diff options
author | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2012-04-22 02:28:35 -0400 |
---|---|---|
committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2012-04-22 02:28:35 -0400 |
commit | 57b8628bb0ac4e47c806e45c5bbd89282e93869b (patch) | |
tree | ee9289f0898054474b7e5054abdb3ffb78666436 /include | |
parent | 486c8aba39e5f194519cd5c0e85e5d1de8b74b03 (diff) | |
parent | 66f75a5d028beaf67c931435fdc3e7823125730c (diff) |
Merge commit 'v3.4-rc4' into next
Diffstat (limited to 'include')
611 files changed, 16412 insertions, 9876 deletions
diff --git a/include/acpi/acconfig.h b/include/acpi/acconfig.h new file mode 100644 index 000000000000..03f14856bd09 --- /dev/null +++ b/include/acpi/acconfig.h | |||
@@ -0,0 +1,248 @@ | |||
1 | /****************************************************************************** | ||
2 | * | ||
3 | * Name: acconfig.h - Global configuration constants | ||
4 | * | ||
5 | *****************************************************************************/ | ||
6 | |||
7 | /* | ||
8 | * Copyright (C) 2000 - 2012, Intel Corp. | ||
9 | * All rights reserved. | ||
10 | * | ||
11 | * Redistribution and use in source and binary forms, with or without | ||
12 | * modification, are permitted provided that the following conditions | ||
13 | * are met: | ||
14 | * 1. Redistributions of source code must retain the above copyright | ||
15 | * notice, this list of conditions, and the following disclaimer, | ||
16 | * without modification. | ||
17 | * 2. Redistributions in binary form must reproduce at minimum a disclaimer | ||
18 | * substantially similar to the "NO WARRANTY" disclaimer below | ||
19 | * ("Disclaimer") and any redistribution must be conditioned upon | ||
20 | * including a substantially similar Disclaimer requirement for further | ||
21 | * binary redistribution. | ||
22 | * 3. Neither the names of the above-listed copyright holders nor the names | ||
23 | * of any contributors may be used to endorse or promote products derived | ||
24 | * from this software without specific prior written permission. | ||
25 | * | ||
26 | * Alternatively, this software may be distributed under the terms of the | ||
27 | * GNU General Public License ("GPL") version 2 as published by the Free | ||
28 | * Software Foundation. | ||
29 | * | ||
30 | * NO WARRANTY | ||
31 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
32 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
33 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR | ||
34 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
35 | * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
36 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
37 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
38 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
39 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING | ||
40 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
41 | * POSSIBILITY OF SUCH DAMAGES. | ||
42 | */ | ||
43 | |||
44 | #ifndef _ACCONFIG_H | ||
45 | #define _ACCONFIG_H | ||
46 | |||
47 | /****************************************************************************** | ||
48 | * | ||
49 | * Configuration options | ||
50 | * | ||
51 | *****************************************************************************/ | ||
52 | |||
53 | /* | ||
54 | * ACPI_DEBUG_OUTPUT - This switch enables all the debug facilities of the | ||
55 | * ACPI subsystem. This includes the DEBUG_PRINT output | ||
56 | * statements. When disabled, all DEBUG_PRINT | ||
57 | * statements are compiled out. | ||
58 | * | ||
59 | * ACPI_APPLICATION - Use this switch if the subsystem is going to be run | ||
60 | * at the application level. | ||
61 | * | ||
62 | */ | ||
63 | |||
64 | /* | ||
65 | * OS name, used for the _OS object. The _OS object is essentially obsolete, | ||
66 | * but there is a large base of ASL/AML code in existing machines that check | ||
67 | * for the string below. The use of this string usually guarantees that | ||
68 | * the ASL will execute down the most tested code path. Also, there is some | ||
69 | * code that will not execute the _OSI method unless _OS matches the string | ||
70 | * below. Therefore, change this string at your own risk. | ||
71 | */ | ||
72 | #define ACPI_OS_NAME "Microsoft Windows NT" | ||
73 | |||
74 | /* Maximum objects in the various object caches */ | ||
75 | |||
76 | #define ACPI_MAX_STATE_CACHE_DEPTH 96 /* State objects */ | ||
77 | #define ACPI_MAX_PARSE_CACHE_DEPTH 96 /* Parse tree objects */ | ||
78 | #define ACPI_MAX_EXTPARSE_CACHE_DEPTH 96 /* Parse tree objects */ | ||
79 | #define ACPI_MAX_OBJECT_CACHE_DEPTH 96 /* Interpreter operand objects */ | ||
80 | #define ACPI_MAX_NAMESPACE_CACHE_DEPTH 96 /* Namespace objects */ | ||
81 | |||
82 | /* | ||
83 | * Should the subsystem abort the loading of an ACPI table if the | ||
84 | * table checksum is incorrect? | ||
85 | */ | ||
86 | #define ACPI_CHECKSUM_ABORT FALSE | ||
87 | |||
88 | /* | ||
89 | * Generate a version of ACPICA that only supports "reduced hardware" | ||
90 | * platforms (as defined in ACPI 5.0). Set to TRUE to generate a specialized | ||
91 | * version of ACPICA that ONLY supports the ACPI 5.0 "reduced hardware" | ||
92 | * model. In other words, no ACPI hardware is supported. | ||
93 | * | ||
94 | * If TRUE, this means no support for the following: | ||
95 | * PM Event and Control registers | ||
96 | * SCI interrupt (and handler) | ||
97 | * Fixed Events | ||
98 | * General Purpose Events (GPEs) | ||
99 | * Global Lock | ||
100 | * ACPI PM timer | ||
101 | * FACS table (Waking vectors and Global Lock) | ||
102 | */ | ||
103 | #define ACPI_REDUCED_HARDWARE FALSE | ||
104 | |||
105 | /****************************************************************************** | ||
106 | * | ||
107 | * Subsystem Constants | ||
108 | * | ||
109 | *****************************************************************************/ | ||
110 | |||
111 | /* Version of ACPI supported */ | ||
112 | |||
113 | #define ACPI_CA_SUPPORT_LEVEL 5 | ||
114 | |||
115 | /* Maximum count for a semaphore object */ | ||
116 | |||
117 | #define ACPI_MAX_SEMAPHORE_COUNT 256 | ||
118 | |||
119 | /* Maximum object reference count (detects object deletion issues) */ | ||
120 | |||
121 | #define ACPI_MAX_REFERENCE_COUNT 0x1000 | ||
122 | |||
123 | /* Default page size for use in mapping memory for operation regions */ | ||
124 | |||
125 | #define ACPI_DEFAULT_PAGE_SIZE 4096 /* Must be power of 2 */ | ||
126 | |||
127 | /* owner_id tracking. 8 entries allows for 255 owner_ids */ | ||
128 | |||
129 | #define ACPI_NUM_OWNERID_MASKS 8 | ||
130 | |||
131 | /* Size of the root table array is increased by this increment */ | ||
132 | |||
133 | #define ACPI_ROOT_TABLE_SIZE_INCREMENT 4 | ||
134 | |||
135 | /* Maximum number of While() loop iterations before forced abort */ | ||
136 | |||
137 | #define ACPI_MAX_LOOP_ITERATIONS 0xFFFF | ||
138 | |||
139 | /* Maximum sleep allowed via Sleep() operator */ | ||
140 | |||
141 | #define ACPI_MAX_SLEEP 2000 /* Two seconds */ | ||
142 | |||
143 | /* Address Range lists are per-space_id (Memory and I/O only) */ | ||
144 | |||
145 | #define ACPI_ADDRESS_RANGE_MAX 2 | ||
146 | |||
147 | /****************************************************************************** | ||
148 | * | ||
149 | * ACPI Specification constants (Do not change unless the specification changes) | ||
150 | * | ||
151 | *****************************************************************************/ | ||
152 | |||
153 | /* Number of distinct GPE register blocks and register width */ | ||
154 | |||
155 | #define ACPI_MAX_GPE_BLOCKS 2 | ||
156 | #define ACPI_GPE_REGISTER_WIDTH 8 | ||
157 | |||
158 | /* Method info (in WALK_STATE), containing local variables and argumetns */ | ||
159 | |||
160 | #define ACPI_METHOD_NUM_LOCALS 8 | ||
161 | #define ACPI_METHOD_MAX_LOCAL 7 | ||
162 | |||
163 | #define ACPI_METHOD_NUM_ARGS 7 | ||
164 | #define ACPI_METHOD_MAX_ARG 6 | ||
165 | |||
166 | /* Length of _HID, _UID, _CID, and UUID values */ | ||
167 | |||
168 | #define ACPI_DEVICE_ID_LENGTH 0x09 | ||
169 | #define ACPI_MAX_CID_LENGTH 48 | ||
170 | #define ACPI_UUID_LENGTH 16 | ||
171 | |||
172 | /* | ||
173 | * Operand Stack (in WALK_STATE), Must be large enough to contain METHOD_MAX_ARG | ||
174 | */ | ||
175 | #define ACPI_OBJ_NUM_OPERANDS 8 | ||
176 | #define ACPI_OBJ_MAX_OPERAND 7 | ||
177 | |||
178 | /* Number of elements in the Result Stack frame, can be an arbitrary value */ | ||
179 | |||
180 | #define ACPI_RESULTS_FRAME_OBJ_NUM 8 | ||
181 | |||
182 | /* | ||
183 | * Maximal number of elements the Result Stack can contain, | ||
184 | * it may be an arbitray value not exceeding the types of | ||
185 | * result_size and result_count (now u8). | ||
186 | */ | ||
187 | #define ACPI_RESULTS_OBJ_NUM_MAX 255 | ||
188 | |||
189 | /* Names within the namespace are 4 bytes long */ | ||
190 | |||
191 | #define ACPI_NAME_SIZE 4 | ||
192 | #define ACPI_PATH_SEGMENT_LENGTH 5 /* 4 chars for name + 1 char for separator */ | ||
193 | #define ACPI_PATH_SEPARATOR '.' | ||
194 | |||
195 | /* Sizes for ACPI table headers */ | ||
196 | |||
197 | #define ACPI_OEM_ID_SIZE 6 | ||
198 | #define ACPI_OEM_TABLE_ID_SIZE 8 | ||
199 | |||
200 | /* Constants used in searching for the RSDP in low memory */ | ||
201 | |||
202 | #define ACPI_EBDA_PTR_LOCATION 0x0000040E /* Physical Address */ | ||
203 | #define ACPI_EBDA_PTR_LENGTH 2 | ||
204 | #define ACPI_EBDA_WINDOW_SIZE 1024 | ||
205 | #define ACPI_HI_RSDP_WINDOW_BASE 0x000E0000 /* Physical Address */ | ||
206 | #define ACPI_HI_RSDP_WINDOW_SIZE 0x00020000 | ||
207 | #define ACPI_RSDP_SCAN_STEP 16 | ||
208 | |||
209 | /* Operation regions */ | ||
210 | |||
211 | #define ACPI_USER_REGION_BEGIN 0x80 | ||
212 | |||
213 | /* Maximum space_ids for Operation Regions */ | ||
214 | |||
215 | #define ACPI_MAX_ADDRESS_SPACE 255 | ||
216 | |||
217 | /* Array sizes. Used for range checking also */ | ||
218 | |||
219 | #define ACPI_MAX_MATCH_OPCODE 5 | ||
220 | |||
221 | /* RSDP checksums */ | ||
222 | |||
223 | #define ACPI_RSDP_CHECKSUM_LENGTH 20 | ||
224 | #define ACPI_RSDP_XCHECKSUM_LENGTH 36 | ||
225 | |||
226 | /* SMBus, GSBus and IPMI bidirectional buffer size */ | ||
227 | |||
228 | #define ACPI_SMBUS_BUFFER_SIZE 34 | ||
229 | #define ACPI_GSBUS_BUFFER_SIZE 34 | ||
230 | #define ACPI_IPMI_BUFFER_SIZE 66 | ||
231 | |||
232 | /* _sx_d and _sx_w control methods */ | ||
233 | |||
234 | #define ACPI_NUM_sx_d_METHODS 4 | ||
235 | #define ACPI_NUM_sx_w_METHODS 5 | ||
236 | |||
237 | /****************************************************************************** | ||
238 | * | ||
239 | * ACPI AML Debugger | ||
240 | * | ||
241 | *****************************************************************************/ | ||
242 | |||
243 | #define ACPI_DEBUGGER_MAX_ARGS 8 /* Must be max method args + 1 */ | ||
244 | |||
245 | #define ACPI_DEBUGGER_COMMAND_PROMPT '-' | ||
246 | #define ACPI_DEBUGGER_EXECUTE_PROMPT '%' | ||
247 | |||
248 | #endif /* _ACCONFIG_H */ | ||
diff --git a/include/acpi/acexcep.h b/include/acpi/acexcep.h index 5b6c391efc8e..92d6e1d701ff 100644 --- a/include/acpi/acexcep.h +++ b/include/acpi/acexcep.h | |||
@@ -57,6 +57,7 @@ | |||
57 | #define ACPI_SUCCESS(a) (!(a)) | 57 | #define ACPI_SUCCESS(a) (!(a)) |
58 | #define ACPI_FAILURE(a) (a) | 58 | #define ACPI_FAILURE(a) (a) |
59 | 59 | ||
60 | #define ACPI_SKIP(a) (a == AE_CTRL_SKIP) | ||
60 | #define AE_OK (acpi_status) 0x0000 | 61 | #define AE_OK (acpi_status) 0x0000 |
61 | 62 | ||
62 | /* | 63 | /* |
@@ -89,8 +90,9 @@ | |||
89 | #define AE_SAME_HANDLER (acpi_status) (0x0019 | AE_CODE_ENVIRONMENTAL) | 90 | #define AE_SAME_HANDLER (acpi_status) (0x0019 | AE_CODE_ENVIRONMENTAL) |
90 | #define AE_NO_HANDLER (acpi_status) (0x001A | AE_CODE_ENVIRONMENTAL) | 91 | #define AE_NO_HANDLER (acpi_status) (0x001A | AE_CODE_ENVIRONMENTAL) |
91 | #define AE_OWNER_ID_LIMIT (acpi_status) (0x001B | AE_CODE_ENVIRONMENTAL) | 92 | #define AE_OWNER_ID_LIMIT (acpi_status) (0x001B | AE_CODE_ENVIRONMENTAL) |
93 | #define AE_NOT_CONFIGURED (acpi_status) (0x001C | AE_CODE_ENVIRONMENTAL) | ||
92 | 94 | ||
93 | #define AE_CODE_ENV_MAX 0x001B | 95 | #define AE_CODE_ENV_MAX 0x001C |
94 | 96 | ||
95 | /* | 97 | /* |
96 | * Programmer exceptions | 98 | * Programmer exceptions |
@@ -213,7 +215,8 @@ char const *acpi_gbl_exception_names_env[] = { | |||
213 | "AE_ABORT_METHOD", | 215 | "AE_ABORT_METHOD", |
214 | "AE_SAME_HANDLER", | 216 | "AE_SAME_HANDLER", |
215 | "AE_NO_HANDLER", | 217 | "AE_NO_HANDLER", |
216 | "AE_OWNER_ID_LIMIT" | 218 | "AE_OWNER_ID_LIMIT", |
219 | "AE_NOT_CONFIGURED" | ||
217 | }; | 220 | }; |
218 | 221 | ||
219 | char const *acpi_gbl_exception_names_pgm[] = { | 222 | char const *acpi_gbl_exception_names_pgm[] = { |
diff --git a/include/acpi/acnames.h b/include/acpi/acnames.h index 5b5af0d30a97..38f508816e4a 100644 --- a/include/acpi/acnames.h +++ b/include/acpi/acnames.h | |||
@@ -46,6 +46,7 @@ | |||
46 | 46 | ||
47 | /* Method names - these methods can appear anywhere in the namespace */ | 47 | /* Method names - these methods can appear anywhere in the namespace */ |
48 | 48 | ||
49 | #define METHOD_NAME__SB_ "_SB_" | ||
49 | #define METHOD_NAME__HID "_HID" | 50 | #define METHOD_NAME__HID "_HID" |
50 | #define METHOD_NAME__CID "_CID" | 51 | #define METHOD_NAME__CID "_CID" |
51 | #define METHOD_NAME__UID "_UID" | 52 | #define METHOD_NAME__UID "_UID" |
@@ -64,11 +65,11 @@ | |||
64 | 65 | ||
65 | /* Method names - these methods must appear at the namespace root */ | 66 | /* Method names - these methods must appear at the namespace root */ |
66 | 67 | ||
67 | #define METHOD_NAME__BFS "\\_BFS" | 68 | #define METHOD_PATHNAME__BFS "\\_BFS" |
68 | #define METHOD_NAME__GTS "\\_GTS" | 69 | #define METHOD_PATHNAME__GTS "\\_GTS" |
69 | #define METHOD_NAME__PTS "\\_PTS" | 70 | #define METHOD_PATHNAME__PTS "\\_PTS" |
70 | #define METHOD_NAME__SST "\\_SI._SST" | 71 | #define METHOD_PATHNAME__SST "\\_SI._SST" |
71 | #define METHOD_NAME__WAK "\\_WAK" | 72 | #define METHOD_PATHNAME__WAK "\\_WAK" |
72 | 73 | ||
73 | /* Definitions of the predefined namespace names */ | 74 | /* Definitions of the predefined namespace names */ |
74 | 75 | ||
@@ -79,6 +80,5 @@ | |||
79 | #define ACPI_PREFIX_LOWER (u32) 0x69706361 /* "acpi" */ | 80 | #define ACPI_PREFIX_LOWER (u32) 0x69706361 /* "acpi" */ |
80 | 81 | ||
81 | #define ACPI_NS_ROOT_PATH "\\" | 82 | #define ACPI_NS_ROOT_PATH "\\" |
82 | #define ACPI_NS_SYSTEM_BUS "_SB_" | ||
83 | 83 | ||
84 | #endif /* __ACNAMES_H__ */ | 84 | #endif /* __ACNAMES_H__ */ |
diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h index 6cd5b6403a7b..f1c8ca60e824 100644 --- a/include/acpi/acpi_bus.h +++ b/include/acpi/acpi_bus.h | |||
@@ -323,6 +323,8 @@ int acpi_bus_set_power(acpi_handle handle, int state); | |||
323 | int acpi_bus_update_power(acpi_handle handle, int *state_p); | 323 | int acpi_bus_update_power(acpi_handle handle, int *state_p); |
324 | bool acpi_bus_power_manageable(acpi_handle handle); | 324 | bool acpi_bus_power_manageable(acpi_handle handle); |
325 | bool acpi_bus_can_wakeup(acpi_handle handle); | 325 | bool acpi_bus_can_wakeup(acpi_handle handle); |
326 | int acpi_power_resource_register_device(struct device *dev, acpi_handle handle); | ||
327 | void acpi_power_resource_unregister_device(struct device *dev, acpi_handle handle); | ||
326 | #ifdef CONFIG_ACPI_PROC_EVENT | 328 | #ifdef CONFIG_ACPI_PROC_EVENT |
327 | int acpi_bus_generate_proc_event(struct acpi_device *device, u8 type, int data); | 329 | int acpi_bus_generate_proc_event(struct acpi_device *device, u8 type, int data); |
328 | int acpi_bus_generate_proc_event4(const char *class, const char *bid, u8 type, int data); | 330 | int acpi_bus_generate_proc_event4(const char *class, const char *bid, u8 type, int data); |
@@ -392,8 +394,13 @@ static inline int acpi_pm_device_sleep_state(struct device *d, int *p) | |||
392 | #endif | 394 | #endif |
393 | 395 | ||
394 | #ifdef CONFIG_PM_SLEEP | 396 | #ifdef CONFIG_PM_SLEEP |
397 | int acpi_pm_device_run_wake(struct device *, bool); | ||
395 | int acpi_pm_device_sleep_wake(struct device *, bool); | 398 | int acpi_pm_device_sleep_wake(struct device *, bool); |
396 | #else | 399 | #else |
400 | static inline int acpi_pm_device_run_wake(struct device *dev, bool enable) | ||
401 | { | ||
402 | return -ENODEV; | ||
403 | } | ||
397 | static inline int acpi_pm_device_sleep_wake(struct device *dev, bool enable) | 404 | static inline int acpi_pm_device_sleep_wake(struct device *dev, bool enable) |
398 | { | 405 | { |
399 | return -ENODEV; | 406 | return -ENODEV; |
diff --git a/include/acpi/acpiosxf.h b/include/acpi/acpiosxf.h index 7c9aebe8a7aa..21a5548c6686 100644 --- a/include/acpi/acpiosxf.h +++ b/include/acpi/acpiosxf.h | |||
@@ -95,6 +95,11 @@ acpi_status | |||
95 | acpi_os_table_override(struct acpi_table_header *existing_table, | 95 | acpi_os_table_override(struct acpi_table_header *existing_table, |
96 | struct acpi_table_header **new_table); | 96 | struct acpi_table_header **new_table); |
97 | 97 | ||
98 | acpi_status | ||
99 | acpi_os_physical_table_override(struct acpi_table_header *existing_table, | ||
100 | acpi_physical_address * new_address, | ||
101 | u32 *new_table_length); | ||
102 | |||
98 | /* | 103 | /* |
99 | * Spinlock primitives | 104 | * Spinlock primitives |
100 | */ | 105 | */ |
@@ -217,14 +222,10 @@ acpi_status acpi_os_write_port(acpi_io_address address, u32 value, u32 width); | |||
217 | * Platform and hardware-independent physical memory interfaces | 222 | * Platform and hardware-independent physical memory interfaces |
218 | */ | 223 | */ |
219 | acpi_status | 224 | acpi_status |
220 | acpi_os_read_memory(acpi_physical_address address, u32 * value, u32 width); | 225 | acpi_os_read_memory(acpi_physical_address address, u64 *value, u32 width); |
221 | acpi_status | ||
222 | acpi_os_read_memory64(acpi_physical_address address, u64 *value, u32 width); | ||
223 | 226 | ||
224 | acpi_status | 227 | acpi_status |
225 | acpi_os_write_memory(acpi_physical_address address, u32 value, u32 width); | 228 | acpi_os_write_memory(acpi_physical_address address, u64 value, u32 width); |
226 | acpi_status | ||
227 | acpi_os_write_memory64(acpi_physical_address address, u64 value, u32 width); | ||
228 | 229 | ||
229 | /* | 230 | /* |
230 | * Platform and hardware-independent PCI configuration space access | 231 | * Platform and hardware-independent PCI configuration space access |
diff --git a/include/acpi/acpixf.h b/include/acpi/acpixf.h index a28da35ba45e..982110134672 100644 --- a/include/acpi/acpixf.h +++ b/include/acpi/acpixf.h | |||
@@ -47,8 +47,9 @@ | |||
47 | 47 | ||
48 | /* Current ACPICA subsystem version in YYYYMMDD format */ | 48 | /* Current ACPICA subsystem version in YYYYMMDD format */ |
49 | 49 | ||
50 | #define ACPI_CA_VERSION 0x20120111 | 50 | #define ACPI_CA_VERSION 0x20120320 |
51 | 51 | ||
52 | #include "acconfig.h" | ||
52 | #include "actypes.h" | 53 | #include "actypes.h" |
53 | #include "actbl.h" | 54 | #include "actbl.h" |
54 | 55 | ||
@@ -71,6 +72,33 @@ extern u8 acpi_gbl_copy_dsdt_locally; | |||
71 | extern u8 acpi_gbl_truncate_io_addresses; | 72 | extern u8 acpi_gbl_truncate_io_addresses; |
72 | extern u8 acpi_gbl_disable_auto_repair; | 73 | extern u8 acpi_gbl_disable_auto_repair; |
73 | 74 | ||
75 | /* | ||
76 | * Hardware-reduced prototypes. All interfaces that use these macros will | ||
77 | * be configured out of the ACPICA build if the ACPI_REDUCED_HARDWARE flag | ||
78 | * is set to TRUE. | ||
79 | */ | ||
80 | #if (!ACPI_REDUCED_HARDWARE) | ||
81 | #define ACPI_HW_DEPENDENT_RETURN_STATUS(prototype) \ | ||
82 | prototype; | ||
83 | |||
84 | #define ACPI_HW_DEPENDENT_RETURN_OK(prototype) \ | ||
85 | prototype; | ||
86 | |||
87 | #define ACPI_HW_DEPENDENT_RETURN_VOID(prototype) \ | ||
88 | prototype; | ||
89 | |||
90 | #else | ||
91 | #define ACPI_HW_DEPENDENT_RETURN_STATUS(prototype) \ | ||
92 | static ACPI_INLINE prototype {return(AE_NOT_CONFIGURED);} | ||
93 | |||
94 | #define ACPI_HW_DEPENDENT_RETURN_OK(prototype) \ | ||
95 | static ACPI_INLINE prototype {return(AE_OK);} | ||
96 | |||
97 | #define ACPI_HW_DEPENDENT_RETURN_VOID(prototype) \ | ||
98 | static ACPI_INLINE prototype {} | ||
99 | |||
100 | #endif /* !ACPI_REDUCED_HARDWARE */ | ||
101 | |||
74 | extern u32 acpi_current_gpe_count; | 102 | extern u32 acpi_current_gpe_count; |
75 | extern struct acpi_table_fadt acpi_gbl_FADT; | 103 | extern struct acpi_table_fadt acpi_gbl_FADT; |
76 | extern u8 acpi_gbl_system_awake_and_running; | 104 | extern u8 acpi_gbl_system_awake_and_running; |
@@ -96,9 +124,8 @@ acpi_status acpi_terminate(void); | |||
96 | acpi_status acpi_subsystem_status(void); | 124 | acpi_status acpi_subsystem_status(void); |
97 | #endif | 125 | #endif |
98 | 126 | ||
99 | acpi_status acpi_enable(void); | 127 | ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status acpi_enable(void)) |
100 | 128 | ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status acpi_disable(void)) | |
101 | acpi_status acpi_disable(void); | ||
102 | 129 | ||
103 | #ifdef ACPI_FUTURE_USAGE | 130 | #ifdef ACPI_FUTURE_USAGE |
104 | acpi_status acpi_get_system_info(struct acpi_buffer *ret_buffer); | 131 | acpi_status acpi_get_system_info(struct acpi_buffer *ret_buffer); |
@@ -235,17 +262,34 @@ acpi_status acpi_get_parent(acpi_handle object, acpi_handle * out_handle); | |||
235 | acpi_status | 262 | acpi_status |
236 | acpi_install_initialization_handler(acpi_init_handler handler, u32 function); | 263 | acpi_install_initialization_handler(acpi_init_handler handler, u32 function); |
237 | 264 | ||
238 | acpi_status | 265 | ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status |
239 | acpi_install_global_event_handler(ACPI_GBL_EVENT_HANDLER handler, | 266 | acpi_install_global_event_handler |
240 | void *context); | 267 | (ACPI_GBL_EVENT_HANDLER handler, void *context)) |
241 | 268 | ||
242 | acpi_status | 269 | ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status |
243 | acpi_install_fixed_event_handler(u32 acpi_event, | 270 | acpi_install_fixed_event_handler(u32 |
244 | acpi_event_handler handler, void *context); | 271 | acpi_event, |
245 | 272 | acpi_event_handler | |
246 | acpi_status | 273 | handler, |
247 | acpi_remove_fixed_event_handler(u32 acpi_event, acpi_event_handler handler); | 274 | void |
248 | 275 | *context)) | |
276 | ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status | ||
277 | acpi_remove_fixed_event_handler(u32 acpi_event, | ||
278 | acpi_event_handler | ||
279 | handler)) | ||
280 | ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status | ||
281 | acpi_install_gpe_handler(acpi_handle | ||
282 | gpe_device, | ||
283 | u32 gpe_number, | ||
284 | u32 type, | ||
285 | acpi_gpe_handler | ||
286 | address, | ||
287 | void *context)) | ||
288 | ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status | ||
289 | acpi_remove_gpe_handler(acpi_handle gpe_device, | ||
290 | u32 gpe_number, | ||
291 | acpi_gpe_handler | ||
292 | address)) | ||
249 | acpi_status | 293 | acpi_status |
250 | acpi_install_notify_handler(acpi_handle device, | 294 | acpi_install_notify_handler(acpi_handle device, |
251 | u32 handler_type, | 295 | u32 handler_type, |
@@ -266,15 +310,6 @@ acpi_remove_address_space_handler(acpi_handle device, | |||
266 | acpi_adr_space_type space_id, | 310 | acpi_adr_space_type space_id, |
267 | acpi_adr_space_handler handler); | 311 | acpi_adr_space_handler handler); |
268 | 312 | ||
269 | acpi_status | ||
270 | acpi_install_gpe_handler(acpi_handle gpe_device, | ||
271 | u32 gpe_number, | ||
272 | u32 type, acpi_gpe_handler address, void *context); | ||
273 | |||
274 | acpi_status | ||
275 | acpi_remove_gpe_handler(acpi_handle gpe_device, | ||
276 | u32 gpe_number, acpi_gpe_handler address); | ||
277 | |||
278 | #ifdef ACPI_FUTURE_USAGE | 313 | #ifdef ACPI_FUTURE_USAGE |
279 | acpi_status acpi_install_exception_handler(acpi_exception_handler handler); | 314 | acpi_status acpi_install_exception_handler(acpi_exception_handler handler); |
280 | #endif | 315 | #endif |
@@ -284,9 +319,11 @@ acpi_status acpi_install_interface_handler(acpi_interface_handler handler); | |||
284 | /* | 319 | /* |
285 | * Global Lock interfaces | 320 | * Global Lock interfaces |
286 | */ | 321 | */ |
287 | acpi_status acpi_acquire_global_lock(u16 timeout, u32 * handle); | 322 | ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status |
288 | 323 | acpi_acquire_global_lock(u16 timeout, | |
289 | acpi_status acpi_release_global_lock(u32 handle); | 324 | u32 *handle)) |
325 | ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status | ||
326 | acpi_release_global_lock(u32 handle)) | ||
290 | 327 | ||
291 | /* | 328 | /* |
292 | * Interfaces to AML mutex objects | 329 | * Interfaces to AML mutex objects |
@@ -299,47 +336,75 @@ acpi_status acpi_release_mutex(acpi_handle handle, acpi_string pathname); | |||
299 | /* | 336 | /* |
300 | * Fixed Event interfaces | 337 | * Fixed Event interfaces |
301 | */ | 338 | */ |
302 | acpi_status acpi_enable_event(u32 event, u32 flags); | 339 | ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status |
303 | 340 | acpi_enable_event(u32 event, u32 flags)) | |
304 | acpi_status acpi_disable_event(u32 event, u32 flags); | ||
305 | 341 | ||
306 | acpi_status acpi_clear_event(u32 event); | 342 | ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status |
343 | acpi_disable_event(u32 event, u32 flags)) | ||
307 | 344 | ||
308 | acpi_status acpi_get_event_status(u32 event, acpi_event_status * event_status); | 345 | ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status acpi_clear_event(u32 event)) |
309 | 346 | ||
347 | ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status | ||
348 | acpi_get_event_status(u32 event, | ||
349 | acpi_event_status | ||
350 | *event_status)) | ||
310 | /* | 351 | /* |
311 | * General Purpose Event (GPE) Interfaces | 352 | * General Purpose Event (GPE) Interfaces |
312 | */ | 353 | */ |
313 | acpi_status acpi_enable_gpe(acpi_handle gpe_device, u32 gpe_number); | 354 | ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status acpi_update_all_gpes(void)) |
314 | 355 | ||
315 | acpi_status acpi_disable_gpe(acpi_handle gpe_device, u32 gpe_number); | 356 | ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status |
316 | 357 | acpi_enable_gpe(acpi_handle gpe_device, | |
317 | acpi_status acpi_clear_gpe(acpi_handle gpe_device, u32 gpe_number); | 358 | u32 gpe_number)) |
318 | 359 | ||
319 | acpi_status | 360 | ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status |
320 | acpi_setup_gpe_for_wake(acpi_handle parent_device, | 361 | acpi_disable_gpe(acpi_handle gpe_device, |
321 | acpi_handle gpe_device, u32 gpe_number); | 362 | u32 gpe_number)) |
322 | 363 | ||
323 | acpi_status acpi_set_gpe_wake_mask(acpi_handle gpe_device, u32 gpe_number, u8 action); | 364 | ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status |
324 | 365 | acpi_clear_gpe(acpi_handle gpe_device, | |
325 | acpi_status | 366 | u32 gpe_number)) |
326 | acpi_get_gpe_status(acpi_handle gpe_device, | 367 | |
327 | u32 gpe_number, acpi_event_status *event_status); | 368 | ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status |
328 | 369 | acpi_set_gpe(acpi_handle gpe_device, | |
329 | acpi_status acpi_disable_all_gpes(void); | 370 | u32 gpe_number, u8 action)) |
330 | 371 | ||
331 | acpi_status acpi_enable_all_runtime_gpes(void); | 372 | ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status |
332 | 373 | acpi_finish_gpe(acpi_handle gpe_device, | |
333 | acpi_status acpi_get_gpe_device(u32 gpe_index, acpi_handle *gpe_device); | 374 | u32 gpe_number)) |
334 | 375 | ||
335 | acpi_status | 376 | ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status |
336 | acpi_install_gpe_block(acpi_handle gpe_device, | 377 | acpi_setup_gpe_for_wake(acpi_handle |
337 | struct acpi_generic_address *gpe_block_address, | 378 | parent_device, |
338 | u32 register_count, u32 interrupt_number); | 379 | acpi_handle gpe_device, |
339 | 380 | u32 gpe_number)) | |
340 | acpi_status acpi_remove_gpe_block(acpi_handle gpe_device); | 381 | ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status |
341 | 382 | acpi_set_gpe_wake_mask(acpi_handle gpe_device, | |
342 | acpi_status acpi_update_all_gpes(void); | 383 | u32 gpe_number, |
384 | u8 action)) | ||
385 | ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status | ||
386 | acpi_get_gpe_status(acpi_handle gpe_device, | ||
387 | u32 gpe_number, | ||
388 | acpi_event_status | ||
389 | *event_status)) | ||
390 | |||
391 | ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status acpi_disable_all_gpes(void)) | ||
392 | |||
393 | ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status acpi_enable_all_runtime_gpes(void)) | ||
394 | |||
395 | ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status | ||
396 | acpi_get_gpe_device(u32 gpe_index, | ||
397 | acpi_handle * gpe_device)) | ||
398 | |||
399 | ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status | ||
400 | acpi_install_gpe_block(acpi_handle gpe_device, | ||
401 | struct | ||
402 | acpi_generic_address | ||
403 | *gpe_block_address, | ||
404 | u32 register_count, | ||
405 | u32 interrupt_number)) | ||
406 | ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status | ||
407 | acpi_remove_gpe_block(acpi_handle gpe_device)) | ||
343 | 408 | ||
344 | /* | 409 | /* |
345 | * Resource interfaces | 410 | * Resource interfaces |
@@ -391,34 +456,60 @@ acpi_buffer_to_resource(u8 *aml_buffer, | |||
391 | */ | 456 | */ |
392 | acpi_status acpi_reset(void); | 457 | acpi_status acpi_reset(void); |
393 | 458 | ||
394 | acpi_status acpi_read_bit_register(u32 register_id, u32 *return_value); | 459 | ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status |
460 | acpi_read_bit_register(u32 register_id, | ||
461 | u32 *return_value)) | ||
395 | 462 | ||
396 | acpi_status acpi_write_bit_register(u32 register_id, u32 value); | 463 | ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status |
464 | acpi_write_bit_register(u32 register_id, | ||
465 | u32 value)) | ||
397 | 466 | ||
398 | acpi_status acpi_set_firmware_waking_vector(u32 physical_address); | 467 | ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status |
468 | acpi_set_firmware_waking_vector(u32 | ||
469 | physical_address)) | ||
399 | 470 | ||
400 | #if ACPI_MACHINE_WIDTH == 64 | 471 | #if ACPI_MACHINE_WIDTH == 64 |
401 | acpi_status acpi_set_firmware_waking_vector64(u64 physical_address); | 472 | ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status |
473 | acpi_set_firmware_waking_vector64(u64 | ||
474 | physical_address)) | ||
402 | #endif | 475 | #endif |
403 | 476 | ||
404 | acpi_status acpi_read(u64 *value, struct acpi_generic_address *reg); | 477 | acpi_status acpi_read(u64 *value, struct acpi_generic_address *reg); |
405 | 478 | ||
406 | acpi_status acpi_write(u64 value, struct acpi_generic_address *reg); | 479 | acpi_status acpi_write(u64 value, struct acpi_generic_address *reg); |
407 | 480 | ||
481 | /* | ||
482 | * Sleep/Wake interfaces | ||
483 | */ | ||
408 | acpi_status | 484 | acpi_status |
409 | acpi_get_sleep_type_data(u8 sleep_state, u8 * slp_typ_a, u8 * slp_typ_b); | 485 | acpi_get_sleep_type_data(u8 sleep_state, u8 * slp_typ_a, u8 * slp_typ_b); |
410 | 486 | ||
411 | acpi_status acpi_enter_sleep_state_prep(u8 sleep_state); | 487 | acpi_status acpi_enter_sleep_state_prep(u8 sleep_state); |
412 | 488 | ||
413 | acpi_status asmlinkage acpi_enter_sleep_state(u8 sleep_state); | 489 | acpi_status asmlinkage acpi_enter_sleep_state(u8 sleep_state, u8 flags); |
414 | 490 | ||
415 | acpi_status asmlinkage acpi_enter_sleep_state_s4bios(void); | 491 | ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status asmlinkage acpi_enter_sleep_state_s4bios(void)) |
416 | 492 | ||
417 | acpi_status acpi_leave_sleep_state_prep(u8 sleep_state); | 493 | acpi_status acpi_leave_sleep_state_prep(u8 sleep_state, u8 flags); |
418 | 494 | ||
419 | acpi_status acpi_leave_sleep_state(u8 sleep_state); | 495 | acpi_status acpi_leave_sleep_state(u8 sleep_state); |
420 | 496 | ||
421 | /* | 497 | /* |
498 | * ACPI Timer interfaces | ||
499 | */ | ||
500 | #ifdef ACPI_FUTURE_USAGE | ||
501 | ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status | ||
502 | acpi_get_timer_resolution(u32 *resolution)) | ||
503 | |||
504 | ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status acpi_get_timer(u32 *ticks)) | ||
505 | |||
506 | ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status | ||
507 | acpi_get_timer_duration(u32 start_ticks, | ||
508 | u32 end_ticks, | ||
509 | u32 *time_elapsed)) | ||
510 | #endif /* ACPI_FUTURE_USAGE */ | ||
511 | |||
512 | /* | ||
422 | * Error/Warning output | 513 | * Error/Warning output |
423 | */ | 514 | */ |
424 | void ACPI_INTERNAL_VAR_XFACE | 515 | void ACPI_INTERNAL_VAR_XFACE |
diff --git a/include/acpi/actbl.h b/include/acpi/actbl.h index 8e1b92f6f650..8dea54665dcf 100644 --- a/include/acpi/actbl.h +++ b/include/acpi/actbl.h | |||
@@ -309,6 +309,13 @@ enum acpi_prefered_pm_profiles { | |||
309 | PM_TABLET = 8 | 309 | PM_TABLET = 8 |
310 | }; | 310 | }; |
311 | 311 | ||
312 | /* Values for sleep_status and sleep_control registers (V5 FADT) */ | ||
313 | |||
314 | #define ACPI_X_WAKE_STATUS 0x80 | ||
315 | #define ACPI_X_SLEEP_TYPE_MASK 0x1C | ||
316 | #define ACPI_X_SLEEP_TYPE_POSITION 0x02 | ||
317 | #define ACPI_X_SLEEP_ENABLE 0x20 | ||
318 | |||
312 | /* Reset to default packing */ | 319 | /* Reset to default packing */ |
313 | 320 | ||
314 | #pragma pack() | 321 | #pragma pack() |
diff --git a/include/acpi/actypes.h b/include/acpi/actypes.h index d5dee7ce9474..eba66043cf1b 100644 --- a/include/acpi/actypes.h +++ b/include/acpi/actypes.h | |||
@@ -518,6 +518,13 @@ typedef u64 acpi_integer; | |||
518 | #define ACPI_SLEEP_TYPE_INVALID 0xFF | 518 | #define ACPI_SLEEP_TYPE_INVALID 0xFF |
519 | 519 | ||
520 | /* | 520 | /* |
521 | * Sleep/Wake flags | ||
522 | */ | ||
523 | #define ACPI_NO_OPTIONAL_METHODS 0x00 /* Do not execute any optional methods */ | ||
524 | #define ACPI_EXECUTE_GTS 0x01 /* For enter sleep interface */ | ||
525 | #define ACPI_EXECUTE_BFS 0x02 /* For leave sleep prep interface */ | ||
526 | |||
527 | /* | ||
521 | * Standard notify values | 528 | * Standard notify values |
522 | */ | 529 | */ |
523 | #define ACPI_NOTIFY_BUS_CHECK (u8) 0x00 | 530 | #define ACPI_NOTIFY_BUS_CHECK (u8) 0x00 |
@@ -532,8 +539,9 @@ typedef u64 acpi_integer; | |||
532 | #define ACPI_NOTIFY_DEVICE_PLD_CHECK (u8) 0x09 | 539 | #define ACPI_NOTIFY_DEVICE_PLD_CHECK (u8) 0x09 |
533 | #define ACPI_NOTIFY_RESERVED (u8) 0x0A | 540 | #define ACPI_NOTIFY_RESERVED (u8) 0x0A |
534 | #define ACPI_NOTIFY_LOCALITY_UPDATE (u8) 0x0B | 541 | #define ACPI_NOTIFY_LOCALITY_UPDATE (u8) 0x0B |
542 | #define ACPI_NOTIFY_SHUTDOWN_REQUEST (u8) 0x0C | ||
535 | 543 | ||
536 | #define ACPI_NOTIFY_MAX 0x0B | 544 | #define ACPI_NOTIFY_MAX 0x0C |
537 | 545 | ||
538 | /* | 546 | /* |
539 | * Types associated with ACPI names and objects. The first group of | 547 | * Types associated with ACPI names and objects. The first group of |
@@ -698,7 +706,8 @@ typedef u32 acpi_event_status; | |||
698 | #define ACPI_ALL_NOTIFY (ACPI_SYSTEM_NOTIFY | ACPI_DEVICE_NOTIFY) | 706 | #define ACPI_ALL_NOTIFY (ACPI_SYSTEM_NOTIFY | ACPI_DEVICE_NOTIFY) |
699 | #define ACPI_MAX_NOTIFY_HANDLER_TYPE 0x3 | 707 | #define ACPI_MAX_NOTIFY_HANDLER_TYPE 0x3 |
700 | 708 | ||
701 | #define ACPI_MAX_SYS_NOTIFY 0x7f | 709 | #define ACPI_MAX_SYS_NOTIFY 0x7F |
710 | #define ACPI_MAX_DEVICE_SPECIFIC_NOTIFY 0xBF | ||
702 | 711 | ||
703 | /* Address Space (Operation Region) Types */ | 712 | /* Address Space (Operation Region) Types */ |
704 | 713 | ||
@@ -786,6 +795,15 @@ typedef u8 acpi_adr_space_type; | |||
786 | #define ACPI_ENABLE_EVENT 1 | 795 | #define ACPI_ENABLE_EVENT 1 |
787 | #define ACPI_DISABLE_EVENT 0 | 796 | #define ACPI_DISABLE_EVENT 0 |
788 | 797 | ||
798 | /* Sleep function dispatch */ | ||
799 | |||
800 | typedef acpi_status(*ACPI_SLEEP_FUNCTION) (u8 sleep_state, u8 flags); | ||
801 | |||
802 | struct acpi_sleep_functions { | ||
803 | ACPI_SLEEP_FUNCTION legacy_function; | ||
804 | ACPI_SLEEP_FUNCTION extended_function; | ||
805 | }; | ||
806 | |||
789 | /* | 807 | /* |
790 | * External ACPI object definition | 808 | * External ACPI object definition |
791 | */ | 809 | */ |
diff --git a/include/acpi/platform/aclinux.h b/include/acpi/platform/aclinux.h index f4b2effe0333..6fbc4cab5834 100644 --- a/include/acpi/platform/aclinux.h +++ b/include/acpi/platform/aclinux.h | |||
@@ -57,7 +57,6 @@ | |||
57 | #include <linux/kernel.h> | 57 | #include <linux/kernel.h> |
58 | #include <linux/ctype.h> | 58 | #include <linux/ctype.h> |
59 | #include <linux/sched.h> | 59 | #include <linux/sched.h> |
60 | #include <asm/system.h> | ||
61 | #include <linux/atomic.h> | 60 | #include <linux/atomic.h> |
62 | #include <asm/div64.h> | 61 | #include <asm/div64.h> |
63 | #include <asm/acpi.h> | 62 | #include <asm/acpi.h> |
diff --git a/include/acpi/processor.h b/include/acpi/processor.h index 8cf7e98a2c7b..9d650476d5dc 100644 --- a/include/acpi/processor.h +++ b/include/acpi/processor.h | |||
@@ -225,6 +225,7 @@ struct acpi_processor_errata { | |||
225 | } piix4; | 225 | } piix4; |
226 | }; | 226 | }; |
227 | 227 | ||
228 | extern void acpi_processor_load_module(struct acpi_processor *pr); | ||
228 | extern int acpi_processor_preregister_performance(struct | 229 | extern int acpi_processor_preregister_performance(struct |
229 | acpi_processor_performance | 230 | acpi_processor_performance |
230 | __percpu *performance); | 231 | __percpu *performance); |
diff --git a/include/asm-generic/atomic.h b/include/asm-generic/atomic.h index e37963c1df4d..1ced6413ea03 100644 --- a/include/asm-generic/atomic.h +++ b/include/asm-generic/atomic.h | |||
@@ -15,6 +15,8 @@ | |||
15 | #ifndef __ASM_GENERIC_ATOMIC_H | 15 | #ifndef __ASM_GENERIC_ATOMIC_H |
16 | #define __ASM_GENERIC_ATOMIC_H | 16 | #define __ASM_GENERIC_ATOMIC_H |
17 | 17 | ||
18 | #include <asm/cmpxchg.h> | ||
19 | |||
18 | #ifdef CONFIG_SMP | 20 | #ifdef CONFIG_SMP |
19 | /* Force people to define core atomics */ | 21 | /* Force people to define core atomics */ |
20 | # if !defined(atomic_add_return) || !defined(atomic_sub_return) || \ | 22 | # if !defined(atomic_add_return) || !defined(atomic_sub_return) || \ |
@@ -52,7 +54,6 @@ | |||
52 | #define atomic_set(v, i) (((v)->counter) = (i)) | 54 | #define atomic_set(v, i) (((v)->counter) = (i)) |
53 | 55 | ||
54 | #include <linux/irqflags.h> | 56 | #include <linux/irqflags.h> |
55 | #include <asm/system.h> | ||
56 | 57 | ||
57 | /** | 58 | /** |
58 | * atomic_add_return - add integer to atomic variable | 59 | * atomic_add_return - add integer to atomic variable |
diff --git a/include/asm-generic/barrier.h b/include/asm-generic/barrier.h new file mode 100644 index 000000000000..639d7a4d033b --- /dev/null +++ b/include/asm-generic/barrier.h | |||
@@ -0,0 +1,50 @@ | |||
1 | /* Generic barrier definitions, based on MN10300 definitions. | ||
2 | * | ||
3 | * It should be possible to use these on really simple architectures, | ||
4 | * but it serves more as a starting point for new ports. | ||
5 | * | ||
6 | * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. | ||
7 | * Written by David Howells (dhowells@redhat.com) | ||
8 | * | ||
9 | * This program is free software; you can redistribute it and/or | ||
10 | * modify it under the terms of the GNU General Public Licence | ||
11 | * as published by the Free Software Foundation; either version | ||
12 | * 2 of the Licence, or (at your option) any later version. | ||
13 | */ | ||
14 | #ifndef __ASM_GENERIC_BARRIER_H | ||
15 | #define __ASM_GENERIC_BARRIER_H | ||
16 | |||
17 | #ifndef __ASSEMBLY__ | ||
18 | |||
19 | #define nop() asm volatile ("nop") | ||
20 | |||
21 | /* | ||
22 | * Force strict CPU ordering. | ||
23 | * And yes, this is required on UP too when we're talking | ||
24 | * to devices. | ||
25 | * | ||
26 | * This implementation only contains a compiler barrier. | ||
27 | */ | ||
28 | |||
29 | #define mb() asm volatile ("": : :"memory") | ||
30 | #define rmb() mb() | ||
31 | #define wmb() asm volatile ("": : :"memory") | ||
32 | |||
33 | #ifdef CONFIG_SMP | ||
34 | #define smp_mb() mb() | ||
35 | #define smp_rmb() rmb() | ||
36 | #define smp_wmb() wmb() | ||
37 | #else | ||
38 | #define smp_mb() barrier() | ||
39 | #define smp_rmb() barrier() | ||
40 | #define smp_wmb() barrier() | ||
41 | #endif | ||
42 | |||
43 | #define set_mb(var, value) do { var = value; mb(); } while (0) | ||
44 | #define set_wmb(var, value) do { var = value; wmb(); } while (0) | ||
45 | |||
46 | #define read_barrier_depends() do {} while (0) | ||
47 | #define smp_read_barrier_depends() do {} while (0) | ||
48 | |||
49 | #endif /* !__ASSEMBLY__ */ | ||
50 | #endif /* __ASM_GENERIC_BARRIER_H */ | ||
diff --git a/include/asm-generic/bitops/atomic.h b/include/asm-generic/bitops/atomic.h index ecc44a8e2b44..9ae6c34dc191 100644 --- a/include/asm-generic/bitops/atomic.h +++ b/include/asm-generic/bitops/atomic.h | |||
@@ -2,7 +2,7 @@ | |||
2 | #define _ASM_GENERIC_BITOPS_ATOMIC_H_ | 2 | #define _ASM_GENERIC_BITOPS_ATOMIC_H_ |
3 | 3 | ||
4 | #include <asm/types.h> | 4 | #include <asm/types.h> |
5 | #include <asm/system.h> | 5 | #include <linux/irqflags.h> |
6 | 6 | ||
7 | #ifdef CONFIG_SMP | 7 | #ifdef CONFIG_SMP |
8 | #include <asm/spinlock.h> | 8 | #include <asm/spinlock.h> |
diff --git a/include/asm-generic/bug.h b/include/asm-generic/bug.h index 84458b0c38d1..2520a6e241dc 100644 --- a/include/asm-generic/bug.h +++ b/include/asm-generic/bug.h | |||
@@ -134,7 +134,7 @@ extern void warn_slowpath_null(const char *file, const int line); | |||
134 | #endif | 134 | #endif |
135 | 135 | ||
136 | #define WARN_ON_ONCE(condition) ({ \ | 136 | #define WARN_ON_ONCE(condition) ({ \ |
137 | static bool __warned; \ | 137 | static bool __section(.data.unlikely) __warned; \ |
138 | int __ret_warn_once = !!(condition); \ | 138 | int __ret_warn_once = !!(condition); \ |
139 | \ | 139 | \ |
140 | if (unlikely(__ret_warn_once)) \ | 140 | if (unlikely(__ret_warn_once)) \ |
@@ -144,7 +144,7 @@ extern void warn_slowpath_null(const char *file, const int line); | |||
144 | }) | 144 | }) |
145 | 145 | ||
146 | #define WARN_ONCE(condition, format...) ({ \ | 146 | #define WARN_ONCE(condition, format...) ({ \ |
147 | static bool __warned; \ | 147 | static bool __section(.data.unlikely) __warned; \ |
148 | int __ret_warn_once = !!(condition); \ | 148 | int __ret_warn_once = !!(condition); \ |
149 | \ | 149 | \ |
150 | if (unlikely(__ret_warn_once)) \ | 150 | if (unlikely(__ret_warn_once)) \ |
@@ -154,7 +154,7 @@ extern void warn_slowpath_null(const char *file, const int line); | |||
154 | }) | 154 | }) |
155 | 155 | ||
156 | #define WARN_TAINT_ONCE(condition, taint, format...) ({ \ | 156 | #define WARN_TAINT_ONCE(condition, taint, format...) ({ \ |
157 | static bool __warned; \ | 157 | static bool __section(.data.unlikely) __warned; \ |
158 | int __ret_warn_once = !!(condition); \ | 158 | int __ret_warn_once = !!(condition); \ |
159 | \ | 159 | \ |
160 | if (unlikely(__ret_warn_once)) \ | 160 | if (unlikely(__ret_warn_once)) \ |
diff --git a/include/asm-generic/cmpxchg.h b/include/asm-generic/cmpxchg.h index 213ac6e8fe39..14883026015d 100644 --- a/include/asm-generic/cmpxchg.h +++ b/include/asm-generic/cmpxchg.h | |||
@@ -1,22 +1,98 @@ | |||
1 | /* | ||
2 | * Generic UP xchg and cmpxchg using interrupt disablement. Does not | ||
3 | * support SMP. | ||
4 | */ | ||
5 | |||
1 | #ifndef __ASM_GENERIC_CMPXCHG_H | 6 | #ifndef __ASM_GENERIC_CMPXCHG_H |
2 | #define __ASM_GENERIC_CMPXCHG_H | 7 | #define __ASM_GENERIC_CMPXCHG_H |
3 | 8 | ||
4 | /* | ||
5 | * Generic cmpxchg | ||
6 | * | ||
7 | * Uses the local cmpxchg. Does not support SMP. | ||
8 | */ | ||
9 | #ifdef CONFIG_SMP | 9 | #ifdef CONFIG_SMP |
10 | #error "Cannot use generic cmpxchg on SMP" | 10 | #error "Cannot use generic cmpxchg on SMP" |
11 | #endif | 11 | #endif |
12 | 12 | ||
13 | #include <linux/types.h> | ||
14 | #include <linux/irqflags.h> | ||
15 | |||
16 | #ifndef xchg | ||
17 | |||
18 | /* | ||
19 | * This function doesn't exist, so you'll get a linker error if | ||
20 | * something tries to do an invalidly-sized xchg(). | ||
21 | */ | ||
22 | extern void __xchg_called_with_bad_pointer(void); | ||
23 | |||
24 | static inline | ||
25 | unsigned long __xchg(unsigned long x, volatile void *ptr, int size) | ||
26 | { | ||
27 | unsigned long ret, flags; | ||
28 | |||
29 | switch (size) { | ||
30 | case 1: | ||
31 | #ifdef __xchg_u8 | ||
32 | return __xchg_u8(x, ptr); | ||
33 | #else | ||
34 | local_irq_save(flags); | ||
35 | ret = *(volatile u8 *)ptr; | ||
36 | *(volatile u8 *)ptr = x; | ||
37 | local_irq_restore(flags); | ||
38 | return ret; | ||
39 | #endif /* __xchg_u8 */ | ||
40 | |||
41 | case 2: | ||
42 | #ifdef __xchg_u16 | ||
43 | return __xchg_u16(x, ptr); | ||
44 | #else | ||
45 | local_irq_save(flags); | ||
46 | ret = *(volatile u16 *)ptr; | ||
47 | *(volatile u16 *)ptr = x; | ||
48 | local_irq_restore(flags); | ||
49 | return ret; | ||
50 | #endif /* __xchg_u16 */ | ||
51 | |||
52 | case 4: | ||
53 | #ifdef __xchg_u32 | ||
54 | return __xchg_u32(x, ptr); | ||
55 | #else | ||
56 | local_irq_save(flags); | ||
57 | ret = *(volatile u32 *)ptr; | ||
58 | *(volatile u32 *)ptr = x; | ||
59 | local_irq_restore(flags); | ||
60 | return ret; | ||
61 | #endif /* __xchg_u32 */ | ||
62 | |||
63 | #ifdef CONFIG_64BIT | ||
64 | case 8: | ||
65 | #ifdef __xchg_u64 | ||
66 | return __xchg_u64(x, ptr); | ||
67 | #else | ||
68 | local_irq_save(flags); | ||
69 | ret = *(volatile u64 *)ptr; | ||
70 | *(volatile u64 *)ptr = x; | ||
71 | local_irq_restore(flags); | ||
72 | return ret; | ||
73 | #endif /* __xchg_u64 */ | ||
74 | #endif /* CONFIG_64BIT */ | ||
75 | |||
76 | default: | ||
77 | __xchg_called_with_bad_pointer(); | ||
78 | return x; | ||
79 | } | ||
80 | } | ||
81 | |||
82 | #define xchg(ptr, x) \ | ||
83 | ((__typeof__(*(ptr))) __xchg((unsigned long)(x), (ptr), sizeof(*(ptr)))) | ||
84 | |||
85 | #endif /* xchg */ | ||
86 | |||
13 | /* | 87 | /* |
14 | * Atomic compare and exchange. | 88 | * Atomic compare and exchange. |
15 | * | 89 | * |
16 | * Do not define __HAVE_ARCH_CMPXCHG because we want to use it to check whether | 90 | * Do not define __HAVE_ARCH_CMPXCHG because we want to use it to check whether |
17 | * a cmpxchg primitive faster than repeated local irq save/restore exists. | 91 | * a cmpxchg primitive faster than repeated local irq save/restore exists. |
18 | */ | 92 | */ |
93 | #include <asm-generic/cmpxchg-local.h> | ||
94 | |||
19 | #define cmpxchg(ptr, o, n) cmpxchg_local((ptr), (o), (n)) | 95 | #define cmpxchg(ptr, o, n) cmpxchg_local((ptr), (o), (n)) |
20 | #define cmpxchg64(ptr, o, n) cmpxchg64_local((ptr), (o), (n)) | 96 | #define cmpxchg64(ptr, o, n) cmpxchg64_local((ptr), (o), (n)) |
21 | 97 | ||
22 | #endif | 98 | #endif /* __ASM_GENERIC_CMPXCHG_H */ |
diff --git a/include/asm-generic/dma-mapping-common.h b/include/asm-generic/dma-mapping-common.h index 9fa3f96e38cf..2e248d8924dc 100644 --- a/include/asm-generic/dma-mapping-common.h +++ b/include/asm-generic/dma-mapping-common.h | |||
@@ -2,6 +2,7 @@ | |||
2 | #define _ASM_GENERIC_DMA_MAPPING_H | 2 | #define _ASM_GENERIC_DMA_MAPPING_H |
3 | 3 | ||
4 | #include <linux/kmemcheck.h> | 4 | #include <linux/kmemcheck.h> |
5 | #include <linux/bug.h> | ||
5 | #include <linux/scatterlist.h> | 6 | #include <linux/scatterlist.h> |
6 | #include <linux/dma-debug.h> | 7 | #include <linux/dma-debug.h> |
7 | #include <linux/dma-attrs.h> | 8 | #include <linux/dma-attrs.h> |
diff --git a/include/asm-generic/exec.h b/include/asm-generic/exec.h new file mode 100644 index 000000000000..567766b0074a --- /dev/null +++ b/include/asm-generic/exec.h | |||
@@ -0,0 +1,19 @@ | |||
1 | /* Generic process execution definitions, based on MN10300 definitions. | ||
2 | * | ||
3 | * It should be possible to use these on really simple architectures, | ||
4 | * but it serves more as a starting point for new ports. | ||
5 | * | ||
6 | * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. | ||
7 | * Written by David Howells (dhowells@redhat.com) | ||
8 | * | ||
9 | * This program is free software; you can redistribute it and/or | ||
10 | * modify it under the terms of the GNU General Public Licence | ||
11 | * as published by the Free Software Foundation; either version | ||
12 | * 2 of the Licence, or (at your option) any later version. | ||
13 | */ | ||
14 | #ifndef __ASM_GENERIC_EXEC_H | ||
15 | #define __ASM_GENERIC_EXEC_H | ||
16 | |||
17 | #define arch_align_stack(x) (x) | ||
18 | |||
19 | #endif /* __ASM_GENERIC_EXEC_H */ | ||
diff --git a/include/asm-generic/getorder.h b/include/asm-generic/getorder.h index 67e7245dc9b3..65e4468ac53d 100644 --- a/include/asm-generic/getorder.h +++ b/include/asm-generic/getorder.h | |||
@@ -4,21 +4,58 @@ | |||
4 | #ifndef __ASSEMBLY__ | 4 | #ifndef __ASSEMBLY__ |
5 | 5 | ||
6 | #include <linux/compiler.h> | 6 | #include <linux/compiler.h> |
7 | #include <linux/log2.h> | ||
7 | 8 | ||
8 | /* Pure 2^n version of get_order */ | 9 | /* |
9 | static inline __attribute_const__ int get_order(unsigned long size) | 10 | * Runtime evaluation of get_order() |
11 | */ | ||
12 | static inline __attribute_const__ | ||
13 | int __get_order(unsigned long size) | ||
10 | { | 14 | { |
11 | int order; | 15 | int order; |
12 | 16 | ||
13 | size = (size - 1) >> (PAGE_SHIFT - 1); | 17 | size--; |
14 | order = -1; | 18 | size >>= PAGE_SHIFT; |
15 | do { | 19 | #if BITS_PER_LONG == 32 |
16 | size >>= 1; | 20 | order = fls(size); |
17 | order++; | 21 | #else |
18 | } while (size); | 22 | order = fls64(size); |
23 | #endif | ||
19 | return order; | 24 | return order; |
20 | } | 25 | } |
21 | 26 | ||
27 | /** | ||
28 | * get_order - Determine the allocation order of a memory size | ||
29 | * @size: The size for which to get the order | ||
30 | * | ||
31 | * Determine the allocation order of a particular sized block of memory. This | ||
32 | * is on a logarithmic scale, where: | ||
33 | * | ||
34 | * 0 -> 2^0 * PAGE_SIZE and below | ||
35 | * 1 -> 2^1 * PAGE_SIZE to 2^0 * PAGE_SIZE + 1 | ||
36 | * 2 -> 2^2 * PAGE_SIZE to 2^1 * PAGE_SIZE + 1 | ||
37 | * 3 -> 2^3 * PAGE_SIZE to 2^2 * PAGE_SIZE + 1 | ||
38 | * 4 -> 2^4 * PAGE_SIZE to 2^3 * PAGE_SIZE + 1 | ||
39 | * ... | ||
40 | * | ||
41 | * The order returned is used to find the smallest allocation granule required | ||
42 | * to hold an object of the specified size. | ||
43 | * | ||
44 | * The result is undefined if the size is 0. | ||
45 | * | ||
46 | * This function may be used to initialise variables with compile time | ||
47 | * evaluations of constants. | ||
48 | */ | ||
49 | #define get_order(n) \ | ||
50 | ( \ | ||
51 | __builtin_constant_p(n) ? ( \ | ||
52 | ((n) == 0UL) ? BITS_PER_LONG - PAGE_SHIFT : \ | ||
53 | (((n) < (1UL << PAGE_SHIFT)) ? 0 : \ | ||
54 | ilog2((n) - 1) - PAGE_SHIFT + 1) \ | ||
55 | ) : \ | ||
56 | __get_order(n) \ | ||
57 | ) | ||
58 | |||
22 | #endif /* __ASSEMBLY__ */ | 59 | #endif /* __ASSEMBLY__ */ |
23 | 60 | ||
24 | #endif /* __ASM_GENERIC_GETORDER_H */ | 61 | #endif /* __ASM_GENERIC_GETORDER_H */ |
diff --git a/include/asm-generic/gpio.h b/include/asm-generic/gpio.h index 1ff4e221cb4d..5f52690c3c8f 100644 --- a/include/asm-generic/gpio.h +++ b/include/asm-generic/gpio.h | |||
@@ -142,9 +142,9 @@ extern int __must_check gpiochip_reserve(int start, int ngpio); | |||
142 | /* add/remove chips */ | 142 | /* add/remove chips */ |
143 | extern int gpiochip_add(struct gpio_chip *chip); | 143 | extern int gpiochip_add(struct gpio_chip *chip); |
144 | extern int __must_check gpiochip_remove(struct gpio_chip *chip); | 144 | extern int __must_check gpiochip_remove(struct gpio_chip *chip); |
145 | extern struct gpio_chip *gpiochip_find(void *data, | 145 | extern struct gpio_chip *gpiochip_find(const void *data, |
146 | int (*match)(struct gpio_chip *chip, | 146 | int (*match)(struct gpio_chip *chip, |
147 | void *data)); | 147 | const void *data)); |
148 | 148 | ||
149 | 149 | ||
150 | /* Always use the library code for GPIO management calls, | 150 | /* Always use the library code for GPIO management calls, |
diff --git a/include/asm-generic/mman-common.h b/include/asm-generic/mman-common.h index 787abbb6d867..d030d2c2647a 100644 --- a/include/asm-generic/mman-common.h +++ b/include/asm-generic/mman-common.h | |||
@@ -48,6 +48,10 @@ | |||
48 | #define MADV_HUGEPAGE 14 /* Worth backing with hugepages */ | 48 | #define MADV_HUGEPAGE 14 /* Worth backing with hugepages */ |
49 | #define MADV_NOHUGEPAGE 15 /* Not worth backing with hugepages */ | 49 | #define MADV_NOHUGEPAGE 15 /* Not worth backing with hugepages */ |
50 | 50 | ||
51 | #define MADV_DONTDUMP 16 /* Explicity exclude from the core dump, | ||
52 | overrides the coredump filter bits */ | ||
53 | #define MADV_DODUMP 17 /* Clear the MADV_NODUMP flag */ | ||
54 | |||
51 | /* compatibility flags */ | 55 | /* compatibility flags */ |
52 | #define MAP_FILE 0 | 56 | #define MAP_FILE 0 |
53 | 57 | ||
diff --git a/include/asm-generic/pci-bridge.h b/include/asm-generic/pci-bridge.h index 4a5aca2a2c94..a5b5d5a89a4f 100644 --- a/include/asm-generic/pci-bridge.h +++ b/include/asm-generic/pci-bridge.h | |||
@@ -45,6 +45,11 @@ static inline void pci_add_flags(int flags) | |||
45 | pci_flags |= flags; | 45 | pci_flags |= flags; |
46 | } | 46 | } |
47 | 47 | ||
48 | static inline void pci_clear_flags(int flags) | ||
49 | { | ||
50 | pci_flags &= ~flags; | ||
51 | } | ||
52 | |||
48 | static inline int pci_has_flag(int flag) | 53 | static inline int pci_has_flag(int flag) |
49 | { | 54 | { |
50 | return pci_flags & flag; | 55 | return pci_flags & flag; |
@@ -52,6 +57,7 @@ static inline int pci_has_flag(int flag) | |||
52 | #else | 57 | #else |
53 | static inline void pci_set_flags(int flags) { } | 58 | static inline void pci_set_flags(int flags) { } |
54 | static inline void pci_add_flags(int flags) { } | 59 | static inline void pci_add_flags(int flags) { } |
60 | static inline void pci_clear_flags(int flags) { } | ||
55 | static inline int pci_has_flag(int flag) | 61 | static inline int pci_has_flag(int flag) |
56 | { | 62 | { |
57 | return 0; | 63 | return 0; |
diff --git a/include/asm-generic/pci.h b/include/asm-generic/pci.h index 26373cff4546..e80a0495e5b0 100644 --- a/include/asm-generic/pci.h +++ b/include/asm-generic/pci.h | |||
@@ -6,30 +6,6 @@ | |||
6 | #ifndef _ASM_GENERIC_PCI_H | 6 | #ifndef _ASM_GENERIC_PCI_H |
7 | #define _ASM_GENERIC_PCI_H | 7 | #define _ASM_GENERIC_PCI_H |
8 | 8 | ||
9 | /** | ||
10 | * pcibios_resource_to_bus - convert resource to PCI bus address | ||
11 | * @dev: device which owns this resource | ||
12 | * @region: converted bus-centric region (start,end) | ||
13 | * @res: resource to convert | ||
14 | * | ||
15 | * Convert a resource to a PCI device bus address or bus window. | ||
16 | */ | ||
17 | static inline void | ||
18 | pcibios_resource_to_bus(struct pci_dev *dev, struct pci_bus_region *region, | ||
19 | struct resource *res) | ||
20 | { | ||
21 | region->start = res->start; | ||
22 | region->end = res->end; | ||
23 | } | ||
24 | |||
25 | static inline void | ||
26 | pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res, | ||
27 | struct pci_bus_region *region) | ||
28 | { | ||
29 | res->start = region->start; | ||
30 | res->end = region->end; | ||
31 | } | ||
32 | |||
33 | static inline struct resource * | 9 | static inline struct resource * |
34 | pcibios_select_root(struct pci_dev *pdev, struct resource *res) | 10 | pcibios_select_root(struct pci_dev *pdev, struct resource *res) |
35 | { | 11 | { |
diff --git a/include/asm-generic/pgtable.h b/include/asm-generic/pgtable.h index 76bff2bff15e..125c54e98517 100644 --- a/include/asm-generic/pgtable.h +++ b/include/asm-generic/pgtable.h | |||
@@ -5,6 +5,7 @@ | |||
5 | #ifdef CONFIG_MMU | 5 | #ifdef CONFIG_MMU |
6 | 6 | ||
7 | #include <linux/mm_types.h> | 7 | #include <linux/mm_types.h> |
8 | #include <linux/bug.h> | ||
8 | 9 | ||
9 | #ifndef __HAVE_ARCH_PTEP_SET_ACCESS_FLAGS | 10 | #ifndef __HAVE_ARCH_PTEP_SET_ACCESS_FLAGS |
10 | extern int ptep_set_access_flags(struct vm_area_struct *vma, | 11 | extern int ptep_set_access_flags(struct vm_area_struct *vma, |
@@ -425,6 +426,8 @@ extern void untrack_pfn_vma(struct vm_area_struct *vma, unsigned long pfn, | |||
425 | unsigned long size); | 426 | unsigned long size); |
426 | #endif | 427 | #endif |
427 | 428 | ||
429 | #ifdef CONFIG_MMU | ||
430 | |||
428 | #ifndef CONFIG_TRANSPARENT_HUGEPAGE | 431 | #ifndef CONFIG_TRANSPARENT_HUGEPAGE |
429 | static inline int pmd_trans_huge(pmd_t pmd) | 432 | static inline int pmd_trans_huge(pmd_t pmd) |
430 | { | 433 | { |
@@ -441,7 +444,66 @@ static inline int pmd_write(pmd_t pmd) | |||
441 | return 0; | 444 | return 0; |
442 | } | 445 | } |
443 | #endif /* __HAVE_ARCH_PMD_WRITE */ | 446 | #endif /* __HAVE_ARCH_PMD_WRITE */ |
447 | #endif /* CONFIG_TRANSPARENT_HUGEPAGE */ | ||
448 | |||
449 | /* | ||
450 | * This function is meant to be used by sites walking pagetables with | ||
451 | * the mmap_sem hold in read mode to protect against MADV_DONTNEED and | ||
452 | * transhuge page faults. MADV_DONTNEED can convert a transhuge pmd | ||
453 | * into a null pmd and the transhuge page fault can convert a null pmd | ||
454 | * into an hugepmd or into a regular pmd (if the hugepage allocation | ||
455 | * fails). While holding the mmap_sem in read mode the pmd becomes | ||
456 | * stable and stops changing under us only if it's not null and not a | ||
457 | * transhuge pmd. When those races occurs and this function makes a | ||
458 | * difference vs the standard pmd_none_or_clear_bad, the result is | ||
459 | * undefined so behaving like if the pmd was none is safe (because it | ||
460 | * can return none anyway). The compiler level barrier() is critically | ||
461 | * important to compute the two checks atomically on the same pmdval. | ||
462 | */ | ||
463 | static inline int pmd_none_or_trans_huge_or_clear_bad(pmd_t *pmd) | ||
464 | { | ||
465 | /* depend on compiler for an atomic pmd read */ | ||
466 | pmd_t pmdval = *pmd; | ||
467 | /* | ||
468 | * The barrier will stabilize the pmdval in a register or on | ||
469 | * the stack so that it will stop changing under the code. | ||
470 | */ | ||
471 | #ifdef CONFIG_TRANSPARENT_HUGEPAGE | ||
472 | barrier(); | ||
473 | #endif | ||
474 | if (pmd_none(pmdval)) | ||
475 | return 1; | ||
476 | if (unlikely(pmd_bad(pmdval))) { | ||
477 | if (!pmd_trans_huge(pmdval)) | ||
478 | pmd_clear_bad(pmd); | ||
479 | return 1; | ||
480 | } | ||
481 | return 0; | ||
482 | } | ||
483 | |||
484 | /* | ||
485 | * This is a noop if Transparent Hugepage Support is not built into | ||
486 | * the kernel. Otherwise it is equivalent to | ||
487 | * pmd_none_or_trans_huge_or_clear_bad(), and shall only be called in | ||
488 | * places that already verified the pmd is not none and they want to | ||
489 | * walk ptes while holding the mmap sem in read mode (write mode don't | ||
490 | * need this). If THP is not enabled, the pmd can't go away under the | ||
491 | * code even if MADV_DONTNEED runs, but if THP is enabled we need to | ||
492 | * run a pmd_trans_unstable before walking the ptes after | ||
493 | * split_huge_page_pmd returns (because it may have run when the pmd | ||
494 | * become null, but then a page fault can map in a THP and not a | ||
495 | * regular page). | ||
496 | */ | ||
497 | static inline int pmd_trans_unstable(pmd_t *pmd) | ||
498 | { | ||
499 | #ifdef CONFIG_TRANSPARENT_HUGEPAGE | ||
500 | return pmd_none_or_trans_huge_or_clear_bad(pmd); | ||
501 | #else | ||
502 | return 0; | ||
444 | #endif | 503 | #endif |
504 | } | ||
505 | |||
506 | #endif /* CONFIG_MMU */ | ||
445 | 507 | ||
446 | #endif /* !__ASSEMBLY__ */ | 508 | #endif /* !__ASSEMBLY__ */ |
447 | 509 | ||
diff --git a/include/asm-generic/posix_types.h b/include/asm-generic/posix_types.h index 3dab00860e71..91d44bd4dde3 100644 --- a/include/asm-generic/posix_types.h +++ b/include/asm-generic/posix_types.h | |||
@@ -10,8 +10,13 @@ | |||
10 | * architectures, so that you can override them. | 10 | * architectures, so that you can override them. |
11 | */ | 11 | */ |
12 | 12 | ||
13 | #ifndef __kernel_long_t | ||
14 | typedef long __kernel_long_t; | ||
15 | typedef unsigned long __kernel_ulong_t; | ||
16 | #endif | ||
17 | |||
13 | #ifndef __kernel_ino_t | 18 | #ifndef __kernel_ino_t |
14 | typedef unsigned long __kernel_ino_t; | 19 | typedef __kernel_ulong_t __kernel_ino_t; |
15 | #endif | 20 | #endif |
16 | 21 | ||
17 | #ifndef __kernel_mode_t | 22 | #ifndef __kernel_mode_t |
@@ -19,7 +24,7 @@ typedef unsigned int __kernel_mode_t; | |||
19 | #endif | 24 | #endif |
20 | 25 | ||
21 | #ifndef __kernel_nlink_t | 26 | #ifndef __kernel_nlink_t |
22 | typedef unsigned long __kernel_nlink_t; | 27 | typedef __kernel_ulong_t __kernel_nlink_t; |
23 | #endif | 28 | #endif |
24 | 29 | ||
25 | #ifndef __kernel_pid_t | 30 | #ifndef __kernel_pid_t |
@@ -36,7 +41,7 @@ typedef unsigned int __kernel_gid_t; | |||
36 | #endif | 41 | #endif |
37 | 42 | ||
38 | #ifndef __kernel_suseconds_t | 43 | #ifndef __kernel_suseconds_t |
39 | typedef long __kernel_suseconds_t; | 44 | typedef __kernel_long_t __kernel_suseconds_t; |
40 | #endif | 45 | #endif |
41 | 46 | ||
42 | #ifndef __kernel_daddr_t | 47 | #ifndef __kernel_daddr_t |
@@ -44,8 +49,8 @@ typedef int __kernel_daddr_t; | |||
44 | #endif | 49 | #endif |
45 | 50 | ||
46 | #ifndef __kernel_uid32_t | 51 | #ifndef __kernel_uid32_t |
47 | typedef __kernel_uid_t __kernel_uid32_t; | 52 | typedef unsigned int __kernel_uid32_t; |
48 | typedef __kernel_gid_t __kernel_gid32_t; | 53 | typedef unsigned int __kernel_gid32_t; |
49 | #endif | 54 | #endif |
50 | 55 | ||
51 | #ifndef __kernel_old_uid_t | 56 | #ifndef __kernel_old_uid_t |
@@ -67,99 +72,29 @@ typedef unsigned int __kernel_size_t; | |||
67 | typedef int __kernel_ssize_t; | 72 | typedef int __kernel_ssize_t; |
68 | typedef int __kernel_ptrdiff_t; | 73 | typedef int __kernel_ptrdiff_t; |
69 | #else | 74 | #else |
70 | typedef unsigned long __kernel_size_t; | 75 | typedef __kernel_ulong_t __kernel_size_t; |
71 | typedef long __kernel_ssize_t; | 76 | typedef __kernel_long_t __kernel_ssize_t; |
72 | typedef long __kernel_ptrdiff_t; | 77 | typedef __kernel_long_t __kernel_ptrdiff_t; |
73 | #endif | 78 | #endif |
74 | #endif | 79 | #endif |
75 | 80 | ||
81 | #ifndef __kernel_fsid_t | ||
82 | typedef struct { | ||
83 | int val[2]; | ||
84 | } __kernel_fsid_t; | ||
85 | #endif | ||
86 | |||
76 | /* | 87 | /* |
77 | * anything below here should be completely generic | 88 | * anything below here should be completely generic |
78 | */ | 89 | */ |
79 | typedef long __kernel_off_t; | 90 | typedef __kernel_long_t __kernel_off_t; |
80 | typedef long long __kernel_loff_t; | 91 | typedef long long __kernel_loff_t; |
81 | typedef long __kernel_time_t; | 92 | typedef __kernel_long_t __kernel_time_t; |
82 | typedef long __kernel_clock_t; | 93 | typedef __kernel_long_t __kernel_clock_t; |
83 | typedef int __kernel_timer_t; | 94 | typedef int __kernel_timer_t; |
84 | typedef int __kernel_clockid_t; | 95 | typedef int __kernel_clockid_t; |
85 | typedef char * __kernel_caddr_t; | 96 | typedef char * __kernel_caddr_t; |
86 | typedef unsigned short __kernel_uid16_t; | 97 | typedef unsigned short __kernel_uid16_t; |
87 | typedef unsigned short __kernel_gid16_t; | 98 | typedef unsigned short __kernel_gid16_t; |
88 | 99 | ||
89 | typedef struct { | ||
90 | int val[2]; | ||
91 | } __kernel_fsid_t; | ||
92 | |||
93 | #ifdef __KERNEL__ | ||
94 | |||
95 | #undef __FD_SET | ||
96 | static inline void __FD_SET(unsigned long __fd, __kernel_fd_set *__fdsetp) | ||
97 | { | ||
98 | unsigned long __tmp = __fd / __NFDBITS; | ||
99 | unsigned long __rem = __fd % __NFDBITS; | ||
100 | __fdsetp->fds_bits[__tmp] |= (1UL<<__rem); | ||
101 | } | ||
102 | |||
103 | #undef __FD_CLR | ||
104 | static inline void __FD_CLR(unsigned long __fd, __kernel_fd_set *__fdsetp) | ||
105 | { | ||
106 | unsigned long __tmp = __fd / __NFDBITS; | ||
107 | unsigned long __rem = __fd % __NFDBITS; | ||
108 | __fdsetp->fds_bits[__tmp] &= ~(1UL<<__rem); | ||
109 | } | ||
110 | |||
111 | #undef __FD_ISSET | ||
112 | static inline int __FD_ISSET(unsigned long __fd, const __kernel_fd_set *__p) | ||
113 | { | ||
114 | unsigned long __tmp = __fd / __NFDBITS; | ||
115 | unsigned long __rem = __fd % __NFDBITS; | ||
116 | return (__p->fds_bits[__tmp] & (1UL<<__rem)) != 0; | ||
117 | } | ||
118 | |||
119 | /* | ||
120 | * This will unroll the loop for the normal constant case (8 ints, | ||
121 | * for a 256-bit fd_set) | ||
122 | */ | ||
123 | #undef __FD_ZERO | ||
124 | static inline void __FD_ZERO(__kernel_fd_set *__p) | ||
125 | { | ||
126 | unsigned long *__tmp = __p->fds_bits; | ||
127 | int __i; | ||
128 | |||
129 | if (__builtin_constant_p(__FDSET_LONGS)) { | ||
130 | switch (__FDSET_LONGS) { | ||
131 | case 16: | ||
132 | __tmp[ 0] = 0; __tmp[ 1] = 0; | ||
133 | __tmp[ 2] = 0; __tmp[ 3] = 0; | ||
134 | __tmp[ 4] = 0; __tmp[ 5] = 0; | ||
135 | __tmp[ 6] = 0; __tmp[ 7] = 0; | ||
136 | __tmp[ 8] = 0; __tmp[ 9] = 0; | ||
137 | __tmp[10] = 0; __tmp[11] = 0; | ||
138 | __tmp[12] = 0; __tmp[13] = 0; | ||
139 | __tmp[14] = 0; __tmp[15] = 0; | ||
140 | return; | ||
141 | |||
142 | case 8: | ||
143 | __tmp[ 0] = 0; __tmp[ 1] = 0; | ||
144 | __tmp[ 2] = 0; __tmp[ 3] = 0; | ||
145 | __tmp[ 4] = 0; __tmp[ 5] = 0; | ||
146 | __tmp[ 6] = 0; __tmp[ 7] = 0; | ||
147 | return; | ||
148 | |||
149 | case 4: | ||
150 | __tmp[ 0] = 0; __tmp[ 1] = 0; | ||
151 | __tmp[ 2] = 0; __tmp[ 3] = 0; | ||
152 | return; | ||
153 | } | ||
154 | } | ||
155 | __i = __FDSET_LONGS; | ||
156 | while (__i) { | ||
157 | __i--; | ||
158 | *__tmp = 0; | ||
159 | __tmp++; | ||
160 | } | ||
161 | } | ||
162 | |||
163 | #endif /* __KERNEL__ */ | ||
164 | |||
165 | #endif /* __ASM_GENERIC_POSIX_TYPES_H */ | 100 | #endif /* __ASM_GENERIC_POSIX_TYPES_H */ |
diff --git a/include/asm-generic/socket.h b/include/asm-generic/socket.h index 49c1704173e7..b1bea03274d5 100644 --- a/include/asm-generic/socket.h +++ b/include/asm-generic/socket.h | |||
@@ -67,4 +67,9 @@ | |||
67 | 67 | ||
68 | #define SO_WIFI_STATUS 41 | 68 | #define SO_WIFI_STATUS 41 |
69 | #define SCM_WIFI_STATUS SO_WIFI_STATUS | 69 | #define SCM_WIFI_STATUS SO_WIFI_STATUS |
70 | #define SO_PEEK_OFF 42 | ||
71 | |||
72 | /* Instruct lower device to use last 4-bytes of skb data as FCS */ | ||
73 | #define SO_NOFCS 43 | ||
74 | |||
70 | #endif /* __ASM_GENERIC_SOCKET_H */ | 75 | #endif /* __ASM_GENERIC_SOCKET_H */ |
diff --git a/include/asm-generic/switch_to.h b/include/asm-generic/switch_to.h new file mode 100644 index 000000000000..052c4ac04fd5 --- /dev/null +++ b/include/asm-generic/switch_to.h | |||
@@ -0,0 +1,30 @@ | |||
1 | /* Generic task switch macro wrapper, based on MN10300 definitions. | ||
2 | * | ||
3 | * It should be possible to use these on really simple architectures, | ||
4 | * but it serves more as a starting point for new ports. | ||
5 | * | ||
6 | * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. | ||
7 | * Written by David Howells (dhowells@redhat.com) | ||
8 | * | ||
9 | * This program is free software; you can redistribute it and/or | ||
10 | * modify it under the terms of the GNU General Public Licence | ||
11 | * as published by the Free Software Foundation; either version | ||
12 | * 2 of the Licence, or (at your option) any later version. | ||
13 | */ | ||
14 | #ifndef __ASM_GENERIC_SWITCH_TO_H | ||
15 | #define __ASM_GENERIC_SWITCH_TO_H | ||
16 | |||
17 | #include <linux/thread_info.h> | ||
18 | |||
19 | /* | ||
20 | * Context switching is now performed out-of-line in switch_to.S | ||
21 | */ | ||
22 | extern struct task_struct *__switch_to(struct task_struct *, | ||
23 | struct task_struct *); | ||
24 | |||
25 | #define switch_to(prev, next, last) \ | ||
26 | do { \ | ||
27 | ((last) = __switch_to((prev), (next))); \ | ||
28 | } while (0) | ||
29 | |||
30 | #endif /* __ASM_GENERIC_SWITCH_TO_H */ | ||
diff --git a/include/asm-generic/system.h b/include/asm-generic/system.h deleted file mode 100644 index 215efa74f5a2..000000000000 --- a/include/asm-generic/system.h +++ /dev/null | |||
@@ -1,141 +0,0 @@ | |||
1 | /* Generic system definitions, based on MN10300 definitions. | ||
2 | * | ||
3 | * It should be possible to use these on really simple architectures, | ||
4 | * but it serves more as a starting point for new ports. | ||
5 | * | ||
6 | * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. | ||
7 | * Written by David Howells (dhowells@redhat.com) | ||
8 | * | ||
9 | * This program is free software; you can redistribute it and/or | ||
10 | * modify it under the terms of the GNU General Public Licence | ||
11 | * as published by the Free Software Foundation; either version | ||
12 | * 2 of the Licence, or (at your option) any later version. | ||
13 | */ | ||
14 | #ifndef __ASM_GENERIC_SYSTEM_H | ||
15 | #define __ASM_GENERIC_SYSTEM_H | ||
16 | |||
17 | #ifndef __ASSEMBLY__ | ||
18 | |||
19 | #include <linux/types.h> | ||
20 | #include <linux/irqflags.h> | ||
21 | |||
22 | #include <asm/cmpxchg-local.h> | ||
23 | #include <asm/cmpxchg.h> | ||
24 | |||
25 | struct task_struct; | ||
26 | |||
27 | /* context switching is now performed out-of-line in switch_to.S */ | ||
28 | extern struct task_struct *__switch_to(struct task_struct *, | ||
29 | struct task_struct *); | ||
30 | #define switch_to(prev, next, last) \ | ||
31 | do { \ | ||
32 | ((last) = __switch_to((prev), (next))); \ | ||
33 | } while (0) | ||
34 | |||
35 | #define arch_align_stack(x) (x) | ||
36 | |||
37 | #define nop() asm volatile ("nop") | ||
38 | |||
39 | #endif /* !__ASSEMBLY__ */ | ||
40 | |||
41 | /* | ||
42 | * Force strict CPU ordering. | ||
43 | * And yes, this is required on UP too when we're talking | ||
44 | * to devices. | ||
45 | * | ||
46 | * This implementation only contains a compiler barrier. | ||
47 | */ | ||
48 | |||
49 | #define mb() asm volatile ("": : :"memory") | ||
50 | #define rmb() mb() | ||
51 | #define wmb() asm volatile ("": : :"memory") | ||
52 | |||
53 | #ifdef CONFIG_SMP | ||
54 | #define smp_mb() mb() | ||
55 | #define smp_rmb() rmb() | ||
56 | #define smp_wmb() wmb() | ||
57 | #else | ||
58 | #define smp_mb() barrier() | ||
59 | #define smp_rmb() barrier() | ||
60 | #define smp_wmb() barrier() | ||
61 | #endif | ||
62 | |||
63 | #define set_mb(var, value) do { var = value; mb(); } while (0) | ||
64 | #define set_wmb(var, value) do { var = value; wmb(); } while (0) | ||
65 | |||
66 | #define read_barrier_depends() do {} while (0) | ||
67 | #define smp_read_barrier_depends() do {} while (0) | ||
68 | |||
69 | /* | ||
70 | * we make sure local_irq_enable() doesn't cause priority inversion | ||
71 | */ | ||
72 | #ifndef __ASSEMBLY__ | ||
73 | |||
74 | /* This function doesn't exist, so you'll get a linker error | ||
75 | * if something tries to do an invalid xchg(). */ | ||
76 | extern void __xchg_called_with_bad_pointer(void); | ||
77 | |||
78 | static inline | ||
79 | unsigned long __xchg(unsigned long x, volatile void *ptr, int size) | ||
80 | { | ||
81 | unsigned long ret, flags; | ||
82 | |||
83 | switch (size) { | ||
84 | case 1: | ||
85 | #ifdef __xchg_u8 | ||
86 | return __xchg_u8(x, ptr); | ||
87 | #else | ||
88 | local_irq_save(flags); | ||
89 | ret = *(volatile u8 *)ptr; | ||
90 | *(volatile u8 *)ptr = x; | ||
91 | local_irq_restore(flags); | ||
92 | return ret; | ||
93 | #endif /* __xchg_u8 */ | ||
94 | |||
95 | case 2: | ||
96 | #ifdef __xchg_u16 | ||
97 | return __xchg_u16(x, ptr); | ||
98 | #else | ||
99 | local_irq_save(flags); | ||
100 | ret = *(volatile u16 *)ptr; | ||
101 | *(volatile u16 *)ptr = x; | ||
102 | local_irq_restore(flags); | ||
103 | return ret; | ||
104 | #endif /* __xchg_u16 */ | ||
105 | |||
106 | case 4: | ||
107 | #ifdef __xchg_u32 | ||
108 | return __xchg_u32(x, ptr); | ||
109 | #else | ||
110 | local_irq_save(flags); | ||
111 | ret = *(volatile u32 *)ptr; | ||
112 | *(volatile u32 *)ptr = x; | ||
113 | local_irq_restore(flags); | ||
114 | return ret; | ||
115 | #endif /* __xchg_u32 */ | ||
116 | |||
117 | #ifdef CONFIG_64BIT | ||
118 | case 8: | ||
119 | #ifdef __xchg_u64 | ||
120 | return __xchg_u64(x, ptr); | ||
121 | #else | ||
122 | local_irq_save(flags); | ||
123 | ret = *(volatile u64 *)ptr; | ||
124 | *(volatile u64 *)ptr = x; | ||
125 | local_irq_restore(flags); | ||
126 | return ret; | ||
127 | #endif /* __xchg_u64 */ | ||
128 | #endif /* CONFIG_64BIT */ | ||
129 | |||
130 | default: | ||
131 | __xchg_called_with_bad_pointer(); | ||
132 | return x; | ||
133 | } | ||
134 | } | ||
135 | |||
136 | #define xchg(ptr, x) \ | ||
137 | ((__typeof__(*(ptr))) __xchg((unsigned long)(x), (ptr), sizeof(*(ptr)))) | ||
138 | |||
139 | #endif /* !__ASSEMBLY__ */ | ||
140 | |||
141 | #endif /* __ASM_GENERIC_SYSTEM_H */ | ||
diff --git a/include/asm-generic/tlbflush.h b/include/asm-generic/tlbflush.h index c7af037024c7..d6d0a88430fe 100644 --- a/include/asm-generic/tlbflush.h +++ b/include/asm-generic/tlbflush.h | |||
@@ -9,6 +9,8 @@ | |||
9 | #error need to implement an architecture specific asm/tlbflush.h | 9 | #error need to implement an architecture specific asm/tlbflush.h |
10 | #endif | 10 | #endif |
11 | 11 | ||
12 | #include <linux/bug.h> | ||
13 | |||
12 | static inline void flush_tlb_mm(struct mm_struct *mm) | 14 | static inline void flush_tlb_mm(struct mm_struct *mm) |
13 | { | 15 | { |
14 | BUG(); | 16 | BUG(); |
diff --git a/include/asm-generic/unistd.h b/include/asm-generic/unistd.h index 2292d1af9d70..991ef01cd77e 100644 --- a/include/asm-generic/unistd.h +++ b/include/asm-generic/unistd.h | |||
@@ -218,7 +218,7 @@ __SC_COMP(__NR_pwritev, sys_pwritev, compat_sys_pwritev) | |||
218 | 218 | ||
219 | /* fs/sendfile.c */ | 219 | /* fs/sendfile.c */ |
220 | #define __NR3264_sendfile 71 | 220 | #define __NR3264_sendfile 71 |
221 | __SC_3264(__NR3264_sendfile, sys_sendfile64, sys_sendfile) | 221 | __SYSCALL(__NR3264_sendfile, sys_sendfile64) |
222 | 222 | ||
223 | /* fs/select.c */ | 223 | /* fs/select.c */ |
224 | #define __NR_pselect6 72 | 224 | #define __NR_pselect6 72 |
diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h index b5e2e4c6b017..8aeadf6b553a 100644 --- a/include/asm-generic/vmlinux.lds.h +++ b/include/asm-generic/vmlinux.lds.h | |||
@@ -167,6 +167,7 @@ | |||
167 | CPU_KEEP(exit.data) \ | 167 | CPU_KEEP(exit.data) \ |
168 | MEM_KEEP(init.data) \ | 168 | MEM_KEEP(init.data) \ |
169 | MEM_KEEP(exit.data) \ | 169 | MEM_KEEP(exit.data) \ |
170 | *(.data.unlikely) \ | ||
170 | STRUCT_ALIGN(); \ | 171 | STRUCT_ALIGN(); \ |
171 | *(__tracepoints) \ | 172 | *(__tracepoints) \ |
172 | /* implement dynamic printk debug */ \ | 173 | /* implement dynamic printk debug */ \ |
@@ -615,30 +616,23 @@ | |||
615 | *(.init.setup) \ | 616 | *(.init.setup) \ |
616 | VMLINUX_SYMBOL(__setup_end) = .; | 617 | VMLINUX_SYMBOL(__setup_end) = .; |
617 | 618 | ||
618 | #define INITCALLS \ | 619 | #define INIT_CALLS_LEVEL(level) \ |
619 | *(.initcallearly.init) \ | 620 | VMLINUX_SYMBOL(__initcall##level##_start) = .; \ |
620 | VMLINUX_SYMBOL(__early_initcall_end) = .; \ | 621 | *(.initcall##level##.init) \ |
621 | *(.initcall0.init) \ | 622 | *(.initcall##level##s.init) \ |
622 | *(.initcall0s.init) \ | ||
623 | *(.initcall1.init) \ | ||
624 | *(.initcall1s.init) \ | ||
625 | *(.initcall2.init) \ | ||
626 | *(.initcall2s.init) \ | ||
627 | *(.initcall3.init) \ | ||
628 | *(.initcall3s.init) \ | ||
629 | *(.initcall4.init) \ | ||
630 | *(.initcall4s.init) \ | ||
631 | *(.initcall5.init) \ | ||
632 | *(.initcall5s.init) \ | ||
633 | *(.initcallrootfs.init) \ | ||
634 | *(.initcall6.init) \ | ||
635 | *(.initcall6s.init) \ | ||
636 | *(.initcall7.init) \ | ||
637 | *(.initcall7s.init) | ||
638 | 623 | ||
639 | #define INIT_CALLS \ | 624 | #define INIT_CALLS \ |
640 | VMLINUX_SYMBOL(__initcall_start) = .; \ | 625 | VMLINUX_SYMBOL(__initcall_start) = .; \ |
641 | INITCALLS \ | 626 | *(.initcallearly.init) \ |
627 | INIT_CALLS_LEVEL(0) \ | ||
628 | INIT_CALLS_LEVEL(1) \ | ||
629 | INIT_CALLS_LEVEL(2) \ | ||
630 | INIT_CALLS_LEVEL(3) \ | ||
631 | INIT_CALLS_LEVEL(4) \ | ||
632 | INIT_CALLS_LEVEL(5) \ | ||
633 | INIT_CALLS_LEVEL(rootfs) \ | ||
634 | INIT_CALLS_LEVEL(6) \ | ||
635 | INIT_CALLS_LEVEL(7) \ | ||
642 | VMLINUX_SYMBOL(__initcall_end) = .; | 636 | VMLINUX_SYMBOL(__initcall_end) = .; |
643 | 637 | ||
644 | #define CON_INITCALL \ | 638 | #define CON_INITCALL \ |
diff --git a/include/crypto/internal/aead.h b/include/crypto/internal/aead.h index d838c945575a..2eba340230a7 100644 --- a/include/crypto/internal/aead.h +++ b/include/crypto/internal/aead.h | |||
@@ -31,6 +31,8 @@ static inline void crypto_set_aead_spawn( | |||
31 | crypto_set_spawn(&spawn->base, inst); | 31 | crypto_set_spawn(&spawn->base, inst); |
32 | } | 32 | } |
33 | 33 | ||
34 | struct crypto_alg *crypto_lookup_aead(const char *name, u32 type, u32 mask); | ||
35 | |||
34 | int crypto_grab_aead(struct crypto_aead_spawn *spawn, const char *name, | 36 | int crypto_grab_aead(struct crypto_aead_spawn *spawn, const char *name, |
35 | u32 type, u32 mask); | 37 | u32 type, u32 mask); |
36 | 38 | ||
diff --git a/include/crypto/internal/skcipher.h b/include/crypto/internal/skcipher.h index 3a748a6bf772..06e8b32d541c 100644 --- a/include/crypto/internal/skcipher.h +++ b/include/crypto/internal/skcipher.h | |||
@@ -34,6 +34,8 @@ static inline void crypto_set_skcipher_spawn( | |||
34 | int crypto_grab_skcipher(struct crypto_skcipher_spawn *spawn, const char *name, | 34 | int crypto_grab_skcipher(struct crypto_skcipher_spawn *spawn, const char *name, |
35 | u32 type, u32 mask); | 35 | u32 type, u32 mask); |
36 | 36 | ||
37 | struct crypto_alg *crypto_lookup_skcipher(const char *name, u32 type, u32 mask); | ||
38 | |||
37 | static inline void crypto_drop_skcipher(struct crypto_skcipher_spawn *spawn) | 39 | static inline void crypto_drop_skcipher(struct crypto_skcipher_spawn *spawn) |
38 | { | 40 | { |
39 | crypto_drop_spawn(&spawn->base); | 41 | crypto_drop_spawn(&spawn->base); |
diff --git a/include/crypto/scatterwalk.h b/include/crypto/scatterwalk.h index 4fd95a323beb..3744d2a642df 100644 --- a/include/crypto/scatterwalk.h +++ b/include/crypto/scatterwalk.h | |||
@@ -25,28 +25,6 @@ | |||
25 | #include <linux/scatterlist.h> | 25 | #include <linux/scatterlist.h> |
26 | #include <linux/sched.h> | 26 | #include <linux/sched.h> |
27 | 27 | ||
28 | static inline enum km_type crypto_kmap_type(int out) | ||
29 | { | ||
30 | enum km_type type; | ||
31 | |||
32 | if (in_softirq()) | ||
33 | type = out * (KM_SOFTIRQ1 - KM_SOFTIRQ0) + KM_SOFTIRQ0; | ||
34 | else | ||
35 | type = out * (KM_USER1 - KM_USER0) + KM_USER0; | ||
36 | |||
37 | return type; | ||
38 | } | ||
39 | |||
40 | static inline void *crypto_kmap(struct page *page, int out) | ||
41 | { | ||
42 | return kmap_atomic(page, crypto_kmap_type(out)); | ||
43 | } | ||
44 | |||
45 | static inline void crypto_kunmap(void *vaddr, int out) | ||
46 | { | ||
47 | kunmap_atomic(vaddr, crypto_kmap_type(out)); | ||
48 | } | ||
49 | |||
50 | static inline void crypto_yield(u32 flags) | 28 | static inline void crypto_yield(u32 flags) |
51 | { | 29 | { |
52 | if (flags & CRYPTO_TFM_REQ_MAY_SLEEP) | 30 | if (flags & CRYPTO_TFM_REQ_MAY_SLEEP) |
@@ -121,15 +99,15 @@ static inline struct page *scatterwalk_page(struct scatter_walk *walk) | |||
121 | return sg_page(walk->sg) + (walk->offset >> PAGE_SHIFT); | 99 | return sg_page(walk->sg) + (walk->offset >> PAGE_SHIFT); |
122 | } | 100 | } |
123 | 101 | ||
124 | static inline void scatterwalk_unmap(void *vaddr, int out) | 102 | static inline void scatterwalk_unmap(void *vaddr) |
125 | { | 103 | { |
126 | crypto_kunmap(vaddr, out); | 104 | kunmap_atomic(vaddr); |
127 | } | 105 | } |
128 | 106 | ||
129 | void scatterwalk_start(struct scatter_walk *walk, struct scatterlist *sg); | 107 | void scatterwalk_start(struct scatter_walk *walk, struct scatterlist *sg); |
130 | void scatterwalk_copychunks(void *buf, struct scatter_walk *walk, | 108 | void scatterwalk_copychunks(void *buf, struct scatter_walk *walk, |
131 | size_t nbytes, int out); | 109 | size_t nbytes, int out); |
132 | void *scatterwalk_map(struct scatter_walk *walk, int out); | 110 | void *scatterwalk_map(struct scatter_walk *walk); |
133 | void scatterwalk_done(struct scatter_walk *walk, int out, int more); | 111 | void scatterwalk_done(struct scatter_walk *walk, int out, int more); |
134 | 112 | ||
135 | void scatterwalk_map_and_copy(void *buf, struct scatterlist *sg, | 113 | void scatterwalk_map_and_copy(void *buf, struct scatterlist *sg, |
diff --git a/include/drm/drm.h b/include/drm/drm.h index 49d94ede2ec2..64ff02d5b730 100644 --- a/include/drm/drm.h +++ b/include/drm/drm.h | |||
@@ -617,6 +617,17 @@ struct drm_get_cap { | |||
617 | __u64 value; | 617 | __u64 value; |
618 | }; | 618 | }; |
619 | 619 | ||
620 | #define DRM_CLOEXEC O_CLOEXEC | ||
621 | struct drm_prime_handle { | ||
622 | __u32 handle; | ||
623 | |||
624 | /** Flags.. only applicable for handle->fd */ | ||
625 | __u32 flags; | ||
626 | |||
627 | /** Returned dmabuf file descriptor */ | ||
628 | __s32 fd; | ||
629 | }; | ||
630 | |||
620 | #include "drm_mode.h" | 631 | #include "drm_mode.h" |
621 | 632 | ||
622 | #define DRM_IOCTL_BASE 'd' | 633 | #define DRM_IOCTL_BASE 'd' |
@@ -673,7 +684,8 @@ struct drm_get_cap { | |||
673 | #define DRM_IOCTL_UNLOCK DRM_IOW( 0x2b, struct drm_lock) | 684 | #define DRM_IOCTL_UNLOCK DRM_IOW( 0x2b, struct drm_lock) |
674 | #define DRM_IOCTL_FINISH DRM_IOW( 0x2c, struct drm_lock) | 685 | #define DRM_IOCTL_FINISH DRM_IOW( 0x2c, struct drm_lock) |
675 | 686 | ||
676 | #define DRM_IOCTL_GEM_PRIME_OPEN DRM_IOWR(0x2e, struct drm_gem_open) | 687 | #define DRM_IOCTL_PRIME_HANDLE_TO_FD DRM_IOWR(0x2d, struct drm_prime_handle) |
688 | #define DRM_IOCTL_PRIME_FD_TO_HANDLE DRM_IOWR(0x2e, struct drm_prime_handle) | ||
677 | 689 | ||
678 | #define DRM_IOCTL_AGP_ACQUIRE DRM_IO( 0x30) | 690 | #define DRM_IOCTL_AGP_ACQUIRE DRM_IO( 0x30) |
679 | #define DRM_IOCTL_AGP_RELEASE DRM_IO( 0x31) | 691 | #define DRM_IOCTL_AGP_RELEASE DRM_IO( 0x31) |
@@ -761,6 +773,8 @@ struct drm_event_vblank { | |||
761 | 773 | ||
762 | #define DRM_CAP_DUMB_BUFFER 0x1 | 774 | #define DRM_CAP_DUMB_BUFFER 0x1 |
763 | #define DRM_CAP_VBLANK_HIGH_CRTC 0x2 | 775 | #define DRM_CAP_VBLANK_HIGH_CRTC 0x2 |
776 | #define DRM_CAP_DUMB_PREFERRED_DEPTH 0x3 | ||
777 | #define DRM_CAP_DUMB_PREFER_SHADOW 0x4 | ||
764 | 778 | ||
765 | /* typedef area */ | 779 | /* typedef area */ |
766 | #ifndef __KERNEL__ | 780 | #ifndef __KERNEL__ |
diff --git a/include/drm/drmP.h b/include/drm/drmP.h index 92f0981b5fb8..dd731043fecd 100644 --- a/include/drm/drmP.h +++ b/include/drm/drmP.h | |||
@@ -91,6 +91,7 @@ struct drm_device; | |||
91 | #define DRM_UT_CORE 0x01 | 91 | #define DRM_UT_CORE 0x01 |
92 | #define DRM_UT_DRIVER 0x02 | 92 | #define DRM_UT_DRIVER 0x02 |
93 | #define DRM_UT_KMS 0x04 | 93 | #define DRM_UT_KMS 0x04 |
94 | #define DRM_UT_PRIME 0x08 | ||
94 | /* | 95 | /* |
95 | * Three debug levels are defined. | 96 | * Three debug levels are defined. |
96 | * drm_core, drm_driver, drm_kms | 97 | * drm_core, drm_driver, drm_kms |
@@ -150,6 +151,7 @@ int drm_err(const char *func, const char *format, ...); | |||
150 | #define DRIVER_IRQ_VBL2 0x800 | 151 | #define DRIVER_IRQ_VBL2 0x800 |
151 | #define DRIVER_GEM 0x1000 | 152 | #define DRIVER_GEM 0x1000 |
152 | #define DRIVER_MODESET 0x2000 | 153 | #define DRIVER_MODESET 0x2000 |
154 | #define DRIVER_PRIME 0x4000 | ||
153 | 155 | ||
154 | #define DRIVER_BUS_PCI 0x1 | 156 | #define DRIVER_BUS_PCI 0x1 |
155 | #define DRIVER_BUS_PLATFORM 0x2 | 157 | #define DRIVER_BUS_PLATFORM 0x2 |
@@ -215,6 +217,11 @@ int drm_err(const char *func, const char *format, ...); | |||
215 | drm_ut_debug_printk(DRM_UT_KMS, DRM_NAME, \ | 217 | drm_ut_debug_printk(DRM_UT_KMS, DRM_NAME, \ |
216 | __func__, fmt, ##args); \ | 218 | __func__, fmt, ##args); \ |
217 | } while (0) | 219 | } while (0) |
220 | #define DRM_DEBUG_PRIME(fmt, args...) \ | ||
221 | do { \ | ||
222 | drm_ut_debug_printk(DRM_UT_PRIME, DRM_NAME, \ | ||
223 | __func__, fmt, ##args); \ | ||
224 | } while (0) | ||
218 | #define DRM_LOG(fmt, args...) \ | 225 | #define DRM_LOG(fmt, args...) \ |
219 | do { \ | 226 | do { \ |
220 | drm_ut_debug_printk(DRM_UT_CORE, NULL, \ | 227 | drm_ut_debug_printk(DRM_UT_CORE, NULL, \ |
@@ -238,6 +245,7 @@ int drm_err(const char *func, const char *format, ...); | |||
238 | #else | 245 | #else |
239 | #define DRM_DEBUG_DRIVER(fmt, args...) do { } while (0) | 246 | #define DRM_DEBUG_DRIVER(fmt, args...) do { } while (0) |
240 | #define DRM_DEBUG_KMS(fmt, args...) do { } while (0) | 247 | #define DRM_DEBUG_KMS(fmt, args...) do { } while (0) |
248 | #define DRM_DEBUG_PRIME(fmt, args...) do { } while (0) | ||
241 | #define DRM_DEBUG(fmt, arg...) do { } while (0) | 249 | #define DRM_DEBUG(fmt, arg...) do { } while (0) |
242 | #define DRM_LOG(fmt, arg...) do { } while (0) | 250 | #define DRM_LOG(fmt, arg...) do { } while (0) |
243 | #define DRM_LOG_KMS(fmt, args...) do { } while (0) | 251 | #define DRM_LOG_KMS(fmt, args...) do { } while (0) |
@@ -410,6 +418,12 @@ struct drm_pending_event { | |||
410 | void (*destroy)(struct drm_pending_event *event); | 418 | void (*destroy)(struct drm_pending_event *event); |
411 | }; | 419 | }; |
412 | 420 | ||
421 | /* initial implementaton using a linked list - todo hashtab */ | ||
422 | struct drm_prime_file_private { | ||
423 | struct list_head head; | ||
424 | struct mutex lock; | ||
425 | }; | ||
426 | |||
413 | /** File private data */ | 427 | /** File private data */ |
414 | struct drm_file { | 428 | struct drm_file { |
415 | int authenticated; | 429 | int authenticated; |
@@ -437,6 +451,8 @@ struct drm_file { | |||
437 | wait_queue_head_t event_wait; | 451 | wait_queue_head_t event_wait; |
438 | struct list_head event_list; | 452 | struct list_head event_list; |
439 | int event_space; | 453 | int event_space; |
454 | |||
455 | struct drm_prime_file_private prime; | ||
440 | }; | 456 | }; |
441 | 457 | ||
442 | /** Wait queue */ | 458 | /** Wait queue */ |
@@ -652,6 +668,12 @@ struct drm_gem_object { | |||
652 | uint32_t pending_write_domain; | 668 | uint32_t pending_write_domain; |
653 | 669 | ||
654 | void *driver_private; | 670 | void *driver_private; |
671 | |||
672 | /* dma buf exported from this GEM object */ | ||
673 | struct dma_buf *export_dma_buf; | ||
674 | |||
675 | /* dma buf attachment backing this object */ | ||
676 | struct dma_buf_attachment *import_attach; | ||
655 | }; | 677 | }; |
656 | 678 | ||
657 | #include "drm_crtc.h" | 679 | #include "drm_crtc.h" |
@@ -890,6 +912,20 @@ struct drm_driver { | |||
890 | int (*gem_open_object) (struct drm_gem_object *, struct drm_file *); | 912 | int (*gem_open_object) (struct drm_gem_object *, struct drm_file *); |
891 | void (*gem_close_object) (struct drm_gem_object *, struct drm_file *); | 913 | void (*gem_close_object) (struct drm_gem_object *, struct drm_file *); |
892 | 914 | ||
915 | /* prime: */ | ||
916 | /* export handle -> fd (see drm_gem_prime_handle_to_fd() helper) */ | ||
917 | int (*prime_handle_to_fd)(struct drm_device *dev, struct drm_file *file_priv, | ||
918 | uint32_t handle, uint32_t flags, int *prime_fd); | ||
919 | /* import fd -> handle (see drm_gem_prime_fd_to_handle() helper) */ | ||
920 | int (*prime_fd_to_handle)(struct drm_device *dev, struct drm_file *file_priv, | ||
921 | int prime_fd, uint32_t *handle); | ||
922 | /* export GEM -> dmabuf */ | ||
923 | struct dma_buf * (*gem_prime_export)(struct drm_device *dev, | ||
924 | struct drm_gem_object *obj, int flags); | ||
925 | /* import dmabuf -> GEM */ | ||
926 | struct drm_gem_object * (*gem_prime_import)(struct drm_device *dev, | ||
927 | struct dma_buf *dma_buf); | ||
928 | |||
893 | /* vga arb irq handler */ | 929 | /* vga arb irq handler */ |
894 | void (*vgaarb_irq)(struct drm_device *dev, bool state); | 930 | void (*vgaarb_irq)(struct drm_device *dev, bool state); |
895 | 931 | ||
@@ -1170,6 +1206,8 @@ struct drm_device { | |||
1170 | struct idr object_name_idr; | 1206 | struct idr object_name_idr; |
1171 | /*@} */ | 1207 | /*@} */ |
1172 | int switch_power_state; | 1208 | int switch_power_state; |
1209 | |||
1210 | atomic_t unplugged; /* device has been unplugged or gone away */ | ||
1173 | }; | 1211 | }; |
1174 | 1212 | ||
1175 | #define DRM_SWITCH_POWER_ON 0 | 1213 | #define DRM_SWITCH_POWER_ON 0 |
@@ -1235,6 +1273,19 @@ static inline int drm_mtrr_del(int handle, unsigned long offset, | |||
1235 | } | 1273 | } |
1236 | #endif | 1274 | #endif |
1237 | 1275 | ||
1276 | static inline void drm_device_set_unplugged(struct drm_device *dev) | ||
1277 | { | ||
1278 | smp_wmb(); | ||
1279 | atomic_set(&dev->unplugged, 1); | ||
1280 | } | ||
1281 | |||
1282 | static inline int drm_device_is_unplugged(struct drm_device *dev) | ||
1283 | { | ||
1284 | int ret = atomic_read(&dev->unplugged); | ||
1285 | smp_rmb(); | ||
1286 | return ret; | ||
1287 | } | ||
1288 | |||
1238 | /******************************************************************/ | 1289 | /******************************************************************/ |
1239 | /** \name Internal function definitions */ | 1290 | /** \name Internal function definitions */ |
1240 | /*@{*/ | 1291 | /*@{*/ |
@@ -1264,11 +1315,6 @@ extern unsigned int drm_poll(struct file *filp, struct poll_table_struct *wait); | |||
1264 | 1315 | ||
1265 | /* Memory management support (drm_memory.h) */ | 1316 | /* Memory management support (drm_memory.h) */ |
1266 | #include "drm_memory.h" | 1317 | #include "drm_memory.h" |
1267 | extern void drm_mem_init(void); | ||
1268 | extern int drm_mem_info(char *buf, char **start, off_t offset, | ||
1269 | int request, int *eof, void *data); | ||
1270 | extern void *drm_realloc(void *oldpt, size_t oldsize, size_t size, int area); | ||
1271 | |||
1272 | extern void drm_free_agp(DRM_AGP_MEM * handle, int pages); | 1318 | extern void drm_free_agp(DRM_AGP_MEM * handle, int pages); |
1273 | extern int drm_bind_agp(DRM_AGP_MEM * handle, unsigned int start); | 1319 | extern int drm_bind_agp(DRM_AGP_MEM * handle, unsigned int start); |
1274 | extern DRM_AGP_MEM *drm_agp_bind_pages(struct drm_device *dev, | 1320 | extern DRM_AGP_MEM *drm_agp_bind_pages(struct drm_device *dev, |
@@ -1383,12 +1429,8 @@ extern void drm_core_reclaim_buffers(struct drm_device *dev, | |||
1383 | /* IRQ support (drm_irq.h) */ | 1429 | /* IRQ support (drm_irq.h) */ |
1384 | extern int drm_control(struct drm_device *dev, void *data, | 1430 | extern int drm_control(struct drm_device *dev, void *data, |
1385 | struct drm_file *file_priv); | 1431 | struct drm_file *file_priv); |
1386 | extern irqreturn_t drm_irq_handler(DRM_IRQ_ARGS); | ||
1387 | extern int drm_irq_install(struct drm_device *dev); | 1432 | extern int drm_irq_install(struct drm_device *dev); |
1388 | extern int drm_irq_uninstall(struct drm_device *dev); | 1433 | extern int drm_irq_uninstall(struct drm_device *dev); |
1389 | extern void drm_driver_irq_preinstall(struct drm_device *dev); | ||
1390 | extern void drm_driver_irq_postinstall(struct drm_device *dev); | ||
1391 | extern void drm_driver_irq_uninstall(struct drm_device *dev); | ||
1392 | 1434 | ||
1393 | extern int drm_vblank_init(struct drm_device *dev, int num_crtcs); | 1435 | extern int drm_vblank_init(struct drm_device *dev, int num_crtcs); |
1394 | extern int drm_wait_vblank(struct drm_device *dev, void *data, | 1436 | extern int drm_wait_vblank(struct drm_device *dev, void *data, |
@@ -1464,6 +1506,7 @@ extern void drm_master_put(struct drm_master **master); | |||
1464 | 1506 | ||
1465 | extern void drm_put_dev(struct drm_device *dev); | 1507 | extern void drm_put_dev(struct drm_device *dev); |
1466 | extern int drm_put_minor(struct drm_minor **minor); | 1508 | extern int drm_put_minor(struct drm_minor **minor); |
1509 | extern void drm_unplug_dev(struct drm_device *dev); | ||
1467 | extern unsigned int drm_debug; | 1510 | extern unsigned int drm_debug; |
1468 | 1511 | ||
1469 | extern unsigned int drm_vblank_offdelay; | 1512 | extern unsigned int drm_vblank_offdelay; |
@@ -1502,6 +1545,32 @@ extern int drm_vblank_info(struct seq_file *m, void *data); | |||
1502 | extern int drm_clients_info(struct seq_file *m, void* data); | 1545 | extern int drm_clients_info(struct seq_file *m, void* data); |
1503 | extern int drm_gem_name_info(struct seq_file *m, void *data); | 1546 | extern int drm_gem_name_info(struct seq_file *m, void *data); |
1504 | 1547 | ||
1548 | |||
1549 | extern int drm_gem_prime_handle_to_fd(struct drm_device *dev, | ||
1550 | struct drm_file *file_priv, uint32_t handle, uint32_t flags, | ||
1551 | int *prime_fd); | ||
1552 | extern int drm_gem_prime_fd_to_handle(struct drm_device *dev, | ||
1553 | struct drm_file *file_priv, int prime_fd, uint32_t *handle); | ||
1554 | |||
1555 | extern int drm_prime_handle_to_fd_ioctl(struct drm_device *dev, void *data, | ||
1556 | struct drm_file *file_priv); | ||
1557 | extern int drm_prime_fd_to_handle_ioctl(struct drm_device *dev, void *data, | ||
1558 | struct drm_file *file_priv); | ||
1559 | |||
1560 | extern struct sg_table *drm_prime_pages_to_sg(struct page **pages, int nr_pages); | ||
1561 | extern void drm_prime_gem_destroy(struct drm_gem_object *obj, struct sg_table *sg); | ||
1562 | |||
1563 | |||
1564 | void drm_prime_init_file_private(struct drm_prime_file_private *prime_fpriv); | ||
1565 | void drm_prime_destroy_file_private(struct drm_prime_file_private *prime_fpriv); | ||
1566 | int drm_prime_add_imported_buf_handle(struct drm_prime_file_private *prime_fpriv, struct dma_buf *dma_buf, uint32_t handle); | ||
1567 | int drm_prime_lookup_imported_buf_handle(struct drm_prime_file_private *prime_fpriv, struct dma_buf *dma_buf, uint32_t *handle); | ||
1568 | void drm_prime_remove_imported_buf_handle(struct drm_prime_file_private *prime_fpriv, struct dma_buf *dma_buf); | ||
1569 | |||
1570 | int drm_prime_add_dma_buf(struct drm_device *dev, struct drm_gem_object *obj); | ||
1571 | int drm_prime_lookup_obj(struct drm_device *dev, struct dma_buf *buf, | ||
1572 | struct drm_gem_object **obj); | ||
1573 | |||
1505 | #if DRM_DEBUG_CODE | 1574 | #if DRM_DEBUG_CODE |
1506 | extern int drm_vma_info(struct seq_file *m, void *data); | 1575 | extern int drm_vma_info(struct seq_file *m, void *data); |
1507 | #endif | 1576 | #endif |
diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h index 4cd4be26722c..e250eda4e3a8 100644 --- a/include/drm/drm_crtc.h +++ b/include/drm/drm_crtc.h | |||
@@ -121,7 +121,7 @@ struct drm_display_mode { | |||
121 | char name[DRM_DISPLAY_MODE_LEN]; | 121 | char name[DRM_DISPLAY_MODE_LEN]; |
122 | 122 | ||
123 | enum drm_mode_status status; | 123 | enum drm_mode_status status; |
124 | int type; | 124 | unsigned int type; |
125 | 125 | ||
126 | /* Proposed mode values */ | 126 | /* Proposed mode values */ |
127 | int clock; /* in kHz */ | 127 | int clock; /* in kHz */ |
@@ -257,7 +257,7 @@ struct drm_property_blob { | |||
257 | struct drm_mode_object base; | 257 | struct drm_mode_object base; |
258 | struct list_head head; | 258 | struct list_head head; |
259 | unsigned int length; | 259 | unsigned int length; |
260 | void *data; | 260 | unsigned char data[]; |
261 | }; | 261 | }; |
262 | 262 | ||
263 | struct drm_property_enum { | 263 | struct drm_property_enum { |
@@ -796,6 +796,9 @@ struct drm_mode_config { | |||
796 | struct drm_property *scaling_mode_property; | 796 | struct drm_property *scaling_mode_property; |
797 | struct drm_property *dithering_mode_property; | 797 | struct drm_property *dithering_mode_property; |
798 | struct drm_property *dirty_info_property; | 798 | struct drm_property *dirty_info_property; |
799 | |||
800 | /* dumb ioctl parameters */ | ||
801 | uint32_t preferred_depth, prefer_shadow; | ||
799 | }; | 802 | }; |
800 | 803 | ||
801 | #define obj_to_crtc(x) container_of(x, struct drm_crtc, base) | 804 | #define obj_to_crtc(x) container_of(x, struct drm_crtc, base) |
@@ -807,23 +810,29 @@ struct drm_mode_config { | |||
807 | #define obj_to_blob(x) container_of(x, struct drm_property_blob, base) | 810 | #define obj_to_blob(x) container_of(x, struct drm_property_blob, base) |
808 | #define obj_to_plane(x) container_of(x, struct drm_plane, base) | 811 | #define obj_to_plane(x) container_of(x, struct drm_plane, base) |
809 | 812 | ||
813 | struct drm_prop_enum_list { | ||
814 | int type; | ||
815 | char *name; | ||
816 | }; | ||
810 | 817 | ||
811 | extern void drm_crtc_init(struct drm_device *dev, | 818 | extern int drm_crtc_init(struct drm_device *dev, |
812 | struct drm_crtc *crtc, | 819 | struct drm_crtc *crtc, |
813 | const struct drm_crtc_funcs *funcs); | 820 | const struct drm_crtc_funcs *funcs); |
814 | extern void drm_crtc_cleanup(struct drm_crtc *crtc); | 821 | extern void drm_crtc_cleanup(struct drm_crtc *crtc); |
815 | 822 | ||
816 | extern void drm_connector_init(struct drm_device *dev, | 823 | extern int drm_connector_init(struct drm_device *dev, |
817 | struct drm_connector *connector, | 824 | struct drm_connector *connector, |
818 | const struct drm_connector_funcs *funcs, | 825 | const struct drm_connector_funcs *funcs, |
819 | int connector_type); | 826 | int connector_type); |
820 | 827 | ||
821 | extern void drm_connector_cleanup(struct drm_connector *connector); | 828 | extern void drm_connector_cleanup(struct drm_connector *connector); |
829 | /* helper to unplug all connectors from sysfs for device */ | ||
830 | extern void drm_connector_unplug_all(struct drm_device *dev); | ||
822 | 831 | ||
823 | extern void drm_encoder_init(struct drm_device *dev, | 832 | extern int drm_encoder_init(struct drm_device *dev, |
824 | struct drm_encoder *encoder, | 833 | struct drm_encoder *encoder, |
825 | const struct drm_encoder_funcs *funcs, | 834 | const struct drm_encoder_funcs *funcs, |
826 | int encoder_type); | 835 | int encoder_type); |
827 | 836 | ||
828 | extern int drm_plane_init(struct drm_device *dev, | 837 | extern int drm_plane_init(struct drm_device *dev, |
829 | struct drm_plane *plane, | 838 | struct drm_plane *plane, |
@@ -848,6 +857,7 @@ extern struct edid *drm_get_edid(struct drm_connector *connector, | |||
848 | extern int drm_add_edid_modes(struct drm_connector *connector, struct edid *edid); | 857 | extern int drm_add_edid_modes(struct drm_connector *connector, struct edid *edid); |
849 | extern void drm_mode_probed_add(struct drm_connector *connector, struct drm_display_mode *mode); | 858 | extern void drm_mode_probed_add(struct drm_connector *connector, struct drm_display_mode *mode); |
850 | extern void drm_mode_remove(struct drm_connector *connector, struct drm_display_mode *mode); | 859 | extern void drm_mode_remove(struct drm_connector *connector, struct drm_display_mode *mode); |
860 | extern void drm_mode_copy(struct drm_display_mode *dst, const struct drm_display_mode *src); | ||
851 | extern struct drm_display_mode *drm_mode_duplicate(struct drm_device *dev, | 861 | extern struct drm_display_mode *drm_mode_duplicate(struct drm_device *dev, |
852 | const struct drm_display_mode *mode); | 862 | const struct drm_display_mode *mode); |
853 | extern void drm_mode_debug_printmodeline(struct drm_display_mode *mode); | 863 | extern void drm_mode_debug_printmodeline(struct drm_display_mode *mode); |
@@ -862,7 +872,7 @@ extern int drm_mode_height(struct drm_display_mode *mode); | |||
862 | /* for us by fb module */ | 872 | /* for us by fb module */ |
863 | extern int drm_mode_attachmode_crtc(struct drm_device *dev, | 873 | extern int drm_mode_attachmode_crtc(struct drm_device *dev, |
864 | struct drm_crtc *crtc, | 874 | struct drm_crtc *crtc, |
865 | struct drm_display_mode *mode); | 875 | const struct drm_display_mode *mode); |
866 | extern int drm_mode_detachmode_crtc(struct drm_device *dev, struct drm_display_mode *mode); | 876 | extern int drm_mode_detachmode_crtc(struct drm_device *dev, struct drm_display_mode *mode); |
867 | 877 | ||
868 | extern struct drm_display_mode *drm_mode_create(struct drm_device *dev); | 878 | extern struct drm_display_mode *drm_mode_create(struct drm_device *dev); |
@@ -904,6 +914,13 @@ extern int drm_connector_attach_property(struct drm_connector *connector, | |||
904 | struct drm_property *property, uint64_t init_val); | 914 | struct drm_property *property, uint64_t init_val); |
905 | extern struct drm_property *drm_property_create(struct drm_device *dev, int flags, | 915 | extern struct drm_property *drm_property_create(struct drm_device *dev, int flags, |
906 | const char *name, int num_values); | 916 | const char *name, int num_values); |
917 | extern struct drm_property *drm_property_create_enum(struct drm_device *dev, int flags, | ||
918 | const char *name, | ||
919 | const struct drm_prop_enum_list *props, | ||
920 | int num_values); | ||
921 | struct drm_property *drm_property_create_range(struct drm_device *dev, int flags, | ||
922 | const char *name, | ||
923 | uint64_t min, uint64_t max); | ||
907 | extern void drm_property_destroy(struct drm_device *dev, struct drm_property *property); | 924 | extern void drm_property_destroy(struct drm_device *dev, struct drm_property *property); |
908 | extern int drm_property_add_enum(struct drm_property *property, int index, | 925 | extern int drm_property_add_enum(struct drm_property *property, int index, |
909 | uint64_t value, const char *name); | 926 | uint64_t value, const char *name); |
@@ -919,7 +936,7 @@ extern int drm_mode_connector_attach_encoder(struct drm_connector *connector, | |||
919 | struct drm_encoder *encoder); | 936 | struct drm_encoder *encoder); |
920 | extern void drm_mode_connector_detach_encoder(struct drm_connector *connector, | 937 | extern void drm_mode_connector_detach_encoder(struct drm_connector *connector, |
921 | struct drm_encoder *encoder); | 938 | struct drm_encoder *encoder); |
922 | extern bool drm_mode_crtc_set_gamma_size(struct drm_crtc *crtc, | 939 | extern int drm_mode_crtc_set_gamma_size(struct drm_crtc *crtc, |
923 | int gamma_size); | 940 | int gamma_size); |
924 | extern struct drm_mode_object *drm_mode_object_find(struct drm_device *dev, | 941 | extern struct drm_mode_object *drm_mode_object_find(struct drm_device *dev, |
925 | uint32_t id, uint32_t type); | 942 | uint32_t id, uint32_t type); |
@@ -995,6 +1012,7 @@ extern int drm_add_modes_noedid(struct drm_connector *connector, | |||
995 | int hdisplay, int vdisplay); | 1012 | int hdisplay, int vdisplay); |
996 | 1013 | ||
997 | extern int drm_edid_header_is_valid(const u8 *raw_edid); | 1014 | extern int drm_edid_header_is_valid(const u8 *raw_edid); |
1015 | extern bool drm_edid_block_valid(u8 *raw_edid); | ||
998 | extern bool drm_edid_is_valid(struct edid *edid); | 1016 | extern bool drm_edid_is_valid(struct edid *edid); |
999 | struct drm_display_mode *drm_mode_find_dmt(struct drm_device *dev, | 1017 | struct drm_display_mode *drm_mode_find_dmt(struct drm_device *dev, |
1000 | int hsize, int vsize, int fresh); | 1018 | int hsize, int vsize, int fresh); |
diff --git a/include/drm/drm_edid.h b/include/drm/drm_edid.h index 74ce91684629..bcb9a66baa8c 100644 --- a/include/drm/drm_edid.h +++ b/include/drm/drm_edid.h | |||
@@ -238,5 +238,6 @@ int drm_av_sync_delay(struct drm_connector *connector, | |||
238 | struct drm_display_mode *mode); | 238 | struct drm_display_mode *mode); |
239 | struct drm_connector *drm_select_eld(struct drm_encoder *encoder, | 239 | struct drm_connector *drm_select_eld(struct drm_encoder *encoder, |
240 | struct drm_display_mode *mode); | 240 | struct drm_display_mode *mode); |
241 | int drm_load_edid_firmware(struct drm_connector *connector); | ||
241 | 242 | ||
242 | #endif /* __DRM_EDID_H__ */ | 243 | #endif /* __DRM_EDID_H__ */ |
diff --git a/include/drm/drm_fb_helper.h b/include/drm/drm_fb_helper.h index 6e3076ad646e..5120b01c2eeb 100644 --- a/include/drm/drm_fb_helper.h +++ b/include/drm/drm_fb_helper.h | |||
@@ -35,7 +35,6 @@ struct drm_fb_helper; | |||
35 | #include <linux/kgdb.h> | 35 | #include <linux/kgdb.h> |
36 | 36 | ||
37 | struct drm_fb_helper_crtc { | 37 | struct drm_fb_helper_crtc { |
38 | uint32_t crtc_id; | ||
39 | struct drm_mode_set mode_set; | 38 | struct drm_mode_set mode_set; |
40 | struct drm_display_mode *desired_mode; | 39 | struct drm_display_mode *desired_mode; |
41 | }; | 40 | }; |
@@ -74,7 +73,6 @@ struct drm_fb_helper { | |||
74 | int connector_count; | 73 | int connector_count; |
75 | struct drm_fb_helper_connector **connector_info; | 74 | struct drm_fb_helper_connector **connector_info; |
76 | struct drm_fb_helper_funcs *funcs; | 75 | struct drm_fb_helper_funcs *funcs; |
77 | int conn_limit; | ||
78 | struct fb_info *fbdev; | 76 | struct fb_info *fbdev; |
79 | u32 pseudo_palette[17]; | 77 | u32 pseudo_palette[17]; |
80 | struct list_head kernel_fb_list; | 78 | struct list_head kernel_fb_list; |
diff --git a/include/drm/drm_mode.h b/include/drm/drm_mode.h index 2a2acda8b437..4a0aae38e160 100644 --- a/include/drm/drm_mode.h +++ b/include/drm/drm_mode.h | |||
@@ -27,6 +27,8 @@ | |||
27 | #ifndef _DRM_MODE_H | 27 | #ifndef _DRM_MODE_H |
28 | #define _DRM_MODE_H | 28 | #define _DRM_MODE_H |
29 | 29 | ||
30 | #include <linux/types.h> | ||
31 | |||
30 | #define DRM_DISPLAY_INFO_LEN 32 | 32 | #define DRM_DISPLAY_INFO_LEN 32 |
31 | #define DRM_CONNECTOR_NAME_LEN 32 | 33 | #define DRM_CONNECTOR_NAME_LEN 32 |
32 | #define DRM_DISPLAY_MODE_LEN 32 | 34 | #define DRM_DISPLAY_MODE_LEN 32 |
diff --git a/include/drm/drm_pciids.h b/include/drm/drm_pciids.h index 14b6cd022284..58d0bdab68dd 100644 --- a/include/drm/drm_pciids.h +++ b/include/drm/drm_pciids.h | |||
@@ -202,11 +202,49 @@ | |||
202 | {0x1002, 0x6778, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CAICOS|RADEON_NEW_MEMMAP}, \ | 202 | {0x1002, 0x6778, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CAICOS|RADEON_NEW_MEMMAP}, \ |
203 | {0x1002, 0x6779, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CAICOS|RADEON_NEW_MEMMAP}, \ | 203 | {0x1002, 0x6779, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CAICOS|RADEON_NEW_MEMMAP}, \ |
204 | {0x1002, 0x677B, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CAICOS|RADEON_NEW_MEMMAP}, \ | 204 | {0x1002, 0x677B, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CAICOS|RADEON_NEW_MEMMAP}, \ |
205 | {0x1002, 0x6780, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TAHITI|RADEON_NEW_MEMMAP}, \ | ||
206 | {0x1002, 0x6784, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TAHITI|RADEON_NEW_MEMMAP}, \ | ||
207 | {0x1002, 0x6788, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TAHITI|RADEON_NEW_MEMMAP}, \ | ||
208 | {0x1002, 0x678A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TAHITI|RADEON_NEW_MEMMAP}, \ | ||
209 | {0x1002, 0x6790, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TAHITI|RADEON_NEW_MEMMAP}, \ | ||
210 | {0x1002, 0x6798, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TAHITI|RADEON_NEW_MEMMAP}, \ | ||
211 | {0x1002, 0x6799, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TAHITI|RADEON_NEW_MEMMAP}, \ | ||
212 | {0x1002, 0x679A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TAHITI|RADEON_NEW_MEMMAP}, \ | ||
213 | {0x1002, 0x679E, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TAHITI|RADEON_NEW_MEMMAP}, \ | ||
214 | {0x1002, 0x679F, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TAHITI|RADEON_NEW_MEMMAP}, \ | ||
215 | {0x1002, 0x6800, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PITCAIRN|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ | ||
216 | {0x1002, 0x6801, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PITCAIRN|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ | ||
217 | {0x1002, 0x6802, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PITCAIRN|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ | ||
218 | {0x1002, 0x6808, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PITCAIRN|RADEON_NEW_MEMMAP}, \ | ||
219 | {0x1002, 0x6809, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PITCAIRN|RADEON_NEW_MEMMAP}, \ | ||
220 | {0x1002, 0x6810, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PITCAIRN|RADEON_NEW_MEMMAP}, \ | ||
221 | {0x1002, 0x6818, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PITCAIRN|RADEON_NEW_MEMMAP}, \ | ||
222 | {0x1002, 0x6819, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PITCAIRN|RADEON_NEW_MEMMAP}, \ | ||
223 | {0x1002, 0x6820, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VERDE|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ | ||
224 | {0x1002, 0x6821, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VERDE|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ | ||
225 | {0x1002, 0x6823, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VERDE|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ | ||
226 | {0x1002, 0x6824, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VERDE|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ | ||
227 | {0x1002, 0x6825, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VERDE|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ | ||
228 | {0x1002, 0x6826, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VERDE|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ | ||
229 | {0x1002, 0x6827, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VERDE|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ | ||
230 | {0x1002, 0x6828, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VERDE|RADEON_NEW_MEMMAP}, \ | ||
231 | {0x1002, 0x6829, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VERDE|RADEON_NEW_MEMMAP}, \ | ||
232 | {0x1002, 0x682D, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VERDE|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ | ||
233 | {0x1002, 0x682F, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VERDE|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ | ||
234 | {0x1002, 0x6830, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VERDE|RADEON_NEW_MEMMAP}, \ | ||
235 | {0x1002, 0x6831, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VERDE|RADEON_NEW_MEMMAP}, \ | ||
236 | {0x1002, 0x6837, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VERDE|RADEON_NEW_MEMMAP}, \ | ||
237 | {0x1002, 0x6838, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VERDE|RADEON_NEW_MEMMAP}, \ | ||
238 | {0x1002, 0x6839, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VERDE|RADEON_NEW_MEMMAP}, \ | ||
239 | {0x1002, 0x683B, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VERDE|RADEON_NEW_MEMMAP}, \ | ||
240 | {0x1002, 0x683D, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VERDE|RADEON_NEW_MEMMAP}, \ | ||
241 | {0x1002, 0x683F, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VERDE|RADEON_NEW_MEMMAP}, \ | ||
205 | {0x1002, 0x6840, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TURKS|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ | 242 | {0x1002, 0x6840, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TURKS|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ |
206 | {0x1002, 0x6841, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TURKS|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ | 243 | {0x1002, 0x6841, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TURKS|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ |
207 | {0x1002, 0x6842, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TURKS|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ | 244 | {0x1002, 0x6842, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TURKS|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ |
208 | {0x1002, 0x6843, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TURKS|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ | 245 | {0x1002, 0x6843, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TURKS|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ |
209 | {0x1002, 0x6849, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TURKS|RADEON_NEW_MEMMAP}, \ | 246 | {0x1002, 0x6849, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TURKS|RADEON_NEW_MEMMAP}, \ |
247 | {0x1002, 0x684C, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PITCAIRN|RADEON_NEW_MEMMAP}, \ | ||
210 | {0x1002, 0x6850, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TURKS|RADEON_NEW_MEMMAP}, \ | 248 | {0x1002, 0x6850, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TURKS|RADEON_NEW_MEMMAP}, \ |
211 | {0x1002, 0x6858, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TURKS|RADEON_NEW_MEMMAP}, \ | 249 | {0x1002, 0x6858, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TURKS|RADEON_NEW_MEMMAP}, \ |
212 | {0x1002, 0x6859, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TURKS|RADEON_NEW_MEMMAP}, \ | 250 | {0x1002, 0x6859, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TURKS|RADEON_NEW_MEMMAP}, \ |
@@ -512,6 +550,22 @@ | |||
512 | {0x1002, 0x9807, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PALM|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ | 550 | {0x1002, 0x9807, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PALM|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ |
513 | {0x1002, 0x9808, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PALM|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ | 551 | {0x1002, 0x9808, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PALM|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ |
514 | {0x1002, 0x9809, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PALM|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ | 552 | {0x1002, 0x9809, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PALM|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ |
553 | {0x1002, 0x9900, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ | ||
554 | {0x1002, 0x9901, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ | ||
555 | {0x1002, 0x9903, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ | ||
556 | {0x1002, 0x9904, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ | ||
557 | {0x1002, 0x9905, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ | ||
558 | {0x1002, 0x9906, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ | ||
559 | {0x1002, 0x9907, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ | ||
560 | {0x1002, 0x9908, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ | ||
561 | {0x1002, 0x9909, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ | ||
562 | {0x1002, 0x990A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ | ||
563 | {0x1002, 0x990F, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ | ||
564 | {0x1002, 0x9990, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ | ||
565 | {0x1002, 0x9991, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ | ||
566 | {0x1002, 0x9992, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ | ||
567 | {0x1002, 0x9993, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ | ||
568 | {0x1002, 0x9994, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ | ||
515 | {0, 0, 0} | 569 | {0, 0, 0} |
516 | 570 | ||
517 | #define r128_PCI_IDS \ | 571 | #define r128_PCI_IDS \ |
diff --git a/include/drm/exynos_drm.h b/include/drm/exynos_drm.h index 1ed3aae893a5..e478de4e5d56 100644 --- a/include/drm/exynos_drm.h +++ b/include/drm/exynos_drm.h | |||
@@ -74,16 +74,38 @@ struct drm_exynos_gem_mmap { | |||
74 | uint64_t mapped; | 74 | uint64_t mapped; |
75 | }; | 75 | }; |
76 | 76 | ||
77 | /** | ||
78 | * A structure for user connection request of virtual display. | ||
79 | * | ||
80 | * @connection: indicate whether doing connetion or not by user. | ||
81 | * @extensions: if this value is 1 then the vidi driver would need additional | ||
82 | * 128bytes edid data. | ||
83 | * @edid: the edid data pointer from user side. | ||
84 | */ | ||
85 | struct drm_exynos_vidi_connection { | ||
86 | unsigned int connection; | ||
87 | unsigned int extensions; | ||
88 | uint64_t edid; | ||
89 | }; | ||
90 | |||
77 | struct drm_exynos_plane_set_zpos { | 91 | struct drm_exynos_plane_set_zpos { |
78 | __u32 plane_id; | 92 | __u32 plane_id; |
79 | __s32 zpos; | 93 | __s32 zpos; |
80 | }; | 94 | }; |
81 | 95 | ||
96 | /* memory type definitions. */ | ||
97 | enum e_drm_exynos_gem_mem_type { | ||
98 | /* Physically Non-Continuous memory. */ | ||
99 | EXYNOS_BO_NONCONTIG = 1 << 0, | ||
100 | EXYNOS_BO_MASK = EXYNOS_BO_NONCONTIG | ||
101 | }; | ||
102 | |||
82 | #define DRM_EXYNOS_GEM_CREATE 0x00 | 103 | #define DRM_EXYNOS_GEM_CREATE 0x00 |
83 | #define DRM_EXYNOS_GEM_MAP_OFFSET 0x01 | 104 | #define DRM_EXYNOS_GEM_MAP_OFFSET 0x01 |
84 | #define DRM_EXYNOS_GEM_MMAP 0x02 | 105 | #define DRM_EXYNOS_GEM_MMAP 0x02 |
85 | /* Reserved 0x03 ~ 0x05 for exynos specific gem ioctl */ | 106 | /* Reserved 0x03 ~ 0x05 for exynos specific gem ioctl */ |
86 | #define DRM_EXYNOS_PLANE_SET_ZPOS 0x06 | 107 | #define DRM_EXYNOS_PLANE_SET_ZPOS 0x06 |
108 | #define DRM_EXYNOS_VIDI_CONNECTION 0x07 | ||
87 | 109 | ||
88 | #define DRM_IOCTL_EXYNOS_GEM_CREATE DRM_IOWR(DRM_COMMAND_BASE + \ | 110 | #define DRM_IOCTL_EXYNOS_GEM_CREATE DRM_IOWR(DRM_COMMAND_BASE + \ |
89 | DRM_EXYNOS_GEM_CREATE, struct drm_exynos_gem_create) | 111 | DRM_EXYNOS_GEM_CREATE, struct drm_exynos_gem_create) |
@@ -97,6 +119,9 @@ struct drm_exynos_plane_set_zpos { | |||
97 | #define DRM_IOCTL_EXYNOS_PLANE_SET_ZPOS DRM_IOWR(DRM_COMMAND_BASE + \ | 119 | #define DRM_IOCTL_EXYNOS_PLANE_SET_ZPOS DRM_IOWR(DRM_COMMAND_BASE + \ |
98 | DRM_EXYNOS_PLANE_SET_ZPOS, struct drm_exynos_plane_set_zpos) | 120 | DRM_EXYNOS_PLANE_SET_ZPOS, struct drm_exynos_plane_set_zpos) |
99 | 121 | ||
122 | #define DRM_IOCTL_EXYNOS_VIDI_CONNECTION DRM_IOWR(DRM_COMMAND_BASE + \ | ||
123 | DRM_EXYNOS_VIDI_CONNECTION, struct drm_exynos_vidi_connection) | ||
124 | |||
100 | #ifdef __KERNEL__ | 125 | #ifdef __KERNEL__ |
101 | 126 | ||
102 | /** | 127 | /** |
@@ -147,11 +172,13 @@ struct exynos_drm_common_hdmi_pd { | |||
147 | * @timing: default video mode for initializing | 172 | * @timing: default video mode for initializing |
148 | * @default_win: default window layer number to be used for UI. | 173 | * @default_win: default window layer number to be used for UI. |
149 | * @bpp: default bit per pixel. | 174 | * @bpp: default bit per pixel. |
175 | * @is_v13: set if hdmi version 13 is. | ||
150 | */ | 176 | */ |
151 | struct exynos_drm_hdmi_pdata { | 177 | struct exynos_drm_hdmi_pdata { |
152 | struct fb_videomode timing; | 178 | struct fb_videomode timing; |
153 | unsigned int default_win; | 179 | unsigned int default_win; |
154 | unsigned int bpp; | 180 | unsigned int bpp; |
181 | unsigned int is_v13:1; | ||
155 | }; | 182 | }; |
156 | 183 | ||
157 | #endif /* __KERNEL__ */ | 184 | #endif /* __KERNEL__ */ |
diff --git a/include/drm/gma_drm.h b/include/drm/gma_drm.h index 113686785717..884613ee00ad 100644 --- a/include/drm/gma_drm.h +++ b/include/drm/gma_drm.h | |||
@@ -83,9 +83,9 @@ struct drm_psb_gem_mmap { | |||
83 | #define DRM_GMA_GAMMA 0x04 /* Set gamma table */ | 83 | #define DRM_GMA_GAMMA 0x04 /* Set gamma table */ |
84 | #define DRM_GMA_ADB 0x05 /* Get backlight */ | 84 | #define DRM_GMA_ADB 0x05 /* Get backlight */ |
85 | #define DRM_GMA_DPST_BL 0x06 /* Set backlight */ | 85 | #define DRM_GMA_DPST_BL 0x06 /* Set backlight */ |
86 | #define DRM_GMA_GET_PIPE_FROM_CRTC_ID 0x1 /* CRTC to physical pipe# */ | ||
87 | #define DRM_GMA_MODE_OPERATION 0x07 /* Mode validation/DC set */ | 86 | #define DRM_GMA_MODE_OPERATION 0x07 /* Mode validation/DC set */ |
88 | #define PSB_MODE_OPERATION_MODE_VALID 0x01 | 87 | #define PSB_MODE_OPERATION_MODE_VALID 0x01 |
88 | #define DRM_GMA_GET_PIPE_FROM_CRTC_ID 0x08 /* CRTC to physical pipe# */ | ||
89 | 89 | ||
90 | 90 | ||
91 | #endif | 91 | #endif |
diff --git a/include/drm/i915_drm.h b/include/drm/i915_drm.h index 924f6a454fed..da929bb5b788 100644 --- a/include/drm/i915_drm.h +++ b/include/drm/i915_drm.h | |||
@@ -296,6 +296,7 @@ typedef struct drm_i915_irq_wait { | |||
296 | #define I915_PARAM_HAS_EXEC_CONSTANTS 14 | 296 | #define I915_PARAM_HAS_EXEC_CONSTANTS 14 |
297 | #define I915_PARAM_HAS_RELAXED_DELTA 15 | 297 | #define I915_PARAM_HAS_RELAXED_DELTA 15 |
298 | #define I915_PARAM_HAS_GEN7_SOL_RESET 16 | 298 | #define I915_PARAM_HAS_GEN7_SOL_RESET 16 |
299 | #define I915_PARAM_HAS_LLC 17 | ||
299 | 300 | ||
300 | typedef struct drm_i915_getparam { | 301 | typedef struct drm_i915_getparam { |
301 | int param; | 302 | int param; |
diff --git a/include/drm/intel-gtt.h b/include/drm/intel-gtt.h index b174620cc9b3..923afb5dcf0c 100644 --- a/include/drm/intel-gtt.h +++ b/include/drm/intel-gtt.h | |||
@@ -15,6 +15,10 @@ const struct intel_gtt { | |||
15 | unsigned int needs_dmar : 1; | 15 | unsigned int needs_dmar : 1; |
16 | /* Whether we idle the gpu before mapping/unmapping */ | 16 | /* Whether we idle the gpu before mapping/unmapping */ |
17 | unsigned int do_idle_maps : 1; | 17 | unsigned int do_idle_maps : 1; |
18 | /* Share the scratch page dma with ppgtts. */ | ||
19 | dma_addr_t scratch_page_dma; | ||
20 | /* for ppgtt PDE access */ | ||
21 | u32 __iomem *gtt; | ||
18 | } *intel_gtt_get(void); | 22 | } *intel_gtt_get(void); |
19 | 23 | ||
20 | void intel_gtt_chipset_flush(void); | 24 | void intel_gtt_chipset_flush(void); |
@@ -40,4 +44,8 @@ void intel_gtt_insert_pages(unsigned int first_entry, unsigned int num_entries, | |||
40 | /* flag for GFDT type */ | 44 | /* flag for GFDT type */ |
41 | #define AGP_USER_CACHED_MEMORY_GFDT (1 << 3) | 45 | #define AGP_USER_CACHED_MEMORY_GFDT (1 << 3) |
42 | 46 | ||
47 | #ifdef CONFIG_INTEL_IOMMU | ||
48 | extern int intel_iommu_gfx_mapped; | ||
49 | #endif | ||
50 | |||
43 | #endif | 51 | #endif |
diff --git a/include/drm/radeon_drm.h b/include/drm/radeon_drm.h index b55da40953fd..7c491b4bcf65 100644 --- a/include/drm/radeon_drm.h +++ b/include/drm/radeon_drm.h | |||
@@ -804,13 +804,23 @@ struct drm_radeon_gem_create { | |||
804 | uint32_t flags; | 804 | uint32_t flags; |
805 | }; | 805 | }; |
806 | 806 | ||
807 | #define RADEON_TILING_MACRO 0x1 | 807 | #define RADEON_TILING_MACRO 0x1 |
808 | #define RADEON_TILING_MICRO 0x2 | 808 | #define RADEON_TILING_MICRO 0x2 |
809 | #define RADEON_TILING_SWAP_16BIT 0x4 | 809 | #define RADEON_TILING_SWAP_16BIT 0x4 |
810 | #define RADEON_TILING_SWAP_32BIT 0x8 | 810 | #define RADEON_TILING_SWAP_32BIT 0x8 |
811 | #define RADEON_TILING_SURFACE 0x10 /* this object requires a surface | 811 | /* this object requires a surface when mapped - i.e. front buffer */ |
812 | * when mapped - i.e. front buffer */ | 812 | #define RADEON_TILING_SURFACE 0x10 |
813 | #define RADEON_TILING_MICRO_SQUARE 0x20 | 813 | #define RADEON_TILING_MICRO_SQUARE 0x20 |
814 | #define RADEON_TILING_EG_BANKW_SHIFT 8 | ||
815 | #define RADEON_TILING_EG_BANKW_MASK 0xf | ||
816 | #define RADEON_TILING_EG_BANKH_SHIFT 12 | ||
817 | #define RADEON_TILING_EG_BANKH_MASK 0xf | ||
818 | #define RADEON_TILING_EG_MACRO_TILE_ASPECT_SHIFT 16 | ||
819 | #define RADEON_TILING_EG_MACRO_TILE_ASPECT_MASK 0xf | ||
820 | #define RADEON_TILING_EG_TILE_SPLIT_SHIFT 24 | ||
821 | #define RADEON_TILING_EG_TILE_SPLIT_MASK 0xf | ||
822 | #define RADEON_TILING_EG_STENCIL_TILE_SPLIT_SHIFT 28 | ||
823 | #define RADEON_TILING_EG_STENCIL_TILE_SPLIT_MASK 0xf | ||
814 | 824 | ||
815 | struct drm_radeon_gem_set_tiling { | 825 | struct drm_radeon_gem_set_tiling { |
816 | uint32_t handle; | 826 | uint32_t handle; |
@@ -898,6 +908,7 @@ struct drm_radeon_gem_va { | |||
898 | #define RADEON_CHUNK_ID_RELOCS 0x01 | 908 | #define RADEON_CHUNK_ID_RELOCS 0x01 |
899 | #define RADEON_CHUNK_ID_IB 0x02 | 909 | #define RADEON_CHUNK_ID_IB 0x02 |
900 | #define RADEON_CHUNK_ID_FLAGS 0x03 | 910 | #define RADEON_CHUNK_ID_FLAGS 0x03 |
911 | #define RADEON_CHUNK_ID_CONST_IB 0x04 | ||
901 | 912 | ||
902 | /* The first dword of RADEON_CHUNK_ID_FLAGS is a uint32 of these flags: */ | 913 | /* The first dword of RADEON_CHUNK_ID_FLAGS is a uint32 of these flags: */ |
903 | #define RADEON_CS_KEEP_TILING_FLAGS 0x01 | 914 | #define RADEON_CS_KEEP_TILING_FLAGS 0x01 |
@@ -952,6 +963,8 @@ struct drm_radeon_cs { | |||
952 | #define RADEON_INFO_VA_START 0x0e | 963 | #define RADEON_INFO_VA_START 0x0e |
953 | /* maximum size of ib using the virtual memory cs */ | 964 | /* maximum size of ib using the virtual memory cs */ |
954 | #define RADEON_INFO_IB_VM_MAX_SIZE 0x0f | 965 | #define RADEON_INFO_IB_VM_MAX_SIZE 0x0f |
966 | /* max pipes - needed for compute shaders */ | ||
967 | #define RADEON_INFO_MAX_PIPES 0x10 | ||
955 | 968 | ||
956 | struct drm_radeon_info { | 969 | struct drm_radeon_info { |
957 | uint32_t request; | 970 | uint32_t request; |
diff --git a/include/drm/ttm/ttm_memory.h b/include/drm/ttm/ttm_memory.h index 26c1f78d136f..d6d1da468c97 100644 --- a/include/drm/ttm/ttm_memory.h +++ b/include/drm/ttm/ttm_memory.h | |||
@@ -30,6 +30,7 @@ | |||
30 | 30 | ||
31 | #include <linux/workqueue.h> | 31 | #include <linux/workqueue.h> |
32 | #include <linux/spinlock.h> | 32 | #include <linux/spinlock.h> |
33 | #include <linux/bug.h> | ||
33 | #include <linux/wait.h> | 34 | #include <linux/wait.h> |
34 | #include <linux/errno.h> | 35 | #include <linux/errno.h> |
35 | #include <linux/kobject.h> | 36 | #include <linux/kobject.h> |
diff --git a/include/linux/Kbuild b/include/linux/Kbuild index c94e71781b79..3c9b616c834a 100644 --- a/include/linux/Kbuild +++ b/include/linux/Kbuild | |||
@@ -3,6 +3,7 @@ header-y += can/ | |||
3 | header-y += caif/ | 3 | header-y += caif/ |
4 | header-y += dvb/ | 4 | header-y += dvb/ |
5 | header-y += hdlc/ | 5 | header-y += hdlc/ |
6 | header-y += hsi/ | ||
6 | header-y += isdn/ | 7 | header-y += isdn/ |
7 | header-y += mmc/ | 8 | header-y += mmc/ |
8 | header-y += nfsd/ | 9 | header-y += nfsd/ |
@@ -120,7 +121,6 @@ header-y += errno.h | |||
120 | header-y += errqueue.h | 121 | header-y += errqueue.h |
121 | header-y += ethtool.h | 122 | header-y += ethtool.h |
122 | header-y += eventpoll.h | 123 | header-y += eventpoll.h |
123 | header-y += ext2_fs.h | ||
124 | header-y += fadvise.h | 124 | header-y += fadvise.h |
125 | header-y += falloc.h | 125 | header-y += falloc.h |
126 | header-y += fanotify.h | 126 | header-y += fanotify.h |
@@ -238,6 +238,7 @@ header-y += magic.h | |||
238 | header-y += major.h | 238 | header-y += major.h |
239 | header-y += map_to_7segment.h | 239 | header-y += map_to_7segment.h |
240 | header-y += matroxfb.h | 240 | header-y += matroxfb.h |
241 | header-y += mdio.h | ||
241 | header-y += media.h | 242 | header-y += media.h |
242 | header-y += mempolicy.h | 243 | header-y += mempolicy.h |
243 | header-y += meye.h | 244 | header-y += meye.h |
@@ -304,6 +305,7 @@ header-y += poll.h | |||
304 | header-y += posix_types.h | 305 | header-y += posix_types.h |
305 | header-y += ppdev.h | 306 | header-y += ppdev.h |
306 | header-y += ppp-comp.h | 307 | header-y += ppp-comp.h |
308 | header-y += ppp-ioctl.h | ||
307 | header-y += ppp_defs.h | 309 | header-y += ppp_defs.h |
308 | header-y += pps.h | 310 | header-y += pps.h |
309 | header-y += prctl.h | 311 | header-y += prctl.h |
@@ -355,6 +357,7 @@ header-y += suspend_ioctls.h | |||
355 | header-y += swab.h | 357 | header-y += swab.h |
356 | header-y += synclink.h | 358 | header-y += synclink.h |
357 | header-y += sysctl.h | 359 | header-y += sysctl.h |
360 | header-y += sysinfo.h | ||
358 | header-y += taskstats.h | 361 | header-y += taskstats.h |
359 | header-y += tcp.h | 362 | header-y += tcp.h |
360 | header-y += telephony.h | 363 | header-y += telephony.h |
diff --git a/include/linux/acpi.h b/include/linux/acpi.h index 3f968665899b..f421dd84f29d 100644 --- a/include/linux/acpi.h +++ b/include/linux/acpi.h | |||
@@ -151,6 +151,7 @@ extern int ec_write(u8 addr, u8 val); | |||
151 | extern int ec_transaction(u8 command, | 151 | extern int ec_transaction(u8 command, |
152 | const u8 *wdata, unsigned wdata_len, | 152 | const u8 *wdata, unsigned wdata_len, |
153 | u8 *rdata, unsigned rdata_len); | 153 | u8 *rdata, unsigned rdata_len); |
154 | extern acpi_handle ec_get_handle(void); | ||
154 | 155 | ||
155 | #if defined(CONFIG_ACPI_WMI) || defined(CONFIG_ACPI_WMI_MODULE) | 156 | #if defined(CONFIG_ACPI_WMI) || defined(CONFIG_ACPI_WMI_MODULE) |
156 | 157 | ||
@@ -371,4 +372,14 @@ static inline int acpi_nvs_for_each_region(int (*func)(__u64, __u64, void *), | |||
371 | 372 | ||
372 | #endif /* !CONFIG_ACPI */ | 373 | #endif /* !CONFIG_ACPI */ |
373 | 374 | ||
375 | #ifdef CONFIG_ACPI | ||
376 | void acpi_os_set_prepare_sleep(int (*func)(u8 sleep_state, | ||
377 | u32 pm1a_ctrl, u32 pm1b_ctrl)); | ||
378 | |||
379 | acpi_status acpi_os_prepare_sleep(u8 sleep_state, | ||
380 | u32 pm1a_control, u32 pm1b_control); | ||
381 | #else | ||
382 | #define acpi_os_set_prepare_sleep(func, pm1a_ctrl, pm1b_ctrl) do { } while (0) | ||
383 | #endif | ||
384 | |||
374 | #endif /*_LINUX_ACPI_H*/ | 385 | #endif /*_LINUX_ACPI_H*/ |
diff --git a/include/linux/aio_abi.h b/include/linux/aio_abi.h index 2c8731664180..86fa7a71336a 100644 --- a/include/linux/aio_abi.h +++ b/include/linux/aio_abi.h | |||
@@ -30,7 +30,7 @@ | |||
30 | #include <linux/types.h> | 30 | #include <linux/types.h> |
31 | #include <asm/byteorder.h> | 31 | #include <asm/byteorder.h> |
32 | 32 | ||
33 | typedef unsigned long aio_context_t; | 33 | typedef __kernel_ulong_t aio_context_t; |
34 | 34 | ||
35 | enum { | 35 | enum { |
36 | IOCB_CMD_PREAD = 0, | 36 | IOCB_CMD_PREAD = 0, |
diff --git a/include/linux/altera_uart.h b/include/linux/altera_uart.h index a10a90791976..c022c82db7ca 100644 --- a/include/linux/altera_uart.h +++ b/include/linux/altera_uart.h | |||
@@ -5,8 +5,6 @@ | |||
5 | #ifndef __ALTUART_H | 5 | #ifndef __ALTUART_H |
6 | #define __ALTUART_H | 6 | #define __ALTUART_H |
7 | 7 | ||
8 | #include <linux/init.h> | ||
9 | |||
10 | struct altera_uart_platform_uart { | 8 | struct altera_uart_platform_uart { |
11 | unsigned long mapbase; /* Physical address base */ | 9 | unsigned long mapbase; /* Physical address base */ |
12 | unsigned int irq; /* Interrupt vector */ | 10 | unsigned int irq; /* Interrupt vector */ |
@@ -14,6 +12,4 @@ struct altera_uart_platform_uart { | |||
14 | unsigned int bus_shift; /* Bus shift (address stride) */ | 12 | unsigned int bus_shift; /* Bus shift (address stride) */ |
15 | }; | 13 | }; |
16 | 14 | ||
17 | int __init early_altera_uart_setup(struct altera_uart_platform_uart *platp); | ||
18 | |||
19 | #endif /* __ALTUART_H */ | 15 | #endif /* __ALTUART_H */ |
diff --git a/include/linux/amba/bus.h b/include/linux/amba/bus.h index 724c69c40bb8..8d54f79457ba 100644 --- a/include/linux/amba/bus.h +++ b/include/linux/amba/bus.h | |||
@@ -30,7 +30,6 @@ struct amba_device { | |||
30 | struct device dev; | 30 | struct device dev; |
31 | struct resource res; | 31 | struct resource res; |
32 | struct clk *pclk; | 32 | struct clk *pclk; |
33 | struct regulator *vcore; | ||
34 | u64 dma_mask; | 33 | u64 dma_mask; |
35 | unsigned int periphid; | 34 | unsigned int periphid; |
36 | unsigned int irq[AMBA_NR_IRQS]; | 35 | unsigned int irq[AMBA_NR_IRQS]; |
@@ -60,6 +59,9 @@ extern struct bus_type amba_bustype; | |||
60 | 59 | ||
61 | int amba_driver_register(struct amba_driver *); | 60 | int amba_driver_register(struct amba_driver *); |
62 | void amba_driver_unregister(struct amba_driver *); | 61 | void amba_driver_unregister(struct amba_driver *); |
62 | struct amba_device *amba_device_alloc(const char *, resource_size_t, size_t); | ||
63 | void amba_device_put(struct amba_device *); | ||
64 | int amba_device_add(struct amba_device *, struct resource *); | ||
63 | int amba_device_register(struct amba_device *, struct resource *); | 65 | int amba_device_register(struct amba_device *, struct resource *); |
64 | void amba_device_unregister(struct amba_device *); | 66 | void amba_device_unregister(struct amba_device *); |
65 | struct amba_device *amba_find_device(const char *, struct device *, unsigned int, unsigned int); | 67 | struct amba_device *amba_find_device(const char *, struct device *, unsigned int, unsigned int); |
@@ -72,12 +74,6 @@ void amba_release_regions(struct amba_device *); | |||
72 | #define amba_pclk_disable(d) \ | 74 | #define amba_pclk_disable(d) \ |
73 | do { if (!IS_ERR((d)->pclk)) clk_disable((d)->pclk); } while (0) | 75 | do { if (!IS_ERR((d)->pclk)) clk_disable((d)->pclk); } while (0) |
74 | 76 | ||
75 | #define amba_vcore_enable(d) \ | ||
76 | (IS_ERR((d)->vcore) ? 0 : regulator_enable((d)->vcore)) | ||
77 | |||
78 | #define amba_vcore_disable(d) \ | ||
79 | do { if (!IS_ERR((d)->vcore)) regulator_disable((d)->vcore); } while (0) | ||
80 | |||
81 | /* Some drivers don't use the struct amba_device */ | 77 | /* Some drivers don't use the struct amba_device */ |
82 | #define AMBA_CONFIG_BITS(a) (((a) >> 24) & 0xff) | 78 | #define AMBA_CONFIG_BITS(a) (((a) >> 24) & 0xff) |
83 | #define AMBA_REV_BITS(a) (((a) >> 20) & 0x0f) | 79 | #define AMBA_REV_BITS(a) (((a) >> 20) & 0x0f) |
@@ -89,4 +85,46 @@ void amba_release_regions(struct amba_device *); | |||
89 | #define amba_manf(d) AMBA_MANF_BITS((d)->periphid) | 85 | #define amba_manf(d) AMBA_MANF_BITS((d)->periphid) |
90 | #define amba_part(d) AMBA_PART_BITS((d)->periphid) | 86 | #define amba_part(d) AMBA_PART_BITS((d)->periphid) |
91 | 87 | ||
88 | #define __AMBA_DEV(busid, data, mask) \ | ||
89 | { \ | ||
90 | .coherent_dma_mask = mask, \ | ||
91 | .init_name = busid, \ | ||
92 | .platform_data = data, \ | ||
93 | } | ||
94 | |||
95 | /* | ||
96 | * APB devices do not themselves have the ability to address memory, | ||
97 | * so DMA masks should be zero (much like USB peripheral devices.) | ||
98 | * The DMA controller DMA masks should be used instead (much like | ||
99 | * USB host controllers in conventional PCs.) | ||
100 | */ | ||
101 | #define AMBA_APB_DEVICE(name, busid, id, base, irqs, data) \ | ||
102 | struct amba_device name##_device = { \ | ||
103 | .dev = __AMBA_DEV(busid, data, 0), \ | ||
104 | .res = DEFINE_RES_MEM(base, SZ_4K), \ | ||
105 | .irq = irqs, \ | ||
106 | .periphid = id, \ | ||
107 | } | ||
108 | |||
109 | /* | ||
110 | * AHB devices are DMA capable, so set their DMA masks | ||
111 | */ | ||
112 | #define AMBA_AHB_DEVICE(name, busid, id, base, irqs, data) \ | ||
113 | struct amba_device name##_device = { \ | ||
114 | .dev = __AMBA_DEV(busid, data, ~0ULL), \ | ||
115 | .res = DEFINE_RES_MEM(base, SZ_4K), \ | ||
116 | .dma_mask = ~0ULL, \ | ||
117 | .irq = irqs, \ | ||
118 | .periphid = id, \ | ||
119 | } | ||
120 | |||
121 | /* | ||
122 | * module_amba_driver() - Helper macro for drivers that don't do anything | ||
123 | * special in module init/exit. This eliminates a lot of boilerplate. Each | ||
124 | * module may only use this macro once, and calling it replaces module_init() | ||
125 | * and module_exit() | ||
126 | */ | ||
127 | #define module_amba_driver(__amba_drv) \ | ||
128 | module_driver(__amba_drv, amba_driver_register, amba_driver_unregister) | ||
129 | |||
92 | #endif | 130 | #endif |
diff --git a/include/linux/amba/mmci.h b/include/linux/amba/mmci.h index 0101e9c17fa1..32a89cf5ec45 100644 --- a/include/linux/amba/mmci.h +++ b/include/linux/amba/mmci.h | |||
@@ -6,6 +6,19 @@ | |||
6 | 6 | ||
7 | #include <linux/mmc/host.h> | 7 | #include <linux/mmc/host.h> |
8 | 8 | ||
9 | |||
10 | /* | ||
11 | * These defines is places here due to access is needed from machine | ||
12 | * configuration files. The ST Micro version does not have ROD and | ||
13 | * reuse the voltage registers for direction settings. | ||
14 | */ | ||
15 | #define MCI_ST_DATA2DIREN (1 << 2) | ||
16 | #define MCI_ST_CMDDIREN (1 << 3) | ||
17 | #define MCI_ST_DATA0DIREN (1 << 4) | ||
18 | #define MCI_ST_DATA31DIREN (1 << 5) | ||
19 | #define MCI_ST_FBCLKEN (1 << 7) | ||
20 | #define MCI_ST_DATA74DIREN (1 << 8) | ||
21 | |||
9 | /* Just some dummy forwarding */ | 22 | /* Just some dummy forwarding */ |
10 | struct dma_chan; | 23 | struct dma_chan; |
11 | 24 | ||
@@ -18,7 +31,8 @@ struct dma_chan; | |||
18 | * @ocr_mask: available voltages on the 4 pins from the block, this | 31 | * @ocr_mask: available voltages on the 4 pins from the block, this |
19 | * is ignored if a regulator is used, see the MMC_VDD_* masks in | 32 | * is ignored if a regulator is used, see the MMC_VDD_* masks in |
20 | * mmc/host.h | 33 | * mmc/host.h |
21 | * @vdd_handler: a callback function to translate a MMC_VDD_* | 34 | * @ios_handler: a callback function to act on specfic ios changes, |
35 | * used for example to control a levelshifter | ||
22 | * mask into a value to be binary (or set some other custom bits | 36 | * mask into a value to be binary (or set some other custom bits |
23 | * in MMCIPWR) or:ed and written into the MMCIPWR register of the | 37 | * in MMCIPWR) or:ed and written into the MMCIPWR register of the |
24 | * block. May also control external power based on the power_mode. | 38 | * block. May also control external power based on the power_mode. |
@@ -31,6 +45,8 @@ struct dma_chan; | |||
31 | * @capabilities: the capabilities of the block as implemented in | 45 | * @capabilities: the capabilities of the block as implemented in |
32 | * this platform, signify anything MMC_CAP_* from mmc/host.h | 46 | * this platform, signify anything MMC_CAP_* from mmc/host.h |
33 | * @capabilities2: more capabilities, MMC_CAP2_* from mmc/host.h | 47 | * @capabilities2: more capabilities, MMC_CAP2_* from mmc/host.h |
48 | * @sigdir: a bit field indicating for what bits in the MMC bus the host | ||
49 | * should enable signal direction indication. | ||
34 | * @dma_filter: function used to select an appropriate RX and TX | 50 | * @dma_filter: function used to select an appropriate RX and TX |
35 | * DMA channel to be used for DMA, if and only if you're deploying the | 51 | * DMA channel to be used for DMA, if and only if you're deploying the |
36 | * generic DMA engine | 52 | * generic DMA engine |
@@ -46,14 +62,14 @@ struct dma_chan; | |||
46 | struct mmci_platform_data { | 62 | struct mmci_platform_data { |
47 | unsigned int f_max; | 63 | unsigned int f_max; |
48 | unsigned int ocr_mask; | 64 | unsigned int ocr_mask; |
49 | u32 (*vdd_handler)(struct device *, unsigned int vdd, | 65 | int (*ios_handler)(struct device *, struct mmc_ios *); |
50 | unsigned char power_mode); | ||
51 | unsigned int (*status)(struct device *); | 66 | unsigned int (*status)(struct device *); |
52 | int gpio_wp; | 67 | int gpio_wp; |
53 | int gpio_cd; | 68 | int gpio_cd; |
54 | bool cd_invert; | 69 | bool cd_invert; |
55 | unsigned long capabilities; | 70 | unsigned long capabilities; |
56 | unsigned long capabilities2; | 71 | unsigned long capabilities2; |
72 | u32 sigdir; | ||
57 | bool (*dma_filter)(struct dma_chan *chan, void *filter_param); | 73 | bool (*dma_filter)(struct dma_chan *chan, void *filter_param); |
58 | void *dma_rx_param; | 74 | void *dma_rx_param; |
59 | void *dma_tx_param; | 75 | void *dma_tx_param; |
diff --git a/include/linux/amba/pl022.h b/include/linux/amba/pl022.h index 572f637299c9..76dd1b199a1b 100644 --- a/include/linux/amba/pl022.h +++ b/include/linux/amba/pl022.h | |||
@@ -25,7 +25,7 @@ | |||
25 | #ifndef _SSP_PL022_H | 25 | #ifndef _SSP_PL022_H |
26 | #define _SSP_PL022_H | 26 | #define _SSP_PL022_H |
27 | 27 | ||
28 | #include <linux/device.h> | 28 | #include <linux/types.h> |
29 | 29 | ||
30 | /** | 30 | /** |
31 | * whether SSP is in loopback mode or not | 31 | * whether SSP is in loopback mode or not |
@@ -241,6 +241,8 @@ struct dma_chan; | |||
241 | * @autosuspend_delay: delay in ms following transfer completion before the | 241 | * @autosuspend_delay: delay in ms following transfer completion before the |
242 | * runtime power management system suspends the device. A setting of 0 | 242 | * runtime power management system suspends the device. A setting of 0 |
243 | * indicates no delay and the device will be suspended immediately. | 243 | * indicates no delay and the device will be suspended immediately. |
244 | * @rt: indicates the controller should run the message pump with realtime | ||
245 | * priority to minimise the transfer latency on the bus. | ||
244 | */ | 246 | */ |
245 | struct pl022_ssp_controller { | 247 | struct pl022_ssp_controller { |
246 | u16 bus_id; | 248 | u16 bus_id; |
@@ -250,6 +252,7 @@ struct pl022_ssp_controller { | |||
250 | void *dma_rx_param; | 252 | void *dma_rx_param; |
251 | void *dma_tx_param; | 253 | void *dma_tx_param; |
252 | int autosuspend_delay; | 254 | int autosuspend_delay; |
255 | bool rt; | ||
253 | }; | 256 | }; |
254 | 257 | ||
255 | /** | 258 | /** |
diff --git a/include/linux/amba/pl08x.h b/include/linux/amba/pl08x.h index 033f6aa670de..e64ce2cfee99 100644 --- a/include/linux/amba/pl08x.h +++ b/include/linux/amba/pl08x.h | |||
@@ -47,9 +47,6 @@ enum { | |||
47 | * @muxval: a number usually used to poke into some mux regiser to | 47 | * @muxval: a number usually used to poke into some mux regiser to |
48 | * mux in the signal to this channel | 48 | * mux in the signal to this channel |
49 | * @cctl_opt: default options for the channel control register | 49 | * @cctl_opt: default options for the channel control register |
50 | * @device_fc: Flow Controller Settings for ccfg register. Only valid for slave | ||
51 | * channels. Fill with 'true' if peripheral should be flow controller. Direction | ||
52 | * will be selected at Runtime. | ||
53 | * @addr: source/target address in physical memory for this DMA channel, | 50 | * @addr: source/target address in physical memory for this DMA channel, |
54 | * can be the address of a FIFO register for burst requests for example. | 51 | * can be the address of a FIFO register for burst requests for example. |
55 | * This can be left undefined if the PrimeCell API is used for configuring | 52 | * This can be left undefined if the PrimeCell API is used for configuring |
@@ -68,7 +65,6 @@ struct pl08x_channel_data { | |||
68 | int max_signal; | 65 | int max_signal; |
69 | u32 muxval; | 66 | u32 muxval; |
70 | u32 cctl; | 67 | u32 cctl; |
71 | bool device_fc; | ||
72 | dma_addr_t addr; | 68 | dma_addr_t addr; |
73 | bool circular_buffer; | 69 | bool circular_buffer; |
74 | bool single; | 70 | bool single; |
@@ -176,13 +172,15 @@ enum pl08x_dma_chan_state { | |||
176 | * @runtime_addr: address for RX/TX according to the runtime config | 172 | * @runtime_addr: address for RX/TX according to the runtime config |
177 | * @runtime_direction: current direction of this channel according to | 173 | * @runtime_direction: current direction of this channel according to |
178 | * runtime config | 174 | * runtime config |
179 | * @lc: last completed transaction on this channel | ||
180 | * @pend_list: queued transactions pending on this channel | 175 | * @pend_list: queued transactions pending on this channel |
181 | * @at: active transaction on this channel | 176 | * @at: active transaction on this channel |
182 | * @lock: a lock for this channel data | 177 | * @lock: a lock for this channel data |
183 | * @host: a pointer to the host (internal use) | 178 | * @host: a pointer to the host (internal use) |
184 | * @state: whether the channel is idle, paused, running etc | 179 | * @state: whether the channel is idle, paused, running etc |
185 | * @slave: whether this channel is a device (slave) or for memcpy | 180 | * @slave: whether this channel is a device (slave) or for memcpy |
181 | * @device_fc: Flow Controller Settings for ccfg register. Only valid for slave | ||
182 | * channels. Fill with 'true' if peripheral should be flow controller. Direction | ||
183 | * will be selected at Runtime. | ||
186 | * @waiting: a TX descriptor on this channel which is waiting for a physical | 184 | * @waiting: a TX descriptor on this channel which is waiting for a physical |
187 | * channel to become available | 185 | * channel to become available |
188 | */ | 186 | */ |
@@ -198,13 +196,13 @@ struct pl08x_dma_chan { | |||
198 | u32 src_cctl; | 196 | u32 src_cctl; |
199 | u32 dst_cctl; | 197 | u32 dst_cctl; |
200 | enum dma_transfer_direction runtime_direction; | 198 | enum dma_transfer_direction runtime_direction; |
201 | dma_cookie_t lc; | ||
202 | struct list_head pend_list; | 199 | struct list_head pend_list; |
203 | struct pl08x_txd *at; | 200 | struct pl08x_txd *at; |
204 | spinlock_t lock; | 201 | spinlock_t lock; |
205 | struct pl08x_driver_data *host; | 202 | struct pl08x_driver_data *host; |
206 | enum pl08x_dma_chan_state state; | 203 | enum pl08x_dma_chan_state state; |
207 | bool slave; | 204 | bool slave; |
205 | bool device_fc; | ||
208 | struct pl08x_txd *waiting; | 206 | struct pl08x_txd *waiting; |
209 | }; | 207 | }; |
210 | 208 | ||
diff --git a/include/linux/amba/pl330.h b/include/linux/amba/pl330.h index 12e023c19ac1..fe93758e8403 100644 --- a/include/linux/amba/pl330.h +++ b/include/linux/amba/pl330.h | |||
@@ -13,7 +13,6 @@ | |||
13 | #define __AMBA_PL330_H_ | 13 | #define __AMBA_PL330_H_ |
14 | 14 | ||
15 | #include <linux/dmaengine.h> | 15 | #include <linux/dmaengine.h> |
16 | #include <asm/hardware/pl330.h> | ||
17 | 16 | ||
18 | struct dma_pl330_platdata { | 17 | struct dma_pl330_platdata { |
19 | /* | 18 | /* |
diff --git a/include/linux/amba/serial.h b/include/linux/amba/serial.h index 514ed45c462e..d117b29d1062 100644 --- a/include/linux/amba/serial.h +++ b/include/linux/amba/serial.h | |||
@@ -23,6 +23,8 @@ | |||
23 | #ifndef ASM_ARM_HARDWARE_SERIAL_AMBA_H | 23 | #ifndef ASM_ARM_HARDWARE_SERIAL_AMBA_H |
24 | #define ASM_ARM_HARDWARE_SERIAL_AMBA_H | 24 | #define ASM_ARM_HARDWARE_SERIAL_AMBA_H |
25 | 25 | ||
26 | #include <linux/types.h> | ||
27 | |||
26 | /* ------------------------------------------------------------------------------- | 28 | /* ------------------------------------------------------------------------------- |
27 | * From AMBA UART (PL010) Block Specification | 29 | * From AMBA UART (PL010) Block Specification |
28 | * ------------------------------------------------------------------------------- | 30 | * ------------------------------------------------------------------------------- |
diff --git a/include/linux/amd-iommu.h b/include/linux/amd-iommu.h index ef00610837d4..15f6b9edd0b1 100644 --- a/include/linux/amd-iommu.h +++ b/include/linux/amd-iommu.h | |||
@@ -28,7 +28,7 @@ struct task_struct; | |||
28 | struct pci_dev; | 28 | struct pci_dev; |
29 | 29 | ||
30 | extern int amd_iommu_detect(void); | 30 | extern int amd_iommu_detect(void); |
31 | 31 | extern int amd_iommu_init_hardware(void); | |
32 | 32 | ||
33 | /** | 33 | /** |
34 | * amd_iommu_enable_device_erratum() - Enable erratum workaround for device | 34 | * amd_iommu_enable_device_erratum() - Enable erratum workaround for device |
diff --git a/include/linux/apple_bl.h b/include/linux/apple_bl.h new file mode 100644 index 000000000000..47bedc0eee69 --- /dev/null +++ b/include/linux/apple_bl.h | |||
@@ -0,0 +1,26 @@ | |||
1 | /* | ||
2 | * apple_bl exported symbols | ||
3 | */ | ||
4 | |||
5 | #ifndef _LINUX_APPLE_BL_H | ||
6 | #define _LINUX_APPLE_BL_H | ||
7 | |||
8 | #ifdef CONFIG_BACKLIGHT_APPLE | ||
9 | |||
10 | extern int apple_bl_register(void); | ||
11 | extern void apple_bl_unregister(void); | ||
12 | |||
13 | #else /* !CONFIG_BACKLIGHT_APPLE */ | ||
14 | |||
15 | static inline int apple_bl_register(void) | ||
16 | { | ||
17 | return 0; | ||
18 | } | ||
19 | |||
20 | static inline void apple_bl_unregister(void) | ||
21 | { | ||
22 | } | ||
23 | |||
24 | #endif /* !CONFIG_BACKLIGHT_APPLE */ | ||
25 | |||
26 | #endif /* _LINUX_APPLE_BL_H */ | ||
diff --git a/include/linux/atmdev.h b/include/linux/atmdev.h index f4ff882cb2da..06fd4bbc58f6 100644 --- a/include/linux/atmdev.h +++ b/include/linux/atmdev.h | |||
@@ -213,10 +213,10 @@ struct atm_cirange { | |||
213 | 213 | ||
214 | #ifdef __KERNEL__ | 214 | #ifdef __KERNEL__ |
215 | 215 | ||
216 | #include <linux/device.h> | ||
217 | #include <linux/wait.h> /* wait_queue_head_t */ | 216 | #include <linux/wait.h> /* wait_queue_head_t */ |
218 | #include <linux/time.h> /* struct timeval */ | 217 | #include <linux/time.h> /* struct timeval */ |
219 | #include <linux/net.h> | 218 | #include <linux/net.h> |
219 | #include <linux/bug.h> | ||
220 | #include <linux/skbuff.h> /* struct sk_buff */ | 220 | #include <linux/skbuff.h> /* struct sk_buff */ |
221 | #include <linux/uio.h> | 221 | #include <linux/uio.h> |
222 | #include <net/sock.h> | 222 | #include <net/sock.h> |
@@ -249,6 +249,7 @@ struct k_atm_dev_stats { | |||
249 | struct k_atm_aal_stats aal5; | 249 | struct k_atm_aal_stats aal5; |
250 | }; | 250 | }; |
251 | 251 | ||
252 | struct device; | ||
252 | 253 | ||
253 | enum { | 254 | enum { |
254 | ATM_VF_ADDR, /* Address is in use. Set by anybody, cleared | 255 | ATM_VF_ADDR, /* Address is in use. Set by anybody, cleared |
diff --git a/include/linux/atmel_tc.h b/include/linux/atmel_tc.h index 53ba65e30caa..1d14b1dc1aee 100644 --- a/include/linux/atmel_tc.h +++ b/include/linux/atmel_tc.h | |||
@@ -34,10 +34,19 @@ | |||
34 | struct clk; | 34 | struct clk; |
35 | 35 | ||
36 | /** | 36 | /** |
37 | * struct atmel_tcb_config - SoC data for a Timer/Counter Block | ||
38 | * @counter_width: size in bits of a timer counter register | ||
39 | */ | ||
40 | struct atmel_tcb_config { | ||
41 | size_t counter_width; | ||
42 | }; | ||
43 | |||
44 | /** | ||
37 | * struct atmel_tc - information about a Timer/Counter Block | 45 | * struct atmel_tc - information about a Timer/Counter Block |
38 | * @pdev: physical device | 46 | * @pdev: physical device |
39 | * @iomem: resource associated with the I/O register | 47 | * @iomem: resource associated with the I/O register |
40 | * @regs: mapping through which the I/O registers can be accessed | 48 | * @regs: mapping through which the I/O registers can be accessed |
49 | * @tcb_config: configuration data from SoC | ||
41 | * @irq: irq for each of the three channels | 50 | * @irq: irq for each of the three channels |
42 | * @clk: internal clock source for each of the three channels | 51 | * @clk: internal clock source for each of the three channels |
43 | * @node: list node, for tclib internal use | 52 | * @node: list node, for tclib internal use |
@@ -54,6 +63,7 @@ struct atmel_tc { | |||
54 | struct platform_device *pdev; | 63 | struct platform_device *pdev; |
55 | struct resource *iomem; | 64 | struct resource *iomem; |
56 | void __iomem *regs; | 65 | void __iomem *regs; |
66 | struct atmel_tcb_config *tcb_config; | ||
57 | int irq[3]; | 67 | int irq[3]; |
58 | struct clk *clk[3]; | 68 | struct clk *clk[3]; |
59 | struct list_head node; | 69 | struct list_head node; |
diff --git a/include/linux/atomic.h b/include/linux/atomic.h index 42b77b5446d2..70cfcb2d63c4 100644 --- a/include/linux/atomic.h +++ b/include/linux/atomic.h | |||
@@ -24,7 +24,9 @@ static inline int atomic_add_unless(atomic_t *v, int a, int u) | |||
24 | * Atomically increments @v by 1, so long as @v is non-zero. | 24 | * Atomically increments @v by 1, so long as @v is non-zero. |
25 | * Returns non-zero if @v was non-zero, and zero otherwise. | 25 | * Returns non-zero if @v was non-zero, and zero otherwise. |
26 | */ | 26 | */ |
27 | #ifndef atomic_inc_not_zero | ||
27 | #define atomic_inc_not_zero(v) atomic_add_unless((v), 1, 0) | 28 | #define atomic_inc_not_zero(v) atomic_add_unless((v), 1, 0) |
29 | #endif | ||
28 | 30 | ||
29 | /** | 31 | /** |
30 | * atomic_inc_not_zero_hint - increment if not null | 32 | * atomic_inc_not_zero_hint - increment if not null |
diff --git a/include/linux/attribute_container.h b/include/linux/attribute_container.h index c3ab81428c66..896c6892f327 100644 --- a/include/linux/attribute_container.h +++ b/include/linux/attribute_container.h | |||
@@ -9,10 +9,11 @@ | |||
9 | #ifndef _ATTRIBUTE_CONTAINER_H_ | 9 | #ifndef _ATTRIBUTE_CONTAINER_H_ |
10 | #define _ATTRIBUTE_CONTAINER_H_ | 10 | #define _ATTRIBUTE_CONTAINER_H_ |
11 | 11 | ||
12 | #include <linux/device.h> | ||
13 | #include <linux/list.h> | 12 | #include <linux/list.h> |
14 | #include <linux/klist.h> | 13 | #include <linux/klist.h> |
15 | 14 | ||
15 | struct device; | ||
16 | |||
16 | struct attribute_container { | 17 | struct attribute_container { |
17 | struct list_head node; | 18 | struct list_head node; |
18 | struct klist containers; | 19 | struct klist containers; |
diff --git a/include/linux/audit.h b/include/linux/audit.h index 9ff7a2c48b50..ed3ef1972496 100644 --- a/include/linux/audit.h +++ b/include/linux/audit.h | |||
@@ -684,7 +684,7 @@ extern void audit_log_untrustedstring(struct audit_buffer *ab, | |||
684 | const char *string); | 684 | const char *string); |
685 | extern void audit_log_d_path(struct audit_buffer *ab, | 685 | extern void audit_log_d_path(struct audit_buffer *ab, |
686 | const char *prefix, | 686 | const char *prefix, |
687 | struct path *path); | 687 | const struct path *path); |
688 | extern void audit_log_key(struct audit_buffer *ab, | 688 | extern void audit_log_key(struct audit_buffer *ab, |
689 | char *key); | 689 | char *key); |
690 | extern void audit_log_lost(const char *message); | 690 | extern void audit_log_lost(const char *message); |
diff --git a/include/linux/bcma/bcma.h b/include/linux/bcma/bcma.h index 83c209f39493..5af9a075498f 100644 --- a/include/linux/bcma/bcma.h +++ b/include/linux/bcma/bcma.h | |||
@@ -136,6 +136,7 @@ struct bcma_device { | |||
136 | bool dev_registered; | 136 | bool dev_registered; |
137 | 137 | ||
138 | u8 core_index; | 138 | u8 core_index; |
139 | u8 core_unit; | ||
139 | 140 | ||
140 | u32 addr; | 141 | u32 addr; |
141 | u32 wrap; | 142 | u32 wrap; |
@@ -175,6 +176,12 @@ int __bcma_driver_register(struct bcma_driver *drv, struct module *owner); | |||
175 | 176 | ||
176 | extern void bcma_driver_unregister(struct bcma_driver *drv); | 177 | extern void bcma_driver_unregister(struct bcma_driver *drv); |
177 | 178 | ||
179 | /* Set a fallback SPROM. | ||
180 | * See kdoc at the function definition for complete documentation. */ | ||
181 | extern int bcma_arch_register_fallback_sprom( | ||
182 | int (*sprom_callback)(struct bcma_bus *bus, | ||
183 | struct ssb_sprom *out)); | ||
184 | |||
178 | struct bcma_bus { | 185 | struct bcma_bus { |
179 | /* The MMIO area. */ | 186 | /* The MMIO area. */ |
180 | void __iomem *mmio; | 187 | void __iomem *mmio; |
@@ -195,6 +202,7 @@ struct bcma_bus { | |||
195 | struct list_head cores; | 202 | struct list_head cores; |
196 | u8 nr_cores; | 203 | u8 nr_cores; |
197 | u8 init_done:1; | 204 | u8 init_done:1; |
205 | u8 num; | ||
198 | 206 | ||
199 | struct bcma_drv_cc drv_cc; | 207 | struct bcma_drv_cc drv_cc; |
200 | struct bcma_drv_pci drv_pci; | 208 | struct bcma_drv_pci drv_pci; |
@@ -282,6 +290,7 @@ static inline void bcma_maskset16(struct bcma_device *cc, | |||
282 | bcma_write16(cc, offset, (bcma_read16(cc, offset) & mask) | set); | 290 | bcma_write16(cc, offset, (bcma_read16(cc, offset) & mask) | set); |
283 | } | 291 | } |
284 | 292 | ||
293 | extern struct bcma_device *bcma_find_core(struct bcma_bus *bus, u16 coreid); | ||
285 | extern bool bcma_core_is_enabled(struct bcma_device *core); | 294 | extern bool bcma_core_is_enabled(struct bcma_device *core); |
286 | extern void bcma_core_disable(struct bcma_device *core, u32 flags); | 295 | extern void bcma_core_disable(struct bcma_device *core, u32 flags); |
287 | extern int bcma_core_enable(struct bcma_device *core, u32 flags); | 296 | extern int bcma_core_enable(struct bcma_device *core, u32 flags); |
diff --git a/include/linux/bcma/bcma_driver_chipcommon.h b/include/linux/bcma/bcma_driver_chipcommon.h index a33086a7530b..8bbfe31fbac8 100644 --- a/include/linux/bcma/bcma_driver_chipcommon.h +++ b/include/linux/bcma/bcma_driver_chipcommon.h | |||
@@ -56,6 +56,9 @@ | |||
56 | #define BCMA_CC_OTPS_HW_PROTECT 0x00000001 | 56 | #define BCMA_CC_OTPS_HW_PROTECT 0x00000001 |
57 | #define BCMA_CC_OTPS_SW_PROTECT 0x00000002 | 57 | #define BCMA_CC_OTPS_SW_PROTECT 0x00000002 |
58 | #define BCMA_CC_OTPS_CID_PROTECT 0x00000004 | 58 | #define BCMA_CC_OTPS_CID_PROTECT 0x00000004 |
59 | #define BCMA_CC_OTPS_GU_PROG_IND 0x00000F00 /* General Use programmed indication */ | ||
60 | #define BCMA_CC_OTPS_GU_PROG_IND_SHIFT 8 | ||
61 | #define BCMA_CC_OTPS_GU_PROG_HW 0x00000100 /* HW region programmed */ | ||
59 | #define BCMA_CC_OTPC 0x0014 /* OTP control */ | 62 | #define BCMA_CC_OTPC 0x0014 /* OTP control */ |
60 | #define BCMA_CC_OTPC_RECWAIT 0xFF000000 | 63 | #define BCMA_CC_OTPC_RECWAIT 0xFF000000 |
61 | #define BCMA_CC_OTPC_PROGWAIT 0x00FFFF00 | 64 | #define BCMA_CC_OTPC_PROGWAIT 0x00FFFF00 |
@@ -72,6 +75,8 @@ | |||
72 | #define BCMA_CC_OTPP_READ 0x40000000 | 75 | #define BCMA_CC_OTPP_READ 0x40000000 |
73 | #define BCMA_CC_OTPP_START 0x80000000 | 76 | #define BCMA_CC_OTPP_START 0x80000000 |
74 | #define BCMA_CC_OTPP_BUSY 0x80000000 | 77 | #define BCMA_CC_OTPP_BUSY 0x80000000 |
78 | #define BCMA_CC_OTPL 0x001C /* OTP layout */ | ||
79 | #define BCMA_CC_OTPL_GURGN_OFFSET 0x00000FFF /* offset of general use region */ | ||
75 | #define BCMA_CC_IRQSTAT 0x0020 | 80 | #define BCMA_CC_IRQSTAT 0x0020 |
76 | #define BCMA_CC_IRQMASK 0x0024 | 81 | #define BCMA_CC_IRQMASK 0x0024 |
77 | #define BCMA_CC_IRQ_GPIO 0x00000001 /* gpio intr */ | 82 | #define BCMA_CC_IRQ_GPIO 0x00000001 /* gpio intr */ |
@@ -79,6 +84,10 @@ | |||
79 | #define BCMA_CC_IRQ_WDRESET 0x80000000 /* watchdog reset occurred */ | 84 | #define BCMA_CC_IRQ_WDRESET 0x80000000 /* watchdog reset occurred */ |
80 | #define BCMA_CC_CHIPCTL 0x0028 /* Rev >= 11 only */ | 85 | #define BCMA_CC_CHIPCTL 0x0028 /* Rev >= 11 only */ |
81 | #define BCMA_CC_CHIPSTAT 0x002C /* Rev >= 11 only */ | 86 | #define BCMA_CC_CHIPSTAT 0x002C /* Rev >= 11 only */ |
87 | #define BCMA_CC_CHIPST_4313_SPROM_PRESENT 1 | ||
88 | #define BCMA_CC_CHIPST_4313_OTP_PRESENT 2 | ||
89 | #define BCMA_CC_CHIPST_4331_SPROM_PRESENT 2 | ||
90 | #define BCMA_CC_CHIPST_4331_OTP_PRESENT 4 | ||
82 | #define BCMA_CC_JCMD 0x0030 /* Rev >= 10 only */ | 91 | #define BCMA_CC_JCMD 0x0030 /* Rev >= 10 only */ |
83 | #define BCMA_CC_JCMD_START 0x80000000 | 92 | #define BCMA_CC_JCMD_START 0x80000000 |
84 | #define BCMA_CC_JCMD_BUSY 0x80000000 | 93 | #define BCMA_CC_JCMD_BUSY 0x80000000 |
@@ -181,6 +190,22 @@ | |||
181 | #define BCMA_CC_FLASH_CFG 0x0128 | 190 | #define BCMA_CC_FLASH_CFG 0x0128 |
182 | #define BCMA_CC_FLASH_CFG_DS 0x0010 /* Data size, 0=8bit, 1=16bit */ | 191 | #define BCMA_CC_FLASH_CFG_DS 0x0010 /* Data size, 0=8bit, 1=16bit */ |
183 | #define BCMA_CC_FLASH_WAITCNT 0x012C | 192 | #define BCMA_CC_FLASH_WAITCNT 0x012C |
193 | #define BCMA_CC_SROM_CONTROL 0x0190 | ||
194 | #define BCMA_CC_SROM_CONTROL_START 0x80000000 | ||
195 | #define BCMA_CC_SROM_CONTROL_BUSY 0x80000000 | ||
196 | #define BCMA_CC_SROM_CONTROL_OPCODE 0x60000000 | ||
197 | #define BCMA_CC_SROM_CONTROL_OP_READ 0x00000000 | ||
198 | #define BCMA_CC_SROM_CONTROL_OP_WRITE 0x20000000 | ||
199 | #define BCMA_CC_SROM_CONTROL_OP_WRDIS 0x40000000 | ||
200 | #define BCMA_CC_SROM_CONTROL_OP_WREN 0x60000000 | ||
201 | #define BCMA_CC_SROM_CONTROL_OTPSEL 0x00000010 | ||
202 | #define BCMA_CC_SROM_CONTROL_LOCK 0x00000008 | ||
203 | #define BCMA_CC_SROM_CONTROL_SIZE_MASK 0x00000006 | ||
204 | #define BCMA_CC_SROM_CONTROL_SIZE_1K 0x00000000 | ||
205 | #define BCMA_CC_SROM_CONTROL_SIZE_4K 0x00000002 | ||
206 | #define BCMA_CC_SROM_CONTROL_SIZE_16K 0x00000004 | ||
207 | #define BCMA_CC_SROM_CONTROL_SIZE_SHIFT 1 | ||
208 | #define BCMA_CC_SROM_CONTROL_PRESENT 0x00000001 | ||
184 | /* 0x1E0 is defined as shared BCMA_CLKCTLST */ | 209 | /* 0x1E0 is defined as shared BCMA_CLKCTLST */ |
185 | #define BCMA_CC_HW_WORKAROUND 0x01E4 /* Hardware workaround (rev >= 20) */ | 210 | #define BCMA_CC_HW_WORKAROUND 0x01E4 /* Hardware workaround (rev >= 20) */ |
186 | #define BCMA_CC_UART0_DATA 0x0300 | 211 | #define BCMA_CC_UART0_DATA 0x0300 |
@@ -240,7 +265,6 @@ | |||
240 | #define BCMA_CC_PLLCTL_ADDR 0x0660 | 265 | #define BCMA_CC_PLLCTL_ADDR 0x0660 |
241 | #define BCMA_CC_PLLCTL_DATA 0x0664 | 266 | #define BCMA_CC_PLLCTL_DATA 0x0664 |
242 | #define BCMA_CC_SPROM 0x0800 /* SPROM beginning */ | 267 | #define BCMA_CC_SPROM 0x0800 /* SPROM beginning */ |
243 | #define BCMA_CC_SPROM_PCIE6 0x0830 /* SPROM beginning on PCIe rev >= 6 */ | ||
244 | 268 | ||
245 | /* Divider allocation in 4716/47162/5356 */ | 269 | /* Divider allocation in 4716/47162/5356 */ |
246 | #define BCMA_CC_PMU5_MAINPLL_CPU 1 | 270 | #define BCMA_CC_PMU5_MAINPLL_CPU 1 |
diff --git a/include/linux/bcma/bcma_driver_pci.h b/include/linux/bcma/bcma_driver_pci.h index 3871b668caf9..46c71e27d31f 100644 --- a/include/linux/bcma/bcma_driver_pci.h +++ b/include/linux/bcma/bcma_driver_pci.h | |||
@@ -53,6 +53,35 @@ struct pci_dev; | |||
53 | #define BCMA_CORE_PCI_SBTOPCI1_MASK 0xFC000000 | 53 | #define BCMA_CORE_PCI_SBTOPCI1_MASK 0xFC000000 |
54 | #define BCMA_CORE_PCI_SBTOPCI2 0x0108 /* Backplane to PCI translation 2 (sbtopci2) */ | 54 | #define BCMA_CORE_PCI_SBTOPCI2 0x0108 /* Backplane to PCI translation 2 (sbtopci2) */ |
55 | #define BCMA_CORE_PCI_SBTOPCI2_MASK 0xC0000000 | 55 | #define BCMA_CORE_PCI_SBTOPCI2_MASK 0xC0000000 |
56 | #define BCMA_CORE_PCI_CONFIG_ADDR 0x0120 /* pcie config space access */ | ||
57 | #define BCMA_CORE_PCI_CONFIG_DATA 0x0124 /* pcie config space access */ | ||
58 | #define BCMA_CORE_PCI_MDIO_CONTROL 0x0128 /* controls the mdio access */ | ||
59 | #define BCMA_CORE_PCI_MDIOCTL_DIVISOR_MASK 0x7f /* clock to be used on MDIO */ | ||
60 | #define BCMA_CORE_PCI_MDIOCTL_DIVISOR_VAL 0x2 | ||
61 | #define BCMA_CORE_PCI_MDIOCTL_PREAM_EN 0x80 /* Enable preamble sequnce */ | ||
62 | #define BCMA_CORE_PCI_MDIOCTL_ACCESS_DONE 0x100 /* Tranaction complete */ | ||
63 | #define BCMA_CORE_PCI_MDIO_DATA 0x012c /* Data to the mdio access */ | ||
64 | #define BCMA_CORE_PCI_MDIODATA_MASK 0x0000ffff /* data 2 bytes */ | ||
65 | #define BCMA_CORE_PCI_MDIODATA_TA 0x00020000 /* Turnaround */ | ||
66 | #define BCMA_CORE_PCI_MDIODATA_REGADDR_SHF_OLD 18 /* Regaddr shift (rev < 10) */ | ||
67 | #define BCMA_CORE_PCI_MDIODATA_REGADDR_MASK_OLD 0x003c0000 /* Regaddr Mask (rev < 10) */ | ||
68 | #define BCMA_CORE_PCI_MDIODATA_DEVADDR_SHF_OLD 22 /* Physmedia devaddr shift (rev < 10) */ | ||
69 | #define BCMA_CORE_PCI_MDIODATA_DEVADDR_MASK_OLD 0x0fc00000 /* Physmedia devaddr Mask (rev < 10) */ | ||
70 | #define BCMA_CORE_PCI_MDIODATA_REGADDR_SHF 18 /* Regaddr shift */ | ||
71 | #define BCMA_CORE_PCI_MDIODATA_REGADDR_MASK 0x007c0000 /* Regaddr Mask */ | ||
72 | #define BCMA_CORE_PCI_MDIODATA_DEVADDR_SHF 23 /* Physmedia devaddr shift */ | ||
73 | #define BCMA_CORE_PCI_MDIODATA_DEVADDR_MASK 0x0f800000 /* Physmedia devaddr Mask */ | ||
74 | #define BCMA_CORE_PCI_MDIODATA_WRITE 0x10000000 /* write Transaction */ | ||
75 | #define BCMA_CORE_PCI_MDIODATA_READ 0x20000000 /* Read Transaction */ | ||
76 | #define BCMA_CORE_PCI_MDIODATA_START 0x40000000 /* start of Transaction */ | ||
77 | #define BCMA_CORE_PCI_MDIODATA_DEV_ADDR 0x0 /* dev address for serdes */ | ||
78 | #define BCMA_CORE_PCI_MDIODATA_BLK_ADDR 0x1F /* blk address for serdes */ | ||
79 | #define BCMA_CORE_PCI_MDIODATA_DEV_PLL 0x1d /* SERDES PLL Dev */ | ||
80 | #define BCMA_CORE_PCI_MDIODATA_DEV_TX 0x1e /* SERDES TX Dev */ | ||
81 | #define BCMA_CORE_PCI_MDIODATA_DEV_RX 0x1f /* SERDES RX Dev */ | ||
82 | #define BCMA_CORE_PCI_PCIEIND_ADDR 0x0130 /* indirect access to the internal register */ | ||
83 | #define BCMA_CORE_PCI_PCIEIND_DATA 0x0134 /* Data to/from the internal regsiter */ | ||
84 | #define BCMA_CORE_PCI_CLKREQENCTRL 0x0138 /* >= rev 6, Clkreq rdma control */ | ||
56 | #define BCMA_CORE_PCI_PCICFG0 0x0400 /* PCI config space 0 (rev >= 8) */ | 85 | #define BCMA_CORE_PCI_PCICFG0 0x0400 /* PCI config space 0 (rev >= 8) */ |
57 | #define BCMA_CORE_PCI_PCICFG1 0x0500 /* PCI config space 1 (rev >= 8) */ | 86 | #define BCMA_CORE_PCI_PCICFG1 0x0500 /* PCI config space 1 (rev >= 8) */ |
58 | #define BCMA_CORE_PCI_PCICFG2 0x0600 /* PCI config space 2 (rev >= 8) */ | 87 | #define BCMA_CORE_PCI_PCICFG2 0x0600 /* PCI config space 2 (rev >= 8) */ |
@@ -72,20 +101,114 @@ struct pci_dev; | |||
72 | #define BCMA_CORE_PCI_SBTOPCI_RC_READL 0x00000010 /* Memory read line */ | 101 | #define BCMA_CORE_PCI_SBTOPCI_RC_READL 0x00000010 /* Memory read line */ |
73 | #define BCMA_CORE_PCI_SBTOPCI_RC_READM 0x00000020 /* Memory read multiple */ | 102 | #define BCMA_CORE_PCI_SBTOPCI_RC_READM 0x00000020 /* Memory read multiple */ |
74 | 103 | ||
104 | /* PCIE protocol PHY diagnostic registers */ | ||
105 | #define BCMA_CORE_PCI_PLP_MODEREG 0x200 /* Mode */ | ||
106 | #define BCMA_CORE_PCI_PLP_STATUSREG 0x204 /* Status */ | ||
107 | #define BCMA_CORE_PCI_PLP_POLARITYINV_STAT 0x10 /* Status reg PCIE_PLP_STATUSREG */ | ||
108 | #define BCMA_CORE_PCI_PLP_LTSSMCTRLREG 0x208 /* LTSSM control */ | ||
109 | #define BCMA_CORE_PCI_PLP_LTLINKNUMREG 0x20c /* Link Training Link number */ | ||
110 | #define BCMA_CORE_PCI_PLP_LTLANENUMREG 0x210 /* Link Training Lane number */ | ||
111 | #define BCMA_CORE_PCI_PLP_LTNFTSREG 0x214 /* Link Training N_FTS */ | ||
112 | #define BCMA_CORE_PCI_PLP_ATTNREG 0x218 /* Attention */ | ||
113 | #define BCMA_CORE_PCI_PLP_ATTNMASKREG 0x21C /* Attention Mask */ | ||
114 | #define BCMA_CORE_PCI_PLP_RXERRCTR 0x220 /* Rx Error */ | ||
115 | #define BCMA_CORE_PCI_PLP_RXFRMERRCTR 0x224 /* Rx Framing Error */ | ||
116 | #define BCMA_CORE_PCI_PLP_RXERRTHRESHREG 0x228 /* Rx Error threshold */ | ||
117 | #define BCMA_CORE_PCI_PLP_TESTCTRLREG 0x22C /* Test Control reg */ | ||
118 | #define BCMA_CORE_PCI_PLP_SERDESCTRLOVRDREG 0x230 /* SERDES Control Override */ | ||
119 | #define BCMA_CORE_PCI_PLP_TIMINGOVRDREG 0x234 /* Timing param override */ | ||
120 | #define BCMA_CORE_PCI_PLP_RXTXSMDIAGREG 0x238 /* RXTX State Machine Diag */ | ||
121 | #define BCMA_CORE_PCI_PLP_LTSSMDIAGREG 0x23C /* LTSSM State Machine Diag */ | ||
122 | |||
123 | /* PCIE protocol DLLP diagnostic registers */ | ||
124 | #define BCMA_CORE_PCI_DLLP_LCREG 0x100 /* Link Control */ | ||
125 | #define BCMA_CORE_PCI_DLLP_LSREG 0x104 /* Link Status */ | ||
126 | #define BCMA_CORE_PCI_DLLP_LAREG 0x108 /* Link Attention */ | ||
127 | #define BCMA_CORE_PCI_DLLP_LSREG_LINKUP (1 << 16) | ||
128 | #define BCMA_CORE_PCI_DLLP_LAMASKREG 0x10C /* Link Attention Mask */ | ||
129 | #define BCMA_CORE_PCI_DLLP_NEXTTXSEQNUMREG 0x110 /* Next Tx Seq Num */ | ||
130 | #define BCMA_CORE_PCI_DLLP_ACKEDTXSEQNUMREG 0x114 /* Acked Tx Seq Num */ | ||
131 | #define BCMA_CORE_PCI_DLLP_PURGEDTXSEQNUMREG 0x118 /* Purged Tx Seq Num */ | ||
132 | #define BCMA_CORE_PCI_DLLP_RXSEQNUMREG 0x11C /* Rx Sequence Number */ | ||
133 | #define BCMA_CORE_PCI_DLLP_LRREG 0x120 /* Link Replay */ | ||
134 | #define BCMA_CORE_PCI_DLLP_LACKTOREG 0x124 /* Link Ack Timeout */ | ||
135 | #define BCMA_CORE_PCI_DLLP_PMTHRESHREG 0x128 /* Power Management Threshold */ | ||
136 | #define BCMA_CORE_PCI_DLLP_RTRYWPREG 0x12C /* Retry buffer write ptr */ | ||
137 | #define BCMA_CORE_PCI_DLLP_RTRYRPREG 0x130 /* Retry buffer Read ptr */ | ||
138 | #define BCMA_CORE_PCI_DLLP_RTRYPPREG 0x134 /* Retry buffer Purged ptr */ | ||
139 | #define BCMA_CORE_PCI_DLLP_RTRRWREG 0x138 /* Retry buffer Read/Write */ | ||
140 | #define BCMA_CORE_PCI_DLLP_ECTHRESHREG 0x13C /* Error Count Threshold */ | ||
141 | #define BCMA_CORE_PCI_DLLP_TLPERRCTRREG 0x140 /* TLP Error Counter */ | ||
142 | #define BCMA_CORE_PCI_DLLP_ERRCTRREG 0x144 /* Error Counter */ | ||
143 | #define BCMA_CORE_PCI_DLLP_NAKRXCTRREG 0x148 /* NAK Received Counter */ | ||
144 | #define BCMA_CORE_PCI_DLLP_TESTREG 0x14C /* Test */ | ||
145 | #define BCMA_CORE_PCI_DLLP_PKTBIST 0x150 /* Packet BIST */ | ||
146 | #define BCMA_CORE_PCI_DLLP_PCIE11 0x154 /* DLLP PCIE 1.1 reg */ | ||
147 | |||
148 | /* SERDES RX registers */ | ||
149 | #define BCMA_CORE_PCI_SERDES_RX_CTRL 1 /* Rx cntrl */ | ||
150 | #define BCMA_CORE_PCI_SERDES_RX_CTRL_FORCE 0x80 /* rxpolarity_force */ | ||
151 | #define BCMA_CORE_PCI_SERDES_RX_CTRL_POLARITY 0x40 /* rxpolarity_value */ | ||
152 | #define BCMA_CORE_PCI_SERDES_RX_TIMER1 2 /* Rx Timer1 */ | ||
153 | #define BCMA_CORE_PCI_SERDES_RX_CDR 6 /* CDR */ | ||
154 | #define BCMA_CORE_PCI_SERDES_RX_CDRBW 7 /* CDR BW */ | ||
155 | |||
156 | /* SERDES PLL registers */ | ||
157 | #define BCMA_CORE_PCI_SERDES_PLL_CTRL 1 /* PLL control reg */ | ||
158 | #define BCMA_CORE_PCI_PLL_CTRL_FREQDET_EN 0x4000 /* bit 14 is FREQDET on */ | ||
159 | |||
75 | /* PCIcore specific boardflags */ | 160 | /* PCIcore specific boardflags */ |
76 | #define BCMA_CORE_PCI_BFL_NOPCI 0x00000400 /* Board leaves PCI floating */ | 161 | #define BCMA_CORE_PCI_BFL_NOPCI 0x00000400 /* Board leaves PCI floating */ |
77 | 162 | ||
163 | /* PCIE Config space accessing MACROS */ | ||
164 | #define BCMA_CORE_PCI_CFG_BUS_SHIFT 24 /* Bus shift */ | ||
165 | #define BCMA_CORE_PCI_CFG_SLOT_SHIFT 19 /* Slot/Device shift */ | ||
166 | #define BCMA_CORE_PCI_CFG_FUN_SHIFT 16 /* Function shift */ | ||
167 | #define BCMA_CORE_PCI_CFG_OFF_SHIFT 0 /* Register shift */ | ||
168 | |||
169 | #define BCMA_CORE_PCI_CFG_BUS_MASK 0xff /* Bus mask */ | ||
170 | #define BCMA_CORE_PCI_CFG_SLOT_MASK 0x1f /* Slot/Device mask */ | ||
171 | #define BCMA_CORE_PCI_CFG_FUN_MASK 7 /* Function mask */ | ||
172 | #define BCMA_CORE_PCI_CFG_OFF_MASK 0xfff /* Register mask */ | ||
173 | |||
174 | /* PCIE Root Capability Register bits (Host mode only) */ | ||
175 | #define BCMA_CORE_PCI_RC_CRS_VISIBILITY 0x0001 | ||
176 | |||
177 | struct bcma_drv_pci; | ||
178 | |||
179 | #ifdef CONFIG_BCMA_DRIVER_PCI_HOSTMODE | ||
180 | struct bcma_drv_pci_host { | ||
181 | struct bcma_drv_pci *pdev; | ||
182 | |||
183 | u32 host_cfg_addr; | ||
184 | spinlock_t cfgspace_lock; | ||
185 | |||
186 | struct pci_controller pci_controller; | ||
187 | struct pci_ops pci_ops; | ||
188 | struct resource mem_resource; | ||
189 | struct resource io_resource; | ||
190 | }; | ||
191 | #endif | ||
192 | |||
78 | struct bcma_drv_pci { | 193 | struct bcma_drv_pci { |
79 | struct bcma_device *core; | 194 | struct bcma_device *core; |
80 | u8 setup_done:1; | 195 | u8 setup_done:1; |
196 | u8 hostmode:1; | ||
197 | |||
198 | #ifdef CONFIG_BCMA_DRIVER_PCI_HOSTMODE | ||
199 | struct bcma_drv_pci_host *host_controller; | ||
200 | #endif | ||
81 | }; | 201 | }; |
82 | 202 | ||
83 | /* Register access */ | 203 | /* Register access */ |
84 | #define pcicore_read32(pc, offset) bcma_read32((pc)->core, offset) | 204 | #define pcicore_read32(pc, offset) bcma_read32((pc)->core, offset) |
85 | #define pcicore_write32(pc, offset, val) bcma_write32((pc)->core, offset, val) | 205 | #define pcicore_write32(pc, offset, val) bcma_write32((pc)->core, offset, val) |
86 | 206 | ||
87 | extern void bcma_core_pci_init(struct bcma_drv_pci *pc); | 207 | extern void __devinit bcma_core_pci_init(struct bcma_drv_pci *pc); |
88 | extern int bcma_core_pci_irq_ctl(struct bcma_drv_pci *pc, | 208 | extern int bcma_core_pci_irq_ctl(struct bcma_drv_pci *pc, |
89 | struct bcma_device *core, bool enable); | 209 | struct bcma_device *core, bool enable); |
90 | 210 | ||
211 | extern int bcma_core_pci_pcibios_map_irq(const struct pci_dev *dev); | ||
212 | extern int bcma_core_pci_plat_dev_init(struct pci_dev *dev); | ||
213 | |||
91 | #endif /* LINUX_BCMA_DRIVER_PCI_H_ */ | 214 | #endif /* LINUX_BCMA_DRIVER_PCI_H_ */ |
diff --git a/include/linux/bcma/bcma_regs.h b/include/linux/bcma/bcma_regs.h index 9faae2ae02e8..5a71d5719640 100644 --- a/include/linux/bcma/bcma_regs.h +++ b/include/linux/bcma/bcma_regs.h | |||
@@ -56,4 +56,31 @@ | |||
56 | #define BCMA_PCI_GPIO_XTAL 0x40 /* PCI config space GPIO 14 for Xtal powerup */ | 56 | #define BCMA_PCI_GPIO_XTAL 0x40 /* PCI config space GPIO 14 for Xtal powerup */ |
57 | #define BCMA_PCI_GPIO_PLL 0x80 /* PCI config space GPIO 15 for PLL powerdown */ | 57 | #define BCMA_PCI_GPIO_PLL 0x80 /* PCI config space GPIO 15 for PLL powerdown */ |
58 | 58 | ||
59 | /* SiliconBackplane Address Map. | ||
60 | * All regions may not exist on all chips. | ||
61 | */ | ||
62 | #define BCMA_SOC_SDRAM_BASE 0x00000000U /* Physical SDRAM */ | ||
63 | #define BCMA_SOC_PCI_MEM 0x08000000U /* Host Mode sb2pcitranslation0 (64 MB) */ | ||
64 | #define BCMA_SOC_PCI_MEM_SZ (64 * 1024 * 1024) | ||
65 | #define BCMA_SOC_PCI_CFG 0x0c000000U /* Host Mode sb2pcitranslation1 (64 MB) */ | ||
66 | #define BCMA_SOC_SDRAM_SWAPPED 0x10000000U /* Byteswapped Physical SDRAM */ | ||
67 | #define BCMA_SOC_SDRAM_R2 0x80000000U /* Region 2 for sdram (512 MB) */ | ||
68 | |||
69 | |||
70 | #define BCMA_SOC_PCI_DMA 0x40000000U /* Client Mode sb2pcitranslation2 (1 GB) */ | ||
71 | #define BCMA_SOC_PCI_DMA2 0x80000000U /* Client Mode sb2pcitranslation2 (1 GB) */ | ||
72 | #define BCMA_SOC_PCI_DMA_SZ 0x40000000U /* Client Mode sb2pcitranslation2 size in bytes */ | ||
73 | #define BCMA_SOC_PCIE_DMA_L32 0x00000000U /* PCIE Client Mode sb2pcitranslation2 | ||
74 | * (2 ZettaBytes), low 32 bits | ||
75 | */ | ||
76 | #define BCMA_SOC_PCIE_DMA_H32 0x80000000U /* PCIE Client Mode sb2pcitranslation2 | ||
77 | * (2 ZettaBytes), high 32 bits | ||
78 | */ | ||
79 | |||
80 | #define BCMA_SOC_PCI1_MEM 0x40000000U /* Host Mode sb2pcitranslation0 (64 MB) */ | ||
81 | #define BCMA_SOC_PCI1_CFG 0x44000000U /* Host Mode sb2pcitranslation1 (64 MB) */ | ||
82 | #define BCMA_SOC_PCIE1_DMA_H32 0xc0000000U /* PCIE Client Mode sb2pcitranslation2 | ||
83 | * (2 ZettaBytes), high 32 bits | ||
84 | */ | ||
85 | |||
59 | #endif /* LINUX_BCMA_REGS_H_ */ | 86 | #endif /* LINUX_BCMA_REGS_H_ */ |
diff --git a/include/linux/binfmts.h b/include/linux/binfmts.h index 0092102db2de..366422bc1633 100644 --- a/include/linux/binfmts.h +++ b/include/linux/binfmts.h | |||
@@ -92,17 +92,17 @@ struct linux_binfmt { | |||
92 | unsigned long min_coredump; /* minimal dump size */ | 92 | unsigned long min_coredump; /* minimal dump size */ |
93 | }; | 93 | }; |
94 | 94 | ||
95 | extern int __register_binfmt(struct linux_binfmt *fmt, int insert); | 95 | extern void __register_binfmt(struct linux_binfmt *fmt, int insert); |
96 | 96 | ||
97 | /* Registration of default binfmt handlers */ | 97 | /* Registration of default binfmt handlers */ |
98 | static inline int register_binfmt(struct linux_binfmt *fmt) | 98 | static inline void register_binfmt(struct linux_binfmt *fmt) |
99 | { | 99 | { |
100 | return __register_binfmt(fmt, 0); | 100 | __register_binfmt(fmt, 0); |
101 | } | 101 | } |
102 | /* Same as above, but adds a new binfmt at the top of the list */ | 102 | /* Same as above, but adds a new binfmt at the top of the list */ |
103 | static inline int insert_binfmt(struct linux_binfmt *fmt) | 103 | static inline void insert_binfmt(struct linux_binfmt *fmt) |
104 | { | 104 | { |
105 | return __register_binfmt(fmt, 1); | 105 | __register_binfmt(fmt, 1); |
106 | } | 106 | } |
107 | 107 | ||
108 | extern void unregister_binfmt(struct linux_binfmt *); | 108 | extern void unregister_binfmt(struct linux_binfmt *); |
diff --git a/include/linux/bio.h b/include/linux/bio.h index 129a9c097958..4d94eb8bcbcc 100644 --- a/include/linux/bio.h +++ b/include/linux/bio.h | |||
@@ -23,6 +23,7 @@ | |||
23 | #include <linux/highmem.h> | 23 | #include <linux/highmem.h> |
24 | #include <linux/mempool.h> | 24 | #include <linux/mempool.h> |
25 | #include <linux/ioprio.h> | 25 | #include <linux/ioprio.h> |
26 | #include <linux/bug.h> | ||
26 | 27 | ||
27 | #ifdef CONFIG_BLOCK | 28 | #ifdef CONFIG_BLOCK |
28 | 29 | ||
@@ -101,10 +102,10 @@ static inline int bio_has_allocated_vec(struct bio *bio) | |||
101 | * I/O completely on that queue (see ide-dma for example) | 102 | * I/O completely on that queue (see ide-dma for example) |
102 | */ | 103 | */ |
103 | #define __bio_kmap_atomic(bio, idx, kmtype) \ | 104 | #define __bio_kmap_atomic(bio, idx, kmtype) \ |
104 | (kmap_atomic(bio_iovec_idx((bio), (idx))->bv_page, kmtype) + \ | 105 | (kmap_atomic(bio_iovec_idx((bio), (idx))->bv_page) + \ |
105 | bio_iovec_idx((bio), (idx))->bv_offset) | 106 | bio_iovec_idx((bio), (idx))->bv_offset) |
106 | 107 | ||
107 | #define __bio_kunmap_atomic(addr, kmtype) kunmap_atomic(addr, kmtype) | 108 | #define __bio_kunmap_atomic(addr, kmtype) kunmap_atomic(addr) |
108 | 109 | ||
109 | /* | 110 | /* |
110 | * merge helpers etc | 111 | * merge helpers etc |
@@ -317,7 +318,7 @@ static inline char *bvec_kmap_irq(struct bio_vec *bvec, unsigned long *flags) | |||
317 | * balancing is a lot nicer this way | 318 | * balancing is a lot nicer this way |
318 | */ | 319 | */ |
319 | local_irq_save(*flags); | 320 | local_irq_save(*flags); |
320 | addr = (unsigned long) kmap_atomic(bvec->bv_page, KM_BIO_SRC_IRQ); | 321 | addr = (unsigned long) kmap_atomic(bvec->bv_page); |
321 | 322 | ||
322 | BUG_ON(addr & ~PAGE_MASK); | 323 | BUG_ON(addr & ~PAGE_MASK); |
323 | 324 | ||
@@ -328,7 +329,7 @@ static inline void bvec_kunmap_irq(char *buffer, unsigned long *flags) | |||
328 | { | 329 | { |
329 | unsigned long ptr = (unsigned long) buffer & PAGE_MASK; | 330 | unsigned long ptr = (unsigned long) buffer & PAGE_MASK; |
330 | 331 | ||
331 | kunmap_atomic((void *) ptr, KM_BIO_SRC_IRQ); | 332 | kunmap_atomic((void *) ptr); |
332 | local_irq_restore(*flags); | 333 | local_irq_restore(*flags); |
333 | } | 334 | } |
334 | 335 | ||
diff --git a/include/linux/bit_spinlock.h b/include/linux/bit_spinlock.h index ac4d9f8b52e9..3b5bafce4337 100644 --- a/include/linux/bit_spinlock.h +++ b/include/linux/bit_spinlock.h | |||
@@ -4,6 +4,7 @@ | |||
4 | #include <linux/kernel.h> | 4 | #include <linux/kernel.h> |
5 | #include <linux/preempt.h> | 5 | #include <linux/preempt.h> |
6 | #include <linux/atomic.h> | 6 | #include <linux/atomic.h> |
7 | #include <linux/bug.h> | ||
7 | 8 | ||
8 | /* | 9 | /* |
9 | * bit-based spin_lock() | 10 | * bit-based spin_lock() |
diff --git a/include/linux/bitops.h b/include/linux/bitops.h index 94300fe46cce..a3b6b82108b9 100644 --- a/include/linux/bitops.h +++ b/include/linux/bitops.h | |||
@@ -27,11 +27,22 @@ extern unsigned long __sw_hweight64(__u64 w); | |||
27 | (bit) = find_next_bit((addr), (size), (bit) + 1)) | 27 | (bit) = find_next_bit((addr), (size), (bit) + 1)) |
28 | 28 | ||
29 | /* same as for_each_set_bit() but use bit as value to start with */ | 29 | /* same as for_each_set_bit() but use bit as value to start with */ |
30 | #define for_each_set_bit_cont(bit, addr, size) \ | 30 | #define for_each_set_bit_from(bit, addr, size) \ |
31 | for ((bit) = find_next_bit((addr), (size), (bit)); \ | 31 | for ((bit) = find_next_bit((addr), (size), (bit)); \ |
32 | (bit) < (size); \ | 32 | (bit) < (size); \ |
33 | (bit) = find_next_bit((addr), (size), (bit) + 1)) | 33 | (bit) = find_next_bit((addr), (size), (bit) + 1)) |
34 | 34 | ||
35 | #define for_each_clear_bit(bit, addr, size) \ | ||
36 | for ((bit) = find_first_zero_bit((addr), (size)); \ | ||
37 | (bit) < (size); \ | ||
38 | (bit) = find_next_zero_bit((addr), (size), (bit) + 1)) | ||
39 | |||
40 | /* same as for_each_clear_bit() but use bit as value to start with */ | ||
41 | #define for_each_clear_bit_from(bit, addr, size) \ | ||
42 | for ((bit) = find_next_zero_bit((addr), (size), (bit)); \ | ||
43 | (bit) < (size); \ | ||
44 | (bit) = find_next_zero_bit((addr), (size), (bit) + 1)) | ||
45 | |||
35 | static __inline__ int get_bitmask_order(unsigned int count) | 46 | static __inline__ int get_bitmask_order(unsigned int count) |
36 | { | 47 | { |
37 | int order; | 48 | int order; |
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index 606cf339bb56..2aa24664a5b5 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h | |||
@@ -426,14 +426,10 @@ struct request_queue { | |||
426 | (1 << QUEUE_FLAG_SAME_COMP) | \ | 426 | (1 << QUEUE_FLAG_SAME_COMP) | \ |
427 | (1 << QUEUE_FLAG_ADD_RANDOM)) | 427 | (1 << QUEUE_FLAG_ADD_RANDOM)) |
428 | 428 | ||
429 | static inline int queue_is_locked(struct request_queue *q) | 429 | static inline void queue_lockdep_assert_held(struct request_queue *q) |
430 | { | 430 | { |
431 | #ifdef CONFIG_SMP | 431 | if (q->queue_lock) |
432 | spinlock_t *lock = q->queue_lock; | 432 | lockdep_assert_held(q->queue_lock); |
433 | return lock && spin_is_locked(lock); | ||
434 | #else | ||
435 | return 1; | ||
436 | #endif | ||
437 | } | 433 | } |
438 | 434 | ||
439 | static inline void queue_flag_set_unlocked(unsigned int flag, | 435 | static inline void queue_flag_set_unlocked(unsigned int flag, |
@@ -445,7 +441,7 @@ static inline void queue_flag_set_unlocked(unsigned int flag, | |||
445 | static inline int queue_flag_test_and_clear(unsigned int flag, | 441 | static inline int queue_flag_test_and_clear(unsigned int flag, |
446 | struct request_queue *q) | 442 | struct request_queue *q) |
447 | { | 443 | { |
448 | WARN_ON_ONCE(!queue_is_locked(q)); | 444 | queue_lockdep_assert_held(q); |
449 | 445 | ||
450 | if (test_bit(flag, &q->queue_flags)) { | 446 | if (test_bit(flag, &q->queue_flags)) { |
451 | __clear_bit(flag, &q->queue_flags); | 447 | __clear_bit(flag, &q->queue_flags); |
@@ -458,7 +454,7 @@ static inline int queue_flag_test_and_clear(unsigned int flag, | |||
458 | static inline int queue_flag_test_and_set(unsigned int flag, | 454 | static inline int queue_flag_test_and_set(unsigned int flag, |
459 | struct request_queue *q) | 455 | struct request_queue *q) |
460 | { | 456 | { |
461 | WARN_ON_ONCE(!queue_is_locked(q)); | 457 | queue_lockdep_assert_held(q); |
462 | 458 | ||
463 | if (!test_bit(flag, &q->queue_flags)) { | 459 | if (!test_bit(flag, &q->queue_flags)) { |
464 | __set_bit(flag, &q->queue_flags); | 460 | __set_bit(flag, &q->queue_flags); |
@@ -470,7 +466,7 @@ static inline int queue_flag_test_and_set(unsigned int flag, | |||
470 | 466 | ||
471 | static inline void queue_flag_set(unsigned int flag, struct request_queue *q) | 467 | static inline void queue_flag_set(unsigned int flag, struct request_queue *q) |
472 | { | 468 | { |
473 | WARN_ON_ONCE(!queue_is_locked(q)); | 469 | queue_lockdep_assert_held(q); |
474 | __set_bit(flag, &q->queue_flags); | 470 | __set_bit(flag, &q->queue_flags); |
475 | } | 471 | } |
476 | 472 | ||
@@ -487,7 +483,7 @@ static inline int queue_in_flight(struct request_queue *q) | |||
487 | 483 | ||
488 | static inline void queue_flag_clear(unsigned int flag, struct request_queue *q) | 484 | static inline void queue_flag_clear(unsigned int flag, struct request_queue *q) |
489 | { | 485 | { |
490 | WARN_ON_ONCE(!queue_is_locked(q)); | 486 | queue_lockdep_assert_held(q); |
491 | __clear_bit(flag, &q->queue_flags); | 487 | __clear_bit(flag, &q->queue_flags); |
492 | } | 488 | } |
493 | 489 | ||
diff --git a/include/linux/bug.h b/include/linux/bug.h index d276b5510c83..72961c39576a 100644 --- a/include/linux/bug.h +++ b/include/linux/bug.h | |||
@@ -11,6 +11,67 @@ enum bug_trap_type { | |||
11 | 11 | ||
12 | struct pt_regs; | 12 | struct pt_regs; |
13 | 13 | ||
14 | #ifdef __CHECKER__ | ||
15 | #define BUILD_BUG_ON_NOT_POWER_OF_2(n) | ||
16 | #define BUILD_BUG_ON_ZERO(e) (0) | ||
17 | #define BUILD_BUG_ON_NULL(e) ((void*)0) | ||
18 | #define BUILD_BUG_ON(condition) | ||
19 | #define BUILD_BUG() (0) | ||
20 | #else /* __CHECKER__ */ | ||
21 | |||
22 | /* Force a compilation error if a constant expression is not a power of 2 */ | ||
23 | #define BUILD_BUG_ON_NOT_POWER_OF_2(n) \ | ||
24 | BUILD_BUG_ON((n) == 0 || (((n) & ((n) - 1)) != 0)) | ||
25 | |||
26 | /* Force a compilation error if condition is true, but also produce a | ||
27 | result (of value 0 and type size_t), so the expression can be used | ||
28 | e.g. in a structure initializer (or where-ever else comma expressions | ||
29 | aren't permitted). */ | ||
30 | #define BUILD_BUG_ON_ZERO(e) (sizeof(struct { int:-!!(e); })) | ||
31 | #define BUILD_BUG_ON_NULL(e) ((void *)sizeof(struct { int:-!!(e); })) | ||
32 | |||
33 | /** | ||
34 | * BUILD_BUG_ON - break compile if a condition is true. | ||
35 | * @condition: the condition which the compiler should know is false. | ||
36 | * | ||
37 | * If you have some code which relies on certain constants being equal, or | ||
38 | * other compile-time-evaluated condition, you should use BUILD_BUG_ON to | ||
39 | * detect if someone changes it. | ||
40 | * | ||
41 | * The implementation uses gcc's reluctance to create a negative array, but | ||
42 | * gcc (as of 4.4) only emits that error for obvious cases (eg. not arguments | ||
43 | * to inline functions). So as a fallback we use the optimizer; if it can't | ||
44 | * prove the condition is false, it will cause a link error on the undefined | ||
45 | * "__build_bug_on_failed". This error message can be harder to track down | ||
46 | * though, hence the two different methods. | ||
47 | */ | ||
48 | #ifndef __OPTIMIZE__ | ||
49 | #define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)])) | ||
50 | #else | ||
51 | extern int __build_bug_on_failed; | ||
52 | #define BUILD_BUG_ON(condition) \ | ||
53 | do { \ | ||
54 | ((void)sizeof(char[1 - 2*!!(condition)])); \ | ||
55 | if (condition) __build_bug_on_failed = 1; \ | ||
56 | } while(0) | ||
57 | #endif | ||
58 | |||
59 | /** | ||
60 | * BUILD_BUG - break compile if used. | ||
61 | * | ||
62 | * If you have some code that you expect the compiler to eliminate at | ||
63 | * build time, you should use BUILD_BUG to detect if it is | ||
64 | * unexpectedly used. | ||
65 | */ | ||
66 | #define BUILD_BUG() \ | ||
67 | do { \ | ||
68 | extern void __build_bug_failed(void) \ | ||
69 | __linktime_error("BUILD_BUG failed"); \ | ||
70 | __build_bug_failed(); \ | ||
71 | } while (0) | ||
72 | |||
73 | #endif /* __CHECKER__ */ | ||
74 | |||
14 | #ifdef CONFIG_GENERIC_BUG | 75 | #ifdef CONFIG_GENERIC_BUG |
15 | #include <asm-generic/bug.h> | 76 | #include <asm-generic/bug.h> |
16 | 77 | ||
diff --git a/include/linux/c2port.h b/include/linux/c2port.h index a2f7d7413f30..4efabcb51347 100644 --- a/include/linux/c2port.h +++ b/include/linux/c2port.h | |||
@@ -9,11 +9,12 @@ | |||
9 | * the Free Software Foundation | 9 | * the Free Software Foundation |
10 | */ | 10 | */ |
11 | 11 | ||
12 | #include <linux/device.h> | ||
13 | #include <linux/kmemcheck.h> | 12 | #include <linux/kmemcheck.h> |
14 | 13 | ||
15 | #define C2PORT_NAME_LEN 32 | 14 | #define C2PORT_NAME_LEN 32 |
16 | 15 | ||
16 | struct device; | ||
17 | |||
17 | /* | 18 | /* |
18 | * C2 port basic structs | 19 | * C2 port basic structs |
19 | */ | 20 | */ |
diff --git a/include/linux/can/dev.h b/include/linux/can/dev.h index a0969fcb72b9..5d2efe7e3f1b 100644 --- a/include/linux/can/dev.h +++ b/include/linux/can/dev.h | |||
@@ -92,7 +92,7 @@ void can_bus_off(struct net_device *dev); | |||
92 | 92 | ||
93 | void can_put_echo_skb(struct sk_buff *skb, struct net_device *dev, | 93 | void can_put_echo_skb(struct sk_buff *skb, struct net_device *dev, |
94 | unsigned int idx); | 94 | unsigned int idx); |
95 | void can_get_echo_skb(struct net_device *dev, unsigned int idx); | 95 | unsigned int can_get_echo_skb(struct net_device *dev, unsigned int idx); |
96 | void can_free_echo_skb(struct net_device *dev, unsigned int idx); | 96 | void can_free_echo_skb(struct net_device *dev, unsigned int idx); |
97 | 97 | ||
98 | struct sk_buff *alloc_can_skb(struct net_device *dev, struct can_frame **cf); | 98 | struct sk_buff *alloc_can_skb(struct net_device *dev, struct can_frame **cf); |
diff --git a/include/linux/cdrom.h b/include/linux/cdrom.h index 7c48029dffe6..dfd7f187c351 100644 --- a/include/linux/cdrom.h +++ b/include/linux/cdrom.h | |||
@@ -910,7 +910,6 @@ struct mode_page_header { | |||
910 | 910 | ||
911 | #ifdef __KERNEL__ | 911 | #ifdef __KERNEL__ |
912 | #include <linux/fs.h> /* not really needed, later.. */ | 912 | #include <linux/fs.h> /* not really needed, later.. */ |
913 | #include <linux/device.h> | ||
914 | #include <linux/list.h> | 913 | #include <linux/list.h> |
915 | 914 | ||
916 | struct packet_command | 915 | struct packet_command |
diff --git a/include/linux/ceph/decode.h b/include/linux/ceph/decode.h index c5b6939fb32a..220ae21e819b 100644 --- a/include/linux/ceph/decode.h +++ b/include/linux/ceph/decode.h | |||
@@ -1,8 +1,9 @@ | |||
1 | #ifndef __CEPH_DECODE_H | 1 | #ifndef __CEPH_DECODE_H |
2 | #define __CEPH_DECODE_H | 2 | #define __CEPH_DECODE_H |
3 | 3 | ||
4 | #include <asm/unaligned.h> | 4 | #include <linux/bug.h> |
5 | #include <linux/time.h> | 5 | #include <linux/time.h> |
6 | #include <asm/unaligned.h> | ||
6 | 7 | ||
7 | #include "types.h" | 8 | #include "types.h" |
8 | 9 | ||
diff --git a/include/linux/ceph/libceph.h b/include/linux/ceph/libceph.h index 95bd8502e715..e71d683982a6 100644 --- a/include/linux/ceph/libceph.h +++ b/include/linux/ceph/libceph.h | |||
@@ -7,6 +7,7 @@ | |||
7 | #include <linux/backing-dev.h> | 7 | #include <linux/backing-dev.h> |
8 | #include <linux/completion.h> | 8 | #include <linux/completion.h> |
9 | #include <linux/exportfs.h> | 9 | #include <linux/exportfs.h> |
10 | #include <linux/bug.h> | ||
10 | #include <linux/fs.h> | 11 | #include <linux/fs.h> |
11 | #include <linux/mempool.h> | 12 | #include <linux/mempool.h> |
12 | #include <linux/pagemap.h> | 13 | #include <linux/pagemap.h> |
@@ -207,7 +208,7 @@ extern struct kmem_cache *ceph_cap_cachep; | |||
207 | extern struct kmem_cache *ceph_dentry_cachep; | 208 | extern struct kmem_cache *ceph_dentry_cachep; |
208 | extern struct kmem_cache *ceph_file_cachep; | 209 | extern struct kmem_cache *ceph_file_cachep; |
209 | 210 | ||
210 | extern int ceph_parse_options(struct ceph_options **popt, char *options, | 211 | extern struct ceph_options *ceph_parse_options(char *options, |
211 | const char *dev_name, const char *dev_name_end, | 212 | const char *dev_name, const char *dev_name_end, |
212 | int (*parse_extra_token)(char *c, void *private), | 213 | int (*parse_extra_token)(char *c, void *private), |
213 | void *private); | 214 | void *private); |
diff --git a/include/linux/ceph/mdsmap.h b/include/linux/ceph/mdsmap.h index 4c5cb0880bba..9935fac8c107 100644 --- a/include/linux/ceph/mdsmap.h +++ b/include/linux/ceph/mdsmap.h | |||
@@ -1,6 +1,7 @@ | |||
1 | #ifndef _FS_CEPH_MDSMAP_H | 1 | #ifndef _FS_CEPH_MDSMAP_H |
2 | #define _FS_CEPH_MDSMAP_H | 2 | #define _FS_CEPH_MDSMAP_H |
3 | 3 | ||
4 | #include <linux/bug.h> | ||
4 | #include "types.h" | 5 | #include "types.h" |
5 | 6 | ||
6 | /* | 7 | /* |
diff --git a/include/linux/ceph/messenger.h b/include/linux/ceph/messenger.h index ffbeb2c217b4..3bff047f6b0f 100644 --- a/include/linux/ceph/messenger.h +++ b/include/linux/ceph/messenger.h | |||
@@ -14,8 +14,6 @@ | |||
14 | struct ceph_msg; | 14 | struct ceph_msg; |
15 | struct ceph_connection; | 15 | struct ceph_connection; |
16 | 16 | ||
17 | extern struct workqueue_struct *ceph_msgr_wq; /* receive work queue */ | ||
18 | |||
19 | /* | 17 | /* |
20 | * Ceph defines these callbacks for handling connection events. | 18 | * Ceph defines these callbacks for handling connection events. |
21 | */ | 19 | */ |
@@ -54,7 +52,6 @@ struct ceph_connection_operations { | |||
54 | struct ceph_messenger { | 52 | struct ceph_messenger { |
55 | struct ceph_entity_inst inst; /* my name+address */ | 53 | struct ceph_entity_inst inst; /* my name+address */ |
56 | struct ceph_entity_addr my_enc_addr; | 54 | struct ceph_entity_addr my_enc_addr; |
57 | struct page *zero_page; /* used in certain error cases */ | ||
58 | 55 | ||
59 | bool nocrc; | 56 | bool nocrc; |
60 | 57 | ||
@@ -101,7 +98,7 @@ struct ceph_msg { | |||
101 | struct ceph_msg_pos { | 98 | struct ceph_msg_pos { |
102 | int page, page_pos; /* which page; offset in page */ | 99 | int page, page_pos; /* which page; offset in page */ |
103 | int data_pos; /* offset in data payload */ | 100 | int data_pos; /* offset in data payload */ |
104 | int did_page_crc; /* true if we've calculated crc for current page */ | 101 | bool did_page_crc; /* true if we've calculated crc for current page */ |
105 | }; | 102 | }; |
106 | 103 | ||
107 | /* ceph connection fault delay defaults, for exponential backoff */ | 104 | /* ceph connection fault delay defaults, for exponential backoff */ |
diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h index e9b602151caf..5a85b3415c1b 100644 --- a/include/linux/cgroup.h +++ b/include/linux/cgroup.h | |||
@@ -160,38 +160,6 @@ enum { | |||
160 | CGRP_CLONE_CHILDREN, | 160 | CGRP_CLONE_CHILDREN, |
161 | }; | 161 | }; |
162 | 162 | ||
163 | /* which pidlist file are we talking about? */ | ||
164 | enum cgroup_filetype { | ||
165 | CGROUP_FILE_PROCS, | ||
166 | CGROUP_FILE_TASKS, | ||
167 | }; | ||
168 | |||
169 | /* | ||
170 | * A pidlist is a list of pids that virtually represents the contents of one | ||
171 | * of the cgroup files ("procs" or "tasks"). We keep a list of such pidlists, | ||
172 | * a pair (one each for procs, tasks) for each pid namespace that's relevant | ||
173 | * to the cgroup. | ||
174 | */ | ||
175 | struct cgroup_pidlist { | ||
176 | /* | ||
177 | * used to find which pidlist is wanted. doesn't change as long as | ||
178 | * this particular list stays in the list. | ||
179 | */ | ||
180 | struct { enum cgroup_filetype type; struct pid_namespace *ns; } key; | ||
181 | /* array of xids */ | ||
182 | pid_t *list; | ||
183 | /* how many elements the above list has */ | ||
184 | int length; | ||
185 | /* how many files are using the current array */ | ||
186 | int use_count; | ||
187 | /* each of these stored in a list by its cgroup */ | ||
188 | struct list_head links; | ||
189 | /* pointer to the cgroup we belong to, for list removal purposes */ | ||
190 | struct cgroup *owner; | ||
191 | /* protects the other fields */ | ||
192 | struct rw_semaphore mutex; | ||
193 | }; | ||
194 | |||
195 | struct cgroup { | 163 | struct cgroup { |
196 | unsigned long flags; /* "unsigned long" so bitops work */ | 164 | unsigned long flags; /* "unsigned long" so bitops work */ |
197 | 165 | ||
@@ -484,23 +452,18 @@ int cgroup_taskset_size(struct cgroup_taskset *tset); | |||
484 | */ | 452 | */ |
485 | 453 | ||
486 | struct cgroup_subsys { | 454 | struct cgroup_subsys { |
487 | struct cgroup_subsys_state *(*create)(struct cgroup_subsys *ss, | 455 | struct cgroup_subsys_state *(*create)(struct cgroup *cgrp); |
488 | struct cgroup *cgrp); | 456 | int (*pre_destroy)(struct cgroup *cgrp); |
489 | int (*pre_destroy)(struct cgroup_subsys *ss, struct cgroup *cgrp); | 457 | void (*destroy)(struct cgroup *cgrp); |
490 | void (*destroy)(struct cgroup_subsys *ss, struct cgroup *cgrp); | 458 | int (*can_attach)(struct cgroup *cgrp, struct cgroup_taskset *tset); |
491 | int (*can_attach)(struct cgroup_subsys *ss, struct cgroup *cgrp, | 459 | void (*cancel_attach)(struct cgroup *cgrp, struct cgroup_taskset *tset); |
492 | struct cgroup_taskset *tset); | 460 | void (*attach)(struct cgroup *cgrp, struct cgroup_taskset *tset); |
493 | void (*cancel_attach)(struct cgroup_subsys *ss, struct cgroup *cgrp, | 461 | void (*fork)(struct task_struct *task); |
494 | struct cgroup_taskset *tset); | 462 | void (*exit)(struct cgroup *cgrp, struct cgroup *old_cgrp, |
495 | void (*attach)(struct cgroup_subsys *ss, struct cgroup *cgrp, | 463 | struct task_struct *task); |
496 | struct cgroup_taskset *tset); | 464 | int (*populate)(struct cgroup_subsys *ss, struct cgroup *cgrp); |
497 | void (*fork)(struct cgroup_subsys *ss, struct task_struct *task); | 465 | void (*post_clone)(struct cgroup *cgrp); |
498 | void (*exit)(struct cgroup_subsys *ss, struct cgroup *cgrp, | 466 | void (*bind)(struct cgroup *root); |
499 | struct cgroup *old_cgrp, struct task_struct *task); | ||
500 | int (*populate)(struct cgroup_subsys *ss, | ||
501 | struct cgroup *cgrp); | ||
502 | void (*post_clone)(struct cgroup_subsys *ss, struct cgroup *cgrp); | ||
503 | void (*bind)(struct cgroup_subsys *ss, struct cgroup *root); | ||
504 | 467 | ||
505 | int subsys_id; | 468 | int subsys_id; |
506 | int active; | 469 | int active; |
@@ -535,7 +498,7 @@ struct cgroup_subsys { | |||
535 | struct list_head sibling; | 498 | struct list_head sibling; |
536 | /* used when use_id == true */ | 499 | /* used when use_id == true */ |
537 | struct idr idr; | 500 | struct idr idr; |
538 | rwlock_t id_lock; | 501 | spinlock_t id_lock; |
539 | 502 | ||
540 | /* should be defined only by modular subsystems */ | 503 | /* should be defined only by modular subsystems */ |
541 | struct module *module; | 504 | struct module *module; |
@@ -602,11 +565,6 @@ int cgroup_scan_tasks(struct cgroup_scanner *scan); | |||
602 | int cgroup_attach_task(struct cgroup *, struct task_struct *); | 565 | int cgroup_attach_task(struct cgroup *, struct task_struct *); |
603 | int cgroup_attach_task_all(struct task_struct *from, struct task_struct *); | 566 | int cgroup_attach_task_all(struct task_struct *from, struct task_struct *); |
604 | 567 | ||
605 | static inline int cgroup_attach_task_current_cg(struct task_struct *tsk) | ||
606 | { | ||
607 | return cgroup_attach_task_all(current, tsk); | ||
608 | } | ||
609 | |||
610 | /* | 568 | /* |
611 | * CSS ID is ID for cgroup_subsys_state structs under subsys. This only works | 569 | * CSS ID is ID for cgroup_subsys_state structs under subsys. This only works |
612 | * if cgroup_subsys.use_id == true. It can be used for looking up and scanning. | 570 | * if cgroup_subsys.use_id == true. It can be used for looking up and scanning. |
@@ -669,10 +627,6 @@ static inline int cgroup_attach_task_all(struct task_struct *from, | |||
669 | { | 627 | { |
670 | return 0; | 628 | return 0; |
671 | } | 629 | } |
672 | static inline int cgroup_attach_task_current_cg(struct task_struct *t) | ||
673 | { | ||
674 | return 0; | ||
675 | } | ||
676 | 630 | ||
677 | #endif /* !CONFIG_CGROUPS */ | 631 | #endif /* !CONFIG_CGROUPS */ |
678 | 632 | ||
diff --git a/include/linux/cleancache.h b/include/linux/cleancache.h index 04ffb2e6c9d0..42e55deee757 100644 --- a/include/linux/cleancache.h +++ b/include/linux/cleancache.h | |||
@@ -28,9 +28,9 @@ struct cleancache_ops { | |||
28 | pgoff_t, struct page *); | 28 | pgoff_t, struct page *); |
29 | void (*put_page)(int, struct cleancache_filekey, | 29 | void (*put_page)(int, struct cleancache_filekey, |
30 | pgoff_t, struct page *); | 30 | pgoff_t, struct page *); |
31 | void (*flush_page)(int, struct cleancache_filekey, pgoff_t); | 31 | void (*invalidate_page)(int, struct cleancache_filekey, pgoff_t); |
32 | void (*flush_inode)(int, struct cleancache_filekey); | 32 | void (*invalidate_inode)(int, struct cleancache_filekey); |
33 | void (*flush_fs)(int); | 33 | void (*invalidate_fs)(int); |
34 | }; | 34 | }; |
35 | 35 | ||
36 | extern struct cleancache_ops | 36 | extern struct cleancache_ops |
@@ -39,9 +39,9 @@ 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 *); |
40 | extern int __cleancache_get_page(struct page *); | 40 | extern int __cleancache_get_page(struct page *); |
41 | extern void __cleancache_put_page(struct page *); | 41 | extern void __cleancache_put_page(struct page *); |
42 | extern void __cleancache_flush_page(struct address_space *, struct page *); | 42 | extern void __cleancache_invalidate_page(struct address_space *, struct page *); |
43 | extern void __cleancache_flush_inode(struct address_space *); | 43 | extern void __cleancache_invalidate_inode(struct address_space *); |
44 | extern void __cleancache_flush_fs(struct super_block *); | 44 | extern void __cleancache_invalidate_fs(struct super_block *); |
45 | extern int cleancache_enabled; | 45 | extern int cleancache_enabled; |
46 | 46 | ||
47 | #ifdef CONFIG_CLEANCACHE | 47 | #ifdef CONFIG_CLEANCACHE |
@@ -99,24 +99,24 @@ static inline void cleancache_put_page(struct page *page) | |||
99 | __cleancache_put_page(page); | 99 | __cleancache_put_page(page); |
100 | } | 100 | } |
101 | 101 | ||
102 | static inline void cleancache_flush_page(struct address_space *mapping, | 102 | static inline void cleancache_invalidate_page(struct address_space *mapping, |
103 | struct page *page) | 103 | struct page *page) |
104 | { | 104 | { |
105 | /* careful... page->mapping is NULL sometimes when this is called */ | 105 | /* careful... page->mapping is NULL sometimes when this is called */ |
106 | if (cleancache_enabled && cleancache_fs_enabled_mapping(mapping)) | 106 | if (cleancache_enabled && cleancache_fs_enabled_mapping(mapping)) |
107 | __cleancache_flush_page(mapping, page); | 107 | __cleancache_invalidate_page(mapping, page); |
108 | } | 108 | } |
109 | 109 | ||
110 | static inline void cleancache_flush_inode(struct address_space *mapping) | 110 | static inline void cleancache_invalidate_inode(struct address_space *mapping) |
111 | { | 111 | { |
112 | if (cleancache_enabled && cleancache_fs_enabled_mapping(mapping)) | 112 | if (cleancache_enabled && cleancache_fs_enabled_mapping(mapping)) |
113 | __cleancache_flush_inode(mapping); | 113 | __cleancache_invalidate_inode(mapping); |
114 | } | 114 | } |
115 | 115 | ||
116 | static inline void cleancache_flush_fs(struct super_block *sb) | 116 | static inline void cleancache_invalidate_fs(struct super_block *sb) |
117 | { | 117 | { |
118 | if (cleancache_enabled) | 118 | if (cleancache_enabled) |
119 | __cleancache_flush_fs(sb); | 119 | __cleancache_invalidate_fs(sb); |
120 | } | 120 | } |
121 | 121 | ||
122 | #endif /* _LINUX_CLEANCACHE_H */ | 122 | #endif /* _LINUX_CLEANCACHE_H */ |
diff --git a/include/linux/clk-private.h b/include/linux/clk-private.h new file mode 100644 index 000000000000..5e4312b6f5cc --- /dev/null +++ b/include/linux/clk-private.h | |||
@@ -0,0 +1,196 @@ | |||
1 | /* | ||
2 | * linux/include/linux/clk-private.h | ||
3 | * | ||
4 | * Copyright (c) 2010-2011 Jeremy Kerr <jeremy.kerr@canonical.com> | ||
5 | * Copyright (C) 2011-2012 Linaro Ltd <mturquette@linaro.org> | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License version 2 as | ||
9 | * published by the Free Software Foundation. | ||
10 | */ | ||
11 | #ifndef __LINUX_CLK_PRIVATE_H | ||
12 | #define __LINUX_CLK_PRIVATE_H | ||
13 | |||
14 | #include <linux/clk-provider.h> | ||
15 | #include <linux/list.h> | ||
16 | |||
17 | /* | ||
18 | * WARNING: Do not include clk-private.h from any file that implements struct | ||
19 | * clk_ops. Doing so is a layering violation! | ||
20 | * | ||
21 | * This header exists only to allow for statically initialized clock data. Any | ||
22 | * static clock data must be defined in a separate file from the logic that | ||
23 | * implements the clock operations for that same data. | ||
24 | */ | ||
25 | |||
26 | #ifdef CONFIG_COMMON_CLK | ||
27 | |||
28 | struct clk { | ||
29 | const char *name; | ||
30 | const struct clk_ops *ops; | ||
31 | struct clk_hw *hw; | ||
32 | struct clk *parent; | ||
33 | char **parent_names; | ||
34 | struct clk **parents; | ||
35 | u8 num_parents; | ||
36 | unsigned long rate; | ||
37 | unsigned long new_rate; | ||
38 | unsigned long flags; | ||
39 | unsigned int enable_count; | ||
40 | unsigned int prepare_count; | ||
41 | struct hlist_head children; | ||
42 | struct hlist_node child_node; | ||
43 | unsigned int notifier_count; | ||
44 | #ifdef CONFIG_COMMON_CLK_DEBUG | ||
45 | struct dentry *dentry; | ||
46 | #endif | ||
47 | }; | ||
48 | |||
49 | /* | ||
50 | * DOC: Basic clock implementations common to many platforms | ||
51 | * | ||
52 | * Each basic clock hardware type is comprised of a structure describing the | ||
53 | * clock hardware, implementations of the relevant callbacks in struct clk_ops, | ||
54 | * unique flags for that hardware type, a registration function and an | ||
55 | * alternative macro for static initialization | ||
56 | */ | ||
57 | |||
58 | extern struct clk_ops clk_fixed_rate_ops; | ||
59 | |||
60 | #define DEFINE_CLK_FIXED_RATE(_name, _flags, _rate, \ | ||
61 | _fixed_rate_flags) \ | ||
62 | static struct clk _name; \ | ||
63 | static char *_name##_parent_names[] = {}; \ | ||
64 | static struct clk_fixed_rate _name##_hw = { \ | ||
65 | .hw = { \ | ||
66 | .clk = &_name, \ | ||
67 | }, \ | ||
68 | .fixed_rate = _rate, \ | ||
69 | .flags = _fixed_rate_flags, \ | ||
70 | }; \ | ||
71 | static struct clk _name = { \ | ||
72 | .name = #_name, \ | ||
73 | .ops = &clk_fixed_rate_ops, \ | ||
74 | .hw = &_name##_hw.hw, \ | ||
75 | .parent_names = _name##_parent_names, \ | ||
76 | .num_parents = \ | ||
77 | ARRAY_SIZE(_name##_parent_names), \ | ||
78 | .flags = _flags, \ | ||
79 | }; | ||
80 | |||
81 | extern struct clk_ops clk_gate_ops; | ||
82 | |||
83 | #define DEFINE_CLK_GATE(_name, _parent_name, _parent_ptr, \ | ||
84 | _flags, _reg, _bit_idx, \ | ||
85 | _gate_flags, _lock) \ | ||
86 | static struct clk _name; \ | ||
87 | static char *_name##_parent_names[] = { \ | ||
88 | _parent_name, \ | ||
89 | }; \ | ||
90 | static struct clk *_name##_parents[] = { \ | ||
91 | _parent_ptr, \ | ||
92 | }; \ | ||
93 | static struct clk_gate _name##_hw = { \ | ||
94 | .hw = { \ | ||
95 | .clk = &_name, \ | ||
96 | }, \ | ||
97 | .reg = _reg, \ | ||
98 | .bit_idx = _bit_idx, \ | ||
99 | .flags = _gate_flags, \ | ||
100 | .lock = _lock, \ | ||
101 | }; \ | ||
102 | static struct clk _name = { \ | ||
103 | .name = #_name, \ | ||
104 | .ops = &clk_gate_ops, \ | ||
105 | .hw = &_name##_hw.hw, \ | ||
106 | .parent_names = _name##_parent_names, \ | ||
107 | .num_parents = \ | ||
108 | ARRAY_SIZE(_name##_parent_names), \ | ||
109 | .parents = _name##_parents, \ | ||
110 | .flags = _flags, \ | ||
111 | }; | ||
112 | |||
113 | extern struct clk_ops clk_divider_ops; | ||
114 | |||
115 | #define DEFINE_CLK_DIVIDER(_name, _parent_name, _parent_ptr, \ | ||
116 | _flags, _reg, _shift, _width, \ | ||
117 | _divider_flags, _lock) \ | ||
118 | static struct clk _name; \ | ||
119 | static char *_name##_parent_names[] = { \ | ||
120 | _parent_name, \ | ||
121 | }; \ | ||
122 | static struct clk *_name##_parents[] = { \ | ||
123 | _parent_ptr, \ | ||
124 | }; \ | ||
125 | static struct clk_divider _name##_hw = { \ | ||
126 | .hw = { \ | ||
127 | .clk = &_name, \ | ||
128 | }, \ | ||
129 | .reg = _reg, \ | ||
130 | .shift = _shift, \ | ||
131 | .width = _width, \ | ||
132 | .flags = _divider_flags, \ | ||
133 | .lock = _lock, \ | ||
134 | }; \ | ||
135 | static struct clk _name = { \ | ||
136 | .name = #_name, \ | ||
137 | .ops = &clk_divider_ops, \ | ||
138 | .hw = &_name##_hw.hw, \ | ||
139 | .parent_names = _name##_parent_names, \ | ||
140 | .num_parents = \ | ||
141 | ARRAY_SIZE(_name##_parent_names), \ | ||
142 | .parents = _name##_parents, \ | ||
143 | .flags = _flags, \ | ||
144 | }; | ||
145 | |||
146 | extern struct clk_ops clk_mux_ops; | ||
147 | |||
148 | #define DEFINE_CLK_MUX(_name, _parent_names, _parents, _flags, \ | ||
149 | _reg, _shift, _width, \ | ||
150 | _mux_flags, _lock) \ | ||
151 | static struct clk _name; \ | ||
152 | static struct clk_mux _name##_hw = { \ | ||
153 | .hw = { \ | ||
154 | .clk = &_name, \ | ||
155 | }, \ | ||
156 | .reg = _reg, \ | ||
157 | .shift = _shift, \ | ||
158 | .width = _width, \ | ||
159 | .flags = _mux_flags, \ | ||
160 | .lock = _lock, \ | ||
161 | }; \ | ||
162 | static struct clk _name = { \ | ||
163 | .name = #_name, \ | ||
164 | .ops = &clk_mux_ops, \ | ||
165 | .hw = &_name##_hw.hw, \ | ||
166 | .parent_names = _parent_names, \ | ||
167 | .num_parents = \ | ||
168 | ARRAY_SIZE(_parent_names), \ | ||
169 | .parents = _parents, \ | ||
170 | .flags = _flags, \ | ||
171 | }; | ||
172 | |||
173 | /** | ||
174 | * __clk_init - initialize the data structures in a struct clk | ||
175 | * @dev: device initializing this clk, placeholder for now | ||
176 | * @clk: clk being initialized | ||
177 | * | ||
178 | * Initializes the lists in struct clk, queries the hardware for the | ||
179 | * parent and rate and sets them both. | ||
180 | * | ||
181 | * Any struct clk passed into __clk_init must have the following members | ||
182 | * populated: | ||
183 | * .name | ||
184 | * .ops | ||
185 | * .hw | ||
186 | * .parent_names | ||
187 | * .num_parents | ||
188 | * .flags | ||
189 | * | ||
190 | * It is not necessary to call clk_register if __clk_init is used directly with | ||
191 | * statically initialized clock data. | ||
192 | */ | ||
193 | void __clk_init(struct device *dev, struct clk *clk); | ||
194 | |||
195 | #endif /* CONFIG_COMMON_CLK */ | ||
196 | #endif /* CLK_PRIVATE_H */ | ||
diff --git a/include/linux/clk-provider.h b/include/linux/clk-provider.h new file mode 100644 index 000000000000..5508897ad376 --- /dev/null +++ b/include/linux/clk-provider.h | |||
@@ -0,0 +1,300 @@ | |||
1 | /* | ||
2 | * linux/include/linux/clk-provider.h | ||
3 | * | ||
4 | * Copyright (c) 2010-2011 Jeremy Kerr <jeremy.kerr@canonical.com> | ||
5 | * Copyright (C) 2011-2012 Linaro Ltd <mturquette@linaro.org> | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License version 2 as | ||
9 | * published by the Free Software Foundation. | ||
10 | */ | ||
11 | #ifndef __LINUX_CLK_PROVIDER_H | ||
12 | #define __LINUX_CLK_PROVIDER_H | ||
13 | |||
14 | #include <linux/clk.h> | ||
15 | |||
16 | #ifdef CONFIG_COMMON_CLK | ||
17 | |||
18 | /** | ||
19 | * struct clk_hw - handle for traversing from a struct clk to its corresponding | ||
20 | * hardware-specific structure. struct clk_hw should be declared within struct | ||
21 | * clk_foo and then referenced by the struct clk instance that uses struct | ||
22 | * clk_foo's clk_ops | ||
23 | * | ||
24 | * clk: pointer to the struct clk instance that points back to this struct | ||
25 | * clk_hw instance | ||
26 | */ | ||
27 | struct clk_hw { | ||
28 | struct clk *clk; | ||
29 | }; | ||
30 | |||
31 | /* | ||
32 | * flags used across common struct clk. these flags should only affect the | ||
33 | * top-level framework. custom flags for dealing with hardware specifics | ||
34 | * belong in struct clk_foo | ||
35 | */ | ||
36 | #define CLK_SET_RATE_GATE BIT(0) /* must be gated across rate change */ | ||
37 | #define CLK_SET_PARENT_GATE BIT(1) /* must be gated across re-parent */ | ||
38 | #define CLK_SET_RATE_PARENT BIT(2) /* propagate rate change up one level */ | ||
39 | #define CLK_IGNORE_UNUSED BIT(3) /* do not gate even if unused */ | ||
40 | #define CLK_IS_ROOT BIT(4) /* root clk, has no parent */ | ||
41 | |||
42 | /** | ||
43 | * struct clk_ops - Callback operations for hardware clocks; these are to | ||
44 | * be provided by the clock implementation, and will be called by drivers | ||
45 | * through the clk_* api. | ||
46 | * | ||
47 | * @prepare: Prepare the clock for enabling. This must not return until | ||
48 | * the clock is fully prepared, and it's safe to call clk_enable. | ||
49 | * This callback is intended to allow clock implementations to | ||
50 | * do any initialisation that may sleep. Called with | ||
51 | * prepare_lock held. | ||
52 | * | ||
53 | * @unprepare: Release the clock from its prepared state. This will typically | ||
54 | * undo any work done in the @prepare callback. Called with | ||
55 | * prepare_lock held. | ||
56 | * | ||
57 | * @enable: Enable the clock atomically. This must not return until the | ||
58 | * clock is generating a valid clock signal, usable by consumer | ||
59 | * devices. Called with enable_lock held. This function must not | ||
60 | * sleep. | ||
61 | * | ||
62 | * @disable: Disable the clock atomically. Called with enable_lock held. | ||
63 | * This function must not sleep. | ||
64 | * | ||
65 | * @recalc_rate Recalculate the rate of this clock, by quering hardware. The | ||
66 | * parent rate is an input parameter. It is up to the caller to | ||
67 | * insure that the prepare_mutex is held across this call. | ||
68 | * Returns the calculated rate. Optional, but recommended - if | ||
69 | * this op is not set then clock rate will be initialized to 0. | ||
70 | * | ||
71 | * @round_rate: Given a target rate as input, returns the closest rate actually | ||
72 | * supported by the clock. | ||
73 | * | ||
74 | * @get_parent: Queries the hardware to determine the parent of a clock. The | ||
75 | * return value is a u8 which specifies the index corresponding to | ||
76 | * the parent clock. This index can be applied to either the | ||
77 | * .parent_names or .parents arrays. In short, this function | ||
78 | * translates the parent value read from hardware into an array | ||
79 | * index. Currently only called when the clock is initialized by | ||
80 | * __clk_init. This callback is mandatory for clocks with | ||
81 | * multiple parents. It is optional (and unnecessary) for clocks | ||
82 | * with 0 or 1 parents. | ||
83 | * | ||
84 | * @set_parent: Change the input source of this clock; for clocks with multiple | ||
85 | * possible parents specify a new parent by passing in the index | ||
86 | * as a u8 corresponding to the parent in either the .parent_names | ||
87 | * or .parents arrays. This function in affect translates an | ||
88 | * array index into the value programmed into the hardware. | ||
89 | * Returns 0 on success, -EERROR otherwise. | ||
90 | * | ||
91 | * @set_rate: Change the rate of this clock. If this callback returns | ||
92 | * CLK_SET_RATE_PARENT, the rate change will be propagated to the | ||
93 | * parent clock (which may propagate again if the parent clock | ||
94 | * also sets this flag). The requested rate of the parent is | ||
95 | * passed back from the callback in the second 'unsigned long *' | ||
96 | * argument. Note that it is up to the hardware clock's set_rate | ||
97 | * implementation to insure that clocks do not run out of spec | ||
98 | * when propgating the call to set_rate up to the parent. One way | ||
99 | * to do this is to gate the clock (via clk_disable and/or | ||
100 | * clk_unprepare) before calling clk_set_rate, then ungating it | ||
101 | * afterward. If your clock also has the CLK_GATE_SET_RATE flag | ||
102 | * set then this will insure safety. Returns 0 on success, | ||
103 | * -EERROR otherwise. | ||
104 | * | ||
105 | * The clk_enable/clk_disable and clk_prepare/clk_unprepare pairs allow | ||
106 | * implementations to split any work between atomic (enable) and sleepable | ||
107 | * (prepare) contexts. If enabling a clock requires code that might sleep, | ||
108 | * this must be done in clk_prepare. Clock enable code that will never be | ||
109 | * called in a sleepable context may be implement in clk_enable. | ||
110 | * | ||
111 | * Typically, drivers will call clk_prepare when a clock may be needed later | ||
112 | * (eg. when a device is opened), and clk_enable when the clock is actually | ||
113 | * required (eg. from an interrupt). Note that clk_prepare MUST have been | ||
114 | * called before clk_enable. | ||
115 | */ | ||
116 | struct clk_ops { | ||
117 | int (*prepare)(struct clk_hw *hw); | ||
118 | void (*unprepare)(struct clk_hw *hw); | ||
119 | int (*enable)(struct clk_hw *hw); | ||
120 | void (*disable)(struct clk_hw *hw); | ||
121 | int (*is_enabled)(struct clk_hw *hw); | ||
122 | unsigned long (*recalc_rate)(struct clk_hw *hw, | ||
123 | unsigned long parent_rate); | ||
124 | long (*round_rate)(struct clk_hw *hw, unsigned long, | ||
125 | unsigned long *); | ||
126 | int (*set_parent)(struct clk_hw *hw, u8 index); | ||
127 | u8 (*get_parent)(struct clk_hw *hw); | ||
128 | int (*set_rate)(struct clk_hw *hw, unsigned long); | ||
129 | void (*init)(struct clk_hw *hw); | ||
130 | }; | ||
131 | |||
132 | /* | ||
133 | * DOC: Basic clock implementations common to many platforms | ||
134 | * | ||
135 | * Each basic clock hardware type is comprised of a structure describing the | ||
136 | * clock hardware, implementations of the relevant callbacks in struct clk_ops, | ||
137 | * unique flags for that hardware type, a registration function and an | ||
138 | * alternative macro for static initialization | ||
139 | */ | ||
140 | |||
141 | /** | ||
142 | * struct clk_fixed_rate - fixed-rate clock | ||
143 | * @hw: handle between common and hardware-specific interfaces | ||
144 | * @fixed_rate: constant frequency of clock | ||
145 | */ | ||
146 | struct clk_fixed_rate { | ||
147 | struct clk_hw hw; | ||
148 | unsigned long fixed_rate; | ||
149 | u8 flags; | ||
150 | }; | ||
151 | |||
152 | struct clk *clk_register_fixed_rate(struct device *dev, const char *name, | ||
153 | const char *parent_name, unsigned long flags, | ||
154 | unsigned long fixed_rate); | ||
155 | |||
156 | /** | ||
157 | * struct clk_gate - gating clock | ||
158 | * | ||
159 | * @hw: handle between common and hardware-specific interfaces | ||
160 | * @reg: register controlling gate | ||
161 | * @bit_idx: single bit controlling gate | ||
162 | * @flags: hardware-specific flags | ||
163 | * @lock: register lock | ||
164 | * | ||
165 | * Clock which can gate its output. Implements .enable & .disable | ||
166 | * | ||
167 | * Flags: | ||
168 | * CLK_GATE_SET_DISABLE - by default this clock sets the bit at bit_idx to | ||
169 | * enable the clock. Setting this flag does the opposite: setting the bit | ||
170 | * disable the clock and clearing it enables the clock | ||
171 | */ | ||
172 | struct clk_gate { | ||
173 | struct clk_hw hw; | ||
174 | void __iomem *reg; | ||
175 | u8 bit_idx; | ||
176 | u8 flags; | ||
177 | spinlock_t *lock; | ||
178 | char *parent[1]; | ||
179 | }; | ||
180 | |||
181 | #define CLK_GATE_SET_TO_DISABLE BIT(0) | ||
182 | |||
183 | struct clk *clk_register_gate(struct device *dev, const char *name, | ||
184 | const char *parent_name, unsigned long flags, | ||
185 | void __iomem *reg, u8 bit_idx, | ||
186 | u8 clk_gate_flags, spinlock_t *lock); | ||
187 | |||
188 | /** | ||
189 | * struct clk_divider - adjustable divider clock | ||
190 | * | ||
191 | * @hw: handle between common and hardware-specific interfaces | ||
192 | * @reg: register containing the divider | ||
193 | * @shift: shift to the divider bit field | ||
194 | * @width: width of the divider bit field | ||
195 | * @lock: register lock | ||
196 | * | ||
197 | * Clock with an adjustable divider affecting its output frequency. Implements | ||
198 | * .recalc_rate, .set_rate and .round_rate | ||
199 | * | ||
200 | * Flags: | ||
201 | * CLK_DIVIDER_ONE_BASED - by default the divisor is the value read from the | ||
202 | * register plus one. If CLK_DIVIDER_ONE_BASED is set then the divider is | ||
203 | * the raw value read from the register, with the value of zero considered | ||
204 | * invalid | ||
205 | * CLK_DIVIDER_POWER_OF_TWO - clock divisor is 2 raised to the value read from | ||
206 | * the hardware register | ||
207 | */ | ||
208 | struct clk_divider { | ||
209 | struct clk_hw hw; | ||
210 | void __iomem *reg; | ||
211 | u8 shift; | ||
212 | u8 width; | ||
213 | u8 flags; | ||
214 | spinlock_t *lock; | ||
215 | char *parent[1]; | ||
216 | }; | ||
217 | |||
218 | #define CLK_DIVIDER_ONE_BASED BIT(0) | ||
219 | #define CLK_DIVIDER_POWER_OF_TWO BIT(1) | ||
220 | |||
221 | struct clk *clk_register_divider(struct device *dev, const char *name, | ||
222 | const char *parent_name, unsigned long flags, | ||
223 | void __iomem *reg, u8 shift, u8 width, | ||
224 | u8 clk_divider_flags, spinlock_t *lock); | ||
225 | |||
226 | /** | ||
227 | * struct clk_mux - multiplexer clock | ||
228 | * | ||
229 | * @hw: handle between common and hardware-specific interfaces | ||
230 | * @reg: register controlling multiplexer | ||
231 | * @shift: shift to multiplexer bit field | ||
232 | * @width: width of mutliplexer bit field | ||
233 | * @num_clks: number of parent clocks | ||
234 | * @lock: register lock | ||
235 | * | ||
236 | * Clock with multiple selectable parents. Implements .get_parent, .set_parent | ||
237 | * and .recalc_rate | ||
238 | * | ||
239 | * Flags: | ||
240 | * CLK_MUX_INDEX_ONE - register index starts at 1, not 0 | ||
241 | * CLK_MUX_INDEX_BITWISE - register index is a single bit (power of two) | ||
242 | */ | ||
243 | struct clk_mux { | ||
244 | struct clk_hw hw; | ||
245 | void __iomem *reg; | ||
246 | u8 shift; | ||
247 | u8 width; | ||
248 | u8 flags; | ||
249 | spinlock_t *lock; | ||
250 | }; | ||
251 | |||
252 | #define CLK_MUX_INDEX_ONE BIT(0) | ||
253 | #define CLK_MUX_INDEX_BIT BIT(1) | ||
254 | |||
255 | struct clk *clk_register_mux(struct device *dev, const char *name, | ||
256 | char **parent_names, u8 num_parents, unsigned long flags, | ||
257 | void __iomem *reg, u8 shift, u8 width, | ||
258 | u8 clk_mux_flags, spinlock_t *lock); | ||
259 | |||
260 | /** | ||
261 | * clk_register - allocate a new clock, register it and return an opaque cookie | ||
262 | * @dev: device that is registering this clock | ||
263 | * @name: clock name | ||
264 | * @ops: operations this clock supports | ||
265 | * @hw: link to hardware-specific clock data | ||
266 | * @parent_names: array of string names for all possible parents | ||
267 | * @num_parents: number of possible parents | ||
268 | * @flags: framework-level hints and quirks | ||
269 | * | ||
270 | * clk_register is the primary interface for populating the clock tree with new | ||
271 | * clock nodes. It returns a pointer to the newly allocated struct clk which | ||
272 | * cannot be dereferenced by driver code but may be used in conjuction with the | ||
273 | * rest of the clock API. | ||
274 | */ | ||
275 | struct clk *clk_register(struct device *dev, const char *name, | ||
276 | const struct clk_ops *ops, struct clk_hw *hw, | ||
277 | char **parent_names, u8 num_parents, unsigned long flags); | ||
278 | |||
279 | /* helper functions */ | ||
280 | const char *__clk_get_name(struct clk *clk); | ||
281 | struct clk_hw *__clk_get_hw(struct clk *clk); | ||
282 | u8 __clk_get_num_parents(struct clk *clk); | ||
283 | struct clk *__clk_get_parent(struct clk *clk); | ||
284 | inline int __clk_get_enable_count(struct clk *clk); | ||
285 | inline int __clk_get_prepare_count(struct clk *clk); | ||
286 | unsigned long __clk_get_rate(struct clk *clk); | ||
287 | unsigned long __clk_get_flags(struct clk *clk); | ||
288 | int __clk_is_enabled(struct clk *clk); | ||
289 | struct clk *__clk_lookup(const char *name); | ||
290 | |||
291 | /* | ||
292 | * FIXME clock api without lock protection | ||
293 | */ | ||
294 | int __clk_prepare(struct clk *clk); | ||
295 | void __clk_unprepare(struct clk *clk); | ||
296 | void __clk_reparent(struct clk *clk, struct clk *new_parent); | ||
297 | unsigned long __clk_round_rate(struct clk *clk, unsigned long rate); | ||
298 | |||
299 | #endif /* CONFIG_COMMON_CLK */ | ||
300 | #endif /* CLK_PROVIDER_H */ | ||
diff --git a/include/linux/clk.h b/include/linux/clk.h index b9d46fa154b4..b0252726df61 100644 --- a/include/linux/clk.h +++ b/include/linux/clk.h | |||
@@ -3,6 +3,7 @@ | |||
3 | * | 3 | * |
4 | * Copyright (C) 2004 ARM Limited. | 4 | * Copyright (C) 2004 ARM Limited. |
5 | * Written by Deep Blue Solutions Limited. | 5 | * Written by Deep Blue Solutions Limited. |
6 | * Copyright (C) 2011-2012 Linaro Ltd <mturquette@linaro.org> | ||
6 | * | 7 | * |
7 | * This program is free software; you can redistribute it and/or modify | 8 | * This program is free software; you can redistribute it and/or modify |
8 | * it under the terms of the GNU General Public License version 2 as | 9 | * it under the terms of the GNU General Public License version 2 as |
@@ -12,18 +13,75 @@ | |||
12 | #define __LINUX_CLK_H | 13 | #define __LINUX_CLK_H |
13 | 14 | ||
14 | #include <linux/kernel.h> | 15 | #include <linux/kernel.h> |
16 | #include <linux/notifier.h> | ||
15 | 17 | ||
16 | struct device; | 18 | struct device; |
17 | 19 | ||
18 | /* | 20 | struct clk; |
19 | * The base API. | 21 | |
22 | #ifdef CONFIG_COMMON_CLK | ||
23 | |||
24 | /** | ||
25 | * DOC: clk notifier callback types | ||
26 | * | ||
27 | * PRE_RATE_CHANGE - called immediately before the clk rate is changed, | ||
28 | * to indicate that the rate change will proceed. Drivers must | ||
29 | * immediately terminate any operations that will be affected by the | ||
30 | * rate change. Callbacks may either return NOTIFY_DONE or | ||
31 | * NOTIFY_STOP. | ||
32 | * | ||
33 | * ABORT_RATE_CHANGE: called if the rate change failed for some reason | ||
34 | * after PRE_RATE_CHANGE. In this case, all registered notifiers on | ||
35 | * the clk will be called with ABORT_RATE_CHANGE. Callbacks must | ||
36 | * always return NOTIFY_DONE. | ||
37 | * | ||
38 | * POST_RATE_CHANGE - called after the clk rate change has successfully | ||
39 | * completed. Callbacks must always return NOTIFY_DONE. | ||
40 | * | ||
20 | */ | 41 | */ |
42 | #define PRE_RATE_CHANGE BIT(0) | ||
43 | #define POST_RATE_CHANGE BIT(1) | ||
44 | #define ABORT_RATE_CHANGE BIT(2) | ||
21 | 45 | ||
46 | /** | ||
47 | * struct clk_notifier - associate a clk with a notifier | ||
48 | * @clk: struct clk * to associate the notifier with | ||
49 | * @notifier_head: a blocking_notifier_head for this clk | ||
50 | * @node: linked list pointers | ||
51 | * | ||
52 | * A list of struct clk_notifier is maintained by the notifier code. | ||
53 | * An entry is created whenever code registers the first notifier on a | ||
54 | * particular @clk. Future notifiers on that @clk are added to the | ||
55 | * @notifier_head. | ||
56 | */ | ||
57 | struct clk_notifier { | ||
58 | struct clk *clk; | ||
59 | struct srcu_notifier_head notifier_head; | ||
60 | struct list_head node; | ||
61 | }; | ||
22 | 62 | ||
23 | /* | 63 | /** |
24 | * struct clk - an machine class defined object / cookie. | 64 | * struct clk_notifier_data - rate data to pass to the notifier callback |
65 | * @clk: struct clk * being changed | ||
66 | * @old_rate: previous rate of this clk | ||
67 | * @new_rate: new rate of this clk | ||
68 | * | ||
69 | * For a pre-notifier, old_rate is the clk's rate before this rate | ||
70 | * change, and new_rate is what the rate will be in the future. For a | ||
71 | * post-notifier, old_rate and new_rate are both set to the clk's | ||
72 | * current rate (this was done to optimize the implementation). | ||
25 | */ | 73 | */ |
26 | struct clk; | 74 | struct clk_notifier_data { |
75 | struct clk *clk; | ||
76 | unsigned long old_rate; | ||
77 | unsigned long new_rate; | ||
78 | }; | ||
79 | |||
80 | int clk_notifier_register(struct clk *clk, struct notifier_block *nb); | ||
81 | |||
82 | int clk_notifier_unregister(struct clk *clk, struct notifier_block *nb); | ||
83 | |||
84 | #endif /* !CONFIG_COMMON_CLK */ | ||
27 | 85 | ||
28 | /** | 86 | /** |
29 | * clk_get - lookup and obtain a reference to a clock producer. | 87 | * clk_get - lookup and obtain a reference to a clock producer. |
diff --git a/include/linux/clocksource.h b/include/linux/clocksource.h index 081147da0564..fbe89e17124e 100644 --- a/include/linux/clocksource.h +++ b/include/linux/clocksource.h | |||
@@ -319,13 +319,6 @@ static inline void __clocksource_updatefreq_khz(struct clocksource *cs, u32 khz) | |||
319 | __clocksource_updatefreq_scale(cs, 1000, khz); | 319 | __clocksource_updatefreq_scale(cs, 1000, khz); |
320 | } | 320 | } |
321 | 321 | ||
322 | static inline void | ||
323 | clocksource_calc_mult_shift(struct clocksource *cs, u32 freq, u32 minsec) | ||
324 | { | ||
325 | return clocks_calc_mult_shift(&cs->mult, &cs->shift, freq, | ||
326 | NSEC_PER_SEC, minsec); | ||
327 | } | ||
328 | |||
329 | #ifdef CONFIG_GENERIC_TIME_VSYSCALL | 322 | #ifdef CONFIG_GENERIC_TIME_VSYSCALL |
330 | extern void | 323 | extern void |
331 | update_vsyscall(struct timespec *ts, struct timespec *wtm, | 324 | update_vsyscall(struct timespec *ts, struct timespec *wtm, |
diff --git a/include/linux/cnt32_to_63.h b/include/linux/cnt32_to_63.h index e3d8bf26e5eb..aa629bce9033 100644 --- a/include/linux/cnt32_to_63.h +++ b/include/linux/cnt32_to_63.h | |||
@@ -16,7 +16,6 @@ | |||
16 | #include <linux/compiler.h> | 16 | #include <linux/compiler.h> |
17 | #include <linux/types.h> | 17 | #include <linux/types.h> |
18 | #include <asm/byteorder.h> | 18 | #include <asm/byteorder.h> |
19 | #include <asm/system.h> | ||
20 | 19 | ||
21 | /* this is used only to give gcc a clue about good code generation */ | 20 | /* this is used only to give gcc a clue about good code generation */ |
22 | union cnt32_to_63 { | 21 | union cnt32_to_63 { |
diff --git a/include/linux/compaction.h b/include/linux/compaction.h index bb2bbdbe5464..51a90b7f2d60 100644 --- a/include/linux/compaction.h +++ b/include/linux/compaction.h | |||
@@ -23,6 +23,7 @@ extern int fragmentation_index(struct zone *zone, unsigned int order); | |||
23 | extern unsigned long try_to_compact_pages(struct zonelist *zonelist, | 23 | extern unsigned long try_to_compact_pages(struct zonelist *zonelist, |
24 | int order, gfp_t gfp_mask, nodemask_t *mask, | 24 | int order, gfp_t gfp_mask, nodemask_t *mask, |
25 | bool sync); | 25 | bool sync); |
26 | extern int compact_pgdat(pg_data_t *pgdat, int order); | ||
26 | extern unsigned long compaction_suitable(struct zone *zone, int order); | 27 | extern unsigned long compaction_suitable(struct zone *zone, int order); |
27 | 28 | ||
28 | /* Do not skip compaction more than 64 times */ | 29 | /* Do not skip compaction more than 64 times */ |
@@ -33,20 +34,26 @@ extern unsigned long compaction_suitable(struct zone *zone, int order); | |||
33 | * allocation success. 1 << compact_defer_limit compactions are skipped up | 34 | * allocation success. 1 << compact_defer_limit compactions are skipped up |
34 | * to a limit of 1 << COMPACT_MAX_DEFER_SHIFT | 35 | * to a limit of 1 << COMPACT_MAX_DEFER_SHIFT |
35 | */ | 36 | */ |
36 | static inline void defer_compaction(struct zone *zone) | 37 | static inline void defer_compaction(struct zone *zone, int order) |
37 | { | 38 | { |
38 | zone->compact_considered = 0; | 39 | zone->compact_considered = 0; |
39 | zone->compact_defer_shift++; | 40 | zone->compact_defer_shift++; |
40 | 41 | ||
42 | if (order < zone->compact_order_failed) | ||
43 | zone->compact_order_failed = order; | ||
44 | |||
41 | if (zone->compact_defer_shift > COMPACT_MAX_DEFER_SHIFT) | 45 | if (zone->compact_defer_shift > COMPACT_MAX_DEFER_SHIFT) |
42 | zone->compact_defer_shift = COMPACT_MAX_DEFER_SHIFT; | 46 | zone->compact_defer_shift = COMPACT_MAX_DEFER_SHIFT; |
43 | } | 47 | } |
44 | 48 | ||
45 | /* Returns true if compaction should be skipped this time */ | 49 | /* Returns true if compaction should be skipped this time */ |
46 | static inline bool compaction_deferred(struct zone *zone) | 50 | static inline bool compaction_deferred(struct zone *zone, int order) |
47 | { | 51 | { |
48 | unsigned long defer_limit = 1UL << zone->compact_defer_shift; | 52 | unsigned long defer_limit = 1UL << zone->compact_defer_shift; |
49 | 53 | ||
54 | if (order < zone->compact_order_failed) | ||
55 | return false; | ||
56 | |||
50 | /* Avoid possible overflow */ | 57 | /* Avoid possible overflow */ |
51 | if (++zone->compact_considered > defer_limit) | 58 | if (++zone->compact_considered > defer_limit) |
52 | zone->compact_considered = defer_limit; | 59 | zone->compact_considered = defer_limit; |
@@ -62,16 +69,21 @@ static inline unsigned long try_to_compact_pages(struct zonelist *zonelist, | |||
62 | return COMPACT_CONTINUE; | 69 | return COMPACT_CONTINUE; |
63 | } | 70 | } |
64 | 71 | ||
72 | static inline int compact_pgdat(pg_data_t *pgdat, int order) | ||
73 | { | ||
74 | return COMPACT_CONTINUE; | ||
75 | } | ||
76 | |||
65 | static inline unsigned long compaction_suitable(struct zone *zone, int order) | 77 | static inline unsigned long compaction_suitable(struct zone *zone, int order) |
66 | { | 78 | { |
67 | return COMPACT_SKIPPED; | 79 | return COMPACT_SKIPPED; |
68 | } | 80 | } |
69 | 81 | ||
70 | static inline void defer_compaction(struct zone *zone) | 82 | static inline void defer_compaction(struct zone *zone, int order) |
71 | { | 83 | { |
72 | } | 84 | } |
73 | 85 | ||
74 | static inline bool compaction_deferred(struct zone *zone) | 86 | static inline bool compaction_deferred(struct zone *zone, int order) |
75 | { | 87 | { |
76 | return 1; | 88 | return 1; |
77 | } | 89 | } |
diff --git a/include/linux/compat.h b/include/linux/compat.h index 7e05fcee75a1..5d46217f84ad 100644 --- a/include/linux/compat.h +++ b/include/linux/compat.h | |||
@@ -19,6 +19,10 @@ | |||
19 | #include <asm/siginfo.h> | 19 | #include <asm/siginfo.h> |
20 | #include <asm/signal.h> | 20 | #include <asm/signal.h> |
21 | 21 | ||
22 | #ifndef COMPAT_USE_64BIT_TIME | ||
23 | #define COMPAT_USE_64BIT_TIME 0 | ||
24 | #endif | ||
25 | |||
22 | #define compat_jiffies_to_clock_t(x) \ | 26 | #define compat_jiffies_to_clock_t(x) \ |
23 | (((unsigned long)(x) * COMPAT_USER_HZ) / HZ) | 27 | (((unsigned long)(x) * COMPAT_USER_HZ) / HZ) |
24 | 28 | ||
@@ -83,10 +87,26 @@ typedef struct { | |||
83 | compat_sigset_word sig[_COMPAT_NSIG_WORDS]; | 87 | compat_sigset_word sig[_COMPAT_NSIG_WORDS]; |
84 | } compat_sigset_t; | 88 | } compat_sigset_t; |
85 | 89 | ||
90 | /* | ||
91 | * These functions operate strictly on struct compat_time* | ||
92 | */ | ||
86 | extern int get_compat_timespec(struct timespec *, | 93 | extern int get_compat_timespec(struct timespec *, |
87 | const struct compat_timespec __user *); | 94 | const struct compat_timespec __user *); |
88 | extern int put_compat_timespec(const struct timespec *, | 95 | extern int put_compat_timespec(const struct timespec *, |
89 | struct compat_timespec __user *); | 96 | struct compat_timespec __user *); |
97 | extern int get_compat_timeval(struct timeval *, | ||
98 | const struct compat_timeval __user *); | ||
99 | extern int put_compat_timeval(const struct timeval *, | ||
100 | struct compat_timeval __user *); | ||
101 | /* | ||
102 | * These functions operate on 32- or 64-bit specs depending on | ||
103 | * COMPAT_USE_64BIT_TIME, hence the void user pointer arguments and the | ||
104 | * naming as compat_get/put_ rather than get/put_compat_. | ||
105 | */ | ||
106 | extern int compat_get_timespec(struct timespec *, const void __user *); | ||
107 | extern int compat_put_timespec(const struct timespec *, void __user *); | ||
108 | extern int compat_get_timeval(struct timeval *, const void __user *); | ||
109 | extern int compat_put_timeval(const struct timeval *, void __user *); | ||
90 | 110 | ||
91 | struct compat_iovec { | 111 | struct compat_iovec { |
92 | compat_uptr_t iov_base; | 112 | compat_uptr_t iov_base; |
@@ -224,6 +244,7 @@ struct compat_sysinfo; | |||
224 | struct compat_sysctl_args; | 244 | struct compat_sysctl_args; |
225 | struct compat_kexec_segment; | 245 | struct compat_kexec_segment; |
226 | struct compat_mq_attr; | 246 | struct compat_mq_attr; |
247 | struct compat_msgbuf; | ||
227 | 248 | ||
228 | extern void compat_exit_robust_list(struct task_struct *curr); | 249 | extern void compat_exit_robust_list(struct task_struct *curr); |
229 | 250 | ||
@@ -234,13 +255,22 @@ asmlinkage long | |||
234 | compat_sys_get_robust_list(int pid, compat_uptr_t __user *head_ptr, | 255 | compat_sys_get_robust_list(int pid, compat_uptr_t __user *head_ptr, |
235 | compat_size_t __user *len_ptr); | 256 | compat_size_t __user *len_ptr); |
236 | 257 | ||
258 | #ifdef CONFIG_ARCH_WANT_OLD_COMPAT_IPC | ||
237 | long compat_sys_semctl(int first, int second, int third, void __user *uptr); | 259 | long compat_sys_semctl(int first, int second, int third, void __user *uptr); |
238 | long compat_sys_msgsnd(int first, int second, int third, void __user *uptr); | 260 | long compat_sys_msgsnd(int first, int second, int third, void __user *uptr); |
239 | long compat_sys_msgrcv(int first, int second, int msgtyp, int third, | 261 | long compat_sys_msgrcv(int first, int second, int msgtyp, int third, |
240 | int version, void __user *uptr); | 262 | int version, void __user *uptr); |
241 | long compat_sys_msgctl(int first, int second, void __user *uptr); | ||
242 | long compat_sys_shmat(int first, int second, compat_uptr_t third, int version, | 263 | long compat_sys_shmat(int first, int second, compat_uptr_t third, int version, |
243 | void __user *uptr); | 264 | void __user *uptr); |
265 | #else | ||
266 | long compat_sys_semctl(int semid, int semnum, int cmd, int arg); | ||
267 | long compat_sys_msgsnd(int msqid, struct compat_msgbuf __user *msgp, | ||
268 | size_t msgsz, int msgflg); | ||
269 | long compat_sys_msgrcv(int msqid, struct compat_msgbuf __user *msgp, | ||
270 | size_t msgsz, long msgtyp, int msgflg); | ||
271 | long compat_sys_shmat(int shmid, compat_uptr_t shmaddr, int shmflg); | ||
272 | #endif | ||
273 | long compat_sys_msgctl(int first, int second, void __user *uptr); | ||
244 | long compat_sys_shmctl(int first, int second, void __user *uptr); | 274 | long compat_sys_shmctl(int first, int second, void __user *uptr); |
245 | long compat_sys_semtimedop(int semid, struct sembuf __user *tsems, | 275 | long compat_sys_semtimedop(int semid, struct sembuf __user *tsems, |
246 | unsigned nsems, const struct compat_timespec __user *timeout); | 276 | unsigned nsems, const struct compat_timespec __user *timeout); |
diff --git a/include/linux/compiler-gcc.h b/include/linux/compiler-gcc.h index 3fd17c249221..e5834aa24b9e 100644 --- a/include/linux/compiler-gcc.h +++ b/include/linux/compiler-gcc.h | |||
@@ -87,7 +87,8 @@ | |||
87 | */ | 87 | */ |
88 | #define __pure __attribute__((pure)) | 88 | #define __pure __attribute__((pure)) |
89 | #define __aligned(x) __attribute__((aligned(x))) | 89 | #define __aligned(x) __attribute__((aligned(x))) |
90 | #define __printf(a,b) __attribute__((format(printf,a,b))) | 90 | #define __printf(a, b) __attribute__((format(printf, a, b))) |
91 | #define __scanf(a, b) __attribute__((format(scanf, a, b))) | ||
91 | #define noinline __attribute__((noinline)) | 92 | #define noinline __attribute__((noinline)) |
92 | #define __attribute_const__ __attribute__((__const__)) | 93 | #define __attribute_const__ __attribute__((__const__)) |
93 | #define __maybe_unused __attribute__((unused)) | 94 | #define __maybe_unused __attribute__((unused)) |
diff --git a/include/linux/compiler.h b/include/linux/compiler.h index 4a243546d142..923d093c9cea 100644 --- a/include/linux/compiler.h +++ b/include/linux/compiler.h | |||
@@ -236,7 +236,7 @@ void ftrace_likely_update(struct ftrace_branch_data *f, int val, int expect); | |||
236 | 236 | ||
237 | /* | 237 | /* |
238 | * Rather then using noinline to prevent stack consumption, use | 238 | * Rather then using noinline to prevent stack consumption, use |
239 | * noinline_for_stack instead. For documentaiton reasons. | 239 | * noinline_for_stack instead. For documentation reasons. |
240 | */ | 240 | */ |
241 | #define noinline_for_stack noinline | 241 | #define noinline_for_stack noinline |
242 | 242 | ||
diff --git a/include/linux/connector.h b/include/linux/connector.h index 3c9c54fd5690..76384074262d 100644 --- a/include/linux/connector.h +++ b/include/linux/connector.h | |||
@@ -43,6 +43,7 @@ | |||
43 | #define CN_IDX_DRBD 0x8 | 43 | #define CN_IDX_DRBD 0x8 |
44 | #define CN_VAL_DRBD 0x1 | 44 | #define CN_VAL_DRBD 0x1 |
45 | #define CN_KVP_IDX 0x9 /* HyperV KVP */ | 45 | #define CN_KVP_IDX 0x9 /* HyperV KVP */ |
46 | #define CN_KVP_VAL 0x1 /* queries from the kernel */ | ||
46 | 47 | ||
47 | #define CN_NETLINK_USERS 10 /* Highest index + 1 */ | 48 | #define CN_NETLINK_USERS 10 /* Highest index + 1 */ |
48 | 49 | ||
diff --git a/include/linux/cpu.h b/include/linux/cpu.h index 1f6587590a1a..ee28844ae68e 100644 --- a/include/linux/cpu.h +++ b/include/linux/cpu.h | |||
@@ -14,11 +14,12 @@ | |||
14 | #ifndef _LINUX_CPU_H_ | 14 | #ifndef _LINUX_CPU_H_ |
15 | #define _LINUX_CPU_H_ | 15 | #define _LINUX_CPU_H_ |
16 | 16 | ||
17 | #include <linux/device.h> | ||
18 | #include <linux/node.h> | 17 | #include <linux/node.h> |
19 | #include <linux/compiler.h> | 18 | #include <linux/compiler.h> |
20 | #include <linux/cpumask.h> | 19 | #include <linux/cpumask.h> |
21 | 20 | ||
21 | struct device; | ||
22 | |||
22 | struct cpu { | 23 | struct cpu { |
23 | int node_id; /* The node which contains the CPU */ | 24 | int node_id; /* The node which contains the CPU */ |
24 | int hotpluggable; /* creates sysfs control file if hotpluggable */ | 25 | int hotpluggable; /* creates sysfs control file if hotpluggable */ |
@@ -44,6 +45,13 @@ extern ssize_t arch_cpu_release(const char *, size_t); | |||
44 | #endif | 45 | #endif |
45 | struct notifier_block; | 46 | struct notifier_block; |
46 | 47 | ||
48 | #ifdef CONFIG_ARCH_HAS_CPU_AUTOPROBE | ||
49 | extern int arch_cpu_uevent(struct device *dev, struct kobj_uevent_env *env); | ||
50 | extern ssize_t arch_print_cpu_modalias(struct device *dev, | ||
51 | struct device_attribute *attr, | ||
52 | char *bufptr); | ||
53 | #endif | ||
54 | |||
47 | /* | 55 | /* |
48 | * CPU notifier priorities. | 56 | * CPU notifier priorities. |
49 | */ | 57 | */ |
diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h index 6216115c7789..b60f6ba01d0c 100644 --- a/include/linux/cpufreq.h +++ b/include/linux/cpufreq.h | |||
@@ -14,7 +14,6 @@ | |||
14 | #include <linux/mutex.h> | 14 | #include <linux/mutex.h> |
15 | #include <linux/notifier.h> | 15 | #include <linux/notifier.h> |
16 | #include <linux/threads.h> | 16 | #include <linux/threads.h> |
17 | #include <linux/device.h> | ||
18 | #include <linux/kobject.h> | 17 | #include <linux/kobject.h> |
19 | #include <linux/sysfs.h> | 18 | #include <linux/sysfs.h> |
20 | #include <linux/completion.h> | 19 | #include <linux/completion.h> |
@@ -35,6 +34,7 @@ | |||
35 | #ifdef CONFIG_CPU_FREQ | 34 | #ifdef CONFIG_CPU_FREQ |
36 | int cpufreq_register_notifier(struct notifier_block *nb, unsigned int list); | 35 | int cpufreq_register_notifier(struct notifier_block *nb, unsigned int list); |
37 | int cpufreq_unregister_notifier(struct notifier_block *nb, unsigned int list); | 36 | int cpufreq_unregister_notifier(struct notifier_block *nb, unsigned int list); |
37 | extern void disable_cpufreq(void); | ||
38 | #else /* CONFIG_CPU_FREQ */ | 38 | #else /* CONFIG_CPU_FREQ */ |
39 | static inline int cpufreq_register_notifier(struct notifier_block *nb, | 39 | static inline int cpufreq_register_notifier(struct notifier_block *nb, |
40 | unsigned int list) | 40 | unsigned int list) |
@@ -46,6 +46,7 @@ static inline int cpufreq_unregister_notifier(struct notifier_block *nb, | |||
46 | { | 46 | { |
47 | return 0; | 47 | return 0; |
48 | } | 48 | } |
49 | static inline void disable_cpufreq(void) { } | ||
49 | #endif /* CONFIG_CPU_FREQ */ | 50 | #endif /* CONFIG_CPU_FREQ */ |
50 | 51 | ||
51 | /* if (cpufreq_driver->target) exists, the ->governor decides what frequency | 52 | /* if (cpufreq_driver->target) exists, the ->governor decides what frequency |
diff --git a/include/linux/cpuidle.h b/include/linux/cpuidle.h index 712abcc205ae..6c26a3da0e03 100644 --- a/include/linux/cpuidle.h +++ b/include/linux/cpuidle.h | |||
@@ -15,6 +15,7 @@ | |||
15 | #include <linux/list.h> | 15 | #include <linux/list.h> |
16 | #include <linux/kobject.h> | 16 | #include <linux/kobject.h> |
17 | #include <linux/completion.h> | 17 | #include <linux/completion.h> |
18 | #include <linux/hrtimer.h> | ||
18 | 19 | ||
19 | #define CPUIDLE_STATE_MAX 8 | 20 | #define CPUIDLE_STATE_MAX 8 |
20 | #define CPUIDLE_NAME_LEN 16 | 21 | #define CPUIDLE_NAME_LEN 16 |
@@ -43,12 +44,15 @@ struct cpuidle_state { | |||
43 | 44 | ||
44 | unsigned int flags; | 45 | unsigned int flags; |
45 | unsigned int exit_latency; /* in US */ | 46 | unsigned int exit_latency; /* in US */ |
46 | unsigned int power_usage; /* in mW */ | 47 | int power_usage; /* in mW */ |
47 | unsigned int target_residency; /* in US */ | 48 | unsigned int target_residency; /* in US */ |
49 | unsigned int disable; | ||
48 | 50 | ||
49 | int (*enter) (struct cpuidle_device *dev, | 51 | int (*enter) (struct cpuidle_device *dev, |
50 | struct cpuidle_driver *drv, | 52 | struct cpuidle_driver *drv, |
51 | int index); | 53 | int index); |
54 | |||
55 | int (*enter_dead) (struct cpuidle_device *dev, int index); | ||
52 | }; | 56 | }; |
53 | 57 | ||
54 | /* Idle State Flags */ | 58 | /* Idle State Flags */ |
@@ -96,7 +100,6 @@ struct cpuidle_device { | |||
96 | struct list_head device_list; | 100 | struct list_head device_list; |
97 | struct kobject kobj; | 101 | struct kobject kobj; |
98 | struct completion kobj_unregister; | 102 | struct completion kobj_unregister; |
99 | void *governor_data; | ||
100 | }; | 103 | }; |
101 | 104 | ||
102 | DECLARE_PER_CPU(struct cpuidle_device *, cpuidle_devices); | 105 | DECLARE_PER_CPU(struct cpuidle_device *, cpuidle_devices); |
@@ -118,10 +121,12 @@ static inline int cpuidle_get_last_residency(struct cpuidle_device *dev) | |||
118 | ****************************/ | 121 | ****************************/ |
119 | 122 | ||
120 | struct cpuidle_driver { | 123 | struct cpuidle_driver { |
121 | char name[CPUIDLE_NAME_LEN]; | 124 | const char *name; |
122 | struct module *owner; | 125 | struct module *owner; |
123 | 126 | ||
124 | unsigned int power_specified:1; | 127 | unsigned int power_specified:1; |
128 | /* set to 1 to use the core cpuidle time keeping (for all states). */ | ||
129 | unsigned int en_core_tk_irqen:1; | ||
125 | struct cpuidle_state states[CPUIDLE_STATE_MAX]; | 130 | struct cpuidle_state states[CPUIDLE_STATE_MAX]; |
126 | int state_count; | 131 | int state_count; |
127 | int safe_state_index; | 132 | int safe_state_index; |
@@ -140,6 +145,11 @@ extern void cpuidle_pause_and_lock(void); | |||
140 | extern void cpuidle_resume_and_unlock(void); | 145 | extern void cpuidle_resume_and_unlock(void); |
141 | extern int cpuidle_enable_device(struct cpuidle_device *dev); | 146 | extern int cpuidle_enable_device(struct cpuidle_device *dev); |
142 | extern void cpuidle_disable_device(struct cpuidle_device *dev); | 147 | extern void cpuidle_disable_device(struct cpuidle_device *dev); |
148 | extern int cpuidle_wrap_enter(struct cpuidle_device *dev, | ||
149 | struct cpuidle_driver *drv, int index, | ||
150 | int (*enter)(struct cpuidle_device *dev, | ||
151 | struct cpuidle_driver *drv, int index)); | ||
152 | extern int cpuidle_play_dead(void); | ||
143 | 153 | ||
144 | #else | 154 | #else |
145 | static inline void disable_cpuidle(void) { } | 155 | static inline void disable_cpuidle(void) { } |
@@ -157,6 +167,12 @@ static inline void cpuidle_resume_and_unlock(void) { } | |||
157 | static inline int cpuidle_enable_device(struct cpuidle_device *dev) | 167 | static inline int cpuidle_enable_device(struct cpuidle_device *dev) |
158 | {return -ENODEV; } | 168 | {return -ENODEV; } |
159 | static inline void cpuidle_disable_device(struct cpuidle_device *dev) { } | 169 | static inline void cpuidle_disable_device(struct cpuidle_device *dev) { } |
170 | static inline int cpuidle_wrap_enter(struct cpuidle_device *dev, | ||
171 | struct cpuidle_driver *drv, int index, | ||
172 | int (*enter)(struct cpuidle_device *dev, | ||
173 | struct cpuidle_driver *drv, int index)) | ||
174 | { return -ENODEV; } | ||
175 | static inline int cpuidle_play_dead(void) {return -ENODEV; } | ||
160 | 176 | ||
161 | #endif | 177 | #endif |
162 | 178 | ||
diff --git a/include/linux/cpumask.h b/include/linux/cpumask.h index 4f7a63237471..a2c819d3c96e 100644 --- a/include/linux/cpumask.h +++ b/include/linux/cpumask.h | |||
@@ -9,6 +9,7 @@ | |||
9 | #include <linux/kernel.h> | 9 | #include <linux/kernel.h> |
10 | #include <linux/threads.h> | 10 | #include <linux/threads.h> |
11 | #include <linux/bitmap.h> | 11 | #include <linux/bitmap.h> |
12 | #include <linux/bug.h> | ||
12 | 13 | ||
13 | typedef struct cpumask { DECLARE_BITMAP(bits, NR_CPUS); } cpumask_t; | 14 | typedef struct cpumask { DECLARE_BITMAP(bits, NR_CPUS); } cpumask_t; |
14 | 15 | ||
@@ -763,12 +764,6 @@ static inline const struct cpumask *get_cpu_mask(unsigned int cpu) | |||
763 | * | 764 | * |
764 | */ | 765 | */ |
765 | #ifndef CONFIG_DISABLE_OBSOLETE_CPUMASK_FUNCTIONS | 766 | #ifndef CONFIG_DISABLE_OBSOLETE_CPUMASK_FUNCTIONS |
766 | /* These strip const, as traditionally they weren't const. */ | ||
767 | #define cpu_possible_map (*(cpumask_t *)cpu_possible_mask) | ||
768 | #define cpu_online_map (*(cpumask_t *)cpu_online_mask) | ||
769 | #define cpu_present_map (*(cpumask_t *)cpu_present_mask) | ||
770 | #define cpu_active_map (*(cpumask_t *)cpu_active_mask) | ||
771 | |||
772 | #define cpumask_of_cpu(cpu) (*get_cpu_mask(cpu)) | 767 | #define cpumask_of_cpu(cpu) (*get_cpu_mask(cpu)) |
773 | 768 | ||
774 | #define CPU_MASK_LAST_WORD BITMAP_LAST_WORD_MASK(NR_CPUS) | 769 | #define CPU_MASK_LAST_WORD BITMAP_LAST_WORD_MASK(NR_CPUS) |
@@ -809,11 +804,10 @@ static inline const struct cpumask *get_cpu_mask(unsigned int cpu) | |||
809 | #else /* NR_CPUS > 1 */ | 804 | #else /* NR_CPUS > 1 */ |
810 | int __first_cpu(const cpumask_t *srcp); | 805 | int __first_cpu(const cpumask_t *srcp); |
811 | int __next_cpu(int n, const cpumask_t *srcp); | 806 | int __next_cpu(int n, const cpumask_t *srcp); |
812 | int __any_online_cpu(const cpumask_t *mask); | ||
813 | 807 | ||
814 | #define first_cpu(src) __first_cpu(&(src)) | 808 | #define first_cpu(src) __first_cpu(&(src)) |
815 | #define next_cpu(n, src) __next_cpu((n), &(src)) | 809 | #define next_cpu(n, src) __next_cpu((n), &(src)) |
816 | #define any_online_cpu(mask) __any_online_cpu(&(mask)) | 810 | #define any_online_cpu(mask) cpumask_any_and(&mask, cpu_online_mask) |
817 | #define for_each_cpu_mask(cpu, mask) \ | 811 | #define for_each_cpu_mask(cpu, mask) \ |
818 | for ((cpu) = -1; \ | 812 | for ((cpu) = -1; \ |
819 | (cpu) = next_cpu((cpu), (mask)), \ | 813 | (cpu) = next_cpu((cpu), (mask)), \ |
diff --git a/include/linux/cpuset.h b/include/linux/cpuset.h index e9eaec522655..668f66baac7b 100644 --- a/include/linux/cpuset.h +++ b/include/linux/cpuset.h | |||
@@ -22,7 +22,7 @@ extern int cpuset_init(void); | |||
22 | extern void cpuset_init_smp(void); | 22 | extern void cpuset_init_smp(void); |
23 | extern void cpuset_update_active_cpus(void); | 23 | extern void cpuset_update_active_cpus(void); |
24 | extern void cpuset_cpus_allowed(struct task_struct *p, struct cpumask *mask); | 24 | extern void cpuset_cpus_allowed(struct task_struct *p, struct cpumask *mask); |
25 | extern int cpuset_cpus_allowed_fallback(struct task_struct *p); | 25 | extern void cpuset_cpus_allowed_fallback(struct task_struct *p); |
26 | extern nodemask_t cpuset_mems_allowed(struct task_struct *p); | 26 | extern nodemask_t cpuset_mems_allowed(struct task_struct *p); |
27 | #define cpuset_current_mems_allowed (current->mems_allowed) | 27 | #define cpuset_current_mems_allowed (current->mems_allowed) |
28 | void cpuset_init_current_mems_allowed(void); | 28 | void cpuset_init_current_mems_allowed(void); |
@@ -89,42 +89,33 @@ extern void rebuild_sched_domains(void); | |||
89 | extern void cpuset_print_task_mems_allowed(struct task_struct *p); | 89 | extern void cpuset_print_task_mems_allowed(struct task_struct *p); |
90 | 90 | ||
91 | /* | 91 | /* |
92 | * reading current mems_allowed and mempolicy in the fastpath must protected | 92 | * get_mems_allowed is required when making decisions involving mems_allowed |
93 | * by get_mems_allowed() | 93 | * such as during page allocation. mems_allowed can be updated in parallel |
94 | * and depending on the new value an operation can fail potentially causing | ||
95 | * process failure. A retry loop with get_mems_allowed and put_mems_allowed | ||
96 | * prevents these artificial failures. | ||
94 | */ | 97 | */ |
95 | static inline void get_mems_allowed(void) | 98 | static inline unsigned int get_mems_allowed(void) |
96 | { | 99 | { |
97 | current->mems_allowed_change_disable++; | 100 | return read_seqcount_begin(¤t->mems_allowed_seq); |
98 | |||
99 | /* | ||
100 | * ensure that reading mems_allowed and mempolicy happens after the | ||
101 | * update of ->mems_allowed_change_disable. | ||
102 | * | ||
103 | * the write-side task finds ->mems_allowed_change_disable is not 0, | ||
104 | * and knows the read-side task is reading mems_allowed or mempolicy, | ||
105 | * so it will clear old bits lazily. | ||
106 | */ | ||
107 | smp_mb(); | ||
108 | } | 101 | } |
109 | 102 | ||
110 | static inline void put_mems_allowed(void) | 103 | /* |
104 | * If this returns false, the operation that took place after get_mems_allowed | ||
105 | * may have failed. It is up to the caller to retry the operation if | ||
106 | * appropriate. | ||
107 | */ | ||
108 | static inline bool put_mems_allowed(unsigned int seq) | ||
111 | { | 109 | { |
112 | /* | 110 | return !read_seqcount_retry(¤t->mems_allowed_seq, seq); |
113 | * ensure that reading mems_allowed and mempolicy before reducing | ||
114 | * mems_allowed_change_disable. | ||
115 | * | ||
116 | * the write-side task will know that the read-side task is still | ||
117 | * reading mems_allowed or mempolicy, don't clears old bits in the | ||
118 | * nodemask. | ||
119 | */ | ||
120 | smp_mb(); | ||
121 | --ACCESS_ONCE(current->mems_allowed_change_disable); | ||
122 | } | 111 | } |
123 | 112 | ||
124 | static inline void set_mems_allowed(nodemask_t nodemask) | 113 | static inline void set_mems_allowed(nodemask_t nodemask) |
125 | { | 114 | { |
126 | task_lock(current); | 115 | task_lock(current); |
116 | write_seqcount_begin(¤t->mems_allowed_seq); | ||
127 | current->mems_allowed = nodemask; | 117 | current->mems_allowed = nodemask; |
118 | write_seqcount_end(¤t->mems_allowed_seq); | ||
128 | task_unlock(current); | 119 | task_unlock(current); |
129 | } | 120 | } |
130 | 121 | ||
@@ -144,10 +135,8 @@ static inline void cpuset_cpus_allowed(struct task_struct *p, | |||
144 | cpumask_copy(mask, cpu_possible_mask); | 135 | cpumask_copy(mask, cpu_possible_mask); |
145 | } | 136 | } |
146 | 137 | ||
147 | static inline int cpuset_cpus_allowed_fallback(struct task_struct *p) | 138 | static inline void cpuset_cpus_allowed_fallback(struct task_struct *p) |
148 | { | 139 | { |
149 | do_set_cpus_allowed(p, cpu_possible_mask); | ||
150 | return cpumask_any(cpu_active_mask); | ||
151 | } | 140 | } |
152 | 141 | ||
153 | static inline nodemask_t cpuset_mems_allowed(struct task_struct *p) | 142 | static inline nodemask_t cpuset_mems_allowed(struct task_struct *p) |
@@ -234,12 +223,14 @@ static inline void set_mems_allowed(nodemask_t nodemask) | |||
234 | { | 223 | { |
235 | } | 224 | } |
236 | 225 | ||
237 | static inline void get_mems_allowed(void) | 226 | static inline unsigned int get_mems_allowed(void) |
238 | { | 227 | { |
228 | return 0; | ||
239 | } | 229 | } |
240 | 230 | ||
241 | static inline void put_mems_allowed(void) | 231 | static inline bool put_mems_allowed(unsigned int seq) |
242 | { | 232 | { |
233 | return true; | ||
243 | } | 234 | } |
244 | 235 | ||
245 | #endif /* !CONFIG_CPUSETS */ | 236 | #endif /* !CONFIG_CPUSETS */ |
diff --git a/include/linux/crash_dump.h b/include/linux/crash_dump.h index b936763f2236..37e4f8da7cdf 100644 --- a/include/linux/crash_dump.h +++ b/include/linux/crash_dump.h | |||
@@ -3,7 +3,6 @@ | |||
3 | 3 | ||
4 | #ifdef CONFIG_CRASH_DUMP | 4 | #ifdef CONFIG_CRASH_DUMP |
5 | #include <linux/kexec.h> | 5 | #include <linux/kexec.h> |
6 | #include <linux/device.h> | ||
7 | #include <linux/proc_fs.h> | 6 | #include <linux/proc_fs.h> |
8 | #include <linux/elf.h> | 7 | #include <linux/elf.h> |
9 | 8 | ||
diff --git a/include/linux/crc32.h b/include/linux/crc32.h index 391a259b2cc9..68267b64bb98 100644 --- a/include/linux/crc32.h +++ b/include/linux/crc32.h | |||
@@ -11,6 +11,8 @@ | |||
11 | extern u32 crc32_le(u32 crc, unsigned char const *p, size_t len); | 11 | extern u32 crc32_le(u32 crc, unsigned char const *p, size_t len); |
12 | extern u32 crc32_be(u32 crc, unsigned char const *p, size_t len); | 12 | extern u32 crc32_be(u32 crc, unsigned char const *p, size_t len); |
13 | 13 | ||
14 | extern u32 __crc32c_le(u32 crc, unsigned char const *p, size_t len); | ||
15 | |||
14 | #define crc32(seed, data, length) crc32_le(seed, (unsigned char const *)(data), length) | 16 | #define crc32(seed, data, length) crc32_le(seed, (unsigned char const *)(data), length) |
15 | 17 | ||
16 | /* | 18 | /* |
diff --git a/include/linux/crypto.h b/include/linux/crypto.h index 8a94217b298e..b92eadf92d72 100644 --- a/include/linux/crypto.h +++ b/include/linux/crypto.h | |||
@@ -20,6 +20,7 @@ | |||
20 | #include <linux/atomic.h> | 20 | #include <linux/atomic.h> |
21 | #include <linux/kernel.h> | 21 | #include <linux/kernel.h> |
22 | #include <linux/list.h> | 22 | #include <linux/list.h> |
23 | #include <linux/bug.h> | ||
23 | #include <linux/slab.h> | 24 | #include <linux/slab.h> |
24 | #include <linux/string.h> | 25 | #include <linux/string.h> |
25 | #include <linux/uaccess.h> | 26 | #include <linux/uaccess.h> |
@@ -75,6 +76,11 @@ | |||
75 | */ | 76 | */ |
76 | #define CRYPTO_ALG_INSTANCE 0x00000800 | 77 | #define CRYPTO_ALG_INSTANCE 0x00000800 |
77 | 78 | ||
79 | /* Set this bit if the algorithm provided is hardware accelerated but | ||
80 | * not available to userspace via instruction set or so. | ||
81 | */ | ||
82 | #define CRYPTO_ALG_KERN_DRIVER_ONLY 0x00001000 | ||
83 | |||
78 | /* | 84 | /* |
79 | * Transform masks and values (for crt_flags). | 85 | * Transform masks and values (for crt_flags). |
80 | */ | 86 | */ |
@@ -309,6 +315,8 @@ struct crypto_alg { | |||
309 | */ | 315 | */ |
310 | int crypto_register_alg(struct crypto_alg *alg); | 316 | int crypto_register_alg(struct crypto_alg *alg); |
311 | int crypto_unregister_alg(struct crypto_alg *alg); | 317 | int crypto_unregister_alg(struct crypto_alg *alg); |
318 | int crypto_register_algs(struct crypto_alg *algs, int count); | ||
319 | int crypto_unregister_algs(struct crypto_alg *algs, int count); | ||
312 | 320 | ||
313 | /* | 321 | /* |
314 | * Algorithm query interface. | 322 | * Algorithm query interface. |
diff --git a/include/linux/cryptouser.h b/include/linux/cryptouser.h index 532fb58f16bf..4abf2ea6a887 100644 --- a/include/linux/cryptouser.h +++ b/include/linux/cryptouser.h | |||
@@ -100,3 +100,6 @@ struct crypto_report_rng { | |||
100 | char type[CRYPTO_MAX_NAME]; | 100 | char type[CRYPTO_MAX_NAME]; |
101 | unsigned int seedsize; | 101 | unsigned int seedsize; |
102 | }; | 102 | }; |
103 | |||
104 | #define CRYPTO_REPORT_MAXSIZE (sizeof(struct crypto_user_alg) + \ | ||
105 | sizeof(struct crypto_report_blkcipher)) | ||
diff --git a/include/linux/dcache.h b/include/linux/dcache.h index 4270bedd2308..7e11f1418203 100644 --- a/include/linux/dcache.h +++ b/include/linux/dcache.h | |||
@@ -47,26 +47,6 @@ struct dentry_stat_t { | |||
47 | }; | 47 | }; |
48 | extern struct dentry_stat_t dentry_stat; | 48 | extern struct dentry_stat_t dentry_stat; |
49 | 49 | ||
50 | /* | ||
51 | * Compare 2 name strings, return 0 if they match, otherwise non-zero. | ||
52 | * The strings are both count bytes long, and count is non-zero. | ||
53 | */ | ||
54 | static inline int dentry_cmp(const unsigned char *cs, size_t scount, | ||
55 | const unsigned char *ct, size_t tcount) | ||
56 | { | ||
57 | if (scount != tcount) | ||
58 | return 1; | ||
59 | |||
60 | do { | ||
61 | if (*cs != *ct) | ||
62 | return 1; | ||
63 | cs++; | ||
64 | ct++; | ||
65 | tcount--; | ||
66 | } while (tcount); | ||
67 | return 0; | ||
68 | } | ||
69 | |||
70 | /* Name hashing routines. Initial hash value */ | 50 | /* Name hashing routines. Initial hash value */ |
71 | /* Hash courtesy of the R5 hash in reiserfs modulo sign bits */ | 51 | /* Hash courtesy of the R5 hash in reiserfs modulo sign bits */ |
72 | #define init_name_hash() 0 | 52 | #define init_name_hash() 0 |
@@ -242,7 +222,6 @@ extern void shrink_dcache_for_umount(struct super_block *); | |||
242 | extern int d_invalidate(struct dentry *); | 222 | extern int d_invalidate(struct dentry *); |
243 | 223 | ||
244 | /* only used at mount-time */ | 224 | /* only used at mount-time */ |
245 | extern struct dentry * d_alloc_root(struct inode *); | ||
246 | extern struct dentry * d_make_root(struct inode *); | 225 | extern struct dentry * d_make_root(struct inode *); |
247 | 226 | ||
248 | /* <clickety>-<click> the ramfs-type tree */ | 227 | /* <clickety>-<click> the ramfs-type tree */ |
diff --git a/include/linux/dccp.h b/include/linux/dccp.h index 710c04302a15..eaf95a023af4 100644 --- a/include/linux/dccp.h +++ b/include/linux/dccp.h | |||
@@ -376,8 +376,10 @@ static inline unsigned int dccp_hdr_len(const struct sk_buff *skb) | |||
376 | /** | 376 | /** |
377 | * struct dccp_request_sock - represent DCCP-specific connection request | 377 | * struct dccp_request_sock - represent DCCP-specific connection request |
378 | * @dreq_inet_rsk: structure inherited from | 378 | * @dreq_inet_rsk: structure inherited from |
379 | * @dreq_iss: initial sequence number sent on the Response (RFC 4340, 7.1) | 379 | * @dreq_iss: initial sequence number, sent on the first Response (RFC 4340, 7.1) |
380 | * @dreq_isr: initial sequence number received on the Request | 380 | * @dreq_gss: greatest sequence number sent (for retransmitted Responses) |
381 | * @dreq_isr: initial sequence number received in the first Request | ||
382 | * @dreq_gsr: greatest sequence number received (for retransmitted Request(s)) | ||
381 | * @dreq_service: service code present on the Request (there is just one) | 383 | * @dreq_service: service code present on the Request (there is just one) |
382 | * @dreq_featneg: feature negotiation options for this connection | 384 | * @dreq_featneg: feature negotiation options for this connection |
383 | * The following two fields are analogous to the ones in dccp_sock: | 385 | * The following two fields are analogous to the ones in dccp_sock: |
@@ -387,7 +389,9 @@ static inline unsigned int dccp_hdr_len(const struct sk_buff *skb) | |||
387 | struct dccp_request_sock { | 389 | struct dccp_request_sock { |
388 | struct inet_request_sock dreq_inet_rsk; | 390 | struct inet_request_sock dreq_inet_rsk; |
389 | __u64 dreq_iss; | 391 | __u64 dreq_iss; |
392 | __u64 dreq_gss; | ||
390 | __u64 dreq_isr; | 393 | __u64 dreq_isr; |
394 | __u64 dreq_gsr; | ||
391 | __be32 dreq_service; | 395 | __be32 dreq_service; |
392 | struct list_head dreq_featneg; | 396 | struct list_head dreq_featneg; |
393 | __u32 dreq_timestamp_echo; | 397 | __u32 dreq_timestamp_echo; |
diff --git a/include/linux/debug_locks.h b/include/linux/debug_locks.h index 5033fb88c107..3bd46f766751 100644 --- a/include/linux/debug_locks.h +++ b/include/linux/debug_locks.h | |||
@@ -3,7 +3,7 @@ | |||
3 | 3 | ||
4 | #include <linux/kernel.h> | 4 | #include <linux/kernel.h> |
5 | #include <linux/atomic.h> | 5 | #include <linux/atomic.h> |
6 | #include <asm/system.h> | 6 | #include <linux/bug.h> |
7 | 7 | ||
8 | struct task_struct; | 8 | struct task_struct; |
9 | 9 | ||
diff --git a/include/linux/debugfs.h b/include/linux/debugfs.h index 6169c26fd8c8..ae36b72c22f3 100644 --- a/include/linux/debugfs.h +++ b/include/linux/debugfs.h | |||
@@ -86,7 +86,7 @@ struct dentry *debugfs_create_blob(const char *name, umode_t mode, | |||
86 | struct dentry *parent, | 86 | struct dentry *parent, |
87 | struct debugfs_blob_wrapper *blob); | 87 | struct debugfs_blob_wrapper *blob); |
88 | 88 | ||
89 | struct dentry *debugfs_create_regset32(const char *name, mode_t mode, | 89 | struct dentry *debugfs_create_regset32(const char *name, umode_t mode, |
90 | struct dentry *parent, | 90 | struct dentry *parent, |
91 | struct debugfs_regset32 *regset); | 91 | struct debugfs_regset32 *regset); |
92 | 92 | ||
@@ -208,7 +208,7 @@ static inline struct dentry *debugfs_create_blob(const char *name, umode_t mode, | |||
208 | } | 208 | } |
209 | 209 | ||
210 | static inline struct dentry *debugfs_create_regset32(const char *name, | 210 | static inline struct dentry *debugfs_create_regset32(const char *name, |
211 | mode_t mode, struct dentry *parent, | 211 | umode_t mode, struct dentry *parent, |
212 | struct debugfs_regset32 *regset) | 212 | struct debugfs_regset32 *regset) |
213 | { | 213 | { |
214 | return ERR_PTR(-ENODEV); | 214 | return ERR_PTR(-ENODEV); |
diff --git a/include/linux/devfreq.h b/include/linux/devfreq.h index 98ce8124b1cc..281c72a3b9d5 100644 --- a/include/linux/devfreq.h +++ b/include/linux/devfreq.h | |||
@@ -44,6 +44,14 @@ struct devfreq_dev_status { | |||
44 | void *private_data; | 44 | void *private_data; |
45 | }; | 45 | }; |
46 | 46 | ||
47 | /* | ||
48 | * The resulting frequency should be at most this. (this bound is the | ||
49 | * least upper bound; thus, the resulting freq should be lower or same) | ||
50 | * If the flag is not set, the resulting frequency should be at most the | ||
51 | * bound (greatest lower bound) | ||
52 | */ | ||
53 | #define DEVFREQ_FLAG_LEAST_UPPER_BOUND 0x1 | ||
54 | |||
47 | /** | 55 | /** |
48 | * struct devfreq_dev_profile - Devfreq's user device profile | 56 | * struct devfreq_dev_profile - Devfreq's user device profile |
49 | * @initial_freq The operating frequency when devfreq_add_device() is | 57 | * @initial_freq The operating frequency when devfreq_add_device() is |
@@ -54,6 +62,8 @@ struct devfreq_dev_status { | |||
54 | * higher than any operable frequency, set maximum. | 62 | * higher than any operable frequency, set maximum. |
55 | * Before returning, target function should set | 63 | * Before returning, target function should set |
56 | * freq at the current frequency. | 64 | * freq at the current frequency. |
65 | * The "flags" parameter's possible values are | ||
66 | * explained above with "DEVFREQ_FLAG_*" macros. | ||
57 | * @get_dev_status The device should provide the current performance | 67 | * @get_dev_status The device should provide the current performance |
58 | * status to devfreq, which is used by governors. | 68 | * status to devfreq, which is used by governors. |
59 | * @exit An optional callback that is called when devfreq | 69 | * @exit An optional callback that is called when devfreq |
@@ -66,7 +76,7 @@ struct devfreq_dev_profile { | |||
66 | unsigned long initial_freq; | 76 | unsigned long initial_freq; |
67 | unsigned int polling_ms; | 77 | unsigned int polling_ms; |
68 | 78 | ||
69 | int (*target)(struct device *dev, unsigned long *freq); | 79 | int (*target)(struct device *dev, unsigned long *freq, u32 flags); |
70 | int (*get_dev_status)(struct device *dev, | 80 | int (*get_dev_status)(struct device *dev, |
71 | struct devfreq_dev_status *stat); | 81 | struct devfreq_dev_status *stat); |
72 | void (*exit)(struct device *dev); | 82 | void (*exit)(struct device *dev); |
@@ -124,6 +134,8 @@ struct devfreq_governor { | |||
124 | * touch this. | 134 | * touch this. |
125 | * @being_removed a flag to mark that this object is being removed in | 135 | * @being_removed a flag to mark that this object is being removed in |
126 | * order to prevent trying to remove the object multiple times. | 136 | * order to prevent trying to remove the object multiple times. |
137 | * @min_freq Limit minimum frequency requested by user (0: none) | ||
138 | * @max_freq Limit maximum frequency requested by user (0: none) | ||
127 | * | 139 | * |
128 | * This structure stores the devfreq information for a give device. | 140 | * This structure stores the devfreq information for a give device. |
129 | * | 141 | * |
@@ -149,6 +161,9 @@ struct devfreq { | |||
149 | void *data; /* private data for governors */ | 161 | void *data; /* private data for governors */ |
150 | 162 | ||
151 | bool being_removed; | 163 | bool being_removed; |
164 | |||
165 | unsigned long min_freq; | ||
166 | unsigned long max_freq; | ||
152 | }; | 167 | }; |
153 | 168 | ||
154 | #if defined(CONFIG_PM_DEVFREQ) | 169 | #if defined(CONFIG_PM_DEVFREQ) |
@@ -160,7 +175,7 @@ extern int devfreq_remove_device(struct devfreq *devfreq); | |||
160 | 175 | ||
161 | /* Helper functions for devfreq user device driver with OPP. */ | 176 | /* Helper functions for devfreq user device driver with OPP. */ |
162 | extern struct opp *devfreq_recommended_opp(struct device *dev, | 177 | extern struct opp *devfreq_recommended_opp(struct device *dev, |
163 | unsigned long *freq); | 178 | unsigned long *freq, u32 flags); |
164 | extern int devfreq_register_opp_notifier(struct device *dev, | 179 | extern int devfreq_register_opp_notifier(struct device *dev, |
165 | struct devfreq *devfreq); | 180 | struct devfreq *devfreq); |
166 | extern int devfreq_unregister_opp_notifier(struct device *dev, | 181 | extern int devfreq_unregister_opp_notifier(struct device *dev, |
@@ -200,18 +215,18 @@ struct devfreq_simple_ondemand_data { | |||
200 | static struct devfreq *devfreq_add_device(struct device *dev, | 215 | static struct devfreq *devfreq_add_device(struct device *dev, |
201 | struct devfreq_dev_profile *profile, | 216 | struct devfreq_dev_profile *profile, |
202 | struct devfreq_governor *governor, | 217 | struct devfreq_governor *governor, |
203 | void *data); | 218 | void *data) |
204 | { | 219 | { |
205 | return NULL; | 220 | return NULL; |
206 | } | 221 | } |
207 | 222 | ||
208 | static int devfreq_remove_device(struct devfreq *devfreq); | 223 | static int devfreq_remove_device(struct devfreq *devfreq) |
209 | { | 224 | { |
210 | return 0; | 225 | return 0; |
211 | } | 226 | } |
212 | 227 | ||
213 | static struct opp *devfreq_recommended_opp(struct device *dev, | 228 | static struct opp *devfreq_recommended_opp(struct device *dev, |
214 | unsigned long *freq) | 229 | unsigned long *freq, u32 flags) |
215 | { | 230 | { |
216 | return -EINVAL; | 231 | return -EINVAL; |
217 | } | 232 | } |
diff --git a/include/linux/device.h b/include/linux/device.h index b63fb393aa58..5ad17cccdd71 100644 --- a/include/linux/device.h +++ b/include/linux/device.h | |||
@@ -238,8 +238,6 @@ struct device_driver { | |||
238 | extern int __must_check driver_register(struct device_driver *drv); | 238 | extern int __must_check driver_register(struct device_driver *drv); |
239 | extern void driver_unregister(struct device_driver *drv); | 239 | extern void driver_unregister(struct device_driver *drv); |
240 | 240 | ||
241 | extern struct device_driver *get_driver(struct device_driver *drv); | ||
242 | extern void put_driver(struct device_driver *drv); | ||
243 | extern struct device_driver *driver_find(const char *name, | 241 | extern struct device_driver *driver_find(const char *name, |
244 | struct bus_type *bus); | 242 | struct bus_type *bus); |
245 | extern int driver_probe_done(void); | 243 | extern int driver_probe_done(void); |
@@ -264,10 +262,6 @@ extern int __must_check driver_create_file(struct device_driver *driver, | |||
264 | extern void driver_remove_file(struct device_driver *driver, | 262 | extern void driver_remove_file(struct device_driver *driver, |
265 | const struct driver_attribute *attr); | 263 | const struct driver_attribute *attr); |
266 | 264 | ||
267 | extern int __must_check driver_add_kobj(struct device_driver *drv, | ||
268 | struct kobject *kobj, | ||
269 | const char *fmt, ...); | ||
270 | |||
271 | extern int __must_check driver_for_each_device(struct device_driver *drv, | 265 | extern int __must_check driver_for_each_device(struct device_driver *drv, |
272 | struct device *start, | 266 | struct device *start, |
273 | void *data, | 267 | void *data, |
@@ -946,14 +940,14 @@ int _dev_info(const struct device *dev, const char *fmt, ...) | |||
946 | 940 | ||
947 | #define dev_info(dev, fmt, arg...) _dev_info(dev, fmt, ##arg) | 941 | #define dev_info(dev, fmt, arg...) _dev_info(dev, fmt, ##arg) |
948 | 942 | ||
949 | #if defined(DEBUG) | 943 | #if defined(CONFIG_DYNAMIC_DEBUG) |
950 | #define dev_dbg(dev, format, arg...) \ | ||
951 | dev_printk(KERN_DEBUG, dev, format, ##arg) | ||
952 | #elif defined(CONFIG_DYNAMIC_DEBUG) | ||
953 | #define dev_dbg(dev, format, ...) \ | 944 | #define dev_dbg(dev, format, ...) \ |
954 | do { \ | 945 | do { \ |
955 | dynamic_dev_dbg(dev, format, ##__VA_ARGS__); \ | 946 | dynamic_dev_dbg(dev, format, ##__VA_ARGS__); \ |
956 | } while (0) | 947 | } while (0) |
948 | #elif defined(DEBUG) | ||
949 | #define dev_dbg(dev, format, arg...) \ | ||
950 | dev_printk(KERN_DEBUG, dev, format, ##arg) | ||
957 | #else | 951 | #else |
958 | #define dev_dbg(dev, format, arg...) \ | 952 | #define dev_dbg(dev, format, arg...) \ |
959 | ({ \ | 953 | ({ \ |
@@ -1007,19 +1001,20 @@ extern long sysfs_deprecated; | |||
1007 | * @__driver: driver name | 1001 | * @__driver: driver name |
1008 | * @__register: register function for this driver type | 1002 | * @__register: register function for this driver type |
1009 | * @__unregister: unregister function for this driver type | 1003 | * @__unregister: unregister function for this driver type |
1004 | * @...: Additional arguments to be passed to __register and __unregister. | ||
1010 | * | 1005 | * |
1011 | * Use this macro to construct bus specific macros for registering | 1006 | * Use this macro to construct bus specific macros for registering |
1012 | * drivers, and do not use it on its own. | 1007 | * drivers, and do not use it on its own. |
1013 | */ | 1008 | */ |
1014 | #define module_driver(__driver, __register, __unregister) \ | 1009 | #define module_driver(__driver, __register, __unregister, ...) \ |
1015 | static int __init __driver##_init(void) \ | 1010 | static int __init __driver##_init(void) \ |
1016 | { \ | 1011 | { \ |
1017 | return __register(&(__driver)); \ | 1012 | return __register(&(__driver) , ##__VA_ARGS__); \ |
1018 | } \ | 1013 | } \ |
1019 | module_init(__driver##_init); \ | 1014 | module_init(__driver##_init); \ |
1020 | static void __exit __driver##_exit(void) \ | 1015 | static void __exit __driver##_exit(void) \ |
1021 | { \ | 1016 | { \ |
1022 | __unregister(&(__driver)); \ | 1017 | __unregister(&(__driver) , ##__VA_ARGS__); \ |
1023 | } \ | 1018 | } \ |
1024 | module_exit(__driver##_exit); | 1019 | module_exit(__driver##_exit); |
1025 | 1020 | ||
diff --git a/include/linux/dma-attrs.h b/include/linux/dma-attrs.h index 71ad34eca6e3..547ab568d3ae 100644 --- a/include/linux/dma-attrs.h +++ b/include/linux/dma-attrs.h | |||
@@ -13,6 +13,8 @@ | |||
13 | enum dma_attr { | 13 | enum dma_attr { |
14 | DMA_ATTR_WRITE_BARRIER, | 14 | DMA_ATTR_WRITE_BARRIER, |
15 | DMA_ATTR_WEAK_ORDERING, | 15 | DMA_ATTR_WEAK_ORDERING, |
16 | DMA_ATTR_WRITE_COMBINE, | ||
17 | DMA_ATTR_NON_CONSISTENT, | ||
16 | DMA_ATTR_MAX, | 18 | DMA_ATTR_MAX, |
17 | }; | 19 | }; |
18 | 20 | ||
diff --git a/include/linux/dma-buf.h b/include/linux/dma-buf.h index f8ac076afa52..3efbfc2145c3 100644 --- a/include/linux/dma-buf.h +++ b/include/linux/dma-buf.h | |||
@@ -26,11 +26,12 @@ | |||
26 | 26 | ||
27 | #include <linux/file.h> | 27 | #include <linux/file.h> |
28 | #include <linux/err.h> | 28 | #include <linux/err.h> |
29 | #include <linux/device.h> | ||
30 | #include <linux/scatterlist.h> | 29 | #include <linux/scatterlist.h> |
31 | #include <linux/list.h> | 30 | #include <linux/list.h> |
32 | #include <linux/dma-mapping.h> | 31 | #include <linux/dma-mapping.h> |
32 | #include <linux/fs.h> | ||
33 | 33 | ||
34 | struct device; | ||
34 | struct dma_buf; | 35 | struct dma_buf; |
35 | struct dma_buf_attachment; | 36 | struct dma_buf_attachment; |
36 | 37 | ||
@@ -49,6 +50,17 @@ struct dma_buf_attachment; | |||
49 | * @unmap_dma_buf: decreases usecount of buffer, might deallocate scatter | 50 | * @unmap_dma_buf: decreases usecount of buffer, might deallocate scatter |
50 | * pages. | 51 | * pages. |
51 | * @release: release this buffer; to be called after the last dma_buf_put. | 52 | * @release: release this buffer; to be called after the last dma_buf_put. |
53 | * @begin_cpu_access: [optional] called before cpu access to invalidate cpu | ||
54 | * caches and allocate backing storage (if not yet done) | ||
55 | * respectively pin the objet into memory. | ||
56 | * @end_cpu_access: [optional] called after cpu access to flush cashes. | ||
57 | * @kmap_atomic: maps a page from the buffer into kernel address | ||
58 | * space, users may not block until the subsequent unmap call. | ||
59 | * This callback must not sleep. | ||
60 | * @kunmap_atomic: [optional] unmaps a atomically mapped page from the buffer. | ||
61 | * This Callback must not sleep. | ||
62 | * @kmap: maps a page from the buffer into kernel address space. | ||
63 | * @kunmap: [optional] unmaps a page from the buffer. | ||
52 | */ | 64 | */ |
53 | struct dma_buf_ops { | 65 | struct dma_buf_ops { |
54 | int (*attach)(struct dma_buf *, struct device *, | 66 | int (*attach)(struct dma_buf *, struct device *, |
@@ -63,7 +75,8 @@ struct dma_buf_ops { | |||
63 | struct sg_table * (*map_dma_buf)(struct dma_buf_attachment *, | 75 | struct sg_table * (*map_dma_buf)(struct dma_buf_attachment *, |
64 | enum dma_data_direction); | 76 | enum dma_data_direction); |
65 | void (*unmap_dma_buf)(struct dma_buf_attachment *, | 77 | void (*unmap_dma_buf)(struct dma_buf_attachment *, |
66 | struct sg_table *); | 78 | struct sg_table *, |
79 | enum dma_data_direction); | ||
67 | /* TODO: Add try_map_dma_buf version, to return immed with -EBUSY | 80 | /* TODO: Add try_map_dma_buf version, to return immed with -EBUSY |
68 | * if the call would block. | 81 | * if the call would block. |
69 | */ | 82 | */ |
@@ -71,6 +84,14 @@ struct dma_buf_ops { | |||
71 | /* after final dma_buf_put() */ | 84 | /* after final dma_buf_put() */ |
72 | void (*release)(struct dma_buf *); | 85 | void (*release)(struct dma_buf *); |
73 | 86 | ||
87 | int (*begin_cpu_access)(struct dma_buf *, size_t, size_t, | ||
88 | enum dma_data_direction); | ||
89 | void (*end_cpu_access)(struct dma_buf *, size_t, size_t, | ||
90 | enum dma_data_direction); | ||
91 | void *(*kmap_atomic)(struct dma_buf *, unsigned long); | ||
92 | void (*kunmap_atomic)(struct dma_buf *, unsigned long, void *); | ||
93 | void *(*kmap)(struct dma_buf *, unsigned long); | ||
94 | void (*kunmap)(struct dma_buf *, unsigned long, void *); | ||
74 | }; | 95 | }; |
75 | 96 | ||
76 | /** | 97 | /** |
@@ -86,7 +107,7 @@ struct dma_buf { | |||
86 | struct file *file; | 107 | struct file *file; |
87 | struct list_head attachments; | 108 | struct list_head attachments; |
88 | const struct dma_buf_ops *ops; | 109 | const struct dma_buf_ops *ops; |
89 | /* mutex to serialize list manipulation and other ops */ | 110 | /* mutex to serialize list manipulation and attach/detach */ |
90 | struct mutex lock; | 111 | struct mutex lock; |
91 | void *priv; | 112 | void *priv; |
92 | }; | 113 | }; |
@@ -109,20 +130,43 @@ struct dma_buf_attachment { | |||
109 | void *priv; | 130 | void *priv; |
110 | }; | 131 | }; |
111 | 132 | ||
133 | /** | ||
134 | * get_dma_buf - convenience wrapper for get_file. | ||
135 | * @dmabuf: [in] pointer to dma_buf | ||
136 | * | ||
137 | * Increments the reference count on the dma-buf, needed in case of drivers | ||
138 | * that either need to create additional references to the dmabuf on the | ||
139 | * kernel side. For example, an exporter that needs to keep a dmabuf ptr | ||
140 | * so that subsequent exports don't create a new dmabuf. | ||
141 | */ | ||
142 | static inline void get_dma_buf(struct dma_buf *dmabuf) | ||
143 | { | ||
144 | get_file(dmabuf->file); | ||
145 | } | ||
146 | |||
112 | #ifdef CONFIG_DMA_SHARED_BUFFER | 147 | #ifdef CONFIG_DMA_SHARED_BUFFER |
113 | struct dma_buf_attachment *dma_buf_attach(struct dma_buf *dmabuf, | 148 | struct dma_buf_attachment *dma_buf_attach(struct dma_buf *dmabuf, |
114 | struct device *dev); | 149 | struct device *dev); |
115 | void dma_buf_detach(struct dma_buf *dmabuf, | 150 | void dma_buf_detach(struct dma_buf *dmabuf, |
116 | struct dma_buf_attachment *dmabuf_attach); | 151 | struct dma_buf_attachment *dmabuf_attach); |
117 | struct dma_buf *dma_buf_export(void *priv, struct dma_buf_ops *ops, | 152 | struct dma_buf *dma_buf_export(void *priv, const struct dma_buf_ops *ops, |
118 | size_t size, int flags); | 153 | size_t size, int flags); |
119 | int dma_buf_fd(struct dma_buf *dmabuf); | 154 | int dma_buf_fd(struct dma_buf *dmabuf, int flags); |
120 | struct dma_buf *dma_buf_get(int fd); | 155 | struct dma_buf *dma_buf_get(int fd); |
121 | void dma_buf_put(struct dma_buf *dmabuf); | 156 | void dma_buf_put(struct dma_buf *dmabuf); |
122 | 157 | ||
123 | struct sg_table *dma_buf_map_attachment(struct dma_buf_attachment *, | 158 | struct sg_table *dma_buf_map_attachment(struct dma_buf_attachment *, |
124 | enum dma_data_direction); | 159 | enum dma_data_direction); |
125 | void dma_buf_unmap_attachment(struct dma_buf_attachment *, struct sg_table *); | 160 | void dma_buf_unmap_attachment(struct dma_buf_attachment *, struct sg_table *, |
161 | enum dma_data_direction); | ||
162 | int dma_buf_begin_cpu_access(struct dma_buf *dma_buf, size_t start, size_t len, | ||
163 | enum dma_data_direction dir); | ||
164 | void dma_buf_end_cpu_access(struct dma_buf *dma_buf, size_t start, size_t len, | ||
165 | enum dma_data_direction dir); | ||
166 | void *dma_buf_kmap_atomic(struct dma_buf *, unsigned long); | ||
167 | void dma_buf_kunmap_atomic(struct dma_buf *, unsigned long, void *); | ||
168 | void *dma_buf_kmap(struct dma_buf *, unsigned long); | ||
169 | void dma_buf_kunmap(struct dma_buf *, unsigned long, void *); | ||
126 | #else | 170 | #else |
127 | 171 | ||
128 | static inline struct dma_buf_attachment *dma_buf_attach(struct dma_buf *dmabuf, | 172 | static inline struct dma_buf_attachment *dma_buf_attach(struct dma_buf *dmabuf, |
@@ -138,13 +182,13 @@ static inline void dma_buf_detach(struct dma_buf *dmabuf, | |||
138 | } | 182 | } |
139 | 183 | ||
140 | static inline struct dma_buf *dma_buf_export(void *priv, | 184 | static inline struct dma_buf *dma_buf_export(void *priv, |
141 | struct dma_buf_ops *ops, | 185 | const struct dma_buf_ops *ops, |
142 | size_t size, int flags) | 186 | size_t size, int flags) |
143 | { | 187 | { |
144 | return ERR_PTR(-ENODEV); | 188 | return ERR_PTR(-ENODEV); |
145 | } | 189 | } |
146 | 190 | ||
147 | static inline int dma_buf_fd(struct dma_buf *dmabuf) | 191 | static inline int dma_buf_fd(struct dma_buf *dmabuf, int flags) |
148 | { | 192 | { |
149 | return -ENODEV; | 193 | return -ENODEV; |
150 | } | 194 | } |
@@ -166,11 +210,44 @@ static inline struct sg_table *dma_buf_map_attachment( | |||
166 | } | 210 | } |
167 | 211 | ||
168 | static inline void dma_buf_unmap_attachment(struct dma_buf_attachment *attach, | 212 | static inline void dma_buf_unmap_attachment(struct dma_buf_attachment *attach, |
169 | struct sg_table *sg) | 213 | struct sg_table *sg, enum dma_data_direction dir) |
170 | { | 214 | { |
171 | return; | 215 | return; |
172 | } | 216 | } |
173 | 217 | ||
218 | static inline int dma_buf_begin_cpu_access(struct dma_buf *dmabuf, | ||
219 | size_t start, size_t len, | ||
220 | enum dma_data_direction dir) | ||
221 | { | ||
222 | return -ENODEV; | ||
223 | } | ||
224 | |||
225 | static inline void dma_buf_end_cpu_access(struct dma_buf *dmabuf, | ||
226 | size_t start, size_t len, | ||
227 | enum dma_data_direction dir) | ||
228 | { | ||
229 | } | ||
230 | |||
231 | static inline void *dma_buf_kmap_atomic(struct dma_buf *dmabuf, | ||
232 | unsigned long pnum) | ||
233 | { | ||
234 | return NULL; | ||
235 | } | ||
236 | |||
237 | static inline void dma_buf_kunmap_atomic(struct dma_buf *dmabuf, | ||
238 | unsigned long pnum, void *vaddr) | ||
239 | { | ||
240 | } | ||
241 | |||
242 | static inline void *dma_buf_kmap(struct dma_buf *dmabuf, unsigned long pnum) | ||
243 | { | ||
244 | return NULL; | ||
245 | } | ||
246 | |||
247 | static inline void dma_buf_kunmap(struct dma_buf *dmabuf, | ||
248 | unsigned long pnum, void *vaddr) | ||
249 | { | ||
250 | } | ||
174 | #endif /* CONFIG_DMA_SHARED_BUFFER */ | 251 | #endif /* CONFIG_DMA_SHARED_BUFFER */ |
175 | 252 | ||
176 | #endif /* __DMA_BUF_H__ */ | 253 | #endif /* __DMA_BUF_H__ */ |
diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h index e13117cbd2f7..dfc099e56a66 100644 --- a/include/linux/dma-mapping.h +++ b/include/linux/dma-mapping.h | |||
@@ -9,10 +9,15 @@ | |||
9 | #include <linux/scatterlist.h> | 9 | #include <linux/scatterlist.h> |
10 | 10 | ||
11 | struct dma_map_ops { | 11 | struct dma_map_ops { |
12 | void* (*alloc_coherent)(struct device *dev, size_t size, | 12 | void* (*alloc)(struct device *dev, size_t size, |
13 | dma_addr_t *dma_handle, gfp_t gfp); | 13 | dma_addr_t *dma_handle, gfp_t gfp, |
14 | void (*free_coherent)(struct device *dev, size_t size, | 14 | struct dma_attrs *attrs); |
15 | void *vaddr, dma_addr_t dma_handle); | 15 | void (*free)(struct device *dev, size_t size, |
16 | void *vaddr, dma_addr_t dma_handle, | ||
17 | struct dma_attrs *attrs); | ||
18 | int (*mmap)(struct device *, struct vm_area_struct *, | ||
19 | void *, dma_addr_t, size_t, struct dma_attrs *attrs); | ||
20 | |||
16 | dma_addr_t (*map_page)(struct device *dev, struct page *page, | 21 | dma_addr_t (*map_page)(struct device *dev, struct page *page, |
17 | unsigned long offset, size_t size, | 22 | unsigned long offset, size_t size, |
18 | enum dma_data_direction dir, | 23 | enum dma_data_direction dir, |
@@ -77,7 +82,7 @@ static inline u64 dma_get_mask(struct device *dev) | |||
77 | return DMA_BIT_MASK(32); | 82 | return DMA_BIT_MASK(32); |
78 | } | 83 | } |
79 | 84 | ||
80 | #ifdef ARCH_HAS_DMA_SET_COHERENT_MASK | 85 | #ifdef CONFIG_ARCH_HAS_DMA_SET_COHERENT_MASK |
81 | int dma_set_coherent_mask(struct device *dev, u64 mask); | 86 | int dma_set_coherent_mask(struct device *dev, u64 mask); |
82 | #else | 87 | #else |
83 | static inline int dma_set_coherent_mask(struct device *dev, u64 mask) | 88 | static inline int dma_set_coherent_mask(struct device *dev, u64 mask) |
diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h index 679b349d9b66..f9a2e5e67a54 100644 --- a/include/linux/dmaengine.h +++ b/include/linux/dmaengine.h | |||
@@ -18,13 +18,15 @@ | |||
18 | * The full GNU General Public License is included in this distribution in the | 18 | * The full GNU General Public License is included in this distribution in the |
19 | * file called COPYING. | 19 | * file called COPYING. |
20 | */ | 20 | */ |
21 | #ifndef DMAENGINE_H | 21 | #ifndef LINUX_DMAENGINE_H |
22 | #define DMAENGINE_H | 22 | #define LINUX_DMAENGINE_H |
23 | 23 | ||
24 | #include <linux/device.h> | 24 | #include <linux/device.h> |
25 | #include <linux/uio.h> | 25 | #include <linux/uio.h> |
26 | #include <linux/bug.h> | ||
26 | #include <linux/scatterlist.h> | 27 | #include <linux/scatterlist.h> |
27 | #include <linux/bitmap.h> | 28 | #include <linux/bitmap.h> |
29 | #include <linux/types.h> | ||
28 | #include <asm/page.h> | 30 | #include <asm/page.h> |
29 | 31 | ||
30 | /** | 32 | /** |
@@ -257,6 +259,7 @@ struct dma_chan_percpu { | |||
257 | * struct dma_chan - devices supply DMA channels, clients use them | 259 | * struct dma_chan - devices supply DMA channels, clients use them |
258 | * @device: ptr to the dma device who supplies this channel, always !%NULL | 260 | * @device: ptr to the dma device who supplies this channel, always !%NULL |
259 | * @cookie: last cookie value returned to client | 261 | * @cookie: last cookie value returned to client |
262 | * @completed_cookie: last completed cookie for this channel | ||
260 | * @chan_id: channel ID for sysfs | 263 | * @chan_id: channel ID for sysfs |
261 | * @dev: class device for sysfs | 264 | * @dev: class device for sysfs |
262 | * @device_node: used to add this to the device chan list | 265 | * @device_node: used to add this to the device chan list |
@@ -268,6 +271,7 @@ struct dma_chan_percpu { | |||
268 | struct dma_chan { | 271 | struct dma_chan { |
269 | struct dma_device *device; | 272 | struct dma_device *device; |
270 | dma_cookie_t cookie; | 273 | dma_cookie_t cookie; |
274 | dma_cookie_t completed_cookie; | ||
271 | 275 | ||
272 | /* sysfs */ | 276 | /* sysfs */ |
273 | int chan_id; | 277 | int chan_id; |
@@ -331,6 +335,9 @@ enum dma_slave_buswidth { | |||
331 | * may or may not be applicable on memory sources. | 335 | * may or may not be applicable on memory sources. |
332 | * @dst_maxburst: same as src_maxburst but for destination target | 336 | * @dst_maxburst: same as src_maxburst but for destination target |
333 | * mutatis mutandis. | 337 | * mutatis mutandis. |
338 | * @device_fc: Flow Controller Settings. Only valid for slave channels. Fill | ||
339 | * with 'true' if peripheral should be flow controller. Direction will be | ||
340 | * selected at Runtime. | ||
334 | * | 341 | * |
335 | * This struct is passed in as configuration data to a DMA engine | 342 | * This struct is passed in as configuration data to a DMA engine |
336 | * in order to set up a certain channel for DMA transport at runtime. | 343 | * in order to set up a certain channel for DMA transport at runtime. |
@@ -357,6 +364,7 @@ struct dma_slave_config { | |||
357 | enum dma_slave_buswidth dst_addr_width; | 364 | enum dma_slave_buswidth dst_addr_width; |
358 | u32 src_maxburst; | 365 | u32 src_maxburst; |
359 | u32 dst_maxburst; | 366 | u32 dst_maxburst; |
367 | bool device_fc; | ||
360 | }; | 368 | }; |
361 | 369 | ||
362 | static inline const char *dma_chan_name(struct dma_chan *chan) | 370 | static inline const char *dma_chan_name(struct dma_chan *chan) |
@@ -575,10 +583,11 @@ struct dma_device { | |||
575 | struct dma_async_tx_descriptor *(*device_prep_slave_sg)( | 583 | struct dma_async_tx_descriptor *(*device_prep_slave_sg)( |
576 | struct dma_chan *chan, struct scatterlist *sgl, | 584 | struct dma_chan *chan, struct scatterlist *sgl, |
577 | unsigned int sg_len, enum dma_transfer_direction direction, | 585 | unsigned int sg_len, enum dma_transfer_direction direction, |
578 | unsigned long flags); | 586 | unsigned long flags, void *context); |
579 | struct dma_async_tx_descriptor *(*device_prep_dma_cyclic)( | 587 | struct dma_async_tx_descriptor *(*device_prep_dma_cyclic)( |
580 | struct dma_chan *chan, dma_addr_t buf_addr, size_t buf_len, | 588 | struct dma_chan *chan, dma_addr_t buf_addr, size_t buf_len, |
581 | size_t period_len, enum dma_transfer_direction direction); | 589 | size_t period_len, enum dma_transfer_direction direction, |
590 | void *context); | ||
582 | struct dma_async_tx_descriptor *(*device_prep_interleaved_dma)( | 591 | struct dma_async_tx_descriptor *(*device_prep_interleaved_dma)( |
583 | struct dma_chan *chan, struct dma_interleaved_template *xt, | 592 | struct dma_chan *chan, struct dma_interleaved_template *xt, |
584 | unsigned long flags); | 593 | unsigned long flags); |
@@ -612,7 +621,24 @@ static inline struct dma_async_tx_descriptor *dmaengine_prep_slave_single( | |||
612 | struct scatterlist sg; | 621 | struct scatterlist sg; |
613 | sg_init_one(&sg, buf, len); | 622 | sg_init_one(&sg, buf, len); |
614 | 623 | ||
615 | return chan->device->device_prep_slave_sg(chan, &sg, 1, dir, flags); | 624 | return chan->device->device_prep_slave_sg(chan, &sg, 1, |
625 | dir, flags, NULL); | ||
626 | } | ||
627 | |||
628 | static inline struct dma_async_tx_descriptor *dmaengine_prep_slave_sg( | ||
629 | struct dma_chan *chan, struct scatterlist *sgl, unsigned int sg_len, | ||
630 | enum dma_transfer_direction dir, unsigned long flags) | ||
631 | { | ||
632 | return chan->device->device_prep_slave_sg(chan, sgl, sg_len, | ||
633 | dir, flags, NULL); | ||
634 | } | ||
635 | |||
636 | static inline struct dma_async_tx_descriptor *dmaengine_prep_dma_cyclic( | ||
637 | struct dma_chan *chan, dma_addr_t buf_addr, size_t buf_len, | ||
638 | size_t period_len, enum dma_transfer_direction dir) | ||
639 | { | ||
640 | return chan->device->device_prep_dma_cyclic(chan, buf_addr, buf_len, | ||
641 | period_len, dir, NULL); | ||
616 | } | 642 | } |
617 | 643 | ||
618 | static inline int dmaengine_terminate_all(struct dma_chan *chan) | 644 | static inline int dmaengine_terminate_all(struct dma_chan *chan) |
@@ -948,6 +974,7 @@ int dma_async_device_register(struct dma_device *device); | |||
948 | void dma_async_device_unregister(struct dma_device *device); | 974 | void dma_async_device_unregister(struct dma_device *device); |
949 | void dma_run_dependencies(struct dma_async_tx_descriptor *tx); | 975 | void dma_run_dependencies(struct dma_async_tx_descriptor *tx); |
950 | struct dma_chan *dma_find_channel(enum dma_transaction_type tx_type); | 976 | struct dma_chan *dma_find_channel(enum dma_transaction_type tx_type); |
977 | struct dma_chan *net_dma_find_channel(void); | ||
951 | #define dma_request_channel(mask, x, y) __dma_request_channel(&(mask), x, y) | 978 | #define dma_request_channel(mask, x, y) __dma_request_channel(&(mask), x, y) |
952 | 979 | ||
953 | /* --- Helper iov-locking functions --- */ | 980 | /* --- Helper iov-locking functions --- */ |
diff --git a/include/linux/dw_dmac.h b/include/linux/dw_dmac.h index f2c64f92c4a0..2412e02d7c0f 100644 --- a/include/linux/dw_dmac.h +++ b/include/linux/dw_dmac.h | |||
@@ -31,18 +31,6 @@ struct dw_dma_platform_data { | |||
31 | unsigned char chan_priority; | 31 | unsigned char chan_priority; |
32 | }; | 32 | }; |
33 | 33 | ||
34 | /** | ||
35 | * enum dw_dma_slave_width - DMA slave register access width. | ||
36 | * @DMA_SLAVE_WIDTH_8BIT: Do 8-bit slave register accesses | ||
37 | * @DMA_SLAVE_WIDTH_16BIT: Do 16-bit slave register accesses | ||
38 | * @DMA_SLAVE_WIDTH_32BIT: Do 32-bit slave register accesses | ||
39 | */ | ||
40 | enum dw_dma_slave_width { | ||
41 | DW_DMA_SLAVE_WIDTH_8BIT, | ||
42 | DW_DMA_SLAVE_WIDTH_16BIT, | ||
43 | DW_DMA_SLAVE_WIDTH_32BIT, | ||
44 | }; | ||
45 | |||
46 | /* bursts size */ | 34 | /* bursts size */ |
47 | enum dw_dma_msize { | 35 | enum dw_dma_msize { |
48 | DW_DMA_MSIZE_1, | 36 | DW_DMA_MSIZE_1, |
@@ -55,47 +43,21 @@ enum dw_dma_msize { | |||
55 | DW_DMA_MSIZE_256, | 43 | DW_DMA_MSIZE_256, |
56 | }; | 44 | }; |
57 | 45 | ||
58 | /* flow controller */ | ||
59 | enum dw_dma_fc { | ||
60 | DW_DMA_FC_D_M2M, | ||
61 | DW_DMA_FC_D_M2P, | ||
62 | DW_DMA_FC_D_P2M, | ||
63 | DW_DMA_FC_D_P2P, | ||
64 | DW_DMA_FC_P_P2M, | ||
65 | DW_DMA_FC_SP_P2P, | ||
66 | DW_DMA_FC_P_M2P, | ||
67 | DW_DMA_FC_DP_P2P, | ||
68 | }; | ||
69 | |||
70 | /** | 46 | /** |
71 | * struct dw_dma_slave - Controller-specific information about a slave | 47 | * struct dw_dma_slave - Controller-specific information about a slave |
72 | * | 48 | * |
73 | * @dma_dev: required DMA master device | 49 | * @dma_dev: required DMA master device |
74 | * @tx_reg: physical address of data register used for | ||
75 | * memory-to-peripheral transfers | ||
76 | * @rx_reg: physical address of data register used for | ||
77 | * peripheral-to-memory transfers | ||
78 | * @reg_width: peripheral register width | ||
79 | * @cfg_hi: Platform-specific initializer for the CFG_HI register | 50 | * @cfg_hi: Platform-specific initializer for the CFG_HI register |
80 | * @cfg_lo: Platform-specific initializer for the CFG_LO register | 51 | * @cfg_lo: Platform-specific initializer for the CFG_LO register |
81 | * @src_master: src master for transfers on allocated channel. | 52 | * @src_master: src master for transfers on allocated channel. |
82 | * @dst_master: dest master for transfers on allocated channel. | 53 | * @dst_master: dest master for transfers on allocated channel. |
83 | * @src_msize: src burst size. | ||
84 | * @dst_msize: dest burst size. | ||
85 | * @fc: flow controller for DMA transfer | ||
86 | */ | 54 | */ |
87 | struct dw_dma_slave { | 55 | struct dw_dma_slave { |
88 | struct device *dma_dev; | 56 | struct device *dma_dev; |
89 | dma_addr_t tx_reg; | ||
90 | dma_addr_t rx_reg; | ||
91 | enum dw_dma_slave_width reg_width; | ||
92 | u32 cfg_hi; | 57 | u32 cfg_hi; |
93 | u32 cfg_lo; | 58 | u32 cfg_lo; |
94 | u8 src_master; | 59 | u8 src_master; |
95 | u8 dst_master; | 60 | u8 dst_master; |
96 | u8 src_msize; | ||
97 | u8 dst_msize; | ||
98 | u8 fc; | ||
99 | }; | 61 | }; |
100 | 62 | ||
101 | /* Platform-configurable bits in CFG_HI */ | 63 | /* Platform-configurable bits in CFG_HI */ |
diff --git a/include/linux/dynamic_debug.h b/include/linux/dynamic_debug.h index 0564e3c39882..7e3c53a900d8 100644 --- a/include/linux/dynamic_debug.h +++ b/include/linux/dynamic_debug.h | |||
@@ -15,20 +15,24 @@ struct _ddebug { | |||
15 | const char *function; | 15 | const char *function; |
16 | const char *filename; | 16 | const char *filename; |
17 | const char *format; | 17 | const char *format; |
18 | unsigned int lineno:24; | 18 | unsigned int lineno:18; |
19 | /* | 19 | /* |
20 | * The flags field controls the behaviour at the callsite. | 20 | * The flags field controls the behaviour at the callsite. |
21 | * The bits here are changed dynamically when the user | 21 | * The bits here are changed dynamically when the user |
22 | * writes commands to <debugfs>/dynamic_debug/control | 22 | * writes commands to <debugfs>/dynamic_debug/control |
23 | */ | 23 | */ |
24 | #define _DPRINTK_FLAGS_PRINT (1<<0) /* printk() a message using the format */ | 24 | #define _DPRINTK_FLAGS_NONE 0 |
25 | #define _DPRINTK_FLAGS_PRINT (1<<0) /* printk() a message using the format */ | ||
25 | #define _DPRINTK_FLAGS_INCL_MODNAME (1<<1) | 26 | #define _DPRINTK_FLAGS_INCL_MODNAME (1<<1) |
26 | #define _DPRINTK_FLAGS_INCL_FUNCNAME (1<<2) | 27 | #define _DPRINTK_FLAGS_INCL_FUNCNAME (1<<2) |
27 | #define _DPRINTK_FLAGS_INCL_LINENO (1<<3) | 28 | #define _DPRINTK_FLAGS_INCL_LINENO (1<<3) |
28 | #define _DPRINTK_FLAGS_INCL_TID (1<<4) | 29 | #define _DPRINTK_FLAGS_INCL_TID (1<<4) |
30 | #if defined DEBUG | ||
31 | #define _DPRINTK_FLAGS_DEFAULT _DPRINTK_FLAGS_PRINT | ||
32 | #else | ||
29 | #define _DPRINTK_FLAGS_DEFAULT 0 | 33 | #define _DPRINTK_FLAGS_DEFAULT 0 |
34 | #endif | ||
30 | unsigned int flags:8; | 35 | unsigned int flags:8; |
31 | char enabled; | ||
32 | } __attribute__((aligned(8))); | 36 | } __attribute__((aligned(8))); |
33 | 37 | ||
34 | 38 | ||
@@ -62,21 +66,20 @@ int __dynamic_netdev_dbg(struct _ddebug *descriptor, | |||
62 | .format = (fmt), \ | 66 | .format = (fmt), \ |
63 | .lineno = __LINE__, \ | 67 | .lineno = __LINE__, \ |
64 | .flags = _DPRINTK_FLAGS_DEFAULT, \ | 68 | .flags = _DPRINTK_FLAGS_DEFAULT, \ |
65 | .enabled = false, \ | ||
66 | } | 69 | } |
67 | 70 | ||
68 | #define dynamic_pr_debug(fmt, ...) \ | 71 | #define dynamic_pr_debug(fmt, ...) \ |
69 | do { \ | 72 | do { \ |
70 | DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, fmt); \ | 73 | DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, fmt); \ |
71 | if (unlikely(descriptor.enabled)) \ | 74 | if (unlikely(descriptor.flags & _DPRINTK_FLAGS_PRINT)) \ |
72 | __dynamic_pr_debug(&descriptor, pr_fmt(fmt), \ | 75 | __dynamic_pr_debug(&descriptor, pr_fmt(fmt), \ |
73 | ##__VA_ARGS__); \ | 76 | ##__VA_ARGS__); \ |
74 | } while (0) | 77 | } while (0) |
75 | 78 | ||
76 | #define dynamic_dev_dbg(dev, fmt, ...) \ | 79 | #define dynamic_dev_dbg(dev, fmt, ...) \ |
77 | do { \ | 80 | do { \ |
78 | DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, fmt); \ | 81 | DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, fmt); \ |
79 | if (unlikely(descriptor.enabled)) \ | 82 | if (unlikely(descriptor.flags & _DPRINTK_FLAGS_PRINT)) \ |
80 | __dynamic_dev_dbg(&descriptor, dev, fmt, \ | 83 | __dynamic_dev_dbg(&descriptor, dev, fmt, \ |
81 | ##__VA_ARGS__); \ | 84 | ##__VA_ARGS__); \ |
82 | } while (0) | 85 | } while (0) |
@@ -84,7 +87,7 @@ do { \ | |||
84 | #define dynamic_netdev_dbg(dev, fmt, ...) \ | 87 | #define dynamic_netdev_dbg(dev, fmt, ...) \ |
85 | do { \ | 88 | do { \ |
86 | DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, fmt); \ | 89 | DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, fmt); \ |
87 | if (unlikely(descriptor.enabled)) \ | 90 | if (unlikely(descriptor.flags & _DPRINTK_FLAGS_PRINT)) \ |
88 | __dynamic_netdev_dbg(&descriptor, dev, fmt, \ | 91 | __dynamic_netdev_dbg(&descriptor, dev, fmt, \ |
89 | ##__VA_ARGS__); \ | 92 | ##__VA_ARGS__); \ |
90 | } while (0) | 93 | } while (0) |
diff --git a/include/linux/edac.h b/include/linux/edac.h index 1cd3947987e5..c621d762bb2c 100644 --- a/include/linux/edac.h +++ b/include/linux/edac.h | |||
@@ -13,7 +13,11 @@ | |||
13 | #define _LINUX_EDAC_H_ | 13 | #define _LINUX_EDAC_H_ |
14 | 14 | ||
15 | #include <linux/atomic.h> | 15 | #include <linux/atomic.h> |
16 | #include <linux/device.h> | 16 | #include <linux/kobject.h> |
17 | #include <linux/completion.h> | ||
18 | #include <linux/workqueue.h> | ||
19 | |||
20 | struct device; | ||
17 | 21 | ||
18 | #define EDAC_OPSTATE_INVAL -1 | 22 | #define EDAC_OPSTATE_INVAL -1 |
19 | #define EDAC_OPSTATE_POLL 0 | 23 | #define EDAC_OPSTATE_POLL 0 |
@@ -66,25 +70,64 @@ enum dev_type { | |||
66 | #define DEV_FLAG_X32 BIT(DEV_X32) | 70 | #define DEV_FLAG_X32 BIT(DEV_X32) |
67 | #define DEV_FLAG_X64 BIT(DEV_X64) | 71 | #define DEV_FLAG_X64 BIT(DEV_X64) |
68 | 72 | ||
69 | /* memory types */ | 73 | /** |
74 | * enum mem_type - memory types. For a more detailed reference, please see | ||
75 | * http://en.wikipedia.org/wiki/DRAM | ||
76 | * | ||
77 | * @MEM_EMPTY Empty csrow | ||
78 | * @MEM_RESERVED: Reserved csrow type | ||
79 | * @MEM_UNKNOWN: Unknown csrow type | ||
80 | * @MEM_FPM: FPM - Fast Page Mode, used on systems up to 1995. | ||
81 | * @MEM_EDO: EDO - Extended data out, used on systems up to 1998. | ||
82 | * @MEM_BEDO: BEDO - Burst Extended data out, an EDO variant. | ||
83 | * @MEM_SDR: SDR - Single data rate SDRAM | ||
84 | * http://en.wikipedia.org/wiki/Synchronous_dynamic_random-access_memory | ||
85 | * They use 3 pins for chip select: Pins 0 and 2 are | ||
86 | * for rank 0; pins 1 and 3 are for rank 1, if the memory | ||
87 | * is dual-rank. | ||
88 | * @MEM_RDR: Registered SDR SDRAM | ||
89 | * @MEM_DDR: Double data rate SDRAM | ||
90 | * http://en.wikipedia.org/wiki/DDR_SDRAM | ||
91 | * @MEM_RDDR: Registered Double data rate SDRAM | ||
92 | * This is a variant of the DDR memories. | ||
93 | * A registered memory has a buffer inside it, hiding | ||
94 | * part of the memory details to the memory controller. | ||
95 | * @MEM_RMBS: Rambus DRAM, used on a few Pentium III/IV controllers. | ||
96 | * @MEM_DDR2: DDR2 RAM, as described at JEDEC JESD79-2F. | ||
97 | * Those memories are labed as "PC2-" instead of "PC" to | ||
98 | * differenciate from DDR. | ||
99 | * @MEM_FB_DDR2: Fully-Buffered DDR2, as described at JEDEC Std No. 205 | ||
100 | * and JESD206. | ||
101 | * Those memories are accessed per DIMM slot, and not by | ||
102 | * a chip select signal. | ||
103 | * @MEM_RDDR2: Registered DDR2 RAM | ||
104 | * This is a variant of the DDR2 memories. | ||
105 | * @MEM_XDR: Rambus XDR | ||
106 | * It is an evolution of the original RAMBUS memories, | ||
107 | * created to compete with DDR2. Weren't used on any | ||
108 | * x86 arch, but cell_edac PPC memory controller uses it. | ||
109 | * @MEM_DDR3: DDR3 RAM | ||
110 | * @MEM_RDDR3: Registered DDR3 RAM | ||
111 | * This is a variant of the DDR3 memories. | ||
112 | */ | ||
70 | enum mem_type { | 113 | enum mem_type { |
71 | MEM_EMPTY = 0, /* Empty csrow */ | 114 | MEM_EMPTY = 0, |
72 | MEM_RESERVED, /* Reserved csrow type */ | 115 | MEM_RESERVED, |
73 | MEM_UNKNOWN, /* Unknown csrow type */ | 116 | MEM_UNKNOWN, |
74 | MEM_FPM, /* Fast page mode */ | 117 | MEM_FPM, |
75 | MEM_EDO, /* Extended data out */ | 118 | MEM_EDO, |
76 | MEM_BEDO, /* Burst Extended data out */ | 119 | MEM_BEDO, |
77 | MEM_SDR, /* Single data rate SDRAM */ | 120 | MEM_SDR, |
78 | MEM_RDR, /* Registered single data rate SDRAM */ | 121 | MEM_RDR, |
79 | MEM_DDR, /* Double data rate SDRAM */ | 122 | MEM_DDR, |
80 | MEM_RDDR, /* Registered Double data rate SDRAM */ | 123 | MEM_RDDR, |
81 | MEM_RMBS, /* Rambus DRAM */ | 124 | MEM_RMBS, |
82 | MEM_DDR2, /* DDR2 RAM */ | 125 | MEM_DDR2, |
83 | MEM_FB_DDR2, /* fully buffered DDR2 */ | 126 | MEM_FB_DDR2, |
84 | MEM_RDDR2, /* Registered DDR2 RAM */ | 127 | MEM_RDDR2, |
85 | MEM_XDR, /* Rambus XDR */ | 128 | MEM_XDR, |
86 | MEM_DDR3, /* DDR3 RAM */ | 129 | MEM_DDR3, |
87 | MEM_RDDR3, /* Registered DDR3 RAM */ | 130 | MEM_RDDR3, |
88 | }; | 131 | }; |
89 | 132 | ||
90 | #define MEM_FLAG_EMPTY BIT(MEM_EMPTY) | 133 | #define MEM_FLAG_EMPTY BIT(MEM_EMPTY) |
@@ -162,8 +205,9 @@ enum scrub_type { | |||
162 | #define OP_OFFLINE 0x300 | 205 | #define OP_OFFLINE 0x300 |
163 | 206 | ||
164 | /* | 207 | /* |
165 | * There are several things to be aware of that aren't at all obvious: | 208 | * Concepts used at the EDAC subsystem |
166 | * | 209 | * |
210 | * There are several things to be aware of that aren't at all obvious: | ||
167 | * | 211 | * |
168 | * SOCKETS, SOCKET SETS, BANKS, ROWS, CHIP-SELECT ROWS, CHANNELS, etc.. | 212 | * SOCKETS, SOCKET SETS, BANKS, ROWS, CHIP-SELECT ROWS, CHANNELS, etc.. |
169 | * | 213 | * |
@@ -172,36 +216,61 @@ enum scrub_type { | |||
172 | * creating a common ground for discussion, terms and their definitions | 216 | * creating a common ground for discussion, terms and their definitions |
173 | * will be established. | 217 | * will be established. |
174 | * | 218 | * |
175 | * Memory devices: The individual chip on a memory stick. These devices | 219 | * Memory devices: The individual DRAM chips on a memory stick. These |
176 | * commonly output 4 and 8 bits each. Grouping several | 220 | * devices commonly output 4 and 8 bits each (x4, x8). |
177 | * of these in parallel provides 64 bits which is common | 221 | * Grouping several of these in parallel provides the |
178 | * for a memory stick. | 222 | * number of bits that the memory controller expects: |
223 | * typically 72 bits, in order to provide 64 bits + | ||
224 | * 8 bits of ECC data. | ||
179 | * | 225 | * |
180 | * Memory Stick: A printed circuit board that aggregates multiple | 226 | * Memory Stick: A printed circuit board that aggregates multiple |
181 | * memory devices in parallel. This is the atomic | 227 | * memory devices in parallel. In general, this is the |
182 | * memory component that is purchaseable by Joe consumer | 228 | * Field Replaceable Unit (FRU) which gets replaced, in |
183 | * and loaded into a memory socket. | 229 | * the case of excessive errors. Most often it is also |
230 | * called DIMM (Dual Inline Memory Module). | ||
231 | * | ||
232 | * Memory Socket: A physical connector on the motherboard that accepts | ||
233 | * a single memory stick. Also called as "slot" on several | ||
234 | * datasheets. | ||
184 | * | 235 | * |
185 | * Socket: A physical connector on the motherboard that accepts | 236 | * Channel: A memory controller channel, responsible to communicate |
186 | * a single memory stick. | 237 | * with a group of DIMMs. Each channel has its own |
238 | * independent control (command) and data bus, and can | ||
239 | * be used independently or grouped with other channels. | ||
187 | * | 240 | * |
188 | * Channel: Set of memory devices on a memory stick that must be | 241 | * Branch: It is typically the highest hierarchy on a |
189 | * grouped in parallel with one or more additional | 242 | * Fully-Buffered DIMM memory controller. |
190 | * channels from other memory sticks. This parallel | 243 | * Typically, it contains two channels. |
191 | * grouping of the output from multiple channels are | 244 | * Two channels at the same branch can be used in single |
192 | * necessary for the smallest granularity of memory access. | 245 | * mode or in lockstep mode. |
193 | * Some memory controllers are capable of single channel - | 246 | * When lockstep is enabled, the cacheline is doubled, |
194 | * which means that memory sticks can be loaded | 247 | * but it generally brings some performance penalty. |
195 | * individually. Other memory controllers are only | 248 | * Also, it is generally not possible to point to just one |
196 | * capable of dual channel - which means that memory | 249 | * memory stick when an error occurs, as the error |
197 | * sticks must be loaded as pairs (see "socket set"). | 250 | * correction code is calculated using two DIMMs instead |
251 | * of one. Due to that, it is capable of correcting more | ||
252 | * errors than on single mode. | ||
198 | * | 253 | * |
199 | * Chip-select row: All of the memory devices that are selected together. | 254 | * Single-channel: The data accessed by the memory controller is contained |
200 | * for a single, minimum grain of memory access. | 255 | * into one dimm only. E. g. if the data is 64 bits-wide, |
201 | * This selects all of the parallel memory devices across | 256 | * the data flows to the CPU using one 64 bits parallel |
202 | * all of the parallel channels. Common chip-select rows | 257 | * access. |
203 | * for single channel are 64 bits, for dual channel 128 | 258 | * Typically used with SDR, DDR, DDR2 and DDR3 memories. |
204 | * bits. | 259 | * FB-DIMM and RAMBUS use a different concept for channel, |
260 | * so this concept doesn't apply there. | ||
261 | * | ||
262 | * Double-channel: The data size accessed by the memory controller is | ||
263 | * interlaced into two dimms, accessed at the same time. | ||
264 | * E. g. if the DIMM is 64 bits-wide (72 bits with ECC), | ||
265 | * the data flows to the CPU using a 128 bits parallel | ||
266 | * access. | ||
267 | * | ||
268 | * Chip-select row: This is the name of the DRAM signal used to select the | ||
269 | * DRAM ranks to be accessed. Common chip-select rows for | ||
270 | * single channel are 64 bits, for dual channel 128 bits. | ||
271 | * It may not be visible by the memory controller, as some | ||
272 | * DIMM types have a memory buffer that can hide direct | ||
273 | * access to it from the Memory Controller. | ||
205 | * | 274 | * |
206 | * Single-Ranked stick: A Single-ranked stick has 1 chip-select row of memory. | 275 | * Single-Ranked stick: A Single-ranked stick has 1 chip-select row of memory. |
207 | * Motherboards commonly drive two chip-select pins to | 276 | * Motherboards commonly drive two chip-select pins to |
@@ -214,8 +283,8 @@ enum scrub_type { | |||
214 | * | 283 | * |
215 | * Double-sided stick: DEPRECATED TERM, see Double-Ranked stick. | 284 | * Double-sided stick: DEPRECATED TERM, see Double-Ranked stick. |
216 | * A double-sided stick has two chip-select rows which | 285 | * A double-sided stick has two chip-select rows which |
217 | * access different sets of memory devices. The two | 286 | * access different sets of memory devices. The two |
218 | * rows cannot be accessed concurrently. "Double-sided" | 287 | * rows cannot be accessed concurrently. "Double-sided" |
219 | * is irrespective of the memory devices being mounted | 288 | * is irrespective of the memory devices being mounted |
220 | * on both sides of the memory stick. | 289 | * on both sides of the memory stick. |
221 | * | 290 | * |
@@ -243,10 +312,22 @@ enum scrub_type { | |||
243 | * PS - I enjoyed writing all that about as much as you enjoyed reading it. | 312 | * PS - I enjoyed writing all that about as much as you enjoyed reading it. |
244 | */ | 313 | */ |
245 | 314 | ||
246 | struct channel_info { | 315 | /** |
247 | int chan_idx; /* channel index */ | 316 | * struct rank_info - contains the information for one DIMM rank |
248 | u32 ce_count; /* Correctable Errors for this CHANNEL */ | 317 | * |
249 | char label[EDAC_MC_LABEL_LEN + 1]; /* DIMM label on motherboard */ | 318 | * @chan_idx: channel number where the rank is (typically, 0 or 1) |
319 | * @ce_count: number of correctable errors for this rank | ||
320 | * @label: DIMM label. Different ranks for the same DIMM should be | ||
321 | * filled, on userspace, with the same label. | ||
322 | * FIXME: The core currently won't enforce it. | ||
323 | * @csrow: A pointer to the chip select row structure (the parent | ||
324 | * structure). The location of the rank is given by | ||
325 | * the (csrow->csrow_idx, chan_idx) vector. | ||
326 | */ | ||
327 | struct rank_info { | ||
328 | int chan_idx; | ||
329 | u32 ce_count; | ||
330 | char label[EDAC_MC_LABEL_LEN + 1]; | ||
250 | struct csrow_info *csrow; /* the parent */ | 331 | struct csrow_info *csrow; /* the parent */ |
251 | }; | 332 | }; |
252 | 333 | ||
@@ -270,7 +351,7 @@ struct csrow_info { | |||
270 | 351 | ||
271 | /* channel information for this csrow */ | 352 | /* channel information for this csrow */ |
272 | u32 nr_channels; | 353 | u32 nr_channels; |
273 | struct channel_info *channels; | 354 | struct rank_info *channels; |
274 | }; | 355 | }; |
275 | 356 | ||
276 | struct mcidev_sysfs_group { | 357 | struct mcidev_sysfs_group { |
diff --git a/include/linux/efi.h b/include/linux/efi.h index 37c300712e02..88ec80670d5f 100644 --- a/include/linux/efi.h +++ b/include/linux/efi.h | |||
@@ -22,7 +22,6 @@ | |||
22 | #include <linux/pstore.h> | 22 | #include <linux/pstore.h> |
23 | 23 | ||
24 | #include <asm/page.h> | 24 | #include <asm/page.h> |
25 | #include <asm/system.h> | ||
26 | 25 | ||
27 | #define EFI_SUCCESS 0 | 26 | #define EFI_SUCCESS 0 |
28 | #define EFI_LOAD_ERROR ( 1 | (1UL << (BITS_PER_LONG-1))) | 27 | #define EFI_LOAD_ERROR ( 1 | (1UL << (BITS_PER_LONG-1))) |
@@ -315,6 +314,16 @@ typedef efi_status_t efi_query_capsule_caps_t(efi_capsule_header_t **capsules, | |||
315 | 314 | ||
316 | typedef struct { | 315 | typedef struct { |
317 | efi_guid_t guid; | 316 | efi_guid_t guid; |
317 | u64 table; | ||
318 | } efi_config_table_64_t; | ||
319 | |||
320 | typedef struct { | ||
321 | efi_guid_t guid; | ||
322 | u32 table; | ||
323 | } efi_config_table_32_t; | ||
324 | |||
325 | typedef struct { | ||
326 | efi_guid_t guid; | ||
318 | unsigned long table; | 327 | unsigned long table; |
319 | } efi_config_table_t; | 328 | } efi_config_table_t; |
320 | 329 | ||
@@ -329,6 +338,40 @@ typedef struct { | |||
329 | 338 | ||
330 | typedef struct { | 339 | typedef struct { |
331 | efi_table_hdr_t hdr; | 340 | efi_table_hdr_t hdr; |
341 | u64 fw_vendor; /* physical addr of CHAR16 vendor string */ | ||
342 | u32 fw_revision; | ||
343 | u32 __pad1; | ||
344 | u64 con_in_handle; | ||
345 | u64 con_in; | ||
346 | u64 con_out_handle; | ||
347 | u64 con_out; | ||
348 | u64 stderr_handle; | ||
349 | u64 stderr; | ||
350 | u64 runtime; | ||
351 | u64 boottime; | ||
352 | u32 nr_tables; | ||
353 | u32 __pad2; | ||
354 | u64 tables; | ||
355 | } efi_system_table_64_t; | ||
356 | |||
357 | typedef struct { | ||
358 | efi_table_hdr_t hdr; | ||
359 | u32 fw_vendor; /* physical addr of CHAR16 vendor string */ | ||
360 | u32 fw_revision; | ||
361 | u32 con_in_handle; | ||
362 | u32 con_in; | ||
363 | u32 con_out_handle; | ||
364 | u32 con_out; | ||
365 | u32 stderr_handle; | ||
366 | u32 stderr; | ||
367 | u32 runtime; | ||
368 | u32 boottime; | ||
369 | u32 nr_tables; | ||
370 | u32 tables; | ||
371 | } efi_system_table_32_t; | ||
372 | |||
373 | typedef struct { | ||
374 | efi_table_hdr_t hdr; | ||
332 | unsigned long fw_vendor; /* physical addr of CHAR16 vendor string */ | 375 | unsigned long fw_vendor; /* physical addr of CHAR16 vendor string */ |
333 | u32 fw_revision; | 376 | u32 fw_revision; |
334 | unsigned long con_in_handle; | 377 | unsigned long con_in_handle; |
@@ -497,6 +540,7 @@ extern int __init efi_setup_pcdp_console(char *); | |||
497 | #ifdef CONFIG_EFI | 540 | #ifdef CONFIG_EFI |
498 | # ifdef CONFIG_X86 | 541 | # ifdef CONFIG_X86 |
499 | extern int efi_enabled; | 542 | extern int efi_enabled; |
543 | extern bool efi_64bit; | ||
500 | # else | 544 | # else |
501 | # define efi_enabled 1 | 545 | # define efi_enabled 1 |
502 | # endif | 546 | # endif |
diff --git a/include/linux/elfcore.h b/include/linux/elfcore.h index 394a3e0e4a6b..0698c79fbcb2 100644 --- a/include/linux/elfcore.h +++ b/include/linux/elfcore.h | |||
@@ -6,6 +6,7 @@ | |||
6 | #include <linux/time.h> | 6 | #include <linux/time.h> |
7 | #ifdef __KERNEL__ | 7 | #ifdef __KERNEL__ |
8 | #include <linux/user.h> | 8 | #include <linux/user.h> |
9 | #include <linux/bug.h> | ||
9 | #endif | 10 | #endif |
10 | #include <linux/ptrace.h> | 11 | #include <linux/ptrace.h> |
11 | #include <linux/elf.h> | 12 | #include <linux/elf.h> |
diff --git a/include/linux/errno.h b/include/linux/errno.h index 46685832ed99..2d09bfa5c262 100644 --- a/include/linux/errno.h +++ b/include/linux/errno.h | |||
@@ -16,6 +16,7 @@ | |||
16 | #define ERESTARTNOHAND 514 /* restart if no handler.. */ | 16 | #define ERESTARTNOHAND 514 /* restart if no handler.. */ |
17 | #define ENOIOCTLCMD 515 /* No ioctl command */ | 17 | #define ENOIOCTLCMD 515 /* No ioctl command */ |
18 | #define ERESTART_RESTARTBLOCK 516 /* restart by calling sys_restart_syscall */ | 18 | #define ERESTART_RESTARTBLOCK 516 /* restart by calling sys_restart_syscall */ |
19 | #define EPROBE_DEFER 517 /* Driver requests probe retry */ | ||
19 | 20 | ||
20 | /* Defined for the NFSv3 protocol */ | 21 | /* Defined for the NFSv3 protocol */ |
21 | #define EBADHANDLE 521 /* Illegal NFS file handle */ | 22 | #define EBADHANDLE 521 /* Illegal NFS file handle */ |
diff --git a/include/linux/etherdevice.h b/include/linux/etherdevice.h index 05955cf09937..8a1835855faa 100644 --- a/include/linux/etherdevice.h +++ b/include/linux/etherdevice.h | |||
@@ -140,17 +140,18 @@ static inline void random_ether_addr(u8 *addr) | |||
140 | } | 140 | } |
141 | 141 | ||
142 | /** | 142 | /** |
143 | * dev_hw_addr_random - Create random MAC and set device flag | 143 | * eth_hw_addr_random - Generate software assigned random Ethernet and |
144 | * set device flag | ||
144 | * @dev: pointer to net_device structure | 145 | * @dev: pointer to net_device structure |
145 | * @hwaddr: Pointer to a six-byte array containing the Ethernet address | ||
146 | * | 146 | * |
147 | * Generate random MAC to be used by a device and set addr_assign_type | 147 | * Generate a random Ethernet address (MAC) to be used by a net device |
148 | * so the state can be read by sysfs and be used by udev. | 148 | * and set addr_assign_type so the state can be read by sysfs and be |
149 | * used by userspace. | ||
149 | */ | 150 | */ |
150 | static inline void dev_hw_addr_random(struct net_device *dev, u8 *hwaddr) | 151 | static inline void eth_hw_addr_random(struct net_device *dev) |
151 | { | 152 | { |
152 | dev->addr_assign_type |= NET_ADDR_RANDOM; | 153 | dev->addr_assign_type |= NET_ADDR_RANDOM; |
153 | random_ether_addr(hwaddr); | 154 | random_ether_addr(dev->dev_addr); |
154 | } | 155 | } |
155 | 156 | ||
156 | /** | 157 | /** |
diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h index da5b2de99ae4..f5647b59a90e 100644 --- a/include/linux/ethtool.h +++ b/include/linux/ethtool.h | |||
@@ -30,10 +30,15 @@ struct ethtool_cmd { | |||
30 | * access it */ | 30 | * access it */ |
31 | __u8 duplex; /* Duplex, half or full */ | 31 | __u8 duplex; /* Duplex, half or full */ |
32 | __u8 port; /* Which connector port */ | 32 | __u8 port; /* Which connector port */ |
33 | __u8 phy_address; | 33 | __u8 phy_address; /* MDIO PHY address (PRTAD for clause 45). |
34 | * May be read-only or read-write | ||
35 | * depending on the driver. | ||
36 | */ | ||
34 | __u8 transceiver; /* Which transceiver to use */ | 37 | __u8 transceiver; /* Which transceiver to use */ |
35 | __u8 autoneg; /* Enable or disable autonegotiation */ | 38 | __u8 autoneg; /* Enable or disable autonegotiation */ |
36 | __u8 mdio_support; | 39 | __u8 mdio_support; /* MDIO protocols supported. Read-only. |
40 | * Not set by all drivers. | ||
41 | */ | ||
37 | __u32 maxtxpkt; /* Tx pkts before generating tx int */ | 42 | __u32 maxtxpkt; /* Tx pkts before generating tx int */ |
38 | __u32 maxrxpkt; /* Rx pkts before generating rx int */ | 43 | __u32 maxrxpkt; /* Rx pkts before generating rx int */ |
39 | __u16 speed_hi; /* The forced speed (upper | 44 | __u16 speed_hi; /* The forced speed (upper |
@@ -59,6 +64,20 @@ static inline __u32 ethtool_cmd_speed(const struct ethtool_cmd *ep) | |||
59 | return (ep->speed_hi << 16) | ep->speed; | 64 | return (ep->speed_hi << 16) | ep->speed; |
60 | } | 65 | } |
61 | 66 | ||
67 | /* Device supports clause 22 register access to PHY or peripherals | ||
68 | * using the interface defined in <linux/mii.h>. This should not be | ||
69 | * set if there are known to be no such peripherals present or if | ||
70 | * the driver only emulates clause 22 registers for compatibility. | ||
71 | */ | ||
72 | #define ETH_MDIO_SUPPORTS_C22 1 | ||
73 | |||
74 | /* Device supports clause 45 register access to PHY or peripherals | ||
75 | * using the interface defined in <linux/mii.h> and <linux/mdio.h>. | ||
76 | * This should not be set if there are known to be no such peripherals | ||
77 | * present. | ||
78 | */ | ||
79 | #define ETH_MDIO_SUPPORTS_C45 2 | ||
80 | |||
62 | #define ETHTOOL_FWVERS_LEN 32 | 81 | #define ETHTOOL_FWVERS_LEN 32 |
63 | #define ETHTOOL_BUSINFO_LEN 32 | 82 | #define ETHTOOL_BUSINFO_LEN 32 |
64 | /* these strings are set to whatever the driver author decides... */ | 83 | /* these strings are set to whatever the driver author decides... */ |
@@ -877,8 +896,7 @@ static inline u32 ethtool_rxfh_indir_default(u32 index, u32 n_rx_rings) | |||
877 | * | 896 | * |
878 | * All operations are optional (i.e. the function pointer may be set | 897 | * All operations are optional (i.e. the function pointer may be set |
879 | * to %NULL) and callers must take this into account. Callers must | 898 | * to %NULL) and callers must take this into account. Callers must |
880 | * hold the RTNL, except that for @get_drvinfo the caller may or may | 899 | * hold the RTNL lock. |
881 | * not hold the RTNL. | ||
882 | * | 900 | * |
883 | * See the structures used by these operations for further documentation. | 901 | * See the structures used by these operations for further documentation. |
884 | * | 902 | * |
diff --git a/include/linux/ext2_fs.h b/include/linux/ext2_fs.h index ce1b719e8bd4..2723e715f67a 100644 --- a/include/linux/ext2_fs.h +++ b/include/linux/ext2_fs.h | |||
@@ -18,574 +18,25 @@ | |||
18 | 18 | ||
19 | #include <linux/types.h> | 19 | #include <linux/types.h> |
20 | #include <linux/magic.h> | 20 | #include <linux/magic.h> |
21 | #include <linux/fs.h> | ||
22 | 21 | ||
23 | /* | 22 | #define EXT2_NAME_LEN 255 |
24 | * The second extended filesystem constants/structures | ||
25 | */ | ||
26 | |||
27 | /* | ||
28 | * Define EXT2FS_DEBUG to produce debug messages | ||
29 | */ | ||
30 | #undef EXT2FS_DEBUG | ||
31 | |||
32 | /* | ||
33 | * Define EXT2_RESERVATION to reserve data blocks for expanding files | ||
34 | */ | ||
35 | #define EXT2_DEFAULT_RESERVE_BLOCKS 8 | ||
36 | /*max window size: 1024(direct blocks) + 3([t,d]indirect blocks) */ | ||
37 | #define EXT2_MAX_RESERVE_BLOCKS 1027 | ||
38 | #define EXT2_RESERVE_WINDOW_NOT_ALLOCATED 0 | ||
39 | /* | ||
40 | * The second extended file system version | ||
41 | */ | ||
42 | #define EXT2FS_DATE "95/08/09" | ||
43 | #define EXT2FS_VERSION "0.5b" | ||
44 | |||
45 | /* | ||
46 | * Debug code | ||
47 | */ | ||
48 | #ifdef EXT2FS_DEBUG | ||
49 | # define ext2_debug(f, a...) { \ | ||
50 | printk ("EXT2-fs DEBUG (%s, %d): %s:", \ | ||
51 | __FILE__, __LINE__, __func__); \ | ||
52 | printk (f, ## a); \ | ||
53 | } | ||
54 | #else | ||
55 | # define ext2_debug(f, a...) /**/ | ||
56 | #endif | ||
57 | |||
58 | /* | ||
59 | * Special inode numbers | ||
60 | */ | ||
61 | #define EXT2_BAD_INO 1 /* Bad blocks inode */ | ||
62 | #define EXT2_ROOT_INO 2 /* Root inode */ | ||
63 | #define EXT2_BOOT_LOADER_INO 5 /* Boot loader inode */ | ||
64 | #define EXT2_UNDEL_DIR_INO 6 /* Undelete directory inode */ | ||
65 | |||
66 | /* First non-reserved inode for old ext2 filesystems */ | ||
67 | #define EXT2_GOOD_OLD_FIRST_INO 11 | ||
68 | |||
69 | #ifdef __KERNEL__ | ||
70 | #include <linux/ext2_fs_sb.h> | ||
71 | static inline struct ext2_sb_info *EXT2_SB(struct super_block *sb) | ||
72 | { | ||
73 | return sb->s_fs_info; | ||
74 | } | ||
75 | #else | ||
76 | /* Assume that user mode programs are passing in an ext2fs superblock, not | ||
77 | * a kernel struct super_block. This will allow us to call the feature-test | ||
78 | * macros from user land. */ | ||
79 | #define EXT2_SB(sb) (sb) | ||
80 | #endif | ||
81 | 23 | ||
82 | /* | 24 | /* |
83 | * Maximal count of links to a file | 25 | * Maximal count of links to a file |
84 | */ | 26 | */ |
85 | #define EXT2_LINK_MAX 32000 | 27 | #define EXT2_LINK_MAX 32000 |
86 | 28 | ||
87 | /* | 29 | #define EXT2_SB_MAGIC_OFFSET 0x38 |
88 | * Macro-instructions used to manage several block sizes | 30 | #define EXT2_SB_BLOCKS_OFFSET 0x04 |
89 | */ | 31 | #define EXT2_SB_BSIZE_OFFSET 0x18 |
90 | #define EXT2_MIN_BLOCK_SIZE 1024 | ||
91 | #define EXT2_MAX_BLOCK_SIZE 4096 | ||
92 | #define EXT2_MIN_BLOCK_LOG_SIZE 10 | ||
93 | #ifdef __KERNEL__ | ||
94 | # define EXT2_BLOCK_SIZE(s) ((s)->s_blocksize) | ||
95 | #else | ||
96 | # define EXT2_BLOCK_SIZE(s) (EXT2_MIN_BLOCK_SIZE << (s)->s_log_block_size) | ||
97 | #endif | ||
98 | #define EXT2_ADDR_PER_BLOCK(s) (EXT2_BLOCK_SIZE(s) / sizeof (__u32)) | ||
99 | #ifdef __KERNEL__ | ||
100 | # define EXT2_BLOCK_SIZE_BITS(s) ((s)->s_blocksize_bits) | ||
101 | #else | ||
102 | # define EXT2_BLOCK_SIZE_BITS(s) ((s)->s_log_block_size + 10) | ||
103 | #endif | ||
104 | #ifdef __KERNEL__ | ||
105 | #define EXT2_ADDR_PER_BLOCK_BITS(s) (EXT2_SB(s)->s_addr_per_block_bits) | ||
106 | #define EXT2_INODE_SIZE(s) (EXT2_SB(s)->s_inode_size) | ||
107 | #define EXT2_FIRST_INO(s) (EXT2_SB(s)->s_first_ino) | ||
108 | #else | ||
109 | #define EXT2_INODE_SIZE(s) (((s)->s_rev_level == EXT2_GOOD_OLD_REV) ? \ | ||
110 | EXT2_GOOD_OLD_INODE_SIZE : \ | ||
111 | (s)->s_inode_size) | ||
112 | #define EXT2_FIRST_INO(s) (((s)->s_rev_level == EXT2_GOOD_OLD_REV) ? \ | ||
113 | EXT2_GOOD_OLD_FIRST_INO : \ | ||
114 | (s)->s_first_ino) | ||
115 | #endif | ||
116 | 32 | ||
117 | /* | 33 | static inline u64 ext2_image_size(void *ext2_sb) |
118 | * Macro-instructions used to manage fragments | ||
119 | */ | ||
120 | #define EXT2_MIN_FRAG_SIZE 1024 | ||
121 | #define EXT2_MAX_FRAG_SIZE 4096 | ||
122 | #define EXT2_MIN_FRAG_LOG_SIZE 10 | ||
123 | #ifdef __KERNEL__ | ||
124 | # define EXT2_FRAG_SIZE(s) (EXT2_SB(s)->s_frag_size) | ||
125 | # define EXT2_FRAGS_PER_BLOCK(s) (EXT2_SB(s)->s_frags_per_block) | ||
126 | #else | ||
127 | # define EXT2_FRAG_SIZE(s) (EXT2_MIN_FRAG_SIZE << (s)->s_log_frag_size) | ||
128 | # define EXT2_FRAGS_PER_BLOCK(s) (EXT2_BLOCK_SIZE(s) / EXT2_FRAG_SIZE(s)) | ||
129 | #endif | ||
130 | |||
131 | /* | ||
132 | * Structure of a blocks group descriptor | ||
133 | */ | ||
134 | struct ext2_group_desc | ||
135 | { | 34 | { |
136 | __le32 bg_block_bitmap; /* Blocks bitmap block */ | 35 | __u8 *p = ext2_sb; |
137 | __le32 bg_inode_bitmap; /* Inodes bitmap block */ | 36 | if (*(__le16 *)(p + EXT2_SB_MAGIC_OFFSET) != cpu_to_le16(EXT2_SUPER_MAGIC)) |
138 | __le32 bg_inode_table; /* Inodes table block */ | 37 | return 0; |
139 | __le16 bg_free_blocks_count; /* Free blocks count */ | 38 | return (u64)le32_to_cpup((__le32 *)(p + EXT2_SB_BLOCKS_OFFSET)) << |
140 | __le16 bg_free_inodes_count; /* Free inodes count */ | 39 | le32_to_cpup((__le32 *)(p + EXT2_SB_BSIZE_OFFSET)); |
141 | __le16 bg_used_dirs_count; /* Directories count */ | ||
142 | __le16 bg_pad; | ||
143 | __le32 bg_reserved[3]; | ||
144 | }; | ||
145 | |||
146 | /* | ||
147 | * Macro-instructions used to manage group descriptors | ||
148 | */ | ||
149 | #ifdef __KERNEL__ | ||
150 | # define EXT2_BLOCKS_PER_GROUP(s) (EXT2_SB(s)->s_blocks_per_group) | ||
151 | # define EXT2_DESC_PER_BLOCK(s) (EXT2_SB(s)->s_desc_per_block) | ||
152 | # define EXT2_INODES_PER_GROUP(s) (EXT2_SB(s)->s_inodes_per_group) | ||
153 | # define EXT2_DESC_PER_BLOCK_BITS(s) (EXT2_SB(s)->s_desc_per_block_bits) | ||
154 | #else | ||
155 | # define EXT2_BLOCKS_PER_GROUP(s) ((s)->s_blocks_per_group) | ||
156 | # define EXT2_DESC_PER_BLOCK(s) (EXT2_BLOCK_SIZE(s) / sizeof (struct ext2_group_desc)) | ||
157 | # define EXT2_INODES_PER_GROUP(s) ((s)->s_inodes_per_group) | ||
158 | #endif | ||
159 | |||
160 | /* | ||
161 | * Constants relative to the data blocks | ||
162 | */ | ||
163 | #define EXT2_NDIR_BLOCKS 12 | ||
164 | #define EXT2_IND_BLOCK EXT2_NDIR_BLOCKS | ||
165 | #define EXT2_DIND_BLOCK (EXT2_IND_BLOCK + 1) | ||
166 | #define EXT2_TIND_BLOCK (EXT2_DIND_BLOCK + 1) | ||
167 | #define EXT2_N_BLOCKS (EXT2_TIND_BLOCK + 1) | ||
168 | |||
169 | /* | ||
170 | * Inode flags (GETFLAGS/SETFLAGS) | ||
171 | */ | ||
172 | #define EXT2_SECRM_FL FS_SECRM_FL /* Secure deletion */ | ||
173 | #define EXT2_UNRM_FL FS_UNRM_FL /* Undelete */ | ||
174 | #define EXT2_COMPR_FL FS_COMPR_FL /* Compress file */ | ||
175 | #define EXT2_SYNC_FL FS_SYNC_FL /* Synchronous updates */ | ||
176 | #define EXT2_IMMUTABLE_FL FS_IMMUTABLE_FL /* Immutable file */ | ||
177 | #define EXT2_APPEND_FL FS_APPEND_FL /* writes to file may only append */ | ||
178 | #define EXT2_NODUMP_FL FS_NODUMP_FL /* do not dump file */ | ||
179 | #define EXT2_NOATIME_FL FS_NOATIME_FL /* do not update atime */ | ||
180 | /* Reserved for compression usage... */ | ||
181 | #define EXT2_DIRTY_FL FS_DIRTY_FL | ||
182 | #define EXT2_COMPRBLK_FL FS_COMPRBLK_FL /* One or more compressed clusters */ | ||
183 | #define EXT2_NOCOMP_FL FS_NOCOMP_FL /* Don't compress */ | ||
184 | #define EXT2_ECOMPR_FL FS_ECOMPR_FL /* Compression error */ | ||
185 | /* End compression flags --- maybe not all used */ | ||
186 | #define EXT2_BTREE_FL FS_BTREE_FL /* btree format dir */ | ||
187 | #define EXT2_INDEX_FL FS_INDEX_FL /* hash-indexed directory */ | ||
188 | #define EXT2_IMAGIC_FL FS_IMAGIC_FL /* AFS directory */ | ||
189 | #define EXT2_JOURNAL_DATA_FL FS_JOURNAL_DATA_FL /* Reserved for ext3 */ | ||
190 | #define EXT2_NOTAIL_FL FS_NOTAIL_FL /* file tail should not be merged */ | ||
191 | #define EXT2_DIRSYNC_FL FS_DIRSYNC_FL /* dirsync behaviour (directories only) */ | ||
192 | #define EXT2_TOPDIR_FL FS_TOPDIR_FL /* Top of directory hierarchies*/ | ||
193 | #define EXT2_RESERVED_FL FS_RESERVED_FL /* reserved for ext2 lib */ | ||
194 | |||
195 | #define EXT2_FL_USER_VISIBLE FS_FL_USER_VISIBLE /* User visible flags */ | ||
196 | #define EXT2_FL_USER_MODIFIABLE FS_FL_USER_MODIFIABLE /* User modifiable flags */ | ||
197 | |||
198 | /* Flags that should be inherited by new inodes from their parent. */ | ||
199 | #define EXT2_FL_INHERITED (EXT2_SECRM_FL | EXT2_UNRM_FL | EXT2_COMPR_FL |\ | ||
200 | EXT2_SYNC_FL | EXT2_NODUMP_FL |\ | ||
201 | EXT2_NOATIME_FL | EXT2_COMPRBLK_FL |\ | ||
202 | EXT2_NOCOMP_FL | EXT2_JOURNAL_DATA_FL |\ | ||
203 | EXT2_NOTAIL_FL | EXT2_DIRSYNC_FL) | ||
204 | |||
205 | /* Flags that are appropriate for regular files (all but dir-specific ones). */ | ||
206 | #define EXT2_REG_FLMASK (~(EXT2_DIRSYNC_FL | EXT2_TOPDIR_FL)) | ||
207 | |||
208 | /* Flags that are appropriate for non-directories/regular files. */ | ||
209 | #define EXT2_OTHER_FLMASK (EXT2_NODUMP_FL | EXT2_NOATIME_FL) | ||
210 | |||
211 | /* Mask out flags that are inappropriate for the given type of inode. */ | ||
212 | static inline __u32 ext2_mask_flags(umode_t mode, __u32 flags) | ||
213 | { | ||
214 | if (S_ISDIR(mode)) | ||
215 | return flags; | ||
216 | else if (S_ISREG(mode)) | ||
217 | return flags & EXT2_REG_FLMASK; | ||
218 | else | ||
219 | return flags & EXT2_OTHER_FLMASK; | ||
220 | } | 40 | } |
221 | 41 | ||
222 | /* | ||
223 | * ioctl commands | ||
224 | */ | ||
225 | #define EXT2_IOC_GETFLAGS FS_IOC_GETFLAGS | ||
226 | #define EXT2_IOC_SETFLAGS FS_IOC_SETFLAGS | ||
227 | #define EXT2_IOC_GETVERSION FS_IOC_GETVERSION | ||
228 | #define EXT2_IOC_SETVERSION FS_IOC_SETVERSION | ||
229 | #define EXT2_IOC_GETRSVSZ _IOR('f', 5, long) | ||
230 | #define EXT2_IOC_SETRSVSZ _IOW('f', 6, long) | ||
231 | |||
232 | /* | ||
233 | * ioctl commands in 32 bit emulation | ||
234 | */ | ||
235 | #define EXT2_IOC32_GETFLAGS FS_IOC32_GETFLAGS | ||
236 | #define EXT2_IOC32_SETFLAGS FS_IOC32_SETFLAGS | ||
237 | #define EXT2_IOC32_GETVERSION FS_IOC32_GETVERSION | ||
238 | #define EXT2_IOC32_SETVERSION FS_IOC32_SETVERSION | ||
239 | |||
240 | /* | ||
241 | * Structure of an inode on the disk | ||
242 | */ | ||
243 | struct ext2_inode { | ||
244 | __le16 i_mode; /* File mode */ | ||
245 | __le16 i_uid; /* Low 16 bits of Owner Uid */ | ||
246 | __le32 i_size; /* Size in bytes */ | ||
247 | __le32 i_atime; /* Access time */ | ||
248 | __le32 i_ctime; /* Creation time */ | ||
249 | __le32 i_mtime; /* Modification time */ | ||
250 | __le32 i_dtime; /* Deletion Time */ | ||
251 | __le16 i_gid; /* Low 16 bits of Group Id */ | ||
252 | __le16 i_links_count; /* Links count */ | ||
253 | __le32 i_blocks; /* Blocks count */ | ||
254 | __le32 i_flags; /* File flags */ | ||
255 | union { | ||
256 | struct { | ||
257 | __le32 l_i_reserved1; | ||
258 | } linux1; | ||
259 | struct { | ||
260 | __le32 h_i_translator; | ||
261 | } hurd1; | ||
262 | struct { | ||
263 | __le32 m_i_reserved1; | ||
264 | } masix1; | ||
265 | } osd1; /* OS dependent 1 */ | ||
266 | __le32 i_block[EXT2_N_BLOCKS];/* Pointers to blocks */ | ||
267 | __le32 i_generation; /* File version (for NFS) */ | ||
268 | __le32 i_file_acl; /* File ACL */ | ||
269 | __le32 i_dir_acl; /* Directory ACL */ | ||
270 | __le32 i_faddr; /* Fragment address */ | ||
271 | union { | ||
272 | struct { | ||
273 | __u8 l_i_frag; /* Fragment number */ | ||
274 | __u8 l_i_fsize; /* Fragment size */ | ||
275 | __u16 i_pad1; | ||
276 | __le16 l_i_uid_high; /* these 2 fields */ | ||
277 | __le16 l_i_gid_high; /* were reserved2[0] */ | ||
278 | __u32 l_i_reserved2; | ||
279 | } linux2; | ||
280 | struct { | ||
281 | __u8 h_i_frag; /* Fragment number */ | ||
282 | __u8 h_i_fsize; /* Fragment size */ | ||
283 | __le16 h_i_mode_high; | ||
284 | __le16 h_i_uid_high; | ||
285 | __le16 h_i_gid_high; | ||
286 | __le32 h_i_author; | ||
287 | } hurd2; | ||
288 | struct { | ||
289 | __u8 m_i_frag; /* Fragment number */ | ||
290 | __u8 m_i_fsize; /* Fragment size */ | ||
291 | __u16 m_pad1; | ||
292 | __u32 m_i_reserved2[2]; | ||
293 | } masix2; | ||
294 | } osd2; /* OS dependent 2 */ | ||
295 | }; | ||
296 | |||
297 | #define i_size_high i_dir_acl | ||
298 | |||
299 | #if defined(__KERNEL__) || defined(__linux__) | ||
300 | #define i_reserved1 osd1.linux1.l_i_reserved1 | ||
301 | #define i_frag osd2.linux2.l_i_frag | ||
302 | #define i_fsize osd2.linux2.l_i_fsize | ||
303 | #define i_uid_low i_uid | ||
304 | #define i_gid_low i_gid | ||
305 | #define i_uid_high osd2.linux2.l_i_uid_high | ||
306 | #define i_gid_high osd2.linux2.l_i_gid_high | ||
307 | #define i_reserved2 osd2.linux2.l_i_reserved2 | ||
308 | #endif | ||
309 | |||
310 | #ifdef __hurd__ | ||
311 | #define i_translator osd1.hurd1.h_i_translator | ||
312 | #define i_frag osd2.hurd2.h_i_frag | ||
313 | #define i_fsize osd2.hurd2.h_i_fsize | ||
314 | #define i_uid_high osd2.hurd2.h_i_uid_high | ||
315 | #define i_gid_high osd2.hurd2.h_i_gid_high | ||
316 | #define i_author osd2.hurd2.h_i_author | ||
317 | #endif | ||
318 | |||
319 | #ifdef __masix__ | ||
320 | #define i_reserved1 osd1.masix1.m_i_reserved1 | ||
321 | #define i_frag osd2.masix2.m_i_frag | ||
322 | #define i_fsize osd2.masix2.m_i_fsize | ||
323 | #define i_reserved2 osd2.masix2.m_i_reserved2 | ||
324 | #endif | ||
325 | |||
326 | /* | ||
327 | * File system states | ||
328 | */ | ||
329 | #define EXT2_VALID_FS 0x0001 /* Unmounted cleanly */ | ||
330 | #define EXT2_ERROR_FS 0x0002 /* Errors detected */ | ||
331 | |||
332 | /* | ||
333 | * Mount flags | ||
334 | */ | ||
335 | #define EXT2_MOUNT_CHECK 0x000001 /* Do mount-time checks */ | ||
336 | #define EXT2_MOUNT_OLDALLOC 0x000002 /* Don't use the new Orlov allocator */ | ||
337 | #define EXT2_MOUNT_GRPID 0x000004 /* Create files with directory's group */ | ||
338 | #define EXT2_MOUNT_DEBUG 0x000008 /* Some debugging messages */ | ||
339 | #define EXT2_MOUNT_ERRORS_CONT 0x000010 /* Continue on errors */ | ||
340 | #define EXT2_MOUNT_ERRORS_RO 0x000020 /* Remount fs ro on errors */ | ||
341 | #define EXT2_MOUNT_ERRORS_PANIC 0x000040 /* Panic on errors */ | ||
342 | #define EXT2_MOUNT_MINIX_DF 0x000080 /* Mimics the Minix statfs */ | ||
343 | #define EXT2_MOUNT_NOBH 0x000100 /* No buffer_heads */ | ||
344 | #define EXT2_MOUNT_NO_UID32 0x000200 /* Disable 32-bit UIDs */ | ||
345 | #define EXT2_MOUNT_XATTR_USER 0x004000 /* Extended user attributes */ | ||
346 | #define EXT2_MOUNT_POSIX_ACL 0x008000 /* POSIX Access Control Lists */ | ||
347 | #define EXT2_MOUNT_XIP 0x010000 /* Execute in place */ | ||
348 | #define EXT2_MOUNT_USRQUOTA 0x020000 /* user quota */ | ||
349 | #define EXT2_MOUNT_GRPQUOTA 0x040000 /* group quota */ | ||
350 | #define EXT2_MOUNT_RESERVATION 0x080000 /* Preallocation */ | ||
351 | |||
352 | |||
353 | #define clear_opt(o, opt) o &= ~EXT2_MOUNT_##opt | ||
354 | #define set_opt(o, opt) o |= EXT2_MOUNT_##opt | ||
355 | #define test_opt(sb, opt) (EXT2_SB(sb)->s_mount_opt & \ | ||
356 | EXT2_MOUNT_##opt) | ||
357 | /* | ||
358 | * Maximal mount counts between two filesystem checks | ||
359 | */ | ||
360 | #define EXT2_DFL_MAX_MNT_COUNT 20 /* Allow 20 mounts */ | ||
361 | #define EXT2_DFL_CHECKINTERVAL 0 /* Don't use interval check */ | ||
362 | |||
363 | /* | ||
364 | * Behaviour when detecting errors | ||
365 | */ | ||
366 | #define EXT2_ERRORS_CONTINUE 1 /* Continue execution */ | ||
367 | #define EXT2_ERRORS_RO 2 /* Remount fs read-only */ | ||
368 | #define EXT2_ERRORS_PANIC 3 /* Panic */ | ||
369 | #define EXT2_ERRORS_DEFAULT EXT2_ERRORS_CONTINUE | ||
370 | |||
371 | /* | ||
372 | * Structure of the super block | ||
373 | */ | ||
374 | struct ext2_super_block { | ||
375 | __le32 s_inodes_count; /* Inodes count */ | ||
376 | __le32 s_blocks_count; /* Blocks count */ | ||
377 | __le32 s_r_blocks_count; /* Reserved blocks count */ | ||
378 | __le32 s_free_blocks_count; /* Free blocks count */ | ||
379 | __le32 s_free_inodes_count; /* Free inodes count */ | ||
380 | __le32 s_first_data_block; /* First Data Block */ | ||
381 | __le32 s_log_block_size; /* Block size */ | ||
382 | __le32 s_log_frag_size; /* Fragment size */ | ||
383 | __le32 s_blocks_per_group; /* # Blocks per group */ | ||
384 | __le32 s_frags_per_group; /* # Fragments per group */ | ||
385 | __le32 s_inodes_per_group; /* # Inodes per group */ | ||
386 | __le32 s_mtime; /* Mount time */ | ||
387 | __le32 s_wtime; /* Write time */ | ||
388 | __le16 s_mnt_count; /* Mount count */ | ||
389 | __le16 s_max_mnt_count; /* Maximal mount count */ | ||
390 | __le16 s_magic; /* Magic signature */ | ||
391 | __le16 s_state; /* File system state */ | ||
392 | __le16 s_errors; /* Behaviour when detecting errors */ | ||
393 | __le16 s_minor_rev_level; /* minor revision level */ | ||
394 | __le32 s_lastcheck; /* time of last check */ | ||
395 | __le32 s_checkinterval; /* max. time between checks */ | ||
396 | __le32 s_creator_os; /* OS */ | ||
397 | __le32 s_rev_level; /* Revision level */ | ||
398 | __le16 s_def_resuid; /* Default uid for reserved blocks */ | ||
399 | __le16 s_def_resgid; /* Default gid for reserved blocks */ | ||
400 | /* | ||
401 | * These fields are for EXT2_DYNAMIC_REV superblocks only. | ||
402 | * | ||
403 | * Note: the difference between the compatible feature set and | ||
404 | * the incompatible feature set is that if there is a bit set | ||
405 | * in the incompatible feature set that the kernel doesn't | ||
406 | * know about, it should refuse to mount the filesystem. | ||
407 | * | ||
408 | * e2fsck's requirements are more strict; if it doesn't know | ||
409 | * about a feature in either the compatible or incompatible | ||
410 | * feature set, it must abort and not try to meddle with | ||
411 | * things it doesn't understand... | ||
412 | */ | ||
413 | __le32 s_first_ino; /* First non-reserved inode */ | ||
414 | __le16 s_inode_size; /* size of inode structure */ | ||
415 | __le16 s_block_group_nr; /* block group # of this superblock */ | ||
416 | __le32 s_feature_compat; /* compatible feature set */ | ||
417 | __le32 s_feature_incompat; /* incompatible feature set */ | ||
418 | __le32 s_feature_ro_compat; /* readonly-compatible feature set */ | ||
419 | __u8 s_uuid[16]; /* 128-bit uuid for volume */ | ||
420 | char s_volume_name[16]; /* volume name */ | ||
421 | char s_last_mounted[64]; /* directory where last mounted */ | ||
422 | __le32 s_algorithm_usage_bitmap; /* For compression */ | ||
423 | /* | ||
424 | * Performance hints. Directory preallocation should only | ||
425 | * happen if the EXT2_COMPAT_PREALLOC flag is on. | ||
426 | */ | ||
427 | __u8 s_prealloc_blocks; /* Nr of blocks to try to preallocate*/ | ||
428 | __u8 s_prealloc_dir_blocks; /* Nr to preallocate for dirs */ | ||
429 | __u16 s_padding1; | ||
430 | /* | ||
431 | * Journaling support valid if EXT3_FEATURE_COMPAT_HAS_JOURNAL set. | ||
432 | */ | ||
433 | __u8 s_journal_uuid[16]; /* uuid of journal superblock */ | ||
434 | __u32 s_journal_inum; /* inode number of journal file */ | ||
435 | __u32 s_journal_dev; /* device number of journal file */ | ||
436 | __u32 s_last_orphan; /* start of list of inodes to delete */ | ||
437 | __u32 s_hash_seed[4]; /* HTREE hash seed */ | ||
438 | __u8 s_def_hash_version; /* Default hash version to use */ | ||
439 | __u8 s_reserved_char_pad; | ||
440 | __u16 s_reserved_word_pad; | ||
441 | __le32 s_default_mount_opts; | ||
442 | __le32 s_first_meta_bg; /* First metablock block group */ | ||
443 | __u32 s_reserved[190]; /* Padding to the end of the block */ | ||
444 | }; | ||
445 | |||
446 | /* | ||
447 | * Codes for operating systems | ||
448 | */ | ||
449 | #define EXT2_OS_LINUX 0 | ||
450 | #define EXT2_OS_HURD 1 | ||
451 | #define EXT2_OS_MASIX 2 | ||
452 | #define EXT2_OS_FREEBSD 3 | ||
453 | #define EXT2_OS_LITES 4 | ||
454 | |||
455 | /* | ||
456 | * Revision levels | ||
457 | */ | ||
458 | #define EXT2_GOOD_OLD_REV 0 /* The good old (original) format */ | ||
459 | #define EXT2_DYNAMIC_REV 1 /* V2 format w/ dynamic inode sizes */ | ||
460 | |||
461 | #define EXT2_CURRENT_REV EXT2_GOOD_OLD_REV | ||
462 | #define EXT2_MAX_SUPP_REV EXT2_DYNAMIC_REV | ||
463 | |||
464 | #define EXT2_GOOD_OLD_INODE_SIZE 128 | ||
465 | |||
466 | /* | ||
467 | * Feature set definitions | ||
468 | */ | ||
469 | |||
470 | #define EXT2_HAS_COMPAT_FEATURE(sb,mask) \ | ||
471 | ( EXT2_SB(sb)->s_es->s_feature_compat & cpu_to_le32(mask) ) | ||
472 | #define EXT2_HAS_RO_COMPAT_FEATURE(sb,mask) \ | ||
473 | ( EXT2_SB(sb)->s_es->s_feature_ro_compat & cpu_to_le32(mask) ) | ||
474 | #define EXT2_HAS_INCOMPAT_FEATURE(sb,mask) \ | ||
475 | ( EXT2_SB(sb)->s_es->s_feature_incompat & cpu_to_le32(mask) ) | ||
476 | #define EXT2_SET_COMPAT_FEATURE(sb,mask) \ | ||
477 | EXT2_SB(sb)->s_es->s_feature_compat |= cpu_to_le32(mask) | ||
478 | #define EXT2_SET_RO_COMPAT_FEATURE(sb,mask) \ | ||
479 | EXT2_SB(sb)->s_es->s_feature_ro_compat |= cpu_to_le32(mask) | ||
480 | #define EXT2_SET_INCOMPAT_FEATURE(sb,mask) \ | ||
481 | EXT2_SB(sb)->s_es->s_feature_incompat |= cpu_to_le32(mask) | ||
482 | #define EXT2_CLEAR_COMPAT_FEATURE(sb,mask) \ | ||
483 | EXT2_SB(sb)->s_es->s_feature_compat &= ~cpu_to_le32(mask) | ||
484 | #define EXT2_CLEAR_RO_COMPAT_FEATURE(sb,mask) \ | ||
485 | EXT2_SB(sb)->s_es->s_feature_ro_compat &= ~cpu_to_le32(mask) | ||
486 | #define EXT2_CLEAR_INCOMPAT_FEATURE(sb,mask) \ | ||
487 | EXT2_SB(sb)->s_es->s_feature_incompat &= ~cpu_to_le32(mask) | ||
488 | |||
489 | #define EXT2_FEATURE_COMPAT_DIR_PREALLOC 0x0001 | ||
490 | #define EXT2_FEATURE_COMPAT_IMAGIC_INODES 0x0002 | ||
491 | #define EXT3_FEATURE_COMPAT_HAS_JOURNAL 0x0004 | ||
492 | #define EXT2_FEATURE_COMPAT_EXT_ATTR 0x0008 | ||
493 | #define EXT2_FEATURE_COMPAT_RESIZE_INO 0x0010 | ||
494 | #define EXT2_FEATURE_COMPAT_DIR_INDEX 0x0020 | ||
495 | #define EXT2_FEATURE_COMPAT_ANY 0xffffffff | ||
496 | |||
497 | #define EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER 0x0001 | ||
498 | #define EXT2_FEATURE_RO_COMPAT_LARGE_FILE 0x0002 | ||
499 | #define EXT2_FEATURE_RO_COMPAT_BTREE_DIR 0x0004 | ||
500 | #define EXT2_FEATURE_RO_COMPAT_ANY 0xffffffff | ||
501 | |||
502 | #define EXT2_FEATURE_INCOMPAT_COMPRESSION 0x0001 | ||
503 | #define EXT2_FEATURE_INCOMPAT_FILETYPE 0x0002 | ||
504 | #define EXT3_FEATURE_INCOMPAT_RECOVER 0x0004 | ||
505 | #define EXT3_FEATURE_INCOMPAT_JOURNAL_DEV 0x0008 | ||
506 | #define EXT2_FEATURE_INCOMPAT_META_BG 0x0010 | ||
507 | #define EXT2_FEATURE_INCOMPAT_ANY 0xffffffff | ||
508 | |||
509 | #define EXT2_FEATURE_COMPAT_SUPP EXT2_FEATURE_COMPAT_EXT_ATTR | ||
510 | #define EXT2_FEATURE_INCOMPAT_SUPP (EXT2_FEATURE_INCOMPAT_FILETYPE| \ | ||
511 | EXT2_FEATURE_INCOMPAT_META_BG) | ||
512 | #define EXT2_FEATURE_RO_COMPAT_SUPP (EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER| \ | ||
513 | EXT2_FEATURE_RO_COMPAT_LARGE_FILE| \ | ||
514 | EXT2_FEATURE_RO_COMPAT_BTREE_DIR) | ||
515 | #define EXT2_FEATURE_RO_COMPAT_UNSUPPORTED ~EXT2_FEATURE_RO_COMPAT_SUPP | ||
516 | #define EXT2_FEATURE_INCOMPAT_UNSUPPORTED ~EXT2_FEATURE_INCOMPAT_SUPP | ||
517 | |||
518 | /* | ||
519 | * Default values for user and/or group using reserved blocks | ||
520 | */ | ||
521 | #define EXT2_DEF_RESUID 0 | ||
522 | #define EXT2_DEF_RESGID 0 | ||
523 | |||
524 | /* | ||
525 | * Default mount options | ||
526 | */ | ||
527 | #define EXT2_DEFM_DEBUG 0x0001 | ||
528 | #define EXT2_DEFM_BSDGROUPS 0x0002 | ||
529 | #define EXT2_DEFM_XATTR_USER 0x0004 | ||
530 | #define EXT2_DEFM_ACL 0x0008 | ||
531 | #define EXT2_DEFM_UID16 0x0010 | ||
532 | /* Not used by ext2, but reserved for use by ext3 */ | ||
533 | #define EXT3_DEFM_JMODE 0x0060 | ||
534 | #define EXT3_DEFM_JMODE_DATA 0x0020 | ||
535 | #define EXT3_DEFM_JMODE_ORDERED 0x0040 | ||
536 | #define EXT3_DEFM_JMODE_WBACK 0x0060 | ||
537 | |||
538 | /* | ||
539 | * Structure of a directory entry | ||
540 | */ | ||
541 | #define EXT2_NAME_LEN 255 | ||
542 | |||
543 | struct ext2_dir_entry { | ||
544 | __le32 inode; /* Inode number */ | ||
545 | __le16 rec_len; /* Directory entry length */ | ||
546 | __le16 name_len; /* Name length */ | ||
547 | char name[EXT2_NAME_LEN]; /* File name */ | ||
548 | }; | ||
549 | |||
550 | /* | ||
551 | * The new version of the directory entry. Since EXT2 structures are | ||
552 | * stored in intel byte order, and the name_len field could never be | ||
553 | * bigger than 255 chars, it's safe to reclaim the extra byte for the | ||
554 | * file_type field. | ||
555 | */ | ||
556 | struct ext2_dir_entry_2 { | ||
557 | __le32 inode; /* Inode number */ | ||
558 | __le16 rec_len; /* Directory entry length */ | ||
559 | __u8 name_len; /* Name length */ | ||
560 | __u8 file_type; | ||
561 | char name[EXT2_NAME_LEN]; /* File name */ | ||
562 | }; | ||
563 | |||
564 | /* | ||
565 | * Ext2 directory file types. Only the low 3 bits are used. The | ||
566 | * other bits are reserved for now. | ||
567 | */ | ||
568 | enum { | ||
569 | EXT2_FT_UNKNOWN = 0, | ||
570 | EXT2_FT_REG_FILE = 1, | ||
571 | EXT2_FT_DIR = 2, | ||
572 | EXT2_FT_CHRDEV = 3, | ||
573 | EXT2_FT_BLKDEV = 4, | ||
574 | EXT2_FT_FIFO = 5, | ||
575 | EXT2_FT_SOCK = 6, | ||
576 | EXT2_FT_SYMLINK = 7, | ||
577 | EXT2_FT_MAX | ||
578 | }; | ||
579 | |||
580 | /* | ||
581 | * EXT2_DIR_PAD defines the directory entries boundaries | ||
582 | * | ||
583 | * NOTE: It must be a multiple of 4 | ||
584 | */ | ||
585 | #define EXT2_DIR_PAD 4 | ||
586 | #define EXT2_DIR_ROUND (EXT2_DIR_PAD - 1) | ||
587 | #define EXT2_DIR_REC_LEN(name_len) (((name_len) + 8 + EXT2_DIR_ROUND) & \ | ||
588 | ~EXT2_DIR_ROUND) | ||
589 | #define EXT2_MAX_REC_LEN ((1<<16)-1) | ||
590 | |||
591 | #endif /* _LINUX_EXT2_FS_H */ | 42 | #endif /* _LINUX_EXT2_FS_H */ |
diff --git a/include/linux/ext2_fs_sb.h b/include/linux/ext2_fs_sb.h deleted file mode 100644 index db4d9f586bb6..000000000000 --- a/include/linux/ext2_fs_sb.h +++ /dev/null | |||
@@ -1,126 +0,0 @@ | |||
1 | /* | ||
2 | * linux/include/linux/ext2_fs_sb.h | ||
3 | * | ||
4 | * Copyright (C) 1992, 1993, 1994, 1995 | ||
5 | * Remy Card (card@masi.ibp.fr) | ||
6 | * Laboratoire MASI - Institut Blaise Pascal | ||
7 | * Universite Pierre et Marie Curie (Paris VI) | ||
8 | * | ||
9 | * from | ||
10 | * | ||
11 | * linux/include/linux/minix_fs_sb.h | ||
12 | * | ||
13 | * Copyright (C) 1991, 1992 Linus Torvalds | ||
14 | */ | ||
15 | |||
16 | #ifndef _LINUX_EXT2_FS_SB | ||
17 | #define _LINUX_EXT2_FS_SB | ||
18 | |||
19 | #include <linux/blockgroup_lock.h> | ||
20 | #include <linux/percpu_counter.h> | ||
21 | #include <linux/rbtree.h> | ||
22 | |||
23 | /* XXX Here for now... not interested in restructing headers JUST now */ | ||
24 | |||
25 | /* data type for block offset of block group */ | ||
26 | typedef int ext2_grpblk_t; | ||
27 | |||
28 | /* data type for filesystem-wide blocks number */ | ||
29 | typedef unsigned long ext2_fsblk_t; | ||
30 | |||
31 | #define E2FSBLK "%lu" | ||
32 | |||
33 | struct ext2_reserve_window { | ||
34 | ext2_fsblk_t _rsv_start; /* First byte reserved */ | ||
35 | ext2_fsblk_t _rsv_end; /* Last byte reserved or 0 */ | ||
36 | }; | ||
37 | |||
38 | struct ext2_reserve_window_node { | ||
39 | struct rb_node rsv_node; | ||
40 | __u32 rsv_goal_size; | ||
41 | __u32 rsv_alloc_hit; | ||
42 | struct ext2_reserve_window rsv_window; | ||
43 | }; | ||
44 | |||
45 | struct ext2_block_alloc_info { | ||
46 | /* information about reservation window */ | ||
47 | struct ext2_reserve_window_node rsv_window_node; | ||
48 | /* | ||
49 | * was i_next_alloc_block in ext2_inode_info | ||
50 | * is the logical (file-relative) number of the | ||
51 | * most-recently-allocated block in this file. | ||
52 | * We use this for detecting linearly ascending allocation requests. | ||
53 | */ | ||
54 | __u32 last_alloc_logical_block; | ||
55 | /* | ||
56 | * Was i_next_alloc_goal in ext2_inode_info | ||
57 | * is the *physical* companion to i_next_alloc_block. | ||
58 | * it the the physical block number of the block which was most-recentl | ||
59 | * allocated to this file. This give us the goal (target) for the next | ||
60 | * allocation when we detect linearly ascending requests. | ||
61 | */ | ||
62 | ext2_fsblk_t last_alloc_physical_block; | ||
63 | }; | ||
64 | |||
65 | #define rsv_start rsv_window._rsv_start | ||
66 | #define rsv_end rsv_window._rsv_end | ||
67 | |||
68 | /* | ||
69 | * second extended-fs super-block data in memory | ||
70 | */ | ||
71 | struct ext2_sb_info { | ||
72 | unsigned long s_frag_size; /* Size of a fragment in bytes */ | ||
73 | unsigned long s_frags_per_block;/* Number of fragments per block */ | ||
74 | unsigned long s_inodes_per_block;/* Number of inodes per block */ | ||
75 | unsigned long s_frags_per_group;/* Number of fragments in a group */ | ||
76 | unsigned long s_blocks_per_group;/* Number of blocks in a group */ | ||
77 | unsigned long s_inodes_per_group;/* Number of inodes in a group */ | ||
78 | unsigned long s_itb_per_group; /* Number of inode table blocks per group */ | ||
79 | unsigned long s_gdb_count; /* Number of group descriptor blocks */ | ||
80 | unsigned long s_desc_per_block; /* Number of group descriptors per block */ | ||
81 | unsigned long s_groups_count; /* Number of groups in the fs */ | ||
82 | unsigned long s_overhead_last; /* Last calculated overhead */ | ||
83 | unsigned long s_blocks_last; /* Last seen block count */ | ||
84 | struct buffer_head * s_sbh; /* Buffer containing the super block */ | ||
85 | struct ext2_super_block * s_es; /* Pointer to the super block in the buffer */ | ||
86 | struct buffer_head ** s_group_desc; | ||
87 | unsigned long s_mount_opt; | ||
88 | unsigned long s_sb_block; | ||
89 | uid_t s_resuid; | ||
90 | gid_t s_resgid; | ||
91 | unsigned short s_mount_state; | ||
92 | unsigned short s_pad; | ||
93 | int s_addr_per_block_bits; | ||
94 | int s_desc_per_block_bits; | ||
95 | int s_inode_size; | ||
96 | int s_first_ino; | ||
97 | spinlock_t s_next_gen_lock; | ||
98 | u32 s_next_generation; | ||
99 | unsigned long s_dir_count; | ||
100 | u8 *s_debts; | ||
101 | struct percpu_counter s_freeblocks_counter; | ||
102 | struct percpu_counter s_freeinodes_counter; | ||
103 | struct percpu_counter s_dirs_counter; | ||
104 | struct blockgroup_lock *s_blockgroup_lock; | ||
105 | /* root of the per fs reservation window tree */ | ||
106 | spinlock_t s_rsv_window_lock; | ||
107 | struct rb_root s_rsv_window_root; | ||
108 | struct ext2_reserve_window_node s_rsv_window_head; | ||
109 | /* | ||
110 | * s_lock protects against concurrent modifications of s_mount_state, | ||
111 | * s_blocks_last, s_overhead_last and the content of superblock's | ||
112 | * buffer pointed to by sbi->s_es. | ||
113 | * | ||
114 | * Note: It is used in ext2_show_options() to provide a consistent view | ||
115 | * of the mount options. | ||
116 | */ | ||
117 | spinlock_t s_lock; | ||
118 | }; | ||
119 | |||
120 | static inline spinlock_t * | ||
121 | sb_bgl_lock(struct ext2_sb_info *sbi, unsigned int block_group) | ||
122 | { | ||
123 | return bgl_lock_ptr(sbi->s_blockgroup_lock, block_group); | ||
124 | } | ||
125 | |||
126 | #endif /* _LINUX_EXT2_FS_SB */ | ||
diff --git a/include/linux/ext3_fs.h b/include/linux/ext3_fs.h deleted file mode 100644 index f957085d40ed..000000000000 --- a/include/linux/ext3_fs.h +++ /dev/null | |||
@@ -1,979 +0,0 @@ | |||
1 | /* | ||
2 | * linux/include/linux/ext3_fs.h | ||
3 | * | ||
4 | * Copyright (C) 1992, 1993, 1994, 1995 | ||
5 | * Remy Card (card@masi.ibp.fr) | ||
6 | * Laboratoire MASI - Institut Blaise Pascal | ||
7 | * Universite Pierre et Marie Curie (Paris VI) | ||
8 | * | ||
9 | * from | ||
10 | * | ||
11 | * linux/include/linux/minix_fs.h | ||
12 | * | ||
13 | * Copyright (C) 1991, 1992 Linus Torvalds | ||
14 | */ | ||
15 | |||
16 | #ifndef _LINUX_EXT3_FS_H | ||
17 | #define _LINUX_EXT3_FS_H | ||
18 | |||
19 | #include <linux/types.h> | ||
20 | #include <linux/magic.h> | ||
21 | |||
22 | /* | ||
23 | * The second extended filesystem constants/structures | ||
24 | */ | ||
25 | |||
26 | /* | ||
27 | * Define EXT3FS_DEBUG to produce debug messages | ||
28 | */ | ||
29 | #undef EXT3FS_DEBUG | ||
30 | |||
31 | /* | ||
32 | * Define EXT3_RESERVATION to reserve data blocks for expanding files | ||
33 | */ | ||
34 | #define EXT3_DEFAULT_RESERVE_BLOCKS 8 | ||
35 | /*max window size: 1024(direct blocks) + 3([t,d]indirect blocks) */ | ||
36 | #define EXT3_MAX_RESERVE_BLOCKS 1027 | ||
37 | #define EXT3_RESERVE_WINDOW_NOT_ALLOCATED 0 | ||
38 | |||
39 | /* | ||
40 | * Debug code | ||
41 | */ | ||
42 | #ifdef EXT3FS_DEBUG | ||
43 | #define ext3_debug(f, a...) \ | ||
44 | do { \ | ||
45 | printk (KERN_DEBUG "EXT3-fs DEBUG (%s, %d): %s:", \ | ||
46 | __FILE__, __LINE__, __func__); \ | ||
47 | printk (KERN_DEBUG f, ## a); \ | ||
48 | } while (0) | ||
49 | #else | ||
50 | #define ext3_debug(f, a...) do {} while (0) | ||
51 | #endif | ||
52 | |||
53 | /* | ||
54 | * Special inodes numbers | ||
55 | */ | ||
56 | #define EXT3_BAD_INO 1 /* Bad blocks inode */ | ||
57 | #define EXT3_ROOT_INO 2 /* Root inode */ | ||
58 | #define EXT3_BOOT_LOADER_INO 5 /* Boot loader inode */ | ||
59 | #define EXT3_UNDEL_DIR_INO 6 /* Undelete directory inode */ | ||
60 | #define EXT3_RESIZE_INO 7 /* Reserved group descriptors inode */ | ||
61 | #define EXT3_JOURNAL_INO 8 /* Journal inode */ | ||
62 | |||
63 | /* First non-reserved inode for old ext3 filesystems */ | ||
64 | #define EXT3_GOOD_OLD_FIRST_INO 11 | ||
65 | |||
66 | /* | ||
67 | * Maximal count of links to a file | ||
68 | */ | ||
69 | #define EXT3_LINK_MAX 32000 | ||
70 | |||
71 | /* | ||
72 | * Macro-instructions used to manage several block sizes | ||
73 | */ | ||
74 | #define EXT3_MIN_BLOCK_SIZE 1024 | ||
75 | #define EXT3_MAX_BLOCK_SIZE 65536 | ||
76 | #define EXT3_MIN_BLOCK_LOG_SIZE 10 | ||
77 | #ifdef __KERNEL__ | ||
78 | # define EXT3_BLOCK_SIZE(s) ((s)->s_blocksize) | ||
79 | #else | ||
80 | # define EXT3_BLOCK_SIZE(s) (EXT3_MIN_BLOCK_SIZE << (s)->s_log_block_size) | ||
81 | #endif | ||
82 | #define EXT3_ADDR_PER_BLOCK(s) (EXT3_BLOCK_SIZE(s) / sizeof (__u32)) | ||
83 | #ifdef __KERNEL__ | ||
84 | # define EXT3_BLOCK_SIZE_BITS(s) ((s)->s_blocksize_bits) | ||
85 | #else | ||
86 | # define EXT3_BLOCK_SIZE_BITS(s) ((s)->s_log_block_size + 10) | ||
87 | #endif | ||
88 | #ifdef __KERNEL__ | ||
89 | #define EXT3_ADDR_PER_BLOCK_BITS(s) (EXT3_SB(s)->s_addr_per_block_bits) | ||
90 | #define EXT3_INODE_SIZE(s) (EXT3_SB(s)->s_inode_size) | ||
91 | #define EXT3_FIRST_INO(s) (EXT3_SB(s)->s_first_ino) | ||
92 | #else | ||
93 | #define EXT3_INODE_SIZE(s) (((s)->s_rev_level == EXT3_GOOD_OLD_REV) ? \ | ||
94 | EXT3_GOOD_OLD_INODE_SIZE : \ | ||
95 | (s)->s_inode_size) | ||
96 | #define EXT3_FIRST_INO(s) (((s)->s_rev_level == EXT3_GOOD_OLD_REV) ? \ | ||
97 | EXT3_GOOD_OLD_FIRST_INO : \ | ||
98 | (s)->s_first_ino) | ||
99 | #endif | ||
100 | |||
101 | /* | ||
102 | * Macro-instructions used to manage fragments | ||
103 | */ | ||
104 | #define EXT3_MIN_FRAG_SIZE 1024 | ||
105 | #define EXT3_MAX_FRAG_SIZE 4096 | ||
106 | #define EXT3_MIN_FRAG_LOG_SIZE 10 | ||
107 | #ifdef __KERNEL__ | ||
108 | # define EXT3_FRAG_SIZE(s) (EXT3_SB(s)->s_frag_size) | ||
109 | # define EXT3_FRAGS_PER_BLOCK(s) (EXT3_SB(s)->s_frags_per_block) | ||
110 | #else | ||
111 | # define EXT3_FRAG_SIZE(s) (EXT3_MIN_FRAG_SIZE << (s)->s_log_frag_size) | ||
112 | # define EXT3_FRAGS_PER_BLOCK(s) (EXT3_BLOCK_SIZE(s) / EXT3_FRAG_SIZE(s)) | ||
113 | #endif | ||
114 | |||
115 | /* | ||
116 | * Structure of a blocks group descriptor | ||
117 | */ | ||
118 | struct ext3_group_desc | ||
119 | { | ||
120 | __le32 bg_block_bitmap; /* Blocks bitmap block */ | ||
121 | __le32 bg_inode_bitmap; /* Inodes bitmap block */ | ||
122 | __le32 bg_inode_table; /* Inodes table block */ | ||
123 | __le16 bg_free_blocks_count; /* Free blocks count */ | ||
124 | __le16 bg_free_inodes_count; /* Free inodes count */ | ||
125 | __le16 bg_used_dirs_count; /* Directories count */ | ||
126 | __u16 bg_pad; | ||
127 | __le32 bg_reserved[3]; | ||
128 | }; | ||
129 | |||
130 | /* | ||
131 | * Macro-instructions used to manage group descriptors | ||
132 | */ | ||
133 | #ifdef __KERNEL__ | ||
134 | # define EXT3_BLOCKS_PER_GROUP(s) (EXT3_SB(s)->s_blocks_per_group) | ||
135 | # define EXT3_DESC_PER_BLOCK(s) (EXT3_SB(s)->s_desc_per_block) | ||
136 | # define EXT3_INODES_PER_GROUP(s) (EXT3_SB(s)->s_inodes_per_group) | ||
137 | # define EXT3_DESC_PER_BLOCK_BITS(s) (EXT3_SB(s)->s_desc_per_block_bits) | ||
138 | #else | ||
139 | # define EXT3_BLOCKS_PER_GROUP(s) ((s)->s_blocks_per_group) | ||
140 | # define EXT3_DESC_PER_BLOCK(s) (EXT3_BLOCK_SIZE(s) / sizeof (struct ext3_group_desc)) | ||
141 | # define EXT3_INODES_PER_GROUP(s) ((s)->s_inodes_per_group) | ||
142 | #endif | ||
143 | |||
144 | /* | ||
145 | * Constants relative to the data blocks | ||
146 | */ | ||
147 | #define EXT3_NDIR_BLOCKS 12 | ||
148 | #define EXT3_IND_BLOCK EXT3_NDIR_BLOCKS | ||
149 | #define EXT3_DIND_BLOCK (EXT3_IND_BLOCK + 1) | ||
150 | #define EXT3_TIND_BLOCK (EXT3_DIND_BLOCK + 1) | ||
151 | #define EXT3_N_BLOCKS (EXT3_TIND_BLOCK + 1) | ||
152 | |||
153 | /* | ||
154 | * Inode flags | ||
155 | */ | ||
156 | #define EXT3_SECRM_FL 0x00000001 /* Secure deletion */ | ||
157 | #define EXT3_UNRM_FL 0x00000002 /* Undelete */ | ||
158 | #define EXT3_COMPR_FL 0x00000004 /* Compress file */ | ||
159 | #define EXT3_SYNC_FL 0x00000008 /* Synchronous updates */ | ||
160 | #define EXT3_IMMUTABLE_FL 0x00000010 /* Immutable file */ | ||
161 | #define EXT3_APPEND_FL 0x00000020 /* writes to file may only append */ | ||
162 | #define EXT3_NODUMP_FL 0x00000040 /* do not dump file */ | ||
163 | #define EXT3_NOATIME_FL 0x00000080 /* do not update atime */ | ||
164 | /* Reserved for compression usage... */ | ||
165 | #define EXT3_DIRTY_FL 0x00000100 | ||
166 | #define EXT3_COMPRBLK_FL 0x00000200 /* One or more compressed clusters */ | ||
167 | #define EXT3_NOCOMPR_FL 0x00000400 /* Don't compress */ | ||
168 | #define EXT3_ECOMPR_FL 0x00000800 /* Compression error */ | ||
169 | /* End compression flags --- maybe not all used */ | ||
170 | #define EXT3_INDEX_FL 0x00001000 /* hash-indexed directory */ | ||
171 | #define EXT3_IMAGIC_FL 0x00002000 /* AFS directory */ | ||
172 | #define EXT3_JOURNAL_DATA_FL 0x00004000 /* file data should be journaled */ | ||
173 | #define EXT3_NOTAIL_FL 0x00008000 /* file tail should not be merged */ | ||
174 | #define EXT3_DIRSYNC_FL 0x00010000 /* dirsync behaviour (directories only) */ | ||
175 | #define EXT3_TOPDIR_FL 0x00020000 /* Top of directory hierarchies*/ | ||
176 | #define EXT3_RESERVED_FL 0x80000000 /* reserved for ext3 lib */ | ||
177 | |||
178 | #define EXT3_FL_USER_VISIBLE 0x0003DFFF /* User visible flags */ | ||
179 | #define EXT3_FL_USER_MODIFIABLE 0x000380FF /* User modifiable flags */ | ||
180 | |||
181 | /* Flags that should be inherited by new inodes from their parent. */ | ||
182 | #define EXT3_FL_INHERITED (EXT3_SECRM_FL | EXT3_UNRM_FL | EXT3_COMPR_FL |\ | ||
183 | EXT3_SYNC_FL | EXT3_NODUMP_FL |\ | ||
184 | EXT3_NOATIME_FL | EXT3_COMPRBLK_FL |\ | ||
185 | EXT3_NOCOMPR_FL | EXT3_JOURNAL_DATA_FL |\ | ||
186 | EXT3_NOTAIL_FL | EXT3_DIRSYNC_FL) | ||
187 | |||
188 | /* Flags that are appropriate for regular files (all but dir-specific ones). */ | ||
189 | #define EXT3_REG_FLMASK (~(EXT3_DIRSYNC_FL | EXT3_TOPDIR_FL)) | ||
190 | |||
191 | /* Flags that are appropriate for non-directories/regular files. */ | ||
192 | #define EXT3_OTHER_FLMASK (EXT3_NODUMP_FL | EXT3_NOATIME_FL) | ||
193 | |||
194 | /* Mask out flags that are inappropriate for the given type of inode. */ | ||
195 | static inline __u32 ext3_mask_flags(umode_t mode, __u32 flags) | ||
196 | { | ||
197 | if (S_ISDIR(mode)) | ||
198 | return flags; | ||
199 | else if (S_ISREG(mode)) | ||
200 | return flags & EXT3_REG_FLMASK; | ||
201 | else | ||
202 | return flags & EXT3_OTHER_FLMASK; | ||
203 | } | ||
204 | |||
205 | /* Used to pass group descriptor data when online resize is done */ | ||
206 | struct ext3_new_group_input { | ||
207 | __u32 group; /* Group number for this data */ | ||
208 | __u32 block_bitmap; /* Absolute block number of block bitmap */ | ||
209 | __u32 inode_bitmap; /* Absolute block number of inode bitmap */ | ||
210 | __u32 inode_table; /* Absolute block number of inode table start */ | ||
211 | __u32 blocks_count; /* Total number of blocks in this group */ | ||
212 | __u16 reserved_blocks; /* Number of reserved blocks in this group */ | ||
213 | __u16 unused; | ||
214 | }; | ||
215 | |||
216 | /* The struct ext3_new_group_input in kernel space, with free_blocks_count */ | ||
217 | struct ext3_new_group_data { | ||
218 | __u32 group; | ||
219 | __u32 block_bitmap; | ||
220 | __u32 inode_bitmap; | ||
221 | __u32 inode_table; | ||
222 | __u32 blocks_count; | ||
223 | __u16 reserved_blocks; | ||
224 | __u16 unused; | ||
225 | __u32 free_blocks_count; | ||
226 | }; | ||
227 | |||
228 | |||
229 | /* | ||
230 | * ioctl commands | ||
231 | */ | ||
232 | #define EXT3_IOC_GETFLAGS FS_IOC_GETFLAGS | ||
233 | #define EXT3_IOC_SETFLAGS FS_IOC_SETFLAGS | ||
234 | #define EXT3_IOC_GETVERSION _IOR('f', 3, long) | ||
235 | #define EXT3_IOC_SETVERSION _IOW('f', 4, long) | ||
236 | #define EXT3_IOC_GROUP_EXTEND _IOW('f', 7, unsigned long) | ||
237 | #define EXT3_IOC_GROUP_ADD _IOW('f', 8,struct ext3_new_group_input) | ||
238 | #define EXT3_IOC_GETVERSION_OLD FS_IOC_GETVERSION | ||
239 | #define EXT3_IOC_SETVERSION_OLD FS_IOC_SETVERSION | ||
240 | #ifdef CONFIG_JBD_DEBUG | ||
241 | #define EXT3_IOC_WAIT_FOR_READONLY _IOR('f', 99, long) | ||
242 | #endif | ||
243 | #define EXT3_IOC_GETRSVSZ _IOR('f', 5, long) | ||
244 | #define EXT3_IOC_SETRSVSZ _IOW('f', 6, long) | ||
245 | |||
246 | /* | ||
247 | * ioctl commands in 32 bit emulation | ||
248 | */ | ||
249 | #define EXT3_IOC32_GETFLAGS FS_IOC32_GETFLAGS | ||
250 | #define EXT3_IOC32_SETFLAGS FS_IOC32_SETFLAGS | ||
251 | #define EXT3_IOC32_GETVERSION _IOR('f', 3, int) | ||
252 | #define EXT3_IOC32_SETVERSION _IOW('f', 4, int) | ||
253 | #define EXT3_IOC32_GETRSVSZ _IOR('f', 5, int) | ||
254 | #define EXT3_IOC32_SETRSVSZ _IOW('f', 6, int) | ||
255 | #define EXT3_IOC32_GROUP_EXTEND _IOW('f', 7, unsigned int) | ||
256 | #ifdef CONFIG_JBD_DEBUG | ||
257 | #define EXT3_IOC32_WAIT_FOR_READONLY _IOR('f', 99, int) | ||
258 | #endif | ||
259 | #define EXT3_IOC32_GETVERSION_OLD FS_IOC32_GETVERSION | ||
260 | #define EXT3_IOC32_SETVERSION_OLD FS_IOC32_SETVERSION | ||
261 | |||
262 | |||
263 | /* | ||
264 | * Mount options | ||
265 | */ | ||
266 | struct ext3_mount_options { | ||
267 | unsigned long s_mount_opt; | ||
268 | uid_t s_resuid; | ||
269 | gid_t s_resgid; | ||
270 | unsigned long s_commit_interval; | ||
271 | #ifdef CONFIG_QUOTA | ||
272 | int s_jquota_fmt; | ||
273 | char *s_qf_names[MAXQUOTAS]; | ||
274 | #endif | ||
275 | }; | ||
276 | |||
277 | /* | ||
278 | * Structure of an inode on the disk | ||
279 | */ | ||
280 | struct ext3_inode { | ||
281 | __le16 i_mode; /* File mode */ | ||
282 | __le16 i_uid; /* Low 16 bits of Owner Uid */ | ||
283 | __le32 i_size; /* Size in bytes */ | ||
284 | __le32 i_atime; /* Access time */ | ||
285 | __le32 i_ctime; /* Creation time */ | ||
286 | __le32 i_mtime; /* Modification time */ | ||
287 | __le32 i_dtime; /* Deletion Time */ | ||
288 | __le16 i_gid; /* Low 16 bits of Group Id */ | ||
289 | __le16 i_links_count; /* Links count */ | ||
290 | __le32 i_blocks; /* Blocks count */ | ||
291 | __le32 i_flags; /* File flags */ | ||
292 | union { | ||
293 | struct { | ||
294 | __u32 l_i_reserved1; | ||
295 | } linux1; | ||
296 | struct { | ||
297 | __u32 h_i_translator; | ||
298 | } hurd1; | ||
299 | struct { | ||
300 | __u32 m_i_reserved1; | ||
301 | } masix1; | ||
302 | } osd1; /* OS dependent 1 */ | ||
303 | __le32 i_block[EXT3_N_BLOCKS];/* Pointers to blocks */ | ||
304 | __le32 i_generation; /* File version (for NFS) */ | ||
305 | __le32 i_file_acl; /* File ACL */ | ||
306 | __le32 i_dir_acl; /* Directory ACL */ | ||
307 | __le32 i_faddr; /* Fragment address */ | ||
308 | union { | ||
309 | struct { | ||
310 | __u8 l_i_frag; /* Fragment number */ | ||
311 | __u8 l_i_fsize; /* Fragment size */ | ||
312 | __u16 i_pad1; | ||
313 | __le16 l_i_uid_high; /* these 2 fields */ | ||
314 | __le16 l_i_gid_high; /* were reserved2[0] */ | ||
315 | __u32 l_i_reserved2; | ||
316 | } linux2; | ||
317 | struct { | ||
318 | __u8 h_i_frag; /* Fragment number */ | ||
319 | __u8 h_i_fsize; /* Fragment size */ | ||
320 | __u16 h_i_mode_high; | ||
321 | __u16 h_i_uid_high; | ||
322 | __u16 h_i_gid_high; | ||
323 | __u32 h_i_author; | ||
324 | } hurd2; | ||
325 | struct { | ||
326 | __u8 m_i_frag; /* Fragment number */ | ||
327 | __u8 m_i_fsize; /* Fragment size */ | ||
328 | __u16 m_pad1; | ||
329 | __u32 m_i_reserved2[2]; | ||
330 | } masix2; | ||
331 | } osd2; /* OS dependent 2 */ | ||
332 | __le16 i_extra_isize; | ||
333 | __le16 i_pad1; | ||
334 | }; | ||
335 | |||
336 | #define i_size_high i_dir_acl | ||
337 | |||
338 | #if defined(__KERNEL__) || defined(__linux__) | ||
339 | #define i_reserved1 osd1.linux1.l_i_reserved1 | ||
340 | #define i_frag osd2.linux2.l_i_frag | ||
341 | #define i_fsize osd2.linux2.l_i_fsize | ||
342 | #define i_uid_low i_uid | ||
343 | #define i_gid_low i_gid | ||
344 | #define i_uid_high osd2.linux2.l_i_uid_high | ||
345 | #define i_gid_high osd2.linux2.l_i_gid_high | ||
346 | #define i_reserved2 osd2.linux2.l_i_reserved2 | ||
347 | |||
348 | #elif defined(__GNU__) | ||
349 | |||
350 | #define i_translator osd1.hurd1.h_i_translator | ||
351 | #define i_frag osd2.hurd2.h_i_frag; | ||
352 | #define i_fsize osd2.hurd2.h_i_fsize; | ||
353 | #define i_uid_high osd2.hurd2.h_i_uid_high | ||
354 | #define i_gid_high osd2.hurd2.h_i_gid_high | ||
355 | #define i_author osd2.hurd2.h_i_author | ||
356 | |||
357 | #elif defined(__masix__) | ||
358 | |||
359 | #define i_reserved1 osd1.masix1.m_i_reserved1 | ||
360 | #define i_frag osd2.masix2.m_i_frag | ||
361 | #define i_fsize osd2.masix2.m_i_fsize | ||
362 | #define i_reserved2 osd2.masix2.m_i_reserved2 | ||
363 | |||
364 | #endif /* defined(__KERNEL__) || defined(__linux__) */ | ||
365 | |||
366 | /* | ||
367 | * File system states | ||
368 | */ | ||
369 | #define EXT3_VALID_FS 0x0001 /* Unmounted cleanly */ | ||
370 | #define EXT3_ERROR_FS 0x0002 /* Errors detected */ | ||
371 | #define EXT3_ORPHAN_FS 0x0004 /* Orphans being recovered */ | ||
372 | |||
373 | /* | ||
374 | * Misc. filesystem flags | ||
375 | */ | ||
376 | #define EXT2_FLAGS_SIGNED_HASH 0x0001 /* Signed dirhash in use */ | ||
377 | #define EXT2_FLAGS_UNSIGNED_HASH 0x0002 /* Unsigned dirhash in use */ | ||
378 | #define EXT2_FLAGS_TEST_FILESYS 0x0004 /* to test development code */ | ||
379 | |||
380 | /* | ||
381 | * Mount flags | ||
382 | */ | ||
383 | #define EXT3_MOUNT_CHECK 0x00001 /* Do mount-time checks */ | ||
384 | /* EXT3_MOUNT_OLDALLOC was there */ | ||
385 | #define EXT3_MOUNT_GRPID 0x00004 /* Create files with directory's group */ | ||
386 | #define EXT3_MOUNT_DEBUG 0x00008 /* Some debugging messages */ | ||
387 | #define EXT3_MOUNT_ERRORS_CONT 0x00010 /* Continue on errors */ | ||
388 | #define EXT3_MOUNT_ERRORS_RO 0x00020 /* Remount fs ro on errors */ | ||
389 | #define EXT3_MOUNT_ERRORS_PANIC 0x00040 /* Panic on errors */ | ||
390 | #define EXT3_MOUNT_MINIX_DF 0x00080 /* Mimics the Minix statfs */ | ||
391 | #define EXT3_MOUNT_NOLOAD 0x00100 /* Don't use existing journal*/ | ||
392 | #define EXT3_MOUNT_ABORT 0x00200 /* Fatal error detected */ | ||
393 | #define EXT3_MOUNT_DATA_FLAGS 0x00C00 /* Mode for data writes: */ | ||
394 | #define EXT3_MOUNT_JOURNAL_DATA 0x00400 /* Write data to journal */ | ||
395 | #define EXT3_MOUNT_ORDERED_DATA 0x00800 /* Flush data before commit */ | ||
396 | #define EXT3_MOUNT_WRITEBACK_DATA 0x00C00 /* No data ordering */ | ||
397 | #define EXT3_MOUNT_UPDATE_JOURNAL 0x01000 /* Update the journal format */ | ||
398 | #define EXT3_MOUNT_NO_UID32 0x02000 /* Disable 32-bit UIDs */ | ||
399 | #define EXT3_MOUNT_XATTR_USER 0x04000 /* Extended user attributes */ | ||
400 | #define EXT3_MOUNT_POSIX_ACL 0x08000 /* POSIX Access Control Lists */ | ||
401 | #define EXT3_MOUNT_RESERVATION 0x10000 /* Preallocation */ | ||
402 | #define EXT3_MOUNT_BARRIER 0x20000 /* Use block barriers */ | ||
403 | #define EXT3_MOUNT_QUOTA 0x80000 /* Some quota option set */ | ||
404 | #define EXT3_MOUNT_USRQUOTA 0x100000 /* "old" user quota */ | ||
405 | #define EXT3_MOUNT_GRPQUOTA 0x200000 /* "old" group quota */ | ||
406 | #define EXT3_MOUNT_DATA_ERR_ABORT 0x400000 /* Abort on file data write | ||
407 | * error in ordered mode */ | ||
408 | |||
409 | /* Compatibility, for having both ext2_fs.h and ext3_fs.h included at once */ | ||
410 | #ifndef _LINUX_EXT2_FS_H | ||
411 | #define clear_opt(o, opt) o &= ~EXT3_MOUNT_##opt | ||
412 | #define set_opt(o, opt) o |= EXT3_MOUNT_##opt | ||
413 | #define test_opt(sb, opt) (EXT3_SB(sb)->s_mount_opt & \ | ||
414 | EXT3_MOUNT_##opt) | ||
415 | #else | ||
416 | #define EXT2_MOUNT_NOLOAD EXT3_MOUNT_NOLOAD | ||
417 | #define EXT2_MOUNT_ABORT EXT3_MOUNT_ABORT | ||
418 | #define EXT2_MOUNT_DATA_FLAGS EXT3_MOUNT_DATA_FLAGS | ||
419 | #endif | ||
420 | |||
421 | #define ext3_set_bit __set_bit_le | ||
422 | #define ext3_set_bit_atomic ext2_set_bit_atomic | ||
423 | #define ext3_clear_bit __clear_bit_le | ||
424 | #define ext3_clear_bit_atomic ext2_clear_bit_atomic | ||
425 | #define ext3_test_bit test_bit_le | ||
426 | #define ext3_find_next_zero_bit find_next_zero_bit_le | ||
427 | |||
428 | /* | ||
429 | * Maximal mount counts between two filesystem checks | ||
430 | */ | ||
431 | #define EXT3_DFL_MAX_MNT_COUNT 20 /* Allow 20 mounts */ | ||
432 | #define EXT3_DFL_CHECKINTERVAL 0 /* Don't use interval check */ | ||
433 | |||
434 | /* | ||
435 | * Behaviour when detecting errors | ||
436 | */ | ||
437 | #define EXT3_ERRORS_CONTINUE 1 /* Continue execution */ | ||
438 | #define EXT3_ERRORS_RO 2 /* Remount fs read-only */ | ||
439 | #define EXT3_ERRORS_PANIC 3 /* Panic */ | ||
440 | #define EXT3_ERRORS_DEFAULT EXT3_ERRORS_CONTINUE | ||
441 | |||
442 | /* | ||
443 | * Structure of the super block | ||
444 | */ | ||
445 | struct ext3_super_block { | ||
446 | /*00*/ __le32 s_inodes_count; /* Inodes count */ | ||
447 | __le32 s_blocks_count; /* Blocks count */ | ||
448 | __le32 s_r_blocks_count; /* Reserved blocks count */ | ||
449 | __le32 s_free_blocks_count; /* Free blocks count */ | ||
450 | /*10*/ __le32 s_free_inodes_count; /* Free inodes count */ | ||
451 | __le32 s_first_data_block; /* First Data Block */ | ||
452 | __le32 s_log_block_size; /* Block size */ | ||
453 | __le32 s_log_frag_size; /* Fragment size */ | ||
454 | /*20*/ __le32 s_blocks_per_group; /* # Blocks per group */ | ||
455 | __le32 s_frags_per_group; /* # Fragments per group */ | ||
456 | __le32 s_inodes_per_group; /* # Inodes per group */ | ||
457 | __le32 s_mtime; /* Mount time */ | ||
458 | /*30*/ __le32 s_wtime; /* Write time */ | ||
459 | __le16 s_mnt_count; /* Mount count */ | ||
460 | __le16 s_max_mnt_count; /* Maximal mount count */ | ||
461 | __le16 s_magic; /* Magic signature */ | ||
462 | __le16 s_state; /* File system state */ | ||
463 | __le16 s_errors; /* Behaviour when detecting errors */ | ||
464 | __le16 s_minor_rev_level; /* minor revision level */ | ||
465 | /*40*/ __le32 s_lastcheck; /* time of last check */ | ||
466 | __le32 s_checkinterval; /* max. time between checks */ | ||
467 | __le32 s_creator_os; /* OS */ | ||
468 | __le32 s_rev_level; /* Revision level */ | ||
469 | /*50*/ __le16 s_def_resuid; /* Default uid for reserved blocks */ | ||
470 | __le16 s_def_resgid; /* Default gid for reserved blocks */ | ||
471 | /* | ||
472 | * These fields are for EXT3_DYNAMIC_REV superblocks only. | ||
473 | * | ||
474 | * Note: the difference between the compatible feature set and | ||
475 | * the incompatible feature set is that if there is a bit set | ||
476 | * in the incompatible feature set that the kernel doesn't | ||
477 | * know about, it should refuse to mount the filesystem. | ||
478 | * | ||
479 | * e2fsck's requirements are more strict; if it doesn't know | ||
480 | * about a feature in either the compatible or incompatible | ||
481 | * feature set, it must abort and not try to meddle with | ||
482 | * things it doesn't understand... | ||
483 | */ | ||
484 | __le32 s_first_ino; /* First non-reserved inode */ | ||
485 | __le16 s_inode_size; /* size of inode structure */ | ||
486 | __le16 s_block_group_nr; /* block group # of this superblock */ | ||
487 | __le32 s_feature_compat; /* compatible feature set */ | ||
488 | /*60*/ __le32 s_feature_incompat; /* incompatible feature set */ | ||
489 | __le32 s_feature_ro_compat; /* readonly-compatible feature set */ | ||
490 | /*68*/ __u8 s_uuid[16]; /* 128-bit uuid for volume */ | ||
491 | /*78*/ char s_volume_name[16]; /* volume name */ | ||
492 | /*88*/ char s_last_mounted[64]; /* directory where last mounted */ | ||
493 | /*C8*/ __le32 s_algorithm_usage_bitmap; /* For compression */ | ||
494 | /* | ||
495 | * Performance hints. Directory preallocation should only | ||
496 | * happen if the EXT3_FEATURE_COMPAT_DIR_PREALLOC flag is on. | ||
497 | */ | ||
498 | __u8 s_prealloc_blocks; /* Nr of blocks to try to preallocate*/ | ||
499 | __u8 s_prealloc_dir_blocks; /* Nr to preallocate for dirs */ | ||
500 | __le16 s_reserved_gdt_blocks; /* Per group desc for online growth */ | ||
501 | /* | ||
502 | * Journaling support valid if EXT3_FEATURE_COMPAT_HAS_JOURNAL set. | ||
503 | */ | ||
504 | /*D0*/ __u8 s_journal_uuid[16]; /* uuid of journal superblock */ | ||
505 | /*E0*/ __le32 s_journal_inum; /* inode number of journal file */ | ||
506 | __le32 s_journal_dev; /* device number of journal file */ | ||
507 | __le32 s_last_orphan; /* start of list of inodes to delete */ | ||
508 | __le32 s_hash_seed[4]; /* HTREE hash seed */ | ||
509 | __u8 s_def_hash_version; /* Default hash version to use */ | ||
510 | __u8 s_reserved_char_pad; | ||
511 | __u16 s_reserved_word_pad; | ||
512 | __le32 s_default_mount_opts; | ||
513 | __le32 s_first_meta_bg; /* First metablock block group */ | ||
514 | __le32 s_mkfs_time; /* When the filesystem was created */ | ||
515 | __le32 s_jnl_blocks[17]; /* Backup of the journal inode */ | ||
516 | /* 64bit support valid if EXT4_FEATURE_COMPAT_64BIT */ | ||
517 | /*150*/ __le32 s_blocks_count_hi; /* Blocks count */ | ||
518 | __le32 s_r_blocks_count_hi; /* Reserved blocks count */ | ||
519 | __le32 s_free_blocks_count_hi; /* Free blocks count */ | ||
520 | __le16 s_min_extra_isize; /* All inodes have at least # bytes */ | ||
521 | __le16 s_want_extra_isize; /* New inodes should reserve # bytes */ | ||
522 | __le32 s_flags; /* Miscellaneous flags */ | ||
523 | __le16 s_raid_stride; /* RAID stride */ | ||
524 | __le16 s_mmp_interval; /* # seconds to wait in MMP checking */ | ||
525 | __le64 s_mmp_block; /* Block for multi-mount protection */ | ||
526 | __le32 s_raid_stripe_width; /* blocks on all data disks (N*stride)*/ | ||
527 | __u8 s_log_groups_per_flex; /* FLEX_BG group size */ | ||
528 | __u8 s_reserved_char_pad2; | ||
529 | __le16 s_reserved_pad; | ||
530 | __u32 s_reserved[162]; /* Padding to the end of the block */ | ||
531 | }; | ||
532 | |||
533 | #ifdef __KERNEL__ | ||
534 | #include <linux/ext3_fs_i.h> | ||
535 | #include <linux/ext3_fs_sb.h> | ||
536 | static inline struct ext3_sb_info * EXT3_SB(struct super_block *sb) | ||
537 | { | ||
538 | return sb->s_fs_info; | ||
539 | } | ||
540 | static inline struct ext3_inode_info *EXT3_I(struct inode *inode) | ||
541 | { | ||
542 | return container_of(inode, struct ext3_inode_info, vfs_inode); | ||
543 | } | ||
544 | |||
545 | static inline int ext3_valid_inum(struct super_block *sb, unsigned long ino) | ||
546 | { | ||
547 | return ino == EXT3_ROOT_INO || | ||
548 | ino == EXT3_JOURNAL_INO || | ||
549 | ino == EXT3_RESIZE_INO || | ||
550 | (ino >= EXT3_FIRST_INO(sb) && | ||
551 | ino <= le32_to_cpu(EXT3_SB(sb)->s_es->s_inodes_count)); | ||
552 | } | ||
553 | |||
554 | /* | ||
555 | * Inode dynamic state flags | ||
556 | */ | ||
557 | enum { | ||
558 | EXT3_STATE_JDATA, /* journaled data exists */ | ||
559 | EXT3_STATE_NEW, /* inode is newly created */ | ||
560 | EXT3_STATE_XATTR, /* has in-inode xattrs */ | ||
561 | EXT3_STATE_FLUSH_ON_CLOSE, /* flush dirty pages on close */ | ||
562 | }; | ||
563 | |||
564 | static inline int ext3_test_inode_state(struct inode *inode, int bit) | ||
565 | { | ||
566 | return test_bit(bit, &EXT3_I(inode)->i_state_flags); | ||
567 | } | ||
568 | |||
569 | static inline void ext3_set_inode_state(struct inode *inode, int bit) | ||
570 | { | ||
571 | set_bit(bit, &EXT3_I(inode)->i_state_flags); | ||
572 | } | ||
573 | |||
574 | static inline void ext3_clear_inode_state(struct inode *inode, int bit) | ||
575 | { | ||
576 | clear_bit(bit, &EXT3_I(inode)->i_state_flags); | ||
577 | } | ||
578 | #else | ||
579 | /* Assume that user mode programs are passing in an ext3fs superblock, not | ||
580 | * a kernel struct super_block. This will allow us to call the feature-test | ||
581 | * macros from user land. */ | ||
582 | #define EXT3_SB(sb) (sb) | ||
583 | #endif | ||
584 | |||
585 | #define NEXT_ORPHAN(inode) EXT3_I(inode)->i_dtime | ||
586 | |||
587 | /* | ||
588 | * Codes for operating systems | ||
589 | */ | ||
590 | #define EXT3_OS_LINUX 0 | ||
591 | #define EXT3_OS_HURD 1 | ||
592 | #define EXT3_OS_MASIX 2 | ||
593 | #define EXT3_OS_FREEBSD 3 | ||
594 | #define EXT3_OS_LITES 4 | ||
595 | |||
596 | /* | ||
597 | * Revision levels | ||
598 | */ | ||
599 | #define EXT3_GOOD_OLD_REV 0 /* The good old (original) format */ | ||
600 | #define EXT3_DYNAMIC_REV 1 /* V2 format w/ dynamic inode sizes */ | ||
601 | |||
602 | #define EXT3_CURRENT_REV EXT3_GOOD_OLD_REV | ||
603 | #define EXT3_MAX_SUPP_REV EXT3_DYNAMIC_REV | ||
604 | |||
605 | #define EXT3_GOOD_OLD_INODE_SIZE 128 | ||
606 | |||
607 | /* | ||
608 | * Feature set definitions | ||
609 | */ | ||
610 | |||
611 | #define EXT3_HAS_COMPAT_FEATURE(sb,mask) \ | ||
612 | ( EXT3_SB(sb)->s_es->s_feature_compat & cpu_to_le32(mask) ) | ||
613 | #define EXT3_HAS_RO_COMPAT_FEATURE(sb,mask) \ | ||
614 | ( EXT3_SB(sb)->s_es->s_feature_ro_compat & cpu_to_le32(mask) ) | ||
615 | #define EXT3_HAS_INCOMPAT_FEATURE(sb,mask) \ | ||
616 | ( EXT3_SB(sb)->s_es->s_feature_incompat & cpu_to_le32(mask) ) | ||
617 | #define EXT3_SET_COMPAT_FEATURE(sb,mask) \ | ||
618 | EXT3_SB(sb)->s_es->s_feature_compat |= cpu_to_le32(mask) | ||
619 | #define EXT3_SET_RO_COMPAT_FEATURE(sb,mask) \ | ||
620 | EXT3_SB(sb)->s_es->s_feature_ro_compat |= cpu_to_le32(mask) | ||
621 | #define EXT3_SET_INCOMPAT_FEATURE(sb,mask) \ | ||
622 | EXT3_SB(sb)->s_es->s_feature_incompat |= cpu_to_le32(mask) | ||
623 | #define EXT3_CLEAR_COMPAT_FEATURE(sb,mask) \ | ||
624 | EXT3_SB(sb)->s_es->s_feature_compat &= ~cpu_to_le32(mask) | ||
625 | #define EXT3_CLEAR_RO_COMPAT_FEATURE(sb,mask) \ | ||
626 | EXT3_SB(sb)->s_es->s_feature_ro_compat &= ~cpu_to_le32(mask) | ||
627 | #define EXT3_CLEAR_INCOMPAT_FEATURE(sb,mask) \ | ||
628 | EXT3_SB(sb)->s_es->s_feature_incompat &= ~cpu_to_le32(mask) | ||
629 | |||
630 | #define EXT3_FEATURE_COMPAT_DIR_PREALLOC 0x0001 | ||
631 | #define EXT3_FEATURE_COMPAT_IMAGIC_INODES 0x0002 | ||
632 | #define EXT3_FEATURE_COMPAT_HAS_JOURNAL 0x0004 | ||
633 | #define EXT3_FEATURE_COMPAT_EXT_ATTR 0x0008 | ||
634 | #define EXT3_FEATURE_COMPAT_RESIZE_INODE 0x0010 | ||
635 | #define EXT3_FEATURE_COMPAT_DIR_INDEX 0x0020 | ||
636 | |||
637 | #define EXT3_FEATURE_RO_COMPAT_SPARSE_SUPER 0x0001 | ||
638 | #define EXT3_FEATURE_RO_COMPAT_LARGE_FILE 0x0002 | ||
639 | #define EXT3_FEATURE_RO_COMPAT_BTREE_DIR 0x0004 | ||
640 | |||
641 | #define EXT3_FEATURE_INCOMPAT_COMPRESSION 0x0001 | ||
642 | #define EXT3_FEATURE_INCOMPAT_FILETYPE 0x0002 | ||
643 | #define EXT3_FEATURE_INCOMPAT_RECOVER 0x0004 /* Needs recovery */ | ||
644 | #define EXT3_FEATURE_INCOMPAT_JOURNAL_DEV 0x0008 /* Journal device */ | ||
645 | #define EXT3_FEATURE_INCOMPAT_META_BG 0x0010 | ||
646 | |||
647 | #define EXT3_FEATURE_COMPAT_SUPP EXT2_FEATURE_COMPAT_EXT_ATTR | ||
648 | #define EXT3_FEATURE_INCOMPAT_SUPP (EXT3_FEATURE_INCOMPAT_FILETYPE| \ | ||
649 | EXT3_FEATURE_INCOMPAT_RECOVER| \ | ||
650 | EXT3_FEATURE_INCOMPAT_META_BG) | ||
651 | #define EXT3_FEATURE_RO_COMPAT_SUPP (EXT3_FEATURE_RO_COMPAT_SPARSE_SUPER| \ | ||
652 | EXT3_FEATURE_RO_COMPAT_LARGE_FILE| \ | ||
653 | EXT3_FEATURE_RO_COMPAT_BTREE_DIR) | ||
654 | |||
655 | /* | ||
656 | * Default values for user and/or group using reserved blocks | ||
657 | */ | ||
658 | #define EXT3_DEF_RESUID 0 | ||
659 | #define EXT3_DEF_RESGID 0 | ||
660 | |||
661 | /* | ||
662 | * Default mount options | ||
663 | */ | ||
664 | #define EXT3_DEFM_DEBUG 0x0001 | ||
665 | #define EXT3_DEFM_BSDGROUPS 0x0002 | ||
666 | #define EXT3_DEFM_XATTR_USER 0x0004 | ||
667 | #define EXT3_DEFM_ACL 0x0008 | ||
668 | #define EXT3_DEFM_UID16 0x0010 | ||
669 | #define EXT3_DEFM_JMODE 0x0060 | ||
670 | #define EXT3_DEFM_JMODE_DATA 0x0020 | ||
671 | #define EXT3_DEFM_JMODE_ORDERED 0x0040 | ||
672 | #define EXT3_DEFM_JMODE_WBACK 0x0060 | ||
673 | |||
674 | /* | ||
675 | * Structure of a directory entry | ||
676 | */ | ||
677 | #define EXT3_NAME_LEN 255 | ||
678 | |||
679 | struct ext3_dir_entry { | ||
680 | __le32 inode; /* Inode number */ | ||
681 | __le16 rec_len; /* Directory entry length */ | ||
682 | __le16 name_len; /* Name length */ | ||
683 | char name[EXT3_NAME_LEN]; /* File name */ | ||
684 | }; | ||
685 | |||
686 | /* | ||
687 | * The new version of the directory entry. Since EXT3 structures are | ||
688 | * stored in intel byte order, and the name_len field could never be | ||
689 | * bigger than 255 chars, it's safe to reclaim the extra byte for the | ||
690 | * file_type field. | ||
691 | */ | ||
692 | struct ext3_dir_entry_2 { | ||
693 | __le32 inode; /* Inode number */ | ||
694 | __le16 rec_len; /* Directory entry length */ | ||
695 | __u8 name_len; /* Name length */ | ||
696 | __u8 file_type; | ||
697 | char name[EXT3_NAME_LEN]; /* File name */ | ||
698 | }; | ||
699 | |||
700 | /* | ||
701 | * Ext3 directory file types. Only the low 3 bits are used. The | ||
702 | * other bits are reserved for now. | ||
703 | */ | ||
704 | #define EXT3_FT_UNKNOWN 0 | ||
705 | #define EXT3_FT_REG_FILE 1 | ||
706 | #define EXT3_FT_DIR 2 | ||
707 | #define EXT3_FT_CHRDEV 3 | ||
708 | #define EXT3_FT_BLKDEV 4 | ||
709 | #define EXT3_FT_FIFO 5 | ||
710 | #define EXT3_FT_SOCK 6 | ||
711 | #define EXT3_FT_SYMLINK 7 | ||
712 | |||
713 | #define EXT3_FT_MAX 8 | ||
714 | |||
715 | /* | ||
716 | * EXT3_DIR_PAD defines the directory entries boundaries | ||
717 | * | ||
718 | * NOTE: It must be a multiple of 4 | ||
719 | */ | ||
720 | #define EXT3_DIR_PAD 4 | ||
721 | #define EXT3_DIR_ROUND (EXT3_DIR_PAD - 1) | ||
722 | #define EXT3_DIR_REC_LEN(name_len) (((name_len) + 8 + EXT3_DIR_ROUND) & \ | ||
723 | ~EXT3_DIR_ROUND) | ||
724 | #define EXT3_MAX_REC_LEN ((1<<16)-1) | ||
725 | |||
726 | /* | ||
727 | * Tests against MAX_REC_LEN etc were put in place for 64k block | ||
728 | * sizes; if that is not possible on this arch, we can skip | ||
729 | * those tests and speed things up. | ||
730 | */ | ||
731 | static inline unsigned ext3_rec_len_from_disk(__le16 dlen) | ||
732 | { | ||
733 | unsigned len = le16_to_cpu(dlen); | ||
734 | |||
735 | #if (PAGE_CACHE_SIZE >= 65536) | ||
736 | if (len == EXT3_MAX_REC_LEN) | ||
737 | return 1 << 16; | ||
738 | #endif | ||
739 | return len; | ||
740 | } | ||
741 | |||
742 | static inline __le16 ext3_rec_len_to_disk(unsigned len) | ||
743 | { | ||
744 | #if (PAGE_CACHE_SIZE >= 65536) | ||
745 | if (len == (1 << 16)) | ||
746 | return cpu_to_le16(EXT3_MAX_REC_LEN); | ||
747 | else if (len > (1 << 16)) | ||
748 | BUG(); | ||
749 | #endif | ||
750 | return cpu_to_le16(len); | ||
751 | } | ||
752 | |||
753 | /* | ||
754 | * Hash Tree Directory indexing | ||
755 | * (c) Daniel Phillips, 2001 | ||
756 | */ | ||
757 | |||
758 | #define is_dx(dir) (EXT3_HAS_COMPAT_FEATURE(dir->i_sb, \ | ||
759 | EXT3_FEATURE_COMPAT_DIR_INDEX) && \ | ||
760 | (EXT3_I(dir)->i_flags & EXT3_INDEX_FL)) | ||
761 | #define EXT3_DIR_LINK_MAX(dir) (!is_dx(dir) && (dir)->i_nlink >= EXT3_LINK_MAX) | ||
762 | #define EXT3_DIR_LINK_EMPTY(dir) ((dir)->i_nlink == 2 || (dir)->i_nlink == 1) | ||
763 | |||
764 | /* Legal values for the dx_root hash_version field: */ | ||
765 | |||
766 | #define DX_HASH_LEGACY 0 | ||
767 | #define DX_HASH_HALF_MD4 1 | ||
768 | #define DX_HASH_TEA 2 | ||
769 | #define DX_HASH_LEGACY_UNSIGNED 3 | ||
770 | #define DX_HASH_HALF_MD4_UNSIGNED 4 | ||
771 | #define DX_HASH_TEA_UNSIGNED 5 | ||
772 | |||
773 | #ifdef __KERNEL__ | ||
774 | |||
775 | /* hash info structure used by the directory hash */ | ||
776 | struct dx_hash_info | ||
777 | { | ||
778 | u32 hash; | ||
779 | u32 minor_hash; | ||
780 | int hash_version; | ||
781 | u32 *seed; | ||
782 | }; | ||
783 | |||
784 | #define EXT3_HTREE_EOF 0x7fffffff | ||
785 | |||
786 | /* | ||
787 | * Control parameters used by ext3_htree_next_block | ||
788 | */ | ||
789 | #define HASH_NB_ALWAYS 1 | ||
790 | |||
791 | |||
792 | /* | ||
793 | * Describe an inode's exact location on disk and in memory | ||
794 | */ | ||
795 | struct ext3_iloc | ||
796 | { | ||
797 | struct buffer_head *bh; | ||
798 | unsigned long offset; | ||
799 | unsigned long block_group; | ||
800 | }; | ||
801 | |||
802 | static inline struct ext3_inode *ext3_raw_inode(struct ext3_iloc *iloc) | ||
803 | { | ||
804 | return (struct ext3_inode *) (iloc->bh->b_data + iloc->offset); | ||
805 | } | ||
806 | |||
807 | /* | ||
808 | * This structure is stuffed into the struct file's private_data field | ||
809 | * for directories. It is where we put information so that we can do | ||
810 | * readdir operations in hash tree order. | ||
811 | */ | ||
812 | struct dir_private_info { | ||
813 | struct rb_root root; | ||
814 | struct rb_node *curr_node; | ||
815 | struct fname *extra_fname; | ||
816 | loff_t last_pos; | ||
817 | __u32 curr_hash; | ||
818 | __u32 curr_minor_hash; | ||
819 | __u32 next_hash; | ||
820 | }; | ||
821 | |||
822 | /* calculate the first block number of the group */ | ||
823 | static inline ext3_fsblk_t | ||
824 | ext3_group_first_block_no(struct super_block *sb, unsigned long group_no) | ||
825 | { | ||
826 | return group_no * (ext3_fsblk_t)EXT3_BLOCKS_PER_GROUP(sb) + | ||
827 | le32_to_cpu(EXT3_SB(sb)->s_es->s_first_data_block); | ||
828 | } | ||
829 | |||
830 | /* | ||
831 | * Special error return code only used by dx_probe() and its callers. | ||
832 | */ | ||
833 | #define ERR_BAD_DX_DIR -75000 | ||
834 | |||
835 | /* | ||
836 | * Function prototypes | ||
837 | */ | ||
838 | |||
839 | /* | ||
840 | * Ok, these declarations are also in <linux/kernel.h> but none of the | ||
841 | * ext3 source programs needs to include it so they are duplicated here. | ||
842 | */ | ||
843 | # define NORET_TYPE /**/ | ||
844 | # define ATTRIB_NORET __attribute__((noreturn)) | ||
845 | # define NORET_AND noreturn, | ||
846 | |||
847 | /* balloc.c */ | ||
848 | extern int ext3_bg_has_super(struct super_block *sb, int group); | ||
849 | extern unsigned long ext3_bg_num_gdb(struct super_block *sb, int group); | ||
850 | extern ext3_fsblk_t ext3_new_block (handle_t *handle, struct inode *inode, | ||
851 | ext3_fsblk_t goal, int *errp); | ||
852 | extern ext3_fsblk_t ext3_new_blocks (handle_t *handle, struct inode *inode, | ||
853 | ext3_fsblk_t goal, unsigned long *count, int *errp); | ||
854 | extern void ext3_free_blocks (handle_t *handle, struct inode *inode, | ||
855 | ext3_fsblk_t block, unsigned long count); | ||
856 | extern void ext3_free_blocks_sb (handle_t *handle, struct super_block *sb, | ||
857 | ext3_fsblk_t block, unsigned long count, | ||
858 | unsigned long *pdquot_freed_blocks); | ||
859 | extern ext3_fsblk_t ext3_count_free_blocks (struct super_block *); | ||
860 | extern void ext3_check_blocks_bitmap (struct super_block *); | ||
861 | extern struct ext3_group_desc * ext3_get_group_desc(struct super_block * sb, | ||
862 | unsigned int block_group, | ||
863 | struct buffer_head ** bh); | ||
864 | extern int ext3_should_retry_alloc(struct super_block *sb, int *retries); | ||
865 | extern void ext3_init_block_alloc_info(struct inode *); | ||
866 | extern void ext3_rsv_window_add(struct super_block *sb, struct ext3_reserve_window_node *rsv); | ||
867 | extern int ext3_trim_fs(struct super_block *sb, struct fstrim_range *range); | ||
868 | |||
869 | /* dir.c */ | ||
870 | extern int ext3_check_dir_entry(const char *, struct inode *, | ||
871 | struct ext3_dir_entry_2 *, | ||
872 | struct buffer_head *, unsigned long); | ||
873 | extern int ext3_htree_store_dirent(struct file *dir_file, __u32 hash, | ||
874 | __u32 minor_hash, | ||
875 | struct ext3_dir_entry_2 *dirent); | ||
876 | extern void ext3_htree_free_dir_info(struct dir_private_info *p); | ||
877 | |||
878 | /* fsync.c */ | ||
879 | extern int ext3_sync_file(struct file *, loff_t, loff_t, int); | ||
880 | |||
881 | /* hash.c */ | ||
882 | extern int ext3fs_dirhash(const char *name, int len, struct | ||
883 | dx_hash_info *hinfo); | ||
884 | |||
885 | /* ialloc.c */ | ||
886 | extern struct inode * ext3_new_inode (handle_t *, struct inode *, | ||
887 | const struct qstr *, umode_t); | ||
888 | extern void ext3_free_inode (handle_t *, struct inode *); | ||
889 | extern struct inode * ext3_orphan_get (struct super_block *, unsigned long); | ||
890 | extern unsigned long ext3_count_free_inodes (struct super_block *); | ||
891 | extern unsigned long ext3_count_dirs (struct super_block *); | ||
892 | extern void ext3_check_inodes_bitmap (struct super_block *); | ||
893 | extern unsigned long ext3_count_free (struct buffer_head *, unsigned); | ||
894 | |||
895 | |||
896 | /* inode.c */ | ||
897 | int ext3_forget(handle_t *handle, int is_metadata, struct inode *inode, | ||
898 | struct buffer_head *bh, ext3_fsblk_t blocknr); | ||
899 | struct buffer_head * ext3_getblk (handle_t *, struct inode *, long, int, int *); | ||
900 | struct buffer_head * ext3_bread (handle_t *, struct inode *, int, int, int *); | ||
901 | int ext3_get_blocks_handle(handle_t *handle, struct inode *inode, | ||
902 | sector_t iblock, unsigned long maxblocks, struct buffer_head *bh_result, | ||
903 | int create); | ||
904 | |||
905 | extern struct inode *ext3_iget(struct super_block *, unsigned long); | ||
906 | extern int ext3_write_inode (struct inode *, struct writeback_control *); | ||
907 | extern int ext3_setattr (struct dentry *, struct iattr *); | ||
908 | extern void ext3_evict_inode (struct inode *); | ||
909 | extern int ext3_sync_inode (handle_t *, struct inode *); | ||
910 | extern void ext3_discard_reservation (struct inode *); | ||
911 | extern void ext3_dirty_inode(struct inode *, int); | ||
912 | extern int ext3_change_inode_journal_flag(struct inode *, int); | ||
913 | extern int ext3_get_inode_loc(struct inode *, struct ext3_iloc *); | ||
914 | extern int ext3_can_truncate(struct inode *inode); | ||
915 | extern void ext3_truncate(struct inode *inode); | ||
916 | extern void ext3_set_inode_flags(struct inode *); | ||
917 | extern void ext3_get_inode_flags(struct ext3_inode_info *); | ||
918 | extern void ext3_set_aops(struct inode *inode); | ||
919 | extern int ext3_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo, | ||
920 | u64 start, u64 len); | ||
921 | |||
922 | /* ioctl.c */ | ||
923 | extern long ext3_ioctl(struct file *, unsigned int, unsigned long); | ||
924 | extern long ext3_compat_ioctl(struct file *, unsigned int, unsigned long); | ||
925 | |||
926 | /* namei.c */ | ||
927 | extern int ext3_orphan_add(handle_t *, struct inode *); | ||
928 | extern int ext3_orphan_del(handle_t *, struct inode *); | ||
929 | extern int ext3_htree_fill_tree(struct file *dir_file, __u32 start_hash, | ||
930 | __u32 start_minor_hash, __u32 *next_hash); | ||
931 | |||
932 | /* resize.c */ | ||
933 | extern int ext3_group_add(struct super_block *sb, | ||
934 | struct ext3_new_group_data *input); | ||
935 | extern int ext3_group_extend(struct super_block *sb, | ||
936 | struct ext3_super_block *es, | ||
937 | ext3_fsblk_t n_blocks_count); | ||
938 | |||
939 | /* super.c */ | ||
940 | extern __printf(3, 4) | ||
941 | void ext3_error(struct super_block *, const char *, const char *, ...); | ||
942 | extern void __ext3_std_error (struct super_block *, const char *, int); | ||
943 | extern __printf(3, 4) | ||
944 | void ext3_abort(struct super_block *, const char *, const char *, ...); | ||
945 | extern __printf(3, 4) | ||
946 | void ext3_warning(struct super_block *, const char *, const char *, ...); | ||
947 | extern __printf(3, 4) | ||
948 | void ext3_msg(struct super_block *, const char *, const char *, ...); | ||
949 | extern void ext3_update_dynamic_rev (struct super_block *sb); | ||
950 | |||
951 | #define ext3_std_error(sb, errno) \ | ||
952 | do { \ | ||
953 | if ((errno)) \ | ||
954 | __ext3_std_error((sb), __func__, (errno)); \ | ||
955 | } while (0) | ||
956 | |||
957 | /* | ||
958 | * Inodes and files operations | ||
959 | */ | ||
960 | |||
961 | /* dir.c */ | ||
962 | extern const struct file_operations ext3_dir_operations; | ||
963 | |||
964 | /* file.c */ | ||
965 | extern const struct inode_operations ext3_file_inode_operations; | ||
966 | extern const struct file_operations ext3_file_operations; | ||
967 | |||
968 | /* namei.c */ | ||
969 | extern const struct inode_operations ext3_dir_inode_operations; | ||
970 | extern const struct inode_operations ext3_special_inode_operations; | ||
971 | |||
972 | /* symlink.c */ | ||
973 | extern const struct inode_operations ext3_symlink_inode_operations; | ||
974 | extern const struct inode_operations ext3_fast_symlink_inode_operations; | ||
975 | |||
976 | |||
977 | #endif /* __KERNEL__ */ | ||
978 | |||
979 | #endif /* _LINUX_EXT3_FS_H */ | ||
diff --git a/include/linux/ext3_fs_i.h b/include/linux/ext3_fs_i.h deleted file mode 100644 index f42c098aed8d..000000000000 --- a/include/linux/ext3_fs_i.h +++ /dev/null | |||
@@ -1,151 +0,0 @@ | |||
1 | /* | ||
2 | * linux/include/linux/ext3_fs_i.h | ||
3 | * | ||
4 | * Copyright (C) 1992, 1993, 1994, 1995 | ||
5 | * Remy Card (card@masi.ibp.fr) | ||
6 | * Laboratoire MASI - Institut Blaise Pascal | ||
7 | * Universite Pierre et Marie Curie (Paris VI) | ||
8 | * | ||
9 | * from | ||
10 | * | ||
11 | * linux/include/linux/minix_fs_i.h | ||
12 | * | ||
13 | * Copyright (C) 1991, 1992 Linus Torvalds | ||
14 | */ | ||
15 | |||
16 | #ifndef _LINUX_EXT3_FS_I | ||
17 | #define _LINUX_EXT3_FS_I | ||
18 | |||
19 | #include <linux/rwsem.h> | ||
20 | #include <linux/rbtree.h> | ||
21 | #include <linux/seqlock.h> | ||
22 | #include <linux/mutex.h> | ||
23 | |||
24 | /* data type for block offset of block group */ | ||
25 | typedef int ext3_grpblk_t; | ||
26 | |||
27 | /* data type for filesystem-wide blocks number */ | ||
28 | typedef unsigned long ext3_fsblk_t; | ||
29 | |||
30 | #define E3FSBLK "%lu" | ||
31 | |||
32 | struct ext3_reserve_window { | ||
33 | ext3_fsblk_t _rsv_start; /* First byte reserved */ | ||
34 | ext3_fsblk_t _rsv_end; /* Last byte reserved or 0 */ | ||
35 | }; | ||
36 | |||
37 | struct ext3_reserve_window_node { | ||
38 | struct rb_node rsv_node; | ||
39 | __u32 rsv_goal_size; | ||
40 | __u32 rsv_alloc_hit; | ||
41 | struct ext3_reserve_window rsv_window; | ||
42 | }; | ||
43 | |||
44 | struct ext3_block_alloc_info { | ||
45 | /* information about reservation window */ | ||
46 | struct ext3_reserve_window_node rsv_window_node; | ||
47 | /* | ||
48 | * was i_next_alloc_block in ext3_inode_info | ||
49 | * is the logical (file-relative) number of the | ||
50 | * most-recently-allocated block in this file. | ||
51 | * We use this for detecting linearly ascending allocation requests. | ||
52 | */ | ||
53 | __u32 last_alloc_logical_block; | ||
54 | /* | ||
55 | * Was i_next_alloc_goal in ext3_inode_info | ||
56 | * is the *physical* companion to i_next_alloc_block. | ||
57 | * it the physical block number of the block which was most-recentl | ||
58 | * allocated to this file. This give us the goal (target) for the next | ||
59 | * allocation when we detect linearly ascending requests. | ||
60 | */ | ||
61 | ext3_fsblk_t last_alloc_physical_block; | ||
62 | }; | ||
63 | |||
64 | #define rsv_start rsv_window._rsv_start | ||
65 | #define rsv_end rsv_window._rsv_end | ||
66 | |||
67 | /* | ||
68 | * third extended file system inode data in memory | ||
69 | */ | ||
70 | struct ext3_inode_info { | ||
71 | __le32 i_data[15]; /* unconverted */ | ||
72 | __u32 i_flags; | ||
73 | #ifdef EXT3_FRAGMENTS | ||
74 | __u32 i_faddr; | ||
75 | __u8 i_frag_no; | ||
76 | __u8 i_frag_size; | ||
77 | #endif | ||
78 | ext3_fsblk_t i_file_acl; | ||
79 | __u32 i_dir_acl; | ||
80 | __u32 i_dtime; | ||
81 | |||
82 | /* | ||
83 | * i_block_group is the number of the block group which contains | ||
84 | * this file's inode. Constant across the lifetime of the inode, | ||
85 | * it is ued for making block allocation decisions - we try to | ||
86 | * place a file's data blocks near its inode block, and new inodes | ||
87 | * near to their parent directory's inode. | ||
88 | */ | ||
89 | __u32 i_block_group; | ||
90 | unsigned long i_state_flags; /* Dynamic state flags for ext3 */ | ||
91 | |||
92 | /* block reservation info */ | ||
93 | struct ext3_block_alloc_info *i_block_alloc_info; | ||
94 | |||
95 | __u32 i_dir_start_lookup; | ||
96 | #ifdef CONFIG_EXT3_FS_XATTR | ||
97 | /* | ||
98 | * Extended attributes can be read independently of the main file | ||
99 | * data. Taking i_mutex even when reading would cause contention | ||
100 | * between readers of EAs and writers of regular file data, so | ||
101 | * instead we synchronize on xattr_sem when reading or changing | ||
102 | * EAs. | ||
103 | */ | ||
104 | struct rw_semaphore xattr_sem; | ||
105 | #endif | ||
106 | |||
107 | struct list_head i_orphan; /* unlinked but open inodes */ | ||
108 | |||
109 | /* | ||
110 | * i_disksize keeps track of what the inode size is ON DISK, not | ||
111 | * in memory. During truncate, i_size is set to the new size by | ||
112 | * the VFS prior to calling ext3_truncate(), but the filesystem won't | ||
113 | * set i_disksize to 0 until the truncate is actually under way. | ||
114 | * | ||
115 | * The intent is that i_disksize always represents the blocks which | ||
116 | * are used by this file. This allows recovery to restart truncate | ||
117 | * on orphans if we crash during truncate. We actually write i_disksize | ||
118 | * into the on-disk inode when writing inodes out, instead of i_size. | ||
119 | * | ||
120 | * The only time when i_disksize and i_size may be different is when | ||
121 | * a truncate is in progress. The only things which change i_disksize | ||
122 | * are ext3_get_block (growth) and ext3_truncate (shrinkth). | ||
123 | */ | ||
124 | loff_t i_disksize; | ||
125 | |||
126 | /* on-disk additional length */ | ||
127 | __u16 i_extra_isize; | ||
128 | |||
129 | /* | ||
130 | * truncate_mutex is for serialising ext3_truncate() against | ||
131 | * ext3_getblock(). In the 2.4 ext2 design, great chunks of inode's | ||
132 | * data tree are chopped off during truncate. We can't do that in | ||
133 | * ext3 because whenever we perform intermediate commits during | ||
134 | * truncate, the inode and all the metadata blocks *must* be in a | ||
135 | * consistent state which allows truncation of the orphans to restart | ||
136 | * during recovery. Hence we must fix the get_block-vs-truncate race | ||
137 | * by other means, so we have truncate_mutex. | ||
138 | */ | ||
139 | struct mutex truncate_mutex; | ||
140 | |||
141 | /* | ||
142 | * Transactions that contain inode's metadata needed to complete | ||
143 | * fsync and fdatasync, respectively. | ||
144 | */ | ||
145 | atomic_t i_sync_tid; | ||
146 | atomic_t i_datasync_tid; | ||
147 | |||
148 | struct inode vfs_inode; | ||
149 | }; | ||
150 | |||
151 | #endif /* _LINUX_EXT3_FS_I */ | ||
diff --git a/include/linux/ext3_fs_sb.h b/include/linux/ext3_fs_sb.h deleted file mode 100644 index 64365252f1b0..000000000000 --- a/include/linux/ext3_fs_sb.h +++ /dev/null | |||
@@ -1,91 +0,0 @@ | |||
1 | /* | ||
2 | * linux/include/linux/ext3_fs_sb.h | ||
3 | * | ||
4 | * Copyright (C) 1992, 1993, 1994, 1995 | ||
5 | * Remy Card (card@masi.ibp.fr) | ||
6 | * Laboratoire MASI - Institut Blaise Pascal | ||
7 | * Universite Pierre et Marie Curie (Paris VI) | ||
8 | * | ||
9 | * from | ||
10 | * | ||
11 | * linux/include/linux/minix_fs_sb.h | ||
12 | * | ||
13 | * Copyright (C) 1991, 1992 Linus Torvalds | ||
14 | */ | ||
15 | |||
16 | #ifndef _LINUX_EXT3_FS_SB | ||
17 | #define _LINUX_EXT3_FS_SB | ||
18 | |||
19 | #ifdef __KERNEL__ | ||
20 | #include <linux/timer.h> | ||
21 | #include <linux/wait.h> | ||
22 | #include <linux/blockgroup_lock.h> | ||
23 | #include <linux/percpu_counter.h> | ||
24 | #endif | ||
25 | #include <linux/rbtree.h> | ||
26 | |||
27 | /* | ||
28 | * third extended-fs super-block data in memory | ||
29 | */ | ||
30 | struct ext3_sb_info { | ||
31 | unsigned long s_frag_size; /* Size of a fragment in bytes */ | ||
32 | unsigned long s_frags_per_block;/* Number of fragments per block */ | ||
33 | unsigned long s_inodes_per_block;/* Number of inodes per block */ | ||
34 | unsigned long s_frags_per_group;/* Number of fragments in a group */ | ||
35 | unsigned long s_blocks_per_group;/* Number of blocks in a group */ | ||
36 | unsigned long s_inodes_per_group;/* Number of inodes in a group */ | ||
37 | unsigned long s_itb_per_group; /* Number of inode table blocks per group */ | ||
38 | unsigned long s_gdb_count; /* Number of group descriptor blocks */ | ||
39 | unsigned long s_desc_per_block; /* Number of group descriptors per block */ | ||
40 | unsigned long s_groups_count; /* Number of groups in the fs */ | ||
41 | unsigned long s_overhead_last; /* Last calculated overhead */ | ||
42 | unsigned long s_blocks_last; /* Last seen block count */ | ||
43 | struct buffer_head * s_sbh; /* Buffer containing the super block */ | ||
44 | struct ext3_super_block * s_es; /* Pointer to the super block in the buffer */ | ||
45 | struct buffer_head ** s_group_desc; | ||
46 | unsigned long s_mount_opt; | ||
47 | ext3_fsblk_t s_sb_block; | ||
48 | uid_t s_resuid; | ||
49 | gid_t s_resgid; | ||
50 | unsigned short s_mount_state; | ||
51 | unsigned short s_pad; | ||
52 | int s_addr_per_block_bits; | ||
53 | int s_desc_per_block_bits; | ||
54 | int s_inode_size; | ||
55 | int s_first_ino; | ||
56 | spinlock_t s_next_gen_lock; | ||
57 | u32 s_next_generation; | ||
58 | u32 s_hash_seed[4]; | ||
59 | int s_def_hash_version; | ||
60 | int s_hash_unsigned; /* 3 if hash should be signed, 0 if not */ | ||
61 | struct percpu_counter s_freeblocks_counter; | ||
62 | struct percpu_counter s_freeinodes_counter; | ||
63 | struct percpu_counter s_dirs_counter; | ||
64 | struct blockgroup_lock *s_blockgroup_lock; | ||
65 | |||
66 | /* root of the per fs reservation window tree */ | ||
67 | spinlock_t s_rsv_window_lock; | ||
68 | struct rb_root s_rsv_window_root; | ||
69 | struct ext3_reserve_window_node s_rsv_window_head; | ||
70 | |||
71 | /* Journaling */ | ||
72 | struct inode * s_journal_inode; | ||
73 | struct journal_s * s_journal; | ||
74 | struct list_head s_orphan; | ||
75 | struct mutex s_orphan_lock; | ||
76 | struct mutex s_resize_lock; | ||
77 | unsigned long s_commit_interval; | ||
78 | struct block_device *journal_bdev; | ||
79 | #ifdef CONFIG_QUOTA | ||
80 | char *s_qf_names[MAXQUOTAS]; /* Names of quota files with journalled quota */ | ||
81 | int s_jquota_fmt; /* Format of quota to use */ | ||
82 | #endif | ||
83 | }; | ||
84 | |||
85 | static inline spinlock_t * | ||
86 | sb_bgl_lock(struct ext3_sb_info *sbi, unsigned int block_group) | ||
87 | { | ||
88 | return bgl_lock_ptr(sbi->s_blockgroup_lock, block_group); | ||
89 | } | ||
90 | |||
91 | #endif /* _LINUX_EXT3_FS_SB */ | ||
diff --git a/include/linux/ext3_jbd.h b/include/linux/ext3_jbd.h deleted file mode 100644 index d7b5ddca99c2..000000000000 --- a/include/linux/ext3_jbd.h +++ /dev/null | |||
@@ -1,229 +0,0 @@ | |||
1 | /* | ||
2 | * linux/include/linux/ext3_jbd.h | ||
3 | * | ||
4 | * Written by Stephen C. Tweedie <sct@redhat.com>, 1999 | ||
5 | * | ||
6 | * Copyright 1998--1999 Red Hat corp --- All Rights Reserved | ||
7 | * | ||
8 | * This file is part of the Linux kernel and is made available under | ||
9 | * the terms of the GNU General Public License, version 2, or at your | ||
10 | * option, any later version, incorporated herein by reference. | ||
11 | * | ||
12 | * Ext3-specific journaling extensions. | ||
13 | */ | ||
14 | |||
15 | #ifndef _LINUX_EXT3_JBD_H | ||
16 | #define _LINUX_EXT3_JBD_H | ||
17 | |||
18 | #include <linux/fs.h> | ||
19 | #include <linux/jbd.h> | ||
20 | #include <linux/ext3_fs.h> | ||
21 | |||
22 | #define EXT3_JOURNAL(inode) (EXT3_SB((inode)->i_sb)->s_journal) | ||
23 | |||
24 | /* Define the number of blocks we need to account to a transaction to | ||
25 | * modify one block of data. | ||
26 | * | ||
27 | * We may have to touch one inode, one bitmap buffer, up to three | ||
28 | * indirection blocks, the group and superblock summaries, and the data | ||
29 | * block to complete the transaction. */ | ||
30 | |||
31 | #define EXT3_SINGLEDATA_TRANS_BLOCKS 8U | ||
32 | |||
33 | /* Extended attribute operations touch at most two data buffers, | ||
34 | * two bitmap buffers, and two group summaries, in addition to the inode | ||
35 | * and the superblock, which are already accounted for. */ | ||
36 | |||
37 | #define EXT3_XATTR_TRANS_BLOCKS 6U | ||
38 | |||
39 | /* Define the minimum size for a transaction which modifies data. This | ||
40 | * needs to take into account the fact that we may end up modifying two | ||
41 | * quota files too (one for the group, one for the user quota). The | ||
42 | * superblock only gets updated once, of course, so don't bother | ||
43 | * counting that again for the quota updates. */ | ||
44 | |||
45 | #define EXT3_DATA_TRANS_BLOCKS(sb) (EXT3_SINGLEDATA_TRANS_BLOCKS + \ | ||
46 | EXT3_XATTR_TRANS_BLOCKS - 2 + \ | ||
47 | EXT3_MAXQUOTAS_TRANS_BLOCKS(sb)) | ||
48 | |||
49 | /* Delete operations potentially hit one directory's namespace plus an | ||
50 | * entire inode, plus arbitrary amounts of bitmap/indirection data. Be | ||
51 | * generous. We can grow the delete transaction later if necessary. */ | ||
52 | |||
53 | #define EXT3_DELETE_TRANS_BLOCKS(sb) (EXT3_MAXQUOTAS_TRANS_BLOCKS(sb) + 64) | ||
54 | |||
55 | /* Define an arbitrary limit for the amount of data we will anticipate | ||
56 | * writing to any given transaction. For unbounded transactions such as | ||
57 | * write(2) and truncate(2) we can write more than this, but we always | ||
58 | * start off at the maximum transaction size and grow the transaction | ||
59 | * optimistically as we go. */ | ||
60 | |||
61 | #define EXT3_MAX_TRANS_DATA 64U | ||
62 | |||
63 | /* We break up a large truncate or write transaction once the handle's | ||
64 | * buffer credits gets this low, we need either to extend the | ||
65 | * transaction or to start a new one. Reserve enough space here for | ||
66 | * inode, bitmap, superblock, group and indirection updates for at least | ||
67 | * one block, plus two quota updates. Quota allocations are not | ||
68 | * needed. */ | ||
69 | |||
70 | #define EXT3_RESERVE_TRANS_BLOCKS 12U | ||
71 | |||
72 | #define EXT3_INDEX_EXTRA_TRANS_BLOCKS 8 | ||
73 | |||
74 | #ifdef CONFIG_QUOTA | ||
75 | /* Amount of blocks needed for quota update - we know that the structure was | ||
76 | * allocated so we need to update only inode+data */ | ||
77 | #define EXT3_QUOTA_TRANS_BLOCKS(sb) (test_opt(sb, QUOTA) ? 2 : 0) | ||
78 | /* Amount of blocks needed for quota insert/delete - we do some block writes | ||
79 | * but inode, sb and group updates are done only once */ | ||
80 | #define EXT3_QUOTA_INIT_BLOCKS(sb) (test_opt(sb, QUOTA) ? (DQUOT_INIT_ALLOC*\ | ||
81 | (EXT3_SINGLEDATA_TRANS_BLOCKS-3)+3+DQUOT_INIT_REWRITE) : 0) | ||
82 | #define EXT3_QUOTA_DEL_BLOCKS(sb) (test_opt(sb, QUOTA) ? (DQUOT_DEL_ALLOC*\ | ||
83 | (EXT3_SINGLEDATA_TRANS_BLOCKS-3)+3+DQUOT_DEL_REWRITE) : 0) | ||
84 | #else | ||
85 | #define EXT3_QUOTA_TRANS_BLOCKS(sb) 0 | ||
86 | #define EXT3_QUOTA_INIT_BLOCKS(sb) 0 | ||
87 | #define EXT3_QUOTA_DEL_BLOCKS(sb) 0 | ||
88 | #endif | ||
89 | #define EXT3_MAXQUOTAS_TRANS_BLOCKS(sb) (MAXQUOTAS*EXT3_QUOTA_TRANS_BLOCKS(sb)) | ||
90 | #define EXT3_MAXQUOTAS_INIT_BLOCKS(sb) (MAXQUOTAS*EXT3_QUOTA_INIT_BLOCKS(sb)) | ||
91 | #define EXT3_MAXQUOTAS_DEL_BLOCKS(sb) (MAXQUOTAS*EXT3_QUOTA_DEL_BLOCKS(sb)) | ||
92 | |||
93 | int | ||
94 | ext3_mark_iloc_dirty(handle_t *handle, | ||
95 | struct inode *inode, | ||
96 | struct ext3_iloc *iloc); | ||
97 | |||
98 | /* | ||
99 | * On success, We end up with an outstanding reference count against | ||
100 | * iloc->bh. This _must_ be cleaned up later. | ||
101 | */ | ||
102 | |||
103 | int ext3_reserve_inode_write(handle_t *handle, struct inode *inode, | ||
104 | struct ext3_iloc *iloc); | ||
105 | |||
106 | int ext3_mark_inode_dirty(handle_t *handle, struct inode *inode); | ||
107 | |||
108 | /* | ||
109 | * Wrapper functions with which ext3 calls into JBD. The intent here is | ||
110 | * to allow these to be turned into appropriate stubs so ext3 can control | ||
111 | * ext2 filesystems, so ext2+ext3 systems only nee one fs. This work hasn't | ||
112 | * been done yet. | ||
113 | */ | ||
114 | |||
115 | static inline void ext3_journal_release_buffer(handle_t *handle, | ||
116 | struct buffer_head *bh) | ||
117 | { | ||
118 | journal_release_buffer(handle, bh); | ||
119 | } | ||
120 | |||
121 | void ext3_journal_abort_handle(const char *caller, const char *err_fn, | ||
122 | struct buffer_head *bh, handle_t *handle, int err); | ||
123 | |||
124 | int __ext3_journal_get_undo_access(const char *where, handle_t *handle, | ||
125 | struct buffer_head *bh); | ||
126 | |||
127 | int __ext3_journal_get_write_access(const char *where, handle_t *handle, | ||
128 | struct buffer_head *bh); | ||
129 | |||
130 | int __ext3_journal_forget(const char *where, handle_t *handle, | ||
131 | struct buffer_head *bh); | ||
132 | |||
133 | int __ext3_journal_revoke(const char *where, handle_t *handle, | ||
134 | unsigned long blocknr, struct buffer_head *bh); | ||
135 | |||
136 | int __ext3_journal_get_create_access(const char *where, | ||
137 | handle_t *handle, struct buffer_head *bh); | ||
138 | |||
139 | int __ext3_journal_dirty_metadata(const char *where, | ||
140 | handle_t *handle, struct buffer_head *bh); | ||
141 | |||
142 | #define ext3_journal_get_undo_access(handle, bh) \ | ||
143 | __ext3_journal_get_undo_access(__func__, (handle), (bh)) | ||
144 | #define ext3_journal_get_write_access(handle, bh) \ | ||
145 | __ext3_journal_get_write_access(__func__, (handle), (bh)) | ||
146 | #define ext3_journal_revoke(handle, blocknr, bh) \ | ||
147 | __ext3_journal_revoke(__func__, (handle), (blocknr), (bh)) | ||
148 | #define ext3_journal_get_create_access(handle, bh) \ | ||
149 | __ext3_journal_get_create_access(__func__, (handle), (bh)) | ||
150 | #define ext3_journal_dirty_metadata(handle, bh) \ | ||
151 | __ext3_journal_dirty_metadata(__func__, (handle), (bh)) | ||
152 | #define ext3_journal_forget(handle, bh) \ | ||
153 | __ext3_journal_forget(__func__, (handle), (bh)) | ||
154 | |||
155 | int ext3_journal_dirty_data(handle_t *handle, struct buffer_head *bh); | ||
156 | |||
157 | handle_t *ext3_journal_start_sb(struct super_block *sb, int nblocks); | ||
158 | int __ext3_journal_stop(const char *where, handle_t *handle); | ||
159 | |||
160 | static inline handle_t *ext3_journal_start(struct inode *inode, int nblocks) | ||
161 | { | ||
162 | return ext3_journal_start_sb(inode->i_sb, nblocks); | ||
163 | } | ||
164 | |||
165 | #define ext3_journal_stop(handle) \ | ||
166 | __ext3_journal_stop(__func__, (handle)) | ||
167 | |||
168 | static inline handle_t *ext3_journal_current_handle(void) | ||
169 | { | ||
170 | return journal_current_handle(); | ||
171 | } | ||
172 | |||
173 | static inline int ext3_journal_extend(handle_t *handle, int nblocks) | ||
174 | { | ||
175 | return journal_extend(handle, nblocks); | ||
176 | } | ||
177 | |||
178 | static inline int ext3_journal_restart(handle_t *handle, int nblocks) | ||
179 | { | ||
180 | return journal_restart(handle, nblocks); | ||
181 | } | ||
182 | |||
183 | static inline int ext3_journal_blocks_per_page(struct inode *inode) | ||
184 | { | ||
185 | return journal_blocks_per_page(inode); | ||
186 | } | ||
187 | |||
188 | static inline int ext3_journal_force_commit(journal_t *journal) | ||
189 | { | ||
190 | return journal_force_commit(journal); | ||
191 | } | ||
192 | |||
193 | /* super.c */ | ||
194 | int ext3_force_commit(struct super_block *sb); | ||
195 | |||
196 | static inline int ext3_should_journal_data(struct inode *inode) | ||
197 | { | ||
198 | if (!S_ISREG(inode->i_mode)) | ||
199 | return 1; | ||
200 | if (test_opt(inode->i_sb, DATA_FLAGS) == EXT3_MOUNT_JOURNAL_DATA) | ||
201 | return 1; | ||
202 | if (EXT3_I(inode)->i_flags & EXT3_JOURNAL_DATA_FL) | ||
203 | return 1; | ||
204 | return 0; | ||
205 | } | ||
206 | |||
207 | static inline int ext3_should_order_data(struct inode *inode) | ||
208 | { | ||
209 | if (!S_ISREG(inode->i_mode)) | ||
210 | return 0; | ||
211 | if (EXT3_I(inode)->i_flags & EXT3_JOURNAL_DATA_FL) | ||
212 | return 0; | ||
213 | if (test_opt(inode->i_sb, DATA_FLAGS) == EXT3_MOUNT_ORDERED_DATA) | ||
214 | return 1; | ||
215 | return 0; | ||
216 | } | ||
217 | |||
218 | static inline int ext3_should_writeback_data(struct inode *inode) | ||
219 | { | ||
220 | if (!S_ISREG(inode->i_mode)) | ||
221 | return 0; | ||
222 | if (EXT3_I(inode)->i_flags & EXT3_JOURNAL_DATA_FL) | ||
223 | return 0; | ||
224 | if (test_opt(inode->i_sb, DATA_FLAGS) == EXT3_MOUNT_WRITEBACK_DATA) | ||
225 | return 1; | ||
226 | return 0; | ||
227 | } | ||
228 | |||
229 | #endif /* _LINUX_EXT3_JBD_H */ | ||
diff --git a/include/linux/fb.h b/include/linux/fb.h index c18122f40543..d31cb682e173 100644 --- a/include/linux/fb.h +++ b/include/linux/fb.h | |||
@@ -407,7 +407,6 @@ struct fb_cursor { | |||
407 | 407 | ||
408 | #include <linux/fs.h> | 408 | #include <linux/fs.h> |
409 | #include <linux/init.h> | 409 | #include <linux/init.h> |
410 | #include <linux/device.h> | ||
411 | #include <linux/workqueue.h> | 410 | #include <linux/workqueue.h> |
412 | #include <linux/notifier.h> | 411 | #include <linux/notifier.h> |
413 | #include <linux/list.h> | 412 | #include <linux/list.h> |
@@ -1003,6 +1002,7 @@ extern ssize_t fb_sys_write(struct fb_info *info, const char __user *buf, | |||
1003 | /* drivers/video/fbmem.c */ | 1002 | /* drivers/video/fbmem.c */ |
1004 | extern int register_framebuffer(struct fb_info *fb_info); | 1003 | extern int register_framebuffer(struct fb_info *fb_info); |
1005 | extern int unregister_framebuffer(struct fb_info *fb_info); | 1004 | extern int unregister_framebuffer(struct fb_info *fb_info); |
1005 | extern int unlink_framebuffer(struct fb_info *fb_info); | ||
1006 | extern void remove_conflicting_framebuffers(struct apertures_struct *a, | 1006 | extern void remove_conflicting_framebuffers(struct apertures_struct *a, |
1007 | const char *name, bool primary); | 1007 | const char *name, bool primary); |
1008 | extern int fb_prepare_logo(struct fb_info *fb_info, int rotate); | 1008 | extern int fb_prepare_logo(struct fb_info *fb_info, int rotate); |
diff --git a/include/linux/fdtable.h b/include/linux/fdtable.h index 82163c4b32c9..158a41eed314 100644 --- a/include/linux/fdtable.h +++ b/include/linux/fdtable.h | |||
@@ -21,23 +21,45 @@ | |||
21 | */ | 21 | */ |
22 | #define NR_OPEN_DEFAULT BITS_PER_LONG | 22 | #define NR_OPEN_DEFAULT BITS_PER_LONG |
23 | 23 | ||
24 | /* | ||
25 | * The embedded_fd_set is a small fd_set, | ||
26 | * suitable for most tasks (which open <= BITS_PER_LONG files) | ||
27 | */ | ||
28 | struct embedded_fd_set { | ||
29 | unsigned long fds_bits[1]; | ||
30 | }; | ||
31 | |||
32 | struct fdtable { | 24 | struct fdtable { |
33 | unsigned int max_fds; | 25 | unsigned int max_fds; |
34 | struct file __rcu **fd; /* current fd array */ | 26 | struct file __rcu **fd; /* current fd array */ |
35 | fd_set *close_on_exec; | 27 | unsigned long *close_on_exec; |
36 | fd_set *open_fds; | 28 | unsigned long *open_fds; |
37 | struct rcu_head rcu; | 29 | struct rcu_head rcu; |
38 | struct fdtable *next; | 30 | struct fdtable *next; |
39 | }; | 31 | }; |
40 | 32 | ||
33 | static inline void __set_close_on_exec(int fd, struct fdtable *fdt) | ||
34 | { | ||
35 | __set_bit(fd, fdt->close_on_exec); | ||
36 | } | ||
37 | |||
38 | static inline void __clear_close_on_exec(int fd, struct fdtable *fdt) | ||
39 | { | ||
40 | __clear_bit(fd, fdt->close_on_exec); | ||
41 | } | ||
42 | |||
43 | static inline bool close_on_exec(int fd, const struct fdtable *fdt) | ||
44 | { | ||
45 | return test_bit(fd, fdt->close_on_exec); | ||
46 | } | ||
47 | |||
48 | static inline void __set_open_fd(int fd, struct fdtable *fdt) | ||
49 | { | ||
50 | __set_bit(fd, fdt->open_fds); | ||
51 | } | ||
52 | |||
53 | static inline void __clear_open_fd(int fd, struct fdtable *fdt) | ||
54 | { | ||
55 | __clear_bit(fd, fdt->open_fds); | ||
56 | } | ||
57 | |||
58 | static inline bool fd_is_open(int fd, const struct fdtable *fdt) | ||
59 | { | ||
60 | return test_bit(fd, fdt->open_fds); | ||
61 | } | ||
62 | |||
41 | /* | 63 | /* |
42 | * Open file table structure | 64 | * Open file table structure |
43 | */ | 65 | */ |
@@ -53,8 +75,8 @@ struct files_struct { | |||
53 | */ | 75 | */ |
54 | spinlock_t file_lock ____cacheline_aligned_in_smp; | 76 | spinlock_t file_lock ____cacheline_aligned_in_smp; |
55 | int next_fd; | 77 | int next_fd; |
56 | struct embedded_fd_set close_on_exec_init; | 78 | unsigned long close_on_exec_init[1]; |
57 | struct embedded_fd_set open_fds_init; | 79 | unsigned long open_fds_init[1]; |
58 | struct file __rcu * fd_array[NR_OPEN_DEFAULT]; | 80 | struct file __rcu * fd_array[NR_OPEN_DEFAULT]; |
59 | }; | 81 | }; |
60 | 82 | ||
diff --git a/include/linux/file.h b/include/linux/file.h index 21a79958541c..58bf158c53d9 100644 --- a/include/linux/file.h +++ b/include/linux/file.h | |||
@@ -12,7 +12,6 @@ | |||
12 | struct file; | 12 | struct file; |
13 | 13 | ||
14 | extern void fput(struct file *); | 14 | extern void fput(struct file *); |
15 | extern void drop_file_write_access(struct file *file); | ||
16 | 15 | ||
17 | struct file_operations; | 16 | struct file_operations; |
18 | struct vfsmount; | 17 | struct vfsmount; |
diff --git a/include/linux/firewire-cdev.h b/include/linux/firewire-cdev.h index 357dbfc2829e..d50036953497 100644 --- a/include/linux/firewire-cdev.h +++ b/include/linux/firewire-cdev.h | |||
@@ -207,12 +207,16 @@ struct fw_cdev_event_request2 { | |||
207 | * @closure: See &fw_cdev_event_common; | 207 | * @closure: See &fw_cdev_event_common; |
208 | * set by %FW_CDEV_CREATE_ISO_CONTEXT ioctl | 208 | * set by %FW_CDEV_CREATE_ISO_CONTEXT ioctl |
209 | * @type: See &fw_cdev_event_common; always %FW_CDEV_EVENT_ISO_INTERRUPT | 209 | * @type: See &fw_cdev_event_common; always %FW_CDEV_EVENT_ISO_INTERRUPT |
210 | * @cycle: Cycle counter of the interrupt packet | 210 | * @cycle: Cycle counter of the last completed packet |
211 | * @header_length: Total length of following headers, in bytes | 211 | * @header_length: Total length of following headers, in bytes |
212 | * @header: Stripped headers, if any | 212 | * @header: Stripped headers, if any |
213 | * | 213 | * |
214 | * This event is sent when the controller has completed an &fw_cdev_iso_packet | 214 | * This event is sent when the controller has completed an &fw_cdev_iso_packet |
215 | * with the %FW_CDEV_ISO_INTERRUPT bit set. | 215 | * with the %FW_CDEV_ISO_INTERRUPT bit set, when explicitly requested with |
216 | * %FW_CDEV_IOC_FLUSH_ISO, or when there have been so many completed packets | ||
217 | * without the interrupt bit set that the kernel's internal buffer for @header | ||
218 | * is about to overflow. (In the last case, kernels with ABI version < 5 drop | ||
219 | * header data up to the next interrupt packet.) | ||
216 | * | 220 | * |
217 | * Isochronous transmit events (context type %FW_CDEV_ISO_CONTEXT_TRANSMIT): | 221 | * Isochronous transmit events (context type %FW_CDEV_ISO_CONTEXT_TRANSMIT): |
218 | * | 222 | * |
@@ -267,9 +271,9 @@ struct fw_cdev_event_iso_interrupt { | |||
267 | * | 271 | * |
268 | * This event is sent in multichannel contexts (context type | 272 | * This event is sent in multichannel contexts (context type |
269 | * %FW_CDEV_ISO_CONTEXT_RECEIVE_MULTICHANNEL) for &fw_cdev_iso_packet buffer | 273 | * %FW_CDEV_ISO_CONTEXT_RECEIVE_MULTICHANNEL) for &fw_cdev_iso_packet buffer |
270 | * chunks that have the %FW_CDEV_ISO_INTERRUPT bit set. Whether this happens | 274 | * chunks that have been completely filled and that have the |
271 | * when a packet is completed and/or when a buffer chunk is completed depends | 275 | * %FW_CDEV_ISO_INTERRUPT bit set, or when explicitly requested with |
272 | * on the hardware implementation. | 276 | * %FW_CDEV_IOC_FLUSH_ISO. |
273 | * | 277 | * |
274 | * The buffer is continuously filled with the following data, per packet: | 278 | * The buffer is continuously filled with the following data, per packet: |
275 | * - the 1394 iso packet header as described at &fw_cdev_event_iso_interrupt, | 279 | * - the 1394 iso packet header as described at &fw_cdev_event_iso_interrupt, |
@@ -419,6 +423,9 @@ union fw_cdev_event { | |||
419 | #define FW_CDEV_IOC_RECEIVE_PHY_PACKETS _IOW('#', 0x16, struct fw_cdev_receive_phy_packets) | 423 | #define FW_CDEV_IOC_RECEIVE_PHY_PACKETS _IOW('#', 0x16, struct fw_cdev_receive_phy_packets) |
420 | #define FW_CDEV_IOC_SET_ISO_CHANNELS _IOW('#', 0x17, struct fw_cdev_set_iso_channels) | 424 | #define FW_CDEV_IOC_SET_ISO_CHANNELS _IOW('#', 0x17, struct fw_cdev_set_iso_channels) |
421 | 425 | ||
426 | /* available since kernel version 3.4 */ | ||
427 | #define FW_CDEV_IOC_FLUSH_ISO _IOW('#', 0x18, struct fw_cdev_flush_iso) | ||
428 | |||
422 | /* | 429 | /* |
423 | * ABI version history | 430 | * ABI version history |
424 | * 1 (2.6.22) - initial version | 431 | * 1 (2.6.22) - initial version |
@@ -441,6 +448,9 @@ union fw_cdev_event { | |||
441 | * - added %FW_CDEV_EVENT_ISO_INTERRUPT_MULTICHANNEL, | 448 | * - added %FW_CDEV_EVENT_ISO_INTERRUPT_MULTICHANNEL, |
442 | * %FW_CDEV_ISO_CONTEXT_RECEIVE_MULTICHANNEL, and | 449 | * %FW_CDEV_ISO_CONTEXT_RECEIVE_MULTICHANNEL, and |
443 | * %FW_CDEV_IOC_SET_ISO_CHANNELS | 450 | * %FW_CDEV_IOC_SET_ISO_CHANNELS |
451 | * 5 (3.4) - send %FW_CDEV_EVENT_ISO_INTERRUPT events when needed to | ||
452 | * avoid dropping data | ||
453 | * - added %FW_CDEV_IOC_FLUSH_ISO | ||
444 | */ | 454 | */ |
445 | 455 | ||
446 | /** | 456 | /** |
@@ -851,6 +861,25 @@ struct fw_cdev_stop_iso { | |||
851 | }; | 861 | }; |
852 | 862 | ||
853 | /** | 863 | /** |
864 | * struct fw_cdev_flush_iso - flush completed iso packets | ||
865 | * @handle: handle of isochronous context to flush | ||
866 | * | ||
867 | * For %FW_CDEV_ISO_CONTEXT_TRANSMIT or %FW_CDEV_ISO_CONTEXT_RECEIVE contexts, | ||
868 | * report any completed packets. | ||
869 | * | ||
870 | * For %FW_CDEV_ISO_CONTEXT_RECEIVE_MULTICHANNEL contexts, report the current | ||
871 | * offset in the receive buffer, if it has changed; this is typically in the | ||
872 | * middle of some buffer chunk. | ||
873 | * | ||
874 | * Any %FW_CDEV_EVENT_ISO_INTERRUPT or %FW_CDEV_EVENT_ISO_INTERRUPT_MULTICHANNEL | ||
875 | * events generated by this ioctl are sent synchronously, i.e., are available | ||
876 | * for reading from the file descriptor when this ioctl returns. | ||
877 | */ | ||
878 | struct fw_cdev_flush_iso { | ||
879 | __u32 handle; | ||
880 | }; | ||
881 | |||
882 | /** | ||
854 | * struct fw_cdev_get_cycle_timer - read cycle timer register | 883 | * struct fw_cdev_get_cycle_timer - read cycle timer register |
855 | * @local_time: system time, in microseconds since the Epoch | 884 | * @local_time: system time, in microseconds since the Epoch |
856 | * @cycle_timer: Cycle Time register contents | 885 | * @cycle_timer: Cycle Time register contents |
diff --git a/include/linux/firewire.h b/include/linux/firewire.h index 84ccf8e04fa6..cdc9b719e9c7 100644 --- a/include/linux/firewire.h +++ b/include/linux/firewire.h | |||
@@ -17,9 +17,6 @@ | |||
17 | #include <linux/atomic.h> | 17 | #include <linux/atomic.h> |
18 | #include <asm/byteorder.h> | 18 | #include <asm/byteorder.h> |
19 | 19 | ||
20 | #define fw_notify(s, args...) printk(KERN_NOTICE KBUILD_MODNAME ": " s, ## args) | ||
21 | #define fw_error(s, args...) printk(KERN_ERR KBUILD_MODNAME ": " s, ## args) | ||
22 | |||
23 | #define CSR_REGISTER_BASE 0xfffff0000000ULL | 20 | #define CSR_REGISTER_BASE 0xfffff0000000ULL |
24 | 21 | ||
25 | /* register offsets are relative to CSR_REGISTER_BASE */ | 22 | /* register offsets are relative to CSR_REGISTER_BASE */ |
@@ -203,18 +200,6 @@ static inline int fw_device_is_shutdown(struct fw_device *device) | |||
203 | return atomic_read(&device->state) == FW_DEVICE_SHUTDOWN; | 200 | return atomic_read(&device->state) == FW_DEVICE_SHUTDOWN; |
204 | } | 201 | } |
205 | 202 | ||
206 | static inline struct fw_device *fw_device_get(struct fw_device *device) | ||
207 | { | ||
208 | get_device(&device->device); | ||
209 | |||
210 | return device; | ||
211 | } | ||
212 | |||
213 | static inline void fw_device_put(struct fw_device *device) | ||
214 | { | ||
215 | put_device(&device->device); | ||
216 | } | ||
217 | |||
218 | int fw_device_enable_phys_dma(struct fw_device *device); | 203 | int fw_device_enable_phys_dma(struct fw_device *device); |
219 | 204 | ||
220 | /* | 205 | /* |
@@ -441,6 +426,7 @@ int fw_iso_context_queue(struct fw_iso_context *ctx, | |||
441 | struct fw_iso_buffer *buffer, | 426 | struct fw_iso_buffer *buffer, |
442 | unsigned long payload); | 427 | unsigned long payload); |
443 | void fw_iso_context_queue_flush(struct fw_iso_context *ctx); | 428 | void fw_iso_context_queue_flush(struct fw_iso_context *ctx); |
429 | int fw_iso_context_flush_completions(struct fw_iso_context *ctx); | ||
444 | int fw_iso_context_start(struct fw_iso_context *ctx, | 430 | int fw_iso_context_start(struct fw_iso_context *ctx, |
445 | int cycle, int sync, int tags); | 431 | int cycle, int sync, int tags); |
446 | int fw_iso_context_stop(struct fw_iso_context *ctx); | 432 | int fw_iso_context_stop(struct fw_iso_context *ctx); |
diff --git a/include/linux/fs.h b/include/linux/fs.h index 69cd5bb640f5..8de675523e46 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h | |||
@@ -92,6 +92,10 @@ struct inodes_stat_t { | |||
92 | /* File is opened using open(.., 3, ..) and is writeable only for ioctls | 92 | /* File is opened using open(.., 3, ..) and is writeable only for ioctls |
93 | (specialy hack for floppy.c) */ | 93 | (specialy hack for floppy.c) */ |
94 | #define FMODE_WRITE_IOCTL ((__force fmode_t)0x100) | 94 | #define FMODE_WRITE_IOCTL ((__force fmode_t)0x100) |
95 | /* 32bit hashes as llseek() offset (for directories) */ | ||
96 | #define FMODE_32BITHASH ((__force fmode_t)0x200) | ||
97 | /* 64bit hashes as llseek() offset (for directories) */ | ||
98 | #define FMODE_64BITHASH ((__force fmode_t)0x400) | ||
95 | 99 | ||
96 | /* | 100 | /* |
97 | * Don't update ctime and mtime. | 101 | * Don't update ctime and mtime. |
@@ -389,6 +393,7 @@ struct inodes_stat_t { | |||
389 | #include <linux/prio_tree.h> | 393 | #include <linux/prio_tree.h> |
390 | #include <linux/init.h> | 394 | #include <linux/init.h> |
391 | #include <linux/pid.h> | 395 | #include <linux/pid.h> |
396 | #include <linux/bug.h> | ||
392 | #include <linux/mutex.h> | 397 | #include <linux/mutex.h> |
393 | #include <linux/capability.h> | 398 | #include <linux/capability.h> |
394 | #include <linux/semaphore.h> | 399 | #include <linux/semaphore.h> |
@@ -1210,6 +1215,7 @@ extern int vfs_setlease(struct file *, long, struct file_lock **); | |||
1210 | extern int lease_modify(struct file_lock **, int); | 1215 | extern int lease_modify(struct file_lock **, int); |
1211 | extern int lock_may_read(struct inode *, loff_t start, unsigned long count); | 1216 | extern int lock_may_read(struct inode *, loff_t start, unsigned long count); |
1212 | extern int lock_may_write(struct inode *, loff_t start, unsigned long count); | 1217 | extern int lock_may_write(struct inode *, loff_t start, unsigned long count); |
1218 | extern void locks_delete_block(struct file_lock *waiter); | ||
1213 | extern void lock_flocks(void); | 1219 | extern void lock_flocks(void); |
1214 | extern void unlock_flocks(void); | 1220 | extern void unlock_flocks(void); |
1215 | #else /* !CONFIG_FILE_LOCKING */ | 1221 | #else /* !CONFIG_FILE_LOCKING */ |
@@ -1354,6 +1360,10 @@ static inline int lock_may_write(struct inode *inode, loff_t start, | |||
1354 | return 1; | 1360 | return 1; |
1355 | } | 1361 | } |
1356 | 1362 | ||
1363 | static inline void locks_delete_block(struct file_lock *waiter) | ||
1364 | { | ||
1365 | } | ||
1366 | |||
1357 | static inline void lock_flocks(void) | 1367 | static inline void lock_flocks(void) |
1358 | { | 1368 | { |
1359 | } | 1369 | } |
@@ -1459,6 +1469,7 @@ struct super_block { | |||
1459 | u8 s_uuid[16]; /* UUID */ | 1469 | u8 s_uuid[16]; /* UUID */ |
1460 | 1470 | ||
1461 | void *s_fs_info; /* Filesystem private info */ | 1471 | void *s_fs_info; /* Filesystem private info */ |
1472 | unsigned int s_max_links; | ||
1462 | fmode_t s_mode; | 1473 | fmode_t s_mode; |
1463 | 1474 | ||
1464 | /* Granularity of c/m/atime in ns. | 1475 | /* Granularity of c/m/atime in ns. |
@@ -1811,11 +1822,11 @@ static inline void inode_inc_iversion(struct inode *inode) | |||
1811 | spin_unlock(&inode->i_lock); | 1822 | spin_unlock(&inode->i_lock); |
1812 | } | 1823 | } |
1813 | 1824 | ||
1814 | extern void touch_atime(struct vfsmount *mnt, struct dentry *dentry); | 1825 | extern void touch_atime(struct path *); |
1815 | static inline void file_accessed(struct file *file) | 1826 | static inline void file_accessed(struct file *file) |
1816 | { | 1827 | { |
1817 | if (!(file->f_flags & O_NOATIME)) | 1828 | if (!(file->f_flags & O_NOATIME)) |
1818 | touch_atime(file->f_path.mnt, file->f_path.dentry); | 1829 | touch_atime(&file->f_path); |
1819 | } | 1830 | } |
1820 | 1831 | ||
1821 | int sync_inode(struct inode *inode, struct writeback_control *wbc); | 1832 | int sync_inode(struct inode *inode, struct writeback_control *wbc); |
@@ -1870,19 +1881,6 @@ extern struct dentry *mount_pseudo(struct file_system_type *, char *, | |||
1870 | const struct dentry_operations *dops, | 1881 | const struct dentry_operations *dops, |
1871 | unsigned long); | 1882 | unsigned long); |
1872 | 1883 | ||
1873 | static inline void sb_mark_dirty(struct super_block *sb) | ||
1874 | { | ||
1875 | sb->s_dirt = 1; | ||
1876 | } | ||
1877 | static inline void sb_mark_clean(struct super_block *sb) | ||
1878 | { | ||
1879 | sb->s_dirt = 0; | ||
1880 | } | ||
1881 | static inline int sb_is_dirty(struct super_block *sb) | ||
1882 | { | ||
1883 | return sb->s_dirt; | ||
1884 | } | ||
1885 | |||
1886 | /* Alas, no aliases. Too much hassle with bringing module.h everywhere */ | 1884 | /* Alas, no aliases. Too much hassle with bringing module.h everywhere */ |
1887 | #define fops_get(fops) \ | 1885 | #define fops_get(fops) \ |
1888 | (((fops) && try_module_get((fops)->owner) ? (fops) : NULL)) | 1886 | (((fops) && try_module_get((fops)->owner) ? (fops) : NULL)) |
@@ -2304,7 +2302,10 @@ extern struct inode * igrab(struct inode *); | |||
2304 | extern ino_t iunique(struct super_block *, ino_t); | 2302 | extern ino_t iunique(struct super_block *, ino_t); |
2305 | extern int inode_needs_sync(struct inode *inode); | 2303 | extern int inode_needs_sync(struct inode *inode); |
2306 | extern int generic_delete_inode(struct inode *inode); | 2304 | extern int generic_delete_inode(struct inode *inode); |
2307 | extern int generic_drop_inode(struct inode *inode); | 2305 | static inline int generic_drop_inode(struct inode *inode) |
2306 | { | ||
2307 | return !inode->i_nlink || inode_unhashed(inode); | ||
2308 | } | ||
2308 | 2309 | ||
2309 | extern struct inode *ilookup5_nowait(struct super_block *sb, | 2310 | extern struct inode *ilookup5_nowait(struct super_block *sb, |
2310 | unsigned long hashval, int (*test)(struct inode *, void *), | 2311 | unsigned long hashval, int (*test)(struct inode *, void *), |
@@ -2510,6 +2511,7 @@ extern int dcache_readdir(struct file *, void *, filldir_t); | |||
2510 | extern int simple_setattr(struct dentry *, struct iattr *); | 2511 | extern int simple_setattr(struct dentry *, struct iattr *); |
2511 | extern int simple_getattr(struct vfsmount *, struct dentry *, struct kstat *); | 2512 | extern int simple_getattr(struct vfsmount *, struct dentry *, struct kstat *); |
2512 | extern int simple_statfs(struct dentry *, struct kstatfs *); | 2513 | extern int simple_statfs(struct dentry *, struct kstatfs *); |
2514 | extern int simple_open(struct inode *inode, struct file *file); | ||
2513 | extern int simple_link(struct dentry *, struct inode *, struct dentry *); | 2515 | extern int simple_link(struct dentry *, struct inode *, struct dentry *); |
2514 | extern int simple_unlink(struct inode *, struct dentry *); | 2516 | extern int simple_unlink(struct inode *, struct dentry *); |
2515 | extern int simple_rmdir(struct inode *, struct dentry *); | 2517 | extern int simple_rmdir(struct inode *, struct dentry *); |
diff --git a/include/linux/fsl/mxs-dma.h b/include/linux/fsl/mxs-dma.h new file mode 100644 index 000000000000..203d7c4a3e11 --- /dev/null +++ b/include/linux/fsl/mxs-dma.h | |||
@@ -0,0 +1,28 @@ | |||
1 | /* | ||
2 | * Copyright 2011 Freescale Semiconductor, Inc. All Rights Reserved. | ||
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 __MACH_MXS_DMA_H__ | ||
10 | #define __MACH_MXS_DMA_H__ | ||
11 | |||
12 | #include <linux/dmaengine.h> | ||
13 | |||
14 | struct mxs_dma_data { | ||
15 | int chan_irq; | ||
16 | }; | ||
17 | |||
18 | static inline int mxs_dma_is_apbh(struct dma_chan *chan) | ||
19 | { | ||
20 | return !strcmp(dev_name(chan->device->dev), "mxs-dma-apbh"); | ||
21 | } | ||
22 | |||
23 | static inline int mxs_dma_is_apbx(struct dma_chan *chan) | ||
24 | { | ||
25 | return !strcmp(dev_name(chan->device->dev), "mxs-dma-apbx"); | ||
26 | } | ||
27 | |||
28 | #endif /* __MACH_MXS_DMA_H__ */ | ||
diff --git a/include/linux/fsnotify.h b/include/linux/fsnotify.h index 2a53f10712b3..a6dfe6944564 100644 --- a/include/linux/fsnotify.h +++ b/include/linux/fsnotify.h | |||
@@ -14,6 +14,7 @@ | |||
14 | #include <linux/fsnotify_backend.h> | 14 | #include <linux/fsnotify_backend.h> |
15 | #include <linux/audit.h> | 15 | #include <linux/audit.h> |
16 | #include <linux/slab.h> | 16 | #include <linux/slab.h> |
17 | #include <linux/bug.h> | ||
17 | 18 | ||
18 | /* | 19 | /* |
19 | * fsnotify_d_instantiate - instantiate a dentry for inode | 20 | * fsnotify_d_instantiate - instantiate a dentry for inode |
diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h index 028e26f0bf08..72a6cabb4d5b 100644 --- a/include/linux/ftrace.h +++ b/include/linux/ftrace.h | |||
@@ -31,16 +31,33 @@ ftrace_enable_sysctl(struct ctl_table *table, int write, | |||
31 | 31 | ||
32 | typedef void (*ftrace_func_t)(unsigned long ip, unsigned long parent_ip); | 32 | typedef void (*ftrace_func_t)(unsigned long ip, unsigned long parent_ip); |
33 | 33 | ||
34 | /* | ||
35 | * FTRACE_OPS_FL_* bits denote the state of ftrace_ops struct and are | ||
36 | * set in the flags member. | ||
37 | * | ||
38 | * ENABLED - set/unset when ftrace_ops is registered/unregistered | ||
39 | * GLOBAL - set manualy by ftrace_ops user to denote the ftrace_ops | ||
40 | * is part of the global tracers sharing the same filter | ||
41 | * via set_ftrace_* debugfs files. | ||
42 | * DYNAMIC - set when ftrace_ops is registered to denote dynamically | ||
43 | * allocated ftrace_ops which need special care | ||
44 | * CONTROL - set manualy by ftrace_ops user to denote the ftrace_ops | ||
45 | * could be controled by following calls: | ||
46 | * ftrace_function_local_enable | ||
47 | * ftrace_function_local_disable | ||
48 | */ | ||
34 | enum { | 49 | enum { |
35 | FTRACE_OPS_FL_ENABLED = 1 << 0, | 50 | FTRACE_OPS_FL_ENABLED = 1 << 0, |
36 | FTRACE_OPS_FL_GLOBAL = 1 << 1, | 51 | FTRACE_OPS_FL_GLOBAL = 1 << 1, |
37 | FTRACE_OPS_FL_DYNAMIC = 1 << 2, | 52 | FTRACE_OPS_FL_DYNAMIC = 1 << 2, |
53 | FTRACE_OPS_FL_CONTROL = 1 << 3, | ||
38 | }; | 54 | }; |
39 | 55 | ||
40 | struct ftrace_ops { | 56 | struct ftrace_ops { |
41 | ftrace_func_t func; | 57 | ftrace_func_t func; |
42 | struct ftrace_ops *next; | 58 | struct ftrace_ops *next; |
43 | unsigned long flags; | 59 | unsigned long flags; |
60 | int __percpu *disabled; | ||
44 | #ifdef CONFIG_DYNAMIC_FTRACE | 61 | #ifdef CONFIG_DYNAMIC_FTRACE |
45 | struct ftrace_hash *notrace_hash; | 62 | struct ftrace_hash *notrace_hash; |
46 | struct ftrace_hash *filter_hash; | 63 | struct ftrace_hash *filter_hash; |
@@ -97,6 +114,55 @@ int register_ftrace_function(struct ftrace_ops *ops); | |||
97 | int unregister_ftrace_function(struct ftrace_ops *ops); | 114 | int unregister_ftrace_function(struct ftrace_ops *ops); |
98 | void clear_ftrace_function(void); | 115 | void clear_ftrace_function(void); |
99 | 116 | ||
117 | /** | ||
118 | * ftrace_function_local_enable - enable controlled ftrace_ops on current cpu | ||
119 | * | ||
120 | * This function enables tracing on current cpu by decreasing | ||
121 | * the per cpu control variable. | ||
122 | * It must be called with preemption disabled and only on ftrace_ops | ||
123 | * registered with FTRACE_OPS_FL_CONTROL. If called without preemption | ||
124 | * disabled, this_cpu_ptr will complain when CONFIG_DEBUG_PREEMPT is enabled. | ||
125 | */ | ||
126 | static inline void ftrace_function_local_enable(struct ftrace_ops *ops) | ||
127 | { | ||
128 | if (WARN_ON_ONCE(!(ops->flags & FTRACE_OPS_FL_CONTROL))) | ||
129 | return; | ||
130 | |||
131 | (*this_cpu_ptr(ops->disabled))--; | ||
132 | } | ||
133 | |||
134 | /** | ||
135 | * ftrace_function_local_disable - enable controlled ftrace_ops on current cpu | ||
136 | * | ||
137 | * This function enables tracing on current cpu by decreasing | ||
138 | * the per cpu control variable. | ||
139 | * It must be called with preemption disabled and only on ftrace_ops | ||
140 | * registered with FTRACE_OPS_FL_CONTROL. If called without preemption | ||
141 | * disabled, this_cpu_ptr will complain when CONFIG_DEBUG_PREEMPT is enabled. | ||
142 | */ | ||
143 | static inline void ftrace_function_local_disable(struct ftrace_ops *ops) | ||
144 | { | ||
145 | if (WARN_ON_ONCE(!(ops->flags & FTRACE_OPS_FL_CONTROL))) | ||
146 | return; | ||
147 | |||
148 | (*this_cpu_ptr(ops->disabled))++; | ||
149 | } | ||
150 | |||
151 | /** | ||
152 | * ftrace_function_local_disabled - returns ftrace_ops disabled value | ||
153 | * on current cpu | ||
154 | * | ||
155 | * This function returns value of ftrace_ops::disabled on current cpu. | ||
156 | * It must be called with preemption disabled and only on ftrace_ops | ||
157 | * registered with FTRACE_OPS_FL_CONTROL. If called without preemption | ||
158 | * disabled, this_cpu_ptr will complain when CONFIG_DEBUG_PREEMPT is enabled. | ||
159 | */ | ||
160 | static inline int ftrace_function_local_disabled(struct ftrace_ops *ops) | ||
161 | { | ||
162 | WARN_ON_ONCE(!(ops->flags & FTRACE_OPS_FL_CONTROL)); | ||
163 | return *this_cpu_ptr(ops->disabled); | ||
164 | } | ||
165 | |||
100 | extern void ftrace_stub(unsigned long a0, unsigned long a1); | 166 | extern void ftrace_stub(unsigned long a0, unsigned long a1); |
101 | 167 | ||
102 | #else /* !CONFIG_FUNCTION_TRACER */ | 168 | #else /* !CONFIG_FUNCTION_TRACER */ |
@@ -178,12 +244,13 @@ struct dyn_ftrace { | |||
178 | }; | 244 | }; |
179 | 245 | ||
180 | int ftrace_force_update(void); | 246 | int ftrace_force_update(void); |
181 | void ftrace_set_filter(struct ftrace_ops *ops, unsigned char *buf, | 247 | int ftrace_set_filter(struct ftrace_ops *ops, unsigned char *buf, |
182 | int len, int reset); | 248 | int len, int reset); |
183 | void ftrace_set_notrace(struct ftrace_ops *ops, unsigned char *buf, | 249 | int ftrace_set_notrace(struct ftrace_ops *ops, unsigned char *buf, |
184 | int len, int reset); | 250 | int len, int reset); |
185 | void ftrace_set_global_filter(unsigned char *buf, int len, int reset); | 251 | void ftrace_set_global_filter(unsigned char *buf, int len, int reset); |
186 | void ftrace_set_global_notrace(unsigned char *buf, int len, int reset); | 252 | void ftrace_set_global_notrace(unsigned char *buf, int len, int reset); |
253 | void ftrace_free_filter(struct ftrace_ops *ops); | ||
187 | 254 | ||
188 | int register_ftrace_command(struct ftrace_func_command *cmd); | 255 | int register_ftrace_command(struct ftrace_func_command *cmd); |
189 | int unregister_ftrace_command(struct ftrace_func_command *cmd); | 256 | int unregister_ftrace_command(struct ftrace_func_command *cmd); |
@@ -314,9 +381,6 @@ extern void ftrace_enable_daemon(void); | |||
314 | #else | 381 | #else |
315 | static inline int skip_trace(unsigned long ip) { return 0; } | 382 | static inline int skip_trace(unsigned long ip) { return 0; } |
316 | static inline int ftrace_force_update(void) { return 0; } | 383 | static inline int ftrace_force_update(void) { return 0; } |
317 | static inline void ftrace_set_filter(unsigned char *buf, int len, int reset) | ||
318 | { | ||
319 | } | ||
320 | static inline void ftrace_disable_daemon(void) { } | 384 | static inline void ftrace_disable_daemon(void) { } |
321 | static inline void ftrace_enable_daemon(void) { } | 385 | static inline void ftrace_enable_daemon(void) { } |
322 | static inline void ftrace_release_mod(struct module *mod) {} | 386 | static inline void ftrace_release_mod(struct module *mod) {} |
@@ -340,6 +404,9 @@ static inline int ftrace_text_reserved(void *start, void *end) | |||
340 | */ | 404 | */ |
341 | #define ftrace_regex_open(ops, flag, inod, file) ({ -ENODEV; }) | 405 | #define ftrace_regex_open(ops, flag, inod, file) ({ -ENODEV; }) |
342 | #define ftrace_set_early_filter(ops, buf, enable) do { } while (0) | 406 | #define ftrace_set_early_filter(ops, buf, enable) do { } while (0) |
407 | #define ftrace_set_filter(ops, buf, len, reset) ({ -ENODEV; }) | ||
408 | #define ftrace_set_notrace(ops, buf, len, reset) ({ -ENODEV; }) | ||
409 | #define ftrace_free_filter(ops) do { } while (0) | ||
343 | 410 | ||
344 | static inline ssize_t ftrace_filter_write(struct file *file, const char __user *ubuf, | 411 | static inline ssize_t ftrace_filter_write(struct file *file, const char __user *ubuf, |
345 | size_t cnt, loff_t *ppos) { return -ENODEV; } | 412 | size_t cnt, loff_t *ppos) { return -ENODEV; } |
diff --git a/include/linux/ftrace_event.h b/include/linux/ftrace_event.h index c3da42dd22ba..5f3f3be5af09 100644 --- a/include/linux/ftrace_event.h +++ b/include/linux/ftrace_event.h | |||
@@ -144,8 +144,14 @@ struct event_filter; | |||
144 | enum trace_reg { | 144 | enum trace_reg { |
145 | TRACE_REG_REGISTER, | 145 | TRACE_REG_REGISTER, |
146 | TRACE_REG_UNREGISTER, | 146 | TRACE_REG_UNREGISTER, |
147 | #ifdef CONFIG_PERF_EVENTS | ||
147 | TRACE_REG_PERF_REGISTER, | 148 | TRACE_REG_PERF_REGISTER, |
148 | TRACE_REG_PERF_UNREGISTER, | 149 | TRACE_REG_PERF_UNREGISTER, |
150 | TRACE_REG_PERF_OPEN, | ||
151 | TRACE_REG_PERF_CLOSE, | ||
152 | TRACE_REG_PERF_ADD, | ||
153 | TRACE_REG_PERF_DEL, | ||
154 | #endif | ||
149 | }; | 155 | }; |
150 | 156 | ||
151 | struct ftrace_event_call; | 157 | struct ftrace_event_call; |
@@ -157,7 +163,7 @@ struct ftrace_event_class { | |||
157 | void *perf_probe; | 163 | void *perf_probe; |
158 | #endif | 164 | #endif |
159 | int (*reg)(struct ftrace_event_call *event, | 165 | int (*reg)(struct ftrace_event_call *event, |
160 | enum trace_reg type); | 166 | enum trace_reg type, void *data); |
161 | int (*define_fields)(struct ftrace_event_call *); | 167 | int (*define_fields)(struct ftrace_event_call *); |
162 | struct list_head *(*get_fields)(struct ftrace_event_call *); | 168 | struct list_head *(*get_fields)(struct ftrace_event_call *); |
163 | struct list_head fields; | 169 | struct list_head fields; |
@@ -165,7 +171,7 @@ struct ftrace_event_class { | |||
165 | }; | 171 | }; |
166 | 172 | ||
167 | extern int ftrace_event_reg(struct ftrace_event_call *event, | 173 | extern int ftrace_event_reg(struct ftrace_event_call *event, |
168 | enum trace_reg type); | 174 | enum trace_reg type, void *data); |
169 | 175 | ||
170 | enum { | 176 | enum { |
171 | TRACE_EVENT_FL_ENABLED_BIT, | 177 | TRACE_EVENT_FL_ENABLED_BIT, |
@@ -241,6 +247,7 @@ enum { | |||
241 | FILTER_STATIC_STRING, | 247 | FILTER_STATIC_STRING, |
242 | FILTER_DYN_STRING, | 248 | FILTER_DYN_STRING, |
243 | FILTER_PTR_STRING, | 249 | FILTER_PTR_STRING, |
250 | FILTER_TRACE_FN, | ||
244 | }; | 251 | }; |
245 | 252 | ||
246 | #define EVENT_STORAGE_SIZE 128 | 253 | #define EVENT_STORAGE_SIZE 128 |
diff --git a/include/linux/fuse.h b/include/linux/fuse.h index 8ba2c9460b28..8f2ab8fef929 100644 --- a/include/linux/fuse.h +++ b/include/linux/fuse.h | |||
@@ -593,7 +593,7 @@ struct fuse_dirent { | |||
593 | __u64 off; | 593 | __u64 off; |
594 | __u32 namelen; | 594 | __u32 namelen; |
595 | __u32 type; | 595 | __u32 type; |
596 | char name[0]; | 596 | char name[]; |
597 | }; | 597 | }; |
598 | 598 | ||
599 | #define FUSE_NAME_OFFSET offsetof(struct fuse_dirent, name) | 599 | #define FUSE_NAME_OFFSET offsetof(struct fuse_dirent, name) |
diff --git a/include/linux/genhd.h b/include/linux/genhd.h index fe23ee768589..e61d3192448e 100644 --- a/include/linux/genhd.h +++ b/include/linux/genhd.h | |||
@@ -596,6 +596,7 @@ extern char *disk_name (struct gendisk *hd, int partno, char *buf); | |||
596 | 596 | ||
597 | extern int disk_expand_part_tbl(struct gendisk *disk, int target); | 597 | extern int disk_expand_part_tbl(struct gendisk *disk, int target); |
598 | extern int rescan_partitions(struct gendisk *disk, struct block_device *bdev); | 598 | extern int rescan_partitions(struct gendisk *disk, struct block_device *bdev); |
599 | extern int invalidate_partitions(struct gendisk *disk, struct block_device *bdev); | ||
599 | extern struct hd_struct * __must_check add_partition(struct gendisk *disk, | 600 | extern struct hd_struct * __must_check add_partition(struct gendisk *disk, |
600 | int partno, sector_t start, | 601 | int partno, sector_t start, |
601 | sector_t len, int flags, | 602 | sector_t len, int flags, |
diff --git a/include/linux/gfs2_ondisk.h b/include/linux/gfs2_ondisk.h index b148087f49a6..fa98bdb073b9 100644 --- a/include/linux/gfs2_ondisk.h +++ b/include/linux/gfs2_ondisk.h | |||
@@ -168,6 +168,7 @@ struct gfs2_rindex { | |||
168 | #define GFS2_RGF_METAONLY 0x00000002 | 168 | #define GFS2_RGF_METAONLY 0x00000002 |
169 | #define GFS2_RGF_DATAONLY 0x00000004 | 169 | #define GFS2_RGF_DATAONLY 0x00000004 |
170 | #define GFS2_RGF_NOALLOC 0x00000008 | 170 | #define GFS2_RGF_NOALLOC 0x00000008 |
171 | #define GFS2_RGF_TRIMMED 0x00000010 | ||
171 | 172 | ||
172 | struct gfs2_rgrp { | 173 | struct gfs2_rgrp { |
173 | struct gfs2_meta_header rg_header; | 174 | struct gfs2_meta_header rg_header; |
diff --git a/include/linux/gpio.h b/include/linux/gpio.h index 38ac48b7d3a8..6155ecf192b0 100644 --- a/include/linux/gpio.h +++ b/include/linux/gpio.h | |||
@@ -14,6 +14,12 @@ | |||
14 | #define GPIOF_OUT_INIT_LOW (GPIOF_DIR_OUT | GPIOF_INIT_LOW) | 14 | #define GPIOF_OUT_INIT_LOW (GPIOF_DIR_OUT | GPIOF_INIT_LOW) |
15 | #define GPIOF_OUT_INIT_HIGH (GPIOF_DIR_OUT | GPIOF_INIT_HIGH) | 15 | #define GPIOF_OUT_INIT_HIGH (GPIOF_DIR_OUT | GPIOF_INIT_HIGH) |
16 | 16 | ||
17 | /* Gpio pin is open drain */ | ||
18 | #define GPIOF_OPEN_DRAIN (1 << 2) | ||
19 | |||
20 | /* Gpio pin is open source */ | ||
21 | #define GPIOF_OPEN_SOURCE (1 << 3) | ||
22 | |||
17 | /** | 23 | /** |
18 | * struct gpio - a structure describing a GPIO with configuration | 24 | * struct gpio - a structure describing a GPIO with configuration |
19 | * @gpio: the GPIO number | 25 | * @gpio: the GPIO number |
@@ -34,6 +40,7 @@ struct gpio { | |||
34 | #include <linux/kernel.h> | 40 | #include <linux/kernel.h> |
35 | #include <linux/types.h> | 41 | #include <linux/types.h> |
36 | #include <linux/errno.h> | 42 | #include <linux/errno.h> |
43 | #include <linux/bug.h> | ||
37 | 44 | ||
38 | struct device; | 45 | struct device; |
39 | struct gpio_chip; | 46 | struct gpio_chip; |
diff --git a/include/linux/highmem.h b/include/linux/highmem.h index 3a93f73a8acc..d3999b4e26cc 100644 --- a/include/linux/highmem.h +++ b/include/linux/highmem.h | |||
@@ -3,6 +3,7 @@ | |||
3 | 3 | ||
4 | #include <linux/fs.h> | 4 | #include <linux/fs.h> |
5 | #include <linux/kernel.h> | 5 | #include <linux/kernel.h> |
6 | #include <linux/bug.h> | ||
6 | #include <linux/mm.h> | 7 | #include <linux/mm.h> |
7 | #include <linux/uaccess.h> | 8 | #include <linux/uaccess.h> |
8 | #include <linux/hardirq.h> | 9 | #include <linux/hardirq.h> |
@@ -55,12 +56,12 @@ static inline void kunmap(struct page *page) | |||
55 | { | 56 | { |
56 | } | 57 | } |
57 | 58 | ||
58 | static inline void *__kmap_atomic(struct page *page) | 59 | static inline void *kmap_atomic(struct page *page) |
59 | { | 60 | { |
60 | pagefault_disable(); | 61 | pagefault_disable(); |
61 | return page_address(page); | 62 | return page_address(page); |
62 | } | 63 | } |
63 | #define kmap_atomic_prot(page, prot) __kmap_atomic(page) | 64 | #define kmap_atomic_prot(page, prot) kmap_atomic(page) |
64 | 65 | ||
65 | static inline void __kunmap_atomic(void *addr) | 66 | static inline void __kunmap_atomic(void *addr) |
66 | { | 67 | { |
@@ -109,27 +110,62 @@ static inline void kmap_atomic_idx_pop(void) | |||
109 | #endif | 110 | #endif |
110 | 111 | ||
111 | /* | 112 | /* |
112 | * Make both: kmap_atomic(page, idx) and kmap_atomic(page) work. | 113 | * NOTE: |
114 | * kmap_atomic() and kunmap_atomic() with two arguments are deprecated. | ||
115 | * We only keep them for backward compatibility, any usage of them | ||
116 | * are now warned. | ||
113 | */ | 117 | */ |
114 | #define kmap_atomic(page, args...) __kmap_atomic(page) | 118 | |
119 | #define PASTE(a, b) a ## b | ||
120 | #define PASTE2(a, b) PASTE(a, b) | ||
121 | |||
122 | #define NARG_(_2, _1, n, ...) n | ||
123 | #define NARG(...) NARG_(__VA_ARGS__, 2, 1, :) | ||
124 | |||
125 | static inline void __deprecated *kmap_atomic_deprecated(struct page *page, | ||
126 | enum km_type km) | ||
127 | { | ||
128 | return kmap_atomic(page); | ||
129 | } | ||
130 | |||
131 | #define kmap_atomic1(...) kmap_atomic(__VA_ARGS__) | ||
132 | #define kmap_atomic2(...) kmap_atomic_deprecated(__VA_ARGS__) | ||
133 | #define kmap_atomic(...) PASTE2(kmap_atomic, NARG(__VA_ARGS__)(__VA_ARGS__)) | ||
134 | |||
135 | static inline void __deprecated __kunmap_atomic_deprecated(void *addr, | ||
136 | enum km_type km) | ||
137 | { | ||
138 | __kunmap_atomic(addr); | ||
139 | } | ||
115 | 140 | ||
116 | /* | 141 | /* |
117 | * Prevent people trying to call kunmap_atomic() as if it were kunmap() | 142 | * Prevent people trying to call kunmap_atomic() as if it were kunmap() |
118 | * kunmap_atomic() should get the return value of kmap_atomic, not the page. | 143 | * kunmap_atomic() should get the return value of kmap_atomic, not the page. |
119 | */ | 144 | */ |
120 | #define kunmap_atomic(addr, args...) \ | 145 | #define kunmap_atomic_deprecated(addr, km) \ |
121 | do { \ | 146 | do { \ |
122 | BUILD_BUG_ON(__same_type((addr), struct page *)); \ | 147 | BUILD_BUG_ON(__same_type((addr), struct page *)); \ |
123 | __kunmap_atomic(addr); \ | 148 | __kunmap_atomic_deprecated(addr, km); \ |
124 | } while (0) | 149 | } while (0) |
125 | 150 | ||
151 | #define kunmap_atomic_withcheck(addr) \ | ||
152 | do { \ | ||
153 | BUILD_BUG_ON(__same_type((addr), struct page *)); \ | ||
154 | __kunmap_atomic(addr); \ | ||
155 | } while (0) | ||
156 | |||
157 | #define kunmap_atomic1(...) kunmap_atomic_withcheck(__VA_ARGS__) | ||
158 | #define kunmap_atomic2(...) kunmap_atomic_deprecated(__VA_ARGS__) | ||
159 | #define kunmap_atomic(...) PASTE2(kunmap_atomic, NARG(__VA_ARGS__)(__VA_ARGS__)) | ||
160 | /**** End of C pre-processor tricks for deprecated macros ****/ | ||
161 | |||
126 | /* when CONFIG_HIGHMEM is not set these will be plain clear/copy_page */ | 162 | /* when CONFIG_HIGHMEM is not set these will be plain clear/copy_page */ |
127 | #ifndef clear_user_highpage | 163 | #ifndef clear_user_highpage |
128 | static inline void clear_user_highpage(struct page *page, unsigned long vaddr) | 164 | static inline void clear_user_highpage(struct page *page, unsigned long vaddr) |
129 | { | 165 | { |
130 | void *addr = kmap_atomic(page, KM_USER0); | 166 | void *addr = kmap_atomic(page); |
131 | clear_user_page(addr, vaddr, page); | 167 | clear_user_page(addr, vaddr, page); |
132 | kunmap_atomic(addr, KM_USER0); | 168 | kunmap_atomic(addr); |
133 | } | 169 | } |
134 | #endif | 170 | #endif |
135 | 171 | ||
@@ -180,16 +216,16 @@ alloc_zeroed_user_highpage_movable(struct vm_area_struct *vma, | |||
180 | 216 | ||
181 | static inline void clear_highpage(struct page *page) | 217 | static inline void clear_highpage(struct page *page) |
182 | { | 218 | { |
183 | void *kaddr = kmap_atomic(page, KM_USER0); | 219 | void *kaddr = kmap_atomic(page); |
184 | clear_page(kaddr); | 220 | clear_page(kaddr); |
185 | kunmap_atomic(kaddr, KM_USER0); | 221 | kunmap_atomic(kaddr); |
186 | } | 222 | } |
187 | 223 | ||
188 | static inline void zero_user_segments(struct page *page, | 224 | static inline void zero_user_segments(struct page *page, |
189 | unsigned start1, unsigned end1, | 225 | unsigned start1, unsigned end1, |
190 | unsigned start2, unsigned end2) | 226 | unsigned start2, unsigned end2) |
191 | { | 227 | { |
192 | void *kaddr = kmap_atomic(page, KM_USER0); | 228 | void *kaddr = kmap_atomic(page); |
193 | 229 | ||
194 | BUG_ON(end1 > PAGE_SIZE || end2 > PAGE_SIZE); | 230 | BUG_ON(end1 > PAGE_SIZE || end2 > PAGE_SIZE); |
195 | 231 | ||
@@ -199,7 +235,7 @@ static inline void zero_user_segments(struct page *page, | |||
199 | if (end2 > start2) | 235 | if (end2 > start2) |
200 | memset(kaddr + start2, 0, end2 - start2); | 236 | memset(kaddr + start2, 0, end2 - start2); |
201 | 237 | ||
202 | kunmap_atomic(kaddr, KM_USER0); | 238 | kunmap_atomic(kaddr); |
203 | flush_dcache_page(page); | 239 | flush_dcache_page(page); |
204 | } | 240 | } |
205 | 241 | ||
@@ -228,11 +264,11 @@ static inline void copy_user_highpage(struct page *to, struct page *from, | |||
228 | { | 264 | { |
229 | char *vfrom, *vto; | 265 | char *vfrom, *vto; |
230 | 266 | ||
231 | vfrom = kmap_atomic(from, KM_USER0); | 267 | vfrom = kmap_atomic(from); |
232 | vto = kmap_atomic(to, KM_USER1); | 268 | vto = kmap_atomic(to); |
233 | copy_user_page(vto, vfrom, vaddr, to); | 269 | copy_user_page(vto, vfrom, vaddr, to); |
234 | kunmap_atomic(vto, KM_USER1); | 270 | kunmap_atomic(vto); |
235 | kunmap_atomic(vfrom, KM_USER0); | 271 | kunmap_atomic(vfrom); |
236 | } | 272 | } |
237 | 273 | ||
238 | #endif | 274 | #endif |
@@ -241,11 +277,11 @@ static inline void copy_highpage(struct page *to, struct page *from) | |||
241 | { | 277 | { |
242 | char *vfrom, *vto; | 278 | char *vfrom, *vto; |
243 | 279 | ||
244 | vfrom = kmap_atomic(from, KM_USER0); | 280 | vfrom = kmap_atomic(from); |
245 | vto = kmap_atomic(to, KM_USER1); | 281 | vto = kmap_atomic(to); |
246 | copy_page(vto, vfrom); | 282 | copy_page(vto, vfrom); |
247 | kunmap_atomic(vto, KM_USER1); | 283 | kunmap_atomic(vto); |
248 | kunmap_atomic(vfrom, KM_USER0); | 284 | kunmap_atomic(vfrom); |
249 | } | 285 | } |
250 | 286 | ||
251 | #endif /* _LINUX_HIGHMEM_H */ | 287 | #endif /* _LINUX_HIGHMEM_H */ |
diff --git a/include/linux/hsi/Kbuild b/include/linux/hsi/Kbuild new file mode 100644 index 000000000000..271a770b4784 --- /dev/null +++ b/include/linux/hsi/Kbuild | |||
@@ -0,0 +1 @@ | |||
header-y += hsi_char.h | |||
diff --git a/include/linux/hsi/hsi.h b/include/linux/hsi/hsi.h new file mode 100644 index 000000000000..4b178067f405 --- /dev/null +++ b/include/linux/hsi/hsi.h | |||
@@ -0,0 +1,410 @@ | |||
1 | /* | ||
2 | * HSI core header file. | ||
3 | * | ||
4 | * Copyright (C) 2010 Nokia Corporation. All rights reserved. | ||
5 | * | ||
6 | * Contact: Carlos Chinea <carlos.chinea@nokia.com> | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or | ||
9 | * modify it under the terms of the GNU General Public License | ||
10 | * version 2 as published by the Free Software Foundation. | ||
11 | * | ||
12 | * This program is distributed in the hope that it will be useful, 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 | * You should have received a copy of the GNU General Public License | ||
18 | * along with this program; if not, write to the Free Software | ||
19 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA | ||
20 | * 02110-1301 USA | ||
21 | */ | ||
22 | |||
23 | #ifndef __LINUX_HSI_H__ | ||
24 | #define __LINUX_HSI_H__ | ||
25 | |||
26 | #include <linux/device.h> | ||
27 | #include <linux/mutex.h> | ||
28 | #include <linux/scatterlist.h> | ||
29 | #include <linux/spinlock.h> | ||
30 | #include <linux/list.h> | ||
31 | #include <linux/module.h> | ||
32 | |||
33 | /* HSI message ttype */ | ||
34 | #define HSI_MSG_READ 0 | ||
35 | #define HSI_MSG_WRITE 1 | ||
36 | |||
37 | /* HSI configuration values */ | ||
38 | enum { | ||
39 | HSI_MODE_STREAM = 1, | ||
40 | HSI_MODE_FRAME, | ||
41 | }; | ||
42 | |||
43 | enum { | ||
44 | HSI_FLOW_SYNC, /* Synchronized flow */ | ||
45 | HSI_FLOW_PIPE, /* Pipelined flow */ | ||
46 | }; | ||
47 | |||
48 | enum { | ||
49 | HSI_ARB_RR, /* Round-robin arbitration */ | ||
50 | HSI_ARB_PRIO, /* Channel priority arbitration */ | ||
51 | }; | ||
52 | |||
53 | #define HSI_MAX_CHANNELS 16 | ||
54 | |||
55 | /* HSI message status codes */ | ||
56 | enum { | ||
57 | HSI_STATUS_COMPLETED, /* Message transfer is completed */ | ||
58 | HSI_STATUS_PENDING, /* Message pending to be read/write (POLL) */ | ||
59 | HSI_STATUS_PROCEEDING, /* Message transfer is ongoing */ | ||
60 | HSI_STATUS_QUEUED, /* Message waiting to be served */ | ||
61 | HSI_STATUS_ERROR, /* Error when message transfer was ongoing */ | ||
62 | }; | ||
63 | |||
64 | /* HSI port event codes */ | ||
65 | enum { | ||
66 | HSI_EVENT_START_RX, | ||
67 | HSI_EVENT_STOP_RX, | ||
68 | }; | ||
69 | |||
70 | /** | ||
71 | * struct hsi_config - Configuration for RX/TX HSI modules | ||
72 | * @mode: Bit transmission mode (STREAM or FRAME) | ||
73 | * @channels: Number of channels to use [1..16] | ||
74 | * @speed: Max bit transmission speed (Kbit/s) | ||
75 | * @flow: RX flow type (SYNCHRONIZED or PIPELINE) | ||
76 | * @arb_mode: Arbitration mode for TX frame (Round robin, priority) | ||
77 | */ | ||
78 | struct hsi_config { | ||
79 | unsigned int mode; | ||
80 | unsigned int channels; | ||
81 | unsigned int speed; | ||
82 | union { | ||
83 | unsigned int flow; /* RX only */ | ||
84 | unsigned int arb_mode; /* TX only */ | ||
85 | }; | ||
86 | }; | ||
87 | |||
88 | /** | ||
89 | * struct hsi_board_info - HSI client board info | ||
90 | * @name: Name for the HSI device | ||
91 | * @hsi_id: HSI controller id where the client sits | ||
92 | * @port: Port number in the controller where the client sits | ||
93 | * @tx_cfg: HSI TX configuration | ||
94 | * @rx_cfg: HSI RX configuration | ||
95 | * @platform_data: Platform related data | ||
96 | * @archdata: Architecture-dependent device data | ||
97 | */ | ||
98 | struct hsi_board_info { | ||
99 | const char *name; | ||
100 | unsigned int hsi_id; | ||
101 | unsigned int port; | ||
102 | struct hsi_config tx_cfg; | ||
103 | struct hsi_config rx_cfg; | ||
104 | void *platform_data; | ||
105 | struct dev_archdata *archdata; | ||
106 | }; | ||
107 | |||
108 | #ifdef CONFIG_HSI_BOARDINFO | ||
109 | extern int hsi_register_board_info(struct hsi_board_info const *info, | ||
110 | unsigned int len); | ||
111 | #else | ||
112 | static inline int hsi_register_board_info(struct hsi_board_info const *info, | ||
113 | unsigned int len) | ||
114 | { | ||
115 | return 0; | ||
116 | } | ||
117 | #endif /* CONFIG_HSI_BOARDINFO */ | ||
118 | |||
119 | /** | ||
120 | * struct hsi_client - HSI client attached to an HSI port | ||
121 | * @device: Driver model representation of the device | ||
122 | * @tx_cfg: HSI TX configuration | ||
123 | * @rx_cfg: HSI RX configuration | ||
124 | * @hsi_start_rx: Called after incoming wake line goes high | ||
125 | * @hsi_stop_rx: Called after incoming wake line goes low | ||
126 | */ | ||
127 | struct hsi_client { | ||
128 | struct device device; | ||
129 | struct hsi_config tx_cfg; | ||
130 | struct hsi_config rx_cfg; | ||
131 | void (*hsi_start_rx)(struct hsi_client *cl); | ||
132 | void (*hsi_stop_rx)(struct hsi_client *cl); | ||
133 | /* private: */ | ||
134 | unsigned int pclaimed:1; | ||
135 | struct list_head link; | ||
136 | }; | ||
137 | |||
138 | #define to_hsi_client(dev) container_of(dev, struct hsi_client, device) | ||
139 | |||
140 | static inline void hsi_client_set_drvdata(struct hsi_client *cl, void *data) | ||
141 | { | ||
142 | dev_set_drvdata(&cl->device, data); | ||
143 | } | ||
144 | |||
145 | static inline void *hsi_client_drvdata(struct hsi_client *cl) | ||
146 | { | ||
147 | return dev_get_drvdata(&cl->device); | ||
148 | } | ||
149 | |||
150 | /** | ||
151 | * struct hsi_client_driver - Driver associated to an HSI client | ||
152 | * @driver: Driver model representation of the driver | ||
153 | */ | ||
154 | struct hsi_client_driver { | ||
155 | struct device_driver driver; | ||
156 | }; | ||
157 | |||
158 | #define to_hsi_client_driver(drv) container_of(drv, struct hsi_client_driver,\ | ||
159 | driver) | ||
160 | |||
161 | int hsi_register_client_driver(struct hsi_client_driver *drv); | ||
162 | |||
163 | static inline void hsi_unregister_client_driver(struct hsi_client_driver *drv) | ||
164 | { | ||
165 | driver_unregister(&drv->driver); | ||
166 | } | ||
167 | |||
168 | /** | ||
169 | * struct hsi_msg - HSI message descriptor | ||
170 | * @link: Free to use by the current descriptor owner | ||
171 | * @cl: HSI device client that issues the transfer | ||
172 | * @sgt: Head of the scatterlist array | ||
173 | * @context: Client context data associated to the transfer | ||
174 | * @complete: Transfer completion callback | ||
175 | * @destructor: Destructor to free resources when flushing | ||
176 | * @status: Status of the transfer when completed | ||
177 | * @actual_len: Actual length of data transfered on completion | ||
178 | * @channel: Channel were to TX/RX the message | ||
179 | * @ttype: Transfer type (TX if set, RX otherwise) | ||
180 | * @break_frame: if true HSI will send/receive a break frame. Data buffers are | ||
181 | * ignored in the request. | ||
182 | */ | ||
183 | struct hsi_msg { | ||
184 | struct list_head link; | ||
185 | struct hsi_client *cl; | ||
186 | struct sg_table sgt; | ||
187 | void *context; | ||
188 | |||
189 | void (*complete)(struct hsi_msg *msg); | ||
190 | void (*destructor)(struct hsi_msg *msg); | ||
191 | |||
192 | int status; | ||
193 | unsigned int actual_len; | ||
194 | unsigned int channel; | ||
195 | unsigned int ttype:1; | ||
196 | unsigned int break_frame:1; | ||
197 | }; | ||
198 | |||
199 | struct hsi_msg *hsi_alloc_msg(unsigned int n_frag, gfp_t flags); | ||
200 | void hsi_free_msg(struct hsi_msg *msg); | ||
201 | |||
202 | /** | ||
203 | * struct hsi_port - HSI port device | ||
204 | * @device: Driver model representation of the device | ||
205 | * @tx_cfg: Current TX path configuration | ||
206 | * @rx_cfg: Current RX path configuration | ||
207 | * @num: Port number | ||
208 | * @shared: Set when port can be shared by different clients | ||
209 | * @claimed: Reference count of clients which claimed the port | ||
210 | * @lock: Serialize port claim | ||
211 | * @async: Asynchronous transfer callback | ||
212 | * @setup: Callback to set the HSI client configuration | ||
213 | * @flush: Callback to clean the HW state and destroy all pending transfers | ||
214 | * @start_tx: Callback to inform that a client wants to TX data | ||
215 | * @stop_tx: Callback to inform that a client no longer wishes to TX data | ||
216 | * @release: Callback to inform that a client no longer uses the port | ||
217 | * @clients: List of hsi_clients using the port. | ||
218 | * @clock: Lock to serialize access to the clients list. | ||
219 | */ | ||
220 | struct hsi_port { | ||
221 | struct device device; | ||
222 | struct hsi_config tx_cfg; | ||
223 | struct hsi_config rx_cfg; | ||
224 | unsigned int num; | ||
225 | unsigned int shared:1; | ||
226 | int claimed; | ||
227 | struct mutex lock; | ||
228 | int (*async)(struct hsi_msg *msg); | ||
229 | int (*setup)(struct hsi_client *cl); | ||
230 | int (*flush)(struct hsi_client *cl); | ||
231 | int (*start_tx)(struct hsi_client *cl); | ||
232 | int (*stop_tx)(struct hsi_client *cl); | ||
233 | int (*release)(struct hsi_client *cl); | ||
234 | struct list_head clients; | ||
235 | spinlock_t clock; | ||
236 | }; | ||
237 | |||
238 | #define to_hsi_port(dev) container_of(dev, struct hsi_port, device) | ||
239 | #define hsi_get_port(cl) to_hsi_port((cl)->device.parent) | ||
240 | |||
241 | void hsi_event(struct hsi_port *port, unsigned int event); | ||
242 | int hsi_claim_port(struct hsi_client *cl, unsigned int share); | ||
243 | void hsi_release_port(struct hsi_client *cl); | ||
244 | |||
245 | static inline int hsi_port_claimed(struct hsi_client *cl) | ||
246 | { | ||
247 | return cl->pclaimed; | ||
248 | } | ||
249 | |||
250 | static inline void hsi_port_set_drvdata(struct hsi_port *port, void *data) | ||
251 | { | ||
252 | dev_set_drvdata(&port->device, data); | ||
253 | } | ||
254 | |||
255 | static inline void *hsi_port_drvdata(struct hsi_port *port) | ||
256 | { | ||
257 | return dev_get_drvdata(&port->device); | ||
258 | } | ||
259 | |||
260 | /** | ||
261 | * struct hsi_controller - HSI controller device | ||
262 | * @device: Driver model representation of the device | ||
263 | * @owner: Pointer to the module owning the controller | ||
264 | * @id: HSI controller ID | ||
265 | * @num_ports: Number of ports in the HSI controller | ||
266 | * @port: Array of HSI ports | ||
267 | */ | ||
268 | struct hsi_controller { | ||
269 | struct device device; | ||
270 | struct module *owner; | ||
271 | unsigned int id; | ||
272 | unsigned int num_ports; | ||
273 | struct hsi_port *port; | ||
274 | }; | ||
275 | |||
276 | #define to_hsi_controller(dev) container_of(dev, struct hsi_controller, device) | ||
277 | |||
278 | struct hsi_controller *hsi_alloc_controller(unsigned int n_ports, gfp_t flags); | ||
279 | void hsi_free_controller(struct hsi_controller *hsi); | ||
280 | int hsi_register_controller(struct hsi_controller *hsi); | ||
281 | void hsi_unregister_controller(struct hsi_controller *hsi); | ||
282 | |||
283 | static inline void hsi_controller_set_drvdata(struct hsi_controller *hsi, | ||
284 | void *data) | ||
285 | { | ||
286 | dev_set_drvdata(&hsi->device, data); | ||
287 | } | ||
288 | |||
289 | static inline void *hsi_controller_drvdata(struct hsi_controller *hsi) | ||
290 | { | ||
291 | return dev_get_drvdata(&hsi->device); | ||
292 | } | ||
293 | |||
294 | static inline struct hsi_port *hsi_find_port_num(struct hsi_controller *hsi, | ||
295 | unsigned int num) | ||
296 | { | ||
297 | return (num < hsi->num_ports) ? &hsi->port[num] : NULL; | ||
298 | } | ||
299 | |||
300 | /* | ||
301 | * API for HSI clients | ||
302 | */ | ||
303 | int hsi_async(struct hsi_client *cl, struct hsi_msg *msg); | ||
304 | |||
305 | /** | ||
306 | * hsi_id - Get HSI controller ID associated to a client | ||
307 | * @cl: Pointer to a HSI client | ||
308 | * | ||
309 | * Return the controller id where the client is attached to | ||
310 | */ | ||
311 | static inline unsigned int hsi_id(struct hsi_client *cl) | ||
312 | { | ||
313 | return to_hsi_controller(cl->device.parent->parent)->id; | ||
314 | } | ||
315 | |||
316 | /** | ||
317 | * hsi_port_id - Gets the port number a client is attached to | ||
318 | * @cl: Pointer to HSI client | ||
319 | * | ||
320 | * Return the port number associated to the client | ||
321 | */ | ||
322 | static inline unsigned int hsi_port_id(struct hsi_client *cl) | ||
323 | { | ||
324 | return to_hsi_port(cl->device.parent)->num; | ||
325 | } | ||
326 | |||
327 | /** | ||
328 | * hsi_setup - Configure the client's port | ||
329 | * @cl: Pointer to the HSI client | ||
330 | * | ||
331 | * When sharing ports, clients should either relay on a single | ||
332 | * client setup or have the same setup for all of them. | ||
333 | * | ||
334 | * Return -errno on failure, 0 on success | ||
335 | */ | ||
336 | static inline int hsi_setup(struct hsi_client *cl) | ||
337 | { | ||
338 | if (!hsi_port_claimed(cl)) | ||
339 | return -EACCES; | ||
340 | return hsi_get_port(cl)->setup(cl); | ||
341 | } | ||
342 | |||
343 | /** | ||
344 | * hsi_flush - Flush all pending transactions on the client's port | ||
345 | * @cl: Pointer to the HSI client | ||
346 | * | ||
347 | * This function will destroy all pending hsi_msg in the port and reset | ||
348 | * the HW port so it is ready to receive and transmit from a clean state. | ||
349 | * | ||
350 | * Return -errno on failure, 0 on success | ||
351 | */ | ||
352 | static inline int hsi_flush(struct hsi_client *cl) | ||
353 | { | ||
354 | if (!hsi_port_claimed(cl)) | ||
355 | return -EACCES; | ||
356 | return hsi_get_port(cl)->flush(cl); | ||
357 | } | ||
358 | |||
359 | /** | ||
360 | * hsi_async_read - Submit a read transfer | ||
361 | * @cl: Pointer to the HSI client | ||
362 | * @msg: HSI message descriptor of the transfer | ||
363 | * | ||
364 | * Return -errno on failure, 0 on success | ||
365 | */ | ||
366 | static inline int hsi_async_read(struct hsi_client *cl, struct hsi_msg *msg) | ||
367 | { | ||
368 | msg->ttype = HSI_MSG_READ; | ||
369 | return hsi_async(cl, msg); | ||
370 | } | ||
371 | |||
372 | /** | ||
373 | * hsi_async_write - Submit a write transfer | ||
374 | * @cl: Pointer to the HSI client | ||
375 | * @msg: HSI message descriptor of the transfer | ||
376 | * | ||
377 | * Return -errno on failure, 0 on success | ||
378 | */ | ||
379 | static inline int hsi_async_write(struct hsi_client *cl, struct hsi_msg *msg) | ||
380 | { | ||
381 | msg->ttype = HSI_MSG_WRITE; | ||
382 | return hsi_async(cl, msg); | ||
383 | } | ||
384 | |||
385 | /** | ||
386 | * hsi_start_tx - Signal the port that the client wants to start a TX | ||
387 | * @cl: Pointer to the HSI client | ||
388 | * | ||
389 | * Return -errno on failure, 0 on success | ||
390 | */ | ||
391 | static inline int hsi_start_tx(struct hsi_client *cl) | ||
392 | { | ||
393 | if (!hsi_port_claimed(cl)) | ||
394 | return -EACCES; | ||
395 | return hsi_get_port(cl)->start_tx(cl); | ||
396 | } | ||
397 | |||
398 | /** | ||
399 | * hsi_stop_tx - Signal the port that the client no longer wants to transmit | ||
400 | * @cl: Pointer to the HSI client | ||
401 | * | ||
402 | * Return -errno on failure, 0 on success | ||
403 | */ | ||
404 | static inline int hsi_stop_tx(struct hsi_client *cl) | ||
405 | { | ||
406 | if (!hsi_port_claimed(cl)) | ||
407 | return -EACCES; | ||
408 | return hsi_get_port(cl)->stop_tx(cl); | ||
409 | } | ||
410 | #endif /* __LINUX_HSI_H__ */ | ||
diff --git a/include/linux/hsi/hsi_char.h b/include/linux/hsi/hsi_char.h new file mode 100644 index 000000000000..76160b4f455d --- /dev/null +++ b/include/linux/hsi/hsi_char.h | |||
@@ -0,0 +1,63 @@ | |||
1 | /* | ||
2 | * Part of the HSI character device driver. | ||
3 | * | ||
4 | * Copyright (C) 2010 Nokia Corporation. All rights reserved. | ||
5 | * | ||
6 | * Contact: Andras Domokos <andras.domokos at nokia.com> | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or | ||
9 | * modify it under the terms of the GNU General Public License | ||
10 | * version 2 as published by the Free Software Foundation. | ||
11 | * | ||
12 | * This program is distributed in the hope that it will be useful, 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 | * You should have received a copy of the GNU General Public License | ||
18 | * along with this program; if not, write to the Free Software | ||
19 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA | ||
20 | * 02110-1301 USA | ||
21 | */ | ||
22 | |||
23 | |||
24 | #ifndef __HSI_CHAR_H | ||
25 | #define __HSI_CHAR_H | ||
26 | |||
27 | #define HSI_CHAR_MAGIC 'k' | ||
28 | #define HSC_IOW(num, dtype) _IOW(HSI_CHAR_MAGIC, num, dtype) | ||
29 | #define HSC_IOR(num, dtype) _IOR(HSI_CHAR_MAGIC, num, dtype) | ||
30 | #define HSC_IOWR(num, dtype) _IOWR(HSI_CHAR_MAGIC, num, dtype) | ||
31 | #define HSC_IO(num) _IO(HSI_CHAR_MAGIC, num) | ||
32 | |||
33 | #define HSC_RESET HSC_IO(16) | ||
34 | #define HSC_SET_PM HSC_IO(17) | ||
35 | #define HSC_SEND_BREAK HSC_IO(18) | ||
36 | #define HSC_SET_RX HSC_IOW(19, struct hsc_rx_config) | ||
37 | #define HSC_GET_RX HSC_IOW(20, struct hsc_rx_config) | ||
38 | #define HSC_SET_TX HSC_IOW(21, struct hsc_tx_config) | ||
39 | #define HSC_GET_TX HSC_IOW(22, struct hsc_tx_config) | ||
40 | |||
41 | #define HSC_PM_DISABLE 0 | ||
42 | #define HSC_PM_ENABLE 1 | ||
43 | |||
44 | #define HSC_MODE_STREAM 1 | ||
45 | #define HSC_MODE_FRAME 2 | ||
46 | #define HSC_FLOW_SYNC 0 | ||
47 | #define HSC_ARB_RR 0 | ||
48 | #define HSC_ARB_PRIO 1 | ||
49 | |||
50 | struct hsc_rx_config { | ||
51 | uint32_t mode; | ||
52 | uint32_t flow; | ||
53 | uint32_t channels; | ||
54 | }; | ||
55 | |||
56 | struct hsc_tx_config { | ||
57 | uint32_t mode; | ||
58 | uint32_t channels; | ||
59 | uint32_t speed; | ||
60 | uint32_t arb_mode; | ||
61 | }; | ||
62 | |||
63 | #endif /* __HSI_CHAR_H */ | ||
diff --git a/include/linux/huge_mm.h b/include/linux/huge_mm.h index 1b921299abc4..c8af7a2efb52 100644 --- a/include/linux/huge_mm.h +++ b/include/linux/huge_mm.h | |||
@@ -51,6 +51,9 @@ extern pmd_t *page_check_address_pmd(struct page *page, | |||
51 | unsigned long address, | 51 | unsigned long address, |
52 | enum page_check_address_pmd_flag flag); | 52 | enum page_check_address_pmd_flag flag); |
53 | 53 | ||
54 | #define HPAGE_PMD_ORDER (HPAGE_PMD_SHIFT-PAGE_SHIFT) | ||
55 | #define HPAGE_PMD_NR (1<<HPAGE_PMD_ORDER) | ||
56 | |||
54 | #ifdef CONFIG_TRANSPARENT_HUGEPAGE | 57 | #ifdef CONFIG_TRANSPARENT_HUGEPAGE |
55 | #define HPAGE_PMD_SHIFT HPAGE_SHIFT | 58 | #define HPAGE_PMD_SHIFT HPAGE_SHIFT |
56 | #define HPAGE_PMD_MASK HPAGE_MASK | 59 | #define HPAGE_PMD_MASK HPAGE_MASK |
@@ -102,8 +105,6 @@ extern void __split_huge_page_pmd(struct mm_struct *mm, pmd_t *pmd); | |||
102 | BUG_ON(pmd_trans_splitting(*____pmd) || \ | 105 | BUG_ON(pmd_trans_splitting(*____pmd) || \ |
103 | pmd_trans_huge(*____pmd)); \ | 106 | pmd_trans_huge(*____pmd)); \ |
104 | } while (0) | 107 | } while (0) |
105 | #define HPAGE_PMD_ORDER (HPAGE_PMD_SHIFT-PAGE_SHIFT) | ||
106 | #define HPAGE_PMD_NR (1<<HPAGE_PMD_ORDER) | ||
107 | #if HPAGE_PMD_ORDER > MAX_ORDER | 108 | #if HPAGE_PMD_ORDER > MAX_ORDER |
108 | #error "hugepages can't be allocated by the buddy allocator" | 109 | #error "hugepages can't be allocated by the buddy allocator" |
109 | #endif | 110 | #endif |
@@ -113,6 +114,18 @@ extern void __vma_adjust_trans_huge(struct vm_area_struct *vma, | |||
113 | unsigned long start, | 114 | unsigned long start, |
114 | unsigned long end, | 115 | unsigned long end, |
115 | long adjust_next); | 116 | long adjust_next); |
117 | extern int __pmd_trans_huge_lock(pmd_t *pmd, | ||
118 | struct vm_area_struct *vma); | ||
119 | /* mmap_sem must be held on entry */ | ||
120 | static inline int pmd_trans_huge_lock(pmd_t *pmd, | ||
121 | struct vm_area_struct *vma) | ||
122 | { | ||
123 | VM_BUG_ON(!rwsem_is_locked(&vma->vm_mm->mmap_sem)); | ||
124 | if (pmd_trans_huge(*pmd)) | ||
125 | return __pmd_trans_huge_lock(pmd, vma); | ||
126 | else | ||
127 | return 0; | ||
128 | } | ||
116 | static inline void vma_adjust_trans_huge(struct vm_area_struct *vma, | 129 | static inline void vma_adjust_trans_huge(struct vm_area_struct *vma, |
117 | unsigned long start, | 130 | unsigned long start, |
118 | unsigned long end, | 131 | unsigned long end, |
@@ -146,9 +159,9 @@ static inline struct page *compound_trans_head(struct page *page) | |||
146 | return page; | 159 | return page; |
147 | } | 160 | } |
148 | #else /* CONFIG_TRANSPARENT_HUGEPAGE */ | 161 | #else /* CONFIG_TRANSPARENT_HUGEPAGE */ |
149 | #define HPAGE_PMD_SHIFT ({ BUG(); 0; }) | 162 | #define HPAGE_PMD_SHIFT ({ BUILD_BUG(); 0; }) |
150 | #define HPAGE_PMD_MASK ({ BUG(); 0; }) | 163 | #define HPAGE_PMD_MASK ({ BUILD_BUG(); 0; }) |
151 | #define HPAGE_PMD_SIZE ({ BUG(); 0; }) | 164 | #define HPAGE_PMD_SIZE ({ BUILD_BUG(); 0; }) |
152 | 165 | ||
153 | #define hpage_nr_pages(x) 1 | 166 | #define hpage_nr_pages(x) 1 |
154 | 167 | ||
@@ -176,6 +189,11 @@ static inline void vma_adjust_trans_huge(struct vm_area_struct *vma, | |||
176 | long adjust_next) | 189 | long adjust_next) |
177 | { | 190 | { |
178 | } | 191 | } |
192 | static inline int pmd_trans_huge_lock(pmd_t *pmd, | ||
193 | struct vm_area_struct *vma) | ||
194 | { | ||
195 | return 0; | ||
196 | } | ||
179 | #endif /* CONFIG_TRANSPARENT_HUGEPAGE */ | 197 | #endif /* CONFIG_TRANSPARENT_HUGEPAGE */ |
180 | 198 | ||
181 | #endif /* _LINUX_HUGE_MM_H */ | 199 | #endif /* _LINUX_HUGE_MM_H */ |
diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h index d9d6c868b86b..000837e126e6 100644 --- a/include/linux/hugetlb.h +++ b/include/linux/hugetlb.h | |||
@@ -14,6 +14,15 @@ struct user_struct; | |||
14 | #include <linux/shm.h> | 14 | #include <linux/shm.h> |
15 | #include <asm/tlbflush.h> | 15 | #include <asm/tlbflush.h> |
16 | 16 | ||
17 | struct hugepage_subpool { | ||
18 | spinlock_t lock; | ||
19 | long count; | ||
20 | long max_hpages, used_hpages; | ||
21 | }; | ||
22 | |||
23 | struct hugepage_subpool *hugepage_new_subpool(long nr_blocks); | ||
24 | void hugepage_put_subpool(struct hugepage_subpool *spool); | ||
25 | |||
17 | int PageHuge(struct page *page); | 26 | int PageHuge(struct page *page); |
18 | 27 | ||
19 | void reset_vma_resv_huge_pages(struct vm_area_struct *vma); | 28 | void reset_vma_resv_huge_pages(struct vm_area_struct *vma); |
@@ -128,35 +137,14 @@ enum { | |||
128 | }; | 137 | }; |
129 | 138 | ||
130 | #ifdef CONFIG_HUGETLBFS | 139 | #ifdef CONFIG_HUGETLBFS |
131 | struct hugetlbfs_config { | ||
132 | uid_t uid; | ||
133 | gid_t gid; | ||
134 | umode_t mode; | ||
135 | long nr_blocks; | ||
136 | long nr_inodes; | ||
137 | struct hstate *hstate; | ||
138 | }; | ||
139 | |||
140 | struct hugetlbfs_sb_info { | 140 | struct hugetlbfs_sb_info { |
141 | long max_blocks; /* blocks allowed */ | ||
142 | long free_blocks; /* blocks free */ | ||
143 | long max_inodes; /* inodes allowed */ | 141 | long max_inodes; /* inodes allowed */ |
144 | long free_inodes; /* inodes free */ | 142 | long free_inodes; /* inodes free */ |
145 | spinlock_t stat_lock; | 143 | spinlock_t stat_lock; |
146 | struct hstate *hstate; | 144 | struct hstate *hstate; |
145 | struct hugepage_subpool *spool; | ||
147 | }; | 146 | }; |
148 | 147 | ||
149 | |||
150 | struct hugetlbfs_inode_info { | ||
151 | struct shared_policy policy; | ||
152 | struct inode vfs_inode; | ||
153 | }; | ||
154 | |||
155 | static inline struct hugetlbfs_inode_info *HUGETLBFS_I(struct inode *inode) | ||
156 | { | ||
157 | return container_of(inode, struct hugetlbfs_inode_info, vfs_inode); | ||
158 | } | ||
159 | |||
160 | static inline struct hugetlbfs_sb_info *HUGETLBFS_SB(struct super_block *sb) | 148 | static inline struct hugetlbfs_sb_info *HUGETLBFS_SB(struct super_block *sb) |
161 | { | 149 | { |
162 | return sb->s_fs_info; | 150 | return sb->s_fs_info; |
@@ -164,10 +152,9 @@ static inline struct hugetlbfs_sb_info *HUGETLBFS_SB(struct super_block *sb) | |||
164 | 152 | ||
165 | extern const struct file_operations hugetlbfs_file_operations; | 153 | extern const struct file_operations hugetlbfs_file_operations; |
166 | extern const struct vm_operations_struct hugetlb_vm_ops; | 154 | extern const struct vm_operations_struct hugetlb_vm_ops; |
167 | struct file *hugetlb_file_setup(const char *name, size_t size, vm_flags_t acct, | 155 | struct file *hugetlb_file_setup(const char *name, unsigned long addr, |
156 | size_t size, vm_flags_t acct, | ||
168 | struct user_struct **user, int creat_flags); | 157 | struct user_struct **user, int creat_flags); |
169 | int hugetlb_get_quota(struct address_space *mapping, long delta); | ||
170 | void hugetlb_put_quota(struct address_space *mapping, long delta); | ||
171 | 158 | ||
172 | static inline int is_file_hugepages(struct file *file) | 159 | static inline int is_file_hugepages(struct file *file) |
173 | { | 160 | { |
@@ -179,15 +166,11 @@ static inline int is_file_hugepages(struct file *file) | |||
179 | return 0; | 166 | return 0; |
180 | } | 167 | } |
181 | 168 | ||
182 | static inline void set_file_hugepages(struct file *file) | ||
183 | { | ||
184 | file->f_op = &hugetlbfs_file_operations; | ||
185 | } | ||
186 | #else /* !CONFIG_HUGETLBFS */ | 169 | #else /* !CONFIG_HUGETLBFS */ |
187 | 170 | ||
188 | #define is_file_hugepages(file) 0 | 171 | #define is_file_hugepages(file) 0 |
189 | #define set_file_hugepages(file) BUG() | 172 | static inline struct file * |
190 | static inline struct file *hugetlb_file_setup(const char *name, size_t size, | 173 | hugetlb_file_setup(const char *name, unsigned long addr, size_t size, |
191 | vm_flags_t acctflag, struct user_struct **user, int creat_flags) | 174 | vm_flags_t acctflag, struct user_struct **user, int creat_flags) |
192 | { | 175 | { |
193 | return ERR_PTR(-ENOSYS); | 176 | return ERR_PTR(-ENOSYS); |
diff --git a/include/linux/hwmon-sysfs.h b/include/linux/hwmon-sysfs.h index a90c09d331c1..1c7b89ae6bdc 100644 --- a/include/linux/hwmon-sysfs.h +++ b/include/linux/hwmon-sysfs.h | |||
@@ -20,6 +20,8 @@ | |||
20 | #ifndef _LINUX_HWMON_SYSFS_H | 20 | #ifndef _LINUX_HWMON_SYSFS_H |
21 | #define _LINUX_HWMON_SYSFS_H | 21 | #define _LINUX_HWMON_SYSFS_H |
22 | 22 | ||
23 | #include <linux/device.h> | ||
24 | |||
23 | struct sensor_device_attribute{ | 25 | struct sensor_device_attribute{ |
24 | struct device_attribute dev_attr; | 26 | struct device_attribute dev_attr; |
25 | int index; | 27 | int index; |
diff --git a/include/linux/hwmon.h b/include/linux/hwmon.h index 6b6ee702b007..82b29ae6ebb0 100644 --- a/include/linux/hwmon.h +++ b/include/linux/hwmon.h | |||
@@ -14,7 +14,7 @@ | |||
14 | #ifndef _HWMON_H_ | 14 | #ifndef _HWMON_H_ |
15 | #define _HWMON_H_ | 15 | #define _HWMON_H_ |
16 | 16 | ||
17 | #include <linux/device.h> | 17 | struct device; |
18 | 18 | ||
19 | struct device *hwmon_device_register(struct device *dev); | 19 | struct device *hwmon_device_register(struct device *dev); |
20 | 20 | ||
diff --git a/include/linux/hwspinlock.h b/include/linux/hwspinlock.h index aad6bd4b3efd..3343298e40e8 100644 --- a/include/linux/hwspinlock.h +++ b/include/linux/hwspinlock.h | |||
@@ -20,12 +20,12 @@ | |||
20 | 20 | ||
21 | #include <linux/err.h> | 21 | #include <linux/err.h> |
22 | #include <linux/sched.h> | 22 | #include <linux/sched.h> |
23 | #include <linux/device.h> | ||
24 | 23 | ||
25 | /* hwspinlock mode argument */ | 24 | /* hwspinlock mode argument */ |
26 | #define HWLOCK_IRQSTATE 0x01 /* Disable interrupts, save state */ | 25 | #define HWLOCK_IRQSTATE 0x01 /* Disable interrupts, save state */ |
27 | #define HWLOCK_IRQ 0x02 /* Disable interrupts, don't save state */ | 26 | #define HWLOCK_IRQ 0x02 /* Disable interrupts, don't save state */ |
28 | 27 | ||
28 | struct device; | ||
29 | struct hwspinlock; | 29 | struct hwspinlock; |
30 | struct hwspinlock_device; | 30 | struct hwspinlock_device; |
31 | struct hwspinlock_ops; | 31 | struct hwspinlock_ops; |
diff --git a/include/linux/hyperv.h b/include/linux/hyperv.h index 0ae065a5fcb2..5852545e6bba 100644 --- a/include/linux/hyperv.h +++ b/include/linux/hyperv.h | |||
@@ -25,6 +25,173 @@ | |||
25 | #ifndef _HYPERV_H | 25 | #ifndef _HYPERV_H |
26 | #define _HYPERV_H | 26 | #define _HYPERV_H |
27 | 27 | ||
28 | #include <linux/types.h> | ||
29 | |||
30 | /* | ||
31 | * An implementation of HyperV key value pair (KVP) functionality for Linux. | ||
32 | * | ||
33 | * | ||
34 | * Copyright (C) 2010, Novell, Inc. | ||
35 | * Author : K. Y. Srinivasan <ksrinivasan@novell.com> | ||
36 | * | ||
37 | */ | ||
38 | |||
39 | /* | ||
40 | * Maximum value size - used for both key names and value data, and includes | ||
41 | * any applicable NULL terminators. | ||
42 | * | ||
43 | * Note: This limit is somewhat arbitrary, but falls easily within what is | ||
44 | * supported for all native guests (back to Win 2000) and what is reasonable | ||
45 | * for the IC KVP exchange functionality. Note that Windows Me/98/95 are | ||
46 | * limited to 255 character key names. | ||
47 | * | ||
48 | * MSDN recommends not storing data values larger than 2048 bytes in the | ||
49 | * registry. | ||
50 | * | ||
51 | * Note: This value is used in defining the KVP exchange message - this value | ||
52 | * cannot be modified without affecting the message size and compatibility. | ||
53 | */ | ||
54 | |||
55 | /* | ||
56 | * bytes, including any null terminators | ||
57 | */ | ||
58 | #define HV_KVP_EXCHANGE_MAX_VALUE_SIZE (2048) | ||
59 | |||
60 | |||
61 | /* | ||
62 | * Maximum key size - the registry limit for the length of an entry name | ||
63 | * is 256 characters, including the null terminator | ||
64 | */ | ||
65 | |||
66 | #define HV_KVP_EXCHANGE_MAX_KEY_SIZE (512) | ||
67 | |||
68 | /* | ||
69 | * In Linux, we implement the KVP functionality in two components: | ||
70 | * 1) The kernel component which is packaged as part of the hv_utils driver | ||
71 | * is responsible for communicating with the host and responsible for | ||
72 | * implementing the host/guest protocol. 2) A user level daemon that is | ||
73 | * responsible for data gathering. | ||
74 | * | ||
75 | * Host/Guest Protocol: The host iterates over an index and expects the guest | ||
76 | * to assign a key name to the index and also return the value corresponding to | ||
77 | * the key. The host will have atmost one KVP transaction outstanding at any | ||
78 | * given point in time. The host side iteration stops when the guest returns | ||
79 | * an error. Microsoft has specified the following mapping of key names to | ||
80 | * host specified index: | ||
81 | * | ||
82 | * Index Key Name | ||
83 | * 0 FullyQualifiedDomainName | ||
84 | * 1 IntegrationServicesVersion | ||
85 | * 2 NetworkAddressIPv4 | ||
86 | * 3 NetworkAddressIPv6 | ||
87 | * 4 OSBuildNumber | ||
88 | * 5 OSName | ||
89 | * 6 OSMajorVersion | ||
90 | * 7 OSMinorVersion | ||
91 | * 8 OSVersion | ||
92 | * 9 ProcessorArchitecture | ||
93 | * | ||
94 | * The Windows host expects the Key Name and Key Value to be encoded in utf16. | ||
95 | * | ||
96 | * Guest Kernel/KVP Daemon Protocol: As noted earlier, we implement all of the | ||
97 | * data gathering functionality in a user mode daemon. The user level daemon | ||
98 | * is also responsible for binding the key name to the index as well. The | ||
99 | * kernel and user-level daemon communicate using a connector channel. | ||
100 | * | ||
101 | * The user mode component first registers with the | ||
102 | * the kernel component. Subsequently, the kernel component requests, data | ||
103 | * for the specified keys. In response to this message the user mode component | ||
104 | * fills in the value corresponding to the specified key. We overload the | ||
105 | * sequence field in the cn_msg header to define our KVP message types. | ||
106 | * | ||
107 | * | ||
108 | * The kernel component simply acts as a conduit for communication between the | ||
109 | * Windows host and the user-level daemon. The kernel component passes up the | ||
110 | * index received from the Host to the user-level daemon. If the index is | ||
111 | * valid (supported), the corresponding key as well as its | ||
112 | * value (both are strings) is returned. If the index is invalid | ||
113 | * (not supported), a NULL key string is returned. | ||
114 | */ | ||
115 | |||
116 | |||
117 | /* | ||
118 | * Registry value types. | ||
119 | */ | ||
120 | |||
121 | #define REG_SZ 1 | ||
122 | #define REG_U32 4 | ||
123 | #define REG_U64 8 | ||
124 | |||
125 | enum hv_kvp_exchg_op { | ||
126 | KVP_OP_GET = 0, | ||
127 | KVP_OP_SET, | ||
128 | KVP_OP_DELETE, | ||
129 | KVP_OP_ENUMERATE, | ||
130 | KVP_OP_REGISTER, | ||
131 | KVP_OP_COUNT /* Number of operations, must be last. */ | ||
132 | }; | ||
133 | |||
134 | enum hv_kvp_exchg_pool { | ||
135 | KVP_POOL_EXTERNAL = 0, | ||
136 | KVP_POOL_GUEST, | ||
137 | KVP_POOL_AUTO, | ||
138 | KVP_POOL_AUTO_EXTERNAL, | ||
139 | KVP_POOL_AUTO_INTERNAL, | ||
140 | KVP_POOL_COUNT /* Number of pools, must be last. */ | ||
141 | }; | ||
142 | |||
143 | struct hv_kvp_hdr { | ||
144 | __u8 operation; | ||
145 | __u8 pool; | ||
146 | __u16 pad; | ||
147 | } __attribute__((packed)); | ||
148 | |||
149 | struct hv_kvp_exchg_msg_value { | ||
150 | __u32 value_type; | ||
151 | __u32 key_size; | ||
152 | __u32 value_size; | ||
153 | __u8 key[HV_KVP_EXCHANGE_MAX_KEY_SIZE]; | ||
154 | union { | ||
155 | __u8 value[HV_KVP_EXCHANGE_MAX_VALUE_SIZE]; | ||
156 | __u32 value_u32; | ||
157 | __u64 value_u64; | ||
158 | }; | ||
159 | } __attribute__((packed)); | ||
160 | |||
161 | struct hv_kvp_msg_enumerate { | ||
162 | __u32 index; | ||
163 | struct hv_kvp_exchg_msg_value data; | ||
164 | } __attribute__((packed)); | ||
165 | |||
166 | struct hv_kvp_msg_get { | ||
167 | struct hv_kvp_exchg_msg_value data; | ||
168 | }; | ||
169 | |||
170 | struct hv_kvp_msg_set { | ||
171 | struct hv_kvp_exchg_msg_value data; | ||
172 | }; | ||
173 | |||
174 | struct hv_kvp_msg_delete { | ||
175 | __u32 key_size; | ||
176 | __u8 key[HV_KVP_EXCHANGE_MAX_KEY_SIZE]; | ||
177 | }; | ||
178 | |||
179 | struct hv_kvp_register { | ||
180 | __u8 version[HV_KVP_EXCHANGE_MAX_KEY_SIZE]; | ||
181 | }; | ||
182 | |||
183 | struct hv_kvp_msg { | ||
184 | struct hv_kvp_hdr kvp_hdr; | ||
185 | union { | ||
186 | struct hv_kvp_msg_get kvp_get; | ||
187 | struct hv_kvp_msg_set kvp_set; | ||
188 | struct hv_kvp_msg_delete kvp_delete; | ||
189 | struct hv_kvp_msg_enumerate kvp_enum_data; | ||
190 | struct hv_kvp_register kvp_register; | ||
191 | } body; | ||
192 | } __attribute__((packed)); | ||
193 | |||
194 | #ifdef __KERNEL__ | ||
28 | #include <linux/scatterlist.h> | 195 | #include <linux/scatterlist.h> |
29 | #include <linux/list.h> | 196 | #include <linux/list.h> |
30 | #include <linux/uuid.h> | 197 | #include <linux/uuid.h> |
@@ -785,6 +952,7 @@ void vmbus_driver_unregister(struct hv_driver *hv_driver); | |||
785 | 952 | ||
786 | #define HV_S_OK 0x00000000 | 953 | #define HV_S_OK 0x00000000 |
787 | #define HV_E_FAIL 0x80004005 | 954 | #define HV_E_FAIL 0x80004005 |
955 | #define HV_S_CONT 0x80070103 | ||
788 | #define HV_ERROR_NOT_SUPPORTED 0x80070032 | 956 | #define HV_ERROR_NOT_SUPPORTED 0x80070032 |
789 | #define HV_ERROR_MACHINE_LOCKED 0x800704F7 | 957 | #define HV_ERROR_MACHINE_LOCKED 0x800704F7 |
790 | 958 | ||
@@ -870,4 +1038,9 @@ struct hyperv_service_callback { | |||
870 | extern void vmbus_prep_negotiate_resp(struct icmsg_hdr *, | 1038 | extern void vmbus_prep_negotiate_resp(struct icmsg_hdr *, |
871 | struct icmsg_negotiate *, u8 *); | 1039 | struct icmsg_negotiate *, u8 *); |
872 | 1040 | ||
1041 | int hv_kvp_init(struct hv_util_service *); | ||
1042 | void hv_kvp_deinit(void); | ||
1043 | void hv_kvp_onchannelcallback(void *); | ||
1044 | |||
1045 | #endif /* __KERNEL__ */ | ||
873 | #endif /* _HYPERV_H */ | 1046 | #endif /* _HYPERV_H */ |
diff --git a/include/linux/i2c-algo-bit.h b/include/linux/i2c-algo-bit.h index 4f98148c11c3..63904ba6887e 100644 --- a/include/linux/i2c-algo-bit.h +++ b/include/linux/i2c-algo-bit.h | |||
@@ -15,7 +15,8 @@ | |||
15 | 15 | ||
16 | You should have received a copy of the GNU General Public License | 16 | You should have received a copy of the GNU General Public License |
17 | along with this program; if not, write to the Free Software | 17 | along with this program; if not, write to the Free Software |
18 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ | 18 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
19 | MA 02110-1301 USA. */ | ||
19 | /* ------------------------------------------------------------------------- */ | 20 | /* ------------------------------------------------------------------------- */ |
20 | 21 | ||
21 | /* With some changes from Kyösti Mälkki <kmalkki@cc.hut.fi> and even | 22 | /* With some changes from Kyösti Mälkki <kmalkki@cc.hut.fi> and even |
@@ -49,5 +50,6 @@ struct i2c_algo_bit_data { | |||
49 | 50 | ||
50 | int i2c_bit_add_bus(struct i2c_adapter *); | 51 | int i2c_bit_add_bus(struct i2c_adapter *); |
51 | int i2c_bit_add_numbered_bus(struct i2c_adapter *); | 52 | int i2c_bit_add_numbered_bus(struct i2c_adapter *); |
53 | extern const struct i2c_algorithm i2c_bit_algo; | ||
52 | 54 | ||
53 | #endif /* _LINUX_I2C_ALGO_BIT_H */ | 55 | #endif /* _LINUX_I2C_ALGO_BIT_H */ |
diff --git a/include/linux/i2c-algo-pcf.h b/include/linux/i2c-algo-pcf.h index 0f91a957a690..538e8f41a319 100644 --- a/include/linux/i2c-algo-pcf.h +++ b/include/linux/i2c-algo-pcf.h | |||
@@ -16,7 +16,8 @@ | |||
16 | 16 | ||
17 | You should have received a copy of the GNU General Public License | 17 | You should have received a copy of the GNU General Public License |
18 | along with this program; if not, write to the Free Software | 18 | along with this program; if not, write to the Free Software |
19 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ | 19 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
20 | MA 02110-1301 USA. */ | ||
20 | /* ------------------------------------------------------------------------- */ | 21 | /* ------------------------------------------------------------------------- */ |
21 | 22 | ||
22 | /* With some changes from Kyösti Mälkki <kmalkki@cc.hut.fi> and even | 23 | /* With some changes from Kyösti Mälkki <kmalkki@cc.hut.fi> and even |
diff --git a/include/linux/i2c-dev.h b/include/linux/i2c-dev.h index fd53bfd26470..8a7406b2114d 100644 --- a/include/linux/i2c-dev.h +++ b/include/linux/i2c-dev.h | |||
@@ -16,7 +16,8 @@ | |||
16 | 16 | ||
17 | You should have received a copy of the GNU General Public License | 17 | You should have received a copy of the GNU General Public License |
18 | along with this program; if not, write to the Free Software | 18 | along with this program; if not, write to the Free Software |
19 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | 19 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
20 | MA 02110-1301 USA. | ||
20 | */ | 21 | */ |
21 | 22 | ||
22 | #ifndef _LINUX_I2C_DEV_H | 23 | #ifndef _LINUX_I2C_DEV_H |
diff --git a/include/linux/i2c-mux.h b/include/linux/i2c-mux.h index 34536effd652..747f0cde4164 100644 --- a/include/linux/i2c-mux.h +++ b/include/linux/i2c-mux.h | |||
@@ -18,7 +18,8 @@ | |||
18 | * | 18 | * |
19 | * You should have received a copy of the GNU General Public License | 19 | * You should have received a copy of the GNU General Public License |
20 | * along with this program; if not, write to the Free Software | 20 | * along with this program; if not, write to the Free Software |
21 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | 21 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
22 | * MA 02110-1301 USA. | ||
22 | */ | 23 | */ |
23 | 24 | ||
24 | #ifndef _LINUX_I2C_MUX_H | 25 | #ifndef _LINUX_I2C_MUX_H |
diff --git a/include/linux/i2c-smbus.h b/include/linux/i2c-smbus.h index 63f57a8c8b31..017fb40f702a 100644 --- a/include/linux/i2c-smbus.h +++ b/include/linux/i2c-smbus.h | |||
@@ -15,7 +15,8 @@ | |||
15 | * | 15 | * |
16 | * You should have received a copy of the GNU General Public License | 16 | * You should have received a copy of the GNU General Public License |
17 | * along with this program; if not, write to the Free Software | 17 | * along with this program; if not, write to the Free Software |
18 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
19 | * MA 02110-1301 USA. | ||
19 | */ | 20 | */ |
20 | 21 | ||
21 | #ifndef _LINUX_I2C_SMBUS_H | 22 | #ifndef _LINUX_I2C_SMBUS_H |
diff --git a/include/linux/i2c.h b/include/linux/i2c.h index 8e25a9167f13..195d8b3d9cfb 100644 --- a/include/linux/i2c.h +++ b/include/linux/i2c.h | |||
@@ -17,7 +17,8 @@ | |||
17 | 17 | ||
18 | You should have received a copy of the GNU General Public License | 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 | 19 | along with this program; if not, write to the Free Software |
20 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ | 20 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
21 | MA 02110-1301 USA. */ | ||
21 | /* ------------------------------------------------------------------------- */ | 22 | /* ------------------------------------------------------------------------- */ |
22 | 23 | ||
23 | /* With some changes from Kyösti Mälkki <kmalkki@cc.hut.fi> and | 24 | /* With some changes from Kyösti Mälkki <kmalkki@cc.hut.fi> and |
diff --git a/include/linux/i2c/at24.h b/include/linux/i2c/at24.h index 8ace93024d60..285025a9cdc9 100644 --- a/include/linux/i2c/at24.h +++ b/include/linux/i2c/at24.h | |||
@@ -1,19 +1,42 @@ | |||
1 | /* | ||
2 | * at24.h - platform_data for the at24 (generic eeprom) driver | ||
3 | * (C) Copyright 2008 by Pengutronix | ||
4 | * (C) Copyright 2012 by Wolfram Sang | ||
5 | * same license as the driver | ||
6 | */ | ||
7 | |||
1 | #ifndef _LINUX_AT24_H | 8 | #ifndef _LINUX_AT24_H |
2 | #define _LINUX_AT24_H | 9 | #define _LINUX_AT24_H |
3 | 10 | ||
4 | #include <linux/types.h> | 11 | #include <linux/types.h> |
5 | #include <linux/memory.h> | 12 | #include <linux/memory.h> |
6 | 13 | ||
7 | /* | 14 | /** |
8 | * As seen through Linux I2C, differences between the most common types of I2C | 15 | * struct at24_platform_data - data to set up at24 (generic eeprom) driver |
9 | * memory include: | 16 | * @byte_len: size of eeprom in byte |
10 | * - How much memory is available (usually specified in bit)? | 17 | * @page_size: number of byte which can be written in one go |
11 | * - What write page size does it support? | 18 | * @flags: tunable options, check AT24_FLAG_* defines |
12 | * - Special flags (16 bit addresses, read_only, world readable...)? | 19 | * @setup: an optional callback invoked after eeprom is probed; enables kernel |
20 | code to access eeprom via memory_accessor, see example | ||
21 | * @context: optional parameter passed to setup() | ||
13 | * | 22 | * |
14 | * If you set up a custom eeprom type, please double-check the parameters. | 23 | * If you set up a custom eeprom type, please double-check the parameters. |
15 | * Especially page_size needs extra care, as you risk data loss if your value | 24 | * Especially page_size needs extra care, as you risk data loss if your value |
16 | * is bigger than what the chip actually supports! | 25 | * is bigger than what the chip actually supports! |
26 | * | ||
27 | * An example in pseudo code for a setup() callback: | ||
28 | * | ||
29 | * void get_mac_addr(struct memory_accessor *mem_acc, void *context) | ||
30 | * { | ||
31 | * u8 *mac_addr = ethernet_pdata->mac_addr; | ||
32 | * off_t offset = context; | ||
33 | * | ||
34 | * // Read MAC addr from EEPROM | ||
35 | * if (mem_acc->read(mem_acc, mac_addr, offset, ETH_ALEN) == ETH_ALEN) | ||
36 | * pr_info("Read MAC addr from EEPROM: %pM\n", mac_addr); | ||
37 | * } | ||
38 | * | ||
39 | * This function pointer and context can now be set up in at24_platform_data. | ||
17 | */ | 40 | */ |
18 | 41 | ||
19 | struct at24_platform_data { | 42 | struct at24_platform_data { |
diff --git a/include/linux/i2c/tc35876x.h b/include/linux/i2c/tc35876x.h new file mode 100644 index 000000000000..cd6a51c71e7e --- /dev/null +++ b/include/linux/i2c/tc35876x.h | |||
@@ -0,0 +1,11 @@ | |||
1 | |||
2 | #ifndef _TC35876X_H | ||
3 | #define _TC35876X_H | ||
4 | |||
5 | struct tc35876x_platform_data { | ||
6 | int gpio_bridge_reset; | ||
7 | int gpio_panel_bl_en; | ||
8 | int gpio_panel_vadd; | ||
9 | }; | ||
10 | |||
11 | #endif /* _TC35876X_H */ | ||
diff --git a/include/linux/i2c/twl.h b/include/linux/i2c/twl.h index 78d3465251d6..1f90de0cfdbe 100644 --- a/include/linux/i2c/twl.h +++ b/include/linux/i2c/twl.h | |||
@@ -666,23 +666,11 @@ struct twl4030_codec_data { | |||
666 | unsigned int check_defaults:1; | 666 | unsigned int check_defaults:1; |
667 | unsigned int reset_registers:1; | 667 | unsigned int reset_registers:1; |
668 | unsigned int hs_extmute:1; | 668 | unsigned int hs_extmute:1; |
669 | u16 hs_left_step; | ||
670 | u16 hs_right_step; | ||
671 | u16 hf_left_step; | ||
672 | u16 hf_right_step; | ||
673 | void (*set_hs_extmute)(int mute); | 669 | void (*set_hs_extmute)(int mute); |
674 | }; | 670 | }; |
675 | 671 | ||
676 | struct twl4030_vibra_data { | 672 | struct twl4030_vibra_data { |
677 | unsigned int coexist; | 673 | unsigned int coexist; |
678 | |||
679 | /* twl6040 */ | ||
680 | unsigned int vibldrv_res; /* left driver resistance */ | ||
681 | unsigned int vibrdrv_res; /* right driver resistance */ | ||
682 | unsigned int viblmotor_res; /* left motor resistance */ | ||
683 | unsigned int vibrmotor_res; /* right motor resistance */ | ||
684 | int vddvibl_uV; /* VDDVIBL volt, set 0 for fixed reg */ | ||
685 | int vddvibr_uV; /* VDDVIBR volt, set 0 for fixed reg */ | ||
686 | }; | 674 | }; |
687 | 675 | ||
688 | struct twl4030_audio_data { | 676 | struct twl4030_audio_data { |
@@ -712,6 +700,9 @@ struct twl4030_platform_data { | |||
712 | struct regulator_init_data *vaux1; | 700 | struct regulator_init_data *vaux1; |
713 | struct regulator_init_data *vaux2; | 701 | struct regulator_init_data *vaux2; |
714 | struct regulator_init_data *vaux3; | 702 | struct regulator_init_data *vaux3; |
703 | struct regulator_init_data *vdd1; | ||
704 | struct regulator_init_data *vdd2; | ||
705 | struct regulator_init_data *vdd3; | ||
715 | /* TWL4030 LDO regulators */ | 706 | /* TWL4030 LDO regulators */ |
716 | struct regulator_init_data *vpll1; | 707 | struct regulator_init_data *vpll1; |
717 | struct regulator_init_data *vpll2; | 708 | struct regulator_init_data *vpll2; |
@@ -720,8 +711,6 @@ struct twl4030_platform_data { | |||
720 | struct regulator_init_data *vsim; | 711 | struct regulator_init_data *vsim; |
721 | struct regulator_init_data *vaux4; | 712 | struct regulator_init_data *vaux4; |
722 | struct regulator_init_data *vio; | 713 | struct regulator_init_data *vio; |
723 | struct regulator_init_data *vdd1; | ||
724 | struct regulator_init_data *vdd2; | ||
725 | struct regulator_init_data *vintana1; | 714 | struct regulator_init_data *vintana1; |
726 | struct regulator_init_data *vintana2; | 715 | struct regulator_init_data *vintana2; |
727 | struct regulator_init_data *vintdig; | 716 | struct regulator_init_data *vintdig; |
@@ -733,6 +722,8 @@ struct twl4030_platform_data { | |||
733 | struct regulator_init_data *vcxio; | 722 | struct regulator_init_data *vcxio; |
734 | struct regulator_init_data *vusb; | 723 | struct regulator_init_data *vusb; |
735 | struct regulator_init_data *clk32kg; | 724 | struct regulator_init_data *clk32kg; |
725 | struct regulator_init_data *v1v8; | ||
726 | struct regulator_init_data *v2v1; | ||
736 | /* TWL6025 LDO regulators */ | 727 | /* TWL6025 LDO regulators */ |
737 | struct regulator_init_data *ldo1; | 728 | struct regulator_init_data *ldo1; |
738 | struct regulator_init_data *ldo2; | 729 | struct regulator_init_data *ldo2; |
@@ -749,9 +740,16 @@ struct twl4030_platform_data { | |||
749 | struct regulator_init_data *vio6025; | 740 | struct regulator_init_data *vio6025; |
750 | }; | 741 | }; |
751 | 742 | ||
743 | struct twl_regulator_driver_data { | ||
744 | int (*set_voltage)(void *data, int target_uV); | ||
745 | int (*get_voltage)(void *data); | ||
746 | void *data; | ||
747 | unsigned long features; | ||
748 | }; | ||
749 | |||
752 | /*----------------------------------------------------------------------*/ | 750 | /*----------------------------------------------------------------------*/ |
753 | 751 | ||
754 | int twl4030_sih_setup(int module); | 752 | int twl4030_sih_setup(struct device *dev, int module, int irq_base); |
755 | 753 | ||
756 | /* Offsets to Power Registers */ | 754 | /* Offsets to Power Registers */ |
757 | #define TWL4030_VDAC_DEV_GRP 0x3B | 755 | #define TWL4030_VDAC_DEV_GRP 0x3B |
diff --git a/include/linux/i2o.h b/include/linux/i2o.h index a6deef4f4f67..d23c3c20b201 100644 --- a/include/linux/i2o.h +++ b/include/linux/i2o.h | |||
@@ -24,6 +24,7 @@ | |||
24 | #define I2O_MAX_DRIVERS 8 | 24 | #define I2O_MAX_DRIVERS 8 |
25 | 25 | ||
26 | #include <linux/pci.h> | 26 | #include <linux/pci.h> |
27 | #include <linux/bug.h> | ||
27 | #include <linux/dma-mapping.h> | 28 | #include <linux/dma-mapping.h> |
28 | #include <linux/string.h> | 29 | #include <linux/string.h> |
29 | #include <linux/slab.h> | 30 | #include <linux/slab.h> |
diff --git a/include/linux/ide.h b/include/linux/ide.h index 501370b61ee5..b17974917dbf 100644 --- a/include/linux/ide.h +++ b/include/linux/ide.h | |||
@@ -14,7 +14,6 @@ | |||
14 | #include <linux/interrupt.h> | 14 | #include <linux/interrupt.h> |
15 | #include <linux/bitops.h> | 15 | #include <linux/bitops.h> |
16 | #include <linux/bio.h> | 16 | #include <linux/bio.h> |
17 | #include <linux/device.h> | ||
18 | #include <linux/pci.h> | 17 | #include <linux/pci.h> |
19 | #include <linux/completion.h> | 18 | #include <linux/completion.h> |
20 | #include <linux/pm.h> | 19 | #include <linux/pm.h> |
@@ -23,7 +22,6 @@ | |||
23 | #include <acpi/acpi.h> | 22 | #include <acpi/acpi.h> |
24 | #endif | 23 | #endif |
25 | #include <asm/byteorder.h> | 24 | #include <asm/byteorder.h> |
26 | #include <asm/system.h> | ||
27 | #include <asm/io.h> | 25 | #include <asm/io.h> |
28 | 26 | ||
29 | /* for request_sense */ | 27 | /* for request_sense */ |
@@ -43,6 +41,8 @@ | |||
43 | #define ERROR_RESET 3 /* Reset controller every 4th retry */ | 41 | #define ERROR_RESET 3 /* Reset controller every 4th retry */ |
44 | #define ERROR_RECAL 1 /* Recalibrate every 2nd retry */ | 42 | #define ERROR_RECAL 1 /* Recalibrate every 2nd retry */ |
45 | 43 | ||
44 | struct device; | ||
45 | |||
46 | /* Error codes returned in rq->errors to the higher part of the driver. */ | 46 | /* Error codes returned in rq->errors to the higher part of the driver. */ |
47 | enum { | 47 | enum { |
48 | IDE_DRV_ERROR_GENERAL = 101, | 48 | IDE_DRV_ERROR_GENERAL = 101, |
diff --git a/include/linux/if.h b/include/linux/if.h index 06b6ef60c821..f995c663c493 100644 --- a/include/linux/if.h +++ b/include/linux/if.h | |||
@@ -80,6 +80,8 @@ | |||
80 | * skbs on transmit */ | 80 | * skbs on transmit */ |
81 | #define IFF_UNICAST_FLT 0x20000 /* Supports unicast filtering */ | 81 | #define IFF_UNICAST_FLT 0x20000 /* Supports unicast filtering */ |
82 | #define IFF_TEAM_PORT 0x40000 /* device used as team port */ | 82 | #define IFF_TEAM_PORT 0x40000 /* device used as team port */ |
83 | #define IFF_SUPP_NOFCS 0x80000 /* device supports sending custom FCS */ | ||
84 | |||
83 | 85 | ||
84 | #define IF_GET_IFACE 0x0001 /* for querying only */ | 86 | #define IF_GET_IFACE 0x0001 /* for querying only */ |
85 | #define IF_GET_PROTO 0x0002 | 87 | #define IF_GET_PROTO 0x0002 |
diff --git a/include/linux/if_eql.h b/include/linux/if_eql.h index 79c4f268410d..18a5d02a8644 100644 --- a/include/linux/if_eql.h +++ b/include/linux/if_eql.h | |||
@@ -22,7 +22,7 @@ | |||
22 | #define EQL_DEFAULT_SLAVE_PRIORITY 28800 | 22 | #define EQL_DEFAULT_SLAVE_PRIORITY 28800 |
23 | #define EQL_DEFAULT_MAX_SLAVES 4 | 23 | #define EQL_DEFAULT_MAX_SLAVES 4 |
24 | #define EQL_DEFAULT_MTU 576 | 24 | #define EQL_DEFAULT_MTU 576 |
25 | #define EQL_DEFAULT_RESCHED_IVAL 100 | 25 | #define EQL_DEFAULT_RESCHED_IVAL HZ |
26 | 26 | ||
27 | #define EQL_ENSLAVE (SIOCDEVPRIVATE) | 27 | #define EQL_ENSLAVE (SIOCDEVPRIVATE) |
28 | #define EQL_EMANCIPATE (SIOCDEVPRIVATE + 1) | 28 | #define EQL_EMANCIPATE (SIOCDEVPRIVATE + 1) |
diff --git a/include/linux/if_ppp.h b/include/linux/if_ppp.h index c9ad38322576..9048fabb7a4e 100644 --- a/include/linux/if_ppp.h +++ b/include/linux/if_ppp.h | |||
@@ -1,173 +1 @@ | |||
1 | /* | #include <linux/ppp-ioctl.h> | |
2 | * if_ppp.h - Point-to-Point Protocol definitions. | ||
3 | * | ||
4 | * Copyright (c) 1989 Carnegie Mellon University. | ||
5 | * All rights reserved. | ||
6 | * | ||
7 | * Redistribution and use in source and binary forms are permitted | ||
8 | * provided that the above copyright notice and this paragraph are | ||
9 | * duplicated in all such forms and that any documentation, | ||
10 | * advertising materials, and other materials related to such | ||
11 | * distribution and use acknowledge that the software was developed | ||
12 | * by Carnegie Mellon University. The name of the | ||
13 | * University may not be used to endorse or promote products derived | ||
14 | * from this software without specific prior written permission. | ||
15 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR | ||
16 | * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED | ||
17 | * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. | ||
18 | * | ||
19 | */ | ||
20 | |||
21 | /* | ||
22 | * ==FILEVERSION 20050812== | ||
23 | * | ||
24 | * NOTE TO MAINTAINERS: | ||
25 | * If you modify this file at all, please set the above date. | ||
26 | * if_ppp.h is shipped with a PPP distribution as well as with the kernel; | ||
27 | * if everyone increases the FILEVERSION number above, then scripts | ||
28 | * can do the right thing when deciding whether to install a new if_ppp.h | ||
29 | * file. Don't change the format of that line otherwise, so the | ||
30 | * installation script can recognize it. | ||
31 | */ | ||
32 | |||
33 | #ifndef _IF_PPP_H_ | ||
34 | #define _IF_PPP_H_ | ||
35 | |||
36 | #include <linux/types.h> | ||
37 | #include <linux/compiler.h> | ||
38 | |||
39 | /* | ||
40 | * Packet sizes | ||
41 | */ | ||
42 | |||
43 | #define PPP_MTU 1500 /* Default MTU (size of Info field) */ | ||
44 | #define PPP_MAXMRU 65000 /* Largest MRU we allow */ | ||
45 | #define PROTO_IPX 0x002b /* protocol numbers */ | ||
46 | #define PROTO_DNA_RT 0x0027 /* DNA Routing */ | ||
47 | |||
48 | |||
49 | /* | ||
50 | * Bit definitions for flags. | ||
51 | */ | ||
52 | |||
53 | #define SC_COMP_PROT 0x00000001 /* protocol compression (output) */ | ||
54 | #define SC_COMP_AC 0x00000002 /* header compression (output) */ | ||
55 | #define SC_COMP_TCP 0x00000004 /* TCP (VJ) compression (output) */ | ||
56 | #define SC_NO_TCP_CCID 0x00000008 /* disable VJ connection-id comp. */ | ||
57 | #define SC_REJ_COMP_AC 0x00000010 /* reject adrs/ctrl comp. on input */ | ||
58 | #define SC_REJ_COMP_TCP 0x00000020 /* reject TCP (VJ) comp. on input */ | ||
59 | #define SC_CCP_OPEN 0x00000040 /* Look at CCP packets */ | ||
60 | #define SC_CCP_UP 0x00000080 /* May send/recv compressed packets */ | ||
61 | #define SC_ENABLE_IP 0x00000100 /* IP packets may be exchanged */ | ||
62 | #define SC_LOOP_TRAFFIC 0x00000200 /* send traffic to pppd */ | ||
63 | #define SC_MULTILINK 0x00000400 /* do multilink encapsulation */ | ||
64 | #define SC_MP_SHORTSEQ 0x00000800 /* use short MP sequence numbers */ | ||
65 | #define SC_COMP_RUN 0x00001000 /* compressor has been inited */ | ||
66 | #define SC_DECOMP_RUN 0x00002000 /* decompressor has been inited */ | ||
67 | #define SC_MP_XSHORTSEQ 0x00004000 /* transmit short MP seq numbers */ | ||
68 | #define SC_DEBUG 0x00010000 /* enable debug messages */ | ||
69 | #define SC_LOG_INPKT 0x00020000 /* log contents of good pkts recvd */ | ||
70 | #define SC_LOG_OUTPKT 0x00040000 /* log contents of pkts sent */ | ||
71 | #define SC_LOG_RAWIN 0x00080000 /* log all chars received */ | ||
72 | #define SC_LOG_FLUSH 0x00100000 /* log all chars flushed */ | ||
73 | #define SC_SYNC 0x00200000 /* synchronous serial mode */ | ||
74 | #define SC_MUST_COMP 0x00400000 /* no uncompressed packets may be sent or received */ | ||
75 | #define SC_MASK 0x0f600fff /* bits that user can change */ | ||
76 | |||
77 | /* state bits */ | ||
78 | #define SC_XMIT_BUSY 0x10000000 /* (used by isdn_ppp?) */ | ||
79 | #define SC_RCV_ODDP 0x08000000 /* have rcvd char with odd parity */ | ||
80 | #define SC_RCV_EVNP 0x04000000 /* have rcvd char with even parity */ | ||
81 | #define SC_RCV_B7_1 0x02000000 /* have rcvd char with bit 7 = 1 */ | ||
82 | #define SC_RCV_B7_0 0x01000000 /* have rcvd char with bit 7 = 0 */ | ||
83 | #define SC_DC_FERROR 0x00800000 /* fatal decomp error detected */ | ||
84 | #define SC_DC_ERROR 0x00400000 /* non-fatal decomp error detected */ | ||
85 | |||
86 | /* | ||
87 | * Ioctl definitions. | ||
88 | */ | ||
89 | |||
90 | struct npioctl { | ||
91 | int protocol; /* PPP protocol, e.g. PPP_IP */ | ||
92 | enum NPmode mode; | ||
93 | }; | ||
94 | |||
95 | /* Structure describing a CCP configuration option, for PPPIOCSCOMPRESS */ | ||
96 | struct ppp_option_data { | ||
97 | __u8 __user *ptr; | ||
98 | __u32 length; | ||
99 | int transmit; | ||
100 | }; | ||
101 | |||
102 | struct ifpppstatsreq { | ||
103 | struct ifreq b; | ||
104 | struct ppp_stats stats; /* statistic information */ | ||
105 | }; | ||
106 | |||
107 | struct ifpppcstatsreq { | ||
108 | struct ifreq b; | ||
109 | struct ppp_comp_stats stats; | ||
110 | }; | ||
111 | |||
112 | /* For PPPIOCGL2TPSTATS */ | ||
113 | struct pppol2tp_ioc_stats { | ||
114 | __u16 tunnel_id; /* redundant */ | ||
115 | __u16 session_id; /* if zero, get tunnel stats */ | ||
116 | __u32 using_ipsec:1; /* valid only for session_id == 0 */ | ||
117 | __aligned_u64 tx_packets; | ||
118 | __aligned_u64 tx_bytes; | ||
119 | __aligned_u64 tx_errors; | ||
120 | __aligned_u64 rx_packets; | ||
121 | __aligned_u64 rx_bytes; | ||
122 | __aligned_u64 rx_seq_discards; | ||
123 | __aligned_u64 rx_oos_packets; | ||
124 | __aligned_u64 rx_errors; | ||
125 | }; | ||
126 | |||
127 | #define ifr__name b.ifr_ifrn.ifrn_name | ||
128 | #define stats_ptr b.ifr_ifru.ifru_data | ||
129 | |||
130 | /* | ||
131 | * Ioctl definitions. | ||
132 | */ | ||
133 | |||
134 | #define PPPIOCGFLAGS _IOR('t', 90, int) /* get configuration flags */ | ||
135 | #define PPPIOCSFLAGS _IOW('t', 89, int) /* set configuration flags */ | ||
136 | #define PPPIOCGASYNCMAP _IOR('t', 88, int) /* get async map */ | ||
137 | #define PPPIOCSASYNCMAP _IOW('t', 87, int) /* set async map */ | ||
138 | #define PPPIOCGUNIT _IOR('t', 86, int) /* get ppp unit number */ | ||
139 | #define PPPIOCGRASYNCMAP _IOR('t', 85, int) /* get receive async map */ | ||
140 | #define PPPIOCSRASYNCMAP _IOW('t', 84, int) /* set receive async map */ | ||
141 | #define PPPIOCGMRU _IOR('t', 83, int) /* get max receive unit */ | ||
142 | #define PPPIOCSMRU _IOW('t', 82, int) /* set max receive unit */ | ||
143 | #define PPPIOCSMAXCID _IOW('t', 81, int) /* set VJ max slot ID */ | ||
144 | #define PPPIOCGXASYNCMAP _IOR('t', 80, ext_accm) /* get extended ACCM */ | ||
145 | #define PPPIOCSXASYNCMAP _IOW('t', 79, ext_accm) /* set extended ACCM */ | ||
146 | #define PPPIOCXFERUNIT _IO('t', 78) /* transfer PPP unit */ | ||
147 | #define PPPIOCSCOMPRESS _IOW('t', 77, struct ppp_option_data) | ||
148 | #define PPPIOCGNPMODE _IOWR('t', 76, struct npioctl) /* get NP mode */ | ||
149 | #define PPPIOCSNPMODE _IOW('t', 75, struct npioctl) /* set NP mode */ | ||
150 | #define PPPIOCSPASS _IOW('t', 71, struct sock_fprog) /* set pass filter */ | ||
151 | #define PPPIOCSACTIVE _IOW('t', 70, struct sock_fprog) /* set active filt */ | ||
152 | #define PPPIOCGDEBUG _IOR('t', 65, int) /* Read debug level */ | ||
153 | #define PPPIOCSDEBUG _IOW('t', 64, int) /* Set debug level */ | ||
154 | #define PPPIOCGIDLE _IOR('t', 63, struct ppp_idle) /* get idle time */ | ||
155 | #define PPPIOCNEWUNIT _IOWR('t', 62, int) /* create new ppp unit */ | ||
156 | #define PPPIOCATTACH _IOW('t', 61, int) /* attach to ppp unit */ | ||
157 | #define PPPIOCDETACH _IOW('t', 60, int) /* detach from ppp unit/chan */ | ||
158 | #define PPPIOCSMRRU _IOW('t', 59, int) /* set multilink MRU */ | ||
159 | #define PPPIOCCONNECT _IOW('t', 58, int) /* connect channel to unit */ | ||
160 | #define PPPIOCDISCONN _IO('t', 57) /* disconnect channel */ | ||
161 | #define PPPIOCATTCHAN _IOW('t', 56, int) /* attach to ppp channel */ | ||
162 | #define PPPIOCGCHAN _IOR('t', 55, int) /* get ppp channel number */ | ||
163 | #define PPPIOCGL2TPSTATS _IOR('t', 54, struct pppol2tp_ioc_stats) | ||
164 | |||
165 | #define SIOCGPPPSTATS (SIOCDEVPRIVATE + 0) | ||
166 | #define SIOCGPPPVER (SIOCDEVPRIVATE + 1) /* NEVER change this!! */ | ||
167 | #define SIOCGPPPCSTATS (SIOCDEVPRIVATE + 2) | ||
168 | |||
169 | #if !defined(ifr_mtu) | ||
170 | #define ifr_mtu ifr_ifru.ifru_metric | ||
171 | #endif | ||
172 | |||
173 | #endif /* _IF_PPP_H_ */ | ||
diff --git a/include/linux/if_vlan.h b/include/linux/if_vlan.h index 13aff1e2183b..a810987cb80e 100644 --- a/include/linux/if_vlan.h +++ b/include/linux/if_vlan.h | |||
@@ -17,11 +17,11 @@ | |||
17 | #include <linux/netdevice.h> | 17 | #include <linux/netdevice.h> |
18 | #include <linux/etherdevice.h> | 18 | #include <linux/etherdevice.h> |
19 | #include <linux/rtnetlink.h> | 19 | #include <linux/rtnetlink.h> |
20 | #include <linux/bug.h> | ||
20 | 21 | ||
21 | #define VLAN_HLEN 4 /* The additional bytes (on top of the Ethernet header) | 22 | #define VLAN_HLEN 4 /* The additional bytes required by VLAN |
22 | * that VLAN requires. | 23 | * (in addition to the Ethernet header) |
23 | */ | 24 | */ |
24 | #define VLAN_ETH_ALEN 6 /* Octets in one ethernet addr */ | ||
25 | #define VLAN_ETH_HLEN 18 /* Total octets in header. */ | 25 | #define VLAN_ETH_HLEN 18 /* Total octets in header. */ |
26 | #define VLAN_ETH_ZLEN 64 /* Min. octets in frame sans FCS */ | 26 | #define VLAN_ETH_ZLEN 64 /* Min. octets in frame sans FCS */ |
27 | 27 | ||
@@ -177,7 +177,7 @@ static inline struct sk_buff *vlan_insert_tag(struct sk_buff *skb, u16 vlan_tci) | |||
177 | veth = (struct vlan_ethhdr *)skb_push(skb, VLAN_HLEN); | 177 | veth = (struct vlan_ethhdr *)skb_push(skb, VLAN_HLEN); |
178 | 178 | ||
179 | /* Move the mac addresses to the beginning of the new header. */ | 179 | /* Move the mac addresses to the beginning of the new header. */ |
180 | memmove(skb->data, skb->data + VLAN_HLEN, 2 * VLAN_ETH_ALEN); | 180 | memmove(skb->data, skb->data + VLAN_HLEN, 2 * ETH_ALEN); |
181 | skb->mac_header -= VLAN_HLEN; | 181 | skb->mac_header -= VLAN_HLEN; |
182 | 182 | ||
183 | /* first, the ethernet type */ | 183 | /* first, the ethernet type */ |
diff --git a/include/linux/in.h b/include/linux/in.h index 01129c0ea87c..e0337f11d92e 100644 --- a/include/linux/in.h +++ b/include/linux/in.h | |||
@@ -111,6 +111,7 @@ struct in_addr { | |||
111 | #define MCAST_LEAVE_SOURCE_GROUP 47 | 111 | #define MCAST_LEAVE_SOURCE_GROUP 47 |
112 | #define MCAST_MSFILTER 48 | 112 | #define MCAST_MSFILTER 48 |
113 | #define IP_MULTICAST_ALL 49 | 113 | #define IP_MULTICAST_ALL 49 |
114 | #define IP_UNICAST_IF 50 | ||
114 | 115 | ||
115 | #define MCAST_EXCLUDE 0 | 116 | #define MCAST_EXCLUDE 0 |
116 | #define MCAST_INCLUDE 1 | 117 | #define MCAST_INCLUDE 1 |
diff --git a/include/linux/in6.h b/include/linux/in6.h index 097a34b55560..5c83d9e3eb8f 100644 --- a/include/linux/in6.h +++ b/include/linux/in6.h | |||
@@ -271,6 +271,7 @@ struct in6_flowlabel_req { | |||
271 | #define IPV6_ORIGDSTADDR 74 | 271 | #define IPV6_ORIGDSTADDR 74 |
272 | #define IPV6_RECVORIGDSTADDR IPV6_ORIGDSTADDR | 272 | #define IPV6_RECVORIGDSTADDR IPV6_ORIGDSTADDR |
273 | #define IPV6_TRANSPARENT 75 | 273 | #define IPV6_TRANSPARENT 75 |
274 | #define IPV6_UNICAST_IF 76 | ||
274 | 275 | ||
275 | /* | 276 | /* |
276 | * Multicast Routing: | 277 | * Multicast Routing: |
diff --git a/include/linux/inetdevice.h b/include/linux/inetdevice.h index 5f8146695b7f..597f4a9f3240 100644 --- a/include/linux/inetdevice.h +++ b/include/linux/inetdevice.h | |||
@@ -139,6 +139,7 @@ static inline void ipv4_devconf_setall(struct in_device *in_dev) | |||
139 | IN_DEV_ORCONF((in_dev), ACCEPT_REDIRECTS))) | 139 | IN_DEV_ORCONF((in_dev), ACCEPT_REDIRECTS))) |
140 | 140 | ||
141 | #define IN_DEV_ARPFILTER(in_dev) IN_DEV_ORCONF((in_dev), ARPFILTER) | 141 | #define IN_DEV_ARPFILTER(in_dev) IN_DEV_ORCONF((in_dev), ARPFILTER) |
142 | #define IN_DEV_ARP_ACCEPT(in_dev) IN_DEV_ORCONF((in_dev), ARP_ACCEPT) | ||
142 | #define IN_DEV_ARP_ANNOUNCE(in_dev) IN_DEV_MAXCONF((in_dev), ARP_ANNOUNCE) | 143 | #define IN_DEV_ARP_ANNOUNCE(in_dev) IN_DEV_MAXCONF((in_dev), ARP_ANNOUNCE) |
143 | #define IN_DEV_ARP_IGNORE(in_dev) IN_DEV_MAXCONF((in_dev), ARP_IGNORE) | 144 | #define IN_DEV_ARP_IGNORE(in_dev) IN_DEV_MAXCONF((in_dev), ARP_IGNORE) |
144 | #define IN_DEV_ARP_NOTIFY(in_dev) IN_DEV_MAXCONF((in_dev), ARP_NOTIFY) | 145 | #define IN_DEV_ARP_NOTIFY(in_dev) IN_DEV_MAXCONF((in_dev), ARP_NOTIFY) |
diff --git a/include/linux/init_task.h b/include/linux/init_task.h index 9c66b1ada9d7..e4baff5f7ff4 100644 --- a/include/linux/init_task.h +++ b/include/linux/init_task.h | |||
@@ -29,6 +29,13 @@ extern struct fs_struct init_fs; | |||
29 | #define INIT_GROUP_RWSEM(sig) | 29 | #define INIT_GROUP_RWSEM(sig) |
30 | #endif | 30 | #endif |
31 | 31 | ||
32 | #ifdef CONFIG_CPUSETS | ||
33 | #define INIT_CPUSET_SEQ \ | ||
34 | .mems_allowed_seq = SEQCNT_ZERO, | ||
35 | #else | ||
36 | #define INIT_CPUSET_SEQ | ||
37 | #endif | ||
38 | |||
32 | #define INIT_SIGNALS(sig) { \ | 39 | #define INIT_SIGNALS(sig) { \ |
33 | .nr_threads = 1, \ | 40 | .nr_threads = 1, \ |
34 | .wait_chldexit = __WAIT_QUEUE_HEAD_INITIALIZER(sig.wait_chldexit),\ | 41 | .wait_chldexit = __WAIT_QUEUE_HEAD_INITIALIZER(sig.wait_chldexit),\ |
@@ -149,7 +156,7 @@ extern struct cred init_cred; | |||
149 | }, \ | 156 | }, \ |
150 | .rt = { \ | 157 | .rt = { \ |
151 | .run_list = LIST_HEAD_INIT(tsk.rt.run_list), \ | 158 | .run_list = LIST_HEAD_INIT(tsk.rt.run_list), \ |
152 | .time_slice = HZ, \ | 159 | .time_slice = RR_TIMESLICE, \ |
153 | .nr_cpus_allowed = NR_CPUS, \ | 160 | .nr_cpus_allowed = NR_CPUS, \ |
154 | }, \ | 161 | }, \ |
155 | .tasks = LIST_HEAD_INIT(tsk.tasks), \ | 162 | .tasks = LIST_HEAD_INIT(tsk.tasks), \ |
@@ -192,6 +199,7 @@ extern struct cred init_cred; | |||
192 | INIT_FTRACE_GRAPH \ | 199 | INIT_FTRACE_GRAPH \ |
193 | INIT_TRACE_RECURSION \ | 200 | INIT_TRACE_RECURSION \ |
194 | INIT_TASK_RCU_PREEMPT(tsk) \ | 201 | INIT_TASK_RCU_PREEMPT(tsk) \ |
202 | INIT_CPUSET_SEQ \ | ||
195 | } | 203 | } |
196 | 204 | ||
197 | 205 | ||
diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h index a64b00e286f5..2aea5d22db07 100644 --- a/include/linux/interrupt.h +++ b/include/linux/interrupt.h | |||
@@ -19,8 +19,6 @@ | |||
19 | 19 | ||
20 | #include <linux/atomic.h> | 20 | #include <linux/atomic.h> |
21 | #include <asm/ptrace.h> | 21 | #include <asm/ptrace.h> |
22 | #include <asm/system.h> | ||
23 | #include <trace/events/irq.h> | ||
24 | 22 | ||
25 | /* | 23 | /* |
26 | * These correspond to the IORESOURCE_IRQ_* defines in | 24 | * These correspond to the IORESOURCE_IRQ_* defines in |
@@ -456,11 +454,7 @@ asmlinkage void do_softirq(void); | |||
456 | asmlinkage void __do_softirq(void); | 454 | asmlinkage void __do_softirq(void); |
457 | extern void open_softirq(int nr, void (*action)(struct softirq_action *)); | 455 | extern void open_softirq(int nr, void (*action)(struct softirq_action *)); |
458 | extern void softirq_init(void); | 456 | extern void softirq_init(void); |
459 | static inline void __raise_softirq_irqoff(unsigned int nr) | 457 | extern void __raise_softirq_irqoff(unsigned int nr); |
460 | { | ||
461 | trace_softirq_raise(nr); | ||
462 | or_softirq_pending(1UL << nr); | ||
463 | } | ||
464 | 458 | ||
465 | extern void raise_softirq_irqoff(unsigned int nr); | 459 | extern void raise_softirq_irqoff(unsigned int nr); |
466 | extern void raise_softirq(unsigned int nr); | 460 | extern void raise_softirq(unsigned int nr); |
diff --git a/include/linux/io-mapping.h b/include/linux/io-mapping.h index e44e84f0156c..657fab4efab3 100644 --- a/include/linux/io-mapping.h +++ b/include/linux/io-mapping.h | |||
@@ -20,6 +20,7 @@ | |||
20 | 20 | ||
21 | #include <linux/types.h> | 21 | #include <linux/types.h> |
22 | #include <linux/slab.h> | 22 | #include <linux/slab.h> |
23 | #include <linux/bug.h> | ||
23 | #include <asm/io.h> | 24 | #include <asm/io.h> |
24 | #include <asm/page.h> | 25 | #include <asm/page.h> |
25 | 26 | ||
diff --git a/include/linux/iocontext.h b/include/linux/iocontext.h index 119773eebe31..1a3018063034 100644 --- a/include/linux/iocontext.h +++ b/include/linux/iocontext.h | |||
@@ -6,8 +6,11 @@ | |||
6 | #include <linux/workqueue.h> | 6 | #include <linux/workqueue.h> |
7 | 7 | ||
8 | enum { | 8 | enum { |
9 | ICQ_IOPRIO_CHANGED, | 9 | ICQ_IOPRIO_CHANGED = 1 << 0, |
10 | ICQ_CGROUP_CHANGED, | 10 | ICQ_CGROUP_CHANGED = 1 << 1, |
11 | ICQ_EXITED = 1 << 2, | ||
12 | |||
13 | ICQ_CHANGED_MASK = ICQ_IOPRIO_CHANGED | ICQ_CGROUP_CHANGED, | ||
11 | }; | 14 | }; |
12 | 15 | ||
13 | /* | 16 | /* |
@@ -88,7 +91,7 @@ struct io_cq { | |||
88 | struct rcu_head __rcu_head; | 91 | struct rcu_head __rcu_head; |
89 | }; | 92 | }; |
90 | 93 | ||
91 | unsigned long changed; | 94 | unsigned int flags; |
92 | }; | 95 | }; |
93 | 96 | ||
94 | /* | 97 | /* |
@@ -139,6 +142,7 @@ struct io_context *get_task_io_context(struct task_struct *task, | |||
139 | gfp_t gfp_flags, int node); | 142 | gfp_t gfp_flags, int node); |
140 | void ioc_ioprio_changed(struct io_context *ioc, int ioprio); | 143 | void ioc_ioprio_changed(struct io_context *ioc, int ioprio); |
141 | void ioc_cgroup_changed(struct io_context *ioc); | 144 | void ioc_cgroup_changed(struct io_context *ioc); |
145 | unsigned int icq_get_changed(struct io_cq *icq); | ||
142 | #else | 146 | #else |
143 | struct io_context; | 147 | struct io_context; |
144 | static inline void put_io_context(struct io_context *ioc) { } | 148 | static inline void put_io_context(struct io_context *ioc) { } |
diff --git a/include/linux/ioport.h b/include/linux/ioport.h index 9d57a71775b5..e885ba23de70 100644 --- a/include/linux/ioport.h +++ b/include/linux/ioport.h | |||
@@ -23,12 +23,6 @@ struct resource { | |||
23 | struct resource *parent, *sibling, *child; | 23 | struct resource *parent, *sibling, *child; |
24 | }; | 24 | }; |
25 | 25 | ||
26 | struct resource_list { | ||
27 | struct resource_list *next; | ||
28 | struct resource *res; | ||
29 | struct pci_dev *dev; | ||
30 | }; | ||
31 | |||
32 | /* | 26 | /* |
33 | * IO resources have these defined flags. | 27 | * IO resources have these defined flags. |
34 | */ | 28 | */ |
diff --git a/include/linux/ipmi.h b/include/linux/ipmi.h index bbd156bb953b..48dcba9b2065 100644 --- a/include/linux/ipmi.h +++ b/include/linux/ipmi.h | |||
@@ -220,10 +220,10 @@ struct kernel_ipmi_msg { | |||
220 | * The in-kernel interface. | 220 | * The in-kernel interface. |
221 | */ | 221 | */ |
222 | #include <linux/list.h> | 222 | #include <linux/list.h> |
223 | #include <linux/device.h> | ||
224 | #include <linux/proc_fs.h> | 223 | #include <linux/proc_fs.h> |
225 | 224 | ||
226 | struct module; | 225 | struct module; |
226 | struct device; | ||
227 | 227 | ||
228 | /* Opaque type for a IPMI message user. One of these is needed to | 228 | /* Opaque type for a IPMI message user. One of these is needed to |
229 | send and receive messages. */ | 229 | send and receive messages. */ |
diff --git a/include/linux/ipmi_smi.h b/include/linux/ipmi_smi.h index 3ef0d8b6aa6f..fcb5d44ea635 100644 --- a/include/linux/ipmi_smi.h +++ b/include/linux/ipmi_smi.h | |||
@@ -36,10 +36,11 @@ | |||
36 | 36 | ||
37 | #include <linux/ipmi_msgdefs.h> | 37 | #include <linux/ipmi_msgdefs.h> |
38 | #include <linux/proc_fs.h> | 38 | #include <linux/proc_fs.h> |
39 | #include <linux/device.h> | ||
40 | #include <linux/platform_device.h> | 39 | #include <linux/platform_device.h> |
41 | #include <linux/ipmi.h> | 40 | #include <linux/ipmi.h> |
42 | 41 | ||
42 | struct device; | ||
43 | |||
43 | /* This files describes the interface for IPMI system management interface | 44 | /* This files describes the interface for IPMI system management interface |
44 | drivers to bind into the IPMI message handler. */ | 45 | drivers to bind into the IPMI message handler. */ |
45 | 46 | ||
diff --git a/include/linux/ipv6.h b/include/linux/ipv6.h index 6318268dcaf5..8260ef779762 100644 --- a/include/linux/ipv6.h +++ b/include/linux/ipv6.h | |||
@@ -233,6 +233,11 @@ static inline struct ipv6hdr *ipipv6_hdr(const struct sk_buff *skb) | |||
233 | return (struct ipv6hdr *)skb_transport_header(skb); | 233 | return (struct ipv6hdr *)skb_transport_header(skb); |
234 | } | 234 | } |
235 | 235 | ||
236 | static inline __u8 ipv6_tclass(const struct ipv6hdr *iph) | ||
237 | { | ||
238 | return (ntohl(*(__be32 *)iph) >> 20) & 0xff; | ||
239 | } | ||
240 | |||
236 | /* | 241 | /* |
237 | This structure contains results of exthdrs parsing | 242 | This structure contains results of exthdrs parsing |
238 | as offsets from skb->nh. | 243 | as offsets from skb->nh. |
@@ -324,6 +329,7 @@ struct ipv6_pinfo { | |||
324 | __unused_2:6; | 329 | __unused_2:6; |
325 | __s16 mcast_hops:9; | 330 | __s16 mcast_hops:9; |
326 | #endif | 331 | #endif |
332 | int ucast_oif; | ||
327 | int mcast_oif; | 333 | int mcast_oif; |
328 | 334 | ||
329 | /* pktoption flags */ | 335 | /* pktoption flags */ |
@@ -360,7 +366,7 @@ struct ipv6_pinfo { | |||
360 | dontfrag:1; | 366 | dontfrag:1; |
361 | __u8 min_hopcount; | 367 | __u8 min_hopcount; |
362 | __u8 tclass; | 368 | __u8 tclass; |
363 | __u8 padding; | 369 | __u8 rcv_tclass; |
364 | 370 | ||
365 | __u32 dst_cookie; | 371 | __u32 dst_cookie; |
366 | 372 | ||
diff --git a/include/linux/irq.h b/include/linux/irq.h index bff29c58da23..7810406f3d80 100644 --- a/include/linux/irq.h +++ b/include/linux/irq.h | |||
@@ -263,6 +263,11 @@ static inline void irqd_clr_chained_irq_inprogress(struct irq_data *d) | |||
263 | d->state_use_accessors &= ~IRQD_IRQ_INPROGRESS; | 263 | d->state_use_accessors &= ~IRQD_IRQ_INPROGRESS; |
264 | } | 264 | } |
265 | 265 | ||
266 | static inline irq_hw_number_t irqd_to_hwirq(struct irq_data *d) | ||
267 | { | ||
268 | return d->hwirq; | ||
269 | } | ||
270 | |||
266 | /** | 271 | /** |
267 | * struct irq_chip - hardware interrupt chip descriptor | 272 | * struct irq_chip - hardware interrupt chip descriptor |
268 | * | 273 | * |
diff --git a/include/linux/irqdomain.h b/include/linux/irqdomain.h index bd4272b61a14..c65740d76e66 100644 --- a/include/linux/irqdomain.h +++ b/include/linux/irqdomain.h | |||
@@ -9,99 +9,178 @@ | |||
9 | * representation into a hardware irq number that can be mapped back to a | 9 | * representation into a hardware irq number that can be mapped back to a |
10 | * Linux irq number without any extra platform support code. | 10 | * Linux irq number without any extra platform support code. |
11 | * | 11 | * |
12 | * irq_domain is expected to be embedded in an interrupt controller's private | 12 | * Interrupt controller "domain" data structure. This could be defined as a |
13 | * data structure. | 13 | * irq domain controller. That is, it handles the mapping between hardware |
14 | * and virtual interrupt numbers for a given interrupt domain. The domain | ||
15 | * structure is generally created by the PIC code for a given PIC instance | ||
16 | * (though a domain can cover more than one PIC if they have a flat number | ||
17 | * model). It's the domain callbacks that are responsible for setting the | ||
18 | * irq_chip on a given irq_desc after it's been mapped. | ||
19 | * | ||
20 | * The host code and data structures are agnostic to whether or not | ||
21 | * we use an open firmware device-tree. We do have references to struct | ||
22 | * device_node in two places: in irq_find_host() to find the host matching | ||
23 | * a given interrupt controller node, and of course as an argument to its | ||
24 | * counterpart domain->ops->match() callback. However, those are treated as | ||
25 | * generic pointers by the core and the fact that it's actually a device-node | ||
26 | * pointer is purely a convention between callers and implementation. This | ||
27 | * code could thus be used on other architectures by replacing those two | ||
28 | * by some sort of arch-specific void * "token" used to identify interrupt | ||
29 | * controllers. | ||
14 | */ | 30 | */ |
31 | |||
15 | #ifndef _LINUX_IRQDOMAIN_H | 32 | #ifndef _LINUX_IRQDOMAIN_H |
16 | #define _LINUX_IRQDOMAIN_H | 33 | #define _LINUX_IRQDOMAIN_H |
17 | 34 | ||
18 | #include <linux/irq.h> | 35 | #include <linux/types.h> |
19 | #include <linux/mod_devicetable.h> | 36 | #include <linux/radix-tree.h> |
20 | 37 | ||
21 | #ifdef CONFIG_IRQ_DOMAIN | ||
22 | struct device_node; | 38 | struct device_node; |
23 | struct irq_domain; | 39 | struct irq_domain; |
40 | struct of_device_id; | ||
41 | |||
42 | /* Number of irqs reserved for a legacy isa controller */ | ||
43 | #define NUM_ISA_INTERRUPTS 16 | ||
24 | 44 | ||
25 | /** | 45 | /** |
26 | * struct irq_domain_ops - Methods for irq_domain objects | 46 | * struct irq_domain_ops - Methods for irq_domain objects |
27 | * @to_irq: (optional) given a local hardware irq number, return the linux | 47 | * @match: Match an interrupt controller device node to a host, returns |
28 | * irq number. If to_irq is not implemented, then the irq_domain | 48 | * 1 on a match |
29 | * will use this translation: irq = (domain->irq_base + hwirq) | 49 | * @map: Create or update a mapping between a virtual irq number and a hw |
30 | * @dt_translate: Given a device tree node and interrupt specifier, decode | 50 | * irq number. This is called only once for a given mapping. |
31 | * the hardware irq number and linux irq type value. | 51 | * @unmap: Dispose of such a mapping |
52 | * @xlate: Given a device tree node and interrupt specifier, decode | ||
53 | * the hardware irq number and linux irq type value. | ||
54 | * | ||
55 | * Functions below are provided by the driver and called whenever a new mapping | ||
56 | * is created or an old mapping is disposed. The driver can then proceed to | ||
57 | * whatever internal data structures management is required. It also needs | ||
58 | * to setup the irq_desc when returning from map(). | ||
32 | */ | 59 | */ |
33 | struct irq_domain_ops { | 60 | struct irq_domain_ops { |
34 | unsigned int (*to_irq)(struct irq_domain *d, unsigned long hwirq); | 61 | int (*match)(struct irq_domain *d, struct device_node *node); |
35 | 62 | int (*map)(struct irq_domain *d, unsigned int virq, irq_hw_number_t hw); | |
36 | #ifdef CONFIG_OF | 63 | void (*unmap)(struct irq_domain *d, unsigned int virq); |
37 | int (*dt_translate)(struct irq_domain *d, struct device_node *node, | 64 | int (*xlate)(struct irq_domain *d, struct device_node *node, |
38 | const u32 *intspec, unsigned int intsize, | 65 | const u32 *intspec, unsigned int intsize, |
39 | unsigned long *out_hwirq, unsigned int *out_type); | 66 | unsigned long *out_hwirq, unsigned int *out_type); |
40 | #endif /* CONFIG_OF */ | ||
41 | }; | 67 | }; |
42 | 68 | ||
43 | /** | 69 | /** |
44 | * struct irq_domain - Hardware interrupt number translation object | 70 | * struct irq_domain - Hardware interrupt number translation object |
45 | * @list: Element in global irq_domain list. | 71 | * @link: Element in global irq_domain list. |
72 | * @revmap_type: Method used for reverse mapping hwirq numbers to linux irq. This | ||
73 | * will be one of the IRQ_DOMAIN_MAP_* values. | ||
74 | * @revmap_data: Revmap method specific data. | ||
75 | * @ops: pointer to irq_domain methods | ||
76 | * @host_data: private data pointer for use by owner. Not touched by irq_domain | ||
77 | * core code. | ||
46 | * @irq_base: Start of irq_desc range assigned to the irq_domain. The creator | 78 | * @irq_base: Start of irq_desc range assigned to the irq_domain. The creator |
47 | * of the irq_domain is responsible for allocating the array of | 79 | * of the irq_domain is responsible for allocating the array of |
48 | * irq_desc structures. | 80 | * irq_desc structures. |
49 | * @nr_irq: Number of irqs managed by the irq domain | 81 | * @nr_irq: Number of irqs managed by the irq domain |
50 | * @hwirq_base: Starting number for hwirqs managed by the irq domain | 82 | * @hwirq_base: Starting number for hwirqs managed by the irq domain |
51 | * @ops: pointer to irq_domain methods | ||
52 | * @priv: private data pointer for use by owner. Not touched by irq_domain | ||
53 | * core code. | ||
54 | * @of_node: (optional) Pointer to device tree nodes associated with the | 83 | * @of_node: (optional) Pointer to device tree nodes associated with the |
55 | * irq_domain. Used when decoding device tree interrupt specifiers. | 84 | * irq_domain. Used when decoding device tree interrupt specifiers. |
56 | */ | 85 | */ |
57 | struct irq_domain { | 86 | struct irq_domain { |
58 | struct list_head list; | 87 | struct list_head link; |
59 | unsigned int irq_base; | 88 | |
60 | unsigned int nr_irq; | 89 | /* type of reverse mapping_technique */ |
61 | unsigned int hwirq_base; | 90 | unsigned int revmap_type; |
91 | union { | ||
92 | struct { | ||
93 | unsigned int size; | ||
94 | unsigned int first_irq; | ||
95 | irq_hw_number_t first_hwirq; | ||
96 | } legacy; | ||
97 | struct { | ||
98 | unsigned int size; | ||
99 | unsigned int *revmap; | ||
100 | } linear; | ||
101 | struct { | ||
102 | unsigned int max_irq; | ||
103 | } nomap; | ||
104 | struct radix_tree_root tree; | ||
105 | } revmap_data; | ||
62 | const struct irq_domain_ops *ops; | 106 | const struct irq_domain_ops *ops; |
63 | void *priv; | 107 | void *host_data; |
108 | irq_hw_number_t inval_irq; | ||
109 | |||
110 | /* Optional device node pointer */ | ||
64 | struct device_node *of_node; | 111 | struct device_node *of_node; |
65 | }; | 112 | }; |
66 | 113 | ||
67 | /** | 114 | #ifdef CONFIG_IRQ_DOMAIN |
68 | * irq_domain_to_irq() - Translate from a hardware irq to a linux irq number | 115 | struct irq_domain *irq_domain_add_legacy(struct device_node *of_node, |
69 | * | 116 | unsigned int size, |
70 | * Returns the linux irq number associated with a hardware irq. By default, | 117 | unsigned int first_irq, |
71 | * the mapping is irq == domain->irq_base + hwirq, but this mapping can | 118 | irq_hw_number_t first_hwirq, |
72 | * be overridden if the irq_domain implements a .to_irq() hook. | 119 | const struct irq_domain_ops *ops, |
73 | */ | 120 | void *host_data); |
74 | static inline unsigned int irq_domain_to_irq(struct irq_domain *d, | 121 | struct irq_domain *irq_domain_add_linear(struct device_node *of_node, |
75 | unsigned long hwirq) | 122 | unsigned int size, |
123 | const struct irq_domain_ops *ops, | ||
124 | void *host_data); | ||
125 | struct irq_domain *irq_domain_add_nomap(struct device_node *of_node, | ||
126 | unsigned int max_irq, | ||
127 | const struct irq_domain_ops *ops, | ||
128 | void *host_data); | ||
129 | struct irq_domain *irq_domain_add_tree(struct device_node *of_node, | ||
130 | const struct irq_domain_ops *ops, | ||
131 | void *host_data); | ||
132 | |||
133 | extern struct irq_domain *irq_find_host(struct device_node *node); | ||
134 | extern void irq_set_default_host(struct irq_domain *host); | ||
135 | |||
136 | static inline struct irq_domain *irq_domain_add_legacy_isa( | ||
137 | struct device_node *of_node, | ||
138 | const struct irq_domain_ops *ops, | ||
139 | void *host_data) | ||
76 | { | 140 | { |
77 | if (d->ops->to_irq) | 141 | return irq_domain_add_legacy(of_node, NUM_ISA_INTERRUPTS, 0, 0, ops, |
78 | return d->ops->to_irq(d, hwirq); | 142 | host_data); |
79 | if (WARN_ON(hwirq < d->hwirq_base)) | ||
80 | return 0; | ||
81 | return d->irq_base + hwirq - d->hwirq_base; | ||
82 | } | 143 | } |
144 | extern struct irq_domain *irq_find_host(struct device_node *node); | ||
145 | extern void irq_set_default_host(struct irq_domain *host); | ||
83 | 146 | ||
84 | #define irq_domain_for_each_hwirq(d, hw) \ | ||
85 | for (hw = d->hwirq_base; hw < d->hwirq_base + d->nr_irq; hw++) | ||
86 | 147 | ||
87 | #define irq_domain_for_each_irq(d, hw, irq) \ | 148 | extern unsigned int irq_create_mapping(struct irq_domain *host, |
88 | for (hw = d->hwirq_base, irq = irq_domain_to_irq(d, hw); \ | 149 | irq_hw_number_t hwirq); |
89 | hw < d->hwirq_base + d->nr_irq; \ | 150 | extern void irq_dispose_mapping(unsigned int virq); |
90 | hw++, irq = irq_domain_to_irq(d, hw)) | 151 | extern unsigned int irq_find_mapping(struct irq_domain *host, |
152 | irq_hw_number_t hwirq); | ||
153 | extern unsigned int irq_create_direct_mapping(struct irq_domain *host); | ||
154 | extern void irq_radix_revmap_insert(struct irq_domain *host, unsigned int virq, | ||
155 | irq_hw_number_t hwirq); | ||
156 | extern unsigned int irq_radix_revmap_lookup(struct irq_domain *host, | ||
157 | irq_hw_number_t hwirq); | ||
158 | extern unsigned int irq_linear_revmap(struct irq_domain *host, | ||
159 | irq_hw_number_t hwirq); | ||
91 | 160 | ||
92 | extern void irq_domain_add(struct irq_domain *domain); | 161 | extern const struct irq_domain_ops irq_domain_simple_ops; |
93 | extern void irq_domain_del(struct irq_domain *domain); | ||
94 | 162 | ||
95 | extern struct irq_domain_ops irq_domain_simple_ops; | 163 | /* stock xlate functions */ |
96 | #endif /* CONFIG_IRQ_DOMAIN */ | 164 | int irq_domain_xlate_onecell(struct irq_domain *d, struct device_node *ctrlr, |
165 | const u32 *intspec, unsigned int intsize, | ||
166 | irq_hw_number_t *out_hwirq, unsigned int *out_type); | ||
167 | int irq_domain_xlate_twocell(struct irq_domain *d, struct device_node *ctrlr, | ||
168 | const u32 *intspec, unsigned int intsize, | ||
169 | irq_hw_number_t *out_hwirq, unsigned int *out_type); | ||
170 | int irq_domain_xlate_onetwocell(struct irq_domain *d, struct device_node *ctrlr, | ||
171 | const u32 *intspec, unsigned int intsize, | ||
172 | irq_hw_number_t *out_hwirq, unsigned int *out_type); | ||
97 | 173 | ||
98 | #if defined(CONFIG_IRQ_DOMAIN) && defined(CONFIG_OF_IRQ) | 174 | #if defined(CONFIG_OF_IRQ) |
99 | extern void irq_domain_add_simple(struct device_node *controller, int irq_base); | ||
100 | extern void irq_domain_generate_simple(const struct of_device_id *match, | 175 | extern void irq_domain_generate_simple(const struct of_device_id *match, |
101 | u64 phys_base, unsigned int irq_start); | 176 | u64 phys_base, unsigned int irq_start); |
102 | #else /* CONFIG_IRQ_DOMAIN && CONFIG_OF_IRQ */ | 177 | #else /* CONFIG_OF_IRQ */ |
103 | static inline void irq_domain_generate_simple(const struct of_device_id *match, | 178 | static inline void irq_domain_generate_simple(const struct of_device_id *match, |
104 | u64 phys_base, unsigned int irq_start) { } | 179 | u64 phys_base, unsigned int irq_start) { } |
105 | #endif /* CONFIG_IRQ_DOMAIN && CONFIG_OF_IRQ */ | 180 | #endif /* !CONFIG_OF_IRQ */ |
181 | |||
182 | #else /* CONFIG_IRQ_DOMAIN */ | ||
183 | static inline void irq_dispose_mapping(unsigned int virq) { } | ||
184 | #endif /* !CONFIG_IRQ_DOMAIN */ | ||
106 | 185 | ||
107 | #endif /* _LINUX_IRQDOMAIN_H */ | 186 | #endif /* _LINUX_IRQDOMAIN_H */ |
diff --git a/include/linux/isdn.h b/include/linux/isdn.h index 4ccf95d681b4..292f27a793d4 100644 --- a/include/linux/isdn.h +++ b/include/linux/isdn.h | |||
@@ -187,7 +187,7 @@ typedef struct { | |||
187 | #endif | 187 | #endif |
188 | 188 | ||
189 | #include <linux/ppp_defs.h> | 189 | #include <linux/ppp_defs.h> |
190 | #include <linux/if_ppp.h> | 190 | #include <linux/ppp-ioctl.h> |
191 | 191 | ||
192 | #include <linux/isdn_ppp.h> | 192 | #include <linux/isdn_ppp.h> |
193 | #endif | 193 | #endif |
diff --git a/include/linux/ivtv.h b/include/linux/ivtv.h index 062d20f74322..42bf725751af 100644 --- a/include/linux/ivtv.h +++ b/include/linux/ivtv.h | |||
@@ -58,7 +58,11 @@ struct ivtv_dma_frame { | |||
58 | __u32 src_height; | 58 | __u32 src_height; |
59 | }; | 59 | }; |
60 | 60 | ||
61 | #define IVTV_IOC_DMA_FRAME _IOW ('V', BASE_VIDIOC_PRIVATE+0, struct ivtv_dma_frame) | 61 | #define IVTV_IOC_DMA_FRAME _IOW ('V', BASE_VIDIOC_PRIVATE+0, struct ivtv_dma_frame) |
62 | |||
63 | /* Select the passthrough mode (if the argument is non-zero). In the passthrough | ||
64 | mode the output of the encoder is passed immediately into the decoder. */ | ||
65 | #define IVTV_IOC_PASSTHROUGH_MODE _IOW ('V', BASE_VIDIOC_PRIVATE+1, int) | ||
62 | 66 | ||
63 | /* Deprecated defines: applications should use the defines from videodev2.h */ | 67 | /* Deprecated defines: applications should use the defines from videodev2.h */ |
64 | #define IVTV_SLICED_TYPE_TELETEXT_B V4L2_MPEG_VBI_IVTV_TELETEXT_B | 68 | #define IVTV_SLICED_TYPE_TELETEXT_B V4L2_MPEG_VBI_IVTV_TELETEXT_B |
diff --git a/include/linux/jbd2.h b/include/linux/jbd2.h index 5557baefed60..912c30a8ddb1 100644 --- a/include/linux/jbd2.h +++ b/include/linux/jbd2.h | |||
@@ -971,6 +971,10 @@ extern void __journal_clean_data_list(transaction_t *transaction); | |||
971 | /* Log buffer allocation */ | 971 | /* Log buffer allocation */ |
972 | extern struct journal_head * jbd2_journal_get_descriptor_buffer(journal_t *); | 972 | extern struct journal_head * jbd2_journal_get_descriptor_buffer(journal_t *); |
973 | int jbd2_journal_next_log_block(journal_t *, unsigned long long *); | 973 | int jbd2_journal_next_log_block(journal_t *, unsigned long long *); |
974 | int jbd2_journal_get_log_tail(journal_t *journal, tid_t *tid, | ||
975 | unsigned long *block); | ||
976 | void __jbd2_update_log_tail(journal_t *journal, tid_t tid, unsigned long block); | ||
977 | void jbd2_update_log_tail(journal_t *journal, tid_t tid, unsigned long block); | ||
974 | 978 | ||
975 | /* Commit management */ | 979 | /* Commit management */ |
976 | extern void jbd2_journal_commit_transaction(journal_t *); | 980 | extern void jbd2_journal_commit_transaction(journal_t *); |
@@ -1020,6 +1024,11 @@ jbd2_journal_write_metadata_buffer(transaction_t *transaction, | |||
1020 | /* Transaction locking */ | 1024 | /* Transaction locking */ |
1021 | extern void __wait_on_journal (journal_t *); | 1025 | extern void __wait_on_journal (journal_t *); |
1022 | 1026 | ||
1027 | /* Transaction cache support */ | ||
1028 | extern void jbd2_journal_destroy_transaction_cache(void); | ||
1029 | extern int jbd2_journal_init_transaction_cache(void); | ||
1030 | extern void jbd2_journal_free_transaction(transaction_t *); | ||
1031 | |||
1023 | /* | 1032 | /* |
1024 | * Journal locking. | 1033 | * Journal locking. |
1025 | * | 1034 | * |
@@ -1082,7 +1091,8 @@ extern int jbd2_journal_destroy (journal_t *); | |||
1082 | extern int jbd2_journal_recover (journal_t *journal); | 1091 | extern int jbd2_journal_recover (journal_t *journal); |
1083 | extern int jbd2_journal_wipe (journal_t *, int); | 1092 | extern int jbd2_journal_wipe (journal_t *, int); |
1084 | extern int jbd2_journal_skip_recovery (journal_t *); | 1093 | extern int jbd2_journal_skip_recovery (journal_t *); |
1085 | extern void jbd2_journal_update_superblock (journal_t *, int); | 1094 | extern void jbd2_journal_update_sb_log_tail (journal_t *, tid_t, |
1095 | unsigned long, int); | ||
1086 | extern void __jbd2_journal_abort_hard (journal_t *); | 1096 | extern void __jbd2_journal_abort_hard (journal_t *); |
1087 | extern void jbd2_journal_abort (journal_t *, int); | 1097 | extern void jbd2_journal_abort (journal_t *, int); |
1088 | extern int jbd2_journal_errno (journal_t *); | 1098 | extern int jbd2_journal_errno (journal_t *); |
diff --git a/include/linux/journal-head.h b/include/linux/journal-head.h index 423cb6d78ee0..c18b46f8aeeb 100644 --- a/include/linux/journal-head.h +++ b/include/linux/journal-head.h | |||
@@ -66,6 +66,8 @@ struct journal_head { | |||
66 | * transaction (if there is one). Only applies to buffers on a | 66 | * transaction (if there is one). Only applies to buffers on a |
67 | * transaction's data or metadata journaling list. | 67 | * transaction's data or metadata journaling list. |
68 | * [j_list_lock] [jbd_lock_bh_state()] | 68 | * [j_list_lock] [jbd_lock_bh_state()] |
69 | * Either of these locks is enough for reading, both are needed for | ||
70 | * changes. | ||
69 | */ | 71 | */ |
70 | transaction_t *b_transaction; | 72 | transaction_t *b_transaction; |
71 | 73 | ||
diff --git a/include/linux/jump_label.h b/include/linux/jump_label.h index 5ce8b140428f..c513a40510f5 100644 --- a/include/linux/jump_label.h +++ b/include/linux/jump_label.h | |||
@@ -1,22 +1,69 @@ | |||
1 | #ifndef _LINUX_JUMP_LABEL_H | 1 | #ifndef _LINUX_JUMP_LABEL_H |
2 | #define _LINUX_JUMP_LABEL_H | 2 | #define _LINUX_JUMP_LABEL_H |
3 | 3 | ||
4 | /* | ||
5 | * Jump label support | ||
6 | * | ||
7 | * Copyright (C) 2009-2012 Jason Baron <jbaron@redhat.com> | ||
8 | * Copyright (C) 2011-2012 Peter Zijlstra <pzijlstr@redhat.com> | ||
9 | * | ||
10 | * Jump labels provide an interface to generate dynamic branches using | ||
11 | * self-modifying code. Assuming toolchain and architecture support the result | ||
12 | * of a "if (static_key_false(&key))" statement is a unconditional branch (which | ||
13 | * defaults to false - and the true block is placed out of line). | ||
14 | * | ||
15 | * However at runtime we can change the branch target using | ||
16 | * static_key_slow_{inc,dec}(). These function as a 'reference' count on the key | ||
17 | * object and for as long as there are references all branches referring to | ||
18 | * that particular key will point to the (out of line) true block. | ||
19 | * | ||
20 | * Since this relies on modifying code the static_key_slow_{inc,dec}() functions | ||
21 | * must be considered absolute slow paths (machine wide synchronization etc.). | ||
22 | * OTOH, since the affected branches are unconditional their runtime overhead | ||
23 | * will be absolutely minimal, esp. in the default (off) case where the total | ||
24 | * effect is a single NOP of appropriate size. The on case will patch in a jump | ||
25 | * to the out-of-line block. | ||
26 | * | ||
27 | * When the control is directly exposed to userspace it is prudent to delay the | ||
28 | * decrement to avoid high frequency code modifications which can (and do) | ||
29 | * cause significant performance degradation. Struct static_key_deferred and | ||
30 | * static_key_slow_dec_deferred() provide for this. | ||
31 | * | ||
32 | * Lacking toolchain and or architecture support, it falls back to a simple | ||
33 | * conditional branch. | ||
34 | * | ||
35 | * struct static_key my_key = STATIC_KEY_INIT_TRUE; | ||
36 | * | ||
37 | * if (static_key_true(&my_key)) { | ||
38 | * } | ||
39 | * | ||
40 | * will result in the true case being in-line and starts the key with a single | ||
41 | * reference. Mixing static_key_true() and static_key_false() on the same key is not | ||
42 | * allowed. | ||
43 | * | ||
44 | * Not initializing the key (static data is initialized to 0s anyway) is the | ||
45 | * same as using STATIC_KEY_INIT_FALSE and static_key_false() is | ||
46 | * equivalent with static_branch(). | ||
47 | * | ||
48 | */ | ||
49 | |||
4 | #include <linux/types.h> | 50 | #include <linux/types.h> |
5 | #include <linux/compiler.h> | 51 | #include <linux/compiler.h> |
6 | #include <linux/workqueue.h> | 52 | #include <linux/workqueue.h> |
7 | 53 | ||
8 | #if defined(CC_HAVE_ASM_GOTO) && defined(CONFIG_JUMP_LABEL) | 54 | #if defined(CC_HAVE_ASM_GOTO) && defined(CONFIG_JUMP_LABEL) |
9 | 55 | ||
10 | struct jump_label_key { | 56 | struct static_key { |
11 | atomic_t enabled; | 57 | atomic_t enabled; |
58 | /* Set lsb bit to 1 if branch is default true, 0 ot */ | ||
12 | struct jump_entry *entries; | 59 | struct jump_entry *entries; |
13 | #ifdef CONFIG_MODULES | 60 | #ifdef CONFIG_MODULES |
14 | struct jump_label_mod *next; | 61 | struct static_key_mod *next; |
15 | #endif | 62 | #endif |
16 | }; | 63 | }; |
17 | 64 | ||
18 | struct jump_label_key_deferred { | 65 | struct static_key_deferred { |
19 | struct jump_label_key key; | 66 | struct static_key key; |
20 | unsigned long timeout; | 67 | unsigned long timeout; |
21 | struct delayed_work work; | 68 | struct delayed_work work; |
22 | }; | 69 | }; |
@@ -34,13 +81,34 @@ struct module; | |||
34 | 81 | ||
35 | #ifdef HAVE_JUMP_LABEL | 82 | #ifdef HAVE_JUMP_LABEL |
36 | 83 | ||
37 | #ifdef CONFIG_MODULES | 84 | #define JUMP_LABEL_TRUE_BRANCH 1UL |
38 | #define JUMP_LABEL_INIT {ATOMIC_INIT(0), NULL, NULL} | 85 | |
39 | #else | 86 | static |
40 | #define JUMP_LABEL_INIT {ATOMIC_INIT(0), NULL} | 87 | inline struct jump_entry *jump_label_get_entries(struct static_key *key) |
41 | #endif | 88 | { |
89 | return (struct jump_entry *)((unsigned long)key->entries | ||
90 | & ~JUMP_LABEL_TRUE_BRANCH); | ||
91 | } | ||
42 | 92 | ||
43 | static __always_inline bool static_branch(struct jump_label_key *key) | 93 | static inline bool jump_label_get_branch_default(struct static_key *key) |
94 | { | ||
95 | if ((unsigned long)key->entries & JUMP_LABEL_TRUE_BRANCH) | ||
96 | return true; | ||
97 | return false; | ||
98 | } | ||
99 | |||
100 | static __always_inline bool static_key_false(struct static_key *key) | ||
101 | { | ||
102 | return arch_static_branch(key); | ||
103 | } | ||
104 | |||
105 | static __always_inline bool static_key_true(struct static_key *key) | ||
106 | { | ||
107 | return !static_key_false(key); | ||
108 | } | ||
109 | |||
110 | /* Deprecated. Please use 'static_key_false() instead. */ | ||
111 | static __always_inline bool static_branch(struct static_key *key) | ||
44 | { | 112 | { |
45 | return arch_static_branch(key); | 113 | return arch_static_branch(key); |
46 | } | 114 | } |
@@ -56,21 +124,23 @@ extern void arch_jump_label_transform(struct jump_entry *entry, | |||
56 | extern void arch_jump_label_transform_static(struct jump_entry *entry, | 124 | extern void arch_jump_label_transform_static(struct jump_entry *entry, |
57 | enum jump_label_type type); | 125 | enum jump_label_type type); |
58 | extern int jump_label_text_reserved(void *start, void *end); | 126 | extern int jump_label_text_reserved(void *start, void *end); |
59 | extern void jump_label_inc(struct jump_label_key *key); | 127 | extern void static_key_slow_inc(struct static_key *key); |
60 | extern void jump_label_dec(struct jump_label_key *key); | 128 | extern void static_key_slow_dec(struct static_key *key); |
61 | extern void jump_label_dec_deferred(struct jump_label_key_deferred *key); | 129 | extern void static_key_slow_dec_deferred(struct static_key_deferred *key); |
62 | extern bool jump_label_enabled(struct jump_label_key *key); | ||
63 | extern void jump_label_apply_nops(struct module *mod); | 130 | extern void jump_label_apply_nops(struct module *mod); |
64 | extern void jump_label_rate_limit(struct jump_label_key_deferred *key, | 131 | extern void |
65 | unsigned long rl); | 132 | jump_label_rate_limit(struct static_key_deferred *key, unsigned long rl); |
133 | |||
134 | #define STATIC_KEY_INIT_TRUE ((struct static_key) \ | ||
135 | { .enabled = ATOMIC_INIT(1), .entries = (void *)1 }) | ||
136 | #define STATIC_KEY_INIT_FALSE ((struct static_key) \ | ||
137 | { .enabled = ATOMIC_INIT(0), .entries = (void *)0 }) | ||
66 | 138 | ||
67 | #else /* !HAVE_JUMP_LABEL */ | 139 | #else /* !HAVE_JUMP_LABEL */ |
68 | 140 | ||
69 | #include <linux/atomic.h> | 141 | #include <linux/atomic.h> |
70 | 142 | ||
71 | #define JUMP_LABEL_INIT {ATOMIC_INIT(0)} | 143 | struct static_key { |
72 | |||
73 | struct jump_label_key { | ||
74 | atomic_t enabled; | 144 | atomic_t enabled; |
75 | }; | 145 | }; |
76 | 146 | ||
@@ -78,30 +148,45 @@ static __always_inline void jump_label_init(void) | |||
78 | { | 148 | { |
79 | } | 149 | } |
80 | 150 | ||
81 | struct jump_label_key_deferred { | 151 | struct static_key_deferred { |
82 | struct jump_label_key key; | 152 | struct static_key key; |
83 | }; | 153 | }; |
84 | 154 | ||
85 | static __always_inline bool static_branch(struct jump_label_key *key) | 155 | static __always_inline bool static_key_false(struct static_key *key) |
156 | { | ||
157 | if (unlikely(atomic_read(&key->enabled)) > 0) | ||
158 | return true; | ||
159 | return false; | ||
160 | } | ||
161 | |||
162 | static __always_inline bool static_key_true(struct static_key *key) | ||
86 | { | 163 | { |
87 | if (unlikely(atomic_read(&key->enabled))) | 164 | if (likely(atomic_read(&key->enabled)) > 0) |
88 | return true; | 165 | return true; |
89 | return false; | 166 | return false; |
90 | } | 167 | } |
91 | 168 | ||
92 | static inline void jump_label_inc(struct jump_label_key *key) | 169 | /* Deprecated. Please use 'static_key_false() instead. */ |
170 | static __always_inline bool static_branch(struct static_key *key) | ||
171 | { | ||
172 | if (unlikely(atomic_read(&key->enabled)) > 0) | ||
173 | return true; | ||
174 | return false; | ||
175 | } | ||
176 | |||
177 | static inline void static_key_slow_inc(struct static_key *key) | ||
93 | { | 178 | { |
94 | atomic_inc(&key->enabled); | 179 | atomic_inc(&key->enabled); |
95 | } | 180 | } |
96 | 181 | ||
97 | static inline void jump_label_dec(struct jump_label_key *key) | 182 | static inline void static_key_slow_dec(struct static_key *key) |
98 | { | 183 | { |
99 | atomic_dec(&key->enabled); | 184 | atomic_dec(&key->enabled); |
100 | } | 185 | } |
101 | 186 | ||
102 | static inline void jump_label_dec_deferred(struct jump_label_key_deferred *key) | 187 | static inline void static_key_slow_dec_deferred(struct static_key_deferred *key) |
103 | { | 188 | { |
104 | jump_label_dec(&key->key); | 189 | static_key_slow_dec(&key->key); |
105 | } | 190 | } |
106 | 191 | ||
107 | static inline int jump_label_text_reserved(void *start, void *end) | 192 | static inline int jump_label_text_reserved(void *start, void *end) |
@@ -112,23 +197,30 @@ static inline int jump_label_text_reserved(void *start, void *end) | |||
112 | static inline void jump_label_lock(void) {} | 197 | static inline void jump_label_lock(void) {} |
113 | static inline void jump_label_unlock(void) {} | 198 | static inline void jump_label_unlock(void) {} |
114 | 199 | ||
115 | static inline bool jump_label_enabled(struct jump_label_key *key) | ||
116 | { | ||
117 | return !!atomic_read(&key->enabled); | ||
118 | } | ||
119 | |||
120 | static inline int jump_label_apply_nops(struct module *mod) | 200 | static inline int jump_label_apply_nops(struct module *mod) |
121 | { | 201 | { |
122 | return 0; | 202 | return 0; |
123 | } | 203 | } |
124 | 204 | ||
125 | static inline void jump_label_rate_limit(struct jump_label_key_deferred *key, | 205 | static inline void |
206 | jump_label_rate_limit(struct static_key_deferred *key, | ||
126 | unsigned long rl) | 207 | unsigned long rl) |
127 | { | 208 | { |
128 | } | 209 | } |
210 | |||
211 | #define STATIC_KEY_INIT_TRUE ((struct static_key) \ | ||
212 | { .enabled = ATOMIC_INIT(1) }) | ||
213 | #define STATIC_KEY_INIT_FALSE ((struct static_key) \ | ||
214 | { .enabled = ATOMIC_INIT(0) }) | ||
215 | |||
129 | #endif /* HAVE_JUMP_LABEL */ | 216 | #endif /* HAVE_JUMP_LABEL */ |
130 | 217 | ||
131 | #define jump_label_key_enabled ((struct jump_label_key){ .enabled = ATOMIC_INIT(1), }) | 218 | #define STATIC_KEY_INIT STATIC_KEY_INIT_FALSE |
132 | #define jump_label_key_disabled ((struct jump_label_key){ .enabled = ATOMIC_INIT(0), }) | 219 | #define jump_label_enabled static_key_enabled |
220 | |||
221 | static inline bool static_key_enabled(struct static_key *key) | ||
222 | { | ||
223 | return (atomic_read(&key->enabled) > 0); | ||
224 | } | ||
133 | 225 | ||
134 | #endif /* _LINUX_JUMP_LABEL_H */ | 226 | #endif /* _LINUX_JUMP_LABEL_H */ |
diff --git a/include/linux/jz4740-adc.h b/include/linux/jz4740-adc.h index 9053f95e9687..8184578fbfa4 100644 --- a/include/linux/jz4740-adc.h +++ b/include/linux/jz4740-adc.h | |||
@@ -2,7 +2,7 @@ | |||
2 | #ifndef __LINUX_JZ4740_ADC | 2 | #ifndef __LINUX_JZ4740_ADC |
3 | #define __LINUX_JZ4740_ADC | 3 | #define __LINUX_JZ4740_ADC |
4 | 4 | ||
5 | #include <linux/device.h> | 5 | struct device; |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * jz4740_adc_set_config - Configure a JZ4740 adc device | 8 | * jz4740_adc_set_config - Configure a JZ4740 adc device |
diff --git a/include/linux/kbd_kern.h b/include/linux/kbd_kern.h index ec2d17bc1f1e..daf4a3a40ee0 100644 --- a/include/linux/kbd_kern.h +++ b/include/linux/kbd_kern.h | |||
@@ -7,8 +7,6 @@ | |||
7 | 7 | ||
8 | extern struct tasklet_struct keyboard_tasklet; | 8 | extern struct tasklet_struct keyboard_tasklet; |
9 | 9 | ||
10 | extern int shift_state; | ||
11 | |||
12 | extern char *func_table[MAX_NR_FUNC]; | 10 | extern char *func_table[MAX_NR_FUNC]; |
13 | extern char func_buf[]; | 11 | extern char func_buf[]; |
14 | extern char *funcbufptr; | 12 | extern char *funcbufptr; |
@@ -65,8 +63,6 @@ struct kbd_struct { | |||
65 | #define VC_META 4 /* 0 - meta, 1 - meta=prefix with ESC */ | 63 | #define VC_META 4 /* 0 - meta, 1 - meta=prefix with ESC */ |
66 | }; | 64 | }; |
67 | 65 | ||
68 | extern struct kbd_struct kbd_table[]; | ||
69 | |||
70 | extern int kbd_init(void); | 66 | extern int kbd_init(void); |
71 | 67 | ||
72 | extern unsigned char getledstate(void); | 68 | extern unsigned char getledstate(void); |
@@ -79,6 +75,7 @@ extern void (*kbd_ledfunc)(unsigned int led); | |||
79 | extern int set_console(int nr); | 75 | extern int set_console(int nr); |
80 | extern void schedule_console_callback(void); | 76 | extern void schedule_console_callback(void); |
81 | 77 | ||
78 | /* FIXME: review locking for vt.c callers */ | ||
82 | static inline void set_leds(void) | 79 | static inline void set_leds(void) |
83 | { | 80 | { |
84 | tasklet_schedule(&keyboard_tasklet); | 81 | tasklet_schedule(&keyboard_tasklet); |
@@ -142,8 +139,6 @@ static inline void chg_vc_kbd_led(struct kbd_struct * kbd, int flag) | |||
142 | 139 | ||
143 | struct console; | 140 | struct console; |
144 | 141 | ||
145 | int getkeycode(unsigned int scancode); | ||
146 | int setkeycode(unsigned int scancode, unsigned int keycode); | ||
147 | void compute_shiftstate(void); | 142 | void compute_shiftstate(void); |
148 | 143 | ||
149 | /* defkeymap.c */ | 144 | /* defkeymap.c */ |
diff --git a/include/linux/kconfig.h b/include/linux/kconfig.h index 067eda0e4b32..be342b94c640 100644 --- a/include/linux/kconfig.h +++ b/include/linux/kconfig.h | |||
@@ -4,29 +4,43 @@ | |||
4 | #include <generated/autoconf.h> | 4 | #include <generated/autoconf.h> |
5 | 5 | ||
6 | /* | 6 | /* |
7 | * Helper macros to use CONFIG_ options in C expressions. Note that | 7 | * Helper macros to use CONFIG_ options in C/CPP expressions. Note that |
8 | * these only work with boolean and tristate options. | 8 | * these only work with boolean and tristate options. |
9 | */ | 9 | */ |
10 | 10 | ||
11 | /* | 11 | /* |
12 | * Getting something that works in C and CPP for an arg that may or may | ||
13 | * not be defined is tricky. Here, if we have "#define CONFIG_BOOGER 1" | ||
14 | * we match on the placeholder define, insert the "0," for arg1 and generate | ||
15 | * the triplet (0, 1, 0). Then the last step cherry picks the 2nd arg (a one). | ||
16 | * When CONFIG_BOOGER is not defined, we generate a (... 1, 0) pair, and when | ||
17 | * the last step cherry picks the 2nd arg, we get a zero. | ||
18 | */ | ||
19 | #define __ARG_PLACEHOLDER_1 0, | ||
20 | #define config_enabled(cfg) _config_enabled(cfg) | ||
21 | #define _config_enabled(value) __config_enabled(__ARG_PLACEHOLDER_##value) | ||
22 | #define __config_enabled(arg1_or_junk) ___config_enabled(arg1_or_junk 1, 0) | ||
23 | #define ___config_enabled(__ignored, val, ...) val | ||
24 | |||
25 | /* | ||
12 | * IS_ENABLED(CONFIG_FOO) evaluates to 1 if CONFIG_FOO is set to 'y' or 'm', | 26 | * IS_ENABLED(CONFIG_FOO) evaluates to 1 if CONFIG_FOO is set to 'y' or 'm', |
13 | * 0 otherwise. | 27 | * 0 otherwise. |
14 | * | 28 | * |
15 | */ | 29 | */ |
16 | #define IS_ENABLED(option) \ | 30 | #define IS_ENABLED(option) \ |
17 | (__enabled_ ## option || __enabled_ ## option ## _MODULE) | 31 | (config_enabled(option) || config_enabled(option##_MODULE)) |
18 | 32 | ||
19 | /* | 33 | /* |
20 | * IS_BUILTIN(CONFIG_FOO) evaluates to 1 if CONFIG_FOO is set to 'y', 0 | 34 | * IS_BUILTIN(CONFIG_FOO) evaluates to 1 if CONFIG_FOO is set to 'y', 0 |
21 | * otherwise. For boolean options, this is equivalent to | 35 | * otherwise. For boolean options, this is equivalent to |
22 | * IS_ENABLED(CONFIG_FOO). | 36 | * IS_ENABLED(CONFIG_FOO). |
23 | */ | 37 | */ |
24 | #define IS_BUILTIN(option) __enabled_ ## option | 38 | #define IS_BUILTIN(option) config_enabled(option) |
25 | 39 | ||
26 | /* | 40 | /* |
27 | * IS_MODULE(CONFIG_FOO) evaluates to 1 if CONFIG_FOO is set to 'm', 0 | 41 | * IS_MODULE(CONFIG_FOO) evaluates to 1 if CONFIG_FOO is set to 'm', 0 |
28 | * otherwise. | 42 | * otherwise. |
29 | */ | 43 | */ |
30 | #define IS_MODULE(option) __enabled_ ## option ## _MODULE | 44 | #define IS_MODULE(option) config_enabled(option##_MODULE) |
31 | 45 | ||
32 | #endif /* __LINUX_KCONFIG_H */ | 46 | #endif /* __LINUX_KCONFIG_H */ |
diff --git a/include/linux/kernel-page-flags.h b/include/linux/kernel-page-flags.h index bd92a89f4b0a..26a65711676f 100644 --- a/include/linux/kernel-page-flags.h +++ b/include/linux/kernel-page-flags.h | |||
@@ -30,6 +30,7 @@ | |||
30 | #define KPF_NOPAGE 20 | 30 | #define KPF_NOPAGE 20 |
31 | 31 | ||
32 | #define KPF_KSM 21 | 32 | #define KPF_KSM 21 |
33 | #define KPF_THP 22 | ||
33 | 34 | ||
34 | /* kernel hacking assistances | 35 | /* kernel hacking assistances |
35 | * WARNING: subject to change, never rely on them! | 36 | * WARNING: subject to change, never rely on them! |
diff --git a/include/linux/kernel.h b/include/linux/kernel.h index e8343422240a..645231c373c8 100644 --- a/include/linux/kernel.h +++ b/include/linux/kernel.h | |||
@@ -1,6 +1,8 @@ | |||
1 | #ifndef _LINUX_KERNEL_H | 1 | #ifndef _LINUX_KERNEL_H |
2 | #define _LINUX_KERNEL_H | 2 | #define _LINUX_KERNEL_H |
3 | 3 | ||
4 | #include <linux/sysinfo.h> | ||
5 | |||
4 | /* | 6 | /* |
5 | * 'kernel.h' contains some often-used function prototypes etc | 7 | * 'kernel.h' contains some often-used function prototypes etc |
6 | */ | 8 | */ |
@@ -20,7 +22,6 @@ | |||
20 | #include <linux/printk.h> | 22 | #include <linux/printk.h> |
21 | #include <linux/dynamic_debug.h> | 23 | #include <linux/dynamic_debug.h> |
22 | #include <asm/byteorder.h> | 24 | #include <asm/byteorder.h> |
23 | #include <asm/bug.h> | ||
24 | 25 | ||
25 | #define USHRT_MAX ((u16)(~0U)) | 26 | #define USHRT_MAX ((u16)(~0U)) |
26 | #define SHRT_MAX ((s16)(USHRT_MAX>>1)) | 27 | #define SHRT_MAX ((s16)(USHRT_MAX>>1)) |
@@ -85,6 +86,19 @@ | |||
85 | } \ | 86 | } \ |
86 | ) | 87 | ) |
87 | 88 | ||
89 | /* | ||
90 | * Multiplies an integer by a fraction, while avoiding unnecessary | ||
91 | * overflow or loss of precision. | ||
92 | */ | ||
93 | #define mult_frac(x, numer, denom)( \ | ||
94 | { \ | ||
95 | typeof(x) quot = (x) / (denom); \ | ||
96 | typeof(x) rem = (x) % (denom); \ | ||
97 | (quot * (numer)) + ((rem * (numer)) / (denom)); \ | ||
98 | } \ | ||
99 | ) | ||
100 | |||
101 | |||
88 | #define _RET_IP_ (unsigned long)__builtin_return_address(0) | 102 | #define _RET_IP_ (unsigned long)__builtin_return_address(0) |
89 | #define _THIS_IP_ ({ __label__ __here; __here: (unsigned long)&&__here; }) | 103 | #define _THIS_IP_ ({ __label__ __here; __here: (unsigned long)&&__here; }) |
90 | 104 | ||
@@ -299,6 +313,8 @@ extern long long simple_strtoll(const char *,char **,unsigned int); | |||
299 | #define strict_strtoull kstrtoull | 313 | #define strict_strtoull kstrtoull |
300 | #define strict_strtoll kstrtoll | 314 | #define strict_strtoll kstrtoll |
301 | 315 | ||
316 | extern int num_to_str(char *buf, int size, unsigned long long num); | ||
317 | |||
302 | /* lib/printf utilities */ | 318 | /* lib/printf utilities */ |
303 | 319 | ||
304 | extern __printf(2, 3) int sprintf(char *buf, const char * fmt, ...); | 320 | extern __printf(2, 3) int sprintf(char *buf, const char * fmt, ...); |
@@ -315,10 +331,10 @@ extern __printf(2, 3) | |||
315 | char *kasprintf(gfp_t gfp, const char *fmt, ...); | 331 | char *kasprintf(gfp_t gfp, const char *fmt, ...); |
316 | extern char *kvasprintf(gfp_t gfp, const char *fmt, va_list args); | 332 | extern char *kvasprintf(gfp_t gfp, const char *fmt, va_list args); |
317 | 333 | ||
318 | extern int sscanf(const char *, const char *, ...) | 334 | extern __scanf(2, 3) |
319 | __attribute__ ((format (scanf, 2, 3))); | 335 | int sscanf(const char *, const char *, ...); |
320 | extern int vsscanf(const char *, const char *, va_list) | 336 | extern __scanf(2, 0) |
321 | __attribute__ ((format (scanf, 2, 0))); | 337 | int vsscanf(const char *, const char *, va_list); |
322 | 338 | ||
323 | extern int get_option(char **str, int *pint); | 339 | extern int get_option(char **str, int *pint); |
324 | extern char *get_options(const char *str, int nints, int *ints); | 340 | extern char *get_options(const char *str, int nints, int *ints); |
@@ -414,16 +430,10 @@ extern int __must_check hex2bin(u8 *dst, const char *src, size_t count); | |||
414 | * Most likely, you want to use tracing_on/tracing_off. | 430 | * Most likely, you want to use tracing_on/tracing_off. |
415 | */ | 431 | */ |
416 | #ifdef CONFIG_RING_BUFFER | 432 | #ifdef CONFIG_RING_BUFFER |
417 | void tracing_on(void); | ||
418 | void tracing_off(void); | ||
419 | /* trace_off_permanent stops recording with no way to bring it back */ | 433 | /* trace_off_permanent stops recording with no way to bring it back */ |
420 | void tracing_off_permanent(void); | 434 | void tracing_off_permanent(void); |
421 | int tracing_is_on(void); | ||
422 | #else | 435 | #else |
423 | static inline void tracing_on(void) { } | ||
424 | static inline void tracing_off(void) { } | ||
425 | static inline void tracing_off_permanent(void) { } | 436 | static inline void tracing_off_permanent(void) { } |
426 | static inline int tracing_is_on(void) { return 0; } | ||
427 | #endif | 437 | #endif |
428 | 438 | ||
429 | enum ftrace_dump_mode { | 439 | enum ftrace_dump_mode { |
@@ -433,6 +443,10 @@ enum ftrace_dump_mode { | |||
433 | }; | 443 | }; |
434 | 444 | ||
435 | #ifdef CONFIG_TRACING | 445 | #ifdef CONFIG_TRACING |
446 | void tracing_on(void); | ||
447 | void tracing_off(void); | ||
448 | int tracing_is_on(void); | ||
449 | |||
436 | extern void tracing_start(void); | 450 | extern void tracing_start(void); |
437 | extern void tracing_stop(void); | 451 | extern void tracing_stop(void); |
438 | extern void ftrace_off_permanent(void); | 452 | extern void ftrace_off_permanent(void); |
@@ -517,6 +531,11 @@ static inline void tracing_start(void) { } | |||
517 | static inline void tracing_stop(void) { } | 531 | static inline void tracing_stop(void) { } |
518 | static inline void ftrace_off_permanent(void) { } | 532 | static inline void ftrace_off_permanent(void) { } |
519 | static inline void trace_dump_stack(void) { } | 533 | static inline void trace_dump_stack(void) { } |
534 | |||
535 | static inline void tracing_on(void) { } | ||
536 | static inline void tracing_off(void) { } | ||
537 | static inline int tracing_is_on(void) { return 0; } | ||
538 | |||
520 | static inline int | 539 | static inline int |
521 | trace_printk(const char *fmt, ...) | 540 | trace_printk(const char *fmt, ...) |
522 | { | 541 | { |
@@ -662,67 +681,6 @@ static inline void ftrace_dump(enum ftrace_dump_mode oops_dump_mode) { } | |||
662 | const typeof( ((type *)0)->member ) *__mptr = (ptr); \ | 681 | const typeof( ((type *)0)->member ) *__mptr = (ptr); \ |
663 | (type *)( (char *)__mptr - offsetof(type,member) );}) | 682 | (type *)( (char *)__mptr - offsetof(type,member) );}) |
664 | 683 | ||
665 | #ifdef __CHECKER__ | ||
666 | #define BUILD_BUG_ON_NOT_POWER_OF_2(n) | ||
667 | #define BUILD_BUG_ON_ZERO(e) (0) | ||
668 | #define BUILD_BUG_ON_NULL(e) ((void*)0) | ||
669 | #define BUILD_BUG_ON(condition) | ||
670 | #define BUILD_BUG() (0) | ||
671 | #else /* __CHECKER__ */ | ||
672 | |||
673 | /* Force a compilation error if a constant expression is not a power of 2 */ | ||
674 | #define BUILD_BUG_ON_NOT_POWER_OF_2(n) \ | ||
675 | BUILD_BUG_ON((n) == 0 || (((n) & ((n) - 1)) != 0)) | ||
676 | |||
677 | /* Force a compilation error if condition is true, but also produce a | ||
678 | result (of value 0 and type size_t), so the expression can be used | ||
679 | e.g. in a structure initializer (or where-ever else comma expressions | ||
680 | aren't permitted). */ | ||
681 | #define BUILD_BUG_ON_ZERO(e) (sizeof(struct { int:-!!(e); })) | ||
682 | #define BUILD_BUG_ON_NULL(e) ((void *)sizeof(struct { int:-!!(e); })) | ||
683 | |||
684 | /** | ||
685 | * BUILD_BUG_ON - break compile if a condition is true. | ||
686 | * @condition: the condition which the compiler should know is false. | ||
687 | * | ||
688 | * If you have some code which relies on certain constants being equal, or | ||
689 | * other compile-time-evaluated condition, you should use BUILD_BUG_ON to | ||
690 | * detect if someone changes it. | ||
691 | * | ||
692 | * The implementation uses gcc's reluctance to create a negative array, but | ||
693 | * gcc (as of 4.4) only emits that error for obvious cases (eg. not arguments | ||
694 | * to inline functions). So as a fallback we use the optimizer; if it can't | ||
695 | * prove the condition is false, it will cause a link error on the undefined | ||
696 | * "__build_bug_on_failed". This error message can be harder to track down | ||
697 | * though, hence the two different methods. | ||
698 | */ | ||
699 | #ifndef __OPTIMIZE__ | ||
700 | #define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)])) | ||
701 | #else | ||
702 | extern int __build_bug_on_failed; | ||
703 | #define BUILD_BUG_ON(condition) \ | ||
704 | do { \ | ||
705 | ((void)sizeof(char[1 - 2*!!(condition)])); \ | ||
706 | if (condition) __build_bug_on_failed = 1; \ | ||
707 | } while(0) | ||
708 | #endif | ||
709 | |||
710 | /** | ||
711 | * BUILD_BUG - break compile if used. | ||
712 | * | ||
713 | * If you have some code that you expect the compiler to eliminate at | ||
714 | * build time, you should use BUILD_BUG to detect if it is | ||
715 | * unexpectedly used. | ||
716 | */ | ||
717 | #define BUILD_BUG() \ | ||
718 | do { \ | ||
719 | extern void __build_bug_failed(void) \ | ||
720 | __linktime_error("BUILD_BUG failed"); \ | ||
721 | __build_bug_failed(); \ | ||
722 | } while (0) | ||
723 | |||
724 | #endif /* __CHECKER__ */ | ||
725 | |||
726 | /* Trap pasters of __FUNCTION__ at compile-time */ | 684 | /* Trap pasters of __FUNCTION__ at compile-time */ |
727 | #define __FUNCTION__ (__func__) | 685 | #define __FUNCTION__ (__func__) |
728 | 686 | ||
@@ -745,27 +703,8 @@ extern int __build_bug_on_failed; | |||
745 | # define REBUILD_DUE_TO_FTRACE_MCOUNT_RECORD | 703 | # define REBUILD_DUE_TO_FTRACE_MCOUNT_RECORD |
746 | #endif | 704 | #endif |
747 | 705 | ||
748 | struct sysinfo; | ||
749 | extern int do_sysinfo(struct sysinfo *info); | 706 | extern int do_sysinfo(struct sysinfo *info); |
750 | 707 | ||
751 | #endif /* __KERNEL__ */ | 708 | #endif /* __KERNEL__ */ |
752 | 709 | ||
753 | #define SI_LOAD_SHIFT 16 | ||
754 | struct sysinfo { | ||
755 | long uptime; /* Seconds since boot */ | ||
756 | unsigned long loads[3]; /* 1, 5, and 15 minute load averages */ | ||
757 | unsigned long totalram; /* Total usable main memory size */ | ||
758 | unsigned long freeram; /* Available memory size */ | ||
759 | unsigned long sharedram; /* Amount of shared memory */ | ||
760 | unsigned long bufferram; /* Memory used by buffers */ | ||
761 | unsigned long totalswap; /* Total swap space size */ | ||
762 | unsigned long freeswap; /* swap space still available */ | ||
763 | unsigned short procs; /* Number of current processes */ | ||
764 | unsigned short pad; /* explicit padding for m68k */ | ||
765 | unsigned long totalhigh; /* Total high memory size */ | ||
766 | unsigned long freehigh; /* Available high memory size */ | ||
767 | unsigned int mem_unit; /* Memory unit size in bytes */ | ||
768 | char _f[20-2*sizeof(long)-sizeof(int)]; /* Padding: libc5 uses this.. */ | ||
769 | }; | ||
770 | |||
771 | #endif | 710 | #endif |
diff --git a/include/linux/key.h b/include/linux/key.h index 5253471cd2ea..96933b1e5d24 100644 --- a/include/linux/key.h +++ b/include/linux/key.h | |||
@@ -155,6 +155,7 @@ struct key { | |||
155 | #define KEY_FLAG_IN_QUOTA 3 /* set if key consumes quota */ | 155 | #define KEY_FLAG_IN_QUOTA 3 /* set if key consumes quota */ |
156 | #define KEY_FLAG_USER_CONSTRUCT 4 /* set if key is being constructed in userspace */ | 156 | #define KEY_FLAG_USER_CONSTRUCT 4 /* set if key is being constructed in userspace */ |
157 | #define KEY_FLAG_NEGATIVE 5 /* set if key is negative */ | 157 | #define KEY_FLAG_NEGATIVE 5 /* set if key is negative */ |
158 | #define KEY_FLAG_ROOT_CAN_CLEAR 6 /* set if key can be cleared by root without permission */ | ||
158 | 159 | ||
159 | /* the description string | 160 | /* the description string |
160 | * - this is used to match a key against search criteria | 161 | * - this is used to match a key against search criteria |
@@ -276,6 +277,8 @@ static inline key_serial_t key_serial(const struct key *key) | |||
276 | return key ? key->serial : 0; | 277 | return key ? key->serial : 0; |
277 | } | 278 | } |
278 | 279 | ||
280 | extern void key_set_timeout(struct key *, unsigned); | ||
281 | |||
279 | /** | 282 | /** |
280 | * key_is_instantiated - Determine if a key has been positively instantiated | 283 | * key_is_instantiated - Determine if a key has been positively instantiated |
281 | * @key: The key to check. | 284 | * @key: The key to check. |
diff --git a/include/linux/keyboard.h b/include/linux/keyboard.h index 33a63f62d57f..86e5214ae735 100644 --- a/include/linux/keyboard.h +++ b/include/linux/keyboard.h | |||
@@ -24,8 +24,6 @@ | |||
24 | 24 | ||
25 | #ifdef __KERNEL__ | 25 | #ifdef __KERNEL__ |
26 | struct notifier_block; | 26 | struct notifier_block; |
27 | extern const int NR_TYPES; | ||
28 | extern const int max_vals[]; | ||
29 | extern unsigned short *key_maps[MAX_NR_KEYMAPS]; | 27 | extern unsigned short *key_maps[MAX_NR_KEYMAPS]; |
30 | extern unsigned short plain_map[NR_KEYS]; | 28 | extern unsigned short plain_map[NR_KEYS]; |
31 | 29 | ||
diff --git a/include/linux/kgdb.h b/include/linux/kgdb.h index fa391835508d..c4d2fc194ede 100644 --- a/include/linux/kgdb.h +++ b/include/linux/kgdb.h | |||
@@ -63,7 +63,8 @@ enum kgdb_bptype { | |||
63 | BP_HARDWARE_BREAKPOINT, | 63 | BP_HARDWARE_BREAKPOINT, |
64 | BP_WRITE_WATCHPOINT, | 64 | BP_WRITE_WATCHPOINT, |
65 | BP_READ_WATCHPOINT, | 65 | BP_READ_WATCHPOINT, |
66 | BP_ACCESS_WATCHPOINT | 66 | BP_ACCESS_WATCHPOINT, |
67 | BP_POKE_BREAKPOINT, | ||
67 | }; | 68 | }; |
68 | 69 | ||
69 | enum kgdb_bpstate { | 70 | enum kgdb_bpstate { |
@@ -207,8 +208,8 @@ extern void kgdb_arch_set_pc(struct pt_regs *regs, unsigned long pc); | |||
207 | 208 | ||
208 | /* Optional functions. */ | 209 | /* Optional functions. */ |
209 | extern int kgdb_validate_break_address(unsigned long addr); | 210 | extern int kgdb_validate_break_address(unsigned long addr); |
210 | extern int kgdb_arch_set_breakpoint(unsigned long addr, char *saved_instr); | 211 | extern int kgdb_arch_set_breakpoint(struct kgdb_bkpt *bpt); |
211 | extern int kgdb_arch_remove_breakpoint(unsigned long addr, char *bundle); | 212 | extern int kgdb_arch_remove_breakpoint(struct kgdb_bkpt *bpt); |
212 | 213 | ||
213 | /** | 214 | /** |
214 | * kgdb_arch_late - Perform any architecture specific initalization. | 215 | * kgdb_arch_late - Perform any architecture specific initalization. |
diff --git a/include/linux/kmod.h b/include/linux/kmod.h index 722f477c4ef7..dd99c329e161 100644 --- a/include/linux/kmod.h +++ b/include/linux/kmod.h | |||
@@ -48,11 +48,10 @@ static inline int request_module_nowait(const char *name, ...) { return -ENOSYS; | |||
48 | struct cred; | 48 | struct cred; |
49 | struct file; | 49 | struct file; |
50 | 50 | ||
51 | enum umh_wait { | 51 | #define UMH_NO_WAIT 0 /* don't wait at all */ |
52 | UMH_NO_WAIT = -1, /* don't wait at all */ | 52 | #define UMH_WAIT_EXEC 1 /* wait for the exec, but not the process */ |
53 | UMH_WAIT_EXEC = 0, /* wait for the exec, but not the process */ | 53 | #define UMH_WAIT_PROC 2 /* wait for the process to complete */ |
54 | UMH_WAIT_PROC = 1, /* wait for the process to complete */ | 54 | #define UMH_KILLABLE 4 /* wait for EXEC/PROC killable */ |
55 | }; | ||
56 | 55 | ||
57 | struct subprocess_info { | 56 | struct subprocess_info { |
58 | struct work_struct work; | 57 | struct work_struct work; |
@@ -60,7 +59,7 @@ struct subprocess_info { | |||
60 | char *path; | 59 | char *path; |
61 | char **argv; | 60 | char **argv; |
62 | char **envp; | 61 | char **envp; |
63 | enum umh_wait wait; | 62 | int wait; |
64 | int retval; | 63 | int retval; |
65 | int (*init)(struct subprocess_info *info, struct cred *new); | 64 | int (*init)(struct subprocess_info *info, struct cred *new); |
66 | void (*cleanup)(struct subprocess_info *info); | 65 | void (*cleanup)(struct subprocess_info *info); |
@@ -78,15 +77,14 @@ void call_usermodehelper_setfns(struct subprocess_info *info, | |||
78 | void *data); | 77 | void *data); |
79 | 78 | ||
80 | /* Actually execute the sub-process */ | 79 | /* Actually execute the sub-process */ |
81 | int call_usermodehelper_exec(struct subprocess_info *info, enum umh_wait wait); | 80 | int call_usermodehelper_exec(struct subprocess_info *info, int wait); |
82 | 81 | ||
83 | /* Free the subprocess_info. This is only needed if you're not going | 82 | /* Free the subprocess_info. This is only needed if you're not going |
84 | to call call_usermodehelper_exec */ | 83 | to call call_usermodehelper_exec */ |
85 | void call_usermodehelper_freeinfo(struct subprocess_info *info); | 84 | void call_usermodehelper_freeinfo(struct subprocess_info *info); |
86 | 85 | ||
87 | static inline int | 86 | static inline int |
88 | call_usermodehelper_fns(char *path, char **argv, char **envp, | 87 | call_usermodehelper_fns(char *path, char **argv, char **envp, int wait, |
89 | enum umh_wait wait, | ||
90 | int (*init)(struct subprocess_info *info, struct cred *new), | 88 | int (*init)(struct subprocess_info *info, struct cred *new), |
91 | void (*cleanup)(struct subprocess_info *), void *data) | 89 | void (*cleanup)(struct subprocess_info *), void *data) |
92 | { | 90 | { |
@@ -104,7 +102,7 @@ call_usermodehelper_fns(char *path, char **argv, char **envp, | |||
104 | } | 102 | } |
105 | 103 | ||
106 | static inline int | 104 | static inline int |
107 | call_usermodehelper(char *path, char **argv, char **envp, enum umh_wait wait) | 105 | call_usermodehelper(char *path, char **argv, char **envp, int wait) |
108 | { | 106 | { |
109 | return call_usermodehelper_fns(path, argv, envp, wait, | 107 | return call_usermodehelper_fns(path, argv, envp, wait, |
110 | NULL, NULL, NULL); | 108 | NULL, NULL, NULL); |
@@ -112,12 +110,29 @@ call_usermodehelper(char *path, char **argv, char **envp, enum umh_wait wait) | |||
112 | 110 | ||
113 | extern struct ctl_table usermodehelper_table[]; | 111 | extern struct ctl_table usermodehelper_table[]; |
114 | 112 | ||
113 | enum umh_disable_depth { | ||
114 | UMH_ENABLED = 0, | ||
115 | UMH_FREEZING, | ||
116 | UMH_DISABLED, | ||
117 | }; | ||
118 | |||
115 | extern void usermodehelper_init(void); | 119 | extern void usermodehelper_init(void); |
116 | 120 | ||
117 | extern int usermodehelper_disable(void); | 121 | extern int __usermodehelper_disable(enum umh_disable_depth depth); |
118 | extern void usermodehelper_enable(void); | 122 | extern void __usermodehelper_set_disable_depth(enum umh_disable_depth depth); |
119 | extern bool usermodehelper_is_disabled(void); | 123 | |
120 | extern void read_lock_usermodehelper(void); | 124 | static inline int usermodehelper_disable(void) |
121 | extern void read_unlock_usermodehelper(void); | 125 | { |
126 | return __usermodehelper_disable(UMH_DISABLED); | ||
127 | } | ||
128 | |||
129 | static inline void usermodehelper_enable(void) | ||
130 | { | ||
131 | __usermodehelper_set_disable_depth(UMH_ENABLED); | ||
132 | } | ||
133 | |||
134 | extern int usermodehelper_read_trylock(void); | ||
135 | extern long usermodehelper_read_lock_wait(long timeout); | ||
136 | extern void usermodehelper_read_unlock(void); | ||
122 | 137 | ||
123 | #endif /* __LINUX_KMOD_H__ */ | 138 | #endif /* __LINUX_KMOD_H__ */ |
diff --git a/include/linux/kmsg_dump.h b/include/linux/kmsg_dump.h index fee66317e071..35f7237ec972 100644 --- a/include/linux/kmsg_dump.h +++ b/include/linux/kmsg_dump.h | |||
@@ -15,13 +15,18 @@ | |||
15 | #include <linux/errno.h> | 15 | #include <linux/errno.h> |
16 | #include <linux/list.h> | 16 | #include <linux/list.h> |
17 | 17 | ||
18 | /* | ||
19 | * Keep this list arranged in rough order of priority. Anything listed after | ||
20 | * KMSG_DUMP_OOPS will not be logged by default unless printk.always_kmsg_dump | ||
21 | * is passed to the kernel. | ||
22 | */ | ||
18 | enum kmsg_dump_reason { | 23 | enum kmsg_dump_reason { |
19 | KMSG_DUMP_OOPS, | ||
20 | KMSG_DUMP_PANIC, | 24 | KMSG_DUMP_PANIC, |
25 | KMSG_DUMP_OOPS, | ||
26 | KMSG_DUMP_EMERG, | ||
21 | KMSG_DUMP_RESTART, | 27 | KMSG_DUMP_RESTART, |
22 | KMSG_DUMP_HALT, | 28 | KMSG_DUMP_HALT, |
23 | KMSG_DUMP_POWEROFF, | 29 | KMSG_DUMP_POWEROFF, |
24 | KMSG_DUMP_EMERG, | ||
25 | }; | 30 | }; |
26 | 31 | ||
27 | /** | 32 | /** |
diff --git a/include/linux/kprobes.h b/include/linux/kprobes.h index dce6e4dbeda7..b6e1f8c00577 100644 --- a/include/linux/kprobes.h +++ b/include/linux/kprobes.h | |||
@@ -33,6 +33,7 @@ | |||
33 | #include <linux/list.h> | 33 | #include <linux/list.h> |
34 | #include <linux/notifier.h> | 34 | #include <linux/notifier.h> |
35 | #include <linux/smp.h> | 35 | #include <linux/smp.h> |
36 | #include <linux/bug.h> | ||
36 | #include <linux/percpu.h> | 37 | #include <linux/percpu.h> |
37 | #include <linux/spinlock.h> | 38 | #include <linux/spinlock.h> |
38 | #include <linux/rcupdate.h> | 39 | #include <linux/rcupdate.h> |
diff --git a/include/linux/kvm.h b/include/linux/kvm.h index 68e67e50d028..6c322a90b92f 100644 --- a/include/linux/kvm.h +++ b/include/linux/kvm.h | |||
@@ -162,6 +162,7 @@ struct kvm_pit_config { | |||
162 | #define KVM_EXIT_INTERNAL_ERROR 17 | 162 | #define KVM_EXIT_INTERNAL_ERROR 17 |
163 | #define KVM_EXIT_OSI 18 | 163 | #define KVM_EXIT_OSI 18 |
164 | #define KVM_EXIT_PAPR_HCALL 19 | 164 | #define KVM_EXIT_PAPR_HCALL 19 |
165 | #define KVM_EXIT_S390_UCONTROL 20 | ||
165 | 166 | ||
166 | /* For KVM_EXIT_INTERNAL_ERROR */ | 167 | /* For KVM_EXIT_INTERNAL_ERROR */ |
167 | #define KVM_INTERNAL_ERROR_EMULATION 1 | 168 | #define KVM_INTERNAL_ERROR_EMULATION 1 |
@@ -249,6 +250,11 @@ struct kvm_run { | |||
249 | #define KVM_S390_RESET_CPU_INIT 8 | 250 | #define KVM_S390_RESET_CPU_INIT 8 |
250 | #define KVM_S390_RESET_IPL 16 | 251 | #define KVM_S390_RESET_IPL 16 |
251 | __u64 s390_reset_flags; | 252 | __u64 s390_reset_flags; |
253 | /* KVM_EXIT_S390_UCONTROL */ | ||
254 | struct { | ||
255 | __u64 trans_exc_code; | ||
256 | __u32 pgm_code; | ||
257 | } s390_ucontrol; | ||
252 | /* KVM_EXIT_DCR */ | 258 | /* KVM_EXIT_DCR */ |
253 | struct { | 259 | struct { |
254 | __u32 dcrn; | 260 | __u32 dcrn; |
@@ -273,6 +279,20 @@ struct kvm_run { | |||
273 | /* Fix the size of the union. */ | 279 | /* Fix the size of the union. */ |
274 | char padding[256]; | 280 | char padding[256]; |
275 | }; | 281 | }; |
282 | |||
283 | /* | ||
284 | * shared registers between kvm and userspace. | ||
285 | * kvm_valid_regs specifies the register classes set by the host | ||
286 | * kvm_dirty_regs specified the register classes dirtied by userspace | ||
287 | * struct kvm_sync_regs is architecture specific, as well as the | ||
288 | * bits for kvm_valid_regs and kvm_dirty_regs | ||
289 | */ | ||
290 | __u64 kvm_valid_regs; | ||
291 | __u64 kvm_dirty_regs; | ||
292 | union { | ||
293 | struct kvm_sync_regs regs; | ||
294 | char padding[1024]; | ||
295 | } s; | ||
276 | }; | 296 | }; |
277 | 297 | ||
278 | /* for KVM_REGISTER_COALESCED_MMIO / KVM_UNREGISTER_COALESCED_MMIO */ | 298 | /* for KVM_REGISTER_COALESCED_MMIO / KVM_UNREGISTER_COALESCED_MMIO */ |
@@ -431,6 +451,11 @@ struct kvm_ppc_pvinfo { | |||
431 | 451 | ||
432 | #define KVMIO 0xAE | 452 | #define KVMIO 0xAE |
433 | 453 | ||
454 | /* machine type bits, to be used as argument to KVM_CREATE_VM */ | ||
455 | #define KVM_VM_S390_UCONTROL 1 | ||
456 | |||
457 | #define KVM_S390_SIE_PAGE_OFFSET 1 | ||
458 | |||
434 | /* | 459 | /* |
435 | * ioctls for /dev/kvm fds: | 460 | * ioctls for /dev/kvm fds: |
436 | */ | 461 | */ |
@@ -555,9 +580,15 @@ struct kvm_ppc_pvinfo { | |||
555 | #define KVM_CAP_PPC_SMT 64 | 580 | #define KVM_CAP_PPC_SMT 64 |
556 | #define KVM_CAP_PPC_RMA 65 | 581 | #define KVM_CAP_PPC_RMA 65 |
557 | #define KVM_CAP_MAX_VCPUS 66 /* returns max vcpus per vm */ | 582 | #define KVM_CAP_MAX_VCPUS 66 /* returns max vcpus per vm */ |
583 | #define KVM_CAP_PPC_HIOR 67 | ||
558 | #define KVM_CAP_PPC_PAPR 68 | 584 | #define KVM_CAP_PPC_PAPR 68 |
585 | #define KVM_CAP_SW_TLB 69 | ||
586 | #define KVM_CAP_ONE_REG 70 | ||
559 | #define KVM_CAP_S390_GMAP 71 | 587 | #define KVM_CAP_S390_GMAP 71 |
560 | #define KVM_CAP_TSC_DEADLINE_TIMER 72 | 588 | #define KVM_CAP_TSC_DEADLINE_TIMER 72 |
589 | #define KVM_CAP_S390_UCONTROL 73 | ||
590 | #define KVM_CAP_SYNC_REGS 74 | ||
591 | #define KVM_CAP_PCI_2_3 75 | ||
561 | 592 | ||
562 | #ifdef KVM_CAP_IRQ_ROUTING | 593 | #ifdef KVM_CAP_IRQ_ROUTING |
563 | 594 | ||
@@ -637,6 +668,52 @@ struct kvm_clock_data { | |||
637 | __u32 pad[9]; | 668 | __u32 pad[9]; |
638 | }; | 669 | }; |
639 | 670 | ||
671 | #define KVM_MMU_FSL_BOOKE_NOHV 0 | ||
672 | #define KVM_MMU_FSL_BOOKE_HV 1 | ||
673 | |||
674 | struct kvm_config_tlb { | ||
675 | __u64 params; | ||
676 | __u64 array; | ||
677 | __u32 mmu_type; | ||
678 | __u32 array_len; | ||
679 | }; | ||
680 | |||
681 | struct kvm_dirty_tlb { | ||
682 | __u64 bitmap; | ||
683 | __u32 num_dirty; | ||
684 | }; | ||
685 | |||
686 | /* Available with KVM_CAP_ONE_REG */ | ||
687 | |||
688 | #define KVM_REG_ARCH_MASK 0xff00000000000000ULL | ||
689 | #define KVM_REG_GENERIC 0x0000000000000000ULL | ||
690 | |||
691 | /* | ||
692 | * Architecture specific registers are to be defined in arch headers and | ||
693 | * ORed with the arch identifier. | ||
694 | */ | ||
695 | #define KVM_REG_PPC 0x1000000000000000ULL | ||
696 | #define KVM_REG_X86 0x2000000000000000ULL | ||
697 | #define KVM_REG_IA64 0x3000000000000000ULL | ||
698 | #define KVM_REG_ARM 0x4000000000000000ULL | ||
699 | #define KVM_REG_S390 0x5000000000000000ULL | ||
700 | |||
701 | #define KVM_REG_SIZE_SHIFT 52 | ||
702 | #define KVM_REG_SIZE_MASK 0x00f0000000000000ULL | ||
703 | #define KVM_REG_SIZE_U8 0x0000000000000000ULL | ||
704 | #define KVM_REG_SIZE_U16 0x0010000000000000ULL | ||
705 | #define KVM_REG_SIZE_U32 0x0020000000000000ULL | ||
706 | #define KVM_REG_SIZE_U64 0x0030000000000000ULL | ||
707 | #define KVM_REG_SIZE_U128 0x0040000000000000ULL | ||
708 | #define KVM_REG_SIZE_U256 0x0050000000000000ULL | ||
709 | #define KVM_REG_SIZE_U512 0x0060000000000000ULL | ||
710 | #define KVM_REG_SIZE_U1024 0x0070000000000000ULL | ||
711 | |||
712 | struct kvm_one_reg { | ||
713 | __u64 id; | ||
714 | __u64 addr; | ||
715 | }; | ||
716 | |||
640 | /* | 717 | /* |
641 | * ioctls for VM fds | 718 | * ioctls for VM fds |
642 | */ | 719 | */ |
@@ -655,6 +732,17 @@ struct kvm_clock_data { | |||
655 | struct kvm_userspace_memory_region) | 732 | struct kvm_userspace_memory_region) |
656 | #define KVM_SET_TSS_ADDR _IO(KVMIO, 0x47) | 733 | #define KVM_SET_TSS_ADDR _IO(KVMIO, 0x47) |
657 | #define KVM_SET_IDENTITY_MAP_ADDR _IOW(KVMIO, 0x48, __u64) | 734 | #define KVM_SET_IDENTITY_MAP_ADDR _IOW(KVMIO, 0x48, __u64) |
735 | |||
736 | /* enable ucontrol for s390 */ | ||
737 | struct kvm_s390_ucas_mapping { | ||
738 | __u64 user_addr; | ||
739 | __u64 vcpu_addr; | ||
740 | __u64 length; | ||
741 | }; | ||
742 | #define KVM_S390_UCAS_MAP _IOW(KVMIO, 0x50, struct kvm_s390_ucas_mapping) | ||
743 | #define KVM_S390_UCAS_UNMAP _IOW(KVMIO, 0x51, struct kvm_s390_ucas_mapping) | ||
744 | #define KVM_S390_VCPU_FAULT _IOW(KVMIO, 0x52, unsigned long) | ||
745 | |||
658 | /* Device model IOC */ | 746 | /* Device model IOC */ |
659 | #define KVM_CREATE_IRQCHIP _IO(KVMIO, 0x60) | 747 | #define KVM_CREATE_IRQCHIP _IO(KVMIO, 0x60) |
660 | #define KVM_IRQ_LINE _IOW(KVMIO, 0x61, struct kvm_irq_level) | 748 | #define KVM_IRQ_LINE _IOW(KVMIO, 0x61, struct kvm_irq_level) |
@@ -697,6 +785,9 @@ struct kvm_clock_data { | |||
697 | /* Available with KVM_CAP_TSC_CONTROL */ | 785 | /* Available with KVM_CAP_TSC_CONTROL */ |
698 | #define KVM_SET_TSC_KHZ _IO(KVMIO, 0xa2) | 786 | #define KVM_SET_TSC_KHZ _IO(KVMIO, 0xa2) |
699 | #define KVM_GET_TSC_KHZ _IO(KVMIO, 0xa3) | 787 | #define KVM_GET_TSC_KHZ _IO(KVMIO, 0xa3) |
788 | /* Available with KVM_CAP_PCI_2_3 */ | ||
789 | #define KVM_ASSIGN_SET_INTX_MASK _IOW(KVMIO, 0xa4, \ | ||
790 | struct kvm_assigned_pci_dev) | ||
700 | 791 | ||
701 | /* | 792 | /* |
702 | * ioctls for vcpu fds | 793 | * ioctls for vcpu fds |
@@ -763,8 +854,15 @@ struct kvm_clock_data { | |||
763 | #define KVM_CREATE_SPAPR_TCE _IOW(KVMIO, 0xa8, struct kvm_create_spapr_tce) | 854 | #define KVM_CREATE_SPAPR_TCE _IOW(KVMIO, 0xa8, struct kvm_create_spapr_tce) |
764 | /* Available with KVM_CAP_RMA */ | 855 | /* Available with KVM_CAP_RMA */ |
765 | #define KVM_ALLOCATE_RMA _IOR(KVMIO, 0xa9, struct kvm_allocate_rma) | 856 | #define KVM_ALLOCATE_RMA _IOR(KVMIO, 0xa9, struct kvm_allocate_rma) |
857 | /* Available with KVM_CAP_SW_TLB */ | ||
858 | #define KVM_DIRTY_TLB _IOW(KVMIO, 0xaa, struct kvm_dirty_tlb) | ||
859 | /* Available with KVM_CAP_ONE_REG */ | ||
860 | #define KVM_GET_ONE_REG _IOW(KVMIO, 0xab, struct kvm_one_reg) | ||
861 | #define KVM_SET_ONE_REG _IOW(KVMIO, 0xac, struct kvm_one_reg) | ||
766 | 862 | ||
767 | #define KVM_DEV_ASSIGN_ENABLE_IOMMU (1 << 0) | 863 | #define KVM_DEV_ASSIGN_ENABLE_IOMMU (1 << 0) |
864 | #define KVM_DEV_ASSIGN_PCI_2_3 (1 << 1) | ||
865 | #define KVM_DEV_ASSIGN_MASK_INTX (1 << 2) | ||
768 | 866 | ||
769 | struct kvm_assigned_pci_dev { | 867 | struct kvm_assigned_pci_dev { |
770 | __u32 assigned_dev_id; | 868 | __u32 assigned_dev_id; |
diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h index 900c76337e8f..72cbf08d45fb 100644 --- a/include/linux/kvm_host.h +++ b/include/linux/kvm_host.h | |||
@@ -13,6 +13,7 @@ | |||
13 | #include <linux/spinlock.h> | 13 | #include <linux/spinlock.h> |
14 | #include <linux/signal.h> | 14 | #include <linux/signal.h> |
15 | #include <linux/sched.h> | 15 | #include <linux/sched.h> |
16 | #include <linux/bug.h> | ||
16 | #include <linux/mm.h> | 17 | #include <linux/mm.h> |
17 | #include <linux/mmu_notifier.h> | 18 | #include <linux/mmu_notifier.h> |
18 | #include <linux/preempt.h> | 19 | #include <linux/preempt.h> |
@@ -171,11 +172,6 @@ static inline int kvm_vcpu_exiting_guest_mode(struct kvm_vcpu *vcpu) | |||
171 | */ | 172 | */ |
172 | #define KVM_MEM_MAX_NR_PAGES ((1UL << 31) - 1) | 173 | #define KVM_MEM_MAX_NR_PAGES ((1UL << 31) - 1) |
173 | 174 | ||
174 | struct kvm_lpage_info { | ||
175 | unsigned long rmap_pde; | ||
176 | int write_count; | ||
177 | }; | ||
178 | |||
179 | struct kvm_memory_slot { | 175 | struct kvm_memory_slot { |
180 | gfn_t base_gfn; | 176 | gfn_t base_gfn; |
181 | unsigned long npages; | 177 | unsigned long npages; |
@@ -184,7 +180,7 @@ struct kvm_memory_slot { | |||
184 | unsigned long *dirty_bitmap; | 180 | unsigned long *dirty_bitmap; |
185 | unsigned long *dirty_bitmap_head; | 181 | unsigned long *dirty_bitmap_head; |
186 | unsigned long nr_dirty_pages; | 182 | unsigned long nr_dirty_pages; |
187 | struct kvm_lpage_info *lpage_info[KVM_NR_PAGE_SIZES - 1]; | 183 | struct kvm_arch_memory_slot arch; |
188 | unsigned long userspace_addr; | 184 | unsigned long userspace_addr; |
189 | int user_alloc; | 185 | int user_alloc; |
190 | int id; | 186 | int id; |
@@ -376,6 +372,9 @@ int kvm_set_memory_region(struct kvm *kvm, | |||
376 | int __kvm_set_memory_region(struct kvm *kvm, | 372 | int __kvm_set_memory_region(struct kvm *kvm, |
377 | struct kvm_userspace_memory_region *mem, | 373 | struct kvm_userspace_memory_region *mem, |
378 | int user_alloc); | 374 | int user_alloc); |
375 | void kvm_arch_free_memslot(struct kvm_memory_slot *free, | ||
376 | struct kvm_memory_slot *dont); | ||
377 | int kvm_arch_create_memslot(struct kvm_memory_slot *slot, unsigned long npages); | ||
379 | int kvm_arch_prepare_memory_region(struct kvm *kvm, | 378 | int kvm_arch_prepare_memory_region(struct kvm *kvm, |
380 | struct kvm_memory_slot *memslot, | 379 | struct kvm_memory_slot *memslot, |
381 | struct kvm_memory_slot old, | 380 | struct kvm_memory_slot old, |
@@ -385,6 +384,7 @@ void kvm_arch_commit_memory_region(struct kvm *kvm, | |||
385 | struct kvm_userspace_memory_region *mem, | 384 | struct kvm_userspace_memory_region *mem, |
386 | struct kvm_memory_slot old, | 385 | struct kvm_memory_slot old, |
387 | int user_alloc); | 386 | int user_alloc); |
387 | bool kvm_largepages_enabled(void); | ||
388 | void kvm_disable_largepages(void); | 388 | void kvm_disable_largepages(void); |
389 | void kvm_arch_flush_shadow(struct kvm *kvm); | 389 | void kvm_arch_flush_shadow(struct kvm *kvm); |
390 | 390 | ||
@@ -450,6 +450,7 @@ long kvm_arch_dev_ioctl(struct file *filp, | |||
450 | unsigned int ioctl, unsigned long arg); | 450 | unsigned int ioctl, unsigned long arg); |
451 | long kvm_arch_vcpu_ioctl(struct file *filp, | 451 | long kvm_arch_vcpu_ioctl(struct file *filp, |
452 | unsigned int ioctl, unsigned long arg); | 452 | unsigned int ioctl, unsigned long arg); |
453 | int kvm_arch_vcpu_fault(struct kvm_vcpu *vcpu, struct vm_fault *vmf); | ||
453 | 454 | ||
454 | int kvm_dev_ioctl_check_extension(long ext); | 455 | int kvm_dev_ioctl_check_extension(long ext); |
455 | 456 | ||
@@ -520,7 +521,7 @@ static inline void kvm_arch_free_vm(struct kvm *kvm) | |||
520 | } | 521 | } |
521 | #endif | 522 | #endif |
522 | 523 | ||
523 | int kvm_arch_init_vm(struct kvm *kvm); | 524 | int kvm_arch_init_vm(struct kvm *kvm, unsigned long type); |
524 | void kvm_arch_destroy_vm(struct kvm *kvm); | 525 | void kvm_arch_destroy_vm(struct kvm *kvm); |
525 | void kvm_free_all_assigned_devices(struct kvm *kvm); | 526 | void kvm_free_all_assigned_devices(struct kvm *kvm); |
526 | void kvm_arch_sync_events(struct kvm *kvm); | 527 | void kvm_arch_sync_events(struct kvm *kvm); |
@@ -546,6 +547,7 @@ struct kvm_assigned_dev_kernel { | |||
546 | unsigned int entries_nr; | 547 | unsigned int entries_nr; |
547 | int host_irq; | 548 | int host_irq; |
548 | bool host_irq_disabled; | 549 | bool host_irq_disabled; |
550 | bool pci_2_3; | ||
549 | struct msix_entry *host_msix_entries; | 551 | struct msix_entry *host_msix_entries; |
550 | int guest_irq; | 552 | int guest_irq; |
551 | struct msix_entry *guest_msix_entries; | 553 | struct msix_entry *guest_msix_entries; |
@@ -555,6 +557,7 @@ struct kvm_assigned_dev_kernel { | |||
555 | struct pci_dev *dev; | 557 | struct pci_dev *dev; |
556 | struct kvm *kvm; | 558 | struct kvm *kvm; |
557 | spinlock_t intx_lock; | 559 | spinlock_t intx_lock; |
560 | spinlock_t intx_mask_lock; | ||
558 | char irq_name[32]; | 561 | char irq_name[32]; |
559 | struct pci_saved_state *pci_saved_state; | 562 | struct pci_saved_state *pci_saved_state; |
560 | }; | 563 | }; |
@@ -593,6 +596,7 @@ void kvm_free_irq_source_id(struct kvm *kvm, int irq_source_id); | |||
593 | 596 | ||
594 | #ifdef CONFIG_IOMMU_API | 597 | #ifdef CONFIG_IOMMU_API |
595 | int kvm_iommu_map_pages(struct kvm *kvm, struct kvm_memory_slot *slot); | 598 | int kvm_iommu_map_pages(struct kvm *kvm, struct kvm_memory_slot *slot); |
599 | void kvm_iommu_unmap_pages(struct kvm *kvm, struct kvm_memory_slot *slot); | ||
596 | int kvm_iommu_map_guest(struct kvm *kvm); | 600 | int kvm_iommu_map_guest(struct kvm *kvm); |
597 | int kvm_iommu_unmap_guest(struct kvm *kvm); | 601 | int kvm_iommu_unmap_guest(struct kvm *kvm); |
598 | int kvm_assign_device(struct kvm *kvm, | 602 | int kvm_assign_device(struct kvm *kvm, |
@@ -606,6 +610,11 @@ static inline int kvm_iommu_map_pages(struct kvm *kvm, | |||
606 | return 0; | 610 | return 0; |
607 | } | 611 | } |
608 | 612 | ||
613 | static inline void kvm_iommu_unmap_pages(struct kvm *kvm, | ||
614 | struct kvm_memory_slot *slot) | ||
615 | { | ||
616 | } | ||
617 | |||
609 | static inline int kvm_iommu_map_guest(struct kvm *kvm) | 618 | static inline int kvm_iommu_map_guest(struct kvm *kvm) |
610 | { | 619 | { |
611 | return -ENODEV; | 620 | return -ENODEV; |
@@ -650,11 +659,43 @@ static inline void kvm_guest_exit(void) | |||
650 | current->flags &= ~PF_VCPU; | 659 | current->flags &= ~PF_VCPU; |
651 | } | 660 | } |
652 | 661 | ||
662 | /* | ||
663 | * search_memslots() and __gfn_to_memslot() are here because they are | ||
664 | * used in non-modular code in arch/powerpc/kvm/book3s_hv_rm_mmu.c. | ||
665 | * gfn_to_memslot() itself isn't here as an inline because that would | ||
666 | * bloat other code too much. | ||
667 | */ | ||
668 | static inline struct kvm_memory_slot * | ||
669 | search_memslots(struct kvm_memslots *slots, gfn_t gfn) | ||
670 | { | ||
671 | struct kvm_memory_slot *memslot; | ||
672 | |||
673 | kvm_for_each_memslot(memslot, slots) | ||
674 | if (gfn >= memslot->base_gfn && | ||
675 | gfn < memslot->base_gfn + memslot->npages) | ||
676 | return memslot; | ||
677 | |||
678 | return NULL; | ||
679 | } | ||
680 | |||
681 | static inline struct kvm_memory_slot * | ||
682 | __gfn_to_memslot(struct kvm_memslots *slots, gfn_t gfn) | ||
683 | { | ||
684 | return search_memslots(slots, gfn); | ||
685 | } | ||
686 | |||
653 | static inline int memslot_id(struct kvm *kvm, gfn_t gfn) | 687 | static inline int memslot_id(struct kvm *kvm, gfn_t gfn) |
654 | { | 688 | { |
655 | return gfn_to_memslot(kvm, gfn)->id; | 689 | return gfn_to_memslot(kvm, gfn)->id; |
656 | } | 690 | } |
657 | 691 | ||
692 | static inline gfn_t gfn_to_index(gfn_t gfn, gfn_t base_gfn, int level) | ||
693 | { | ||
694 | /* KVM_HPAGE_GFN_SHIFT(PT_PAGE_TABLE_LEVEL) must be 0. */ | ||
695 | return (gfn >> KVM_HPAGE_GFN_SHIFT(level)) - | ||
696 | (base_gfn >> KVM_HPAGE_GFN_SHIFT(level)); | ||
697 | } | ||
698 | |||
658 | static inline unsigned long gfn_to_hva_memslot(struct kvm_memory_slot *slot, | 699 | static inline unsigned long gfn_to_hva_memslot(struct kvm_memory_slot *slot, |
659 | gfn_t gfn) | 700 | gfn_t gfn) |
660 | { | 701 | { |
@@ -701,12 +742,16 @@ static inline int mmu_notifier_retry(struct kvm_vcpu *vcpu, unsigned long mmu_se | |||
701 | if (unlikely(vcpu->kvm->mmu_notifier_count)) | 742 | if (unlikely(vcpu->kvm->mmu_notifier_count)) |
702 | return 1; | 743 | return 1; |
703 | /* | 744 | /* |
704 | * Both reads happen under the mmu_lock and both values are | 745 | * Ensure the read of mmu_notifier_count happens before the read |
705 | * modified under mmu_lock, so there's no need of smb_rmb() | 746 | * of mmu_notifier_seq. This interacts with the smp_wmb() in |
706 | * here in between, otherwise mmu_notifier_count should be | 747 | * mmu_notifier_invalidate_range_end to make sure that the caller |
707 | * read before mmu_notifier_seq, see | 748 | * either sees the old (non-zero) value of mmu_notifier_count or |
708 | * mmu_notifier_invalidate_range_end write side. | 749 | * the new (incremented) value of mmu_notifier_seq. |
750 | * PowerPC Book3s HV KVM calls this under a per-page lock | ||
751 | * rather than under kvm->mmu_lock, for scalability, so | ||
752 | * can't rely on kvm->mmu_lock to keep things ordered. | ||
709 | */ | 753 | */ |
754 | smp_rmb(); | ||
710 | if (vcpu->kvm->mmu_notifier_seq != mmu_seq) | 755 | if (vcpu->kvm->mmu_notifier_seq != mmu_seq) |
711 | return 1; | 756 | return 1; |
712 | return 0; | 757 | return 0; |
@@ -769,6 +814,13 @@ static inline bool kvm_vcpu_is_bsp(struct kvm_vcpu *vcpu) | |||
769 | { | 814 | { |
770 | return vcpu->kvm->bsp_vcpu_id == vcpu->vcpu_id; | 815 | return vcpu->kvm->bsp_vcpu_id == vcpu->vcpu_id; |
771 | } | 816 | } |
817 | |||
818 | bool kvm_vcpu_compatible(struct kvm_vcpu *vcpu); | ||
819 | |||
820 | #else | ||
821 | |||
822 | static inline bool kvm_vcpu_compatible(struct kvm_vcpu *vcpu) { return true; } | ||
823 | |||
772 | #endif | 824 | #endif |
773 | 825 | ||
774 | #ifdef __KVM_HAVE_DEVICE_ASSIGNMENT | 826 | #ifdef __KVM_HAVE_DEVICE_ASSIGNMENT |
diff --git a/include/linux/led-lm3530.h b/include/linux/led-lm3530.h index 8eb12357a110..eeae6e742471 100644 --- a/include/linux/led-lm3530.h +++ b/include/linux/led-lm3530.h | |||
@@ -72,6 +72,12 @@ enum lm3530_als_mode { | |||
72 | LM3530_INPUT_CEIL, /* Max of ALS1 and ALS2 */ | 72 | LM3530_INPUT_CEIL, /* Max of ALS1 and ALS2 */ |
73 | }; | 73 | }; |
74 | 74 | ||
75 | /* PWM Platform Specific Data */ | ||
76 | struct lm3530_pwm_data { | ||
77 | void (*pwm_set_intensity) (int brightness, int max_brightness); | ||
78 | int (*pwm_get_intensity) (int max_brightness); | ||
79 | }; | ||
80 | |||
75 | /** | 81 | /** |
76 | * struct lm3530_platform_data | 82 | * struct lm3530_platform_data |
77 | * @mode: mode of operation i.e. Manual, ALS or PWM | 83 | * @mode: mode of operation i.e. Manual, ALS or PWM |
@@ -87,6 +93,7 @@ enum lm3530_als_mode { | |||
87 | * @als_vmin: als input voltage calibrated for max brightness in mV | 93 | * @als_vmin: als input voltage calibrated for max brightness in mV |
88 | * @als_vmax: als input voltage calibrated for min brightness in mV | 94 | * @als_vmax: als input voltage calibrated for min brightness in mV |
89 | * @brt_val: brightness value (0-255) | 95 | * @brt_val: brightness value (0-255) |
96 | * @pwm_data: PWM control functions (only valid when the mode is PWM) | ||
90 | */ | 97 | */ |
91 | struct lm3530_platform_data { | 98 | struct lm3530_platform_data { |
92 | enum lm3530_mode mode; | 99 | enum lm3530_mode mode; |
@@ -107,6 +114,8 @@ struct lm3530_platform_data { | |||
107 | u32 als_vmax; | 114 | u32 als_vmax; |
108 | 115 | ||
109 | u8 brt_val; | 116 | u8 brt_val; |
117 | |||
118 | struct lm3530_pwm_data pwm_data; | ||
110 | }; | 119 | }; |
111 | 120 | ||
112 | #endif /* _LINUX_LED_LM3530_H__ */ | 121 | #endif /* _LINUX_LED_LM3530_H__ */ |
diff --git a/include/linux/leds-lp5521.h b/include/linux/leds-lp5521.h index fd548d2a8775..3f071ec019b2 100644 --- a/include/linux/leds-lp5521.h +++ b/include/linux/leds-lp5521.h | |||
@@ -26,15 +26,37 @@ | |||
26 | /* See Documentation/leds/leds-lp5521.txt */ | 26 | /* See Documentation/leds/leds-lp5521.txt */ |
27 | 27 | ||
28 | struct lp5521_led_config { | 28 | struct lp5521_led_config { |
29 | char *name; | ||
29 | u8 chan_nr; | 30 | u8 chan_nr; |
30 | u8 led_current; /* mA x10, 0 if led is not connected */ | 31 | u8 led_current; /* mA x10, 0 if led is not connected */ |
31 | u8 max_current; | 32 | u8 max_current; |
32 | }; | 33 | }; |
33 | 34 | ||
35 | struct lp5521_led_pattern { | ||
36 | u8 *r; | ||
37 | u8 *g; | ||
38 | u8 *b; | ||
39 | u8 size_r; | ||
40 | u8 size_g; | ||
41 | u8 size_b; | ||
42 | }; | ||
43 | |||
34 | #define LP5521_CLOCK_AUTO 0 | 44 | #define LP5521_CLOCK_AUTO 0 |
35 | #define LP5521_CLOCK_INT 1 | 45 | #define LP5521_CLOCK_INT 1 |
36 | #define LP5521_CLOCK_EXT 2 | 46 | #define LP5521_CLOCK_EXT 2 |
37 | 47 | ||
48 | /* Bits in CONFIG register */ | ||
49 | #define LP5521_PWM_HF 0x40 /* PWM: 0 = 256Hz, 1 = 558Hz */ | ||
50 | #define LP5521_PWRSAVE_EN 0x20 /* 1 = Power save mode */ | ||
51 | #define LP5521_CP_MODE_OFF 0 /* Charge pump (CP) off */ | ||
52 | #define LP5521_CP_MODE_BYPASS 8 /* CP forced to bypass mode */ | ||
53 | #define LP5521_CP_MODE_1X5 0x10 /* CP forced to 1.5x mode */ | ||
54 | #define LP5521_CP_MODE_AUTO 0x18 /* Automatic mode selection */ | ||
55 | #define LP5521_R_TO_BATT 4 /* R out: 0 = CP, 1 = Vbat */ | ||
56 | #define LP5521_CLK_SRC_EXT 0 /* Ext-clk source (CLK_32K) */ | ||
57 | #define LP5521_CLK_INT 1 /* Internal clock */ | ||
58 | #define LP5521_CLK_AUTO 2 /* Automatic clock selection */ | ||
59 | |||
38 | struct lp5521_platform_data { | 60 | struct lp5521_platform_data { |
39 | struct lp5521_led_config *led_config; | 61 | struct lp5521_led_config *led_config; |
40 | u8 num_channels; | 62 | u8 num_channels; |
@@ -43,6 +65,9 @@ struct lp5521_platform_data { | |||
43 | void (*release_resources)(void); | 65 | void (*release_resources)(void); |
44 | void (*enable)(bool state); | 66 | void (*enable)(bool state); |
45 | const char *label; | 67 | const char *label; |
68 | u8 update_config; | ||
69 | struct lp5521_led_pattern *patterns; | ||
70 | int num_patterns; | ||
46 | }; | 71 | }; |
47 | 72 | ||
48 | #endif /* __LINUX_LP5521_H */ | 73 | #endif /* __LINUX_LP5521_H */ |
diff --git a/include/linux/libata.h b/include/linux/libata.h index cafc09a64fe4..42378d637ffb 100644 --- a/include/linux/libata.h +++ b/include/linux/libata.h | |||
@@ -996,6 +996,7 @@ extern int ata_sas_scsi_ioctl(struct ata_port *ap, struct scsi_device *dev, | |||
996 | extern void ata_sas_port_destroy(struct ata_port *); | 996 | extern void ata_sas_port_destroy(struct ata_port *); |
997 | extern struct ata_port *ata_sas_port_alloc(struct ata_host *, | 997 | extern struct ata_port *ata_sas_port_alloc(struct ata_host *, |
998 | struct ata_port_info *, struct Scsi_Host *); | 998 | struct ata_port_info *, struct Scsi_Host *); |
999 | extern int ata_sas_async_port_init(struct ata_port *); | ||
999 | extern int ata_sas_port_init(struct ata_port *); | 1000 | extern int ata_sas_port_init(struct ata_port *); |
1000 | extern int ata_sas_port_start(struct ata_port *ap); | 1001 | extern int ata_sas_port_start(struct ata_port *ap); |
1001 | extern void ata_sas_port_stop(struct ata_port *ap); | 1002 | extern void ata_sas_port_stop(struct ata_port *ap); |
@@ -1147,6 +1148,7 @@ static inline int ata_acpi_cbl_80wire(struct ata_port *ap, | |||
1147 | * EH - drivers/ata/libata-eh.c | 1148 | * EH - drivers/ata/libata-eh.c |
1148 | */ | 1149 | */ |
1149 | extern void ata_port_schedule_eh(struct ata_port *ap); | 1150 | extern void ata_port_schedule_eh(struct ata_port *ap); |
1151 | extern void ata_port_wait_eh(struct ata_port *ap); | ||
1150 | extern int ata_link_abort(struct ata_link *link); | 1152 | extern int ata_link_abort(struct ata_link *link); |
1151 | extern int ata_port_abort(struct ata_port *ap); | 1153 | extern int ata_port_abort(struct ata_port *ap); |
1152 | extern int ata_port_freeze(struct ata_port *ap); | 1154 | extern int ata_port_freeze(struct ata_port *ap); |
diff --git a/include/linux/llist.h b/include/linux/llist.h index 801b44b07aac..a5199f6d0e82 100644 --- a/include/linux/llist.h +++ b/include/linux/llist.h | |||
@@ -56,8 +56,7 @@ | |||
56 | */ | 56 | */ |
57 | 57 | ||
58 | #include <linux/kernel.h> | 58 | #include <linux/kernel.h> |
59 | #include <asm/system.h> | 59 | #include <asm/cmpxchg.h> |
60 | #include <asm/processor.h> | ||
61 | 60 | ||
62 | struct llist_head { | 61 | struct llist_head { |
63 | struct llist_node *first; | 62 | struct llist_node *first; |
diff --git a/include/linux/lockd/bind.h b/include/linux/lockd/bind.h index fbc48f898521..11a966e5f829 100644 --- a/include/linux/lockd/bind.h +++ b/include/linux/lockd/bind.h | |||
@@ -42,6 +42,7 @@ struct nlmclnt_initdata { | |||
42 | unsigned short protocol; | 42 | unsigned short protocol; |
43 | u32 nfs_version; | 43 | u32 nfs_version; |
44 | int noresvport; | 44 | int noresvport; |
45 | struct net *net; | ||
45 | }; | 46 | }; |
46 | 47 | ||
47 | /* | 48 | /* |
diff --git a/include/linux/lockd/lockd.h b/include/linux/lockd/lockd.h index 88a114fce477..f04ce6ac6d04 100644 --- a/include/linux/lockd/lockd.h +++ b/include/linux/lockd/lockd.h | |||
@@ -67,6 +67,7 @@ struct nlm_host { | |||
67 | struct list_head h_reclaim; /* Locks in RECLAIM state */ | 67 | struct list_head h_reclaim; /* Locks in RECLAIM state */ |
68 | struct nsm_handle *h_nsmhandle; /* NSM status handle */ | 68 | struct nsm_handle *h_nsmhandle; /* NSM status handle */ |
69 | char *h_addrbuf; /* address eyecatcher */ | 69 | char *h_addrbuf; /* address eyecatcher */ |
70 | struct net *net; /* host net */ | ||
70 | }; | 71 | }; |
71 | 72 | ||
72 | /* | 73 | /* |
@@ -188,7 +189,7 @@ struct nlm_block { | |||
188 | /* | 189 | /* |
189 | * Global variables | 190 | * Global variables |
190 | */ | 191 | */ |
191 | extern struct rpc_program nlm_program; | 192 | extern const struct rpc_program nlm_program; |
192 | extern struct svc_procedure nlmsvc_procedures[]; | 193 | extern struct svc_procedure nlmsvc_procedures[]; |
193 | #ifdef CONFIG_LOCKD_V4 | 194 | #ifdef CONFIG_LOCKD_V4 |
194 | extern struct svc_procedure nlmsvc_procedures4[]; | 195 | extern struct svc_procedure nlmsvc_procedures4[]; |
@@ -222,7 +223,8 @@ struct nlm_host *nlmclnt_lookup_host(const struct sockaddr *sap, | |||
222 | const unsigned short protocol, | 223 | const unsigned short protocol, |
223 | const u32 version, | 224 | const u32 version, |
224 | const char *hostname, | 225 | const char *hostname, |
225 | int noresvport); | 226 | int noresvport, |
227 | struct net *net); | ||
226 | void nlmclnt_release_host(struct nlm_host *); | 228 | void nlmclnt_release_host(struct nlm_host *); |
227 | struct nlm_host *nlmsvc_lookup_host(const struct svc_rqst *rqstp, | 229 | struct nlm_host *nlmsvc_lookup_host(const struct svc_rqst *rqstp, |
228 | const char *hostname, | 230 | const char *hostname, |
@@ -232,6 +234,7 @@ struct rpc_clnt * nlm_bind_host(struct nlm_host *); | |||
232 | void nlm_rebind_host(struct nlm_host *); | 234 | void nlm_rebind_host(struct nlm_host *); |
233 | struct nlm_host * nlm_get_host(struct nlm_host *); | 235 | struct nlm_host * nlm_get_host(struct nlm_host *); |
234 | void nlm_shutdown_hosts(void); | 236 | void nlm_shutdown_hosts(void); |
237 | void nlm_shutdown_hosts_net(struct net *net); | ||
235 | void nlm_host_rebooted(const struct nlm_reboot *); | 238 | void nlm_host_rebooted(const struct nlm_reboot *); |
236 | 239 | ||
237 | /* | 240 | /* |
diff --git a/include/linux/lockd/xdr4.h b/include/linux/lockd/xdr4.h index 7353821341ed..e58c88b52ce1 100644 --- a/include/linux/lockd/xdr4.h +++ b/include/linux/lockd/xdr4.h | |||
@@ -42,6 +42,6 @@ int nlmclt_encode_lockargs(struct rpc_rqst *, u32 *, struct nlm_args *); | |||
42 | int nlmclt_encode_cancargs(struct rpc_rqst *, u32 *, struct nlm_args *); | 42 | int nlmclt_encode_cancargs(struct rpc_rqst *, u32 *, struct nlm_args *); |
43 | int nlmclt_encode_unlockargs(struct rpc_rqst *, u32 *, struct nlm_args *); | 43 | int nlmclt_encode_unlockargs(struct rpc_rqst *, u32 *, struct nlm_args *); |
44 | */ | 44 | */ |
45 | extern struct rpc_version nlm_version4; | 45 | extern const struct rpc_version nlm_version4; |
46 | 46 | ||
47 | #endif /* LOCKD_XDR4_H */ | 47 | #endif /* LOCKD_XDR4_H */ |
diff --git a/include/linux/lp855x.h b/include/linux/lp855x.h new file mode 100644 index 000000000000..781a490a451b --- /dev/null +++ b/include/linux/lp855x.h | |||
@@ -0,0 +1,131 @@ | |||
1 | /* | ||
2 | * LP855x Backlight Driver | ||
3 | * | ||
4 | * Copyright (C) 2011 Texas Instruments | ||
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 | */ | ||
11 | |||
12 | #ifndef _LP855X_H | ||
13 | #define _LP855X_H | ||
14 | |||
15 | #define BL_CTL_SHFT (0) | ||
16 | #define BRT_MODE_SHFT (1) | ||
17 | #define BRT_MODE_MASK (0x06) | ||
18 | |||
19 | /* Enable backlight. Only valid when BRT_MODE=10(I2C only) */ | ||
20 | #define ENABLE_BL (1) | ||
21 | #define DISABLE_BL (0) | ||
22 | |||
23 | #define I2C_CONFIG(id) id ## _I2C_CONFIG | ||
24 | #define PWM_CONFIG(id) id ## _PWM_CONFIG | ||
25 | |||
26 | /* DEVICE CONTROL register - LP8550 */ | ||
27 | #define LP8550_PWM_CONFIG (LP8550_PWM_ONLY << BRT_MODE_SHFT) | ||
28 | #define LP8550_I2C_CONFIG ((ENABLE_BL << BL_CTL_SHFT) | \ | ||
29 | (LP8550_I2C_ONLY << BRT_MODE_SHFT)) | ||
30 | |||
31 | /* DEVICE CONTROL register - LP8551 */ | ||
32 | #define LP8551_PWM_CONFIG LP8550_PWM_CONFIG | ||
33 | #define LP8551_I2C_CONFIG LP8550_I2C_CONFIG | ||
34 | |||
35 | /* DEVICE CONTROL register - LP8552 */ | ||
36 | #define LP8552_PWM_CONFIG LP8550_PWM_CONFIG | ||
37 | #define LP8552_I2C_CONFIG LP8550_I2C_CONFIG | ||
38 | |||
39 | /* DEVICE CONTROL register - LP8553 */ | ||
40 | #define LP8553_PWM_CONFIG LP8550_PWM_CONFIG | ||
41 | #define LP8553_I2C_CONFIG LP8550_I2C_CONFIG | ||
42 | |||
43 | /* DEVICE CONTROL register - LP8556 */ | ||
44 | #define LP8556_PWM_CONFIG (LP8556_PWM_ONLY << BRT_MODE_SHFT) | ||
45 | #define LP8556_COMB1_CONFIG (LP8556_COMBINED1 << BRT_MODE_SHFT) | ||
46 | #define LP8556_I2C_CONFIG ((ENABLE_BL << BL_CTL_SHFT) | \ | ||
47 | (LP8556_I2C_ONLY << BRT_MODE_SHFT)) | ||
48 | #define LP8556_COMB2_CONFIG (LP8556_COMBINED2 << BRT_MODE_SHFT) | ||
49 | |||
50 | /* ROM area boundary */ | ||
51 | #define EEPROM_START (0xA0) | ||
52 | #define EEPROM_END (0xA7) | ||
53 | #define EPROM_START (0xA0) | ||
54 | #define EPROM_END (0xAF) | ||
55 | |||
56 | enum lp855x_chip_id { | ||
57 | LP8550, | ||
58 | LP8551, | ||
59 | LP8552, | ||
60 | LP8553, | ||
61 | LP8556, | ||
62 | }; | ||
63 | |||
64 | enum lp855x_brightness_ctrl_mode { | ||
65 | PWM_BASED = 1, | ||
66 | REGISTER_BASED, | ||
67 | }; | ||
68 | |||
69 | enum lp8550_brighntess_source { | ||
70 | LP8550_PWM_ONLY, | ||
71 | LP8550_I2C_ONLY = 2, | ||
72 | }; | ||
73 | |||
74 | enum lp8551_brighntess_source { | ||
75 | LP8551_PWM_ONLY = LP8550_PWM_ONLY, | ||
76 | LP8551_I2C_ONLY = LP8550_I2C_ONLY, | ||
77 | }; | ||
78 | |||
79 | enum lp8552_brighntess_source { | ||
80 | LP8552_PWM_ONLY = LP8550_PWM_ONLY, | ||
81 | LP8552_I2C_ONLY = LP8550_I2C_ONLY, | ||
82 | }; | ||
83 | |||
84 | enum lp8553_brighntess_source { | ||
85 | LP8553_PWM_ONLY = LP8550_PWM_ONLY, | ||
86 | LP8553_I2C_ONLY = LP8550_I2C_ONLY, | ||
87 | }; | ||
88 | |||
89 | enum lp8556_brightness_source { | ||
90 | LP8556_PWM_ONLY, | ||
91 | LP8556_COMBINED1, /* pwm + i2c before the shaper block */ | ||
92 | LP8556_I2C_ONLY, | ||
93 | LP8556_COMBINED2, /* pwm + i2c after the shaper block */ | ||
94 | }; | ||
95 | |||
96 | struct lp855x_pwm_data { | ||
97 | void (*pwm_set_intensity) (int brightness, int max_brightness); | ||
98 | int (*pwm_get_intensity) (int max_brightness); | ||
99 | }; | ||
100 | |||
101 | struct lp855x_rom_data { | ||
102 | u8 addr; | ||
103 | u8 val; | ||
104 | }; | ||
105 | |||
106 | /** | ||
107 | * struct lp855x_platform_data | ||
108 | * @name : Backlight driver name. If it is not defined, default name is set. | ||
109 | * @mode : brightness control by pwm or lp855x register | ||
110 | * @device_control : value of DEVICE CONTROL register | ||
111 | * @initial_brightness : initial value of backlight brightness | ||
112 | * @pwm_data : platform specific pwm generation functions. | ||
113 | Only valid when mode is PWM_BASED. | ||
114 | * @load_new_rom_data : | ||
115 | 0 : use default configuration data | ||
116 | 1 : update values of eeprom or eprom registers on loading driver | ||
117 | * @size_program : total size of lp855x_rom_data | ||
118 | * @rom_data : list of new eeprom/eprom registers | ||
119 | */ | ||
120 | struct lp855x_platform_data { | ||
121 | char *name; | ||
122 | enum lp855x_brightness_ctrl_mode mode; | ||
123 | u8 device_control; | ||
124 | int initial_brightness; | ||
125 | struct lp855x_pwm_data pwm_data; | ||
126 | u8 load_new_rom_data; | ||
127 | int size_program; | ||
128 | struct lp855x_rom_data *rom_data; | ||
129 | }; | ||
130 | |||
131 | #endif | ||
diff --git a/include/linux/lp8727.h b/include/linux/lp8727.h index d21fa2865bf4..ea98c6133d32 100644 --- a/include/linux/lp8727.h +++ b/include/linux/lp8727.h | |||
@@ -1,4 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * LP8727 Micro/Mini USB IC with integrated charger | ||
3 | * | ||
4 | * Copyright (C) 2011 Texas Instruments | ||
2 | * Copyright (C) 2011 National Semiconductor | 5 | * Copyright (C) 2011 National Semiconductor |
3 | * | 6 | * |
4 | * This program is free software; you can redistribute it and/or modify | 7 | * This program is free software; you can redistribute it and/or modify |
@@ -32,13 +35,24 @@ enum lp8727_ichg { | |||
32 | ICHG_1000mA, | 35 | ICHG_1000mA, |
33 | }; | 36 | }; |
34 | 37 | ||
38 | /** | ||
39 | * struct lp8727_chg_param | ||
40 | * @eoc_level : end of charge level setting | ||
41 | * @ichg : charging current | ||
42 | */ | ||
35 | struct lp8727_chg_param { | 43 | struct lp8727_chg_param { |
36 | /* end of charge level setting */ | ||
37 | enum lp8727_eoc_level eoc_level; | 44 | enum lp8727_eoc_level eoc_level; |
38 | /* charging current */ | ||
39 | enum lp8727_ichg ichg; | 45 | enum lp8727_ichg ichg; |
40 | }; | 46 | }; |
41 | 47 | ||
48 | /** | ||
49 | * struct lp8727_platform_data | ||
50 | * @get_batt_present : check battery status - exists or not | ||
51 | * @get_batt_level : get battery voltage (mV) | ||
52 | * @get_batt_capacity : get battery capacity (%) | ||
53 | * @get_batt_temp : get battery temperature | ||
54 | * @ac, @usb : charging parameters each charger type | ||
55 | */ | ||
42 | struct lp8727_platform_data { | 56 | struct lp8727_platform_data { |
43 | u8 (*get_batt_present)(void); | 57 | u8 (*get_batt_present)(void); |
44 | u16 (*get_batt_level)(void); | 58 | u16 (*get_batt_level)(void); |
diff --git a/include/linux/lsm_audit.h b/include/linux/lsm_audit.h index 88e78dedc2e8..fad48aab893b 100644 --- a/include/linux/lsm_audit.h +++ b/include/linux/lsm_audit.h | |||
@@ -21,8 +21,24 @@ | |||
21 | #include <linux/path.h> | 21 | #include <linux/path.h> |
22 | #include <linux/key.h> | 22 | #include <linux/key.h> |
23 | #include <linux/skbuff.h> | 23 | #include <linux/skbuff.h> |
24 | #include <asm/system.h> | ||
25 | 24 | ||
25 | struct lsm_network_audit { | ||
26 | int netif; | ||
27 | struct sock *sk; | ||
28 | u16 family; | ||
29 | __be16 dport; | ||
30 | __be16 sport; | ||
31 | union { | ||
32 | struct { | ||
33 | __be32 daddr; | ||
34 | __be32 saddr; | ||
35 | } v4; | ||
36 | struct { | ||
37 | struct in6_addr daddr; | ||
38 | struct in6_addr saddr; | ||
39 | } v6; | ||
40 | } fam; | ||
41 | }; | ||
26 | 42 | ||
27 | /* Auxiliary data to use in generating the audit record. */ | 43 | /* Auxiliary data to use in generating the audit record. */ |
28 | struct common_audit_data { | 44 | struct common_audit_data { |
@@ -42,23 +58,7 @@ struct common_audit_data { | |||
42 | struct path path; | 58 | struct path path; |
43 | struct dentry *dentry; | 59 | struct dentry *dentry; |
44 | struct inode *inode; | 60 | struct inode *inode; |
45 | struct { | 61 | struct lsm_network_audit *net; |
46 | int netif; | ||
47 | struct sock *sk; | ||
48 | u16 family; | ||
49 | __be16 dport; | ||
50 | __be16 sport; | ||
51 | union { | ||
52 | struct { | ||
53 | __be32 daddr; | ||
54 | __be32 saddr; | ||
55 | } v4; | ||
56 | struct { | ||
57 | struct in6_addr daddr; | ||
58 | struct in6_addr saddr; | ||
59 | } v6; | ||
60 | } fam; | ||
61 | } net; | ||
62 | int cap; | 62 | int cap; |
63 | int ipc_id; | 63 | int ipc_id; |
64 | struct task_struct *tsk; | 64 | struct task_struct *tsk; |
@@ -73,64 +73,15 @@ struct common_audit_data { | |||
73 | /* this union contains LSM specific data */ | 73 | /* this union contains LSM specific data */ |
74 | union { | 74 | union { |
75 | #ifdef CONFIG_SECURITY_SMACK | 75 | #ifdef CONFIG_SECURITY_SMACK |
76 | /* SMACK data */ | 76 | struct smack_audit_data *smack_audit_data; |
77 | struct smack_audit_data { | ||
78 | const char *function; | ||
79 | char *subject; | ||
80 | char *object; | ||
81 | char *request; | ||
82 | int result; | ||
83 | } smack_audit_data; | ||
84 | #endif | 77 | #endif |
85 | #ifdef CONFIG_SECURITY_SELINUX | 78 | #ifdef CONFIG_SECURITY_SELINUX |
86 | /* SELinux data */ | 79 | struct selinux_audit_data *selinux_audit_data; |
87 | struct { | ||
88 | u32 ssid; | ||
89 | u32 tsid; | ||
90 | u16 tclass; | ||
91 | u32 requested; | ||
92 | u32 audited; | ||
93 | u32 denied; | ||
94 | /* | ||
95 | * auditdeny is a bit tricky and unintuitive. See the | ||
96 | * comments in avc.c for it's meaning and usage. | ||
97 | */ | ||
98 | u32 auditdeny; | ||
99 | struct av_decision *avd; | ||
100 | int result; | ||
101 | } selinux_audit_data; | ||
102 | #endif | 80 | #endif |
103 | #ifdef CONFIG_SECURITY_APPARMOR | 81 | #ifdef CONFIG_SECURITY_APPARMOR |
104 | struct { | 82 | struct apparmor_audit_data *apparmor_audit_data; |
105 | int error; | ||
106 | int op; | ||
107 | int type; | ||
108 | void *profile; | ||
109 | const char *name; | ||
110 | const char *info; | ||
111 | union { | ||
112 | void *target; | ||
113 | struct { | ||
114 | long pos; | ||
115 | void *target; | ||
116 | } iface; | ||
117 | struct { | ||
118 | int rlim; | ||
119 | unsigned long max; | ||
120 | } rlim; | ||
121 | struct { | ||
122 | const char *target; | ||
123 | u32 request; | ||
124 | u32 denied; | ||
125 | uid_t ouid; | ||
126 | } fs; | ||
127 | }; | ||
128 | } apparmor_audit_data; | ||
129 | #endif | 83 | #endif |
130 | }; | 84 | }; /* per LSM data pointer union */ |
131 | /* these callback will be implemented by a specific LSM */ | ||
132 | void (*lsm_pre_audit)(struct audit_buffer *, void *); | ||
133 | void (*lsm_post_audit)(struct audit_buffer *, void *); | ||
134 | }; | 85 | }; |
135 | 86 | ||
136 | #define v4info fam.v4 | 87 | #define v4info fam.v4 |
@@ -147,6 +98,8 @@ int ipv6_skb_to_auditdata(struct sk_buff *skb, | |||
147 | { memset((_d), 0, sizeof(struct common_audit_data)); \ | 98 | { memset((_d), 0, sizeof(struct common_audit_data)); \ |
148 | (_d)->type = LSM_AUDIT_DATA_##_t; } | 99 | (_d)->type = LSM_AUDIT_DATA_##_t; } |
149 | 100 | ||
150 | void common_lsm_audit(struct common_audit_data *a); | 101 | void common_lsm_audit(struct common_audit_data *a, |
102 | void (*pre_audit)(struct audit_buffer *, void *), | ||
103 | void (*post_audit)(struct audit_buffer *, void *)); | ||
151 | 104 | ||
152 | #endif | 105 | #endif |
diff --git a/include/linux/magic.h b/include/linux/magic.h index 2d4beab0d5b7..e15192cb9cf4 100644 --- a/include/linux/magic.h +++ b/include/linux/magic.h | |||
@@ -9,7 +9,6 @@ | |||
9 | #define CRAMFS_MAGIC 0x28cd3d45 /* some random number */ | 9 | #define CRAMFS_MAGIC 0x28cd3d45 /* some random number */ |
10 | #define CRAMFS_MAGIC_WEND 0x453dcd28 /* magic number with the wrong endianess */ | 10 | #define CRAMFS_MAGIC_WEND 0x453dcd28 /* magic number with the wrong endianess */ |
11 | #define DEBUGFS_MAGIC 0x64626720 | 11 | #define DEBUGFS_MAGIC 0x64626720 |
12 | #define SYSFS_MAGIC 0x62656572 | ||
13 | #define SECURITYFS_MAGIC 0x73636673 | 12 | #define SECURITYFS_MAGIC 0x73636673 |
14 | #define SELINUX_MAGIC 0xf97cff8c | 13 | #define SELINUX_MAGIC 0xf97cff8c |
15 | #define RAMFS_MAGIC 0x858458f6 /* some random number */ | 14 | #define RAMFS_MAGIC 0x858458f6 /* some random number */ |
@@ -27,7 +26,6 @@ | |||
27 | #define HPFS_SUPER_MAGIC 0xf995e849 | 26 | #define HPFS_SUPER_MAGIC 0xf995e849 |
28 | #define ISOFS_SUPER_MAGIC 0x9660 | 27 | #define ISOFS_SUPER_MAGIC 0x9660 |
29 | #define JFFS2_SUPER_MAGIC 0x72b6 | 28 | #define JFFS2_SUPER_MAGIC 0x72b6 |
30 | #define ANON_INODE_FS_MAGIC 0x09041934 | ||
31 | #define PSTOREFS_MAGIC 0x6165676C | 29 | #define PSTOREFS_MAGIC 0x6165676C |
32 | 30 | ||
33 | #define MINIX_SUPER_MAGIC 0x137F /* minix v1 fs, 14 char names */ | 31 | #define MINIX_SUPER_MAGIC 0x137F /* minix v1 fs, 14 char names */ |
@@ -40,8 +38,8 @@ | |||
40 | #define NCP_SUPER_MAGIC 0x564c /* Guess, what 0x564c is :-) */ | 38 | #define NCP_SUPER_MAGIC 0x564c /* Guess, what 0x564c is :-) */ |
41 | #define NFS_SUPER_MAGIC 0x6969 | 39 | #define NFS_SUPER_MAGIC 0x6969 |
42 | #define OPENPROM_SUPER_MAGIC 0x9fa1 | 40 | #define OPENPROM_SUPER_MAGIC 0x9fa1 |
43 | #define PROC_SUPER_MAGIC 0x9fa0 | ||
44 | #define QNX4_SUPER_MAGIC 0x002f /* qnx4 fs detection */ | 41 | #define QNX4_SUPER_MAGIC 0x002f /* qnx4 fs detection */ |
42 | #define QNX6_SUPER_MAGIC 0x68191122 /* qnx6 fs detection */ | ||
45 | 43 | ||
46 | #define REISERFS_SUPER_MAGIC 0x52654973 /* used by gcc */ | 44 | #define REISERFS_SUPER_MAGIC 0x52654973 /* used by gcc */ |
47 | /* used by file system utilities that | 45 | /* used by file system utilities that |
@@ -51,15 +49,24 @@ | |||
51 | #define REISER2FS_JR_SUPER_MAGIC_STRING "ReIsEr3Fs" | 49 | #define REISER2FS_JR_SUPER_MAGIC_STRING "ReIsEr3Fs" |
52 | 50 | ||
53 | #define SMB_SUPER_MAGIC 0x517B | 51 | #define SMB_SUPER_MAGIC 0x517B |
54 | #define USBDEVICE_SUPER_MAGIC 0x9fa2 | ||
55 | #define CGROUP_SUPER_MAGIC 0x27e0eb | 52 | #define CGROUP_SUPER_MAGIC 0x27e0eb |
56 | 53 | ||
57 | #define FUTEXFS_SUPER_MAGIC 0xBAD1DEA | ||
58 | 54 | ||
59 | #define STACK_END_MAGIC 0x57AC6E9D | 55 | #define STACK_END_MAGIC 0x57AC6E9D |
60 | 56 | ||
57 | #define V9FS_MAGIC 0x01021997 | ||
58 | |||
59 | #define BDEVFS_MAGIC 0x62646576 | ||
60 | #define BINFMTFS_MAGIC 0x42494e4d | ||
61 | #define DEVPTS_SUPER_MAGIC 0x1cd1 | 61 | #define DEVPTS_SUPER_MAGIC 0x1cd1 |
62 | #define FUTEXFS_SUPER_MAGIC 0xBAD1DEA | ||
63 | #define PIPEFS_MAGIC 0x50495045 | ||
64 | #define PROC_SUPER_MAGIC 0x9fa0 | ||
62 | #define SOCKFS_MAGIC 0x534F434B | 65 | #define SOCKFS_MAGIC 0x534F434B |
63 | #define V9FS_MAGIC 0x01021997 | 66 | #define SYSFS_MAGIC 0x62656572 |
67 | #define USBDEVICE_SUPER_MAGIC 0x9fa2 | ||
68 | #define MTD_INODE_FS_MAGIC 0x11307854 | ||
69 | #define ANON_INODE_FS_MAGIC 0x09041934 | ||
70 | |||
64 | 71 | ||
65 | #endif /* __LINUX_MAGIC_H__ */ | 72 | #endif /* __LINUX_MAGIC_H__ */ |
diff --git a/include/linux/maple.h b/include/linux/maple.h index d9a51b9b3300..c37288b23e0c 100644 --- a/include/linux/maple.h +++ b/include/linux/maple.h | |||
@@ -1,9 +1,9 @@ | |||
1 | #ifndef __LINUX_MAPLE_H | 1 | #ifndef __LINUX_MAPLE_H |
2 | #define __LINUX_MAPLE_H | 2 | #define __LINUX_MAPLE_H |
3 | 3 | ||
4 | #include <linux/device.h> | ||
5 | #include <mach/maple.h> | 4 | #include <mach/maple.h> |
6 | 5 | ||
6 | struct device; | ||
7 | extern struct bus_type maple_bus_type; | 7 | extern struct bus_type maple_bus_type; |
8 | 8 | ||
9 | /* Maple Bus command and response codes */ | 9 | /* Maple Bus command and response codes */ |
diff --git a/include/linux/math64.h b/include/linux/math64.h index 23fcdfcba81b..b8ba85544721 100644 --- a/include/linux/math64.h +++ b/include/linux/math64.h | |||
@@ -6,6 +6,8 @@ | |||
6 | 6 | ||
7 | #if BITS_PER_LONG == 64 | 7 | #if BITS_PER_LONG == 64 |
8 | 8 | ||
9 | #define div64_long(x,y) div64_s64((x),(y)) | ||
10 | |||
9 | /** | 11 | /** |
10 | * div_u64_rem - unsigned 64bit divide with 32bit divisor with remainder | 12 | * div_u64_rem - unsigned 64bit divide with 32bit divisor with remainder |
11 | * | 13 | * |
@@ -45,6 +47,8 @@ static inline s64 div64_s64(s64 dividend, s64 divisor) | |||
45 | 47 | ||
46 | #elif BITS_PER_LONG == 32 | 48 | #elif BITS_PER_LONG == 32 |
47 | 49 | ||
50 | #define div64_long(x,y) div_s64((x),(y)) | ||
51 | |||
48 | #ifndef div_u64_rem | 52 | #ifndef div_u64_rem |
49 | static inline u64 div_u64_rem(u64 dividend, u32 divisor, u32 *remainder) | 53 | static inline u64 div_u64_rem(u64 dividend, u32 divisor, u32 *remainder) |
50 | { | 54 | { |
diff --git a/include/linux/mdio.h b/include/linux/mdio.h index b1494aced217..dfb947959ec9 100644 --- a/include/linux/mdio.h +++ b/include/linux/mdio.h | |||
@@ -10,6 +10,7 @@ | |||
10 | #ifndef __LINUX_MDIO_H__ | 10 | #ifndef __LINUX_MDIO_H__ |
11 | #define __LINUX_MDIO_H__ | 11 | #define __LINUX_MDIO_H__ |
12 | 12 | ||
13 | #include <linux/types.h> | ||
13 | #include <linux/mii.h> | 14 | #include <linux/mii.h> |
14 | 15 | ||
15 | /* MDIO Manageable Devices (MMDs). */ | 16 | /* MDIO Manageable Devices (MMDs). */ |
@@ -273,6 +274,8 @@ static inline __u16 mdio_phy_id_c45(int prtad, int devad) | |||
273 | return MDIO_PHY_ID_C45 | (prtad << 5) | devad; | 274 | return MDIO_PHY_ID_C45 | (prtad << 5) | devad; |
274 | } | 275 | } |
275 | 276 | ||
277 | #ifdef __KERNEL__ | ||
278 | |||
276 | static inline bool mdio_phy_id_is_c45(int phy_id) | 279 | static inline bool mdio_phy_id_is_c45(int phy_id) |
277 | { | 280 | { |
278 | return (phy_id & MDIO_PHY_ID_C45) && !(phy_id & ~MDIO_PHY_ID_C45_MASK); | 281 | return (phy_id & MDIO_PHY_ID_C45) && !(phy_id & ~MDIO_PHY_ID_C45_MASK); |
@@ -288,11 +291,6 @@ static inline __u16 mdio_phy_id_devad(int phy_id) | |||
288 | return phy_id & MDIO_PHY_ID_DEVAD; | 291 | return phy_id & MDIO_PHY_ID_DEVAD; |
289 | } | 292 | } |
290 | 293 | ||
291 | #define MDIO_SUPPORTS_C22 1 | ||
292 | #define MDIO_SUPPORTS_C45 2 | ||
293 | |||
294 | #ifdef __KERNEL__ | ||
295 | |||
296 | /** | 294 | /** |
297 | * struct mdio_if_info - Ethernet controller MDIO interface | 295 | * struct mdio_if_info - Ethernet controller MDIO interface |
298 | * @prtad: PRTAD of the PHY (%MDIO_PRTAD_NONE if not present/unknown) | 296 | * @prtad: PRTAD of the PHY (%MDIO_PRTAD_NONE if not present/unknown) |
@@ -321,6 +319,8 @@ struct mdio_if_info { | |||
321 | 319 | ||
322 | #define MDIO_PRTAD_NONE (-1) | 320 | #define MDIO_PRTAD_NONE (-1) |
323 | #define MDIO_DEVAD_NONE (-1) | 321 | #define MDIO_DEVAD_NONE (-1) |
322 | #define MDIO_SUPPORTS_C22 1 | ||
323 | #define MDIO_SUPPORTS_C45 2 | ||
324 | #define MDIO_EMULATE_C22 4 | 324 | #define MDIO_EMULATE_C22 4 |
325 | 325 | ||
326 | struct ethtool_cmd; | 326 | struct ethtool_cmd; |
diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h index 4d34356fe644..f94efd2f6c27 100644 --- a/include/linux/memcontrol.h +++ b/include/linux/memcontrol.h | |||
@@ -77,7 +77,8 @@ extern void mem_cgroup_uncharge_end(void); | |||
77 | extern void mem_cgroup_uncharge_page(struct page *page); | 77 | extern void mem_cgroup_uncharge_page(struct page *page); |
78 | extern void mem_cgroup_uncharge_cache_page(struct page *page); | 78 | extern void mem_cgroup_uncharge_cache_page(struct page *page); |
79 | 79 | ||
80 | extern void mem_cgroup_out_of_memory(struct mem_cgroup *memcg, gfp_t gfp_mask); | 80 | extern void mem_cgroup_out_of_memory(struct mem_cgroup *memcg, gfp_t gfp_mask, |
81 | int order); | ||
81 | int task_in_mem_cgroup(struct task_struct *task, const struct mem_cgroup *memcg); | 82 | int task_in_mem_cgroup(struct task_struct *task, const struct mem_cgroup *memcg); |
82 | 83 | ||
83 | extern struct mem_cgroup *try_get_mem_cgroup_from_page(struct page *page); | 84 | extern struct mem_cgroup *try_get_mem_cgroup_from_page(struct page *page); |
@@ -129,7 +130,6 @@ extern void mem_cgroup_print_oom_info(struct mem_cgroup *memcg, | |||
129 | extern void mem_cgroup_replace_page_cache(struct page *oldpage, | 130 | extern void mem_cgroup_replace_page_cache(struct page *oldpage, |
130 | struct page *newpage); | 131 | struct page *newpage); |
131 | 132 | ||
132 | extern void mem_cgroup_reset_owner(struct page *page); | ||
133 | #ifdef CONFIG_CGROUP_MEM_RES_CTLR_SWAP | 133 | #ifdef CONFIG_CGROUP_MEM_RES_CTLR_SWAP |
134 | extern int do_swap_account; | 134 | extern int do_swap_account; |
135 | #endif | 135 | #endif |
@@ -141,6 +141,34 @@ static inline bool mem_cgroup_disabled(void) | |||
141 | return false; | 141 | return false; |
142 | } | 142 | } |
143 | 143 | ||
144 | void __mem_cgroup_begin_update_page_stat(struct page *page, bool *locked, | ||
145 | unsigned long *flags); | ||
146 | |||
147 | extern atomic_t memcg_moving; | ||
148 | |||
149 | static inline void mem_cgroup_begin_update_page_stat(struct page *page, | ||
150 | bool *locked, unsigned long *flags) | ||
151 | { | ||
152 | if (mem_cgroup_disabled()) | ||
153 | return; | ||
154 | rcu_read_lock(); | ||
155 | *locked = false; | ||
156 | if (atomic_read(&memcg_moving)) | ||
157 | __mem_cgroup_begin_update_page_stat(page, locked, flags); | ||
158 | } | ||
159 | |||
160 | void __mem_cgroup_end_update_page_stat(struct page *page, | ||
161 | unsigned long *flags); | ||
162 | static inline void mem_cgroup_end_update_page_stat(struct page *page, | ||
163 | bool *locked, unsigned long *flags) | ||
164 | { | ||
165 | if (mem_cgroup_disabled()) | ||
166 | return; | ||
167 | if (*locked) | ||
168 | __mem_cgroup_end_update_page_stat(page, flags); | ||
169 | rcu_read_unlock(); | ||
170 | } | ||
171 | |||
144 | void mem_cgroup_update_page_stat(struct page *page, | 172 | void mem_cgroup_update_page_stat(struct page *page, |
145 | enum mem_cgroup_page_stat_item idx, | 173 | enum mem_cgroup_page_stat_item idx, |
146 | int val); | 174 | int val); |
@@ -299,21 +327,6 @@ static inline void mem_cgroup_iter_break(struct mem_cgroup *root, | |||
299 | { | 327 | { |
300 | } | 328 | } |
301 | 329 | ||
302 | static inline int mem_cgroup_get_reclaim_priority(struct mem_cgroup *memcg) | ||
303 | { | ||
304 | return 0; | ||
305 | } | ||
306 | |||
307 | static inline void mem_cgroup_note_reclaim_priority(struct mem_cgroup *memcg, | ||
308 | int priority) | ||
309 | { | ||
310 | } | ||
311 | |||
312 | static inline void mem_cgroup_record_reclaim_priority(struct mem_cgroup *memcg, | ||
313 | int priority) | ||
314 | { | ||
315 | } | ||
316 | |||
317 | static inline bool mem_cgroup_disabled(void) | 330 | static inline bool mem_cgroup_disabled(void) |
318 | { | 331 | { |
319 | return true; | 332 | return true; |
@@ -356,6 +369,16 @@ mem_cgroup_print_oom_info(struct mem_cgroup *memcg, struct task_struct *p) | |||
356 | { | 369 | { |
357 | } | 370 | } |
358 | 371 | ||
372 | static inline void mem_cgroup_begin_update_page_stat(struct page *page, | ||
373 | bool *locked, unsigned long *flags) | ||
374 | { | ||
375 | } | ||
376 | |||
377 | static inline void mem_cgroup_end_update_page_stat(struct page *page, | ||
378 | bool *locked, unsigned long *flags) | ||
379 | { | ||
380 | } | ||
381 | |||
359 | static inline void mem_cgroup_inc_page_stat(struct page *page, | 382 | static inline void mem_cgroup_inc_page_stat(struct page *page, |
360 | enum mem_cgroup_page_stat_item idx) | 383 | enum mem_cgroup_page_stat_item idx) |
361 | { | 384 | { |
@@ -392,11 +415,7 @@ static inline void mem_cgroup_replace_page_cache(struct page *oldpage, | |||
392 | struct page *newpage) | 415 | struct page *newpage) |
393 | { | 416 | { |
394 | } | 417 | } |
395 | 418 | #endif /* CONFIG_CGROUP_MEM_RES_CTLR */ | |
396 | static inline void mem_cgroup_reset_owner(struct page *page) | ||
397 | { | ||
398 | } | ||
399 | #endif /* CONFIG_CGROUP_MEM_CONT */ | ||
400 | 419 | ||
401 | #if !defined(CONFIG_CGROUP_MEM_RES_CTLR) || !defined(CONFIG_DEBUG_VM) | 420 | #if !defined(CONFIG_CGROUP_MEM_RES_CTLR) || !defined(CONFIG_DEBUG_VM) |
402 | static inline bool | 421 | static inline bool |
diff --git a/include/linux/memory_hotplug.h b/include/linux/memory_hotplug.h index 0b8e2a742600..910550f3b70e 100644 --- a/include/linux/memory_hotplug.h +++ b/include/linux/memory_hotplug.h | |||
@@ -4,6 +4,7 @@ | |||
4 | #include <linux/mmzone.h> | 4 | #include <linux/mmzone.h> |
5 | #include <linux/spinlock.h> | 5 | #include <linux/spinlock.h> |
6 | #include <linux/notifier.h> | 6 | #include <linux/notifier.h> |
7 | #include <linux/bug.h> | ||
7 | 8 | ||
8 | struct page; | 9 | struct page; |
9 | struct zone; | 10 | struct zone; |
diff --git a/include/linux/mfd/88pm860x.h b/include/linux/mfd/88pm860x.h index 92be3476c9f5..84d071ade1d8 100644 --- a/include/linux/mfd/88pm860x.h +++ b/include/linux/mfd/88pm860x.h | |||
@@ -263,6 +263,22 @@ enum { | |||
263 | #define PM8607_PD_PREBIAS_MASK (0x1F << 0) | 263 | #define PM8607_PD_PREBIAS_MASK (0x1F << 0) |
264 | #define PM8607_PD_PRECHG_MASK (7 << 5) | 264 | #define PM8607_PD_PRECHG_MASK (7 << 5) |
265 | 265 | ||
266 | #define PM8606_REF_GP_OSC_OFF 0 | ||
267 | #define PM8606_REF_GP_OSC_ON 1 | ||
268 | #define PM8606_REF_GP_OSC_UNKNOWN 2 | ||
269 | |||
270 | /* Clients of reference group and 8MHz oscillator in 88PM8606 */ | ||
271 | enum pm8606_ref_gp_and_osc_clients { | ||
272 | REF_GP_NO_CLIENTS = 0, | ||
273 | WLED1_DUTY = (1<<0), /*PF 0x02.7:0*/ | ||
274 | WLED2_DUTY = (1<<1), /*PF 0x04.7:0*/ | ||
275 | WLED3_DUTY = (1<<2), /*PF 0x06.7:0*/ | ||
276 | RGB1_ENABLE = (1<<3), /*PF 0x07.1*/ | ||
277 | RGB2_ENABLE = (1<<4), /*PF 0x07.2*/ | ||
278 | LDO_VBR_EN = (1<<5), /*PF 0x12.0*/ | ||
279 | REF_GP_MAX_CLIENT = 0xFFFF | ||
280 | }; | ||
281 | |||
266 | /* Interrupt Number in 88PM8607 */ | 282 | /* Interrupt Number in 88PM8607 */ |
267 | enum { | 283 | enum { |
268 | PM8607_IRQ_ONKEY, | 284 | PM8607_IRQ_ONKEY, |
@@ -298,6 +314,7 @@ enum { | |||
298 | struct pm860x_chip { | 314 | struct pm860x_chip { |
299 | struct device *dev; | 315 | struct device *dev; |
300 | struct mutex irq_lock; | 316 | struct mutex irq_lock; |
317 | struct mutex osc_lock; | ||
301 | struct i2c_client *client; | 318 | struct i2c_client *client; |
302 | struct i2c_client *companion; /* companion chip client */ | 319 | struct i2c_client *companion; /* companion chip client */ |
303 | struct regmap *regmap; | 320 | struct regmap *regmap; |
@@ -305,12 +322,15 @@ struct pm860x_chip { | |||
305 | 322 | ||
306 | int buck3_double; /* DVC ramp slope double */ | 323 | int buck3_double; /* DVC ramp slope double */ |
307 | unsigned short companion_addr; | 324 | unsigned short companion_addr; |
325 | unsigned short osc_vote; | ||
308 | int id; | 326 | int id; |
309 | int irq_mode; | 327 | int irq_mode; |
310 | int irq_base; | 328 | int irq_base; |
311 | int core_irq; | 329 | int core_irq; |
312 | unsigned char chip_version; | 330 | unsigned char chip_version; |
331 | unsigned char osc_status; | ||
313 | 332 | ||
333 | unsigned int wakeup_flag; | ||
314 | }; | 334 | }; |
315 | 335 | ||
316 | enum { | 336 | enum { |
@@ -369,6 +389,9 @@ struct pm860x_platform_data { | |||
369 | int num_regulators; | 389 | int num_regulators; |
370 | }; | 390 | }; |
371 | 391 | ||
392 | extern int pm8606_osc_enable(struct pm860x_chip *, unsigned short); | ||
393 | extern int pm8606_osc_disable(struct pm860x_chip *, unsigned short); | ||
394 | |||
372 | extern int pm860x_reg_read(struct i2c_client *, int); | 395 | extern int pm860x_reg_read(struct i2c_client *, int); |
373 | extern int pm860x_reg_write(struct i2c_client *, int, unsigned char); | 396 | extern int pm860x_reg_write(struct i2c_client *, int, unsigned char); |
374 | extern int pm860x_bulk_read(struct i2c_client *, int, int, unsigned char *); | 397 | extern int pm860x_bulk_read(struct i2c_client *, int, int, unsigned char *); |
diff --git a/include/linux/mfd/abx500.h b/include/linux/mfd/abx500.h index 9970337ff041..ee96cd51d8b2 100644 --- a/include/linux/mfd/abx500.h +++ b/include/linux/mfd/abx500.h | |||
@@ -14,9 +14,10 @@ | |||
14 | * Author: Rickard Andersson <rickard.andersson@stericsson.com> | 14 | * Author: Rickard Andersson <rickard.andersson@stericsson.com> |
15 | */ | 15 | */ |
16 | 16 | ||
17 | #include <linux/device.h> | ||
18 | #include <linux/regulator/machine.h> | 17 | #include <linux/regulator/machine.h> |
19 | 18 | ||
19 | struct device; | ||
20 | |||
20 | #ifndef MFD_ABX500_H | 21 | #ifndef MFD_ABX500_H |
21 | #define MFD_ABX500_H | 22 | #define MFD_ABX500_H |
22 | 23 | ||
@@ -33,13 +34,6 @@ | |||
33 | #define AB5500_1_1 0x21 | 34 | #define AB5500_1_1 0x21 |
34 | #define AB5500_2_0 0x24 | 35 | #define AB5500_2_0 0x24 |
35 | 36 | ||
36 | /* AB8500 CIDs*/ | ||
37 | #define AB8500_CUT1P0 0x10 | ||
38 | #define AB8500_CUT1P1 0x11 | ||
39 | #define AB8500_CUT2P0 0x20 | ||
40 | #define AB8500_CUT3P0 0x30 | ||
41 | #define AB8500_CUT3P3 0x33 | ||
42 | |||
43 | /* | 37 | /* |
44 | * AB3100, EVENTA1, A2 and A3 event register flags | 38 | * AB3100, EVENTA1, A2 and A3 event register flags |
45 | * these are catenated into a single 32-bit flag in the code | 39 | * these are catenated into a single 32-bit flag in the code |
@@ -152,6 +146,279 @@ struct abx500_init_settings { | |||
152 | u8 setting; | 146 | u8 setting; |
153 | }; | 147 | }; |
154 | 148 | ||
149 | /* Battery driver related data */ | ||
150 | /* | ||
151 | * ADC for the battery thermistor. | ||
152 | * When using the ABx500_ADC_THERM_BATCTRL the battery ID resistor is combined | ||
153 | * with a NTC resistor to both identify the battery and to measure its | ||
154 | * temperature. Different phone manufactures uses different techniques to both | ||
155 | * identify the battery and to read its temperature. | ||
156 | */ | ||
157 | enum abx500_adc_therm { | ||
158 | ABx500_ADC_THERM_BATCTRL, | ||
159 | ABx500_ADC_THERM_BATTEMP, | ||
160 | }; | ||
161 | |||
162 | /** | ||
163 | * struct abx500_res_to_temp - defines one point in a temp to res curve. To | ||
164 | * be used in battery packs that combines the identification resistor with a | ||
165 | * NTC resistor. | ||
166 | * @temp: battery pack temperature in Celcius | ||
167 | * @resist: NTC resistor net total resistance | ||
168 | */ | ||
169 | struct abx500_res_to_temp { | ||
170 | int temp; | ||
171 | int resist; | ||
172 | }; | ||
173 | |||
174 | /** | ||
175 | * struct abx500_v_to_cap - Table for translating voltage to capacity | ||
176 | * @voltage: Voltage in mV | ||
177 | * @capacity: Capacity in percent | ||
178 | */ | ||
179 | struct abx500_v_to_cap { | ||
180 | int voltage; | ||
181 | int capacity; | ||
182 | }; | ||
183 | |||
184 | /* Forward declaration */ | ||
185 | struct abx500_fg; | ||
186 | |||
187 | /** | ||
188 | * struct abx500_fg_parameters - Fuel gauge algorithm parameters, in seconds | ||
189 | * if not specified | ||
190 | * @recovery_sleep_timer: Time between measurements while recovering | ||
191 | * @recovery_total_time: Total recovery time | ||
192 | * @init_timer: Measurement interval during startup | ||
193 | * @init_discard_time: Time we discard voltage measurement at startup | ||
194 | * @init_total_time: Total init time during startup | ||
195 | * @high_curr_time: Time current has to be high to go to recovery | ||
196 | * @accu_charging: FG accumulation time while charging | ||
197 | * @accu_high_curr: FG accumulation time in high current mode | ||
198 | * @high_curr_threshold: High current threshold, in mA | ||
199 | * @lowbat_threshold: Low battery threshold, in mV | ||
200 | * @overbat_threshold: Over battery threshold, in mV | ||
201 | * @battok_falling_th_sel0 Threshold in mV for battOk signal sel0 | ||
202 | * Resolution in 50 mV step. | ||
203 | * @battok_raising_th_sel1 Threshold in mV for battOk signal sel1 | ||
204 | * Resolution in 50 mV step. | ||
205 | * @user_cap_limit Capacity reported from user must be within this | ||
206 | * limit to be considered as sane, in percentage | ||
207 | * points. | ||
208 | * @maint_thres This is the threshold where we stop reporting | ||
209 | * battery full while in maintenance, in per cent | ||
210 | */ | ||
211 | struct abx500_fg_parameters { | ||
212 | int recovery_sleep_timer; | ||
213 | int recovery_total_time; | ||
214 | int init_timer; | ||
215 | int init_discard_time; | ||
216 | int init_total_time; | ||
217 | int high_curr_time; | ||
218 | int accu_charging; | ||
219 | int accu_high_curr; | ||
220 | int high_curr_threshold; | ||
221 | int lowbat_threshold; | ||
222 | int overbat_threshold; | ||
223 | int battok_falling_th_sel0; | ||
224 | int battok_raising_th_sel1; | ||
225 | int user_cap_limit; | ||
226 | int maint_thres; | ||
227 | }; | ||
228 | |||
229 | /** | ||
230 | * struct abx500_charger_maximization - struct used by the board config. | ||
231 | * @use_maxi: Enable maximization for this battery type | ||
232 | * @maxi_chg_curr: Maximum charger current allowed | ||
233 | * @maxi_wait_cycles: cycles to wait before setting charger current | ||
234 | * @charger_curr_step delta between two charger current settings (mA) | ||
235 | */ | ||
236 | struct abx500_maxim_parameters { | ||
237 | bool ena_maxi; | ||
238 | int chg_curr; | ||
239 | int wait_cycles; | ||
240 | int charger_curr_step; | ||
241 | }; | ||
242 | |||
243 | /** | ||
244 | * struct abx500_battery_type - different batteries supported | ||
245 | * @name: battery technology | ||
246 | * @resis_high: battery upper resistance limit | ||
247 | * @resis_low: battery lower resistance limit | ||
248 | * @charge_full_design: Maximum battery capacity in mAh | ||
249 | * @nominal_voltage: Nominal voltage of the battery in mV | ||
250 | * @termination_vol: max voltage upto which battery can be charged | ||
251 | * @termination_curr battery charging termination current in mA | ||
252 | * @recharge_vol battery voltage limit that will trigger a new | ||
253 | * full charging cycle in the case where maintenan- | ||
254 | * -ce charging has been disabled | ||
255 | * @normal_cur_lvl: charger current in normal state in mA | ||
256 | * @normal_vol_lvl: charger voltage in normal state in mV | ||
257 | * @maint_a_cur_lvl: charger current in maintenance A state in mA | ||
258 | * @maint_a_vol_lvl: charger voltage in maintenance A state in mV | ||
259 | * @maint_a_chg_timer_h: charge time in maintenance A state | ||
260 | * @maint_b_cur_lvl: charger current in maintenance B state in mA | ||
261 | * @maint_b_vol_lvl: charger voltage in maintenance B state in mV | ||
262 | * @maint_b_chg_timer_h: charge time in maintenance B state | ||
263 | * @low_high_cur_lvl: charger current in temp low/high state in mA | ||
264 | * @low_high_vol_lvl: charger voltage in temp low/high state in mV' | ||
265 | * @battery_resistance: battery inner resistance in mOhm. | ||
266 | * @n_r_t_tbl_elements: number of elements in r_to_t_tbl | ||
267 | * @r_to_t_tbl: table containing resistance to temp points | ||
268 | * @n_v_cap_tbl_elements: number of elements in v_to_cap_tbl | ||
269 | * @v_to_cap_tbl: Voltage to capacity (in %) table | ||
270 | * @n_batres_tbl_elements number of elements in the batres_tbl | ||
271 | * @batres_tbl battery internal resistance vs temperature table | ||
272 | */ | ||
273 | struct abx500_battery_type { | ||
274 | int name; | ||
275 | int resis_high; | ||
276 | int resis_low; | ||
277 | int charge_full_design; | ||
278 | int nominal_voltage; | ||
279 | int termination_vol; | ||
280 | int termination_curr; | ||
281 | int recharge_vol; | ||
282 | int normal_cur_lvl; | ||
283 | int normal_vol_lvl; | ||
284 | int maint_a_cur_lvl; | ||
285 | int maint_a_vol_lvl; | ||
286 | int maint_a_chg_timer_h; | ||
287 | int maint_b_cur_lvl; | ||
288 | int maint_b_vol_lvl; | ||
289 | int maint_b_chg_timer_h; | ||
290 | int low_high_cur_lvl; | ||
291 | int low_high_vol_lvl; | ||
292 | int battery_resistance; | ||
293 | int n_temp_tbl_elements; | ||
294 | struct abx500_res_to_temp *r_to_t_tbl; | ||
295 | int n_v_cap_tbl_elements; | ||
296 | struct abx500_v_to_cap *v_to_cap_tbl; | ||
297 | int n_batres_tbl_elements; | ||
298 | struct batres_vs_temp *batres_tbl; | ||
299 | }; | ||
300 | |||
301 | /** | ||
302 | * struct abx500_bm_capacity_levels - abx500 capacity level data | ||
303 | * @critical: critical capacity level in percent | ||
304 | * @low: low capacity level in percent | ||
305 | * @normal: normal capacity level in percent | ||
306 | * @high: high capacity level in percent | ||
307 | * @full: full capacity level in percent | ||
308 | */ | ||
309 | struct abx500_bm_capacity_levels { | ||
310 | int critical; | ||
311 | int low; | ||
312 | int normal; | ||
313 | int high; | ||
314 | int full; | ||
315 | }; | ||
316 | |||
317 | /** | ||
318 | * struct abx500_bm_charger_parameters - Charger specific parameters | ||
319 | * @usb_volt_max: maximum allowed USB charger voltage in mV | ||
320 | * @usb_curr_max: maximum allowed USB charger current in mA | ||
321 | * @ac_volt_max: maximum allowed AC charger voltage in mV | ||
322 | * @ac_curr_max: maximum allowed AC charger current in mA | ||
323 | */ | ||
324 | struct abx500_bm_charger_parameters { | ||
325 | int usb_volt_max; | ||
326 | int usb_curr_max; | ||
327 | int ac_volt_max; | ||
328 | int ac_curr_max; | ||
329 | }; | ||
330 | |||
331 | /** | ||
332 | * struct abx500_bm_data - abx500 battery management data | ||
333 | * @temp_under under this temp, charging is stopped | ||
334 | * @temp_low between this temp and temp_under charging is reduced | ||
335 | * @temp_high between this temp and temp_over charging is reduced | ||
336 | * @temp_over over this temp, charging is stopped | ||
337 | * @temp_now present battery temperature | ||
338 | * @temp_interval_chg temperature measurement interval in s when charging | ||
339 | * @temp_interval_nochg temperature measurement interval in s when not charging | ||
340 | * @main_safety_tmr_h safety timer for main charger | ||
341 | * @usb_safety_tmr_h safety timer for usb charger | ||
342 | * @bkup_bat_v voltage which we charge the backup battery with | ||
343 | * @bkup_bat_i current which we charge the backup battery with | ||
344 | * @no_maintenance indicates that maintenance charging is disabled | ||
345 | * @abx500_adc_therm placement of thermistor, batctrl or battemp adc | ||
346 | * @chg_unknown_bat flag to enable charging of unknown batteries | ||
347 | * @enable_overshoot flag to enable VBAT overshoot control | ||
348 | * @auto_trig flag to enable auto adc trigger | ||
349 | * @fg_res resistance of FG resistor in 0.1mOhm | ||
350 | * @n_btypes number of elements in array bat_type | ||
351 | * @batt_id index of the identified battery in array bat_type | ||
352 | * @interval_charging charge alg cycle period time when charging (sec) | ||
353 | * @interval_not_charging charge alg cycle period time when not charging (sec) | ||
354 | * @temp_hysteresis temperature hysteresis | ||
355 | * @gnd_lift_resistance Battery ground to phone ground resistance (mOhm) | ||
356 | * @maxi: maximization parameters | ||
357 | * @cap_levels capacity in percent for the different capacity levels | ||
358 | * @bat_type table of supported battery types | ||
359 | * @chg_params charger parameters | ||
360 | * @fg_params fuel gauge parameters | ||
361 | */ | ||
362 | struct abx500_bm_data { | ||
363 | int temp_under; | ||
364 | int temp_low; | ||
365 | int temp_high; | ||
366 | int temp_over; | ||
367 | int temp_now; | ||
368 | int temp_interval_chg; | ||
369 | int temp_interval_nochg; | ||
370 | int main_safety_tmr_h; | ||
371 | int usb_safety_tmr_h; | ||
372 | int bkup_bat_v; | ||
373 | int bkup_bat_i; | ||
374 | bool no_maintenance; | ||
375 | bool chg_unknown_bat; | ||
376 | bool enable_overshoot; | ||
377 | bool auto_trig; | ||
378 | enum abx500_adc_therm adc_therm; | ||
379 | int fg_res; | ||
380 | int n_btypes; | ||
381 | int batt_id; | ||
382 | int interval_charging; | ||
383 | int interval_not_charging; | ||
384 | int temp_hysteresis; | ||
385 | int gnd_lift_resistance; | ||
386 | const struct abx500_maxim_parameters *maxi; | ||
387 | const struct abx500_bm_capacity_levels *cap_levels; | ||
388 | const struct abx500_battery_type *bat_type; | ||
389 | const struct abx500_bm_charger_parameters *chg_params; | ||
390 | const struct abx500_fg_parameters *fg_params; | ||
391 | }; | ||
392 | |||
393 | struct abx500_chargalg_platform_data { | ||
394 | char **supplied_to; | ||
395 | size_t num_supplicants; | ||
396 | }; | ||
397 | |||
398 | struct abx500_charger_platform_data { | ||
399 | char **supplied_to; | ||
400 | size_t num_supplicants; | ||
401 | bool autopower_cfg; | ||
402 | }; | ||
403 | |||
404 | struct abx500_btemp_platform_data { | ||
405 | char **supplied_to; | ||
406 | size_t num_supplicants; | ||
407 | }; | ||
408 | |||
409 | struct abx500_fg_platform_data { | ||
410 | char **supplied_to; | ||
411 | size_t num_supplicants; | ||
412 | }; | ||
413 | |||
414 | struct abx500_bm_plat_data { | ||
415 | struct abx500_bm_data *battery; | ||
416 | struct abx500_charger_platform_data *charger; | ||
417 | struct abx500_btemp_platform_data *btemp; | ||
418 | struct abx500_fg_platform_data *fg; | ||
419 | struct abx500_chargalg_platform_data *chargalg; | ||
420 | }; | ||
421 | |||
155 | int abx500_set_register_interruptible(struct device *dev, u8 bank, u8 reg, | 422 | int abx500_set_register_interruptible(struct device *dev, u8 bank, u8 reg, |
156 | u8 value); | 423 | u8 value); |
157 | int abx500_get_register_interruptible(struct device *dev, u8 bank, u8 reg, | 424 | int abx500_get_register_interruptible(struct device *dev, u8 bank, u8 reg, |
diff --git a/include/linux/mfd/abx500/ab5500.h b/include/linux/mfd/abx500/ab5500.h index a720051ae933..54f820ed73bb 100644 --- a/include/linux/mfd/abx500/ab5500.h +++ b/include/linux/mfd/abx500/ab5500.h | |||
@@ -6,7 +6,7 @@ | |||
6 | #ifndef MFD_AB5500_H | 6 | #ifndef MFD_AB5500_H |
7 | #define MFD_AB5500_H | 7 | #define MFD_AB5500_H |
8 | 8 | ||
9 | #include <linux/device.h> | 9 | struct device; |
10 | 10 | ||
11 | enum ab5500_devid { | 11 | enum ab5500_devid { |
12 | AB5500_DEVID_ADC, | 12 | AB5500_DEVID_ADC, |
diff --git a/include/linux/mfd/abx500/ab8500-bm.h b/include/linux/mfd/abx500/ab8500-bm.h new file mode 100644 index 000000000000..44310c98ee6e --- /dev/null +++ b/include/linux/mfd/abx500/ab8500-bm.h | |||
@@ -0,0 +1,474 @@ | |||
1 | /* | ||
2 | * Copyright ST-Ericsson 2012. | ||
3 | * | ||
4 | * Author: Arun Murthy <arun.murthy@stericsson.com> | ||
5 | * Licensed under GPLv2. | ||
6 | */ | ||
7 | |||
8 | #ifndef _AB8500_BM_H | ||
9 | #define _AB8500_BM_H | ||
10 | |||
11 | #include <linux/kernel.h> | ||
12 | #include <linux/mfd/abx500.h> | ||
13 | |||
14 | /* | ||
15 | * System control 2 register offsets. | ||
16 | * bank = 0x02 | ||
17 | */ | ||
18 | #define AB8500_MAIN_WDOG_CTRL_REG 0x01 | ||
19 | #define AB8500_LOW_BAT_REG 0x03 | ||
20 | #define AB8500_BATT_OK_REG 0x04 | ||
21 | /* | ||
22 | * USB/ULPI register offsets | ||
23 | * Bank : 0x5 | ||
24 | */ | ||
25 | #define AB8500_USB_LINE_STAT_REG 0x80 | ||
26 | |||
27 | /* | ||
28 | * Charger / status register offfsets | ||
29 | * Bank : 0x0B | ||
30 | */ | ||
31 | #define AB8500_CH_STATUS1_REG 0x00 | ||
32 | #define AB8500_CH_STATUS2_REG 0x01 | ||
33 | #define AB8500_CH_USBCH_STAT1_REG 0x02 | ||
34 | #define AB8500_CH_USBCH_STAT2_REG 0x03 | ||
35 | #define AB8500_CH_FSM_STAT_REG 0x04 | ||
36 | #define AB8500_CH_STAT_REG 0x05 | ||
37 | |||
38 | /* | ||
39 | * Charger / control register offfsets | ||
40 | * Bank : 0x0B | ||
41 | */ | ||
42 | #define AB8500_CH_VOLT_LVL_REG 0x40 | ||
43 | #define AB8500_CH_VOLT_LVL_MAX_REG 0x41 /*Only in Cut2.0*/ | ||
44 | #define AB8500_CH_OPT_CRNTLVL_REG 0x42 | ||
45 | #define AB8500_CH_OPT_CRNTLVL_MAX_REG 0x43 /*Only in Cut2.0*/ | ||
46 | #define AB8500_CH_WD_TIMER_REG 0x50 | ||
47 | #define AB8500_CHARG_WD_CTRL 0x51 | ||
48 | #define AB8500_BTEMP_HIGH_TH 0x52 | ||
49 | #define AB8500_LED_INDICATOR_PWM_CTRL 0x53 | ||
50 | #define AB8500_LED_INDICATOR_PWM_DUTY 0x54 | ||
51 | #define AB8500_BATT_OVV 0x55 | ||
52 | #define AB8500_CHARGER_CTRL 0x56 | ||
53 | #define AB8500_BAT_CTRL_CURRENT_SOURCE 0x60 /*Only in Cut2.0*/ | ||
54 | |||
55 | /* | ||
56 | * Charger / main control register offsets | ||
57 | * Bank : 0x0B | ||
58 | */ | ||
59 | #define AB8500_MCH_CTRL1 0x80 | ||
60 | #define AB8500_MCH_CTRL2 0x81 | ||
61 | #define AB8500_MCH_IPT_CURLVL_REG 0x82 | ||
62 | #define AB8500_CH_WD_REG 0x83 | ||
63 | |||
64 | /* | ||
65 | * Charger / USB control register offsets | ||
66 | * Bank : 0x0B | ||
67 | */ | ||
68 | #define AB8500_USBCH_CTRL1_REG 0xC0 | ||
69 | #define AB8500_USBCH_CTRL2_REG 0xC1 | ||
70 | #define AB8500_USBCH_IPT_CRNTLVL_REG 0xC2 | ||
71 | |||
72 | /* | ||
73 | * Gas Gauge register offsets | ||
74 | * Bank : 0x0C | ||
75 | */ | ||
76 | #define AB8500_GASG_CC_CTRL_REG 0x00 | ||
77 | #define AB8500_GASG_CC_ACCU1_REG 0x01 | ||
78 | #define AB8500_GASG_CC_ACCU2_REG 0x02 | ||
79 | #define AB8500_GASG_CC_ACCU3_REG 0x03 | ||
80 | #define AB8500_GASG_CC_ACCU4_REG 0x04 | ||
81 | #define AB8500_GASG_CC_SMPL_CNTRL_REG 0x05 | ||
82 | #define AB8500_GASG_CC_SMPL_CNTRH_REG 0x06 | ||
83 | #define AB8500_GASG_CC_SMPL_CNVL_REG 0x07 | ||
84 | #define AB8500_GASG_CC_SMPL_CNVH_REG 0x08 | ||
85 | #define AB8500_GASG_CC_CNTR_AVGOFF_REG 0x09 | ||
86 | #define AB8500_GASG_CC_OFFSET_REG 0x0A | ||
87 | #define AB8500_GASG_CC_NCOV_ACCU 0x10 | ||
88 | #define AB8500_GASG_CC_NCOV_ACCU_CTRL 0x11 | ||
89 | #define AB8500_GASG_CC_NCOV_ACCU_LOW 0x12 | ||
90 | #define AB8500_GASG_CC_NCOV_ACCU_MED 0x13 | ||
91 | #define AB8500_GASG_CC_NCOV_ACCU_HIGH 0x14 | ||
92 | |||
93 | /* | ||
94 | * Interrupt register offsets | ||
95 | * Bank : 0x0E | ||
96 | */ | ||
97 | #define AB8500_IT_SOURCE2_REG 0x01 | ||
98 | #define AB8500_IT_SOURCE21_REG 0x14 | ||
99 | |||
100 | /* | ||
101 | * RTC register offsets | ||
102 | * Bank: 0x0F | ||
103 | */ | ||
104 | #define AB8500_RTC_BACKUP_CHG_REG 0x0C | ||
105 | #define AB8500_RTC_CC_CONF_REG 0x01 | ||
106 | #define AB8500_RTC_CTRL_REG 0x0B | ||
107 | |||
108 | /* | ||
109 | * OTP register offsets | ||
110 | * Bank : 0x15 | ||
111 | */ | ||
112 | #define AB8500_OTP_CONF_15 0x0E | ||
113 | |||
114 | /* GPADC constants from AB8500 spec, UM0836 */ | ||
115 | #define ADC_RESOLUTION 1024 | ||
116 | #define ADC_CH_MAIN_MIN 0 | ||
117 | #define ADC_CH_MAIN_MAX 20030 | ||
118 | #define ADC_CH_VBUS_MIN 0 | ||
119 | #define ADC_CH_VBUS_MAX 20030 | ||
120 | #define ADC_CH_VBAT_MIN 2300 | ||
121 | #define ADC_CH_VBAT_MAX 4800 | ||
122 | #define ADC_CH_BKBAT_MIN 0 | ||
123 | #define ADC_CH_BKBAT_MAX 3200 | ||
124 | |||
125 | /* Main charge i/p current */ | ||
126 | #define MAIN_CH_IP_CUR_0P9A 0x80 | ||
127 | #define MAIN_CH_IP_CUR_1P0A 0x90 | ||
128 | #define MAIN_CH_IP_CUR_1P1A 0xA0 | ||
129 | #define MAIN_CH_IP_CUR_1P2A 0xB0 | ||
130 | #define MAIN_CH_IP_CUR_1P3A 0xC0 | ||
131 | #define MAIN_CH_IP_CUR_1P4A 0xD0 | ||
132 | #define MAIN_CH_IP_CUR_1P5A 0xE0 | ||
133 | |||
134 | /* ChVoltLevel */ | ||
135 | #define CH_VOL_LVL_3P5 0x00 | ||
136 | #define CH_VOL_LVL_4P0 0x14 | ||
137 | #define CH_VOL_LVL_4P05 0x16 | ||
138 | #define CH_VOL_LVL_4P1 0x1B | ||
139 | #define CH_VOL_LVL_4P15 0x20 | ||
140 | #define CH_VOL_LVL_4P2 0x25 | ||
141 | #define CH_VOL_LVL_4P6 0x4D | ||
142 | |||
143 | /* ChOutputCurrentLevel */ | ||
144 | #define CH_OP_CUR_LVL_0P1 0x00 | ||
145 | #define CH_OP_CUR_LVL_0P2 0x01 | ||
146 | #define CH_OP_CUR_LVL_0P3 0x02 | ||
147 | #define CH_OP_CUR_LVL_0P4 0x03 | ||
148 | #define CH_OP_CUR_LVL_0P5 0x04 | ||
149 | #define CH_OP_CUR_LVL_0P6 0x05 | ||
150 | #define CH_OP_CUR_LVL_0P7 0x06 | ||
151 | #define CH_OP_CUR_LVL_0P8 0x07 | ||
152 | #define CH_OP_CUR_LVL_0P9 0x08 | ||
153 | #define CH_OP_CUR_LVL_1P4 0x0D | ||
154 | #define CH_OP_CUR_LVL_1P5 0x0E | ||
155 | #define CH_OP_CUR_LVL_1P6 0x0F | ||
156 | |||
157 | /* BTEMP High thermal limits */ | ||
158 | #define BTEMP_HIGH_TH_57_0 0x00 | ||
159 | #define BTEMP_HIGH_TH_52 0x01 | ||
160 | #define BTEMP_HIGH_TH_57_1 0x02 | ||
161 | #define BTEMP_HIGH_TH_62 0x03 | ||
162 | |||
163 | /* current is mA */ | ||
164 | #define USB_0P1A 100 | ||
165 | #define USB_0P2A 200 | ||
166 | #define USB_0P3A 300 | ||
167 | #define USB_0P4A 400 | ||
168 | #define USB_0P5A 500 | ||
169 | |||
170 | #define LOW_BAT_3P1V 0x20 | ||
171 | #define LOW_BAT_2P3V 0x00 | ||
172 | #define LOW_BAT_RESET 0x01 | ||
173 | #define LOW_BAT_ENABLE 0x01 | ||
174 | |||
175 | /* Backup battery constants */ | ||
176 | #define BUP_ICH_SEL_50UA 0x00 | ||
177 | #define BUP_ICH_SEL_150UA 0x04 | ||
178 | #define BUP_ICH_SEL_300UA 0x08 | ||
179 | #define BUP_ICH_SEL_700UA 0x0C | ||
180 | |||
181 | #define BUP_VCH_SEL_2P5V 0x00 | ||
182 | #define BUP_VCH_SEL_2P6V 0x01 | ||
183 | #define BUP_VCH_SEL_2P8V 0x02 | ||
184 | #define BUP_VCH_SEL_3P1V 0x03 | ||
185 | |||
186 | /* Battery OVV constants */ | ||
187 | #define BATT_OVV_ENA 0x02 | ||
188 | #define BATT_OVV_TH_3P7 0x00 | ||
189 | #define BATT_OVV_TH_4P75 0x01 | ||
190 | |||
191 | /* A value to indicate over voltage */ | ||
192 | #define BATT_OVV_VALUE 4750 | ||
193 | |||
194 | /* VBUS OVV constants */ | ||
195 | #define VBUS_OVV_SELECT_MASK 0x78 | ||
196 | #define VBUS_OVV_SELECT_5P6V 0x00 | ||
197 | #define VBUS_OVV_SELECT_5P7V 0x08 | ||
198 | #define VBUS_OVV_SELECT_5P8V 0x10 | ||
199 | #define VBUS_OVV_SELECT_5P9V 0x18 | ||
200 | #define VBUS_OVV_SELECT_6P0V 0x20 | ||
201 | #define VBUS_OVV_SELECT_6P1V 0x28 | ||
202 | #define VBUS_OVV_SELECT_6P2V 0x30 | ||
203 | #define VBUS_OVV_SELECT_6P3V 0x38 | ||
204 | |||
205 | #define VBUS_AUTO_IN_CURR_LIM_ENA 0x04 | ||
206 | |||
207 | /* Fuel Gauge constants */ | ||
208 | #define RESET_ACCU 0x02 | ||
209 | #define READ_REQ 0x01 | ||
210 | #define CC_DEEP_SLEEP_ENA 0x02 | ||
211 | #define CC_PWR_UP_ENA 0x01 | ||
212 | #define CC_SAMPLES_40 0x28 | ||
213 | #define RD_NCONV_ACCU_REQ 0x01 | ||
214 | #define CC_CALIB 0x08 | ||
215 | #define CC_INTAVGOFFSET_ENA 0x10 | ||
216 | #define CC_MUXOFFSET 0x80 | ||
217 | #define CC_INT_CAL_N_AVG_MASK 0x60 | ||
218 | #define CC_INT_CAL_SAMPLES_16 0x40 | ||
219 | #define CC_INT_CAL_SAMPLES_8 0x20 | ||
220 | #define CC_INT_CAL_SAMPLES_4 0x00 | ||
221 | |||
222 | /* RTC constants */ | ||
223 | #define RTC_BUP_CH_ENA 0x10 | ||
224 | |||
225 | /* BatCtrl Current Source Constants */ | ||
226 | #define BAT_CTRL_7U_ENA 0x01 | ||
227 | #define BAT_CTRL_20U_ENA 0x02 | ||
228 | #define BAT_CTRL_CMP_ENA 0x04 | ||
229 | #define FORCE_BAT_CTRL_CMP_HIGH 0x08 | ||
230 | #define BAT_CTRL_PULL_UP_ENA 0x10 | ||
231 | |||
232 | /* Battery type */ | ||
233 | #define BATTERY_UNKNOWN 00 | ||
234 | |||
235 | /** | ||
236 | * struct res_to_temp - defines one point in a temp to res curve. To | ||
237 | * be used in battery packs that combines the identification resistor with a | ||
238 | * NTC resistor. | ||
239 | * @temp: battery pack temperature in Celcius | ||
240 | * @resist: NTC resistor net total resistance | ||
241 | */ | ||
242 | struct res_to_temp { | ||
243 | int temp; | ||
244 | int resist; | ||
245 | }; | ||
246 | |||
247 | /** | ||
248 | * struct batres_vs_temp - defines one point in a temp vs battery internal | ||
249 | * resistance curve. | ||
250 | * @temp: battery pack temperature in Celcius | ||
251 | * @resist: battery internal reistance in mOhm | ||
252 | */ | ||
253 | struct batres_vs_temp { | ||
254 | int temp; | ||
255 | int resist; | ||
256 | }; | ||
257 | |||
258 | /* Forward declaration */ | ||
259 | struct ab8500_fg; | ||
260 | |||
261 | /** | ||
262 | * struct ab8500_fg_parameters - Fuel gauge algorithm parameters, in seconds | ||
263 | * if not specified | ||
264 | * @recovery_sleep_timer: Time between measurements while recovering | ||
265 | * @recovery_total_time: Total recovery time | ||
266 | * @init_timer: Measurement interval during startup | ||
267 | * @init_discard_time: Time we discard voltage measurement at startup | ||
268 | * @init_total_time: Total init time during startup | ||
269 | * @high_curr_time: Time current has to be high to go to recovery | ||
270 | * @accu_charging: FG accumulation time while charging | ||
271 | * @accu_high_curr: FG accumulation time in high current mode | ||
272 | * @high_curr_threshold: High current threshold, in mA | ||
273 | * @lowbat_threshold: Low battery threshold, in mV | ||
274 | * @battok_falling_th_sel0 Threshold in mV for battOk signal sel0 | ||
275 | * Resolution in 50 mV step. | ||
276 | * @battok_raising_th_sel1 Threshold in mV for battOk signal sel1 | ||
277 | * Resolution in 50 mV step. | ||
278 | * @user_cap_limit Capacity reported from user must be within this | ||
279 | * limit to be considered as sane, in percentage | ||
280 | * points. | ||
281 | * @maint_thres This is the threshold where we stop reporting | ||
282 | * battery full while in maintenance, in per cent | ||
283 | */ | ||
284 | struct ab8500_fg_parameters { | ||
285 | int recovery_sleep_timer; | ||
286 | int recovery_total_time; | ||
287 | int init_timer; | ||
288 | int init_discard_time; | ||
289 | int init_total_time; | ||
290 | int high_curr_time; | ||
291 | int accu_charging; | ||
292 | int accu_high_curr; | ||
293 | int high_curr_threshold; | ||
294 | int lowbat_threshold; | ||
295 | int battok_falling_th_sel0; | ||
296 | int battok_raising_th_sel1; | ||
297 | int user_cap_limit; | ||
298 | int maint_thres; | ||
299 | }; | ||
300 | |||
301 | /** | ||
302 | * struct ab8500_charger_maximization - struct used by the board config. | ||
303 | * @use_maxi: Enable maximization for this battery type | ||
304 | * @maxi_chg_curr: Maximum charger current allowed | ||
305 | * @maxi_wait_cycles: cycles to wait before setting charger current | ||
306 | * @charger_curr_step delta between two charger current settings (mA) | ||
307 | */ | ||
308 | struct ab8500_maxim_parameters { | ||
309 | bool ena_maxi; | ||
310 | int chg_curr; | ||
311 | int wait_cycles; | ||
312 | int charger_curr_step; | ||
313 | }; | ||
314 | |||
315 | /** | ||
316 | * struct ab8500_bm_capacity_levels - ab8500 capacity level data | ||
317 | * @critical: critical capacity level in percent | ||
318 | * @low: low capacity level in percent | ||
319 | * @normal: normal capacity level in percent | ||
320 | * @high: high capacity level in percent | ||
321 | * @full: full capacity level in percent | ||
322 | */ | ||
323 | struct ab8500_bm_capacity_levels { | ||
324 | int critical; | ||
325 | int low; | ||
326 | int normal; | ||
327 | int high; | ||
328 | int full; | ||
329 | }; | ||
330 | |||
331 | /** | ||
332 | * struct ab8500_bm_charger_parameters - Charger specific parameters | ||
333 | * @usb_volt_max: maximum allowed USB charger voltage in mV | ||
334 | * @usb_curr_max: maximum allowed USB charger current in mA | ||
335 | * @ac_volt_max: maximum allowed AC charger voltage in mV | ||
336 | * @ac_curr_max: maximum allowed AC charger current in mA | ||
337 | */ | ||
338 | struct ab8500_bm_charger_parameters { | ||
339 | int usb_volt_max; | ||
340 | int usb_curr_max; | ||
341 | int ac_volt_max; | ||
342 | int ac_curr_max; | ||
343 | }; | ||
344 | |||
345 | /** | ||
346 | * struct ab8500_bm_data - ab8500 battery management data | ||
347 | * @temp_under under this temp, charging is stopped | ||
348 | * @temp_low between this temp and temp_under charging is reduced | ||
349 | * @temp_high between this temp and temp_over charging is reduced | ||
350 | * @temp_over over this temp, charging is stopped | ||
351 | * @temp_interval_chg temperature measurement interval in s when charging | ||
352 | * @temp_interval_nochg temperature measurement interval in s when not charging | ||
353 | * @main_safety_tmr_h safety timer for main charger | ||
354 | * @usb_safety_tmr_h safety timer for usb charger | ||
355 | * @bkup_bat_v voltage which we charge the backup battery with | ||
356 | * @bkup_bat_i current which we charge the backup battery with | ||
357 | * @no_maintenance indicates that maintenance charging is disabled | ||
358 | * @adc_therm placement of thermistor, batctrl or battemp adc | ||
359 | * @chg_unknown_bat flag to enable charging of unknown batteries | ||
360 | * @enable_overshoot flag to enable VBAT overshoot control | ||
361 | * @fg_res resistance of FG resistor in 0.1mOhm | ||
362 | * @n_btypes number of elements in array bat_type | ||
363 | * @batt_id index of the identified battery in array bat_type | ||
364 | * @interval_charging charge alg cycle period time when charging (sec) | ||
365 | * @interval_not_charging charge alg cycle period time when not charging (sec) | ||
366 | * @temp_hysteresis temperature hysteresis | ||
367 | * @gnd_lift_resistance Battery ground to phone ground resistance (mOhm) | ||
368 | * @maxi: maximization parameters | ||
369 | * @cap_levels capacity in percent for the different capacity levels | ||
370 | * @bat_type table of supported battery types | ||
371 | * @chg_params charger parameters | ||
372 | * @fg_params fuel gauge parameters | ||
373 | */ | ||
374 | struct ab8500_bm_data { | ||
375 | int temp_under; | ||
376 | int temp_low; | ||
377 | int temp_high; | ||
378 | int temp_over; | ||
379 | int temp_interval_chg; | ||
380 | int temp_interval_nochg; | ||
381 | int main_safety_tmr_h; | ||
382 | int usb_safety_tmr_h; | ||
383 | int bkup_bat_v; | ||
384 | int bkup_bat_i; | ||
385 | bool no_maintenance; | ||
386 | bool chg_unknown_bat; | ||
387 | bool enable_overshoot; | ||
388 | enum abx500_adc_therm adc_therm; | ||
389 | int fg_res; | ||
390 | int n_btypes; | ||
391 | int batt_id; | ||
392 | int interval_charging; | ||
393 | int interval_not_charging; | ||
394 | int temp_hysteresis; | ||
395 | int gnd_lift_resistance; | ||
396 | const struct ab8500_maxim_parameters *maxi; | ||
397 | const struct ab8500_bm_capacity_levels *cap_levels; | ||
398 | const struct ab8500_bm_charger_parameters *chg_params; | ||
399 | const struct ab8500_fg_parameters *fg_params; | ||
400 | }; | ||
401 | |||
402 | struct ab8500_charger_platform_data { | ||
403 | char **supplied_to; | ||
404 | size_t num_supplicants; | ||
405 | bool autopower_cfg; | ||
406 | }; | ||
407 | |||
408 | struct ab8500_btemp_platform_data { | ||
409 | char **supplied_to; | ||
410 | size_t num_supplicants; | ||
411 | }; | ||
412 | |||
413 | struct ab8500_fg_platform_data { | ||
414 | char **supplied_to; | ||
415 | size_t num_supplicants; | ||
416 | }; | ||
417 | |||
418 | struct ab8500_chargalg_platform_data { | ||
419 | char **supplied_to; | ||
420 | size_t num_supplicants; | ||
421 | }; | ||
422 | struct ab8500_btemp; | ||
423 | struct ab8500_gpadc; | ||
424 | struct ab8500_fg; | ||
425 | #ifdef CONFIG_AB8500_BM | ||
426 | void ab8500_fg_reinit(void); | ||
427 | void ab8500_charger_usb_state_changed(u8 bm_usb_state, u16 mA); | ||
428 | struct ab8500_btemp *ab8500_btemp_get(void); | ||
429 | int ab8500_btemp_get_batctrl_temp(struct ab8500_btemp *btemp); | ||
430 | struct ab8500_fg *ab8500_fg_get(void); | ||
431 | int ab8500_fg_inst_curr_blocking(struct ab8500_fg *dev); | ||
432 | int ab8500_fg_inst_curr_start(struct ab8500_fg *di); | ||
433 | int ab8500_fg_inst_curr_finalize(struct ab8500_fg *di, int *res); | ||
434 | int ab8500_fg_inst_curr_done(struct ab8500_fg *di); | ||
435 | |||
436 | #else | ||
437 | int ab8500_fg_inst_curr_done(struct ab8500_fg *di) | ||
438 | { | ||
439 | } | ||
440 | static void ab8500_fg_reinit(void) | ||
441 | { | ||
442 | } | ||
443 | static void ab8500_charger_usb_state_changed(u8 bm_usb_state, u16 mA) | ||
444 | { | ||
445 | } | ||
446 | static struct ab8500_btemp *ab8500_btemp_get(void) | ||
447 | { | ||
448 | return NULL; | ||
449 | } | ||
450 | static int ab8500_btemp_get_batctrl_temp(struct ab8500_btemp *btemp) | ||
451 | { | ||
452 | return 0; | ||
453 | } | ||
454 | struct ab8500_fg *ab8500_fg_get(void) | ||
455 | { | ||
456 | return NULL; | ||
457 | } | ||
458 | static int ab8500_fg_inst_curr_blocking(struct ab8500_fg *dev) | ||
459 | { | ||
460 | return -ENODEV; | ||
461 | } | ||
462 | |||
463 | static inline int ab8500_fg_inst_curr_start(struct ab8500_fg *di) | ||
464 | { | ||
465 | return -ENODEV; | ||
466 | } | ||
467 | |||
468 | static inline int ab8500_fg_inst_curr_finalize(struct ab8500_fg *di, int *res) | ||
469 | { | ||
470 | return -ENODEV; | ||
471 | } | ||
472 | |||
473 | #endif | ||
474 | #endif /* _AB8500_BM_H */ | ||
diff --git a/include/linux/mfd/abx500/ab8500-gpio.h b/include/linux/mfd/abx500/ab8500-gpio.h index 488a8c920a29..2387c207ea86 100644 --- a/include/linux/mfd/abx500/ab8500-gpio.h +++ b/include/linux/mfd/abx500/ab8500-gpio.h | |||
@@ -10,12 +10,14 @@ | |||
10 | 10 | ||
11 | /* | 11 | /* |
12 | * Platform data to register a block: only the initial gpio/irq number. | 12 | * Platform data to register a block: only the initial gpio/irq number. |
13 | * Array sizes are large enough to contain all AB8500 and AB9540 GPIO | ||
14 | * registers. | ||
13 | */ | 15 | */ |
14 | 16 | ||
15 | struct ab8500_gpio_platform_data { | 17 | struct ab8500_gpio_platform_data { |
16 | int gpio_base; | 18 | int gpio_base; |
17 | u32 irq_base; | 19 | u32 irq_base; |
18 | u8 config_reg[7]; | 20 | u8 config_reg[8]; |
19 | }; | 21 | }; |
20 | 22 | ||
21 | #endif /* _AB8500_GPIO_H */ | 23 | #endif /* _AB8500_GPIO_H */ |
diff --git a/include/linux/mfd/abx500/ab8500-sysctrl.h b/include/linux/mfd/abx500/ab8500-sysctrl.h index 10da0291f8f8..10eb50973c39 100644 --- a/include/linux/mfd/abx500/ab8500-sysctrl.h +++ b/include/linux/mfd/abx500/ab8500-sysctrl.h | |||
@@ -71,6 +71,13 @@ static inline int ab8500_sysctrl_clear(u16 reg, u8 bits) | |||
71 | #define AB8500_SWATCTRL 0x230 | 71 | #define AB8500_SWATCTRL 0x230 |
72 | #define AB8500_HIQCLKCTRL 0x232 | 72 | #define AB8500_HIQCLKCTRL 0x232 |
73 | #define AB8500_VSIMSYSCLKCTRL 0x233 | 73 | #define AB8500_VSIMSYSCLKCTRL 0x233 |
74 | #define AB9540_SYSCLK12BUFCTRL 0x234 | ||
75 | #define AB9540_SYSCLK12CONFCTRL 0x235 | ||
76 | #define AB9540_SYSCLK12BUFCTRL2 0x236 | ||
77 | #define AB9540_SYSCLK12BUF1VALID 0x237 | ||
78 | #define AB9540_SYSCLK12BUF2VALID 0x238 | ||
79 | #define AB9540_SYSCLK12BUF3VALID 0x239 | ||
80 | #define AB9540_SYSCLK12BUF4VALID 0x23A | ||
74 | 81 | ||
75 | /* Bits */ | 82 | /* Bits */ |
76 | #define AB8500_TURNONSTATUS_PORNVBAT BIT(0) | 83 | #define AB8500_TURNONSTATUS_PORNVBAT BIT(0) |
@@ -251,4 +258,40 @@ static inline int ab8500_sysctrl_clear(u16 reg, u8 bits) | |||
251 | #define AB8500_VSIMSYSCLKCTRL_VSIMSYSCLKREQ7VALID BIT(6) | 258 | #define AB8500_VSIMSYSCLKCTRL_VSIMSYSCLKREQ7VALID BIT(6) |
252 | #define AB8500_VSIMSYSCLKCTRL_VSIMSYSCLKREQ8VALID BIT(7) | 259 | #define AB8500_VSIMSYSCLKCTRL_VSIMSYSCLKREQ8VALID BIT(7) |
253 | 260 | ||
261 | #define AB9540_SYSCLK12BUFCTRL_SYSCLK12BUF1ENA BIT(0) | ||
262 | #define AB9540_SYSCLK12BUFCTRL_SYSCLK12BUF2ENA BIT(1) | ||
263 | #define AB9540_SYSCLK12BUFCTRL_SYSCLK12BUF3ENA BIT(2) | ||
264 | #define AB9540_SYSCLK12BUFCTRL_SYSCLK12BUF4ENA BIT(3) | ||
265 | #define AB9540_SYSCLK12BUFCTRL_SYSCLK12BUFENA_MASK 0x0F | ||
266 | #define AB9540_SYSCLK12BUFCTRL_SYSCLK12BUF1STRE BIT(4) | ||
267 | #define AB9540_SYSCLK12BUFCTRL_SYSCLK12BUF2STRE BIT(5) | ||
268 | #define AB9540_SYSCLK12BUFCTRL_SYSCLK12BUF3STRE BIT(6) | ||
269 | #define AB9540_SYSCLK12BUFCTRL_SYSCLK12BUF4STRE BIT(7) | ||
270 | #define AB9540_SYSCLK12BUFCTRL_SYSCLK12BUFSTRE_MASK 0xF0 | ||
271 | |||
272 | #define AB9540_SYSCLK12CONFCTRL_PLL26TO38ENA BIT(0) | ||
273 | #define AB9540_SYSCLK12CONFCTRL_SYSCLK12USBMUXSEL BIT(1) | ||
274 | #define AB9540_SYSCLK12CONFCTRL_INT384MHZMUXSEL_MASK 0x0C | ||
275 | #define AB9540_SYSCLK12CONFCTRL_INT384MHZMUXSEL_SHIFT 2 | ||
276 | #define AB9540_SYSCLK12CONFCTRL_SYSCLK12BUFMUX BIT(4) | ||
277 | #define AB9540_SYSCLK12CONFCTRL_SYSCLK12PLLMUX BIT(5) | ||
278 | #define AB9540_SYSCLK12CONFCTRL_SYSCLK2MUXVALID BIT(6) | ||
279 | |||
280 | #define AB9540_SYSCLK12BUFCTRL2_SYSCLK12BUF1PDENA BIT(0) | ||
281 | #define AB9540_SYSCLK12BUFCTRL2_SYSCLK12BUF2PDENA BIT(1) | ||
282 | #define AB9540_SYSCLK12BUFCTRL2_SYSCLK12BUF3PDENA BIT(2) | ||
283 | #define AB9540_SYSCLK12BUFCTRL2_SYSCLK12BUF4PDENA BIT(3) | ||
284 | |||
285 | #define AB9540_SYSCLK12BUF1VALID_SYSCLK12BUF1VALID_MASK 0xFF | ||
286 | #define AB9540_SYSCLK12BUF1VALID_SYSCLK12BUF1VALID_SHIFT 0 | ||
287 | |||
288 | #define AB9540_SYSCLK12BUF2VALID_SYSCLK12BUF2VALID_MASK 0xFF | ||
289 | #define AB9540_SYSCLK12BUF2VALID_SYSCLK12BUF2VALID_SHIFT 0 | ||
290 | |||
291 | #define AB9540_SYSCLK12BUF3VALID_SYSCLK12BUF3VALID_MASK 0xFF | ||
292 | #define AB9540_SYSCLK12BUF3VALID_SYSCLK12BUF3VALID_SHIFT 0 | ||
293 | |||
294 | #define AB9540_SYSCLK12BUF4VALID_SYSCLK12BUF4VALID_MASK 0xFF | ||
295 | #define AB9540_SYSCLK12BUF4VALID_SYSCLK12BUF4VALID_SHIFT 0 | ||
296 | |||
254 | #endif /* __AB8500_SYSCTRL_H */ | 297 | #endif /* __AB8500_SYSCTRL_H */ |
diff --git a/include/linux/mfd/abx500/ab8500.h b/include/linux/mfd/abx500/ab8500.h index 838c6b487cc5..fccc3002f271 100644 --- a/include/linux/mfd/abx500/ab8500.h +++ b/include/linux/mfd/abx500/ab8500.h | |||
@@ -7,7 +7,32 @@ | |||
7 | #ifndef MFD_AB8500_H | 7 | #ifndef MFD_AB8500_H |
8 | #define MFD_AB8500_H | 8 | #define MFD_AB8500_H |
9 | 9 | ||
10 | #include <linux/device.h> | 10 | #include <linux/mutex.h> |
11 | |||
12 | struct device; | ||
13 | |||
14 | /* | ||
15 | * AB IC versions | ||
16 | * | ||
17 | * AB8500_VERSION_AB8500 should be 0xFF but will never be read as need a | ||
18 | * non-supported multi-byte I2C access via PRCMU. Set to 0x00 to ease the | ||
19 | * print of version string. | ||
20 | */ | ||
21 | enum ab8500_version { | ||
22 | AB8500_VERSION_AB8500 = 0x0, | ||
23 | AB8500_VERSION_AB8505 = 0x1, | ||
24 | AB8500_VERSION_AB9540 = 0x2, | ||
25 | AB8500_VERSION_AB8540 = 0x3, | ||
26 | AB8500_VERSION_UNDEFINED, | ||
27 | }; | ||
28 | |||
29 | /* AB8500 CIDs*/ | ||
30 | #define AB8500_CUTEARLY 0x00 | ||
31 | #define AB8500_CUT1P0 0x10 | ||
32 | #define AB8500_CUT1P1 0x11 | ||
33 | #define AB8500_CUT2P0 0x20 | ||
34 | #define AB8500_CUT3P0 0x30 | ||
35 | #define AB8500_CUT3P3 0x33 | ||
11 | 36 | ||
12 | /* | 37 | /* |
13 | * AB8500 bank addresses | 38 | * AB8500 bank addresses |
@@ -35,30 +60,34 @@ | |||
35 | 60 | ||
36 | /* | 61 | /* |
37 | * Interrupts | 62 | * Interrupts |
63 | * Values used to index into array ab8500_irq_regoffset[] defined in | ||
64 | * drivers/mdf/ab8500-core.c | ||
38 | */ | 65 | */ |
39 | 66 | /* Definitions for AB8500 and AB9540 */ | |
40 | #define AB8500_INT_MAIN_EXT_CH_NOT_OK 0 | 67 | /* ab8500_irq_regoffset[0] -> IT[Source|Latch|Mask]1 */ |
41 | #define AB8500_INT_UN_PLUG_TV_DET 1 | 68 | #define AB8500_INT_MAIN_EXT_CH_NOT_OK 0 /* not 8505/9540 */ |
42 | #define AB8500_INT_PLUG_TV_DET 2 | 69 | #define AB8500_INT_UN_PLUG_TV_DET 1 /* not 8505/9540 */ |
70 | #define AB8500_INT_PLUG_TV_DET 2 /* not 8505/9540 */ | ||
43 | #define AB8500_INT_TEMP_WARM 3 | 71 | #define AB8500_INT_TEMP_WARM 3 |
44 | #define AB8500_INT_PON_KEY2DB_F 4 | 72 | #define AB8500_INT_PON_KEY2DB_F 4 |
45 | #define AB8500_INT_PON_KEY2DB_R 5 | 73 | #define AB8500_INT_PON_KEY2DB_R 5 |
46 | #define AB8500_INT_PON_KEY1DB_F 6 | 74 | #define AB8500_INT_PON_KEY1DB_F 6 |
47 | #define AB8500_INT_PON_KEY1DB_R 7 | 75 | #define AB8500_INT_PON_KEY1DB_R 7 |
76 | /* ab8500_irq_regoffset[1] -> IT[Source|Latch|Mask]2 */ | ||
48 | #define AB8500_INT_BATT_OVV 8 | 77 | #define AB8500_INT_BATT_OVV 8 |
49 | #define AB8500_INT_MAIN_CH_UNPLUG_DET 10 | 78 | #define AB8500_INT_MAIN_CH_UNPLUG_DET 10 /* not 8505 */ |
50 | #define AB8500_INT_MAIN_CH_PLUG_DET 11 | 79 | #define AB8500_INT_MAIN_CH_PLUG_DET 11 /* not 8505 */ |
51 | #define AB8500_INT_USB_ID_DET_F 12 | ||
52 | #define AB8500_INT_USB_ID_DET_R 13 | ||
53 | #define AB8500_INT_VBUS_DET_F 14 | 80 | #define AB8500_INT_VBUS_DET_F 14 |
54 | #define AB8500_INT_VBUS_DET_R 15 | 81 | #define AB8500_INT_VBUS_DET_R 15 |
82 | /* ab8500_irq_regoffset[2] -> IT[Source|Latch|Mask]3 */ | ||
55 | #define AB8500_INT_VBUS_CH_DROP_END 16 | 83 | #define AB8500_INT_VBUS_CH_DROP_END 16 |
56 | #define AB8500_INT_RTC_60S 17 | 84 | #define AB8500_INT_RTC_60S 17 |
57 | #define AB8500_INT_RTC_ALARM 18 | 85 | #define AB8500_INT_RTC_ALARM 18 |
58 | #define AB8500_INT_BAT_CTRL_INDB 20 | 86 | #define AB8500_INT_BAT_CTRL_INDB 20 |
59 | #define AB8500_INT_CH_WD_EXP 21 | 87 | #define AB8500_INT_CH_WD_EXP 21 |
60 | #define AB8500_INT_VBUS_OVV 22 | 88 | #define AB8500_INT_VBUS_OVV 22 |
61 | #define AB8500_INT_MAIN_CH_DROP_END 23 | 89 | #define AB8500_INT_MAIN_CH_DROP_END 23 /* not 8505/9540 */ |
90 | /* ab8500_irq_regoffset[3] -> IT[Source|Latch|Mask]4 */ | ||
62 | #define AB8500_INT_CCN_CONV_ACC 24 | 91 | #define AB8500_INT_CCN_CONV_ACC 24 |
63 | #define AB8500_INT_INT_AUD 25 | 92 | #define AB8500_INT_INT_AUD 25 |
64 | #define AB8500_INT_CCEOC 26 | 93 | #define AB8500_INT_CCEOC 26 |
@@ -67,7 +96,8 @@ | |||
67 | #define AB8500_INT_LOW_BAT_R 29 | 96 | #define AB8500_INT_LOW_BAT_R 29 |
68 | #define AB8500_INT_BUP_CHG_NOT_OK 30 | 97 | #define AB8500_INT_BUP_CHG_NOT_OK 30 |
69 | #define AB8500_INT_BUP_CHG_OK 31 | 98 | #define AB8500_INT_BUP_CHG_OK 31 |
70 | #define AB8500_INT_GP_HW_ADC_CONV_END 32 | 99 | /* ab8500_irq_regoffset[4] -> IT[Source|Latch|Mask]5 */ |
100 | #define AB8500_INT_GP_HW_ADC_CONV_END 32 /* not 8505 */ | ||
71 | #define AB8500_INT_ACC_DETECT_1DB_F 33 | 101 | #define AB8500_INT_ACC_DETECT_1DB_F 33 |
72 | #define AB8500_INT_ACC_DETECT_1DB_R 34 | 102 | #define AB8500_INT_ACC_DETECT_1DB_R 34 |
73 | #define AB8500_INT_ACC_DETECT_22DB_F 35 | 103 | #define AB8500_INT_ACC_DETECT_22DB_F 35 |
@@ -75,38 +105,43 @@ | |||
75 | #define AB8500_INT_ACC_DETECT_21DB_F 37 | 105 | #define AB8500_INT_ACC_DETECT_21DB_F 37 |
76 | #define AB8500_INT_ACC_DETECT_21DB_R 38 | 106 | #define AB8500_INT_ACC_DETECT_21DB_R 38 |
77 | #define AB8500_INT_GP_SW_ADC_CONV_END 39 | 107 | #define AB8500_INT_GP_SW_ADC_CONV_END 39 |
78 | #define AB8500_INT_GPIO6R 40 | 108 | /* ab8500_irq_regoffset[5] -> IT[Source|Latch|Mask]7 */ |
79 | #define AB8500_INT_GPIO7R 41 | 109 | #define AB8500_INT_GPIO6R 40 /* not 8505/9540 */ |
80 | #define AB8500_INT_GPIO8R 42 | 110 | #define AB8500_INT_GPIO7R 41 /* not 8505/9540 */ |
81 | #define AB8500_INT_GPIO9R 43 | 111 | #define AB8500_INT_GPIO8R 42 /* not 8505/9540 */ |
112 | #define AB8500_INT_GPIO9R 43 /* not 8505/9540 */ | ||
82 | #define AB8500_INT_GPIO10R 44 | 113 | #define AB8500_INT_GPIO10R 44 |
83 | #define AB8500_INT_GPIO11R 45 | 114 | #define AB8500_INT_GPIO11R 45 |
84 | #define AB8500_INT_GPIO12R 46 | 115 | #define AB8500_INT_GPIO12R 46 /* not 8505 */ |
85 | #define AB8500_INT_GPIO13R 47 | 116 | #define AB8500_INT_GPIO13R 47 |
86 | #define AB8500_INT_GPIO24R 48 | 117 | /* ab8500_irq_regoffset[6] -> IT[Source|Latch|Mask]8 */ |
87 | #define AB8500_INT_GPIO25R 49 | 118 | #define AB8500_INT_GPIO24R 48 /* not 8505 */ |
88 | #define AB8500_INT_GPIO36R 50 | 119 | #define AB8500_INT_GPIO25R 49 /* not 8505 */ |
89 | #define AB8500_INT_GPIO37R 51 | 120 | #define AB8500_INT_GPIO36R 50 /* not 8505/9540 */ |
90 | #define AB8500_INT_GPIO38R 52 | 121 | #define AB8500_INT_GPIO37R 51 /* not 8505/9540 */ |
91 | #define AB8500_INT_GPIO39R 53 | 122 | #define AB8500_INT_GPIO38R 52 /* not 8505/9540 */ |
123 | #define AB8500_INT_GPIO39R 53 /* not 8505/9540 */ | ||
92 | #define AB8500_INT_GPIO40R 54 | 124 | #define AB8500_INT_GPIO40R 54 |
93 | #define AB8500_INT_GPIO41R 55 | 125 | #define AB8500_INT_GPIO41R 55 |
94 | #define AB8500_INT_GPIO6F 56 | 126 | /* ab8500_irq_regoffset[7] -> IT[Source|Latch|Mask]9 */ |
95 | #define AB8500_INT_GPIO7F 57 | 127 | #define AB8500_INT_GPIO6F 56 /* not 8505/9540 */ |
96 | #define AB8500_INT_GPIO8F 58 | 128 | #define AB8500_INT_GPIO7F 57 /* not 8505/9540 */ |
97 | #define AB8500_INT_GPIO9F 59 | 129 | #define AB8500_INT_GPIO8F 58 /* not 8505/9540 */ |
130 | #define AB8500_INT_GPIO9F 59 /* not 8505/9540 */ | ||
98 | #define AB8500_INT_GPIO10F 60 | 131 | #define AB8500_INT_GPIO10F 60 |
99 | #define AB8500_INT_GPIO11F 61 | 132 | #define AB8500_INT_GPIO11F 61 |
100 | #define AB8500_INT_GPIO12F 62 | 133 | #define AB8500_INT_GPIO12F 62 /* not 8505 */ |
101 | #define AB8500_INT_GPIO13F 63 | 134 | #define AB8500_INT_GPIO13F 63 |
102 | #define AB8500_INT_GPIO24F 64 | 135 | /* ab8500_irq_regoffset[8] -> IT[Source|Latch|Mask]10 */ |
103 | #define AB8500_INT_GPIO25F 65 | 136 | #define AB8500_INT_GPIO24F 64 /* not 8505 */ |
104 | #define AB8500_INT_GPIO36F 66 | 137 | #define AB8500_INT_GPIO25F 65 /* not 8505 */ |
105 | #define AB8500_INT_GPIO37F 67 | 138 | #define AB8500_INT_GPIO36F 66 /* not 8505/9540 */ |
106 | #define AB8500_INT_GPIO38F 68 | 139 | #define AB8500_INT_GPIO37F 67 /* not 8505/9540 */ |
107 | #define AB8500_INT_GPIO39F 69 | 140 | #define AB8500_INT_GPIO38F 68 /* not 8505/9540 */ |
141 | #define AB8500_INT_GPIO39F 69 /* not 8505/9540 */ | ||
108 | #define AB8500_INT_GPIO40F 70 | 142 | #define AB8500_INT_GPIO40F 70 |
109 | #define AB8500_INT_GPIO41F 71 | 143 | #define AB8500_INT_GPIO41F 71 |
144 | /* ab8500_irq_regoffset[9] -> IT[Source|Latch|Mask]12 */ | ||
110 | #define AB8500_INT_ADP_SOURCE_ERROR 72 | 145 | #define AB8500_INT_ADP_SOURCE_ERROR 72 |
111 | #define AB8500_INT_ADP_SINK_ERROR 73 | 146 | #define AB8500_INT_ADP_SINK_ERROR 73 |
112 | #define AB8500_INT_ADP_PROBE_PLUG 74 | 147 | #define AB8500_INT_ADP_PROBE_PLUG 74 |
@@ -114,30 +149,67 @@ | |||
114 | #define AB8500_INT_ADP_SENSE_OFF 76 | 149 | #define AB8500_INT_ADP_SENSE_OFF 76 |
115 | #define AB8500_INT_USB_PHY_POWER_ERR 78 | 150 | #define AB8500_INT_USB_PHY_POWER_ERR 78 |
116 | #define AB8500_INT_USB_LINK_STATUS 79 | 151 | #define AB8500_INT_USB_LINK_STATUS 79 |
152 | /* ab8500_irq_regoffset[10] -> IT[Source|Latch|Mask]19 */ | ||
117 | #define AB8500_INT_BTEMP_LOW 80 | 153 | #define AB8500_INT_BTEMP_LOW 80 |
118 | #define AB8500_INT_BTEMP_LOW_MEDIUM 81 | 154 | #define AB8500_INT_BTEMP_LOW_MEDIUM 81 |
119 | #define AB8500_INT_BTEMP_MEDIUM_HIGH 82 | 155 | #define AB8500_INT_BTEMP_MEDIUM_HIGH 82 |
120 | #define AB8500_INT_BTEMP_HIGH 83 | 156 | #define AB8500_INT_BTEMP_HIGH 83 |
121 | #define AB8500_INT_USB_CHARGER_NOT_OK 89 | 157 | /* ab8500_irq_regoffset[11] -> IT[Source|Latch|Mask]20 */ |
158 | #define AB8500_INT_SRP_DETECT 88 | ||
159 | #define AB8500_INT_USB_CHARGER_NOT_OKR 89 | ||
122 | #define AB8500_INT_ID_WAKEUP_R 90 | 160 | #define AB8500_INT_ID_WAKEUP_R 90 |
123 | #define AB8500_INT_ID_DET_R1R 92 | 161 | #define AB8500_INT_ID_DET_R1R 92 |
124 | #define AB8500_INT_ID_DET_R2R 93 | 162 | #define AB8500_INT_ID_DET_R2R 93 |
125 | #define AB8500_INT_ID_DET_R3R 94 | 163 | #define AB8500_INT_ID_DET_R3R 94 |
126 | #define AB8500_INT_ID_DET_R4R 95 | 164 | #define AB8500_INT_ID_DET_R4R 95 |
165 | /* ab8500_irq_regoffset[12] -> IT[Source|Latch|Mask]21 */ | ||
127 | #define AB8500_INT_ID_WAKEUP_F 96 | 166 | #define AB8500_INT_ID_WAKEUP_F 96 |
128 | #define AB8500_INT_ID_DET_R1F 98 | 167 | #define AB8500_INT_ID_DET_R1F 98 |
129 | #define AB8500_INT_ID_DET_R2F 99 | 168 | #define AB8500_INT_ID_DET_R2F 99 |
130 | #define AB8500_INT_ID_DET_R3F 100 | 169 | #define AB8500_INT_ID_DET_R3F 100 |
131 | #define AB8500_INT_ID_DET_R4F 101 | 170 | #define AB8500_INT_ID_DET_R4F 101 |
132 | #define AB8500_INT_USB_CHG_DET_DONE 102 | 171 | #define AB8500_INT_CHAUTORESTARTAFTSEC 102 |
172 | #define AB8500_INT_CHSTOPBYSEC 103 | ||
173 | /* ab8500_irq_regoffset[13] -> IT[Source|Latch|Mask]22 */ | ||
133 | #define AB8500_INT_USB_CH_TH_PROT_F 104 | 174 | #define AB8500_INT_USB_CH_TH_PROT_F 104 |
134 | #define AB8500_INT_USB_CH_TH_PROT_R 105 | 175 | #define AB8500_INT_USB_CH_TH_PROT_R 105 |
135 | #define AB8500_INT_MAIN_CH_TH_PROT_F 106 | 176 | #define AB8500_INT_MAIN_CH_TH_PROT_F 106 /* not 8505/9540 */ |
136 | #define AB8500_INT_MAIN_CH_TH_PROT_R 107 | 177 | #define AB8500_INT_MAIN_CH_TH_PROT_R 107 /* not 8505/9540 */ |
137 | #define AB8500_INT_USB_CHARGER_NOT_OKF 111 | 178 | #define AB8500_INT_CHCURLIMNOHSCHIRP 109 |
179 | #define AB8500_INT_CHCURLIMHSCHIRP 110 | ||
180 | #define AB8500_INT_XTAL32K_KO 111 | ||
138 | 181 | ||
182 | /* Definitions for AB9540 */ | ||
183 | /* ab8500_irq_regoffset[14] -> IT[Source|Latch|Mask]13 */ | ||
184 | #define AB9540_INT_GPIO50R 113 | ||
185 | #define AB9540_INT_GPIO51R 114 /* not 8505 */ | ||
186 | #define AB9540_INT_GPIO52R 115 | ||
187 | #define AB9540_INT_GPIO53R 116 | ||
188 | #define AB9540_INT_GPIO54R 117 /* not 8505 */ | ||
189 | #define AB9540_INT_IEXT_CH_RF_BFN_R 118 | ||
190 | #define AB9540_INT_IEXT_CH_RF_BFN_F 119 | ||
191 | /* ab8500_irq_regoffset[15] -> IT[Source|Latch|Mask]14 */ | ||
192 | #define AB9540_INT_GPIO50F 121 | ||
193 | #define AB9540_INT_GPIO51F 122 /* not 8505 */ | ||
194 | #define AB9540_INT_GPIO52F 123 | ||
195 | #define AB9540_INT_GPIO53F 124 | ||
196 | #define AB9540_INT_GPIO54F 125 /* not 8505 */ | ||
197 | |||
198 | /* | ||
199 | * AB8500_AB9540_NR_IRQS is used when configuring the IRQ numbers for the | ||
200 | * entire platform. This is a "compile time" constant so this must be set to | ||
201 | * the largest possible value that may be encountered with different AB SOCs. | ||
202 | * Of the currently supported AB devices, AB8500 and AB9540, it is the AB9540 | ||
203 | * which is larger. | ||
204 | */ | ||
139 | #define AB8500_NR_IRQS 112 | 205 | #define AB8500_NR_IRQS 112 |
206 | #define AB8505_NR_IRQS 128 | ||
207 | #define AB9540_NR_IRQS 128 | ||
208 | /* This is set to the roof of any AB8500 chip variant IRQ counts */ | ||
209 | #define AB8500_MAX_NR_IRQS AB9540_NR_IRQS | ||
210 | |||
140 | #define AB8500_NUM_IRQ_REGS 14 | 211 | #define AB8500_NUM_IRQ_REGS 14 |
212 | #define AB9540_NUM_IRQ_REGS 17 | ||
141 | 213 | ||
142 | /** | 214 | /** |
143 | * struct ab8500 - ab8500 internal structure | 215 | * struct ab8500 - ab8500 internal structure |
@@ -145,13 +217,18 @@ | |||
145 | * @lock: read/write operations lock | 217 | * @lock: read/write operations lock |
146 | * @irq_lock: genirq bus lock | 218 | * @irq_lock: genirq bus lock |
147 | * @irq: irq line | 219 | * @irq: irq line |
220 | * @version: chip version id (e.g. ab8500 or ab9540) | ||
148 | * @chip_id: chip revision id | 221 | * @chip_id: chip revision id |
149 | * @write: register write | 222 | * @write: register write |
223 | * @write_masked: masked register write | ||
150 | * @read: register read | 224 | * @read: register read |
151 | * @rx_buf: rx buf for SPI | 225 | * @rx_buf: rx buf for SPI |
152 | * @tx_buf: tx buf for SPI | 226 | * @tx_buf: tx buf for SPI |
153 | * @mask: cache of IRQ regs for bus lock | 227 | * @mask: cache of IRQ regs for bus lock |
154 | * @oldmask: cache of previous IRQ regs for bus lock | 228 | * @oldmask: cache of previous IRQ regs for bus lock |
229 | * @mask_size: Actual number of valid entries in mask[], oldmask[] and | ||
230 | * irq_reg_offset | ||
231 | * @irq_reg_offset: Array of offsets into IRQ registers | ||
155 | */ | 232 | */ |
156 | struct ab8500 { | 233 | struct ab8500 { |
157 | struct device *dev; | 234 | struct device *dev; |
@@ -160,16 +237,20 @@ struct ab8500 { | |||
160 | 237 | ||
161 | int irq_base; | 238 | int irq_base; |
162 | int irq; | 239 | int irq; |
240 | enum ab8500_version version; | ||
163 | u8 chip_id; | 241 | u8 chip_id; |
164 | 242 | ||
165 | int (*write) (struct ab8500 *a8500, u16 addr, u8 data); | 243 | int (*write)(struct ab8500 *ab8500, u16 addr, u8 data); |
166 | int (*read) (struct ab8500 *a8500, u16 addr); | 244 | int (*write_masked)(struct ab8500 *ab8500, u16 addr, u8 mask, u8 data); |
245 | int (*read)(struct ab8500 *ab8500, u16 addr); | ||
167 | 246 | ||
168 | unsigned long tx_buf[4]; | 247 | unsigned long tx_buf[4]; |
169 | unsigned long rx_buf[4]; | 248 | unsigned long rx_buf[4]; |
170 | 249 | ||
171 | u8 mask[AB8500_NUM_IRQ_REGS]; | 250 | u8 *mask; |
172 | u8 oldmask[AB8500_NUM_IRQ_REGS]; | 251 | u8 *oldmask; |
252 | int mask_size; | ||
253 | const int *irq_reg_offset; | ||
173 | }; | 254 | }; |
174 | 255 | ||
175 | struct regulator_reg_init; | 256 | struct regulator_reg_init; |
@@ -195,7 +276,52 @@ struct ab8500_platform_data { | |||
195 | struct ab8500_gpio_platform_data *gpio; | 276 | struct ab8500_gpio_platform_data *gpio; |
196 | }; | 277 | }; |
197 | 278 | ||
198 | extern int __devinit ab8500_init(struct ab8500 *ab8500); | 279 | extern int __devinit ab8500_init(struct ab8500 *ab8500, |
280 | enum ab8500_version version); | ||
199 | extern int __devexit ab8500_exit(struct ab8500 *ab8500); | 281 | extern int __devexit ab8500_exit(struct ab8500 *ab8500); |
200 | 282 | ||
283 | static inline int is_ab8500(struct ab8500 *ab) | ||
284 | { | ||
285 | return ab->version == AB8500_VERSION_AB8500; | ||
286 | } | ||
287 | |||
288 | static inline int is_ab8505(struct ab8500 *ab) | ||
289 | { | ||
290 | return ab->version == AB8500_VERSION_AB8505; | ||
291 | } | ||
292 | |||
293 | static inline int is_ab9540(struct ab8500 *ab) | ||
294 | { | ||
295 | return ab->version == AB8500_VERSION_AB9540; | ||
296 | } | ||
297 | |||
298 | static inline int is_ab8540(struct ab8500 *ab) | ||
299 | { | ||
300 | return ab->version == AB8500_VERSION_AB8540; | ||
301 | } | ||
302 | |||
303 | /* exclude also ab8505, ab9540... */ | ||
304 | static inline int is_ab8500_1p0_or_earlier(struct ab8500 *ab) | ||
305 | { | ||
306 | return (is_ab8500(ab) && (ab->chip_id <= AB8500_CUT1P0)); | ||
307 | } | ||
308 | |||
309 | /* exclude also ab8505, ab9540... */ | ||
310 | static inline int is_ab8500_1p1_or_earlier(struct ab8500 *ab) | ||
311 | { | ||
312 | return (is_ab8500(ab) && (ab->chip_id <= AB8500_CUT1P1)); | ||
313 | } | ||
314 | |||
315 | /* exclude also ab8505, ab9540... */ | ||
316 | static inline int is_ab8500_2p0_or_earlier(struct ab8500 *ab) | ||
317 | { | ||
318 | return (is_ab8500(ab) && (ab->chip_id <= AB8500_CUT2P0)); | ||
319 | } | ||
320 | |||
321 | /* exclude also ab8505, ab9540... */ | ||
322 | static inline int is_ab8500_2p0(struct ab8500 *ab) | ||
323 | { | ||
324 | return (is_ab8500(ab) && (ab->chip_id == AB8500_CUT2P0)); | ||
325 | } | ||
326 | |||
201 | #endif /* MFD_AB8500_H */ | 327 | #endif /* MFD_AB8500_H */ |
diff --git a/include/linux/mfd/abx500/ux500_chargalg.h b/include/linux/mfd/abx500/ux500_chargalg.h new file mode 100644 index 000000000000..9b07725750c9 --- /dev/null +++ b/include/linux/mfd/abx500/ux500_chargalg.h | |||
@@ -0,0 +1,38 @@ | |||
1 | /* | ||
2 | * Copyright (C) ST-Ericsson SA 2012 | ||
3 | * Author: Johan Gardsmark <johan.gardsmark@stericsson.com> for ST-Ericsson. | ||
4 | * License terms: GNU General Public License (GPL), version 2 | ||
5 | */ | ||
6 | |||
7 | #ifndef _UX500_CHARGALG_H | ||
8 | #define _UX500_CHARGALG_H | ||
9 | |||
10 | #include <linux/power_supply.h> | ||
11 | |||
12 | #define psy_to_ux500_charger(x) container_of((x), \ | ||
13 | struct ux500_charger, psy) | ||
14 | |||
15 | /* Forward declaration */ | ||
16 | struct ux500_charger; | ||
17 | |||
18 | struct ux500_charger_ops { | ||
19 | int (*enable) (struct ux500_charger *, int, int, int); | ||
20 | int (*kick_wd) (struct ux500_charger *); | ||
21 | int (*update_curr) (struct ux500_charger *, int); | ||
22 | }; | ||
23 | |||
24 | /** | ||
25 | * struct ux500_charger - power supply ux500 charger sub class | ||
26 | * @psy power supply base class | ||
27 | * @ops ux500 charger operations | ||
28 | * @max_out_volt maximum output charger voltage in mV | ||
29 | * @max_out_curr maximum output charger current in mA | ||
30 | */ | ||
31 | struct ux500_charger { | ||
32 | struct power_supply psy; | ||
33 | struct ux500_charger_ops ops; | ||
34 | int max_out_volt; | ||
35 | int max_out_curr; | ||
36 | }; | ||
37 | |||
38 | #endif | ||
diff --git a/include/linux/mfd/anatop.h b/include/linux/mfd/anatop.h new file mode 100644 index 000000000000..22c1007d3ec5 --- /dev/null +++ b/include/linux/mfd/anatop.h | |||
@@ -0,0 +1,40 @@ | |||
1 | /* | ||
2 | * anatop.h - Anatop MFD driver | ||
3 | * | ||
4 | * Copyright (C) 2012 Ying-Chun Liu (PaulLiu) <paul.liu@linaro.org> | ||
5 | * Copyright (C) 2012 Linaro | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License as published by | ||
9 | * the Free Software Foundation; either version 2 of the License, or | ||
10 | * (at your option) any later version. | ||
11 | * | ||
12 | * This program is distributed in the hope that it will be useful, | ||
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
15 | * GNU General Public License for more details. | ||
16 | * | ||
17 | * You should have received a copy of the GNU General Public License | ||
18 | * along with this program; if not, write to the Free Software | ||
19 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
20 | */ | ||
21 | |||
22 | #ifndef __LINUX_MFD_ANATOP_H | ||
23 | #define __LINUX_MFD_ANATOP_H | ||
24 | |||
25 | #include <linux/spinlock.h> | ||
26 | |||
27 | /** | ||
28 | * anatop - MFD data | ||
29 | * @ioreg: ioremap register | ||
30 | * @reglock: spinlock for register read/write | ||
31 | */ | ||
32 | struct anatop { | ||
33 | void *ioreg; | ||
34 | spinlock_t reglock; | ||
35 | }; | ||
36 | |||
37 | extern u32 anatop_get_bits(struct anatop *, u32, int, int); | ||
38 | extern void anatop_set_bits(struct anatop *, u32, int, int, u32); | ||
39 | |||
40 | #endif /* __LINUX_MFD_ANATOP_H */ | ||
diff --git a/include/linux/mfd/da9052/da9052.h b/include/linux/mfd/da9052/da9052.h index 5702d1be13b4..7ffbd6e9e7fc 100644 --- a/include/linux/mfd/da9052/da9052.h +++ b/include/linux/mfd/da9052/da9052.h | |||
@@ -76,8 +76,6 @@ enum da9052_chip_id { | |||
76 | struct da9052_pdata; | 76 | struct da9052_pdata; |
77 | 77 | ||
78 | struct da9052 { | 78 | struct da9052 { |
79 | struct mutex io_lock; | ||
80 | |||
81 | struct device *dev; | 79 | struct device *dev; |
82 | struct regmap *regmap; | 80 | struct regmap *regmap; |
83 | 81 | ||
diff --git a/include/linux/mfd/db5500-prcmu.h b/include/linux/mfd/db5500-prcmu.h index 9890687f582d..5a049dfaf153 100644 --- a/include/linux/mfd/db5500-prcmu.h +++ b/include/linux/mfd/db5500-prcmu.h | |||
@@ -8,41 +8,14 @@ | |||
8 | #ifndef __MFD_DB5500_PRCMU_H | 8 | #ifndef __MFD_DB5500_PRCMU_H |
9 | #define __MFD_DB5500_PRCMU_H | 9 | #define __MFD_DB5500_PRCMU_H |
10 | 10 | ||
11 | #ifdef CONFIG_MFD_DB5500_PRCMU | 11 | static inline int prcmu_resetout(u8 resoutn, u8 state) |
12 | |||
13 | void db5500_prcmu_early_init(void); | ||
14 | int db5500_prcmu_set_epod(u16 epod_id, u8 epod_state); | ||
15 | int db5500_prcmu_set_display_clocks(void); | ||
16 | int db5500_prcmu_disable_dsipll(void); | ||
17 | int db5500_prcmu_enable_dsipll(void); | ||
18 | int db5500_prcmu_abb_read(u8 slave, u8 reg, u8 *value, u8 size); | ||
19 | int db5500_prcmu_abb_write(u8 slave, u8 reg, u8 *value, u8 size); | ||
20 | void db5500_prcmu_enable_wakeups(u32 wakeups); | ||
21 | int db5500_prcmu_request_clock(u8 clock, bool enable); | ||
22 | void db5500_prcmu_config_abb_event_readout(u32 abb_events); | ||
23 | void db5500_prcmu_get_abb_event_buffer(void __iomem **buf); | ||
24 | int prcmu_resetout(u8 resoutn, u8 state); | ||
25 | int db5500_prcmu_set_power_state(u8 state, bool keep_ulp_clk, | ||
26 | bool keep_ap_pll); | ||
27 | int db5500_prcmu_config_esram0_deep_sleep(u8 state); | ||
28 | void db5500_prcmu_system_reset(u16 reset_code); | ||
29 | u16 db5500_prcmu_get_reset_code(void); | ||
30 | bool db5500_prcmu_is_ac_wake_requested(void); | ||
31 | int db5500_prcmu_set_arm_opp(u8 opp); | ||
32 | int db5500_prcmu_get_arm_opp(void); | ||
33 | |||
34 | #else /* !CONFIG_UX500_SOC_DB5500 */ | ||
35 | |||
36 | static inline void db5500_prcmu_early_init(void) {} | ||
37 | |||
38 | static inline int db5500_prcmu_abb_read(u8 slave, u8 reg, u8 *value, u8 size) | ||
39 | { | 12 | { |
40 | return -ENOSYS; | 13 | return 0; |
41 | } | 14 | } |
42 | 15 | ||
43 | static inline int db5500_prcmu_abb_write(u8 slave, u8 reg, u8 *value, u8 size) | 16 | static inline int db5500_prcmu_set_epod(u16 epod_id, u8 epod_state) |
44 | { | 17 | { |
45 | return -ENOSYS; | 18 | return 0; |
46 | } | 19 | } |
47 | 20 | ||
48 | static inline int db5500_prcmu_request_clock(u8 clock, bool enable) | 21 | static inline int db5500_prcmu_request_clock(u8 clock, bool enable) |
@@ -50,69 +23,82 @@ static inline int db5500_prcmu_request_clock(u8 clock, bool enable) | |||
50 | return 0; | 23 | return 0; |
51 | } | 24 | } |
52 | 25 | ||
53 | static inline int db5500_prcmu_set_display_clocks(void) | 26 | static inline int db5500_prcmu_set_power_state(u8 state, bool keep_ulp_clk, |
27 | bool keep_ap_pll) | ||
54 | { | 28 | { |
55 | return 0; | 29 | return 0; |
56 | } | 30 | } |
57 | 31 | ||
58 | static inline int db5500_prcmu_disable_dsipll(void) | 32 | static inline int db5500_prcmu_config_esram0_deep_sleep(u8 state) |
59 | { | 33 | { |
60 | return 0; | 34 | return 0; |
61 | } | 35 | } |
62 | 36 | ||
63 | static inline int db5500_prcmu_enable_dsipll(void) | 37 | static inline u16 db5500_prcmu_get_reset_code(void) |
64 | { | 38 | { |
65 | return 0; | 39 | return 0; |
66 | } | 40 | } |
67 | 41 | ||
68 | static inline int db5500_prcmu_config_esram0_deep_sleep(u8 state) | 42 | static inline bool db5500_prcmu_is_ac_wake_requested(void) |
69 | { | 43 | { |
70 | return 0; | 44 | return 0; |
71 | } | 45 | } |
72 | 46 | ||
73 | static inline void db5500_prcmu_enable_wakeups(u32 wakeups) {} | 47 | static inline int db5500_prcmu_set_arm_opp(u8 opp) |
74 | |||
75 | static inline int prcmu_resetout(u8 resoutn, u8 state) | ||
76 | { | 48 | { |
77 | return 0; | 49 | return 0; |
78 | } | 50 | } |
79 | 51 | ||
80 | static inline int db5500_prcmu_set_epod(u16 epod_id, u8 epod_state) | 52 | static inline int db5500_prcmu_get_arm_opp(void) |
81 | { | 53 | { |
82 | return 0; | 54 | return 0; |
83 | } | 55 | } |
84 | 56 | ||
85 | static inline void db5500_prcmu_get_abb_event_buffer(void __iomem **buf) {} | ||
86 | static inline void db5500_prcmu_config_abb_event_readout(u32 abb_events) {} | 57 | static inline void db5500_prcmu_config_abb_event_readout(u32 abb_events) {} |
87 | 58 | ||
88 | static inline int db5500_prcmu_set_power_state(u8 state, bool keep_ulp_clk, | 59 | static inline void db5500_prcmu_get_abb_event_buffer(void __iomem **buf) {} |
89 | bool keep_ap_pll) | ||
90 | { | ||
91 | return 0; | ||
92 | } | ||
93 | 60 | ||
94 | static inline void db5500_prcmu_system_reset(u16 reset_code) {} | 61 | static inline void db5500_prcmu_system_reset(u16 reset_code) {} |
95 | 62 | ||
96 | static inline u16 db5500_prcmu_get_reset_code(void) | 63 | static inline void db5500_prcmu_enable_wakeups(u32 wakeups) {} |
64 | |||
65 | #ifdef CONFIG_MFD_DB5500_PRCMU | ||
66 | |||
67 | void db5500_prcmu_early_init(void); | ||
68 | int db5500_prcmu_set_display_clocks(void); | ||
69 | int db5500_prcmu_disable_dsipll(void); | ||
70 | int db5500_prcmu_enable_dsipll(void); | ||
71 | int db5500_prcmu_abb_read(u8 slave, u8 reg, u8 *value, u8 size); | ||
72 | int db5500_prcmu_abb_write(u8 slave, u8 reg, u8 *value, u8 size); | ||
73 | |||
74 | #else /* !CONFIG_UX500_SOC_DB5500 */ | ||
75 | |||
76 | static inline void db5500_prcmu_early_init(void) {} | ||
77 | |||
78 | static inline int db5500_prcmu_abb_read(u8 slave, u8 reg, u8 *value, u8 size) | ||
97 | { | 79 | { |
98 | return 0; | 80 | return -ENOSYS; |
99 | } | 81 | } |
100 | 82 | ||
101 | static inline bool db5500_prcmu_is_ac_wake_requested(void) | 83 | static inline int db5500_prcmu_abb_write(u8 slave, u8 reg, u8 *value, u8 size) |
102 | { | 84 | { |
103 | return 0; | 85 | return -ENOSYS; |
104 | } | 86 | } |
105 | 87 | ||
106 | static inline int db5500_prcmu_set_arm_opp(u8 opp) | 88 | static inline int db5500_prcmu_set_display_clocks(void) |
107 | { | 89 | { |
108 | return 0; | 90 | return 0; |
109 | } | 91 | } |
110 | 92 | ||
111 | static inline int db5500_prcmu_get_arm_opp(void) | 93 | static inline int db5500_prcmu_disable_dsipll(void) |
112 | { | 94 | { |
113 | return 0; | 95 | return 0; |
114 | } | 96 | } |
115 | 97 | ||
98 | static inline int db5500_prcmu_enable_dsipll(void) | ||
99 | { | ||
100 | return 0; | ||
101 | } | ||
116 | 102 | ||
117 | #endif /* CONFIG_MFD_DB5500_PRCMU */ | 103 | #endif /* CONFIG_MFD_DB5500_PRCMU */ |
118 | 104 | ||
diff --git a/include/linux/mfd/db8500-prcmu.h b/include/linux/mfd/db8500-prcmu.h index 60d27f7bfc1f..b3a43b1263fe 100644 --- a/include/linux/mfd/db8500-prcmu.h +++ b/include/linux/mfd/db8500-prcmu.h | |||
@@ -11,6 +11,24 @@ | |||
11 | #define __MFD_DB8500_PRCMU_H | 11 | #define __MFD_DB8500_PRCMU_H |
12 | 12 | ||
13 | #include <linux/interrupt.h> | 13 | #include <linux/interrupt.h> |
14 | #include <linux/bitops.h> | ||
15 | |||
16 | /* | ||
17 | * Registers | ||
18 | */ | ||
19 | #define DB8500_PRCM_GPIOCR 0x138 | ||
20 | #define DB8500_PRCM_GPIOCR_DBG_UARTMOD_CMD0 BIT(0) | ||
21 | #define DB8500_PRCM_GPIOCR_DBG_STM_APE_CMD BIT(9) | ||
22 | #define DB8500_PRCM_GPIOCR_DBG_STM_MOD_CMD1 BIT(11) | ||
23 | #define DB8500_PRCM_GPIOCR_SPI2_SELECT BIT(23) | ||
24 | |||
25 | #define DB8500_PRCM_LINE_VALUE 0x170 | ||
26 | #define DB8500_PRCM_LINE_VALUE_HSI_CAWAKE0 BIT(3) | ||
27 | |||
28 | #define DB8500_PRCM_DSI_SW_RESET 0x324 | ||
29 | #define DB8500_PRCM_DSI_SW_RESET_DSI0_SW_RESETN BIT(0) | ||
30 | #define DB8500_PRCM_DSI_SW_RESET_DSI1_SW_RESETN BIT(1) | ||
31 | #define DB8500_PRCM_DSI_SW_RESET_DSI2_SW_RESETN BIT(2) | ||
14 | 32 | ||
15 | /* This portion previously known as <mach/prcmu-fw-defs_v1.h> */ | 33 | /* This portion previously known as <mach/prcmu-fw-defs_v1.h> */ |
16 | 34 | ||
@@ -421,40 +439,22 @@ enum auto_enable { | |||
421 | /* End of file previously known as prcmu-fw-defs_v1.h */ | 439 | /* End of file previously known as prcmu-fw-defs_v1.h */ |
422 | 440 | ||
423 | /** | 441 | /** |
424 | * enum hw_acc_dev - enum for hw accelerators | 442 | * enum prcmu_power_status - results from set_power_state |
425 | * @HW_ACC_SVAMMDSP: for SVAMMDSP | 443 | * @PRCMU_SLEEP_OK: Sleep went ok |
426 | * @HW_ACC_SVAPIPE: for SVAPIPE | 444 | * @PRCMU_DEEP_SLEEP_OK: DeepSleep went ok |
427 | * @HW_ACC_SIAMMDSP: for SIAMMDSP | 445 | * @PRCMU_IDLE_OK: Idle went ok |
428 | * @HW_ACC_SIAPIPE: for SIAPIPE | 446 | * @PRCMU_DEEPIDLE_OK: DeepIdle went ok |
429 | * @HW_ACC_SGA: for SGA | 447 | * @PRCMU_PRCMU2ARMPENDINGIT_ER: Pending interrupt detected |
430 | * @HW_ACC_B2R2: for B2R2 | 448 | * @PRCMU_ARMPENDINGIT_ER: Pending interrupt detected |
431 | * @HW_ACC_MCDE: for MCDE | ||
432 | * @HW_ACC_ESRAM1: for ESRAM1 | ||
433 | * @HW_ACC_ESRAM2: for ESRAM2 | ||
434 | * @HW_ACC_ESRAM3: for ESRAM3 | ||
435 | * @HW_ACC_ESRAM4: for ESRAM4 | ||
436 | * @NUM_HW_ACC: number of hardware accelerators | ||
437 | * | ||
438 | * Different hw accelerators which can be turned ON/ | ||
439 | * OFF or put into retention (MMDSPs and ESRAMs). | ||
440 | * Used with EPOD API. | ||
441 | * | 449 | * |
442 | * NOTE! Deprecated, to be removed when all users switched over to use the | ||
443 | * regulator API. | ||
444 | */ | 450 | */ |
445 | enum hw_acc_dev { | 451 | enum prcmu_power_status { |
446 | HW_ACC_SVAMMDSP, | 452 | PRCMU_SLEEP_OK = 0xf3, |
447 | HW_ACC_SVAPIPE, | 453 | PRCMU_DEEP_SLEEP_OK = 0xf6, |
448 | HW_ACC_SIAMMDSP, | 454 | PRCMU_IDLE_OK = 0xf0, |
449 | HW_ACC_SIAPIPE, | 455 | PRCMU_DEEPIDLE_OK = 0xe3, |
450 | HW_ACC_SGA, | 456 | PRCMU_PRCMU2ARMPENDINGIT_ER = 0x91, |
451 | HW_ACC_B2R2, | 457 | PRCMU_ARMPENDINGIT_ER = 0x93, |
452 | HW_ACC_MCDE, | ||
453 | HW_ACC_ESRAM1, | ||
454 | HW_ACC_ESRAM2, | ||
455 | HW_ACC_ESRAM3, | ||
456 | HW_ACC_ESRAM4, | ||
457 | NUM_HW_ACC | ||
458 | }; | 458 | }; |
459 | 459 | ||
460 | /* | 460 | /* |
@@ -493,6 +493,20 @@ struct prcmu_auto_pm_config { | |||
493 | u8 sva_policy; | 493 | u8 sva_policy; |
494 | }; | 494 | }; |
495 | 495 | ||
496 | #define PRCMU_FW_PROJECT_U8500 2 | ||
497 | #define PRCMU_FW_PROJECT_U9500 4 | ||
498 | #define PRCMU_FW_PROJECT_U8500_C2 7 | ||
499 | #define PRCMU_FW_PROJECT_U9500_C2 11 | ||
500 | #define PRCMU_FW_PROJECT_U8520 13 | ||
501 | #define PRCMU_FW_PROJECT_U8420 14 | ||
502 | |||
503 | struct prcmu_fw_version { | ||
504 | u8 project; | ||
505 | u8 api_version; | ||
506 | u8 func_version; | ||
507 | u8 errata; | ||
508 | }; | ||
509 | |||
496 | #ifdef CONFIG_MFD_DB8500_PRCMU | 510 | #ifdef CONFIG_MFD_DB8500_PRCMU |
497 | 511 | ||
498 | void db8500_prcmu_early_init(void); | 512 | void db8500_prcmu_early_init(void); |
@@ -500,42 +514,41 @@ int prcmu_set_rc_a2p(enum romcode_write); | |||
500 | enum romcode_read prcmu_get_rc_p2a(void); | 514 | enum romcode_read prcmu_get_rc_p2a(void); |
501 | enum ap_pwrst prcmu_get_xp70_current_state(void); | 515 | enum ap_pwrst prcmu_get_xp70_current_state(void); |
502 | bool prcmu_has_arm_maxopp(void); | 516 | bool prcmu_has_arm_maxopp(void); |
503 | bool prcmu_is_u8400(void); | 517 | struct prcmu_fw_version *prcmu_get_fw_version(void); |
504 | int prcmu_set_ape_opp(u8 opp); | ||
505 | int prcmu_get_ape_opp(void); | ||
506 | int prcmu_request_ape_opp_100_voltage(bool enable); | 518 | int prcmu_request_ape_opp_100_voltage(bool enable); |
507 | int prcmu_release_usb_wakeup_state(void); | 519 | int prcmu_release_usb_wakeup_state(void); |
508 | int prcmu_set_ddr_opp(u8 opp); | ||
509 | int prcmu_get_ddr_opp(void); | ||
510 | /* NOTE! Use regulator framework instead */ | ||
511 | int prcmu_set_hwacc(u16 hw_acc_dev, u8 state); | ||
512 | void prcmu_configure_auto_pm(struct prcmu_auto_pm_config *sleep, | 520 | void prcmu_configure_auto_pm(struct prcmu_auto_pm_config *sleep, |
513 | struct prcmu_auto_pm_config *idle); | 521 | struct prcmu_auto_pm_config *idle); |
514 | bool prcmu_is_auto_pm_enabled(void); | 522 | bool prcmu_is_auto_pm_enabled(void); |
515 | 523 | ||
516 | int prcmu_config_clkout(u8 clkout, u8 source, u8 div); | 524 | int prcmu_config_clkout(u8 clkout, u8 source, u8 div); |
517 | int prcmu_set_clock_divider(u8 clock, u8 divider); | 525 | int prcmu_set_clock_divider(u8 clock, u8 divider); |
518 | int prcmu_config_hotdog(u8 threshold); | 526 | int db8500_prcmu_config_hotdog(u8 threshold); |
519 | int prcmu_config_hotmon(u8 low, u8 high); | 527 | int db8500_prcmu_config_hotmon(u8 low, u8 high); |
520 | int prcmu_start_temp_sense(u16 cycles32k); | 528 | int db8500_prcmu_start_temp_sense(u16 cycles32k); |
521 | int prcmu_stop_temp_sense(void); | 529 | int db8500_prcmu_stop_temp_sense(void); |
522 | int prcmu_abb_read(u8 slave, u8 reg, u8 *value, u8 size); | 530 | int prcmu_abb_read(u8 slave, u8 reg, u8 *value, u8 size); |
523 | int prcmu_abb_write(u8 slave, u8 reg, u8 *value, u8 size); | 531 | int prcmu_abb_write(u8 slave, u8 reg, u8 *value, u8 size); |
524 | 532 | ||
525 | void prcmu_ac_wake_req(void); | 533 | void prcmu_ac_wake_req(void); |
526 | void prcmu_ac_sleep_req(void); | 534 | void prcmu_ac_sleep_req(void); |
527 | void prcmu_modem_reset(void); | 535 | void db8500_prcmu_modem_reset(void); |
528 | void prcmu_enable_spi2(void); | ||
529 | void prcmu_disable_spi2(void); | ||
530 | 536 | ||
531 | int prcmu_config_a9wdog(u8 num, bool sleep_auto_off); | 537 | int db8500_prcmu_config_a9wdog(u8 num, bool sleep_auto_off); |
532 | int prcmu_enable_a9wdog(u8 id); | 538 | int db8500_prcmu_enable_a9wdog(u8 id); |
533 | int prcmu_disable_a9wdog(u8 id); | 539 | int db8500_prcmu_disable_a9wdog(u8 id); |
534 | int prcmu_kick_a9wdog(u8 id); | 540 | int db8500_prcmu_kick_a9wdog(u8 id); |
535 | int prcmu_load_a9wdog(u8 id, u32 val); | 541 | int db8500_prcmu_load_a9wdog(u8 id, u32 val); |
536 | 542 | ||
537 | void db8500_prcmu_system_reset(u16 reset_code); | 543 | void db8500_prcmu_system_reset(u16 reset_code); |
538 | int db8500_prcmu_set_power_state(u8 state, bool keep_ulp_clk, bool keep_ap_pll); | 544 | int db8500_prcmu_set_power_state(u8 state, bool keep_ulp_clk, bool keep_ap_pll); |
545 | u8 db8500_prcmu_get_power_state_result(void); | ||
546 | int db8500_prcmu_gic_decouple(void); | ||
547 | int db8500_prcmu_gic_recouple(void); | ||
548 | int db8500_prcmu_copy_gic_settings(void); | ||
549 | bool db8500_prcmu_gic_pending_irq(void); | ||
550 | bool db8500_prcmu_pending_irq(void); | ||
551 | bool db8500_prcmu_is_cpu_in_wfi(int cpu); | ||
539 | void db8500_prcmu_enable_wakeups(u32 wakeups); | 552 | void db8500_prcmu_enable_wakeups(u32 wakeups); |
540 | int db8500_prcmu_set_epod(u16 epod_id, u8 epod_state); | 553 | int db8500_prcmu_set_epod(u16 epod_id, u8 epod_state); |
541 | int db8500_prcmu_request_clock(u8 clock, bool enable); | 554 | int db8500_prcmu_request_clock(u8 clock, bool enable); |
@@ -549,6 +562,14 @@ u16 db8500_prcmu_get_reset_code(void); | |||
549 | bool db8500_prcmu_is_ac_wake_requested(void); | 562 | bool db8500_prcmu_is_ac_wake_requested(void); |
550 | int db8500_prcmu_set_arm_opp(u8 opp); | 563 | int db8500_prcmu_set_arm_opp(u8 opp); |
551 | int db8500_prcmu_get_arm_opp(void); | 564 | int db8500_prcmu_get_arm_opp(void); |
565 | int db8500_prcmu_set_ape_opp(u8 opp); | ||
566 | int db8500_prcmu_get_ape_opp(void); | ||
567 | int db8500_prcmu_set_ddr_opp(u8 opp); | ||
568 | int db8500_prcmu_get_ddr_opp(void); | ||
569 | |||
570 | u32 db8500_prcmu_read(unsigned int reg); | ||
571 | void db8500_prcmu_write(unsigned int reg, u32 value); | ||
572 | void db8500_prcmu_write_masked(unsigned int reg, u32 mask, u32 value); | ||
552 | 573 | ||
553 | #else /* !CONFIG_MFD_DB8500_PRCMU */ | 574 | #else /* !CONFIG_MFD_DB8500_PRCMU */ |
554 | 575 | ||
@@ -574,17 +595,17 @@ static inline bool prcmu_has_arm_maxopp(void) | |||
574 | return false; | 595 | return false; |
575 | } | 596 | } |
576 | 597 | ||
577 | static inline bool prcmu_is_u8400(void) | 598 | static inline struct prcmu_fw_version *prcmu_get_fw_version(void) |
578 | { | 599 | { |
579 | return false; | 600 | return NULL; |
580 | } | 601 | } |
581 | 602 | ||
582 | static inline int prcmu_set_ape_opp(u8 opp) | 603 | static inline int db8500_prcmu_set_ape_opp(u8 opp) |
583 | { | 604 | { |
584 | return 0; | 605 | return 0; |
585 | } | 606 | } |
586 | 607 | ||
587 | static inline int prcmu_get_ape_opp(void) | 608 | static inline int db8500_prcmu_get_ape_opp(void) |
588 | { | 609 | { |
589 | return APE_100_OPP; | 610 | return APE_100_OPP; |
590 | } | 611 | } |
@@ -599,21 +620,16 @@ static inline int prcmu_release_usb_wakeup_state(void) | |||
599 | return 0; | 620 | return 0; |
600 | } | 621 | } |
601 | 622 | ||
602 | static inline int prcmu_set_ddr_opp(u8 opp) | 623 | static inline int db8500_prcmu_set_ddr_opp(u8 opp) |
603 | { | 624 | { |
604 | return 0; | 625 | return 0; |
605 | } | 626 | } |
606 | 627 | ||
607 | static inline int prcmu_get_ddr_opp(void) | 628 | static inline int db8500_prcmu_get_ddr_opp(void) |
608 | { | 629 | { |
609 | return DDR_100_OPP; | 630 | return DDR_100_OPP; |
610 | } | 631 | } |
611 | 632 | ||
612 | static inline int prcmu_set_hwacc(u16 hw_acc_dev, u8 state) | ||
613 | { | ||
614 | return 0; | ||
615 | } | ||
616 | |||
617 | static inline void prcmu_configure_auto_pm(struct prcmu_auto_pm_config *sleep, | 633 | static inline void prcmu_configure_auto_pm(struct prcmu_auto_pm_config *sleep, |
618 | struct prcmu_auto_pm_config *idle) | 634 | struct prcmu_auto_pm_config *idle) |
619 | { | 635 | { |
@@ -634,22 +650,22 @@ static inline int prcmu_set_clock_divider(u8 clock, u8 divider) | |||
634 | return 0; | 650 | return 0; |
635 | } | 651 | } |
636 | 652 | ||
637 | static inline int prcmu_config_hotdog(u8 threshold) | 653 | static inline int db8500_prcmu_config_hotdog(u8 threshold) |
638 | { | 654 | { |
639 | return 0; | 655 | return 0; |
640 | } | 656 | } |
641 | 657 | ||
642 | static inline int prcmu_config_hotmon(u8 low, u8 high) | 658 | static inline int db8500_prcmu_config_hotmon(u8 low, u8 high) |
643 | { | 659 | { |
644 | return 0; | 660 | return 0; |
645 | } | 661 | } |
646 | 662 | ||
647 | static inline int prcmu_start_temp_sense(u16 cycles32k) | 663 | static inline int db8500_prcmu_start_temp_sense(u16 cycles32k) |
648 | { | 664 | { |
649 | return 0; | 665 | return 0; |
650 | } | 666 | } |
651 | 667 | ||
652 | static inline int prcmu_stop_temp_sense(void) | 668 | static inline int db8500_prcmu_stop_temp_sense(void) |
653 | { | 669 | { |
654 | return 0; | 670 | return 0; |
655 | } | 671 | } |
@@ -668,22 +684,17 @@ static inline void prcmu_ac_wake_req(void) {} | |||
668 | 684 | ||
669 | static inline void prcmu_ac_sleep_req(void) {} | 685 | static inline void prcmu_ac_sleep_req(void) {} |
670 | 686 | ||
671 | static inline void prcmu_modem_reset(void) {} | 687 | static inline void db8500_prcmu_modem_reset(void) {} |
672 | 688 | ||
673 | static inline int prcmu_enable_spi2(void) | 689 | static inline void db8500_prcmu_system_reset(u16 reset_code) {} |
674 | { | ||
675 | return 0; | ||
676 | } | ||
677 | 690 | ||
678 | static inline int prcmu_disable_spi2(void) | 691 | static inline int db8500_prcmu_set_power_state(u8 state, bool keep_ulp_clk, |
692 | bool keep_ap_pll) | ||
679 | { | 693 | { |
680 | return 0; | 694 | return 0; |
681 | } | 695 | } |
682 | 696 | ||
683 | static inline void db8500_prcmu_system_reset(u16 reset_code) {} | 697 | static inline u8 db8500_prcmu_get_power_state_result(void) |
684 | |||
685 | static inline int db8500_prcmu_set_power_state(u8 state, bool keep_ulp_clk, | ||
686 | bool keep_ap_pll) | ||
687 | { | 698 | { |
688 | return 0; | 699 | return 0; |
689 | } | 700 | } |
@@ -729,27 +740,27 @@ static inline u16 db8500_prcmu_get_reset_code(void) | |||
729 | return 0; | 740 | return 0; |
730 | } | 741 | } |
731 | 742 | ||
732 | static inline int prcmu_config_a9wdog(u8 num, bool sleep_auto_off) | 743 | static inline int db8500_prcmu_config_a9wdog(u8 num, bool sleep_auto_off) |
733 | { | 744 | { |
734 | return 0; | 745 | return 0; |
735 | } | 746 | } |
736 | 747 | ||
737 | static inline int prcmu_enable_a9wdog(u8 id) | 748 | static inline int db8500_prcmu_enable_a9wdog(u8 id) |
738 | { | 749 | { |
739 | return 0; | 750 | return 0; |
740 | } | 751 | } |
741 | 752 | ||
742 | static inline int prcmu_disable_a9wdog(u8 id) | 753 | static inline int db8500_prcmu_disable_a9wdog(u8 id) |
743 | { | 754 | { |
744 | return 0; | 755 | return 0; |
745 | } | 756 | } |
746 | 757 | ||
747 | static inline int prcmu_kick_a9wdog(u8 id) | 758 | static inline int db8500_prcmu_kick_a9wdog(u8 id) |
748 | { | 759 | { |
749 | return 0; | 760 | return 0; |
750 | } | 761 | } |
751 | 762 | ||
752 | static inline int prcmu_load_a9wdog(u8 id, u32 val) | 763 | static inline int db8500_prcmu_load_a9wdog(u8 id, u32 val) |
753 | { | 764 | { |
754 | return 0; | 765 | return 0; |
755 | } | 766 | } |
@@ -769,6 +780,16 @@ static inline int db8500_prcmu_get_arm_opp(void) | |||
769 | return 0; | 780 | return 0; |
770 | } | 781 | } |
771 | 782 | ||
783 | static inline u32 db8500_prcmu_read(unsigned int reg) | ||
784 | { | ||
785 | return 0; | ||
786 | } | ||
787 | |||
788 | static inline void db8500_prcmu_write(unsigned int reg, u32 value) {} | ||
789 | |||
790 | static inline void db8500_prcmu_write_masked(unsigned int reg, u32 mask, | ||
791 | u32 value) {} | ||
792 | |||
772 | #endif /* !CONFIG_MFD_DB8500_PRCMU */ | 793 | #endif /* !CONFIG_MFD_DB8500_PRCMU */ |
773 | 794 | ||
774 | #endif /* __MFD_DB8500_PRCMU_H */ | 795 | #endif /* __MFD_DB8500_PRCMU_H */ |
diff --git a/include/linux/mfd/dbx500-prcmu.h b/include/linux/mfd/dbx500-prcmu.h index bac942f959c1..d7674eb7305f 100644 --- a/include/linux/mfd/dbx500-prcmu.h +++ b/include/linux/mfd/dbx500-prcmu.h | |||
@@ -10,7 +10,7 @@ | |||
10 | 10 | ||
11 | #include <linux/interrupt.h> | 11 | #include <linux/interrupt.h> |
12 | #include <linux/notifier.h> | 12 | #include <linux/notifier.h> |
13 | #include <asm/mach-types.h> | 13 | #include <linux/err.h> |
14 | 14 | ||
15 | /* PRCMU Wakeup defines */ | 15 | /* PRCMU Wakeup defines */ |
16 | enum prcmu_wakeup_index { | 16 | enum prcmu_wakeup_index { |
@@ -80,6 +80,29 @@ enum prcmu_wakeup_index { | |||
80 | #define EPOD_STATE_ON_CLK_OFF 0x03 | 80 | #define EPOD_STATE_ON_CLK_OFF 0x03 |
81 | #define EPOD_STATE_ON 0x04 | 81 | #define EPOD_STATE_ON 0x04 |
82 | 82 | ||
83 | /* DB5500 CLKOUT IDs */ | ||
84 | enum { | ||
85 | DB5500_CLKOUT0 = 0, | ||
86 | DB5500_CLKOUT1, | ||
87 | }; | ||
88 | |||
89 | /* DB5500 CLKOUTx sources */ | ||
90 | enum { | ||
91 | DB5500_CLKOUT_REF_CLK_SEL0, | ||
92 | DB5500_CLKOUT_RTC_CLK0_SEL0, | ||
93 | DB5500_CLKOUT_ULP_CLK_SEL0, | ||
94 | DB5500_CLKOUT_STATIC0, | ||
95 | DB5500_CLKOUT_REFCLK, | ||
96 | DB5500_CLKOUT_ULPCLK, | ||
97 | DB5500_CLKOUT_ARMCLK, | ||
98 | DB5500_CLKOUT_SYSACC0CLK, | ||
99 | DB5500_CLKOUT_SOC0PLLCLK, | ||
100 | DB5500_CLKOUT_SOC1PLLCLK, | ||
101 | DB5500_CLKOUT_DDRPLLCLK, | ||
102 | DB5500_CLKOUT_TVCLK, | ||
103 | DB5500_CLKOUT_IRDACLK, | ||
104 | }; | ||
105 | |||
83 | /* | 106 | /* |
84 | * CLKOUT sources | 107 | * CLKOUT sources |
85 | */ | 108 | */ |
@@ -111,6 +134,7 @@ enum prcmu_clock { | |||
111 | PRCMU_MSP1CLK, | 134 | PRCMU_MSP1CLK, |
112 | PRCMU_I2CCLK, | 135 | PRCMU_I2CCLK, |
113 | PRCMU_SDMMCCLK, | 136 | PRCMU_SDMMCCLK, |
137 | PRCMU_SPARE1CLK, | ||
114 | PRCMU_SLIMCLK, | 138 | PRCMU_SLIMCLK, |
115 | PRCMU_PER1CLK, | 139 | PRCMU_PER1CLK, |
116 | PRCMU_PER2CLK, | 140 | PRCMU_PER2CLK, |
@@ -139,12 +163,20 @@ enum prcmu_clock { | |||
139 | PRCMU_IRRCCLK, | 163 | PRCMU_IRRCCLK, |
140 | PRCMU_SIACLK, | 164 | PRCMU_SIACLK, |
141 | PRCMU_SVACLK, | 165 | PRCMU_SVACLK, |
166 | PRCMU_ACLK, | ||
142 | PRCMU_NUM_REG_CLOCKS, | 167 | PRCMU_NUM_REG_CLOCKS, |
143 | PRCMU_SYSCLK = PRCMU_NUM_REG_CLOCKS, | 168 | PRCMU_SYSCLK = PRCMU_NUM_REG_CLOCKS, |
169 | PRCMU_CDCLK, | ||
144 | PRCMU_TIMCLK, | 170 | PRCMU_TIMCLK, |
145 | PRCMU_PLLSOC0, | 171 | PRCMU_PLLSOC0, |
146 | PRCMU_PLLSOC1, | 172 | PRCMU_PLLSOC1, |
147 | PRCMU_PLLDDR, | 173 | PRCMU_PLLDDR, |
174 | PRCMU_PLLDSI, | ||
175 | PRCMU_DSI0CLK, | ||
176 | PRCMU_DSI1CLK, | ||
177 | PRCMU_DSI0ESCCLK, | ||
178 | PRCMU_DSI1ESCCLK, | ||
179 | PRCMU_DSI2ESCCLK, | ||
148 | }; | 180 | }; |
149 | 181 | ||
150 | /** | 182 | /** |
@@ -153,12 +185,14 @@ enum prcmu_clock { | |||
153 | * @APE_NO_CHANGE: The APE operating point is unchanged | 185 | * @APE_NO_CHANGE: The APE operating point is unchanged |
154 | * @APE_100_OPP: The new APE operating point is ape100opp | 186 | * @APE_100_OPP: The new APE operating point is ape100opp |
155 | * @APE_50_OPP: 50% | 187 | * @APE_50_OPP: 50% |
188 | * @APE_50_PARTLY_25_OPP: 50%, except some clocks at 25%. | ||
156 | */ | 189 | */ |
157 | enum ape_opp { | 190 | enum ape_opp { |
158 | APE_OPP_INIT = 0x00, | 191 | APE_OPP_INIT = 0x00, |
159 | APE_NO_CHANGE = 0x01, | 192 | APE_NO_CHANGE = 0x01, |
160 | APE_100_OPP = 0x02, | 193 | APE_100_OPP = 0x02, |
161 | APE_50_OPP = 0x03 | 194 | APE_50_OPP = 0x03, |
195 | APE_50_PARTLY_25_OPP = 0xFF, | ||
162 | }; | 196 | }; |
163 | 197 | ||
164 | /** | 198 | /** |
@@ -218,9 +252,11 @@ enum ddr_pwrst { | |||
218 | 252 | ||
219 | #if defined(CONFIG_UX500_SOC_DB8500) || defined(CONFIG_UX500_SOC_DB5500) | 253 | #if defined(CONFIG_UX500_SOC_DB8500) || defined(CONFIG_UX500_SOC_DB5500) |
220 | 254 | ||
255 | #include <mach/id.h> | ||
256 | |||
221 | static inline void __init prcmu_early_init(void) | 257 | static inline void __init prcmu_early_init(void) |
222 | { | 258 | { |
223 | if (machine_is_u5500()) | 259 | if (cpu_is_u5500()) |
224 | return db5500_prcmu_early_init(); | 260 | return db5500_prcmu_early_init(); |
225 | else | 261 | else |
226 | return db8500_prcmu_early_init(); | 262 | return db8500_prcmu_early_init(); |
@@ -229,7 +265,7 @@ static inline void __init prcmu_early_init(void) | |||
229 | static inline int prcmu_set_power_state(u8 state, bool keep_ulp_clk, | 265 | static inline int prcmu_set_power_state(u8 state, bool keep_ulp_clk, |
230 | bool keep_ap_pll) | 266 | bool keep_ap_pll) |
231 | { | 267 | { |
232 | if (machine_is_u5500()) | 268 | if (cpu_is_u5500()) |
233 | return db5500_prcmu_set_power_state(state, keep_ulp_clk, | 269 | return db5500_prcmu_set_power_state(state, keep_ulp_clk, |
234 | keep_ap_pll); | 270 | keep_ap_pll); |
235 | else | 271 | else |
@@ -237,9 +273,65 @@ static inline int prcmu_set_power_state(u8 state, bool keep_ulp_clk, | |||
237 | keep_ap_pll); | 273 | keep_ap_pll); |
238 | } | 274 | } |
239 | 275 | ||
276 | static inline u8 prcmu_get_power_state_result(void) | ||
277 | { | ||
278 | if (cpu_is_u5500()) | ||
279 | return -EINVAL; | ||
280 | else | ||
281 | return db8500_prcmu_get_power_state_result(); | ||
282 | } | ||
283 | |||
284 | static inline int prcmu_gic_decouple(void) | ||
285 | { | ||
286 | if (cpu_is_u5500()) | ||
287 | return -EINVAL; | ||
288 | else | ||
289 | return db8500_prcmu_gic_decouple(); | ||
290 | } | ||
291 | |||
292 | static inline int prcmu_gic_recouple(void) | ||
293 | { | ||
294 | if (cpu_is_u5500()) | ||
295 | return -EINVAL; | ||
296 | else | ||
297 | return db8500_prcmu_gic_recouple(); | ||
298 | } | ||
299 | |||
300 | static inline bool prcmu_gic_pending_irq(void) | ||
301 | { | ||
302 | if (cpu_is_u5500()) | ||
303 | return -EINVAL; | ||
304 | else | ||
305 | return db8500_prcmu_gic_pending_irq(); | ||
306 | } | ||
307 | |||
308 | static inline bool prcmu_is_cpu_in_wfi(int cpu) | ||
309 | { | ||
310 | if (cpu_is_u5500()) | ||
311 | return -EINVAL; | ||
312 | else | ||
313 | return db8500_prcmu_is_cpu_in_wfi(cpu); | ||
314 | } | ||
315 | |||
316 | static inline int prcmu_copy_gic_settings(void) | ||
317 | { | ||
318 | if (cpu_is_u5500()) | ||
319 | return -EINVAL; | ||
320 | else | ||
321 | return db8500_prcmu_copy_gic_settings(); | ||
322 | } | ||
323 | |||
324 | static inline bool prcmu_pending_irq(void) | ||
325 | { | ||
326 | if (cpu_is_u5500()) | ||
327 | return -EINVAL; | ||
328 | else | ||
329 | return db8500_prcmu_pending_irq(); | ||
330 | } | ||
331 | |||
240 | static inline int prcmu_set_epod(u16 epod_id, u8 epod_state) | 332 | static inline int prcmu_set_epod(u16 epod_id, u8 epod_state) |
241 | { | 333 | { |
242 | if (machine_is_u5500()) | 334 | if (cpu_is_u5500()) |
243 | return -EINVAL; | 335 | return -EINVAL; |
244 | else | 336 | else |
245 | return db8500_prcmu_set_epod(epod_id, epod_state); | 337 | return db8500_prcmu_set_epod(epod_id, epod_state); |
@@ -247,7 +339,7 @@ static inline int prcmu_set_epod(u16 epod_id, u8 epod_state) | |||
247 | 339 | ||
248 | static inline void prcmu_enable_wakeups(u32 wakeups) | 340 | static inline void prcmu_enable_wakeups(u32 wakeups) |
249 | { | 341 | { |
250 | if (machine_is_u5500()) | 342 | if (cpu_is_u5500()) |
251 | db5500_prcmu_enable_wakeups(wakeups); | 343 | db5500_prcmu_enable_wakeups(wakeups); |
252 | else | 344 | else |
253 | db8500_prcmu_enable_wakeups(wakeups); | 345 | db8500_prcmu_enable_wakeups(wakeups); |
@@ -260,7 +352,7 @@ static inline void prcmu_disable_wakeups(void) | |||
260 | 352 | ||
261 | static inline void prcmu_config_abb_event_readout(u32 abb_events) | 353 | static inline void prcmu_config_abb_event_readout(u32 abb_events) |
262 | { | 354 | { |
263 | if (machine_is_u5500()) | 355 | if (cpu_is_u5500()) |
264 | db5500_prcmu_config_abb_event_readout(abb_events); | 356 | db5500_prcmu_config_abb_event_readout(abb_events); |
265 | else | 357 | else |
266 | db8500_prcmu_config_abb_event_readout(abb_events); | 358 | db8500_prcmu_config_abb_event_readout(abb_events); |
@@ -268,7 +360,7 @@ static inline void prcmu_config_abb_event_readout(u32 abb_events) | |||
268 | 360 | ||
269 | static inline void prcmu_get_abb_event_buffer(void __iomem **buf) | 361 | static inline void prcmu_get_abb_event_buffer(void __iomem **buf) |
270 | { | 362 | { |
271 | if (machine_is_u5500()) | 363 | if (cpu_is_u5500()) |
272 | db5500_prcmu_get_abb_event_buffer(buf); | 364 | db5500_prcmu_get_abb_event_buffer(buf); |
273 | else | 365 | else |
274 | db8500_prcmu_get_abb_event_buffer(buf); | 366 | db8500_prcmu_get_abb_event_buffer(buf); |
@@ -276,25 +368,40 @@ static inline void prcmu_get_abb_event_buffer(void __iomem **buf) | |||
276 | 368 | ||
277 | int prcmu_abb_read(u8 slave, u8 reg, u8 *value, u8 size); | 369 | int prcmu_abb_read(u8 slave, u8 reg, u8 *value, u8 size); |
278 | int prcmu_abb_write(u8 slave, u8 reg, u8 *value, u8 size); | 370 | int prcmu_abb_write(u8 slave, u8 reg, u8 *value, u8 size); |
371 | int prcmu_abb_write_masked(u8 slave, u8 reg, u8 *value, u8 *mask, u8 size); | ||
279 | 372 | ||
280 | int prcmu_config_clkout(u8 clkout, u8 source, u8 div); | 373 | int prcmu_config_clkout(u8 clkout, u8 source, u8 div); |
281 | 374 | ||
282 | static inline int prcmu_request_clock(u8 clock, bool enable) | 375 | static inline int prcmu_request_clock(u8 clock, bool enable) |
283 | { | 376 | { |
284 | if (machine_is_u5500()) | 377 | if (cpu_is_u5500()) |
285 | return db5500_prcmu_request_clock(clock, enable); | 378 | return db5500_prcmu_request_clock(clock, enable); |
286 | else | 379 | else |
287 | return db8500_prcmu_request_clock(clock, enable); | 380 | return db8500_prcmu_request_clock(clock, enable); |
288 | } | 381 | } |
289 | 382 | ||
290 | int prcmu_set_ape_opp(u8 opp); | 383 | unsigned long prcmu_clock_rate(u8 clock); |
291 | int prcmu_get_ape_opp(void); | 384 | long prcmu_round_clock_rate(u8 clock, unsigned long rate); |
292 | int prcmu_set_ddr_opp(u8 opp); | 385 | int prcmu_set_clock_rate(u8 clock, unsigned long rate); |
293 | int prcmu_get_ddr_opp(void); | 386 | |
387 | static inline int prcmu_set_ddr_opp(u8 opp) | ||
388 | { | ||
389 | if (cpu_is_u5500()) | ||
390 | return -EINVAL; | ||
391 | else | ||
392 | return db8500_prcmu_set_ddr_opp(opp); | ||
393 | } | ||
394 | static inline int prcmu_get_ddr_opp(void) | ||
395 | { | ||
396 | if (cpu_is_u5500()) | ||
397 | return -EINVAL; | ||
398 | else | ||
399 | return db8500_prcmu_get_ddr_opp(); | ||
400 | } | ||
294 | 401 | ||
295 | static inline int prcmu_set_arm_opp(u8 opp) | 402 | static inline int prcmu_set_arm_opp(u8 opp) |
296 | { | 403 | { |
297 | if (machine_is_u5500()) | 404 | if (cpu_is_u5500()) |
298 | return -EINVAL; | 405 | return -EINVAL; |
299 | else | 406 | else |
300 | return db8500_prcmu_set_arm_opp(opp); | 407 | return db8500_prcmu_set_arm_opp(opp); |
@@ -302,15 +409,31 @@ static inline int prcmu_set_arm_opp(u8 opp) | |||
302 | 409 | ||
303 | static inline int prcmu_get_arm_opp(void) | 410 | static inline int prcmu_get_arm_opp(void) |
304 | { | 411 | { |
305 | if (machine_is_u5500()) | 412 | if (cpu_is_u5500()) |
306 | return -EINVAL; | 413 | return -EINVAL; |
307 | else | 414 | else |
308 | return db8500_prcmu_get_arm_opp(); | 415 | return db8500_prcmu_get_arm_opp(); |
309 | } | 416 | } |
310 | 417 | ||
418 | static inline int prcmu_set_ape_opp(u8 opp) | ||
419 | { | ||
420 | if (cpu_is_u5500()) | ||
421 | return -EINVAL; | ||
422 | else | ||
423 | return db8500_prcmu_set_ape_opp(opp); | ||
424 | } | ||
425 | |||
426 | static inline int prcmu_get_ape_opp(void) | ||
427 | { | ||
428 | if (cpu_is_u5500()) | ||
429 | return -EINVAL; | ||
430 | else | ||
431 | return db8500_prcmu_get_ape_opp(); | ||
432 | } | ||
433 | |||
311 | static inline void prcmu_system_reset(u16 reset_code) | 434 | static inline void prcmu_system_reset(u16 reset_code) |
312 | { | 435 | { |
313 | if (machine_is_u5500()) | 436 | if (cpu_is_u5500()) |
314 | return db5500_prcmu_system_reset(reset_code); | 437 | return db5500_prcmu_system_reset(reset_code); |
315 | else | 438 | else |
316 | return db8500_prcmu_system_reset(reset_code); | 439 | return db8500_prcmu_system_reset(reset_code); |
@@ -318,7 +441,7 @@ static inline void prcmu_system_reset(u16 reset_code) | |||
318 | 441 | ||
319 | static inline u16 prcmu_get_reset_code(void) | 442 | static inline u16 prcmu_get_reset_code(void) |
320 | { | 443 | { |
321 | if (machine_is_u5500()) | 444 | if (cpu_is_u5500()) |
322 | return db5500_prcmu_get_reset_code(); | 445 | return db5500_prcmu_get_reset_code(); |
323 | else | 446 | else |
324 | return db8500_prcmu_get_reset_code(); | 447 | return db8500_prcmu_get_reset_code(); |
@@ -326,10 +449,17 @@ static inline u16 prcmu_get_reset_code(void) | |||
326 | 449 | ||
327 | void prcmu_ac_wake_req(void); | 450 | void prcmu_ac_wake_req(void); |
328 | void prcmu_ac_sleep_req(void); | 451 | void prcmu_ac_sleep_req(void); |
329 | void prcmu_modem_reset(void); | 452 | static inline void prcmu_modem_reset(void) |
453 | { | ||
454 | if (cpu_is_u5500()) | ||
455 | return; | ||
456 | else | ||
457 | return db8500_prcmu_modem_reset(); | ||
458 | } | ||
459 | |||
330 | static inline bool prcmu_is_ac_wake_requested(void) | 460 | static inline bool prcmu_is_ac_wake_requested(void) |
331 | { | 461 | { |
332 | if (machine_is_u5500()) | 462 | if (cpu_is_u5500()) |
333 | return db5500_prcmu_is_ac_wake_requested(); | 463 | return db5500_prcmu_is_ac_wake_requested(); |
334 | else | 464 | else |
335 | return db8500_prcmu_is_ac_wake_requested(); | 465 | return db8500_prcmu_is_ac_wake_requested(); |
@@ -337,7 +467,7 @@ static inline bool prcmu_is_ac_wake_requested(void) | |||
337 | 467 | ||
338 | static inline int prcmu_set_display_clocks(void) | 468 | static inline int prcmu_set_display_clocks(void) |
339 | { | 469 | { |
340 | if (machine_is_u5500()) | 470 | if (cpu_is_u5500()) |
341 | return db5500_prcmu_set_display_clocks(); | 471 | return db5500_prcmu_set_display_clocks(); |
342 | else | 472 | else |
343 | return db8500_prcmu_set_display_clocks(); | 473 | return db8500_prcmu_set_display_clocks(); |
@@ -345,7 +475,7 @@ static inline int prcmu_set_display_clocks(void) | |||
345 | 475 | ||
346 | static inline int prcmu_disable_dsipll(void) | 476 | static inline int prcmu_disable_dsipll(void) |
347 | { | 477 | { |
348 | if (machine_is_u5500()) | 478 | if (cpu_is_u5500()) |
349 | return db5500_prcmu_disable_dsipll(); | 479 | return db5500_prcmu_disable_dsipll(); |
350 | else | 480 | else |
351 | return db8500_prcmu_disable_dsipll(); | 481 | return db8500_prcmu_disable_dsipll(); |
@@ -353,7 +483,7 @@ static inline int prcmu_disable_dsipll(void) | |||
353 | 483 | ||
354 | static inline int prcmu_enable_dsipll(void) | 484 | static inline int prcmu_enable_dsipll(void) |
355 | { | 485 | { |
356 | if (machine_is_u5500()) | 486 | if (cpu_is_u5500()) |
357 | return db5500_prcmu_enable_dsipll(); | 487 | return db5500_prcmu_enable_dsipll(); |
358 | else | 488 | else |
359 | return db8500_prcmu_enable_dsipll(); | 489 | return db8500_prcmu_enable_dsipll(); |
@@ -361,11 +491,107 @@ static inline int prcmu_enable_dsipll(void) | |||
361 | 491 | ||
362 | static inline int prcmu_config_esram0_deep_sleep(u8 state) | 492 | static inline int prcmu_config_esram0_deep_sleep(u8 state) |
363 | { | 493 | { |
364 | if (machine_is_u5500()) | 494 | if (cpu_is_u5500()) |
365 | return -EINVAL; | 495 | return -EINVAL; |
366 | else | 496 | else |
367 | return db8500_prcmu_config_esram0_deep_sleep(state); | 497 | return db8500_prcmu_config_esram0_deep_sleep(state); |
368 | } | 498 | } |
499 | |||
500 | static inline int prcmu_config_hotdog(u8 threshold) | ||
501 | { | ||
502 | if (cpu_is_u5500()) | ||
503 | return -EINVAL; | ||
504 | else | ||
505 | return db8500_prcmu_config_hotdog(threshold); | ||
506 | } | ||
507 | |||
508 | static inline int prcmu_config_hotmon(u8 low, u8 high) | ||
509 | { | ||
510 | if (cpu_is_u5500()) | ||
511 | return -EINVAL; | ||
512 | else | ||
513 | return db8500_prcmu_config_hotmon(low, high); | ||
514 | } | ||
515 | |||
516 | static inline int prcmu_start_temp_sense(u16 cycles32k) | ||
517 | { | ||
518 | if (cpu_is_u5500()) | ||
519 | return -EINVAL; | ||
520 | else | ||
521 | return db8500_prcmu_start_temp_sense(cycles32k); | ||
522 | } | ||
523 | |||
524 | static inline int prcmu_stop_temp_sense(void) | ||
525 | { | ||
526 | if (cpu_is_u5500()) | ||
527 | return -EINVAL; | ||
528 | else | ||
529 | return db8500_prcmu_stop_temp_sense(); | ||
530 | } | ||
531 | |||
532 | static inline u32 prcmu_read(unsigned int reg) | ||
533 | { | ||
534 | if (cpu_is_u5500()) | ||
535 | return -EINVAL; | ||
536 | else | ||
537 | return db8500_prcmu_read(reg); | ||
538 | } | ||
539 | |||
540 | static inline void prcmu_write(unsigned int reg, u32 value) | ||
541 | { | ||
542 | if (cpu_is_u5500()) | ||
543 | return; | ||
544 | else | ||
545 | db8500_prcmu_write(reg, value); | ||
546 | } | ||
547 | |||
548 | static inline void prcmu_write_masked(unsigned int reg, u32 mask, u32 value) | ||
549 | { | ||
550 | if (cpu_is_u5500()) | ||
551 | return; | ||
552 | else | ||
553 | db8500_prcmu_write_masked(reg, mask, value); | ||
554 | } | ||
555 | |||
556 | static inline int prcmu_enable_a9wdog(u8 id) | ||
557 | { | ||
558 | if (cpu_is_u5500()) | ||
559 | return -EINVAL; | ||
560 | else | ||
561 | return db8500_prcmu_enable_a9wdog(id); | ||
562 | } | ||
563 | |||
564 | static inline int prcmu_disable_a9wdog(u8 id) | ||
565 | { | ||
566 | if (cpu_is_u5500()) | ||
567 | return -EINVAL; | ||
568 | else | ||
569 | return db8500_prcmu_disable_a9wdog(id); | ||
570 | } | ||
571 | |||
572 | static inline int prcmu_kick_a9wdog(u8 id) | ||
573 | { | ||
574 | if (cpu_is_u5500()) | ||
575 | return -EINVAL; | ||
576 | else | ||
577 | return db8500_prcmu_kick_a9wdog(id); | ||
578 | } | ||
579 | |||
580 | static inline int prcmu_load_a9wdog(u8 id, u32 timeout) | ||
581 | { | ||
582 | if (cpu_is_u5500()) | ||
583 | return -EINVAL; | ||
584 | else | ||
585 | return db8500_prcmu_load_a9wdog(id, timeout); | ||
586 | } | ||
587 | |||
588 | static inline int prcmu_config_a9wdog(u8 num, bool sleep_auto_off) | ||
589 | { | ||
590 | if (cpu_is_u5500()) | ||
591 | return -EINVAL; | ||
592 | else | ||
593 | return db8500_prcmu_config_a9wdog(num, sleep_auto_off); | ||
594 | } | ||
369 | #else | 595 | #else |
370 | 596 | ||
371 | static inline void __init prcmu_early_init(void) {} | 597 | static inline void __init prcmu_early_init(void) {} |
@@ -395,6 +621,12 @@ static inline int prcmu_abb_write(u8 slave, u8 reg, u8 *value, u8 size) | |||
395 | return -ENOSYS; | 621 | return -ENOSYS; |
396 | } | 622 | } |
397 | 623 | ||
624 | static inline int prcmu_abb_write_masked(u8 slave, u8 reg, u8 *value, u8 *mask, | ||
625 | u8 size) | ||
626 | { | ||
627 | return -ENOSYS; | ||
628 | } | ||
629 | |||
398 | static inline int prcmu_config_clkout(u8 clkout, u8 source, u8 div) | 630 | static inline int prcmu_config_clkout(u8 clkout, u8 source, u8 div) |
399 | { | 631 | { |
400 | return 0; | 632 | return 0; |
@@ -405,6 +637,21 @@ static inline int prcmu_request_clock(u8 clock, bool enable) | |||
405 | return 0; | 637 | return 0; |
406 | } | 638 | } |
407 | 639 | ||
640 | static inline long prcmu_round_clock_rate(u8 clock, unsigned long rate) | ||
641 | { | ||
642 | return 0; | ||
643 | } | ||
644 | |||
645 | static inline int prcmu_set_clock_rate(u8 clock, unsigned long rate) | ||
646 | { | ||
647 | return 0; | ||
648 | } | ||
649 | |||
650 | static inline unsigned long prcmu_clock_rate(u8 clock) | ||
651 | { | ||
652 | return 0; | ||
653 | } | ||
654 | |||
408 | static inline int prcmu_set_ape_opp(u8 opp) | 655 | static inline int prcmu_set_ape_opp(u8 opp) |
409 | { | 656 | { |
410 | return 0; | 657 | return 0; |
@@ -480,14 +727,133 @@ static inline void prcmu_get_abb_event_buffer(void __iomem **buf) | |||
480 | *buf = NULL; | 727 | *buf = NULL; |
481 | } | 728 | } |
482 | 729 | ||
730 | static inline int prcmu_config_hotdog(u8 threshold) | ||
731 | { | ||
732 | return 0; | ||
733 | } | ||
734 | |||
735 | static inline int prcmu_config_hotmon(u8 low, u8 high) | ||
736 | { | ||
737 | return 0; | ||
738 | } | ||
739 | |||
740 | static inline int prcmu_start_temp_sense(u16 cycles32k) | ||
741 | { | ||
742 | return 0; | ||
743 | } | ||
744 | |||
745 | static inline int prcmu_stop_temp_sense(void) | ||
746 | { | ||
747 | return 0; | ||
748 | } | ||
749 | |||
750 | static inline u32 prcmu_read(unsigned int reg) | ||
751 | { | ||
752 | return 0; | ||
753 | } | ||
754 | |||
755 | static inline void prcmu_write(unsigned int reg, u32 value) {} | ||
756 | |||
757 | static inline void prcmu_write_masked(unsigned int reg, u32 mask, u32 value) {} | ||
758 | |||
759 | #endif | ||
760 | |||
761 | static inline void prcmu_set(unsigned int reg, u32 bits) | ||
762 | { | ||
763 | prcmu_write_masked(reg, bits, bits); | ||
764 | } | ||
765 | |||
766 | static inline void prcmu_clear(unsigned int reg, u32 bits) | ||
767 | { | ||
768 | prcmu_write_masked(reg, bits, 0); | ||
769 | } | ||
770 | |||
771 | #if defined(CONFIG_UX500_SOC_DB8500) || defined(CONFIG_UX500_SOC_DB5500) | ||
772 | |||
773 | /** | ||
774 | * prcmu_enable_spi2 - Enables pin muxing for SPI2 on OtherAlternateC1. | ||
775 | */ | ||
776 | static inline void prcmu_enable_spi2(void) | ||
777 | { | ||
778 | if (cpu_is_u8500()) | ||
779 | prcmu_set(DB8500_PRCM_GPIOCR, DB8500_PRCM_GPIOCR_SPI2_SELECT); | ||
780 | } | ||
781 | |||
782 | /** | ||
783 | * prcmu_disable_spi2 - Disables pin muxing for SPI2 on OtherAlternateC1. | ||
784 | */ | ||
785 | static inline void prcmu_disable_spi2(void) | ||
786 | { | ||
787 | if (cpu_is_u8500()) | ||
788 | prcmu_clear(DB8500_PRCM_GPIOCR, DB8500_PRCM_GPIOCR_SPI2_SELECT); | ||
789 | } | ||
790 | |||
791 | /** | ||
792 | * prcmu_enable_stm_mod_uart - Enables pin muxing for STMMOD | ||
793 | * and UARTMOD on OtherAlternateC3. | ||
794 | */ | ||
795 | static inline void prcmu_enable_stm_mod_uart(void) | ||
796 | { | ||
797 | if (cpu_is_u8500()) { | ||
798 | prcmu_set(DB8500_PRCM_GPIOCR, | ||
799 | (DB8500_PRCM_GPIOCR_DBG_STM_MOD_CMD1 | | ||
800 | DB8500_PRCM_GPIOCR_DBG_UARTMOD_CMD0)); | ||
801 | } | ||
802 | } | ||
803 | |||
804 | /** | ||
805 | * prcmu_disable_stm_mod_uart - Disables pin muxing for STMMOD | ||
806 | * and UARTMOD on OtherAlternateC3. | ||
807 | */ | ||
808 | static inline void prcmu_disable_stm_mod_uart(void) | ||
809 | { | ||
810 | if (cpu_is_u8500()) { | ||
811 | prcmu_clear(DB8500_PRCM_GPIOCR, | ||
812 | (DB8500_PRCM_GPIOCR_DBG_STM_MOD_CMD1 | | ||
813 | DB8500_PRCM_GPIOCR_DBG_UARTMOD_CMD0)); | ||
814 | } | ||
815 | } | ||
816 | |||
817 | /** | ||
818 | * prcmu_enable_stm_ape - Enables pin muxing for STM APE on OtherAlternateC1. | ||
819 | */ | ||
820 | static inline void prcmu_enable_stm_ape(void) | ||
821 | { | ||
822 | if (cpu_is_u8500()) { | ||
823 | prcmu_set(DB8500_PRCM_GPIOCR, | ||
824 | DB8500_PRCM_GPIOCR_DBG_STM_APE_CMD); | ||
825 | } | ||
826 | } | ||
827 | |||
828 | /** | ||
829 | * prcmu_disable_stm_ape - Disables pin muxing for STM APE on OtherAlternateC1. | ||
830 | */ | ||
831 | static inline void prcmu_disable_stm_ape(void) | ||
832 | { | ||
833 | if (cpu_is_u8500()) { | ||
834 | prcmu_clear(DB8500_PRCM_GPIOCR, | ||
835 | DB8500_PRCM_GPIOCR_DBG_STM_APE_CMD); | ||
836 | } | ||
837 | } | ||
838 | |||
839 | #else | ||
840 | |||
841 | static inline void prcmu_enable_spi2(void) {} | ||
842 | static inline void prcmu_disable_spi2(void) {} | ||
843 | static inline void prcmu_enable_stm_mod_uart(void) {} | ||
844 | static inline void prcmu_disable_stm_mod_uart(void) {} | ||
845 | static inline void prcmu_enable_stm_ape(void) {} | ||
846 | static inline void prcmu_disable_stm_ape(void) {} | ||
847 | |||
483 | #endif | 848 | #endif |
484 | 849 | ||
485 | /* PRCMU QoS APE OPP class */ | 850 | /* PRCMU QoS APE OPP class */ |
486 | #define PRCMU_QOS_APE_OPP 1 | 851 | #define PRCMU_QOS_APE_OPP 1 |
487 | #define PRCMU_QOS_DDR_OPP 2 | 852 | #define PRCMU_QOS_DDR_OPP 2 |
853 | #define PRCMU_QOS_ARM_OPP 3 | ||
488 | #define PRCMU_QOS_DEFAULT_VALUE -1 | 854 | #define PRCMU_QOS_DEFAULT_VALUE -1 |
489 | 855 | ||
490 | #ifdef CONFIG_UX500_PRCMU_QOS_POWER | 856 | #ifdef CONFIG_DBX500_PRCMU_QOS_POWER |
491 | 857 | ||
492 | unsigned long prcmu_qos_get_cpufreq_opp_delay(void); | 858 | unsigned long prcmu_qos_get_cpufreq_opp_delay(void); |
493 | void prcmu_qos_set_cpufreq_opp_delay(unsigned long); | 859 | void prcmu_qos_set_cpufreq_opp_delay(unsigned long); |
diff --git a/include/linux/mfd/mc13xxx.h b/include/linux/mfd/mc13xxx.h index b86ee45c8b03..10e038bac8dd 100644 --- a/include/linux/mfd/mc13xxx.h +++ b/include/linux/mfd/mc13xxx.h | |||
@@ -38,7 +38,8 @@ int mc13xxx_irq_ack(struct mc13xxx *mc13xxx, int irq); | |||
38 | int mc13xxx_get_flags(struct mc13xxx *mc13xxx); | 38 | int mc13xxx_get_flags(struct mc13xxx *mc13xxx); |
39 | 39 | ||
40 | int mc13xxx_adc_do_conversion(struct mc13xxx *mc13xxx, | 40 | int mc13xxx_adc_do_conversion(struct mc13xxx *mc13xxx, |
41 | unsigned int mode, unsigned int channel, unsigned int *sample); | 41 | unsigned int mode, unsigned int channel, |
42 | u8 ato, bool atox, unsigned int *sample); | ||
42 | 43 | ||
43 | #define MC13XXX_IRQ_ADCDONE 0 | 44 | #define MC13XXX_IRQ_ADCDONE 0 |
44 | #define MC13XXX_IRQ_ADCBISDONE 1 | 45 | #define MC13XXX_IRQ_ADCBISDONE 1 |
@@ -157,6 +158,18 @@ struct mc13xxx_buttons_platform_data { | |||
157 | unsigned short b3on_key; | 158 | unsigned short b3on_key; |
158 | }; | 159 | }; |
159 | 160 | ||
161 | struct mc13xxx_ts_platform_data { | ||
162 | /* Delay between Touchscreen polarization and ADC Conversion. | ||
163 | * Given in clock ticks of a 32 kHz clock which gives a granularity of | ||
164 | * about 30.5ms */ | ||
165 | u8 ato; | ||
166 | |||
167 | #define MC13783_TS_ATO_FIRST false | ||
168 | #define MC13783_TS_ATO_EACH true | ||
169 | /* Use the ATO delay only for the first conversion or for each one */ | ||
170 | bool atox; | ||
171 | }; | ||
172 | |||
160 | struct mc13xxx_platform_data { | 173 | struct mc13xxx_platform_data { |
161 | #define MC13XXX_USE_TOUCHSCREEN (1 << 0) | 174 | #define MC13XXX_USE_TOUCHSCREEN (1 << 0) |
162 | #define MC13XXX_USE_CODEC (1 << 1) | 175 | #define MC13XXX_USE_CODEC (1 << 1) |
@@ -167,6 +180,7 @@ struct mc13xxx_platform_data { | |||
167 | struct mc13xxx_regulator_platform_data regulators; | 180 | struct mc13xxx_regulator_platform_data regulators; |
168 | struct mc13xxx_leds_platform_data *leds; | 181 | struct mc13xxx_leds_platform_data *leds; |
169 | struct mc13xxx_buttons_platform_data *buttons; | 182 | struct mc13xxx_buttons_platform_data *buttons; |
183 | struct mc13xxx_ts_platform_data touch; | ||
170 | }; | 184 | }; |
171 | 185 | ||
172 | #define MC13XXX_ADC_MODE_TS 1 | 186 | #define MC13XXX_ADC_MODE_TS 1 |
diff --git a/include/linux/mfd/mcp.h b/include/linux/mfd/mcp.h index f88c1cc0cb0f..a9e8bd157673 100644 --- a/include/linux/mfd/mcp.h +++ b/include/linux/mfd/mcp.h | |||
@@ -10,8 +10,6 @@ | |||
10 | #ifndef MCP_H | 10 | #ifndef MCP_H |
11 | #define MCP_H | 11 | #define MCP_H |
12 | 12 | ||
13 | #include <mach/dma.h> | ||
14 | |||
15 | struct mcp_ops; | 13 | struct mcp_ops; |
16 | 14 | ||
17 | struct mcp { | 15 | struct mcp { |
@@ -21,12 +19,7 @@ struct mcp { | |||
21 | int use_count; | 19 | int use_count; |
22 | unsigned int sclk_rate; | 20 | unsigned int sclk_rate; |
23 | unsigned int rw_timeout; | 21 | unsigned int rw_timeout; |
24 | dma_device_t dma_audio_rd; | ||
25 | dma_device_t dma_audio_wr; | ||
26 | dma_device_t dma_telco_rd; | ||
27 | dma_device_t dma_telco_wr; | ||
28 | struct device attached_device; | 22 | struct device attached_device; |
29 | int gpio_base; | ||
30 | }; | 23 | }; |
31 | 24 | ||
32 | struct mcp_ops { | 25 | struct mcp_ops { |
@@ -47,15 +40,14 @@ void mcp_disable(struct mcp *); | |||
47 | #define mcp_get_sclk_rate(mcp) ((mcp)->sclk_rate) | 40 | #define mcp_get_sclk_rate(mcp) ((mcp)->sclk_rate) |
48 | 41 | ||
49 | struct mcp *mcp_host_alloc(struct device *, size_t); | 42 | struct mcp *mcp_host_alloc(struct device *, size_t); |
50 | int mcp_host_register(struct mcp *); | 43 | int mcp_host_add(struct mcp *, void *); |
51 | void mcp_host_unregister(struct mcp *); | 44 | void mcp_host_del(struct mcp *); |
45 | void mcp_host_free(struct mcp *); | ||
52 | 46 | ||
53 | struct mcp_driver { | 47 | struct mcp_driver { |
54 | struct device_driver drv; | 48 | struct device_driver drv; |
55 | int (*probe)(struct mcp *); | 49 | int (*probe)(struct mcp *); |
56 | void (*remove)(struct mcp *); | 50 | void (*remove)(struct mcp *); |
57 | int (*suspend)(struct mcp *, pm_message_t); | ||
58 | int (*resume)(struct mcp *); | ||
59 | }; | 51 | }; |
60 | 52 | ||
61 | int mcp_driver_register(struct mcp_driver *); | 53 | int mcp_driver_register(struct mcp_driver *); |
diff --git a/include/linux/mfd/pm8xxx/pm8921.h b/include/linux/mfd/pm8xxx/pm8921.h index d5517fd32d1b..00fa3de7659d 100644 --- a/include/linux/mfd/pm8xxx/pm8921.h +++ b/include/linux/mfd/pm8xxx/pm8921.h | |||
@@ -18,7 +18,6 @@ | |||
18 | #ifndef __MFD_PM8921_H | 18 | #ifndef __MFD_PM8921_H |
19 | #define __MFD_PM8921_H | 19 | #define __MFD_PM8921_H |
20 | 20 | ||
21 | #include <linux/device.h> | ||
22 | #include <linux/mfd/pm8xxx/irq.h> | 21 | #include <linux/mfd/pm8xxx/irq.h> |
23 | 22 | ||
24 | #define PM8921_NR_IRQS 256 | 23 | #define PM8921_NR_IRQS 256 |
diff --git a/include/linux/mfd/rc5t583.h b/include/linux/mfd/rc5t583.h new file mode 100644 index 000000000000..0b64b19d81ab --- /dev/null +++ b/include/linux/mfd/rc5t583.h | |||
@@ -0,0 +1,326 @@ | |||
1 | /* | ||
2 | * Core driver interface to access RICOH_RC5T583 power management chip. | ||
3 | * | ||
4 | * Copyright (c) 2011-2012, NVIDIA CORPORATION. All rights reserved. | ||
5 | * Author: Laxman dewangan <ldewangan@nvidia.com> | ||
6 | * | ||
7 | * Based on code | ||
8 | * Copyright (C) 2011 RICOH COMPANY,LTD | ||
9 | * | ||
10 | * This program is free software; you can redistribute it and/or modify it | ||
11 | * under the terms and conditions of the GNU General Public License, | ||
12 | * version 2, as published by the Free Software Foundation. | ||
13 | * | ||
14 | * This program is distributed in the hope it will be useful, but WITHOUT | ||
15 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
16 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
17 | * more details. | ||
18 | * | ||
19 | * You should have received a copy of the GNU General Public License | ||
20 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
21 | * | ||
22 | */ | ||
23 | |||
24 | #ifndef __LINUX_MFD_RC5T583_H | ||
25 | #define __LINUX_MFD_RC5T583_H | ||
26 | |||
27 | #include <linux/mutex.h> | ||
28 | #include <linux/types.h> | ||
29 | #include <linux/regmap.h> | ||
30 | |||
31 | #define RC5T583_MAX_REGS 0xF8 | ||
32 | |||
33 | /* Maximum number of main interrupts */ | ||
34 | #define MAX_MAIN_INTERRUPT 5 | ||
35 | #define RC5T583_MAX_GPEDGE_REG 2 | ||
36 | #define RC5T583_MAX_INTERRUPT_MASK_REGS 9 | ||
37 | |||
38 | /* Interrupt enable register */ | ||
39 | #define RC5T583_INT_EN_SYS1 0x19 | ||
40 | #define RC5T583_INT_EN_SYS2 0x1D | ||
41 | #define RC5T583_INT_EN_DCDC 0x41 | ||
42 | #define RC5T583_INT_EN_RTC 0xED | ||
43 | #define RC5T583_INT_EN_ADC1 0x90 | ||
44 | #define RC5T583_INT_EN_ADC2 0x91 | ||
45 | #define RC5T583_INT_EN_ADC3 0x92 | ||
46 | |||
47 | /* Interrupt status registers (monitor regs in Ricoh)*/ | ||
48 | #define RC5T583_INTC_INTPOL 0xAD | ||
49 | #define RC5T583_INTC_INTEN 0xAE | ||
50 | #define RC5T583_INTC_INTMON 0xAF | ||
51 | |||
52 | #define RC5T583_INT_MON_GRP 0xAF | ||
53 | #define RC5T583_INT_MON_SYS1 0x1B | ||
54 | #define RC5T583_INT_MON_SYS2 0x1F | ||
55 | #define RC5T583_INT_MON_DCDC 0x43 | ||
56 | #define RC5T583_INT_MON_RTC 0xEE | ||
57 | |||
58 | /* Interrupt clearing registers */ | ||
59 | #define RC5T583_INT_IR_SYS1 0x1A | ||
60 | #define RC5T583_INT_IR_SYS2 0x1E | ||
61 | #define RC5T583_INT_IR_DCDC 0x42 | ||
62 | #define RC5T583_INT_IR_RTC 0xEE | ||
63 | #define RC5T583_INT_IR_ADCL 0x94 | ||
64 | #define RC5T583_INT_IR_ADCH 0x95 | ||
65 | #define RC5T583_INT_IR_ADCEND 0x96 | ||
66 | #define RC5T583_INT_IR_GPIOR 0xA9 | ||
67 | #define RC5T583_INT_IR_GPIOF 0xAA | ||
68 | |||
69 | /* Sleep sequence registers */ | ||
70 | #define RC5T583_SLPSEQ1 0x21 | ||
71 | #define RC5T583_SLPSEQ2 0x22 | ||
72 | #define RC5T583_SLPSEQ3 0x23 | ||
73 | #define RC5T583_SLPSEQ4 0x24 | ||
74 | #define RC5T583_SLPSEQ5 0x25 | ||
75 | #define RC5T583_SLPSEQ6 0x26 | ||
76 | #define RC5T583_SLPSEQ7 0x27 | ||
77 | #define RC5T583_SLPSEQ8 0x28 | ||
78 | #define RC5T583_SLPSEQ9 0x29 | ||
79 | #define RC5T583_SLPSEQ10 0x2A | ||
80 | #define RC5T583_SLPSEQ11 0x2B | ||
81 | |||
82 | /* Regulator registers */ | ||
83 | #define RC5T583_REG_DC0CTL 0x30 | ||
84 | #define RC5T583_REG_DC0DAC 0x31 | ||
85 | #define RC5T583_REG_DC0LATCTL 0x32 | ||
86 | #define RC5T583_REG_SR0CTL 0x33 | ||
87 | |||
88 | #define RC5T583_REG_DC1CTL 0x34 | ||
89 | #define RC5T583_REG_DC1DAC 0x35 | ||
90 | #define RC5T583_REG_DC1LATCTL 0x36 | ||
91 | #define RC5T583_REG_SR1CTL 0x37 | ||
92 | |||
93 | #define RC5T583_REG_DC2CTL 0x38 | ||
94 | #define RC5T583_REG_DC2DAC 0x39 | ||
95 | #define RC5T583_REG_DC2LATCTL 0x3A | ||
96 | #define RC5T583_REG_SR2CTL 0x3B | ||
97 | |||
98 | #define RC5T583_REG_DC3CTL 0x3C | ||
99 | #define RC5T583_REG_DC3DAC 0x3D | ||
100 | #define RC5T583_REG_DC3LATCTL 0x3E | ||
101 | #define RC5T583_REG_SR3CTL 0x3F | ||
102 | |||
103 | |||
104 | #define RC5T583_REG_LDOEN1 0x50 | ||
105 | #define RC5T583_REG_LDOEN2 0x51 | ||
106 | #define RC5T583_REG_LDODIS1 0x52 | ||
107 | #define RC5T583_REG_LDODIS2 0x53 | ||
108 | |||
109 | #define RC5T583_REG_LDO0DAC 0x54 | ||
110 | #define RC5T583_REG_LDO1DAC 0x55 | ||
111 | #define RC5T583_REG_LDO2DAC 0x56 | ||
112 | #define RC5T583_REG_LDO3DAC 0x57 | ||
113 | #define RC5T583_REG_LDO4DAC 0x58 | ||
114 | #define RC5T583_REG_LDO5DAC 0x59 | ||
115 | #define RC5T583_REG_LDO6DAC 0x5A | ||
116 | #define RC5T583_REG_LDO7DAC 0x5B | ||
117 | #define RC5T583_REG_LDO8DAC 0x5C | ||
118 | #define RC5T583_REG_LDO9DAC 0x5D | ||
119 | |||
120 | #define RC5T583_REG_DC0DAC_DS 0x60 | ||
121 | #define RC5T583_REG_DC1DAC_DS 0x61 | ||
122 | #define RC5T583_REG_DC2DAC_DS 0x62 | ||
123 | #define RC5T583_REG_DC3DAC_DS 0x63 | ||
124 | |||
125 | #define RC5T583_REG_LDO0DAC_DS 0x64 | ||
126 | #define RC5T583_REG_LDO1DAC_DS 0x65 | ||
127 | #define RC5T583_REG_LDO2DAC_DS 0x66 | ||
128 | #define RC5T583_REG_LDO3DAC_DS 0x67 | ||
129 | #define RC5T583_REG_LDO4DAC_DS 0x68 | ||
130 | #define RC5T583_REG_LDO5DAC_DS 0x69 | ||
131 | #define RC5T583_REG_LDO6DAC_DS 0x6A | ||
132 | #define RC5T583_REG_LDO7DAC_DS 0x6B | ||
133 | #define RC5T583_REG_LDO8DAC_DS 0x6C | ||
134 | #define RC5T583_REG_LDO9DAC_DS 0x6D | ||
135 | |||
136 | /* GPIO register base address */ | ||
137 | #define RC5T583_GPIO_IOSEL 0xA0 | ||
138 | #define RC5T583_GPIO_PDEN 0xA1 | ||
139 | #define RC5T583_GPIO_IOOUT 0xA2 | ||
140 | #define RC5T583_GPIO_PGSEL 0xA3 | ||
141 | #define RC5T583_GPIO_GPINV 0xA4 | ||
142 | #define RC5T583_GPIO_GPDEB 0xA5 | ||
143 | #define RC5T583_GPIO_GPEDGE1 0xA6 | ||
144 | #define RC5T583_GPIO_GPEDGE2 0xA7 | ||
145 | #define RC5T583_GPIO_EN_INT 0xA8 | ||
146 | #define RC5T583_GPIO_MON_IOIN 0xAB | ||
147 | #define RC5T583_GPIO_GPOFUNC 0xAC | ||
148 | |||
149 | /* RICOH_RC5T583 IRQ definitions */ | ||
150 | enum { | ||
151 | RC5T583_IRQ_ONKEY, | ||
152 | RC5T583_IRQ_ACOK, | ||
153 | RC5T583_IRQ_LIDOPEN, | ||
154 | RC5T583_IRQ_PREOT, | ||
155 | RC5T583_IRQ_CLKSTP, | ||
156 | RC5T583_IRQ_ONKEY_OFF, | ||
157 | RC5T583_IRQ_WD, | ||
158 | RC5T583_IRQ_EN_PWRREQ1, | ||
159 | RC5T583_IRQ_EN_PWRREQ2, | ||
160 | RC5T583_IRQ_PRE_VINDET, | ||
161 | |||
162 | RC5T583_IRQ_DC0LIM, | ||
163 | RC5T583_IRQ_DC1LIM, | ||
164 | RC5T583_IRQ_DC2LIM, | ||
165 | RC5T583_IRQ_DC3LIM, | ||
166 | |||
167 | RC5T583_IRQ_CTC, | ||
168 | RC5T583_IRQ_YALE, | ||
169 | RC5T583_IRQ_DALE, | ||
170 | RC5T583_IRQ_WALE, | ||
171 | |||
172 | RC5T583_IRQ_AIN1L, | ||
173 | RC5T583_IRQ_AIN2L, | ||
174 | RC5T583_IRQ_AIN3L, | ||
175 | RC5T583_IRQ_VBATL, | ||
176 | RC5T583_IRQ_VIN3L, | ||
177 | RC5T583_IRQ_VIN8L, | ||
178 | RC5T583_IRQ_AIN1H, | ||
179 | RC5T583_IRQ_AIN2H, | ||
180 | RC5T583_IRQ_AIN3H, | ||
181 | RC5T583_IRQ_VBATH, | ||
182 | RC5T583_IRQ_VIN3H, | ||
183 | RC5T583_IRQ_VIN8H, | ||
184 | RC5T583_IRQ_ADCEND, | ||
185 | |||
186 | RC5T583_IRQ_GPIO0, | ||
187 | RC5T583_IRQ_GPIO1, | ||
188 | RC5T583_IRQ_GPIO2, | ||
189 | RC5T583_IRQ_GPIO3, | ||
190 | RC5T583_IRQ_GPIO4, | ||
191 | RC5T583_IRQ_GPIO5, | ||
192 | RC5T583_IRQ_GPIO6, | ||
193 | RC5T583_IRQ_GPIO7, | ||
194 | |||
195 | /* Should be last entry */ | ||
196 | RC5T583_MAX_IRQS, | ||
197 | }; | ||
198 | |||
199 | /* Ricoh583 gpio definitions */ | ||
200 | enum { | ||
201 | RC5T583_GPIO0, | ||
202 | RC5T583_GPIO1, | ||
203 | RC5T583_GPIO2, | ||
204 | RC5T583_GPIO3, | ||
205 | RC5T583_GPIO4, | ||
206 | RC5T583_GPIO5, | ||
207 | RC5T583_GPIO6, | ||
208 | RC5T583_GPIO7, | ||
209 | |||
210 | /* Should be last entry */ | ||
211 | RC5T583_MAX_GPIO, | ||
212 | }; | ||
213 | |||
214 | enum { | ||
215 | RC5T583_DS_NONE, | ||
216 | RC5T583_DS_DC0, | ||
217 | RC5T583_DS_DC1, | ||
218 | RC5T583_DS_DC2, | ||
219 | RC5T583_DS_DC3, | ||
220 | RC5T583_DS_LDO0, | ||
221 | RC5T583_DS_LDO1, | ||
222 | RC5T583_DS_LDO2, | ||
223 | RC5T583_DS_LDO3, | ||
224 | RC5T583_DS_LDO4, | ||
225 | RC5T583_DS_LDO5, | ||
226 | RC5T583_DS_LDO6, | ||
227 | RC5T583_DS_LDO7, | ||
228 | RC5T583_DS_LDO8, | ||
229 | RC5T583_DS_LDO9, | ||
230 | RC5T583_DS_PSO0, | ||
231 | RC5T583_DS_PSO1, | ||
232 | RC5T583_DS_PSO2, | ||
233 | RC5T583_DS_PSO3, | ||
234 | RC5T583_DS_PSO4, | ||
235 | RC5T583_DS_PSO5, | ||
236 | RC5T583_DS_PSO6, | ||
237 | RC5T583_DS_PSO7, | ||
238 | |||
239 | /* Should be last entry */ | ||
240 | RC5T583_DS_MAX, | ||
241 | }; | ||
242 | |||
243 | /* | ||
244 | * Ricoh pmic RC5T583 supports sleep through two external controls. | ||
245 | * The output of gpios and regulator can be enable/disable through | ||
246 | * this external signals. | ||
247 | */ | ||
248 | enum { | ||
249 | RC5T583_EXT_PWRREQ1_CONTROL = 0x1, | ||
250 | RC5T583_EXT_PWRREQ2_CONTROL = 0x2, | ||
251 | }; | ||
252 | |||
253 | struct rc5t583 { | ||
254 | struct device *dev; | ||
255 | struct regmap *regmap; | ||
256 | int chip_irq; | ||
257 | int irq_base; | ||
258 | struct mutex irq_lock; | ||
259 | unsigned long group_irq_en[MAX_MAIN_INTERRUPT]; | ||
260 | |||
261 | /* For main interrupt bits in INTC */ | ||
262 | uint8_t intc_inten_reg; | ||
263 | |||
264 | /* For group interrupt bits and address */ | ||
265 | uint8_t irq_en_reg[RC5T583_MAX_INTERRUPT_MASK_REGS]; | ||
266 | |||
267 | /* For gpio edge */ | ||
268 | uint8_t gpedge_reg[RC5T583_MAX_GPEDGE_REG]; | ||
269 | }; | ||
270 | |||
271 | /* | ||
272 | * rc5t583_platform_data: Platform data for ricoh rc5t583 pmu. | ||
273 | * The board specific data is provided through this structure. | ||
274 | * @irq_base: Irq base number on which this device registers their interrupts. | ||
275 | * @enable_shutdown: Enable shutdown through the input pin "shutdown". | ||
276 | */ | ||
277 | |||
278 | struct rc5t583_platform_data { | ||
279 | int irq_base; | ||
280 | bool enable_shutdown; | ||
281 | }; | ||
282 | |||
283 | static inline int rc5t583_write(struct device *dev, uint8_t reg, uint8_t val) | ||
284 | { | ||
285 | struct rc5t583 *rc5t583 = dev_get_drvdata(dev); | ||
286 | return regmap_write(rc5t583->regmap, reg, val); | ||
287 | } | ||
288 | |||
289 | static inline int rc5t583_read(struct device *dev, uint8_t reg, uint8_t *val) | ||
290 | { | ||
291 | struct rc5t583 *rc5t583 = dev_get_drvdata(dev); | ||
292 | unsigned int ival; | ||
293 | int ret; | ||
294 | ret = regmap_read(rc5t583->regmap, reg, &ival); | ||
295 | if (!ret) | ||
296 | *val = (uint8_t)ival; | ||
297 | return ret; | ||
298 | } | ||
299 | |||
300 | static inline int rc5t583_set_bits(struct device *dev, unsigned int reg, | ||
301 | unsigned int bit_mask) | ||
302 | { | ||
303 | struct rc5t583 *rc5t583 = dev_get_drvdata(dev); | ||
304 | return regmap_update_bits(rc5t583->regmap, reg, bit_mask, bit_mask); | ||
305 | } | ||
306 | |||
307 | static inline int rc5t583_clear_bits(struct device *dev, unsigned int reg, | ||
308 | unsigned int bit_mask) | ||
309 | { | ||
310 | struct rc5t583 *rc5t583 = dev_get_drvdata(dev); | ||
311 | return regmap_update_bits(rc5t583->regmap, reg, bit_mask, 0); | ||
312 | } | ||
313 | |||
314 | static inline int rc5t583_update(struct device *dev, unsigned int reg, | ||
315 | unsigned int val, unsigned int mask) | ||
316 | { | ||
317 | struct rc5t583 *rc5t583 = dev_get_drvdata(dev); | ||
318 | return regmap_update_bits(rc5t583->regmap, reg, mask, val); | ||
319 | } | ||
320 | |||
321 | int rc5t583_ext_power_req_config(struct device *dev, int deepsleep_id, | ||
322 | int ext_pwr_req, int deepsleep_slot_nr); | ||
323 | int rc5t583_irq_init(struct rc5t583 *rc5t583, int irq, int irq_base); | ||
324 | int rc5t583_irq_exit(struct rc5t583 *rc5t583); | ||
325 | |||
326 | #endif | ||
diff --git a/include/linux/mfd/stmpe.h b/include/linux/mfd/stmpe.h index ca1d7a347600..8516fd1eaabc 100644 --- a/include/linux/mfd/stmpe.h +++ b/include/linux/mfd/stmpe.h | |||
@@ -8,7 +8,9 @@ | |||
8 | #ifndef __LINUX_MFD_STMPE_H | 8 | #ifndef __LINUX_MFD_STMPE_H |
9 | #define __LINUX_MFD_STMPE_H | 9 | #define __LINUX_MFD_STMPE_H |
10 | 10 | ||
11 | #include <linux/device.h> | 11 | #include <linux/mutex.h> |
12 | |||
13 | struct device; | ||
12 | 14 | ||
13 | enum stmpe_block { | 15 | enum stmpe_block { |
14 | STMPE_BLOCK_GPIO = 1 << 0, | 16 | STMPE_BLOCK_GPIO = 1 << 0, |
@@ -26,6 +28,7 @@ enum stmpe_partnum { | |||
26 | STMPE1601, | 28 | STMPE1601, |
27 | STMPE2401, | 29 | STMPE2401, |
28 | STMPE2403, | 30 | STMPE2403, |
31 | STMPE_NBR_PARTS | ||
29 | }; | 32 | }; |
30 | 33 | ||
31 | /* | 34 | /* |
diff --git a/include/linux/mfd/tc3589x.h b/include/linux/mfd/tc3589x.h index 16c76e124f9c..3acb3a8e3af5 100644 --- a/include/linux/mfd/tc3589x.h +++ b/include/linux/mfd/tc3589x.h | |||
@@ -7,7 +7,7 @@ | |||
7 | #ifndef __LINUX_MFD_TC3589x_H | 7 | #ifndef __LINUX_MFD_TC3589x_H |
8 | #define __LINUX_MFD_TC3589x_H | 8 | #define __LINUX_MFD_TC3589x_H |
9 | 9 | ||
10 | #include <linux/device.h> | 10 | struct device; |
11 | 11 | ||
12 | enum tx3589x_block { | 12 | enum tx3589x_block { |
13 | TC3589x_BLOCK_GPIO = 1 << 0, | 13 | TC3589x_BLOCK_GPIO = 1 << 0, |
diff --git a/include/linux/mfd/tmio.h b/include/linux/mfd/tmio.h index 0dc98044d8b7..f5171dbf8850 100644 --- a/include/linux/mfd/tmio.h +++ b/include/linux/mfd/tmio.h | |||
@@ -1,8 +1,10 @@ | |||
1 | #ifndef MFD_TMIO_H | 1 | #ifndef MFD_TMIO_H |
2 | #define MFD_TMIO_H | 2 | #define MFD_TMIO_H |
3 | 3 | ||
4 | #include <linux/device.h> | ||
4 | #include <linux/fb.h> | 5 | #include <linux/fb.h> |
5 | #include <linux/io.h> | 6 | #include <linux/io.h> |
7 | #include <linux/jiffies.h> | ||
6 | #include <linux/platform_device.h> | 8 | #include <linux/platform_device.h> |
7 | #include <linux/pm_runtime.h> | 9 | #include <linux/pm_runtime.h> |
8 | 10 | ||
@@ -64,8 +66,8 @@ | |||
64 | #define TMIO_MMC_SDIO_IRQ (1 << 2) | 66 | #define TMIO_MMC_SDIO_IRQ (1 << 2) |
65 | /* | 67 | /* |
66 | * Some platforms can detect card insertion events with controller powered | 68 | * Some platforms can detect card insertion events with controller powered |
67 | * down, in which case they have to call tmio_mmc_cd_wakeup() to power up the | 69 | * down, using a GPIO IRQ, in which case they have to fill in cd_irq, cd_gpio, |
68 | * controller and report the event to the driver. | 70 | * and cd_flags fields of struct tmio_mmc_data. |
69 | */ | 71 | */ |
70 | #define TMIO_MMC_HAS_COLD_CD (1 << 3) | 72 | #define TMIO_MMC_HAS_COLD_CD (1 << 3) |
71 | /* | 73 | /* |
@@ -73,6 +75,12 @@ | |||
73 | * idle before writing to some registers. | 75 | * idle before writing to some registers. |
74 | */ | 76 | */ |
75 | #define TMIO_MMC_HAS_IDLE_WAIT (1 << 4) | 77 | #define TMIO_MMC_HAS_IDLE_WAIT (1 << 4) |
78 | /* | ||
79 | * A GPIO is used for card hotplug detection. We need an extra flag for this, | ||
80 | * because 0 is a valid GPIO number too, and requiring users to specify | ||
81 | * cd_gpio < 0 to disable GPIO hotplug would break backwards compatibility. | ||
82 | */ | ||
83 | #define TMIO_MMC_USE_GPIO_CD (1 << 5) | ||
76 | 84 | ||
77 | int tmio_core_mmc_enable(void __iomem *cnf, int shift, unsigned long base); | 85 | int tmio_core_mmc_enable(void __iomem *cnf, int shift, unsigned long base); |
78 | int tmio_core_mmc_resume(void __iomem *cnf, int shift, unsigned long base); | 86 | int tmio_core_mmc_resume(void __iomem *cnf, int shift, unsigned long base); |
@@ -97,19 +105,23 @@ struct tmio_mmc_data { | |||
97 | u32 ocr_mask; /* available voltages */ | 105 | u32 ocr_mask; /* available voltages */ |
98 | struct tmio_mmc_dma *dma; | 106 | struct tmio_mmc_dma *dma; |
99 | struct device *dev; | 107 | struct device *dev; |
100 | bool power; | 108 | unsigned int cd_gpio; |
101 | void (*set_pwr)(struct platform_device *host, int state); | 109 | void (*set_pwr)(struct platform_device *host, int state); |
102 | void (*set_clk_div)(struct platform_device *host, int state); | 110 | void (*set_clk_div)(struct platform_device *host, int state); |
103 | int (*get_cd)(struct platform_device *host); | 111 | int (*get_cd)(struct platform_device *host); |
104 | int (*write16_hook)(struct tmio_mmc_host *host, int addr); | 112 | int (*write16_hook)(struct tmio_mmc_host *host, int addr); |
105 | }; | 113 | }; |
106 | 114 | ||
115 | /* | ||
116 | * This function is deprecated and will be removed soon. Please, convert your | ||
117 | * platform to use drivers/mmc/core/cd-gpio.c | ||
118 | */ | ||
119 | #include <linux/mmc/host.h> | ||
107 | static inline void tmio_mmc_cd_wakeup(struct tmio_mmc_data *pdata) | 120 | static inline void tmio_mmc_cd_wakeup(struct tmio_mmc_data *pdata) |
108 | { | 121 | { |
109 | if (pdata && !pdata->power) { | 122 | if (pdata) |
110 | pdata->power = true; | 123 | mmc_detect_change(dev_get_drvdata(pdata->dev), |
111 | pm_runtime_get(pdata->dev); | 124 | msecs_to_jiffies(100)); |
112 | } | ||
113 | } | 125 | } |
114 | 126 | ||
115 | /* | 127 | /* |
diff --git a/include/linux/mfd/tps65090.h b/include/linux/mfd/tps65090.h new file mode 100644 index 000000000000..38e31c55adbb --- /dev/null +++ b/include/linux/mfd/tps65090.h | |||
@@ -0,0 +1,46 @@ | |||
1 | /* | ||
2 | * Core driver interface for TI TPS65090 PMIC family | ||
3 | * | ||
4 | * Copyright (C) 2012 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 | |||
22 | #ifndef __LINUX_MFD_TPS65090_H | ||
23 | #define __LINUX_MFD_TPS65090_H | ||
24 | |||
25 | struct tps65090_subdev_info { | ||
26 | int id; | ||
27 | const char *name; | ||
28 | void *platform_data; | ||
29 | }; | ||
30 | |||
31 | struct tps65090_platform_data { | ||
32 | int irq_base; | ||
33 | int num_subdevs; | ||
34 | struct tps65090_subdev_info *subdevs; | ||
35 | }; | ||
36 | |||
37 | /* | ||
38 | * NOTE: the functions below are not intended for use outside | ||
39 | * of the TPS65090 sub-device drivers | ||
40 | */ | ||
41 | extern int tps65090_write(struct device *dev, int reg, uint8_t val); | ||
42 | extern int tps65090_read(struct device *dev, int reg, uint8_t *val); | ||
43 | extern int tps65090_set_bits(struct device *dev, int reg, uint8_t bit_num); | ||
44 | extern int tps65090_clr_bits(struct device *dev, int reg, uint8_t bit_num); | ||
45 | |||
46 | #endif /*__LINUX_MFD_TPS65090_H */ | ||
diff --git a/include/linux/mfd/tps65217.h b/include/linux/mfd/tps65217.h new file mode 100644 index 000000000000..e030ef9a64ee --- /dev/null +++ b/include/linux/mfd/tps65217.h | |||
@@ -0,0 +1,283 @@ | |||
1 | /* | ||
2 | * linux/mfd/tps65217.h | ||
3 | * | ||
4 | * Functions to access TPS65217 power management chip. | ||
5 | * | ||
6 | * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/ | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or | ||
9 | * modify it under the terms of the GNU General Public License as | ||
10 | * published by the Free Software Foundation version 2. | ||
11 | * | ||
12 | * This program is distributed "as is" WITHOUT ANY WARRANTY of any | ||
13 | * kind, whether express or implied; without even the implied warranty | ||
14 | * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
15 | * GNU General Public License for more details. | ||
16 | */ | ||
17 | |||
18 | #ifndef __LINUX_MFD_TPS65217_H | ||
19 | #define __LINUX_MFD_TPS65217_H | ||
20 | |||
21 | #include <linux/i2c.h> | ||
22 | #include <linux/regulator/driver.h> | ||
23 | #include <linux/regulator/machine.h> | ||
24 | |||
25 | /* I2C ID for TPS65217 part */ | ||
26 | #define TPS65217_I2C_ID 0x24 | ||
27 | |||
28 | /* All register addresses */ | ||
29 | #define TPS65217_REG_CHIPID 0X00 | ||
30 | #define TPS65217_REG_PPATH 0X01 | ||
31 | #define TPS65217_REG_INT 0X02 | ||
32 | #define TPS65217_REG_CHGCONFIG0 0X03 | ||
33 | #define TPS65217_REG_CHGCONFIG1 0X04 | ||
34 | #define TPS65217_REG_CHGCONFIG2 0X05 | ||
35 | #define TPS65217_REG_CHGCONFIG3 0X06 | ||
36 | #define TPS65217_REG_WLEDCTRL1 0X07 | ||
37 | #define TPS65217_REG_WLEDCTRL2 0X08 | ||
38 | #define TPS65217_REG_MUXCTRL 0X09 | ||
39 | #define TPS65217_REG_STATUS 0X0A | ||
40 | #define TPS65217_REG_PASSWORD 0X0B | ||
41 | #define TPS65217_REG_PGOOD 0X0C | ||
42 | #define TPS65217_REG_DEFPG 0X0D | ||
43 | #define TPS65217_REG_DEFDCDC1 0X0E | ||
44 | #define TPS65217_REG_DEFDCDC2 0X0F | ||
45 | #define TPS65217_REG_DEFDCDC3 0X10 | ||
46 | #define TPS65217_REG_DEFSLEW 0X11 | ||
47 | #define TPS65217_REG_DEFLDO1 0X12 | ||
48 | #define TPS65217_REG_DEFLDO2 0X13 | ||
49 | #define TPS65217_REG_DEFLS1 0X14 | ||
50 | #define TPS65217_REG_DEFLS2 0X15 | ||
51 | #define TPS65217_REG_ENABLE 0X16 | ||
52 | #define TPS65217_REG_DEFUVLO 0X18 | ||
53 | #define TPS65217_REG_SEQ1 0X19 | ||
54 | #define TPS65217_REG_SEQ2 0X1A | ||
55 | #define TPS65217_REG_SEQ3 0X1B | ||
56 | #define TPS65217_REG_SEQ4 0X1C | ||
57 | #define TPS65217_REG_SEQ5 0X1D | ||
58 | #define TPS65217_REG_SEQ6 0X1E | ||
59 | |||
60 | /* Register field definitions */ | ||
61 | #define TPS65217_CHIPID_CHIP_MASK 0xF0 | ||
62 | #define TPS65217_CHIPID_REV_MASK 0x0F | ||
63 | |||
64 | #define TPS65217_PPATH_ACSINK_ENABLE BIT(7) | ||
65 | #define TPS65217_PPATH_USBSINK_ENABLE BIT(6) | ||
66 | #define TPS65217_PPATH_AC_PW_ENABLE BIT(5) | ||
67 | #define TPS65217_PPATH_USB_PW_ENABLE BIT(4) | ||
68 | #define TPS65217_PPATH_AC_CURRENT_MASK 0x0C | ||
69 | #define TPS65217_PPATH_USB_CURRENT_MASK 0x03 | ||
70 | |||
71 | #define TPS65217_INT_PBM BIT(6) | ||
72 | #define TPS65217_INT_ACM BIT(5) | ||
73 | #define TPS65217_INT_USBM BIT(4) | ||
74 | #define TPS65217_INT_PBI BIT(2) | ||
75 | #define TPS65217_INT_ACI BIT(1) | ||
76 | #define TPS65217_INT_USBI BIT(0) | ||
77 | |||
78 | #define TPS65217_CHGCONFIG0_TREG BIT(7) | ||
79 | #define TPS65217_CHGCONFIG0_DPPM BIT(6) | ||
80 | #define TPS65217_CHGCONFIG0_TSUSP BIT(5) | ||
81 | #define TPS65217_CHGCONFIG0_TERMI BIT(4) | ||
82 | #define TPS65217_CHGCONFIG0_ACTIVE BIT(3) | ||
83 | #define TPS65217_CHGCONFIG0_CHGTOUT BIT(2) | ||
84 | #define TPS65217_CHGCONFIG0_PCHGTOUT BIT(1) | ||
85 | #define TPS65217_CHGCONFIG0_BATTEMP BIT(0) | ||
86 | |||
87 | #define TPS65217_CHGCONFIG1_TMR_MASK 0xC0 | ||
88 | #define TPS65217_CHGCONFIG1_TMR_ENABLE BIT(5) | ||
89 | #define TPS65217_CHGCONFIG1_NTC_TYPE BIT(4) | ||
90 | #define TPS65217_CHGCONFIG1_RESET BIT(3) | ||
91 | #define TPS65217_CHGCONFIG1_TERM BIT(2) | ||
92 | #define TPS65217_CHGCONFIG1_SUSP BIT(1) | ||
93 | #define TPS65217_CHGCONFIG1_CHG_EN BIT(0) | ||
94 | |||
95 | #define TPS65217_CHGCONFIG2_DYNTMR BIT(7) | ||
96 | #define TPS65217_CHGCONFIG2_VPREGHG BIT(6) | ||
97 | #define TPS65217_CHGCONFIG2_VOREG_MASK 0x30 | ||
98 | |||
99 | #define TPS65217_CHGCONFIG3_ICHRG_MASK 0xC0 | ||
100 | #define TPS65217_CHGCONFIG3_DPPMTH_MASK 0x30 | ||
101 | #define TPS65217_CHGCONFIG2_PCHRGT BIT(3) | ||
102 | #define TPS65217_CHGCONFIG2_TERMIF 0x06 | ||
103 | #define TPS65217_CHGCONFIG2_TRANGE BIT(0) | ||
104 | |||
105 | #define TPS65217_WLEDCTRL1_ISINK_ENABLE BIT(3) | ||
106 | #define TPS65217_WLEDCTRL1_ISEL BIT(2) | ||
107 | #define TPS65217_WLEDCTRL1_FDIM_MASK 0x03 | ||
108 | |||
109 | #define TPS65217_WLEDCTRL2_DUTY_MASK 0x7F | ||
110 | |||
111 | #define TPS65217_MUXCTRL_MUX_MASK 0x07 | ||
112 | |||
113 | #define TPS65217_STATUS_OFF BIT(7) | ||
114 | #define TPS65217_STATUS_ACPWR BIT(3) | ||
115 | #define TPS65217_STATUS_USBPWR BIT(2) | ||
116 | #define TPS65217_STATUS_PB BIT(0) | ||
117 | |||
118 | #define TPS65217_PASSWORD_REGS_UNLOCK 0x7D | ||
119 | |||
120 | #define TPS65217_PGOOD_LDO3_PG BIT(6) | ||
121 | #define TPS65217_PGOOD_LDO4_PG BIT(5) | ||
122 | #define TPS65217_PGOOD_DC1_PG BIT(4) | ||
123 | #define TPS65217_PGOOD_DC2_PG BIT(3) | ||
124 | #define TPS65217_PGOOD_DC3_PG BIT(2) | ||
125 | #define TPS65217_PGOOD_LDO1_PG BIT(1) | ||
126 | #define TPS65217_PGOOD_LDO2_PG BIT(0) | ||
127 | |||
128 | #define TPS65217_DEFPG_LDO1PGM BIT(3) | ||
129 | #define TPS65217_DEFPG_LDO2PGM BIT(2) | ||
130 | #define TPS65217_DEFPG_PGDLY_MASK 0x03 | ||
131 | |||
132 | #define TPS65217_DEFDCDCX_XADJX BIT(7) | ||
133 | #define TPS65217_DEFDCDCX_DCDC_MASK 0x3F | ||
134 | |||
135 | #define TPS65217_DEFSLEW_GO BIT(7) | ||
136 | #define TPS65217_DEFSLEW_GODSBL BIT(6) | ||
137 | #define TPS65217_DEFSLEW_PFM_EN1 BIT(5) | ||
138 | #define TPS65217_DEFSLEW_PFM_EN2 BIT(4) | ||
139 | #define TPS65217_DEFSLEW_PFM_EN3 BIT(3) | ||
140 | #define TPS65217_DEFSLEW_SLEW_MASK 0x07 | ||
141 | |||
142 | #define TPS65217_DEFLDO1_LDO1_MASK 0x0F | ||
143 | |||
144 | #define TPS65217_DEFLDO2_TRACK BIT(6) | ||
145 | #define TPS65217_DEFLDO2_LDO2_MASK 0x3F | ||
146 | |||
147 | #define TPS65217_DEFLDO3_LDO3_EN BIT(5) | ||
148 | #define TPS65217_DEFLDO3_LDO3_MASK 0x1F | ||
149 | |||
150 | #define TPS65217_DEFLDO4_LDO4_EN BIT(5) | ||
151 | #define TPS65217_DEFLDO4_LDO4_MASK 0x1F | ||
152 | |||
153 | #define TPS65217_ENABLE_LS1_EN BIT(6) | ||
154 | #define TPS65217_ENABLE_LS2_EN BIT(5) | ||
155 | #define TPS65217_ENABLE_DC1_EN BIT(4) | ||
156 | #define TPS65217_ENABLE_DC2_EN BIT(3) | ||
157 | #define TPS65217_ENABLE_DC3_EN BIT(2) | ||
158 | #define TPS65217_ENABLE_LDO1_EN BIT(1) | ||
159 | #define TPS65217_ENABLE_LDO2_EN BIT(0) | ||
160 | |||
161 | #define TPS65217_DEFUVLO_UVLOHYS BIT(2) | ||
162 | #define TPS65217_DEFUVLO_UVLO_MASK 0x03 | ||
163 | |||
164 | #define TPS65217_SEQ1_DC1_SEQ_MASK 0xF0 | ||
165 | #define TPS65217_SEQ1_DC2_SEQ_MASK 0x0F | ||
166 | |||
167 | #define TPS65217_SEQ2_DC3_SEQ_MASK 0xF0 | ||
168 | #define TPS65217_SEQ2_LDO1_SEQ_MASK 0x0F | ||
169 | |||
170 | #define TPS65217_SEQ3_LDO2_SEQ_MASK 0xF0 | ||
171 | #define TPS65217_SEQ3_LDO3_SEQ_MASK 0x0F | ||
172 | |||
173 | #define TPS65217_SEQ4_LDO4_SEQ_MASK 0xF0 | ||
174 | |||
175 | #define TPS65217_SEQ5_DLY1_MASK 0xC0 | ||
176 | #define TPS65217_SEQ5_DLY2_MASK 0x30 | ||
177 | #define TPS65217_SEQ5_DLY3_MASK 0x0C | ||
178 | #define TPS65217_SEQ5_DLY4_MASK 0x03 | ||
179 | |||
180 | #define TPS65217_SEQ6_DLY5_MASK 0xC0 | ||
181 | #define TPS65217_SEQ6_DLY6_MASK 0x30 | ||
182 | #define TPS65217_SEQ6_SEQUP BIT(2) | ||
183 | #define TPS65217_SEQ6_SEQDWN BIT(1) | ||
184 | #define TPS65217_SEQ6_INSTDWN BIT(0) | ||
185 | |||
186 | #define TPS65217_MAX_REGISTER 0x1E | ||
187 | #define TPS65217_PROTECT_NONE 0 | ||
188 | #define TPS65217_PROTECT_L1 1 | ||
189 | #define TPS65217_PROTECT_L2 2 | ||
190 | |||
191 | |||
192 | enum tps65217_regulator_id { | ||
193 | /* DCDC's */ | ||
194 | TPS65217_DCDC_1, | ||
195 | TPS65217_DCDC_2, | ||
196 | TPS65217_DCDC_3, | ||
197 | /* LDOs */ | ||
198 | TPS65217_LDO_1, | ||
199 | TPS65217_LDO_2, | ||
200 | TPS65217_LDO_3, | ||
201 | TPS65217_LDO_4, | ||
202 | }; | ||
203 | |||
204 | #define TPS65217_MAX_REG_ID TPS65217_LDO_4 | ||
205 | |||
206 | /* Number of step-down converters available */ | ||
207 | #define TPS65217_NUM_DCDC 3 | ||
208 | /* Number of LDO voltage regulators available */ | ||
209 | #define TPS65217_NUM_LDO 4 | ||
210 | /* Number of total regulators available */ | ||
211 | #define TPS65217_NUM_REGULATOR (TPS65217_NUM_DCDC + TPS65217_NUM_LDO) | ||
212 | |||
213 | /** | ||
214 | * struct tps65217_board - packages regulator init data | ||
215 | * @tps65217_regulator_data: regulator initialization values | ||
216 | * | ||
217 | * Board data may be used to initialize regulator. | ||
218 | */ | ||
219 | struct tps65217_board { | ||
220 | struct regulator_init_data *tps65217_init_data; | ||
221 | }; | ||
222 | |||
223 | /** | ||
224 | * struct tps_info - packages regulator constraints | ||
225 | * @name: Voltage regulator name | ||
226 | * @min_uV: minimum micro volts | ||
227 | * @max_uV: minimum micro volts | ||
228 | * @vsel_to_uv: Function pointer to get voltage from selector | ||
229 | * @uv_to_vsel: Function pointer to get selector from voltage | ||
230 | * @table: Table for non-uniform voltage step-size | ||
231 | * @table_len: Length of the voltage table | ||
232 | * @enable_mask: Regulator enable mask bits | ||
233 | * @set_vout_reg: Regulator output voltage set register | ||
234 | * @set_vout_mask: Regulator output voltage set mask | ||
235 | * | ||
236 | * This data is used to check the regualtor voltage limits while setting. | ||
237 | */ | ||
238 | struct tps_info { | ||
239 | const char *name; | ||
240 | int min_uV; | ||
241 | int max_uV; | ||
242 | int (*vsel_to_uv)(unsigned int vsel); | ||
243 | int (*uv_to_vsel)(int uV, unsigned int *vsel); | ||
244 | const int *table; | ||
245 | unsigned int table_len; | ||
246 | unsigned int enable_mask; | ||
247 | unsigned int set_vout_reg; | ||
248 | unsigned int set_vout_mask; | ||
249 | }; | ||
250 | |||
251 | /** | ||
252 | * struct tps65217 - tps65217 sub-driver chip access routines | ||
253 | * | ||
254 | * Device data may be used to access the TPS65217 chip | ||
255 | */ | ||
256 | |||
257 | struct tps65217 { | ||
258 | struct device *dev; | ||
259 | struct tps65217_board *pdata; | ||
260 | struct regulator_desc desc[TPS65217_NUM_REGULATOR]; | ||
261 | struct regulator_dev *rdev[TPS65217_NUM_REGULATOR]; | ||
262 | struct tps_info *info[TPS65217_NUM_REGULATOR]; | ||
263 | struct regmap *regmap; | ||
264 | |||
265 | /* Client devices */ | ||
266 | struct platform_device *regulator_pdev[TPS65217_NUM_REGULATOR]; | ||
267 | }; | ||
268 | |||
269 | static inline struct tps65217 *dev_to_tps65217(struct device *dev) | ||
270 | { | ||
271 | return dev_get_drvdata(dev); | ||
272 | } | ||
273 | |||
274 | int tps65217_reg_read(struct tps65217 *tps, unsigned int reg, | ||
275 | unsigned int *val); | ||
276 | int tps65217_reg_write(struct tps65217 *tps, unsigned int reg, | ||
277 | unsigned int val, unsigned int level); | ||
278 | int tps65217_set_bits(struct tps65217 *tps, unsigned int reg, | ||
279 | unsigned int mask, unsigned int val, unsigned int level); | ||
280 | int tps65217_clear_bits(struct tps65217 *tps, unsigned int reg, | ||
281 | unsigned int mask, unsigned int level); | ||
282 | |||
283 | #endif /* __LINUX_MFD_TPS65217_H */ | ||
diff --git a/include/linux/mfd/tps65910.h b/include/linux/mfd/tps65910.h index d0cb12eba402..1c6c2860d1a6 100644 --- a/include/linux/mfd/tps65910.h +++ b/include/linux/mfd/tps65910.h | |||
@@ -17,6 +17,8 @@ | |||
17 | #ifndef __LINUX_MFD_TPS65910_H | 17 | #ifndef __LINUX_MFD_TPS65910_H |
18 | #define __LINUX_MFD_TPS65910_H | 18 | #define __LINUX_MFD_TPS65910_H |
19 | 19 | ||
20 | #include <linux/gpio.h> | ||
21 | |||
20 | /* TPS chip id list */ | 22 | /* TPS chip id list */ |
21 | #define TPS65910 0 | 23 | #define TPS65910 0 |
22 | #define TPS65911 1 | 24 | #define TPS65911 1 |
@@ -657,6 +659,8 @@ | |||
657 | 659 | ||
658 | 660 | ||
659 | /*Register GPIO (0x80) register.RegisterDescription */ | 661 | /*Register GPIO (0x80) register.RegisterDescription */ |
662 | #define GPIO_SLEEP_MASK 0x80 | ||
663 | #define GPIO_SLEEP_SHIFT 7 | ||
660 | #define GPIO_DEB_MASK 0x10 | 664 | #define GPIO_DEB_MASK 0x10 |
661 | #define GPIO_DEB_SHIFT 4 | 665 | #define GPIO_DEB_SHIFT 4 |
662 | #define GPIO_PUEN_MASK 0x08 | 666 | #define GPIO_PUEN_MASK 0x08 |
@@ -740,6 +744,11 @@ | |||
740 | #define TPS65910_GPIO_STS BIT(1) | 744 | #define TPS65910_GPIO_STS BIT(1) |
741 | #define TPS65910_GPIO_SET BIT(0) | 745 | #define TPS65910_GPIO_SET BIT(0) |
742 | 746 | ||
747 | /* Max number of TPS65910/11 GPIOs */ | ||
748 | #define TPS65910_NUM_GPIO 6 | ||
749 | #define TPS65911_NUM_GPIO 9 | ||
750 | #define TPS6591X_MAX_NUM_GPIO 9 | ||
751 | |||
743 | /* Regulator Index Definitions */ | 752 | /* Regulator Index Definitions */ |
744 | #define TPS65910_REG_VRTC 0 | 753 | #define TPS65910_REG_VRTC 0 |
745 | #define TPS65910_REG_VIO 1 | 754 | #define TPS65910_REG_VIO 1 |
@@ -768,6 +777,12 @@ | |||
768 | /* Max number of TPS65910/11 regulators */ | 777 | /* Max number of TPS65910/11 regulators */ |
769 | #define TPS65910_NUM_REGS 13 | 778 | #define TPS65910_NUM_REGS 13 |
770 | 779 | ||
780 | /* External sleep controls through EN1/EN2/EN3/SLEEP inputs */ | ||
781 | #define TPS65910_SLEEP_CONTROL_EXT_INPUT_EN1 0x1 | ||
782 | #define TPS65910_SLEEP_CONTROL_EXT_INPUT_EN2 0x2 | ||
783 | #define TPS65910_SLEEP_CONTROL_EXT_INPUT_EN3 0x4 | ||
784 | #define TPS65911_SLEEP_CONTROL_EXT_INPUT_SLEEP 0x8 | ||
785 | |||
771 | /** | 786 | /** |
772 | * struct tps65910_board | 787 | * struct tps65910_board |
773 | * Board platform data may be used to initialize regulators. | 788 | * Board platform data may be used to initialize regulators. |
@@ -779,6 +794,8 @@ struct tps65910_board { | |||
779 | int irq_base; | 794 | int irq_base; |
780 | int vmbch_threshold; | 795 | int vmbch_threshold; |
781 | int vmbch2_threshold; | 796 | int vmbch2_threshold; |
797 | bool en_gpio_sleep[TPS6591X_MAX_NUM_GPIO]; | ||
798 | unsigned long regulator_ext_sleep_control[TPS65910_NUM_REGS]; | ||
782 | struct regulator_init_data *tps65910_pmic_init_data[TPS65910_NUM_REGS]; | 799 | struct regulator_init_data *tps65910_pmic_init_data[TPS65910_NUM_REGS]; |
783 | }; | 800 | }; |
784 | 801 | ||
@@ -789,6 +806,7 @@ struct tps65910_board { | |||
789 | struct tps65910 { | 806 | struct tps65910 { |
790 | struct device *dev; | 807 | struct device *dev; |
791 | struct i2c_client *i2c_client; | 808 | struct i2c_client *i2c_client; |
809 | struct regmap *regmap; | ||
792 | struct mutex io_mutex; | 810 | struct mutex io_mutex; |
793 | unsigned int id; | 811 | unsigned int id; |
794 | int (*read)(struct tps65910 *tps65910, u8 reg, int size, void *dest); | 812 | int (*read)(struct tps65910 *tps65910, u8 reg, int size, void *dest); |
diff --git a/include/linux/mfd/twl6040.h b/include/linux/mfd/twl6040.h index 9bc9ac651dad..b15b5f03f5c4 100644 --- a/include/linux/mfd/twl6040.h +++ b/include/linux/mfd/twl6040.h | |||
@@ -174,8 +174,35 @@ | |||
174 | #define TWL6040_SYSCLK_SEL_LPPLL 0 | 174 | #define TWL6040_SYSCLK_SEL_LPPLL 0 |
175 | #define TWL6040_SYSCLK_SEL_HPPLL 1 | 175 | #define TWL6040_SYSCLK_SEL_HPPLL 1 |
176 | 176 | ||
177 | struct twl6040_codec_data { | ||
178 | u16 hs_left_step; | ||
179 | u16 hs_right_step; | ||
180 | u16 hf_left_step; | ||
181 | u16 hf_right_step; | ||
182 | }; | ||
183 | |||
184 | struct twl6040_vibra_data { | ||
185 | unsigned int vibldrv_res; /* left driver resistance */ | ||
186 | unsigned int vibrdrv_res; /* right driver resistance */ | ||
187 | unsigned int viblmotor_res; /* left motor resistance */ | ||
188 | unsigned int vibrmotor_res; /* right motor resistance */ | ||
189 | int vddvibl_uV; /* VDDVIBL volt, set 0 for fixed reg */ | ||
190 | int vddvibr_uV; /* VDDVIBR volt, set 0 for fixed reg */ | ||
191 | }; | ||
192 | |||
193 | struct twl6040_platform_data { | ||
194 | int audpwron_gpio; /* audio power-on gpio */ | ||
195 | unsigned int irq_base; | ||
196 | |||
197 | struct twl6040_codec_data *codec; | ||
198 | struct twl6040_vibra_data *vibra; | ||
199 | }; | ||
200 | |||
201 | struct regmap; | ||
202 | |||
177 | struct twl6040 { | 203 | struct twl6040 { |
178 | struct device *dev; | 204 | struct device *dev; |
205 | struct regmap *regmap; | ||
179 | struct mutex mutex; | 206 | struct mutex mutex; |
180 | struct mutex io_mutex; | 207 | struct mutex io_mutex; |
181 | struct mutex irq_mutex; | 208 | struct mutex irq_mutex; |
diff --git a/include/linux/mfd/ucb1x00.h b/include/linux/mfd/ucb1x00.h index 4321f044d1e4..28af41756360 100644 --- a/include/linux/mfd/ucb1x00.h +++ b/include/linux/mfd/ucb1x00.h | |||
@@ -12,7 +12,7 @@ | |||
12 | 12 | ||
13 | #include <linux/mfd/mcp.h> | 13 | #include <linux/mfd/mcp.h> |
14 | #include <linux/gpio.h> | 14 | #include <linux/gpio.h> |
15 | #include <linux/semaphore.h> | 15 | #include <linux/mutex.h> |
16 | 16 | ||
17 | #define UCB_IO_DATA 0x00 | 17 | #define UCB_IO_DATA 0x00 |
18 | #define UCB_IO_DIR 0x01 | 18 | #define UCB_IO_DIR 0x01 |
@@ -104,17 +104,27 @@ | |||
104 | #define UCB_MODE_DYN_VFLAG_ENA (1 << 12) | 104 | #define UCB_MODE_DYN_VFLAG_ENA (1 << 12) |
105 | #define UCB_MODE_AUD_OFF_CAN (1 << 13) | 105 | #define UCB_MODE_AUD_OFF_CAN (1 << 13) |
106 | 106 | ||
107 | enum ucb1x00_reset { | ||
108 | UCB_RST_PROBE, | ||
109 | UCB_RST_RESUME, | ||
110 | UCB_RST_SUSPEND, | ||
111 | UCB_RST_REMOVE, | ||
112 | UCB_RST_PROBE_FAIL, | ||
113 | }; | ||
107 | 114 | ||
108 | struct ucb1x00_irq { | 115 | struct ucb1x00_plat_data { |
109 | void *devid; | 116 | void (*reset)(enum ucb1x00_reset); |
110 | void (*fn)(int, void *); | 117 | unsigned irq_base; |
118 | int gpio_base; | ||
119 | unsigned can_wakeup; | ||
111 | }; | 120 | }; |
112 | 121 | ||
113 | struct ucb1x00 { | 122 | struct ucb1x00 { |
114 | spinlock_t lock; | 123 | raw_spinlock_t irq_lock; |
115 | struct mcp *mcp; | 124 | struct mcp *mcp; |
116 | unsigned int irq; | 125 | unsigned int irq; |
117 | struct semaphore adc_sem; | 126 | int irq_base; |
127 | struct mutex adc_mutex; | ||
118 | spinlock_t io_lock; | 128 | spinlock_t io_lock; |
119 | u16 id; | 129 | u16 id; |
120 | u16 io_dir; | 130 | u16 io_dir; |
@@ -122,7 +132,8 @@ struct ucb1x00 { | |||
122 | u16 adc_cr; | 132 | u16 adc_cr; |
123 | u16 irq_fal_enbl; | 133 | u16 irq_fal_enbl; |
124 | u16 irq_ris_enbl; | 134 | u16 irq_ris_enbl; |
125 | struct ucb1x00_irq irq_handler[16]; | 135 | u16 irq_mask; |
136 | u16 irq_wake; | ||
126 | struct device dev; | 137 | struct device dev; |
127 | struct list_head node; | 138 | struct list_head node; |
128 | struct list_head devs; | 139 | struct list_head devs; |
@@ -144,7 +155,7 @@ struct ucb1x00_driver { | |||
144 | struct list_head devs; | 155 | struct list_head devs; |
145 | int (*add)(struct ucb1x00_dev *dev); | 156 | int (*add)(struct ucb1x00_dev *dev); |
146 | void (*remove)(struct ucb1x00_dev *dev); | 157 | void (*remove)(struct ucb1x00_dev *dev); |
147 | int (*suspend)(struct ucb1x00_dev *dev, pm_message_t state); | 158 | int (*suspend)(struct ucb1x00_dev *dev); |
148 | int (*resume)(struct ucb1x00_dev *dev); | 159 | int (*resume)(struct ucb1x00_dev *dev); |
149 | }; | 160 | }; |
150 | 161 | ||
@@ -245,15 +256,4 @@ unsigned int ucb1x00_adc_read(struct ucb1x00 *ucb, int adc_channel, int sync); | |||
245 | void ucb1x00_adc_enable(struct ucb1x00 *ucb); | 256 | void ucb1x00_adc_enable(struct ucb1x00 *ucb); |
246 | void ucb1x00_adc_disable(struct ucb1x00 *ucb); | 257 | void ucb1x00_adc_disable(struct ucb1x00 *ucb); |
247 | 258 | ||
248 | /* | ||
249 | * Which edges of the IRQ do you want to control today? | ||
250 | */ | ||
251 | #define UCB_RISING (1 << 0) | ||
252 | #define UCB_FALLING (1 << 1) | ||
253 | |||
254 | int ucb1x00_hook_irq(struct ucb1x00 *ucb, unsigned int idx, void (*fn)(int, void *), void *devid); | ||
255 | void ucb1x00_enable_irq(struct ucb1x00 *ucb, unsigned int idx, int edges); | ||
256 | void ucb1x00_disable_irq(struct ucb1x00 *ucb, unsigned int idx, int edges); | ||
257 | int ucb1x00_free_irq(struct ucb1x00 *ucb, unsigned int idx, void *devid); | ||
258 | |||
259 | #endif | 259 | #endif |
diff --git a/include/linux/mfd/wm8994/pdata.h b/include/linux/mfd/wm8994/pdata.h index 3fb1f407d5e6..893267bb6229 100644 --- a/include/linux/mfd/wm8994/pdata.h +++ b/include/linux/mfd/wm8994/pdata.h | |||
@@ -22,7 +22,6 @@ struct wm8994_ldo_pdata { | |||
22 | /** GPIOs to enable regulator, 0 or less if not available */ | 22 | /** GPIOs to enable regulator, 0 or less if not available */ |
23 | int enable; | 23 | int enable; |
24 | 24 | ||
25 | const char *supply; | ||
26 | const struct regulator_init_data *init_data; | 25 | const struct regulator_init_data *init_data; |
27 | }; | 26 | }; |
28 | 27 | ||
@@ -185,6 +184,9 @@ struct wm8994_pdata { | |||
185 | unsigned int jd_scthr:2; | 184 | unsigned int jd_scthr:2; |
186 | unsigned int jd_thr:2; | 185 | unsigned int jd_thr:2; |
187 | 186 | ||
187 | /* Configure WM1811 jack detection for use with external capacitor */ | ||
188 | unsigned int jd_ext_cap:1; | ||
189 | |||
188 | /* WM8958 microphone bias configuration */ | 190 | /* WM8958 microphone bias configuration */ |
189 | int micbias[2]; | 191 | int micbias[2]; |
190 | 192 | ||
diff --git a/include/linux/migrate.h b/include/linux/migrate.h index 05ed2828a553..855c337b20c3 100644 --- a/include/linux/migrate.h +++ b/include/linux/migrate.h | |||
@@ -8,7 +8,6 @@ | |||
8 | typedef struct page *new_page_t(struct page *, unsigned long private, int **); | 8 | typedef struct page *new_page_t(struct page *, unsigned long private, int **); |
9 | 9 | ||
10 | #ifdef CONFIG_MIGRATION | 10 | #ifdef CONFIG_MIGRATION |
11 | #define PAGE_MIGRATION 1 | ||
12 | 11 | ||
13 | extern void putback_lru_pages(struct list_head *l); | 12 | extern void putback_lru_pages(struct list_head *l); |
14 | extern int migrate_page(struct address_space *, | 13 | extern int migrate_page(struct address_space *, |
@@ -32,7 +31,6 @@ extern void migrate_page_copy(struct page *newpage, struct page *page); | |||
32 | extern int migrate_huge_page_move_mapping(struct address_space *mapping, | 31 | extern int migrate_huge_page_move_mapping(struct address_space *mapping, |
33 | struct page *newpage, struct page *page); | 32 | struct page *newpage, struct page *page); |
34 | #else | 33 | #else |
35 | #define PAGE_MIGRATION 0 | ||
36 | 34 | ||
37 | static inline void putback_lru_pages(struct list_head *l) {} | 35 | static inline void putback_lru_pages(struct list_head *l) {} |
38 | static inline int migrate_pages(struct list_head *l, new_page_t x, | 36 | static inline int migrate_pages(struct list_head *l, new_page_t x, |
diff --git a/include/linux/mlx4/device.h b/include/linux/mlx4/device.h index aea61905499b..834c96c5d879 100644 --- a/include/linux/mlx4/device.h +++ b/include/linux/mlx4/device.h | |||
@@ -101,10 +101,6 @@ enum { | |||
101 | #define MLX4_ATTR_EXTENDED_PORT_INFO cpu_to_be16(0xff90) | 101 | #define MLX4_ATTR_EXTENDED_PORT_INFO cpu_to_be16(0xff90) |
102 | 102 | ||
103 | enum { | 103 | enum { |
104 | MLX_EXT_PORT_CAP_FLAG_EXTENDED_PORT_INFO = 1 << 0 | ||
105 | }; | ||
106 | |||
107 | enum { | ||
108 | MLX4_BMME_FLAG_LOCAL_INV = 1 << 6, | 104 | MLX4_BMME_FLAG_LOCAL_INV = 1 << 6, |
109 | MLX4_BMME_FLAG_REMOTE_INV = 1 << 7, | 105 | MLX4_BMME_FLAG_REMOTE_INV = 1 << 7, |
110 | MLX4_BMME_FLAG_TYPE_2_WIN = 1 << 9, | 106 | MLX4_BMME_FLAG_TYPE_2_WIN = 1 << 9, |
@@ -133,6 +129,7 @@ enum mlx4_event { | |||
133 | MLX4_EVENT_TYPE_CMD = 0x0a, | 129 | MLX4_EVENT_TYPE_CMD = 0x0a, |
134 | MLX4_EVENT_TYPE_VEP_UPDATE = 0x19, | 130 | MLX4_EVENT_TYPE_VEP_UPDATE = 0x19, |
135 | MLX4_EVENT_TYPE_COMM_CHANNEL = 0x18, | 131 | MLX4_EVENT_TYPE_COMM_CHANNEL = 0x18, |
132 | MLX4_EVENT_TYPE_FATAL_WARNING = 0x1b, | ||
136 | MLX4_EVENT_TYPE_FLR_EVENT = 0x1c, | 133 | MLX4_EVENT_TYPE_FLR_EVENT = 0x1c, |
137 | MLX4_EVENT_TYPE_NONE = 0xff, | 134 | MLX4_EVENT_TYPE_NONE = 0xff, |
138 | }; | 135 | }; |
@@ -143,6 +140,10 @@ enum { | |||
143 | }; | 140 | }; |
144 | 141 | ||
145 | enum { | 142 | enum { |
143 | MLX4_FATAL_WARNING_SUBTYPE_WARMING = 0, | ||
144 | }; | ||
145 | |||
146 | enum { | ||
146 | MLX4_PERM_LOCAL_READ = 1 << 10, | 147 | MLX4_PERM_LOCAL_READ = 1 << 10, |
147 | MLX4_PERM_LOCAL_WRITE = 1 << 11, | 148 | MLX4_PERM_LOCAL_WRITE = 1 << 11, |
148 | MLX4_PERM_REMOTE_READ = 1 << 12, | 149 | MLX4_PERM_REMOTE_READ = 1 << 12, |
@@ -273,6 +274,7 @@ struct mlx4_caps { | |||
273 | int num_comp_vectors; | 274 | int num_comp_vectors; |
274 | int comp_pool; | 275 | int comp_pool; |
275 | int num_mpts; | 276 | int num_mpts; |
277 | int max_fmr_maps; | ||
276 | int num_mtts; | 278 | int num_mtts; |
277 | int fmr_reserved_mtts; | 279 | int fmr_reserved_mtts; |
278 | int reserved_mtts; | 280 | int reserved_mtts; |
@@ -308,7 +310,7 @@ struct mlx4_caps { | |||
308 | u32 port_mask[MLX4_MAX_PORTS + 1]; | 310 | u32 port_mask[MLX4_MAX_PORTS + 1]; |
309 | enum mlx4_port_type possible_type[MLX4_MAX_PORTS + 1]; | 311 | enum mlx4_port_type possible_type[MLX4_MAX_PORTS + 1]; |
310 | u32 max_counters; | 312 | u32 max_counters; |
311 | u8 ext_port_cap[MLX4_MAX_PORTS + 1]; | 313 | u8 port_ib_mtu[MLX4_MAX_PORTS + 1]; |
312 | }; | 314 | }; |
313 | 315 | ||
314 | struct mlx4_buf_list { | 316 | struct mlx4_buf_list { |
@@ -622,7 +624,10 @@ int mlx4_replace_mac(struct mlx4_dev *dev, u8 port, int qpn, u64 new_mac); | |||
622 | int mlx4_get_eth_qp(struct mlx4_dev *dev, u8 port, u64 mac, int *qpn); | 624 | int mlx4_get_eth_qp(struct mlx4_dev *dev, u8 port, u64 mac, int *qpn); |
623 | void mlx4_put_eth_qp(struct mlx4_dev *dev, u8 port, u64 mac, int qpn); | 625 | void mlx4_put_eth_qp(struct mlx4_dev *dev, u8 port, u64 mac, int qpn); |
624 | void mlx4_set_stats_bitmap(struct mlx4_dev *dev, u64 *stats_bitmap); | 626 | void mlx4_set_stats_bitmap(struct mlx4_dev *dev, u64 *stats_bitmap); |
625 | 627 | int mlx4_SET_PORT_general(struct mlx4_dev *dev, u8 port, int mtu, | |
628 | u8 pptx, u8 pfctx, u8 pprx, u8 pfcrx); | ||
629 | int mlx4_SET_PORT_qpn_calc(struct mlx4_dev *dev, u8 port, u32 base_qpn, | ||
630 | u8 promisc); | ||
626 | int mlx4_find_cached_vlan(struct mlx4_dev *dev, u8 port, u16 vid, int *idx); | 631 | int mlx4_find_cached_vlan(struct mlx4_dev *dev, u8 port, u16 vid, int *idx); |
627 | int mlx4_register_vlan(struct mlx4_dev *dev, u8 port, u16 vlan, int *index); | 632 | int mlx4_register_vlan(struct mlx4_dev *dev, u8 port, u16 vlan, int *index); |
628 | void mlx4_unregister_vlan(struct mlx4_dev *dev, u8 port, int index); | 633 | void mlx4_unregister_vlan(struct mlx4_dev *dev, u8 port, int index); |
diff --git a/include/linux/mlx4/driver.h b/include/linux/mlx4/driver.h index e1eebf78caba..5f1298b1b5ef 100644 --- a/include/linux/mlx4/driver.h +++ b/include/linux/mlx4/driver.h | |||
@@ -33,7 +33,6 @@ | |||
33 | #ifndef MLX4_DRIVER_H | 33 | #ifndef MLX4_DRIVER_H |
34 | #define MLX4_DRIVER_H | 34 | #define MLX4_DRIVER_H |
35 | 35 | ||
36 | #include <linux/device.h> | ||
37 | #include <linux/mlx4/device.h> | 36 | #include <linux/mlx4/device.h> |
38 | 37 | ||
39 | struct mlx4_dev; | 38 | struct mlx4_dev; |
diff --git a/include/linux/mlx4/qp.h b/include/linux/mlx4/qp.h index bee8fa231276..091f9e7dc8b9 100644 --- a/include/linux/mlx4/qp.h +++ b/include/linux/mlx4/qp.h | |||
@@ -212,7 +212,10 @@ struct mlx4_wqe_ctrl_seg { | |||
212 | * [1] SE (solicited event) | 212 | * [1] SE (solicited event) |
213 | * [0] FL (force loopback) | 213 | * [0] FL (force loopback) |
214 | */ | 214 | */ |
215 | __be32 srcrb_flags; | 215 | union { |
216 | __be32 srcrb_flags; | ||
217 | __be16 srcrb_flags16[2]; | ||
218 | }; | ||
216 | /* | 219 | /* |
217 | * imm is immediate data for send/RDMA write w/ immediate; | 220 | * imm is immediate data for send/RDMA write w/ immediate; |
218 | * also invalidation key for send with invalidate; input | 221 | * also invalidation key for send with invalidate; input |
diff --git a/include/linux/mm.h b/include/linux/mm.h index 17b27cd269c4..74aa71bea1e4 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h | |||
@@ -6,6 +6,7 @@ | |||
6 | #ifdef __KERNEL__ | 6 | #ifdef __KERNEL__ |
7 | 7 | ||
8 | #include <linux/gfp.h> | 8 | #include <linux/gfp.h> |
9 | #include <linux/bug.h> | ||
9 | #include <linux/list.h> | 10 | #include <linux/list.h> |
10 | #include <linux/mmzone.h> | 11 | #include <linux/mmzone.h> |
11 | #include <linux/rbtree.h> | 12 | #include <linux/rbtree.h> |
@@ -111,7 +112,7 @@ extern unsigned int kobjsize(const void *objp); | |||
111 | #define VM_HUGEPAGE 0x01000000 /* MADV_HUGEPAGE marked this vma */ | 112 | #define VM_HUGEPAGE 0x01000000 /* MADV_HUGEPAGE marked this vma */ |
112 | #endif | 113 | #endif |
113 | #define VM_INSERTPAGE 0x02000000 /* The vma has had "vm_insert_page()" done on it */ | 114 | #define VM_INSERTPAGE 0x02000000 /* The vma has had "vm_insert_page()" done on it */ |
114 | #define VM_ALWAYSDUMP 0x04000000 /* Always include in core dumps */ | 115 | #define VM_NODUMP 0x04000000 /* Do not include in the core dump */ |
115 | 116 | ||
116 | #define VM_CAN_NONLINEAR 0x08000000 /* Has ->fault & does nonlinear pages */ | 117 | #define VM_CAN_NONLINEAR 0x08000000 /* Has ->fault & does nonlinear pages */ |
117 | #define VM_MIXEDMAP 0x10000000 /* Can contain "struct page" and pure PFN pages */ | 118 | #define VM_MIXEDMAP 0x10000000 /* Can contain "struct page" and pure PFN pages */ |
@@ -893,9 +894,9 @@ struct page *vm_normal_page(struct vm_area_struct *vma, unsigned long addr, | |||
893 | 894 | ||
894 | int zap_vma_ptes(struct vm_area_struct *vma, unsigned long address, | 895 | int zap_vma_ptes(struct vm_area_struct *vma, unsigned long address, |
895 | unsigned long size); | 896 | unsigned long size); |
896 | unsigned long zap_page_range(struct vm_area_struct *vma, unsigned long address, | 897 | void zap_page_range(struct vm_area_struct *vma, unsigned long address, |
897 | unsigned long size, struct zap_details *); | 898 | unsigned long size, struct zap_details *); |
898 | unsigned long unmap_vmas(struct mmu_gather *tlb, | 899 | void unmap_vmas(struct mmu_gather *tlb, |
899 | struct vm_area_struct *start_vma, unsigned long start_addr, | 900 | struct vm_area_struct *start_vma, unsigned long start_addr, |
900 | unsigned long end_addr, unsigned long *nr_accounted, | 901 | unsigned long end_addr, unsigned long *nr_accounted, |
901 | struct zap_details *); | 902 | struct zap_details *); |
@@ -953,7 +954,7 @@ extern void truncate_pagecache(struct inode *inode, loff_t old, loff_t new); | |||
953 | extern void truncate_setsize(struct inode *inode, loff_t newsize); | 954 | extern void truncate_setsize(struct inode *inode, loff_t newsize); |
954 | extern int vmtruncate(struct inode *inode, loff_t offset); | 955 | extern int vmtruncate(struct inode *inode, loff_t offset); |
955 | extern int vmtruncate_range(struct inode *inode, loff_t offset, loff_t end); | 956 | extern int vmtruncate_range(struct inode *inode, loff_t offset, loff_t end); |
956 | 957 | void truncate_pagecache_range(struct inode *inode, loff_t offset, loff_t end); | |
957 | int truncate_inode_page(struct address_space *mapping, struct page *page); | 958 | int truncate_inode_page(struct address_space *mapping, struct page *page); |
958 | int generic_error_remove_page(struct address_space *mapping, struct page *page); | 959 | int generic_error_remove_page(struct address_space *mapping, struct page *page); |
959 | 960 | ||
@@ -1040,6 +1041,9 @@ static inline int stack_guard_page_end(struct vm_area_struct *vma, | |||
1040 | !vma_growsup(vma->vm_next, addr); | 1041 | !vma_growsup(vma->vm_next, addr); |
1041 | } | 1042 | } |
1042 | 1043 | ||
1044 | extern pid_t | ||
1045 | vm_is_stack(struct task_struct *task, struct vm_area_struct *vma, int in_group); | ||
1046 | |||
1043 | extern unsigned long move_page_tables(struct vm_area_struct *vma, | 1047 | extern unsigned long move_page_tables(struct vm_area_struct *vma, |
1044 | unsigned long old_addr, struct vm_area_struct *new_vma, | 1048 | unsigned long old_addr, struct vm_area_struct *new_vma, |
1045 | unsigned long new_addr, unsigned long len); | 1049 | unsigned long new_addr, unsigned long len); |
@@ -1058,19 +1062,20 @@ int __get_user_pages_fast(unsigned long start, int nr_pages, int write, | |||
1058 | /* | 1062 | /* |
1059 | * per-process(per-mm_struct) statistics. | 1063 | * per-process(per-mm_struct) statistics. |
1060 | */ | 1064 | */ |
1061 | static inline void set_mm_counter(struct mm_struct *mm, int member, long value) | ||
1062 | { | ||
1063 | atomic_long_set(&mm->rss_stat.count[member], value); | ||
1064 | } | ||
1065 | |||
1066 | #if defined(SPLIT_RSS_COUNTING) | ||
1067 | unsigned long get_mm_counter(struct mm_struct *mm, int member); | ||
1068 | #else | ||
1069 | static inline unsigned long get_mm_counter(struct mm_struct *mm, int member) | 1065 | static inline unsigned long get_mm_counter(struct mm_struct *mm, int member) |
1070 | { | 1066 | { |
1071 | return atomic_long_read(&mm->rss_stat.count[member]); | 1067 | long val = atomic_long_read(&mm->rss_stat.count[member]); |
1072 | } | 1068 | |
1069 | #ifdef SPLIT_RSS_COUNTING | ||
1070 | /* | ||
1071 | * counter is updated in asynchronous manner and may go to minus. | ||
1072 | * But it's never be expected number for users. | ||
1073 | */ | ||
1074 | if (val < 0) | ||
1075 | val = 0; | ||
1073 | #endif | 1076 | #endif |
1077 | return (unsigned long)val; | ||
1078 | } | ||
1074 | 1079 | ||
1075 | static inline void add_mm_counter(struct mm_struct *mm, int member, long value) | 1080 | static inline void add_mm_counter(struct mm_struct *mm, int member, long value) |
1076 | { | 1081 | { |
@@ -1127,9 +1132,9 @@ static inline void setmax_mm_hiwater_rss(unsigned long *maxrss, | |||
1127 | } | 1132 | } |
1128 | 1133 | ||
1129 | #if defined(SPLIT_RSS_COUNTING) | 1134 | #if defined(SPLIT_RSS_COUNTING) |
1130 | void sync_mm_rss(struct task_struct *task, struct mm_struct *mm); | 1135 | void sync_mm_rss(struct mm_struct *mm); |
1131 | #else | 1136 | #else |
1132 | static inline void sync_mm_rss(struct task_struct *task, struct mm_struct *mm) | 1137 | static inline void sync_mm_rss(struct mm_struct *mm) |
1133 | { | 1138 | { |
1134 | } | 1139 | } |
1135 | #endif | 1140 | #endif |
@@ -1253,6 +1258,8 @@ static inline void pgtable_page_dtor(struct page *page) | |||
1253 | extern void free_area_init(unsigned long * zones_size); | 1258 | extern void free_area_init(unsigned long * zones_size); |
1254 | extern void free_area_init_node(int nid, unsigned long * zones_size, | 1259 | extern void free_area_init_node(int nid, unsigned long * zones_size, |
1255 | unsigned long zone_start_pfn, unsigned long *zholes_size); | 1260 | unsigned long zone_start_pfn, unsigned long *zholes_size); |
1261 | extern void free_initmem(void); | ||
1262 | |||
1256 | #ifdef CONFIG_HAVE_MEMBLOCK_NODE_MAP | 1263 | #ifdef CONFIG_HAVE_MEMBLOCK_NODE_MAP |
1257 | /* | 1264 | /* |
1258 | * With CONFIG_HAVE_MEMBLOCK_NODE_MAP set, an architecture may initialise its | 1265 | * With CONFIG_HAVE_MEMBLOCK_NODE_MAP set, an architecture may initialise its |
@@ -1291,8 +1298,6 @@ extern void get_pfn_range_for_nid(unsigned int nid, | |||
1291 | extern unsigned long find_min_pfn_with_active_regions(void); | 1298 | extern unsigned long find_min_pfn_with_active_regions(void); |
1292 | extern void free_bootmem_with_active_regions(int nid, | 1299 | extern void free_bootmem_with_active_regions(int nid, |
1293 | unsigned long max_low_pfn); | 1300 | unsigned long max_low_pfn); |
1294 | int add_from_early_node_map(struct range *range, int az, | ||
1295 | int nr_range, int nid); | ||
1296 | extern void sparse_memory_present_with_active_regions(int nid); | 1301 | extern void sparse_memory_present_with_active_regions(int nid); |
1297 | 1302 | ||
1298 | #endif /* CONFIG_HAVE_MEMBLOCK_NODE_MAP */ | 1303 | #endif /* CONFIG_HAVE_MEMBLOCK_NODE_MAP */ |
@@ -1388,29 +1393,20 @@ extern int install_special_mapping(struct mm_struct *mm, | |||
1388 | 1393 | ||
1389 | extern unsigned long get_unmapped_area(struct file *, unsigned long, unsigned long, unsigned long, unsigned long); | 1394 | extern unsigned long get_unmapped_area(struct file *, unsigned long, unsigned long, unsigned long, unsigned long); |
1390 | 1395 | ||
1391 | extern unsigned long do_mmap_pgoff(struct file *file, unsigned long addr, | ||
1392 | unsigned long len, unsigned long prot, | ||
1393 | unsigned long flag, unsigned long pgoff); | ||
1394 | extern unsigned long mmap_region(struct file *file, unsigned long addr, | 1396 | extern unsigned long mmap_region(struct file *file, unsigned long addr, |
1395 | unsigned long len, unsigned long flags, | 1397 | unsigned long len, unsigned long flags, |
1396 | vm_flags_t vm_flags, unsigned long pgoff); | 1398 | vm_flags_t vm_flags, unsigned long pgoff); |
1397 | 1399 | extern unsigned long do_mmap(struct file *, unsigned long, | |
1398 | static inline unsigned long do_mmap(struct file *file, unsigned long addr, | 1400 | unsigned long, unsigned long, |
1399 | unsigned long len, unsigned long prot, | 1401 | unsigned long, unsigned long); |
1400 | unsigned long flag, unsigned long offset) | ||
1401 | { | ||
1402 | unsigned long ret = -EINVAL; | ||
1403 | if ((offset + PAGE_ALIGN(len)) < offset) | ||
1404 | goto out; | ||
1405 | if (!(offset & ~PAGE_MASK)) | ||
1406 | ret = do_mmap_pgoff(file, addr, len, prot, flag, offset >> PAGE_SHIFT); | ||
1407 | out: | ||
1408 | return ret; | ||
1409 | } | ||
1410 | |||
1411 | extern int do_munmap(struct mm_struct *, unsigned long, size_t); | 1402 | extern int do_munmap(struct mm_struct *, unsigned long, size_t); |
1412 | 1403 | ||
1413 | extern unsigned long do_brk(unsigned long, unsigned long); | 1404 | /* These take the mm semaphore themselves */ |
1405 | extern unsigned long vm_brk(unsigned long, unsigned long); | ||
1406 | extern int vm_munmap(unsigned long, size_t); | ||
1407 | extern unsigned long vm_mmap(struct file *, unsigned long, | ||
1408 | unsigned long, unsigned long, | ||
1409 | unsigned long, unsigned long); | ||
1414 | 1410 | ||
1415 | /* truncate.c */ | 1411 | /* truncate.c */ |
1416 | extern void truncate_inode_pages(struct address_space *, loff_t); | 1412 | extern void truncate_inode_pages(struct address_space *, loff_t); |
@@ -1598,9 +1594,9 @@ void vmemmap_populate_print_last(void); | |||
1598 | 1594 | ||
1599 | enum mf_flags { | 1595 | enum mf_flags { |
1600 | MF_COUNT_INCREASED = 1 << 0, | 1596 | MF_COUNT_INCREASED = 1 << 0, |
1597 | MF_ACTION_REQUIRED = 1 << 1, | ||
1601 | }; | 1598 | }; |
1602 | extern void memory_failure(unsigned long pfn, int trapno); | 1599 | extern int memory_failure(unsigned long pfn, int trapno, int flags); |
1603 | extern int __memory_failure(unsigned long pfn, int trapno, int flags); | ||
1604 | extern void memory_failure_queue(unsigned long pfn, int trapno, int flags); | 1600 | extern void memory_failure_queue(unsigned long pfn, int trapno, int flags); |
1605 | extern int unpoison_memory(unsigned long pfn); | 1601 | extern int unpoison_memory(unsigned long pfn); |
1606 | extern int sysctl_memory_failure_early_kill; | 1602 | extern int sysctl_memory_failure_early_kill; |
diff --git a/include/linux/mmc/card.h b/include/linux/mmc/card.h index 19a41d1737af..629b823f8836 100644 --- a/include/linux/mmc/card.h +++ b/include/linux/mmc/card.h | |||
@@ -10,6 +10,7 @@ | |||
10 | #ifndef LINUX_MMC_CARD_H | 10 | #ifndef LINUX_MMC_CARD_H |
11 | #define LINUX_MMC_CARD_H | 11 | #define LINUX_MMC_CARD_H |
12 | 12 | ||
13 | #include <linux/device.h> | ||
13 | #include <linux/mmc/core.h> | 14 | #include <linux/mmc/core.h> |
14 | #include <linux/mod_devicetable.h> | 15 | #include <linux/mod_devicetable.h> |
15 | 16 | ||
@@ -71,6 +72,8 @@ struct mmc_ext_csd { | |||
71 | bool hpi_en; /* HPI enablebit */ | 72 | bool hpi_en; /* HPI enablebit */ |
72 | bool hpi; /* HPI support bit */ | 73 | bool hpi; /* HPI support bit */ |
73 | unsigned int hpi_cmd; /* cmd used as HPI */ | 74 | unsigned int hpi_cmd; /* cmd used as HPI */ |
75 | unsigned int data_sector_size; /* 512 bytes or 4KB */ | ||
76 | unsigned int data_tag_unit_size; /* DATA TAG UNIT size */ | ||
74 | unsigned int boot_ro_lock; /* ro lock support */ | 77 | unsigned int boot_ro_lock; /* ro lock support */ |
75 | bool boot_ro_lockable; | 78 | bool boot_ro_lockable; |
76 | u8 raw_partition_support; /* 160 */ | 79 | u8 raw_partition_support; /* 160 */ |
@@ -478,7 +481,7 @@ struct mmc_driver { | |||
478 | struct device_driver drv; | 481 | struct device_driver drv; |
479 | int (*probe)(struct mmc_card *); | 482 | int (*probe)(struct mmc_card *); |
480 | void (*remove)(struct mmc_card *); | 483 | void (*remove)(struct mmc_card *); |
481 | int (*suspend)(struct mmc_card *, pm_message_t); | 484 | int (*suspend)(struct mmc_card *); |
482 | int (*resume)(struct mmc_card *); | 485 | int (*resume)(struct mmc_card *); |
483 | }; | 486 | }; |
484 | 487 | ||
diff --git a/include/linux/mmc/cd-gpio.h b/include/linux/mmc/cd-gpio.h index a8e469783318..cefaba038ccb 100644 --- a/include/linux/mmc/cd-gpio.h +++ b/include/linux/mmc/cd-gpio.h | |||
@@ -12,8 +12,7 @@ | |||
12 | #define MMC_CD_GPIO_H | 12 | #define MMC_CD_GPIO_H |
13 | 13 | ||
14 | struct mmc_host; | 14 | struct mmc_host; |
15 | int mmc_cd_gpio_request(struct mmc_host *host, unsigned int gpio, | 15 | int mmc_cd_gpio_request(struct mmc_host *host, unsigned int gpio); |
16 | unsigned int irq, unsigned long flags); | ||
17 | void mmc_cd_gpio_free(struct mmc_host *host); | 16 | void mmc_cd_gpio_free(struct mmc_host *host); |
18 | 17 | ||
19 | #endif | 18 | #endif |
diff --git a/include/linux/mmc/core.h b/include/linux/mmc/core.h index 87a976cc5654..1b431c728b9a 100644 --- a/include/linux/mmc/core.h +++ b/include/linux/mmc/core.h | |||
@@ -9,7 +9,7 @@ | |||
9 | #define LINUX_MMC_CORE_H | 9 | #define LINUX_MMC_CORE_H |
10 | 10 | ||
11 | #include <linux/interrupt.h> | 11 | #include <linux/interrupt.h> |
12 | #include <linux/device.h> | 12 | #include <linux/completion.h> |
13 | 13 | ||
14 | struct request; | 14 | struct request; |
15 | struct mmc_data; | 15 | struct mmc_data; |
@@ -175,7 +175,6 @@ extern unsigned int mmc_align_data_size(struct mmc_card *, unsigned int); | |||
175 | 175 | ||
176 | extern int __mmc_claim_host(struct mmc_host *host, atomic_t *abort); | 176 | extern int __mmc_claim_host(struct mmc_host *host, atomic_t *abort); |
177 | extern void mmc_release_host(struct mmc_host *host); | 177 | extern void mmc_release_host(struct mmc_host *host); |
178 | extern void mmc_do_release_host(struct mmc_host *host); | ||
179 | extern int mmc_try_claim_host(struct mmc_host *host); | 178 | extern int mmc_try_claim_host(struct mmc_host *host); |
180 | 179 | ||
181 | extern int mmc_flush_cache(struct mmc_card *); | 180 | extern int mmc_flush_cache(struct mmc_card *); |
diff --git a/include/linux/mmc/dw_mmc.h b/include/linux/mmc/dw_mmc.h index aae5d1f1bb39..8f66e28f5a0f 100644 --- a/include/linux/mmc/dw_mmc.h +++ b/include/linux/mmc/dw_mmc.h | |||
@@ -76,7 +76,7 @@ struct mmc_data; | |||
76 | * @num_slots: Number of slots available. | 76 | * @num_slots: Number of slots available. |
77 | * @verid: Denote Version ID. | 77 | * @verid: Denote Version ID. |
78 | * @data_offset: Set the offset of DATA register according to VERID. | 78 | * @data_offset: Set the offset of DATA register according to VERID. |
79 | * @pdev: Platform device associated with the MMC controller. | 79 | * @dev: Device associated with the MMC controller. |
80 | * @pdata: Platform data associated with the MMC controller. | 80 | * @pdata: Platform data associated with the MMC controller. |
81 | * @slot: Slots sharing this MMC controller. | 81 | * @slot: Slots sharing this MMC controller. |
82 | * @fifo_depth: depth of FIFO. | 82 | * @fifo_depth: depth of FIFO. |
@@ -87,6 +87,8 @@ struct mmc_data; | |||
87 | * @push_data: Pointer to FIFO push function. | 87 | * @push_data: Pointer to FIFO push function. |
88 | * @pull_data: Pointer to FIFO pull function. | 88 | * @pull_data: Pointer to FIFO pull function. |
89 | * @quirks: Set of quirks that apply to specific versions of the IP. | 89 | * @quirks: Set of quirks that apply to specific versions of the IP. |
90 | * @irq_flags: The flags to be passed to request_irq. | ||
91 | * @irq: The irq value to be passed to request_irq. | ||
90 | * | 92 | * |
91 | * Locking | 93 | * Locking |
92 | * ======= | 94 | * ======= |
@@ -153,7 +155,7 @@ struct dw_mci { | |||
153 | u32 fifoth_val; | 155 | u32 fifoth_val; |
154 | u16 verid; | 156 | u16 verid; |
155 | u16 data_offset; | 157 | u16 data_offset; |
156 | struct platform_device *pdev; | 158 | struct device dev; |
157 | struct dw_mci_board *pdata; | 159 | struct dw_mci_board *pdata; |
158 | struct dw_mci_slot *slot[MAX_MCI_SLOTS]; | 160 | struct dw_mci_slot *slot[MAX_MCI_SLOTS]; |
159 | 161 | ||
@@ -174,6 +176,8 @@ struct dw_mci { | |||
174 | u32 quirks; | 176 | u32 quirks; |
175 | 177 | ||
176 | struct regulator *vmmc; /* Power regulator */ | 178 | struct regulator *vmmc; /* Power regulator */ |
179 | unsigned long irq_flags; /* IRQ flags */ | ||
180 | unsigned int irq; | ||
177 | }; | 181 | }; |
178 | 182 | ||
179 | /* DMA ops for Internal/External DMAC interface */ | 183 | /* DMA ops for Internal/External DMAC interface */ |
diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h index ee2b0363c040..cbde4b7e675e 100644 --- a/include/linux/mmc/host.h +++ b/include/linux/mmc/host.h | |||
@@ -12,6 +12,7 @@ | |||
12 | 12 | ||
13 | #include <linux/leds.h> | 13 | #include <linux/leds.h> |
14 | #include <linux/sched.h> | 14 | #include <linux/sched.h> |
15 | #include <linux/device.h> | ||
15 | #include <linux/fault-inject.h> | 16 | #include <linux/fault-inject.h> |
16 | 17 | ||
17 | #include <linux/mmc/core.h> | 18 | #include <linux/mmc/core.h> |
@@ -80,34 +81,11 @@ struct mmc_ios { | |||
80 | 81 | ||
81 | struct mmc_host_ops { | 82 | struct mmc_host_ops { |
82 | /* | 83 | /* |
83 | * Hosts that support power saving can use the 'enable' and 'disable' | 84 | * 'enable' is called when the host is claimed and 'disable' is called |
84 | * methods to exit and enter power saving states. 'enable' is called | 85 | * when the host is released. 'enable' and 'disable' are deprecated. |
85 | * when the host is claimed and 'disable' is called (or scheduled with | ||
86 | * a delay) when the host is released. The 'disable' is scheduled if | ||
87 | * the disable delay set by 'mmc_set_disable_delay()' is non-zero, | ||
88 | * otherwise 'disable' is called immediately. 'disable' may be | ||
89 | * scheduled repeatedly, to permit ever greater power saving at the | ||
90 | * expense of ever greater latency to re-enable. Rescheduling is | ||
91 | * determined by the return value of the 'disable' method. A positive | ||
92 | * value gives the delay in milliseconds. | ||
93 | * | ||
94 | * In the case where a host function (like set_ios) may be called | ||
95 | * with or without the host claimed, enabling and disabling can be | ||
96 | * done directly and will nest correctly. Call 'mmc_host_enable()' and | ||
97 | * 'mmc_host_lazy_disable()' for this purpose, but note that these | ||
98 | * functions must be paired. | ||
99 | * | ||
100 | * Alternatively, 'mmc_host_enable()' may be paired with | ||
101 | * 'mmc_host_disable()' which calls 'disable' immediately. In this | ||
102 | * case the 'disable' method will be called with 'lazy' set to 0. | ||
103 | * This is mainly useful for error paths. | ||
104 | * | ||
105 | * Because lazy disable may be called from a work queue, the 'disable' | ||
106 | * method must claim the host when 'lazy' != 0, which will work | ||
107 | * correctly because recursion is detected and handled. | ||
108 | */ | 86 | */ |
109 | int (*enable)(struct mmc_host *host); | 87 | int (*enable)(struct mmc_host *host); |
110 | int (*disable)(struct mmc_host *host, int lazy); | 88 | int (*disable)(struct mmc_host *host); |
111 | /* | 89 | /* |
112 | * It is optional for the host to implement pre_req and post_req in | 90 | * It is optional for the host to implement pre_req and post_req in |
113 | * order to support double buffering of requests (prepare one | 91 | * order to support double buffering of requests (prepare one |
@@ -218,7 +196,7 @@ struct mmc_host { | |||
218 | #define MMC_CAP_SPI (1 << 4) /* Talks only SPI protocols */ | 196 | #define MMC_CAP_SPI (1 << 4) /* Talks only SPI protocols */ |
219 | #define MMC_CAP_NEEDS_POLL (1 << 5) /* Needs polling for card-detection */ | 197 | #define MMC_CAP_NEEDS_POLL (1 << 5) /* Needs polling for card-detection */ |
220 | #define MMC_CAP_8_BIT_DATA (1 << 6) /* Can the host do 8 bit transfers */ | 198 | #define MMC_CAP_8_BIT_DATA (1 << 6) /* Can the host do 8 bit transfers */ |
221 | #define MMC_CAP_DISABLE (1 << 7) /* Can the host be disabled */ | 199 | |
222 | #define MMC_CAP_NONREMOVABLE (1 << 8) /* Nonremovable e.g. eMMC */ | 200 | #define MMC_CAP_NONREMOVABLE (1 << 8) /* Nonremovable e.g. eMMC */ |
223 | #define MMC_CAP_WAIT_WHILE_BUSY (1 << 9) /* Waits while card is busy */ | 201 | #define MMC_CAP_WAIT_WHILE_BUSY (1 << 9) /* Waits while card is busy */ |
224 | #define MMC_CAP_ERASE (1 << 10) /* Allow erase/trim commands */ | 202 | #define MMC_CAP_ERASE (1 << 10) /* Allow erase/trim commands */ |
@@ -258,6 +236,8 @@ struct mmc_host { | |||
258 | #define MMC_CAP2_HS200 (MMC_CAP2_HS200_1_8V_SDR | \ | 236 | #define MMC_CAP2_HS200 (MMC_CAP2_HS200_1_8V_SDR | \ |
259 | MMC_CAP2_HS200_1_2V_SDR) | 237 | MMC_CAP2_HS200_1_2V_SDR) |
260 | #define MMC_CAP2_BROKEN_VOLTAGE (1 << 7) /* Use the broken voltage */ | 238 | #define MMC_CAP2_BROKEN_VOLTAGE (1 << 7) /* Use the broken voltage */ |
239 | #define MMC_CAP2_DETECT_ON_ERR (1 << 8) /* On I/O err check card removal */ | ||
240 | #define MMC_CAP2_HC_ERASE_SZ (1 << 9) /* High-capacity erase size */ | ||
261 | 241 | ||
262 | mmc_pm_flag_t pm_caps; /* supported pm features */ | 242 | mmc_pm_flag_t pm_caps; /* supported pm features */ |
263 | unsigned int power_notify_type; | 243 | unsigned int power_notify_type; |
@@ -300,13 +280,7 @@ struct mmc_host { | |||
300 | unsigned int removed:1; /* host is being removed */ | 280 | unsigned int removed:1; /* host is being removed */ |
301 | #endif | 281 | #endif |
302 | 282 | ||
303 | /* Only used with MMC_CAP_DISABLE */ | ||
304 | int enabled; /* host is enabled */ | ||
305 | int rescan_disable; /* disable card detection */ | 283 | int rescan_disable; /* disable card detection */ |
306 | int nesting_cnt; /* "enable" nesting count */ | ||
307 | int en_dis_recurs; /* detect recursion */ | ||
308 | unsigned int disable_delay; /* disable delay in msecs */ | ||
309 | struct delayed_work disable; /* disabling work */ | ||
310 | 284 | ||
311 | struct mmc_card *card; /* device attached to this host */ | 285 | struct mmc_card *card; /* device attached to this host */ |
312 | 286 | ||
@@ -406,17 +380,8 @@ int mmc_card_awake(struct mmc_host *host); | |||
406 | int mmc_card_sleep(struct mmc_host *host); | 380 | int mmc_card_sleep(struct mmc_host *host); |
407 | int mmc_card_can_sleep(struct mmc_host *host); | 381 | int mmc_card_can_sleep(struct mmc_host *host); |
408 | 382 | ||
409 | int mmc_host_enable(struct mmc_host *host); | ||
410 | int mmc_host_disable(struct mmc_host *host); | ||
411 | int mmc_host_lazy_disable(struct mmc_host *host); | ||
412 | int mmc_pm_notify(struct notifier_block *notify_block, unsigned long, void *); | 383 | int mmc_pm_notify(struct notifier_block *notify_block, unsigned long, void *); |
413 | 384 | ||
414 | static inline void mmc_set_disable_delay(struct mmc_host *host, | ||
415 | unsigned int disable_delay) | ||
416 | { | ||
417 | host->disable_delay = disable_delay; | ||
418 | } | ||
419 | |||
420 | /* Module parameter */ | 385 | /* Module parameter */ |
421 | extern bool mmc_assume_removable; | 386 | extern bool mmc_assume_removable; |
422 | 387 | ||
diff --git a/include/linux/mmc/ioctl.h b/include/linux/mmc/ioctl.h index 8fa5bc5f8059..1f5e68923929 100644 --- a/include/linux/mmc/ioctl.h +++ b/include/linux/mmc/ioctl.h | |||
@@ -1,5 +1,8 @@ | |||
1 | #ifndef LINUX_MMC_IOCTL_H | 1 | #ifndef LINUX_MMC_IOCTL_H |
2 | #define LINUX_MMC_IOCTL_H | 2 | #define LINUX_MMC_IOCTL_H |
3 | |||
4 | #include <linux/types.h> | ||
5 | |||
3 | struct mmc_ioc_cmd { | 6 | struct mmc_ioc_cmd { |
4 | /* Implies direction of data. true = write, false = read */ | 7 | /* Implies direction of data. true = write, false = read */ |
5 | int write_flag; | 8 | int write_flag; |
diff --git a/include/linux/mmc/mmc.h b/include/linux/mmc/mmc.h index fb9f6e116e1c..b822a2cb6008 100644 --- a/include/linux/mmc/mmc.h +++ b/include/linux/mmc/mmc.h | |||
@@ -274,6 +274,7 @@ struct _mmc_csd { | |||
274 | #define EXT_CSD_FLUSH_CACHE 32 /* W */ | 274 | #define EXT_CSD_FLUSH_CACHE 32 /* W */ |
275 | #define EXT_CSD_CACHE_CTRL 33 /* R/W */ | 275 | #define EXT_CSD_CACHE_CTRL 33 /* R/W */ |
276 | #define EXT_CSD_POWER_OFF_NOTIFICATION 34 /* R/W */ | 276 | #define EXT_CSD_POWER_OFF_NOTIFICATION 34 /* R/W */ |
277 | #define EXT_CSD_DATA_SECTOR_SIZE 61 /* R */ | ||
277 | #define EXT_CSD_GP_SIZE_MULT 143 /* R/W */ | 278 | #define EXT_CSD_GP_SIZE_MULT 143 /* R/W */ |
278 | #define EXT_CSD_PARTITION_ATTRIBUTE 156 /* R/W */ | 279 | #define EXT_CSD_PARTITION_ATTRIBUTE 156 /* R/W */ |
279 | #define EXT_CSD_PARTITION_SUPPORT 160 /* RO */ | 280 | #define EXT_CSD_PARTITION_SUPPORT 160 /* RO */ |
@@ -315,6 +316,8 @@ struct _mmc_csd { | |||
315 | #define EXT_CSD_POWER_OFF_LONG_TIME 247 /* RO */ | 316 | #define EXT_CSD_POWER_OFF_LONG_TIME 247 /* RO */ |
316 | #define EXT_CSD_GENERIC_CMD6_TIME 248 /* RO */ | 317 | #define EXT_CSD_GENERIC_CMD6_TIME 248 /* RO */ |
317 | #define EXT_CSD_CACHE_SIZE 249 /* RO, 4 bytes */ | 318 | #define EXT_CSD_CACHE_SIZE 249 /* RO, 4 bytes */ |
319 | #define EXT_CSD_TAG_UNIT_SIZE 498 /* RO */ | ||
320 | #define EXT_CSD_DATA_TAG_SUPPORT 499 /* RO */ | ||
318 | #define EXT_CSD_HPI_FEATURES 503 /* RO */ | 321 | #define EXT_CSD_HPI_FEATURES 503 /* RO */ |
319 | 322 | ||
320 | /* | 323 | /* |
diff --git a/include/linux/mmc/sdhci.h b/include/linux/mmc/sdhci.h index c750f85177d9..e9051e1cb1ce 100644 --- a/include/linux/mmc/sdhci.h +++ b/include/linux/mmc/sdhci.h | |||
@@ -90,6 +90,8 @@ struct sdhci_host { | |||
90 | 90 | ||
91 | unsigned int quirks2; /* More deviations from spec. */ | 91 | unsigned int quirks2; /* More deviations from spec. */ |
92 | 92 | ||
93 | #define SDHCI_QUIRK2_HOST_OFF_CARD_ON (1<<0) | ||
94 | |||
93 | int irq; /* Device IRQ */ | 95 | int irq; /* Device IRQ */ |
94 | void __iomem *ioaddr; /* Mapped address */ | 96 | void __iomem *ioaddr; /* Mapped address */ |
95 | 97 | ||
diff --git a/include/linux/mmc/sh_mmcif.h b/include/linux/mmc/sh_mmcif.h index 04ff452bf5c3..05f0e3db1c12 100644 --- a/include/linux/mmc/sh_mmcif.h +++ b/include/linux/mmc/sh_mmcif.h | |||
@@ -77,18 +77,15 @@ struct sh_mmcif_plat_data { | |||
77 | 77 | ||
78 | /* CE_CLK_CTRL */ | 78 | /* CE_CLK_CTRL */ |
79 | #define CLK_ENABLE (1 << 24) /* 1: output mmc clock */ | 79 | #define CLK_ENABLE (1 << 24) /* 1: output mmc clock */ |
80 | #define CLK_CLEAR ((1 << 19) | (1 << 18) | (1 << 17) | (1 << 16)) | 80 | #define CLK_CLEAR (0xf << 16) |
81 | #define CLK_SUP_PCLK ((1 << 19) | (1 << 18) | (1 << 17) | (1 << 16)) | 81 | #define CLK_SUP_PCLK (0xf << 16) |
82 | #define CLKDIV_4 (1<<16) /* mmc clock frequency. | 82 | #define CLKDIV_4 (1 << 16) /* mmc clock frequency. |
83 | * n: bus clock/(2^(n+1)) */ | 83 | * n: bus clock/(2^(n+1)) */ |
84 | #define CLKDIV_256 (7<<16) /* mmc clock frequency. (see above) */ | 84 | #define CLKDIV_256 (7 << 16) /* mmc clock frequency. (see above) */ |
85 | #define SRSPTO_256 ((1 << 13) | (0 << 12)) /* resp timeout */ | 85 | #define SRSPTO_256 (2 << 12) /* resp timeout */ |
86 | #define SRBSYTO_29 ((1 << 11) | (1 << 10) | \ | 86 | #define SRBSYTO_29 (0xf << 8) /* resp busy timeout */ |
87 | (1 << 9) | (1 << 8)) /* resp busy timeout */ | 87 | #define SRWDTO_29 (0xf << 4) /* read/write timeout */ |
88 | #define SRWDTO_29 ((1 << 7) | (1 << 6) | \ | 88 | #define SCCSTO_29 (0xf << 0) /* ccs timeout */ |
89 | (1 << 5) | (1 << 4)) /* read/write timeout */ | ||
90 | #define SCCSTO_29 ((1 << 3) | (1 << 2) | \ | ||
91 | (1 << 1) | (1 << 0)) /* ccs timeout */ | ||
92 | 89 | ||
93 | /* CE_VERSION */ | 90 | /* CE_VERSION */ |
94 | #define SOFT_RST_ON (1 << 31) | 91 | #define SOFT_RST_ON (1 << 31) |
diff --git a/include/linux/mmc/sh_mobile_sdhi.h b/include/linux/mmc/sh_mobile_sdhi.h index 71b805451bd8..e94e620aeddc 100644 --- a/include/linux/mmc/sh_mobile_sdhi.h +++ b/include/linux/mmc/sh_mobile_sdhi.h | |||
@@ -10,15 +10,29 @@ struct tmio_mmc_data; | |||
10 | #define SH_MOBILE_SDHI_IRQ_SDCARD "sdcard" | 10 | #define SH_MOBILE_SDHI_IRQ_SDCARD "sdcard" |
11 | #define SH_MOBILE_SDHI_IRQ_SDIO "sdio" | 11 | #define SH_MOBILE_SDHI_IRQ_SDIO "sdio" |
12 | 12 | ||
13 | /** | ||
14 | * struct sh_mobile_sdhi_ops - SDHI driver callbacks | ||
15 | * @cd_wakeup: trigger a card-detection run | ||
16 | */ | ||
17 | struct sh_mobile_sdhi_ops { | ||
18 | void (*cd_wakeup)(const struct platform_device *pdev); | ||
19 | }; | ||
20 | |||
13 | struct sh_mobile_sdhi_info { | 21 | struct sh_mobile_sdhi_info { |
14 | int dma_slave_tx; | 22 | int dma_slave_tx; |
15 | int dma_slave_rx; | 23 | int dma_slave_rx; |
16 | unsigned long tmio_flags; | 24 | unsigned long tmio_flags; |
17 | unsigned long tmio_caps; | 25 | unsigned long tmio_caps; |
18 | u32 tmio_ocr_mask; /* available MMC voltages */ | 26 | u32 tmio_ocr_mask; /* available MMC voltages */ |
27 | unsigned int cd_gpio; | ||
19 | struct tmio_mmc_data *pdata; | 28 | struct tmio_mmc_data *pdata; |
20 | void (*set_pwr)(struct platform_device *pdev, int state); | 29 | void (*set_pwr)(struct platform_device *pdev, int state); |
21 | int (*get_cd)(struct platform_device *pdev); | 30 | int (*get_cd)(struct platform_device *pdev); |
31 | |||
32 | /* callbacks for board specific setup code */ | ||
33 | int (*init)(struct platform_device *pdev, | ||
34 | const struct sh_mobile_sdhi_ops *ops); | ||
35 | void (*cleanup)(struct platform_device *pdev); | ||
22 | }; | 36 | }; |
23 | 37 | ||
24 | #endif /* LINUX_MMC_SH_MOBILE_SDHI_H */ | 38 | #endif /* LINUX_MMC_SH_MOBILE_SDHI_H */ |
diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h index 650ba2fb3301..dff711509661 100644 --- a/include/linux/mmzone.h +++ b/include/linux/mmzone.h | |||
@@ -365,6 +365,7 @@ struct zone { | |||
365 | */ | 365 | */ |
366 | unsigned int compact_considered; | 366 | unsigned int compact_considered; |
367 | unsigned int compact_defer_shift; | 367 | unsigned int compact_defer_shift; |
368 | int compact_order_failed; | ||
368 | #endif | 369 | #endif |
369 | 370 | ||
370 | ZONE_PADDING(_pad1_) | 371 | ZONE_PADDING(_pad1_) |
diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h index 83ac0713ed0a..501da4cb8a6d 100644 --- a/include/linux/mod_devicetable.h +++ b/include/linux/mod_devicetable.h | |||
@@ -414,6 +414,15 @@ struct hv_vmbus_device_id { | |||
414 | __attribute__((aligned(sizeof(kernel_ulong_t)))); | 414 | __attribute__((aligned(sizeof(kernel_ulong_t)))); |
415 | }; | 415 | }; |
416 | 416 | ||
417 | /* rpmsg */ | ||
418 | |||
419 | #define RPMSG_NAME_SIZE 32 | ||
420 | #define RPMSG_DEVICE_MODALIAS_FMT "rpmsg:%s" | ||
421 | |||
422 | struct rpmsg_device_id { | ||
423 | char name[RPMSG_NAME_SIZE]; | ||
424 | }; | ||
425 | |||
417 | /* i2c */ | 426 | /* i2c */ |
418 | 427 | ||
419 | #define I2C_NAME_SIZE 20 | 428 | #define I2C_NAME_SIZE 20 |
@@ -560,4 +569,25 @@ struct amba_id { | |||
560 | #endif | 569 | #endif |
561 | }; | 570 | }; |
562 | 571 | ||
572 | /* | ||
573 | * Match x86 CPUs for CPU specific drivers. | ||
574 | * See documentation of "x86_match_cpu" for details. | ||
575 | */ | ||
576 | |||
577 | struct x86_cpu_id { | ||
578 | __u16 vendor; | ||
579 | __u16 family; | ||
580 | __u16 model; | ||
581 | __u16 feature; /* bit index */ | ||
582 | kernel_ulong_t driver_data; | ||
583 | }; | ||
584 | |||
585 | #define X86_FEATURE_MATCH(x) \ | ||
586 | { X86_VENDOR_ANY, X86_FAMILY_ANY, X86_MODEL_ANY, x } | ||
587 | |||
588 | #define X86_VENDOR_ANY 0xffff | ||
589 | #define X86_FAMILY_ANY 0 | ||
590 | #define X86_MODEL_ANY 0 | ||
591 | #define X86_FEATURE_ANY 0 /* Same as FPU, you can't test for that */ | ||
592 | |||
563 | #endif /* LINUX_MOD_DEVICETABLE_H */ | 593 | #endif /* LINUX_MOD_DEVICETABLE_H */ |
diff --git a/include/linux/module.h b/include/linux/module.h index 4598bf03e98b..fbcafe2ee13e 100644 --- a/include/linux/module.h +++ b/include/linux/module.h | |||
@@ -21,8 +21,6 @@ | |||
21 | #include <linux/percpu.h> | 21 | #include <linux/percpu.h> |
22 | #include <asm/module.h> | 22 | #include <asm/module.h> |
23 | 23 | ||
24 | #include <trace/events/module.h> | ||
25 | |||
26 | /* Not Yet Implemented */ | 24 | /* Not Yet Implemented */ |
27 | #define MODULE_SUPPORTED_DEVICE(name) | 25 | #define MODULE_SUPPORTED_DEVICE(name) |
28 | 26 | ||
@@ -452,33 +450,11 @@ void symbol_put_addr(void *addr); | |||
452 | 450 | ||
453 | /* Sometimes we know we already have a refcount, and it's easier not | 451 | /* Sometimes we know we already have a refcount, and it's easier not |
454 | to handle the error case (which only happens with rmmod --wait). */ | 452 | to handle the error case (which only happens with rmmod --wait). */ |
455 | static inline void __module_get(struct module *module) | 453 | extern void __module_get(struct module *module); |
456 | { | ||
457 | if (module) { | ||
458 | preempt_disable(); | ||
459 | __this_cpu_inc(module->refptr->incs); | ||
460 | trace_module_get(module, _THIS_IP_); | ||
461 | preempt_enable(); | ||
462 | } | ||
463 | } | ||
464 | |||
465 | static inline int try_module_get(struct module *module) | ||
466 | { | ||
467 | int ret = 1; | ||
468 | |||
469 | if (module) { | ||
470 | preempt_disable(); | ||
471 | 454 | ||
472 | if (likely(module_is_live(module))) { | 455 | /* This is the Right Way to get a module: if it fails, it's being removed, |
473 | __this_cpu_inc(module->refptr->incs); | 456 | * so pretend it's not there. */ |
474 | trace_module_get(module, _THIS_IP_); | 457 | extern bool try_module_get(struct module *module); |
475 | } else | ||
476 | ret = 0; | ||
477 | |||
478 | preempt_enable(); | ||
479 | } | ||
480 | return ret; | ||
481 | } | ||
482 | 458 | ||
483 | extern void module_put(struct module *module); | 459 | extern void module_put(struct module *module); |
484 | 460 | ||
diff --git a/include/linux/moduleparam.h b/include/linux/moduleparam.h index c47f4d60db0b..ea36486378d8 100644 --- a/include/linux/moduleparam.h +++ b/include/linux/moduleparam.h | |||
@@ -47,14 +47,11 @@ struct kernel_param_ops { | |||
47 | void (*free)(void *arg); | 47 | void (*free)(void *arg); |
48 | }; | 48 | }; |
49 | 49 | ||
50 | /* Flag bits for kernel_param.flags */ | ||
51 | #define KPARAM_ISBOOL 2 | ||
52 | |||
53 | struct kernel_param { | 50 | struct kernel_param { |
54 | const char *name; | 51 | const char *name; |
55 | const struct kernel_param_ops *ops; | 52 | const struct kernel_param_ops *ops; |
56 | u16 perm; | 53 | u16 perm; |
57 | u16 flags; | 54 | s16 level; |
58 | union { | 55 | union { |
59 | void *arg; | 56 | void *arg; |
60 | const struct kparam_string *str; | 57 | const struct kparam_string *str; |
@@ -131,8 +128,40 @@ struct kparam_array | |||
131 | * The ops can have NULL set or get functions. | 128 | * The ops can have NULL set or get functions. |
132 | */ | 129 | */ |
133 | #define module_param_cb(name, ops, arg, perm) \ | 130 | #define module_param_cb(name, ops, arg, perm) \ |
134 | __module_param_call(MODULE_PARAM_PREFIX, \ | 131 | __module_param_call(MODULE_PARAM_PREFIX, name, ops, arg, perm, 0) |
135 | name, ops, arg, __same_type((arg), bool *), perm) | 132 | |
133 | /** | ||
134 | * <level>_param_cb - general callback for a module/cmdline parameter | ||
135 | * to be evaluated before certain initcall level | ||
136 | * @name: a valid C identifier which is the parameter name. | ||
137 | * @ops: the set & get operations for this parameter. | ||
138 | * @perm: visibility in sysfs. | ||
139 | * | ||
140 | * The ops can have NULL set or get functions. | ||
141 | */ | ||
142 | #define __level_param_cb(name, ops, arg, perm, level) \ | ||
143 | __module_param_call(MODULE_PARAM_PREFIX, name, ops, arg, perm, level) | ||
144 | |||
145 | #define core_param_cb(name, ops, arg, perm) \ | ||
146 | __level_param_cb(name, ops, arg, perm, 1) | ||
147 | |||
148 | #define postcore_param_cb(name, ops, arg, perm) \ | ||
149 | __level_param_cb(name, ops, arg, perm, 2) | ||
150 | |||
151 | #define arch_param_cb(name, ops, arg, perm) \ | ||
152 | __level_param_cb(name, ops, arg, perm, 3) | ||
153 | |||
154 | #define subsys_param_cb(name, ops, arg, perm) \ | ||
155 | __level_param_cb(name, ops, arg, perm, 4) | ||
156 | |||
157 | #define fs_param_cb(name, ops, arg, perm) \ | ||
158 | __level_param_cb(name, ops, arg, perm, 5) | ||
159 | |||
160 | #define device_param_cb(name, ops, arg, perm) \ | ||
161 | __level_param_cb(name, ops, arg, perm, 6) | ||
162 | |||
163 | #define late_param_cb(name, ops, arg, perm) \ | ||
164 | __level_param_cb(name, ops, arg, perm, 7) | ||
136 | 165 | ||
137 | /* On alpha, ia64 and ppc64 relocations to global data cannot go into | 166 | /* On alpha, ia64 and ppc64 relocations to global data cannot go into |
138 | read-only sections (which is part of respective UNIX ABI on these | 167 | read-only sections (which is part of respective UNIX ABI on these |
@@ -146,7 +175,7 @@ struct kparam_array | |||
146 | 175 | ||
147 | /* This is the fundamental function for registering boot/module | 176 | /* This is the fundamental function for registering boot/module |
148 | parameters. */ | 177 | parameters. */ |
149 | #define __module_param_call(prefix, name, ops, arg, isbool, perm) \ | 178 | #define __module_param_call(prefix, name, ops, arg, perm, level) \ |
150 | /* Default value instead of permissions? */ \ | 179 | /* Default value instead of permissions? */ \ |
151 | static int __param_perm_check_##name __attribute__((unused)) = \ | 180 | static int __param_perm_check_##name __attribute__((unused)) = \ |
152 | BUILD_BUG_ON_ZERO((perm) < 0 || (perm) > 0777 || ((perm) & 2)) \ | 181 | BUILD_BUG_ON_ZERO((perm) < 0 || (perm) > 0777 || ((perm) & 2)) \ |
@@ -155,8 +184,7 @@ struct kparam_array | |||
155 | static struct kernel_param __moduleparam_const __param_##name \ | 184 | static struct kernel_param __moduleparam_const __param_##name \ |
156 | __used \ | 185 | __used \ |
157 | __attribute__ ((unused,__section__ ("__param"),aligned(sizeof(void *)))) \ | 186 | __attribute__ ((unused,__section__ ("__param"),aligned(sizeof(void *)))) \ |
158 | = { __param_str_##name, ops, perm, isbool ? KPARAM_ISBOOL : 0, \ | 187 | = { __param_str_##name, ops, perm, level, { arg } } |
159 | { arg } } | ||
160 | 188 | ||
161 | /* Obsolete - use module_param_cb() */ | 189 | /* Obsolete - use module_param_cb() */ |
162 | #define module_param_call(name, set, get, arg, perm) \ | 190 | #define module_param_call(name, set, get, arg, perm) \ |
@@ -164,8 +192,7 @@ struct kparam_array | |||
164 | { (void *)set, (void *)get }; \ | 192 | { (void *)set, (void *)get }; \ |
165 | __module_param_call(MODULE_PARAM_PREFIX, \ | 193 | __module_param_call(MODULE_PARAM_PREFIX, \ |
166 | name, &__param_ops_##name, arg, \ | 194 | name, &__param_ops_##name, arg, \ |
167 | __same_type(arg, bool *), \ | 195 | (perm) + sizeof(__check_old_set_param(set))*0, 0) |
168 | (perm) + sizeof(__check_old_set_param(set))*0) | ||
169 | 196 | ||
170 | /* We don't get oldget: it's often a new-style param_get_uint, etc. */ | 197 | /* We don't get oldget: it's often a new-style param_get_uint, etc. */ |
171 | static inline int | 198 | static inline int |
@@ -245,8 +272,7 @@ static inline void __kernel_param_unlock(void) | |||
245 | */ | 272 | */ |
246 | #define core_param(name, var, type, perm) \ | 273 | #define core_param(name, var, type, perm) \ |
247 | param_check_##type(name, &(var)); \ | 274 | param_check_##type(name, &(var)); \ |
248 | __module_param_call("", name, ¶m_ops_##type, \ | 275 | __module_param_call("", name, ¶m_ops_##type, &var, perm, 0) |
249 | &var, __same_type(var, bool), perm) | ||
250 | #endif /* !MODULE */ | 276 | #endif /* !MODULE */ |
251 | 277 | ||
252 | /** | 278 | /** |
@@ -264,7 +290,7 @@ static inline void __kernel_param_unlock(void) | |||
264 | = { len, string }; \ | 290 | = { len, string }; \ |
265 | __module_param_call(MODULE_PARAM_PREFIX, name, \ | 291 | __module_param_call(MODULE_PARAM_PREFIX, name, \ |
266 | ¶m_ops_string, \ | 292 | ¶m_ops_string, \ |
267 | .str = &__param_string_##name, 0, perm); \ | 293 | .str = &__param_string_##name, perm, 0); \ |
268 | __MODULE_PARM_TYPE(name, "string") | 294 | __MODULE_PARM_TYPE(name, "string") |
269 | 295 | ||
270 | /** | 296 | /** |
@@ -292,6 +318,8 @@ extern int parse_args(const char *name, | |||
292 | char *args, | 318 | char *args, |
293 | const struct kernel_param *params, | 319 | const struct kernel_param *params, |
294 | unsigned num, | 320 | unsigned num, |
321 | s16 level_min, | ||
322 | s16 level_max, | ||
295 | int (*unknown)(char *param, char *val)); | 323 | int (*unknown)(char *param, char *val)); |
296 | 324 | ||
297 | /* Called by module remove. */ | 325 | /* Called by module remove. */ |
@@ -403,7 +431,7 @@ extern int param_set_bint(const char *val, const struct kernel_param *kp); | |||
403 | __module_param_call(MODULE_PARAM_PREFIX, name, \ | 431 | __module_param_call(MODULE_PARAM_PREFIX, name, \ |
404 | ¶m_array_ops, \ | 432 | ¶m_array_ops, \ |
405 | .arr = &__param_arr_##name, \ | 433 | .arr = &__param_arr_##name, \ |
406 | __same_type(array[0], bool), perm); \ | 434 | perm, 0); \ |
407 | __MODULE_PARM_TYPE(name, "array of " #type) | 435 | __MODULE_PARM_TYPE(name, "array of " #type) |
408 | 436 | ||
409 | extern struct kernel_param_ops param_array_ops; | 437 | extern struct kernel_param_ops param_array_ops; |
diff --git a/include/linux/mtd/bbm.h b/include/linux/mtd/bbm.h index c4eec228eef9..650ef352f045 100644 --- a/include/linux/mtd/bbm.h +++ b/include/linux/mtd/bbm.h | |||
@@ -112,6 +112,11 @@ struct nand_bbt_descr { | |||
112 | #define NAND_BBT_USE_FLASH 0x00020000 | 112 | #define NAND_BBT_USE_FLASH 0x00020000 |
113 | /* Do not store flash based bad block table in OOB area; store it in-band */ | 113 | /* Do not store flash based bad block table in OOB area; store it in-band */ |
114 | #define NAND_BBT_NO_OOB 0x00040000 | 114 | #define NAND_BBT_NO_OOB 0x00040000 |
115 | /* | ||
116 | * Do not write new bad block markers to OOB; useful, e.g., when ECC covers | ||
117 | * entire spare area. Must be used with NAND_BBT_USE_FLASH. | ||
118 | */ | ||
119 | #define NAND_BBT_NO_OOB_BBM 0x00080000 | ||
115 | 120 | ||
116 | /* | 121 | /* |
117 | * Flag set by nand_create_default_bbt_descr(), marking that the nand_bbt_descr | 122 | * Flag set by nand_create_default_bbt_descr(), marking that the nand_bbt_descr |
diff --git a/include/linux/mtd/blktrans.h b/include/linux/mtd/blktrans.h index 1bbd9f289245..ed270bd2e4df 100644 --- a/include/linux/mtd/blktrans.h +++ b/include/linux/mtd/blktrans.h | |||
@@ -47,6 +47,7 @@ struct mtd_blktrans_dev { | |||
47 | struct request_queue *rq; | 47 | struct request_queue *rq; |
48 | spinlock_t queue_lock; | 48 | spinlock_t queue_lock; |
49 | void *priv; | 49 | void *priv; |
50 | fmode_t file_mode; | ||
50 | }; | 51 | }; |
51 | 52 | ||
52 | struct mtd_blktrans_ops { | 53 | struct mtd_blktrans_ops { |
diff --git a/include/linux/mtd/cfi.h b/include/linux/mtd/cfi.h index d5d2ec6494bb..37ef6b194089 100644 --- a/include/linux/mtd/cfi.h +++ b/include/linux/mtd/cfi.h | |||
@@ -22,6 +22,7 @@ | |||
22 | 22 | ||
23 | #include <linux/delay.h> | 23 | #include <linux/delay.h> |
24 | #include <linux/types.h> | 24 | #include <linux/types.h> |
25 | #include <linux/bug.h> | ||
25 | #include <linux/interrupt.h> | 26 | #include <linux/interrupt.h> |
26 | #include <linux/mtd/flashchip.h> | 27 | #include <linux/mtd/flashchip.h> |
27 | #include <linux/mtd/map.h> | 28 | #include <linux/mtd/map.h> |
diff --git a/include/linux/mtd/fsmc.h b/include/linux/mtd/fsmc.h index 6987995ad3cf..b20029221fb1 100644 --- a/include/linux/mtd/fsmc.h +++ b/include/linux/mtd/fsmc.h | |||
@@ -26,95 +26,83 @@ | |||
26 | #define FSMC_NAND_BW8 1 | 26 | #define FSMC_NAND_BW8 1 |
27 | #define FSMC_NAND_BW16 2 | 27 | #define FSMC_NAND_BW16 2 |
28 | 28 | ||
29 | /* | ||
30 | * The placement of the Command Latch Enable (CLE) and | ||
31 | * Address Latch Enable (ALE) is twisted around in the | ||
32 | * SPEAR310 implementation. | ||
33 | */ | ||
34 | #if defined(CONFIG_MACH_SPEAR310) | ||
35 | #define PLAT_NAND_CLE (1 << 17) | ||
36 | #define PLAT_NAND_ALE (1 << 16) | ||
37 | #else | ||
38 | #define PLAT_NAND_CLE (1 << 16) | ||
39 | #define PLAT_NAND_ALE (1 << 17) | ||
40 | #endif | ||
41 | |||
42 | #define FSMC_MAX_NOR_BANKS 4 | 29 | #define FSMC_MAX_NOR_BANKS 4 |
43 | #define FSMC_MAX_NAND_BANKS 4 | 30 | #define FSMC_MAX_NAND_BANKS 4 |
44 | 31 | ||
45 | #define FSMC_FLASH_WIDTH8 1 | 32 | #define FSMC_FLASH_WIDTH8 1 |
46 | #define FSMC_FLASH_WIDTH16 2 | 33 | #define FSMC_FLASH_WIDTH16 2 |
47 | 34 | ||
48 | struct fsmc_nor_bank_regs { | 35 | /* fsmc controller registers for NOR flash */ |
49 | uint32_t ctrl; | 36 | #define CTRL 0x0 |
50 | uint32_t ctrl_tim; | 37 | /* ctrl register definitions */ |
51 | }; | 38 | #define BANK_ENABLE (1 << 0) |
52 | 39 | #define MUXED (1 << 1) | |
53 | /* ctrl register definitions */ | 40 | #define NOR_DEV (2 << 2) |
54 | #define BANK_ENABLE (1 << 0) | 41 | #define WIDTH_8 (0 << 4) |
55 | #define MUXED (1 << 1) | 42 | #define WIDTH_16 (1 << 4) |
56 | #define NOR_DEV (2 << 2) | 43 | #define RSTPWRDWN (1 << 6) |
57 | #define WIDTH_8 (0 << 4) | 44 | #define WPROT (1 << 7) |
58 | #define WIDTH_16 (1 << 4) | 45 | #define WRT_ENABLE (1 << 12) |
59 | #define RSTPWRDWN (1 << 6) | 46 | #define WAIT_ENB (1 << 13) |
60 | #define WPROT (1 << 7) | 47 | |
61 | #define WRT_ENABLE (1 << 12) | 48 | #define CTRL_TIM 0x4 |
62 | #define WAIT_ENB (1 << 13) | 49 | /* ctrl_tim register definitions */ |
63 | 50 | ||
64 | /* ctrl_tim register definitions */ | 51 | #define FSMC_NOR_BANK_SZ 0x8 |
65 | |||
66 | struct fsmc_nand_bank_regs { | ||
67 | uint32_t pc; | ||
68 | uint32_t sts; | ||
69 | uint32_t comm; | ||
70 | uint32_t attrib; | ||
71 | uint32_t ioata; | ||
72 | uint32_t ecc1; | ||
73 | uint32_t ecc2; | ||
74 | uint32_t ecc3; | ||
75 | }; | ||
76 | |||
77 | #define FSMC_NOR_REG_SIZE 0x40 | 52 | #define FSMC_NOR_REG_SIZE 0x40 |
78 | 53 | ||
79 | struct fsmc_regs { | 54 | #define FSMC_NOR_REG(base, bank, reg) (base + \ |
80 | struct fsmc_nor_bank_regs nor_bank_regs[FSMC_MAX_NOR_BANKS]; | 55 | FSMC_NOR_BANK_SZ * (bank) + \ |
81 | uint8_t reserved_1[0x40 - 0x20]; | 56 | reg) |
82 | struct fsmc_nand_bank_regs bank_regs[FSMC_MAX_NAND_BANKS]; | 57 | |
83 | uint8_t reserved_2[0xfe0 - 0xc0]; | 58 | /* fsmc controller registers for NAND flash */ |
84 | uint32_t peripid0; /* 0xfe0 */ | 59 | #define PC 0x00 |
85 | uint32_t peripid1; /* 0xfe4 */ | 60 | /* pc register definitions */ |
86 | uint32_t peripid2; /* 0xfe8 */ | 61 | #define FSMC_RESET (1 << 0) |
87 | uint32_t peripid3; /* 0xfec */ | 62 | #define FSMC_WAITON (1 << 1) |
88 | uint32_t pcellid0; /* 0xff0 */ | 63 | #define FSMC_ENABLE (1 << 2) |
89 | uint32_t pcellid1; /* 0xff4 */ | 64 | #define FSMC_DEVTYPE_NAND (1 << 3) |
90 | uint32_t pcellid2; /* 0xff8 */ | 65 | #define FSMC_DEVWID_8 (0 << 4) |
91 | uint32_t pcellid3; /* 0xffc */ | 66 | #define FSMC_DEVWID_16 (1 << 4) |
92 | }; | 67 | #define FSMC_ECCEN (1 << 6) |
68 | #define FSMC_ECCPLEN_512 (0 << 7) | ||
69 | #define FSMC_ECCPLEN_256 (1 << 7) | ||
70 | #define FSMC_TCLR_1 (1) | ||
71 | #define FSMC_TCLR_SHIFT (9) | ||
72 | #define FSMC_TCLR_MASK (0xF) | ||
73 | #define FSMC_TAR_1 (1) | ||
74 | #define FSMC_TAR_SHIFT (13) | ||
75 | #define FSMC_TAR_MASK (0xF) | ||
76 | #define STS 0x04 | ||
77 | /* sts register definitions */ | ||
78 | #define FSMC_CODE_RDY (1 << 15) | ||
79 | #define COMM 0x08 | ||
80 | /* comm register definitions */ | ||
81 | #define FSMC_TSET_0 0 | ||
82 | #define FSMC_TSET_SHIFT 0 | ||
83 | #define FSMC_TSET_MASK 0xFF | ||
84 | #define FSMC_TWAIT_6 6 | ||
85 | #define FSMC_TWAIT_SHIFT 8 | ||
86 | #define FSMC_TWAIT_MASK 0xFF | ||
87 | #define FSMC_THOLD_4 4 | ||
88 | #define FSMC_THOLD_SHIFT 16 | ||
89 | #define FSMC_THOLD_MASK 0xFF | ||
90 | #define FSMC_THIZ_1 1 | ||
91 | #define FSMC_THIZ_SHIFT 24 | ||
92 | #define FSMC_THIZ_MASK 0xFF | ||
93 | #define ATTRIB 0x0C | ||
94 | #define IOATA 0x10 | ||
95 | #define ECC1 0x14 | ||
96 | #define ECC2 0x18 | ||
97 | #define ECC3 0x1C | ||
98 | #define FSMC_NAND_BANK_SZ 0x20 | ||
99 | |||
100 | #define FSMC_NAND_REG(base, bank, reg) (base + FSMC_NOR_REG_SIZE + \ | ||
101 | (FSMC_NAND_BANK_SZ * (bank)) + \ | ||
102 | reg) | ||
93 | 103 | ||
94 | #define FSMC_BUSY_WAIT_TIMEOUT (1 * HZ) | 104 | #define FSMC_BUSY_WAIT_TIMEOUT (1 * HZ) |
95 | 105 | ||
96 | /* pc register definitions */ | ||
97 | #define FSMC_RESET (1 << 0) | ||
98 | #define FSMC_WAITON (1 << 1) | ||
99 | #define FSMC_ENABLE (1 << 2) | ||
100 | #define FSMC_DEVTYPE_NAND (1 << 3) | ||
101 | #define FSMC_DEVWID_8 (0 << 4) | ||
102 | #define FSMC_DEVWID_16 (1 << 4) | ||
103 | #define FSMC_ECCEN (1 << 6) | ||
104 | #define FSMC_ECCPLEN_512 (0 << 7) | ||
105 | #define FSMC_ECCPLEN_256 (1 << 7) | ||
106 | #define FSMC_TCLR_1 (1 << 9) | ||
107 | #define FSMC_TAR_1 (1 << 13) | ||
108 | |||
109 | /* sts register definitions */ | ||
110 | #define FSMC_CODE_RDY (1 << 15) | ||
111 | |||
112 | /* comm register definitions */ | ||
113 | #define FSMC_TSET_0 (0 << 0) | ||
114 | #define FSMC_TWAIT_6 (6 << 8) | ||
115 | #define FSMC_THOLD_4 (4 << 16) | ||
116 | #define FSMC_THIZ_1 (1 << 24) | ||
117 | |||
118 | /* | 106 | /* |
119 | * There are 13 bytes of ecc for every 512 byte block in FSMC version 8 | 107 | * There are 13 bytes of ecc for every 512 byte block in FSMC version 8 |
120 | * and it has to be read consecutively and immediately after the 512 | 108 | * and it has to be read consecutively and immediately after the 512 |
@@ -133,6 +121,20 @@ struct fsmc_eccplace { | |||
133 | struct fsmc_nand_eccplace eccplace[MAX_ECCPLACE_ENTRIES]; | 121 | struct fsmc_nand_eccplace eccplace[MAX_ECCPLACE_ENTRIES]; |
134 | }; | 122 | }; |
135 | 123 | ||
124 | struct fsmc_nand_timings { | ||
125 | uint8_t tclr; | ||
126 | uint8_t tar; | ||
127 | uint8_t thiz; | ||
128 | uint8_t thold; | ||
129 | uint8_t twait; | ||
130 | uint8_t tset; | ||
131 | }; | ||
132 | |||
133 | enum access_mode { | ||
134 | USE_DMA_ACCESS = 1, | ||
135 | USE_WORD_ACCESS, | ||
136 | }; | ||
137 | |||
136 | /** | 138 | /** |
137 | * fsmc_nand_platform_data - platform specific NAND controller config | 139 | * fsmc_nand_platform_data - platform specific NAND controller config |
138 | * @partitions: partition table for the platform, use a default fallback | 140 | * @partitions: partition table for the platform, use a default fallback |
@@ -146,12 +148,23 @@ struct fsmc_eccplace { | |||
146 | * this may be set to NULL | 148 | * this may be set to NULL |
147 | */ | 149 | */ |
148 | struct fsmc_nand_platform_data { | 150 | struct fsmc_nand_platform_data { |
151 | struct fsmc_nand_timings *nand_timings; | ||
149 | struct mtd_partition *partitions; | 152 | struct mtd_partition *partitions; |
150 | unsigned int nr_partitions; | 153 | unsigned int nr_partitions; |
151 | unsigned int options; | 154 | unsigned int options; |
152 | unsigned int width; | 155 | unsigned int width; |
153 | unsigned int bank; | 156 | unsigned int bank; |
157 | |||
158 | /* CLE, ALE offsets */ | ||
159 | unsigned int cle_off; | ||
160 | unsigned int ale_off; | ||
161 | enum access_mode mode; | ||
162 | |||
154 | void (*select_bank)(uint32_t bank, uint32_t busw); | 163 | void (*select_bank)(uint32_t bank, uint32_t busw); |
164 | |||
165 | /* priv structures for dma accesses */ | ||
166 | void *read_dma_priv; | ||
167 | void *write_dma_priv; | ||
155 | }; | 168 | }; |
156 | 169 | ||
157 | extern int __init fsmc_nor_init(struct platform_device *pdev, | 170 | extern int __init fsmc_nor_init(struct platform_device *pdev, |
diff --git a/include/linux/mtd/map.h b/include/linux/mtd/map.h index 94e924e2ecd5..3595a0236b0f 100644 --- a/include/linux/mtd/map.h +++ b/include/linux/mtd/map.h | |||
@@ -29,8 +29,8 @@ | |||
29 | #include <linux/kernel.h> | 29 | #include <linux/kernel.h> |
30 | 30 | ||
31 | #include <asm/unaligned.h> | 31 | #include <asm/unaligned.h> |
32 | #include <asm/system.h> | ||
33 | #include <asm/io.h> | 32 | #include <asm/io.h> |
33 | #include <asm/barrier.h> | ||
34 | 34 | ||
35 | #ifdef CONFIG_MTD_MAP_BANK_WIDTH_1 | 35 | #ifdef CONFIG_MTD_MAP_BANK_WIDTH_1 |
36 | #define map_bankwidth(map) 1 | 36 | #define map_bankwidth(map) 1 |
diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h index d43dc25af82e..cf5ea8cdcf8e 100644 --- a/include/linux/mtd/mtd.h +++ b/include/linux/mtd/mtd.h | |||
@@ -164,6 +164,9 @@ struct mtd_info { | |||
164 | /* ECC layout structure pointer - read only! */ | 164 | /* ECC layout structure pointer - read only! */ |
165 | struct nand_ecclayout *ecclayout; | 165 | struct nand_ecclayout *ecclayout; |
166 | 166 | ||
167 | /* max number of correctible bit errors per writesize */ | ||
168 | unsigned int ecc_strength; | ||
169 | |||
167 | /* Data for variable erase regions. If numeraseregions is zero, | 170 | /* Data for variable erase regions. If numeraseregions is zero, |
168 | * it means that the whole device has erasesize as given above. | 171 | * it means that the whole device has erasesize as given above. |
169 | */ | 172 | */ |
@@ -174,52 +177,52 @@ struct mtd_info { | |||
174 | * Do not call via these pointers, use corresponding mtd_*() | 177 | * Do not call via these pointers, use corresponding mtd_*() |
175 | * wrappers instead. | 178 | * wrappers instead. |
176 | */ | 179 | */ |
177 | int (*erase) (struct mtd_info *mtd, struct erase_info *instr); | 180 | int (*_erase) (struct mtd_info *mtd, struct erase_info *instr); |
178 | int (*point) (struct mtd_info *mtd, loff_t from, size_t len, | 181 | int (*_point) (struct mtd_info *mtd, loff_t from, size_t len, |
179 | size_t *retlen, void **virt, resource_size_t *phys); | 182 | size_t *retlen, void **virt, resource_size_t *phys); |
180 | void (*unpoint) (struct mtd_info *mtd, loff_t from, size_t len); | 183 | int (*_unpoint) (struct mtd_info *mtd, loff_t from, size_t len); |
181 | unsigned long (*get_unmapped_area) (struct mtd_info *mtd, | 184 | unsigned long (*_get_unmapped_area) (struct mtd_info *mtd, |
182 | unsigned long len, | 185 | unsigned long len, |
183 | unsigned long offset, | 186 | unsigned long offset, |
184 | unsigned long flags); | 187 | unsigned long flags); |
185 | int (*read) (struct mtd_info *mtd, loff_t from, size_t len, | 188 | int (*_read) (struct mtd_info *mtd, loff_t from, size_t len, |
186 | size_t *retlen, u_char *buf); | 189 | size_t *retlen, u_char *buf); |
187 | int (*write) (struct mtd_info *mtd, loff_t to, size_t len, | 190 | int (*_write) (struct mtd_info *mtd, loff_t to, size_t len, |
188 | size_t *retlen, const u_char *buf); | 191 | size_t *retlen, const u_char *buf); |
189 | int (*panic_write) (struct mtd_info *mtd, loff_t to, size_t len, | 192 | int (*_panic_write) (struct mtd_info *mtd, loff_t to, size_t len, |
190 | size_t *retlen, const u_char *buf); | 193 | size_t *retlen, const u_char *buf); |
191 | int (*read_oob) (struct mtd_info *mtd, loff_t from, | 194 | int (*_read_oob) (struct mtd_info *mtd, loff_t from, |
192 | struct mtd_oob_ops *ops); | ||
193 | int (*write_oob) (struct mtd_info *mtd, loff_t to, | ||
194 | struct mtd_oob_ops *ops); | 195 | struct mtd_oob_ops *ops); |
195 | int (*get_fact_prot_info) (struct mtd_info *mtd, struct otp_info *buf, | 196 | int (*_write_oob) (struct mtd_info *mtd, loff_t to, |
196 | size_t len); | 197 | struct mtd_oob_ops *ops); |
197 | int (*read_fact_prot_reg) (struct mtd_info *mtd, loff_t from, | 198 | int (*_get_fact_prot_info) (struct mtd_info *mtd, struct otp_info *buf, |
198 | size_t len, size_t *retlen, u_char *buf); | 199 | size_t len); |
199 | int (*get_user_prot_info) (struct mtd_info *mtd, struct otp_info *buf, | 200 | int (*_read_fact_prot_reg) (struct mtd_info *mtd, loff_t from, |
200 | size_t len); | 201 | size_t len, size_t *retlen, u_char *buf); |
201 | int (*read_user_prot_reg) (struct mtd_info *mtd, loff_t from, | 202 | int (*_get_user_prot_info) (struct mtd_info *mtd, struct otp_info *buf, |
202 | size_t len, size_t *retlen, u_char *buf); | 203 | size_t len); |
203 | int (*write_user_prot_reg) (struct mtd_info *mtd, loff_t to, size_t len, | 204 | int (*_read_user_prot_reg) (struct mtd_info *mtd, loff_t from, |
204 | size_t *retlen, u_char *buf); | 205 | size_t len, size_t *retlen, u_char *buf); |
205 | int (*lock_user_prot_reg) (struct mtd_info *mtd, loff_t from, | 206 | int (*_write_user_prot_reg) (struct mtd_info *mtd, loff_t to, |
206 | size_t len); | 207 | size_t len, size_t *retlen, u_char *buf); |
207 | int (*writev) (struct mtd_info *mtd, const struct kvec *vecs, | 208 | int (*_lock_user_prot_reg) (struct mtd_info *mtd, loff_t from, |
209 | size_t len); | ||
210 | int (*_writev) (struct mtd_info *mtd, const struct kvec *vecs, | ||
208 | unsigned long count, loff_t to, size_t *retlen); | 211 | unsigned long count, loff_t to, size_t *retlen); |
209 | void (*sync) (struct mtd_info *mtd); | 212 | void (*_sync) (struct mtd_info *mtd); |
210 | int (*lock) (struct mtd_info *mtd, loff_t ofs, uint64_t len); | 213 | int (*_lock) (struct mtd_info *mtd, loff_t ofs, uint64_t len); |
211 | int (*unlock) (struct mtd_info *mtd, loff_t ofs, uint64_t len); | 214 | int (*_unlock) (struct mtd_info *mtd, loff_t ofs, uint64_t len); |
212 | int (*is_locked) (struct mtd_info *mtd, loff_t ofs, uint64_t len); | 215 | int (*_is_locked) (struct mtd_info *mtd, loff_t ofs, uint64_t len); |
213 | int (*block_isbad) (struct mtd_info *mtd, loff_t ofs); | 216 | int (*_block_isbad) (struct mtd_info *mtd, loff_t ofs); |
214 | int (*block_markbad) (struct mtd_info *mtd, loff_t ofs); | 217 | int (*_block_markbad) (struct mtd_info *mtd, loff_t ofs); |
215 | int (*suspend) (struct mtd_info *mtd); | 218 | int (*_suspend) (struct mtd_info *mtd); |
216 | void (*resume) (struct mtd_info *mtd); | 219 | void (*_resume) (struct mtd_info *mtd); |
217 | /* | 220 | /* |
218 | * If the driver is something smart, like UBI, it may need to maintain | 221 | * If the driver is something smart, like UBI, it may need to maintain |
219 | * its own reference counting. The below functions are only for driver. | 222 | * its own reference counting. The below functions are only for driver. |
220 | */ | 223 | */ |
221 | int (*get_device) (struct mtd_info *mtd); | 224 | int (*_get_device) (struct mtd_info *mtd); |
222 | void (*put_device) (struct mtd_info *mtd); | 225 | void (*_put_device) (struct mtd_info *mtd); |
223 | 226 | ||
224 | /* Backing device capabilities for this device | 227 | /* Backing device capabilities for this device |
225 | * - provides mmap capabilities | 228 | * - provides mmap capabilities |
@@ -240,214 +243,75 @@ struct mtd_info { | |||
240 | int usecount; | 243 | int usecount; |
241 | }; | 244 | }; |
242 | 245 | ||
243 | /* | 246 | int mtd_erase(struct mtd_info *mtd, struct erase_info *instr); |
244 | * Erase is an asynchronous operation. Device drivers are supposed | 247 | int mtd_point(struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, |
245 | * to call instr->callback() whenever the operation completes, even | 248 | void **virt, resource_size_t *phys); |
246 | * if it completes with a failure. | 249 | int mtd_unpoint(struct mtd_info *mtd, loff_t from, size_t len); |
247 | * Callers are supposed to pass a callback function and wait for it | 250 | unsigned long mtd_get_unmapped_area(struct mtd_info *mtd, unsigned long len, |
248 | * to be called before writing to the block. | 251 | unsigned long offset, unsigned long flags); |
249 | */ | 252 | int mtd_read(struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, |
250 | static inline int mtd_erase(struct mtd_info *mtd, struct erase_info *instr) | 253 | u_char *buf); |
251 | { | 254 | int mtd_write(struct mtd_info *mtd, loff_t to, size_t len, size_t *retlen, |
252 | return mtd->erase(mtd, instr); | 255 | const u_char *buf); |
253 | } | 256 | int mtd_panic_write(struct mtd_info *mtd, loff_t to, size_t len, size_t *retlen, |
254 | 257 | const u_char *buf); | |
255 | /* | ||
256 | * This stuff for eXecute-In-Place. phys is optional and may be set to NULL. | ||
257 | */ | ||
258 | static inline int mtd_point(struct mtd_info *mtd, loff_t from, size_t len, | ||
259 | size_t *retlen, void **virt, resource_size_t *phys) | ||
260 | { | ||
261 | *retlen = 0; | ||
262 | if (!mtd->point) | ||
263 | return -EOPNOTSUPP; | ||
264 | return mtd->point(mtd, from, len, retlen, virt, phys); | ||
265 | } | ||
266 | |||
267 | /* We probably shouldn't allow XIP if the unpoint isn't a NULL */ | ||
268 | static inline void mtd_unpoint(struct mtd_info *mtd, loff_t from, size_t len) | ||
269 | { | ||
270 | return mtd->unpoint(mtd, from, len); | ||
271 | } | ||
272 | |||
273 | /* | ||
274 | * Allow NOMMU mmap() to directly map the device (if not NULL) | ||
275 | * - return the address to which the offset maps | ||
276 | * - return -ENOSYS to indicate refusal to do the mapping | ||
277 | */ | ||
278 | static inline unsigned long mtd_get_unmapped_area(struct mtd_info *mtd, | ||
279 | unsigned long len, | ||
280 | unsigned long offset, | ||
281 | unsigned long flags) | ||
282 | { | ||
283 | if (!mtd->get_unmapped_area) | ||
284 | return -EOPNOTSUPP; | ||
285 | return mtd->get_unmapped_area(mtd, len, offset, flags); | ||
286 | } | ||
287 | |||
288 | static inline int mtd_read(struct mtd_info *mtd, loff_t from, size_t len, | ||
289 | size_t *retlen, u_char *buf) | ||
290 | { | ||
291 | return mtd->read(mtd, from, len, retlen, buf); | ||
292 | } | ||
293 | |||
294 | static inline int mtd_write(struct mtd_info *mtd, loff_t to, size_t len, | ||
295 | size_t *retlen, const u_char *buf) | ||
296 | { | ||
297 | *retlen = 0; | ||
298 | if (!mtd->write) | ||
299 | return -EROFS; | ||
300 | return mtd->write(mtd, to, len, retlen, buf); | ||
301 | } | ||
302 | |||
303 | /* | ||
304 | * In blackbox flight recorder like scenarios we want to make successful writes | ||
305 | * in interrupt context. panic_write() is only intended to be called when its | ||
306 | * known the kernel is about to panic and we need the write to succeed. Since | ||
307 | * the kernel is not going to be running for much longer, this function can | ||
308 | * break locks and delay to ensure the write succeeds (but not sleep). | ||
309 | */ | ||
310 | static inline int mtd_panic_write(struct mtd_info *mtd, loff_t to, size_t len, | ||
311 | size_t *retlen, const u_char *buf) | ||
312 | { | ||
313 | *retlen = 0; | ||
314 | if (!mtd->panic_write) | ||
315 | return -EOPNOTSUPP; | ||
316 | return mtd->panic_write(mtd, to, len, retlen, buf); | ||
317 | } | ||
318 | 258 | ||
319 | static inline int mtd_read_oob(struct mtd_info *mtd, loff_t from, | 259 | static inline int mtd_read_oob(struct mtd_info *mtd, loff_t from, |
320 | struct mtd_oob_ops *ops) | 260 | struct mtd_oob_ops *ops) |
321 | { | 261 | { |
322 | ops->retlen = ops->oobretlen = 0; | 262 | ops->retlen = ops->oobretlen = 0; |
323 | if (!mtd->read_oob) | 263 | if (!mtd->_read_oob) |
324 | return -EOPNOTSUPP; | 264 | return -EOPNOTSUPP; |
325 | return mtd->read_oob(mtd, from, ops); | 265 | return mtd->_read_oob(mtd, from, ops); |
326 | } | 266 | } |
327 | 267 | ||
328 | static inline int mtd_write_oob(struct mtd_info *mtd, loff_t to, | 268 | static inline int mtd_write_oob(struct mtd_info *mtd, loff_t to, |
329 | struct mtd_oob_ops *ops) | 269 | struct mtd_oob_ops *ops) |
330 | { | 270 | { |
331 | ops->retlen = ops->oobretlen = 0; | 271 | ops->retlen = ops->oobretlen = 0; |
332 | if (!mtd->write_oob) | 272 | if (!mtd->_write_oob) |
333 | return -EOPNOTSUPP; | ||
334 | return mtd->write_oob(mtd, to, ops); | ||
335 | } | ||
336 | |||
337 | /* | ||
338 | * Method to access the protection register area, present in some flash | ||
339 | * devices. The user data is one time programmable but the factory data is read | ||
340 | * only. | ||
341 | */ | ||
342 | static inline int mtd_get_fact_prot_info(struct mtd_info *mtd, | ||
343 | struct otp_info *buf, size_t len) | ||
344 | { | ||
345 | if (!mtd->get_fact_prot_info) | ||
346 | return -EOPNOTSUPP; | 273 | return -EOPNOTSUPP; |
347 | return mtd->get_fact_prot_info(mtd, buf, len); | 274 | if (!(mtd->flags & MTD_WRITEABLE)) |
348 | } | 275 | return -EROFS; |
349 | 276 | return mtd->_write_oob(mtd, to, ops); | |
350 | static inline int mtd_read_fact_prot_reg(struct mtd_info *mtd, loff_t from, | ||
351 | size_t len, size_t *retlen, | ||
352 | u_char *buf) | ||
353 | { | ||
354 | *retlen = 0; | ||
355 | if (!mtd->read_fact_prot_reg) | ||
356 | return -EOPNOTSUPP; | ||
357 | return mtd->read_fact_prot_reg(mtd, from, len, retlen, buf); | ||
358 | } | ||
359 | |||
360 | static inline int mtd_get_user_prot_info(struct mtd_info *mtd, | ||
361 | struct otp_info *buf, | ||
362 | size_t len) | ||
363 | { | ||
364 | if (!mtd->get_user_prot_info) | ||
365 | return -EOPNOTSUPP; | ||
366 | return mtd->get_user_prot_info(mtd, buf, len); | ||
367 | } | ||
368 | |||
369 | static inline int mtd_read_user_prot_reg(struct mtd_info *mtd, loff_t from, | ||
370 | size_t len, size_t *retlen, | ||
371 | u_char *buf) | ||
372 | { | ||
373 | *retlen = 0; | ||
374 | if (!mtd->read_user_prot_reg) | ||
375 | return -EOPNOTSUPP; | ||
376 | return mtd->read_user_prot_reg(mtd, from, len, retlen, buf); | ||
377 | } | ||
378 | |||
379 | static inline int mtd_write_user_prot_reg(struct mtd_info *mtd, loff_t to, | ||
380 | size_t len, size_t *retlen, | ||
381 | u_char *buf) | ||
382 | { | ||
383 | *retlen = 0; | ||
384 | if (!mtd->write_user_prot_reg) | ||
385 | return -EOPNOTSUPP; | ||
386 | return mtd->write_user_prot_reg(mtd, to, len, retlen, buf); | ||
387 | } | 277 | } |
388 | 278 | ||
389 | static inline int mtd_lock_user_prot_reg(struct mtd_info *mtd, loff_t from, | 279 | int mtd_get_fact_prot_info(struct mtd_info *mtd, struct otp_info *buf, |
390 | size_t len) | 280 | size_t len); |
391 | { | 281 | int mtd_read_fact_prot_reg(struct mtd_info *mtd, loff_t from, size_t len, |
392 | if (!mtd->lock_user_prot_reg) | 282 | size_t *retlen, u_char *buf); |
393 | return -EOPNOTSUPP; | 283 | int mtd_get_user_prot_info(struct mtd_info *mtd, struct otp_info *buf, |
394 | return mtd->lock_user_prot_reg(mtd, from, len); | 284 | size_t len); |
395 | } | 285 | int mtd_read_user_prot_reg(struct mtd_info *mtd, loff_t from, size_t len, |
286 | size_t *retlen, u_char *buf); | ||
287 | int mtd_write_user_prot_reg(struct mtd_info *mtd, loff_t to, size_t len, | ||
288 | size_t *retlen, u_char *buf); | ||
289 | int mtd_lock_user_prot_reg(struct mtd_info *mtd, loff_t from, size_t len); | ||
396 | 290 | ||
397 | int mtd_writev(struct mtd_info *mtd, const struct kvec *vecs, | 291 | int mtd_writev(struct mtd_info *mtd, const struct kvec *vecs, |
398 | unsigned long count, loff_t to, size_t *retlen); | 292 | unsigned long count, loff_t to, size_t *retlen); |
399 | 293 | ||
400 | static inline void mtd_sync(struct mtd_info *mtd) | 294 | static inline void mtd_sync(struct mtd_info *mtd) |
401 | { | 295 | { |
402 | if (mtd->sync) | 296 | if (mtd->_sync) |
403 | mtd->sync(mtd); | 297 | mtd->_sync(mtd); |
404 | } | ||
405 | |||
406 | /* Chip-supported device locking */ | ||
407 | static inline int mtd_lock(struct mtd_info *mtd, loff_t ofs, uint64_t len) | ||
408 | { | ||
409 | if (!mtd->lock) | ||
410 | return -EOPNOTSUPP; | ||
411 | return mtd->lock(mtd, ofs, len); | ||
412 | } | 298 | } |
413 | 299 | ||
414 | static inline int mtd_unlock(struct mtd_info *mtd, loff_t ofs, uint64_t len) | 300 | int mtd_lock(struct mtd_info *mtd, loff_t ofs, uint64_t len); |
415 | { | 301 | int mtd_unlock(struct mtd_info *mtd, loff_t ofs, uint64_t len); |
416 | if (!mtd->unlock) | 302 | int mtd_is_locked(struct mtd_info *mtd, loff_t ofs, uint64_t len); |
417 | return -EOPNOTSUPP; | 303 | int mtd_block_isbad(struct mtd_info *mtd, loff_t ofs); |
418 | return mtd->unlock(mtd, ofs, len); | 304 | int mtd_block_markbad(struct mtd_info *mtd, loff_t ofs); |
419 | } | ||
420 | |||
421 | static inline int mtd_is_locked(struct mtd_info *mtd, loff_t ofs, uint64_t len) | ||
422 | { | ||
423 | if (!mtd->is_locked) | ||
424 | return -EOPNOTSUPP; | ||
425 | return mtd->is_locked(mtd, ofs, len); | ||
426 | } | ||
427 | 305 | ||
428 | static inline int mtd_suspend(struct mtd_info *mtd) | 306 | static inline int mtd_suspend(struct mtd_info *mtd) |
429 | { | 307 | { |
430 | return mtd->suspend ? mtd->suspend(mtd) : 0; | 308 | return mtd->_suspend ? mtd->_suspend(mtd) : 0; |
431 | } | 309 | } |
432 | 310 | ||
433 | static inline void mtd_resume(struct mtd_info *mtd) | 311 | static inline void mtd_resume(struct mtd_info *mtd) |
434 | { | 312 | { |
435 | if (mtd->resume) | 313 | if (mtd->_resume) |
436 | mtd->resume(mtd); | 314 | mtd->_resume(mtd); |
437 | } | ||
438 | |||
439 | static inline int mtd_block_isbad(struct mtd_info *mtd, loff_t ofs) | ||
440 | { | ||
441 | if (!mtd->block_isbad) | ||
442 | return 0; | ||
443 | return mtd->block_isbad(mtd, ofs); | ||
444 | } | ||
445 | |||
446 | static inline int mtd_block_markbad(struct mtd_info *mtd, loff_t ofs) | ||
447 | { | ||
448 | if (!mtd->block_markbad) | ||
449 | return -EOPNOTSUPP; | ||
450 | return mtd->block_markbad(mtd, ofs); | ||
451 | } | 315 | } |
452 | 316 | ||
453 | static inline uint32_t mtd_div_by_eb(uint64_t sz, struct mtd_info *mtd) | 317 | static inline uint32_t mtd_div_by_eb(uint64_t sz, struct mtd_info *mtd) |
@@ -482,12 +346,12 @@ static inline uint32_t mtd_mod_by_ws(uint64_t sz, struct mtd_info *mtd) | |||
482 | 346 | ||
483 | static inline int mtd_has_oob(const struct mtd_info *mtd) | 347 | static inline int mtd_has_oob(const struct mtd_info *mtd) |
484 | { | 348 | { |
485 | return mtd->read_oob && mtd->write_oob; | 349 | return mtd->_read_oob && mtd->_write_oob; |
486 | } | 350 | } |
487 | 351 | ||
488 | static inline int mtd_can_have_bb(const struct mtd_info *mtd) | 352 | static inline int mtd_can_have_bb(const struct mtd_info *mtd) |
489 | { | 353 | { |
490 | return !!mtd->block_isbad; | 354 | return !!mtd->_block_isbad; |
491 | } | 355 | } |
492 | 356 | ||
493 | /* Kernel-side ioctl definitions */ | 357 | /* Kernel-side ioctl definitions */ |
diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h index 63b5a8b6dfbd..1482340d3d9f 100644 --- a/include/linux/mtd/nand.h +++ b/include/linux/mtd/nand.h | |||
@@ -324,6 +324,7 @@ struct nand_hw_control { | |||
324 | * @steps: number of ECC steps per page | 324 | * @steps: number of ECC steps per page |
325 | * @size: data bytes per ECC step | 325 | * @size: data bytes per ECC step |
326 | * @bytes: ECC bytes per step | 326 | * @bytes: ECC bytes per step |
327 | * @strength: max number of correctible bits per ECC step | ||
327 | * @total: total number of ECC bytes per page | 328 | * @total: total number of ECC bytes per page |
328 | * @prepad: padding information for syndrome based ECC generators | 329 | * @prepad: padding information for syndrome based ECC generators |
329 | * @postpad: padding information for syndrome based ECC generators | 330 | * @postpad: padding information for syndrome based ECC generators |
@@ -351,6 +352,7 @@ struct nand_ecc_ctrl { | |||
351 | int size; | 352 | int size; |
352 | int bytes; | 353 | int bytes; |
353 | int total; | 354 | int total; |
355 | int strength; | ||
354 | int prepad; | 356 | int prepad; |
355 | int postpad; | 357 | int postpad; |
356 | struct nand_ecclayout *layout; | 358 | struct nand_ecclayout *layout; |
@@ -448,8 +450,9 @@ struct nand_buffers { | |||
448 | * will be copied to the appropriate nand_bbt_descr's. | 450 | * will be copied to the appropriate nand_bbt_descr's. |
449 | * @badblockpos: [INTERN] position of the bad block marker in the oob | 451 | * @badblockpos: [INTERN] position of the bad block marker in the oob |
450 | * area. | 452 | * area. |
451 | * @badblockbits: [INTERN] number of bits to left-shift the bad block | 453 | * @badblockbits: [INTERN] minimum number of set bits in a good block's |
452 | * number | 454 | * bad block marker position; i.e., BBM == 11110111b is |
455 | * not bad when badblockbits == 7 | ||
453 | * @cellinfo: [INTERN] MLC/multichip data from chip ident | 456 | * @cellinfo: [INTERN] MLC/multichip data from chip ident |
454 | * @numchips: [INTERN] number of physical chips | 457 | * @numchips: [INTERN] number of physical chips |
455 | * @chipsize: [INTERN] the size of one chip for multichip arrays | 458 | * @chipsize: [INTERN] the size of one chip for multichip arrays |
diff --git a/include/linux/mtd/pmc551.h b/include/linux/mtd/pmc551.h deleted file mode 100644 index 27ad40aed19f..000000000000 --- a/include/linux/mtd/pmc551.h +++ /dev/null | |||
@@ -1,78 +0,0 @@ | |||
1 | /* | ||
2 | * PMC551 PCI Mezzanine Ram Device | ||
3 | * | ||
4 | * Author: | ||
5 | * Mark Ferrell | ||
6 | * Copyright 1999,2000 Nortel Networks | ||
7 | * | ||
8 | * License: | ||
9 | * As part of this driver was derrived from the slram.c driver it falls | ||
10 | * under the same license, which is GNU General Public License v2 | ||
11 | */ | ||
12 | |||
13 | #ifndef __MTD_PMC551_H__ | ||
14 | #define __MTD_PMC551_H__ | ||
15 | |||
16 | #include <linux/mtd/mtd.h> | ||
17 | |||
18 | #define PMC551_VERSION \ | ||
19 | "Ramix PMC551 PCI Mezzanine Ram Driver. (C) 1999,2000 Nortel Networks.\n" | ||
20 | |||
21 | /* | ||
22 | * Our personal and private information | ||
23 | */ | ||
24 | struct mypriv { | ||
25 | struct pci_dev *dev; | ||
26 | u_char *start; | ||
27 | u32 base_map0; | ||
28 | u32 curr_map0; | ||
29 | u32 asize; | ||
30 | struct mtd_info *nextpmc551; | ||
31 | }; | ||
32 | |||
33 | /* | ||
34 | * Function Prototypes | ||
35 | */ | ||
36 | static int pmc551_erase(struct mtd_info *, struct erase_info *); | ||
37 | static void pmc551_unpoint(struct mtd_info *, loff_t, size_t); | ||
38 | static int pmc551_point(struct mtd_info *mtd, loff_t from, size_t len, | ||
39 | size_t *retlen, void **virt, resource_size_t *phys); | ||
40 | static int pmc551_read(struct mtd_info *, loff_t, size_t, size_t *, u_char *); | ||
41 | static int pmc551_write(struct mtd_info *, loff_t, size_t, size_t *, const u_char *); | ||
42 | |||
43 | |||
44 | /* | ||
45 | * Define the PCI ID's if the kernel doesn't define them for us | ||
46 | */ | ||
47 | #ifndef PCI_VENDOR_ID_V3_SEMI | ||
48 | #define PCI_VENDOR_ID_V3_SEMI 0x11b0 | ||
49 | #endif | ||
50 | |||
51 | #ifndef PCI_DEVICE_ID_V3_SEMI_V370PDC | ||
52 | #define PCI_DEVICE_ID_V3_SEMI_V370PDC 0x0200 | ||
53 | #endif | ||
54 | |||
55 | |||
56 | #define PMC551_PCI_MEM_MAP0 0x50 | ||
57 | #define PMC551_PCI_MEM_MAP1 0x54 | ||
58 | #define PMC551_PCI_MEM_MAP_MAP_ADDR_MASK 0x3ff00000 | ||
59 | #define PMC551_PCI_MEM_MAP_APERTURE_MASK 0x000000f0 | ||
60 | #define PMC551_PCI_MEM_MAP_REG_EN 0x00000002 | ||
61 | #define PMC551_PCI_MEM_MAP_ENABLE 0x00000001 | ||
62 | |||
63 | #define PMC551_SDRAM_MA 0x60 | ||
64 | #define PMC551_SDRAM_CMD 0x62 | ||
65 | #define PMC551_DRAM_CFG 0x64 | ||
66 | #define PMC551_SYS_CTRL_REG 0x78 | ||
67 | |||
68 | #define PMC551_DRAM_BLK0 0x68 | ||
69 | #define PMC551_DRAM_BLK1 0x6c | ||
70 | #define PMC551_DRAM_BLK2 0x70 | ||
71 | #define PMC551_DRAM_BLK3 0x74 | ||
72 | #define PMC551_DRAM_BLK_GET_SIZE(x) (524288<<((x>>4)&0x0f)) | ||
73 | #define PMC551_DRAM_BLK_SET_COL_MUX(x,v) (((x) & ~0x00007000) | (((v) & 0x7) << 12)) | ||
74 | #define PMC551_DRAM_BLK_SET_ROW_MUX(x,v) (((x) & ~0x00000f00) | (((v) & 0xf) << 8)) | ||
75 | |||
76 | |||
77 | #endif /* __MTD_PMC551_H__ */ | ||
78 | |||
diff --git a/include/linux/mtd/sh_flctl.h b/include/linux/mtd/sh_flctl.h index 9cf4c4c79555..a38e1fa8af01 100644 --- a/include/linux/mtd/sh_flctl.h +++ b/include/linux/mtd/sh_flctl.h | |||
@@ -23,6 +23,7 @@ | |||
23 | #include <linux/mtd/mtd.h> | 23 | #include <linux/mtd/mtd.h> |
24 | #include <linux/mtd/nand.h> | 24 | #include <linux/mtd/nand.h> |
25 | #include <linux/mtd/partitions.h> | 25 | #include <linux/mtd/partitions.h> |
26 | #include <linux/pm_qos.h> | ||
26 | 27 | ||
27 | /* FLCTL registers */ | 28 | /* FLCTL registers */ |
28 | #define FLCMNCR(f) (f->reg + 0x0) | 29 | #define FLCMNCR(f) (f->reg + 0x0) |
@@ -38,6 +39,7 @@ | |||
38 | #define FLDTFIFO(f) (f->reg + 0x24) | 39 | #define FLDTFIFO(f) (f->reg + 0x24) |
39 | #define FLECFIFO(f) (f->reg + 0x28) | 40 | #define FLECFIFO(f) (f->reg + 0x28) |
40 | #define FLTRCR(f) (f->reg + 0x2C) | 41 | #define FLTRCR(f) (f->reg + 0x2C) |
42 | #define FLHOLDCR(f) (f->reg + 0x38) | ||
41 | #define FL4ECCRESULT0(f) (f->reg + 0x80) | 43 | #define FL4ECCRESULT0(f) (f->reg + 0x80) |
42 | #define FL4ECCRESULT1(f) (f->reg + 0x84) | 44 | #define FL4ECCRESULT1(f) (f->reg + 0x84) |
43 | #define FL4ECCRESULT2(f) (f->reg + 0x88) | 45 | #define FL4ECCRESULT2(f) (f->reg + 0x88) |
@@ -67,6 +69,30 @@ | |||
67 | #define CE0_ENABLE (0x1 << 3) /* Chip Enable 0 */ | 69 | #define CE0_ENABLE (0x1 << 3) /* Chip Enable 0 */ |
68 | #define TYPESEL_SET (0x1 << 0) | 70 | #define TYPESEL_SET (0x1 << 0) |
69 | 71 | ||
72 | /* | ||
73 | * Clock settings using the PULSEx registers from FLCMNCR | ||
74 | * | ||
75 | * Some hardware uses bits called PULSEx instead of FCKSEL_E and QTSEL_E | ||
76 | * to control the clock divider used between the High-Speed Peripheral Clock | ||
77 | * and the FLCTL internal clock. If so, use CLK_8_BIT_xxx for connecting 8 bit | ||
78 | * and CLK_16_BIT_xxx for connecting 16 bit bus bandwith NAND chips. For the 16 | ||
79 | * bit version the divider is seperate for the pulse width of high and low | ||
80 | * signals. | ||
81 | */ | ||
82 | #define PULSE3 (0x1 << 27) | ||
83 | #define PULSE2 (0x1 << 17) | ||
84 | #define PULSE1 (0x1 << 15) | ||
85 | #define PULSE0 (0x1 << 9) | ||
86 | #define CLK_8B_0_5 PULSE1 | ||
87 | #define CLK_8B_1 0x0 | ||
88 | #define CLK_8B_1_5 (PULSE1 | PULSE2) | ||
89 | #define CLK_8B_2 PULSE0 | ||
90 | #define CLK_8B_3 (PULSE0 | PULSE1 | PULSE2) | ||
91 | #define CLK_8B_4 (PULSE0 | PULSE2) | ||
92 | #define CLK_16B_6L_2H PULSE0 | ||
93 | #define CLK_16B_9L_3H (PULSE0 | PULSE1 | PULSE2) | ||
94 | #define CLK_16B_12L_4H (PULSE0 | PULSE2) | ||
95 | |||
70 | /* FLCMDCR control bits */ | 96 | /* FLCMDCR control bits */ |
71 | #define ADRCNT2_E (0x1 << 31) /* 5byte address enable */ | 97 | #define ADRCNT2_E (0x1 << 31) /* 5byte address enable */ |
72 | #define ADRMD_E (0x1 << 26) /* Sector address access */ | 98 | #define ADRMD_E (0x1 << 26) /* Sector address access */ |
@@ -85,6 +111,15 @@ | |||
85 | #define TRSTRT (0x1 << 0) /* translation start */ | 111 | #define TRSTRT (0x1 << 0) /* translation start */ |
86 | #define TREND (0x1 << 1) /* translation end */ | 112 | #define TREND (0x1 << 1) /* translation end */ |
87 | 113 | ||
114 | /* | ||
115 | * FLHOLDCR control bits | ||
116 | * | ||
117 | * HOLDEN: Bus Occupancy Enable (inverted) | ||
118 | * Enable this bit when the external bus might be used in between transfers. | ||
119 | * If not set and the bus gets used by other modules, a deadlock occurs. | ||
120 | */ | ||
121 | #define HOLDEN (0x1 << 0) | ||
122 | |||
88 | /* FL4ECCCR control bits */ | 123 | /* FL4ECCCR control bits */ |
89 | #define _4ECCFA (0x1 << 2) /* 4 symbols correct fault */ | 124 | #define _4ECCFA (0x1 << 2) /* 4 symbols correct fault */ |
90 | #define _4ECCEND (0x1 << 1) /* 4 symbols end */ | 125 | #define _4ECCEND (0x1 << 1) /* 4 symbols end */ |
@@ -97,6 +132,7 @@ struct sh_flctl { | |||
97 | struct mtd_info mtd; | 132 | struct mtd_info mtd; |
98 | struct nand_chip chip; | 133 | struct nand_chip chip; |
99 | struct platform_device *pdev; | 134 | struct platform_device *pdev; |
135 | struct dev_pm_qos_request pm_qos; | ||
100 | void __iomem *reg; | 136 | void __iomem *reg; |
101 | 137 | ||
102 | uint8_t done_buff[2048 + 64]; /* max size 2048 + 64 */ | 138 | uint8_t done_buff[2048 + 64]; /* max size 2048 + 64 */ |
@@ -108,11 +144,14 @@ struct sh_flctl { | |||
108 | int erase1_page_addr; /* page_addr in ERASE1 cmd */ | 144 | int erase1_page_addr; /* page_addr in ERASE1 cmd */ |
109 | uint32_t erase_ADRCNT; /* bits of FLCMDCR in ERASE1 cmd */ | 145 | uint32_t erase_ADRCNT; /* bits of FLCMDCR in ERASE1 cmd */ |
110 | uint32_t rw_ADRCNT; /* bits of FLCMDCR in READ WRITE cmd */ | 146 | uint32_t rw_ADRCNT; /* bits of FLCMDCR in READ WRITE cmd */ |
147 | uint32_t flcmncr_base; /* base value of FLCMNCR */ | ||
111 | 148 | ||
112 | int hwecc_cant_correct[4]; | 149 | int hwecc_cant_correct[4]; |
113 | 150 | ||
114 | unsigned page_size:1; /* NAND page size (0 = 512, 1 = 2048) */ | 151 | unsigned page_size:1; /* NAND page size (0 = 512, 1 = 2048) */ |
115 | unsigned hwecc:1; /* Hardware ECC (0 = disabled, 1 = enabled) */ | 152 | unsigned hwecc:1; /* Hardware ECC (0 = disabled, 1 = enabled) */ |
153 | unsigned holden:1; /* Hardware has FLHOLDCR and HOLDEN is set */ | ||
154 | unsigned qos_request:1; /* QoS request to prevent deep power shutdown */ | ||
116 | }; | 155 | }; |
117 | 156 | ||
118 | struct sh_flctl_platform_data { | 157 | struct sh_flctl_platform_data { |
@@ -121,6 +160,7 @@ struct sh_flctl_platform_data { | |||
121 | unsigned long flcmncr_val; | 160 | unsigned long flcmncr_val; |
122 | 161 | ||
123 | unsigned has_hwecc:1; | 162 | unsigned has_hwecc:1; |
163 | unsigned use_holden:1; | ||
124 | }; | 164 | }; |
125 | 165 | ||
126 | static inline struct sh_flctl *mtd_to_flctl(struct mtd_info *mtdinfo) | 166 | static inline struct sh_flctl *mtd_to_flctl(struct mtd_info *mtdinfo) |
diff --git a/include/linux/mtd/spear_smi.h b/include/linux/mtd/spear_smi.h new file mode 100644 index 000000000000..8ae1726044c3 --- /dev/null +++ b/include/linux/mtd/spear_smi.h | |||
@@ -0,0 +1,65 @@ | |||
1 | /* | ||
2 | * Copyright © 2010 ST Microelectronics | ||
3 | * Shiraz Hashim <shiraz.hashim@st.com> | ||
4 | * | ||
5 | * This file is licensed under the terms of the GNU General Public | ||
6 | * License version 2. This program is licensed "as is" without any | ||
7 | * warranty of any kind, whether express or implied. | ||
8 | */ | ||
9 | |||
10 | #ifndef __MTD_SPEAR_SMI_H | ||
11 | #define __MTD_SPEAR_SMI_H | ||
12 | |||
13 | #include <linux/types.h> | ||
14 | #include <linux/mtd/mtd.h> | ||
15 | #include <linux/mtd/partitions.h> | ||
16 | #include <linux/platform_device.h> | ||
17 | #include <linux/of.h> | ||
18 | |||
19 | /* max possible slots for serial-nor flash chip in the SMI controller */ | ||
20 | #define MAX_NUM_FLASH_CHIP 4 | ||
21 | |||
22 | /* macro to define partitions for flash devices */ | ||
23 | #define DEFINE_PARTS(n, of, s) \ | ||
24 | { \ | ||
25 | .name = n, \ | ||
26 | .offset = of, \ | ||
27 | .size = s, \ | ||
28 | } | ||
29 | |||
30 | /** | ||
31 | * struct spear_smi_flash_info - platform structure for passing flash | ||
32 | * information | ||
33 | * | ||
34 | * name: name of the serial nor flash for identification | ||
35 | * mem_base: the memory base on which the flash is mapped | ||
36 | * size: size of the flash in bytes | ||
37 | * partitions: parition details | ||
38 | * nr_partitions: number of partitions | ||
39 | * fast_mode: whether flash supports fast mode | ||
40 | */ | ||
41 | |||
42 | struct spear_smi_flash_info { | ||
43 | char *name; | ||
44 | unsigned long mem_base; | ||
45 | unsigned long size; | ||
46 | struct mtd_partition *partitions; | ||
47 | int nr_partitions; | ||
48 | u8 fast_mode; | ||
49 | }; | ||
50 | |||
51 | /** | ||
52 | * struct spear_smi_plat_data - platform structure for configuring smi | ||
53 | * | ||
54 | * clk_rate: clk rate at which SMI must operate | ||
55 | * num_flashes: number of flashes present on board | ||
56 | * board_flash_info: specific details of each flash present on board | ||
57 | */ | ||
58 | struct spear_smi_plat_data { | ||
59 | unsigned long clk_rate; | ||
60 | int num_flashes; | ||
61 | struct spear_smi_flash_info *board_flash_info; | ||
62 | struct device_node *np[MAX_NUM_FLASH_CHIP]; | ||
63 | }; | ||
64 | |||
65 | #endif /* __MTD_SPEAR_SMI_H */ | ||
diff --git a/include/linux/mtio.h b/include/linux/mtio.h index 8f825756c459..18543e2db06f 100644 --- a/include/linux/mtio.h +++ b/include/linux/mtio.h | |||
@@ -194,6 +194,7 @@ struct mtpos { | |||
194 | #define MT_ST_SYSV 0x1000 | 194 | #define MT_ST_SYSV 0x1000 |
195 | #define MT_ST_NOWAIT 0x2000 | 195 | #define MT_ST_NOWAIT 0x2000 |
196 | #define MT_ST_SILI 0x4000 | 196 | #define MT_ST_SILI 0x4000 |
197 | #define MT_ST_NOWAIT_EOF 0x8000 | ||
197 | 198 | ||
198 | /* The mode parameters to be controlled. Parameter chosen with bits 20-28 */ | 199 | /* The mode parameters to be controlled. Parameter chosen with bits 20-28 */ |
199 | #define MT_ST_CLEAR_DEFAULT 0xfffff | 200 | #define MT_ST_CLEAR_DEFAULT 0xfffff |
diff --git a/include/linux/net.h b/include/linux/net.h index b29923006b11..be60c7f5e145 100644 --- a/include/linux/net.h +++ b/include/linux/net.h | |||
@@ -206,6 +206,7 @@ struct proto_ops { | |||
206 | int offset, size_t size, int flags); | 206 | int offset, size_t size, int flags); |
207 | ssize_t (*splice_read)(struct socket *sock, loff_t *ppos, | 207 | ssize_t (*splice_read)(struct socket *sock, loff_t *ppos, |
208 | struct pipe_inode_info *pipe, size_t len, unsigned int flags); | 208 | struct pipe_inode_info *pipe, size_t len, unsigned int flags); |
209 | void (*set_peek_off)(struct sock *sk, int val); | ||
209 | }; | 210 | }; |
210 | 211 | ||
211 | #define DECLARE_SOCKADDR(type, dst, src) \ | 212 | #define DECLARE_SOCKADDR(type, dst, src) \ |
diff --git a/include/linux/netdev_features.h b/include/linux/netdev_features.h index 77f5202977ce..5ac32123035a 100644 --- a/include/linux/netdev_features.h +++ b/include/linux/netdev_features.h | |||
@@ -54,6 +54,8 @@ enum { | |||
54 | NETIF_F_RXCSUM_BIT, /* Receive checksumming offload */ | 54 | NETIF_F_RXCSUM_BIT, /* Receive checksumming offload */ |
55 | NETIF_F_NOCACHE_COPY_BIT, /* Use no-cache copyfromuser */ | 55 | NETIF_F_NOCACHE_COPY_BIT, /* Use no-cache copyfromuser */ |
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 */ | ||
58 | NETIF_F_RXALL_BIT, /* Receive errored frames too */ | ||
57 | 59 | ||
58 | /* | 60 | /* |
59 | * Add your fresh new feature above and remember to update | 61 | * Add your fresh new feature above and remember to update |
@@ -98,6 +100,8 @@ enum { | |||
98 | #define NETIF_F_TSO __NETIF_F(TSO) | 100 | #define NETIF_F_TSO __NETIF_F(TSO) |
99 | #define NETIF_F_UFO __NETIF_F(UFO) | 101 | #define NETIF_F_UFO __NETIF_F(UFO) |
100 | #define NETIF_F_VLAN_CHALLENGED __NETIF_F(VLAN_CHALLENGED) | 102 | #define NETIF_F_VLAN_CHALLENGED __NETIF_F(VLAN_CHALLENGED) |
103 | #define NETIF_F_RXFCS __NETIF_F(RXFCS) | ||
104 | #define NETIF_F_RXALL __NETIF_F(RXALL) | ||
101 | 105 | ||
102 | /* Features valid for ethtool to change */ | 106 | /* Features valid for ethtool to change */ |
103 | /* = all defined minus driver/device-class-related */ | 107 | /* = all defined minus driver/device-class-related */ |
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index 0eac07c95255..5cbaa20f1659 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h | |||
@@ -33,12 +33,12 @@ | |||
33 | #ifdef __KERNEL__ | 33 | #ifdef __KERNEL__ |
34 | #include <linux/pm_qos.h> | 34 | #include <linux/pm_qos.h> |
35 | #include <linux/timer.h> | 35 | #include <linux/timer.h> |
36 | #include <linux/bug.h> | ||
36 | #include <linux/delay.h> | 37 | #include <linux/delay.h> |
37 | #include <linux/atomic.h> | 38 | #include <linux/atomic.h> |
38 | #include <asm/cache.h> | 39 | #include <asm/cache.h> |
39 | #include <asm/byteorder.h> | 40 | #include <asm/byteorder.h> |
40 | 41 | ||
41 | #include <linux/device.h> | ||
42 | #include <linux/percpu.h> | 42 | #include <linux/percpu.h> |
43 | #include <linux/rculist.h> | 43 | #include <linux/rculist.h> |
44 | #include <linux/dmaengine.h> | 44 | #include <linux/dmaengine.h> |
@@ -56,6 +56,7 @@ | |||
56 | #include <linux/netdev_features.h> | 56 | #include <linux/netdev_features.h> |
57 | 57 | ||
58 | struct netpoll_info; | 58 | struct netpoll_info; |
59 | struct device; | ||
59 | struct phy_device; | 60 | struct phy_device; |
60 | /* 802.11 specific */ | 61 | /* 802.11 specific */ |
61 | struct wireless_dev; | 62 | struct wireless_dev; |
@@ -214,8 +215,8 @@ enum { | |||
214 | #include <linux/skbuff.h> | 215 | #include <linux/skbuff.h> |
215 | 216 | ||
216 | #ifdef CONFIG_RPS | 217 | #ifdef CONFIG_RPS |
217 | #include <linux/jump_label.h> | 218 | #include <linux/static_key.h> |
218 | extern struct jump_label_key rps_needed; | 219 | extern struct static_key rps_needed; |
219 | #endif | 220 | #endif |
220 | 221 | ||
221 | struct neighbour; | 222 | struct neighbour; |
@@ -417,7 +418,7 @@ typedef rx_handler_result_t rx_handler_func_t(struct sk_buff **pskb); | |||
417 | 418 | ||
418 | extern void __napi_schedule(struct napi_struct *n); | 419 | extern void __napi_schedule(struct napi_struct *n); |
419 | 420 | ||
420 | static inline int napi_disable_pending(struct napi_struct *n) | 421 | static inline bool napi_disable_pending(struct napi_struct *n) |
421 | { | 422 | { |
422 | return test_bit(NAPI_STATE_DISABLE, &n->state); | 423 | return test_bit(NAPI_STATE_DISABLE, &n->state); |
423 | } | 424 | } |
@@ -431,7 +432,7 @@ static inline int napi_disable_pending(struct napi_struct *n) | |||
431 | * insure only one NAPI poll instance runs. We also make | 432 | * insure only one NAPI poll instance runs. We also make |
432 | * sure there is no pending NAPI disable. | 433 | * sure there is no pending NAPI disable. |
433 | */ | 434 | */ |
434 | static inline int napi_schedule_prep(struct napi_struct *n) | 435 | static inline bool napi_schedule_prep(struct napi_struct *n) |
435 | { | 436 | { |
436 | return !napi_disable_pending(n) && | 437 | return !napi_disable_pending(n) && |
437 | !test_and_set_bit(NAPI_STATE_SCHED, &n->state); | 438 | !test_and_set_bit(NAPI_STATE_SCHED, &n->state); |
@@ -451,13 +452,13 @@ static inline void napi_schedule(struct napi_struct *n) | |||
451 | } | 452 | } |
452 | 453 | ||
453 | /* Try to reschedule poll. Called by dev->poll() after napi_complete(). */ | 454 | /* Try to reschedule poll. Called by dev->poll() after napi_complete(). */ |
454 | static inline int napi_reschedule(struct napi_struct *napi) | 455 | static inline bool napi_reschedule(struct napi_struct *napi) |
455 | { | 456 | { |
456 | if (napi_schedule_prep(napi)) { | 457 | if (napi_schedule_prep(napi)) { |
457 | __napi_schedule(napi); | 458 | __napi_schedule(napi); |
458 | return 1; | 459 | return true; |
459 | } | 460 | } |
460 | return 0; | 461 | return false; |
461 | } | 462 | } |
462 | 463 | ||
463 | /** | 464 | /** |
@@ -1082,7 +1083,8 @@ struct net_device { | |||
1082 | const struct header_ops *header_ops; | 1083 | const struct header_ops *header_ops; |
1083 | 1084 | ||
1084 | unsigned int flags; /* interface flags (a la BSD) */ | 1085 | unsigned int flags; /* interface flags (a la BSD) */ |
1085 | unsigned int priv_flags; /* Like 'flags' but invisible to userspace. */ | 1086 | unsigned int priv_flags; /* Like 'flags' but invisible to userspace. |
1087 | * See if.h for definitions. */ | ||
1086 | unsigned short gflags; | 1088 | unsigned short gflags; |
1087 | unsigned short padded; /* How much padding added by alloc_netdev() */ | 1089 | unsigned short padded; /* How much padding added by alloc_netdev() */ |
1088 | 1090 | ||
@@ -1867,7 +1869,7 @@ static inline void netif_tx_stop_all_queues(struct net_device *dev) | |||
1867 | } | 1869 | } |
1868 | } | 1870 | } |
1869 | 1871 | ||
1870 | static inline int netif_tx_queue_stopped(const struct netdev_queue *dev_queue) | 1872 | static inline bool netif_tx_queue_stopped(const struct netdev_queue *dev_queue) |
1871 | { | 1873 | { |
1872 | return test_bit(__QUEUE_STATE_DRV_XOFF, &dev_queue->state); | 1874 | return test_bit(__QUEUE_STATE_DRV_XOFF, &dev_queue->state); |
1873 | } | 1875 | } |
@@ -1878,17 +1880,17 @@ static inline int netif_tx_queue_stopped(const struct netdev_queue *dev_queue) | |||
1878 | * | 1880 | * |
1879 | * Test if transmit queue on device is currently unable to send. | 1881 | * Test if transmit queue on device is currently unable to send. |
1880 | */ | 1882 | */ |
1881 | static inline int netif_queue_stopped(const struct net_device *dev) | 1883 | static inline bool netif_queue_stopped(const struct net_device *dev) |
1882 | { | 1884 | { |
1883 | return netif_tx_queue_stopped(netdev_get_tx_queue(dev, 0)); | 1885 | return netif_tx_queue_stopped(netdev_get_tx_queue(dev, 0)); |
1884 | } | 1886 | } |
1885 | 1887 | ||
1886 | static inline int netif_xmit_stopped(const struct netdev_queue *dev_queue) | 1888 | static inline bool netif_xmit_stopped(const struct netdev_queue *dev_queue) |
1887 | { | 1889 | { |
1888 | return dev_queue->state & QUEUE_STATE_ANY_XOFF; | 1890 | return dev_queue->state & QUEUE_STATE_ANY_XOFF; |
1889 | } | 1891 | } |
1890 | 1892 | ||
1891 | static inline int netif_xmit_frozen_or_stopped(const struct netdev_queue *dev_queue) | 1893 | static inline bool netif_xmit_frozen_or_stopped(const struct netdev_queue *dev_queue) |
1892 | { | 1894 | { |
1893 | return dev_queue->state & QUEUE_STATE_ANY_XOFF_OR_FROZEN; | 1895 | return dev_queue->state & QUEUE_STATE_ANY_XOFF_OR_FROZEN; |
1894 | } | 1896 | } |
@@ -1898,12 +1900,22 @@ static inline void netdev_tx_sent_queue(struct netdev_queue *dev_queue, | |||
1898 | { | 1900 | { |
1899 | #ifdef CONFIG_BQL | 1901 | #ifdef CONFIG_BQL |
1900 | dql_queued(&dev_queue->dql, bytes); | 1902 | dql_queued(&dev_queue->dql, bytes); |
1901 | if (unlikely(dql_avail(&dev_queue->dql) < 0)) { | 1903 | |
1902 | set_bit(__QUEUE_STATE_STACK_XOFF, &dev_queue->state); | 1904 | if (likely(dql_avail(&dev_queue->dql) >= 0)) |
1903 | if (unlikely(dql_avail(&dev_queue->dql) >= 0)) | 1905 | return; |
1904 | clear_bit(__QUEUE_STATE_STACK_XOFF, | 1906 | |
1905 | &dev_queue->state); | 1907 | set_bit(__QUEUE_STATE_STACK_XOFF, &dev_queue->state); |
1906 | } | 1908 | |
1909 | /* | ||
1910 | * The XOFF flag must be set before checking the dql_avail below, | ||
1911 | * because in netdev_tx_completed_queue we update the dql_completed | ||
1912 | * before checking the XOFF flag. | ||
1913 | */ | ||
1914 | smp_mb(); | ||
1915 | |||
1916 | /* check again in case another CPU has just made room avail */ | ||
1917 | if (unlikely(dql_avail(&dev_queue->dql) >= 0)) | ||
1918 | clear_bit(__QUEUE_STATE_STACK_XOFF, &dev_queue->state); | ||
1907 | #endif | 1919 | #endif |
1908 | } | 1920 | } |
1909 | 1921 | ||
@@ -1916,16 +1928,23 @@ static inline void netdev_tx_completed_queue(struct netdev_queue *dev_queue, | |||
1916 | unsigned pkts, unsigned bytes) | 1928 | unsigned pkts, unsigned bytes) |
1917 | { | 1929 | { |
1918 | #ifdef CONFIG_BQL | 1930 | #ifdef CONFIG_BQL |
1919 | if (likely(bytes)) { | 1931 | if (unlikely(!bytes)) |
1920 | dql_completed(&dev_queue->dql, bytes); | 1932 | return; |
1921 | if (unlikely(test_bit(__QUEUE_STATE_STACK_XOFF, | 1933 | |
1922 | &dev_queue->state) && | 1934 | dql_completed(&dev_queue->dql, bytes); |
1923 | dql_avail(&dev_queue->dql) >= 0)) { | 1935 | |
1924 | if (test_and_clear_bit(__QUEUE_STATE_STACK_XOFF, | 1936 | /* |
1925 | &dev_queue->state)) | 1937 | * Without the memory barrier there is a small possiblity that |
1926 | netif_schedule_queue(dev_queue); | 1938 | * netdev_tx_sent_queue will miss the update and cause the queue to |
1927 | } | 1939 | * be stopped forever |
1928 | } | 1940 | */ |
1941 | smp_mb(); | ||
1942 | |||
1943 | if (dql_avail(&dev_queue->dql) < 0) | ||
1944 | return; | ||
1945 | |||
1946 | if (test_and_clear_bit(__QUEUE_STATE_STACK_XOFF, &dev_queue->state)) | ||
1947 | netif_schedule_queue(dev_queue); | ||
1929 | #endif | 1948 | #endif |
1930 | } | 1949 | } |
1931 | 1950 | ||
@@ -1938,6 +1957,7 @@ static inline void netdev_completed_queue(struct net_device *dev, | |||
1938 | static inline void netdev_tx_reset_queue(struct netdev_queue *q) | 1957 | static inline void netdev_tx_reset_queue(struct netdev_queue *q) |
1939 | { | 1958 | { |
1940 | #ifdef CONFIG_BQL | 1959 | #ifdef CONFIG_BQL |
1960 | clear_bit(__QUEUE_STATE_STACK_XOFF, &q->state); | ||
1941 | dql_reset(&q->dql); | 1961 | dql_reset(&q->dql); |
1942 | #endif | 1962 | #endif |
1943 | } | 1963 | } |
@@ -1953,7 +1973,7 @@ static inline void netdev_reset_queue(struct net_device *dev_queue) | |||
1953 | * | 1973 | * |
1954 | * Test if the device has been brought up. | 1974 | * Test if the device has been brought up. |
1955 | */ | 1975 | */ |
1956 | static inline int netif_running(const struct net_device *dev) | 1976 | static inline bool netif_running(const struct net_device *dev) |
1957 | { | 1977 | { |
1958 | return test_bit(__LINK_STATE_START, &dev->state); | 1978 | return test_bit(__LINK_STATE_START, &dev->state); |
1959 | } | 1979 | } |
@@ -2003,16 +2023,16 @@ static inline void netif_stop_subqueue(struct net_device *dev, u16 queue_index) | |||
2003 | * | 2023 | * |
2004 | * Check individual transmit queue of a device with multiple transmit queues. | 2024 | * Check individual transmit queue of a device with multiple transmit queues. |
2005 | */ | 2025 | */ |
2006 | static inline int __netif_subqueue_stopped(const struct net_device *dev, | 2026 | static inline bool __netif_subqueue_stopped(const struct net_device *dev, |
2007 | u16 queue_index) | 2027 | u16 queue_index) |
2008 | { | 2028 | { |
2009 | struct netdev_queue *txq = netdev_get_tx_queue(dev, queue_index); | 2029 | struct netdev_queue *txq = netdev_get_tx_queue(dev, queue_index); |
2010 | 2030 | ||
2011 | return netif_tx_queue_stopped(txq); | 2031 | return netif_tx_queue_stopped(txq); |
2012 | } | 2032 | } |
2013 | 2033 | ||
2014 | static inline int netif_subqueue_stopped(const struct net_device *dev, | 2034 | static inline bool netif_subqueue_stopped(const struct net_device *dev, |
2015 | struct sk_buff *skb) | 2035 | struct sk_buff *skb) |
2016 | { | 2036 | { |
2017 | return __netif_subqueue_stopped(dev, skb_get_queue_mapping(skb)); | 2037 | return __netif_subqueue_stopped(dev, skb_get_queue_mapping(skb)); |
2018 | } | 2038 | } |
@@ -2051,7 +2071,7 @@ static inline u16 skb_tx_hash(const struct net_device *dev, | |||
2051 | * | 2071 | * |
2052 | * Check if device has multiple transmit queues | 2072 | * Check if device has multiple transmit queues |
2053 | */ | 2073 | */ |
2054 | static inline int netif_is_multiqueue(const struct net_device *dev) | 2074 | static inline bool netif_is_multiqueue(const struct net_device *dev) |
2055 | { | 2075 | { |
2056 | return dev->num_tx_queues > 1; | 2076 | return dev->num_tx_queues > 1; |
2057 | } | 2077 | } |
@@ -2121,7 +2141,7 @@ extern int netdev_rx_handler_register(struct net_device *dev, | |||
2121 | void *rx_handler_data); | 2141 | void *rx_handler_data); |
2122 | extern void netdev_rx_handler_unregister(struct net_device *dev); | 2142 | extern void netdev_rx_handler_unregister(struct net_device *dev); |
2123 | 2143 | ||
2124 | extern int dev_valid_name(const char *name); | 2144 | extern bool dev_valid_name(const char *name); |
2125 | extern int dev_ioctl(struct net *net, unsigned int cmd, void __user *); | 2145 | extern int dev_ioctl(struct net *net, unsigned int cmd, void __user *); |
2126 | extern int dev_ethtool(struct net *net, struct ifreq *); | 2146 | extern int dev_ethtool(struct net *net, struct ifreq *); |
2127 | extern unsigned dev_get_flags(const struct net_device *); | 2147 | extern unsigned dev_get_flags(const struct net_device *); |
@@ -2187,7 +2207,7 @@ extern void linkwatch_forget_dev(struct net_device *dev); | |||
2187 | * | 2207 | * |
2188 | * Check if carrier is present on device | 2208 | * Check if carrier is present on device |
2189 | */ | 2209 | */ |
2190 | static inline int netif_carrier_ok(const struct net_device *dev) | 2210 | static inline bool netif_carrier_ok(const struct net_device *dev) |
2191 | { | 2211 | { |
2192 | return !test_bit(__LINK_STATE_NOCARRIER, &dev->state); | 2212 | return !test_bit(__LINK_STATE_NOCARRIER, &dev->state); |
2193 | } | 2213 | } |
@@ -2239,7 +2259,7 @@ static inline void netif_dormant_off(struct net_device *dev) | |||
2239 | * | 2259 | * |
2240 | * Check if carrier is present on device | 2260 | * Check if carrier is present on device |
2241 | */ | 2261 | */ |
2242 | static inline int netif_dormant(const struct net_device *dev) | 2262 | static inline bool netif_dormant(const struct net_device *dev) |
2243 | { | 2263 | { |
2244 | return test_bit(__LINK_STATE_DORMANT, &dev->state); | 2264 | return test_bit(__LINK_STATE_DORMANT, &dev->state); |
2245 | } | 2265 | } |
@@ -2251,7 +2271,7 @@ static inline int netif_dormant(const struct net_device *dev) | |||
2251 | * | 2271 | * |
2252 | * Check if carrier is operational | 2272 | * Check if carrier is operational |
2253 | */ | 2273 | */ |
2254 | static inline int netif_oper_up(const struct net_device *dev) | 2274 | static inline bool netif_oper_up(const struct net_device *dev) |
2255 | { | 2275 | { |
2256 | return (dev->operstate == IF_OPER_UP || | 2276 | return (dev->operstate == IF_OPER_UP || |
2257 | dev->operstate == IF_OPER_UNKNOWN /* backward compat */); | 2277 | dev->operstate == IF_OPER_UNKNOWN /* backward compat */); |
@@ -2263,7 +2283,7 @@ static inline int netif_oper_up(const struct net_device *dev) | |||
2263 | * | 2283 | * |
2264 | * Check if device has not been removed from system. | 2284 | * Check if device has not been removed from system. |
2265 | */ | 2285 | */ |
2266 | static inline int netif_device_present(struct net_device *dev) | 2286 | static inline bool netif_device_present(struct net_device *dev) |
2267 | { | 2287 | { |
2268 | return test_bit(__LINK_STATE_PRESENT, &dev->state); | 2288 | return test_bit(__LINK_STATE_PRESENT, &dev->state); |
2269 | } | 2289 | } |
@@ -2333,9 +2353,9 @@ static inline void __netif_tx_lock_bh(struct netdev_queue *txq) | |||
2333 | txq->xmit_lock_owner = smp_processor_id(); | 2353 | txq->xmit_lock_owner = smp_processor_id(); |
2334 | } | 2354 | } |
2335 | 2355 | ||
2336 | static inline int __netif_tx_trylock(struct netdev_queue *txq) | 2356 | static inline bool __netif_tx_trylock(struct netdev_queue *txq) |
2337 | { | 2357 | { |
2338 | int ok = spin_trylock(&txq->_xmit_lock); | 2358 | bool ok = spin_trylock(&txq->_xmit_lock); |
2339 | if (likely(ok)) | 2359 | if (likely(ok)) |
2340 | txq->xmit_lock_owner = smp_processor_id(); | 2360 | txq->xmit_lock_owner = smp_processor_id(); |
2341 | return ok; | 2361 | return ok; |
@@ -2556,6 +2576,8 @@ extern void dev_load(struct net *net, const char *name); | |||
2556 | extern void dev_mcast_init(void); | 2576 | extern void dev_mcast_init(void); |
2557 | extern struct rtnl_link_stats64 *dev_get_stats(struct net_device *dev, | 2577 | extern struct rtnl_link_stats64 *dev_get_stats(struct net_device *dev, |
2558 | struct rtnl_link_stats64 *storage); | 2578 | struct rtnl_link_stats64 *storage); |
2579 | extern void netdev_stats_to_stats64(struct rtnl_link_stats64 *stats64, | ||
2580 | const struct net_device_stats *netdev_stats); | ||
2559 | 2581 | ||
2560 | extern int netdev_max_backlog; | 2582 | extern int netdev_max_backlog; |
2561 | extern int netdev_tstamp_prequeue; | 2583 | extern int netdev_tstamp_prequeue; |
@@ -2582,8 +2604,6 @@ extern void net_disable_timestamp(void); | |||
2582 | extern void *dev_seq_start(struct seq_file *seq, loff_t *pos); | 2604 | extern void *dev_seq_start(struct seq_file *seq, loff_t *pos); |
2583 | extern void *dev_seq_next(struct seq_file *seq, void *v, loff_t *pos); | 2605 | extern void *dev_seq_next(struct seq_file *seq, void *v, loff_t *pos); |
2584 | extern void dev_seq_stop(struct seq_file *seq, void *v); | 2606 | extern void dev_seq_stop(struct seq_file *seq, void *v); |
2585 | extern int dev_seq_open_ops(struct inode *inode, struct file *file, | ||
2586 | const struct seq_operations *ops); | ||
2587 | #endif | 2607 | #endif |
2588 | 2608 | ||
2589 | extern int netdev_class_create_file(struct class_attribute *class_attr); | 2609 | extern int netdev_class_create_file(struct class_attribute *class_attr); |
@@ -2611,7 +2631,7 @@ void netif_stacked_transfer_operstate(const struct net_device *rootdev, | |||
2611 | 2631 | ||
2612 | netdev_features_t netif_skb_features(struct sk_buff *skb); | 2632 | netdev_features_t netif_skb_features(struct sk_buff *skb); |
2613 | 2633 | ||
2614 | static inline int net_gso_ok(netdev_features_t features, int gso_type) | 2634 | static inline bool net_gso_ok(netdev_features_t features, int gso_type) |
2615 | { | 2635 | { |
2616 | netdev_features_t feature = gso_type << NETIF_F_GSO_SHIFT; | 2636 | netdev_features_t feature = gso_type << NETIF_F_GSO_SHIFT; |
2617 | 2637 | ||
@@ -2626,17 +2646,18 @@ static inline int net_gso_ok(netdev_features_t features, int gso_type) | |||
2626 | return (features & feature) == feature; | 2646 | return (features & feature) == feature; |
2627 | } | 2647 | } |
2628 | 2648 | ||
2629 | static inline int skb_gso_ok(struct sk_buff *skb, netdev_features_t features) | 2649 | static inline bool skb_gso_ok(struct sk_buff *skb, netdev_features_t features) |
2630 | { | 2650 | { |
2631 | return net_gso_ok(features, skb_shinfo(skb)->gso_type) && | 2651 | return net_gso_ok(features, skb_shinfo(skb)->gso_type) && |
2632 | (!skb_has_frag_list(skb) || (features & NETIF_F_FRAGLIST)); | 2652 | (!skb_has_frag_list(skb) || (features & NETIF_F_FRAGLIST)); |
2633 | } | 2653 | } |
2634 | 2654 | ||
2635 | static inline int netif_needs_gso(struct sk_buff *skb, | 2655 | static inline bool netif_needs_gso(struct sk_buff *skb, |
2636 | netdev_features_t features) | 2656 | netdev_features_t features) |
2637 | { | 2657 | { |
2638 | return skb_is_gso(skb) && (!skb_gso_ok(skb, features) || | 2658 | return skb_is_gso(skb) && (!skb_gso_ok(skb, features) || |
2639 | unlikely(skb->ip_summed != CHECKSUM_PARTIAL)); | 2659 | unlikely((skb->ip_summed != CHECKSUM_PARTIAL) && |
2660 | (skb->ip_summed != CHECKSUM_UNNECESSARY))); | ||
2640 | } | 2661 | } |
2641 | 2662 | ||
2642 | static inline void netif_set_gso_max_size(struct net_device *dev, | 2663 | static inline void netif_set_gso_max_size(struct net_device *dev, |
@@ -2645,11 +2666,16 @@ static inline void netif_set_gso_max_size(struct net_device *dev, | |||
2645 | dev->gso_max_size = size; | 2666 | dev->gso_max_size = size; |
2646 | } | 2667 | } |
2647 | 2668 | ||
2648 | static inline int netif_is_bond_slave(struct net_device *dev) | 2669 | static inline bool netif_is_bond_slave(struct net_device *dev) |
2649 | { | 2670 | { |
2650 | return dev->flags & IFF_SLAVE && dev->priv_flags & IFF_BONDING; | 2671 | return dev->flags & IFF_SLAVE && dev->priv_flags & IFF_BONDING; |
2651 | } | 2672 | } |
2652 | 2673 | ||
2674 | static inline bool netif_supports_nofcs(struct net_device *dev) | ||
2675 | { | ||
2676 | return dev->priv_flags & IFF_SUPP_NOFCS; | ||
2677 | } | ||
2678 | |||
2653 | extern struct pernet_operations __net_initdata loopback_net_ops; | 2679 | extern struct pernet_operations __net_initdata loopback_net_ops; |
2654 | 2680 | ||
2655 | /* Logging, debugging and troubleshooting/diagnostic helpers. */ | 2681 | /* Logging, debugging and troubleshooting/diagnostic helpers. */ |
@@ -2687,14 +2713,14 @@ int netdev_info(const struct net_device *dev, const char *format, ...); | |||
2687 | #define MODULE_ALIAS_NETDEV(device) \ | 2713 | #define MODULE_ALIAS_NETDEV(device) \ |
2688 | MODULE_ALIAS("netdev-" device) | 2714 | MODULE_ALIAS("netdev-" device) |
2689 | 2715 | ||
2690 | #if defined(DEBUG) | 2716 | #if defined(CONFIG_DYNAMIC_DEBUG) |
2691 | #define netdev_dbg(__dev, format, args...) \ | ||
2692 | netdev_printk(KERN_DEBUG, __dev, format, ##args) | ||
2693 | #elif defined(CONFIG_DYNAMIC_DEBUG) | ||
2694 | #define netdev_dbg(__dev, format, args...) \ | 2717 | #define netdev_dbg(__dev, format, args...) \ |
2695 | do { \ | 2718 | do { \ |
2696 | dynamic_netdev_dbg(__dev, format, ##args); \ | 2719 | dynamic_netdev_dbg(__dev, format, ##args); \ |
2697 | } while (0) | 2720 | } while (0) |
2721 | #elif defined(DEBUG) | ||
2722 | #define netdev_dbg(__dev, format, args...) \ | ||
2723 | netdev_printk(KERN_DEBUG, __dev, format, ##args) | ||
2698 | #else | 2724 | #else |
2699 | #define netdev_dbg(__dev, format, args...) \ | 2725 | #define netdev_dbg(__dev, format, args...) \ |
2700 | ({ \ | 2726 | ({ \ |
diff --git a/include/linux/netfilter.h b/include/linux/netfilter.h index b809265607d0..29734be334c1 100644 --- a/include/linux/netfilter.h +++ b/include/linux/netfilter.h | |||
@@ -163,13 +163,13 @@ extern struct ctl_path nf_net_ipv4_netfilter_sysctl_path[]; | |||
163 | extern struct list_head nf_hooks[NFPROTO_NUMPROTO][NF_MAX_HOOKS]; | 163 | extern struct list_head nf_hooks[NFPROTO_NUMPROTO][NF_MAX_HOOKS]; |
164 | 164 | ||
165 | #if defined(CONFIG_JUMP_LABEL) | 165 | #if defined(CONFIG_JUMP_LABEL) |
166 | #include <linux/jump_label.h> | 166 | #include <linux/static_key.h> |
167 | extern struct jump_label_key nf_hooks_needed[NFPROTO_NUMPROTO][NF_MAX_HOOKS]; | 167 | extern struct static_key nf_hooks_needed[NFPROTO_NUMPROTO][NF_MAX_HOOKS]; |
168 | static inline bool nf_hooks_active(u_int8_t pf, unsigned int hook) | 168 | static inline bool nf_hooks_active(u_int8_t pf, unsigned int hook) |
169 | { | 169 | { |
170 | if (__builtin_constant_p(pf) && | 170 | if (__builtin_constant_p(pf) && |
171 | __builtin_constant_p(hook)) | 171 | __builtin_constant_p(hook)) |
172 | return static_branch(&nf_hooks_needed[pf][hook]); | 172 | return static_key_false(&nf_hooks_needed[pf][hook]); |
173 | 173 | ||
174 | return !list_empty(&nf_hooks[pf][hook]); | 174 | return !list_empty(&nf_hooks[pf][hook]); |
175 | } | 175 | } |
diff --git a/include/linux/netfilter/Kbuild b/include/linux/netfilter/Kbuild index e144f54185c0..1697036336b6 100644 --- a/include/linux/netfilter/Kbuild +++ b/include/linux/netfilter/Kbuild | |||
@@ -10,6 +10,7 @@ header-y += nfnetlink.h | |||
10 | header-y += nfnetlink_acct.h | 10 | header-y += nfnetlink_acct.h |
11 | header-y += nfnetlink_compat.h | 11 | header-y += nfnetlink_compat.h |
12 | header-y += nfnetlink_conntrack.h | 12 | header-y += nfnetlink_conntrack.h |
13 | header-y += nfnetlink_cttimeout.h | ||
13 | header-y += nfnetlink_log.h | 14 | header-y += nfnetlink_log.h |
14 | header-y += nfnetlink_queue.h | 15 | header-y += nfnetlink_queue.h |
15 | header-y += x_tables.h | 16 | header-y += x_tables.h |
@@ -22,6 +23,7 @@ header-y += xt_CT.h | |||
22 | header-y += xt_DSCP.h | 23 | header-y += xt_DSCP.h |
23 | header-y += xt_IDLETIMER.h | 24 | header-y += xt_IDLETIMER.h |
24 | header-y += xt_LED.h | 25 | header-y += xt_LED.h |
26 | header-y += xt_LOG.h | ||
25 | header-y += xt_MARK.h | 27 | header-y += xt_MARK.h |
26 | header-y += xt_nfacct.h | 28 | header-y += xt_nfacct.h |
27 | header-y += xt_NFLOG.h | 29 | header-y += xt_NFLOG.h |
diff --git a/include/linux/netfilter/ipset/ip_set.h b/include/linux/netfilter/ipset/ip_set.h index 3540c6e262f7..2f8e18a23227 100644 --- a/include/linux/netfilter/ipset/ip_set.h +++ b/include/linux/netfilter/ipset/ip_set.h | |||
@@ -11,6 +11,8 @@ | |||
11 | * published by the Free Software Foundation. | 11 | * published by the Free Software Foundation. |
12 | */ | 12 | */ |
13 | 13 | ||
14 | #include <linux/types.h> | ||
15 | |||
14 | /* The protocol version */ | 16 | /* The protocol version */ |
15 | #define IPSET_PROTOCOL 6 | 17 | #define IPSET_PROTOCOL 6 |
16 | 18 | ||
@@ -148,6 +150,7 @@ enum ipset_cmd_flags { | |||
148 | IPSET_FLAG_LIST_SETNAME = (1 << IPSET_FLAG_BIT_LIST_SETNAME), | 150 | IPSET_FLAG_LIST_SETNAME = (1 << IPSET_FLAG_BIT_LIST_SETNAME), |
149 | IPSET_FLAG_BIT_LIST_HEADER = 2, | 151 | IPSET_FLAG_BIT_LIST_HEADER = 2, |
150 | IPSET_FLAG_LIST_HEADER = (1 << IPSET_FLAG_BIT_LIST_HEADER), | 152 | IPSET_FLAG_LIST_HEADER = (1 << IPSET_FLAG_BIT_LIST_HEADER), |
153 | IPSET_FLAG_CMD_MAX = 15, /* Lower half */ | ||
151 | }; | 154 | }; |
152 | 155 | ||
153 | /* Flags at CADT attribute level */ | 156 | /* Flags at CADT attribute level */ |
@@ -156,6 +159,9 @@ enum ipset_cadt_flags { | |||
156 | IPSET_FLAG_BEFORE = (1 << IPSET_FLAG_BIT_BEFORE), | 159 | IPSET_FLAG_BEFORE = (1 << IPSET_FLAG_BIT_BEFORE), |
157 | IPSET_FLAG_BIT_PHYSDEV = 1, | 160 | IPSET_FLAG_BIT_PHYSDEV = 1, |
158 | IPSET_FLAG_PHYSDEV = (1 << IPSET_FLAG_BIT_PHYSDEV), | 161 | IPSET_FLAG_PHYSDEV = (1 << IPSET_FLAG_BIT_PHYSDEV), |
162 | IPSET_FLAG_BIT_NOMATCH = 2, | ||
163 | IPSET_FLAG_NOMATCH = (1 << IPSET_FLAG_BIT_NOMATCH), | ||
164 | IPSET_FLAG_CADT_MAX = 15, /* Upper half */ | ||
159 | }; | 165 | }; |
160 | 166 | ||
161 | /* Commands with settype-specific attributes */ | 167 | /* Commands with settype-specific attributes */ |
@@ -168,19 +174,10 @@ enum ipset_adt { | |||
168 | IPSET_CADT_MAX, | 174 | IPSET_CADT_MAX, |
169 | }; | 175 | }; |
170 | 176 | ||
171 | #ifdef __KERNEL__ | ||
172 | #include <linux/ip.h> | ||
173 | #include <linux/ipv6.h> | ||
174 | #include <linux/netlink.h> | ||
175 | #include <linux/netfilter.h> | ||
176 | #include <linux/netfilter/x_tables.h> | ||
177 | #include <linux/vmalloc.h> | ||
178 | #include <net/netlink.h> | ||
179 | |||
180 | /* Sets are identified by an index in kernel space. Tweak with ip_set_id_t | 177 | /* Sets are identified by an index in kernel space. Tweak with ip_set_id_t |
181 | * and IPSET_INVALID_ID if you want to increase the max number of sets. | 178 | * and IPSET_INVALID_ID if you want to increase the max number of sets. |
182 | */ | 179 | */ |
183 | typedef u16 ip_set_id_t; | 180 | typedef __u16 ip_set_id_t; |
184 | 181 | ||
185 | #define IPSET_INVALID_ID 65535 | 182 | #define IPSET_INVALID_ID 65535 |
186 | 183 | ||
@@ -203,6 +200,15 @@ enum ip_set_kopt { | |||
203 | IPSET_DIM_THREE_SRC = (1 << IPSET_DIM_THREE), | 200 | IPSET_DIM_THREE_SRC = (1 << IPSET_DIM_THREE), |
204 | }; | 201 | }; |
205 | 202 | ||
203 | #ifdef __KERNEL__ | ||
204 | #include <linux/ip.h> | ||
205 | #include <linux/ipv6.h> | ||
206 | #include <linux/netlink.h> | ||
207 | #include <linux/netfilter.h> | ||
208 | #include <linux/netfilter/x_tables.h> | ||
209 | #include <linux/vmalloc.h> | ||
210 | #include <net/netlink.h> | ||
211 | |||
206 | /* Set features */ | 212 | /* Set features */ |
207 | enum ip_set_feature { | 213 | enum ip_set_feature { |
208 | IPSET_TYPE_IP_FLAG = 0, | 214 | IPSET_TYPE_IP_FLAG = 0, |
@@ -288,7 +294,10 @@ struct ip_set_type { | |||
288 | u8 features; | 294 | u8 features; |
289 | /* Set type dimension */ | 295 | /* Set type dimension */ |
290 | u8 dimension; | 296 | u8 dimension; |
291 | /* Supported family: may be AF_UNSPEC for both AF_INET/AF_INET6 */ | 297 | /* |
298 | * Supported family: may be NFPROTO_UNSPEC for both | ||
299 | * NFPROTO_IPV4/NFPROTO_IPV6. | ||
300 | */ | ||
292 | u8 family; | 301 | u8 family; |
293 | /* Type revisions */ | 302 | /* Type revisions */ |
294 | u8 revision_min, revision_max; | 303 | u8 revision_min, revision_max; |
@@ -450,6 +459,8 @@ bitmap_bytes(u32 a, u32 b) | |||
450 | return 4 * ((((b - a + 8) / 8) + 3) / 4); | 459 | return 4 * ((((b - a + 8) / 8) + 3) / 4); |
451 | } | 460 | } |
452 | 461 | ||
462 | #endif /* __KERNEL__ */ | ||
463 | |||
453 | /* Interface to iptables/ip6tables */ | 464 | /* Interface to iptables/ip6tables */ |
454 | 465 | ||
455 | #define SO_IP_SET 83 | 466 | #define SO_IP_SET 83 |
@@ -475,6 +486,4 @@ struct ip_set_req_version { | |||
475 | unsigned version; | 486 | unsigned version; |
476 | }; | 487 | }; |
477 | 488 | ||
478 | #endif /* __KERNEL__ */ | ||
479 | |||
480 | #endif /*_IP_SET_H */ | 489 | #endif /*_IP_SET_H */ |
diff --git a/include/linux/netfilter/ipset/ip_set_ahash.h b/include/linux/netfilter/ipset/ip_set_ahash.h index b89fb79cb44f..05a5d72680be 100644 --- a/include/linux/netfilter/ipset/ip_set_ahash.h +++ b/include/linux/netfilter/ipset/ip_set_ahash.h | |||
@@ -113,6 +113,12 @@ htable_bits(u32 hashsize) | |||
113 | } | 113 | } |
114 | 114 | ||
115 | #ifdef IP_SET_HASH_WITH_NETS | 115 | #ifdef IP_SET_HASH_WITH_NETS |
116 | #ifdef IP_SET_HASH_WITH_NETS_PACKED | ||
117 | /* When cidr is packed with nomatch, cidr - 1 is stored in the entry */ | ||
118 | #define CIDR(cidr) (cidr + 1) | ||
119 | #else | ||
120 | #define CIDR(cidr) (cidr) | ||
121 | #endif | ||
116 | 122 | ||
117 | #define SET_HOST_MASK(family) (family == AF_INET ? 32 : 128) | 123 | #define SET_HOST_MASK(family) (family == AF_INET ? 32 : 128) |
118 | 124 | ||
@@ -262,6 +268,12 @@ ip_set_hash_destroy(struct ip_set *set) | |||
262 | #define type_pf_data_list TOKEN(TYPE, PF, _data_list) | 268 | #define type_pf_data_list TOKEN(TYPE, PF, _data_list) |
263 | #define type_pf_data_tlist TOKEN(TYPE, PF, _data_tlist) | 269 | #define type_pf_data_tlist TOKEN(TYPE, PF, _data_tlist) |
264 | #define type_pf_data_next TOKEN(TYPE, PF, _data_next) | 270 | #define type_pf_data_next TOKEN(TYPE, PF, _data_next) |
271 | #define type_pf_data_flags TOKEN(TYPE, PF, _data_flags) | ||
272 | #ifdef IP_SET_HASH_WITH_NETS | ||
273 | #define type_pf_data_match TOKEN(TYPE, PF, _data_match) | ||
274 | #else | ||
275 | #define type_pf_data_match(d) 1 | ||
276 | #endif | ||
265 | 277 | ||
266 | #define type_pf_elem TOKEN(TYPE, PF, _elem) | 278 | #define type_pf_elem TOKEN(TYPE, PF, _elem) |
267 | #define type_pf_telem TOKEN(TYPE, PF, _telem) | 279 | #define type_pf_telem TOKEN(TYPE, PF, _telem) |
@@ -308,8 +320,10 @@ ip_set_hash_destroy(struct ip_set *set) | |||
308 | * we spare the maintenance of the internal counters. */ | 320 | * we spare the maintenance of the internal counters. */ |
309 | static int | 321 | static int |
310 | type_pf_elem_add(struct hbucket *n, const struct type_pf_elem *value, | 322 | type_pf_elem_add(struct hbucket *n, const struct type_pf_elem *value, |
311 | u8 ahash_max) | 323 | u8 ahash_max, u32 cadt_flags) |
312 | { | 324 | { |
325 | struct type_pf_elem *data; | ||
326 | |||
313 | if (n->pos >= n->size) { | 327 | if (n->pos >= n->size) { |
314 | void *tmp; | 328 | void *tmp; |
315 | 329 | ||
@@ -330,7 +344,13 @@ type_pf_elem_add(struct hbucket *n, const struct type_pf_elem *value, | |||
330 | n->value = tmp; | 344 | n->value = tmp; |
331 | n->size += AHASH_INIT_SIZE; | 345 | n->size += AHASH_INIT_SIZE; |
332 | } | 346 | } |
333 | type_pf_data_copy(ahash_data(n, n->pos++), value); | 347 | data = ahash_data(n, n->pos++); |
348 | type_pf_data_copy(data, value); | ||
349 | #ifdef IP_SET_HASH_WITH_NETS | ||
350 | /* Resizing won't overwrite stored flags */ | ||
351 | if (cadt_flags) | ||
352 | type_pf_data_flags(data, cadt_flags); | ||
353 | #endif | ||
334 | return 0; | 354 | return 0; |
335 | } | 355 | } |
336 | 356 | ||
@@ -353,9 +373,12 @@ retry: | |||
353 | htable_bits++; | 373 | htable_bits++; |
354 | pr_debug("attempt to resize set %s from %u to %u, t %p\n", | 374 | pr_debug("attempt to resize set %s from %u to %u, t %p\n", |
355 | set->name, orig->htable_bits, htable_bits, orig); | 375 | set->name, orig->htable_bits, htable_bits, orig); |
356 | if (!htable_bits) | 376 | if (!htable_bits) { |
357 | /* In case we have plenty of memory :-) */ | 377 | /* In case we have plenty of memory :-) */ |
378 | pr_warning("Cannot increase the hashsize of set %s further\n", | ||
379 | set->name); | ||
358 | return -IPSET_ERR_HASH_FULL; | 380 | return -IPSET_ERR_HASH_FULL; |
381 | } | ||
359 | t = ip_set_alloc(sizeof(*t) | 382 | t = ip_set_alloc(sizeof(*t) |
360 | + jhash_size(htable_bits) * sizeof(struct hbucket)); | 383 | + jhash_size(htable_bits) * sizeof(struct hbucket)); |
361 | if (!t) | 384 | if (!t) |
@@ -368,7 +391,7 @@ retry: | |||
368 | for (j = 0; j < n->pos; j++) { | 391 | for (j = 0; j < n->pos; j++) { |
369 | data = ahash_data(n, j); | 392 | data = ahash_data(n, j); |
370 | m = hbucket(t, HKEY(data, h->initval, htable_bits)); | 393 | m = hbucket(t, HKEY(data, h->initval, htable_bits)); |
371 | ret = type_pf_elem_add(m, data, AHASH_MAX(h)); | 394 | ret = type_pf_elem_add(m, data, AHASH_MAX(h), 0); |
372 | if (ret < 0) { | 395 | if (ret < 0) { |
373 | read_unlock_bh(&set->lock); | 396 | read_unlock_bh(&set->lock); |
374 | ahash_destroy(t); | 397 | ahash_destroy(t); |
@@ -406,9 +429,14 @@ type_pf_add(struct ip_set *set, void *value, u32 timeout, u32 flags) | |||
406 | struct hbucket *n; | 429 | struct hbucket *n; |
407 | int i, ret = 0; | 430 | int i, ret = 0; |
408 | u32 key, multi = 0; | 431 | u32 key, multi = 0; |
432 | u32 cadt_flags = flags >> 16; | ||
409 | 433 | ||
410 | if (h->elements >= h->maxelem) | 434 | if (h->elements >= h->maxelem) { |
435 | if (net_ratelimit()) | ||
436 | pr_warning("Set %s is full, maxelem %u reached\n", | ||
437 | set->name, h->maxelem); | ||
411 | return -IPSET_ERR_HASH_FULL; | 438 | return -IPSET_ERR_HASH_FULL; |
439 | } | ||
412 | 440 | ||
413 | rcu_read_lock_bh(); | 441 | rcu_read_lock_bh(); |
414 | t = rcu_dereference_bh(h->table); | 442 | t = rcu_dereference_bh(h->table); |
@@ -416,11 +444,17 @@ type_pf_add(struct ip_set *set, void *value, u32 timeout, u32 flags) | |||
416 | n = hbucket(t, key); | 444 | n = hbucket(t, key); |
417 | for (i = 0; i < n->pos; i++) | 445 | for (i = 0; i < n->pos; i++) |
418 | if (type_pf_data_equal(ahash_data(n, i), d, &multi)) { | 446 | if (type_pf_data_equal(ahash_data(n, i), d, &multi)) { |
447 | #ifdef IP_SET_HASH_WITH_NETS | ||
448 | if (flags & IPSET_FLAG_EXIST) | ||
449 | /* Support overwriting just the flags */ | ||
450 | type_pf_data_flags(ahash_data(n, i), | ||
451 | cadt_flags); | ||
452 | #endif | ||
419 | ret = -IPSET_ERR_EXIST; | 453 | ret = -IPSET_ERR_EXIST; |
420 | goto out; | 454 | goto out; |
421 | } | 455 | } |
422 | TUNE_AHASH_MAX(h, multi); | 456 | TUNE_AHASH_MAX(h, multi); |
423 | ret = type_pf_elem_add(n, value, AHASH_MAX(h)); | 457 | ret = type_pf_elem_add(n, value, AHASH_MAX(h), cadt_flags); |
424 | if (ret != 0) { | 458 | if (ret != 0) { |
425 | if (ret == -EAGAIN) | 459 | if (ret == -EAGAIN) |
426 | type_pf_data_next(h, d); | 460 | type_pf_data_next(h, d); |
@@ -428,7 +462,7 @@ type_pf_add(struct ip_set *set, void *value, u32 timeout, u32 flags) | |||
428 | } | 462 | } |
429 | 463 | ||
430 | #ifdef IP_SET_HASH_WITH_NETS | 464 | #ifdef IP_SET_HASH_WITH_NETS |
431 | add_cidr(h, d->cidr, HOST_MASK); | 465 | add_cidr(h, CIDR(d->cidr), HOST_MASK); |
432 | #endif | 466 | #endif |
433 | h->elements++; | 467 | h->elements++; |
434 | out: | 468 | out: |
@@ -463,7 +497,7 @@ type_pf_del(struct ip_set *set, void *value, u32 timeout, u32 flags) | |||
463 | n->pos--; | 497 | n->pos--; |
464 | h->elements--; | 498 | h->elements--; |
465 | #ifdef IP_SET_HASH_WITH_NETS | 499 | #ifdef IP_SET_HASH_WITH_NETS |
466 | del_cidr(h, d->cidr, HOST_MASK); | 500 | del_cidr(h, CIDR(d->cidr), HOST_MASK); |
467 | #endif | 501 | #endif |
468 | if (n->pos + AHASH_INIT_SIZE < n->size) { | 502 | if (n->pos + AHASH_INIT_SIZE < n->size) { |
469 | void *tmp = kzalloc((n->size - AHASH_INIT_SIZE) | 503 | void *tmp = kzalloc((n->size - AHASH_INIT_SIZE) |
@@ -506,7 +540,7 @@ type_pf_test_cidrs(struct ip_set *set, struct type_pf_elem *d, u32 timeout) | |||
506 | for (i = 0; i < n->pos; i++) { | 540 | for (i = 0; i < n->pos; i++) { |
507 | data = ahash_data(n, i); | 541 | data = ahash_data(n, i); |
508 | if (type_pf_data_equal(data, d, &multi)) | 542 | if (type_pf_data_equal(data, d, &multi)) |
509 | return 1; | 543 | return type_pf_data_match(data); |
510 | } | 544 | } |
511 | } | 545 | } |
512 | return 0; | 546 | return 0; |
@@ -528,7 +562,7 @@ type_pf_test(struct ip_set *set, void *value, u32 timeout, u32 flags) | |||
528 | #ifdef IP_SET_HASH_WITH_NETS | 562 | #ifdef IP_SET_HASH_WITH_NETS |
529 | /* If we test an IP address and not a network address, | 563 | /* If we test an IP address and not a network address, |
530 | * try all possible network sizes */ | 564 | * try all possible network sizes */ |
531 | if (d->cidr == SET_HOST_MASK(set->family)) | 565 | if (CIDR(d->cidr) == SET_HOST_MASK(set->family)) |
532 | return type_pf_test_cidrs(set, d, timeout); | 566 | return type_pf_test_cidrs(set, d, timeout); |
533 | #endif | 567 | #endif |
534 | 568 | ||
@@ -537,7 +571,7 @@ type_pf_test(struct ip_set *set, void *value, u32 timeout, u32 flags) | |||
537 | for (i = 0; i < n->pos; i++) { | 571 | for (i = 0; i < n->pos; i++) { |
538 | data = ahash_data(n, i); | 572 | data = ahash_data(n, i); |
539 | if (type_pf_data_equal(data, d, &multi)) | 573 | if (type_pf_data_equal(data, d, &multi)) |
540 | return 1; | 574 | return type_pf_data_match(data); |
541 | } | 575 | } |
542 | return 0; | 576 | return 0; |
543 | } | 577 | } |
@@ -693,7 +727,7 @@ type_pf_data_timeout_set(struct type_pf_elem *data, u32 timeout) | |||
693 | 727 | ||
694 | static int | 728 | static int |
695 | type_pf_elem_tadd(struct hbucket *n, const struct type_pf_elem *value, | 729 | type_pf_elem_tadd(struct hbucket *n, const struct type_pf_elem *value, |
696 | u8 ahash_max, u32 timeout) | 730 | u8 ahash_max, u32 cadt_flags, u32 timeout) |
697 | { | 731 | { |
698 | struct type_pf_elem *data; | 732 | struct type_pf_elem *data; |
699 | 733 | ||
@@ -720,6 +754,11 @@ type_pf_elem_tadd(struct hbucket *n, const struct type_pf_elem *value, | |||
720 | data = ahash_tdata(n, n->pos++); | 754 | data = ahash_tdata(n, n->pos++); |
721 | type_pf_data_copy(data, value); | 755 | type_pf_data_copy(data, value); |
722 | type_pf_data_timeout_set(data, timeout); | 756 | type_pf_data_timeout_set(data, timeout); |
757 | #ifdef IP_SET_HASH_WITH_NETS | ||
758 | /* Resizing won't overwrite stored flags */ | ||
759 | if (cadt_flags) | ||
760 | type_pf_data_flags(data, cadt_flags); | ||
761 | #endif | ||
723 | return 0; | 762 | return 0; |
724 | } | 763 | } |
725 | 764 | ||
@@ -740,7 +779,7 @@ type_pf_expire(struct ip_set_hash *h) | |||
740 | if (type_pf_data_expired(data)) { | 779 | if (type_pf_data_expired(data)) { |
741 | pr_debug("expired %u/%u\n", i, j); | 780 | pr_debug("expired %u/%u\n", i, j); |
742 | #ifdef IP_SET_HASH_WITH_NETS | 781 | #ifdef IP_SET_HASH_WITH_NETS |
743 | del_cidr(h, data->cidr, HOST_MASK); | 782 | del_cidr(h, CIDR(data->cidr), HOST_MASK); |
744 | #endif | 783 | #endif |
745 | if (j != n->pos - 1) | 784 | if (j != n->pos - 1) |
746 | /* Not last one */ | 785 | /* Not last one */ |
@@ -790,9 +829,12 @@ type_pf_tresize(struct ip_set *set, bool retried) | |||
790 | retry: | 829 | retry: |
791 | ret = 0; | 830 | ret = 0; |
792 | htable_bits++; | 831 | htable_bits++; |
793 | if (!htable_bits) | 832 | if (!htable_bits) { |
794 | /* In case we have plenty of memory :-) */ | 833 | /* In case we have plenty of memory :-) */ |
834 | pr_warning("Cannot increase the hashsize of set %s further\n", | ||
835 | set->name); | ||
795 | return -IPSET_ERR_HASH_FULL; | 836 | return -IPSET_ERR_HASH_FULL; |
837 | } | ||
796 | t = ip_set_alloc(sizeof(*t) | 838 | t = ip_set_alloc(sizeof(*t) |
797 | + jhash_size(htable_bits) * sizeof(struct hbucket)); | 839 | + jhash_size(htable_bits) * sizeof(struct hbucket)); |
798 | if (!t) | 840 | if (!t) |
@@ -805,7 +847,7 @@ retry: | |||
805 | for (j = 0; j < n->pos; j++) { | 847 | for (j = 0; j < n->pos; j++) { |
806 | data = ahash_tdata(n, j); | 848 | data = ahash_tdata(n, j); |
807 | m = hbucket(t, HKEY(data, h->initval, htable_bits)); | 849 | m = hbucket(t, HKEY(data, h->initval, htable_bits)); |
808 | ret = type_pf_elem_tadd(m, data, AHASH_MAX(h), | 850 | ret = type_pf_elem_tadd(m, data, AHASH_MAX(h), 0, |
809 | type_pf_data_timeout(data)); | 851 | type_pf_data_timeout(data)); |
810 | if (ret < 0) { | 852 | if (ret < 0) { |
811 | read_unlock_bh(&set->lock); | 853 | read_unlock_bh(&set->lock); |
@@ -839,12 +881,17 @@ type_pf_tadd(struct ip_set *set, void *value, u32 timeout, u32 flags) | |||
839 | int ret = 0, i, j = AHASH_MAX(h) + 1; | 881 | int ret = 0, i, j = AHASH_MAX(h) + 1; |
840 | bool flag_exist = flags & IPSET_FLAG_EXIST; | 882 | bool flag_exist = flags & IPSET_FLAG_EXIST; |
841 | u32 key, multi = 0; | 883 | u32 key, multi = 0; |
884 | u32 cadt_flags = flags >> 16; | ||
842 | 885 | ||
843 | if (h->elements >= h->maxelem) | 886 | if (h->elements >= h->maxelem) |
844 | /* FIXME: when set is full, we slow down here */ | 887 | /* FIXME: when set is full, we slow down here */ |
845 | type_pf_expire(h); | 888 | type_pf_expire(h); |
846 | if (h->elements >= h->maxelem) | 889 | if (h->elements >= h->maxelem) { |
890 | if (net_ratelimit()) | ||
891 | pr_warning("Set %s is full, maxelem %u reached\n", | ||
892 | set->name, h->maxelem); | ||
847 | return -IPSET_ERR_HASH_FULL; | 893 | return -IPSET_ERR_HASH_FULL; |
894 | } | ||
848 | 895 | ||
849 | rcu_read_lock_bh(); | 896 | rcu_read_lock_bh(); |
850 | t = rcu_dereference_bh(h->table); | 897 | t = rcu_dereference_bh(h->table); |
@@ -854,6 +901,7 @@ type_pf_tadd(struct ip_set *set, void *value, u32 timeout, u32 flags) | |||
854 | data = ahash_tdata(n, i); | 901 | data = ahash_tdata(n, i); |
855 | if (type_pf_data_equal(data, d, &multi)) { | 902 | if (type_pf_data_equal(data, d, &multi)) { |
856 | if (type_pf_data_expired(data) || flag_exist) | 903 | if (type_pf_data_expired(data) || flag_exist) |
904 | /* Just timeout value may be updated */ | ||
857 | j = i; | 905 | j = i; |
858 | else { | 906 | else { |
859 | ret = -IPSET_ERR_EXIST; | 907 | ret = -IPSET_ERR_EXIST; |
@@ -866,15 +914,18 @@ type_pf_tadd(struct ip_set *set, void *value, u32 timeout, u32 flags) | |||
866 | if (j != AHASH_MAX(h) + 1) { | 914 | if (j != AHASH_MAX(h) + 1) { |
867 | data = ahash_tdata(n, j); | 915 | data = ahash_tdata(n, j); |
868 | #ifdef IP_SET_HASH_WITH_NETS | 916 | #ifdef IP_SET_HASH_WITH_NETS |
869 | del_cidr(h, data->cidr, HOST_MASK); | 917 | del_cidr(h, CIDR(data->cidr), HOST_MASK); |
870 | add_cidr(h, d->cidr, HOST_MASK); | 918 | add_cidr(h, CIDR(d->cidr), HOST_MASK); |
871 | #endif | 919 | #endif |
872 | type_pf_data_copy(data, d); | 920 | type_pf_data_copy(data, d); |
873 | type_pf_data_timeout_set(data, timeout); | 921 | type_pf_data_timeout_set(data, timeout); |
922 | #ifdef IP_SET_HASH_WITH_NETS | ||
923 | type_pf_data_flags(data, cadt_flags); | ||
924 | #endif | ||
874 | goto out; | 925 | goto out; |
875 | } | 926 | } |
876 | TUNE_AHASH_MAX(h, multi); | 927 | TUNE_AHASH_MAX(h, multi); |
877 | ret = type_pf_elem_tadd(n, d, AHASH_MAX(h), timeout); | 928 | ret = type_pf_elem_tadd(n, d, AHASH_MAX(h), cadt_flags, timeout); |
878 | if (ret != 0) { | 929 | if (ret != 0) { |
879 | if (ret == -EAGAIN) | 930 | if (ret == -EAGAIN) |
880 | type_pf_data_next(h, d); | 931 | type_pf_data_next(h, d); |
@@ -882,7 +933,7 @@ type_pf_tadd(struct ip_set *set, void *value, u32 timeout, u32 flags) | |||
882 | } | 933 | } |
883 | 934 | ||
884 | #ifdef IP_SET_HASH_WITH_NETS | 935 | #ifdef IP_SET_HASH_WITH_NETS |
885 | add_cidr(h, d->cidr, HOST_MASK); | 936 | add_cidr(h, CIDR(d->cidr), HOST_MASK); |
886 | #endif | 937 | #endif |
887 | h->elements++; | 938 | h->elements++; |
888 | out: | 939 | out: |
@@ -916,7 +967,7 @@ type_pf_tdel(struct ip_set *set, void *value, u32 timeout, u32 flags) | |||
916 | n->pos--; | 967 | n->pos--; |
917 | h->elements--; | 968 | h->elements--; |
918 | #ifdef IP_SET_HASH_WITH_NETS | 969 | #ifdef IP_SET_HASH_WITH_NETS |
919 | del_cidr(h, d->cidr, HOST_MASK); | 970 | del_cidr(h, CIDR(d->cidr), HOST_MASK); |
920 | #endif | 971 | #endif |
921 | if (n->pos + AHASH_INIT_SIZE < n->size) { | 972 | if (n->pos + AHASH_INIT_SIZE < n->size) { |
922 | void *tmp = kzalloc((n->size - AHASH_INIT_SIZE) | 973 | void *tmp = kzalloc((n->size - AHASH_INIT_SIZE) |
@@ -954,8 +1005,17 @@ type_pf_ttest_cidrs(struct ip_set *set, struct type_pf_elem *d, u32 timeout) | |||
954 | n = hbucket(t, key); | 1005 | n = hbucket(t, key); |
955 | for (i = 0; i < n->pos; i++) { | 1006 | for (i = 0; i < n->pos; i++) { |
956 | data = ahash_tdata(n, i); | 1007 | data = ahash_tdata(n, i); |
957 | if (type_pf_data_equal(data, d, &multi)) | 1008 | #ifdef IP_SET_HASH_WITH_MULTI |
958 | return !type_pf_data_expired(data); | 1009 | if (type_pf_data_equal(data, d, &multi)) { |
1010 | if (!type_pf_data_expired(data)) | ||
1011 | return type_pf_data_match(data); | ||
1012 | multi = 0; | ||
1013 | } | ||
1014 | #else | ||
1015 | if (type_pf_data_equal(data, d, &multi) && | ||
1016 | !type_pf_data_expired(data)) | ||
1017 | return type_pf_data_match(data); | ||
1018 | #endif | ||
959 | } | 1019 | } |
960 | } | 1020 | } |
961 | return 0; | 1021 | return 0; |
@@ -973,15 +1033,16 @@ type_pf_ttest(struct ip_set *set, void *value, u32 timeout, u32 flags) | |||
973 | u32 key, multi = 0; | 1033 | u32 key, multi = 0; |
974 | 1034 | ||
975 | #ifdef IP_SET_HASH_WITH_NETS | 1035 | #ifdef IP_SET_HASH_WITH_NETS |
976 | if (d->cidr == SET_HOST_MASK(set->family)) | 1036 | if (CIDR(d->cidr) == SET_HOST_MASK(set->family)) |
977 | return type_pf_ttest_cidrs(set, d, timeout); | 1037 | return type_pf_ttest_cidrs(set, d, timeout); |
978 | #endif | 1038 | #endif |
979 | key = HKEY(d, h->initval, t->htable_bits); | 1039 | key = HKEY(d, h->initval, t->htable_bits); |
980 | n = hbucket(t, key); | 1040 | n = hbucket(t, key); |
981 | for (i = 0; i < n->pos; i++) { | 1041 | for (i = 0; i < n->pos; i++) { |
982 | data = ahash_tdata(n, i); | 1042 | data = ahash_tdata(n, i); |
983 | if (type_pf_data_equal(data, d, &multi)) | 1043 | if (type_pf_data_equal(data, d, &multi) && |
984 | return !type_pf_data_expired(data); | 1044 | !type_pf_data_expired(data)) |
1045 | return type_pf_data_match(data); | ||
985 | } | 1046 | } |
986 | return 0; | 1047 | return 0; |
987 | } | 1048 | } |
@@ -1094,14 +1155,17 @@ type_pf_gc_init(struct ip_set *set) | |||
1094 | #undef type_pf_data_isnull | 1155 | #undef type_pf_data_isnull |
1095 | #undef type_pf_data_copy | 1156 | #undef type_pf_data_copy |
1096 | #undef type_pf_data_zero_out | 1157 | #undef type_pf_data_zero_out |
1158 | #undef type_pf_data_netmask | ||
1097 | #undef type_pf_data_list | 1159 | #undef type_pf_data_list |
1098 | #undef type_pf_data_tlist | 1160 | #undef type_pf_data_tlist |
1161 | #undef type_pf_data_next | ||
1162 | #undef type_pf_data_flags | ||
1163 | #undef type_pf_data_match | ||
1099 | 1164 | ||
1100 | #undef type_pf_elem | 1165 | #undef type_pf_elem |
1101 | #undef type_pf_telem | 1166 | #undef type_pf_telem |
1102 | #undef type_pf_data_timeout | 1167 | #undef type_pf_data_timeout |
1103 | #undef type_pf_data_expired | 1168 | #undef type_pf_data_expired |
1104 | #undef type_pf_data_netmask | ||
1105 | #undef type_pf_data_timeout_set | 1169 | #undef type_pf_data_timeout_set |
1106 | 1170 | ||
1107 | #undef type_pf_elem_add | 1171 | #undef type_pf_elem_add |
@@ -1111,6 +1175,7 @@ type_pf_gc_init(struct ip_set *set) | |||
1111 | #undef type_pf_test | 1175 | #undef type_pf_test |
1112 | 1176 | ||
1113 | #undef type_pf_elem_tadd | 1177 | #undef type_pf_elem_tadd |
1178 | #undef type_pf_del_telem | ||
1114 | #undef type_pf_expire | 1179 | #undef type_pf_expire |
1115 | #undef type_pf_tadd | 1180 | #undef type_pf_tadd |
1116 | #undef type_pf_tdel | 1181 | #undef type_pf_tdel |
diff --git a/include/linux/netfilter/nf_conntrack_tcp.h b/include/linux/netfilter/nf_conntrack_tcp.h index 6e135f97e59a..e59868ae12d4 100644 --- a/include/linux/netfilter/nf_conntrack_tcp.h +++ b/include/linux/netfilter/nf_conntrack_tcp.h | |||
@@ -18,7 +18,10 @@ enum tcp_conntrack { | |||
18 | TCP_CONNTRACK_LISTEN, /* obsolete */ | 18 | TCP_CONNTRACK_LISTEN, /* obsolete */ |
19 | #define TCP_CONNTRACK_SYN_SENT2 TCP_CONNTRACK_LISTEN | 19 | #define TCP_CONNTRACK_SYN_SENT2 TCP_CONNTRACK_LISTEN |
20 | TCP_CONNTRACK_MAX, | 20 | TCP_CONNTRACK_MAX, |
21 | TCP_CONNTRACK_IGNORE | 21 | TCP_CONNTRACK_IGNORE, |
22 | TCP_CONNTRACK_RETRANS, | ||
23 | TCP_CONNTRACK_UNACK, | ||
24 | TCP_CONNTRACK_TIMEOUT_MAX | ||
22 | }; | 25 | }; |
23 | 26 | ||
24 | /* Window scaling is advertised by the sender */ | 27 | /* Window scaling is advertised by the sender */ |
diff --git a/include/linux/netfilter/nfnetlink.h b/include/linux/netfilter/nfnetlink.h index b64454c2f79f..6fd1f0d07e64 100644 --- a/include/linux/netfilter/nfnetlink.h +++ b/include/linux/netfilter/nfnetlink.h | |||
@@ -49,7 +49,8 @@ struct nfgenmsg { | |||
49 | #define NFNL_SUBSYS_OSF 5 | 49 | #define NFNL_SUBSYS_OSF 5 |
50 | #define NFNL_SUBSYS_IPSET 6 | 50 | #define NFNL_SUBSYS_IPSET 6 |
51 | #define NFNL_SUBSYS_ACCT 7 | 51 | #define NFNL_SUBSYS_ACCT 7 |
52 | #define NFNL_SUBSYS_COUNT 8 | 52 | #define NFNL_SUBSYS_CTNETLINK_TIMEOUT 8 |
53 | #define NFNL_SUBSYS_COUNT 9 | ||
53 | 54 | ||
54 | #ifdef __KERNEL__ | 55 | #ifdef __KERNEL__ |
55 | 56 | ||
diff --git a/include/linux/netfilter/nfnetlink_conntrack.h b/include/linux/netfilter/nfnetlink_conntrack.h index debf1aefd753..e58e4b93c108 100644 --- a/include/linux/netfilter/nfnetlink_conntrack.h +++ b/include/linux/netfilter/nfnetlink_conntrack.h | |||
@@ -43,6 +43,7 @@ enum ctattr_type { | |||
43 | CTA_ZONE, | 43 | CTA_ZONE, |
44 | CTA_SECCTX, | 44 | CTA_SECCTX, |
45 | CTA_TIMESTAMP, | 45 | CTA_TIMESTAMP, |
46 | CTA_MARK_MASK, | ||
46 | __CTA_MAX | 47 | __CTA_MAX |
47 | }; | 48 | }; |
48 | #define CTA_MAX (__CTA_MAX - 1) | 49 | #define CTA_MAX (__CTA_MAX - 1) |
@@ -172,10 +173,21 @@ enum ctattr_expect { | |||
172 | CTA_EXPECT_HELP_NAME, | 173 | CTA_EXPECT_HELP_NAME, |
173 | CTA_EXPECT_ZONE, | 174 | CTA_EXPECT_ZONE, |
174 | CTA_EXPECT_FLAGS, | 175 | CTA_EXPECT_FLAGS, |
176 | CTA_EXPECT_CLASS, | ||
177 | CTA_EXPECT_NAT, | ||
178 | CTA_EXPECT_FN, | ||
175 | __CTA_EXPECT_MAX | 179 | __CTA_EXPECT_MAX |
176 | }; | 180 | }; |
177 | #define CTA_EXPECT_MAX (__CTA_EXPECT_MAX - 1) | 181 | #define CTA_EXPECT_MAX (__CTA_EXPECT_MAX - 1) |
178 | 182 | ||
183 | enum ctattr_expect_nat { | ||
184 | CTA_EXPECT_NAT_UNSPEC, | ||
185 | CTA_EXPECT_NAT_DIR, | ||
186 | CTA_EXPECT_NAT_TUPLE, | ||
187 | __CTA_EXPECT_NAT_MAX | ||
188 | }; | ||
189 | #define CTA_EXPECT_NAT_MAX (__CTA_EXPECT_NAT_MAX - 1) | ||
190 | |||
179 | enum ctattr_help { | 191 | enum ctattr_help { |
180 | CTA_HELP_UNSPEC, | 192 | CTA_HELP_UNSPEC, |
181 | CTA_HELP_NAME, | 193 | CTA_HELP_NAME, |
diff --git a/include/linux/netfilter/nfnetlink_cttimeout.h b/include/linux/netfilter/nfnetlink_cttimeout.h new file mode 100644 index 000000000000..a2810a7c5e30 --- /dev/null +++ b/include/linux/netfilter/nfnetlink_cttimeout.h | |||
@@ -0,0 +1,114 @@ | |||
1 | #ifndef _CTTIMEOUT_NETLINK_H | ||
2 | #define _CTTIMEOUT_NETLINK_H | ||
3 | #include <linux/netfilter/nfnetlink.h> | ||
4 | |||
5 | enum ctnl_timeout_msg_types { | ||
6 | IPCTNL_MSG_TIMEOUT_NEW, | ||
7 | IPCTNL_MSG_TIMEOUT_GET, | ||
8 | IPCTNL_MSG_TIMEOUT_DELETE, | ||
9 | |||
10 | IPCTNL_MSG_TIMEOUT_MAX | ||
11 | }; | ||
12 | |||
13 | enum ctattr_timeout { | ||
14 | CTA_TIMEOUT_UNSPEC, | ||
15 | CTA_TIMEOUT_NAME, | ||
16 | CTA_TIMEOUT_L3PROTO, | ||
17 | CTA_TIMEOUT_L4PROTO, | ||
18 | CTA_TIMEOUT_DATA, | ||
19 | CTA_TIMEOUT_USE, | ||
20 | __CTA_TIMEOUT_MAX | ||
21 | }; | ||
22 | #define CTA_TIMEOUT_MAX (__CTA_TIMEOUT_MAX - 1) | ||
23 | |||
24 | enum ctattr_timeout_generic { | ||
25 | CTA_TIMEOUT_GENERIC_UNSPEC, | ||
26 | CTA_TIMEOUT_GENERIC_TIMEOUT, | ||
27 | __CTA_TIMEOUT_GENERIC_MAX | ||
28 | }; | ||
29 | #define CTA_TIMEOUT_GENERIC_MAX (__CTA_TIMEOUT_GENERIC_MAX - 1) | ||
30 | |||
31 | enum ctattr_timeout_tcp { | ||
32 | CTA_TIMEOUT_TCP_UNSPEC, | ||
33 | CTA_TIMEOUT_TCP_SYN_SENT, | ||
34 | CTA_TIMEOUT_TCP_SYN_RECV, | ||
35 | CTA_TIMEOUT_TCP_ESTABLISHED, | ||
36 | CTA_TIMEOUT_TCP_FIN_WAIT, | ||
37 | CTA_TIMEOUT_TCP_CLOSE_WAIT, | ||
38 | CTA_TIMEOUT_TCP_LAST_ACK, | ||
39 | CTA_TIMEOUT_TCP_TIME_WAIT, | ||
40 | CTA_TIMEOUT_TCP_CLOSE, | ||
41 | CTA_TIMEOUT_TCP_SYN_SENT2, | ||
42 | CTA_TIMEOUT_TCP_RETRANS, | ||
43 | CTA_TIMEOUT_TCP_UNACK, | ||
44 | __CTA_TIMEOUT_TCP_MAX | ||
45 | }; | ||
46 | #define CTA_TIMEOUT_TCP_MAX (__CTA_TIMEOUT_TCP_MAX - 1) | ||
47 | |||
48 | enum ctattr_timeout_udp { | ||
49 | CTA_TIMEOUT_UDP_UNSPEC, | ||
50 | CTA_TIMEOUT_UDP_UNREPLIED, | ||
51 | CTA_TIMEOUT_UDP_REPLIED, | ||
52 | __CTA_TIMEOUT_UDP_MAX | ||
53 | }; | ||
54 | #define CTA_TIMEOUT_UDP_MAX (__CTA_TIMEOUT_UDP_MAX - 1) | ||
55 | |||
56 | enum ctattr_timeout_udplite { | ||
57 | CTA_TIMEOUT_UDPLITE_UNSPEC, | ||
58 | CTA_TIMEOUT_UDPLITE_UNREPLIED, | ||
59 | CTA_TIMEOUT_UDPLITE_REPLIED, | ||
60 | __CTA_TIMEOUT_UDPLITE_MAX | ||
61 | }; | ||
62 | #define CTA_TIMEOUT_UDPLITE_MAX (__CTA_TIMEOUT_UDPLITE_MAX - 1) | ||
63 | |||
64 | enum ctattr_timeout_icmp { | ||
65 | CTA_TIMEOUT_ICMP_UNSPEC, | ||
66 | CTA_TIMEOUT_ICMP_TIMEOUT, | ||
67 | __CTA_TIMEOUT_ICMP_MAX | ||
68 | }; | ||
69 | #define CTA_TIMEOUT_ICMP_MAX (__CTA_TIMEOUT_ICMP_MAX - 1) | ||
70 | |||
71 | enum ctattr_timeout_dccp { | ||
72 | CTA_TIMEOUT_DCCP_UNSPEC, | ||
73 | CTA_TIMEOUT_DCCP_REQUEST, | ||
74 | CTA_TIMEOUT_DCCP_RESPOND, | ||
75 | CTA_TIMEOUT_DCCP_PARTOPEN, | ||
76 | CTA_TIMEOUT_DCCP_OPEN, | ||
77 | CTA_TIMEOUT_DCCP_CLOSEREQ, | ||
78 | CTA_TIMEOUT_DCCP_CLOSING, | ||
79 | CTA_TIMEOUT_DCCP_TIMEWAIT, | ||
80 | __CTA_TIMEOUT_DCCP_MAX | ||
81 | }; | ||
82 | #define CTA_TIMEOUT_DCCP_MAX (__CTA_TIMEOUT_DCCP_MAX - 1) | ||
83 | |||
84 | enum ctattr_timeout_sctp { | ||
85 | CTA_TIMEOUT_SCTP_UNSPEC, | ||
86 | CTA_TIMEOUT_SCTP_CLOSED, | ||
87 | CTA_TIMEOUT_SCTP_COOKIE_WAIT, | ||
88 | CTA_TIMEOUT_SCTP_COOKIE_ECHOED, | ||
89 | CTA_TIMEOUT_SCTP_ESTABLISHED, | ||
90 | CTA_TIMEOUT_SCTP_SHUTDOWN_SENT, | ||
91 | CTA_TIMEOUT_SCTP_SHUTDOWN_RECD, | ||
92 | CTA_TIMEOUT_SCTP_SHUTDOWN_ACK_SENT, | ||
93 | __CTA_TIMEOUT_SCTP_MAX | ||
94 | }; | ||
95 | #define CTA_TIMEOUT_SCTP_MAX (__CTA_TIMEOUT_SCTP_MAX - 1) | ||
96 | |||
97 | enum ctattr_timeout_icmpv6 { | ||
98 | CTA_TIMEOUT_ICMPV6_UNSPEC, | ||
99 | CTA_TIMEOUT_ICMPV6_TIMEOUT, | ||
100 | __CTA_TIMEOUT_ICMPV6_MAX | ||
101 | }; | ||
102 | #define CTA_TIMEOUT_ICMPV6_MAX (__CTA_TIMEOUT_ICMPV6_MAX - 1) | ||
103 | |||
104 | enum ctattr_timeout_gre { | ||
105 | CTA_TIMEOUT_GRE_UNSPEC, | ||
106 | CTA_TIMEOUT_GRE_UNREPLIED, | ||
107 | CTA_TIMEOUT_GRE_REPLIED, | ||
108 | __CTA_TIMEOUT_GRE_MAX | ||
109 | }; | ||
110 | #define CTA_TIMEOUT_GRE_MAX (__CTA_TIMEOUT_GRE_MAX - 1) | ||
111 | |||
112 | #define CTNL_TIMEOUT_NAME_MAX 32 | ||
113 | |||
114 | #endif | ||
diff --git a/include/linux/netfilter/xt_CT.h b/include/linux/netfilter/xt_CT.h index b56e76811c04..a064b8af360c 100644 --- a/include/linux/netfilter/xt_CT.h +++ b/include/linux/netfilter/xt_CT.h | |||
@@ -16,4 +16,16 @@ struct xt_ct_target_info { | |||
16 | struct nf_conn *ct __attribute__((aligned(8))); | 16 | struct nf_conn *ct __attribute__((aligned(8))); |
17 | }; | 17 | }; |
18 | 18 | ||
19 | struct xt_ct_target_info_v1 { | ||
20 | __u16 flags; | ||
21 | __u16 zone; | ||
22 | __u32 ct_events; | ||
23 | __u32 exp_events; | ||
24 | char helper[16]; | ||
25 | char timeout[32]; | ||
26 | |||
27 | /* Used internally by the kernel */ | ||
28 | struct nf_conn *ct __attribute__((aligned(8))); | ||
29 | }; | ||
30 | |||
19 | #endif /* _XT_CT_H */ | 31 | #endif /* _XT_CT_H */ |
diff --git a/include/linux/netfilter/xt_LOG.h b/include/linux/netfilter/xt_LOG.h new file mode 100644 index 000000000000..cac079095305 --- /dev/null +++ b/include/linux/netfilter/xt_LOG.h | |||
@@ -0,0 +1,19 @@ | |||
1 | #ifndef _XT_LOG_H | ||
2 | #define _XT_LOG_H | ||
3 | |||
4 | /* make sure not to change this without changing nf_log.h:NF_LOG_* (!) */ | ||
5 | #define XT_LOG_TCPSEQ 0x01 /* Log TCP sequence numbers */ | ||
6 | #define XT_LOG_TCPOPT 0x02 /* Log TCP options */ | ||
7 | #define XT_LOG_IPOPT 0x04 /* Log IP options */ | ||
8 | #define XT_LOG_UID 0x08 /* Log UID owning local socket */ | ||
9 | #define XT_LOG_NFLOG 0x10 /* Unsupported, don't reuse */ | ||
10 | #define XT_LOG_MACDECODE 0x20 /* Decode MAC header */ | ||
11 | #define XT_LOG_MASK 0x2f | ||
12 | |||
13 | struct xt_log_info { | ||
14 | unsigned char level; | ||
15 | unsigned char logflags; | ||
16 | char prefix[30]; | ||
17 | }; | ||
18 | |||
19 | #endif /* _XT_LOG_H */ | ||
diff --git a/include/linux/netfilter/xt_set.h b/include/linux/netfilter/xt_set.h index c0405ac92870..e3a9978f259f 100644 --- a/include/linux/netfilter/xt_set.h +++ b/include/linux/netfilter/xt_set.h | |||
@@ -58,8 +58,8 @@ struct xt_set_info_target_v1 { | |||
58 | struct xt_set_info_target_v2 { | 58 | struct xt_set_info_target_v2 { |
59 | struct xt_set_info add_set; | 59 | struct xt_set_info add_set; |
60 | struct xt_set_info del_set; | 60 | struct xt_set_info del_set; |
61 | u32 flags; | 61 | __u32 flags; |
62 | u32 timeout; | 62 | __u32 timeout; |
63 | }; | 63 | }; |
64 | 64 | ||
65 | #endif /*_XT_SET_H*/ | 65 | #endif /*_XT_SET_H*/ |
diff --git a/include/linux/netfilter_ipv4/Kbuild b/include/linux/netfilter_ipv4/Kbuild index f9930c87fff3..31f8bec95650 100644 --- a/include/linux/netfilter_ipv4/Kbuild +++ b/include/linux/netfilter_ipv4/Kbuild | |||
@@ -4,11 +4,9 @@ header-y += ipt_CLUSTERIP.h | |||
4 | header-y += ipt_ECN.h | 4 | header-y += ipt_ECN.h |
5 | header-y += ipt_LOG.h | 5 | header-y += ipt_LOG.h |
6 | header-y += ipt_REJECT.h | 6 | header-y += ipt_REJECT.h |
7 | header-y += ipt_SAME.h | ||
8 | header-y += ipt_TTL.h | 7 | header-y += ipt_TTL.h |
9 | header-y += ipt_ULOG.h | 8 | header-y += ipt_ULOG.h |
10 | header-y += ipt_addrtype.h | 9 | header-y += ipt_addrtype.h |
11 | header-y += ipt_ah.h | 10 | header-y += ipt_ah.h |
12 | header-y += ipt_ecn.h | 11 | header-y += ipt_ecn.h |
13 | header-y += ipt_realm.h | ||
14 | header-y += ipt_ttl.h | 12 | header-y += ipt_ttl.h |
diff --git a/include/linux/netfilter_ipv4/ipt_LOG.h b/include/linux/netfilter_ipv4/ipt_LOG.h index dcdbadf9fd4a..5d8152077d71 100644 --- a/include/linux/netfilter_ipv4/ipt_LOG.h +++ b/include/linux/netfilter_ipv4/ipt_LOG.h | |||
@@ -1,6 +1,8 @@ | |||
1 | #ifndef _IPT_LOG_H | 1 | #ifndef _IPT_LOG_H |
2 | #define _IPT_LOG_H | 2 | #define _IPT_LOG_H |
3 | 3 | ||
4 | #warning "Please update iptables, this file will be removed soon!" | ||
5 | |||
4 | /* make sure not to change this without changing netfilter.h:NF_LOG_* (!) */ | 6 | /* make sure not to change this without changing netfilter.h:NF_LOG_* (!) */ |
5 | #define IPT_LOG_TCPSEQ 0x01 /* Log TCP sequence numbers */ | 7 | #define IPT_LOG_TCPSEQ 0x01 /* Log TCP sequence numbers */ |
6 | #define IPT_LOG_TCPOPT 0x02 /* Log TCP options */ | 8 | #define IPT_LOG_TCPOPT 0x02 /* Log TCP options */ |
diff --git a/include/linux/netfilter_ipv4/ipt_SAME.h b/include/linux/netfilter_ipv4/ipt_SAME.h deleted file mode 100644 index 5bca78267afd..000000000000 --- a/include/linux/netfilter_ipv4/ipt_SAME.h +++ /dev/null | |||
@@ -1,20 +0,0 @@ | |||
1 | #ifndef _IPT_SAME_H | ||
2 | #define _IPT_SAME_H | ||
3 | |||
4 | #include <linux/types.h> | ||
5 | |||
6 | #define IPT_SAME_MAX_RANGE 10 | ||
7 | |||
8 | #define IPT_SAME_NODST 0x01 | ||
9 | |||
10 | struct ipt_same_info { | ||
11 | unsigned char info; | ||
12 | __u32 rangesize; | ||
13 | __u32 ipnum; | ||
14 | __u32 *iparray; | ||
15 | |||
16 | /* hangs off end. */ | ||
17 | struct nf_nat_range range[IPT_SAME_MAX_RANGE]; | ||
18 | }; | ||
19 | |||
20 | #endif /*_IPT_SAME_H*/ | ||
diff --git a/include/linux/netfilter_ipv4/ipt_realm.h b/include/linux/netfilter_ipv4/ipt_realm.h deleted file mode 100644 index b3996eaa0188..000000000000 --- a/include/linux/netfilter_ipv4/ipt_realm.h +++ /dev/null | |||
@@ -1,7 +0,0 @@ | |||
1 | #ifndef _IPT_REALM_H | ||
2 | #define _IPT_REALM_H | ||
3 | |||
4 | #include <linux/netfilter/xt_realm.h> | ||
5 | #define ipt_realm_info xt_realm_info | ||
6 | |||
7 | #endif /* _IPT_REALM_H */ | ||
diff --git a/include/linux/netfilter_ipv6/ip6_tables.h b/include/linux/netfilter_ipv6/ip6_tables.h index f549adccc94c..1bc898b14a80 100644 --- a/include/linux/netfilter_ipv6/ip6_tables.h +++ b/include/linux/netfilter_ipv6/ip6_tables.h | |||
@@ -287,7 +287,17 @@ extern unsigned int ip6t_do_table(struct sk_buff *skb, | |||
287 | struct xt_table *table); | 287 | struct xt_table *table); |
288 | 288 | ||
289 | /* Check for an extension */ | 289 | /* Check for an extension */ |
290 | extern int ip6t_ext_hdr(u8 nexthdr); | 290 | static inline int |
291 | ip6t_ext_hdr(u8 nexthdr) | ||
292 | { return (nexthdr == IPPROTO_HOPOPTS) || | ||
293 | (nexthdr == IPPROTO_ROUTING) || | ||
294 | (nexthdr == IPPROTO_FRAGMENT) || | ||
295 | (nexthdr == IPPROTO_ESP) || | ||
296 | (nexthdr == IPPROTO_AH) || | ||
297 | (nexthdr == IPPROTO_NONE) || | ||
298 | (nexthdr == IPPROTO_DSTOPTS); | ||
299 | } | ||
300 | |||
291 | /* find specified header and get offset to it */ | 301 | /* find specified header and get offset to it */ |
292 | extern int ipv6_find_hdr(const struct sk_buff *skb, unsigned int *offset, | 302 | extern int ipv6_find_hdr(const struct sk_buff *skb, unsigned int *offset, |
293 | int target, unsigned short *fragoff); | 303 | int target, unsigned short *fragoff); |
diff --git a/include/linux/netfilter_ipv6/ip6t_LOG.h b/include/linux/netfilter_ipv6/ip6t_LOG.h index 9dd5579e02ec..3dd0bc4e0735 100644 --- a/include/linux/netfilter_ipv6/ip6t_LOG.h +++ b/include/linux/netfilter_ipv6/ip6t_LOG.h | |||
@@ -1,6 +1,8 @@ | |||
1 | #ifndef _IP6T_LOG_H | 1 | #ifndef _IP6T_LOG_H |
2 | #define _IP6T_LOG_H | 2 | #define _IP6T_LOG_H |
3 | 3 | ||
4 | #warning "Please update iptables, this file will be removed soon!" | ||
5 | |||
4 | /* make sure not to change this without changing netfilter.h:NF_LOG_* (!) */ | 6 | /* make sure not to change this without changing netfilter.h:NF_LOG_* (!) */ |
5 | #define IP6T_LOG_TCPSEQ 0x01 /* Log TCP sequence numbers */ | 7 | #define IP6T_LOG_TCPSEQ 0x01 /* Log TCP sequence numbers */ |
6 | #define IP6T_LOG_TCPOPT 0x02 /* Log TCP options */ | 8 | #define IP6T_LOG_TCPOPT 0x02 /* Log TCP options */ |
diff --git a/include/linux/netlink.h b/include/linux/netlink.h index 52e48959cfa1..a2092f582a78 100644 --- a/include/linux/netlink.h +++ b/include/linux/netlink.h | |||
@@ -225,6 +225,7 @@ struct netlink_callback { | |||
225 | int (*dump)(struct sk_buff * skb, | 225 | int (*dump)(struct sk_buff * skb, |
226 | struct netlink_callback *cb); | 226 | struct netlink_callback *cb); |
227 | int (*done)(struct netlink_callback *cb); | 227 | int (*done)(struct netlink_callback *cb); |
228 | void *data; | ||
228 | u16 family; | 229 | u16 family; |
229 | u16 min_dump_alloc; | 230 | u16 min_dump_alloc; |
230 | unsigned int prev_seq, seq; | 231 | unsigned int prev_seq, seq; |
@@ -237,22 +238,8 @@ struct netlink_notify { | |||
237 | int protocol; | 238 | int protocol; |
238 | }; | 239 | }; |
239 | 240 | ||
240 | static __inline__ struct nlmsghdr * | 241 | struct nlmsghdr * |
241 | __nlmsg_put(struct sk_buff *skb, u32 pid, u32 seq, int type, int len, int flags) | 242 | __nlmsg_put(struct sk_buff *skb, u32 pid, u32 seq, int type, int len, int flags); |
242 | { | ||
243 | struct nlmsghdr *nlh; | ||
244 | int size = NLMSG_LENGTH(len); | ||
245 | |||
246 | nlh = (struct nlmsghdr*)skb_put(skb, NLMSG_ALIGN(size)); | ||
247 | nlh->nlmsg_type = type; | ||
248 | nlh->nlmsg_len = size; | ||
249 | nlh->nlmsg_flags = flags; | ||
250 | nlh->nlmsg_pid = pid; | ||
251 | nlh->nlmsg_seq = seq; | ||
252 | if (!__builtin_constant_p(size) || NLMSG_ALIGN(size) - size != 0) | ||
253 | memset(NLMSG_DATA(nlh) + len, 0, NLMSG_ALIGN(size) - size); | ||
254 | return nlh; | ||
255 | } | ||
256 | 243 | ||
257 | #define NLMSG_NEW(skb, pid, seq, type, len, flags) \ | 244 | #define NLMSG_NEW(skb, pid, seq, type, len, flags) \ |
258 | ({ if (unlikely(skb_tailroom(skb) < (int)NLMSG_SPACE(len))) \ | 245 | ({ if (unlikely(skb_tailroom(skb) < (int)NLMSG_SPACE(len))) \ |
@@ -262,11 +249,16 @@ __nlmsg_put(struct sk_buff *skb, u32 pid, u32 seq, int type, int len, int flags) | |||
262 | #define NLMSG_PUT(skb, pid, seq, type, len) \ | 249 | #define NLMSG_PUT(skb, pid, seq, type, len) \ |
263 | NLMSG_NEW(skb, pid, seq, type, len, 0) | 250 | NLMSG_NEW(skb, pid, seq, type, len, 0) |
264 | 251 | ||
252 | struct netlink_dump_control { | ||
253 | int (*dump)(struct sk_buff *skb, struct netlink_callback *); | ||
254 | int (*done)(struct netlink_callback*); | ||
255 | void *data; | ||
256 | u16 min_dump_alloc; | ||
257 | }; | ||
258 | |||
265 | extern int netlink_dump_start(struct sock *ssk, struct sk_buff *skb, | 259 | extern int netlink_dump_start(struct sock *ssk, struct sk_buff *skb, |
266 | const struct nlmsghdr *nlh, | 260 | const struct nlmsghdr *nlh, |
267 | int (*dump)(struct sk_buff *skb, struct netlink_callback*), | 261 | struct netlink_dump_control *control); |
268 | int (*done)(struct netlink_callback*), | ||
269 | u16 min_dump_alloc); | ||
270 | 262 | ||
271 | 263 | ||
272 | #define NL_NONROOT_RECV 0x1 | 264 | #define NL_NONROOT_RECV 0x1 |
diff --git a/include/linux/nfc.h b/include/linux/nfc.h index 01d4e5d60325..39c1fcf089c0 100644 --- a/include/linux/nfc.h +++ b/include/linux/nfc.h | |||
@@ -89,6 +89,8 @@ enum nfc_commands { | |||
89 | * @NFC_ATTR_TARGET_SEL_RES: NFC-A targets extra information (useful if the | 89 | * @NFC_ATTR_TARGET_SEL_RES: NFC-A targets extra information (useful if the |
90 | * target is not NFC-Forum compliant) | 90 | * target is not NFC-Forum compliant) |
91 | * @NFC_ATTR_TARGET_NFCID1: NFC-A targets identifier, max 10 bytes | 91 | * @NFC_ATTR_TARGET_NFCID1: NFC-A targets identifier, max 10 bytes |
92 | * @NFC_ATTR_TARGET_SENSB_RES: NFC-B targets extra information, max 12 bytes | ||
93 | * @NFC_ATTR_TARGET_SENSF_RES: NFC-F targets extra information, max 18 bytes | ||
92 | * @NFC_ATTR_COMM_MODE: Passive or active mode | 94 | * @NFC_ATTR_COMM_MODE: Passive or active mode |
93 | * @NFC_ATTR_RF_MODE: Initiator or target | 95 | * @NFC_ATTR_RF_MODE: Initiator or target |
94 | */ | 96 | */ |
@@ -101,14 +103,20 @@ enum nfc_attrs { | |||
101 | NFC_ATTR_TARGET_SENS_RES, | 103 | NFC_ATTR_TARGET_SENS_RES, |
102 | NFC_ATTR_TARGET_SEL_RES, | 104 | NFC_ATTR_TARGET_SEL_RES, |
103 | NFC_ATTR_TARGET_NFCID1, | 105 | NFC_ATTR_TARGET_NFCID1, |
106 | NFC_ATTR_TARGET_SENSB_RES, | ||
107 | NFC_ATTR_TARGET_SENSF_RES, | ||
104 | NFC_ATTR_COMM_MODE, | 108 | NFC_ATTR_COMM_MODE, |
105 | NFC_ATTR_RF_MODE, | 109 | NFC_ATTR_RF_MODE, |
110 | NFC_ATTR_DEVICE_POWERED, | ||
106 | /* private: internal use only */ | 111 | /* private: internal use only */ |
107 | __NFC_ATTR_AFTER_LAST | 112 | __NFC_ATTR_AFTER_LAST |
108 | }; | 113 | }; |
109 | #define NFC_ATTR_MAX (__NFC_ATTR_AFTER_LAST - 1) | 114 | #define NFC_ATTR_MAX (__NFC_ATTR_AFTER_LAST - 1) |
110 | 115 | ||
111 | #define NFC_DEVICE_NAME_MAXSIZE 8 | 116 | #define NFC_DEVICE_NAME_MAXSIZE 8 |
117 | #define NFC_NFCID1_MAXSIZE 10 | ||
118 | #define NFC_SENSB_RES_MAXSIZE 12 | ||
119 | #define NFC_SENSF_RES_MAXSIZE 18 | ||
112 | 120 | ||
113 | /* NFC protocols */ | 121 | /* NFC protocols */ |
114 | #define NFC_PROTO_JEWEL 1 | 122 | #define NFC_PROTO_JEWEL 1 |
diff --git a/include/linux/nfs.h b/include/linux/nfs.h index 8c6ee44914cb..6d1fb63f5922 100644 --- a/include/linux/nfs.h +++ b/include/linux/nfs.h | |||
@@ -29,7 +29,7 @@ | |||
29 | #define NFS_MNT_VERSION 1 | 29 | #define NFS_MNT_VERSION 1 |
30 | #define NFS_MNT3_VERSION 3 | 30 | #define NFS_MNT3_VERSION 3 |
31 | 31 | ||
32 | #define NFS_PIPE_DIRNAME "/nfs" | 32 | #define NFS_PIPE_DIRNAME "nfs" |
33 | 33 | ||
34 | /* | 34 | /* |
35 | * NFS stats. The good thing with these values is that NFSv3 errors are | 35 | * NFS stats. The good thing with these values is that NFSv3 errors are |
diff --git a/include/linux/nfs4.h b/include/linux/nfs4.h index 32345c2805c0..0987146b0637 100644 --- a/include/linux/nfs4.h +++ b/include/linux/nfs4.h | |||
@@ -183,15 +183,12 @@ struct nfs4_acl { | |||
183 | 183 | ||
184 | typedef struct { char data[NFS4_VERIFIER_SIZE]; } nfs4_verifier; | 184 | typedef struct { char data[NFS4_VERIFIER_SIZE]; } nfs4_verifier; |
185 | 185 | ||
186 | struct nfs41_stateid { | 186 | struct nfs_stateid4 { |
187 | __be32 seqid; | 187 | __be32 seqid; |
188 | char other[NFS4_STATEID_OTHER_SIZE]; | 188 | char other[NFS4_STATEID_OTHER_SIZE]; |
189 | } __attribute__ ((packed)); | 189 | } __attribute__ ((packed)); |
190 | 190 | ||
191 | typedef union { | 191 | typedef struct nfs_stateid4 nfs4_stateid; |
192 | char data[NFS4_STATEID_SIZE]; | ||
193 | struct nfs41_stateid stateid; | ||
194 | } nfs4_stateid; | ||
195 | 192 | ||
196 | enum nfs_opnum4 { | 193 | enum nfs_opnum4 { |
197 | OP_ACCESS = 3, | 194 | OP_ACCESS = 3, |
@@ -441,7 +438,20 @@ enum limit_by4 { | |||
441 | enum open_delegation_type4 { | 438 | enum open_delegation_type4 { |
442 | NFS4_OPEN_DELEGATE_NONE = 0, | 439 | NFS4_OPEN_DELEGATE_NONE = 0, |
443 | NFS4_OPEN_DELEGATE_READ = 1, | 440 | NFS4_OPEN_DELEGATE_READ = 1, |
444 | NFS4_OPEN_DELEGATE_WRITE = 2 | 441 | NFS4_OPEN_DELEGATE_WRITE = 2, |
442 | NFS4_OPEN_DELEGATE_NONE_EXT = 3, /* 4.1 */ | ||
443 | }; | ||
444 | |||
445 | enum why_no_delegation4 { /* new to v4.1 */ | ||
446 | WND4_NOT_WANTED = 0, | ||
447 | WND4_CONTENTION = 1, | ||
448 | WND4_RESOURCE = 2, | ||
449 | WND4_NOT_SUPP_FTYPE = 3, | ||
450 | WND4_WRITE_DELEG_NOT_SUPP_FTYPE = 4, | ||
451 | WND4_NOT_SUPP_UPGRADE = 5, | ||
452 | WND4_NOT_SUPP_DOWNGRADE = 6, | ||
453 | WND4_CANCELLED = 7, | ||
454 | WND4_IS_DIR = 8, | ||
445 | }; | 455 | }; |
446 | 456 | ||
447 | enum lock_type4 { | 457 | enum lock_type4 { |
diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h index 8c29950d2fa5..52a1bdb4ee2b 100644 --- a/include/linux/nfs_fs.h +++ b/include/linux/nfs_fs.h | |||
@@ -38,6 +38,13 @@ | |||
38 | 38 | ||
39 | #ifdef __KERNEL__ | 39 | #ifdef __KERNEL__ |
40 | 40 | ||
41 | /* | ||
42 | * Enable dprintk() debugging support for nfs client. | ||
43 | */ | ||
44 | #ifdef CONFIG_NFS_DEBUG | ||
45 | # define NFS_DEBUG | ||
46 | #endif | ||
47 | |||
41 | #include <linux/in.h> | 48 | #include <linux/in.h> |
42 | #include <linux/mm.h> | 49 | #include <linux/mm.h> |
43 | #include <linux/pagemap.h> | 50 | #include <linux/pagemap.h> |
@@ -171,13 +178,9 @@ struct nfs_inode { | |||
171 | */ | 178 | */ |
172 | __be32 cookieverf[2]; | 179 | __be32 cookieverf[2]; |
173 | 180 | ||
174 | /* | ||
175 | * This is the list of dirty unwritten pages. | ||
176 | */ | ||
177 | struct radix_tree_root nfs_page_tree; | ||
178 | |||
179 | unsigned long npages; | 181 | unsigned long npages; |
180 | unsigned long ncommit; | 182 | unsigned long ncommit; |
183 | struct list_head commit_list; | ||
181 | 184 | ||
182 | /* Open contexts for shared mmap writes */ | 185 | /* Open contexts for shared mmap writes */ |
183 | struct list_head open_files; | 186 | struct list_head open_files; |
@@ -395,6 +398,29 @@ static inline void nfs_free_fhandle(const struct nfs_fh *fh) | |||
395 | kfree(fh); | 398 | kfree(fh); |
396 | } | 399 | } |
397 | 400 | ||
401 | #ifdef NFS_DEBUG | ||
402 | extern u32 _nfs_display_fhandle_hash(const struct nfs_fh *fh); | ||
403 | static inline u32 nfs_display_fhandle_hash(const struct nfs_fh *fh) | ||
404 | { | ||
405 | return _nfs_display_fhandle_hash(fh); | ||
406 | } | ||
407 | extern void _nfs_display_fhandle(const struct nfs_fh *fh, const char *caption); | ||
408 | #define nfs_display_fhandle(fh, caption) \ | ||
409 | do { \ | ||
410 | if (unlikely(nfs_debug & NFSDBG_FACILITY)) \ | ||
411 | _nfs_display_fhandle(fh, caption); \ | ||
412 | } while (0) | ||
413 | #else | ||
414 | static inline u32 nfs_display_fhandle_hash(const struct nfs_fh *fh) | ||
415 | { | ||
416 | return 0; | ||
417 | } | ||
418 | static inline void nfs_display_fhandle(const struct nfs_fh *fh, | ||
419 | const char *caption) | ||
420 | { | ||
421 | } | ||
422 | #endif | ||
423 | |||
398 | /* | 424 | /* |
399 | * linux/fs/nfs/nfsroot.c | 425 | * linux/fs/nfs/nfsroot.c |
400 | */ | 426 | */ |
@@ -632,19 +658,13 @@ nfs_fileid_to_ino_t(u64 fileid) | |||
632 | 658 | ||
633 | #ifdef __KERNEL__ | 659 | #ifdef __KERNEL__ |
634 | 660 | ||
635 | /* | ||
636 | * Enable debugging support for nfs client. | ||
637 | * Requires RPC_DEBUG. | ||
638 | */ | ||
639 | #ifdef RPC_DEBUG | ||
640 | # define NFS_DEBUG | ||
641 | #endif | ||
642 | |||
643 | # undef ifdebug | 661 | # undef ifdebug |
644 | # ifdef NFS_DEBUG | 662 | # ifdef NFS_DEBUG |
645 | # define ifdebug(fac) if (unlikely(nfs_debug & NFSDBG_##fac)) | 663 | # define ifdebug(fac) if (unlikely(nfs_debug & NFSDBG_##fac)) |
664 | # define NFS_IFDEBUG(x) x | ||
646 | # else | 665 | # else |
647 | # define ifdebug(fac) if (0) | 666 | # define ifdebug(fac) if (0) |
667 | # define NFS_IFDEBUG(x) | ||
648 | # endif | 668 | # endif |
649 | #endif /* __KERNEL */ | 669 | #endif /* __KERNEL */ |
650 | 670 | ||
diff --git a/include/linux/nfs_fs_i.h b/include/linux/nfs_fs_i.h index 861730275ba0..a5c50d97341e 100644 --- a/include/linux/nfs_fs_i.h +++ b/include/linux/nfs_fs_i.h | |||
@@ -1,10 +1,6 @@ | |||
1 | #ifndef _NFS_FS_I | 1 | #ifndef _NFS_FS_I |
2 | #define _NFS_FS_I | 2 | #define _NFS_FS_I |
3 | 3 | ||
4 | #include <asm/types.h> | ||
5 | #include <linux/list.h> | ||
6 | #include <linux/nfs.h> | ||
7 | |||
8 | struct nlm_lockowner; | 4 | struct nlm_lockowner; |
9 | 5 | ||
10 | /* | 6 | /* |
diff --git a/include/linux/nfs_fs_sb.h b/include/linux/nfs_fs_sb.h index ba4d7656ecfd..7073fc74481c 100644 --- a/include/linux/nfs_fs_sb.h +++ b/include/linux/nfs_fs_sb.h | |||
@@ -3,6 +3,7 @@ | |||
3 | 3 | ||
4 | #include <linux/list.h> | 4 | #include <linux/list.h> |
5 | #include <linux/backing-dev.h> | 5 | #include <linux/backing-dev.h> |
6 | #include <linux/idr.h> | ||
6 | #include <linux/wait.h> | 7 | #include <linux/wait.h> |
7 | #include <linux/nfs_xdr.h> | 8 | #include <linux/nfs_xdr.h> |
8 | #include <linux/sunrpc/xprt.h> | 9 | #include <linux/sunrpc/xprt.h> |
@@ -17,6 +18,7 @@ struct nfs4_sequence_res; | |||
17 | struct nfs_server; | 18 | struct nfs_server; |
18 | struct nfs4_minor_version_ops; | 19 | struct nfs4_minor_version_ops; |
19 | struct server_scope; | 20 | struct server_scope; |
21 | struct nfs41_impl_id; | ||
20 | 22 | ||
21 | /* | 23 | /* |
22 | * The nfs_client identifies our client state to the server. | 24 | * The nfs_client identifies our client state to the server. |
@@ -85,6 +87,8 @@ struct nfs_client { | |||
85 | #endif | 87 | #endif |
86 | 88 | ||
87 | struct server_scope *server_scope; /* from exchange_id */ | 89 | struct server_scope *server_scope; /* from exchange_id */ |
90 | struct nfs41_impl_id *impl_id; /* from exchange_id */ | ||
91 | struct net *net; | ||
88 | }; | 92 | }; |
89 | 93 | ||
90 | /* | 94 | /* |
@@ -144,15 +148,18 @@ struct nfs_server { | |||
144 | u32 acl_bitmask; /* V4 bitmask representing the ACEs | 148 | u32 acl_bitmask; /* V4 bitmask representing the ACEs |
145 | that are supported on this | 149 | that are supported on this |
146 | filesystem */ | 150 | filesystem */ |
151 | u32 fh_expire_type; /* V4 bitmask representing file | ||
152 | handle volatility type for | ||
153 | this filesystem */ | ||
147 | struct pnfs_layoutdriver_type *pnfs_curr_ld; /* Active layout driver */ | 154 | struct pnfs_layoutdriver_type *pnfs_curr_ld; /* Active layout driver */ |
148 | struct rpc_wait_queue roc_rpcwaitq; | 155 | struct rpc_wait_queue roc_rpcwaitq; |
149 | void *pnfs_ld_data; /* per mount point data */ | 156 | void *pnfs_ld_data; /* per mount point data */ |
150 | 157 | ||
151 | /* the following fields are protected by nfs_client->cl_lock */ | 158 | /* the following fields are protected by nfs_client->cl_lock */ |
152 | struct rb_root state_owners; | 159 | struct rb_root state_owners; |
153 | struct rb_root openowner_id; | ||
154 | struct rb_root lockowner_id; | ||
155 | #endif | 160 | #endif |
161 | struct ida openowner_id; | ||
162 | struct ida lockowner_id; | ||
156 | struct list_head state_owners_lru; | 163 | struct list_head state_owners_lru; |
157 | struct list_head layouts; | 164 | struct list_head layouts; |
158 | struct list_head delegations; | 165 | struct list_head delegations; |
@@ -188,21 +195,23 @@ struct nfs_server { | |||
188 | 195 | ||
189 | 196 | ||
190 | /* maximum number of slots to use */ | 197 | /* maximum number of slots to use */ |
191 | #define NFS4_MAX_SLOT_TABLE RPC_MAX_SLOT_TABLE | 198 | #define NFS4_DEF_SLOT_TABLE_SIZE (16U) |
199 | #define NFS4_MAX_SLOT_TABLE (256U) | ||
200 | #define NFS4_NO_SLOT ((u32)-1) | ||
192 | 201 | ||
193 | #if defined(CONFIG_NFS_V4) | 202 | #if defined(CONFIG_NFS_V4) |
194 | 203 | ||
195 | /* Sessions */ | 204 | /* Sessions */ |
196 | #define SLOT_TABLE_SZ (NFS4_MAX_SLOT_TABLE/(8*sizeof(long))) | 205 | #define SLOT_TABLE_SZ DIV_ROUND_UP(NFS4_MAX_SLOT_TABLE, 8*sizeof(long)) |
197 | struct nfs4_slot_table { | 206 | struct nfs4_slot_table { |
198 | struct nfs4_slot *slots; /* seqid per slot */ | 207 | struct nfs4_slot *slots; /* seqid per slot */ |
199 | unsigned long used_slots[SLOT_TABLE_SZ]; /* used/unused bitmap */ | 208 | unsigned long used_slots[SLOT_TABLE_SZ]; /* used/unused bitmap */ |
200 | spinlock_t slot_tbl_lock; | 209 | spinlock_t slot_tbl_lock; |
201 | struct rpc_wait_queue slot_tbl_waitq; /* allocators may wait here */ | 210 | struct rpc_wait_queue slot_tbl_waitq; /* allocators may wait here */ |
202 | int max_slots; /* # slots in table */ | 211 | u32 max_slots; /* # slots in table */ |
203 | int highest_used_slotid; /* sent to server on each SEQ. | 212 | u32 highest_used_slotid; /* sent to server on each SEQ. |
204 | * op for dynamic resizing */ | 213 | * op for dynamic resizing */ |
205 | int target_max_slots; /* Set by CB_RECALL_SLOT as | 214 | u32 target_max_slots; /* Set by CB_RECALL_SLOT as |
206 | * the new max_slots */ | 215 | * the new max_slots */ |
207 | struct completion complete; | 216 | struct completion complete; |
208 | }; | 217 | }; |
diff --git a/include/linux/nfs_idmap.h b/include/linux/nfs_idmap.h index 308c18877018..7eed2012d288 100644 --- a/include/linux/nfs_idmap.h +++ b/include/linux/nfs_idmap.h | |||
@@ -69,36 +69,22 @@ struct nfs_server; | |||
69 | struct nfs_fattr; | 69 | struct nfs_fattr; |
70 | struct nfs4_string; | 70 | struct nfs4_string; |
71 | 71 | ||
72 | #ifdef CONFIG_NFS_USE_NEW_IDMAPPER | 72 | #ifdef CONFIG_NFS_V4 |
73 | |||
74 | int nfs_idmap_init(void); | 73 | int nfs_idmap_init(void); |
75 | void nfs_idmap_quit(void); | 74 | void nfs_idmap_quit(void); |
76 | 75 | #else | |
77 | static inline int nfs_idmap_new(struct nfs_client *clp) | ||
78 | { | ||
79 | return 0; | ||
80 | } | ||
81 | |||
82 | static inline void nfs_idmap_delete(struct nfs_client *clp) | ||
83 | { | ||
84 | } | ||
85 | |||
86 | #else /* CONFIG_NFS_USE_NEW_IDMAPPER not set */ | ||
87 | |||
88 | static inline int nfs_idmap_init(void) | 76 | static inline int nfs_idmap_init(void) |
89 | { | 77 | { |
90 | return 0; | 78 | return 0; |
91 | } | 79 | } |
92 | 80 | ||
93 | static inline void nfs_idmap_quit(void) | 81 | static inline void nfs_idmap_quit(void) |
94 | { | 82 | {} |
95 | } | 83 | #endif |
96 | 84 | ||
97 | int nfs_idmap_new(struct nfs_client *); | 85 | int nfs_idmap_new(struct nfs_client *); |
98 | void nfs_idmap_delete(struct nfs_client *); | 86 | void nfs_idmap_delete(struct nfs_client *); |
99 | 87 | ||
100 | #endif /* CONFIG_NFS_USE_NEW_IDMAPPER */ | ||
101 | |||
102 | void nfs_fattr_init_names(struct nfs_fattr *fattr, | 88 | void nfs_fattr_init_names(struct nfs_fattr *fattr, |
103 | struct nfs4_string *owner_name, | 89 | struct nfs4_string *owner_name, |
104 | struct nfs4_string *group_name); | 90 | struct nfs4_string *group_name); |
diff --git a/include/linux/nfs_iostat.h b/include/linux/nfs_iostat.h index 8866bb3502ee..9dcbbe9a51fb 100644 --- a/include/linux/nfs_iostat.h +++ b/include/linux/nfs_iostat.h | |||
@@ -21,7 +21,7 @@ | |||
21 | #ifndef _LINUX_NFS_IOSTAT | 21 | #ifndef _LINUX_NFS_IOSTAT |
22 | #define _LINUX_NFS_IOSTAT | 22 | #define _LINUX_NFS_IOSTAT |
23 | 23 | ||
24 | #define NFS_IOSTAT_VERS "1.0" | 24 | #define NFS_IOSTAT_VERS "1.1" |
25 | 25 | ||
26 | /* | 26 | /* |
27 | * NFS byte counters | 27 | * NFS byte counters |
diff --git a/include/linux/nfs_page.h b/include/linux/nfs_page.h index ab465fe8c3d6..eac30d6bec17 100644 --- a/include/linux/nfs_page.h +++ b/include/linux/nfs_page.h | |||
@@ -19,12 +19,6 @@ | |||
19 | #include <linux/kref.h> | 19 | #include <linux/kref.h> |
20 | 20 | ||
21 | /* | 21 | /* |
22 | * Valid flags for the radix tree | ||
23 | */ | ||
24 | #define NFS_PAGE_TAG_LOCKED 0 | ||
25 | #define NFS_PAGE_TAG_COMMIT 1 | ||
26 | |||
27 | /* | ||
28 | * Valid flags for a dirty buffer | 22 | * Valid flags for a dirty buffer |
29 | */ | 23 | */ |
30 | enum { | 24 | enum { |
@@ -33,16 +27,13 @@ enum { | |||
33 | PG_CLEAN, | 27 | PG_CLEAN, |
34 | PG_NEED_COMMIT, | 28 | PG_NEED_COMMIT, |
35 | PG_NEED_RESCHED, | 29 | PG_NEED_RESCHED, |
36 | PG_PNFS_COMMIT, | ||
37 | PG_PARTIAL_READ_FAILED, | 30 | PG_PARTIAL_READ_FAILED, |
31 | PG_COMMIT_TO_DS, | ||
38 | }; | 32 | }; |
39 | 33 | ||
40 | struct nfs_inode; | 34 | struct nfs_inode; |
41 | struct nfs_page { | 35 | struct nfs_page { |
42 | union { | 36 | struct list_head wb_list; /* Defines state of page: */ |
43 | struct list_head wb_list; /* Defines state of page: */ | ||
44 | struct pnfs_layout_segment *wb_commit_lseg; /* Used when PG_PNFS_COMMIT set */ | ||
45 | }; | ||
46 | struct page *wb_page; /* page to read in/write out */ | 37 | struct page *wb_page; /* page to read in/write out */ |
47 | struct nfs_open_context *wb_context; /* File state context info */ | 38 | struct nfs_open_context *wb_context; /* File state context info */ |
48 | struct nfs_lock_context *wb_lock_context; /* lock context info */ | 39 | struct nfs_lock_context *wb_lock_context; /* lock context info */ |
@@ -90,8 +81,6 @@ extern struct nfs_page *nfs_create_request(struct nfs_open_context *ctx, | |||
90 | extern void nfs_release_request(struct nfs_page *req); | 81 | extern void nfs_release_request(struct nfs_page *req); |
91 | 82 | ||
92 | 83 | ||
93 | extern int nfs_scan_list(struct nfs_inode *nfsi, struct list_head *dst, | ||
94 | pgoff_t idx_start, unsigned int npages, int tag); | ||
95 | extern void nfs_pageio_init(struct nfs_pageio_descriptor *desc, | 84 | extern void nfs_pageio_init(struct nfs_pageio_descriptor *desc, |
96 | struct inode *inode, | 85 | struct inode *inode, |
97 | const struct nfs_pageio_ops *pg_ops, | 86 | const struct nfs_pageio_ops *pg_ops, |
@@ -106,8 +95,6 @@ extern bool nfs_generic_pg_test(struct nfs_pageio_descriptor *desc, | |||
106 | struct nfs_page *req); | 95 | struct nfs_page *req); |
107 | extern int nfs_wait_on_request(struct nfs_page *); | 96 | extern int nfs_wait_on_request(struct nfs_page *); |
108 | extern void nfs_unlock_request(struct nfs_page *req); | 97 | extern void nfs_unlock_request(struct nfs_page *req); |
109 | extern int nfs_set_page_tag_locked(struct nfs_page *req); | ||
110 | extern void nfs_clear_page_tag_locked(struct nfs_page *req); | ||
111 | 98 | ||
112 | /* | 99 | /* |
113 | * Lock the page of an asynchronous request without getting a new reference | 100 | * Lock the page of an asynchronous request without getting a new reference |
@@ -118,6 +105,16 @@ nfs_lock_request_dontget(struct nfs_page *req) | |||
118 | return !test_and_set_bit(PG_BUSY, &req->wb_flags); | 105 | return !test_and_set_bit(PG_BUSY, &req->wb_flags); |
119 | } | 106 | } |
120 | 107 | ||
108 | static inline int | ||
109 | nfs_lock_request(struct nfs_page *req) | ||
110 | { | ||
111 | if (test_and_set_bit(PG_BUSY, &req->wb_flags)) | ||
112 | return 0; | ||
113 | kref_get(&req->wb_kref); | ||
114 | return 1; | ||
115 | } | ||
116 | |||
117 | |||
121 | /** | 118 | /** |
122 | * nfs_list_add_request - Insert a request into a list | 119 | * nfs_list_add_request - Insert a request into a list |
123 | * @req: request | 120 | * @req: request |
diff --git a/include/linux/nfs_xdr.h b/include/linux/nfs_xdr.h index d6ba9a12591e..bfd0d1bf6707 100644 --- a/include/linux/nfs_xdr.h +++ b/include/linux/nfs_xdr.h | |||
@@ -2,7 +2,6 @@ | |||
2 | #define _LINUX_NFS_XDR_H | 2 | #define _LINUX_NFS_XDR_H |
3 | 3 | ||
4 | #include <linux/nfsacl.h> | 4 | #include <linux/nfsacl.h> |
5 | #include <linux/nfs3.h> | ||
6 | #include <linux/sunrpc/gss_api.h> | 5 | #include <linux/sunrpc/gss_api.h> |
7 | 6 | ||
8 | /* | 7 | /* |
@@ -89,11 +88,12 @@ struct nfs_fattr { | |||
89 | #define NFS_ATTR_FATTR_PRECTIME (1U << 16) | 88 | #define NFS_ATTR_FATTR_PRECTIME (1U << 16) |
90 | #define NFS_ATTR_FATTR_CHANGE (1U << 17) | 89 | #define NFS_ATTR_FATTR_CHANGE (1U << 17) |
91 | #define NFS_ATTR_FATTR_PRECHANGE (1U << 18) | 90 | #define NFS_ATTR_FATTR_PRECHANGE (1U << 18) |
92 | #define NFS_ATTR_FATTR_V4_REFERRAL (1U << 19) /* NFSv4 referral */ | 91 | #define NFS_ATTR_FATTR_V4_LOCATIONS (1U << 19) |
93 | #define NFS_ATTR_FATTR_MOUNTPOINT (1U << 20) /* Treat as mountpoint */ | 92 | #define NFS_ATTR_FATTR_V4_REFERRAL (1U << 20) |
94 | #define NFS_ATTR_FATTR_MOUNTED_ON_FILEID (1U << 21) | 93 | #define NFS_ATTR_FATTR_MOUNTPOINT (1U << 21) |
95 | #define NFS_ATTR_FATTR_OWNER_NAME (1U << 22) | 94 | #define NFS_ATTR_FATTR_MOUNTED_ON_FILEID (1U << 22) |
96 | #define NFS_ATTR_FATTR_GROUP_NAME (1U << 23) | 95 | #define NFS_ATTR_FATTR_OWNER_NAME (1U << 23) |
96 | #define NFS_ATTR_FATTR_GROUP_NAME (1U << 24) | ||
97 | 97 | ||
98 | #define NFS_ATTR_FATTR (NFS_ATTR_FATTR_TYPE \ | 98 | #define NFS_ATTR_FATTR (NFS_ATTR_FATTR_TYPE \ |
99 | | NFS_ATTR_FATTR_MODE \ | 99 | | NFS_ATTR_FATTR_MODE \ |
@@ -182,7 +182,7 @@ struct nfs4_slot { | |||
182 | 182 | ||
183 | struct nfs4_sequence_args { | 183 | struct nfs4_sequence_args { |
184 | struct nfs4_session *sa_session; | 184 | struct nfs4_session *sa_session; |
185 | u8 sa_slotid; | 185 | u32 sa_slotid; |
186 | u8 sa_cache_this; | 186 | u8 sa_cache_this; |
187 | }; | 187 | }; |
188 | 188 | ||
@@ -977,6 +977,7 @@ struct nfs4_server_caps_res { | |||
977 | u32 acl_bitmask; | 977 | u32 acl_bitmask; |
978 | u32 has_links; | 978 | u32 has_links; |
979 | u32 has_symlinks; | 979 | u32 has_symlinks; |
980 | u32 fh_expire_type; | ||
980 | struct nfs4_sequence_res seq_res; | 981 | struct nfs4_sequence_res seq_res; |
981 | }; | 982 | }; |
982 | 983 | ||
@@ -1055,14 +1056,6 @@ struct nfstime4 { | |||
1055 | }; | 1056 | }; |
1056 | 1057 | ||
1057 | #ifdef CONFIG_NFS_V4_1 | 1058 | #ifdef CONFIG_NFS_V4_1 |
1058 | struct nfs_impl_id4 { | ||
1059 | u32 domain_len; | ||
1060 | char *domain; | ||
1061 | u32 name_len; | ||
1062 | char *name; | ||
1063 | struct nfstime4 date; | ||
1064 | }; | ||
1065 | |||
1066 | #define NFS4_EXCHANGE_ID_LEN (48) | 1059 | #define NFS4_EXCHANGE_ID_LEN (48) |
1067 | struct nfs41_exchange_id_args { | 1060 | struct nfs41_exchange_id_args { |
1068 | struct nfs_client *client; | 1061 | struct nfs_client *client; |
@@ -1083,10 +1076,17 @@ struct server_scope { | |||
1083 | char server_scope[NFS4_OPAQUE_LIMIT]; | 1076 | char server_scope[NFS4_OPAQUE_LIMIT]; |
1084 | }; | 1077 | }; |
1085 | 1078 | ||
1079 | struct nfs41_impl_id { | ||
1080 | char domain[NFS4_OPAQUE_LIMIT + 1]; | ||
1081 | char name[NFS4_OPAQUE_LIMIT + 1]; | ||
1082 | struct nfstime4 date; | ||
1083 | }; | ||
1084 | |||
1086 | struct nfs41_exchange_id_res { | 1085 | struct nfs41_exchange_id_res { |
1087 | struct nfs_client *client; | 1086 | struct nfs_client *client; |
1088 | u32 flags; | 1087 | u32 flags; |
1089 | struct server_scope *server_scope; | 1088 | struct server_scope *server_scope; |
1089 | struct nfs41_impl_id *impl_id; | ||
1090 | }; | 1090 | }; |
1091 | 1091 | ||
1092 | struct nfs41_create_session_args { | 1092 | struct nfs41_create_session_args { |
@@ -1192,6 +1192,27 @@ struct nfs_write_data { | |||
1192 | struct page *page_array[NFS_PAGEVEC_SIZE]; | 1192 | struct page *page_array[NFS_PAGEVEC_SIZE]; |
1193 | }; | 1193 | }; |
1194 | 1194 | ||
1195 | struct nfs_unlinkdata { | ||
1196 | struct hlist_node list; | ||
1197 | struct nfs_removeargs args; | ||
1198 | struct nfs_removeres res; | ||
1199 | struct inode *dir; | ||
1200 | struct rpc_cred *cred; | ||
1201 | struct nfs_fattr dir_attr; | ||
1202 | }; | ||
1203 | |||
1204 | struct nfs_renamedata { | ||
1205 | struct nfs_renameargs args; | ||
1206 | struct nfs_renameres res; | ||
1207 | struct rpc_cred *cred; | ||
1208 | struct inode *old_dir; | ||
1209 | struct dentry *old_dentry; | ||
1210 | struct nfs_fattr old_fattr; | ||
1211 | struct inode *new_dir; | ||
1212 | struct dentry *new_dentry; | ||
1213 | struct nfs_fattr new_fattr; | ||
1214 | }; | ||
1215 | |||
1195 | struct nfs_access_entry; | 1216 | struct nfs_access_entry; |
1196 | struct nfs_client; | 1217 | struct nfs_client; |
1197 | struct rpc_timeout; | 1218 | struct rpc_timeout; |
@@ -1221,10 +1242,12 @@ struct nfs_rpc_ops { | |||
1221 | struct iattr *, int, struct nfs_open_context *); | 1242 | struct iattr *, int, struct nfs_open_context *); |
1222 | int (*remove) (struct inode *, struct qstr *); | 1243 | int (*remove) (struct inode *, struct qstr *); |
1223 | void (*unlink_setup) (struct rpc_message *, struct inode *dir); | 1244 | void (*unlink_setup) (struct rpc_message *, struct inode *dir); |
1245 | void (*unlink_rpc_prepare) (struct rpc_task *, struct nfs_unlinkdata *); | ||
1224 | int (*unlink_done) (struct rpc_task *, struct inode *); | 1246 | int (*unlink_done) (struct rpc_task *, struct inode *); |
1225 | int (*rename) (struct inode *, struct qstr *, | 1247 | int (*rename) (struct inode *, struct qstr *, |
1226 | struct inode *, struct qstr *); | 1248 | struct inode *, struct qstr *); |
1227 | void (*rename_setup) (struct rpc_message *msg, struct inode *dir); | 1249 | void (*rename_setup) (struct rpc_message *msg, struct inode *dir); |
1250 | void (*rename_rpc_prepare)(struct rpc_task *task, struct nfs_renamedata *); | ||
1228 | int (*rename_done) (struct rpc_task *task, struct inode *old_dir, struct inode *new_dir); | 1251 | int (*rename_done) (struct rpc_task *task, struct inode *old_dir, struct inode *new_dir); |
1229 | int (*link) (struct inode *, struct inode *, struct qstr *); | 1252 | int (*link) (struct inode *, struct inode *, struct qstr *); |
1230 | int (*symlink) (struct inode *, struct dentry *, struct page *, | 1253 | int (*symlink) (struct inode *, struct dentry *, struct page *, |
@@ -1244,8 +1267,10 @@ struct nfs_rpc_ops { | |||
1244 | int (*set_capabilities)(struct nfs_server *, struct nfs_fh *); | 1267 | int (*set_capabilities)(struct nfs_server *, struct nfs_fh *); |
1245 | int (*decode_dirent)(struct xdr_stream *, struct nfs_entry *, int); | 1268 | int (*decode_dirent)(struct xdr_stream *, struct nfs_entry *, int); |
1246 | void (*read_setup) (struct nfs_read_data *, struct rpc_message *); | 1269 | void (*read_setup) (struct nfs_read_data *, struct rpc_message *); |
1270 | void (*read_rpc_prepare)(struct rpc_task *, struct nfs_read_data *); | ||
1247 | int (*read_done) (struct rpc_task *, struct nfs_read_data *); | 1271 | int (*read_done) (struct rpc_task *, struct nfs_read_data *); |
1248 | void (*write_setup) (struct nfs_write_data *, struct rpc_message *); | 1272 | void (*write_setup) (struct nfs_write_data *, struct rpc_message *); |
1273 | void (*write_rpc_prepare)(struct rpc_task *, struct nfs_write_data *); | ||
1249 | int (*write_done) (struct rpc_task *, struct nfs_write_data *); | 1274 | int (*write_done) (struct rpc_task *, struct nfs_write_data *); |
1250 | void (*commit_setup) (struct nfs_write_data *, struct rpc_message *); | 1275 | void (*commit_setup) (struct nfs_write_data *, struct rpc_message *); |
1251 | int (*commit_done) (struct rpc_task *, struct nfs_write_data *); | 1276 | int (*commit_done) (struct rpc_task *, struct nfs_write_data *); |
@@ -1275,11 +1300,11 @@ struct nfs_rpc_ops { | |||
1275 | extern const struct nfs_rpc_ops nfs_v2_clientops; | 1300 | extern const struct nfs_rpc_ops nfs_v2_clientops; |
1276 | extern const struct nfs_rpc_ops nfs_v3_clientops; | 1301 | extern const struct nfs_rpc_ops nfs_v3_clientops; |
1277 | extern const struct nfs_rpc_ops nfs_v4_clientops; | 1302 | extern const struct nfs_rpc_ops nfs_v4_clientops; |
1278 | extern struct rpc_version nfs_version2; | 1303 | extern const struct rpc_version nfs_version2; |
1279 | extern struct rpc_version nfs_version3; | 1304 | extern const struct rpc_version nfs_version3; |
1280 | extern struct rpc_version nfs_version4; | 1305 | extern const struct rpc_version nfs_version4; |
1281 | 1306 | ||
1282 | extern struct rpc_version nfsacl_version3; | 1307 | extern const struct rpc_version nfsacl_version3; |
1283 | extern struct rpc_program nfsacl_program; | 1308 | extern const struct rpc_program nfsacl_program; |
1284 | 1309 | ||
1285 | #endif | 1310 | #endif |
diff --git a/include/linux/nfsd/Kbuild b/include/linux/nfsd/Kbuild index b8d4001212b3..5b7d84ac954a 100644 --- a/include/linux/nfsd/Kbuild +++ b/include/linux/nfsd/Kbuild | |||
@@ -1,3 +1,4 @@ | |||
1 | header-y += cld.h | ||
1 | header-y += debug.h | 2 | header-y += debug.h |
2 | header-y += export.h | 3 | header-y += export.h |
3 | header-y += nfsfh.h | 4 | header-y += nfsfh.h |
diff --git a/include/linux/nfsd/cld.h b/include/linux/nfsd/cld.h new file mode 100644 index 000000000000..f14a9ab06f1f --- /dev/null +++ b/include/linux/nfsd/cld.h | |||
@@ -0,0 +1,56 @@ | |||
1 | /* | ||
2 | * Upcall description for nfsdcld communication | ||
3 | * | ||
4 | * Copyright (c) 2012 Red Hat, Inc. | ||
5 | * Author(s): Jeff Layton <jlayton@redhat.com> | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License as published by | ||
9 | * the Free Software Foundation; either version 2 of the License, or | ||
10 | * (at your option) any later version. | ||
11 | * | ||
12 | * This program is distributed in the hope that it will be useful, | ||
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
15 | * GNU General Public License for more details. | ||
16 | * | ||
17 | * You should have received a copy of the GNU General Public License | ||
18 | * along with this program; if not, write to the Free Software | ||
19 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
20 | */ | ||
21 | |||
22 | #ifndef _NFSD_CLD_H | ||
23 | #define _NFSD_CLD_H | ||
24 | |||
25 | /* latest upcall version available */ | ||
26 | #define CLD_UPCALL_VERSION 1 | ||
27 | |||
28 | /* defined by RFC3530 */ | ||
29 | #define NFS4_OPAQUE_LIMIT 1024 | ||
30 | |||
31 | enum cld_command { | ||
32 | Cld_Create, /* create a record for this cm_id */ | ||
33 | Cld_Remove, /* remove record of this cm_id */ | ||
34 | Cld_Check, /* is this cm_id allowed? */ | ||
35 | Cld_GraceDone, /* grace period is complete */ | ||
36 | }; | ||
37 | |||
38 | /* representation of long-form NFSv4 client ID */ | ||
39 | struct cld_name { | ||
40 | uint16_t cn_len; /* length of cm_id */ | ||
41 | unsigned char cn_id[NFS4_OPAQUE_LIMIT]; /* client-provided */ | ||
42 | } __attribute__((packed)); | ||
43 | |||
44 | /* message struct for communication with userspace */ | ||
45 | struct cld_msg { | ||
46 | uint8_t cm_vers; /* upcall version */ | ||
47 | uint8_t cm_cmd; /* upcall command */ | ||
48 | int16_t cm_status; /* return code */ | ||
49 | uint32_t cm_xid; /* transaction id */ | ||
50 | union { | ||
51 | int64_t cm_gracetime; /* grace period start time */ | ||
52 | struct cld_name cm_name; | ||
53 | } __attribute__((packed)) cm_u; | ||
54 | } __attribute__((packed)); | ||
55 | |||
56 | #endif /* !_NFSD_CLD_H */ | ||
diff --git a/include/linux/nilfs2_fs.h b/include/linux/nilfs2_fs.h index 7454ad7451b4..89bd4a4dcfb4 100644 --- a/include/linux/nilfs2_fs.h +++ b/include/linux/nilfs2_fs.h | |||
@@ -41,6 +41,7 @@ | |||
41 | #include <linux/types.h> | 41 | #include <linux/types.h> |
42 | #include <linux/ioctl.h> | 42 | #include <linux/ioctl.h> |
43 | #include <linux/magic.h> | 43 | #include <linux/magic.h> |
44 | #include <linux/bug.h> | ||
44 | 45 | ||
45 | 46 | ||
46 | #define NILFS_INODE_BMAP_SIZE 7 | 47 | #define NILFS_INODE_BMAP_SIZE 7 |
diff --git a/include/linux/nl80211.h b/include/linux/nl80211.h index 0f5ff3739820..e474f6e780cc 100644 --- a/include/linux/nl80211.h +++ b/include/linux/nl80211.h | |||
@@ -156,21 +156,23 @@ | |||
156 | * @NL80211_CMD_DEL_KEY: delete a key identified by %NL80211_ATTR_KEY_IDX | 156 | * @NL80211_CMD_DEL_KEY: delete a key identified by %NL80211_ATTR_KEY_IDX |
157 | * or %NL80211_ATTR_MAC. | 157 | * or %NL80211_ATTR_MAC. |
158 | * | 158 | * |
159 | * @NL80211_CMD_GET_BEACON: retrieve beacon information (returned in a | 159 | * @NL80211_CMD_GET_BEACON: (not used) |
160 | * %NL80222_CMD_NEW_BEACON message) | 160 | * @NL80211_CMD_SET_BEACON: change the beacon on an access point interface |
161 | * @NL80211_CMD_SET_BEACON: set the beacon on an access point interface | 161 | * using the %NL80211_ATTR_BEACON_HEAD and %NL80211_ATTR_BEACON_TAIL |
162 | * using the %NL80211_ATTR_BEACON_INTERVAL, %NL80211_ATTR_DTIM_PERIOD, | 162 | * attributes. For drivers that generate the beacon and probe responses |
163 | * %NL80211_ATTR_BEACON_HEAD and %NL80211_ATTR_BEACON_TAIL attributes. | 163 | * internally, the following attributes must be provided: %NL80211_ATTR_IE, |
164 | * Following attributes are provided for drivers that generate full Beacon | 164 | * %NL80211_ATTR_IE_PROBE_RESP and %NL80211_ATTR_IE_ASSOC_RESP. |
165 | * and Probe Response frames internally: %NL80211_ATTR_SSID, | 165 | * @NL80211_CMD_START_AP: Start AP operation on an AP interface, parameters |
166 | * are like for %NL80211_CMD_SET_BEACON, and additionally parameters that | ||
167 | * do not change are used, these include %NL80211_ATTR_BEACON_INTERVAL, | ||
168 | * %NL80211_ATTR_DTIM_PERIOD, %NL80211_ATTR_SSID, | ||
166 | * %NL80211_ATTR_HIDDEN_SSID, %NL80211_ATTR_CIPHERS_PAIRWISE, | 169 | * %NL80211_ATTR_HIDDEN_SSID, %NL80211_ATTR_CIPHERS_PAIRWISE, |
167 | * %NL80211_ATTR_CIPHER_GROUP, %NL80211_ATTR_WPA_VERSIONS, | 170 | * %NL80211_ATTR_CIPHER_GROUP, %NL80211_ATTR_WPA_VERSIONS, |
168 | * %NL80211_ATTR_AKM_SUITES, %NL80211_ATTR_PRIVACY, | 171 | * %NL80211_ATTR_AKM_SUITES, %NL80211_ATTR_PRIVACY, |
169 | * %NL80211_ATTR_AUTH_TYPE, %NL80211_ATTR_IE, %NL80211_ATTR_IE_PROBE_RESP, | 172 | * %NL80211_ATTR_AUTH_TYPE and %NL80211_ATTR_INACTIVITY_TIMEOUT. |
170 | * %NL80211_ATTR_IE_ASSOC_RESP. | 173 | * @NL80211_CMD_NEW_BEACON: old alias for %NL80211_CMD_START_AP |
171 | * @NL80211_CMD_NEW_BEACON: add a new beacon to an access point interface, | 174 | * @NL80211_CMD_STOP_AP: Stop AP operation on the given interface |
172 | * parameters are like for %NL80211_CMD_SET_BEACON. | 175 | * @NL80211_CMD_DEL_BEACON: old alias for %NL80211_CMD_STOP_AP |
173 | * @NL80211_CMD_DEL_BEACON: remove the beacon, stop sending it | ||
174 | * | 176 | * |
175 | * @NL80211_CMD_GET_STATION: Get station attributes for station identified by | 177 | * @NL80211_CMD_GET_STATION: Get station attributes for station identified by |
176 | * %NL80211_ATTR_MAC on the interface identified by %NL80211_ATTR_IFINDEX. | 178 | * %NL80211_ATTR_MAC on the interface identified by %NL80211_ATTR_IFINDEX. |
@@ -367,6 +369,11 @@ | |||
367 | * %NL80211_ATTR_WIPHY_FREQ, %NL80211_ATTR_CONTROL_PORT, | 369 | * %NL80211_ATTR_WIPHY_FREQ, %NL80211_ATTR_CONTROL_PORT, |
368 | * %NL80211_ATTR_CONTROL_PORT_ETHERTYPE and | 370 | * %NL80211_ATTR_CONTROL_PORT_ETHERTYPE and |
369 | * %NL80211_ATTR_CONTROL_PORT_NO_ENCRYPT. | 371 | * %NL80211_ATTR_CONTROL_PORT_NO_ENCRYPT. |
372 | * Background scan period can optionally be | ||
373 | * specified in %NL80211_ATTR_BG_SCAN_PERIOD, | ||
374 | * if not specified default background scan configuration | ||
375 | * in driver is used and if period value is 0, bg scan will be disabled. | ||
376 | * This attribute is ignored if driver does not support roam scan. | ||
370 | * It is also sent as an event, with the BSSID and response IEs when the | 377 | * It is also sent as an event, with the BSSID and response IEs when the |
371 | * connection is established or failed to be established. This can be | 378 | * connection is established or failed to be established. This can be |
372 | * determined by the STATUS_CODE attribute. | 379 | * determined by the STATUS_CODE attribute. |
@@ -565,8 +572,10 @@ enum nl80211_commands { | |||
565 | 572 | ||
566 | NL80211_CMD_GET_BEACON, | 573 | NL80211_CMD_GET_BEACON, |
567 | NL80211_CMD_SET_BEACON, | 574 | NL80211_CMD_SET_BEACON, |
568 | NL80211_CMD_NEW_BEACON, | 575 | NL80211_CMD_START_AP, |
569 | NL80211_CMD_DEL_BEACON, | 576 | NL80211_CMD_NEW_BEACON = NL80211_CMD_START_AP, |
577 | NL80211_CMD_STOP_AP, | ||
578 | NL80211_CMD_DEL_BEACON = NL80211_CMD_STOP_AP, | ||
570 | 579 | ||
571 | NL80211_CMD_GET_STATION, | 580 | NL80211_CMD_GET_STATION, |
572 | NL80211_CMD_SET_STATION, | 581 | NL80211_CMD_SET_STATION, |
@@ -1193,6 +1202,19 @@ enum nl80211_commands { | |||
1193 | * @NL80211_ATTR_NOACK_MAP: This u16 bitmap contains the No Ack Policy of | 1202 | * @NL80211_ATTR_NOACK_MAP: This u16 bitmap contains the No Ack Policy of |
1194 | * up to 16 TIDs. | 1203 | * up to 16 TIDs. |
1195 | * | 1204 | * |
1205 | * @NL80211_ATTR_INACTIVITY_TIMEOUT: timeout value in seconds, this can be | ||
1206 | * used by the drivers which has MLME in firmware and does not have support | ||
1207 | * to report per station tx/rx activity to free up the staion entry from | ||
1208 | * the list. This needs to be used when the driver advertises the | ||
1209 | * capability to timeout the stations. | ||
1210 | * | ||
1211 | * @NL80211_ATTR_RX_SIGNAL_DBM: signal strength in dBm (as a 32-bit int); | ||
1212 | * this attribute is (depending on the driver capabilities) added to | ||
1213 | * received frames indicated with %NL80211_CMD_FRAME. | ||
1214 | * | ||
1215 | * @NL80211_ATTR_BG_SCAN_PERIOD: Background scan period in seconds | ||
1216 | * or 0 to disable background scan. | ||
1217 | * | ||
1196 | * @NL80211_ATTR_MAX: highest attribute number currently defined | 1218 | * @NL80211_ATTR_MAX: highest attribute number currently defined |
1197 | * @__NL80211_ATTR_AFTER_LAST: internal use | 1219 | * @__NL80211_ATTR_AFTER_LAST: internal use |
1198 | */ | 1220 | */ |
@@ -1438,6 +1460,12 @@ enum nl80211_attrs { | |||
1438 | 1460 | ||
1439 | NL80211_ATTR_NOACK_MAP, | 1461 | NL80211_ATTR_NOACK_MAP, |
1440 | 1462 | ||
1463 | NL80211_ATTR_INACTIVITY_TIMEOUT, | ||
1464 | |||
1465 | NL80211_ATTR_RX_SIGNAL_DBM, | ||
1466 | |||
1467 | NL80211_ATTR_BG_SCAN_PERIOD, | ||
1468 | |||
1441 | /* add attributes here, update the policy in nl80211.c */ | 1469 | /* add attributes here, update the policy in nl80211.c */ |
1442 | 1470 | ||
1443 | __NL80211_ATTR_AFTER_LAST, | 1471 | __NL80211_ATTR_AFTER_LAST, |
@@ -1475,6 +1503,7 @@ enum nl80211_attrs { | |||
1475 | #define NL80211_ATTR_FEATURE_FLAGS NL80211_ATTR_FEATURE_FLAGS | 1503 | #define NL80211_ATTR_FEATURE_FLAGS NL80211_ATTR_FEATURE_FLAGS |
1476 | 1504 | ||
1477 | #define NL80211_MAX_SUPP_RATES 32 | 1505 | #define NL80211_MAX_SUPP_RATES 32 |
1506 | #define NL80211_MAX_SUPP_HT_RATES 77 | ||
1478 | #define NL80211_MAX_SUPP_REG_RULES 32 | 1507 | #define NL80211_MAX_SUPP_REG_RULES 32 |
1479 | #define NL80211_TKIP_DATA_OFFSET_ENCR_KEY 0 | 1508 | #define NL80211_TKIP_DATA_OFFSET_ENCR_KEY 0 |
1480 | #define NL80211_TKIP_DATA_OFFSET_TX_MIC_KEY 16 | 1509 | #define NL80211_TKIP_DATA_OFFSET_TX_MIC_KEY 16 |
@@ -2104,6 +2133,13 @@ enum nl80211_mntr_flags { | |||
2104 | * TUs) during which a mesh STA can send only one Action frame containing a | 2133 | * TUs) during which a mesh STA can send only one Action frame containing a |
2105 | * PERR element. | 2134 | * PERR element. |
2106 | * | 2135 | * |
2136 | * @NL80211_MESHCONF_FORWARDING: set Mesh STA as forwarding or non-forwarding | ||
2137 | * or forwarding entity (default is TRUE - forwarding entity) | ||
2138 | * | ||
2139 | * @NL80211_MESHCONF_RSSI_THRESHOLD: RSSI threshold in dBm. This specifies the | ||
2140 | * threshold for average signal strength of candidate station to establish | ||
2141 | * a peer link. | ||
2142 | * | ||
2107 | * @NL80211_MESHCONF_ATTR_MAX: highest possible mesh configuration attribute | 2143 | * @NL80211_MESHCONF_ATTR_MAX: highest possible mesh configuration attribute |
2108 | * | 2144 | * |
2109 | * @__NL80211_MESHCONF_ATTR_AFTER_LAST: internal use | 2145 | * @__NL80211_MESHCONF_ATTR_AFTER_LAST: internal use |
@@ -2128,6 +2164,8 @@ enum nl80211_meshconf_params { | |||
2128 | NL80211_MESHCONF_HWMP_RANN_INTERVAL, | 2164 | NL80211_MESHCONF_HWMP_RANN_INTERVAL, |
2129 | NL80211_MESHCONF_GATE_ANNOUNCEMENTS, | 2165 | NL80211_MESHCONF_GATE_ANNOUNCEMENTS, |
2130 | NL80211_MESHCONF_HWMP_PERR_MIN_INTERVAL, | 2166 | NL80211_MESHCONF_HWMP_PERR_MIN_INTERVAL, |
2167 | NL80211_MESHCONF_FORWARDING, | ||
2168 | NL80211_MESHCONF_RSSI_THRESHOLD, | ||
2131 | 2169 | ||
2132 | /* keep last */ | 2170 | /* keep last */ |
2133 | __NL80211_MESHCONF_ATTR_AFTER_LAST, | 2171 | __NL80211_MESHCONF_ATTR_AFTER_LAST, |
@@ -2401,12 +2439,15 @@ enum nl80211_key_attributes { | |||
2401 | * in an array of rates as defined in IEEE 802.11 7.3.2.2 (u8 values with | 2439 | * in an array of rates as defined in IEEE 802.11 7.3.2.2 (u8 values with |
2402 | * 1 = 500 kbps) but without the IE length restriction (at most | 2440 | * 1 = 500 kbps) but without the IE length restriction (at most |
2403 | * %NL80211_MAX_SUPP_RATES in a single array). | 2441 | * %NL80211_MAX_SUPP_RATES in a single array). |
2442 | * @NL80211_TXRATE_MCS: HT (MCS) rates allowed for TX rate selection | ||
2443 | * in an array of MCS numbers. | ||
2404 | * @__NL80211_TXRATE_AFTER_LAST: internal | 2444 | * @__NL80211_TXRATE_AFTER_LAST: internal |
2405 | * @NL80211_TXRATE_MAX: highest TX rate attribute | 2445 | * @NL80211_TXRATE_MAX: highest TX rate attribute |
2406 | */ | 2446 | */ |
2407 | enum nl80211_tx_rate_attributes { | 2447 | enum nl80211_tx_rate_attributes { |
2408 | __NL80211_TXRATE_INVALID, | 2448 | __NL80211_TXRATE_INVALID, |
2409 | NL80211_TXRATE_LEGACY, | 2449 | NL80211_TXRATE_LEGACY, |
2450 | NL80211_TXRATE_MCS, | ||
2410 | 2451 | ||
2411 | /* keep last */ | 2452 | /* keep last */ |
2412 | __NL80211_TXRATE_AFTER_LAST, | 2453 | __NL80211_TXRATE_AFTER_LAST, |
@@ -2792,10 +2833,13 @@ enum nl80211_ap_sme_features { | |||
2792 | * TX status to the socket error queue when requested with the | 2833 | * TX status to the socket error queue when requested with the |
2793 | * socket option. | 2834 | * socket option. |
2794 | * @NL80211_FEATURE_HT_IBSS: This driver supports IBSS with HT datarates. | 2835 | * @NL80211_FEATURE_HT_IBSS: This driver supports IBSS with HT datarates. |
2836 | * @NL80211_FEATURE_INACTIVITY_TIMER: This driver takes care of freeing up | ||
2837 | * the connected inactive stations in AP mode. | ||
2795 | */ | 2838 | */ |
2796 | enum nl80211_feature_flags { | 2839 | enum nl80211_feature_flags { |
2797 | NL80211_FEATURE_SK_TX_STATUS = 1 << 0, | 2840 | NL80211_FEATURE_SK_TX_STATUS = 1 << 0, |
2798 | NL80211_FEATURE_HT_IBSS = 1 << 1, | 2841 | NL80211_FEATURE_HT_IBSS = 1 << 1, |
2842 | NL80211_FEATURE_INACTIVITY_TIMER = 1 << 2, | ||
2799 | }; | 2843 | }; |
2800 | 2844 | ||
2801 | /** | 2845 | /** |
diff --git a/include/linux/nmi.h b/include/linux/nmi.h index 2d304efc89df..db50840e6355 100644 --- a/include/linux/nmi.h +++ b/include/linux/nmi.h | |||
@@ -14,7 +14,7 @@ | |||
14 | * may be used to reset the timeout - for code which intentionally | 14 | * may be used to reset the timeout - for code which intentionally |
15 | * disables interrupts for a long time. This call is stateless. | 15 | * disables interrupts for a long time. This call is stateless. |
16 | */ | 16 | */ |
17 | #if defined(ARCH_HAS_NMI_WATCHDOG) || defined(CONFIG_HARDLOCKUP_DETECTOR) | 17 | #if defined(CONFIG_HAVE_NMI_WATCHDOG) || defined(CONFIG_HARDLOCKUP_DETECTOR) |
18 | #include <asm/nmi.h> | 18 | #include <asm/nmi.h> |
19 | extern void touch_nmi_watchdog(void); | 19 | extern void touch_nmi_watchdog(void); |
20 | #else | 20 | #else |
diff --git a/include/linux/of.h b/include/linux/of.h index a75a831e2057..fa7fb1d97458 100644 --- a/include/linux/of.h +++ b/include/linux/of.h | |||
@@ -72,19 +72,17 @@ struct of_phandle_args { | |||
72 | uint32_t args[MAX_PHANDLE_ARGS]; | 72 | uint32_t args[MAX_PHANDLE_ARGS]; |
73 | }; | 73 | }; |
74 | 74 | ||
75 | #if defined(CONFIG_SPARC) || !defined(CONFIG_OF) | 75 | #ifdef CONFIG_OF_DYNAMIC |
76 | extern struct device_node *of_node_get(struct device_node *node); | ||
77 | extern void of_node_put(struct device_node *node); | ||
78 | #else /* CONFIG_OF_DYNAMIC */ | ||
76 | /* Dummy ref counting routines - to be implemented later */ | 79 | /* Dummy ref counting routines - to be implemented later */ |
77 | static inline struct device_node *of_node_get(struct device_node *node) | 80 | static inline struct device_node *of_node_get(struct device_node *node) |
78 | { | 81 | { |
79 | return node; | 82 | return node; |
80 | } | 83 | } |
81 | static inline void of_node_put(struct device_node *node) | 84 | static inline void of_node_put(struct device_node *node) { } |
82 | { | 85 | #endif /* !CONFIG_OF_DYNAMIC */ |
83 | } | ||
84 | #else | ||
85 | extern struct device_node *of_node_get(struct device_node *node); | ||
86 | extern void of_node_put(struct device_node *node); | ||
87 | #endif | ||
88 | 86 | ||
89 | #ifdef CONFIG_OF | 87 | #ifdef CONFIG_OF |
90 | 88 | ||
@@ -217,6 +215,9 @@ extern int of_property_read_string(struct device_node *np, | |||
217 | extern int of_property_read_string_index(struct device_node *np, | 215 | extern int of_property_read_string_index(struct device_node *np, |
218 | const char *propname, | 216 | const char *propname, |
219 | int index, const char **output); | 217 | int index, const char **output); |
218 | extern int of_property_match_string(struct device_node *np, | ||
219 | const char *propname, | ||
220 | const char *string); | ||
220 | extern int of_property_count_strings(struct device_node *np, | 221 | extern int of_property_count_strings(struct device_node *np, |
221 | const char *propname); | 222 | const char *propname); |
222 | extern int of_device_is_compatible(const struct device_node *device, | 223 | extern int of_device_is_compatible(const struct device_node *device, |
@@ -281,6 +282,14 @@ static inline struct property *of_find_property(const struct device_node *np, | |||
281 | return NULL; | 282 | return NULL; |
282 | } | 283 | } |
283 | 284 | ||
285 | static inline struct device_node *of_find_compatible_node( | ||
286 | struct device_node *from, | ||
287 | const char *type, | ||
288 | const char *compat) | ||
289 | { | ||
290 | return NULL; | ||
291 | } | ||
292 | |||
284 | static inline int of_property_read_u32_array(const struct device_node *np, | 293 | static inline int of_property_read_u32_array(const struct device_node *np, |
285 | const char *propname, | 294 | const char *propname, |
286 | u32 *out_values, size_t sz) | 295 | u32 *out_values, size_t sz) |
@@ -342,6 +351,22 @@ static inline int of_machine_is_compatible(const char *compat) | |||
342 | #define of_match_node(_matches, _node) NULL | 351 | #define of_match_node(_matches, _node) NULL |
343 | #endif /* CONFIG_OF */ | 352 | #endif /* CONFIG_OF */ |
344 | 353 | ||
354 | /** | ||
355 | * of_property_read_bool - Findfrom a property | ||
356 | * @np: device node from which the property value is to be read. | ||
357 | * @propname: name of the property to be searched. | ||
358 | * | ||
359 | * Search for a property in a device node. | ||
360 | * Returns true if the property exist false otherwise. | ||
361 | */ | ||
362 | static inline bool of_property_read_bool(const struct device_node *np, | ||
363 | const char *propname) | ||
364 | { | ||
365 | struct property *prop = of_find_property(np, propname, NULL); | ||
366 | |||
367 | return prop ? true : false; | ||
368 | } | ||
369 | |||
345 | static inline int of_property_read_u32(const struct device_node *np, | 370 | static inline int of_property_read_u32(const struct device_node *np, |
346 | const char *propname, | 371 | const char *propname, |
347 | u32 *out_value) | 372 | u32 *out_value) |
diff --git a/include/linux/of_address.h b/include/linux/of_address.h index 3118623c2c1f..01b925ad8d78 100644 --- a/include/linux/of_address.h +++ b/include/linux/of_address.h | |||
@@ -4,6 +4,7 @@ | |||
4 | #include <linux/errno.h> | 4 | #include <linux/errno.h> |
5 | #include <linux/of.h> | 5 | #include <linux/of.h> |
6 | 6 | ||
7 | #ifdef CONFIG_OF_ADDRESS | ||
7 | extern u64 of_translate_address(struct device_node *np, const __be32 *addr); | 8 | extern u64 of_translate_address(struct device_node *np, const __be32 *addr); |
8 | extern int of_address_to_resource(struct device_node *dev, int index, | 9 | extern int of_address_to_resource(struct device_node *dev, int index, |
9 | struct resource *r); | 10 | struct resource *r); |
@@ -25,12 +26,37 @@ static inline unsigned long pci_address_to_pio(phys_addr_t addr) { return -1; } | |||
25 | #define pci_address_to_pio pci_address_to_pio | 26 | #define pci_address_to_pio pci_address_to_pio |
26 | #endif | 27 | #endif |
27 | 28 | ||
28 | #ifdef CONFIG_PCI | 29 | #else /* CONFIG_OF_ADDRESS */ |
30 | static inline int of_address_to_resource(struct device_node *dev, int index, | ||
31 | struct resource *r) | ||
32 | { | ||
33 | return -EINVAL; | ||
34 | } | ||
35 | static inline struct device_node *of_find_matching_node_by_address( | ||
36 | struct device_node *from, | ||
37 | const struct of_device_id *matches, | ||
38 | u64 base_address) | ||
39 | { | ||
40 | return NULL; | ||
41 | } | ||
42 | static inline void __iomem *of_iomap(struct device_node *device, int index) | ||
43 | { | ||
44 | return NULL; | ||
45 | } | ||
46 | static inline const u32 *of_get_address(struct device_node *dev, int index, | ||
47 | u64 *size, unsigned int *flags) | ||
48 | { | ||
49 | return NULL; | ||
50 | } | ||
51 | #endif /* CONFIG_OF_ADDRESS */ | ||
52 | |||
53 | |||
54 | #if defined(CONFIG_OF_ADDRESS) && defined(CONFIG_PCI) | ||
29 | extern const __be32 *of_get_pci_address(struct device_node *dev, int bar_no, | 55 | extern const __be32 *of_get_pci_address(struct device_node *dev, int bar_no, |
30 | u64 *size, unsigned int *flags); | 56 | u64 *size, unsigned int *flags); |
31 | extern int of_pci_address_to_resource(struct device_node *dev, int bar, | 57 | extern int of_pci_address_to_resource(struct device_node *dev, int bar, |
32 | struct resource *r); | 58 | struct resource *r); |
33 | #else /* CONFIG_PCI */ | 59 | #else /* CONFIG_OF_ADDRESS && CONFIG_PCI */ |
34 | static inline int of_pci_address_to_resource(struct device_node *dev, int bar, | 60 | static inline int of_pci_address_to_resource(struct device_node *dev, int bar, |
35 | struct resource *r) | 61 | struct resource *r) |
36 | { | 62 | { |
@@ -42,8 +68,7 @@ static inline const __be32 *of_get_pci_address(struct device_node *dev, | |||
42 | { | 68 | { |
43 | return NULL; | 69 | return NULL; |
44 | } | 70 | } |
45 | #endif /* CONFIG_PCI */ | 71 | #endif /* CONFIG_OF_ADDRESS && CONFIG_PCI */ |
46 | |||
47 | 72 | ||
48 | #endif /* __OF_ADDRESS_H */ | 73 | #endif /* __OF_ADDRESS_H */ |
49 | 74 | ||
diff --git a/include/linux/of_device.h b/include/linux/of_device.h index ae5638480ef2..901b7435e890 100644 --- a/include/linux/of_device.h +++ b/include/linux/of_device.h | |||
@@ -5,10 +5,11 @@ | |||
5 | #include <linux/of_platform.h> /* temporary until merge */ | 5 | #include <linux/of_platform.h> /* temporary until merge */ |
6 | 6 | ||
7 | #ifdef CONFIG_OF_DEVICE | 7 | #ifdef CONFIG_OF_DEVICE |
8 | #include <linux/device.h> | ||
9 | #include <linux/of.h> | 8 | #include <linux/of.h> |
10 | #include <linux/mod_devicetable.h> | 9 | #include <linux/mod_devicetable.h> |
11 | 10 | ||
11 | struct device; | ||
12 | |||
12 | extern const struct of_device_id *of_match_device( | 13 | extern const struct of_device_id *of_match_device( |
13 | const struct of_device_id *matches, const struct device *dev); | 14 | const struct of_device_id *matches, const struct device *dev); |
14 | extern void of_device_make_bus_id(struct device *dev); | 15 | extern void of_device_make_bus_id(struct device *dev); |
@@ -34,7 +35,8 @@ extern void of_device_unregister(struct platform_device *ofdev); | |||
34 | extern ssize_t of_device_get_modalias(struct device *dev, | 35 | extern ssize_t of_device_get_modalias(struct device *dev, |
35 | char *str, ssize_t len); | 36 | char *str, ssize_t len); |
36 | 37 | ||
37 | extern int of_device_uevent(struct device *dev, struct kobj_uevent_env *env); | 38 | extern void of_device_uevent(struct device *dev, struct kobj_uevent_env *env); |
39 | extern int of_device_uevent_modalias(struct device *dev, struct kobj_uevent_env *env); | ||
38 | 40 | ||
39 | static inline void of_device_node_put(struct device *dev) | 41 | static inline void of_device_node_put(struct device *dev) |
40 | { | 42 | { |
@@ -49,7 +51,10 @@ static inline int of_driver_match_device(struct device *dev, | |||
49 | return 0; | 51 | return 0; |
50 | } | 52 | } |
51 | 53 | ||
52 | static inline int of_device_uevent(struct device *dev, | 54 | static inline void of_device_uevent(struct device *dev, |
55 | struct kobj_uevent_env *env) { } | ||
56 | |||
57 | static inline int of_device_uevent_modalias(struct device *dev, | ||
53 | struct kobj_uevent_env *env) | 58 | struct kobj_uevent_env *env) |
54 | { | 59 | { |
55 | return -ENODEV; | 60 | return -ENODEV; |
diff --git a/include/linux/of_gpio.h b/include/linux/of_gpio.h index b254052a49d7..81733d12cbea 100644 --- a/include/linux/of_gpio.h +++ b/include/linux/of_gpio.h | |||
@@ -50,7 +50,8 @@ static inline struct of_mm_gpio_chip *to_of_mm_gpio_chip(struct gpio_chip *gc) | |||
50 | extern int of_get_named_gpio_flags(struct device_node *np, | 50 | extern int of_get_named_gpio_flags(struct device_node *np, |
51 | const char *list_name, int index, enum of_gpio_flags *flags); | 51 | const char *list_name, int index, enum of_gpio_flags *flags); |
52 | 52 | ||
53 | extern unsigned int of_gpio_count(struct device_node *np); | 53 | extern unsigned int of_gpio_named_count(struct device_node *np, |
54 | const char* propname); | ||
54 | 55 | ||
55 | extern int of_mm_gpiochip_add(struct device_node *np, | 56 | extern int of_mm_gpiochip_add(struct device_node *np, |
56 | struct of_mm_gpio_chip *mm_gc); | 57 | struct of_mm_gpio_chip *mm_gc); |
@@ -71,7 +72,8 @@ static inline int of_get_named_gpio_flags(struct device_node *np, | |||
71 | return -ENOSYS; | 72 | return -ENOSYS; |
72 | } | 73 | } |
73 | 74 | ||
74 | static inline unsigned int of_gpio_count(struct device_node *np) | 75 | static inline unsigned int of_gpio_named_count(struct device_node *np, |
76 | const char* propname) | ||
75 | { | 77 | { |
76 | return 0; | 78 | return 0; |
77 | } | 79 | } |
@@ -89,6 +91,27 @@ static inline void of_gpiochip_remove(struct gpio_chip *gc) { } | |||
89 | #endif /* CONFIG_OF_GPIO */ | 91 | #endif /* CONFIG_OF_GPIO */ |
90 | 92 | ||
91 | /** | 93 | /** |
94 | * of_gpio_count - Count GPIOs for a device | ||
95 | * @np: device node to count GPIOs for | ||
96 | * | ||
97 | * The function returns the count of GPIOs specified for a node. | ||
98 | * | ||
99 | * Note that the empty GPIO specifiers counts too. For example, | ||
100 | * | ||
101 | * gpios = <0 | ||
102 | * &pio1 1 2 | ||
103 | * 0 | ||
104 | * &pio2 3 4>; | ||
105 | * | ||
106 | * defines four GPIOs (so this function will return 4), two of which | ||
107 | * are not specified. | ||
108 | */ | ||
109 | static inline unsigned int of_gpio_count(struct device_node *np) | ||
110 | { | ||
111 | return of_gpio_named_count(np, "gpios"); | ||
112 | } | ||
113 | |||
114 | /** | ||
92 | * of_get_gpio_flags() - Get a GPIO number and flags to use with GPIO API | 115 | * of_get_gpio_flags() - Get a GPIO number and flags to use with GPIO API |
93 | * @np: device node to get GPIO from | 116 | * @np: device node to get GPIO from |
94 | * @index: index of the GPIO | 117 | * @index: index of the GPIO |
diff --git a/include/linux/of_irq.h b/include/linux/of_irq.h index d0307eed20c9..d229ad3edee0 100644 --- a/include/linux/of_irq.h +++ b/include/linux/of_irq.h | |||
@@ -6,6 +6,7 @@ struct of_irq; | |||
6 | #include <linux/types.h> | 6 | #include <linux/types.h> |
7 | #include <linux/errno.h> | 7 | #include <linux/errno.h> |
8 | #include <linux/irq.h> | 8 | #include <linux/irq.h> |
9 | #include <linux/irqdomain.h> | ||
9 | #include <linux/ioport.h> | 10 | #include <linux/ioport.h> |
10 | #include <linux/of.h> | 11 | #include <linux/of.h> |
11 | 12 | ||
@@ -65,9 +66,6 @@ extern int of_irq_map_one(struct device_node *device, int index, | |||
65 | extern unsigned int irq_create_of_mapping(struct device_node *controller, | 66 | extern unsigned int irq_create_of_mapping(struct device_node *controller, |
66 | const u32 *intspec, | 67 | const u32 *intspec, |
67 | unsigned int intsize); | 68 | unsigned int intsize); |
68 | #ifdef CONFIG_IRQ_DOMAIN | ||
69 | extern void irq_dispose_mapping(unsigned int irq); | ||
70 | #endif | ||
71 | extern int of_irq_to_resource(struct device_node *dev, int index, | 69 | extern int of_irq_to_resource(struct device_node *dev, int index, |
72 | struct resource *r); | 70 | struct resource *r); |
73 | extern int of_irq_count(struct device_node *dev); | 71 | extern int of_irq_count(struct device_node *dev); |
diff --git a/include/linux/of_mtd.h b/include/linux/of_mtd.h new file mode 100644 index 000000000000..bae1b6094c63 --- /dev/null +++ b/include/linux/of_mtd.h | |||
@@ -0,0 +1,19 @@ | |||
1 | /* | ||
2 | * Copyright 2012 Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> | ||
3 | * | ||
4 | * OF helpers for mtd. | ||
5 | * | ||
6 | * This file is released under the GPLv2 | ||
7 | */ | ||
8 | |||
9 | #ifndef __LINUX_OF_MTD_H | ||
10 | #define __LINUX_OF_NET_H | ||
11 | |||
12 | #ifdef CONFIG_OF_MTD | ||
13 | #include <linux/of.h> | ||
14 | extern const int of_get_nand_ecc_mode(struct device_node *np); | ||
15 | int of_get_nand_bus_width(struct device_node *np); | ||
16 | bool of_get_nand_on_flash_bbt(struct device_node *np); | ||
17 | #endif | ||
18 | |||
19 | #endif /* __LINUX_OF_MTD_H */ | ||
diff --git a/include/linux/of_platform.h b/include/linux/of_platform.h index 040ce2f6e8de..b47d2040c9f2 100644 --- a/include/linux/of_platform.h +++ b/include/linux/of_platform.h | |||
@@ -81,7 +81,7 @@ extern struct platform_device *of_device_alloc(struct device_node *np, | |||
81 | struct device *parent); | 81 | struct device *parent); |
82 | extern struct platform_device *of_find_device_by_node(struct device_node *np); | 82 | extern struct platform_device *of_find_device_by_node(struct device_node *np); |
83 | 83 | ||
84 | #if !defined(CONFIG_SPARC) /* SPARC has its own device registration method */ | 84 | #ifdef CONFIG_OF_ADDRESS /* device reg helpers depend on OF_ADDRESS */ |
85 | /* Platform devices and busses creation */ | 85 | /* Platform devices and busses creation */ |
86 | extern struct platform_device *of_platform_device_create(struct device_node *np, | 86 | extern struct platform_device *of_platform_device_create(struct device_node *np, |
87 | const char *bus_id, | 87 | const char *bus_id, |
@@ -94,8 +94,19 @@ extern int of_platform_populate(struct device_node *root, | |||
94 | const struct of_device_id *matches, | 94 | const struct of_device_id *matches, |
95 | const struct of_dev_auxdata *lookup, | 95 | const struct of_dev_auxdata *lookup, |
96 | struct device *parent); | 96 | struct device *parent); |
97 | #endif /* !CONFIG_SPARC */ | 97 | #endif /* CONFIG_OF_ADDRESS */ |
98 | 98 | ||
99 | #endif /* CONFIG_OF_DEVICE */ | 99 | #endif /* CONFIG_OF_DEVICE */ |
100 | 100 | ||
101 | #if !defined(CONFIG_OF_ADDRESS) | ||
102 | struct of_dev_auxdata; | ||
103 | static inline int of_platform_populate(struct device_node *root, | ||
104 | const struct of_device_id *matches, | ||
105 | const struct of_dev_auxdata *lookup, | ||
106 | struct device *parent) | ||
107 | { | ||
108 | return -ENODEV; | ||
109 | } | ||
110 | #endif /* !CONFIG_OF_ADDRESS */ | ||
111 | |||
101 | #endif /* _LINUX_OF_PLATFORM_H */ | 112 | #endif /* _LINUX_OF_PLATFORM_H */ |
diff --git a/include/linux/omapfb.h b/include/linux/omapfb.h index c0b018790f07..4ff57e81051d 100644 --- a/include/linux/omapfb.h +++ b/include/linux/omapfb.h | |||
@@ -222,41 +222,11 @@ struct omapfb_display_info { | |||
222 | 222 | ||
223 | #include <plat/board.h> | 223 | #include <plat/board.h> |
224 | 224 | ||
225 | #ifdef CONFIG_ARCH_OMAP1 | ||
226 | #define OMAPFB_PLANE_NUM 1 | ||
227 | #else | ||
228 | #define OMAPFB_PLANE_NUM 3 | ||
229 | #endif | ||
230 | |||
231 | struct omapfb_mem_region { | ||
232 | u32 paddr; | ||
233 | void __iomem *vaddr; | ||
234 | unsigned long size; | ||
235 | u8 type; /* OMAPFB_PLANE_MEM_* */ | ||
236 | enum omapfb_color_format format;/* OMAPFB_COLOR_* */ | ||
237 | unsigned format_used:1; /* Must be set when format is set. | ||
238 | * Needed b/c of the badly chosen 0 | ||
239 | * base for OMAPFB_COLOR_* values | ||
240 | */ | ||
241 | unsigned alloc:1; /* allocated by the driver */ | ||
242 | unsigned map:1; /* kernel mapped by the driver */ | ||
243 | }; | ||
244 | |||
245 | struct omapfb_mem_desc { | ||
246 | int region_cnt; | ||
247 | struct omapfb_mem_region region[OMAPFB_PLANE_NUM]; | ||
248 | }; | ||
249 | |||
250 | struct omapfb_platform_data { | 225 | struct omapfb_platform_data { |
251 | struct omap_lcd_config lcd; | 226 | struct omap_lcd_config lcd; |
252 | struct omapfb_mem_desc mem_desc; | ||
253 | void *ctrl_platform_data; | ||
254 | }; | 227 | }; |
255 | 228 | ||
256 | /* in arch/arm/plat-omap/fb.c */ | 229 | void __init omapfb_set_lcd_config(const struct omap_lcd_config *config); |
257 | extern void omapfb_set_platform_data(struct omapfb_platform_data *data); | ||
258 | extern void omapfb_set_ctrl_platform_data(void *pdata); | ||
259 | extern void omapfb_reserve_sdram_memblock(void); | ||
260 | 230 | ||
261 | #endif | 231 | #endif |
262 | 232 | ||
diff --git a/include/linux/oom.h b/include/linux/oom.h index 552fba9c7d5a..3d7647536b03 100644 --- a/include/linux/oom.h +++ b/include/linux/oom.h | |||
@@ -49,7 +49,7 @@ extern int try_set_zonelist_oom(struct zonelist *zonelist, gfp_t gfp_flags); | |||
49 | extern void clear_zonelist_oom(struct zonelist *zonelist, gfp_t gfp_flags); | 49 | extern void clear_zonelist_oom(struct zonelist *zonelist, gfp_t gfp_flags); |
50 | 50 | ||
51 | extern void out_of_memory(struct zonelist *zonelist, gfp_t gfp_mask, | 51 | extern void out_of_memory(struct zonelist *zonelist, gfp_t gfp_mask, |
52 | int order, nodemask_t *mask); | 52 | int order, nodemask_t *mask, bool force_kill); |
53 | extern int register_oom_notifier(struct notifier_block *nb); | 53 | extern int register_oom_notifier(struct notifier_block *nb); |
54 | extern int unregister_oom_notifier(struct notifier_block *nb); | 54 | extern int unregister_oom_notifier(struct notifier_block *nb); |
55 | 55 | ||
diff --git a/include/linux/opp.h b/include/linux/opp.h index ee94b33080c2..2a4e5faee904 100644 --- a/include/linux/opp.h +++ b/include/linux/opp.h | |||
@@ -19,6 +19,7 @@ | |||
19 | #include <linux/notifier.h> | 19 | #include <linux/notifier.h> |
20 | 20 | ||
21 | struct opp; | 21 | struct opp; |
22 | struct device; | ||
22 | 23 | ||
23 | enum opp_event { | 24 | enum opp_event { |
24 | OPP_EVENT_ADD, OPP_EVENT_ENABLE, OPP_EVENT_DISABLE, | 25 | OPP_EVENT_ADD, OPP_EVENT_ENABLE, OPP_EVENT_DISABLE, |
diff --git a/include/linux/padata.h b/include/linux/padata.h index 4633b2f726b6..86292beebfe2 100644 --- a/include/linux/padata.h +++ b/include/linux/padata.h | |||
@@ -46,7 +46,6 @@ struct padata_priv { | |||
46 | struct list_head list; | 46 | struct list_head list; |
47 | struct parallel_data *pd; | 47 | struct parallel_data *pd; |
48 | int cb_cpu; | 48 | int cb_cpu; |
49 | int seq_nr; | ||
50 | int info; | 49 | int info; |
51 | void (*parallel)(struct padata_priv *padata); | 50 | void (*parallel)(struct padata_priv *padata); |
52 | void (*serial)(struct padata_priv *padata); | 51 | void (*serial)(struct padata_priv *padata); |
@@ -116,7 +115,6 @@ struct padata_cpumask { | |||
116 | * @pinst: padata instance. | 115 | * @pinst: padata instance. |
117 | * @pqueue: percpu padata queues used for parallelization. | 116 | * @pqueue: percpu padata queues used for parallelization. |
118 | * @squeue: percpu padata queues used for serialuzation. | 117 | * @squeue: percpu padata queues used for serialuzation. |
119 | * @seq_nr: The sequence number that will be attached to the next object. | ||
120 | * @reorder_objects: Number of objects waiting in the reorder queues. | 118 | * @reorder_objects: Number of objects waiting in the reorder queues. |
121 | * @refcnt: Number of objects holding a reference on this parallel_data. | 119 | * @refcnt: Number of objects holding a reference on this parallel_data. |
122 | * @max_seq_nr: Maximal used sequence number. | 120 | * @max_seq_nr: Maximal used sequence number. |
@@ -129,12 +127,12 @@ struct parallel_data { | |||
129 | struct padata_instance *pinst; | 127 | struct padata_instance *pinst; |
130 | struct padata_parallel_queue __percpu *pqueue; | 128 | struct padata_parallel_queue __percpu *pqueue; |
131 | struct padata_serial_queue __percpu *squeue; | 129 | struct padata_serial_queue __percpu *squeue; |
132 | atomic_t seq_nr; | ||
133 | atomic_t reorder_objects; | 130 | atomic_t reorder_objects; |
134 | atomic_t refcnt; | 131 | atomic_t refcnt; |
135 | unsigned int max_seq_nr; | ||
136 | struct padata_cpumask cpumask; | 132 | struct padata_cpumask cpumask; |
137 | spinlock_t lock ____cacheline_aligned; | 133 | spinlock_t lock ____cacheline_aligned; |
134 | spinlock_t seq_lock; | ||
135 | unsigned int seq_nr; | ||
138 | unsigned int processed; | 136 | unsigned int processed; |
139 | struct timer_list timer; | 137 | struct timer_list timer; |
140 | }; | 138 | }; |
diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h index e90a673be67e..c88d2a9451af 100644 --- a/include/linux/page-flags.h +++ b/include/linux/page-flags.h | |||
@@ -6,6 +6,7 @@ | |||
6 | #define PAGE_FLAGS_H | 6 | #define PAGE_FLAGS_H |
7 | 7 | ||
8 | #include <linux/types.h> | 8 | #include <linux/types.h> |
9 | #include <linux/bug.h> | ||
9 | #ifndef __GENERATING_BOUNDS_H | 10 | #ifndef __GENERATING_BOUNDS_H |
10 | #include <linux/mm_types.h> | 11 | #include <linux/mm_types.h> |
11 | #include <generated/bounds.h> | 12 | #include <generated/bounds.h> |
@@ -414,11 +415,26 @@ static inline int PageTransHuge(struct page *page) | |||
414 | return PageHead(page); | 415 | return PageHead(page); |
415 | } | 416 | } |
416 | 417 | ||
418 | /* | ||
419 | * PageTransCompound returns true for both transparent huge pages | ||
420 | * and hugetlbfs pages, so it should only be called when it's known | ||
421 | * that hugetlbfs pages aren't involved. | ||
422 | */ | ||
417 | static inline int PageTransCompound(struct page *page) | 423 | static inline int PageTransCompound(struct page *page) |
418 | { | 424 | { |
419 | return PageCompound(page); | 425 | return PageCompound(page); |
420 | } | 426 | } |
421 | 427 | ||
428 | /* | ||
429 | * PageTransTail returns true for both transparent huge pages | ||
430 | * and hugetlbfs pages, so it should only be called when it's known | ||
431 | * that hugetlbfs pages aren't involved. | ||
432 | */ | ||
433 | static inline int PageTransTail(struct page *page) | ||
434 | { | ||
435 | return PageTail(page); | ||
436 | } | ||
437 | |||
422 | #else | 438 | #else |
423 | 439 | ||
424 | static inline int PageTransHuge(struct page *page) | 440 | static inline int PageTransHuge(struct page *page) |
@@ -430,6 +446,11 @@ static inline int PageTransCompound(struct page *page) | |||
430 | { | 446 | { |
431 | return 0; | 447 | return 0; |
432 | } | 448 | } |
449 | |||
450 | static inline int PageTransTail(struct page *page) | ||
451 | { | ||
452 | return 0; | ||
453 | } | ||
433 | #endif | 454 | #endif |
434 | 455 | ||
435 | #ifdef CONFIG_MMU | 456 | #ifdef CONFIG_MMU |
diff --git a/include/linux/page_cgroup.h b/include/linux/page_cgroup.h index a2d11771c84b..a88cdba27809 100644 --- a/include/linux/page_cgroup.h +++ b/include/linux/page_cgroup.h | |||
@@ -4,12 +4,8 @@ | |||
4 | enum { | 4 | enum { |
5 | /* flags for mem_cgroup */ | 5 | /* flags for mem_cgroup */ |
6 | PCG_LOCK, /* Lock for pc->mem_cgroup and following bits. */ | 6 | PCG_LOCK, /* Lock for pc->mem_cgroup and following bits. */ |
7 | PCG_CACHE, /* charged as cache */ | ||
8 | PCG_USED, /* this object is in use. */ | 7 | PCG_USED, /* this object is in use. */ |
9 | PCG_MIGRATION, /* under page migration */ | 8 | PCG_MIGRATION, /* under page migration */ |
10 | /* flags for mem_cgroup and file and I/O status */ | ||
11 | PCG_MOVE_LOCK, /* For race between move_account v.s. following bits */ | ||
12 | PCG_FILE_MAPPED, /* page is accounted as "mapped" */ | ||
13 | __NR_PCG_FLAGS, | 9 | __NR_PCG_FLAGS, |
14 | }; | 10 | }; |
15 | 11 | ||
@@ -64,19 +60,10 @@ static inline void ClearPageCgroup##uname(struct page_cgroup *pc) \ | |||
64 | static inline int TestClearPageCgroup##uname(struct page_cgroup *pc) \ | 60 | static inline int TestClearPageCgroup##uname(struct page_cgroup *pc) \ |
65 | { return test_and_clear_bit(PCG_##lname, &pc->flags); } | 61 | { return test_and_clear_bit(PCG_##lname, &pc->flags); } |
66 | 62 | ||
67 | /* Cache flag is set only once (at allocation) */ | ||
68 | TESTPCGFLAG(Cache, CACHE) | ||
69 | CLEARPCGFLAG(Cache, CACHE) | ||
70 | SETPCGFLAG(Cache, CACHE) | ||
71 | |||
72 | TESTPCGFLAG(Used, USED) | 63 | TESTPCGFLAG(Used, USED) |
73 | CLEARPCGFLAG(Used, USED) | 64 | CLEARPCGFLAG(Used, USED) |
74 | SETPCGFLAG(Used, USED) | 65 | SETPCGFLAG(Used, USED) |
75 | 66 | ||
76 | SETPCGFLAG(FileMapped, FILE_MAPPED) | ||
77 | CLEARPCGFLAG(FileMapped, FILE_MAPPED) | ||
78 | TESTPCGFLAG(FileMapped, FILE_MAPPED) | ||
79 | |||
80 | SETPCGFLAG(Migration, MIGRATION) | 67 | SETPCGFLAG(Migration, MIGRATION) |
81 | CLEARPCGFLAG(Migration, MIGRATION) | 68 | CLEARPCGFLAG(Migration, MIGRATION) |
82 | TESTPCGFLAG(Migration, MIGRATION) | 69 | TESTPCGFLAG(Migration, MIGRATION) |
@@ -85,7 +72,7 @@ static inline void lock_page_cgroup(struct page_cgroup *pc) | |||
85 | { | 72 | { |
86 | /* | 73 | /* |
87 | * Don't take this lock in IRQ context. | 74 | * Don't take this lock in IRQ context. |
88 | * This lock is for pc->mem_cgroup, USED, CACHE, MIGRATION | 75 | * This lock is for pc->mem_cgroup, USED, MIGRATION |
89 | */ | 76 | */ |
90 | bit_spin_lock(PCG_LOCK, &pc->flags); | 77 | bit_spin_lock(PCG_LOCK, &pc->flags); |
91 | } | 78 | } |
@@ -95,24 +82,6 @@ static inline void unlock_page_cgroup(struct page_cgroup *pc) | |||
95 | bit_spin_unlock(PCG_LOCK, &pc->flags); | 82 | bit_spin_unlock(PCG_LOCK, &pc->flags); |
96 | } | 83 | } |
97 | 84 | ||
98 | static inline void move_lock_page_cgroup(struct page_cgroup *pc, | ||
99 | unsigned long *flags) | ||
100 | { | ||
101 | /* | ||
102 | * We know updates to pc->flags of page cache's stats are from both of | ||
103 | * usual context or IRQ context. Disable IRQ to avoid deadlock. | ||
104 | */ | ||
105 | local_irq_save(*flags); | ||
106 | bit_spin_lock(PCG_MOVE_LOCK, &pc->flags); | ||
107 | } | ||
108 | |||
109 | static inline void move_unlock_page_cgroup(struct page_cgroup *pc, | ||
110 | unsigned long *flags) | ||
111 | { | ||
112 | bit_spin_unlock(PCG_MOVE_LOCK, &pc->flags); | ||
113 | local_irq_restore(*flags); | ||
114 | } | ||
115 | |||
116 | #else /* CONFIG_CGROUP_MEM_RES_CTLR */ | 85 | #else /* CONFIG_CGROUP_MEM_RES_CTLR */ |
117 | struct page_cgroup; | 86 | struct page_cgroup; |
118 | 87 | ||
diff --git a/include/linux/parport.h b/include/linux/parport.h index 38a423ed3c01..106c2ca9440b 100644 --- a/include/linux/parport.h +++ b/include/linux/parport.h | |||
@@ -100,7 +100,6 @@ typedef enum { | |||
100 | #include <linux/wait.h> | 100 | #include <linux/wait.h> |
101 | #include <linux/irqreturn.h> | 101 | #include <linux/irqreturn.h> |
102 | #include <linux/semaphore.h> | 102 | #include <linux/semaphore.h> |
103 | #include <asm/system.h> | ||
104 | #include <asm/ptrace.h> | 103 | #include <asm/ptrace.h> |
105 | 104 | ||
106 | /* Define this later. */ | 105 | /* Define this later. */ |
diff --git a/include/linux/pci.h b/include/linux/pci.h index a16b1df3deff..e444f5b49118 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h | |||
@@ -299,7 +299,6 @@ struct pci_dev { | |||
299 | */ | 299 | */ |
300 | unsigned int irq; | 300 | unsigned int irq; |
301 | struct resource resource[DEVICE_COUNT_RESOURCE]; /* I/O and memory regions + expansion ROMs */ | 301 | struct resource resource[DEVICE_COUNT_RESOURCE]; /* I/O and memory regions + expansion ROMs */ |
302 | resource_size_t fw_addr[DEVICE_COUNT_RESOURCE]; /* FW-assigned addr */ | ||
303 | 302 | ||
304 | /* These fields are used by common fixups */ | 303 | /* These fields are used by common fixups */ |
305 | unsigned int transparent:1; /* Transparent PCI bridge */ | 304 | unsigned int transparent:1; /* Transparent PCI bridge */ |
@@ -369,24 +368,17 @@ static inline int pci_channel_offline(struct pci_dev *pdev) | |||
369 | return (pdev->error_state != pci_channel_io_normal); | 368 | return (pdev->error_state != pci_channel_io_normal); |
370 | } | 369 | } |
371 | 370 | ||
372 | static inline struct pci_cap_saved_state *pci_find_saved_cap( | 371 | struct pci_host_bridge_window { |
373 | struct pci_dev *pci_dev, char cap) | 372 | struct list_head list; |
374 | { | 373 | struct resource *res; /* host bridge aperture (CPU address) */ |
375 | struct pci_cap_saved_state *tmp; | 374 | resource_size_t offset; /* bus address + offset = CPU address */ |
376 | struct hlist_node *pos; | 375 | }; |
377 | |||
378 | hlist_for_each_entry(tmp, pos, &pci_dev->saved_cap_space, next) { | ||
379 | if (tmp->cap.cap_nr == cap) | ||
380 | return tmp; | ||
381 | } | ||
382 | return NULL; | ||
383 | } | ||
384 | 376 | ||
385 | static inline void pci_add_saved_cap(struct pci_dev *pci_dev, | 377 | struct pci_host_bridge { |
386 | struct pci_cap_saved_state *new_cap) | 378 | struct list_head list; |
387 | { | 379 | struct pci_bus *bus; /* root bus */ |
388 | hlist_add_head(&new_cap->next, &pci_dev->saved_cap_space); | 380 | struct list_head windows; /* pci_host_bridge_windows */ |
389 | } | 381 | }; |
390 | 382 | ||
391 | /* | 383 | /* |
392 | * The first PCI_BRIDGE_RESOURCE_NUM PCI bus resources (those that correspond | 384 | * The first PCI_BRIDGE_RESOURCE_NUM PCI bus resources (those that correspond |
@@ -656,6 +648,10 @@ void pci_fixup_cardbus(struct pci_bus *); | |||
656 | 648 | ||
657 | /* Generic PCI functions used internally */ | 649 | /* Generic PCI functions used internally */ |
658 | 650 | ||
651 | void pcibios_resource_to_bus(struct pci_dev *dev, struct pci_bus_region *region, | ||
652 | struct resource *res); | ||
653 | void pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res, | ||
654 | struct pci_bus_region *region); | ||
659 | void pcibios_scan_specific_bus(int busn); | 655 | void pcibios_scan_specific_bus(int busn); |
660 | extern struct pci_bus *pci_find_bus(int domain, int busnr); | 656 | extern struct pci_bus *pci_find_bus(int domain, int busnr); |
661 | void pci_bus_add_devices(const struct pci_bus *bus); | 657 | void pci_bus_add_devices(const struct pci_bus *bus); |
@@ -690,7 +686,8 @@ u8 pci_common_swizzle(struct pci_dev *dev, u8 *pinp); | |||
690 | extern struct pci_dev *pci_dev_get(struct pci_dev *dev); | 686 | extern struct pci_dev *pci_dev_get(struct pci_dev *dev); |
691 | extern void pci_dev_put(struct pci_dev *dev); | 687 | extern void pci_dev_put(struct pci_dev *dev); |
692 | extern void pci_remove_bus(struct pci_bus *b); | 688 | extern void pci_remove_bus(struct pci_bus *b); |
693 | extern void pci_remove_bus_device(struct pci_dev *dev); | 689 | extern void __pci_remove_bus_device(struct pci_dev *dev); |
690 | extern void pci_stop_and_remove_bus_device(struct pci_dev *dev); | ||
694 | extern void pci_stop_bus_device(struct pci_dev *dev); | 691 | extern void pci_stop_bus_device(struct pci_dev *dev); |
695 | void pci_setup_cardbus(struct pci_bus *bus); | 692 | void pci_setup_cardbus(struct pci_bus *bus); |
696 | extern void pci_sort_breadthfirst(void); | 693 | extern void pci_sort_breadthfirst(void); |
@@ -746,28 +743,28 @@ int pci_bus_write_config_dword(struct pci_bus *bus, unsigned int devfn, | |||
746 | int where, u32 val); | 743 | int where, u32 val); |
747 | struct pci_ops *pci_bus_set_ops(struct pci_bus *bus, struct pci_ops *ops); | 744 | struct pci_ops *pci_bus_set_ops(struct pci_bus *bus, struct pci_ops *ops); |
748 | 745 | ||
749 | static inline int pci_read_config_byte(struct pci_dev *dev, int where, u8 *val) | 746 | static inline int pci_read_config_byte(const struct pci_dev *dev, int where, u8 *val) |
750 | { | 747 | { |
751 | return pci_bus_read_config_byte(dev->bus, dev->devfn, where, val); | 748 | return pci_bus_read_config_byte(dev->bus, dev->devfn, where, val); |
752 | } | 749 | } |
753 | static inline int pci_read_config_word(struct pci_dev *dev, int where, u16 *val) | 750 | static inline int pci_read_config_word(const struct pci_dev *dev, int where, u16 *val) |
754 | { | 751 | { |
755 | return pci_bus_read_config_word(dev->bus, dev->devfn, where, val); | 752 | return pci_bus_read_config_word(dev->bus, dev->devfn, where, val); |
756 | } | 753 | } |
757 | static inline int pci_read_config_dword(struct pci_dev *dev, int where, | 754 | static inline int pci_read_config_dword(const struct pci_dev *dev, int where, |
758 | u32 *val) | 755 | u32 *val) |
759 | { | 756 | { |
760 | return pci_bus_read_config_dword(dev->bus, dev->devfn, where, val); | 757 | return pci_bus_read_config_dword(dev->bus, dev->devfn, where, val); |
761 | } | 758 | } |
762 | static inline int pci_write_config_byte(struct pci_dev *dev, int where, u8 val) | 759 | static inline int pci_write_config_byte(const struct pci_dev *dev, int where, u8 val) |
763 | { | 760 | { |
764 | return pci_bus_write_config_byte(dev->bus, dev->devfn, where, val); | 761 | return pci_bus_write_config_byte(dev->bus, dev->devfn, where, val); |
765 | } | 762 | } |
766 | static inline int pci_write_config_word(struct pci_dev *dev, int where, u16 val) | 763 | static inline int pci_write_config_word(const struct pci_dev *dev, int where, u16 val) |
767 | { | 764 | { |
768 | return pci_bus_write_config_word(dev->bus, dev->devfn, where, val); | 765 | return pci_bus_write_config_word(dev->bus, dev->devfn, where, val); |
769 | } | 766 | } |
770 | static inline int pci_write_config_dword(struct pci_dev *dev, int where, | 767 | static inline int pci_write_config_dword(const struct pci_dev *dev, int where, |
771 | u32 val) | 768 | u32 val) |
772 | { | 769 | { |
773 | return pci_bus_write_config_dword(dev->bus, dev->devfn, where, val); | 770 | return pci_bus_write_config_dword(dev->bus, dev->devfn, where, val); |
@@ -817,6 +814,7 @@ int pcie_set_readrq(struct pci_dev *dev, int rq); | |||
817 | int pcie_get_mps(struct pci_dev *dev); | 814 | int pcie_get_mps(struct pci_dev *dev); |
818 | int pcie_set_mps(struct pci_dev *dev, int mps); | 815 | int pcie_set_mps(struct pci_dev *dev, int mps); |
819 | int __pci_reset_function(struct pci_dev *dev); | 816 | int __pci_reset_function(struct pci_dev *dev); |
817 | int __pci_reset_function_locked(struct pci_dev *dev); | ||
820 | int pci_reset_function(struct pci_dev *dev); | 818 | int pci_reset_function(struct pci_dev *dev); |
821 | void pci_update_resource(struct pci_dev *dev, int resno); | 819 | void pci_update_resource(struct pci_dev *dev, int resno); |
822 | int __must_check pci_assign_resource(struct pci_dev *dev, int i); | 820 | int __must_check pci_assign_resource(struct pci_dev *dev, int i); |
@@ -882,6 +880,7 @@ void set_pcie_hotplug_bridge(struct pci_dev *pdev); | |||
882 | /* Functions for PCI Hotplug drivers to use */ | 880 | /* Functions for PCI Hotplug drivers to use */ |
883 | int pci_bus_find_capability(struct pci_bus *bus, unsigned int devfn, int cap); | 881 | int pci_bus_find_capability(struct pci_bus *bus, unsigned int devfn, int cap); |
884 | #ifdef CONFIG_HOTPLUG | 882 | #ifdef CONFIG_HOTPLUG |
883 | unsigned int pci_rescan_bus_bridge_resize(struct pci_dev *bridge); | ||
885 | unsigned int pci_rescan_bus(struct pci_bus *bus); | 884 | unsigned int pci_rescan_bus(struct pci_bus *bus); |
886 | #endif | 885 | #endif |
887 | 886 | ||
@@ -891,13 +890,13 @@ ssize_t pci_write_vpd(struct pci_dev *dev, loff_t pos, size_t count, const void | |||
891 | int pci_vpd_truncate(struct pci_dev *dev, size_t size); | 890 | int pci_vpd_truncate(struct pci_dev *dev, size_t size); |
892 | 891 | ||
893 | /* Helper functions for low-level code (drivers/pci/setup-[bus,res].c) */ | 892 | /* Helper functions for low-level code (drivers/pci/setup-[bus,res].c) */ |
893 | resource_size_t pcibios_retrieve_fw_addr(struct pci_dev *dev, int idx); | ||
894 | void pci_bus_assign_resources(const struct pci_bus *bus); | 894 | void pci_bus_assign_resources(const struct pci_bus *bus); |
895 | void pci_bus_size_bridges(struct pci_bus *bus); | 895 | void pci_bus_size_bridges(struct pci_bus *bus); |
896 | int pci_claim_resource(struct pci_dev *, int); | 896 | int pci_claim_resource(struct pci_dev *, int); |
897 | void pci_assign_unassigned_resources(void); | 897 | void pci_assign_unassigned_resources(void); |
898 | void pci_assign_unassigned_bridge_resources(struct pci_dev *bridge); | 898 | void pci_assign_unassigned_bridge_resources(struct pci_dev *bridge); |
899 | void pdev_enable_device(struct pci_dev *); | 899 | void pdev_enable_device(struct pci_dev *); |
900 | void pdev_sort_resources(struct pci_dev *, struct resource_list *); | ||
901 | int pci_enable_resources(struct pci_dev *, int mask); | 900 | int pci_enable_resources(struct pci_dev *, int mask); |
902 | void pci_fixup_irqs(u8 (*)(struct pci_dev *, u8 *), | 901 | void pci_fixup_irqs(u8 (*)(struct pci_dev *, u8 *), |
903 | int (*)(const struct pci_dev *, u8, u8)); | 902 | int (*)(const struct pci_dev *, u8, u8)); |
@@ -914,6 +913,8 @@ void pci_release_selected_regions(struct pci_dev *, int); | |||
914 | 913 | ||
915 | /* drivers/pci/bus.c */ | 914 | /* drivers/pci/bus.c */ |
916 | void pci_add_resource(struct list_head *resources, struct resource *res); | 915 | void pci_add_resource(struct list_head *resources, struct resource *res); |
916 | void pci_add_resource_offset(struct list_head *resources, struct resource *res, | ||
917 | resource_size_t offset); | ||
917 | void pci_free_resource_list(struct list_head *resources); | 918 | void pci_free_resource_list(struct list_head *resources); |
918 | void pci_bus_add_resource(struct pci_bus *bus, struct resource *res, unsigned int flags); | 919 | void pci_bus_add_resource(struct pci_bus *bus, struct resource *res, unsigned int flags); |
919 | struct resource *pci_bus_resource_n(const struct pci_bus *bus, int n); | 920 | struct resource *pci_bus_resource_n(const struct pci_bus *bus, int n); |
@@ -946,7 +947,20 @@ int __must_check __pci_register_driver(struct pci_driver *, struct module *, | |||
946 | __pci_register_driver(driver, THIS_MODULE, KBUILD_MODNAME) | 947 | __pci_register_driver(driver, THIS_MODULE, KBUILD_MODNAME) |
947 | 948 | ||
948 | void pci_unregister_driver(struct pci_driver *dev); | 949 | void pci_unregister_driver(struct pci_driver *dev); |
949 | void pci_remove_behind_bridge(struct pci_dev *dev); | 950 | |
951 | /** | ||
952 | * module_pci_driver() - Helper macro for registering a PCI driver | ||
953 | * @__pci_driver: pci_driver struct | ||
954 | * | ||
955 | * Helper macro for PCI drivers which do not do anything special in module | ||
956 | * init/exit. This eliminates a lot of boilerplate. Each module may only | ||
957 | * use this macro once, and calling it replaces module_init() and module_exit() | ||
958 | */ | ||
959 | #define module_pci_driver(__pci_driver) \ | ||
960 | module_driver(__pci_driver, pci_register_driver, \ | ||
961 | pci_unregister_driver) | ||
962 | |||
963 | void pci_stop_and_remove_behind_bridge(struct pci_dev *dev); | ||
950 | struct pci_driver *pci_dev_driver(const struct pci_dev *dev); | 964 | struct pci_driver *pci_dev_driver(const struct pci_dev *dev); |
951 | int pci_add_dynid(struct pci_driver *drv, | 965 | int pci_add_dynid(struct pci_driver *drv, |
952 | unsigned int vendor, unsigned int device, | 966 | unsigned int vendor, unsigned int device, |
@@ -1382,7 +1396,10 @@ static inline void pci_resource_to_user(const struct pci_dev *dev, int bar, | |||
1382 | */ | 1396 | */ |
1383 | 1397 | ||
1384 | struct pci_fixup { | 1398 | struct pci_fixup { |
1385 | u16 vendor, device; /* You can use PCI_ANY_ID here of course */ | 1399 | u16 vendor; /* You can use PCI_ANY_ID here of course */ |
1400 | u16 device; /* You can use PCI_ANY_ID here of course */ | ||
1401 | u32 class; /* You can use PCI_ANY_ID here too */ | ||
1402 | unsigned int class_shift; /* should be 0, 8, 16 */ | ||
1386 | void (*hook)(struct pci_dev *dev); | 1403 | void (*hook)(struct pci_dev *dev); |
1387 | }; | 1404 | }; |
1388 | 1405 | ||
@@ -1397,30 +1414,68 @@ enum pci_fixup_pass { | |||
1397 | }; | 1414 | }; |
1398 | 1415 | ||
1399 | /* Anonymous variables would be nice... */ | 1416 | /* Anonymous variables would be nice... */ |
1400 | #define DECLARE_PCI_FIXUP_SECTION(section, name, vendor, device, hook) \ | 1417 | #define DECLARE_PCI_FIXUP_SECTION(section, name, vendor, device, class, \ |
1401 | static const struct pci_fixup __pci_fixup_##name __used \ | 1418 | class_shift, hook) \ |
1402 | __attribute__((__section__(#section))) = { vendor, device, hook }; | 1419 | static const struct pci_fixup const __pci_fixup_##name __used \ |
1420 | __attribute__((__section__(#section), aligned((sizeof(void *))))) \ | ||
1421 | = { vendor, device, class, class_shift, hook }; | ||
1422 | |||
1423 | #define DECLARE_PCI_FIXUP_CLASS_EARLY(vendor, device, class, \ | ||
1424 | class_shift, hook) \ | ||
1425 | DECLARE_PCI_FIXUP_SECTION(.pci_fixup_early, \ | ||
1426 | vendor##device##hook, vendor, device, class, class_shift, hook) | ||
1427 | #define DECLARE_PCI_FIXUP_CLASS_HEADER(vendor, device, class, \ | ||
1428 | class_shift, hook) \ | ||
1429 | DECLARE_PCI_FIXUP_SECTION(.pci_fixup_header, \ | ||
1430 | vendor##device##hook, vendor, device, class, class_shift, hook) | ||
1431 | #define DECLARE_PCI_FIXUP_CLASS_FINAL(vendor, device, class, \ | ||
1432 | class_shift, hook) \ | ||
1433 | DECLARE_PCI_FIXUP_SECTION(.pci_fixup_final, \ | ||
1434 | vendor##device##hook, vendor, device, class, class_shift, hook) | ||
1435 | #define DECLARE_PCI_FIXUP_CLASS_ENABLE(vendor, device, class, \ | ||
1436 | class_shift, hook) \ | ||
1437 | DECLARE_PCI_FIXUP_SECTION(.pci_fixup_enable, \ | ||
1438 | vendor##device##hook, vendor, device, class, class_shift, hook) | ||
1439 | #define DECLARE_PCI_FIXUP_CLASS_RESUME(vendor, device, class, \ | ||
1440 | class_shift, hook) \ | ||
1441 | DECLARE_PCI_FIXUP_SECTION(.pci_fixup_resume, \ | ||
1442 | resume##vendor##device##hook, vendor, device, class, \ | ||
1443 | class_shift, hook) | ||
1444 | #define DECLARE_PCI_FIXUP_CLASS_RESUME_EARLY(vendor, device, class, \ | ||
1445 | class_shift, hook) \ | ||
1446 | DECLARE_PCI_FIXUP_SECTION(.pci_fixup_resume_early, \ | ||
1447 | resume_early##vendor##device##hook, vendor, device, \ | ||
1448 | class, class_shift, hook) | ||
1449 | #define DECLARE_PCI_FIXUP_CLASS_SUSPEND(vendor, device, class, \ | ||
1450 | class_shift, hook) \ | ||
1451 | DECLARE_PCI_FIXUP_SECTION(.pci_fixup_suspend, \ | ||
1452 | suspend##vendor##device##hook, vendor, device, class, \ | ||
1453 | class_shift, hook) | ||
1454 | |||
1403 | #define DECLARE_PCI_FIXUP_EARLY(vendor, device, hook) \ | 1455 | #define DECLARE_PCI_FIXUP_EARLY(vendor, device, hook) \ |
1404 | DECLARE_PCI_FIXUP_SECTION(.pci_fixup_early, \ | 1456 | DECLARE_PCI_FIXUP_SECTION(.pci_fixup_early, \ |
1405 | vendor##device##hook, vendor, device, hook) | 1457 | vendor##device##hook, vendor, device, PCI_ANY_ID, 0, hook) |
1406 | #define DECLARE_PCI_FIXUP_HEADER(vendor, device, hook) \ | 1458 | #define DECLARE_PCI_FIXUP_HEADER(vendor, device, hook) \ |
1407 | DECLARE_PCI_FIXUP_SECTION(.pci_fixup_header, \ | 1459 | DECLARE_PCI_FIXUP_SECTION(.pci_fixup_header, \ |
1408 | vendor##device##hook, vendor, device, hook) | 1460 | vendor##device##hook, vendor, device, PCI_ANY_ID, 0, hook) |
1409 | #define DECLARE_PCI_FIXUP_FINAL(vendor, device, hook) \ | 1461 | #define DECLARE_PCI_FIXUP_FINAL(vendor, device, hook) \ |
1410 | DECLARE_PCI_FIXUP_SECTION(.pci_fixup_final, \ | 1462 | DECLARE_PCI_FIXUP_SECTION(.pci_fixup_final, \ |
1411 | vendor##device##hook, vendor, device, hook) | 1463 | vendor##device##hook, vendor, device, PCI_ANY_ID, 0, hook) |
1412 | #define DECLARE_PCI_FIXUP_ENABLE(vendor, device, hook) \ | 1464 | #define DECLARE_PCI_FIXUP_ENABLE(vendor, device, hook) \ |
1413 | DECLARE_PCI_FIXUP_SECTION(.pci_fixup_enable, \ | 1465 | DECLARE_PCI_FIXUP_SECTION(.pci_fixup_enable, \ |
1414 | vendor##device##hook, vendor, device, hook) | 1466 | vendor##device##hook, vendor, device, PCI_ANY_ID, 0, hook) |
1415 | #define DECLARE_PCI_FIXUP_RESUME(vendor, device, hook) \ | 1467 | #define DECLARE_PCI_FIXUP_RESUME(vendor, device, hook) \ |
1416 | DECLARE_PCI_FIXUP_SECTION(.pci_fixup_resume, \ | 1468 | DECLARE_PCI_FIXUP_SECTION(.pci_fixup_resume, \ |
1417 | resume##vendor##device##hook, vendor, device, hook) | 1469 | resume##vendor##device##hook, vendor, device, \ |
1470 | PCI_ANY_ID, 0, hook) | ||
1418 | #define DECLARE_PCI_FIXUP_RESUME_EARLY(vendor, device, hook) \ | 1471 | #define DECLARE_PCI_FIXUP_RESUME_EARLY(vendor, device, hook) \ |
1419 | DECLARE_PCI_FIXUP_SECTION(.pci_fixup_resume_early, \ | 1472 | DECLARE_PCI_FIXUP_SECTION(.pci_fixup_resume_early, \ |
1420 | resume_early##vendor##device##hook, vendor, device, hook) | 1473 | resume_early##vendor##device##hook, vendor, device, \ |
1474 | PCI_ANY_ID, 0, hook) | ||
1421 | #define DECLARE_PCI_FIXUP_SUSPEND(vendor, device, hook) \ | 1475 | #define DECLARE_PCI_FIXUP_SUSPEND(vendor, device, hook) \ |
1422 | DECLARE_PCI_FIXUP_SECTION(.pci_fixup_suspend, \ | 1476 | DECLARE_PCI_FIXUP_SECTION(.pci_fixup_suspend, \ |
1423 | suspend##vendor##device##hook, vendor, device, hook) | 1477 | suspend##vendor##device##hook, vendor, device, \ |
1478 | PCI_ANY_ID, 0, hook) | ||
1424 | 1479 | ||
1425 | #ifdef CONFIG_PCI_QUIRKS | 1480 | #ifdef CONFIG_PCI_QUIRKS |
1426 | void pci_fixup_device(enum pci_fixup_pass pass, struct pci_dev *dev); | 1481 | void pci_fixup_device(enum pci_fixup_pass pass, struct pci_dev *dev); |
@@ -1647,6 +1702,13 @@ static inline void pci_set_bus_of_node(struct pci_bus *bus) { } | |||
1647 | static inline void pci_release_bus_of_node(struct pci_bus *bus) { } | 1702 | static inline void pci_release_bus_of_node(struct pci_bus *bus) { } |
1648 | #endif /* CONFIG_OF */ | 1703 | #endif /* CONFIG_OF */ |
1649 | 1704 | ||
1705 | #ifdef CONFIG_EEH | ||
1706 | static inline struct eeh_dev *pci_dev_to_eeh_dev(struct pci_dev *pdev) | ||
1707 | { | ||
1708 | return pdev->dev.archdata.edev; | ||
1709 | } | ||
1710 | #endif | ||
1711 | |||
1650 | /** | 1712 | /** |
1651 | * pci_find_upstream_pcie_bridge - find upstream PCIe-to-PCI bridge of a device | 1713 | * pci_find_upstream_pcie_bridge - find upstream PCIe-to-PCI bridge of a device |
1652 | * @pdev: the PCI device | 1714 | * @pdev: the PCI device |
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h index 31d77af2ef42..3329965ed63f 100644 --- a/include/linux/pci_ids.h +++ b/include/linux/pci_ids.h | |||
@@ -2105,6 +2105,7 @@ | |||
2105 | #define PCI_DEVICE_ID_NX2_57711E 0x1650 | 2105 | #define PCI_DEVICE_ID_NX2_57711E 0x1650 |
2106 | #define PCI_DEVICE_ID_TIGON3_5705 0x1653 | 2106 | #define PCI_DEVICE_ID_TIGON3_5705 0x1653 |
2107 | #define PCI_DEVICE_ID_TIGON3_5705_2 0x1654 | 2107 | #define PCI_DEVICE_ID_TIGON3_5705_2 0x1654 |
2108 | #define PCI_DEVICE_ID_TIGON3_5719 0x1657 | ||
2108 | #define PCI_DEVICE_ID_TIGON3_5721 0x1659 | 2109 | #define PCI_DEVICE_ID_TIGON3_5721 0x1659 |
2109 | #define PCI_DEVICE_ID_TIGON3_5722 0x165a | 2110 | #define PCI_DEVICE_ID_TIGON3_5722 0x165a |
2110 | #define PCI_DEVICE_ID_TIGON3_5723 0x165b | 2111 | #define PCI_DEVICE_ID_TIGON3_5723 0x165b |
diff --git a/include/linux/pci_regs.h b/include/linux/pci_regs.h index e41a10f5ae83..4b608f543412 100644 --- a/include/linux/pci_regs.h +++ b/include/linux/pci_regs.h | |||
@@ -391,6 +391,7 @@ | |||
391 | #define PCI_EXP_TYPE_UPSTREAM 0x5 /* Upstream Port */ | 391 | #define PCI_EXP_TYPE_UPSTREAM 0x5 /* Upstream Port */ |
392 | #define PCI_EXP_TYPE_DOWNSTREAM 0x6 /* Downstream Port */ | 392 | #define PCI_EXP_TYPE_DOWNSTREAM 0x6 /* Downstream Port */ |
393 | #define PCI_EXP_TYPE_PCI_BRIDGE 0x7 /* PCI/PCI-X Bridge */ | 393 | #define PCI_EXP_TYPE_PCI_BRIDGE 0x7 /* PCI/PCI-X Bridge */ |
394 | #define PCI_EXP_TYPE_PCIE_BRIDGE 0x8 /* PCI/PCI-X to PCIE Bridge */ | ||
394 | #define PCI_EXP_TYPE_RC_END 0x9 /* Root Complex Integrated Endpoint */ | 395 | #define PCI_EXP_TYPE_RC_END 0x9 /* Root Complex Integrated Endpoint */ |
395 | #define PCI_EXP_TYPE_RC_EC 0xa /* Root Complex Event Collector */ | 396 | #define PCI_EXP_TYPE_RC_EC 0xa /* Root Complex Event Collector */ |
396 | #define PCI_EXP_FLAGS_SLOT 0x0100 /* Slot implemented */ | 397 | #define PCI_EXP_FLAGS_SLOT 0x0100 /* Slot implemented */ |
diff --git a/include/linux/percpu.h b/include/linux/percpu.h index 32cd1f67462e..21638ae14e07 100644 --- a/include/linux/percpu.h +++ b/include/linux/percpu.h | |||
@@ -348,9 +348,9 @@ do { \ | |||
348 | #define _this_cpu_generic_to_op(pcp, val, op) \ | 348 | #define _this_cpu_generic_to_op(pcp, val, op) \ |
349 | do { \ | 349 | do { \ |
350 | unsigned long flags; \ | 350 | unsigned long flags; \ |
351 | local_irq_save(flags); \ | 351 | raw_local_irq_save(flags); \ |
352 | *__this_cpu_ptr(&(pcp)) op val; \ | 352 | *__this_cpu_ptr(&(pcp)) op val; \ |
353 | local_irq_restore(flags); \ | 353 | raw_local_irq_restore(flags); \ |
354 | } while (0) | 354 | } while (0) |
355 | 355 | ||
356 | #ifndef this_cpu_write | 356 | #ifndef this_cpu_write |
@@ -449,10 +449,10 @@ do { \ | |||
449 | ({ \ | 449 | ({ \ |
450 | typeof(pcp) ret__; \ | 450 | typeof(pcp) ret__; \ |
451 | unsigned long flags; \ | 451 | unsigned long flags; \ |
452 | local_irq_save(flags); \ | 452 | raw_local_irq_save(flags); \ |
453 | __this_cpu_add(pcp, val); \ | 453 | __this_cpu_add(pcp, val); \ |
454 | ret__ = __this_cpu_read(pcp); \ | 454 | ret__ = __this_cpu_read(pcp); \ |
455 | local_irq_restore(flags); \ | 455 | raw_local_irq_restore(flags); \ |
456 | ret__; \ | 456 | ret__; \ |
457 | }) | 457 | }) |
458 | 458 | ||
@@ -479,10 +479,10 @@ do { \ | |||
479 | #define _this_cpu_generic_xchg(pcp, nval) \ | 479 | #define _this_cpu_generic_xchg(pcp, nval) \ |
480 | ({ typeof(pcp) ret__; \ | 480 | ({ typeof(pcp) ret__; \ |
481 | unsigned long flags; \ | 481 | unsigned long flags; \ |
482 | local_irq_save(flags); \ | 482 | raw_local_irq_save(flags); \ |
483 | ret__ = __this_cpu_read(pcp); \ | 483 | ret__ = __this_cpu_read(pcp); \ |
484 | __this_cpu_write(pcp, nval); \ | 484 | __this_cpu_write(pcp, nval); \ |
485 | local_irq_restore(flags); \ | 485 | raw_local_irq_restore(flags); \ |
486 | ret__; \ | 486 | ret__; \ |
487 | }) | 487 | }) |
488 | 488 | ||
@@ -507,11 +507,11 @@ do { \ | |||
507 | ({ \ | 507 | ({ \ |
508 | typeof(pcp) ret__; \ | 508 | typeof(pcp) ret__; \ |
509 | unsigned long flags; \ | 509 | unsigned long flags; \ |
510 | local_irq_save(flags); \ | 510 | raw_local_irq_save(flags); \ |
511 | ret__ = __this_cpu_read(pcp); \ | 511 | ret__ = __this_cpu_read(pcp); \ |
512 | if (ret__ == (oval)) \ | 512 | if (ret__ == (oval)) \ |
513 | __this_cpu_write(pcp, nval); \ | 513 | __this_cpu_write(pcp, nval); \ |
514 | local_irq_restore(flags); \ | 514 | raw_local_irq_restore(flags); \ |
515 | ret__; \ | 515 | ret__; \ |
516 | }) | 516 | }) |
517 | 517 | ||
@@ -544,10 +544,10 @@ do { \ | |||
544 | ({ \ | 544 | ({ \ |
545 | int ret__; \ | 545 | int ret__; \ |
546 | unsigned long flags; \ | 546 | unsigned long flags; \ |
547 | local_irq_save(flags); \ | 547 | raw_local_irq_save(flags); \ |
548 | ret__ = __this_cpu_generic_cmpxchg_double(pcp1, pcp2, \ | 548 | ret__ = __this_cpu_generic_cmpxchg_double(pcp1, pcp2, \ |
549 | oval1, oval2, nval1, nval2); \ | 549 | oval1, oval2, nval1, nval2); \ |
550 | local_irq_restore(flags); \ | 550 | raw_local_irq_restore(flags); \ |
551 | ret__; \ | 551 | ret__; \ |
552 | }) | 552 | }) |
553 | 553 | ||
@@ -718,12 +718,13 @@ do { \ | |||
718 | # ifndef __this_cpu_add_return_8 | 718 | # ifndef __this_cpu_add_return_8 |
719 | # define __this_cpu_add_return_8(pcp, val) __this_cpu_generic_add_return(pcp, val) | 719 | # define __this_cpu_add_return_8(pcp, val) __this_cpu_generic_add_return(pcp, val) |
720 | # endif | 720 | # endif |
721 | # define __this_cpu_add_return(pcp, val) __pcpu_size_call_return2(this_cpu_add_return_, pcp, val) | 721 | # define __this_cpu_add_return(pcp, val) \ |
722 | __pcpu_size_call_return2(__this_cpu_add_return_, pcp, val) | ||
722 | #endif | 723 | #endif |
723 | 724 | ||
724 | #define __this_cpu_sub_return(pcp, val) this_cpu_add_return(pcp, -(val)) | 725 | #define __this_cpu_sub_return(pcp, val) __this_cpu_add_return(pcp, -(val)) |
725 | #define __this_cpu_inc_return(pcp) this_cpu_add_return(pcp, 1) | 726 | #define __this_cpu_inc_return(pcp) __this_cpu_add_return(pcp, 1) |
726 | #define __this_cpu_dec_return(pcp) this_cpu_add_return(pcp, -1) | 727 | #define __this_cpu_dec_return(pcp) __this_cpu_add_return(pcp, -1) |
727 | 728 | ||
728 | #define __this_cpu_generic_xchg(pcp, nval) \ | 729 | #define __this_cpu_generic_xchg(pcp, nval) \ |
729 | ({ typeof(pcp) ret__; \ | 730 | ({ typeof(pcp) ret__; \ |
diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h index abb2776be1ba..ddbb6a901f65 100644 --- a/include/linux/perf_event.h +++ b/include/linux/perf_event.h | |||
@@ -129,11 +129,40 @@ enum perf_event_sample_format { | |||
129 | PERF_SAMPLE_PERIOD = 1U << 8, | 129 | PERF_SAMPLE_PERIOD = 1U << 8, |
130 | PERF_SAMPLE_STREAM_ID = 1U << 9, | 130 | PERF_SAMPLE_STREAM_ID = 1U << 9, |
131 | PERF_SAMPLE_RAW = 1U << 10, | 131 | PERF_SAMPLE_RAW = 1U << 10, |
132 | PERF_SAMPLE_BRANCH_STACK = 1U << 11, | ||
132 | 133 | ||
133 | PERF_SAMPLE_MAX = 1U << 11, /* non-ABI */ | 134 | PERF_SAMPLE_MAX = 1U << 12, /* non-ABI */ |
134 | }; | 135 | }; |
135 | 136 | ||
136 | /* | 137 | /* |
138 | * values to program into branch_sample_type when PERF_SAMPLE_BRANCH is set | ||
139 | * | ||
140 | * If the user does not pass priv level information via branch_sample_type, | ||
141 | * the kernel uses the event's priv level. Branch and event priv levels do | ||
142 | * not have to match. Branch priv level is checked for permissions. | ||
143 | * | ||
144 | * The branch types can be combined, however BRANCH_ANY covers all types | ||
145 | * of branches and therefore it supersedes all the other types. | ||
146 | */ | ||
147 | enum perf_branch_sample_type { | ||
148 | PERF_SAMPLE_BRANCH_USER = 1U << 0, /* user branches */ | ||
149 | PERF_SAMPLE_BRANCH_KERNEL = 1U << 1, /* kernel branches */ | ||
150 | PERF_SAMPLE_BRANCH_HV = 1U << 2, /* hypervisor branches */ | ||
151 | |||
152 | PERF_SAMPLE_BRANCH_ANY = 1U << 3, /* any branch types */ | ||
153 | PERF_SAMPLE_BRANCH_ANY_CALL = 1U << 4, /* any call branch */ | ||
154 | PERF_SAMPLE_BRANCH_ANY_RETURN = 1U << 5, /* any return branch */ | ||
155 | PERF_SAMPLE_BRANCH_IND_CALL = 1U << 6, /* indirect calls */ | ||
156 | |||
157 | PERF_SAMPLE_BRANCH_MAX = 1U << 7, /* non-ABI */ | ||
158 | }; | ||
159 | |||
160 | #define PERF_SAMPLE_BRANCH_PLM_ALL \ | ||
161 | (PERF_SAMPLE_BRANCH_USER|\ | ||
162 | PERF_SAMPLE_BRANCH_KERNEL|\ | ||
163 | PERF_SAMPLE_BRANCH_HV) | ||
164 | |||
165 | /* | ||
137 | * The format of the data returned by read() on a perf event fd, | 166 | * The format of the data returned by read() on a perf event fd, |
138 | * as specified by attr.read_format: | 167 | * as specified by attr.read_format: |
139 | * | 168 | * |
@@ -163,6 +192,8 @@ enum perf_event_read_format { | |||
163 | }; | 192 | }; |
164 | 193 | ||
165 | #define PERF_ATTR_SIZE_VER0 64 /* sizeof first published struct */ | 194 | #define PERF_ATTR_SIZE_VER0 64 /* sizeof first published struct */ |
195 | #define PERF_ATTR_SIZE_VER1 72 /* add: config2 */ | ||
196 | #define PERF_ATTR_SIZE_VER2 80 /* add: branch_sample_type */ | ||
166 | 197 | ||
167 | /* | 198 | /* |
168 | * Hardware event_id to monitor via a performance monitoring event: | 199 | * Hardware event_id to monitor via a performance monitoring event: |
@@ -240,6 +271,7 @@ struct perf_event_attr { | |||
240 | __u64 bp_len; | 271 | __u64 bp_len; |
241 | __u64 config2; /* extension of config1 */ | 272 | __u64 config2; /* extension of config1 */ |
242 | }; | 273 | }; |
274 | __u64 branch_sample_type; /* enum branch_sample_type */ | ||
243 | }; | 275 | }; |
244 | 276 | ||
245 | /* | 277 | /* |
@@ -267,18 +299,31 @@ struct perf_event_mmap_page { | |||
267 | /* | 299 | /* |
268 | * Bits needed to read the hw events in user-space. | 300 | * Bits needed to read the hw events in user-space. |
269 | * | 301 | * |
270 | * u32 seq; | 302 | * u32 seq, time_mult, time_shift, idx, width; |
271 | * s64 count; | 303 | * u64 count, enabled, running; |
304 | * u64 cyc, time_offset; | ||
305 | * s64 pmc = 0; | ||
272 | * | 306 | * |
273 | * do { | 307 | * do { |
274 | * seq = pc->lock; | 308 | * seq = pc->lock; |
275 | * | ||
276 | * barrier() | 309 | * barrier() |
277 | * if (pc->index) { | 310 | * |
278 | * count = pmc_read(pc->index - 1); | 311 | * enabled = pc->time_enabled; |
279 | * count += pc->offset; | 312 | * running = pc->time_running; |
280 | * } else | 313 | * |
281 | * goto regular_read; | 314 | * if (pc->cap_usr_time && enabled != running) { |
315 | * cyc = rdtsc(); | ||
316 | * time_offset = pc->time_offset; | ||
317 | * time_mult = pc->time_mult; | ||
318 | * time_shift = pc->time_shift; | ||
319 | * } | ||
320 | * | ||
321 | * idx = pc->index; | ||
322 | * count = pc->offset; | ||
323 | * if (pc->cap_usr_rdpmc && idx) { | ||
324 | * width = pc->pmc_width; | ||
325 | * pmc = rdpmc(idx - 1); | ||
326 | * } | ||
282 | * | 327 | * |
283 | * barrier(); | 328 | * barrier(); |
284 | * } while (pc->lock != seq); | 329 | * } while (pc->lock != seq); |
@@ -291,12 +336,57 @@ struct perf_event_mmap_page { | |||
291 | __s64 offset; /* add to hardware event value */ | 336 | __s64 offset; /* add to hardware event value */ |
292 | __u64 time_enabled; /* time event active */ | 337 | __u64 time_enabled; /* time event active */ |
293 | __u64 time_running; /* time event on cpu */ | 338 | __u64 time_running; /* time event on cpu */ |
339 | union { | ||
340 | __u64 capabilities; | ||
341 | __u64 cap_usr_time : 1, | ||
342 | cap_usr_rdpmc : 1, | ||
343 | cap_____res : 62; | ||
344 | }; | ||
345 | |||
346 | /* | ||
347 | * If cap_usr_rdpmc this field provides the bit-width of the value | ||
348 | * read using the rdpmc() or equivalent instruction. This can be used | ||
349 | * to sign extend the result like: | ||
350 | * | ||
351 | * pmc <<= 64 - width; | ||
352 | * pmc >>= 64 - width; // signed shift right | ||
353 | * count += pmc; | ||
354 | */ | ||
355 | __u16 pmc_width; | ||
356 | |||
357 | /* | ||
358 | * If cap_usr_time the below fields can be used to compute the time | ||
359 | * delta since time_enabled (in ns) using rdtsc or similar. | ||
360 | * | ||
361 | * u64 quot, rem; | ||
362 | * u64 delta; | ||
363 | * | ||
364 | * quot = (cyc >> time_shift); | ||
365 | * rem = cyc & ((1 << time_shift) - 1); | ||
366 | * delta = time_offset + quot * time_mult + | ||
367 | * ((rem * time_mult) >> time_shift); | ||
368 | * | ||
369 | * Where time_offset,time_mult,time_shift and cyc are read in the | ||
370 | * seqcount loop described above. This delta can then be added to | ||
371 | * enabled and possible running (if idx), improving the scaling: | ||
372 | * | ||
373 | * enabled += delta; | ||
374 | * if (idx) | ||
375 | * running += delta; | ||
376 | * | ||
377 | * quot = count / running; | ||
378 | * rem = count % running; | ||
379 | * count = quot * enabled + (rem * enabled) / running; | ||
380 | */ | ||
381 | __u16 time_shift; | ||
382 | __u32 time_mult; | ||
383 | __u64 time_offset; | ||
294 | 384 | ||
295 | /* | 385 | /* |
296 | * Hole for extension of the self monitor capabilities | 386 | * Hole for extension of the self monitor capabilities |
297 | */ | 387 | */ |
298 | 388 | ||
299 | __u64 __reserved[123]; /* align to 1k */ | 389 | __u64 __reserved[120]; /* align to 1k */ |
300 | 390 | ||
301 | /* | 391 | /* |
302 | * Control data for the mmap() data buffer. | 392 | * Control data for the mmap() data buffer. |
@@ -456,6 +546,8 @@ enum perf_event_type { | |||
456 | * | 546 | * |
457 | * { u32 size; | 547 | * { u32 size; |
458 | * char data[size];}&& PERF_SAMPLE_RAW | 548 | * char data[size];}&& PERF_SAMPLE_RAW |
549 | * | ||
550 | * { u64 from, to, flags } lbr[nr];} && PERF_SAMPLE_BRANCH_STACK | ||
459 | * }; | 551 | * }; |
460 | */ | 552 | */ |
461 | PERF_RECORD_SAMPLE = 9, | 553 | PERF_RECORD_SAMPLE = 9, |
@@ -512,8 +604,9 @@ struct perf_guest_info_callbacks { | |||
512 | #include <linux/ftrace.h> | 604 | #include <linux/ftrace.h> |
513 | #include <linux/cpu.h> | 605 | #include <linux/cpu.h> |
514 | #include <linux/irq_work.h> | 606 | #include <linux/irq_work.h> |
515 | #include <linux/jump_label.h> | 607 | #include <linux/static_key.h> |
516 | #include <linux/atomic.h> | 608 | #include <linux/atomic.h> |
609 | #include <linux/sysfs.h> | ||
517 | #include <asm/local.h> | 610 | #include <asm/local.h> |
518 | 611 | ||
519 | #define PERF_MAX_STACK_DEPTH 255 | 612 | #define PERF_MAX_STACK_DEPTH 255 |
@@ -528,12 +621,34 @@ struct perf_raw_record { | |||
528 | void *data; | 621 | void *data; |
529 | }; | 622 | }; |
530 | 623 | ||
624 | /* | ||
625 | * single taken branch record layout: | ||
626 | * | ||
627 | * from: source instruction (may not always be a branch insn) | ||
628 | * to: branch target | ||
629 | * mispred: branch target was mispredicted | ||
630 | * predicted: branch target was predicted | ||
631 | * | ||
632 | * support for mispred, predicted is optional. In case it | ||
633 | * is not supported mispred = predicted = 0. | ||
634 | */ | ||
531 | struct perf_branch_entry { | 635 | struct perf_branch_entry { |
532 | __u64 from; | 636 | __u64 from; |
533 | __u64 to; | 637 | __u64 to; |
534 | __u64 flags; | 638 | __u64 mispred:1, /* target mispredicted */ |
639 | predicted:1,/* target predicted */ | ||
640 | reserved:62; | ||
535 | }; | 641 | }; |
536 | 642 | ||
643 | /* | ||
644 | * branch stack layout: | ||
645 | * nr: number of taken branches stored in entries[] | ||
646 | * | ||
647 | * Note that nr can vary from sample to sample | ||
648 | * branches (to, from) are stored from most recent | ||
649 | * to least recent, i.e., entries[0] contains the most | ||
650 | * recent branch. | ||
651 | */ | ||
537 | struct perf_branch_stack { | 652 | struct perf_branch_stack { |
538 | __u64 nr; | 653 | __u64 nr; |
539 | struct perf_branch_entry entries[0]; | 654 | struct perf_branch_entry entries[0]; |
@@ -564,7 +679,9 @@ struct hw_perf_event { | |||
564 | unsigned long event_base; | 679 | unsigned long event_base; |
565 | int idx; | 680 | int idx; |
566 | int last_cpu; | 681 | int last_cpu; |
682 | |||
567 | struct hw_perf_event_extra extra_reg; | 683 | struct hw_perf_event_extra extra_reg; |
684 | struct hw_perf_event_extra branch_reg; | ||
568 | }; | 685 | }; |
569 | struct { /* software */ | 686 | struct { /* software */ |
570 | struct hrtimer hrtimer; | 687 | struct hrtimer hrtimer; |
@@ -616,6 +733,7 @@ struct pmu { | |||
616 | struct list_head entry; | 733 | struct list_head entry; |
617 | 734 | ||
618 | struct device *dev; | 735 | struct device *dev; |
736 | const struct attribute_group **attr_groups; | ||
619 | char *name; | 737 | char *name; |
620 | int type; | 738 | int type; |
621 | 739 | ||
@@ -681,6 +799,17 @@ struct pmu { | |||
681 | * for each successful ->add() during the transaction. | 799 | * for each successful ->add() during the transaction. |
682 | */ | 800 | */ |
683 | void (*cancel_txn) (struct pmu *pmu); /* optional */ | 801 | void (*cancel_txn) (struct pmu *pmu); /* optional */ |
802 | |||
803 | /* | ||
804 | * Will return the value for perf_event_mmap_page::index for this event, | ||
805 | * if no implementation is provided it will default to: event->hw.idx + 1. | ||
806 | */ | ||
807 | int (*event_idx) (struct perf_event *event); /*optional */ | ||
808 | |||
809 | /* | ||
810 | * flush branch stack on context-switches (needed in cpu-wide mode) | ||
811 | */ | ||
812 | void (*flush_branch_stack) (void); | ||
684 | }; | 813 | }; |
685 | 814 | ||
686 | /** | 815 | /** |
@@ -850,6 +979,9 @@ struct perf_event { | |||
850 | #ifdef CONFIG_EVENT_TRACING | 979 | #ifdef CONFIG_EVENT_TRACING |
851 | struct ftrace_event_call *tp_event; | 980 | struct ftrace_event_call *tp_event; |
852 | struct event_filter *filter; | 981 | struct event_filter *filter; |
982 | #ifdef CONFIG_FUNCTION_TRACER | ||
983 | struct ftrace_ops ftrace_ops; | ||
984 | #endif | ||
853 | #endif | 985 | #endif |
854 | 986 | ||
855 | #ifdef CONFIG_CGROUP_PERF | 987 | #ifdef CONFIG_CGROUP_PERF |
@@ -911,7 +1043,8 @@ struct perf_event_context { | |||
911 | u64 parent_gen; | 1043 | u64 parent_gen; |
912 | u64 generation; | 1044 | u64 generation; |
913 | int pin_count; | 1045 | int pin_count; |
914 | int nr_cgroups; /* cgroup events present */ | 1046 | int nr_cgroups; /* cgroup evts */ |
1047 | int nr_branch_stack; /* branch_stack evt */ | ||
915 | struct rcu_head rcu_head; | 1048 | struct rcu_head rcu_head; |
916 | }; | 1049 | }; |
917 | 1050 | ||
@@ -976,6 +1109,7 @@ perf_event_create_kernel_counter(struct perf_event_attr *attr, | |||
976 | extern u64 perf_event_read_value(struct perf_event *event, | 1109 | extern u64 perf_event_read_value(struct perf_event *event, |
977 | u64 *enabled, u64 *running); | 1110 | u64 *enabled, u64 *running); |
978 | 1111 | ||
1112 | |||
979 | struct perf_sample_data { | 1113 | struct perf_sample_data { |
980 | u64 type; | 1114 | u64 type; |
981 | 1115 | ||
@@ -995,12 +1129,14 @@ struct perf_sample_data { | |||
995 | u64 period; | 1129 | u64 period; |
996 | struct perf_callchain_entry *callchain; | 1130 | struct perf_callchain_entry *callchain; |
997 | struct perf_raw_record *raw; | 1131 | struct perf_raw_record *raw; |
1132 | struct perf_branch_stack *br_stack; | ||
998 | }; | 1133 | }; |
999 | 1134 | ||
1000 | static inline void perf_sample_data_init(struct perf_sample_data *data, u64 addr) | 1135 | static inline void perf_sample_data_init(struct perf_sample_data *data, u64 addr) |
1001 | { | 1136 | { |
1002 | data->addr = addr; | 1137 | data->addr = addr; |
1003 | data->raw = NULL; | 1138 | data->raw = NULL; |
1139 | data->br_stack = NULL; | ||
1004 | } | 1140 | } |
1005 | 1141 | ||
1006 | extern void perf_output_sample(struct perf_output_handle *handle, | 1142 | extern void perf_output_sample(struct perf_output_handle *handle, |
@@ -1029,7 +1165,7 @@ static inline int is_software_event(struct perf_event *event) | |||
1029 | return event->pmu->task_ctx_nr == perf_sw_context; | 1165 | return event->pmu->task_ctx_nr == perf_sw_context; |
1030 | } | 1166 | } |
1031 | 1167 | ||
1032 | extern struct jump_label_key perf_swevent_enabled[PERF_COUNT_SW_MAX]; | 1168 | extern struct static_key perf_swevent_enabled[PERF_COUNT_SW_MAX]; |
1033 | 1169 | ||
1034 | extern void __perf_sw_event(u32, u64, struct pt_regs *, u64); | 1170 | extern void __perf_sw_event(u32, u64, struct pt_regs *, u64); |
1035 | 1171 | ||
@@ -1057,7 +1193,7 @@ perf_sw_event(u32 event_id, u64 nr, struct pt_regs *regs, u64 addr) | |||
1057 | { | 1193 | { |
1058 | struct pt_regs hot_regs; | 1194 | struct pt_regs hot_regs; |
1059 | 1195 | ||
1060 | if (static_branch(&perf_swevent_enabled[event_id])) { | 1196 | if (static_key_false(&perf_swevent_enabled[event_id])) { |
1061 | if (!regs) { | 1197 | if (!regs) { |
1062 | perf_fetch_caller_regs(&hot_regs); | 1198 | perf_fetch_caller_regs(&hot_regs); |
1063 | regs = &hot_regs; | 1199 | regs = &hot_regs; |
@@ -1066,12 +1202,12 @@ perf_sw_event(u32 event_id, u64 nr, struct pt_regs *regs, u64 addr) | |||
1066 | } | 1202 | } |
1067 | } | 1203 | } |
1068 | 1204 | ||
1069 | extern struct jump_label_key_deferred perf_sched_events; | 1205 | extern struct static_key_deferred perf_sched_events; |
1070 | 1206 | ||
1071 | static inline void perf_event_task_sched_in(struct task_struct *prev, | 1207 | static inline void perf_event_task_sched_in(struct task_struct *prev, |
1072 | struct task_struct *task) | 1208 | struct task_struct *task) |
1073 | { | 1209 | { |
1074 | if (static_branch(&perf_sched_events.key)) | 1210 | if (static_key_false(&perf_sched_events.key)) |
1075 | __perf_event_task_sched_in(prev, task); | 1211 | __perf_event_task_sched_in(prev, task); |
1076 | } | 1212 | } |
1077 | 1213 | ||
@@ -1080,7 +1216,7 @@ static inline void perf_event_task_sched_out(struct task_struct *prev, | |||
1080 | { | 1216 | { |
1081 | perf_sw_event(PERF_COUNT_SW_CONTEXT_SWITCHES, 1, NULL, 0); | 1217 | perf_sw_event(PERF_COUNT_SW_CONTEXT_SWITCHES, 1, NULL, 0); |
1082 | 1218 | ||
1083 | if (static_branch(&perf_sched_events.key)) | 1219 | if (static_key_false(&perf_sched_events.key)) |
1084 | __perf_event_task_sched_out(prev, next); | 1220 | __perf_event_task_sched_out(prev, next); |
1085 | } | 1221 | } |
1086 | 1222 | ||
@@ -1139,6 +1275,11 @@ extern void perf_bp_event(struct perf_event *event, void *data); | |||
1139 | # define perf_instruction_pointer(regs) instruction_pointer(regs) | 1275 | # define perf_instruction_pointer(regs) instruction_pointer(regs) |
1140 | #endif | 1276 | #endif |
1141 | 1277 | ||
1278 | static inline bool has_branch_stack(struct perf_event *event) | ||
1279 | { | ||
1280 | return event->attr.sample_type & PERF_SAMPLE_BRANCH_STACK; | ||
1281 | } | ||
1282 | |||
1142 | extern int perf_output_begin(struct perf_output_handle *handle, | 1283 | extern int perf_output_begin(struct perf_output_handle *handle, |
1143 | struct perf_event *event, unsigned int size); | 1284 | struct perf_event *event, unsigned int size); |
1144 | extern void perf_output_end(struct perf_output_handle *handle); | 1285 | extern void perf_output_end(struct perf_output_handle *handle); |
@@ -1207,5 +1348,18 @@ do { \ | |||
1207 | register_cpu_notifier(&fn##_nb); \ | 1348 | register_cpu_notifier(&fn##_nb); \ |
1208 | } while (0) | 1349 | } while (0) |
1209 | 1350 | ||
1351 | |||
1352 | #define PMU_FORMAT_ATTR(_name, _format) \ | ||
1353 | static ssize_t \ | ||
1354 | _name##_show(struct device *dev, \ | ||
1355 | struct device_attribute *attr, \ | ||
1356 | char *page) \ | ||
1357 | { \ | ||
1358 | BUILD_BUG_ON(sizeof(_format) >= PAGE_SIZE); \ | ||
1359 | return sprintf(page, _format "\n"); \ | ||
1360 | } \ | ||
1361 | \ | ||
1362 | static struct device_attribute format_attr_##_name = __ATTR_RO(_name) | ||
1363 | |||
1210 | #endif /* __KERNEL__ */ | 1364 | #endif /* __KERNEL__ */ |
1211 | #endif /* _LINUX_PERF_EVENT_H */ | 1365 | #endif /* _LINUX_PERF_EVENT_H */ |
diff --git a/include/linux/phy.h b/include/linux/phy.h index c599f7eca1e7..6fe0a37d4abf 100644 --- a/include/linux/phy.h +++ b/include/linux/phy.h | |||
@@ -19,7 +19,6 @@ | |||
19 | #define __PHY_H | 19 | #define __PHY_H |
20 | 20 | ||
21 | #include <linux/spinlock.h> | 21 | #include <linux/spinlock.h> |
22 | #include <linux/device.h> | ||
23 | #include <linux/ethtool.h> | 22 | #include <linux/ethtool.h> |
24 | #include <linux/mii.h> | 23 | #include <linux/mii.h> |
25 | #include <linux/timer.h> | 24 | #include <linux/timer.h> |
@@ -88,6 +87,9 @@ typedef enum { | |||
88 | IEEE 802.3ae clause 45 addressing mode used by 10GIGE phy chips. */ | 87 | IEEE 802.3ae clause 45 addressing mode used by 10GIGE phy chips. */ |
89 | #define MII_ADDR_C45 (1<<30) | 88 | #define MII_ADDR_C45 (1<<30) |
90 | 89 | ||
90 | struct device; | ||
91 | struct sk_buff; | ||
92 | |||
91 | /* | 93 | /* |
92 | * The Bus class for PHYs. Devices which provide access to | 94 | * The Bus class for PHYs. Devices which provide access to |
93 | * PHYs should register using this structure | 95 | * PHYs should register using this structure |
@@ -241,7 +243,6 @@ enum phy_state { | |||
241 | PHY_RESUMING | 243 | PHY_RESUMING |
242 | }; | 244 | }; |
243 | 245 | ||
244 | struct sk_buff; | ||
245 | 246 | ||
246 | /* phy_device: An instance of a PHY | 247 | /* phy_device: An instance of a PHY |
247 | * | 248 | * |
diff --git a/include/linux/pid_namespace.h b/include/linux/pid_namespace.h index e7cf6669ac34..b067bd8c49d0 100644 --- a/include/linux/pid_namespace.h +++ b/include/linux/pid_namespace.h | |||
@@ -2,6 +2,7 @@ | |||
2 | #define _LINUX_PID_NS_H | 2 | #define _LINUX_PID_NS_H |
3 | 3 | ||
4 | #include <linux/sched.h> | 4 | #include <linux/sched.h> |
5 | #include <linux/bug.h> | ||
5 | #include <linux/mm.h> | 6 | #include <linux/mm.h> |
6 | #include <linux/threads.h> | 7 | #include <linux/threads.h> |
7 | #include <linux/nsproxy.h> | 8 | #include <linux/nsproxy.h> |
@@ -32,6 +33,7 @@ struct pid_namespace { | |||
32 | #endif | 33 | #endif |
33 | gid_t pid_gid; | 34 | gid_t pid_gid; |
34 | int hide_pid; | 35 | int hide_pid; |
36 | int reboot; /* group exit code if this pidns was rebooted */ | ||
35 | }; | 37 | }; |
36 | 38 | ||
37 | extern struct pid_namespace init_pid_ns; | 39 | extern struct pid_namespace init_pid_ns; |
@@ -47,6 +49,7 @@ static inline struct pid_namespace *get_pid_ns(struct pid_namespace *ns) | |||
47 | extern struct pid_namespace *copy_pid_ns(unsigned long flags, struct pid_namespace *ns); | 49 | extern struct pid_namespace *copy_pid_ns(unsigned long flags, struct pid_namespace *ns); |
48 | extern void free_pid_ns(struct kref *kref); | 50 | extern void free_pid_ns(struct kref *kref); |
49 | extern void zap_pid_ns_processes(struct pid_namespace *pid_ns); | 51 | extern void zap_pid_ns_processes(struct pid_namespace *pid_ns); |
52 | extern int reboot_pid_ns(struct pid_namespace *pid_ns, int cmd); | ||
50 | 53 | ||
51 | static inline void put_pid_ns(struct pid_namespace *ns) | 54 | static inline void put_pid_ns(struct pid_namespace *ns) |
52 | { | 55 | { |
@@ -74,11 +77,15 @@ static inline void put_pid_ns(struct pid_namespace *ns) | |||
74 | { | 77 | { |
75 | } | 78 | } |
76 | 79 | ||
77 | |||
78 | static inline void zap_pid_ns_processes(struct pid_namespace *ns) | 80 | static inline void zap_pid_ns_processes(struct pid_namespace *ns) |
79 | { | 81 | { |
80 | BUG(); | 82 | BUG(); |
81 | } | 83 | } |
84 | |||
85 | static inline int reboot_pid_ns(struct pid_namespace *pid_ns, int cmd) | ||
86 | { | ||
87 | return 0; | ||
88 | } | ||
82 | #endif /* CONFIG_PID_NS */ | 89 | #endif /* CONFIG_PID_NS */ |
83 | 90 | ||
84 | extern struct pid_namespace *task_active_pid_ns(struct task_struct *tsk); | 91 | extern struct pid_namespace *task_active_pid_ns(struct task_struct *tsk); |
diff --git a/include/linux/pinctrl/consumer.h b/include/linux/pinctrl/consumer.h new file mode 100644 index 000000000000..191e72688481 --- /dev/null +++ b/include/linux/pinctrl/consumer.h | |||
@@ -0,0 +1,159 @@ | |||
1 | /* | ||
2 | * Consumer interface the pin control subsystem | ||
3 | * | ||
4 | * Copyright (C) 2012 ST-Ericsson SA | ||
5 | * Written on behalf of Linaro for ST-Ericsson | ||
6 | * Based on bits of regulator core, gpio core and clk core | ||
7 | * | ||
8 | * Author: Linus Walleij <linus.walleij@linaro.org> | ||
9 | * | ||
10 | * License terms: GNU General Public License (GPL) version 2 | ||
11 | */ | ||
12 | #ifndef __LINUX_PINCTRL_CONSUMER_H | ||
13 | #define __LINUX_PINCTRL_CONSUMER_H | ||
14 | |||
15 | #include <linux/err.h> | ||
16 | #include <linux/list.h> | ||
17 | #include <linux/seq_file.h> | ||
18 | #include "pinctrl-state.h" | ||
19 | |||
20 | /* This struct is private to the core and should be regarded as a cookie */ | ||
21 | struct pinctrl; | ||
22 | struct pinctrl_state; | ||
23 | |||
24 | #ifdef CONFIG_PINCTRL | ||
25 | |||
26 | /* External interface to pin control */ | ||
27 | extern int pinctrl_request_gpio(unsigned gpio); | ||
28 | extern void pinctrl_free_gpio(unsigned gpio); | ||
29 | extern int pinctrl_gpio_direction_input(unsigned gpio); | ||
30 | extern int pinctrl_gpio_direction_output(unsigned gpio); | ||
31 | |||
32 | extern struct pinctrl * __must_check pinctrl_get(struct device *dev); | ||
33 | extern void pinctrl_put(struct pinctrl *p); | ||
34 | extern struct pinctrl_state * __must_check pinctrl_lookup_state( | ||
35 | struct pinctrl *p, | ||
36 | const char *name); | ||
37 | extern int pinctrl_select_state(struct pinctrl *p, struct pinctrl_state *s); | ||
38 | |||
39 | #else /* !CONFIG_PINCTRL */ | ||
40 | |||
41 | static inline int pinctrl_request_gpio(unsigned gpio) | ||
42 | { | ||
43 | return 0; | ||
44 | } | ||
45 | |||
46 | static inline void pinctrl_free_gpio(unsigned gpio) | ||
47 | { | ||
48 | } | ||
49 | |||
50 | static inline int pinctrl_gpio_direction_input(unsigned gpio) | ||
51 | { | ||
52 | return 0; | ||
53 | } | ||
54 | |||
55 | static inline int pinctrl_gpio_direction_output(unsigned gpio) | ||
56 | { | ||
57 | return 0; | ||
58 | } | ||
59 | |||
60 | static inline struct pinctrl * __must_check pinctrl_get(struct device *dev) | ||
61 | { | ||
62 | return NULL; | ||
63 | } | ||
64 | |||
65 | static inline void pinctrl_put(struct pinctrl *p) | ||
66 | { | ||
67 | } | ||
68 | |||
69 | static inline struct pinctrl_state * __must_check pinctrl_lookup_state( | ||
70 | struct pinctrl *p, | ||
71 | const char *name) | ||
72 | { | ||
73 | return NULL; | ||
74 | } | ||
75 | |||
76 | static inline int pinctrl_select_state(struct pinctrl *p, | ||
77 | struct pinctrl_state *s) | ||
78 | { | ||
79 | return 0; | ||
80 | } | ||
81 | |||
82 | #endif /* CONFIG_PINCTRL */ | ||
83 | |||
84 | static inline struct pinctrl * __must_check pinctrl_get_select( | ||
85 | struct device *dev, const char *name) | ||
86 | { | ||
87 | struct pinctrl *p; | ||
88 | struct pinctrl_state *s; | ||
89 | int ret; | ||
90 | |||
91 | p = pinctrl_get(dev); | ||
92 | if (IS_ERR(p)) | ||
93 | return p; | ||
94 | |||
95 | s = pinctrl_lookup_state(p, name); | ||
96 | if (IS_ERR(s)) { | ||
97 | pinctrl_put(p); | ||
98 | return ERR_PTR(PTR_ERR(s)); | ||
99 | } | ||
100 | |||
101 | ret = pinctrl_select_state(p, s); | ||
102 | if (ret < 0) { | ||
103 | pinctrl_put(p); | ||
104 | return ERR_PTR(ret); | ||
105 | } | ||
106 | |||
107 | return p; | ||
108 | } | ||
109 | |||
110 | static inline struct pinctrl * __must_check pinctrl_get_select_default( | ||
111 | struct device *dev) | ||
112 | { | ||
113 | return pinctrl_get_select(dev, PINCTRL_STATE_DEFAULT); | ||
114 | } | ||
115 | |||
116 | #ifdef CONFIG_PINCONF | ||
117 | |||
118 | extern int pin_config_get(const char *dev_name, const char *name, | ||
119 | unsigned long *config); | ||
120 | extern int pin_config_set(const char *dev_name, const char *name, | ||
121 | unsigned long config); | ||
122 | extern int pin_config_group_get(const char *dev_name, | ||
123 | const char *pin_group, | ||
124 | unsigned long *config); | ||
125 | extern int pin_config_group_set(const char *dev_name, | ||
126 | const char *pin_group, | ||
127 | unsigned long config); | ||
128 | |||
129 | #else | ||
130 | |||
131 | static inline int pin_config_get(const char *dev_name, const char *name, | ||
132 | unsigned long *config) | ||
133 | { | ||
134 | return 0; | ||
135 | } | ||
136 | |||
137 | static inline int pin_config_set(const char *dev_name, const char *name, | ||
138 | unsigned long config) | ||
139 | { | ||
140 | return 0; | ||
141 | } | ||
142 | |||
143 | static inline int pin_config_group_get(const char *dev_name, | ||
144 | const char *pin_group, | ||
145 | unsigned long *config) | ||
146 | { | ||
147 | return 0; | ||
148 | } | ||
149 | |||
150 | static inline int pin_config_group_set(const char *dev_name, | ||
151 | const char *pin_group, | ||
152 | unsigned long config) | ||
153 | { | ||
154 | return 0; | ||
155 | } | ||
156 | |||
157 | #endif | ||
158 | |||
159 | #endif /* __LINUX_PINCTRL_CONSUMER_H */ | ||
diff --git a/include/linux/pinctrl/machine.h b/include/linux/pinctrl/machine.h index d0aecb7f6fb9..e4d1de742502 100644 --- a/include/linux/pinctrl/machine.h +++ b/include/linux/pinctrl/machine.h | |||
@@ -9,87 +9,155 @@ | |||
9 | * | 9 | * |
10 | * License terms: GNU General Public License (GPL) version 2 | 10 | * License terms: GNU General Public License (GPL) version 2 |
11 | */ | 11 | */ |
12 | #ifndef __LINUX_PINMUX_MACHINE_H | 12 | #ifndef __LINUX_PINCTRL_MACHINE_H |
13 | #define __LINUX_PINMUX_MACHINE_H | 13 | #define __LINUX_PINCTRL_MACHINE_H |
14 | |||
15 | #include <linux/bug.h> | ||
16 | |||
17 | #include "pinctrl-state.h" | ||
18 | |||
19 | enum pinctrl_map_type { | ||
20 | PIN_MAP_TYPE_INVALID, | ||
21 | PIN_MAP_TYPE_DUMMY_STATE, | ||
22 | PIN_MAP_TYPE_MUX_GROUP, | ||
23 | PIN_MAP_TYPE_CONFIGS_PIN, | ||
24 | PIN_MAP_TYPE_CONFIGS_GROUP, | ||
25 | }; | ||
26 | |||
27 | /** | ||
28 | * struct pinctrl_map_mux - mapping table content for MAP_TYPE_MUX_GROUP | ||
29 | * @group: the name of the group whose mux function is to be configured. This | ||
30 | * field may be left NULL, and the first applicable group for the function | ||
31 | * will be used. | ||
32 | * @function: the mux function to select for the group | ||
33 | */ | ||
34 | struct pinctrl_map_mux { | ||
35 | const char *group; | ||
36 | const char *function; | ||
37 | }; | ||
14 | 38 | ||
15 | /** | 39 | /** |
16 | * struct pinmux_map - boards/machines shall provide this map for devices | 40 | * struct pinctrl_map_configs - mapping table content for MAP_TYPE_CONFIGS_* |
41 | * @group_or_pin: the name of the pin or group whose configuration parameters | ||
42 | * are to be configured. | ||
43 | * @configs: a pointer to an array of config parameters/values to program into | ||
44 | * hardware. Each individual pin controller defines the format and meaning | ||
45 | * of config parameters. | ||
46 | * @num_configs: the number of entries in array @configs | ||
47 | */ | ||
48 | struct pinctrl_map_configs { | ||
49 | const char *group_or_pin; | ||
50 | unsigned long *configs; | ||
51 | unsigned num_configs; | ||
52 | }; | ||
53 | |||
54 | /** | ||
55 | * struct pinctrl_map - boards/machines shall provide this map for devices | ||
56 | * @dev_name: the name of the device using this specific mapping, the name | ||
57 | * must be the same as in your struct device*. If this name is set to the | ||
58 | * same name as the pin controllers own dev_name(), the map entry will be | ||
59 | * hogged by the driver itself upon registration | ||
17 | * @name: the name of this specific map entry for the particular machine. | 60 | * @name: the name of this specific map entry for the particular machine. |
18 | * This is the second parameter passed to pinmux_get() when you want | 61 | * This is the parameter passed to pinmux_lookup_state() |
19 | * to have several mappings to the same device | 62 | * @type: the type of mapping table entry |
20 | * @ctrl_dev: the pin control device to be used by this mapping, may be NULL | ||
21 | * if you provide .ctrl_dev_name instead (this is more common) | ||
22 | * @ctrl_dev_name: the name of the device controlling this specific mapping, | 63 | * @ctrl_dev_name: the name of the device controlling this specific mapping, |
23 | * the name must be the same as in your struct device*, may be NULL if | 64 | * the name must be the same as in your struct device*. This field is not |
24 | * you provide .ctrl_dev instead | 65 | * used for PIN_MAP_TYPE_DUMMY_STATE |
25 | * @function: a function in the driver to use for this mapping, the driver | 66 | * @data: Data specific to the mapping type |
26 | * will lookup the function referenced by this ID on the specified | ||
27 | * pin control device | ||
28 | * @group: sometimes a function can map to different pin groups, so this | ||
29 | * selects a certain specific pin group to activate for the function, if | ||
30 | * left as NULL, the first applicable group will be used | ||
31 | * @dev: the device using this specific mapping, may be NULL if you provide | ||
32 | * .dev_name instead (this is more common) | ||
33 | * @dev_name: the name of the device using this specific mapping, the name | ||
34 | * must be the same as in your struct device*, may be NULL if you | ||
35 | * provide .dev instead | ||
36 | * @hog_on_boot: if this is set to true, the pin control subsystem will itself | ||
37 | * hog the mappings as the pinmux device drivers are attached, so this is | ||
38 | * typically used with system maps (mux mappings without an assigned | ||
39 | * device) that you want to get hogged and enabled by default as soon as | ||
40 | * a pinmux device supporting it is registered. These maps will not be | ||
41 | * disabled and put until the system shuts down. | ||
42 | */ | 67 | */ |
43 | struct pinmux_map { | 68 | struct pinctrl_map { |
69 | const char *dev_name; | ||
44 | const char *name; | 70 | const char *name; |
45 | struct device *ctrl_dev; | 71 | enum pinctrl_map_type type; |
46 | const char *ctrl_dev_name; | 72 | const char *ctrl_dev_name; |
47 | const char *function; | 73 | union { |
48 | const char *group; | 74 | struct pinctrl_map_mux mux; |
49 | struct device *dev; | 75 | struct pinctrl_map_configs configs; |
50 | const char *dev_name; | 76 | } data; |
51 | bool hog_on_boot; | ||
52 | }; | 77 | }; |
53 | 78 | ||
54 | /* | 79 | /* Convenience macros to create mapping table entries */ |
55 | * Convenience macro to set a simple map from a certain pin controller and a | ||
56 | * certain function to a named device | ||
57 | */ | ||
58 | #define PINMUX_MAP(a, b, c, d) \ | ||
59 | { .name = a, .ctrl_dev_name = b, .function = c, .dev_name = d } | ||
60 | 80 | ||
61 | /* | 81 | #define PIN_MAP_DUMMY_STATE(dev, state) \ |
62 | * Convenience macro to map a system function onto a certain pinctrl device. | 82 | { \ |
63 | * System functions are not assigned to a particular device. | 83 | .dev_name = dev, \ |
64 | */ | 84 | .name = state, \ |
65 | #define PINMUX_MAP_SYS(a, b, c) \ | 85 | .type = PIN_MAP_TYPE_DUMMY_STATE, \ |
66 | { .name = a, .ctrl_dev_name = b, .function = c } | 86 | } |
67 | 87 | ||
68 | /* | 88 | #define PIN_MAP_MUX_GROUP(dev, state, pinctrl, grp, func) \ |
69 | * Convenience macro to map a system function onto a certain pinctrl device, | 89 | { \ |
70 | * to be hogged by the pinmux core until the system shuts down. | 90 | .dev_name = dev, \ |
71 | */ | 91 | .name = state, \ |
72 | #define PINMUX_MAP_SYS_HOG(a, b, c) \ | 92 | .type = PIN_MAP_TYPE_MUX_GROUP, \ |
73 | { .name = a, .ctrl_dev_name = b, .function = c, \ | 93 | .ctrl_dev_name = pinctrl, \ |
74 | .hog_on_boot = true } | 94 | .data.mux = { \ |
95 | .group = grp, \ | ||
96 | .function = func, \ | ||
97 | }, \ | ||
98 | } | ||
75 | 99 | ||
76 | /* | 100 | #define PIN_MAP_MUX_GROUP_DEFAULT(dev, pinctrl, grp, func) \ |
77 | * Convenience macro to map a system function onto a certain pinctrl device | 101 | PIN_MAP_MUX_GROUP(dev, PINCTRL_STATE_DEFAULT, pinctrl, grp, func) |
78 | * using a specified group, to be hogged by the pinmux core until the system | 102 | |
79 | * shuts down. | 103 | #define PIN_MAP_MUX_GROUP_HOG(dev, state, grp, func) \ |
80 | */ | 104 | PIN_MAP_MUX_GROUP(dev, state, dev, grp, func) |
81 | #define PINMUX_MAP_SYS_HOG_GROUP(a, b, c, d) \ | 105 | |
82 | { .name = a, .ctrl_dev_name = b, .function = c, .group = d, \ | 106 | #define PIN_MAP_MUX_GROUP_HOG_DEFAULT(dev, grp, func) \ |
83 | .hog_on_boot = true } | 107 | PIN_MAP_MUX_GROUP(dev, PINCTRL_STATE_DEFAULT, dev, grp, func) |
108 | |||
109 | #define PIN_MAP_CONFIGS_PIN(dev, state, pinctrl, pin, cfgs) \ | ||
110 | { \ | ||
111 | .dev_name = dev, \ | ||
112 | .name = state, \ | ||
113 | .type = PIN_MAP_TYPE_CONFIGS_PIN, \ | ||
114 | .ctrl_dev_name = pinctrl, \ | ||
115 | .data.configs = { \ | ||
116 | .group_or_pin = pin, \ | ||
117 | .configs = cfgs, \ | ||
118 | .num_configs = ARRAY_SIZE(cfgs), \ | ||
119 | }, \ | ||
120 | } | ||
121 | |||
122 | #define PIN_MAP_CONFIGS_PIN_DEFAULT(dev, pinctrl, pin, cfgs) \ | ||
123 | PIN_MAP_CONFIGS_PIN(dev, PINCTRL_STATE_DEFAULT, pinctrl, pin, cfgs) | ||
124 | |||
125 | #define PIN_MAP_CONFIGS_PIN_HOG(dev, state, pin, cfgs) \ | ||
126 | PIN_MAP_CONFIGS_PIN(dev, state, dev, pin, cfgs) | ||
127 | |||
128 | #define PIN_MAP_CONFIGS_PIN_HOG_DEFAULT(dev, pin, cfgs) \ | ||
129 | PIN_MAP_CONFIGS_PIN(dev, PINCTRL_STATE_DEFAULT, dev, pin, cfgs) | ||
130 | |||
131 | #define PIN_MAP_CONFIGS_GROUP(dev, state, pinctrl, grp, cfgs) \ | ||
132 | { \ | ||
133 | .dev_name = dev, \ | ||
134 | .name = state, \ | ||
135 | .type = PIN_MAP_TYPE_CONFIGS_GROUP, \ | ||
136 | .ctrl_dev_name = pinctrl, \ | ||
137 | .data.configs = { \ | ||
138 | .group_or_pin = grp, \ | ||
139 | .configs = cfgs, \ | ||
140 | .num_configs = ARRAY_SIZE(cfgs), \ | ||
141 | }, \ | ||
142 | } | ||
143 | |||
144 | #define PIN_MAP_CONFIGS_GROUP_DEFAULT(dev, pinctrl, grp, cfgs) \ | ||
145 | PIN_MAP_CONFIGS_GROUP(dev, PINCTRL_STATE_DEFAULT, pinctrl, grp, cfgs) | ||
146 | |||
147 | #define PIN_MAP_CONFIGS_GROUP_HOG(dev, state, grp, cfgs) \ | ||
148 | PIN_MAP_CONFIGS_GROUP(dev, state, dev, grp, cfgs) | ||
149 | |||
150 | #define PIN_MAP_CONFIGS_GROUP_HOG_DEFAULT(dev, grp, cfgs) \ | ||
151 | PIN_MAP_CONFIGS_GROUP(dev, PINCTRL_STATE_DEFAULT, dev, grp, cfgs) | ||
84 | 152 | ||
85 | #ifdef CONFIG_PINMUX | 153 | #ifdef CONFIG_PINCTRL |
86 | 154 | ||
87 | extern int pinmux_register_mappings(struct pinmux_map const *map, | 155 | extern int pinctrl_register_mappings(struct pinctrl_map const *map, |
88 | unsigned num_maps); | 156 | unsigned num_maps); |
89 | 157 | ||
90 | #else | 158 | #else |
91 | 159 | ||
92 | static inline int pinmux_register_mappings(struct pinmux_map const *map, | 160 | static inline int pinctrl_register_mappings(struct pinctrl_map const *map, |
93 | unsigned num_maps) | 161 | unsigned num_maps) |
94 | { | 162 | { |
95 | return 0; | 163 | return 0; |
diff --git a/include/linux/pinctrl/pinconf-generic.h b/include/linux/pinctrl/pinconf-generic.h new file mode 100644 index 000000000000..4f0abb9f1c09 --- /dev/null +++ b/include/linux/pinctrl/pinconf-generic.h | |||
@@ -0,0 +1,114 @@ | |||
1 | /* | ||
2 | * Interface the generic pinconfig portions of the pinctrl subsystem | ||
3 | * | ||
4 | * Copyright (C) 2011 ST-Ericsson SA | ||
5 | * Written on behalf of Linaro for ST-Ericsson | ||
6 | * This interface is used in the core to keep track of pins. | ||
7 | * | ||
8 | * Author: Linus Walleij <linus.walleij@linaro.org> | ||
9 | * | ||
10 | * License terms: GNU General Public License (GPL) version 2 | ||
11 | */ | ||
12 | #ifndef __LINUX_PINCTRL_PINCONF_GENERIC_H | ||
13 | #define __LINUX_PINCTRL_PINCONF_GENERIC_H | ||
14 | |||
15 | /* | ||
16 | * You shouldn't even be able to compile with these enums etc unless you're | ||
17 | * using generic pin config. That is why this is defined out. | ||
18 | */ | ||
19 | #ifdef CONFIG_GENERIC_PINCONF | ||
20 | |||
21 | /** | ||
22 | * enum pin_config_param - possible pin configuration parameters | ||
23 | * @PIN_CONFIG_BIAS_DISABLE: disable any pin bias on the pin, a | ||
24 | * transition from say pull-up to pull-down implies that you disable | ||
25 | * pull-up in the process, this setting disables all biasing. | ||
26 | * @PIN_CONFIG_BIAS_HIGH_IMPEDANCE: the pin will be set to a high impedance | ||
27 | * mode, also know as "third-state" (tristate) or "high-Z" or "floating". | ||
28 | * On output pins this effectively disconnects the pin, which is useful | ||
29 | * if for example some other pin is going to drive the signal connected | ||
30 | * to it for a while. Pins used for input are usually always high | ||
31 | * impedance. | ||
32 | * @PIN_CONFIG_BIAS_PULL_UP: the pin will be pulled up (usually with high | ||
33 | * impedance to VDD). If the argument is != 0 pull-up is enabled, | ||
34 | * if it is 0, pull-up is disabled. | ||
35 | * @PIN_CONFIG_BIAS_PULL_DOWN: the pin will be pulled down (usually with high | ||
36 | * impedance to GROUND). If the argument is != 0 pull-down is enabled, | ||
37 | * if it is 0, pull-down is disabled. | ||
38 | * @PIN_CONFIG_DRIVE_PUSH_PULL: the pin will be driven actively high and | ||
39 | * low, this is the most typical case and is typically achieved with two | ||
40 | * active transistors on the output. Sending this config will enabale | ||
41 | * push-pull mode, the argument is ignored. | ||
42 | * @PIN_CONFIG_DRIVE_OPEN_DRAIN: the pin will be driven with open drain (open | ||
43 | * collector) which means it is usually wired with other output ports | ||
44 | * which are then pulled up with an external resistor. Sending this | ||
45 | * config will enabale open drain mode, the argument is ignored. | ||
46 | * @PIN_CONFIG_DRIVE_OPEN_SOURCE: the pin will be driven with open source | ||
47 | * (open emitter). Sending this config will enabale open drain mode, the | ||
48 | * argument is ignored. | ||
49 | * @PIN_CONFIG_INPUT_SCHMITT: this will configure an input pin to run in | ||
50 | * schmitt-trigger mode. If the schmitt-trigger has adjustable hysteresis, | ||
51 | * the threshold value is given on a custom format as argument when | ||
52 | * setting pins to this mode. The argument zero turns the schmitt trigger | ||
53 | * off. | ||
54 | * @PIN_CONFIG_INPUT_DEBOUNCE: this will configure the pin to debounce mode, | ||
55 | * which means it will wait for signals to settle when reading inputs. The | ||
56 | * argument gives the debounce time on a custom format. Setting the | ||
57 | * argument to zero turns debouncing off. | ||
58 | * @PIN_CONFIG_POWER_SOURCE: if the pin can select between different power | ||
59 | * supplies, the argument to this parameter (on a custom format) tells | ||
60 | * the driver which alternative power source to use. | ||
61 | * @PIN_CONFIG_LOW_POWER_MODE: this will configure the pin for low power | ||
62 | * operation, if several modes of operation are supported these can be | ||
63 | * passed in the argument on a custom form, else just use argument 1 | ||
64 | * to indicate low power mode, argument 0 turns low power mode off. | ||
65 | * @PIN_CONFIG_END: this is the last enumerator for pin configurations, if | ||
66 | * you need to pass in custom configurations to the pin controller, use | ||
67 | * PIN_CONFIG_END+1 as the base offset. | ||
68 | */ | ||
69 | enum pin_config_param { | ||
70 | PIN_CONFIG_BIAS_DISABLE, | ||
71 | PIN_CONFIG_BIAS_HIGH_IMPEDANCE, | ||
72 | PIN_CONFIG_BIAS_PULL_UP, | ||
73 | PIN_CONFIG_BIAS_PULL_DOWN, | ||
74 | PIN_CONFIG_DRIVE_PUSH_PULL, | ||
75 | PIN_CONFIG_DRIVE_OPEN_DRAIN, | ||
76 | PIN_CONFIG_DRIVE_OPEN_SOURCE, | ||
77 | PIN_CONFIG_INPUT_SCHMITT, | ||
78 | PIN_CONFIG_INPUT_DEBOUNCE, | ||
79 | PIN_CONFIG_POWER_SOURCE, | ||
80 | PIN_CONFIG_LOW_POWER_MODE, | ||
81 | PIN_CONFIG_END = 0x7FFF, | ||
82 | }; | ||
83 | |||
84 | /* | ||
85 | * Helpful configuration macro to be used in tables etc. | ||
86 | */ | ||
87 | #define PIN_CONF_PACKED(p, a) ((a << 16) | ((unsigned long) p & 0xffffUL)) | ||
88 | |||
89 | /* | ||
90 | * The following inlines stuffs a configuration parameter and data value | ||
91 | * into and out of an unsigned long argument, as used by the generic pin config | ||
92 | * system. We put the parameter in the lower 16 bits and the argument in the | ||
93 | * upper 16 bits. | ||
94 | */ | ||
95 | |||
96 | static inline enum pin_config_param pinconf_to_config_param(unsigned long config) | ||
97 | { | ||
98 | return (enum pin_config_param) (config & 0xffffUL); | ||
99 | } | ||
100 | |||
101 | static inline u16 pinconf_to_config_argument(unsigned long config) | ||
102 | { | ||
103 | return (enum pin_config_param) ((config >> 16) & 0xffffUL); | ||
104 | } | ||
105 | |||
106 | static inline unsigned long pinconf_to_config_packed(enum pin_config_param param, | ||
107 | u16 argument) | ||
108 | { | ||
109 | return PIN_CONF_PACKED(param, argument); | ||
110 | } | ||
111 | |||
112 | #endif /* CONFIG_GENERIC_PINCONF */ | ||
113 | |||
114 | #endif /* __LINUX_PINCTRL_PINCONF_GENERIC_H */ | ||
diff --git a/include/linux/pinctrl/pinconf.h b/include/linux/pinctrl/pinconf.h index 477922cf043a..ec431f03362d 100644 --- a/include/linux/pinctrl/pinconf.h +++ b/include/linux/pinctrl/pinconf.h | |||
@@ -20,6 +20,8 @@ struct seq_file; | |||
20 | /** | 20 | /** |
21 | * struct pinconf_ops - pin config operations, to be implemented by | 21 | * struct pinconf_ops - pin config operations, to be implemented by |
22 | * pin configuration capable drivers. | 22 | * pin configuration capable drivers. |
23 | * @is_generic: for pin controllers that want to use the generic interface, | ||
24 | * this flag tells the framework that it's generic. | ||
23 | * @pin_config_get: get the config of a certain pin, if the requested config | 25 | * @pin_config_get: get the config of a certain pin, if the requested config |
24 | * is not available on this controller this should return -ENOTSUPP | 26 | * is not available on this controller this should return -ENOTSUPP |
25 | * and if it is available but disabled it should return -EINVAL | 27 | * and if it is available but disabled it should return -EINVAL |
@@ -33,6 +35,9 @@ struct seq_file; | |||
33 | * per-device info for a certain group in debugfs | 35 | * per-device info for a certain group in debugfs |
34 | */ | 36 | */ |
35 | struct pinconf_ops { | 37 | struct pinconf_ops { |
38 | #ifdef CONFIG_GENERIC_PINCONF | ||
39 | bool is_generic; | ||
40 | #endif | ||
36 | int (*pin_config_get) (struct pinctrl_dev *pctldev, | 41 | int (*pin_config_get) (struct pinctrl_dev *pctldev, |
37 | unsigned pin, | 42 | unsigned pin, |
38 | unsigned long *config); | 43 | unsigned long *config); |
@@ -53,45 +58,6 @@ struct pinconf_ops { | |||
53 | unsigned selector); | 58 | unsigned selector); |
54 | }; | 59 | }; |
55 | 60 | ||
56 | extern int pin_config_get(const char *dev_name, const char *name, | ||
57 | unsigned long *config); | ||
58 | extern int pin_config_set(const char *dev_name, const char *name, | ||
59 | unsigned long config); | ||
60 | extern int pin_config_group_get(const char *dev_name, | ||
61 | const char *pin_group, | ||
62 | unsigned long *config); | ||
63 | extern int pin_config_group_set(const char *dev_name, | ||
64 | const char *pin_group, | ||
65 | unsigned long config); | ||
66 | |||
67 | #else | ||
68 | |||
69 | static inline int pin_config_get(const char *dev_name, const char *name, | ||
70 | unsigned long *config) | ||
71 | { | ||
72 | return 0; | ||
73 | } | ||
74 | |||
75 | static inline int pin_config_set(const char *dev_name, const char *name, | ||
76 | unsigned long config) | ||
77 | { | ||
78 | return 0; | ||
79 | } | ||
80 | |||
81 | static inline int pin_config_group_get(const char *dev_name, | ||
82 | const char *pin_group, | ||
83 | unsigned long *config) | ||
84 | { | ||
85 | return 0; | ||
86 | } | ||
87 | |||
88 | static inline int pin_config_group_set(const char *dev_name, | ||
89 | const char *pin_group, | ||
90 | unsigned long config) | ||
91 | { | ||
92 | return 0; | ||
93 | } | ||
94 | |||
95 | #endif | 61 | #endif |
96 | 62 | ||
97 | #endif /* __LINUX_PINCTRL_PINCONF_H */ | 63 | #endif /* __LINUX_PINCTRL_PINCONF_H */ |
diff --git a/include/linux/pinctrl/pinctrl-state.h b/include/linux/pinctrl/pinctrl-state.h new file mode 100644 index 000000000000..3920e28b4da7 --- /dev/null +++ b/include/linux/pinctrl/pinctrl-state.h | |||
@@ -0,0 +1,6 @@ | |||
1 | /* | ||
2 | * Standard pin control state definitions | ||
3 | */ | ||
4 | |||
5 | #define PINCTRL_STATE_DEFAULT "default" | ||
6 | #define PINCTRL_STATE_IDLE "idle" | ||
diff --git a/include/linux/pinctrl/pinctrl.h b/include/linux/pinctrl/pinctrl.h index 8bd22ee7aa09..4e9f0788c221 100644 --- a/include/linux/pinctrl/pinctrl.h +++ b/include/linux/pinctrl/pinctrl.h | |||
@@ -15,10 +15,11 @@ | |||
15 | #ifdef CONFIG_PINCTRL | 15 | #ifdef CONFIG_PINCTRL |
16 | 16 | ||
17 | #include <linux/radix-tree.h> | 17 | #include <linux/radix-tree.h> |
18 | #include <linux/spinlock.h> | ||
19 | #include <linux/list.h> | 18 | #include <linux/list.h> |
20 | #include <linux/seq_file.h> | 19 | #include <linux/seq_file.h> |
20 | #include "pinctrl-state.h" | ||
21 | 21 | ||
22 | struct device; | ||
22 | struct pinctrl_dev; | 23 | struct pinctrl_dev; |
23 | struct pinmux_ops; | 24 | struct pinmux_ops; |
24 | struct pinconf_ops; | 25 | struct pinconf_ops; |
diff --git a/include/linux/pinctrl/pinmux.h b/include/linux/pinctrl/pinmux.h index 937b3e2fa36f..47e9237edd47 100644 --- a/include/linux/pinctrl/pinmux.h +++ b/include/linux/pinctrl/pinmux.h | |||
@@ -16,9 +16,6 @@ | |||
16 | #include <linux/seq_file.h> | 16 | #include <linux/seq_file.h> |
17 | #include "pinctrl.h" | 17 | #include "pinctrl.h" |
18 | 18 | ||
19 | /* This struct is private to the core and should be regarded as a cookie */ | ||
20 | struct pinmux; | ||
21 | |||
22 | #ifdef CONFIG_PINMUX | 19 | #ifdef CONFIG_PINMUX |
23 | 20 | ||
24 | struct pinctrl_dev; | 21 | struct pinctrl_dev; |
@@ -88,55 +85,6 @@ struct pinmux_ops { | |||
88 | bool input); | 85 | bool input); |
89 | }; | 86 | }; |
90 | 87 | ||
91 | /* External interface to pinmux */ | ||
92 | extern int pinmux_request_gpio(unsigned gpio); | ||
93 | extern void pinmux_free_gpio(unsigned gpio); | ||
94 | extern int pinmux_gpio_direction_input(unsigned gpio); | ||
95 | extern int pinmux_gpio_direction_output(unsigned gpio); | ||
96 | extern struct pinmux * __must_check pinmux_get(struct device *dev, const char *name); | ||
97 | extern void pinmux_put(struct pinmux *pmx); | ||
98 | extern int pinmux_enable(struct pinmux *pmx); | ||
99 | extern void pinmux_disable(struct pinmux *pmx); | ||
100 | |||
101 | #else /* !CONFIG_PINMUX */ | ||
102 | |||
103 | static inline int pinmux_request_gpio(unsigned gpio) | ||
104 | { | ||
105 | return 0; | ||
106 | } | ||
107 | |||
108 | static inline void pinmux_free_gpio(unsigned gpio) | ||
109 | { | ||
110 | } | ||
111 | |||
112 | static inline int pinmux_gpio_direction_input(unsigned gpio) | ||
113 | { | ||
114 | return 0; | ||
115 | } | ||
116 | |||
117 | static inline int pinmux_gpio_direction_output(unsigned gpio) | ||
118 | { | ||
119 | return 0; | ||
120 | } | ||
121 | |||
122 | static inline struct pinmux * __must_check pinmux_get(struct device *dev, const char *name) | ||
123 | { | ||
124 | return NULL; | ||
125 | } | ||
126 | |||
127 | static inline void pinmux_put(struct pinmux *pmx) | ||
128 | { | ||
129 | } | ||
130 | |||
131 | static inline int pinmux_enable(struct pinmux *pmx) | ||
132 | { | ||
133 | return 0; | ||
134 | } | ||
135 | |||
136 | static inline void pinmux_disable(struct pinmux *pmx) | ||
137 | { | ||
138 | } | ||
139 | |||
140 | #endif /* CONFIG_PINMUX */ | 88 | #endif /* CONFIG_PINMUX */ |
141 | 89 | ||
142 | #endif /* __LINUX_PINCTRL_PINMUX_H */ | 90 | #endif /* __LINUX_PINCTRL_PINMUX_H */ |
diff --git a/include/linux/pipe_fs_i.h b/include/linux/pipe_fs_i.h index 77257c92155a..6d626ff0cfd0 100644 --- a/include/linux/pipe_fs_i.h +++ b/include/linux/pipe_fs_i.h | |||
@@ -1,8 +1,6 @@ | |||
1 | #ifndef _LINUX_PIPE_FS_I_H | 1 | #ifndef _LINUX_PIPE_FS_I_H |
2 | #define _LINUX_PIPE_FS_I_H | 2 | #define _LINUX_PIPE_FS_I_H |
3 | 3 | ||
4 | #define PIPEFS_MAGIC 0x50495045 | ||
5 | |||
6 | #define PIPE_DEF_BUFFERS 16 | 4 | #define PIPE_DEF_BUFFERS 16 |
7 | 5 | ||
8 | #define PIPE_BUF_FLAG_LRU 0x01 /* page is on the LRU */ | 6 | #define PIPE_BUF_FLAG_LRU 0x01 /* page is on the LRU */ |
diff --git a/include/linux/pkt_sched.h b/include/linux/pkt_sched.h index 0d5b79365d03..410b33d014d2 100644 --- a/include/linux/pkt_sched.h +++ b/include/linux/pkt_sched.h | |||
@@ -127,6 +127,27 @@ struct tc_multiq_qopt { | |||
127 | __u16 max_bands; /* Maximum number of queues */ | 127 | __u16 max_bands; /* Maximum number of queues */ |
128 | }; | 128 | }; |
129 | 129 | ||
130 | /* PLUG section */ | ||
131 | |||
132 | #define TCQ_PLUG_BUFFER 0 | ||
133 | #define TCQ_PLUG_RELEASE_ONE 1 | ||
134 | #define TCQ_PLUG_RELEASE_INDEFINITE 2 | ||
135 | #define TCQ_PLUG_LIMIT 3 | ||
136 | |||
137 | struct tc_plug_qopt { | ||
138 | /* TCQ_PLUG_BUFFER: Inset a plug into the queue and | ||
139 | * buffer any incoming packets | ||
140 | * TCQ_PLUG_RELEASE_ONE: Dequeue packets from queue head | ||
141 | * to beginning of the next plug. | ||
142 | * TCQ_PLUG_RELEASE_INDEFINITE: Dequeue all packets from queue. | ||
143 | * Stop buffering packets until the next TCQ_PLUG_BUFFER | ||
144 | * command is received (just act as a pass-thru queue). | ||
145 | * TCQ_PLUG_LIMIT: Increase/decrease queue size | ||
146 | */ | ||
147 | int action; | ||
148 | __u32 limit; | ||
149 | }; | ||
150 | |||
130 | /* TBF section */ | 151 | /* TBF section */ |
131 | 152 | ||
132 | struct tc_tbf_qopt { | 153 | struct tc_tbf_qopt { |
diff --git a/include/linux/platform_data/atmel.h b/include/linux/platform_data/atmel.h new file mode 100644 index 000000000000..b0f2c56a8ea2 --- /dev/null +++ b/include/linux/platform_data/atmel.h | |||
@@ -0,0 +1,27 @@ | |||
1 | /* | ||
2 | * atmel platform data | ||
3 | * | ||
4 | * GPL v2 Only | ||
5 | */ | ||
6 | |||
7 | #ifndef __ATMEL_H__ | ||
8 | #define __ATMEL_H__ | ||
9 | |||
10 | #include <linux/mtd/nand.h> | ||
11 | |||
12 | /* NAND / SmartMedia */ | ||
13 | struct atmel_nand_data { | ||
14 | int enable_pin; /* chip enable */ | ||
15 | int det_pin; /* card detect */ | ||
16 | int rdy_pin; /* ready/busy */ | ||
17 | u8 rdy_pin_active_low; /* rdy_pin value is inverted */ | ||
18 | u8 ale; /* address line number connected to ALE */ | ||
19 | u8 cle; /* address line number connected to CLE */ | ||
20 | u8 bus_width_16; /* buswidth is 16 bit */ | ||
21 | u8 ecc_mode; /* ecc mode */ | ||
22 | u8 on_flash_bbt; /* bbt on flash */ | ||
23 | struct mtd_partition *parts; | ||
24 | unsigned int num_parts; | ||
25 | }; | ||
26 | |||
27 | #endif /* __ATMEL_H__ */ | ||
diff --git a/include/linux/platform_data/cpsw.h b/include/linux/platform_data/cpsw.h new file mode 100644 index 000000000000..c4e23d029498 --- /dev/null +++ b/include/linux/platform_data/cpsw.h | |||
@@ -0,0 +1,55 @@ | |||
1 | /* | ||
2 | * Texas Instruments Ethernet Switch Driver | ||
3 | * | ||
4 | * Copyright (C) 2012 Texas Instruments | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or | ||
7 | * modify it under the terms of the GNU General Public License as | ||
8 | * published by the Free Software Foundation version 2. | ||
9 | * | ||
10 | * This program is distributed "as is" WITHOUT ANY WARRANTY of any | ||
11 | * kind, whether express or implied; without even the implied warranty | ||
12 | * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | * GNU General Public License for more details. | ||
14 | */ | ||
15 | #ifndef __CPSW_H__ | ||
16 | #define __CPSW_H__ | ||
17 | |||
18 | #include <linux/if_ether.h> | ||
19 | |||
20 | struct cpsw_slave_data { | ||
21 | u32 slave_reg_ofs; | ||
22 | u32 sliver_reg_ofs; | ||
23 | const char *phy_id; | ||
24 | int phy_if; | ||
25 | u8 mac_addr[ETH_ALEN]; | ||
26 | }; | ||
27 | |||
28 | struct cpsw_platform_data { | ||
29 | u32 ss_reg_ofs; /* Subsystem control register offset */ | ||
30 | u32 channels; /* number of cpdma channels (symmetric) */ | ||
31 | u32 cpdma_reg_ofs; /* cpdma register offset */ | ||
32 | u32 cpdma_sram_ofs; /* cpdma sram offset */ | ||
33 | |||
34 | u32 slaves; /* number of slave cpgmac ports */ | ||
35 | struct cpsw_slave_data *slave_data; | ||
36 | |||
37 | u32 ale_reg_ofs; /* address lookup engine reg offset */ | ||
38 | u32 ale_entries; /* ale table size */ | ||
39 | |||
40 | u32 host_port_reg_ofs; /* cpsw cpdma host port registers */ | ||
41 | u32 host_port_num; /* The port number for the host port */ | ||
42 | |||
43 | u32 hw_stats_reg_ofs; /* cpsw hardware statistics counters */ | ||
44 | |||
45 | u32 bd_ram_ofs; /* embedded buffer descriptor RAM offset*/ | ||
46 | u32 bd_ram_size; /*buffer descriptor ram size */ | ||
47 | u32 hw_ram_addr; /*if the HW address for BD RAM is different */ | ||
48 | bool no_bd_ram; /* no embedded BD ram*/ | ||
49 | |||
50 | u32 rx_descs; /* Number of Rx Descriptios */ | ||
51 | |||
52 | u32 mac_control; /* Mac control register */ | ||
53 | }; | ||
54 | |||
55 | #endif /* __CPSW_H__ */ | ||
diff --git a/include/linux/platform_data/dwc3-exynos.h b/include/linux/platform_data/dwc3-exynos.h new file mode 100644 index 000000000000..5eb7da9b3772 --- /dev/null +++ b/include/linux/platform_data/dwc3-exynos.h | |||
@@ -0,0 +1,24 @@ | |||
1 | /** | ||
2 | * dwc3-exynos.h - Samsung EXYNOS DWC3 Specific Glue layer, header. | ||
3 | * | ||
4 | * Copyright (c) 2012 Samsung Electronics Co., Ltd. | ||
5 | * http://www.samsung.com | ||
6 | * | ||
7 | * Author: Anton Tikhomirov <av.tikhomirov@samsung.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; either version 2 of the License, or | ||
12 | * (at your option) any later version. | ||
13 | */ | ||
14 | |||
15 | #ifndef _DWC3_EXYNOS_H_ | ||
16 | #define _DWC3_EXYNOS_H_ | ||
17 | |||
18 | struct dwc3_exynos_data { | ||
19 | int phy_type; | ||
20 | int (*phy_init)(struct platform_device *pdev, int type); | ||
21 | int (*phy_exit)(struct platform_device *pdev, int type); | ||
22 | }; | ||
23 | |||
24 | #endif /* _DWC3_EXYNOS_H_ */ | ||
diff --git a/include/linux/platform_data/efm32-uart.h b/include/linux/platform_data/efm32-uart.h new file mode 100644 index 000000000000..ed0e975b3c54 --- /dev/null +++ b/include/linux/platform_data/efm32-uart.h | |||
@@ -0,0 +1,18 @@ | |||
1 | /* | ||
2 | * | ||
3 | * | ||
4 | */ | ||
5 | #ifndef __LINUX_PLATFORM_DATA_EFM32_UART_H__ | ||
6 | #define __LINUX_PLATFORM_DATA_EFM32_UART_H__ | ||
7 | |||
8 | #include <linux/types.h> | ||
9 | |||
10 | /** | ||
11 | * struct efm32_uart_pdata | ||
12 | * @location: pinmux location for the I/O pins (to be written to the ROUTE | ||
13 | * register) | ||
14 | */ | ||
15 | struct efm32_uart_pdata { | ||
16 | u8 location; | ||
17 | }; | ||
18 | #endif /* ifndef __LINUX_PLATFORM_DATA_EFM32_UART_H__ */ | ||
diff --git a/include/linux/platform_data/omap-abe-twl6040.h b/include/linux/platform_data/omap-abe-twl6040.h new file mode 100644 index 000000000000..5d298ac10fc2 --- /dev/null +++ b/include/linux/platform_data/omap-abe-twl6040.h | |||
@@ -0,0 +1,49 @@ | |||
1 | /** | ||
2 | * omap-abe-twl6040.h - ASoC machine driver OMAP4+ devices, header. | ||
3 | * | ||
4 | * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com | ||
5 | * All rights reserved. | ||
6 | * | ||
7 | * Author: Peter Ujfalusi <peter.ujfalusi@ti.com> | ||
8 | * | ||
9 | * This program is free software; you can redistribute it and/or | ||
10 | * modify it under the terms of the GNU General Public License | ||
11 | * version 2 as published by the Free Software Foundation. | ||
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 | * 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., 51 Franklin St, Fifth Floor, Boston, MA | ||
21 | * 02110-1301 USA | ||
22 | */ | ||
23 | |||
24 | #ifndef _OMAP_ABE_TWL6040_H_ | ||
25 | #define _OMAP_ABE_TWL6040_H_ | ||
26 | |||
27 | /* To select if only one channel is connected in a stereo port */ | ||
28 | #define ABE_TWL6040_LEFT (1 << 0) | ||
29 | #define ABE_TWL6040_RIGHT (1 << 1) | ||
30 | |||
31 | struct omap_abe_twl6040_data { | ||
32 | char *card_name; | ||
33 | /* Feature flags for connected audio pins */ | ||
34 | u8 has_hs; | ||
35 | u8 has_hf; | ||
36 | bool has_ep; | ||
37 | u8 has_aux; | ||
38 | u8 has_vibra; | ||
39 | bool has_dmic; | ||
40 | bool has_hsmic; | ||
41 | bool has_mainmic; | ||
42 | bool has_submic; | ||
43 | u8 has_afm; | ||
44 | /* Other features */ | ||
45 | bool jack_detection; /* board can detect jack events */ | ||
46 | int mclk_freq; /* MCLK frequency speed for twl6040 */ | ||
47 | }; | ||
48 | |||
49 | #endif /* _OMAP_ABE_TWL6040_H_ */ | ||
diff --git a/include/linux/platform_data/spear_thermal.h b/include/linux/platform_data/spear_thermal.h new file mode 100644 index 000000000000..724f2e1cbbcb --- /dev/null +++ b/include/linux/platform_data/spear_thermal.h | |||
@@ -0,0 +1,26 @@ | |||
1 | /* | ||
2 | * SPEAr thermal driver platform data. | ||
3 | * | ||
4 | * Copyright (C) 2011-2012 ST Microelectronics | ||
5 | * Author: Vincenzo Frascino <vincenzo.frascino@st.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 | #ifndef SPEAR_THERMAL_H | ||
18 | #define SPEAR_THERMAL_H | ||
19 | |||
20 | /* SPEAr Thermal Sensor Platform Data */ | ||
21 | struct spear_thermal_pdata { | ||
22 | /* flags used to enable thermal sensor */ | ||
23 | unsigned int thermal_flags; | ||
24 | }; | ||
25 | |||
26 | #endif /* SPEAR_THERMAL_H */ | ||
diff --git a/include/linux/platform_data/tegra_emc.h b/include/linux/platform_data/tegra_emc.h new file mode 100644 index 000000000000..df67505e98f8 --- /dev/null +++ b/include/linux/platform_data/tegra_emc.h | |||
@@ -0,0 +1,34 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2011 Google, Inc. | ||
3 | * | ||
4 | * Author: | ||
5 | * Colin Cross <ccross@android.com> | ||
6 | * Olof Johansson <olof@lixom.net> | ||
7 | * | ||
8 | * This software is licensed under the terms of the GNU General Public | ||
9 | * License version 2, as published by the Free Software Foundation, and | ||
10 | * may be copied, distributed, and modified under those terms. | ||
11 | * | ||
12 | * This program is distributed in the hope that it will be useful, | ||
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
15 | * GNU General Public License for more details. | ||
16 | * | ||
17 | */ | ||
18 | |||
19 | #ifndef __TEGRA_EMC_H_ | ||
20 | #define __TEGRA_EMC_H_ | ||
21 | |||
22 | #define TEGRA_EMC_NUM_REGS 46 | ||
23 | |||
24 | struct tegra_emc_table { | ||
25 | unsigned long rate; | ||
26 | u32 regs[TEGRA_EMC_NUM_REGS]; | ||
27 | }; | ||
28 | |||
29 | struct tegra_emc_pdata { | ||
30 | int num_tables; | ||
31 | struct tegra_emc_table *tables; | ||
32 | }; | ||
33 | |||
34 | #endif | ||
diff --git a/include/linux/pm.h b/include/linux/pm.h index e4982ac3fbbc..715305e05123 100644 --- a/include/linux/pm.h +++ b/include/linux/pm.h | |||
@@ -110,6 +110,10 @@ typedef struct pm_message { | |||
110 | * Subsystem-level @suspend() is executed for all devices after invoking | 110 | * Subsystem-level @suspend() is executed for all devices after invoking |
111 | * subsystem-level @prepare() for all of them. | 111 | * subsystem-level @prepare() for all of them. |
112 | * | 112 | * |
113 | * @suspend_late: Continue operations started by @suspend(). For a number of | ||
114 | * devices @suspend_late() may point to the same callback routine as the | ||
115 | * runtime suspend callback. | ||
116 | * | ||
113 | * @resume: Executed after waking the system up from a sleep state in which the | 117 | * @resume: Executed after waking the system up from a sleep state in which the |
114 | * contents of main memory were preserved. The exact action to perform | 118 | * contents of main memory were preserved. The exact action to perform |
115 | * depends on the device's subsystem, but generally the driver is expected | 119 | * depends on the device's subsystem, but generally the driver is expected |
@@ -122,6 +126,10 @@ typedef struct pm_message { | |||
122 | * Subsystem-level @resume() is executed for all devices after invoking | 126 | * Subsystem-level @resume() is executed for all devices after invoking |
123 | * subsystem-level @resume_noirq() for all of them. | 127 | * subsystem-level @resume_noirq() for all of them. |
124 | * | 128 | * |
129 | * @resume_early: Prepare to execute @resume(). For a number of devices | ||
130 | * @resume_early() may point to the same callback routine as the runtime | ||
131 | * resume callback. | ||
132 | * | ||
125 | * @freeze: Hibernation-specific, executed before creating a hibernation image. | 133 | * @freeze: Hibernation-specific, executed before creating a hibernation image. |
126 | * Analogous to @suspend(), but it should not enable the device to signal | 134 | * Analogous to @suspend(), but it should not enable the device to signal |
127 | * wakeup events or change its power state. The majority of subsystems | 135 | * wakeup events or change its power state. The majority of subsystems |
@@ -131,6 +139,10 @@ typedef struct pm_message { | |||
131 | * Subsystem-level @freeze() is executed for all devices after invoking | 139 | * Subsystem-level @freeze() is executed for all devices after invoking |
132 | * subsystem-level @prepare() for all of them. | 140 | * subsystem-level @prepare() for all of them. |
133 | * | 141 | * |
142 | * @freeze_late: Continue operations started by @freeze(). Analogous to | ||
143 | * @suspend_late(), but it should not enable the device to signal wakeup | ||
144 | * events or change its power state. | ||
145 | * | ||
134 | * @thaw: Hibernation-specific, executed after creating a hibernation image OR | 146 | * @thaw: Hibernation-specific, executed after creating a hibernation image OR |
135 | * if the creation of an image has failed. Also executed after a failing | 147 | * if the creation of an image has failed. Also executed after a failing |
136 | * attempt to restore the contents of main memory from such an image. | 148 | * attempt to restore the contents of main memory from such an image. |
@@ -140,15 +152,23 @@ typedef struct pm_message { | |||
140 | * subsystem-level @thaw_noirq() for all of them. It also may be executed | 152 | * subsystem-level @thaw_noirq() for all of them. It also may be executed |
141 | * directly after @freeze() in case of a transition error. | 153 | * directly after @freeze() in case of a transition error. |
142 | * | 154 | * |
155 | * @thaw_early: Prepare to execute @thaw(). Undo the changes made by the | ||
156 | * preceding @freeze_late(). | ||
157 | * | ||
143 | * @poweroff: Hibernation-specific, executed after saving a hibernation image. | 158 | * @poweroff: Hibernation-specific, executed after saving a hibernation image. |
144 | * Analogous to @suspend(), but it need not save the device's settings in | 159 | * Analogous to @suspend(), but it need not save the device's settings in |
145 | * memory. | 160 | * memory. |
146 | * Subsystem-level @poweroff() is executed for all devices after invoking | 161 | * Subsystem-level @poweroff() is executed for all devices after invoking |
147 | * subsystem-level @prepare() for all of them. | 162 | * subsystem-level @prepare() for all of them. |
148 | * | 163 | * |
164 | * @poweroff_late: Continue operations started by @poweroff(). Analogous to | ||
165 | * @suspend_late(), but it need not save the device's settings in memory. | ||
166 | * | ||
149 | * @restore: Hibernation-specific, executed after restoring the contents of main | 167 | * @restore: Hibernation-specific, executed after restoring the contents of main |
150 | * memory from a hibernation image, analogous to @resume(). | 168 | * memory from a hibernation image, analogous to @resume(). |
151 | * | 169 | * |
170 | * @restore_early: Prepare to execute @restore(), analogous to @resume_early(). | ||
171 | * | ||
152 | * @suspend_noirq: Complete the actions started by @suspend(). Carry out any | 172 | * @suspend_noirq: Complete the actions started by @suspend(). Carry out any |
153 | * additional operations required for suspending the device that might be | 173 | * additional operations required for suspending the device that might be |
154 | * racing with its driver's interrupt handler, which is guaranteed not to | 174 | * racing with its driver's interrupt handler, which is guaranteed not to |
@@ -158,9 +178,10 @@ typedef struct pm_message { | |||
158 | * @suspend_noirq() has returned successfully. If the device can generate | 178 | * @suspend_noirq() has returned successfully. If the device can generate |
159 | * system wakeup signals and is enabled to wake up the system, it should be | 179 | * system wakeup signals and is enabled to wake up the system, it should be |
160 | * configured to do so at that time. However, depending on the platform | 180 | * configured to do so at that time. However, depending on the platform |
161 | * and device's subsystem, @suspend() may be allowed to put the device into | 181 | * and device's subsystem, @suspend() or @suspend_late() may be allowed to |
162 | * the low-power state and configure it to generate wakeup signals, in | 182 | * put the device into the low-power state and configure it to generate |
163 | * which case it generally is not necessary to define @suspend_noirq(). | 183 | * wakeup signals, in which case it generally is not necessary to define |
184 | * @suspend_noirq(). | ||
164 | * | 185 | * |
165 | * @resume_noirq: Prepare for the execution of @resume() by carrying out any | 186 | * @resume_noirq: Prepare for the execution of @resume() by carrying out any |
166 | * operations required for resuming the device that might be racing with | 187 | * operations required for resuming the device that might be racing with |
@@ -171,9 +192,9 @@ typedef struct pm_message { | |||
171 | * additional operations required for freezing the device that might be | 192 | * additional operations required for freezing the device that might be |
172 | * racing with its driver's interrupt handler, which is guaranteed not to | 193 | * racing with its driver's interrupt handler, which is guaranteed not to |
173 | * run while @freeze_noirq() is being executed. | 194 | * run while @freeze_noirq() is being executed. |
174 | * The power state of the device should not be changed by either @freeze() | 195 | * The power state of the device should not be changed by either @freeze(), |
175 | * or @freeze_noirq() and it should not be configured to signal system | 196 | * or @freeze_late(), or @freeze_noirq() and it should not be configured to |
176 | * wakeup by any of these callbacks. | 197 | * signal system wakeup by any of these callbacks. |
177 | * | 198 | * |
178 | * @thaw_noirq: Prepare for the execution of @thaw() by carrying out any | 199 | * @thaw_noirq: Prepare for the execution of @thaw() by carrying out any |
179 | * operations required for thawing the device that might be racing with its | 200 | * operations required for thawing the device that might be racing with its |
@@ -249,6 +270,12 @@ struct dev_pm_ops { | |||
249 | int (*thaw)(struct device *dev); | 270 | int (*thaw)(struct device *dev); |
250 | int (*poweroff)(struct device *dev); | 271 | int (*poweroff)(struct device *dev); |
251 | int (*restore)(struct device *dev); | 272 | int (*restore)(struct device *dev); |
273 | int (*suspend_late)(struct device *dev); | ||
274 | int (*resume_early)(struct device *dev); | ||
275 | int (*freeze_late)(struct device *dev); | ||
276 | int (*thaw_early)(struct device *dev); | ||
277 | int (*poweroff_late)(struct device *dev); | ||
278 | int (*restore_early)(struct device *dev); | ||
252 | int (*suspend_noirq)(struct device *dev); | 279 | int (*suspend_noirq)(struct device *dev); |
253 | int (*resume_noirq)(struct device *dev); | 280 | int (*resume_noirq)(struct device *dev); |
254 | int (*freeze_noirq)(struct device *dev); | 281 | int (*freeze_noirq)(struct device *dev); |
@@ -293,6 +320,15 @@ const struct dev_pm_ops name = { \ | |||
293 | /* | 320 | /* |
294 | * Use this for defining a set of PM operations to be used in all situations | 321 | * Use this for defining a set of PM operations to be used in all situations |
295 | * (sustem suspend, hibernation or runtime PM). | 322 | * (sustem suspend, hibernation or runtime PM). |
323 | * NOTE: In general, system suspend callbacks, .suspend() and .resume(), should | ||
324 | * be different from the corresponding runtime PM callbacks, .runtime_suspend(), | ||
325 | * and .runtime_resume(), because .runtime_suspend() always works on an already | ||
326 | * quiescent device, while .suspend() should assume that the device may be doing | ||
327 | * something when it is called (it should ensure that the device will be | ||
328 | * quiescent after it has returned). Therefore it's better to point the "late" | ||
329 | * suspend and "early" resume callback pointers, .suspend_late() and | ||
330 | * .resume_early(), to the same routines as .runtime_suspend() and | ||
331 | * .runtime_resume(), respectively (and analogously for hibernation). | ||
296 | */ | 332 | */ |
297 | #define UNIVERSAL_DEV_PM_OPS(name, suspend_fn, resume_fn, idle_fn) \ | 333 | #define UNIVERSAL_DEV_PM_OPS(name, suspend_fn, resume_fn, idle_fn) \ |
298 | const struct dev_pm_ops name = { \ | 334 | const struct dev_pm_ops name = { \ |
@@ -510,6 +546,7 @@ struct dev_pm_info { | |||
510 | unsigned long accounting_timestamp; | 546 | unsigned long accounting_timestamp; |
511 | ktime_t suspend_time; | 547 | ktime_t suspend_time; |
512 | s64 max_time_suspended_ns; | 548 | s64 max_time_suspended_ns; |
549 | struct dev_pm_qos_request *pq_req; | ||
513 | #endif | 550 | #endif |
514 | struct pm_subsys_data *subsys_data; /* Owned by the subsystem. */ | 551 | struct pm_subsys_data *subsys_data; /* Owned by the subsystem. */ |
515 | struct pm_qos_constraints *constraints; | 552 | struct pm_qos_constraints *constraints; |
@@ -584,13 +621,13 @@ struct dev_pm_domain { | |||
584 | 621 | ||
585 | #ifdef CONFIG_PM_SLEEP | 622 | #ifdef CONFIG_PM_SLEEP |
586 | extern void device_pm_lock(void); | 623 | extern void device_pm_lock(void); |
587 | extern void dpm_resume_noirq(pm_message_t state); | 624 | extern void dpm_resume_start(pm_message_t state); |
588 | extern void dpm_resume_end(pm_message_t state); | 625 | extern void dpm_resume_end(pm_message_t state); |
589 | extern void dpm_resume(pm_message_t state); | 626 | extern void dpm_resume(pm_message_t state); |
590 | extern void dpm_complete(pm_message_t state); | 627 | extern void dpm_complete(pm_message_t state); |
591 | 628 | ||
592 | extern void device_pm_unlock(void); | 629 | extern void device_pm_unlock(void); |
593 | extern int dpm_suspend_noirq(pm_message_t state); | 630 | extern int dpm_suspend_end(pm_message_t state); |
594 | extern int dpm_suspend_start(pm_message_t state); | 631 | extern int dpm_suspend_start(pm_message_t state); |
595 | extern int dpm_suspend(pm_message_t state); | 632 | extern int dpm_suspend(pm_message_t state); |
596 | extern int dpm_prepare(pm_message_t state); | 633 | extern int dpm_prepare(pm_message_t state); |
@@ -605,17 +642,23 @@ extern void __suspend_report_result(const char *function, void *fn, int ret); | |||
605 | extern int device_pm_wait_for_dev(struct device *sub, struct device *dev); | 642 | extern int device_pm_wait_for_dev(struct device *sub, struct device *dev); |
606 | 643 | ||
607 | extern int pm_generic_prepare(struct device *dev); | 644 | extern int pm_generic_prepare(struct device *dev); |
645 | extern int pm_generic_suspend_late(struct device *dev); | ||
608 | extern int pm_generic_suspend_noirq(struct device *dev); | 646 | extern int pm_generic_suspend_noirq(struct device *dev); |
609 | extern int pm_generic_suspend(struct device *dev); | 647 | extern int pm_generic_suspend(struct device *dev); |
648 | extern int pm_generic_resume_early(struct device *dev); | ||
610 | extern int pm_generic_resume_noirq(struct device *dev); | 649 | extern int pm_generic_resume_noirq(struct device *dev); |
611 | extern int pm_generic_resume(struct device *dev); | 650 | extern int pm_generic_resume(struct device *dev); |
612 | extern int pm_generic_freeze_noirq(struct device *dev); | 651 | extern int pm_generic_freeze_noirq(struct device *dev); |
652 | extern int pm_generic_freeze_late(struct device *dev); | ||
613 | extern int pm_generic_freeze(struct device *dev); | 653 | extern int pm_generic_freeze(struct device *dev); |
614 | extern int pm_generic_thaw_noirq(struct device *dev); | 654 | extern int pm_generic_thaw_noirq(struct device *dev); |
655 | extern int pm_generic_thaw_early(struct device *dev); | ||
615 | extern int pm_generic_thaw(struct device *dev); | 656 | extern int pm_generic_thaw(struct device *dev); |
616 | extern int pm_generic_restore_noirq(struct device *dev); | 657 | extern int pm_generic_restore_noirq(struct device *dev); |
658 | extern int pm_generic_restore_early(struct device *dev); | ||
617 | extern int pm_generic_restore(struct device *dev); | 659 | extern int pm_generic_restore(struct device *dev); |
618 | extern int pm_generic_poweroff_noirq(struct device *dev); | 660 | extern int pm_generic_poweroff_noirq(struct device *dev); |
661 | extern int pm_generic_poweroff_late(struct device *dev); | ||
619 | extern int pm_generic_poweroff(struct device *dev); | 662 | extern int pm_generic_poweroff(struct device *dev); |
620 | extern void pm_generic_complete(struct device *dev); | 663 | extern void pm_generic_complete(struct device *dev); |
621 | 664 | ||
diff --git a/include/linux/pm_domain.h b/include/linux/pm_domain.h index a03a0ad998b8..91f8286106ea 100644 --- a/include/linux/pm_domain.h +++ b/include/linux/pm_domain.h | |||
@@ -10,7 +10,10 @@ | |||
10 | #define _LINUX_PM_DOMAIN_H | 10 | #define _LINUX_PM_DOMAIN_H |
11 | 11 | ||
12 | #include <linux/device.h> | 12 | #include <linux/device.h> |
13 | #include <linux/mutex.h> | ||
14 | #include <linux/pm.h> | ||
13 | #include <linux/err.h> | 15 | #include <linux/err.h> |
16 | #include <linux/of.h> | ||
14 | 17 | ||
15 | enum gpd_status { | 18 | enum gpd_status { |
16 | GPD_STATE_ACTIVE = 0, /* PM domain is active */ | 19 | GPD_STATE_ACTIVE = 0, /* PM domain is active */ |
@@ -70,6 +73,7 @@ struct generic_pm_domain { | |||
70 | s64 break_even_ns; /* Power break even for the entire domain. */ | 73 | s64 break_even_ns; /* Power break even for the entire domain. */ |
71 | s64 max_off_time_ns; /* Maximum allowed "suspended" time. */ | 74 | s64 max_off_time_ns; /* Maximum allowed "suspended" time. */ |
72 | ktime_t power_off_time; | 75 | ktime_t power_off_time; |
76 | struct device_node *of_node; /* Node in device tree */ | ||
73 | }; | 77 | }; |
74 | 78 | ||
75 | static inline struct generic_pm_domain *pd_to_genpd(struct dev_pm_domain *pd) | 79 | static inline struct generic_pm_domain *pd_to_genpd(struct dev_pm_domain *pd) |
@@ -97,14 +101,15 @@ struct generic_pm_domain_data { | |||
97 | struct gpd_dev_ops ops; | 101 | struct gpd_dev_ops ops; |
98 | struct gpd_timing_data td; | 102 | struct gpd_timing_data td; |
99 | bool need_restore; | 103 | bool need_restore; |
104 | bool always_on; | ||
100 | }; | 105 | }; |
101 | 106 | ||
107 | #ifdef CONFIG_PM_GENERIC_DOMAINS | ||
102 | static inline struct generic_pm_domain_data *to_gpd_data(struct pm_domain_data *pdd) | 108 | static inline struct generic_pm_domain_data *to_gpd_data(struct pm_domain_data *pdd) |
103 | { | 109 | { |
104 | return container_of(pdd, struct generic_pm_domain_data, base); | 110 | return container_of(pdd, struct generic_pm_domain_data, base); |
105 | } | 111 | } |
106 | 112 | ||
107 | #ifdef CONFIG_PM_GENERIC_DOMAINS | ||
108 | static inline struct generic_pm_domain_data *dev_gpd_data(struct device *dev) | 113 | static inline struct generic_pm_domain_data *dev_gpd_data(struct device *dev) |
109 | { | 114 | { |
110 | return to_gpd_data(dev->power.subsys_data->domain_data); | 115 | return to_gpd_data(dev->power.subsys_data->domain_data); |
@@ -117,14 +122,25 @@ extern int __pm_genpd_add_device(struct generic_pm_domain *genpd, | |||
117 | struct device *dev, | 122 | struct device *dev, |
118 | struct gpd_timing_data *td); | 123 | struct gpd_timing_data *td); |
119 | 124 | ||
125 | extern int __pm_genpd_of_add_device(struct device_node *genpd_node, | ||
126 | struct device *dev, | ||
127 | struct gpd_timing_data *td); | ||
128 | |||
120 | static inline int pm_genpd_add_device(struct generic_pm_domain *genpd, | 129 | static inline int pm_genpd_add_device(struct generic_pm_domain *genpd, |
121 | struct device *dev) | 130 | struct device *dev) |
122 | { | 131 | { |
123 | return __pm_genpd_add_device(genpd, dev, NULL); | 132 | return __pm_genpd_add_device(genpd, dev, NULL); |
124 | } | 133 | } |
125 | 134 | ||
135 | static inline int pm_genpd_of_add_device(struct device_node *genpd_node, | ||
136 | struct device *dev) | ||
137 | { | ||
138 | return __pm_genpd_of_add_device(genpd_node, dev, NULL); | ||
139 | } | ||
140 | |||
126 | extern int pm_genpd_remove_device(struct generic_pm_domain *genpd, | 141 | extern int pm_genpd_remove_device(struct generic_pm_domain *genpd, |
127 | struct device *dev); | 142 | struct device *dev); |
143 | extern void pm_genpd_dev_always_on(struct device *dev, bool val); | ||
128 | extern int pm_genpd_add_subdomain(struct generic_pm_domain *genpd, | 144 | extern int pm_genpd_add_subdomain(struct generic_pm_domain *genpd, |
129 | struct generic_pm_domain *new_subdomain); | 145 | struct generic_pm_domain *new_subdomain); |
130 | extern int pm_genpd_remove_subdomain(struct generic_pm_domain *genpd, | 146 | extern int pm_genpd_remove_subdomain(struct generic_pm_domain *genpd, |
@@ -143,6 +159,10 @@ extern bool default_stop_ok(struct device *dev); | |||
143 | extern struct dev_power_governor pm_domain_always_on_gov; | 159 | extern struct dev_power_governor pm_domain_always_on_gov; |
144 | #else | 160 | #else |
145 | 161 | ||
162 | static inline struct generic_pm_domain_data *dev_gpd_data(struct device *dev) | ||
163 | { | ||
164 | return ERR_PTR(-ENOSYS); | ||
165 | } | ||
146 | static inline struct generic_pm_domain *dev_to_genpd(struct device *dev) | 166 | static inline struct generic_pm_domain *dev_to_genpd(struct device *dev) |
147 | { | 167 | { |
148 | return ERR_PTR(-ENOSYS); | 168 | return ERR_PTR(-ENOSYS); |
@@ -163,6 +183,7 @@ static inline int pm_genpd_remove_device(struct generic_pm_domain *genpd, | |||
163 | { | 183 | { |
164 | return -ENOSYS; | 184 | return -ENOSYS; |
165 | } | 185 | } |
186 | static inline void pm_genpd_dev_always_on(struct device *dev, bool val) {} | ||
166 | static inline int pm_genpd_add_subdomain(struct generic_pm_domain *genpd, | 187 | static inline int pm_genpd_add_subdomain(struct generic_pm_domain *genpd, |
167 | struct generic_pm_domain *new_sd) | 188 | struct generic_pm_domain *new_sd) |
168 | { | 189 | { |
@@ -183,7 +204,8 @@ static inline int __pm_genpd_remove_callbacks(struct device *dev, bool clear_td) | |||
183 | { | 204 | { |
184 | return -ENOSYS; | 205 | return -ENOSYS; |
185 | } | 206 | } |
186 | static inline void pm_genpd_init(struct generic_pm_domain *genpd, bool is_off) | 207 | static inline void pm_genpd_init(struct generic_pm_domain *genpd, |
208 | struct dev_power_governor *gov, bool is_off) | ||
187 | { | 209 | { |
188 | } | 210 | } |
189 | static inline int pm_genpd_poweron(struct generic_pm_domain *genpd) | 211 | static inline int pm_genpd_poweron(struct generic_pm_domain *genpd) |
@@ -194,6 +216,7 @@ static inline bool default_stop_ok(struct device *dev) | |||
194 | { | 216 | { |
195 | return false; | 217 | return false; |
196 | } | 218 | } |
219 | #define simple_qos_governor NULL | ||
197 | #define pm_domain_always_on_gov NULL | 220 | #define pm_domain_always_on_gov NULL |
198 | #endif | 221 | #endif |
199 | 222 | ||
diff --git a/include/linux/pm_qos.h b/include/linux/pm_qos.h index 4d99e4e6ef83..233149cb19f4 100644 --- a/include/linux/pm_qos.h +++ b/include/linux/pm_qos.h | |||
@@ -8,13 +8,18 @@ | |||
8 | #include <linux/notifier.h> | 8 | #include <linux/notifier.h> |
9 | #include <linux/miscdevice.h> | 9 | #include <linux/miscdevice.h> |
10 | #include <linux/device.h> | 10 | #include <linux/device.h> |
11 | #include <linux/workqueue.h> | ||
11 | 12 | ||
12 | #define PM_QOS_RESERVED 0 | 13 | enum { |
13 | #define PM_QOS_CPU_DMA_LATENCY 1 | 14 | PM_QOS_RESERVED = 0, |
14 | #define PM_QOS_NETWORK_LATENCY 2 | 15 | PM_QOS_CPU_DMA_LATENCY, |
15 | #define PM_QOS_NETWORK_THROUGHPUT 3 | 16 | PM_QOS_NETWORK_LATENCY, |
17 | PM_QOS_NETWORK_THROUGHPUT, | ||
18 | |||
19 | /* insert new class ID */ | ||
20 | PM_QOS_NUM_CLASSES, | ||
21 | }; | ||
16 | 22 | ||
17 | #define PM_QOS_NUM_CLASSES 4 | ||
18 | #define PM_QOS_DEFAULT_VALUE -1 | 23 | #define PM_QOS_DEFAULT_VALUE -1 |
19 | 24 | ||
20 | #define PM_QOS_CPU_DMA_LAT_DEFAULT_VALUE (2000 * USEC_PER_SEC) | 25 | #define PM_QOS_CPU_DMA_LAT_DEFAULT_VALUE (2000 * USEC_PER_SEC) |
@@ -25,6 +30,7 @@ | |||
25 | struct pm_qos_request { | 30 | struct pm_qos_request { |
26 | struct plist_node node; | 31 | struct plist_node node; |
27 | int pm_qos_class; | 32 | int pm_qos_class; |
33 | struct delayed_work work; /* for pm_qos_update_request_timeout */ | ||
28 | }; | 34 | }; |
29 | 35 | ||
30 | struct dev_pm_qos_request { | 36 | struct dev_pm_qos_request { |
@@ -63,13 +69,14 @@ static inline int dev_pm_qos_request_active(struct dev_pm_qos_request *req) | |||
63 | return req->dev != 0; | 69 | return req->dev != 0; |
64 | } | 70 | } |
65 | 71 | ||
66 | #ifdef CONFIG_PM | ||
67 | int pm_qos_update_target(struct pm_qos_constraints *c, struct plist_node *node, | 72 | int pm_qos_update_target(struct pm_qos_constraints *c, struct plist_node *node, |
68 | enum pm_qos_req_action action, int value); | 73 | enum pm_qos_req_action action, int value); |
69 | void pm_qos_add_request(struct pm_qos_request *req, int pm_qos_class, | 74 | void pm_qos_add_request(struct pm_qos_request *req, int pm_qos_class, |
70 | s32 value); | 75 | s32 value); |
71 | void pm_qos_update_request(struct pm_qos_request *req, | 76 | void pm_qos_update_request(struct pm_qos_request *req, |
72 | s32 new_value); | 77 | s32 new_value); |
78 | void pm_qos_update_request_timeout(struct pm_qos_request *req, | ||
79 | s32 new_value, unsigned long timeout_us); | ||
73 | void pm_qos_remove_request(struct pm_qos_request *req); | 80 | void pm_qos_remove_request(struct pm_qos_request *req); |
74 | 81 | ||
75 | int pm_qos_request(int pm_qos_class); | 82 | int pm_qos_request(int pm_qos_class); |
@@ -78,6 +85,7 @@ int pm_qos_remove_notifier(int pm_qos_class, struct notifier_block *notifier); | |||
78 | int pm_qos_request_active(struct pm_qos_request *req); | 85 | int pm_qos_request_active(struct pm_qos_request *req); |
79 | s32 pm_qos_read_value(struct pm_qos_constraints *c); | 86 | s32 pm_qos_read_value(struct pm_qos_constraints *c); |
80 | 87 | ||
88 | #ifdef CONFIG_PM | ||
81 | s32 __dev_pm_qos_read_value(struct device *dev); | 89 | s32 __dev_pm_qos_read_value(struct device *dev); |
82 | s32 dev_pm_qos_read_value(struct device *dev); | 90 | s32 dev_pm_qos_read_value(struct device *dev); |
83 | int dev_pm_qos_add_request(struct device *dev, struct dev_pm_qos_request *req, | 91 | int dev_pm_qos_add_request(struct device *dev, struct dev_pm_qos_request *req, |
@@ -95,45 +103,6 @@ void dev_pm_qos_constraints_destroy(struct device *dev); | |||
95 | int dev_pm_qos_add_ancestor_request(struct device *dev, | 103 | int dev_pm_qos_add_ancestor_request(struct device *dev, |
96 | struct dev_pm_qos_request *req, s32 value); | 104 | struct dev_pm_qos_request *req, s32 value); |
97 | #else | 105 | #else |
98 | static inline int pm_qos_update_target(struct pm_qos_constraints *c, | ||
99 | struct plist_node *node, | ||
100 | enum pm_qos_req_action action, | ||
101 | int value) | ||
102 | { return 0; } | ||
103 | static inline void pm_qos_add_request(struct pm_qos_request *req, | ||
104 | int pm_qos_class, s32 value) | ||
105 | { return; } | ||
106 | static inline void pm_qos_update_request(struct pm_qos_request *req, | ||
107 | s32 new_value) | ||
108 | { return; } | ||
109 | static inline void pm_qos_remove_request(struct pm_qos_request *req) | ||
110 | { return; } | ||
111 | |||
112 | static inline int pm_qos_request(int pm_qos_class) | ||
113 | { | ||
114 | switch (pm_qos_class) { | ||
115 | case PM_QOS_CPU_DMA_LATENCY: | ||
116 | return PM_QOS_CPU_DMA_LAT_DEFAULT_VALUE; | ||
117 | case PM_QOS_NETWORK_LATENCY: | ||
118 | return PM_QOS_NETWORK_LAT_DEFAULT_VALUE; | ||
119 | case PM_QOS_NETWORK_THROUGHPUT: | ||
120 | return PM_QOS_NETWORK_THROUGHPUT_DEFAULT_VALUE; | ||
121 | default: | ||
122 | return PM_QOS_DEFAULT_VALUE; | ||
123 | } | ||
124 | } | ||
125 | |||
126 | static inline int pm_qos_add_notifier(int pm_qos_class, | ||
127 | struct notifier_block *notifier) | ||
128 | { return 0; } | ||
129 | static inline int pm_qos_remove_notifier(int pm_qos_class, | ||
130 | struct notifier_block *notifier) | ||
131 | { return 0; } | ||
132 | static inline int pm_qos_request_active(struct pm_qos_request *req) | ||
133 | { return 0; } | ||
134 | static inline s32 pm_qos_read_value(struct pm_qos_constraints *c) | ||
135 | { return 0; } | ||
136 | |||
137 | static inline s32 __dev_pm_qos_read_value(struct device *dev) | 106 | static inline s32 __dev_pm_qos_read_value(struct device *dev) |
138 | { return 0; } | 107 | { return 0; } |
139 | static inline s32 dev_pm_qos_read_value(struct device *dev) | 108 | static inline s32 dev_pm_qos_read_value(struct device *dev) |
@@ -172,4 +141,13 @@ static inline int dev_pm_qos_add_ancestor_request(struct device *dev, | |||
172 | { return 0; } | 141 | { return 0; } |
173 | #endif | 142 | #endif |
174 | 143 | ||
144 | #ifdef CONFIG_PM_RUNTIME | ||
145 | int dev_pm_qos_expose_latency_limit(struct device *dev, s32 value); | ||
146 | void dev_pm_qos_hide_latency_limit(struct device *dev); | ||
147 | #else | ||
148 | static inline int dev_pm_qos_expose_latency_limit(struct device *dev, s32 value) | ||
149 | { return 0; } | ||
150 | static inline void dev_pm_qos_hide_latency_limit(struct device *dev) {} | ||
151 | #endif | ||
152 | |||
175 | #endif | 153 | #endif |
diff --git a/include/linux/pm_wakeup.h b/include/linux/pm_wakeup.h index a32da962d693..d9f05113e5fb 100644 --- a/include/linux/pm_wakeup.h +++ b/include/linux/pm_wakeup.h | |||
@@ -41,7 +41,7 @@ | |||
41 | * @active: Status of the wakeup source. | 41 | * @active: Status of the wakeup source. |
42 | */ | 42 | */ |
43 | struct wakeup_source { | 43 | struct wakeup_source { |
44 | char *name; | 44 | const char *name; |
45 | struct list_head entry; | 45 | struct list_head entry; |
46 | spinlock_t lock; | 46 | spinlock_t lock; |
47 | struct timer_list timer; | 47 | struct timer_list timer; |
@@ -73,7 +73,9 @@ static inline bool device_may_wakeup(struct device *dev) | |||
73 | } | 73 | } |
74 | 74 | ||
75 | /* drivers/base/power/wakeup.c */ | 75 | /* drivers/base/power/wakeup.c */ |
76 | extern void wakeup_source_prepare(struct wakeup_source *ws, const char *name); | ||
76 | extern struct wakeup_source *wakeup_source_create(const char *name); | 77 | extern struct wakeup_source *wakeup_source_create(const char *name); |
78 | extern void wakeup_source_drop(struct wakeup_source *ws); | ||
77 | extern void wakeup_source_destroy(struct wakeup_source *ws); | 79 | extern void wakeup_source_destroy(struct wakeup_source *ws); |
78 | extern void wakeup_source_add(struct wakeup_source *ws); | 80 | extern void wakeup_source_add(struct wakeup_source *ws); |
79 | extern void wakeup_source_remove(struct wakeup_source *ws); | 81 | extern void wakeup_source_remove(struct wakeup_source *ws); |
@@ -103,11 +105,16 @@ static inline bool device_can_wakeup(struct device *dev) | |||
103 | return dev->power.can_wakeup; | 105 | return dev->power.can_wakeup; |
104 | } | 106 | } |
105 | 107 | ||
108 | static inline void wakeup_source_prepare(struct wakeup_source *ws, | ||
109 | const char *name) {} | ||
110 | |||
106 | static inline struct wakeup_source *wakeup_source_create(const char *name) | 111 | static inline struct wakeup_source *wakeup_source_create(const char *name) |
107 | { | 112 | { |
108 | return NULL; | 113 | return NULL; |
109 | } | 114 | } |
110 | 115 | ||
116 | static inline void wakeup_source_drop(struct wakeup_source *ws) {} | ||
117 | |||
111 | static inline void wakeup_source_destroy(struct wakeup_source *ws) {} | 118 | static inline void wakeup_source_destroy(struct wakeup_source *ws) {} |
112 | 119 | ||
113 | static inline void wakeup_source_add(struct wakeup_source *ws) {} | 120 | static inline void wakeup_source_add(struct wakeup_source *ws) {} |
@@ -165,4 +172,17 @@ static inline void pm_wakeup_event(struct device *dev, unsigned int msec) {} | |||
165 | 172 | ||
166 | #endif /* !CONFIG_PM_SLEEP */ | 173 | #endif /* !CONFIG_PM_SLEEP */ |
167 | 174 | ||
175 | static inline void wakeup_source_init(struct wakeup_source *ws, | ||
176 | const char *name) | ||
177 | { | ||
178 | wakeup_source_prepare(ws, name); | ||
179 | wakeup_source_add(ws); | ||
180 | } | ||
181 | |||
182 | static inline void wakeup_source_trash(struct wakeup_source *ws) | ||
183 | { | ||
184 | wakeup_source_remove(ws); | ||
185 | wakeup_source_drop(ws); | ||
186 | } | ||
187 | |||
168 | #endif /* _LINUX_PM_WAKEUP_H */ | 188 | #endif /* _LINUX_PM_WAKEUP_H */ |
diff --git a/include/linux/poll.h b/include/linux/poll.h index cf40010ce0cd..48fe8bc398d1 100644 --- a/include/linux/poll.h +++ b/include/linux/poll.h | |||
@@ -32,21 +32,46 @@ struct poll_table_struct; | |||
32 | */ | 32 | */ |
33 | typedef void (*poll_queue_proc)(struct file *, wait_queue_head_t *, struct poll_table_struct *); | 33 | typedef void (*poll_queue_proc)(struct file *, wait_queue_head_t *, struct poll_table_struct *); |
34 | 34 | ||
35 | /* | ||
36 | * Do not touch the structure directly, use the access functions | ||
37 | * poll_does_not_wait() and poll_requested_events() instead. | ||
38 | */ | ||
35 | typedef struct poll_table_struct { | 39 | typedef struct poll_table_struct { |
36 | poll_queue_proc qproc; | 40 | poll_queue_proc _qproc; |
37 | unsigned long key; | 41 | unsigned long _key; |
38 | } poll_table; | 42 | } poll_table; |
39 | 43 | ||
40 | static inline void poll_wait(struct file * filp, wait_queue_head_t * wait_address, poll_table *p) | 44 | static inline void poll_wait(struct file * filp, wait_queue_head_t * wait_address, poll_table *p) |
41 | { | 45 | { |
42 | if (p && wait_address) | 46 | if (p && p->_qproc && wait_address) |
43 | p->qproc(filp, wait_address, p); | 47 | p->_qproc(filp, wait_address, p); |
48 | } | ||
49 | |||
50 | /* | ||
51 | * Return true if it is guaranteed that poll will not wait. This is the case | ||
52 | * if the poll() of another file descriptor in the set got an event, so there | ||
53 | * is no need for waiting. | ||
54 | */ | ||
55 | static inline bool poll_does_not_wait(const poll_table *p) | ||
56 | { | ||
57 | return p == NULL || p->_qproc == NULL; | ||
58 | } | ||
59 | |||
60 | /* | ||
61 | * Return the set of events that the application wants to poll for. | ||
62 | * This is useful for drivers that need to know whether a DMA transfer has | ||
63 | * to be started implicitly on poll(). You typically only want to do that | ||
64 | * if the application is actually polling for POLLIN and/or POLLOUT. | ||
65 | */ | ||
66 | static inline unsigned long poll_requested_events(const poll_table *p) | ||
67 | { | ||
68 | return p ? p->_key : ~0UL; | ||
44 | } | 69 | } |
45 | 70 | ||
46 | static inline void init_poll_funcptr(poll_table *pt, poll_queue_proc qproc) | 71 | static inline void init_poll_funcptr(poll_table *pt, poll_queue_proc qproc) |
47 | { | 72 | { |
48 | pt->qproc = qproc; | 73 | pt->_qproc = qproc; |
49 | pt->key = ~0UL; /* all events enabled */ | 74 | pt->_key = ~0UL; /* all events enabled */ |
50 | } | 75 | } |
51 | 76 | ||
52 | struct poll_table_entry { | 77 | struct poll_table_entry { |
diff --git a/include/linux/posix_acl.h b/include/linux/posix_acl.h index b7681102a4b9..11bad91c4433 100644 --- a/include/linux/posix_acl.h +++ b/include/linux/posix_acl.h | |||
@@ -8,6 +8,7 @@ | |||
8 | #ifndef __LINUX_POSIX_ACL_H | 8 | #ifndef __LINUX_POSIX_ACL_H |
9 | #define __LINUX_POSIX_ACL_H | 9 | #define __LINUX_POSIX_ACL_H |
10 | 10 | ||
11 | #include <linux/bug.h> | ||
11 | #include <linux/slab.h> | 12 | #include <linux/slab.h> |
12 | #include <linux/rcupdate.h> | 13 | #include <linux/rcupdate.h> |
13 | 14 | ||
diff --git a/include/linux/power/max17042_battery.h b/include/linux/power/max17042_battery.h index fe99211fb2b8..e01b167e66f0 100644 --- a/include/linux/power/max17042_battery.h +++ b/include/linux/power/max17042_battery.h | |||
@@ -27,6 +27,8 @@ | |||
27 | #define MAX17042_BATTERY_FULL (100) | 27 | #define MAX17042_BATTERY_FULL (100) |
28 | #define MAX17042_DEFAULT_SNS_RESISTOR (10000) | 28 | #define MAX17042_DEFAULT_SNS_RESISTOR (10000) |
29 | 29 | ||
30 | #define MAX17042_CHARACTERIZATION_DATA_SIZE 48 | ||
31 | |||
30 | enum max17042_register { | 32 | enum max17042_register { |
31 | MAX17042_STATUS = 0x00, | 33 | MAX17042_STATUS = 0x00, |
32 | MAX17042_VALRT_Th = 0x01, | 34 | MAX17042_VALRT_Th = 0x01, |
@@ -40,11 +42,11 @@ enum max17042_register { | |||
40 | MAX17042_VCELL = 0x09, | 42 | MAX17042_VCELL = 0x09, |
41 | MAX17042_Current = 0x0A, | 43 | MAX17042_Current = 0x0A, |
42 | MAX17042_AvgCurrent = 0x0B, | 44 | MAX17042_AvgCurrent = 0x0B, |
43 | MAX17042_Qresidual = 0x0C, | 45 | |
44 | MAX17042_SOC = 0x0D, | 46 | MAX17042_SOC = 0x0D, |
45 | MAX17042_AvSOC = 0x0E, | 47 | MAX17042_AvSOC = 0x0E, |
46 | MAX17042_RemCap = 0x0F, | 48 | MAX17042_RemCap = 0x0F, |
47 | MAX17402_FullCAP = 0x10, | 49 | MAX17042_FullCAP = 0x10, |
48 | MAX17042_TTE = 0x11, | 50 | MAX17042_TTE = 0x11, |
49 | MAX17042_V_empty = 0x12, | 51 | MAX17042_V_empty = 0x12, |
50 | 52 | ||
@@ -62,14 +64,14 @@ enum max17042_register { | |||
62 | MAX17042_AvCap = 0x1F, | 64 | MAX17042_AvCap = 0x1F, |
63 | MAX17042_ManName = 0x20, | 65 | MAX17042_ManName = 0x20, |
64 | MAX17042_DevName = 0x21, | 66 | MAX17042_DevName = 0x21, |
65 | MAX17042_DevChem = 0x22, | ||
66 | 67 | ||
68 | MAX17042_FullCAPNom = 0x23, | ||
67 | MAX17042_TempNom = 0x24, | 69 | MAX17042_TempNom = 0x24, |
68 | MAX17042_TempCold = 0x25, | 70 | MAX17042_TempLim = 0x25, |
69 | MAX17042_TempHot = 0x26, | 71 | MAX17042_TempHot = 0x26, |
70 | MAX17042_AIN = 0x27, | 72 | MAX17042_AIN = 0x27, |
71 | MAX17042_LearnCFG = 0x28, | 73 | MAX17042_LearnCFG = 0x28, |
72 | MAX17042_SHFTCFG = 0x29, | 74 | MAX17042_FilterCFG = 0x29, |
73 | MAX17042_RelaxCFG = 0x2A, | 75 | MAX17042_RelaxCFG = 0x2A, |
74 | MAX17042_MiscCFG = 0x2B, | 76 | MAX17042_MiscCFG = 0x2B, |
75 | MAX17042_TGAIN = 0x2C, | 77 | MAX17042_TGAIN = 0x2C, |
@@ -77,22 +79,41 @@ enum max17042_register { | |||
77 | MAX17042_CGAIN = 0x2E, | 79 | MAX17042_CGAIN = 0x2E, |
78 | MAX17042_COFF = 0x2F, | 80 | MAX17042_COFF = 0x2F, |
79 | 81 | ||
80 | MAX17042_Q_empty = 0x33, | 82 | MAX17042_MaskSOC = 0x32, |
83 | MAX17042_SOC_empty = 0x33, | ||
81 | MAX17042_T_empty = 0x34, | 84 | MAX17042_T_empty = 0x34, |
82 | 85 | ||
86 | MAX17042_FullCAP0 = 0x35, | ||
87 | MAX17042_LAvg_empty = 0x36, | ||
88 | MAX17042_FCTC = 0x37, | ||
83 | MAX17042_RCOMP0 = 0x38, | 89 | MAX17042_RCOMP0 = 0x38, |
84 | MAX17042_TempCo = 0x39, | 90 | MAX17042_TempCo = 0x39, |
85 | MAX17042_Rx = 0x3A, | 91 | MAX17042_EmptyTempCo = 0x3A, |
86 | MAX17042_T_empty0 = 0x3B, | 92 | MAX17042_K_empty0 = 0x3B, |
87 | MAX17042_TaskPeriod = 0x3C, | 93 | MAX17042_TaskPeriod = 0x3C, |
88 | MAX17042_FSTAT = 0x3D, | 94 | MAX17042_FSTAT = 0x3D, |
89 | 95 | ||
90 | MAX17042_SHDNTIMER = 0x3F, | 96 | MAX17042_SHDNTIMER = 0x3F, |
91 | 97 | ||
92 | MAX17042_VFRemCap = 0x4A, | 98 | MAX17042_dQacc = 0x45, |
99 | MAX17042_dPacc = 0x46, | ||
100 | |||
101 | MAX17042_VFSOC0 = 0x48, | ||
93 | 102 | ||
94 | MAX17042_QH = 0x4D, | 103 | MAX17042_QH = 0x4D, |
95 | MAX17042_QL = 0x4E, | 104 | MAX17042_QL = 0x4E, |
105 | |||
106 | MAX17042_VFSOC0Enable = 0x60, | ||
107 | MAX17042_MLOCKReg1 = 0x62, | ||
108 | MAX17042_MLOCKReg2 = 0x63, | ||
109 | |||
110 | MAX17042_MODELChrTbl = 0x80, | ||
111 | |||
112 | MAX17042_OCV = 0xEE, | ||
113 | |||
114 | MAX17042_OCVInternal = 0xFB, | ||
115 | |||
116 | MAX17042_VFSOC = 0xFF, | ||
96 | }; | 117 | }; |
97 | 118 | ||
98 | /* | 119 | /* |
@@ -105,10 +126,64 @@ struct max17042_reg_data { | |||
105 | u16 data; | 126 | u16 data; |
106 | }; | 127 | }; |
107 | 128 | ||
129 | struct max17042_config_data { | ||
130 | /* External current sense resistor value in milli-ohms */ | ||
131 | u32 cur_sense_val; | ||
132 | |||
133 | /* A/D measurement */ | ||
134 | u16 tgain; /* 0x2C */ | ||
135 | u16 toff; /* 0x2D */ | ||
136 | u16 cgain; /* 0x2E */ | ||
137 | u16 coff; /* 0x2F */ | ||
138 | |||
139 | /* Alert / Status */ | ||
140 | u16 valrt_thresh; /* 0x01 */ | ||
141 | u16 talrt_thresh; /* 0x02 */ | ||
142 | u16 soc_alrt_thresh; /* 0x03 */ | ||
143 | u16 config; /* 0x01D */ | ||
144 | u16 shdntimer; /* 0x03F */ | ||
145 | |||
146 | /* App data */ | ||
147 | u16 design_cap; /* 0x18 */ | ||
148 | u16 ichgt_term; /* 0x1E */ | ||
149 | |||
150 | /* MG3 config */ | ||
151 | u16 at_rate; /* 0x04 */ | ||
152 | u16 learn_cfg; /* 0x28 */ | ||
153 | u16 filter_cfg; /* 0x29 */ | ||
154 | u16 relax_cfg; /* 0x2A */ | ||
155 | u16 misc_cfg; /* 0x2B */ | ||
156 | u16 masksoc; /* 0x32 */ | ||
157 | |||
158 | /* MG3 save and restore */ | ||
159 | u16 fullcap; /* 0x10 */ | ||
160 | u16 fullcapnom; /* 0x23 */ | ||
161 | u16 socempty; /* 0x33 */ | ||
162 | u16 lavg_empty; /* 0x36 */ | ||
163 | u16 dqacc; /* 0x45 */ | ||
164 | u16 dpacc; /* 0x46 */ | ||
165 | |||
166 | /* Cell technology from power_supply.h */ | ||
167 | u16 cell_technology; | ||
168 | |||
169 | /* Cell Data */ | ||
170 | u16 vempty; /* 0x12 */ | ||
171 | u16 temp_nom; /* 0x24 */ | ||
172 | u16 temp_lim; /* 0x25 */ | ||
173 | u16 fctc; /* 0x37 */ | ||
174 | u16 rcomp0; /* 0x38 */ | ||
175 | u16 tcompc0; /* 0x39 */ | ||
176 | u16 empty_tempco; /* 0x3A */ | ||
177 | u16 kempty0; /* 0x3B */ | ||
178 | u16 cell_char_tbl[MAX17042_CHARACTERIZATION_DATA_SIZE]; | ||
179 | } __packed; | ||
180 | |||
108 | struct max17042_platform_data { | 181 | struct max17042_platform_data { |
109 | struct max17042_reg_data *init_data; | 182 | struct max17042_reg_data *init_data; |
183 | struct max17042_config_data *config_data; | ||
110 | int num_init_data; /* Number of enties in init_data array */ | 184 | int num_init_data; /* Number of enties in init_data array */ |
111 | bool enable_current_sense; | 185 | bool enable_current_sense; |
186 | bool enable_por_init; /* Use POR init from Maxim appnote */ | ||
112 | 187 | ||
113 | /* | 188 | /* |
114 | * R_sns in micro-ohms. | 189 | * R_sns in micro-ohms. |
diff --git a/include/linux/power/smb347-charger.h b/include/linux/power/smb347-charger.h new file mode 100644 index 000000000000..b3cb20dab55f --- /dev/null +++ b/include/linux/power/smb347-charger.h | |||
@@ -0,0 +1,117 @@ | |||
1 | /* | ||
2 | * Summit Microelectronics SMB347 Battery Charger Driver | ||
3 | * | ||
4 | * Copyright (C) 2011, Intel Corporation | ||
5 | * | ||
6 | * Authors: Bruce E. Robertson <bruce.e.robertson@intel.com> | ||
7 | * Mika Westerberg <mika.westerberg@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 SMB347_CHARGER_H | ||
15 | #define SMB347_CHARGER_H | ||
16 | |||
17 | #include <linux/types.h> | ||
18 | #include <linux/power_supply.h> | ||
19 | |||
20 | enum { | ||
21 | /* use the default compensation method */ | ||
22 | SMB347_SOFT_TEMP_COMPENSATE_DEFAULT = -1, | ||
23 | |||
24 | SMB347_SOFT_TEMP_COMPENSATE_NONE, | ||
25 | SMB347_SOFT_TEMP_COMPENSATE_CURRENT, | ||
26 | SMB347_SOFT_TEMP_COMPENSATE_VOLTAGE, | ||
27 | }; | ||
28 | |||
29 | /* Use default factory programmed value for hard/soft temperature limit */ | ||
30 | #define SMB347_TEMP_USE_DEFAULT -273 | ||
31 | |||
32 | /* | ||
33 | * Charging enable can be controlled by software (via i2c) by | ||
34 | * smb347-charger driver or by EN pin (active low/high). | ||
35 | */ | ||
36 | enum smb347_chg_enable { | ||
37 | SMB347_CHG_ENABLE_SW, | ||
38 | SMB347_CHG_ENABLE_PIN_ACTIVE_LOW, | ||
39 | SMB347_CHG_ENABLE_PIN_ACTIVE_HIGH, | ||
40 | }; | ||
41 | |||
42 | /** | ||
43 | * struct smb347_charger_platform_data - platform data for SMB347 charger | ||
44 | * @battery_info: Information about the battery | ||
45 | * @max_charge_current: maximum current (in uA) the battery can be charged | ||
46 | * @max_charge_voltage: maximum voltage (in uV) the battery can be charged | ||
47 | * @pre_charge_current: current (in uA) to use in pre-charging phase | ||
48 | * @termination_current: current (in uA) used to determine when the | ||
49 | * charging cycle terminates | ||
50 | * @pre_to_fast_voltage: voltage (in uV) treshold used for transitioning to | ||
51 | * pre-charge to fast charge mode | ||
52 | * @mains_current_limit: maximum input current drawn from AC/DC input (in uA) | ||
53 | * @usb_hc_current_limit: maximum input high current (in uA) drawn from USB | ||
54 | * input | ||
55 | * @chip_temp_threshold: die temperature where device starts limiting charge | ||
56 | * current [%100 - %130] (in degree C) | ||
57 | * @soft_cold_temp_limit: soft cold temperature limit [%0 - %15] (in degree C), | ||
58 | * granularity is 5 deg C. | ||
59 | * @soft_hot_temp_limit: soft hot temperature limit [%40 - %55] (in degree C), | ||
60 | * granularity is 5 deg C. | ||
61 | * @hard_cold_temp_limit: hard cold temperature limit [%-5 - %10] (in degree C), | ||
62 | * granularity is 5 deg C. | ||
63 | * @hard_hot_temp_limit: hard hot temperature limit [%50 - %65] (in degree C), | ||
64 | * granularity is 5 deg C. | ||
65 | * @suspend_on_hard_temp_limit: suspend charging when hard limit is hit | ||
66 | * @soft_temp_limit_compensation: compensation method when soft temperature | ||
67 | * limit is hit | ||
68 | * @charge_current_compensation: current (in uA) for charging compensation | ||
69 | * current when temperature hits soft limits | ||
70 | * @use_mains: AC/DC input can be used | ||
71 | * @use_usb: USB input can be used | ||
72 | * @use_usb_otg: USB OTG output can be used (not implemented yet) | ||
73 | * @irq_gpio: GPIO number used for interrupts (%-1 if not used) | ||
74 | * @enable_control: how charging enable/disable is controlled | ||
75 | * (driver/pin controls) | ||
76 | * | ||
77 | * @use_main, @use_usb, and @use_usb_otg are means to enable/disable | ||
78 | * hardware support for these. This is useful when we want to have for | ||
79 | * example OTG charging controlled via OTG transceiver driver and not by | ||
80 | * the SMB347 hardware. | ||
81 | * | ||
82 | * Hard and soft temperature limit values are given as described in the | ||
83 | * device data sheet and assuming NTC beta value is %3750. Even if this is | ||
84 | * not the case, these values should be used. They can be mapped to the | ||
85 | * corresponding NTC beta values with the help of table %2 in the data | ||
86 | * sheet. So for example if NTC beta is %3375 and we want to program hard | ||
87 | * hot limit to be %53 deg C, @hard_hot_temp_limit should be set to %50. | ||
88 | * | ||
89 | * If zero value is given in any of the current and voltage values, the | ||
90 | * factory programmed default will be used. For soft/hard temperature | ||
91 | * values, pass in %SMB347_TEMP_USE_DEFAULT instead. | ||
92 | */ | ||
93 | struct smb347_charger_platform_data { | ||
94 | struct power_supply_info battery_info; | ||
95 | unsigned int max_charge_current; | ||
96 | unsigned int max_charge_voltage; | ||
97 | unsigned int pre_charge_current; | ||
98 | unsigned int termination_current; | ||
99 | unsigned int pre_to_fast_voltage; | ||
100 | unsigned int mains_current_limit; | ||
101 | unsigned int usb_hc_current_limit; | ||
102 | unsigned int chip_temp_threshold; | ||
103 | int soft_cold_temp_limit; | ||
104 | int soft_hot_temp_limit; | ||
105 | int hard_cold_temp_limit; | ||
106 | int hard_hot_temp_limit; | ||
107 | bool suspend_on_hard_temp_limit; | ||
108 | unsigned int soft_temp_limit_compensation; | ||
109 | unsigned int charge_current_compensation; | ||
110 | bool use_mains; | ||
111 | bool use_usb; | ||
112 | bool use_usb_otg; | ||
113 | int irq_gpio; | ||
114 | enum smb347_chg_enable enable_control; | ||
115 | }; | ||
116 | |||
117 | #endif /* SMB347_CHARGER_H */ | ||
diff --git a/include/linux/power_supply.h b/include/linux/power_supply.h index fa9b962aec12..c38c13db8832 100644 --- a/include/linux/power_supply.h +++ b/include/linux/power_supply.h | |||
@@ -13,10 +13,11 @@ | |||
13 | #ifndef __LINUX_POWER_SUPPLY_H__ | 13 | #ifndef __LINUX_POWER_SUPPLY_H__ |
14 | #define __LINUX_POWER_SUPPLY_H__ | 14 | #define __LINUX_POWER_SUPPLY_H__ |
15 | 15 | ||
16 | #include <linux/device.h> | ||
17 | #include <linux/workqueue.h> | 16 | #include <linux/workqueue.h> |
18 | #include <linux/leds.h> | 17 | #include <linux/leds.h> |
19 | 18 | ||
19 | struct device; | ||
20 | |||
20 | /* | 21 | /* |
21 | * All voltages, currents, charges, energies, time and temperatures in uV, | 22 | * All voltages, currents, charges, energies, time and temperatures in uV, |
22 | * µA, µAh, µWh, seconds and tenths of degree Celsius unless otherwise | 23 | * µA, µAh, µWh, seconds and tenths of degree Celsius unless otherwise |
diff --git a/include/linux/ppp-comp.h b/include/linux/ppp-comp.h index b8d4ddd22736..e53ff65935dd 100644 --- a/include/linux/ppp-comp.h +++ b/include/linux/ppp-comp.h | |||
@@ -1,42 +1,12 @@ | |||
1 | /* | 1 | /* |
2 | * ppp-comp.h - Definitions for doing PPP packet compression. | 2 | * ppp-comp.h - Definitions for doing PPP packet compression. |
3 | * | 3 | * |
4 | * Copyright (c) 1994 The Australian National University. | 4 | * Copyright 1994-1998 Paul Mackerras. |
5 | * All rights reserved. | ||
6 | * | 5 | * |
7 | * Permission to use, copy, modify, and distribute this software and its | 6 | * This program is free software; you can redistribute it and/or |
8 | * documentation is hereby granted, provided that the above copyright | 7 | * modify it under the terms of the GNU General Public License |
9 | * notice appears in all copies. This software is provided without any | 8 | * version 2 as published by the Free Software Foundation. |
10 | * warranty, express or implied. The Australian National University | ||
11 | * makes no representations about the suitability of this software for | ||
12 | * any purpose. | ||
13 | * | ||
14 | * IN NO EVENT SHALL THE AUSTRALIAN NATIONAL UNIVERSITY BE LIABLE TO ANY | ||
15 | * PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES | ||
16 | * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF | ||
17 | * THE AUSTRALIAN NATIONAL UNIVERSITY HAVE BEEN ADVISED OF THE POSSIBILITY | ||
18 | * OF SUCH DAMAGE. | ||
19 | * | ||
20 | * THE AUSTRALIAN NATIONAL UNIVERSITY SPECIFICALLY DISCLAIMS ANY WARRANTIES, | ||
21 | * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY | ||
22 | * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS | ||
23 | * ON AN "AS IS" BASIS, AND THE AUSTRALIAN NATIONAL UNIVERSITY HAS NO | ||
24 | * OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, | ||
25 | * OR MODIFICATIONS. | ||
26 | */ | 9 | */ |
27 | |||
28 | /* | ||
29 | * ==FILEVERSION 980319== | ||
30 | * | ||
31 | * NOTE TO MAINTAINERS: | ||
32 | * If you modify this file at all, please set the above date. | ||
33 | * ppp-comp.h is shipped with a PPP distribution as well as with the kernel; | ||
34 | * if everyone increases the FILEVERSION number above, then scripts | ||
35 | * can do the right thing when deciding whether to install a new ppp-comp.h | ||
36 | * file. Don't change the format of that line otherwise, so the | ||
37 | * installation script can recognize it. | ||
38 | */ | ||
39 | |||
40 | #ifndef _NET_PPP_COMP_H | 10 | #ifndef _NET_PPP_COMP_H |
41 | #define _NET_PPP_COMP_H | 11 | #define _NET_PPP_COMP_H |
42 | 12 | ||
diff --git a/include/linux/ppp-ioctl.h b/include/linux/ppp-ioctl.h new file mode 100644 index 000000000000..2d9a8859550a --- /dev/null +++ b/include/linux/ppp-ioctl.h | |||
@@ -0,0 +1,119 @@ | |||
1 | /* | ||
2 | * ppp-ioctl.h - PPP ioctl definitions. | ||
3 | * | ||
4 | * Copyright 1999-2002 Paul Mackerras. | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or | ||
7 | * modify it under the terms of the GNU General Public License | ||
8 | * version 2 as published by the Free Software Foundation. | ||
9 | */ | ||
10 | #ifndef _PPP_IOCTL_H | ||
11 | #define _PPP_IOCTL_H | ||
12 | |||
13 | #include <linux/types.h> | ||
14 | #include <linux/compiler.h> | ||
15 | |||
16 | /* | ||
17 | * Bit definitions for flags argument to PPPIOCGFLAGS/PPPIOCSFLAGS. | ||
18 | */ | ||
19 | #define SC_COMP_PROT 0x00000001 /* protocol compression (output) */ | ||
20 | #define SC_COMP_AC 0x00000002 /* header compression (output) */ | ||
21 | #define SC_COMP_TCP 0x00000004 /* TCP (VJ) compression (output) */ | ||
22 | #define SC_NO_TCP_CCID 0x00000008 /* disable VJ connection-id comp. */ | ||
23 | #define SC_REJ_COMP_AC 0x00000010 /* reject adrs/ctrl comp. on input */ | ||
24 | #define SC_REJ_COMP_TCP 0x00000020 /* reject TCP (VJ) comp. on input */ | ||
25 | #define SC_CCP_OPEN 0x00000040 /* Look at CCP packets */ | ||
26 | #define SC_CCP_UP 0x00000080 /* May send/recv compressed packets */ | ||
27 | #define SC_ENABLE_IP 0x00000100 /* IP packets may be exchanged */ | ||
28 | #define SC_LOOP_TRAFFIC 0x00000200 /* send traffic to pppd */ | ||
29 | #define SC_MULTILINK 0x00000400 /* do multilink encapsulation */ | ||
30 | #define SC_MP_SHORTSEQ 0x00000800 /* use short MP sequence numbers */ | ||
31 | #define SC_COMP_RUN 0x00001000 /* compressor has been inited */ | ||
32 | #define SC_DECOMP_RUN 0x00002000 /* decompressor has been inited */ | ||
33 | #define SC_MP_XSHORTSEQ 0x00004000 /* transmit short MP seq numbers */ | ||
34 | #define SC_DEBUG 0x00010000 /* enable debug messages */ | ||
35 | #define SC_LOG_INPKT 0x00020000 /* log contents of good pkts recvd */ | ||
36 | #define SC_LOG_OUTPKT 0x00040000 /* log contents of pkts sent */ | ||
37 | #define SC_LOG_RAWIN 0x00080000 /* log all chars received */ | ||
38 | #define SC_LOG_FLUSH 0x00100000 /* log all chars flushed */ | ||
39 | #define SC_SYNC 0x00200000 /* synchronous serial mode */ | ||
40 | #define SC_MUST_COMP 0x00400000 /* no uncompressed packets may be sent or received */ | ||
41 | #define SC_MASK 0x0f600fff /* bits that user can change */ | ||
42 | |||
43 | /* state bits */ | ||
44 | #define SC_XMIT_BUSY 0x10000000 /* (used by isdn_ppp?) */ | ||
45 | #define SC_RCV_ODDP 0x08000000 /* have rcvd char with odd parity */ | ||
46 | #define SC_RCV_EVNP 0x04000000 /* have rcvd char with even parity */ | ||
47 | #define SC_RCV_B7_1 0x02000000 /* have rcvd char with bit 7 = 1 */ | ||
48 | #define SC_RCV_B7_0 0x01000000 /* have rcvd char with bit 7 = 0 */ | ||
49 | #define SC_DC_FERROR 0x00800000 /* fatal decomp error detected */ | ||
50 | #define SC_DC_ERROR 0x00400000 /* non-fatal decomp error detected */ | ||
51 | |||
52 | /* Used with PPPIOCGNPMODE/PPPIOCSNPMODE */ | ||
53 | struct npioctl { | ||
54 | int protocol; /* PPP protocol, e.g. PPP_IP */ | ||
55 | enum NPmode mode; | ||
56 | }; | ||
57 | |||
58 | /* Structure describing a CCP configuration option, for PPPIOCSCOMPRESS */ | ||
59 | struct ppp_option_data { | ||
60 | __u8 __user *ptr; | ||
61 | __u32 length; | ||
62 | int transmit; | ||
63 | }; | ||
64 | |||
65 | /* For PPPIOCGL2TPSTATS */ | ||
66 | struct pppol2tp_ioc_stats { | ||
67 | __u16 tunnel_id; /* redundant */ | ||
68 | __u16 session_id; /* if zero, get tunnel stats */ | ||
69 | __u32 using_ipsec:1; /* valid only for session_id == 0 */ | ||
70 | __aligned_u64 tx_packets; | ||
71 | __aligned_u64 tx_bytes; | ||
72 | __aligned_u64 tx_errors; | ||
73 | __aligned_u64 rx_packets; | ||
74 | __aligned_u64 rx_bytes; | ||
75 | __aligned_u64 rx_seq_discards; | ||
76 | __aligned_u64 rx_oos_packets; | ||
77 | __aligned_u64 rx_errors; | ||
78 | }; | ||
79 | |||
80 | /* | ||
81 | * Ioctl definitions. | ||
82 | */ | ||
83 | |||
84 | #define PPPIOCGFLAGS _IOR('t', 90, int) /* get configuration flags */ | ||
85 | #define PPPIOCSFLAGS _IOW('t', 89, int) /* set configuration flags */ | ||
86 | #define PPPIOCGASYNCMAP _IOR('t', 88, int) /* get async map */ | ||
87 | #define PPPIOCSASYNCMAP _IOW('t', 87, int) /* set async map */ | ||
88 | #define PPPIOCGUNIT _IOR('t', 86, int) /* get ppp unit number */ | ||
89 | #define PPPIOCGRASYNCMAP _IOR('t', 85, int) /* get receive async map */ | ||
90 | #define PPPIOCSRASYNCMAP _IOW('t', 84, int) /* set receive async map */ | ||
91 | #define PPPIOCGMRU _IOR('t', 83, int) /* get max receive unit */ | ||
92 | #define PPPIOCSMRU _IOW('t', 82, int) /* set max receive unit */ | ||
93 | #define PPPIOCSMAXCID _IOW('t', 81, int) /* set VJ max slot ID */ | ||
94 | #define PPPIOCGXASYNCMAP _IOR('t', 80, ext_accm) /* get extended ACCM */ | ||
95 | #define PPPIOCSXASYNCMAP _IOW('t', 79, ext_accm) /* set extended ACCM */ | ||
96 | #define PPPIOCXFERUNIT _IO('t', 78) /* transfer PPP unit */ | ||
97 | #define PPPIOCSCOMPRESS _IOW('t', 77, struct ppp_option_data) | ||
98 | #define PPPIOCGNPMODE _IOWR('t', 76, struct npioctl) /* get NP mode */ | ||
99 | #define PPPIOCSNPMODE _IOW('t', 75, struct npioctl) /* set NP mode */ | ||
100 | #define PPPIOCSPASS _IOW('t', 71, struct sock_fprog) /* set pass filter */ | ||
101 | #define PPPIOCSACTIVE _IOW('t', 70, struct sock_fprog) /* set active filt */ | ||
102 | #define PPPIOCGDEBUG _IOR('t', 65, int) /* Read debug level */ | ||
103 | #define PPPIOCSDEBUG _IOW('t', 64, int) /* Set debug level */ | ||
104 | #define PPPIOCGIDLE _IOR('t', 63, struct ppp_idle) /* get idle time */ | ||
105 | #define PPPIOCNEWUNIT _IOWR('t', 62, int) /* create new ppp unit */ | ||
106 | #define PPPIOCATTACH _IOW('t', 61, int) /* attach to ppp unit */ | ||
107 | #define PPPIOCDETACH _IOW('t', 60, int) /* detach from ppp unit/chan */ | ||
108 | #define PPPIOCSMRRU _IOW('t', 59, int) /* set multilink MRU */ | ||
109 | #define PPPIOCCONNECT _IOW('t', 58, int) /* connect channel to unit */ | ||
110 | #define PPPIOCDISCONN _IO('t', 57) /* disconnect channel */ | ||
111 | #define PPPIOCATTCHAN _IOW('t', 56, int) /* attach to ppp channel */ | ||
112 | #define PPPIOCGCHAN _IOR('t', 55, int) /* get ppp channel number */ | ||
113 | #define PPPIOCGL2TPSTATS _IOR('t', 54, struct pppol2tp_ioc_stats) | ||
114 | |||
115 | #define SIOCGPPPSTATS (SIOCDEVPRIVATE + 0) | ||
116 | #define SIOCGPPPVER (SIOCDEVPRIVATE + 1) /* NEVER change this!! */ | ||
117 | #define SIOCGPPPCSTATS (SIOCDEVPRIVATE + 2) | ||
118 | |||
119 | #endif /* _PPP_IOCTL_H */ | ||
diff --git a/include/linux/ppp_defs.h b/include/linux/ppp_defs.h index 0f93ed6b4a88..ba416f67eb62 100644 --- a/include/linux/ppp_defs.h +++ b/include/linux/ppp_defs.h | |||
@@ -1,44 +1,14 @@ | |||
1 | /* | 1 | /* |
2 | * ppp_defs.h - PPP definitions. | 2 | * ppp_defs.h - PPP definitions. |
3 | * | 3 | * |
4 | * Copyright (c) 1994 The Australian National University. | 4 | * Copyright 1994-2000 Paul Mackerras. |
5 | * All rights reserved. | ||
6 | * | 5 | * |
7 | * Permission to use, copy, modify, and distribute this software and its | 6 | * This program is free software; you can redistribute it and/or |
8 | * documentation is hereby granted, provided that the above copyright | 7 | * modify it under the terms of the GNU General Public License |
9 | * notice appears in all copies. This software is provided without any | 8 | * version 2 as published by the Free Software Foundation. |
10 | * warranty, express or implied. The Australian National University | ||
11 | * makes no representations about the suitability of this software for | ||
12 | * any purpose. | ||
13 | * | ||
14 | * IN NO EVENT SHALL THE AUSTRALIAN NATIONAL UNIVERSITY BE LIABLE TO ANY | ||
15 | * PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES | ||
16 | * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF | ||
17 | * THE AUSTRALIAN NATIONAL UNIVERSITY HAVE BEEN ADVISED OF THE POSSIBILITY | ||
18 | * OF SUCH DAMAGE. | ||
19 | * | ||
20 | * THE AUSTRALIAN NATIONAL UNIVERSITY SPECIFICALLY DISCLAIMS ANY WARRANTIES, | ||
21 | * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY | ||
22 | * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS | ||
23 | * ON AN "AS IS" BASIS, AND THE AUSTRALIAN NATIONAL UNIVERSITY HAS NO | ||
24 | * OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, | ||
25 | * OR MODIFICATIONS. | ||
26 | */ | 9 | */ |
27 | |||
28 | #include <linux/types.h> | 10 | #include <linux/types.h> |
29 | 11 | ||
30 | /* | ||
31 | * ==FILEVERSION 20000114== | ||
32 | * | ||
33 | * NOTE TO MAINTAINERS: | ||
34 | * If you modify this file at all, please set the above date. | ||
35 | * ppp_defs.h is shipped with a PPP distribution as well as with the kernel; | ||
36 | * if everyone increases the FILEVERSION number above, then scripts | ||
37 | * can do the right thing when deciding whether to install a new ppp_defs.h | ||
38 | * file. Don't change the format of that line otherwise, so the | ||
39 | * installation script can recognize it. | ||
40 | */ | ||
41 | |||
42 | #ifndef _PPP_DEFS_H_ | 12 | #ifndef _PPP_DEFS_H_ |
43 | #define _PPP_DEFS_H_ | 13 | #define _PPP_DEFS_H_ |
44 | 14 | ||
diff --git a/include/linux/prctl.h b/include/linux/prctl.h index 7ddc7f1b480f..e0cfec2490aa 100644 --- a/include/linux/prctl.h +++ b/include/linux/prctl.h | |||
@@ -114,4 +114,14 @@ | |||
114 | # define PR_SET_MM_START_BRK 6 | 114 | # define PR_SET_MM_START_BRK 6 |
115 | # define PR_SET_MM_BRK 7 | 115 | # define PR_SET_MM_BRK 7 |
116 | 116 | ||
117 | /* | ||
118 | * Set specific pid that is allowed to ptrace the current task. | ||
119 | * A value of 0 mean "no process". | ||
120 | */ | ||
121 | #define PR_SET_PTRACER 0x59616d61 | ||
122 | # define PR_SET_PTRACER_ANY ((unsigned long)-1) | ||
123 | |||
124 | #define PR_SET_CHILD_SUBREAPER 36 | ||
125 | #define PR_GET_CHILD_SUBREAPER 37 | ||
126 | |||
117 | #endif /* _LINUX_PRCTL_H */ | 127 | #endif /* _LINUX_PRCTL_H */ |
diff --git a/include/linux/preempt.h b/include/linux/preempt.h index 58969b2a8a82..5a710b9c578e 100644 --- a/include/linux/preempt.h +++ b/include/linux/preempt.h | |||
@@ -48,12 +48,14 @@ do { \ | |||
48 | barrier(); \ | 48 | barrier(); \ |
49 | } while (0) | 49 | } while (0) |
50 | 50 | ||
51 | #define preempt_enable_no_resched() \ | 51 | #define sched_preempt_enable_no_resched() \ |
52 | do { \ | 52 | do { \ |
53 | barrier(); \ | 53 | barrier(); \ |
54 | dec_preempt_count(); \ | 54 | dec_preempt_count(); \ |
55 | } while (0) | 55 | } while (0) |
56 | 56 | ||
57 | #define preempt_enable_no_resched() sched_preempt_enable_no_resched() | ||
58 | |||
57 | #define preempt_enable() \ | 59 | #define preempt_enable() \ |
58 | do { \ | 60 | do { \ |
59 | preempt_enable_no_resched(); \ | 61 | preempt_enable_no_resched(); \ |
@@ -92,6 +94,7 @@ do { \ | |||
92 | #else /* !CONFIG_PREEMPT_COUNT */ | 94 | #else /* !CONFIG_PREEMPT_COUNT */ |
93 | 95 | ||
94 | #define preempt_disable() do { } while (0) | 96 | #define preempt_disable() do { } while (0) |
97 | #define sched_preempt_enable_no_resched() do { } while (0) | ||
95 | #define preempt_enable_no_resched() do { } while (0) | 98 | #define preempt_enable_no_resched() do { } while (0) |
96 | #define preempt_enable() do { } while (0) | 99 | #define preempt_enable() do { } while (0) |
97 | 100 | ||
diff --git a/include/linux/printk.h b/include/linux/printk.h index f0e22f75143f..0525927f203f 100644 --- a/include/linux/printk.h +++ b/include/linux/printk.h | |||
@@ -101,6 +101,11 @@ asmlinkage __printf(1, 2) __cold | |||
101 | int printk(const char *fmt, ...); | 101 | int printk(const char *fmt, ...); |
102 | 102 | ||
103 | /* | 103 | /* |
104 | * Special printk facility for scheduler use only, _DO_NOT_USE_ ! | ||
105 | */ | ||
106 | __printf(1, 2) __cold int printk_sched(const char *fmt, ...); | ||
107 | |||
108 | /* | ||
104 | * Please don't use printk_ratelimit(), because it shares ratelimiting state | 109 | * Please don't use printk_ratelimit(), because it shares ratelimiting state |
105 | * with all other unrelated printk_ratelimit() callsites. Instead use | 110 | * with all other unrelated printk_ratelimit() callsites. Instead use |
106 | * printk_ratelimited() or plain old __ratelimit(). | 111 | * printk_ratelimited() or plain old __ratelimit(). |
@@ -127,6 +132,11 @@ int printk(const char *s, ...) | |||
127 | { | 132 | { |
128 | return 0; | 133 | return 0; |
129 | } | 134 | } |
135 | static inline __printf(1, 2) __cold | ||
136 | int printk_sched(const char *s, ...) | ||
137 | { | ||
138 | return 0; | ||
139 | } | ||
130 | static inline int printk_ratelimit(void) | 140 | static inline int printk_ratelimit(void) |
131 | { | 141 | { |
132 | return 0; | 142 | return 0; |
@@ -180,13 +190,13 @@ extern void dump_stack(void) __cold; | |||
180 | #endif | 190 | #endif |
181 | 191 | ||
182 | /* If you are writing a driver, please use dev_dbg instead */ | 192 | /* If you are writing a driver, please use dev_dbg instead */ |
183 | #if defined(DEBUG) | 193 | #if defined(CONFIG_DYNAMIC_DEBUG) |
184 | #define pr_debug(fmt, ...) \ | ||
185 | printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__) | ||
186 | #elif defined(CONFIG_DYNAMIC_DEBUG) | ||
187 | /* dynamic_pr_debug() uses pr_fmt() internally so we don't need it here */ | 194 | /* dynamic_pr_debug() uses pr_fmt() internally so we don't need it here */ |
188 | #define pr_debug(fmt, ...) \ | 195 | #define pr_debug(fmt, ...) \ |
189 | dynamic_pr_debug(fmt, ##__VA_ARGS__) | 196 | dynamic_pr_debug(fmt, ##__VA_ARGS__) |
197 | #elif defined(DEBUG) | ||
198 | #define pr_debug(fmt, ...) \ | ||
199 | printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__) | ||
190 | #else | 200 | #else |
191 | #define pr_debug(fmt, ...) \ | 201 | #define pr_debug(fmt, ...) \ |
192 | no_printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__) | 202 | no_printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__) |
diff --git a/include/linux/ptrace.h b/include/linux/ptrace.h index c2f1f6a5fcb8..5c719627c2aa 100644 --- a/include/linux/ptrace.h +++ b/include/linux/ptrace.h | |||
@@ -51,20 +51,6 @@ | |||
51 | #define PTRACE_INTERRUPT 0x4207 | 51 | #define PTRACE_INTERRUPT 0x4207 |
52 | #define PTRACE_LISTEN 0x4208 | 52 | #define PTRACE_LISTEN 0x4208 |
53 | 53 | ||
54 | /* flags in @data for PTRACE_SEIZE */ | ||
55 | #define PTRACE_SEIZE_DEVEL 0x80000000 /* temp flag for development */ | ||
56 | |||
57 | /* options set using PTRACE_SETOPTIONS */ | ||
58 | #define PTRACE_O_TRACESYSGOOD 0x00000001 | ||
59 | #define PTRACE_O_TRACEFORK 0x00000002 | ||
60 | #define PTRACE_O_TRACEVFORK 0x00000004 | ||
61 | #define PTRACE_O_TRACECLONE 0x00000008 | ||
62 | #define PTRACE_O_TRACEEXEC 0x00000010 | ||
63 | #define PTRACE_O_TRACEVFORKDONE 0x00000020 | ||
64 | #define PTRACE_O_TRACEEXIT 0x00000040 | ||
65 | |||
66 | #define PTRACE_O_MASK 0x0000007f | ||
67 | |||
68 | /* Wait extended result codes for the above trace options. */ | 54 | /* Wait extended result codes for the above trace options. */ |
69 | #define PTRACE_EVENT_FORK 1 | 55 | #define PTRACE_EVENT_FORK 1 |
70 | #define PTRACE_EVENT_VFORK 2 | 56 | #define PTRACE_EVENT_VFORK 2 |
@@ -72,7 +58,19 @@ | |||
72 | #define PTRACE_EVENT_EXEC 4 | 58 | #define PTRACE_EVENT_EXEC 4 |
73 | #define PTRACE_EVENT_VFORK_DONE 5 | 59 | #define PTRACE_EVENT_VFORK_DONE 5 |
74 | #define PTRACE_EVENT_EXIT 6 | 60 | #define PTRACE_EVENT_EXIT 6 |
75 | #define PTRACE_EVENT_STOP 7 | 61 | /* Extended result codes which enabled by means other than options. */ |
62 | #define PTRACE_EVENT_STOP 128 | ||
63 | |||
64 | /* Options set using PTRACE_SETOPTIONS or using PTRACE_SEIZE @data param */ | ||
65 | #define PTRACE_O_TRACESYSGOOD 1 | ||
66 | #define PTRACE_O_TRACEFORK (1 << PTRACE_EVENT_FORK) | ||
67 | #define PTRACE_O_TRACEVFORK (1 << PTRACE_EVENT_VFORK) | ||
68 | #define PTRACE_O_TRACECLONE (1 << PTRACE_EVENT_CLONE) | ||
69 | #define PTRACE_O_TRACEEXEC (1 << PTRACE_EVENT_EXEC) | ||
70 | #define PTRACE_O_TRACEVFORKDONE (1 << PTRACE_EVENT_VFORK_DONE) | ||
71 | #define PTRACE_O_TRACEEXIT (1 << PTRACE_EVENT_EXIT) | ||
72 | |||
73 | #define PTRACE_O_MASK 0x0000007f | ||
76 | 74 | ||
77 | #include <asm/ptrace.h> | 75 | #include <asm/ptrace.h> |
78 | 76 | ||
@@ -88,13 +86,12 @@ | |||
88 | #define PT_SEIZED 0x00010000 /* SEIZE used, enable new behavior */ | 86 | #define PT_SEIZED 0x00010000 /* SEIZE used, enable new behavior */ |
89 | #define PT_PTRACED 0x00000001 | 87 | #define PT_PTRACED 0x00000001 |
90 | #define PT_DTRACE 0x00000002 /* delayed trace (used on m68k, i386) */ | 88 | #define PT_DTRACE 0x00000002 /* delayed trace (used on m68k, i386) */ |
91 | #define PT_TRACESYSGOOD 0x00000004 | 89 | #define PT_PTRACE_CAP 0x00000004 /* ptracer can follow suid-exec */ |
92 | #define PT_PTRACE_CAP 0x00000008 /* ptracer can follow suid-exec */ | ||
93 | 90 | ||
91 | #define PT_OPT_FLAG_SHIFT 3 | ||
94 | /* PT_TRACE_* event enable flags */ | 92 | /* PT_TRACE_* event enable flags */ |
95 | #define PT_EVENT_FLAG_SHIFT 4 | 93 | #define PT_EVENT_FLAG(event) (1 << (PT_OPT_FLAG_SHIFT + (event))) |
96 | #define PT_EVENT_FLAG(event) (1 << (PT_EVENT_FLAG_SHIFT + (event) - 1)) | 94 | #define PT_TRACESYSGOOD PT_EVENT_FLAG(0) |
97 | |||
98 | #define PT_TRACE_FORK PT_EVENT_FLAG(PTRACE_EVENT_FORK) | 95 | #define PT_TRACE_FORK PT_EVENT_FLAG(PTRACE_EVENT_FORK) |
99 | #define PT_TRACE_VFORK PT_EVENT_FLAG(PTRACE_EVENT_VFORK) | 96 | #define PT_TRACE_VFORK PT_EVENT_FLAG(PTRACE_EVENT_VFORK) |
100 | #define PT_TRACE_CLONE PT_EVENT_FLAG(PTRACE_EVENT_CLONE) | 97 | #define PT_TRACE_CLONE PT_EVENT_FLAG(PTRACE_EVENT_CLONE) |
@@ -102,8 +99,6 @@ | |||
102 | #define PT_TRACE_VFORK_DONE PT_EVENT_FLAG(PTRACE_EVENT_VFORK_DONE) | 99 | #define PT_TRACE_VFORK_DONE PT_EVENT_FLAG(PTRACE_EVENT_VFORK_DONE) |
103 | #define PT_TRACE_EXIT PT_EVENT_FLAG(PTRACE_EVENT_EXIT) | 100 | #define PT_TRACE_EXIT PT_EVENT_FLAG(PTRACE_EVENT_EXIT) |
104 | 101 | ||
105 | #define PT_TRACE_MASK 0x000003f4 | ||
106 | |||
107 | /* single stepping state bits (used on ARM and PA-RISC) */ | 102 | /* single stepping state bits (used on ARM and PA-RISC) */ |
108 | #define PT_SINGLESTEP_BIT 31 | 103 | #define PT_SINGLESTEP_BIT 31 |
109 | #define PT_SINGLESTEP (1<<PT_SINGLESTEP_BIT) | 104 | #define PT_SINGLESTEP (1<<PT_SINGLESTEP_BIT) |
@@ -113,6 +108,7 @@ | |||
113 | #include <linux/compiler.h> /* For unlikely. */ | 108 | #include <linux/compiler.h> /* For unlikely. */ |
114 | #include <linux/sched.h> /* For struct task_struct. */ | 109 | #include <linux/sched.h> /* For struct task_struct. */ |
115 | #include <linux/err.h> /* for IS_ERR_VALUE */ | 110 | #include <linux/err.h> /* for IS_ERR_VALUE */ |
111 | #include <linux/bug.h> /* For BUG_ON. */ | ||
116 | 112 | ||
117 | 113 | ||
118 | extern long arch_ptrace(struct task_struct *child, long request, | 114 | extern long arch_ptrace(struct task_struct *child, long request, |
@@ -199,9 +195,10 @@ static inline void ptrace_event(int event, unsigned long message) | |||
199 | if (unlikely(ptrace_event_enabled(current, event))) { | 195 | if (unlikely(ptrace_event_enabled(current, event))) { |
200 | current->ptrace_message = message; | 196 | current->ptrace_message = message; |
201 | ptrace_notify((event << 8) | SIGTRAP); | 197 | ptrace_notify((event << 8) | SIGTRAP); |
202 | } else if (event == PTRACE_EVENT_EXEC && unlikely(current->ptrace)) { | 198 | } else if (event == PTRACE_EVENT_EXEC) { |
203 | /* legacy EXEC report via SIGTRAP */ | 199 | /* legacy EXEC report via SIGTRAP */ |
204 | send_sig(SIGTRAP, current, 0); | 200 | if ((current->ptrace & (PT_PTRACED|PT_SEIZED)) == PT_PTRACED) |
201 | send_sig(SIGTRAP, current, 0); | ||
205 | } | 202 | } |
206 | } | 203 | } |
207 | 204 | ||
diff --git a/include/linux/qnx6_fs.h b/include/linux/qnx6_fs.h new file mode 100644 index 000000000000..26049eab9010 --- /dev/null +++ b/include/linux/qnx6_fs.h | |||
@@ -0,0 +1,134 @@ | |||
1 | /* | ||
2 | * Name : qnx6_fs.h | ||
3 | * Author : Kai Bankett | ||
4 | * Function : qnx6 global filesystem definitions | ||
5 | * History : 17-01-2012 created | ||
6 | */ | ||
7 | #ifndef _LINUX_QNX6_FS_H | ||
8 | #define _LINUX_QNX6_FS_H | ||
9 | |||
10 | #include <linux/types.h> | ||
11 | #include <linux/magic.h> | ||
12 | |||
13 | #define QNX6_ROOT_INO 1 | ||
14 | |||
15 | /* for di_status */ | ||
16 | #define QNX6_FILE_DIRECTORY 0x01 | ||
17 | #define QNX6_FILE_DELETED 0x02 | ||
18 | #define QNX6_FILE_NORMAL 0x03 | ||
19 | |||
20 | #define QNX6_SUPERBLOCK_SIZE 0x200 /* superblock always is 512 bytes */ | ||
21 | #define QNX6_SUPERBLOCK_AREA 0x1000 /* area reserved for superblock */ | ||
22 | #define QNX6_BOOTBLOCK_SIZE 0x2000 /* heading bootblock area */ | ||
23 | #define QNX6_DIR_ENTRY_SIZE 0x20 /* dir entry size of 32 bytes */ | ||
24 | #define QNX6_INODE_SIZE 0x80 /* each inode is 128 bytes */ | ||
25 | #define QNX6_INODE_SIZE_BITS 7 /* inode entry size shift */ | ||
26 | |||
27 | #define QNX6_NO_DIRECT_POINTERS 16 /* 16 blockptrs in sbl/inode */ | ||
28 | #define QNX6_PTR_MAX_LEVELS 5 /* maximum indirect levels */ | ||
29 | |||
30 | /* for filenames */ | ||
31 | #define QNX6_SHORT_NAME_MAX 27 | ||
32 | #define QNX6_LONG_NAME_MAX 510 | ||
33 | |||
34 | /* list of mount options */ | ||
35 | #define QNX6_MOUNT_MMI_FS 0x010000 /* mount as Audi MMI 3G fs */ | ||
36 | |||
37 | /* | ||
38 | * This is the original qnx6 inode layout on disk. | ||
39 | * Each inode is 128 byte long. | ||
40 | */ | ||
41 | struct qnx6_inode_entry { | ||
42 | __fs64 di_size; | ||
43 | __fs32 di_uid; | ||
44 | __fs32 di_gid; | ||
45 | __fs32 di_ftime; | ||
46 | __fs32 di_mtime; | ||
47 | __fs32 di_atime; | ||
48 | __fs32 di_ctime; | ||
49 | __fs16 di_mode; | ||
50 | __fs16 di_ext_mode; | ||
51 | __fs32 di_block_ptr[QNX6_NO_DIRECT_POINTERS]; | ||
52 | __u8 di_filelevels; | ||
53 | __u8 di_status; | ||
54 | __u8 di_unknown2[2]; | ||
55 | __fs32 di_zero2[6]; | ||
56 | }; | ||
57 | |||
58 | /* | ||
59 | * Each directory entry is maximum 32 bytes long. | ||
60 | * If more characters or special characters required it is stored | ||
61 | * in the longfilenames structure. | ||
62 | */ | ||
63 | struct qnx6_dir_entry { | ||
64 | __fs32 de_inode; | ||
65 | __u8 de_size; | ||
66 | char de_fname[QNX6_SHORT_NAME_MAX]; | ||
67 | }; | ||
68 | |||
69 | /* | ||
70 | * Longfilename direntries have a different structure | ||
71 | */ | ||
72 | struct qnx6_long_dir_entry { | ||
73 | __fs32 de_inode; | ||
74 | __u8 de_size; | ||
75 | __u8 de_unknown[3]; | ||
76 | __fs32 de_long_inode; | ||
77 | __fs32 de_checksum; | ||
78 | }; | ||
79 | |||
80 | struct qnx6_long_filename { | ||
81 | __fs16 lf_size; | ||
82 | __u8 lf_fname[QNX6_LONG_NAME_MAX]; | ||
83 | }; | ||
84 | |||
85 | struct qnx6_root_node { | ||
86 | __fs64 size; | ||
87 | __fs32 ptr[QNX6_NO_DIRECT_POINTERS]; | ||
88 | __u8 levels; | ||
89 | __u8 mode; | ||
90 | __u8 spare[6]; | ||
91 | }; | ||
92 | |||
93 | struct qnx6_super_block { | ||
94 | __fs32 sb_magic; | ||
95 | __fs32 sb_checksum; | ||
96 | __fs64 sb_serial; | ||
97 | __fs32 sb_ctime; /* time the fs was created */ | ||
98 | __fs32 sb_atime; /* last access time */ | ||
99 | __fs32 sb_flags; | ||
100 | __fs16 sb_version1; /* filesystem version information */ | ||
101 | __fs16 sb_version2; /* filesystem version information */ | ||
102 | __u8 sb_volumeid[16]; | ||
103 | __fs32 sb_blocksize; | ||
104 | __fs32 sb_num_inodes; | ||
105 | __fs32 sb_free_inodes; | ||
106 | __fs32 sb_num_blocks; | ||
107 | __fs32 sb_free_blocks; | ||
108 | __fs32 sb_allocgroup; | ||
109 | struct qnx6_root_node Inode; | ||
110 | struct qnx6_root_node Bitmap; | ||
111 | struct qnx6_root_node Longfile; | ||
112 | struct qnx6_root_node Unknown; | ||
113 | }; | ||
114 | |||
115 | /* Audi MMI 3G superblock layout is different to plain qnx6 */ | ||
116 | struct qnx6_mmi_super_block { | ||
117 | __fs32 sb_magic; | ||
118 | __fs32 sb_checksum; | ||
119 | __fs64 sb_serial; | ||
120 | __u8 sb_spare0[12]; | ||
121 | __u8 sb_id[12]; | ||
122 | __fs32 sb_blocksize; | ||
123 | __fs32 sb_num_inodes; | ||
124 | __fs32 sb_free_inodes; | ||
125 | __fs32 sb_num_blocks; | ||
126 | __fs32 sb_free_blocks; | ||
127 | __u8 sb_spare1[4]; | ||
128 | struct qnx6_root_node Inode; | ||
129 | struct qnx6_root_node Bitmap; | ||
130 | struct qnx6_root_node Longfile; | ||
131 | struct qnx6_root_node Unknown; | ||
132 | }; | ||
133 | |||
134 | #endif | ||
diff --git a/include/linux/radix-tree.h b/include/linux/radix-tree.h index 07e360b1b282..0d04cd69ab9b 100644 --- a/include/linux/radix-tree.h +++ b/include/linux/radix-tree.h | |||
@@ -2,6 +2,7 @@ | |||
2 | * Copyright (C) 2001 Momchil Velikov | 2 | * Copyright (C) 2001 Momchil Velikov |
3 | * Portions Copyright (C) 2001 Christoph Hellwig | 3 | * Portions Copyright (C) 2001 Christoph Hellwig |
4 | * Copyright (C) 2006 Nick Piggin | 4 | * Copyright (C) 2006 Nick Piggin |
5 | * Copyright (C) 2012 Konstantin Khlebnikov | ||
5 | * | 6 | * |
6 | * This program is free software; you can redistribute it and/or | 7 | * This program is free software; you can redistribute it and/or |
7 | * modify it under the terms of the GNU General Public License as | 8 | * modify it under the terms of the GNU General Public License as |
@@ -22,6 +23,7 @@ | |||
22 | 23 | ||
23 | #include <linux/preempt.h> | 24 | #include <linux/preempt.h> |
24 | #include <linux/types.h> | 25 | #include <linux/types.h> |
26 | #include <linux/bug.h> | ||
25 | #include <linux/kernel.h> | 27 | #include <linux/kernel.h> |
26 | #include <linux/rcupdate.h> | 28 | #include <linux/rcupdate.h> |
27 | 29 | ||
@@ -256,4 +258,199 @@ static inline void radix_tree_preload_end(void) | |||
256 | preempt_enable(); | 258 | preempt_enable(); |
257 | } | 259 | } |
258 | 260 | ||
261 | /** | ||
262 | * struct radix_tree_iter - radix tree iterator state | ||
263 | * | ||
264 | * @index: index of current slot | ||
265 | * @next_index: next-to-last index for this chunk | ||
266 | * @tags: bit-mask for tag-iterating | ||
267 | * | ||
268 | * This radix tree iterator works in terms of "chunks" of slots. A chunk is a | ||
269 | * subinterval of slots contained within one radix tree leaf node. It is | ||
270 | * described by a pointer to its first slot and a struct radix_tree_iter | ||
271 | * which holds the chunk's position in the tree and its size. For tagged | ||
272 | * iteration radix_tree_iter also holds the slots' bit-mask for one chosen | ||
273 | * radix tree tag. | ||
274 | */ | ||
275 | struct radix_tree_iter { | ||
276 | unsigned long index; | ||
277 | unsigned long next_index; | ||
278 | unsigned long tags; | ||
279 | }; | ||
280 | |||
281 | #define RADIX_TREE_ITER_TAG_MASK 0x00FF /* tag index in lower byte */ | ||
282 | #define RADIX_TREE_ITER_TAGGED 0x0100 /* lookup tagged slots */ | ||
283 | #define RADIX_TREE_ITER_CONTIG 0x0200 /* stop at first hole */ | ||
284 | |||
285 | /** | ||
286 | * radix_tree_iter_init - initialize radix tree iterator | ||
287 | * | ||
288 | * @iter: pointer to iterator state | ||
289 | * @start: iteration starting index | ||
290 | * Returns: NULL | ||
291 | */ | ||
292 | static __always_inline void ** | ||
293 | radix_tree_iter_init(struct radix_tree_iter *iter, unsigned long start) | ||
294 | { | ||
295 | /* | ||
296 | * Leave iter->tags uninitialized. radix_tree_next_chunk() will fill it | ||
297 | * in the case of a successful tagged chunk lookup. If the lookup was | ||
298 | * unsuccessful or non-tagged then nobody cares about ->tags. | ||
299 | * | ||
300 | * Set index to zero to bypass next_index overflow protection. | ||
301 | * See the comment in radix_tree_next_chunk() for details. | ||
302 | */ | ||
303 | iter->index = 0; | ||
304 | iter->next_index = start; | ||
305 | return NULL; | ||
306 | } | ||
307 | |||
308 | /** | ||
309 | * radix_tree_next_chunk - find next chunk of slots for iteration | ||
310 | * | ||
311 | * @root: radix tree root | ||
312 | * @iter: iterator state | ||
313 | * @flags: RADIX_TREE_ITER_* flags and tag index | ||
314 | * Returns: pointer to chunk first slot, or NULL if there no more left | ||
315 | * | ||
316 | * This function looks up the next chunk in the radix tree starting from | ||
317 | * @iter->next_index. It returns a pointer to the chunk's first slot. | ||
318 | * Also it fills @iter with data about chunk: position in the tree (index), | ||
319 | * its end (next_index), and constructs a bit mask for tagged iterating (tags). | ||
320 | */ | ||
321 | void **radix_tree_next_chunk(struct radix_tree_root *root, | ||
322 | struct radix_tree_iter *iter, unsigned flags); | ||
323 | |||
324 | /** | ||
325 | * radix_tree_chunk_size - get current chunk size | ||
326 | * | ||
327 | * @iter: pointer to radix tree iterator | ||
328 | * Returns: current chunk size | ||
329 | */ | ||
330 | static __always_inline unsigned | ||
331 | radix_tree_chunk_size(struct radix_tree_iter *iter) | ||
332 | { | ||
333 | return iter->next_index - iter->index; | ||
334 | } | ||
335 | |||
336 | /** | ||
337 | * radix_tree_next_slot - find next slot in chunk | ||
338 | * | ||
339 | * @slot: pointer to current slot | ||
340 | * @iter: pointer to interator state | ||
341 | * @flags: RADIX_TREE_ITER_*, should be constant | ||
342 | * Returns: pointer to next slot, or NULL if there no more left | ||
343 | * | ||
344 | * This function updates @iter->index in the case of a successful lookup. | ||
345 | * For tagged lookup it also eats @iter->tags. | ||
346 | */ | ||
347 | static __always_inline void ** | ||
348 | radix_tree_next_slot(void **slot, struct radix_tree_iter *iter, unsigned flags) | ||
349 | { | ||
350 | if (flags & RADIX_TREE_ITER_TAGGED) { | ||
351 | iter->tags >>= 1; | ||
352 | if (likely(iter->tags & 1ul)) { | ||
353 | iter->index++; | ||
354 | return slot + 1; | ||
355 | } | ||
356 | if (!(flags & RADIX_TREE_ITER_CONTIG) && likely(iter->tags)) { | ||
357 | unsigned offset = __ffs(iter->tags); | ||
358 | |||
359 | iter->tags >>= offset; | ||
360 | iter->index += offset + 1; | ||
361 | return slot + offset + 1; | ||
362 | } | ||
363 | } else { | ||
364 | unsigned size = radix_tree_chunk_size(iter) - 1; | ||
365 | |||
366 | while (size--) { | ||
367 | slot++; | ||
368 | iter->index++; | ||
369 | if (likely(*slot)) | ||
370 | return slot; | ||
371 | if (flags & RADIX_TREE_ITER_CONTIG) | ||
372 | break; | ||
373 | } | ||
374 | } | ||
375 | return NULL; | ||
376 | } | ||
377 | |||
378 | /** | ||
379 | * radix_tree_for_each_chunk - iterate over chunks | ||
380 | * | ||
381 | * @slot: the void** variable for pointer to chunk first slot | ||
382 | * @root: the struct radix_tree_root pointer | ||
383 | * @iter: the struct radix_tree_iter pointer | ||
384 | * @start: iteration starting index | ||
385 | * @flags: RADIX_TREE_ITER_* and tag index | ||
386 | * | ||
387 | * Locks can be released and reacquired between iterations. | ||
388 | */ | ||
389 | #define radix_tree_for_each_chunk(slot, root, iter, start, flags) \ | ||
390 | for (slot = radix_tree_iter_init(iter, start) ; \ | ||
391 | (slot = radix_tree_next_chunk(root, iter, flags)) ;) | ||
392 | |||
393 | /** | ||
394 | * radix_tree_for_each_chunk_slot - iterate over slots in one chunk | ||
395 | * | ||
396 | * @slot: the void** variable, at the beginning points to chunk first slot | ||
397 | * @iter: the struct radix_tree_iter pointer | ||
398 | * @flags: RADIX_TREE_ITER_*, should be constant | ||
399 | * | ||
400 | * This macro is designed to be nested inside radix_tree_for_each_chunk(). | ||
401 | * @slot points to the radix tree slot, @iter->index contains its index. | ||
402 | */ | ||
403 | #define radix_tree_for_each_chunk_slot(slot, iter, flags) \ | ||
404 | for (; slot ; slot = radix_tree_next_slot(slot, iter, flags)) | ||
405 | |||
406 | /** | ||
407 | * radix_tree_for_each_slot - iterate over non-empty slots | ||
408 | * | ||
409 | * @slot: the void** variable for pointer to slot | ||
410 | * @root: the struct radix_tree_root pointer | ||
411 | * @iter: the struct radix_tree_iter pointer | ||
412 | * @start: iteration starting index | ||
413 | * | ||
414 | * @slot points to radix tree slot, @iter->index contains its index. | ||
415 | */ | ||
416 | #define radix_tree_for_each_slot(slot, root, iter, start) \ | ||
417 | for (slot = radix_tree_iter_init(iter, start) ; \ | ||
418 | slot || (slot = radix_tree_next_chunk(root, iter, 0)) ; \ | ||
419 | slot = radix_tree_next_slot(slot, iter, 0)) | ||
420 | |||
421 | /** | ||
422 | * radix_tree_for_each_contig - iterate over contiguous slots | ||
423 | * | ||
424 | * @slot: the void** variable for pointer to slot | ||
425 | * @root: the struct radix_tree_root pointer | ||
426 | * @iter: the struct radix_tree_iter pointer | ||
427 | * @start: iteration starting index | ||
428 | * | ||
429 | * @slot points to radix tree slot, @iter->index contains its index. | ||
430 | */ | ||
431 | #define radix_tree_for_each_contig(slot, root, iter, start) \ | ||
432 | for (slot = radix_tree_iter_init(iter, start) ; \ | ||
433 | slot || (slot = radix_tree_next_chunk(root, iter, \ | ||
434 | RADIX_TREE_ITER_CONTIG)) ; \ | ||
435 | slot = radix_tree_next_slot(slot, iter, \ | ||
436 | RADIX_TREE_ITER_CONTIG)) | ||
437 | |||
438 | /** | ||
439 | * radix_tree_for_each_tagged - iterate over tagged slots | ||
440 | * | ||
441 | * @slot: the void** variable for pointer to slot | ||
442 | * @root: the struct radix_tree_root pointer | ||
443 | * @iter: the struct radix_tree_iter pointer | ||
444 | * @start: iteration starting index | ||
445 | * @tag: tag index | ||
446 | * | ||
447 | * @slot points to radix tree slot, @iter->index contains its index. | ||
448 | */ | ||
449 | #define radix_tree_for_each_tagged(slot, root, iter, start, tag) \ | ||
450 | for (slot = radix_tree_iter_init(iter, start) ; \ | ||
451 | slot || (slot = radix_tree_next_chunk(root, iter, \ | ||
452 | RADIX_TREE_ITER_TAGGED | tag)) ; \ | ||
453 | slot = radix_tree_next_slot(slot, iter, \ | ||
454 | RADIX_TREE_ITER_TAGGED)) | ||
455 | |||
259 | #endif /* _LINUX_RADIX_TREE_H */ | 456 | #endif /* _LINUX_RADIX_TREE_H */ |
diff --git a/include/linux/raid/md_p.h b/include/linux/raid/md_p.h index 6f6df86f1ae5..8c0a3adc5df5 100644 --- a/include/linux/raid/md_p.h +++ b/include/linux/raid/md_p.h | |||
@@ -281,6 +281,10 @@ struct mdp_superblock_1 { | |||
281 | * active device with same 'role'. | 281 | * active device with same 'role'. |
282 | * 'recovery_offset' is also set. | 282 | * 'recovery_offset' is also set. |
283 | */ | 283 | */ |
284 | #define MD_FEATURE_ALL (1|2|4|8|16) | 284 | #define MD_FEATURE_ALL (MD_FEATURE_BITMAP_OFFSET \ |
285 | |MD_FEATURE_RECOVERY_OFFSET \ | ||
286 | |MD_FEATURE_RESHAPE_ACTIVE \ | ||
287 | |MD_FEATURE_BAD_BLOCKS \ | ||
288 | |MD_FEATURE_REPLACEMENT) | ||
285 | 289 | ||
286 | #endif | 290 | #endif |
diff --git a/include/linux/rar_register.h b/include/linux/rar_register.h deleted file mode 100644 index 5c6118189363..000000000000 --- a/include/linux/rar_register.h +++ /dev/null | |||
@@ -1,60 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2010 Intel Corporation. All rights reserved. | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or | ||
5 | * modify it under the terms of version 2 of the GNU General | ||
6 | * Public License as published by the Free Software Foundation. | ||
7 | * | ||
8 | * This program is distributed in the hope that it will be | ||
9 | * useful, but WITHOUT ANY WARRANTY; without even the implied | ||
10 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR | ||
11 | * PURPOSE. See the GNU General Public License for more details. | ||
12 | * You should have received a copy of the GNU General Public | ||
13 | * License along with this program; if not, write to the Free | ||
14 | * Software Foundation, Inc., 59 Temple Place - Suite 330, | ||
15 | * Boston, MA 02111-1307, USA. | ||
16 | * The full GNU General Public License is included in this | ||
17 | * distribution in the file called COPYING. | ||
18 | */ | ||
19 | |||
20 | |||
21 | #ifndef _RAR_REGISTER_H | ||
22 | #define _RAR_REGISTER_H | ||
23 | |||
24 | #include <linux/types.h> | ||
25 | |||
26 | /* following are used both in drivers as well as user space apps */ | ||
27 | |||
28 | #define RAR_TYPE_VIDEO 0 | ||
29 | #define RAR_TYPE_AUDIO 1 | ||
30 | #define RAR_TYPE_IMAGE 2 | ||
31 | #define RAR_TYPE_DATA 3 | ||
32 | |||
33 | #ifdef __KERNEL__ | ||
34 | |||
35 | struct rar_device; | ||
36 | |||
37 | #if defined(CONFIG_RAR_REGISTER) | ||
38 | int register_rar(int num, | ||
39 | int (*callback)(unsigned long data), unsigned long data); | ||
40 | void unregister_rar(int num); | ||
41 | int rar_get_address(int rar_index, dma_addr_t *start, dma_addr_t *end); | ||
42 | int rar_lock(int rar_index); | ||
43 | #else | ||
44 | extern void unregister_rar(int num) { } | ||
45 | extern int rar_lock(int rar_index) { return -EIO; } | ||
46 | |||
47 | extern inline int register_rar(int num, | ||
48 | int (*callback)(unsigned long data), unsigned long data) | ||
49 | { | ||
50 | return -ENODEV; | ||
51 | } | ||
52 | |||
53 | extern int rar_get_address(int rar_index, dma_addr_t *start, dma_addr_t *end) | ||
54 | { | ||
55 | return -ENODEV; | ||
56 | } | ||
57 | #endif /* RAR_REGISTER */ | ||
58 | |||
59 | #endif /* __KERNEL__ */ | ||
60 | #endif /* _RAR_REGISTER_H */ | ||
diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h index 81c04f4348ec..20fb776a1d4a 100644 --- a/include/linux/rcupdate.h +++ b/include/linux/rcupdate.h | |||
@@ -42,6 +42,7 @@ | |||
42 | #include <linux/lockdep.h> | 42 | #include <linux/lockdep.h> |
43 | #include <linux/completion.h> | 43 | #include <linux/completion.h> |
44 | #include <linux/debugobjects.h> | 44 | #include <linux/debugobjects.h> |
45 | #include <linux/bug.h> | ||
45 | #include <linux/compiler.h> | 46 | #include <linux/compiler.h> |
46 | 47 | ||
47 | #ifdef CONFIG_RCU_TORTURE_TEST | 48 | #ifdef CONFIG_RCU_TORTURE_TEST |
@@ -190,6 +191,33 @@ extern void rcu_idle_exit(void); | |||
190 | extern void rcu_irq_enter(void); | 191 | extern void rcu_irq_enter(void); |
191 | extern void rcu_irq_exit(void); | 192 | extern void rcu_irq_exit(void); |
192 | 193 | ||
194 | /** | ||
195 | * RCU_NONIDLE - Indicate idle-loop code that needs RCU readers | ||
196 | * @a: Code that RCU needs to pay attention to. | ||
197 | * | ||
198 | * RCU, RCU-bh, and RCU-sched read-side critical sections are forbidden | ||
199 | * in the inner idle loop, that is, between the rcu_idle_enter() and | ||
200 | * the rcu_idle_exit() -- RCU will happily ignore any such read-side | ||
201 | * critical sections. However, things like powertop need tracepoints | ||
202 | * in the inner idle loop. | ||
203 | * | ||
204 | * This macro provides the way out: RCU_NONIDLE(do_something_with_RCU()) | ||
205 | * will tell RCU that it needs to pay attending, invoke its argument | ||
206 | * (in this example, a call to the do_something_with_RCU() function), | ||
207 | * and then tell RCU to go back to ignoring this CPU. It is permissible | ||
208 | * to nest RCU_NONIDLE() wrappers, but the nesting level is currently | ||
209 | * quite limited. If deeper nesting is required, it will be necessary | ||
210 | * to adjust DYNTICK_TASK_NESTING_VALUE accordingly. | ||
211 | * | ||
212 | * This macro may be used from process-level code only. | ||
213 | */ | ||
214 | #define RCU_NONIDLE(a) \ | ||
215 | do { \ | ||
216 | rcu_idle_exit(); \ | ||
217 | do { a; } while (0); \ | ||
218 | rcu_idle_enter(); \ | ||
219 | } while (0) | ||
220 | |||
193 | /* | 221 | /* |
194 | * Infrastructure to implement the synchronize_() primitives in | 222 | * Infrastructure to implement the synchronize_() primitives in |
195 | * TREE_RCU and rcu_barrier_() primitives in TINY_RCU. | 223 | * TREE_RCU and rcu_barrier_() primitives in TINY_RCU. |
@@ -226,6 +254,15 @@ static inline void destroy_rcu_head_on_stack(struct rcu_head *head) | |||
226 | } | 254 | } |
227 | #endif /* #else !CONFIG_DEBUG_OBJECTS_RCU_HEAD */ | 255 | #endif /* #else !CONFIG_DEBUG_OBJECTS_RCU_HEAD */ |
228 | 256 | ||
257 | #if defined(CONFIG_HOTPLUG_CPU) && defined(CONFIG_PROVE_RCU) | ||
258 | bool rcu_lockdep_current_cpu_online(void); | ||
259 | #else /* #if defined(CONFIG_HOTPLUG_CPU) && defined(CONFIG_PROVE_RCU) */ | ||
260 | static inline bool rcu_lockdep_current_cpu_online(void) | ||
261 | { | ||
262 | return 1; | ||
263 | } | ||
264 | #endif /* #else #if defined(CONFIG_HOTPLUG_CPU) && defined(CONFIG_PROVE_RCU) */ | ||
265 | |||
229 | #ifdef CONFIG_DEBUG_LOCK_ALLOC | 266 | #ifdef CONFIG_DEBUG_LOCK_ALLOC |
230 | 267 | ||
231 | #ifdef CONFIG_PROVE_RCU | 268 | #ifdef CONFIG_PROVE_RCU |
@@ -239,13 +276,11 @@ static inline int rcu_is_cpu_idle(void) | |||
239 | 276 | ||
240 | static inline void rcu_lock_acquire(struct lockdep_map *map) | 277 | static inline void rcu_lock_acquire(struct lockdep_map *map) |
241 | { | 278 | { |
242 | WARN_ON_ONCE(rcu_is_cpu_idle()); | ||
243 | lock_acquire(map, 0, 0, 2, 1, NULL, _THIS_IP_); | 279 | lock_acquire(map, 0, 0, 2, 1, NULL, _THIS_IP_); |
244 | } | 280 | } |
245 | 281 | ||
246 | static inline void rcu_lock_release(struct lockdep_map *map) | 282 | static inline void rcu_lock_release(struct lockdep_map *map) |
247 | { | 283 | { |
248 | WARN_ON_ONCE(rcu_is_cpu_idle()); | ||
249 | lock_release(map, 1, _THIS_IP_); | 284 | lock_release(map, 1, _THIS_IP_); |
250 | } | 285 | } |
251 | 286 | ||
@@ -270,6 +305,9 @@ extern int debug_lockdep_rcu_enabled(void); | |||
270 | * occur in the same context, for example, it is illegal to invoke | 305 | * occur in the same context, for example, it is illegal to invoke |
271 | * rcu_read_unlock() in process context if the matching rcu_read_lock() | 306 | * rcu_read_unlock() in process context if the matching rcu_read_lock() |
272 | * was invoked from within an irq handler. | 307 | * was invoked from within an irq handler. |
308 | * | ||
309 | * Note that rcu_read_lock() is disallowed if the CPU is either idle or | ||
310 | * offline from an RCU perspective, so check for those as well. | ||
273 | */ | 311 | */ |
274 | static inline int rcu_read_lock_held(void) | 312 | static inline int rcu_read_lock_held(void) |
275 | { | 313 | { |
@@ -277,6 +315,8 @@ static inline int rcu_read_lock_held(void) | |||
277 | return 1; | 315 | return 1; |
278 | if (rcu_is_cpu_idle()) | 316 | if (rcu_is_cpu_idle()) |
279 | return 0; | 317 | return 0; |
318 | if (!rcu_lockdep_current_cpu_online()) | ||
319 | return 0; | ||
280 | return lock_is_held(&rcu_lock_map); | 320 | return lock_is_held(&rcu_lock_map); |
281 | } | 321 | } |
282 | 322 | ||
@@ -313,6 +353,9 @@ extern int rcu_read_lock_bh_held(void); | |||
313 | * notice an extended quiescent state to other CPUs that started a grace | 353 | * notice an extended quiescent state to other CPUs that started a grace |
314 | * period. Otherwise we would delay any grace period as long as we run in | 354 | * period. Otherwise we would delay any grace period as long as we run in |
315 | * the idle task. | 355 | * the idle task. |
356 | * | ||
357 | * Similarly, we avoid claiming an SRCU read lock held if the current | ||
358 | * CPU is offline. | ||
316 | */ | 359 | */ |
317 | #ifdef CONFIG_PREEMPT_COUNT | 360 | #ifdef CONFIG_PREEMPT_COUNT |
318 | static inline int rcu_read_lock_sched_held(void) | 361 | static inline int rcu_read_lock_sched_held(void) |
@@ -323,6 +366,8 @@ static inline int rcu_read_lock_sched_held(void) | |||
323 | return 1; | 366 | return 1; |
324 | if (rcu_is_cpu_idle()) | 367 | if (rcu_is_cpu_idle()) |
325 | return 0; | 368 | return 0; |
369 | if (!rcu_lockdep_current_cpu_online()) | ||
370 | return 0; | ||
326 | if (debug_locks) | 371 | if (debug_locks) |
327 | lockdep_opinion = lock_is_held(&rcu_sched_lock_map); | 372 | lockdep_opinion = lock_is_held(&rcu_sched_lock_map); |
328 | return lockdep_opinion || preempt_count() != 0 || irqs_disabled(); | 373 | return lockdep_opinion || preempt_count() != 0 || irqs_disabled(); |
@@ -374,15 +419,29 @@ extern int rcu_my_thread_group_empty(void); | |||
374 | */ | 419 | */ |
375 | #define rcu_lockdep_assert(c, s) \ | 420 | #define rcu_lockdep_assert(c, s) \ |
376 | do { \ | 421 | do { \ |
377 | static bool __warned; \ | 422 | static bool __section(.data.unlikely) __warned; \ |
378 | if (debug_lockdep_rcu_enabled() && !__warned && !(c)) { \ | 423 | if (debug_lockdep_rcu_enabled() && !__warned && !(c)) { \ |
379 | __warned = true; \ | 424 | __warned = true; \ |
380 | lockdep_rcu_suspicious(__FILE__, __LINE__, s); \ | 425 | lockdep_rcu_suspicious(__FILE__, __LINE__, s); \ |
381 | } \ | 426 | } \ |
382 | } while (0) | 427 | } while (0) |
383 | 428 | ||
429 | #if defined(CONFIG_PROVE_RCU) && !defined(CONFIG_PREEMPT_RCU) | ||
430 | static inline void rcu_preempt_sleep_check(void) | ||
431 | { | ||
432 | rcu_lockdep_assert(!lock_is_held(&rcu_lock_map), | ||
433 | "Illegal context switch in RCU read-side " | ||
434 | "critical section"); | ||
435 | } | ||
436 | #else /* #ifdef CONFIG_PROVE_RCU */ | ||
437 | static inline void rcu_preempt_sleep_check(void) | ||
438 | { | ||
439 | } | ||
440 | #endif /* #else #ifdef CONFIG_PROVE_RCU */ | ||
441 | |||
384 | #define rcu_sleep_check() \ | 442 | #define rcu_sleep_check() \ |
385 | do { \ | 443 | do { \ |
444 | rcu_preempt_sleep_check(); \ | ||
386 | rcu_lockdep_assert(!lock_is_held(&rcu_bh_lock_map), \ | 445 | rcu_lockdep_assert(!lock_is_held(&rcu_bh_lock_map), \ |
387 | "Illegal context switch in RCU-bh" \ | 446 | "Illegal context switch in RCU-bh" \ |
388 | " read-side critical section"); \ | 447 | " read-side critical section"); \ |
@@ -470,6 +529,13 @@ extern int rcu_my_thread_group_empty(void); | |||
470 | * NULL. Although rcu_access_pointer() may also be used in cases where | 529 | * NULL. Although rcu_access_pointer() may also be used in cases where |
471 | * update-side locks prevent the value of the pointer from changing, you | 530 | * update-side locks prevent the value of the pointer from changing, you |
472 | * should instead use rcu_dereference_protected() for this use case. | 531 | * should instead use rcu_dereference_protected() for this use case. |
532 | * | ||
533 | * It is also permissible to use rcu_access_pointer() when read-side | ||
534 | * access to the pointer was removed at least one grace period ago, as | ||
535 | * is the case in the context of the RCU callback that is freeing up | ||
536 | * the data, or after a synchronize_rcu() returns. This can be useful | ||
537 | * when tearing down multi-linked structures after a grace period | ||
538 | * has elapsed. | ||
473 | */ | 539 | */ |
474 | #define rcu_access_pointer(p) __rcu_access_pointer((p), __rcu) | 540 | #define rcu_access_pointer(p) __rcu_access_pointer((p), __rcu) |
475 | 541 | ||
@@ -659,6 +725,8 @@ static inline void rcu_read_lock(void) | |||
659 | __rcu_read_lock(); | 725 | __rcu_read_lock(); |
660 | __acquire(RCU); | 726 | __acquire(RCU); |
661 | rcu_lock_acquire(&rcu_lock_map); | 727 | rcu_lock_acquire(&rcu_lock_map); |
728 | rcu_lockdep_assert(!rcu_is_cpu_idle(), | ||
729 | "rcu_read_lock() used illegally while idle"); | ||
662 | } | 730 | } |
663 | 731 | ||
664 | /* | 732 | /* |
@@ -678,6 +746,8 @@ static inline void rcu_read_lock(void) | |||
678 | */ | 746 | */ |
679 | static inline void rcu_read_unlock(void) | 747 | static inline void rcu_read_unlock(void) |
680 | { | 748 | { |
749 | rcu_lockdep_assert(!rcu_is_cpu_idle(), | ||
750 | "rcu_read_unlock() used illegally while idle"); | ||
681 | rcu_lock_release(&rcu_lock_map); | 751 | rcu_lock_release(&rcu_lock_map); |
682 | __release(RCU); | 752 | __release(RCU); |
683 | __rcu_read_unlock(); | 753 | __rcu_read_unlock(); |
@@ -705,6 +775,8 @@ static inline void rcu_read_lock_bh(void) | |||
705 | local_bh_disable(); | 775 | local_bh_disable(); |
706 | __acquire(RCU_BH); | 776 | __acquire(RCU_BH); |
707 | rcu_lock_acquire(&rcu_bh_lock_map); | 777 | rcu_lock_acquire(&rcu_bh_lock_map); |
778 | rcu_lockdep_assert(!rcu_is_cpu_idle(), | ||
779 | "rcu_read_lock_bh() used illegally while idle"); | ||
708 | } | 780 | } |
709 | 781 | ||
710 | /* | 782 | /* |
@@ -714,6 +786,8 @@ static inline void rcu_read_lock_bh(void) | |||
714 | */ | 786 | */ |
715 | static inline void rcu_read_unlock_bh(void) | 787 | static inline void rcu_read_unlock_bh(void) |
716 | { | 788 | { |
789 | rcu_lockdep_assert(!rcu_is_cpu_idle(), | ||
790 | "rcu_read_unlock_bh() used illegally while idle"); | ||
717 | rcu_lock_release(&rcu_bh_lock_map); | 791 | rcu_lock_release(&rcu_bh_lock_map); |
718 | __release(RCU_BH); | 792 | __release(RCU_BH); |
719 | local_bh_enable(); | 793 | local_bh_enable(); |
@@ -737,6 +811,8 @@ static inline void rcu_read_lock_sched(void) | |||
737 | preempt_disable(); | 811 | preempt_disable(); |
738 | __acquire(RCU_SCHED); | 812 | __acquire(RCU_SCHED); |
739 | rcu_lock_acquire(&rcu_sched_lock_map); | 813 | rcu_lock_acquire(&rcu_sched_lock_map); |
814 | rcu_lockdep_assert(!rcu_is_cpu_idle(), | ||
815 | "rcu_read_lock_sched() used illegally while idle"); | ||
740 | } | 816 | } |
741 | 817 | ||
742 | /* Used by lockdep and tracing: cannot be traced, cannot call lockdep. */ | 818 | /* Used by lockdep and tracing: cannot be traced, cannot call lockdep. */ |
@@ -753,6 +829,8 @@ static inline notrace void rcu_read_lock_sched_notrace(void) | |||
753 | */ | 829 | */ |
754 | static inline void rcu_read_unlock_sched(void) | 830 | static inline void rcu_read_unlock_sched(void) |
755 | { | 831 | { |
832 | rcu_lockdep_assert(!rcu_is_cpu_idle(), | ||
833 | "rcu_read_unlock_sched() used illegally while idle"); | ||
756 | rcu_lock_release(&rcu_sched_lock_map); | 834 | rcu_lock_release(&rcu_sched_lock_map); |
757 | __release(RCU_SCHED); | 835 | __release(RCU_SCHED); |
758 | preempt_enable(); | 836 | preempt_enable(); |
@@ -841,7 +919,7 @@ void __kfree_rcu(struct rcu_head *head, unsigned long offset) | |||
841 | /* See the kfree_rcu() header comment. */ | 919 | /* See the kfree_rcu() header comment. */ |
842 | BUILD_BUG_ON(!__is_kfree_rcu_offset(offset)); | 920 | BUILD_BUG_ON(!__is_kfree_rcu_offset(offset)); |
843 | 921 | ||
844 | call_rcu(head, (rcu_callback)offset); | 922 | kfree_call_rcu(head, (rcu_callback)offset); |
845 | } | 923 | } |
846 | 924 | ||
847 | /** | 925 | /** |
diff --git a/include/linux/rcutiny.h b/include/linux/rcutiny.h index 00b7a5e493d2..e93df77176d1 100644 --- a/include/linux/rcutiny.h +++ b/include/linux/rcutiny.h | |||
@@ -27,13 +27,9 @@ | |||
27 | 27 | ||
28 | #include <linux/cache.h> | 28 | #include <linux/cache.h> |
29 | 29 | ||
30 | #ifdef CONFIG_RCU_BOOST | ||
31 | static inline void rcu_init(void) | 30 | static inline void rcu_init(void) |
32 | { | 31 | { |
33 | } | 32 | } |
34 | #else /* #ifdef CONFIG_RCU_BOOST */ | ||
35 | void rcu_init(void); | ||
36 | #endif /* #else #ifdef CONFIG_RCU_BOOST */ | ||
37 | 33 | ||
38 | static inline void rcu_barrier_bh(void) | 34 | static inline void rcu_barrier_bh(void) |
39 | { | 35 | { |
@@ -83,6 +79,12 @@ static inline void synchronize_sched_expedited(void) | |||
83 | synchronize_sched(); | 79 | synchronize_sched(); |
84 | } | 80 | } |
85 | 81 | ||
82 | static inline void kfree_call_rcu(struct rcu_head *head, | ||
83 | void (*func)(struct rcu_head *rcu)) | ||
84 | { | ||
85 | call_rcu(head, func); | ||
86 | } | ||
87 | |||
86 | #ifdef CONFIG_TINY_RCU | 88 | #ifdef CONFIG_TINY_RCU |
87 | 89 | ||
88 | static inline void rcu_preempt_note_context_switch(void) | 90 | static inline void rcu_preempt_note_context_switch(void) |
diff --git a/include/linux/rcutree.h b/include/linux/rcutree.h index 67458468f1a8..e8ee5dd0854c 100644 --- a/include/linux/rcutree.h +++ b/include/linux/rcutree.h | |||
@@ -61,6 +61,24 @@ extern void synchronize_rcu_bh(void); | |||
61 | extern void synchronize_sched_expedited(void); | 61 | extern void synchronize_sched_expedited(void); |
62 | extern void synchronize_rcu_expedited(void); | 62 | extern void synchronize_rcu_expedited(void); |
63 | 63 | ||
64 | void kfree_call_rcu(struct rcu_head *head, void (*func)(struct rcu_head *rcu)); | ||
65 | |||
66 | /** | ||
67 | * synchronize_rcu_bh_expedited - Brute-force RCU-bh grace period | ||
68 | * | ||
69 | * Wait for an RCU-bh grace period to elapse, but use a "big hammer" | ||
70 | * approach to force the grace period to end quickly. This consumes | ||
71 | * significant time on all CPUs and is unfriendly to real-time workloads, | ||
72 | * so is thus not recommended for any sort of common-case code. In fact, | ||
73 | * if you are using synchronize_rcu_bh_expedited() in a loop, please | ||
74 | * restructure your code to batch your updates, and then use a single | ||
75 | * synchronize_rcu_bh() instead. | ||
76 | * | ||
77 | * Note that it is illegal to call this function while holding any lock | ||
78 | * that is acquired by a CPU-hotplug notifier. And yes, it is also illegal | ||
79 | * to call this function from a CPU-hotplug notifier. Failing to observe | ||
80 | * these restriction will result in deadlock. | ||
81 | */ | ||
64 | static inline void synchronize_rcu_bh_expedited(void) | 82 | static inline void synchronize_rcu_bh_expedited(void) |
65 | { | 83 | { |
66 | synchronize_sched_expedited(); | 84 | synchronize_sched_expedited(); |
@@ -83,6 +101,7 @@ extern void rcu_sched_force_quiescent_state(void); | |||
83 | /* A context switch is a grace period for RCU-sched and RCU-bh. */ | 101 | /* A context switch is a grace period for RCU-sched and RCU-bh. */ |
84 | static inline int rcu_blocking_is_gp(void) | 102 | static inline int rcu_blocking_is_gp(void) |
85 | { | 103 | { |
104 | might_sleep(); /* Check for RCU read-side critical section. */ | ||
86 | return num_online_cpus() == 1; | 105 | return num_online_cpus() == 1; |
87 | } | 106 | } |
88 | 107 | ||
diff --git a/include/linux/regmap.h b/include/linux/regmap.h index eb93921cdd30..a90abb6bfa64 100644 --- a/include/linux/regmap.h +++ b/include/linux/regmap.h | |||
@@ -13,12 +13,13 @@ | |||
13 | * published by the Free Software Foundation. | 13 | * published by the Free Software Foundation. |
14 | */ | 14 | */ |
15 | 15 | ||
16 | #include <linux/device.h> | ||
17 | #include <linux/list.h> | 16 | #include <linux/list.h> |
18 | 17 | ||
19 | struct module; | 18 | struct module; |
19 | struct device; | ||
20 | struct i2c_client; | 20 | struct i2c_client; |
21 | struct spi_device; | 21 | struct spi_device; |
22 | struct regmap; | ||
22 | 23 | ||
23 | /* An enum of all the supported cache types */ | 24 | /* An enum of all the supported cache types */ |
24 | enum regcache_type { | 25 | enum regcache_type { |
@@ -40,10 +41,13 @@ struct reg_default { | |||
40 | unsigned int def; | 41 | unsigned int def; |
41 | }; | 42 | }; |
42 | 43 | ||
44 | #ifdef CONFIG_REGMAP | ||
45 | |||
43 | /** | 46 | /** |
44 | * Configuration for the register map of a device. | 47 | * Configuration for the register map of a device. |
45 | * | 48 | * |
46 | * @reg_bits: Number of bits in a register address, mandatory. | 49 | * @reg_bits: Number of bits in a register address, mandatory. |
50 | * @pad_bits: Number of bits of padding between register and value. | ||
47 | * @val_bits: Number of bits in a register value, mandatory. | 51 | * @val_bits: Number of bits in a register value, mandatory. |
48 | * | 52 | * |
49 | * @writeable_reg: Optional callback returning true if the register | 53 | * @writeable_reg: Optional callback returning true if the register |
@@ -74,6 +78,7 @@ struct reg_default { | |||
74 | */ | 78 | */ |
75 | struct regmap_config { | 79 | struct regmap_config { |
76 | int reg_bits; | 80 | int reg_bits; |
81 | int pad_bits; | ||
77 | int val_bits; | 82 | int val_bits; |
78 | 83 | ||
79 | bool (*writeable_reg)(struct device *dev, unsigned int reg); | 84 | bool (*writeable_reg)(struct device *dev, unsigned int reg); |
@@ -127,12 +132,22 @@ struct regmap *regmap_init_i2c(struct i2c_client *i2c, | |||
127 | struct regmap *regmap_init_spi(struct spi_device *dev, | 132 | struct regmap *regmap_init_spi(struct spi_device *dev, |
128 | const struct regmap_config *config); | 133 | const struct regmap_config *config); |
129 | 134 | ||
135 | struct regmap *devm_regmap_init(struct device *dev, | ||
136 | const struct regmap_bus *bus, | ||
137 | const struct regmap_config *config); | ||
138 | struct regmap *devm_regmap_init_i2c(struct i2c_client *i2c, | ||
139 | const struct regmap_config *config); | ||
140 | struct regmap *devm_regmap_init_spi(struct spi_device *dev, | ||
141 | const struct regmap_config *config); | ||
142 | |||
130 | void regmap_exit(struct regmap *map); | 143 | void regmap_exit(struct regmap *map); |
131 | int regmap_reinit_cache(struct regmap *map, | 144 | int regmap_reinit_cache(struct regmap *map, |
132 | const struct regmap_config *config); | 145 | const struct regmap_config *config); |
133 | int regmap_write(struct regmap *map, unsigned int reg, unsigned int val); | 146 | int regmap_write(struct regmap *map, unsigned int reg, unsigned int val); |
134 | int regmap_raw_write(struct regmap *map, unsigned int reg, | 147 | int regmap_raw_write(struct regmap *map, unsigned int reg, |
135 | const void *val, size_t val_len); | 148 | const void *val, size_t val_len); |
149 | int regmap_bulk_write(struct regmap *map, unsigned int reg, const void *val, | ||
150 | size_t val_count); | ||
136 | int regmap_read(struct regmap *map, unsigned int reg, unsigned int *val); | 151 | int regmap_read(struct regmap *map, unsigned int reg, unsigned int *val); |
137 | int regmap_raw_read(struct regmap *map, unsigned int reg, | 152 | int regmap_raw_read(struct regmap *map, unsigned int reg, |
138 | void *val, size_t val_len); | 153 | void *val, size_t val_len); |
@@ -143,12 +158,18 @@ int regmap_update_bits(struct regmap *map, unsigned int reg, | |||
143 | int regmap_update_bits_check(struct regmap *map, unsigned int reg, | 158 | int regmap_update_bits_check(struct regmap *map, unsigned int reg, |
144 | unsigned int mask, unsigned int val, | 159 | unsigned int mask, unsigned int val, |
145 | bool *change); | 160 | bool *change); |
161 | int regmap_get_val_bytes(struct regmap *map); | ||
146 | 162 | ||
147 | int regcache_sync(struct regmap *map); | 163 | int regcache_sync(struct regmap *map); |
164 | int regcache_sync_region(struct regmap *map, unsigned int min, | ||
165 | unsigned int max); | ||
148 | void regcache_cache_only(struct regmap *map, bool enable); | 166 | void regcache_cache_only(struct regmap *map, bool enable); |
149 | void regcache_cache_bypass(struct regmap *map, bool enable); | 167 | void regcache_cache_bypass(struct regmap *map, bool enable); |
150 | void regcache_mark_dirty(struct regmap *map); | 168 | void regcache_mark_dirty(struct regmap *map); |
151 | 169 | ||
170 | int regmap_register_patch(struct regmap *map, const struct reg_default *regs, | ||
171 | int num_regs); | ||
172 | |||
152 | /** | 173 | /** |
153 | * Description of an IRQ for the generic regmap irq_chip. | 174 | * Description of an IRQ for the generic regmap irq_chip. |
154 | * | 175 | * |
@@ -197,4 +218,115 @@ int regmap_add_irq_chip(struct regmap *map, int irq, int irq_flags, | |||
197 | void regmap_del_irq_chip(int irq, struct regmap_irq_chip_data *data); | 218 | void regmap_del_irq_chip(int irq, struct regmap_irq_chip_data *data); |
198 | int regmap_irq_chip_get_base(struct regmap_irq_chip_data *data); | 219 | int regmap_irq_chip_get_base(struct regmap_irq_chip_data *data); |
199 | 220 | ||
221 | #else | ||
222 | |||
223 | /* | ||
224 | * These stubs should only ever be called by generic code which has | ||
225 | * regmap based facilities, if they ever get called at runtime | ||
226 | * something is going wrong and something probably needs to select | ||
227 | * REGMAP. | ||
228 | */ | ||
229 | |||
230 | static inline int regmap_write(struct regmap *map, unsigned int reg, | ||
231 | unsigned int val) | ||
232 | { | ||
233 | WARN_ONCE(1, "regmap API is disabled"); | ||
234 | return -EINVAL; | ||
235 | } | ||
236 | |||
237 | static inline int regmap_raw_write(struct regmap *map, unsigned int reg, | ||
238 | const void *val, size_t val_len) | ||
239 | { | ||
240 | WARN_ONCE(1, "regmap API is disabled"); | ||
241 | return -EINVAL; | ||
242 | } | ||
243 | |||
244 | static inline int regmap_bulk_write(struct regmap *map, unsigned int reg, | ||
245 | const void *val, size_t val_count) | ||
246 | { | ||
247 | WARN_ONCE(1, "regmap API is disabled"); | ||
248 | return -EINVAL; | ||
249 | } | ||
250 | |||
251 | static inline int regmap_read(struct regmap *map, unsigned int reg, | ||
252 | unsigned int *val) | ||
253 | { | ||
254 | WARN_ONCE(1, "regmap API is disabled"); | ||
255 | return -EINVAL; | ||
256 | } | ||
257 | |||
258 | static inline int regmap_raw_read(struct regmap *map, unsigned int reg, | ||
259 | void *val, size_t val_len) | ||
260 | { | ||
261 | WARN_ONCE(1, "regmap API is disabled"); | ||
262 | return -EINVAL; | ||
263 | } | ||
264 | |||
265 | static inline int regmap_bulk_read(struct regmap *map, unsigned int reg, | ||
266 | void *val, size_t val_count) | ||
267 | { | ||
268 | WARN_ONCE(1, "regmap API is disabled"); | ||
269 | return -EINVAL; | ||
270 | } | ||
271 | |||
272 | static inline int regmap_update_bits(struct regmap *map, unsigned int reg, | ||
273 | unsigned int mask, unsigned int val) | ||
274 | { | ||
275 | WARN_ONCE(1, "regmap API is disabled"); | ||
276 | return -EINVAL; | ||
277 | } | ||
278 | |||
279 | static inline int regmap_update_bits_check(struct regmap *map, | ||
280 | unsigned int reg, | ||
281 | unsigned int mask, unsigned int val, | ||
282 | bool *change) | ||
283 | { | ||
284 | WARN_ONCE(1, "regmap API is disabled"); | ||
285 | return -EINVAL; | ||
286 | } | ||
287 | |||
288 | static inline int regmap_get_val_bytes(struct regmap *map) | ||
289 | { | ||
290 | WARN_ONCE(1, "regmap API is disabled"); | ||
291 | return -EINVAL; | ||
292 | } | ||
293 | |||
294 | static inline int regcache_sync(struct regmap *map) | ||
295 | { | ||
296 | WARN_ONCE(1, "regmap API is disabled"); | ||
297 | return -EINVAL; | ||
298 | } | ||
299 | |||
300 | static inline int regcache_sync_region(struct regmap *map, unsigned int min, | ||
301 | unsigned int max) | ||
302 | { | ||
303 | WARN_ONCE(1, "regmap API is disabled"); | ||
304 | return -EINVAL; | ||
305 | } | ||
306 | |||
307 | static inline void regcache_cache_only(struct regmap *map, bool enable) | ||
308 | { | ||
309 | WARN_ONCE(1, "regmap API is disabled"); | ||
310 | } | ||
311 | |||
312 | static inline void regcache_cache_bypass(struct regmap *map, bool enable) | ||
313 | { | ||
314 | WARN_ONCE(1, "regmap API is disabled"); | ||
315 | } | ||
316 | |||
317 | static inline void regcache_mark_dirty(struct regmap *map) | ||
318 | { | ||
319 | WARN_ONCE(1, "regmap API is disabled"); | ||
320 | } | ||
321 | |||
322 | static inline int regmap_register_patch(struct regmap *map, | ||
323 | const struct reg_default *regs, | ||
324 | int num_regs) | ||
325 | { | ||
326 | WARN_ONCE(1, "regmap API is disabled"); | ||
327 | return -EINVAL; | ||
328 | } | ||
329 | |||
330 | #endif | ||
331 | |||
200 | #endif | 332 | #endif |
diff --git a/include/linux/regset.h b/include/linux/regset.h index 686f37327a49..8e0c9febf495 100644 --- a/include/linux/regset.h +++ b/include/linux/regset.h | |||
@@ -15,6 +15,7 @@ | |||
15 | 15 | ||
16 | #include <linux/compiler.h> | 16 | #include <linux/compiler.h> |
17 | #include <linux/types.h> | 17 | #include <linux/types.h> |
18 | #include <linux/bug.h> | ||
18 | #include <linux/uaccess.h> | 19 | #include <linux/uaccess.h> |
19 | struct task_struct; | 20 | struct task_struct; |
20 | struct user_regset; | 21 | struct user_regset; |
diff --git a/include/linux/regulator/ab8500.h b/include/linux/regulator/ab8500.h index 76579f964a29..7bd73bbdfd1b 100644 --- a/include/linux/regulator/ab8500.h +++ b/include/linux/regulator/ab8500.h | |||
@@ -26,7 +26,26 @@ enum ab8500_regulator_id { | |||
26 | AB8500_NUM_REGULATORS, | 26 | AB8500_NUM_REGULATORS, |
27 | }; | 27 | }; |
28 | 28 | ||
29 | /* AB8500 register initialization */ | 29 | /* AB9450 regulators */ |
30 | enum ab9540_regulator_id { | ||
31 | AB9540_LDO_AUX1, | ||
32 | AB9540_LDO_AUX2, | ||
33 | AB9540_LDO_AUX3, | ||
34 | AB9540_LDO_AUX4, | ||
35 | AB9540_LDO_INTCORE, | ||
36 | AB9540_LDO_TVOUT, | ||
37 | AB9540_LDO_USB, | ||
38 | AB9540_LDO_AUDIO, | ||
39 | AB9540_LDO_ANAMIC1, | ||
40 | AB9540_LDO_ANAMIC2, | ||
41 | AB9540_LDO_DMIC, | ||
42 | AB9540_LDO_ANA, | ||
43 | AB9540_SYSCLKREQ_2, | ||
44 | AB9540_SYSCLKREQ_4, | ||
45 | AB9540_NUM_REGULATORS, | ||
46 | }; | ||
47 | |||
48 | /* AB8500 and AB9540 register initialization */ | ||
30 | struct ab8500_regulator_reg_init { | 49 | struct ab8500_regulator_reg_init { |
31 | int id; | 50 | int id; |
32 | u8 value; | 51 | u8 value; |
@@ -71,4 +90,53 @@ enum ab8500_regulator_reg { | |||
71 | AB8500_NUM_REGULATOR_REGISTERS, | 90 | AB8500_NUM_REGULATOR_REGISTERS, |
72 | }; | 91 | }; |
73 | 92 | ||
93 | |||
94 | /* AB9540 registers */ | ||
95 | enum ab9540_regulator_reg { | ||
96 | AB9540_REGUREQUESTCTRL1, | ||
97 | AB9540_REGUREQUESTCTRL2, | ||
98 | AB9540_REGUREQUESTCTRL3, | ||
99 | AB9540_REGUREQUESTCTRL4, | ||
100 | AB9540_REGUSYSCLKREQ1HPVALID1, | ||
101 | AB9540_REGUSYSCLKREQ1HPVALID2, | ||
102 | AB9540_REGUHWHPREQ1VALID1, | ||
103 | AB9540_REGUHWHPREQ1VALID2, | ||
104 | AB9540_REGUHWHPREQ2VALID1, | ||
105 | AB9540_REGUHWHPREQ2VALID2, | ||
106 | AB9540_REGUSWHPREQVALID1, | ||
107 | AB9540_REGUSWHPREQVALID2, | ||
108 | AB9540_REGUSYSCLKREQVALID1, | ||
109 | AB9540_REGUSYSCLKREQVALID2, | ||
110 | AB9540_REGUVAUX4REQVALID, | ||
111 | AB9540_REGUMISC1, | ||
112 | AB9540_VAUDIOSUPPLY, | ||
113 | AB9540_REGUCTRL1VAMIC, | ||
114 | AB9540_VSMPS1REGU, | ||
115 | AB9540_VSMPS2REGU, | ||
116 | AB9540_VSMPS3REGU, /* NOTE! PRCMU register */ | ||
117 | AB9540_VPLLVANAREGU, | ||
118 | AB9540_EXTSUPPLYREGU, | ||
119 | AB9540_VAUX12REGU, | ||
120 | AB9540_VRF1VAUX3REGU, | ||
121 | AB9540_VSMPS1SEL1, | ||
122 | AB9540_VSMPS1SEL2, | ||
123 | AB9540_VSMPS1SEL3, | ||
124 | AB9540_VSMPS2SEL1, | ||
125 | AB9540_VSMPS2SEL2, | ||
126 | AB9540_VSMPS2SEL3, | ||
127 | AB9540_VSMPS3SEL1, /* NOTE! PRCMU register */ | ||
128 | AB9540_VSMPS3SEL2, /* NOTE! PRCMU register */ | ||
129 | AB9540_VAUX1SEL, | ||
130 | AB9540_VAUX2SEL, | ||
131 | AB9540_VRF1VAUX3SEL, | ||
132 | AB9540_REGUCTRL2SPARE, | ||
133 | AB9540_VAUX4REQCTRL, | ||
134 | AB9540_VAUX4REGU, | ||
135 | AB9540_VAUX4SEL, | ||
136 | AB9540_REGUCTRLDISCH, | ||
137 | AB9540_REGUCTRLDISCH2, | ||
138 | AB9540_REGUCTRLDISCH3, | ||
139 | AB9540_NUM_REGULATOR_REGISTERS, | ||
140 | }; | ||
141 | |||
74 | #endif | 142 | #endif |
diff --git a/include/linux/regulator/bq24022.h b/include/linux/regulator/bq24022.h deleted file mode 100644 index a6d014005d49..000000000000 --- a/include/linux/regulator/bq24022.h +++ /dev/null | |||
@@ -1,24 +0,0 @@ | |||
1 | /* | ||
2 | * Support for TI bq24022 (bqTINY-II) Dual Input (USB/AC Adpater) | ||
3 | * 1-Cell Li-Ion Charger connected via GPIOs. | ||
4 | * | ||
5 | * Copyright (c) 2008 Philipp Zabel | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License version 2 as | ||
9 | * published by the Free Software Foundation. | ||
10 | * | ||
11 | */ | ||
12 | |||
13 | struct regulator_init_data; | ||
14 | |||
15 | /** | ||
16 | * bq24022_mach_info - platform data for bq24022 | ||
17 | * @gpio_nce: GPIO line connected to the nCE pin, used to enable / disable charging | ||
18 | * @gpio_iset2: GPIO line connected to the ISET2 pin, used to limit charging current to 100 mA / 500 mA | ||
19 | */ | ||
20 | struct bq24022_mach_info { | ||
21 | int gpio_nce; | ||
22 | int gpio_iset2; | ||
23 | struct regulator_init_data *init_data; | ||
24 | }; | ||
diff --git a/include/linux/regulator/consumer.h b/include/linux/regulator/consumer.h index f2698a0edfc4..4ed1b30ac5fc 100644 --- a/include/linux/regulator/consumer.h +++ b/include/linux/regulator/consumer.h | |||
@@ -35,7 +35,8 @@ | |||
35 | #ifndef __LINUX_REGULATOR_CONSUMER_H_ | 35 | #ifndef __LINUX_REGULATOR_CONSUMER_H_ |
36 | #define __LINUX_REGULATOR_CONSUMER_H_ | 36 | #define __LINUX_REGULATOR_CONSUMER_H_ |
37 | 37 | ||
38 | #include <linux/device.h> | 38 | struct device; |
39 | struct notifier_block; | ||
39 | 40 | ||
40 | /* | 41 | /* |
41 | * Regulator operating modes. | 42 | * Regulator operating modes. |
@@ -132,9 +133,12 @@ struct regulator_bulk_data { | |||
132 | /* regulator get and put */ | 133 | /* regulator get and put */ |
133 | struct regulator *__must_check regulator_get(struct device *dev, | 134 | struct regulator *__must_check regulator_get(struct device *dev, |
134 | const char *id); | 135 | const char *id); |
136 | struct regulator *__must_check devm_regulator_get(struct device *dev, | ||
137 | const char *id); | ||
135 | struct regulator *__must_check regulator_get_exclusive(struct device *dev, | 138 | struct regulator *__must_check regulator_get_exclusive(struct device *dev, |
136 | const char *id); | 139 | const char *id); |
137 | void regulator_put(struct regulator *regulator); | 140 | void regulator_put(struct regulator *regulator); |
141 | void devm_regulator_put(struct regulator *regulator); | ||
138 | 142 | ||
139 | /* regulator output control and status */ | 143 | /* regulator output control and status */ |
140 | int regulator_enable(struct regulator *regulator); | 144 | int regulator_enable(struct regulator *regulator); |
@@ -145,6 +149,8 @@ int regulator_disable_deferred(struct regulator *regulator, int ms); | |||
145 | 149 | ||
146 | int regulator_bulk_get(struct device *dev, int num_consumers, | 150 | int regulator_bulk_get(struct device *dev, int num_consumers, |
147 | struct regulator_bulk_data *consumers); | 151 | struct regulator_bulk_data *consumers); |
152 | int devm_regulator_bulk_get(struct device *dev, int num_consumers, | ||
153 | struct regulator_bulk_data *consumers); | ||
148 | int regulator_bulk_enable(int num_consumers, | 154 | int regulator_bulk_enable(int num_consumers, |
149 | struct regulator_bulk_data *consumers); | 155 | struct regulator_bulk_data *consumers); |
150 | int regulator_bulk_disable(int num_consumers, | 156 | int regulator_bulk_disable(int num_consumers, |
@@ -200,10 +206,21 @@ static inline struct regulator *__must_check regulator_get(struct device *dev, | |||
200 | */ | 206 | */ |
201 | return NULL; | 207 | return NULL; |
202 | } | 208 | } |
209 | |||
210 | static inline struct regulator *__must_check | ||
211 | devm_regulator_get(struct device *dev, const char *id) | ||
212 | { | ||
213 | return NULL; | ||
214 | } | ||
215 | |||
203 | static inline void regulator_put(struct regulator *regulator) | 216 | static inline void regulator_put(struct regulator *regulator) |
204 | { | 217 | { |
205 | } | 218 | } |
206 | 219 | ||
220 | static inline void devm_regulator_put(struct regulator *regulator) | ||
221 | { | ||
222 | } | ||
223 | |||
207 | static inline int regulator_enable(struct regulator *regulator) | 224 | static inline int regulator_enable(struct regulator *regulator) |
208 | { | 225 | { |
209 | return 0; | 226 | return 0; |
@@ -237,6 +254,12 @@ static inline int regulator_bulk_get(struct device *dev, | |||
237 | return 0; | 254 | return 0; |
238 | } | 255 | } |
239 | 256 | ||
257 | static inline int devm_regulator_bulk_get(struct device *dev, int num_consumers, | ||
258 | struct regulator_bulk_data *consumers) | ||
259 | { | ||
260 | return 0; | ||
261 | } | ||
262 | |||
240 | static inline int regulator_bulk_enable(int num_consumers, | 263 | static inline int regulator_bulk_enable(int num_consumers, |
241 | struct regulator_bulk_data *consumers) | 264 | struct regulator_bulk_data *consumers) |
242 | { | 265 | { |
diff --git a/include/linux/regulator/driver.h b/include/linux/regulator/driver.h index 4214b9a9d1c9..fa8b55b8191c 100644 --- a/include/linux/regulator/driver.h +++ b/include/linux/regulator/driver.h | |||
@@ -104,7 +104,7 @@ struct regulator_ops { | |||
104 | int (*disable) (struct regulator_dev *); | 104 | int (*disable) (struct regulator_dev *); |
105 | int (*is_enabled) (struct regulator_dev *); | 105 | int (*is_enabled) (struct regulator_dev *); |
106 | 106 | ||
107 | /* get/set regulator operating mode (defined in regulator.h) */ | 107 | /* get/set regulator operating mode (defined in consumer.h) */ |
108 | int (*set_mode) (struct regulator_dev *, unsigned int mode); | 108 | int (*set_mode) (struct regulator_dev *, unsigned int mode); |
109 | unsigned int (*get_mode) (struct regulator_dev *); | 109 | unsigned int (*get_mode) (struct regulator_dev *); |
110 | 110 | ||
@@ -135,7 +135,7 @@ struct regulator_ops { | |||
135 | int (*set_suspend_enable) (struct regulator_dev *); | 135 | int (*set_suspend_enable) (struct regulator_dev *); |
136 | int (*set_suspend_disable) (struct regulator_dev *); | 136 | int (*set_suspend_disable) (struct regulator_dev *); |
137 | 137 | ||
138 | /* set regulator suspend operating mode (defined in regulator.h) */ | 138 | /* set regulator suspend operating mode (defined in consumer.h) */ |
139 | int (*set_suspend_mode) (struct regulator_dev *, unsigned int mode); | 139 | int (*set_suspend_mode) (struct regulator_dev *, unsigned int mode); |
140 | }; | 140 | }; |
141 | 141 | ||
@@ -207,9 +207,7 @@ struct regulator_dev { | |||
207 | 207 | ||
208 | void *reg_data; /* regulator_dev data */ | 208 | void *reg_data; /* regulator_dev data */ |
209 | 209 | ||
210 | #ifdef CONFIG_DEBUG_FS | ||
211 | struct dentry *debugfs; | 210 | struct dentry *debugfs; |
212 | #endif | ||
213 | }; | 211 | }; |
214 | 212 | ||
215 | struct regulator_dev *regulator_register(struct regulator_desc *regulator_desc, | 213 | struct regulator_dev *regulator_register(struct regulator_desc *regulator_desc, |
diff --git a/include/linux/regulator/fixed.h b/include/linux/regulator/fixed.h index ffd7d508e726..936a7d8c11a9 100644 --- a/include/linux/regulator/fixed.h +++ b/include/linux/regulator/fixed.h | |||
@@ -48,4 +48,17 @@ struct fixed_voltage_config { | |||
48 | struct regulator_init_data *init_data; | 48 | struct regulator_init_data *init_data; |
49 | }; | 49 | }; |
50 | 50 | ||
51 | struct regulator_consumer_supply; | ||
52 | |||
53 | #if IS_ENABLED(CONFIG_REGULATOR) | ||
54 | struct platform_device *regulator_register_fixed(int id, | ||
55 | struct regulator_consumer_supply *supplies, int num_supplies); | ||
56 | #else | ||
57 | static inline struct platform_device *regulator_register_fixed(int id, | ||
58 | struct regulator_consumer_supply *supplies, int num_supplies) | ||
59 | { | ||
60 | return NULL; | ||
61 | } | ||
62 | #endif | ||
63 | |||
51 | #endif | 64 | #endif |
diff --git a/include/linux/regulator/machine.h b/include/linux/regulator/machine.h index f3f13fd5868f..b02108446be7 100644 --- a/include/linux/regulator/machine.h +++ b/include/linux/regulator/machine.h | |||
@@ -71,7 +71,7 @@ struct regulator_state { | |||
71 | * @uV_offset: Offset applied to voltages from consumer to compensate for | 71 | * @uV_offset: Offset applied to voltages from consumer to compensate for |
72 | * voltage drops. | 72 | * voltage drops. |
73 | * | 73 | * |
74 | * @min_uA: Smallest consumers consumers may set. | 74 | * @min_uA: Smallest current consumers may set. |
75 | * @max_uA: Largest current consumers may set. | 75 | * @max_uA: Largest current consumers may set. |
76 | * | 76 | * |
77 | * @valid_modes_mask: Mask of modes which may be configured by consumers. | 77 | * @valid_modes_mask: Mask of modes which may be configured by consumers. |
@@ -134,17 +134,13 @@ struct regulation_constraints { | |||
134 | /** | 134 | /** |
135 | * struct regulator_consumer_supply - supply -> device mapping | 135 | * struct regulator_consumer_supply - supply -> device mapping |
136 | * | 136 | * |
137 | * This maps a supply name to a device. Only one of dev or dev_name | 137 | * This maps a supply name to a device. Use of dev_name allows support for |
138 | * can be specified. Use of dev_name allows support for buses which | 138 | * buses which make struct device available late such as I2C. |
139 | * make struct device available late such as I2C and is the preferred | ||
140 | * form. | ||
141 | * | 139 | * |
142 | * @dev: Device structure for the consumer. | ||
143 | * @dev_name: Result of dev_name() for the consumer. | 140 | * @dev_name: Result of dev_name() for the consumer. |
144 | * @supply: Name for the supply. | 141 | * @supply: Name for the supply. |
145 | */ | 142 | */ |
146 | struct regulator_consumer_supply { | 143 | struct regulator_consumer_supply { |
147 | struct device *dev; /* consumer */ | ||
148 | const char *dev_name; /* dev_name() for consumer */ | 144 | const char *dev_name; /* dev_name() for consumer */ |
149 | const char *supply; /* consumer supply - e.g. "vcc" */ | 145 | const char *supply; /* consumer supply - e.g. "vcc" */ |
150 | }; | 146 | }; |
diff --git a/include/linux/regulator/tps62360.h b/include/linux/regulator/tps62360.h new file mode 100644 index 000000000000..6a5c1b2c751e --- /dev/null +++ b/include/linux/regulator/tps62360.h | |||
@@ -0,0 +1,57 @@ | |||
1 | /* | ||
2 | * tps62360.h -- TI tps62360 | ||
3 | * | ||
4 | * Interface for regulator driver for TI TPS62360 Processor core supply | ||
5 | * | ||
6 | * Copyright (C) 2012 NVIDIA Corporation | ||
7 | |||
8 | * Author: Laxman Dewangan <ldewangan@nvidia.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; either version 2 of the License, or | ||
13 | * (at your option) any later version. | ||
14 | * | ||
15 | * This program is distributed in the hope that it will be useful, but WITHOUT | ||
16 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
17 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
18 | * more details. | ||
19 | * | ||
20 | * You should have received a copy of the GNU General Public License along | ||
21 | * with this program; if not, write to the Free Software Foundation, Inc., | ||
22 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
23 | * | ||
24 | */ | ||
25 | |||
26 | #ifndef __LINUX_REGULATOR_TPS62360_H | ||
27 | #define __LINUX_REGULATOR_TPS62360_H | ||
28 | |||
29 | #include <linux/regulator/machine.h> | ||
30 | |||
31 | /* | ||
32 | * struct tps62360_regulator_platform_data - tps62360 regulator platform data. | ||
33 | * | ||
34 | * @reg_init_data: The regulator init data. | ||
35 | * @en_force_pwm: Enable force pwm or not. | ||
36 | * @en_discharge: Enable discharge the output capacitor via internal | ||
37 | * register. | ||
38 | * @en_internal_pulldn: internal pull down enable or not. | ||
39 | * @vsel0_gpio: Gpio number for vsel0. It should be -1 if this is tied with | ||
40 | * fixed logic. | ||
41 | * @vsel1_gpio: Gpio number for vsel1. It should be -1 if this is tied with | ||
42 | * fixed logic. | ||
43 | * @vsel0_def_state: Default state of vsel0. 1 if it is high else 0. | ||
44 | * @vsel1_def_state: Default state of vsel1. 1 if it is high else 0. | ||
45 | */ | ||
46 | struct tps62360_regulator_platform_data { | ||
47 | struct regulator_init_data reg_init_data; | ||
48 | bool en_force_pwm; | ||
49 | bool en_discharge; | ||
50 | bool en_internal_pulldn; | ||
51 | int vsel0_gpio; | ||
52 | int vsel1_gpio; | ||
53 | int vsel0_def_state; | ||
54 | int vsel1_def_state; | ||
55 | }; | ||
56 | |||
57 | #endif /* __LINUX_REGULATOR_TPS62360_H */ | ||
diff --git a/include/linux/reiserfs_acl.h b/include/linux/reiserfs_acl.h deleted file mode 100644 index f096b80e73d8..000000000000 --- a/include/linux/reiserfs_acl.h +++ /dev/null | |||
@@ -1,76 +0,0 @@ | |||
1 | #include <linux/init.h> | ||
2 | #include <linux/posix_acl.h> | ||
3 | |||
4 | #define REISERFS_ACL_VERSION 0x0001 | ||
5 | |||
6 | typedef struct { | ||
7 | __le16 e_tag; | ||
8 | __le16 e_perm; | ||
9 | __le32 e_id; | ||
10 | } reiserfs_acl_entry; | ||
11 | |||
12 | typedef struct { | ||
13 | __le16 e_tag; | ||
14 | __le16 e_perm; | ||
15 | } reiserfs_acl_entry_short; | ||
16 | |||
17 | typedef struct { | ||
18 | __le32 a_version; | ||
19 | } reiserfs_acl_header; | ||
20 | |||
21 | static inline size_t reiserfs_acl_size(int count) | ||
22 | { | ||
23 | if (count <= 4) { | ||
24 | return sizeof(reiserfs_acl_header) + | ||
25 | count * sizeof(reiserfs_acl_entry_short); | ||
26 | } else { | ||
27 | return sizeof(reiserfs_acl_header) + | ||
28 | 4 * sizeof(reiserfs_acl_entry_short) + | ||
29 | (count - 4) * sizeof(reiserfs_acl_entry); | ||
30 | } | ||
31 | } | ||
32 | |||
33 | static inline int reiserfs_acl_count(size_t size) | ||
34 | { | ||
35 | ssize_t s; | ||
36 | size -= sizeof(reiserfs_acl_header); | ||
37 | s = size - 4 * sizeof(reiserfs_acl_entry_short); | ||
38 | if (s < 0) { | ||
39 | if (size % sizeof(reiserfs_acl_entry_short)) | ||
40 | return -1; | ||
41 | return size / sizeof(reiserfs_acl_entry_short); | ||
42 | } else { | ||
43 | if (s % sizeof(reiserfs_acl_entry)) | ||
44 | return -1; | ||
45 | return s / sizeof(reiserfs_acl_entry) + 4; | ||
46 | } | ||
47 | } | ||
48 | |||
49 | #ifdef CONFIG_REISERFS_FS_POSIX_ACL | ||
50 | struct posix_acl *reiserfs_get_acl(struct inode *inode, int type); | ||
51 | int reiserfs_acl_chmod(struct inode *inode); | ||
52 | int reiserfs_inherit_default_acl(struct reiserfs_transaction_handle *th, | ||
53 | struct inode *dir, struct dentry *dentry, | ||
54 | struct inode *inode); | ||
55 | int reiserfs_cache_default_acl(struct inode *dir); | ||
56 | extern const struct xattr_handler reiserfs_posix_acl_default_handler; | ||
57 | extern const struct xattr_handler reiserfs_posix_acl_access_handler; | ||
58 | |||
59 | #else | ||
60 | |||
61 | #define reiserfs_cache_default_acl(inode) 0 | ||
62 | #define reiserfs_get_acl NULL | ||
63 | |||
64 | static inline int reiserfs_acl_chmod(struct inode *inode) | ||
65 | { | ||
66 | return 0; | ||
67 | } | ||
68 | |||
69 | static inline int | ||
70 | reiserfs_inherit_default_acl(struct reiserfs_transaction_handle *th, | ||
71 | const struct inode *dir, struct dentry *dentry, | ||
72 | struct inode *inode) | ||
73 | { | ||
74 | return 0; | ||
75 | } | ||
76 | #endif | ||
diff --git a/include/linux/reiserfs_fs.h b/include/linux/reiserfs_fs.h index 2213ddcce20c..ea3700cd7367 100644 --- a/include/linux/reiserfs_fs.h +++ b/include/linux/reiserfs_fs.h | |||
@@ -1,32 +1,12 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright 1996, 1997, 1998 Hans Reiser, see reiserfs/README for licensing and copyright details | 2 | * Copyright 1996, 1997, 1998 Hans Reiser, see reiserfs/README for licensing and copyright details |
3 | */ | 3 | */ |
4 | |||
5 | /* this file has an amazingly stupid | ||
6 | name, yura please fix it to be | ||
7 | reiserfs.h, and merge all the rest | ||
8 | of our .h files that are in this | ||
9 | directory into it. */ | ||
10 | |||
11 | #ifndef _LINUX_REISER_FS_H | 4 | #ifndef _LINUX_REISER_FS_H |
12 | #define _LINUX_REISER_FS_H | 5 | #define _LINUX_REISER_FS_H |
13 | 6 | ||
14 | #include <linux/types.h> | 7 | #include <linux/types.h> |
15 | #include <linux/magic.h> | 8 | #include <linux/magic.h> |
16 | 9 | ||
17 | #ifdef __KERNEL__ | ||
18 | #include <linux/slab.h> | ||
19 | #include <linux/interrupt.h> | ||
20 | #include <linux/sched.h> | ||
21 | #include <linux/workqueue.h> | ||
22 | #include <asm/unaligned.h> | ||
23 | #include <linux/bitops.h> | ||
24 | #include <linux/proc_fs.h> | ||
25 | #include <linux/buffer_head.h> | ||
26 | #include <linux/reiserfs_fs_i.h> | ||
27 | #include <linux/reiserfs_fs_sb.h> | ||
28 | #endif | ||
29 | |||
30 | /* | 10 | /* |
31 | * include/linux/reiser_fs.h | 11 | * include/linux/reiser_fs.h |
32 | * | 12 | * |
@@ -43,2318 +23,4 @@ | |||
43 | #define REISERFS_IOC_GETVERSION FS_IOC_GETVERSION | 23 | #define REISERFS_IOC_GETVERSION FS_IOC_GETVERSION |
44 | #define REISERFS_IOC_SETVERSION FS_IOC_SETVERSION | 24 | #define REISERFS_IOC_SETVERSION FS_IOC_SETVERSION |
45 | 25 | ||
46 | #ifdef __KERNEL__ | ||
47 | /* the 32 bit compat definitions with int argument */ | ||
48 | #define REISERFS_IOC32_UNPACK _IOW(0xCD, 1, int) | ||
49 | #define REISERFS_IOC32_GETFLAGS FS_IOC32_GETFLAGS | ||
50 | #define REISERFS_IOC32_SETFLAGS FS_IOC32_SETFLAGS | ||
51 | #define REISERFS_IOC32_GETVERSION FS_IOC32_GETVERSION | ||
52 | #define REISERFS_IOC32_SETVERSION FS_IOC32_SETVERSION | ||
53 | |||
54 | /* | ||
55 | * Locking primitives. The write lock is a per superblock | ||
56 | * special mutex that has properties close to the Big Kernel Lock | ||
57 | * which was used in the previous locking scheme. | ||
58 | */ | ||
59 | void reiserfs_write_lock(struct super_block *s); | ||
60 | void reiserfs_write_unlock(struct super_block *s); | ||
61 | int reiserfs_write_lock_once(struct super_block *s); | ||
62 | void reiserfs_write_unlock_once(struct super_block *s, int lock_depth); | ||
63 | |||
64 | #ifdef CONFIG_REISERFS_CHECK | ||
65 | void reiserfs_lock_check_recursive(struct super_block *s); | ||
66 | #else | ||
67 | static inline void reiserfs_lock_check_recursive(struct super_block *s) { } | ||
68 | #endif | ||
69 | |||
70 | /* | ||
71 | * Several mutexes depend on the write lock. | ||
72 | * However sometimes we want to relax the write lock while we hold | ||
73 | * these mutexes, according to the release/reacquire on schedule() | ||
74 | * properties of the Bkl that were used. | ||
75 | * Reiserfs performances and locking were based on this scheme. | ||
76 | * Now that the write lock is a mutex and not the bkl anymore, doing so | ||
77 | * may result in a deadlock: | ||
78 | * | ||
79 | * A acquire write_lock | ||
80 | * A acquire j_commit_mutex | ||
81 | * A release write_lock and wait for something | ||
82 | * B acquire write_lock | ||
83 | * B can't acquire j_commit_mutex and sleep | ||
84 | * A can't acquire write lock anymore | ||
85 | * deadlock | ||
86 | * | ||
87 | * What we do here is avoiding such deadlock by playing the same game | ||
88 | * than the Bkl: if we can't acquire a mutex that depends on the write lock, | ||
89 | * we release the write lock, wait a bit and then retry. | ||
90 | * | ||
91 | * The mutexes concerned by this hack are: | ||
92 | * - The commit mutex of a journal list | ||
93 | * - The flush mutex | ||
94 | * - The journal lock | ||
95 | * - The inode mutex | ||
96 | */ | ||
97 | static inline void reiserfs_mutex_lock_safe(struct mutex *m, | ||
98 | struct super_block *s) | ||
99 | { | ||
100 | reiserfs_lock_check_recursive(s); | ||
101 | reiserfs_write_unlock(s); | ||
102 | mutex_lock(m); | ||
103 | reiserfs_write_lock(s); | ||
104 | } | ||
105 | |||
106 | static inline void | ||
107 | reiserfs_mutex_lock_nested_safe(struct mutex *m, unsigned int subclass, | ||
108 | struct super_block *s) | ||
109 | { | ||
110 | reiserfs_lock_check_recursive(s); | ||
111 | reiserfs_write_unlock(s); | ||
112 | mutex_lock_nested(m, subclass); | ||
113 | reiserfs_write_lock(s); | ||
114 | } | ||
115 | |||
116 | static inline void | ||
117 | reiserfs_down_read_safe(struct rw_semaphore *sem, struct super_block *s) | ||
118 | { | ||
119 | reiserfs_lock_check_recursive(s); | ||
120 | reiserfs_write_unlock(s); | ||
121 | down_read(sem); | ||
122 | reiserfs_write_lock(s); | ||
123 | } | ||
124 | |||
125 | /* | ||
126 | * When we schedule, we usually want to also release the write lock, | ||
127 | * according to the previous bkl based locking scheme of reiserfs. | ||
128 | */ | ||
129 | static inline void reiserfs_cond_resched(struct super_block *s) | ||
130 | { | ||
131 | if (need_resched()) { | ||
132 | reiserfs_write_unlock(s); | ||
133 | schedule(); | ||
134 | reiserfs_write_lock(s); | ||
135 | } | ||
136 | } | ||
137 | |||
138 | struct fid; | ||
139 | |||
140 | /* in reading the #defines, it may help to understand that they employ | ||
141 | the following abbreviations: | ||
142 | |||
143 | B = Buffer | ||
144 | I = Item header | ||
145 | H = Height within the tree (should be changed to LEV) | ||
146 | N = Number of the item in the node | ||
147 | STAT = stat data | ||
148 | DEH = Directory Entry Header | ||
149 | EC = Entry Count | ||
150 | E = Entry number | ||
151 | UL = Unsigned Long | ||
152 | BLKH = BLocK Header | ||
153 | UNFM = UNForMatted node | ||
154 | DC = Disk Child | ||
155 | P = Path | ||
156 | |||
157 | These #defines are named by concatenating these abbreviations, | ||
158 | where first comes the arguments, and last comes the return value, | ||
159 | of the macro. | ||
160 | |||
161 | */ | ||
162 | |||
163 | #define USE_INODE_GENERATION_COUNTER | ||
164 | |||
165 | #define REISERFS_PREALLOCATE | ||
166 | #define DISPLACE_NEW_PACKING_LOCALITIES | ||
167 | #define PREALLOCATION_SIZE 9 | ||
168 | |||
169 | /* n must be power of 2 */ | ||
170 | #define _ROUND_UP(x,n) (((x)+(n)-1u) & ~((n)-1u)) | ||
171 | |||
172 | // to be ok for alpha and others we have to align structures to 8 byte | ||
173 | // boundary. | ||
174 | // FIXME: do not change 4 by anything else: there is code which relies on that | ||
175 | #define ROUND_UP(x) _ROUND_UP(x,8LL) | ||
176 | |||
177 | /* debug levels. Right now, CONFIG_REISERFS_CHECK means print all debug | ||
178 | ** messages. | ||
179 | */ | ||
180 | #define REISERFS_DEBUG_CODE 5 /* extra messages to help find/debug errors */ | ||
181 | |||
182 | void __reiserfs_warning(struct super_block *s, const char *id, | ||
183 | const char *func, const char *fmt, ...); | ||
184 | #define reiserfs_warning(s, id, fmt, args...) \ | ||
185 | __reiserfs_warning(s, id, __func__, fmt, ##args) | ||
186 | /* assertions handling */ | ||
187 | |||
188 | /** always check a condition and panic if it's false. */ | ||
189 | #define __RASSERT(cond, scond, format, args...) \ | ||
190 | do { \ | ||
191 | if (!(cond)) \ | ||
192 | reiserfs_panic(NULL, "assertion failure", "(" #cond ") at " \ | ||
193 | __FILE__ ":%i:%s: " format "\n", \ | ||
194 | in_interrupt() ? -1 : task_pid_nr(current), \ | ||
195 | __LINE__, __func__ , ##args); \ | ||
196 | } while (0) | ||
197 | |||
198 | #define RASSERT(cond, format, args...) __RASSERT(cond, #cond, format, ##args) | ||
199 | |||
200 | #if defined( CONFIG_REISERFS_CHECK ) | ||
201 | #define RFALSE(cond, format, args...) __RASSERT(!(cond), "!(" #cond ")", format, ##args) | ||
202 | #else | ||
203 | #define RFALSE( cond, format, args... ) do {;} while( 0 ) | ||
204 | #endif | ||
205 | |||
206 | #define CONSTF __attribute_const__ | ||
207 | /* | ||
208 | * Disk Data Structures | ||
209 | */ | ||
210 | |||
211 | /***************************************************************************/ | ||
212 | /* SUPER BLOCK */ | ||
213 | /***************************************************************************/ | ||
214 | |||
215 | /* | ||
216 | * Structure of super block on disk, a version of which in RAM is often accessed as REISERFS_SB(s)->s_rs | ||
217 | * the version in RAM is part of a larger structure containing fields never written to disk. | ||
218 | */ | ||
219 | #define UNSET_HASH 0 // read_super will guess about, what hash names | ||
220 | // in directories were sorted with | ||
221 | #define TEA_HASH 1 | ||
222 | #define YURA_HASH 2 | ||
223 | #define R5_HASH 3 | ||
224 | #define DEFAULT_HASH R5_HASH | ||
225 | |||
226 | struct journal_params { | ||
227 | __le32 jp_journal_1st_block; /* where does journal start from on its | ||
228 | * device */ | ||
229 | __le32 jp_journal_dev; /* journal device st_rdev */ | ||
230 | __le32 jp_journal_size; /* size of the journal */ | ||
231 | __le32 jp_journal_trans_max; /* max number of blocks in a transaction. */ | ||
232 | __le32 jp_journal_magic; /* random value made on fs creation (this | ||
233 | * was sb_journal_block_count) */ | ||
234 | __le32 jp_journal_max_batch; /* max number of blocks to batch into a | ||
235 | * trans */ | ||
236 | __le32 jp_journal_max_commit_age; /* in seconds, how old can an async | ||
237 | * commit be */ | ||
238 | __le32 jp_journal_max_trans_age; /* in seconds, how old can a transaction | ||
239 | * be */ | ||
240 | }; | ||
241 | |||
242 | /* this is the super from 3.5.X, where X >= 10 */ | ||
243 | struct reiserfs_super_block_v1 { | ||
244 | __le32 s_block_count; /* blocks count */ | ||
245 | __le32 s_free_blocks; /* free blocks count */ | ||
246 | __le32 s_root_block; /* root block number */ | ||
247 | struct journal_params s_journal; | ||
248 | __le16 s_blocksize; /* block size */ | ||
249 | __le16 s_oid_maxsize; /* max size of object id array, see | ||
250 | * get_objectid() commentary */ | ||
251 | __le16 s_oid_cursize; /* current size of object id array */ | ||
252 | __le16 s_umount_state; /* this is set to 1 when filesystem was | ||
253 | * umounted, to 2 - when not */ | ||
254 | char s_magic[10]; /* reiserfs magic string indicates that | ||
255 | * file system is reiserfs: | ||
256 | * "ReIsErFs" or "ReIsEr2Fs" or "ReIsEr3Fs" */ | ||
257 | __le16 s_fs_state; /* it is set to used by fsck to mark which | ||
258 | * phase of rebuilding is done */ | ||
259 | __le32 s_hash_function_code; /* indicate, what hash function is being use | ||
260 | * to sort names in a directory*/ | ||
261 | __le16 s_tree_height; /* height of disk tree */ | ||
262 | __le16 s_bmap_nr; /* amount of bitmap blocks needed to address | ||
263 | * each block of file system */ | ||
264 | __le16 s_version; /* this field is only reliable on filesystem | ||
265 | * with non-standard journal */ | ||
266 | __le16 s_reserved_for_journal; /* size in blocks of journal area on main | ||
267 | * device, we need to keep after | ||
268 | * making fs with non-standard journal */ | ||
269 | } __attribute__ ((__packed__)); | ||
270 | |||
271 | #define SB_SIZE_V1 (sizeof(struct reiserfs_super_block_v1)) | ||
272 | |||
273 | /* this is the on disk super block */ | ||
274 | struct reiserfs_super_block { | ||
275 | struct reiserfs_super_block_v1 s_v1; | ||
276 | __le32 s_inode_generation; | ||
277 | __le32 s_flags; /* Right now used only by inode-attributes, if enabled */ | ||
278 | unsigned char s_uuid[16]; /* filesystem unique identifier */ | ||
279 | unsigned char s_label[16]; /* filesystem volume label */ | ||
280 | __le16 s_mnt_count; /* Count of mounts since last fsck */ | ||
281 | __le16 s_max_mnt_count; /* Maximum mounts before check */ | ||
282 | __le32 s_lastcheck; /* Timestamp of last fsck */ | ||
283 | __le32 s_check_interval; /* Interval between checks */ | ||
284 | char s_unused[76]; /* zero filled by mkreiserfs and | ||
285 | * reiserfs_convert_objectid_map_v1() | ||
286 | * so any additions must be updated | ||
287 | * there as well. */ | ||
288 | } __attribute__ ((__packed__)); | ||
289 | |||
290 | #define SB_SIZE (sizeof(struct reiserfs_super_block)) | ||
291 | |||
292 | #define REISERFS_VERSION_1 0 | ||
293 | #define REISERFS_VERSION_2 2 | ||
294 | |||
295 | // on-disk super block fields converted to cpu form | ||
296 | #define SB_DISK_SUPER_BLOCK(s) (REISERFS_SB(s)->s_rs) | ||
297 | #define SB_V1_DISK_SUPER_BLOCK(s) (&(SB_DISK_SUPER_BLOCK(s)->s_v1)) | ||
298 | #define SB_BLOCKSIZE(s) \ | ||
299 | le32_to_cpu ((SB_V1_DISK_SUPER_BLOCK(s)->s_blocksize)) | ||
300 | #define SB_BLOCK_COUNT(s) \ | ||
301 | le32_to_cpu ((SB_V1_DISK_SUPER_BLOCK(s)->s_block_count)) | ||
302 | #define SB_FREE_BLOCKS(s) \ | ||
303 | le32_to_cpu ((SB_V1_DISK_SUPER_BLOCK(s)->s_free_blocks)) | ||
304 | #define SB_REISERFS_MAGIC(s) \ | ||
305 | (SB_V1_DISK_SUPER_BLOCK(s)->s_magic) | ||
306 | #define SB_ROOT_BLOCK(s) \ | ||
307 | le32_to_cpu ((SB_V1_DISK_SUPER_BLOCK(s)->s_root_block)) | ||
308 | #define SB_TREE_HEIGHT(s) \ | ||
309 | le16_to_cpu ((SB_V1_DISK_SUPER_BLOCK(s)->s_tree_height)) | ||
310 | #define SB_REISERFS_STATE(s) \ | ||
311 | le16_to_cpu ((SB_V1_DISK_SUPER_BLOCK(s)->s_umount_state)) | ||
312 | #define SB_VERSION(s) le16_to_cpu ((SB_V1_DISK_SUPER_BLOCK(s)->s_version)) | ||
313 | #define SB_BMAP_NR(s) le16_to_cpu ((SB_V1_DISK_SUPER_BLOCK(s)->s_bmap_nr)) | ||
314 | |||
315 | #define PUT_SB_BLOCK_COUNT(s, val) \ | ||
316 | do { SB_V1_DISK_SUPER_BLOCK(s)->s_block_count = cpu_to_le32(val); } while (0) | ||
317 | #define PUT_SB_FREE_BLOCKS(s, val) \ | ||
318 | do { SB_V1_DISK_SUPER_BLOCK(s)->s_free_blocks = cpu_to_le32(val); } while (0) | ||
319 | #define PUT_SB_ROOT_BLOCK(s, val) \ | ||
320 | do { SB_V1_DISK_SUPER_BLOCK(s)->s_root_block = cpu_to_le32(val); } while (0) | ||
321 | #define PUT_SB_TREE_HEIGHT(s, val) \ | ||
322 | do { SB_V1_DISK_SUPER_BLOCK(s)->s_tree_height = cpu_to_le16(val); } while (0) | ||
323 | #define PUT_SB_REISERFS_STATE(s, val) \ | ||
324 | do { SB_V1_DISK_SUPER_BLOCK(s)->s_umount_state = cpu_to_le16(val); } while (0) | ||
325 | #define PUT_SB_VERSION(s, val) \ | ||
326 | do { SB_V1_DISK_SUPER_BLOCK(s)->s_version = cpu_to_le16(val); } while (0) | ||
327 | #define PUT_SB_BMAP_NR(s, val) \ | ||
328 | do { SB_V1_DISK_SUPER_BLOCK(s)->s_bmap_nr = cpu_to_le16 (val); } while (0) | ||
329 | |||
330 | #define SB_ONDISK_JP(s) (&SB_V1_DISK_SUPER_BLOCK(s)->s_journal) | ||
331 | #define SB_ONDISK_JOURNAL_SIZE(s) \ | ||
332 | le32_to_cpu ((SB_ONDISK_JP(s)->jp_journal_size)) | ||
333 | #define SB_ONDISK_JOURNAL_1st_BLOCK(s) \ | ||
334 | le32_to_cpu ((SB_ONDISK_JP(s)->jp_journal_1st_block)) | ||
335 | #define SB_ONDISK_JOURNAL_DEVICE(s) \ | ||
336 | le32_to_cpu ((SB_ONDISK_JP(s)->jp_journal_dev)) | ||
337 | #define SB_ONDISK_RESERVED_FOR_JOURNAL(s) \ | ||
338 | le16_to_cpu ((SB_V1_DISK_SUPER_BLOCK(s)->s_reserved_for_journal)) | ||
339 | |||
340 | #define is_block_in_log_or_reserved_area(s, block) \ | ||
341 | block >= SB_JOURNAL_1st_RESERVED_BLOCK(s) \ | ||
342 | && block < SB_JOURNAL_1st_RESERVED_BLOCK(s) + \ | ||
343 | ((!is_reiserfs_jr(SB_DISK_SUPER_BLOCK(s)) ? \ | ||
344 | SB_ONDISK_JOURNAL_SIZE(s) + 1 : SB_ONDISK_RESERVED_FOR_JOURNAL(s))) | ||
345 | |||
346 | int is_reiserfs_3_5(struct reiserfs_super_block *rs); | ||
347 | int is_reiserfs_3_6(struct reiserfs_super_block *rs); | ||
348 | int is_reiserfs_jr(struct reiserfs_super_block *rs); | ||
349 | |||
350 | /* ReiserFS leaves the first 64k unused, so that partition labels have | ||
351 | enough space. If someone wants to write a fancy bootloader that | ||
352 | needs more than 64k, let us know, and this will be increased in size. | ||
353 | This number must be larger than than the largest block size on any | ||
354 | platform, or code will break. -Hans */ | ||
355 | #define REISERFS_DISK_OFFSET_IN_BYTES (64 * 1024) | ||
356 | #define REISERFS_FIRST_BLOCK unused_define | ||
357 | #define REISERFS_JOURNAL_OFFSET_IN_BYTES REISERFS_DISK_OFFSET_IN_BYTES | ||
358 | |||
359 | /* the spot for the super in versions 3.5 - 3.5.10 (inclusive) */ | ||
360 | #define REISERFS_OLD_DISK_OFFSET_IN_BYTES (8 * 1024) | ||
361 | |||
362 | /* reiserfs internal error code (used by search_by_key and fix_nodes)) */ | ||
363 | #define CARRY_ON 0 | ||
364 | #define REPEAT_SEARCH -1 | ||
365 | #define IO_ERROR -2 | ||
366 | #define NO_DISK_SPACE -3 | ||
367 | #define NO_BALANCING_NEEDED (-4) | ||
368 | #define NO_MORE_UNUSED_CONTIGUOUS_BLOCKS (-5) | ||
369 | #define QUOTA_EXCEEDED -6 | ||
370 | |||
371 | typedef __u32 b_blocknr_t; | ||
372 | typedef __le32 unp_t; | ||
373 | |||
374 | struct unfm_nodeinfo { | ||
375 | unp_t unfm_nodenum; | ||
376 | unsigned short unfm_freespace; | ||
377 | }; | ||
378 | |||
379 | /* there are two formats of keys: 3.5 and 3.6 | ||
380 | */ | ||
381 | #define KEY_FORMAT_3_5 0 | ||
382 | #define KEY_FORMAT_3_6 1 | ||
383 | |||
384 | /* there are two stat datas */ | ||
385 | #define STAT_DATA_V1 0 | ||
386 | #define STAT_DATA_V2 1 | ||
387 | |||
388 | static inline struct reiserfs_inode_info *REISERFS_I(const struct inode *inode) | ||
389 | { | ||
390 | return container_of(inode, struct reiserfs_inode_info, vfs_inode); | ||
391 | } | ||
392 | |||
393 | static inline struct reiserfs_sb_info *REISERFS_SB(const struct super_block *sb) | ||
394 | { | ||
395 | return sb->s_fs_info; | ||
396 | } | ||
397 | |||
398 | /* Don't trust REISERFS_SB(sb)->s_bmap_nr, it's a u16 | ||
399 | * which overflows on large file systems. */ | ||
400 | static inline __u32 reiserfs_bmap_count(struct super_block *sb) | ||
401 | { | ||
402 | return (SB_BLOCK_COUNT(sb) - 1) / (sb->s_blocksize * 8) + 1; | ||
403 | } | ||
404 | |||
405 | static inline int bmap_would_wrap(unsigned bmap_nr) | ||
406 | { | ||
407 | return bmap_nr > ((1LL << 16) - 1); | ||
408 | } | ||
409 | |||
410 | /** this says about version of key of all items (but stat data) the | ||
411 | object consists of */ | ||
412 | #define get_inode_item_key_version( inode ) \ | ||
413 | ((REISERFS_I(inode)->i_flags & i_item_key_version_mask) ? KEY_FORMAT_3_6 : KEY_FORMAT_3_5) | ||
414 | |||
415 | #define set_inode_item_key_version( inode, version ) \ | ||
416 | ({ if((version)==KEY_FORMAT_3_6) \ | ||
417 | REISERFS_I(inode)->i_flags |= i_item_key_version_mask; \ | ||
418 | else \ | ||
419 | REISERFS_I(inode)->i_flags &= ~i_item_key_version_mask; }) | ||
420 | |||
421 | #define get_inode_sd_version(inode) \ | ||
422 | ((REISERFS_I(inode)->i_flags & i_stat_data_version_mask) ? STAT_DATA_V2 : STAT_DATA_V1) | ||
423 | |||
424 | #define set_inode_sd_version(inode, version) \ | ||
425 | ({ if((version)==STAT_DATA_V2) \ | ||
426 | REISERFS_I(inode)->i_flags |= i_stat_data_version_mask; \ | ||
427 | else \ | ||
428 | REISERFS_I(inode)->i_flags &= ~i_stat_data_version_mask; }) | ||
429 | |||
430 | /* This is an aggressive tail suppression policy, I am hoping it | ||
431 | improves our benchmarks. The principle behind it is that percentage | ||
432 | space saving is what matters, not absolute space saving. This is | ||
433 | non-intuitive, but it helps to understand it if you consider that the | ||
434 | cost to access 4 blocks is not much more than the cost to access 1 | ||
435 | block, if you have to do a seek and rotate. A tail risks a | ||
436 | non-linear disk access that is significant as a percentage of total | ||
437 | time cost for a 4 block file and saves an amount of space that is | ||
438 | less significant as a percentage of space, or so goes the hypothesis. | ||
439 | -Hans */ | ||
440 | #define STORE_TAIL_IN_UNFM_S1(n_file_size,n_tail_size,n_block_size) \ | ||
441 | (\ | ||
442 | (!(n_tail_size)) || \ | ||
443 | (((n_tail_size) > MAX_DIRECT_ITEM_LEN(n_block_size)) || \ | ||
444 | ( (n_file_size) >= (n_block_size) * 4 ) || \ | ||
445 | ( ( (n_file_size) >= (n_block_size) * 3 ) && \ | ||
446 | ( (n_tail_size) >= (MAX_DIRECT_ITEM_LEN(n_block_size))/4) ) || \ | ||
447 | ( ( (n_file_size) >= (n_block_size) * 2 ) && \ | ||
448 | ( (n_tail_size) >= (MAX_DIRECT_ITEM_LEN(n_block_size))/2) ) || \ | ||
449 | ( ( (n_file_size) >= (n_block_size) ) && \ | ||
450 | ( (n_tail_size) >= (MAX_DIRECT_ITEM_LEN(n_block_size) * 3)/4) ) ) \ | ||
451 | ) | ||
452 | |||
453 | /* Another strategy for tails, this one means only create a tail if all the | ||
454 | file would fit into one DIRECT item. | ||
455 | Primary intention for this one is to increase performance by decreasing | ||
456 | seeking. | ||
457 | */ | ||
458 | #define STORE_TAIL_IN_UNFM_S2(n_file_size,n_tail_size,n_block_size) \ | ||
459 | (\ | ||
460 | (!(n_tail_size)) || \ | ||
461 | (((n_file_size) > MAX_DIRECT_ITEM_LEN(n_block_size)) ) \ | ||
462 | ) | ||
463 | |||
464 | /* | ||
465 | * values for s_umount_state field | ||
466 | */ | ||
467 | #define REISERFS_VALID_FS 1 | ||
468 | #define REISERFS_ERROR_FS 2 | ||
469 | |||
470 | // | ||
471 | // there are 5 item types currently | ||
472 | // | ||
473 | #define TYPE_STAT_DATA 0 | ||
474 | #define TYPE_INDIRECT 1 | ||
475 | #define TYPE_DIRECT 2 | ||
476 | #define TYPE_DIRENTRY 3 | ||
477 | #define TYPE_MAXTYPE 3 | ||
478 | #define TYPE_ANY 15 // FIXME: comment is required | ||
479 | |||
480 | /***************************************************************************/ | ||
481 | /* KEY & ITEM HEAD */ | ||
482 | /***************************************************************************/ | ||
483 | |||
484 | // | ||
485 | // directories use this key as well as old files | ||
486 | // | ||
487 | struct offset_v1 { | ||
488 | __le32 k_offset; | ||
489 | __le32 k_uniqueness; | ||
490 | } __attribute__ ((__packed__)); | ||
491 | |||
492 | struct offset_v2 { | ||
493 | __le64 v; | ||
494 | } __attribute__ ((__packed__)); | ||
495 | |||
496 | static inline __u16 offset_v2_k_type(const struct offset_v2 *v2) | ||
497 | { | ||
498 | __u8 type = le64_to_cpu(v2->v) >> 60; | ||
499 | return (type <= TYPE_MAXTYPE) ? type : TYPE_ANY; | ||
500 | } | ||
501 | |||
502 | static inline void set_offset_v2_k_type(struct offset_v2 *v2, int type) | ||
503 | { | ||
504 | v2->v = | ||
505 | (v2->v & cpu_to_le64(~0ULL >> 4)) | cpu_to_le64((__u64) type << 60); | ||
506 | } | ||
507 | |||
508 | static inline loff_t offset_v2_k_offset(const struct offset_v2 *v2) | ||
509 | { | ||
510 | return le64_to_cpu(v2->v) & (~0ULL >> 4); | ||
511 | } | ||
512 | |||
513 | static inline void set_offset_v2_k_offset(struct offset_v2 *v2, loff_t offset) | ||
514 | { | ||
515 | offset &= (~0ULL >> 4); | ||
516 | v2->v = (v2->v & cpu_to_le64(15ULL << 60)) | cpu_to_le64(offset); | ||
517 | } | ||
518 | |||
519 | /* Key of an item determines its location in the S+tree, and | ||
520 | is composed of 4 components */ | ||
521 | struct reiserfs_key { | ||
522 | __le32 k_dir_id; /* packing locality: by default parent | ||
523 | directory object id */ | ||
524 | __le32 k_objectid; /* object identifier */ | ||
525 | union { | ||
526 | struct offset_v1 k_offset_v1; | ||
527 | struct offset_v2 k_offset_v2; | ||
528 | } __attribute__ ((__packed__)) u; | ||
529 | } __attribute__ ((__packed__)); | ||
530 | |||
531 | struct in_core_key { | ||
532 | __u32 k_dir_id; /* packing locality: by default parent | ||
533 | directory object id */ | ||
534 | __u32 k_objectid; /* object identifier */ | ||
535 | __u64 k_offset; | ||
536 | __u8 k_type; | ||
537 | }; | ||
538 | |||
539 | struct cpu_key { | ||
540 | struct in_core_key on_disk_key; | ||
541 | int version; | ||
542 | int key_length; /* 3 in all cases but direct2indirect and | ||
543 | indirect2direct conversion */ | ||
544 | }; | ||
545 | |||
546 | /* Our function for comparing keys can compare keys of different | ||
547 | lengths. It takes as a parameter the length of the keys it is to | ||
548 | compare. These defines are used in determining what is to be passed | ||
549 | to it as that parameter. */ | ||
550 | #define REISERFS_FULL_KEY_LEN 4 | ||
551 | #define REISERFS_SHORT_KEY_LEN 2 | ||
552 | |||
553 | /* The result of the key compare */ | ||
554 | #define FIRST_GREATER 1 | ||
555 | #define SECOND_GREATER -1 | ||
556 | #define KEYS_IDENTICAL 0 | ||
557 | #define KEY_FOUND 1 | ||
558 | #define KEY_NOT_FOUND 0 | ||
559 | |||
560 | #define KEY_SIZE (sizeof(struct reiserfs_key)) | ||
561 | #define SHORT_KEY_SIZE (sizeof (__u32) + sizeof (__u32)) | ||
562 | |||
563 | /* return values for search_by_key and clones */ | ||
564 | #define ITEM_FOUND 1 | ||
565 | #define ITEM_NOT_FOUND 0 | ||
566 | #define ENTRY_FOUND 1 | ||
567 | #define ENTRY_NOT_FOUND 0 | ||
568 | #define DIRECTORY_NOT_FOUND -1 | ||
569 | #define REGULAR_FILE_FOUND -2 | ||
570 | #define DIRECTORY_FOUND -3 | ||
571 | #define BYTE_FOUND 1 | ||
572 | #define BYTE_NOT_FOUND 0 | ||
573 | #define FILE_NOT_FOUND -1 | ||
574 | |||
575 | #define POSITION_FOUND 1 | ||
576 | #define POSITION_NOT_FOUND 0 | ||
577 | |||
578 | // return values for reiserfs_find_entry and search_by_entry_key | ||
579 | #define NAME_FOUND 1 | ||
580 | #define NAME_NOT_FOUND 0 | ||
581 | #define GOTO_PREVIOUS_ITEM 2 | ||
582 | #define NAME_FOUND_INVISIBLE 3 | ||
583 | |||
584 | /* Everything in the filesystem is stored as a set of items. The | ||
585 | item head contains the key of the item, its free space (for | ||
586 | indirect items) and specifies the location of the item itself | ||
587 | within the block. */ | ||
588 | |||
589 | struct item_head { | ||
590 | /* Everything in the tree is found by searching for it based on | ||
591 | * its key.*/ | ||
592 | struct reiserfs_key ih_key; | ||
593 | union { | ||
594 | /* The free space in the last unformatted node of an | ||
595 | indirect item if this is an indirect item. This | ||
596 | equals 0xFFFF iff this is a direct item or stat data | ||
597 | item. Note that the key, not this field, is used to | ||
598 | determine the item type, and thus which field this | ||
599 | union contains. */ | ||
600 | __le16 ih_free_space_reserved; | ||
601 | /* Iff this is a directory item, this field equals the | ||
602 | number of directory entries in the directory item. */ | ||
603 | __le16 ih_entry_count; | ||
604 | } __attribute__ ((__packed__)) u; | ||
605 | __le16 ih_item_len; /* total size of the item body */ | ||
606 | __le16 ih_item_location; /* an offset to the item body | ||
607 | * within the block */ | ||
608 | __le16 ih_version; /* 0 for all old items, 2 for new | ||
609 | ones. Highest bit is set by fsck | ||
610 | temporary, cleaned after all | ||
611 | done */ | ||
612 | } __attribute__ ((__packed__)); | ||
613 | /* size of item header */ | ||
614 | #define IH_SIZE (sizeof(struct item_head)) | ||
615 | |||
616 | #define ih_free_space(ih) le16_to_cpu((ih)->u.ih_free_space_reserved) | ||
617 | #define ih_version(ih) le16_to_cpu((ih)->ih_version) | ||
618 | #define ih_entry_count(ih) le16_to_cpu((ih)->u.ih_entry_count) | ||
619 | #define ih_location(ih) le16_to_cpu((ih)->ih_item_location) | ||
620 | #define ih_item_len(ih) le16_to_cpu((ih)->ih_item_len) | ||
621 | |||
622 | #define put_ih_free_space(ih, val) do { (ih)->u.ih_free_space_reserved = cpu_to_le16(val); } while(0) | ||
623 | #define put_ih_version(ih, val) do { (ih)->ih_version = cpu_to_le16(val); } while (0) | ||
624 | #define put_ih_entry_count(ih, val) do { (ih)->u.ih_entry_count = cpu_to_le16(val); } while (0) | ||
625 | #define put_ih_location(ih, val) do { (ih)->ih_item_location = cpu_to_le16(val); } while (0) | ||
626 | #define put_ih_item_len(ih, val) do { (ih)->ih_item_len = cpu_to_le16(val); } while (0) | ||
627 | |||
628 | #define unreachable_item(ih) (ih_version(ih) & (1 << 15)) | ||
629 | |||
630 | #define get_ih_free_space(ih) (ih_version (ih) == KEY_FORMAT_3_6 ? 0 : ih_free_space (ih)) | ||
631 | #define set_ih_free_space(ih,val) put_ih_free_space((ih), ((ih_version(ih) == KEY_FORMAT_3_6) ? 0 : (val))) | ||
632 | |||
633 | /* these operate on indirect items, where you've got an array of ints | ||
634 | ** at a possibly unaligned location. These are a noop on ia32 | ||
635 | ** | ||
636 | ** p is the array of __u32, i is the index into the array, v is the value | ||
637 | ** to store there. | ||
638 | */ | ||
639 | #define get_block_num(p, i) get_unaligned_le32((p) + (i)) | ||
640 | #define put_block_num(p, i, v) put_unaligned_le32((v), (p) + (i)) | ||
641 | |||
642 | // | ||
643 | // in old version uniqueness field shows key type | ||
644 | // | ||
645 | #define V1_SD_UNIQUENESS 0 | ||
646 | #define V1_INDIRECT_UNIQUENESS 0xfffffffe | ||
647 | #define V1_DIRECT_UNIQUENESS 0xffffffff | ||
648 | #define V1_DIRENTRY_UNIQUENESS 500 | ||
649 | #define V1_ANY_UNIQUENESS 555 // FIXME: comment is required | ||
650 | |||
651 | // | ||
652 | // here are conversion routines | ||
653 | // | ||
654 | static inline int uniqueness2type(__u32 uniqueness) CONSTF; | ||
655 | static inline int uniqueness2type(__u32 uniqueness) | ||
656 | { | ||
657 | switch ((int)uniqueness) { | ||
658 | case V1_SD_UNIQUENESS: | ||
659 | return TYPE_STAT_DATA; | ||
660 | case V1_INDIRECT_UNIQUENESS: | ||
661 | return TYPE_INDIRECT; | ||
662 | case V1_DIRECT_UNIQUENESS: | ||
663 | return TYPE_DIRECT; | ||
664 | case V1_DIRENTRY_UNIQUENESS: | ||
665 | return TYPE_DIRENTRY; | ||
666 | case V1_ANY_UNIQUENESS: | ||
667 | default: | ||
668 | return TYPE_ANY; | ||
669 | } | ||
670 | } | ||
671 | |||
672 | static inline __u32 type2uniqueness(int type) CONSTF; | ||
673 | static inline __u32 type2uniqueness(int type) | ||
674 | { | ||
675 | switch (type) { | ||
676 | case TYPE_STAT_DATA: | ||
677 | return V1_SD_UNIQUENESS; | ||
678 | case TYPE_INDIRECT: | ||
679 | return V1_INDIRECT_UNIQUENESS; | ||
680 | case TYPE_DIRECT: | ||
681 | return V1_DIRECT_UNIQUENESS; | ||
682 | case TYPE_DIRENTRY: | ||
683 | return V1_DIRENTRY_UNIQUENESS; | ||
684 | case TYPE_ANY: | ||
685 | default: | ||
686 | return V1_ANY_UNIQUENESS; | ||
687 | } | ||
688 | } | ||
689 | |||
690 | // | ||
691 | // key is pointer to on disk key which is stored in le, result is cpu, | ||
692 | // there is no way to get version of object from key, so, provide | ||
693 | // version to these defines | ||
694 | // | ||
695 | static inline loff_t le_key_k_offset(int version, | ||
696 | const struct reiserfs_key *key) | ||
697 | { | ||
698 | return (version == KEY_FORMAT_3_5) ? | ||
699 | le32_to_cpu(key->u.k_offset_v1.k_offset) : | ||
700 | offset_v2_k_offset(&(key->u.k_offset_v2)); | ||
701 | } | ||
702 | |||
703 | static inline loff_t le_ih_k_offset(const struct item_head *ih) | ||
704 | { | ||
705 | return le_key_k_offset(ih_version(ih), &(ih->ih_key)); | ||
706 | } | ||
707 | |||
708 | static inline loff_t le_key_k_type(int version, const struct reiserfs_key *key) | ||
709 | { | ||
710 | return (version == KEY_FORMAT_3_5) ? | ||
711 | uniqueness2type(le32_to_cpu(key->u.k_offset_v1.k_uniqueness)) : | ||
712 | offset_v2_k_type(&(key->u.k_offset_v2)); | ||
713 | } | ||
714 | |||
715 | static inline loff_t le_ih_k_type(const struct item_head *ih) | ||
716 | { | ||
717 | return le_key_k_type(ih_version(ih), &(ih->ih_key)); | ||
718 | } | ||
719 | |||
720 | static inline void set_le_key_k_offset(int version, struct reiserfs_key *key, | ||
721 | loff_t offset) | ||
722 | { | ||
723 | (version == KEY_FORMAT_3_5) ? (void)(key->u.k_offset_v1.k_offset = cpu_to_le32(offset)) : /* jdm check */ | ||
724 | (void)(set_offset_v2_k_offset(&(key->u.k_offset_v2), offset)); | ||
725 | } | ||
726 | |||
727 | static inline void set_le_ih_k_offset(struct item_head *ih, loff_t offset) | ||
728 | { | ||
729 | set_le_key_k_offset(ih_version(ih), &(ih->ih_key), offset); | ||
730 | } | ||
731 | |||
732 | static inline void set_le_key_k_type(int version, struct reiserfs_key *key, | ||
733 | int type) | ||
734 | { | ||
735 | (version == KEY_FORMAT_3_5) ? | ||
736 | (void)(key->u.k_offset_v1.k_uniqueness = | ||
737 | cpu_to_le32(type2uniqueness(type))) | ||
738 | : (void)(set_offset_v2_k_type(&(key->u.k_offset_v2), type)); | ||
739 | } | ||
740 | |||
741 | static inline void set_le_ih_k_type(struct item_head *ih, int type) | ||
742 | { | ||
743 | set_le_key_k_type(ih_version(ih), &(ih->ih_key), type); | ||
744 | } | ||
745 | |||
746 | static inline int is_direntry_le_key(int version, struct reiserfs_key *key) | ||
747 | { | ||
748 | return le_key_k_type(version, key) == TYPE_DIRENTRY; | ||
749 | } | ||
750 | |||
751 | static inline int is_direct_le_key(int version, struct reiserfs_key *key) | ||
752 | { | ||
753 | return le_key_k_type(version, key) == TYPE_DIRECT; | ||
754 | } | ||
755 | |||
756 | static inline int is_indirect_le_key(int version, struct reiserfs_key *key) | ||
757 | { | ||
758 | return le_key_k_type(version, key) == TYPE_INDIRECT; | ||
759 | } | ||
760 | |||
761 | static inline int is_statdata_le_key(int version, struct reiserfs_key *key) | ||
762 | { | ||
763 | return le_key_k_type(version, key) == TYPE_STAT_DATA; | ||
764 | } | ||
765 | |||
766 | // | ||
767 | // item header has version. | ||
768 | // | ||
769 | static inline int is_direntry_le_ih(struct item_head *ih) | ||
770 | { | ||
771 | return is_direntry_le_key(ih_version(ih), &ih->ih_key); | ||
772 | } | ||
773 | |||
774 | static inline int is_direct_le_ih(struct item_head *ih) | ||
775 | { | ||
776 | return is_direct_le_key(ih_version(ih), &ih->ih_key); | ||
777 | } | ||
778 | |||
779 | static inline int is_indirect_le_ih(struct item_head *ih) | ||
780 | { | ||
781 | return is_indirect_le_key(ih_version(ih), &ih->ih_key); | ||
782 | } | ||
783 | |||
784 | static inline int is_statdata_le_ih(struct item_head *ih) | ||
785 | { | ||
786 | return is_statdata_le_key(ih_version(ih), &ih->ih_key); | ||
787 | } | ||
788 | |||
789 | // | ||
790 | // key is pointer to cpu key, result is cpu | ||
791 | // | ||
792 | static inline loff_t cpu_key_k_offset(const struct cpu_key *key) | ||
793 | { | ||
794 | return key->on_disk_key.k_offset; | ||
795 | } | ||
796 | |||
797 | static inline loff_t cpu_key_k_type(const struct cpu_key *key) | ||
798 | { | ||
799 | return key->on_disk_key.k_type; | ||
800 | } | ||
801 | |||
802 | static inline void set_cpu_key_k_offset(struct cpu_key *key, loff_t offset) | ||
803 | { | ||
804 | key->on_disk_key.k_offset = offset; | ||
805 | } | ||
806 | |||
807 | static inline void set_cpu_key_k_type(struct cpu_key *key, int type) | ||
808 | { | ||
809 | key->on_disk_key.k_type = type; | ||
810 | } | ||
811 | |||
812 | static inline void cpu_key_k_offset_dec(struct cpu_key *key) | ||
813 | { | ||
814 | key->on_disk_key.k_offset--; | ||
815 | } | ||
816 | |||
817 | #define is_direntry_cpu_key(key) (cpu_key_k_type (key) == TYPE_DIRENTRY) | ||
818 | #define is_direct_cpu_key(key) (cpu_key_k_type (key) == TYPE_DIRECT) | ||
819 | #define is_indirect_cpu_key(key) (cpu_key_k_type (key) == TYPE_INDIRECT) | ||
820 | #define is_statdata_cpu_key(key) (cpu_key_k_type (key) == TYPE_STAT_DATA) | ||
821 | |||
822 | /* are these used ? */ | ||
823 | #define is_direntry_cpu_ih(ih) (is_direntry_cpu_key (&((ih)->ih_key))) | ||
824 | #define is_direct_cpu_ih(ih) (is_direct_cpu_key (&((ih)->ih_key))) | ||
825 | #define is_indirect_cpu_ih(ih) (is_indirect_cpu_key (&((ih)->ih_key))) | ||
826 | #define is_statdata_cpu_ih(ih) (is_statdata_cpu_key (&((ih)->ih_key))) | ||
827 | |||
828 | #define I_K_KEY_IN_ITEM(ih, key, n_blocksize) \ | ||
829 | (!COMP_SHORT_KEYS(ih, key) && \ | ||
830 | I_OFF_BYTE_IN_ITEM(ih, k_offset(key), n_blocksize)) | ||
831 | |||
832 | /* maximal length of item */ | ||
833 | #define MAX_ITEM_LEN(block_size) (block_size - BLKH_SIZE - IH_SIZE) | ||
834 | #define MIN_ITEM_LEN 1 | ||
835 | |||
836 | /* object identifier for root dir */ | ||
837 | #define REISERFS_ROOT_OBJECTID 2 | ||
838 | #define REISERFS_ROOT_PARENT_OBJECTID 1 | ||
839 | |||
840 | extern struct reiserfs_key root_key; | ||
841 | |||
842 | /* | ||
843 | * Picture represents a leaf of the S+tree | ||
844 | * ______________________________________________________ | ||
845 | * | | Array of | | | | ||
846 | * |Block | Object-Item | F r e e | Objects- | | ||
847 | * | head | Headers | S p a c e | Items | | ||
848 | * |______|_______________|___________________|___________| | ||
849 | */ | ||
850 | |||
851 | /* Header of a disk block. More precisely, header of a formatted leaf | ||
852 | or internal node, and not the header of an unformatted node. */ | ||
853 | struct block_head { | ||
854 | __le16 blk_level; /* Level of a block in the tree. */ | ||
855 | __le16 blk_nr_item; /* Number of keys/items in a block. */ | ||
856 | __le16 blk_free_space; /* Block free space in bytes. */ | ||
857 | __le16 blk_reserved; | ||
858 | /* dump this in v4/planA */ | ||
859 | struct reiserfs_key blk_right_delim_key; /* kept only for compatibility */ | ||
860 | }; | ||
861 | |||
862 | #define BLKH_SIZE (sizeof(struct block_head)) | ||
863 | #define blkh_level(p_blkh) (le16_to_cpu((p_blkh)->blk_level)) | ||
864 | #define blkh_nr_item(p_blkh) (le16_to_cpu((p_blkh)->blk_nr_item)) | ||
865 | #define blkh_free_space(p_blkh) (le16_to_cpu((p_blkh)->blk_free_space)) | ||
866 | #define blkh_reserved(p_blkh) (le16_to_cpu((p_blkh)->blk_reserved)) | ||
867 | #define set_blkh_level(p_blkh,val) ((p_blkh)->blk_level = cpu_to_le16(val)) | ||
868 | #define set_blkh_nr_item(p_blkh,val) ((p_blkh)->blk_nr_item = cpu_to_le16(val)) | ||
869 | #define set_blkh_free_space(p_blkh,val) ((p_blkh)->blk_free_space = cpu_to_le16(val)) | ||
870 | #define set_blkh_reserved(p_blkh,val) ((p_blkh)->blk_reserved = cpu_to_le16(val)) | ||
871 | #define blkh_right_delim_key(p_blkh) ((p_blkh)->blk_right_delim_key) | ||
872 | #define set_blkh_right_delim_key(p_blkh,val) ((p_blkh)->blk_right_delim_key = val) | ||
873 | |||
874 | /* | ||
875 | * values for blk_level field of the struct block_head | ||
876 | */ | ||
877 | |||
878 | #define FREE_LEVEL 0 /* when node gets removed from the tree its | ||
879 | blk_level is set to FREE_LEVEL. It is then | ||
880 | used to see whether the node is still in the | ||
881 | tree */ | ||
882 | |||
883 | #define DISK_LEAF_NODE_LEVEL 1 /* Leaf node level. */ | ||
884 | |||
885 | /* Given the buffer head of a formatted node, resolve to the block head of that node. */ | ||
886 | #define B_BLK_HEAD(bh) ((struct block_head *)((bh)->b_data)) | ||
887 | /* Number of items that are in buffer. */ | ||
888 | #define B_NR_ITEMS(bh) (blkh_nr_item(B_BLK_HEAD(bh))) | ||
889 | #define B_LEVEL(bh) (blkh_level(B_BLK_HEAD(bh))) | ||
890 | #define B_FREE_SPACE(bh) (blkh_free_space(B_BLK_HEAD(bh))) | ||
891 | |||
892 | #define PUT_B_NR_ITEMS(bh, val) do { set_blkh_nr_item(B_BLK_HEAD(bh), val); } while (0) | ||
893 | #define PUT_B_LEVEL(bh, val) do { set_blkh_level(B_BLK_HEAD(bh), val); } while (0) | ||
894 | #define PUT_B_FREE_SPACE(bh, val) do { set_blkh_free_space(B_BLK_HEAD(bh), val); } while (0) | ||
895 | |||
896 | /* Get right delimiting key. -- little endian */ | ||
897 | #define B_PRIGHT_DELIM_KEY(bh) (&(blk_right_delim_key(B_BLK_HEAD(bh)))) | ||
898 | |||
899 | /* Does the buffer contain a disk leaf. */ | ||
900 | #define B_IS_ITEMS_LEVEL(bh) (B_LEVEL(bh) == DISK_LEAF_NODE_LEVEL) | ||
901 | |||
902 | /* Does the buffer contain a disk internal node */ | ||
903 | #define B_IS_KEYS_LEVEL(bh) (B_LEVEL(bh) > DISK_LEAF_NODE_LEVEL \ | ||
904 | && B_LEVEL(bh) <= MAX_HEIGHT) | ||
905 | |||
906 | /***************************************************************************/ | ||
907 | /* STAT DATA */ | ||
908 | /***************************************************************************/ | ||
909 | |||
910 | // | ||
911 | // old stat data is 32 bytes long. We are going to distinguish new one by | ||
912 | // different size | ||
913 | // | ||
914 | struct stat_data_v1 { | ||
915 | __le16 sd_mode; /* file type, permissions */ | ||
916 | __le16 sd_nlink; /* number of hard links */ | ||
917 | __le16 sd_uid; /* owner */ | ||
918 | __le16 sd_gid; /* group */ | ||
919 | __le32 sd_size; /* file size */ | ||
920 | __le32 sd_atime; /* time of last access */ | ||
921 | __le32 sd_mtime; /* time file was last modified */ | ||
922 | __le32 sd_ctime; /* time inode (stat data) was last changed (except changes to sd_atime and sd_mtime) */ | ||
923 | union { | ||
924 | __le32 sd_rdev; | ||
925 | __le32 sd_blocks; /* number of blocks file uses */ | ||
926 | } __attribute__ ((__packed__)) u; | ||
927 | __le32 sd_first_direct_byte; /* first byte of file which is stored | ||
928 | in a direct item: except that if it | ||
929 | equals 1 it is a symlink and if it | ||
930 | equals ~(__u32)0 there is no | ||
931 | direct item. The existence of this | ||
932 | field really grates on me. Let's | ||
933 | replace it with a macro based on | ||
934 | sd_size and our tail suppression | ||
935 | policy. Someday. -Hans */ | ||
936 | } __attribute__ ((__packed__)); | ||
937 | |||
938 | #define SD_V1_SIZE (sizeof(struct stat_data_v1)) | ||
939 | #define stat_data_v1(ih) (ih_version (ih) == KEY_FORMAT_3_5) | ||
940 | #define sd_v1_mode(sdp) (le16_to_cpu((sdp)->sd_mode)) | ||
941 | #define set_sd_v1_mode(sdp,v) ((sdp)->sd_mode = cpu_to_le16(v)) | ||
942 | #define sd_v1_nlink(sdp) (le16_to_cpu((sdp)->sd_nlink)) | ||
943 | #define set_sd_v1_nlink(sdp,v) ((sdp)->sd_nlink = cpu_to_le16(v)) | ||
944 | #define sd_v1_uid(sdp) (le16_to_cpu((sdp)->sd_uid)) | ||
945 | #define set_sd_v1_uid(sdp,v) ((sdp)->sd_uid = cpu_to_le16(v)) | ||
946 | #define sd_v1_gid(sdp) (le16_to_cpu((sdp)->sd_gid)) | ||
947 | #define set_sd_v1_gid(sdp,v) ((sdp)->sd_gid = cpu_to_le16(v)) | ||
948 | #define sd_v1_size(sdp) (le32_to_cpu((sdp)->sd_size)) | ||
949 | #define set_sd_v1_size(sdp,v) ((sdp)->sd_size = cpu_to_le32(v)) | ||
950 | #define sd_v1_atime(sdp) (le32_to_cpu((sdp)->sd_atime)) | ||
951 | #define set_sd_v1_atime(sdp,v) ((sdp)->sd_atime = cpu_to_le32(v)) | ||
952 | #define sd_v1_mtime(sdp) (le32_to_cpu((sdp)->sd_mtime)) | ||
953 | #define set_sd_v1_mtime(sdp,v) ((sdp)->sd_mtime = cpu_to_le32(v)) | ||
954 | #define sd_v1_ctime(sdp) (le32_to_cpu((sdp)->sd_ctime)) | ||
955 | #define set_sd_v1_ctime(sdp,v) ((sdp)->sd_ctime = cpu_to_le32(v)) | ||
956 | #define sd_v1_rdev(sdp) (le32_to_cpu((sdp)->u.sd_rdev)) | ||
957 | #define set_sd_v1_rdev(sdp,v) ((sdp)->u.sd_rdev = cpu_to_le32(v)) | ||
958 | #define sd_v1_blocks(sdp) (le32_to_cpu((sdp)->u.sd_blocks)) | ||
959 | #define set_sd_v1_blocks(sdp,v) ((sdp)->u.sd_blocks = cpu_to_le32(v)) | ||
960 | #define sd_v1_first_direct_byte(sdp) \ | ||
961 | (le32_to_cpu((sdp)->sd_first_direct_byte)) | ||
962 | #define set_sd_v1_first_direct_byte(sdp,v) \ | ||
963 | ((sdp)->sd_first_direct_byte = cpu_to_le32(v)) | ||
964 | |||
965 | /* inode flags stored in sd_attrs (nee sd_reserved) */ | ||
966 | |||
967 | /* we want common flags to have the same values as in ext2, | ||
968 | so chattr(1) will work without problems */ | ||
969 | #define REISERFS_IMMUTABLE_FL FS_IMMUTABLE_FL | ||
970 | #define REISERFS_APPEND_FL FS_APPEND_FL | ||
971 | #define REISERFS_SYNC_FL FS_SYNC_FL | ||
972 | #define REISERFS_NOATIME_FL FS_NOATIME_FL | ||
973 | #define REISERFS_NODUMP_FL FS_NODUMP_FL | ||
974 | #define REISERFS_SECRM_FL FS_SECRM_FL | ||
975 | #define REISERFS_UNRM_FL FS_UNRM_FL | ||
976 | #define REISERFS_COMPR_FL FS_COMPR_FL | ||
977 | #define REISERFS_NOTAIL_FL FS_NOTAIL_FL | ||
978 | |||
979 | /* persistent flags that file inherits from the parent directory */ | ||
980 | #define REISERFS_INHERIT_MASK ( REISERFS_IMMUTABLE_FL | \ | ||
981 | REISERFS_SYNC_FL | \ | ||
982 | REISERFS_NOATIME_FL | \ | ||
983 | REISERFS_NODUMP_FL | \ | ||
984 | REISERFS_SECRM_FL | \ | ||
985 | REISERFS_COMPR_FL | \ | ||
986 | REISERFS_NOTAIL_FL ) | ||
987 | |||
988 | /* Stat Data on disk (reiserfs version of UFS disk inode minus the | ||
989 | address blocks) */ | ||
990 | struct stat_data { | ||
991 | __le16 sd_mode; /* file type, permissions */ | ||
992 | __le16 sd_attrs; /* persistent inode flags */ | ||
993 | __le32 sd_nlink; /* number of hard links */ | ||
994 | __le64 sd_size; /* file size */ | ||
995 | __le32 sd_uid; /* owner */ | ||
996 | __le32 sd_gid; /* group */ | ||
997 | __le32 sd_atime; /* time of last access */ | ||
998 | __le32 sd_mtime; /* time file was last modified */ | ||
999 | __le32 sd_ctime; /* time inode (stat data) was last changed (except changes to sd_atime and sd_mtime) */ | ||
1000 | __le32 sd_blocks; | ||
1001 | union { | ||
1002 | __le32 sd_rdev; | ||
1003 | __le32 sd_generation; | ||
1004 | //__le32 sd_first_direct_byte; | ||
1005 | /* first byte of file which is stored in a | ||
1006 | direct item: except that if it equals 1 | ||
1007 | it is a symlink and if it equals | ||
1008 | ~(__u32)0 there is no direct item. The | ||
1009 | existence of this field really grates | ||
1010 | on me. Let's replace it with a macro | ||
1011 | based on sd_size and our tail | ||
1012 | suppression policy? */ | ||
1013 | } __attribute__ ((__packed__)) u; | ||
1014 | } __attribute__ ((__packed__)); | ||
1015 | // | ||
1016 | // this is 44 bytes long | ||
1017 | // | ||
1018 | #define SD_SIZE (sizeof(struct stat_data)) | ||
1019 | #define SD_V2_SIZE SD_SIZE | ||
1020 | #define stat_data_v2(ih) (ih_version (ih) == KEY_FORMAT_3_6) | ||
1021 | #define sd_v2_mode(sdp) (le16_to_cpu((sdp)->sd_mode)) | ||
1022 | #define set_sd_v2_mode(sdp,v) ((sdp)->sd_mode = cpu_to_le16(v)) | ||
1023 | /* sd_reserved */ | ||
1024 | /* set_sd_reserved */ | ||
1025 | #define sd_v2_nlink(sdp) (le32_to_cpu((sdp)->sd_nlink)) | ||
1026 | #define set_sd_v2_nlink(sdp,v) ((sdp)->sd_nlink = cpu_to_le32(v)) | ||
1027 | #define sd_v2_size(sdp) (le64_to_cpu((sdp)->sd_size)) | ||
1028 | #define set_sd_v2_size(sdp,v) ((sdp)->sd_size = cpu_to_le64(v)) | ||
1029 | #define sd_v2_uid(sdp) (le32_to_cpu((sdp)->sd_uid)) | ||
1030 | #define set_sd_v2_uid(sdp,v) ((sdp)->sd_uid = cpu_to_le32(v)) | ||
1031 | #define sd_v2_gid(sdp) (le32_to_cpu((sdp)->sd_gid)) | ||
1032 | #define set_sd_v2_gid(sdp,v) ((sdp)->sd_gid = cpu_to_le32(v)) | ||
1033 | #define sd_v2_atime(sdp) (le32_to_cpu((sdp)->sd_atime)) | ||
1034 | #define set_sd_v2_atime(sdp,v) ((sdp)->sd_atime = cpu_to_le32(v)) | ||
1035 | #define sd_v2_mtime(sdp) (le32_to_cpu((sdp)->sd_mtime)) | ||
1036 | #define set_sd_v2_mtime(sdp,v) ((sdp)->sd_mtime = cpu_to_le32(v)) | ||
1037 | #define sd_v2_ctime(sdp) (le32_to_cpu((sdp)->sd_ctime)) | ||
1038 | #define set_sd_v2_ctime(sdp,v) ((sdp)->sd_ctime = cpu_to_le32(v)) | ||
1039 | #define sd_v2_blocks(sdp) (le32_to_cpu((sdp)->sd_blocks)) | ||
1040 | #define set_sd_v2_blocks(sdp,v) ((sdp)->sd_blocks = cpu_to_le32(v)) | ||
1041 | #define sd_v2_rdev(sdp) (le32_to_cpu((sdp)->u.sd_rdev)) | ||
1042 | #define set_sd_v2_rdev(sdp,v) ((sdp)->u.sd_rdev = cpu_to_le32(v)) | ||
1043 | #define sd_v2_generation(sdp) (le32_to_cpu((sdp)->u.sd_generation)) | ||
1044 | #define set_sd_v2_generation(sdp,v) ((sdp)->u.sd_generation = cpu_to_le32(v)) | ||
1045 | #define sd_v2_attrs(sdp) (le16_to_cpu((sdp)->sd_attrs)) | ||
1046 | #define set_sd_v2_attrs(sdp,v) ((sdp)->sd_attrs = cpu_to_le16(v)) | ||
1047 | |||
1048 | /***************************************************************************/ | ||
1049 | /* DIRECTORY STRUCTURE */ | ||
1050 | /***************************************************************************/ | ||
1051 | /* | ||
1052 | Picture represents the structure of directory items | ||
1053 | ________________________________________________ | ||
1054 | | Array of | | | | | | | ||
1055 | | directory |N-1| N-2 | .... | 1st |0th| | ||
1056 | | entry headers | | | | | | | ||
1057 | |_______________|___|_____|________|_______|___| | ||
1058 | <---- directory entries ------> | ||
1059 | |||
1060 | First directory item has k_offset component 1. We store "." and ".." | ||
1061 | in one item, always, we never split "." and ".." into differing | ||
1062 | items. This makes, among other things, the code for removing | ||
1063 | directories simpler. */ | ||
1064 | #define SD_OFFSET 0 | ||
1065 | #define SD_UNIQUENESS 0 | ||
1066 | #define DOT_OFFSET 1 | ||
1067 | #define DOT_DOT_OFFSET 2 | ||
1068 | #define DIRENTRY_UNIQUENESS 500 | ||
1069 | |||
1070 | /* */ | ||
1071 | #define FIRST_ITEM_OFFSET 1 | ||
1072 | |||
1073 | /* | ||
1074 | Q: How to get key of object pointed to by entry from entry? | ||
1075 | |||
1076 | A: Each directory entry has its header. This header has deh_dir_id and deh_objectid fields, those are key | ||
1077 | of object, entry points to */ | ||
1078 | |||
1079 | /* NOT IMPLEMENTED: | ||
1080 | Directory will someday contain stat data of object */ | ||
1081 | |||
1082 | struct reiserfs_de_head { | ||
1083 | __le32 deh_offset; /* third component of the directory entry key */ | ||
1084 | __le32 deh_dir_id; /* objectid of the parent directory of the object, that is referenced | ||
1085 | by directory entry */ | ||
1086 | __le32 deh_objectid; /* objectid of the object, that is referenced by directory entry */ | ||
1087 | __le16 deh_location; /* offset of name in the whole item */ | ||
1088 | __le16 deh_state; /* whether 1) entry contains stat data (for future), and 2) whether | ||
1089 | entry is hidden (unlinked) */ | ||
1090 | } __attribute__ ((__packed__)); | ||
1091 | #define DEH_SIZE sizeof(struct reiserfs_de_head) | ||
1092 | #define deh_offset(p_deh) (le32_to_cpu((p_deh)->deh_offset)) | ||
1093 | #define deh_dir_id(p_deh) (le32_to_cpu((p_deh)->deh_dir_id)) | ||
1094 | #define deh_objectid(p_deh) (le32_to_cpu((p_deh)->deh_objectid)) | ||
1095 | #define deh_location(p_deh) (le16_to_cpu((p_deh)->deh_location)) | ||
1096 | #define deh_state(p_deh) (le16_to_cpu((p_deh)->deh_state)) | ||
1097 | |||
1098 | #define put_deh_offset(p_deh,v) ((p_deh)->deh_offset = cpu_to_le32((v))) | ||
1099 | #define put_deh_dir_id(p_deh,v) ((p_deh)->deh_dir_id = cpu_to_le32((v))) | ||
1100 | #define put_deh_objectid(p_deh,v) ((p_deh)->deh_objectid = cpu_to_le32((v))) | ||
1101 | #define put_deh_location(p_deh,v) ((p_deh)->deh_location = cpu_to_le16((v))) | ||
1102 | #define put_deh_state(p_deh,v) ((p_deh)->deh_state = cpu_to_le16((v))) | ||
1103 | |||
1104 | /* empty directory contains two entries "." and ".." and their headers */ | ||
1105 | #define EMPTY_DIR_SIZE \ | ||
1106 | (DEH_SIZE * 2 + ROUND_UP (strlen (".")) + ROUND_UP (strlen (".."))) | ||
1107 | |||
1108 | /* old format directories have this size when empty */ | ||
1109 | #define EMPTY_DIR_SIZE_V1 (DEH_SIZE * 2 + 3) | ||
1110 | |||
1111 | #define DEH_Statdata 0 /* not used now */ | ||
1112 | #define DEH_Visible 2 | ||
1113 | |||
1114 | /* 64 bit systems (and the S/390) need to be aligned explicitly -jdm */ | ||
1115 | #if BITS_PER_LONG == 64 || defined(__s390__) || defined(__hppa__) | ||
1116 | # define ADDR_UNALIGNED_BITS (3) | ||
1117 | #endif | ||
1118 | |||
1119 | /* These are only used to manipulate deh_state. | ||
1120 | * Because of this, we'll use the ext2_ bit routines, | ||
1121 | * since they are little endian */ | ||
1122 | #ifdef ADDR_UNALIGNED_BITS | ||
1123 | |||
1124 | # define aligned_address(addr) ((void *)((long)(addr) & ~((1UL << ADDR_UNALIGNED_BITS) - 1))) | ||
1125 | # define unaligned_offset(addr) (((int)((long)(addr) & ((1 << ADDR_UNALIGNED_BITS) - 1))) << 3) | ||
1126 | |||
1127 | # define set_bit_unaligned(nr, addr) \ | ||
1128 | __test_and_set_bit_le((nr) + unaligned_offset(addr), aligned_address(addr)) | ||
1129 | # define clear_bit_unaligned(nr, addr) \ | ||
1130 | __test_and_clear_bit_le((nr) + unaligned_offset(addr), aligned_address(addr)) | ||
1131 | # define test_bit_unaligned(nr, addr) \ | ||
1132 | test_bit_le((nr) + unaligned_offset(addr), aligned_address(addr)) | ||
1133 | |||
1134 | #else | ||
1135 | |||
1136 | # define set_bit_unaligned(nr, addr) __test_and_set_bit_le(nr, addr) | ||
1137 | # define clear_bit_unaligned(nr, addr) __test_and_clear_bit_le(nr, addr) | ||
1138 | # define test_bit_unaligned(nr, addr) test_bit_le(nr, addr) | ||
1139 | |||
1140 | #endif | ||
1141 | |||
1142 | #define mark_de_with_sd(deh) set_bit_unaligned (DEH_Statdata, &((deh)->deh_state)) | ||
1143 | #define mark_de_without_sd(deh) clear_bit_unaligned (DEH_Statdata, &((deh)->deh_state)) | ||
1144 | #define mark_de_visible(deh) set_bit_unaligned (DEH_Visible, &((deh)->deh_state)) | ||
1145 | #define mark_de_hidden(deh) clear_bit_unaligned (DEH_Visible, &((deh)->deh_state)) | ||
1146 | |||
1147 | #define de_with_sd(deh) test_bit_unaligned (DEH_Statdata, &((deh)->deh_state)) | ||
1148 | #define de_visible(deh) test_bit_unaligned (DEH_Visible, &((deh)->deh_state)) | ||
1149 | #define de_hidden(deh) !test_bit_unaligned (DEH_Visible, &((deh)->deh_state)) | ||
1150 | |||
1151 | extern void make_empty_dir_item_v1(char *body, __le32 dirid, __le32 objid, | ||
1152 | __le32 par_dirid, __le32 par_objid); | ||
1153 | extern void make_empty_dir_item(char *body, __le32 dirid, __le32 objid, | ||
1154 | __le32 par_dirid, __le32 par_objid); | ||
1155 | |||
1156 | /* array of the entry headers */ | ||
1157 | /* get item body */ | ||
1158 | #define B_I_PITEM(bh,ih) ( (bh)->b_data + ih_location(ih) ) | ||
1159 | #define B_I_DEH(bh,ih) ((struct reiserfs_de_head *)(B_I_PITEM(bh,ih))) | ||
1160 | |||
1161 | /* length of the directory entry in directory item. This define | ||
1162 | calculates length of i-th directory entry using directory entry | ||
1163 | locations from dir entry head. When it calculates length of 0-th | ||
1164 | directory entry, it uses length of whole item in place of entry | ||
1165 | location of the non-existent following entry in the calculation. | ||
1166 | See picture above.*/ | ||
1167 | /* | ||
1168 | #define I_DEH_N_ENTRY_LENGTH(ih,deh,i) \ | ||
1169 | ((i) ? (deh_location((deh)-1) - deh_location((deh))) : (ih_item_len((ih)) - deh_location((deh)))) | ||
1170 | */ | ||
1171 | static inline int entry_length(const struct buffer_head *bh, | ||
1172 | const struct item_head *ih, int pos_in_item) | ||
1173 | { | ||
1174 | struct reiserfs_de_head *deh; | ||
1175 | |||
1176 | deh = B_I_DEH(bh, ih) + pos_in_item; | ||
1177 | if (pos_in_item) | ||
1178 | return deh_location(deh - 1) - deh_location(deh); | ||
1179 | |||
1180 | return ih_item_len(ih) - deh_location(deh); | ||
1181 | } | ||
1182 | |||
1183 | /* number of entries in the directory item, depends on ENTRY_COUNT being at the start of directory dynamic data. */ | ||
1184 | #define I_ENTRY_COUNT(ih) (ih_entry_count((ih))) | ||
1185 | |||
1186 | /* name by bh, ih and entry_num */ | ||
1187 | #define B_I_E_NAME(bh,ih,entry_num) ((char *)(bh->b_data + ih_location(ih) + deh_location(B_I_DEH(bh,ih)+(entry_num)))) | ||
1188 | |||
1189 | // two entries per block (at least) | ||
1190 | #define REISERFS_MAX_NAME(block_size) 255 | ||
1191 | |||
1192 | /* this structure is used for operations on directory entries. It is | ||
1193 | not a disk structure. */ | ||
1194 | /* When reiserfs_find_entry or search_by_entry_key find directory | ||
1195 | entry, they return filled reiserfs_dir_entry structure */ | ||
1196 | struct reiserfs_dir_entry { | ||
1197 | struct buffer_head *de_bh; | ||
1198 | int de_item_num; | ||
1199 | struct item_head *de_ih; | ||
1200 | int de_entry_num; | ||
1201 | struct reiserfs_de_head *de_deh; | ||
1202 | int de_entrylen; | ||
1203 | int de_namelen; | ||
1204 | char *de_name; | ||
1205 | unsigned long *de_gen_number_bit_string; | ||
1206 | |||
1207 | __u32 de_dir_id; | ||
1208 | __u32 de_objectid; | ||
1209 | |||
1210 | struct cpu_key de_entry_key; | ||
1211 | }; | ||
1212 | |||
1213 | /* these defines are useful when a particular member of a reiserfs_dir_entry is needed */ | ||
1214 | |||
1215 | /* pointer to file name, stored in entry */ | ||
1216 | #define B_I_DEH_ENTRY_FILE_NAME(bh,ih,deh) (B_I_PITEM (bh, ih) + deh_location(deh)) | ||
1217 | |||
1218 | /* length of name */ | ||
1219 | #define I_DEH_N_ENTRY_FILE_NAME_LENGTH(ih,deh,entry_num) \ | ||
1220 | (I_DEH_N_ENTRY_LENGTH (ih, deh, entry_num) - (de_with_sd (deh) ? SD_SIZE : 0)) | ||
1221 | |||
1222 | /* hash value occupies bits from 7 up to 30 */ | ||
1223 | #define GET_HASH_VALUE(offset) ((offset) & 0x7fffff80LL) | ||
1224 | /* generation number occupies 7 bits starting from 0 up to 6 */ | ||
1225 | #define GET_GENERATION_NUMBER(offset) ((offset) & 0x7fLL) | ||
1226 | #define MAX_GENERATION_NUMBER 127 | ||
1227 | |||
1228 | #define SET_GENERATION_NUMBER(offset,gen_number) (GET_HASH_VALUE(offset)|(gen_number)) | ||
1229 | |||
1230 | /* | ||
1231 | * Picture represents an internal node of the reiserfs tree | ||
1232 | * ______________________________________________________ | ||
1233 | * | | Array of | Array of | Free | | ||
1234 | * |block | keys | pointers | space | | ||
1235 | * | head | N | N+1 | | | ||
1236 | * |______|_______________|___________________|___________| | ||
1237 | */ | ||
1238 | |||
1239 | /***************************************************************************/ | ||
1240 | /* DISK CHILD */ | ||
1241 | /***************************************************************************/ | ||
1242 | /* Disk child pointer: The pointer from an internal node of the tree | ||
1243 | to a node that is on disk. */ | ||
1244 | struct disk_child { | ||
1245 | __le32 dc_block_number; /* Disk child's block number. */ | ||
1246 | __le16 dc_size; /* Disk child's used space. */ | ||
1247 | __le16 dc_reserved; | ||
1248 | }; | ||
1249 | |||
1250 | #define DC_SIZE (sizeof(struct disk_child)) | ||
1251 | #define dc_block_number(dc_p) (le32_to_cpu((dc_p)->dc_block_number)) | ||
1252 | #define dc_size(dc_p) (le16_to_cpu((dc_p)->dc_size)) | ||
1253 | #define put_dc_block_number(dc_p, val) do { (dc_p)->dc_block_number = cpu_to_le32(val); } while(0) | ||
1254 | #define put_dc_size(dc_p, val) do { (dc_p)->dc_size = cpu_to_le16(val); } while(0) | ||
1255 | |||
1256 | /* Get disk child by buffer header and position in the tree node. */ | ||
1257 | #define B_N_CHILD(bh, n_pos) ((struct disk_child *)\ | ||
1258 | ((bh)->b_data + BLKH_SIZE + B_NR_ITEMS(bh) * KEY_SIZE + DC_SIZE * (n_pos))) | ||
1259 | |||
1260 | /* Get disk child number by buffer header and position in the tree node. */ | ||
1261 | #define B_N_CHILD_NUM(bh, n_pos) (dc_block_number(B_N_CHILD(bh, n_pos))) | ||
1262 | #define PUT_B_N_CHILD_NUM(bh, n_pos, val) \ | ||
1263 | (put_dc_block_number(B_N_CHILD(bh, n_pos), val)) | ||
1264 | |||
1265 | /* maximal value of field child_size in structure disk_child */ | ||
1266 | /* child size is the combined size of all items and their headers */ | ||
1267 | #define MAX_CHILD_SIZE(bh) ((int)( (bh)->b_size - BLKH_SIZE )) | ||
1268 | |||
1269 | /* amount of used space in buffer (not including block head) */ | ||
1270 | #define B_CHILD_SIZE(cur) (MAX_CHILD_SIZE(cur)-(B_FREE_SPACE(cur))) | ||
1271 | |||
1272 | /* max and min number of keys in internal node */ | ||
1273 | #define MAX_NR_KEY(bh) ( (MAX_CHILD_SIZE(bh)-DC_SIZE)/(KEY_SIZE+DC_SIZE) ) | ||
1274 | #define MIN_NR_KEY(bh) (MAX_NR_KEY(bh)/2) | ||
1275 | |||
1276 | /***************************************************************************/ | ||
1277 | /* PATH STRUCTURES AND DEFINES */ | ||
1278 | /***************************************************************************/ | ||
1279 | |||
1280 | /* Search_by_key fills up the path from the root to the leaf as it descends the tree looking for the | ||
1281 | key. It uses reiserfs_bread to try to find buffers in the cache given their block number. If it | ||
1282 | does not find them in the cache it reads them from disk. For each node search_by_key finds using | ||
1283 | reiserfs_bread it then uses bin_search to look through that node. bin_search will find the | ||
1284 | position of the block_number of the next node if it is looking through an internal node. If it | ||
1285 | is looking through a leaf node bin_search will find the position of the item which has key either | ||
1286 | equal to given key, or which is the maximal key less than the given key. */ | ||
1287 | |||
1288 | struct path_element { | ||
1289 | struct buffer_head *pe_buffer; /* Pointer to the buffer at the path in the tree. */ | ||
1290 | int pe_position; /* Position in the tree node which is placed in the */ | ||
1291 | /* buffer above. */ | ||
1292 | }; | ||
1293 | |||
1294 | #define MAX_HEIGHT 5 /* maximal height of a tree. don't change this without changing JOURNAL_PER_BALANCE_CNT */ | ||
1295 | #define EXTENDED_MAX_HEIGHT 7 /* Must be equals MAX_HEIGHT + FIRST_PATH_ELEMENT_OFFSET */ | ||
1296 | #define FIRST_PATH_ELEMENT_OFFSET 2 /* Must be equal to at least 2. */ | ||
1297 | |||
1298 | #define ILLEGAL_PATH_ELEMENT_OFFSET 1 /* Must be equal to FIRST_PATH_ELEMENT_OFFSET - 1 */ | ||
1299 | #define MAX_FEB_SIZE 6 /* this MUST be MAX_HEIGHT + 1. See about FEB below */ | ||
1300 | |||
1301 | /* We need to keep track of who the ancestors of nodes are. When we | ||
1302 | perform a search we record which nodes were visited while | ||
1303 | descending the tree looking for the node we searched for. This list | ||
1304 | of nodes is called the path. This information is used while | ||
1305 | performing balancing. Note that this path information may become | ||
1306 | invalid, and this means we must check it when using it to see if it | ||
1307 | is still valid. You'll need to read search_by_key and the comments | ||
1308 | in it, especially about decrement_counters_in_path(), to understand | ||
1309 | this structure. | ||
1310 | |||
1311 | Paths make the code so much harder to work with and debug.... An | ||
1312 | enormous number of bugs are due to them, and trying to write or modify | ||
1313 | code that uses them just makes my head hurt. They are based on an | ||
1314 | excessive effort to avoid disturbing the precious VFS code.:-( The | ||
1315 | gods only know how we are going to SMP the code that uses them. | ||
1316 | znodes are the way! */ | ||
1317 | |||
1318 | #define PATH_READA 0x1 /* do read ahead */ | ||
1319 | #define PATH_READA_BACK 0x2 /* read backwards */ | ||
1320 | |||
1321 | struct treepath { | ||
1322 | int path_length; /* Length of the array above. */ | ||
1323 | int reada; | ||
1324 | struct path_element path_elements[EXTENDED_MAX_HEIGHT]; /* Array of the path elements. */ | ||
1325 | int pos_in_item; | ||
1326 | }; | ||
1327 | |||
1328 | #define pos_in_item(path) ((path)->pos_in_item) | ||
1329 | |||
1330 | #define INITIALIZE_PATH(var) \ | ||
1331 | struct treepath var = {.path_length = ILLEGAL_PATH_ELEMENT_OFFSET, .reada = 0,} | ||
1332 | |||
1333 | /* Get path element by path and path position. */ | ||
1334 | #define PATH_OFFSET_PELEMENT(path, n_offset) ((path)->path_elements + (n_offset)) | ||
1335 | |||
1336 | /* Get buffer header at the path by path and path position. */ | ||
1337 | #define PATH_OFFSET_PBUFFER(path, n_offset) (PATH_OFFSET_PELEMENT(path, n_offset)->pe_buffer) | ||
1338 | |||
1339 | /* Get position in the element at the path by path and path position. */ | ||
1340 | #define PATH_OFFSET_POSITION(path, n_offset) (PATH_OFFSET_PELEMENT(path, n_offset)->pe_position) | ||
1341 | |||
1342 | #define PATH_PLAST_BUFFER(path) (PATH_OFFSET_PBUFFER((path), (path)->path_length)) | ||
1343 | /* you know, to the person who didn't | ||
1344 | write this the macro name does not | ||
1345 | at first suggest what it does. | ||
1346 | Maybe POSITION_FROM_PATH_END? Or | ||
1347 | maybe we should just focus on | ||
1348 | dumping paths... -Hans */ | ||
1349 | #define PATH_LAST_POSITION(path) (PATH_OFFSET_POSITION((path), (path)->path_length)) | ||
1350 | |||
1351 | #define PATH_PITEM_HEAD(path) B_N_PITEM_HEAD(PATH_PLAST_BUFFER(path), PATH_LAST_POSITION(path)) | ||
1352 | |||
1353 | /* in do_balance leaf has h == 0 in contrast with path structure, | ||
1354 | where root has level == 0. That is why we need these defines */ | ||
1355 | #define PATH_H_PBUFFER(path, h) PATH_OFFSET_PBUFFER (path, path->path_length - (h)) /* tb->S[h] */ | ||
1356 | #define PATH_H_PPARENT(path, h) PATH_H_PBUFFER (path, (h) + 1) /* tb->F[h] or tb->S[0]->b_parent */ | ||
1357 | #define PATH_H_POSITION(path, h) PATH_OFFSET_POSITION (path, path->path_length - (h)) | ||
1358 | #define PATH_H_B_ITEM_ORDER(path, h) PATH_H_POSITION(path, h + 1) /* tb->S[h]->b_item_order */ | ||
1359 | |||
1360 | #define PATH_H_PATH_OFFSET(path, n_h) ((path)->path_length - (n_h)) | ||
1361 | |||
1362 | #define get_last_bh(path) PATH_PLAST_BUFFER(path) | ||
1363 | #define get_ih(path) PATH_PITEM_HEAD(path) | ||
1364 | #define get_item_pos(path) PATH_LAST_POSITION(path) | ||
1365 | #define get_item(path) ((void *)B_N_PITEM(PATH_PLAST_BUFFER(path), PATH_LAST_POSITION (path))) | ||
1366 | #define item_moved(ih,path) comp_items(ih, path) | ||
1367 | #define path_changed(ih,path) comp_items (ih, path) | ||
1368 | |||
1369 | /***************************************************************************/ | ||
1370 | /* MISC */ | ||
1371 | /***************************************************************************/ | ||
1372 | |||
1373 | /* Size of pointer to the unformatted node. */ | ||
1374 | #define UNFM_P_SIZE (sizeof(unp_t)) | ||
1375 | #define UNFM_P_SHIFT 2 | ||
1376 | |||
1377 | // in in-core inode key is stored on le form | ||
1378 | #define INODE_PKEY(inode) ((struct reiserfs_key *)(REISERFS_I(inode)->i_key)) | ||
1379 | |||
1380 | #define MAX_UL_INT 0xffffffff | ||
1381 | #define MAX_INT 0x7ffffff | ||
1382 | #define MAX_US_INT 0xffff | ||
1383 | |||
1384 | // reiserfs version 2 has max offset 60 bits. Version 1 - 32 bit offset | ||
1385 | #define U32_MAX (~(__u32)0) | ||
1386 | |||
1387 | static inline loff_t max_reiserfs_offset(struct inode *inode) | ||
1388 | { | ||
1389 | if (get_inode_item_key_version(inode) == KEY_FORMAT_3_5) | ||
1390 | return (loff_t) U32_MAX; | ||
1391 | |||
1392 | return (loff_t) ((~(__u64) 0) >> 4); | ||
1393 | } | ||
1394 | |||
1395 | /*#define MAX_KEY_UNIQUENESS MAX_UL_INT*/ | ||
1396 | #define MAX_KEY_OBJECTID MAX_UL_INT | ||
1397 | |||
1398 | #define MAX_B_NUM MAX_UL_INT | ||
1399 | #define MAX_FC_NUM MAX_US_INT | ||
1400 | |||
1401 | /* the purpose is to detect overflow of an unsigned short */ | ||
1402 | #define REISERFS_LINK_MAX (MAX_US_INT - 1000) | ||
1403 | |||
1404 | /* The following defines are used in reiserfs_insert_item and reiserfs_append_item */ | ||
1405 | #define REISERFS_KERNEL_MEM 0 /* reiserfs kernel memory mode */ | ||
1406 | #define REISERFS_USER_MEM 1 /* reiserfs user memory mode */ | ||
1407 | |||
1408 | #define fs_generation(s) (REISERFS_SB(s)->s_generation_counter) | ||
1409 | #define get_generation(s) atomic_read (&fs_generation(s)) | ||
1410 | #define FILESYSTEM_CHANGED_TB(tb) (get_generation((tb)->tb_sb) != (tb)->fs_gen) | ||
1411 | #define __fs_changed(gen,s) (gen != get_generation (s)) | ||
1412 | #define fs_changed(gen,s) \ | ||
1413 | ({ \ | ||
1414 | reiserfs_cond_resched(s); \ | ||
1415 | __fs_changed(gen, s); \ | ||
1416 | }) | ||
1417 | |||
1418 | /***************************************************************************/ | ||
1419 | /* FIXATE NODES */ | ||
1420 | /***************************************************************************/ | ||
1421 | |||
1422 | #define VI_TYPE_LEFT_MERGEABLE 1 | ||
1423 | #define VI_TYPE_RIGHT_MERGEABLE 2 | ||
1424 | |||
1425 | /* To make any changes in the tree we always first find node, that | ||
1426 | contains item to be changed/deleted or place to insert a new | ||
1427 | item. We call this node S. To do balancing we need to decide what | ||
1428 | we will shift to left/right neighbor, or to a new node, where new | ||
1429 | item will be etc. To make this analysis simpler we build virtual | ||
1430 | node. Virtual node is an array of items, that will replace items of | ||
1431 | node S. (For instance if we are going to delete an item, virtual | ||
1432 | node does not contain it). Virtual node keeps information about | ||
1433 | item sizes and types, mergeability of first and last items, sizes | ||
1434 | of all entries in directory item. We use this array of items when | ||
1435 | calculating what we can shift to neighbors and how many nodes we | ||
1436 | have to have if we do not any shiftings, if we shift to left/right | ||
1437 | neighbor or to both. */ | ||
1438 | struct virtual_item { | ||
1439 | int vi_index; // index in the array of item operations | ||
1440 | unsigned short vi_type; // left/right mergeability | ||
1441 | unsigned short vi_item_len; /* length of item that it will have after balancing */ | ||
1442 | struct item_head *vi_ih; | ||
1443 | const char *vi_item; // body of item (old or new) | ||
1444 | const void *vi_new_data; // 0 always but paste mode | ||
1445 | void *vi_uarea; // item specific area | ||
1446 | }; | ||
1447 | |||
1448 | struct virtual_node { | ||
1449 | char *vn_free_ptr; /* this is a pointer to the free space in the buffer */ | ||
1450 | unsigned short vn_nr_item; /* number of items in virtual node */ | ||
1451 | short vn_size; /* size of node , that node would have if it has unlimited size and no balancing is performed */ | ||
1452 | short vn_mode; /* mode of balancing (paste, insert, delete, cut) */ | ||
1453 | short vn_affected_item_num; | ||
1454 | short vn_pos_in_item; | ||
1455 | struct item_head *vn_ins_ih; /* item header of inserted item, 0 for other modes */ | ||
1456 | const void *vn_data; | ||
1457 | struct virtual_item *vn_vi; /* array of items (including a new one, excluding item to be deleted) */ | ||
1458 | }; | ||
1459 | |||
1460 | /* used by directory items when creating virtual nodes */ | ||
1461 | struct direntry_uarea { | ||
1462 | int flags; | ||
1463 | __u16 entry_count; | ||
1464 | __u16 entry_sizes[1]; | ||
1465 | } __attribute__ ((__packed__)); | ||
1466 | |||
1467 | /***************************************************************************/ | ||
1468 | /* TREE BALANCE */ | ||
1469 | /***************************************************************************/ | ||
1470 | |||
1471 | /* This temporary structure is used in tree balance algorithms, and | ||
1472 | constructed as we go to the extent that its various parts are | ||
1473 | needed. It contains arrays of nodes that can potentially be | ||
1474 | involved in the balancing of node S, and parameters that define how | ||
1475 | each of the nodes must be balanced. Note that in these algorithms | ||
1476 | for balancing the worst case is to need to balance the current node | ||
1477 | S and the left and right neighbors and all of their parents plus | ||
1478 | create a new node. We implement S1 balancing for the leaf nodes | ||
1479 | and S0 balancing for the internal nodes (S1 and S0 are defined in | ||
1480 | our papers.)*/ | ||
1481 | |||
1482 | #define MAX_FREE_BLOCK 7 /* size of the array of buffers to free at end of do_balance */ | ||
1483 | |||
1484 | /* maximum number of FEB blocknrs on a single level */ | ||
1485 | #define MAX_AMOUNT_NEEDED 2 | ||
1486 | |||
1487 | /* someday somebody will prefix every field in this struct with tb_ */ | ||
1488 | struct tree_balance { | ||
1489 | int tb_mode; | ||
1490 | int need_balance_dirty; | ||
1491 | struct super_block *tb_sb; | ||
1492 | struct reiserfs_transaction_handle *transaction_handle; | ||
1493 | struct treepath *tb_path; | ||
1494 | struct buffer_head *L[MAX_HEIGHT]; /* array of left neighbors of nodes in the path */ | ||
1495 | struct buffer_head *R[MAX_HEIGHT]; /* array of right neighbors of nodes in the path */ | ||
1496 | struct buffer_head *FL[MAX_HEIGHT]; /* array of fathers of the left neighbors */ | ||
1497 | struct buffer_head *FR[MAX_HEIGHT]; /* array of fathers of the right neighbors */ | ||
1498 | struct buffer_head *CFL[MAX_HEIGHT]; /* array of common parents of center node and its left neighbor */ | ||
1499 | struct buffer_head *CFR[MAX_HEIGHT]; /* array of common parents of center node and its right neighbor */ | ||
1500 | |||
1501 | struct buffer_head *FEB[MAX_FEB_SIZE]; /* array of empty buffers. Number of buffers in array equals | ||
1502 | cur_blknum. */ | ||
1503 | struct buffer_head *used[MAX_FEB_SIZE]; | ||
1504 | struct buffer_head *thrown[MAX_FEB_SIZE]; | ||
1505 | int lnum[MAX_HEIGHT]; /* array of number of items which must be | ||
1506 | shifted to the left in order to balance the | ||
1507 | current node; for leaves includes item that | ||
1508 | will be partially shifted; for internal | ||
1509 | nodes, it is the number of child pointers | ||
1510 | rather than items. It includes the new item | ||
1511 | being created. The code sometimes subtracts | ||
1512 | one to get the number of wholly shifted | ||
1513 | items for other purposes. */ | ||
1514 | int rnum[MAX_HEIGHT]; /* substitute right for left in comment above */ | ||
1515 | int lkey[MAX_HEIGHT]; /* array indexed by height h mapping the key delimiting L[h] and | ||
1516 | S[h] to its item number within the node CFL[h] */ | ||
1517 | int rkey[MAX_HEIGHT]; /* substitute r for l in comment above */ | ||
1518 | int insert_size[MAX_HEIGHT]; /* the number of bytes by we are trying to add or remove from | ||
1519 | S[h]. A negative value means removing. */ | ||
1520 | int blknum[MAX_HEIGHT]; /* number of nodes that will replace node S[h] after | ||
1521 | balancing on the level h of the tree. If 0 then S is | ||
1522 | being deleted, if 1 then S is remaining and no new nodes | ||
1523 | are being created, if 2 or 3 then 1 or 2 new nodes is | ||
1524 | being created */ | ||
1525 | |||
1526 | /* fields that are used only for balancing leaves of the tree */ | ||
1527 | int cur_blknum; /* number of empty blocks having been already allocated */ | ||
1528 | int s0num; /* number of items that fall into left most node when S[0] splits */ | ||
1529 | int s1num; /* number of items that fall into first new node when S[0] splits */ | ||
1530 | int s2num; /* number of items that fall into second new node when S[0] splits */ | ||
1531 | int lbytes; /* number of bytes which can flow to the left neighbor from the left */ | ||
1532 | /* most liquid item that cannot be shifted from S[0] entirely */ | ||
1533 | /* if -1 then nothing will be partially shifted */ | ||
1534 | int rbytes; /* number of bytes which will flow to the right neighbor from the right */ | ||
1535 | /* most liquid item that cannot be shifted from S[0] entirely */ | ||
1536 | /* if -1 then nothing will be partially shifted */ | ||
1537 | int s1bytes; /* number of bytes which flow to the first new node when S[0] splits */ | ||
1538 | /* note: if S[0] splits into 3 nodes, then items do not need to be cut */ | ||
1539 | int s2bytes; | ||
1540 | struct buffer_head *buf_to_free[MAX_FREE_BLOCK]; /* buffers which are to be freed after do_balance finishes by unfix_nodes */ | ||
1541 | char *vn_buf; /* kmalloced memory. Used to create | ||
1542 | virtual node and keep map of | ||
1543 | dirtied bitmap blocks */ | ||
1544 | int vn_buf_size; /* size of the vn_buf */ | ||
1545 | struct virtual_node *tb_vn; /* VN starts after bitmap of bitmap blocks */ | ||
1546 | |||
1547 | int fs_gen; /* saved value of `reiserfs_generation' counter | ||
1548 | see FILESYSTEM_CHANGED() macro in reiserfs_fs.h */ | ||
1549 | #ifdef DISPLACE_NEW_PACKING_LOCALITIES | ||
1550 | struct in_core_key key; /* key pointer, to pass to block allocator or | ||
1551 | another low-level subsystem */ | ||
1552 | #endif | ||
1553 | }; | ||
1554 | |||
1555 | /* These are modes of balancing */ | ||
1556 | |||
1557 | /* When inserting an item. */ | ||
1558 | #define M_INSERT 'i' | ||
1559 | /* When inserting into (directories only) or appending onto an already | ||
1560 | existent item. */ | ||
1561 | #define M_PASTE 'p' | ||
1562 | /* When deleting an item. */ | ||
1563 | #define M_DELETE 'd' | ||
1564 | /* When truncating an item or removing an entry from a (directory) item. */ | ||
1565 | #define M_CUT 'c' | ||
1566 | |||
1567 | /* used when balancing on leaf level skipped (in reiserfsck) */ | ||
1568 | #define M_INTERNAL 'n' | ||
1569 | |||
1570 | /* When further balancing is not needed, then do_balance does not need | ||
1571 | to be called. */ | ||
1572 | #define M_SKIP_BALANCING 's' | ||
1573 | #define M_CONVERT 'v' | ||
1574 | |||
1575 | /* modes of leaf_move_items */ | ||
1576 | #define LEAF_FROM_S_TO_L 0 | ||
1577 | #define LEAF_FROM_S_TO_R 1 | ||
1578 | #define LEAF_FROM_R_TO_L 2 | ||
1579 | #define LEAF_FROM_L_TO_R 3 | ||
1580 | #define LEAF_FROM_S_TO_SNEW 4 | ||
1581 | |||
1582 | #define FIRST_TO_LAST 0 | ||
1583 | #define LAST_TO_FIRST 1 | ||
1584 | |||
1585 | /* used in do_balance for passing parent of node information that has | ||
1586 | been gotten from tb struct */ | ||
1587 | struct buffer_info { | ||
1588 | struct tree_balance *tb; | ||
1589 | struct buffer_head *bi_bh; | ||
1590 | struct buffer_head *bi_parent; | ||
1591 | int bi_position; | ||
1592 | }; | ||
1593 | |||
1594 | static inline struct super_block *sb_from_tb(struct tree_balance *tb) | ||
1595 | { | ||
1596 | return tb ? tb->tb_sb : NULL; | ||
1597 | } | ||
1598 | |||
1599 | static inline struct super_block *sb_from_bi(struct buffer_info *bi) | ||
1600 | { | ||
1601 | return bi ? sb_from_tb(bi->tb) : NULL; | ||
1602 | } | ||
1603 | |||
1604 | /* there are 4 types of items: stat data, directory item, indirect, direct. | ||
1605 | +-------------------+------------+--------------+------------+ | ||
1606 | | | k_offset | k_uniqueness | mergeable? | | ||
1607 | +-------------------+------------+--------------+------------+ | ||
1608 | | stat data | 0 | 0 | no | | ||
1609 | +-------------------+------------+--------------+------------+ | ||
1610 | | 1st directory item| DOT_OFFSET |DIRENTRY_UNIQUENESS| no | | ||
1611 | | non 1st directory | hash value | | yes | | ||
1612 | | item | | | | | ||
1613 | +-------------------+------------+--------------+------------+ | ||
1614 | | indirect item | offset + 1 |TYPE_INDIRECT | if this is not the first indirect item of the object | ||
1615 | +-------------------+------------+--------------+------------+ | ||
1616 | | direct item | offset + 1 |TYPE_DIRECT | if not this is not the first direct item of the object | ||
1617 | +-------------------+------------+--------------+------------+ | ||
1618 | */ | ||
1619 | |||
1620 | struct item_operations { | ||
1621 | int (*bytes_number) (struct item_head * ih, int block_size); | ||
1622 | void (*decrement_key) (struct cpu_key *); | ||
1623 | int (*is_left_mergeable) (struct reiserfs_key * ih, | ||
1624 | unsigned long bsize); | ||
1625 | void (*print_item) (struct item_head *, char *item); | ||
1626 | void (*check_item) (struct item_head *, char *item); | ||
1627 | |||
1628 | int (*create_vi) (struct virtual_node * vn, struct virtual_item * vi, | ||
1629 | int is_affected, int insert_size); | ||
1630 | int (*check_left) (struct virtual_item * vi, int free, | ||
1631 | int start_skip, int end_skip); | ||
1632 | int (*check_right) (struct virtual_item * vi, int free); | ||
1633 | int (*part_size) (struct virtual_item * vi, int from, int to); | ||
1634 | int (*unit_num) (struct virtual_item * vi); | ||
1635 | void (*print_vi) (struct virtual_item * vi); | ||
1636 | }; | ||
1637 | |||
1638 | extern struct item_operations *item_ops[TYPE_ANY + 1]; | ||
1639 | |||
1640 | #define op_bytes_number(ih,bsize) item_ops[le_ih_k_type (ih)]->bytes_number (ih, bsize) | ||
1641 | #define op_is_left_mergeable(key,bsize) item_ops[le_key_k_type (le_key_version (key), key)]->is_left_mergeable (key, bsize) | ||
1642 | #define op_print_item(ih,item) item_ops[le_ih_k_type (ih)]->print_item (ih, item) | ||
1643 | #define op_check_item(ih,item) item_ops[le_ih_k_type (ih)]->check_item (ih, item) | ||
1644 | #define op_create_vi(vn,vi,is_affected,insert_size) item_ops[le_ih_k_type ((vi)->vi_ih)]->create_vi (vn,vi,is_affected,insert_size) | ||
1645 | #define op_check_left(vi,free,start_skip,end_skip) item_ops[(vi)->vi_index]->check_left (vi, free, start_skip, end_skip) | ||
1646 | #define op_check_right(vi,free) item_ops[(vi)->vi_index]->check_right (vi, free) | ||
1647 | #define op_part_size(vi,from,to) item_ops[(vi)->vi_index]->part_size (vi, from, to) | ||
1648 | #define op_unit_num(vi) item_ops[(vi)->vi_index]->unit_num (vi) | ||
1649 | #define op_print_vi(vi) item_ops[(vi)->vi_index]->print_vi (vi) | ||
1650 | |||
1651 | #define COMP_SHORT_KEYS comp_short_keys | ||
1652 | |||
1653 | /* number of blocks pointed to by the indirect item */ | ||
1654 | #define I_UNFM_NUM(ih) (ih_item_len(ih) / UNFM_P_SIZE) | ||
1655 | |||
1656 | /* the used space within the unformatted node corresponding to pos within the item pointed to by ih */ | ||
1657 | #define I_POS_UNFM_SIZE(ih,pos,size) (((pos) == I_UNFM_NUM(ih) - 1 ) ? (size) - ih_free_space(ih) : (size)) | ||
1658 | |||
1659 | /* number of bytes contained by the direct item or the unformatted nodes the indirect item points to */ | ||
1660 | |||
1661 | /* get the item header */ | ||
1662 | #define B_N_PITEM_HEAD(bh,item_num) ( (struct item_head * )((bh)->b_data + BLKH_SIZE) + (item_num) ) | ||
1663 | |||
1664 | /* get key */ | ||
1665 | #define B_N_PDELIM_KEY(bh,item_num) ( (struct reiserfs_key * )((bh)->b_data + BLKH_SIZE) + (item_num) ) | ||
1666 | |||
1667 | /* get the key */ | ||
1668 | #define B_N_PKEY(bh,item_num) ( &(B_N_PITEM_HEAD(bh,item_num)->ih_key) ) | ||
1669 | |||
1670 | /* get item body */ | ||
1671 | #define B_N_PITEM(bh,item_num) ( (bh)->b_data + ih_location(B_N_PITEM_HEAD((bh),(item_num)))) | ||
1672 | |||
1673 | /* get the stat data by the buffer header and the item order */ | ||
1674 | #define B_N_STAT_DATA(bh,nr) \ | ||
1675 | ( (struct stat_data *)((bh)->b_data + ih_location(B_N_PITEM_HEAD((bh),(nr))) ) ) | ||
1676 | |||
1677 | /* following defines use reiserfs buffer header and item header */ | ||
1678 | |||
1679 | /* get stat-data */ | ||
1680 | #define B_I_STAT_DATA(bh, ih) ( (struct stat_data * )((bh)->b_data + ih_location(ih)) ) | ||
1681 | |||
1682 | // this is 3976 for size==4096 | ||
1683 | #define MAX_DIRECT_ITEM_LEN(size) ((size) - BLKH_SIZE - 2*IH_SIZE - SD_SIZE - UNFM_P_SIZE) | ||
1684 | |||
1685 | /* indirect items consist of entries which contain blocknrs, pos | ||
1686 | indicates which entry, and B_I_POS_UNFM_POINTER resolves to the | ||
1687 | blocknr contained by the entry pos points to */ | ||
1688 | #define B_I_POS_UNFM_POINTER(bh,ih,pos) le32_to_cpu(*(((unp_t *)B_I_PITEM(bh,ih)) + (pos))) | ||
1689 | #define PUT_B_I_POS_UNFM_POINTER(bh,ih,pos, val) do {*(((unp_t *)B_I_PITEM(bh,ih)) + (pos)) = cpu_to_le32(val); } while (0) | ||
1690 | |||
1691 | struct reiserfs_iget_args { | ||
1692 | __u32 objectid; | ||
1693 | __u32 dirid; | ||
1694 | }; | ||
1695 | |||
1696 | /***************************************************************************/ | ||
1697 | /* FUNCTION DECLARATIONS */ | ||
1698 | /***************************************************************************/ | ||
1699 | |||
1700 | #define get_journal_desc_magic(bh) (bh->b_data + bh->b_size - 12) | ||
1701 | |||
1702 | #define journal_trans_half(blocksize) \ | ||
1703 | ((blocksize - sizeof (struct reiserfs_journal_desc) + sizeof (__u32) - 12) / sizeof (__u32)) | ||
1704 | |||
1705 | /* journal.c see journal.c for all the comments here */ | ||
1706 | |||
1707 | /* first block written in a commit. */ | ||
1708 | struct reiserfs_journal_desc { | ||
1709 | __le32 j_trans_id; /* id of commit */ | ||
1710 | __le32 j_len; /* length of commit. len +1 is the commit block */ | ||
1711 | __le32 j_mount_id; /* mount id of this trans */ | ||
1712 | __le32 j_realblock[1]; /* real locations for each block */ | ||
1713 | }; | ||
1714 | |||
1715 | #define get_desc_trans_id(d) le32_to_cpu((d)->j_trans_id) | ||
1716 | #define get_desc_trans_len(d) le32_to_cpu((d)->j_len) | ||
1717 | #define get_desc_mount_id(d) le32_to_cpu((d)->j_mount_id) | ||
1718 | |||
1719 | #define set_desc_trans_id(d,val) do { (d)->j_trans_id = cpu_to_le32 (val); } while (0) | ||
1720 | #define set_desc_trans_len(d,val) do { (d)->j_len = cpu_to_le32 (val); } while (0) | ||
1721 | #define set_desc_mount_id(d,val) do { (d)->j_mount_id = cpu_to_le32 (val); } while (0) | ||
1722 | |||
1723 | /* last block written in a commit */ | ||
1724 | struct reiserfs_journal_commit { | ||
1725 | __le32 j_trans_id; /* must match j_trans_id from the desc block */ | ||
1726 | __le32 j_len; /* ditto */ | ||
1727 | __le32 j_realblock[1]; /* real locations for each block */ | ||
1728 | }; | ||
1729 | |||
1730 | #define get_commit_trans_id(c) le32_to_cpu((c)->j_trans_id) | ||
1731 | #define get_commit_trans_len(c) le32_to_cpu((c)->j_len) | ||
1732 | #define get_commit_mount_id(c) le32_to_cpu((c)->j_mount_id) | ||
1733 | |||
1734 | #define set_commit_trans_id(c,val) do { (c)->j_trans_id = cpu_to_le32 (val); } while (0) | ||
1735 | #define set_commit_trans_len(c,val) do { (c)->j_len = cpu_to_le32 (val); } while (0) | ||
1736 | |||
1737 | /* this header block gets written whenever a transaction is considered fully flushed, and is more recent than the | ||
1738 | ** last fully flushed transaction. fully flushed means all the log blocks and all the real blocks are on disk, | ||
1739 | ** and this transaction does not need to be replayed. | ||
1740 | */ | ||
1741 | struct reiserfs_journal_header { | ||
1742 | __le32 j_last_flush_trans_id; /* id of last fully flushed transaction */ | ||
1743 | __le32 j_first_unflushed_offset; /* offset in the log of where to start replay after a crash */ | ||
1744 | __le32 j_mount_id; | ||
1745 | /* 12 */ struct journal_params jh_journal; | ||
1746 | }; | ||
1747 | |||
1748 | /* biggest tunable defines are right here */ | ||
1749 | #define JOURNAL_BLOCK_COUNT 8192 /* number of blocks in the journal */ | ||
1750 | #define JOURNAL_TRANS_MAX_DEFAULT 1024 /* biggest possible single transaction, don't change for now (8/3/99) */ | ||
1751 | #define JOURNAL_TRANS_MIN_DEFAULT 256 | ||
1752 | #define JOURNAL_MAX_BATCH_DEFAULT 900 /* max blocks to batch into one transaction, don't make this any bigger than 900 */ | ||
1753 | #define JOURNAL_MIN_RATIO 2 | ||
1754 | #define JOURNAL_MAX_COMMIT_AGE 30 | ||
1755 | #define JOURNAL_MAX_TRANS_AGE 30 | ||
1756 | #define JOURNAL_PER_BALANCE_CNT (3 * (MAX_HEIGHT-2) + 9) | ||
1757 | #define JOURNAL_BLOCKS_PER_OBJECT(sb) (JOURNAL_PER_BALANCE_CNT * 3 + \ | ||
1758 | 2 * (REISERFS_QUOTA_INIT_BLOCKS(sb) + \ | ||
1759 | REISERFS_QUOTA_TRANS_BLOCKS(sb))) | ||
1760 | |||
1761 | #ifdef CONFIG_QUOTA | ||
1762 | #define REISERFS_QUOTA_OPTS ((1 << REISERFS_USRQUOTA) | (1 << REISERFS_GRPQUOTA)) | ||
1763 | /* We need to update data and inode (atime) */ | ||
1764 | #define REISERFS_QUOTA_TRANS_BLOCKS(s) (REISERFS_SB(s)->s_mount_opt & REISERFS_QUOTA_OPTS ? 2 : 0) | ||
1765 | /* 1 balancing, 1 bitmap, 1 data per write + stat data update */ | ||
1766 | #define REISERFS_QUOTA_INIT_BLOCKS(s) (REISERFS_SB(s)->s_mount_opt & REISERFS_QUOTA_OPTS ? \ | ||
1767 | (DQUOT_INIT_ALLOC*(JOURNAL_PER_BALANCE_CNT+2)+DQUOT_INIT_REWRITE+1) : 0) | ||
1768 | /* same as with INIT */ | ||
1769 | #define REISERFS_QUOTA_DEL_BLOCKS(s) (REISERFS_SB(s)->s_mount_opt & REISERFS_QUOTA_OPTS ? \ | ||
1770 | (DQUOT_DEL_ALLOC*(JOURNAL_PER_BALANCE_CNT+2)+DQUOT_DEL_REWRITE+1) : 0) | ||
1771 | #else | ||
1772 | #define REISERFS_QUOTA_TRANS_BLOCKS(s) 0 | ||
1773 | #define REISERFS_QUOTA_INIT_BLOCKS(s) 0 | ||
1774 | #define REISERFS_QUOTA_DEL_BLOCKS(s) 0 | ||
1775 | #endif | ||
1776 | |||
1777 | /* both of these can be as low as 1, or as high as you want. The min is the | ||
1778 | ** number of 4k bitmap nodes preallocated on mount. New nodes are allocated | ||
1779 | ** as needed, and released when transactions are committed. On release, if | ||
1780 | ** the current number of nodes is > max, the node is freed, otherwise, | ||
1781 | ** it is put on a free list for faster use later. | ||
1782 | */ | ||
1783 | #define REISERFS_MIN_BITMAP_NODES 10 | ||
1784 | #define REISERFS_MAX_BITMAP_NODES 100 | ||
1785 | |||
1786 | #define JBH_HASH_SHIFT 13 /* these are based on journal hash size of 8192 */ | ||
1787 | #define JBH_HASH_MASK 8191 | ||
1788 | |||
1789 | #define _jhashfn(sb,block) \ | ||
1790 | (((unsigned long)sb>>L1_CACHE_SHIFT) ^ \ | ||
1791 | (((block)<<(JBH_HASH_SHIFT - 6)) ^ ((block) >> 13) ^ ((block) << (JBH_HASH_SHIFT - 12)))) | ||
1792 | #define journal_hash(t,sb,block) ((t)[_jhashfn((sb),(block)) & JBH_HASH_MASK]) | ||
1793 | |||
1794 | // We need these to make journal.c code more readable | ||
1795 | #define journal_find_get_block(s, block) __find_get_block(SB_JOURNAL(s)->j_dev_bd, block, s->s_blocksize) | ||
1796 | #define journal_getblk(s, block) __getblk(SB_JOURNAL(s)->j_dev_bd, block, s->s_blocksize) | ||
1797 | #define journal_bread(s, block) __bread(SB_JOURNAL(s)->j_dev_bd, block, s->s_blocksize) | ||
1798 | |||
1799 | enum reiserfs_bh_state_bits { | ||
1800 | BH_JDirty = BH_PrivateStart, /* buffer is in current transaction */ | ||
1801 | BH_JDirty_wait, | ||
1802 | BH_JNew, /* disk block was taken off free list before | ||
1803 | * being in a finished transaction, or | ||
1804 | * written to disk. Can be reused immed. */ | ||
1805 | BH_JPrepared, | ||
1806 | BH_JRestore_dirty, | ||
1807 | BH_JTest, // debugging only will go away | ||
1808 | }; | ||
1809 | |||
1810 | BUFFER_FNS(JDirty, journaled); | ||
1811 | TAS_BUFFER_FNS(JDirty, journaled); | ||
1812 | BUFFER_FNS(JDirty_wait, journal_dirty); | ||
1813 | TAS_BUFFER_FNS(JDirty_wait, journal_dirty); | ||
1814 | BUFFER_FNS(JNew, journal_new); | ||
1815 | TAS_BUFFER_FNS(JNew, journal_new); | ||
1816 | BUFFER_FNS(JPrepared, journal_prepared); | ||
1817 | TAS_BUFFER_FNS(JPrepared, journal_prepared); | ||
1818 | BUFFER_FNS(JRestore_dirty, journal_restore_dirty); | ||
1819 | TAS_BUFFER_FNS(JRestore_dirty, journal_restore_dirty); | ||
1820 | BUFFER_FNS(JTest, journal_test); | ||
1821 | TAS_BUFFER_FNS(JTest, journal_test); | ||
1822 | |||
1823 | /* | ||
1824 | ** transaction handle which is passed around for all journal calls | ||
1825 | */ | ||
1826 | struct reiserfs_transaction_handle { | ||
1827 | struct super_block *t_super; /* super for this FS when journal_begin was | ||
1828 | called. saves calls to reiserfs_get_super | ||
1829 | also used by nested transactions to make | ||
1830 | sure they are nesting on the right FS | ||
1831 | _must_ be first in the handle | ||
1832 | */ | ||
1833 | int t_refcount; | ||
1834 | int t_blocks_logged; /* number of blocks this writer has logged */ | ||
1835 | int t_blocks_allocated; /* number of blocks this writer allocated */ | ||
1836 | unsigned int t_trans_id; /* sanity check, equals the current trans id */ | ||
1837 | void *t_handle_save; /* save existing current->journal_info */ | ||
1838 | unsigned displace_new_blocks:1; /* if new block allocation occurres, that block | ||
1839 | should be displaced from others */ | ||
1840 | struct list_head t_list; | ||
1841 | }; | ||
1842 | |||
1843 | /* used to keep track of ordered and tail writes, attached to the buffer | ||
1844 | * head through b_journal_head. | ||
1845 | */ | ||
1846 | struct reiserfs_jh { | ||
1847 | struct reiserfs_journal_list *jl; | ||
1848 | struct buffer_head *bh; | ||
1849 | struct list_head list; | ||
1850 | }; | ||
1851 | |||
1852 | void reiserfs_free_jh(struct buffer_head *bh); | ||
1853 | int reiserfs_add_tail_list(struct inode *inode, struct buffer_head *bh); | ||
1854 | int reiserfs_add_ordered_list(struct inode *inode, struct buffer_head *bh); | ||
1855 | int journal_mark_dirty(struct reiserfs_transaction_handle *, | ||
1856 | struct super_block *, struct buffer_head *bh); | ||
1857 | |||
1858 | static inline int reiserfs_file_data_log(struct inode *inode) | ||
1859 | { | ||
1860 | if (reiserfs_data_log(inode->i_sb) || | ||
1861 | (REISERFS_I(inode)->i_flags & i_data_log)) | ||
1862 | return 1; | ||
1863 | return 0; | ||
1864 | } | ||
1865 | |||
1866 | static inline int reiserfs_transaction_running(struct super_block *s) | ||
1867 | { | ||
1868 | struct reiserfs_transaction_handle *th = current->journal_info; | ||
1869 | if (th && th->t_super == s) | ||
1870 | return 1; | ||
1871 | if (th && th->t_super == NULL) | ||
1872 | BUG(); | ||
1873 | return 0; | ||
1874 | } | ||
1875 | |||
1876 | static inline int reiserfs_transaction_free_space(struct reiserfs_transaction_handle *th) | ||
1877 | { | ||
1878 | return th->t_blocks_allocated - th->t_blocks_logged; | ||
1879 | } | ||
1880 | |||
1881 | struct reiserfs_transaction_handle *reiserfs_persistent_transaction(struct | ||
1882 | super_block | ||
1883 | *, | ||
1884 | int count); | ||
1885 | int reiserfs_end_persistent_transaction(struct reiserfs_transaction_handle *); | ||
1886 | int reiserfs_commit_page(struct inode *inode, struct page *page, | ||
1887 | unsigned from, unsigned to); | ||
1888 | int reiserfs_flush_old_commits(struct super_block *); | ||
1889 | int reiserfs_commit_for_inode(struct inode *); | ||
1890 | int reiserfs_inode_needs_commit(struct inode *); | ||
1891 | void reiserfs_update_inode_transaction(struct inode *); | ||
1892 | void reiserfs_wait_on_write_block(struct super_block *s); | ||
1893 | void reiserfs_block_writes(struct reiserfs_transaction_handle *th); | ||
1894 | void reiserfs_allow_writes(struct super_block *s); | ||
1895 | void reiserfs_check_lock_depth(struct super_block *s, char *caller); | ||
1896 | int reiserfs_prepare_for_journal(struct super_block *, struct buffer_head *bh, | ||
1897 | int wait); | ||
1898 | void reiserfs_restore_prepared_buffer(struct super_block *, | ||
1899 | struct buffer_head *bh); | ||
1900 | int journal_init(struct super_block *, const char *j_dev_name, int old_format, | ||
1901 | unsigned int); | ||
1902 | int journal_release(struct reiserfs_transaction_handle *, struct super_block *); | ||
1903 | int journal_release_error(struct reiserfs_transaction_handle *, | ||
1904 | struct super_block *); | ||
1905 | int journal_end(struct reiserfs_transaction_handle *, struct super_block *, | ||
1906 | unsigned long); | ||
1907 | int journal_end_sync(struct reiserfs_transaction_handle *, struct super_block *, | ||
1908 | unsigned long); | ||
1909 | int journal_mark_freed(struct reiserfs_transaction_handle *, | ||
1910 | struct super_block *, b_blocknr_t blocknr); | ||
1911 | int journal_transaction_should_end(struct reiserfs_transaction_handle *, int); | ||
1912 | int reiserfs_in_journal(struct super_block *sb, unsigned int bmap_nr, | ||
1913 | int bit_nr, int searchall, b_blocknr_t *next); | ||
1914 | int journal_begin(struct reiserfs_transaction_handle *, | ||
1915 | struct super_block *sb, unsigned long); | ||
1916 | int journal_join_abort(struct reiserfs_transaction_handle *, | ||
1917 | struct super_block *sb, unsigned long); | ||
1918 | void reiserfs_abort_journal(struct super_block *sb, int errno); | ||
1919 | void reiserfs_abort(struct super_block *sb, int errno, const char *fmt, ...); | ||
1920 | int reiserfs_allocate_list_bitmaps(struct super_block *s, | ||
1921 | struct reiserfs_list_bitmap *, unsigned int); | ||
1922 | |||
1923 | void add_save_link(struct reiserfs_transaction_handle *th, | ||
1924 | struct inode *inode, int truncate); | ||
1925 | int remove_save_link(struct inode *inode, int truncate); | ||
1926 | |||
1927 | /* objectid.c */ | ||
1928 | __u32 reiserfs_get_unused_objectid(struct reiserfs_transaction_handle *th); | ||
1929 | void reiserfs_release_objectid(struct reiserfs_transaction_handle *th, | ||
1930 | __u32 objectid_to_release); | ||
1931 | int reiserfs_convert_objectid_map_v1(struct super_block *); | ||
1932 | |||
1933 | /* stree.c */ | ||
1934 | int B_IS_IN_TREE(const struct buffer_head *); | ||
1935 | extern void copy_item_head(struct item_head *to, | ||
1936 | const struct item_head *from); | ||
1937 | |||
1938 | // first key is in cpu form, second - le | ||
1939 | extern int comp_short_keys(const struct reiserfs_key *le_key, | ||
1940 | const struct cpu_key *cpu_key); | ||
1941 | extern void le_key2cpu_key(struct cpu_key *to, const struct reiserfs_key *from); | ||
1942 | |||
1943 | // both are in le form | ||
1944 | extern int comp_le_keys(const struct reiserfs_key *, | ||
1945 | const struct reiserfs_key *); | ||
1946 | extern int comp_short_le_keys(const struct reiserfs_key *, | ||
1947 | const struct reiserfs_key *); | ||
1948 | |||
1949 | // | ||
1950 | // get key version from on disk key - kludge | ||
1951 | // | ||
1952 | static inline int le_key_version(const struct reiserfs_key *key) | ||
1953 | { | ||
1954 | int type; | ||
1955 | |||
1956 | type = offset_v2_k_type(&(key->u.k_offset_v2)); | ||
1957 | if (type != TYPE_DIRECT && type != TYPE_INDIRECT | ||
1958 | && type != TYPE_DIRENTRY) | ||
1959 | return KEY_FORMAT_3_5; | ||
1960 | |||
1961 | return KEY_FORMAT_3_6; | ||
1962 | |||
1963 | } | ||
1964 | |||
1965 | static inline void copy_key(struct reiserfs_key *to, | ||
1966 | const struct reiserfs_key *from) | ||
1967 | { | ||
1968 | memcpy(to, from, KEY_SIZE); | ||
1969 | } | ||
1970 | |||
1971 | int comp_items(const struct item_head *stored_ih, const struct treepath *path); | ||
1972 | const struct reiserfs_key *get_rkey(const struct treepath *chk_path, | ||
1973 | const struct super_block *sb); | ||
1974 | int search_by_key(struct super_block *, const struct cpu_key *, | ||
1975 | struct treepath *, int); | ||
1976 | #define search_item(s,key,path) search_by_key (s, key, path, DISK_LEAF_NODE_LEVEL) | ||
1977 | int search_for_position_by_key(struct super_block *sb, | ||
1978 | const struct cpu_key *cpu_key, | ||
1979 | struct treepath *search_path); | ||
1980 | extern void decrement_bcount(struct buffer_head *bh); | ||
1981 | void decrement_counters_in_path(struct treepath *search_path); | ||
1982 | void pathrelse(struct treepath *search_path); | ||
1983 | int reiserfs_check_path(struct treepath *p); | ||
1984 | void pathrelse_and_restore(struct super_block *s, struct treepath *search_path); | ||
1985 | |||
1986 | int reiserfs_insert_item(struct reiserfs_transaction_handle *th, | ||
1987 | struct treepath *path, | ||
1988 | const struct cpu_key *key, | ||
1989 | struct item_head *ih, | ||
1990 | struct inode *inode, const char *body); | ||
1991 | |||
1992 | int reiserfs_paste_into_item(struct reiserfs_transaction_handle *th, | ||
1993 | struct treepath *path, | ||
1994 | const struct cpu_key *key, | ||
1995 | struct inode *inode, | ||
1996 | const char *body, int paste_size); | ||
1997 | |||
1998 | int reiserfs_cut_from_item(struct reiserfs_transaction_handle *th, | ||
1999 | struct treepath *path, | ||
2000 | struct cpu_key *key, | ||
2001 | struct inode *inode, | ||
2002 | struct page *page, loff_t new_file_size); | ||
2003 | |||
2004 | int reiserfs_delete_item(struct reiserfs_transaction_handle *th, | ||
2005 | struct treepath *path, | ||
2006 | const struct cpu_key *key, | ||
2007 | struct inode *inode, struct buffer_head *un_bh); | ||
2008 | |||
2009 | void reiserfs_delete_solid_item(struct reiserfs_transaction_handle *th, | ||
2010 | struct inode *inode, struct reiserfs_key *key); | ||
2011 | int reiserfs_delete_object(struct reiserfs_transaction_handle *th, | ||
2012 | struct inode *inode); | ||
2013 | int reiserfs_do_truncate(struct reiserfs_transaction_handle *th, | ||
2014 | struct inode *inode, struct page *, | ||
2015 | int update_timestamps); | ||
2016 | |||
2017 | #define i_block_size(inode) ((inode)->i_sb->s_blocksize) | ||
2018 | #define file_size(inode) ((inode)->i_size) | ||
2019 | #define tail_size(inode) (file_size (inode) & (i_block_size (inode) - 1)) | ||
2020 | |||
2021 | #define tail_has_to_be_packed(inode) (have_large_tails ((inode)->i_sb)?\ | ||
2022 | !STORE_TAIL_IN_UNFM_S1(file_size (inode), tail_size(inode), inode->i_sb->s_blocksize):have_small_tails ((inode)->i_sb)?!STORE_TAIL_IN_UNFM_S2(file_size (inode), tail_size(inode), inode->i_sb->s_blocksize):0 ) | ||
2023 | |||
2024 | void padd_item(char *item, int total_length, int length); | ||
2025 | |||
2026 | /* inode.c */ | ||
2027 | /* args for the create parameter of reiserfs_get_block */ | ||
2028 | #define GET_BLOCK_NO_CREATE 0 /* don't create new blocks or convert tails */ | ||
2029 | #define GET_BLOCK_CREATE 1 /* add anything you need to find block */ | ||
2030 | #define GET_BLOCK_NO_HOLE 2 /* return -ENOENT for file holes */ | ||
2031 | #define GET_BLOCK_READ_DIRECT 4 /* read the tail if indirect item not found */ | ||
2032 | #define GET_BLOCK_NO_IMUX 8 /* i_mutex is not held, don't preallocate */ | ||
2033 | #define GET_BLOCK_NO_DANGLE 16 /* don't leave any transactions running */ | ||
2034 | |||
2035 | void reiserfs_read_locked_inode(struct inode *inode, | ||
2036 | struct reiserfs_iget_args *args); | ||
2037 | int reiserfs_find_actor(struct inode *inode, void *p); | ||
2038 | int reiserfs_init_locked_inode(struct inode *inode, void *p); | ||
2039 | void reiserfs_evict_inode(struct inode *inode); | ||
2040 | int reiserfs_write_inode(struct inode *inode, struct writeback_control *wbc); | ||
2041 | int reiserfs_get_block(struct inode *inode, sector_t block, | ||
2042 | struct buffer_head *bh_result, int create); | ||
2043 | struct dentry *reiserfs_fh_to_dentry(struct super_block *sb, struct fid *fid, | ||
2044 | int fh_len, int fh_type); | ||
2045 | struct dentry *reiserfs_fh_to_parent(struct super_block *sb, struct fid *fid, | ||
2046 | int fh_len, int fh_type); | ||
2047 | int reiserfs_encode_fh(struct dentry *dentry, __u32 * data, int *lenp, | ||
2048 | int connectable); | ||
2049 | |||
2050 | int reiserfs_truncate_file(struct inode *, int update_timestamps); | ||
2051 | void make_cpu_key(struct cpu_key *cpu_key, struct inode *inode, loff_t offset, | ||
2052 | int type, int key_length); | ||
2053 | void make_le_item_head(struct item_head *ih, const struct cpu_key *key, | ||
2054 | int version, | ||
2055 | loff_t offset, int type, int length, int entry_count); | ||
2056 | struct inode *reiserfs_iget(struct super_block *s, const struct cpu_key *key); | ||
2057 | |||
2058 | struct reiserfs_security_handle; | ||
2059 | int reiserfs_new_inode(struct reiserfs_transaction_handle *th, | ||
2060 | struct inode *dir, umode_t mode, | ||
2061 | const char *symname, loff_t i_size, | ||
2062 | struct dentry *dentry, struct inode *inode, | ||
2063 | struct reiserfs_security_handle *security); | ||
2064 | |||
2065 | void reiserfs_update_sd_size(struct reiserfs_transaction_handle *th, | ||
2066 | struct inode *inode, loff_t size); | ||
2067 | |||
2068 | static inline void reiserfs_update_sd(struct reiserfs_transaction_handle *th, | ||
2069 | struct inode *inode) | ||
2070 | { | ||
2071 | reiserfs_update_sd_size(th, inode, inode->i_size); | ||
2072 | } | ||
2073 | |||
2074 | void sd_attrs_to_i_attrs(__u16 sd_attrs, struct inode *inode); | ||
2075 | void i_attrs_to_sd_attrs(struct inode *inode, __u16 * sd_attrs); | ||
2076 | int reiserfs_setattr(struct dentry *dentry, struct iattr *attr); | ||
2077 | |||
2078 | int __reiserfs_write_begin(struct page *page, unsigned from, unsigned len); | ||
2079 | |||
2080 | /* namei.c */ | ||
2081 | void set_de_name_and_namelen(struct reiserfs_dir_entry *de); | ||
2082 | int search_by_entry_key(struct super_block *sb, const struct cpu_key *key, | ||
2083 | struct treepath *path, struct reiserfs_dir_entry *de); | ||
2084 | struct dentry *reiserfs_get_parent(struct dentry *); | ||
2085 | |||
2086 | #ifdef CONFIG_REISERFS_PROC_INFO | ||
2087 | int reiserfs_proc_info_init(struct super_block *sb); | ||
2088 | int reiserfs_proc_info_done(struct super_block *sb); | ||
2089 | int reiserfs_proc_info_global_init(void); | ||
2090 | int reiserfs_proc_info_global_done(void); | ||
2091 | |||
2092 | #define PROC_EXP( e ) e | ||
2093 | |||
2094 | #define __PINFO( sb ) REISERFS_SB(sb) -> s_proc_info_data | ||
2095 | #define PROC_INFO_MAX( sb, field, value ) \ | ||
2096 | __PINFO( sb ).field = \ | ||
2097 | max( REISERFS_SB( sb ) -> s_proc_info_data.field, value ) | ||
2098 | #define PROC_INFO_INC( sb, field ) ( ++ ( __PINFO( sb ).field ) ) | ||
2099 | #define PROC_INFO_ADD( sb, field, val ) ( __PINFO( sb ).field += ( val ) ) | ||
2100 | #define PROC_INFO_BH_STAT( sb, bh, level ) \ | ||
2101 | PROC_INFO_INC( sb, sbk_read_at[ ( level ) ] ); \ | ||
2102 | PROC_INFO_ADD( sb, free_at[ ( level ) ], B_FREE_SPACE( bh ) ); \ | ||
2103 | PROC_INFO_ADD( sb, items_at[ ( level ) ], B_NR_ITEMS( bh ) ) | ||
2104 | #else | ||
2105 | static inline int reiserfs_proc_info_init(struct super_block *sb) | ||
2106 | { | ||
2107 | return 0; | ||
2108 | } | ||
2109 | |||
2110 | static inline int reiserfs_proc_info_done(struct super_block *sb) | ||
2111 | { | ||
2112 | return 0; | ||
2113 | } | ||
2114 | |||
2115 | static inline int reiserfs_proc_info_global_init(void) | ||
2116 | { | ||
2117 | return 0; | ||
2118 | } | ||
2119 | |||
2120 | static inline int reiserfs_proc_info_global_done(void) | ||
2121 | { | ||
2122 | return 0; | ||
2123 | } | ||
2124 | |||
2125 | #define PROC_EXP( e ) | ||
2126 | #define VOID_V ( ( void ) 0 ) | ||
2127 | #define PROC_INFO_MAX( sb, field, value ) VOID_V | ||
2128 | #define PROC_INFO_INC( sb, field ) VOID_V | ||
2129 | #define PROC_INFO_ADD( sb, field, val ) VOID_V | ||
2130 | #define PROC_INFO_BH_STAT(sb, bh, n_node_level) VOID_V | ||
2131 | #endif | ||
2132 | |||
2133 | /* dir.c */ | ||
2134 | extern const struct inode_operations reiserfs_dir_inode_operations; | ||
2135 | extern const struct inode_operations reiserfs_symlink_inode_operations; | ||
2136 | extern const struct inode_operations reiserfs_special_inode_operations; | ||
2137 | extern const struct file_operations reiserfs_dir_operations; | ||
2138 | int reiserfs_readdir_dentry(struct dentry *, void *, filldir_t, loff_t *); | ||
2139 | |||
2140 | /* tail_conversion.c */ | ||
2141 | int direct2indirect(struct reiserfs_transaction_handle *, struct inode *, | ||
2142 | struct treepath *, struct buffer_head *, loff_t); | ||
2143 | int indirect2direct(struct reiserfs_transaction_handle *, struct inode *, | ||
2144 | struct page *, struct treepath *, const struct cpu_key *, | ||
2145 | loff_t, char *); | ||
2146 | void reiserfs_unmap_buffer(struct buffer_head *); | ||
2147 | |||
2148 | /* file.c */ | ||
2149 | extern const struct inode_operations reiserfs_file_inode_operations; | ||
2150 | extern const struct file_operations reiserfs_file_operations; | ||
2151 | extern const struct address_space_operations reiserfs_address_space_operations; | ||
2152 | |||
2153 | /* fix_nodes.c */ | ||
2154 | |||
2155 | int fix_nodes(int n_op_mode, struct tree_balance *tb, | ||
2156 | struct item_head *ins_ih, const void *); | ||
2157 | void unfix_nodes(struct tree_balance *); | ||
2158 | |||
2159 | /* prints.c */ | ||
2160 | void __reiserfs_panic(struct super_block *s, const char *id, | ||
2161 | const char *function, const char *fmt, ...) | ||
2162 | __attribute__ ((noreturn)); | ||
2163 | #define reiserfs_panic(s, id, fmt, args...) \ | ||
2164 | __reiserfs_panic(s, id, __func__, fmt, ##args) | ||
2165 | void __reiserfs_error(struct super_block *s, const char *id, | ||
2166 | const char *function, const char *fmt, ...); | ||
2167 | #define reiserfs_error(s, id, fmt, args...) \ | ||
2168 | __reiserfs_error(s, id, __func__, fmt, ##args) | ||
2169 | void reiserfs_info(struct super_block *s, const char *fmt, ...); | ||
2170 | void reiserfs_debug(struct super_block *s, int level, const char *fmt, ...); | ||
2171 | void print_indirect_item(struct buffer_head *bh, int item_num); | ||
2172 | void store_print_tb(struct tree_balance *tb); | ||
2173 | void print_cur_tb(char *mes); | ||
2174 | void print_de(struct reiserfs_dir_entry *de); | ||
2175 | void print_bi(struct buffer_info *bi, char *mes); | ||
2176 | #define PRINT_LEAF_ITEMS 1 /* print all items */ | ||
2177 | #define PRINT_DIRECTORY_ITEMS 2 /* print directory items */ | ||
2178 | #define PRINT_DIRECT_ITEMS 4 /* print contents of direct items */ | ||
2179 | void print_block(struct buffer_head *bh, ...); | ||
2180 | void print_bmap(struct super_block *s, int silent); | ||
2181 | void print_bmap_block(int i, char *data, int size, int silent); | ||
2182 | /*void print_super_block (struct super_block * s, char * mes);*/ | ||
2183 | void print_objectid_map(struct super_block *s); | ||
2184 | void print_block_head(struct buffer_head *bh, char *mes); | ||
2185 | void check_leaf(struct buffer_head *bh); | ||
2186 | void check_internal(struct buffer_head *bh); | ||
2187 | void print_statistics(struct super_block *s); | ||
2188 | char *reiserfs_hashname(int code); | ||
2189 | |||
2190 | /* lbalance.c */ | ||
2191 | int leaf_move_items(int shift_mode, struct tree_balance *tb, int mov_num, | ||
2192 | int mov_bytes, struct buffer_head *Snew); | ||
2193 | int leaf_shift_left(struct tree_balance *tb, int shift_num, int shift_bytes); | ||
2194 | int leaf_shift_right(struct tree_balance *tb, int shift_num, int shift_bytes); | ||
2195 | void leaf_delete_items(struct buffer_info *cur_bi, int last_first, int first, | ||
2196 | int del_num, int del_bytes); | ||
2197 | void leaf_insert_into_buf(struct buffer_info *bi, int before, | ||
2198 | struct item_head *inserted_item_ih, | ||
2199 | const char *inserted_item_body, int zeros_number); | ||
2200 | void leaf_paste_in_buffer(struct buffer_info *bi, int pasted_item_num, | ||
2201 | int pos_in_item, int paste_size, const char *body, | ||
2202 | int zeros_number); | ||
2203 | void leaf_cut_from_buffer(struct buffer_info *bi, int cut_item_num, | ||
2204 | int pos_in_item, int cut_size); | ||
2205 | void leaf_paste_entries(struct buffer_info *bi, int item_num, int before, | ||
2206 | int new_entry_count, struct reiserfs_de_head *new_dehs, | ||
2207 | const char *records, int paste_size); | ||
2208 | /* ibalance.c */ | ||
2209 | int balance_internal(struct tree_balance *, int, int, struct item_head *, | ||
2210 | struct buffer_head **); | ||
2211 | |||
2212 | /* do_balance.c */ | ||
2213 | void do_balance_mark_leaf_dirty(struct tree_balance *tb, | ||
2214 | struct buffer_head *bh, int flag); | ||
2215 | #define do_balance_mark_internal_dirty do_balance_mark_leaf_dirty | ||
2216 | #define do_balance_mark_sb_dirty do_balance_mark_leaf_dirty | ||
2217 | |||
2218 | void do_balance(struct tree_balance *tb, struct item_head *ih, | ||
2219 | const char *body, int flag); | ||
2220 | void reiserfs_invalidate_buffer(struct tree_balance *tb, | ||
2221 | struct buffer_head *bh); | ||
2222 | |||
2223 | int get_left_neighbor_position(struct tree_balance *tb, int h); | ||
2224 | int get_right_neighbor_position(struct tree_balance *tb, int h); | ||
2225 | void replace_key(struct tree_balance *tb, struct buffer_head *, int, | ||
2226 | struct buffer_head *, int); | ||
2227 | void make_empty_node(struct buffer_info *); | ||
2228 | struct buffer_head *get_FEB(struct tree_balance *); | ||
2229 | |||
2230 | /* bitmap.c */ | ||
2231 | |||
2232 | /* structure contains hints for block allocator, and it is a container for | ||
2233 | * arguments, such as node, search path, transaction_handle, etc. */ | ||
2234 | struct __reiserfs_blocknr_hint { | ||
2235 | struct inode *inode; /* inode passed to allocator, if we allocate unf. nodes */ | ||
2236 | sector_t block; /* file offset, in blocks */ | ||
2237 | struct in_core_key key; | ||
2238 | struct treepath *path; /* search path, used by allocator to deternine search_start by | ||
2239 | * various ways */ | ||
2240 | struct reiserfs_transaction_handle *th; /* transaction handle is needed to log super blocks and | ||
2241 | * bitmap blocks changes */ | ||
2242 | b_blocknr_t beg, end; | ||
2243 | b_blocknr_t search_start; /* a field used to transfer search start value (block number) | ||
2244 | * between different block allocator procedures | ||
2245 | * (determine_search_start() and others) */ | ||
2246 | int prealloc_size; /* is set in determine_prealloc_size() function, used by underlayed | ||
2247 | * function that do actual allocation */ | ||
2248 | |||
2249 | unsigned formatted_node:1; /* the allocator uses different polices for getting disk space for | ||
2250 | * formatted/unformatted blocks with/without preallocation */ | ||
2251 | unsigned preallocate:1; | ||
2252 | }; | ||
2253 | |||
2254 | typedef struct __reiserfs_blocknr_hint reiserfs_blocknr_hint_t; | ||
2255 | |||
2256 | int reiserfs_parse_alloc_options(struct super_block *, char *); | ||
2257 | void reiserfs_init_alloc_options(struct super_block *s); | ||
2258 | |||
2259 | /* | ||
2260 | * given a directory, this will tell you what packing locality | ||
2261 | * to use for a new object underneat it. The locality is returned | ||
2262 | * in disk byte order (le). | ||
2263 | */ | ||
2264 | __le32 reiserfs_choose_packing(struct inode *dir); | ||
2265 | |||
2266 | int reiserfs_init_bitmap_cache(struct super_block *sb); | ||
2267 | void reiserfs_free_bitmap_cache(struct super_block *sb); | ||
2268 | void reiserfs_cache_bitmap_metadata(struct super_block *sb, struct buffer_head *bh, struct reiserfs_bitmap_info *info); | ||
2269 | struct buffer_head *reiserfs_read_bitmap_block(struct super_block *sb, unsigned int bitmap); | ||
2270 | int is_reusable(struct super_block *s, b_blocknr_t block, int bit_value); | ||
2271 | void reiserfs_free_block(struct reiserfs_transaction_handle *th, struct inode *, | ||
2272 | b_blocknr_t, int for_unformatted); | ||
2273 | int reiserfs_allocate_blocknrs(reiserfs_blocknr_hint_t *, b_blocknr_t *, int, | ||
2274 | int); | ||
2275 | static inline int reiserfs_new_form_blocknrs(struct tree_balance *tb, | ||
2276 | b_blocknr_t * new_blocknrs, | ||
2277 | int amount_needed) | ||
2278 | { | ||
2279 | reiserfs_blocknr_hint_t hint = { | ||
2280 | .th = tb->transaction_handle, | ||
2281 | .path = tb->tb_path, | ||
2282 | .inode = NULL, | ||
2283 | .key = tb->key, | ||
2284 | .block = 0, | ||
2285 | .formatted_node = 1 | ||
2286 | }; | ||
2287 | return reiserfs_allocate_blocknrs(&hint, new_blocknrs, amount_needed, | ||
2288 | 0); | ||
2289 | } | ||
2290 | |||
2291 | static inline int reiserfs_new_unf_blocknrs(struct reiserfs_transaction_handle | ||
2292 | *th, struct inode *inode, | ||
2293 | b_blocknr_t * new_blocknrs, | ||
2294 | struct treepath *path, | ||
2295 | sector_t block) | ||
2296 | { | ||
2297 | reiserfs_blocknr_hint_t hint = { | ||
2298 | .th = th, | ||
2299 | .path = path, | ||
2300 | .inode = inode, | ||
2301 | .block = block, | ||
2302 | .formatted_node = 0, | ||
2303 | .preallocate = 0 | ||
2304 | }; | ||
2305 | return reiserfs_allocate_blocknrs(&hint, new_blocknrs, 1, 0); | ||
2306 | } | ||
2307 | |||
2308 | #ifdef REISERFS_PREALLOCATE | ||
2309 | static inline int reiserfs_new_unf_blocknrs2(struct reiserfs_transaction_handle | ||
2310 | *th, struct inode *inode, | ||
2311 | b_blocknr_t * new_blocknrs, | ||
2312 | struct treepath *path, | ||
2313 | sector_t block) | ||
2314 | { | ||
2315 | reiserfs_blocknr_hint_t hint = { | ||
2316 | .th = th, | ||
2317 | .path = path, | ||
2318 | .inode = inode, | ||
2319 | .block = block, | ||
2320 | .formatted_node = 0, | ||
2321 | .preallocate = 1 | ||
2322 | }; | ||
2323 | return reiserfs_allocate_blocknrs(&hint, new_blocknrs, 1, 0); | ||
2324 | } | ||
2325 | |||
2326 | void reiserfs_discard_prealloc(struct reiserfs_transaction_handle *th, | ||
2327 | struct inode *inode); | ||
2328 | void reiserfs_discard_all_prealloc(struct reiserfs_transaction_handle *th); | ||
2329 | #endif | ||
2330 | |||
2331 | /* hashes.c */ | ||
2332 | __u32 keyed_hash(const signed char *msg, int len); | ||
2333 | __u32 yura_hash(const signed char *msg, int len); | ||
2334 | __u32 r5_hash(const signed char *msg, int len); | ||
2335 | |||
2336 | #define reiserfs_set_le_bit __set_bit_le | ||
2337 | #define reiserfs_test_and_set_le_bit __test_and_set_bit_le | ||
2338 | #define reiserfs_clear_le_bit __clear_bit_le | ||
2339 | #define reiserfs_test_and_clear_le_bit __test_and_clear_bit_le | ||
2340 | #define reiserfs_test_le_bit test_bit_le | ||
2341 | #define reiserfs_find_next_zero_le_bit find_next_zero_bit_le | ||
2342 | |||
2343 | /* sometimes reiserfs_truncate may require to allocate few new blocks | ||
2344 | to perform indirect2direct conversion. People probably used to | ||
2345 | think, that truncate should work without problems on a filesystem | ||
2346 | without free disk space. They may complain that they can not | ||
2347 | truncate due to lack of free disk space. This spare space allows us | ||
2348 | to not worry about it. 500 is probably too much, but it should be | ||
2349 | absolutely safe */ | ||
2350 | #define SPARE_SPACE 500 | ||
2351 | |||
2352 | /* prototypes from ioctl.c */ | ||
2353 | long reiserfs_ioctl(struct file *filp, unsigned int cmd, unsigned long arg); | ||
2354 | long reiserfs_compat_ioctl(struct file *filp, | ||
2355 | unsigned int cmd, unsigned long arg); | ||
2356 | int reiserfs_unpack(struct inode *inode, struct file *filp); | ||
2357 | |||
2358 | #endif /* __KERNEL__ */ | ||
2359 | |||
2360 | #endif /* _LINUX_REISER_FS_H */ | 26 | #endif /* _LINUX_REISER_FS_H */ |
diff --git a/include/linux/reiserfs_fs_i.h b/include/linux/reiserfs_fs_i.h deleted file mode 100644 index 97959bdfe214..000000000000 --- a/include/linux/reiserfs_fs_i.h +++ /dev/null | |||
@@ -1,63 +0,0 @@ | |||
1 | #ifndef _REISER_FS_I | ||
2 | #define _REISER_FS_I | ||
3 | |||
4 | #include <linux/list.h> | ||
5 | |||
6 | struct reiserfs_journal_list; | ||
7 | |||
8 | /** bitmasks for i_flags field in reiserfs-specific part of inode */ | ||
9 | typedef enum { | ||
10 | /** this says what format of key do all items (but stat data) of | ||
11 | an object have. If this is set, that format is 3.6 otherwise | ||
12 | - 3.5 */ | ||
13 | i_item_key_version_mask = 0x0001, | ||
14 | /** If this is unset, object has 3.5 stat data, otherwise, it has | ||
15 | 3.6 stat data with 64bit size, 32bit nlink etc. */ | ||
16 | i_stat_data_version_mask = 0x0002, | ||
17 | /** file might need tail packing on close */ | ||
18 | i_pack_on_close_mask = 0x0004, | ||
19 | /** don't pack tail of file */ | ||
20 | i_nopack_mask = 0x0008, | ||
21 | /** If those is set, "safe link" was created for this file during | ||
22 | truncate or unlink. Safe link is used to avoid leakage of disk | ||
23 | space on crash with some files open, but unlinked. */ | ||
24 | i_link_saved_unlink_mask = 0x0010, | ||
25 | i_link_saved_truncate_mask = 0x0020, | ||
26 | i_has_xattr_dir = 0x0040, | ||
27 | i_data_log = 0x0080, | ||
28 | } reiserfs_inode_flags; | ||
29 | |||
30 | struct reiserfs_inode_info { | ||
31 | __u32 i_key[4]; /* key is still 4 32 bit integers */ | ||
32 | /** transient inode flags that are never stored on disk. Bitmasks | ||
33 | for this field are defined above. */ | ||
34 | __u32 i_flags; | ||
35 | |||
36 | __u32 i_first_direct_byte; // offset of first byte stored in direct item. | ||
37 | |||
38 | /* copy of persistent inode flags read from sd_attrs. */ | ||
39 | __u32 i_attrs; | ||
40 | |||
41 | int i_prealloc_block; /* first unused block of a sequence of unused blocks */ | ||
42 | int i_prealloc_count; /* length of that sequence */ | ||
43 | struct list_head i_prealloc_list; /* per-transaction list of inodes which | ||
44 | * have preallocated blocks */ | ||
45 | |||
46 | unsigned new_packing_locality:1; /* new_packig_locality is created; new blocks | ||
47 | * for the contents of this directory should be | ||
48 | * displaced */ | ||
49 | |||
50 | /* we use these for fsync or O_SYNC to decide which transaction | ||
51 | ** needs to be committed in order for this inode to be properly | ||
52 | ** flushed */ | ||
53 | unsigned int i_trans_id; | ||
54 | struct reiserfs_journal_list *i_jl; | ||
55 | atomic_t openers; | ||
56 | struct mutex tailpack; | ||
57 | #ifdef CONFIG_REISERFS_FS_XATTR | ||
58 | struct rw_semaphore i_xattr_sem; | ||
59 | #endif | ||
60 | struct inode vfs_inode; | ||
61 | }; | ||
62 | |||
63 | #endif | ||
diff --git a/include/linux/reiserfs_fs_sb.h b/include/linux/reiserfs_fs_sb.h deleted file mode 100644 index 8c9e85c64b46..000000000000 --- a/include/linux/reiserfs_fs_sb.h +++ /dev/null | |||
@@ -1,554 +0,0 @@ | |||
1 | /* Copyright 1996-2000 Hans Reiser, see reiserfs/README for licensing | ||
2 | * and copyright details */ | ||
3 | |||
4 | #ifndef _LINUX_REISER_FS_SB | ||
5 | #define _LINUX_REISER_FS_SB | ||
6 | |||
7 | #ifdef __KERNEL__ | ||
8 | #include <linux/workqueue.h> | ||
9 | #include <linux/rwsem.h> | ||
10 | #include <linux/mutex.h> | ||
11 | #include <linux/sched.h> | ||
12 | #endif | ||
13 | |||
14 | typedef enum { | ||
15 | reiserfs_attrs_cleared = 0x00000001, | ||
16 | } reiserfs_super_block_flags; | ||
17 | |||
18 | /* struct reiserfs_super_block accessors/mutators | ||
19 | * since this is a disk structure, it will always be in | ||
20 | * little endian format. */ | ||
21 | #define sb_block_count(sbp) (le32_to_cpu((sbp)->s_v1.s_block_count)) | ||
22 | #define set_sb_block_count(sbp,v) ((sbp)->s_v1.s_block_count = cpu_to_le32(v)) | ||
23 | #define sb_free_blocks(sbp) (le32_to_cpu((sbp)->s_v1.s_free_blocks)) | ||
24 | #define set_sb_free_blocks(sbp,v) ((sbp)->s_v1.s_free_blocks = cpu_to_le32(v)) | ||
25 | #define sb_root_block(sbp) (le32_to_cpu((sbp)->s_v1.s_root_block)) | ||
26 | #define set_sb_root_block(sbp,v) ((sbp)->s_v1.s_root_block = cpu_to_le32(v)) | ||
27 | |||
28 | #define sb_jp_journal_1st_block(sbp) \ | ||
29 | (le32_to_cpu((sbp)->s_v1.s_journal.jp_journal_1st_block)) | ||
30 | #define set_sb_jp_journal_1st_block(sbp,v) \ | ||
31 | ((sbp)->s_v1.s_journal.jp_journal_1st_block = cpu_to_le32(v)) | ||
32 | #define sb_jp_journal_dev(sbp) \ | ||
33 | (le32_to_cpu((sbp)->s_v1.s_journal.jp_journal_dev)) | ||
34 | #define set_sb_jp_journal_dev(sbp,v) \ | ||
35 | ((sbp)->s_v1.s_journal.jp_journal_dev = cpu_to_le32(v)) | ||
36 | #define sb_jp_journal_size(sbp) \ | ||
37 | (le32_to_cpu((sbp)->s_v1.s_journal.jp_journal_size)) | ||
38 | #define set_sb_jp_journal_size(sbp,v) \ | ||
39 | ((sbp)->s_v1.s_journal.jp_journal_size = cpu_to_le32(v)) | ||
40 | #define sb_jp_journal_trans_max(sbp) \ | ||
41 | (le32_to_cpu((sbp)->s_v1.s_journal.jp_journal_trans_max)) | ||
42 | #define set_sb_jp_journal_trans_max(sbp,v) \ | ||
43 | ((sbp)->s_v1.s_journal.jp_journal_trans_max = cpu_to_le32(v)) | ||
44 | #define sb_jp_journal_magic(sbp) \ | ||
45 | (le32_to_cpu((sbp)->s_v1.s_journal.jp_journal_magic)) | ||
46 | #define set_sb_jp_journal_magic(sbp,v) \ | ||
47 | ((sbp)->s_v1.s_journal.jp_journal_magic = cpu_to_le32(v)) | ||
48 | #define sb_jp_journal_max_batch(sbp) \ | ||
49 | (le32_to_cpu((sbp)->s_v1.s_journal.jp_journal_max_batch)) | ||
50 | #define set_sb_jp_journal_max_batch(sbp,v) \ | ||
51 | ((sbp)->s_v1.s_journal.jp_journal_max_batch = cpu_to_le32(v)) | ||
52 | #define sb_jp_jourmal_max_commit_age(sbp) \ | ||
53 | (le32_to_cpu((sbp)->s_v1.s_journal.jp_journal_max_commit_age)) | ||
54 | #define set_sb_jp_journal_max_commit_age(sbp,v) \ | ||
55 | ((sbp)->s_v1.s_journal.jp_journal_max_commit_age = cpu_to_le32(v)) | ||
56 | |||
57 | #define sb_blocksize(sbp) (le16_to_cpu((sbp)->s_v1.s_blocksize)) | ||
58 | #define set_sb_blocksize(sbp,v) ((sbp)->s_v1.s_blocksize = cpu_to_le16(v)) | ||
59 | #define sb_oid_maxsize(sbp) (le16_to_cpu((sbp)->s_v1.s_oid_maxsize)) | ||
60 | #define set_sb_oid_maxsize(sbp,v) ((sbp)->s_v1.s_oid_maxsize = cpu_to_le16(v)) | ||
61 | #define sb_oid_cursize(sbp) (le16_to_cpu((sbp)->s_v1.s_oid_cursize)) | ||
62 | #define set_sb_oid_cursize(sbp,v) ((sbp)->s_v1.s_oid_cursize = cpu_to_le16(v)) | ||
63 | #define sb_umount_state(sbp) (le16_to_cpu((sbp)->s_v1.s_umount_state)) | ||
64 | #define set_sb_umount_state(sbp,v) ((sbp)->s_v1.s_umount_state = cpu_to_le16(v)) | ||
65 | #define sb_fs_state(sbp) (le16_to_cpu((sbp)->s_v1.s_fs_state)) | ||
66 | #define set_sb_fs_state(sbp,v) ((sbp)->s_v1.s_fs_state = cpu_to_le16(v)) | ||
67 | #define sb_hash_function_code(sbp) \ | ||
68 | (le32_to_cpu((sbp)->s_v1.s_hash_function_code)) | ||
69 | #define set_sb_hash_function_code(sbp,v) \ | ||
70 | ((sbp)->s_v1.s_hash_function_code = cpu_to_le32(v)) | ||
71 | #define sb_tree_height(sbp) (le16_to_cpu((sbp)->s_v1.s_tree_height)) | ||
72 | #define set_sb_tree_height(sbp,v) ((sbp)->s_v1.s_tree_height = cpu_to_le16(v)) | ||
73 | #define sb_bmap_nr(sbp) (le16_to_cpu((sbp)->s_v1.s_bmap_nr)) | ||
74 | #define set_sb_bmap_nr(sbp,v) ((sbp)->s_v1.s_bmap_nr = cpu_to_le16(v)) | ||
75 | #define sb_version(sbp) (le16_to_cpu((sbp)->s_v1.s_version)) | ||
76 | #define set_sb_version(sbp,v) ((sbp)->s_v1.s_version = cpu_to_le16(v)) | ||
77 | |||
78 | #define sb_mnt_count(sbp) (le16_to_cpu((sbp)->s_mnt_count)) | ||
79 | #define set_sb_mnt_count(sbp, v) ((sbp)->s_mnt_count = cpu_to_le16(v)) | ||
80 | |||
81 | #define sb_reserved_for_journal(sbp) \ | ||
82 | (le16_to_cpu((sbp)->s_v1.s_reserved_for_journal)) | ||
83 | #define set_sb_reserved_for_journal(sbp,v) \ | ||
84 | ((sbp)->s_v1.s_reserved_for_journal = cpu_to_le16(v)) | ||
85 | |||
86 | /* LOGGING -- */ | ||
87 | |||
88 | /* These all interelate for performance. | ||
89 | ** | ||
90 | ** If the journal block count is smaller than n transactions, you lose speed. | ||
91 | ** I don't know what n is yet, I'm guessing 8-16. | ||
92 | ** | ||
93 | ** typical transaction size depends on the application, how often fsync is | ||
94 | ** called, and how many metadata blocks you dirty in a 30 second period. | ||
95 | ** The more small files (<16k) you use, the larger your transactions will | ||
96 | ** be. | ||
97 | ** | ||
98 | ** If your journal fills faster than dirty buffers get flushed to disk, it must flush them before allowing the journal | ||
99 | ** to wrap, which slows things down. If you need high speed meta data updates, the journal should be big enough | ||
100 | ** to prevent wrapping before dirty meta blocks get to disk. | ||
101 | ** | ||
102 | ** If the batch max is smaller than the transaction max, you'll waste space at the end of the journal | ||
103 | ** because journal_end sets the next transaction to start at 0 if the next transaction has any chance of wrapping. | ||
104 | ** | ||
105 | ** The large the batch max age, the better the speed, and the more meta data changes you'll lose after a crash. | ||
106 | ** | ||
107 | */ | ||
108 | |||
109 | /* don't mess with these for a while */ | ||
110 | /* we have a node size define somewhere in reiserfs_fs.h. -Hans */ | ||
111 | #define JOURNAL_BLOCK_SIZE 4096 /* BUG gotta get rid of this */ | ||
112 | #define JOURNAL_MAX_CNODE 1500 /* max cnodes to allocate. */ | ||
113 | #define JOURNAL_HASH_SIZE 8192 | ||
114 | #define JOURNAL_NUM_BITMAPS 5 /* number of copies of the bitmaps to have floating. Must be >= 2 */ | ||
115 | |||
116 | /* One of these for every block in every transaction | ||
117 | ** Each one is in two hash tables. First, a hash of the current transaction, and after journal_end, a | ||
118 | ** hash of all the in memory transactions. | ||
119 | ** next and prev are used by the current transaction (journal_hash). | ||
120 | ** hnext and hprev are used by journal_list_hash. If a block is in more than one transaction, the journal_list_hash | ||
121 | ** links it in multiple times. This allows flush_journal_list to remove just the cnode belonging | ||
122 | ** to a given transaction. | ||
123 | */ | ||
124 | struct reiserfs_journal_cnode { | ||
125 | struct buffer_head *bh; /* real buffer head */ | ||
126 | struct super_block *sb; /* dev of real buffer head */ | ||
127 | __u32 blocknr; /* block number of real buffer head, == 0 when buffer on disk */ | ||
128 | unsigned long state; | ||
129 | struct reiserfs_journal_list *jlist; /* journal list this cnode lives in */ | ||
130 | struct reiserfs_journal_cnode *next; /* next in transaction list */ | ||
131 | struct reiserfs_journal_cnode *prev; /* prev in transaction list */ | ||
132 | struct reiserfs_journal_cnode *hprev; /* prev in hash list */ | ||
133 | struct reiserfs_journal_cnode *hnext; /* next in hash list */ | ||
134 | }; | ||
135 | |||
136 | struct reiserfs_bitmap_node { | ||
137 | int id; | ||
138 | char *data; | ||
139 | struct list_head list; | ||
140 | }; | ||
141 | |||
142 | struct reiserfs_list_bitmap { | ||
143 | struct reiserfs_journal_list *journal_list; | ||
144 | struct reiserfs_bitmap_node **bitmaps; | ||
145 | }; | ||
146 | |||
147 | /* | ||
148 | ** one of these for each transaction. The most important part here is the j_realblock. | ||
149 | ** this list of cnodes is used to hash all the blocks in all the commits, to mark all the | ||
150 | ** real buffer heads dirty once all the commits hit the disk, | ||
151 | ** and to make sure every real block in a transaction is on disk before allowing the log area | ||
152 | ** to be overwritten */ | ||
153 | struct reiserfs_journal_list { | ||
154 | unsigned long j_start; | ||
155 | unsigned long j_state; | ||
156 | unsigned long j_len; | ||
157 | atomic_t j_nonzerolen; | ||
158 | atomic_t j_commit_left; | ||
159 | atomic_t j_older_commits_done; /* all commits older than this on disk */ | ||
160 | struct mutex j_commit_mutex; | ||
161 | unsigned int j_trans_id; | ||
162 | time_t j_timestamp; | ||
163 | struct reiserfs_list_bitmap *j_list_bitmap; | ||
164 | struct buffer_head *j_commit_bh; /* commit buffer head */ | ||
165 | struct reiserfs_journal_cnode *j_realblock; | ||
166 | struct reiserfs_journal_cnode *j_freedlist; /* list of buffers that were freed during this trans. free each of these on flush */ | ||
167 | /* time ordered list of all active transactions */ | ||
168 | struct list_head j_list; | ||
169 | |||
170 | /* time ordered list of all transactions we haven't tried to flush yet */ | ||
171 | struct list_head j_working_list; | ||
172 | |||
173 | /* list of tail conversion targets in need of flush before commit */ | ||
174 | struct list_head j_tail_bh_list; | ||
175 | /* list of data=ordered buffers in need of flush before commit */ | ||
176 | struct list_head j_bh_list; | ||
177 | int j_refcount; | ||
178 | }; | ||
179 | |||
180 | struct reiserfs_journal { | ||
181 | struct buffer_head **j_ap_blocks; /* journal blocks on disk */ | ||
182 | struct reiserfs_journal_cnode *j_last; /* newest journal block */ | ||
183 | struct reiserfs_journal_cnode *j_first; /* oldest journal block. start here for traverse */ | ||
184 | |||
185 | struct block_device *j_dev_bd; | ||
186 | fmode_t j_dev_mode; | ||
187 | int j_1st_reserved_block; /* first block on s_dev of reserved area journal */ | ||
188 | |||
189 | unsigned long j_state; | ||
190 | unsigned int j_trans_id; | ||
191 | unsigned long j_mount_id; | ||
192 | unsigned long j_start; /* start of current waiting commit (index into j_ap_blocks) */ | ||
193 | unsigned long j_len; /* length of current waiting commit */ | ||
194 | unsigned long j_len_alloc; /* number of buffers requested by journal_begin() */ | ||
195 | atomic_t j_wcount; /* count of writers for current commit */ | ||
196 | unsigned long j_bcount; /* batch count. allows turning X transactions into 1 */ | ||
197 | unsigned long j_first_unflushed_offset; /* first unflushed transactions offset */ | ||
198 | unsigned j_last_flush_trans_id; /* last fully flushed journal timestamp */ | ||
199 | struct buffer_head *j_header_bh; | ||
200 | |||
201 | time_t j_trans_start_time; /* time this transaction started */ | ||
202 | struct mutex j_mutex; | ||
203 | struct mutex j_flush_mutex; | ||
204 | wait_queue_head_t j_join_wait; /* wait for current transaction to finish before starting new one */ | ||
205 | atomic_t j_jlock; /* lock for j_join_wait */ | ||
206 | int j_list_bitmap_index; /* number of next list bitmap to use */ | ||
207 | int j_must_wait; /* no more journal begins allowed. MUST sleep on j_join_wait */ | ||
208 | int j_next_full_flush; /* next journal_end will flush all journal list */ | ||
209 | int j_next_async_flush; /* next journal_end will flush all async commits */ | ||
210 | |||
211 | int j_cnode_used; /* number of cnodes on the used list */ | ||
212 | int j_cnode_free; /* number of cnodes on the free list */ | ||
213 | |||
214 | unsigned int j_trans_max; /* max number of blocks in a transaction. */ | ||
215 | unsigned int j_max_batch; /* max number of blocks to batch into a trans */ | ||
216 | unsigned int j_max_commit_age; /* in seconds, how old can an async commit be */ | ||
217 | unsigned int j_max_trans_age; /* in seconds, how old can a transaction be */ | ||
218 | unsigned int j_default_max_commit_age; /* the default for the max commit age */ | ||
219 | |||
220 | struct reiserfs_journal_cnode *j_cnode_free_list; | ||
221 | struct reiserfs_journal_cnode *j_cnode_free_orig; /* orig pointer returned from vmalloc */ | ||
222 | |||
223 | struct reiserfs_journal_list *j_current_jl; | ||
224 | int j_free_bitmap_nodes; | ||
225 | int j_used_bitmap_nodes; | ||
226 | |||
227 | int j_num_lists; /* total number of active transactions */ | ||
228 | int j_num_work_lists; /* number that need attention from kreiserfsd */ | ||
229 | |||
230 | /* debugging to make sure things are flushed in order */ | ||
231 | unsigned int j_last_flush_id; | ||
232 | |||
233 | /* debugging to make sure things are committed in order */ | ||
234 | unsigned int j_last_commit_id; | ||
235 | |||
236 | struct list_head j_bitmap_nodes; | ||
237 | struct list_head j_dirty_buffers; | ||
238 | spinlock_t j_dirty_buffers_lock; /* protects j_dirty_buffers */ | ||
239 | |||
240 | /* list of all active transactions */ | ||
241 | struct list_head j_journal_list; | ||
242 | /* lists that haven't been touched by writeback attempts */ | ||
243 | struct list_head j_working_list; | ||
244 | |||
245 | struct reiserfs_list_bitmap j_list_bitmap[JOURNAL_NUM_BITMAPS]; /* array of bitmaps to record the deleted blocks */ | ||
246 | struct reiserfs_journal_cnode *j_hash_table[JOURNAL_HASH_SIZE]; /* hash table for real buffer heads in current trans */ | ||
247 | struct reiserfs_journal_cnode *j_list_hash_table[JOURNAL_HASH_SIZE]; /* hash table for all the real buffer heads in all | ||
248 | the transactions */ | ||
249 | struct list_head j_prealloc_list; /* list of inodes which have preallocated blocks */ | ||
250 | int j_persistent_trans; | ||
251 | unsigned long j_max_trans_size; | ||
252 | unsigned long j_max_batch_size; | ||
253 | |||
254 | int j_errno; | ||
255 | |||
256 | /* when flushing ordered buffers, throttle new ordered writers */ | ||
257 | struct delayed_work j_work; | ||
258 | struct super_block *j_work_sb; | ||
259 | atomic_t j_async_throttle; | ||
260 | }; | ||
261 | |||
262 | enum journal_state_bits { | ||
263 | J_WRITERS_BLOCKED = 1, /* set when new writers not allowed */ | ||
264 | J_WRITERS_QUEUED, /* set when log is full due to too many writers */ | ||
265 | J_ABORTED, /* set when log is aborted */ | ||
266 | }; | ||
267 | |||
268 | #define JOURNAL_DESC_MAGIC "ReIsErLB" /* ick. magic string to find desc blocks in the journal */ | ||
269 | |||
270 | typedef __u32(*hashf_t) (const signed char *, int); | ||
271 | |||
272 | struct reiserfs_bitmap_info { | ||
273 | __u32 free_count; | ||
274 | }; | ||
275 | |||
276 | struct proc_dir_entry; | ||
277 | |||
278 | #if defined( CONFIG_PROC_FS ) && defined( CONFIG_REISERFS_PROC_INFO ) | ||
279 | typedef unsigned long int stat_cnt_t; | ||
280 | typedef struct reiserfs_proc_info_data { | ||
281 | spinlock_t lock; | ||
282 | int exiting; | ||
283 | int max_hash_collisions; | ||
284 | |||
285 | stat_cnt_t breads; | ||
286 | stat_cnt_t bread_miss; | ||
287 | stat_cnt_t search_by_key; | ||
288 | stat_cnt_t search_by_key_fs_changed; | ||
289 | stat_cnt_t search_by_key_restarted; | ||
290 | |||
291 | stat_cnt_t insert_item_restarted; | ||
292 | stat_cnt_t paste_into_item_restarted; | ||
293 | stat_cnt_t cut_from_item_restarted; | ||
294 | stat_cnt_t delete_solid_item_restarted; | ||
295 | stat_cnt_t delete_item_restarted; | ||
296 | |||
297 | stat_cnt_t leaked_oid; | ||
298 | stat_cnt_t leaves_removable; | ||
299 | |||
300 | /* balances per level. Use explicit 5 as MAX_HEIGHT is not visible yet. */ | ||
301 | stat_cnt_t balance_at[5]; /* XXX */ | ||
302 | /* sbk == search_by_key */ | ||
303 | stat_cnt_t sbk_read_at[5]; /* XXX */ | ||
304 | stat_cnt_t sbk_fs_changed[5]; | ||
305 | stat_cnt_t sbk_restarted[5]; | ||
306 | stat_cnt_t items_at[5]; /* XXX */ | ||
307 | stat_cnt_t free_at[5]; /* XXX */ | ||
308 | stat_cnt_t can_node_be_removed[5]; /* XXX */ | ||
309 | long int lnum[5]; /* XXX */ | ||
310 | long int rnum[5]; /* XXX */ | ||
311 | long int lbytes[5]; /* XXX */ | ||
312 | long int rbytes[5]; /* XXX */ | ||
313 | stat_cnt_t get_neighbors[5]; | ||
314 | stat_cnt_t get_neighbors_restart[5]; | ||
315 | stat_cnt_t need_l_neighbor[5]; | ||
316 | stat_cnt_t need_r_neighbor[5]; | ||
317 | |||
318 | stat_cnt_t free_block; | ||
319 | struct __scan_bitmap_stats { | ||
320 | stat_cnt_t call; | ||
321 | stat_cnt_t wait; | ||
322 | stat_cnt_t bmap; | ||
323 | stat_cnt_t retry; | ||
324 | stat_cnt_t in_journal_hint; | ||
325 | stat_cnt_t in_journal_nohint; | ||
326 | stat_cnt_t stolen; | ||
327 | } scan_bitmap; | ||
328 | struct __journal_stats { | ||
329 | stat_cnt_t in_journal; | ||
330 | stat_cnt_t in_journal_bitmap; | ||
331 | stat_cnt_t in_journal_reusable; | ||
332 | stat_cnt_t lock_journal; | ||
333 | stat_cnt_t lock_journal_wait; | ||
334 | stat_cnt_t journal_being; | ||
335 | stat_cnt_t journal_relock_writers; | ||
336 | stat_cnt_t journal_relock_wcount; | ||
337 | stat_cnt_t mark_dirty; | ||
338 | stat_cnt_t mark_dirty_already; | ||
339 | stat_cnt_t mark_dirty_notjournal; | ||
340 | stat_cnt_t restore_prepared; | ||
341 | stat_cnt_t prepare; | ||
342 | stat_cnt_t prepare_retry; | ||
343 | } journal; | ||
344 | } reiserfs_proc_info_data_t; | ||
345 | #else | ||
346 | typedef struct reiserfs_proc_info_data { | ||
347 | } reiserfs_proc_info_data_t; | ||
348 | #endif | ||
349 | |||
350 | /* reiserfs union of in-core super block data */ | ||
351 | struct reiserfs_sb_info { | ||
352 | struct buffer_head *s_sbh; /* Buffer containing the super block */ | ||
353 | /* both the comment and the choice of | ||
354 | name are unclear for s_rs -Hans */ | ||
355 | struct reiserfs_super_block *s_rs; /* Pointer to the super block in the buffer */ | ||
356 | struct reiserfs_bitmap_info *s_ap_bitmap; | ||
357 | struct reiserfs_journal *s_journal; /* pointer to journal information */ | ||
358 | unsigned short s_mount_state; /* reiserfs state (valid, invalid) */ | ||
359 | |||
360 | /* Serialize writers access, replace the old bkl */ | ||
361 | struct mutex lock; | ||
362 | /* Owner of the lock (can be recursive) */ | ||
363 | struct task_struct *lock_owner; | ||
364 | /* Depth of the lock, start from -1 like the bkl */ | ||
365 | int lock_depth; | ||
366 | |||
367 | /* Comment? -Hans */ | ||
368 | void (*end_io_handler) (struct buffer_head *, int); | ||
369 | hashf_t s_hash_function; /* pointer to function which is used | ||
370 | to sort names in directory. Set on | ||
371 | mount */ | ||
372 | unsigned long s_mount_opt; /* reiserfs's mount options are set | ||
373 | here (currently - NOTAIL, NOLOG, | ||
374 | REPLAYONLY) */ | ||
375 | |||
376 | struct { /* This is a structure that describes block allocator options */ | ||
377 | unsigned long bits; /* Bitfield for enable/disable kind of options */ | ||
378 | unsigned long large_file_size; /* size started from which we consider file to be a large one(in blocks) */ | ||
379 | int border; /* percentage of disk, border takes */ | ||
380 | int preallocmin; /* Minimal file size (in blocks) starting from which we do preallocations */ | ||
381 | int preallocsize; /* Number of blocks we try to prealloc when file | ||
382 | reaches preallocmin size (in blocks) or | ||
383 | prealloc_list is empty. */ | ||
384 | } s_alloc_options; | ||
385 | |||
386 | /* Comment? -Hans */ | ||
387 | wait_queue_head_t s_wait; | ||
388 | /* To be obsoleted soon by per buffer seals.. -Hans */ | ||
389 | atomic_t s_generation_counter; // increased by one every time the | ||
390 | // tree gets re-balanced | ||
391 | unsigned long s_properties; /* File system properties. Currently holds | ||
392 | on-disk FS format */ | ||
393 | |||
394 | /* session statistics */ | ||
395 | int s_disk_reads; | ||
396 | int s_disk_writes; | ||
397 | int s_fix_nodes; | ||
398 | int s_do_balance; | ||
399 | int s_unneeded_left_neighbor; | ||
400 | int s_good_search_by_key_reada; | ||
401 | int s_bmaps; | ||
402 | int s_bmaps_without_search; | ||
403 | int s_direct2indirect; | ||
404 | int s_indirect2direct; | ||
405 | /* set up when it's ok for reiserfs_read_inode2() to read from | ||
406 | disk inode with nlink==0. Currently this is only used during | ||
407 | finish_unfinished() processing at mount time */ | ||
408 | int s_is_unlinked_ok; | ||
409 | reiserfs_proc_info_data_t s_proc_info_data; | ||
410 | struct proc_dir_entry *procdir; | ||
411 | int reserved_blocks; /* amount of blocks reserved for further allocations */ | ||
412 | spinlock_t bitmap_lock; /* this lock on now only used to protect reserved_blocks variable */ | ||
413 | struct dentry *priv_root; /* root of /.reiserfs_priv */ | ||
414 | struct dentry *xattr_root; /* root of /.reiserfs_priv/xattrs */ | ||
415 | int j_errno; | ||
416 | #ifdef CONFIG_QUOTA | ||
417 | char *s_qf_names[MAXQUOTAS]; | ||
418 | int s_jquota_fmt; | ||
419 | #endif | ||
420 | char *s_jdev; /* Stored jdev for mount option showing */ | ||
421 | #ifdef CONFIG_REISERFS_CHECK | ||
422 | |||
423 | struct tree_balance *cur_tb; /* | ||
424 | * Detects whether more than one | ||
425 | * copy of tb exists per superblock | ||
426 | * as a means of checking whether | ||
427 | * do_balance is executing concurrently | ||
428 | * against another tree reader/writer | ||
429 | * on a same mount point. | ||
430 | */ | ||
431 | #endif | ||
432 | }; | ||
433 | |||
434 | /* Definitions of reiserfs on-disk properties: */ | ||
435 | #define REISERFS_3_5 0 | ||
436 | #define REISERFS_3_6 1 | ||
437 | #define REISERFS_OLD_FORMAT 2 | ||
438 | |||
439 | enum reiserfs_mount_options { | ||
440 | /* Mount options */ | ||
441 | REISERFS_LARGETAIL, /* large tails will be created in a session */ | ||
442 | REISERFS_SMALLTAIL, /* small (for files less than block size) tails will be created in a session */ | ||
443 | REPLAYONLY, /* replay journal and return 0. Use by fsck */ | ||
444 | REISERFS_CONVERT, /* -o conv: causes conversion of old | ||
445 | format super block to the new | ||
446 | format. If not specified - old | ||
447 | partition will be dealt with in a | ||
448 | manner of 3.5.x */ | ||
449 | |||
450 | /* -o hash={tea, rupasov, r5, detect} is meant for properly mounting | ||
451 | ** reiserfs disks from 3.5.19 or earlier. 99% of the time, this option | ||
452 | ** is not required. If the normal autodection code can't determine which | ||
453 | ** hash to use (because both hashes had the same value for a file) | ||
454 | ** use this option to force a specific hash. It won't allow you to override | ||
455 | ** the existing hash on the FS, so if you have a tea hash disk, and mount | ||
456 | ** with -o hash=rupasov, the mount will fail. | ||
457 | */ | ||
458 | FORCE_TEA_HASH, /* try to force tea hash on mount */ | ||
459 | FORCE_RUPASOV_HASH, /* try to force rupasov hash on mount */ | ||
460 | FORCE_R5_HASH, /* try to force rupasov hash on mount */ | ||
461 | FORCE_HASH_DETECT, /* try to detect hash function on mount */ | ||
462 | |||
463 | REISERFS_DATA_LOG, | ||
464 | REISERFS_DATA_ORDERED, | ||
465 | REISERFS_DATA_WRITEBACK, | ||
466 | |||
467 | /* used for testing experimental features, makes benchmarking new | ||
468 | features with and without more convenient, should never be used by | ||
469 | users in any code shipped to users (ideally) */ | ||
470 | |||
471 | REISERFS_NO_BORDER, | ||
472 | REISERFS_NO_UNHASHED_RELOCATION, | ||
473 | REISERFS_HASHED_RELOCATION, | ||
474 | REISERFS_ATTRS, | ||
475 | REISERFS_XATTRS_USER, | ||
476 | REISERFS_POSIXACL, | ||
477 | REISERFS_EXPOSE_PRIVROOT, | ||
478 | REISERFS_BARRIER_NONE, | ||
479 | REISERFS_BARRIER_FLUSH, | ||
480 | |||
481 | /* Actions on error */ | ||
482 | REISERFS_ERROR_PANIC, | ||
483 | REISERFS_ERROR_RO, | ||
484 | REISERFS_ERROR_CONTINUE, | ||
485 | |||
486 | REISERFS_USRQUOTA, /* User quota option specified */ | ||
487 | REISERFS_GRPQUOTA, /* Group quota option specified */ | ||
488 | |||
489 | REISERFS_TEST1, | ||
490 | REISERFS_TEST2, | ||
491 | REISERFS_TEST3, | ||
492 | REISERFS_TEST4, | ||
493 | REISERFS_UNSUPPORTED_OPT, | ||
494 | }; | ||
495 | |||
496 | #define reiserfs_r5_hash(s) (REISERFS_SB(s)->s_mount_opt & (1 << FORCE_R5_HASH)) | ||
497 | #define reiserfs_rupasov_hash(s) (REISERFS_SB(s)->s_mount_opt & (1 << FORCE_RUPASOV_HASH)) | ||
498 | #define reiserfs_tea_hash(s) (REISERFS_SB(s)->s_mount_opt & (1 << FORCE_TEA_HASH)) | ||
499 | #define reiserfs_hash_detect(s) (REISERFS_SB(s)->s_mount_opt & (1 << FORCE_HASH_DETECT)) | ||
500 | #define reiserfs_no_border(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_NO_BORDER)) | ||
501 | #define reiserfs_no_unhashed_relocation(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_NO_UNHASHED_RELOCATION)) | ||
502 | #define reiserfs_hashed_relocation(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_HASHED_RELOCATION)) | ||
503 | #define reiserfs_test4(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_TEST4)) | ||
504 | |||
505 | #define have_large_tails(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_LARGETAIL)) | ||
506 | #define have_small_tails(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_SMALLTAIL)) | ||
507 | #define replay_only(s) (REISERFS_SB(s)->s_mount_opt & (1 << REPLAYONLY)) | ||
508 | #define reiserfs_attrs(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_ATTRS)) | ||
509 | #define old_format_only(s) (REISERFS_SB(s)->s_properties & (1 << REISERFS_3_5)) | ||
510 | #define convert_reiserfs(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_CONVERT)) | ||
511 | #define reiserfs_data_log(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_DATA_LOG)) | ||
512 | #define reiserfs_data_ordered(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_DATA_ORDERED)) | ||
513 | #define reiserfs_data_writeback(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_DATA_WRITEBACK)) | ||
514 | #define reiserfs_xattrs_user(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_XATTRS_USER)) | ||
515 | #define reiserfs_posixacl(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_POSIXACL)) | ||
516 | #define reiserfs_expose_privroot(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_EXPOSE_PRIVROOT)) | ||
517 | #define reiserfs_xattrs_optional(s) (reiserfs_xattrs_user(s) || reiserfs_posixacl(s)) | ||
518 | #define reiserfs_barrier_none(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_BARRIER_NONE)) | ||
519 | #define reiserfs_barrier_flush(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_BARRIER_FLUSH)) | ||
520 | |||
521 | #define reiserfs_error_panic(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_ERROR_PANIC)) | ||
522 | #define reiserfs_error_ro(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_ERROR_RO)) | ||
523 | |||
524 | void reiserfs_file_buffer(struct buffer_head *bh, int list); | ||
525 | extern struct file_system_type reiserfs_fs_type; | ||
526 | int reiserfs_resize(struct super_block *, unsigned long); | ||
527 | |||
528 | #define CARRY_ON 0 | ||
529 | #define SCHEDULE_OCCURRED 1 | ||
530 | |||
531 | #define SB_BUFFER_WITH_SB(s) (REISERFS_SB(s)->s_sbh) | ||
532 | #define SB_JOURNAL(s) (REISERFS_SB(s)->s_journal) | ||
533 | #define SB_JOURNAL_1st_RESERVED_BLOCK(s) (SB_JOURNAL(s)->j_1st_reserved_block) | ||
534 | #define SB_JOURNAL_LEN_FREE(s) (SB_JOURNAL(s)->j_journal_len_free) | ||
535 | #define SB_AP_BITMAP(s) (REISERFS_SB(s)->s_ap_bitmap) | ||
536 | |||
537 | #define SB_DISK_JOURNAL_HEAD(s) (SB_JOURNAL(s)->j_header_bh->) | ||
538 | |||
539 | /* A safe version of the "bdevname", which returns the "s_id" field of | ||
540 | * a superblock or else "Null superblock" if the super block is NULL. | ||
541 | */ | ||
542 | static inline char *reiserfs_bdevname(struct super_block *s) | ||
543 | { | ||
544 | return (s == NULL) ? "Null superblock" : s->s_id; | ||
545 | } | ||
546 | |||
547 | #define reiserfs_is_journal_aborted(journal) (unlikely (__reiserfs_is_journal_aborted (journal))) | ||
548 | static inline int __reiserfs_is_journal_aborted(struct reiserfs_journal | ||
549 | *journal) | ||
550 | { | ||
551 | return test_bit(J_ABORTED, &journal->j_state); | ||
552 | } | ||
553 | |||
554 | #endif /* _LINUX_REISER_FS_SB */ | ||
diff --git a/include/linux/reiserfs_xattr.h b/include/linux/reiserfs_xattr.h index c2b71473266e..d8ce17c2459a 100644 --- a/include/linux/reiserfs_xattr.h +++ b/include/linux/reiserfs_xattr.h | |||
@@ -21,132 +21,4 @@ struct reiserfs_security_handle { | |||
21 | size_t length; | 21 | size_t length; |
22 | }; | 22 | }; |
23 | 23 | ||
24 | #ifdef __KERNEL__ | ||
25 | |||
26 | #include <linux/init.h> | ||
27 | #include <linux/list.h> | ||
28 | #include <linux/rwsem.h> | ||
29 | #include <linux/reiserfs_fs_i.h> | ||
30 | #include <linux/reiserfs_fs.h> | ||
31 | |||
32 | struct inode; | ||
33 | struct dentry; | ||
34 | struct iattr; | ||
35 | struct super_block; | ||
36 | struct nameidata; | ||
37 | |||
38 | int reiserfs_xattr_register_handlers(void) __init; | ||
39 | void reiserfs_xattr_unregister_handlers(void); | ||
40 | int reiserfs_xattr_init(struct super_block *sb, int mount_flags); | ||
41 | int reiserfs_lookup_privroot(struct super_block *sb); | ||
42 | int reiserfs_delete_xattrs(struct inode *inode); | ||
43 | int reiserfs_chown_xattrs(struct inode *inode, struct iattr *attrs); | ||
44 | int reiserfs_permission(struct inode *inode, int mask); | ||
45 | |||
46 | #ifdef CONFIG_REISERFS_FS_XATTR | ||
47 | #define has_xattr_dir(inode) (REISERFS_I(inode)->i_flags & i_has_xattr_dir) | ||
48 | ssize_t reiserfs_getxattr(struct dentry *dentry, const char *name, | ||
49 | void *buffer, size_t size); | ||
50 | int reiserfs_setxattr(struct dentry *dentry, const char *name, | ||
51 | const void *value, size_t size, int flags); | ||
52 | ssize_t reiserfs_listxattr(struct dentry *dentry, char *buffer, size_t size); | ||
53 | int reiserfs_removexattr(struct dentry *dentry, const char *name); | ||
54 | |||
55 | int reiserfs_xattr_get(struct inode *, const char *, void *, size_t); | ||
56 | int reiserfs_xattr_set(struct inode *, const char *, const void *, size_t, int); | ||
57 | int reiserfs_xattr_set_handle(struct reiserfs_transaction_handle *, | ||
58 | struct inode *, const char *, const void *, | ||
59 | size_t, int); | ||
60 | |||
61 | extern const struct xattr_handler reiserfs_xattr_user_handler; | ||
62 | extern const struct xattr_handler reiserfs_xattr_trusted_handler; | ||
63 | extern const struct xattr_handler reiserfs_xattr_security_handler; | ||
64 | #ifdef CONFIG_REISERFS_FS_SECURITY | ||
65 | int reiserfs_security_init(struct inode *dir, struct inode *inode, | ||
66 | const struct qstr *qstr, | ||
67 | struct reiserfs_security_handle *sec); | ||
68 | int reiserfs_security_write(struct reiserfs_transaction_handle *th, | ||
69 | struct inode *inode, | ||
70 | struct reiserfs_security_handle *sec); | ||
71 | void reiserfs_security_free(struct reiserfs_security_handle *sec); | ||
72 | #endif | ||
73 | |||
74 | static inline int reiserfs_xattrs_initialized(struct super_block *sb) | ||
75 | { | ||
76 | return REISERFS_SB(sb)->priv_root != NULL; | ||
77 | } | ||
78 | |||
79 | #define xattr_size(size) ((size) + sizeof(struct reiserfs_xattr_header)) | ||
80 | static inline loff_t reiserfs_xattr_nblocks(struct inode *inode, loff_t size) | ||
81 | { | ||
82 | loff_t ret = 0; | ||
83 | if (reiserfs_file_data_log(inode)) { | ||
84 | ret = _ROUND_UP(xattr_size(size), inode->i_sb->s_blocksize); | ||
85 | ret >>= inode->i_sb->s_blocksize_bits; | ||
86 | } | ||
87 | return ret; | ||
88 | } | ||
89 | |||
90 | /* We may have to create up to 3 objects: xattr root, xattr dir, xattr file. | ||
91 | * Let's try to be smart about it. | ||
92 | * xattr root: We cache it. If it's not cached, we may need to create it. | ||
93 | * xattr dir: If anything has been loaded for this inode, we can set a flag | ||
94 | * saying so. | ||
95 | * xattr file: Since we don't cache xattrs, we can't tell. We always include | ||
96 | * blocks for it. | ||
97 | * | ||
98 | * However, since root and dir can be created between calls - YOU MUST SAVE | ||
99 | * THIS VALUE. | ||
100 | */ | ||
101 | static inline size_t reiserfs_xattr_jcreate_nblocks(struct inode *inode) | ||
102 | { | ||
103 | size_t nblocks = JOURNAL_BLOCKS_PER_OBJECT(inode->i_sb); | ||
104 | |||
105 | if ((REISERFS_I(inode)->i_flags & i_has_xattr_dir) == 0) { | ||
106 | nblocks += JOURNAL_BLOCKS_PER_OBJECT(inode->i_sb); | ||
107 | if (!REISERFS_SB(inode->i_sb)->xattr_root->d_inode) | ||
108 | nblocks += JOURNAL_BLOCKS_PER_OBJECT(inode->i_sb); | ||
109 | } | ||
110 | |||
111 | return nblocks; | ||
112 | } | ||
113 | |||
114 | static inline void reiserfs_init_xattr_rwsem(struct inode *inode) | ||
115 | { | ||
116 | init_rwsem(&REISERFS_I(inode)->i_xattr_sem); | ||
117 | } | ||
118 | |||
119 | #else | ||
120 | |||
121 | #define reiserfs_getxattr NULL | ||
122 | #define reiserfs_setxattr NULL | ||
123 | #define reiserfs_listxattr NULL | ||
124 | #define reiserfs_removexattr NULL | ||
125 | |||
126 | static inline void reiserfs_init_xattr_rwsem(struct inode *inode) | ||
127 | { | ||
128 | } | ||
129 | #endif /* CONFIG_REISERFS_FS_XATTR */ | ||
130 | |||
131 | #ifndef CONFIG_REISERFS_FS_SECURITY | ||
132 | static inline int reiserfs_security_init(struct inode *dir, | ||
133 | struct inode *inode, | ||
134 | const struct qstr *qstr, | ||
135 | struct reiserfs_security_handle *sec) | ||
136 | { | ||
137 | return 0; | ||
138 | } | ||
139 | static inline int | ||
140 | reiserfs_security_write(struct reiserfs_transaction_handle *th, | ||
141 | struct inode *inode, | ||
142 | struct reiserfs_security_handle *sec) | ||
143 | { | ||
144 | return 0; | ||
145 | } | ||
146 | static inline void reiserfs_security_free(struct reiserfs_security_handle *sec) | ||
147 | {} | ||
148 | #endif | ||
149 | |||
150 | #endif /* __KERNEL__ */ | ||
151 | |||
152 | #endif /* _LINUX_REISERFS_XATTR_H */ | 24 | #endif /* _LINUX_REISERFS_XATTR_H */ |
diff --git a/include/linux/relay.h b/include/linux/relay.h index a822fd71fd64..91cacc34c159 100644 --- a/include/linux/relay.h +++ b/include/linux/relay.h | |||
@@ -15,6 +15,7 @@ | |||
15 | #include <linux/timer.h> | 15 | #include <linux/timer.h> |
16 | #include <linux/wait.h> | 16 | #include <linux/wait.h> |
17 | #include <linux/list.h> | 17 | #include <linux/list.h> |
18 | #include <linux/bug.h> | ||
18 | #include <linux/fs.h> | 19 | #include <linux/fs.h> |
19 | #include <linux/poll.h> | 20 | #include <linux/poll.h> |
20 | #include <linux/kref.h> | 21 | #include <linux/kref.h> |
diff --git a/include/linux/remoteproc.h b/include/linux/remoteproc.h new file mode 100644 index 000000000000..f1ffabb978d3 --- /dev/null +++ b/include/linux/remoteproc.h | |||
@@ -0,0 +1,478 @@ | |||
1 | /* | ||
2 | * Remote Processor Framework | ||
3 | * | ||
4 | * Copyright(c) 2011 Texas Instruments, Inc. | ||
5 | * Copyright(c) 2011 Google, Inc. | ||
6 | * All rights reserved. | ||
7 | * | ||
8 | * Redistribution and use in source and binary forms, with or without | ||
9 | * modification, are permitted provided that the following conditions | ||
10 | * are met: | ||
11 | * | ||
12 | * * Redistributions of source code must retain the above copyright | ||
13 | * notice, this list of conditions and the following disclaimer. | ||
14 | * * Redistributions in binary form must reproduce the above copyright | ||
15 | * notice, this list of conditions and the following disclaimer in | ||
16 | * the documentation and/or other materials provided with the | ||
17 | * distribution. | ||
18 | * * Neither the name Texas Instruments nor the names of its | ||
19 | * contributors may be used to endorse or promote products derived | ||
20 | * from this software without specific prior written permission. | ||
21 | * | ||
22 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
23 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
24 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | ||
25 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
26 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
27 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | ||
28 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
29 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | ||
30 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
31 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
32 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
33 | */ | ||
34 | |||
35 | #ifndef REMOTEPROC_H | ||
36 | #define REMOTEPROC_H | ||
37 | |||
38 | #include <linux/types.h> | ||
39 | #include <linux/kref.h> | ||
40 | #include <linux/klist.h> | ||
41 | #include <linux/mutex.h> | ||
42 | #include <linux/virtio.h> | ||
43 | #include <linux/completion.h> | ||
44 | #include <linux/idr.h> | ||
45 | |||
46 | /** | ||
47 | * struct resource_table - firmware resource table header | ||
48 | * @ver: version number | ||
49 | * @num: number of resource entries | ||
50 | * @reserved: reserved (must be zero) | ||
51 | * @offset: array of offsets pointing at the various resource entries | ||
52 | * | ||
53 | * A resource table is essentially a list of system resources required | ||
54 | * by the remote processor. It may also include configuration entries. | ||
55 | * If needed, the remote processor firmware should contain this table | ||
56 | * as a dedicated ".resource_table" ELF section. | ||
57 | * | ||
58 | * Some resources entries are mere announcements, where the host is informed | ||
59 | * of specific remoteproc configuration. Other entries require the host to | ||
60 | * do something (e.g. allocate a system resource). Sometimes a negotiation | ||
61 | * is expected, where the firmware requests a resource, and once allocated, | ||
62 | * the host should provide back its details (e.g. address of an allocated | ||
63 | * memory region). | ||
64 | * | ||
65 | * The header of the resource table, as expressed by this structure, | ||
66 | * contains a version number (should we need to change this format in the | ||
67 | * future), the number of available resource entries, and their offsets | ||
68 | * in the table. | ||
69 | * | ||
70 | * Immediately following this header are the resource entries themselves, | ||
71 | * each of which begins with a resource entry header (as described below). | ||
72 | */ | ||
73 | struct resource_table { | ||
74 | u32 ver; | ||
75 | u32 num; | ||
76 | u32 reserved[2]; | ||
77 | u32 offset[0]; | ||
78 | } __packed; | ||
79 | |||
80 | /** | ||
81 | * struct fw_rsc_hdr - firmware resource entry header | ||
82 | * @type: resource type | ||
83 | * @data: resource data | ||
84 | * | ||
85 | * Every resource entry begins with a 'struct fw_rsc_hdr' header providing | ||
86 | * its @type. The content of the entry itself will immediately follow | ||
87 | * this header, and it should be parsed according to the resource type. | ||
88 | */ | ||
89 | struct fw_rsc_hdr { | ||
90 | u32 type; | ||
91 | u8 data[0]; | ||
92 | } __packed; | ||
93 | |||
94 | /** | ||
95 | * enum fw_resource_type - types of resource entries | ||
96 | * | ||
97 | * @RSC_CARVEOUT: request for allocation of a physically contiguous | ||
98 | * memory region. | ||
99 | * @RSC_DEVMEM: request to iommu_map a memory-based peripheral. | ||
100 | * @RSC_TRACE: announces the availability of a trace buffer into which | ||
101 | * the remote processor will be writing logs. | ||
102 | * @RSC_VDEV: declare support for a virtio device, and serve as its | ||
103 | * virtio header. | ||
104 | * @RSC_LAST: just keep this one at the end | ||
105 | * | ||
106 | * For more details regarding a specific resource type, please see its | ||
107 | * dedicated structure below. | ||
108 | * | ||
109 | * Please note that these values are used as indices to the rproc_handle_rsc | ||
110 | * lookup table, so please keep them sane. Moreover, @RSC_LAST is used to | ||
111 | * check the validity of an index before the lookup table is accessed, so | ||
112 | * please update it as needed. | ||
113 | */ | ||
114 | enum fw_resource_type { | ||
115 | RSC_CARVEOUT = 0, | ||
116 | RSC_DEVMEM = 1, | ||
117 | RSC_TRACE = 2, | ||
118 | RSC_VDEV = 3, | ||
119 | RSC_LAST = 4, | ||
120 | }; | ||
121 | |||
122 | #define FW_RSC_ADDR_ANY (0xFFFFFFFFFFFFFFFF) | ||
123 | |||
124 | /** | ||
125 | * struct fw_rsc_carveout - physically contiguous memory request | ||
126 | * @da: device address | ||
127 | * @pa: physical address | ||
128 | * @len: length (in bytes) | ||
129 | * @flags: iommu protection flags | ||
130 | * @reserved: reserved (must be zero) | ||
131 | * @name: human-readable name of the requested memory region | ||
132 | * | ||
133 | * This resource entry requests the host to allocate a physically contiguous | ||
134 | * memory region. | ||
135 | * | ||
136 | * These request entries should precede other firmware resource entries, | ||
137 | * as other entries might request placing other data objects inside | ||
138 | * these memory regions (e.g. data/code segments, trace resource entries, ...). | ||
139 | * | ||
140 | * Allocating memory this way helps utilizing the reserved physical memory | ||
141 | * (e.g. CMA) more efficiently, and also minimizes the number of TLB entries | ||
142 | * needed to map it (in case @rproc is using an IOMMU). Reducing the TLB | ||
143 | * pressure is important; it may have a substantial impact on performance. | ||
144 | * | ||
145 | * If the firmware is compiled with static addresses, then @da should specify | ||
146 | * the expected device address of this memory region. If @da is set to | ||
147 | * FW_RSC_ADDR_ANY, then the host will dynamically allocate it, and then | ||
148 | * overwrite @da with the dynamically allocated address. | ||
149 | * | ||
150 | * We will always use @da to negotiate the device addresses, even if it | ||
151 | * isn't using an iommu. In that case, though, it will obviously contain | ||
152 | * physical addresses. | ||
153 | * | ||
154 | * Some remote processors needs to know the allocated physical address | ||
155 | * even if they do use an iommu. This is needed, e.g., if they control | ||
156 | * hardware accelerators which access the physical memory directly (this | ||
157 | * is the case with OMAP4 for instance). In that case, the host will | ||
158 | * overwrite @pa with the dynamically allocated physical address. | ||
159 | * Generally we don't want to expose physical addresses if we don't have to | ||
160 | * (remote processors are generally _not_ trusted), so we might want to | ||
161 | * change this to happen _only_ when explicitly required by the hardware. | ||
162 | * | ||
163 | * @flags is used to provide IOMMU protection flags, and @name should | ||
164 | * (optionally) contain a human readable name of this carveout region | ||
165 | * (mainly for debugging purposes). | ||
166 | */ | ||
167 | struct fw_rsc_carveout { | ||
168 | u32 da; | ||
169 | u32 pa; | ||
170 | u32 len; | ||
171 | u32 flags; | ||
172 | u32 reserved; | ||
173 | u8 name[32]; | ||
174 | } __packed; | ||
175 | |||
176 | /** | ||
177 | * struct fw_rsc_devmem - iommu mapping request | ||
178 | * @da: device address | ||
179 | * @pa: physical address | ||
180 | * @len: length (in bytes) | ||
181 | * @flags: iommu protection flags | ||
182 | * @reserved: reserved (must be zero) | ||
183 | * @name: human-readable name of the requested region to be mapped | ||
184 | * | ||
185 | * This resource entry requests the host to iommu map a physically contiguous | ||
186 | * memory region. This is needed in case the remote processor requires | ||
187 | * access to certain memory-based peripherals; _never_ use it to access | ||
188 | * regular memory. | ||
189 | * | ||
190 | * This is obviously only needed if the remote processor is accessing memory | ||
191 | * via an iommu. | ||
192 | * | ||
193 | * @da should specify the required device address, @pa should specify | ||
194 | * the physical address we want to map, @len should specify the size of | ||
195 | * the mapping and @flags is the IOMMU protection flags. As always, @name may | ||
196 | * (optionally) contain a human readable name of this mapping (mainly for | ||
197 | * debugging purposes). | ||
198 | * | ||
199 | * Note: at this point we just "trust" those devmem entries to contain valid | ||
200 | * physical addresses, but this isn't safe and will be changed: eventually we | ||
201 | * want remoteproc implementations to provide us ranges of physical addresses | ||
202 | * the firmware is allowed to request, and not allow firmwares to request | ||
203 | * access to physical addresses that are outside those ranges. | ||
204 | */ | ||
205 | struct fw_rsc_devmem { | ||
206 | u32 da; | ||
207 | u32 pa; | ||
208 | u32 len; | ||
209 | u32 flags; | ||
210 | u32 reserved; | ||
211 | u8 name[32]; | ||
212 | } __packed; | ||
213 | |||
214 | /** | ||
215 | * struct fw_rsc_trace - trace buffer declaration | ||
216 | * @da: device address | ||
217 | * @len: length (in bytes) | ||
218 | * @reserved: reserved (must be zero) | ||
219 | * @name: human-readable name of the trace buffer | ||
220 | * | ||
221 | * This resource entry provides the host information about a trace buffer | ||
222 | * into which the remote processor will write log messages. | ||
223 | * | ||
224 | * @da specifies the device address of the buffer, @len specifies | ||
225 | * its size, and @name may contain a human readable name of the trace buffer. | ||
226 | * | ||
227 | * After booting the remote processor, the trace buffers are exposed to the | ||
228 | * user via debugfs entries (called trace0, trace1, etc..). | ||
229 | */ | ||
230 | struct fw_rsc_trace { | ||
231 | u32 da; | ||
232 | u32 len; | ||
233 | u32 reserved; | ||
234 | u8 name[32]; | ||
235 | } __packed; | ||
236 | |||
237 | /** | ||
238 | * struct fw_rsc_vdev_vring - vring descriptor entry | ||
239 | * @da: device address | ||
240 | * @align: the alignment between the consumer and producer parts of the vring | ||
241 | * @num: num of buffers supported by this vring (must be power of two) | ||
242 | * @notifyid is a unique rproc-wide notify index for this vring. This notify | ||
243 | * index is used when kicking a remote processor, to let it know that this | ||
244 | * vring is triggered. | ||
245 | * @reserved: reserved (must be zero) | ||
246 | * | ||
247 | * This descriptor is not a resource entry by itself; it is part of the | ||
248 | * vdev resource type (see below). | ||
249 | * | ||
250 | * Note that @da should either contain the device address where | ||
251 | * the remote processor is expecting the vring, or indicate that | ||
252 | * dynamically allocation of the vring's device address is supported. | ||
253 | */ | ||
254 | struct fw_rsc_vdev_vring { | ||
255 | u32 da; | ||
256 | u32 align; | ||
257 | u32 num; | ||
258 | u32 notifyid; | ||
259 | u32 reserved; | ||
260 | } __packed; | ||
261 | |||
262 | /** | ||
263 | * struct fw_rsc_vdev - virtio device header | ||
264 | * @id: virtio device id (as in virtio_ids.h) | ||
265 | * @notifyid is a unique rproc-wide notify index for this vdev. This notify | ||
266 | * index is used when kicking a remote processor, to let it know that the | ||
267 | * status/features of this vdev have changes. | ||
268 | * @dfeatures specifies the virtio device features supported by the firmware | ||
269 | * @gfeatures is a place holder used by the host to write back the | ||
270 | * negotiated features that are supported by both sides. | ||
271 | * @config_len is the size of the virtio config space of this vdev. The config | ||
272 | * space lies in the resource table immediate after this vdev header. | ||
273 | * @status is a place holder where the host will indicate its virtio progress. | ||
274 | * @num_of_vrings indicates how many vrings are described in this vdev header | ||
275 | * @reserved: reserved (must be zero) | ||
276 | * @vring is an array of @num_of_vrings entries of 'struct fw_rsc_vdev_vring'. | ||
277 | * | ||
278 | * This resource is a virtio device header: it provides information about | ||
279 | * the vdev, and is then used by the host and its peer remote processors | ||
280 | * to negotiate and share certain virtio properties. | ||
281 | * | ||
282 | * By providing this resource entry, the firmware essentially asks remoteproc | ||
283 | * to statically allocate a vdev upon registration of the rproc (dynamic vdev | ||
284 | * allocation is not yet supported). | ||
285 | * | ||
286 | * Note: unlike virtualization systems, the term 'host' here means | ||
287 | * the Linux side which is running remoteproc to control the remote | ||
288 | * processors. We use the name 'gfeatures' to comply with virtio's terms, | ||
289 | * though there isn't really any virtualized guest OS here: it's the host | ||
290 | * which is responsible for negotiating the final features. | ||
291 | * Yeah, it's a bit confusing. | ||
292 | * | ||
293 | * Note: immediately following this structure is the virtio config space for | ||
294 | * this vdev (which is specific to the vdev; for more info, read the virtio | ||
295 | * spec). the size of the config space is specified by @config_len. | ||
296 | */ | ||
297 | struct fw_rsc_vdev { | ||
298 | u32 id; | ||
299 | u32 notifyid; | ||
300 | u32 dfeatures; | ||
301 | u32 gfeatures; | ||
302 | u32 config_len; | ||
303 | u8 status; | ||
304 | u8 num_of_vrings; | ||
305 | u8 reserved[2]; | ||
306 | struct fw_rsc_vdev_vring vring[0]; | ||
307 | } __packed; | ||
308 | |||
309 | /** | ||
310 | * struct rproc_mem_entry - memory entry descriptor | ||
311 | * @va: virtual address | ||
312 | * @dma: dma address | ||
313 | * @len: length, in bytes | ||
314 | * @da: device address | ||
315 | * @priv: associated data | ||
316 | * @node: list node | ||
317 | */ | ||
318 | struct rproc_mem_entry { | ||
319 | void *va; | ||
320 | dma_addr_t dma; | ||
321 | int len; | ||
322 | u32 da; | ||
323 | void *priv; | ||
324 | struct list_head node; | ||
325 | }; | ||
326 | |||
327 | struct rproc; | ||
328 | |||
329 | /** | ||
330 | * struct rproc_ops - platform-specific device handlers | ||
331 | * @start: power on the device and boot it | ||
332 | * @stop: power off the device | ||
333 | * @kick: kick a virtqueue (virtqueue id given as a parameter) | ||
334 | */ | ||
335 | struct rproc_ops { | ||
336 | int (*start)(struct rproc *rproc); | ||
337 | int (*stop)(struct rproc *rproc); | ||
338 | void (*kick)(struct rproc *rproc, int vqid); | ||
339 | }; | ||
340 | |||
341 | /** | ||
342 | * enum rproc_state - remote processor states | ||
343 | * @RPROC_OFFLINE: device is powered off | ||
344 | * @RPROC_SUSPENDED: device is suspended; needs to be woken up to receive | ||
345 | * a message. | ||
346 | * @RPROC_RUNNING: device is up and running | ||
347 | * @RPROC_CRASHED: device has crashed; need to start recovery | ||
348 | * @RPROC_LAST: just keep this one at the end | ||
349 | * | ||
350 | * Please note that the values of these states are used as indices | ||
351 | * to rproc_state_string, a state-to-name lookup table, | ||
352 | * so please keep the two synchronized. @RPROC_LAST is used to check | ||
353 | * the validity of an index before the lookup table is accessed, so | ||
354 | * please update it as needed too. | ||
355 | */ | ||
356 | enum rproc_state { | ||
357 | RPROC_OFFLINE = 0, | ||
358 | RPROC_SUSPENDED = 1, | ||
359 | RPROC_RUNNING = 2, | ||
360 | RPROC_CRASHED = 3, | ||
361 | RPROC_LAST = 4, | ||
362 | }; | ||
363 | |||
364 | /** | ||
365 | * struct rproc - represents a physical remote processor device | ||
366 | * @node: klist node of this rproc object | ||
367 | * @domain: iommu domain | ||
368 | * @name: human readable name of the rproc | ||
369 | * @firmware: name of firmware file to be loaded | ||
370 | * @priv: private data which belongs to the platform-specific rproc module | ||
371 | * @ops: platform-specific start/stop rproc handlers | ||
372 | * @dev: underlying device | ||
373 | * @refcount: refcount of users that have a valid pointer to this rproc | ||
374 | * @power: refcount of users who need this rproc powered up | ||
375 | * @state: state of the device | ||
376 | * @lock: lock which protects concurrent manipulations of the rproc | ||
377 | * @dbg_dir: debugfs directory of this rproc device | ||
378 | * @traces: list of trace buffers | ||
379 | * @num_traces: number of trace buffers | ||
380 | * @carveouts: list of physically contiguous memory allocations | ||
381 | * @mappings: list of iommu mappings we initiated, needed on shutdown | ||
382 | * @firmware_loading_complete: marks e/o asynchronous firmware loading | ||
383 | * @bootaddr: address of first instruction to boot rproc with (optional) | ||
384 | * @rvdevs: list of remote virtio devices | ||
385 | * @notifyids: idr for dynamically assigning rproc-wide unique notify ids | ||
386 | */ | ||
387 | struct rproc { | ||
388 | struct klist_node node; | ||
389 | struct iommu_domain *domain; | ||
390 | const char *name; | ||
391 | const char *firmware; | ||
392 | void *priv; | ||
393 | const struct rproc_ops *ops; | ||
394 | struct device *dev; | ||
395 | struct kref refcount; | ||
396 | atomic_t power; | ||
397 | unsigned int state; | ||
398 | struct mutex lock; | ||
399 | struct dentry *dbg_dir; | ||
400 | struct list_head traces; | ||
401 | int num_traces; | ||
402 | struct list_head carveouts; | ||
403 | struct list_head mappings; | ||
404 | struct completion firmware_loading_complete; | ||
405 | u32 bootaddr; | ||
406 | struct list_head rvdevs; | ||
407 | struct idr notifyids; | ||
408 | }; | ||
409 | |||
410 | /* we currently support only two vrings per rvdev */ | ||
411 | #define RVDEV_NUM_VRINGS 2 | ||
412 | |||
413 | /** | ||
414 | * struct rproc_vring - remoteproc vring state | ||
415 | * @va: virtual address | ||
416 | * @dma: dma address | ||
417 | * @len: length, in bytes | ||
418 | * @da: device address | ||
419 | * @align: vring alignment | ||
420 | * @notifyid: rproc-specific unique vring index | ||
421 | * @rvdev: remote vdev | ||
422 | * @vq: the virtqueue of this vring | ||
423 | */ | ||
424 | struct rproc_vring { | ||
425 | void *va; | ||
426 | dma_addr_t dma; | ||
427 | int len; | ||
428 | u32 da; | ||
429 | u32 align; | ||
430 | int notifyid; | ||
431 | struct rproc_vdev *rvdev; | ||
432 | struct virtqueue *vq; | ||
433 | }; | ||
434 | |||
435 | /** | ||
436 | * struct rproc_vdev - remoteproc state for a supported virtio device | ||
437 | * @node: list node | ||
438 | * @rproc: the rproc handle | ||
439 | * @vdev: the virio device | ||
440 | * @vring: the vrings for this vdev | ||
441 | * @dfeatures: virtio device features | ||
442 | * @gfeatures: virtio guest features | ||
443 | */ | ||
444 | struct rproc_vdev { | ||
445 | struct list_head node; | ||
446 | struct rproc *rproc; | ||
447 | struct virtio_device vdev; | ||
448 | struct rproc_vring vring[RVDEV_NUM_VRINGS]; | ||
449 | unsigned long dfeatures; | ||
450 | unsigned long gfeatures; | ||
451 | }; | ||
452 | |||
453 | struct rproc *rproc_get_by_name(const char *name); | ||
454 | void rproc_put(struct rproc *rproc); | ||
455 | |||
456 | struct rproc *rproc_alloc(struct device *dev, const char *name, | ||
457 | const struct rproc_ops *ops, | ||
458 | const char *firmware, int len); | ||
459 | void rproc_free(struct rproc *rproc); | ||
460 | int rproc_register(struct rproc *rproc); | ||
461 | int rproc_unregister(struct rproc *rproc); | ||
462 | |||
463 | int rproc_boot(struct rproc *rproc); | ||
464 | void rproc_shutdown(struct rproc *rproc); | ||
465 | |||
466 | static inline struct rproc_vdev *vdev_to_rvdev(struct virtio_device *vdev) | ||
467 | { | ||
468 | return container_of(vdev, struct rproc_vdev, vdev); | ||
469 | } | ||
470 | |||
471 | static inline struct rproc *vdev_to_rproc(struct virtio_device *vdev) | ||
472 | { | ||
473 | struct rproc_vdev *rvdev = vdev_to_rvdev(vdev); | ||
474 | |||
475 | return rvdev->rproc; | ||
476 | } | ||
477 | |||
478 | #endif /* REMOTEPROC_H */ | ||
diff --git a/include/linux/rfkill.h b/include/linux/rfkill.h index c6c608482cba..6fdf02737e9d 100644 --- a/include/linux/rfkill.h +++ b/include/linux/rfkill.h | |||
@@ -117,10 +117,10 @@ enum rfkill_user_states { | |||
117 | #include <linux/kernel.h> | 117 | #include <linux/kernel.h> |
118 | #include <linux/list.h> | 118 | #include <linux/list.h> |
119 | #include <linux/mutex.h> | 119 | #include <linux/mutex.h> |
120 | #include <linux/device.h> | ||
121 | #include <linux/leds.h> | 120 | #include <linux/leds.h> |
122 | #include <linux/err.h> | 121 | #include <linux/err.h> |
123 | 122 | ||
123 | struct device; | ||
124 | /* this is opaque */ | 124 | /* this is opaque */ |
125 | struct rfkill; | 125 | struct rfkill; |
126 | 126 | ||
diff --git a/include/linux/ring_buffer.h b/include/linux/ring_buffer.h index 67be0376d8e3..7be2e88f23fd 100644 --- a/include/linux/ring_buffer.h +++ b/include/linux/ring_buffer.h | |||
@@ -151,6 +151,9 @@ int ring_buffer_empty_cpu(struct ring_buffer *buffer, int cpu); | |||
151 | 151 | ||
152 | void ring_buffer_record_disable(struct ring_buffer *buffer); | 152 | void ring_buffer_record_disable(struct ring_buffer *buffer); |
153 | void ring_buffer_record_enable(struct ring_buffer *buffer); | 153 | void ring_buffer_record_enable(struct ring_buffer *buffer); |
154 | void ring_buffer_record_off(struct ring_buffer *buffer); | ||
155 | void ring_buffer_record_on(struct ring_buffer *buffer); | ||
156 | int ring_buffer_record_is_on(struct ring_buffer *buffer); | ||
154 | void ring_buffer_record_disable_cpu(struct ring_buffer *buffer, int cpu); | 157 | void ring_buffer_record_disable_cpu(struct ring_buffer *buffer, int cpu); |
155 | void ring_buffer_record_enable_cpu(struct ring_buffer *buffer, int cpu); | 158 | void ring_buffer_record_enable_cpu(struct ring_buffer *buffer, int cpu); |
156 | 159 | ||
diff --git a/include/linux/rio_drv.h b/include/linux/rio_drv.h index 229b3ca23134..7f07470e1ed9 100644 --- a/include/linux/rio_drv.h +++ b/include/linux/rio_drv.h | |||
@@ -17,7 +17,6 @@ | |||
17 | #include <linux/ioport.h> | 17 | #include <linux/ioport.h> |
18 | #include <linux/list.h> | 18 | #include <linux/list.h> |
19 | #include <linux/errno.h> | 19 | #include <linux/errno.h> |
20 | #include <linux/device.h> | ||
21 | #include <linux/string.h> | 20 | #include <linux/string.h> |
22 | #include <linux/rio.h> | 21 | #include <linux/rio.h> |
23 | 22 | ||
diff --git a/include/linux/rmap.h b/include/linux/rmap.h index 1cdd62a2788a..fd07c4542cee 100644 --- a/include/linux/rmap.h +++ b/include/linux/rmap.h | |||
@@ -122,7 +122,6 @@ void unlink_anon_vmas(struct vm_area_struct *); | |||
122 | int anon_vma_clone(struct vm_area_struct *, struct vm_area_struct *); | 122 | int anon_vma_clone(struct vm_area_struct *, struct vm_area_struct *); |
123 | void anon_vma_moveto_tail(struct vm_area_struct *); | 123 | void anon_vma_moveto_tail(struct vm_area_struct *); |
124 | int anon_vma_fork(struct vm_area_struct *, struct vm_area_struct *); | 124 | int anon_vma_fork(struct vm_area_struct *, struct vm_area_struct *); |
125 | void __anon_vma_link(struct vm_area_struct *); | ||
126 | 125 | ||
127 | static inline void anon_vma_merge(struct vm_area_struct *vma, | 126 | static inline void anon_vma_merge(struct vm_area_struct *vma, |
128 | struct vm_area_struct *next) | 127 | struct vm_area_struct *next) |
diff --git a/include/linux/rpmsg.h b/include/linux/rpmsg.h new file mode 100644 index 000000000000..a8e50e44203c --- /dev/null +++ b/include/linux/rpmsg.h | |||
@@ -0,0 +1,326 @@ | |||
1 | /* | ||
2 | * Remote processor messaging | ||
3 | * | ||
4 | * Copyright (C) 2011 Texas Instruments, Inc. | ||
5 | * Copyright (C) 2011 Google, Inc. | ||
6 | * All rights reserved. | ||
7 | * | ||
8 | * Redistribution and use in source and binary forms, with or without | ||
9 | * modification, are permitted provided that the following conditions | ||
10 | * are met: | ||
11 | * | ||
12 | * * Redistributions of source code must retain the above copyright | ||
13 | * notice, this list of conditions and the following disclaimer. | ||
14 | * * Redistributions in binary form must reproduce the above copyright | ||
15 | * notice, this list of conditions and the following disclaimer in | ||
16 | * the documentation and/or other materials provided with the | ||
17 | * distribution. | ||
18 | * * Neither the name Texas Instruments nor the names of its | ||
19 | * contributors may be used to endorse or promote products derived | ||
20 | * from this software without specific prior written permission. | ||
21 | * | ||
22 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
23 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
24 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | ||
25 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
26 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
27 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | ||
28 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
29 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | ||
30 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
31 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
32 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
33 | */ | ||
34 | |||
35 | #ifndef _LINUX_RPMSG_H | ||
36 | #define _LINUX_RPMSG_H | ||
37 | |||
38 | #include <linux/types.h> | ||
39 | #include <linux/device.h> | ||
40 | #include <linux/mod_devicetable.h> | ||
41 | |||
42 | /* The feature bitmap for virtio rpmsg */ | ||
43 | #define VIRTIO_RPMSG_F_NS 0 /* RP supports name service notifications */ | ||
44 | |||
45 | /** | ||
46 | * struct rpmsg_hdr - common header for all rpmsg messages | ||
47 | * @src: source address | ||
48 | * @dst: destination address | ||
49 | * @reserved: reserved for future use | ||
50 | * @len: length of payload (in bytes) | ||
51 | * @flags: message flags | ||
52 | * @data: @len bytes of message payload data | ||
53 | * | ||
54 | * Every message sent(/received) on the rpmsg bus begins with this header. | ||
55 | */ | ||
56 | struct rpmsg_hdr { | ||
57 | u32 src; | ||
58 | u32 dst; | ||
59 | u32 reserved; | ||
60 | u16 len; | ||
61 | u16 flags; | ||
62 | u8 data[0]; | ||
63 | } __packed; | ||
64 | |||
65 | /** | ||
66 | * struct rpmsg_ns_msg - dynamic name service announcement message | ||
67 | * @name: name of remote service that is published | ||
68 | * @addr: address of remote service that is published | ||
69 | * @flags: indicates whether service is created or destroyed | ||
70 | * | ||
71 | * This message is sent across to publish a new service, or announce | ||
72 | * about its removal. When we receive these messages, an appropriate | ||
73 | * rpmsg channel (i.e device) is created/destroyed. In turn, the ->probe() | ||
74 | * or ->remove() handler of the appropriate rpmsg driver will be invoked | ||
75 | * (if/as-soon-as one is registered). | ||
76 | */ | ||
77 | struct rpmsg_ns_msg { | ||
78 | char name[RPMSG_NAME_SIZE]; | ||
79 | u32 addr; | ||
80 | u32 flags; | ||
81 | } __packed; | ||
82 | |||
83 | /** | ||
84 | * enum rpmsg_ns_flags - dynamic name service announcement flags | ||
85 | * | ||
86 | * @RPMSG_NS_CREATE: a new remote service was just created | ||
87 | * @RPMSG_NS_DESTROY: a known remote service was just destroyed | ||
88 | */ | ||
89 | enum rpmsg_ns_flags { | ||
90 | RPMSG_NS_CREATE = 0, | ||
91 | RPMSG_NS_DESTROY = 1, | ||
92 | }; | ||
93 | |||
94 | #define RPMSG_ADDR_ANY 0xFFFFFFFF | ||
95 | |||
96 | struct virtproc_info; | ||
97 | |||
98 | /** | ||
99 | * rpmsg_channel - devices that belong to the rpmsg bus are called channels | ||
100 | * @vrp: the remote processor this channel belongs to | ||
101 | * @dev: the device struct | ||
102 | * @id: device id (used to match between rpmsg drivers and devices) | ||
103 | * @src: local address | ||
104 | * @dst: destination address | ||
105 | * @ept: the rpmsg endpoint of this channel | ||
106 | * @announce: if set, rpmsg will announce the creation/removal of this channel | ||
107 | */ | ||
108 | struct rpmsg_channel { | ||
109 | struct virtproc_info *vrp; | ||
110 | struct device dev; | ||
111 | struct rpmsg_device_id id; | ||
112 | u32 src; | ||
113 | u32 dst; | ||
114 | struct rpmsg_endpoint *ept; | ||
115 | bool announce; | ||
116 | }; | ||
117 | |||
118 | typedef void (*rpmsg_rx_cb_t)(struct rpmsg_channel *, void *, int, void *, u32); | ||
119 | |||
120 | /** | ||
121 | * struct rpmsg_endpoint - binds a local rpmsg address to its user | ||
122 | * @rpdev: rpmsg channel device | ||
123 | * @cb: rx callback handler | ||
124 | * @addr: local rpmsg address | ||
125 | * @priv: private data for the driver's use | ||
126 | * | ||
127 | * In essence, an rpmsg endpoint represents a listener on the rpmsg bus, as | ||
128 | * it binds an rpmsg address with an rx callback handler. | ||
129 | * | ||
130 | * Simple rpmsg drivers shouldn't use this struct directly, because | ||
131 | * things just work: every rpmsg driver provides an rx callback upon | ||
132 | * registering to the bus, and that callback is then bound to its rpmsg | ||
133 | * address when the driver is probed. When relevant inbound messages arrive | ||
134 | * (i.e. messages which their dst address equals to the src address of | ||
135 | * the rpmsg channel), the driver's handler is invoked to process it. | ||
136 | * | ||
137 | * More complicated drivers though, that do need to allocate additional rpmsg | ||
138 | * addresses, and bind them to different rx callbacks, must explicitly | ||
139 | * create additional endpoints by themselves (see rpmsg_create_ept()). | ||
140 | */ | ||
141 | struct rpmsg_endpoint { | ||
142 | struct rpmsg_channel *rpdev; | ||
143 | rpmsg_rx_cb_t cb; | ||
144 | u32 addr; | ||
145 | void *priv; | ||
146 | }; | ||
147 | |||
148 | /** | ||
149 | * struct rpmsg_driver - rpmsg driver struct | ||
150 | * @drv: underlying device driver | ||
151 | * @id_table: rpmsg ids serviced by this driver | ||
152 | * @probe: invoked when a matching rpmsg channel (i.e. device) is found | ||
153 | * @remove: invoked when the rpmsg channel is removed | ||
154 | * @callback: invoked when an inbound message is received on the channel | ||
155 | */ | ||
156 | struct rpmsg_driver { | ||
157 | struct device_driver drv; | ||
158 | const struct rpmsg_device_id *id_table; | ||
159 | int (*probe)(struct rpmsg_channel *dev); | ||
160 | void (*remove)(struct rpmsg_channel *dev); | ||
161 | void (*callback)(struct rpmsg_channel *, void *, int, void *, u32); | ||
162 | }; | ||
163 | |||
164 | int register_rpmsg_device(struct rpmsg_channel *dev); | ||
165 | void unregister_rpmsg_device(struct rpmsg_channel *dev); | ||
166 | int register_rpmsg_driver(struct rpmsg_driver *drv); | ||
167 | void unregister_rpmsg_driver(struct rpmsg_driver *drv); | ||
168 | void rpmsg_destroy_ept(struct rpmsg_endpoint *); | ||
169 | struct rpmsg_endpoint *rpmsg_create_ept(struct rpmsg_channel *, | ||
170 | rpmsg_rx_cb_t cb, void *priv, u32 addr); | ||
171 | int | ||
172 | rpmsg_send_offchannel_raw(struct rpmsg_channel *, u32, u32, void *, int, bool); | ||
173 | |||
174 | /** | ||
175 | * rpmsg_send() - send a message across to the remote processor | ||
176 | * @rpdev: the rpmsg channel | ||
177 | * @data: payload of message | ||
178 | * @len: length of payload | ||
179 | * | ||
180 | * This function sends @data of length @len on the @rpdev channel. | ||
181 | * The message will be sent to the remote processor which the @rpdev | ||
182 | * channel belongs to, using @rpdev's source and destination addresses. | ||
183 | * In case there are no TX buffers available, the function will block until | ||
184 | * one becomes available, or a timeout of 15 seconds elapses. When the latter | ||
185 | * happens, -ERESTARTSYS is returned. | ||
186 | * | ||
187 | * Can only be called from process context (for now). | ||
188 | * | ||
189 | * Returns 0 on success and an appropriate error value on failure. | ||
190 | */ | ||
191 | static inline int rpmsg_send(struct rpmsg_channel *rpdev, void *data, int len) | ||
192 | { | ||
193 | u32 src = rpdev->src, dst = rpdev->dst; | ||
194 | |||
195 | return rpmsg_send_offchannel_raw(rpdev, src, dst, data, len, true); | ||
196 | } | ||
197 | |||
198 | /** | ||
199 | * rpmsg_sendto() - send a message across to the remote processor, specify dst | ||
200 | * @rpdev: the rpmsg channel | ||
201 | * @data: payload of message | ||
202 | * @len: length of payload | ||
203 | * @dst: destination address | ||
204 | * | ||
205 | * This function sends @data of length @len to the remote @dst address. | ||
206 | * The message will be sent to the remote processor which the @rpdev | ||
207 | * channel belongs to, using @rpdev's source address. | ||
208 | * In case there are no TX buffers available, the function will block until | ||
209 | * one becomes available, or a timeout of 15 seconds elapses. When the latter | ||
210 | * happens, -ERESTARTSYS is returned. | ||
211 | * | ||
212 | * Can only be called from process context (for now). | ||
213 | * | ||
214 | * Returns 0 on success and an appropriate error value on failure. | ||
215 | */ | ||
216 | static inline | ||
217 | int rpmsg_sendto(struct rpmsg_channel *rpdev, void *data, int len, u32 dst) | ||
218 | { | ||
219 | u32 src = rpdev->src; | ||
220 | |||
221 | return rpmsg_send_offchannel_raw(rpdev, src, dst, data, len, true); | ||
222 | } | ||
223 | |||
224 | /** | ||
225 | * rpmsg_send_offchannel() - send a message using explicit src/dst addresses | ||
226 | * @rpdev: the rpmsg channel | ||
227 | * @src: source address | ||
228 | * @dst: destination address | ||
229 | * @data: payload of message | ||
230 | * @len: length of payload | ||
231 | * | ||
232 | * This function sends @data of length @len to the remote @dst address, | ||
233 | * and uses @src as the source address. | ||
234 | * The message will be sent to the remote processor which the @rpdev | ||
235 | * channel belongs to. | ||
236 | * In case there are no TX buffers available, the function will block until | ||
237 | * one becomes available, or a timeout of 15 seconds elapses. When the latter | ||
238 | * happens, -ERESTARTSYS is returned. | ||
239 | * | ||
240 | * Can only be called from process context (for now). | ||
241 | * | ||
242 | * Returns 0 on success and an appropriate error value on failure. | ||
243 | */ | ||
244 | static inline | ||
245 | int rpmsg_send_offchannel(struct rpmsg_channel *rpdev, u32 src, u32 dst, | ||
246 | void *data, int len) | ||
247 | { | ||
248 | return rpmsg_send_offchannel_raw(rpdev, src, dst, data, len, true); | ||
249 | } | ||
250 | |||
251 | /** | ||
252 | * rpmsg_send() - send a message across to the remote processor | ||
253 | * @rpdev: the rpmsg channel | ||
254 | * @data: payload of message | ||
255 | * @len: length of payload | ||
256 | * | ||
257 | * This function sends @data of length @len on the @rpdev channel. | ||
258 | * The message will be sent to the remote processor which the @rpdev | ||
259 | * channel belongs to, using @rpdev's source and destination addresses. | ||
260 | * In case there are no TX buffers available, the function will immediately | ||
261 | * return -ENOMEM without waiting until one becomes available. | ||
262 | * | ||
263 | * Can only be called from process context (for now). | ||
264 | * | ||
265 | * Returns 0 on success and an appropriate error value on failure. | ||
266 | */ | ||
267 | static inline | ||
268 | int rpmsg_trysend(struct rpmsg_channel *rpdev, void *data, int len) | ||
269 | { | ||
270 | u32 src = rpdev->src, dst = rpdev->dst; | ||
271 | |||
272 | return rpmsg_send_offchannel_raw(rpdev, src, dst, data, len, false); | ||
273 | } | ||
274 | |||
275 | /** | ||
276 | * rpmsg_sendto() - send a message across to the remote processor, specify dst | ||
277 | * @rpdev: the rpmsg channel | ||
278 | * @data: payload of message | ||
279 | * @len: length of payload | ||
280 | * @dst: destination address | ||
281 | * | ||
282 | * This function sends @data of length @len to the remote @dst address. | ||
283 | * The message will be sent to the remote processor which the @rpdev | ||
284 | * channel belongs to, using @rpdev's source address. | ||
285 | * In case there are no TX buffers available, the function will immediately | ||
286 | * return -ENOMEM without waiting until one becomes available. | ||
287 | * | ||
288 | * Can only be called from process context (for now). | ||
289 | * | ||
290 | * Returns 0 on success and an appropriate error value on failure. | ||
291 | */ | ||
292 | static inline | ||
293 | int rpmsg_trysendto(struct rpmsg_channel *rpdev, void *data, int len, u32 dst) | ||
294 | { | ||
295 | u32 src = rpdev->src; | ||
296 | |||
297 | return rpmsg_send_offchannel_raw(rpdev, src, dst, data, len, false); | ||
298 | } | ||
299 | |||
300 | /** | ||
301 | * rpmsg_send_offchannel() - send a message using explicit src/dst addresses | ||
302 | * @rpdev: the rpmsg channel | ||
303 | * @src: source address | ||
304 | * @dst: destination address | ||
305 | * @data: payload of message | ||
306 | * @len: length of payload | ||
307 | * | ||
308 | * This function sends @data of length @len to the remote @dst address, | ||
309 | * and uses @src as the source address. | ||
310 | * The message will be sent to the remote processor which the @rpdev | ||
311 | * channel belongs to. | ||
312 | * In case there are no TX buffers available, the function will immediately | ||
313 | * return -ENOMEM without waiting until one becomes available. | ||
314 | * | ||
315 | * Can only be called from process context (for now). | ||
316 | * | ||
317 | * Returns 0 on success and an appropriate error value on failure. | ||
318 | */ | ||
319 | static inline | ||
320 | int rpmsg_trysend_offchannel(struct rpmsg_channel *rpdev, u32 src, u32 dst, | ||
321 | void *data, int len) | ||
322 | { | ||
323 | return rpmsg_send_offchannel_raw(rpdev, src, dst, data, len, false); | ||
324 | } | ||
325 | |||
326 | #endif /* _LINUX_RPMSG_H */ | ||
diff --git a/include/linux/rtc.h b/include/linux/rtc.h index 93f4d035076b..fcabfb4873c8 100644 --- a/include/linux/rtc.h +++ b/include/linux/rtc.h | |||
@@ -202,7 +202,8 @@ struct rtc_device | |||
202 | struct hrtimer pie_timer; /* sub second exp, so needs hrtimer */ | 202 | struct hrtimer pie_timer; /* sub second exp, so needs hrtimer */ |
203 | int pie_enabled; | 203 | int pie_enabled; |
204 | struct work_struct irqwork; | 204 | struct work_struct irqwork; |
205 | 205 | /* Some hardware can't support UIE mode */ | |
206 | int uie_unsupported; | ||
206 | 207 | ||
207 | #ifdef CONFIG_RTC_INTF_DEV_UIE_EMUL | 208 | #ifdef CONFIG_RTC_INTF_DEV_UIE_EMUL |
208 | struct work_struct uie_task; | 209 | struct work_struct uie_task; |
diff --git a/include/linux/rwsem.h b/include/linux/rwsem.h index 63d406554391..54bd7cd7ecbd 100644 --- a/include/linux/rwsem.h +++ b/include/linux/rwsem.h | |||
@@ -14,7 +14,6 @@ | |||
14 | #include <linux/list.h> | 14 | #include <linux/list.h> |
15 | #include <linux/spinlock.h> | 15 | #include <linux/spinlock.h> |
16 | 16 | ||
17 | #include <asm/system.h> | ||
18 | #include <linux/atomic.h> | 17 | #include <linux/atomic.h> |
19 | 18 | ||
20 | struct rw_semaphore; | 19 | struct rw_semaphore; |
diff --git a/include/linux/sa11x0-dma.h b/include/linux/sa11x0-dma.h new file mode 100644 index 000000000000..65839a58b8e5 --- /dev/null +++ b/include/linux/sa11x0-dma.h | |||
@@ -0,0 +1,24 @@ | |||
1 | /* | ||
2 | * SA11x0 DMA Engine support | ||
3 | * | ||
4 | * Copyright (C) 2012 Russell King | ||
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 | #ifndef __LINUX_SA11X0_DMA_H | ||
11 | #define __LINUX_SA11X0_DMA_H | ||
12 | |||
13 | struct dma_chan; | ||
14 | |||
15 | #if defined(CONFIG_DMA_SA11X0) || defined(CONFIG_DMA_SA11X0_MODULE) | ||
16 | bool sa11x0_dma_filter_fn(struct dma_chan *, void *); | ||
17 | #else | ||
18 | static inline bool sa11x0_dma_filter_fn(struct dma_chan *c, void *d) | ||
19 | { | ||
20 | return false; | ||
21 | } | ||
22 | #endif | ||
23 | |||
24 | #endif | ||
diff --git a/include/linux/scatterlist.h b/include/linux/scatterlist.h index 9aaf5bfdad1a..ac9586dadfa5 100644 --- a/include/linux/scatterlist.h +++ b/include/linux/scatterlist.h | |||
@@ -1,10 +1,12 @@ | |||
1 | #ifndef _LINUX_SCATTERLIST_H | 1 | #ifndef _LINUX_SCATTERLIST_H |
2 | #define _LINUX_SCATTERLIST_H | 2 | #define _LINUX_SCATTERLIST_H |
3 | 3 | ||
4 | #include <linux/string.h> | ||
5 | #include <linux/bug.h> | ||
6 | #include <linux/mm.h> | ||
7 | |||
4 | #include <asm/types.h> | 8 | #include <asm/types.h> |
5 | #include <asm/scatterlist.h> | 9 | #include <asm/scatterlist.h> |
6 | #include <linux/mm.h> | ||
7 | #include <linux/string.h> | ||
8 | #include <asm/io.h> | 10 | #include <asm/io.h> |
9 | 11 | ||
10 | struct sg_table { | 12 | struct sg_table { |
diff --git a/include/linux/sched.h b/include/linux/sched.h index 7d379a6bfd88..81a173c0897d 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h | |||
@@ -63,7 +63,6 @@ struct sched_param { | |||
63 | #include <linux/nodemask.h> | 63 | #include <linux/nodemask.h> |
64 | #include <linux/mm_types.h> | 64 | #include <linux/mm_types.h> |
65 | 65 | ||
66 | #include <asm/system.h> | ||
67 | #include <asm/page.h> | 66 | #include <asm/page.h> |
68 | #include <asm/ptrace.h> | 67 | #include <asm/ptrace.h> |
69 | #include <asm/cputime.h> | 68 | #include <asm/cputime.h> |
@@ -361,6 +360,7 @@ extern signed long schedule_timeout_interruptible(signed long timeout); | |||
361 | extern signed long schedule_timeout_killable(signed long timeout); | 360 | extern signed long schedule_timeout_killable(signed long timeout); |
362 | extern signed long schedule_timeout_uninterruptible(signed long timeout); | 361 | extern signed long schedule_timeout_uninterruptible(signed long timeout); |
363 | asmlinkage void schedule(void); | 362 | asmlinkage void schedule(void); |
363 | extern void schedule_preempt_disabled(void); | ||
364 | extern int mutex_spin_on_owner(struct mutex *lock, struct task_struct *owner); | 364 | extern int mutex_spin_on_owner(struct mutex *lock, struct task_struct *owner); |
365 | 365 | ||
366 | struct nsproxy; | 366 | struct nsproxy; |
@@ -552,6 +552,18 @@ struct signal_struct { | |||
552 | int group_stop_count; | 552 | int group_stop_count; |
553 | unsigned int flags; /* see SIGNAL_* flags below */ | 553 | unsigned int flags; /* see SIGNAL_* flags below */ |
554 | 554 | ||
555 | /* | ||
556 | * PR_SET_CHILD_SUBREAPER marks a process, like a service | ||
557 | * manager, to re-parent orphan (double-forking) child processes | ||
558 | * to this process instead of 'init'. The service manager is | ||
559 | * able to receive SIGCHLD signals and is able to investigate | ||
560 | * the process until it calls wait(). All children of this | ||
561 | * process will inherit a flag if they should look for a | ||
562 | * child_subreaper process at exit. | ||
563 | */ | ||
564 | unsigned int is_child_subreaper:1; | ||
565 | unsigned int has_child_subreaper:1; | ||
566 | |||
555 | /* POSIX.1b Interval Timers */ | 567 | /* POSIX.1b Interval Timers */ |
556 | struct list_head posix_timers; | 568 | struct list_head posix_timers; |
557 | 569 | ||
@@ -905,6 +917,7 @@ struct sched_group_power { | |||
905 | * single CPU. | 917 | * single CPU. |
906 | */ | 918 | */ |
907 | unsigned int power, power_orig; | 919 | unsigned int power, power_orig; |
920 | unsigned long next_update; | ||
908 | /* | 921 | /* |
909 | * Number of busy cpus in this group. | 922 | * Number of busy cpus in this group. |
910 | */ | 923 | */ |
@@ -1052,6 +1065,8 @@ static inline int test_sd_parent(struct sched_domain *sd, int flag) | |||
1052 | unsigned long default_scale_freq_power(struct sched_domain *sd, int cpu); | 1065 | unsigned long default_scale_freq_power(struct sched_domain *sd, int cpu); |
1053 | unsigned long default_scale_smt_power(struct sched_domain *sd, int cpu); | 1066 | unsigned long default_scale_smt_power(struct sched_domain *sd, int cpu); |
1054 | 1067 | ||
1068 | bool cpus_share_cache(int this_cpu, int that_cpu); | ||
1069 | |||
1055 | #else /* CONFIG_SMP */ | 1070 | #else /* CONFIG_SMP */ |
1056 | 1071 | ||
1057 | struct sched_domain_attr; | 1072 | struct sched_domain_attr; |
@@ -1061,6 +1076,12 @@ partition_sched_domains(int ndoms_new, cpumask_var_t doms_new[], | |||
1061 | struct sched_domain_attr *dattr_new) | 1076 | struct sched_domain_attr *dattr_new) |
1062 | { | 1077 | { |
1063 | } | 1078 | } |
1079 | |||
1080 | static inline bool cpus_share_cache(int this_cpu, int that_cpu) | ||
1081 | { | ||
1082 | return true; | ||
1083 | } | ||
1084 | |||
1064 | #endif /* !CONFIG_SMP */ | 1085 | #endif /* !CONFIG_SMP */ |
1065 | 1086 | ||
1066 | 1087 | ||
@@ -1225,6 +1246,12 @@ struct sched_rt_entity { | |||
1225 | #endif | 1246 | #endif |
1226 | }; | 1247 | }; |
1227 | 1248 | ||
1249 | /* | ||
1250 | * default timeslice is 100 msecs (used only for SCHED_RR tasks). | ||
1251 | * Timeslices get refilled after they expire. | ||
1252 | */ | ||
1253 | #define RR_TIMESLICE (100 * HZ / 1000) | ||
1254 | |||
1228 | struct rcu_node; | 1255 | struct rcu_node; |
1229 | 1256 | ||
1230 | enum perf_event_task_context { | 1257 | enum perf_event_task_context { |
@@ -1319,6 +1346,11 @@ struct task_struct { | |||
1319 | unsigned sched_reset_on_fork:1; | 1346 | unsigned sched_reset_on_fork:1; |
1320 | unsigned sched_contributes_to_load:1; | 1347 | unsigned sched_contributes_to_load:1; |
1321 | 1348 | ||
1349 | #ifdef CONFIG_GENERIC_HARDIRQS | ||
1350 | /* IRQ handler threads */ | ||
1351 | unsigned irq_thread:1; | ||
1352 | #endif | ||
1353 | |||
1322 | pid_t pid; | 1354 | pid_t pid; |
1323 | pid_t tgid; | 1355 | pid_t tgid; |
1324 | 1356 | ||
@@ -1427,11 +1459,6 @@ struct task_struct { | |||
1427 | * mempolicy */ | 1459 | * mempolicy */ |
1428 | spinlock_t alloc_lock; | 1460 | spinlock_t alloc_lock; |
1429 | 1461 | ||
1430 | #ifdef CONFIG_GENERIC_HARDIRQS | ||
1431 | /* IRQ handler threads */ | ||
1432 | struct irqaction *irqaction; | ||
1433 | #endif | ||
1434 | |||
1435 | /* Protection of the PI data structures: */ | 1462 | /* Protection of the PI data structures: */ |
1436 | raw_spinlock_t pi_lock; | 1463 | raw_spinlock_t pi_lock; |
1437 | 1464 | ||
@@ -1498,7 +1525,7 @@ struct task_struct { | |||
1498 | #endif | 1525 | #endif |
1499 | #ifdef CONFIG_CPUSETS | 1526 | #ifdef CONFIG_CPUSETS |
1500 | nodemask_t mems_allowed; /* Protected by alloc_lock */ | 1527 | nodemask_t mems_allowed; /* Protected by alloc_lock */ |
1501 | int mems_allowed_change_disable; | 1528 | seqcount_t mems_allowed_seq; /* Seqence no to catch updates */ |
1502 | int cpuset_mem_spread_rotor; | 1529 | int cpuset_mem_spread_rotor; |
1503 | int cpuset_slab_spread_rotor; | 1530 | int cpuset_slab_spread_rotor; |
1504 | #endif | 1531 | #endif |
@@ -1777,7 +1804,6 @@ extern void thread_group_times(struct task_struct *p, cputime_t *ut, cputime_t * | |||
1777 | /* | 1804 | /* |
1778 | * Per process flags | 1805 | * Per process flags |
1779 | */ | 1806 | */ |
1780 | #define PF_STARTING 0x00000002 /* being created */ | ||
1781 | #define PF_EXITING 0x00000004 /* getting shut down */ | 1807 | #define PF_EXITING 0x00000004 /* getting shut down */ |
1782 | #define PF_EXITPIDONE 0x00000008 /* pi exit done on shut down */ | 1808 | #define PF_EXITPIDONE 0x00000008 /* pi exit done on shut down */ |
1783 | #define PF_VCPU 0x00000010 /* I'm a virtual CPU */ | 1809 | #define PF_VCPU 0x00000010 /* I'm a virtual CPU */ |
@@ -1864,8 +1890,7 @@ extern void task_clear_jobctl_pending(struct task_struct *task, | |||
1864 | #ifdef CONFIG_PREEMPT_RCU | 1890 | #ifdef CONFIG_PREEMPT_RCU |
1865 | 1891 | ||
1866 | #define RCU_READ_UNLOCK_BLOCKED (1 << 0) /* blocked while in RCU read-side. */ | 1892 | #define RCU_READ_UNLOCK_BLOCKED (1 << 0) /* blocked while in RCU read-side. */ |
1867 | #define RCU_READ_UNLOCK_BOOSTED (1 << 1) /* boosted while in RCU read-side. */ | 1893 | #define RCU_READ_UNLOCK_NEED_QS (1 << 1) /* RCU core needs CPU response. */ |
1868 | #define RCU_READ_UNLOCK_NEED_QS (1 << 2) /* RCU core needs CPU response. */ | ||
1869 | 1894 | ||
1870 | static inline void rcu_copy_process(struct task_struct *p) | 1895 | static inline void rcu_copy_process(struct task_struct *p) |
1871 | { | 1896 | { |
@@ -2049,7 +2074,7 @@ extern void sched_autogroup_fork(struct signal_struct *sig); | |||
2049 | extern void sched_autogroup_exit(struct signal_struct *sig); | 2074 | extern void sched_autogroup_exit(struct signal_struct *sig); |
2050 | #ifdef CONFIG_PROC_FS | 2075 | #ifdef CONFIG_PROC_FS |
2051 | extern void proc_sched_autogroup_show_task(struct task_struct *p, struct seq_file *m); | 2076 | extern void proc_sched_autogroup_show_task(struct task_struct *p, struct seq_file *m); |
2052 | extern int proc_sched_autogroup_set_nice(struct task_struct *p, int *nice); | 2077 | extern int proc_sched_autogroup_set_nice(struct task_struct *p, int nice); |
2053 | #endif | 2078 | #endif |
2054 | #else | 2079 | #else |
2055 | static inline void sched_autogroup_create_attach(struct task_struct *p) { } | 2080 | static inline void sched_autogroup_create_attach(struct task_struct *p) { } |
@@ -2066,12 +2091,20 @@ extern unsigned int sysctl_sched_cfs_bandwidth_slice; | |||
2066 | extern int rt_mutex_getprio(struct task_struct *p); | 2091 | extern int rt_mutex_getprio(struct task_struct *p); |
2067 | extern void rt_mutex_setprio(struct task_struct *p, int prio); | 2092 | extern void rt_mutex_setprio(struct task_struct *p, int prio); |
2068 | extern void rt_mutex_adjust_pi(struct task_struct *p); | 2093 | extern void rt_mutex_adjust_pi(struct task_struct *p); |
2094 | static inline bool tsk_is_pi_blocked(struct task_struct *tsk) | ||
2095 | { | ||
2096 | return tsk->pi_blocked_on != NULL; | ||
2097 | } | ||
2069 | #else | 2098 | #else |
2070 | static inline int rt_mutex_getprio(struct task_struct *p) | 2099 | static inline int rt_mutex_getprio(struct task_struct *p) |
2071 | { | 2100 | { |
2072 | return p->normal_prio; | 2101 | return p->normal_prio; |
2073 | } | 2102 | } |
2074 | # define rt_mutex_adjust_pi(p) do { } while (0) | 2103 | # define rt_mutex_adjust_pi(p) do { } while (0) |
2104 | static inline bool tsk_is_pi_blocked(struct task_struct *tsk) | ||
2105 | { | ||
2106 | return false; | ||
2107 | } | ||
2075 | #endif | 2108 | #endif |
2076 | 2109 | ||
2077 | extern bool yield_to(struct task_struct *p, bool preempt); | 2110 | extern bool yield_to(struct task_struct *p, bool preempt); |
@@ -2371,7 +2404,7 @@ static inline int thread_group_empty(struct task_struct *p) | |||
2371 | * Protects ->fs, ->files, ->mm, ->group_info, ->comm, keyring | 2404 | * Protects ->fs, ->files, ->mm, ->group_info, ->comm, keyring |
2372 | * subscriptions and synchronises with wait4(). Also used in procfs. Also | 2405 | * subscriptions and synchronises with wait4(). Also used in procfs. Also |
2373 | * pins the final release of task.io_context. Also protects ->cpuset and | 2406 | * pins the final release of task.io_context. Also protects ->cpuset and |
2374 | * ->cgroup.subsys[]. | 2407 | * ->cgroup.subsys[]. And ->vfork_done. |
2375 | * | 2408 | * |
2376 | * Nests both inside and outside of read_lock(&tasklist_lock). | 2409 | * Nests both inside and outside of read_lock(&tasklist_lock). |
2377 | * It must not be nested with write_lock_irq(&tasklist_lock), | 2410 | * It must not be nested with write_lock_irq(&tasklist_lock), |
@@ -2390,12 +2423,15 @@ static inline void task_unlock(struct task_struct *p) | |||
2390 | extern struct sighand_struct *__lock_task_sighand(struct task_struct *tsk, | 2423 | extern struct sighand_struct *__lock_task_sighand(struct task_struct *tsk, |
2391 | unsigned long *flags); | 2424 | unsigned long *flags); |
2392 | 2425 | ||
2393 | #define lock_task_sighand(tsk, flags) \ | 2426 | static inline struct sighand_struct *lock_task_sighand(struct task_struct *tsk, |
2394 | ({ struct sighand_struct *__ss; \ | 2427 | unsigned long *flags) |
2395 | __cond_lock(&(tsk)->sighand->siglock, \ | 2428 | { |
2396 | (__ss = __lock_task_sighand(tsk, flags))); \ | 2429 | struct sighand_struct *ret; |
2397 | __ss; \ | 2430 | |
2398 | }) \ | 2431 | ret = __lock_task_sighand(tsk, flags); |
2432 | (void)__cond_lock(&tsk->sighand->siglock, ret); | ||
2433 | return ret; | ||
2434 | } | ||
2399 | 2435 | ||
2400 | static inline void unlock_task_sighand(struct task_struct *tsk, | 2436 | static inline void unlock_task_sighand(struct task_struct *tsk, |
2401 | unsigned long *flags) | 2437 | unsigned long *flags) |
diff --git a/include/linux/security.h b/include/linux/security.h index 83c18e8c846d..673afbb8238a 100644 --- a/include/linux/security.h +++ b/include/linux/security.h | |||
@@ -22,22 +22,36 @@ | |||
22 | #ifndef __LINUX_SECURITY_H | 22 | #ifndef __LINUX_SECURITY_H |
23 | #define __LINUX_SECURITY_H | 23 | #define __LINUX_SECURITY_H |
24 | 24 | ||
25 | #include <linux/fs.h> | ||
26 | #include <linux/fsnotify.h> | ||
27 | #include <linux/binfmts.h> | ||
28 | #include <linux/dcache.h> | ||
29 | #include <linux/signal.h> | ||
30 | #include <linux/resource.h> | ||
31 | #include <linux/sem.h> | ||
32 | #include <linux/shm.h> | ||
33 | #include <linux/mm.h> /* PAGE_ALIGN */ | ||
34 | #include <linux/msg.h> | ||
35 | #include <linux/sched.h> | ||
36 | #include <linux/key.h> | 25 | #include <linux/key.h> |
37 | #include <linux/xfrm.h> | 26 | #include <linux/capability.h> |
38 | #include <linux/slab.h> | 27 | #include <linux/slab.h> |
39 | #include <linux/xattr.h> | 28 | #include <linux/err.h> |
40 | #include <net/flow.h> | 29 | |
30 | struct linux_binprm; | ||
31 | struct cred; | ||
32 | struct rlimit; | ||
33 | struct siginfo; | ||
34 | struct sem_array; | ||
35 | struct sembuf; | ||
36 | struct kern_ipc_perm; | ||
37 | struct audit_context; | ||
38 | struct super_block; | ||
39 | struct inode; | ||
40 | struct dentry; | ||
41 | struct file; | ||
42 | struct vfsmount; | ||
43 | struct path; | ||
44 | struct qstr; | ||
45 | struct nameidata; | ||
46 | struct iattr; | ||
47 | struct fown_struct; | ||
48 | struct file_operations; | ||
49 | struct shmid_kernel; | ||
50 | struct msg_msg; | ||
51 | struct msg_queue; | ||
52 | struct xattr; | ||
53 | struct xfrm_sec_ctx; | ||
54 | struct mm_struct; | ||
41 | 55 | ||
42 | /* Maximum number of letters for an LSM name string */ | 56 | /* Maximum number of letters for an LSM name string */ |
43 | #define SECURITY_NAME_MAX 10 | 57 | #define SECURITY_NAME_MAX 10 |
@@ -49,6 +63,7 @@ | |||
49 | struct ctl_table; | 63 | struct ctl_table; |
50 | struct audit_krule; | 64 | struct audit_krule; |
51 | struct user_namespace; | 65 | struct user_namespace; |
66 | struct timezone; | ||
52 | 67 | ||
53 | /* | 68 | /* |
54 | * These functions are in security/capability.c and are used | 69 | * These functions are in security/capability.c and are used |
@@ -131,18 +146,6 @@ struct request_sock; | |||
131 | #define LSM_UNSAFE_PTRACE_CAP 4 | 146 | #define LSM_UNSAFE_PTRACE_CAP 4 |
132 | 147 | ||
133 | #ifdef CONFIG_MMU | 148 | #ifdef CONFIG_MMU |
134 | /* | ||
135 | * If a hint addr is less than mmap_min_addr change hint to be as | ||
136 | * low as possible but still greater than mmap_min_addr | ||
137 | */ | ||
138 | static inline unsigned long round_hint_to_min(unsigned long hint) | ||
139 | { | ||
140 | hint &= PAGE_MASK; | ||
141 | if (((void *)hint != NULL) && | ||
142 | (hint < mmap_min_addr)) | ||
143 | return PAGE_ALIGN(mmap_min_addr); | ||
144 | return hint; | ||
145 | } | ||
146 | extern int mmap_min_addr_handler(struct ctl_table *table, int write, | 149 | extern int mmap_min_addr_handler(struct ctl_table *table, int write, |
147 | void __user *buffer, size_t *lenp, loff_t *ppos); | 150 | void __user *buffer, size_t *lenp, loff_t *ppos); |
148 | #endif | 151 | #endif |
@@ -651,6 +654,10 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts) | |||
651 | * manual page for definitions of the @clone_flags. | 654 | * manual page for definitions of the @clone_flags. |
652 | * @clone_flags contains the flags indicating what should be shared. | 655 | * @clone_flags contains the flags indicating what should be shared. |
653 | * Return 0 if permission is granted. | 656 | * Return 0 if permission is granted. |
657 | * @task_free: | ||
658 | * @task task being freed | ||
659 | * Handle release of task-related resources. (Note that this can be called | ||
660 | * from interrupt context.) | ||
654 | * @cred_alloc_blank: | 661 | * @cred_alloc_blank: |
655 | * @cred points to the credentials. | 662 | * @cred points to the credentials. |
656 | * @gfp indicates the atomicity of any memory allocations. | 663 | * @gfp indicates the atomicity of any memory allocations. |
@@ -812,7 +819,7 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts) | |||
812 | * Check permissions before connecting or sending datagrams from @sock to | 819 | * Check permissions before connecting or sending datagrams from @sock to |
813 | * @other. | 820 | * @other. |
814 | * @sock contains the socket structure. | 821 | * @sock contains the socket structure. |
815 | * @sock contains the peer socket structure. | 822 | * @other contains the peer socket structure. |
816 | * Return 0 if permission is granted. | 823 | * Return 0 if permission is granted. |
817 | * | 824 | * |
818 | * The @unix_stream_connect and @unix_may_send hooks were necessary because | 825 | * The @unix_stream_connect and @unix_may_send hooks were necessary because |
@@ -1493,6 +1500,7 @@ struct security_operations { | |||
1493 | int (*dentry_open) (struct file *file, const struct cred *cred); | 1500 | int (*dentry_open) (struct file *file, const struct cred *cred); |
1494 | 1501 | ||
1495 | int (*task_create) (unsigned long clone_flags); | 1502 | int (*task_create) (unsigned long clone_flags); |
1503 | void (*task_free) (struct task_struct *task); | ||
1496 | int (*cred_alloc_blank) (struct cred *cred, gfp_t gfp); | 1504 | int (*cred_alloc_blank) (struct cred *cred, gfp_t gfp); |
1497 | void (*cred_free) (struct cred *cred); | 1505 | void (*cred_free) (struct cred *cred); |
1498 | int (*cred_prepare)(struct cred *new, const struct cred *old, | 1506 | int (*cred_prepare)(struct cred *new, const struct cred *old, |
@@ -1674,9 +1682,7 @@ int security_quotactl(int cmds, int type, int id, struct super_block *sb); | |||
1674 | int security_quota_on(struct dentry *dentry); | 1682 | int security_quota_on(struct dentry *dentry); |
1675 | int security_syslog(int type); | 1683 | int security_syslog(int type); |
1676 | int security_settime(const struct timespec *ts, const struct timezone *tz); | 1684 | int security_settime(const struct timespec *ts, const struct timezone *tz); |
1677 | int security_vm_enough_memory(long pages); | ||
1678 | int security_vm_enough_memory_mm(struct mm_struct *mm, long pages); | 1685 | int security_vm_enough_memory_mm(struct mm_struct *mm, long pages); |
1679 | int security_vm_enough_memory_kern(long pages); | ||
1680 | int security_bprm_set_creds(struct linux_binprm *bprm); | 1686 | int security_bprm_set_creds(struct linux_binprm *bprm); |
1681 | int security_bprm_check(struct linux_binprm *bprm); | 1687 | int security_bprm_check(struct linux_binprm *bprm); |
1682 | void security_bprm_committing_creds(struct linux_binprm *bprm); | 1688 | void security_bprm_committing_creds(struct linux_binprm *bprm); |
@@ -1752,6 +1758,7 @@ int security_file_send_sigiotask(struct task_struct *tsk, | |||
1752 | int security_file_receive(struct file *file); | 1758 | int security_file_receive(struct file *file); |
1753 | int security_dentry_open(struct file *file, const struct cred *cred); | 1759 | int security_dentry_open(struct file *file, const struct cred *cred); |
1754 | int security_task_create(unsigned long clone_flags); | 1760 | int security_task_create(unsigned long clone_flags); |
1761 | void security_task_free(struct task_struct *task); | ||
1755 | int security_cred_alloc_blank(struct cred *cred, gfp_t gfp); | 1762 | int security_cred_alloc_blank(struct cred *cred, gfp_t gfp); |
1756 | void security_cred_free(struct cred *cred); | 1763 | void security_cred_free(struct cred *cred); |
1757 | int security_prepare_creds(struct cred *new, const struct cred *old, gfp_t gfp); | 1764 | int security_prepare_creds(struct cred *new, const struct cred *old, gfp_t gfp); |
@@ -1896,25 +1903,11 @@ static inline int security_settime(const struct timespec *ts, | |||
1896 | return cap_settime(ts, tz); | 1903 | return cap_settime(ts, tz); |
1897 | } | 1904 | } |
1898 | 1905 | ||
1899 | static inline int security_vm_enough_memory(long pages) | ||
1900 | { | ||
1901 | WARN_ON(current->mm == NULL); | ||
1902 | return cap_vm_enough_memory(current->mm, pages); | ||
1903 | } | ||
1904 | |||
1905 | static inline int security_vm_enough_memory_mm(struct mm_struct *mm, long pages) | 1906 | static inline int security_vm_enough_memory_mm(struct mm_struct *mm, long pages) |
1906 | { | 1907 | { |
1907 | WARN_ON(mm == NULL); | ||
1908 | return cap_vm_enough_memory(mm, pages); | 1908 | return cap_vm_enough_memory(mm, pages); |
1909 | } | 1909 | } |
1910 | 1910 | ||
1911 | static inline int security_vm_enough_memory_kern(long pages) | ||
1912 | { | ||
1913 | /* If current->mm is a kernel thread then we will pass NULL, | ||
1914 | for this specific case that is fine */ | ||
1915 | return cap_vm_enough_memory(current->mm, pages); | ||
1916 | } | ||
1917 | |||
1918 | static inline int security_bprm_set_creds(struct linux_binprm *bprm) | 1911 | static inline int security_bprm_set_creds(struct linux_binprm *bprm) |
1919 | { | 1912 | { |
1920 | return cap_bprm_set_creds(bprm); | 1913 | return cap_bprm_set_creds(bprm); |
@@ -2245,6 +2238,9 @@ static inline int security_task_create(unsigned long clone_flags) | |||
2245 | return 0; | 2238 | return 0; |
2246 | } | 2239 | } |
2247 | 2240 | ||
2241 | static inline void security_task_free(struct task_struct *task) | ||
2242 | { } | ||
2243 | |||
2248 | static inline int security_cred_alloc_blank(struct cred *cred, gfp_t gfp) | 2244 | static inline int security_cred_alloc_blank(struct cred *cred, gfp_t gfp) |
2249 | { | 2245 | { |
2250 | return 0; | 2246 | return 0; |
diff --git a/include/linux/seq_file.h b/include/linux/seq_file.h index 44f1514b00ba..fc61854f6224 100644 --- a/include/linux/seq_file.h +++ b/include/linux/seq_file.h | |||
@@ -3,6 +3,7 @@ | |||
3 | 3 | ||
4 | #include <linux/types.h> | 4 | #include <linux/types.h> |
5 | #include <linux/string.h> | 5 | #include <linux/string.h> |
6 | #include <linux/bug.h> | ||
6 | #include <linux/mutex.h> | 7 | #include <linux/mutex.h> |
7 | #include <linux/cpumask.h> | 8 | #include <linux/cpumask.h> |
8 | #include <linux/nodemask.h> | 9 | #include <linux/nodemask.h> |
@@ -121,9 +122,12 @@ int single_release(struct inode *, struct file *); | |||
121 | void *__seq_open_private(struct file *, const struct seq_operations *, int); | 122 | void *__seq_open_private(struct file *, const struct seq_operations *, int); |
122 | int seq_open_private(struct file *, const struct seq_operations *, int); | 123 | int seq_open_private(struct file *, const struct seq_operations *, int); |
123 | int seq_release_private(struct inode *, struct file *); | 124 | int seq_release_private(struct inode *, struct file *); |
125 | int seq_put_decimal_ull(struct seq_file *m, char delimiter, | ||
126 | unsigned long long num); | ||
127 | int seq_put_decimal_ll(struct seq_file *m, char delimiter, | ||
128 | long long num); | ||
124 | 129 | ||
125 | #define SEQ_START_TOKEN ((void *)1) | 130 | #define SEQ_START_TOKEN ((void *)1) |
126 | |||
127 | /* | 131 | /* |
128 | * Helpers for iteration over list_head-s in seq_files | 132 | * Helpers for iteration over list_head-s in seq_files |
129 | */ | 133 | */ |
diff --git a/include/linux/serial.h b/include/linux/serial.h index 3d86517fe7d5..441980ecc4e5 100644 --- a/include/linux/serial.h +++ b/include/linux/serial.h | |||
@@ -152,8 +152,8 @@ struct serial_uart_config { | |||
152 | #define ASYNC_AUTOPROBE (1U << ASYNCB_AUTOPROBE) | 152 | #define ASYNC_AUTOPROBE (1U << ASYNCB_AUTOPROBE) |
153 | 153 | ||
154 | #define ASYNC_FLAGS ((1U << (ASYNCB_LAST_USER + 1)) - 1) | 154 | #define ASYNC_FLAGS ((1U << (ASYNCB_LAST_USER + 1)) - 1) |
155 | #define ASYNC_USR_MASK (ASYNC_SPD_HI|ASYNC_SPD_VHI| \ | 155 | #define ASYNC_USR_MASK (ASYNC_SPD_MASK|ASYNC_CALLOUT_NOHUP| \ |
156 | ASYNC_CALLOUT_NOHUP|ASYNC_SPD_SHI|ASYNC_LOW_LATENCY) | 156 | ASYNC_LOW_LATENCY) |
157 | #define ASYNC_SPD_CUST (ASYNC_SPD_HI|ASYNC_SPD_VHI) | 157 | #define ASYNC_SPD_CUST (ASYNC_SPD_HI|ASYNC_SPD_VHI) |
158 | #define ASYNC_SPD_WARP (ASYNC_SPD_HI|ASYNC_SPD_SHI) | 158 | #define ASYNC_SPD_WARP (ASYNC_SPD_HI|ASYNC_SPD_SHI) |
159 | #define ASYNC_SPD_MASK (ASYNC_SPD_HI|ASYNC_SPD_VHI|ASYNC_SPD_SHI) | 159 | #define ASYNC_SPD_MASK (ASYNC_SPD_HI|ASYNC_SPD_VHI|ASYNC_SPD_SHI) |
diff --git a/include/linux/serialP.h b/include/linux/serialP.h deleted file mode 100644 index e811a615f696..000000000000 --- a/include/linux/serialP.h +++ /dev/null | |||
@@ -1,142 +0,0 @@ | |||
1 | /* | ||
2 | * Private header file for the (dumb) serial driver | ||
3 | * | ||
4 | * Copyright (C) 1997 by Theodore Ts'o. | ||
5 | * | ||
6 | * Redistribution of this file is permitted under the terms of the GNU | ||
7 | * Public License (GPL) | ||
8 | */ | ||
9 | |||
10 | #ifndef _LINUX_SERIALP_H | ||
11 | #define _LINUX_SERIALP_H | ||
12 | |||
13 | /* | ||
14 | * This is our internal structure for each serial port's state. | ||
15 | * | ||
16 | * Many fields are paralleled by the structure used by the serial_struct | ||
17 | * structure. | ||
18 | * | ||
19 | * For definitions of the flags field, see tty.h | ||
20 | */ | ||
21 | |||
22 | #include <linux/termios.h> | ||
23 | #include <linux/workqueue.h> | ||
24 | #include <linux/interrupt.h> | ||
25 | #include <linux/circ_buf.h> | ||
26 | #include <linux/wait.h> | ||
27 | |||
28 | struct serial_state { | ||
29 | int magic; | ||
30 | int baud_base; | ||
31 | unsigned long port; | ||
32 | int irq; | ||
33 | int flags; | ||
34 | int hub6; | ||
35 | int type; | ||
36 | int line; | ||
37 | int revision; /* Chip revision (950) */ | ||
38 | int xmit_fifo_size; | ||
39 | int custom_divisor; | ||
40 | int count; | ||
41 | u8 *iomem_base; | ||
42 | u16 iomem_reg_shift; | ||
43 | unsigned short close_delay; | ||
44 | unsigned short closing_wait; /* time to wait before closing */ | ||
45 | struct async_icount icount; | ||
46 | int io_type; | ||
47 | struct async_struct *info; | ||
48 | struct pci_dev *dev; | ||
49 | }; | ||
50 | |||
51 | struct async_struct { | ||
52 | int magic; | ||
53 | unsigned long port; | ||
54 | int hub6; | ||
55 | int flags; | ||
56 | int xmit_fifo_size; | ||
57 | struct serial_state *state; | ||
58 | struct tty_struct *tty; | ||
59 | int read_status_mask; | ||
60 | int ignore_status_mask; | ||
61 | int timeout; | ||
62 | int quot; | ||
63 | int x_char; /* xon/xoff character */ | ||
64 | int close_delay; | ||
65 | unsigned short closing_wait; | ||
66 | unsigned short closing_wait2; /* obsolete */ | ||
67 | int IER; /* Interrupt Enable Register */ | ||
68 | int MCR; /* Modem control register */ | ||
69 | int LCR; /* Line control register */ | ||
70 | int ACR; /* 16950 Additional Control Reg. */ | ||
71 | unsigned long event; | ||
72 | unsigned long last_active; | ||
73 | int line; | ||
74 | int blocked_open; /* # of blocked opens */ | ||
75 | struct circ_buf xmit; | ||
76 | spinlock_t xmit_lock; | ||
77 | u8 *iomem_base; | ||
78 | u16 iomem_reg_shift; | ||
79 | int io_type; | ||
80 | struct work_struct work; | ||
81 | struct tasklet_struct tlet; | ||
82 | #ifdef DECLARE_WAITQUEUE | ||
83 | wait_queue_head_t open_wait; | ||
84 | wait_queue_head_t close_wait; | ||
85 | wait_queue_head_t delta_msr_wait; | ||
86 | #else | ||
87 | struct wait_queue *open_wait; | ||
88 | struct wait_queue *close_wait; | ||
89 | struct wait_queue *delta_msr_wait; | ||
90 | #endif | ||
91 | struct async_struct *next_port; /* For the linked list */ | ||
92 | struct async_struct *prev_port; | ||
93 | }; | ||
94 | |||
95 | #define CONFIGURED_SERIAL_PORT(info) ((info)->port || ((info)->iomem_base)) | ||
96 | |||
97 | #define SERIAL_MAGIC 0x5301 | ||
98 | #define SSTATE_MAGIC 0x5302 | ||
99 | |||
100 | /* | ||
101 | * Events are used to schedule things to happen at timer-interrupt | ||
102 | * time, instead of at rs interrupt time. | ||
103 | */ | ||
104 | #define RS_EVENT_WRITE_WAKEUP 0 | ||
105 | |||
106 | /* | ||
107 | * Multiport serial configuration structure --- internal structure | ||
108 | */ | ||
109 | struct rs_multiport_struct { | ||
110 | int port1; | ||
111 | unsigned char mask1, match1; | ||
112 | int port2; | ||
113 | unsigned char mask2, match2; | ||
114 | int port3; | ||
115 | unsigned char mask3, match3; | ||
116 | int port4; | ||
117 | unsigned char mask4, match4; | ||
118 | int port_monitor; | ||
119 | }; | ||
120 | |||
121 | #if defined(__alpha__) && !defined(CONFIG_PCI) | ||
122 | /* | ||
123 | * Digital did something really horribly wrong with the OUT1 and OUT2 | ||
124 | * lines on at least some ALPHA's. The failure mode is that if either | ||
125 | * is cleared, the machine locks up with endless interrupts. | ||
126 | * | ||
127 | * This is still used by arch/mips/au1000/common/serial.c for some weird | ||
128 | * reason (mips != alpha!) | ||
129 | */ | ||
130 | #define ALPHA_KLUDGE_MCR (UART_MCR_OUT2 | UART_MCR_OUT1) | ||
131 | #elif defined(CONFIG_SBC8560) | ||
132 | /* | ||
133 | * WindRiver did something similarly broken on their SBC8560 board. The | ||
134 | * UART tristates its IRQ output while OUT2 is clear, but they pulled | ||
135 | * the interrupt line _up_ instead of down, so if we register the IRQ | ||
136 | * while the UART is in that state, we die in an IRQ storm. */ | ||
137 | #define ALPHA_KLUDGE_MCR (UART_MCR_OUT2) | ||
138 | #else | ||
139 | #define ALPHA_KLUDGE_MCR 0 | ||
140 | #endif | ||
141 | |||
142 | #endif /* _LINUX_SERIAL_H */ | ||
diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h index c91ace70c21d..2db407a40051 100644 --- a/include/linux/serial_core.h +++ b/include/linux/serial_core.h | |||
@@ -210,6 +210,8 @@ | |||
210 | /* Atheros AR933X SoC */ | 210 | /* Atheros AR933X SoC */ |
211 | #define PORT_AR933X 99 | 211 | #define PORT_AR933X 99 |
212 | 212 | ||
213 | /* Energy Micro efm32 SoC */ | ||
214 | #define PORT_EFMUART 100 | ||
213 | 215 | ||
214 | #ifdef __KERNEL__ | 216 | #ifdef __KERNEL__ |
215 | 217 | ||
@@ -355,7 +357,7 @@ struct uart_port { | |||
355 | #define UPF_CONS_FLOW ((__force upf_t) (1 << 23)) | 357 | #define UPF_CONS_FLOW ((__force upf_t) (1 << 23)) |
356 | #define UPF_SHARE_IRQ ((__force upf_t) (1 << 24)) | 358 | #define UPF_SHARE_IRQ ((__force upf_t) (1 << 24)) |
357 | #define UPF_EXAR_EFR ((__force upf_t) (1 << 25)) | 359 | #define UPF_EXAR_EFR ((__force upf_t) (1 << 25)) |
358 | #define UPF_IIR_ONCE ((__force upf_t) (1 << 26)) | 360 | #define UPF_BUG_THRE ((__force upf_t) (1 << 26)) |
359 | /* The exact UART type is known and should not be probed. */ | 361 | /* The exact UART type is known and should not be probed. */ |
360 | #define UPF_FIXED_TYPE ((__force upf_t) (1 << 27)) | 362 | #define UPF_FIXED_TYPE ((__force upf_t) (1 << 27)) |
361 | #define UPF_BOOT_AUTOCONF ((__force upf_t) (1 << 28)) | 363 | #define UPF_BOOT_AUTOCONF ((__force upf_t) (1 << 28)) |
@@ -381,6 +383,16 @@ struct uart_port { | |||
381 | void *private_data; /* generic platform data pointer */ | 383 | void *private_data; /* generic platform data pointer */ |
382 | }; | 384 | }; |
383 | 385 | ||
386 | static inline int serial_port_in(struct uart_port *up, int offset) | ||
387 | { | ||
388 | return up->serial_in(up, offset); | ||
389 | } | ||
390 | |||
391 | static inline void serial_port_out(struct uart_port *up, int offset, int value) | ||
392 | { | ||
393 | up->serial_out(up, offset, value); | ||
394 | } | ||
395 | |||
384 | /* | 396 | /* |
385 | * This is the state information which is persistent across opens. | 397 | * This is the state information which is persistent across opens. |
386 | */ | 398 | */ |
diff --git a/include/linux/serial_pnx8xxx.h b/include/linux/serial_pnx8xxx.h index de6c19c7f340..79ad87b0be3e 100644 --- a/include/linux/serial_pnx8xxx.h +++ b/include/linux/serial_pnx8xxx.h | |||
@@ -20,7 +20,6 @@ | |||
20 | #define _LINUX_SERIAL_PNX8XXX_H | 20 | #define _LINUX_SERIAL_PNX8XXX_H |
21 | 21 | ||
22 | #include <linux/serial_core.h> | 22 | #include <linux/serial_core.h> |
23 | #include <linux/device.h> | ||
24 | 23 | ||
25 | #define PNX8XXX_NR_PORTS 2 | 24 | #define PNX8XXX_NR_PORTS 2 |
26 | 25 | ||
diff --git a/include/linux/sh_clk.h b/include/linux/sh_clk.h index 54341d811685..0a9d8f2ac519 100644 --- a/include/linux/sh_clk.h +++ b/include/linux/sh_clk.h | |||
@@ -18,7 +18,8 @@ struct clk_mapping { | |||
18 | struct kref ref; | 18 | struct kref ref; |
19 | }; | 19 | }; |
20 | 20 | ||
21 | struct clk_ops { | 21 | |
22 | struct sh_clk_ops { | ||
22 | #ifdef CONFIG_SH_CLK_CPG_LEGACY | 23 | #ifdef CONFIG_SH_CLK_CPG_LEGACY |
23 | void (*init)(struct clk *clk); | 24 | void (*init)(struct clk *clk); |
24 | #endif | 25 | #endif |
@@ -37,7 +38,7 @@ struct clk { | |||
37 | unsigned short parent_num; /* choose between */ | 38 | unsigned short parent_num; /* choose between */ |
38 | unsigned char src_shift; /* source clock field in the */ | 39 | unsigned char src_shift; /* source clock field in the */ |
39 | unsigned char src_width; /* configuration register */ | 40 | unsigned char src_width; /* configuration register */ |
40 | struct clk_ops *ops; | 41 | struct sh_clk_ops *ops; |
41 | 42 | ||
42 | struct list_head children; | 43 | struct list_head children; |
43 | struct list_head sibling; /* node for children */ | 44 | struct list_head sibling; /* node for children */ |
diff --git a/include/linux/sh_eth.h b/include/linux/sh_eth.h index 2076acf8294d..b17d765ded84 100644 --- a/include/linux/sh_eth.h +++ b/include/linux/sh_eth.h | |||
@@ -20,6 +20,7 @@ struct sh_eth_plat_data { | |||
20 | unsigned char mac_addr[6]; | 20 | unsigned char mac_addr[6]; |
21 | unsigned no_ether_link:1; | 21 | unsigned no_ether_link:1; |
22 | unsigned ether_link_active_low:1; | 22 | unsigned ether_link_active_low:1; |
23 | unsigned needs_init:1; | ||
23 | }; | 24 | }; |
24 | 25 | ||
25 | #endif | 26 | #endif |
diff --git a/include/linux/sh_intc.h b/include/linux/sh_intc.h index b160645f5599..6aed0805927f 100644 --- a/include/linux/sh_intc.h +++ b/include/linux/sh_intc.h | |||
@@ -3,6 +3,23 @@ | |||
3 | 3 | ||
4 | #include <linux/ioport.h> | 4 | #include <linux/ioport.h> |
5 | 5 | ||
6 | #ifdef CONFIG_SUPERH | ||
7 | #define INTC_NR_IRQS 512 | ||
8 | #else | ||
9 | #define INTC_NR_IRQS 1024 | ||
10 | #endif | ||
11 | |||
12 | /* | ||
13 | * Convert back and forth between INTEVT and IRQ values. | ||
14 | */ | ||
15 | #ifdef CONFIG_CPU_HAS_INTEVT | ||
16 | #define evt2irq(evt) (((evt) >> 5) - 16) | ||
17 | #define irq2evt(irq) (((irq) + 16) << 5) | ||
18 | #else | ||
19 | #define evt2irq(evt) (evt) | ||
20 | #define irq2evt(irq) (irq) | ||
21 | #endif | ||
22 | |||
6 | typedef unsigned char intc_enum; | 23 | typedef unsigned char intc_enum; |
7 | 24 | ||
8 | struct intc_vect { | 25 | struct intc_vect { |
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index ae86adee3746..70a3f8d49118 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h | |||
@@ -18,6 +18,7 @@ | |||
18 | #include <linux/kmemcheck.h> | 18 | #include <linux/kmemcheck.h> |
19 | #include <linux/compiler.h> | 19 | #include <linux/compiler.h> |
20 | #include <linux/time.h> | 20 | #include <linux/time.h> |
21 | #include <linux/bug.h> | ||
21 | #include <linux/cache.h> | 22 | #include <linux/cache.h> |
22 | 23 | ||
23 | #include <linux/atomic.h> | 24 | #include <linux/atomic.h> |
@@ -94,6 +95,13 @@ | |||
94 | * about CHECKSUM_UNNECESSARY. 8) | 95 | * about CHECKSUM_UNNECESSARY. 8) |
95 | * NETIF_F_IPV6_CSUM about as dumb as the last one but does IPv6 instead. | 96 | * NETIF_F_IPV6_CSUM about as dumb as the last one but does IPv6 instead. |
96 | * | 97 | * |
98 | * UNNECESSARY: device will do per protocol specific csum. Protocol drivers | ||
99 | * that do not want net to perform the checksum calculation should use | ||
100 | * this flag in their outgoing skbs. | ||
101 | * NETIF_F_FCOE_CRC this indicates the device can do FCoE FC CRC | ||
102 | * offload. Correspondingly, the FCoE protocol driver | ||
103 | * stack should use CHECKSUM_UNNECESSARY. | ||
104 | * | ||
97 | * Any questions? No questions, good. --ANK | 105 | * Any questions? No questions, good. --ANK |
98 | */ | 106 | */ |
99 | 107 | ||
@@ -361,6 +369,7 @@ typedef unsigned char *sk_buff_data_t; | |||
361 | * ports. | 369 | * ports. |
362 | * @wifi_acked_valid: wifi_acked was set | 370 | * @wifi_acked_valid: wifi_acked was set |
363 | * @wifi_acked: whether frame was acked on wifi or not | 371 | * @wifi_acked: whether frame was acked on wifi or not |
372 | * @no_fcs: Request NIC to treat last 4 bytes as Ethernet FCS | ||
364 | * @dma_cookie: a cookie to one of several possible DMA operations | 373 | * @dma_cookie: a cookie to one of several possible DMA operations |
365 | * done by skb DMA functions | 374 | * done by skb DMA functions |
366 | * @secmark: security marking | 375 | * @secmark: security marking |
@@ -438,6 +447,11 @@ struct sk_buff { | |||
438 | #endif | 447 | #endif |
439 | 448 | ||
440 | int skb_iif; | 449 | int skb_iif; |
450 | |||
451 | __u32 rxhash; | ||
452 | |||
453 | __u16 vlan_tci; | ||
454 | |||
441 | #ifdef CONFIG_NET_SCHED | 455 | #ifdef CONFIG_NET_SCHED |
442 | __u16 tc_index; /* traffic control index */ | 456 | __u16 tc_index; /* traffic control index */ |
443 | #ifdef CONFIG_NET_CLS_ACT | 457 | #ifdef CONFIG_NET_CLS_ACT |
@@ -445,8 +459,6 @@ struct sk_buff { | |||
445 | #endif | 459 | #endif |
446 | #endif | 460 | #endif |
447 | 461 | ||
448 | __u32 rxhash; | ||
449 | |||
450 | __u16 queue_mapping; | 462 | __u16 queue_mapping; |
451 | kmemcheck_bitfield_begin(flags2); | 463 | kmemcheck_bitfield_begin(flags2); |
452 | #ifdef CONFIG_IPV6_NDISC_NODETYPE | 464 | #ifdef CONFIG_IPV6_NDISC_NODETYPE |
@@ -456,7 +468,8 @@ struct sk_buff { | |||
456 | __u8 l4_rxhash:1; | 468 | __u8 l4_rxhash:1; |
457 | __u8 wifi_acked_valid:1; | 469 | __u8 wifi_acked_valid:1; |
458 | __u8 wifi_acked:1; | 470 | __u8 wifi_acked:1; |
459 | /* 10/12 bit hole (depending on ndisc_nodetype presence) */ | 471 | __u8 no_fcs:1; |
472 | /* 9/11 bit hole (depending on ndisc_nodetype presence) */ | ||
460 | kmemcheck_bitfield_end(flags2); | 473 | kmemcheck_bitfield_end(flags2); |
461 | 474 | ||
462 | #ifdef CONFIG_NET_DMA | 475 | #ifdef CONFIG_NET_DMA |
@@ -468,10 +481,9 @@ struct sk_buff { | |||
468 | union { | 481 | union { |
469 | __u32 mark; | 482 | __u32 mark; |
470 | __u32 dropcount; | 483 | __u32 dropcount; |
484 | __u32 avail_size; | ||
471 | }; | 485 | }; |
472 | 486 | ||
473 | __u16 vlan_tci; | ||
474 | |||
475 | sk_buff_data_t transport_header; | 487 | sk_buff_data_t transport_header; |
476 | sk_buff_data_t network_header; | 488 | sk_buff_data_t network_header; |
477 | sk_buff_data_t mac_header; | 489 | sk_buff_data_t mac_header; |
@@ -490,7 +502,6 @@ struct sk_buff { | |||
490 | */ | 502 | */ |
491 | #include <linux/slab.h> | 503 | #include <linux/slab.h> |
492 | 504 | ||
493 | #include <asm/system.h> | ||
494 | 505 | ||
495 | /* | 506 | /* |
496 | * skb might have a dst pointer attached, refcounted or not. | 507 | * skb might have a dst pointer attached, refcounted or not. |
@@ -876,6 +887,24 @@ static inline struct sk_buff *skb_peek(const struct sk_buff_head *list_) | |||
876 | } | 887 | } |
877 | 888 | ||
878 | /** | 889 | /** |
890 | * skb_peek_next - peek skb following the given one from a queue | ||
891 | * @skb: skb to start from | ||
892 | * @list_: list to peek at | ||
893 | * | ||
894 | * Returns %NULL when the end of the list is met or a pointer to the | ||
895 | * next element. The reference count is not incremented and the | ||
896 | * reference is therefore volatile. Use with caution. | ||
897 | */ | ||
898 | static inline struct sk_buff *skb_peek_next(struct sk_buff *skb, | ||
899 | const struct sk_buff_head *list_) | ||
900 | { | ||
901 | struct sk_buff *next = skb->next; | ||
902 | if (next == (struct sk_buff *)list_) | ||
903 | next = NULL; | ||
904 | return next; | ||
905 | } | ||
906 | |||
907 | /** | ||
879 | * skb_peek_tail - peek at the tail of an &sk_buff_head | 908 | * skb_peek_tail - peek at the tail of an &sk_buff_head |
880 | * @list_: list to peek at | 909 | * @list_: list to peek at |
881 | * | 910 | * |
@@ -1152,7 +1181,7 @@ static inline struct sk_buff *__skb_dequeue_tail(struct sk_buff_head *list) | |||
1152 | } | 1181 | } |
1153 | 1182 | ||
1154 | 1183 | ||
1155 | static inline int skb_is_nonlinear(const struct sk_buff *skb) | 1184 | static inline bool skb_is_nonlinear(const struct sk_buff *skb) |
1156 | { | 1185 | { |
1157 | return skb->data_len; | 1186 | return skb->data_len; |
1158 | } | 1187 | } |
@@ -1216,7 +1245,7 @@ static inline void skb_fill_page_desc(struct sk_buff *skb, int i, | |||
1216 | } | 1245 | } |
1217 | 1246 | ||
1218 | extern void skb_add_rx_frag(struct sk_buff *skb, int i, struct page *page, | 1247 | extern void skb_add_rx_frag(struct sk_buff *skb, int i, struct page *page, |
1219 | int off, int size); | 1248 | int off, int size, unsigned int truesize); |
1220 | 1249 | ||
1221 | #define SKB_PAGE_ASSERT(skb) BUG_ON(skb_shinfo(skb)->nr_frags) | 1250 | #define SKB_PAGE_ASSERT(skb) BUG_ON(skb_shinfo(skb)->nr_frags) |
1222 | #define SKB_FRAG_ASSERT(skb) BUG_ON(skb_has_frag_list(skb)) | 1251 | #define SKB_FRAG_ASSERT(skb) BUG_ON(skb_has_frag_list(skb)) |
@@ -1338,6 +1367,18 @@ static inline int skb_tailroom(const struct sk_buff *skb) | |||
1338 | } | 1367 | } |
1339 | 1368 | ||
1340 | /** | 1369 | /** |
1370 | * skb_availroom - bytes at buffer end | ||
1371 | * @skb: buffer to check | ||
1372 | * | ||
1373 | * Return the number of bytes of free space at the tail of an sk_buff | ||
1374 | * allocated by sk_stream_alloc() | ||
1375 | */ | ||
1376 | static inline int skb_availroom(const struct sk_buff *skb) | ||
1377 | { | ||
1378 | return skb_is_nonlinear(skb) ? 0 : skb->avail_size - skb->len; | ||
1379 | } | ||
1380 | |||
1381 | /** | ||
1341 | * skb_reserve - adjust headroom | 1382 | * skb_reserve - adjust headroom |
1342 | * @skb: buffer to alter | 1383 | * @skb: buffer to alter |
1343 | * @len: bytes to move | 1384 | * @len: bytes to move |
@@ -2055,7 +2096,7 @@ static inline void skb_frag_add_head(struct sk_buff *skb, struct sk_buff *frag) | |||
2055 | for (iter = skb_shinfo(skb)->frag_list; iter; iter = iter->next) | 2096 | for (iter = skb_shinfo(skb)->frag_list; iter; iter = iter->next) |
2056 | 2097 | ||
2057 | extern struct sk_buff *__skb_recv_datagram(struct sock *sk, unsigned flags, | 2098 | extern struct sk_buff *__skb_recv_datagram(struct sock *sk, unsigned flags, |
2058 | int *peeked, int *err); | 2099 | int *peeked, int *off, int *err); |
2059 | extern struct sk_buff *skb_recv_datagram(struct sock *sk, unsigned flags, | 2100 | extern struct sk_buff *skb_recv_datagram(struct sock *sk, unsigned flags, |
2060 | int noblock, int *err); | 2101 | int noblock, int *err); |
2061 | extern unsigned int datagram_poll(struct file *file, struct socket *sock, | 2102 | extern unsigned int datagram_poll(struct file *file, struct socket *sock, |
@@ -2448,12 +2489,12 @@ static inline struct sec_path *skb_sec_path(struct sk_buff *skb) | |||
2448 | } | 2489 | } |
2449 | #endif | 2490 | #endif |
2450 | 2491 | ||
2451 | static inline int skb_is_gso(const struct sk_buff *skb) | 2492 | static inline bool skb_is_gso(const struct sk_buff *skb) |
2452 | { | 2493 | { |
2453 | return skb_shinfo(skb)->gso_size; | 2494 | return skb_shinfo(skb)->gso_size; |
2454 | } | 2495 | } |
2455 | 2496 | ||
2456 | static inline int skb_is_gso_v6(const struct sk_buff *skb) | 2497 | static inline bool skb_is_gso_v6(const struct sk_buff *skb) |
2457 | { | 2498 | { |
2458 | return skb_shinfo(skb)->gso_type & SKB_GSO_TCPV6; | 2499 | return skb_shinfo(skb)->gso_type & SKB_GSO_TCPV6; |
2459 | } | 2500 | } |
diff --git a/include/linux/slab.h b/include/linux/slab.h index 573c809c33d9..a595dce6b0c7 100644 --- a/include/linux/slab.h +++ b/include/linux/slab.h | |||
@@ -190,7 +190,7 @@ size_t ksize(const void *); | |||
190 | #endif | 190 | #endif |
191 | 191 | ||
192 | /** | 192 | /** |
193 | * kcalloc - allocate memory for an array. The memory is set to zero. | 193 | * kmalloc_array - allocate memory for an array. |
194 | * @n: number of elements. | 194 | * @n: number of elements. |
195 | * @size: element size. | 195 | * @size: element size. |
196 | * @flags: the type of memory to allocate. | 196 | * @flags: the type of memory to allocate. |
@@ -240,11 +240,22 @@ size_t ksize(const void *); | |||
240 | * for general use, and so are not documented here. For a full list of | 240 | * for general use, and so are not documented here. For a full list of |
241 | * potential flags, always refer to linux/gfp.h. | 241 | * potential flags, always refer to linux/gfp.h. |
242 | */ | 242 | */ |
243 | static inline void *kcalloc(size_t n, size_t size, gfp_t flags) | 243 | static inline void *kmalloc_array(size_t n, size_t size, gfp_t flags) |
244 | { | 244 | { |
245 | if (size != 0 && n > ULONG_MAX / size) | 245 | if (size != 0 && n > ULONG_MAX / size) |
246 | return NULL; | 246 | return NULL; |
247 | return __kmalloc(n * size, flags | __GFP_ZERO); | 247 | return __kmalloc(n * size, flags); |
248 | } | ||
249 | |||
250 | /** | ||
251 | * kcalloc - allocate memory for an array. The memory is set to zero. | ||
252 | * @n: number of elements. | ||
253 | * @size: element size. | ||
254 | * @flags: the type of memory to allocate (see kmalloc). | ||
255 | */ | ||
256 | static inline void *kcalloc(size_t n, size_t size, gfp_t flags) | ||
257 | { | ||
258 | return kmalloc_array(n, size, flags | __GFP_ZERO); | ||
248 | } | 259 | } |
249 | 260 | ||
250 | #if !defined(CONFIG_NUMA) && !defined(CONFIG_SLOB) | 261 | #if !defined(CONFIG_NUMA) && !defined(CONFIG_SLOB) |
diff --git a/include/linux/slub_def.h b/include/linux/slub_def.h index a32bcfdc7834..c2f8c8bc56ed 100644 --- a/include/linux/slub_def.h +++ b/include/linux/slub_def.h | |||
@@ -8,6 +8,7 @@ | |||
8 | */ | 8 | */ |
9 | #include <linux/types.h> | 9 | #include <linux/types.h> |
10 | #include <linux/gfp.h> | 10 | #include <linux/gfp.h> |
11 | #include <linux/bug.h> | ||
11 | #include <linux/workqueue.h> | 12 | #include <linux/workqueue.h> |
12 | #include <linux/kobject.h> | 13 | #include <linux/kobject.h> |
13 | 14 | ||
@@ -21,7 +22,7 @@ enum stat_item { | |||
21 | FREE_FROZEN, /* Freeing to frozen slab */ | 22 | FREE_FROZEN, /* Freeing to frozen slab */ |
22 | FREE_ADD_PARTIAL, /* Freeing moves slab to partial list */ | 23 | FREE_ADD_PARTIAL, /* Freeing moves slab to partial list */ |
23 | FREE_REMOVE_PARTIAL, /* Freeing removes last object */ | 24 | FREE_REMOVE_PARTIAL, /* Freeing removes last object */ |
24 | ALLOC_FROM_PARTIAL, /* Cpu slab acquired from partial list */ | 25 | ALLOC_FROM_PARTIAL, /* Cpu slab acquired from node partial list */ |
25 | ALLOC_SLAB, /* Cpu slab acquired from page allocator */ | 26 | ALLOC_SLAB, /* Cpu slab acquired from page allocator */ |
26 | ALLOC_REFILL, /* Refill cpu slab from slab freelist */ | 27 | ALLOC_REFILL, /* Refill cpu slab from slab freelist */ |
27 | ALLOC_NODE_MISMATCH, /* Switching cpu slab */ | 28 | ALLOC_NODE_MISMATCH, /* Switching cpu slab */ |
@@ -37,7 +38,9 @@ enum stat_item { | |||
37 | CMPXCHG_DOUBLE_CPU_FAIL,/* Failure of this_cpu_cmpxchg_double */ | 38 | CMPXCHG_DOUBLE_CPU_FAIL,/* Failure of this_cpu_cmpxchg_double */ |
38 | CMPXCHG_DOUBLE_FAIL, /* Number of times that cmpxchg double did not match */ | 39 | CMPXCHG_DOUBLE_FAIL, /* Number of times that cmpxchg double did not match */ |
39 | CPU_PARTIAL_ALLOC, /* Used cpu partial on alloc */ | 40 | CPU_PARTIAL_ALLOC, /* Used cpu partial on alloc */ |
40 | CPU_PARTIAL_FREE, /* USed cpu partial on free */ | 41 | CPU_PARTIAL_FREE, /* Refill cpu partial on free */ |
42 | CPU_PARTIAL_NODE, /* Refill cpu partial from node partial */ | ||
43 | CPU_PARTIAL_DRAIN, /* Drain cpu partial to node partial */ | ||
41 | NR_SLUB_STAT_ITEMS }; | 44 | NR_SLUB_STAT_ITEMS }; |
42 | 45 | ||
43 | struct kmem_cache_cpu { | 46 | struct kmem_cache_cpu { |
diff --git a/include/linux/smp.h b/include/linux/smp.h index 8cc38d3bab0c..10530d92c04b 100644 --- a/include/linux/smp.h +++ b/include/linux/smp.h | |||
@@ -102,6 +102,22 @@ static inline void call_function_init(void) { } | |||
102 | int on_each_cpu(smp_call_func_t func, void *info, int wait); | 102 | int on_each_cpu(smp_call_func_t func, void *info, int wait); |
103 | 103 | ||
104 | /* | 104 | /* |
105 | * Call a function on processors specified by mask, which might include | ||
106 | * the local one. | ||
107 | */ | ||
108 | void on_each_cpu_mask(const struct cpumask *mask, smp_call_func_t func, | ||
109 | void *info, bool wait); | ||
110 | |||
111 | /* | ||
112 | * Call a function on each processor for which the supplied function | ||
113 | * cond_func returns a positive value. This may include the local | ||
114 | * processor. | ||
115 | */ | ||
116 | void on_each_cpu_cond(bool (*cond_func)(int cpu, void *info), | ||
117 | smp_call_func_t func, void *info, bool wait, | ||
118 | gfp_t gfp_flags); | ||
119 | |||
120 | /* | ||
105 | * Mark the boot cpu "online" so that it can call console drivers in | 121 | * Mark the boot cpu "online" so that it can call console drivers in |
106 | * printk() and can access its per-cpu storage. | 122 | * printk() and can access its per-cpu storage. |
107 | */ | 123 | */ |
@@ -132,6 +148,36 @@ static inline int up_smp_call_function(smp_call_func_t func, void *info) | |||
132 | local_irq_enable(); \ | 148 | local_irq_enable(); \ |
133 | 0; \ | 149 | 0; \ |
134 | }) | 150 | }) |
151 | /* | ||
152 | * Note we still need to test the mask even for UP | ||
153 | * because we actually can get an empty mask from | ||
154 | * code that on SMP might call us without the local | ||
155 | * CPU in the mask. | ||
156 | */ | ||
157 | #define on_each_cpu_mask(mask, func, info, wait) \ | ||
158 | do { \ | ||
159 | if (cpumask_test_cpu(0, (mask))) { \ | ||
160 | local_irq_disable(); \ | ||
161 | (func)(info); \ | ||
162 | local_irq_enable(); \ | ||
163 | } \ | ||
164 | } while (0) | ||
165 | /* | ||
166 | * Preemption is disabled here to make sure the cond_func is called under the | ||
167 | * same condtions in UP and SMP. | ||
168 | */ | ||
169 | #define on_each_cpu_cond(cond_func, func, info, wait, gfp_flags)\ | ||
170 | do { \ | ||
171 | void *__info = (info); \ | ||
172 | preempt_disable(); \ | ||
173 | if ((cond_func)(0, __info)) { \ | ||
174 | local_irq_disable(); \ | ||
175 | (func)(__info); \ | ||
176 | local_irq_enable(); \ | ||
177 | } \ | ||
178 | preempt_enable(); \ | ||
179 | } while (0) | ||
180 | |||
135 | static inline void smp_send_reschedule(int cpu) { } | 181 | static inline void smp_send_reschedule(int cpu) { } |
136 | #define num_booting_cpus() 1 | 182 | #define num_booting_cpus() 1 |
137 | #define smp_prepare_boot_cpu() do {} while (0) | 183 | #define smp_prepare_boot_cpu() do {} while (0) |
diff --git a/include/linux/snmp.h b/include/linux/snmp.h index c1241c428179..2e68f5ba0389 100644 --- a/include/linux/snmp.h +++ b/include/linux/snmp.h | |||
@@ -232,6 +232,8 @@ enum | |||
232 | LINUX_MIB_TCPTIMEWAITOVERFLOW, /* TCPTimeWaitOverflow */ | 232 | LINUX_MIB_TCPTIMEWAITOVERFLOW, /* TCPTimeWaitOverflow */ |
233 | LINUX_MIB_TCPREQQFULLDOCOOKIES, /* TCPReqQFullDoCookies */ | 233 | LINUX_MIB_TCPREQQFULLDOCOOKIES, /* TCPReqQFullDoCookies */ |
234 | LINUX_MIB_TCPREQQFULLDROP, /* TCPReqQFullDrop */ | 234 | LINUX_MIB_TCPREQQFULLDROP, /* TCPReqQFullDrop */ |
235 | LINUX_MIB_TCPRETRANSFAIL, /* TCPRetransFail */ | ||
236 | LINUX_MIB_TCPRCVCOALESCE, /* TCPRcvCoalesce */ | ||
235 | __LINUX_MIB_MAX | 237 | __LINUX_MIB_MAX |
236 | }; | 238 | }; |
237 | 239 | ||
diff --git a/include/linux/socket.h b/include/linux/socket.h index d0e77f607a79..b84bbd48b874 100644 --- a/include/linux/socket.h +++ b/include/linux/socket.h | |||
@@ -265,7 +265,7 @@ struct ucred { | |||
265 | #define MSG_NOSIGNAL 0x4000 /* Do not generate SIGPIPE */ | 265 | #define MSG_NOSIGNAL 0x4000 /* Do not generate SIGPIPE */ |
266 | #define MSG_MORE 0x8000 /* Sender will send more */ | 266 | #define MSG_MORE 0x8000 /* Sender will send more */ |
267 | #define MSG_WAITFORONE 0x10000 /* recvmmsg(): block until 1+ packets avail */ | 267 | #define MSG_WAITFORONE 0x10000 /* recvmmsg(): block until 1+ packets avail */ |
268 | 268 | #define MSG_SENDPAGE_NOTLAST 0x20000 /* sendpage() internal : not the last page */ | |
269 | #define MSG_EOF MSG_FIN | 269 | #define MSG_EOF MSG_FIN |
270 | 270 | ||
271 | #define MSG_CMSG_CLOEXEC 0x40000000 /* Set close_on_exit for file | 271 | #define MSG_CMSG_CLOEXEC 0x40000000 /* Set close_on_exit for file |
@@ -326,11 +326,11 @@ extern int csum_partial_copy_fromiovecend(unsigned char *kdata, | |||
326 | int offset, | 326 | int offset, |
327 | unsigned int len, __wsum *csump); | 327 | unsigned int len, __wsum *csump); |
328 | 328 | ||
329 | extern int verify_iovec(struct msghdr *m, struct iovec *iov, struct sockaddr *address, int mode); | 329 | extern int verify_iovec(struct msghdr *m, struct iovec *iov, struct sockaddr_storage *address, int mode); |
330 | extern int memcpy_toiovec(struct iovec *v, unsigned char *kdata, int len); | 330 | extern int memcpy_toiovec(struct iovec *v, unsigned char *kdata, int len); |
331 | extern int memcpy_toiovecend(const struct iovec *v, unsigned char *kdata, | 331 | extern int memcpy_toiovecend(const struct iovec *v, unsigned char *kdata, |
332 | int offset, int len); | 332 | int offset, int len); |
333 | extern int move_addr_to_kernel(void __user *uaddr, int ulen, struct sockaddr *kaddr); | 333 | extern int move_addr_to_kernel(void __user *uaddr, int ulen, struct sockaddr_storage *kaddr); |
334 | extern int put_cmsg(struct msghdr*, int level, int type, int len, void *data); | 334 | extern int put_cmsg(struct msghdr*, int level, int type, int len, void *data); |
335 | 335 | ||
336 | struct timespec; | 336 | struct timespec; |
diff --git a/include/linux/spi/mmc_spi.h b/include/linux/spi/mmc_spi.h index 0f4eb165f254..32be8dbdf191 100644 --- a/include/linux/spi/mmc_spi.h +++ b/include/linux/spi/mmc_spi.h | |||
@@ -1,10 +1,10 @@ | |||
1 | #ifndef __LINUX_SPI_MMC_SPI_H | 1 | #ifndef __LINUX_SPI_MMC_SPI_H |
2 | #define __LINUX_SPI_MMC_SPI_H | 2 | #define __LINUX_SPI_MMC_SPI_H |
3 | 3 | ||
4 | #include <linux/device.h> | ||
5 | #include <linux/spi/spi.h> | 4 | #include <linux/spi/spi.h> |
6 | #include <linux/interrupt.h> | 5 | #include <linux/interrupt.h> |
7 | 6 | ||
7 | struct device; | ||
8 | struct mmc_host; | 8 | struct mmc_host; |
9 | 9 | ||
10 | /* Put this in platform_data of a device being used to manage an MMC/SD | 10 | /* Put this in platform_data of a device being used to manage an MMC/SD |
diff --git a/include/linux/spi/orion_spi.h b/include/linux/spi/orion_spi.h index decf6d8c77b7..b4d9fa6f797c 100644 --- a/include/linux/spi/orion_spi.h +++ b/include/linux/spi/orion_spi.h | |||
@@ -11,7 +11,6 @@ | |||
11 | 11 | ||
12 | struct orion_spi_info { | 12 | struct orion_spi_info { |
13 | u32 tclk; /* no <linux/clk.h> support yet */ | 13 | u32 tclk; /* no <linux/clk.h> support yet */ |
14 | u32 enable_clock_fix; | ||
15 | }; | 14 | }; |
16 | 15 | ||
17 | 16 | ||
diff --git a/include/linux/spi/s3c24xx.h b/include/linux/spi/s3c24xx.h new file mode 100644 index 000000000000..c23b923e493b --- /dev/null +++ b/include/linux/spi/s3c24xx.h | |||
@@ -0,0 +1,26 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2006 Simtec Electronics | ||
3 | * Ben Dooks <ben@simtec.co.uk> | ||
4 | * | ||
5 | * S3C2410 - SPI Controller platform_device info | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License version 2 as | ||
9 | * published by the Free Software Foundation. | ||
10 | */ | ||
11 | |||
12 | #ifndef __LINUX_SPI_S3C24XX_H | ||
13 | #define __LINUX_SPI_S3C24XX_H __FILE__ | ||
14 | |||
15 | struct s3c2410_spi_info { | ||
16 | int pin_cs; /* simple gpio cs */ | ||
17 | unsigned int num_cs; /* total chipselects */ | ||
18 | int bus_num; /* bus number to use. */ | ||
19 | |||
20 | unsigned int use_fiq:1; /* use fiq */ | ||
21 | |||
22 | void (*gpio_setup)(struct s3c2410_spi_info *spi, int enable); | ||
23 | void (*set_cs)(struct s3c2410_spi_info *spi, int cs, int pol); | ||
24 | }; | ||
25 | |||
26 | #endif /* __LINUX_SPI_S3C24XX_H */ | ||
diff --git a/include/linux/spi/sh_hspi.h b/include/linux/spi/sh_hspi.h new file mode 100644 index 000000000000..a1121f872ac1 --- /dev/null +++ b/include/linux/spi/sh_hspi.h | |||
@@ -0,0 +1,23 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2011 Kuninori Morimoto | ||
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; version 2 of the License. | ||
7 | * | ||
8 | * This program is distributed in the hope that it will be useful, | ||
9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
11 | * GNU General Public License for more details. | ||
12 | * | ||
13 | * You should have received a copy of the GNU General Public License | ||
14 | * along with this program; if not, write to the Free Software | ||
15 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | ||
16 | */ | ||
17 | #ifndef SH_HSPI_H | ||
18 | #define SH_HSPI_H | ||
19 | |||
20 | struct sh_hspi_info { | ||
21 | }; | ||
22 | |||
23 | #endif | ||
diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h index 176fce9cc6b1..98679b061b63 100644 --- a/include/linux/spi/spi.h +++ b/include/linux/spi/spi.h | |||
@@ -22,6 +22,7 @@ | |||
22 | #include <linux/device.h> | 22 | #include <linux/device.h> |
23 | #include <linux/mod_devicetable.h> | 23 | #include <linux/mod_devicetable.h> |
24 | #include <linux/slab.h> | 24 | #include <linux/slab.h> |
25 | #include <linux/kthread.h> | ||
25 | 26 | ||
26 | /* | 27 | /* |
27 | * INTERFACES between SPI master-side drivers and SPI infrastructure. | 28 | * INTERFACES between SPI master-side drivers and SPI infrastructure. |
@@ -235,6 +236,27 @@ static inline void spi_unregister_driver(struct spi_driver *sdrv) | |||
235 | * the device whose settings are being modified. | 236 | * the device whose settings are being modified. |
236 | * @transfer: adds a message to the controller's transfer queue. | 237 | * @transfer: adds a message to the controller's transfer queue. |
237 | * @cleanup: frees controller-specific state | 238 | * @cleanup: frees controller-specific state |
239 | * @queued: whether this master is providing an internal message queue | ||
240 | * @kworker: thread struct for message pump | ||
241 | * @kworker_task: pointer to task for message pump kworker thread | ||
242 | * @pump_messages: work struct for scheduling work to the message pump | ||
243 | * @queue_lock: spinlock to syncronise access to message queue | ||
244 | * @queue: message queue | ||
245 | * @cur_msg: the currently in-flight message | ||
246 | * @busy: message pump is busy | ||
247 | * @running: message pump is running | ||
248 | * @rt: whether this queue is set to run as a realtime task | ||
249 | * @prepare_transfer_hardware: a message will soon arrive from the queue | ||
250 | * so the subsystem requests the driver to prepare the transfer hardware | ||
251 | * by issuing this call | ||
252 | * @transfer_one_message: the subsystem calls the driver to transfer a single | ||
253 | * message while queuing transfers that arrive in the meantime. When the | ||
254 | * driver is finished with this message, it must call | ||
255 | * spi_finalize_current_message() so the subsystem can issue the next | ||
256 | * transfer | ||
257 | * @prepare_transfer_hardware: there are currently no more messages on the | ||
258 | * queue so the subsystem notifies the driver that it may relax the | ||
259 | * hardware by issuing this call | ||
238 | * | 260 | * |
239 | * Each SPI master controller can communicate with one or more @spi_device | 261 | * Each SPI master controller can communicate with one or more @spi_device |
240 | * children. These make a small bus, sharing MOSI, MISO and SCK signals | 262 | * children. These make a small bus, sharing MOSI, MISO and SCK signals |
@@ -318,6 +340,28 @@ struct spi_master { | |||
318 | 340 | ||
319 | /* called on release() to free memory provided by spi_master */ | 341 | /* called on release() to free memory provided by spi_master */ |
320 | void (*cleanup)(struct spi_device *spi); | 342 | void (*cleanup)(struct spi_device *spi); |
343 | |||
344 | /* | ||
345 | * These hooks are for drivers that want to use the generic | ||
346 | * master transfer queueing mechanism. If these are used, the | ||
347 | * transfer() function above must NOT be specified by the driver. | ||
348 | * Over time we expect SPI drivers to be phased over to this API. | ||
349 | */ | ||
350 | bool queued; | ||
351 | struct kthread_worker kworker; | ||
352 | struct task_struct *kworker_task; | ||
353 | struct kthread_work pump_messages; | ||
354 | spinlock_t queue_lock; | ||
355 | struct list_head queue; | ||
356 | struct spi_message *cur_msg; | ||
357 | bool busy; | ||
358 | bool running; | ||
359 | bool rt; | ||
360 | |||
361 | int (*prepare_transfer_hardware)(struct spi_master *master); | ||
362 | int (*transfer_one_message)(struct spi_master *master, | ||
363 | struct spi_message *mesg); | ||
364 | int (*unprepare_transfer_hardware)(struct spi_master *master); | ||
321 | }; | 365 | }; |
322 | 366 | ||
323 | static inline void *spi_master_get_devdata(struct spi_master *master) | 367 | static inline void *spi_master_get_devdata(struct spi_master *master) |
@@ -343,6 +387,13 @@ static inline void spi_master_put(struct spi_master *master) | |||
343 | put_device(&master->dev); | 387 | put_device(&master->dev); |
344 | } | 388 | } |
345 | 389 | ||
390 | /* PM calls that need to be issued by the driver */ | ||
391 | extern int spi_master_suspend(struct spi_master *master); | ||
392 | extern int spi_master_resume(struct spi_master *master); | ||
393 | |||
394 | /* Calls the driver make to interact with the message queue */ | ||
395 | extern struct spi_message *spi_get_next_queued_message(struct spi_master *master); | ||
396 | extern void spi_finalize_current_message(struct spi_master *master); | ||
346 | 397 | ||
347 | /* the spi driver core manages memory for the spi_master classdev */ | 398 | /* the spi driver core manages memory for the spi_master classdev */ |
348 | extern struct spi_master * | 399 | extern struct spi_master * |
@@ -549,7 +600,7 @@ static inline struct spi_message *spi_message_alloc(unsigned ntrans, gfp_t flags | |||
549 | + ntrans * sizeof(struct spi_transfer), | 600 | + ntrans * sizeof(struct spi_transfer), |
550 | flags); | 601 | flags); |
551 | if (m) { | 602 | if (m) { |
552 | int i; | 603 | unsigned i; |
553 | struct spi_transfer *t = (struct spi_transfer *)(m + 1); | 604 | struct spi_transfer *t = (struct spi_transfer *)(m + 1); |
554 | 605 | ||
555 | INIT_LIST_HEAD(&m->transfers); | 606 | INIT_LIST_HEAD(&m->transfers); |
diff --git a/include/linux/spinlock.h b/include/linux/spinlock.h index 7df6c17b0281..7d537ced949a 100644 --- a/include/linux/spinlock.h +++ b/include/linux/spinlock.h | |||
@@ -55,8 +55,8 @@ | |||
55 | #include <linux/kernel.h> | 55 | #include <linux/kernel.h> |
56 | #include <linux/stringify.h> | 56 | #include <linux/stringify.h> |
57 | #include <linux/bottom_half.h> | 57 | #include <linux/bottom_half.h> |
58 | #include <asm/barrier.h> | ||
58 | 59 | ||
59 | #include <asm/system.h> | ||
60 | 60 | ||
61 | /* | 61 | /* |
62 | * Must define these before including other files, inline functions need them | 62 | * Must define these before including other files, inline functions need them |
@@ -375,10 +375,7 @@ static inline int spin_can_lock(spinlock_t *lock) | |||
375 | return raw_spin_can_lock(&lock->rlock); | 375 | return raw_spin_can_lock(&lock->rlock); |
376 | } | 376 | } |
377 | 377 | ||
378 | static inline void assert_spin_locked(spinlock_t *lock) | 378 | #define assert_spin_locked(lock) assert_raw_spin_locked(&(lock)->rlock) |
379 | { | ||
380 | assert_raw_spin_locked(&lock->rlock); | ||
381 | } | ||
382 | 379 | ||
383 | /* | 380 | /* |
384 | * Pull the atomic_t declaration: | 381 | * Pull the atomic_t declaration: |
diff --git a/include/linux/spinlock_api_smp.h b/include/linux/spinlock_api_smp.h index e253ccd7a604..51df117abe46 100644 --- a/include/linux/spinlock_api_smp.h +++ b/include/linux/spinlock_api_smp.h | |||
@@ -67,7 +67,7 @@ _raw_spin_unlock_irqrestore(raw_spinlock_t *lock, unsigned long flags) | |||
67 | #define _raw_spin_trylock_bh(lock) __raw_spin_trylock_bh(lock) | 67 | #define _raw_spin_trylock_bh(lock) __raw_spin_trylock_bh(lock) |
68 | #endif | 68 | #endif |
69 | 69 | ||
70 | #ifdef CONFIG_INLINE_SPIN_UNLOCK | 70 | #ifndef CONFIG_UNINLINE_SPIN_UNLOCK |
71 | #define _raw_spin_unlock(lock) __raw_spin_unlock(lock) | 71 | #define _raw_spin_unlock(lock) __raw_spin_unlock(lock) |
72 | #endif | 72 | #endif |
73 | 73 | ||
diff --git a/include/linux/srcu.h b/include/linux/srcu.h index e1b005918bbb..d3d5fa54f25e 100644 --- a/include/linux/srcu.h +++ b/include/linux/srcu.h | |||
@@ -99,15 +99,18 @@ long srcu_batches_completed(struct srcu_struct *sp); | |||
99 | * power mode. This way we can notice an extended quiescent state to | 99 | * power mode. This way we can notice an extended quiescent state to |
100 | * other CPUs that started a grace period. Otherwise we would delay any | 100 | * other CPUs that started a grace period. Otherwise we would delay any |
101 | * grace period as long as we run in the idle task. | 101 | * grace period as long as we run in the idle task. |
102 | * | ||
103 | * Similarly, we avoid claiming an SRCU read lock held if the current | ||
104 | * CPU is offline. | ||
102 | */ | 105 | */ |
103 | static inline int srcu_read_lock_held(struct srcu_struct *sp) | 106 | static inline int srcu_read_lock_held(struct srcu_struct *sp) |
104 | { | 107 | { |
105 | if (rcu_is_cpu_idle()) | ||
106 | return 0; | ||
107 | |||
108 | if (!debug_lockdep_rcu_enabled()) | 108 | if (!debug_lockdep_rcu_enabled()) |
109 | return 1; | 109 | return 1; |
110 | 110 | if (rcu_is_cpu_idle()) | |
111 | return 0; | ||
112 | if (!rcu_lockdep_current_cpu_online()) | ||
113 | return 0; | ||
111 | return lock_is_held(&sp->dep_map); | 114 | return lock_is_held(&sp->dep_map); |
112 | } | 115 | } |
113 | 116 | ||
@@ -169,6 +172,8 @@ static inline int srcu_read_lock(struct srcu_struct *sp) __acquires(sp) | |||
169 | int retval = __srcu_read_lock(sp); | 172 | int retval = __srcu_read_lock(sp); |
170 | 173 | ||
171 | rcu_lock_acquire(&(sp)->dep_map); | 174 | rcu_lock_acquire(&(sp)->dep_map); |
175 | rcu_lockdep_assert(!rcu_is_cpu_idle(), | ||
176 | "srcu_read_lock() used illegally while idle"); | ||
172 | return retval; | 177 | return retval; |
173 | } | 178 | } |
174 | 179 | ||
@@ -182,6 +187,8 @@ static inline int srcu_read_lock(struct srcu_struct *sp) __acquires(sp) | |||
182 | static inline void srcu_read_unlock(struct srcu_struct *sp, int idx) | 187 | static inline void srcu_read_unlock(struct srcu_struct *sp, int idx) |
183 | __releases(sp) | 188 | __releases(sp) |
184 | { | 189 | { |
190 | rcu_lockdep_assert(!rcu_is_cpu_idle(), | ||
191 | "srcu_read_unlock() used illegally while idle"); | ||
185 | rcu_lock_release(&(sp)->dep_map); | 192 | rcu_lock_release(&(sp)->dep_map); |
186 | __srcu_read_unlock(sp, idx); | 193 | __srcu_read_unlock(sp, idx); |
187 | } | 194 | } |
diff --git a/include/linux/ssb/ssb.h b/include/linux/ssb/ssb.h index dcf35b0f303a..d27683180025 100644 --- a/include/linux/ssb/ssb.h +++ b/include/linux/ssb/ssb.h | |||
@@ -16,6 +16,12 @@ struct pcmcia_device; | |||
16 | struct ssb_bus; | 16 | struct ssb_bus; |
17 | struct ssb_driver; | 17 | struct ssb_driver; |
18 | 18 | ||
19 | struct ssb_sprom_core_pwr_info { | ||
20 | u8 itssi_2g, itssi_5g; | ||
21 | u8 maxpwr_2g, maxpwr_5gl, maxpwr_5g, maxpwr_5gh; | ||
22 | u16 pa_2g[4], pa_5gl[4], pa_5g[4], pa_5gh[4]; | ||
23 | }; | ||
24 | |||
19 | struct ssb_sprom { | 25 | struct ssb_sprom { |
20 | u8 revision; | 26 | u8 revision; |
21 | u8 il0mac[6]; /* MAC address for 802.11b/g */ | 27 | u8 il0mac[6]; /* MAC address for 802.11b/g */ |
@@ -26,9 +32,12 @@ struct ssb_sprom { | |||
26 | u8 et0mdcport; /* MDIO for enet0 */ | 32 | u8 et0mdcport; /* MDIO for enet0 */ |
27 | u8 et1mdcport; /* MDIO for enet1 */ | 33 | u8 et1mdcport; /* MDIO for enet1 */ |
28 | u16 board_rev; /* Board revision number from SPROM. */ | 34 | u16 board_rev; /* Board revision number from SPROM. */ |
35 | u16 board_num; /* Board number from SPROM. */ | ||
36 | u16 board_type; /* Board type from SPROM. */ | ||
29 | u8 country_code; /* Country Code */ | 37 | u8 country_code; /* Country Code */ |
30 | u16 leddc_on_time; /* LED Powersave Duty Cycle On Count */ | 38 | char alpha2[2]; /* Country Code as two chars like EU or US */ |
31 | u16 leddc_off_time; /* LED Powersave Duty Cycle Off Count */ | 39 | u8 leddc_on_time; /* LED Powersave Duty Cycle On Count */ |
40 | u8 leddc_off_time; /* LED Powersave Duty Cycle Off Count */ | ||
32 | u8 ant_available_a; /* 2GHz antenna available bits (up to 4) */ | 41 | u8 ant_available_a; /* 2GHz antenna available bits (up to 4) */ |
33 | u8 ant_available_bg; /* 5GHz antenna available bits (up to 4) */ | 42 | u8 ant_available_bg; /* 5GHz antenna available bits (up to 4) */ |
34 | u16 pa0b0; | 43 | u16 pa0b0; |
@@ -47,10 +56,10 @@ struct ssb_sprom { | |||
47 | u8 gpio1; /* GPIO pin 1 */ | 56 | u8 gpio1; /* GPIO pin 1 */ |
48 | u8 gpio2; /* GPIO pin 2 */ | 57 | u8 gpio2; /* GPIO pin 2 */ |
49 | u8 gpio3; /* GPIO pin 3 */ | 58 | u8 gpio3; /* GPIO pin 3 */ |
50 | u16 maxpwr_bg; /* 2.4GHz Amplifier Max Power (in dBm Q5.2) */ | 59 | u8 maxpwr_bg; /* 2.4GHz Amplifier Max Power (in dBm Q5.2) */ |
51 | u16 maxpwr_al; /* 5.2GHz Amplifier Max Power (in dBm Q5.2) */ | 60 | u8 maxpwr_al; /* 5.2GHz Amplifier Max Power (in dBm Q5.2) */ |
52 | u16 maxpwr_a; /* 5.3GHz Amplifier Max Power (in dBm Q5.2) */ | 61 | u8 maxpwr_a; /* 5.3GHz Amplifier Max Power (in dBm Q5.2) */ |
53 | u16 maxpwr_ah; /* 5.8GHz Amplifier Max Power (in dBm Q5.2) */ | 62 | u8 maxpwr_ah; /* 5.8GHz Amplifier Max Power (in dBm Q5.2) */ |
54 | u8 itssi_a; /* Idle TSSI Target for A-PHY */ | 63 | u8 itssi_a; /* Idle TSSI Target for A-PHY */ |
55 | u8 itssi_bg; /* Idle TSSI Target for B/G-PHY */ | 64 | u8 itssi_bg; /* Idle TSSI Target for B/G-PHY */ |
56 | u8 tri2g; /* 2.4GHz TX isolation */ | 65 | u8 tri2g; /* 2.4GHz TX isolation */ |
@@ -61,8 +70,8 @@ struct ssb_sprom { | |||
61 | u8 txpid5gl[4]; /* 4.9 - 5.1GHz TX power index */ | 70 | u8 txpid5gl[4]; /* 4.9 - 5.1GHz TX power index */ |
62 | u8 txpid5g[4]; /* 5.1 - 5.5GHz TX power index */ | 71 | u8 txpid5g[4]; /* 5.1 - 5.5GHz TX power index */ |
63 | u8 txpid5gh[4]; /* 5.5 - ...GHz TX power index */ | 72 | u8 txpid5gh[4]; /* 5.5 - ...GHz TX power index */ |
64 | u8 rxpo2g; /* 2GHz RX power offset */ | 73 | s8 rxpo2g; /* 2GHz RX power offset */ |
65 | u8 rxpo5g; /* 5GHz RX power offset */ | 74 | s8 rxpo5g; /* 5GHz RX power offset */ |
66 | u8 rssisav2g; /* 2GHz RSSI params */ | 75 | u8 rssisav2g; /* 2GHz RSSI params */ |
67 | u8 rssismc2g; | 76 | u8 rssismc2g; |
68 | u8 rssismf2g; | 77 | u8 rssismf2g; |
@@ -82,16 +91,13 @@ struct ssb_sprom { | |||
82 | u16 boardflags2_hi; /* Board flags (bits 48-63) */ | 91 | u16 boardflags2_hi; /* Board flags (bits 48-63) */ |
83 | /* TODO store board flags in a single u64 */ | 92 | /* TODO store board flags in a single u64 */ |
84 | 93 | ||
94 | struct ssb_sprom_core_pwr_info core_pwr_info[4]; | ||
95 | |||
85 | /* Antenna gain values for up to 4 antennas | 96 | /* Antenna gain values for up to 4 antennas |
86 | * on each band. Values in dBm/4 (Q5.2). Negative gain means the | 97 | * on each band. Values in dBm/4 (Q5.2). Negative gain means the |
87 | * loss in the connectors is bigger than the gain. */ | 98 | * loss in the connectors is bigger than the gain. */ |
88 | struct { | 99 | struct { |
89 | struct { | 100 | s8 a0, a1, a2, a3; |
90 | s8 a0, a1, a2, a3; | ||
91 | } ghz24; /* 2.4GHz band */ | ||
92 | struct { | ||
93 | s8 a0, a1, a2, a3; | ||
94 | } ghz5; /* 5GHz band */ | ||
95 | } antenna_gain; | 101 | } antenna_gain; |
96 | 102 | ||
97 | struct { | 103 | struct { |
@@ -103,7 +109,79 @@ struct ssb_sprom { | |||
103 | } ghz5; | 109 | } ghz5; |
104 | } fem; | 110 | } fem; |
105 | 111 | ||
106 | /* TODO - add any parameters needed from rev 2, 3, 4, 5 or 8 SPROMs */ | 112 | u16 mcs2gpo[8]; |
113 | u16 mcs5gpo[8]; | ||
114 | u16 mcs5glpo[8]; | ||
115 | u16 mcs5ghpo[8]; | ||
116 | u8 opo; | ||
117 | |||
118 | u8 rxgainerr2ga[3]; | ||
119 | u8 rxgainerr5gla[3]; | ||
120 | u8 rxgainerr5gma[3]; | ||
121 | u8 rxgainerr5gha[3]; | ||
122 | u8 rxgainerr5gua[3]; | ||
123 | |||
124 | u8 noiselvl2ga[3]; | ||
125 | u8 noiselvl5gla[3]; | ||
126 | u8 noiselvl5gma[3]; | ||
127 | u8 noiselvl5gha[3]; | ||
128 | u8 noiselvl5gua[3]; | ||
129 | |||
130 | u8 regrev; | ||
131 | u8 txchain; | ||
132 | u8 rxchain; | ||
133 | u8 antswitch; | ||
134 | u16 cddpo; | ||
135 | u16 stbcpo; | ||
136 | u16 bw40po; | ||
137 | u16 bwduppo; | ||
138 | |||
139 | u8 tempthresh; | ||
140 | u8 tempoffset; | ||
141 | u16 rawtempsense; | ||
142 | u8 measpower; | ||
143 | u8 tempsense_slope; | ||
144 | u8 tempcorrx; | ||
145 | u8 tempsense_option; | ||
146 | u8 freqoffset_corr; | ||
147 | u8 iqcal_swp_dis; | ||
148 | u8 hw_iqcal_en; | ||
149 | u8 elna2g; | ||
150 | u8 elna5g; | ||
151 | u8 phycal_tempdelta; | ||
152 | u8 temps_period; | ||
153 | u8 temps_hysteresis; | ||
154 | u8 measpower1; | ||
155 | u8 measpower2; | ||
156 | u8 pcieingress_war; | ||
157 | |||
158 | /* power per rate from sromrev 9 */ | ||
159 | u16 cckbw202gpo; | ||
160 | u16 cckbw20ul2gpo; | ||
161 | u32 legofdmbw202gpo; | ||
162 | u32 legofdmbw20ul2gpo; | ||
163 | u32 legofdmbw205glpo; | ||
164 | u32 legofdmbw20ul5glpo; | ||
165 | u32 legofdmbw205gmpo; | ||
166 | u32 legofdmbw20ul5gmpo; | ||
167 | u32 legofdmbw205ghpo; | ||
168 | u32 legofdmbw20ul5ghpo; | ||
169 | u32 mcsbw202gpo; | ||
170 | u32 mcsbw20ul2gpo; | ||
171 | u32 mcsbw402gpo; | ||
172 | u32 mcsbw205glpo; | ||
173 | u32 mcsbw20ul5glpo; | ||
174 | u32 mcsbw405glpo; | ||
175 | u32 mcsbw205gmpo; | ||
176 | u32 mcsbw20ul5gmpo; | ||
177 | u32 mcsbw405gmpo; | ||
178 | u32 mcsbw205ghpo; | ||
179 | u32 mcsbw20ul5ghpo; | ||
180 | u32 mcsbw405ghpo; | ||
181 | u16 mcs32po; | ||
182 | u16 legofdm40duppo; | ||
183 | u8 sar2g; | ||
184 | u8 sar5g; | ||
107 | }; | 185 | }; |
108 | 186 | ||
109 | /* Information about the PCB the circuitry is soldered on. */ | 187 | /* Information about the PCB the circuitry is soldered on. */ |
diff --git a/include/linux/ssb/ssb_driver_gige.h b/include/linux/ssb/ssb_driver_gige.h index eba52a100533..6b05dcd927ff 100644 --- a/include/linux/ssb/ssb_driver_gige.h +++ b/include/linux/ssb/ssb_driver_gige.h | |||
@@ -2,6 +2,7 @@ | |||
2 | #define LINUX_SSB_DRIVER_GIGE_H_ | 2 | #define LINUX_SSB_DRIVER_GIGE_H_ |
3 | 3 | ||
4 | #include <linux/ssb/ssb.h> | 4 | #include <linux/ssb/ssb.h> |
5 | #include <linux/bug.h> | ||
5 | #include <linux/pci.h> | 6 | #include <linux/pci.h> |
6 | #include <linux/spinlock.h> | 7 | #include <linux/spinlock.h> |
7 | 8 | ||
diff --git a/include/linux/ssb/ssb_regs.h b/include/linux/ssb/ssb_regs.h index c814ae6eeb22..40b1ef8595ee 100644 --- a/include/linux/ssb/ssb_regs.h +++ b/include/linux/ssb/ssb_regs.h | |||
@@ -449,6 +449,39 @@ | |||
449 | #define SSB_SPROM8_TS_SLP_OPT_CORRX 0x00B6 | 449 | #define SSB_SPROM8_TS_SLP_OPT_CORRX 0x00B6 |
450 | #define SSB_SPROM8_FOC_HWIQ_IQSWP 0x00B8 | 450 | #define SSB_SPROM8_FOC_HWIQ_IQSWP 0x00B8 |
451 | #define SSB_SPROM8_PHYCAL_TEMPDELTA 0x00BA | 451 | #define SSB_SPROM8_PHYCAL_TEMPDELTA 0x00BA |
452 | |||
453 | /* There are 4 blocks with power info sharing the same layout */ | ||
454 | #define SSB_SROM8_PWR_INFO_CORE0 0x00C0 | ||
455 | #define SSB_SROM8_PWR_INFO_CORE1 0x00E0 | ||
456 | #define SSB_SROM8_PWR_INFO_CORE2 0x0100 | ||
457 | #define SSB_SROM8_PWR_INFO_CORE3 0x0120 | ||
458 | |||
459 | #define SSB_SROM8_2G_MAXP_ITSSI 0x00 | ||
460 | #define SSB_SPROM8_2G_MAXP 0x00FF | ||
461 | #define SSB_SPROM8_2G_ITSSI 0xFF00 | ||
462 | #define SSB_SPROM8_2G_ITSSI_SHIFT 8 | ||
463 | #define SSB_SROM8_2G_PA_0 0x02 /* 2GHz power amp settings */ | ||
464 | #define SSB_SROM8_2G_PA_1 0x04 | ||
465 | #define SSB_SROM8_2G_PA_2 0x06 | ||
466 | #define SSB_SROM8_5G_MAXP_ITSSI 0x08 /* 5GHz ITSSI and 5.3GHz Max Power */ | ||
467 | #define SSB_SPROM8_5G_MAXP 0x00FF | ||
468 | #define SSB_SPROM8_5G_ITSSI 0xFF00 | ||
469 | #define SSB_SPROM8_5G_ITSSI_SHIFT 8 | ||
470 | #define SSB_SPROM8_5GHL_MAXP 0x0A /* 5.2GHz and 5.8GHz Max Power */ | ||
471 | #define SSB_SPROM8_5GH_MAXP 0x00FF | ||
472 | #define SSB_SPROM8_5GL_MAXP 0xFF00 | ||
473 | #define SSB_SPROM8_5GL_MAXP_SHIFT 8 | ||
474 | #define SSB_SROM8_5G_PA_0 0x0C /* 5.3GHz power amp settings */ | ||
475 | #define SSB_SROM8_5G_PA_1 0x0E | ||
476 | #define SSB_SROM8_5G_PA_2 0x10 | ||
477 | #define SSB_SROM8_5GL_PA_0 0x12 /* 5.2GHz power amp settings */ | ||
478 | #define SSB_SROM8_5GL_PA_1 0x14 | ||
479 | #define SSB_SROM8_5GL_PA_2 0x16 | ||
480 | #define SSB_SROM8_5GH_PA_0 0x18 /* 5.8GHz power amp settings */ | ||
481 | #define SSB_SROM8_5GH_PA_1 0x1A | ||
482 | #define SSB_SROM8_5GH_PA_2 0x1C | ||
483 | |||
484 | /* TODO: Make it deprecated */ | ||
452 | #define SSB_SPROM8_MAXP_BG 0x00C0 /* Max Power 2GHz in path 1 */ | 485 | #define SSB_SPROM8_MAXP_BG 0x00C0 /* Max Power 2GHz in path 1 */ |
453 | #define SSB_SPROM8_MAXP_BG_MASK 0x00FF /* Mask for Max Power 2GHz */ | 486 | #define SSB_SPROM8_MAXP_BG_MASK 0x00FF /* Mask for Max Power 2GHz */ |
454 | #define SSB_SPROM8_ITSSI_BG 0xFF00 /* Mask for path 1 itssi_bg */ | 487 | #define SSB_SPROM8_ITSSI_BG 0xFF00 /* Mask for path 1 itssi_bg */ |
@@ -473,6 +506,7 @@ | |||
473 | #define SSB_SPROM8_PA1HIB0 0x00D8 /* 5.8GHz power amp settings */ | 506 | #define SSB_SPROM8_PA1HIB0 0x00D8 /* 5.8GHz power amp settings */ |
474 | #define SSB_SPROM8_PA1HIB1 0x00DA | 507 | #define SSB_SPROM8_PA1HIB1 0x00DA |
475 | #define SSB_SPROM8_PA1HIB2 0x00DC | 508 | #define SSB_SPROM8_PA1HIB2 0x00DC |
509 | |||
476 | #define SSB_SPROM8_CCK2GPO 0x0140 /* CCK power offset */ | 510 | #define SSB_SPROM8_CCK2GPO 0x0140 /* CCK power offset */ |
477 | #define SSB_SPROM8_OFDM2GPO 0x0142 /* 2.4GHz OFDM power offset */ | 511 | #define SSB_SPROM8_OFDM2GPO 0x0142 /* 2.4GHz OFDM power offset */ |
478 | #define SSB_SPROM8_OFDM5GPO 0x0146 /* 5.3GHz OFDM power offset */ | 512 | #define SSB_SPROM8_OFDM5GPO 0x0146 /* 5.3GHz OFDM power offset */ |
diff --git a/include/linux/static_key.h b/include/linux/static_key.h new file mode 100644 index 000000000000..27bd3f8a0857 --- /dev/null +++ b/include/linux/static_key.h | |||
@@ -0,0 +1 @@ | |||
#include <linux/jump_label.h> | |||
diff --git a/include/linux/stddef.h b/include/linux/stddef.h index 6a40c76bdcf1..1747b6787b9e 100644 --- a/include/linux/stddef.h +++ b/include/linux/stddef.h | |||
@@ -3,14 +3,10 @@ | |||
3 | 3 | ||
4 | #include <linux/compiler.h> | 4 | #include <linux/compiler.h> |
5 | 5 | ||
6 | #ifdef __KERNEL__ | ||
7 | |||
6 | #undef NULL | 8 | #undef NULL |
7 | #if defined(__cplusplus) | ||
8 | #define NULL 0 | ||
9 | #else | ||
10 | #define NULL ((void *)0) | 9 | #define NULL ((void *)0) |
11 | #endif | ||
12 | |||
13 | #ifdef __KERNEL__ | ||
14 | 10 | ||
15 | enum { | 11 | enum { |
16 | false = 0, | 12 | false = 0, |
diff --git a/include/linux/stop_machine.h b/include/linux/stop_machine.h index c170edc3bf5f..3b5e910d14ca 100644 --- a/include/linux/stop_machine.h +++ b/include/linux/stop_machine.h | |||
@@ -5,7 +5,6 @@ | |||
5 | #include <linux/cpumask.h> | 5 | #include <linux/cpumask.h> |
6 | #include <linux/smp.h> | 6 | #include <linux/smp.h> |
7 | #include <linux/list.h> | 7 | #include <linux/list.h> |
8 | #include <asm/system.h> | ||
9 | 8 | ||
10 | /* | 9 | /* |
11 | * stop_cpu[s]() is simplistic per-cpu maximum priority cpu | 10 | * stop_cpu[s]() is simplistic per-cpu maximum priority cpu |
diff --git a/include/linux/sunrpc/auth.h b/include/linux/sunrpc/auth.h index 7874a8a56638..492a36d72829 100644 --- a/include/linux/sunrpc/auth.h +++ b/include/linux/sunrpc/auth.h | |||
@@ -99,6 +99,8 @@ struct rpc_authops { | |||
99 | 99 | ||
100 | struct rpc_cred * (*lookup_cred)(struct rpc_auth *, struct auth_cred *, int); | 100 | struct rpc_cred * (*lookup_cred)(struct rpc_auth *, struct auth_cred *, int); |
101 | struct rpc_cred * (*crcreate)(struct rpc_auth*, struct auth_cred *, int); | 101 | struct rpc_cred * (*crcreate)(struct rpc_auth*, struct auth_cred *, int); |
102 | int (*pipes_create)(struct rpc_auth *); | ||
103 | void (*pipes_destroy)(struct rpc_auth *); | ||
102 | }; | 104 | }; |
103 | 105 | ||
104 | struct rpc_credops { | 106 | struct rpc_credops { |
diff --git a/include/linux/sunrpc/bc_xprt.h b/include/linux/sunrpc/bc_xprt.h index f7f3ce340c08..969c0a671dbf 100644 --- a/include/linux/sunrpc/bc_xprt.h +++ b/include/linux/sunrpc/bc_xprt.h | |||
@@ -35,7 +35,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |||
35 | struct rpc_rqst *xprt_alloc_bc_request(struct rpc_xprt *xprt); | 35 | struct rpc_rqst *xprt_alloc_bc_request(struct rpc_xprt *xprt); |
36 | void xprt_free_bc_request(struct rpc_rqst *req); | 36 | void xprt_free_bc_request(struct rpc_rqst *req); |
37 | int xprt_setup_backchannel(struct rpc_xprt *, unsigned int min_reqs); | 37 | int xprt_setup_backchannel(struct rpc_xprt *, unsigned int min_reqs); |
38 | void xprt_destroy_backchannel(struct rpc_xprt *, int max_reqs); | 38 | void xprt_destroy_backchannel(struct rpc_xprt *, unsigned int max_reqs); |
39 | int bc_send(struct rpc_rqst *req); | 39 | int bc_send(struct rpc_rqst *req); |
40 | 40 | ||
41 | /* | 41 | /* |
diff --git a/include/linux/sunrpc/cache.h b/include/linux/sunrpc/cache.h index 57531f8e5956..f5fd6160dbca 100644 --- a/include/linux/sunrpc/cache.h +++ b/include/linux/sunrpc/cache.h | |||
@@ -117,6 +117,7 @@ struct cache_detail { | |||
117 | struct cache_detail_procfs procfs; | 117 | struct cache_detail_procfs procfs; |
118 | struct cache_detail_pipefs pipefs; | 118 | struct cache_detail_pipefs pipefs; |
119 | } u; | 119 | } u; |
120 | struct net *net; | ||
120 | }; | 121 | }; |
121 | 122 | ||
122 | 123 | ||
@@ -197,11 +198,14 @@ extern void cache_flush(void); | |||
197 | extern void cache_purge(struct cache_detail *detail); | 198 | extern void cache_purge(struct cache_detail *detail); |
198 | #define NEVER (0x7FFFFFFF) | 199 | #define NEVER (0x7FFFFFFF) |
199 | extern void __init cache_initialize(void); | 200 | extern void __init cache_initialize(void); |
200 | extern int cache_register(struct cache_detail *cd); | ||
201 | extern int cache_register_net(struct cache_detail *cd, struct net *net); | 201 | extern int cache_register_net(struct cache_detail *cd, struct net *net); |
202 | extern void cache_unregister(struct cache_detail *cd); | ||
203 | extern void cache_unregister_net(struct cache_detail *cd, struct net *net); | 202 | extern void cache_unregister_net(struct cache_detail *cd, struct net *net); |
204 | 203 | ||
204 | extern struct cache_detail *cache_create_net(struct cache_detail *tmpl, struct net *net); | ||
205 | extern void cache_destroy_net(struct cache_detail *cd, struct net *net); | ||
206 | |||
207 | extern void sunrpc_init_cache_detail(struct cache_detail *cd); | ||
208 | extern void sunrpc_destroy_cache_detail(struct cache_detail *cd); | ||
205 | extern int sunrpc_cache_register_pipefs(struct dentry *parent, const char *, | 209 | extern int sunrpc_cache_register_pipefs(struct dentry *parent, const char *, |
206 | umode_t, struct cache_detail *); | 210 | umode_t, struct cache_detail *); |
207 | extern void sunrpc_cache_unregister_pipefs(struct cache_detail *); | 211 | extern void sunrpc_cache_unregister_pipefs(struct cache_detail *); |
diff --git a/include/linux/sunrpc/clnt.h b/include/linux/sunrpc/clnt.h index 2c5993a17c33..523547ecfee2 100644 --- a/include/linux/sunrpc/clnt.h +++ b/include/linux/sunrpc/clnt.h | |||
@@ -35,14 +35,13 @@ struct rpc_clnt { | |||
35 | struct list_head cl_clients; /* Global list of clients */ | 35 | struct list_head cl_clients; /* Global list of clients */ |
36 | struct list_head cl_tasks; /* List of tasks */ | 36 | struct list_head cl_tasks; /* List of tasks */ |
37 | spinlock_t cl_lock; /* spinlock */ | 37 | spinlock_t cl_lock; /* spinlock */ |
38 | struct rpc_xprt * cl_xprt; /* transport */ | 38 | struct rpc_xprt __rcu * cl_xprt; /* transport */ |
39 | struct rpc_procinfo * cl_procinfo; /* procedure info */ | 39 | struct rpc_procinfo * cl_procinfo; /* procedure info */ |
40 | u32 cl_prog, /* RPC program number */ | 40 | u32 cl_prog, /* RPC program number */ |
41 | cl_vers, /* RPC version number */ | 41 | cl_vers, /* RPC version number */ |
42 | cl_maxproc; /* max procedure number */ | 42 | cl_maxproc; /* max procedure number */ |
43 | 43 | ||
44 | char * cl_server; /* server machine name */ | 44 | const char * cl_protname; /* protocol name */ |
45 | char * cl_protname; /* protocol name */ | ||
46 | struct rpc_auth * cl_auth; /* authenticator */ | 45 | struct rpc_auth * cl_auth; /* authenticator */ |
47 | struct rpc_stat * cl_stats; /* per-program statistics */ | 46 | struct rpc_stat * cl_stats; /* per-program statistics */ |
48 | struct rpc_iostats * cl_metrics; /* per-client statistics */ | 47 | struct rpc_iostats * cl_metrics; /* per-client statistics */ |
@@ -57,12 +56,11 @@ struct rpc_clnt { | |||
57 | 56 | ||
58 | int cl_nodelen; /* nodename length */ | 57 | int cl_nodelen; /* nodename length */ |
59 | char cl_nodename[UNX_MAXNODENAME]; | 58 | char cl_nodename[UNX_MAXNODENAME]; |
60 | struct path cl_path; | 59 | struct dentry * cl_dentry; |
61 | struct rpc_clnt * cl_parent; /* Points to parent of clones */ | 60 | struct rpc_clnt * cl_parent; /* Points to parent of clones */ |
62 | struct rpc_rtt cl_rtt_default; | 61 | struct rpc_rtt cl_rtt_default; |
63 | struct rpc_timeout cl_timeout_default; | 62 | struct rpc_timeout cl_timeout_default; |
64 | struct rpc_program * cl_program; | 63 | const struct rpc_program *cl_program; |
65 | char cl_inline_name[32]; | ||
66 | char *cl_principal; /* target to authenticate to */ | 64 | char *cl_principal; /* target to authenticate to */ |
67 | }; | 65 | }; |
68 | 66 | ||
@@ -71,12 +69,12 @@ struct rpc_clnt { | |||
71 | */ | 69 | */ |
72 | #define RPC_MAXVERSION 4 | 70 | #define RPC_MAXVERSION 4 |
73 | struct rpc_program { | 71 | struct rpc_program { |
74 | char * name; /* protocol name */ | 72 | const char * name; /* protocol name */ |
75 | u32 number; /* program number */ | 73 | u32 number; /* program number */ |
76 | unsigned int nrvers; /* number of versions */ | 74 | unsigned int nrvers; /* number of versions */ |
77 | struct rpc_version ** version; /* version array */ | 75 | const struct rpc_version ** version; /* version array */ |
78 | struct rpc_stat * stats; /* statistics */ | 76 | struct rpc_stat * stats; /* statistics */ |
79 | char * pipe_dir_name; /* path to rpc_pipefs dir */ | 77 | const char * pipe_dir_name; /* path to rpc_pipefs dir */ |
80 | }; | 78 | }; |
81 | 79 | ||
82 | struct rpc_version { | 80 | struct rpc_version { |
@@ -97,7 +95,7 @@ struct rpc_procinfo { | |||
97 | unsigned int p_count; /* call count */ | 95 | unsigned int p_count; /* call count */ |
98 | unsigned int p_timer; /* Which RTT timer to use */ | 96 | unsigned int p_timer; /* Which RTT timer to use */ |
99 | u32 p_statidx; /* Which procedure to account */ | 97 | u32 p_statidx; /* Which procedure to account */ |
100 | char * p_name; /* name of procedure */ | 98 | const char * p_name; /* name of procedure */ |
101 | }; | 99 | }; |
102 | 100 | ||
103 | #ifdef __KERNEL__ | 101 | #ifdef __KERNEL__ |
@@ -109,8 +107,8 @@ struct rpc_create_args { | |||
109 | size_t addrsize; | 107 | size_t addrsize; |
110 | struct sockaddr *saddress; | 108 | struct sockaddr *saddress; |
111 | const struct rpc_timeout *timeout; | 109 | const struct rpc_timeout *timeout; |
112 | char *servername; | 110 | const char *servername; |
113 | struct rpc_program *program; | 111 | const struct rpc_program *program; |
114 | u32 prognumber; /* overrides program->number */ | 112 | u32 prognumber; /* overrides program->number */ |
115 | u32 version; | 113 | u32 version; |
116 | rpc_authflavor_t authflavor; | 114 | rpc_authflavor_t authflavor; |
@@ -129,17 +127,18 @@ struct rpc_create_args { | |||
129 | 127 | ||
130 | struct rpc_clnt *rpc_create(struct rpc_create_args *args); | 128 | struct rpc_clnt *rpc_create(struct rpc_create_args *args); |
131 | struct rpc_clnt *rpc_bind_new_program(struct rpc_clnt *, | 129 | struct rpc_clnt *rpc_bind_new_program(struct rpc_clnt *, |
132 | struct rpc_program *, u32); | 130 | const struct rpc_program *, u32); |
133 | void rpc_task_reset_client(struct rpc_task *task, struct rpc_clnt *clnt); | 131 | void rpc_task_reset_client(struct rpc_task *task, struct rpc_clnt *clnt); |
134 | struct rpc_clnt *rpc_clone_client(struct rpc_clnt *); | 132 | struct rpc_clnt *rpc_clone_client(struct rpc_clnt *); |
135 | void rpc_shutdown_client(struct rpc_clnt *); | 133 | void rpc_shutdown_client(struct rpc_clnt *); |
136 | void rpc_release_client(struct rpc_clnt *); | 134 | void rpc_release_client(struct rpc_clnt *); |
137 | void rpc_task_release_client(struct rpc_task *); | 135 | void rpc_task_release_client(struct rpc_task *); |
138 | 136 | ||
139 | int rpcb_create_local(void); | 137 | int rpcb_create_local(struct net *); |
140 | void rpcb_put_local(void); | 138 | void rpcb_put_local(struct net *); |
141 | int rpcb_register(u32, u32, int, unsigned short); | 139 | int rpcb_register(struct net *, u32, u32, int, unsigned short); |
142 | int rpcb_v4_register(const u32 program, const u32 version, | 140 | int rpcb_v4_register(struct net *net, const u32 program, |
141 | const u32 version, | ||
143 | const struct sockaddr *address, | 142 | const struct sockaddr *address, |
144 | const char *netid); | 143 | const char *netid); |
145 | void rpcb_getport_async(struct rpc_task *); | 144 | void rpcb_getport_async(struct rpc_task *); |
@@ -156,16 +155,19 @@ struct rpc_task *rpc_call_null(struct rpc_clnt *clnt, struct rpc_cred *cred, | |||
156 | int rpc_restart_call_prepare(struct rpc_task *); | 155 | int rpc_restart_call_prepare(struct rpc_task *); |
157 | int rpc_restart_call(struct rpc_task *); | 156 | int rpc_restart_call(struct rpc_task *); |
158 | void rpc_setbufsize(struct rpc_clnt *, unsigned int, unsigned int); | 157 | void rpc_setbufsize(struct rpc_clnt *, unsigned int, unsigned int); |
158 | int rpc_protocol(struct rpc_clnt *); | ||
159 | struct net * rpc_net_ns(struct rpc_clnt *); | ||
159 | size_t rpc_max_payload(struct rpc_clnt *); | 160 | size_t rpc_max_payload(struct rpc_clnt *); |
160 | void rpc_force_rebind(struct rpc_clnt *); | 161 | void rpc_force_rebind(struct rpc_clnt *); |
161 | size_t rpc_peeraddr(struct rpc_clnt *, struct sockaddr *, size_t); | 162 | size_t rpc_peeraddr(struct rpc_clnt *, struct sockaddr *, size_t); |
162 | const char *rpc_peeraddr2str(struct rpc_clnt *, enum rpc_display_format_t); | 163 | const char *rpc_peeraddr2str(struct rpc_clnt *, enum rpc_display_format_t); |
164 | int rpc_localaddr(struct rpc_clnt *, struct sockaddr *, size_t); | ||
163 | 165 | ||
164 | size_t rpc_ntop(const struct sockaddr *, char *, const size_t); | 166 | size_t rpc_ntop(const struct sockaddr *, char *, const size_t); |
165 | size_t rpc_pton(const char *, const size_t, | 167 | size_t rpc_pton(struct net *, const char *, const size_t, |
166 | struct sockaddr *, const size_t); | 168 | struct sockaddr *, const size_t); |
167 | char * rpc_sockaddr2uaddr(const struct sockaddr *, gfp_t); | 169 | char * rpc_sockaddr2uaddr(const struct sockaddr *, gfp_t); |
168 | size_t rpc_uaddr2sockaddr(const char *, const size_t, | 170 | size_t rpc_uaddr2sockaddr(struct net *, const char *, const size_t, |
169 | struct sockaddr *, const size_t); | 171 | struct sockaddr *, const size_t); |
170 | 172 | ||
171 | static inline unsigned short rpc_get_port(const struct sockaddr *sap) | 173 | static inline unsigned short rpc_get_port(const struct sockaddr *sap) |
diff --git a/include/linux/sunrpc/debug.h b/include/linux/sunrpc/debug.h index c2786f20016f..a76cc20d98ce 100644 --- a/include/linux/sunrpc/debug.h +++ b/include/linux/sunrpc/debug.h | |||
@@ -31,9 +31,12 @@ | |||
31 | /* | 31 | /* |
32 | * Enable RPC debugging/profiling. | 32 | * Enable RPC debugging/profiling. |
33 | */ | 33 | */ |
34 | #ifdef CONFIG_SYSCTL | 34 | #ifdef CONFIG_SUNRPC_DEBUG |
35 | #define RPC_DEBUG | 35 | #define RPC_DEBUG |
36 | #endif | 36 | #endif |
37 | #ifdef CONFIG_TRACEPOINTS | ||
38 | #define RPC_TRACEPOINTS | ||
39 | #endif | ||
37 | /* #define RPC_PROFILE */ | 40 | /* #define RPC_PROFILE */ |
38 | 41 | ||
39 | /* | 42 | /* |
@@ -47,15 +50,32 @@ extern unsigned int nlm_debug; | |||
47 | #endif | 50 | #endif |
48 | 51 | ||
49 | #define dprintk(args...) dfprintk(FACILITY, ## args) | 52 | #define dprintk(args...) dfprintk(FACILITY, ## args) |
53 | #define dprintk_rcu(args...) dfprintk_rcu(FACILITY, ## args) | ||
50 | 54 | ||
51 | #undef ifdebug | 55 | #undef ifdebug |
52 | #ifdef RPC_DEBUG | 56 | #ifdef RPC_DEBUG |
53 | # define ifdebug(fac) if (unlikely(rpc_debug & RPCDBG_##fac)) | 57 | # define ifdebug(fac) if (unlikely(rpc_debug & RPCDBG_##fac)) |
54 | # define dfprintk(fac, args...) do { ifdebug(fac) printk(args); } while(0) | 58 | |
59 | # define dfprintk(fac, args...) \ | ||
60 | do { \ | ||
61 | ifdebug(fac) \ | ||
62 | printk(KERN_DEFAULT args); \ | ||
63 | } while (0) | ||
64 | |||
65 | # define dfprintk_rcu(fac, args...) \ | ||
66 | do { \ | ||
67 | ifdebug(fac) { \ | ||
68 | rcu_read_lock(); \ | ||
69 | printk(KERN_DEFAULT args); \ | ||
70 | rcu_read_unlock(); \ | ||
71 | } \ | ||
72 | } while (0) | ||
73 | |||
55 | # define RPC_IFDEBUG(x) x | 74 | # define RPC_IFDEBUG(x) x |
56 | #else | 75 | #else |
57 | # define ifdebug(fac) if (0) | 76 | # define ifdebug(fac) if (0) |
58 | # define dfprintk(fac, args...) do ; while (0) | 77 | # define dfprintk(fac, args...) do {} while (0) |
78 | # define dfprintk_rcu(fac, args...) do {} while (0) | ||
59 | # define RPC_IFDEBUG(x) | 79 | # define RPC_IFDEBUG(x) |
60 | #endif | 80 | #endif |
61 | 81 | ||
diff --git a/include/linux/sunrpc/metrics.h b/include/linux/sunrpc/metrics.h index b6edbc0ea83d..1565bbe86d51 100644 --- a/include/linux/sunrpc/metrics.h +++ b/include/linux/sunrpc/metrics.h | |||
@@ -74,14 +74,16 @@ struct rpc_clnt; | |||
74 | #ifdef CONFIG_PROC_FS | 74 | #ifdef CONFIG_PROC_FS |
75 | 75 | ||
76 | struct rpc_iostats * rpc_alloc_iostats(struct rpc_clnt *); | 76 | struct rpc_iostats * rpc_alloc_iostats(struct rpc_clnt *); |
77 | void rpc_count_iostats(struct rpc_task *); | 77 | void rpc_count_iostats(const struct rpc_task *, |
78 | struct rpc_iostats *); | ||
78 | void rpc_print_iostats(struct seq_file *, struct rpc_clnt *); | 79 | void rpc_print_iostats(struct seq_file *, struct rpc_clnt *); |
79 | void rpc_free_iostats(struct rpc_iostats *); | 80 | void rpc_free_iostats(struct rpc_iostats *); |
80 | 81 | ||
81 | #else /* CONFIG_PROC_FS */ | 82 | #else /* CONFIG_PROC_FS */ |
82 | 83 | ||
83 | static inline struct rpc_iostats *rpc_alloc_iostats(struct rpc_clnt *clnt) { return NULL; } | 84 | static inline struct rpc_iostats *rpc_alloc_iostats(struct rpc_clnt *clnt) { return NULL; } |
84 | static inline void rpc_count_iostats(struct rpc_task *task) {} | 85 | static inline void rpc_count_iostats(const struct rpc_task *task, |
86 | struct rpc_iostats *stats) {} | ||
85 | static inline void rpc_print_iostats(struct seq_file *seq, struct rpc_clnt *clnt) {} | 87 | static inline void rpc_print_iostats(struct seq_file *seq, struct rpc_clnt *clnt) {} |
86 | static inline void rpc_free_iostats(struct rpc_iostats *stats) {} | 88 | static inline void rpc_free_iostats(struct rpc_iostats *stats) {} |
87 | 89 | ||
diff --git a/include/linux/sunrpc/rpc_pipe_fs.h b/include/linux/sunrpc/rpc_pipe_fs.h index 2bb03d77375a..a7b422b33eda 100644 --- a/include/linux/sunrpc/rpc_pipe_fs.h +++ b/include/linux/sunrpc/rpc_pipe_fs.h | |||
@@ -21,21 +21,26 @@ struct rpc_pipe_ops { | |||
21 | void (*destroy_msg)(struct rpc_pipe_msg *); | 21 | void (*destroy_msg)(struct rpc_pipe_msg *); |
22 | }; | 22 | }; |
23 | 23 | ||
24 | struct rpc_inode { | 24 | struct rpc_pipe { |
25 | struct inode vfs_inode; | ||
26 | void *private; | ||
27 | struct list_head pipe; | 25 | struct list_head pipe; |
28 | struct list_head in_upcall; | 26 | struct list_head in_upcall; |
29 | struct list_head in_downcall; | 27 | struct list_head in_downcall; |
30 | int pipelen; | 28 | int pipelen; |
31 | int nreaders; | 29 | int nreaders; |
32 | int nwriters; | 30 | int nwriters; |
33 | int nkern_readwriters; | ||
34 | wait_queue_head_t waitq; | ||
35 | #define RPC_PIPE_WAIT_FOR_OPEN 1 | 31 | #define RPC_PIPE_WAIT_FOR_OPEN 1 |
36 | int flags; | 32 | int flags; |
37 | struct delayed_work queue_timeout; | 33 | struct delayed_work queue_timeout; |
38 | const struct rpc_pipe_ops *ops; | 34 | const struct rpc_pipe_ops *ops; |
35 | spinlock_t lock; | ||
36 | struct dentry *dentry; | ||
37 | }; | ||
38 | |||
39 | struct rpc_inode { | ||
40 | struct inode vfs_inode; | ||
41 | void *private; | ||
42 | struct rpc_pipe *pipe; | ||
43 | wait_queue_head_t waitq; | ||
39 | }; | 44 | }; |
40 | 45 | ||
41 | static inline struct rpc_inode * | 46 | static inline struct rpc_inode * |
@@ -44,9 +49,28 @@ RPC_I(struct inode *inode) | |||
44 | return container_of(inode, struct rpc_inode, vfs_inode); | 49 | return container_of(inode, struct rpc_inode, vfs_inode); |
45 | } | 50 | } |
46 | 51 | ||
52 | enum { | ||
53 | SUNRPC_PIPEFS_NFS_PRIO, | ||
54 | SUNRPC_PIPEFS_RPC_PRIO, | ||
55 | }; | ||
56 | |||
57 | extern int rpc_pipefs_notifier_register(struct notifier_block *); | ||
58 | extern void rpc_pipefs_notifier_unregister(struct notifier_block *); | ||
59 | |||
60 | enum { | ||
61 | RPC_PIPEFS_MOUNT, | ||
62 | RPC_PIPEFS_UMOUNT, | ||
63 | }; | ||
64 | |||
65 | extern struct dentry *rpc_d_lookup_sb(const struct super_block *sb, | ||
66 | const unsigned char *dir_name); | ||
67 | extern void rpc_pipefs_init_net(struct net *net); | ||
68 | extern struct super_block *rpc_get_sb_net(const struct net *net); | ||
69 | extern void rpc_put_sb_net(const struct net *net); | ||
70 | |||
47 | extern ssize_t rpc_pipe_generic_upcall(struct file *, struct rpc_pipe_msg *, | 71 | extern ssize_t rpc_pipe_generic_upcall(struct file *, struct rpc_pipe_msg *, |
48 | char __user *, size_t); | 72 | char __user *, size_t); |
49 | extern int rpc_queue_upcall(struct inode *, struct rpc_pipe_msg *); | 73 | extern int rpc_queue_upcall(struct rpc_pipe *, struct rpc_pipe_msg *); |
50 | 74 | ||
51 | struct rpc_clnt; | 75 | struct rpc_clnt; |
52 | extern struct dentry *rpc_create_client_dir(struct dentry *, struct qstr *, struct rpc_clnt *); | 76 | extern struct dentry *rpc_create_client_dir(struct dentry *, struct qstr *, struct rpc_clnt *); |
@@ -59,11 +83,13 @@ extern struct dentry *rpc_create_cache_dir(struct dentry *, | |||
59 | struct cache_detail *); | 83 | struct cache_detail *); |
60 | extern void rpc_remove_cache_dir(struct dentry *); | 84 | extern void rpc_remove_cache_dir(struct dentry *); |
61 | 85 | ||
62 | extern struct dentry *rpc_mkpipe(struct dentry *, const char *, void *, | 86 | extern int rpc_rmdir(struct dentry *dentry); |
63 | const struct rpc_pipe_ops *, int flags); | 87 | |
88 | struct rpc_pipe *rpc_mkpipe_data(const struct rpc_pipe_ops *ops, int flags); | ||
89 | void rpc_destroy_pipe_data(struct rpc_pipe *pipe); | ||
90 | extern struct dentry *rpc_mkpipe_dentry(struct dentry *, const char *, void *, | ||
91 | struct rpc_pipe *); | ||
64 | extern int rpc_unlink(struct dentry *); | 92 | extern int rpc_unlink(struct dentry *); |
65 | extern struct vfsmount *rpc_get_mount(void); | ||
66 | extern void rpc_put_mount(void); | ||
67 | extern int register_rpc_pipefs(void); | 93 | extern int register_rpc_pipefs(void); |
68 | extern void unregister_rpc_pipefs(void); | 94 | extern void unregister_rpc_pipefs(void); |
69 | 95 | ||
diff --git a/include/linux/sunrpc/sched.h b/include/linux/sunrpc/sched.h index e7756896f3ca..dc0c3cc3ada3 100644 --- a/include/linux/sunrpc/sched.h +++ b/include/linux/sunrpc/sched.h | |||
@@ -103,6 +103,7 @@ typedef void (*rpc_action)(struct rpc_task *); | |||
103 | struct rpc_call_ops { | 103 | struct rpc_call_ops { |
104 | void (*rpc_call_prepare)(struct rpc_task *, void *); | 104 | void (*rpc_call_prepare)(struct rpc_task *, void *); |
105 | void (*rpc_call_done)(struct rpc_task *, void *); | 105 | void (*rpc_call_done)(struct rpc_task *, void *); |
106 | void (*rpc_count_stats)(struct rpc_task *, void *); | ||
106 | void (*rpc_release)(void *); | 107 | void (*rpc_release)(void *); |
107 | }; | 108 | }; |
108 | 109 | ||
@@ -195,7 +196,7 @@ struct rpc_wait_queue { | |||
195 | unsigned char nr; /* # tasks remaining for cookie */ | 196 | unsigned char nr; /* # tasks remaining for cookie */ |
196 | unsigned short qlen; /* total # tasks waiting in queue */ | 197 | unsigned short qlen; /* total # tasks waiting in queue */ |
197 | struct rpc_timer timer_list; | 198 | struct rpc_timer timer_list; |
198 | #ifdef RPC_DEBUG | 199 | #if defined(RPC_DEBUG) || defined(RPC_TRACEPOINTS) |
199 | const char * name; | 200 | const char * name; |
200 | #endif | 201 | #endif |
201 | }; | 202 | }; |
@@ -235,6 +236,9 @@ void rpc_wake_up_queued_task(struct rpc_wait_queue *, | |||
235 | struct rpc_task *); | 236 | struct rpc_task *); |
236 | void rpc_wake_up(struct rpc_wait_queue *); | 237 | void rpc_wake_up(struct rpc_wait_queue *); |
237 | struct rpc_task *rpc_wake_up_next(struct rpc_wait_queue *); | 238 | struct rpc_task *rpc_wake_up_next(struct rpc_wait_queue *); |
239 | struct rpc_task *rpc_wake_up_first(struct rpc_wait_queue *, | ||
240 | bool (*)(struct rpc_task *, void *), | ||
241 | void *); | ||
238 | void rpc_wake_up_status(struct rpc_wait_queue *, int); | 242 | void rpc_wake_up_status(struct rpc_wait_queue *, int); |
239 | int rpc_queue_empty(struct rpc_wait_queue *); | 243 | int rpc_queue_empty(struct rpc_wait_queue *); |
240 | void rpc_delay(struct rpc_task *, unsigned long); | 244 | void rpc_delay(struct rpc_task *, unsigned long); |
@@ -244,7 +248,8 @@ int rpciod_up(void); | |||
244 | void rpciod_down(void); | 248 | void rpciod_down(void); |
245 | int __rpc_wait_for_completion_task(struct rpc_task *task, int (*)(void *)); | 249 | int __rpc_wait_for_completion_task(struct rpc_task *task, int (*)(void *)); |
246 | #ifdef RPC_DEBUG | 250 | #ifdef RPC_DEBUG |
247 | void rpc_show_tasks(void); | 251 | struct net; |
252 | void rpc_show_tasks(struct net *); | ||
248 | #endif | 253 | #endif |
249 | int rpc_init_mempool(void); | 254 | int rpc_init_mempool(void); |
250 | void rpc_destroy_mempool(void); | 255 | void rpc_destroy_mempool(void); |
@@ -266,11 +271,22 @@ static inline int rpc_task_has_priority(struct rpc_task *task, unsigned char pri | |||
266 | return (task->tk_priority + RPC_PRIORITY_LOW == prio); | 271 | return (task->tk_priority + RPC_PRIORITY_LOW == prio); |
267 | } | 272 | } |
268 | 273 | ||
269 | #ifdef RPC_DEBUG | 274 | #if defined(RPC_DEBUG) || defined (RPC_TRACEPOINTS) |
270 | static inline const char * rpc_qname(struct rpc_wait_queue *q) | 275 | static inline const char * rpc_qname(const struct rpc_wait_queue *q) |
271 | { | 276 | { |
272 | return ((q && q->name) ? q->name : "unknown"); | 277 | return ((q && q->name) ? q->name : "unknown"); |
273 | } | 278 | } |
279 | |||
280 | static inline void rpc_assign_waitqueue_name(struct rpc_wait_queue *q, | ||
281 | const char *name) | ||
282 | { | ||
283 | q->name = name; | ||
284 | } | ||
285 | #else | ||
286 | static inline void rpc_assign_waitqueue_name(struct rpc_wait_queue *q, | ||
287 | const char *name) | ||
288 | { | ||
289 | } | ||
274 | #endif | 290 | #endif |
275 | 291 | ||
276 | #endif /* _LINUX_SUNRPC_SCHED_H_ */ | 292 | #endif /* _LINUX_SUNRPC_SCHED_H_ */ |
diff --git a/include/linux/sunrpc/stats.h b/include/linux/sunrpc/stats.h index 680471d1f28a..edc64219f92b 100644 --- a/include/linux/sunrpc/stats.h +++ b/include/linux/sunrpc/stats.h | |||
@@ -12,7 +12,7 @@ | |||
12 | #include <linux/proc_fs.h> | 12 | #include <linux/proc_fs.h> |
13 | 13 | ||
14 | struct rpc_stat { | 14 | struct rpc_stat { |
15 | struct rpc_program * program; | 15 | const struct rpc_program *program; |
16 | 16 | ||
17 | unsigned int netcnt, | 17 | unsigned int netcnt, |
18 | netudpcnt, | 18 | netudpcnt, |
@@ -58,24 +58,24 @@ void rpc_modcount(struct inode *, int); | |||
58 | #endif | 58 | #endif |
59 | 59 | ||
60 | #ifdef CONFIG_PROC_FS | 60 | #ifdef CONFIG_PROC_FS |
61 | struct proc_dir_entry * rpc_proc_register(struct rpc_stat *); | 61 | struct proc_dir_entry * rpc_proc_register(struct net *,struct rpc_stat *); |
62 | void rpc_proc_unregister(const char *); | 62 | void rpc_proc_unregister(struct net *,const char *); |
63 | void rpc_proc_zero(struct rpc_program *); | 63 | void rpc_proc_zero(const struct rpc_program *); |
64 | struct proc_dir_entry * svc_proc_register(struct svc_stat *, | 64 | struct proc_dir_entry * svc_proc_register(struct net *, struct svc_stat *, |
65 | const struct file_operations *); | 65 | const struct file_operations *); |
66 | void svc_proc_unregister(const char *); | 66 | void svc_proc_unregister(struct net *, const char *); |
67 | 67 | ||
68 | void svc_seq_show(struct seq_file *, | 68 | void svc_seq_show(struct seq_file *, |
69 | const struct svc_stat *); | 69 | const struct svc_stat *); |
70 | #else | 70 | #else |
71 | 71 | ||
72 | static inline struct proc_dir_entry *rpc_proc_register(struct rpc_stat *s) { return NULL; } | 72 | static inline struct proc_dir_entry *rpc_proc_register(struct net *net, struct rpc_stat *s) { return NULL; } |
73 | static inline void rpc_proc_unregister(const char *p) {} | 73 | static inline void rpc_proc_unregister(struct net *net, const char *p) {} |
74 | static inline void rpc_proc_zero(struct rpc_program *p) {} | 74 | static inline void rpc_proc_zero(const struct rpc_program *p) {} |
75 | 75 | ||
76 | static inline struct proc_dir_entry *svc_proc_register(struct svc_stat *s, | 76 | static inline struct proc_dir_entry *svc_proc_register(struct net *net, struct svc_stat *s, |
77 | const struct file_operations *f) { return NULL; } | 77 | const struct file_operations *f) { return NULL; } |
78 | static inline void svc_proc_unregister(const char *p) {} | 78 | static inline void svc_proc_unregister(struct net *net, const char *p) {} |
79 | 79 | ||
80 | static inline void svc_seq_show(struct seq_file *seq, | 80 | static inline void svc_seq_show(struct seq_file *seq, |
81 | const struct svc_stat *st) {} | 81 | const struct svc_stat *st) {} |
diff --git a/include/linux/sunrpc/svc.h b/include/linux/sunrpc/svc.h index 35b37b1e9299..51b29ac45a8e 100644 --- a/include/linux/sunrpc/svc.h +++ b/include/linux/sunrpc/svc.h | |||
@@ -84,7 +84,8 @@ struct svc_serv { | |||
84 | unsigned int sv_nrpools; /* number of thread pools */ | 84 | unsigned int sv_nrpools; /* number of thread pools */ |
85 | struct svc_pool * sv_pools; /* array of thread pools */ | 85 | struct svc_pool * sv_pools; /* array of thread pools */ |
86 | 86 | ||
87 | void (*sv_shutdown)(struct svc_serv *serv); | 87 | void (*sv_shutdown)(struct svc_serv *serv, |
88 | struct net *net); | ||
88 | /* Callback to use when last thread | 89 | /* Callback to use when last thread |
89 | * exits. | 90 | * exits. |
90 | */ | 91 | */ |
@@ -413,22 +414,24 @@ struct svc_procedure { | |||
413 | /* | 414 | /* |
414 | * Function prototypes. | 415 | * Function prototypes. |
415 | */ | 416 | */ |
416 | void svc_rpcb_cleanup(struct svc_serv *serv); | 417 | int svc_rpcb_setup(struct svc_serv *serv, struct net *net); |
418 | void svc_rpcb_cleanup(struct svc_serv *serv, struct net *net); | ||
417 | struct svc_serv *svc_create(struct svc_program *, unsigned int, | 419 | struct svc_serv *svc_create(struct svc_program *, unsigned int, |
418 | void (*shutdown)(struct svc_serv *)); | 420 | void (*shutdown)(struct svc_serv *, struct net *net)); |
419 | struct svc_rqst *svc_prepare_thread(struct svc_serv *serv, | 421 | struct svc_rqst *svc_prepare_thread(struct svc_serv *serv, |
420 | struct svc_pool *pool, int node); | 422 | struct svc_pool *pool, int node); |
421 | void svc_exit_thread(struct svc_rqst *); | 423 | void svc_exit_thread(struct svc_rqst *); |
422 | struct svc_serv * svc_create_pooled(struct svc_program *, unsigned int, | 424 | struct svc_serv * svc_create_pooled(struct svc_program *, unsigned int, |
423 | void (*shutdown)(struct svc_serv *), | 425 | void (*shutdown)(struct svc_serv *, struct net *net), |
424 | svc_thread_fn, struct module *); | 426 | svc_thread_fn, struct module *); |
425 | int svc_set_num_threads(struct svc_serv *, struct svc_pool *, int); | 427 | int svc_set_num_threads(struct svc_serv *, struct svc_pool *, int); |
426 | int svc_pool_stats_open(struct svc_serv *serv, struct file *file); | 428 | int svc_pool_stats_open(struct svc_serv *serv, struct file *file); |
427 | void svc_destroy(struct svc_serv *); | 429 | void svc_destroy(struct svc_serv *); |
430 | void svc_shutdown_net(struct svc_serv *, struct net *); | ||
428 | int svc_process(struct svc_rqst *); | 431 | int svc_process(struct svc_rqst *); |
429 | int bc_svc_process(struct svc_serv *, struct rpc_rqst *, | 432 | int bc_svc_process(struct svc_serv *, struct rpc_rqst *, |
430 | struct svc_rqst *); | 433 | struct svc_rqst *); |
431 | int svc_register(const struct svc_serv *, const int, | 434 | int svc_register(const struct svc_serv *, struct net *, const int, |
432 | const unsigned short, const unsigned short); | 435 | const unsigned short, const unsigned short); |
433 | 436 | ||
434 | void svc_wake_up(struct svc_serv *); | 437 | void svc_wake_up(struct svc_serv *); |
diff --git a/include/linux/sunrpc/svc_rdma.h b/include/linux/sunrpc/svc_rdma.h index c14fe86dac59..0b8e3e6bdacf 100644 --- a/include/linux/sunrpc/svc_rdma.h +++ b/include/linux/sunrpc/svc_rdma.h | |||
@@ -190,7 +190,7 @@ extern int svc_rdma_xdr_encode_error(struct svcxprt_rdma *, | |||
190 | extern void svc_rdma_xdr_encode_write_list(struct rpcrdma_msg *, int); | 190 | extern void svc_rdma_xdr_encode_write_list(struct rpcrdma_msg *, int); |
191 | extern void svc_rdma_xdr_encode_reply_array(struct rpcrdma_write_array *, int); | 191 | extern void svc_rdma_xdr_encode_reply_array(struct rpcrdma_write_array *, int); |
192 | extern void svc_rdma_xdr_encode_array_chunk(struct rpcrdma_write_array *, int, | 192 | extern void svc_rdma_xdr_encode_array_chunk(struct rpcrdma_write_array *, int, |
193 | u32, u64, u32); | 193 | __be32, __be64, u32); |
194 | extern void svc_rdma_xdr_encode_reply_header(struct svcxprt_rdma *, | 194 | extern void svc_rdma_xdr_encode_reply_header(struct svcxprt_rdma *, |
195 | struct rpcrdma_msg *, | 195 | struct rpcrdma_msg *, |
196 | struct rpcrdma_msg *, | 196 | struct rpcrdma_msg *, |
@@ -292,7 +292,7 @@ svc_rdma_get_reply_array(struct rpcrdma_msg *rmsgp) | |||
292 | if (wr_ary) { | 292 | if (wr_ary) { |
293 | rp_ary = (struct rpcrdma_write_array *) | 293 | rp_ary = (struct rpcrdma_write_array *) |
294 | &wr_ary-> | 294 | &wr_ary-> |
295 | wc_array[wr_ary->wc_nchunks].wc_target.rs_length; | 295 | wc_array[ntohl(wr_ary->wc_nchunks)].wc_target.rs_length; |
296 | 296 | ||
297 | goto found_it; | 297 | goto found_it; |
298 | } | 298 | } |
diff --git a/include/linux/sunrpc/svc_xprt.h b/include/linux/sunrpc/svc_xprt.h index dfa900948af7..b3f64b12f141 100644 --- a/include/linux/sunrpc/svc_xprt.h +++ b/include/linux/sunrpc/svc_xprt.h | |||
@@ -121,7 +121,8 @@ void svc_close_xprt(struct svc_xprt *xprt); | |||
121 | int svc_port_is_privileged(struct sockaddr *sin); | 121 | int svc_port_is_privileged(struct sockaddr *sin); |
122 | int svc_print_xprts(char *buf, int maxlen); | 122 | int svc_print_xprts(char *buf, int maxlen); |
123 | struct svc_xprt *svc_find_xprt(struct svc_serv *serv, const char *xcl_name, | 123 | struct svc_xprt *svc_find_xprt(struct svc_serv *serv, const char *xcl_name, |
124 | const sa_family_t af, const unsigned short port); | 124 | struct net *net, const sa_family_t af, |
125 | const unsigned short port); | ||
125 | int svc_xprt_names(struct svc_serv *serv, char *buf, const int buflen); | 126 | int svc_xprt_names(struct svc_serv *serv, char *buf, const int buflen); |
126 | 127 | ||
127 | static inline void svc_xprt_get(struct svc_xprt *xprt) | 128 | static inline void svc_xprt_get(struct svc_xprt *xprt) |
diff --git a/include/linux/sunrpc/svcauth.h b/include/linux/sunrpc/svcauth.h index 25d333c1b571..548790e9113b 100644 --- a/include/linux/sunrpc/svcauth.h +++ b/include/linux/sunrpc/svcauth.h | |||
@@ -135,6 +135,9 @@ extern void svcauth_unix_purge(void); | |||
135 | extern void svcauth_unix_info_release(struct svc_xprt *xpt); | 135 | extern void svcauth_unix_info_release(struct svc_xprt *xpt); |
136 | extern int svcauth_unix_set_client(struct svc_rqst *rqstp); | 136 | extern int svcauth_unix_set_client(struct svc_rqst *rqstp); |
137 | 137 | ||
138 | extern int unix_gid_cache_create(struct net *net); | ||
139 | extern void unix_gid_cache_destroy(struct net *net); | ||
140 | |||
138 | static inline unsigned long hash_str(char *name, int bits) | 141 | static inline unsigned long hash_str(char *name, int bits) |
139 | { | 142 | { |
140 | unsigned long hash = 0; | 143 | unsigned long hash = 0; |
diff --git a/include/linux/sunrpc/svcauth_gss.h b/include/linux/sunrpc/svcauth_gss.h index 83bbee3f089c..7c32daa025eb 100644 --- a/include/linux/sunrpc/svcauth_gss.h +++ b/include/linux/sunrpc/svcauth_gss.h | |||
@@ -18,6 +18,8 @@ | |||
18 | 18 | ||
19 | int gss_svc_init(void); | 19 | int gss_svc_init(void); |
20 | void gss_svc_shutdown(void); | 20 | void gss_svc_shutdown(void); |
21 | int gss_svc_init_net(struct net *net); | ||
22 | void gss_svc_shutdown_net(struct net *net); | ||
21 | int svcauth_gss_register_pseudoflavor(u32 pseudoflavor, char * name); | 23 | int svcauth_gss_register_pseudoflavor(u32 pseudoflavor, char * name); |
22 | u32 svcauth_gss_flavor(struct auth_domain *dom); | 24 | u32 svcauth_gss_flavor(struct auth_domain *dom); |
23 | char *svc_gss_principal(struct svc_rqst *); | 25 | char *svc_gss_principal(struct svc_rqst *); |
diff --git a/include/linux/sunrpc/svcsock.h b/include/linux/sunrpc/svcsock.h index c84e9741cb2a..cb4ac69e1f33 100644 --- a/include/linux/sunrpc/svcsock.h +++ b/include/linux/sunrpc/svcsock.h | |||
@@ -34,7 +34,7 @@ struct svc_sock { | |||
34 | /* | 34 | /* |
35 | * Function prototypes. | 35 | * Function prototypes. |
36 | */ | 36 | */ |
37 | void svc_close_all(struct svc_serv *); | 37 | void svc_close_net(struct svc_serv *, struct net *); |
38 | int svc_recv(struct svc_rqst *, long); | 38 | int svc_recv(struct svc_rqst *, long); |
39 | int svc_send(struct svc_rqst *); | 39 | int svc_send(struct svc_rqst *); |
40 | void svc_drop(struct svc_rqst *); | 40 | void svc_drop(struct svc_rqst *); |
diff --git a/include/linux/sunrpc/xprt.h b/include/linux/sunrpc/xprt.h index 15518a152ac3..77d278defa70 100644 --- a/include/linux/sunrpc/xprt.h +++ b/include/linux/sunrpc/xprt.h | |||
@@ -21,8 +21,8 @@ | |||
21 | 21 | ||
22 | #define RPC_MIN_SLOT_TABLE (2U) | 22 | #define RPC_MIN_SLOT_TABLE (2U) |
23 | #define RPC_DEF_SLOT_TABLE (16U) | 23 | #define RPC_DEF_SLOT_TABLE (16U) |
24 | #define RPC_MAX_SLOT_TABLE (128U) | ||
25 | #define RPC_MAX_SLOT_TABLE_LIMIT (65536U) | 24 | #define RPC_MAX_SLOT_TABLE_LIMIT (65536U) |
25 | #define RPC_MAX_SLOT_TABLE RPC_MAX_SLOT_TABLE_LIMIT | ||
26 | 26 | ||
27 | /* | 27 | /* |
28 | * This describes a timeout strategy | 28 | * This describes a timeout strategy |
@@ -219,13 +219,17 @@ struct rpc_xprt { | |||
219 | connect_time, /* jiffies waiting for connect */ | 219 | connect_time, /* jiffies waiting for connect */ |
220 | sends, /* how many complete requests */ | 220 | sends, /* how many complete requests */ |
221 | recvs, /* how many complete requests */ | 221 | recvs, /* how many complete requests */ |
222 | bad_xids; /* lookup_rqst didn't find XID */ | 222 | bad_xids, /* lookup_rqst didn't find XID */ |
223 | max_slots; /* max rpc_slots used */ | ||
223 | 224 | ||
224 | unsigned long long req_u, /* average requests on the wire */ | 225 | unsigned long long req_u, /* average requests on the wire */ |
225 | bklog_u; /* backlog queue utilization */ | 226 | bklog_u, /* backlog queue utilization */ |
227 | sending_u, /* send q utilization */ | ||
228 | pending_u; /* pend q utilization */ | ||
226 | } stat; | 229 | } stat; |
227 | 230 | ||
228 | struct net *xprt_net; | 231 | struct net *xprt_net; |
232 | const char *servername; | ||
229 | const char *address_strings[RPC_DISPLAY_MAX]; | 233 | const char *address_strings[RPC_DISPLAY_MAX]; |
230 | }; | 234 | }; |
231 | 235 | ||
@@ -255,6 +259,7 @@ struct xprt_create { | |||
255 | struct sockaddr * srcaddr; /* optional local address */ | 259 | struct sockaddr * srcaddr; /* optional local address */ |
256 | struct sockaddr * dstaddr; /* remote peer address */ | 260 | struct sockaddr * dstaddr; /* remote peer address */ |
257 | size_t addrlen; | 261 | size_t addrlen; |
262 | const char *servername; | ||
258 | struct svc_xprt *bc_xprt; /* NFSv4.1 backchannel */ | 263 | struct svc_xprt *bc_xprt; /* NFSv4.1 backchannel */ |
259 | }; | 264 | }; |
260 | 265 | ||
diff --git a/include/linux/sunrpc/xprtsock.h b/include/linux/sunrpc/xprtsock.h index 3f14a02e9cc0..1ad36cc25b2e 100644 --- a/include/linux/sunrpc/xprtsock.h +++ b/include/linux/sunrpc/xprtsock.h | |||
@@ -12,18 +12,6 @@ | |||
12 | int init_socket_xprt(void); | 12 | int init_socket_xprt(void); |
13 | void cleanup_socket_xprt(void); | 13 | void cleanup_socket_xprt(void); |
14 | 14 | ||
15 | /* | ||
16 | * RPC slot table sizes for UDP, TCP transports | ||
17 | */ | ||
18 | extern unsigned int xprt_udp_slot_table_entries; | ||
19 | extern unsigned int xprt_tcp_slot_table_entries; | ||
20 | |||
21 | /* | ||
22 | * Parameters for choosing a free port | ||
23 | */ | ||
24 | extern unsigned int xprt_min_resvport; | ||
25 | extern unsigned int xprt_max_resvport; | ||
26 | |||
27 | #define RPC_MIN_RESVPORT (1U) | 15 | #define RPC_MIN_RESVPORT (1U) |
28 | #define RPC_MAX_RESVPORT (65535U) | 16 | #define RPC_MAX_RESVPORT (65535U) |
29 | #define RPC_DEF_MIN_RESVPORT (665U) | 17 | #define RPC_DEF_MIN_RESVPORT (665U) |
diff --git a/include/linux/sunserialcore.h b/include/linux/sunserialcore.h new file mode 100644 index 000000000000..68e7430bb0fe --- /dev/null +++ b/include/linux/sunserialcore.h | |||
@@ -0,0 +1,33 @@ | |||
1 | /* sunserialcore.h | ||
2 | * | ||
3 | * Generic SUN serial/kbd/ms layer. Based entirely | ||
4 | * upon drivers/sbus/char/sunserial.h which is: | ||
5 | * | ||
6 | * Copyright (C) 1997 Eddie C. Dost (ecd@skynet.be) | ||
7 | * | ||
8 | * Port to new UART layer is: | ||
9 | * | ||
10 | * Copyright (C) 2002 David S. Miller (davem@redhat.com) | ||
11 | */ | ||
12 | |||
13 | #ifndef _SERIAL_SUN_H | ||
14 | #define _SERIAL_SUN_H | ||
15 | |||
16 | /* Serial keyboard defines for L1-A processing... */ | ||
17 | #define SUNKBD_RESET 0xff | ||
18 | #define SUNKBD_L1 0x01 | ||
19 | #define SUNKBD_UP 0x80 | ||
20 | #define SUNKBD_A 0x4d | ||
21 | |||
22 | extern unsigned int suncore_mouse_baud_cflag_next(unsigned int, int *); | ||
23 | extern int suncore_mouse_baud_detection(unsigned char, int); | ||
24 | |||
25 | extern int sunserial_register_minors(struct uart_driver *, int); | ||
26 | extern void sunserial_unregister_minors(struct uart_driver *, int); | ||
27 | |||
28 | extern int sunserial_console_match(struct console *, struct device_node *, | ||
29 | struct uart_driver *, int, bool); | ||
30 | extern void sunserial_console_termios(struct console *, | ||
31 | struct device_node *); | ||
32 | |||
33 | #endif /* !(_SERIAL_SUN_H) */ | ||
diff --git a/include/linux/suspend.h b/include/linux/suspend.h index 91784a4f8608..ac1c114c499d 100644 --- a/include/linux/suspend.h +++ b/include/linux/suspend.h | |||
@@ -42,8 +42,10 @@ enum suspend_stat_step { | |||
42 | SUSPEND_FREEZE = 1, | 42 | SUSPEND_FREEZE = 1, |
43 | SUSPEND_PREPARE, | 43 | SUSPEND_PREPARE, |
44 | SUSPEND_SUSPEND, | 44 | SUSPEND_SUSPEND, |
45 | SUSPEND_SUSPEND_LATE, | ||
45 | SUSPEND_SUSPEND_NOIRQ, | 46 | SUSPEND_SUSPEND_NOIRQ, |
46 | SUSPEND_RESUME_NOIRQ, | 47 | SUSPEND_RESUME_NOIRQ, |
48 | SUSPEND_RESUME_EARLY, | ||
47 | SUSPEND_RESUME | 49 | SUSPEND_RESUME |
48 | }; | 50 | }; |
49 | 51 | ||
@@ -53,8 +55,10 @@ struct suspend_stats { | |||
53 | int failed_freeze; | 55 | int failed_freeze; |
54 | int failed_prepare; | 56 | int failed_prepare; |
55 | int failed_suspend; | 57 | int failed_suspend; |
58 | int failed_suspend_late; | ||
56 | int failed_suspend_noirq; | 59 | int failed_suspend_noirq; |
57 | int failed_resume; | 60 | int failed_resume; |
61 | int failed_resume_early; | ||
58 | int failed_resume_noirq; | 62 | int failed_resume_noirq; |
59 | #define REC_FAILED_NUM 2 | 63 | #define REC_FAILED_NUM 2 |
60 | int last_failed_dev; | 64 | int last_failed_dev; |
diff --git a/include/linux/swap.h b/include/linux/swap.h index 3e60228e7299..b1fd5c7925fe 100644 --- a/include/linux/swap.h +++ b/include/linux/swap.h | |||
@@ -21,6 +21,9 @@ struct bio; | |||
21 | #define SWAP_FLAG_PRIO_SHIFT 0 | 21 | #define SWAP_FLAG_PRIO_SHIFT 0 |
22 | #define SWAP_FLAG_DISCARD 0x10000 /* discard swap cluster after use */ | 22 | #define SWAP_FLAG_DISCARD 0x10000 /* discard swap cluster after use */ |
23 | 23 | ||
24 | #define SWAP_FLAGS_VALID (SWAP_FLAG_PRIO_MASK | SWAP_FLAG_PREFER | \ | ||
25 | SWAP_FLAG_DISCARD) | ||
26 | |||
24 | static inline int current_is_kswapd(void) | 27 | static inline int current_is_kswapd(void) |
25 | { | 28 | { |
26 | return current->flags & PF_KSWAPD; | 29 | return current->flags & PF_KSWAPD; |
@@ -223,6 +226,7 @@ extern void lru_add_page_tail(struct zone* zone, | |||
223 | extern void activate_page(struct page *); | 226 | extern void activate_page(struct page *); |
224 | extern void mark_page_accessed(struct page *); | 227 | extern void mark_page_accessed(struct page *); |
225 | extern void lru_add_drain(void); | 228 | extern void lru_add_drain(void); |
229 | extern void lru_add_drain_cpu(int cpu); | ||
226 | extern int lru_add_drain_all(void); | 230 | extern int lru_add_drain_all(void); |
227 | extern void rotate_reclaimable_page(struct page *page); | 231 | extern void rotate_reclaimable_page(struct page *page); |
228 | extern void deactivate_page(struct page *page); | 232 | extern void deactivate_page(struct page *page); |
@@ -301,6 +305,13 @@ static inline int mem_cgroup_swappiness(struct mem_cgroup *mem) | |||
301 | return vm_swappiness; | 305 | return vm_swappiness; |
302 | } | 306 | } |
303 | #endif | 307 | #endif |
308 | #ifdef CONFIG_CGROUP_MEM_RES_CTLR_SWAP | ||
309 | extern void mem_cgroup_uncharge_swap(swp_entry_t ent); | ||
310 | #else | ||
311 | static inline void mem_cgroup_uncharge_swap(swp_entry_t ent) | ||
312 | { | ||
313 | } | ||
314 | #endif | ||
304 | #ifdef CONFIG_SWAP | 315 | #ifdef CONFIG_SWAP |
305 | /* linux/mm/page_io.c */ | 316 | /* linux/mm/page_io.c */ |
306 | extern int swap_readpage(struct page *); | 317 | extern int swap_readpage(struct page *); |
@@ -329,7 +340,6 @@ extern long total_swap_pages; | |||
329 | extern void si_swapinfo(struct sysinfo *); | 340 | extern void si_swapinfo(struct sysinfo *); |
330 | extern swp_entry_t get_swap_page(void); | 341 | extern swp_entry_t get_swap_page(void); |
331 | extern swp_entry_t get_swap_page_of_type(int); | 342 | extern swp_entry_t get_swap_page_of_type(int); |
332 | extern int valid_swaphandles(swp_entry_t, unsigned long *); | ||
333 | extern int add_swap_count_continuation(swp_entry_t, gfp_t); | 343 | extern int add_swap_count_continuation(swp_entry_t, gfp_t); |
334 | extern void swap_shmem_alloc(swp_entry_t); | 344 | extern void swap_shmem_alloc(swp_entry_t); |
335 | extern int swap_duplicate(swp_entry_t); | 345 | extern int swap_duplicate(swp_entry_t); |
@@ -372,13 +382,6 @@ mem_cgroup_uncharge_swapcache(struct page *page, swp_entry_t ent, bool swapout) | |||
372 | { | 382 | { |
373 | } | 383 | } |
374 | #endif | 384 | #endif |
375 | #ifdef CONFIG_CGROUP_MEM_RES_CTLR_SWAP | ||
376 | extern void mem_cgroup_uncharge_swap(swp_entry_t ent); | ||
377 | #else | ||
378 | static inline void mem_cgroup_uncharge_swap(swp_entry_t ent) | ||
379 | { | ||
380 | } | ||
381 | #endif | ||
382 | 385 | ||
383 | #else /* CONFIG_SWAP */ | 386 | #else /* CONFIG_SWAP */ |
384 | 387 | ||
diff --git a/include/linux/swapops.h b/include/linux/swapops.h index 2189d3ffc85d..792d16d9cbc7 100644 --- a/include/linux/swapops.h +++ b/include/linux/swapops.h | |||
@@ -2,6 +2,7 @@ | |||
2 | #define _LINUX_SWAPOPS_H | 2 | #define _LINUX_SWAPOPS_H |
3 | 3 | ||
4 | #include <linux/radix-tree.h> | 4 | #include <linux/radix-tree.h> |
5 | #include <linux/bug.h> | ||
5 | 6 | ||
6 | /* | 7 | /* |
7 | * swapcache pages are stored in the swapper_space radix tree. We want to | 8 | * swapcache pages are stored in the swapper_space radix tree. We want to |
diff --git a/include/linux/sys_soc.h b/include/linux/sys_soc.h new file mode 100644 index 000000000000..2739ccb69571 --- /dev/null +++ b/include/linux/sys_soc.h | |||
@@ -0,0 +1,37 @@ | |||
1 | /* | ||
2 | * Copyright (C) ST-Ericsson SA 2011 | ||
3 | * Author: Lee Jones <lee.jones@linaro.org> for ST-Ericsson. | ||
4 | * License terms: GNU General Public License (GPL), version 2 | ||
5 | */ | ||
6 | #ifndef __SOC_BUS_H | ||
7 | #define __SOC_BUS_H | ||
8 | |||
9 | #include <linux/device.h> | ||
10 | |||
11 | struct soc_device_attribute { | ||
12 | const char *machine; | ||
13 | const char *family; | ||
14 | const char *revision; | ||
15 | const char *soc_id; | ||
16 | }; | ||
17 | |||
18 | /** | ||
19 | * soc_device_register - register SoC as a device | ||
20 | * @soc_plat_dev_attr: Attributes passed from platform to be attributed to a SoC | ||
21 | */ | ||
22 | struct soc_device *soc_device_register( | ||
23 | struct soc_device_attribute *soc_plat_dev_attr); | ||
24 | |||
25 | /** | ||
26 | * soc_device_unregister - unregister SoC device | ||
27 | * @dev: SoC device to be unregistered | ||
28 | */ | ||
29 | void soc_device_unregister(struct soc_device *soc_dev); | ||
30 | |||
31 | /** | ||
32 | * soc_device_to_device - helper function to fetch struct device | ||
33 | * @soc: Previously registered SoC device container | ||
34 | */ | ||
35 | struct device *soc_device_to_device(struct soc_device *soc); | ||
36 | |||
37 | #endif /* __SOC_BUS_H */ | ||
diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h index 8ec1153ff57b..3de3acb84a95 100644 --- a/include/linux/syscalls.h +++ b/include/linux/syscalls.h | |||
@@ -68,6 +68,7 @@ struct file_handle; | |||
68 | #include <linux/aio_abi.h> | 68 | #include <linux/aio_abi.h> |
69 | #include <linux/capability.h> | 69 | #include <linux/capability.h> |
70 | #include <linux/list.h> | 70 | #include <linux/list.h> |
71 | #include <linux/bug.h> | ||
71 | #include <linux/sem.h> | 72 | #include <linux/sem.h> |
72 | #include <asm/siginfo.h> | 73 | #include <asm/siginfo.h> |
73 | #include <asm/signal.h> | 74 | #include <asm/signal.h> |
diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h index bb9127dd814b..c34b4c82b0dc 100644 --- a/include/linux/sysctl.h +++ b/include/linux/sysctl.h | |||
@@ -932,34 +932,14 @@ enum | |||
932 | #include <linux/list.h> | 932 | #include <linux/list.h> |
933 | #include <linux/rcupdate.h> | 933 | #include <linux/rcupdate.h> |
934 | #include <linux/wait.h> | 934 | #include <linux/wait.h> |
935 | #include <linux/rbtree.h> | ||
935 | 936 | ||
936 | /* For the /proc/sys support */ | 937 | /* For the /proc/sys support */ |
937 | struct ctl_table; | 938 | struct ctl_table; |
938 | struct nsproxy; | 939 | struct nsproxy; |
939 | struct ctl_table_root; | 940 | struct ctl_table_root; |
940 | |||
941 | struct ctl_table_set { | ||
942 | struct list_head list; | ||
943 | struct ctl_table_set *parent; | ||
944 | int (*is_seen)(struct ctl_table_set *); | ||
945 | }; | ||
946 | |||
947 | extern void setup_sysctl_set(struct ctl_table_set *p, | ||
948 | struct ctl_table_set *parent, | ||
949 | int (*is_seen)(struct ctl_table_set *)); | ||
950 | |||
951 | struct ctl_table_header; | 941 | struct ctl_table_header; |
952 | 942 | struct ctl_dir; | |
953 | extern void sysctl_head_get(struct ctl_table_header *); | ||
954 | extern void sysctl_head_put(struct ctl_table_header *); | ||
955 | extern int sysctl_is_seen(struct ctl_table_header *); | ||
956 | extern struct ctl_table_header *sysctl_head_grab(struct ctl_table_header *); | ||
957 | extern struct ctl_table_header *sysctl_head_next(struct ctl_table_header *prev); | ||
958 | extern struct ctl_table_header *__sysctl_head_next(struct nsproxy *namespaces, | ||
959 | struct ctl_table_header *prev); | ||
960 | extern void sysctl_head_finish(struct ctl_table_header *prev); | ||
961 | extern int sysctl_perm(struct ctl_table_root *root, | ||
962 | struct ctl_table *table, int op); | ||
963 | 943 | ||
964 | typedef struct ctl_table ctl_table; | 944 | typedef struct ctl_table ctl_table; |
965 | 945 | ||
@@ -1023,8 +1003,6 @@ static inline void *proc_sys_poll_event(struct ctl_table_poll *poll) | |||
1023 | return (void *)(unsigned long)atomic_read(&poll->event); | 1003 | return (void *)(unsigned long)atomic_read(&poll->event); |
1024 | } | 1004 | } |
1025 | 1005 | ||
1026 | void proc_sys_poll_notify(struct ctl_table_poll *poll); | ||
1027 | |||
1028 | #define __CTL_TABLE_POLL_INITIALIZER(name) { \ | 1006 | #define __CTL_TABLE_POLL_INITIALIZER(name) { \ |
1029 | .event = ATOMIC_INIT(0), \ | 1007 | .event = ATOMIC_INIT(0), \ |
1030 | .wait = __WAIT_QUEUE_HEAD_INITIALIZER(name.wait) } | 1008 | .wait = __WAIT_QUEUE_HEAD_INITIALIZER(name.wait) } |
@@ -1039,21 +1017,16 @@ struct ctl_table | |||
1039 | void *data; | 1017 | void *data; |
1040 | int maxlen; | 1018 | int maxlen; |
1041 | umode_t mode; | 1019 | umode_t mode; |
1042 | struct ctl_table *child; | 1020 | struct ctl_table *child; /* Deprecated */ |
1043 | struct ctl_table *parent; /* Automatically set */ | ||
1044 | proc_handler *proc_handler; /* Callback for text formatting */ | 1021 | proc_handler *proc_handler; /* Callback for text formatting */ |
1045 | struct ctl_table_poll *poll; | 1022 | struct ctl_table_poll *poll; |
1046 | void *extra1; | 1023 | void *extra1; |
1047 | void *extra2; | 1024 | void *extra2; |
1048 | }; | 1025 | }; |
1049 | 1026 | ||
1050 | struct ctl_table_root { | 1027 | struct ctl_node { |
1051 | struct list_head root_list; | 1028 | struct rb_node node; |
1052 | struct ctl_table_set default_set; | 1029 | struct ctl_table_header *header; |
1053 | struct ctl_table_set *(*lookup)(struct ctl_table_root *root, | ||
1054 | struct nsproxy *namespaces); | ||
1055 | int (*permissions)(struct ctl_table_root *root, | ||
1056 | struct nsproxy *namespaces, struct ctl_table *table); | ||
1057 | }; | 1030 | }; |
1058 | 1031 | ||
1059 | /* struct ctl_table_header is used to maintain dynamic lists of | 1032 | /* struct ctl_table_header is used to maintain dynamic lists of |
@@ -1063,9 +1036,9 @@ struct ctl_table_header | |||
1063 | union { | 1036 | union { |
1064 | struct { | 1037 | struct { |
1065 | struct ctl_table *ctl_table; | 1038 | struct ctl_table *ctl_table; |
1066 | struct list_head ctl_entry; | ||
1067 | int used; | 1039 | int used; |
1068 | int count; | 1040 | int count; |
1041 | int nreg; | ||
1069 | }; | 1042 | }; |
1070 | struct rcu_head rcu; | 1043 | struct rcu_head rcu; |
1071 | }; | 1044 | }; |
@@ -1073,9 +1046,27 @@ struct ctl_table_header | |||
1073 | struct ctl_table *ctl_table_arg; | 1046 | struct ctl_table *ctl_table_arg; |
1074 | struct ctl_table_root *root; | 1047 | struct ctl_table_root *root; |
1075 | struct ctl_table_set *set; | 1048 | struct ctl_table_set *set; |
1076 | struct ctl_table *attached_by; | 1049 | struct ctl_dir *parent; |
1077 | struct ctl_table *attached_to; | 1050 | struct ctl_node *node; |
1078 | struct ctl_table_header *parent; | 1051 | }; |
1052 | |||
1053 | struct ctl_dir { | ||
1054 | /* Header must be at the start of ctl_dir */ | ||
1055 | struct ctl_table_header header; | ||
1056 | struct rb_root root; | ||
1057 | }; | ||
1058 | |||
1059 | struct ctl_table_set { | ||
1060 | int (*is_seen)(struct ctl_table_set *); | ||
1061 | struct ctl_dir dir; | ||
1062 | }; | ||
1063 | |||
1064 | struct ctl_table_root { | ||
1065 | struct ctl_table_set default_set; | ||
1066 | struct ctl_table_set *(*lookup)(struct ctl_table_root *root, | ||
1067 | struct nsproxy *namespaces); | ||
1068 | int (*permissions)(struct ctl_table_root *root, | ||
1069 | struct nsproxy *namespaces, struct ctl_table *table); | ||
1079 | }; | 1070 | }; |
1080 | 1071 | ||
1081 | /* struct ctl_path describes where in the hierarchy a table is added */ | 1072 | /* struct ctl_path describes where in the hierarchy a table is added */ |
@@ -1083,16 +1074,53 @@ struct ctl_path { | |||
1083 | const char *procname; | 1074 | const char *procname; |
1084 | }; | 1075 | }; |
1085 | 1076 | ||
1077 | #ifdef CONFIG_SYSCTL | ||
1078 | |||
1079 | void proc_sys_poll_notify(struct ctl_table_poll *poll); | ||
1080 | |||
1081 | extern void setup_sysctl_set(struct ctl_table_set *p, | ||
1082 | struct ctl_table_root *root, | ||
1083 | int (*is_seen)(struct ctl_table_set *)); | ||
1084 | extern void retire_sysctl_set(struct ctl_table_set *set); | ||
1085 | |||
1086 | void register_sysctl_root(struct ctl_table_root *root); | 1086 | void register_sysctl_root(struct ctl_table_root *root); |
1087 | struct ctl_table_header *__register_sysctl_table( | ||
1088 | struct ctl_table_set *set, | ||
1089 | const char *path, struct ctl_table *table); | ||
1087 | struct ctl_table_header *__register_sysctl_paths( | 1090 | struct ctl_table_header *__register_sysctl_paths( |
1088 | struct ctl_table_root *root, struct nsproxy *namespaces, | 1091 | struct ctl_table_set *set, |
1089 | const struct ctl_path *path, struct ctl_table *table); | 1092 | const struct ctl_path *path, struct ctl_table *table); |
1093 | struct ctl_table_header *register_sysctl(const char *path, struct ctl_table *table); | ||
1090 | struct ctl_table_header *register_sysctl_table(struct ctl_table * table); | 1094 | struct ctl_table_header *register_sysctl_table(struct ctl_table * table); |
1091 | struct ctl_table_header *register_sysctl_paths(const struct ctl_path *path, | 1095 | struct ctl_table_header *register_sysctl_paths(const struct ctl_path *path, |
1092 | struct ctl_table *table); | 1096 | struct ctl_table *table); |
1093 | 1097 | ||
1094 | void unregister_sysctl_table(struct ctl_table_header * table); | 1098 | void unregister_sysctl_table(struct ctl_table_header * table); |
1095 | int sysctl_check_table(struct nsproxy *namespaces, struct ctl_table *table); | 1099 | |
1100 | extern int sysctl_init(void); | ||
1101 | #else /* CONFIG_SYSCTL */ | ||
1102 | static inline struct ctl_table_header *register_sysctl_table(struct ctl_table * table) | ||
1103 | { | ||
1104 | return NULL; | ||
1105 | } | ||
1106 | |||
1107 | static inline struct ctl_table_header *register_sysctl_paths( | ||
1108 | const struct ctl_path *path, struct ctl_table *table) | ||
1109 | { | ||
1110 | return NULL; | ||
1111 | } | ||
1112 | |||
1113 | static inline void unregister_sysctl_table(struct ctl_table_header * table) | ||
1114 | { | ||
1115 | } | ||
1116 | |||
1117 | static inline void setup_sysctl_set(struct ctl_table_set *p, | ||
1118 | struct ctl_table_root *root, | ||
1119 | int (*is_seen)(struct ctl_table_set *)) | ||
1120 | { | ||
1121 | } | ||
1122 | |||
1123 | #endif /* CONFIG_SYSCTL */ | ||
1096 | 1124 | ||
1097 | #endif /* __KERNEL__ */ | 1125 | #endif /* __KERNEL__ */ |
1098 | 1126 | ||
diff --git a/include/linux/sysinfo.h b/include/linux/sysinfo.h new file mode 100644 index 000000000000..934335a22522 --- /dev/null +++ b/include/linux/sysinfo.h | |||
@@ -0,0 +1,24 @@ | |||
1 | #ifndef _LINUX_SYSINFO_H | ||
2 | #define _LINUX_SYSINFO_H | ||
3 | |||
4 | #include <linux/types.h> | ||
5 | |||
6 | #define SI_LOAD_SHIFT 16 | ||
7 | struct sysinfo { | ||
8 | __kernel_long_t uptime; /* Seconds since boot */ | ||
9 | __kernel_ulong_t loads[3]; /* 1, 5, and 15 minute load averages */ | ||
10 | __kernel_ulong_t totalram; /* Total usable main memory size */ | ||
11 | __kernel_ulong_t freeram; /* Available memory size */ | ||
12 | __kernel_ulong_t sharedram; /* Amount of shared memory */ | ||
13 | __kernel_ulong_t bufferram; /* Memory used by buffers */ | ||
14 | __kernel_ulong_t totalswap; /* Total swap space size */ | ||
15 | __kernel_ulong_t freeswap; /* swap space still available */ | ||
16 | __u16 procs; /* Number of current processes */ | ||
17 | __u16 pad; /* Explicit padding for m68k */ | ||
18 | __kernel_ulong_t totalhigh; /* Total high memory size */ | ||
19 | __kernel_ulong_t freehigh; /* Available high memory size */ | ||
20 | __u32 mem_unit; /* Memory unit size in bytes */ | ||
21 | char _f[20-2*sizeof(__kernel_ulong_t)-sizeof(__u32)]; /* Padding: libc5 uses this.. */ | ||
22 | }; | ||
23 | |||
24 | #endif /* _LINUX_SYSINFO_H */ | ||
diff --git a/include/linux/tboot.h b/include/linux/tboot.h index 1dba6ee55203..c75128bed5fa 100644 --- a/include/linux/tboot.h +++ b/include/linux/tboot.h | |||
@@ -143,7 +143,6 @@ static inline int tboot_enabled(void) | |||
143 | 143 | ||
144 | extern void tboot_probe(void); | 144 | extern void tboot_probe(void); |
145 | extern void tboot_shutdown(u32 shutdown_type); | 145 | extern void tboot_shutdown(u32 shutdown_type); |
146 | extern void tboot_sleep(u8 sleep_state, u32 pm1a_control, u32 pm1b_control); | ||
147 | extern struct acpi_table_header *tboot_get_dmar_table( | 146 | extern struct acpi_table_header *tboot_get_dmar_table( |
148 | struct acpi_table_header *dmar_tbl); | 147 | struct acpi_table_header *dmar_tbl); |
149 | extern int tboot_force_iommu(void); | 148 | extern int tboot_force_iommu(void); |
diff --git a/include/linux/tcp.h b/include/linux/tcp.h index 46a85c9e1f25..b6c62d294380 100644 --- a/include/linux/tcp.h +++ b/include/linux/tcp.h | |||
@@ -412,7 +412,8 @@ struct tcp_sock { | |||
412 | 412 | ||
413 | struct tcp_sack_block recv_sack_cache[4]; | 413 | struct tcp_sack_block recv_sack_cache[4]; |
414 | 414 | ||
415 | struct sk_buff *highest_sack; /* highest skb with SACK received | 415 | struct sk_buff *highest_sack; /* skb just after the highest |
416 | * skb with SACKed bit set | ||
416 | * (validity guaranteed only if | 417 | * (validity guaranteed only if |
417 | * sacked_out > 0) | 418 | * sacked_out > 0) |
418 | */ | 419 | */ |
@@ -463,7 +464,7 @@ struct tcp_sock { | |||
463 | const struct tcp_sock_af_ops *af_specific; | 464 | const struct tcp_sock_af_ops *af_specific; |
464 | 465 | ||
465 | /* TCP MD5 Signature Option information */ | 466 | /* TCP MD5 Signature Option information */ |
466 | struct tcp_md5sig_info *md5sig_info; | 467 | struct tcp_md5sig_info __rcu *md5sig_info; |
467 | #endif | 468 | #endif |
468 | 469 | ||
469 | /* When the cookie options are generated and exchanged, then this | 470 | /* When the cookie options are generated and exchanged, then this |
@@ -486,8 +487,7 @@ struct tcp_timewait_sock { | |||
486 | u32 tw_ts_recent; | 487 | u32 tw_ts_recent; |
487 | long tw_ts_recent_stamp; | 488 | long tw_ts_recent_stamp; |
488 | #ifdef CONFIG_TCP_MD5SIG | 489 | #ifdef CONFIG_TCP_MD5SIG |
489 | u16 tw_md5_keylen; | 490 | struct tcp_md5sig_key *tw_md5_key; |
490 | u8 tw_md5_key[TCP_MD5SIG_MAXKEYLEN]; | ||
491 | #endif | 491 | #endif |
492 | /* Few sockets in timewait have cookies; in that case, then this | 492 | /* Few sockets in timewait have cookies; in that case, then this |
493 | * object holds a reference to them (tw_cookie_values->kref). | 493 | * object holds a reference to them (tw_cookie_values->kref). |
diff --git a/include/linux/time.h b/include/linux/time.h index b3061782dec3..33a92ead4d88 100644 --- a/include/linux/time.h +++ b/include/linux/time.h | |||
@@ -116,7 +116,6 @@ static inline struct timespec timespec_sub(struct timespec lhs, | |||
116 | extern void read_persistent_clock(struct timespec *ts); | 116 | extern void read_persistent_clock(struct timespec *ts); |
117 | extern void read_boot_clock(struct timespec *ts); | 117 | extern void read_boot_clock(struct timespec *ts); |
118 | extern int update_persistent_clock(struct timespec now); | 118 | extern int update_persistent_clock(struct timespec now); |
119 | extern int no_sync_cmos_clock __read_mostly; | ||
120 | void timekeeping_init(void); | 119 | void timekeeping_init(void); |
121 | extern int timekeeping_suspended; | 120 | extern int timekeeping_suspended; |
122 | 121 | ||
@@ -256,6 +255,7 @@ static __always_inline void timespec_add_ns(struct timespec *a, u64 ns) | |||
256 | a->tv_sec += __iter_div_u64_rem(a->tv_nsec + ns, NSEC_PER_SEC, &ns); | 255 | a->tv_sec += __iter_div_u64_rem(a->tv_nsec + ns, NSEC_PER_SEC, &ns); |
257 | a->tv_nsec = ns; | 256 | a->tv_nsec = ns; |
258 | } | 257 | } |
258 | |||
259 | #endif /* __KERNEL__ */ | 259 | #endif /* __KERNEL__ */ |
260 | 260 | ||
261 | #define NFDBITS __NFDBITS | 261 | #define NFDBITS __NFDBITS |
diff --git a/include/linux/timex.h b/include/linux/timex.h index aa60fe7b6ed6..99bc88b1fc02 100644 --- a/include/linux/timex.h +++ b/include/linux/timex.h | |||
@@ -234,23 +234,9 @@ struct timex { | |||
234 | extern unsigned long tick_usec; /* USER_HZ period (usec) */ | 234 | extern unsigned long tick_usec; /* USER_HZ period (usec) */ |
235 | extern unsigned long tick_nsec; /* ACTHZ period (nsec) */ | 235 | extern unsigned long tick_nsec; /* ACTHZ period (nsec) */ |
236 | 236 | ||
237 | /* | ||
238 | * phase-lock loop variables | ||
239 | */ | ||
240 | extern int time_status; /* clock synchronization status bits */ | ||
241 | |||
242 | extern void ntp_init(void); | 237 | extern void ntp_init(void); |
243 | extern void ntp_clear(void); | 238 | extern void ntp_clear(void); |
244 | 239 | ||
245 | /** | ||
246 | * ntp_synced - Returns 1 if the NTP status is not UNSYNC | ||
247 | * | ||
248 | */ | ||
249 | static inline int ntp_synced(void) | ||
250 | { | ||
251 | return !(time_status & STA_UNSYNC); | ||
252 | } | ||
253 | |||
254 | /* Required to safely shift negative values */ | 240 | /* Required to safely shift negative values */ |
255 | #define shift_right(x, s) ({ \ | 241 | #define shift_right(x, s) ({ \ |
256 | __typeof__(x) __x = (x); \ | 242 | __typeof__(x) __x = (x); \ |
@@ -264,10 +250,9 @@ static inline int ntp_synced(void) | |||
264 | #define NTP_INTERVAL_LENGTH (NSEC_PER_SEC/NTP_INTERVAL_FREQ) | 250 | #define NTP_INTERVAL_LENGTH (NSEC_PER_SEC/NTP_INTERVAL_FREQ) |
265 | 251 | ||
266 | /* Returns how long ticks are at present, in ns / 2^NTP_SCALE_SHIFT. */ | 252 | /* Returns how long ticks are at present, in ns / 2^NTP_SCALE_SHIFT. */ |
267 | extern u64 tick_length; | 253 | extern u64 ntp_tick_length(void); |
268 | 254 | ||
269 | extern void second_overflow(void); | 255 | extern int second_overflow(unsigned long secs); |
270 | extern void update_ntp_one_tick(void); | ||
271 | extern int do_adjtimex(struct timex *); | 256 | extern int do_adjtimex(struct timex *); |
272 | extern void hardpps(const struct timespec *, const struct timespec *); | 257 | extern void hardpps(const struct timespec *, const struct timespec *); |
273 | 258 | ||
diff --git a/include/linux/trace_seq.h b/include/linux/trace_seq.h index 7dadc3df0c77..a32d86ec8bf2 100644 --- a/include/linux/trace_seq.h +++ b/include/linux/trace_seq.h | |||
@@ -44,7 +44,7 @@ extern int trace_seq_putmem(struct trace_seq *s, const void *mem, size_t len); | |||
44 | extern int trace_seq_putmem_hex(struct trace_seq *s, const void *mem, | 44 | extern int trace_seq_putmem_hex(struct trace_seq *s, const void *mem, |
45 | size_t len); | 45 | size_t len); |
46 | extern void *trace_seq_reserve(struct trace_seq *s, size_t len); | 46 | extern void *trace_seq_reserve(struct trace_seq *s, size_t len); |
47 | extern int trace_seq_path(struct trace_seq *s, struct path *path); | 47 | extern int trace_seq_path(struct trace_seq *s, const struct path *path); |
48 | 48 | ||
49 | #else /* CONFIG_TRACING */ | 49 | #else /* CONFIG_TRACING */ |
50 | static inline int trace_seq_printf(struct trace_seq *s, const char *fmt, ...) | 50 | static inline int trace_seq_printf(struct trace_seq *s, const char *fmt, ...) |
@@ -88,7 +88,7 @@ static inline void *trace_seq_reserve(struct trace_seq *s, size_t len) | |||
88 | { | 88 | { |
89 | return NULL; | 89 | return NULL; |
90 | } | 90 | } |
91 | static inline int trace_seq_path(struct trace_seq *s, struct path *path) | 91 | static inline int trace_seq_path(struct trace_seq *s, const struct path *path) |
92 | { | 92 | { |
93 | return 0; | 93 | return 0; |
94 | } | 94 | } |
diff --git a/include/linux/tracehook.h b/include/linux/tracehook.h index a71a2927a6a0..51bd91d911c3 100644 --- a/include/linux/tracehook.h +++ b/include/linux/tracehook.h | |||
@@ -54,12 +54,12 @@ struct linux_binprm; | |||
54 | /* | 54 | /* |
55 | * ptrace report for syscall entry and exit looks identical. | 55 | * ptrace report for syscall entry and exit looks identical. |
56 | */ | 56 | */ |
57 | static inline void ptrace_report_syscall(struct pt_regs *regs) | 57 | static inline int ptrace_report_syscall(struct pt_regs *regs) |
58 | { | 58 | { |
59 | int ptrace = current->ptrace; | 59 | int ptrace = current->ptrace; |
60 | 60 | ||
61 | if (!(ptrace & PT_PTRACED)) | 61 | if (!(ptrace & PT_PTRACED)) |
62 | return; | 62 | return 0; |
63 | 63 | ||
64 | ptrace_notify(SIGTRAP | ((ptrace & PT_TRACESYSGOOD) ? 0x80 : 0)); | 64 | ptrace_notify(SIGTRAP | ((ptrace & PT_TRACESYSGOOD) ? 0x80 : 0)); |
65 | 65 | ||
@@ -72,6 +72,8 @@ static inline void ptrace_report_syscall(struct pt_regs *regs) | |||
72 | send_sig(current->exit_code, current, 1); | 72 | send_sig(current->exit_code, current, 1); |
73 | current->exit_code = 0; | 73 | current->exit_code = 0; |
74 | } | 74 | } |
75 | |||
76 | return fatal_signal_pending(current); | ||
75 | } | 77 | } |
76 | 78 | ||
77 | /** | 79 | /** |
@@ -96,8 +98,7 @@ static inline void ptrace_report_syscall(struct pt_regs *regs) | |||
96 | static inline __must_check int tracehook_report_syscall_entry( | 98 | static inline __must_check int tracehook_report_syscall_entry( |
97 | struct pt_regs *regs) | 99 | struct pt_regs *regs) |
98 | { | 100 | { |
99 | ptrace_report_syscall(regs); | 101 | return ptrace_report_syscall(regs); |
100 | return 0; | ||
101 | } | 102 | } |
102 | 103 | ||
103 | /** | 104 | /** |
diff --git a/include/linux/tracepoint.h b/include/linux/tracepoint.h index df0a779c1bbd..bd96ecd0e05c 100644 --- a/include/linux/tracepoint.h +++ b/include/linux/tracepoint.h | |||
@@ -17,7 +17,7 @@ | |||
17 | #include <linux/errno.h> | 17 | #include <linux/errno.h> |
18 | #include <linux/types.h> | 18 | #include <linux/types.h> |
19 | #include <linux/rcupdate.h> | 19 | #include <linux/rcupdate.h> |
20 | #include <linux/jump_label.h> | 20 | #include <linux/static_key.h> |
21 | 21 | ||
22 | struct module; | 22 | struct module; |
23 | struct tracepoint; | 23 | struct tracepoint; |
@@ -29,7 +29,7 @@ struct tracepoint_func { | |||
29 | 29 | ||
30 | struct tracepoint { | 30 | struct tracepoint { |
31 | const char *name; /* Tracepoint name */ | 31 | const char *name; /* Tracepoint name */ |
32 | struct jump_label_key key; | 32 | struct static_key key; |
33 | void (*regfunc)(void); | 33 | void (*regfunc)(void); |
34 | void (*unregfunc)(void); | 34 | void (*unregfunc)(void); |
35 | struct tracepoint_func __rcu *funcs; | 35 | struct tracepoint_func __rcu *funcs; |
@@ -114,7 +114,7 @@ static inline void tracepoint_synchronize_unregister(void) | |||
114 | * as "(void *, void)". The DECLARE_TRACE_NOARGS() will pass in just | 114 | * as "(void *, void)". The DECLARE_TRACE_NOARGS() will pass in just |
115 | * "void *data", where as the DECLARE_TRACE() will pass in "void *data, proto". | 115 | * "void *data", where as the DECLARE_TRACE() will pass in "void *data, proto". |
116 | */ | 116 | */ |
117 | #define __DO_TRACE(tp, proto, args, cond) \ | 117 | #define __DO_TRACE(tp, proto, args, cond, prercu, postrcu) \ |
118 | do { \ | 118 | do { \ |
119 | struct tracepoint_func *it_func_ptr; \ | 119 | struct tracepoint_func *it_func_ptr; \ |
120 | void *it_func; \ | 120 | void *it_func; \ |
@@ -122,6 +122,7 @@ static inline void tracepoint_synchronize_unregister(void) | |||
122 | \ | 122 | \ |
123 | if (!(cond)) \ | 123 | if (!(cond)) \ |
124 | return; \ | 124 | return; \ |
125 | prercu; \ | ||
125 | rcu_read_lock_sched_notrace(); \ | 126 | rcu_read_lock_sched_notrace(); \ |
126 | it_func_ptr = rcu_dereference_sched((tp)->funcs); \ | 127 | it_func_ptr = rcu_dereference_sched((tp)->funcs); \ |
127 | if (it_func_ptr) { \ | 128 | if (it_func_ptr) { \ |
@@ -132,6 +133,7 @@ static inline void tracepoint_synchronize_unregister(void) | |||
132 | } while ((++it_func_ptr)->func); \ | 133 | } while ((++it_func_ptr)->func); \ |
133 | } \ | 134 | } \ |
134 | rcu_read_unlock_sched_notrace(); \ | 135 | rcu_read_unlock_sched_notrace(); \ |
136 | postrcu; \ | ||
135 | } while (0) | 137 | } while (0) |
136 | 138 | ||
137 | /* | 139 | /* |
@@ -139,15 +141,25 @@ static inline void tracepoint_synchronize_unregister(void) | |||
139 | * not add unwanted padding between the beginning of the section and the | 141 | * not add unwanted padding between the beginning of the section and the |
140 | * structure. Force alignment to the same alignment as the section start. | 142 | * structure. Force alignment to the same alignment as the section start. |
141 | */ | 143 | */ |
142 | #define __DECLARE_TRACE(name, proto, args, cond, data_proto, data_args) \ | 144 | #define __DECLARE_TRACE(name, proto, args, cond, data_proto, data_args) \ |
143 | extern struct tracepoint __tracepoint_##name; \ | 145 | extern struct tracepoint __tracepoint_##name; \ |
144 | static inline void trace_##name(proto) \ | 146 | static inline void trace_##name(proto) \ |
145 | { \ | 147 | { \ |
148 | if (static_key_false(&__tracepoint_##name.key)) \ | ||
149 | __DO_TRACE(&__tracepoint_##name, \ | ||
150 | TP_PROTO(data_proto), \ | ||
151 | TP_ARGS(data_args), \ | ||
152 | TP_CONDITION(cond),,); \ | ||
153 | } \ | ||
154 | static inline void trace_##name##_rcuidle(proto) \ | ||
155 | { \ | ||
146 | if (static_branch(&__tracepoint_##name.key)) \ | 156 | if (static_branch(&__tracepoint_##name.key)) \ |
147 | __DO_TRACE(&__tracepoint_##name, \ | 157 | __DO_TRACE(&__tracepoint_##name, \ |
148 | TP_PROTO(data_proto), \ | 158 | TP_PROTO(data_proto), \ |
149 | TP_ARGS(data_args), \ | 159 | TP_ARGS(data_args), \ |
150 | TP_CONDITION(cond)); \ | 160 | TP_CONDITION(cond), \ |
161 | rcu_idle_exit(), \ | ||
162 | rcu_idle_enter()); \ | ||
151 | } \ | 163 | } \ |
152 | static inline int \ | 164 | static inline int \ |
153 | register_trace_##name(void (*probe)(data_proto), void *data) \ | 165 | register_trace_##name(void (*probe)(data_proto), void *data) \ |
@@ -176,7 +188,7 @@ static inline void tracepoint_synchronize_unregister(void) | |||
176 | __attribute__((section("__tracepoints_strings"))) = #name; \ | 188 | __attribute__((section("__tracepoints_strings"))) = #name; \ |
177 | struct tracepoint __tracepoint_##name \ | 189 | struct tracepoint __tracepoint_##name \ |
178 | __attribute__((section("__tracepoints"))) = \ | 190 | __attribute__((section("__tracepoints"))) = \ |
179 | { __tpstrtab_##name, JUMP_LABEL_INIT, reg, unreg, NULL };\ | 191 | { __tpstrtab_##name, STATIC_KEY_INIT_FALSE, reg, unreg, NULL };\ |
180 | static struct tracepoint * const __tracepoint_ptr_##name __used \ | 192 | static struct tracepoint * const __tracepoint_ptr_##name __used \ |
181 | __attribute__((section("__tracepoints_ptrs"))) = \ | 193 | __attribute__((section("__tracepoints_ptrs"))) = \ |
182 | &__tracepoint_##name; | 194 | &__tracepoint_##name; |
@@ -190,9 +202,11 @@ static inline void tracepoint_synchronize_unregister(void) | |||
190 | EXPORT_SYMBOL(__tracepoint_##name) | 202 | EXPORT_SYMBOL(__tracepoint_##name) |
191 | 203 | ||
192 | #else /* !CONFIG_TRACEPOINTS */ | 204 | #else /* !CONFIG_TRACEPOINTS */ |
193 | #define __DECLARE_TRACE(name, proto, args, cond, data_proto, data_args) \ | 205 | #define __DECLARE_TRACE(name, proto, args, cond, data_proto, data_args) \ |
194 | static inline void trace_##name(proto) \ | 206 | static inline void trace_##name(proto) \ |
195 | { } \ | 207 | { } \ |
208 | static inline void trace_##name##_rcuidle(proto) \ | ||
209 | { } \ | ||
196 | static inline int \ | 210 | static inline int \ |
197 | register_trace_##name(void (*probe)(data_proto), \ | 211 | register_trace_##name(void (*probe)(data_proto), \ |
198 | void *data) \ | 212 | void *data) \ |
diff --git a/include/linux/transport_class.h b/include/linux/transport_class.h index 9ae8da3e6407..11087cdd4ad3 100644 --- a/include/linux/transport_class.h +++ b/include/linux/transport_class.h | |||
@@ -10,6 +10,7 @@ | |||
10 | #define _TRANSPORT_CLASS_H_ | 10 | #define _TRANSPORT_CLASS_H_ |
11 | 11 | ||
12 | #include <linux/device.h> | 12 | #include <linux/device.h> |
13 | #include <linux/bug.h> | ||
13 | #include <linux/attribute_container.h> | 14 | #include <linux/attribute_container.h> |
14 | 15 | ||
15 | struct transport_container; | 16 | struct transport_container; |
diff --git a/include/linux/tty.h b/include/linux/tty.h index 5dbb3cb05a82..9f47ab540f65 100644 --- a/include/linux/tty.h +++ b/include/linux/tty.h | |||
@@ -44,7 +44,6 @@ | |||
44 | #include <linux/tty_ldisc.h> | 44 | #include <linux/tty_ldisc.h> |
45 | #include <linux/mutex.h> | 45 | #include <linux/mutex.h> |
46 | 46 | ||
47 | #include <asm/system.h> | ||
48 | 47 | ||
49 | 48 | ||
50 | /* | 49 | /* |
@@ -52,6 +51,7 @@ | |||
52 | * hardcoded at present.) | 51 | * hardcoded at present.) |
53 | */ | 52 | */ |
54 | #define NR_UNIX98_PTY_DEFAULT 4096 /* Default maximum for Unix98 ptys */ | 53 | #define NR_UNIX98_PTY_DEFAULT 4096 /* Default maximum for Unix98 ptys */ |
54 | #define NR_UNIX98_PTY_RESERVE 1024 /* Default reserve for main devpts */ | ||
55 | #define NR_UNIX98_PTY_MAX (1 << MINORBITS) /* Absolute limit */ | 55 | #define NR_UNIX98_PTY_MAX (1 << MINORBITS) /* Absolute limit */ |
56 | 56 | ||
57 | /* | 57 | /* |
@@ -480,10 +480,11 @@ extern void free_tty_struct(struct tty_struct *tty); | |||
480 | extern void initialize_tty_struct(struct tty_struct *tty, | 480 | extern void initialize_tty_struct(struct tty_struct *tty, |
481 | struct tty_driver *driver, int idx); | 481 | struct tty_driver *driver, int idx); |
482 | extern void deinitialize_tty_struct(struct tty_struct *tty); | 482 | extern void deinitialize_tty_struct(struct tty_struct *tty); |
483 | extern struct tty_struct *tty_init_dev(struct tty_driver *driver, int idx, | 483 | extern struct tty_struct *tty_init_dev(struct tty_driver *driver, int idx); |
484 | int first_ok); | ||
485 | extern int tty_release(struct inode *inode, struct file *filp); | 484 | extern int tty_release(struct inode *inode, struct file *filp); |
486 | extern int tty_init_termios(struct tty_struct *tty); | 485 | extern int tty_init_termios(struct tty_struct *tty); |
486 | extern int tty_standard_install(struct tty_driver *driver, | ||
487 | struct tty_struct *tty); | ||
487 | 488 | ||
488 | extern struct tty_struct *tty_pair_get_tty(struct tty_struct *tty); | 489 | extern struct tty_struct *tty_pair_get_tty(struct tty_struct *tty); |
489 | extern struct tty_struct *tty_pair_get_pty(struct tty_struct *tty); | 490 | extern struct tty_struct *tty_pair_get_pty(struct tty_struct *tty); |
diff --git a/include/linux/tty_driver.h b/include/linux/tty_driver.h index 5cf685086dd3..6e6dbb7447b6 100644 --- a/include/linux/tty_driver.h +++ b/include/linux/tty_driver.h | |||
@@ -50,6 +50,8 @@ | |||
50 | * Note that tty_shutdown() is not called if ops->shutdown is defined. | 50 | * Note that tty_shutdown() is not called if ops->shutdown is defined. |
51 | * This means one is responsible to take care of calling ops->remove (e.g. | 51 | * This means one is responsible to take care of calling ops->remove (e.g. |
52 | * via tty_driver_remove_tty) and releasing tty->termios. | 52 | * via tty_driver_remove_tty) and releasing tty->termios. |
53 | * Note that this hook may be called from *all* the contexts where one | ||
54 | * uses tty refcounting (e.g. tty_port_tty_get). | ||
53 | * | 55 | * |
54 | * | 56 | * |
55 | * void (*cleanup)(struct tty_struct * tty); | 57 | * void (*cleanup)(struct tty_struct * tty); |
@@ -234,6 +236,7 @@ | |||
234 | * if provided (otherwise EINVAL will be returned). | 236 | * if provided (otherwise EINVAL will be returned). |
235 | */ | 237 | */ |
236 | 238 | ||
239 | #include <linux/export.h> | ||
237 | #include <linux/fs.h> | 240 | #include <linux/fs.h> |
238 | #include <linux/list.h> | 241 | #include <linux/list.h> |
239 | #include <linux/cdev.h> | 242 | #include <linux/cdev.h> |
@@ -298,7 +301,6 @@ struct tty_driver { | |||
298 | int name_base; /* offset of printed name */ | 301 | int name_base; /* offset of printed name */ |
299 | int major; /* major device number */ | 302 | int major; /* major device number */ |
300 | int minor_start; /* start of minor device number */ | 303 | int minor_start; /* start of minor device number */ |
301 | int minor_num; /* number of *possible* devices */ | ||
302 | int num; /* number of devices allocated */ | 304 | int num; /* number of devices allocated */ |
303 | short type; /* type of tty driver */ | 305 | short type; /* type of tty driver */ |
304 | short subtype; /* subtype of tty driver */ | 306 | short subtype; /* subtype of tty driver */ |
@@ -324,7 +326,7 @@ struct tty_driver { | |||
324 | 326 | ||
325 | extern struct list_head tty_drivers; | 327 | extern struct list_head tty_drivers; |
326 | 328 | ||
327 | extern struct tty_driver *alloc_tty_driver(int lines); | 329 | extern struct tty_driver *__alloc_tty_driver(int lines, struct module *owner); |
328 | extern void put_tty_driver(struct tty_driver *driver); | 330 | extern void put_tty_driver(struct tty_driver *driver); |
329 | extern void tty_set_operations(struct tty_driver *driver, | 331 | extern void tty_set_operations(struct tty_driver *driver, |
330 | const struct tty_operations *op); | 332 | const struct tty_operations *op); |
@@ -332,6 +334,8 @@ extern struct tty_driver *tty_find_polling_driver(char *name, int *line); | |||
332 | 334 | ||
333 | extern void tty_driver_kref_put(struct tty_driver *driver); | 335 | extern void tty_driver_kref_put(struct tty_driver *driver); |
334 | 336 | ||
337 | #define alloc_tty_driver(lines) __alloc_tty_driver(lines, THIS_MODULE) | ||
338 | |||
335 | static inline struct tty_driver *tty_driver_kref_get(struct tty_driver *d) | 339 | static inline struct tty_driver *tty_driver_kref_get(struct tty_driver *d) |
336 | { | 340 | { |
337 | kref_get(&d->kref); | 341 | kref_get(&d->kref); |
diff --git a/include/linux/types.h b/include/linux/types.h index e5fa50345516..7f480db60231 100644 --- a/include/linux/types.h +++ b/include/linux/types.h | |||
@@ -210,6 +210,12 @@ typedef u32 phys_addr_t; | |||
210 | 210 | ||
211 | typedef phys_addr_t resource_size_t; | 211 | typedef phys_addr_t resource_size_t; |
212 | 212 | ||
213 | /* | ||
214 | * This type is the placeholder for a hardware interrupt number. It has to be | ||
215 | * big enough to enclose whatever representation is used by a given platform. | ||
216 | */ | ||
217 | typedef unsigned long irq_hw_number_t; | ||
218 | |||
213 | typedef struct { | 219 | typedef struct { |
214 | int counter; | 220 | int counter; |
215 | } atomic_t; | 221 | } atomic_t; |
diff --git a/include/linux/usb.h b/include/linux/usb.h index 69d845739bc2..73b68d1f2cb0 100644 --- a/include/linux/usb.h +++ b/include/linux/usb.h | |||
@@ -376,6 +376,12 @@ struct usb_bus { | |||
376 | 376 | ||
377 | struct usb_tt; | 377 | struct usb_tt; |
378 | 378 | ||
379 | enum usb_device_removable { | ||
380 | USB_DEVICE_REMOVABLE_UNKNOWN = 0, | ||
381 | USB_DEVICE_REMOVABLE, | ||
382 | USB_DEVICE_FIXED, | ||
383 | }; | ||
384 | |||
379 | /** | 385 | /** |
380 | * struct usb_device - kernel's representation of a USB device | 386 | * struct usb_device - kernel's representation of a USB device |
381 | * @devnum: device number; address on a USB bus | 387 | * @devnum: device number; address on a USB bus |
@@ -432,6 +438,7 @@ struct usb_tt; | |||
432 | * @wusb_dev: if this is a Wireless USB device, link to the WUSB | 438 | * @wusb_dev: if this is a Wireless USB device, link to the WUSB |
433 | * specific data for the device. | 439 | * specific data for the device. |
434 | * @slot_id: Slot ID assigned by xHCI | 440 | * @slot_id: Slot ID assigned by xHCI |
441 | * @removable: Device can be physically removed from this port | ||
435 | * | 442 | * |
436 | * Notes: | 443 | * Notes: |
437 | * Usbcore drivers should not set usbdev->state directly. Instead use | 444 | * Usbcore drivers should not set usbdev->state directly. Instead use |
@@ -494,7 +501,7 @@ struct usb_device { | |||
494 | #endif | 501 | #endif |
495 | 502 | ||
496 | int maxchild; | 503 | int maxchild; |
497 | struct usb_device *children[USB_MAXCHILDREN]; | 504 | struct usb_device **children; |
498 | 505 | ||
499 | u32 quirks; | 506 | u32 quirks; |
500 | atomic_t urbnum; | 507 | atomic_t urbnum; |
@@ -509,6 +516,7 @@ struct usb_device { | |||
509 | #endif | 516 | #endif |
510 | struct wusb_dev *wusb_dev; | 517 | struct wusb_dev *wusb_dev; |
511 | int slot_id; | 518 | int slot_id; |
519 | enum usb_device_removable removable; | ||
512 | }; | 520 | }; |
513 | #define to_usb_device(d) container_of(d, struct usb_device, dev) | 521 | #define to_usb_device(d) container_of(d, struct usb_device, dev) |
514 | 522 | ||
diff --git a/include/linux/usb/audio-v2.h b/include/linux/usb/audio-v2.h index 964cb603f7c7..ed13053153f4 100644 --- a/include/linux/usb/audio-v2.h +++ b/include/linux/usb/audio-v2.h | |||
@@ -43,6 +43,27 @@ static inline bool uac2_control_is_writeable(u32 bmControls, u8 control) | |||
43 | return (bmControls >> (control * 2)) & 0x2; | 43 | return (bmControls >> (control * 2)) & 0x2; |
44 | } | 44 | } |
45 | 45 | ||
46 | /* 4.7.2 Class-Specific AC Interface Descriptor */ | ||
47 | struct uac2_ac_header_descriptor { | ||
48 | __u8 bLength; /* 9 */ | ||
49 | __u8 bDescriptorType; /* USB_DT_CS_INTERFACE */ | ||
50 | __u8 bDescriptorSubtype; /* UAC_MS_HEADER */ | ||
51 | __le16 bcdADC; /* 0x0200 */ | ||
52 | __u8 bCategory; | ||
53 | __le16 wTotalLength; /* includes Unit and Terminal desc. */ | ||
54 | __u8 bmControls; | ||
55 | } __packed; | ||
56 | |||
57 | /* 2.3.1.6 Type I Format Type Descriptor (Frmts20 final.pdf)*/ | ||
58 | struct uac2_format_type_i_descriptor { | ||
59 | __u8 bLength; /* in bytes: 6 */ | ||
60 | __u8 bDescriptorType; /* USB_DT_CS_INTERFACE */ | ||
61 | __u8 bDescriptorSubtype; /* FORMAT_TYPE */ | ||
62 | __u8 bFormatType; /* FORMAT_TYPE_1 */ | ||
63 | __u8 bSubslotSize; /* {1,2,3,4} */ | ||
64 | __u8 bBitResolution; | ||
65 | } __packed; | ||
66 | |||
46 | /* 4.7.2.1 Clock Source Descriptor */ | 67 | /* 4.7.2.1 Clock Source Descriptor */ |
47 | 68 | ||
48 | struct uac_clock_source_descriptor { | 69 | struct uac_clock_source_descriptor { |
diff --git a/include/linux/usb/cdc-wdm.h b/include/linux/usb/cdc-wdm.h new file mode 100644 index 000000000000..719c332620fa --- /dev/null +++ b/include/linux/usb/cdc-wdm.h | |||
@@ -0,0 +1,19 @@ | |||
1 | /* | ||
2 | * USB CDC Device Management subdriver | ||
3 | * | ||
4 | * Copyright (c) 2012 Bjørn Mork <bjorn@mork.no> | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or | ||
7 | * modify it under the terms of the GNU General Public License | ||
8 | * version 2 as published by the Free Software Foundation. | ||
9 | */ | ||
10 | |||
11 | #ifndef __LINUX_USB_CDC_WDM_H | ||
12 | #define __LINUX_USB_CDC_WDM_H | ||
13 | |||
14 | extern struct usb_driver *usb_cdc_wdm_register(struct usb_interface *intf, | ||
15 | struct usb_endpoint_descriptor *ep, | ||
16 | int bufsize, | ||
17 | int (*manage_power)(struct usb_interface *, int)); | ||
18 | |||
19 | #endif /* __LINUX_USB_CDC_WDM_H */ | ||
diff --git a/include/linux/usb/ch11.h b/include/linux/usb/ch11.h index 0b83acd3360a..f1d26b6067f1 100644 --- a/include/linux/usb/ch11.h +++ b/include/linux/usb/ch11.h | |||
@@ -76,6 +76,11 @@ | |||
76 | #define USB_PORT_FEAT_C_BH_PORT_RESET 29 | 76 | #define USB_PORT_FEAT_C_BH_PORT_RESET 29 |
77 | #define USB_PORT_FEAT_FORCE_LINKPM_ACCEPT 30 | 77 | #define USB_PORT_FEAT_FORCE_LINKPM_ACCEPT 30 |
78 | 78 | ||
79 | /* USB 3.0 hub remote wake mask bits, see table 10-14 */ | ||
80 | #define USB_PORT_FEAT_REMOTE_WAKE_CONNECT (1 << 8) | ||
81 | #define USB_PORT_FEAT_REMOTE_WAKE_DISCONNECT (1 << 9) | ||
82 | #define USB_PORT_FEAT_REMOTE_WAKE_OVER_CURRENT (1 << 10) | ||
83 | |||
79 | /* | 84 | /* |
80 | * Hub Status and Hub Change results | 85 | * Hub Status and Hub Change results |
81 | * See USB 2.0 spec Table 11-19 and Table 11-20 | 86 | * See USB 2.0 spec Table 11-19 and Table 11-20 |
diff --git a/include/linux/usb/ch9.h b/include/linux/usb/ch9.h index 3b6f628880f8..af21f3115919 100644 --- a/include/linux/usb/ch9.h +++ b/include/linux/usb/ch9.h | |||
@@ -789,6 +789,11 @@ struct usb_ext_cap_descriptor { /* Link Power Management */ | |||
789 | __u8 bDevCapabilityType; | 789 | __u8 bDevCapabilityType; |
790 | __le32 bmAttributes; | 790 | __le32 bmAttributes; |
791 | #define USB_LPM_SUPPORT (1 << 1) /* supports LPM */ | 791 | #define USB_LPM_SUPPORT (1 << 1) /* supports LPM */ |
792 | #define USB_BESL_SUPPORT (1 << 2) /* supports BESL */ | ||
793 | #define USB_BESL_BASELINE_VALID (1 << 3) /* Baseline BESL valid*/ | ||
794 | #define USB_BESL_DEEP_VALID (1 << 4) /* Deep BESL valid */ | ||
795 | #define USB_GET_BESL_BASELINE(p) (((p) & (0xf << 8)) >> 8) | ||
796 | #define USB_GET_BESL_DEEP(p) (((p) & (0xf << 12)) >> 12) | ||
792 | } __attribute__((packed)); | 797 | } __attribute__((packed)); |
793 | 798 | ||
794 | #define USB_DT_USB_EXT_CAP_SIZE 7 | 799 | #define USB_DT_USB_EXT_CAP_SIZE 7 |
diff --git a/include/linux/usb/ehci_pdriver.h b/include/linux/usb/ehci_pdriver.h new file mode 100644 index 000000000000..1894f42fe3f7 --- /dev/null +++ b/include/linux/usb/ehci_pdriver.h | |||
@@ -0,0 +1,46 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2012 Hauke Mehrtens <hauke@hauke-m.de> | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify it | ||
5 | * under the terms of the GNU General Public License as published by the | ||
6 | * Free Software Foundation; either version 2 of the License, or (at your | ||
7 | * option) any later version. | ||
8 | * | ||
9 | * This program is distributed in the hope that it will be useful, but | ||
10 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY | ||
11 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | ||
12 | * 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 Foundation, | ||
16 | * Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
17 | */ | ||
18 | |||
19 | #ifndef __USB_CORE_EHCI_PDRIVER_H | ||
20 | #define __USB_CORE_EHCI_PDRIVER_H | ||
21 | |||
22 | /** | ||
23 | * struct usb_ehci_pdata - platform_data for generic ehci driver | ||
24 | * | ||
25 | * @caps_offset: offset of the EHCI Capability Registers to the start of | ||
26 | * the io memory region provided to the driver. | ||
27 | * @has_tt: set to 1 if TT is integrated in root hub. | ||
28 | * @port_power_on: set to 1 if the controller needs a power up after | ||
29 | * initialization. | ||
30 | * @port_power_off: set to 1 if the controller needs to be powered down | ||
31 | * after initialization. | ||
32 | * | ||
33 | * These are general configuration options for the EHCI controller. All of | ||
34 | * these options are activating more or less workarounds for some hardware. | ||
35 | */ | ||
36 | struct usb_ehci_pdata { | ||
37 | int caps_offset; | ||
38 | unsigned has_tt:1; | ||
39 | unsigned has_synopsys_hc_bug:1; | ||
40 | unsigned big_endian_desc:1; | ||
41 | unsigned big_endian_mmio:1; | ||
42 | unsigned port_power_on:1; | ||
43 | unsigned port_power_off:1; | ||
44 | }; | ||
45 | |||
46 | #endif /* __USB_CORE_EHCI_PDRIVER_H */ | ||
diff --git a/include/linux/usb/gadget.h b/include/linux/usb/gadget.h index da653b5c7134..9517466ababb 100644 --- a/include/linux/usb/gadget.h +++ b/include/linux/usb/gadget.h | |||
@@ -950,6 +950,16 @@ static inline void usb_free_descriptors(struct usb_descriptor_header **v) | |||
950 | 950 | ||
951 | /*-------------------------------------------------------------------------*/ | 951 | /*-------------------------------------------------------------------------*/ |
952 | 952 | ||
953 | /* utility to simplify map/unmap of usb_requests to/from DMA */ | ||
954 | |||
955 | extern int usb_gadget_map_request(struct usb_gadget *gadget, | ||
956 | struct usb_request *req, int is_in); | ||
957 | |||
958 | extern void usb_gadget_unmap_request(struct usb_gadget *gadget, | ||
959 | struct usb_request *req, int is_in); | ||
960 | |||
961 | /*-------------------------------------------------------------------------*/ | ||
962 | |||
953 | /* utility wrapping a simple endpoint selection policy */ | 963 | /* utility wrapping a simple endpoint selection policy */ |
954 | 964 | ||
955 | extern struct usb_ep *usb_ep_autoconfig(struct usb_gadget *, | 965 | extern struct usb_ep *usb_ep_autoconfig(struct usb_gadget *, |
diff --git a/include/linux/usb/hcd.h b/include/linux/usb/hcd.h index b2f62f3a32af..5de415707c23 100644 --- a/include/linux/usb/hcd.h +++ b/include/linux/usb/hcd.h | |||
@@ -127,7 +127,7 @@ struct usb_hcd { | |||
127 | unsigned authorized_default:1; | 127 | unsigned authorized_default:1; |
128 | unsigned has_tt:1; /* Integrated TT in root hub */ | 128 | unsigned has_tt:1; /* Integrated TT in root hub */ |
129 | 129 | ||
130 | int irq; /* irq allocated */ | 130 | unsigned int irq; /* irq allocated */ |
131 | void __iomem *regs; /* device memory/io */ | 131 | void __iomem *regs; /* device memory/io */ |
132 | u64 rsrc_start; /* memory/io resource start */ | 132 | u64 rsrc_start; /* memory/io resource start */ |
133 | u64 rsrc_len; /* memory/io resource length */ | 133 | u64 rsrc_len; /* memory/io resource length */ |
@@ -412,6 +412,8 @@ extern irqreturn_t usb_hcd_irq(int irq, void *__hcd); | |||
412 | 412 | ||
413 | extern void usb_hc_died(struct usb_hcd *hcd); | 413 | extern void usb_hc_died(struct usb_hcd *hcd); |
414 | extern void usb_hcd_poll_rh_status(struct usb_hcd *hcd); | 414 | extern void usb_hcd_poll_rh_status(struct usb_hcd *hcd); |
415 | extern void usb_wakeup_notification(struct usb_device *hdev, | ||
416 | unsigned int portnum); | ||
415 | 417 | ||
416 | /* The D0/D1 toggle bits ... USE WITH CAUTION (they're almost hcd-internal) */ | 418 | /* The D0/D1 toggle bits ... USE WITH CAUTION (they're almost hcd-internal) */ |
417 | #define usb_gettoggle(dev, ep, out) (((dev)->toggle[out] >> (ep)) & 1) | 419 | #define usb_gettoggle(dev, ep, out) (((dev)->toggle[out] >> (ep)) & 1) |
diff --git a/include/linux/usb/intel_mid_otg.h b/include/linux/usb/intel_mid_otg.h index a0ccf795f362..756cf5543ffd 100644 --- a/include/linux/usb/intel_mid_otg.h +++ b/include/linux/usb/intel_mid_otg.h | |||
@@ -104,11 +104,11 @@ struct iotg_ulpi_access_ops { | |||
104 | /* | 104 | /* |
105 | * the Intel MID (Langwell/Penwell) otg transceiver driver needs to interact | 105 | * the Intel MID (Langwell/Penwell) otg transceiver driver needs to interact |
106 | * with device and host drivers to implement the USB OTG related feature. More | 106 | * with device and host drivers to implement the USB OTG related feature. More |
107 | * function members are added based on otg_transceiver data structure for this | 107 | * function members are added based on usb_phy data structure for this |
108 | * purpose. | 108 | * purpose. |
109 | */ | 109 | */ |
110 | struct intel_mid_otg_xceiv { | 110 | struct intel_mid_otg_xceiv { |
111 | struct otg_transceiver otg; | 111 | struct usb_phy otg; |
112 | struct otg_hsm hsm; | 112 | struct otg_hsm hsm; |
113 | 113 | ||
114 | /* base address */ | 114 | /* base address */ |
@@ -147,7 +147,7 @@ struct intel_mid_otg_xceiv { | |||
147 | 147 | ||
148 | }; | 148 | }; |
149 | static inline | 149 | static inline |
150 | struct intel_mid_otg_xceiv *otg_to_mid_xceiv(struct otg_transceiver *otg) | 150 | struct intel_mid_otg_xceiv *otg_to_mid_xceiv(struct usb_phy *otg) |
151 | { | 151 | { |
152 | return container_of(otg, struct intel_mid_otg_xceiv, otg); | 152 | return container_of(otg, struct intel_mid_otg_xceiv, otg); |
153 | } | 153 | } |
diff --git a/include/linux/usb/msm_hsusb.h b/include/linux/usb/msm_hsusb.h index 00311fe9d0df..22a396c13f3a 100644 --- a/include/linux/usb/msm_hsusb.h +++ b/include/linux/usb/msm_hsusb.h | |||
@@ -160,7 +160,7 @@ struct msm_otg_platform_data { | |||
160 | * detection process. | 160 | * detection process. |
161 | */ | 161 | */ |
162 | struct msm_otg { | 162 | struct msm_otg { |
163 | struct otg_transceiver otg; | 163 | struct usb_phy phy; |
164 | struct msm_otg_platform_data *pdata; | 164 | struct msm_otg_platform_data *pdata; |
165 | int irq; | 165 | int irq; |
166 | struct clk *clk; | 166 | struct clk *clk; |
diff --git a/include/linux/usb/ohci_pdriver.h b/include/linux/usb/ohci_pdriver.h new file mode 100644 index 000000000000..2808f2a9cce8 --- /dev/null +++ b/include/linux/usb/ohci_pdriver.h | |||
@@ -0,0 +1,38 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2012 Hauke Mehrtens <hauke@hauke-m.de> | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify it | ||
5 | * under the terms of the GNU General Public License as published by the | ||
6 | * Free Software Foundation; either version 2 of the License, or (at your | ||
7 | * option) any later version. | ||
8 | * | ||
9 | * This program is distributed in the hope that it will be useful, but | ||
10 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY | ||
11 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | ||
12 | * 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 Foundation, | ||
16 | * Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
17 | */ | ||
18 | |||
19 | #ifndef __USB_CORE_OHCI_PDRIVER_H | ||
20 | #define __USB_CORE_OHCI_PDRIVER_H | ||
21 | |||
22 | /** | ||
23 | * struct usb_ohci_pdata - platform_data for generic ohci driver | ||
24 | * | ||
25 | * @big_endian_desc: BE descriptors | ||
26 | * @big_endian_mmio: BE registers | ||
27 | * @no_big_frame_no: no big endian frame_no shift | ||
28 | * | ||
29 | * These are general configuration options for the OHCI controller. All of | ||
30 | * these options are activating more or less workarounds for some hardware. | ||
31 | */ | ||
32 | struct usb_ohci_pdata { | ||
33 | unsigned big_endian_desc:1; | ||
34 | unsigned big_endian_mmio:1; | ||
35 | unsigned no_big_frame_no:1; | ||
36 | }; | ||
37 | |||
38 | #endif /* __USB_CORE_OHCI_PDRIVER_H */ | ||
diff --git a/include/linux/usb/otg.h b/include/linux/usb/otg.h index d87f44f5b04e..38ab3f46346f 100644 --- a/include/linux/usb/otg.h +++ b/include/linux/usb/otg.h | |||
@@ -35,7 +35,7 @@ enum usb_otg_state { | |||
35 | OTG_STATE_A_VBUS_ERR, | 35 | OTG_STATE_A_VBUS_ERR, |
36 | }; | 36 | }; |
37 | 37 | ||
38 | enum usb_xceiv_events { | 38 | enum usb_phy_events { |
39 | USB_EVENT_NONE, /* no events or cable disconnected */ | 39 | USB_EVENT_NONE, /* no events or cable disconnected */ |
40 | USB_EVENT_VBUS, /* vbus valid event */ | 40 | USB_EVENT_VBUS, /* vbus valid event */ |
41 | USB_EVENT_ID, /* id was grounded */ | 41 | USB_EVENT_ID, /* id was grounded */ |
@@ -43,14 +43,39 @@ enum usb_xceiv_events { | |||
43 | USB_EVENT_ENUMERATED, /* gadget driver enumerated */ | 43 | USB_EVENT_ENUMERATED, /* gadget driver enumerated */ |
44 | }; | 44 | }; |
45 | 45 | ||
46 | struct otg_transceiver; | 46 | struct usb_phy; |
47 | 47 | ||
48 | /* for transceivers connected thru an ULPI interface, the user must | 48 | /* for transceivers connected thru an ULPI interface, the user must |
49 | * provide access ops | 49 | * provide access ops |
50 | */ | 50 | */ |
51 | struct otg_io_access_ops { | 51 | struct usb_phy_io_ops { |
52 | int (*read)(struct otg_transceiver *otg, u32 reg); | 52 | int (*read)(struct usb_phy *x, u32 reg); |
53 | int (*write)(struct otg_transceiver *otg, u32 val, u32 reg); | 53 | int (*write)(struct usb_phy *x, u32 val, u32 reg); |
54 | }; | ||
55 | |||
56 | struct usb_otg { | ||
57 | u8 default_a; | ||
58 | |||
59 | struct usb_phy *phy; | ||
60 | struct usb_bus *host; | ||
61 | struct usb_gadget *gadget; | ||
62 | |||
63 | /* bind/unbind the host controller */ | ||
64 | int (*set_host)(struct usb_otg *otg, struct usb_bus *host); | ||
65 | |||
66 | /* bind/unbind the peripheral controller */ | ||
67 | int (*set_peripheral)(struct usb_otg *otg, | ||
68 | struct usb_gadget *gadget); | ||
69 | |||
70 | /* effective for A-peripheral, ignored for B devices */ | ||
71 | int (*set_vbus)(struct usb_otg *otg, bool enabled); | ||
72 | |||
73 | /* for B devices only: start session with A-Host */ | ||
74 | int (*start_srp)(struct usb_otg *otg); | ||
75 | |||
76 | /* start or continue HNP role switch */ | ||
77 | int (*start_hnp)(struct usb_otg *otg); | ||
78 | |||
54 | }; | 79 | }; |
55 | 80 | ||
56 | /* | 81 | /* |
@@ -59,22 +84,21 @@ struct otg_io_access_ops { | |||
59 | * moment, using the transceiver, ID signal, HNP and sometimes static | 84 | * moment, using the transceiver, ID signal, HNP and sometimes static |
60 | * configuration information (including "board isn't wired for otg"). | 85 | * configuration information (including "board isn't wired for otg"). |
61 | */ | 86 | */ |
62 | struct otg_transceiver { | 87 | struct usb_phy { |
63 | struct device *dev; | 88 | struct device *dev; |
64 | const char *label; | 89 | const char *label; |
65 | unsigned int flags; | 90 | unsigned int flags; |
66 | 91 | ||
67 | u8 default_a; | ||
68 | enum usb_otg_state state; | 92 | enum usb_otg_state state; |
69 | enum usb_xceiv_events last_event; | 93 | enum usb_phy_events last_event; |
70 | 94 | ||
71 | struct usb_bus *host; | 95 | struct usb_otg *otg; |
72 | struct usb_gadget *gadget; | ||
73 | 96 | ||
74 | struct otg_io_access_ops *io_ops; | 97 | struct device *io_dev; |
75 | void __iomem *io_priv; | 98 | struct usb_phy_io_ops *io_ops; |
99 | void __iomem *io_priv; | ||
76 | 100 | ||
77 | /* for notification of usb_xceiv_events */ | 101 | /* for notification of usb_phy_events */ |
78 | struct atomic_notifier_head notifier; | 102 | struct atomic_notifier_head notifier; |
79 | 103 | ||
80 | /* to pass extra port status to the root hub */ | 104 | /* to pass extra port status to the root hub */ |
@@ -82,40 +106,22 @@ struct otg_transceiver { | |||
82 | u16 port_change; | 106 | u16 port_change; |
83 | 107 | ||
84 | /* initialize/shutdown the OTG controller */ | 108 | /* initialize/shutdown the OTG controller */ |
85 | int (*init)(struct otg_transceiver *otg); | 109 | int (*init)(struct usb_phy *x); |
86 | void (*shutdown)(struct otg_transceiver *otg); | 110 | void (*shutdown)(struct usb_phy *x); |
87 | |||
88 | /* bind/unbind the host controller */ | ||
89 | int (*set_host)(struct otg_transceiver *otg, | ||
90 | struct usb_bus *host); | ||
91 | |||
92 | /* bind/unbind the peripheral controller */ | ||
93 | int (*set_peripheral)(struct otg_transceiver *otg, | ||
94 | struct usb_gadget *gadget); | ||
95 | 111 | ||
96 | /* effective for B devices, ignored for A-peripheral */ | 112 | /* effective for B devices, ignored for A-peripheral */ |
97 | int (*set_power)(struct otg_transceiver *otg, | 113 | int (*set_power)(struct usb_phy *x, |
98 | unsigned mA); | 114 | unsigned mA); |
99 | 115 | ||
100 | /* effective for A-peripheral, ignored for B devices */ | ||
101 | int (*set_vbus)(struct otg_transceiver *otg, | ||
102 | bool enabled); | ||
103 | |||
104 | /* for non-OTG B devices: set transceiver into suspend mode */ | 116 | /* for non-OTG B devices: set transceiver into suspend mode */ |
105 | int (*set_suspend)(struct otg_transceiver *otg, | 117 | int (*set_suspend)(struct usb_phy *x, |
106 | int suspend); | 118 | int suspend); |
107 | 119 | ||
108 | /* for B devices only: start session with A-Host */ | ||
109 | int (*start_srp)(struct otg_transceiver *otg); | ||
110 | |||
111 | /* start or continue HNP role switch */ | ||
112 | int (*start_hnp)(struct otg_transceiver *otg); | ||
113 | |||
114 | }; | 120 | }; |
115 | 121 | ||
116 | 122 | ||
117 | /* for board-specific init logic */ | 123 | /* for board-specific init logic */ |
118 | extern int otg_set_transceiver(struct otg_transceiver *); | 124 | extern int usb_set_transceiver(struct usb_phy *); |
119 | 125 | ||
120 | #if defined(CONFIG_NOP_USB_XCEIV) || (defined(CONFIG_NOP_USB_XCEIV_MODULE) && defined(MODULE)) | 126 | #if defined(CONFIG_NOP_USB_XCEIV) || (defined(CONFIG_NOP_USB_XCEIV_MODULE) && defined(MODULE)) |
121 | /* sometimes transceivers are accessed only through e.g. ULPI */ | 127 | /* sometimes transceivers are accessed only through e.g. ULPI */ |
@@ -132,50 +138,50 @@ static inline void usb_nop_xceiv_unregister(void) | |||
132 | #endif | 138 | #endif |
133 | 139 | ||
134 | /* helpers for direct access thru low-level io interface */ | 140 | /* helpers for direct access thru low-level io interface */ |
135 | static inline int otg_io_read(struct otg_transceiver *otg, u32 reg) | 141 | static inline int usb_phy_io_read(struct usb_phy *x, u32 reg) |
136 | { | 142 | { |
137 | if (otg->io_ops && otg->io_ops->read) | 143 | if (x->io_ops && x->io_ops->read) |
138 | return otg->io_ops->read(otg, reg); | 144 | return x->io_ops->read(x, reg); |
139 | 145 | ||
140 | return -EINVAL; | 146 | return -EINVAL; |
141 | } | 147 | } |
142 | 148 | ||
143 | static inline int otg_io_write(struct otg_transceiver *otg, u32 val, u32 reg) | 149 | static inline int usb_phy_io_write(struct usb_phy *x, u32 val, u32 reg) |
144 | { | 150 | { |
145 | if (otg->io_ops && otg->io_ops->write) | 151 | if (x->io_ops && x->io_ops->write) |
146 | return otg->io_ops->write(otg, val, reg); | 152 | return x->io_ops->write(x, val, reg); |
147 | 153 | ||
148 | return -EINVAL; | 154 | return -EINVAL; |
149 | } | 155 | } |
150 | 156 | ||
151 | static inline int | 157 | static inline int |
152 | otg_init(struct otg_transceiver *otg) | 158 | usb_phy_init(struct usb_phy *x) |
153 | { | 159 | { |
154 | if (otg->init) | 160 | if (x->init) |
155 | return otg->init(otg); | 161 | return x->init(x); |
156 | 162 | ||
157 | return 0; | 163 | return 0; |
158 | } | 164 | } |
159 | 165 | ||
160 | static inline void | 166 | static inline void |
161 | otg_shutdown(struct otg_transceiver *otg) | 167 | usb_phy_shutdown(struct usb_phy *x) |
162 | { | 168 | { |
163 | if (otg->shutdown) | 169 | if (x->shutdown) |
164 | otg->shutdown(otg); | 170 | x->shutdown(x); |
165 | } | 171 | } |
166 | 172 | ||
167 | /* for usb host and peripheral controller drivers */ | 173 | /* for usb host and peripheral controller drivers */ |
168 | #ifdef CONFIG_USB_OTG_UTILS | 174 | #ifdef CONFIG_USB_OTG_UTILS |
169 | extern struct otg_transceiver *otg_get_transceiver(void); | 175 | extern struct usb_phy *usb_get_transceiver(void); |
170 | extern void otg_put_transceiver(struct otg_transceiver *); | 176 | extern void usb_put_transceiver(struct usb_phy *); |
171 | extern const char *otg_state_string(enum usb_otg_state state); | 177 | extern const char *otg_state_string(enum usb_otg_state state); |
172 | #else | 178 | #else |
173 | static inline struct otg_transceiver *otg_get_transceiver(void) | 179 | static inline struct usb_phy *usb_get_transceiver(void) |
174 | { | 180 | { |
175 | return NULL; | 181 | return NULL; |
176 | } | 182 | } |
177 | 183 | ||
178 | static inline void otg_put_transceiver(struct otg_transceiver *x) | 184 | static inline void usb_put_transceiver(struct usb_phy *x) |
179 | { | 185 | { |
180 | } | 186 | } |
181 | 187 | ||
@@ -187,67 +193,84 @@ static inline const char *otg_state_string(enum usb_otg_state state) | |||
187 | 193 | ||
188 | /* Context: can sleep */ | 194 | /* Context: can sleep */ |
189 | static inline int | 195 | static inline int |
190 | otg_start_hnp(struct otg_transceiver *otg) | 196 | otg_start_hnp(struct usb_otg *otg) |
191 | { | 197 | { |
192 | return otg->start_hnp(otg); | 198 | if (otg && otg->start_hnp) |
199 | return otg->start_hnp(otg); | ||
200 | |||
201 | return -ENOTSUPP; | ||
193 | } | 202 | } |
194 | 203 | ||
195 | /* Context: can sleep */ | 204 | /* Context: can sleep */ |
196 | static inline int | 205 | static inline int |
197 | otg_set_vbus(struct otg_transceiver *otg, bool enabled) | 206 | otg_set_vbus(struct usb_otg *otg, bool enabled) |
198 | { | 207 | { |
199 | return otg->set_vbus(otg, enabled); | 208 | if (otg && otg->set_vbus) |
209 | return otg->set_vbus(otg, enabled); | ||
210 | |||
211 | return -ENOTSUPP; | ||
200 | } | 212 | } |
201 | 213 | ||
202 | /* for HCDs */ | 214 | /* for HCDs */ |
203 | static inline int | 215 | static inline int |
204 | otg_set_host(struct otg_transceiver *otg, struct usb_bus *host) | 216 | otg_set_host(struct usb_otg *otg, struct usb_bus *host) |
205 | { | 217 | { |
206 | return otg->set_host(otg, host); | 218 | if (otg && otg->set_host) |
219 | return otg->set_host(otg, host); | ||
220 | |||
221 | return -ENOTSUPP; | ||
207 | } | 222 | } |
208 | 223 | ||
209 | /* for usb peripheral controller drivers */ | 224 | /* for usb peripheral controller drivers */ |
210 | 225 | ||
211 | /* Context: can sleep */ | 226 | /* Context: can sleep */ |
212 | static inline int | 227 | static inline int |
213 | otg_set_peripheral(struct otg_transceiver *otg, struct usb_gadget *periph) | 228 | otg_set_peripheral(struct usb_otg *otg, struct usb_gadget *periph) |
214 | { | 229 | { |
215 | return otg->set_peripheral(otg, periph); | 230 | if (otg && otg->set_peripheral) |
231 | return otg->set_peripheral(otg, periph); | ||
232 | |||
233 | return -ENOTSUPP; | ||
216 | } | 234 | } |
217 | 235 | ||
218 | static inline int | 236 | static inline int |
219 | otg_set_power(struct otg_transceiver *otg, unsigned mA) | 237 | usb_phy_set_power(struct usb_phy *x, unsigned mA) |
220 | { | 238 | { |
221 | return otg->set_power(otg, mA); | 239 | if (x && x->set_power) |
240 | return x->set_power(x, mA); | ||
241 | return 0; | ||
222 | } | 242 | } |
223 | 243 | ||
224 | /* Context: can sleep */ | 244 | /* Context: can sleep */ |
225 | static inline int | 245 | static inline int |
226 | otg_set_suspend(struct otg_transceiver *otg, int suspend) | 246 | usb_phy_set_suspend(struct usb_phy *x, int suspend) |
227 | { | 247 | { |
228 | if (otg->set_suspend != NULL) | 248 | if (x->set_suspend != NULL) |
229 | return otg->set_suspend(otg, suspend); | 249 | return x->set_suspend(x, suspend); |
230 | else | 250 | else |
231 | return 0; | 251 | return 0; |
232 | } | 252 | } |
233 | 253 | ||
234 | static inline int | 254 | static inline int |
235 | otg_start_srp(struct otg_transceiver *otg) | 255 | otg_start_srp(struct usb_otg *otg) |
236 | { | 256 | { |
237 | return otg->start_srp(otg); | 257 | if (otg && otg->start_srp) |
258 | return otg->start_srp(otg); | ||
259 | |||
260 | return -ENOTSUPP; | ||
238 | } | 261 | } |
239 | 262 | ||
240 | /* notifiers */ | 263 | /* notifiers */ |
241 | static inline int | 264 | static inline int |
242 | otg_register_notifier(struct otg_transceiver *otg, struct notifier_block *nb) | 265 | usb_register_notifier(struct usb_phy *x, struct notifier_block *nb) |
243 | { | 266 | { |
244 | return atomic_notifier_chain_register(&otg->notifier, nb); | 267 | return atomic_notifier_chain_register(&x->notifier, nb); |
245 | } | 268 | } |
246 | 269 | ||
247 | static inline void | 270 | static inline void |
248 | otg_unregister_notifier(struct otg_transceiver *otg, struct notifier_block *nb) | 271 | usb_unregister_notifier(struct usb_phy *x, struct notifier_block *nb) |
249 | { | 272 | { |
250 | atomic_notifier_chain_unregister(&otg->notifier, nb); | 273 | atomic_notifier_chain_unregister(&x->notifier, nb); |
251 | } | 274 | } |
252 | 275 | ||
253 | /* for OTG controller drivers (and maybe other stuff) */ | 276 | /* for OTG controller drivers (and maybe other stuff) */ |
diff --git a/include/linux/usb/renesas_usbhs.h b/include/linux/usb/renesas_usbhs.h index 0d3f98879256..547e59cc00ea 100644 --- a/include/linux/usb/renesas_usbhs.h +++ b/include/linux/usb/renesas_usbhs.h | |||
@@ -149,6 +149,7 @@ struct renesas_usbhs_driver_param { | |||
149 | * option: | 149 | * option: |
150 | */ | 150 | */ |
151 | u32 has_otg:1; /* for controlling PWEN/EXTLP */ | 151 | u32 has_otg:1; /* for controlling PWEN/EXTLP */ |
152 | u32 has_sudmac:1; /* for SUDMAC */ | ||
152 | }; | 153 | }; |
153 | 154 | ||
154 | /* | 155 | /* |
diff --git a/include/linux/usb/serial.h b/include/linux/usb/serial.h index 4267a9c717ba..474283888233 100644 --- a/include/linux/usb/serial.h +++ b/include/linux/usb/serial.h | |||
@@ -28,13 +28,6 @@ | |||
28 | /* parity check flag */ | 28 | /* parity check flag */ |
29 | #define RELEVANT_IFLAG(iflag) (iflag & (IGNBRK|BRKINT|IGNPAR|PARMRK|INPCK)) | 29 | #define RELEVANT_IFLAG(iflag) (iflag & (IGNBRK|BRKINT|IGNPAR|PARMRK|INPCK)) |
30 | 30 | ||
31 | enum port_dev_state { | ||
32 | PORT_UNREGISTERED, | ||
33 | PORT_REGISTERING, | ||
34 | PORT_REGISTERED, | ||
35 | PORT_UNREGISTERING, | ||
36 | }; | ||
37 | |||
38 | /* USB serial flags */ | 31 | /* USB serial flags */ |
39 | #define USB_SERIAL_WRITE_BUSY 0 | 32 | #define USB_SERIAL_WRITE_BUSY 0 |
40 | 33 | ||
@@ -124,7 +117,6 @@ struct usb_serial_port { | |||
124 | char throttle_req; | 117 | char throttle_req; |
125 | unsigned long sysrq; /* sysrq timeout */ | 118 | unsigned long sysrq; /* sysrq timeout */ |
126 | struct device dev; | 119 | struct device dev; |
127 | enum port_dev_state dev_state; | ||
128 | }; | 120 | }; |
129 | #define to_usb_serial_port(d) container_of(d, struct usb_serial_port, dev) | 121 | #define to_usb_serial_port(d) container_of(d, struct usb_serial_port, dev) |
130 | 122 | ||
@@ -300,8 +292,10 @@ struct usb_serial_driver { | |||
300 | #define to_usb_serial_driver(d) \ | 292 | #define to_usb_serial_driver(d) \ |
301 | container_of(d, struct usb_serial_driver, driver) | 293 | container_of(d, struct usb_serial_driver, driver) |
302 | 294 | ||
303 | extern int usb_serial_register(struct usb_serial_driver *driver); | 295 | extern int usb_serial_register_drivers(struct usb_driver *udriver, |
304 | extern void usb_serial_deregister(struct usb_serial_driver *driver); | 296 | struct usb_serial_driver * const serial_drivers[]); |
297 | extern void usb_serial_deregister_drivers(struct usb_driver *udriver, | ||
298 | struct usb_serial_driver * const serial_drivers[]); | ||
305 | extern void usb_serial_port_softint(struct usb_serial_port *port); | 299 | extern void usb_serial_port_softint(struct usb_serial_port *port); |
306 | 300 | ||
307 | extern int usb_serial_probe(struct usb_interface *iface, | 301 | extern int usb_serial_probe(struct usb_interface *iface, |
@@ -389,5 +383,35 @@ do { \ | |||
389 | printk(KERN_DEBUG "%s: " format "\n", __FILE__, ##arg); \ | 383 | printk(KERN_DEBUG "%s: " format "\n", __FILE__, ##arg); \ |
390 | } while (0) | 384 | } while (0) |
391 | 385 | ||
386 | /* | ||
387 | * Macro for reporting errors in write path to avoid inifinite loop | ||
388 | * when port is used as a console. | ||
389 | */ | ||
390 | #define dev_err_console(usport, fmt, ...) \ | ||
391 | do { \ | ||
392 | static bool __print_once; \ | ||
393 | struct usb_serial_port *__port = (usport); \ | ||
394 | \ | ||
395 | if (!__port->port.console || !__print_once) { \ | ||
396 | __print_once = true; \ | ||
397 | dev_err(&__port->dev, fmt, ##__VA_ARGS__); \ | ||
398 | } \ | ||
399 | } while (0) | ||
400 | |||
401 | /* | ||
402 | * module_usb_serial_driver() - Helper macro for registering a USB Serial driver | ||
403 | * @__usb_driver: usb_driver struct to register | ||
404 | * @__serial_drivers: list of usb_serial drivers to register | ||
405 | * | ||
406 | * Helper macro for USB serial drivers which do not do anything special | ||
407 | * in module init/exit. This eliminates a lot of boilerplate. Each | ||
408 | * module may only use this macro once, and calling it replaces | ||
409 | * module_init() and module_exit() | ||
410 | * | ||
411 | */ | ||
412 | #define module_usb_serial_driver(__usb_driver, __serial_drivers) \ | ||
413 | module_driver(__usb_driver, usb_serial_register_drivers, \ | ||
414 | usb_serial_deregister_drivers, __serial_drivers) | ||
415 | |||
392 | #endif /* __LINUX_USB_SERIAL_H */ | 416 | #endif /* __LINUX_USB_SERIAL_H */ |
393 | 417 | ||
diff --git a/include/linux/usb/storage.h b/include/linux/usb/storage.h index d7fc910f1dc4..cb33fff2ba0b 100644 --- a/include/linux/usb/storage.h +++ b/include/linux/usb/storage.h | |||
@@ -45,4 +45,42 @@ | |||
45 | 45 | ||
46 | #define USB_PR_DEVICE 0xff /* Use device's value */ | 46 | #define USB_PR_DEVICE 0xff /* Use device's value */ |
47 | 47 | ||
48 | /* | ||
49 | * Bulk only data structures | ||
50 | */ | ||
51 | |||
52 | /* command block wrapper */ | ||
53 | struct bulk_cb_wrap { | ||
54 | __le32 Signature; /* contains 'USBC' */ | ||
55 | __u32 Tag; /* unique per command id */ | ||
56 | __le32 DataTransferLength; /* size of data */ | ||
57 | __u8 Flags; /* direction in bit 0 */ | ||
58 | __u8 Lun; /* LUN normally 0 */ | ||
59 | __u8 Length; /* of of the CDB */ | ||
60 | __u8 CDB[16]; /* max command */ | ||
61 | }; | ||
62 | |||
63 | #define US_BULK_CB_WRAP_LEN 31 | ||
64 | #define US_BULK_CB_SIGN 0x43425355 /*spells out USBC */ | ||
65 | #define US_BULK_FLAG_IN (1 << 7) | ||
66 | #define US_BULK_FLAG_OUT 0 | ||
67 | |||
68 | /* command status wrapper */ | ||
69 | struct bulk_cs_wrap { | ||
70 | __le32 Signature; /* should = 'USBS' */ | ||
71 | __u32 Tag; /* same as original command */ | ||
72 | __le32 Residue; /* amount not transferred */ | ||
73 | __u8 Status; /* see below */ | ||
74 | }; | ||
75 | |||
76 | #define US_BULK_CS_WRAP_LEN 13 | ||
77 | #define US_BULK_CS_SIGN 0x53425355 /* spells out 'USBS' */ | ||
78 | #define US_BULK_STAT_OK 0 | ||
79 | #define US_BULK_STAT_FAIL 1 | ||
80 | #define US_BULK_STAT_PHASE 2 | ||
81 | |||
82 | /* bulk-only class specific requests */ | ||
83 | #define US_BULK_RESET_REQUEST 0xff | ||
84 | #define US_BULK_GET_MAX_LUN 0xfe | ||
85 | |||
48 | #endif | 86 | #endif |
diff --git a/include/linux/usb/uas.h b/include/linux/usb/uas.h new file mode 100644 index 000000000000..9a988e413694 --- /dev/null +++ b/include/linux/usb/uas.h | |||
@@ -0,0 +1,69 @@ | |||
1 | #ifndef __USB_UAS_H__ | ||
2 | #define __USB_UAS_H__ | ||
3 | |||
4 | #include <scsi/scsi.h> | ||
5 | #include <scsi/scsi_cmnd.h> | ||
6 | |||
7 | /* Common header for all IUs */ | ||
8 | struct iu { | ||
9 | __u8 iu_id; | ||
10 | __u8 rsvd1; | ||
11 | __be16 tag; | ||
12 | }; | ||
13 | |||
14 | enum { | ||
15 | IU_ID_COMMAND = 0x01, | ||
16 | IU_ID_STATUS = 0x03, | ||
17 | IU_ID_RESPONSE = 0x04, | ||
18 | IU_ID_TASK_MGMT = 0x05, | ||
19 | IU_ID_READ_READY = 0x06, | ||
20 | IU_ID_WRITE_READY = 0x07, | ||
21 | }; | ||
22 | |||
23 | struct command_iu { | ||
24 | __u8 iu_id; | ||
25 | __u8 rsvd1; | ||
26 | __be16 tag; | ||
27 | __u8 prio_attr; | ||
28 | __u8 rsvd5; | ||
29 | __u8 len; | ||
30 | __u8 rsvd7; | ||
31 | struct scsi_lun lun; | ||
32 | __u8 cdb[16]; /* XXX: Overflow-checking tools may misunderstand */ | ||
33 | }; | ||
34 | |||
35 | /* | ||
36 | * Also used for the Read Ready and Write Ready IUs since they have the | ||
37 | * same first four bytes | ||
38 | */ | ||
39 | struct sense_iu { | ||
40 | __u8 iu_id; | ||
41 | __u8 rsvd1; | ||
42 | __be16 tag; | ||
43 | __be16 status_qual; | ||
44 | __u8 status; | ||
45 | __u8 rsvd7[7]; | ||
46 | __be16 len; | ||
47 | __u8 sense[SCSI_SENSE_BUFFERSIZE]; | ||
48 | }; | ||
49 | |||
50 | struct usb_pipe_usage_descriptor { | ||
51 | __u8 bLength; | ||
52 | __u8 bDescriptorType; | ||
53 | |||
54 | __u8 bPipeID; | ||
55 | __u8 Reserved; | ||
56 | } __attribute__((__packed__)); | ||
57 | |||
58 | enum { | ||
59 | CMD_PIPE_ID = 1, | ||
60 | STATUS_PIPE_ID = 2, | ||
61 | DATA_IN_PIPE_ID = 3, | ||
62 | DATA_OUT_PIPE_ID = 4, | ||
63 | |||
64 | UAS_SIMPLE_TAG = 0, | ||
65 | UAS_HEAD_TAG = 1, | ||
66 | UAS_ORDERED_TAG = 2, | ||
67 | UAS_ACA = 4, | ||
68 | }; | ||
69 | #endif | ||
diff --git a/include/linux/usb/ulpi.h b/include/linux/usb/ulpi.h index 9595796d62ed..6f033a415ecb 100644 --- a/include/linux/usb/ulpi.h +++ b/include/linux/usb/ulpi.h | |||
@@ -181,12 +181,12 @@ | |||
181 | 181 | ||
182 | /*-------------------------------------------------------------------------*/ | 182 | /*-------------------------------------------------------------------------*/ |
183 | 183 | ||
184 | struct otg_transceiver *otg_ulpi_create(struct otg_io_access_ops *ops, | 184 | struct usb_phy *otg_ulpi_create(struct usb_phy_io_ops *ops, |
185 | unsigned int flags); | 185 | unsigned int flags); |
186 | 186 | ||
187 | #ifdef CONFIG_USB_ULPI_VIEWPORT | 187 | #ifdef CONFIG_USB_ULPI_VIEWPORT |
188 | /* access ops for controllers with a viewport register */ | 188 | /* access ops for controllers with a viewport register */ |
189 | extern struct otg_io_access_ops ulpi_viewport_access_ops; | 189 | extern struct usb_phy_io_ops ulpi_viewport_access_ops; |
190 | #endif | 190 | #endif |
191 | 191 | ||
192 | #endif /* __LINUX_USB_ULPI_H */ | 192 | #endif /* __LINUX_USB_ULPI_H */ |
diff --git a/include/linux/vgaarb.h b/include/linux/vgaarb.h index 9c3120dca294..b572f80bdfd5 100644 --- a/include/linux/vgaarb.h +++ b/include/linux/vgaarb.h | |||
@@ -47,6 +47,8 @@ | |||
47 | */ | 47 | */ |
48 | #define VGA_DEFAULT_DEVICE (NULL) | 48 | #define VGA_DEFAULT_DEVICE (NULL) |
49 | 49 | ||
50 | struct pci_dev; | ||
51 | |||
50 | /* For use by clients */ | 52 | /* For use by clients */ |
51 | 53 | ||
52 | /** | 54 | /** |
diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h index 5e11f8a1f867..c9c9a4680cc5 100644 --- a/include/linux/videodev2.h +++ b/include/linux/videodev2.h | |||
@@ -235,16 +235,25 @@ struct v4l2_fract { | |||
235 | __u32 denominator; | 235 | __u32 denominator; |
236 | }; | 236 | }; |
237 | 237 | ||
238 | /* | 238 | /** |
239 | * D R I V E R C A P A B I L I T I E S | 239 | * struct v4l2_capability - Describes V4L2 device caps returned by VIDIOC_QUERYCAP |
240 | */ | 240 | * |
241 | * @driver: name of the driver module (e.g. "bttv") | ||
242 | * @card: name of the card (e.g. "Hauppauge WinTV") | ||
243 | * @bus_info: name of the bus (e.g. "PCI:" + pci_name(pci_dev) ) | ||
244 | * @version: KERNEL_VERSION | ||
245 | * @capabilities: capabilities of the physical device as a whole | ||
246 | * @device_caps: capabilities accessed via this particular device (node) | ||
247 | * @reserved: reserved fields for future extensions | ||
248 | */ | ||
241 | struct v4l2_capability { | 249 | struct v4l2_capability { |
242 | __u8 driver[16]; /* i.e. "bttv" */ | 250 | __u8 driver[16]; |
243 | __u8 card[32]; /* i.e. "Hauppauge WinTV" */ | 251 | __u8 card[32]; |
244 | __u8 bus_info[32]; /* "PCI:" + pci_name(pci_dev) */ | 252 | __u8 bus_info[32]; |
245 | __u32 version; /* should use KERNEL_VERSION() */ | 253 | __u32 version; |
246 | __u32 capabilities; /* Device capabilities */ | 254 | __u32 capabilities; |
247 | __u32 reserved[4]; | 255 | __u32 device_caps; |
256 | __u32 reserved[3]; | ||
248 | }; | 257 | }; |
249 | 258 | ||
250 | /* Values for 'capabilities' field */ | 259 | /* Values for 'capabilities' field */ |
@@ -274,6 +283,8 @@ struct v4l2_capability { | |||
274 | #define V4L2_CAP_ASYNCIO 0x02000000 /* async I/O */ | 283 | #define V4L2_CAP_ASYNCIO 0x02000000 /* async I/O */ |
275 | #define V4L2_CAP_STREAMING 0x04000000 /* streaming I/O ioctls */ | 284 | #define V4L2_CAP_STREAMING 0x04000000 /* streaming I/O ioctls */ |
276 | 285 | ||
286 | #define V4L2_CAP_DEVICE_CAPS 0x80000000 /* sets device capabilities field */ | ||
287 | |||
277 | /* | 288 | /* |
278 | * V I D E O I M A G E F O R M A T | 289 | * V I D E O I M A G E F O R M A T |
279 | */ | 290 | */ |
@@ -751,20 +762,20 @@ struct v4l2_crop { | |||
751 | 762 | ||
752 | /* Selection targets */ | 763 | /* Selection targets */ |
753 | 764 | ||
754 | /* current cropping area */ | 765 | /* Current cropping area */ |
755 | #define V4L2_SEL_TGT_CROP_ACTIVE 0 | 766 | #define V4L2_SEL_TGT_CROP_ACTIVE 0x0000 |
756 | /* default cropping area */ | 767 | /* Default cropping area */ |
757 | #define V4L2_SEL_TGT_CROP_DEFAULT 1 | 768 | #define V4L2_SEL_TGT_CROP_DEFAULT 0x0001 |
758 | /* cropping bounds */ | 769 | /* Cropping bounds */ |
759 | #define V4L2_SEL_TGT_CROP_BOUNDS 2 | 770 | #define V4L2_SEL_TGT_CROP_BOUNDS 0x0002 |
760 | /* current composing area */ | 771 | /* Current composing area */ |
761 | #define V4L2_SEL_TGT_COMPOSE_ACTIVE 256 | 772 | #define V4L2_SEL_TGT_COMPOSE_ACTIVE 0x0100 |
762 | /* default composing area */ | 773 | /* Default composing area */ |
763 | #define V4L2_SEL_TGT_COMPOSE_DEFAULT 257 | 774 | #define V4L2_SEL_TGT_COMPOSE_DEFAULT 0x0101 |
764 | /* composing bounds */ | 775 | /* Composing bounds */ |
765 | #define V4L2_SEL_TGT_COMPOSE_BOUNDS 258 | 776 | #define V4L2_SEL_TGT_COMPOSE_BOUNDS 0x0102 |
766 | /* current composing area plus all padding pixels */ | 777 | /* Current composing area plus all padding pixels */ |
767 | #define V4L2_SEL_TGT_COMPOSE_PADDED 259 | 778 | #define V4L2_SEL_TGT_COMPOSE_PADDED 0x0103 |
768 | 779 | ||
769 | /** | 780 | /** |
770 | * struct v4l2_selection - selection info | 781 | * struct v4l2_selection - selection info |
@@ -774,7 +785,7 @@ struct v4l2_crop { | |||
774 | * @r: coordinates of selection window | 785 | * @r: coordinates of selection window |
775 | * @reserved: for future use, rounds structure size to 64 bytes, set to zero | 786 | * @reserved: for future use, rounds structure size to 64 bytes, set to zero |
776 | * | 787 | * |
777 | * Hardware may use multiple helper window to process a video stream. | 788 | * Hardware may use multiple helper windows to process a video stream. |
778 | * The structure is used to exchange this selection areas between | 789 | * The structure is used to exchange this selection areas between |
779 | * an application and a driver. | 790 | * an application and a driver. |
780 | */ | 791 | */ |
@@ -1125,6 +1136,7 @@ struct v4l2_ext_controls { | |||
1125 | #define V4L2_CTRL_CLASS_CAMERA 0x009a0000 /* Camera class controls */ | 1136 | #define V4L2_CTRL_CLASS_CAMERA 0x009a0000 /* Camera class controls */ |
1126 | #define V4L2_CTRL_CLASS_FM_TX 0x009b0000 /* FM Modulator control class */ | 1137 | #define V4L2_CTRL_CLASS_FM_TX 0x009b0000 /* FM Modulator control class */ |
1127 | #define V4L2_CTRL_CLASS_FLASH 0x009c0000 /* Camera flash controls */ | 1138 | #define V4L2_CTRL_CLASS_FLASH 0x009c0000 /* Camera flash controls */ |
1139 | #define V4L2_CTRL_CLASS_JPEG 0x009d0000 /* JPEG-compression controls */ | ||
1128 | 1140 | ||
1129 | #define V4L2_CTRL_ID_MASK (0x0fffffff) | 1141 | #define V4L2_CTRL_ID_MASK (0x0fffffff) |
1130 | #define V4L2_CTRL_ID2CLASS(id) ((id) & 0x0fff0000UL) | 1142 | #define V4L2_CTRL_ID2CLASS(id) ((id) & 0x0fff0000UL) |
@@ -1396,6 +1408,16 @@ enum v4l2_mpeg_audio_ac3_bitrate { | |||
1396 | V4L2_MPEG_AUDIO_AC3_BITRATE_576K = 17, | 1408 | V4L2_MPEG_AUDIO_AC3_BITRATE_576K = 17, |
1397 | V4L2_MPEG_AUDIO_AC3_BITRATE_640K = 18, | 1409 | V4L2_MPEG_AUDIO_AC3_BITRATE_640K = 18, |
1398 | }; | 1410 | }; |
1411 | #define V4L2_CID_MPEG_AUDIO_DEC_PLAYBACK (V4L2_CID_MPEG_BASE+112) | ||
1412 | enum v4l2_mpeg_audio_dec_playback { | ||
1413 | V4L2_MPEG_AUDIO_DEC_PLAYBACK_AUTO = 0, | ||
1414 | V4L2_MPEG_AUDIO_DEC_PLAYBACK_STEREO = 1, | ||
1415 | V4L2_MPEG_AUDIO_DEC_PLAYBACK_LEFT = 2, | ||
1416 | V4L2_MPEG_AUDIO_DEC_PLAYBACK_RIGHT = 3, | ||
1417 | V4L2_MPEG_AUDIO_DEC_PLAYBACK_MONO = 4, | ||
1418 | V4L2_MPEG_AUDIO_DEC_PLAYBACK_SWAPPED_STEREO = 5, | ||
1419 | }; | ||
1420 | #define V4L2_CID_MPEG_AUDIO_DEC_MULTILINGUAL_PLAYBACK (V4L2_CID_MPEG_BASE+113) | ||
1399 | 1421 | ||
1400 | /* MPEG video controls specific to multiplexed streams */ | 1422 | /* MPEG video controls specific to multiplexed streams */ |
1401 | #define V4L2_CID_MPEG_VIDEO_ENCODING (V4L2_CID_MPEG_BASE+200) | 1423 | #define V4L2_CID_MPEG_VIDEO_ENCODING (V4L2_CID_MPEG_BASE+200) |
@@ -1446,6 +1468,9 @@ enum v4l2_mpeg_video_multi_slice_mode { | |||
1446 | V4L2_MPEG_VIDEO_MULTI_SICE_MODE_MAX_BYTES = 2, | 1468 | V4L2_MPEG_VIDEO_MULTI_SICE_MODE_MAX_BYTES = 2, |
1447 | }; | 1469 | }; |
1448 | #define V4L2_CID_MPEG_VIDEO_VBV_SIZE (V4L2_CID_MPEG_BASE+222) | 1470 | #define V4L2_CID_MPEG_VIDEO_VBV_SIZE (V4L2_CID_MPEG_BASE+222) |
1471 | #define V4L2_CID_MPEG_VIDEO_DEC_PTS (V4L2_CID_MPEG_BASE+223) | ||
1472 | #define V4L2_CID_MPEG_VIDEO_DEC_FRAME (V4L2_CID_MPEG_BASE+224) | ||
1473 | |||
1449 | #define V4L2_CID_MPEG_VIDEO_H263_I_FRAME_QP (V4L2_CID_MPEG_BASE+300) | 1474 | #define V4L2_CID_MPEG_VIDEO_H263_I_FRAME_QP (V4L2_CID_MPEG_BASE+300) |
1450 | #define V4L2_CID_MPEG_VIDEO_H263_P_FRAME_QP (V4L2_CID_MPEG_BASE+301) | 1475 | #define V4L2_CID_MPEG_VIDEO_H263_P_FRAME_QP (V4L2_CID_MPEG_BASE+301) |
1451 | #define V4L2_CID_MPEG_VIDEO_H263_B_FRAME_QP (V4L2_CID_MPEG_BASE+302) | 1476 | #define V4L2_CID_MPEG_VIDEO_H263_B_FRAME_QP (V4L2_CID_MPEG_BASE+302) |
@@ -1734,6 +1759,29 @@ enum v4l2_flash_strobe_source { | |||
1734 | #define V4L2_CID_FLASH_CHARGE (V4L2_CID_FLASH_CLASS_BASE + 11) | 1759 | #define V4L2_CID_FLASH_CHARGE (V4L2_CID_FLASH_CLASS_BASE + 11) |
1735 | #define V4L2_CID_FLASH_READY (V4L2_CID_FLASH_CLASS_BASE + 12) | 1760 | #define V4L2_CID_FLASH_READY (V4L2_CID_FLASH_CLASS_BASE + 12) |
1736 | 1761 | ||
1762 | /* JPEG-class control IDs defined by V4L2 */ | ||
1763 | #define V4L2_CID_JPEG_CLASS_BASE (V4L2_CTRL_CLASS_JPEG | 0x900) | ||
1764 | #define V4L2_CID_JPEG_CLASS (V4L2_CTRL_CLASS_JPEG | 1) | ||
1765 | |||
1766 | #define V4L2_CID_JPEG_CHROMA_SUBSAMPLING (V4L2_CID_JPEG_CLASS_BASE + 1) | ||
1767 | enum v4l2_jpeg_chroma_subsampling { | ||
1768 | V4L2_JPEG_CHROMA_SUBSAMPLING_444 = 0, | ||
1769 | V4L2_JPEG_CHROMA_SUBSAMPLING_422 = 1, | ||
1770 | V4L2_JPEG_CHROMA_SUBSAMPLING_420 = 2, | ||
1771 | V4L2_JPEG_CHROMA_SUBSAMPLING_411 = 3, | ||
1772 | V4L2_JPEG_CHROMA_SUBSAMPLING_410 = 4, | ||
1773 | V4L2_JPEG_CHROMA_SUBSAMPLING_GRAY = 5, | ||
1774 | }; | ||
1775 | #define V4L2_CID_JPEG_RESTART_INTERVAL (V4L2_CID_JPEG_CLASS_BASE + 2) | ||
1776 | #define V4L2_CID_JPEG_COMPRESSION_QUALITY (V4L2_CID_JPEG_CLASS_BASE + 3) | ||
1777 | |||
1778 | #define V4L2_CID_JPEG_ACTIVE_MARKER (V4L2_CID_JPEG_CLASS_BASE + 4) | ||
1779 | #define V4L2_JPEG_ACTIVE_MARKER_APP0 (1 << 0) | ||
1780 | #define V4L2_JPEG_ACTIVE_MARKER_APP1 (1 << 1) | ||
1781 | #define V4L2_JPEG_ACTIVE_MARKER_COM (1 << 16) | ||
1782 | #define V4L2_JPEG_ACTIVE_MARKER_DQT (1 << 17) | ||
1783 | #define V4L2_JPEG_ACTIVE_MARKER_DHT (1 << 18) | ||
1784 | |||
1737 | /* | 1785 | /* |
1738 | * T U N I N G | 1786 | * T U N I N G |
1739 | */ | 1787 | */ |
@@ -1897,6 +1945,54 @@ struct v4l2_encoder_cmd { | |||
1897 | }; | 1945 | }; |
1898 | }; | 1946 | }; |
1899 | 1947 | ||
1948 | /* Decoder commands */ | ||
1949 | #define V4L2_DEC_CMD_START (0) | ||
1950 | #define V4L2_DEC_CMD_STOP (1) | ||
1951 | #define V4L2_DEC_CMD_PAUSE (2) | ||
1952 | #define V4L2_DEC_CMD_RESUME (3) | ||
1953 | |||
1954 | /* Flags for V4L2_DEC_CMD_START */ | ||
1955 | #define V4L2_DEC_CMD_START_MUTE_AUDIO (1 << 0) | ||
1956 | |||
1957 | /* Flags for V4L2_DEC_CMD_PAUSE */ | ||
1958 | #define V4L2_DEC_CMD_PAUSE_TO_BLACK (1 << 0) | ||
1959 | |||
1960 | /* Flags for V4L2_DEC_CMD_STOP */ | ||
1961 | #define V4L2_DEC_CMD_STOP_TO_BLACK (1 << 0) | ||
1962 | #define V4L2_DEC_CMD_STOP_IMMEDIATELY (1 << 1) | ||
1963 | |||
1964 | /* Play format requirements (returned by the driver): */ | ||
1965 | |||
1966 | /* The decoder has no special format requirements */ | ||
1967 | #define V4L2_DEC_START_FMT_NONE (0) | ||
1968 | /* The decoder requires full GOPs */ | ||
1969 | #define V4L2_DEC_START_FMT_GOP (1) | ||
1970 | |||
1971 | /* The structure must be zeroed before use by the application | ||
1972 | This ensures it can be extended safely in the future. */ | ||
1973 | struct v4l2_decoder_cmd { | ||
1974 | __u32 cmd; | ||
1975 | __u32 flags; | ||
1976 | union { | ||
1977 | struct { | ||
1978 | __u64 pts; | ||
1979 | } stop; | ||
1980 | |||
1981 | struct { | ||
1982 | /* 0 or 1000 specifies normal speed, | ||
1983 | 1 specifies forward single stepping, | ||
1984 | -1 specifies backward single stepping, | ||
1985 | >1: playback at speed/1000 of the normal speed, | ||
1986 | <-1: reverse playback at (-speed/1000) of the normal speed. */ | ||
1987 | __s32 speed; | ||
1988 | __u32 format; | ||
1989 | } start; | ||
1990 | |||
1991 | struct { | ||
1992 | __u32 data[16]; | ||
1993 | } raw; | ||
1994 | }; | ||
1995 | }; | ||
1900 | #endif | 1996 | #endif |
1901 | 1997 | ||
1902 | 1998 | ||
@@ -2307,6 +2403,11 @@ struct v4l2_create_buffers { | |||
2307 | #define VIDIOC_G_SELECTION _IOWR('V', 94, struct v4l2_selection) | 2403 | #define VIDIOC_G_SELECTION _IOWR('V', 94, struct v4l2_selection) |
2308 | #define VIDIOC_S_SELECTION _IOWR('V', 95, struct v4l2_selection) | 2404 | #define VIDIOC_S_SELECTION _IOWR('V', 95, struct v4l2_selection) |
2309 | 2405 | ||
2406 | /* Experimental, these two ioctls may change over the next couple of kernel | ||
2407 | versions. */ | ||
2408 | #define VIDIOC_DECODER_CMD _IOWR('V', 96, struct v4l2_decoder_cmd) | ||
2409 | #define VIDIOC_TRY_DECODER_CMD _IOWR('V', 97, struct v4l2_decoder_cmd) | ||
2410 | |||
2310 | /* Reminder: when adding new ioctls please add support for them to | 2411 | /* Reminder: when adding new ioctls please add support for them to |
2311 | drivers/media/video/v4l2-compat-ioctl32.c as well! */ | 2412 | drivers/media/video/v4l2-compat-ioctl32.c as well! */ |
2312 | 2413 | ||
diff --git a/include/linux/virtio.h b/include/linux/virtio.h index d0018d27c281..8efd28ae5597 100644 --- a/include/linux/virtio.h +++ b/include/linux/virtio.h | |||
@@ -96,7 +96,6 @@ struct virtio_driver { | |||
96 | void (*config_changed)(struct virtio_device *dev); | 96 | void (*config_changed)(struct virtio_device *dev); |
97 | #ifdef CONFIG_PM | 97 | #ifdef CONFIG_PM |
98 | int (*freeze)(struct virtio_device *dev); | 98 | int (*freeze)(struct virtio_device *dev); |
99 | int (*thaw)(struct virtio_device *dev); | ||
100 | int (*restore)(struct virtio_device *dev); | 99 | int (*restore)(struct virtio_device *dev); |
101 | #endif | 100 | #endif |
102 | }; | 101 | }; |
diff --git a/include/linux/virtio_config.h b/include/linux/virtio_config.h index 5206d6541da5..7323a3390206 100644 --- a/include/linux/virtio_config.h +++ b/include/linux/virtio_config.h | |||
@@ -53,6 +53,7 @@ | |||
53 | 53 | ||
54 | #ifdef __KERNEL__ | 54 | #ifdef __KERNEL__ |
55 | #include <linux/err.h> | 55 | #include <linux/err.h> |
56 | #include <linux/bug.h> | ||
56 | #include <linux/virtio.h> | 57 | #include <linux/virtio.h> |
57 | 58 | ||
58 | /** | 59 | /** |
diff --git a/include/linux/virtio_ids.h b/include/linux/virtio_ids.h index 85bb0bb66ffc..7529b854b7fd 100644 --- a/include/linux/virtio_ids.h +++ b/include/linux/virtio_ids.h | |||
@@ -34,6 +34,8 @@ | |||
34 | #define VIRTIO_ID_CONSOLE 3 /* virtio console */ | 34 | #define VIRTIO_ID_CONSOLE 3 /* virtio console */ |
35 | #define VIRTIO_ID_RNG 4 /* virtio ring */ | 35 | #define VIRTIO_ID_RNG 4 /* virtio ring */ |
36 | #define VIRTIO_ID_BALLOON 5 /* virtio balloon */ | 36 | #define VIRTIO_ID_BALLOON 5 /* virtio balloon */ |
37 | #define VIRTIO_ID_RPMSG 7 /* virtio remote processor messaging */ | ||
38 | #define VIRTIO_ID_SCSI 8 /* virtio scsi */ | ||
37 | #define VIRTIO_ID_9P 9 /* 9p virtio console */ | 39 | #define VIRTIO_ID_9P 9 /* 9p virtio console */ |
38 | 40 | ||
39 | #endif /* _LINUX_VIRTIO_IDS_H */ | 41 | #endif /* _LINUX_VIRTIO_IDS_H */ |
diff --git a/include/linux/virtio_scsi.h b/include/linux/virtio_scsi.h new file mode 100644 index 000000000000..8ddeafdc0546 --- /dev/null +++ b/include/linux/virtio_scsi.h | |||
@@ -0,0 +1,114 @@ | |||
1 | #ifndef _LINUX_VIRTIO_SCSI_H | ||
2 | #define _LINUX_VIRTIO_SCSI_H | ||
3 | /* This header is BSD licensed so anyone can use the definitions to implement | ||
4 | * compatible drivers/servers. */ | ||
5 | |||
6 | #define VIRTIO_SCSI_CDB_SIZE 32 | ||
7 | #define VIRTIO_SCSI_SENSE_SIZE 96 | ||
8 | |||
9 | /* SCSI command request, followed by data-out */ | ||
10 | struct virtio_scsi_cmd_req { | ||
11 | u8 lun[8]; /* Logical Unit Number */ | ||
12 | u64 tag; /* Command identifier */ | ||
13 | u8 task_attr; /* Task attribute */ | ||
14 | u8 prio; | ||
15 | u8 crn; | ||
16 | u8 cdb[VIRTIO_SCSI_CDB_SIZE]; | ||
17 | } __packed; | ||
18 | |||
19 | /* Response, followed by sense data and data-in */ | ||
20 | struct virtio_scsi_cmd_resp { | ||
21 | u32 sense_len; /* Sense data length */ | ||
22 | u32 resid; /* Residual bytes in data buffer */ | ||
23 | u16 status_qualifier; /* Status qualifier */ | ||
24 | u8 status; /* Command completion status */ | ||
25 | u8 response; /* Response values */ | ||
26 | u8 sense[VIRTIO_SCSI_SENSE_SIZE]; | ||
27 | } __packed; | ||
28 | |||
29 | /* Task Management Request */ | ||
30 | struct virtio_scsi_ctrl_tmf_req { | ||
31 | u32 type; | ||
32 | u32 subtype; | ||
33 | u8 lun[8]; | ||
34 | u64 tag; | ||
35 | } __packed; | ||
36 | |||
37 | struct virtio_scsi_ctrl_tmf_resp { | ||
38 | u8 response; | ||
39 | } __packed; | ||
40 | |||
41 | /* Asynchronous notification query/subscription */ | ||
42 | struct virtio_scsi_ctrl_an_req { | ||
43 | u32 type; | ||
44 | u8 lun[8]; | ||
45 | u32 event_requested; | ||
46 | } __packed; | ||
47 | |||
48 | struct virtio_scsi_ctrl_an_resp { | ||
49 | u32 event_actual; | ||
50 | u8 response; | ||
51 | } __packed; | ||
52 | |||
53 | struct virtio_scsi_event { | ||
54 | u32 event; | ||
55 | u8 lun[8]; | ||
56 | u32 reason; | ||
57 | } __packed; | ||
58 | |||
59 | struct virtio_scsi_config { | ||
60 | u32 num_queues; | ||
61 | u32 seg_max; | ||
62 | u32 max_sectors; | ||
63 | u32 cmd_per_lun; | ||
64 | u32 event_info_size; | ||
65 | u32 sense_size; | ||
66 | u32 cdb_size; | ||
67 | u16 max_channel; | ||
68 | u16 max_target; | ||
69 | u32 max_lun; | ||
70 | } __packed; | ||
71 | |||
72 | /* Response codes */ | ||
73 | #define VIRTIO_SCSI_S_OK 0 | ||
74 | #define VIRTIO_SCSI_S_OVERRUN 1 | ||
75 | #define VIRTIO_SCSI_S_ABORTED 2 | ||
76 | #define VIRTIO_SCSI_S_BAD_TARGET 3 | ||
77 | #define VIRTIO_SCSI_S_RESET 4 | ||
78 | #define VIRTIO_SCSI_S_BUSY 5 | ||
79 | #define VIRTIO_SCSI_S_TRANSPORT_FAILURE 6 | ||
80 | #define VIRTIO_SCSI_S_TARGET_FAILURE 7 | ||
81 | #define VIRTIO_SCSI_S_NEXUS_FAILURE 8 | ||
82 | #define VIRTIO_SCSI_S_FAILURE 9 | ||
83 | #define VIRTIO_SCSI_S_FUNCTION_SUCCEEDED 10 | ||
84 | #define VIRTIO_SCSI_S_FUNCTION_REJECTED 11 | ||
85 | #define VIRTIO_SCSI_S_INCORRECT_LUN 12 | ||
86 | |||
87 | /* Controlq type codes. */ | ||
88 | #define VIRTIO_SCSI_T_TMF 0 | ||
89 | #define VIRTIO_SCSI_T_AN_QUERY 1 | ||
90 | #define VIRTIO_SCSI_T_AN_SUBSCRIBE 2 | ||
91 | |||
92 | /* Valid TMF subtypes. */ | ||
93 | #define VIRTIO_SCSI_T_TMF_ABORT_TASK 0 | ||
94 | #define VIRTIO_SCSI_T_TMF_ABORT_TASK_SET 1 | ||
95 | #define VIRTIO_SCSI_T_TMF_CLEAR_ACA 2 | ||
96 | #define VIRTIO_SCSI_T_TMF_CLEAR_TASK_SET 3 | ||
97 | #define VIRTIO_SCSI_T_TMF_I_T_NEXUS_RESET 4 | ||
98 | #define VIRTIO_SCSI_T_TMF_LOGICAL_UNIT_RESET 5 | ||
99 | #define VIRTIO_SCSI_T_TMF_QUERY_TASK 6 | ||
100 | #define VIRTIO_SCSI_T_TMF_QUERY_TASK_SET 7 | ||
101 | |||
102 | /* Events. */ | ||
103 | #define VIRTIO_SCSI_T_EVENTS_MISSED 0x80000000 | ||
104 | #define VIRTIO_SCSI_T_NO_EVENT 0 | ||
105 | #define VIRTIO_SCSI_T_TRANSPORT_RESET 1 | ||
106 | #define VIRTIO_SCSI_T_ASYNC_NOTIFY 2 | ||
107 | |||
108 | #define VIRTIO_SCSI_S_SIMPLE 0 | ||
109 | #define VIRTIO_SCSI_S_ORDERED 1 | ||
110 | #define VIRTIO_SCSI_S_HEAD 2 | ||
111 | #define VIRTIO_SCSI_S_ACA 3 | ||
112 | |||
113 | |||
114 | #endif /* _LINUX_VIRTIO_SCSI_H */ | ||
diff --git a/include/linux/vt_kern.h b/include/linux/vt_kern.h index c2164fad0083..e33d77f15bda 100644 --- a/include/linux/vt_kern.h +++ b/include/linux/vt_kern.h | |||
@@ -167,4 +167,30 @@ extern int unregister_vt_notifier(struct notifier_block *nb); | |||
167 | 167 | ||
168 | extern void hide_boot_cursor(bool hide); | 168 | extern void hide_boot_cursor(bool hide); |
169 | 169 | ||
170 | /* keyboard provided interfaces */ | ||
171 | extern int vt_do_diacrit(unsigned int cmd, void __user *up, int eperm); | ||
172 | extern int vt_do_kdskbmode(int console, unsigned int arg); | ||
173 | extern int vt_do_kdskbmeta(int console, unsigned int arg); | ||
174 | extern int vt_do_kbkeycode_ioctl(int cmd, struct kbkeycode __user *user_kbkc, | ||
175 | int perm); | ||
176 | extern int vt_do_kdsk_ioctl(int cmd, struct kbentry __user *user_kbe, | ||
177 | int perm, int console); | ||
178 | extern int vt_do_kdgkb_ioctl(int cmd, struct kbsentry __user *user_kdgkb, | ||
179 | int perm); | ||
180 | extern int vt_do_kdskled(int console, int cmd, unsigned long arg, int perm); | ||
181 | extern int vt_do_kdgkbmode(int console); | ||
182 | extern int vt_do_kdgkbmeta(int console); | ||
183 | extern void vt_reset_unicode(int console); | ||
184 | extern int vt_get_shift_state(void); | ||
185 | extern void vt_reset_keyboard(int console); | ||
186 | extern int vt_get_leds(int console, int flag); | ||
187 | extern int vt_get_kbd_mode_bit(int console, int bit); | ||
188 | extern void vt_set_kbd_mode_bit(int console, int bit); | ||
189 | extern void vt_clr_kbd_mode_bit(int console, int bit); | ||
190 | extern void vt_set_led_state(int console, int leds); | ||
191 | extern void vt_set_led_state(int console, int leds); | ||
192 | extern void vt_kbd_con_start(int console); | ||
193 | extern void vt_kbd_con_stop(int console); | ||
194 | |||
195 | |||
170 | #endif /* _VT_KERN_H */ | 196 | #endif /* _VT_KERN_H */ |
diff --git a/include/linux/wait.h b/include/linux/wait.h index a9ce45e8501c..1dee81c41ff1 100644 --- a/include/linux/wait.h +++ b/include/linux/wait.h | |||
@@ -22,7 +22,6 @@ | |||
22 | #include <linux/list.h> | 22 | #include <linux/list.h> |
23 | #include <linux/stddef.h> | 23 | #include <linux/stddef.h> |
24 | #include <linux/spinlock.h> | 24 | #include <linux/spinlock.h> |
25 | #include <asm/system.h> | ||
26 | #include <asm/current.h> | 25 | #include <asm/current.h> |
27 | 26 | ||
28 | typedef struct __wait_queue wait_queue_t; | 27 | typedef struct __wait_queue wait_queue_t; |
@@ -157,7 +156,7 @@ void __wake_up(wait_queue_head_t *q, unsigned int mode, int nr, void *key); | |||
157 | void __wake_up_locked_key(wait_queue_head_t *q, unsigned int mode, void *key); | 156 | void __wake_up_locked_key(wait_queue_head_t *q, unsigned int mode, void *key); |
158 | void __wake_up_sync_key(wait_queue_head_t *q, unsigned int mode, int nr, | 157 | void __wake_up_sync_key(wait_queue_head_t *q, unsigned int mode, int nr, |
159 | void *key); | 158 | void *key); |
160 | void __wake_up_locked(wait_queue_head_t *q, unsigned int mode); | 159 | void __wake_up_locked(wait_queue_head_t *q, unsigned int mode, int nr); |
161 | void __wake_up_sync(wait_queue_head_t *q, unsigned int mode, int nr); | 160 | void __wake_up_sync(wait_queue_head_t *q, unsigned int mode, int nr); |
162 | void __wake_up_bit(wait_queue_head_t *, void *, int); | 161 | void __wake_up_bit(wait_queue_head_t *, void *, int); |
163 | int __wait_on_bit(wait_queue_head_t *, struct wait_bit_queue *, int (*)(void *), unsigned); | 162 | int __wait_on_bit(wait_queue_head_t *, struct wait_bit_queue *, int (*)(void *), unsigned); |
@@ -170,7 +169,8 @@ wait_queue_head_t *bit_waitqueue(void *, int); | |||
170 | #define wake_up(x) __wake_up(x, TASK_NORMAL, 1, NULL) | 169 | #define wake_up(x) __wake_up(x, TASK_NORMAL, 1, NULL) |
171 | #define wake_up_nr(x, nr) __wake_up(x, TASK_NORMAL, nr, NULL) | 170 | #define wake_up_nr(x, nr) __wake_up(x, TASK_NORMAL, nr, NULL) |
172 | #define wake_up_all(x) __wake_up(x, TASK_NORMAL, 0, NULL) | 171 | #define wake_up_all(x) __wake_up(x, TASK_NORMAL, 0, NULL) |
173 | #define wake_up_locked(x) __wake_up_locked((x), TASK_NORMAL) | 172 | #define wake_up_locked(x) __wake_up_locked((x), TASK_NORMAL, 1) |
173 | #define wake_up_all_locked(x) __wake_up_locked((x), TASK_NORMAL, 0) | ||
174 | 174 | ||
175 | #define wake_up_interruptible(x) __wake_up(x, TASK_INTERRUPTIBLE, 1, NULL) | 175 | #define wake_up_interruptible(x) __wake_up(x, TASK_INTERRUPTIBLE, 1, NULL) |
176 | #define wake_up_interruptible_nr(x, nr) __wake_up(x, TASK_INTERRUPTIBLE, nr, NULL) | 176 | #define wake_up_interruptible_nr(x, nr) __wake_up(x, TASK_INTERRUPTIBLE, nr, NULL) |
diff --git a/include/linux/watchdog.h b/include/linux/watchdog.h index 43ba5b3ce2a3..ac40716b44e9 100644 --- a/include/linux/watchdog.h +++ b/include/linux/watchdog.h | |||
@@ -66,6 +66,7 @@ struct watchdog_device; | |||
66 | * @ping: The routine that sends a keepalive ping to the watchdog device. | 66 | * @ping: The routine that sends a keepalive ping to the watchdog device. |
67 | * @status: The routine that shows the status of the watchdog device. | 67 | * @status: The routine that shows the status of the watchdog device. |
68 | * @set_timeout:The routine for setting the watchdog devices timeout value. | 68 | * @set_timeout:The routine for setting the watchdog devices timeout value. |
69 | * @get_timeleft:The routine that get's the time that's left before a reset. | ||
69 | * @ioctl: The routines that handles extra ioctl calls. | 70 | * @ioctl: The routines that handles extra ioctl calls. |
70 | * | 71 | * |
71 | * The watchdog_ops structure contains a list of low-level operations | 72 | * The watchdog_ops structure contains a list of low-level operations |
@@ -82,6 +83,7 @@ struct watchdog_ops { | |||
82 | int (*ping)(struct watchdog_device *); | 83 | int (*ping)(struct watchdog_device *); |
83 | unsigned int (*status)(struct watchdog_device *); | 84 | unsigned int (*status)(struct watchdog_device *); |
84 | int (*set_timeout)(struct watchdog_device *, unsigned int); | 85 | int (*set_timeout)(struct watchdog_device *, unsigned int); |
86 | unsigned int (*get_timeleft)(struct watchdog_device *); | ||
85 | long (*ioctl)(struct watchdog_device *, unsigned int, unsigned long); | 87 | long (*ioctl)(struct watchdog_device *, unsigned int, unsigned long); |
86 | }; | 88 | }; |
87 | 89 | ||
@@ -127,7 +129,7 @@ struct watchdog_device { | |||
127 | #endif | 129 | #endif |
128 | 130 | ||
129 | /* Use the following function to set the nowayout feature */ | 131 | /* Use the following function to set the nowayout feature */ |
130 | static inline void watchdog_set_nowayout(struct watchdog_device *wdd, int nowayout) | 132 | static inline void watchdog_set_nowayout(struct watchdog_device *wdd, bool nowayout) |
131 | { | 133 | { |
132 | if (nowayout) | 134 | if (nowayout) |
133 | set_bit(WDOG_NO_WAY_OUT, &wdd->status); | 135 | set_bit(WDOG_NO_WAY_OUT, &wdd->status); |
diff --git a/include/linux/wimax/debug.h b/include/linux/wimax/debug.h index 57031b4d12f2..aaf24ba12c4d 100644 --- a/include/linux/wimax/debug.h +++ b/include/linux/wimax/debug.h | |||
@@ -154,9 +154,9 @@ | |||
154 | #define __debug__h__ | 154 | #define __debug__h__ |
155 | 155 | ||
156 | #include <linux/types.h> | 156 | #include <linux/types.h> |
157 | #include <linux/device.h> | ||
158 | #include <linux/slab.h> | 157 | #include <linux/slab.h> |
159 | 158 | ||
159 | struct device; | ||
160 | 160 | ||
161 | /* Backend stuff */ | 161 | /* Backend stuff */ |
162 | 162 | ||
diff --git a/include/linux/workqueue.h b/include/linux/workqueue.h index eb8b9f15f2e0..af155450cabb 100644 --- a/include/linux/workqueue.h +++ b/include/linux/workqueue.h | |||
@@ -289,12 +289,16 @@ enum { | |||
289 | * | 289 | * |
290 | * system_freezable_wq is equivalent to system_wq except that it's | 290 | * system_freezable_wq is equivalent to system_wq except that it's |
291 | * freezable. | 291 | * freezable. |
292 | * | ||
293 | * system_nrt_freezable_wq is equivalent to system_nrt_wq except that | ||
294 | * it's freezable. | ||
292 | */ | 295 | */ |
293 | extern struct workqueue_struct *system_wq; | 296 | extern struct workqueue_struct *system_wq; |
294 | extern struct workqueue_struct *system_long_wq; | 297 | extern struct workqueue_struct *system_long_wq; |
295 | extern struct workqueue_struct *system_nrt_wq; | 298 | extern struct workqueue_struct *system_nrt_wq; |
296 | extern struct workqueue_struct *system_unbound_wq; | 299 | extern struct workqueue_struct *system_unbound_wq; |
297 | extern struct workqueue_struct *system_freezable_wq; | 300 | extern struct workqueue_struct *system_freezable_wq; |
301 | extern struct workqueue_struct *system_nrt_freezable_wq; | ||
298 | 302 | ||
299 | extern struct workqueue_struct * | 303 | extern struct workqueue_struct * |
300 | __alloc_workqueue_key(const char *fmt, unsigned int flags, int max_active, | 304 | __alloc_workqueue_key(const char *fmt, unsigned int flags, int max_active, |
diff --git a/include/linux/writeback.h b/include/linux/writeback.h index 995b8bf630ac..a2b84f598e2b 100644 --- a/include/linux/writeback.h +++ b/include/linux/writeback.h | |||
@@ -64,7 +64,7 @@ struct writeback_control { | |||
64 | long pages_skipped; /* Pages which were not written */ | 64 | long pages_skipped; /* Pages which were not written */ |
65 | 65 | ||
66 | /* | 66 | /* |
67 | * For a_ops->writepages(): is start or end are non-zero then this is | 67 | * For a_ops->writepages(): if start or end are non-zero then this is |
68 | * a hint that the filesystem need only write out the pages inside that | 68 | * a hint that the filesystem need only write out the pages inside that |
69 | * byterange. The byte at `end' is included in the writeout request. | 69 | * byterange. The byte at `end' is included in the writeout request. |
70 | */ | 70 | */ |
diff --git a/include/media/adv7183.h b/include/media/adv7183.h new file mode 100644 index 000000000000..c5c2d377c0a6 --- /dev/null +++ b/include/media/adv7183.h | |||
@@ -0,0 +1,47 @@ | |||
1 | /* | ||
2 | * adv7183.h - definition for adv7183 inputs and outputs | ||
3 | * | ||
4 | * Copyright (c) 2011 Analog Devices Inc. | ||
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, write to the Free Software | ||
17 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
18 | */ | ||
19 | |||
20 | #ifndef _ADV7183_H_ | ||
21 | #define _ADV7183_H_ | ||
22 | |||
23 | /* ADV7183 HW inputs */ | ||
24 | #define ADV7183_COMPOSITE0 0 /* CVBS in on AIN1 */ | ||
25 | #define ADV7183_COMPOSITE1 1 /* CVBS in on AIN2 */ | ||
26 | #define ADV7183_COMPOSITE2 2 /* CVBS in on AIN3 */ | ||
27 | #define ADV7183_COMPOSITE3 3 /* CVBS in on AIN4 */ | ||
28 | #define ADV7183_COMPOSITE4 4 /* CVBS in on AIN5 */ | ||
29 | #define ADV7183_COMPOSITE5 5 /* CVBS in on AIN6 */ | ||
30 | #define ADV7183_COMPOSITE6 6 /* CVBS in on AIN7 */ | ||
31 | #define ADV7183_COMPOSITE7 7 /* CVBS in on AIN8 */ | ||
32 | #define ADV7183_COMPOSITE8 8 /* CVBS in on AIN9 */ | ||
33 | #define ADV7183_COMPOSITE9 9 /* CVBS in on AIN10 */ | ||
34 | #define ADV7183_COMPOSITE10 10 /* CVBS in on AIN11 */ | ||
35 | |||
36 | #define ADV7183_SVIDEO0 11 /* Y on AIN1, C on AIN4 */ | ||
37 | #define ADV7183_SVIDEO1 12 /* Y on AIN2, C on AIN5 */ | ||
38 | #define ADV7183_SVIDEO2 13 /* Y on AIN3, C on AIN6 */ | ||
39 | |||
40 | #define ADV7183_COMPONENT0 14 /* Y on AIN1, Pr on AIN4, Pb on AIN5 */ | ||
41 | #define ADV7183_COMPONENT1 15 /* Y on AIN2, Pr on AIN3, Pb on AIN6 */ | ||
42 | |||
43 | /* ADV7183 HW outputs */ | ||
44 | #define ADV7183_8BIT_OUT 0 | ||
45 | #define ADV7183_16BIT_OUT 1 | ||
46 | |||
47 | #endif | ||
diff --git a/include/media/blackfin/bfin_capture.h b/include/media/blackfin/bfin_capture.h new file mode 100644 index 000000000000..2038a8a3f8aa --- /dev/null +++ b/include/media/blackfin/bfin_capture.h | |||
@@ -0,0 +1,37 @@ | |||
1 | #ifndef _BFIN_CAPTURE_H_ | ||
2 | #define _BFIN_CAPTURE_H_ | ||
3 | |||
4 | #include <linux/i2c.h> | ||
5 | |||
6 | struct v4l2_input; | ||
7 | struct ppi_info; | ||
8 | |||
9 | struct bcap_route { | ||
10 | u32 input; | ||
11 | u32 output; | ||
12 | }; | ||
13 | |||
14 | struct bfin_capture_config { | ||
15 | /* card name */ | ||
16 | char *card_name; | ||
17 | /* inputs available at the sub device */ | ||
18 | struct v4l2_input *inputs; | ||
19 | /* number of inputs supported */ | ||
20 | int num_inputs; | ||
21 | /* routing information for each input */ | ||
22 | struct bcap_route *routes; | ||
23 | /* i2c bus adapter no */ | ||
24 | int i2c_adapter_id; | ||
25 | /* i2c subdevice board info */ | ||
26 | struct i2c_board_info board_info; | ||
27 | /* ppi board info */ | ||
28 | const struct ppi_info *ppi_info; | ||
29 | /* ppi control */ | ||
30 | unsigned long ppi_control; | ||
31 | /* ppi interrupt mask */ | ||
32 | u32 int_mask; | ||
33 | /* horizontal blanking clocks */ | ||
34 | int blank_clocks; | ||
35 | }; | ||
36 | |||
37 | #endif | ||
diff --git a/include/media/blackfin/ppi.h b/include/media/blackfin/ppi.h new file mode 100644 index 000000000000..8f72f8a0b3d0 --- /dev/null +++ b/include/media/blackfin/ppi.h | |||
@@ -0,0 +1,74 @@ | |||
1 | /* | ||
2 | * Analog Devices PPI header file | ||
3 | * | ||
4 | * Copyright (c) 2011 Analog Devices Inc. | ||
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, write to the Free Software | ||
17 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
18 | */ | ||
19 | |||
20 | #ifndef _PPI_H_ | ||
21 | #define _PPI_H_ | ||
22 | |||
23 | #include <linux/interrupt.h> | ||
24 | |||
25 | #ifdef EPPI_EN | ||
26 | #define PORT_EN EPPI_EN | ||
27 | #define DMA32 0 | ||
28 | #define PACK_EN PACKEN | ||
29 | #endif | ||
30 | |||
31 | struct ppi_if; | ||
32 | |||
33 | struct ppi_params { | ||
34 | int width; | ||
35 | int height; | ||
36 | int bpp; | ||
37 | unsigned long ppi_control; | ||
38 | u32 int_mask; | ||
39 | int blank_clocks; | ||
40 | }; | ||
41 | |||
42 | struct ppi_ops { | ||
43 | int (*attach_irq)(struct ppi_if *ppi, irq_handler_t handler); | ||
44 | void (*detach_irq)(struct ppi_if *ppi); | ||
45 | int (*start)(struct ppi_if *ppi); | ||
46 | int (*stop)(struct ppi_if *ppi); | ||
47 | int (*set_params)(struct ppi_if *ppi, struct ppi_params *params); | ||
48 | void (*update_addr)(struct ppi_if *ppi, unsigned long addr); | ||
49 | }; | ||
50 | |||
51 | enum ppi_type { | ||
52 | PPI_TYPE_PPI, | ||
53 | PPI_TYPE_EPPI, | ||
54 | }; | ||
55 | |||
56 | struct ppi_info { | ||
57 | enum ppi_type type; | ||
58 | int dma_ch; | ||
59 | int irq_err; | ||
60 | void __iomem *base; | ||
61 | const unsigned short *pin_req; | ||
62 | }; | ||
63 | |||
64 | struct ppi_if { | ||
65 | unsigned long ppi_control; | ||
66 | const struct ppi_ops *ops; | ||
67 | const struct ppi_info *info; | ||
68 | bool err_int; | ||
69 | void *priv; | ||
70 | }; | ||
71 | |||
72 | struct ppi_if *ppi_create_instance(const struct ppi_info *info); | ||
73 | void ppi_delete_instance(struct ppi_if *ppi); | ||
74 | #endif | ||
diff --git a/include/media/davinci/vpif_types.h b/include/media/davinci/vpif_types.h index 9929b05cff3a..bd8217c2577c 100644 --- a/include/media/davinci/vpif_types.h +++ b/include/media/davinci/vpif_types.h | |||
@@ -17,6 +17,8 @@ | |||
17 | #ifndef _VPIF_TYPES_H | 17 | #ifndef _VPIF_TYPES_H |
18 | #define _VPIF_TYPES_H | 18 | #define _VPIF_TYPES_H |
19 | 19 | ||
20 | #include <linux/i2c.h> | ||
21 | |||
20 | #define VPIF_CAPTURE_MAX_CHANNELS 2 | 22 | #define VPIF_CAPTURE_MAX_CHANNELS 2 |
21 | 23 | ||
22 | enum vpif_if_type { | 24 | enum vpif_if_type { |
diff --git a/include/media/gpio-ir-recv.h b/include/media/gpio-ir-recv.h new file mode 100644 index 000000000000..67797bf5d432 --- /dev/null +++ b/include/media/gpio-ir-recv.h | |||
@@ -0,0 +1,22 @@ | |||
1 | /* Copyright (c) 2012, Code Aurora Forum. All rights reserved. | ||
2 | * | ||
3 | * This program is free software; you can redistribute it and/or modify | ||
4 | * it under the terms of the GNU General Public License version 2 and | ||
5 | * only version 2 as published by the Free Software Foundation. | ||
6 | * | ||
7 | * This program is distributed in the hope that it will be useful, | ||
8 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
9 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
10 | * GNU General Public License for more details. | ||
11 | */ | ||
12 | |||
13 | #ifndef __GPIO_IR_RECV_H__ | ||
14 | #define __GPIO_IR_RECV_H__ | ||
15 | |||
16 | struct gpio_ir_recv_platform_data { | ||
17 | int gpio_nr; | ||
18 | bool active_low; | ||
19 | }; | ||
20 | |||
21 | #endif /* __GPIO_IR_RECV_H__ */ | ||
22 | |||
diff --git a/include/media/media-device.h b/include/media/media-device.h index 6a27d916c250..eaade9815bb6 100644 --- a/include/media/media-device.h +++ b/include/media/media-device.h | |||
@@ -23,7 +23,6 @@ | |||
23 | #ifndef _MEDIA_DEVICE_H | 23 | #ifndef _MEDIA_DEVICE_H |
24 | #define _MEDIA_DEVICE_H | 24 | #define _MEDIA_DEVICE_H |
25 | 25 | ||
26 | #include <linux/device.h> | ||
27 | #include <linux/list.h> | 26 | #include <linux/list.h> |
28 | #include <linux/mutex.h> | 27 | #include <linux/mutex.h> |
29 | #include <linux/spinlock.h> | 28 | #include <linux/spinlock.h> |
@@ -31,6 +30,8 @@ | |||
31 | #include <media/media-devnode.h> | 30 | #include <media/media-devnode.h> |
32 | #include <media/media-entity.h> | 31 | #include <media/media-entity.h> |
33 | 32 | ||
33 | struct device; | ||
34 | |||
34 | /** | 35 | /** |
35 | * struct media_device - Media device | 36 | * struct media_device - Media device |
36 | * @dev: Parent device | 37 | * @dev: Parent device |
diff --git a/include/media/mt9m032.h b/include/media/mt9m032.h new file mode 100644 index 000000000000..c3a78114d7a6 --- /dev/null +++ b/include/media/mt9m032.h | |||
@@ -0,0 +1,36 @@ | |||
1 | /* | ||
2 | * Driver for MT9M032 CMOS Image Sensor from Micron | ||
3 | * | ||
4 | * Copyright (C) 2010-2011 Lund Engineering | ||
5 | * Contact: Gil Lund <gwlund@lundeng.com> | ||
6 | * Author: Martin Hostettler <martin@neutronstar.dyndns.org> | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or | ||
9 | * modify it under the terms of the GNU General Public License | ||
10 | * version 2 as published by the Free Software Foundation. | ||
11 | * | ||
12 | * This program is distributed in the hope that it will be useful, 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 | * You should have received a copy of the GNU General Public License | ||
18 | * along with this program; if not, write to the Free Software | ||
19 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA | ||
20 | * 02110-1301 USA | ||
21 | * | ||
22 | */ | ||
23 | |||
24 | #ifndef MT9M032_H | ||
25 | #define MT9M032_H | ||
26 | |||
27 | #define MT9M032_NAME "mt9m032" | ||
28 | #define MT9M032_I2C_ADDR (0xb8 >> 1) | ||
29 | |||
30 | struct mt9m032_platform_data { | ||
31 | u32 ext_clock; | ||
32 | u32 pix_clock; | ||
33 | bool invert_pixclock; | ||
34 | |||
35 | }; | ||
36 | #endif /* MT9M032_H */ | ||
diff --git a/include/media/rc-map.h b/include/media/rc-map.h index f688bde61228..8db6741c1256 100644 --- a/include/media/rc-map.h +++ b/include/media/rc-map.h | |||
@@ -102,8 +102,11 @@ void rc_map_init(void); | |||
102 | #define RC_MAP_IMON_MCE "rc-imon-mce" | 102 | #define RC_MAP_IMON_MCE "rc-imon-mce" |
103 | #define RC_MAP_IMON_PAD "rc-imon-pad" | 103 | #define RC_MAP_IMON_PAD "rc-imon-pad" |
104 | #define RC_MAP_IODATA_BCTV7E "rc-iodata-bctv7e" | 104 | #define RC_MAP_IODATA_BCTV7E "rc-iodata-bctv7e" |
105 | #define RC_MAP_IT913X_V1 "rc-it913x-v1" | ||
106 | #define RC_MAP_IT913X_V2 "rc-it913x-v2" | ||
105 | #define RC_MAP_KAIOMY "rc-kaiomy" | 107 | #define RC_MAP_KAIOMY "rc-kaiomy" |
106 | #define RC_MAP_KWORLD_315U "rc-kworld-315u" | 108 | #define RC_MAP_KWORLD_315U "rc-kworld-315u" |
109 | #define RC_MAP_KWORLD_PC150U "rc-kworld-pc150u" | ||
107 | #define RC_MAP_KWORLD_PLUS_TV_ANALOG "rc-kworld-plus-tv-analog" | 110 | #define RC_MAP_KWORLD_PLUS_TV_ANALOG "rc-kworld-plus-tv-analog" |
108 | #define RC_MAP_LEADTEK_Y04G0051 "rc-leadtek-y04g0051" | 111 | #define RC_MAP_LEADTEK_Y04G0051 "rc-leadtek-y04g0051" |
109 | #define RC_MAP_LIRC "rc-lirc" | 112 | #define RC_MAP_LIRC "rc-lirc" |
diff --git a/include/media/s5p_hdmi.h b/include/media/s5p_hdmi.h new file mode 100644 index 000000000000..361a751f73af --- /dev/null +++ b/include/media/s5p_hdmi.h | |||
@@ -0,0 +1,35 @@ | |||
1 | /* | ||
2 | * Driver header for S5P HDMI chip. | ||
3 | * | ||
4 | * Copyright (c) 2011 Samsung Electronics, Co. Ltd | ||
5 | * Contact: Tomasz Stanislawski <t.stanislaws@samsung.com> | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License as published by | ||
9 | * the Free Software Foundation; either version 2 of the License, or | ||
10 | * (at your option) any later version. | ||
11 | */ | ||
12 | |||
13 | #ifndef S5P_HDMI_H | ||
14 | #define S5P_HDMI_H | ||
15 | |||
16 | struct i2c_board_info; | ||
17 | |||
18 | /** | ||
19 | * @hdmiphy_bus: controller id for HDMIPHY bus | ||
20 | * @hdmiphy_info: template for HDMIPHY I2C device | ||
21 | * @mhl_bus: controller id for MHL control bus | ||
22 | * @mhl_info: template for MHL I2C device | ||
23 | * | ||
24 | * NULL pointer for *_info fields indicates that | ||
25 | * the corresponding chip is not present | ||
26 | */ | ||
27 | struct s5p_hdmi_platform_data { | ||
28 | int hdmiphy_bus; | ||
29 | struct i2c_board_info *hdmiphy_info; | ||
30 | int mhl_bus; | ||
31 | struct i2c_board_info *mhl_info; | ||
32 | }; | ||
33 | |||
34 | #endif /* S5P_HDMI_H */ | ||
35 | |||
diff --git a/include/media/sh_mobile_ceu.h b/include/media/sh_mobile_ceu.h index 48413b410f15..a90a765f18da 100644 --- a/include/media/sh_mobile_ceu.h +++ b/include/media/sh_mobile_ceu.h | |||
@@ -18,6 +18,8 @@ struct sh_mobile_ceu_companion { | |||
18 | 18 | ||
19 | struct sh_mobile_ceu_info { | 19 | struct sh_mobile_ceu_info { |
20 | unsigned long flags; | 20 | unsigned long flags; |
21 | int max_width; | ||
22 | int max_height; | ||
21 | struct sh_mobile_ceu_companion *csi2; | 23 | struct sh_mobile_ceu_companion *csi2; |
22 | }; | 24 | }; |
23 | 25 | ||
diff --git a/include/media/sii9234.h b/include/media/sii9234.h new file mode 100644 index 000000000000..6a4a809fe9a3 --- /dev/null +++ b/include/media/sii9234.h | |||
@@ -0,0 +1,24 @@ | |||
1 | /* | ||
2 | * Driver header for SII9234 MHL converter chip. | ||
3 | * | ||
4 | * Copyright (c) 2011 Samsung Electronics, Co. Ltd | ||
5 | * Contact: Tomasz Stanislawski <t.stanislaws@samsung.com> | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License as published by | ||
9 | * the Free Software Foundation; either version 2 of the License, or | ||
10 | * (at your option) any later version. | ||
11 | */ | ||
12 | |||
13 | #ifndef SII9234_H | ||
14 | #define SII9234_H | ||
15 | |||
16 | /** | ||
17 | * @gpio_n_reset: GPIO driving nRESET pin | ||
18 | */ | ||
19 | |||
20 | struct sii9234_platform_data { | ||
21 | int gpio_n_reset; | ||
22 | }; | ||
23 | |||
24 | #endif /* SII9234_H */ | ||
diff --git a/include/media/tuner.h b/include/media/tuner.h index 29e1920e7339..926aff9bdf65 100644 --- a/include/media/tuner.h +++ b/include/media/tuner.h | |||
@@ -136,6 +136,7 @@ | |||
136 | #define TUNER_TENA_TNF_5337 86 | 136 | #define TUNER_TENA_TNF_5337 86 |
137 | 137 | ||
138 | #define TUNER_XC4000 87 /* Xceive Silicon Tuner */ | 138 | #define TUNER_XC4000 87 /* Xceive Silicon Tuner */ |
139 | #define TUNER_XC5000C 88 /* Xceive Silicon Tuner */ | ||
139 | 140 | ||
140 | /* tv card specific */ | 141 | /* tv card specific */ |
141 | #define TDA9887_PRESENT (1<<0) | 142 | #define TDA9887_PRESENT (1<<0) |
diff --git a/include/media/v4l2-chip-ident.h b/include/media/v4l2-chip-ident.h index 810a20928a21..7395c815939d 100644 --- a/include/media/v4l2-chip-ident.h +++ b/include/media/v4l2-chip-ident.h | |||
@@ -143,6 +143,9 @@ enum { | |||
143 | /* module saa6588: just ident 6588 */ | 143 | /* module saa6588: just ident 6588 */ |
144 | V4L2_IDENT_SAA6588 = 6588, | 144 | V4L2_IDENT_SAA6588 = 6588, |
145 | 145 | ||
146 | /* module vs6624: just ident 6624 */ | ||
147 | V4L2_IDENT_VS6624 = 6624, | ||
148 | |||
146 | /* module saa6752hs: reserved range 6750-6759 */ | 149 | /* module saa6752hs: reserved range 6750-6759 */ |
147 | V4L2_IDENT_SAA6752HS = 6752, | 150 | V4L2_IDENT_SAA6752HS = 6752, |
148 | V4L2_IDENT_SAA6752HS_AC3 = 6753, | 151 | V4L2_IDENT_SAA6752HS_AC3 = 6753, |
@@ -162,6 +165,9 @@ enum { | |||
162 | /* module adv7180: just ident 7180 */ | 165 | /* module adv7180: just ident 7180 */ |
163 | V4L2_IDENT_ADV7180 = 7180, | 166 | V4L2_IDENT_ADV7180 = 7180, |
164 | 167 | ||
168 | /* module adv7183: just ident 7183 */ | ||
169 | V4L2_IDENT_ADV7183 = 7183, | ||
170 | |||
165 | /* module saa7185: just ident 7185 */ | 171 | /* module saa7185: just ident 7185 */ |
166 | V4L2_IDENT_SAA7185 = 7185, | 172 | V4L2_IDENT_SAA7185 = 7185, |
167 | 173 | ||
diff --git a/include/media/v4l2-ctrls.h b/include/media/v4l2-ctrls.h index eeb3df637144..11e67562b3ac 100644 --- a/include/media/v4l2-ctrls.h +++ b/include/media/v4l2-ctrls.h | |||
@@ -22,7 +22,6 @@ | |||
22 | #define _V4L2_CTRLS_H | 22 | #define _V4L2_CTRLS_H |
23 | 23 | ||
24 | #include <linux/list.h> | 24 | #include <linux/list.h> |
25 | #include <linux/device.h> | ||
26 | #include <linux/videodev2.h> | 25 | #include <linux/videodev2.h> |
27 | 26 | ||
28 | /* forward references */ | 27 | /* forward references */ |
@@ -33,6 +32,7 @@ struct video_device; | |||
33 | struct v4l2_subdev; | 32 | struct v4l2_subdev; |
34 | struct v4l2_subscribed_event; | 33 | struct v4l2_subscribed_event; |
35 | struct v4l2_fh; | 34 | struct v4l2_fh; |
35 | struct poll_table_struct; | ||
36 | 36 | ||
37 | /** struct v4l2_ctrl_ops - The control operations that the driver has to provide. | 37 | /** struct v4l2_ctrl_ops - The control operations that the driver has to provide. |
38 | * @g_volatile_ctrl: Get a new value for this control. Generally only relevant | 38 | * @g_volatile_ctrl: Get a new value for this control. Generally only relevant |
@@ -492,6 +492,18 @@ void v4l2_ctrl_add_event(struct v4l2_ctrl *ctrl, | |||
492 | void v4l2_ctrl_del_event(struct v4l2_ctrl *ctrl, | 492 | void v4l2_ctrl_del_event(struct v4l2_ctrl *ctrl, |
493 | struct v4l2_subscribed_event *sev); | 493 | struct v4l2_subscribed_event *sev); |
494 | 494 | ||
495 | /* Can be used as a vidioc_log_status function that just dumps all controls | ||
496 | associated with the filehandle. */ | ||
497 | int v4l2_ctrl_log_status(struct file *file, void *fh); | ||
498 | |||
499 | /* Can be used as a vidioc_subscribe_event function that just subscribes | ||
500 | control events. */ | ||
501 | int v4l2_ctrl_subscribe_event(struct v4l2_fh *fh, | ||
502 | struct v4l2_event_subscription *sub); | ||
503 | |||
504 | /* Can be used as a poll function that just polls for control events. */ | ||
505 | unsigned int v4l2_ctrl_poll(struct file *file, struct poll_table_struct *wait); | ||
506 | |||
495 | /* Helpers for ioctl_ops. If hdl == NULL then they will all return -EINVAL. */ | 507 | /* Helpers for ioctl_ops. If hdl == NULL then they will all return -EINVAL. */ |
496 | int v4l2_queryctrl(struct v4l2_ctrl_handler *hdl, struct v4l2_queryctrl *qc); | 508 | int v4l2_queryctrl(struct v4l2_ctrl_handler *hdl, struct v4l2_queryctrl *qc); |
497 | int v4l2_querymenu(struct v4l2_ctrl_handler *hdl, struct v4l2_querymenu *qm); | 509 | int v4l2_querymenu(struct v4l2_ctrl_handler *hdl, struct v4l2_querymenu *qm); |
diff --git a/include/media/v4l2-dev.h b/include/media/v4l2-dev.h index c7c40f1d2624..96d22215cc88 100644 --- a/include/media/v4l2-dev.h +++ b/include/media/v4l2-dev.h | |||
@@ -62,6 +62,9 @@ struct v4l2_file_operations { | |||
62 | unsigned int (*poll) (struct file *, struct poll_table_struct *); | 62 | unsigned int (*poll) (struct file *, struct poll_table_struct *); |
63 | long (*ioctl) (struct file *, unsigned int, unsigned long); | 63 | long (*ioctl) (struct file *, unsigned int, unsigned long); |
64 | long (*unlocked_ioctl) (struct file *, unsigned int, unsigned long); | 64 | long (*unlocked_ioctl) (struct file *, unsigned int, unsigned long); |
65 | #ifdef CONFIG_COMPAT | ||
66 | long (*compat_ioctl32) (struct file *, unsigned int, unsigned long); | ||
67 | #endif | ||
65 | unsigned long (*get_unmapped_area) (struct file *, unsigned long, | 68 | unsigned long (*get_unmapped_area) (struct file *, unsigned long, |
66 | unsigned long, unsigned long, unsigned long); | 69 | unsigned long, unsigned long, unsigned long); |
67 | int (*mmap) (struct file *, struct vm_area_struct *); | 70 | int (*mmap) (struct file *, struct vm_area_struct *); |
diff --git a/include/media/v4l2-ioctl.h b/include/media/v4l2-ioctl.h index 3f5d60fc5df6..3cb939cd03f9 100644 --- a/include/media/v4l2-ioctl.h +++ b/include/media/v4l2-ioctl.h | |||
@@ -11,7 +11,6 @@ | |||
11 | 11 | ||
12 | #include <linux/poll.h> | 12 | #include <linux/poll.h> |
13 | #include <linux/fs.h> | 13 | #include <linux/fs.h> |
14 | #include <linux/device.h> | ||
15 | #include <linux/mutex.h> | 14 | #include <linux/mutex.h> |
16 | #include <linux/compiler.h> /* need __user */ | 15 | #include <linux/compiler.h> /* need __user */ |
17 | #include <linux/videodev2.h> | 16 | #include <linux/videodev2.h> |
@@ -211,6 +210,10 @@ struct v4l2_ioctl_ops { | |||
211 | struct v4l2_encoder_cmd *a); | 210 | struct v4l2_encoder_cmd *a); |
212 | int (*vidioc_try_encoder_cmd) (struct file *file, void *fh, | 211 | int (*vidioc_try_encoder_cmd) (struct file *file, void *fh, |
213 | struct v4l2_encoder_cmd *a); | 212 | struct v4l2_encoder_cmd *a); |
213 | int (*vidioc_decoder_cmd) (struct file *file, void *fh, | ||
214 | struct v4l2_decoder_cmd *a); | ||
215 | int (*vidioc_try_decoder_cmd) (struct file *file, void *fh, | ||
216 | struct v4l2_decoder_cmd *a); | ||
214 | 217 | ||
215 | /* Stream type-dependent parameter ioctls */ | 218 | /* Stream type-dependent parameter ioctls */ |
216 | int (*vidioc_g_parm) (struct file *file, void *fh, | 219 | int (*vidioc_g_parm) (struct file *file, void *fh, |
diff --git a/include/net/addrconf.h b/include/net/addrconf.h index f68dce2d8d88..757a17638b1b 100644 --- a/include/net/addrconf.h +++ b/include/net/addrconf.h | |||
@@ -160,7 +160,6 @@ extern void addrconf_prefix_rcv(struct net_device *dev, | |||
160 | extern int ipv6_sock_ac_join(struct sock *sk,int ifindex, const struct in6_addr *addr); | 160 | extern int ipv6_sock_ac_join(struct sock *sk,int ifindex, const struct in6_addr *addr); |
161 | extern int ipv6_sock_ac_drop(struct sock *sk,int ifindex, const struct in6_addr *addr); | 161 | extern int ipv6_sock_ac_drop(struct sock *sk,int ifindex, const struct in6_addr *addr); |
162 | extern void ipv6_sock_ac_close(struct sock *sk); | 162 | extern void ipv6_sock_ac_close(struct sock *sk); |
163 | extern int inet6_ac_check(struct sock *sk, const struct in6_addr *addr, int ifindex); | ||
164 | 163 | ||
165 | extern int ipv6_dev_ac_inc(struct net_device *dev, const struct in6_addr *addr); | 164 | extern int ipv6_dev_ac_inc(struct net_device *dev, const struct in6_addr *addr); |
166 | extern int __ipv6_dev_ac_dec(struct inet6_dev *idev, const struct in6_addr *addr); | 165 | extern int __ipv6_dev_ac_dec(struct inet6_dev *idev, const struct in6_addr *addr); |
diff --git a/include/net/af_unix.h b/include/net/af_unix.h index 5a4e29b168c9..ca68e2cef230 100644 --- a/include/net/af_unix.h +++ b/include/net/af_unix.h | |||
@@ -49,8 +49,7 @@ struct unix_sock { | |||
49 | /* WARNING: sk has to be the first member */ | 49 | /* WARNING: sk has to be the first member */ |
50 | struct sock sk; | 50 | struct sock sk; |
51 | struct unix_address *addr; | 51 | struct unix_address *addr; |
52 | struct dentry *dentry; | 52 | struct path path; |
53 | struct vfsmount *mnt; | ||
54 | struct mutex readlock; | 53 | struct mutex readlock; |
55 | struct sock *peer; | 54 | struct sock *peer; |
56 | struct sock *other; | 55 | struct sock *other; |
diff --git a/include/net/arp.h b/include/net/arp.h index 0013dc87940b..4a1f3fb562eb 100644 --- a/include/net/arp.h +++ b/include/net/arp.h | |||
@@ -15,14 +15,14 @@ static inline u32 arp_hashfn(u32 key, const struct net_device *dev, u32 hash_rnd | |||
15 | return val * hash_rnd; | 15 | return val * hash_rnd; |
16 | } | 16 | } |
17 | 17 | ||
18 | static inline struct neighbour *__ipv4_neigh_lookup(struct neigh_table *tbl, struct net_device *dev, u32 key) | 18 | static inline struct neighbour *__ipv4_neigh_lookup(struct net_device *dev, u32 key) |
19 | { | 19 | { |
20 | struct neigh_hash_table *nht; | 20 | struct neigh_hash_table *nht; |
21 | struct neighbour *n; | 21 | struct neighbour *n; |
22 | u32 hash_val; | 22 | u32 hash_val; |
23 | 23 | ||
24 | rcu_read_lock_bh(); | 24 | rcu_read_lock_bh(); |
25 | nht = rcu_dereference_bh(tbl->nht); | 25 | nht = rcu_dereference_bh(arp_tbl.nht); |
26 | hash_val = arp_hashfn(key, dev, nht->hash_rnd[0]) >> (32 - nht->hash_shift); | 26 | hash_val = arp_hashfn(key, dev, nht->hash_rnd[0]) >> (32 - nht->hash_shift); |
27 | for (n = rcu_dereference_bh(nht->hash_buckets[hash_val]); | 27 | for (n = rcu_dereference_bh(nht->hash_buckets[hash_val]); |
28 | n != NULL; | 28 | n != NULL; |
diff --git a/include/net/bluetooth/bluetooth.h b/include/net/bluetooth/bluetooth.h index 4a82ca0bb0b2..262ebd1747d4 100644 --- a/include/net/bluetooth/bluetooth.h +++ b/include/net/bluetooth/bluetooth.h | |||
@@ -109,12 +109,14 @@ struct bt_power { | |||
109 | */ | 109 | */ |
110 | #define BT_CHANNEL_POLICY_AMP_PREFERRED 2 | 110 | #define BT_CHANNEL_POLICY_AMP_PREFERRED 2 |
111 | 111 | ||
112 | __printf(2, 3) | 112 | __printf(1, 2) |
113 | int bt_printk(const char *level, const char *fmt, ...); | 113 | int bt_info(const char *fmt, ...); |
114 | __printf(1, 2) | ||
115 | int bt_err(const char *fmt, ...); | ||
114 | 116 | ||
115 | #define BT_INFO(fmt, arg...) bt_printk(KERN_INFO, pr_fmt(fmt), ##arg) | 117 | #define BT_INFO(fmt, ...) bt_info(fmt "\n", ##__VA_ARGS__) |
116 | #define BT_ERR(fmt, arg...) bt_printk(KERN_ERR, pr_fmt(fmt), ##arg) | 118 | #define BT_ERR(fmt, ...) bt_err(fmt "\n", ##__VA_ARGS__) |
117 | #define BT_DBG(fmt, arg...) pr_debug(fmt "\n", ##arg) | 119 | #define BT_DBG(fmt, ...) pr_debug(fmt "\n", ##__VA_ARGS__) |
118 | 120 | ||
119 | /* Connection and socket states */ | 121 | /* Connection and socket states */ |
120 | enum { | 122 | enum { |
@@ -129,6 +131,33 @@ enum { | |||
129 | BT_CLOSED | 131 | BT_CLOSED |
130 | }; | 132 | }; |
131 | 133 | ||
134 | /* If unused will be removed by compiler */ | ||
135 | static inline const char *state_to_string(int state) | ||
136 | { | ||
137 | switch (state) { | ||
138 | case BT_CONNECTED: | ||
139 | return "BT_CONNECTED"; | ||
140 | case BT_OPEN: | ||
141 | return "BT_OPEN"; | ||
142 | case BT_BOUND: | ||
143 | return "BT_BOUND"; | ||
144 | case BT_LISTEN: | ||
145 | return "BT_LISTEN"; | ||
146 | case BT_CONNECT: | ||
147 | return "BT_CONNECT"; | ||
148 | case BT_CONNECT2: | ||
149 | return "BT_CONNECT2"; | ||
150 | case BT_CONFIG: | ||
151 | return "BT_CONFIG"; | ||
152 | case BT_DISCONN: | ||
153 | return "BT_DISCONN"; | ||
154 | case BT_CLOSED: | ||
155 | return "BT_CLOSED"; | ||
156 | } | ||
157 | |||
158 | return "invalid state"; | ||
159 | } | ||
160 | |||
132 | /* BD Address */ | 161 | /* BD Address */ |
133 | typedef struct { | 162 | typedef struct { |
134 | __u8 b[6]; | 163 | __u8 b[6]; |
@@ -193,7 +222,6 @@ struct bt_skb_cb { | |||
193 | __u16 tx_seq; | 222 | __u16 tx_seq; |
194 | __u8 retries; | 223 | __u8 retries; |
195 | __u8 sar; | 224 | __u8 sar; |
196 | unsigned short channel; | ||
197 | __u8 force_active; | 225 | __u8 force_active; |
198 | }; | 226 | }; |
199 | #define bt_cb(skb) ((struct bt_skb_cb *)((skb)->cb)) | 227 | #define bt_cb(skb) ((struct bt_skb_cb *)((skb)->cb)) |
diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h index 00596e816b4d..d47e523c9d83 100644 --- a/include/net/bluetooth/hci.h +++ b/include/net/bluetooth/hci.h | |||
@@ -77,14 +77,6 @@ enum { | |||
77 | 77 | ||
78 | HCI_RAW, | 78 | HCI_RAW, |
79 | 79 | ||
80 | HCI_SETUP, | ||
81 | HCI_AUTO_OFF, | ||
82 | HCI_MGMT, | ||
83 | HCI_PAIRABLE, | ||
84 | HCI_SERVICE_CACHE, | ||
85 | HCI_LINK_KEYS, | ||
86 | HCI_DEBUG_KEYS, | ||
87 | |||
88 | HCI_RESET, | 80 | HCI_RESET, |
89 | }; | 81 | }; |
90 | 82 | ||
@@ -93,7 +85,23 @@ enum { | |||
93 | * states from the controller. | 85 | * states from the controller. |
94 | */ | 86 | */ |
95 | enum { | 87 | enum { |
88 | HCI_SETUP, | ||
89 | HCI_AUTO_OFF, | ||
90 | HCI_MGMT, | ||
91 | HCI_PAIRABLE, | ||
92 | HCI_SERVICE_CACHE, | ||
93 | HCI_LINK_KEYS, | ||
94 | HCI_DEBUG_KEYS, | ||
95 | HCI_UNREGISTER, | ||
96 | |||
96 | HCI_LE_SCAN, | 97 | HCI_LE_SCAN, |
98 | HCI_SSP_ENABLED, | ||
99 | HCI_HS_ENABLED, | ||
100 | HCI_LE_ENABLED, | ||
101 | HCI_CONNECTABLE, | ||
102 | HCI_DISCOVERABLE, | ||
103 | HCI_LINK_SECURITY, | ||
104 | HCI_PENDING_CLASS, | ||
97 | }; | 105 | }; |
98 | 106 | ||
99 | /* HCI ioctl defines */ | 107 | /* HCI ioctl defines */ |
@@ -130,6 +138,7 @@ enum { | |||
130 | #define HCI_IDLE_TIMEOUT (6000) /* 6 seconds */ | 138 | #define HCI_IDLE_TIMEOUT (6000) /* 6 seconds */ |
131 | #define HCI_INIT_TIMEOUT (10000) /* 10 seconds */ | 139 | #define HCI_INIT_TIMEOUT (10000) /* 10 seconds */ |
132 | #define HCI_CMD_TIMEOUT (1000) /* 1 seconds */ | 140 | #define HCI_CMD_TIMEOUT (1000) /* 1 seconds */ |
141 | #define HCI_ACL_TX_TIMEOUT (45000) /* 45 seconds */ | ||
133 | 142 | ||
134 | /* HCI data types */ | 143 | /* HCI data types */ |
135 | #define HCI_COMMAND_PKT 0x01 | 144 | #define HCI_COMMAND_PKT 0x01 |
@@ -229,7 +238,9 @@ enum { | |||
229 | #define LMP_EXTFEATURES 0x80 | 238 | #define LMP_EXTFEATURES 0x80 |
230 | 239 | ||
231 | /* Extended LMP features */ | 240 | /* Extended LMP features */ |
232 | #define LMP_HOST_LE 0x02 | 241 | #define LMP_HOST_SSP 0x01 |
242 | #define LMP_HOST_LE 0x02 | ||
243 | #define LMP_HOST_LE_BREDR 0x04 | ||
233 | 244 | ||
234 | /* Connection modes */ | 245 | /* Connection modes */ |
235 | #define HCI_CM_ACTIVE 0x0000 | 246 | #define HCI_CM_ACTIVE 0x0000 |
@@ -268,10 +279,11 @@ enum { | |||
268 | #define HCI_LK_UNAUTH_COMBINATION 0x04 | 279 | #define HCI_LK_UNAUTH_COMBINATION 0x04 |
269 | #define HCI_LK_AUTH_COMBINATION 0x05 | 280 | #define HCI_LK_AUTH_COMBINATION 0x05 |
270 | #define HCI_LK_CHANGED_COMBINATION 0x06 | 281 | #define HCI_LK_CHANGED_COMBINATION 0x06 |
271 | /* The spec doesn't define types for SMP keys */ | 282 | /* The spec doesn't define types for SMP keys, the _MASTER suffix is implied */ |
272 | #define HCI_LK_SMP_LTK 0x81 | 283 | #define HCI_SMP_STK 0x80 |
273 | #define HCI_LK_SMP_IRK 0x82 | 284 | #define HCI_SMP_STK_SLAVE 0x81 |
274 | #define HCI_LK_SMP_CSRK 0x83 | 285 | #define HCI_SMP_LTK 0x82 |
286 | #define HCI_SMP_LTK_SLAVE 0x83 | ||
275 | 287 | ||
276 | /* ---- HCI Error Codes ---- */ | 288 | /* ---- HCI Error Codes ---- */ |
277 | #define HCI_ERROR_AUTH_FAILURE 0x05 | 289 | #define HCI_ERROR_AUTH_FAILURE 0x05 |
@@ -284,6 +296,22 @@ enum { | |||
284 | #define HCI_FLOW_CTL_MODE_PACKET_BASED 0x00 | 296 | #define HCI_FLOW_CTL_MODE_PACKET_BASED 0x00 |
285 | #define HCI_FLOW_CTL_MODE_BLOCK_BASED 0x01 | 297 | #define HCI_FLOW_CTL_MODE_BLOCK_BASED 0x01 |
286 | 298 | ||
299 | /* Extended Inquiry Response field types */ | ||
300 | #define EIR_FLAGS 0x01 /* flags */ | ||
301 | #define EIR_UUID16_SOME 0x02 /* 16-bit UUID, more available */ | ||
302 | #define EIR_UUID16_ALL 0x03 /* 16-bit UUID, all listed */ | ||
303 | #define EIR_UUID32_SOME 0x04 /* 32-bit UUID, more available */ | ||
304 | #define EIR_UUID32_ALL 0x05 /* 32-bit UUID, all listed */ | ||
305 | #define EIR_UUID128_SOME 0x06 /* 128-bit UUID, more available */ | ||
306 | #define EIR_UUID128_ALL 0x07 /* 128-bit UUID, all listed */ | ||
307 | #define EIR_NAME_SHORT 0x08 /* shortened local name */ | ||
308 | #define EIR_NAME_COMPLETE 0x09 /* complete local name */ | ||
309 | #define EIR_TX_POWER 0x0A /* transmit power level */ | ||
310 | #define EIR_CLASS_OF_DEV 0x0D /* Class of Device */ | ||
311 | #define EIR_SSP_HASH_C 0x0E /* Simple Pairing Hash C */ | ||
312 | #define EIR_SSP_RAND_R 0x0F /* Simple Pairing Randomizer R */ | ||
313 | #define EIR_DEVICE_ID 0x10 /* device ID */ | ||
314 | |||
287 | /* ----- HCI Commands ---- */ | 315 | /* ----- HCI Commands ---- */ |
288 | #define HCI_OP_NOP 0x0000 | 316 | #define HCI_OP_NOP 0x0000 |
289 | 317 | ||
@@ -666,8 +694,8 @@ struct hci_cp_host_buffer_size { | |||
666 | 694 | ||
667 | #define HCI_OP_WRITE_EIR 0x0c52 | 695 | #define HCI_OP_WRITE_EIR 0x0c52 |
668 | struct hci_cp_write_eir { | 696 | struct hci_cp_write_eir { |
669 | uint8_t fec; | 697 | __u8 fec; |
670 | uint8_t data[HCI_MAX_EIR_LENGTH]; | 698 | __u8 data[HCI_MAX_EIR_LENGTH]; |
671 | } __packed; | 699 | } __packed; |
672 | 700 | ||
673 | #define HCI_OP_READ_SSP_MODE 0x0c55 | 701 | #define HCI_OP_READ_SSP_MODE 0x0c55 |
@@ -698,8 +726,8 @@ struct hci_rp_read_flow_control_mode { | |||
698 | 726 | ||
699 | #define HCI_OP_WRITE_LE_HOST_SUPPORTED 0x0c6d | 727 | #define HCI_OP_WRITE_LE_HOST_SUPPORTED 0x0c6d |
700 | struct hci_cp_write_le_host_supported { | 728 | struct hci_cp_write_le_host_supported { |
701 | __u8 le; | 729 | __u8 le; |
702 | __u8 simul; | 730 | __u8 simul; |
703 | } __packed; | 731 | } __packed; |
704 | 732 | ||
705 | #define HCI_OP_READ_LOCAL_VERSION 0x1001 | 733 | #define HCI_OP_READ_LOCAL_VERSION 0x1001 |
@@ -1155,6 +1183,19 @@ struct hci_ev_le_meta { | |||
1155 | __u8 subevent; | 1183 | __u8 subevent; |
1156 | } __packed; | 1184 | } __packed; |
1157 | 1185 | ||
1186 | #define HCI_EV_NUM_COMP_BLOCKS 0x48 | ||
1187 | struct hci_comp_blocks_info { | ||
1188 | __le16 handle; | ||
1189 | __le16 pkts; | ||
1190 | __le16 blocks; | ||
1191 | } __packed; | ||
1192 | |||
1193 | struct hci_ev_num_comp_blocks { | ||
1194 | __le16 num_blocks; | ||
1195 | __u8 num_hndl; | ||
1196 | struct hci_comp_blocks_info handles[0]; | ||
1197 | } __packed; | ||
1198 | |||
1158 | /* Low energy meta events */ | 1199 | /* Low energy meta events */ |
1159 | #define HCI_EV_LE_CONN_COMPLETE 0x01 | 1200 | #define HCI_EV_LE_CONN_COMPLETE 0x01 |
1160 | struct hci_ev_le_conn_complete { | 1201 | struct hci_ev_le_conn_complete { |
@@ -1287,7 +1328,8 @@ struct sockaddr_hci { | |||
1287 | #define HCI_DEV_NONE 0xffff | 1328 | #define HCI_DEV_NONE 0xffff |
1288 | 1329 | ||
1289 | #define HCI_CHANNEL_RAW 0 | 1330 | #define HCI_CHANNEL_RAW 0 |
1290 | #define HCI_CHANNEL_CONTROL 1 | 1331 | #define HCI_CHANNEL_MONITOR 2 |
1332 | #define HCI_CHANNEL_CONTROL 3 | ||
1291 | 1333 | ||
1292 | struct hci_filter { | 1334 | struct hci_filter { |
1293 | unsigned long type_mask; | 1335 | unsigned long type_mask; |
@@ -1389,5 +1431,6 @@ struct hci_inquiry_req { | |||
1389 | #define IREQ_CACHE_FLUSH 0x0001 | 1431 | #define IREQ_CACHE_FLUSH 0x0001 |
1390 | 1432 | ||
1391 | extern bool enable_hs; | 1433 | extern bool enable_hs; |
1434 | extern bool enable_le; | ||
1392 | 1435 | ||
1393 | #endif /* __HCI_H */ | 1436 | #endif /* __HCI_H */ |
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h index 453893b3120e..6822d2595aff 100644 --- a/include/net/bluetooth/hci_core.h +++ b/include/net/bluetooth/hci_core.h | |||
@@ -44,14 +44,31 @@ struct inquiry_data { | |||
44 | }; | 44 | }; |
45 | 45 | ||
46 | struct inquiry_entry { | 46 | struct inquiry_entry { |
47 | struct inquiry_entry *next; | 47 | struct list_head all; /* inq_cache.all */ |
48 | struct list_head list; /* unknown or resolve */ | ||
49 | enum { | ||
50 | NAME_NOT_KNOWN, | ||
51 | NAME_NEEDED, | ||
52 | NAME_PENDING, | ||
53 | NAME_KNOWN, | ||
54 | } name_state; | ||
48 | __u32 timestamp; | 55 | __u32 timestamp; |
49 | struct inquiry_data data; | 56 | struct inquiry_data data; |
50 | }; | 57 | }; |
51 | 58 | ||
52 | struct inquiry_cache { | 59 | struct discovery_state { |
60 | int type; | ||
61 | enum { | ||
62 | DISCOVERY_STOPPED, | ||
63 | DISCOVERY_STARTING, | ||
64 | DISCOVERY_FINDING, | ||
65 | DISCOVERY_RESOLVING, | ||
66 | DISCOVERY_STOPPING, | ||
67 | } state; | ||
68 | struct list_head all; /* All devices found during inquiry */ | ||
69 | struct list_head unknown; /* Name state not known */ | ||
70 | struct list_head resolve; /* Name needs to be resolved */ | ||
53 | __u32 timestamp; | 71 | __u32 timestamp; |
54 | struct inquiry_entry *list; | ||
55 | }; | 72 | }; |
56 | 73 | ||
57 | struct hci_conn_hash { | 74 | struct hci_conn_hash { |
@@ -72,18 +89,16 @@ struct bt_uuid { | |||
72 | u8 svc_hint; | 89 | u8 svc_hint; |
73 | }; | 90 | }; |
74 | 91 | ||
75 | struct key_master_id { | 92 | struct smp_ltk { |
76 | __le16 ediv; | 93 | struct list_head list; |
77 | u8 rand[8]; | ||
78 | } __packed; | ||
79 | |||
80 | struct link_key_data { | ||
81 | bdaddr_t bdaddr; | 94 | bdaddr_t bdaddr; |
95 | u8 bdaddr_type; | ||
96 | u8 authenticated; | ||
82 | u8 type; | 97 | u8 type; |
98 | u8 enc_size; | ||
99 | __le16 ediv; | ||
100 | u8 rand[8]; | ||
83 | u8 val[16]; | 101 | u8 val[16]; |
84 | u8 pin_len; | ||
85 | u8 dlen; | ||
86 | u8 data[0]; | ||
87 | } __packed; | 102 | } __packed; |
88 | 103 | ||
89 | struct link_key { | 104 | struct link_key { |
@@ -92,8 +107,6 @@ struct link_key { | |||
92 | u8 type; | 107 | u8 type; |
93 | u8 val[16]; | 108 | u8 val[16]; |
94 | u8 pin_len; | 109 | u8 pin_len; |
95 | u8 dlen; | ||
96 | u8 data[0]; | ||
97 | }; | 110 | }; |
98 | 111 | ||
99 | struct oob_data { | 112 | struct oob_data { |
@@ -109,11 +122,19 @@ struct adv_entry { | |||
109 | u8 bdaddr_type; | 122 | u8 bdaddr_type; |
110 | }; | 123 | }; |
111 | 124 | ||
125 | struct le_scan_params { | ||
126 | u8 type; | ||
127 | u16 interval; | ||
128 | u16 window; | ||
129 | int timeout; | ||
130 | }; | ||
131 | |||
132 | #define HCI_MAX_SHORT_NAME_LENGTH 10 | ||
133 | |||
112 | #define NUM_REASSEMBLY 4 | 134 | #define NUM_REASSEMBLY 4 |
113 | struct hci_dev { | 135 | struct hci_dev { |
114 | struct list_head list; | 136 | struct list_head list; |
115 | struct mutex lock; | 137 | struct mutex lock; |
116 | atomic_t refcnt; | ||
117 | 138 | ||
118 | char name[8]; | 139 | char name[8]; |
119 | unsigned long flags; | 140 | unsigned long flags; |
@@ -122,6 +143,7 @@ struct hci_dev { | |||
122 | __u8 dev_type; | 143 | __u8 dev_type; |
123 | bdaddr_t bdaddr; | 144 | bdaddr_t bdaddr; |
124 | __u8 dev_name[HCI_MAX_NAME_LENGTH]; | 145 | __u8 dev_name[HCI_MAX_NAME_LENGTH]; |
146 | __u8 short_name[HCI_MAX_SHORT_NAME_LENGTH]; | ||
125 | __u8 eir[HCI_MAX_EIR_LENGTH]; | 147 | __u8 eir[HCI_MAX_EIR_LENGTH]; |
126 | __u8 dev_class[3]; | 148 | __u8 dev_class[3]; |
127 | __u8 major_class; | 149 | __u8 major_class; |
@@ -129,7 +151,6 @@ struct hci_dev { | |||
129 | __u8 features[8]; | 151 | __u8 features[8]; |
130 | __u8 host_features[8]; | 152 | __u8 host_features[8]; |
131 | __u8 commands[64]; | 153 | __u8 commands[64]; |
132 | __u8 ssp_mode; | ||
133 | __u8 hci_ver; | 154 | __u8 hci_ver; |
134 | __u16 hci_rev; | 155 | __u16 hci_rev; |
135 | __u8 lmp_ver; | 156 | __u8 lmp_ver; |
@@ -217,7 +238,7 @@ struct hci_dev { | |||
217 | 238 | ||
218 | struct list_head mgmt_pending; | 239 | struct list_head mgmt_pending; |
219 | 240 | ||
220 | struct inquiry_cache inq_cache; | 241 | struct discovery_state discovery; |
221 | struct hci_conn_hash conn_hash; | 242 | struct hci_conn_hash conn_hash; |
222 | struct list_head blacklist; | 243 | struct list_head blacklist; |
223 | 244 | ||
@@ -225,6 +246,8 @@ struct hci_dev { | |||
225 | 246 | ||
226 | struct list_head link_keys; | 247 | struct list_head link_keys; |
227 | 248 | ||
249 | struct list_head long_term_keys; | ||
250 | |||
228 | struct list_head remote_oob_data; | 251 | struct list_head remote_oob_data; |
229 | 252 | ||
230 | struct list_head adv_entries; | 253 | struct list_head adv_entries; |
@@ -234,7 +257,6 @@ struct hci_dev { | |||
234 | 257 | ||
235 | struct sk_buff_head driver_init; | 258 | struct sk_buff_head driver_init; |
236 | 259 | ||
237 | void *driver_data; | ||
238 | void *core_data; | 260 | void *core_data; |
239 | 261 | ||
240 | atomic_t promisc; | 262 | atomic_t promisc; |
@@ -246,15 +268,17 @@ struct hci_dev { | |||
246 | 268 | ||
247 | struct rfkill *rfkill; | 269 | struct rfkill *rfkill; |
248 | 270 | ||
249 | struct module *owner; | ||
250 | |||
251 | unsigned long dev_flags; | 271 | unsigned long dev_flags; |
252 | 272 | ||
273 | struct delayed_work le_scan_disable; | ||
274 | |||
275 | struct work_struct le_scan; | ||
276 | struct le_scan_params le_scan_params; | ||
277 | |||
253 | int (*open)(struct hci_dev *hdev); | 278 | int (*open)(struct hci_dev *hdev); |
254 | int (*close)(struct hci_dev *hdev); | 279 | int (*close)(struct hci_dev *hdev); |
255 | int (*flush)(struct hci_dev *hdev); | 280 | int (*flush)(struct hci_dev *hdev); |
256 | int (*send)(struct sk_buff *skb); | 281 | int (*send)(struct sk_buff *skb); |
257 | void (*destruct)(struct hci_dev *hdev); | ||
258 | void (*notify)(struct hci_dev *hdev, unsigned int evt); | 282 | void (*notify)(struct hci_dev *hdev, unsigned int evt); |
259 | int (*ioctl)(struct hci_dev *hdev, unsigned int cmd, unsigned long arg); | 283 | int (*ioctl)(struct hci_dev *hdev, unsigned int cmd, unsigned long arg); |
260 | }; | 284 | }; |
@@ -270,11 +294,10 @@ struct hci_conn { | |||
270 | __u16 state; | 294 | __u16 state; |
271 | __u8 mode; | 295 | __u8 mode; |
272 | __u8 type; | 296 | __u8 type; |
273 | __u8 out; | 297 | bool out; |
274 | __u8 attempt; | 298 | __u8 attempt; |
275 | __u8 dev_class[3]; | 299 | __u8 dev_class[3]; |
276 | __u8 features[8]; | 300 | __u8 features[8]; |
277 | __u8 ssp_mode; | ||
278 | __u16 interval; | 301 | __u16 interval; |
279 | __u16 pkt_type; | 302 | __u16 pkt_type; |
280 | __u16 link_policy; | 303 | __u16 link_policy; |
@@ -286,12 +309,10 @@ struct hci_conn { | |||
286 | __u8 pin_length; | 309 | __u8 pin_length; |
287 | __u8 enc_key_size; | 310 | __u8 enc_key_size; |
288 | __u8 io_capability; | 311 | __u8 io_capability; |
289 | __u8 power_save; | ||
290 | __u16 disc_timeout; | 312 | __u16 disc_timeout; |
291 | unsigned long pend; | 313 | unsigned long flags; |
292 | 314 | ||
293 | __u8 remote_cap; | 315 | __u8 remote_cap; |
294 | __u8 remote_oob; | ||
295 | __u8 remote_auth; | 316 | __u8 remote_auth; |
296 | 317 | ||
297 | unsigned int sent; | 318 | unsigned int sent; |
@@ -348,21 +369,26 @@ extern int sco_recv_scodata(struct hci_conn *hcon, struct sk_buff *skb); | |||
348 | #define INQUIRY_CACHE_AGE_MAX (HZ*30) /* 30 seconds */ | 369 | #define INQUIRY_CACHE_AGE_MAX (HZ*30) /* 30 seconds */ |
349 | #define INQUIRY_ENTRY_AGE_MAX (HZ*60) /* 60 seconds */ | 370 | #define INQUIRY_ENTRY_AGE_MAX (HZ*60) /* 60 seconds */ |
350 | 371 | ||
351 | static inline void inquiry_cache_init(struct hci_dev *hdev) | 372 | static inline void discovery_init(struct hci_dev *hdev) |
352 | { | 373 | { |
353 | struct inquiry_cache *c = &hdev->inq_cache; | 374 | hdev->discovery.state = DISCOVERY_STOPPED; |
354 | c->list = NULL; | 375 | INIT_LIST_HEAD(&hdev->discovery.all); |
376 | INIT_LIST_HEAD(&hdev->discovery.unknown); | ||
377 | INIT_LIST_HEAD(&hdev->discovery.resolve); | ||
355 | } | 378 | } |
356 | 379 | ||
380 | bool hci_discovery_active(struct hci_dev *hdev); | ||
381 | |||
382 | void hci_discovery_set_state(struct hci_dev *hdev, int state); | ||
383 | |||
357 | static inline int inquiry_cache_empty(struct hci_dev *hdev) | 384 | static inline int inquiry_cache_empty(struct hci_dev *hdev) |
358 | { | 385 | { |
359 | struct inquiry_cache *c = &hdev->inq_cache; | 386 | return list_empty(&hdev->discovery.all); |
360 | return c->list == NULL; | ||
361 | } | 387 | } |
362 | 388 | ||
363 | static inline long inquiry_cache_age(struct hci_dev *hdev) | 389 | static inline long inquiry_cache_age(struct hci_dev *hdev) |
364 | { | 390 | { |
365 | struct inquiry_cache *c = &hdev->inq_cache; | 391 | struct discovery_state *c = &hdev->discovery; |
366 | return jiffies - c->timestamp; | 392 | return jiffies - c->timestamp; |
367 | } | 393 | } |
368 | 394 | ||
@@ -372,8 +398,16 @@ static inline long inquiry_entry_age(struct inquiry_entry *e) | |||
372 | } | 398 | } |
373 | 399 | ||
374 | struct inquiry_entry *hci_inquiry_cache_lookup(struct hci_dev *hdev, | 400 | struct inquiry_entry *hci_inquiry_cache_lookup(struct hci_dev *hdev, |
375 | bdaddr_t *bdaddr); | 401 | bdaddr_t *bdaddr); |
376 | void hci_inquiry_cache_update(struct hci_dev *hdev, struct inquiry_data *data); | 402 | struct inquiry_entry *hci_inquiry_cache_lookup_unknown(struct hci_dev *hdev, |
403 | bdaddr_t *bdaddr); | ||
404 | struct inquiry_entry *hci_inquiry_cache_lookup_resolve(struct hci_dev *hdev, | ||
405 | bdaddr_t *bdaddr, | ||
406 | int state); | ||
407 | void hci_inquiry_cache_update_resolve(struct hci_dev *hdev, | ||
408 | struct inquiry_entry *ie); | ||
409 | bool hci_inquiry_cache_update(struct hci_dev *hdev, struct inquiry_data *data, | ||
410 | bool name_known, bool *ssp); | ||
377 | 411 | ||
378 | /* ----- HCI Connections ----- */ | 412 | /* ----- HCI Connections ----- */ |
379 | enum { | 413 | enum { |
@@ -384,8 +418,19 @@ enum { | |||
384 | HCI_CONN_MODE_CHANGE_PEND, | 418 | HCI_CONN_MODE_CHANGE_PEND, |
385 | HCI_CONN_SCO_SETUP_PEND, | 419 | HCI_CONN_SCO_SETUP_PEND, |
386 | HCI_CONN_LE_SMP_PEND, | 420 | HCI_CONN_LE_SMP_PEND, |
421 | HCI_CONN_MGMT_CONNECTED, | ||
422 | HCI_CONN_SSP_ENABLED, | ||
423 | HCI_CONN_POWER_SAVE, | ||
424 | HCI_CONN_REMOTE_OOB, | ||
387 | }; | 425 | }; |
388 | 426 | ||
427 | static inline bool hci_conn_ssp_enabled(struct hci_conn *conn) | ||
428 | { | ||
429 | struct hci_dev *hdev = conn->hdev; | ||
430 | return (test_bit(HCI_SSP_ENABLED, &hdev->dev_flags) && | ||
431 | test_bit(HCI_CONN_SSP_ENABLED, &conn->flags)); | ||
432 | } | ||
433 | |||
389 | static inline void hci_conn_hash_init(struct hci_dev *hdev) | 434 | static inline void hci_conn_hash_init(struct hci_dev *hdev) |
390 | { | 435 | { |
391 | struct hci_conn_hash *h = &hdev->conn_hash; | 436 | struct hci_conn_hash *h = &hdev->conn_hash; |
@@ -566,36 +611,33 @@ static inline void hci_conn_put(struct hci_conn *conn) | |||
566 | } | 611 | } |
567 | 612 | ||
568 | /* ----- HCI Devices ----- */ | 613 | /* ----- HCI Devices ----- */ |
569 | static inline void __hci_dev_put(struct hci_dev *d) | 614 | static inline void hci_dev_put(struct hci_dev *d) |
570 | { | 615 | { |
571 | if (atomic_dec_and_test(&d->refcnt)) | 616 | put_device(&d->dev); |
572 | d->destruct(d); | ||
573 | } | 617 | } |
574 | 618 | ||
575 | /* | 619 | static inline struct hci_dev *hci_dev_hold(struct hci_dev *d) |
576 | * hci_dev_put and hci_dev_hold are macros to avoid dragging all the | ||
577 | * overhead of all the modular infrastructure into this header. | ||
578 | */ | ||
579 | #define hci_dev_put(d) \ | ||
580 | do { \ | ||
581 | __hci_dev_put(d); \ | ||
582 | module_put(d->owner); \ | ||
583 | } while (0) | ||
584 | |||
585 | static inline struct hci_dev *__hci_dev_hold(struct hci_dev *d) | ||
586 | { | 620 | { |
587 | atomic_inc(&d->refcnt); | 621 | get_device(&d->dev); |
588 | return d; | 622 | return d; |
589 | } | 623 | } |
590 | 624 | ||
591 | #define hci_dev_hold(d) \ | ||
592 | ({ \ | ||
593 | try_module_get(d->owner) ? __hci_dev_hold(d) : NULL; \ | ||
594 | }) | ||
595 | |||
596 | #define hci_dev_lock(d) mutex_lock(&d->lock) | 625 | #define hci_dev_lock(d) mutex_lock(&d->lock) |
597 | #define hci_dev_unlock(d) mutex_unlock(&d->lock) | 626 | #define hci_dev_unlock(d) mutex_unlock(&d->lock) |
598 | 627 | ||
628 | #define to_hci_dev(d) container_of(d, struct hci_dev, dev) | ||
629 | #define to_hci_conn(c) container_of(c, struct hci_conn, dev) | ||
630 | |||
631 | static inline void *hci_get_drvdata(struct hci_dev *hdev) | ||
632 | { | ||
633 | return dev_get_drvdata(&hdev->dev); | ||
634 | } | ||
635 | |||
636 | static inline void hci_set_drvdata(struct hci_dev *hdev, void *data) | ||
637 | { | ||
638 | dev_set_drvdata(&hdev->dev, data); | ||
639 | } | ||
640 | |||
599 | struct hci_dev *hci_dev_get(int index); | 641 | struct hci_dev *hci_dev_get(int index); |
600 | struct hci_dev *hci_get_route(bdaddr_t *src, bdaddr_t *dst); | 642 | struct hci_dev *hci_get_route(bdaddr_t *src, bdaddr_t *dst); |
601 | 643 | ||
@@ -619,20 +661,23 @@ int hci_inquiry(void __user *arg); | |||
619 | 661 | ||
620 | struct bdaddr_list *hci_blacklist_lookup(struct hci_dev *hdev, bdaddr_t *bdaddr); | 662 | struct bdaddr_list *hci_blacklist_lookup(struct hci_dev *hdev, bdaddr_t *bdaddr); |
621 | int hci_blacklist_clear(struct hci_dev *hdev); | 663 | int hci_blacklist_clear(struct hci_dev *hdev); |
622 | int hci_blacklist_add(struct hci_dev *hdev, bdaddr_t *bdaddr); | 664 | int hci_blacklist_add(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 type); |
623 | int hci_blacklist_del(struct hci_dev *hdev, bdaddr_t *bdaddr); | 665 | int hci_blacklist_del(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 type); |
624 | 666 | ||
625 | int hci_uuids_clear(struct hci_dev *hdev); | 667 | int hci_uuids_clear(struct hci_dev *hdev); |
626 | 668 | ||
627 | int hci_link_keys_clear(struct hci_dev *hdev); | 669 | int hci_link_keys_clear(struct hci_dev *hdev); |
628 | struct link_key *hci_find_link_key(struct hci_dev *hdev, bdaddr_t *bdaddr); | 670 | struct link_key *hci_find_link_key(struct hci_dev *hdev, bdaddr_t *bdaddr); |
629 | int hci_add_link_key(struct hci_dev *hdev, struct hci_conn *conn, int new_key, | 671 | int hci_add_link_key(struct hci_dev *hdev, struct hci_conn *conn, int new_key, |
630 | bdaddr_t *bdaddr, u8 *val, u8 type, u8 pin_len); | 672 | bdaddr_t *bdaddr, u8 *val, u8 type, u8 pin_len); |
631 | struct link_key *hci_find_ltk(struct hci_dev *hdev, __le16 ediv, u8 rand[8]); | 673 | struct smp_ltk *hci_find_ltk(struct hci_dev *hdev, __le16 ediv, u8 rand[8]); |
632 | struct link_key *hci_find_link_key_type(struct hci_dev *hdev, | 674 | int hci_add_ltk(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 addr_type, u8 type, |
633 | bdaddr_t *bdaddr, u8 type); | 675 | int new_key, u8 authenticated, u8 tk[16], u8 enc_size, u16 ediv, |
634 | int hci_add_ltk(struct hci_dev *hdev, int new_key, bdaddr_t *bdaddr, | 676 | u8 rand[8]); |
635 | u8 key_size, __le16 ediv, u8 rand[8], u8 ltk[16]); | 677 | struct smp_ltk *hci_find_ltk_by_addr(struct hci_dev *hdev, bdaddr_t *bdaddr, |
678 | u8 addr_type); | ||
679 | int hci_remove_ltk(struct hci_dev *hdev, bdaddr_t *bdaddr); | ||
680 | int hci_smp_ltks_clear(struct hci_dev *hdev); | ||
636 | int hci_remove_link_key(struct hci_dev *hdev, bdaddr_t *bdaddr); | 681 | int hci_remove_link_key(struct hci_dev *hdev, bdaddr_t *bdaddr); |
637 | 682 | ||
638 | int hci_remote_oob_data_clear(struct hci_dev *hdev); | 683 | int hci_remote_oob_data_clear(struct hci_dev *hdev); |
@@ -674,6 +719,7 @@ void hci_conn_del_sysfs(struct hci_conn *conn); | |||
674 | #define lmp_ssp_capable(dev) ((dev)->features[6] & LMP_SIMPLE_PAIR) | 719 | #define lmp_ssp_capable(dev) ((dev)->features[6] & LMP_SIMPLE_PAIR) |
675 | #define lmp_no_flush_capable(dev) ((dev)->features[6] & LMP_NO_FLUSH) | 720 | #define lmp_no_flush_capable(dev) ((dev)->features[6] & LMP_NO_FLUSH) |
676 | #define lmp_le_capable(dev) ((dev)->features[4] & LMP_LE) | 721 | #define lmp_le_capable(dev) ((dev)->features[4] & LMP_LE) |
722 | #define lmp_bredr_capable(dev) (!((dev)->features[4] & LMP_NO_BREDR)) | ||
677 | 723 | ||
678 | /* ----- Extended LMP capabilities ----- */ | 724 | /* ----- Extended LMP capabilities ----- */ |
679 | #define lmp_host_le_capable(dev) ((dev)->host_features[0] & LMP_HOST_LE) | 725 | #define lmp_host_le_capable(dev) ((dev)->host_features[0] & LMP_HOST_LE) |
@@ -755,7 +801,7 @@ static inline void hci_proto_auth_cfm(struct hci_conn *conn, __u8 status) | |||
755 | if (conn->type != ACL_LINK && conn->type != LE_LINK) | 801 | if (conn->type != ACL_LINK && conn->type != LE_LINK) |
756 | return; | 802 | return; |
757 | 803 | ||
758 | if (test_bit(HCI_CONN_ENCRYPT_PEND, &conn->pend)) | 804 | if (test_bit(HCI_CONN_ENCRYPT_PEND, &conn->flags)) |
759 | return; | 805 | return; |
760 | 806 | ||
761 | encrypt = (conn->link_mode & HCI_LM_ENCRYPT) ? 0x01 : 0x00; | 807 | encrypt = (conn->link_mode & HCI_LM_ENCRYPT) ? 0x01 : 0x00; |
@@ -796,7 +842,7 @@ static inline void hci_auth_cfm(struct hci_conn *conn, __u8 status) | |||
796 | 842 | ||
797 | hci_proto_auth_cfm(conn, status); | 843 | hci_proto_auth_cfm(conn, status); |
798 | 844 | ||
799 | if (test_bit(HCI_CONN_ENCRYPT_PEND, &conn->pend)) | 845 | if (test_bit(HCI_CONN_ENCRYPT_PEND, &conn->flags)) |
800 | return; | 846 | return; |
801 | 847 | ||
802 | encrypt = (conn->link_mode & HCI_LM_ENCRYPT) ? 0x01 : 0x00; | 848 | encrypt = (conn->link_mode & HCI_LM_ENCRYPT) ? 0x01 : 0x00; |
@@ -859,25 +905,73 @@ static inline void hci_role_switch_cfm(struct hci_conn *conn, __u8 status, | |||
859 | read_unlock(&hci_cb_list_lock); | 905 | read_unlock(&hci_cb_list_lock); |
860 | } | 906 | } |
861 | 907 | ||
908 | static inline bool eir_has_data_type(u8 *data, size_t data_len, u8 type) | ||
909 | { | ||
910 | size_t parsed = 0; | ||
911 | |||
912 | if (data_len < 2) | ||
913 | return false; | ||
914 | |||
915 | while (parsed < data_len - 1) { | ||
916 | u8 field_len = data[0]; | ||
917 | |||
918 | if (field_len == 0) | ||
919 | break; | ||
920 | |||
921 | parsed += field_len + 1; | ||
922 | |||
923 | if (parsed > data_len) | ||
924 | break; | ||
925 | |||
926 | if (data[1] == type) | ||
927 | return true; | ||
928 | |||
929 | data += field_len + 1; | ||
930 | } | ||
931 | |||
932 | return false; | ||
933 | } | ||
934 | |||
935 | static inline u16 eir_append_data(u8 *eir, u16 eir_len, u8 type, u8 *data, | ||
936 | u8 data_len) | ||
937 | { | ||
938 | eir[eir_len++] = sizeof(type) + data_len; | ||
939 | eir[eir_len++] = type; | ||
940 | memcpy(&eir[eir_len], data, data_len); | ||
941 | eir_len += data_len; | ||
942 | |||
943 | return eir_len; | ||
944 | } | ||
945 | |||
862 | int hci_register_cb(struct hci_cb *hcb); | 946 | int hci_register_cb(struct hci_cb *hcb); |
863 | int hci_unregister_cb(struct hci_cb *hcb); | 947 | int hci_unregister_cb(struct hci_cb *hcb); |
864 | 948 | ||
865 | int hci_register_notifier(struct notifier_block *nb); | ||
866 | int hci_unregister_notifier(struct notifier_block *nb); | ||
867 | |||
868 | int hci_send_cmd(struct hci_dev *hdev, __u16 opcode, __u32 plen, void *param); | 949 | int hci_send_cmd(struct hci_dev *hdev, __u16 opcode, __u32 plen, void *param); |
869 | void hci_send_acl(struct hci_chan *chan, struct sk_buff *skb, __u16 flags); | 950 | void hci_send_acl(struct hci_chan *chan, struct sk_buff *skb, __u16 flags); |
870 | void hci_send_sco(struct hci_conn *conn, struct sk_buff *skb); | 951 | void hci_send_sco(struct hci_conn *conn, struct sk_buff *skb); |
871 | 952 | ||
872 | void *hci_sent_cmd_data(struct hci_dev *hdev, __u16 opcode); | 953 | void *hci_sent_cmd_data(struct hci_dev *hdev, __u16 opcode); |
873 | 954 | ||
874 | void hci_si_event(struct hci_dev *hdev, int type, int dlen, void *data); | ||
875 | |||
876 | /* ----- HCI Sockets ----- */ | 955 | /* ----- HCI Sockets ----- */ |
877 | void hci_send_to_sock(struct hci_dev *hdev, struct sk_buff *skb, | 956 | void hci_send_to_sock(struct hci_dev *hdev, struct sk_buff *skb); |
878 | struct sock *skip_sk); | 957 | void hci_send_to_control(struct sk_buff *skb, struct sock *skip_sk); |
958 | void hci_send_to_monitor(struct hci_dev *hdev, struct sk_buff *skb); | ||
959 | |||
960 | void hci_sock_dev_event(struct hci_dev *hdev, int event); | ||
879 | 961 | ||
880 | /* Management interface */ | 962 | /* Management interface */ |
963 | #define MGMT_ADDR_BREDR 0x00 | ||
964 | #define MGMT_ADDR_LE_PUBLIC 0x01 | ||
965 | #define MGMT_ADDR_LE_RANDOM 0x02 | ||
966 | #define MGMT_ADDR_INVALID 0xff | ||
967 | |||
968 | #define DISCOV_TYPE_BREDR (BIT(MGMT_ADDR_BREDR)) | ||
969 | #define DISCOV_TYPE_LE (BIT(MGMT_ADDR_LE_PUBLIC) | \ | ||
970 | BIT(MGMT_ADDR_LE_RANDOM)) | ||
971 | #define DISCOV_TYPE_INTERLEAVED (BIT(MGMT_ADDR_BREDR) | \ | ||
972 | BIT(MGMT_ADDR_LE_PUBLIC) | \ | ||
973 | BIT(MGMT_ADDR_LE_RANDOM)) | ||
974 | |||
881 | int mgmt_control(struct sock *sk, struct msghdr *msg, size_t len); | 975 | int mgmt_control(struct sock *sk, struct msghdr *msg, size_t len); |
882 | int mgmt_index_added(struct hci_dev *hdev); | 976 | int mgmt_index_added(struct hci_dev *hdev); |
883 | int mgmt_index_removed(struct hci_dev *hdev); | 977 | int mgmt_index_removed(struct hci_dev *hdev); |
@@ -886,56 +980,67 @@ int mgmt_discoverable(struct hci_dev *hdev, u8 discoverable); | |||
886 | int mgmt_connectable(struct hci_dev *hdev, u8 connectable); | 980 | int mgmt_connectable(struct hci_dev *hdev, u8 connectable); |
887 | int mgmt_write_scan_failed(struct hci_dev *hdev, u8 scan, u8 status); | 981 | int mgmt_write_scan_failed(struct hci_dev *hdev, u8 scan, u8 status); |
888 | int mgmt_new_link_key(struct hci_dev *hdev, struct link_key *key, | 982 | int mgmt_new_link_key(struct hci_dev *hdev, struct link_key *key, |
889 | u8 persistent); | 983 | u8 persistent); |
890 | int mgmt_connected(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type, | 984 | int mgmt_device_connected(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type, |
891 | u8 addr_type); | 985 | u8 addr_type, u32 flags, u8 *name, u8 name_len, |
892 | int mgmt_disconnected(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type, | 986 | u8 *dev_class); |
893 | u8 addr_type); | 987 | int mgmt_device_disconnected(struct hci_dev *hdev, bdaddr_t *bdaddr, |
894 | int mgmt_disconnect_failed(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 status); | 988 | u8 link_type, u8 addr_type); |
989 | int mgmt_disconnect_failed(struct hci_dev *hdev, bdaddr_t *bdaddr, | ||
990 | u8 link_type, u8 addr_type, u8 status); | ||
895 | int mgmt_connect_failed(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type, | 991 | int mgmt_connect_failed(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type, |
896 | u8 addr_type, u8 status); | 992 | u8 addr_type, u8 status); |
897 | int mgmt_pin_code_request(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 secure); | 993 | int mgmt_pin_code_request(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 secure); |
898 | int mgmt_pin_code_reply_complete(struct hci_dev *hdev, bdaddr_t *bdaddr, | 994 | int mgmt_pin_code_reply_complete(struct hci_dev *hdev, bdaddr_t *bdaddr, |
899 | u8 status); | 995 | u8 status); |
900 | int mgmt_pin_code_neg_reply_complete(struct hci_dev *hdev, bdaddr_t *bdaddr, | 996 | int mgmt_pin_code_neg_reply_complete(struct hci_dev *hdev, bdaddr_t *bdaddr, |
901 | u8 status); | 997 | u8 status); |
902 | int mgmt_user_confirm_request(struct hci_dev *hdev, bdaddr_t *bdaddr, | 998 | int mgmt_user_confirm_request(struct hci_dev *hdev, bdaddr_t *bdaddr, |
903 | __le32 value, u8 confirm_hint); | 999 | u8 link_type, u8 addr_type, __le32 value, |
1000 | u8 confirm_hint); | ||
904 | int mgmt_user_confirm_reply_complete(struct hci_dev *hdev, bdaddr_t *bdaddr, | 1001 | int mgmt_user_confirm_reply_complete(struct hci_dev *hdev, bdaddr_t *bdaddr, |
905 | u8 status); | 1002 | u8 link_type, u8 addr_type, u8 status); |
906 | int mgmt_user_confirm_neg_reply_complete(struct hci_dev *hdev, | 1003 | int mgmt_user_confirm_neg_reply_complete(struct hci_dev *hdev, bdaddr_t *bdaddr, |
907 | bdaddr_t *bdaddr, u8 status); | 1004 | u8 link_type, u8 addr_type, u8 status); |
908 | int mgmt_user_passkey_request(struct hci_dev *hdev, bdaddr_t *bdaddr); | 1005 | int mgmt_user_passkey_request(struct hci_dev *hdev, bdaddr_t *bdaddr, |
1006 | u8 link_type, u8 addr_type); | ||
909 | int mgmt_user_passkey_reply_complete(struct hci_dev *hdev, bdaddr_t *bdaddr, | 1007 | int mgmt_user_passkey_reply_complete(struct hci_dev *hdev, bdaddr_t *bdaddr, |
910 | u8 status); | 1008 | u8 link_type, u8 addr_type, u8 status); |
911 | int mgmt_user_passkey_neg_reply_complete(struct hci_dev *hdev, | 1009 | int mgmt_user_passkey_neg_reply_complete(struct hci_dev *hdev, bdaddr_t *bdaddr, |
912 | bdaddr_t *bdaddr, u8 status); | 1010 | u8 link_type, u8 addr_type, u8 status); |
913 | int mgmt_auth_failed(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 status); | 1011 | int mgmt_auth_failed(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type, |
1012 | u8 addr_type, u8 status); | ||
1013 | int mgmt_auth_enable_complete(struct hci_dev *hdev, u8 status); | ||
1014 | int mgmt_ssp_enable_complete(struct hci_dev *hdev, u8 enable, u8 status); | ||
1015 | int mgmt_set_class_of_dev_complete(struct hci_dev *hdev, u8 *dev_class, | ||
1016 | u8 status); | ||
914 | int mgmt_set_local_name_complete(struct hci_dev *hdev, u8 *name, u8 status); | 1017 | int mgmt_set_local_name_complete(struct hci_dev *hdev, u8 *name, u8 status); |
915 | int mgmt_read_local_oob_data_reply_complete(struct hci_dev *hdev, u8 *hash, | 1018 | int mgmt_read_local_oob_data_reply_complete(struct hci_dev *hdev, u8 *hash, |
916 | u8 *randomizer, u8 status); | 1019 | u8 *randomizer, u8 status); |
1020 | int mgmt_le_enable_complete(struct hci_dev *hdev, u8 enable, u8 status); | ||
917 | int mgmt_device_found(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type, | 1021 | int mgmt_device_found(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type, |
918 | u8 addr_type, u8 *dev_class, s8 rssi, u8 *eir); | 1022 | u8 addr_type, u8 *dev_class, s8 rssi, u8 cfm_name, |
919 | int mgmt_remote_name(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 *name); | 1023 | u8 ssp, u8 *eir, u16 eir_len); |
1024 | int mgmt_remote_name(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type, | ||
1025 | u8 addr_type, s8 rssi, u8 *name, u8 name_len); | ||
920 | int mgmt_start_discovery_failed(struct hci_dev *hdev, u8 status); | 1026 | int mgmt_start_discovery_failed(struct hci_dev *hdev, u8 status); |
921 | int mgmt_stop_discovery_failed(struct hci_dev *hdev, u8 status); | 1027 | int mgmt_stop_discovery_failed(struct hci_dev *hdev, u8 status); |
922 | int mgmt_discovering(struct hci_dev *hdev, u8 discovering); | 1028 | int mgmt_discovering(struct hci_dev *hdev, u8 discovering); |
923 | int mgmt_device_blocked(struct hci_dev *hdev, bdaddr_t *bdaddr); | 1029 | int mgmt_interleaved_discovery(struct hci_dev *hdev); |
924 | int mgmt_device_unblocked(struct hci_dev *hdev, bdaddr_t *bdaddr); | 1030 | int mgmt_device_blocked(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 type); |
1031 | int mgmt_device_unblocked(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 type); | ||
1032 | |||
1033 | int mgmt_new_ltk(struct hci_dev *hdev, struct smp_ltk *key, u8 persistent); | ||
925 | 1034 | ||
926 | /* HCI info for socket */ | 1035 | /* HCI info for socket */ |
927 | #define hci_pi(sk) ((struct hci_pinfo *) sk) | 1036 | #define hci_pi(sk) ((struct hci_pinfo *) sk) |
928 | 1037 | ||
929 | /* HCI socket flags */ | ||
930 | #define HCI_PI_MGMT_INIT 0 | ||
931 | |||
932 | struct hci_pinfo { | 1038 | struct hci_pinfo { |
933 | struct bt_sock bt; | 1039 | struct bt_sock bt; |
934 | struct hci_dev *hdev; | 1040 | struct hci_dev *hdev; |
935 | struct hci_filter filter; | 1041 | struct hci_filter filter; |
936 | __u32 cmsg_mask; | 1042 | __u32 cmsg_mask; |
937 | unsigned short channel; | 1043 | unsigned short channel; |
938 | unsigned long flags; | ||
939 | }; | 1044 | }; |
940 | 1045 | ||
941 | /* HCI security filter */ | 1046 | /* HCI security filter */ |
@@ -966,5 +1071,7 @@ void hci_le_ltk_neg_reply(struct hci_conn *conn); | |||
966 | 1071 | ||
967 | int hci_do_inquiry(struct hci_dev *hdev, u8 length); | 1072 | int hci_do_inquiry(struct hci_dev *hdev, u8 length); |
968 | int hci_cancel_inquiry(struct hci_dev *hdev); | 1073 | int hci_cancel_inquiry(struct hci_dev *hdev); |
1074 | int hci_le_scan(struct hci_dev *hdev, u8 type, u16 interval, u16 window, | ||
1075 | int timeout); | ||
969 | 1076 | ||
970 | #endif /* __HCI_CORE_H */ | 1077 | #endif /* __HCI_CORE_H */ |
diff --git a/include/net/bluetooth/hci_mon.h b/include/net/bluetooth/hci_mon.h new file mode 100644 index 000000000000..77d1e5764185 --- /dev/null +++ b/include/net/bluetooth/hci_mon.h | |||
@@ -0,0 +1,51 @@ | |||
1 | /* | ||
2 | BlueZ - Bluetooth protocol stack for Linux | ||
3 | |||
4 | Copyright (C) 2011-2012 Intel 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 version 2 as | ||
8 | published by the Free Software Foundation; | ||
9 | |||
10 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS | ||
11 | OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
12 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. | ||
13 | IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY | ||
14 | CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES | ||
15 | WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||
16 | ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | ||
17 | OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
18 | |||
19 | ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS, | ||
20 | COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS | ||
21 | SOFTWARE IS DISCLAIMED. | ||
22 | */ | ||
23 | |||
24 | #ifndef __HCI_MON_H | ||
25 | #define __HCI_MON_H | ||
26 | |||
27 | struct hci_mon_hdr { | ||
28 | __le16 opcode; | ||
29 | __le16 index; | ||
30 | __le16 len; | ||
31 | } __packed; | ||
32 | #define HCI_MON_HDR_SIZE 6 | ||
33 | |||
34 | #define HCI_MON_NEW_INDEX 0 | ||
35 | #define HCI_MON_DEL_INDEX 1 | ||
36 | #define HCI_MON_COMMAND_PKT 2 | ||
37 | #define HCI_MON_EVENT_PKT 3 | ||
38 | #define HCI_MON_ACL_TX_PKT 4 | ||
39 | #define HCI_MON_ACL_RX_PKT 5 | ||
40 | #define HCI_MON_SCO_TX_PKT 6 | ||
41 | #define HCI_MON_SCO_RX_PKT 7 | ||
42 | |||
43 | struct hci_mon_new_index { | ||
44 | __u8 type; | ||
45 | __u8 bus; | ||
46 | bdaddr_t bdaddr; | ||
47 | char name[8]; | ||
48 | } __packed; | ||
49 | #define HCI_MON_NEW_INDEX_SIZE 16 | ||
50 | |||
51 | #endif /* __HCI_MON_H */ | ||
diff --git a/include/net/bluetooth/l2cap.h b/include/net/bluetooth/l2cap.h index b1664ed884e6..9b242c6bf55b 100644 --- a/include/net/bluetooth/l2cap.h +++ b/include/net/bluetooth/l2cap.h | |||
@@ -45,11 +45,11 @@ | |||
45 | #define L2CAP_DEFAULT_SDU_ITIME 0xFFFFFFFF | 45 | #define L2CAP_DEFAULT_SDU_ITIME 0xFFFFFFFF |
46 | #define L2CAP_DEFAULT_ACC_LAT 0xFFFFFFFF | 46 | #define L2CAP_DEFAULT_ACC_LAT 0xFFFFFFFF |
47 | 47 | ||
48 | #define L2CAP_DISC_TIMEOUT (100) | 48 | #define L2CAP_DISC_TIMEOUT msecs_to_jiffies(100) |
49 | #define L2CAP_DISC_REJ_TIMEOUT (5000) /* 5 seconds */ | 49 | #define L2CAP_DISC_REJ_TIMEOUT msecs_to_jiffies(5000) |
50 | #define L2CAP_ENC_TIMEOUT (5000) /* 5 seconds */ | 50 | #define L2CAP_ENC_TIMEOUT msecs_to_jiffies(5000) |
51 | #define L2CAP_CONN_TIMEOUT (40000) /* 40 seconds */ | 51 | #define L2CAP_CONN_TIMEOUT msecs_to_jiffies(40000) |
52 | #define L2CAP_INFO_TIMEOUT (4000) /* 4 seconds */ | 52 | #define L2CAP_INFO_TIMEOUT msecs_to_jiffies(4000) |
53 | 53 | ||
54 | /* L2CAP socket address */ | 54 | /* L2CAP socket address */ |
55 | struct sockaddr_l2 { | 55 | struct sockaddr_l2 { |
@@ -492,51 +492,56 @@ struct l2cap_chan { | |||
492 | struct sk_buff_head srej_q; | 492 | struct sk_buff_head srej_q; |
493 | struct list_head srej_l; | 493 | struct list_head srej_l; |
494 | 494 | ||
495 | struct list_head list; | 495 | struct list_head list; |
496 | struct list_head global_l; | 496 | struct list_head global_l; |
497 | 497 | ||
498 | void *data; | 498 | void *data; |
499 | struct l2cap_ops *ops; | 499 | struct l2cap_ops *ops; |
500 | struct mutex lock; | ||
500 | }; | 501 | }; |
501 | 502 | ||
502 | struct l2cap_ops { | 503 | struct l2cap_ops { |
503 | char *name; | 504 | char *name; |
504 | 505 | ||
505 | struct l2cap_chan *(*new_connection) (void *data); | 506 | struct l2cap_chan *(*new_connection) (void *data); |
506 | int (*recv) (void *data, struct sk_buff *skb); | 507 | int (*recv) (void *data, struct sk_buff *skb); |
507 | void (*close) (void *data); | 508 | void (*close) (void *data); |
508 | void (*state_change) (void *data, int state); | 509 | void (*state_change) (void *data, int state); |
510 | struct sk_buff *(*alloc_skb) (struct l2cap_chan *chan, | ||
511 | unsigned long len, int nb, int *err); | ||
512 | |||
509 | }; | 513 | }; |
510 | 514 | ||
511 | struct l2cap_conn { | 515 | struct l2cap_conn { |
512 | struct hci_conn *hcon; | 516 | struct hci_conn *hcon; |
513 | struct hci_chan *hchan; | 517 | struct hci_chan *hchan; |
514 | 518 | ||
515 | bdaddr_t *dst; | 519 | bdaddr_t *dst; |
516 | bdaddr_t *src; | 520 | bdaddr_t *src; |
517 | 521 | ||
518 | unsigned int mtu; | 522 | unsigned int mtu; |
519 | 523 | ||
520 | __u32 feat_mask; | 524 | __u32 feat_mask; |
525 | __u8 fixed_chan_mask; | ||
521 | 526 | ||
522 | __u8 info_state; | 527 | __u8 info_state; |
523 | __u8 info_ident; | 528 | __u8 info_ident; |
524 | 529 | ||
525 | struct delayed_work info_timer; | 530 | struct delayed_work info_timer; |
526 | 531 | ||
527 | spinlock_t lock; | 532 | spinlock_t lock; |
528 | 533 | ||
529 | struct sk_buff *rx_skb; | 534 | struct sk_buff *rx_skb; |
530 | __u32 rx_len; | 535 | __u32 rx_len; |
531 | __u8 tx_ident; | 536 | __u8 tx_ident; |
532 | 537 | ||
533 | __u8 disc_reason; | 538 | __u8 disc_reason; |
534 | 539 | ||
535 | struct delayed_work security_timer; | 540 | struct delayed_work security_timer; |
536 | struct smp_chan *smp_chan; | 541 | struct smp_chan *smp_chan; |
537 | 542 | ||
538 | struct list_head chan_l; | 543 | struct list_head chan_l; |
539 | struct mutex chan_lock; | 544 | struct mutex chan_lock; |
540 | }; | 545 | }; |
541 | 546 | ||
542 | #define L2CAP_INFO_CL_MTU_REQ_SENT 0x01 | 547 | #define L2CAP_INFO_CL_MTU_REQ_SENT 0x01 |
@@ -551,9 +556,9 @@ struct l2cap_conn { | |||
551 | #define l2cap_pi(sk) ((struct l2cap_pinfo *) sk) | 556 | #define l2cap_pi(sk) ((struct l2cap_pinfo *) sk) |
552 | 557 | ||
553 | struct l2cap_pinfo { | 558 | struct l2cap_pinfo { |
554 | struct bt_sock bt; | 559 | struct bt_sock bt; |
555 | struct l2cap_chan *chan; | 560 | struct l2cap_chan *chan; |
556 | struct sk_buff *rx_busy_skb; | 561 | struct sk_buff *rx_busy_skb; |
557 | }; | 562 | }; |
558 | 563 | ||
559 | enum { | 564 | enum { |
@@ -606,21 +611,37 @@ static inline void l2cap_chan_put(struct l2cap_chan *c) | |||
606 | kfree(c); | 611 | kfree(c); |
607 | } | 612 | } |
608 | 613 | ||
614 | static inline void l2cap_chan_lock(struct l2cap_chan *chan) | ||
615 | { | ||
616 | mutex_lock(&chan->lock); | ||
617 | } | ||
618 | |||
619 | static inline void l2cap_chan_unlock(struct l2cap_chan *chan) | ||
620 | { | ||
621 | mutex_unlock(&chan->lock); | ||
622 | } | ||
623 | |||
609 | static inline void l2cap_set_timer(struct l2cap_chan *chan, | 624 | static inline void l2cap_set_timer(struct l2cap_chan *chan, |
610 | struct delayed_work *work, long timeout) | 625 | struct delayed_work *work, long timeout) |
611 | { | 626 | { |
612 | BT_DBG("chan %p state %d timeout %ld", chan, chan->state, timeout); | 627 | BT_DBG("chan %p state %s timeout %ld", chan, |
628 | state_to_string(chan->state), timeout); | ||
613 | 629 | ||
614 | if (!cancel_delayed_work(work)) | 630 | if (!cancel_delayed_work(work)) |
615 | l2cap_chan_hold(chan); | 631 | l2cap_chan_hold(chan); |
616 | schedule_delayed_work(work, timeout); | 632 | schedule_delayed_work(work, timeout); |
617 | } | 633 | } |
618 | 634 | ||
619 | static inline void l2cap_clear_timer(struct l2cap_chan *chan, | 635 | static inline bool l2cap_clear_timer(struct l2cap_chan *chan, |
620 | struct delayed_work *work) | 636 | struct delayed_work *work) |
621 | { | 637 | { |
622 | if (cancel_delayed_work(work)) | 638 | bool ret; |
639 | |||
640 | ret = cancel_delayed_work(work); | ||
641 | if (ret) | ||
623 | l2cap_chan_put(chan); | 642 | l2cap_chan_put(chan); |
643 | |||
644 | return ret; | ||
624 | } | 645 | } |
625 | 646 | ||
626 | #define __set_chan_timer(c, t) l2cap_set_timer(c, &c->chan_timer, (t)) | 647 | #define __set_chan_timer(c, t) l2cap_set_timer(c, &c->chan_timer, (t)) |
diff --git a/include/net/bluetooth/mgmt.h b/include/net/bluetooth/mgmt.h index be65d3417883..ebfd91fc20f8 100644 --- a/include/net/bluetooth/mgmt.h +++ b/include/net/bluetooth/mgmt.h | |||
@@ -2,6 +2,7 @@ | |||
2 | BlueZ - Bluetooth protocol stack for Linux | 2 | BlueZ - Bluetooth protocol stack for Linux |
3 | 3 | ||
4 | Copyright (C) 2010 Nokia Corporation | 4 | Copyright (C) 2010 Nokia Corporation |
5 | Copyright (C) 2011-2012 Intel Corporation | ||
5 | 6 | ||
6 | This program is free software; you can redistribute it and/or modify | 7 | 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 | it under the terms of the GNU General Public License version 2 as |
@@ -39,29 +40,47 @@ | |||
39 | #define MGMT_STATUS_INVALID_PARAMS 0x0d | 40 | #define MGMT_STATUS_INVALID_PARAMS 0x0d |
40 | #define MGMT_STATUS_DISCONNECTED 0x0e | 41 | #define MGMT_STATUS_DISCONNECTED 0x0e |
41 | #define MGMT_STATUS_NOT_POWERED 0x0f | 42 | #define MGMT_STATUS_NOT_POWERED 0x0f |
43 | #define MGMT_STATUS_CANCELLED 0x10 | ||
44 | #define MGMT_STATUS_INVALID_INDEX 0x11 | ||
42 | 45 | ||
43 | struct mgmt_hdr { | 46 | struct mgmt_hdr { |
44 | __le16 opcode; | 47 | __le16 opcode; |
45 | __le16 index; | 48 | __le16 index; |
46 | __le16 len; | 49 | __le16 len; |
47 | } __packed; | 50 | } __packed; |
48 | 51 | ||
52 | struct mgmt_addr_info { | ||
53 | bdaddr_t bdaddr; | ||
54 | __u8 type; | ||
55 | } __packed; | ||
56 | #define MGMT_ADDR_INFO_SIZE 7 | ||
57 | |||
49 | #define MGMT_OP_READ_VERSION 0x0001 | 58 | #define MGMT_OP_READ_VERSION 0x0001 |
59 | #define MGMT_READ_VERSION_SIZE 0 | ||
50 | struct mgmt_rp_read_version { | 60 | struct mgmt_rp_read_version { |
51 | __u8 version; | 61 | __u8 version; |
52 | __le16 revision; | 62 | __le16 revision; |
63 | } __packed; | ||
64 | |||
65 | #define MGMT_OP_READ_COMMANDS 0x0002 | ||
66 | #define MGMT_READ_COMMANDS_SIZE 0 | ||
67 | struct mgmt_rp_read_commands { | ||
68 | __le16 num_commands; | ||
69 | __le16 num_events; | ||
70 | __le16 opcodes[0]; | ||
53 | } __packed; | 71 | } __packed; |
54 | 72 | ||
55 | #define MGMT_OP_READ_INDEX_LIST 0x0003 | 73 | #define MGMT_OP_READ_INDEX_LIST 0x0003 |
74 | #define MGMT_READ_INDEX_LIST_SIZE 0 | ||
56 | struct mgmt_rp_read_index_list { | 75 | struct mgmt_rp_read_index_list { |
57 | __le16 num_controllers; | 76 | __le16 num_controllers; |
58 | __le16 index[0]; | 77 | __le16 index[0]; |
59 | } __packed; | 78 | } __packed; |
60 | 79 | ||
61 | /* Reserve one extra byte for names in management messages so that they | 80 | /* Reserve one extra byte for names in management messages so that they |
62 | * are always guaranteed to be nul-terminated */ | 81 | * are always guaranteed to be nul-terminated */ |
63 | #define MGMT_MAX_NAME_LENGTH (HCI_MAX_NAME_LENGTH + 1) | 82 | #define MGMT_MAX_NAME_LENGTH (HCI_MAX_NAME_LENGTH + 1) |
64 | #define MGMT_MAX_SHORT_NAME_LENGTH (10 + 1) | 83 | #define MGMT_MAX_SHORT_NAME_LENGTH (HCI_MAX_SHORT_NAME_LENGTH + 1) |
65 | 84 | ||
66 | #define MGMT_SETTING_POWERED 0x00000001 | 85 | #define MGMT_SETTING_POWERED 0x00000001 |
67 | #define MGMT_SETTING_CONNECTABLE 0x00000002 | 86 | #define MGMT_SETTING_CONNECTABLE 0x00000002 |
@@ -75,28 +94,32 @@ struct mgmt_rp_read_index_list { | |||
75 | #define MGMT_SETTING_LE 0x00000200 | 94 | #define MGMT_SETTING_LE 0x00000200 |
76 | 95 | ||
77 | #define MGMT_OP_READ_INFO 0x0004 | 96 | #define MGMT_OP_READ_INFO 0x0004 |
97 | #define MGMT_READ_INFO_SIZE 0 | ||
78 | struct mgmt_rp_read_info { | 98 | struct mgmt_rp_read_info { |
79 | bdaddr_t bdaddr; | 99 | bdaddr_t bdaddr; |
80 | __u8 version; | 100 | __u8 version; |
81 | __le16 manufacturer; | 101 | __le16 manufacturer; |
82 | __le32 supported_settings; | 102 | __le32 supported_settings; |
83 | __le32 current_settings; | 103 | __le32 current_settings; |
84 | __u8 dev_class[3]; | 104 | __u8 dev_class[3]; |
85 | __u8 name[MGMT_MAX_NAME_LENGTH]; | 105 | __u8 name[MGMT_MAX_NAME_LENGTH]; |
86 | __u8 short_name[MGMT_MAX_SHORT_NAME_LENGTH]; | 106 | __u8 short_name[MGMT_MAX_SHORT_NAME_LENGTH]; |
87 | } __packed; | 107 | } __packed; |
88 | 108 | ||
89 | struct mgmt_mode { | 109 | struct mgmt_mode { |
90 | __u8 val; | 110 | __u8 val; |
91 | } __packed; | 111 | } __packed; |
92 | 112 | ||
113 | #define MGMT_SETTING_SIZE 1 | ||
114 | |||
93 | #define MGMT_OP_SET_POWERED 0x0005 | 115 | #define MGMT_OP_SET_POWERED 0x0005 |
94 | 116 | ||
95 | #define MGMT_OP_SET_DISCOVERABLE 0x0006 | 117 | #define MGMT_OP_SET_DISCOVERABLE 0x0006 |
96 | struct mgmt_cp_set_discoverable { | 118 | struct mgmt_cp_set_discoverable { |
97 | __u8 val; | 119 | __u8 val; |
98 | __u16 timeout; | 120 | __le16 timeout; |
99 | } __packed; | 121 | } __packed; |
122 | #define MGMT_SET_DISCOVERABLE_SIZE 3 | ||
100 | 123 | ||
101 | #define MGMT_OP_SET_CONNECTABLE 0x0007 | 124 | #define MGMT_OP_SET_CONNECTABLE 0x0007 |
102 | 125 | ||
@@ -111,73 +134,76 @@ struct mgmt_cp_set_discoverable { | |||
111 | #define MGMT_OP_SET_HS 0x000C | 134 | #define MGMT_OP_SET_HS 0x000C |
112 | 135 | ||
113 | #define MGMT_OP_SET_LE 0x000D | 136 | #define MGMT_OP_SET_LE 0x000D |
114 | |||
115 | #define MGMT_OP_SET_DEV_CLASS 0x000E | 137 | #define MGMT_OP_SET_DEV_CLASS 0x000E |
116 | struct mgmt_cp_set_dev_class { | 138 | struct mgmt_cp_set_dev_class { |
117 | __u8 major; | 139 | __u8 major; |
118 | __u8 minor; | 140 | __u8 minor; |
119 | } __packed; | 141 | } __packed; |
142 | #define MGMT_SET_DEV_CLASS_SIZE 2 | ||
120 | 143 | ||
121 | #define MGMT_OP_SET_LOCAL_NAME 0x000F | 144 | #define MGMT_OP_SET_LOCAL_NAME 0x000F |
122 | struct mgmt_cp_set_local_name { | 145 | struct mgmt_cp_set_local_name { |
123 | __u8 name[MGMT_MAX_NAME_LENGTH]; | 146 | __u8 name[MGMT_MAX_NAME_LENGTH]; |
147 | __u8 short_name[MGMT_MAX_SHORT_NAME_LENGTH]; | ||
124 | } __packed; | 148 | } __packed; |
149 | #define MGMT_SET_LOCAL_NAME_SIZE 260 | ||
125 | 150 | ||
126 | #define MGMT_OP_ADD_UUID 0x0010 | 151 | #define MGMT_OP_ADD_UUID 0x0010 |
127 | struct mgmt_cp_add_uuid { | 152 | struct mgmt_cp_add_uuid { |
128 | __u8 uuid[16]; | 153 | __u8 uuid[16]; |
129 | __u8 svc_hint; | 154 | __u8 svc_hint; |
130 | } __packed; | 155 | } __packed; |
156 | #define MGMT_ADD_UUID_SIZE 17 | ||
131 | 157 | ||
132 | #define MGMT_OP_REMOVE_UUID 0x0011 | 158 | #define MGMT_OP_REMOVE_UUID 0x0011 |
133 | struct mgmt_cp_remove_uuid { | 159 | struct mgmt_cp_remove_uuid { |
134 | __u8 uuid[16]; | 160 | __u8 uuid[16]; |
135 | } __packed; | 161 | } __packed; |
162 | #define MGMT_REMOVE_UUID_SIZE 16 | ||
136 | 163 | ||
137 | struct mgmt_link_key_info { | 164 | struct mgmt_link_key_info { |
138 | bdaddr_t bdaddr; | 165 | struct mgmt_addr_info addr; |
139 | u8 type; | 166 | __u8 type; |
140 | u8 val[16]; | 167 | __u8 val[16]; |
141 | u8 pin_len; | 168 | __u8 pin_len; |
142 | } __packed; | 169 | } __packed; |
143 | 170 | ||
144 | #define MGMT_OP_LOAD_LINK_KEYS 0x0012 | 171 | #define MGMT_OP_LOAD_LINK_KEYS 0x0012 |
145 | struct mgmt_cp_load_link_keys { | 172 | struct mgmt_cp_load_link_keys { |
146 | __u8 debug_keys; | 173 | __u8 debug_keys; |
147 | __le16 key_count; | 174 | __le16 key_count; |
148 | struct mgmt_link_key_info keys[0]; | 175 | struct mgmt_link_key_info keys[0]; |
149 | } __packed; | 176 | } __packed; |
177 | #define MGMT_LOAD_LINK_KEYS_SIZE 3 | ||
150 | 178 | ||
151 | #define MGMT_OP_REMOVE_KEYS 0x0013 | 179 | struct mgmt_ltk_info { |
152 | struct mgmt_cp_remove_keys { | 180 | struct mgmt_addr_info addr; |
153 | bdaddr_t bdaddr; | 181 | __u8 authenticated; |
154 | __u8 disconnect; | 182 | __u8 master; |
183 | __u8 enc_size; | ||
184 | __le16 ediv; | ||
185 | __u8 rand[8]; | ||
186 | __u8 val[16]; | ||
155 | } __packed; | 187 | } __packed; |
156 | struct mgmt_rp_remove_keys { | 188 | |
157 | bdaddr_t bdaddr; | 189 | #define MGMT_OP_LOAD_LONG_TERM_KEYS 0x0013 |
158 | __u8 status; | 190 | struct mgmt_cp_load_long_term_keys { |
159 | }; | 191 | __le16 key_count; |
192 | struct mgmt_ltk_info keys[0]; | ||
193 | } __packed; | ||
194 | #define MGMT_LOAD_LONG_TERM_KEYS_SIZE 2 | ||
160 | 195 | ||
161 | #define MGMT_OP_DISCONNECT 0x0014 | 196 | #define MGMT_OP_DISCONNECT 0x0014 |
162 | struct mgmt_cp_disconnect { | 197 | struct mgmt_cp_disconnect { |
163 | bdaddr_t bdaddr; | 198 | struct mgmt_addr_info addr; |
164 | } __packed; | 199 | } __packed; |
200 | #define MGMT_DISCONNECT_SIZE MGMT_ADDR_INFO_SIZE | ||
165 | struct mgmt_rp_disconnect { | 201 | struct mgmt_rp_disconnect { |
166 | bdaddr_t bdaddr; | 202 | struct mgmt_addr_info addr; |
167 | __u8 status; | ||
168 | } __packed; | ||
169 | |||
170 | #define MGMT_ADDR_BREDR 0x00 | ||
171 | #define MGMT_ADDR_LE_PUBLIC 0x01 | ||
172 | #define MGMT_ADDR_LE_RANDOM 0x02 | ||
173 | #define MGMT_ADDR_INVALID 0xff | ||
174 | |||
175 | struct mgmt_addr_info { | ||
176 | bdaddr_t bdaddr; | ||
177 | __u8 type; | ||
178 | } __packed; | 203 | } __packed; |
179 | 204 | ||
180 | #define MGMT_OP_GET_CONNECTIONS 0x0015 | 205 | #define MGMT_OP_GET_CONNECTIONS 0x0015 |
206 | #define MGMT_GET_CONNECTIONS_SIZE 0 | ||
181 | struct mgmt_rp_get_connections { | 207 | struct mgmt_rp_get_connections { |
182 | __le16 conn_count; | 208 | __le16 conn_count; |
183 | struct mgmt_addr_info addr[0]; | 209 | struct mgmt_addr_info addr[0]; |
@@ -185,124 +211,152 @@ struct mgmt_rp_get_connections { | |||
185 | 211 | ||
186 | #define MGMT_OP_PIN_CODE_REPLY 0x0016 | 212 | #define MGMT_OP_PIN_CODE_REPLY 0x0016 |
187 | struct mgmt_cp_pin_code_reply { | 213 | struct mgmt_cp_pin_code_reply { |
188 | bdaddr_t bdaddr; | 214 | struct mgmt_addr_info addr; |
189 | __u8 pin_len; | 215 | __u8 pin_len; |
190 | __u8 pin_code[16]; | 216 | __u8 pin_code[16]; |
191 | } __packed; | 217 | } __packed; |
218 | #define MGMT_PIN_CODE_REPLY_SIZE (MGMT_ADDR_INFO_SIZE + 17) | ||
192 | struct mgmt_rp_pin_code_reply { | 219 | struct mgmt_rp_pin_code_reply { |
193 | bdaddr_t bdaddr; | 220 | struct mgmt_addr_info addr; |
194 | uint8_t status; | ||
195 | } __packed; | 221 | } __packed; |
196 | 222 | ||
197 | #define MGMT_OP_PIN_CODE_NEG_REPLY 0x0017 | 223 | #define MGMT_OP_PIN_CODE_NEG_REPLY 0x0017 |
198 | struct mgmt_cp_pin_code_neg_reply { | 224 | struct mgmt_cp_pin_code_neg_reply { |
199 | bdaddr_t bdaddr; | 225 | struct mgmt_addr_info addr; |
200 | } __packed; | 226 | } __packed; |
227 | #define MGMT_PIN_CODE_NEG_REPLY_SIZE MGMT_ADDR_INFO_SIZE | ||
201 | 228 | ||
202 | #define MGMT_OP_SET_IO_CAPABILITY 0x0018 | 229 | #define MGMT_OP_SET_IO_CAPABILITY 0x0018 |
203 | struct mgmt_cp_set_io_capability { | 230 | struct mgmt_cp_set_io_capability { |
204 | __u8 io_capability; | 231 | __u8 io_capability; |
205 | } __packed; | 232 | } __packed; |
233 | #define MGMT_SET_IO_CAPABILITY_SIZE 1 | ||
206 | 234 | ||
207 | #define MGMT_OP_PAIR_DEVICE 0x0019 | 235 | #define MGMT_OP_PAIR_DEVICE 0x0019 |
208 | struct mgmt_cp_pair_device { | 236 | struct mgmt_cp_pair_device { |
209 | struct mgmt_addr_info addr; | 237 | struct mgmt_addr_info addr; |
210 | __u8 io_cap; | 238 | __u8 io_cap; |
211 | } __packed; | 239 | } __packed; |
240 | #define MGMT_PAIR_DEVICE_SIZE (MGMT_ADDR_INFO_SIZE + 1) | ||
212 | struct mgmt_rp_pair_device { | 241 | struct mgmt_rp_pair_device { |
213 | struct mgmt_addr_info addr; | 242 | struct mgmt_addr_info addr; |
214 | __u8 status; | ||
215 | } __packed; | 243 | } __packed; |
216 | 244 | ||
217 | #define MGMT_OP_USER_CONFIRM_REPLY 0x001A | 245 | #define MGMT_OP_CANCEL_PAIR_DEVICE 0x001A |
246 | #define MGMT_CANCEL_PAIR_DEVICE_SIZE MGMT_ADDR_INFO_SIZE | ||
247 | |||
248 | #define MGMT_OP_UNPAIR_DEVICE 0x001B | ||
249 | struct mgmt_cp_unpair_device { | ||
250 | struct mgmt_addr_info addr; | ||
251 | __u8 disconnect; | ||
252 | } __packed; | ||
253 | #define MGMT_UNPAIR_DEVICE_SIZE (MGMT_ADDR_INFO_SIZE + 1) | ||
254 | struct mgmt_rp_unpair_device { | ||
255 | struct mgmt_addr_info addr; | ||
256 | }; | ||
257 | |||
258 | #define MGMT_OP_USER_CONFIRM_REPLY 0x001C | ||
218 | struct mgmt_cp_user_confirm_reply { | 259 | struct mgmt_cp_user_confirm_reply { |
219 | bdaddr_t bdaddr; | 260 | struct mgmt_addr_info addr; |
220 | } __packed; | 261 | } __packed; |
262 | #define MGMT_USER_CONFIRM_REPLY_SIZE MGMT_ADDR_INFO_SIZE | ||
221 | struct mgmt_rp_user_confirm_reply { | 263 | struct mgmt_rp_user_confirm_reply { |
222 | bdaddr_t bdaddr; | 264 | struct mgmt_addr_info addr; |
223 | __u8 status; | ||
224 | } __packed; | 265 | } __packed; |
225 | 266 | ||
226 | #define MGMT_OP_USER_CONFIRM_NEG_REPLY 0x001B | 267 | #define MGMT_OP_USER_CONFIRM_NEG_REPLY 0x001D |
227 | struct mgmt_cp_user_confirm_neg_reply { | 268 | struct mgmt_cp_user_confirm_neg_reply { |
228 | bdaddr_t bdaddr; | 269 | struct mgmt_addr_info addr; |
229 | } __packed; | 270 | } __packed; |
271 | #define MGMT_USER_CONFIRM_NEG_REPLY_SIZE MGMT_ADDR_INFO_SIZE | ||
230 | 272 | ||
231 | #define MGMT_OP_USER_PASSKEY_REPLY 0x001C | 273 | #define MGMT_OP_USER_PASSKEY_REPLY 0x001E |
232 | struct mgmt_cp_user_passkey_reply { | 274 | struct mgmt_cp_user_passkey_reply { |
233 | bdaddr_t bdaddr; | 275 | struct mgmt_addr_info addr; |
234 | __le32 passkey; | 276 | __le32 passkey; |
235 | } __packed; | 277 | } __packed; |
278 | #define MGMT_USER_PASSKEY_REPLY_SIZE (MGMT_ADDR_INFO_SIZE + 4) | ||
236 | struct mgmt_rp_user_passkey_reply { | 279 | struct mgmt_rp_user_passkey_reply { |
237 | bdaddr_t bdaddr; | 280 | struct mgmt_addr_info addr; |
238 | __u8 status; | ||
239 | } __packed; | 281 | } __packed; |
240 | 282 | ||
241 | #define MGMT_OP_USER_PASSKEY_NEG_REPLY 0x001D | 283 | #define MGMT_OP_USER_PASSKEY_NEG_REPLY 0x001F |
242 | struct mgmt_cp_user_passkey_neg_reply { | 284 | struct mgmt_cp_user_passkey_neg_reply { |
243 | bdaddr_t bdaddr; | 285 | struct mgmt_addr_info addr; |
244 | } __packed; | 286 | } __packed; |
287 | #define MGMT_USER_PASSKEY_NEG_REPLY_SIZE MGMT_ADDR_INFO_SIZE | ||
245 | 288 | ||
246 | #define MGMT_OP_READ_LOCAL_OOB_DATA 0x001E | 289 | #define MGMT_OP_READ_LOCAL_OOB_DATA 0x0020 |
290 | #define MGMT_READ_LOCAL_OOB_DATA_SIZE 0 | ||
247 | struct mgmt_rp_read_local_oob_data { | 291 | struct mgmt_rp_read_local_oob_data { |
248 | __u8 hash[16]; | 292 | __u8 hash[16]; |
249 | __u8 randomizer[16]; | 293 | __u8 randomizer[16]; |
250 | } __packed; | 294 | } __packed; |
251 | 295 | ||
252 | #define MGMT_OP_ADD_REMOTE_OOB_DATA 0x001F | 296 | #define MGMT_OP_ADD_REMOTE_OOB_DATA 0x0021 |
253 | struct mgmt_cp_add_remote_oob_data { | 297 | struct mgmt_cp_add_remote_oob_data { |
254 | bdaddr_t bdaddr; | 298 | struct mgmt_addr_info addr; |
255 | __u8 hash[16]; | 299 | __u8 hash[16]; |
256 | __u8 randomizer[16]; | 300 | __u8 randomizer[16]; |
257 | } __packed; | 301 | } __packed; |
302 | #define MGMT_ADD_REMOTE_OOB_DATA_SIZE (MGMT_ADDR_INFO_SIZE + 32) | ||
258 | 303 | ||
259 | #define MGMT_OP_REMOVE_REMOTE_OOB_DATA 0x0020 | 304 | #define MGMT_OP_REMOVE_REMOTE_OOB_DATA 0x0022 |
260 | struct mgmt_cp_remove_remote_oob_data { | 305 | struct mgmt_cp_remove_remote_oob_data { |
261 | bdaddr_t bdaddr; | 306 | struct mgmt_addr_info addr; |
262 | } __packed; | 307 | } __packed; |
308 | #define MGMT_REMOVE_REMOTE_OOB_DATA_SIZE MGMT_ADDR_INFO_SIZE | ||
263 | 309 | ||
264 | #define MGMT_OP_START_DISCOVERY 0x0021 | 310 | #define MGMT_OP_START_DISCOVERY 0x0023 |
265 | struct mgmt_cp_start_discovery { | 311 | struct mgmt_cp_start_discovery { |
266 | __u8 type; | 312 | __u8 type; |
267 | } __packed; | 313 | } __packed; |
314 | #define MGMT_START_DISCOVERY_SIZE 1 | ||
268 | 315 | ||
269 | #define MGMT_OP_STOP_DISCOVERY 0x0022 | 316 | #define MGMT_OP_STOP_DISCOVERY 0x0024 |
317 | struct mgmt_cp_stop_discovery { | ||
318 | __u8 type; | ||
319 | } __packed; | ||
320 | #define MGMT_STOP_DISCOVERY_SIZE 1 | ||
270 | 321 | ||
271 | #define MGMT_OP_CONFIRM_NAME 0x0023 | 322 | #define MGMT_OP_CONFIRM_NAME 0x0025 |
272 | struct mgmt_cp_confirm_name { | 323 | struct mgmt_cp_confirm_name { |
273 | bdaddr_t bdaddr; | 324 | struct mgmt_addr_info addr; |
274 | __u8 name_known; | 325 | __u8 name_known; |
275 | } __packed; | 326 | } __packed; |
327 | #define MGMT_CONFIRM_NAME_SIZE (MGMT_ADDR_INFO_SIZE + 1) | ||
276 | struct mgmt_rp_confirm_name { | 328 | struct mgmt_rp_confirm_name { |
277 | bdaddr_t bdaddr; | 329 | struct mgmt_addr_info addr; |
278 | __u8 status; | ||
279 | } __packed; | 330 | } __packed; |
280 | 331 | ||
281 | #define MGMT_OP_BLOCK_DEVICE 0x0024 | 332 | #define MGMT_OP_BLOCK_DEVICE 0x0026 |
282 | struct mgmt_cp_block_device { | 333 | struct mgmt_cp_block_device { |
283 | bdaddr_t bdaddr; | 334 | struct mgmt_addr_info addr; |
284 | } __packed; | 335 | } __packed; |
336 | #define MGMT_BLOCK_DEVICE_SIZE MGMT_ADDR_INFO_SIZE | ||
285 | 337 | ||
286 | #define MGMT_OP_UNBLOCK_DEVICE 0x0025 | 338 | #define MGMT_OP_UNBLOCK_DEVICE 0x0027 |
287 | struct mgmt_cp_unblock_device { | 339 | struct mgmt_cp_unblock_device { |
288 | bdaddr_t bdaddr; | 340 | struct mgmt_addr_info addr; |
289 | } __packed; | 341 | } __packed; |
342 | #define MGMT_UNBLOCK_DEVICE_SIZE MGMT_ADDR_INFO_SIZE | ||
290 | 343 | ||
291 | #define MGMT_EV_CMD_COMPLETE 0x0001 | 344 | #define MGMT_EV_CMD_COMPLETE 0x0001 |
292 | struct mgmt_ev_cmd_complete { | 345 | struct mgmt_ev_cmd_complete { |
293 | __le16 opcode; | 346 | __le16 opcode; |
294 | __u8 data[0]; | 347 | __u8 status; |
348 | __u8 data[0]; | ||
295 | } __packed; | 349 | } __packed; |
296 | 350 | ||
297 | #define MGMT_EV_CMD_STATUS 0x0002 | 351 | #define MGMT_EV_CMD_STATUS 0x0002 |
298 | struct mgmt_ev_cmd_status { | 352 | struct mgmt_ev_cmd_status { |
299 | __u8 status; | 353 | __le16 opcode; |
300 | __le16 opcode; | 354 | __u8 status; |
301 | } __packed; | 355 | } __packed; |
302 | 356 | ||
303 | #define MGMT_EV_CONTROLLER_ERROR 0x0003 | 357 | #define MGMT_EV_CONTROLLER_ERROR 0x0003 |
304 | struct mgmt_ev_controller_error { | 358 | struct mgmt_ev_controller_error { |
305 | __u8 error_code; | 359 | __u8 error_code; |
306 | } __packed; | 360 | } __packed; |
307 | 361 | ||
308 | #define MGMT_EV_INDEX_ADDED 0x0004 | 362 | #define MGMT_EV_INDEX_ADDED 0x0004 |
@@ -313,78 +367,96 @@ struct mgmt_ev_controller_error { | |||
313 | 367 | ||
314 | #define MGMT_EV_CLASS_OF_DEV_CHANGED 0x0007 | 368 | #define MGMT_EV_CLASS_OF_DEV_CHANGED 0x0007 |
315 | struct mgmt_ev_class_of_dev_changed { | 369 | struct mgmt_ev_class_of_dev_changed { |
316 | __u8 dev_class[3]; | 370 | __u8 dev_class[3]; |
317 | }; | 371 | }; |
318 | 372 | ||
319 | #define MGMT_EV_LOCAL_NAME_CHANGED 0x0008 | 373 | #define MGMT_EV_LOCAL_NAME_CHANGED 0x0008 |
320 | struct mgmt_ev_local_name_changed { | 374 | struct mgmt_ev_local_name_changed { |
321 | __u8 name[MGMT_MAX_NAME_LENGTH]; | 375 | __u8 name[MGMT_MAX_NAME_LENGTH]; |
322 | __u8 short_name[MGMT_MAX_SHORT_NAME_LENGTH]; | 376 | __u8 short_name[MGMT_MAX_SHORT_NAME_LENGTH]; |
323 | } __packed; | 377 | } __packed; |
324 | 378 | ||
325 | #define MGMT_EV_NEW_LINK_KEY 0x0009 | 379 | #define MGMT_EV_NEW_LINK_KEY 0x0009 |
326 | struct mgmt_ev_new_link_key { | 380 | struct mgmt_ev_new_link_key { |
327 | __u8 store_hint; | 381 | __u8 store_hint; |
328 | struct mgmt_link_key_info key; | 382 | struct mgmt_link_key_info key; |
329 | } __packed; | 383 | } __packed; |
330 | 384 | ||
331 | #define MGMT_EV_CONNECTED 0x000A | 385 | #define MGMT_EV_NEW_LONG_TERM_KEY 0x000A |
386 | struct mgmt_ev_new_long_term_key { | ||
387 | __u8 store_hint; | ||
388 | struct mgmt_ltk_info key; | ||
389 | } __packed; | ||
332 | 390 | ||
333 | #define MGMT_EV_DISCONNECTED 0x000B | 391 | #define MGMT_EV_DEVICE_CONNECTED 0x000B |
392 | struct mgmt_ev_device_connected { | ||
393 | struct mgmt_addr_info addr; | ||
394 | __le32 flags; | ||
395 | __le16 eir_len; | ||
396 | __u8 eir[0]; | ||
397 | } __packed; | ||
398 | |||
399 | #define MGMT_EV_DEVICE_DISCONNECTED 0x000C | ||
334 | 400 | ||
335 | #define MGMT_EV_CONNECT_FAILED 0x000C | 401 | #define MGMT_EV_CONNECT_FAILED 0x000D |
336 | struct mgmt_ev_connect_failed { | 402 | struct mgmt_ev_connect_failed { |
337 | struct mgmt_addr_info addr; | 403 | struct mgmt_addr_info addr; |
338 | __u8 status; | 404 | __u8 status; |
339 | } __packed; | 405 | } __packed; |
340 | 406 | ||
341 | #define MGMT_EV_PIN_CODE_REQUEST 0x000D | 407 | #define MGMT_EV_PIN_CODE_REQUEST 0x000E |
342 | struct mgmt_ev_pin_code_request { | 408 | struct mgmt_ev_pin_code_request { |
343 | bdaddr_t bdaddr; | 409 | struct mgmt_addr_info addr; |
344 | __u8 secure; | 410 | __u8 secure; |
345 | } __packed; | 411 | } __packed; |
346 | 412 | ||
347 | #define MGMT_EV_USER_CONFIRM_REQUEST 0x000E | 413 | #define MGMT_EV_USER_CONFIRM_REQUEST 0x000F |
348 | struct mgmt_ev_user_confirm_request { | 414 | struct mgmt_ev_user_confirm_request { |
349 | bdaddr_t bdaddr; | 415 | struct mgmt_addr_info addr; |
350 | __u8 confirm_hint; | 416 | __u8 confirm_hint; |
351 | __le32 value; | 417 | __le32 value; |
352 | } __packed; | 418 | } __packed; |
353 | 419 | ||
354 | #define MGMT_EV_USER_PASSKEY_REQUEST 0x000F | 420 | #define MGMT_EV_USER_PASSKEY_REQUEST 0x0010 |
355 | struct mgmt_ev_user_passkey_request { | 421 | struct mgmt_ev_user_passkey_request { |
356 | bdaddr_t bdaddr; | 422 | struct mgmt_addr_info addr; |
357 | } __packed; | 423 | } __packed; |
358 | 424 | ||
359 | #define MGMT_EV_AUTH_FAILED 0x0010 | 425 | #define MGMT_EV_AUTH_FAILED 0x0011 |
360 | struct mgmt_ev_auth_failed { | 426 | struct mgmt_ev_auth_failed { |
361 | bdaddr_t bdaddr; | 427 | struct mgmt_addr_info addr; |
362 | __u8 status; | 428 | __u8 status; |
363 | } __packed; | 429 | } __packed; |
364 | 430 | ||
365 | #define MGMT_EV_DEVICE_FOUND 0x0011 | 431 | #define MGMT_DEV_FOUND_CONFIRM_NAME 0x01 |
432 | #define MGMT_DEV_FOUND_LEGACY_PAIRING 0x02 | ||
433 | |||
434 | #define MGMT_EV_DEVICE_FOUND 0x0012 | ||
366 | struct mgmt_ev_device_found { | 435 | struct mgmt_ev_device_found { |
367 | struct mgmt_addr_info addr; | 436 | struct mgmt_addr_info addr; |
368 | __u8 dev_class[3]; | 437 | __s8 rssi; |
369 | __s8 rssi; | 438 | __u8 flags[4]; |
370 | __u8 confirm_name; | 439 | __le16 eir_len; |
371 | __u8 eir[HCI_MAX_EIR_LENGTH]; | 440 | __u8 eir[0]; |
372 | } __packed; | ||
373 | |||
374 | #define MGMT_EV_REMOTE_NAME 0x0012 | ||
375 | struct mgmt_ev_remote_name { | ||
376 | bdaddr_t bdaddr; | ||
377 | __u8 name[MGMT_MAX_NAME_LENGTH]; | ||
378 | } __packed; | 441 | } __packed; |
379 | 442 | ||
380 | #define MGMT_EV_DISCOVERING 0x0013 | 443 | #define MGMT_EV_DISCOVERING 0x0013 |
444 | struct mgmt_ev_discovering { | ||
445 | __u8 type; | ||
446 | __u8 discovering; | ||
447 | } __packed; | ||
381 | 448 | ||
382 | #define MGMT_EV_DEVICE_BLOCKED 0x0014 | 449 | #define MGMT_EV_DEVICE_BLOCKED 0x0014 |
383 | struct mgmt_ev_device_blocked { | 450 | struct mgmt_ev_device_blocked { |
384 | bdaddr_t bdaddr; | 451 | struct mgmt_addr_info addr; |
385 | } __packed; | 452 | } __packed; |
386 | 453 | ||
387 | #define MGMT_EV_DEVICE_UNBLOCKED 0x0015 | 454 | #define MGMT_EV_DEVICE_UNBLOCKED 0x0015 |
388 | struct mgmt_ev_device_unblocked { | 455 | struct mgmt_ev_device_unblocked { |
389 | bdaddr_t bdaddr; | 456 | struct mgmt_addr_info addr; |
457 | } __packed; | ||
458 | |||
459 | #define MGMT_EV_DEVICE_UNPAIRED 0x0016 | ||
460 | struct mgmt_ev_device_unpaired { | ||
461 | struct mgmt_addr_info addr; | ||
390 | } __packed; | 462 | } __packed; |
diff --git a/include/net/bluetooth/smp.h b/include/net/bluetooth/smp.h index aeaf5fa2b9f1..7b3acdd29134 100644 --- a/include/net/bluetooth/smp.h +++ b/include/net/bluetooth/smp.h | |||
@@ -127,7 +127,7 @@ struct smp_chan { | |||
127 | u8 rrnd[16]; /* SMP Pairing Random (remote) */ | 127 | u8 rrnd[16]; /* SMP Pairing Random (remote) */ |
128 | u8 pcnf[16]; /* SMP Pairing Confirm */ | 128 | u8 pcnf[16]; /* SMP Pairing Confirm */ |
129 | u8 tk[16]; /* SMP Temporary Key */ | 129 | u8 tk[16]; /* SMP Temporary Key */ |
130 | u8 smp_key_size; | 130 | u8 enc_key_size; |
131 | unsigned long smp_flags; | 131 | unsigned long smp_flags; |
132 | struct crypto_blkcipher *tfm; | 132 | struct crypto_blkcipher *tfm; |
133 | struct work_struct confirm; | 133 | struct work_struct confirm; |
diff --git a/include/net/caif/caif_hsi.h b/include/net/caif/caif_hsi.h index 8d552519ff67..6db8ecf52aa2 100644 --- a/include/net/caif/caif_hsi.h +++ b/include/net/caif/caif_hsi.h | |||
@@ -138,6 +138,7 @@ struct cfhsi { | |||
138 | u8 *rx_ptr; | 138 | u8 *rx_ptr; |
139 | u8 *tx_buf; | 139 | u8 *tx_buf; |
140 | u8 *rx_buf; | 140 | u8 *rx_buf; |
141 | u8 *rx_flip_buf; | ||
141 | spinlock_t lock; | 142 | spinlock_t lock; |
142 | int flow_off_sent; | 143 | int flow_off_sent; |
143 | u32 q_low_mark; | 144 | u32 q_low_mark; |
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h index a067d30ce73e..83d800c31e3c 100644 --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h | |||
@@ -13,6 +13,7 @@ | |||
13 | #include <linux/netdevice.h> | 13 | #include <linux/netdevice.h> |
14 | #include <linux/debugfs.h> | 14 | #include <linux/debugfs.h> |
15 | #include <linux/list.h> | 15 | #include <linux/list.h> |
16 | #include <linux/bug.h> | ||
16 | #include <linux/netlink.h> | 17 | #include <linux/netlink.h> |
17 | #include <linux/skbuff.h> | 18 | #include <linux/skbuff.h> |
18 | #include <linux/nl80211.h> | 19 | #include <linux/nl80211.h> |
@@ -120,6 +121,7 @@ enum ieee80211_channel_flags { | |||
120 | * @band: band this channel belongs to. | 121 | * @band: band this channel belongs to. |
121 | * @max_antenna_gain: maximum antenna gain in dBi | 122 | * @max_antenna_gain: maximum antenna gain in dBi |
122 | * @max_power: maximum transmission power (in dBm) | 123 | * @max_power: maximum transmission power (in dBm) |
124 | * @max_reg_power: maximum regulatory transmission power (in dBm) | ||
123 | * @beacon_found: helper to regulatory code to indicate when a beacon | 125 | * @beacon_found: helper to regulatory code to indicate when a beacon |
124 | * has been found on this channel. Use regulatory_hint_found_beacon() | 126 | * has been found on this channel. Use regulatory_hint_found_beacon() |
125 | * to enable this, this is useful only on 5 GHz band. | 127 | * to enable this, this is useful only on 5 GHz band. |
@@ -133,6 +135,7 @@ struct ieee80211_channel { | |||
133 | u32 flags; | 135 | u32 flags; |
134 | int max_antenna_gain; | 136 | int max_antenna_gain; |
135 | int max_power; | 137 | int max_power; |
138 | int max_reg_power; | ||
136 | bool beacon_found; | 139 | bool beacon_found; |
137 | u32 orig_flags; | 140 | u32 orig_flags; |
138 | int orig_mag, orig_mpwr; | 141 | int orig_mag, orig_mpwr; |
@@ -364,25 +367,13 @@ struct cfg80211_crypto_settings { | |||
364 | }; | 367 | }; |
365 | 368 | ||
366 | /** | 369 | /** |
367 | * struct beacon_parameters - beacon parameters | 370 | * struct cfg80211_beacon_data - beacon data |
368 | * | ||
369 | * Used to configure the beacon for an interface. | ||
370 | * | ||
371 | * @head: head portion of beacon (before TIM IE) | 371 | * @head: head portion of beacon (before TIM IE) |
372 | * or %NULL if not changed | 372 | * or %NULL if not changed |
373 | * @tail: tail portion of beacon (after TIM IE) | 373 | * @tail: tail portion of beacon (after TIM IE) |
374 | * or %NULL if not changed | 374 | * or %NULL if not changed |
375 | * @interval: beacon interval or zero if not changed | ||
376 | * @dtim_period: DTIM period or zero if not changed | ||
377 | * @head_len: length of @head | 375 | * @head_len: length of @head |
378 | * @tail_len: length of @tail | 376 | * @tail_len: length of @tail |
379 | * @ssid: SSID to be used in the BSS (note: may be %NULL if not provided from | ||
380 | * user space) | ||
381 | * @ssid_len: length of @ssid | ||
382 | * @hidden_ssid: whether to hide the SSID in Beacon/Probe Response frames | ||
383 | * @crypto: crypto settings | ||
384 | * @privacy: the BSS uses privacy | ||
385 | * @auth_type: Authentication type (algorithm) | ||
386 | * @beacon_ies: extra information element(s) to add into Beacon frames or %NULL | 377 | * @beacon_ies: extra information element(s) to add into Beacon frames or %NULL |
387 | * @beacon_ies_len: length of beacon_ies in octets | 378 | * @beacon_ies_len: length of beacon_ies in octets |
388 | * @proberesp_ies: extra information element(s) to add into Probe Response | 379 | * @proberesp_ies: extra information element(s) to add into Probe Response |
@@ -394,24 +385,48 @@ struct cfg80211_crypto_settings { | |||
394 | * @probe_resp_len: length of probe response template (@probe_resp) | 385 | * @probe_resp_len: length of probe response template (@probe_resp) |
395 | * @probe_resp: probe response template (AP mode only) | 386 | * @probe_resp: probe response template (AP mode only) |
396 | */ | 387 | */ |
397 | struct beacon_parameters { | 388 | struct cfg80211_beacon_data { |
398 | u8 *head, *tail; | 389 | const u8 *head, *tail; |
399 | int interval, dtim_period; | 390 | const u8 *beacon_ies; |
400 | int head_len, tail_len; | 391 | const u8 *proberesp_ies; |
392 | const u8 *assocresp_ies; | ||
393 | const u8 *probe_resp; | ||
394 | |||
395 | size_t head_len, tail_len; | ||
396 | size_t beacon_ies_len; | ||
397 | size_t proberesp_ies_len; | ||
398 | size_t assocresp_ies_len; | ||
399 | size_t probe_resp_len; | ||
400 | }; | ||
401 | |||
402 | /** | ||
403 | * struct cfg80211_ap_settings - AP configuration | ||
404 | * | ||
405 | * Used to configure an AP interface. | ||
406 | * | ||
407 | * @beacon: beacon data | ||
408 | * @beacon_interval: beacon interval | ||
409 | * @dtim_period: DTIM period | ||
410 | * @ssid: SSID to be used in the BSS (note: may be %NULL if not provided from | ||
411 | * user space) | ||
412 | * @ssid_len: length of @ssid | ||
413 | * @hidden_ssid: whether to hide the SSID in Beacon/Probe Response frames | ||
414 | * @crypto: crypto settings | ||
415 | * @privacy: the BSS uses privacy | ||
416 | * @auth_type: Authentication type (algorithm) | ||
417 | * @inactivity_timeout: time in seconds to determine station's inactivity. | ||
418 | */ | ||
419 | struct cfg80211_ap_settings { | ||
420 | struct cfg80211_beacon_data beacon; | ||
421 | |||
422 | int beacon_interval, dtim_period; | ||
401 | const u8 *ssid; | 423 | const u8 *ssid; |
402 | size_t ssid_len; | 424 | size_t ssid_len; |
403 | enum nl80211_hidden_ssid hidden_ssid; | 425 | enum nl80211_hidden_ssid hidden_ssid; |
404 | struct cfg80211_crypto_settings crypto; | 426 | struct cfg80211_crypto_settings crypto; |
405 | bool privacy; | 427 | bool privacy; |
406 | enum nl80211_auth_type auth_type; | 428 | enum nl80211_auth_type auth_type; |
407 | const u8 *beacon_ies; | 429 | int inactivity_timeout; |
408 | size_t beacon_ies_len; | ||
409 | const u8 *proberesp_ies; | ||
410 | size_t proberesp_ies_len; | ||
411 | const u8 *assocresp_ies; | ||
412 | size_t assocresp_ies_len; | ||
413 | int probe_resp_len; | ||
414 | u8 *probe_resp; | ||
415 | }; | 430 | }; |
416 | 431 | ||
417 | /** | 432 | /** |
@@ -605,8 +620,10 @@ struct sta_bss_parameters { | |||
605 | * @llid: mesh local link id | 620 | * @llid: mesh local link id |
606 | * @plid: mesh peer link id | 621 | * @plid: mesh peer link id |
607 | * @plink_state: mesh peer link state | 622 | * @plink_state: mesh peer link state |
608 | * @signal: signal strength of last received packet in dBm | 623 | * @signal: the signal strength, type depends on the wiphy's signal_type |
609 | * @signal_avg: signal strength average in dBm | 624 | NOTE: For CFG80211_SIGNAL_TYPE_MBM, value is expressed in _dBm_. |
625 | * @signal_avg: avg signal strength, type depends on the wiphy's signal_type | ||
626 | NOTE: For CFG80211_SIGNAL_TYPE_MBM, value is expressed in _dBm_. | ||
610 | * @txrate: current unicast bitrate from this station | 627 | * @txrate: current unicast bitrate from this station |
611 | * @rxrate: current unicast bitrate to this station | 628 | * @rxrate: current unicast bitrate to this station |
612 | * @rx_packets: packets received from this station | 629 | * @rx_packets: packets received from this station |
@@ -796,6 +813,8 @@ struct mesh_config { | |||
796 | * mesh gate, but not necessarily using the gate announcement protocol. | 813 | * mesh gate, but not necessarily using the gate announcement protocol. |
797 | * Still keeping the same nomenclature to be in sync with the spec. */ | 814 | * Still keeping the same nomenclature to be in sync with the spec. */ |
798 | bool dot11MeshGateAnnouncementProtocol; | 815 | bool dot11MeshGateAnnouncementProtocol; |
816 | bool dot11MeshForwarding; | ||
817 | s32 rssi_threshold; | ||
799 | }; | 818 | }; |
800 | 819 | ||
801 | /** | 820 | /** |
@@ -1036,10 +1055,6 @@ const u8 *ieee80211_bss_get_ie(struct cfg80211_bss *bss, u8 ie); | |||
1036 | * @key_len: length of WEP key for shared key authentication | 1055 | * @key_len: length of WEP key for shared key authentication |
1037 | * @key_idx: index of WEP key for shared key authentication | 1056 | * @key_idx: index of WEP key for shared key authentication |
1038 | * @key: WEP key for shared key authentication | 1057 | * @key: WEP key for shared key authentication |
1039 | * @local_state_change: This is a request for a local state only, i.e., no | ||
1040 | * Authentication frame is to be transmitted and authentication state is | ||
1041 | * to be changed without having to wait for a response from the peer STA | ||
1042 | * (AP). | ||
1043 | */ | 1058 | */ |
1044 | struct cfg80211_auth_request { | 1059 | struct cfg80211_auth_request { |
1045 | struct cfg80211_bss *bss; | 1060 | struct cfg80211_bss *bss; |
@@ -1048,7 +1063,6 @@ struct cfg80211_auth_request { | |||
1048 | enum nl80211_auth_type auth_type; | 1063 | enum nl80211_auth_type auth_type; |
1049 | const u8 *key; | 1064 | const u8 *key; |
1050 | u8 key_len, key_idx; | 1065 | u8 key_len, key_idx; |
1051 | bool local_state_change; | ||
1052 | }; | 1066 | }; |
1053 | 1067 | ||
1054 | /** | 1068 | /** |
@@ -1065,7 +1079,11 @@ enum cfg80211_assoc_req_flags { | |||
1065 | * | 1079 | * |
1066 | * This structure provides information needed to complete IEEE 802.11 | 1080 | * This structure provides information needed to complete IEEE 802.11 |
1067 | * (re)association. | 1081 | * (re)association. |
1068 | * @bss: The BSS to associate with. | 1082 | * @bss: The BSS to associate with. If the call is successful the driver |
1083 | * is given a reference that it must release, normally via a call to | ||
1084 | * cfg80211_send_rx_assoc(), or, if association timed out, with a | ||
1085 | * call to cfg80211_put_bss() (in addition to calling | ||
1086 | * cfg80211_send_assoc_timeout()) | ||
1069 | * @ie: Extra IEs to add to (Re)Association Request frame or %NULL | 1087 | * @ie: Extra IEs to add to (Re)Association Request frame or %NULL |
1070 | * @ie_len: Length of ie buffer in octets | 1088 | * @ie_len: Length of ie buffer in octets |
1071 | * @use_mfp: Use management frame protection (IEEE 802.11w) in this association | 1089 | * @use_mfp: Use management frame protection (IEEE 802.11w) in this association |
@@ -1093,19 +1111,16 @@ struct cfg80211_assoc_request { | |||
1093 | * This structure provides information needed to complete IEEE 802.11 | 1111 | * This structure provides information needed to complete IEEE 802.11 |
1094 | * deauthentication. | 1112 | * deauthentication. |
1095 | * | 1113 | * |
1096 | * @bss: the BSS to deauthenticate from | 1114 | * @bssid: the BSSID of the BSS to deauthenticate from |
1097 | * @ie: Extra IEs to add to Deauthentication frame or %NULL | 1115 | * @ie: Extra IEs to add to Deauthentication frame or %NULL |
1098 | * @ie_len: Length of ie buffer in octets | 1116 | * @ie_len: Length of ie buffer in octets |
1099 | * @reason_code: The reason code for the deauthentication | 1117 | * @reason_code: The reason code for the deauthentication |
1100 | * @local_state_change: This is a request for a local state only, i.e., no | ||
1101 | * Deauthentication frame is to be transmitted. | ||
1102 | */ | 1118 | */ |
1103 | struct cfg80211_deauth_request { | 1119 | struct cfg80211_deauth_request { |
1104 | struct cfg80211_bss *bss; | 1120 | const u8 *bssid; |
1105 | const u8 *ie; | 1121 | const u8 *ie; |
1106 | size_t ie_len; | 1122 | size_t ie_len; |
1107 | u16 reason_code; | 1123 | u16 reason_code; |
1108 | bool local_state_change; | ||
1109 | }; | 1124 | }; |
1110 | 1125 | ||
1111 | /** | 1126 | /** |
@@ -1148,6 +1163,10 @@ struct cfg80211_disassoc_request { | |||
1148 | * @beacon_interval: beacon interval to use | 1163 | * @beacon_interval: beacon interval to use |
1149 | * @privacy: this is a protected network, keys will be configured | 1164 | * @privacy: this is a protected network, keys will be configured |
1150 | * after joining | 1165 | * after joining |
1166 | * @control_port: whether user space controls IEEE 802.1X port, i.e., | ||
1167 | * sets/clears %NL80211_STA_FLAG_AUTHORIZED. If true, the driver is | ||
1168 | * required to assume that the port is unauthorized until authorized by | ||
1169 | * user space. Otherwise, port is marked authorized by default. | ||
1151 | * @basic_rates: bitmap of basic rates to use when creating the IBSS | 1170 | * @basic_rates: bitmap of basic rates to use when creating the IBSS |
1152 | * @mcast_rate: per-band multicast rate index + 1 (0: disabled) | 1171 | * @mcast_rate: per-band multicast rate index + 1 (0: disabled) |
1153 | */ | 1172 | */ |
@@ -1162,6 +1181,7 @@ struct cfg80211_ibss_params { | |||
1162 | u32 basic_rates; | 1181 | u32 basic_rates; |
1163 | bool channel_fixed; | 1182 | bool channel_fixed; |
1164 | bool privacy; | 1183 | bool privacy; |
1184 | bool control_port; | ||
1165 | int mcast_rate[IEEE80211_NUM_BANDS]; | 1185 | int mcast_rate[IEEE80211_NUM_BANDS]; |
1166 | }; | 1186 | }; |
1167 | 1187 | ||
@@ -1186,6 +1206,8 @@ struct cfg80211_ibss_params { | |||
1186 | * @key_idx: index of WEP key for shared key authentication | 1206 | * @key_idx: index of WEP key for shared key authentication |
1187 | * @key: WEP key for shared key authentication | 1207 | * @key: WEP key for shared key authentication |
1188 | * @flags: See &enum cfg80211_assoc_req_flags | 1208 | * @flags: See &enum cfg80211_assoc_req_flags |
1209 | * @bg_scan_period: Background scan period in seconds | ||
1210 | * or -1 to indicate that default value is to be used. | ||
1189 | * @ht_capa: HT Capabilities over-rides. Values set in ht_capa_mask | 1211 | * @ht_capa: HT Capabilities over-rides. Values set in ht_capa_mask |
1190 | * will be used in ht_capa. Un-supported values will be ignored. | 1212 | * will be used in ht_capa. Un-supported values will be ignored. |
1191 | * @ht_capa_mask: The bits of ht_capa which are to be used. | 1213 | * @ht_capa_mask: The bits of ht_capa which are to be used. |
@@ -1203,6 +1225,7 @@ struct cfg80211_connect_params { | |||
1203 | const u8 *key; | 1225 | const u8 *key; |
1204 | u8 key_len, key_idx; | 1226 | u8 key_len, key_idx; |
1205 | u32 flags; | 1227 | u32 flags; |
1228 | int bg_scan_period; | ||
1206 | struct ieee80211_ht_cap ht_capa; | 1229 | struct ieee80211_ht_cap ht_capa; |
1207 | struct ieee80211_ht_cap ht_capa_mask; | 1230 | struct ieee80211_ht_cap ht_capa_mask; |
1208 | }; | 1231 | }; |
@@ -1229,8 +1252,7 @@ enum wiphy_params_flags { | |||
1229 | struct cfg80211_bitrate_mask { | 1252 | struct cfg80211_bitrate_mask { |
1230 | struct { | 1253 | struct { |
1231 | u32 legacy; | 1254 | u32 legacy; |
1232 | /* TODO: add support for masking MCS rates; e.g.: */ | 1255 | u8 mcs[IEEE80211_HT_MCS_MASK_LEN]; |
1233 | /* u8 mcs[IEEE80211_HT_MCS_MASK_LEN]; */ | ||
1234 | } control[IEEE80211_NUM_BANDS]; | 1256 | } control[IEEE80211_NUM_BANDS]; |
1235 | }; | 1257 | }; |
1236 | /** | 1258 | /** |
@@ -1343,12 +1365,10 @@ struct cfg80211_gtk_rekey_data { | |||
1343 | * | 1365 | * |
1344 | * @set_rekey_data: give the data necessary for GTK rekeying to the driver | 1366 | * @set_rekey_data: give the data necessary for GTK rekeying to the driver |
1345 | * | 1367 | * |
1346 | * @add_beacon: Add a beacon with given parameters, @head, @interval | 1368 | * @start_ap: Start acting in AP mode defined by the parameters. |
1347 | * and @dtim_period will be valid, @tail is optional. | 1369 | * @change_beacon: Change the beacon parameters for an access point mode |
1348 | * @set_beacon: Change the beacon parameters for an access point mode | 1370 | * interface. This should reject the call when AP mode wasn't started. |
1349 | * interface. This should reject the call when no beacon has been | 1371 | * @stop_ap: Stop being an AP, including stopping beaconing. |
1350 | * configured. | ||
1351 | * @del_beacon: Remove beacon configuration and stop sending the beacon. | ||
1352 | * | 1372 | * |
1353 | * @add_station: Add a new station. | 1373 | * @add_station: Add a new station. |
1354 | * @del_station: Remove a station; @mac may be NULL to remove all stations. | 1374 | * @del_station: Remove a station; @mac may be NULL to remove all stations. |
@@ -1515,11 +1535,11 @@ struct cfg80211_ops { | |||
1515 | struct net_device *netdev, | 1535 | struct net_device *netdev, |
1516 | u8 key_index); | 1536 | u8 key_index); |
1517 | 1537 | ||
1518 | int (*add_beacon)(struct wiphy *wiphy, struct net_device *dev, | 1538 | int (*start_ap)(struct wiphy *wiphy, struct net_device *dev, |
1519 | struct beacon_parameters *info); | 1539 | struct cfg80211_ap_settings *settings); |
1520 | int (*set_beacon)(struct wiphy *wiphy, struct net_device *dev, | 1540 | int (*change_beacon)(struct wiphy *wiphy, struct net_device *dev, |
1521 | struct beacon_parameters *info); | 1541 | struct cfg80211_beacon_data *info); |
1522 | int (*del_beacon)(struct wiphy *wiphy, struct net_device *dev); | 1542 | int (*stop_ap)(struct wiphy *wiphy, struct net_device *dev); |
1523 | 1543 | ||
1524 | 1544 | ||
1525 | int (*add_station)(struct wiphy *wiphy, struct net_device *dev, | 1545 | int (*add_station)(struct wiphy *wiphy, struct net_device *dev, |
@@ -1574,11 +1594,9 @@ struct cfg80211_ops { | |||
1574 | int (*assoc)(struct wiphy *wiphy, struct net_device *dev, | 1594 | int (*assoc)(struct wiphy *wiphy, struct net_device *dev, |
1575 | struct cfg80211_assoc_request *req); | 1595 | struct cfg80211_assoc_request *req); |
1576 | int (*deauth)(struct wiphy *wiphy, struct net_device *dev, | 1596 | int (*deauth)(struct wiphy *wiphy, struct net_device *dev, |
1577 | struct cfg80211_deauth_request *req, | 1597 | struct cfg80211_deauth_request *req); |
1578 | void *cookie); | ||
1579 | int (*disassoc)(struct wiphy *wiphy, struct net_device *dev, | 1598 | int (*disassoc)(struct wiphy *wiphy, struct net_device *dev, |
1580 | struct cfg80211_disassoc_request *req, | 1599 | struct cfg80211_disassoc_request *req); |
1581 | void *cookie); | ||
1582 | 1600 | ||
1583 | int (*connect)(struct wiphy *wiphy, struct net_device *dev, | 1601 | int (*connect)(struct wiphy *wiphy, struct net_device *dev, |
1584 | struct cfg80211_connect_params *sme); | 1602 | struct cfg80211_connect_params *sme); |
@@ -2204,8 +2222,6 @@ struct cfg80211_conn; | |||
2204 | struct cfg80211_internal_bss; | 2222 | struct cfg80211_internal_bss; |
2205 | struct cfg80211_cached_keys; | 2223 | struct cfg80211_cached_keys; |
2206 | 2224 | ||
2207 | #define MAX_AUTH_BSSES 4 | ||
2208 | |||
2209 | /** | 2225 | /** |
2210 | * struct wireless_dev - wireless per-netdev state | 2226 | * struct wireless_dev - wireless per-netdev state |
2211 | * | 2227 | * |
@@ -2269,8 +2285,6 @@ struct wireless_dev { | |||
2269 | struct list_head event_list; | 2285 | struct list_head event_list; |
2270 | spinlock_t event_lock; | 2286 | spinlock_t event_lock; |
2271 | 2287 | ||
2272 | struct cfg80211_internal_bss *authtry_bsses[MAX_AUTH_BSSES]; | ||
2273 | struct cfg80211_internal_bss *auth_bsses[MAX_AUTH_BSSES]; | ||
2274 | struct cfg80211_internal_bss *current_bss; /* associated / joined */ | 2288 | struct cfg80211_internal_bss *current_bss; /* associated / joined */ |
2275 | struct ieee80211_channel *channel; | 2289 | struct ieee80211_channel *channel; |
2276 | 2290 | ||
@@ -2686,7 +2700,7 @@ cfg80211_inform_bss_frame(struct wiphy *wiphy, | |||
2686 | * @wiphy: the wiphy reporting the BSS | 2700 | * @wiphy: the wiphy reporting the BSS |
2687 | * @channel: The channel the frame was received on | 2701 | * @channel: The channel the frame was received on |
2688 | * @bssid: the BSSID of the BSS | 2702 | * @bssid: the BSSID of the BSS |
2689 | * @timestamp: the TSF timestamp sent by the peer | 2703 | * @tsf: the TSF sent by the peer in the beacon/probe response (or 0) |
2690 | * @capability: the capability field sent by the peer | 2704 | * @capability: the capability field sent by the peer |
2691 | * @beacon_interval: the beacon interval announced by the peer | 2705 | * @beacon_interval: the beacon interval announced by the peer |
2692 | * @ie: additional IEs sent by the peer | 2706 | * @ie: additional IEs sent by the peer |
@@ -2702,9 +2716,8 @@ cfg80211_inform_bss_frame(struct wiphy *wiphy, | |||
2702 | struct cfg80211_bss * __must_check | 2716 | struct cfg80211_bss * __must_check |
2703 | cfg80211_inform_bss(struct wiphy *wiphy, | 2717 | cfg80211_inform_bss(struct wiphy *wiphy, |
2704 | struct ieee80211_channel *channel, | 2718 | struct ieee80211_channel *channel, |
2705 | const u8 *bssid, | 2719 | const u8 *bssid, u64 tsf, u16 capability, |
2706 | u64 timestamp, u16 capability, u16 beacon_interval, | 2720 | u16 beacon_interval, const u8 *ie, size_t ielen, |
2707 | const u8 *ie, size_t ielen, | ||
2708 | s32 signal, gfp_t gfp); | 2721 | s32 signal, gfp_t gfp); |
2709 | 2722 | ||
2710 | struct cfg80211_bss *cfg80211_get_bss(struct wiphy *wiphy, | 2723 | struct cfg80211_bss *cfg80211_get_bss(struct wiphy *wiphy, |
@@ -2725,6 +2738,20 @@ struct cfg80211_bss *cfg80211_get_mesh(struct wiphy *wiphy, | |||
2725 | struct ieee80211_channel *channel, | 2738 | struct ieee80211_channel *channel, |
2726 | const u8 *meshid, size_t meshidlen, | 2739 | const u8 *meshid, size_t meshidlen, |
2727 | const u8 *meshcfg); | 2740 | const u8 *meshcfg); |
2741 | /** | ||
2742 | * cfg80211_ref_bss - reference BSS struct | ||
2743 | * @bss: the BSS struct to reference | ||
2744 | * | ||
2745 | * Increments the refcount of the given BSS struct. | ||
2746 | */ | ||
2747 | void cfg80211_ref_bss(struct cfg80211_bss *bss); | ||
2748 | |||
2749 | /** | ||
2750 | * cfg80211_put_bss - unref BSS struct | ||
2751 | * @bss: the BSS struct | ||
2752 | * | ||
2753 | * Decrements the refcount of the given BSS struct. | ||
2754 | */ | ||
2728 | void cfg80211_put_bss(struct cfg80211_bss *bss); | 2755 | void cfg80211_put_bss(struct cfg80211_bss *bss); |
2729 | 2756 | ||
2730 | /** | 2757 | /** |
@@ -2762,20 +2789,10 @@ void cfg80211_send_rx_auth(struct net_device *dev, const u8 *buf, size_t len); | |||
2762 | void cfg80211_send_auth_timeout(struct net_device *dev, const u8 *addr); | 2789 | void cfg80211_send_auth_timeout(struct net_device *dev, const u8 *addr); |
2763 | 2790 | ||
2764 | /** | 2791 | /** |
2765 | * __cfg80211_auth_canceled - notify cfg80211 that authentication was canceled | ||
2766 | * @dev: network device | ||
2767 | * @addr: The MAC address of the device with which the authentication timed out | ||
2768 | * | ||
2769 | * When a pending authentication had no action yet, the driver may decide | ||
2770 | * to not send a deauth frame, but in that case must calls this function | ||
2771 | * to tell cfg80211 about this decision. It is only valid to call this | ||
2772 | * function within the deauth() callback. | ||
2773 | */ | ||
2774 | void __cfg80211_auth_canceled(struct net_device *dev, const u8 *addr); | ||
2775 | |||
2776 | /** | ||
2777 | * cfg80211_send_rx_assoc - notification of processed association | 2792 | * cfg80211_send_rx_assoc - notification of processed association |
2778 | * @dev: network device | 2793 | * @dev: network device |
2794 | * @bss: the BSS struct association was requested for, the struct reference | ||
2795 | * is owned by cfg80211 after this call | ||
2779 | * @buf: (re)association response frame (header + body) | 2796 | * @buf: (re)association response frame (header + body) |
2780 | * @len: length of the frame data | 2797 | * @len: length of the frame data |
2781 | * | 2798 | * |
@@ -2784,7 +2801,8 @@ void __cfg80211_auth_canceled(struct net_device *dev, const u8 *addr); | |||
2784 | * function or cfg80211_send_assoc_timeout() to indicate the result of | 2801 | * function or cfg80211_send_assoc_timeout() to indicate the result of |
2785 | * cfg80211_ops::assoc() call. This function may sleep. | 2802 | * cfg80211_ops::assoc() call. This function may sleep. |
2786 | */ | 2803 | */ |
2787 | void cfg80211_send_rx_assoc(struct net_device *dev, const u8 *buf, size_t len); | 2804 | void cfg80211_send_rx_assoc(struct net_device *dev, struct cfg80211_bss *bss, |
2805 | const u8 *buf, size_t len); | ||
2788 | 2806 | ||
2789 | /** | 2807 | /** |
2790 | * cfg80211_send_assoc_timeout - notification of timed out association | 2808 | * cfg80211_send_assoc_timeout - notification of timed out association |
@@ -3176,6 +3194,7 @@ void cfg80211_del_sta(struct net_device *dev, const u8 *mac_addr, gfp_t gfp); | |||
3176 | * cfg80211_rx_mgmt - notification of received, unprocessed management frame | 3194 | * cfg80211_rx_mgmt - notification of received, unprocessed management frame |
3177 | * @dev: network device | 3195 | * @dev: network device |
3178 | * @freq: Frequency on which the frame was received in MHz | 3196 | * @freq: Frequency on which the frame was received in MHz |
3197 | * @sig_dbm: signal strength in mBm, or 0 if unknown | ||
3179 | * @buf: Management frame (header + body) | 3198 | * @buf: Management frame (header + body) |
3180 | * @len: length of the frame data | 3199 | * @len: length of the frame data |
3181 | * @gfp: context flags | 3200 | * @gfp: context flags |
@@ -3188,8 +3207,8 @@ void cfg80211_del_sta(struct net_device *dev, const u8 *mac_addr, gfp_t gfp); | |||
3188 | * This function is called whenever an Action frame is received for a station | 3207 | * This function is called whenever an Action frame is received for a station |
3189 | * mode interface, but is not processed in kernel. | 3208 | * mode interface, but is not processed in kernel. |
3190 | */ | 3209 | */ |
3191 | bool cfg80211_rx_mgmt(struct net_device *dev, int freq, const u8 *buf, | 3210 | bool cfg80211_rx_mgmt(struct net_device *dev, int freq, int sig_dbm, |
3192 | size_t len, gfp_t gfp); | 3211 | const u8 *buf, size_t len, gfp_t gfp); |
3193 | 3212 | ||
3194 | /** | 3213 | /** |
3195 | * cfg80211_mgmt_tx_status - notification of TX status for management frame | 3214 | * cfg80211_mgmt_tx_status - notification of TX status for management frame |
@@ -3302,6 +3321,7 @@ void cfg80211_probe_status(struct net_device *dev, const u8 *addr, | |||
3302 | * @frame: the frame | 3321 | * @frame: the frame |
3303 | * @len: length of the frame | 3322 | * @len: length of the frame |
3304 | * @freq: frequency the frame was received on | 3323 | * @freq: frequency the frame was received on |
3324 | * @sig_dbm: signal strength in mBm, or 0 if unknown | ||
3305 | * @gfp: allocation flags | 3325 | * @gfp: allocation flags |
3306 | * | 3326 | * |
3307 | * Use this function to report to userspace when a beacon was | 3327 | * Use this function to report to userspace when a beacon was |
@@ -3310,7 +3330,7 @@ void cfg80211_probe_status(struct net_device *dev, const u8 *addr, | |||
3310 | */ | 3330 | */ |
3311 | void cfg80211_report_obss_beacon(struct wiphy *wiphy, | 3331 | void cfg80211_report_obss_beacon(struct wiphy *wiphy, |
3312 | const u8 *frame, size_t len, | 3332 | const u8 *frame, size_t len, |
3313 | int freq, gfp_t gfp); | 3333 | int freq, int sig_dbm, gfp_t gfp); |
3314 | 3334 | ||
3315 | /* | 3335 | /* |
3316 | * cfg80211_can_beacon_sec_chan - test if ht40 on extension channel can be used | 3336 | * cfg80211_can_beacon_sec_chan - test if ht40 on extension channel can be used |
@@ -3322,6 +3342,14 @@ int cfg80211_can_beacon_sec_chan(struct wiphy *wiphy, | |||
3322 | struct ieee80211_channel *chan, | 3342 | struct ieee80211_channel *chan, |
3323 | enum nl80211_channel_type channel_type); | 3343 | enum nl80211_channel_type channel_type); |
3324 | 3344 | ||
3345 | /* | ||
3346 | * cfg80211_calculate_bitrate - calculate actual bitrate (in 100Kbps units) | ||
3347 | * @rate: given rate_info to calculate bitrate from | ||
3348 | * | ||
3349 | * return 0 if MCS index >= 32 | ||
3350 | */ | ||
3351 | u16 cfg80211_calculate_bitrate(struct rate_info *rate); | ||
3352 | |||
3325 | /* Logging, debugging and troubleshooting/diagnostic helpers. */ | 3353 | /* Logging, debugging and troubleshooting/diagnostic helpers. */ |
3326 | 3354 | ||
3327 | /* wiphy_printk helpers, similar to dev_printk */ | 3355 | /* wiphy_printk helpers, similar to dev_printk */ |
diff --git a/include/net/compat.h b/include/net/compat.h index 9ee75edcc295..a974ae92d182 100644 --- a/include/net/compat.h +++ b/include/net/compat.h | |||
@@ -41,7 +41,7 @@ extern int compat_sock_get_timestampns(struct sock *, struct timespec __user *); | |||
41 | #endif /* defined(CONFIG_COMPAT) */ | 41 | #endif /* defined(CONFIG_COMPAT) */ |
42 | 42 | ||
43 | extern int get_compat_msghdr(struct msghdr *, struct compat_msghdr __user *); | 43 | extern int get_compat_msghdr(struct msghdr *, struct compat_msghdr __user *); |
44 | extern int verify_compat_iovec(struct msghdr *, struct iovec *, struct sockaddr *, int); | 44 | extern int verify_compat_iovec(struct msghdr *, struct iovec *, struct sockaddr_storage *, int); |
45 | extern asmlinkage long compat_sys_sendmsg(int,struct compat_msghdr __user *,unsigned); | 45 | extern asmlinkage long compat_sys_sendmsg(int,struct compat_msghdr __user *,unsigned); |
46 | extern asmlinkage long compat_sys_sendmmsg(int, struct compat_mmsghdr __user *, | 46 | extern asmlinkage long compat_sys_sendmmsg(int, struct compat_mmsghdr __user *, |
47 | unsigned, unsigned); | 47 | unsigned, unsigned); |
diff --git a/include/net/dcbnl.h b/include/net/dcbnl.h index 2cd66d0be348..f55c980d8e23 100644 --- a/include/net/dcbnl.h +++ b/include/net/dcbnl.h | |||
@@ -72,8 +72,8 @@ struct dcbnl_rtnl_ops { | |||
72 | void (*getpfccfg)(struct net_device *, int, u8 *); | 72 | void (*getpfccfg)(struct net_device *, int, u8 *); |
73 | u8 (*setall)(struct net_device *); | 73 | u8 (*setall)(struct net_device *); |
74 | u8 (*getcap)(struct net_device *, int, u8 *); | 74 | u8 (*getcap)(struct net_device *, int, u8 *); |
75 | u8 (*getnumtcs)(struct net_device *, int, u8 *); | 75 | int (*getnumtcs)(struct net_device *, int, u8 *); |
76 | u8 (*setnumtcs)(struct net_device *, int, u8); | 76 | int (*setnumtcs)(struct net_device *, int, u8); |
77 | u8 (*getpfcstate)(struct net_device *); | 77 | u8 (*getpfcstate)(struct net_device *); |
78 | void (*setpfcstate)(struct net_device *, u8); | 78 | void (*setpfcstate)(struct net_device *, u8); |
79 | void (*getbcncfg)(struct net_device *, int, u32 *); | 79 | void (*getbcncfg)(struct net_device *, int, u32 *); |
diff --git a/include/net/dn.h b/include/net/dn.h index 298521e0d8a2..814af0b9387d 100644 --- a/include/net/dn.h +++ b/include/net/dn.h | |||
@@ -3,6 +3,7 @@ | |||
3 | 3 | ||
4 | #include <linux/dn.h> | 4 | #include <linux/dn.h> |
5 | #include <net/sock.h> | 5 | #include <net/sock.h> |
6 | #include <net/flow.h> | ||
6 | #include <asm/byteorder.h> | 7 | #include <asm/byteorder.h> |
7 | #include <asm/unaligned.h> | 8 | #include <asm/unaligned.h> |
8 | 9 | ||
diff --git a/include/net/dst.h b/include/net/dst.h index 344c8dd02874..59c5d18cc385 100644 --- a/include/net/dst.h +++ b/include/net/dst.h | |||
@@ -12,6 +12,7 @@ | |||
12 | #include <linux/netdevice.h> | 12 | #include <linux/netdevice.h> |
13 | #include <linux/rtnetlink.h> | 13 | #include <linux/rtnetlink.h> |
14 | #include <linux/rcupdate.h> | 14 | #include <linux/rcupdate.h> |
15 | #include <linux/bug.h> | ||
15 | #include <linux/jiffies.h> | 16 | #include <linux/jiffies.h> |
16 | #include <net/neighbour.h> | 17 | #include <net/neighbour.h> |
17 | #include <asm/processor.h> | 18 | #include <asm/processor.h> |
diff --git a/include/net/genetlink.h b/include/net/genetlink.h index 7db32995ccd3..ccb68880abf5 100644 --- a/include/net/genetlink.h +++ b/include/net/genetlink.h | |||
@@ -131,35 +131,8 @@ extern void genl_unregister_mc_group(struct genl_family *family, | |||
131 | extern void genl_notify(struct sk_buff *skb, struct net *net, u32 pid, | 131 | extern void genl_notify(struct sk_buff *skb, struct net *net, u32 pid, |
132 | u32 group, struct nlmsghdr *nlh, gfp_t flags); | 132 | u32 group, struct nlmsghdr *nlh, gfp_t flags); |
133 | 133 | ||
134 | /** | 134 | void *genlmsg_put(struct sk_buff *skb, u32 pid, u32 seq, |
135 | * genlmsg_put - Add generic netlink header to netlink message | 135 | struct genl_family *family, int flags, u8 cmd); |
136 | * @skb: socket buffer holding the message | ||
137 | * @pid: netlink pid the message is addressed to | ||
138 | * @seq: sequence number (usually the one of the sender) | ||
139 | * @family: generic netlink family | ||
140 | * @flags netlink message flags | ||
141 | * @cmd: generic netlink command | ||
142 | * | ||
143 | * Returns pointer to user specific header | ||
144 | */ | ||
145 | static inline void *genlmsg_put(struct sk_buff *skb, u32 pid, u32 seq, | ||
146 | struct genl_family *family, int flags, u8 cmd) | ||
147 | { | ||
148 | struct nlmsghdr *nlh; | ||
149 | struct genlmsghdr *hdr; | ||
150 | |||
151 | nlh = nlmsg_put(skb, pid, seq, family->id, GENL_HDRLEN + | ||
152 | family->hdrsize, flags); | ||
153 | if (nlh == NULL) | ||
154 | return NULL; | ||
155 | |||
156 | hdr = nlmsg_data(nlh); | ||
157 | hdr->cmd = cmd; | ||
158 | hdr->version = family->version; | ||
159 | hdr->reserved = 0; | ||
160 | |||
161 | return (char *) hdr + GENL_HDRLEN; | ||
162 | } | ||
163 | 136 | ||
164 | /** | 137 | /** |
165 | * genlmsg_nlhdr - Obtain netlink header from user specified header | 138 | * genlmsg_nlhdr - Obtain netlink header from user specified header |
diff --git a/include/net/inet_sock.h b/include/net/inet_sock.h index e3e405106afe..ae17e1352d7e 100644 --- a/include/net/inet_sock.h +++ b/include/net/inet_sock.h | |||
@@ -132,6 +132,7 @@ struct rtable; | |||
132 | * @tos - TOS | 132 | * @tos - TOS |
133 | * @mc_ttl - Multicasting TTL | 133 | * @mc_ttl - Multicasting TTL |
134 | * @is_icsk - is this an inet_connection_sock? | 134 | * @is_icsk - is this an inet_connection_sock? |
135 | * @uc_index - Unicast outgoing device index | ||
135 | * @mc_index - Multicast device index | 136 | * @mc_index - Multicast device index |
136 | * @mc_list - Group array | 137 | * @mc_list - Group array |
137 | * @cork - info to build ip hdr on each ip frag while socket is corked | 138 | * @cork - info to build ip hdr on each ip frag while socket is corked |
@@ -167,6 +168,8 @@ struct inet_sock { | |||
167 | transparent:1, | 168 | transparent:1, |
168 | mc_all:1, | 169 | mc_all:1, |
169 | nodefrag:1; | 170 | nodefrag:1; |
171 | __u8 rcv_tos; | ||
172 | int uc_index; | ||
170 | int mc_index; | 173 | int mc_index; |
171 | __be32 mc_addr; | 174 | __be32 mc_addr; |
172 | struct ip_mc_socklist __rcu *mc_list; | 175 | struct ip_mc_socklist __rcu *mc_list; |
diff --git a/include/net/inetpeer.h b/include/net/inetpeer.h index 06b795dd5906..b94765e38e80 100644 --- a/include/net/inetpeer.h +++ b/include/net/inetpeer.h | |||
@@ -35,12 +35,12 @@ struct inet_peer { | |||
35 | 35 | ||
36 | u32 metrics[RTAX_MAX]; | 36 | u32 metrics[RTAX_MAX]; |
37 | u32 rate_tokens; /* rate limiting for ICMP */ | 37 | u32 rate_tokens; /* rate limiting for ICMP */ |
38 | int redirect_genid; | ||
39 | unsigned long rate_last; | 38 | unsigned long rate_last; |
40 | unsigned long pmtu_expires; | 39 | unsigned long pmtu_expires; |
41 | u32 pmtu_orig; | 40 | u32 pmtu_orig; |
42 | u32 pmtu_learned; | 41 | u32 pmtu_learned; |
43 | struct inetpeer_addr_base redirect_learned; | 42 | struct inetpeer_addr_base redirect_learned; |
43 | struct list_head gc_list; | ||
44 | /* | 44 | /* |
45 | * Once inet_peer is queued for deletion (refcnt == -1), following fields | 45 | * Once inet_peer is queued for deletion (refcnt == -1), following fields |
46 | * are not available: rid, ip_id_count, tcp_ts, tcp_ts_stamp | 46 | * are not available: rid, ip_id_count, tcp_ts, tcp_ts_stamp |
@@ -96,6 +96,8 @@ static inline struct inet_peer *inet_getpeer_v6(const struct in6_addr *v6daddr, | |||
96 | extern void inet_putpeer(struct inet_peer *p); | 96 | extern void inet_putpeer(struct inet_peer *p); |
97 | extern bool inet_peer_xrlim_allow(struct inet_peer *peer, int timeout); | 97 | extern bool inet_peer_xrlim_allow(struct inet_peer *peer, int timeout); |
98 | 98 | ||
99 | extern void inetpeer_invalidate_tree(int family); | ||
100 | |||
99 | /* | 101 | /* |
100 | * temporary check to make sure we dont access rid, ip_id_count, tcp_ts, | 102 | * temporary check to make sure we dont access rid, ip_id_count, tcp_ts, |
101 | * tcp_ts_stamp if no refcount is taken on inet_peer | 103 | * tcp_ts_stamp if no refcount is taken on inet_peer |
diff --git a/include/net/ip.h b/include/net/ip.h index 775009f9eaba..b53d65f24f7b 100644 --- a/include/net/ip.h +++ b/include/net/ip.h | |||
@@ -388,7 +388,7 @@ static inline int sk_mc_loop(struct sock *sk) | |||
388 | return 1; | 388 | return 1; |
389 | } | 389 | } |
390 | 390 | ||
391 | extern int ip_call_ra_chain(struct sk_buff *skb); | 391 | extern bool ip_call_ra_chain(struct sk_buff *skb); |
392 | 392 | ||
393 | /* | 393 | /* |
394 | * Functions provided by ip_fragment.c | 394 | * Functions provided by ip_fragment.c |
diff --git a/include/net/ip_vs.h b/include/net/ip_vs.h index ebe517f2da9f..2bdee51ba30d 100644 --- a/include/net/ip_vs.h +++ b/include/net/ip_vs.h | |||
@@ -16,6 +16,7 @@ | |||
16 | #include <linux/atomic.h> /* for struct atomic_t */ | 16 | #include <linux/atomic.h> /* for struct atomic_t */ |
17 | #include <linux/compiler.h> | 17 | #include <linux/compiler.h> |
18 | #include <linux/timer.h> | 18 | #include <linux/timer.h> |
19 | #include <linux/bug.h> | ||
19 | 20 | ||
20 | #include <net/checksum.h> | 21 | #include <net/checksum.h> |
21 | #include <linux/netfilter.h> /* for union nf_inet_addr */ | 22 | #include <linux/netfilter.h> /* for union nf_inet_addr */ |
diff --git a/include/net/iucv/af_iucv.h b/include/net/iucv/af_iucv.h index 0954ec959159..cc7c19732389 100644 --- a/include/net/iucv/af_iucv.h +++ b/include/net/iucv/af_iucv.h | |||
@@ -62,6 +62,7 @@ struct sock_msg_q { | |||
62 | #define AF_IUCV_FLAG_SYN 0x2 | 62 | #define AF_IUCV_FLAG_SYN 0x2 |
63 | #define AF_IUCV_FLAG_FIN 0x4 | 63 | #define AF_IUCV_FLAG_FIN 0x4 |
64 | #define AF_IUCV_FLAG_WIN 0x8 | 64 | #define AF_IUCV_FLAG_WIN 0x8 |
65 | #define AF_IUCV_FLAG_SHT 0x10 | ||
65 | 66 | ||
66 | struct af_iucv_trans_hdr { | 67 | struct af_iucv_trans_hdr { |
67 | u16 magic; | 68 | u16 magic; |
@@ -113,6 +114,7 @@ struct iucv_sock { | |||
113 | spinlock_t accept_q_lock; | 114 | spinlock_t accept_q_lock; |
114 | struct sock *parent; | 115 | struct sock *parent; |
115 | struct iucv_path *path; | 116 | struct iucv_path *path; |
117 | struct net_device *hs_dev; | ||
116 | struct sk_buff_head send_skb_q; | 118 | struct sk_buff_head send_skb_q; |
117 | struct sk_buff_head backlog_skb_q; | 119 | struct sk_buff_head backlog_skb_q; |
118 | struct sock_msg_q message_q; | 120 | struct sock_msg_q message_q; |
@@ -131,6 +133,7 @@ struct iucv_sock { | |||
131 | /* iucv socket options (SOL_IUCV) */ | 133 | /* iucv socket options (SOL_IUCV) */ |
132 | #define SO_IPRMDATA_MSG 0x0080 /* send/recv IPRM_DATA msgs */ | 134 | #define SO_IPRMDATA_MSG 0x0080 /* send/recv IPRM_DATA msgs */ |
133 | #define SO_MSGLIMIT 0x1000 /* get/set IUCV MSGLIMIT */ | 135 | #define SO_MSGLIMIT 0x1000 /* get/set IUCV MSGLIMIT */ |
136 | #define SO_MSGSIZE 0x0800 /* get maximum msgsize */ | ||
134 | 137 | ||
135 | /* iucv related control messages (scm) */ | 138 | /* iucv related control messages (scm) */ |
136 | #define SCM_IUCV_TRGCLS 0x0001 /* target class control message */ | 139 | #define SCM_IUCV_TRGCLS 0x0001 /* target class control message */ |
diff --git a/include/net/mac80211.h b/include/net/mac80211.h index d49928ba5d09..9210bdc7bd8d 100644 --- a/include/net/mac80211.h +++ b/include/net/mac80211.h | |||
@@ -13,10 +13,10 @@ | |||
13 | #ifndef MAC80211_H | 13 | #ifndef MAC80211_H |
14 | #define MAC80211_H | 14 | #define MAC80211_H |
15 | 15 | ||
16 | #include <linux/bug.h> | ||
16 | #include <linux/kernel.h> | 17 | #include <linux/kernel.h> |
17 | #include <linux/if_ether.h> | 18 | #include <linux/if_ether.h> |
18 | #include <linux/skbuff.h> | 19 | #include <linux/skbuff.h> |
19 | #include <linux/device.h> | ||
20 | #include <linux/ieee80211.h> | 20 | #include <linux/ieee80211.h> |
21 | #include <net/cfg80211.h> | 21 | #include <net/cfg80211.h> |
22 | #include <asm/unaligned.h> | 22 | #include <asm/unaligned.h> |
@@ -87,6 +87,8 @@ | |||
87 | * | 87 | * |
88 | */ | 88 | */ |
89 | 89 | ||
90 | struct device; | ||
91 | |||
90 | /** | 92 | /** |
91 | * enum ieee80211_max_queues - maximum number of queues | 93 | * enum ieee80211_max_queues - maximum number of queues |
92 | * | 94 | * |
@@ -229,7 +231,8 @@ enum ieee80211_rssi_event { | |||
229 | * valid in station mode only while @assoc is true and if also | 231 | * valid in station mode only while @assoc is true and if also |
230 | * requested by %IEEE80211_HW_NEED_DTIM_PERIOD (cf. also hw conf | 232 | * requested by %IEEE80211_HW_NEED_DTIM_PERIOD (cf. also hw conf |
231 | * @ps_dtim_period) | 233 | * @ps_dtim_period) |
232 | * @timestamp: beacon timestamp | 234 | * @last_tsf: last beacon's/probe response's TSF timestamp (could be old |
235 | * as it may have been received during scanning long ago) | ||
233 | * @beacon_int: beacon interval | 236 | * @beacon_int: beacon interval |
234 | * @assoc_capability: capabilities taken from assoc resp | 237 | * @assoc_capability: capabilities taken from assoc resp |
235 | * @basic_rates: bitmap of basic rates, each bit stands for an | 238 | * @basic_rates: bitmap of basic rates, each bit stands for an |
@@ -276,7 +279,7 @@ struct ieee80211_bss_conf { | |||
276 | u8 dtim_period; | 279 | u8 dtim_period; |
277 | u16 beacon_int; | 280 | u16 beacon_int; |
278 | u16 assoc_capability; | 281 | u16 assoc_capability; |
279 | u64 timestamp; | 282 | u64 last_tsf; |
280 | u32 basic_rates; | 283 | u32 basic_rates; |
281 | int mcast_rate[IEEE80211_NUM_BANDS]; | 284 | int mcast_rate[IEEE80211_NUM_BANDS]; |
282 | u16 ht_operation_mode; | 285 | u16 ht_operation_mode; |
@@ -341,9 +344,9 @@ struct ieee80211_bss_conf { | |||
341 | * used to indicate that a frame was already retried due to PS | 344 | * used to indicate that a frame was already retried due to PS |
342 | * @IEEE80211_TX_INTFL_DONT_ENCRYPT: completely internal to mac80211, | 345 | * @IEEE80211_TX_INTFL_DONT_ENCRYPT: completely internal to mac80211, |
343 | * used to indicate frame should not be encrypted | 346 | * used to indicate frame should not be encrypted |
344 | * @IEEE80211_TX_CTL_POLL_RESPONSE: This frame is a response to a poll | 347 | * @IEEE80211_TX_CTL_NO_PS_BUFFER: This frame is a response to a poll |
345 | * frame (PS-Poll or uAPSD) and should be sent although the station | 348 | * frame (PS-Poll or uAPSD) or a non-bufferable MMPDU and must |
346 | * is in powersave mode. | 349 | * be sent although the station is in powersave mode. |
347 | * @IEEE80211_TX_CTL_MORE_FRAMES: More frames will be passed to the | 350 | * @IEEE80211_TX_CTL_MORE_FRAMES: More frames will be passed to the |
348 | * transmit function after the current frame, this can be used | 351 | * transmit function after the current frame, this can be used |
349 | * by drivers to kick the DMA queue only if unset or when the | 352 | * by drivers to kick the DMA queue only if unset or when the |
@@ -399,7 +402,7 @@ enum mac80211_tx_control_flags { | |||
399 | IEEE80211_TX_INTFL_NEED_TXPROCESSING = BIT(14), | 402 | IEEE80211_TX_INTFL_NEED_TXPROCESSING = BIT(14), |
400 | IEEE80211_TX_INTFL_RETRIED = BIT(15), | 403 | IEEE80211_TX_INTFL_RETRIED = BIT(15), |
401 | IEEE80211_TX_INTFL_DONT_ENCRYPT = BIT(16), | 404 | IEEE80211_TX_INTFL_DONT_ENCRYPT = BIT(16), |
402 | IEEE80211_TX_CTL_POLL_RESPONSE = BIT(17), | 405 | IEEE80211_TX_CTL_NO_PS_BUFFER = BIT(17), |
403 | IEEE80211_TX_CTL_MORE_FRAMES = BIT(18), | 406 | IEEE80211_TX_CTL_MORE_FRAMES = BIT(18), |
404 | IEEE80211_TX_INTFL_RETRANSMISSION = BIT(19), | 407 | IEEE80211_TX_INTFL_RETRANSMISSION = BIT(19), |
405 | /* hole at 20, use later */ | 408 | /* hole at 20, use later */ |
@@ -425,7 +428,7 @@ enum mac80211_tx_control_flags { | |||
425 | IEEE80211_TX_CTL_SEND_AFTER_DTIM | IEEE80211_TX_CTL_AMPDU | \ | 428 | IEEE80211_TX_CTL_SEND_AFTER_DTIM | IEEE80211_TX_CTL_AMPDU | \ |
426 | IEEE80211_TX_STAT_TX_FILTERED | IEEE80211_TX_STAT_ACK | \ | 429 | IEEE80211_TX_STAT_TX_FILTERED | IEEE80211_TX_STAT_ACK | \ |
427 | IEEE80211_TX_STAT_AMPDU | IEEE80211_TX_STAT_AMPDU_NO_BACK | \ | 430 | IEEE80211_TX_STAT_AMPDU | IEEE80211_TX_STAT_AMPDU_NO_BACK | \ |
428 | IEEE80211_TX_CTL_RATE_CTRL_PROBE | IEEE80211_TX_CTL_POLL_RESPONSE | \ | 431 | IEEE80211_TX_CTL_RATE_CTRL_PROBE | IEEE80211_TX_CTL_NO_PS_BUFFER | \ |
429 | IEEE80211_TX_CTL_MORE_FRAMES | IEEE80211_TX_CTL_LDPC | \ | 432 | IEEE80211_TX_CTL_MORE_FRAMES | IEEE80211_TX_CTL_LDPC | \ |
430 | IEEE80211_TX_CTL_STBC | IEEE80211_TX_STATUS_EOSP) | 433 | IEEE80211_TX_CTL_STBC | IEEE80211_TX_STATUS_EOSP) |
431 | 434 | ||
@@ -659,6 +662,8 @@ ieee80211_tx_info_clear_status(struct ieee80211_tx_info *info) | |||
659 | * @RX_FLAG_HT: HT MCS was used and rate_idx is MCS index | 662 | * @RX_FLAG_HT: HT MCS was used and rate_idx is MCS index |
660 | * @RX_FLAG_40MHZ: HT40 (40 MHz) was used | 663 | * @RX_FLAG_40MHZ: HT40 (40 MHz) was used |
661 | * @RX_FLAG_SHORT_GI: Short guard interval was used | 664 | * @RX_FLAG_SHORT_GI: Short guard interval was used |
665 | * @RX_FLAG_NO_SIGNAL_VAL: The signal strength value is not present. | ||
666 | * Valid only for data frames (mainly A-MPDU) | ||
662 | */ | 667 | */ |
663 | enum mac80211_rx_flags { | 668 | enum mac80211_rx_flags { |
664 | RX_FLAG_MMIC_ERROR = 1<<0, | 669 | RX_FLAG_MMIC_ERROR = 1<<0, |
@@ -672,6 +677,7 @@ enum mac80211_rx_flags { | |||
672 | RX_FLAG_HT = 1<<9, | 677 | RX_FLAG_HT = 1<<9, |
673 | RX_FLAG_40MHZ = 1<<10, | 678 | RX_FLAG_40MHZ = 1<<10, |
674 | RX_FLAG_SHORT_GI = 1<<11, | 679 | RX_FLAG_SHORT_GI = 1<<11, |
680 | RX_FLAG_NO_SIGNAL_VAL = 1<<12, | ||
675 | }; | 681 | }; |
676 | 682 | ||
677 | /** | 683 | /** |
@@ -852,6 +858,21 @@ struct ieee80211_channel_switch { | |||
852 | }; | 858 | }; |
853 | 859 | ||
854 | /** | 860 | /** |
861 | * enum ieee80211_vif_flags - virtual interface flags | ||
862 | * | ||
863 | * @IEEE80211_VIF_BEACON_FILTER: the device performs beacon filtering | ||
864 | * on this virtual interface to avoid unnecessary CPU wakeups | ||
865 | * @IEEE80211_VIF_SUPPORTS_CQM_RSSI: the device can do connection quality | ||
866 | * monitoring on this virtual interface -- i.e. it can monitor | ||
867 | * connection quality related parameters, such as the RSSI level and | ||
868 | * provide notifications if configured trigger levels are reached. | ||
869 | */ | ||
870 | enum ieee80211_vif_flags { | ||
871 | IEEE80211_VIF_BEACON_FILTER = BIT(0), | ||
872 | IEEE80211_VIF_SUPPORTS_CQM_RSSI = BIT(1), | ||
873 | }; | ||
874 | |||
875 | /** | ||
855 | * struct ieee80211_vif - per-interface data | 876 | * struct ieee80211_vif - per-interface data |
856 | * | 877 | * |
857 | * Data in this structure is continually present for driver | 878 | * Data in this structure is continually present for driver |
@@ -863,6 +884,10 @@ struct ieee80211_channel_switch { | |||
863 | * @addr: address of this interface | 884 | * @addr: address of this interface |
864 | * @p2p: indicates whether this AP or STA interface is a p2p | 885 | * @p2p: indicates whether this AP or STA interface is a p2p |
865 | * interface, i.e. a GO or p2p-sta respectively | 886 | * interface, i.e. a GO or p2p-sta respectively |
887 | * @driver_flags: flags/capabilities the driver has for this interface, | ||
888 | * these need to be set (or cleared) when the interface is added | ||
889 | * or, if supported by the driver, the interface type is changed | ||
890 | * at runtime, mac80211 will never touch this field | ||
866 | * @drv_priv: data area for driver use, will always be aligned to | 891 | * @drv_priv: data area for driver use, will always be aligned to |
867 | * sizeof(void *). | 892 | * sizeof(void *). |
868 | */ | 893 | */ |
@@ -871,6 +896,7 @@ struct ieee80211_vif { | |||
871 | struct ieee80211_bss_conf bss_conf; | 896 | struct ieee80211_bss_conf bss_conf; |
872 | u8 addr[ETH_ALEN]; | 897 | u8 addr[ETH_ALEN]; |
873 | bool p2p; | 898 | bool p2p; |
899 | u32 driver_flags; | ||
874 | /* must be last */ | 900 | /* must be last */ |
875 | u8 drv_priv[0] __attribute__((__aligned__(sizeof(void *)))); | 901 | u8 drv_priv[0] __attribute__((__aligned__(sizeof(void *)))); |
876 | }; | 902 | }; |
@@ -962,6 +988,25 @@ enum set_key_cmd { | |||
962 | }; | 988 | }; |
963 | 989 | ||
964 | /** | 990 | /** |
991 | * enum ieee80211_sta_state - station state | ||
992 | * | ||
993 | * @IEEE80211_STA_NOTEXIST: station doesn't exist at all, | ||
994 | * this is a special state for add/remove transitions | ||
995 | * @IEEE80211_STA_NONE: station exists without special state | ||
996 | * @IEEE80211_STA_AUTH: station is authenticated | ||
997 | * @IEEE80211_STA_ASSOC: station is associated | ||
998 | * @IEEE80211_STA_AUTHORIZED: station is authorized (802.1X) | ||
999 | */ | ||
1000 | enum ieee80211_sta_state { | ||
1001 | /* NOTE: These need to be ordered correctly! */ | ||
1002 | IEEE80211_STA_NOTEXIST, | ||
1003 | IEEE80211_STA_NONE, | ||
1004 | IEEE80211_STA_AUTH, | ||
1005 | IEEE80211_STA_ASSOC, | ||
1006 | IEEE80211_STA_AUTHORIZED, | ||
1007 | }; | ||
1008 | |||
1009 | /** | ||
965 | * struct ieee80211_sta - station table entry | 1010 | * struct ieee80211_sta - station table entry |
966 | * | 1011 | * |
967 | * A station table entry represents a station we are possibly | 1012 | * A station table entry represents a station we are possibly |
@@ -1079,10 +1124,6 @@ enum sta_notify_cmd { | |||
1079 | * @IEEE80211_HW_MFP_CAPABLE: | 1124 | * @IEEE80211_HW_MFP_CAPABLE: |
1080 | * Hardware supports management frame protection (MFP, IEEE 802.11w). | 1125 | * Hardware supports management frame protection (MFP, IEEE 802.11w). |
1081 | * | 1126 | * |
1082 | * @IEEE80211_HW_BEACON_FILTER: | ||
1083 | * Hardware supports dropping of irrelevant beacon frames to | ||
1084 | * avoid waking up cpu. | ||
1085 | * | ||
1086 | * @IEEE80211_HW_SUPPORTS_STATIC_SMPS: | 1127 | * @IEEE80211_HW_SUPPORTS_STATIC_SMPS: |
1087 | * Hardware supports static spatial multiplexing powersave, | 1128 | * Hardware supports static spatial multiplexing powersave, |
1088 | * ie. can turn off all but one chain even on HT connections | 1129 | * ie. can turn off all but one chain even on HT connections |
@@ -1108,11 +1149,6 @@ enum sta_notify_cmd { | |||
1108 | * When this flag is set, signaling beacon-loss will cause an immediate | 1149 | * When this flag is set, signaling beacon-loss will cause an immediate |
1109 | * change to disassociated state. | 1150 | * change to disassociated state. |
1110 | * | 1151 | * |
1111 | * @IEEE80211_HW_SUPPORTS_CQM_RSSI: | ||
1112 | * Hardware can do connection quality monitoring - i.e. it can monitor | ||
1113 | * connection quality related parameters, such as the RSSI level and | ||
1114 | * provide notifications if configured trigger levels are reached. | ||
1115 | * | ||
1116 | * @IEEE80211_HW_NEED_DTIM_PERIOD: | 1152 | * @IEEE80211_HW_NEED_DTIM_PERIOD: |
1117 | * This device needs to know the DTIM period for the BSS before | 1153 | * This device needs to know the DTIM period for the BSS before |
1118 | * associating. | 1154 | * associating. |
@@ -1134,6 +1170,10 @@ enum sta_notify_cmd { | |||
1134 | * @IEEE80211_HW_TX_AMPDU_SETUP_IN_HW: The device handles TX A-MPDU session | 1170 | * @IEEE80211_HW_TX_AMPDU_SETUP_IN_HW: The device handles TX A-MPDU session |
1135 | * setup strictly in HW. mac80211 should not attempt to do this in | 1171 | * setup strictly in HW. mac80211 should not attempt to do this in |
1136 | * software. | 1172 | * software. |
1173 | * | ||
1174 | * @IEEE80211_HW_SCAN_WHILE_IDLE: The device can do hw scan while | ||
1175 | * being idle (i.e. mac80211 doesn't have to go idle-off during the | ||
1176 | * the scan). | ||
1137 | */ | 1177 | */ |
1138 | enum ieee80211_hw_flags { | 1178 | enum ieee80211_hw_flags { |
1139 | IEEE80211_HW_HAS_RATE_CONTROL = 1<<0, | 1179 | IEEE80211_HW_HAS_RATE_CONTROL = 1<<0, |
@@ -1150,16 +1190,17 @@ enum ieee80211_hw_flags { | |||
1150 | IEEE80211_HW_PS_NULLFUNC_STACK = 1<<11, | 1190 | IEEE80211_HW_PS_NULLFUNC_STACK = 1<<11, |
1151 | IEEE80211_HW_SUPPORTS_DYNAMIC_PS = 1<<12, | 1191 | IEEE80211_HW_SUPPORTS_DYNAMIC_PS = 1<<12, |
1152 | IEEE80211_HW_MFP_CAPABLE = 1<<13, | 1192 | IEEE80211_HW_MFP_CAPABLE = 1<<13, |
1153 | IEEE80211_HW_BEACON_FILTER = 1<<14, | 1193 | /* reuse bit 14 */ |
1154 | IEEE80211_HW_SUPPORTS_STATIC_SMPS = 1<<15, | 1194 | IEEE80211_HW_SUPPORTS_STATIC_SMPS = 1<<15, |
1155 | IEEE80211_HW_SUPPORTS_DYNAMIC_SMPS = 1<<16, | 1195 | IEEE80211_HW_SUPPORTS_DYNAMIC_SMPS = 1<<16, |
1156 | IEEE80211_HW_SUPPORTS_UAPSD = 1<<17, | 1196 | IEEE80211_HW_SUPPORTS_UAPSD = 1<<17, |
1157 | IEEE80211_HW_REPORTS_TX_ACK_STATUS = 1<<18, | 1197 | IEEE80211_HW_REPORTS_TX_ACK_STATUS = 1<<18, |
1158 | IEEE80211_HW_CONNECTION_MONITOR = 1<<19, | 1198 | IEEE80211_HW_CONNECTION_MONITOR = 1<<19, |
1159 | IEEE80211_HW_SUPPORTS_CQM_RSSI = 1<<20, | 1199 | /* reuse bit 20 */ |
1160 | IEEE80211_HW_SUPPORTS_PER_STA_GTK = 1<<21, | 1200 | IEEE80211_HW_SUPPORTS_PER_STA_GTK = 1<<21, |
1161 | IEEE80211_HW_AP_LINK_PS = 1<<22, | 1201 | IEEE80211_HW_AP_LINK_PS = 1<<22, |
1162 | IEEE80211_HW_TX_AMPDU_SETUP_IN_HW = 1<<23, | 1202 | IEEE80211_HW_TX_AMPDU_SETUP_IN_HW = 1<<23, |
1203 | IEEE80211_HW_SCAN_WHILE_IDLE = 1<<24, | ||
1163 | }; | 1204 | }; |
1164 | 1205 | ||
1165 | /** | 1206 | /** |
@@ -1286,7 +1327,7 @@ static inline struct ieee80211_rate * | |||
1286 | ieee80211_get_tx_rate(const struct ieee80211_hw *hw, | 1327 | ieee80211_get_tx_rate(const struct ieee80211_hw *hw, |
1287 | const struct ieee80211_tx_info *c) | 1328 | const struct ieee80211_tx_info *c) |
1288 | { | 1329 | { |
1289 | if (WARN_ON(c->control.rates[0].idx < 0)) | 1330 | if (WARN_ON_ONCE(c->control.rates[0].idx < 0)) |
1290 | return NULL; | 1331 | return NULL; |
1291 | return &hw->wiphy->bands[c->band]->bitrates[c->control.rates[0].idx]; | 1332 | return &hw->wiphy->bands[c->band]->bitrates[c->control.rates[0].idx]; |
1292 | } | 1333 | } |
@@ -1446,8 +1487,8 @@ void ieee80211_free_txskb(struct ieee80211_hw *hw, struct sk_buff *skb); | |||
1446 | * way the host will only receive beacons where some relevant information | 1487 | * way the host will only receive beacons where some relevant information |
1447 | * (for example ERP protection or WMM settings) have changed. | 1488 | * (for example ERP protection or WMM settings) have changed. |
1448 | * | 1489 | * |
1449 | * Beacon filter support is advertised with the %IEEE80211_HW_BEACON_FILTER | 1490 | * Beacon filter support is advertised with the %IEEE80211_VIF_BEACON_FILTER |
1450 | * hardware capability. The driver needs to enable beacon filter support | 1491 | * interface capability. The driver needs to enable beacon filter support |
1451 | * whenever power save is enabled, that is %IEEE80211_CONF_PS is set. When | 1492 | * whenever power save is enabled, that is %IEEE80211_CONF_PS is set. When |
1452 | * power save is enabled, the stack will not check for beacon loss and the | 1493 | * power save is enabled, the stack will not check for beacon loss and the |
1453 | * driver needs to notify about loss of beacons with ieee80211_beacon_loss(). | 1494 | * driver needs to notify about loss of beacons with ieee80211_beacon_loss(). |
@@ -1599,7 +1640,7 @@ void ieee80211_free_txskb(struct ieee80211_hw *hw, struct sk_buff *skb); | |||
1599 | * the station sends a PS-Poll or a uAPSD trigger frame, mac80211 | 1640 | * the station sends a PS-Poll or a uAPSD trigger frame, mac80211 |
1600 | * will inform the driver of this with the @allow_buffered_frames | 1641 | * will inform the driver of this with the @allow_buffered_frames |
1601 | * callback; this callback is optional. mac80211 will then transmit | 1642 | * callback; this callback is optional. mac80211 will then transmit |
1602 | * the frames as usual and set the %IEEE80211_TX_CTL_POLL_RESPONSE | 1643 | * the frames as usual and set the %IEEE80211_TX_CTL_NO_PS_BUFFER |
1603 | * on each frame. The last frame in the service period (or the only | 1644 | * on each frame. The last frame in the service period (or the only |
1604 | * response to a PS-Poll) also has %IEEE80211_TX_STATUS_EOSP set to | 1645 | * response to a PS-Poll) also has %IEEE80211_TX_STATUS_EOSP set to |
1605 | * indicate that it ends the service period; as this frame must have | 1646 | * indicate that it ends the service period; as this frame must have |
@@ -1607,6 +1648,9 @@ void ieee80211_free_txskb(struct ieee80211_hw *hw, struct sk_buff *skb); | |||
1607 | * When TX status is reported for this frame, the service period is | 1648 | * When TX status is reported for this frame, the service period is |
1608 | * marked has having ended and a new one can be started by the peer. | 1649 | * marked has having ended and a new one can be started by the peer. |
1609 | * | 1650 | * |
1651 | * Additionally, non-bufferable MMPDUs can also be transmitted by | ||
1652 | * mac80211 with the %IEEE80211_TX_CTL_NO_PS_BUFFER set in them. | ||
1653 | * | ||
1610 | * Another race condition can happen on some devices like iwlwifi | 1654 | * Another race condition can happen on some devices like iwlwifi |
1611 | * when there are frames queued for the station and it wakes up | 1655 | * when there are frames queued for the station and it wakes up |
1612 | * or polls; the frames that are already queued could end up being | 1656 | * or polls; the frames that are already queued could end up being |
@@ -1725,20 +1769,6 @@ enum ieee80211_ampdu_mlme_action { | |||
1725 | }; | 1769 | }; |
1726 | 1770 | ||
1727 | /** | 1771 | /** |
1728 | * enum ieee80211_tx_sync_type - TX sync type | ||
1729 | * @IEEE80211_TX_SYNC_AUTH: sync TX for authentication | ||
1730 | * (and possibly also before direct probe) | ||
1731 | * @IEEE80211_TX_SYNC_ASSOC: sync TX for association | ||
1732 | * @IEEE80211_TX_SYNC_ACTION: sync TX for action frame | ||
1733 | * (not implemented yet) | ||
1734 | */ | ||
1735 | enum ieee80211_tx_sync_type { | ||
1736 | IEEE80211_TX_SYNC_AUTH, | ||
1737 | IEEE80211_TX_SYNC_ASSOC, | ||
1738 | IEEE80211_TX_SYNC_ACTION, | ||
1739 | }; | ||
1740 | |||
1741 | /** | ||
1742 | * enum ieee80211_frame_release_type - frame release reason | 1772 | * enum ieee80211_frame_release_type - frame release reason |
1743 | * @IEEE80211_FRAME_RELEASE_PSPOLL: frame released for PS-Poll | 1773 | * @IEEE80211_FRAME_RELEASE_PSPOLL: frame released for PS-Poll |
1744 | * @IEEE80211_FRAME_RELEASE_UAPSD: frame(s) released due to | 1774 | * @IEEE80211_FRAME_RELEASE_UAPSD: frame(s) released due to |
@@ -1848,26 +1878,6 @@ enum ieee80211_frame_release_type { | |||
1848 | * of the bss parameters has changed when a call is made. The callback | 1878 | * of the bss parameters has changed when a call is made. The callback |
1849 | * can sleep. | 1879 | * can sleep. |
1850 | * | 1880 | * |
1851 | * @tx_sync: Called before a frame is sent to an AP/GO. In the GO case, the | ||
1852 | * driver should sync with the GO's powersaving so the device doesn't | ||
1853 | * transmit the frame while the GO is asleep. In the regular AP case | ||
1854 | * it may be used by drivers for devices implementing other restrictions | ||
1855 | * on talking to APs, e.g. due to regulatory enforcement or just HW | ||
1856 | * restrictions. | ||
1857 | * This function is called for every authentication, association and | ||
1858 | * action frame separately since applications might attempt to auth | ||
1859 | * with multiple APs before chosing one to associate to. If it returns | ||
1860 | * an error, the corresponding authentication, association or frame | ||
1861 | * transmission is aborted and reported as having failed. It is always | ||
1862 | * called after tuning to the correct channel. | ||
1863 | * The callback might be called multiple times before @finish_tx_sync | ||
1864 | * (but @finish_tx_sync will be called once for each) but in practice | ||
1865 | * this is unlikely to happen. It can also refuse in that case if the | ||
1866 | * driver cannot handle that situation. | ||
1867 | * This callback can sleep. | ||
1868 | * @finish_tx_sync: Called as a counterpart to @tx_sync, unless that returned | ||
1869 | * an error. This callback can sleep. | ||
1870 | * | ||
1871 | * @prepare_multicast: Prepare for multicast filter configuration. | 1881 | * @prepare_multicast: Prepare for multicast filter configuration. |
1872 | * This callback is optional, and its return value is passed | 1882 | * This callback is optional, and its return value is passed |
1873 | * to configure_filter(). This callback must be atomic. | 1883 | * to configure_filter(). This callback must be atomic. |
@@ -1963,6 +1973,13 @@ enum ieee80211_frame_release_type { | |||
1963 | * in AP mode, this callback will not be called when the flag | 1973 | * in AP mode, this callback will not be called when the flag |
1964 | * %IEEE80211_HW_AP_LINK_PS is set. Must be atomic. | 1974 | * %IEEE80211_HW_AP_LINK_PS is set. Must be atomic. |
1965 | * | 1975 | * |
1976 | * @sta_state: Notifies low level driver about state transition of a | ||
1977 | * station (which can be the AP, a client, IBSS/WDS/mesh peer etc.) | ||
1978 | * This callback is mutually exclusive with @sta_add/@sta_remove. | ||
1979 | * It must not fail for down transitions but may fail for transitions | ||
1980 | * up the list of states. | ||
1981 | * The callback can sleep. | ||
1982 | * | ||
1966 | * @conf_tx: Configure TX queue parameters (EDCF (aifs, cw_min, cw_max), | 1983 | * @conf_tx: Configure TX queue parameters (EDCF (aifs, cw_min, cw_max), |
1967 | * bursting) for a hardware TX queue. | 1984 | * bursting) for a hardware TX queue. |
1968 | * Returns a negative error code on failure. | 1985 | * Returns a negative error code on failure. |
@@ -2098,7 +2115,7 @@ enum ieee80211_frame_release_type { | |||
2098 | * @allow_buffered_frames: Prepare device to allow the given number of frames | 2115 | * @allow_buffered_frames: Prepare device to allow the given number of frames |
2099 | * to go out to the given station. The frames will be sent by mac80211 | 2116 | * to go out to the given station. The frames will be sent by mac80211 |
2100 | * via the usual TX path after this call. The TX information for frames | 2117 | * via the usual TX path after this call. The TX information for frames |
2101 | * released will also have the %IEEE80211_TX_CTL_POLL_RESPONSE flag set | 2118 | * released will also have the %IEEE80211_TX_CTL_NO_PS_BUFFER flag set |
2102 | * and the last one will also have %IEEE80211_TX_STATUS_EOSP set. In case | 2119 | * and the last one will also have %IEEE80211_TX_STATUS_EOSP set. In case |
2103 | * frames from multiple TIDs are released and the driver might reorder | 2120 | * frames from multiple TIDs are released and the driver might reorder |
2104 | * them between the TIDs, it must set the %IEEE80211_TX_STATUS_EOSP flag | 2121 | * them between the TIDs, it must set the %IEEE80211_TX_STATUS_EOSP flag |
@@ -2132,13 +2149,6 @@ struct ieee80211_ops { | |||
2132 | struct ieee80211_bss_conf *info, | 2149 | struct ieee80211_bss_conf *info, |
2133 | u32 changed); | 2150 | u32 changed); |
2134 | 2151 | ||
2135 | int (*tx_sync)(struct ieee80211_hw *hw, struct ieee80211_vif *vif, | ||
2136 | const u8 *bssid, enum ieee80211_tx_sync_type type); | ||
2137 | void (*finish_tx_sync)(struct ieee80211_hw *hw, | ||
2138 | struct ieee80211_vif *vif, | ||
2139 | const u8 *bssid, | ||
2140 | enum ieee80211_tx_sync_type type); | ||
2141 | |||
2142 | u64 (*prepare_multicast)(struct ieee80211_hw *hw, | 2152 | u64 (*prepare_multicast)(struct ieee80211_hw *hw, |
2143 | struct netdev_hw_addr_list *mc_list); | 2153 | struct netdev_hw_addr_list *mc_list); |
2144 | void (*configure_filter)(struct ieee80211_hw *hw, | 2154 | void (*configure_filter)(struct ieee80211_hw *hw, |
@@ -2182,6 +2192,10 @@ struct ieee80211_ops { | |||
2182 | struct ieee80211_sta *sta); | 2192 | struct ieee80211_sta *sta); |
2183 | void (*sta_notify)(struct ieee80211_hw *hw, struct ieee80211_vif *vif, | 2193 | void (*sta_notify)(struct ieee80211_hw *hw, struct ieee80211_vif *vif, |
2184 | enum sta_notify_cmd, struct ieee80211_sta *sta); | 2194 | enum sta_notify_cmd, struct ieee80211_sta *sta); |
2195 | int (*sta_state)(struct ieee80211_hw *hw, struct ieee80211_vif *vif, | ||
2196 | struct ieee80211_sta *sta, | ||
2197 | enum ieee80211_sta_state old_state, | ||
2198 | enum ieee80211_sta_state new_state); | ||
2185 | int (*conf_tx)(struct ieee80211_hw *hw, | 2199 | int (*conf_tx)(struct ieee80211_hw *hw, |
2186 | struct ieee80211_vif *vif, u16 queue, | 2200 | struct ieee80211_vif *vif, u16 queue, |
2187 | const struct ieee80211_tx_queue_params *params); | 2201 | const struct ieee80211_tx_queue_params *params); |
@@ -3316,7 +3330,7 @@ struct sk_buff *ieee80211_ap_probereq_get(struct ieee80211_hw *hw, | |||
3316 | * | 3330 | * |
3317 | * @vif: &struct ieee80211_vif pointer from the add_interface callback. | 3331 | * @vif: &struct ieee80211_vif pointer from the add_interface callback. |
3318 | * | 3332 | * |
3319 | * When beacon filtering is enabled with %IEEE80211_HW_BEACON_FILTER and | 3333 | * When beacon filtering is enabled with %IEEE80211_VIF_BEACON_FILTER and |
3320 | * %IEEE80211_CONF_PS is set, the driver needs to inform whenever the | 3334 | * %IEEE80211_CONF_PS is set, the driver needs to inform whenever the |
3321 | * hardware is not receiving beacons with this function. | 3335 | * hardware is not receiving beacons with this function. |
3322 | */ | 3336 | */ |
@@ -3327,7 +3341,7 @@ void ieee80211_beacon_loss(struct ieee80211_vif *vif); | |||
3327 | * | 3341 | * |
3328 | * @vif: &struct ieee80211_vif pointer from the add_interface callback. | 3342 | * @vif: &struct ieee80211_vif pointer from the add_interface callback. |
3329 | * | 3343 | * |
3330 | * When beacon filtering is enabled with %IEEE80211_HW_BEACON_FILTER, and | 3344 | * When beacon filtering is enabled with %IEEE80211_VIF_BEACON_FILTER, and |
3331 | * %IEEE80211_CONF_PS and %IEEE80211_HW_CONNECTION_MONITOR are set, the driver | 3345 | * %IEEE80211_CONF_PS and %IEEE80211_HW_CONNECTION_MONITOR are set, the driver |
3332 | * needs to inform if the connection to the AP has been lost. | 3346 | * needs to inform if the connection to the AP has been lost. |
3333 | * | 3347 | * |
@@ -3397,7 +3411,7 @@ void ieee80211_enable_dyn_ps(struct ieee80211_vif *vif); | |||
3397 | * @rssi_event: the RSSI trigger event type | 3411 | * @rssi_event: the RSSI trigger event type |
3398 | * @gfp: context flags | 3412 | * @gfp: context flags |
3399 | * | 3413 | * |
3400 | * When the %IEEE80211_HW_SUPPORTS_CQM_RSSI is set, and a connection quality | 3414 | * When the %IEEE80211_VIF_SUPPORTS_CQM_RSSI is set, and a connection quality |
3401 | * monitoring is configured with an rssi threshold, the driver will inform | 3415 | * monitoring is configured with an rssi threshold, the driver will inform |
3402 | * whenever the rssi level reaches the threshold. | 3416 | * whenever the rssi level reaches the threshold. |
3403 | */ | 3417 | */ |
@@ -3516,6 +3530,8 @@ enum rate_control_changed { | |||
3516 | * @hw: The hardware the algorithm is invoked for. | 3530 | * @hw: The hardware the algorithm is invoked for. |
3517 | * @sband: The band this frame is being transmitted on. | 3531 | * @sband: The band this frame is being transmitted on. |
3518 | * @bss_conf: the current BSS configuration | 3532 | * @bss_conf: the current BSS configuration |
3533 | * @skb: the skb that will be transmitted, the control information in it needs | ||
3534 | * to be filled in | ||
3519 | * @reported_rate: The rate control algorithm can fill this in to indicate | 3535 | * @reported_rate: The rate control algorithm can fill this in to indicate |
3520 | * which rate should be reported to userspace as the current rate and | 3536 | * which rate should be reported to userspace as the current rate and |
3521 | * used for rate calculations in the mesh network. | 3537 | * used for rate calculations in the mesh network. |
@@ -3523,12 +3539,11 @@ enum rate_control_changed { | |||
3523 | * RTS threshold | 3539 | * RTS threshold |
3524 | * @short_preamble: whether mac80211 will request short-preamble transmission | 3540 | * @short_preamble: whether mac80211 will request short-preamble transmission |
3525 | * if the selected rate supports it | 3541 | * if the selected rate supports it |
3526 | * @max_rate_idx: user-requested maximum rate (not MCS for now) | 3542 | * @max_rate_idx: user-requested maximum (legacy) rate |
3527 | * (deprecated; this will be removed once drivers get updated to use | 3543 | * (deprecated; this will be removed once drivers get updated to use |
3528 | * rate_idx_mask) | 3544 | * rate_idx_mask) |
3529 | * @rate_idx_mask: user-requested rate mask (not MCS for now) | 3545 | * @rate_idx_mask: user-requested (legacy) rate mask |
3530 | * @skb: the skb that will be transmitted, the control information in it needs | 3546 | * @rate_idx_mcs_mask: user-requested MCS rate mask |
3531 | * to be filled in | ||
3532 | * @bss: whether this frame is sent out in AP or IBSS mode | 3547 | * @bss: whether this frame is sent out in AP or IBSS mode |
3533 | */ | 3548 | */ |
3534 | struct ieee80211_tx_rate_control { | 3549 | struct ieee80211_tx_rate_control { |
@@ -3540,6 +3555,7 @@ struct ieee80211_tx_rate_control { | |||
3540 | bool rts, short_preamble; | 3555 | bool rts, short_preamble; |
3541 | u8 max_rate_idx; | 3556 | u8 max_rate_idx; |
3542 | u32 rate_idx_mask; | 3557 | u32 rate_idx_mask; |
3558 | u8 rate_idx_mcs_mask[IEEE80211_HT_MCS_MASK_LEN]; | ||
3543 | bool bss; | 3559 | bool bss; |
3544 | }; | 3560 | }; |
3545 | 3561 | ||
diff --git a/include/net/ndisc.h b/include/net/ndisc.h index e3133c23980e..6f9c25a76cd1 100644 --- a/include/net/ndisc.h +++ b/include/net/ndisc.h | |||
@@ -133,7 +133,6 @@ extern void ndisc_send_rs(struct net_device *dev, | |||
133 | const struct in6_addr *daddr); | 133 | const struct in6_addr *daddr); |
134 | 134 | ||
135 | extern void ndisc_send_redirect(struct sk_buff *skb, | 135 | extern void ndisc_send_redirect(struct sk_buff *skb, |
136 | struct neighbour *neigh, | ||
137 | const struct in6_addr *target); | 136 | const struct in6_addr *target); |
138 | 137 | ||
139 | extern int ndisc_mc_map(const struct in6_addr *addr, char *buf, | 138 | extern int ndisc_mc_map(const struct in6_addr *addr, char *buf, |
diff --git a/include/net/netfilter/nf_conntrack_extend.h b/include/net/netfilter/nf_conntrack_extend.h index 2dcf31703acb..96755c3798a5 100644 --- a/include/net/netfilter/nf_conntrack_extend.h +++ b/include/net/netfilter/nf_conntrack_extend.h | |||
@@ -20,6 +20,9 @@ enum nf_ct_ext_id { | |||
20 | #ifdef CONFIG_NF_CONNTRACK_TIMESTAMP | 20 | #ifdef CONFIG_NF_CONNTRACK_TIMESTAMP |
21 | NF_CT_EXT_TSTAMP, | 21 | NF_CT_EXT_TSTAMP, |
22 | #endif | 22 | #endif |
23 | #ifdef CONFIG_NF_CONNTRACK_TIMEOUT | ||
24 | NF_CT_EXT_TIMEOUT, | ||
25 | #endif | ||
23 | NF_CT_EXT_NUM, | 26 | NF_CT_EXT_NUM, |
24 | }; | 27 | }; |
25 | 28 | ||
@@ -29,6 +32,7 @@ enum nf_ct_ext_id { | |||
29 | #define NF_CT_EXT_ECACHE_TYPE struct nf_conntrack_ecache | 32 | #define NF_CT_EXT_ECACHE_TYPE struct nf_conntrack_ecache |
30 | #define NF_CT_EXT_ZONE_TYPE struct nf_conntrack_zone | 33 | #define NF_CT_EXT_ZONE_TYPE struct nf_conntrack_zone |
31 | #define NF_CT_EXT_TSTAMP_TYPE struct nf_conn_tstamp | 34 | #define NF_CT_EXT_TSTAMP_TYPE struct nf_conn_tstamp |
35 | #define NF_CT_EXT_TIMEOUT_TYPE struct nf_conn_timeout | ||
32 | 36 | ||
33 | /* Extensions: optional stuff which isn't permanently in struct. */ | 37 | /* Extensions: optional stuff which isn't permanently in struct. */ |
34 | struct nf_ct_ext { | 38 | struct nf_ct_ext { |
diff --git a/include/net/netfilter/nf_conntrack_helper.h b/include/net/netfilter/nf_conntrack_helper.h index f1c1311adc2c..5767dc242dee 100644 --- a/include/net/netfilter/nf_conntrack_helper.h +++ b/include/net/netfilter/nf_conntrack_helper.h | |||
@@ -69,4 +69,17 @@ extern int nf_conntrack_broadcast_help(struct sk_buff *skb, | |||
69 | enum ip_conntrack_info ctinfo, | 69 | enum ip_conntrack_info ctinfo, |
70 | unsigned int timeout); | 70 | unsigned int timeout); |
71 | 71 | ||
72 | struct nf_ct_helper_expectfn { | ||
73 | struct list_head head; | ||
74 | const char *name; | ||
75 | void (*expectfn)(struct nf_conn *ct, struct nf_conntrack_expect *exp); | ||
76 | }; | ||
77 | |||
78 | void nf_ct_helper_expectfn_register(struct nf_ct_helper_expectfn *n); | ||
79 | void nf_ct_helper_expectfn_unregister(struct nf_ct_helper_expectfn *n); | ||
80 | struct nf_ct_helper_expectfn * | ||
81 | nf_ct_helper_expectfn_find_by_name(const char *name); | ||
82 | struct nf_ct_helper_expectfn * | ||
83 | nf_ct_helper_expectfn_find_by_symbol(const void *symbol); | ||
84 | |||
72 | #endif /*_NF_CONNTRACK_HELPER_H*/ | 85 | #endif /*_NF_CONNTRACK_HELPER_H*/ |
diff --git a/include/net/netfilter/nf_conntrack_l4proto.h b/include/net/netfilter/nf_conntrack_l4proto.h index e3d3ee3c06a2..3b572bb20aa2 100644 --- a/include/net/netfilter/nf_conntrack_l4proto.h +++ b/include/net/netfilter/nf_conntrack_l4proto.h | |||
@@ -39,12 +39,13 @@ struct nf_conntrack_l4proto { | |||
39 | unsigned int dataoff, | 39 | unsigned int dataoff, |
40 | enum ip_conntrack_info ctinfo, | 40 | enum ip_conntrack_info ctinfo, |
41 | u_int8_t pf, | 41 | u_int8_t pf, |
42 | unsigned int hooknum); | 42 | unsigned int hooknum, |
43 | unsigned int *timeouts); | ||
43 | 44 | ||
44 | /* Called when a new connection for this protocol found; | 45 | /* Called when a new connection for this protocol found; |
45 | * returns TRUE if it's OK. If so, packet() called next. */ | 46 | * returns TRUE if it's OK. If so, packet() called next. */ |
46 | bool (*new)(struct nf_conn *ct, const struct sk_buff *skb, | 47 | bool (*new)(struct nf_conn *ct, const struct sk_buff *skb, |
47 | unsigned int dataoff); | 48 | unsigned int dataoff, unsigned int *timeouts); |
48 | 49 | ||
49 | /* Called when a conntrack entry is destroyed */ | 50 | /* Called when a conntrack entry is destroyed */ |
50 | void (*destroy)(struct nf_conn *ct); | 51 | void (*destroy)(struct nf_conn *ct); |
@@ -60,6 +61,9 @@ struct nf_conntrack_l4proto { | |||
60 | /* Print out the private part of the conntrack. */ | 61 | /* Print out the private part of the conntrack. */ |
61 | int (*print_conntrack)(struct seq_file *s, struct nf_conn *); | 62 | int (*print_conntrack)(struct seq_file *s, struct nf_conn *); |
62 | 63 | ||
64 | /* Return the array of timeouts for this protocol. */ | ||
65 | unsigned int *(*get_timeouts)(struct net *net); | ||
66 | |||
63 | /* convert protoinfo to nfnetink attributes */ | 67 | /* convert protoinfo to nfnetink attributes */ |
64 | int (*to_nlattr)(struct sk_buff *skb, struct nlattr *nla, | 68 | int (*to_nlattr)(struct sk_buff *skb, struct nlattr *nla, |
65 | struct nf_conn *ct); | 69 | struct nf_conn *ct); |
@@ -79,6 +83,17 @@ struct nf_conntrack_l4proto { | |||
79 | 83 | ||
80 | size_t nla_size; | 84 | size_t nla_size; |
81 | 85 | ||
86 | #if IS_ENABLED(CONFIG_NF_CT_NETLINK_TIMEOUT) | ||
87 | struct { | ||
88 | size_t obj_size; | ||
89 | int (*nlattr_to_obj)(struct nlattr *tb[], void *data); | ||
90 | int (*obj_to_nlattr)(struct sk_buff *skb, const void *data); | ||
91 | |||
92 | unsigned int nlattr_max; | ||
93 | const struct nla_policy *nla_policy; | ||
94 | } ctnl_timeout; | ||
95 | #endif | ||
96 | |||
82 | #ifdef CONFIG_SYSCTL | 97 | #ifdef CONFIG_SYSCTL |
83 | struct ctl_table_header **ctl_table_header; | 98 | struct ctl_table_header **ctl_table_header; |
84 | struct ctl_table *ctl_table; | 99 | struct ctl_table *ctl_table; |
@@ -103,6 +118,10 @@ extern struct nf_conntrack_l4proto nf_conntrack_l4proto_generic; | |||
103 | extern struct nf_conntrack_l4proto * | 118 | extern struct nf_conntrack_l4proto * |
104 | __nf_ct_l4proto_find(u_int16_t l3proto, u_int8_t l4proto); | 119 | __nf_ct_l4proto_find(u_int16_t l3proto, u_int8_t l4proto); |
105 | 120 | ||
121 | extern struct nf_conntrack_l4proto * | ||
122 | nf_ct_l4proto_find_get(u_int16_t l3proto, u_int8_t l4proto); | ||
123 | extern void nf_ct_l4proto_put(struct nf_conntrack_l4proto *p); | ||
124 | |||
106 | /* Protocol registration. */ | 125 | /* Protocol registration. */ |
107 | extern int nf_conntrack_l4proto_register(struct nf_conntrack_l4proto *proto); | 126 | extern int nf_conntrack_l4proto_register(struct nf_conntrack_l4proto *proto); |
108 | extern void nf_conntrack_l4proto_unregister(struct nf_conntrack_l4proto *proto); | 127 | extern void nf_conntrack_l4proto_unregister(struct nf_conntrack_l4proto *proto); |
diff --git a/include/net/netfilter/nf_conntrack_timeout.h b/include/net/netfilter/nf_conntrack_timeout.h new file mode 100644 index 000000000000..34ec89f8dbf9 --- /dev/null +++ b/include/net/netfilter/nf_conntrack_timeout.h | |||
@@ -0,0 +1,78 @@ | |||
1 | #ifndef _NF_CONNTRACK_TIMEOUT_H | ||
2 | #define _NF_CONNTRACK_TIMEOUT_H | ||
3 | |||
4 | #include <net/net_namespace.h> | ||
5 | #include <linux/netfilter/nf_conntrack_common.h> | ||
6 | #include <linux/netfilter/nf_conntrack_tuple_common.h> | ||
7 | #include <net/netfilter/nf_conntrack.h> | ||
8 | #include <net/netfilter/nf_conntrack_extend.h> | ||
9 | |||
10 | #define CTNL_TIMEOUT_NAME_MAX 32 | ||
11 | |||
12 | struct ctnl_timeout { | ||
13 | struct list_head head; | ||
14 | struct rcu_head rcu_head; | ||
15 | atomic_t refcnt; | ||
16 | char name[CTNL_TIMEOUT_NAME_MAX]; | ||
17 | __u16 l3num; | ||
18 | struct nf_conntrack_l4proto *l4proto; | ||
19 | char data[0]; | ||
20 | }; | ||
21 | |||
22 | struct nf_conn_timeout { | ||
23 | struct ctnl_timeout *timeout; | ||
24 | }; | ||
25 | |||
26 | #define NF_CT_TIMEOUT_EXT_DATA(__t) (unsigned int *) &((__t)->timeout->data) | ||
27 | |||
28 | static inline | ||
29 | struct nf_conn_timeout *nf_ct_timeout_find(const struct nf_conn *ct) | ||
30 | { | ||
31 | #ifdef CONFIG_NF_CONNTRACK_TIMEOUT | ||
32 | return nf_ct_ext_find(ct, NF_CT_EXT_TIMEOUT); | ||
33 | #else | ||
34 | return NULL; | ||
35 | #endif | ||
36 | } | ||
37 | |||
38 | static inline | ||
39 | struct nf_conn_timeout *nf_ct_timeout_ext_add(struct nf_conn *ct, | ||
40 | struct ctnl_timeout *timeout, | ||
41 | gfp_t gfp) | ||
42 | { | ||
43 | #ifdef CONFIG_NF_CONNTRACK_TIMEOUT | ||
44 | struct nf_conn_timeout *timeout_ext; | ||
45 | |||
46 | timeout_ext = nf_ct_ext_add(ct, NF_CT_EXT_TIMEOUT, gfp); | ||
47 | if (timeout_ext == NULL) | ||
48 | return NULL; | ||
49 | |||
50 | timeout_ext->timeout = timeout; | ||
51 | |||
52 | return timeout_ext; | ||
53 | #else | ||
54 | return NULL; | ||
55 | #endif | ||
56 | }; | ||
57 | |||
58 | #ifdef CONFIG_NF_CONNTRACK_TIMEOUT | ||
59 | extern int nf_conntrack_timeout_init(struct net *net); | ||
60 | extern void nf_conntrack_timeout_fini(struct net *net); | ||
61 | #else | ||
62 | static inline int nf_conntrack_timeout_init(struct net *net) | ||
63 | { | ||
64 | return 0; | ||
65 | } | ||
66 | |||
67 | static inline void nf_conntrack_timeout_fini(struct net *net) | ||
68 | { | ||
69 | return; | ||
70 | } | ||
71 | #endif /* CONFIG_NF_CONNTRACK_TIMEOUT */ | ||
72 | |||
73 | #ifdef CONFIG_NF_CONNTRACK_TIMEOUT | ||
74 | extern struct ctnl_timeout *(*nf_ct_timeout_find_get_hook)(const char *name); | ||
75 | extern void (*nf_ct_timeout_put_hook)(struct ctnl_timeout *timeout); | ||
76 | #endif | ||
77 | |||
78 | #endif /* _NF_CONNTRACK_TIMEOUT_H */ | ||
diff --git a/include/net/netfilter/xt_log.h b/include/net/netfilter/xt_log.h index 0dfb34a5b53c..9d9756cca013 100644 --- a/include/net/netfilter/xt_log.h +++ b/include/net/netfilter/xt_log.h | |||
@@ -6,7 +6,7 @@ struct sbuff { | |||
6 | }; | 6 | }; |
7 | static struct sbuff emergency, *emergency_ptr = &emergency; | 7 | static struct sbuff emergency, *emergency_ptr = &emergency; |
8 | 8 | ||
9 | static int sb_add(struct sbuff *m, const char *f, ...) | 9 | static __printf(2, 3) int sb_add(struct sbuff *m, const char *f, ...) |
10 | { | 10 | { |
11 | va_list args; | 11 | va_list args; |
12 | int len; | 12 | int len; |
@@ -47,7 +47,7 @@ static void sb_close(struct sbuff *m) | |||
47 | if (likely(m != &emergency)) | 47 | if (likely(m != &emergency)) |
48 | kfree(m); | 48 | kfree(m); |
49 | else { | 49 | else { |
50 | xchg(&emergency_ptr, m); | 50 | emergency_ptr = m; |
51 | local_bh_enable(); | 51 | local_bh_enable(); |
52 | } | 52 | } |
53 | } | 53 | } |
diff --git a/include/net/netlink.h b/include/net/netlink.h index cb1f3504687f..f394fe5d7641 100644 --- a/include/net/netlink.h +++ b/include/net/netlink.h | |||
@@ -441,41 +441,6 @@ static inline int nlmsg_report(const struct nlmsghdr *nlh) | |||
441 | nla_for_each_attr(pos, nlmsg_attrdata(nlh, hdrlen), \ | 441 | nla_for_each_attr(pos, nlmsg_attrdata(nlh, hdrlen), \ |
442 | nlmsg_attrlen(nlh, hdrlen), rem) | 442 | nlmsg_attrlen(nlh, hdrlen), rem) |
443 | 443 | ||
444 | #if 0 | ||
445 | /* FIXME: Enable once all users have been converted */ | ||
446 | |||
447 | /** | ||
448 | * __nlmsg_put - Add a new netlink message to an skb | ||
449 | * @skb: socket buffer to store message in | ||
450 | * @pid: netlink process id | ||
451 | * @seq: sequence number of message | ||
452 | * @type: message type | ||
453 | * @payload: length of message payload | ||
454 | * @flags: message flags | ||
455 | * | ||
456 | * The caller is responsible to ensure that the skb provides enough | ||
457 | * tailroom for both the netlink header and payload. | ||
458 | */ | ||
459 | static inline struct nlmsghdr *__nlmsg_put(struct sk_buff *skb, u32 pid, | ||
460 | u32 seq, int type, int payload, | ||
461 | int flags) | ||
462 | { | ||
463 | struct nlmsghdr *nlh; | ||
464 | |||
465 | nlh = (struct nlmsghdr *) skb_put(skb, nlmsg_total_size(payload)); | ||
466 | nlh->nlmsg_type = type; | ||
467 | nlh->nlmsg_len = nlmsg_msg_size(payload); | ||
468 | nlh->nlmsg_flags = flags; | ||
469 | nlh->nlmsg_pid = pid; | ||
470 | nlh->nlmsg_seq = seq; | ||
471 | |||
472 | memset((unsigned char *) nlmsg_data(nlh) + payload, 0, | ||
473 | nlmsg_padlen(payload)); | ||
474 | |||
475 | return nlh; | ||
476 | } | ||
477 | #endif | ||
478 | |||
479 | /** | 444 | /** |
480 | * nlmsg_put - Add a new netlink message to an skb | 445 | * nlmsg_put - Add a new netlink message to an skb |
481 | * @skb: socket buffer to store message in | 446 | * @skb: socket buffer to store message in |
diff --git a/include/net/netns/generic.h b/include/net/netns/generic.h index d55f43443335..0931618c0f7f 100644 --- a/include/net/netns/generic.h +++ b/include/net/netns/generic.h | |||
@@ -5,6 +5,7 @@ | |||
5 | #ifndef __NET_GENERIC_H__ | 5 | #ifndef __NET_GENERIC_H__ |
6 | #define __NET_GENERIC_H__ | 6 | #define __NET_GENERIC_H__ |
7 | 7 | ||
8 | #include <linux/bug.h> | ||
8 | #include <linux/rcupdate.h> | 9 | #include <linux/rcupdate.h> |
9 | 10 | ||
10 | /* | 11 | /* |
diff --git a/include/net/nfc/nci.h b/include/net/nfc/nci.h index 2be95e2626c0..276094b91d7c 100644 --- a/include/net/nfc/nci.h +++ b/include/net/nfc/nci.h | |||
@@ -116,6 +116,11 @@ | |||
116 | #define NCI_DISC_MAP_MODE_POLL 0x01 | 116 | #define NCI_DISC_MAP_MODE_POLL 0x01 |
117 | #define NCI_DISC_MAP_MODE_LISTEN 0x02 | 117 | #define NCI_DISC_MAP_MODE_LISTEN 0x02 |
118 | 118 | ||
119 | /* NCI Discover Notification Type */ | ||
120 | #define NCI_DISCOVER_NTF_TYPE_LAST 0x00 | ||
121 | #define NCI_DISCOVER_NTF_TYPE_LAST_NFCC 0x01 | ||
122 | #define NCI_DISCOVER_NTF_TYPE_MORE 0x02 | ||
123 | |||
119 | /* NCI Deactivation Type */ | 124 | /* NCI Deactivation Type */ |
120 | #define NCI_DEACTIVATE_TYPE_IDLE_MODE 0x00 | 125 | #define NCI_DEACTIVATE_TYPE_IDLE_MODE 0x00 |
121 | #define NCI_DEACTIVATE_TYPE_SLEEP_MODE 0x01 | 126 | #define NCI_DEACTIVATE_TYPE_SLEEP_MODE 0x01 |
@@ -207,6 +212,13 @@ struct nci_rf_disc_cmd { | |||
207 | struct disc_config disc_configs[NCI_MAX_NUM_RF_CONFIGS]; | 212 | struct disc_config disc_configs[NCI_MAX_NUM_RF_CONFIGS]; |
208 | } __packed; | 213 | } __packed; |
209 | 214 | ||
215 | #define NCI_OP_RF_DISCOVER_SELECT_CMD nci_opcode_pack(NCI_GID_RF_MGMT, 0x04) | ||
216 | struct nci_rf_discover_select_cmd { | ||
217 | __u8 rf_discovery_id; | ||
218 | __u8 rf_protocol; | ||
219 | __u8 rf_interface; | ||
220 | } __packed; | ||
221 | |||
210 | #define NCI_OP_RF_DEACTIVATE_CMD nci_opcode_pack(NCI_GID_RF_MGMT, 0x06) | 222 | #define NCI_OP_RF_DEACTIVATE_CMD nci_opcode_pack(NCI_GID_RF_MGMT, 0x06) |
211 | struct nci_rf_deactivate_cmd { | 223 | struct nci_rf_deactivate_cmd { |
212 | __u8 type; | 224 | __u8 type; |
@@ -244,6 +256,8 @@ struct nci_core_init_rsp_2 { | |||
244 | 256 | ||
245 | #define NCI_OP_RF_DISCOVER_RSP nci_opcode_pack(NCI_GID_RF_MGMT, 0x03) | 257 | #define NCI_OP_RF_DISCOVER_RSP nci_opcode_pack(NCI_GID_RF_MGMT, 0x03) |
246 | 258 | ||
259 | #define NCI_OP_RF_DISCOVER_SELECT_RSP nci_opcode_pack(NCI_GID_RF_MGMT, 0x04) | ||
260 | |||
247 | #define NCI_OP_RF_DEACTIVATE_RSP nci_opcode_pack(NCI_GID_RF_MGMT, 0x06) | 261 | #define NCI_OP_RF_DEACTIVATE_RSP nci_opcode_pack(NCI_GID_RF_MGMT, 0x06) |
248 | 262 | ||
249 | /* --------------------------- */ | 263 | /* --------------------------- */ |
@@ -260,13 +274,15 @@ struct nci_core_conn_credit_ntf { | |||
260 | struct conn_credit_entry conn_entries[NCI_MAX_NUM_CONN]; | 274 | struct conn_credit_entry conn_entries[NCI_MAX_NUM_CONN]; |
261 | } __packed; | 275 | } __packed; |
262 | 276 | ||
277 | #define NCI_OP_CORE_GENERIC_ERROR_NTF nci_opcode_pack(NCI_GID_CORE, 0x07) | ||
278 | |||
263 | #define NCI_OP_CORE_INTF_ERROR_NTF nci_opcode_pack(NCI_GID_CORE, 0x08) | 279 | #define NCI_OP_CORE_INTF_ERROR_NTF nci_opcode_pack(NCI_GID_CORE, 0x08) |
264 | struct nci_core_intf_error_ntf { | 280 | struct nci_core_intf_error_ntf { |
265 | __u8 status; | 281 | __u8 status; |
266 | __u8 conn_id; | 282 | __u8 conn_id; |
267 | } __packed; | 283 | } __packed; |
268 | 284 | ||
269 | #define NCI_OP_RF_INTF_ACTIVATED_NTF nci_opcode_pack(NCI_GID_RF_MGMT, 0x05) | 285 | #define NCI_OP_RF_DISCOVER_NTF nci_opcode_pack(NCI_GID_RF_MGMT, 0x03) |
270 | struct rf_tech_specific_params_nfca_poll { | 286 | struct rf_tech_specific_params_nfca_poll { |
271 | __u16 sens_res; | 287 | __u16 sens_res; |
272 | __u8 nfcid1_len; /* 0, 4, 7, or 10 Bytes */ | 288 | __u8 nfcid1_len; /* 0, 4, 7, or 10 Bytes */ |
@@ -275,11 +291,43 @@ struct rf_tech_specific_params_nfca_poll { | |||
275 | __u8 sel_res; | 291 | __u8 sel_res; |
276 | } __packed; | 292 | } __packed; |
277 | 293 | ||
294 | struct rf_tech_specific_params_nfcb_poll { | ||
295 | __u8 sensb_res_len; | ||
296 | __u8 sensb_res[12]; /* 11 or 12 Bytes */ | ||
297 | } __packed; | ||
298 | |||
299 | struct rf_tech_specific_params_nfcf_poll { | ||
300 | __u8 bit_rate; | ||
301 | __u8 sensf_res_len; | ||
302 | __u8 sensf_res[18]; /* 16 or 18 Bytes */ | ||
303 | } __packed; | ||
304 | |||
305 | struct nci_rf_discover_ntf { | ||
306 | __u8 rf_discovery_id; | ||
307 | __u8 rf_protocol; | ||
308 | __u8 rf_tech_and_mode; | ||
309 | __u8 rf_tech_specific_params_len; | ||
310 | |||
311 | union { | ||
312 | struct rf_tech_specific_params_nfca_poll nfca_poll; | ||
313 | struct rf_tech_specific_params_nfcb_poll nfcb_poll; | ||
314 | struct rf_tech_specific_params_nfcf_poll nfcf_poll; | ||
315 | } rf_tech_specific_params; | ||
316 | |||
317 | __u8 ntf_type; | ||
318 | } __packed; | ||
319 | |||
320 | #define NCI_OP_RF_INTF_ACTIVATED_NTF nci_opcode_pack(NCI_GID_RF_MGMT, 0x05) | ||
278 | struct activation_params_nfca_poll_iso_dep { | 321 | struct activation_params_nfca_poll_iso_dep { |
279 | __u8 rats_res_len; | 322 | __u8 rats_res_len; |
280 | __u8 rats_res[20]; | 323 | __u8 rats_res[20]; |
281 | }; | 324 | }; |
282 | 325 | ||
326 | struct activation_params_nfcb_poll_iso_dep { | ||
327 | __u8 attrib_res_len; | ||
328 | __u8 attrib_res[50]; | ||
329 | }; | ||
330 | |||
283 | struct nci_rf_intf_activated_ntf { | 331 | struct nci_rf_intf_activated_ntf { |
284 | __u8 rf_discovery_id; | 332 | __u8 rf_discovery_id; |
285 | __u8 rf_interface; | 333 | __u8 rf_interface; |
@@ -291,6 +339,8 @@ struct nci_rf_intf_activated_ntf { | |||
291 | 339 | ||
292 | union { | 340 | union { |
293 | struct rf_tech_specific_params_nfca_poll nfca_poll; | 341 | struct rf_tech_specific_params_nfca_poll nfca_poll; |
342 | struct rf_tech_specific_params_nfcb_poll nfcb_poll; | ||
343 | struct rf_tech_specific_params_nfcf_poll nfcf_poll; | ||
294 | } rf_tech_specific_params; | 344 | } rf_tech_specific_params; |
295 | 345 | ||
296 | __u8 data_exch_rf_tech_and_mode; | 346 | __u8 data_exch_rf_tech_and_mode; |
@@ -300,6 +350,7 @@ struct nci_rf_intf_activated_ntf { | |||
300 | 350 | ||
301 | union { | 351 | union { |
302 | struct activation_params_nfca_poll_iso_dep nfca_poll_iso_dep; | 352 | struct activation_params_nfca_poll_iso_dep nfca_poll_iso_dep; |
353 | struct activation_params_nfcb_poll_iso_dep nfcb_poll_iso_dep; | ||
303 | } activation_params; | 354 | } activation_params; |
304 | 355 | ||
305 | } __packed; | 356 | } __packed; |
diff --git a/include/net/nfc/nci_core.h b/include/net/nfc/nci_core.h index bccd89e9d4c2..feba74027ff8 100644 --- a/include/net/nfc/nci_core.h +++ b/include/net/nfc/nci_core.h | |||
@@ -34,21 +34,31 @@ | |||
34 | #include <net/nfc/nfc.h> | 34 | #include <net/nfc/nfc.h> |
35 | #include <net/nfc/nci.h> | 35 | #include <net/nfc/nci.h> |
36 | 36 | ||
37 | /* NCI device state */ | 37 | /* NCI device flags */ |
38 | enum { | 38 | enum nci_flag { |
39 | NCI_INIT, | 39 | NCI_INIT, |
40 | NCI_UP, | 40 | NCI_UP, |
41 | NCI_DATA_EXCHANGE, | ||
42 | NCI_DATA_EXCHANGE_TO, | ||
43 | }; | ||
44 | |||
45 | /* NCI device states */ | ||
46 | enum nci_state { | ||
47 | NCI_IDLE, | ||
41 | NCI_DISCOVERY, | 48 | NCI_DISCOVERY, |
49 | NCI_W4_ALL_DISCOVERIES, | ||
50 | NCI_W4_HOST_SELECT, | ||
42 | NCI_POLL_ACTIVE, | 51 | NCI_POLL_ACTIVE, |
43 | NCI_DATA_EXCHANGE, | ||
44 | }; | 52 | }; |
45 | 53 | ||
46 | /* NCI timeouts */ | 54 | /* NCI timeouts */ |
47 | #define NCI_RESET_TIMEOUT 5000 | 55 | #define NCI_RESET_TIMEOUT 5000 |
48 | #define NCI_INIT_TIMEOUT 5000 | 56 | #define NCI_INIT_TIMEOUT 5000 |
49 | #define NCI_RF_DISC_TIMEOUT 5000 | 57 | #define NCI_RF_DISC_TIMEOUT 5000 |
50 | #define NCI_RF_DEACTIVATE_TIMEOUT 5000 | 58 | #define NCI_RF_DISC_SELECT_TIMEOUT 5000 |
59 | #define NCI_RF_DEACTIVATE_TIMEOUT 30000 | ||
51 | #define NCI_CMD_TIMEOUT 5000 | 60 | #define NCI_CMD_TIMEOUT 5000 |
61 | #define NCI_DATA_TIMEOUT 700 | ||
52 | 62 | ||
53 | struct nci_dev; | 63 | struct nci_dev; |
54 | 64 | ||
@@ -59,6 +69,7 @@ struct nci_ops { | |||
59 | }; | 69 | }; |
60 | 70 | ||
61 | #define NCI_MAX_SUPPORTED_RF_INTERFACES 4 | 71 | #define NCI_MAX_SUPPORTED_RF_INTERFACES 4 |
72 | #define NCI_MAX_DISCOVERED_TARGETS 10 | ||
62 | 73 | ||
63 | /* NCI Core structures */ | 74 | /* NCI Core structures */ |
64 | struct nci_dev { | 75 | struct nci_dev { |
@@ -68,12 +79,14 @@ struct nci_dev { | |||
68 | int tx_headroom; | 79 | int tx_headroom; |
69 | int tx_tailroom; | 80 | int tx_tailroom; |
70 | 81 | ||
82 | atomic_t state; | ||
71 | unsigned long flags; | 83 | unsigned long flags; |
72 | 84 | ||
73 | atomic_t cmd_cnt; | 85 | atomic_t cmd_cnt; |
74 | atomic_t credits_cnt; | 86 | atomic_t credits_cnt; |
75 | 87 | ||
76 | struct timer_list cmd_timer; | 88 | struct timer_list cmd_timer; |
89 | struct timer_list data_timer; | ||
77 | 90 | ||
78 | struct workqueue_struct *cmd_wq; | 91 | struct workqueue_struct *cmd_wq; |
79 | struct work_struct cmd_work; | 92 | struct work_struct cmd_work; |
@@ -96,9 +109,11 @@ struct nci_dev { | |||
96 | void *driver_data; | 109 | void *driver_data; |
97 | 110 | ||
98 | __u32 poll_prots; | 111 | __u32 poll_prots; |
99 | __u32 target_available_prots; | ||
100 | __u32 target_active_prot; | 112 | __u32 target_active_prot; |
101 | 113 | ||
114 | struct nfc_target targets[NCI_MAX_DISCOVERED_TARGETS]; | ||
115 | int n_targets; | ||
116 | |||
102 | /* received during NCI_OP_CORE_RESET_RSP */ | 117 | /* received during NCI_OP_CORE_RESET_RSP */ |
103 | __u8 nci_ver; | 118 | __u8 nci_ver; |
104 | 119 | ||
@@ -126,17 +141,17 @@ struct nci_dev { | |||
126 | 141 | ||
127 | /* ----- NCI Devices ----- */ | 142 | /* ----- NCI Devices ----- */ |
128 | struct nci_dev *nci_allocate_device(struct nci_ops *ops, | 143 | struct nci_dev *nci_allocate_device(struct nci_ops *ops, |
129 | __u32 supported_protocols, | 144 | __u32 supported_protocols, |
130 | int tx_headroom, | 145 | int tx_headroom, |
131 | int tx_tailroom); | 146 | int tx_tailroom); |
132 | void nci_free_device(struct nci_dev *ndev); | 147 | void nci_free_device(struct nci_dev *ndev); |
133 | int nci_register_device(struct nci_dev *ndev); | 148 | int nci_register_device(struct nci_dev *ndev); |
134 | void nci_unregister_device(struct nci_dev *ndev); | 149 | void nci_unregister_device(struct nci_dev *ndev); |
135 | int nci_recv_frame(struct sk_buff *skb); | 150 | int nci_recv_frame(struct sk_buff *skb); |
136 | 151 | ||
137 | static inline struct sk_buff *nci_skb_alloc(struct nci_dev *ndev, | 152 | static inline struct sk_buff *nci_skb_alloc(struct nci_dev *ndev, |
138 | unsigned int len, | 153 | unsigned int len, |
139 | gfp_t how) | 154 | gfp_t how) |
140 | { | 155 | { |
141 | struct sk_buff *skb; | 156 | struct sk_buff *skb; |
142 | 157 | ||
@@ -169,6 +184,7 @@ int nci_send_cmd(struct nci_dev *ndev, __u16 opcode, __u8 plen, void *payload); | |||
169 | int nci_send_data(struct nci_dev *ndev, __u8 conn_id, struct sk_buff *skb); | 184 | int nci_send_data(struct nci_dev *ndev, __u8 conn_id, struct sk_buff *skb); |
170 | void nci_data_exchange_complete(struct nci_dev *ndev, struct sk_buff *skb, | 185 | void nci_data_exchange_complete(struct nci_dev *ndev, struct sk_buff *skb, |
171 | int err); | 186 | int err); |
187 | void nci_clear_target_list(struct nci_dev *ndev); | ||
172 | 188 | ||
173 | /* ----- NCI requests ----- */ | 189 | /* ----- NCI requests ----- */ |
174 | #define NCI_REQ_DONE 0 | 190 | #define NCI_REQ_DONE 0 |
diff --git a/include/net/nfc/nfc.h b/include/net/nfc/nfc.h index 8696b773a695..bac070bf3514 100644 --- a/include/net/nfc/nfc.h +++ b/include/net/nfc/nfc.h | |||
@@ -24,6 +24,7 @@ | |||
24 | #ifndef __NET_NFC_H | 24 | #ifndef __NET_NFC_H |
25 | #define __NET_NFC_H | 25 | #define __NET_NFC_H |
26 | 26 | ||
27 | #include <linux/nfc.h> | ||
27 | #include <linux/device.h> | 28 | #include <linux/device.h> |
28 | #include <linux/skbuff.h> | 29 | #include <linux/skbuff.h> |
29 | 30 | ||
@@ -52,20 +53,19 @@ struct nfc_ops { | |||
52 | int (*dev_down)(struct nfc_dev *dev); | 53 | int (*dev_down)(struct nfc_dev *dev); |
53 | int (*start_poll)(struct nfc_dev *dev, u32 protocols); | 54 | int (*start_poll)(struct nfc_dev *dev, u32 protocols); |
54 | void (*stop_poll)(struct nfc_dev *dev); | 55 | void (*stop_poll)(struct nfc_dev *dev); |
55 | int (*dep_link_up)(struct nfc_dev *dev, int target_idx, | 56 | int (*dep_link_up)(struct nfc_dev *dev, int target_idx, u8 comm_mode, |
56 | u8 comm_mode, u8 rf_mode); | 57 | u8 *gb, size_t gb_len); |
57 | int (*dep_link_down)(struct nfc_dev *dev); | 58 | int (*dep_link_down)(struct nfc_dev *dev); |
58 | int (*activate_target)(struct nfc_dev *dev, u32 target_idx, | 59 | int (*activate_target)(struct nfc_dev *dev, u32 target_idx, |
59 | u32 protocol); | 60 | u32 protocol); |
60 | void (*deactivate_target)(struct nfc_dev *dev, u32 target_idx); | 61 | void (*deactivate_target)(struct nfc_dev *dev, u32 target_idx); |
61 | int (*data_exchange)(struct nfc_dev *dev, u32 target_idx, | 62 | int (*data_exchange)(struct nfc_dev *dev, u32 target_idx, |
62 | struct sk_buff *skb, data_exchange_cb_t cb, | 63 | struct sk_buff *skb, data_exchange_cb_t cb, |
63 | void *cb_context); | 64 | void *cb_context); |
64 | }; | 65 | }; |
65 | 66 | ||
66 | #define NFC_TARGET_IDX_ANY -1 | 67 | #define NFC_TARGET_IDX_ANY -1 |
67 | #define NFC_MAX_GT_LEN 48 | 68 | #define NFC_MAX_GT_LEN 48 |
68 | #define NFC_MAX_NFCID1_LEN 10 | ||
69 | 69 | ||
70 | struct nfc_target { | 70 | struct nfc_target { |
71 | u32 idx; | 71 | u32 idx; |
@@ -73,7 +73,11 @@ struct nfc_target { | |||
73 | u16 sens_res; | 73 | u16 sens_res; |
74 | u8 sel_res; | 74 | u8 sel_res; |
75 | u8 nfcid1_len; | 75 | u8 nfcid1_len; |
76 | u8 nfcid1[NFC_MAX_NFCID1_LEN]; | 76 | u8 nfcid1[NFC_NFCID1_MAXSIZE]; |
77 | u8 sensb_res_len; | ||
78 | u8 sensb_res[NFC_SENSB_RES_MAXSIZE]; | ||
79 | u8 sensf_res_len; | ||
80 | u8 sensf_res[NFC_SENSF_RES_MAXSIZE]; | ||
77 | }; | 81 | }; |
78 | 82 | ||
79 | struct nfc_genl_data { | 83 | struct nfc_genl_data { |
@@ -83,7 +87,6 @@ struct nfc_genl_data { | |||
83 | 87 | ||
84 | struct nfc_dev { | 88 | struct nfc_dev { |
85 | unsigned idx; | 89 | unsigned idx; |
86 | unsigned target_idx; | ||
87 | struct nfc_target *targets; | 90 | struct nfc_target *targets; |
88 | int n_targets; | 91 | int n_targets; |
89 | int targets_generation; | 92 | int targets_generation; |
@@ -107,9 +110,9 @@ struct nfc_dev { | |||
107 | extern struct class nfc_class; | 110 | extern struct class nfc_class; |
108 | 111 | ||
109 | struct nfc_dev *nfc_allocate_device(struct nfc_ops *ops, | 112 | struct nfc_dev *nfc_allocate_device(struct nfc_ops *ops, |
110 | u32 supported_protocols, | 113 | u32 supported_protocols, |
111 | int tx_headroom, | 114 | int tx_headroom, |
112 | int tx_tailroom); | 115 | int tx_tailroom); |
113 | 116 | ||
114 | /** | 117 | /** |
115 | * nfc_free_device - free nfc device | 118 | * nfc_free_device - free nfc device |
@@ -132,7 +135,7 @@ void nfc_unregister_device(struct nfc_dev *dev); | |||
132 | * @dev: The parent device | 135 | * @dev: The parent device |
133 | */ | 136 | */ |
134 | static inline void nfc_set_parent_dev(struct nfc_dev *nfc_dev, | 137 | static inline void nfc_set_parent_dev(struct nfc_dev *nfc_dev, |
135 | struct device *dev) | 138 | struct device *dev) |
136 | { | 139 | { |
137 | nfc_dev->dev.parent = dev; | 140 | nfc_dev->dev.parent = dev; |
138 | } | 141 | } |
@@ -169,17 +172,15 @@ static inline const char *nfc_device_name(struct nfc_dev *dev) | |||
169 | } | 172 | } |
170 | 173 | ||
171 | struct sk_buff *nfc_alloc_send_skb(struct nfc_dev *dev, struct sock *sk, | 174 | struct sk_buff *nfc_alloc_send_skb(struct nfc_dev *dev, struct sock *sk, |
172 | unsigned int flags, unsigned int size, | 175 | unsigned int flags, unsigned int size, |
173 | unsigned int *err); | 176 | unsigned int *err); |
174 | struct sk_buff *nfc_alloc_recv_skb(unsigned int size, gfp_t gfp); | 177 | struct sk_buff *nfc_alloc_recv_skb(unsigned int size, gfp_t gfp); |
175 | 178 | ||
176 | int nfc_set_remote_general_bytes(struct nfc_dev *dev, | 179 | int nfc_set_remote_general_bytes(struct nfc_dev *dev, |
177 | u8 *gt, u8 gt_len); | 180 | u8 *gt, u8 gt_len); |
178 | 181 | ||
179 | u8 *nfc_get_local_general_bytes(struct nfc_dev *dev, u8 *gt_len); | 182 | int nfc_targets_found(struct nfc_dev *dev, |
180 | 183 | struct nfc_target *targets, int ntargets); | |
181 | int nfc_targets_found(struct nfc_dev *dev, struct nfc_target *targets, | ||
182 | int ntargets); | ||
183 | 184 | ||
184 | int nfc_dep_link_is_up(struct nfc_dev *dev, u32 target_idx, | 185 | int nfc_dep_link_is_up(struct nfc_dev *dev, u32 target_idx, |
185 | u8 comm_mode, u8 rf_mode); | 186 | u8 comm_mode, u8 rf_mode); |
diff --git a/include/net/red.h b/include/net/red.h index 28068ec614b2..77d4c3745cb5 100644 --- a/include/net/red.h +++ b/include/net/red.h | |||
@@ -2,6 +2,7 @@ | |||
2 | #define __NET_SCHED_RED_H | 2 | #define __NET_SCHED_RED_H |
3 | 3 | ||
4 | #include <linux/types.h> | 4 | #include <linux/types.h> |
5 | #include <linux/bug.h> | ||
5 | #include <net/pkt_sched.h> | 6 | #include <net/pkt_sched.h> |
6 | #include <net/inet_ecn.h> | 7 | #include <net/inet_ecn.h> |
7 | #include <net/dsfield.h> | 8 | #include <net/dsfield.h> |
diff --git a/include/net/sctp/sctp.h b/include/net/sctp/sctp.h index d3685615a8b0..6ee44b24864a 100644 --- a/include/net/sctp/sctp.h +++ b/include/net/sctp/sctp.h | |||
@@ -413,6 +413,7 @@ static inline sctp_assoc_t sctp_assoc2id(const struct sctp_association *asoc) | |||
413 | /* Look up the association by its id. */ | 413 | /* Look up the association by its id. */ |
414 | struct sctp_association *sctp_id2assoc(struct sock *sk, sctp_assoc_t id); | 414 | struct sctp_association *sctp_id2assoc(struct sock *sk, sctp_assoc_t id); |
415 | 415 | ||
416 | int sctp_do_peeloff(struct sock *sk, sctp_assoc_t id, struct socket **sockp); | ||
416 | 417 | ||
417 | /* A macro to walk a list of skbs. */ | 418 | /* A macro to walk a list of skbs. */ |
418 | #define sctp_skb_for_each(pos, head, tmp) \ | 419 | #define sctp_skb_for_each(pos, head, tmp) \ |
diff --git a/include/net/sock.h b/include/net/sock.h index 91c1c8baf020..a6ba1f8871fd 100644 --- a/include/net/sock.h +++ b/include/net/sock.h | |||
@@ -55,7 +55,9 @@ | |||
55 | #include <linux/uaccess.h> | 55 | #include <linux/uaccess.h> |
56 | #include <linux/memcontrol.h> | 56 | #include <linux/memcontrol.h> |
57 | #include <linux/res_counter.h> | 57 | #include <linux/res_counter.h> |
58 | #include <linux/jump_label.h> | 58 | #include <linux/static_key.h> |
59 | #include <linux/aio.h> | ||
60 | #include <linux/sched.h> | ||
59 | 61 | ||
60 | #include <linux/filter.h> | 62 | #include <linux/filter.h> |
61 | #include <linux/rculist_nulls.h> | 63 | #include <linux/rculist_nulls.h> |
@@ -69,7 +71,7 @@ struct cgroup; | |||
69 | struct cgroup_subsys; | 71 | struct cgroup_subsys; |
70 | #ifdef CONFIG_NET | 72 | #ifdef CONFIG_NET |
71 | int mem_cgroup_sockets_init(struct cgroup *cgrp, struct cgroup_subsys *ss); | 73 | int mem_cgroup_sockets_init(struct cgroup *cgrp, struct cgroup_subsys *ss); |
72 | void mem_cgroup_sockets_destroy(struct cgroup *cgrp, struct cgroup_subsys *ss); | 74 | void mem_cgroup_sockets_destroy(struct cgroup *cgrp); |
73 | #else | 75 | #else |
74 | static inline | 76 | static inline |
75 | int mem_cgroup_sockets_init(struct cgroup *cgrp, struct cgroup_subsys *ss) | 77 | int mem_cgroup_sockets_init(struct cgroup *cgrp, struct cgroup_subsys *ss) |
@@ -77,7 +79,7 @@ int mem_cgroup_sockets_init(struct cgroup *cgrp, struct cgroup_subsys *ss) | |||
77 | return 0; | 79 | return 0; |
78 | } | 80 | } |
79 | static inline | 81 | static inline |
80 | void mem_cgroup_sockets_destroy(struct cgroup *cgrp, struct cgroup_subsys *ss) | 82 | void mem_cgroup_sockets_destroy(struct cgroup *cgrp) |
81 | { | 83 | { |
82 | } | 84 | } |
83 | #endif | 85 | #endif |
@@ -357,6 +359,7 @@ struct sock { | |||
357 | struct page *sk_sndmsg_page; | 359 | struct page *sk_sndmsg_page; |
358 | struct sk_buff *sk_send_head; | 360 | struct sk_buff *sk_send_head; |
359 | __u32 sk_sndmsg_off; | 361 | __u32 sk_sndmsg_off; |
362 | __s32 sk_peek_off; | ||
360 | int sk_write_pending; | 363 | int sk_write_pending; |
361 | #ifdef CONFIG_SECURITY | 364 | #ifdef CONFIG_SECURITY |
362 | void *sk_security; | 365 | void *sk_security; |
@@ -373,6 +376,30 @@ struct sock { | |||
373 | void (*sk_destruct)(struct sock *sk); | 376 | void (*sk_destruct)(struct sock *sk); |
374 | }; | 377 | }; |
375 | 378 | ||
379 | static inline int sk_peek_offset(struct sock *sk, int flags) | ||
380 | { | ||
381 | if ((flags & MSG_PEEK) && (sk->sk_peek_off >= 0)) | ||
382 | return sk->sk_peek_off; | ||
383 | else | ||
384 | return 0; | ||
385 | } | ||
386 | |||
387 | static inline void sk_peek_offset_bwd(struct sock *sk, int val) | ||
388 | { | ||
389 | if (sk->sk_peek_off >= 0) { | ||
390 | if (sk->sk_peek_off >= val) | ||
391 | sk->sk_peek_off -= val; | ||
392 | else | ||
393 | sk->sk_peek_off = 0; | ||
394 | } | ||
395 | } | ||
396 | |||
397 | static inline void sk_peek_offset_fwd(struct sock *sk, int val) | ||
398 | { | ||
399 | if (sk->sk_peek_off >= 0) | ||
400 | sk->sk_peek_off += val; | ||
401 | } | ||
402 | |||
376 | /* | 403 | /* |
377 | * Hashed lists helper routines | 404 | * Hashed lists helper routines |
378 | */ | 405 | */ |
@@ -590,6 +617,10 @@ enum sock_flags { | |||
590 | SOCK_RXQ_OVFL, | 617 | SOCK_RXQ_OVFL, |
591 | SOCK_ZEROCOPY, /* buffers from userspace */ | 618 | SOCK_ZEROCOPY, /* buffers from userspace */ |
592 | SOCK_WIFI_STATUS, /* push wifi status to userspace */ | 619 | SOCK_WIFI_STATUS, /* push wifi status to userspace */ |
620 | SOCK_NOFCS, /* Tell NIC not to do the Ethernet FCS. | ||
621 | * Will use last 4 bytes of packet sent from | ||
622 | * user-space instead. | ||
623 | */ | ||
593 | }; | 624 | }; |
594 | 625 | ||
595 | static inline void sock_copy_flags(struct sock *nsk, struct sock *osk) | 626 | static inline void sock_copy_flags(struct sock *nsk, struct sock *osk) |
@@ -871,8 +902,7 @@ struct proto { | |||
871 | */ | 902 | */ |
872 | int (*init_cgroup)(struct cgroup *cgrp, | 903 | int (*init_cgroup)(struct cgroup *cgrp, |
873 | struct cgroup_subsys *ss); | 904 | struct cgroup_subsys *ss); |
874 | void (*destroy_cgroup)(struct cgroup *cgrp, | 905 | void (*destroy_cgroup)(struct cgroup *cgrp); |
875 | struct cgroup_subsys *ss); | ||
876 | struct cg_proto *(*proto_cgroup)(struct mem_cgroup *memcg); | 906 | struct cg_proto *(*proto_cgroup)(struct mem_cgroup *memcg); |
877 | #endif | 907 | #endif |
878 | }; | 908 | }; |
@@ -924,13 +954,13 @@ inline void sk_refcnt_debug_release(const struct sock *sk) | |||
924 | #endif /* SOCK_REFCNT_DEBUG */ | 954 | #endif /* SOCK_REFCNT_DEBUG */ |
925 | 955 | ||
926 | #if defined(CONFIG_CGROUP_MEM_RES_CTLR_KMEM) && defined(CONFIG_NET) | 956 | #if defined(CONFIG_CGROUP_MEM_RES_CTLR_KMEM) && defined(CONFIG_NET) |
927 | extern struct jump_label_key memcg_socket_limit_enabled; | 957 | extern struct static_key memcg_socket_limit_enabled; |
928 | static inline struct cg_proto *parent_cg_proto(struct proto *proto, | 958 | static inline struct cg_proto *parent_cg_proto(struct proto *proto, |
929 | struct cg_proto *cg_proto) | 959 | struct cg_proto *cg_proto) |
930 | { | 960 | { |
931 | return proto->proto_cgroup(parent_mem_cgroup(cg_proto->memcg)); | 961 | return proto->proto_cgroup(parent_mem_cgroup(cg_proto->memcg)); |
932 | } | 962 | } |
933 | #define mem_cgroup_sockets_enabled static_branch(&memcg_socket_limit_enabled) | 963 | #define mem_cgroup_sockets_enabled static_key_false(&memcg_socket_limit_enabled) |
934 | #else | 964 | #else |
935 | #define mem_cgroup_sockets_enabled 0 | 965 | #define mem_cgroup_sockets_enabled 0 |
936 | static inline struct cg_proto *parent_cg_proto(struct proto *proto, | 966 | static inline struct cg_proto *parent_cg_proto(struct proto *proto, |
@@ -1824,7 +1854,7 @@ static inline bool wq_has_sleeper(struct socket_wq *wq) | |||
1824 | static inline void sock_poll_wait(struct file *filp, | 1854 | static inline void sock_poll_wait(struct file *filp, |
1825 | wait_queue_head_t *wait_address, poll_table *p) | 1855 | wait_queue_head_t *wait_address, poll_table *p) |
1826 | { | 1856 | { |
1827 | if (p && wait_address) { | 1857 | if (!poll_does_not_wait(p) && wait_address) { |
1828 | poll_wait(filp, wait_address, p); | 1858 | poll_wait(filp, wait_address, p); |
1829 | /* | 1859 | /* |
1830 | * We need to be sure we are in sync with the | 1860 | * We need to be sure we are in sync with the |
diff --git a/include/net/tcp.h b/include/net/tcp.h index 42c29bfbcee3..f75a04d752cb 100644 --- a/include/net/tcp.h +++ b/include/net/tcp.h | |||
@@ -22,6 +22,7 @@ | |||
22 | 22 | ||
23 | #include <linux/list.h> | 23 | #include <linux/list.h> |
24 | #include <linux/tcp.h> | 24 | #include <linux/tcp.h> |
25 | #include <linux/bug.h> | ||
25 | #include <linux/slab.h> | 26 | #include <linux/slab.h> |
26 | #include <linux/cache.h> | 27 | #include <linux/cache.h> |
27 | #include <linux/percpu.h> | 28 | #include <linux/percpu.h> |
@@ -1138,35 +1139,27 @@ static inline void tcp_clear_all_retrans_hints(struct tcp_sock *tp) | |||
1138 | /* MD5 Signature */ | 1139 | /* MD5 Signature */ |
1139 | struct crypto_hash; | 1140 | struct crypto_hash; |
1140 | 1141 | ||
1142 | union tcp_md5_addr { | ||
1143 | struct in_addr a4; | ||
1144 | #if IS_ENABLED(CONFIG_IPV6) | ||
1145 | struct in6_addr a6; | ||
1146 | #endif | ||
1147 | }; | ||
1148 | |||
1141 | /* - key database */ | 1149 | /* - key database */ |
1142 | struct tcp_md5sig_key { | 1150 | struct tcp_md5sig_key { |
1143 | u8 *key; | 1151 | struct hlist_node node; |
1144 | u8 keylen; | 1152 | u8 keylen; |
1145 | }; | 1153 | u8 family; /* AF_INET or AF_INET6 */ |
1146 | 1154 | union tcp_md5_addr addr; | |
1147 | struct tcp4_md5sig_key { | 1155 | u8 key[TCP_MD5SIG_MAXKEYLEN]; |
1148 | struct tcp_md5sig_key base; | 1156 | struct rcu_head rcu; |
1149 | __be32 addr; | ||
1150 | }; | ||
1151 | |||
1152 | struct tcp6_md5sig_key { | ||
1153 | struct tcp_md5sig_key base; | ||
1154 | #if 0 | ||
1155 | u32 scope_id; /* XXX */ | ||
1156 | #endif | ||
1157 | struct in6_addr addr; | ||
1158 | }; | 1157 | }; |
1159 | 1158 | ||
1160 | /* - sock block */ | 1159 | /* - sock block */ |
1161 | struct tcp_md5sig_info { | 1160 | struct tcp_md5sig_info { |
1162 | struct tcp4_md5sig_key *keys4; | 1161 | struct hlist_head head; |
1163 | #if IS_ENABLED(CONFIG_IPV6) | 1162 | struct rcu_head rcu; |
1164 | struct tcp6_md5sig_key *keys6; | ||
1165 | u32 entries6; | ||
1166 | u32 alloced6; | ||
1167 | #endif | ||
1168 | u32 entries4; | ||
1169 | u32 alloced4; | ||
1170 | }; | 1163 | }; |
1171 | 1164 | ||
1172 | /* - pseudo header */ | 1165 | /* - pseudo header */ |
@@ -1203,19 +1196,25 @@ extern int tcp_v4_md5_hash_skb(char *md5_hash, struct tcp_md5sig_key *key, | |||
1203 | const struct sock *sk, | 1196 | const struct sock *sk, |
1204 | const struct request_sock *req, | 1197 | const struct request_sock *req, |
1205 | const struct sk_buff *skb); | 1198 | const struct sk_buff *skb); |
1206 | extern struct tcp_md5sig_key * tcp_v4_md5_lookup(struct sock *sk, | 1199 | extern int tcp_md5_do_add(struct sock *sk, const union tcp_md5_addr *addr, |
1207 | struct sock *addr_sk); | 1200 | int family, const u8 *newkey, |
1208 | extern int tcp_v4_md5_do_add(struct sock *sk, __be32 addr, u8 *newkey, | 1201 | u8 newkeylen, gfp_t gfp); |
1209 | u8 newkeylen); | 1202 | extern int tcp_md5_do_del(struct sock *sk, const union tcp_md5_addr *addr, |
1210 | extern int tcp_v4_md5_do_del(struct sock *sk, __be32 addr); | 1203 | int family); |
1204 | extern struct tcp_md5sig_key *tcp_v4_md5_lookup(struct sock *sk, | ||
1205 | struct sock *addr_sk); | ||
1211 | 1206 | ||
1212 | #ifdef CONFIG_TCP_MD5SIG | 1207 | #ifdef CONFIG_TCP_MD5SIG |
1213 | #define tcp_twsk_md5_key(twsk) ((twsk)->tw_md5_keylen ? \ | 1208 | extern struct tcp_md5sig_key *tcp_md5_do_lookup(struct sock *sk, |
1214 | &(struct tcp_md5sig_key) { \ | 1209 | const union tcp_md5_addr *addr, int family); |
1215 | .key = (twsk)->tw_md5_key, \ | 1210 | #define tcp_twsk_md5_key(twsk) ((twsk)->tw_md5_key) |
1216 | .keylen = (twsk)->tw_md5_keylen, \ | ||
1217 | } : NULL) | ||
1218 | #else | 1211 | #else |
1212 | static inline struct tcp_md5sig_key *tcp_md5_do_lookup(struct sock *sk, | ||
1213 | const union tcp_md5_addr *addr, | ||
1214 | int family) | ||
1215 | { | ||
1216 | return NULL; | ||
1217 | } | ||
1219 | #define tcp_twsk_md5_key(twsk) NULL | 1218 | #define tcp_twsk_md5_key(twsk) NULL |
1220 | #endif | 1219 | #endif |
1221 | 1220 | ||
@@ -1364,8 +1363,9 @@ static inline void tcp_push_pending_frames(struct sock *sk) | |||
1364 | } | 1363 | } |
1365 | } | 1364 | } |
1366 | 1365 | ||
1367 | /* Start sequence of the highest skb with SACKed bit, valid only if | 1366 | /* Start sequence of the skb just after the highest skb with SACKed |
1368 | * sacked > 0 or when the caller has ensured validity by itself. | 1367 | * bit, valid only if sacked_out > 0 or when the caller has ensured |
1368 | * validity by itself. | ||
1369 | */ | 1369 | */ |
1370 | static inline u32 tcp_highest_sack_seq(struct tcp_sock *tp) | 1370 | static inline u32 tcp_highest_sack_seq(struct tcp_sock *tp) |
1371 | { | 1371 | { |
@@ -1470,10 +1470,6 @@ struct tcp_sock_af_ops { | |||
1470 | const struct sock *sk, | 1470 | const struct sock *sk, |
1471 | const struct request_sock *req, | 1471 | const struct request_sock *req, |
1472 | const struct sk_buff *skb); | 1472 | const struct sk_buff *skb); |
1473 | int (*md5_add) (struct sock *sk, | ||
1474 | struct sock *addr_sk, | ||
1475 | u8 *newkey, | ||
1476 | u8 len); | ||
1477 | int (*md5_parse) (struct sock *sk, | 1473 | int (*md5_parse) (struct sock *sk, |
1478 | char __user *optval, | 1474 | char __user *optval, |
1479 | int optlen); | 1475 | int optlen); |
diff --git a/include/net/tcp_memcontrol.h b/include/net/tcp_memcontrol.h index 3512082fa909..48410ff25c9e 100644 --- a/include/net/tcp_memcontrol.h +++ b/include/net/tcp_memcontrol.h | |||
@@ -13,7 +13,7 @@ struct tcp_memcontrol { | |||
13 | 13 | ||
14 | struct cg_proto *tcp_proto_cgroup(struct mem_cgroup *memcg); | 14 | struct cg_proto *tcp_proto_cgroup(struct mem_cgroup *memcg); |
15 | int tcp_init_cgroup(struct cgroup *cgrp, struct cgroup_subsys *ss); | 15 | int tcp_init_cgroup(struct cgroup *cgrp, struct cgroup_subsys *ss); |
16 | void tcp_destroy_cgroup(struct cgroup *cgrp, struct cgroup_subsys *ss); | 16 | void tcp_destroy_cgroup(struct cgroup *cgrp); |
17 | unsigned long long tcp_max_memory(const struct mem_cgroup *memcg); | 17 | unsigned long long tcp_max_memory(const struct mem_cgroup *memcg); |
18 | void tcp_prot_mem(struct mem_cgroup *memcg, long val, int idx); | 18 | void tcp_prot_mem(struct mem_cgroup *memcg, long val, int idx); |
19 | #endif /* _TCP_MEMCG_H */ | 19 | #endif /* _TCP_MEMCG_H */ |
diff --git a/include/net/timewait_sock.h b/include/net/timewait_sock.h index 053b3cf2c66a..8d6689cb2c66 100644 --- a/include/net/timewait_sock.h +++ b/include/net/timewait_sock.h | |||
@@ -12,6 +12,7 @@ | |||
12 | #define _TIMEWAIT_SOCK_H | 12 | #define _TIMEWAIT_SOCK_H |
13 | 13 | ||
14 | #include <linux/slab.h> | 14 | #include <linux/slab.h> |
15 | #include <linux/bug.h> | ||
15 | #include <net/sock.h> | 16 | #include <net/sock.h> |
16 | 17 | ||
17 | struct timewait_sock_ops { | 18 | struct timewait_sock_ops { |
diff --git a/include/net/udp.h b/include/net/udp.h index e39592f682c3..5d606d9da9e5 100644 --- a/include/net/udp.h +++ b/include/net/udp.h | |||
@@ -23,6 +23,7 @@ | |||
23 | #define _UDP_H | 23 | #define _UDP_H |
24 | 24 | ||
25 | #include <linux/list.h> | 25 | #include <linux/list.h> |
26 | #include <linux/bug.h> | ||
26 | #include <net/inet_sock.h> | 27 | #include <net/inet_sock.h> |
27 | #include <net/sock.h> | 28 | #include <net/sock.h> |
28 | #include <net/snmp.h> | 29 | #include <net/snmp.h> |
diff --git a/include/net/udplite.h b/include/net/udplite.h index 5f097ca7d5c5..71375459a884 100644 --- a/include/net/udplite.h +++ b/include/net/udplite.h | |||
@@ -40,7 +40,7 @@ static inline int udplite_checksum_init(struct sk_buff *skb, struct udphdr *uh) | |||
40 | * checksum. UDP-Lite (like IPv6) mandates checksums, hence packets | 40 | * checksum. UDP-Lite (like IPv6) mandates checksums, hence packets |
41 | * with a zero checksum field are illegal. */ | 41 | * with a zero checksum field are illegal. */ |
42 | if (uh->check == 0) { | 42 | if (uh->check == 0) { |
43 | LIMIT_NETDEBUG(KERN_DEBUG "UDPLITE: zeroed checksum field\n"); | 43 | LIMIT_NETDEBUG(KERN_DEBUG "UDPLite: zeroed checksum field\n"); |
44 | return 1; | 44 | return 1; |
45 | } | 45 | } |
46 | 46 | ||
@@ -52,7 +52,7 @@ static inline int udplite_checksum_init(struct sk_buff *skb, struct udphdr *uh) | |||
52 | /* | 52 | /* |
53 | * Coverage length violates RFC 3828: log and discard silently. | 53 | * Coverage length violates RFC 3828: log and discard silently. |
54 | */ | 54 | */ |
55 | LIMIT_NETDEBUG(KERN_DEBUG "UDPLITE: bad csum coverage %d/%d\n", | 55 | LIMIT_NETDEBUG(KERN_DEBUG "UDPLite: bad csum coverage %d/%d\n", |
56 | cscov, skb->len); | 56 | cscov, skb->len); |
57 | return 1; | 57 | return 1; |
58 | 58 | ||
diff --git a/include/net/wpan-phy.h b/include/net/wpan-phy.h index d86fffd3c03c..ff27f1b078d1 100644 --- a/include/net/wpan-phy.h +++ b/include/net/wpan-phy.h | |||
@@ -23,6 +23,7 @@ | |||
23 | 23 | ||
24 | #include <linux/netdevice.h> | 24 | #include <linux/netdevice.h> |
25 | #include <linux/mutex.h> | 25 | #include <linux/mutex.h> |
26 | #include <linux/bug.h> | ||
26 | 27 | ||
27 | struct wpan_phy { | 28 | struct wpan_phy { |
28 | struct mutex pib_lock; | 29 | struct mutex pib_lock; |
diff --git a/include/net/xfrm.h b/include/net/xfrm.h index 89174e29dca9..96239e78e621 100644 --- a/include/net/xfrm.h +++ b/include/net/xfrm.h | |||
@@ -1566,11 +1566,6 @@ extern struct xfrm_algo_desc *xfrm_calg_get_byname(const char *name, int probe); | |||
1566 | extern struct xfrm_algo_desc *xfrm_aead_get_byname(const char *name, int icv_len, | 1566 | extern struct xfrm_algo_desc *xfrm_aead_get_byname(const char *name, int icv_len, |
1567 | int probe); | 1567 | int probe); |
1568 | 1568 | ||
1569 | struct hash_desc; | ||
1570 | struct scatterlist; | ||
1571 | typedef int (icv_update_fn_t)(struct hash_desc *, struct scatterlist *, | ||
1572 | unsigned int); | ||
1573 | |||
1574 | static inline int xfrm_addr_cmp(const xfrm_address_t *a, | 1569 | static inline int xfrm_addr_cmp(const xfrm_address_t *a, |
1575 | const xfrm_address_t *b, | 1570 | const xfrm_address_t *b, |
1576 | int family) | 1571 | int family) |
diff --git a/include/rdma/ib_mad.h b/include/rdma/ib_mad.h index d3b9401b77b0..b513f57e1725 100644 --- a/include/rdma/ib_mad.h +++ b/include/rdma/ib_mad.h | |||
@@ -77,6 +77,15 @@ | |||
77 | 77 | ||
78 | #define IB_MGMT_MAX_METHODS 128 | 78 | #define IB_MGMT_MAX_METHODS 128 |
79 | 79 | ||
80 | /* MAD Status field bit masks */ | ||
81 | #define IB_MGMT_MAD_STATUS_SUCCESS 0x0000 | ||
82 | #define IB_MGMT_MAD_STATUS_BUSY 0x0001 | ||
83 | #define IB_MGMT_MAD_STATUS_REDIRECT_REQD 0x0002 | ||
84 | #define IB_MGMT_MAD_STATUS_BAD_VERSION 0x0004 | ||
85 | #define IB_MGMT_MAD_STATUS_UNSUPPORTED_METHOD 0x0008 | ||
86 | #define IB_MGMT_MAD_STATUS_UNSUPPORTED_METHOD_ATTRIB 0x000c | ||
87 | #define IB_MGMT_MAD_STATUS_INVALID_ATTRIB_VALUE 0x001c | ||
88 | |||
80 | /* RMPP information */ | 89 | /* RMPP information */ |
81 | #define IB_MGMT_RMPP_VERSION 1 | 90 | #define IB_MGMT_RMPP_VERSION 1 |
82 | 91 | ||
diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h index bf5daafe8ecc..c3cca5a4dacd 100644 --- a/include/rdma/ib_verbs.h +++ b/include/rdma/ib_verbs.h | |||
@@ -239,6 +239,15 @@ static inline int ib_width_enum_to_int(enum ib_port_width width) | |||
239 | } | 239 | } |
240 | } | 240 | } |
241 | 241 | ||
242 | enum ib_port_speed { | ||
243 | IB_SPEED_SDR = 1, | ||
244 | IB_SPEED_DDR = 2, | ||
245 | IB_SPEED_QDR = 4, | ||
246 | IB_SPEED_FDR10 = 8, | ||
247 | IB_SPEED_FDR = 16, | ||
248 | IB_SPEED_EDR = 32 | ||
249 | }; | ||
250 | |||
242 | struct ib_protocol_stats { | 251 | struct ib_protocol_stats { |
243 | /* TBD... */ | 252 | /* TBD... */ |
244 | }; | 253 | }; |
@@ -509,6 +518,7 @@ enum ib_wc_flags { | |||
509 | IB_WC_GRH = 1, | 518 | IB_WC_GRH = 1, |
510 | IB_WC_WITH_IMM = (1<<1), | 519 | IB_WC_WITH_IMM = (1<<1), |
511 | IB_WC_WITH_INVALIDATE = (1<<2), | 520 | IB_WC_WITH_INVALIDATE = (1<<2), |
521 | IB_WC_IP_CSUM_OK = (1<<3), | ||
512 | }; | 522 | }; |
513 | 523 | ||
514 | struct ib_wc { | 524 | struct ib_wc { |
@@ -529,7 +539,6 @@ struct ib_wc { | |||
529 | u8 sl; | 539 | u8 sl; |
530 | u8 dlid_path_bits; | 540 | u8 dlid_path_bits; |
531 | u8 port_num; /* valid only for DR SMPs on switches */ | 541 | u8 port_num; /* valid only for DR SMPs on switches */ |
532 | int csum_ok; | ||
533 | }; | 542 | }; |
534 | 543 | ||
535 | enum ib_cq_notify_flags { | 544 | enum ib_cq_notify_flags { |
diff --git a/include/scsi/fc/fc_fcp.h b/include/scsi/fc/fc_fcp.h index 652dec230514..0d7d67e96d43 100644 --- a/include/scsi/fc/fc_fcp.h +++ b/include/scsi/fc/fc_fcp.h | |||
@@ -20,6 +20,8 @@ | |||
20 | #ifndef _FC_FCP_H_ | 20 | #ifndef _FC_FCP_H_ |
21 | #define _FC_FCP_H_ | 21 | #define _FC_FCP_H_ |
22 | 22 | ||
23 | #include <scsi/scsi.h> | ||
24 | |||
23 | /* | 25 | /* |
24 | * Fibre Channel Protocol for SCSI. | 26 | * Fibre Channel Protocol for SCSI. |
25 | * From T10 FCP-3, T10 project 1560-D Rev 4, Sept. 13, 2005. | 27 | * From T10 FCP-3, T10 project 1560-D Rev 4, Sept. 13, 2005. |
@@ -45,7 +47,7 @@ | |||
45 | * FCP_CMND IU Payload. | 47 | * FCP_CMND IU Payload. |
46 | */ | 48 | */ |
47 | struct fcp_cmnd { | 49 | struct fcp_cmnd { |
48 | __u8 fc_lun[8]; /* logical unit number */ | 50 | struct scsi_lun fc_lun; /* logical unit number */ |
49 | __u8 fc_cmdref; /* command reference number */ | 51 | __u8 fc_cmdref; /* command reference number */ |
50 | __u8 fc_pri_ta; /* priority and task attribute */ | 52 | __u8 fc_pri_ta; /* priority and task attribute */ |
51 | __u8 fc_tm_flags; /* task management flags */ | 53 | __u8 fc_tm_flags; /* task management flags */ |
@@ -57,7 +59,7 @@ struct fcp_cmnd { | |||
57 | #define FCP_CMND_LEN 32 /* expected length of structure */ | 59 | #define FCP_CMND_LEN 32 /* expected length of structure */ |
58 | 60 | ||
59 | struct fcp_cmnd32 { | 61 | struct fcp_cmnd32 { |
60 | __u8 fc_lun[8]; /* logical unit number */ | 62 | struct scsi_lun fc_lun; /* logical unit number */ |
61 | __u8 fc_cmdref; /* command reference number */ | 63 | __u8 fc_cmdref; /* command reference number */ |
62 | __u8 fc_pri_ta; /* priority and task attribute */ | 64 | __u8 fc_pri_ta; /* priority and task attribute */ |
63 | __u8 fc_tm_flags; /* task management flags */ | 65 | __u8 fc_tm_flags; /* task management flags */ |
diff --git a/include/scsi/fc/fc_ms.h b/include/scsi/fc/fc_ms.h new file mode 100644 index 000000000000..f52b921b5c70 --- /dev/null +++ b/include/scsi/fc/fc_ms.h | |||
@@ -0,0 +1,213 @@ | |||
1 | /* * Copyright(c) 2011 Intel Corporation. All rights reserved. | ||
2 | * | ||
3 | * This program is free software; you can redistribute it and/or modify it | ||
4 | * under the terms and conditions of the GNU General Public License, | ||
5 | * version 2, as published by the Free Software Foundation. | ||
6 | * | ||
7 | * This program is distributed in the hope it will be useful, but WITHOUT | ||
8 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
9 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
10 | * more details. | ||
11 | * | ||
12 | * You should have received a copy of the GNU General Public License along with | ||
13 | * this program; if not, write to the Free Software Foundation, Inc., | ||
14 | * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. | ||
15 | * | ||
16 | * Maintained at www.Open-FCoE.org | ||
17 | */ | ||
18 | |||
19 | #ifndef _FC_MS_H_ | ||
20 | #define _FC_MS_H_ | ||
21 | |||
22 | #include <linux/types.h> | ||
23 | |||
24 | /* | ||
25 | * Fibre Channel Services - Management Service (MS) | ||
26 | * From T11.org FC-GS-4 Rev 7.91 February 4, 2004 | ||
27 | */ | ||
28 | |||
29 | /* | ||
30 | * Fabric Device Management Interface | ||
31 | */ | ||
32 | |||
33 | /* | ||
34 | * Common-transport sub-type for FDMI | ||
35 | */ | ||
36 | #define FC_FDMI_SUBTYPE 0x10 /* fs_ct_hdr.ct_fs_subtype */ | ||
37 | |||
38 | /* | ||
39 | * Management server FDMI Requests. | ||
40 | */ | ||
41 | enum fc_fdmi_req { | ||
42 | FC_FDMI_GRHL = 0x0100, /* Get Registered HBA List */ | ||
43 | FC_FDMI_GHAT = 0x0101, /* Get HBA Attributes */ | ||
44 | FC_FDMI_GRPL = 0x0102, /* Get Registered Port List */ | ||
45 | FC_FDMI_GPAT = 0x0110, /* Get Port Attributes */ | ||
46 | FC_FDMI_RHBA = 0x0200, /* Register HBA */ | ||
47 | FC_FDMI_RHAT = 0x0201, /* Register HBA Attributes */ | ||
48 | FC_FDMI_RPRT = 0x0210, /* Register Port */ | ||
49 | FC_FDMI_RPA = 0x0211, /* Register Port Attributes */ | ||
50 | FC_FDMI_DHBA = 0x0300, /* Deregister HBA */ | ||
51 | FC_FDMI_DHAT = 0x0301, /* Deregister HBA Attributes */ | ||
52 | FC_FDMI_DPRT = 0x0310, /* Deregister Port */ | ||
53 | FC_FDMI_DPA = 0x0311, /* Deregister Port Attributes */ | ||
54 | }; | ||
55 | |||
56 | /* | ||
57 | * HBA Attribute Entry Type | ||
58 | */ | ||
59 | enum fc_fdmi_hba_attr_type { | ||
60 | FC_FDMI_HBA_ATTR_NODENAME = 0x0001, | ||
61 | FC_FDMI_HBA_ATTR_MANUFACTURER = 0x0002, | ||
62 | FC_FDMI_HBA_ATTR_SERIALNUMBER = 0x0003, | ||
63 | FC_FDMI_HBA_ATTR_MODEL = 0x0004, | ||
64 | FC_FDMI_HBA_ATTR_MODELDESCRIPTION = 0x0005, | ||
65 | FC_FDMI_HBA_ATTR_HARDWAREVERSION = 0x0006, | ||
66 | FC_FDMI_HBA_ATTR_DRIVERVERSION = 0x0007, | ||
67 | FC_FDMI_HBA_ATTR_OPTIONROMVERSION = 0x0008, | ||
68 | FC_FDMI_HBA_ATTR_FIRMWAREVERSION = 0x0009, | ||
69 | FC_FDMI_HBA_ATTR_OSNAMEVERSION = 0x000A, | ||
70 | FC_FDMI_HBA_ATTR_MAXCTPAYLOAD = 0x000B, | ||
71 | }; | ||
72 | |||
73 | /* | ||
74 | * HBA Attribute Length | ||
75 | */ | ||
76 | #define FC_FDMI_HBA_ATTR_NODENAME_LEN 8 | ||
77 | #define FC_FDMI_HBA_ATTR_MANUFACTURER_LEN 64 | ||
78 | #define FC_FDMI_HBA_ATTR_SERIALNUMBER_LEN 64 | ||
79 | #define FC_FDMI_HBA_ATTR_MODEL_LEN 256 | ||
80 | #define FC_FDMI_HBA_ATTR_MODELDESCR_LEN 256 | ||
81 | #define FC_FDMI_HBA_ATTR_HARDWAREVERSION_LEN 256 | ||
82 | #define FC_FDMI_HBA_ATTR_DRIVERVERSION_LEN 256 | ||
83 | #define FC_FDMI_HBA_ATTR_OPTIONROMVERSION_LEN 256 | ||
84 | #define FC_FDMI_HBA_ATTR_FIRMWAREVERSION_LEN 256 | ||
85 | #define FC_FDMI_HBA_ATTR_OSNAMEVERSION_LEN 256 | ||
86 | #define FC_FDMI_HBA_ATTR_MAXCTPAYLOAD_LEN 4 | ||
87 | |||
88 | /* | ||
89 | * Port Attribute Type | ||
90 | */ | ||
91 | enum fc_fdmi_port_attr_type { | ||
92 | FC_FDMI_PORT_ATTR_FC4TYPES = 0x0001, | ||
93 | FC_FDMI_PORT_ATTR_SUPPORTEDSPEED = 0x0002, | ||
94 | FC_FDMI_PORT_ATTR_CURRENTPORTSPEED = 0x0003, | ||
95 | FC_FDMI_PORT_ATTR_MAXFRAMESIZE = 0x0004, | ||
96 | FC_FDMI_PORT_ATTR_OSDEVICENAME = 0x0005, | ||
97 | FC_FDMI_PORT_ATTR_HOSTNAME = 0x0006, | ||
98 | }; | ||
99 | |||
100 | /* | ||
101 | * Port Attribute Length | ||
102 | */ | ||
103 | #define FC_FDMI_PORT_ATTR_FC4TYPES_LEN 32 | ||
104 | #define FC_FDMI_PORT_ATTR_SUPPORTEDSPEED_LEN 4 | ||
105 | #define FC_FDMI_PORT_ATTR_CURRENTPORTSPEED_LEN 4 | ||
106 | #define FC_FDMI_PORT_ATTR_MAXFRAMESIZE_LEN 4 | ||
107 | #define FC_FDMI_PORT_ATTR_OSDEVICENAME_LEN 256 | ||
108 | #define FC_FDMI_PORT_ATTR_HOSTNAME_LEN 256 | ||
109 | |||
110 | /* | ||
111 | * HBA Attribute ID | ||
112 | */ | ||
113 | struct fc_fdmi_hba_identifier { | ||
114 | __be64 id; | ||
115 | }; | ||
116 | |||
117 | /* | ||
118 | * Port Name | ||
119 | */ | ||
120 | struct fc_fdmi_port_name { | ||
121 | __be64 portname; | ||
122 | }; | ||
123 | |||
124 | /* | ||
125 | * Attribute Entry Block for HBA/Port Attributes | ||
126 | */ | ||
127 | #define FC_FDMI_ATTR_ENTRY_HEADER_LEN 4 | ||
128 | struct fc_fdmi_attr_entry { | ||
129 | __be16 type; | ||
130 | __be16 len; | ||
131 | __u8 value[1]; | ||
132 | } __attribute__((__packed__)); | ||
133 | |||
134 | /* | ||
135 | * Common for HBA/Port Attributes | ||
136 | */ | ||
137 | struct fs_fdmi_attrs { | ||
138 | __be32 numattrs; | ||
139 | struct fc_fdmi_attr_entry attr[1]; | ||
140 | } __attribute__((__packed__)); | ||
141 | |||
142 | /* | ||
143 | * Registered Port List | ||
144 | */ | ||
145 | struct fc_fdmi_rpl { | ||
146 | __be32 numport; | ||
147 | struct fc_fdmi_port_name port[1]; | ||
148 | } __attribute__((__packed__)); | ||
149 | |||
150 | /* | ||
151 | * Register HBA (RHBA) | ||
152 | */ | ||
153 | struct fc_fdmi_rhba { | ||
154 | struct fc_fdmi_hba_identifier hbaid; | ||
155 | struct fc_fdmi_rpl port; | ||
156 | struct fs_fdmi_attrs hba_attrs; | ||
157 | } __attribute__((__packed__)); | ||
158 | |||
159 | /* | ||
160 | * Register HBA Attributes (RHAT) | ||
161 | */ | ||
162 | struct fc_fdmi_rhat { | ||
163 | struct fc_fdmi_hba_identifier hbaid; | ||
164 | struct fs_fdmi_attrs hba_attrs; | ||
165 | } __attribute__((__packed__)); | ||
166 | |||
167 | /* | ||
168 | * Register Port (RPRT) | ||
169 | */ | ||
170 | struct fc_fdmi_rprt { | ||
171 | struct fc_fdmi_hba_identifier hbaid; | ||
172 | struct fc_fdmi_port_name port; | ||
173 | struct fs_fdmi_attrs hba_attrs; | ||
174 | } __attribute__((__packed__)); | ||
175 | |||
176 | /* | ||
177 | * Register Port Attributes (RPA) | ||
178 | */ | ||
179 | struct fc_fdmi_rpa { | ||
180 | struct fc_fdmi_port_name port; | ||
181 | struct fs_fdmi_attrs hba_attrs; | ||
182 | } __attribute__((__packed__)); | ||
183 | |||
184 | /* | ||
185 | * Deregister Port (DPRT) | ||
186 | */ | ||
187 | struct fc_fdmi_dprt { | ||
188 | struct fc_fdmi_port_name port; | ||
189 | } __attribute__((__packed__)); | ||
190 | |||
191 | /* | ||
192 | * Deregister Port Attributes (DPA) | ||
193 | */ | ||
194 | struct fc_fdmi_dpa { | ||
195 | struct fc_fdmi_port_name port; | ||
196 | struct fs_fdmi_attrs hba_attrs; | ||
197 | } __attribute__((__packed__)); | ||
198 | |||
199 | /* | ||
200 | * Deregister HBA Attributes (DHAT) | ||
201 | */ | ||
202 | struct fc_fdmi_dhat { | ||
203 | struct fc_fdmi_hba_identifier hbaid; | ||
204 | } __attribute__((__packed__)); | ||
205 | |||
206 | /* | ||
207 | * Deregister HBA (DHBA) | ||
208 | */ | ||
209 | struct fc_fdmi_dhba { | ||
210 | struct fc_fdmi_hba_identifier hbaid; | ||
211 | } __attribute__((__packed__)); | ||
212 | |||
213 | #endif /* _FC_MS_H_ */ | ||
diff --git a/include/scsi/fc_encode.h b/include/scsi/fc_encode.h index be418d8448a5..35fd4744f3e9 100644 --- a/include/scsi/fc_encode.h +++ b/include/scsi/fc_encode.h | |||
@@ -20,6 +20,7 @@ | |||
20 | #ifndef _FC_ENCODE_H_ | 20 | #ifndef _FC_ENCODE_H_ |
21 | #define _FC_ENCODE_H_ | 21 | #define _FC_ENCODE_H_ |
22 | #include <asm/unaligned.h> | 22 | #include <asm/unaligned.h> |
23 | #include <linux/utsname.h> | ||
23 | 24 | ||
24 | /* | 25 | /* |
25 | * F_CTL values for simple requests and responses. | 26 | * F_CTL values for simple requests and responses. |
@@ -43,6 +44,10 @@ struct fc_ct_req { | |||
43 | struct fc_ns_fid fid; | 44 | struct fc_ns_fid fid; |
44 | struct fc_ns_rsnn snn; | 45 | struct fc_ns_rsnn snn; |
45 | struct fc_ns_rspn spn; | 46 | struct fc_ns_rspn spn; |
47 | struct fc_fdmi_rhba rhba; | ||
48 | struct fc_fdmi_rpa rpa; | ||
49 | struct fc_fdmi_dprt dprt; | ||
50 | struct fc_fdmi_dhba dhba; | ||
46 | } payload; | 51 | } payload; |
47 | }; | 52 | }; |
48 | 53 | ||
@@ -97,7 +102,9 @@ static inline void fc_adisc_fill(struct fc_lport *lport, struct fc_frame *fp) | |||
97 | * returns pointer to ct request. | 102 | * returns pointer to ct request. |
98 | */ | 103 | */ |
99 | static inline struct fc_ct_req *fc_ct_hdr_fill(const struct fc_frame *fp, | 104 | static inline struct fc_ct_req *fc_ct_hdr_fill(const struct fc_frame *fp, |
100 | unsigned int op, size_t req_size) | 105 | unsigned int op, size_t req_size, |
106 | enum fc_ct_fs_type fs_type, | ||
107 | u8 subtype) | ||
101 | { | 108 | { |
102 | struct fc_ct_req *ct; | 109 | struct fc_ct_req *ct; |
103 | size_t ct_plen; | 110 | size_t ct_plen; |
@@ -106,14 +113,14 @@ static inline struct fc_ct_req *fc_ct_hdr_fill(const struct fc_frame *fp, | |||
106 | ct = fc_frame_payload_get(fp, ct_plen); | 113 | ct = fc_frame_payload_get(fp, ct_plen); |
107 | memset(ct, 0, ct_plen); | 114 | memset(ct, 0, ct_plen); |
108 | ct->hdr.ct_rev = FC_CT_REV; | 115 | ct->hdr.ct_rev = FC_CT_REV; |
109 | ct->hdr.ct_fs_type = FC_FST_DIR; | 116 | ct->hdr.ct_fs_type = fs_type; |
110 | ct->hdr.ct_fs_subtype = FC_NS_SUBTYPE; | 117 | ct->hdr.ct_fs_subtype = subtype; |
111 | ct->hdr.ct_cmd = htons((u16) op); | 118 | ct->hdr.ct_cmd = htons((u16) op); |
112 | return ct; | 119 | return ct; |
113 | } | 120 | } |
114 | 121 | ||
115 | /** | 122 | /** |
116 | * fc_ct_fill() - Fill in a name service request frame | 123 | * fc_ct_ns_fill() - Fill in a name service request frame |
117 | * @lport: local port. | 124 | * @lport: local port. |
118 | * @fc_id: FC_ID of non-destination rport for GPN_ID and similar inquiries. | 125 | * @fc_id: FC_ID of non-destination rport for GPN_ID and similar inquiries. |
119 | * @fp: frame to contain payload. | 126 | * @fp: frame to contain payload. |
@@ -121,7 +128,7 @@ static inline struct fc_ct_req *fc_ct_hdr_fill(const struct fc_frame *fp, | |||
121 | * @r_ctl: pointer to FC header R_CTL. | 128 | * @r_ctl: pointer to FC header R_CTL. |
122 | * @fh_type: pointer to FC-4 type. | 129 | * @fh_type: pointer to FC-4 type. |
123 | */ | 130 | */ |
124 | static inline int fc_ct_fill(struct fc_lport *lport, | 131 | static inline int fc_ct_ns_fill(struct fc_lport *lport, |
125 | u32 fc_id, struct fc_frame *fp, | 132 | u32 fc_id, struct fc_frame *fp, |
126 | unsigned int op, enum fc_rctl *r_ctl, | 133 | unsigned int op, enum fc_rctl *r_ctl, |
127 | enum fc_fh_type *fh_type) | 134 | enum fc_fh_type *fh_type) |
@@ -131,23 +138,28 @@ static inline int fc_ct_fill(struct fc_lport *lport, | |||
131 | 138 | ||
132 | switch (op) { | 139 | switch (op) { |
133 | case FC_NS_GPN_FT: | 140 | case FC_NS_GPN_FT: |
134 | ct = fc_ct_hdr_fill(fp, op, sizeof(struct fc_ns_gid_ft)); | 141 | ct = fc_ct_hdr_fill(fp, op, sizeof(struct fc_ns_gid_ft), |
142 | FC_FST_DIR, FC_NS_SUBTYPE); | ||
135 | ct->payload.gid.fn_fc4_type = FC_TYPE_FCP; | 143 | ct->payload.gid.fn_fc4_type = FC_TYPE_FCP; |
136 | break; | 144 | break; |
137 | 145 | ||
138 | case FC_NS_GPN_ID: | 146 | case FC_NS_GPN_ID: |
139 | ct = fc_ct_hdr_fill(fp, op, sizeof(struct fc_ns_fid)); | 147 | ct = fc_ct_hdr_fill(fp, op, sizeof(struct fc_ns_fid), |
148 | FC_FST_DIR, FC_NS_SUBTYPE); | ||
149 | ct->payload.gid.fn_fc4_type = FC_TYPE_FCP; | ||
140 | hton24(ct->payload.fid.fp_fid, fc_id); | 150 | hton24(ct->payload.fid.fp_fid, fc_id); |
141 | break; | 151 | break; |
142 | 152 | ||
143 | case FC_NS_RFT_ID: | 153 | case FC_NS_RFT_ID: |
144 | ct = fc_ct_hdr_fill(fp, op, sizeof(struct fc_ns_rft)); | 154 | ct = fc_ct_hdr_fill(fp, op, sizeof(struct fc_ns_rft), |
155 | FC_FST_DIR, FC_NS_SUBTYPE); | ||
145 | hton24(ct->payload.rft.fid.fp_fid, lport->port_id); | 156 | hton24(ct->payload.rft.fid.fp_fid, lport->port_id); |
146 | ct->payload.rft.fts = lport->fcts; | 157 | ct->payload.rft.fts = lport->fcts; |
147 | break; | 158 | break; |
148 | 159 | ||
149 | case FC_NS_RFF_ID: | 160 | case FC_NS_RFF_ID: |
150 | ct = fc_ct_hdr_fill(fp, op, sizeof(struct fc_ns_rff_id)); | 161 | ct = fc_ct_hdr_fill(fp, op, sizeof(struct fc_ns_rff_id), |
162 | FC_FST_DIR, FC_NS_SUBTYPE); | ||
151 | hton24(ct->payload.rff.fr_fid.fp_fid, lport->port_id); | 163 | hton24(ct->payload.rff.fr_fid.fp_fid, lport->port_id); |
152 | ct->payload.rff.fr_type = FC_TYPE_FCP; | 164 | ct->payload.rff.fr_type = FC_TYPE_FCP; |
153 | if (lport->service_params & FCP_SPPF_INIT_FCN) | 165 | if (lport->service_params & FCP_SPPF_INIT_FCN) |
@@ -157,14 +169,16 @@ static inline int fc_ct_fill(struct fc_lport *lport, | |||
157 | break; | 169 | break; |
158 | 170 | ||
159 | case FC_NS_RNN_ID: | 171 | case FC_NS_RNN_ID: |
160 | ct = fc_ct_hdr_fill(fp, op, sizeof(struct fc_ns_rn_id)); | 172 | ct = fc_ct_hdr_fill(fp, op, sizeof(struct fc_ns_rn_id), |
173 | FC_FST_DIR, FC_NS_SUBTYPE); | ||
161 | hton24(ct->payload.rn.fr_fid.fp_fid, lport->port_id); | 174 | hton24(ct->payload.rn.fr_fid.fp_fid, lport->port_id); |
162 | put_unaligned_be64(lport->wwnn, &ct->payload.rn.fr_wwn); | 175 | put_unaligned_be64(lport->wwnn, &ct->payload.rn.fr_wwn); |
163 | break; | 176 | break; |
164 | 177 | ||
165 | case FC_NS_RSPN_ID: | 178 | case FC_NS_RSPN_ID: |
166 | len = strnlen(fc_host_symbolic_name(lport->host), 255); | 179 | len = strnlen(fc_host_symbolic_name(lport->host), 255); |
167 | ct = fc_ct_hdr_fill(fp, op, sizeof(struct fc_ns_rspn) + len); | 180 | ct = fc_ct_hdr_fill(fp, op, sizeof(struct fc_ns_rspn) + len, |
181 | FC_FST_DIR, FC_NS_SUBTYPE); | ||
168 | hton24(ct->payload.spn.fr_fid.fp_fid, lport->port_id); | 182 | hton24(ct->payload.spn.fr_fid.fp_fid, lport->port_id); |
169 | strncpy(ct->payload.spn.fr_name, | 183 | strncpy(ct->payload.spn.fr_name, |
170 | fc_host_symbolic_name(lport->host), len); | 184 | fc_host_symbolic_name(lport->host), len); |
@@ -173,7 +187,8 @@ static inline int fc_ct_fill(struct fc_lport *lport, | |||
173 | 187 | ||
174 | case FC_NS_RSNN_NN: | 188 | case FC_NS_RSNN_NN: |
175 | len = strnlen(fc_host_symbolic_name(lport->host), 255); | 189 | len = strnlen(fc_host_symbolic_name(lport->host), 255); |
176 | ct = fc_ct_hdr_fill(fp, op, sizeof(struct fc_ns_rsnn) + len); | 190 | ct = fc_ct_hdr_fill(fp, op, sizeof(struct fc_ns_rsnn) + len, |
191 | FC_FST_DIR, FC_NS_SUBTYPE); | ||
177 | put_unaligned_be64(lport->wwnn, &ct->payload.snn.fr_wwn); | 192 | put_unaligned_be64(lport->wwnn, &ct->payload.snn.fr_wwn); |
178 | strncpy(ct->payload.snn.fr_name, | 193 | strncpy(ct->payload.snn.fr_name, |
179 | fc_host_symbolic_name(lport->host), len); | 194 | fc_host_symbolic_name(lport->host), len); |
@@ -189,6 +204,330 @@ static inline int fc_ct_fill(struct fc_lport *lport, | |||
189 | } | 204 | } |
190 | 205 | ||
191 | /** | 206 | /** |
207 | * fc_ct_ms_fill() - Fill in a mgmt service request frame | ||
208 | * @lport: local port. | ||
209 | * @fc_id: FC_ID of non-destination rport for GPN_ID and similar inquiries. | ||
210 | * @fp: frame to contain payload. | ||
211 | * @op: CT opcode. | ||
212 | * @r_ctl: pointer to FC header R_CTL. | ||
213 | * @fh_type: pointer to FC-4 type. | ||
214 | */ | ||
215 | static inline int fc_ct_ms_fill(struct fc_lport *lport, | ||
216 | u32 fc_id, struct fc_frame *fp, | ||
217 | unsigned int op, enum fc_rctl *r_ctl, | ||
218 | enum fc_fh_type *fh_type) | ||
219 | { | ||
220 | struct fc_ct_req *ct; | ||
221 | size_t len; | ||
222 | struct fc_fdmi_attr_entry *entry; | ||
223 | struct fs_fdmi_attrs *hba_attrs; | ||
224 | int numattrs = 0; | ||
225 | |||
226 | switch (op) { | ||
227 | case FC_FDMI_RHBA: | ||
228 | numattrs = 10; | ||
229 | len = sizeof(struct fc_fdmi_rhba); | ||
230 | len -= sizeof(struct fc_fdmi_attr_entry); | ||
231 | len += (numattrs * FC_FDMI_ATTR_ENTRY_HEADER_LEN); | ||
232 | len += FC_FDMI_HBA_ATTR_NODENAME_LEN; | ||
233 | len += FC_FDMI_HBA_ATTR_MANUFACTURER_LEN; | ||
234 | len += FC_FDMI_HBA_ATTR_SERIALNUMBER_LEN; | ||
235 | len += FC_FDMI_HBA_ATTR_MODEL_LEN; | ||
236 | len += FC_FDMI_HBA_ATTR_MODELDESCR_LEN; | ||
237 | len += FC_FDMI_HBA_ATTR_HARDWAREVERSION_LEN; | ||
238 | len += FC_FDMI_HBA_ATTR_DRIVERVERSION_LEN; | ||
239 | len += FC_FDMI_HBA_ATTR_OPTIONROMVERSION_LEN; | ||
240 | len += FC_FDMI_HBA_ATTR_FIRMWAREVERSION_LEN; | ||
241 | len += FC_FDMI_HBA_ATTR_OSNAMEVERSION_LEN; | ||
242 | ct = fc_ct_hdr_fill(fp, op, len, FC_FST_MGMT, | ||
243 | FC_FDMI_SUBTYPE); | ||
244 | |||
245 | /* HBA Identifier */ | ||
246 | put_unaligned_be64(lport->wwpn, &ct->payload.rhba.hbaid.id); | ||
247 | /* Number of Ports - always 1 */ | ||
248 | put_unaligned_be32(1, &ct->payload.rhba.port.numport); | ||
249 | /* Port Name */ | ||
250 | put_unaligned_be64(lport->wwpn, | ||
251 | &ct->payload.rhba.port.port[0].portname); | ||
252 | |||
253 | /* HBA Attributes */ | ||
254 | put_unaligned_be32(numattrs, | ||
255 | &ct->payload.rhba.hba_attrs.numattrs); | ||
256 | hba_attrs = &ct->payload.rhba.hba_attrs; | ||
257 | entry = (struct fc_fdmi_attr_entry *)hba_attrs->attr; | ||
258 | /* NodeName*/ | ||
259 | len = FC_FDMI_ATTR_ENTRY_HEADER_LEN; | ||
260 | len += FC_FDMI_HBA_ATTR_NODENAME_LEN; | ||
261 | put_unaligned_be16(FC_FDMI_HBA_ATTR_NODENAME, | ||
262 | &entry->type); | ||
263 | put_unaligned_be16(len, &entry->len); | ||
264 | put_unaligned_be64(lport->wwnn, | ||
265 | (__be64 *)&entry->value[0]); | ||
266 | |||
267 | /* Manufacturer */ | ||
268 | entry = (struct fc_fdmi_attr_entry *)((char *)entry->value + | ||
269 | FC_FDMI_HBA_ATTR_NODENAME_LEN); | ||
270 | len = FC_FDMI_ATTR_ENTRY_HEADER_LEN; | ||
271 | len += FC_FDMI_HBA_ATTR_MANUFACTURER_LEN; | ||
272 | put_unaligned_be16(FC_FDMI_HBA_ATTR_MANUFACTURER, | ||
273 | &entry->type); | ||
274 | put_unaligned_be16(len, &entry->len); | ||
275 | strncpy((char *)&entry->value, | ||
276 | fc_host_manufacturer(lport->host), | ||
277 | FC_FDMI_HBA_ATTR_MANUFACTURER_LEN); | ||
278 | |||
279 | /* SerialNumber */ | ||
280 | entry = (struct fc_fdmi_attr_entry *)((char *)entry->value + | ||
281 | FC_FDMI_HBA_ATTR_MANUFACTURER_LEN); | ||
282 | len = FC_FDMI_ATTR_ENTRY_HEADER_LEN; | ||
283 | len += FC_FDMI_HBA_ATTR_SERIALNUMBER_LEN; | ||
284 | put_unaligned_be16(FC_FDMI_HBA_ATTR_SERIALNUMBER, | ||
285 | &entry->type); | ||
286 | put_unaligned_be16(len, &entry->len); | ||
287 | strncpy((char *)&entry->value, | ||
288 | fc_host_serial_number(lport->host), | ||
289 | FC_FDMI_HBA_ATTR_SERIALNUMBER_LEN); | ||
290 | |||
291 | /* Model */ | ||
292 | entry = (struct fc_fdmi_attr_entry *)((char *)entry->value + | ||
293 | FC_FDMI_HBA_ATTR_SERIALNUMBER_LEN); | ||
294 | len = FC_FDMI_ATTR_ENTRY_HEADER_LEN; | ||
295 | len += FC_FDMI_HBA_ATTR_MODEL_LEN; | ||
296 | put_unaligned_be16(FC_FDMI_HBA_ATTR_MODEL, | ||
297 | &entry->type); | ||
298 | put_unaligned_be16(len, &entry->len); | ||
299 | strncpy((char *)&entry->value, | ||
300 | fc_host_model(lport->host), | ||
301 | FC_FDMI_HBA_ATTR_MODEL_LEN); | ||
302 | |||
303 | /* Model Description */ | ||
304 | entry = (struct fc_fdmi_attr_entry *)((char *)entry->value + | ||
305 | FC_FDMI_HBA_ATTR_MODEL_LEN); | ||
306 | len = FC_FDMI_ATTR_ENTRY_HEADER_LEN; | ||
307 | len += FC_FDMI_HBA_ATTR_MODELDESCR_LEN; | ||
308 | put_unaligned_be16(FC_FDMI_HBA_ATTR_MODELDESCRIPTION, | ||
309 | &entry->type); | ||
310 | put_unaligned_be16(len, &entry->len); | ||
311 | strncpy((char *)&entry->value, | ||
312 | fc_host_model_description(lport->host), | ||
313 | FC_FDMI_HBA_ATTR_MODELDESCR_LEN); | ||
314 | |||
315 | /* Hardware Version */ | ||
316 | entry = (struct fc_fdmi_attr_entry *)((char *)entry->value + | ||
317 | FC_FDMI_HBA_ATTR_MODELDESCR_LEN); | ||
318 | len = FC_FDMI_ATTR_ENTRY_HEADER_LEN; | ||
319 | len += FC_FDMI_HBA_ATTR_HARDWAREVERSION_LEN; | ||
320 | put_unaligned_be16(FC_FDMI_HBA_ATTR_HARDWAREVERSION, | ||
321 | &entry->type); | ||
322 | put_unaligned_be16(len, &entry->len); | ||
323 | strncpy((char *)&entry->value, | ||
324 | fc_host_hardware_version(lport->host), | ||
325 | FC_FDMI_HBA_ATTR_HARDWAREVERSION_LEN); | ||
326 | |||
327 | /* Driver Version */ | ||
328 | entry = (struct fc_fdmi_attr_entry *)((char *)entry->value + | ||
329 | FC_FDMI_HBA_ATTR_HARDWAREVERSION_LEN); | ||
330 | len = FC_FDMI_ATTR_ENTRY_HEADER_LEN; | ||
331 | len += FC_FDMI_HBA_ATTR_DRIVERVERSION_LEN; | ||
332 | put_unaligned_be16(FC_FDMI_HBA_ATTR_DRIVERVERSION, | ||
333 | &entry->type); | ||
334 | put_unaligned_be16(len, &entry->len); | ||
335 | strncpy((char *)&entry->value, | ||
336 | fc_host_driver_version(lport->host), | ||
337 | FC_FDMI_HBA_ATTR_DRIVERVERSION_LEN); | ||
338 | |||
339 | /* OptionROM Version */ | ||
340 | entry = (struct fc_fdmi_attr_entry *)((char *)entry->value + | ||
341 | FC_FDMI_HBA_ATTR_DRIVERVERSION_LEN); | ||
342 | len = FC_FDMI_ATTR_ENTRY_HEADER_LEN; | ||
343 | len += FC_FDMI_HBA_ATTR_OPTIONROMVERSION_LEN; | ||
344 | put_unaligned_be16(FC_FDMI_HBA_ATTR_OPTIONROMVERSION, | ||
345 | &entry->type); | ||
346 | put_unaligned_be16(len, &entry->len); | ||
347 | strncpy((char *)&entry->value, | ||
348 | fc_host_optionrom_version(lport->host), | ||
349 | FC_FDMI_HBA_ATTR_OPTIONROMVERSION_LEN); | ||
350 | |||
351 | /* Firmware Version */ | ||
352 | entry = (struct fc_fdmi_attr_entry *)((char *)entry->value + | ||
353 | FC_FDMI_HBA_ATTR_OPTIONROMVERSION_LEN); | ||
354 | len = FC_FDMI_ATTR_ENTRY_HEADER_LEN; | ||
355 | len += FC_FDMI_HBA_ATTR_FIRMWAREVERSION_LEN; | ||
356 | put_unaligned_be16(FC_FDMI_HBA_ATTR_FIRMWAREVERSION, | ||
357 | &entry->type); | ||
358 | put_unaligned_be16(len, &entry->len); | ||
359 | strncpy((char *)&entry->value, | ||
360 | fc_host_firmware_version(lport->host), | ||
361 | FC_FDMI_HBA_ATTR_FIRMWAREVERSION_LEN); | ||
362 | |||
363 | /* OS Name and Version */ | ||
364 | entry = (struct fc_fdmi_attr_entry *)((char *)entry->value + | ||
365 | FC_FDMI_HBA_ATTR_FIRMWAREVERSION_LEN); | ||
366 | len = FC_FDMI_ATTR_ENTRY_HEADER_LEN; | ||
367 | len += FC_FDMI_HBA_ATTR_OSNAMEVERSION_LEN; | ||
368 | put_unaligned_be16(FC_FDMI_HBA_ATTR_OSNAMEVERSION, | ||
369 | &entry->type); | ||
370 | put_unaligned_be16(len, &entry->len); | ||
371 | snprintf((char *)&entry->value, | ||
372 | FC_FDMI_HBA_ATTR_OSNAMEVERSION_LEN, | ||
373 | "%s v%s", | ||
374 | init_utsname()->sysname, | ||
375 | init_utsname()->release); | ||
376 | break; | ||
377 | case FC_FDMI_RPA: | ||
378 | numattrs = 6; | ||
379 | len = sizeof(struct fc_fdmi_rpa); | ||
380 | len -= sizeof(struct fc_fdmi_attr_entry); | ||
381 | len += (numattrs * FC_FDMI_ATTR_ENTRY_HEADER_LEN); | ||
382 | len += FC_FDMI_PORT_ATTR_FC4TYPES_LEN; | ||
383 | len += FC_FDMI_PORT_ATTR_SUPPORTEDSPEED_LEN; | ||
384 | len += FC_FDMI_PORT_ATTR_CURRENTPORTSPEED_LEN; | ||
385 | len += FC_FDMI_PORT_ATTR_MAXFRAMESIZE_LEN; | ||
386 | len += FC_FDMI_PORT_ATTR_OSDEVICENAME_LEN; | ||
387 | len += FC_FDMI_PORT_ATTR_HOSTNAME_LEN; | ||
388 | ct = fc_ct_hdr_fill(fp, op, len, FC_FST_MGMT, | ||
389 | FC_FDMI_SUBTYPE); | ||
390 | |||
391 | /* Port Name */ | ||
392 | put_unaligned_be64(lport->wwpn, | ||
393 | &ct->payload.rpa.port.portname); | ||
394 | |||
395 | /* Port Attributes */ | ||
396 | put_unaligned_be32(numattrs, | ||
397 | &ct->payload.rpa.hba_attrs.numattrs); | ||
398 | |||
399 | hba_attrs = &ct->payload.rpa.hba_attrs; | ||
400 | entry = (struct fc_fdmi_attr_entry *)hba_attrs->attr; | ||
401 | |||
402 | /* FC4 types */ | ||
403 | len = FC_FDMI_ATTR_ENTRY_HEADER_LEN; | ||
404 | len += FC_FDMI_PORT_ATTR_FC4TYPES_LEN; | ||
405 | put_unaligned_be16(FC_FDMI_PORT_ATTR_FC4TYPES, | ||
406 | &entry->type); | ||
407 | put_unaligned_be16(len, &entry->len); | ||
408 | memcpy(&entry->value, fc_host_supported_fc4s(lport->host), | ||
409 | FC_FDMI_PORT_ATTR_FC4TYPES_LEN); | ||
410 | |||
411 | /* Supported Speed */ | ||
412 | entry = (struct fc_fdmi_attr_entry *)((char *)entry->value + | ||
413 | FC_FDMI_PORT_ATTR_FC4TYPES_LEN); | ||
414 | len = FC_FDMI_ATTR_ENTRY_HEADER_LEN; | ||
415 | len += FC_FDMI_PORT_ATTR_SUPPORTEDSPEED_LEN; | ||
416 | put_unaligned_be16(FC_FDMI_PORT_ATTR_SUPPORTEDSPEED, | ||
417 | &entry->type); | ||
418 | put_unaligned_be16(len, &entry->len); | ||
419 | |||
420 | put_unaligned_be32(fc_host_supported_speeds(lport->host), | ||
421 | &entry->value); | ||
422 | |||
423 | /* Current Port Speed */ | ||
424 | entry = (struct fc_fdmi_attr_entry *)((char *)entry->value + | ||
425 | FC_FDMI_PORT_ATTR_SUPPORTEDSPEED_LEN); | ||
426 | len = FC_FDMI_ATTR_ENTRY_HEADER_LEN; | ||
427 | len += FC_FDMI_PORT_ATTR_CURRENTPORTSPEED_LEN; | ||
428 | put_unaligned_be16(FC_FDMI_PORT_ATTR_CURRENTPORTSPEED, | ||
429 | &entry->type); | ||
430 | put_unaligned_be16(len, &entry->len); | ||
431 | put_unaligned_be32(lport->link_speed, | ||
432 | &entry->value); | ||
433 | |||
434 | /* Max Frame Size */ | ||
435 | entry = (struct fc_fdmi_attr_entry *)((char *)entry->value + | ||
436 | FC_FDMI_PORT_ATTR_CURRENTPORTSPEED_LEN); | ||
437 | len = FC_FDMI_ATTR_ENTRY_HEADER_LEN; | ||
438 | len += FC_FDMI_PORT_ATTR_MAXFRAMESIZE_LEN; | ||
439 | put_unaligned_be16(FC_FDMI_PORT_ATTR_MAXFRAMESIZE, | ||
440 | &entry->type); | ||
441 | put_unaligned_be16(len, &entry->len); | ||
442 | put_unaligned_be32(fc_host_maxframe_size(lport->host), | ||
443 | &entry->value); | ||
444 | |||
445 | /* OS Device Name */ | ||
446 | entry = (struct fc_fdmi_attr_entry *)((char *)entry->value + | ||
447 | FC_FDMI_PORT_ATTR_MAXFRAMESIZE_LEN); | ||
448 | len = FC_FDMI_ATTR_ENTRY_HEADER_LEN; | ||
449 | len += FC_FDMI_PORT_ATTR_OSDEVICENAME_LEN; | ||
450 | put_unaligned_be16(FC_FDMI_PORT_ATTR_OSDEVICENAME, | ||
451 | &entry->type); | ||
452 | put_unaligned_be16(len, &entry->len); | ||
453 | /* Use the sysfs device name */ | ||
454 | strncpy((char *)&entry->value, | ||
455 | dev_name(&lport->host->shost_gendev), | ||
456 | strnlen(dev_name(&lport->host->shost_gendev), | ||
457 | FC_FDMI_PORT_ATTR_HOSTNAME_LEN)); | ||
458 | |||
459 | /* Host Name */ | ||
460 | entry = (struct fc_fdmi_attr_entry *)((char *)entry->value + | ||
461 | FC_FDMI_PORT_ATTR_OSDEVICENAME_LEN); | ||
462 | len = FC_FDMI_ATTR_ENTRY_HEADER_LEN; | ||
463 | len += FC_FDMI_PORT_ATTR_HOSTNAME_LEN; | ||
464 | put_unaligned_be16(FC_FDMI_PORT_ATTR_HOSTNAME, | ||
465 | &entry->type); | ||
466 | put_unaligned_be16(len, &entry->len); | ||
467 | if (strlen(fc_host_system_hostname(lport->host))) | ||
468 | strncpy((char *)&entry->value, | ||
469 | fc_host_system_hostname(lport->host), | ||
470 | strnlen(fc_host_system_hostname(lport->host), | ||
471 | FC_FDMI_PORT_ATTR_HOSTNAME_LEN)); | ||
472 | else | ||
473 | strncpy((char *)&entry->value, | ||
474 | init_utsname()->nodename, | ||
475 | FC_FDMI_PORT_ATTR_HOSTNAME_LEN); | ||
476 | break; | ||
477 | case FC_FDMI_DPRT: | ||
478 | len = sizeof(struct fc_fdmi_dprt); | ||
479 | ct = fc_ct_hdr_fill(fp, op, len, FC_FST_MGMT, | ||
480 | FC_FDMI_SUBTYPE); | ||
481 | /* Port Name */ | ||
482 | put_unaligned_be64(lport->wwpn, | ||
483 | &ct->payload.dprt.port.portname); | ||
484 | break; | ||
485 | case FC_FDMI_DHBA: | ||
486 | len = sizeof(struct fc_fdmi_dhba); | ||
487 | ct = fc_ct_hdr_fill(fp, op, len, FC_FST_MGMT, | ||
488 | FC_FDMI_SUBTYPE); | ||
489 | /* HBA Identifier */ | ||
490 | put_unaligned_be64(lport->wwpn, &ct->payload.dhba.hbaid.id); | ||
491 | break; | ||
492 | default: | ||
493 | return -EINVAL; | ||
494 | } | ||
495 | *r_ctl = FC_RCTL_DD_UNSOL_CTL; | ||
496 | *fh_type = FC_TYPE_CT; | ||
497 | return 0; | ||
498 | } | ||
499 | |||
500 | /** | ||
501 | * fc_ct_fill() - Fill in a common transport service request frame | ||
502 | * @lport: local port. | ||
503 | * @fc_id: FC_ID of non-destination rport for GPN_ID and similar inquiries. | ||
504 | * @fp: frame to contain payload. | ||
505 | * @op: CT opcode. | ||
506 | * @r_ctl: pointer to FC header R_CTL. | ||
507 | * @fh_type: pointer to FC-4 type. | ||
508 | */ | ||
509 | static inline int fc_ct_fill(struct fc_lport *lport, | ||
510 | u32 fc_id, struct fc_frame *fp, | ||
511 | unsigned int op, enum fc_rctl *r_ctl, | ||
512 | enum fc_fh_type *fh_type, u32 *did) | ||
513 | { | ||
514 | int rc = -EINVAL; | ||
515 | |||
516 | switch (fc_id) { | ||
517 | case FC_FID_MGMT_SERV: | ||
518 | rc = fc_ct_ms_fill(lport, fc_id, fp, op, r_ctl, fh_type); | ||
519 | *did = FC_FID_MGMT_SERV; | ||
520 | break; | ||
521 | case FC_FID_DIR_SERV: | ||
522 | default: | ||
523 | rc = fc_ct_ns_fill(lport, fc_id, fp, op, r_ctl, fh_type); | ||
524 | *did = FC_FID_DIR_SERV; | ||
525 | break; | ||
526 | } | ||
527 | |||
528 | return rc; | ||
529 | } | ||
530 | /** | ||
192 | * fc_plogi_fill - Fill in plogi request frame | 531 | * fc_plogi_fill - Fill in plogi request frame |
193 | */ | 532 | */ |
194 | static inline void fc_plogi_fill(struct fc_lport *lport, struct fc_frame *fp, | 533 | static inline void fc_plogi_fill(struct fc_lport *lport, struct fc_frame *fp, |
diff --git a/include/scsi/iscsi_if.h b/include/scsi/iscsi_if.h index 2703e3bedbf5..917741bb8e11 100644 --- a/include/scsi/iscsi_if.h +++ b/include/scsi/iscsi_if.h | |||
@@ -60,6 +60,9 @@ enum iscsi_uevent_e { | |||
60 | 60 | ||
61 | ISCSI_UEVENT_PATH_UPDATE = UEVENT_BASE + 20, | 61 | ISCSI_UEVENT_PATH_UPDATE = UEVENT_BASE + 20, |
62 | ISCSI_UEVENT_SET_IFACE_PARAMS = UEVENT_BASE + 21, | 62 | ISCSI_UEVENT_SET_IFACE_PARAMS = UEVENT_BASE + 21, |
63 | ISCSI_UEVENT_PING = UEVENT_BASE + 22, | ||
64 | ISCSI_UEVENT_GET_CHAP = UEVENT_BASE + 23, | ||
65 | ISCSI_UEVENT_DELETE_CHAP = UEVENT_BASE + 24, | ||
63 | 66 | ||
64 | /* up events */ | 67 | /* up events */ |
65 | ISCSI_KEVENT_RECV_PDU = KEVENT_BASE + 1, | 68 | ISCSI_KEVENT_RECV_PDU = KEVENT_BASE + 1, |
@@ -72,6 +75,8 @@ enum iscsi_uevent_e { | |||
72 | ISCSI_KEVENT_PATH_REQ = KEVENT_BASE + 7, | 75 | ISCSI_KEVENT_PATH_REQ = KEVENT_BASE + 7, |
73 | ISCSI_KEVENT_IF_DOWN = KEVENT_BASE + 8, | 76 | ISCSI_KEVENT_IF_DOWN = KEVENT_BASE + 8, |
74 | ISCSI_KEVENT_CONN_LOGIN_STATE = KEVENT_BASE + 9, | 77 | ISCSI_KEVENT_CONN_LOGIN_STATE = KEVENT_BASE + 9, |
78 | ISCSI_KEVENT_HOST_EVENT = KEVENT_BASE + 10, | ||
79 | ISCSI_KEVENT_PING_COMP = KEVENT_BASE + 11, | ||
75 | }; | 80 | }; |
76 | 81 | ||
77 | enum iscsi_tgt_dscvr { | 82 | enum iscsi_tgt_dscvr { |
@@ -80,6 +85,13 @@ enum iscsi_tgt_dscvr { | |||
80 | ISCSI_TGT_DSCVR_SLP = 3, | 85 | ISCSI_TGT_DSCVR_SLP = 3, |
81 | }; | 86 | }; |
82 | 87 | ||
88 | enum iscsi_host_event_code { | ||
89 | ISCSI_EVENT_LINKUP = 1, | ||
90 | ISCSI_EVENT_LINKDOWN, | ||
91 | /* must always be last */ | ||
92 | ISCSI_EVENT_MAX, | ||
93 | }; | ||
94 | |||
83 | struct iscsi_uevent { | 95 | struct iscsi_uevent { |
84 | uint32_t type; /* k/u events type */ | 96 | uint32_t type; /* k/u events type */ |
85 | uint32_t iferror; /* carries interface or resource errors */ | 97 | uint32_t iferror; /* carries interface or resource errors */ |
@@ -178,6 +190,26 @@ struct iscsi_uevent { | |||
178 | uint32_t host_no; | 190 | uint32_t host_no; |
179 | uint32_t count; | 191 | uint32_t count; |
180 | } set_iface_params; | 192 | } set_iface_params; |
193 | struct msg_iscsi_ping { | ||
194 | uint32_t host_no; | ||
195 | uint32_t iface_num; | ||
196 | uint32_t iface_type; | ||
197 | uint32_t payload_size; | ||
198 | uint32_t pid; /* unique ping id associated | ||
199 | with each ping request */ | ||
200 | } iscsi_ping; | ||
201 | struct msg_get_chap { | ||
202 | uint32_t host_no; | ||
203 | uint32_t num_entries; /* number of CHAP entries | ||
204 | * on request, number of | ||
205 | * valid CHAP entries on | ||
206 | * response */ | ||
207 | uint16_t chap_tbl_idx; | ||
208 | } get_chap; | ||
209 | struct msg_delete_chap { | ||
210 | uint32_t host_no; | ||
211 | uint16_t chap_tbl_idx; | ||
212 | } delete_chap; | ||
181 | } u; | 213 | } u; |
182 | union { | 214 | union { |
183 | /* messages k -> u */ | 215 | /* messages k -> u */ |
@@ -222,6 +254,19 @@ struct iscsi_uevent { | |||
222 | struct msg_notify_if_down { | 254 | struct msg_notify_if_down { |
223 | uint32_t host_no; | 255 | uint32_t host_no; |
224 | } notify_if_down; | 256 | } notify_if_down; |
257 | struct msg_host_event { | ||
258 | uint32_t host_no; | ||
259 | uint32_t data_size; | ||
260 | enum iscsi_host_event_code code; | ||
261 | } host_event; | ||
262 | struct msg_ping_comp { | ||
263 | uint32_t host_no; | ||
264 | uint32_t status; /* enum | ||
265 | * iscsi_ping_status_code */ | ||
266 | uint32_t pid; /* unique ping id associated | ||
267 | with each ping request */ | ||
268 | uint32_t data_size; | ||
269 | } ping_comp; | ||
225 | } r; | 270 | } r; |
226 | } __attribute__ ((aligned (sizeof(uint64_t)))); | 271 | } __attribute__ ((aligned (sizeof(uint64_t)))); |
227 | 272 | ||
@@ -406,6 +451,9 @@ enum iscsi_param { | |||
406 | 451 | ||
407 | ISCSI_PARAM_TGT_RESET_TMO, | 452 | ISCSI_PARAM_TGT_RESET_TMO, |
408 | ISCSI_PARAM_TARGET_ALIAS, | 453 | ISCSI_PARAM_TARGET_ALIAS, |
454 | |||
455 | ISCSI_PARAM_CHAP_IN_IDX, | ||
456 | ISCSI_PARAM_CHAP_OUT_IDX, | ||
409 | /* must always be last */ | 457 | /* must always be last */ |
410 | ISCSI_PARAM_MAX, | 458 | ISCSI_PARAM_MAX, |
411 | }; | 459 | }; |
@@ -416,9 +464,40 @@ enum iscsi_host_param { | |||
416 | ISCSI_HOST_PARAM_INITIATOR_NAME, | 464 | ISCSI_HOST_PARAM_INITIATOR_NAME, |
417 | ISCSI_HOST_PARAM_NETDEV_NAME, | 465 | ISCSI_HOST_PARAM_NETDEV_NAME, |
418 | ISCSI_HOST_PARAM_IPADDRESS, | 466 | ISCSI_HOST_PARAM_IPADDRESS, |
467 | ISCSI_HOST_PARAM_PORT_STATE, | ||
468 | ISCSI_HOST_PARAM_PORT_SPEED, | ||
419 | ISCSI_HOST_PARAM_MAX, | 469 | ISCSI_HOST_PARAM_MAX, |
420 | }; | 470 | }; |
421 | 471 | ||
472 | /* iSCSI port Speed */ | ||
473 | enum iscsi_port_speed { | ||
474 | ISCSI_PORT_SPEED_UNKNOWN = 0x1, | ||
475 | ISCSI_PORT_SPEED_10MBPS = 0x2, | ||
476 | ISCSI_PORT_SPEED_100MBPS = 0x4, | ||
477 | ISCSI_PORT_SPEED_1GBPS = 0x8, | ||
478 | ISCSI_PORT_SPEED_10GBPS = 0x10, | ||
479 | }; | ||
480 | |||
481 | /* iSCSI port state */ | ||
482 | enum iscsi_port_state { | ||
483 | ISCSI_PORT_STATE_DOWN = 0x1, | ||
484 | ISCSI_PORT_STATE_UP = 0x2, | ||
485 | }; | ||
486 | |||
487 | /* iSCSI PING status/error code */ | ||
488 | enum iscsi_ping_status_code { | ||
489 | ISCSI_PING_SUCCESS = 0, | ||
490 | ISCSI_PING_FW_DISABLED = 0x1, | ||
491 | ISCSI_PING_IPADDR_INVALID = 0x2, | ||
492 | ISCSI_PING_LINKLOCAL_IPV6_ADDR_INVALID = 0x3, | ||
493 | ISCSI_PING_TIMEOUT = 0x4, | ||
494 | ISCSI_PING_INVALID_DEST_ADDR = 0x5, | ||
495 | ISCSI_PING_OVERSIZE_PACKET = 0x6, | ||
496 | ISCSI_PING_ICMP_ERROR = 0x7, | ||
497 | ISCSI_PING_MAX_REQ_EXCEEDED = 0x8, | ||
498 | ISCSI_PING_NO_ARP_RECEIVED = 0x9, | ||
499 | }; | ||
500 | |||
422 | #define iscsi_ptr(_handle) ((void*)(unsigned long)_handle) | 501 | #define iscsi_ptr(_handle) ((void*)(unsigned long)_handle) |
423 | #define iscsi_handle(_ptr) ((uint64_t)(unsigned long)_ptr) | 502 | #define iscsi_handle(_ptr) ((uint64_t)(unsigned long)_ptr) |
424 | 503 | ||
@@ -501,4 +580,19 @@ struct iscsi_stats { | |||
501 | __attribute__ ((aligned (sizeof(uint64_t)))); | 580 | __attribute__ ((aligned (sizeof(uint64_t)))); |
502 | }; | 581 | }; |
503 | 582 | ||
583 | enum chap_type_e { | ||
584 | CHAP_TYPE_OUT, | ||
585 | CHAP_TYPE_IN, | ||
586 | }; | ||
587 | |||
588 | #define ISCSI_CHAP_AUTH_NAME_MAX_LEN 256 | ||
589 | #define ISCSI_CHAP_AUTH_SECRET_MAX_LEN 256 | ||
590 | struct iscsi_chap_rec { | ||
591 | uint16_t chap_tbl_idx; | ||
592 | enum chap_type_e chap_type; | ||
593 | char username[ISCSI_CHAP_AUTH_NAME_MAX_LEN]; | ||
594 | uint8_t password[ISCSI_CHAP_AUTH_SECRET_MAX_LEN]; | ||
595 | uint8_t password_length; | ||
596 | }; | ||
597 | |||
504 | #endif | 598 | #endif |
diff --git a/include/scsi/libfc.h b/include/scsi/libfc.h index 6a3922fe0be0..8f9dfba3fcf0 100644 --- a/include/scsi/libfc.h +++ b/include/scsi/libfc.h | |||
@@ -30,6 +30,7 @@ | |||
30 | 30 | ||
31 | #include <scsi/fc/fc_fcp.h> | 31 | #include <scsi/fc/fc_fcp.h> |
32 | #include <scsi/fc/fc_ns.h> | 32 | #include <scsi/fc/fc_ns.h> |
33 | #include <scsi/fc/fc_ms.h> | ||
33 | #include <scsi/fc/fc_els.h> | 34 | #include <scsi/fc/fc_els.h> |
34 | #include <scsi/fc/fc_gs.h> | 35 | #include <scsi/fc/fc_gs.h> |
35 | 36 | ||
@@ -52,6 +53,8 @@ | |||
52 | * @LPORT_ST_RPN_ID: Register port name by ID (RPN_ID) sent | 53 | * @LPORT_ST_RPN_ID: Register port name by ID (RPN_ID) sent |
53 | * @LPORT_ST_RFT_ID: Register Fibre Channel types by ID (RFT_ID) sent | 54 | * @LPORT_ST_RFT_ID: Register Fibre Channel types by ID (RFT_ID) sent |
54 | * @LPORT_ST_RFF_ID: Register FC-4 Features by ID (RFF_ID) sent | 55 | * @LPORT_ST_RFF_ID: Register FC-4 Features by ID (RFF_ID) sent |
56 | * @LPORT_ST_FDMI: Waiting for mgmt server rport to become ready | ||
57 | * @LPORT_ST_RHBA: | ||
55 | * @LPORT_ST_SCR: State Change Register (SCR) sent | 58 | * @LPORT_ST_SCR: State Change Register (SCR) sent |
56 | * @LPORT_ST_READY: Ready for use | 59 | * @LPORT_ST_READY: Ready for use |
57 | * @LPORT_ST_LOGO: Local port logout (LOGO) sent | 60 | * @LPORT_ST_LOGO: Local port logout (LOGO) sent |
@@ -66,6 +69,11 @@ enum fc_lport_state { | |||
66 | LPORT_ST_RSPN_ID, | 69 | LPORT_ST_RSPN_ID, |
67 | LPORT_ST_RFT_ID, | 70 | LPORT_ST_RFT_ID, |
68 | LPORT_ST_RFF_ID, | 71 | LPORT_ST_RFF_ID, |
72 | LPORT_ST_FDMI, | ||
73 | LPORT_ST_RHBA, | ||
74 | LPORT_ST_RPA, | ||
75 | LPORT_ST_DHBA, | ||
76 | LPORT_ST_DPRT, | ||
69 | LPORT_ST_SCR, | 77 | LPORT_ST_SCR, |
70 | LPORT_ST_READY, | 78 | LPORT_ST_READY, |
71 | LPORT_ST_LOGO, | 79 | LPORT_ST_LOGO, |
@@ -797,6 +805,7 @@ enum fc_lport_event { | |||
797 | * @host: The SCSI host associated with a local port | 805 | * @host: The SCSI host associated with a local port |
798 | * @ema_list: Exchange manager anchor list | 806 | * @ema_list: Exchange manager anchor list |
799 | * @dns_rdata: The directory server remote port | 807 | * @dns_rdata: The directory server remote port |
808 | * @ms_rdata: The management server remote port | ||
800 | * @ptp_rdata: Point to point remote port | 809 | * @ptp_rdata: Point to point remote port |
801 | * @scsi_priv: FCP layer internal data | 810 | * @scsi_priv: FCP layer internal data |
802 | * @disc: Discovery context | 811 | * @disc: Discovery context |
@@ -842,6 +851,7 @@ struct fc_lport { | |||
842 | struct Scsi_Host *host; | 851 | struct Scsi_Host *host; |
843 | struct list_head ema_list; | 852 | struct list_head ema_list; |
844 | struct fc_rport_priv *dns_rdata; | 853 | struct fc_rport_priv *dns_rdata; |
854 | struct fc_rport_priv *ms_rdata; | ||
845 | struct fc_rport_priv *ptp_rdata; | 855 | struct fc_rport_priv *ptp_rdata; |
846 | void *scsi_priv; | 856 | void *scsi_priv; |
847 | struct fc_disc disc; | 857 | struct fc_disc disc; |
@@ -877,6 +887,7 @@ struct fc_lport { | |||
877 | u32 does_npiv:1; | 887 | u32 does_npiv:1; |
878 | u32 npiv_enabled:1; | 888 | u32 npiv_enabled:1; |
879 | u32 point_to_multipoint:1; | 889 | u32 point_to_multipoint:1; |
890 | u32 fdmi_enabled:1; | ||
880 | u32 mfs; | 891 | u32 mfs; |
881 | u8 max_retry_count; | 892 | u8 max_retry_count; |
882 | u8 max_rport_retry_count; | 893 | u8 max_rport_retry_count; |
diff --git a/include/scsi/libfcoe.h b/include/scsi/libfcoe.h index 5a35a2a2d3c5..cfdb55f0937e 100644 --- a/include/scsi/libfcoe.h +++ b/include/scsi/libfcoe.h | |||
@@ -165,7 +165,8 @@ struct fcoe_ctlr { | |||
165 | * @switch_name: WWN of switch from advertisement | 165 | * @switch_name: WWN of switch from advertisement |
166 | * @fabric_name: WWN of fabric from advertisement | 166 | * @fabric_name: WWN of fabric from advertisement |
167 | * @fc_map: FC_MAP value from advertisement | 167 | * @fc_map: FC_MAP value from advertisement |
168 | * @fcf_mac: Ethernet address of the FCF | 168 | * @fcf_mac: Ethernet address of the FCF for FIP traffic |
169 | * @fcoe_mac: Ethernet address of the FCF for FCoE traffic | ||
169 | * @vfid: virtual fabric ID | 170 | * @vfid: virtual fabric ID |
170 | * @pri: selection priority, smaller values are better | 171 | * @pri: selection priority, smaller values are better |
171 | * @flogi_sent: current FLOGI sent to this FCF | 172 | * @flogi_sent: current FLOGI sent to this FCF |
@@ -188,6 +189,7 @@ struct fcoe_fcf { | |||
188 | u32 fc_map; | 189 | u32 fc_map; |
189 | u16 vfid; | 190 | u16 vfid; |
190 | u8 fcf_mac[ETH_ALEN]; | 191 | u8 fcf_mac[ETH_ALEN]; |
192 | u8 fcoe_mac[ETH_ALEN]; | ||
191 | 193 | ||
192 | u8 pri; | 194 | u8 pri; |
193 | u8 flogi_sent; | 195 | u8 flogi_sent; |
diff --git a/include/scsi/libiscsi.h b/include/scsi/libiscsi.h index cedcff371c88..6e33386a3898 100644 --- a/include/scsi/libiscsi.h +++ b/include/scsi/libiscsi.h | |||
@@ -268,7 +268,7 @@ struct iscsi_session { | |||
268 | int lu_reset_timeout; | 268 | int lu_reset_timeout; |
269 | int tgt_reset_timeout; | 269 | int tgt_reset_timeout; |
270 | int initial_r2t_en; | 270 | int initial_r2t_en; |
271 | unsigned max_r2t; | 271 | unsigned short max_r2t; |
272 | int imm_data_en; | 272 | int imm_data_en; |
273 | unsigned first_burst; | 273 | unsigned first_burst; |
274 | unsigned max_burst; | 274 | unsigned max_burst; |
@@ -284,6 +284,7 @@ struct iscsi_session { | |||
284 | char *password; | 284 | char *password; |
285 | char *password_in; | 285 | char *password_in; |
286 | char *targetname; | 286 | char *targetname; |
287 | char *targetalias; | ||
287 | char *ifacename; | 288 | char *ifacename; |
288 | char *initiatorname; | 289 | char *initiatorname; |
289 | /* control data */ | 290 | /* control data */ |
diff --git a/include/scsi/libiscsi_tcp.h b/include/scsi/libiscsi_tcp.h index ac0cc1d925ef..215469a9b801 100644 --- a/include/scsi/libiscsi_tcp.h +++ b/include/scsi/libiscsi_tcp.h | |||
@@ -128,7 +128,7 @@ extern void iscsi_tcp_conn_teardown(struct iscsi_cls_conn *cls_conn); | |||
128 | /* misc helpers */ | 128 | /* misc helpers */ |
129 | extern int iscsi_tcp_r2tpool_alloc(struct iscsi_session *session); | 129 | extern int iscsi_tcp_r2tpool_alloc(struct iscsi_session *session); |
130 | extern void iscsi_tcp_r2tpool_free(struct iscsi_session *session); | 130 | extern void iscsi_tcp_r2tpool_free(struct iscsi_session *session); |
131 | 131 | extern int iscsi_tcp_set_max_r2t(struct iscsi_conn *conn, char *buf); | |
132 | extern void iscsi_tcp_conn_get_stats(struct iscsi_cls_conn *cls_conn, | 132 | extern void iscsi_tcp_conn_get_stats(struct iscsi_cls_conn *cls_conn, |
133 | struct iscsi_stats *stats); | 133 | struct iscsi_stats *stats); |
134 | #endif /* LIBISCSI_TCP_H */ | 134 | #endif /* LIBISCSI_TCP_H */ |
diff --git a/include/scsi/libsas.h b/include/scsi/libsas.h index 6a308d42d98f..5f5ed1b8b41b 100644 --- a/include/scsi/libsas.h +++ b/include/scsi/libsas.h | |||
@@ -86,7 +86,9 @@ enum discover_event { | |||
86 | DISCE_DISCOVER_DOMAIN = 0U, | 86 | DISCE_DISCOVER_DOMAIN = 0U, |
87 | DISCE_REVALIDATE_DOMAIN = 1, | 87 | DISCE_REVALIDATE_DOMAIN = 1, |
88 | DISCE_PORT_GONE = 2, | 88 | DISCE_PORT_GONE = 2, |
89 | DISC_NUM_EVENTS = 3, | 89 | DISCE_PROBE = 3, |
90 | DISCE_DESTRUCT = 4, | ||
91 | DISC_NUM_EVENTS = 5, | ||
90 | }; | 92 | }; |
91 | 93 | ||
92 | /* ---------- Expander Devices ---------- */ | 94 | /* ---------- Expander Devices ---------- */ |
@@ -151,6 +153,8 @@ struct expander_device { | |||
151 | 153 | ||
152 | struct ex_phy *ex_phy; | 154 | struct ex_phy *ex_phy; |
153 | struct sas_port *parent_port; | 155 | struct sas_port *parent_port; |
156 | |||
157 | struct mutex cmd_mutex; | ||
154 | }; | 158 | }; |
155 | 159 | ||
156 | /* ---------- SATA device ---------- */ | 160 | /* ---------- SATA device ---------- */ |
@@ -162,22 +166,21 @@ enum ata_command_set { | |||
162 | struct sata_device { | 166 | struct sata_device { |
163 | enum ata_command_set command_set; | 167 | enum ata_command_set command_set; |
164 | struct smp_resp rps_resp; /* report_phy_sata_resp */ | 168 | struct smp_resp rps_resp; /* report_phy_sata_resp */ |
165 | __le16 *identify_device; | ||
166 | __le16 *identify_packet_device; | ||
167 | |||
168 | u8 port_no; /* port number, if this is a PM (Port) */ | 169 | u8 port_no; /* port number, if this is a PM (Port) */ |
169 | struct list_head children; /* PM Ports if this is a PM */ | 170 | struct list_head children; /* PM Ports if this is a PM */ |
170 | 171 | ||
171 | struct ata_port *ap; | 172 | struct ata_port *ap; |
172 | struct ata_host ata_host; | 173 | struct ata_host ata_host; |
173 | struct ata_taskfile tf; | 174 | struct ata_taskfile tf; |
174 | u32 sstatus; | ||
175 | u32 serror; | ||
176 | u32 scontrol; | ||
177 | }; | 175 | }; |
178 | 176 | ||
179 | /* ---------- Domain device ---------- */ | 177 | enum { |
178 | SAS_DEV_GONE, | ||
179 | SAS_DEV_DESTROY, | ||
180 | }; | ||
181 | |||
180 | struct domain_device { | 182 | struct domain_device { |
183 | spinlock_t done_lock; | ||
181 | enum sas_dev_type dev_type; | 184 | enum sas_dev_type dev_type; |
182 | 185 | ||
183 | enum sas_linkrate linkrate; | 186 | enum sas_linkrate linkrate; |
@@ -189,8 +192,10 @@ struct domain_device { | |||
189 | struct domain_device *parent; | 192 | struct domain_device *parent; |
190 | struct list_head siblings; /* devices on the same level */ | 193 | struct list_head siblings; /* devices on the same level */ |
191 | struct asd_sas_port *port; /* shortcut to root of the tree */ | 194 | struct asd_sas_port *port; /* shortcut to root of the tree */ |
195 | struct sas_phy *phy; | ||
192 | 196 | ||
193 | struct list_head dev_list_node; | 197 | struct list_head dev_list_node; |
198 | struct list_head disco_list_node; /* awaiting probe or destruct */ | ||
194 | 199 | ||
195 | enum sas_protocol iproto; | 200 | enum sas_protocol iproto; |
196 | enum sas_protocol tproto; | 201 | enum sas_protocol tproto; |
@@ -208,7 +213,8 @@ struct domain_device { | |||
208 | }; | 213 | }; |
209 | 214 | ||
210 | void *lldd_dev; | 215 | void *lldd_dev; |
211 | int gone; | 216 | unsigned long state; |
217 | struct kref kref; | ||
212 | }; | 218 | }; |
213 | 219 | ||
214 | struct sas_discovery_event { | 220 | struct sas_discovery_event { |
@@ -217,7 +223,6 @@ struct sas_discovery_event { | |||
217 | }; | 223 | }; |
218 | 224 | ||
219 | struct sas_discovery { | 225 | struct sas_discovery { |
220 | spinlock_t disc_event_lock; | ||
221 | struct sas_discovery_event disc_work[DISC_NUM_EVENTS]; | 226 | struct sas_discovery_event disc_work[DISC_NUM_EVENTS]; |
222 | unsigned long pending; | 227 | unsigned long pending; |
223 | u8 fanout_sas_addr[8]; | 228 | u8 fanout_sas_addr[8]; |
@@ -226,7 +231,6 @@ struct sas_discovery { | |||
226 | int max_level; | 231 | int max_level; |
227 | }; | 232 | }; |
228 | 233 | ||
229 | |||
230 | /* The port struct is Class:RW, driver:RO */ | 234 | /* The port struct is Class:RW, driver:RO */ |
231 | struct asd_sas_port { | 235 | struct asd_sas_port { |
232 | /* private: */ | 236 | /* private: */ |
@@ -236,9 +240,10 @@ struct asd_sas_port { | |||
236 | struct domain_device *port_dev; | 240 | struct domain_device *port_dev; |
237 | spinlock_t dev_list_lock; | 241 | spinlock_t dev_list_lock; |
238 | struct list_head dev_list; | 242 | struct list_head dev_list; |
243 | struct list_head disco_list; | ||
244 | struct list_head destroy_list; | ||
239 | enum sas_linkrate linkrate; | 245 | enum sas_linkrate linkrate; |
240 | 246 | ||
241 | struct sas_phy *phy; | ||
242 | struct work_struct work; | 247 | struct work_struct work; |
243 | 248 | ||
244 | /* public: */ | 249 | /* public: */ |
@@ -274,7 +279,6 @@ struct asd_sas_event { | |||
274 | */ | 279 | */ |
275 | struct asd_sas_phy { | 280 | struct asd_sas_phy { |
276 | /* private: */ | 281 | /* private: */ |
277 | /* protected by ha->event_lock */ | ||
278 | struct asd_sas_event port_events[PORT_NUM_EVENTS]; | 282 | struct asd_sas_event port_events[PORT_NUM_EVENTS]; |
279 | struct asd_sas_event phy_events[PHY_NUM_EVENTS]; | 283 | struct asd_sas_event phy_events[PHY_NUM_EVENTS]; |
280 | 284 | ||
@@ -320,6 +324,7 @@ struct asd_sas_phy { | |||
320 | struct scsi_core { | 324 | struct scsi_core { |
321 | struct Scsi_Host *shost; | 325 | struct Scsi_Host *shost; |
322 | 326 | ||
327 | struct mutex task_queue_flush; | ||
323 | spinlock_t task_queue_lock; | 328 | spinlock_t task_queue_lock; |
324 | struct list_head task_queue; | 329 | struct list_head task_queue; |
325 | int task_queue_size; | 330 | int task_queue_size; |
@@ -334,18 +339,23 @@ struct sas_ha_event { | |||
334 | 339 | ||
335 | enum sas_ha_state { | 340 | enum sas_ha_state { |
336 | SAS_HA_REGISTERED, | 341 | SAS_HA_REGISTERED, |
337 | SAS_HA_UNREGISTERED | 342 | SAS_HA_DRAINING, |
343 | SAS_HA_ATA_EH_ACTIVE, | ||
344 | SAS_HA_FROZEN, | ||
338 | }; | 345 | }; |
339 | 346 | ||
340 | struct sas_ha_struct { | 347 | struct sas_ha_struct { |
341 | /* private: */ | 348 | /* private: */ |
342 | spinlock_t event_lock; | ||
343 | struct sas_ha_event ha_events[HA_NUM_EVENTS]; | 349 | struct sas_ha_event ha_events[HA_NUM_EVENTS]; |
344 | unsigned long pending; | 350 | unsigned long pending; |
345 | 351 | ||
346 | enum sas_ha_state state; | 352 | struct list_head defer_q; /* work queued while draining */ |
353 | struct mutex drain_mutex; | ||
354 | unsigned long state; | ||
347 | spinlock_t state_lock; | 355 | spinlock_t state_lock; |
348 | 356 | ||
357 | struct mutex disco_mutex; | ||
358 | |||
349 | struct scsi_core core; | 359 | struct scsi_core core; |
350 | 360 | ||
351 | /* public: */ | 361 | /* public: */ |
@@ -374,7 +384,8 @@ struct sas_ha_struct { | |||
374 | 384 | ||
375 | void *lldd_ha; /* not touched by sas class code */ | 385 | void *lldd_ha; /* not touched by sas class code */ |
376 | 386 | ||
377 | struct list_head eh_done_q; | 387 | struct list_head eh_done_q; /* complete via scsi_eh_flush_done_q */ |
388 | struct list_head eh_ata_q; /* scmds to promote from sas to ata eh */ | ||
378 | }; | 389 | }; |
379 | 390 | ||
380 | #define SHOST_TO_SAS_HA(_shost) (*(struct sas_ha_struct **)(_shost)->hostdata) | 391 | #define SHOST_TO_SAS_HA(_shost) (*(struct sas_ha_struct **)(_shost)->hostdata) |
@@ -418,6 +429,11 @@ static inline unsigned int to_sas_gpio_od(int device, int bit) | |||
418 | return 3 * device + bit; | 429 | return 3 * device + bit; |
419 | } | 430 | } |
420 | 431 | ||
432 | static inline void sas_put_local_phy(struct sas_phy *phy) | ||
433 | { | ||
434 | put_device(&phy->dev); | ||
435 | } | ||
436 | |||
421 | #ifdef CONFIG_SCSI_SAS_HOST_SMP | 437 | #ifdef CONFIG_SCSI_SAS_HOST_SMP |
422 | int try_test_sas_gpio_gp_bit(unsigned int od, u8 *data, u8 index, u8 count); | 438 | int try_test_sas_gpio_gp_bit(unsigned int od, u8 *data, u8 index, u8 count); |
423 | #else | 439 | #else |
@@ -447,7 +463,10 @@ enum service_response { | |||
447 | }; | 463 | }; |
448 | 464 | ||
449 | enum exec_status { | 465 | enum exec_status { |
450 | /* The SAM_STAT_.. codes fit in the lower 6 bits */ | 466 | /* The SAM_STAT_.. codes fit in the lower 6 bits, alias some of |
467 | * them here to silence 'case value not in enumerated type' warnings | ||
468 | */ | ||
469 | __SAM_STAT_CHECK_CONDITION = SAM_STAT_CHECK_CONDITION, | ||
451 | 470 | ||
452 | SAS_DEV_NO_RESPONSE = 0x80, | 471 | SAS_DEV_NO_RESPONSE = 0x80, |
453 | SAS_DATA_UNDERRUN, | 472 | SAS_DATA_UNDERRUN, |
@@ -487,10 +506,6 @@ enum exec_status { | |||
487 | struct ata_task_resp { | 506 | struct ata_task_resp { |
488 | u16 frame_len; | 507 | u16 frame_len; |
489 | u8 ending_fis[24]; /* dev to host or data-in */ | 508 | u8 ending_fis[24]; /* dev to host or data-in */ |
490 | u32 sstatus; | ||
491 | u32 serror; | ||
492 | u32 scontrol; | ||
493 | u32 sactive; | ||
494 | }; | 509 | }; |
495 | 510 | ||
496 | #define SAS_STATUS_BUF_SIZE 96 | 511 | #define SAS_STATUS_BUF_SIZE 96 |
@@ -604,7 +619,8 @@ struct sas_domain_function_template { | |||
604 | int (*lldd_clear_aca)(struct domain_device *, u8 *lun); | 619 | int (*lldd_clear_aca)(struct domain_device *, u8 *lun); |
605 | int (*lldd_clear_task_set)(struct domain_device *, u8 *lun); | 620 | int (*lldd_clear_task_set)(struct domain_device *, u8 *lun); |
606 | int (*lldd_I_T_nexus_reset)(struct domain_device *); | 621 | int (*lldd_I_T_nexus_reset)(struct domain_device *); |
607 | int (*lldd_ata_soft_reset)(struct domain_device *); | 622 | int (*lldd_ata_check_ready)(struct domain_device *); |
623 | void (*lldd_ata_set_dmamode)(struct domain_device *); | ||
608 | int (*lldd_lu_reset)(struct domain_device *, u8 *lun); | 624 | int (*lldd_lu_reset)(struct domain_device *, u8 *lun); |
609 | int (*lldd_query_task)(struct sas_task *); | 625 | int (*lldd_query_task)(struct sas_task *); |
610 | 626 | ||
@@ -625,14 +641,11 @@ extern int sas_unregister_ha(struct sas_ha_struct *); | |||
625 | 641 | ||
626 | int sas_set_phy_speed(struct sas_phy *phy, | 642 | int sas_set_phy_speed(struct sas_phy *phy, |
627 | struct sas_phy_linkrates *rates); | 643 | struct sas_phy_linkrates *rates); |
628 | int sas_phy_enable(struct sas_phy *phy, int enabled); | ||
629 | int sas_phy_reset(struct sas_phy *phy, int hard_reset); | 644 | int sas_phy_reset(struct sas_phy *phy, int hard_reset); |
630 | int sas_queue_up(struct sas_task *task); | 645 | int sas_queue_up(struct sas_task *task); |
631 | extern int sas_queuecommand(struct Scsi_Host * ,struct scsi_cmnd *); | 646 | extern int sas_queuecommand(struct Scsi_Host * ,struct scsi_cmnd *); |
632 | extern int sas_target_alloc(struct scsi_target *); | 647 | extern int sas_target_alloc(struct scsi_target *); |
633 | extern int sas_slave_alloc(struct scsi_device *); | ||
634 | extern int sas_slave_configure(struct scsi_device *); | 648 | extern int sas_slave_configure(struct scsi_device *); |
635 | extern void sas_slave_destroy(struct scsi_device *); | ||
636 | extern int sas_change_queue_depth(struct scsi_device *, int new_depth, | 649 | extern int sas_change_queue_depth(struct scsi_device *, int new_depth, |
637 | int reason); | 650 | int reason); |
638 | extern int sas_change_queue_type(struct scsi_device *, int qt); | 651 | extern int sas_change_queue_type(struct scsi_device *, int qt); |
@@ -649,7 +662,7 @@ void sas_init_ex_attr(void); | |||
649 | 662 | ||
650 | int sas_ex_revalidate_domain(struct domain_device *); | 663 | int sas_ex_revalidate_domain(struct domain_device *); |
651 | 664 | ||
652 | void sas_unregister_domain_devices(struct asd_sas_port *port); | 665 | void sas_unregister_domain_devices(struct asd_sas_port *port, int gone); |
653 | void sas_init_disc(struct sas_discovery *disc, struct asd_sas_port *); | 666 | void sas_init_disc(struct sas_discovery *disc, struct asd_sas_port *); |
654 | int sas_discover_event(struct asd_sas_port *, enum discover_event ev); | 667 | int sas_discover_event(struct asd_sas_port *, enum discover_event ev); |
655 | 668 | ||
@@ -661,20 +674,20 @@ void sas_unregister_dev(struct asd_sas_port *port, struct domain_device *); | |||
661 | void sas_init_dev(struct domain_device *); | 674 | void sas_init_dev(struct domain_device *); |
662 | 675 | ||
663 | void sas_task_abort(struct sas_task *); | 676 | void sas_task_abort(struct sas_task *); |
664 | int __sas_task_abort(struct sas_task *); | ||
665 | int sas_eh_device_reset_handler(struct scsi_cmnd *cmd); | 677 | int sas_eh_device_reset_handler(struct scsi_cmnd *cmd); |
666 | int sas_eh_bus_reset_handler(struct scsi_cmnd *cmd); | 678 | int sas_eh_bus_reset_handler(struct scsi_cmnd *cmd); |
667 | 679 | ||
668 | extern void sas_target_destroy(struct scsi_target *); | 680 | extern void sas_target_destroy(struct scsi_target *); |
669 | extern int sas_slave_alloc(struct scsi_device *); | 681 | extern int sas_slave_alloc(struct scsi_device *); |
670 | extern int sas_ioctl(struct scsi_device *sdev, int cmd, void __user *arg); | 682 | extern int sas_ioctl(struct scsi_device *sdev, int cmd, void __user *arg); |
683 | extern int sas_drain_work(struct sas_ha_struct *ha); | ||
671 | 684 | ||
672 | extern int sas_smp_handler(struct Scsi_Host *shost, struct sas_rphy *rphy, | 685 | extern int sas_smp_handler(struct Scsi_Host *shost, struct sas_rphy *rphy, |
673 | struct request *req); | 686 | struct request *req); |
674 | 687 | ||
675 | extern void sas_ssp_task_response(struct device *dev, struct sas_task *task, | 688 | extern void sas_ssp_task_response(struct device *dev, struct sas_task *task, |
676 | struct ssp_response_iu *iu); | 689 | struct ssp_response_iu *iu); |
677 | struct sas_phy *sas_find_local_phy(struct domain_device *dev); | 690 | struct sas_phy *sas_get_local_phy(struct domain_device *dev); |
678 | 691 | ||
679 | int sas_request_addr(struct Scsi_Host *shost, u8 *addr); | 692 | int sas_request_addr(struct Scsi_Host *shost, u8 *addr); |
680 | 693 | ||
diff --git a/include/scsi/osd_ore.h b/include/scsi/osd_ore.h index f05fa826f89e..a5f9b960dfc8 100644 --- a/include/scsi/osd_ore.h +++ b/include/scsi/osd_ore.h | |||
@@ -26,6 +26,7 @@ | |||
26 | #include <scsi/osd_attributes.h> | 26 | #include <scsi/osd_attributes.h> |
27 | #include <scsi/osd_sec.h> | 27 | #include <scsi/osd_sec.h> |
28 | #include <linux/pnfs_osd_xdr.h> | 28 | #include <linux/pnfs_osd_xdr.h> |
29 | #include <linux/bug.h> | ||
29 | 30 | ||
30 | struct ore_comp { | 31 | struct ore_comp { |
31 | struct osd_obj_id obj; | 32 | struct osd_obj_id obj; |
diff --git a/include/scsi/sas.h b/include/scsi/sas.h index 3673d685e6ad..a577a833603d 100644 --- a/include/scsi/sas.h +++ b/include/scsi/sas.h | |||
@@ -89,8 +89,7 @@ enum sas_oob_mode { | |||
89 | SAS_OOB_MODE | 89 | SAS_OOB_MODE |
90 | }; | 90 | }; |
91 | 91 | ||
92 | /* See sas_discover.c if you plan on changing these. | 92 | /* See sas_discover.c if you plan on changing these */ |
93 | */ | ||
94 | enum sas_dev_type { | 93 | enum sas_dev_type { |
95 | NO_DEVICE = 0, /* protocol */ | 94 | NO_DEVICE = 0, /* protocol */ |
96 | SAS_END_DEV = 1, /* protocol */ | 95 | SAS_END_DEV = 1, /* protocol */ |
@@ -100,6 +99,7 @@ enum sas_dev_type { | |||
100 | SATA_DEV = 5, | 99 | SATA_DEV = 5, |
101 | SATA_PM = 7, | 100 | SATA_PM = 7, |
102 | SATA_PM_PORT= 8, | 101 | SATA_PM_PORT= 8, |
102 | SATA_PENDING = 9, | ||
103 | }; | 103 | }; |
104 | 104 | ||
105 | enum sas_protocol { | 105 | enum sas_protocol { |
diff --git a/include/scsi/sas_ata.h b/include/scsi/sas_ata.h index 9c159f74c6d0..cdccd2eb7b6c 100644 --- a/include/scsi/sas_ata.h +++ b/include/scsi/sas_ata.h | |||
@@ -32,19 +32,19 @@ | |||
32 | 32 | ||
33 | static inline int dev_is_sata(struct domain_device *dev) | 33 | static inline int dev_is_sata(struct domain_device *dev) |
34 | { | 34 | { |
35 | return (dev->rphy->identify.target_port_protocols & SAS_PROTOCOL_SATA); | 35 | return dev->dev_type == SATA_DEV || dev->dev_type == SATA_PM || |
36 | dev->dev_type == SATA_PM_PORT || dev->dev_type == SATA_PENDING; | ||
36 | } | 37 | } |
37 | 38 | ||
38 | int sas_ata_init_host_and_port(struct domain_device *found_dev, | 39 | int sas_get_ata_info(struct domain_device *dev, struct ex_phy *phy); |
39 | struct scsi_target *starget); | 40 | int sas_ata_init_host_and_port(struct domain_device *found_dev); |
40 | |||
41 | void sas_ata_task_abort(struct sas_task *task); | 41 | void sas_ata_task_abort(struct sas_task *task); |
42 | void sas_ata_strategy_handler(struct Scsi_Host *shost); | 42 | void sas_ata_strategy_handler(struct Scsi_Host *shost); |
43 | int sas_ata_timed_out(struct scsi_cmnd *cmd, struct sas_task *task, | 43 | void sas_ata_eh(struct Scsi_Host *shost, struct list_head *work_q, |
44 | enum blk_eh_timer_return *rtn); | 44 | struct list_head *done_q); |
45 | int sas_ata_eh(struct Scsi_Host *shost, struct list_head *work_q, | 45 | void sas_ata_schedule_reset(struct domain_device *dev); |
46 | struct list_head *done_q); | 46 | void sas_ata_wait_eh(struct domain_device *dev); |
47 | 47 | void sas_probe_sata(struct asd_sas_port *port); | |
48 | #else | 48 | #else |
49 | 49 | ||
50 | 50 | ||
@@ -52,8 +52,7 @@ static inline int dev_is_sata(struct domain_device *dev) | |||
52 | { | 52 | { |
53 | return 0; | 53 | return 0; |
54 | } | 54 | } |
55 | static inline int sas_ata_init_host_and_port(struct domain_device *found_dev, | 55 | static inline int sas_ata_init_host_and_port(struct domain_device *found_dev) |
56 | struct scsi_target *starget) | ||
57 | { | 56 | { |
58 | return 0; | 57 | return 0; |
59 | } | 58 | } |
@@ -65,18 +64,27 @@ static inline void sas_ata_strategy_handler(struct Scsi_Host *shost) | |||
65 | { | 64 | { |
66 | } | 65 | } |
67 | 66 | ||
68 | static inline int sas_ata_timed_out(struct scsi_cmnd *cmd, | 67 | static inline void sas_ata_eh(struct Scsi_Host *shost, struct list_head *work_q, |
69 | struct sas_task *task, | 68 | struct list_head *done_q) |
70 | enum blk_eh_timer_return *rtn) | ||
71 | { | 69 | { |
72 | return 0; | ||
73 | } | 70 | } |
74 | static inline int sas_ata_eh(struct Scsi_Host *shost, struct list_head *work_q, | 71 | |
75 | struct list_head *done_q) | 72 | static inline void sas_ata_schedule_reset(struct domain_device *dev) |
73 | { | ||
74 | } | ||
75 | |||
76 | static inline void sas_ata_wait_eh(struct domain_device *dev) | ||
77 | { | ||
78 | } | ||
79 | |||
80 | static inline void sas_probe_sata(struct asd_sas_port *port) | ||
76 | { | 81 | { |
77 | return 0; | ||
78 | } | 82 | } |
79 | 83 | ||
84 | static inline int sas_get_ata_info(struct domain_device *dev, struct ex_phy *phy) | ||
85 | { | ||
86 | return 0; | ||
87 | } | ||
80 | #endif | 88 | #endif |
81 | 89 | ||
82 | #endif /* _SAS_ATA_H_ */ | 90 | #endif /* _SAS_ATA_H_ */ |
diff --git a/include/scsi/scsi.h b/include/scsi/scsi.h index 8001ae4cd7ba..f34a5a87af38 100644 --- a/include/scsi/scsi.h +++ b/include/scsi/scsi.h | |||
@@ -143,6 +143,7 @@ struct scsi_cmnd; | |||
143 | #define READ_ATTRIBUTE 0x8c | 143 | #define READ_ATTRIBUTE 0x8c |
144 | #define WRITE_ATTRIBUTE 0x8d | 144 | #define WRITE_ATTRIBUTE 0x8d |
145 | #define VERIFY_16 0x8f | 145 | #define VERIFY_16 0x8f |
146 | #define SYNCHRONIZE_CACHE_16 0x91 | ||
146 | #define WRITE_SAME_16 0x93 | 147 | #define WRITE_SAME_16 0x93 |
147 | #define SERVICE_ACTION_IN 0x9e | 148 | #define SERVICE_ACTION_IN 0x9e |
148 | /* values for service action in */ | 149 | /* values for service action in */ |
diff --git a/include/scsi/scsi_cmnd.h b/include/scsi/scsi_cmnd.h index a5e885a111df..1e1198546c72 100644 --- a/include/scsi/scsi_cmnd.h +++ b/include/scsi/scsi_cmnd.h | |||
@@ -10,6 +10,7 @@ | |||
10 | 10 | ||
11 | struct Scsi_Host; | 11 | struct Scsi_Host; |
12 | struct scsi_device; | 12 | struct scsi_device; |
13 | struct scsi_driver; | ||
13 | 14 | ||
14 | /* | 15 | /* |
15 | * MAX_COMMAND_SIZE is: | 16 | * MAX_COMMAND_SIZE is: |
@@ -131,6 +132,14 @@ struct scsi_cmnd { | |||
131 | unsigned char tag; /* SCSI-II queued command tag */ | 132 | unsigned char tag; /* SCSI-II queued command tag */ |
132 | }; | 133 | }; |
133 | 134 | ||
135 | static inline struct scsi_driver *scsi_cmd_to_driver(struct scsi_cmnd *cmd) | ||
136 | { | ||
137 | if (!cmd->request->rq_disk) | ||
138 | return NULL; | ||
139 | |||
140 | return *(struct scsi_driver **)cmd->request->rq_disk->private_data; | ||
141 | } | ||
142 | |||
134 | extern struct scsi_cmnd *scsi_get_command(struct scsi_device *, gfp_t); | 143 | extern struct scsi_cmnd *scsi_get_command(struct scsi_device *, gfp_t); |
135 | extern struct scsi_cmnd *__scsi_get_command(struct Scsi_Host *, gfp_t); | 144 | extern struct scsi_cmnd *__scsi_get_command(struct Scsi_Host *, gfp_t); |
136 | extern void scsi_put_command(struct scsi_cmnd *); | 145 | extern void scsi_put_command(struct scsi_cmnd *); |
@@ -289,17 +298,17 @@ static inline struct scsi_data_buffer *scsi_prot(struct scsi_cmnd *cmd) | |||
289 | 298 | ||
290 | static inline void set_msg_byte(struct scsi_cmnd *cmd, char status) | 299 | static inline void set_msg_byte(struct scsi_cmnd *cmd, char status) |
291 | { | 300 | { |
292 | cmd->result |= status << 8; | 301 | cmd->result = (cmd->result & 0xffff00ff) | (status << 8); |
293 | } | 302 | } |
294 | 303 | ||
295 | static inline void set_host_byte(struct scsi_cmnd *cmd, char status) | 304 | static inline void set_host_byte(struct scsi_cmnd *cmd, char status) |
296 | { | 305 | { |
297 | cmd->result |= status << 16; | 306 | cmd->result = (cmd->result & 0xff00ffff) | (status << 16); |
298 | } | 307 | } |
299 | 308 | ||
300 | static inline void set_driver_byte(struct scsi_cmnd *cmd, char status) | 309 | static inline void set_driver_byte(struct scsi_cmnd *cmd, char status) |
301 | { | 310 | { |
302 | cmd->result |= status << 24; | 311 | cmd->result = (cmd->result & 0x00ffffff) | (status << 24); |
303 | } | 312 | } |
304 | 313 | ||
305 | #endif /* _SCSI_SCSI_CMND_H */ | 314 | #endif /* _SCSI_SCSI_CMND_H */ |
diff --git a/include/scsi/scsi_device.h b/include/scsi/scsi_device.h index 77273f2fdd80..6efb2e1416e0 100644 --- a/include/scsi/scsi_device.h +++ b/include/scsi/scsi_device.h | |||
@@ -1,7 +1,6 @@ | |||
1 | #ifndef _SCSI_SCSI_DEVICE_H | 1 | #ifndef _SCSI_SCSI_DEVICE_H |
2 | #define _SCSI_SCSI_DEVICE_H | 2 | #define _SCSI_SCSI_DEVICE_H |
3 | 3 | ||
4 | #include <linux/device.h> | ||
5 | #include <linux/list.h> | 4 | #include <linux/list.h> |
6 | #include <linux/spinlock.h> | 5 | #include <linux/spinlock.h> |
7 | #include <linux/workqueue.h> | 6 | #include <linux/workqueue.h> |
@@ -9,6 +8,7 @@ | |||
9 | #include <scsi/scsi.h> | 8 | #include <scsi/scsi.h> |
10 | #include <linux/atomic.h> | 9 | #include <linux/atomic.h> |
11 | 10 | ||
11 | struct device; | ||
12 | struct request_queue; | 12 | struct request_queue; |
13 | struct scsi_cmnd; | 13 | struct scsi_cmnd; |
14 | struct scsi_lun; | 14 | struct scsi_lun; |
@@ -136,6 +136,7 @@ struct scsi_device { | |||
136 | unsigned use_10_for_ms:1; /* first try 10-byte mode sense/select */ | 136 | unsigned use_10_for_ms:1; /* first try 10-byte mode sense/select */ |
137 | unsigned skip_ms_page_8:1; /* do not use MODE SENSE page 0x08 */ | 137 | unsigned skip_ms_page_8:1; /* do not use MODE SENSE page 0x08 */ |
138 | unsigned skip_ms_page_3f:1; /* do not use MODE SENSE page 0x3f */ | 138 | unsigned skip_ms_page_3f:1; /* do not use MODE SENSE page 0x3f */ |
139 | unsigned skip_vpd_pages:1; /* do not read VPD pages */ | ||
139 | unsigned use_192_bytes_for_3f:1; /* ask for 192 bytes from page 0x3f */ | 140 | unsigned use_192_bytes_for_3f:1; /* ask for 192 bytes from page 0x3f */ |
140 | unsigned no_start_on_add:1; /* do not issue start on add */ | 141 | unsigned no_start_on_add:1; /* do not issue start on add */ |
141 | unsigned allow_restart:1; /* issue START_UNIT in error handler */ | 142 | unsigned allow_restart:1; /* issue START_UNIT in error handler */ |
@@ -246,8 +247,10 @@ struct scsi_target { | |||
246 | unsigned int single_lun:1; /* Indicates we should only | 247 | unsigned int single_lun:1; /* Indicates we should only |
247 | * allow I/O to one of the luns | 248 | * allow I/O to one of the luns |
248 | * for the device at a time. */ | 249 | * for the device at a time. */ |
249 | unsigned int pdt_1f_for_no_lun; /* PDT = 0x1f */ | 250 | unsigned int pdt_1f_for_no_lun:1; /* PDT = 0x1f |
250 | /* means no lun present */ | 251 | * means no lun present. */ |
252 | unsigned int no_report_luns:1; /* Don't use | ||
253 | * REPORT LUNS for scanning. */ | ||
251 | /* commands actually active on LLD. protected by host lock. */ | 254 | /* commands actually active on LLD. protected by host lock. */ |
252 | unsigned int target_busy; | 255 | unsigned int target_busy; |
253 | /* | 256 | /* |
diff --git a/include/scsi/scsi_driver.h b/include/scsi/scsi_driver.h index 9fd6702f02e2..d443aa06a722 100644 --- a/include/scsi/scsi_driver.h +++ b/include/scsi/scsi_driver.h | |||
@@ -16,6 +16,7 @@ struct scsi_driver { | |||
16 | 16 | ||
17 | void (*rescan)(struct device *); | 17 | void (*rescan)(struct device *); |
18 | int (*done)(struct scsi_cmnd *); | 18 | int (*done)(struct scsi_cmnd *); |
19 | int (*eh_action)(struct scsi_cmnd *, unsigned char *, int, int); | ||
19 | }; | 20 | }; |
20 | #define to_scsi_driver(drv) \ | 21 | #define to_scsi_driver(drv) \ |
21 | container_of((drv), struct scsi_driver, gendrv) | 22 | container_of((drv), struct scsi_driver, gendrv) |
diff --git a/include/scsi/scsi_netlink.h b/include/scsi/scsi_netlink.h index 58ce8fe44783..5cb20ccb1956 100644 --- a/include/scsi/scsi_netlink.h +++ b/include/scsi/scsi_netlink.h | |||
@@ -23,7 +23,7 @@ | |||
23 | #define SCSI_NETLINK_H | 23 | #define SCSI_NETLINK_H |
24 | 24 | ||
25 | #include <linux/netlink.h> | 25 | #include <linux/netlink.h> |
26 | 26 | #include <linux/types.h> | |
27 | 27 | ||
28 | /* | 28 | /* |
29 | * This file intended to be included by both kernel and user space | 29 | * This file intended to be included by both kernel and user space |
diff --git a/include/scsi/scsi_transport.h b/include/scsi/scsi_transport.h index 0de32cd4e8a7..af244f4bba53 100644 --- a/include/scsi/scsi_transport.h +++ b/include/scsi/scsi_transport.h | |||
@@ -22,6 +22,7 @@ | |||
22 | 22 | ||
23 | #include <linux/transport_class.h> | 23 | #include <linux/transport_class.h> |
24 | #include <linux/blkdev.h> | 24 | #include <linux/blkdev.h> |
25 | #include <linux/bug.h> | ||
25 | #include <scsi/scsi_host.h> | 26 | #include <scsi/scsi_host.h> |
26 | #include <scsi/scsi_device.h> | 27 | #include <scsi/scsi_device.h> |
27 | 28 | ||
diff --git a/include/scsi/scsi_transport_fc.h b/include/scsi/scsi_transport_fc.h index 2a65167a8f10..719faf1863ad 100644 --- a/include/scsi/scsi_transport_fc.h +++ b/include/scsi/scsi_transport_fc.h | |||
@@ -126,8 +126,8 @@ enum fc_vport_state { | |||
126 | incapable of reporting */ | 126 | incapable of reporting */ |
127 | #define FC_PORTSPEED_1GBIT 1 | 127 | #define FC_PORTSPEED_1GBIT 1 |
128 | #define FC_PORTSPEED_2GBIT 2 | 128 | #define FC_PORTSPEED_2GBIT 2 |
129 | #define FC_PORTSPEED_4GBIT 4 | 129 | #define FC_PORTSPEED_10GBIT 4 |
130 | #define FC_PORTSPEED_10GBIT 8 | 130 | #define FC_PORTSPEED_4GBIT 8 |
131 | #define FC_PORTSPEED_8GBIT 0x10 | 131 | #define FC_PORTSPEED_8GBIT 0x10 |
132 | #define FC_PORTSPEED_16GBIT 0x20 | 132 | #define FC_PORTSPEED_16GBIT 0x20 |
133 | #define FC_PORTSPEED_NOT_NEGOTIATED (1 << 15) /* Speed not established */ | 133 | #define FC_PORTSPEED_NOT_NEGOTIATED (1 << 15) /* Speed not established */ |
@@ -486,6 +486,13 @@ struct fc_host_attrs { | |||
486 | u32 maxframe_size; | 486 | u32 maxframe_size; |
487 | u16 max_npiv_vports; | 487 | u16 max_npiv_vports; |
488 | char serial_number[FC_SERIAL_NUMBER_SIZE]; | 488 | char serial_number[FC_SERIAL_NUMBER_SIZE]; |
489 | char manufacturer[FC_SERIAL_NUMBER_SIZE]; | ||
490 | char model[FC_SYMBOLIC_NAME_SIZE]; | ||
491 | char model_description[FC_SYMBOLIC_NAME_SIZE]; | ||
492 | char hardware_version[FC_VERSION_STRING_SIZE]; | ||
493 | char driver_version[FC_VERSION_STRING_SIZE]; | ||
494 | char firmware_version[FC_VERSION_STRING_SIZE]; | ||
495 | char optionrom_version[FC_VERSION_STRING_SIZE]; | ||
489 | 496 | ||
490 | /* Dynamic Attributes */ | 497 | /* Dynamic Attributes */ |
491 | u32 port_id; | 498 | u32 port_id; |
@@ -541,6 +548,20 @@ struct fc_host_attrs { | |||
541 | (((struct fc_host_attrs *)(x)->shost_data)->max_npiv_vports) | 548 | (((struct fc_host_attrs *)(x)->shost_data)->max_npiv_vports) |
542 | #define fc_host_serial_number(x) \ | 549 | #define fc_host_serial_number(x) \ |
543 | (((struct fc_host_attrs *)(x)->shost_data)->serial_number) | 550 | (((struct fc_host_attrs *)(x)->shost_data)->serial_number) |
551 | #define fc_host_manufacturer(x) \ | ||
552 | (((struct fc_host_attrs *)(x)->shost_data)->manufacturer) | ||
553 | #define fc_host_model(x) \ | ||
554 | (((struct fc_host_attrs *)(x)->shost_data)->model) | ||
555 | #define fc_host_model_description(x) \ | ||
556 | (((struct fc_host_attrs *)(x)->shost_data)->model_description) | ||
557 | #define fc_host_hardware_version(x) \ | ||
558 | (((struct fc_host_attrs *)(x)->shost_data)->hardware_version) | ||
559 | #define fc_host_driver_version(x) \ | ||
560 | (((struct fc_host_attrs *)(x)->shost_data)->driver_version) | ||
561 | #define fc_host_firmware_version(x) \ | ||
562 | (((struct fc_host_attrs *)(x)->shost_data)->firmware_version) | ||
563 | #define fc_host_optionrom_version(x) \ | ||
564 | (((struct fc_host_attrs *)(x)->shost_data)->optionrom_version) | ||
544 | #define fc_host_port_id(x) \ | 565 | #define fc_host_port_id(x) \ |
545 | (((struct fc_host_attrs *)(x)->shost_data)->port_id) | 566 | (((struct fc_host_attrs *)(x)->shost_data)->port_id) |
546 | #define fc_host_port_type(x) \ | 567 | #define fc_host_port_type(x) \ |
@@ -700,6 +721,13 @@ struct fc_function_template { | |||
700 | unsigned long show_host_supported_speeds:1; | 721 | unsigned long show_host_supported_speeds:1; |
701 | unsigned long show_host_maxframe_size:1; | 722 | unsigned long show_host_maxframe_size:1; |
702 | unsigned long show_host_serial_number:1; | 723 | unsigned long show_host_serial_number:1; |
724 | unsigned long show_host_manufacturer:1; | ||
725 | unsigned long show_host_model:1; | ||
726 | unsigned long show_host_model_description:1; | ||
727 | unsigned long show_host_hardware_version:1; | ||
728 | unsigned long show_host_driver_version:1; | ||
729 | unsigned long show_host_firmware_version:1; | ||
730 | unsigned long show_host_optionrom_version:1; | ||
703 | /* host dynamic attributes */ | 731 | /* host dynamic attributes */ |
704 | unsigned long show_host_port_id:1; | 732 | unsigned long show_host_port_id:1; |
705 | unsigned long show_host_port_type:1; | 733 | unsigned long show_host_port_type:1; |
diff --git a/include/scsi/scsi_transport_iscsi.h b/include/scsi/scsi_transport_iscsi.h index 2c3a46d102fd..53f0b361d668 100644 --- a/include/scsi/scsi_transport_iscsi.h +++ b/include/scsi/scsi_transport_iscsi.h | |||
@@ -144,6 +144,12 @@ struct iscsi_transport { | |||
144 | int param, char *buf); | 144 | int param, char *buf); |
145 | umode_t (*attr_is_visible)(int param_type, int param); | 145 | umode_t (*attr_is_visible)(int param_type, int param); |
146 | int (*bsg_request)(struct bsg_job *job); | 146 | int (*bsg_request)(struct bsg_job *job); |
147 | int (*send_ping) (struct Scsi_Host *shost, uint32_t iface_num, | ||
148 | uint32_t iface_type, uint32_t payload_size, | ||
149 | uint32_t pid, struct sockaddr *dst_addr); | ||
150 | int (*get_chap) (struct Scsi_Host *shost, uint16_t chap_tbl_idx, | ||
151 | uint32_t *num_entries, char *buf); | ||
152 | int (*delete_chap) (struct Scsi_Host *shost, uint16_t chap_tbl_idx); | ||
147 | }; | 153 | }; |
148 | 154 | ||
149 | /* | 155 | /* |
@@ -166,6 +172,17 @@ extern int iscsi_offload_mesg(struct Scsi_Host *shost, | |||
166 | struct iscsi_transport *transport, uint32_t type, | 172 | struct iscsi_transport *transport, uint32_t type, |
167 | char *data, uint16_t data_size); | 173 | char *data, uint16_t data_size); |
168 | 174 | ||
175 | extern void iscsi_post_host_event(uint32_t host_no, | ||
176 | struct iscsi_transport *transport, | ||
177 | enum iscsi_host_event_code code, | ||
178 | uint32_t data_size, | ||
179 | uint8_t *data); | ||
180 | |||
181 | extern void iscsi_ping_comp_event(uint32_t host_no, | ||
182 | struct iscsi_transport *transport, | ||
183 | uint32_t status, uint32_t pid, | ||
184 | uint32_t data_size, uint8_t *data); | ||
185 | |||
169 | struct iscsi_cls_conn { | 186 | struct iscsi_cls_conn { |
170 | struct list_head conn_list; /* item in connlist */ | 187 | struct list_head conn_list; /* item in connlist */ |
171 | void *dd_data; /* LLD private data */ | 188 | void *dd_data; /* LLD private data */ |
@@ -238,6 +255,8 @@ struct iscsi_cls_host { | |||
238 | atomic_t nr_scans; | 255 | atomic_t nr_scans; |
239 | struct mutex mutex; | 256 | struct mutex mutex; |
240 | struct request_queue *bsg_q; | 257 | struct request_queue *bsg_q; |
258 | uint32_t port_speed; | ||
259 | uint32_t port_state; | ||
241 | }; | 260 | }; |
242 | 261 | ||
243 | #define iscsi_job_to_shost(_job) \ | 262 | #define iscsi_job_to_shost(_job) \ |
@@ -307,5 +326,8 @@ extern struct iscsi_iface *iscsi_create_iface(struct Scsi_Host *shost, | |||
307 | uint32_t iface_num, int dd_size); | 326 | uint32_t iface_num, int dd_size); |
308 | extern void iscsi_destroy_iface(struct iscsi_iface *iface); | 327 | extern void iscsi_destroy_iface(struct iscsi_iface *iface); |
309 | extern struct iscsi_iface *iscsi_lookup_iface(int handle); | 328 | extern struct iscsi_iface *iscsi_lookup_iface(int handle); |
329 | extern char *iscsi_get_port_speed_name(struct Scsi_Host *shost); | ||
330 | extern char *iscsi_get_port_state_name(struct Scsi_Host *shost); | ||
331 | extern int iscsi_is_session_dev(const struct device *dev); | ||
310 | 332 | ||
311 | #endif | 333 | #endif |
diff --git a/include/scsi/scsi_transport_sas.h b/include/scsi/scsi_transport_sas.h index ffeebc34a4f7..98b3a20a0102 100644 --- a/include/scsi/scsi_transport_sas.h +++ b/include/scsi/scsi_transport_sas.h | |||
@@ -75,7 +75,8 @@ struct sas_phy { | |||
75 | /* for the list of phys belonging to a port */ | 75 | /* for the list of phys belonging to a port */ |
76 | struct list_head port_siblings; | 76 | struct list_head port_siblings; |
77 | 77 | ||
78 | struct work_struct reset_work; | 78 | /* available to the lldd */ |
79 | void *hostdata; | ||
79 | }; | 80 | }; |
80 | 81 | ||
81 | #define dev_to_phy(d) \ | 82 | #define dev_to_phy(d) \ |
@@ -169,6 +170,8 @@ struct sas_function_template { | |||
169 | int (*get_bay_identifier)(struct sas_rphy *); | 170 | int (*get_bay_identifier)(struct sas_rphy *); |
170 | int (*phy_reset)(struct sas_phy *, int); | 171 | int (*phy_reset)(struct sas_phy *, int); |
171 | int (*phy_enable)(struct sas_phy *, int); | 172 | int (*phy_enable)(struct sas_phy *, int); |
173 | int (*phy_setup)(struct sas_phy *); | ||
174 | void (*phy_release)(struct sas_phy *); | ||
172 | int (*set_phy_speed)(struct sas_phy *, struct sas_phy_linkrates *); | 175 | int (*set_phy_speed)(struct sas_phy *, struct sas_phy_linkrates *); |
173 | int (*smp_handler)(struct Scsi_Host *, struct sas_rphy *, struct request *); | 176 | int (*smp_handler)(struct Scsi_Host *, struct sas_rphy *, struct request *); |
174 | }; | 177 | }; |
@@ -194,6 +197,7 @@ void sas_rphy_free(struct sas_rphy *); | |||
194 | extern int sas_rphy_add(struct sas_rphy *); | 197 | extern int sas_rphy_add(struct sas_rphy *); |
195 | extern void sas_rphy_remove(struct sas_rphy *); | 198 | extern void sas_rphy_remove(struct sas_rphy *); |
196 | extern void sas_rphy_delete(struct sas_rphy *); | 199 | extern void sas_rphy_delete(struct sas_rphy *); |
200 | extern void sas_rphy_unlink(struct sas_rphy *); | ||
197 | extern int scsi_is_sas_rphy(const struct device *); | 201 | extern int scsi_is_sas_rphy(const struct device *); |
198 | 202 | ||
199 | struct sas_port *sas_port_alloc(struct device *, int); | 203 | struct sas_port *sas_port_alloc(struct device *, int); |
@@ -205,6 +209,12 @@ void sas_port_add_phy(struct sas_port *, struct sas_phy *); | |||
205 | void sas_port_delete_phy(struct sas_port *, struct sas_phy *); | 209 | void sas_port_delete_phy(struct sas_port *, struct sas_phy *); |
206 | void sas_port_mark_backlink(struct sas_port *); | 210 | void sas_port_mark_backlink(struct sas_port *); |
207 | int scsi_is_sas_port(const struct device *); | 211 | int scsi_is_sas_port(const struct device *); |
212 | struct sas_phy *sas_port_get_phy(struct sas_port *port); | ||
213 | static inline void sas_port_put_phy(struct sas_phy *phy) | ||
214 | { | ||
215 | if (phy) | ||
216 | put_device(&phy->dev); | ||
217 | } | ||
208 | 218 | ||
209 | extern struct scsi_transport_template * | 219 | extern struct scsi_transport_template * |
210 | sas_attach_transport(struct sas_function_template *); | 220 | sas_attach_transport(struct sas_function_template *); |
diff --git a/include/sound/compress_params.h b/include/sound/compress_params.h index d97d69f81a7d..da4a456de032 100644 --- a/include/sound/compress_params.h +++ b/include/sound/compress_params.h | |||
@@ -51,6 +51,8 @@ | |||
51 | #ifndef __SND_COMPRESS_PARAMS_H | 51 | #ifndef __SND_COMPRESS_PARAMS_H |
52 | #define __SND_COMPRESS_PARAMS_H | 52 | #define __SND_COMPRESS_PARAMS_H |
53 | 53 | ||
54 | #include <linux/types.h> | ||
55 | |||
54 | /* AUDIO CODECS SUPPORTED */ | 56 | /* AUDIO CODECS SUPPORTED */ |
55 | #define MAX_NUM_CODECS 32 | 57 | #define MAX_NUM_CODECS 32 |
56 | #define MAX_NUM_CODEC_DESCRIPTORS 32 | 58 | #define MAX_NUM_CODEC_DESCRIPTORS 32 |
diff --git a/include/sound/control.h b/include/sound/control.h index b2796e83c7ac..8332e865c759 100644 --- a/include/sound/control.h +++ b/include/sound/control.h | |||
@@ -40,7 +40,7 @@ struct snd_kcontrol_new { | |||
40 | snd_ctl_elem_iface_t iface; /* interface identifier */ | 40 | snd_ctl_elem_iface_t iface; /* interface identifier */ |
41 | unsigned int device; /* device/client number */ | 41 | unsigned int device; /* device/client number */ |
42 | unsigned int subdevice; /* subdevice (substream) number */ | 42 | unsigned int subdevice; /* subdevice (substream) number */ |
43 | unsigned char *name; /* ASCII name of item */ | 43 | const unsigned char *name; /* ASCII name of item */ |
44 | unsigned int index; /* index of item */ | 44 | unsigned int index; /* index of item */ |
45 | unsigned int access; /* access rights */ | 45 | unsigned int access; /* access rights */ |
46 | unsigned int count; /* count of same elements */ | 46 | unsigned int count; /* count of same elements */ |
@@ -227,6 +227,11 @@ snd_ctl_add_slave_uncached(struct snd_kcontrol *master, | |||
227 | return _snd_ctl_add_slave(master, slave, SND_CTL_SLAVE_NEED_UPDATE); | 227 | return _snd_ctl_add_slave(master, slave, SND_CTL_SLAVE_NEED_UPDATE); |
228 | } | 228 | } |
229 | 229 | ||
230 | int snd_ctl_add_vmaster_hook(struct snd_kcontrol *kctl, | ||
231 | void (*hook)(void *private_data, int), | ||
232 | void *private_data); | ||
233 | void snd_ctl_sync_vmaster_hook(struct snd_kcontrol *kctl); | ||
234 | |||
230 | /* | 235 | /* |
231 | * Helper functions for jack-detection controls | 236 | * Helper functions for jack-detection controls |
232 | */ | 237 | */ |
diff --git a/include/sound/core.h b/include/sound/core.h index cea1b5426dfa..bc056687f647 100644 --- a/include/sound/core.h +++ b/include/sound/core.h | |||
@@ -26,7 +26,6 @@ | |||
26 | #include <linux/mutex.h> /* struct mutex */ | 26 | #include <linux/mutex.h> /* struct mutex */ |
27 | #include <linux/rwsem.h> /* struct rw_semaphore */ | 27 | #include <linux/rwsem.h> /* struct rw_semaphore */ |
28 | #include <linux/pm.h> /* pm_message_t */ | 28 | #include <linux/pm.h> /* pm_message_t */ |
29 | #include <linux/device.h> | ||
30 | #include <linux/stringify.h> | 29 | #include <linux/stringify.h> |
31 | 30 | ||
32 | /* number of supported soundcards */ | 31 | /* number of supported soundcards */ |
@@ -39,10 +38,10 @@ | |||
39 | #define CONFIG_SND_MAJOR 116 /* standard configuration */ | 38 | #define CONFIG_SND_MAJOR 116 /* standard configuration */ |
40 | 39 | ||
41 | /* forward declarations */ | 40 | /* forward declarations */ |
42 | #ifdef CONFIG_PCI | ||
43 | struct pci_dev; | 41 | struct pci_dev; |
44 | #endif | ||
45 | struct module; | 42 | struct module; |
43 | struct device; | ||
44 | struct device_attribute; | ||
46 | 45 | ||
47 | /* device allocation stuff */ | 46 | /* device allocation stuff */ |
48 | 47 | ||
@@ -326,6 +325,13 @@ void release_and_free_resource(struct resource *res); | |||
326 | 325 | ||
327 | /* --- */ | 326 | /* --- */ |
328 | 327 | ||
328 | /* sound printk debug levels */ | ||
329 | enum { | ||
330 | SND_PR_ALWAYS, | ||
331 | SND_PR_DEBUG, | ||
332 | SND_PR_VERBOSE, | ||
333 | }; | ||
334 | |||
329 | #if defined(CONFIG_SND_DEBUG) || defined(CONFIG_SND_VERBOSE_PRINTK) | 335 | #if defined(CONFIG_SND_DEBUG) || defined(CONFIG_SND_VERBOSE_PRINTK) |
330 | __printf(4, 5) | 336 | __printf(4, 5) |
331 | void __snd_printk(unsigned int level, const char *file, int line, | 337 | void __snd_printk(unsigned int level, const char *file, int line, |
@@ -355,6 +361,8 @@ void __snd_printk(unsigned int level, const char *file, int line, | |||
355 | */ | 361 | */ |
356 | #define snd_printd(fmt, args...) \ | 362 | #define snd_printd(fmt, args...) \ |
357 | __snd_printk(1, __FILE__, __LINE__, fmt, ##args) | 363 | __snd_printk(1, __FILE__, __LINE__, fmt, ##args) |
364 | #define _snd_printd(level, fmt, args...) \ | ||
365 | __snd_printk(level, __FILE__, __LINE__, fmt, ##args) | ||
358 | 366 | ||
359 | /** | 367 | /** |
360 | * snd_BUG - give a BUG warning message and stack trace | 368 | * snd_BUG - give a BUG warning message and stack trace |
@@ -384,6 +392,7 @@ void __snd_printk(unsigned int level, const char *file, int line, | |||
384 | #else /* !CONFIG_SND_DEBUG */ | 392 | #else /* !CONFIG_SND_DEBUG */ |
385 | 393 | ||
386 | #define snd_printd(fmt, args...) do { } while (0) | 394 | #define snd_printd(fmt, args...) do { } while (0) |
395 | #define _snd_printd(level, fmt, args...) do { } while (0) | ||
387 | #define snd_BUG() do { } while (0) | 396 | #define snd_BUG() do { } while (0) |
388 | static inline int __snd_bug_on(int cond) | 397 | static inline int __snd_bug_on(int cond) |
389 | { | 398 | { |
diff --git a/include/sound/dmaengine_pcm.h b/include/sound/dmaengine_pcm.h new file mode 100644 index 000000000000..a8fcaa6d531f --- /dev/null +++ b/include/sound/dmaengine_pcm.h | |||
@@ -0,0 +1,49 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2012, Analog Devices Inc. | ||
3 | * Author: Lars-Peter Clausen <lars@metafoo.de> | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or modify it | ||
6 | * under the terms of the GNU General Public License as published by the | ||
7 | * Free Software Foundation; either version 2 of the License, or (at your | ||
8 | * option) any later version. | ||
9 | * | ||
10 | * You should have received a copy of the GNU General Public License along | ||
11 | * with this program; if not, write to the Free Software Foundation, Inc., | ||
12 | * 675 Mass Ave, Cambridge, MA 02139, USA. | ||
13 | * | ||
14 | */ | ||
15 | #ifndef __SOUND_DMAENGINE_PCM_H__ | ||
16 | #define __SOUND_DMAENGINE_PCM_H__ | ||
17 | |||
18 | #include <sound/pcm.h> | ||
19 | #include <linux/dmaengine.h> | ||
20 | |||
21 | /** | ||
22 | * snd_pcm_substream_to_dma_direction - Get dma_transfer_direction for a PCM | ||
23 | * substream | ||
24 | * @substream: PCM substream | ||
25 | */ | ||
26 | static inline enum dma_transfer_direction | ||
27 | snd_pcm_substream_to_dma_direction(const struct snd_pcm_substream *substream) | ||
28 | { | ||
29 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) | ||
30 | return DMA_MEM_TO_DEV; | ||
31 | else | ||
32 | return DMA_DEV_TO_MEM; | ||
33 | } | ||
34 | |||
35 | void snd_dmaengine_pcm_set_data(struct snd_pcm_substream *substream, void *data); | ||
36 | void *snd_dmaengine_pcm_get_data(struct snd_pcm_substream *substream); | ||
37 | |||
38 | int snd_hwparams_to_dma_slave_config(const struct snd_pcm_substream *substream, | ||
39 | const struct snd_pcm_hw_params *params, struct dma_slave_config *slave_config); | ||
40 | int snd_dmaengine_pcm_trigger(struct snd_pcm_substream *substream, int cmd); | ||
41 | snd_pcm_uframes_t snd_dmaengine_pcm_pointer(struct snd_pcm_substream *substream); | ||
42 | |||
43 | int snd_dmaengine_pcm_open(struct snd_pcm_substream *substream, | ||
44 | dma_filter_fn filter_fn, void *filter_data); | ||
45 | int snd_dmaengine_pcm_close(struct snd_pcm_substream *substream); | ||
46 | |||
47 | struct dma_chan *snd_dmaengine_pcm_get_chan(struct snd_pcm_substream *substream); | ||
48 | |||
49 | #endif | ||
diff --git a/include/sound/jack.h b/include/sound/jack.h index 63c790742db4..58916573db58 100644 --- a/include/sound/jack.h +++ b/include/sound/jack.h | |||
@@ -53,6 +53,9 @@ enum snd_jack_types { | |||
53 | SND_JACK_BTN_5 = 0x0200, | 53 | SND_JACK_BTN_5 = 0x0200, |
54 | }; | 54 | }; |
55 | 55 | ||
56 | /* Keep in sync with definitions above */ | ||
57 | #define SND_JACK_SWITCH_TYPES 6 | ||
58 | |||
56 | struct snd_jack { | 59 | struct snd_jack { |
57 | struct input_dev *input_dev; | 60 | struct input_dev *input_dev; |
58 | int registered; | 61 | int registered; |
diff --git a/include/sound/max9768.h b/include/sound/max9768.h new file mode 100644 index 000000000000..0f78b41d030e --- /dev/null +++ b/include/sound/max9768.h | |||
@@ -0,0 +1,24 @@ | |||
1 | /* | ||
2 | * Platform data for MAX9768 | ||
3 | * Copyright (C) 2011, 2012 by Wolfram Sang, Pengutronix e.K. | ||
4 | * same licence as the driver | ||
5 | */ | ||
6 | |||
7 | #ifndef __SOUND_MAX9768_PDATA_H__ | ||
8 | #define __SOUND_MAX9768_PDATA_H__ | ||
9 | |||
10 | /** | ||
11 | * struct max9768_pdata - optional platform specific MAX9768 configuration | ||
12 | * @shdn_gpio: GPIO to SHDN pin. If not valid, pin must be hardwired HIGH | ||
13 | * @mute_gpio: GPIO to MUTE pin. If not valid, control for mute won't be added | ||
14 | * @flags: configuration flags, e.g. set classic PWM mode (check datasheet | ||
15 | * regarding "filterless modulation" which is default). | ||
16 | */ | ||
17 | struct max9768_pdata { | ||
18 | int shdn_gpio; | ||
19 | int mute_gpio; | ||
20 | unsigned flags; | ||
21 | #define MAX9768_FLAG_CLASSIC_PWM (1 << 0) | ||
22 | }; | ||
23 | |||
24 | #endif /* __SOUND_MAX9768_PDATA_H__*/ | ||
diff --git a/include/sound/pcm.h b/include/sound/pcm.h index 0cf91b2f08ca..0d1112815be3 100644 --- a/include/sound/pcm.h +++ b/include/sound/pcm.h | |||
@@ -264,7 +264,7 @@ struct snd_pcm_hw_constraint_ratdens { | |||
264 | 264 | ||
265 | struct snd_pcm_hw_constraint_list { | 265 | struct snd_pcm_hw_constraint_list { |
266 | unsigned int count; | 266 | unsigned int count; |
267 | unsigned int *list; | 267 | const unsigned int *list; |
268 | unsigned int mask; | 268 | unsigned int mask; |
269 | }; | 269 | }; |
270 | 270 | ||
@@ -454,6 +454,7 @@ struct snd_pcm { | |||
454 | void *private_data; | 454 | void *private_data; |
455 | void (*private_free) (struct snd_pcm *pcm); | 455 | void (*private_free) (struct snd_pcm *pcm); |
456 | struct device *dev; /* actual hw device this belongs to */ | 456 | struct device *dev; /* actual hw device this belongs to */ |
457 | bool internal; /* pcm is for internal use only */ | ||
457 | #if defined(CONFIG_SND_PCM_OSS) || defined(CONFIG_SND_PCM_OSS_MODULE) | 458 | #if defined(CONFIG_SND_PCM_OSS) || defined(CONFIG_SND_PCM_OSS_MODULE) |
458 | struct snd_pcm_oss oss; | 459 | struct snd_pcm_oss oss; |
459 | #endif | 460 | #endif |
@@ -475,6 +476,9 @@ extern const struct file_operations snd_pcm_f_ops[2]; | |||
475 | int snd_pcm_new(struct snd_card *card, const char *id, int device, | 476 | int snd_pcm_new(struct snd_card *card, const char *id, int device, |
476 | int playback_count, int capture_count, | 477 | int playback_count, int capture_count, |
477 | struct snd_pcm **rpcm); | 478 | struct snd_pcm **rpcm); |
479 | int snd_pcm_new_internal(struct snd_card *card, const char *id, int device, | ||
480 | int playback_count, int capture_count, | ||
481 | struct snd_pcm **rpcm); | ||
478 | int snd_pcm_new_stream(struct snd_pcm *pcm, int stream, int substream_count); | 482 | int snd_pcm_new_stream(struct snd_pcm *pcm, int stream, int substream_count); |
479 | 483 | ||
480 | int snd_pcm_notify(struct snd_pcm_notify *notify, int nfree); | 484 | int snd_pcm_notify(struct snd_pcm_notify *notify, int nfree); |
@@ -781,7 +785,8 @@ void snd_interval_muldivk(const struct snd_interval *a, const struct snd_interva | |||
781 | unsigned int k, struct snd_interval *c); | 785 | unsigned int k, struct snd_interval *c); |
782 | void snd_interval_mulkdiv(const struct snd_interval *a, unsigned int k, | 786 | void snd_interval_mulkdiv(const struct snd_interval *a, unsigned int k, |
783 | const struct snd_interval *b, struct snd_interval *c); | 787 | const struct snd_interval *b, struct snd_interval *c); |
784 | int snd_interval_list(struct snd_interval *i, unsigned int count, unsigned int *list, unsigned int mask); | 788 | int snd_interval_list(struct snd_interval *i, unsigned int count, |
789 | const unsigned int *list, unsigned int mask); | ||
785 | int snd_interval_ratnum(struct snd_interval *i, | 790 | int snd_interval_ratnum(struct snd_interval *i, |
786 | unsigned int rats_count, struct snd_ratnum *rats, | 791 | unsigned int rats_count, struct snd_ratnum *rats, |
787 | unsigned int *nump, unsigned int *denp); | 792 | unsigned int *nump, unsigned int *denp); |
diff --git a/include/sound/sh_fsi.h b/include/sound/sh_fsi.h index 9b1aacaa82fe..b457e87fbd08 100644 --- a/include/sound/sh_fsi.h +++ b/include/sound/sh_fsi.h | |||
@@ -72,10 +72,16 @@ | |||
72 | #define SH_FSI_BPFMD_32 (5 << 4) | 72 | #define SH_FSI_BPFMD_32 (5 << 4) |
73 | #define SH_FSI_BPFMD_16 (6 << 4) | 73 | #define SH_FSI_BPFMD_16 (6 << 4) |
74 | 74 | ||
75 | struct sh_fsi_port_info { | ||
76 | unsigned long flags; | ||
77 | int tx_id; | ||
78 | int rx_id; | ||
79 | int (*set_rate)(struct device *dev, int rate, int enable); | ||
80 | }; | ||
81 | |||
75 | struct sh_fsi_platform_info { | 82 | struct sh_fsi_platform_info { |
76 | unsigned long porta_flags; | 83 | struct sh_fsi_port_info port_a; |
77 | unsigned long portb_flags; | 84 | struct sh_fsi_port_info port_b; |
78 | int (*set_rate)(struct device *dev, int is_porta, int rate, int enable); | ||
79 | }; | 85 | }; |
80 | 86 | ||
81 | /* | 87 | /* |
diff --git a/include/sound/soc-dai.h b/include/sound/soc-dai.h index 2413acc54883..c429f248cf4e 100644 --- a/include/sound/soc-dai.h +++ b/include/sound/soc-dai.h | |||
@@ -17,6 +17,7 @@ | |||
17 | #include <linux/list.h> | 17 | #include <linux/list.h> |
18 | 18 | ||
19 | struct snd_pcm_substream; | 19 | struct snd_pcm_substream; |
20 | struct snd_soc_dapm_widget; | ||
20 | 21 | ||
21 | /* | 22 | /* |
22 | * DAI hardware audio formats. | 23 | * DAI hardware audio formats. |
@@ -238,6 +239,9 @@ struct snd_soc_dai { | |||
238 | unsigned char pop_wait:1; | 239 | unsigned char pop_wait:1; |
239 | unsigned char probed:1; | 240 | unsigned char probed:1; |
240 | 241 | ||
242 | struct snd_soc_dapm_widget *playback_widget; | ||
243 | struct snd_soc_dapm_widget *capture_widget; | ||
244 | |||
241 | /* DAI DMA data */ | 245 | /* DAI DMA data */ |
242 | void *playback_dma_data; | 246 | void *playback_dma_data; |
243 | void *capture_dma_data; | 247 | void *capture_dma_data; |
@@ -246,10 +250,9 @@ struct snd_soc_dai { | |||
246 | unsigned int rate; | 250 | unsigned int rate; |
247 | 251 | ||
248 | /* parent platform/codec */ | 252 | /* parent platform/codec */ |
249 | union { | 253 | struct snd_soc_platform *platform; |
250 | struct snd_soc_platform *platform; | 254 | struct snd_soc_codec *codec; |
251 | struct snd_soc_codec *codec; | 255 | |
252 | }; | ||
253 | struct snd_soc_card *card; | 256 | struct snd_soc_card *card; |
254 | 257 | ||
255 | struct list_head list; | 258 | struct list_head list; |
diff --git a/include/sound/soc-dapm.h b/include/sound/soc-dapm.h index d26a9b784772..8da3c2409060 100644 --- a/include/sound/soc-dapm.h +++ b/include/sound/soc-dapm.h | |||
@@ -13,10 +13,11 @@ | |||
13 | #ifndef __LINUX_SND_SOC_DAPM_H | 13 | #ifndef __LINUX_SND_SOC_DAPM_H |
14 | #define __LINUX_SND_SOC_DAPM_H | 14 | #define __LINUX_SND_SOC_DAPM_H |
15 | 15 | ||
16 | #include <linux/device.h> | ||
17 | #include <linux/types.h> | 16 | #include <linux/types.h> |
18 | #include <sound/control.h> | 17 | #include <sound/control.h> |
19 | 18 | ||
19 | struct device; | ||
20 | |||
20 | /* widget has no PM register bit */ | 21 | /* widget has no PM register bit */ |
21 | #define SND_SOC_NOPM -1 | 22 | #define SND_SOC_NOPM -1 |
22 | 23 | ||
@@ -243,6 +244,10 @@ | |||
243 | { .id = snd_soc_dapm_supply, .name = wname, .reg = wreg, \ | 244 | { .id = snd_soc_dapm_supply, .name = wname, .reg = wreg, \ |
244 | .shift = wshift, .invert = winvert, .event = wevent, \ | 245 | .shift = wshift, .invert = winvert, .event = wevent, \ |
245 | .event_flags = wflags} | 246 | .event_flags = wflags} |
247 | #define SND_SOC_DAPM_REGULATOR_SUPPLY(wname, wdelay) \ | ||
248 | { .id = snd_soc_dapm_regulator_supply, .name = wname, \ | ||
249 | .reg = SND_SOC_NOPM, .shift = wdelay, .event = dapm_regulator_event, \ | ||
250 | .event_flags = SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD } | ||
246 | 251 | ||
247 | /* dapm kcontrol types */ | 252 | /* dapm kcontrol types */ |
248 | #define SOC_DAPM_SINGLE(xname, reg, shift, max, invert) \ | 253 | #define SOC_DAPM_SINGLE(xname, reg, shift, max, invert) \ |
@@ -322,6 +327,8 @@ struct snd_soc_dapm_context; | |||
322 | 327 | ||
323 | int dapm_reg_event(struct snd_soc_dapm_widget *w, | 328 | int dapm_reg_event(struct snd_soc_dapm_widget *w, |
324 | struct snd_kcontrol *kcontrol, int event); | 329 | struct snd_kcontrol *kcontrol, int event); |
330 | int dapm_regulator_event(struct snd_soc_dapm_widget *w, | ||
331 | struct snd_kcontrol *kcontrol, int event); | ||
325 | 332 | ||
326 | /* dapm controls */ | 333 | /* dapm controls */ |
327 | int snd_soc_dapm_put_volsw(struct snd_kcontrol *kcontrol, | 334 | int snd_soc_dapm_put_volsw(struct snd_kcontrol *kcontrol, |
@@ -346,11 +353,12 @@ int snd_soc_dapm_get_pin_switch(struct snd_kcontrol *kcontrol, | |||
346 | struct snd_ctl_elem_value *uncontrol); | 353 | struct snd_ctl_elem_value *uncontrol); |
347 | int snd_soc_dapm_put_pin_switch(struct snd_kcontrol *kcontrol, | 354 | int snd_soc_dapm_put_pin_switch(struct snd_kcontrol *kcontrol, |
348 | struct snd_ctl_elem_value *uncontrol); | 355 | struct snd_ctl_elem_value *uncontrol); |
349 | int snd_soc_dapm_new_control(struct snd_soc_dapm_context *dapm, | ||
350 | const struct snd_soc_dapm_widget *widget); | ||
351 | int snd_soc_dapm_new_controls(struct snd_soc_dapm_context *dapm, | 356 | int snd_soc_dapm_new_controls(struct snd_soc_dapm_context *dapm, |
352 | const struct snd_soc_dapm_widget *widget, | 357 | const struct snd_soc_dapm_widget *widget, |
353 | int num); | 358 | int num); |
359 | int snd_soc_dapm_new_dai_widgets(struct snd_soc_dapm_context *dapm, | ||
360 | struct snd_soc_dai *dai); | ||
361 | int snd_soc_dapm_link_dai_widgets(struct snd_soc_card *card); | ||
354 | 362 | ||
355 | /* dapm path setup */ | 363 | /* dapm path setup */ |
356 | int snd_soc_dapm_new_widgets(struct snd_soc_dapm_context *dapm); | 364 | int snd_soc_dapm_new_widgets(struct snd_soc_dapm_context *dapm); |
@@ -361,10 +369,16 @@ int snd_soc_dapm_weak_routes(struct snd_soc_dapm_context *dapm, | |||
361 | const struct snd_soc_dapm_route *route, int num); | 369 | const struct snd_soc_dapm_route *route, int num); |
362 | 370 | ||
363 | /* dapm events */ | 371 | /* dapm events */ |
364 | int snd_soc_dapm_stream_event(struct snd_soc_pcm_runtime *rtd, | 372 | int snd_soc_dapm_stream_event(struct snd_soc_pcm_runtime *rtd, int stream, |
365 | const char *stream, int event); | 373 | struct snd_soc_dai *dai, int event); |
366 | void snd_soc_dapm_shutdown(struct snd_soc_card *card); | 374 | void snd_soc_dapm_shutdown(struct snd_soc_card *card); |
367 | 375 | ||
376 | /* external DAPM widget events */ | ||
377 | int snd_soc_dapm_mixer_update_power(struct snd_soc_dapm_widget *widget, | ||
378 | struct snd_kcontrol *kcontrol, int connect); | ||
379 | int snd_soc_dapm_mux_update_power(struct snd_soc_dapm_widget *widget, | ||
380 | struct snd_kcontrol *kcontrol, int mux, struct soc_enum *e); | ||
381 | |||
368 | /* dapm sys fs - used by the core */ | 382 | /* dapm sys fs - used by the core */ |
369 | int snd_soc_dapm_sys_add(struct device *dev); | 383 | int snd_soc_dapm_sys_add(struct device *dev); |
370 | void snd_soc_dapm_debugfs_init(struct snd_soc_dapm_context *dapm, | 384 | void snd_soc_dapm_debugfs_init(struct snd_soc_dapm_context *dapm, |
@@ -411,9 +425,11 @@ enum snd_soc_dapm_type { | |||
411 | snd_soc_dapm_pre, /* machine specific pre widget - exec first */ | 425 | snd_soc_dapm_pre, /* machine specific pre widget - exec first */ |
412 | snd_soc_dapm_post, /* machine specific post widget - exec last */ | 426 | snd_soc_dapm_post, /* machine specific post widget - exec last */ |
413 | snd_soc_dapm_supply, /* power/clock supply */ | 427 | snd_soc_dapm_supply, /* power/clock supply */ |
428 | snd_soc_dapm_regulator_supply, /* external regulator */ | ||
414 | snd_soc_dapm_aif_in, /* audio interface input */ | 429 | snd_soc_dapm_aif_in, /* audio interface input */ |
415 | snd_soc_dapm_aif_out, /* audio interface output */ | 430 | snd_soc_dapm_aif_out, /* audio interface output */ |
416 | snd_soc_dapm_siggen, /* signal generator */ | 431 | snd_soc_dapm_siggen, /* signal generator */ |
432 | snd_soc_dapm_dai, /* link to DAI structure */ | ||
417 | }; | 433 | }; |
418 | 434 | ||
419 | /* | 435 | /* |
@@ -434,8 +450,8 @@ struct snd_soc_dapm_route { | |||
434 | 450 | ||
435 | /* dapm audio path between two widgets */ | 451 | /* dapm audio path between two widgets */ |
436 | struct snd_soc_dapm_path { | 452 | struct snd_soc_dapm_path { |
437 | char *name; | 453 | const char *name; |
438 | char *long_name; | 454 | const char *long_name; |
439 | 455 | ||
440 | /* source (input) and sink (output) widgets */ | 456 | /* source (input) and sink (output) widgets */ |
441 | struct snd_soc_dapm_widget *source; | 457 | struct snd_soc_dapm_widget *source; |
@@ -458,13 +474,15 @@ struct snd_soc_dapm_path { | |||
458 | /* dapm widget */ | 474 | /* dapm widget */ |
459 | struct snd_soc_dapm_widget { | 475 | struct snd_soc_dapm_widget { |
460 | enum snd_soc_dapm_type id; | 476 | enum snd_soc_dapm_type id; |
461 | char *name; /* widget name */ | 477 | const char *name; /* widget name */ |
462 | char *sname; /* stream name */ | 478 | const char *sname; /* stream name */ |
463 | struct snd_soc_codec *codec; | 479 | struct snd_soc_codec *codec; |
464 | struct snd_soc_platform *platform; | 480 | struct snd_soc_platform *platform; |
465 | struct list_head list; | 481 | struct list_head list; |
466 | struct snd_soc_dapm_context *dapm; | 482 | struct snd_soc_dapm_context *dapm; |
467 | 483 | ||
484 | void *priv; /* widget specific data */ | ||
485 | |||
468 | /* dapm control */ | 486 | /* dapm control */ |
469 | short reg; /* negative reg = no direct dapm */ | 487 | short reg; /* negative reg = no direct dapm */ |
470 | unsigned char shift; /* bits to shift */ | 488 | unsigned char shift; /* bits to shift */ |
diff --git a/include/sound/soc.h b/include/sound/soc.h index 0992dff55959..2ebf7877c148 100644 --- a/include/sound/soc.h +++ b/include/sound/soc.h | |||
@@ -185,6 +185,20 @@ | |||
185 | .rreg = xreg_right, .shift = xshift, \ | 185 | .rreg = xreg_right, .shift = xshift, \ |
186 | .min = xmin, .max = xmax} } | 186 | .min = xmin, .max = xmax} } |
187 | 187 | ||
188 | #define SND_SOC_BYTES(xname, xbase, xregs) \ | ||
189 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \ | ||
190 | .info = snd_soc_bytes_info, .get = snd_soc_bytes_get, \ | ||
191 | .put = snd_soc_bytes_put, .private_value = \ | ||
192 | ((unsigned long)&(struct soc_bytes) \ | ||
193 | {.base = xbase, .num_regs = xregs }) } | ||
194 | |||
195 | #define SND_SOC_BYTES_MASK(xname, xbase, xregs, xmask) \ | ||
196 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \ | ||
197 | .info = snd_soc_bytes_info, .get = snd_soc_bytes_get, \ | ||
198 | .put = snd_soc_bytes_put, .private_value = \ | ||
199 | ((unsigned long)&(struct soc_bytes) \ | ||
200 | {.base = xbase, .num_regs = xregs, \ | ||
201 | .mask = xmask }) } | ||
188 | 202 | ||
189 | /* | 203 | /* |
190 | * Simplified versions of above macros, declaring a struct and calculating | 204 | * Simplified versions of above macros, declaring a struct and calculating |
@@ -366,12 +380,16 @@ void snd_soc_free_ac97_codec(struct snd_soc_codec *codec); | |||
366 | *Controls | 380 | *Controls |
367 | */ | 381 | */ |
368 | struct snd_kcontrol *snd_soc_cnew(const struct snd_kcontrol_new *_template, | 382 | struct snd_kcontrol *snd_soc_cnew(const struct snd_kcontrol_new *_template, |
369 | void *data, char *long_name, | 383 | void *data, const char *long_name, |
370 | const char *prefix); | 384 | const char *prefix); |
371 | int snd_soc_add_controls(struct snd_soc_codec *codec, | 385 | int snd_soc_add_codec_controls(struct snd_soc_codec *codec, |
372 | const struct snd_kcontrol_new *controls, int num_controls); | 386 | const struct snd_kcontrol_new *controls, int num_controls); |
373 | int snd_soc_add_platform_controls(struct snd_soc_platform *platform, | 387 | int snd_soc_add_platform_controls(struct snd_soc_platform *platform, |
374 | const struct snd_kcontrol_new *controls, int num_controls); | 388 | const struct snd_kcontrol_new *controls, int num_controls); |
389 | int snd_soc_add_card_controls(struct snd_soc_card *soc_card, | ||
390 | const struct snd_kcontrol_new *controls, int num_controls); | ||
391 | int snd_soc_add_dai_controls(struct snd_soc_dai *dai, | ||
392 | const struct snd_kcontrol_new *controls, int num_controls); | ||
375 | int snd_soc_info_enum_double(struct snd_kcontrol *kcontrol, | 393 | int snd_soc_info_enum_double(struct snd_kcontrol *kcontrol, |
376 | struct snd_ctl_elem_info *uinfo); | 394 | struct snd_ctl_elem_info *uinfo); |
377 | int snd_soc_info_enum_ext(struct snd_kcontrol *kcontrol, | 395 | int snd_soc_info_enum_ext(struct snd_kcontrol *kcontrol, |
@@ -409,6 +427,13 @@ int snd_soc_get_volsw_2r_sx(struct snd_kcontrol *kcontrol, | |||
409 | struct snd_ctl_elem_value *ucontrol); | 427 | struct snd_ctl_elem_value *ucontrol); |
410 | int snd_soc_put_volsw_2r_sx(struct snd_kcontrol *kcontrol, | 428 | int snd_soc_put_volsw_2r_sx(struct snd_kcontrol *kcontrol, |
411 | struct snd_ctl_elem_value *ucontrol); | 429 | struct snd_ctl_elem_value *ucontrol); |
430 | int snd_soc_bytes_info(struct snd_kcontrol *kcontrol, | ||
431 | struct snd_ctl_elem_info *uinfo); | ||
432 | int snd_soc_bytes_get(struct snd_kcontrol *kcontrol, | ||
433 | struct snd_ctl_elem_value *ucontrol); | ||
434 | int snd_soc_bytes_put(struct snd_kcontrol *kcontrol, | ||
435 | struct snd_ctl_elem_value *ucontrol); | ||
436 | |||
412 | 437 | ||
413 | /** | 438 | /** |
414 | * struct snd_soc_reg_access - Describes whether a given register is | 439 | * struct snd_soc_reg_access - Describes whether a given register is |
@@ -505,6 +530,7 @@ struct snd_soc_pcm_stream { | |||
505 | unsigned int rate_max; /* max rate */ | 530 | unsigned int rate_max; /* max rate */ |
506 | unsigned int channels_min; /* min channels */ | 531 | unsigned int channels_min; /* min channels */ |
507 | unsigned int channels_max; /* max channels */ | 532 | unsigned int channels_max; /* max channels */ |
533 | unsigned int sig_bits; /* number of bits of content */ | ||
508 | }; | 534 | }; |
509 | 535 | ||
510 | /* SoC audio ops */ | 536 | /* SoC audio ops */ |
@@ -559,6 +585,7 @@ struct snd_soc_codec { | |||
559 | unsigned int ac97_created:1; /* Codec has been created by SoC */ | 585 | unsigned int ac97_created:1; /* Codec has been created by SoC */ |
560 | unsigned int sysfs_registered:1; /* codec has been sysfs registered */ | 586 | unsigned int sysfs_registered:1; /* codec has been sysfs registered */ |
561 | unsigned int cache_init:1; /* codec cache has been initialized */ | 587 | unsigned int cache_init:1; /* codec cache has been initialized */ |
588 | unsigned int using_regmap:1; /* using regmap access */ | ||
562 | u32 cache_only; /* Suppress writes to hardware */ | 589 | u32 cache_only; /* Suppress writes to hardware */ |
563 | u32 cache_sync; /* Cache needs to be synced to hardware */ | 590 | u32 cache_sync; /* Cache needs to be synced to hardware */ |
564 | 591 | ||
@@ -637,6 +664,8 @@ struct snd_soc_codec_driver { | |||
637 | /* codec stream completion event */ | 664 | /* codec stream completion event */ |
638 | int (*stream_event)(struct snd_soc_dapm_context *dapm, int event); | 665 | int (*stream_event)(struct snd_soc_dapm_context *dapm, int event); |
639 | 666 | ||
667 | bool ignore_pmdown_time; /* Doesn't benefit from pmdown delay */ | ||
668 | |||
640 | /* probe ordering - for components with runtime dependencies */ | 669 | /* probe ordering - for components with runtime dependencies */ |
641 | int probe_order; | 670 | int probe_order; |
642 | int remove_order; | 671 | int remove_order; |
@@ -689,6 +718,7 @@ struct snd_soc_platform { | |||
689 | int id; | 718 | int id; |
690 | struct device *dev; | 719 | struct device *dev; |
691 | struct snd_soc_platform_driver *driver; | 720 | struct snd_soc_platform_driver *driver; |
721 | struct mutex mutex; | ||
692 | 722 | ||
693 | unsigned int suspended:1; /* platform is suspended */ | 723 | unsigned int suspended:1; /* platform is suspended */ |
694 | unsigned int probed:1; | 724 | unsigned int probed:1; |
@@ -698,6 +728,11 @@ struct snd_soc_platform { | |||
698 | struct list_head card_list; | 728 | struct list_head card_list; |
699 | 729 | ||
700 | struct snd_soc_dapm_context dapm; | 730 | struct snd_soc_dapm_context dapm; |
731 | |||
732 | #ifdef CONFIG_DEBUG_FS | ||
733 | struct dentry *debugfs_platform_root; | ||
734 | struct dentry *debugfs_dapm; | ||
735 | #endif | ||
701 | }; | 736 | }; |
702 | 737 | ||
703 | struct snd_soc_dai_link { | 738 | struct snd_soc_dai_link { |
@@ -875,6 +910,12 @@ struct soc_mixer_control { | |||
875 | unsigned int reg, rreg, shift, rshift, invert; | 910 | unsigned int reg, rreg, shift, rshift, invert; |
876 | }; | 911 | }; |
877 | 912 | ||
913 | struct soc_bytes { | ||
914 | int base; | ||
915 | int num_regs; | ||
916 | u32 mask; | ||
917 | }; | ||
918 | |||
878 | /* enumerated kcontrol */ | 919 | /* enumerated kcontrol */ |
879 | struct soc_enum { | 920 | struct soc_enum { |
880 | unsigned short reg; | 921 | unsigned short reg; |
diff --git a/include/sound/tea575x-tuner.h b/include/sound/tea575x-tuner.h index 726e94742a5c..ec3f910aa40b 100644 --- a/include/sound/tea575x-tuner.h +++ b/include/sound/tea575x-tuner.h | |||
@@ -25,6 +25,7 @@ | |||
25 | #include <linux/videodev2.h> | 25 | #include <linux/videodev2.h> |
26 | #include <media/v4l2-ctrls.h> | 26 | #include <media/v4l2-ctrls.h> |
27 | #include <media/v4l2-dev.h> | 27 | #include <media/v4l2-dev.h> |
28 | #include <media/v4l2-device.h> | ||
28 | 29 | ||
29 | #define TEA575X_FMIF 10700 | 30 | #define TEA575X_FMIF 10700 |
30 | 31 | ||
@@ -42,13 +43,16 @@ struct snd_tea575x_ops { | |||
42 | }; | 43 | }; |
43 | 44 | ||
44 | struct snd_tea575x { | 45 | struct snd_tea575x { |
46 | struct v4l2_device *v4l2_dev; | ||
45 | struct video_device vd; /* video device */ | 47 | struct video_device vd; /* video device */ |
48 | int radio_nr; /* radio_nr */ | ||
46 | bool tea5759; /* 5759 chip is present */ | 49 | bool tea5759; /* 5759 chip is present */ |
50 | bool cannot_read_data; /* Device cannot read the data pin */ | ||
47 | bool mute; /* Device is muted? */ | 51 | bool mute; /* Device is muted? */ |
48 | bool stereo; /* receiving stereo */ | 52 | bool stereo; /* receiving stereo */ |
49 | bool tuned; /* tuned to a station */ | 53 | bool tuned; /* tuned to a station */ |
50 | unsigned int val; /* hw value */ | 54 | unsigned int val; /* hw value */ |
51 | unsigned long freq; /* frequency */ | 55 | u32 freq; /* frequency */ |
52 | struct mutex mutex; | 56 | struct mutex mutex; |
53 | struct snd_tea575x_ops *ops; | 57 | struct snd_tea575x_ops *ops; |
54 | void *private_data; | 58 | void *private_data; |
diff --git a/include/sound/version.h b/include/sound/version.h index 8fc5321e1ecc..cc75024c1089 100644 --- a/include/sound/version.h +++ b/include/sound/version.h | |||
@@ -1,3 +1,3 @@ | |||
1 | /* include/version.h */ | 1 | /* include/version.h */ |
2 | #define CONFIG_SND_VERSION "1.0.24" | 2 | #define CONFIG_SND_VERSION "1.0.25" |
3 | #define CONFIG_SND_DATE "" | 3 | #define CONFIG_SND_DATE "" |
diff --git a/include/sound/wm2200.h b/include/sound/wm2200.h new file mode 100644 index 000000000000..79bf55be7ffa --- /dev/null +++ b/include/sound/wm2200.h | |||
@@ -0,0 +1,41 @@ | |||
1 | /* | ||
2 | * linux/sound/wm2200.h -- Platform data for WM2200 | ||
3 | * | ||
4 | * Copyright 2012 Wolfson Microelectronics. PLC. | ||
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 | |||
11 | #ifndef __LINUX_SND_WM2200_H | ||
12 | #define __LINUX_SND_WM2200_H | ||
13 | |||
14 | #define WM2200_GPIO_SET 0x10000 | ||
15 | |||
16 | enum wm2200_in_mode { | ||
17 | WM2200_IN_SE = 0, | ||
18 | WM2200_IN_DIFF = 1, | ||
19 | WM2200_IN_DMIC = 2, | ||
20 | }; | ||
21 | |||
22 | enum wm2200_dmic_sup { | ||
23 | WM2200_DMIC_SUP_MICVDD = 0, | ||
24 | WM2200_DMIC_SUP_MICBIAS1 = 1, | ||
25 | WM2200_DMIC_SUP_MICBIAS2 = 2, | ||
26 | }; | ||
27 | |||
28 | struct wm2200_pdata { | ||
29 | int reset; /** GPIO controlling /RESET, if any */ | ||
30 | int ldo_ena; /** GPIO controlling LODENA, if any */ | ||
31 | int irq_flags; | ||
32 | |||
33 | int gpio_defaults[4]; | ||
34 | |||
35 | enum wm2200_in_mode in_mode[3]; | ||
36 | enum wm2200_dmic_sup dmic_sup[3]; | ||
37 | |||
38 | int micbias_cfg[2]; /** Register value to configure MICBIAS */ | ||
39 | }; | ||
40 | |||
41 | #endif | ||
diff --git a/include/sound/wm8962.h b/include/sound/wm8962.h index 1750bed7c2f6..79e6d427b858 100644 --- a/include/sound/wm8962.h +++ b/include/sound/wm8962.h | |||
@@ -49,6 +49,12 @@ struct wm8962_pdata { | |||
49 | bool irq_active_low; | 49 | bool irq_active_low; |
50 | 50 | ||
51 | bool spk_mono; /* Speaker outputs tied together as mono */ | 51 | bool spk_mono; /* Speaker outputs tied together as mono */ |
52 | |||
53 | /** | ||
54 | * This flag should be set if one or both IN4 inputs is wired | ||
55 | * in a DC measurement configuration. | ||
56 | */ | ||
57 | bool in4_dc_measure; | ||
52 | }; | 58 | }; |
53 | 59 | ||
54 | #endif | 60 | #endif |
diff --git a/include/sound/ymfpci.h b/include/sound/ymfpci.h index 444cd6ba0ba7..41199664666b 100644 --- a/include/sound/ymfpci.h +++ b/include/sound/ymfpci.h | |||
@@ -366,6 +366,8 @@ struct snd_ymfpci { | |||
366 | #ifdef CONFIG_PM | 366 | #ifdef CONFIG_PM |
367 | u32 *saved_regs; | 367 | u32 *saved_regs; |
368 | u32 saved_ydsxgr_mode; | 368 | u32 saved_ydsxgr_mode; |
369 | u16 saved_dsxg_legacy; | ||
370 | u16 saved_dsxg_elegacy; | ||
369 | #endif | 371 | #endif |
370 | }; | 372 | }; |
371 | 373 | ||
diff --git a/include/target/target_core_backend.h b/include/target/target_core_backend.h index e5e6ff98f0fa..8c9ff1b14396 100644 --- a/include/target/target_core_backend.h +++ b/include/target/target_core_backend.h | |||
@@ -62,4 +62,6 @@ int transport_set_vpd_ident(struct t10_vpd *, unsigned char *); | |||
62 | void *transport_kmap_data_sg(struct se_cmd *); | 62 | void *transport_kmap_data_sg(struct se_cmd *); |
63 | void transport_kunmap_data_sg(struct se_cmd *); | 63 | void transport_kunmap_data_sg(struct se_cmd *); |
64 | 64 | ||
65 | void array_free(void *array, int n); | ||
66 | |||
65 | #endif /* TARGET_CORE_BACKEND_H */ | 67 | #endif /* TARGET_CORE_BACKEND_H */ |
diff --git a/include/target/target_core_base.h b/include/target/target_core_base.h index dc4e345a0163..aaccc5f5fc9f 100644 --- a/include/target/target_core_base.h +++ b/include/target/target_core_base.h | |||
@@ -9,7 +9,7 @@ | |||
9 | #include <net/sock.h> | 9 | #include <net/sock.h> |
10 | #include <net/tcp.h> | 10 | #include <net/tcp.h> |
11 | 11 | ||
12 | #define TARGET_CORE_MOD_VERSION "v4.1.0-rc1-ml" | 12 | #define TARGET_CORE_MOD_VERSION "v4.1.0-rc2-ml" |
13 | #define TARGET_CORE_VERSION TARGET_CORE_MOD_VERSION | 13 | #define TARGET_CORE_VERSION TARGET_CORE_MOD_VERSION |
14 | 14 | ||
15 | /* Maximum Number of LUNs per Target Portal Group */ | 15 | /* Maximum Number of LUNs per Target Portal Group */ |
@@ -86,6 +86,8 @@ | |||
86 | #define DA_UNMAP_GRANULARITY_DEFAULT 0 | 86 | #define DA_UNMAP_GRANULARITY_DEFAULT 0 |
87 | /* Default unmap_granularity_alignment */ | 87 | /* Default unmap_granularity_alignment */ |
88 | #define DA_UNMAP_GRANULARITY_ALIGNMENT_DEFAULT 0 | 88 | #define DA_UNMAP_GRANULARITY_ALIGNMENT_DEFAULT 0 |
89 | /* Default max transfer length */ | ||
90 | #define DA_FABRIC_MAX_SECTORS 8192 | ||
89 | /* Emulation for Direct Page Out */ | 91 | /* Emulation for Direct Page Out */ |
90 | #define DA_EMULATE_DPO 0 | 92 | #define DA_EMULATE_DPO 0 |
91 | /* Emulation for Forced Unit Access WRITEs */ | 93 | /* Emulation for Forced Unit Access WRITEs */ |
@@ -118,9 +120,9 @@ | |||
118 | /* Queue Algorithm Modifier default for restricted reordering in control mode page */ | 120 | /* Queue Algorithm Modifier default for restricted reordering in control mode page */ |
119 | #define DA_EMULATE_REST_REORD 0 | 121 | #define DA_EMULATE_REST_REORD 0 |
120 | 122 | ||
123 | #define SE_INQUIRY_BUF 512 | ||
121 | #define SE_MODE_PAGE_BUF 512 | 124 | #define SE_MODE_PAGE_BUF 512 |
122 | 125 | ||
123 | |||
124 | /* struct se_hba->hba_flags */ | 126 | /* struct se_hba->hba_flags */ |
125 | enum hba_flags_table { | 127 | enum hba_flags_table { |
126 | HBA_FLAGS_INTERNAL_USE = 0x01, | 128 | HBA_FLAGS_INTERNAL_USE = 0x01, |
@@ -169,7 +171,8 @@ enum se_cmd_flags_table { | |||
169 | SCF_EMULATED_TASK_SENSE = 0x00000004, | 171 | SCF_EMULATED_TASK_SENSE = 0x00000004, |
170 | SCF_SCSI_DATA_SG_IO_CDB = 0x00000008, | 172 | SCF_SCSI_DATA_SG_IO_CDB = 0x00000008, |
171 | SCF_SCSI_CONTROL_SG_IO_CDB = 0x00000010, | 173 | SCF_SCSI_CONTROL_SG_IO_CDB = 0x00000010, |
172 | SCF_SCSI_NON_DATA_CDB = 0x00000040, | 174 | SCF_SCSI_NON_DATA_CDB = 0x00000020, |
175 | SCF_SCSI_TMR_CDB = 0x00000040, | ||
173 | SCF_SCSI_CDB_EXCEPTION = 0x00000080, | 176 | SCF_SCSI_CDB_EXCEPTION = 0x00000080, |
174 | SCF_SCSI_RESERVATION_CONFLICT = 0x00000100, | 177 | SCF_SCSI_RESERVATION_CONFLICT = 0x00000100, |
175 | SCF_FUA = 0x00000200, | 178 | SCF_FUA = 0x00000200, |
@@ -183,7 +186,8 @@ enum se_cmd_flags_table { | |||
183 | SCF_ALUA_NON_OPTIMIZED = 0x00040000, | 186 | SCF_ALUA_NON_OPTIMIZED = 0x00040000, |
184 | SCF_DELAYED_CMD_FROM_SAM_ATTR = 0x00080000, | 187 | SCF_DELAYED_CMD_FROM_SAM_ATTR = 0x00080000, |
185 | SCF_UNUSED = 0x00100000, | 188 | SCF_UNUSED = 0x00100000, |
186 | SCF_PASSTHROUGH_SG_TO_MEM_NOALLOC = 0x00400000, | 189 | SCF_PASSTHROUGH_SG_TO_MEM_NOALLOC = 0x00200000, |
190 | SCF_ACK_KREF = 0x00400000, | ||
187 | }; | 191 | }; |
188 | 192 | ||
189 | /* struct se_dev_entry->lun_flags and struct se_lun->lun_access */ | 193 | /* struct se_dev_entry->lun_flags and struct se_lun->lun_access */ |
@@ -474,12 +478,6 @@ struct t10_reservation { | |||
474 | struct t10_reservation_ops pr_ops; | 478 | struct t10_reservation_ops pr_ops; |
475 | }; | 479 | }; |
476 | 480 | ||
477 | struct se_queue_req { | ||
478 | int state; | ||
479 | struct se_cmd *cmd; | ||
480 | struct list_head qr_list; | ||
481 | }; | ||
482 | |||
483 | struct se_queue_obj { | 481 | struct se_queue_obj { |
484 | atomic_t queue_cnt; | 482 | atomic_t queue_cnt; |
485 | spinlock_t cmd_queue_lock; | 483 | spinlock_t cmd_queue_lock; |
@@ -504,6 +502,24 @@ struct se_task { | |||
504 | struct completion task_stop_comp; | 502 | struct completion task_stop_comp; |
505 | }; | 503 | }; |
506 | 504 | ||
505 | struct se_tmr_req { | ||
506 | /* Task Management function to be performed */ | ||
507 | u8 function; | ||
508 | /* Task Management response to send */ | ||
509 | u8 response; | ||
510 | int call_transport; | ||
511 | /* Reference to ITT that Task Mgmt should be performed */ | ||
512 | u32 ref_task_tag; | ||
513 | /* 64-bit encoded SAM LUN from $FABRIC_MOD TMR header */ | ||
514 | u64 ref_task_lun; | ||
515 | void *fabric_tmr_ptr; | ||
516 | struct se_cmd *task_cmd; | ||
517 | struct se_cmd *ref_cmd; | ||
518 | struct se_device *tmr_dev; | ||
519 | struct se_lun *tmr_lun; | ||
520 | struct list_head tmr_list; | ||
521 | }; | ||
522 | |||
507 | struct se_cmd { | 523 | struct se_cmd { |
508 | /* SAM response code being sent to initiator */ | 524 | /* SAM response code being sent to initiator */ |
509 | u8 scsi_status; | 525 | u8 scsi_status; |
@@ -555,23 +571,23 @@ struct se_cmd { | |||
555 | unsigned char *t_task_cdb; | 571 | unsigned char *t_task_cdb; |
556 | unsigned char __t_task_cdb[TCM_MAX_COMMAND_SIZE]; | 572 | unsigned char __t_task_cdb[TCM_MAX_COMMAND_SIZE]; |
557 | unsigned long long t_task_lba; | 573 | unsigned long long t_task_lba; |
558 | int t_tasks_failed; | ||
559 | u32 t_tasks_sg_chained_no; | 574 | u32 t_tasks_sg_chained_no; |
560 | atomic_t t_fe_count; | 575 | atomic_t t_fe_count; |
561 | atomic_t t_se_count; | 576 | atomic_t t_se_count; |
562 | atomic_t t_task_cdbs_left; | 577 | atomic_t t_task_cdbs_left; |
563 | atomic_t t_task_cdbs_ex_left; | 578 | atomic_t t_task_cdbs_ex_left; |
564 | atomic_t t_task_cdbs_sent; | 579 | atomic_t t_task_cdbs_sent; |
565 | atomic_t t_transport_aborted; | 580 | unsigned int transport_state; |
566 | atomic_t t_transport_active; | 581 | #define CMD_T_ABORTED (1 << 0) |
567 | atomic_t t_transport_complete; | 582 | #define CMD_T_ACTIVE (1 << 1) |
568 | atomic_t t_transport_queue_active; | 583 | #define CMD_T_COMPLETE (1 << 2) |
569 | atomic_t t_transport_sent; | 584 | #define CMD_T_QUEUED (1 << 3) |
570 | atomic_t t_transport_stop; | 585 | #define CMD_T_SENT (1 << 4) |
571 | atomic_t transport_dev_active; | 586 | #define CMD_T_STOP (1 << 5) |
572 | atomic_t transport_lun_active; | 587 | #define CMD_T_FAILED (1 << 6) |
573 | atomic_t transport_lun_fe_stop; | 588 | #define CMD_T_LUN_STOP (1 << 7) |
574 | atomic_t transport_lun_stop; | 589 | #define CMD_T_LUN_FE_STOP (1 << 8) |
590 | #define CMD_T_DEV_ACTIVE (1 << 9) | ||
575 | spinlock_t t_state_lock; | 591 | spinlock_t t_state_lock; |
576 | struct completion t_transport_stop_comp; | 592 | struct completion t_transport_stop_comp; |
577 | struct completion transport_lun_fe_stop_comp; | 593 | struct completion transport_lun_fe_stop_comp; |
@@ -592,24 +608,6 @@ struct se_cmd { | |||
592 | 608 | ||
593 | }; | 609 | }; |
594 | 610 | ||
595 | struct se_tmr_req { | ||
596 | /* Task Management function to be preformed */ | ||
597 | u8 function; | ||
598 | /* Task Management response to send */ | ||
599 | u8 response; | ||
600 | int call_transport; | ||
601 | /* Reference to ITT that Task Mgmt should be preformed */ | ||
602 | u32 ref_task_tag; | ||
603 | /* 64-bit encoded SAM LUN from $FABRIC_MOD TMR header */ | ||
604 | u64 ref_task_lun; | ||
605 | void *fabric_tmr_ptr; | ||
606 | struct se_cmd *task_cmd; | ||
607 | struct se_cmd *ref_cmd; | ||
608 | struct se_device *tmr_dev; | ||
609 | struct se_lun *tmr_lun; | ||
610 | struct list_head tmr_list; | ||
611 | }; | ||
612 | |||
613 | struct se_ua { | 611 | struct se_ua { |
614 | u8 ua_asc; | 612 | u8 ua_asc; |
615 | u8 ua_ascq; | 613 | u8 ua_ascq; |
@@ -622,6 +620,7 @@ struct se_node_acl { | |||
622 | char initiatorname[TRANSPORT_IQN_LEN]; | 620 | char initiatorname[TRANSPORT_IQN_LEN]; |
623 | /* Used to signal demo mode created ACL, disabled by default */ | 621 | /* Used to signal demo mode created ACL, disabled by default */ |
624 | bool dynamic_node_acl; | 622 | bool dynamic_node_acl; |
623 | bool acl_stop:1; | ||
625 | u32 queue_depth; | 624 | u32 queue_depth; |
626 | u32 acl_index; | 625 | u32 acl_index; |
627 | u64 num_cmds; | 626 | u64 num_cmds; |
@@ -630,7 +629,7 @@ struct se_node_acl { | |||
630 | spinlock_t stats_lock; | 629 | spinlock_t stats_lock; |
631 | /* Used for PR SPEC_I_PT=1 and REGISTER_AND_MOVE */ | 630 | /* Used for PR SPEC_I_PT=1 and REGISTER_AND_MOVE */ |
632 | atomic_t acl_pr_ref_count; | 631 | atomic_t acl_pr_ref_count; |
633 | struct se_dev_entry *device_list; | 632 | struct se_dev_entry **device_list; |
634 | struct se_session *nacl_sess; | 633 | struct se_session *nacl_sess; |
635 | struct se_portal_group *se_tpg; | 634 | struct se_portal_group *se_tpg; |
636 | spinlock_t device_list_lock; | 635 | spinlock_t device_list_lock; |
@@ -643,6 +642,8 @@ struct se_node_acl { | |||
643 | struct config_group *acl_default_groups[5]; | 642 | struct config_group *acl_default_groups[5]; |
644 | struct list_head acl_list; | 643 | struct list_head acl_list; |
645 | struct list_head acl_sess_list; | 644 | struct list_head acl_sess_list; |
645 | struct completion acl_free_comp; | ||
646 | struct kref acl_kref; | ||
646 | }; | 647 | }; |
647 | 648 | ||
648 | struct se_session { | 649 | struct se_session { |
@@ -656,6 +657,7 @@ struct se_session { | |||
656 | struct list_head sess_cmd_list; | 657 | struct list_head sess_cmd_list; |
657 | struct list_head sess_wait_list; | 658 | struct list_head sess_wait_list; |
658 | spinlock_t sess_cmd_lock; | 659 | spinlock_t sess_cmd_lock; |
660 | struct kref sess_kref; | ||
659 | }; | 661 | }; |
660 | 662 | ||
661 | struct se_device; | 663 | struct se_device; |
@@ -730,6 +732,7 @@ struct se_dev_attrib { | |||
730 | u32 block_size; | 732 | u32 block_size; |
731 | u32 hw_max_sectors; | 733 | u32 hw_max_sectors; |
732 | u32 max_sectors; | 734 | u32 max_sectors; |
735 | u32 fabric_max_sectors; | ||
733 | u32 optimal_sectors; | 736 | u32 optimal_sectors; |
734 | u32 hw_queue_depth; | 737 | u32 hw_queue_depth; |
735 | u32 queue_depth; | 738 | u32 queue_depth; |
@@ -931,7 +934,7 @@ struct se_portal_group { | |||
931 | struct list_head se_tpg_node; | 934 | struct list_head se_tpg_node; |
932 | /* linked list for initiator ACL list */ | 935 | /* linked list for initiator ACL list */ |
933 | struct list_head acl_node_list; | 936 | struct list_head acl_node_list; |
934 | struct se_lun *tpg_lun_list; | 937 | struct se_lun **tpg_lun_list; |
935 | struct se_lun tpg_virt_lun0; | 938 | struct se_lun tpg_virt_lun0; |
936 | /* List of TCM sessions associated wth this TPG */ | 939 | /* List of TCM sessions associated wth this TPG */ |
937 | struct list_head tpg_sess_list; | 940 | struct list_head tpg_sess_list; |
diff --git a/include/target/target_core_fabric.h b/include/target/target_core_fabric.h index d36fad317e78..10c690809601 100644 --- a/include/target/target_core_fabric.h +++ b/include/target/target_core_fabric.h | |||
@@ -58,9 +58,6 @@ struct target_core_fabric_ops { | |||
58 | */ | 58 | */ |
59 | int (*shutdown_session)(struct se_session *); | 59 | int (*shutdown_session)(struct se_session *); |
60 | void (*close_session)(struct se_session *); | 60 | void (*close_session)(struct se_session *); |
61 | void (*stop_session)(struct se_session *, int, int); | ||
62 | void (*fall_back_to_erl0)(struct se_session *); | ||
63 | int (*sess_logged_in)(struct se_session *); | ||
64 | u32 (*sess_get_index)(struct se_session *); | 61 | u32 (*sess_get_index)(struct se_session *); |
65 | /* | 62 | /* |
66 | * Used only for SCSI fabrics that contain multi-value TransportIDs | 63 | * Used only for SCSI fabrics that contain multi-value TransportIDs |
@@ -78,7 +75,6 @@ struct target_core_fabric_ops { | |||
78 | int (*queue_tm_rsp)(struct se_cmd *); | 75 | int (*queue_tm_rsp)(struct se_cmd *); |
79 | u16 (*set_fabric_sense_len)(struct se_cmd *, u32); | 76 | u16 (*set_fabric_sense_len)(struct se_cmd *, u32); |
80 | u16 (*get_fabric_sense_len)(void); | 77 | u16 (*get_fabric_sense_len)(void); |
81 | int (*is_state_remove)(struct se_cmd *); | ||
82 | /* | 78 | /* |
83 | * fabric module calls for target_core_fabric_configfs.c | 79 | * fabric module calls for target_core_fabric_configfs.c |
84 | */ | 80 | */ |
@@ -105,7 +101,10 @@ void __transport_register_session(struct se_portal_group *, | |||
105 | struct se_node_acl *, struct se_session *, void *); | 101 | struct se_node_acl *, struct se_session *, void *); |
106 | void transport_register_session(struct se_portal_group *, | 102 | void transport_register_session(struct se_portal_group *, |
107 | struct se_node_acl *, struct se_session *, void *); | 103 | struct se_node_acl *, struct se_session *, void *); |
104 | void target_get_session(struct se_session *); | ||
105 | int target_put_session(struct se_session *); | ||
108 | void transport_free_session(struct se_session *); | 106 | void transport_free_session(struct se_session *); |
107 | void target_put_nacl(struct se_node_acl *); | ||
109 | void transport_deregister_session_configfs(struct se_session *); | 108 | void transport_deregister_session_configfs(struct se_session *); |
110 | void transport_deregister_session(struct se_session *); | 109 | void transport_deregister_session(struct se_session *); |
111 | 110 | ||
@@ -116,6 +115,10 @@ int transport_lookup_cmd_lun(struct se_cmd *, u32); | |||
116 | int transport_generic_allocate_tasks(struct se_cmd *, unsigned char *); | 115 | int transport_generic_allocate_tasks(struct se_cmd *, unsigned char *); |
117 | void target_submit_cmd(struct se_cmd *, struct se_session *, unsigned char *, | 116 | void target_submit_cmd(struct se_cmd *, struct se_session *, unsigned char *, |
118 | unsigned char *, u32, u32, int, int, int); | 117 | unsigned char *, u32, u32, int, int, int); |
118 | int target_submit_tmr(struct se_cmd *se_cmd, struct se_session *se_sess, | ||
119 | unsigned char *sense, u32 unpacked_lun, | ||
120 | void *fabric_tmr_ptr, unsigned char tm_type, | ||
121 | gfp_t, unsigned int, int); | ||
119 | int transport_handle_cdb_direct(struct se_cmd *); | 122 | int transport_handle_cdb_direct(struct se_cmd *); |
120 | int transport_generic_handle_cdb_map(struct se_cmd *); | 123 | int transport_generic_handle_cdb_map(struct se_cmd *); |
121 | int transport_generic_handle_data(struct se_cmd *); | 124 | int transport_generic_handle_data(struct se_cmd *); |
@@ -139,9 +142,10 @@ void target_wait_for_sess_cmds(struct se_session *, int); | |||
139 | 142 | ||
140 | int core_alua_check_nonop_delay(struct se_cmd *); | 143 | int core_alua_check_nonop_delay(struct se_cmd *); |
141 | 144 | ||
142 | struct se_tmr_req *core_tmr_alloc_req(struct se_cmd *, void *, u8, gfp_t); | 145 | int core_tmr_alloc_req(struct se_cmd *, void *, u8, gfp_t); |
143 | void core_tmr_release_req(struct se_tmr_req *); | 146 | void core_tmr_release_req(struct se_tmr_req *); |
144 | int transport_generic_handle_tmr(struct se_cmd *); | 147 | int transport_generic_handle_tmr(struct se_cmd *); |
148 | void transport_generic_request_failure(struct se_cmd *); | ||
145 | int transport_lookup_tmr_lun(struct se_cmd *, u32); | 149 | int transport_lookup_tmr_lun(struct se_cmd *, u32); |
146 | 150 | ||
147 | struct se_node_acl *core_tpg_check_initiator_node_acl(struct se_portal_group *, | 151 | struct se_node_acl *core_tpg_check_initiator_node_acl(struct se_portal_group *, |
diff --git a/include/trace/events/btrfs.h b/include/trace/events/btrfs.h index 84f3001a568d..91b91e805673 100644 --- a/include/trace/events/btrfs.h +++ b/include/trace/events/btrfs.h | |||
@@ -6,6 +6,7 @@ | |||
6 | 6 | ||
7 | #include <linux/writeback.h> | 7 | #include <linux/writeback.h> |
8 | #include <linux/tracepoint.h> | 8 | #include <linux/tracepoint.h> |
9 | #include <trace/events/gfpflags.h> | ||
9 | 10 | ||
10 | struct btrfs_root; | 11 | struct btrfs_root; |
11 | struct btrfs_fs_info; | 12 | struct btrfs_fs_info; |
@@ -862,6 +863,49 @@ TRACE_EVENT(btrfs_setup_cluster, | |||
862 | __entry->size, __entry->max_size, __entry->bitmap) | 863 | __entry->size, __entry->max_size, __entry->bitmap) |
863 | ); | 864 | ); |
864 | 865 | ||
866 | struct extent_state; | ||
867 | TRACE_EVENT(alloc_extent_state, | ||
868 | |||
869 | TP_PROTO(struct extent_state *state, gfp_t mask, unsigned long IP), | ||
870 | |||
871 | TP_ARGS(state, mask, IP), | ||
872 | |||
873 | TP_STRUCT__entry( | ||
874 | __field(struct extent_state *, state) | ||
875 | __field(gfp_t, mask) | ||
876 | __field(unsigned long, ip) | ||
877 | ), | ||
878 | |||
879 | TP_fast_assign( | ||
880 | __entry->state = state, | ||
881 | __entry->mask = mask, | ||
882 | __entry->ip = IP | ||
883 | ), | ||
884 | |||
885 | TP_printk("state=%p; mask = %s; caller = %pF", __entry->state, | ||
886 | show_gfp_flags(__entry->mask), (void *)__entry->ip) | ||
887 | ); | ||
888 | |||
889 | TRACE_EVENT(free_extent_state, | ||
890 | |||
891 | TP_PROTO(struct extent_state *state, unsigned long IP), | ||
892 | |||
893 | TP_ARGS(state, IP), | ||
894 | |||
895 | TP_STRUCT__entry( | ||
896 | __field(struct extent_state *, state) | ||
897 | __field(unsigned long, ip) | ||
898 | ), | ||
899 | |||
900 | TP_fast_assign( | ||
901 | __entry->state = state, | ||
902 | __entry->ip = IP | ||
903 | ), | ||
904 | |||
905 | TP_printk(" state=%p; caller = %pF", __entry->state, | ||
906 | (void *)__entry->ip) | ||
907 | ); | ||
908 | |||
865 | #endif /* _TRACE_BTRFS_H */ | 909 | #endif /* _TRACE_BTRFS_H */ |
866 | 910 | ||
867 | /* This part must be outside protection */ | 911 | /* This part must be outside protection */ |
diff --git a/include/trace/events/jbd2.h b/include/trace/events/jbd2.h index 75964412ddbb..127993dbf322 100644 --- a/include/trace/events/jbd2.h +++ b/include/trace/events/jbd2.h | |||
@@ -81,6 +81,13 @@ DEFINE_EVENT(jbd2_commit, jbd2_commit_logging, | |||
81 | TP_ARGS(journal, commit_transaction) | 81 | TP_ARGS(journal, commit_transaction) |
82 | ); | 82 | ); |
83 | 83 | ||
84 | DEFINE_EVENT(jbd2_commit, jbd2_drop_transaction, | ||
85 | |||
86 | TP_PROTO(journal_t *journal, transaction_t *commit_transaction), | ||
87 | |||
88 | TP_ARGS(journal, commit_transaction) | ||
89 | ); | ||
90 | |||
84 | TRACE_EVENT(jbd2_end_commit, | 91 | TRACE_EVENT(jbd2_end_commit, |
85 | TP_PROTO(journal_t *journal, transaction_t *commit_transaction), | 92 | TP_PROTO(journal_t *journal, transaction_t *commit_transaction), |
86 | 93 | ||
@@ -200,7 +207,7 @@ TRACE_EVENT(jbd2_checkpoint_stats, | |||
200 | __entry->forced_to_close, __entry->written, __entry->dropped) | 207 | __entry->forced_to_close, __entry->written, __entry->dropped) |
201 | ); | 208 | ); |
202 | 209 | ||
203 | TRACE_EVENT(jbd2_cleanup_journal_tail, | 210 | TRACE_EVENT(jbd2_update_log_tail, |
204 | 211 | ||
205 | TP_PROTO(journal_t *journal, tid_t first_tid, | 212 | TP_PROTO(journal_t *journal, tid_t first_tid, |
206 | unsigned long block_nr, unsigned long freed), | 213 | unsigned long block_nr, unsigned long freed), |
@@ -229,6 +236,26 @@ TRACE_EVENT(jbd2_cleanup_journal_tail, | |||
229 | __entry->block_nr, __entry->freed) | 236 | __entry->block_nr, __entry->freed) |
230 | ); | 237 | ); |
231 | 238 | ||
239 | TRACE_EVENT(jbd2_write_superblock, | ||
240 | |||
241 | TP_PROTO(journal_t *journal, int write_op), | ||
242 | |||
243 | TP_ARGS(journal, write_op), | ||
244 | |||
245 | TP_STRUCT__entry( | ||
246 | __field( dev_t, dev ) | ||
247 | __field( int, write_op ) | ||
248 | ), | ||
249 | |||
250 | TP_fast_assign( | ||
251 | __entry->dev = journal->j_fs_dev->bd_dev; | ||
252 | __entry->write_op = write_op; | ||
253 | ), | ||
254 | |||
255 | TP_printk("dev %d,%d write_op %x", MAJOR(__entry->dev), | ||
256 | MINOR(__entry->dev), __entry->write_op) | ||
257 | ); | ||
258 | |||
232 | #endif /* _TRACE_JBD2_H */ | 259 | #endif /* _TRACE_JBD2_H */ |
233 | 260 | ||
234 | /* This part must be outside protection */ | 261 | /* This part must be outside protection */ |
diff --git a/include/trace/events/power.h b/include/trace/events/power.h index 1bcc2a8c00e2..cae9a94f025d 100644 --- a/include/trace/events/power.h +++ b/include/trace/events/power.h | |||
@@ -65,7 +65,6 @@ TRACE_EVENT(machine_suspend, | |||
65 | TP_printk("state=%lu", (unsigned long)__entry->state) | 65 | TP_printk("state=%lu", (unsigned long)__entry->state) |
66 | ); | 66 | ); |
67 | 67 | ||
68 | /* This code will be removed after deprecation time exceeded (2.6.41) */ | ||
69 | #ifdef CONFIG_EVENT_POWER_TRACING_DEPRECATED | 68 | #ifdef CONFIG_EVENT_POWER_TRACING_DEPRECATED |
70 | 69 | ||
71 | /* | 70 | /* |
@@ -151,6 +150,8 @@ enum { | |||
151 | events get removed */ | 150 | events get removed */ |
152 | static inline void trace_power_start(u64 type, u64 state, u64 cpuid) {}; | 151 | static inline void trace_power_start(u64 type, u64 state, u64 cpuid) {}; |
153 | static inline void trace_power_end(u64 cpuid) {}; | 152 | static inline void trace_power_end(u64 cpuid) {}; |
153 | static inline void trace_power_start_rcuidle(u64 type, u64 state, u64 cpuid) {}; | ||
154 | static inline void trace_power_end_rcuidle(u64 cpuid) {}; | ||
154 | static inline void trace_power_frequency(u64 type, u64 state, u64 cpuid) {}; | 155 | static inline void trace_power_frequency(u64 type, u64 state, u64 cpuid) {}; |
155 | #endif /* _PWR_EVENT_AVOID_DOUBLE_DEFINING_DEPRECATED */ | 156 | #endif /* _PWR_EVENT_AVOID_DOUBLE_DEFINING_DEPRECATED */ |
156 | 157 | ||
diff --git a/include/trace/events/printk.h b/include/trace/events/printk.h new file mode 100644 index 000000000000..94ec79cc011a --- /dev/null +++ b/include/trace/events/printk.h | |||
@@ -0,0 +1,41 @@ | |||
1 | #undef TRACE_SYSTEM | ||
2 | #define TRACE_SYSTEM printk | ||
3 | |||
4 | #if !defined(_TRACE_PRINTK_H) || defined(TRACE_HEADER_MULTI_READ) | ||
5 | #define _TRACE_PRINTK_H | ||
6 | |||
7 | #include <linux/tracepoint.h> | ||
8 | |||
9 | TRACE_EVENT_CONDITION(console, | ||
10 | TP_PROTO(const char *log_buf, unsigned start, unsigned end, | ||
11 | unsigned log_buf_len), | ||
12 | |||
13 | TP_ARGS(log_buf, start, end, log_buf_len), | ||
14 | |||
15 | TP_CONDITION(start != end), | ||
16 | |||
17 | TP_STRUCT__entry( | ||
18 | __dynamic_array(char, msg, end - start + 1) | ||
19 | ), | ||
20 | |||
21 | TP_fast_assign( | ||
22 | if ((start & (log_buf_len - 1)) > (end & (log_buf_len - 1))) { | ||
23 | memcpy(__get_dynamic_array(msg), | ||
24 | log_buf + (start & (log_buf_len - 1)), | ||
25 | log_buf_len - (start & (log_buf_len - 1))); | ||
26 | memcpy((char *)__get_dynamic_array(msg) + | ||
27 | log_buf_len - (start & (log_buf_len - 1)), | ||
28 | log_buf, end & (log_buf_len - 1)); | ||
29 | } else | ||
30 | memcpy(__get_dynamic_array(msg), | ||
31 | log_buf + (start & (log_buf_len - 1)), | ||
32 | end - start); | ||
33 | ((char *)__get_dynamic_array(msg))[end - start] = 0; | ||
34 | ), | ||
35 | |||
36 | TP_printk("%s", __get_str(msg)) | ||
37 | ); | ||
38 | #endif /* _TRACE_PRINTK_H */ | ||
39 | |||
40 | /* This part must be outside protection */ | ||
41 | #include <trace/define_trace.h> | ||
diff --git a/include/trace/events/rcu.h b/include/trace/events/rcu.h index d2d88bed891b..337099783f37 100644 --- a/include/trace/events/rcu.h +++ b/include/trace/events/rcu.h | |||
@@ -313,19 +313,22 @@ TRACE_EVENT(rcu_prep_idle, | |||
313 | /* | 313 | /* |
314 | * Tracepoint for the registration of a single RCU callback function. | 314 | * Tracepoint for the registration of a single RCU callback function. |
315 | * The first argument is the type of RCU, the second argument is | 315 | * The first argument is the type of RCU, the second argument is |
316 | * a pointer to the RCU callback itself, and the third element is the | 316 | * a pointer to the RCU callback itself, the third element is the |
317 | * new RCU callback queue length for the current CPU. | 317 | * number of lazy callbacks queued, and the fourth element is the |
318 | * total number of callbacks queued. | ||
318 | */ | 319 | */ |
319 | TRACE_EVENT(rcu_callback, | 320 | TRACE_EVENT(rcu_callback, |
320 | 321 | ||
321 | TP_PROTO(char *rcuname, struct rcu_head *rhp, long qlen), | 322 | TP_PROTO(char *rcuname, struct rcu_head *rhp, long qlen_lazy, |
323 | long qlen), | ||
322 | 324 | ||
323 | TP_ARGS(rcuname, rhp, qlen), | 325 | TP_ARGS(rcuname, rhp, qlen_lazy, qlen), |
324 | 326 | ||
325 | TP_STRUCT__entry( | 327 | TP_STRUCT__entry( |
326 | __field(char *, rcuname) | 328 | __field(char *, rcuname) |
327 | __field(void *, rhp) | 329 | __field(void *, rhp) |
328 | __field(void *, func) | 330 | __field(void *, func) |
331 | __field(long, qlen_lazy) | ||
329 | __field(long, qlen) | 332 | __field(long, qlen) |
330 | ), | 333 | ), |
331 | 334 | ||
@@ -333,11 +336,13 @@ TRACE_EVENT(rcu_callback, | |||
333 | __entry->rcuname = rcuname; | 336 | __entry->rcuname = rcuname; |
334 | __entry->rhp = rhp; | 337 | __entry->rhp = rhp; |
335 | __entry->func = rhp->func; | 338 | __entry->func = rhp->func; |
339 | __entry->qlen_lazy = qlen_lazy; | ||
336 | __entry->qlen = qlen; | 340 | __entry->qlen = qlen; |
337 | ), | 341 | ), |
338 | 342 | ||
339 | TP_printk("%s rhp=%p func=%pf %ld", | 343 | TP_printk("%s rhp=%p func=%pf %ld/%ld", |
340 | __entry->rcuname, __entry->rhp, __entry->func, __entry->qlen) | 344 | __entry->rcuname, __entry->rhp, __entry->func, |
345 | __entry->qlen_lazy, __entry->qlen) | ||
341 | ); | 346 | ); |
342 | 347 | ||
343 | /* | 348 | /* |
@@ -345,20 +350,21 @@ TRACE_EVENT(rcu_callback, | |||
345 | * kfree() form. The first argument is the RCU type, the second argument | 350 | * kfree() form. The first argument is the RCU type, the second argument |
346 | * is a pointer to the RCU callback, the third argument is the offset | 351 | * is a pointer to the RCU callback, the third argument is the offset |
347 | * of the callback within the enclosing RCU-protected data structure, | 352 | * of the callback within the enclosing RCU-protected data structure, |
348 | * and the fourth argument is the new RCU callback queue length for the | 353 | * the fourth argument is the number of lazy callbacks queued, and the |
349 | * current CPU. | 354 | * fifth argument is the total number of callbacks queued. |
350 | */ | 355 | */ |
351 | TRACE_EVENT(rcu_kfree_callback, | 356 | TRACE_EVENT(rcu_kfree_callback, |
352 | 357 | ||
353 | TP_PROTO(char *rcuname, struct rcu_head *rhp, unsigned long offset, | 358 | TP_PROTO(char *rcuname, struct rcu_head *rhp, unsigned long offset, |
354 | long qlen), | 359 | long qlen_lazy, long qlen), |
355 | 360 | ||
356 | TP_ARGS(rcuname, rhp, offset, qlen), | 361 | TP_ARGS(rcuname, rhp, offset, qlen_lazy, qlen), |
357 | 362 | ||
358 | TP_STRUCT__entry( | 363 | TP_STRUCT__entry( |
359 | __field(char *, rcuname) | 364 | __field(char *, rcuname) |
360 | __field(void *, rhp) | 365 | __field(void *, rhp) |
361 | __field(unsigned long, offset) | 366 | __field(unsigned long, offset) |
367 | __field(long, qlen_lazy) | ||
362 | __field(long, qlen) | 368 | __field(long, qlen) |
363 | ), | 369 | ), |
364 | 370 | ||
@@ -366,41 +372,45 @@ TRACE_EVENT(rcu_kfree_callback, | |||
366 | __entry->rcuname = rcuname; | 372 | __entry->rcuname = rcuname; |
367 | __entry->rhp = rhp; | 373 | __entry->rhp = rhp; |
368 | __entry->offset = offset; | 374 | __entry->offset = offset; |
375 | __entry->qlen_lazy = qlen_lazy; | ||
369 | __entry->qlen = qlen; | 376 | __entry->qlen = qlen; |
370 | ), | 377 | ), |
371 | 378 | ||
372 | TP_printk("%s rhp=%p func=%ld %ld", | 379 | TP_printk("%s rhp=%p func=%ld %ld/%ld", |
373 | __entry->rcuname, __entry->rhp, __entry->offset, | 380 | __entry->rcuname, __entry->rhp, __entry->offset, |
374 | __entry->qlen) | 381 | __entry->qlen_lazy, __entry->qlen) |
375 | ); | 382 | ); |
376 | 383 | ||
377 | /* | 384 | /* |
378 | * Tracepoint for marking the beginning rcu_do_batch, performed to start | 385 | * Tracepoint for marking the beginning rcu_do_batch, performed to start |
379 | * RCU callback invocation. The first argument is the RCU flavor, | 386 | * RCU callback invocation. The first argument is the RCU flavor, |
380 | * the second is the total number of callbacks (including those that | 387 | * the second is the number of lazy callbacks queued, the third is |
381 | * are not yet ready to be invoked), and the third argument is the | 388 | * the total number of callbacks queued, and the fourth argument is |
382 | * current RCU-callback batch limit. | 389 | * the current RCU-callback batch limit. |
383 | */ | 390 | */ |
384 | TRACE_EVENT(rcu_batch_start, | 391 | TRACE_EVENT(rcu_batch_start, |
385 | 392 | ||
386 | TP_PROTO(char *rcuname, long qlen, int blimit), | 393 | TP_PROTO(char *rcuname, long qlen_lazy, long qlen, int blimit), |
387 | 394 | ||
388 | TP_ARGS(rcuname, qlen, blimit), | 395 | TP_ARGS(rcuname, qlen_lazy, qlen, blimit), |
389 | 396 | ||
390 | TP_STRUCT__entry( | 397 | TP_STRUCT__entry( |
391 | __field(char *, rcuname) | 398 | __field(char *, rcuname) |
399 | __field(long, qlen_lazy) | ||
392 | __field(long, qlen) | 400 | __field(long, qlen) |
393 | __field(int, blimit) | 401 | __field(int, blimit) |
394 | ), | 402 | ), |
395 | 403 | ||
396 | TP_fast_assign( | 404 | TP_fast_assign( |
397 | __entry->rcuname = rcuname; | 405 | __entry->rcuname = rcuname; |
406 | __entry->qlen_lazy = qlen_lazy; | ||
398 | __entry->qlen = qlen; | 407 | __entry->qlen = qlen; |
399 | __entry->blimit = blimit; | 408 | __entry->blimit = blimit; |
400 | ), | 409 | ), |
401 | 410 | ||
402 | TP_printk("%s CBs=%ld bl=%d", | 411 | TP_printk("%s CBs=%ld/%ld bl=%d", |
403 | __entry->rcuname, __entry->qlen, __entry->blimit) | 412 | __entry->rcuname, __entry->qlen_lazy, __entry->qlen, |
413 | __entry->blimit) | ||
404 | ); | 414 | ); |
405 | 415 | ||
406 | /* | 416 | /* |
@@ -531,16 +541,21 @@ TRACE_EVENT(rcu_torture_read, | |||
531 | #else /* #ifdef CONFIG_RCU_TRACE */ | 541 | #else /* #ifdef CONFIG_RCU_TRACE */ |
532 | 542 | ||
533 | #define trace_rcu_grace_period(rcuname, gpnum, gpevent) do { } while (0) | 543 | #define trace_rcu_grace_period(rcuname, gpnum, gpevent) do { } while (0) |
534 | #define trace_rcu_grace_period_init(rcuname, gpnum, level, grplo, grphi, qsmask) do { } while (0) | 544 | #define trace_rcu_grace_period_init(rcuname, gpnum, level, grplo, grphi, \ |
545 | qsmask) do { } while (0) | ||
535 | #define trace_rcu_preempt_task(rcuname, pid, gpnum) do { } while (0) | 546 | #define trace_rcu_preempt_task(rcuname, pid, gpnum) do { } while (0) |
536 | #define trace_rcu_unlock_preempted_task(rcuname, gpnum, pid) do { } while (0) | 547 | #define trace_rcu_unlock_preempted_task(rcuname, gpnum, pid) do { } while (0) |
537 | #define trace_rcu_quiescent_state_report(rcuname, gpnum, mask, qsmask, level, grplo, grphi, gp_tasks) do { } while (0) | 548 | #define trace_rcu_quiescent_state_report(rcuname, gpnum, mask, qsmask, level, \ |
549 | grplo, grphi, gp_tasks) do { } \ | ||
550 | while (0) | ||
538 | #define trace_rcu_fqs(rcuname, gpnum, cpu, qsevent) do { } while (0) | 551 | #define trace_rcu_fqs(rcuname, gpnum, cpu, qsevent) do { } while (0) |
539 | #define trace_rcu_dyntick(polarity, oldnesting, newnesting) do { } while (0) | 552 | #define trace_rcu_dyntick(polarity, oldnesting, newnesting) do { } while (0) |
540 | #define trace_rcu_prep_idle(reason) do { } while (0) | 553 | #define trace_rcu_prep_idle(reason) do { } while (0) |
541 | #define trace_rcu_callback(rcuname, rhp, qlen) do { } while (0) | 554 | #define trace_rcu_callback(rcuname, rhp, qlen_lazy, qlen) do { } while (0) |
542 | #define trace_rcu_kfree_callback(rcuname, rhp, offset, qlen) do { } while (0) | 555 | #define trace_rcu_kfree_callback(rcuname, rhp, offset, qlen_lazy, qlen) \ |
543 | #define trace_rcu_batch_start(rcuname, qlen, blimit) do { } while (0) | 556 | do { } while (0) |
557 | #define trace_rcu_batch_start(rcuname, qlen_lazy, qlen, blimit) \ | ||
558 | do { } while (0) | ||
544 | #define trace_rcu_invoke_callback(rcuname, rhp) do { } while (0) | 559 | #define trace_rcu_invoke_callback(rcuname, rhp) do { } while (0) |
545 | #define trace_rcu_invoke_kfree_callback(rcuname, rhp, offset) do { } while (0) | 560 | #define trace_rcu_invoke_kfree_callback(rcuname, rhp, offset) do { } while (0) |
546 | #define trace_rcu_batch_end(rcuname, callbacks_invoked, cb, nr, iit, risk) \ | 561 | #define trace_rcu_batch_end(rcuname, callbacks_invoked, cb, nr, iit, risk) \ |
diff --git a/include/trace/events/regmap.h b/include/trace/events/regmap.h index 12fbf43524e9..41a7dbd570e2 100644 --- a/include/trace/events/regmap.h +++ b/include/trace/events/regmap.h | |||
@@ -4,10 +4,10 @@ | |||
4 | #if !defined(_TRACE_REGMAP_H) || defined(TRACE_HEADER_MULTI_READ) | 4 | #if !defined(_TRACE_REGMAP_H) || defined(TRACE_HEADER_MULTI_READ) |
5 | #define _TRACE_REGMAP_H | 5 | #define _TRACE_REGMAP_H |
6 | 6 | ||
7 | #include <linux/device.h> | ||
8 | #include <linux/ktime.h> | 7 | #include <linux/ktime.h> |
9 | #include <linux/tracepoint.h> | 8 | #include <linux/tracepoint.h> |
10 | 9 | ||
10 | struct device; | ||
11 | struct regmap; | 11 | struct regmap; |
12 | 12 | ||
13 | /* | 13 | /* |
@@ -139,6 +139,42 @@ TRACE_EVENT(regcache_sync, | |||
139 | __get_str(type), __get_str(status)) | 139 | __get_str(type), __get_str(status)) |
140 | ); | 140 | ); |
141 | 141 | ||
142 | DECLARE_EVENT_CLASS(regmap_bool, | ||
143 | |||
144 | TP_PROTO(struct device *dev, bool flag), | ||
145 | |||
146 | TP_ARGS(dev, flag), | ||
147 | |||
148 | TP_STRUCT__entry( | ||
149 | __string( name, dev_name(dev) ) | ||
150 | __field( int, flag ) | ||
151 | ), | ||
152 | |||
153 | TP_fast_assign( | ||
154 | __assign_str(name, dev_name(dev)); | ||
155 | __entry->flag = flag; | ||
156 | ), | ||
157 | |||
158 | TP_printk("%s flag=%d", __get_str(name), | ||
159 | (int)__entry->flag) | ||
160 | ); | ||
161 | |||
162 | DEFINE_EVENT(regmap_bool, regmap_cache_only, | ||
163 | |||
164 | TP_PROTO(struct device *dev, bool flag), | ||
165 | |||
166 | TP_ARGS(dev, flag) | ||
167 | |||
168 | ); | ||
169 | |||
170 | DEFINE_EVENT(regmap_bool, regmap_cache_bypass, | ||
171 | |||
172 | TP_PROTO(struct device *dev, bool flag), | ||
173 | |||
174 | TP_ARGS(dev, flag) | ||
175 | |||
176 | ); | ||
177 | |||
142 | #endif /* _TRACE_REGMAP_H */ | 178 | #endif /* _TRACE_REGMAP_H */ |
143 | 179 | ||
144 | /* This part must be outside protection */ | 180 | /* This part must be outside protection */ |
diff --git a/include/trace/events/rpm.h b/include/trace/events/rpm.h index d62c558bf64b..33f85b68c22c 100644 --- a/include/trace/events/rpm.h +++ b/include/trace/events/rpm.h | |||
@@ -7,7 +7,8 @@ | |||
7 | 7 | ||
8 | #include <linux/ktime.h> | 8 | #include <linux/ktime.h> |
9 | #include <linux/tracepoint.h> | 9 | #include <linux/tracepoint.h> |
10 | #include <linux/device.h> | 10 | |
11 | struct device; | ||
11 | 12 | ||
12 | /* | 13 | /* |
13 | * The rpm_internal events are used for tracing some important | 14 | * The rpm_internal events are used for tracing some important |
diff --git a/include/trace/events/sched.h b/include/trace/events/sched.h index e33ed1bfa113..ea7a2035456d 100644 --- a/include/trace/events/sched.h +++ b/include/trace/events/sched.h | |||
@@ -6,6 +6,7 @@ | |||
6 | 6 | ||
7 | #include <linux/sched.h> | 7 | #include <linux/sched.h> |
8 | #include <linux/tracepoint.h> | 8 | #include <linux/tracepoint.h> |
9 | #include <linux/binfmts.h> | ||
9 | 10 | ||
10 | /* | 11 | /* |
11 | * Tracepoint for calling kthread_stop, performed to end a kthread: | 12 | * Tracepoint for calling kthread_stop, performed to end a kthread: |
@@ -276,6 +277,32 @@ TRACE_EVENT(sched_process_fork, | |||
276 | ); | 277 | ); |
277 | 278 | ||
278 | /* | 279 | /* |
280 | * Tracepoint for exec: | ||
281 | */ | ||
282 | TRACE_EVENT(sched_process_exec, | ||
283 | |||
284 | TP_PROTO(struct task_struct *p, pid_t old_pid, | ||
285 | struct linux_binprm *bprm), | ||
286 | |||
287 | TP_ARGS(p, old_pid, bprm), | ||
288 | |||
289 | TP_STRUCT__entry( | ||
290 | __string( filename, bprm->filename ) | ||
291 | __field( pid_t, pid ) | ||
292 | __field( pid_t, old_pid ) | ||
293 | ), | ||
294 | |||
295 | TP_fast_assign( | ||
296 | __assign_str(filename, bprm->filename); | ||
297 | __entry->pid = p->pid; | ||
298 | __entry->old_pid = old_pid; | ||
299 | ), | ||
300 | |||
301 | TP_printk("filename=%s pid=%d old_pid=%d", __get_str(filename), | ||
302 | __entry->pid, __entry->old_pid) | ||
303 | ); | ||
304 | |||
305 | /* | ||
279 | * XXX the below sched_stat tracepoints only apply to SCHED_OTHER/BATCH/IDLE | 306 | * XXX the below sched_stat tracepoints only apply to SCHED_OTHER/BATCH/IDLE |
280 | * adding sched_stat support to SCHED_FIFO/RR would be welcome. | 307 | * adding sched_stat support to SCHED_FIFO/RR would be welcome. |
281 | */ | 308 | */ |
diff --git a/include/trace/events/signal.h b/include/trace/events/signal.h index 17df43464df0..39a8a430d90f 100644 --- a/include/trace/events/signal.h +++ b/include/trace/events/signal.h | |||
@@ -23,11 +23,23 @@ | |||
23 | } \ | 23 | } \ |
24 | } while (0) | 24 | } while (0) |
25 | 25 | ||
26 | #ifndef TRACE_HEADER_MULTI_READ | ||
27 | enum { | ||
28 | TRACE_SIGNAL_DELIVERED, | ||
29 | TRACE_SIGNAL_IGNORED, | ||
30 | TRACE_SIGNAL_ALREADY_PENDING, | ||
31 | TRACE_SIGNAL_OVERFLOW_FAIL, | ||
32 | TRACE_SIGNAL_LOSE_INFO, | ||
33 | }; | ||
34 | #endif | ||
35 | |||
26 | /** | 36 | /** |
27 | * signal_generate - called when a signal is generated | 37 | * signal_generate - called when a signal is generated |
28 | * @sig: signal number | 38 | * @sig: signal number |
29 | * @info: pointer to struct siginfo | 39 | * @info: pointer to struct siginfo |
30 | * @task: pointer to struct task_struct | 40 | * @task: pointer to struct task_struct |
41 | * @group: shared or private | ||
42 | * @result: TRACE_SIGNAL_* | ||
31 | * | 43 | * |
32 | * Current process sends a 'sig' signal to 'task' process with | 44 | * Current process sends a 'sig' signal to 'task' process with |
33 | * 'info' siginfo. If 'info' is SEND_SIG_NOINFO or SEND_SIG_PRIV, | 45 | * 'info' siginfo. If 'info' is SEND_SIG_NOINFO or SEND_SIG_PRIV, |
@@ -37,9 +49,10 @@ | |||
37 | */ | 49 | */ |
38 | TRACE_EVENT(signal_generate, | 50 | TRACE_EVENT(signal_generate, |
39 | 51 | ||
40 | TP_PROTO(int sig, struct siginfo *info, struct task_struct *task), | 52 | TP_PROTO(int sig, struct siginfo *info, struct task_struct *task, |
53 | int group, int result), | ||
41 | 54 | ||
42 | TP_ARGS(sig, info, task), | 55 | TP_ARGS(sig, info, task, group, result), |
43 | 56 | ||
44 | TP_STRUCT__entry( | 57 | TP_STRUCT__entry( |
45 | __field( int, sig ) | 58 | __field( int, sig ) |
@@ -47,6 +60,8 @@ TRACE_EVENT(signal_generate, | |||
47 | __field( int, code ) | 60 | __field( int, code ) |
48 | __array( char, comm, TASK_COMM_LEN ) | 61 | __array( char, comm, TASK_COMM_LEN ) |
49 | __field( pid_t, pid ) | 62 | __field( pid_t, pid ) |
63 | __field( int, group ) | ||
64 | __field( int, result ) | ||
50 | ), | 65 | ), |
51 | 66 | ||
52 | TP_fast_assign( | 67 | TP_fast_assign( |
@@ -54,11 +69,14 @@ TRACE_EVENT(signal_generate, | |||
54 | TP_STORE_SIGINFO(__entry, info); | 69 | TP_STORE_SIGINFO(__entry, info); |
55 | memcpy(__entry->comm, task->comm, TASK_COMM_LEN); | 70 | memcpy(__entry->comm, task->comm, TASK_COMM_LEN); |
56 | __entry->pid = task->pid; | 71 | __entry->pid = task->pid; |
72 | __entry->group = group; | ||
73 | __entry->result = result; | ||
57 | ), | 74 | ), |
58 | 75 | ||
59 | TP_printk("sig=%d errno=%d code=%d comm=%s pid=%d", | 76 | TP_printk("sig=%d errno=%d code=%d comm=%s pid=%d grp=%d res=%d", |
60 | __entry->sig, __entry->errno, __entry->code, | 77 | __entry->sig, __entry->errno, __entry->code, |
61 | __entry->comm, __entry->pid) | 78 | __entry->comm, __entry->pid, __entry->group, |
79 | __entry->result) | ||
62 | ); | 80 | ); |
63 | 81 | ||
64 | /** | 82 | /** |
@@ -101,65 +119,6 @@ TRACE_EVENT(signal_deliver, | |||
101 | __entry->sa_handler, __entry->sa_flags) | 119 | __entry->sa_handler, __entry->sa_flags) |
102 | ); | 120 | ); |
103 | 121 | ||
104 | DECLARE_EVENT_CLASS(signal_queue_overflow, | ||
105 | |||
106 | TP_PROTO(int sig, int group, struct siginfo *info), | ||
107 | |||
108 | TP_ARGS(sig, group, info), | ||
109 | |||
110 | TP_STRUCT__entry( | ||
111 | __field( int, sig ) | ||
112 | __field( int, group ) | ||
113 | __field( int, errno ) | ||
114 | __field( int, code ) | ||
115 | ), | ||
116 | |||
117 | TP_fast_assign( | ||
118 | __entry->sig = sig; | ||
119 | __entry->group = group; | ||
120 | TP_STORE_SIGINFO(__entry, info); | ||
121 | ), | ||
122 | |||
123 | TP_printk("sig=%d group=%d errno=%d code=%d", | ||
124 | __entry->sig, __entry->group, __entry->errno, __entry->code) | ||
125 | ); | ||
126 | |||
127 | /** | ||
128 | * signal_overflow_fail - called when signal queue is overflow | ||
129 | * @sig: signal number | ||
130 | * @group: signal to process group or not (bool) | ||
131 | * @info: pointer to struct siginfo | ||
132 | * | ||
133 | * Kernel fails to generate 'sig' signal with 'info' siginfo, because | ||
134 | * siginfo queue is overflow, and the signal is dropped. | ||
135 | * 'group' is not 0 if the signal will be sent to a process group. | ||
136 | * 'sig' is always one of RT signals. | ||
137 | */ | ||
138 | DEFINE_EVENT(signal_queue_overflow, signal_overflow_fail, | ||
139 | |||
140 | TP_PROTO(int sig, int group, struct siginfo *info), | ||
141 | |||
142 | TP_ARGS(sig, group, info) | ||
143 | ); | ||
144 | |||
145 | /** | ||
146 | * signal_lose_info - called when siginfo is lost | ||
147 | * @sig: signal number | ||
148 | * @group: signal to process group or not (bool) | ||
149 | * @info: pointer to struct siginfo | ||
150 | * | ||
151 | * Kernel generates 'sig' signal but loses 'info' siginfo, because siginfo | ||
152 | * queue is overflow. | ||
153 | * 'group' is not 0 if the signal will be sent to a process group. | ||
154 | * 'sig' is always one of non-RT signals. | ||
155 | */ | ||
156 | DEFINE_EVENT(signal_queue_overflow, signal_lose_info, | ||
157 | |||
158 | TP_PROTO(int sig, int group, struct siginfo *info), | ||
159 | |||
160 | TP_ARGS(sig, group, info) | ||
161 | ); | ||
162 | |||
163 | #endif /* _TRACE_SIGNAL_H */ | 122 | #endif /* _TRACE_SIGNAL_H */ |
164 | 123 | ||
165 | /* This part must be outside protection */ | 124 | /* This part must be outside protection */ |
diff --git a/include/trace/events/sunrpc.h b/include/trace/events/sunrpc.h new file mode 100644 index 000000000000..43be87d5dd58 --- /dev/null +++ b/include/trace/events/sunrpc.h | |||
@@ -0,0 +1,177 @@ | |||
1 | #undef TRACE_SYSTEM | ||
2 | #define TRACE_SYSTEM sunrpc | ||
3 | |||
4 | #if !defined(_TRACE_SUNRPC_H) || defined(TRACE_HEADER_MULTI_READ) | ||
5 | #define _TRACE_SUNRPC_H | ||
6 | |||
7 | #include <linux/sunrpc/sched.h> | ||
8 | #include <linux/sunrpc/clnt.h> | ||
9 | #include <linux/tracepoint.h> | ||
10 | |||
11 | DECLARE_EVENT_CLASS(rpc_task_status, | ||
12 | |||
13 | TP_PROTO(struct rpc_task *task), | ||
14 | |||
15 | TP_ARGS(task), | ||
16 | |||
17 | TP_STRUCT__entry( | ||
18 | __field(const struct rpc_task *, task) | ||
19 | __field(const struct rpc_clnt *, clnt) | ||
20 | __field(int, status) | ||
21 | ), | ||
22 | |||
23 | TP_fast_assign( | ||
24 | __entry->task = task; | ||
25 | __entry->clnt = task->tk_client; | ||
26 | __entry->status = task->tk_status; | ||
27 | ), | ||
28 | |||
29 | TP_printk("task:%p@%p, status %d",__entry->task, __entry->clnt, __entry->status) | ||
30 | ); | ||
31 | |||
32 | DEFINE_EVENT(rpc_task_status, rpc_call_status, | ||
33 | TP_PROTO(struct rpc_task *task), | ||
34 | |||
35 | TP_ARGS(task) | ||
36 | ); | ||
37 | |||
38 | DEFINE_EVENT(rpc_task_status, rpc_bind_status, | ||
39 | TP_PROTO(struct rpc_task *task), | ||
40 | |||
41 | TP_ARGS(task) | ||
42 | ); | ||
43 | |||
44 | TRACE_EVENT(rpc_connect_status, | ||
45 | TP_PROTO(struct rpc_task *task, int status), | ||
46 | |||
47 | TP_ARGS(task, status), | ||
48 | |||
49 | TP_STRUCT__entry( | ||
50 | __field(const struct rpc_task *, task) | ||
51 | __field(const struct rpc_clnt *, clnt) | ||
52 | __field(int, status) | ||
53 | ), | ||
54 | |||
55 | TP_fast_assign( | ||
56 | __entry->task = task; | ||
57 | __entry->clnt = task->tk_client; | ||
58 | __entry->status = status; | ||
59 | ), | ||
60 | |||
61 | TP_printk("task:%p@%p, status %d",__entry->task, __entry->clnt, __entry->status) | ||
62 | ); | ||
63 | |||
64 | DECLARE_EVENT_CLASS(rpc_task_running, | ||
65 | |||
66 | TP_PROTO(const struct rpc_clnt *clnt, const struct rpc_task *task, const void *action), | ||
67 | |||
68 | TP_ARGS(clnt, task, action), | ||
69 | |||
70 | TP_STRUCT__entry( | ||
71 | __field(const struct rpc_clnt *, clnt) | ||
72 | __field(const struct rpc_task *, task) | ||
73 | __field(const void *, action) | ||
74 | __field(unsigned long, runstate) | ||
75 | __field(int, status) | ||
76 | __field(unsigned short, flags) | ||
77 | ), | ||
78 | |||
79 | TP_fast_assign( | ||
80 | __entry->clnt = clnt; | ||
81 | __entry->task = task; | ||
82 | __entry->action = action; | ||
83 | __entry->runstate = task->tk_runstate; | ||
84 | __entry->status = task->tk_status; | ||
85 | __entry->flags = task->tk_flags; | ||
86 | ), | ||
87 | |||
88 | TP_printk("task:%p@%p flags=%4.4x state=%4.4lx status=%d action=%pf", | ||
89 | __entry->task, | ||
90 | __entry->clnt, | ||
91 | __entry->flags, | ||
92 | __entry->runstate, | ||
93 | __entry->status, | ||
94 | __entry->action | ||
95 | ) | ||
96 | ); | ||
97 | |||
98 | DEFINE_EVENT(rpc_task_running, rpc_task_begin, | ||
99 | |||
100 | TP_PROTO(const struct rpc_clnt *clnt, const struct rpc_task *task, const void *action), | ||
101 | |||
102 | TP_ARGS(clnt, task, action) | ||
103 | |||
104 | ); | ||
105 | |||
106 | DEFINE_EVENT(rpc_task_running, rpc_task_run_action, | ||
107 | |||
108 | TP_PROTO(const struct rpc_clnt *clnt, const struct rpc_task *task, const void *action), | ||
109 | |||
110 | TP_ARGS(clnt, task, action) | ||
111 | |||
112 | ); | ||
113 | |||
114 | DEFINE_EVENT(rpc_task_running, rpc_task_complete, | ||
115 | |||
116 | TP_PROTO(const struct rpc_clnt *clnt, const struct rpc_task *task, const void *action), | ||
117 | |||
118 | TP_ARGS(clnt, task, action) | ||
119 | |||
120 | ); | ||
121 | |||
122 | DECLARE_EVENT_CLASS(rpc_task_queued, | ||
123 | |||
124 | TP_PROTO(const struct rpc_clnt *clnt, const struct rpc_task *task, const struct rpc_wait_queue *q), | ||
125 | |||
126 | TP_ARGS(clnt, task, q), | ||
127 | |||
128 | TP_STRUCT__entry( | ||
129 | __field(const struct rpc_clnt *, clnt) | ||
130 | __field(const struct rpc_task *, task) | ||
131 | __field(unsigned long, timeout) | ||
132 | __field(unsigned long, runstate) | ||
133 | __field(int, status) | ||
134 | __field(unsigned short, flags) | ||
135 | __string(q_name, rpc_qname(q)) | ||
136 | ), | ||
137 | |||
138 | TP_fast_assign( | ||
139 | __entry->clnt = clnt; | ||
140 | __entry->task = task; | ||
141 | __entry->timeout = task->tk_timeout; | ||
142 | __entry->runstate = task->tk_runstate; | ||
143 | __entry->status = task->tk_status; | ||
144 | __entry->flags = task->tk_flags; | ||
145 | __assign_str(q_name, rpc_qname(q)); | ||
146 | ), | ||
147 | |||
148 | TP_printk("task:%p@%p flags=%4.4x state=%4.4lx status=%d timeout=%lu queue=%s", | ||
149 | __entry->task, | ||
150 | __entry->clnt, | ||
151 | __entry->flags, | ||
152 | __entry->runstate, | ||
153 | __entry->status, | ||
154 | __entry->timeout, | ||
155 | __get_str(q_name) | ||
156 | ) | ||
157 | ); | ||
158 | |||
159 | DEFINE_EVENT(rpc_task_queued, rpc_task_sleep, | ||
160 | |||
161 | TP_PROTO(const struct rpc_clnt *clnt, const struct rpc_task *task, const struct rpc_wait_queue *q), | ||
162 | |||
163 | TP_ARGS(clnt, task, q) | ||
164 | |||
165 | ); | ||
166 | |||
167 | DEFINE_EVENT(rpc_task_queued, rpc_task_wakeup, | ||
168 | |||
169 | TP_PROTO(const struct rpc_clnt *clnt, const struct rpc_task *task, const struct rpc_wait_queue *q), | ||
170 | |||
171 | TP_ARGS(clnt, task, q) | ||
172 | |||
173 | ); | ||
174 | |||
175 | #endif /* _TRACE_SUNRPC_H */ | ||
176 | |||
177 | #include <trace/define_trace.h> | ||
diff --git a/include/trace/events/writeback.h b/include/trace/events/writeback.h index 5973410e8f8c..7b81887b023f 100644 --- a/include/trace/events/writeback.h +++ b/include/trace/events/writeback.h | |||
@@ -5,7 +5,6 @@ | |||
5 | #define _TRACE_WRITEBACK_H | 5 | #define _TRACE_WRITEBACK_H |
6 | 6 | ||
7 | #include <linux/backing-dev.h> | 7 | #include <linux/backing-dev.h> |
8 | #include <linux/device.h> | ||
9 | #include <linux/writeback.h> | 8 | #include <linux/writeback.h> |
10 | 9 | ||
11 | #define show_inode_state(state) \ | 10 | #define show_inode_state(state) \ |
diff --git a/include/video/exynos_dp.h b/include/video/exynos_dp.h new file mode 100644 index 000000000000..8847a9d6dd42 --- /dev/null +++ b/include/video/exynos_dp.h | |||
@@ -0,0 +1,131 @@ | |||
1 | /* | ||
2 | * Samsung SoC DP device support | ||
3 | * | ||
4 | * Copyright (C) 2012 Samsung Electronics Co., Ltd. | ||
5 | * Author: Jingoo Han <jg1.han@samsung.com> | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License version 2 as | ||
9 | * published by the Free Software Foundation. | ||
10 | */ | ||
11 | |||
12 | #ifndef _EXYNOS_DP_H | ||
13 | #define _EXYNOS_DP_H | ||
14 | |||
15 | #define DP_TIMEOUT_LOOP_COUNT 100 | ||
16 | #define MAX_CR_LOOP 5 | ||
17 | #define MAX_EQ_LOOP 4 | ||
18 | |||
19 | enum link_rate_type { | ||
20 | LINK_RATE_1_62GBPS = 0x06, | ||
21 | LINK_RATE_2_70GBPS = 0x0a | ||
22 | }; | ||
23 | |||
24 | enum link_lane_count_type { | ||
25 | LANE_COUNT1 = 1, | ||
26 | LANE_COUNT2 = 2, | ||
27 | LANE_COUNT4 = 4 | ||
28 | }; | ||
29 | |||
30 | enum link_training_state { | ||
31 | START, | ||
32 | CLOCK_RECOVERY, | ||
33 | EQUALIZER_TRAINING, | ||
34 | FINISHED, | ||
35 | FAILED | ||
36 | }; | ||
37 | |||
38 | enum voltage_swing_level { | ||
39 | VOLTAGE_LEVEL_0, | ||
40 | VOLTAGE_LEVEL_1, | ||
41 | VOLTAGE_LEVEL_2, | ||
42 | VOLTAGE_LEVEL_3, | ||
43 | }; | ||
44 | |||
45 | enum pre_emphasis_level { | ||
46 | PRE_EMPHASIS_LEVEL_0, | ||
47 | PRE_EMPHASIS_LEVEL_1, | ||
48 | PRE_EMPHASIS_LEVEL_2, | ||
49 | PRE_EMPHASIS_LEVEL_3, | ||
50 | }; | ||
51 | |||
52 | enum pattern_set { | ||
53 | PRBS7, | ||
54 | D10_2, | ||
55 | TRAINING_PTN1, | ||
56 | TRAINING_PTN2, | ||
57 | DP_NONE | ||
58 | }; | ||
59 | |||
60 | enum color_space { | ||
61 | COLOR_RGB, | ||
62 | COLOR_YCBCR422, | ||
63 | COLOR_YCBCR444 | ||
64 | }; | ||
65 | |||
66 | enum color_depth { | ||
67 | COLOR_6, | ||
68 | COLOR_8, | ||
69 | COLOR_10, | ||
70 | COLOR_12 | ||
71 | }; | ||
72 | |||
73 | enum color_coefficient { | ||
74 | COLOR_YCBCR601, | ||
75 | COLOR_YCBCR709 | ||
76 | }; | ||
77 | |||
78 | enum dynamic_range { | ||
79 | VESA, | ||
80 | CEA | ||
81 | }; | ||
82 | |||
83 | enum pll_status { | ||
84 | PLL_UNLOCKED, | ||
85 | PLL_LOCKED | ||
86 | }; | ||
87 | |||
88 | enum clock_recovery_m_value_type { | ||
89 | CALCULATED_M, | ||
90 | REGISTER_M | ||
91 | }; | ||
92 | |||
93 | enum video_timing_recognition_type { | ||
94 | VIDEO_TIMING_FROM_CAPTURE, | ||
95 | VIDEO_TIMING_FROM_REGISTER | ||
96 | }; | ||
97 | |||
98 | enum analog_power_block { | ||
99 | AUX_BLOCK, | ||
100 | CH0_BLOCK, | ||
101 | CH1_BLOCK, | ||
102 | CH2_BLOCK, | ||
103 | CH3_BLOCK, | ||
104 | ANALOG_TOTAL, | ||
105 | POWER_ALL | ||
106 | }; | ||
107 | |||
108 | struct video_info { | ||
109 | char *name; | ||
110 | |||
111 | bool h_sync_polarity; | ||
112 | bool v_sync_polarity; | ||
113 | bool interlaced; | ||
114 | |||
115 | enum color_space color_space; | ||
116 | enum dynamic_range dynamic_range; | ||
117 | enum color_coefficient ycbcr_coeff; | ||
118 | enum color_depth color_depth; | ||
119 | |||
120 | enum link_rate_type link_rate; | ||
121 | enum link_lane_count_type lane_count; | ||
122 | }; | ||
123 | |||
124 | struct exynos_dp_platdata { | ||
125 | struct video_info *video_info; | ||
126 | |||
127 | void (*phy_init)(void); | ||
128 | void (*phy_exit)(void); | ||
129 | }; | ||
130 | |||
131 | #endif /* _EXYNOS_DP_H */ | ||
diff --git a/include/video/exynos_mipi_dsim.h b/include/video/exynos_mipi_dsim.h new file mode 100644 index 000000000000..772c770535f1 --- /dev/null +++ b/include/video/exynos_mipi_dsim.h | |||
@@ -0,0 +1,359 @@ | |||
1 | /* include/video/exynos_mipi_dsim.h | ||
2 | * | ||
3 | * Platform data header for Samsung SoC MIPI-DSIM. | ||
4 | * | ||
5 | * Copyright (c) 2012 Samsung Electronics Co., Ltd | ||
6 | * | ||
7 | * InKi Dae <inki.dae@samsung.com> | ||
8 | * Donghwa Lee <dh09.lee@samsung.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 version 2 as | ||
12 | * published by the Free Software Foundation. | ||
13 | */ | ||
14 | |||
15 | #ifndef _EXYNOS_MIPI_DSIM_H | ||
16 | #define _EXYNOS_MIPI_DSIM_H | ||
17 | |||
18 | #include <linux/device.h> | ||
19 | #include <linux/fb.h> | ||
20 | |||
21 | #define PANEL_NAME_SIZE (32) | ||
22 | |||
23 | /* | ||
24 | * Enumerate display interface type. | ||
25 | * | ||
26 | * DSIM_COMMAND means cpu interface and rgb interface for DSIM_VIDEO. | ||
27 | * | ||
28 | * P.S. MIPI DSI Master has two display controller intefaces, RGB Interface | ||
29 | * for main display and CPU Interface(same as I80 Interface) for main | ||
30 | * and sub display. | ||
31 | */ | ||
32 | enum mipi_dsim_interface_type { | ||
33 | DSIM_COMMAND, | ||
34 | DSIM_VIDEO | ||
35 | }; | ||
36 | |||
37 | enum mipi_dsim_virtual_ch_no { | ||
38 | DSIM_VIRTUAL_CH_0, | ||
39 | DSIM_VIRTUAL_CH_1, | ||
40 | DSIM_VIRTUAL_CH_2, | ||
41 | DSIM_VIRTUAL_CH_3 | ||
42 | }; | ||
43 | |||
44 | enum mipi_dsim_burst_mode_type { | ||
45 | DSIM_NON_BURST_SYNC_EVENT, | ||
46 | DSIM_BURST_SYNC_EVENT, | ||
47 | DSIM_NON_BURST_SYNC_PULSE, | ||
48 | DSIM_BURST, | ||
49 | DSIM_NON_VIDEO_MODE | ||
50 | }; | ||
51 | |||
52 | enum mipi_dsim_no_of_data_lane { | ||
53 | DSIM_DATA_LANE_1, | ||
54 | DSIM_DATA_LANE_2, | ||
55 | DSIM_DATA_LANE_3, | ||
56 | DSIM_DATA_LANE_4 | ||
57 | }; | ||
58 | |||
59 | enum mipi_dsim_byte_clk_src { | ||
60 | DSIM_PLL_OUT_DIV8, | ||
61 | DSIM_EXT_CLK_DIV8, | ||
62 | DSIM_EXT_CLK_BYPASS | ||
63 | }; | ||
64 | |||
65 | enum mipi_dsim_pixel_format { | ||
66 | DSIM_CMD_3BPP, | ||
67 | DSIM_CMD_8BPP, | ||
68 | DSIM_CMD_12BPP, | ||
69 | DSIM_CMD_16BPP, | ||
70 | DSIM_VID_16BPP_565, | ||
71 | DSIM_VID_18BPP_666PACKED, | ||
72 | DSIM_18BPP_666LOOSELYPACKED, | ||
73 | DSIM_24BPP_888 | ||
74 | }; | ||
75 | |||
76 | /* | ||
77 | * struct mipi_dsim_config - interface for configuring mipi-dsi controller. | ||
78 | * | ||
79 | * @auto_flush: enable or disable Auto flush of MD FIFO using VSYNC pulse. | ||
80 | * @eot_disable: enable or disable EoT packet in HS mode. | ||
81 | * @auto_vertical_cnt: specifies auto vertical count mode. | ||
82 | * in Video mode, the vertical line transition uses line counter | ||
83 | * configured by VSA, VBP, and Vertical resolution. | ||
84 | * If this bit is set to '1', the line counter does not use VSA and VBP | ||
85 | * registers.(in command mode, this variable is ignored) | ||
86 | * @hse: set horizontal sync event mode. | ||
87 | * In VSYNC pulse and Vporch area, MIPI DSI master transfers only HSYNC | ||
88 | * start packet to MIPI DSI slave at MIPI DSI spec1.1r02. | ||
89 | * this bit transfers HSYNC end packet in VSYNC pulse and Vporch area | ||
90 | * (in mommand mode, this variable is ignored) | ||
91 | * @hfp: specifies HFP disable mode. | ||
92 | * if this variable is set, DSI master ignores HFP area in VIDEO mode. | ||
93 | * (in command mode, this variable is ignored) | ||
94 | * @hbp: specifies HBP disable mode. | ||
95 | * if this variable is set, DSI master ignores HBP area in VIDEO mode. | ||
96 | * (in command mode, this variable is ignored) | ||
97 | * @hsa: specifies HSA disable mode. | ||
98 | * if this variable is set, DSI master ignores HSA area in VIDEO mode. | ||
99 | * (in command mode, this variable is ignored) | ||
100 | * @cma_allow: specifies the number of horizontal lines, where command packet | ||
101 | * transmission is allowed after Stable VFP period. | ||
102 | * @e_interface: specifies interface to be used.(CPU or RGB interface) | ||
103 | * @e_virtual_ch: specifies virtual channel number that main or | ||
104 | * sub diaplsy uses. | ||
105 | * @e_pixel_format: specifies pixel stream format for main or sub display. | ||
106 | * @e_burst_mode: selects Burst mode in Video mode. | ||
107 | * in Non-burst mode, RGB data area is filled with RGB data and NULL | ||
108 | * packets, according to input bandwidth of RGB interface. | ||
109 | * In Burst mode, RGB data area is filled with RGB data only. | ||
110 | * @e_no_data_lane: specifies data lane count to be used by Master. | ||
111 | * @e_byte_clk: select byte clock source. (it must be DSIM_PLL_OUT_DIV8) | ||
112 | * DSIM_EXT_CLK_DIV8 and DSIM_EXT_CLK_BYPASSS are not supported. | ||
113 | * @pll_stable_time: specifies the PLL Timer for stability of the ganerated | ||
114 | * clock(System clock cycle base) | ||
115 | * if the timer value goes to 0x00000000, the clock stable bit of status | ||
116 | * and interrupt register is set. | ||
117 | * @esc_clk: specifies escape clock frequency for getting the escape clock | ||
118 | * prescaler value. | ||
119 | * @stop_holding_cnt: specifies the interval value between transmitting | ||
120 | * read packet(or write "set_tear_on" command) and BTA request. | ||
121 | * after transmitting read packet or write "set_tear_on" command, | ||
122 | * BTA requests to D-PHY automatically. this counter value specifies | ||
123 | * the interval between them. | ||
124 | * @bta_timeout: specifies the timer for BTA. | ||
125 | * this register specifies time out from BTA request to change | ||
126 | * the direction with respect to Tx escape clock. | ||
127 | * @rx_timeout: specifies the timer for LP Rx mode timeout. | ||
128 | * this register specifies time out on how long RxValid deasserts, | ||
129 | * after RxLpdt asserts with respect to Tx escape clock. | ||
130 | * - RxValid specifies Rx data valid indicator. | ||
131 | * - RxLpdt specifies an indicator that D-PHY is under RxLpdt mode. | ||
132 | * - RxValid and RxLpdt specifies signal from D-PHY. | ||
133 | */ | ||
134 | struct mipi_dsim_config { | ||
135 | unsigned char auto_flush; | ||
136 | unsigned char eot_disable; | ||
137 | |||
138 | unsigned char auto_vertical_cnt; | ||
139 | unsigned char hse; | ||
140 | unsigned char hfp; | ||
141 | unsigned char hbp; | ||
142 | unsigned char hsa; | ||
143 | unsigned char cmd_allow; | ||
144 | |||
145 | enum mipi_dsim_interface_type e_interface; | ||
146 | enum mipi_dsim_virtual_ch_no e_virtual_ch; | ||
147 | enum mipi_dsim_pixel_format e_pixel_format; | ||
148 | enum mipi_dsim_burst_mode_type e_burst_mode; | ||
149 | enum mipi_dsim_no_of_data_lane e_no_data_lane; | ||
150 | enum mipi_dsim_byte_clk_src e_byte_clk; | ||
151 | |||
152 | /* | ||
153 | * =========================================== | ||
154 | * | P | M | S | MHz | | ||
155 | * ------------------------------------------- | ||
156 | * | 3 | 100 | 3 | 100 | | ||
157 | * | 3 | 100 | 2 | 200 | | ||
158 | * | 3 | 63 | 1 | 252 | | ||
159 | * | 4 | 100 | 1 | 300 | | ||
160 | * | 4 | 110 | 1 | 330 | | ||
161 | * | 12 | 350 | 1 | 350 | | ||
162 | * | 3 | 100 | 1 | 400 | | ||
163 | * | 4 | 150 | 1 | 450 | | ||
164 | * | 6 | 118 | 1 | 472 | | ||
165 | * | 3 | 120 | 1 | 480 | | ||
166 | * | 12 | 250 | 0 | 500 | | ||
167 | * | 4 | 100 | 0 | 600 | | ||
168 | * | 3 | 81 | 0 | 648 | | ||
169 | * | 3 | 88 | 0 | 704 | | ||
170 | * | 3 | 90 | 0 | 720 | | ||
171 | * | 3 | 100 | 0 | 800 | | ||
172 | * | 12 | 425 | 0 | 850 | | ||
173 | * | 4 | 150 | 0 | 900 | | ||
174 | * | 12 | 475 | 0 | 950 | | ||
175 | * | 6 | 250 | 0 | 1000 | | ||
176 | * ------------------------------------------- | ||
177 | */ | ||
178 | |||
179 | /* | ||
180 | * pms could be calculated as the following. | ||
181 | * M * 24 / P * 2 ^ S = MHz | ||
182 | */ | ||
183 | unsigned char p; | ||
184 | unsigned short m; | ||
185 | unsigned char s; | ||
186 | |||
187 | unsigned int pll_stable_time; | ||
188 | unsigned long esc_clk; | ||
189 | |||
190 | unsigned short stop_holding_cnt; | ||
191 | unsigned char bta_timeout; | ||
192 | unsigned short rx_timeout; | ||
193 | }; | ||
194 | |||
195 | /* | ||
196 | * struct mipi_dsim_device - global interface for mipi-dsi driver. | ||
197 | * | ||
198 | * @dev: driver model representation of the device. | ||
199 | * @id: unique device id. | ||
200 | * @clock: pointer to MIPI-DSI clock of clock framework. | ||
201 | * @irq: interrupt number to MIPI-DSI controller. | ||
202 | * @reg_base: base address to memory mapped SRF of MIPI-DSI controller. | ||
203 | * (virtual address) | ||
204 | * @lock: the mutex protecting this data structure. | ||
205 | * @dsim_info: infomation for configuring mipi-dsi controller. | ||
206 | * @master_ops: callbacks to mipi-dsi operations. | ||
207 | * @dsim_lcd_dev: pointer to activated ddi device. | ||
208 | * (it would be registered by mipi-dsi driver.) | ||
209 | * @dsim_lcd_drv: pointer to activated_ddi driver. | ||
210 | * (it would be registered by mipi-dsi driver.) | ||
211 | * @lcd_info: pointer to mipi_lcd_info structure. | ||
212 | * @state: specifies status of MIPI-DSI controller. | ||
213 | * the status could be RESET, INIT, STOP, HSCLKEN and ULPS. | ||
214 | * @data_lane: specifiec enabled data lane number. | ||
215 | * this variable would be set by driver according to e_no_data_lane | ||
216 | * automatically. | ||
217 | * @e_clk_src: select byte clock source. | ||
218 | * @pd: pointer to MIPI-DSI driver platform data. | ||
219 | */ | ||
220 | struct mipi_dsim_device { | ||
221 | struct device *dev; | ||
222 | int id; | ||
223 | struct resource *res; | ||
224 | struct clk *clock; | ||
225 | unsigned int irq; | ||
226 | void __iomem *reg_base; | ||
227 | struct mutex lock; | ||
228 | |||
229 | struct mipi_dsim_config *dsim_config; | ||
230 | struct mipi_dsim_master_ops *master_ops; | ||
231 | struct mipi_dsim_lcd_device *dsim_lcd_dev; | ||
232 | struct mipi_dsim_lcd_driver *dsim_lcd_drv; | ||
233 | |||
234 | unsigned int state; | ||
235 | unsigned int data_lane; | ||
236 | unsigned int e_clk_src; | ||
237 | bool suspended; | ||
238 | |||
239 | struct mipi_dsim_platform_data *pd; | ||
240 | }; | ||
241 | |||
242 | /* | ||
243 | * struct mipi_dsim_platform_data - interface to platform data | ||
244 | * for mipi-dsi driver. | ||
245 | * | ||
246 | * @lcd_panel_name: specifies lcd panel name registered to mipi-dsi driver. | ||
247 | * lcd panel driver searched would be actived. | ||
248 | * @dsim_config: pointer of structure for configuring mipi-dsi controller. | ||
249 | * @enabled: indicate whether mipi controller got enabled or not. | ||
250 | * @lcd_panel_info: pointer for lcd panel specific structure. | ||
251 | * this structure specifies width, height, timing and polarity and so on. | ||
252 | * @phy_enable: pointer to a callback controlling D-PHY enable/reset | ||
253 | */ | ||
254 | struct mipi_dsim_platform_data { | ||
255 | char lcd_panel_name[PANEL_NAME_SIZE]; | ||
256 | |||
257 | struct mipi_dsim_config *dsim_config; | ||
258 | unsigned int enabled; | ||
259 | void *lcd_panel_info; | ||
260 | |||
261 | int (*phy_enable)(struct platform_device *pdev, bool on); | ||
262 | }; | ||
263 | |||
264 | /* | ||
265 | * struct mipi_dsim_master_ops - callbacks to mipi-dsi operations. | ||
266 | * | ||
267 | * @cmd_write: transfer command to lcd panel at LP mode. | ||
268 | * @cmd_read: read command from rx register. | ||
269 | * @get_dsim_frame_done: get the status that all screen data have been | ||
270 | * transferred to mipi-dsi. | ||
271 | * @clear_dsim_frame_done: clear frame done status. | ||
272 | * @get_fb_frame_done: get frame done status of display controller. | ||
273 | * @trigger: trigger display controller. | ||
274 | * - this one would be used only in case of CPU mode. | ||
275 | * @set_early_blank_mode: set framebuffer blank mode. | ||
276 | * - this callback should be called prior to fb_blank() by a client driver | ||
277 | * only if needing. | ||
278 | * @set_blank_mode: set framebuffer blank mode. | ||
279 | * - this callback should be called after fb_blank() by a client driver | ||
280 | * only if needing. | ||
281 | */ | ||
282 | |||
283 | struct mipi_dsim_master_ops { | ||
284 | int (*cmd_write)(struct mipi_dsim_device *dsim, unsigned int data_id, | ||
285 | const unsigned char *data0, unsigned int data1); | ||
286 | int (*cmd_read)(struct mipi_dsim_device *dsim, unsigned int data_id, | ||
287 | unsigned int data0, unsigned int req_size, u8 *rx_buf); | ||
288 | int (*get_dsim_frame_done)(struct mipi_dsim_device *dsim); | ||
289 | int (*clear_dsim_frame_done)(struct mipi_dsim_device *dsim); | ||
290 | |||
291 | int (*get_fb_frame_done)(struct fb_info *info); | ||
292 | void (*trigger)(struct fb_info *info); | ||
293 | int (*set_early_blank_mode)(struct mipi_dsim_device *dsim, int power); | ||
294 | int (*set_blank_mode)(struct mipi_dsim_device *dsim, int power); | ||
295 | }; | ||
296 | |||
297 | /* | ||
298 | * device structure for mipi-dsi based lcd panel. | ||
299 | * | ||
300 | * @name: name of the device to use with this device, or an | ||
301 | * alias for that name. | ||
302 | * @dev: driver model representation of the device. | ||
303 | * @id: id of device to be registered. | ||
304 | * @bus_id: bus id for identifing connected bus | ||
305 | * and this bus id should be same as id of mipi_dsim_device. | ||
306 | * @irq: irq number for signaling when framebuffer transfer of | ||
307 | * lcd panel module is completed. | ||
308 | * this irq would be used only for MIPI-DSI based CPU mode lcd panel. | ||
309 | * @master: pointer to mipi-dsi master device object. | ||
310 | * @platform_data: lcd panel specific platform data. | ||
311 | */ | ||
312 | struct mipi_dsim_lcd_device { | ||
313 | char *name; | ||
314 | struct device dev; | ||
315 | int id; | ||
316 | int bus_id; | ||
317 | int irq; | ||
318 | |||
319 | struct mipi_dsim_device *master; | ||
320 | void *platform_data; | ||
321 | }; | ||
322 | |||
323 | /* | ||
324 | * driver structure for mipi-dsi based lcd panel. | ||
325 | * | ||
326 | * this structure should be registered by lcd panel driver. | ||
327 | * mipi-dsi driver seeks lcd panel registered through name field | ||
328 | * and calls these callback functions in appropriate time. | ||
329 | * | ||
330 | * @name: name of the driver to use with this device, or an | ||
331 | * alias for that name. | ||
332 | * @id: id of driver to be registered. | ||
333 | * this id would be used for finding device object registered. | ||
334 | */ | ||
335 | struct mipi_dsim_lcd_driver { | ||
336 | char *name; | ||
337 | int id; | ||
338 | |||
339 | void (*power_on)(struct mipi_dsim_lcd_device *dsim_dev, int enable); | ||
340 | void (*set_sequence)(struct mipi_dsim_lcd_device *dsim_dev); | ||
341 | int (*probe)(struct mipi_dsim_lcd_device *dsim_dev); | ||
342 | int (*remove)(struct mipi_dsim_lcd_device *dsim_dev); | ||
343 | void (*shutdown)(struct mipi_dsim_lcd_device *dsim_dev); | ||
344 | int (*suspend)(struct mipi_dsim_lcd_device *dsim_dev); | ||
345 | int (*resume)(struct mipi_dsim_lcd_device *dsim_dev); | ||
346 | }; | ||
347 | |||
348 | /* | ||
349 | * register mipi_dsim_lcd_device to mipi-dsi master. | ||
350 | */ | ||
351 | int exynos_mipi_dsi_register_lcd_device(struct mipi_dsim_lcd_device | ||
352 | *lcd_dev); | ||
353 | /** | ||
354 | * register mipi_dsim_lcd_driver object defined by lcd panel driver | ||
355 | * to mipi-dsi driver. | ||
356 | */ | ||
357 | int exynos_mipi_dsi_register_lcd_driver(struct mipi_dsim_lcd_driver | ||
358 | *lcd_drv); | ||
359 | #endif /* _EXYNOS_MIPI_DSIM_H */ | ||
diff --git a/include/video/sa1100fb.h b/include/video/sa1100fb.h new file mode 100644 index 000000000000..4ab409653785 --- /dev/null +++ b/include/video/sa1100fb.h | |||
@@ -0,0 +1,63 @@ | |||
1 | /* | ||
2 | * StrongARM 1100 LCD Controller Frame Buffer Device | ||
3 | * | ||
4 | * Copyright (C) 1999 Eric A. Thomas | ||
5 | * Based on acornfb.c Copyright (C) Russell King. | ||
6 | * | ||
7 | * This file is subject to the terms and conditions of the GNU General Public | ||
8 | * License. See the file COPYING in the main directory of this archive | ||
9 | * for more details. | ||
10 | */ | ||
11 | #ifndef _VIDEO_SA1100FB_H | ||
12 | #define _VIDEO_SA1100FB_H | ||
13 | |||
14 | #include <linux/fb.h> | ||
15 | #include <linux/types.h> | ||
16 | |||
17 | #define RGB_4 0 | ||
18 | #define RGB_8 1 | ||
19 | #define RGB_16 2 | ||
20 | #define NR_RGB 3 | ||
21 | |||
22 | /* These are the bitfields for each display depth that we support. */ | ||
23 | struct sa1100fb_rgb { | ||
24 | struct fb_bitfield red; | ||
25 | struct fb_bitfield green; | ||
26 | struct fb_bitfield blue; | ||
27 | struct fb_bitfield transp; | ||
28 | }; | ||
29 | |||
30 | /* This structure describes the machine which we are running on. */ | ||
31 | struct sa1100fb_mach_info { | ||
32 | u_long pixclock; | ||
33 | |||
34 | u_short xres; | ||
35 | u_short yres; | ||
36 | |||
37 | u_char bpp; | ||
38 | u_char hsync_len; | ||
39 | u_char left_margin; | ||
40 | u_char right_margin; | ||
41 | |||
42 | u_char vsync_len; | ||
43 | u_char upper_margin; | ||
44 | u_char lower_margin; | ||
45 | u_char sync; | ||
46 | |||
47 | u_int cmap_greyscale:1, | ||
48 | cmap_inverse:1, | ||
49 | cmap_static:1, | ||
50 | unused:29; | ||
51 | |||
52 | u_int lccr0; | ||
53 | u_int lccr3; | ||
54 | |||
55 | /* Overrides for the default RGB maps */ | ||
56 | const struct sa1100fb_rgb *rgb[NR_RGB]; | ||
57 | |||
58 | void (*backlight_power)(int); | ||
59 | void (*lcd_power)(int); | ||
60 | void (*set_visual)(u32); | ||
61 | }; | ||
62 | |||
63 | #endif | ||
diff --git a/include/video/sh_mipi_dsi.h b/include/video/sh_mipi_dsi.h index 434d56b4a1a5..06c67fbc4eee 100644 --- a/include/video/sh_mipi_dsi.h +++ b/include/video/sh_mipi_dsi.h | |||
@@ -51,6 +51,7 @@ struct sh_mipi_dsi_info { | |||
51 | int lane; | 51 | int lane; |
52 | unsigned long flags; | 52 | unsigned long flags; |
53 | u32 clksrc; | 53 | u32 clksrc; |
54 | u32 phyctrl; /* for extra setting */ | ||
54 | unsigned int vsynw_offset; | 55 | unsigned int vsynw_offset; |
55 | int (*set_dot_clock)(struct platform_device *pdev, | 56 | int (*set_dot_clock)(struct platform_device *pdev, |
56 | void __iomem *base, | 57 | void __iomem *base, |
diff --git a/include/video/sh_mobile_hdmi.h b/include/video/sh_mobile_hdmi.h index b56932927d0a..728f9de9c258 100644 --- a/include/video/sh_mobile_hdmi.h +++ b/include/video/sh_mobile_hdmi.h | |||
@@ -31,8 +31,6 @@ struct clk; | |||
31 | #define HDMI_SND_SRC_HBR (3 << 0) | 31 | #define HDMI_SND_SRC_HBR (3 << 0) |
32 | 32 | ||
33 | struct sh_mobile_hdmi_info { | 33 | struct sh_mobile_hdmi_info { |
34 | struct sh_mobile_lcdc_chan_cfg *lcd_chan; | ||
35 | struct device *lcd_dev; | ||
36 | unsigned int flags; | 34 | unsigned int flags; |
37 | long (*clk_optimize_parent)(unsigned long target, unsigned long *best_freq, | 35 | long (*clk_optimize_parent)(unsigned long target, unsigned long *best_freq, |
38 | unsigned long *parent_freq); | 36 | unsigned long *parent_freq); |
diff --git a/include/video/sh_mobile_lcdc.h b/include/video/sh_mobile_lcdc.h index fe30b759c51e..7571b27a0ba1 100644 --- a/include/video/sh_mobile_lcdc.h +++ b/include/video/sh_mobile_lcdc.h | |||
@@ -147,29 +147,23 @@ struct sh_mobile_lcdc_sys_bus_ops { | |||
147 | unsigned long (*read_data)(void *handle); | 147 | unsigned long (*read_data)(void *handle); |
148 | }; | 148 | }; |
149 | 149 | ||
150 | struct module; | 150 | struct sh_mobile_lcdc_panel_cfg { |
151 | struct sh_mobile_lcdc_board_cfg { | 151 | unsigned long width; /* Panel width in mm */ |
152 | struct module *owner; | 152 | unsigned long height; /* Panel height in mm */ |
153 | void *board_data; | 153 | int (*setup_sys)(void *sys_ops_handle, |
154 | int (*setup_sys)(void *board_data, void *sys_ops_handle, | ||
155 | struct sh_mobile_lcdc_sys_bus_ops *sys_ops); | 154 | struct sh_mobile_lcdc_sys_bus_ops *sys_ops); |
156 | void (*start_transfer)(void *board_data, void *sys_ops_handle, | 155 | void (*start_transfer)(void *sys_ops_handle, |
157 | struct sh_mobile_lcdc_sys_bus_ops *sys_ops); | 156 | struct sh_mobile_lcdc_sys_bus_ops *sys_ops); |
158 | void (*display_on)(void *board_data, struct fb_info *info); | 157 | void (*display_on)(void); |
159 | void (*display_off)(void *board_data); | 158 | void (*display_off)(void); |
160 | int (*set_brightness)(void *board_data, int brightness); | ||
161 | int (*get_brightness)(void *board_data); | ||
162 | }; | ||
163 | |||
164 | struct sh_mobile_lcdc_lcd_size_cfg { /* width and height of panel in mm */ | ||
165 | unsigned long width; | ||
166 | unsigned long height; | ||
167 | }; | 159 | }; |
168 | 160 | ||
169 | /* backlight info */ | 161 | /* backlight info */ |
170 | struct sh_mobile_lcdc_bl_info { | 162 | struct sh_mobile_lcdc_bl_info { |
171 | const char *name; | 163 | const char *name; |
172 | int max_brightness; | 164 | int max_brightness; |
165 | int (*set_brightness)(int brightness); | ||
166 | int (*get_brightness)(void); | ||
173 | }; | 167 | }; |
174 | 168 | ||
175 | struct sh_mobile_lcdc_chan_cfg { | 169 | struct sh_mobile_lcdc_chan_cfg { |
@@ -179,13 +173,14 @@ struct sh_mobile_lcdc_chan_cfg { | |||
179 | int interface_type; /* selects RGBn or SYSn I/F, see above */ | 173 | int interface_type; /* selects RGBn or SYSn I/F, see above */ |
180 | int clock_divider; | 174 | int clock_divider; |
181 | unsigned long flags; /* LCDC_FLAGS_... */ | 175 | unsigned long flags; /* LCDC_FLAGS_... */ |
182 | const struct fb_videomode *lcd_cfg; | 176 | const struct fb_videomode *lcd_modes; |
183 | int num_cfg; | 177 | int num_modes; |
184 | struct sh_mobile_lcdc_lcd_size_cfg lcd_size_cfg; | 178 | struct sh_mobile_lcdc_panel_cfg panel_cfg; |
185 | struct sh_mobile_lcdc_board_cfg board_cfg; | ||
186 | struct sh_mobile_lcdc_bl_info bl_info; | 179 | struct sh_mobile_lcdc_bl_info bl_info; |
187 | struct sh_mobile_lcdc_sys_bus_cfg sys_bus_cfg; /* only for SYSn I/F */ | 180 | struct sh_mobile_lcdc_sys_bus_cfg sys_bus_cfg; /* only for SYSn I/F */ |
188 | struct sh_mobile_meram_cfg *meram_cfg; | 181 | const struct sh_mobile_meram_cfg *meram_cfg; |
182 | |||
183 | struct platform_device *tx_dev; /* HDMI/DSI transmitter device */ | ||
189 | }; | 184 | }; |
190 | 185 | ||
191 | struct sh_mobile_lcdc_info { | 186 | struct sh_mobile_lcdc_info { |
diff --git a/include/video/sh_mobile_meram.h b/include/video/sh_mobile_meram.h index af602d602b28..29b2fd3b147e 100644 --- a/include/video/sh_mobile_meram.h +++ b/include/video/sh_mobile_meram.h | |||
@@ -17,52 +17,47 @@ enum { | |||
17 | struct sh_mobile_meram_priv; | 17 | struct sh_mobile_meram_priv; |
18 | struct sh_mobile_meram_ops; | 18 | struct sh_mobile_meram_ops; |
19 | 19 | ||
20 | /* | ||
21 | * struct sh_mobile_meram_info - MERAM platform data | ||
22 | * @reserved_icbs: Bitmask of reserved ICBs (for instance used through UIO) | ||
23 | */ | ||
20 | struct sh_mobile_meram_info { | 24 | struct sh_mobile_meram_info { |
21 | int addr_mode; | 25 | int addr_mode; |
26 | u32 reserved_icbs; | ||
22 | struct sh_mobile_meram_ops *ops; | 27 | struct sh_mobile_meram_ops *ops; |
23 | struct sh_mobile_meram_priv *priv; | 28 | struct sh_mobile_meram_priv *priv; |
24 | struct platform_device *pdev; | 29 | struct platform_device *pdev; |
25 | }; | 30 | }; |
26 | 31 | ||
27 | /* icb config */ | 32 | /* icb config */ |
28 | struct sh_mobile_meram_icb { | 33 | struct sh_mobile_meram_icb_cfg { |
29 | int marker_icb; /* ICB # for Marker ICB */ | 34 | unsigned int meram_size; /* MERAM Buffer Size to use */ |
30 | int cache_icb; /* ICB # for Cache ICB */ | ||
31 | int meram_offset; /* MERAM Buffer Offset to use */ | ||
32 | int meram_size; /* MERAM Buffer Size to use */ | ||
33 | |||
34 | int cache_unit; /* bytes to cache per ICB */ | ||
35 | }; | 35 | }; |
36 | 36 | ||
37 | struct sh_mobile_meram_cfg { | 37 | struct sh_mobile_meram_cfg { |
38 | struct sh_mobile_meram_icb icb[2]; | 38 | struct sh_mobile_meram_icb_cfg icb[2]; |
39 | int pixelformat; | ||
40 | int current_reg; | ||
41 | }; | 39 | }; |
42 | 40 | ||
43 | struct module; | 41 | struct module; |
44 | struct sh_mobile_meram_ops { | 42 | struct sh_mobile_meram_ops { |
45 | struct module *module; | 43 | struct module *module; |
46 | /* register usage of meram */ | 44 | /* register usage of meram */ |
47 | int (*meram_register)(struct sh_mobile_meram_info *meram_dev, | 45 | void *(*meram_register)(struct sh_mobile_meram_info *meram_dev, |
48 | struct sh_mobile_meram_cfg *cfg, | 46 | const struct sh_mobile_meram_cfg *cfg, |
49 | int xres, int yres, int pixelformat, | 47 | unsigned int xres, unsigned int yres, |
50 | unsigned long base_addr_y, | 48 | unsigned int pixelformat, |
51 | unsigned long base_addr_c, | 49 | unsigned int *pitch); |
52 | unsigned long *icb_addr_y, | ||
53 | unsigned long *icb_addr_c, int *pitch); | ||
54 | 50 | ||
55 | /* unregister usage of meram */ | 51 | /* unregister usage of meram */ |
56 | int (*meram_unregister)(struct sh_mobile_meram_info *meram_dev, | 52 | void (*meram_unregister)(struct sh_mobile_meram_info *meram_dev, |
57 | struct sh_mobile_meram_cfg *cfg); | 53 | void *data); |
58 | 54 | ||
59 | /* update meram settings */ | 55 | /* update meram settings */ |
60 | int (*meram_update)(struct sh_mobile_meram_info *meram_dev, | 56 | void (*meram_update)(struct sh_mobile_meram_info *meram_dev, void *data, |
61 | struct sh_mobile_meram_cfg *cfg, | 57 | unsigned long base_addr_y, |
62 | unsigned long base_addr_y, | 58 | unsigned long base_addr_c, |
63 | unsigned long base_addr_c, | 59 | unsigned long *icb_addr_y, |
64 | unsigned long *icb_addr_y, | 60 | unsigned long *icb_addr_c); |
65 | unsigned long *icb_addr_c); | ||
66 | }; | 61 | }; |
67 | 62 | ||
68 | #endif /* __VIDEO_SH_MOBILE_MERAM_H__ */ | 63 | #endif /* __VIDEO_SH_MOBILE_MERAM_H__ */ |
diff --git a/include/video/udlfb.h b/include/video/udlfb.h index c41f308c9636..f9466fa54ba4 100644 --- a/include/video/udlfb.h +++ b/include/video/udlfb.h | |||
@@ -41,6 +41,7 @@ struct dlfb_data { | |||
41 | char *backing_buffer; | 41 | char *backing_buffer; |
42 | int fb_count; | 42 | int fb_count; |
43 | bool virtualized; /* true when physical usb device not present */ | 43 | bool virtualized; /* true when physical usb device not present */ |
44 | struct delayed_work init_framebuffer_work; | ||
44 | struct delayed_work free_framebuffer_work; | 45 | struct delayed_work free_framebuffer_work; |
45 | atomic_t usb_active; /* 0 = update virtual buffer, but no usb traffic */ | 46 | atomic_t usb_active; /* 0 = update virtual buffer, but no usb traffic */ |
46 | atomic_t lost_pixels; /* 1 = a render op failed. Need screen refresh */ | 47 | atomic_t lost_pixels; /* 1 = a render op failed. Need screen refresh */ |
diff --git a/include/xen/interface/hvm/params.h b/include/xen/interface/hvm/params.h index 1888d8c157e6..1b4f923d7086 100644 --- a/include/xen/interface/hvm/params.h +++ b/include/xen/interface/hvm/params.h | |||
@@ -90,6 +90,10 @@ | |||
90 | /* Boolean: Enable aligning all periodic vpts to reduce interrupts */ | 90 | /* Boolean: Enable aligning all periodic vpts to reduce interrupts */ |
91 | #define HVM_PARAM_VPT_ALIGN 16 | 91 | #define HVM_PARAM_VPT_ALIGN 16 |
92 | 92 | ||
93 | #define HVM_NR_PARAMS 17 | 93 | /* Console debug shared memory ring and event channel */ |
94 | #define HVM_PARAM_CONSOLE_PFN 17 | ||
95 | #define HVM_PARAM_CONSOLE_EVTCHN 18 | ||
96 | |||
97 | #define HVM_NR_PARAMS 19 | ||
94 | 98 | ||
95 | #endif /* __XEN_PUBLIC_HVM_PARAMS_H__ */ | 99 | #endif /* __XEN_PUBLIC_HVM_PARAMS_H__ */ |
diff --git a/include/xen/interface/physdev.h b/include/xen/interface/physdev.h index c1080d9c705d..9ce788d8cf49 100644 --- a/include/xen/interface/physdev.h +++ b/include/xen/interface/physdev.h | |||
@@ -39,6 +39,27 @@ struct physdev_eoi { | |||
39 | }; | 39 | }; |
40 | 40 | ||
41 | /* | 41 | /* |
42 | * Register a shared page for the hypervisor to indicate whether the guest | ||
43 | * must issue PHYSDEVOP_eoi. The semantics of PHYSDEVOP_eoi change slightly | ||
44 | * once the guest used this function in that the associated event channel | ||
45 | * will automatically get unmasked. The page registered is used as a bit | ||
46 | * array indexed by Xen's PIRQ value. | ||
47 | */ | ||
48 | #define PHYSDEVOP_pirq_eoi_gmfn_v1 17 | ||
49 | /* | ||
50 | * Register a shared page for the hypervisor to indicate whether the | ||
51 | * guest must issue PHYSDEVOP_eoi. This hypercall is very similar to | ||
52 | * PHYSDEVOP_pirq_eoi_gmfn_v1 but it doesn't change the semantics of | ||
53 | * PHYSDEVOP_eoi. The page registered is used as a bit array indexed by | ||
54 | * Xen's PIRQ value. | ||
55 | */ | ||
56 | #define PHYSDEVOP_pirq_eoi_gmfn_v2 28 | ||
57 | struct physdev_pirq_eoi_gmfn { | ||
58 | /* IN */ | ||
59 | unsigned long gmfn; | ||
60 | }; | ||
61 | |||
62 | /* | ||
42 | * Query the status of an IRQ line. | 63 | * Query the status of an IRQ line. |
43 | * @arg == pointer to physdev_irq_status_query structure. | 64 | * @arg == pointer to physdev_irq_status_query structure. |
44 | */ | 65 | */ |
@@ -145,6 +166,13 @@ struct physdev_manage_pci { | |||
145 | uint8_t devfn; | 166 | uint8_t devfn; |
146 | }; | 167 | }; |
147 | 168 | ||
169 | #define PHYSDEVOP_restore_msi 19 | ||
170 | struct physdev_restore_msi { | ||
171 | /* IN */ | ||
172 | uint8_t bus; | ||
173 | uint8_t devfn; | ||
174 | }; | ||
175 | |||
148 | #define PHYSDEVOP_manage_pci_add_ext 20 | 176 | #define PHYSDEVOP_manage_pci_add_ext 20 |
149 | struct physdev_manage_pci_ext { | 177 | struct physdev_manage_pci_ext { |
150 | /* IN */ | 178 | /* IN */ |
diff --git a/include/xen/interface/platform.h b/include/xen/interface/platform.h index c1684680431b..486653f0dd8f 100644 --- a/include/xen/interface/platform.h +++ b/include/xen/interface/platform.h | |||
@@ -200,7 +200,7 @@ DEFINE_GUEST_HANDLE_STRUCT(xenpf_getidletime_t); | |||
200 | #define XEN_PM_CX 0 | 200 | #define XEN_PM_CX 0 |
201 | #define XEN_PM_PX 1 | 201 | #define XEN_PM_PX 1 |
202 | #define XEN_PM_TX 2 | 202 | #define XEN_PM_TX 2 |
203 | 203 | #define XEN_PM_PDC 3 | |
204 | /* Px sub info type */ | 204 | /* Px sub info type */ |
205 | #define XEN_PX_PCT 1 | 205 | #define XEN_PX_PCT 1 |
206 | #define XEN_PX_PSS 2 | 206 | #define XEN_PX_PSS 2 |
@@ -293,10 +293,27 @@ struct xenpf_set_processor_pminfo { | |||
293 | union { | 293 | union { |
294 | struct xen_processor_power power;/* Cx: _CST/_CSD */ | 294 | struct xen_processor_power power;/* Cx: _CST/_CSD */ |
295 | struct xen_processor_performance perf; /* Px: _PPC/_PCT/_PSS/_PSD */ | 295 | struct xen_processor_performance perf; /* Px: _PPC/_PCT/_PSS/_PSD */ |
296 | GUEST_HANDLE(uint32_t) pdc; | ||
296 | }; | 297 | }; |
297 | }; | 298 | }; |
298 | DEFINE_GUEST_HANDLE_STRUCT(xenpf_set_processor_pminfo); | 299 | DEFINE_GUEST_HANDLE_STRUCT(xenpf_set_processor_pminfo); |
299 | 300 | ||
301 | #define XENPF_get_cpuinfo 55 | ||
302 | struct xenpf_pcpuinfo { | ||
303 | /* IN */ | ||
304 | uint32_t xen_cpuid; | ||
305 | /* OUT */ | ||
306 | /* The maxium cpu_id that is present */ | ||
307 | uint32_t max_present; | ||
308 | #define XEN_PCPU_FLAGS_ONLINE 1 | ||
309 | /* Correponding xen_cpuid is not present*/ | ||
310 | #define XEN_PCPU_FLAGS_INVALID 2 | ||
311 | uint32_t flags; | ||
312 | uint32_t apic_id; | ||
313 | uint32_t acpi_id; | ||
314 | }; | ||
315 | DEFINE_GUEST_HANDLE_STRUCT(xenpf_pcpuinfo); | ||
316 | |||
300 | struct xen_platform_op { | 317 | struct xen_platform_op { |
301 | uint32_t cmd; | 318 | uint32_t cmd; |
302 | uint32_t interface_version; /* XENPF_INTERFACE_VERSION */ | 319 | uint32_t interface_version; /* XENPF_INTERFACE_VERSION */ |
@@ -312,6 +329,7 @@ struct xen_platform_op { | |||
312 | struct xenpf_change_freq change_freq; | 329 | struct xenpf_change_freq change_freq; |
313 | struct xenpf_getidletime getidletime; | 330 | struct xenpf_getidletime getidletime; |
314 | struct xenpf_set_processor_pminfo set_pminfo; | 331 | struct xenpf_set_processor_pminfo set_pminfo; |
332 | struct xenpf_pcpuinfo pcpu_info; | ||
315 | uint8_t pad[128]; | 333 | uint8_t pad[128]; |
316 | } u; | 334 | } u; |
317 | }; | 335 | }; |
diff --git a/include/xen/swiotlb-xen.h b/include/xen/swiotlb-xen.h index 2ea2fdc79c16..4f4d449f00f6 100644 --- a/include/xen/swiotlb-xen.h +++ b/include/xen/swiotlb-xen.h | |||
@@ -7,11 +7,13 @@ extern void xen_swiotlb_init(int verbose); | |||
7 | 7 | ||
8 | extern void | 8 | extern void |
9 | *xen_swiotlb_alloc_coherent(struct device *hwdev, size_t size, | 9 | *xen_swiotlb_alloc_coherent(struct device *hwdev, size_t size, |
10 | dma_addr_t *dma_handle, gfp_t flags); | 10 | dma_addr_t *dma_handle, gfp_t flags, |
11 | struct dma_attrs *attrs); | ||
11 | 12 | ||
12 | extern void | 13 | extern void |
13 | xen_swiotlb_free_coherent(struct device *hwdev, size_t size, | 14 | xen_swiotlb_free_coherent(struct device *hwdev, size_t size, |
14 | void *vaddr, dma_addr_t dma_handle); | 15 | void *vaddr, dma_addr_t dma_handle, |
16 | struct dma_attrs *attrs); | ||
15 | 17 | ||
16 | extern dma_addr_t xen_swiotlb_map_page(struct device *dev, struct page *page, | 18 | extern dma_addr_t xen_swiotlb_map_page(struct device *dev, struct page *page, |
17 | unsigned long offset, size_t size, | 19 | unsigned long offset, size_t size, |
diff --git a/include/xen/tmem.h b/include/xen/tmem.h index 82e2c83a32f5..591550a22ac7 100644 --- a/include/xen/tmem.h +++ b/include/xen/tmem.h | |||
@@ -1,5 +1,9 @@ | |||
1 | #ifndef _XEN_TMEM_H | 1 | #ifndef _XEN_TMEM_H |
2 | #define _XEN_TMEM_H | 2 | #define _XEN_TMEM_H |
3 | |||
4 | #include <linux/types.h> | ||
5 | |||
3 | /* defined in drivers/xen/tmem.c */ | 6 | /* defined in drivers/xen/tmem.c */ |
4 | extern int tmem_enabled; | 7 | extern bool tmem_enabled; |
8 | |||
5 | #endif /* _XEN_TMEM_H */ | 9 | #endif /* _XEN_TMEM_H */ |
diff --git a/include/xen/xen-ops.h b/include/xen/xen-ops.h index 03c85d7387fb..6a198e46ab6e 100644 --- a/include/xen/xen-ops.h +++ b/include/xen/xen-ops.h | |||
@@ -23,6 +23,7 @@ int xen_create_contiguous_region(unsigned long vstart, unsigned int order, | |||
23 | 23 | ||
24 | void xen_destroy_contiguous_region(unsigned long vstart, unsigned int order); | 24 | void xen_destroy_contiguous_region(unsigned long vstart, unsigned int order); |
25 | 25 | ||
26 | struct vm_area_struct; | ||
26 | int xen_remap_domain_mfn_range(struct vm_area_struct *vma, | 27 | int xen_remap_domain_mfn_range(struct vm_area_struct *vma, |
27 | unsigned long addr, | 28 | unsigned long addr, |
28 | unsigned long mfn, int nr, | 29 | unsigned long mfn, int nr, |
diff --git a/include/xen/xenbus.h b/include/xen/xenbus.h index e8c599b237c2..0a7515c1e3a4 100644 --- a/include/xen/xenbus.h +++ b/include/xen/xenbus.h | |||
@@ -139,9 +139,9 @@ int xenbus_transaction_start(struct xenbus_transaction *t); | |||
139 | int xenbus_transaction_end(struct xenbus_transaction t, int abort); | 139 | int xenbus_transaction_end(struct xenbus_transaction t, int abort); |
140 | 140 | ||
141 | /* Single read and scanf: returns -errno or num scanned if > 0. */ | 141 | /* Single read and scanf: returns -errno or num scanned if > 0. */ |
142 | __scanf(4, 5) | ||
142 | int xenbus_scanf(struct xenbus_transaction t, | 143 | int xenbus_scanf(struct xenbus_transaction t, |
143 | const char *dir, const char *node, const char *fmt, ...) | 144 | const char *dir, const char *node, const char *fmt, ...); |
144 | __attribute__((format(scanf, 4, 5))); | ||
145 | 145 | ||
146 | /* Single printf and write: returns -errno or 0. */ | 146 | /* Single printf and write: returns -errno or 0. */ |
147 | __printf(4, 5) | 147 | __printf(4, 5) |