diff options
Diffstat (limited to 'include')
846 files changed, 29510 insertions, 11554 deletions
diff --git a/include/acpi/acexcep.h b/include/acpi/acexcep.h index 473d584b1d31..5b2e5e80ecb0 100644 --- a/include/acpi/acexcep.h +++ b/include/acpi/acexcep.h | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2008, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/include/acpi/acnames.h b/include/acpi/acnames.h index c1343a9265fa..9cf736ea4691 100644 --- a/include/acpi/acnames.h +++ b/include/acpi/acnames.h | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2008, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/include/acpi/acoutput.h b/include/acpi/acoutput.h index 5c823d5ab783..d7726685797e 100644 --- a/include/acpi/acoutput.h +++ b/include/acpi/acoutput.h | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2008, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
| @@ -85,7 +85,8 @@ | |||
| 85 | #define ACPI_LV_INIT 0x00000001 | 85 | #define ACPI_LV_INIT 0x00000001 |
| 86 | #define ACPI_LV_DEBUG_OBJECT 0x00000002 | 86 | #define ACPI_LV_DEBUG_OBJECT 0x00000002 |
| 87 | #define ACPI_LV_INFO 0x00000004 | 87 | #define ACPI_LV_INFO 0x00000004 |
| 88 | #define ACPI_LV_ALL_EXCEPTIONS 0x00000007 | 88 | #define ACPI_LV_REPAIR 0x00000008 |
| 89 | #define ACPI_LV_ALL_EXCEPTIONS 0x0000000F | ||
| 89 | 90 | ||
| 90 | /* Trace verbosity level 1 [Standard Trace Level] */ | 91 | /* Trace verbosity level 1 [Standard Trace Level] */ |
| 91 | 92 | ||
| @@ -143,6 +144,7 @@ | |||
| 143 | #define ACPI_DB_INIT ACPI_DEBUG_LEVEL (ACPI_LV_INIT) | 144 | #define ACPI_DB_INIT ACPI_DEBUG_LEVEL (ACPI_LV_INIT) |
| 144 | #define ACPI_DB_DEBUG_OBJECT ACPI_DEBUG_LEVEL (ACPI_LV_DEBUG_OBJECT) | 145 | #define ACPI_DB_DEBUG_OBJECT ACPI_DEBUG_LEVEL (ACPI_LV_DEBUG_OBJECT) |
| 145 | #define ACPI_DB_INFO ACPI_DEBUG_LEVEL (ACPI_LV_INFO) | 146 | #define ACPI_DB_INFO ACPI_DEBUG_LEVEL (ACPI_LV_INFO) |
| 147 | #define ACPI_DB_REPAIR ACPI_DEBUG_LEVEL (ACPI_LV_REPAIR) | ||
| 146 | #define ACPI_DB_ALL_EXCEPTIONS ACPI_DEBUG_LEVEL (ACPI_LV_ALL_EXCEPTIONS) | 148 | #define ACPI_DB_ALL_EXCEPTIONS ACPI_DEBUG_LEVEL (ACPI_LV_ALL_EXCEPTIONS) |
| 147 | 149 | ||
| 148 | /* Trace level -- also used in the global "DebugLevel" */ | 150 | /* Trace level -- also used in the global "DebugLevel" */ |
| @@ -174,8 +176,8 @@ | |||
| 174 | 176 | ||
| 175 | /* Defaults for debug_level, debug and normal */ | 177 | /* Defaults for debug_level, debug and normal */ |
| 176 | 178 | ||
| 177 | #define ACPI_DEBUG_DEFAULT (ACPI_LV_INFO) | 179 | #define ACPI_DEBUG_DEFAULT (ACPI_LV_INFO | ACPI_LV_REPAIR) |
| 178 | #define ACPI_NORMAL_DEFAULT (ACPI_LV_INIT | ACPI_LV_DEBUG_OBJECT) | 180 | #define ACPI_NORMAL_DEFAULT (ACPI_LV_INIT | ACPI_LV_DEBUG_OBJECT | ACPI_LV_REPAIR) |
| 179 | #define ACPI_DEBUG_ALL (ACPI_LV_AML_DISASSEMBLE | ACPI_LV_ALL_EXCEPTIONS | ACPI_LV_ALL) | 181 | #define ACPI_DEBUG_ALL (ACPI_LV_AML_DISASSEMBLE | ACPI_LV_ALL_EXCEPTIONS | ACPI_LV_ALL) |
| 180 | 182 | ||
| 181 | #if defined (ACPI_DEBUG_OUTPUT) || !defined (ACPI_NO_ERROR_MESSAGES) | 183 | #if defined (ACPI_DEBUG_OUTPUT) || !defined (ACPI_NO_ERROR_MESSAGES) |
diff --git a/include/acpi/acpi.h b/include/acpi/acpi.h index 472b7bf0c5d4..a091cabca4b1 100644 --- a/include/acpi/acpi.h +++ b/include/acpi/acpi.h | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2008, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h index 3cd9ccdcbd8f..7bf83ddf82e0 100644 --- a/include/acpi/acpi_bus.h +++ b/include/acpi/acpi_bus.h | |||
| @@ -242,6 +242,8 @@ struct acpi_device_perf { | |||
| 242 | struct acpi_device_wakeup_flags { | 242 | struct acpi_device_wakeup_flags { |
| 243 | u8 valid:1; /* Can successfully enable wakeup? */ | 243 | u8 valid:1; /* Can successfully enable wakeup? */ |
| 244 | u8 run_wake:1; /* Run-Wake GPE devices */ | 244 | u8 run_wake:1; /* Run-Wake GPE devices */ |
| 245 | u8 always_enabled:1; /* Run-wake devices that are always enabled */ | ||
| 246 | u8 notifier_present:1; /* Wake-up notify handler has been installed */ | ||
| 245 | }; | 247 | }; |
| 246 | 248 | ||
| 247 | struct acpi_device_wakeup_state { | 249 | struct acpi_device_wakeup_state { |
| @@ -250,12 +252,13 @@ struct acpi_device_wakeup_state { | |||
| 250 | 252 | ||
| 251 | struct acpi_device_wakeup { | 253 | struct acpi_device_wakeup { |
| 252 | acpi_handle gpe_device; | 254 | acpi_handle gpe_device; |
| 253 | acpi_integer gpe_number; | 255 | u64 gpe_number; |
| 254 | acpi_integer sleep_state; | 256 | u64 sleep_state; |
| 255 | struct acpi_handle_list resources; | 257 | struct acpi_handle_list resources; |
| 256 | struct acpi_device_wakeup_state state; | 258 | struct acpi_device_wakeup_state state; |
| 257 | struct acpi_device_wakeup_flags flags; | 259 | struct acpi_device_wakeup_flags flags; |
| 258 | int prepare_count; | 260 | int prepare_count; |
| 261 | int run_wake_count; | ||
| 259 | }; | 262 | }; |
| 260 | 263 | ||
| 261 | /* Device */ | 264 | /* Device */ |
| @@ -380,12 +383,15 @@ struct acpi_pci_root { | |||
| 380 | }; | 383 | }; |
| 381 | 384 | ||
| 382 | /* helper */ | 385 | /* helper */ |
| 383 | acpi_handle acpi_get_child(acpi_handle, acpi_integer); | 386 | acpi_handle acpi_get_child(acpi_handle, u64); |
| 384 | int acpi_is_root_bridge(acpi_handle); | 387 | int acpi_is_root_bridge(acpi_handle); |
| 385 | acpi_handle acpi_get_pci_rootbridge_handle(unsigned int, unsigned int); | 388 | acpi_handle acpi_get_pci_rootbridge_handle(unsigned int, unsigned int); |
| 386 | struct acpi_pci_root *acpi_pci_find_root(acpi_handle handle); | 389 | struct acpi_pci_root *acpi_pci_find_root(acpi_handle handle); |
| 387 | #define DEVICE_ACPI_HANDLE(dev) ((acpi_handle)((dev)->archdata.acpi_handle)) | 390 | #define DEVICE_ACPI_HANDLE(dev) ((acpi_handle)((dev)->archdata.acpi_handle)) |
| 388 | 391 | ||
| 392 | int acpi_enable_wakeup_device_power(struct acpi_device *dev, int state); | ||
| 393 | int acpi_disable_wakeup_device_power(struct acpi_device *dev); | ||
| 394 | |||
| 389 | #ifdef CONFIG_PM_SLEEP | 395 | #ifdef CONFIG_PM_SLEEP |
| 390 | int acpi_pm_device_sleep_state(struct device *, int *); | 396 | int acpi_pm_device_sleep_state(struct device *, int *); |
| 391 | int acpi_pm_device_sleep_wake(struct device *, bool); | 397 | int acpi_pm_device_sleep_wake(struct device *, bool); |
diff --git a/include/acpi/acpi_drivers.h b/include/acpi/acpi_drivers.h index f4906f6568d4..4f7b44866b76 100644 --- a/include/acpi/acpi_drivers.h +++ b/include/acpi/acpi_drivers.h | |||
| @@ -65,6 +65,8 @@ | |||
| 65 | #define ACPI_VIDEO_HID "LNXVIDEO" | 65 | #define ACPI_VIDEO_HID "LNXVIDEO" |
| 66 | #define ACPI_BAY_HID "LNXIOBAY" | 66 | #define ACPI_BAY_HID "LNXIOBAY" |
| 67 | #define ACPI_DOCK_HID "LNXDOCK" | 67 | #define ACPI_DOCK_HID "LNXDOCK" |
| 68 | /* Quirk for broken IBM BIOSes */ | ||
| 69 | #define ACPI_SMBUS_IBM_HID "SMBUSIBM" | ||
| 68 | 70 | ||
| 69 | /* | 71 | /* |
| 70 | * For fixed hardware buttons, we fabricate acpi_devices with HID | 72 | * For fixed hardware buttons, we fabricate acpi_devices with HID |
| @@ -104,6 +106,7 @@ int acpi_pci_bind_root(struct acpi_device *device); | |||
| 104 | 106 | ||
| 105 | struct pci_bus *pci_acpi_scan_root(struct acpi_device *device, int domain, | 107 | struct pci_bus *pci_acpi_scan_root(struct acpi_device *device, int domain, |
| 106 | int bus); | 108 | int bus); |
| 109 | void pci_acpi_crs_quirks(void); | ||
| 107 | 110 | ||
| 108 | /* -------------------------------------------------------------------------- | 111 | /* -------------------------------------------------------------------------- |
| 109 | Processor | 112 | Processor |
diff --git a/include/acpi/acpi_hest.h b/include/acpi/acpi_hest.h new file mode 100644 index 000000000000..63194d03cb2d --- /dev/null +++ b/include/acpi/acpi_hest.h | |||
| @@ -0,0 +1,12 @@ | |||
| 1 | #ifndef __ACPI_HEST_H | ||
| 2 | #define __ACPI_HEST_H | ||
| 3 | |||
| 4 | #include <linux/pci.h> | ||
| 5 | |||
| 6 | #ifdef CONFIG_ACPI | ||
| 7 | extern int acpi_hest_firmware_first_pci(struct pci_dev *pci); | ||
| 8 | #else | ||
| 9 | static inline int acpi_hest_firmware_first_pci(struct pci_dev *pci) { return 0; } | ||
| 10 | #endif | ||
| 11 | |||
| 12 | #endif | ||
diff --git a/include/acpi/acpiosxf.h b/include/acpi/acpiosxf.h index eb0e7189075f..b396854b83b0 100644 --- a/include/acpi/acpiosxf.h +++ b/include/acpi/acpiosxf.h | |||
| @@ -8,7 +8,7 @@ | |||
| 8 | *****************************************************************************/ | 8 | *****************************************************************************/ |
| 9 | 9 | ||
| 10 | /* | 10 | /* |
| 11 | * Copyright (C) 2000 - 2008, Intel Corp. | 11 | * Copyright (C) 2000 - 2010, Intel Corp. |
| 12 | * All rights reserved. | 12 | * All rights reserved. |
| 13 | * | 13 | * |
| 14 | * Redistribution and use in source and binary forms, with or without | 14 | * Redistribution and use in source and binary forms, with or without |
| @@ -196,7 +196,7 @@ acpi_os_hotplug_execute(acpi_osd_exec_callback function, void *context); | |||
| 196 | 196 | ||
| 197 | void acpi_os_wait_events_complete(void *context); | 197 | void acpi_os_wait_events_complete(void *context); |
| 198 | 198 | ||
| 199 | void acpi_os_sleep(acpi_integer milliseconds); | 199 | void acpi_os_sleep(u64 milliseconds); |
| 200 | 200 | ||
| 201 | void acpi_os_stall(u32 microseconds); | 201 | void acpi_os_stall(u32 microseconds); |
| 202 | 202 | ||
| @@ -227,7 +227,7 @@ acpi_os_read_pci_configuration(struct acpi_pci_id *pci_id, | |||
| 227 | 227 | ||
| 228 | acpi_status | 228 | acpi_status |
| 229 | acpi_os_write_pci_configuration(struct acpi_pci_id *pci_id, | 229 | acpi_os_write_pci_configuration(struct acpi_pci_id *pci_id, |
| 230 | u32 reg, acpi_integer value, u32 width); | 230 | u32 reg, u64 value, u32 width); |
| 231 | 231 | ||
| 232 | /* | 232 | /* |
| 233 | * Interim function needed for PCI IRQ routing | 233 | * Interim function needed for PCI IRQ routing |
diff --git a/include/acpi/acpixf.h b/include/acpi/acpixf.h index e723b0fd8e41..4447a0461bae 100644 --- a/include/acpi/acpixf.h +++ b/include/acpi/acpixf.h | |||
| @@ -6,7 +6,7 @@ | |||
| 6 | *****************************************************************************/ | 6 | *****************************************************************************/ |
| 7 | 7 | ||
| 8 | /* | 8 | /* |
| 9 | * Copyright (C) 2000 - 2008, Intel Corp. | 9 | * Copyright (C) 2000 - 2010, Intel Corp. |
| 10 | * All rights reserved. | 10 | * All rights reserved. |
| 11 | * | 11 | * |
| 12 | * Redistribution and use in source and binary forms, with or without | 12 | * Redistribution and use in source and binary forms, with or without |
| @@ -47,7 +47,7 @@ | |||
| 47 | 47 | ||
| 48 | /* Current ACPICA subsystem version in YYYYMMDD format */ | 48 | /* Current ACPICA subsystem version in YYYYMMDD format */ |
| 49 | 49 | ||
| 50 | #define ACPI_CA_VERSION 0x20090903 | 50 | #define ACPI_CA_VERSION 0x20100121 |
| 51 | 51 | ||
| 52 | #include "actypes.h" | 52 | #include "actypes.h" |
| 53 | #include "actbl.h" | 53 | #include "actbl.h" |
| @@ -154,7 +154,8 @@ acpi_status | |||
| 154 | acpi_walk_namespace(acpi_object_type type, | 154 | acpi_walk_namespace(acpi_object_type type, |
| 155 | acpi_handle start_object, | 155 | acpi_handle start_object, |
| 156 | u32 max_depth, | 156 | u32 max_depth, |
| 157 | acpi_walk_callback user_function, | 157 | acpi_walk_callback pre_order_visit, |
| 158 | acpi_walk_callback post_order_visit, | ||
| 158 | void *context, void **return_value); | 159 | void *context, void **return_value); |
| 159 | 160 | ||
| 160 | acpi_status | 161 | acpi_status |
| @@ -280,11 +281,11 @@ acpi_status acpi_get_event_status(u32 event, acpi_event_status * event_status); | |||
| 280 | /* | 281 | /* |
| 281 | * GPE Interfaces | 282 | * GPE Interfaces |
| 282 | */ | 283 | */ |
| 283 | acpi_status acpi_set_gpe_type(acpi_handle gpe_device, u32 gpe_number, u8 type); | 284 | acpi_status acpi_set_gpe(acpi_handle gpe_device, u32 gpe_number, u8 action); |
| 284 | 285 | ||
| 285 | acpi_status acpi_enable_gpe(acpi_handle gpe_device, u32 gpe_number); | 286 | acpi_status acpi_enable_gpe(acpi_handle gpe_device, u32 gpe_number, u8 type); |
| 286 | 287 | ||
| 287 | acpi_status acpi_disable_gpe(acpi_handle gpe_device, u32 gpe_number); | 288 | acpi_status acpi_disable_gpe(acpi_handle gpe_device, u32 gpe_number, u8 type); |
| 288 | 289 | ||
| 289 | acpi_status acpi_clear_gpe(acpi_handle gpe_device, u32 gpe_number, u32 flags); | 290 | acpi_status acpi_clear_gpe(acpi_handle gpe_device, u32 gpe_number, u32 flags); |
| 290 | 291 | ||
diff --git a/include/acpi/acrestyp.h b/include/acpi/acrestyp.h index 9ffe00feada6..e5526354ba5e 100644 --- a/include/acpi/acrestyp.h +++ b/include/acpi/acrestyp.h | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2008, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
| @@ -397,7 +397,7 @@ struct acpi_resource { | |||
| 397 | struct acpi_pci_routing_table { | 397 | struct acpi_pci_routing_table { |
| 398 | u32 length; | 398 | u32 length; |
| 399 | u32 pin; | 399 | u32 pin; |
| 400 | acpi_integer address; /* here for 64-bit alignment */ | 400 | u64 address; /* here for 64-bit alignment */ |
| 401 | u32 source_index; | 401 | u32 source_index; |
| 402 | char source[4]; /* pad to 64 bits so sizeof() works in all cases */ | 402 | char source[4]; /* pad to 64 bits so sizeof() works in all cases */ |
| 403 | }; | 403 | }; |
diff --git a/include/acpi/actbl.h b/include/acpi/actbl.h index 1b6587952604..ad2001683ba7 100644 --- a/include/acpi/actbl.h +++ b/include/acpi/actbl.h | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2008, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/include/acpi/actbl1.h b/include/acpi/actbl1.h index 0b9b430b092b..c637b75b9f3f 100644 --- a/include/acpi/actbl1.h +++ b/include/acpi/actbl1.h | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2008, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/include/acpi/actbl2.h b/include/acpi/actbl2.h index 6f3dce9991e1..5b02e307bff3 100644 --- a/include/acpi/actbl2.h +++ b/include/acpi/actbl2.h | |||
| @@ -1,3 +1,46 @@ | |||
| 1 | /****************************************************************************** | ||
| 2 | * | ||
| 3 | * Name: actbl2.h - ACPI Specification Revision 2.0 Tables | ||
| 4 | * | ||
| 5 | *****************************************************************************/ | ||
| 6 | |||
| 7 | /* | ||
| 8 | * Copyright (C) 2000 - 2010, 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 | |||
| 1 | #ifndef __ACTBL2_H__ | 44 | #ifndef __ACTBL2_H__ |
| 2 | #define __ACTBL2_H__ | 45 | #define __ACTBL2_H__ |
| 3 | 46 | ||
diff --git a/include/acpi/actypes.h b/include/acpi/actypes.h index 153f12dc3373..3f08e64962f8 100644 --- a/include/acpi/actypes.h +++ b/include/acpi/actypes.h | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2008, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
| @@ -385,19 +385,6 @@ union uint64_overlay { | |||
| 385 | struct uint64_struct part; | 385 | struct uint64_struct part; |
| 386 | }; | 386 | }; |
| 387 | 387 | ||
| 388 | struct uint32_struct { | ||
| 389 | u32 lo; | ||
| 390 | u32 hi; | ||
| 391 | }; | ||
| 392 | |||
| 393 | /* | ||
| 394 | * Acpi integer width. In ACPI version 1, integers are 32 bits. In ACPI | ||
| 395 | * version 2, integers are 64 bits. Note that this pertains to the ACPI integer | ||
| 396 | * type only, not other integers used in the implementation of the ACPI CA | ||
| 397 | * subsystem. | ||
| 398 | */ | ||
| 399 | typedef unsigned long long acpi_integer; | ||
| 400 | #define ACPI_INTEGER_MAX ACPI_UINT64_MAX | ||
| 401 | #define ACPI_INTEGER_BIT_SIZE 64 | 388 | #define ACPI_INTEGER_BIT_SIZE 64 |
| 402 | #define ACPI_MAX_DECIMAL_DIGITS 20 /* 2^64 = 18,446,744,073,709,551,616 */ | 389 | #define ACPI_MAX_DECIMAL_DIGITS 20 /* 2^64 = 18,446,744,073,709,551,616 */ |
| 403 | 390 | ||
| @@ -421,6 +408,19 @@ typedef unsigned long long acpi_integer; | |||
| 421 | #define ACPI_WAIT_FOREVER 0xFFFF /* u16, as per ACPI spec */ | 408 | #define ACPI_WAIT_FOREVER 0xFFFF /* u16, as per ACPI spec */ |
| 422 | #define ACPI_DO_NOT_WAIT 0 | 409 | #define ACPI_DO_NOT_WAIT 0 |
| 423 | 410 | ||
| 411 | /* | ||
| 412 | * Obsolete: Acpi integer width. In ACPI version 1 (1996), integers are 32 bits. | ||
| 413 | * In ACPI version 2 (2000) and later, integers are 64 bits. Note that this | ||
| 414 | * pertains to the ACPI integer type only, not to other integers used in the | ||
| 415 | * implementation of the ACPICA subsystem. | ||
| 416 | * | ||
| 417 | * 01/2010: This type is obsolete and has been removed from the entire ACPICA | ||
| 418 | * code base. It remains here for compatibility with device drivers that use | ||
| 419 | * the type. However, it will be removed in the future. | ||
| 420 | */ | ||
| 421 | typedef u64 acpi_integer; | ||
| 422 | #define ACPI_INTEGER_MAX ACPI_UINT64_MAX | ||
| 423 | |||
| 424 | /******************************************************************************* | 424 | /******************************************************************************* |
| 425 | * | 425 | * |
| 426 | * Commonly used macros | 426 | * Commonly used macros |
| @@ -668,15 +668,16 @@ typedef u32 acpi_event_status; | |||
| 668 | 668 | ||
| 669 | /* | 669 | /* |
| 670 | * GPE info flags - Per GPE | 670 | * GPE info flags - Per GPE |
| 671 | * +-+-+-+---+---+-+ | 671 | * +-+-+-+---+-+-+-+ |
| 672 | * |7|6|5|4:3|2:1|0| | 672 | * |7|6|5|4:3|2|1|0| |
| 673 | * +-+-+-+---+---+-+ | 673 | * +-+-+-+---+-+-+-+ |
| 674 | * | | | | | | | 674 | * | | | | | | | |
| 675 | * | | | | | +--- Interrupt type: Edge or Level Triggered | 675 | * | | | | | | +--- Interrupt type: Edge or Level Triggered |
| 676 | * | | | | +--- Type: Wake-only, Runtime-only, or wake/runtime | 676 | * | | | | | +--- GPE can wake the system |
| 677 | * | | | | +--- Unused | ||
| 677 | * | | | +--- Type of dispatch -- to method, handler, or none | 678 | * | | | +--- Type of dispatch -- to method, handler, or none |
| 678 | * | | +--- Enabled for runtime? | 679 | * | | +--- Unused |
| 679 | * | +--- Enabled for wake? | 680 | * | +--- Unused |
| 680 | * +--- Unused | 681 | * +--- Unused |
| 681 | */ | 682 | */ |
| 682 | #define ACPI_GPE_XRUPT_TYPE_MASK (u8) 0x01 | 683 | #define ACPI_GPE_XRUPT_TYPE_MASK (u8) 0x01 |
| @@ -687,22 +688,13 @@ typedef u32 acpi_event_status; | |||
| 687 | #define ACPI_GPE_TYPE_WAKE_RUN (u8) 0x06 | 688 | #define ACPI_GPE_TYPE_WAKE_RUN (u8) 0x06 |
| 688 | #define ACPI_GPE_TYPE_WAKE (u8) 0x02 | 689 | #define ACPI_GPE_TYPE_WAKE (u8) 0x02 |
| 689 | #define ACPI_GPE_TYPE_RUNTIME (u8) 0x04 /* Default */ | 690 | #define ACPI_GPE_TYPE_RUNTIME (u8) 0x04 /* Default */ |
| 691 | #define ACPI_GPE_CAN_WAKE (u8) 0x02 | ||
| 690 | 692 | ||
| 691 | #define ACPI_GPE_DISPATCH_MASK (u8) 0x18 | 693 | #define ACPI_GPE_DISPATCH_MASK (u8) 0x18 |
| 692 | #define ACPI_GPE_DISPATCH_HANDLER (u8) 0x08 | 694 | #define ACPI_GPE_DISPATCH_HANDLER (u8) 0x08 |
| 693 | #define ACPI_GPE_DISPATCH_METHOD (u8) 0x10 | 695 | #define ACPI_GPE_DISPATCH_METHOD (u8) 0x10 |
| 694 | #define ACPI_GPE_DISPATCH_NOT_USED (u8) 0x00 /* Default */ | 696 | #define ACPI_GPE_DISPATCH_NOT_USED (u8) 0x00 /* Default */ |
| 695 | 697 | ||
| 696 | #define ACPI_GPE_RUN_ENABLE_MASK (u8) 0x20 | ||
| 697 | #define ACPI_GPE_RUN_ENABLED (u8) 0x20 | ||
| 698 | #define ACPI_GPE_RUN_DISABLED (u8) 0x00 /* Default */ | ||
| 699 | |||
| 700 | #define ACPI_GPE_WAKE_ENABLE_MASK (u8) 0x40 | ||
| 701 | #define ACPI_GPE_WAKE_ENABLED (u8) 0x40 | ||
| 702 | #define ACPI_GPE_WAKE_DISABLED (u8) 0x00 /* Default */ | ||
| 703 | |||
| 704 | #define ACPI_GPE_ENABLE_MASK (u8) 0x60 /* Both run/wake */ | ||
| 705 | |||
| 706 | /* | 698 | /* |
| 707 | * Flags for GPE and Lock interfaces | 699 | * Flags for GPE and Lock interfaces |
| 708 | */ | 700 | */ |
| @@ -801,7 +793,7 @@ union acpi_object { | |||
| 801 | acpi_object_type type; /* See definition of acpi_ns_type for values */ | 793 | acpi_object_type type; /* See definition of acpi_ns_type for values */ |
| 802 | struct { | 794 | struct { |
| 803 | acpi_object_type type; /* ACPI_TYPE_INTEGER */ | 795 | acpi_object_type type; /* ACPI_TYPE_INTEGER */ |
| 804 | acpi_integer value; /* The actual number */ | 796 | u64 value; /* The actual number */ |
| 805 | } integer; | 797 | } integer; |
| 806 | 798 | ||
| 807 | struct { | 799 | struct { |
| @@ -945,7 +937,7 @@ typedef | |||
| 945 | acpi_status(*acpi_adr_space_handler) (u32 function, | 937 | acpi_status(*acpi_adr_space_handler) (u32 function, |
| 946 | acpi_physical_address address, | 938 | acpi_physical_address address, |
| 947 | u32 bit_width, | 939 | u32 bit_width, |
| 948 | acpi_integer * value, | 940 | u64 *value, |
| 949 | void *handler_context, | 941 | void *handler_context, |
| 950 | void *region_context); | 942 | void *region_context); |
| 951 | 943 | ||
| @@ -1005,7 +997,7 @@ struct acpi_device_info { | |||
| 1005 | u8 highest_dstates[4]; /* _sx_d values: 0xFF indicates not valid */ | 997 | u8 highest_dstates[4]; /* _sx_d values: 0xFF indicates not valid */ |
| 1006 | u8 lowest_dstates[5]; /* _sx_w values: 0xFF indicates not valid */ | 998 | u8 lowest_dstates[5]; /* _sx_w values: 0xFF indicates not valid */ |
| 1007 | u32 current_status; /* _STA value */ | 999 | u32 current_status; /* _STA value */ |
| 1008 | acpi_integer address; /* _ADR value */ | 1000 | u64 address; /* _ADR value */ |
| 1009 | struct acpica_device_id hardware_id; /* _HID value */ | 1001 | struct acpica_device_id hardware_id; /* _HID value */ |
| 1010 | struct acpica_device_id unique_id; /* _UID value */ | 1002 | struct acpica_device_id unique_id; /* _UID value */ |
| 1011 | struct acpica_device_id_list compatible_id_list; /* _CID list <must be last> */ | 1003 | struct acpica_device_id_list compatible_id_list; /* _CID list <must be last> */ |
diff --git a/include/acpi/platform/acenv.h b/include/acpi/platform/acenv.h index e62f10d9a7d8..c05aeba9e8f0 100644 --- a/include/acpi/platform/acenv.h +++ b/include/acpi/platform/acenv.h | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2008, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
| @@ -311,8 +311,8 @@ typedef char *va_list; | |||
| 311 | #define ACPI_MEMCMP(s1,s2,n) acpi_ut_memcmp((const char *)(s1), (const char *)(s2), (acpi_size)(n)) | 311 | #define ACPI_MEMCMP(s1,s2,n) acpi_ut_memcmp((const char *)(s1), (const char *)(s2), (acpi_size)(n)) |
| 312 | #define ACPI_MEMCPY(d,s,n) (void) acpi_ut_memcpy ((d), (s), (acpi_size)(n)) | 312 | #define ACPI_MEMCPY(d,s,n) (void) acpi_ut_memcpy ((d), (s), (acpi_size)(n)) |
| 313 | #define ACPI_MEMSET(d,v,n) (void) acpi_ut_memset ((d), (v), (acpi_size)(n)) | 313 | #define ACPI_MEMSET(d,v,n) (void) acpi_ut_memset ((d), (v), (acpi_size)(n)) |
| 314 | #define ACPI_TOUPPER acpi_ut_to_upper | 314 | #define ACPI_TOUPPER(c) acpi_ut_to_upper ((int) (c)) |
| 315 | #define ACPI_TOLOWER acpi_ut_to_lower | 315 | #define ACPI_TOLOWER(c) acpi_ut_to_lower ((int) (c)) |
| 316 | 316 | ||
| 317 | #endif /* ACPI_USE_SYSTEM_CLIBRARY */ | 317 | #endif /* ACPI_USE_SYSTEM_CLIBRARY */ |
| 318 | 318 | ||
diff --git a/include/acpi/platform/acgcc.h b/include/acpi/platform/acgcc.h index 6aadbf84ae71..0cd53e3cd1a3 100644 --- a/include/acpi/platform/acgcc.h +++ b/include/acpi/platform/acgcc.h | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2008, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/include/acpi/platform/aclinux.h b/include/acpi/platform/aclinux.h index 9d7febde10a1..e5039a2856f8 100644 --- a/include/acpi/platform/aclinux.h +++ b/include/acpi/platform/aclinux.h | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2009, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
| @@ -152,7 +152,7 @@ static inline void *acpi_os_acquire_object(acpi_cache_t * cache) | |||
| 152 | #include <linux/hardirq.h> | 152 | #include <linux/hardirq.h> |
| 153 | #define ACPI_PREEMPTION_POINT() \ | 153 | #define ACPI_PREEMPTION_POINT() \ |
| 154 | do { \ | 154 | do { \ |
| 155 | if (!in_atomic_preempt_off()) \ | 155 | if (!in_atomic_preempt_off() && !irqs_disabled()) \ |
| 156 | cond_resched(); \ | 156 | cond_resched(); \ |
| 157 | } while (0) | 157 | } while (0) |
| 158 | 158 | ||
diff --git a/include/acpi/processor.h b/include/acpi/processor.h index 740ac3ad8fd0..86825ddbe14e 100644 --- a/include/acpi/processor.h +++ b/include/acpi/processor.h | |||
| @@ -92,11 +92,11 @@ struct acpi_processor_power { | |||
| 92 | /* Performance Management */ | 92 | /* Performance Management */ |
| 93 | 93 | ||
| 94 | struct acpi_psd_package { | 94 | struct acpi_psd_package { |
| 95 | acpi_integer num_entries; | 95 | u64 num_entries; |
| 96 | acpi_integer revision; | 96 | u64 revision; |
| 97 | acpi_integer domain; | 97 | u64 domain; |
| 98 | acpi_integer coord_type; | 98 | u64 coord_type; |
| 99 | acpi_integer num_processors; | 99 | u64 num_processors; |
| 100 | } __attribute__ ((packed)); | 100 | } __attribute__ ((packed)); |
| 101 | 101 | ||
| 102 | struct acpi_pct_register { | 102 | struct acpi_pct_register { |
| @@ -110,12 +110,12 @@ struct acpi_pct_register { | |||
| 110 | } __attribute__ ((packed)); | 110 | } __attribute__ ((packed)); |
| 111 | 111 | ||
| 112 | struct acpi_processor_px { | 112 | struct acpi_processor_px { |
| 113 | acpi_integer core_frequency; /* megahertz */ | 113 | u64 core_frequency; /* megahertz */ |
| 114 | acpi_integer power; /* milliWatts */ | 114 | u64 power; /* milliWatts */ |
| 115 | acpi_integer transition_latency; /* microseconds */ | 115 | u64 transition_latency; /* microseconds */ |
| 116 | acpi_integer bus_master_latency; /* microseconds */ | 116 | u64 bus_master_latency; /* microseconds */ |
| 117 | acpi_integer control; /* control value */ | 117 | u64 control; /* control value */ |
| 118 | acpi_integer status; /* success indicator */ | 118 | u64 status; /* success indicator */ |
| 119 | }; | 119 | }; |
| 120 | 120 | ||
| 121 | struct acpi_processor_performance { | 121 | struct acpi_processor_performance { |
| @@ -133,11 +133,11 @@ struct acpi_processor_performance { | |||
| 133 | /* Throttling Control */ | 133 | /* Throttling Control */ |
| 134 | 134 | ||
| 135 | struct acpi_tsd_package { | 135 | struct acpi_tsd_package { |
| 136 | acpi_integer num_entries; | 136 | u64 num_entries; |
| 137 | acpi_integer revision; | 137 | u64 revision; |
| 138 | acpi_integer domain; | 138 | u64 domain; |
| 139 | acpi_integer coord_type; | 139 | u64 coord_type; |
| 140 | acpi_integer num_processors; | 140 | u64 num_processors; |
| 141 | } __attribute__ ((packed)); | 141 | } __attribute__ ((packed)); |
| 142 | 142 | ||
| 143 | struct acpi_ptc_register { | 143 | struct acpi_ptc_register { |
| @@ -151,11 +151,11 @@ struct acpi_ptc_register { | |||
| 151 | } __attribute__ ((packed)); | 151 | } __attribute__ ((packed)); |
| 152 | 152 | ||
| 153 | struct acpi_processor_tx_tss { | 153 | struct acpi_processor_tx_tss { |
| 154 | acpi_integer freqpercentage; /* */ | 154 | u64 freqpercentage; /* */ |
| 155 | acpi_integer power; /* milliWatts */ | 155 | u64 power; /* milliWatts */ |
| 156 | acpi_integer transition_latency; /* microseconds */ | 156 | u64 transition_latency; /* microseconds */ |
| 157 | acpi_integer control; /* control value */ | 157 | u64 control; /* control value */ |
| 158 | acpi_integer status; /* success indicator */ | 158 | u64 status; /* success indicator */ |
| 159 | }; | 159 | }; |
| 160 | struct acpi_processor_tx { | 160 | struct acpi_processor_tx { |
| 161 | u16 power; | 161 | u16 power; |
| @@ -224,8 +224,6 @@ struct acpi_processor { | |||
| 224 | struct acpi_processor_throttling throttling; | 224 | struct acpi_processor_throttling throttling; |
| 225 | struct acpi_processor_limit limit; | 225 | struct acpi_processor_limit limit; |
| 226 | struct thermal_cooling_device *cdev; | 226 | struct thermal_cooling_device *cdev; |
| 227 | /* the _PDC objects for this processor, if any */ | ||
| 228 | struct acpi_object_list *pdc; | ||
| 229 | }; | 227 | }; |
| 230 | 228 | ||
| 231 | struct acpi_processor_errata { | 229 | struct acpi_processor_errata { |
| @@ -240,7 +238,7 @@ struct acpi_processor_errata { | |||
| 240 | 238 | ||
| 241 | extern int acpi_processor_preregister_performance(struct | 239 | extern int acpi_processor_preregister_performance(struct |
| 242 | acpi_processor_performance | 240 | acpi_processor_performance |
| 243 | *performance); | 241 | __percpu *performance); |
| 244 | 242 | ||
| 245 | extern int acpi_processor_register_performance(struct acpi_processor_performance | 243 | extern int acpi_processor_register_performance(struct acpi_processor_performance |
| 246 | *performance, unsigned int cpu); | 244 | *performance, unsigned int cpu); |
| @@ -257,9 +255,6 @@ int acpi_processor_notify_smm(struct module *calling_module); | |||
| 257 | DECLARE_PER_CPU(struct acpi_processor *, processors); | 255 | DECLARE_PER_CPU(struct acpi_processor *, processors); |
| 258 | extern struct acpi_processor_errata errata; | 256 | extern struct acpi_processor_errata errata; |
| 259 | 257 | ||
| 260 | void arch_acpi_processor_init_pdc(struct acpi_processor *pr); | ||
| 261 | void arch_acpi_processor_cleanup_pdc(struct acpi_processor *pr); | ||
| 262 | |||
| 263 | #ifdef ARCH_HAS_POWER_INIT | 258 | #ifdef ARCH_HAS_POWER_INIT |
| 264 | void acpi_processor_power_init_bm_check(struct acpi_processor_flags *flags, | 259 | void acpi_processor_power_init_bm_check(struct acpi_processor_flags *flags, |
| 265 | unsigned int cpu); | 260 | unsigned int cpu); |
| @@ -294,7 +289,8 @@ static inline void acpi_processor_ffh_cstate_enter(struct acpi_processor_cx | |||
| 294 | #ifdef CONFIG_CPU_FREQ | 289 | #ifdef CONFIG_CPU_FREQ |
| 295 | void acpi_processor_ppc_init(void); | 290 | void acpi_processor_ppc_init(void); |
| 296 | void acpi_processor_ppc_exit(void); | 291 | void acpi_processor_ppc_exit(void); |
| 297 | int acpi_processor_ppc_has_changed(struct acpi_processor *pr); | 292 | int acpi_processor_ppc_has_changed(struct acpi_processor *pr, int event_flag); |
| 293 | extern int acpi_processor_get_bios_limit(int cpu, unsigned int *limit); | ||
| 298 | #else | 294 | #else |
| 299 | static inline void acpi_processor_ppc_init(void) | 295 | static inline void acpi_processor_ppc_init(void) |
| 300 | { | 296 | { |
| @@ -304,7 +300,8 @@ static inline void acpi_processor_ppc_exit(void) | |||
| 304 | { | 300 | { |
| 305 | return; | 301 | return; |
| 306 | } | 302 | } |
| 307 | static inline int acpi_processor_ppc_has_changed(struct acpi_processor *pr) | 303 | static inline int acpi_processor_ppc_has_changed(struct acpi_processor *pr, |
| 304 | int event_flag) | ||
| 308 | { | 305 | { |
| 309 | static unsigned int printout = 1; | 306 | static unsigned int printout = 1; |
| 310 | if (printout) { | 307 | if (printout) { |
| @@ -316,8 +313,24 @@ static inline int acpi_processor_ppc_has_changed(struct acpi_processor *pr) | |||
| 316 | } | 313 | } |
| 317 | return 0; | 314 | return 0; |
| 318 | } | 315 | } |
| 316 | static inline int acpi_processor_get_bios_limit(int cpu, unsigned int *limit) | ||
| 317 | { | ||
| 318 | return -ENODEV; | ||
| 319 | } | ||
| 320 | |||
| 319 | #endif /* CONFIG_CPU_FREQ */ | 321 | #endif /* CONFIG_CPU_FREQ */ |
| 320 | 322 | ||
| 323 | /* in processor_core.c */ | ||
| 324 | void acpi_processor_set_pdc(acpi_handle handle); | ||
| 325 | #ifdef CONFIG_SMP | ||
| 326 | int acpi_get_cpuid(acpi_handle, int type, u32 acpi_id); | ||
| 327 | #else | ||
| 328 | static inline int acpi_get_cpuid(acpi_handle handle, int type, u32 acpi_id) | ||
| 329 | { | ||
| 330 | return -1; | ||
| 331 | } | ||
| 332 | #endif | ||
| 333 | |||
| 321 | /* in processor_throttling.c */ | 334 | /* in processor_throttling.c */ |
| 322 | int acpi_processor_tstate_has_changed(struct acpi_processor *pr); | 335 | int acpi_processor_tstate_has_changed(struct acpi_processor *pr); |
| 323 | int acpi_processor_get_throttling_info(struct acpi_processor *pr); | 336 | int acpi_processor_get_throttling_info(struct acpi_processor *pr); |
diff --git a/include/asm-generic/bitops/atomic.h b/include/asm-generic/bitops/atomic.h index c8946465e63a..ecc44a8e2b44 100644 --- a/include/asm-generic/bitops/atomic.h +++ b/include/asm-generic/bitops/atomic.h | |||
| @@ -15,19 +15,19 @@ | |||
| 15 | # define ATOMIC_HASH_SIZE 4 | 15 | # define ATOMIC_HASH_SIZE 4 |
| 16 | # define ATOMIC_HASH(a) (&(__atomic_hash[ (((unsigned long) a)/L1_CACHE_BYTES) & (ATOMIC_HASH_SIZE-1) ])) | 16 | # define ATOMIC_HASH(a) (&(__atomic_hash[ (((unsigned long) a)/L1_CACHE_BYTES) & (ATOMIC_HASH_SIZE-1) ])) |
| 17 | 17 | ||
| 18 | extern raw_spinlock_t __atomic_hash[ATOMIC_HASH_SIZE] __lock_aligned; | 18 | extern arch_spinlock_t __atomic_hash[ATOMIC_HASH_SIZE] __lock_aligned; |
| 19 | 19 | ||
| 20 | /* Can't use raw_spin_lock_irq because of #include problems, so | 20 | /* Can't use raw_spin_lock_irq because of #include problems, so |
| 21 | * this is the substitute */ | 21 | * this is the substitute */ |
| 22 | #define _atomic_spin_lock_irqsave(l,f) do { \ | 22 | #define _atomic_spin_lock_irqsave(l,f) do { \ |
| 23 | raw_spinlock_t *s = ATOMIC_HASH(l); \ | 23 | arch_spinlock_t *s = ATOMIC_HASH(l); \ |
| 24 | local_irq_save(f); \ | 24 | local_irq_save(f); \ |
| 25 | __raw_spin_lock(s); \ | 25 | arch_spin_lock(s); \ |
| 26 | } while(0) | 26 | } while(0) |
| 27 | 27 | ||
| 28 | #define _atomic_spin_unlock_irqrestore(l,f) do { \ | 28 | #define _atomic_spin_unlock_irqrestore(l,f) do { \ |
| 29 | raw_spinlock_t *s = ATOMIC_HASH(l); \ | 29 | arch_spinlock_t *s = ATOMIC_HASH(l); \ |
| 30 | __raw_spin_unlock(s); \ | 30 | arch_spin_unlock(s); \ |
| 31 | local_irq_restore(f); \ | 31 | local_irq_restore(f); \ |
| 32 | } while(0) | 32 | } while(0) |
| 33 | 33 | ||
diff --git a/include/asm-generic/bug.h b/include/asm-generic/bug.h index 4b6755984d24..18c435d7c082 100644 --- a/include/asm-generic/bug.h +++ b/include/asm-generic/bug.h | |||
| @@ -113,22 +113,22 @@ extern void warn_slowpath_null(const char *file, const int line); | |||
| 113 | #endif | 113 | #endif |
| 114 | 114 | ||
| 115 | #define WARN_ON_ONCE(condition) ({ \ | 115 | #define WARN_ON_ONCE(condition) ({ \ |
| 116 | static int __warned; \ | 116 | static bool __warned; \ |
| 117 | int __ret_warn_once = !!(condition); \ | 117 | int __ret_warn_once = !!(condition); \ |
| 118 | \ | 118 | \ |
| 119 | if (unlikely(__ret_warn_once)) \ | 119 | if (unlikely(__ret_warn_once)) \ |
| 120 | if (WARN_ON(!__warned)) \ | 120 | if (WARN_ON(!__warned)) \ |
| 121 | __warned = 1; \ | 121 | __warned = true; \ |
| 122 | unlikely(__ret_warn_once); \ | 122 | unlikely(__ret_warn_once); \ |
| 123 | }) | 123 | }) |
| 124 | 124 | ||
| 125 | #define WARN_ONCE(condition, format...) ({ \ | 125 | #define WARN_ONCE(condition, format...) ({ \ |
| 126 | static int __warned; \ | 126 | static bool __warned; \ |
| 127 | int __ret_warn_once = !!(condition); \ | 127 | int __ret_warn_once = !!(condition); \ |
| 128 | \ | 128 | \ |
| 129 | if (unlikely(__ret_warn_once)) \ | 129 | if (unlikely(__ret_warn_once)) \ |
| 130 | if (WARN(!__warned, format)) \ | 130 | if (WARN(!__warned, format)) \ |
| 131 | __warned = 1; \ | 131 | __warned = true; \ |
| 132 | unlikely(__ret_warn_once); \ | 132 | unlikely(__ret_warn_once); \ |
| 133 | }) | 133 | }) |
| 134 | 134 | ||
diff --git a/include/asm-generic/cacheflush.h b/include/asm-generic/cacheflush.h index ba4ec39a1131..57b5c3c82e86 100644 --- a/include/asm-generic/cacheflush.h +++ b/include/asm-generic/cacheflush.h | |||
| @@ -13,6 +13,7 @@ | |||
| 13 | #define flush_cache_dup_mm(mm) do { } while (0) | 13 | #define flush_cache_dup_mm(mm) do { } while (0) |
| 14 | #define flush_cache_range(vma, start, end) do { } while (0) | 14 | #define flush_cache_range(vma, start, end) do { } while (0) |
| 15 | #define flush_cache_page(vma, vmaddr, pfn) do { } while (0) | 15 | #define flush_cache_page(vma, vmaddr, pfn) do { } while (0) |
| 16 | #define ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE 0 | ||
| 16 | #define flush_dcache_page(page) do { } while (0) | 17 | #define flush_dcache_page(page) do { } while (0) |
| 17 | #define flush_dcache_mmap_lock(mapping) do { } while (0) | 18 | #define flush_dcache_mmap_lock(mapping) do { } while (0) |
| 18 | #define flush_dcache_mmap_unlock(mapping) do { } while (0) | 19 | #define flush_dcache_mmap_unlock(mapping) do { } while (0) |
diff --git a/include/asm-generic/dma-mapping-common.h b/include/asm-generic/dma-mapping-common.h index e694263445f7..69206957b72c 100644 --- a/include/asm-generic/dma-mapping-common.h +++ b/include/asm-generic/dma-mapping-common.h | |||
| @@ -131,7 +131,7 @@ static inline void dma_sync_single_range_for_cpu(struct device *dev, | |||
| 131 | debug_dma_sync_single_range_for_cpu(dev, addr, offset, size, dir); | 131 | debug_dma_sync_single_range_for_cpu(dev, addr, offset, size, dir); |
| 132 | 132 | ||
| 133 | } else | 133 | } else |
| 134 | dma_sync_single_for_cpu(dev, addr, size, dir); | 134 | dma_sync_single_for_cpu(dev, addr + offset, size, dir); |
| 135 | } | 135 | } |
| 136 | 136 | ||
| 137 | static inline void dma_sync_single_range_for_device(struct device *dev, | 137 | static inline void dma_sync_single_range_for_device(struct device *dev, |
| @@ -148,7 +148,7 @@ static inline void dma_sync_single_range_for_device(struct device *dev, | |||
| 148 | debug_dma_sync_single_range_for_device(dev, addr, offset, size, dir); | 148 | debug_dma_sync_single_range_for_device(dev, addr, offset, size, dir); |
| 149 | 149 | ||
| 150 | } else | 150 | } else |
| 151 | dma_sync_single_for_device(dev, addr, size, dir); | 151 | dma_sync_single_for_device(dev, addr + offset, size, dir); |
| 152 | } | 152 | } |
| 153 | 153 | ||
| 154 | static inline void | 154 | static inline void |
diff --git a/include/asm-generic/fcntl.h b/include/asm-generic/fcntl.h index 495dc8af4044..fcd268ce0674 100644 --- a/include/asm-generic/fcntl.h +++ b/include/asm-generic/fcntl.h | |||
| @@ -3,8 +3,6 @@ | |||
| 3 | 3 | ||
| 4 | #include <linux/types.h> | 4 | #include <linux/types.h> |
| 5 | 5 | ||
| 6 | /* open/fcntl - O_SYNC is only implemented on blocks devices and on files | ||
| 7 | located on an ext2 file system */ | ||
| 8 | #define O_ACCMODE 00000003 | 6 | #define O_ACCMODE 00000003 |
| 9 | #define O_RDONLY 00000000 | 7 | #define O_RDONLY 00000000 |
| 10 | #define O_WRONLY 00000001 | 8 | #define O_WRONLY 00000001 |
| @@ -27,8 +25,8 @@ | |||
| 27 | #ifndef O_NONBLOCK | 25 | #ifndef O_NONBLOCK |
| 28 | #define O_NONBLOCK 00004000 | 26 | #define O_NONBLOCK 00004000 |
| 29 | #endif | 27 | #endif |
| 30 | #ifndef O_SYNC | 28 | #ifndef O_DSYNC |
| 31 | #define O_SYNC 00010000 | 29 | #define O_DSYNC 00010000 /* used to be O_SYNC, see below */ |
| 32 | #endif | 30 | #endif |
| 33 | #ifndef FASYNC | 31 | #ifndef FASYNC |
| 34 | #define FASYNC 00020000 /* fcntl, for BSD compatibility */ | 32 | #define FASYNC 00020000 /* fcntl, for BSD compatibility */ |
| @@ -51,6 +49,25 @@ | |||
| 51 | #ifndef O_CLOEXEC | 49 | #ifndef O_CLOEXEC |
| 52 | #define O_CLOEXEC 02000000 /* set close_on_exec */ | 50 | #define O_CLOEXEC 02000000 /* set close_on_exec */ |
| 53 | #endif | 51 | #endif |
| 52 | |||
| 53 | /* | ||
| 54 | * Before Linux 2.6.33 only O_DSYNC semantics were implemented, but using | ||
| 55 | * the O_SYNC flag. We continue to use the existing numerical value | ||
| 56 | * for O_DSYNC semantics now, but using the correct symbolic name for it. | ||
| 57 | * This new value is used to request true Posix O_SYNC semantics. It is | ||
| 58 | * defined in this strange way to make sure applications compiled against | ||
| 59 | * new headers get at least O_DSYNC semantics on older kernels. | ||
| 60 | * | ||
| 61 | * This has the nice side-effect that we can simply test for O_DSYNC | ||
| 62 | * wherever we do not care if O_DSYNC or O_SYNC is used. | ||
| 63 | * | ||
| 64 | * Note: __O_SYNC must never be used directly. | ||
| 65 | */ | ||
| 66 | #ifndef O_SYNC | ||
| 67 | #define __O_SYNC 04000000 | ||
| 68 | #define O_SYNC (__O_SYNC|O_DSYNC) | ||
| 69 | #endif | ||
| 70 | |||
| 54 | #ifndef O_NDELAY | 71 | #ifndef O_NDELAY |
| 55 | #define O_NDELAY O_NONBLOCK | 72 | #define O_NDELAY O_NONBLOCK |
| 56 | #endif | 73 | #endif |
diff --git a/include/asm-generic/gpio.h b/include/asm-generic/gpio.h index 66d6106a2067..979c6a57f2f1 100644 --- a/include/asm-generic/gpio.h +++ b/include/asm-generic/gpio.h | |||
| @@ -28,6 +28,7 @@ static inline int gpio_is_valid(int number) | |||
| 28 | return ((unsigned)number) < ARCH_NR_GPIOS; | 28 | return ((unsigned)number) < ARCH_NR_GPIOS; |
| 29 | } | 29 | } |
| 30 | 30 | ||
| 31 | struct device; | ||
| 31 | struct seq_file; | 32 | struct seq_file; |
| 32 | struct module; | 33 | struct module; |
| 33 | 34 | ||
| @@ -135,6 +136,32 @@ extern int __gpio_cansleep(unsigned gpio); | |||
| 135 | 136 | ||
| 136 | extern int __gpio_to_irq(unsigned gpio); | 137 | extern int __gpio_to_irq(unsigned gpio); |
| 137 | 138 | ||
| 139 | #define GPIOF_DIR_OUT (0 << 0) | ||
| 140 | #define GPIOF_DIR_IN (1 << 0) | ||
| 141 | |||
| 142 | #define GPIOF_INIT_LOW (0 << 1) | ||
| 143 | #define GPIOF_INIT_HIGH (1 << 1) | ||
| 144 | |||
| 145 | #define GPIOF_IN (GPIOF_DIR_IN) | ||
| 146 | #define GPIOF_OUT_INIT_LOW (GPIOF_DIR_OUT | GPIOF_INIT_LOW) | ||
| 147 | #define GPIOF_OUT_INIT_HIGH (GPIOF_DIR_OUT | GPIOF_INIT_HIGH) | ||
| 148 | |||
| 149 | /** | ||
| 150 | * struct gpio - a structure describing a GPIO with configuration | ||
| 151 | * @gpio: the GPIO number | ||
| 152 | * @flags: GPIO configuration as specified by GPIOF_* | ||
| 153 | * @label: a literal description string of this GPIO | ||
| 154 | */ | ||
| 155 | struct gpio { | ||
| 156 | unsigned gpio; | ||
| 157 | unsigned long flags; | ||
| 158 | const char *label; | ||
| 159 | }; | ||
| 160 | |||
| 161 | extern int gpio_request_one(unsigned gpio, unsigned long flags, const char *label); | ||
| 162 | extern int gpio_request_array(struct gpio *array, size_t num); | ||
| 163 | extern void gpio_free_array(struct gpio *array, size_t num); | ||
| 164 | |||
| 138 | #ifdef CONFIG_GPIO_SYSFS | 165 | #ifdef CONFIG_GPIO_SYSFS |
| 139 | 166 | ||
| 140 | /* | 167 | /* |
| @@ -144,6 +171,7 @@ extern int __gpio_to_irq(unsigned gpio); | |||
| 144 | extern int gpio_export(unsigned gpio, bool direction_may_change); | 171 | extern int gpio_export(unsigned gpio, bool direction_may_change); |
| 145 | extern int gpio_export_link(struct device *dev, const char *name, | 172 | extern int gpio_export_link(struct device *dev, const char *name, |
| 146 | unsigned gpio); | 173 | unsigned gpio); |
| 174 | extern int gpio_sysfs_set_active_low(unsigned gpio, int value); | ||
| 147 | extern void gpio_unexport(unsigned gpio); | 175 | extern void gpio_unexport(unsigned gpio); |
| 148 | 176 | ||
| 149 | #endif /* CONFIG_GPIO_SYSFS */ | 177 | #endif /* CONFIG_GPIO_SYSFS */ |
| @@ -181,6 +209,8 @@ static inline void gpio_set_value_cansleep(unsigned gpio, int value) | |||
| 181 | 209 | ||
| 182 | #ifndef CONFIG_GPIO_SYSFS | 210 | #ifndef CONFIG_GPIO_SYSFS |
| 183 | 211 | ||
| 212 | struct device; | ||
| 213 | |||
| 184 | /* sysfs support is only available with gpiolib, where it's optional */ | 214 | /* sysfs support is only available with gpiolib, where it's optional */ |
| 185 | 215 | ||
| 186 | static inline int gpio_export(unsigned gpio, bool direction_may_change) | 216 | static inline int gpio_export(unsigned gpio, bool direction_may_change) |
| @@ -194,6 +224,11 @@ static inline int gpio_export_link(struct device *dev, const char *name, | |||
| 194 | return -ENOSYS; | 224 | return -ENOSYS; |
| 195 | } | 225 | } |
| 196 | 226 | ||
| 227 | static inline int gpio_sysfs_set_active_low(unsigned gpio, int value) | ||
| 228 | { | ||
| 229 | return -ENOSYS; | ||
| 230 | } | ||
| 231 | |||
| 197 | static inline void gpio_unexport(unsigned gpio) | 232 | static inline void gpio_unexport(unsigned gpio) |
| 198 | { | 233 | { |
| 199 | } | 234 | } |
diff --git a/include/asm-generic/local.h b/include/asm-generic/local.h index fc218444e315..c8a5d68541d7 100644 --- a/include/asm-generic/local.h +++ b/include/asm-generic/local.h | |||
| @@ -52,23 +52,4 @@ typedef struct | |||
| 52 | #define __local_add(i,l) local_set((l), local_read(l) + (i)) | 52 | #define __local_add(i,l) local_set((l), local_read(l) + (i)) |
| 53 | #define __local_sub(i,l) local_set((l), local_read(l) - (i)) | 53 | #define __local_sub(i,l) local_set((l), local_read(l) - (i)) |
| 54 | 54 | ||
| 55 | /* Use these for per-cpu local_t variables: on some archs they are | ||
| 56 | * much more efficient than these naive implementations. Note they take | ||
| 57 | * a variable (eg. mystruct.foo), not an address. | ||
| 58 | */ | ||
| 59 | #define cpu_local_read(l) local_read(&__get_cpu_var(l)) | ||
| 60 | #define cpu_local_set(l, i) local_set(&__get_cpu_var(l), (i)) | ||
| 61 | #define cpu_local_inc(l) local_inc(&__get_cpu_var(l)) | ||
| 62 | #define cpu_local_dec(l) local_dec(&__get_cpu_var(l)) | ||
| 63 | #define cpu_local_add(i, l) local_add((i), &__get_cpu_var(l)) | ||
| 64 | #define cpu_local_sub(i, l) local_sub((i), &__get_cpu_var(l)) | ||
| 65 | |||
| 66 | /* Non-atomic increments, ie. preemption disabled and won't be touched | ||
| 67 | * in interrupt, etc. Some archs can optimize this case well. | ||
| 68 | */ | ||
| 69 | #define __cpu_local_inc(l) __local_inc(&__get_cpu_var(l)) | ||
| 70 | #define __cpu_local_dec(l) __local_dec(&__get_cpu_var(l)) | ||
| 71 | #define __cpu_local_add(i, l) __local_add((i), &__get_cpu_var(l)) | ||
| 72 | #define __cpu_local_sub(i, l) __local_sub((i), &__get_cpu_var(l)) | ||
| 73 | |||
| 74 | #endif /* _ASM_GENERIC_LOCAL_H */ | 55 | #endif /* _ASM_GENERIC_LOCAL_H */ |
diff --git a/include/asm-generic/memory_model.h b/include/asm-generic/memory_model.h index 4c8d0afae711..fb2d63f13f4c 100644 --- a/include/asm-generic/memory_model.h +++ b/include/asm-generic/memory_model.h | |||
| @@ -47,7 +47,7 @@ | |||
| 47 | 47 | ||
| 48 | #elif defined(CONFIG_SPARSEMEM_VMEMMAP) | 48 | #elif defined(CONFIG_SPARSEMEM_VMEMMAP) |
| 49 | 49 | ||
| 50 | /* memmap is virtually contigious. */ | 50 | /* memmap is virtually contiguous. */ |
| 51 | #define __pfn_to_page(pfn) (vmemmap + (pfn)) | 51 | #define __pfn_to_page(pfn) (vmemmap + (pfn)) |
| 52 | #define __page_to_pfn(page) (unsigned long)((page) - vmemmap) | 52 | #define __page_to_pfn(page) (unsigned long)((page) - vmemmap) |
| 53 | 53 | ||
diff --git a/include/asm-generic/mman-common.h b/include/asm-generic/mman-common.h index 5ee13b2fd223..3da9e2742fa0 100644 --- a/include/asm-generic/mman-common.h +++ b/include/asm-generic/mman-common.h | |||
| @@ -19,6 +19,11 @@ | |||
| 19 | #define MAP_TYPE 0x0f /* Mask for type of mapping */ | 19 | #define MAP_TYPE 0x0f /* Mask for type of mapping */ |
| 20 | #define MAP_FIXED 0x10 /* Interpret addr exactly */ | 20 | #define MAP_FIXED 0x10 /* Interpret addr exactly */ |
| 21 | #define MAP_ANONYMOUS 0x20 /* don't use a file */ | 21 | #define MAP_ANONYMOUS 0x20 /* don't use a file */ |
| 22 | #ifdef CONFIG_MMAP_ALLOW_UNINITIALIZED | ||
| 23 | # define MAP_UNINITIALIZED 0x4000000 /* For anonymous mmap, memory could be uninitialized */ | ||
| 24 | #else | ||
| 25 | # define MAP_UNINITIALIZED 0x0 /* Don't support this flag */ | ||
| 26 | #endif | ||
| 22 | 27 | ||
| 23 | #define MS_ASYNC 1 /* sync memory asynchronously */ | 28 | #define MS_ASYNC 1 /* sync memory asynchronously */ |
| 24 | #define MS_INVALIDATE 2 /* invalidate the caches */ | 29 | #define MS_INVALIDATE 2 /* invalidate the caches */ |
| @@ -35,6 +40,7 @@ | |||
| 35 | #define MADV_DONTFORK 10 /* don't inherit across fork */ | 40 | #define MADV_DONTFORK 10 /* don't inherit across fork */ |
| 36 | #define MADV_DOFORK 11 /* do inherit across fork */ | 41 | #define MADV_DOFORK 11 /* do inherit across fork */ |
| 37 | #define MADV_HWPOISON 100 /* poison a page for testing */ | 42 | #define MADV_HWPOISON 100 /* poison a page for testing */ |
| 43 | #define MADV_SOFT_OFFLINE 101 /* soft offline page for testing */ | ||
| 38 | 44 | ||
| 39 | #define MADV_MERGEABLE 12 /* KSM may merge identical pages */ | 45 | #define MADV_MERGEABLE 12 /* KSM may merge identical pages */ |
| 40 | #define MADV_UNMERGEABLE 13 /* KSM may not merge identical pages */ | 46 | #define MADV_UNMERGEABLE 13 /* KSM may not merge identical pages */ |
diff --git a/include/asm-generic/pci-dma-compat.h b/include/asm-generic/pci-dma-compat.h index 37b3706226e7..1437b7da09b2 100644 --- a/include/asm-generic/pci-dma-compat.h +++ b/include/asm-generic/pci-dma-compat.h | |||
| @@ -6,9 +6,6 @@ | |||
| 6 | 6 | ||
| 7 | #include <linux/dma-mapping.h> | 7 | #include <linux/dma-mapping.h> |
| 8 | 8 | ||
| 9 | /* note pci_set_dma_mask isn't here, since it's a public function | ||
| 10 | * exported from drivers/pci, use dma_supported instead */ | ||
| 11 | |||
| 12 | static inline int | 9 | static inline int |
| 13 | pci_dma_supported(struct pci_dev *hwdev, u64 mask) | 10 | pci_dma_supported(struct pci_dev *hwdev, u64 mask) |
| 14 | { | 11 | { |
| @@ -104,4 +101,16 @@ pci_dma_mapping_error(struct pci_dev *pdev, dma_addr_t dma_addr) | |||
| 104 | return dma_mapping_error(&pdev->dev, dma_addr); | 101 | return dma_mapping_error(&pdev->dev, dma_addr); |
| 105 | } | 102 | } |
| 106 | 103 | ||
| 104 | #ifdef CONFIG_PCI | ||
| 105 | static inline int pci_set_dma_mask(struct pci_dev *dev, u64 mask) | ||
| 106 | { | ||
| 107 | return dma_set_mask(&dev->dev, mask); | ||
| 108 | } | ||
| 109 | |||
| 110 | static inline int pci_set_consistent_dma_mask(struct pci_dev *dev, u64 mask) | ||
| 111 | { | ||
| 112 | return dma_set_coherent_mask(&dev->dev, mask); | ||
| 113 | } | ||
| 114 | #endif | ||
| 115 | |||
| 107 | #endif | 116 | #endif |
diff --git a/include/asm-generic/percpu.h b/include/asm-generic/percpu.h index 90079c373f1c..04f91c2d3f7b 100644 --- a/include/asm-generic/percpu.h +++ b/include/asm-generic/percpu.h | |||
| @@ -41,7 +41,11 @@ extern unsigned long __per_cpu_offset[NR_CPUS]; | |||
| 41 | * Only S390 provides its own means of moving the pointer. | 41 | * Only S390 provides its own means of moving the pointer. |
| 42 | */ | 42 | */ |
| 43 | #ifndef SHIFT_PERCPU_PTR | 43 | #ifndef SHIFT_PERCPU_PTR |
| 44 | #define SHIFT_PERCPU_PTR(__p, __offset) RELOC_HIDE((__p), (__offset)) | 44 | /* Weird cast keeps both GCC and sparse happy. */ |
| 45 | #define SHIFT_PERCPU_PTR(__p, __offset) ({ \ | ||
| 46 | __verify_pcpu_ptr((__p)); \ | ||
| 47 | RELOC_HIDE((typeof(*(__p)) __kernel __force *)(__p), (__offset)); \ | ||
| 48 | }) | ||
| 45 | #endif | 49 | #endif |
| 46 | 50 | ||
| 47 | /* | 51 | /* |
| @@ -50,11 +54,14 @@ extern unsigned long __per_cpu_offset[NR_CPUS]; | |||
| 50 | * offset. | 54 | * offset. |
| 51 | */ | 55 | */ |
| 52 | #define per_cpu(var, cpu) \ | 56 | #define per_cpu(var, cpu) \ |
| 53 | (*SHIFT_PERCPU_PTR(&per_cpu_var(var), per_cpu_offset(cpu))) | 57 | (*SHIFT_PERCPU_PTR(&(var), per_cpu_offset(cpu))) |
| 54 | #define __get_cpu_var(var) \ | 58 | #define __get_cpu_var(var) \ |
| 55 | (*SHIFT_PERCPU_PTR(&per_cpu_var(var), my_cpu_offset)) | 59 | (*SHIFT_PERCPU_PTR(&(var), my_cpu_offset)) |
| 56 | #define __raw_get_cpu_var(var) \ | 60 | #define __raw_get_cpu_var(var) \ |
| 57 | (*SHIFT_PERCPU_PTR(&per_cpu_var(var), __my_cpu_offset)) | 61 | (*SHIFT_PERCPU_PTR(&(var), __my_cpu_offset)) |
| 62 | |||
| 63 | #define this_cpu_ptr(ptr) SHIFT_PERCPU_PTR(ptr, my_cpu_offset) | ||
| 64 | #define __this_cpu_ptr(ptr) SHIFT_PERCPU_PTR(ptr, __my_cpu_offset) | ||
| 58 | 65 | ||
| 59 | 66 | ||
| 60 | #ifdef CONFIG_HAVE_SETUP_PER_CPU_AREA | 67 | #ifdef CONFIG_HAVE_SETUP_PER_CPU_AREA |
| @@ -63,9 +70,11 @@ extern void setup_per_cpu_areas(void); | |||
| 63 | 70 | ||
| 64 | #else /* ! SMP */ | 71 | #else /* ! SMP */ |
| 65 | 72 | ||
| 66 | #define per_cpu(var, cpu) (*((void)(cpu), &per_cpu_var(var))) | 73 | #define per_cpu(var, cpu) (*((void)(cpu), &(var))) |
| 67 | #define __get_cpu_var(var) per_cpu_var(var) | 74 | #define __get_cpu_var(var) (var) |
| 68 | #define __raw_get_cpu_var(var) per_cpu_var(var) | 75 | #define __raw_get_cpu_var(var) (var) |
| 76 | #define this_cpu_ptr(ptr) per_cpu_ptr(ptr, 0) | ||
| 77 | #define __this_cpu_ptr(ptr) this_cpu_ptr(ptr) | ||
| 69 | 78 | ||
| 70 | #endif /* SMP */ | 79 | #endif /* SMP */ |
| 71 | 80 | ||
diff --git a/include/asm-generic/socket.h b/include/asm-generic/socket.h index 538991cef6f0..9a6115e7cf63 100644 --- a/include/asm-generic/socket.h +++ b/include/asm-generic/socket.h | |||
| @@ -63,4 +63,5 @@ | |||
| 63 | #define SO_PROTOCOL 38 | 63 | #define SO_PROTOCOL 38 |
| 64 | #define SO_DOMAIN 39 | 64 | #define SO_DOMAIN 39 |
| 65 | 65 | ||
| 66 | #define SO_RXQ_OVFL 40 | ||
| 66 | #endif /* __ASM_GENERIC_SOCKET_H */ | 67 | #endif /* __ASM_GENERIC_SOCKET_H */ |
diff --git a/include/asm-generic/unistd.h b/include/asm-generic/unistd.h index d76b66acea95..6a0b30f78a62 100644 --- a/include/asm-generic/unistd.h +++ b/include/asm-generic/unistd.h | |||
| @@ -622,16 +622,20 @@ __SYSCALL(__NR_move_pages, sys_move_pages) | |||
| 622 | __SYSCALL(__NR_rt_tgsigqueueinfo, sys_rt_tgsigqueueinfo) | 622 | __SYSCALL(__NR_rt_tgsigqueueinfo, sys_rt_tgsigqueueinfo) |
| 623 | #define __NR_perf_event_open 241 | 623 | #define __NR_perf_event_open 241 |
| 624 | __SYSCALL(__NR_perf_event_open, sys_perf_event_open) | 624 | __SYSCALL(__NR_perf_event_open, sys_perf_event_open) |
| 625 | #define __NR_accept4 242 | ||
| 626 | __SYSCALL(__NR_accept4, sys_accept4) | ||
| 627 | #define __NR_recvmmsg 243 | ||
| 628 | __SYSCALL(__NR_recvmmsg, sys_recvmmsg) | ||
| 625 | 629 | ||
| 626 | #undef __NR_syscalls | 630 | #undef __NR_syscalls |
| 627 | #define __NR_syscalls 242 | 631 | #define __NR_syscalls 244 |
| 628 | 632 | ||
| 629 | /* | 633 | /* |
| 630 | * All syscalls below here should go away really, | 634 | * All syscalls below here should go away really, |
| 631 | * these are provided for both review and as a porting | 635 | * these are provided for both review and as a porting |
| 632 | * help for the C library version. | 636 | * help for the C library version. |
| 633 | * | 637 | * |
| 634 | * Last chance: are any of these important enought to | 638 | * Last chance: are any of these important enough to |
| 635 | * enable by default? | 639 | * enable by default? |
| 636 | */ | 640 | */ |
| 637 | #ifdef __ARCH_WANT_SYSCALL_NO_AT | 641 | #ifdef __ARCH_WANT_SYSCALL_NO_AT |
| @@ -802,7 +806,7 @@ __SYSCALL(__NR_fork, sys_ni_syscall) | |||
| 802 | #define __NR_statfs __NR3264_statfs | 806 | #define __NR_statfs __NR3264_statfs |
| 803 | #define __NR_fstatfs __NR3264_fstatfs | 807 | #define __NR_fstatfs __NR3264_fstatfs |
| 804 | #define __NR_truncate __NR3264_truncate | 808 | #define __NR_truncate __NR3264_truncate |
| 805 | #define __NR_ftruncate __NR3264_truncate | 809 | #define __NR_ftruncate __NR3264_ftruncate |
| 806 | #define __NR_lseek __NR3264_lseek | 810 | #define __NR_lseek __NR3264_lseek |
| 807 | #define __NR_sendfile __NR3264_sendfile | 811 | #define __NR_sendfile __NR3264_sendfile |
| 808 | #define __NR_newfstatat __NR3264_fstatat | 812 | #define __NR_newfstatat __NR3264_fstatat |
| @@ -818,7 +822,7 @@ __SYSCALL(__NR_fork, sys_ni_syscall) | |||
| 818 | #define __NR_statfs64 __NR3264_statfs | 822 | #define __NR_statfs64 __NR3264_statfs |
| 819 | #define __NR_fstatfs64 __NR3264_fstatfs | 823 | #define __NR_fstatfs64 __NR3264_fstatfs |
| 820 | #define __NR_truncate64 __NR3264_truncate | 824 | #define __NR_truncate64 __NR3264_truncate |
| 821 | #define __NR_ftruncate64 __NR3264_truncate | 825 | #define __NR_ftruncate64 __NR3264_ftruncate |
| 822 | #define __NR_llseek __NR3264_lseek | 826 | #define __NR_llseek __NR3264_lseek |
| 823 | #define __NR_sendfile64 __NR3264_sendfile | 827 | #define __NR_sendfile64 __NR3264_sendfile |
| 824 | #define __NR_fstatat64 __NR3264_fstatat | 828 | #define __NR_fstatat64 __NR3264_fstatat |
diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h index b6e818f4b247..67e652068e0e 100644 --- a/include/asm-generic/vmlinux.lds.h +++ b/include/asm-generic/vmlinux.lds.h | |||
| @@ -52,8 +52,12 @@ | |||
| 52 | #define LOAD_OFFSET 0 | 52 | #define LOAD_OFFSET 0 |
| 53 | #endif | 53 | #endif |
| 54 | 54 | ||
| 55 | #ifndef VMLINUX_SYMBOL | 55 | #ifndef SYMBOL_PREFIX |
| 56 | #define VMLINUX_SYMBOL(_sym_) _sym_ | 56 | #define VMLINUX_SYMBOL(sym) sym |
| 57 | #else | ||
| 58 | #define PASTE2(x,y) x##y | ||
| 59 | #define PASTE(x,y) PASTE2(x,y) | ||
| 60 | #define VMLINUX_SYMBOL(sym) PASTE(SYMBOL_PREFIX, sym) | ||
| 57 | #endif | 61 | #endif |
| 58 | 62 | ||
| 59 | /* Align . to a 8 byte boundary equals to maximum function alignment. */ | 63 | /* Align . to a 8 byte boundary equals to maximum function alignment. */ |
diff --git a/include/crypto/algapi.h b/include/crypto/algapi.h index 1ffb53f74d37..fc0d575c71e0 100644 --- a/include/crypto/algapi.h +++ b/include/crypto/algapi.h | |||
| @@ -106,7 +106,6 @@ struct blkcipher_walk { | |||
| 106 | extern const struct crypto_type crypto_ablkcipher_type; | 106 | extern const struct crypto_type crypto_ablkcipher_type; |
| 107 | extern const struct crypto_type crypto_aead_type; | 107 | extern const struct crypto_type crypto_aead_type; |
| 108 | extern const struct crypto_type crypto_blkcipher_type; | 108 | extern const struct crypto_type crypto_blkcipher_type; |
| 109 | extern const struct crypto_type crypto_hash_type; | ||
| 110 | 109 | ||
| 111 | void crypto_mod_put(struct crypto_alg *alg); | 110 | void crypto_mod_put(struct crypto_alg *alg); |
| 112 | 111 | ||
diff --git a/include/crypto/cryptd.h b/include/crypto/cryptd.h index 2f65a6e8ea4d..1c96b255017c 100644 --- a/include/crypto/cryptd.h +++ b/include/crypto/cryptd.h | |||
| @@ -39,6 +39,7 @@ static inline struct cryptd_ahash *__cryptd_ahash_cast( | |||
| 39 | struct cryptd_ahash *cryptd_alloc_ahash(const char *alg_name, | 39 | struct cryptd_ahash *cryptd_alloc_ahash(const char *alg_name, |
| 40 | u32 type, u32 mask); | 40 | u32 type, u32 mask); |
| 41 | struct crypto_shash *cryptd_ahash_child(struct cryptd_ahash *tfm); | 41 | struct crypto_shash *cryptd_ahash_child(struct cryptd_ahash *tfm); |
| 42 | struct shash_desc *cryptd_shash_desc(struct ahash_request *req); | ||
| 42 | void cryptd_free_ahash(struct cryptd_ahash *tfm); | 43 | void cryptd_free_ahash(struct cryptd_ahash *tfm); |
| 43 | 44 | ||
| 44 | #endif | 45 | #endif |
diff --git a/include/crypto/md5.h b/include/crypto/md5.h new file mode 100644 index 000000000000..65f299b08b0d --- /dev/null +++ b/include/crypto/md5.h | |||
| @@ -0,0 +1,17 @@ | |||
| 1 | #ifndef _CRYPTO_MD5_H | ||
| 2 | #define _CRYPTO_MD5_H | ||
| 3 | |||
| 4 | #include <linux/types.h> | ||
| 5 | |||
| 6 | #define MD5_DIGEST_SIZE 16 | ||
| 7 | #define MD5_HMAC_BLOCK_SIZE 64 | ||
| 8 | #define MD5_BLOCK_WORDS 16 | ||
| 9 | #define MD5_HASH_WORDS 4 | ||
| 10 | |||
| 11 | struct md5_state { | ||
| 12 | u32 hash[MD5_HASH_WORDS]; | ||
| 13 | u32 block[MD5_BLOCK_WORDS]; | ||
| 14 | u64 byte_count; | ||
| 15 | }; | ||
| 16 | |||
| 17 | #endif | ||
diff --git a/include/crypto/pcrypt.h b/include/crypto/pcrypt.h new file mode 100644 index 000000000000..d7d8bd8c6edc --- /dev/null +++ b/include/crypto/pcrypt.h | |||
| @@ -0,0 +1,51 @@ | |||
| 1 | /* | ||
| 2 | * pcrypt - Parallel crypto engine. | ||
| 3 | * | ||
| 4 | * Copyright (C) 2009 secunet Security Networks AG | ||
| 5 | * Copyright (C) 2009 Steffen Klassert <steffen.klassert@secunet.com> | ||
| 6 | * | ||
| 7 | * This program is free software; you can redistribute it and/or modify it | ||
| 8 | * under the terms and conditions of the GNU General Public License, | ||
| 9 | * version 2, as published by the Free Software Foundation. | ||
| 10 | * | ||
| 11 | * This program is distributed in the hope it will be useful, but WITHOUT | ||
| 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
| 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
| 14 | * more details. | ||
| 15 | * | ||
| 16 | * You should have received a copy of the GNU General Public License along with | ||
| 17 | * this program; if not, write to the Free Software Foundation, Inc., | ||
| 18 | * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. | ||
| 19 | */ | ||
| 20 | |||
| 21 | #ifndef _CRYPTO_PCRYPT_H | ||
| 22 | #define _CRYPTO_PCRYPT_H | ||
| 23 | |||
| 24 | #include <linux/crypto.h> | ||
| 25 | #include <linux/kernel.h> | ||
| 26 | #include <linux/padata.h> | ||
| 27 | |||
| 28 | struct pcrypt_request { | ||
| 29 | struct padata_priv padata; | ||
| 30 | void *data; | ||
| 31 | void *__ctx[] CRYPTO_MINALIGN_ATTR; | ||
| 32 | }; | ||
| 33 | |||
| 34 | static inline void *pcrypt_request_ctx(struct pcrypt_request *req) | ||
| 35 | { | ||
| 36 | return req->__ctx; | ||
| 37 | } | ||
| 38 | |||
| 39 | static inline | ||
| 40 | struct padata_priv *pcrypt_request_padata(struct pcrypt_request *req) | ||
| 41 | { | ||
| 42 | return &req->padata; | ||
| 43 | } | ||
| 44 | |||
| 45 | static inline | ||
| 46 | struct pcrypt_request *pcrypt_padata_request(struct padata_priv *padata) | ||
| 47 | { | ||
| 48 | return container_of(padata, struct pcrypt_request, padata); | ||
| 49 | } | ||
| 50 | |||
| 51 | #endif | ||
diff --git a/include/drm/Kbuild b/include/drm/Kbuild index b940fdfa3b25..bd3a1c2fbdb4 100644 --- a/include/drm/Kbuild +++ b/include/drm/Kbuild | |||
| @@ -7,4 +7,6 @@ unifdef-y += r128_drm.h | |||
| 7 | unifdef-y += radeon_drm.h | 7 | unifdef-y += radeon_drm.h |
| 8 | unifdef-y += sis_drm.h | 8 | unifdef-y += sis_drm.h |
| 9 | unifdef-y += savage_drm.h | 9 | unifdef-y += savage_drm.h |
| 10 | unifdef-y += vmwgfx_drm.h | ||
| 10 | unifdef-y += via_drm.h | 11 | unifdef-y += via_drm.h |
| 12 | unifdef-y += nouveau_drm.h | ||
diff --git a/include/drm/drm.h b/include/drm/drm.h index 7cb50bdde46d..e3f46e0cb7dc 100644 --- a/include/drm/drm.h +++ b/include/drm/drm.h | |||
| @@ -36,17 +36,27 @@ | |||
| 36 | #ifndef _DRM_H_ | 36 | #ifndef _DRM_H_ |
| 37 | #define _DRM_H_ | 37 | #define _DRM_H_ |
| 38 | 38 | ||
| 39 | #if defined(__linux__) | ||
| 40 | |||
| 39 | #include <linux/types.h> | 41 | #include <linux/types.h> |
| 40 | #include <asm/ioctl.h> /* For _IO* macros */ | 42 | #include <asm/ioctl.h> |
| 41 | #define DRM_IOCTL_NR(n) _IOC_NR(n) | 43 | typedef unsigned int drm_handle_t; |
| 42 | #define DRM_IOC_VOID _IOC_NONE | ||
| 43 | #define DRM_IOC_READ _IOC_READ | ||
| 44 | #define DRM_IOC_WRITE _IOC_WRITE | ||
| 45 | #define DRM_IOC_READWRITE _IOC_READ|_IOC_WRITE | ||
| 46 | #define DRM_IOC(dir, group, nr, size) _IOC(dir, group, nr, size) | ||
| 47 | 44 | ||
| 48 | #define DRM_MAJOR 226 | 45 | #else /* One of the BSDs */ |
| 49 | #define DRM_MAX_MINOR 15 | 46 | |
| 47 | #include <sys/ioccom.h> | ||
| 48 | #include <sys/types.h> | ||
| 49 | typedef int8_t __s8; | ||
| 50 | typedef uint8_t __u8; | ||
| 51 | typedef int16_t __s16; | ||
| 52 | typedef uint16_t __u16; | ||
| 53 | typedef int32_t __s32; | ||
| 54 | typedef uint32_t __u32; | ||
| 55 | typedef int64_t __s64; | ||
| 56 | typedef uint64_t __u64; | ||
| 57 | typedef unsigned long drm_handle_t; | ||
| 58 | |||
| 59 | #endif | ||
| 50 | 60 | ||
| 51 | #define DRM_NAME "drm" /**< Name in kernel, /dev, and /proc */ | 61 | #define DRM_NAME "drm" /**< Name in kernel, /dev, and /proc */ |
| 52 | #define DRM_MIN_ORDER 5 /**< At least 2^5 bytes = 32 bytes */ | 62 | #define DRM_MIN_ORDER 5 /**< At least 2^5 bytes = 32 bytes */ |
| @@ -59,7 +69,6 @@ | |||
| 59 | #define _DRM_LOCK_IS_CONT(lock) ((lock) & _DRM_LOCK_CONT) | 69 | #define _DRM_LOCK_IS_CONT(lock) ((lock) & _DRM_LOCK_CONT) |
| 60 | #define _DRM_LOCKING_CONTEXT(lock) ((lock) & ~(_DRM_LOCK_HELD|_DRM_LOCK_CONT)) | 70 | #define _DRM_LOCKING_CONTEXT(lock) ((lock) & ~(_DRM_LOCK_HELD|_DRM_LOCK_CONT)) |
| 61 | 71 | ||
| 62 | typedef unsigned int drm_handle_t; | ||
| 63 | typedef unsigned int drm_context_t; | 72 | typedef unsigned int drm_context_t; |
| 64 | typedef unsigned int drm_drawable_t; | 73 | typedef unsigned int drm_drawable_t; |
| 65 | typedef unsigned int drm_magic_t; | 74 | typedef unsigned int drm_magic_t; |
| @@ -454,6 +463,7 @@ struct drm_irq_busid { | |||
| 454 | enum drm_vblank_seq_type { | 463 | enum drm_vblank_seq_type { |
| 455 | _DRM_VBLANK_ABSOLUTE = 0x0, /**< Wait for specific vblank sequence number */ | 464 | _DRM_VBLANK_ABSOLUTE = 0x0, /**< Wait for specific vblank sequence number */ |
| 456 | _DRM_VBLANK_RELATIVE = 0x1, /**< Wait for given number of vblanks */ | 465 | _DRM_VBLANK_RELATIVE = 0x1, /**< Wait for given number of vblanks */ |
| 466 | _DRM_VBLANK_EVENT = 0x4000000, /**< Send event instead of blocking */ | ||
| 457 | _DRM_VBLANK_FLIP = 0x8000000, /**< Scheduled buffer swap should flip */ | 467 | _DRM_VBLANK_FLIP = 0x8000000, /**< Scheduled buffer swap should flip */ |
| 458 | _DRM_VBLANK_NEXTONMISS = 0x10000000, /**< If missed, wait for next vblank */ | 468 | _DRM_VBLANK_NEXTONMISS = 0x10000000, /**< If missed, wait for next vblank */ |
| 459 | _DRM_VBLANK_SECONDARY = 0x20000000, /**< Secondary display controller */ | 469 | _DRM_VBLANK_SECONDARY = 0x20000000, /**< Secondary display controller */ |
| @@ -461,8 +471,8 @@ enum drm_vblank_seq_type { | |||
| 461 | }; | 471 | }; |
| 462 | 472 | ||
| 463 | #define _DRM_VBLANK_TYPES_MASK (_DRM_VBLANK_ABSOLUTE | _DRM_VBLANK_RELATIVE) | 473 | #define _DRM_VBLANK_TYPES_MASK (_DRM_VBLANK_ABSOLUTE | _DRM_VBLANK_RELATIVE) |
| 464 | #define _DRM_VBLANK_FLAGS_MASK (_DRM_VBLANK_SIGNAL | _DRM_VBLANK_SECONDARY | \ | 474 | #define _DRM_VBLANK_FLAGS_MASK (_DRM_VBLANK_EVENT | _DRM_VBLANK_SIGNAL | \ |
| 465 | _DRM_VBLANK_NEXTONMISS) | 475 | _DRM_VBLANK_SECONDARY | _DRM_VBLANK_NEXTONMISS) |
| 466 | 476 | ||
| 467 | struct drm_wait_vblank_request { | 477 | struct drm_wait_vblank_request { |
| 468 | enum drm_vblank_seq_type type; | 478 | enum drm_vblank_seq_type type; |
| @@ -686,6 +696,8 @@ struct drm_gem_open { | |||
| 686 | #define DRM_IOCTL_MODE_GETFB DRM_IOWR(0xAD, struct drm_mode_fb_cmd) | 696 | #define DRM_IOCTL_MODE_GETFB DRM_IOWR(0xAD, struct drm_mode_fb_cmd) |
| 687 | #define DRM_IOCTL_MODE_ADDFB DRM_IOWR(0xAE, struct drm_mode_fb_cmd) | 697 | #define DRM_IOCTL_MODE_ADDFB DRM_IOWR(0xAE, struct drm_mode_fb_cmd) |
| 688 | #define DRM_IOCTL_MODE_RMFB DRM_IOWR(0xAF, unsigned int) | 698 | #define DRM_IOCTL_MODE_RMFB DRM_IOWR(0xAF, unsigned int) |
| 699 | #define DRM_IOCTL_MODE_PAGE_FLIP DRM_IOWR(0xB0, struct drm_mode_crtc_page_flip) | ||
| 700 | #define DRM_IOCTL_MODE_DIRTYFB DRM_IOWR(0xB1, struct drm_mode_fb_dirty_cmd) | ||
| 689 | 701 | ||
| 690 | /** | 702 | /** |
| 691 | * Device specific ioctls should only be in their respective headers | 703 | * Device specific ioctls should only be in their respective headers |
| @@ -698,6 +710,35 @@ struct drm_gem_open { | |||
| 698 | #define DRM_COMMAND_BASE 0x40 | 710 | #define DRM_COMMAND_BASE 0x40 |
| 699 | #define DRM_COMMAND_END 0xA0 | 711 | #define DRM_COMMAND_END 0xA0 |
| 700 | 712 | ||
| 713 | /** | ||
| 714 | * Header for events written back to userspace on the drm fd. The | ||
| 715 | * type defines the type of event, the length specifies the total | ||
| 716 | * length of the event (including the header), and user_data is | ||
| 717 | * typically a 64 bit value passed with the ioctl that triggered the | ||
| 718 | * event. A read on the drm fd will always only return complete | ||
| 719 | * events, that is, if for example the read buffer is 100 bytes, and | ||
| 720 | * there are two 64 byte events pending, only one will be returned. | ||
| 721 | * | ||
| 722 | * Event types 0 - 0x7fffffff are generic drm events, 0x80000000 and | ||
| 723 | * up are chipset specific. | ||
| 724 | */ | ||
| 725 | struct drm_event { | ||
| 726 | __u32 type; | ||
| 727 | __u32 length; | ||
| 728 | }; | ||
| 729 | |||
| 730 | #define DRM_EVENT_VBLANK 0x01 | ||
| 731 | #define DRM_EVENT_FLIP_COMPLETE 0x02 | ||
| 732 | |||
| 733 | struct drm_event_vblank { | ||
| 734 | struct drm_event base; | ||
| 735 | __u64 user_data; | ||
| 736 | __u32 tv_sec; | ||
| 737 | __u32 tv_usec; | ||
| 738 | __u32 sequence; | ||
| 739 | __u32 reserved; | ||
| 740 | }; | ||
| 741 | |||
| 701 | /* typedef area */ | 742 | /* typedef area */ |
| 702 | #ifndef __KERNEL__ | 743 | #ifndef __KERNEL__ |
| 703 | typedef struct drm_clip_rect drm_clip_rect_t; | 744 | typedef struct drm_clip_rect drm_clip_rect_t; |
diff --git a/include/drm/drmP.h b/include/drm/drmP.h index c8e64bbadbcf..2f3b3a00b7a3 100644 --- a/include/drm/drmP.h +++ b/include/drm/drmP.h | |||
| @@ -55,6 +55,7 @@ | |||
| 55 | #include <linux/mm.h> | 55 | #include <linux/mm.h> |
| 56 | #include <linux/cdev.h> | 56 | #include <linux/cdev.h> |
| 57 | #include <linux/mutex.h> | 57 | #include <linux/mutex.h> |
| 58 | #include <linux/slab.h> | ||
| 58 | #if defined(__alpha__) || defined(__powerpc__) | 59 | #if defined(__alpha__) || defined(__powerpc__) |
| 59 | #include <asm/pgtable.h> /* For pte_wrprotect */ | 60 | #include <asm/pgtable.h> /* For pte_wrprotect */ |
| 60 | #endif | 61 | #endif |
| @@ -245,16 +246,6 @@ extern void drm_ut_debug_printk(unsigned int request_level, | |||
| 245 | 246 | ||
| 246 | #endif | 247 | #endif |
| 247 | 248 | ||
| 248 | #define DRM_PROC_LIMIT (PAGE_SIZE-80) | ||
| 249 | |||
| 250 | #define DRM_PROC_PRINT(fmt, arg...) \ | ||
| 251 | len += sprintf(&buf[len], fmt , ##arg); \ | ||
| 252 | if (len > DRM_PROC_LIMIT) { *eof = 1; return len - offset; } | ||
| 253 | |||
| 254 | #define DRM_PROC_PRINT_RET(ret, fmt, arg...) \ | ||
| 255 | len += sprintf(&buf[len], fmt , ##arg); \ | ||
| 256 | if (len > DRM_PROC_LIMIT) { ret; *eof = 1; return len - offset; } | ||
| 257 | |||
| 258 | /*@}*/ | 249 | /*@}*/ |
| 259 | 250 | ||
| 260 | /***********************************************************************/ | 251 | /***********************************************************************/ |
| @@ -265,19 +256,8 @@ extern void drm_ut_debug_printk(unsigned int request_level, | |||
| 265 | 256 | ||
| 266 | #define DRM_LEFTCOUNT(x) (((x)->rp + (x)->count - (x)->wp) % ((x)->count + 1)) | 257 | #define DRM_LEFTCOUNT(x) (((x)->rp + (x)->count - (x)->wp) % ((x)->count + 1)) |
| 267 | #define DRM_BUFCOUNT(x) ((x)->count - DRM_LEFTCOUNT(x)) | 258 | #define DRM_BUFCOUNT(x) ((x)->count - DRM_LEFTCOUNT(x)) |
| 268 | #define DRM_WAITCOUNT(dev,idx) DRM_BUFCOUNT(&dev->queuelist[idx]->waitlist) | ||
| 269 | 259 | ||
| 270 | #define DRM_IF_VERSION(maj, min) (maj << 16 | min) | 260 | #define DRM_IF_VERSION(maj, min) (maj << 16 | min) |
| 271 | /** | ||
| 272 | * Get the private SAREA mapping. | ||
| 273 | * | ||
| 274 | * \param _dev DRM device. | ||
| 275 | * \param _ctx context number. | ||
| 276 | * \param _map output mapping. | ||
| 277 | */ | ||
| 278 | #define DRM_GET_PRIV_SAREA(_dev, _ctx, _map) do { \ | ||
| 279 | (_map) = (_dev)->context_sareas[_ctx]; \ | ||
| 280 | } while(0) | ||
| 281 | 261 | ||
| 282 | /** | 262 | /** |
| 283 | * Test that the hardware lock is held by the caller, returning otherwise. | 263 | * Test that the hardware lock is held by the caller, returning otherwise. |
| @@ -297,18 +277,6 @@ do { \ | |||
| 297 | } while (0) | 277 | } while (0) |
| 298 | 278 | ||
| 299 | /** | 279 | /** |
| 300 | * Copy and IOCTL return string to user space | ||
| 301 | */ | ||
| 302 | #define DRM_COPY( name, value ) \ | ||
| 303 | len = strlen( value ); \ | ||
| 304 | if ( len > name##_len ) len = name##_len; \ | ||
| 305 | name##_len = strlen( value ); \ | ||
| 306 | if ( len && name ) { \ | ||
| 307 | if ( copy_to_user( name, value, len ) ) \ | ||
| 308 | return -EFAULT; \ | ||
| 309 | } | ||
| 310 | |||
| 311 | /** | ||
| 312 | * Ioctl function type. | 280 | * Ioctl function type. |
| 313 | * | 281 | * |
| 314 | * \param inode device inode. | 282 | * \param inode device inode. |
| @@ -322,10 +290,14 @@ typedef int drm_ioctl_t(struct drm_device *dev, void *data, | |||
| 322 | typedef int drm_ioctl_compat_t(struct file *filp, unsigned int cmd, | 290 | typedef int drm_ioctl_compat_t(struct file *filp, unsigned int cmd, |
| 323 | unsigned long arg); | 291 | unsigned long arg); |
| 324 | 292 | ||
| 293 | #define DRM_IOCTL_NR(n) _IOC_NR(n) | ||
| 294 | #define DRM_MAJOR 226 | ||
| 295 | |||
| 325 | #define DRM_AUTH 0x1 | 296 | #define DRM_AUTH 0x1 |
| 326 | #define DRM_MASTER 0x2 | 297 | #define DRM_MASTER 0x2 |
| 327 | #define DRM_ROOT_ONLY 0x4 | 298 | #define DRM_ROOT_ONLY 0x4 |
| 328 | #define DRM_CONTROL_ALLOW 0x8 | 299 | #define DRM_CONTROL_ALLOW 0x8 |
| 300 | #define DRM_UNLOCKED 0x10 | ||
| 329 | 301 | ||
| 330 | struct drm_ioctl_desc { | 302 | struct drm_ioctl_desc { |
| 331 | unsigned int cmd; | 303 | unsigned int cmd; |
| @@ -426,6 +398,14 @@ struct drm_buf_entry { | |||
| 426 | struct drm_freelist freelist; | 398 | struct drm_freelist freelist; |
| 427 | }; | 399 | }; |
| 428 | 400 | ||
| 401 | /* Event queued up for userspace to read */ | ||
| 402 | struct drm_pending_event { | ||
| 403 | struct drm_event *event; | ||
| 404 | struct list_head link; | ||
| 405 | struct drm_file *file_priv; | ||
| 406 | void (*destroy)(struct drm_pending_event *event); | ||
| 407 | }; | ||
| 408 | |||
| 429 | /** File private data */ | 409 | /** File private data */ |
| 430 | struct drm_file { | 410 | struct drm_file { |
| 431 | int authenticated; | 411 | int authenticated; |
| @@ -449,6 +429,10 @@ struct drm_file { | |||
| 449 | struct drm_master *master; /* master this node is currently associated with | 429 | struct drm_master *master; /* master this node is currently associated with |
| 450 | N.B. not always minor->master */ | 430 | N.B. not always minor->master */ |
| 451 | struct list_head fbs; | 431 | struct list_head fbs; |
| 432 | |||
| 433 | wait_queue_head_t event_wait; | ||
| 434 | struct list_head event_list; | ||
| 435 | int event_space; | ||
| 452 | }; | 436 | }; |
| 453 | 437 | ||
| 454 | /** Wait queue */ | 438 | /** Wait queue */ |
| @@ -795,6 +779,15 @@ struct drm_driver { | |||
| 795 | /* Master routines */ | 779 | /* Master routines */ |
| 796 | int (*master_create)(struct drm_device *dev, struct drm_master *master); | 780 | int (*master_create)(struct drm_device *dev, struct drm_master *master); |
| 797 | void (*master_destroy)(struct drm_device *dev, struct drm_master *master); | 781 | void (*master_destroy)(struct drm_device *dev, struct drm_master *master); |
| 782 | /** | ||
| 783 | * master_set is called whenever the minor master is set. | ||
| 784 | * master_drop is called whenever the minor master is dropped. | ||
| 785 | */ | ||
| 786 | |||
| 787 | int (*master_set)(struct drm_device *dev, struct drm_file *file_priv, | ||
| 788 | bool from_open); | ||
| 789 | void (*master_drop)(struct drm_device *dev, struct drm_file *file_priv, | ||
| 790 | bool from_release); | ||
| 798 | 791 | ||
| 799 | int (*proc_init)(struct drm_minor *minor); | 792 | int (*proc_init)(struct drm_minor *minor); |
| 800 | void (*proc_cleanup)(struct drm_minor *minor); | 793 | void (*proc_cleanup)(struct drm_minor *minor); |
| @@ -809,6 +802,7 @@ struct drm_driver { | |||
| 809 | */ | 802 | */ |
| 810 | int (*gem_init_object) (struct drm_gem_object *obj); | 803 | int (*gem_init_object) (struct drm_gem_object *obj); |
| 811 | void (*gem_free_object) (struct drm_gem_object *obj); | 804 | void (*gem_free_object) (struct drm_gem_object *obj); |
| 805 | void (*gem_free_object_unlocked) (struct drm_gem_object *obj); | ||
| 812 | 806 | ||
| 813 | /* vga arb irq handler */ | 807 | /* vga arb irq handler */ |
| 814 | void (*vgaarb_irq)(struct drm_device *dev, bool state); | 808 | void (*vgaarb_irq)(struct drm_device *dev, bool state); |
| @@ -900,6 +894,12 @@ struct drm_minor { | |||
| 900 | struct drm_mode_group mode_group; | 894 | struct drm_mode_group mode_group; |
| 901 | }; | 895 | }; |
| 902 | 896 | ||
| 897 | struct drm_pending_vblank_event { | ||
| 898 | struct drm_pending_event base; | ||
| 899 | int pipe; | ||
| 900 | struct drm_event_vblank event; | ||
| 901 | }; | ||
| 902 | |||
| 903 | /** | 903 | /** |
| 904 | * DRM device structure. This structure represent a complete card that | 904 | * DRM device structure. This structure represent a complete card that |
| 905 | * may contain multiple heads. | 905 | * may contain multiple heads. |
| @@ -999,6 +999,12 @@ struct drm_device { | |||
| 999 | 999 | ||
| 1000 | u32 max_vblank_count; /**< size of vblank counter register */ | 1000 | u32 max_vblank_count; /**< size of vblank counter register */ |
| 1001 | 1001 | ||
| 1002 | /** | ||
| 1003 | * List of events | ||
| 1004 | */ | ||
| 1005 | struct list_head vblank_event_list; | ||
| 1006 | spinlock_t event_lock; | ||
| 1007 | |||
| 1002 | /*@} */ | 1008 | /*@} */ |
| 1003 | cycles_t ctx_start; | 1009 | cycles_t ctx_start; |
| 1004 | cycles_t lck_start; | 1010 | cycles_t lck_start; |
| @@ -1125,8 +1131,8 @@ static inline int drm_mtrr_del(int handle, unsigned long offset, | |||
| 1125 | /* Driver support (drm_drv.h) */ | 1131 | /* Driver support (drm_drv.h) */ |
| 1126 | extern int drm_init(struct drm_driver *driver); | 1132 | extern int drm_init(struct drm_driver *driver); |
| 1127 | extern void drm_exit(struct drm_driver *driver); | 1133 | extern void drm_exit(struct drm_driver *driver); |
| 1128 | extern int drm_ioctl(struct inode *inode, struct file *filp, | 1134 | extern long drm_ioctl(struct file *filp, |
| 1129 | unsigned int cmd, unsigned long arg); | 1135 | unsigned int cmd, unsigned long arg); |
| 1130 | extern long drm_compat_ioctl(struct file *filp, | 1136 | extern long drm_compat_ioctl(struct file *filp, |
| 1131 | unsigned int cmd, unsigned long arg); | 1137 | unsigned int cmd, unsigned long arg); |
| 1132 | extern int drm_lastclose(struct drm_device *dev); | 1138 | extern int drm_lastclose(struct drm_device *dev); |
| @@ -1135,6 +1141,8 @@ extern int drm_lastclose(struct drm_device *dev); | |||
| 1135 | extern int drm_open(struct inode *inode, struct file *filp); | 1141 | extern int drm_open(struct inode *inode, struct file *filp); |
| 1136 | extern int drm_stub_open(struct inode *inode, struct file *filp); | 1142 | extern int drm_stub_open(struct inode *inode, struct file *filp); |
| 1137 | extern int drm_fasync(int fd, struct file *filp, int on); | 1143 | extern int drm_fasync(int fd, struct file *filp, int on); |
| 1144 | extern ssize_t drm_read(struct file *filp, char __user *buffer, | ||
| 1145 | size_t count, loff_t *offset); | ||
| 1138 | extern int drm_release(struct inode *inode, struct file *filp); | 1146 | extern int drm_release(struct inode *inode, struct file *filp); |
| 1139 | 1147 | ||
| 1140 | /* Mapping support (drm_vm.h) */ | 1148 | /* Mapping support (drm_vm.h) */ |
| @@ -1295,6 +1303,7 @@ extern u32 drm_vblank_count(struct drm_device *dev, int crtc); | |||
| 1295 | extern void drm_handle_vblank(struct drm_device *dev, int crtc); | 1303 | extern void drm_handle_vblank(struct drm_device *dev, int crtc); |
| 1296 | extern int drm_vblank_get(struct drm_device *dev, int crtc); | 1304 | extern int drm_vblank_get(struct drm_device *dev, int crtc); |
| 1297 | extern void drm_vblank_put(struct drm_device *dev, int crtc); | 1305 | extern void drm_vblank_put(struct drm_device *dev, int crtc); |
| 1306 | extern void drm_vblank_off(struct drm_device *dev, int crtc); | ||
| 1298 | extern void drm_vblank_cleanup(struct drm_device *dev); | 1307 | extern void drm_vblank_cleanup(struct drm_device *dev); |
| 1299 | /* Modesetting support */ | 1308 | /* Modesetting support */ |
| 1300 | extern void drm_vblank_pre_modeset(struct drm_device *dev, int crtc); | 1309 | extern void drm_vblank_pre_modeset(struct drm_device *dev, int crtc); |
| @@ -1401,7 +1410,7 @@ extern int drm_ati_pcigart_cleanup(struct drm_device *dev, | |||
| 1401 | struct drm_ati_pcigart_info * gart_info); | 1410 | struct drm_ati_pcigart_info * gart_info); |
| 1402 | 1411 | ||
| 1403 | extern drm_dma_handle_t *drm_pci_alloc(struct drm_device *dev, size_t size, | 1412 | extern drm_dma_handle_t *drm_pci_alloc(struct drm_device *dev, size_t size, |
| 1404 | size_t align, dma_addr_t maxaddr); | 1413 | size_t align); |
| 1405 | extern void __drm_pci_free(struct drm_device *dev, drm_dma_handle_t * dmah); | 1414 | extern void __drm_pci_free(struct drm_device *dev, drm_dma_handle_t * dmah); |
| 1406 | extern void drm_pci_free(struct drm_device *dev, drm_dma_handle_t * dmah); | 1415 | extern void drm_pci_free(struct drm_device *dev, drm_dma_handle_t * dmah); |
| 1407 | 1416 | ||
| @@ -1420,6 +1429,7 @@ extern void drm_sysfs_connector_remove(struct drm_connector *connector); | |||
| 1420 | int drm_gem_init(struct drm_device *dev); | 1429 | int drm_gem_init(struct drm_device *dev); |
| 1421 | void drm_gem_destroy(struct drm_device *dev); | 1430 | void drm_gem_destroy(struct drm_device *dev); |
| 1422 | void drm_gem_object_free(struct kref *kref); | 1431 | void drm_gem_object_free(struct kref *kref); |
| 1432 | void drm_gem_object_free_unlocked(struct kref *kref); | ||
| 1423 | struct drm_gem_object *drm_gem_object_alloc(struct drm_device *dev, | 1433 | struct drm_gem_object *drm_gem_object_alloc(struct drm_device *dev, |
| 1424 | size_t size); | 1434 | size_t size); |
| 1425 | void drm_gem_object_handle_free(struct kref *kref); | 1435 | void drm_gem_object_handle_free(struct kref *kref); |
| @@ -1436,10 +1446,15 @@ drm_gem_object_reference(struct drm_gem_object *obj) | |||
| 1436 | static inline void | 1446 | static inline void |
| 1437 | drm_gem_object_unreference(struct drm_gem_object *obj) | 1447 | drm_gem_object_unreference(struct drm_gem_object *obj) |
| 1438 | { | 1448 | { |
| 1439 | if (obj == NULL) | 1449 | if (obj != NULL) |
| 1440 | return; | 1450 | kref_put(&obj->refcount, drm_gem_object_free); |
| 1451 | } | ||
| 1441 | 1452 | ||
| 1442 | kref_put(&obj->refcount, drm_gem_object_free); | 1453 | static inline void |
| 1454 | drm_gem_object_unreference_unlocked(struct drm_gem_object *obj) | ||
| 1455 | { | ||
| 1456 | if (obj != NULL) | ||
| 1457 | kref_put(&obj->refcount, drm_gem_object_free_unlocked); | ||
| 1443 | } | 1458 | } |
| 1444 | 1459 | ||
| 1445 | int drm_gem_handle_create(struct drm_file *file_priv, | 1460 | int drm_gem_handle_create(struct drm_file *file_priv, |
| @@ -1468,6 +1483,21 @@ drm_gem_object_handle_unreference(struct drm_gem_object *obj) | |||
| 1468 | drm_gem_object_unreference(obj); | 1483 | drm_gem_object_unreference(obj); |
| 1469 | } | 1484 | } |
| 1470 | 1485 | ||
| 1486 | static inline void | ||
| 1487 | drm_gem_object_handle_unreference_unlocked(struct drm_gem_object *obj) | ||
| 1488 | { | ||
| 1489 | if (obj == NULL) | ||
| 1490 | return; | ||
| 1491 | |||
| 1492 | /* | ||
| 1493 | * Must bump handle count first as this may be the last | ||
| 1494 | * ref, in which case the object would disappear before we | ||
| 1495 | * checked for a name | ||
| 1496 | */ | ||
| 1497 | kref_put(&obj->handlecount, drm_gem_object_handle_free); | ||
| 1498 | drm_gem_object_unreference_unlocked(obj); | ||
| 1499 | } | ||
| 1500 | |||
| 1471 | struct drm_gem_object *drm_gem_object_lookup(struct drm_device *dev, | 1501 | struct drm_gem_object *drm_gem_object_lookup(struct drm_device *dev, |
| 1472 | struct drm_file *filp, | 1502 | struct drm_file *filp, |
| 1473 | u32 handle); | 1503 | u32 handle); |
| @@ -1516,26 +1546,7 @@ static __inline__ void drm_core_dropmap(struct drm_local_map *map) | |||
| 1516 | { | 1546 | { |
| 1517 | } | 1547 | } |
| 1518 | 1548 | ||
| 1519 | 1549 | #include "drm_mem_util.h" | |
| 1520 | static __inline__ void *drm_calloc_large(size_t nmemb, size_t size) | ||
| 1521 | { | ||
| 1522 | if (size * nmemb <= PAGE_SIZE) | ||
| 1523 | return kcalloc(nmemb, size, GFP_KERNEL); | ||
| 1524 | |||
| 1525 | if (size != 0 && nmemb > ULONG_MAX / size) | ||
| 1526 | return NULL; | ||
| 1527 | |||
| 1528 | return __vmalloc(size * nmemb, | ||
| 1529 | GFP_KERNEL | __GFP_HIGHMEM | __GFP_ZERO, PAGE_KERNEL); | ||
| 1530 | } | ||
| 1531 | |||
| 1532 | static __inline void drm_free_large(void *ptr) | ||
| 1533 | { | ||
| 1534 | if (!is_vmalloc_addr(ptr)) | ||
| 1535 | return kfree(ptr); | ||
| 1536 | |||
| 1537 | vfree(ptr); | ||
| 1538 | } | ||
| 1539 | /*@}*/ | 1550 | /*@}*/ |
| 1540 | 1551 | ||
| 1541 | #endif /* __KERNEL__ */ | 1552 | #endif /* __KERNEL__ */ |
diff --git a/include/drm/drm_buffer.h b/include/drm/drm_buffer.h new file mode 100644 index 000000000000..322dbff3f861 --- /dev/null +++ b/include/drm/drm_buffer.h | |||
| @@ -0,0 +1,148 @@ | |||
| 1 | /************************************************************************** | ||
| 2 | * | ||
| 3 | * Copyright 2010 Pauli Nieminen. | ||
| 4 | * All Rights Reserved. | ||
| 5 | * | ||
| 6 | * Permission is hereby granted, free of charge, to any person obtaining a | ||
| 7 | * copy of this software and associated documentation files (the | ||
| 8 | * "Software"), to deal in the Software without restriction, including | ||
| 9 | * without limitation the rights to use, copy, modify, merge, publish, | ||
| 10 | * distribute, sub license, and/or sell copies of the Software, and to | ||
| 11 | * permit persons to whom the Software is furnished to do so, subject to | ||
| 12 | * the following conditions: | ||
| 13 | * | ||
| 14 | * The above copyright notice and this permission notice (including the | ||
| 15 | * next paragraph) shall be included in all copies or substantial portions | ||
| 16 | * of the Software. | ||
| 17 | * | ||
| 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| 19 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
| 20 | * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL | ||
| 21 | * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, | ||
| 22 | * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR | ||
| 23 | * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE | ||
| 24 | * USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
| 25 | * | ||
| 26 | * | ||
| 27 | **************************************************************************/ | ||
| 28 | /* | ||
| 29 | * Multipart buffer for coping data which is larger than the page size. | ||
| 30 | * | ||
| 31 | * Authors: | ||
| 32 | * Pauli Nieminen <suokkos-at-gmail-dot-com> | ||
| 33 | */ | ||
| 34 | |||
| 35 | #ifndef _DRM_BUFFER_H_ | ||
| 36 | #define _DRM_BUFFER_H_ | ||
| 37 | |||
| 38 | #include "drmP.h" | ||
| 39 | |||
| 40 | struct drm_buffer { | ||
| 41 | int iterator; | ||
| 42 | int size; | ||
| 43 | char *data[]; | ||
| 44 | }; | ||
| 45 | |||
| 46 | |||
| 47 | /** | ||
| 48 | * Return the index of page that buffer is currently pointing at. | ||
| 49 | */ | ||
| 50 | static inline int drm_buffer_page(struct drm_buffer *buf) | ||
| 51 | { | ||
| 52 | return buf->iterator / PAGE_SIZE; | ||
| 53 | } | ||
| 54 | /** | ||
| 55 | * Return the index of the current byte in the page | ||
| 56 | */ | ||
| 57 | static inline int drm_buffer_index(struct drm_buffer *buf) | ||
| 58 | { | ||
| 59 | return buf->iterator & (PAGE_SIZE - 1); | ||
| 60 | } | ||
| 61 | /** | ||
| 62 | * Return number of bytes that is left to process | ||
| 63 | */ | ||
| 64 | static inline int drm_buffer_unprocessed(struct drm_buffer *buf) | ||
| 65 | { | ||
| 66 | return buf->size - buf->iterator; | ||
| 67 | } | ||
| 68 | |||
| 69 | /** | ||
| 70 | * Advance the buffer iterator number of bytes that is given. | ||
| 71 | */ | ||
| 72 | static inline void drm_buffer_advance(struct drm_buffer *buf, int bytes) | ||
| 73 | { | ||
| 74 | buf->iterator += bytes; | ||
| 75 | } | ||
| 76 | |||
| 77 | /** | ||
| 78 | * Allocate the drm buffer object. | ||
| 79 | * | ||
| 80 | * buf: A pointer to a pointer where the object is stored. | ||
| 81 | * size: The number of bytes to allocate. | ||
| 82 | */ | ||
| 83 | extern int drm_buffer_alloc(struct drm_buffer **buf, int size); | ||
| 84 | |||
| 85 | /** | ||
| 86 | * Copy the user data to the begin of the buffer and reset the processing | ||
| 87 | * iterator. | ||
| 88 | * | ||
| 89 | * user_data: A pointer the data that is copied to the buffer. | ||
| 90 | * size: The Number of bytes to copy. | ||
| 91 | */ | ||
| 92 | extern int drm_buffer_copy_from_user(struct drm_buffer *buf, | ||
| 93 | void __user *user_data, int size); | ||
| 94 | |||
| 95 | /** | ||
| 96 | * Free the drm buffer object | ||
| 97 | */ | ||
| 98 | extern void drm_buffer_free(struct drm_buffer *buf); | ||
| 99 | |||
| 100 | /** | ||
| 101 | * Read an object from buffer that may be split to multiple parts. If object | ||
| 102 | * is not split function just returns the pointer to object in buffer. But in | ||
| 103 | * case of split object data is copied to given stack object that is suplied | ||
| 104 | * by caller. | ||
| 105 | * | ||
| 106 | * The processing location of the buffer is also advanced to the next byte | ||
| 107 | * after the object. | ||
| 108 | * | ||
| 109 | * objsize: The size of the objet in bytes. | ||
| 110 | * stack_obj: A pointer to a memory location where object can be copied. | ||
| 111 | */ | ||
| 112 | extern void *drm_buffer_read_object(struct drm_buffer *buf, | ||
| 113 | int objsize, void *stack_obj); | ||
| 114 | |||
| 115 | /** | ||
| 116 | * Returns the pointer to the dword which is offset number of elements from the | ||
| 117 | * current processing location. | ||
| 118 | * | ||
| 119 | * Caller must make sure that dword is not split in the buffer. This | ||
| 120 | * requirement is easily met if all the sizes of objects in buffer are | ||
| 121 | * multiples of dword and PAGE_SIZE is multiple dword. | ||
| 122 | * | ||
| 123 | * Call to this function doesn't change the processing location. | ||
| 124 | * | ||
| 125 | * offset: The index of the dword relative to the internat iterator. | ||
| 126 | */ | ||
| 127 | static inline void *drm_buffer_pointer_to_dword(struct drm_buffer *buffer, | ||
| 128 | int offset) | ||
| 129 | { | ||
| 130 | int iter = buffer->iterator + offset * 4; | ||
| 131 | return &buffer->data[iter / PAGE_SIZE][iter & (PAGE_SIZE - 1)]; | ||
| 132 | } | ||
| 133 | /** | ||
| 134 | * Returns the pointer to the dword which is offset number of elements from | ||
| 135 | * the current processing location. | ||
| 136 | * | ||
| 137 | * Call to this function doesn't change the processing location. | ||
| 138 | * | ||
| 139 | * offset: The index of the byte relative to the internat iterator. | ||
| 140 | */ | ||
| 141 | static inline void *drm_buffer_pointer_to_byte(struct drm_buffer *buffer, | ||
| 142 | int offset) | ||
| 143 | { | ||
| 144 | int iter = buffer->iterator + offset; | ||
| 145 | return &buffer->data[iter / PAGE_SIZE][iter & (PAGE_SIZE - 1)]; | ||
| 146 | } | ||
| 147 | |||
| 148 | #endif | ||
diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h index b69347b8904f..1347524a8e30 100644 --- a/include/drm/drm_crtc.h +++ b/include/drm/drm_crtc.h | |||
| @@ -123,7 +123,7 @@ struct drm_display_mode { | |||
| 123 | int type; | 123 | int type; |
| 124 | 124 | ||
| 125 | /* Proposed mode values */ | 125 | /* Proposed mode values */ |
| 126 | int clock; | 126 | int clock; /* in kHz */ |
| 127 | int hdisplay; | 127 | int hdisplay; |
| 128 | int hsync_start; | 128 | int hsync_start; |
| 129 | int hsync_end; | 129 | int hsync_end; |
| @@ -164,8 +164,8 @@ struct drm_display_mode { | |||
| 164 | int *private; | 164 | int *private; |
| 165 | int private_flags; | 165 | int private_flags; |
| 166 | 166 | ||
| 167 | int vrefresh; | 167 | int vrefresh; /* in Hz */ |
| 168 | float hsync; | 168 | int hsync; /* in kHz */ |
| 169 | }; | 169 | }; |
| 170 | 170 | ||
| 171 | enum drm_connector_status { | 171 | enum drm_connector_status { |
| @@ -242,6 +242,21 @@ struct drm_framebuffer_funcs { | |||
| 242 | int (*create_handle)(struct drm_framebuffer *fb, | 242 | int (*create_handle)(struct drm_framebuffer *fb, |
| 243 | struct drm_file *file_priv, | 243 | struct drm_file *file_priv, |
| 244 | unsigned int *handle); | 244 | unsigned int *handle); |
| 245 | /** | ||
| 246 | * Optinal callback for the dirty fb ioctl. | ||
| 247 | * | ||
| 248 | * Userspace can notify the driver via this callback | ||
| 249 | * that a area of the framebuffer has changed and should | ||
| 250 | * be flushed to the display hardware. | ||
| 251 | * | ||
| 252 | * See documentation in drm_mode.h for the struct | ||
| 253 | * drm_mode_fb_dirty_cmd for more information as all | ||
| 254 | * the semantics and arguments have a one to one mapping | ||
| 255 | * on this function. | ||
| 256 | */ | ||
| 257 | int (*dirty)(struct drm_framebuffer *framebuffer, unsigned flags, | ||
| 258 | unsigned color, struct drm_clip_rect *clips, | ||
| 259 | unsigned num_clips); | ||
| 245 | }; | 260 | }; |
| 246 | 261 | ||
| 247 | struct drm_framebuffer { | 262 | struct drm_framebuffer { |
| @@ -256,7 +271,7 @@ struct drm_framebuffer { | |||
| 256 | unsigned int depth; | 271 | unsigned int depth; |
| 257 | int bits_per_pixel; | 272 | int bits_per_pixel; |
| 258 | int flags; | 273 | int flags; |
| 259 | void *fbdev; | 274 | struct fb_info *fbdev; |
| 260 | u32 pseudo_palette[17]; | 275 | u32 pseudo_palette[17]; |
| 261 | struct list_head filp_head; | 276 | struct list_head filp_head; |
| 262 | /* if you are using the helper */ | 277 | /* if you are using the helper */ |
| @@ -290,6 +305,7 @@ struct drm_property { | |||
| 290 | struct drm_crtc; | 305 | struct drm_crtc; |
| 291 | struct drm_connector; | 306 | struct drm_connector; |
| 292 | struct drm_encoder; | 307 | struct drm_encoder; |
| 308 | struct drm_pending_vblank_event; | ||
| 293 | 309 | ||
| 294 | /** | 310 | /** |
| 295 | * drm_crtc_funcs - control CRTCs for a given device | 311 | * drm_crtc_funcs - control CRTCs for a given device |
| @@ -333,6 +349,19 @@ struct drm_crtc_funcs { | |||
| 333 | void (*destroy)(struct drm_crtc *crtc); | 349 | void (*destroy)(struct drm_crtc *crtc); |
| 334 | 350 | ||
| 335 | int (*set_config)(struct drm_mode_set *set); | 351 | int (*set_config)(struct drm_mode_set *set); |
| 352 | |||
| 353 | /* | ||
| 354 | * Flip to the given framebuffer. This implements the page | ||
| 355 | * flip ioctl descibed in drm_mode.h, specifically, the | ||
| 356 | * implementation must return immediately and block all | ||
| 357 | * rendering to the current fb until the flip has completed. | ||
| 358 | * If userspace set the event flag in the ioctl, the event | ||
| 359 | * argument will point to an event to send back when the flip | ||
| 360 | * completes, otherwise it will be NULL. | ||
| 361 | */ | ||
| 362 | int (*page_flip)(struct drm_crtc *crtc, | ||
| 363 | struct drm_framebuffer *fb, | ||
| 364 | struct drm_pending_vblank_event *event); | ||
| 336 | }; | 365 | }; |
| 337 | 366 | ||
| 338 | /** | 367 | /** |
| @@ -596,6 +625,7 @@ struct drm_mode_config { | |||
| 596 | /* Optional properties */ | 625 | /* Optional properties */ |
| 597 | struct drm_property *scaling_mode_property; | 626 | struct drm_property *scaling_mode_property; |
| 598 | struct drm_property *dithering_mode_property; | 627 | struct drm_property *dithering_mode_property; |
| 628 | struct drm_property *dirty_info_property; | ||
| 599 | }; | 629 | }; |
| 600 | 630 | ||
| 601 | #define obj_to_crtc(x) container_of(x, struct drm_crtc, base) | 631 | #define obj_to_crtc(x) container_of(x, struct drm_crtc, base) |
| @@ -667,6 +697,7 @@ extern void drm_mode_validate_size(struct drm_device *dev, | |||
| 667 | extern void drm_mode_prune_invalid(struct drm_device *dev, | 697 | extern void drm_mode_prune_invalid(struct drm_device *dev, |
| 668 | struct list_head *mode_list, bool verbose); | 698 | struct list_head *mode_list, bool verbose); |
| 669 | extern void drm_mode_sort(struct list_head *mode_list); | 699 | extern void drm_mode_sort(struct list_head *mode_list); |
| 700 | extern int drm_mode_hsync(struct drm_display_mode *mode); | ||
| 670 | extern int drm_mode_vrefresh(struct drm_display_mode *mode); | 701 | extern int drm_mode_vrefresh(struct drm_display_mode *mode); |
| 671 | extern void drm_mode_set_crtcinfo(struct drm_display_mode *p, | 702 | extern void drm_mode_set_crtcinfo(struct drm_display_mode *p, |
| 672 | int adjust_flags); | 703 | int adjust_flags); |
| @@ -703,6 +734,7 @@ extern int drm_mode_create_tv_properties(struct drm_device *dev, int num_formats | |||
| 703 | char *formats[]); | 734 | char *formats[]); |
| 704 | extern int drm_mode_create_scaling_mode_property(struct drm_device *dev); | 735 | extern int drm_mode_create_scaling_mode_property(struct drm_device *dev); |
| 705 | extern int drm_mode_create_dithering_property(struct drm_device *dev); | 736 | extern int drm_mode_create_dithering_property(struct drm_device *dev); |
| 737 | extern int drm_mode_create_dirty_info_property(struct drm_device *dev); | ||
| 706 | extern char *drm_get_encoder_name(struct drm_encoder *encoder); | 738 | extern char *drm_get_encoder_name(struct drm_encoder *encoder); |
| 707 | 739 | ||
| 708 | extern int drm_mode_connector_attach_encoder(struct drm_connector *connector, | 740 | extern int drm_mode_connector_attach_encoder(struct drm_connector *connector, |
| @@ -711,7 +743,8 @@ extern void drm_mode_connector_detach_encoder(struct drm_connector *connector, | |||
| 711 | struct drm_encoder *encoder); | 743 | struct drm_encoder *encoder); |
| 712 | extern bool drm_mode_crtc_set_gamma_size(struct drm_crtc *crtc, | 744 | extern bool drm_mode_crtc_set_gamma_size(struct drm_crtc *crtc, |
| 713 | int gamma_size); | 745 | int gamma_size); |
| 714 | extern void *drm_mode_object_find(struct drm_device *dev, uint32_t id, uint32_t type); | 746 | extern struct drm_mode_object *drm_mode_object_find(struct drm_device *dev, |
| 747 | uint32_t id, uint32_t type); | ||
| 715 | /* IOCTLs */ | 748 | /* IOCTLs */ |
| 716 | extern int drm_mode_getresources(struct drm_device *dev, | 749 | extern int drm_mode_getresources(struct drm_device *dev, |
| 717 | void *data, struct drm_file *file_priv); | 750 | void *data, struct drm_file *file_priv); |
| @@ -730,6 +763,8 @@ extern int drm_mode_rmfb(struct drm_device *dev, | |||
| 730 | void *data, struct drm_file *file_priv); | 763 | void *data, struct drm_file *file_priv); |
| 731 | extern int drm_mode_getfb(struct drm_device *dev, | 764 | extern int drm_mode_getfb(struct drm_device *dev, |
| 732 | void *data, struct drm_file *file_priv); | 765 | void *data, struct drm_file *file_priv); |
| 766 | extern int drm_mode_dirtyfb_ioctl(struct drm_device *dev, | ||
| 767 | void *data, struct drm_file *file_priv); | ||
| 733 | extern int drm_mode_addmode_ioctl(struct drm_device *dev, | 768 | extern int drm_mode_addmode_ioctl(struct drm_device *dev, |
| 734 | void *data, struct drm_file *file_priv); | 769 | void *data, struct drm_file *file_priv); |
| 735 | extern int drm_mode_rmmode_ioctl(struct drm_device *dev, | 770 | extern int drm_mode_rmmode_ioctl(struct drm_device *dev, |
| @@ -756,6 +791,8 @@ extern int drm_mode_gamma_get_ioctl(struct drm_device *dev, | |||
| 756 | extern int drm_mode_gamma_set_ioctl(struct drm_device *dev, | 791 | extern int drm_mode_gamma_set_ioctl(struct drm_device *dev, |
| 757 | void *data, struct drm_file *file_priv); | 792 | void *data, struct drm_file *file_priv); |
| 758 | extern bool drm_detect_hdmi_monitor(struct edid *edid); | 793 | extern bool drm_detect_hdmi_monitor(struct edid *edid); |
| 794 | extern int drm_mode_page_flip_ioctl(struct drm_device *dev, | ||
| 795 | void *data, struct drm_file *file_priv); | ||
| 759 | extern struct drm_display_mode *drm_cvt_mode(struct drm_device *dev, | 796 | extern struct drm_display_mode *drm_cvt_mode(struct drm_device *dev, |
| 760 | int hdisplay, int vdisplay, int vrefresh, | 797 | int hdisplay, int vdisplay, int vrefresh, |
| 761 | bool reduced, bool interlaced, bool margins); | 798 | bool reduced, bool interlaced, bool margins); |
| @@ -764,4 +801,6 @@ extern struct drm_display_mode *drm_gtf_mode(struct drm_device *dev, | |||
| 764 | bool interlaced, int margins); | 801 | bool interlaced, int margins); |
| 765 | extern int drm_add_modes_noedid(struct drm_connector *connector, | 802 | extern int drm_add_modes_noedid(struct drm_connector *connector, |
| 766 | int hdisplay, int vdisplay); | 803 | int hdisplay, int vdisplay); |
| 804 | |||
| 805 | extern bool drm_edid_is_valid(struct edid *edid); | ||
| 767 | #endif /* __DRM_CRTC_H__ */ | 806 | #endif /* __DRM_CRTC_H__ */ |
diff --git a/include/drm/drm_dp_helper.h b/include/drm/drm_dp_helper.h new file mode 100644 index 000000000000..a49e791db0b0 --- /dev/null +++ b/include/drm/drm_dp_helper.h | |||
| @@ -0,0 +1,180 @@ | |||
| 1 | /* | ||
| 2 | * Copyright © 2008 Keith Packard | ||
| 3 | * | ||
| 4 | * Permission to use, copy, modify, distribute, and sell this software and its | ||
| 5 | * documentation for any purpose is hereby granted without fee, provided that | ||
| 6 | * the above copyright notice appear in all copies and that both that copyright | ||
| 7 | * notice and this permission notice appear in supporting documentation, and | ||
| 8 | * that the name of the copyright holders not be used in advertising or | ||
| 9 | * publicity pertaining to distribution of the software without specific, | ||
| 10 | * written prior permission. The copyright holders make no representations | ||
| 11 | * about the suitability of this software for any purpose. It is provided "as | ||
| 12 | * is" without express or implied warranty. | ||
| 13 | * | ||
| 14 | * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, | ||
| 15 | * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO | ||
| 16 | * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR | ||
| 17 | * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, | ||
| 18 | * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER | ||
| 19 | * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | ||
| 20 | * OF THIS SOFTWARE. | ||
| 21 | */ | ||
| 22 | |||
| 23 | #ifndef _DRM_DP_HELPER_H_ | ||
| 24 | #define _DRM_DP_HELPER_H_ | ||
| 25 | |||
| 26 | /* From the VESA DisplayPort spec */ | ||
| 27 | |||
| 28 | #define AUX_NATIVE_WRITE 0x8 | ||
| 29 | #define AUX_NATIVE_READ 0x9 | ||
| 30 | #define AUX_I2C_WRITE 0x0 | ||
| 31 | #define AUX_I2C_READ 0x1 | ||
| 32 | #define AUX_I2C_STATUS 0x2 | ||
| 33 | #define AUX_I2C_MOT 0x4 | ||
| 34 | |||
| 35 | #define AUX_NATIVE_REPLY_ACK (0x0 << 4) | ||
| 36 | #define AUX_NATIVE_REPLY_NACK (0x1 << 4) | ||
| 37 | #define AUX_NATIVE_REPLY_DEFER (0x2 << 4) | ||
| 38 | #define AUX_NATIVE_REPLY_MASK (0x3 << 4) | ||
| 39 | |||
| 40 | #define AUX_I2C_REPLY_ACK (0x0 << 6) | ||
| 41 | #define AUX_I2C_REPLY_NACK (0x1 << 6) | ||
| 42 | #define AUX_I2C_REPLY_DEFER (0x2 << 6) | ||
| 43 | #define AUX_I2C_REPLY_MASK (0x3 << 6) | ||
| 44 | |||
| 45 | /* AUX CH addresses */ | ||
| 46 | /* DPCD */ | ||
| 47 | #define DP_DPCD_REV 0x000 | ||
| 48 | |||
| 49 | #define DP_MAX_LINK_RATE 0x001 | ||
| 50 | |||
| 51 | #define DP_MAX_LANE_COUNT 0x002 | ||
| 52 | # define DP_MAX_LANE_COUNT_MASK 0x1f | ||
| 53 | # define DP_ENHANCED_FRAME_CAP (1 << 7) | ||
| 54 | |||
| 55 | #define DP_MAX_DOWNSPREAD 0x003 | ||
| 56 | # define DP_NO_AUX_HANDSHAKE_LINK_TRAINING (1 << 6) | ||
| 57 | |||
| 58 | #define DP_NORP 0x004 | ||
| 59 | |||
| 60 | #define DP_DOWNSTREAMPORT_PRESENT 0x005 | ||
| 61 | # define DP_DWN_STRM_PORT_PRESENT (1 << 0) | ||
| 62 | # define DP_DWN_STRM_PORT_TYPE_MASK 0x06 | ||
| 63 | /* 00b = DisplayPort */ | ||
| 64 | /* 01b = Analog */ | ||
| 65 | /* 10b = TMDS or HDMI */ | ||
| 66 | /* 11b = Other */ | ||
| 67 | # define DP_FORMAT_CONVERSION (1 << 3) | ||
| 68 | |||
| 69 | #define DP_MAIN_LINK_CHANNEL_CODING 0x006 | ||
| 70 | |||
| 71 | /* link configuration */ | ||
| 72 | #define DP_LINK_BW_SET 0x100 | ||
| 73 | # define DP_LINK_BW_1_62 0x06 | ||
| 74 | # define DP_LINK_BW_2_7 0x0a | ||
| 75 | |||
| 76 | #define DP_LANE_COUNT_SET 0x101 | ||
| 77 | # define DP_LANE_COUNT_MASK 0x0f | ||
| 78 | # define DP_LANE_COUNT_ENHANCED_FRAME_EN (1 << 7) | ||
| 79 | |||
| 80 | #define DP_TRAINING_PATTERN_SET 0x102 | ||
| 81 | # define DP_TRAINING_PATTERN_DISABLE 0 | ||
| 82 | # define DP_TRAINING_PATTERN_1 1 | ||
| 83 | # define DP_TRAINING_PATTERN_2 2 | ||
| 84 | # define DP_TRAINING_PATTERN_MASK 0x3 | ||
| 85 | |||
| 86 | # define DP_LINK_QUAL_PATTERN_DISABLE (0 << 2) | ||
| 87 | # define DP_LINK_QUAL_PATTERN_D10_2 (1 << 2) | ||
| 88 | # define DP_LINK_QUAL_PATTERN_ERROR_RATE (2 << 2) | ||
| 89 | # define DP_LINK_QUAL_PATTERN_PRBS7 (3 << 2) | ||
| 90 | # define DP_LINK_QUAL_PATTERN_MASK (3 << 2) | ||
| 91 | |||
| 92 | # define DP_RECOVERED_CLOCK_OUT_EN (1 << 4) | ||
| 93 | # define DP_LINK_SCRAMBLING_DISABLE (1 << 5) | ||
| 94 | |||
| 95 | # define DP_SYMBOL_ERROR_COUNT_BOTH (0 << 6) | ||
| 96 | # define DP_SYMBOL_ERROR_COUNT_DISPARITY (1 << 6) | ||
| 97 | # define DP_SYMBOL_ERROR_COUNT_SYMBOL (2 << 6) | ||
| 98 | # define DP_SYMBOL_ERROR_COUNT_MASK (3 << 6) | ||
| 99 | |||
| 100 | #define DP_TRAINING_LANE0_SET 0x103 | ||
| 101 | #define DP_TRAINING_LANE1_SET 0x104 | ||
| 102 | #define DP_TRAINING_LANE2_SET 0x105 | ||
| 103 | #define DP_TRAINING_LANE3_SET 0x106 | ||
| 104 | |||
| 105 | # define DP_TRAIN_VOLTAGE_SWING_MASK 0x3 | ||
| 106 | # define DP_TRAIN_VOLTAGE_SWING_SHIFT 0 | ||
| 107 | # define DP_TRAIN_MAX_SWING_REACHED (1 << 2) | ||
| 108 | # define DP_TRAIN_VOLTAGE_SWING_400 (0 << 0) | ||
| 109 | # define DP_TRAIN_VOLTAGE_SWING_600 (1 << 0) | ||
| 110 | # define DP_TRAIN_VOLTAGE_SWING_800 (2 << 0) | ||
| 111 | # define DP_TRAIN_VOLTAGE_SWING_1200 (3 << 0) | ||
| 112 | |||
| 113 | # define DP_TRAIN_PRE_EMPHASIS_MASK (3 << 3) | ||
| 114 | # define DP_TRAIN_PRE_EMPHASIS_0 (0 << 3) | ||
| 115 | # define DP_TRAIN_PRE_EMPHASIS_3_5 (1 << 3) | ||
| 116 | # define DP_TRAIN_PRE_EMPHASIS_6 (2 << 3) | ||
| 117 | # define DP_TRAIN_PRE_EMPHASIS_9_5 (3 << 3) | ||
| 118 | |||
| 119 | # define DP_TRAIN_PRE_EMPHASIS_SHIFT 3 | ||
| 120 | # define DP_TRAIN_MAX_PRE_EMPHASIS_REACHED (1 << 5) | ||
| 121 | |||
| 122 | #define DP_DOWNSPREAD_CTRL 0x107 | ||
| 123 | # define DP_SPREAD_AMP_0_5 (1 << 4) | ||
| 124 | |||
| 125 | #define DP_MAIN_LINK_CHANNEL_CODING_SET 0x108 | ||
| 126 | # define DP_SET_ANSI_8B10B (1 << 0) | ||
| 127 | |||
| 128 | #define DP_LANE0_1_STATUS 0x202 | ||
| 129 | #define DP_LANE2_3_STATUS 0x203 | ||
| 130 | # define DP_LANE_CR_DONE (1 << 0) | ||
| 131 | # define DP_LANE_CHANNEL_EQ_DONE (1 << 1) | ||
| 132 | # define DP_LANE_SYMBOL_LOCKED (1 << 2) | ||
| 133 | |||
| 134 | #define DP_CHANNEL_EQ_BITS (DP_LANE_CR_DONE | \ | ||
| 135 | DP_LANE_CHANNEL_EQ_DONE | \ | ||
| 136 | DP_LANE_SYMBOL_LOCKED) | ||
| 137 | |||
| 138 | #define DP_LANE_ALIGN_STATUS_UPDATED 0x204 | ||
| 139 | |||
| 140 | #define DP_INTERLANE_ALIGN_DONE (1 << 0) | ||
| 141 | #define DP_DOWNSTREAM_PORT_STATUS_CHANGED (1 << 6) | ||
| 142 | #define DP_LINK_STATUS_UPDATED (1 << 7) | ||
| 143 | |||
| 144 | #define DP_SINK_STATUS 0x205 | ||
| 145 | |||
| 146 | #define DP_RECEIVE_PORT_0_STATUS (1 << 0) | ||
| 147 | #define DP_RECEIVE_PORT_1_STATUS (1 << 1) | ||
| 148 | |||
| 149 | #define DP_ADJUST_REQUEST_LANE0_1 0x206 | ||
| 150 | #define DP_ADJUST_REQUEST_LANE2_3 0x207 | ||
| 151 | # define DP_ADJUST_VOLTAGE_SWING_LANE0_MASK 0x03 | ||
| 152 | # define DP_ADJUST_VOLTAGE_SWING_LANE0_SHIFT 0 | ||
| 153 | # define DP_ADJUST_PRE_EMPHASIS_LANE0_MASK 0x0c | ||
| 154 | # define DP_ADJUST_PRE_EMPHASIS_LANE0_SHIFT 2 | ||
| 155 | # define DP_ADJUST_VOLTAGE_SWING_LANE1_MASK 0x30 | ||
| 156 | # define DP_ADJUST_VOLTAGE_SWING_LANE1_SHIFT 4 | ||
| 157 | # define DP_ADJUST_PRE_EMPHASIS_LANE1_MASK 0xc0 | ||
| 158 | # define DP_ADJUST_PRE_EMPHASIS_LANE1_SHIFT 6 | ||
| 159 | |||
| 160 | #define DP_SET_POWER 0x600 | ||
| 161 | # define DP_SET_POWER_D0 0x1 | ||
| 162 | # define DP_SET_POWER_D3 0x2 | ||
| 163 | |||
| 164 | #define MODE_I2C_START 1 | ||
| 165 | #define MODE_I2C_WRITE 2 | ||
| 166 | #define MODE_I2C_READ 4 | ||
| 167 | #define MODE_I2C_STOP 8 | ||
| 168 | |||
| 169 | struct i2c_algo_dp_aux_data { | ||
| 170 | bool running; | ||
| 171 | u16 address; | ||
| 172 | int (*aux_ch) (struct i2c_adapter *adapter, | ||
| 173 | int mode, uint8_t write_byte, | ||
| 174 | uint8_t *read_byte); | ||
| 175 | }; | ||
| 176 | |||
| 177 | int | ||
| 178 | i2c_dp_aux_add_bus(struct i2c_adapter *adapter); | ||
| 179 | |||
| 180 | #endif /* _DRM_DP_HELPER_H_ */ | ||
diff --git a/include/drm/drm_edid.h b/include/drm/drm_edid.h index 7d6c9a2dfcbb..b4209898f115 100644 --- a/include/drm/drm_edid.h +++ b/include/drm/drm_edid.h | |||
| @@ -106,6 +106,10 @@ struct detailed_data_color_point { | |||
| 106 | u8 wpindex2[3]; | 106 | u8 wpindex2[3]; |
| 107 | } __attribute__((packed)); | 107 | } __attribute__((packed)); |
| 108 | 108 | ||
| 109 | struct cvt_timing { | ||
| 110 | u8 code[3]; | ||
| 111 | } __attribute__((packed)); | ||
| 112 | |||
| 109 | struct detailed_non_pixel { | 113 | struct detailed_non_pixel { |
| 110 | u8 pad1; | 114 | u8 pad1; |
| 111 | u8 type; /* ff=serial, fe=string, fd=monitor range, fc=monitor name | 115 | u8 type; /* ff=serial, fe=string, fd=monitor range, fc=monitor name |
| @@ -117,9 +121,13 @@ struct detailed_non_pixel { | |||
| 117 | struct detailed_data_monitor_range range; | 121 | struct detailed_data_monitor_range range; |
| 118 | struct detailed_data_wpindex color; | 122 | struct detailed_data_wpindex color; |
| 119 | struct std_timing timings[5]; | 123 | struct std_timing timings[5]; |
| 124 | struct cvt_timing cvt[4]; | ||
| 120 | } data; | 125 | } data; |
| 121 | } __attribute__((packed)); | 126 | } __attribute__((packed)); |
| 122 | 127 | ||
| 128 | #define EDID_DETAIL_EST_TIMINGS 0xf7 | ||
| 129 | #define EDID_DETAIL_CVT_3BYTE 0xf8 | ||
| 130 | #define EDID_DETAIL_COLOR_MGMT_DATA 0xf9 | ||
| 123 | #define EDID_DETAIL_STD_MODES 0xfa | 131 | #define EDID_DETAIL_STD_MODES 0xfa |
| 124 | #define EDID_DETAIL_MONITOR_CPDATA 0xfb | 132 | #define EDID_DETAIL_MONITOR_CPDATA 0xfb |
| 125 | #define EDID_DETAIL_MONITOR_NAME 0xfc | 133 | #define EDID_DETAIL_MONITOR_NAME 0xfc |
| @@ -193,4 +201,7 @@ struct edid { | |||
| 193 | 201 | ||
| 194 | #define EDID_PRODUCT_ID(e) ((e)->prod_code[0] | ((e)->prod_code[1] << 8)) | 202 | #define EDID_PRODUCT_ID(e) ((e)->prod_code[0] | ((e)->prod_code[1] << 8)) |
| 195 | 203 | ||
| 204 | /* define the number of Extension EDID block */ | ||
| 205 | #define DRM_MAX_EDID_EXT_NUM 4 | ||
| 206 | |||
| 196 | #endif /* __DRM_EDID_H__ */ | 207 | #endif /* __DRM_EDID_H__ */ |
diff --git a/include/drm/drm_mem_util.h b/include/drm/drm_mem_util.h new file mode 100644 index 000000000000..6bd325fedc87 --- /dev/null +++ b/include/drm/drm_mem_util.h | |||
| @@ -0,0 +1,65 @@ | |||
| 1 | /* | ||
| 2 | * Copyright © 2008 Intel Corporation | ||
| 3 | * | ||
| 4 | * Permission is hereby granted, free of charge, to any person obtaining a | ||
| 5 | * copy of this software and associated documentation files (the "Software"), | ||
| 6 | * to deal in the Software without restriction, including without limitation | ||
| 7 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||
| 8 | * and/or sell copies of the Software, and to permit persons to whom the | ||
| 9 | * Software is furnished to do so, subject to the following conditions: | ||
| 10 | * | ||
| 11 | * The above copyright notice and this permission notice (including the next | ||
| 12 | * paragraph) shall be included in all copies or substantial portions of the | ||
| 13 | * Software. | ||
| 14 | * | ||
| 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
| 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | ||
| 18 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
| 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||
| 20 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS | ||
| 21 | * IN THE SOFTWARE. | ||
| 22 | * | ||
| 23 | * Authors: | ||
| 24 | * Jesse Barnes <jbarnes@virtuousgeek.org> | ||
| 25 | * | ||
| 26 | */ | ||
| 27 | #ifndef _DRM_MEM_UTIL_H_ | ||
| 28 | #define _DRM_MEM_UTIL_H_ | ||
| 29 | |||
| 30 | #include <linux/vmalloc.h> | ||
| 31 | |||
| 32 | static __inline__ void *drm_calloc_large(size_t nmemb, size_t size) | ||
| 33 | { | ||
| 34 | if (size != 0 && nmemb > ULONG_MAX / size) | ||
| 35 | return NULL; | ||
| 36 | |||
| 37 | if (size * nmemb <= PAGE_SIZE) | ||
| 38 | return kcalloc(nmemb, size, GFP_KERNEL); | ||
| 39 | |||
| 40 | return __vmalloc(size * nmemb, | ||
| 41 | GFP_KERNEL | __GFP_HIGHMEM | __GFP_ZERO, PAGE_KERNEL); | ||
| 42 | } | ||
| 43 | |||
| 44 | /* Modeled after cairo's malloc_ab, it's like calloc but without the zeroing. */ | ||
| 45 | static __inline__ void *drm_malloc_ab(size_t nmemb, size_t size) | ||
| 46 | { | ||
| 47 | if (size != 0 && nmemb > ULONG_MAX / size) | ||
| 48 | return NULL; | ||
| 49 | |||
| 50 | if (size * nmemb <= PAGE_SIZE) | ||
| 51 | return kmalloc(nmemb * size, GFP_KERNEL); | ||
| 52 | |||
| 53 | return __vmalloc(size * nmemb, | ||
| 54 | GFP_KERNEL | __GFP_HIGHMEM, PAGE_KERNEL); | ||
| 55 | } | ||
| 56 | |||
| 57 | static __inline void drm_free_large(void *ptr) | ||
| 58 | { | ||
| 59 | if (!is_vmalloc_addr(ptr)) | ||
| 60 | return kfree(ptr); | ||
| 61 | |||
| 62 | vfree(ptr); | ||
| 63 | } | ||
| 64 | |||
| 65 | #endif | ||
diff --git a/include/drm/drm_mm.h b/include/drm/drm_mm.h index 62329f9a42cb..4c10be39a43b 100644 --- a/include/drm/drm_mm.h +++ b/include/drm/drm_mm.h | |||
| @@ -66,6 +66,13 @@ extern struct drm_mm_node *drm_mm_get_block_generic(struct drm_mm_node *node, | |||
| 66 | unsigned long size, | 66 | unsigned long size, |
| 67 | unsigned alignment, | 67 | unsigned alignment, |
| 68 | int atomic); | 68 | int atomic); |
| 69 | extern struct drm_mm_node *drm_mm_get_block_range_generic( | ||
| 70 | struct drm_mm_node *node, | ||
| 71 | unsigned long size, | ||
| 72 | unsigned alignment, | ||
| 73 | unsigned long start, | ||
| 74 | unsigned long end, | ||
| 75 | int atomic); | ||
| 69 | static inline struct drm_mm_node *drm_mm_get_block(struct drm_mm_node *parent, | 76 | static inline struct drm_mm_node *drm_mm_get_block(struct drm_mm_node *parent, |
| 70 | unsigned long size, | 77 | unsigned long size, |
| 71 | unsigned alignment) | 78 | unsigned alignment) |
| @@ -78,11 +85,38 @@ static inline struct drm_mm_node *drm_mm_get_block_atomic(struct drm_mm_node *pa | |||
| 78 | { | 85 | { |
| 79 | return drm_mm_get_block_generic(parent, size, alignment, 1); | 86 | return drm_mm_get_block_generic(parent, size, alignment, 1); |
| 80 | } | 87 | } |
| 88 | static inline struct drm_mm_node *drm_mm_get_block_range( | ||
| 89 | struct drm_mm_node *parent, | ||
| 90 | unsigned long size, | ||
| 91 | unsigned alignment, | ||
| 92 | unsigned long start, | ||
| 93 | unsigned long end) | ||
| 94 | { | ||
| 95 | return drm_mm_get_block_range_generic(parent, size, alignment, | ||
| 96 | start, end, 0); | ||
| 97 | } | ||
| 98 | static inline struct drm_mm_node *drm_mm_get_block_atomic_range( | ||
| 99 | struct drm_mm_node *parent, | ||
| 100 | unsigned long size, | ||
| 101 | unsigned alignment, | ||
| 102 | unsigned long start, | ||
| 103 | unsigned long end) | ||
| 104 | { | ||
| 105 | return drm_mm_get_block_range_generic(parent, size, alignment, | ||
| 106 | start, end, 1); | ||
| 107 | } | ||
| 81 | extern void drm_mm_put_block(struct drm_mm_node *cur); | 108 | extern void drm_mm_put_block(struct drm_mm_node *cur); |
| 82 | extern struct drm_mm_node *drm_mm_search_free(const struct drm_mm *mm, | 109 | extern struct drm_mm_node *drm_mm_search_free(const struct drm_mm *mm, |
| 83 | unsigned long size, | 110 | unsigned long size, |
| 84 | unsigned alignment, | 111 | unsigned alignment, |
| 85 | int best_match); | 112 | int best_match); |
| 113 | extern struct drm_mm_node *drm_mm_search_free_in_range( | ||
| 114 | const struct drm_mm *mm, | ||
| 115 | unsigned long size, | ||
| 116 | unsigned alignment, | ||
| 117 | unsigned long start, | ||
| 118 | unsigned long end, | ||
| 119 | int best_match); | ||
| 86 | extern int drm_mm_init(struct drm_mm *mm, unsigned long start, | 120 | extern int drm_mm_init(struct drm_mm *mm, unsigned long start, |
| 87 | unsigned long size); | 121 | unsigned long size); |
| 88 | extern void drm_mm_takedown(struct drm_mm *mm); | 122 | extern void drm_mm_takedown(struct drm_mm *mm); |
| @@ -99,6 +133,7 @@ static inline struct drm_mm *drm_get_mm(struct drm_mm_node *block) | |||
| 99 | return block->mm; | 133 | return block->mm; |
| 100 | } | 134 | } |
| 101 | 135 | ||
| 136 | extern void drm_mm_debug_table(struct drm_mm *mm, const char *prefix); | ||
| 102 | #ifdef CONFIG_DEBUG_FS | 137 | #ifdef CONFIG_DEBUG_FS |
| 103 | int drm_mm_dump_table(struct seq_file *m, struct drm_mm *mm); | 138 | int drm_mm_dump_table(struct seq_file *m, struct drm_mm *mm); |
| 104 | #endif | 139 | #endif |
diff --git a/include/drm/drm_mode.h b/include/drm/drm_mode.h index 1f908416aedb..c5ba1636613c 100644 --- a/include/drm/drm_mode.h +++ b/include/drm/drm_mode.h | |||
| @@ -27,9 +27,6 @@ | |||
| 27 | #ifndef _DRM_MODE_H | 27 | #ifndef _DRM_MODE_H |
| 28 | #define _DRM_MODE_H | 28 | #define _DRM_MODE_H |
| 29 | 29 | ||
| 30 | #include <linux/kernel.h> | ||
| 31 | #include <linux/types.h> | ||
| 32 | |||
| 33 | #define DRM_DISPLAY_INFO_LEN 32 | 30 | #define DRM_DISPLAY_INFO_LEN 32 |
| 34 | #define DRM_CONNECTOR_NAME_LEN 32 | 31 | #define DRM_CONNECTOR_NAME_LEN 32 |
| 35 | #define DRM_DISPLAY_MODE_LEN 32 | 32 | #define DRM_DISPLAY_MODE_LEN 32 |
| @@ -78,12 +75,17 @@ | |||
| 78 | #define DRM_MODE_DITHERING_OFF 0 | 75 | #define DRM_MODE_DITHERING_OFF 0 |
| 79 | #define DRM_MODE_DITHERING_ON 1 | 76 | #define DRM_MODE_DITHERING_ON 1 |
| 80 | 77 | ||
| 78 | /* Dirty info options */ | ||
| 79 | #define DRM_MODE_DIRTY_OFF 0 | ||
| 80 | #define DRM_MODE_DIRTY_ON 1 | ||
| 81 | #define DRM_MODE_DIRTY_ANNOTATE 2 | ||
| 82 | |||
| 81 | struct drm_mode_modeinfo { | 83 | struct drm_mode_modeinfo { |
| 82 | __u32 clock; | 84 | __u32 clock; |
| 83 | __u16 hdisplay, hsync_start, hsync_end, htotal, hskew; | 85 | __u16 hdisplay, hsync_start, hsync_end, htotal, hskew; |
| 84 | __u16 vdisplay, vsync_start, vsync_end, vtotal, vscan; | 86 | __u16 vdisplay, vsync_start, vsync_end, vtotal, vscan; |
| 85 | 87 | ||
| 86 | __u32 vrefresh; /* vertical refresh * 1000 */ | 88 | __u32 vrefresh; |
| 87 | 89 | ||
| 88 | __u32 flags; | 90 | __u32 flags; |
| 89 | __u32 type; | 91 | __u32 type; |
| @@ -158,6 +160,7 @@ struct drm_mode_get_encoder { | |||
| 158 | #define DRM_MODE_CONNECTOR_HDMIA 11 | 160 | #define DRM_MODE_CONNECTOR_HDMIA 11 |
| 159 | #define DRM_MODE_CONNECTOR_HDMIB 12 | 161 | #define DRM_MODE_CONNECTOR_HDMIB 12 |
| 160 | #define DRM_MODE_CONNECTOR_TV 13 | 162 | #define DRM_MODE_CONNECTOR_TV 13 |
| 163 | #define DRM_MODE_CONNECTOR_eDP 14 | ||
| 161 | 164 | ||
| 162 | struct drm_mode_get_connector { | 165 | struct drm_mode_get_connector { |
| 163 | 166 | ||
| @@ -225,6 +228,45 @@ struct drm_mode_fb_cmd { | |||
| 225 | __u32 handle; | 228 | __u32 handle; |
| 226 | }; | 229 | }; |
| 227 | 230 | ||
| 231 | #define DRM_MODE_FB_DIRTY_ANNOTATE_COPY 0x01 | ||
| 232 | #define DRM_MODE_FB_DIRTY_ANNOTATE_FILL 0x02 | ||
| 233 | #define DRM_MODE_FB_DIRTY_FLAGS 0x03 | ||
| 234 | |||
| 235 | /* | ||
| 236 | * Mark a region of a framebuffer as dirty. | ||
| 237 | * | ||
| 238 | * Some hardware does not automatically update display contents | ||
| 239 | * as a hardware or software draw to a framebuffer. This ioctl | ||
| 240 | * allows userspace to tell the kernel and the hardware what | ||
| 241 | * regions of the framebuffer have changed. | ||
| 242 | * | ||
| 243 | * The kernel or hardware is free to update more then just the | ||
| 244 | * region specified by the clip rects. The kernel or hardware | ||
| 245 | * may also delay and/or coalesce several calls to dirty into a | ||
| 246 | * single update. | ||
| 247 | * | ||
| 248 | * Userspace may annotate the updates, the annotates are a | ||
| 249 | * promise made by the caller that the change is either a copy | ||
| 250 | * of pixels or a fill of a single color in the region specified. | ||
| 251 | * | ||
| 252 | * If the DRM_MODE_FB_DIRTY_ANNOTATE_COPY flag is given then | ||
| 253 | * the number of updated regions are half of num_clips given, | ||
| 254 | * where the clip rects are paired in src and dst. The width and | ||
| 255 | * height of each one of the pairs must match. | ||
| 256 | * | ||
| 257 | * If the DRM_MODE_FB_DIRTY_ANNOTATE_FILL flag is given the caller | ||
| 258 | * promises that the region specified of the clip rects is filled | ||
| 259 | * completely with a single color as given in the color argument. | ||
| 260 | */ | ||
| 261 | |||
| 262 | struct drm_mode_fb_dirty_cmd { | ||
| 263 | __u32 fb_id; | ||
| 264 | __u32 flags; | ||
| 265 | __u32 color; | ||
| 266 | __u32 num_clips; | ||
| 267 | __u64 clips_ptr; | ||
| 268 | }; | ||
| 269 | |||
| 228 | struct drm_mode_mode_cmd { | 270 | struct drm_mode_mode_cmd { |
| 229 | __u32 connector_id; | 271 | __u32 connector_id; |
| 230 | struct drm_mode_modeinfo mode; | 272 | struct drm_mode_modeinfo mode; |
| @@ -268,4 +310,37 @@ struct drm_mode_crtc_lut { | |||
| 268 | __u64 blue; | 310 | __u64 blue; |
| 269 | }; | 311 | }; |
| 270 | 312 | ||
| 313 | #define DRM_MODE_PAGE_FLIP_EVENT 0x01 | ||
| 314 | #define DRM_MODE_PAGE_FLIP_FLAGS DRM_MODE_PAGE_FLIP_EVENT | ||
| 315 | |||
| 316 | /* | ||
| 317 | * Request a page flip on the specified crtc. | ||
| 318 | * | ||
| 319 | * This ioctl will ask KMS to schedule a page flip for the specified | ||
| 320 | * crtc. Once any pending rendering targeting the specified fb (as of | ||
| 321 | * ioctl time) has completed, the crtc will be reprogrammed to display | ||
| 322 | * that fb after the next vertical refresh. The ioctl returns | ||
| 323 | * immediately, but subsequent rendering to the current fb will block | ||
| 324 | * in the execbuffer ioctl until the page flip happens. If a page | ||
| 325 | * flip is already pending as the ioctl is called, EBUSY will be | ||
| 326 | * returned. | ||
| 327 | * | ||
| 328 | * The ioctl supports one flag, DRM_MODE_PAGE_FLIP_EVENT, which will | ||
| 329 | * request that drm sends back a vblank event (see drm.h: struct | ||
| 330 | * drm_event_vblank) when the page flip is done. The user_data field | ||
| 331 | * passed in with this ioctl will be returned as the user_data field | ||
| 332 | * in the vblank event struct. | ||
| 333 | * | ||
| 334 | * The reserved field must be zero until we figure out something | ||
| 335 | * clever to use it for. | ||
| 336 | */ | ||
| 337 | |||
| 338 | struct drm_mode_crtc_page_flip { | ||
| 339 | __u32 crtc_id; | ||
| 340 | __u32 fb_id; | ||
| 341 | __u32 flags; | ||
| 342 | __u32 reserved; | ||
| 343 | __u64 user_data; | ||
| 344 | }; | ||
| 345 | |||
| 271 | #endif | 346 | #endif |
diff --git a/include/drm/drm_os_linux.h b/include/drm/drm_os_linux.h index 26641e95e0a4..393369147a2d 100644 --- a/include/drm/drm_os_linux.h +++ b/include/drm/drm_os_linux.h | |||
| @@ -123,5 +123,5 @@ do { \ | |||
| 123 | remove_wait_queue(&(queue), &entry); \ | 123 | remove_wait_queue(&(queue), &entry); \ |
| 124 | } while (0) | 124 | } while (0) |
| 125 | 125 | ||
| 126 | #define DRM_WAKEUP( queue ) wake_up_interruptible( queue ) | 126 | #define DRM_WAKEUP( queue ) wake_up( queue ) |
| 127 | #define DRM_INIT_WAITQUEUE( queue ) init_waitqueue_head( queue ) | 127 | #define DRM_INIT_WAITQUEUE( queue ) init_waitqueue_head( queue ) |
diff --git a/include/drm/drm_pciids.h b/include/drm/drm_pciids.h index e6f3b120f51a..2d428b088cc8 100644 --- a/include/drm/drm_pciids.h +++ b/include/drm/drm_pciids.h | |||
| @@ -6,6 +6,7 @@ | |||
| 6 | {0x1002, 0x3150, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV380|RADEON_IS_MOBILITY}, \ | 6 | {0x1002, 0x3150, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV380|RADEON_IS_MOBILITY}, \ |
| 7 | {0x1002, 0x3152, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV380|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ | 7 | {0x1002, 0x3152, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV380|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ |
| 8 | {0x1002, 0x3154, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV380|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ | 8 | {0x1002, 0x3154, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV380|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ |
| 9 | {0x1002, 0x3155, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV380|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ | ||
| 9 | {0x1002, 0x3E50, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV380|RADEON_NEW_MEMMAP}, \ | 10 | {0x1002, 0x3E50, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV380|RADEON_NEW_MEMMAP}, \ |
| 10 | {0x1002, 0x3E54, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV380|RADEON_NEW_MEMMAP}, \ | 11 | {0x1002, 0x3E54, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV380|RADEON_NEW_MEMMAP}, \ |
| 11 | {0x1002, 0x4136, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS100|RADEON_IS_IGP}, \ | 12 | {0x1002, 0x4136, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS100|RADEON_IS_IGP}, \ |
| @@ -141,6 +142,41 @@ | |||
| 141 | {0x1002, 0x5e4c, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV410|RADEON_NEW_MEMMAP}, \ | 142 | {0x1002, 0x5e4c, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV410|RADEON_NEW_MEMMAP}, \ |
| 142 | {0x1002, 0x5e4d, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV410|RADEON_NEW_MEMMAP}, \ | 143 | {0x1002, 0x5e4d, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV410|RADEON_NEW_MEMMAP}, \ |
| 143 | {0x1002, 0x5e4f, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV410|RADEON_NEW_MEMMAP}, \ | 144 | {0x1002, 0x5e4f, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV410|RADEON_NEW_MEMMAP}, \ |
| 145 | {0x1002, 0x6880, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CYPRESS|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ | ||
| 146 | {0x1002, 0x6888, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CYPRESS|RADEON_NEW_MEMMAP}, \ | ||
| 147 | {0x1002, 0x6889, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CYPRESS|RADEON_NEW_MEMMAP}, \ | ||
| 148 | {0x1002, 0x688A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CYPRESS|RADEON_NEW_MEMMAP}, \ | ||
| 149 | {0x1002, 0x6898, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CYPRESS|RADEON_NEW_MEMMAP}, \ | ||
| 150 | {0x1002, 0x6899, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CYPRESS|RADEON_NEW_MEMMAP}, \ | ||
| 151 | {0x1002, 0x689c, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_HEMLOCK|RADEON_NEW_MEMMAP}, \ | ||
| 152 | {0x1002, 0x689d, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_HEMLOCK|RADEON_NEW_MEMMAP}, \ | ||
| 153 | {0x1002, 0x689e, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CYPRESS|RADEON_NEW_MEMMAP}, \ | ||
| 154 | {0x1002, 0x68a0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_JUNIPER|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ | ||
| 155 | {0x1002, 0x68a1, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_JUNIPER|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ | ||
| 156 | {0x1002, 0x68a8, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_JUNIPER|RADEON_NEW_MEMMAP}, \ | ||
| 157 | {0x1002, 0x68a9, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_JUNIPER|RADEON_NEW_MEMMAP}, \ | ||
| 158 | {0x1002, 0x68b0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_JUNIPER|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ | ||
| 159 | {0x1002, 0x68b8, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_JUNIPER|RADEON_NEW_MEMMAP}, \ | ||
| 160 | {0x1002, 0x68b9, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_JUNIPER|RADEON_NEW_MEMMAP}, \ | ||
| 161 | {0x1002, 0x68be, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_JUNIPER|RADEON_NEW_MEMMAP}, \ | ||
| 162 | {0x1002, 0x68c0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_REDWOOD|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ | ||
| 163 | {0x1002, 0x68c1, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_REDWOOD|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ | ||
| 164 | {0x1002, 0x68c8, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_REDWOOD|RADEON_NEW_MEMMAP}, \ | ||
| 165 | {0x1002, 0x68c9, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_REDWOOD|RADEON_NEW_MEMMAP}, \ | ||
| 166 | {0x1002, 0x68d8, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_REDWOOD|RADEON_NEW_MEMMAP}, \ | ||
| 167 | {0x1002, 0x68d9, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_REDWOOD|RADEON_NEW_MEMMAP}, \ | ||
| 168 | {0x1002, 0x68da, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_REDWOOD|RADEON_NEW_MEMMAP}, \ | ||
| 169 | {0x1002, 0x68de, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_REDWOOD|RADEON_NEW_MEMMAP}, \ | ||
| 170 | {0x1002, 0x68e0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CEDAR|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ | ||
| 171 | {0x1002, 0x68e1, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CEDAR|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ | ||
| 172 | {0x1002, 0x68e4, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CEDAR|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ | ||
| 173 | {0x1002, 0x68e5, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CEDAR|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ | ||
| 174 | {0x1002, 0x68e8, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CEDAR|RADEON_NEW_MEMMAP}, \ | ||
| 175 | {0x1002, 0x68e9, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CEDAR|RADEON_NEW_MEMMAP}, \ | ||
| 176 | {0x1002, 0x68f1, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CEDAR|RADEON_NEW_MEMMAP}, \ | ||
| 177 | {0x1002, 0x68f8, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CEDAR|RADEON_NEW_MEMMAP}, \ | ||
| 178 | {0x1002, 0x68f9, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CEDAR|RADEON_NEW_MEMMAP}, \ | ||
| 179 | {0x1002, 0x68fe, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CEDAR|RADEON_NEW_MEMMAP}, \ | ||
| 144 | {0x1002, 0x7100, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R520|RADEON_NEW_MEMMAP}, \ | 180 | {0x1002, 0x7100, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R520|RADEON_NEW_MEMMAP}, \ |
| 145 | {0x1002, 0x7101, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R520|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ | 181 | {0x1002, 0x7101, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R520|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ |
| 146 | {0x1002, 0x7102, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R520|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ | 182 | {0x1002, 0x7102, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R520|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ |
| @@ -375,6 +411,7 @@ | |||
| 375 | {0x1002, 0x9712, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS880|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ | 411 | {0x1002, 0x9712, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS880|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ |
| 376 | {0x1002, 0x9713, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS880|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ | 412 | {0x1002, 0x9713, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS880|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ |
| 377 | {0x1002, 0x9714, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS880|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ | 413 | {0x1002, 0x9714, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS880|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ |
| 414 | {0x1002, 0x9715, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS880|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ | ||
| 378 | {0, 0, 0} | 415 | {0, 0, 0} |
| 379 | 416 | ||
| 380 | #define r128_PCI_IDS \ | 417 | #define r128_PCI_IDS \ |
| @@ -558,4 +595,5 @@ | |||
| 558 | {0x8086, 0x35e8, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_DISPLAY_VGA << 8, 0xffff00, 0}, \ | 595 | {0x8086, 0x35e8, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_DISPLAY_VGA << 8, 0xffff00, 0}, \ |
| 559 | {0x8086, 0x0042, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_DISPLAY_VGA << 8, 0xffff00, 0}, \ | 596 | {0x8086, 0x0042, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_DISPLAY_VGA << 8, 0xffff00, 0}, \ |
| 560 | {0x8086, 0x0046, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_DISPLAY_VGA << 8, 0xffff00, 0}, \ | 597 | {0x8086, 0x0046, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_DISPLAY_VGA << 8, 0xffff00, 0}, \ |
| 598 | {0x8086, 0x0102, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_DISPLAY_VGA << 8, 0xffff00, 0}, \ | ||
| 561 | {0, 0, 0} | 599 | {0, 0, 0} |
diff --git a/include/drm/i2c/ch7006.h b/include/drm/i2c/ch7006.h new file mode 100644 index 000000000000..8390b437a1f8 --- /dev/null +++ b/include/drm/i2c/ch7006.h | |||
| @@ -0,0 +1,86 @@ | |||
| 1 | /* | ||
| 2 | * Copyright (C) 2009 Francisco Jerez. | ||
| 3 | * All Rights Reserved. | ||
| 4 | * | ||
| 5 | * Permission is hereby granted, free of charge, to any person obtaining | ||
| 6 | * a copy of this software and associated documentation files (the | ||
| 7 | * "Software"), to deal in the Software without restriction, including | ||
| 8 | * without limitation the rights to use, copy, modify, merge, publish, | ||
| 9 | * distribute, sublicense, and/or sell copies of the Software, and to | ||
| 10 | * permit persons to whom the Software is furnished to do so, subject to | ||
| 11 | * the following conditions: | ||
| 12 | * | ||
| 13 | * The above copyright notice and this permission notice (including the | ||
| 14 | * next paragraph) shall be included in all copies or substantial | ||
| 15 | * portions of the Software. | ||
| 16 | * | ||
| 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||
| 18 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
| 19 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. | ||
| 20 | * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE | ||
| 21 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION | ||
| 22 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | ||
| 23 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
| 24 | * | ||
| 25 | */ | ||
| 26 | |||
| 27 | #ifndef __DRM_I2C_CH7006_H__ | ||
| 28 | #define __DRM_I2C_CH7006_H__ | ||
| 29 | |||
| 30 | /** | ||
| 31 | * struct ch7006_encoder_params | ||
| 32 | * | ||
| 33 | * Describes how the ch7006 is wired up with the GPU. It should be | ||
| 34 | * used as the @params parameter of its @set_config method. | ||
| 35 | * | ||
| 36 | * See "http://www.chrontel.com/pdf/7006.pdf" for their precise | ||
| 37 | * meaning. | ||
| 38 | */ | ||
| 39 | struct ch7006_encoder_params { | ||
| 40 | enum { | ||
| 41 | CH7006_FORMAT_RGB16 = 0, | ||
| 42 | CH7006_FORMAT_YCrCb24m16, | ||
| 43 | CH7006_FORMAT_RGB24m16, | ||
| 44 | CH7006_FORMAT_RGB15, | ||
| 45 | CH7006_FORMAT_RGB24m12C, | ||
| 46 | CH7006_FORMAT_RGB24m12I, | ||
| 47 | CH7006_FORMAT_RGB24m8, | ||
| 48 | CH7006_FORMAT_RGB16m8, | ||
| 49 | CH7006_FORMAT_RGB15m8, | ||
| 50 | CH7006_FORMAT_YCrCb24m8, | ||
| 51 | } input_format; | ||
| 52 | |||
| 53 | enum { | ||
| 54 | CH7006_CLOCK_SLAVE = 0, | ||
| 55 | CH7006_CLOCK_MASTER, | ||
| 56 | } clock_mode; | ||
| 57 | |||
| 58 | enum { | ||
| 59 | CH7006_CLOCK_EDGE_NEG = 0, | ||
| 60 | CH7006_CLOCK_EDGE_POS, | ||
| 61 | } clock_edge; | ||
| 62 | |||
| 63 | int xcm, pcm; | ||
| 64 | |||
| 65 | enum { | ||
| 66 | CH7006_SYNC_SLAVE = 0, | ||
| 67 | CH7006_SYNC_MASTER, | ||
| 68 | } sync_direction; | ||
| 69 | |||
| 70 | enum { | ||
| 71 | CH7006_SYNC_SEPARATED = 0, | ||
| 72 | CH7006_SYNC_EMBEDDED, | ||
| 73 | } sync_encoding; | ||
| 74 | |||
| 75 | enum { | ||
| 76 | CH7006_POUT_1_8V = 0, | ||
| 77 | CH7006_POUT_3_3V, | ||
| 78 | } pout_level; | ||
| 79 | |||
| 80 | enum { | ||
| 81 | CH7006_ACTIVE_HSYNC = 0, | ||
| 82 | CH7006_ACTIVE_DSTART, | ||
| 83 | } active_detect; | ||
| 84 | }; | ||
| 85 | |||
| 86 | #endif | ||
diff --git a/include/drm/i915_drm.h b/include/drm/i915_drm.h index 7e0cb1da92e6..b64a8d7cdf6d 100644 --- a/include/drm/i915_drm.h +++ b/include/drm/i915_drm.h | |||
| @@ -27,11 +27,11 @@ | |||
| 27 | #ifndef _I915_DRM_H_ | 27 | #ifndef _I915_DRM_H_ |
| 28 | #define _I915_DRM_H_ | 28 | #define _I915_DRM_H_ |
| 29 | 29 | ||
| 30 | #include "drm.h" | ||
| 31 | |||
| 30 | /* Please note that modifications to all structs defined here are | 32 | /* Please note that modifications to all structs defined here are |
| 31 | * subject to backwards-compatibility constraints. | 33 | * subject to backwards-compatibility constraints. |
| 32 | */ | 34 | */ |
| 33 | #include <linux/types.h> | ||
| 34 | #include "drm.h" | ||
| 35 | 35 | ||
| 36 | /* Each region is a minimum of 16k, and there are at most 255 of them. | 36 | /* Each region is a minimum of 16k, and there are at most 255 of them. |
| 37 | */ | 37 | */ |
| @@ -186,6 +186,9 @@ typedef struct _drm_i915_sarea { | |||
| 186 | #define DRM_I915_GEM_MMAP_GTT 0x24 | 186 | #define DRM_I915_GEM_MMAP_GTT 0x24 |
| 187 | #define DRM_I915_GET_PIPE_FROM_CRTC_ID 0x25 | 187 | #define DRM_I915_GET_PIPE_FROM_CRTC_ID 0x25 |
| 188 | #define DRM_I915_GEM_MADVISE 0x26 | 188 | #define DRM_I915_GEM_MADVISE 0x26 |
| 189 | #define DRM_I915_OVERLAY_PUT_IMAGE 0x27 | ||
| 190 | #define DRM_I915_OVERLAY_ATTRS 0x28 | ||
| 191 | #define DRM_I915_GEM_EXECBUFFER2 0x29 | ||
| 189 | 192 | ||
| 190 | #define DRM_IOCTL_I915_INIT DRM_IOW( DRM_COMMAND_BASE + DRM_I915_INIT, drm_i915_init_t) | 193 | #define DRM_IOCTL_I915_INIT DRM_IOW( DRM_COMMAND_BASE + DRM_I915_INIT, drm_i915_init_t) |
| 191 | #define DRM_IOCTL_I915_FLUSH DRM_IO ( DRM_COMMAND_BASE + DRM_I915_FLUSH) | 194 | #define DRM_IOCTL_I915_FLUSH DRM_IO ( DRM_COMMAND_BASE + DRM_I915_FLUSH) |
| @@ -205,6 +208,7 @@ typedef struct _drm_i915_sarea { | |||
| 205 | #define DRM_IOCTL_I915_VBLANK_SWAP DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_VBLANK_SWAP, drm_i915_vblank_swap_t) | 208 | #define DRM_IOCTL_I915_VBLANK_SWAP DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_VBLANK_SWAP, drm_i915_vblank_swap_t) |
| 206 | #define DRM_IOCTL_I915_GEM_INIT DRM_IOW(DRM_COMMAND_BASE + DRM_I915_GEM_INIT, struct drm_i915_gem_init) | 209 | #define DRM_IOCTL_I915_GEM_INIT DRM_IOW(DRM_COMMAND_BASE + DRM_I915_GEM_INIT, struct drm_i915_gem_init) |
| 207 | #define DRM_IOCTL_I915_GEM_EXECBUFFER DRM_IOW(DRM_COMMAND_BASE + DRM_I915_GEM_EXECBUFFER, struct drm_i915_gem_execbuffer) | 210 | #define DRM_IOCTL_I915_GEM_EXECBUFFER DRM_IOW(DRM_COMMAND_BASE + DRM_I915_GEM_EXECBUFFER, struct drm_i915_gem_execbuffer) |
| 211 | #define DRM_IOCTL_I915_GEM_EXECBUFFER2 DRM_IOW(DRM_COMMAND_BASE + DRM_I915_GEM_EXECBUFFER2, struct drm_i915_gem_execbuffer2) | ||
| 208 | #define DRM_IOCTL_I915_GEM_PIN DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_PIN, struct drm_i915_gem_pin) | 212 | #define DRM_IOCTL_I915_GEM_PIN DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_PIN, struct drm_i915_gem_pin) |
| 209 | #define DRM_IOCTL_I915_GEM_UNPIN DRM_IOW(DRM_COMMAND_BASE + DRM_I915_GEM_UNPIN, struct drm_i915_gem_unpin) | 213 | #define DRM_IOCTL_I915_GEM_UNPIN DRM_IOW(DRM_COMMAND_BASE + DRM_I915_GEM_UNPIN, struct drm_i915_gem_unpin) |
| 210 | #define DRM_IOCTL_I915_GEM_BUSY DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_BUSY, struct drm_i915_gem_busy) | 214 | #define DRM_IOCTL_I915_GEM_BUSY DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_BUSY, struct drm_i915_gem_busy) |
| @@ -221,8 +225,10 @@ typedef struct _drm_i915_sarea { | |||
| 221 | #define DRM_IOCTL_I915_GEM_SET_TILING DRM_IOWR (DRM_COMMAND_BASE + DRM_I915_GEM_SET_TILING, struct drm_i915_gem_set_tiling) | 225 | #define DRM_IOCTL_I915_GEM_SET_TILING DRM_IOWR (DRM_COMMAND_BASE + DRM_I915_GEM_SET_TILING, struct drm_i915_gem_set_tiling) |
| 222 | #define DRM_IOCTL_I915_GEM_GET_TILING DRM_IOWR (DRM_COMMAND_BASE + DRM_I915_GEM_GET_TILING, struct drm_i915_gem_get_tiling) | 226 | #define DRM_IOCTL_I915_GEM_GET_TILING DRM_IOWR (DRM_COMMAND_BASE + DRM_I915_GEM_GET_TILING, struct drm_i915_gem_get_tiling) |
| 223 | #define DRM_IOCTL_I915_GEM_GET_APERTURE DRM_IOR (DRM_COMMAND_BASE + DRM_I915_GEM_GET_APERTURE, struct drm_i915_gem_get_aperture) | 227 | #define DRM_IOCTL_I915_GEM_GET_APERTURE DRM_IOR (DRM_COMMAND_BASE + DRM_I915_GEM_GET_APERTURE, struct drm_i915_gem_get_aperture) |
| 224 | #define DRM_IOCTL_I915_GET_PIPE_FROM_CRTC_ID DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GET_PIPE_FROM_CRTC_ID, struct drm_intel_get_pipe_from_crtc_id) | 228 | #define DRM_IOCTL_I915_GET_PIPE_FROM_CRTC_ID DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GET_PIPE_FROM_CRTC_ID, struct drm_i915_get_pipe_from_crtc_id) |
| 225 | #define DRM_IOCTL_I915_GEM_MADVISE DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_MADVISE, struct drm_i915_gem_madvise) | 229 | #define DRM_IOCTL_I915_GEM_MADVISE DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_MADVISE, struct drm_i915_gem_madvise) |
| 230 | #define DRM_IOCTL_I915_OVERLAY_PUT_IMAGE DRM_IOW(DRM_COMMAND_BASE + DRM_IOCTL_I915_OVERLAY_ATTRS, struct drm_intel_overlay_put_image) | ||
| 231 | #define DRM_IOCTL_I915_OVERLAY_ATTRS DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_OVERLAY_ATTRS, struct drm_intel_overlay_attrs) | ||
| 226 | 232 | ||
| 227 | /* Allow drivers to submit batchbuffers directly to hardware, relying | 233 | /* Allow drivers to submit batchbuffers directly to hardware, relying |
| 228 | * on the security mechanisms provided by hardware. | 234 | * on the security mechanisms provided by hardware. |
| @@ -266,6 +272,9 @@ typedef struct drm_i915_irq_wait { | |||
| 266 | #define I915_PARAM_CHIPSET_ID 4 | 272 | #define I915_PARAM_CHIPSET_ID 4 |
| 267 | #define I915_PARAM_HAS_GEM 5 | 273 | #define I915_PARAM_HAS_GEM 5 |
| 268 | #define I915_PARAM_NUM_FENCES_AVAIL 6 | 274 | #define I915_PARAM_NUM_FENCES_AVAIL 6 |
| 275 | #define I915_PARAM_HAS_OVERLAY 7 | ||
| 276 | #define I915_PARAM_HAS_PAGEFLIPPING 8 | ||
| 277 | #define I915_PARAM_HAS_EXECBUF2 9 | ||
| 269 | 278 | ||
| 270 | typedef struct drm_i915_getparam { | 279 | typedef struct drm_i915_getparam { |
| 271 | int param; | 280 | int param; |
| @@ -561,6 +570,57 @@ struct drm_i915_gem_execbuffer { | |||
| 561 | __u64 cliprects_ptr; | 570 | __u64 cliprects_ptr; |
| 562 | }; | 571 | }; |
| 563 | 572 | ||
| 573 | struct drm_i915_gem_exec_object2 { | ||
| 574 | /** | ||
| 575 | * User's handle for a buffer to be bound into the GTT for this | ||
| 576 | * operation. | ||
| 577 | */ | ||
| 578 | __u32 handle; | ||
| 579 | |||
| 580 | /** Number of relocations to be performed on this buffer */ | ||
| 581 | __u32 relocation_count; | ||
| 582 | /** | ||
| 583 | * Pointer to array of struct drm_i915_gem_relocation_entry containing | ||
| 584 | * the relocations to be performed in this buffer. | ||
| 585 | */ | ||
| 586 | __u64 relocs_ptr; | ||
| 587 | |||
| 588 | /** Required alignment in graphics aperture */ | ||
| 589 | __u64 alignment; | ||
| 590 | |||
| 591 | /** | ||
| 592 | * Returned value of the updated offset of the object, for future | ||
| 593 | * presumed_offset writes. | ||
| 594 | */ | ||
| 595 | __u64 offset; | ||
| 596 | |||
| 597 | #define EXEC_OBJECT_NEEDS_FENCE (1<<0) | ||
| 598 | __u64 flags; | ||
| 599 | __u64 rsvd1; | ||
| 600 | __u64 rsvd2; | ||
| 601 | }; | ||
| 602 | |||
| 603 | struct drm_i915_gem_execbuffer2 { | ||
| 604 | /** | ||
| 605 | * List of gem_exec_object2 structs | ||
| 606 | */ | ||
| 607 | __u64 buffers_ptr; | ||
| 608 | __u32 buffer_count; | ||
| 609 | |||
| 610 | /** Offset in the batchbuffer to start execution from. */ | ||
| 611 | __u32 batch_start_offset; | ||
| 612 | /** Bytes used in batchbuffer from batch_start_offset */ | ||
| 613 | __u32 batch_len; | ||
| 614 | __u32 DR1; | ||
| 615 | __u32 DR4; | ||
| 616 | __u32 num_cliprects; | ||
| 617 | /** This is a struct drm_clip_rect *cliprects */ | ||
| 618 | __u64 cliprects_ptr; | ||
| 619 | __u64 flags; /* currently unused */ | ||
| 620 | __u64 rsvd1; | ||
| 621 | __u64 rsvd2; | ||
| 622 | }; | ||
| 623 | |||
| 564 | struct drm_i915_gem_pin { | 624 | struct drm_i915_gem_pin { |
| 565 | /** Handle of the buffer to be pinned. */ | 625 | /** Handle of the buffer to be pinned. */ |
| 566 | __u32 handle; | 626 | __u32 handle; |
| @@ -686,4 +746,70 @@ struct drm_i915_gem_madvise { | |||
| 686 | __u32 retained; | 746 | __u32 retained; |
| 687 | }; | 747 | }; |
| 688 | 748 | ||
| 749 | /* flags */ | ||
| 750 | #define I915_OVERLAY_TYPE_MASK 0xff | ||
| 751 | #define I915_OVERLAY_YUV_PLANAR 0x01 | ||
| 752 | #define I915_OVERLAY_YUV_PACKED 0x02 | ||
| 753 | #define I915_OVERLAY_RGB 0x03 | ||
| 754 | |||
| 755 | #define I915_OVERLAY_DEPTH_MASK 0xff00 | ||
| 756 | #define I915_OVERLAY_RGB24 0x1000 | ||
| 757 | #define I915_OVERLAY_RGB16 0x2000 | ||
| 758 | #define I915_OVERLAY_RGB15 0x3000 | ||
| 759 | #define I915_OVERLAY_YUV422 0x0100 | ||
| 760 | #define I915_OVERLAY_YUV411 0x0200 | ||
| 761 | #define I915_OVERLAY_YUV420 0x0300 | ||
| 762 | #define I915_OVERLAY_YUV410 0x0400 | ||
| 763 | |||
| 764 | #define I915_OVERLAY_SWAP_MASK 0xff0000 | ||
| 765 | #define I915_OVERLAY_NO_SWAP 0x000000 | ||
| 766 | #define I915_OVERLAY_UV_SWAP 0x010000 | ||
| 767 | #define I915_OVERLAY_Y_SWAP 0x020000 | ||
| 768 | #define I915_OVERLAY_Y_AND_UV_SWAP 0x030000 | ||
| 769 | |||
| 770 | #define I915_OVERLAY_FLAGS_MASK 0xff000000 | ||
| 771 | #define I915_OVERLAY_ENABLE 0x01000000 | ||
| 772 | |||
| 773 | struct drm_intel_overlay_put_image { | ||
| 774 | /* various flags and src format description */ | ||
| 775 | __u32 flags; | ||
| 776 | /* source picture description */ | ||
| 777 | __u32 bo_handle; | ||
| 778 | /* stride values and offsets are in bytes, buffer relative */ | ||
| 779 | __u16 stride_Y; /* stride for packed formats */ | ||
| 780 | __u16 stride_UV; | ||
| 781 | __u32 offset_Y; /* offset for packet formats */ | ||
| 782 | __u32 offset_U; | ||
| 783 | __u32 offset_V; | ||
| 784 | /* in pixels */ | ||
| 785 | __u16 src_width; | ||
| 786 | __u16 src_height; | ||
| 787 | /* to compensate the scaling factors for partially covered surfaces */ | ||
| 788 | __u16 src_scan_width; | ||
| 789 | __u16 src_scan_height; | ||
| 790 | /* output crtc description */ | ||
| 791 | __u32 crtc_id; | ||
| 792 | __u16 dst_x; | ||
| 793 | __u16 dst_y; | ||
| 794 | __u16 dst_width; | ||
| 795 | __u16 dst_height; | ||
| 796 | }; | ||
| 797 | |||
| 798 | /* flags */ | ||
| 799 | #define I915_OVERLAY_UPDATE_ATTRS (1<<0) | ||
| 800 | #define I915_OVERLAY_UPDATE_GAMMA (1<<1) | ||
| 801 | struct drm_intel_overlay_attrs { | ||
| 802 | __u32 flags; | ||
| 803 | __u32 color_key; | ||
| 804 | __s32 brightness; | ||
| 805 | __u32 contrast; | ||
| 806 | __u32 saturation; | ||
| 807 | __u32 gamma0; | ||
| 808 | __u32 gamma1; | ||
| 809 | __u32 gamma2; | ||
| 810 | __u32 gamma3; | ||
| 811 | __u32 gamma4; | ||
| 812 | __u32 gamma5; | ||
| 813 | }; | ||
| 814 | |||
| 689 | #endif /* _I915_DRM_H_ */ | 815 | #endif /* _I915_DRM_H_ */ |
diff --git a/include/drm/mga_drm.h b/include/drm/mga_drm.h index 325fd6fb4a42..3ffbc4798afa 100644 --- a/include/drm/mga_drm.h +++ b/include/drm/mga_drm.h | |||
| @@ -35,7 +35,7 @@ | |||
| 35 | #ifndef __MGA_DRM_H__ | 35 | #ifndef __MGA_DRM_H__ |
| 36 | #define __MGA_DRM_H__ | 36 | #define __MGA_DRM_H__ |
| 37 | 37 | ||
| 38 | #include <linux/types.h> | 38 | #include "drm.h" |
| 39 | 39 | ||
| 40 | /* WARNING: If you change any of these defines, make sure to change the | 40 | /* WARNING: If you change any of these defines, make sure to change the |
| 41 | * defines in the Xserver file (mga_sarea.h) | 41 | * defines in the Xserver file (mga_sarea.h) |
diff --git a/include/drm/nouveau_drm.h b/include/drm/nouveau_drm.h new file mode 100644 index 000000000000..a6a9f4af5ebd --- /dev/null +++ b/include/drm/nouveau_drm.h | |||
| @@ -0,0 +1,199 @@ | |||
| 1 | /* | ||
| 2 | * Copyright 2005 Stephane Marchesin. | ||
| 3 | * All Rights Reserved. | ||
| 4 | * | ||
| 5 | * Permission is hereby granted, free of charge, to any person obtaining a | ||
| 6 | * copy of this software and associated documentation files (the "Software"), | ||
| 7 | * to deal in the Software without restriction, including without limitation | ||
| 8 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||
| 9 | * and/or sell copies of the Software, and to permit persons to whom the | ||
| 10 | * Software is furnished to do so, subject to the following conditions: | ||
| 11 | * | ||
| 12 | * The above copyright notice and this permission notice (including the next | ||
| 13 | * paragraph) shall be included in all copies or substantial portions of the | ||
| 14 | * Software. | ||
| 15 | * | ||
| 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
| 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | ||
| 19 | * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR | ||
| 20 | * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, | ||
| 21 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR | ||
| 22 | * OTHER DEALINGS IN THE SOFTWARE. | ||
| 23 | */ | ||
| 24 | |||
| 25 | #ifndef __NOUVEAU_DRM_H__ | ||
| 26 | #define __NOUVEAU_DRM_H__ | ||
| 27 | |||
| 28 | #define NOUVEAU_DRM_HEADER_PATCHLEVEL 16 | ||
| 29 | |||
| 30 | struct drm_nouveau_channel_alloc { | ||
| 31 | uint32_t fb_ctxdma_handle; | ||
| 32 | uint32_t tt_ctxdma_handle; | ||
| 33 | |||
| 34 | int channel; | ||
| 35 | uint32_t pushbuf_domains; | ||
| 36 | |||
| 37 | /* Notifier memory */ | ||
| 38 | uint32_t notifier_handle; | ||
| 39 | |||
| 40 | /* DRM-enforced subchannel assignments */ | ||
| 41 | struct { | ||
| 42 | uint32_t handle; | ||
| 43 | uint32_t grclass; | ||
| 44 | } subchan[8]; | ||
| 45 | uint32_t nr_subchan; | ||
| 46 | }; | ||
| 47 | |||
| 48 | struct drm_nouveau_channel_free { | ||
| 49 | int channel; | ||
| 50 | }; | ||
| 51 | |||
| 52 | struct drm_nouveau_grobj_alloc { | ||
| 53 | int channel; | ||
| 54 | uint32_t handle; | ||
| 55 | int class; | ||
| 56 | }; | ||
| 57 | |||
| 58 | struct drm_nouveau_notifierobj_alloc { | ||
| 59 | uint32_t channel; | ||
| 60 | uint32_t handle; | ||
| 61 | uint32_t size; | ||
| 62 | uint32_t offset; | ||
| 63 | }; | ||
| 64 | |||
| 65 | struct drm_nouveau_gpuobj_free { | ||
| 66 | int channel; | ||
| 67 | uint32_t handle; | ||
| 68 | }; | ||
| 69 | |||
| 70 | /* FIXME : maybe unify {GET,SET}PARAMs */ | ||
| 71 | #define NOUVEAU_GETPARAM_PCI_VENDOR 3 | ||
| 72 | #define NOUVEAU_GETPARAM_PCI_DEVICE 4 | ||
| 73 | #define NOUVEAU_GETPARAM_BUS_TYPE 5 | ||
| 74 | #define NOUVEAU_GETPARAM_FB_PHYSICAL 6 | ||
| 75 | #define NOUVEAU_GETPARAM_AGP_PHYSICAL 7 | ||
| 76 | #define NOUVEAU_GETPARAM_FB_SIZE 8 | ||
| 77 | #define NOUVEAU_GETPARAM_AGP_SIZE 9 | ||
| 78 | #define NOUVEAU_GETPARAM_PCI_PHYSICAL 10 | ||
| 79 | #define NOUVEAU_GETPARAM_CHIPSET_ID 11 | ||
| 80 | #define NOUVEAU_GETPARAM_VM_VRAM_BASE 12 | ||
| 81 | #define NOUVEAU_GETPARAM_GRAPH_UNITS 13 | ||
| 82 | struct drm_nouveau_getparam { | ||
| 83 | uint64_t param; | ||
| 84 | uint64_t value; | ||
| 85 | }; | ||
| 86 | |||
| 87 | struct drm_nouveau_setparam { | ||
| 88 | uint64_t param; | ||
| 89 | uint64_t value; | ||
| 90 | }; | ||
| 91 | |||
| 92 | #define NOUVEAU_GEM_DOMAIN_CPU (1 << 0) | ||
| 93 | #define NOUVEAU_GEM_DOMAIN_VRAM (1 << 1) | ||
| 94 | #define NOUVEAU_GEM_DOMAIN_GART (1 << 2) | ||
| 95 | #define NOUVEAU_GEM_DOMAIN_MAPPABLE (1 << 3) | ||
| 96 | |||
| 97 | struct drm_nouveau_gem_info { | ||
| 98 | uint32_t handle; | ||
| 99 | uint32_t domain; | ||
| 100 | uint64_t size; | ||
| 101 | uint64_t offset; | ||
| 102 | uint64_t map_handle; | ||
| 103 | uint32_t tile_mode; | ||
| 104 | uint32_t tile_flags; | ||
| 105 | }; | ||
| 106 | |||
| 107 | struct drm_nouveau_gem_new { | ||
| 108 | struct drm_nouveau_gem_info info; | ||
| 109 | uint32_t channel_hint; | ||
| 110 | uint32_t align; | ||
| 111 | }; | ||
| 112 | |||
| 113 | #define NOUVEAU_GEM_MAX_BUFFERS 1024 | ||
| 114 | struct drm_nouveau_gem_pushbuf_bo_presumed { | ||
| 115 | uint32_t valid; | ||
| 116 | uint32_t domain; | ||
| 117 | uint64_t offset; | ||
| 118 | }; | ||
| 119 | |||
| 120 | struct drm_nouveau_gem_pushbuf_bo { | ||
| 121 | uint64_t user_priv; | ||
| 122 | uint32_t handle; | ||
| 123 | uint32_t read_domains; | ||
| 124 | uint32_t write_domains; | ||
| 125 | uint32_t valid_domains; | ||
| 126 | struct drm_nouveau_gem_pushbuf_bo_presumed presumed; | ||
| 127 | }; | ||
| 128 | |||
| 129 | #define NOUVEAU_GEM_RELOC_LOW (1 << 0) | ||
| 130 | #define NOUVEAU_GEM_RELOC_HIGH (1 << 1) | ||
| 131 | #define NOUVEAU_GEM_RELOC_OR (1 << 2) | ||
| 132 | #define NOUVEAU_GEM_MAX_RELOCS 1024 | ||
| 133 | struct drm_nouveau_gem_pushbuf_reloc { | ||
| 134 | uint32_t reloc_bo_index; | ||
| 135 | uint32_t reloc_bo_offset; | ||
| 136 | uint32_t bo_index; | ||
| 137 | uint32_t flags; | ||
| 138 | uint32_t data; | ||
| 139 | uint32_t vor; | ||
| 140 | uint32_t tor; | ||
| 141 | }; | ||
| 142 | |||
| 143 | #define NOUVEAU_GEM_MAX_PUSH 512 | ||
| 144 | struct drm_nouveau_gem_pushbuf_push { | ||
| 145 | uint32_t bo_index; | ||
| 146 | uint32_t pad; | ||
| 147 | uint64_t offset; | ||
| 148 | uint64_t length; | ||
| 149 | }; | ||
| 150 | |||
| 151 | struct drm_nouveau_gem_pushbuf { | ||
| 152 | uint32_t channel; | ||
| 153 | uint32_t nr_buffers; | ||
| 154 | uint64_t buffers; | ||
| 155 | uint32_t nr_relocs; | ||
| 156 | uint32_t nr_push; | ||
| 157 | uint64_t relocs; | ||
| 158 | uint64_t push; | ||
| 159 | uint32_t suffix0; | ||
| 160 | uint32_t suffix1; | ||
| 161 | uint64_t vram_available; | ||
| 162 | uint64_t gart_available; | ||
| 163 | }; | ||
| 164 | |||
| 165 | #define NOUVEAU_GEM_CPU_PREP_NOWAIT 0x00000001 | ||
| 166 | #define NOUVEAU_GEM_CPU_PREP_NOBLOCK 0x00000002 | ||
| 167 | #define NOUVEAU_GEM_CPU_PREP_WRITE 0x00000004 | ||
| 168 | struct drm_nouveau_gem_cpu_prep { | ||
| 169 | uint32_t handle; | ||
| 170 | uint32_t flags; | ||
| 171 | }; | ||
| 172 | |||
| 173 | struct drm_nouveau_gem_cpu_fini { | ||
| 174 | uint32_t handle; | ||
| 175 | }; | ||
| 176 | |||
| 177 | enum nouveau_bus_type { | ||
| 178 | NV_AGP = 0, | ||
| 179 | NV_PCI = 1, | ||
| 180 | NV_PCIE = 2, | ||
| 181 | }; | ||
| 182 | |||
| 183 | struct drm_nouveau_sarea { | ||
| 184 | }; | ||
| 185 | |||
| 186 | #define DRM_NOUVEAU_GETPARAM 0x00 | ||
| 187 | #define DRM_NOUVEAU_SETPARAM 0x01 | ||
| 188 | #define DRM_NOUVEAU_CHANNEL_ALLOC 0x02 | ||
| 189 | #define DRM_NOUVEAU_CHANNEL_FREE 0x03 | ||
| 190 | #define DRM_NOUVEAU_GROBJ_ALLOC 0x04 | ||
| 191 | #define DRM_NOUVEAU_NOTIFIEROBJ_ALLOC 0x05 | ||
| 192 | #define DRM_NOUVEAU_GPUOBJ_FREE 0x06 | ||
| 193 | #define DRM_NOUVEAU_GEM_NEW 0x40 | ||
| 194 | #define DRM_NOUVEAU_GEM_PUSHBUF 0x41 | ||
| 195 | #define DRM_NOUVEAU_GEM_CPU_PREP 0x42 | ||
| 196 | #define DRM_NOUVEAU_GEM_CPU_FINI 0x43 | ||
| 197 | #define DRM_NOUVEAU_GEM_INFO 0x44 | ||
| 198 | |||
| 199 | #endif /* __NOUVEAU_DRM_H__ */ | ||
diff --git a/include/drm/radeon_drm.h b/include/drm/radeon_drm.h index 3b9932ab1756..81e614bf2dc3 100644 --- a/include/drm/radeon_drm.h +++ b/include/drm/radeon_drm.h | |||
| @@ -33,7 +33,7 @@ | |||
| 33 | #ifndef __RADEON_DRM_H__ | 33 | #ifndef __RADEON_DRM_H__ |
| 34 | #define __RADEON_DRM_H__ | 34 | #define __RADEON_DRM_H__ |
| 35 | 35 | ||
| 36 | #include <linux/types.h> | 36 | #include "drm.h" |
| 37 | 37 | ||
| 38 | /* WARNING: If you change any of these defines, make sure to change the | 38 | /* WARNING: If you change any of these defines, make sure to change the |
| 39 | * defines in the X server file (radeon_sarea.h) | 39 | * defines in the X server file (radeon_sarea.h) |
| @@ -808,6 +808,7 @@ struct drm_radeon_gem_create { | |||
| 808 | #define RADEON_TILING_SWAP_32BIT 0x8 | 808 | #define RADEON_TILING_SWAP_32BIT 0x8 |
| 809 | #define RADEON_TILING_SURFACE 0x10 /* this object requires a surface | 809 | #define RADEON_TILING_SURFACE 0x10 /* this object requires a surface |
| 810 | * when mapped - i.e. front buffer */ | 810 | * when mapped - i.e. front buffer */ |
| 811 | #define RADEON_TILING_MICRO_SQUARE 0x20 | ||
| 811 | 812 | ||
| 812 | struct drm_radeon_gem_set_tiling { | 813 | struct drm_radeon_gem_set_tiling { |
| 813 | uint32_t handle; | 814 | uint32_t handle; |
diff --git a/include/drm/ttm/ttm_bo_api.h b/include/drm/ttm/ttm_bo_api.h index 491146170522..81eb9f45883c 100644 --- a/include/drm/ttm/ttm_bo_api.h +++ b/include/drm/ttm/ttm_bo_api.h | |||
| @@ -44,6 +44,29 @@ struct ttm_bo_device; | |||
| 44 | 44 | ||
| 45 | struct drm_mm_node; | 45 | struct drm_mm_node; |
| 46 | 46 | ||
| 47 | |||
| 48 | /** | ||
| 49 | * struct ttm_placement | ||
| 50 | * | ||
| 51 | * @fpfn: first valid page frame number to put the object | ||
| 52 | * @lpfn: last valid page frame number to put the object | ||
| 53 | * @num_placement: number of prefered placements | ||
| 54 | * @placement: prefered placements | ||
| 55 | * @num_busy_placement: number of prefered placements when need to evict buffer | ||
| 56 | * @busy_placement: prefered placements when need to evict buffer | ||
| 57 | * | ||
| 58 | * Structure indicating the placement you request for an object. | ||
| 59 | */ | ||
| 60 | struct ttm_placement { | ||
| 61 | unsigned fpfn; | ||
| 62 | unsigned lpfn; | ||
| 63 | unsigned num_placement; | ||
| 64 | const uint32_t *placement; | ||
| 65 | unsigned num_busy_placement; | ||
| 66 | const uint32_t *busy_placement; | ||
| 67 | }; | ||
| 68 | |||
| 69 | |||
| 47 | /** | 70 | /** |
| 48 | * struct ttm_mem_reg | 71 | * struct ttm_mem_reg |
| 49 | * | 72 | * |
| @@ -109,10 +132,6 @@ struct ttm_tt; | |||
| 109 | * the object is destroyed. | 132 | * the object is destroyed. |
| 110 | * @event_queue: Queue for processes waiting on buffer object status change. | 133 | * @event_queue: Queue for processes waiting on buffer object status change. |
| 111 | * @lock: spinlock protecting mostly synchronization members. | 134 | * @lock: spinlock protecting mostly synchronization members. |
| 112 | * @proposed_placement: Proposed placement for the buffer. Changed only by the | ||
| 113 | * creator prior to validation as opposed to bo->mem.proposed_flags which is | ||
| 114 | * changed by the implementation prior to a buffer move if it wants to outsmart | ||
| 115 | * the buffer creator / user. This latter happens, for example, at eviction. | ||
| 116 | * @mem: structure describing current placement. | 135 | * @mem: structure describing current placement. |
| 117 | * @persistant_swap_storage: Usually the swap storage is deleted for buffers | 136 | * @persistant_swap_storage: Usually the swap storage is deleted for buffers |
| 118 | * pinned in physical memory. If this behaviour is not desired, this member | 137 | * pinned in physical memory. If this behaviour is not desired, this member |
| @@ -177,7 +196,6 @@ struct ttm_buffer_object { | |||
| 177 | * Members protected by the bo::reserved lock. | 196 | * Members protected by the bo::reserved lock. |
| 178 | */ | 197 | */ |
| 179 | 198 | ||
| 180 | uint32_t proposed_placement; | ||
| 181 | struct ttm_mem_reg mem; | 199 | struct ttm_mem_reg mem; |
| 182 | struct file *persistant_swap_storage; | 200 | struct file *persistant_swap_storage; |
| 183 | struct ttm_tt *ttm; | 201 | struct ttm_tt *ttm; |
| @@ -285,29 +303,30 @@ ttm_bo_reference(struct ttm_buffer_object *bo) | |||
| 285 | * Note: It might be necessary to block validations before the | 303 | * Note: It might be necessary to block validations before the |
| 286 | * wait by reserving the buffer. | 304 | * wait by reserving the buffer. |
| 287 | * Returns -EBUSY if no_wait is true and the buffer is busy. | 305 | * Returns -EBUSY if no_wait is true and the buffer is busy. |
| 288 | * Returns -ERESTART if interrupted by a signal. | 306 | * Returns -ERESTARTSYS if interrupted by a signal. |
| 289 | */ | 307 | */ |
| 290 | extern int ttm_bo_wait(struct ttm_buffer_object *bo, bool lazy, | 308 | extern int ttm_bo_wait(struct ttm_buffer_object *bo, bool lazy, |
| 291 | bool interruptible, bool no_wait); | 309 | bool interruptible, bool no_wait); |
| 292 | /** | 310 | /** |
| 293 | * ttm_buffer_object_validate | 311 | * ttm_bo_validate |
| 294 | * | 312 | * |
| 295 | * @bo: The buffer object. | 313 | * @bo: The buffer object. |
| 296 | * @proposed_placement: Proposed_placement for the buffer object. | 314 | * @placement: Proposed placement for the buffer object. |
| 297 | * @interruptible: Sleep interruptible if sleeping. | 315 | * @interruptible: Sleep interruptible if sleeping. |
| 298 | * @no_wait: Return immediately if the buffer is busy. | 316 | * @no_wait: Return immediately if the buffer is busy. |
| 299 | * | 317 | * |
| 300 | * Changes placement and caching policy of the buffer object | 318 | * Changes placement and caching policy of the buffer object |
| 301 | * according to bo::proposed_flags. | 319 | * according proposed placement. |
| 302 | * Returns | 320 | * Returns |
| 303 | * -EINVAL on invalid proposed_flags. | 321 | * -EINVAL on invalid proposed placement. |
| 304 | * -ENOMEM on out-of-memory condition. | 322 | * -ENOMEM on out-of-memory condition. |
| 305 | * -EBUSY if no_wait is true and buffer busy. | 323 | * -EBUSY if no_wait is true and buffer busy. |
| 306 | * -ERESTART if interrupted by a signal. | 324 | * -ERESTARTSYS if interrupted by a signal. |
| 307 | */ | 325 | */ |
| 308 | extern int ttm_buffer_object_validate(struct ttm_buffer_object *bo, | 326 | extern int ttm_bo_validate(struct ttm_buffer_object *bo, |
| 309 | uint32_t proposed_placement, | 327 | struct ttm_placement *placement, |
| 310 | bool interruptible, bool no_wait); | 328 | bool interruptible, bool no_wait); |
| 329 | |||
| 311 | /** | 330 | /** |
| 312 | * ttm_bo_unref | 331 | * ttm_bo_unref |
| 313 | * | 332 | * |
| @@ -328,7 +347,7 @@ extern void ttm_bo_unref(struct ttm_buffer_object **bo); | |||
| 328 | * waiting for buffer idle. This lock is recursive. | 347 | * waiting for buffer idle. This lock is recursive. |
| 329 | * Returns | 348 | * Returns |
| 330 | * -EBUSY if the buffer is busy and no_wait is true. | 349 | * -EBUSY if the buffer is busy and no_wait is true. |
| 331 | * -ERESTART if interrupted by a signal. | 350 | * -ERESTARTSYS if interrupted by a signal. |
| 332 | */ | 351 | */ |
| 333 | 352 | ||
| 334 | extern int | 353 | extern int |
| @@ -343,7 +362,7 @@ ttm_bo_synccpu_write_grab(struct ttm_buffer_object *bo, bool no_wait); | |||
| 343 | extern void ttm_bo_synccpu_write_release(struct ttm_buffer_object *bo); | 362 | extern void ttm_bo_synccpu_write_release(struct ttm_buffer_object *bo); |
| 344 | 363 | ||
| 345 | /** | 364 | /** |
| 346 | * ttm_buffer_object_init | 365 | * ttm_bo_init |
| 347 | * | 366 | * |
| 348 | * @bdev: Pointer to a ttm_bo_device struct. | 367 | * @bdev: Pointer to a ttm_bo_device struct. |
| 349 | * @bo: Pointer to a ttm_buffer_object to be initialized. | 368 | * @bo: Pointer to a ttm_buffer_object to be initialized. |
| @@ -371,20 +390,20 @@ extern void ttm_bo_synccpu_write_release(struct ttm_buffer_object *bo); | |||
| 371 | * Returns | 390 | * Returns |
| 372 | * -ENOMEM: Out of memory. | 391 | * -ENOMEM: Out of memory. |
| 373 | * -EINVAL: Invalid placement flags. | 392 | * -EINVAL: Invalid placement flags. |
| 374 | * -ERESTART: Interrupted by signal while sleeping waiting for resources. | 393 | * -ERESTARTSYS: Interrupted by signal while sleeping waiting for resources. |
| 375 | */ | 394 | */ |
| 376 | 395 | ||
| 377 | extern int ttm_buffer_object_init(struct ttm_bo_device *bdev, | 396 | extern int ttm_bo_init(struct ttm_bo_device *bdev, |
| 378 | struct ttm_buffer_object *bo, | 397 | struct ttm_buffer_object *bo, |
| 379 | unsigned long size, | 398 | unsigned long size, |
| 380 | enum ttm_bo_type type, | 399 | enum ttm_bo_type type, |
| 381 | uint32_t flags, | 400 | struct ttm_placement *placement, |
| 382 | uint32_t page_alignment, | 401 | uint32_t page_alignment, |
| 383 | unsigned long buffer_start, | 402 | unsigned long buffer_start, |
| 384 | bool interrubtible, | 403 | bool interrubtible, |
| 385 | struct file *persistant_swap_storage, | 404 | struct file *persistant_swap_storage, |
| 386 | size_t acc_size, | 405 | size_t acc_size, |
| 387 | void (*destroy) (struct ttm_buffer_object *)); | 406 | void (*destroy) (struct ttm_buffer_object *)); |
| 388 | /** | 407 | /** |
| 389 | * ttm_bo_synccpu_object_init | 408 | * ttm_bo_synccpu_object_init |
| 390 | * | 409 | * |
| @@ -405,47 +424,43 @@ extern int ttm_buffer_object_init(struct ttm_bo_device *bdev, | |||
| 405 | * GEM user interface. | 424 | * GEM user interface. |
| 406 | * @p_bo: On successful completion *p_bo points to the created object. | 425 | * @p_bo: On successful completion *p_bo points to the created object. |
| 407 | * | 426 | * |
| 408 | * This function allocates a ttm_buffer_object, and then calls | 427 | * This function allocates a ttm_buffer_object, and then calls ttm_bo_init |
| 409 | * ttm_buffer_object_init on that object. | 428 | * on that object. The destroy function is set to kfree(). |
| 410 | * The destroy function is set to kfree(). | ||
| 411 | * Returns | 429 | * Returns |
| 412 | * -ENOMEM: Out of memory. | 430 | * -ENOMEM: Out of memory. |
| 413 | * -EINVAL: Invalid placement flags. | 431 | * -EINVAL: Invalid placement flags. |
| 414 | * -ERESTART: Interrupted by signal while waiting for resources. | 432 | * -ERESTARTSYS: Interrupted by signal while waiting for resources. |
| 415 | */ | 433 | */ |
| 416 | 434 | ||
| 417 | extern int ttm_buffer_object_create(struct ttm_bo_device *bdev, | 435 | extern int ttm_bo_create(struct ttm_bo_device *bdev, |
| 418 | unsigned long size, | 436 | unsigned long size, |
| 419 | enum ttm_bo_type type, | 437 | enum ttm_bo_type type, |
| 420 | uint32_t flags, | 438 | struct ttm_placement *placement, |
| 421 | uint32_t page_alignment, | 439 | uint32_t page_alignment, |
| 422 | unsigned long buffer_start, | 440 | unsigned long buffer_start, |
| 423 | bool interruptible, | 441 | bool interruptible, |
| 424 | struct file *persistant_swap_storage, | 442 | struct file *persistant_swap_storage, |
| 425 | struct ttm_buffer_object **p_bo); | 443 | struct ttm_buffer_object **p_bo); |
| 426 | 444 | ||
| 427 | /** | 445 | /** |
| 428 | * ttm_bo_check_placement | 446 | * ttm_bo_check_placement |
| 429 | * | 447 | * |
| 430 | * @bo: the buffer object. | 448 | * @bo: the buffer object. |
| 431 | * @set_flags: placement flags to set. | 449 | * @placement: placements |
| 432 | * @clr_flags: placement flags to clear. | ||
| 433 | * | 450 | * |
| 434 | * Performs minimal validity checking on an intended change of | 451 | * Performs minimal validity checking on an intended change of |
| 435 | * placement flags. | 452 | * placement flags. |
| 436 | * Returns | 453 | * Returns |
| 437 | * -EINVAL: Intended change is invalid or not allowed. | 454 | * -EINVAL: Intended change is invalid or not allowed. |
| 438 | */ | 455 | */ |
| 439 | |||
| 440 | extern int ttm_bo_check_placement(struct ttm_buffer_object *bo, | 456 | extern int ttm_bo_check_placement(struct ttm_buffer_object *bo, |
| 441 | uint32_t set_flags, uint32_t clr_flags); | 457 | struct ttm_placement *placement); |
| 442 | 458 | ||
| 443 | /** | 459 | /** |
| 444 | * ttm_bo_init_mm | 460 | * ttm_bo_init_mm |
| 445 | * | 461 | * |
| 446 | * @bdev: Pointer to a ttm_bo_device struct. | 462 | * @bdev: Pointer to a ttm_bo_device struct. |
| 447 | * @mem_type: The memory type. | 463 | * @mem_type: The memory type. |
| 448 | * @p_offset: offset for managed area in pages. | ||
| 449 | * @p_size: size managed area in pages. | 464 | * @p_size: size managed area in pages. |
| 450 | * | 465 | * |
| 451 | * Initialize a manager for a given memory type. | 466 | * Initialize a manager for a given memory type. |
| @@ -458,7 +473,7 @@ extern int ttm_bo_check_placement(struct ttm_buffer_object *bo, | |||
| 458 | */ | 473 | */ |
| 459 | 474 | ||
| 460 | extern int ttm_bo_init_mm(struct ttm_bo_device *bdev, unsigned type, | 475 | extern int ttm_bo_init_mm(struct ttm_bo_device *bdev, unsigned type, |
| 461 | unsigned long p_offset, unsigned long p_size); | 476 | unsigned long p_size); |
| 462 | /** | 477 | /** |
| 463 | * ttm_bo_clean_mm | 478 | * ttm_bo_clean_mm |
| 464 | * | 479 | * |
| @@ -503,7 +518,7 @@ extern int ttm_bo_clean_mm(struct ttm_bo_device *bdev, unsigned mem_type); | |||
| 503 | * | 518 | * |
| 504 | * Returns: | 519 | * Returns: |
| 505 | * -EINVAL: Invalid or uninitialized memory type. | 520 | * -EINVAL: Invalid or uninitialized memory type. |
| 506 | * -ERESTART: The call was interrupted by a signal while waiting to | 521 | * -ERESTARTSYS: The call was interrupted by a signal while waiting to |
| 507 | * evict a buffer. | 522 | * evict a buffer. |
| 508 | */ | 523 | */ |
| 509 | 524 | ||
| @@ -606,7 +621,7 @@ extern int ttm_bo_mmap(struct file *filp, struct vm_area_struct *vma, | |||
| 606 | * be called from the fops::read and fops::write method. | 621 | * be called from the fops::read and fops::write method. |
| 607 | * Returns: | 622 | * Returns: |
| 608 | * See man (2) write, man(2) read. In particular, | 623 | * See man (2) write, man(2) read. In particular, |
| 609 | * the function may return -EINTR if | 624 | * the function may return -ERESTARTSYS if |
| 610 | * interrupted by a signal. | 625 | * interrupted by a signal. |
| 611 | */ | 626 | */ |
| 612 | 627 | ||
diff --git a/include/drm/ttm/ttm_bo_driver.h b/include/drm/ttm/ttm_bo_driver.h index e8cd6d20aed2..6b9db917e717 100644 --- a/include/drm/ttm/ttm_bo_driver.h +++ b/include/drm/ttm/ttm_bo_driver.h | |||
| @@ -115,7 +115,6 @@ struct ttm_backend { | |||
| 115 | struct ttm_backend_func *func; | 115 | struct ttm_backend_func *func; |
| 116 | }; | 116 | }; |
| 117 | 117 | ||
| 118 | #define TTM_PAGE_FLAG_VMALLOC (1 << 0) | ||
| 119 | #define TTM_PAGE_FLAG_USER (1 << 1) | 118 | #define TTM_PAGE_FLAG_USER (1 << 1) |
| 120 | #define TTM_PAGE_FLAG_USER_DIRTY (1 << 2) | 119 | #define TTM_PAGE_FLAG_USER_DIRTY (1 << 2) |
| 121 | #define TTM_PAGE_FLAG_WRITE (1 << 3) | 120 | #define TTM_PAGE_FLAG_WRITE (1 << 3) |
| @@ -242,12 +241,6 @@ struct ttm_mem_type_manager { | |||
| 242 | /** | 241 | /** |
| 243 | * struct ttm_bo_driver | 242 | * struct ttm_bo_driver |
| 244 | * | 243 | * |
| 245 | * @mem_type_prio: Priority array of memory types to place a buffer object in | ||
| 246 | * if it fits without evicting buffers from any of these memory types. | ||
| 247 | * @mem_busy_prio: Priority array of memory types to place a buffer object in | ||
| 248 | * if it needs to evict buffers to make room. | ||
| 249 | * @num_mem_type_prio: Number of elements in the @mem_type_prio array. | ||
| 250 | * @num_mem_busy_prio: Number of elements in the @num_mem_busy_prio array. | ||
| 251 | * @create_ttm_backend_entry: Callback to create a struct ttm_backend. | 244 | * @create_ttm_backend_entry: Callback to create a struct ttm_backend. |
| 252 | * @invalidate_caches: Callback to invalidate read caches when a buffer object | 245 | * @invalidate_caches: Callback to invalidate read caches when a buffer object |
| 253 | * has been evicted. | 246 | * has been evicted. |
| @@ -265,11 +258,6 @@ struct ttm_mem_type_manager { | |||
| 265 | */ | 258 | */ |
| 266 | 259 | ||
| 267 | struct ttm_bo_driver { | 260 | struct ttm_bo_driver { |
| 268 | const uint32_t *mem_type_prio; | ||
| 269 | const uint32_t *mem_busy_prio; | ||
| 270 | uint32_t num_mem_type_prio; | ||
| 271 | uint32_t num_mem_busy_prio; | ||
| 272 | |||
| 273 | /** | 261 | /** |
| 274 | * struct ttm_bo_driver member create_ttm_backend_entry | 262 | * struct ttm_bo_driver member create_ttm_backend_entry |
| 275 | * | 263 | * |
| @@ -306,7 +294,8 @@ struct ttm_bo_driver { | |||
| 306 | * finished, they'll end up in bo->mem.flags | 294 | * finished, they'll end up in bo->mem.flags |
| 307 | */ | 295 | */ |
| 308 | 296 | ||
| 309 | uint32_t(*evict_flags) (struct ttm_buffer_object *bo); | 297 | void(*evict_flags) (struct ttm_buffer_object *bo, |
| 298 | struct ttm_placement *placement); | ||
| 310 | /** | 299 | /** |
| 311 | * struct ttm_bo_driver member move: | 300 | * struct ttm_bo_driver member move: |
| 312 | * | 301 | * |
| @@ -363,6 +352,11 @@ struct ttm_bo_driver { | |||
| 363 | /* notify the driver we are taking a fault on this BO | 352 | /* notify the driver we are taking a fault on this BO |
| 364 | * and have reserved it */ | 353 | * and have reserved it */ |
| 365 | void (*fault_reserve_notify)(struct ttm_buffer_object *bo); | 354 | void (*fault_reserve_notify)(struct ttm_buffer_object *bo); |
| 355 | |||
| 356 | /** | ||
| 357 | * notify the driver that we're about to swap out this bo | ||
| 358 | */ | ||
| 359 | void (*swap_notify) (struct ttm_buffer_object *bo); | ||
| 366 | }; | 360 | }; |
| 367 | 361 | ||
| 368 | /** | 362 | /** |
| @@ -545,6 +539,15 @@ extern int ttm_tt_set_user(struct ttm_tt *ttm, | |||
| 545 | extern int ttm_tt_bind(struct ttm_tt *ttm, struct ttm_mem_reg *bo_mem); | 539 | extern int ttm_tt_bind(struct ttm_tt *ttm, struct ttm_mem_reg *bo_mem); |
| 546 | 540 | ||
| 547 | /** | 541 | /** |
| 542 | * ttm_tt_populate: | ||
| 543 | * | ||
| 544 | * @ttm: The struct ttm_tt to contain the backing pages. | ||
| 545 | * | ||
| 546 | * Add backing pages to all of @ttm | ||
| 547 | */ | ||
| 548 | extern int ttm_tt_populate(struct ttm_tt *ttm); | ||
| 549 | |||
| 550 | /** | ||
| 548 | * ttm_ttm_destroy: | 551 | * ttm_ttm_destroy: |
| 549 | * | 552 | * |
| 550 | * @ttm: The struct ttm_tt. | 553 | * @ttm: The struct ttm_tt. |
| @@ -639,12 +642,12 @@ extern bool ttm_mem_reg_is_pci(struct ttm_bo_device *bdev, | |||
| 639 | * -EBUSY: No space available (only if no_wait == 1). | 642 | * -EBUSY: No space available (only if no_wait == 1). |
| 640 | * -ENOMEM: Could not allocate memory for the buffer object, either due to | 643 | * -ENOMEM: Could not allocate memory for the buffer object, either due to |
| 641 | * fragmentation or concurrent allocators. | 644 | * fragmentation or concurrent allocators. |
| 642 | * -ERESTART: An interruptible sleep was interrupted by a signal. | 645 | * -ERESTARTSYS: An interruptible sleep was interrupted by a signal. |
| 643 | */ | 646 | */ |
| 644 | extern int ttm_bo_mem_space(struct ttm_buffer_object *bo, | 647 | extern int ttm_bo_mem_space(struct ttm_buffer_object *bo, |
| 645 | uint32_t proposed_placement, | 648 | struct ttm_placement *placement, |
| 646 | struct ttm_mem_reg *mem, | 649 | struct ttm_mem_reg *mem, |
| 647 | bool interruptible, bool no_wait); | 650 | bool interruptible, bool no_wait); |
| 648 | /** | 651 | /** |
| 649 | * ttm_bo_wait_for_cpu | 652 | * ttm_bo_wait_for_cpu |
| 650 | * | 653 | * |
| @@ -654,7 +657,7 @@ extern int ttm_bo_mem_space(struct ttm_buffer_object *bo, | |||
| 654 | * Wait until a buffer object is no longer sync'ed for CPU access. | 657 | * Wait until a buffer object is no longer sync'ed for CPU access. |
| 655 | * Returns: | 658 | * Returns: |
| 656 | * -EBUSY: Buffer object was sync'ed for CPU access. (only if no_wait == 1). | 659 | * -EBUSY: Buffer object was sync'ed for CPU access. (only if no_wait == 1). |
| 657 | * -ERESTART: An interruptible sleep was interrupted by a signal. | 660 | * -ERESTARTSYS: An interruptible sleep was interrupted by a signal. |
| 658 | */ | 661 | */ |
| 659 | 662 | ||
| 660 | extern int ttm_bo_wait_cpu(struct ttm_buffer_object *bo, bool no_wait); | 663 | extern int ttm_bo_wait_cpu(struct ttm_buffer_object *bo, bool no_wait); |
| @@ -758,7 +761,7 @@ extern void ttm_bo_unmap_virtual(struct ttm_buffer_object *bo); | |||
| 758 | * -EAGAIN: The reservation may cause a deadlock. | 761 | * -EAGAIN: The reservation may cause a deadlock. |
| 759 | * Release all buffer reservations, wait for @bo to become unreserved and | 762 | * Release all buffer reservations, wait for @bo to become unreserved and |
| 760 | * try again. (only if use_sequence == 1). | 763 | * try again. (only if use_sequence == 1). |
| 761 | * -ERESTART: A wait for the buffer to become unreserved was interrupted by | 764 | * -ERESTARTSYS: A wait for the buffer to become unreserved was interrupted by |
| 762 | * a signal. Release all buffer reservations and return to user-space. | 765 | * a signal. Release all buffer reservations and return to user-space. |
| 763 | */ | 766 | */ |
| 764 | extern int ttm_bo_reserve(struct ttm_buffer_object *bo, | 767 | extern int ttm_bo_reserve(struct ttm_buffer_object *bo, |
| @@ -786,34 +789,6 @@ extern void ttm_bo_unreserve(struct ttm_buffer_object *bo); | |||
| 786 | extern int ttm_bo_wait_unreserved(struct ttm_buffer_object *bo, | 789 | extern int ttm_bo_wait_unreserved(struct ttm_buffer_object *bo, |
| 787 | bool interruptible); | 790 | bool interruptible); |
| 788 | 791 | ||
| 789 | /** | ||
| 790 | * ttm_bo_block_reservation | ||
| 791 | * | ||
| 792 | * @bo: A pointer to a struct ttm_buffer_object. | ||
| 793 | * @interruptible: Use interruptible sleep when waiting. | ||
| 794 | * @no_wait: Don't sleep, but rather return -EBUSY. | ||
| 795 | * | ||
| 796 | * Block reservation for validation by simply reserving the buffer. | ||
| 797 | * This is intended for single buffer use only without eviction, | ||
| 798 | * and thus needs no deadlock protection. | ||
| 799 | * | ||
| 800 | * Returns: | ||
| 801 | * -EBUSY: If no_wait == 1 and the buffer is already reserved. | ||
| 802 | * -ERESTART: If interruptible == 1 and the process received a signal | ||
| 803 | * while sleeping. | ||
| 804 | */ | ||
| 805 | extern int ttm_bo_block_reservation(struct ttm_buffer_object *bo, | ||
| 806 | bool interruptible, bool no_wait); | ||
| 807 | |||
| 808 | /** | ||
| 809 | * ttm_bo_unblock_reservation | ||
| 810 | * | ||
| 811 | * @bo: A pointer to a struct ttm_buffer_object. | ||
| 812 | * | ||
| 813 | * Unblocks reservation leaving lru lists untouched. | ||
| 814 | */ | ||
| 815 | extern void ttm_bo_unblock_reservation(struct ttm_buffer_object *bo); | ||
| 816 | |||
| 817 | /* | 792 | /* |
| 818 | * ttm_bo_util.c | 793 | * ttm_bo_util.c |
| 819 | */ | 794 | */ |
| @@ -904,7 +879,7 @@ extern int ttm_bo_move_accel_cleanup(struct ttm_buffer_object *bo, | |||
| 904 | * Utility function that returns the pgprot_t that should be used for | 879 | * Utility function that returns the pgprot_t that should be used for |
| 905 | * setting up a PTE with the caching model indicated by @c_state. | 880 | * setting up a PTE with the caching model indicated by @c_state. |
| 906 | */ | 881 | */ |
| 907 | extern pgprot_t ttm_io_prot(enum ttm_caching_state c_state, pgprot_t tmp); | 882 | extern pgprot_t ttm_io_prot(uint32_t caching_flags, pgprot_t tmp); |
| 908 | 883 | ||
| 909 | #if (defined(CONFIG_AGP) || (defined(CONFIG_AGP_MODULE) && defined(MODULE))) | 884 | #if (defined(CONFIG_AGP) || (defined(CONFIG_AGP_MODULE) && defined(MODULE))) |
| 910 | #define TTM_HAS_AGP | 885 | #define TTM_HAS_AGP |
diff --git a/include/drm/ttm/ttm_execbuf_util.h b/include/drm/ttm/ttm_execbuf_util.h new file mode 100644 index 000000000000..cd2c475da9ea --- /dev/null +++ b/include/drm/ttm/ttm_execbuf_util.h | |||
| @@ -0,0 +1,107 @@ | |||
| 1 | /************************************************************************** | ||
| 2 | * | ||
| 3 | * Copyright (c) 2006-2009 VMware, Inc., Palo Alto, CA., USA | ||
| 4 | * All Rights Reserved. | ||
| 5 | * | ||
| 6 | * Permission is hereby granted, free of charge, to any person obtaining a | ||
| 7 | * copy of this software and associated documentation files (the | ||
| 8 | * "Software"), to deal in the Software without restriction, including | ||
| 9 | * without limitation the rights to use, copy, modify, merge, publish, | ||
| 10 | * distribute, sub license, and/or sell copies of the Software, and to | ||
| 11 | * permit persons to whom the Software is furnished to do so, subject to | ||
| 12 | * the following conditions: | ||
| 13 | * | ||
| 14 | * The above copyright notice and this permission notice (including the | ||
| 15 | * next paragraph) shall be included in all copies or substantial portions | ||
| 16 | * of the Software. | ||
| 17 | * | ||
| 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| 19 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
| 20 | * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL | ||
| 21 | * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, | ||
| 22 | * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR | ||
| 23 | * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE | ||
| 24 | * USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
| 25 | * | ||
| 26 | **************************************************************************/ | ||
| 27 | /* | ||
| 28 | * Authors: Thomas Hellstrom <thellstrom-at-vmware-dot-com> | ||
| 29 | */ | ||
| 30 | |||
| 31 | #ifndef _TTM_EXECBUF_UTIL_H_ | ||
| 32 | #define _TTM_EXECBUF_UTIL_H_ | ||
| 33 | |||
| 34 | #include "ttm/ttm_bo_api.h" | ||
| 35 | #include <linux/list.h> | ||
| 36 | |||
| 37 | /** | ||
| 38 | * struct ttm_validate_buffer | ||
| 39 | * | ||
| 40 | * @head: list head for thread-private list. | ||
| 41 | * @bo: refcounted buffer object pointer. | ||
| 42 | * @new_sync_obj_arg: New sync_obj_arg for @bo, to be used once | ||
| 43 | * adding a new sync object. | ||
| 44 | * @reservied: Indicates whether @bo has been reserved for validation. | ||
| 45 | */ | ||
| 46 | |||
| 47 | struct ttm_validate_buffer { | ||
| 48 | struct list_head head; | ||
| 49 | struct ttm_buffer_object *bo; | ||
| 50 | void *new_sync_obj_arg; | ||
| 51 | bool reserved; | ||
| 52 | }; | ||
| 53 | |||
| 54 | /** | ||
| 55 | * function ttm_eu_backoff_reservation | ||
| 56 | * | ||
| 57 | * @list: thread private list of ttm_validate_buffer structs. | ||
| 58 | * | ||
| 59 | * Undoes all buffer validation reservations for bos pointed to by | ||
| 60 | * the list entries. | ||
| 61 | */ | ||
| 62 | |||
| 63 | extern void ttm_eu_backoff_reservation(struct list_head *list); | ||
| 64 | |||
| 65 | /** | ||
| 66 | * function ttm_eu_reserve_buffers | ||
| 67 | * | ||
| 68 | * @list: thread private list of ttm_validate_buffer structs. | ||
| 69 | * @val_seq: A unique sequence number. | ||
| 70 | * | ||
| 71 | * Tries to reserve bos pointed to by the list entries for validation. | ||
| 72 | * If the function returns 0, all buffers are marked as "unfenced", | ||
| 73 | * taken off the lru lists and are not synced for write CPU usage. | ||
| 74 | * | ||
| 75 | * If the function detects a deadlock due to multiple threads trying to | ||
| 76 | * reserve the same buffers in reverse order, all threads except one will | ||
| 77 | * back off and retry. This function may sleep while waiting for | ||
| 78 | * CPU write reservations to be cleared, and for other threads to | ||
| 79 | * unreserve their buffers. | ||
| 80 | * | ||
| 81 | * This function may return -ERESTART or -EAGAIN if the calling process | ||
| 82 | * receives a signal while waiting. In that case, no buffers on the list | ||
| 83 | * will be reserved upon return. | ||
| 84 | * | ||
| 85 | * Buffers reserved by this function should be unreserved by | ||
| 86 | * a call to either ttm_eu_backoff_reservation() or | ||
| 87 | * ttm_eu_fence_buffer_objects() when command submission is complete or | ||
| 88 | * has failed. | ||
| 89 | */ | ||
| 90 | |||
| 91 | extern int ttm_eu_reserve_buffers(struct list_head *list, uint32_t val_seq); | ||
| 92 | |||
| 93 | /** | ||
| 94 | * function ttm_eu_fence_buffer_objects. | ||
| 95 | * | ||
| 96 | * @list: thread private list of ttm_validate_buffer structs. | ||
| 97 | * @sync_obj: The new sync object for the buffers. | ||
| 98 | * | ||
| 99 | * This function should be called when command submission is complete, and | ||
| 100 | * it will add a new sync object to bos pointed to by entries on @list. | ||
| 101 | * It also unreserves all buffers, putting them on lru lists. | ||
| 102 | * | ||
| 103 | */ | ||
| 104 | |||
| 105 | extern void ttm_eu_fence_buffer_objects(struct list_head *list, void *sync_obj); | ||
| 106 | |||
| 107 | #endif | ||
diff --git a/include/drm/ttm/ttm_lock.h b/include/drm/ttm/ttm_lock.h new file mode 100644 index 000000000000..81ba0b0b891a --- /dev/null +++ b/include/drm/ttm/ttm_lock.h | |||
| @@ -0,0 +1,247 @@ | |||
| 1 | /************************************************************************** | ||
| 2 | * | ||
| 3 | * Copyright (c) 2007-2009 VMware, Inc., Palo Alto, CA., USA | ||
| 4 | * All Rights Reserved. | ||
| 5 | * | ||
| 6 | * Permission is hereby granted, free of charge, to any person obtaining a | ||
| 7 | * copy of this software and associated documentation files (the | ||
| 8 | * "Software"), to deal in the Software without restriction, including | ||
| 9 | * without limitation the rights to use, copy, modify, merge, publish, | ||
| 10 | * distribute, sub license, and/or sell copies of the Software, and to | ||
| 11 | * permit persons to whom the Software is furnished to do so, subject to | ||
| 12 | * the following conditions: | ||
| 13 | * | ||
| 14 | * The above copyright notice and this permission notice (including the | ||
| 15 | * next paragraph) shall be included in all copies or substantial portions | ||
| 16 | * of the Software. | ||
| 17 | * | ||
| 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| 19 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
| 20 | * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL | ||
| 21 | * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, | ||
| 22 | * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR | ||
| 23 | * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE | ||
| 24 | * USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
| 25 | * | ||
| 26 | **************************************************************************/ | ||
| 27 | /* | ||
| 28 | * Authors: Thomas Hellstrom <thellstrom-at-vmware-dot-com> | ||
| 29 | */ | ||
| 30 | |||
| 31 | /** @file ttm_lock.h | ||
| 32 | * This file implements a simple replacement for the buffer manager use | ||
| 33 | * of the DRM heavyweight hardware lock. | ||
| 34 | * The lock is a read-write lock. Taking it in read mode and write mode | ||
| 35 | * is relatively fast, and intended for in-kernel use only. | ||
| 36 | * | ||
| 37 | * The vt mode is used only when there is a need to block all | ||
| 38 | * user-space processes from validating buffers. | ||
| 39 | * It's allowed to leave kernel space with the vt lock held. | ||
| 40 | * If a user-space process dies while having the vt-lock, | ||
| 41 | * it will be released during the file descriptor release. The vt lock | ||
| 42 | * excludes write lock and read lock. | ||
| 43 | * | ||
| 44 | * The suspend mode is used to lock out all TTM users when preparing for | ||
| 45 | * and executing suspend operations. | ||
| 46 | * | ||
| 47 | */ | ||
| 48 | |||
| 49 | #ifndef _TTM_LOCK_H_ | ||
| 50 | #define _TTM_LOCK_H_ | ||
| 51 | |||
| 52 | #include "ttm/ttm_object.h" | ||
| 53 | #include <linux/wait.h> | ||
| 54 | #include <asm/atomic.h> | ||
| 55 | |||
| 56 | /** | ||
| 57 | * struct ttm_lock | ||
| 58 | * | ||
| 59 | * @base: ttm base object used solely to release the lock if the client | ||
| 60 | * holding the lock dies. | ||
| 61 | * @queue: Queue for processes waiting for lock change-of-status. | ||
| 62 | * @lock: Spinlock protecting some lock members. | ||
| 63 | * @rw: Read-write lock counter. Protected by @lock. | ||
| 64 | * @flags: Lock state. Protected by @lock. | ||
| 65 | * @kill_takers: Boolean whether to kill takers of the lock. | ||
| 66 | * @signal: Signal to send when kill_takers is true. | ||
| 67 | */ | ||
| 68 | |||
| 69 | struct ttm_lock { | ||
| 70 | struct ttm_base_object base; | ||
| 71 | wait_queue_head_t queue; | ||
| 72 | spinlock_t lock; | ||
| 73 | int32_t rw; | ||
| 74 | uint32_t flags; | ||
| 75 | bool kill_takers; | ||
| 76 | int signal; | ||
| 77 | struct ttm_object_file *vt_holder; | ||
| 78 | }; | ||
| 79 | |||
| 80 | |||
| 81 | /** | ||
| 82 | * ttm_lock_init | ||
| 83 | * | ||
| 84 | * @lock: Pointer to a struct ttm_lock | ||
| 85 | * Initializes the lock. | ||
| 86 | */ | ||
| 87 | extern void ttm_lock_init(struct ttm_lock *lock); | ||
| 88 | |||
| 89 | /** | ||
| 90 | * ttm_read_unlock | ||
| 91 | * | ||
| 92 | * @lock: Pointer to a struct ttm_lock | ||
| 93 | * | ||
| 94 | * Releases a read lock. | ||
| 95 | */ | ||
| 96 | extern void ttm_read_unlock(struct ttm_lock *lock); | ||
| 97 | |||
| 98 | /** | ||
| 99 | * ttm_read_lock | ||
| 100 | * | ||
| 101 | * @lock: Pointer to a struct ttm_lock | ||
| 102 | * @interruptible: Interruptible sleeping while waiting for a lock. | ||
| 103 | * | ||
| 104 | * Takes the lock in read mode. | ||
| 105 | * Returns: | ||
| 106 | * -ERESTARTSYS If interrupted by a signal and interruptible is true. | ||
| 107 | */ | ||
| 108 | extern int ttm_read_lock(struct ttm_lock *lock, bool interruptible); | ||
| 109 | |||
| 110 | /** | ||
| 111 | * ttm_read_trylock | ||
| 112 | * | ||
| 113 | * @lock: Pointer to a struct ttm_lock | ||
| 114 | * @interruptible: Interruptible sleeping while waiting for a lock. | ||
| 115 | * | ||
| 116 | * Tries to take the lock in read mode. If the lock is already held | ||
| 117 | * in write mode, the function will return -EBUSY. If the lock is held | ||
| 118 | * in vt or suspend mode, the function will sleep until these modes | ||
| 119 | * are unlocked. | ||
| 120 | * | ||
| 121 | * Returns: | ||
| 122 | * -EBUSY The lock was already held in write mode. | ||
| 123 | * -ERESTARTSYS If interrupted by a signal and interruptible is true. | ||
| 124 | */ | ||
| 125 | extern int ttm_read_trylock(struct ttm_lock *lock, bool interruptible); | ||
| 126 | |||
| 127 | /** | ||
| 128 | * ttm_write_unlock | ||
| 129 | * | ||
| 130 | * @lock: Pointer to a struct ttm_lock | ||
| 131 | * | ||
| 132 | * Releases a write lock. | ||
| 133 | */ | ||
| 134 | extern void ttm_write_unlock(struct ttm_lock *lock); | ||
| 135 | |||
| 136 | /** | ||
| 137 | * ttm_write_lock | ||
| 138 | * | ||
| 139 | * @lock: Pointer to a struct ttm_lock | ||
| 140 | * @interruptible: Interruptible sleeping while waiting for a lock. | ||
| 141 | * | ||
| 142 | * Takes the lock in write mode. | ||
| 143 | * Returns: | ||
| 144 | * -ERESTARTSYS If interrupted by a signal and interruptible is true. | ||
| 145 | */ | ||
| 146 | extern int ttm_write_lock(struct ttm_lock *lock, bool interruptible); | ||
| 147 | |||
| 148 | /** | ||
| 149 | * ttm_lock_downgrade | ||
| 150 | * | ||
| 151 | * @lock: Pointer to a struct ttm_lock | ||
| 152 | * | ||
| 153 | * Downgrades a write lock to a read lock. | ||
| 154 | */ | ||
| 155 | extern void ttm_lock_downgrade(struct ttm_lock *lock); | ||
| 156 | |||
| 157 | /** | ||
| 158 | * ttm_suspend_lock | ||
| 159 | * | ||
| 160 | * @lock: Pointer to a struct ttm_lock | ||
| 161 | * | ||
| 162 | * Takes the lock in suspend mode. Excludes read and write mode. | ||
| 163 | */ | ||
| 164 | extern void ttm_suspend_lock(struct ttm_lock *lock); | ||
| 165 | |||
| 166 | /** | ||
| 167 | * ttm_suspend_unlock | ||
| 168 | * | ||
| 169 | * @lock: Pointer to a struct ttm_lock | ||
| 170 | * | ||
| 171 | * Releases a suspend lock | ||
| 172 | */ | ||
| 173 | extern void ttm_suspend_unlock(struct ttm_lock *lock); | ||
| 174 | |||
| 175 | /** | ||
| 176 | * ttm_vt_lock | ||
| 177 | * | ||
| 178 | * @lock: Pointer to a struct ttm_lock | ||
| 179 | * @interruptible: Interruptible sleeping while waiting for a lock. | ||
| 180 | * @tfile: Pointer to a struct ttm_object_file to register the lock with. | ||
| 181 | * | ||
| 182 | * Takes the lock in vt mode. | ||
| 183 | * Returns: | ||
| 184 | * -ERESTARTSYS If interrupted by a signal and interruptible is true. | ||
| 185 | * -ENOMEM: Out of memory when locking. | ||
| 186 | */ | ||
| 187 | extern int ttm_vt_lock(struct ttm_lock *lock, bool interruptible, | ||
| 188 | struct ttm_object_file *tfile); | ||
| 189 | |||
| 190 | /** | ||
| 191 | * ttm_vt_unlock | ||
| 192 | * | ||
| 193 | * @lock: Pointer to a struct ttm_lock | ||
| 194 | * | ||
| 195 | * Releases a vt lock. | ||
| 196 | * Returns: | ||
| 197 | * -EINVAL If the lock was not held. | ||
| 198 | */ | ||
| 199 | extern int ttm_vt_unlock(struct ttm_lock *lock); | ||
| 200 | |||
| 201 | /** | ||
| 202 | * ttm_write_unlock | ||
| 203 | * | ||
| 204 | * @lock: Pointer to a struct ttm_lock | ||
| 205 | * | ||
| 206 | * Releases a write lock. | ||
| 207 | */ | ||
| 208 | extern void ttm_write_unlock(struct ttm_lock *lock); | ||
| 209 | |||
| 210 | /** | ||
| 211 | * ttm_write_lock | ||
| 212 | * | ||
| 213 | * @lock: Pointer to a struct ttm_lock | ||
| 214 | * @interruptible: Interruptible sleeping while waiting for a lock. | ||
| 215 | * | ||
| 216 | * Takes the lock in write mode. | ||
| 217 | * Returns: | ||
| 218 | * -ERESTARTSYS If interrupted by a signal and interruptible is true. | ||
| 219 | */ | ||
| 220 | extern int ttm_write_lock(struct ttm_lock *lock, bool interruptible); | ||
| 221 | |||
| 222 | /** | ||
| 223 | * ttm_lock_set_kill | ||
| 224 | * | ||
| 225 | * @lock: Pointer to a struct ttm_lock | ||
| 226 | * @val: Boolean whether to kill processes taking the lock. | ||
| 227 | * @signal: Signal to send to the process taking the lock. | ||
| 228 | * | ||
| 229 | * The kill-when-taking-lock functionality is used to kill processes that keep | ||
| 230 | * on using the TTM functionality when its resources has been taken down, for | ||
| 231 | * example when the X server exits. A typical sequence would look like this: | ||
| 232 | * - X server takes lock in write mode. | ||
| 233 | * - ttm_lock_set_kill() is called with @val set to true. | ||
| 234 | * - As part of X server exit, TTM resources are taken down. | ||
| 235 | * - X server releases the lock on file release. | ||
| 236 | * - Another dri client wants to render, takes the lock and is killed. | ||
| 237 | * | ||
| 238 | */ | ||
| 239 | static inline void ttm_lock_set_kill(struct ttm_lock *lock, bool val, | ||
| 240 | int signal) | ||
| 241 | { | ||
| 242 | lock->kill_takers = val; | ||
| 243 | if (val) | ||
| 244 | lock->signal = signal; | ||
| 245 | } | ||
| 246 | |||
| 247 | #endif | ||
diff --git a/include/drm/ttm/ttm_memory.h b/include/drm/ttm/ttm_memory.h index 6983a7cf4da4..b199170b3c2c 100644 --- a/include/drm/ttm/ttm_memory.h +++ b/include/drm/ttm/ttm_memory.h | |||
| @@ -33,6 +33,7 @@ | |||
| 33 | #include <linux/wait.h> | 33 | #include <linux/wait.h> |
| 34 | #include <linux/errno.h> | 34 | #include <linux/errno.h> |
| 35 | #include <linux/kobject.h> | 35 | #include <linux/kobject.h> |
| 36 | #include <linux/mm.h> | ||
| 36 | 37 | ||
| 37 | /** | 38 | /** |
| 38 | * struct ttm_mem_shrink - callback to shrink TTM memory usage. | 39 | * struct ttm_mem_shrink - callback to shrink TTM memory usage. |
diff --git a/include/drm/ttm/ttm_object.h b/include/drm/ttm/ttm_object.h new file mode 100644 index 000000000000..0d9db099978b --- /dev/null +++ b/include/drm/ttm/ttm_object.h | |||
| @@ -0,0 +1,271 @@ | |||
| 1 | /************************************************************************** | ||
| 2 | * | ||
| 3 | * Copyright (c) 2006-2009 VMware, Inc., Palo Alto, CA., USA | ||
| 4 | * All Rights Reserved. | ||
| 5 | * | ||
| 6 | * Permission is hereby granted, free of charge, to any person obtaining a | ||
| 7 | * copy of this software and associated documentation files (the | ||
| 8 | * "Software"), to deal in the Software without restriction, including | ||
| 9 | * without limitation the rights to use, copy, modify, merge, publish, | ||
| 10 | * distribute, sub license, and/or sell copies of the Software, and to | ||
| 11 | * permit persons to whom the Software is furnished to do so, subject to | ||
| 12 | * the following conditions: | ||
| 13 | * | ||
| 14 | * The above copyright notice and this permission notice (including the | ||
| 15 | * next paragraph) shall be included in all copies or substantial portions | ||
| 16 | * of the Software. | ||
| 17 | * | ||
| 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| 19 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
| 20 | * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL | ||
| 21 | * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, | ||
| 22 | * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR | ||
| 23 | * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE | ||
| 24 | * USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
| 25 | * | ||
| 26 | **************************************************************************/ | ||
| 27 | /* | ||
| 28 | * Authors: Thomas Hellstrom <thellstrom-at-vmware-dot-com> | ||
| 29 | */ | ||
| 30 | /** @file ttm_object.h | ||
| 31 | * | ||
| 32 | * Base- and reference object implementation for the various | ||
| 33 | * ttm objects. Implements reference counting, minimal security checks | ||
| 34 | * and release on file close. | ||
| 35 | */ | ||
| 36 | |||
| 37 | #ifndef _TTM_OBJECT_H_ | ||
| 38 | #define _TTM_OBJECT_H_ | ||
| 39 | |||
| 40 | #include <linux/list.h> | ||
| 41 | #include "drm_hashtab.h" | ||
| 42 | #include <linux/kref.h> | ||
| 43 | #include <ttm/ttm_memory.h> | ||
| 44 | |||
| 45 | /** | ||
| 46 | * enum ttm_ref_type | ||
| 47 | * | ||
| 48 | * Describes what type of reference a ref object holds. | ||
| 49 | * | ||
| 50 | * TTM_REF_USAGE is a simple refcount on a base object. | ||
| 51 | * | ||
| 52 | * TTM_REF_SYNCCPU_READ is a SYNCCPU_READ reference on a | ||
| 53 | * buffer object. | ||
| 54 | * | ||
| 55 | * TTM_REF_SYNCCPU_WRITE is a SYNCCPU_WRITE reference on a | ||
| 56 | * buffer object. | ||
| 57 | * | ||
| 58 | */ | ||
| 59 | |||
| 60 | enum ttm_ref_type { | ||
| 61 | TTM_REF_USAGE, | ||
| 62 | TTM_REF_SYNCCPU_READ, | ||
| 63 | TTM_REF_SYNCCPU_WRITE, | ||
| 64 | TTM_REF_NUM | ||
| 65 | }; | ||
| 66 | |||
| 67 | /** | ||
| 68 | * enum ttm_object_type | ||
| 69 | * | ||
| 70 | * One entry per ttm object type. | ||
| 71 | * Device-specific types should use the | ||
| 72 | * ttm_driver_typex types. | ||
| 73 | */ | ||
| 74 | |||
| 75 | enum ttm_object_type { | ||
| 76 | ttm_fence_type, | ||
| 77 | ttm_buffer_type, | ||
| 78 | ttm_lock_type, | ||
| 79 | ttm_driver_type0 = 256, | ||
| 80 | ttm_driver_type1, | ||
| 81 | ttm_driver_type2, | ||
| 82 | ttm_driver_type3, | ||
| 83 | ttm_driver_type4, | ||
| 84 | ttm_driver_type5 | ||
| 85 | }; | ||
| 86 | |||
| 87 | struct ttm_object_file; | ||
| 88 | struct ttm_object_device; | ||
| 89 | |||
| 90 | /** | ||
| 91 | * struct ttm_base_object | ||
| 92 | * | ||
| 93 | * @hash: hash entry for the per-device object hash. | ||
| 94 | * @type: derived type this object is base class for. | ||
| 95 | * @shareable: Other ttm_object_files can access this object. | ||
| 96 | * | ||
| 97 | * @tfile: Pointer to ttm_object_file of the creator. | ||
| 98 | * NULL if the object was not created by a user request. | ||
| 99 | * (kernel object). | ||
| 100 | * | ||
| 101 | * @refcount: Number of references to this object, not | ||
| 102 | * including the hash entry. A reference to a base object can | ||
| 103 | * only be held by a ref object. | ||
| 104 | * | ||
| 105 | * @refcount_release: A function to be called when there are | ||
| 106 | * no more references to this object. This function should | ||
| 107 | * destroy the object (or make sure destruction eventually happens), | ||
| 108 | * and when it is called, the object has | ||
| 109 | * already been taken out of the per-device hash. The parameter | ||
| 110 | * "base" should be set to NULL by the function. | ||
| 111 | * | ||
| 112 | * @ref_obj_release: A function to be called when a reference object | ||
| 113 | * with another ttm_ref_type than TTM_REF_USAGE is deleted. | ||
| 114 | * this function may, for example, release a lock held by a user-space | ||
| 115 | * process. | ||
| 116 | * | ||
| 117 | * This struct is intended to be used as a base struct for objects that | ||
| 118 | * are visible to user-space. It provides a global name, race-safe | ||
| 119 | * access and refcounting, minimal access contol and hooks for unref actions. | ||
| 120 | */ | ||
| 121 | |||
| 122 | struct ttm_base_object { | ||
| 123 | struct drm_hash_item hash; | ||
| 124 | enum ttm_object_type object_type; | ||
| 125 | bool shareable; | ||
| 126 | struct ttm_object_file *tfile; | ||
| 127 | struct kref refcount; | ||
| 128 | void (*refcount_release) (struct ttm_base_object **base); | ||
| 129 | void (*ref_obj_release) (struct ttm_base_object *base, | ||
| 130 | enum ttm_ref_type ref_type); | ||
| 131 | }; | ||
| 132 | |||
| 133 | /** | ||
| 134 | * ttm_base_object_init | ||
| 135 | * | ||
| 136 | * @tfile: Pointer to a struct ttm_object_file. | ||
| 137 | * @base: The struct ttm_base_object to initialize. | ||
| 138 | * @shareable: This object is shareable with other applcations. | ||
| 139 | * (different @tfile pointers.) | ||
| 140 | * @type: The object type. | ||
| 141 | * @refcount_release: See the struct ttm_base_object description. | ||
| 142 | * @ref_obj_release: See the struct ttm_base_object description. | ||
| 143 | * | ||
| 144 | * Initializes a struct ttm_base_object. | ||
| 145 | */ | ||
| 146 | |||
| 147 | extern int ttm_base_object_init(struct ttm_object_file *tfile, | ||
| 148 | struct ttm_base_object *base, | ||
| 149 | bool shareable, | ||
| 150 | enum ttm_object_type type, | ||
| 151 | void (*refcount_release) (struct ttm_base_object | ||
| 152 | **), | ||
| 153 | void (*ref_obj_release) (struct ttm_base_object | ||
| 154 | *, | ||
| 155 | enum ttm_ref_type | ||
| 156 | ref_type)); | ||
| 157 | |||
| 158 | /** | ||
| 159 | * ttm_base_object_lookup | ||
| 160 | * | ||
| 161 | * @tfile: Pointer to a struct ttm_object_file. | ||
| 162 | * @key: Hash key | ||
| 163 | * | ||
| 164 | * Looks up a struct ttm_base_object with the key @key. | ||
| 165 | * Also verifies that the object is visible to the application, by | ||
| 166 | * comparing the @tfile argument and checking the object shareable flag. | ||
| 167 | */ | ||
| 168 | |||
| 169 | extern struct ttm_base_object *ttm_base_object_lookup(struct ttm_object_file | ||
| 170 | *tfile, uint32_t key); | ||
| 171 | |||
| 172 | /** | ||
| 173 | * ttm_base_object_unref | ||
| 174 | * | ||
| 175 | * @p_base: Pointer to a pointer referncing a struct ttm_base_object. | ||
| 176 | * | ||
| 177 | * Decrements the base object refcount and clears the pointer pointed to by | ||
| 178 | * p_base. | ||
| 179 | */ | ||
| 180 | |||
| 181 | extern void ttm_base_object_unref(struct ttm_base_object **p_base); | ||
| 182 | |||
| 183 | /** | ||
| 184 | * ttm_ref_object_add. | ||
| 185 | * | ||
| 186 | * @tfile: A struct ttm_object_file representing the application owning the | ||
| 187 | * ref_object. | ||
| 188 | * @base: The base object to reference. | ||
| 189 | * @ref_type: The type of reference. | ||
| 190 | * @existed: Upon completion, indicates that an identical reference object | ||
| 191 | * already existed, and the refcount was upped on that object instead. | ||
| 192 | * | ||
| 193 | * Adding a ref object to a base object is basically like referencing the | ||
| 194 | * base object, but a user-space application holds the reference. When the | ||
| 195 | * file corresponding to @tfile is closed, all its reference objects are | ||
| 196 | * deleted. A reference object can have different types depending on what | ||
| 197 | * it's intended for. It can be refcounting to prevent object destruction, | ||
| 198 | * When user-space takes a lock, it can add a ref object to that lock to | ||
| 199 | * make sure the lock is released if the application dies. A ref object | ||
| 200 | * will hold a single reference on a base object. | ||
| 201 | */ | ||
| 202 | extern int ttm_ref_object_add(struct ttm_object_file *tfile, | ||
| 203 | struct ttm_base_object *base, | ||
| 204 | enum ttm_ref_type ref_type, bool *existed); | ||
| 205 | /** | ||
| 206 | * ttm_ref_object_base_unref | ||
| 207 | * | ||
| 208 | * @key: Key representing the base object. | ||
| 209 | * @ref_type: Ref type of the ref object to be dereferenced. | ||
| 210 | * | ||
| 211 | * Unreference a ref object with type @ref_type | ||
| 212 | * on the base object identified by @key. If there are no duplicate | ||
| 213 | * references, the ref object will be destroyed and the base object | ||
| 214 | * will be unreferenced. | ||
| 215 | */ | ||
| 216 | extern int ttm_ref_object_base_unref(struct ttm_object_file *tfile, | ||
| 217 | unsigned long key, | ||
| 218 | enum ttm_ref_type ref_type); | ||
| 219 | |||
| 220 | /** | ||
| 221 | * ttm_object_file_init - initialize a struct ttm_object file | ||
| 222 | * | ||
| 223 | * @tdev: A struct ttm_object device this file is initialized on. | ||
| 224 | * @hash_order: Order of the hash table used to hold the reference objects. | ||
| 225 | * | ||
| 226 | * This is typically called by the file_ops::open function. | ||
| 227 | */ | ||
| 228 | |||
| 229 | extern struct ttm_object_file *ttm_object_file_init(struct ttm_object_device | ||
| 230 | *tdev, | ||
| 231 | unsigned int hash_order); | ||
| 232 | |||
| 233 | /** | ||
| 234 | * ttm_object_file_release - release data held by a ttm_object_file | ||
| 235 | * | ||
| 236 | * @p_tfile: Pointer to pointer to the ttm_object_file object to release. | ||
| 237 | * *p_tfile will be set to NULL by this function. | ||
| 238 | * | ||
| 239 | * Releases all data associated by a ttm_object_file. | ||
| 240 | * Typically called from file_ops::release. The caller must | ||
| 241 | * ensure that there are no concurrent users of tfile. | ||
| 242 | */ | ||
| 243 | |||
| 244 | extern void ttm_object_file_release(struct ttm_object_file **p_tfile); | ||
| 245 | |||
| 246 | /** | ||
| 247 | * ttm_object device init - initialize a struct ttm_object_device | ||
| 248 | * | ||
| 249 | * @hash_order: Order of hash table used to hash the base objects. | ||
| 250 | * | ||
| 251 | * This function is typically called on device initialization to prepare | ||
| 252 | * data structures needed for ttm base and ref objects. | ||
| 253 | */ | ||
| 254 | |||
| 255 | extern struct ttm_object_device *ttm_object_device_init | ||
| 256 | (struct ttm_mem_global *mem_glob, unsigned int hash_order); | ||
| 257 | |||
| 258 | /** | ||
| 259 | * ttm_object_device_release - release data held by a ttm_object_device | ||
| 260 | * | ||
| 261 | * @p_tdev: Pointer to pointer to the ttm_object_device object to release. | ||
| 262 | * *p_tdev will be set to NULL by this function. | ||
| 263 | * | ||
| 264 | * Releases all data associated by a ttm_object_device. | ||
| 265 | * Typically called from driver::unload before the destruction of the | ||
| 266 | * device private data structure. | ||
| 267 | */ | ||
| 268 | |||
| 269 | extern void ttm_object_device_release(struct ttm_object_device **p_tdev); | ||
| 270 | |||
| 271 | #endif | ||
diff --git a/include/drm/via_drm.h b/include/drm/via_drm.h index 170786e5c2ff..fd11a5bd892d 100644 --- a/include/drm/via_drm.h +++ b/include/drm/via_drm.h | |||
| @@ -24,7 +24,7 @@ | |||
| 24 | #ifndef _VIA_DRM_H_ | 24 | #ifndef _VIA_DRM_H_ |
| 25 | #define _VIA_DRM_H_ | 25 | #define _VIA_DRM_H_ |
| 26 | 26 | ||
| 27 | #include <linux/types.h> | 27 | #include "drm.h" |
| 28 | 28 | ||
| 29 | /* WARNING: These defines must be the same as what the Xserver uses. | 29 | /* WARNING: These defines must be the same as what the Xserver uses. |
| 30 | * if you change them, you must change the defines in the Xserver. | 30 | * if you change them, you must change the defines in the Xserver. |
diff --git a/include/drm/vmwgfx_drm.h b/include/drm/vmwgfx_drm.h new file mode 100644 index 000000000000..c7645f480d12 --- /dev/null +++ b/include/drm/vmwgfx_drm.h | |||
| @@ -0,0 +1,588 @@ | |||
| 1 | /************************************************************************** | ||
| 2 | * | ||
| 3 | * Copyright © 2009 VMware, Inc., Palo Alto, CA., USA | ||
| 4 | * All Rights Reserved. | ||
| 5 | * | ||
| 6 | * Permission is hereby granted, free of charge, to any person obtaining a | ||
| 7 | * copy of this software and associated documentation files (the | ||
| 8 | * "Software"), to deal in the Software without restriction, including | ||
| 9 | * without limitation the rights to use, copy, modify, merge, publish, | ||
| 10 | * distribute, sub license, and/or sell copies of the Software, and to | ||
| 11 | * permit persons to whom the Software is furnished to do so, subject to | ||
| 12 | * the following conditions: | ||
| 13 | * | ||
| 14 | * The above copyright notice and this permission notice (including the | ||
| 15 | * next paragraph) shall be included in all copies or substantial portions | ||
| 16 | * of the Software. | ||
| 17 | * | ||
| 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| 19 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
| 20 | * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL | ||
| 21 | * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, | ||
| 22 | * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR | ||
| 23 | * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE | ||
| 24 | * USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
| 25 | * | ||
| 26 | **************************************************************************/ | ||
| 27 | |||
| 28 | #ifndef __VMWGFX_DRM_H__ | ||
| 29 | #define __VMWGFX_DRM_H__ | ||
| 30 | |||
| 31 | #define DRM_VMW_MAX_SURFACE_FACES 6 | ||
| 32 | #define DRM_VMW_MAX_MIP_LEVELS 24 | ||
| 33 | |||
| 34 | #define DRM_VMW_EXT_NAME_LEN 128 | ||
| 35 | |||
| 36 | #define DRM_VMW_GET_PARAM 0 | ||
| 37 | #define DRM_VMW_ALLOC_DMABUF 1 | ||
| 38 | #define DRM_VMW_UNREF_DMABUF 2 | ||
| 39 | #define DRM_VMW_CURSOR_BYPASS 3 | ||
| 40 | /* guarded by DRM_VMW_PARAM_NUM_STREAMS != 0*/ | ||
| 41 | #define DRM_VMW_CONTROL_STREAM 4 | ||
| 42 | #define DRM_VMW_CLAIM_STREAM 5 | ||
| 43 | #define DRM_VMW_UNREF_STREAM 6 | ||
| 44 | /* guarded by DRM_VMW_PARAM_3D == 1 */ | ||
| 45 | #define DRM_VMW_CREATE_CONTEXT 7 | ||
| 46 | #define DRM_VMW_UNREF_CONTEXT 8 | ||
| 47 | #define DRM_VMW_CREATE_SURFACE 9 | ||
| 48 | #define DRM_VMW_UNREF_SURFACE 10 | ||
| 49 | #define DRM_VMW_REF_SURFACE 11 | ||
| 50 | #define DRM_VMW_EXECBUF 12 | ||
| 51 | #define DRM_VMW_FIFO_DEBUG 13 | ||
| 52 | #define DRM_VMW_FENCE_WAIT 14 | ||
| 53 | |||
| 54 | |||
| 55 | /*************************************************************************/ | ||
| 56 | /** | ||
| 57 | * DRM_VMW_GET_PARAM - get device information. | ||
| 58 | * | ||
| 59 | * DRM_VMW_PARAM_FIFO_OFFSET: | ||
| 60 | * Offset to use to map the first page of the FIFO read-only. | ||
| 61 | * The fifo is mapped using the mmap() system call on the drm device. | ||
| 62 | * | ||
| 63 | * DRM_VMW_PARAM_OVERLAY_IOCTL: | ||
| 64 | * Does the driver support the overlay ioctl. | ||
| 65 | */ | ||
| 66 | |||
| 67 | #define DRM_VMW_PARAM_NUM_STREAMS 0 | ||
| 68 | #define DRM_VMW_PARAM_NUM_FREE_STREAMS 1 | ||
| 69 | #define DRM_VMW_PARAM_3D 2 | ||
| 70 | #define DRM_VMW_PARAM_FIFO_OFFSET 3 | ||
| 71 | #define DRM_VMW_PARAM_HW_CAPS 4 | ||
| 72 | #define DRM_VMW_PARAM_FIFO_CAPS 5 | ||
| 73 | |||
| 74 | /** | ||
| 75 | * struct drm_vmw_getparam_arg | ||
| 76 | * | ||
| 77 | * @value: Returned value. //Out | ||
| 78 | * @param: Parameter to query. //In. | ||
| 79 | * | ||
| 80 | * Argument to the DRM_VMW_GET_PARAM Ioctl. | ||
| 81 | */ | ||
| 82 | |||
| 83 | struct drm_vmw_getparam_arg { | ||
| 84 | uint64_t value; | ||
| 85 | uint32_t param; | ||
| 86 | uint32_t pad64; | ||
| 87 | }; | ||
| 88 | |||
| 89 | /*************************************************************************/ | ||
| 90 | /** | ||
| 91 | * DRM_VMW_EXTENSION - Query device extensions. | ||
| 92 | */ | ||
| 93 | |||
| 94 | /** | ||
| 95 | * struct drm_vmw_extension_rep | ||
| 96 | * | ||
| 97 | * @exists: The queried extension exists. | ||
| 98 | * @driver_ioctl_offset: Ioctl number of the first ioctl in the extension. | ||
| 99 | * @driver_sarea_offset: Offset to any space in the DRI SAREA | ||
| 100 | * used by the extension. | ||
| 101 | * @major: Major version number of the extension. | ||
| 102 | * @minor: Minor version number of the extension. | ||
| 103 | * @pl: Patch level version number of the extension. | ||
| 104 | * | ||
| 105 | * Output argument to the DRM_VMW_EXTENSION Ioctl. | ||
| 106 | */ | ||
| 107 | |||
| 108 | struct drm_vmw_extension_rep { | ||
| 109 | int32_t exists; | ||
| 110 | uint32_t driver_ioctl_offset; | ||
| 111 | uint32_t driver_sarea_offset; | ||
| 112 | uint32_t major; | ||
| 113 | uint32_t minor; | ||
| 114 | uint32_t pl; | ||
| 115 | uint32_t pad64; | ||
| 116 | }; | ||
| 117 | |||
| 118 | /** | ||
| 119 | * union drm_vmw_extension_arg | ||
| 120 | * | ||
| 121 | * @extension - Ascii name of the extension to be queried. //In | ||
| 122 | * @rep - Reply as defined above. //Out | ||
| 123 | * | ||
| 124 | * Argument to the DRM_VMW_EXTENSION Ioctl. | ||
| 125 | */ | ||
| 126 | |||
| 127 | union drm_vmw_extension_arg { | ||
| 128 | char extension[DRM_VMW_EXT_NAME_LEN]; | ||
| 129 | struct drm_vmw_extension_rep rep; | ||
| 130 | }; | ||
| 131 | |||
| 132 | /*************************************************************************/ | ||
| 133 | /** | ||
| 134 | * DRM_VMW_CREATE_CONTEXT - Create a host context. | ||
| 135 | * | ||
| 136 | * Allocates a device unique context id, and queues a create context command | ||
| 137 | * for the host. Does not wait for host completion. | ||
| 138 | */ | ||
| 139 | |||
| 140 | /** | ||
| 141 | * struct drm_vmw_context_arg | ||
| 142 | * | ||
| 143 | * @cid: Device unique context ID. | ||
| 144 | * | ||
| 145 | * Output argument to the DRM_VMW_CREATE_CONTEXT Ioctl. | ||
| 146 | * Input argument to the DRM_VMW_UNREF_CONTEXT Ioctl. | ||
| 147 | */ | ||
| 148 | |||
| 149 | struct drm_vmw_context_arg { | ||
| 150 | int32_t cid; | ||
| 151 | uint32_t pad64; | ||
| 152 | }; | ||
| 153 | |||
| 154 | /*************************************************************************/ | ||
| 155 | /** | ||
| 156 | * DRM_VMW_UNREF_CONTEXT - Create a host context. | ||
| 157 | * | ||
| 158 | * Frees a global context id, and queues a destroy host command for the host. | ||
| 159 | * Does not wait for host completion. The context ID can be used directly | ||
| 160 | * in the command stream and shows up as the same context ID on the host. | ||
| 161 | */ | ||
| 162 | |||
| 163 | /*************************************************************************/ | ||
| 164 | /** | ||
| 165 | * DRM_VMW_CREATE_SURFACE - Create a host suface. | ||
| 166 | * | ||
| 167 | * Allocates a device unique surface id, and queues a create surface command | ||
| 168 | * for the host. Does not wait for host completion. The surface ID can be | ||
| 169 | * used directly in the command stream and shows up as the same surface | ||
| 170 | * ID on the host. | ||
| 171 | */ | ||
| 172 | |||
| 173 | /** | ||
| 174 | * struct drm_wmv_surface_create_req | ||
| 175 | * | ||
| 176 | * @flags: Surface flags as understood by the host. | ||
| 177 | * @format: Surface format as understood by the host. | ||
| 178 | * @mip_levels: Number of mip levels for each face. | ||
| 179 | * An unused face should have 0 encoded. | ||
| 180 | * @size_addr: Address of a user-space array of sruct drm_vmw_size | ||
| 181 | * cast to an uint64_t for 32-64 bit compatibility. | ||
| 182 | * The size of the array should equal the total number of mipmap levels. | ||
| 183 | * @shareable: Boolean whether other clients (as identified by file descriptors) | ||
| 184 | * may reference this surface. | ||
| 185 | * @scanout: Boolean whether the surface is intended to be used as a | ||
| 186 | * scanout. | ||
| 187 | * | ||
| 188 | * Input data to the DRM_VMW_CREATE_SURFACE Ioctl. | ||
| 189 | * Output data from the DRM_VMW_REF_SURFACE Ioctl. | ||
| 190 | */ | ||
| 191 | |||
| 192 | struct drm_vmw_surface_create_req { | ||
| 193 | uint32_t flags; | ||
| 194 | uint32_t format; | ||
| 195 | uint32_t mip_levels[DRM_VMW_MAX_SURFACE_FACES]; | ||
| 196 | uint64_t size_addr; | ||
| 197 | int32_t shareable; | ||
| 198 | int32_t scanout; | ||
| 199 | }; | ||
| 200 | |||
| 201 | /** | ||
| 202 | * struct drm_wmv_surface_arg | ||
| 203 | * | ||
| 204 | * @sid: Surface id of created surface or surface to destroy or reference. | ||
| 205 | * | ||
| 206 | * Output data from the DRM_VMW_CREATE_SURFACE Ioctl. | ||
| 207 | * Input argument to the DRM_VMW_UNREF_SURFACE Ioctl. | ||
| 208 | * Input argument to the DRM_VMW_REF_SURFACE Ioctl. | ||
| 209 | */ | ||
| 210 | |||
| 211 | struct drm_vmw_surface_arg { | ||
| 212 | int32_t sid; | ||
| 213 | uint32_t pad64; | ||
| 214 | }; | ||
| 215 | |||
| 216 | /** | ||
| 217 | * struct drm_vmw_size ioctl. | ||
| 218 | * | ||
| 219 | * @width - mip level width | ||
| 220 | * @height - mip level height | ||
| 221 | * @depth - mip level depth | ||
| 222 | * | ||
| 223 | * Description of a mip level. | ||
| 224 | * Input data to the DRM_WMW_CREATE_SURFACE Ioctl. | ||
| 225 | */ | ||
| 226 | |||
| 227 | struct drm_vmw_size { | ||
| 228 | uint32_t width; | ||
| 229 | uint32_t height; | ||
| 230 | uint32_t depth; | ||
| 231 | uint32_t pad64; | ||
| 232 | }; | ||
| 233 | |||
| 234 | /** | ||
| 235 | * union drm_vmw_surface_create_arg | ||
| 236 | * | ||
| 237 | * @rep: Output data as described above. | ||
| 238 | * @req: Input data as described above. | ||
| 239 | * | ||
| 240 | * Argument to the DRM_VMW_CREATE_SURFACE Ioctl. | ||
| 241 | */ | ||
| 242 | |||
| 243 | union drm_vmw_surface_create_arg { | ||
| 244 | struct drm_vmw_surface_arg rep; | ||
| 245 | struct drm_vmw_surface_create_req req; | ||
| 246 | }; | ||
| 247 | |||
| 248 | /*************************************************************************/ | ||
| 249 | /** | ||
| 250 | * DRM_VMW_REF_SURFACE - Reference a host surface. | ||
| 251 | * | ||
| 252 | * Puts a reference on a host surface with a give sid, as previously | ||
| 253 | * returned by the DRM_VMW_CREATE_SURFACE ioctl. | ||
| 254 | * A reference will make sure the surface isn't destroyed while we hold | ||
| 255 | * it and will allow the calling client to use the surface ID in the command | ||
| 256 | * stream. | ||
| 257 | * | ||
| 258 | * On successful return, the Ioctl returns the surface information given | ||
| 259 | * in the DRM_VMW_CREATE_SURFACE ioctl. | ||
| 260 | */ | ||
| 261 | |||
| 262 | /** | ||
| 263 | * union drm_vmw_surface_reference_arg | ||
| 264 | * | ||
| 265 | * @rep: Output data as described above. | ||
| 266 | * @req: Input data as described above. | ||
| 267 | * | ||
| 268 | * Argument to the DRM_VMW_REF_SURFACE Ioctl. | ||
| 269 | */ | ||
| 270 | |||
| 271 | union drm_vmw_surface_reference_arg { | ||
| 272 | struct drm_vmw_surface_create_req rep; | ||
| 273 | struct drm_vmw_surface_arg req; | ||
| 274 | }; | ||
| 275 | |||
| 276 | /*************************************************************************/ | ||
| 277 | /** | ||
| 278 | * DRM_VMW_UNREF_SURFACE - Unreference a host surface. | ||
| 279 | * | ||
| 280 | * Clear a reference previously put on a host surface. | ||
| 281 | * When all references are gone, including the one implicitly placed | ||
| 282 | * on creation, | ||
| 283 | * a destroy surface command will be queued for the host. | ||
| 284 | * Does not wait for completion. | ||
| 285 | */ | ||
| 286 | |||
| 287 | /*************************************************************************/ | ||
| 288 | /** | ||
| 289 | * DRM_VMW_EXECBUF | ||
| 290 | * | ||
| 291 | * Submit a command buffer for execution on the host, and return a | ||
| 292 | * fence sequence that when signaled, indicates that the command buffer has | ||
| 293 | * executed. | ||
| 294 | */ | ||
| 295 | |||
| 296 | /** | ||
| 297 | * struct drm_vmw_execbuf_arg | ||
| 298 | * | ||
| 299 | * @commands: User-space address of a command buffer cast to an uint64_t. | ||
| 300 | * @command-size: Size in bytes of the command buffer. | ||
| 301 | * @throttle-us: Sleep until software is less than @throttle_us | ||
| 302 | * microseconds ahead of hardware. The driver may round this value | ||
| 303 | * to the nearest kernel tick. | ||
| 304 | * @fence_rep: User-space address of a struct drm_vmw_fence_rep cast to an | ||
| 305 | * uint64_t. | ||
| 306 | * @version: Allows expanding the execbuf ioctl parameters without breaking | ||
| 307 | * backwards compatibility, since user-space will always tell the kernel | ||
| 308 | * which version it uses. | ||
| 309 | * @flags: Execbuf flags. None currently. | ||
| 310 | * | ||
| 311 | * Argument to the DRM_VMW_EXECBUF Ioctl. | ||
| 312 | */ | ||
| 313 | |||
| 314 | #define DRM_VMW_EXECBUF_VERSION 0 | ||
| 315 | |||
| 316 | struct drm_vmw_execbuf_arg { | ||
| 317 | uint64_t commands; | ||
| 318 | uint32_t command_size; | ||
| 319 | uint32_t throttle_us; | ||
| 320 | uint64_t fence_rep; | ||
| 321 | uint32_t version; | ||
| 322 | uint32_t flags; | ||
| 323 | }; | ||
| 324 | |||
| 325 | /** | ||
| 326 | * struct drm_vmw_fence_rep | ||
| 327 | * | ||
| 328 | * @fence_seq: Fence sequence associated with a command submission. | ||
| 329 | * @error: This member should've been set to -EFAULT on submission. | ||
| 330 | * The following actions should be take on completion: | ||
| 331 | * error == -EFAULT: Fence communication failed. The host is synchronized. | ||
| 332 | * Use the last fence id read from the FIFO fence register. | ||
| 333 | * error != 0 && error != -EFAULT: | ||
| 334 | * Fence submission failed. The host is synchronized. Use the fence_seq member. | ||
| 335 | * error == 0: All is OK, The host may not be synchronized. | ||
| 336 | * Use the fence_seq member. | ||
| 337 | * | ||
| 338 | * Input / Output data to the DRM_VMW_EXECBUF Ioctl. | ||
| 339 | */ | ||
| 340 | |||
| 341 | struct drm_vmw_fence_rep { | ||
| 342 | uint64_t fence_seq; | ||
| 343 | int32_t error; | ||
| 344 | uint32_t pad64; | ||
| 345 | }; | ||
| 346 | |||
| 347 | /*************************************************************************/ | ||
| 348 | /** | ||
| 349 | * DRM_VMW_ALLOC_DMABUF | ||
| 350 | * | ||
| 351 | * Allocate a DMA buffer that is visible also to the host. | ||
| 352 | * NOTE: The buffer is | ||
| 353 | * identified by a handle and an offset, which are private to the guest, but | ||
| 354 | * useable in the command stream. The guest kernel may translate these | ||
| 355 | * and patch up the command stream accordingly. In the future, the offset may | ||
| 356 | * be zero at all times, or it may disappear from the interface before it is | ||
| 357 | * fixed. | ||
| 358 | * | ||
| 359 | * The DMA buffer may stay user-space mapped in the guest at all times, | ||
| 360 | * and is thus suitable for sub-allocation. | ||
| 361 | * | ||
| 362 | * DMA buffers are mapped using the mmap() syscall on the drm device. | ||
| 363 | */ | ||
| 364 | |||
| 365 | /** | ||
| 366 | * struct drm_vmw_alloc_dmabuf_req | ||
| 367 | * | ||
| 368 | * @size: Required minimum size of the buffer. | ||
| 369 | * | ||
| 370 | * Input data to the DRM_VMW_ALLOC_DMABUF Ioctl. | ||
| 371 | */ | ||
| 372 | |||
| 373 | struct drm_vmw_alloc_dmabuf_req { | ||
| 374 | uint32_t size; | ||
| 375 | uint32_t pad64; | ||
| 376 | }; | ||
| 377 | |||
| 378 | /** | ||
| 379 | * struct drm_vmw_dmabuf_rep | ||
| 380 | * | ||
| 381 | * @map_handle: Offset to use in the mmap() call used to map the buffer. | ||
| 382 | * @handle: Handle unique to this buffer. Used for unreferencing. | ||
| 383 | * @cur_gmr_id: GMR id to use in the command stream when this buffer is | ||
| 384 | * referenced. See not above. | ||
| 385 | * @cur_gmr_offset: Offset to use in the command stream when this buffer is | ||
| 386 | * referenced. See note above. | ||
| 387 | * | ||
| 388 | * Output data from the DRM_VMW_ALLOC_DMABUF Ioctl. | ||
| 389 | */ | ||
| 390 | |||
| 391 | struct drm_vmw_dmabuf_rep { | ||
| 392 | uint64_t map_handle; | ||
| 393 | uint32_t handle; | ||
| 394 | uint32_t cur_gmr_id; | ||
| 395 | uint32_t cur_gmr_offset; | ||
| 396 | uint32_t pad64; | ||
| 397 | }; | ||
| 398 | |||
| 399 | /** | ||
| 400 | * union drm_vmw_dmabuf_arg | ||
| 401 | * | ||
| 402 | * @req: Input data as described above. | ||
| 403 | * @rep: Output data as described above. | ||
| 404 | * | ||
| 405 | * Argument to the DRM_VMW_ALLOC_DMABUF Ioctl. | ||
| 406 | */ | ||
| 407 | |||
| 408 | union drm_vmw_alloc_dmabuf_arg { | ||
| 409 | struct drm_vmw_alloc_dmabuf_req req; | ||
| 410 | struct drm_vmw_dmabuf_rep rep; | ||
| 411 | }; | ||
| 412 | |||
| 413 | /*************************************************************************/ | ||
| 414 | /** | ||
| 415 | * DRM_VMW_UNREF_DMABUF - Free a DMA buffer. | ||
| 416 | * | ||
| 417 | */ | ||
| 418 | |||
| 419 | /** | ||
| 420 | * struct drm_vmw_unref_dmabuf_arg | ||
| 421 | * | ||
| 422 | * @handle: Handle indicating what buffer to free. Obtained from the | ||
| 423 | * DRM_VMW_ALLOC_DMABUF Ioctl. | ||
| 424 | * | ||
| 425 | * Argument to the DRM_VMW_UNREF_DMABUF Ioctl. | ||
| 426 | */ | ||
| 427 | |||
| 428 | struct drm_vmw_unref_dmabuf_arg { | ||
| 429 | uint32_t handle; | ||
| 430 | uint32_t pad64; | ||
| 431 | }; | ||
| 432 | |||
| 433 | /*************************************************************************/ | ||
| 434 | /** | ||
| 435 | * DRM_VMW_FIFO_DEBUG - Get last FIFO submission. | ||
| 436 | * | ||
| 437 | * This IOCTL copies the last FIFO submission directly out of the FIFO buffer. | ||
| 438 | */ | ||
| 439 | |||
| 440 | /** | ||
| 441 | * struct drm_vmw_fifo_debug_arg | ||
| 442 | * | ||
| 443 | * @debug_buffer: User space address of a debug_buffer cast to an uint64_t //In | ||
| 444 | * @debug_buffer_size: Size in bytes of debug buffer //In | ||
| 445 | * @used_size: Number of bytes copied to the buffer // Out | ||
| 446 | * @did_not_fit: Boolean indicating that the fifo contents did not fit. //Out | ||
| 447 | * | ||
| 448 | * Argument to the DRM_VMW_FIFO_DEBUG Ioctl. | ||
| 449 | */ | ||
| 450 | |||
| 451 | struct drm_vmw_fifo_debug_arg { | ||
| 452 | uint64_t debug_buffer; | ||
| 453 | uint32_t debug_buffer_size; | ||
| 454 | uint32_t used_size; | ||
| 455 | int32_t did_not_fit; | ||
| 456 | uint32_t pad64; | ||
| 457 | }; | ||
| 458 | |||
| 459 | struct drm_vmw_fence_wait_arg { | ||
| 460 | uint64_t sequence; | ||
| 461 | uint64_t kernel_cookie; | ||
| 462 | int32_t cookie_valid; | ||
| 463 | int32_t pad64; | ||
| 464 | }; | ||
| 465 | |||
| 466 | /*************************************************************************/ | ||
| 467 | /** | ||
| 468 | * DRM_VMW_CONTROL_STREAM - Control overlays, aka streams. | ||
| 469 | * | ||
| 470 | * This IOCTL controls the overlay units of the svga device. | ||
| 471 | * The SVGA overlay units does not work like regular hardware units in | ||
| 472 | * that they do not automaticaly read back the contents of the given dma | ||
| 473 | * buffer. But instead only read back for each call to this ioctl, and | ||
| 474 | * at any point between this call being made and a following call that | ||
| 475 | * either changes the buffer or disables the stream. | ||
| 476 | */ | ||
| 477 | |||
| 478 | /** | ||
| 479 | * struct drm_vmw_rect | ||
| 480 | * | ||
| 481 | * Defines a rectangle. Used in the overlay ioctl to define | ||
| 482 | * source and destination rectangle. | ||
| 483 | */ | ||
| 484 | |||
| 485 | struct drm_vmw_rect { | ||
| 486 | int32_t x; | ||
| 487 | int32_t y; | ||
| 488 | uint32_t w; | ||
| 489 | uint32_t h; | ||
| 490 | }; | ||
| 491 | |||
| 492 | /** | ||
| 493 | * struct drm_vmw_control_stream_arg | ||
| 494 | * | ||
| 495 | * @stream_id: Stearm to control | ||
| 496 | * @enabled: If false all following arguments are ignored. | ||
| 497 | * @handle: Handle to buffer for getting data from. | ||
| 498 | * @format: Format of the overlay as understood by the host. | ||
| 499 | * @width: Width of the overlay. | ||
| 500 | * @height: Height of the overlay. | ||
| 501 | * @size: Size of the overlay in bytes. | ||
| 502 | * @pitch: Array of pitches, the two last are only used for YUV12 formats. | ||
| 503 | * @offset: Offset from start of dma buffer to overlay. | ||
| 504 | * @src: Source rect, must be within the defined area above. | ||
| 505 | * @dst: Destination rect, x and y may be negative. | ||
| 506 | * | ||
| 507 | * Argument to the DRM_VMW_CONTROL_STREAM Ioctl. | ||
| 508 | */ | ||
| 509 | |||
| 510 | struct drm_vmw_control_stream_arg { | ||
| 511 | uint32_t stream_id; | ||
| 512 | uint32_t enabled; | ||
| 513 | |||
| 514 | uint32_t flags; | ||
| 515 | uint32_t color_key; | ||
| 516 | |||
| 517 | uint32_t handle; | ||
| 518 | uint32_t offset; | ||
| 519 | int32_t format; | ||
| 520 | uint32_t size; | ||
| 521 | uint32_t width; | ||
| 522 | uint32_t height; | ||
| 523 | uint32_t pitch[3]; | ||
| 524 | |||
| 525 | uint32_t pad64; | ||
| 526 | struct drm_vmw_rect src; | ||
| 527 | struct drm_vmw_rect dst; | ||
| 528 | }; | ||
| 529 | |||
| 530 | /*************************************************************************/ | ||
| 531 | /** | ||
| 532 | * DRM_VMW_CURSOR_BYPASS - Give extra information about cursor bypass. | ||
| 533 | * | ||
| 534 | */ | ||
| 535 | |||
| 536 | #define DRM_VMW_CURSOR_BYPASS_ALL (1 << 0) | ||
| 537 | #define DRM_VMW_CURSOR_BYPASS_FLAGS (1) | ||
| 538 | |||
| 539 | /** | ||
| 540 | * struct drm_vmw_cursor_bypass_arg | ||
| 541 | * | ||
| 542 | * @flags: Flags. | ||
| 543 | * @crtc_id: Crtc id, only used if DMR_CURSOR_BYPASS_ALL isn't passed. | ||
| 544 | * @xpos: X position of cursor. | ||
| 545 | * @ypos: Y position of cursor. | ||
| 546 | * @xhot: X hotspot. | ||
| 547 | * @yhot: Y hotspot. | ||
| 548 | * | ||
| 549 | * Argument to the DRM_VMW_CURSOR_BYPASS Ioctl. | ||
| 550 | */ | ||
| 551 | |||
| 552 | struct drm_vmw_cursor_bypass_arg { | ||
| 553 | uint32_t flags; | ||
| 554 | uint32_t crtc_id; | ||
| 555 | int32_t xpos; | ||
| 556 | int32_t ypos; | ||
| 557 | int32_t xhot; | ||
| 558 | int32_t yhot; | ||
| 559 | }; | ||
| 560 | |||
| 561 | /*************************************************************************/ | ||
| 562 | /** | ||
| 563 | * DRM_VMW_CLAIM_STREAM - Claim a single stream. | ||
| 564 | */ | ||
| 565 | |||
| 566 | /** | ||
| 567 | * struct drm_vmw_context_arg | ||
| 568 | * | ||
| 569 | * @stream_id: Device unique context ID. | ||
| 570 | * | ||
| 571 | * Output argument to the DRM_VMW_CREATE_CONTEXT Ioctl. | ||
| 572 | * Input argument to the DRM_VMW_UNREF_CONTEXT Ioctl. | ||
| 573 | */ | ||
| 574 | |||
| 575 | struct drm_vmw_stream_arg { | ||
| 576 | uint32_t stream_id; | ||
| 577 | uint32_t pad64; | ||
| 578 | }; | ||
| 579 | |||
| 580 | /*************************************************************************/ | ||
| 581 | /** | ||
| 582 | * DRM_VMW_UNREF_STREAM - Unclaim a stream. | ||
| 583 | * | ||
| 584 | * Return a single stream that was claimed by this process. Also makes | ||
| 585 | * sure that the stream has been stopped. | ||
| 586 | */ | ||
| 587 | |||
| 588 | #endif | ||
diff --git a/include/linux/Kbuild b/include/linux/Kbuild index 1feed71551c9..e2ea0b2159cd 100644 --- a/include/linux/Kbuild +++ b/include/linux/Kbuild | |||
| @@ -43,6 +43,7 @@ header-y += blkpg.h | |||
| 43 | header-y += bpqether.h | 43 | header-y += bpqether.h |
| 44 | header-y += bsg.h | 44 | header-y += bsg.h |
| 45 | header-y += can.h | 45 | header-y += can.h |
| 46 | header-y += cciss_defs.h | ||
| 46 | header-y += cdk.h | 47 | header-y += cdk.h |
| 47 | header-y += chio.h | 48 | header-y += chio.h |
| 48 | header-y += coda_psdev.h | 49 | header-y += coda_psdev.h |
| @@ -118,12 +119,14 @@ header-y += mtio.h | |||
| 118 | header-y += ncp_no.h | 119 | header-y += ncp_no.h |
| 119 | header-y += neighbour.h | 120 | header-y += neighbour.h |
| 120 | header-y += net_dropmon.h | 121 | header-y += net_dropmon.h |
| 122 | header-y += net_tstamp.h | ||
| 121 | header-y += netfilter_arp.h | 123 | header-y += netfilter_arp.h |
| 122 | header-y += netrom.h | 124 | header-y += netrom.h |
| 123 | header-y += nfs2.h | 125 | header-y += nfs2.h |
| 124 | header-y += nfs4_mount.h | 126 | header-y += nfs4_mount.h |
| 125 | header-y += nfs_mount.h | 127 | header-y += nfs_mount.h |
| 126 | header-y += nl80211.h | 128 | header-y += nl80211.h |
| 129 | header-y += omapfb.h | ||
| 127 | header-y += param.h | 130 | header-y += param.h |
| 128 | header-y += pci_regs.h | 131 | header-y += pci_regs.h |
| 129 | header-y += perf_event.h | 132 | header-y += perf_event.h |
| @@ -214,7 +217,6 @@ unifdef-y += futex.h | |||
| 214 | unifdef-y += fs.h | 217 | unifdef-y += fs.h |
| 215 | unifdef-y += gameport.h | 218 | unifdef-y += gameport.h |
| 216 | unifdef-y += generic_serial.h | 219 | unifdef-y += generic_serial.h |
| 217 | unifdef-y += hayesesp.h | ||
| 218 | unifdef-y += hdlcdrv.h | 220 | unifdef-y += hdlcdrv.h |
| 219 | unifdef-y += hdlc.h | 221 | unifdef-y += hdlc.h |
| 220 | unifdef-y += hdreg.h | 222 | unifdef-y += hdreg.h |
| @@ -330,6 +332,7 @@ unifdef-y += scc.h | |||
| 330 | unifdef-y += sched.h | 332 | unifdef-y += sched.h |
| 331 | unifdef-y += screen_info.h | 333 | unifdef-y += screen_info.h |
| 332 | unifdef-y += sdla.h | 334 | unifdef-y += sdla.h |
| 335 | unifdef-y += securebits.h | ||
| 333 | unifdef-y += selinux_netlink.h | 336 | unifdef-y += selinux_netlink.h |
| 334 | unifdef-y += sem.h | 337 | unifdef-y += sem.h |
| 335 | unifdef-y += serial_core.h | 338 | unifdef-y += serial_core.h |
| @@ -361,6 +364,7 @@ unifdef-y += uio.h | |||
| 361 | unifdef-y += unistd.h | 364 | unifdef-y += unistd.h |
| 362 | unifdef-y += usbdevice_fs.h | 365 | unifdef-y += usbdevice_fs.h |
| 363 | unifdef-y += utsname.h | 366 | unifdef-y += utsname.h |
| 367 | unifdef-y += vhost.h | ||
| 364 | unifdef-y += videodev2.h | 368 | unifdef-y += videodev2.h |
| 365 | unifdef-y += videodev.h | 369 | unifdef-y += videodev.h |
| 366 | unifdef-y += virtio_config.h | 370 | unifdef-y += virtio_config.h |
diff --git a/include/linux/acct.h b/include/linux/acct.h index 882dc7248766..3e4737fa6cce 100644 --- a/include/linux/acct.h +++ b/include/linux/acct.h | |||
| @@ -121,16 +121,15 @@ struct vfsmount; | |||
| 121 | struct super_block; | 121 | struct super_block; |
| 122 | struct pacct_struct; | 122 | struct pacct_struct; |
| 123 | struct pid_namespace; | 123 | struct pid_namespace; |
| 124 | extern int acct_parm[]; /* for sysctl */ | ||
| 124 | extern void acct_auto_close_mnt(struct vfsmount *m); | 125 | extern void acct_auto_close_mnt(struct vfsmount *m); |
| 125 | extern void acct_auto_close(struct super_block *sb); | 126 | extern void acct_auto_close(struct super_block *sb); |
| 126 | extern void acct_init_pacct(struct pacct_struct *pacct); | ||
| 127 | extern void acct_collect(long exitcode, int group_dead); | 127 | extern void acct_collect(long exitcode, int group_dead); |
| 128 | extern void acct_process(void); | 128 | extern void acct_process(void); |
| 129 | extern void acct_exit_ns(struct pid_namespace *); | 129 | extern void acct_exit_ns(struct pid_namespace *); |
| 130 | #else | 130 | #else |
| 131 | #define acct_auto_close_mnt(x) do { } while (0) | 131 | #define acct_auto_close_mnt(x) do { } while (0) |
| 132 | #define acct_auto_close(x) do { } while (0) | 132 | #define acct_auto_close(x) do { } while (0) |
| 133 | #define acct_init_pacct(x) do { } while (0) | ||
| 134 | #define acct_collect(x,y) do { } while (0) | 133 | #define acct_collect(x,y) do { } while (0) |
| 135 | #define acct_process() do { } while (0) | 134 | #define acct_process() do { } while (0) |
| 136 | #define acct_exit_ns(ns) do { } while (0) | 135 | #define acct_exit_ns(ns) do { } while (0) |
diff --git a/include/linux/acpi.h b/include/linux/acpi.h index dfcd920c3e54..b926afe8c03e 100644 --- a/include/linux/acpi.h +++ b/include/linux/acpi.h | |||
| @@ -80,7 +80,7 @@ char * __acpi_map_table (unsigned long phys_addr, unsigned long size); | |||
| 80 | void __acpi_unmap_table(char *map, unsigned long size); | 80 | void __acpi_unmap_table(char *map, unsigned long size); |
| 81 | int early_acpi_boot_init(void); | 81 | int early_acpi_boot_init(void); |
| 82 | int acpi_boot_init (void); | 82 | int acpi_boot_init (void); |
| 83 | int acpi_boot_table_init (void); | 83 | void acpi_boot_table_init (void); |
| 84 | int acpi_mps_check (void); | 84 | int acpi_mps_check (void); |
| 85 | int acpi_numa_init (void); | 85 | int acpi_numa_init (void); |
| 86 | 86 | ||
| @@ -240,7 +240,7 @@ extern int pnpacpi_disabled; | |||
| 240 | #define PXM_INVAL (-1) | 240 | #define PXM_INVAL (-1) |
| 241 | #define NID_INVAL (-1) | 241 | #define NID_INVAL (-1) |
| 242 | 242 | ||
| 243 | int acpi_check_resource_conflict(struct resource *res); | 243 | int acpi_check_resource_conflict(const struct resource *res); |
| 244 | 244 | ||
| 245 | int acpi_check_region(resource_size_t start, resource_size_t n, | 245 | int acpi_check_region(resource_size_t start, resource_size_t n, |
| 246 | const char *name); | 246 | const char *name); |
| @@ -251,12 +251,19 @@ int acpi_check_mem_region(resource_size_t start, resource_size_t n, | |||
| 251 | void __init acpi_no_s4_hw_signature(void); | 251 | void __init acpi_no_s4_hw_signature(void); |
| 252 | void __init acpi_old_suspend_ordering(void); | 252 | void __init acpi_old_suspend_ordering(void); |
| 253 | void __init acpi_s4_no_nvs(void); | 253 | void __init acpi_s4_no_nvs(void); |
| 254 | void __init acpi_set_sci_en_on_resume(void); | ||
| 254 | #endif /* CONFIG_PM_SLEEP */ | 255 | #endif /* CONFIG_PM_SLEEP */ |
| 255 | 256 | ||
| 257 | struct acpi_osc_context { | ||
| 258 | char *uuid_str; /* uuid string */ | ||
| 259 | int rev; | ||
| 260 | struct acpi_buffer cap; /* arg2/arg3 */ | ||
| 261 | struct acpi_buffer ret; /* free by caller if success */ | ||
| 262 | }; | ||
| 263 | |||
| 256 | #define OSC_QUERY_TYPE 0 | 264 | #define OSC_QUERY_TYPE 0 |
| 257 | #define OSC_SUPPORT_TYPE 1 | 265 | #define OSC_SUPPORT_TYPE 1 |
| 258 | #define OSC_CONTROL_TYPE 2 | 266 | #define OSC_CONTROL_TYPE 2 |
| 259 | #define OSC_SUPPORT_MASKS 0x1f | ||
| 260 | 267 | ||
| 261 | /* _OSC DW0 Definition */ | 268 | /* _OSC DW0 Definition */ |
| 262 | #define OSC_QUERY_ENABLE 1 | 269 | #define OSC_QUERY_ENABLE 1 |
| @@ -265,12 +272,23 @@ void __init acpi_s4_no_nvs(void); | |||
| 265 | #define OSC_INVALID_REVISION_ERROR 8 | 272 | #define OSC_INVALID_REVISION_ERROR 8 |
| 266 | #define OSC_CAPABILITIES_MASK_ERROR 16 | 273 | #define OSC_CAPABILITIES_MASK_ERROR 16 |
| 267 | 274 | ||
| 275 | acpi_status acpi_run_osc(acpi_handle handle, struct acpi_osc_context *context); | ||
| 276 | |||
| 277 | /* platform-wide _OSC bits */ | ||
| 278 | #define OSC_SB_PAD_SUPPORT 1 | ||
| 279 | #define OSC_SB_PPC_OST_SUPPORT 2 | ||
| 280 | #define OSC_SB_PR3_SUPPORT 4 | ||
| 281 | #define OSC_SB_CPUHP_OST_SUPPORT 8 | ||
| 282 | #define OSC_SB_APEI_SUPPORT 16 | ||
| 283 | |||
| 284 | /* PCI defined _OSC bits */ | ||
| 268 | /* _OSC DW1 Definition (OS Support Fields) */ | 285 | /* _OSC DW1 Definition (OS Support Fields) */ |
| 269 | #define OSC_EXT_PCI_CONFIG_SUPPORT 1 | 286 | #define OSC_EXT_PCI_CONFIG_SUPPORT 1 |
| 270 | #define OSC_ACTIVE_STATE_PWR_SUPPORT 2 | 287 | #define OSC_ACTIVE_STATE_PWR_SUPPORT 2 |
| 271 | #define OSC_CLOCK_PWR_CAPABILITY_SUPPORT 4 | 288 | #define OSC_CLOCK_PWR_CAPABILITY_SUPPORT 4 |
| 272 | #define OSC_PCI_SEGMENT_GROUPS_SUPPORT 8 | 289 | #define OSC_PCI_SEGMENT_GROUPS_SUPPORT 8 |
| 273 | #define OSC_MSI_SUPPORT 16 | 290 | #define OSC_MSI_SUPPORT 16 |
| 291 | #define OSC_PCI_SUPPORT_MASKS 0x1f | ||
| 274 | 292 | ||
| 275 | /* _OSC DW1 Definition (OS Control Fields) */ | 293 | /* _OSC DW1 Definition (OS Control Fields) */ |
| 276 | #define OSC_PCI_EXPRESS_NATIVE_HP_CONTROL 1 | 294 | #define OSC_PCI_EXPRESS_NATIVE_HP_CONTROL 1 |
| @@ -279,7 +297,7 @@ void __init acpi_s4_no_nvs(void); | |||
| 279 | #define OSC_PCI_EXPRESS_AER_CONTROL 8 | 297 | #define OSC_PCI_EXPRESS_AER_CONTROL 8 |
| 280 | #define OSC_PCI_EXPRESS_CAP_STRUCTURE_CONTROL 16 | 298 | #define OSC_PCI_EXPRESS_CAP_STRUCTURE_CONTROL 16 |
| 281 | 299 | ||
| 282 | #define OSC_CONTROL_MASKS (OSC_PCI_EXPRESS_NATIVE_HP_CONTROL | \ | 300 | #define OSC_PCI_CONTROL_MASKS (OSC_PCI_EXPRESS_NATIVE_HP_CONTROL | \ |
| 283 | OSC_SHPC_NATIVE_HP_CONTROL | \ | 301 | OSC_SHPC_NATIVE_HP_CONTROL | \ |
| 284 | OSC_PCI_EXPRESS_PME_CONTROL | \ | 302 | OSC_PCI_EXPRESS_PME_CONTROL | \ |
| 285 | OSC_PCI_EXPRESS_AER_CONTROL | \ | 303 | OSC_PCI_EXPRESS_AER_CONTROL | \ |
| @@ -303,9 +321,9 @@ static inline int acpi_boot_init(void) | |||
| 303 | return 0; | 321 | return 0; |
| 304 | } | 322 | } |
| 305 | 323 | ||
| 306 | static inline int acpi_boot_table_init(void) | 324 | static inline void acpi_boot_table_init(void) |
| 307 | { | 325 | { |
| 308 | return 0; | 326 | return; |
| 309 | } | 327 | } |
| 310 | 328 | ||
| 311 | static inline int acpi_mps_check(void) | 329 | static inline int acpi_mps_check(void) |
diff --git a/include/linux/aio.h b/include/linux/aio.h index aea219d7d8d1..811dbb369379 100644 --- a/include/linux/aio.h +++ b/include/linux/aio.h | |||
| @@ -102,7 +102,6 @@ struct kiocb { | |||
| 102 | } ki_obj; | 102 | } ki_obj; |
| 103 | 103 | ||
| 104 | __u64 ki_user_data; /* user's data for completion */ | 104 | __u64 ki_user_data; /* user's data for completion */ |
| 105 | wait_queue_t ki_wait; | ||
| 106 | loff_t ki_pos; | 105 | loff_t ki_pos; |
| 107 | 106 | ||
| 108 | void *private; | 107 | void *private; |
| @@ -140,7 +139,6 @@ struct kiocb { | |||
| 140 | (x)->ki_dtor = NULL; \ | 139 | (x)->ki_dtor = NULL; \ |
| 141 | (x)->ki_obj.tsk = tsk; \ | 140 | (x)->ki_obj.tsk = tsk; \ |
| 142 | (x)->ki_user_data = 0; \ | 141 | (x)->ki_user_data = 0; \ |
| 143 | init_wait((&(x)->ki_wait)); \ | ||
| 144 | } while (0) | 142 | } while (0) |
| 145 | 143 | ||
| 146 | #define AIO_RING_MAGIC 0xa10a10a1 | 144 | #define AIO_RING_MAGIC 0xa10a10a1 |
| @@ -223,8 +221,6 @@ struct mm_struct; | |||
| 223 | static inline void exit_aio(struct mm_struct *mm) { } | 221 | static inline void exit_aio(struct mm_struct *mm) { } |
| 224 | #endif /* CONFIG_AIO */ | 222 | #endif /* CONFIG_AIO */ |
| 225 | 223 | ||
| 226 | #define io_wait_to_kiocb(wait) container_of(wait, struct kiocb, ki_wait) | ||
| 227 | |||
| 228 | static inline struct kiocb *list_kiocb(struct list_head *h) | 224 | static inline struct kiocb *list_kiocb(struct list_head *h) |
| 229 | { | 225 | { |
| 230 | return list_entry(h, struct kiocb, ki_list); | 226 | return list_entry(h, struct kiocb, ki_list); |
diff --git a/include/linux/amba/bus.h b/include/linux/amba/bus.h index ab94335b4bb9..8b1038607831 100644 --- a/include/linux/amba/bus.h +++ b/include/linux/amba/bus.h | |||
| @@ -1,5 +1,9 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * linux/include/asm-arm/hardware/amba.h | 2 | * linux/include/amba/bus.h |
| 3 | * | ||
| 4 | * This device type deals with ARM PrimeCells and anything else that | ||
| 5 | * presents a proper CID (0xB105F00D) at the end of the I/O register | ||
| 6 | * region or that is derived from a PrimeCell. | ||
| 3 | * | 7 | * |
| 4 | * Copyright (C) 2003 Deep Blue Solutions Ltd, All Rights Reserved. | 8 | * Copyright (C) 2003 Deep Blue Solutions Ltd, All Rights Reserved. |
| 5 | * | 9 | * |
| @@ -10,6 +14,9 @@ | |||
| 10 | #ifndef ASMARM_AMBA_H | 14 | #ifndef ASMARM_AMBA_H |
| 11 | #define ASMARM_AMBA_H | 15 | #define ASMARM_AMBA_H |
| 12 | 16 | ||
| 17 | #include <linux/device.h> | ||
| 18 | #include <linux/resource.h> | ||
| 19 | |||
| 13 | #define AMBA_NR_IRQS 2 | 20 | #define AMBA_NR_IRQS 2 |
| 14 | 21 | ||
| 15 | struct amba_device { | 22 | struct amba_device { |
diff --git a/include/linux/amba/clcd.h b/include/linux/amba/clcd.h index 29c0448265cf..ca16c3801a1e 100644 --- a/include/linux/amba/clcd.h +++ b/include/linux/amba/clcd.h | |||
| @@ -21,22 +21,21 @@ | |||
| 21 | #define CLCD_UBAS 0x00000010 | 21 | #define CLCD_UBAS 0x00000010 |
| 22 | #define CLCD_LBAS 0x00000014 | 22 | #define CLCD_LBAS 0x00000014 |
| 23 | 23 | ||
| 24 | #if !defined(CONFIG_ARCH_VERSATILE) && !defined(CONFIG_ARCH_REALVIEW) | 24 | #define CLCD_PL110_IENB 0x00000018 |
| 25 | #define CLCD_IENB 0x00000018 | 25 | #define CLCD_PL110_CNTL 0x0000001c |
| 26 | #define CLCD_CNTL 0x0000001c | 26 | #define CLCD_PL110_STAT 0x00000020 |
| 27 | #else | 27 | #define CLCD_PL110_INTR 0x00000024 |
| 28 | /* | 28 | #define CLCD_PL110_UCUR 0x00000028 |
| 29 | * Someone rearranged these two registers on the Versatile | 29 | #define CLCD_PL110_LCUR 0x0000002C |
| 30 | * platform... | 30 | |
| 31 | */ | 31 | #define CLCD_PL111_CNTL 0x00000018 |
| 32 | #define CLCD_IENB 0x0000001c | 32 | #define CLCD_PL111_IENB 0x0000001c |
| 33 | #define CLCD_CNTL 0x00000018 | 33 | #define CLCD_PL111_RIS 0x00000020 |
| 34 | #endif | 34 | #define CLCD_PL111_MIS 0x00000024 |
| 35 | 35 | #define CLCD_PL111_ICR 0x00000028 | |
| 36 | #define CLCD_STAT 0x00000020 | 36 | #define CLCD_PL111_UCUR 0x0000002c |
| 37 | #define CLCD_INTR 0x00000024 | 37 | #define CLCD_PL111_LCUR 0x00000030 |
| 38 | #define CLCD_UCUR 0x00000028 | 38 | |
| 39 | #define CLCD_LCUR 0x0000002C | ||
| 40 | #define CLCD_PALL 0x00000200 | 39 | #define CLCD_PALL 0x00000200 |
| 41 | #define CLCD_PALETTE 0x00000200 | 40 | #define CLCD_PALETTE 0x00000200 |
| 42 | 41 | ||
| @@ -147,6 +146,8 @@ struct clcd_fb { | |||
| 147 | struct clcd_board *board; | 146 | struct clcd_board *board; |
| 148 | void *board_data; | 147 | void *board_data; |
| 149 | void __iomem *regs; | 148 | void __iomem *regs; |
| 149 | u16 off_ienb; | ||
| 150 | u16 off_cntl; | ||
| 150 | u32 clcd_cntl; | 151 | u32 clcd_cntl; |
| 151 | u32 cmap[16]; | 152 | u32 cmap[16]; |
| 152 | }; | 153 | }; |
diff --git a/include/linux/amba/pl061.h b/include/linux/amba/pl061.h index b4fbd9862606..5ddd9ad4b19c 100644 --- a/include/linux/amba/pl061.h +++ b/include/linux/amba/pl061.h | |||
| @@ -1,3 +1,5 @@ | |||
| 1 | #include <linux/types.h> | ||
| 2 | |||
| 1 | /* platform data for the PL061 GPIO driver */ | 3 | /* platform data for the PL061 GPIO driver */ |
| 2 | 4 | ||
| 3 | struct pl061_platform_data { | 5 | struct pl061_platform_data { |
diff --git a/include/linux/ata.h b/include/linux/ata.h index 4fb357312b3b..700c5b9b3583 100644 --- a/include/linux/ata.h +++ b/include/linux/ata.h | |||
| @@ -75,6 +75,7 @@ enum { | |||
| 75 | ATA_ID_EIDE_DMA_TIME = 66, | 75 | ATA_ID_EIDE_DMA_TIME = 66, |
| 76 | ATA_ID_EIDE_PIO = 67, | 76 | ATA_ID_EIDE_PIO = 67, |
| 77 | ATA_ID_EIDE_PIO_IORDY = 68, | 77 | ATA_ID_EIDE_PIO_IORDY = 68, |
| 78 | ATA_ID_ADDITIONAL_SUPP = 69, | ||
| 78 | ATA_ID_QUEUE_DEPTH = 75, | 79 | ATA_ID_QUEUE_DEPTH = 75, |
| 79 | ATA_ID_MAJOR_VER = 80, | 80 | ATA_ID_MAJOR_VER = 80, |
| 80 | ATA_ID_COMMAND_SET_1 = 82, | 81 | ATA_ID_COMMAND_SET_1 = 82, |
| @@ -87,6 +88,7 @@ enum { | |||
| 87 | ATA_ID_HW_CONFIG = 93, | 88 | ATA_ID_HW_CONFIG = 93, |
| 88 | ATA_ID_SPG = 98, | 89 | ATA_ID_SPG = 98, |
| 89 | ATA_ID_LBA_CAPACITY_2 = 100, | 90 | ATA_ID_LBA_CAPACITY_2 = 100, |
| 91 | ATA_ID_SECTOR_SIZE = 106, | ||
| 90 | ATA_ID_LAST_LUN = 126, | 92 | ATA_ID_LAST_LUN = 126, |
| 91 | ATA_ID_DLF = 128, | 93 | ATA_ID_DLF = 128, |
| 92 | ATA_ID_CSFO = 129, | 94 | ATA_ID_CSFO = 129, |
| @@ -638,6 +640,18 @@ static inline int ata_id_flush_ext_enabled(const u16 *id) | |||
| 638 | return (id[ATA_ID_CFS_ENABLE_2] & 0x2400) == 0x2400; | 640 | return (id[ATA_ID_CFS_ENABLE_2] & 0x2400) == 0x2400; |
| 639 | } | 641 | } |
| 640 | 642 | ||
| 643 | static inline int ata_id_has_large_logical_sectors(const u16 *id) | ||
| 644 | { | ||
| 645 | if ((id[ATA_ID_SECTOR_SIZE] & 0xc000) != 0x4000) | ||
| 646 | return 0; | ||
| 647 | return id[ATA_ID_SECTOR_SIZE] & (1 << 13); | ||
| 648 | } | ||
| 649 | |||
| 650 | static inline u16 ata_id_logical_per_physical_sectors(const u16 *id) | ||
| 651 | { | ||
| 652 | return 1 << (id[ATA_ID_SECTOR_SIZE] & 0xf); | ||
| 653 | } | ||
| 654 | |||
| 641 | static inline int ata_id_has_lba48(const u16 *id) | 655 | static inline int ata_id_has_lba48(const u16 *id) |
| 642 | { | 656 | { |
| 643 | if ((id[ATA_ID_COMMAND_SET_2] & 0xC000) != 0x4000) | 657 | if ((id[ATA_ID_COMMAND_SET_2] & 0xC000) != 0x4000) |
| @@ -803,6 +817,16 @@ static inline int ata_id_has_trim(const u16 *id) | |||
| 803 | return 0; | 817 | return 0; |
| 804 | } | 818 | } |
| 805 | 819 | ||
| 820 | static inline int ata_id_has_zero_after_trim(const u16 *id) | ||
| 821 | { | ||
| 822 | /* DSM supported, deterministic read, and read zero after trim set */ | ||
| 823 | if (ata_id_has_trim(id) && | ||
| 824 | (id[ATA_ID_ADDITIONAL_SUPP] & 0x4020) == 0x4020) | ||
| 825 | return 1; | ||
| 826 | |||
| 827 | return 0; | ||
| 828 | } | ||
| 829 | |||
| 806 | static inline int ata_id_current_chs_valid(const u16 *id) | 830 | static inline int ata_id_current_chs_valid(const u16 *id) |
| 807 | { | 831 | { |
| 808 | /* For ATA-1 devices, if the INITIALIZE DEVICE PARAMETERS command | 832 | /* For ATA-1 devices, if the INITIALIZE DEVICE PARAMETERS command |
| @@ -817,7 +841,8 @@ static inline int ata_id_current_chs_valid(const u16 *id) | |||
| 817 | 841 | ||
| 818 | static inline int ata_id_is_cfa(const u16 *id) | 842 | static inline int ata_id_is_cfa(const u16 *id) |
| 819 | { | 843 | { |
| 820 | if (id[ATA_ID_CONFIG] == 0x848A) /* Traditional CF */ | 844 | if ((id[ATA_ID_CONFIG] == 0x848A) || /* Traditional CF */ |
| 845 | (id[ATA_ID_CONFIG] == 0x844A)) /* Delkin Devices CF */ | ||
| 821 | return 1; | 846 | return 1; |
| 822 | /* | 847 | /* |
| 823 | * CF specs don't require specific value in the word 0 anymore and yet | 848 | * CF specs don't require specific value in the word 0 anymore and yet |
| @@ -958,17 +983,17 @@ static inline void ata_id_to_hd_driveid(u16 *id) | |||
| 958 | } | 983 | } |
| 959 | 984 | ||
| 960 | /* | 985 | /* |
| 961 | * Write up to 'max' LBA Range Entries to the buffer that will cover the | 986 | * Write LBA Range Entries to the buffer that will cover the extent from |
| 962 | * extent from sector to sector + count. This is used for TRIM and for | 987 | * sector to sector + count. This is used for TRIM and for ADD LBA(S) |
| 963 | * ADD LBA(S) TO NV CACHE PINNED SET. | 988 | * TO NV CACHE PINNED SET. |
| 964 | */ | 989 | */ |
| 965 | static inline unsigned ata_set_lba_range_entries(void *_buffer, unsigned max, | 990 | static inline unsigned ata_set_lba_range_entries(void *_buffer, |
| 966 | u64 sector, unsigned long count) | 991 | unsigned buf_size, u64 sector, unsigned long count) |
| 967 | { | 992 | { |
| 968 | __le64 *buffer = _buffer; | 993 | __le64 *buffer = _buffer; |
| 969 | unsigned i = 0; | 994 | unsigned i = 0, used_bytes; |
| 970 | 995 | ||
| 971 | while (i < max) { | 996 | while (i < buf_size / 8 ) { /* 6-byte LBA + 2-byte range per entry */ |
| 972 | u64 entry = sector | | 997 | u64 entry = sector | |
| 973 | ((u64)(count > 0xffff ? 0xffff : count) << 48); | 998 | ((u64)(count > 0xffff ? 0xffff : count) << 48); |
| 974 | buffer[i++] = __cpu_to_le64(entry); | 999 | buffer[i++] = __cpu_to_le64(entry); |
| @@ -978,9 +1003,9 @@ static inline unsigned ata_set_lba_range_entries(void *_buffer, unsigned max, | |||
| 978 | sector += 0xffff; | 1003 | sector += 0xffff; |
| 979 | } | 1004 | } |
| 980 | 1005 | ||
| 981 | max = ALIGN(i * 8, 512); | 1006 | used_bytes = ALIGN(i * 8, 512); |
| 982 | memset(buffer + i, 0, max - i * 8); | 1007 | memset(buffer + i, 0, used_bytes - i * 8); |
| 983 | return max; | 1008 | return used_bytes; |
| 984 | } | 1009 | } |
| 985 | 1010 | ||
| 986 | static inline int is_multi_taskfile(struct ata_taskfile *tf) | 1011 | static inline int is_multi_taskfile(struct ata_taskfile *tf) |
| @@ -1000,8 +1025,8 @@ static inline int ata_ok(u8 status) | |||
| 1000 | 1025 | ||
| 1001 | static inline int lba_28_ok(u64 block, u32 n_block) | 1026 | static inline int lba_28_ok(u64 block, u32 n_block) |
| 1002 | { | 1027 | { |
| 1003 | /* check the ending block number */ | 1028 | /* check the ending block number: must be LESS THAN 0x0fffffff */ |
| 1004 | return ((block + n_block) < ((u64)1 << 28)) && (n_block <= 256); | 1029 | return ((block + n_block) < ((1 << 28) - 1)) && (n_block <= 256); |
| 1005 | } | 1030 | } |
| 1006 | 1031 | ||
| 1007 | static inline int lba_48_ok(u64 block, u32 n_block) | 1032 | static inline int lba_48_ok(u64 block, u32 n_block) |
diff --git a/include/linux/atmel-mci.h b/include/linux/atmel-mci.h index 57b1846a3c87..3e09b345f4d6 100644 --- a/include/linux/atmel-mci.h +++ b/include/linux/atmel-mci.h | |||
| @@ -3,8 +3,6 @@ | |||
| 3 | 3 | ||
| 4 | #define ATMEL_MCI_MAX_NR_SLOTS 2 | 4 | #define ATMEL_MCI_MAX_NR_SLOTS 2 |
| 5 | 5 | ||
| 6 | #include <linux/dw_dmac.h> | ||
| 7 | |||
| 8 | /** | 6 | /** |
| 9 | * struct mci_slot_pdata - board-specific per-slot configuration | 7 | * struct mci_slot_pdata - board-specific per-slot configuration |
| 10 | * @bus_width: Number of data lines wired up the slot | 8 | * @bus_width: Number of data lines wired up the slot |
| @@ -34,7 +32,7 @@ struct mci_slot_pdata { | |||
| 34 | * @slot: Per-slot configuration data. | 32 | * @slot: Per-slot configuration data. |
| 35 | */ | 33 | */ |
| 36 | struct mci_platform_data { | 34 | struct mci_platform_data { |
| 37 | struct dw_dma_slave dma_slave; | 35 | struct mci_dma_data *dma_slave; |
| 38 | struct mci_slot_pdata slot[ATMEL_MCI_MAX_NR_SLOTS]; | 36 | struct mci_slot_pdata slot[ATMEL_MCI_MAX_NR_SLOTS]; |
| 39 | }; | 37 | }; |
| 40 | 38 | ||
diff --git a/include/linux/audit.h b/include/linux/audit.h index 3c7a358241a7..f391d45c8aea 100644 --- a/include/linux/audit.h +++ b/include/linux/audit.h | |||
| @@ -424,7 +424,7 @@ extern void audit_syscall_exit(int failed, long return_code); | |||
| 424 | extern void __audit_getname(const char *name); | 424 | extern void __audit_getname(const char *name); |
| 425 | extern void audit_putname(const char *name); | 425 | extern void audit_putname(const char *name); |
| 426 | extern void __audit_inode(const char *name, const struct dentry *dentry); | 426 | extern void __audit_inode(const char *name, const struct dentry *dentry); |
| 427 | extern void __audit_inode_child(const char *dname, const struct dentry *dentry, | 427 | extern void __audit_inode_child(const struct dentry *dentry, |
| 428 | const struct inode *parent); | 428 | const struct inode *parent); |
| 429 | extern void __audit_ptrace(struct task_struct *t); | 429 | extern void __audit_ptrace(struct task_struct *t); |
| 430 | 430 | ||
| @@ -442,11 +442,10 @@ static inline void audit_inode(const char *name, const struct dentry *dentry) { | |||
| 442 | if (unlikely(!audit_dummy_context())) | 442 | if (unlikely(!audit_dummy_context())) |
| 443 | __audit_inode(name, dentry); | 443 | __audit_inode(name, dentry); |
| 444 | } | 444 | } |
| 445 | static inline void audit_inode_child(const char *dname, | 445 | static inline void audit_inode_child(const struct dentry *dentry, |
| 446 | const struct dentry *dentry, | ||
| 447 | const struct inode *parent) { | 446 | const struct inode *parent) { |
| 448 | if (unlikely(!audit_dummy_context())) | 447 | if (unlikely(!audit_dummy_context())) |
| 449 | __audit_inode_child(dname, dentry, parent); | 448 | __audit_inode_child(dentry, parent); |
| 450 | } | 449 | } |
| 451 | void audit_core_dumps(long signr); | 450 | void audit_core_dumps(long signr); |
| 452 | 451 | ||
| @@ -544,9 +543,9 @@ extern int audit_signals; | |||
| 544 | #define audit_getname(n) do { ; } while (0) | 543 | #define audit_getname(n) do { ; } while (0) |
| 545 | #define audit_putname(n) do { ; } while (0) | 544 | #define audit_putname(n) do { ; } while (0) |
| 546 | #define __audit_inode(n,d) do { ; } while (0) | 545 | #define __audit_inode(n,d) do { ; } while (0) |
| 547 | #define __audit_inode_child(d,i,p) do { ; } while (0) | 546 | #define __audit_inode_child(i,p) do { ; } while (0) |
| 548 | #define audit_inode(n,d) do { ; } while (0) | 547 | #define audit_inode(n,d) do { ; } while (0) |
| 549 | #define audit_inode_child(d,i,p) do { ; } while (0) | 548 | #define audit_inode_child(i,p) do { ; } while (0) |
| 550 | #define audit_core_dumps(i) do { ; } while (0) | 549 | #define audit_core_dumps(i) do { ; } while (0) |
| 551 | #define auditsc_get_stamp(c,t,s) (0) | 550 | #define auditsc_get_stamp(c,t,s) (0) |
| 552 | #define audit_get_loginuid(t) (-1) | 551 | #define audit_get_loginuid(t) (-1) |
diff --git a/include/linux/backing-dev.h b/include/linux/backing-dev.h index b449e738533a..bd0e3c6f323f 100644 --- a/include/linux/backing-dev.h +++ b/include/linux/backing-dev.h | |||
| @@ -101,6 +101,7 @@ int bdi_register(struct backing_dev_info *bdi, struct device *parent, | |||
| 101 | const char *fmt, ...); | 101 | const char *fmt, ...); |
| 102 | int bdi_register_dev(struct backing_dev_info *bdi, dev_t dev); | 102 | int bdi_register_dev(struct backing_dev_info *bdi, dev_t dev); |
| 103 | void bdi_unregister(struct backing_dev_info *bdi); | 103 | void bdi_unregister(struct backing_dev_info *bdi); |
| 104 | int bdi_setup_and_register(struct backing_dev_info *, char *, unsigned int); | ||
| 104 | void bdi_start_writeback(struct backing_dev_info *bdi, struct super_block *sb, | 105 | void bdi_start_writeback(struct backing_dev_info *bdi, struct super_block *sb, |
| 105 | long nr_pages); | 106 | long nr_pages); |
| 106 | int bdi_writeback_task(struct bdi_writeback *wb); | 107 | int bdi_writeback_task(struct bdi_writeback *wb); |
| @@ -246,6 +247,7 @@ int bdi_set_max_ratio(struct backing_dev_info *bdi, unsigned int max_ratio); | |||
| 246 | #endif | 247 | #endif |
| 247 | 248 | ||
| 248 | extern struct backing_dev_info default_backing_dev_info; | 249 | extern struct backing_dev_info default_backing_dev_info; |
| 250 | extern struct backing_dev_info noop_backing_dev_info; | ||
| 249 | void default_unplug_io_fn(struct backing_dev_info *bdi, struct page *page); | 251 | void default_unplug_io_fn(struct backing_dev_info *bdi, struct page *page); |
| 250 | 252 | ||
| 251 | int writeback_in_progress(struct backing_dev_info *bdi); | 253 | int writeback_in_progress(struct backing_dev_info *bdi); |
| @@ -331,4 +333,17 @@ static inline int bdi_sched_wait(void *word) | |||
| 331 | return 0; | 333 | return 0; |
| 332 | } | 334 | } |
| 333 | 335 | ||
| 336 | static inline void blk_run_backing_dev(struct backing_dev_info *bdi, | ||
| 337 | struct page *page) | ||
| 338 | { | ||
| 339 | if (bdi && bdi->unplug_io_fn) | ||
| 340 | bdi->unplug_io_fn(bdi, page); | ||
| 341 | } | ||
| 342 | |||
| 343 | static inline void blk_run_address_space(struct address_space *mapping) | ||
| 344 | { | ||
| 345 | if (mapping) | ||
| 346 | blk_run_backing_dev(mapping->backing_dev_info, NULL); | ||
| 347 | } | ||
| 348 | |||
| 334 | #endif /* _LINUX_BACKING_DEV_H */ | 349 | #endif /* _LINUX_BACKING_DEV_H */ |
diff --git a/include/linux/backlight.h b/include/linux/backlight.h index 0f5f57858a23..4a3d52e545e1 100644 --- a/include/linux/backlight.h +++ b/include/linux/backlight.h | |||
| @@ -47,7 +47,7 @@ struct backlight_ops { | |||
| 47 | int (*get_brightness)(struct backlight_device *); | 47 | int (*get_brightness)(struct backlight_device *); |
| 48 | /* Check if given framebuffer device is the one bound to this backlight; | 48 | /* Check if given framebuffer device is the one bound to this backlight; |
| 49 | return 0 if not, !=0 if it is. If NULL, backlight always matches the fb. */ | 49 | return 0 if not, !=0 if it is. If NULL, backlight always matches the fb. */ |
| 50 | int (*check_fb)(struct fb_info *); | 50 | int (*check_fb)(struct backlight_device *, struct fb_info *); |
| 51 | }; | 51 | }; |
| 52 | 52 | ||
| 53 | /* This structure defines all the properties of a backlight */ | 53 | /* This structure defines all the properties of a backlight */ |
| @@ -86,7 +86,7 @@ struct backlight_device { | |||
| 86 | registered this device has been unloaded, and if class_get_devdata() | 86 | registered this device has been unloaded, and if class_get_devdata() |
| 87 | points to something in the body of that driver, it is also invalid. */ | 87 | points to something in the body of that driver, it is also invalid. */ |
| 88 | struct mutex ops_lock; | 88 | struct mutex ops_lock; |
| 89 | struct backlight_ops *ops; | 89 | const struct backlight_ops *ops; |
| 90 | 90 | ||
| 91 | /* The framebuffer notifier block */ | 91 | /* The framebuffer notifier block */ |
| 92 | struct notifier_block fb_notif; | 92 | struct notifier_block fb_notif; |
| @@ -103,7 +103,8 @@ static inline void backlight_update_status(struct backlight_device *bd) | |||
| 103 | } | 103 | } |
| 104 | 104 | ||
| 105 | extern struct backlight_device *backlight_device_register(const char *name, | 105 | extern struct backlight_device *backlight_device_register(const char *name, |
| 106 | struct device *dev, void *devdata, struct backlight_ops *ops); | 106 | struct device *dev, void *devdata, const struct backlight_ops *ops, |
| 107 | const struct backlight_properties *props); | ||
| 107 | extern void backlight_device_unregister(struct backlight_device *bd); | 108 | extern void backlight_device_unregister(struct backlight_device *bd); |
| 108 | extern void backlight_force_update(struct backlight_device *bd, | 109 | extern void backlight_force_update(struct backlight_device *bd, |
| 109 | enum backlight_update_reason reason); | 110 | enum backlight_update_reason reason); |
diff --git a/include/linux/binfmts.h b/include/linux/binfmts.h index aece486ac734..c809e286d213 100644 --- a/include/linux/binfmts.h +++ b/include/linux/binfmts.h | |||
| @@ -68,6 +68,15 @@ struct linux_binprm{ | |||
| 68 | 68 | ||
| 69 | #define BINPRM_MAX_RECURSION 4 | 69 | #define BINPRM_MAX_RECURSION 4 |
| 70 | 70 | ||
| 71 | /* Function parameter for binfmt->coredump */ | ||
| 72 | struct coredump_params { | ||
| 73 | long signr; | ||
| 74 | struct pt_regs *regs; | ||
| 75 | struct file *file; | ||
| 76 | unsigned long limit; | ||
| 77 | unsigned long mm_flags; | ||
| 78 | }; | ||
| 79 | |||
| 71 | /* | 80 | /* |
| 72 | * This structure defines the functions that are used to load the binary formats that | 81 | * This structure defines the functions that are used to load the binary formats that |
| 73 | * linux accepts. | 82 | * linux accepts. |
| @@ -77,7 +86,7 @@ struct linux_binfmt { | |||
| 77 | struct module *module; | 86 | struct module *module; |
| 78 | int (*load_binary)(struct linux_binprm *, struct pt_regs * regs); | 87 | int (*load_binary)(struct linux_binprm *, struct pt_regs * regs); |
| 79 | int (*load_shlib)(struct file *); | 88 | int (*load_shlib)(struct file *); |
| 80 | int (*core_dump)(long signr, struct pt_regs *regs, struct file *file, unsigned long limit); | 89 | int (*core_dump)(struct coredump_params *cprm); |
| 81 | unsigned long min_coredump; /* minimal dump size */ | 90 | unsigned long min_coredump; /* minimal dump size */ |
| 82 | int hasvdso; | 91 | int hasvdso; |
| 83 | }; | 92 | }; |
| @@ -101,6 +110,7 @@ extern int prepare_binprm(struct linux_binprm *); | |||
| 101 | extern int __must_check remove_arg_zero(struct linux_binprm *); | 110 | extern int __must_check remove_arg_zero(struct linux_binprm *); |
| 102 | extern int search_binary_handler(struct linux_binprm *,struct pt_regs *); | 111 | extern int search_binary_handler(struct linux_binprm *,struct pt_regs *); |
| 103 | extern int flush_old_exec(struct linux_binprm * bprm); | 112 | extern int flush_old_exec(struct linux_binprm * bprm); |
| 113 | extern void setup_new_exec(struct linux_binprm * bprm); | ||
| 104 | 114 | ||
| 105 | extern int suid_dumpable; | 115 | extern int suid_dumpable; |
| 106 | #define SUID_DUMP_DISABLE 0 /* No setuid dumping */ | 116 | #define SUID_DUMP_DISABLE 0 /* No setuid dumping */ |
diff --git a/include/linux/bio.h b/include/linux/bio.h index 5be93f18d842..7fc5606e6ea5 100644 --- a/include/linux/bio.h +++ b/include/linux/bio.h | |||
| @@ -391,6 +391,18 @@ extern struct bio *bio_copy_kern(struct request_queue *, void *, unsigned int, | |||
| 391 | gfp_t, int); | 391 | gfp_t, int); |
| 392 | extern void bio_set_pages_dirty(struct bio *bio); | 392 | extern void bio_set_pages_dirty(struct bio *bio); |
| 393 | extern void bio_check_pages_dirty(struct bio *bio); | 393 | extern void bio_check_pages_dirty(struct bio *bio); |
| 394 | |||
| 395 | #ifndef ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE | ||
| 396 | # error "You should define ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE for your platform" | ||
| 397 | #endif | ||
| 398 | #if ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE | ||
| 399 | extern void bio_flush_dcache_pages(struct bio *bi); | ||
| 400 | #else | ||
| 401 | static inline void bio_flush_dcache_pages(struct bio *bi) | ||
| 402 | { | ||
| 403 | } | ||
| 404 | #endif | ||
| 405 | |||
| 394 | extern struct bio *bio_copy_user(struct request_queue *, struct rq_map_data *, | 406 | extern struct bio *bio_copy_user(struct request_queue *, struct rq_map_data *, |
| 395 | unsigned long, unsigned int, int, gfp_t); | 407 | unsigned long, unsigned int, int, gfp_t); |
| 396 | extern struct bio *bio_copy_user_iov(struct request_queue *, | 408 | extern struct bio *bio_copy_user_iov(struct request_queue *, |
| @@ -450,11 +462,8 @@ extern struct biovec_slab bvec_slabs[BIOVEC_NR_POOLS] __read_mostly; | |||
| 450 | /* | 462 | /* |
| 451 | * remember never ever reenable interrupts between a bvec_kmap_irq and | 463 | * remember never ever reenable interrupts between a bvec_kmap_irq and |
| 452 | * bvec_kunmap_irq! | 464 | * bvec_kunmap_irq! |
| 453 | * | ||
| 454 | * This function MUST be inlined - it plays with the CPU interrupt flags. | ||
| 455 | */ | 465 | */ |
| 456 | static __always_inline char *bvec_kmap_irq(struct bio_vec *bvec, | 466 | static inline char *bvec_kmap_irq(struct bio_vec *bvec, unsigned long *flags) |
| 457 | unsigned long *flags) | ||
| 458 | { | 467 | { |
| 459 | unsigned long addr; | 468 | unsigned long addr; |
| 460 | 469 | ||
| @@ -470,8 +479,7 @@ static __always_inline char *bvec_kmap_irq(struct bio_vec *bvec, | |||
| 470 | return (char *) addr + bvec->bv_offset; | 479 | return (char *) addr + bvec->bv_offset; |
| 471 | } | 480 | } |
| 472 | 481 | ||
| 473 | static __always_inline void bvec_kunmap_irq(char *buffer, | 482 | static inline void bvec_kunmap_irq(char *buffer, unsigned long *flags) |
| 474 | unsigned long *flags) | ||
| 475 | { | 483 | { |
| 476 | unsigned long ptr = (unsigned long) buffer & PAGE_MASK; | 484 | unsigned long ptr = (unsigned long) buffer & PAGE_MASK; |
| 477 | 485 | ||
diff --git a/include/linux/bitmap.h b/include/linux/bitmap.h index 756d78b8c1c5..daf8c480c786 100644 --- a/include/linux/bitmap.h +++ b/include/linux/bitmap.h | |||
| @@ -42,6 +42,9 @@ | |||
| 42 | * bitmap_empty(src, nbits) Are all bits zero in *src? | 42 | * bitmap_empty(src, nbits) Are all bits zero in *src? |
| 43 | * bitmap_full(src, nbits) Are all bits set in *src? | 43 | * bitmap_full(src, nbits) Are all bits set in *src? |
| 44 | * bitmap_weight(src, nbits) Hamming Weight: number set bits | 44 | * bitmap_weight(src, nbits) Hamming Weight: number set bits |
| 45 | * bitmap_set(dst, pos, nbits) Set specified bit area | ||
| 46 | * bitmap_clear(dst, pos, nbits) Clear specified bit area | ||
| 47 | * bitmap_find_next_zero_area(buf, len, pos, n, mask) Find bit free area | ||
| 45 | * bitmap_shift_right(dst, src, n, nbits) *dst = *src >> n | 48 | * bitmap_shift_right(dst, src, n, nbits) *dst = *src >> n |
| 46 | * bitmap_shift_left(dst, src, n, nbits) *dst = *src << n | 49 | * bitmap_shift_left(dst, src, n, nbits) *dst = *src << n |
| 47 | * bitmap_remap(dst, src, old, new, nbits) *dst = map(old, new)(src) | 50 | * bitmap_remap(dst, src, old, new, nbits) *dst = map(old, new)(src) |
| @@ -108,6 +111,14 @@ extern int __bitmap_subset(const unsigned long *bitmap1, | |||
| 108 | const unsigned long *bitmap2, int bits); | 111 | const unsigned long *bitmap2, int bits); |
| 109 | extern int __bitmap_weight(const unsigned long *bitmap, int bits); | 112 | extern int __bitmap_weight(const unsigned long *bitmap, int bits); |
| 110 | 113 | ||
| 114 | extern void bitmap_set(unsigned long *map, int i, int len); | ||
| 115 | extern void bitmap_clear(unsigned long *map, int start, int nr); | ||
| 116 | extern unsigned long bitmap_find_next_zero_area(unsigned long *map, | ||
| 117 | unsigned long size, | ||
| 118 | unsigned long start, | ||
| 119 | unsigned int nr, | ||
| 120 | unsigned long align_mask); | ||
| 121 | |||
| 111 | extern int bitmap_scnprintf(char *buf, unsigned int len, | 122 | extern int bitmap_scnprintf(char *buf, unsigned int len, |
| 112 | const unsigned long *src, int nbits); | 123 | const unsigned long *src, int nbits); |
| 113 | extern int __bitmap_parse(const char *buf, unsigned int buflen, int is_user, | 124 | extern int __bitmap_parse(const char *buf, unsigned int buflen, int is_user, |
diff --git a/include/linux/bitops.h b/include/linux/bitops.h index c05a29cb9bb2..b796eab5ca75 100644 --- a/include/linux/bitops.h +++ b/include/linux/bitops.h | |||
| @@ -16,16 +16,15 @@ | |||
| 16 | */ | 16 | */ |
| 17 | #include <asm/bitops.h> | 17 | #include <asm/bitops.h> |
| 18 | 18 | ||
| 19 | #define for_each_bit(bit, addr, size) \ | 19 | #define for_each_set_bit(bit, addr, size) \ |
| 20 | for ((bit) = find_first_bit((addr), (size)); \ | 20 | for ((bit) = find_first_bit((addr), (size)); \ |
| 21 | (bit) < (size); \ | 21 | (bit) < (size); \ |
| 22 | (bit) = find_next_bit((addr), (size), (bit) + 1)) | 22 | (bit) = find_next_bit((addr), (size), (bit) + 1)) |
| 23 | 23 | ||
| 24 | |||
| 25 | static __inline__ int get_bitmask_order(unsigned int count) | 24 | static __inline__ int get_bitmask_order(unsigned int count) |
| 26 | { | 25 | { |
| 27 | int order; | 26 | int order; |
| 28 | 27 | ||
| 29 | order = fls(count); | 28 | order = fls(count); |
| 30 | return order; /* We could be slightly more clever with -1 here... */ | 29 | return order; /* We could be slightly more clever with -1 here... */ |
| 31 | } | 30 | } |
| @@ -33,7 +32,7 @@ static __inline__ int get_bitmask_order(unsigned int count) | |||
| 33 | static __inline__ int get_count_order(unsigned int count) | 32 | static __inline__ int get_count_order(unsigned int count) |
| 34 | { | 33 | { |
| 35 | int order; | 34 | int order; |
| 36 | 35 | ||
| 37 | order = fls(count) - 1; | 36 | order = fls(count) - 1; |
| 38 | if (count & (count - 1)) | 37 | if (count & (count - 1)) |
| 39 | order++; | 38 | order++; |
| @@ -45,6 +44,31 @@ static inline unsigned long hweight_long(unsigned long w) | |||
| 45 | return sizeof(w) == 4 ? hweight32(w) : hweight64(w); | 44 | return sizeof(w) == 4 ? hweight32(w) : hweight64(w); |
| 46 | } | 45 | } |
| 47 | 46 | ||
| 47 | /* | ||
| 48 | * Clearly slow versions of the hweightN() functions, their benefit is | ||
| 49 | * of course compile time evaluation of constant arguments. | ||
| 50 | */ | ||
| 51 | #define HWEIGHT8(w) \ | ||
| 52 | ( BUILD_BUG_ON_ZERO(!__builtin_constant_p(w)) + \ | ||
| 53 | (!!((w) & (1ULL << 0))) + \ | ||
| 54 | (!!((w) & (1ULL << 1))) + \ | ||
| 55 | (!!((w) & (1ULL << 2))) + \ | ||
| 56 | (!!((w) & (1ULL << 3))) + \ | ||
| 57 | (!!((w) & (1ULL << 4))) + \ | ||
| 58 | (!!((w) & (1ULL << 5))) + \ | ||
| 59 | (!!((w) & (1ULL << 6))) + \ | ||
| 60 | (!!((w) & (1ULL << 7))) ) | ||
| 61 | |||
| 62 | #define HWEIGHT16(w) (HWEIGHT8(w) + HWEIGHT8((w) >> 8)) | ||
| 63 | #define HWEIGHT32(w) (HWEIGHT16(w) + HWEIGHT16((w) >> 16)) | ||
| 64 | #define HWEIGHT64(w) (HWEIGHT32(w) + HWEIGHT32((w) >> 32)) | ||
| 65 | |||
| 66 | /* | ||
| 67 | * Type invariant version that simply casts things to the | ||
| 68 | * largest type. | ||
| 69 | */ | ||
| 70 | #define HWEIGHT(w) HWEIGHT64((u64)(w)) | ||
| 71 | |||
| 48 | /** | 72 | /** |
| 49 | * rol32 - rotate a 32-bit value left | 73 | * rol32 - rotate a 32-bit value left |
| 50 | * @word: value to rotate | 74 | * @word: value to rotate |
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index 221cecd86bd3..6690e8bae7bb 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h | |||
| @@ -158,7 +158,6 @@ enum rq_flag_bits { | |||
| 158 | struct request { | 158 | struct request { |
| 159 | struct list_head queuelist; | 159 | struct list_head queuelist; |
| 160 | struct call_single_data csd; | 160 | struct call_single_data csd; |
| 161 | int cpu; | ||
| 162 | 161 | ||
| 163 | struct request_queue *q; | 162 | struct request_queue *q; |
| 164 | 163 | ||
| @@ -166,9 +165,11 @@ struct request { | |||
| 166 | enum rq_cmd_type_bits cmd_type; | 165 | enum rq_cmd_type_bits cmd_type; |
| 167 | unsigned long atomic_flags; | 166 | unsigned long atomic_flags; |
| 168 | 167 | ||
| 168 | int cpu; | ||
| 169 | |||
| 169 | /* the following two fields are internal, NEVER access directly */ | 170 | /* the following two fields are internal, NEVER access directly */ |
| 170 | sector_t __sector; /* sector cursor */ | ||
| 171 | unsigned int __data_len; /* total data len */ | 171 | unsigned int __data_len; /* total data len */ |
| 172 | sector_t __sector; /* sector cursor */ | ||
| 172 | 173 | ||
| 173 | struct bio *bio; | 174 | struct bio *bio; |
| 174 | struct bio *biotail; | 175 | struct bio *biotail; |
| @@ -201,20 +202,20 @@ struct request { | |||
| 201 | 202 | ||
| 202 | unsigned short ioprio; | 203 | unsigned short ioprio; |
| 203 | 204 | ||
| 205 | int ref_count; | ||
| 206 | |||
| 204 | void *special; /* opaque pointer available for LLD use */ | 207 | void *special; /* opaque pointer available for LLD use */ |
| 205 | char *buffer; /* kaddr of the current segment if available */ | 208 | char *buffer; /* kaddr of the current segment if available */ |
| 206 | 209 | ||
| 207 | int tag; | 210 | int tag; |
| 208 | int errors; | 211 | int errors; |
| 209 | 212 | ||
| 210 | int ref_count; | ||
| 211 | |||
| 212 | /* | 213 | /* |
| 213 | * when request is used as a packet command carrier | 214 | * when request is used as a packet command carrier |
| 214 | */ | 215 | */ |
| 215 | unsigned short cmd_len; | ||
| 216 | unsigned char __cmd[BLK_MAX_CDB]; | 216 | unsigned char __cmd[BLK_MAX_CDB]; |
| 217 | unsigned char *cmd; | 217 | unsigned char *cmd; |
| 218 | unsigned short cmd_len; | ||
| 218 | 219 | ||
| 219 | unsigned int extra_len; /* length of alignment and padding */ | 220 | unsigned int extra_len; /* length of alignment and padding */ |
| 220 | unsigned int sense_len; | 221 | unsigned int sense_len; |
| @@ -312,13 +313,16 @@ struct queue_limits { | |||
| 312 | unsigned int io_min; | 313 | unsigned int io_min; |
| 313 | unsigned int io_opt; | 314 | unsigned int io_opt; |
| 314 | unsigned int max_discard_sectors; | 315 | unsigned int max_discard_sectors; |
| 316 | unsigned int discard_granularity; | ||
| 317 | unsigned int discard_alignment; | ||
| 315 | 318 | ||
| 316 | unsigned short logical_block_size; | 319 | unsigned short logical_block_size; |
| 317 | unsigned short max_hw_segments; | 320 | unsigned short max_segments; |
| 318 | unsigned short max_phys_segments; | ||
| 319 | 321 | ||
| 320 | unsigned char misaligned; | 322 | unsigned char misaligned; |
| 323 | unsigned char discard_misaligned; | ||
| 321 | unsigned char no_cluster; | 324 | unsigned char no_cluster; |
| 325 | signed char discard_zeroes_data; | ||
| 322 | }; | 326 | }; |
| 323 | 327 | ||
| 324 | struct request_queue | 328 | struct request_queue |
| @@ -457,8 +461,8 @@ struct request_queue | |||
| 457 | #define QUEUE_FLAG_NONROT 14 /* non-rotational device (SSD) */ | 461 | #define QUEUE_FLAG_NONROT 14 /* non-rotational device (SSD) */ |
| 458 | #define QUEUE_FLAG_VIRT QUEUE_FLAG_NONROT /* paravirt device */ | 462 | #define QUEUE_FLAG_VIRT QUEUE_FLAG_NONROT /* paravirt device */ |
| 459 | #define QUEUE_FLAG_IO_STAT 15 /* do IO stats */ | 463 | #define QUEUE_FLAG_IO_STAT 15 /* do IO stats */ |
| 460 | #define QUEUE_FLAG_CQ 16 /* hardware does queuing */ | 464 | #define QUEUE_FLAG_DISCARD 16 /* supports DISCARD */ |
| 461 | #define QUEUE_FLAG_DISCARD 17 /* supports DISCARD */ | 465 | #define QUEUE_FLAG_NOXMERGES 17 /* No extended merges */ |
| 462 | 466 | ||
| 463 | #define QUEUE_FLAG_DEFAULT ((1 << QUEUE_FLAG_IO_STAT) | \ | 467 | #define QUEUE_FLAG_DEFAULT ((1 << QUEUE_FLAG_IO_STAT) | \ |
| 464 | (1 << QUEUE_FLAG_CLUSTER) | \ | 468 | (1 << QUEUE_FLAG_CLUSTER) | \ |
| @@ -582,9 +586,10 @@ enum { | |||
| 582 | 586 | ||
| 583 | #define blk_queue_plugged(q) test_bit(QUEUE_FLAG_PLUGGED, &(q)->queue_flags) | 587 | #define blk_queue_plugged(q) test_bit(QUEUE_FLAG_PLUGGED, &(q)->queue_flags) |
| 584 | #define blk_queue_tagged(q) test_bit(QUEUE_FLAG_QUEUED, &(q)->queue_flags) | 588 | #define blk_queue_tagged(q) test_bit(QUEUE_FLAG_QUEUED, &(q)->queue_flags) |
| 585 | #define blk_queue_queuing(q) test_bit(QUEUE_FLAG_CQ, &(q)->queue_flags) | ||
| 586 | #define blk_queue_stopped(q) test_bit(QUEUE_FLAG_STOPPED, &(q)->queue_flags) | 589 | #define blk_queue_stopped(q) test_bit(QUEUE_FLAG_STOPPED, &(q)->queue_flags) |
| 587 | #define blk_queue_nomerges(q) test_bit(QUEUE_FLAG_NOMERGES, &(q)->queue_flags) | 590 | #define blk_queue_nomerges(q) test_bit(QUEUE_FLAG_NOMERGES, &(q)->queue_flags) |
| 591 | #define blk_queue_noxmerges(q) \ | ||
| 592 | test_bit(QUEUE_FLAG_NOXMERGES, &(q)->queue_flags) | ||
| 588 | #define blk_queue_nonrot(q) test_bit(QUEUE_FLAG_NONROT, &(q)->queue_flags) | 593 | #define blk_queue_nonrot(q) test_bit(QUEUE_FLAG_NONROT, &(q)->queue_flags) |
| 589 | #define blk_queue_io_stat(q) test_bit(QUEUE_FLAG_IO_STAT, &(q)->queue_flags) | 594 | #define blk_queue_io_stat(q) test_bit(QUEUE_FLAG_IO_STAT, &(q)->queue_flags) |
| 590 | #define blk_queue_flushing(q) ((q)->ordseq) | 595 | #define blk_queue_flushing(q) ((q)->ordseq) |
| @@ -749,6 +754,17 @@ struct req_iterator { | |||
| 749 | #define rq_iter_last(rq, _iter) \ | 754 | #define rq_iter_last(rq, _iter) \ |
| 750 | (_iter.bio->bi_next == NULL && _iter.i == _iter.bio->bi_vcnt-1) | 755 | (_iter.bio->bi_next == NULL && _iter.i == _iter.bio->bi_vcnt-1) |
| 751 | 756 | ||
| 757 | #ifndef ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE | ||
| 758 | # error "You should define ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE for your platform" | ||
| 759 | #endif | ||
| 760 | #if ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE | ||
| 761 | extern void rq_flush_dcache_pages(struct request *rq); | ||
| 762 | #else | ||
| 763 | static inline void rq_flush_dcache_pages(struct request *rq) | ||
| 764 | { | ||
| 765 | } | ||
| 766 | #endif | ||
| 767 | |||
| 752 | extern int blk_register_queue(struct gendisk *disk); | 768 | extern int blk_register_queue(struct gendisk *disk); |
| 753 | extern void blk_unregister_queue(struct gendisk *disk); | 769 | extern void blk_unregister_queue(struct gendisk *disk); |
| 754 | extern void register_disk(struct gendisk *dev); | 770 | extern void register_disk(struct gendisk *dev); |
| @@ -823,19 +839,6 @@ static inline struct request_queue *bdev_get_queue(struct block_device *bdev) | |||
| 823 | return bdev->bd_disk->queue; | 839 | return bdev->bd_disk->queue; |
| 824 | } | 840 | } |
| 825 | 841 | ||
| 826 | static inline void blk_run_backing_dev(struct backing_dev_info *bdi, | ||
| 827 | struct page *page) | ||
| 828 | { | ||
| 829 | if (bdi && bdi->unplug_io_fn) | ||
| 830 | bdi->unplug_io_fn(bdi, page); | ||
| 831 | } | ||
| 832 | |||
| 833 | static inline void blk_run_address_space(struct address_space *mapping) | ||
| 834 | { | ||
| 835 | if (mapping) | ||
| 836 | blk_run_backing_dev(mapping->backing_dev_info, NULL); | ||
| 837 | } | ||
| 838 | |||
| 839 | /* | 842 | /* |
| 840 | * blk_rq_pos() : the current sector | 843 | * blk_rq_pos() : the current sector |
| 841 | * blk_rq_bytes() : bytes left in the entire request | 844 | * blk_rq_bytes() : bytes left in the entire request |
| @@ -843,7 +846,6 @@ static inline void blk_run_address_space(struct address_space *mapping) | |||
| 843 | * blk_rq_err_bytes() : bytes left till the next error boundary | 846 | * blk_rq_err_bytes() : bytes left till the next error boundary |
| 844 | * blk_rq_sectors() : sectors left in the entire request | 847 | * blk_rq_sectors() : sectors left in the entire request |
| 845 | * blk_rq_cur_sectors() : sectors left in the current segment | 848 | * blk_rq_cur_sectors() : sectors left in the current segment |
| 846 | * blk_rq_err_sectors() : sectors left till the next error boundary | ||
| 847 | */ | 849 | */ |
| 848 | static inline sector_t blk_rq_pos(const struct request *rq) | 850 | static inline sector_t blk_rq_pos(const struct request *rq) |
| 849 | { | 851 | { |
| @@ -872,11 +874,6 @@ static inline unsigned int blk_rq_cur_sectors(const struct request *rq) | |||
| 872 | return blk_rq_cur_bytes(rq) >> 9; | 874 | return blk_rq_cur_bytes(rq) >> 9; |
| 873 | } | 875 | } |
| 874 | 876 | ||
| 875 | static inline unsigned int blk_rq_err_sectors(const struct request *rq) | ||
| 876 | { | ||
| 877 | return blk_rq_err_bytes(rq) >> 9; | ||
| 878 | } | ||
| 879 | |||
| 880 | /* | 877 | /* |
| 881 | * Request issue related functions. | 878 | * Request issue related functions. |
| 882 | */ | 879 | */ |
| @@ -924,10 +921,8 @@ extern struct request_queue *blk_init_queue(request_fn_proc *, spinlock_t *); | |||
| 924 | extern void blk_cleanup_queue(struct request_queue *); | 921 | extern void blk_cleanup_queue(struct request_queue *); |
| 925 | extern void blk_queue_make_request(struct request_queue *, make_request_fn *); | 922 | extern void blk_queue_make_request(struct request_queue *, make_request_fn *); |
| 926 | extern void blk_queue_bounce_limit(struct request_queue *, u64); | 923 | extern void blk_queue_bounce_limit(struct request_queue *, u64); |
| 927 | extern void blk_queue_max_sectors(struct request_queue *, unsigned int); | ||
| 928 | extern void blk_queue_max_hw_sectors(struct request_queue *, unsigned int); | 924 | extern void blk_queue_max_hw_sectors(struct request_queue *, unsigned int); |
| 929 | extern void blk_queue_max_phys_segments(struct request_queue *, unsigned short); | 925 | extern void blk_queue_max_segments(struct request_queue *, unsigned short); |
| 930 | extern void blk_queue_max_hw_segments(struct request_queue *, unsigned short); | ||
| 931 | extern void blk_queue_max_segment_size(struct request_queue *, unsigned int); | 926 | extern void blk_queue_max_segment_size(struct request_queue *, unsigned int); |
| 932 | extern void blk_queue_max_discard_sectors(struct request_queue *q, | 927 | extern void blk_queue_max_discard_sectors(struct request_queue *q, |
| 933 | unsigned int max_discard_sectors); | 928 | unsigned int max_discard_sectors); |
| @@ -942,6 +937,8 @@ extern void blk_queue_io_opt(struct request_queue *q, unsigned int opt); | |||
| 942 | extern void blk_set_default_limits(struct queue_limits *lim); | 937 | extern void blk_set_default_limits(struct queue_limits *lim); |
| 943 | extern int blk_stack_limits(struct queue_limits *t, struct queue_limits *b, | 938 | extern int blk_stack_limits(struct queue_limits *t, struct queue_limits *b, |
| 944 | sector_t offset); | 939 | sector_t offset); |
| 940 | extern int bdev_stack_limits(struct queue_limits *t, struct block_device *bdev, | ||
| 941 | sector_t offset); | ||
| 945 | extern void disk_stack_limits(struct gendisk *disk, struct block_device *bdev, | 942 | extern void disk_stack_limits(struct gendisk *disk, struct block_device *bdev, |
| 946 | sector_t offset); | 943 | sector_t offset); |
| 947 | extern void blk_queue_stack_limits(struct request_queue *t, struct request_queue *b); | 944 | extern void blk_queue_stack_limits(struct request_queue *t, struct request_queue *b); |
| @@ -1015,14 +1012,13 @@ static inline int sb_issue_discard(struct super_block *sb, | |||
| 1015 | 1012 | ||
| 1016 | extern int blk_verify_command(unsigned char *cmd, fmode_t has_write_perm); | 1013 | extern int blk_verify_command(unsigned char *cmd, fmode_t has_write_perm); |
| 1017 | 1014 | ||
| 1018 | #define MAX_PHYS_SEGMENTS 128 | 1015 | enum blk_default_limits { |
| 1019 | #define MAX_HW_SEGMENTS 128 | 1016 | BLK_MAX_SEGMENTS = 128, |
| 1020 | #define SAFE_MAX_SECTORS 255 | 1017 | BLK_SAFE_MAX_SECTORS = 255, |
| 1021 | #define BLK_DEF_MAX_SECTORS 1024 | 1018 | BLK_DEF_MAX_SECTORS = 1024, |
| 1022 | 1019 | BLK_MAX_SEGMENT_SIZE = 65536, | |
| 1023 | #define MAX_SEGMENT_SIZE 65536 | 1020 | BLK_SEG_BOUNDARY_MASK = 0xFFFFFFFFUL, |
| 1024 | 1021 | }; | |
| 1025 | #define BLK_SEG_BOUNDARY_MASK 0xFFFFFFFFUL | ||
| 1026 | 1022 | ||
| 1027 | #define blkdev_entry_to_request(entry) list_entry((entry), struct request, queuelist) | 1023 | #define blkdev_entry_to_request(entry) list_entry((entry), struct request, queuelist) |
| 1028 | 1024 | ||
| @@ -1046,14 +1042,9 @@ static inline unsigned int queue_max_hw_sectors(struct request_queue *q) | |||
| 1046 | return q->limits.max_hw_sectors; | 1042 | return q->limits.max_hw_sectors; |
| 1047 | } | 1043 | } |
| 1048 | 1044 | ||
| 1049 | static inline unsigned short queue_max_hw_segments(struct request_queue *q) | 1045 | static inline unsigned short queue_max_segments(struct request_queue *q) |
| 1050 | { | ||
| 1051 | return q->limits.max_hw_segments; | ||
| 1052 | } | ||
| 1053 | |||
| 1054 | static inline unsigned short queue_max_phys_segments(struct request_queue *q) | ||
| 1055 | { | 1046 | { |
| 1056 | return q->limits.max_phys_segments; | 1047 | return q->limits.max_segments; |
| 1057 | } | 1048 | } |
| 1058 | 1049 | ||
| 1059 | static inline unsigned int queue_max_segment_size(struct request_queue *q) | 1050 | static inline unsigned int queue_max_segment_size(struct request_queue *q) |
| @@ -1114,11 +1105,13 @@ static inline int queue_alignment_offset(struct request_queue *q) | |||
| 1114 | return q->limits.alignment_offset; | 1105 | return q->limits.alignment_offset; |
| 1115 | } | 1106 | } |
| 1116 | 1107 | ||
| 1117 | static inline int queue_sector_alignment_offset(struct request_queue *q, | 1108 | static inline int queue_limit_alignment_offset(struct queue_limits *lim, sector_t sector) |
| 1118 | sector_t sector) | ||
| 1119 | { | 1109 | { |
| 1120 | return ((sector << 9) - q->limits.alignment_offset) | 1110 | unsigned int granularity = max(lim->physical_block_size, lim->io_min); |
| 1121 | & (q->limits.io_min - 1); | 1111 | unsigned int alignment = (sector << 9) & (granularity - 1); |
| 1112 | |||
| 1113 | return (granularity + lim->alignment_offset - alignment) | ||
| 1114 | & (granularity - 1); | ||
| 1122 | } | 1115 | } |
| 1123 | 1116 | ||
| 1124 | static inline int bdev_alignment_offset(struct block_device *bdev) | 1117 | static inline int bdev_alignment_offset(struct block_device *bdev) |
| @@ -1134,6 +1127,35 @@ static inline int bdev_alignment_offset(struct block_device *bdev) | |||
| 1134 | return q->limits.alignment_offset; | 1127 | return q->limits.alignment_offset; |
| 1135 | } | 1128 | } |
| 1136 | 1129 | ||
| 1130 | static inline int queue_discard_alignment(struct request_queue *q) | ||
| 1131 | { | ||
| 1132 | if (q->limits.discard_misaligned) | ||
| 1133 | return -1; | ||
| 1134 | |||
| 1135 | return q->limits.discard_alignment; | ||
| 1136 | } | ||
| 1137 | |||
| 1138 | static inline int queue_limit_discard_alignment(struct queue_limits *lim, sector_t sector) | ||
| 1139 | { | ||
| 1140 | unsigned int alignment = (sector << 9) & (lim->discard_granularity - 1); | ||
| 1141 | |||
| 1142 | return (lim->discard_granularity + lim->discard_alignment - alignment) | ||
| 1143 | & (lim->discard_granularity - 1); | ||
| 1144 | } | ||
| 1145 | |||
| 1146 | static inline unsigned int queue_discard_zeroes_data(struct request_queue *q) | ||
| 1147 | { | ||
| 1148 | if (q->limits.discard_zeroes_data == 1) | ||
| 1149 | return 1; | ||
| 1150 | |||
| 1151 | return 0; | ||
| 1152 | } | ||
| 1153 | |||
| 1154 | static inline unsigned int bdev_discard_zeroes_data(struct block_device *bdev) | ||
| 1155 | { | ||
| 1156 | return queue_discard_zeroes_data(bdev_get_queue(bdev)); | ||
| 1157 | } | ||
| 1158 | |||
| 1137 | static inline int queue_dma_alignment(struct request_queue *q) | 1159 | static inline int queue_dma_alignment(struct request_queue *q) |
| 1138 | { | 1160 | { |
| 1139 | return q ? q->dma_alignment : 511; | 1161 | return q ? q->dma_alignment : 511; |
diff --git a/include/linux/blktrace_api.h b/include/linux/blktrace_api.h index 3b73b9992b26..416bf62d6d46 100644 --- a/include/linux/blktrace_api.h +++ b/include/linux/blktrace_api.h | |||
| @@ -150,8 +150,8 @@ struct blk_user_trace_setup { | |||
| 150 | struct blk_trace { | 150 | struct blk_trace { |
| 151 | int trace_state; | 151 | int trace_state; |
| 152 | struct rchan *rchan; | 152 | struct rchan *rchan; |
| 153 | unsigned long *sequence; | 153 | unsigned long __percpu *sequence; |
| 154 | unsigned char *msg_data; | 154 | unsigned char __percpu *msg_data; |
| 155 | u16 act_mask; | 155 | u16 act_mask; |
| 156 | u64 start_lba; | 156 | u64 start_lba; |
| 157 | u64 end_lba; | 157 | u64 end_lba; |
diff --git a/include/linux/bootmem.h b/include/linux/bootmem.h index dd97fb8408a8..266ab9291232 100644 --- a/include/linux/bootmem.h +++ b/include/linux/bootmem.h | |||
| @@ -23,6 +23,7 @@ extern unsigned long max_pfn; | |||
| 23 | extern unsigned long saved_max_pfn; | 23 | extern unsigned long saved_max_pfn; |
| 24 | #endif | 24 | #endif |
| 25 | 25 | ||
| 26 | #ifndef CONFIG_NO_BOOTMEM | ||
| 26 | /* | 27 | /* |
| 27 | * node_bootmem_map is a map pointer - the bits represent all physical | 28 | * node_bootmem_map is a map pointer - the bits represent all physical |
| 28 | * memory pages (including holes) on the node. | 29 | * memory pages (including holes) on the node. |
| @@ -37,6 +38,7 @@ typedef struct bootmem_data { | |||
| 37 | } bootmem_data_t; | 38 | } bootmem_data_t; |
| 38 | 39 | ||
| 39 | extern bootmem_data_t bootmem_node_data[]; | 40 | extern bootmem_data_t bootmem_node_data[]; |
| 41 | #endif | ||
| 40 | 42 | ||
| 41 | extern unsigned long bootmem_bootmap_pages(unsigned long); | 43 | extern unsigned long bootmem_bootmap_pages(unsigned long); |
| 42 | 44 | ||
| @@ -46,6 +48,7 @@ extern unsigned long init_bootmem_node(pg_data_t *pgdat, | |||
| 46 | unsigned long endpfn); | 48 | unsigned long endpfn); |
| 47 | extern unsigned long init_bootmem(unsigned long addr, unsigned long memend); | 49 | extern unsigned long init_bootmem(unsigned long addr, unsigned long memend); |
| 48 | 50 | ||
| 51 | unsigned long free_all_memory_core_early(int nodeid); | ||
| 49 | extern unsigned long free_all_bootmem_node(pg_data_t *pgdat); | 52 | extern unsigned long free_all_bootmem_node(pg_data_t *pgdat); |
| 50 | extern unsigned long free_all_bootmem(void); | 53 | extern unsigned long free_all_bootmem(void); |
| 51 | 54 | ||
| @@ -53,6 +56,7 @@ extern void free_bootmem_node(pg_data_t *pgdat, | |||
| 53 | unsigned long addr, | 56 | unsigned long addr, |
| 54 | unsigned long size); | 57 | unsigned long size); |
| 55 | extern void free_bootmem(unsigned long addr, unsigned long size); | 58 | extern void free_bootmem(unsigned long addr, unsigned long size); |
| 59 | extern void free_bootmem_late(unsigned long addr, unsigned long size); | ||
| 56 | 60 | ||
| 57 | /* | 61 | /* |
| 58 | * Flags for reserve_bootmem (also if CONFIG_HAVE_ARCH_BOOTMEM_NODE, | 62 | * Flags for reserve_bootmem (also if CONFIG_HAVE_ARCH_BOOTMEM_NODE, |
| @@ -83,6 +87,10 @@ extern void *__alloc_bootmem_node(pg_data_t *pgdat, | |||
| 83 | unsigned long size, | 87 | unsigned long size, |
| 84 | unsigned long align, | 88 | unsigned long align, |
| 85 | unsigned long goal); | 89 | unsigned long goal); |
| 90 | void *__alloc_bootmem_node_high(pg_data_t *pgdat, | ||
| 91 | unsigned long size, | ||
| 92 | unsigned long align, | ||
| 93 | unsigned long goal); | ||
| 86 | extern void *__alloc_bootmem_node_nopanic(pg_data_t *pgdat, | 94 | extern void *__alloc_bootmem_node_nopanic(pg_data_t *pgdat, |
| 87 | unsigned long size, | 95 | unsigned long size, |
| 88 | unsigned long align, | 96 | unsigned long align, |
diff --git a/include/linux/brcmphy.h b/include/linux/brcmphy.h index 9b64b6d67873..7f437ca1ed44 100644 --- a/include/linux/brcmphy.h +++ b/include/linux/brcmphy.h | |||
| @@ -1,6 +1,24 @@ | |||
| 1 | #define PHY_BRCM_WIRESPEED_ENABLE 0x00000001 | 1 | #define PHY_ID_BCM50610 0x0143bd60 |
| 2 | #define PHY_BRCM_AUTO_PWRDWN_ENABLE 0x00000002 | 2 | #define PHY_ID_BCM50610M 0x0143bd70 |
| 3 | #define PHY_BRCM_APD_CLK125_ENABLE 0x00000004 | 3 | #define PHY_ID_BCMAC131 0x0143bc70 |
| 4 | #define PHY_BRCM_STD_IBND_DISABLE 0x00000008 | 4 | #define PHY_ID_BCM57780 0x03625d90 |
| 5 | #define PHY_BRCM_EXT_IBND_RX_ENABLE 0x00000010 | 5 | |
| 6 | #define PHY_BRCM_EXT_IBND_TX_ENABLE 0x00000020 | 6 | #define PHY_BCM_OUI_MASK 0xfffffc00 |
| 7 | #define PHY_BCM_OUI_1 0x00206000 | ||
| 8 | #define PHY_BCM_OUI_2 0x0143bc00 | ||
| 9 | #define PHY_BCM_OUI_3 0x03625c00 | ||
| 10 | |||
| 11 | |||
| 12 | #define PHY_BCM_FLAGS_MODE_COPPER 0x00000001 | ||
| 13 | #define PHY_BCM_FLAGS_MODE_1000BX 0x00000002 | ||
| 14 | #define PHY_BCM_FLAGS_INTF_SGMII 0x00000010 | ||
| 15 | #define PHY_BCM_FLAGS_INTF_XAUI 0x00000020 | ||
| 16 | #define PHY_BRCM_WIRESPEED_ENABLE 0x00000100 | ||
| 17 | #define PHY_BRCM_AUTO_PWRDWN_ENABLE 0x00000200 | ||
| 18 | #define PHY_BRCM_RX_REFCLK_UNUSED 0x00000400 | ||
| 19 | #define PHY_BRCM_STD_IBND_DISABLE 0x00000800 | ||
| 20 | #define PHY_BRCM_EXT_IBND_RX_ENABLE 0x00001000 | ||
| 21 | #define PHY_BRCM_EXT_IBND_TX_ENABLE 0x00002000 | ||
| 22 | #define PHY_BRCM_CLEAR_RGMII_MODE 0x00004000 | ||
| 23 | #define PHY_BRCM_DIS_TXCRXC_NOENRGY 0x00008000 | ||
| 24 | #define PHY_BCM_FLAGS_VALID 0x80000000 | ||
diff --git a/include/linux/btree-128.h b/include/linux/btree-128.h new file mode 100644 index 000000000000..0b3414c4c928 --- /dev/null +++ b/include/linux/btree-128.h | |||
| @@ -0,0 +1,109 @@ | |||
| 1 | extern struct btree_geo btree_geo128; | ||
| 2 | |||
| 3 | struct btree_head128 { struct btree_head h; }; | ||
| 4 | |||
| 5 | static inline void btree_init_mempool128(struct btree_head128 *head, | ||
| 6 | mempool_t *mempool) | ||
| 7 | { | ||
| 8 | btree_init_mempool(&head->h, mempool); | ||
| 9 | } | ||
| 10 | |||
| 11 | static inline int btree_init128(struct btree_head128 *head) | ||
| 12 | { | ||
| 13 | return btree_init(&head->h); | ||
| 14 | } | ||
| 15 | |||
| 16 | static inline void btree_destroy128(struct btree_head128 *head) | ||
| 17 | { | ||
| 18 | btree_destroy(&head->h); | ||
| 19 | } | ||
| 20 | |||
| 21 | static inline void *btree_lookup128(struct btree_head128 *head, u64 k1, u64 k2) | ||
| 22 | { | ||
| 23 | u64 key[2] = {k1, k2}; | ||
| 24 | return btree_lookup(&head->h, &btree_geo128, (unsigned long *)&key); | ||
| 25 | } | ||
| 26 | |||
| 27 | static inline void *btree_get_prev128(struct btree_head128 *head, | ||
| 28 | u64 *k1, u64 *k2) | ||
| 29 | { | ||
| 30 | u64 key[2] = {*k1, *k2}; | ||
| 31 | void *val; | ||
| 32 | |||
| 33 | val = btree_get_prev(&head->h, &btree_geo128, | ||
| 34 | (unsigned long *)&key); | ||
| 35 | *k1 = key[0]; | ||
| 36 | *k2 = key[1]; | ||
| 37 | return val; | ||
| 38 | } | ||
| 39 | |||
| 40 | static inline int btree_insert128(struct btree_head128 *head, u64 k1, u64 k2, | ||
| 41 | void *val, gfp_t gfp) | ||
| 42 | { | ||
| 43 | u64 key[2] = {k1, k2}; | ||
| 44 | return btree_insert(&head->h, &btree_geo128, | ||
| 45 | (unsigned long *)&key, val, gfp); | ||
| 46 | } | ||
| 47 | |||
| 48 | static inline int btree_update128(struct btree_head128 *head, u64 k1, u64 k2, | ||
| 49 | void *val) | ||
| 50 | { | ||
| 51 | u64 key[2] = {k1, k2}; | ||
| 52 | return btree_update(&head->h, &btree_geo128, | ||
| 53 | (unsigned long *)&key, val); | ||
| 54 | } | ||
| 55 | |||
| 56 | static inline void *btree_remove128(struct btree_head128 *head, u64 k1, u64 k2) | ||
| 57 | { | ||
| 58 | u64 key[2] = {k1, k2}; | ||
| 59 | return btree_remove(&head->h, &btree_geo128, (unsigned long *)&key); | ||
| 60 | } | ||
| 61 | |||
| 62 | static inline void *btree_last128(struct btree_head128 *head, u64 *k1, u64 *k2) | ||
| 63 | { | ||
| 64 | u64 key[2]; | ||
| 65 | void *val; | ||
| 66 | |||
| 67 | val = btree_last(&head->h, &btree_geo128, (unsigned long *)&key[0]); | ||
| 68 | if (val) { | ||
| 69 | *k1 = key[0]; | ||
| 70 | *k2 = key[1]; | ||
| 71 | } | ||
| 72 | |||
| 73 | return val; | ||
| 74 | } | ||
| 75 | |||
| 76 | static inline int btree_merge128(struct btree_head128 *target, | ||
| 77 | struct btree_head128 *victim, | ||
| 78 | gfp_t gfp) | ||
| 79 | { | ||
| 80 | return btree_merge(&target->h, &victim->h, &btree_geo128, gfp); | ||
| 81 | } | ||
| 82 | |||
| 83 | void visitor128(void *elem, unsigned long opaque, unsigned long *__key, | ||
| 84 | size_t index, void *__func); | ||
| 85 | |||
| 86 | typedef void (*visitor128_t)(void *elem, unsigned long opaque, | ||
| 87 | u64 key1, u64 key2, size_t index); | ||
| 88 | |||
| 89 | static inline size_t btree_visitor128(struct btree_head128 *head, | ||
| 90 | unsigned long opaque, | ||
| 91 | visitor128_t func2) | ||
| 92 | { | ||
| 93 | return btree_visitor(&head->h, &btree_geo128, opaque, | ||
| 94 | visitor128, func2); | ||
| 95 | } | ||
| 96 | |||
| 97 | static inline size_t btree_grim_visitor128(struct btree_head128 *head, | ||
| 98 | unsigned long opaque, | ||
| 99 | visitor128_t func2) | ||
| 100 | { | ||
| 101 | return btree_grim_visitor(&head->h, &btree_geo128, opaque, | ||
| 102 | visitor128, func2); | ||
| 103 | } | ||
| 104 | |||
| 105 | #define btree_for_each_safe128(head, k1, k2, val) \ | ||
| 106 | for (val = btree_last128(head, &k1, &k2); \ | ||
| 107 | val; \ | ||
| 108 | val = btree_get_prev128(head, &k1, &k2)) | ||
| 109 | |||
diff --git a/include/linux/btree-type.h b/include/linux/btree-type.h new file mode 100644 index 000000000000..9a1147ef8563 --- /dev/null +++ b/include/linux/btree-type.h | |||
| @@ -0,0 +1,147 @@ | |||
| 1 | #define __BTREE_TP(pfx, type, sfx) pfx ## type ## sfx | ||
| 2 | #define _BTREE_TP(pfx, type, sfx) __BTREE_TP(pfx, type, sfx) | ||
| 3 | #define BTREE_TP(pfx) _BTREE_TP(pfx, BTREE_TYPE_SUFFIX,) | ||
| 4 | #define BTREE_FN(name) BTREE_TP(btree_ ## name) | ||
| 5 | #define BTREE_TYPE_HEAD BTREE_TP(struct btree_head) | ||
| 6 | #define VISITOR_FN BTREE_TP(visitor) | ||
| 7 | #define VISITOR_FN_T _BTREE_TP(visitor, BTREE_TYPE_SUFFIX, _t) | ||
| 8 | |||
| 9 | BTREE_TYPE_HEAD { | ||
| 10 | struct btree_head h; | ||
| 11 | }; | ||
| 12 | |||
| 13 | static inline void BTREE_FN(init_mempool)(BTREE_TYPE_HEAD *head, | ||
| 14 | mempool_t *mempool) | ||
| 15 | { | ||
| 16 | btree_init_mempool(&head->h, mempool); | ||
| 17 | } | ||
| 18 | |||
| 19 | static inline int BTREE_FN(init)(BTREE_TYPE_HEAD *head) | ||
| 20 | { | ||
| 21 | return btree_init(&head->h); | ||
| 22 | } | ||
| 23 | |||
| 24 | static inline void BTREE_FN(destroy)(BTREE_TYPE_HEAD *head) | ||
| 25 | { | ||
| 26 | btree_destroy(&head->h); | ||
| 27 | } | ||
| 28 | |||
| 29 | static inline int BTREE_FN(merge)(BTREE_TYPE_HEAD *target, | ||
| 30 | BTREE_TYPE_HEAD *victim, | ||
| 31 | gfp_t gfp) | ||
| 32 | { | ||
| 33 | return btree_merge(&target->h, &victim->h, BTREE_TYPE_GEO, gfp); | ||
| 34 | } | ||
| 35 | |||
| 36 | #if (BITS_PER_LONG > BTREE_TYPE_BITS) | ||
| 37 | static inline void *BTREE_FN(lookup)(BTREE_TYPE_HEAD *head, BTREE_KEYTYPE key) | ||
| 38 | { | ||
| 39 | unsigned long _key = key; | ||
| 40 | return btree_lookup(&head->h, BTREE_TYPE_GEO, &_key); | ||
| 41 | } | ||
| 42 | |||
| 43 | static inline int BTREE_FN(insert)(BTREE_TYPE_HEAD *head, BTREE_KEYTYPE key, | ||
| 44 | void *val, gfp_t gfp) | ||
| 45 | { | ||
| 46 | unsigned long _key = key; | ||
| 47 | return btree_insert(&head->h, BTREE_TYPE_GEO, &_key, val, gfp); | ||
| 48 | } | ||
| 49 | |||
| 50 | static inline int BTREE_FN(update)(BTREE_TYPE_HEAD *head, BTREE_KEYTYPE key, | ||
| 51 | void *val) | ||
| 52 | { | ||
| 53 | unsigned long _key = key; | ||
| 54 | return btree_update(&head->h, BTREE_TYPE_GEO, &_key, val); | ||
| 55 | } | ||
| 56 | |||
| 57 | static inline void *BTREE_FN(remove)(BTREE_TYPE_HEAD *head, BTREE_KEYTYPE key) | ||
| 58 | { | ||
| 59 | unsigned long _key = key; | ||
| 60 | return btree_remove(&head->h, BTREE_TYPE_GEO, &_key); | ||
| 61 | } | ||
| 62 | |||
| 63 | static inline void *BTREE_FN(last)(BTREE_TYPE_HEAD *head, BTREE_KEYTYPE *key) | ||
| 64 | { | ||
| 65 | unsigned long _key; | ||
| 66 | void *val = btree_last(&head->h, BTREE_TYPE_GEO, &_key); | ||
| 67 | if (val) | ||
| 68 | *key = _key; | ||
| 69 | return val; | ||
| 70 | } | ||
| 71 | |||
| 72 | static inline void *BTREE_FN(get_prev)(BTREE_TYPE_HEAD *head, BTREE_KEYTYPE *key) | ||
| 73 | { | ||
| 74 | unsigned long _key = *key; | ||
| 75 | void *val = btree_get_prev(&head->h, BTREE_TYPE_GEO, &_key); | ||
| 76 | if (val) | ||
| 77 | *key = _key; | ||
| 78 | return val; | ||
| 79 | } | ||
| 80 | #else | ||
| 81 | static inline void *BTREE_FN(lookup)(BTREE_TYPE_HEAD *head, BTREE_KEYTYPE key) | ||
| 82 | { | ||
| 83 | return btree_lookup(&head->h, BTREE_TYPE_GEO, (unsigned long *)&key); | ||
| 84 | } | ||
| 85 | |||
| 86 | static inline int BTREE_FN(insert)(BTREE_TYPE_HEAD *head, BTREE_KEYTYPE key, | ||
| 87 | void *val, gfp_t gfp) | ||
| 88 | { | ||
| 89 | return btree_insert(&head->h, BTREE_TYPE_GEO, (unsigned long *)&key, | ||
| 90 | val, gfp); | ||
| 91 | } | ||
| 92 | |||
| 93 | static inline int BTREE_FN(update)(BTREE_TYPE_HEAD *head, BTREE_KEYTYPE key, | ||
| 94 | void *val) | ||
| 95 | { | ||
| 96 | return btree_update(&head->h, BTREE_TYPE_GEO, (unsigned long *)&key, val); | ||
| 97 | } | ||
| 98 | |||
| 99 | static inline void *BTREE_FN(remove)(BTREE_TYPE_HEAD *head, BTREE_KEYTYPE key) | ||
| 100 | { | ||
| 101 | return btree_remove(&head->h, BTREE_TYPE_GEO, (unsigned long *)&key); | ||
| 102 | } | ||
| 103 | |||
| 104 | static inline void *BTREE_FN(last)(BTREE_TYPE_HEAD *head, BTREE_KEYTYPE *key) | ||
| 105 | { | ||
| 106 | return btree_last(&head->h, BTREE_TYPE_GEO, (unsigned long *)key); | ||
| 107 | } | ||
| 108 | |||
| 109 | static inline void *BTREE_FN(get_prev)(BTREE_TYPE_HEAD *head, BTREE_KEYTYPE *key) | ||
| 110 | { | ||
| 111 | return btree_get_prev(&head->h, BTREE_TYPE_GEO, (unsigned long *)key); | ||
| 112 | } | ||
| 113 | #endif | ||
| 114 | |||
| 115 | void VISITOR_FN(void *elem, unsigned long opaque, unsigned long *key, | ||
| 116 | size_t index, void *__func); | ||
| 117 | |||
| 118 | typedef void (*VISITOR_FN_T)(void *elem, unsigned long opaque, | ||
| 119 | BTREE_KEYTYPE key, size_t index); | ||
| 120 | |||
| 121 | static inline size_t BTREE_FN(visitor)(BTREE_TYPE_HEAD *head, | ||
| 122 | unsigned long opaque, | ||
| 123 | VISITOR_FN_T func2) | ||
| 124 | { | ||
| 125 | return btree_visitor(&head->h, BTREE_TYPE_GEO, opaque, | ||
| 126 | visitorl, func2); | ||
| 127 | } | ||
| 128 | |||
| 129 | static inline size_t BTREE_FN(grim_visitor)(BTREE_TYPE_HEAD *head, | ||
| 130 | unsigned long opaque, | ||
| 131 | VISITOR_FN_T func2) | ||
| 132 | { | ||
| 133 | return btree_grim_visitor(&head->h, BTREE_TYPE_GEO, opaque, | ||
| 134 | visitorl, func2); | ||
| 135 | } | ||
| 136 | |||
| 137 | #undef VISITOR_FN | ||
| 138 | #undef VISITOR_FN_T | ||
| 139 | #undef __BTREE_TP | ||
| 140 | #undef _BTREE_TP | ||
| 141 | #undef BTREE_TP | ||
| 142 | #undef BTREE_FN | ||
| 143 | #undef BTREE_TYPE_HEAD | ||
| 144 | #undef BTREE_TYPE_SUFFIX | ||
| 145 | #undef BTREE_TYPE_GEO | ||
| 146 | #undef BTREE_KEYTYPE | ||
| 147 | #undef BTREE_TYPE_BITS | ||
diff --git a/include/linux/btree.h b/include/linux/btree.h new file mode 100644 index 000000000000..65b5bb058324 --- /dev/null +++ b/include/linux/btree.h | |||
| @@ -0,0 +1,243 @@ | |||
| 1 | #ifndef BTREE_H | ||
| 2 | #define BTREE_H | ||
| 3 | |||
| 4 | #include <linux/kernel.h> | ||
| 5 | #include <linux/mempool.h> | ||
| 6 | |||
| 7 | /** | ||
| 8 | * DOC: B+Tree basics | ||
| 9 | * | ||
| 10 | * A B+Tree is a data structure for looking up arbitrary (currently allowing | ||
| 11 | * unsigned long, u32, u64 and 2 * u64) keys into pointers. The data structure | ||
| 12 | * is described at http://en.wikipedia.org/wiki/B-tree, we currently do not | ||
| 13 | * use binary search to find the key on lookups. | ||
| 14 | * | ||
| 15 | * Each B+Tree consists of a head, that contains bookkeeping information and | ||
| 16 | * a variable number (starting with zero) nodes. Each node contains the keys | ||
| 17 | * and pointers to sub-nodes, or, for leaf nodes, the keys and values for the | ||
| 18 | * tree entries. | ||
| 19 | * | ||
| 20 | * Each node in this implementation has the following layout: | ||
| 21 | * [key1, key2, ..., keyN] [val1, val2, ..., valN] | ||
| 22 | * | ||
| 23 | * Each key here is an array of unsigned longs, geo->no_longs in total. The | ||
| 24 | * number of keys and values (N) is geo->no_pairs. | ||
| 25 | */ | ||
| 26 | |||
| 27 | /** | ||
| 28 | * struct btree_head - btree head | ||
| 29 | * | ||
| 30 | * @node: the first node in the tree | ||
| 31 | * @mempool: mempool used for node allocations | ||
| 32 | * @height: current of the tree | ||
| 33 | */ | ||
| 34 | struct btree_head { | ||
| 35 | unsigned long *node; | ||
| 36 | mempool_t *mempool; | ||
| 37 | int height; | ||
| 38 | }; | ||
| 39 | |||
| 40 | /* btree geometry */ | ||
| 41 | struct btree_geo; | ||
| 42 | |||
| 43 | /** | ||
| 44 | * btree_alloc - allocate function for the mempool | ||
| 45 | * @gfp_mask: gfp mask for the allocation | ||
| 46 | * @pool_data: unused | ||
| 47 | */ | ||
| 48 | void *btree_alloc(gfp_t gfp_mask, void *pool_data); | ||
| 49 | |||
| 50 | /** | ||
| 51 | * btree_free - free function for the mempool | ||
| 52 | * @element: the element to free | ||
| 53 | * @pool_data: unused | ||
| 54 | */ | ||
| 55 | void btree_free(void *element, void *pool_data); | ||
| 56 | |||
| 57 | /** | ||
| 58 | * btree_init_mempool - initialise a btree with given mempool | ||
| 59 | * | ||
| 60 | * @head: the btree head to initialise | ||
| 61 | * @mempool: the mempool to use | ||
| 62 | * | ||
| 63 | * When this function is used, there is no need to destroy | ||
| 64 | * the mempool. | ||
| 65 | */ | ||
| 66 | void btree_init_mempool(struct btree_head *head, mempool_t *mempool); | ||
| 67 | |||
| 68 | /** | ||
| 69 | * btree_init - initialise a btree | ||
| 70 | * | ||
| 71 | * @head: the btree head to initialise | ||
| 72 | * | ||
| 73 | * This function allocates the memory pool that the | ||
| 74 | * btree needs. Returns zero or a negative error code | ||
| 75 | * (-%ENOMEM) when memory allocation fails. | ||
| 76 | * | ||
| 77 | */ | ||
| 78 | int __must_check btree_init(struct btree_head *head); | ||
| 79 | |||
| 80 | /** | ||
| 81 | * btree_destroy - destroy mempool | ||
| 82 | * | ||
| 83 | * @head: the btree head to destroy | ||
| 84 | * | ||
| 85 | * This function destroys the internal memory pool, use only | ||
| 86 | * when using btree_init(), not with btree_init_mempool(). | ||
| 87 | */ | ||
| 88 | void btree_destroy(struct btree_head *head); | ||
| 89 | |||
| 90 | /** | ||
| 91 | * btree_lookup - look up a key in the btree | ||
| 92 | * | ||
| 93 | * @head: the btree to look in | ||
| 94 | * @geo: the btree geometry | ||
| 95 | * @key: the key to look up | ||
| 96 | * | ||
| 97 | * This function returns the value for the given key, or %NULL. | ||
| 98 | */ | ||
| 99 | void *btree_lookup(struct btree_head *head, struct btree_geo *geo, | ||
| 100 | unsigned long *key); | ||
| 101 | |||
| 102 | /** | ||
| 103 | * btree_insert - insert an entry into the btree | ||
| 104 | * | ||
| 105 | * @head: the btree to add to | ||
| 106 | * @geo: the btree geometry | ||
| 107 | * @key: the key to add (must not already be present) | ||
| 108 | * @val: the value to add (must not be %NULL) | ||
| 109 | * @gfp: allocation flags for node allocations | ||
| 110 | * | ||
| 111 | * This function returns 0 if the item could be added, or an | ||
| 112 | * error code if it failed (may fail due to memory pressure). | ||
| 113 | */ | ||
| 114 | int __must_check btree_insert(struct btree_head *head, struct btree_geo *geo, | ||
| 115 | unsigned long *key, void *val, gfp_t gfp); | ||
| 116 | /** | ||
| 117 | * btree_update - update an entry in the btree | ||
| 118 | * | ||
| 119 | * @head: the btree to update | ||
| 120 | * @geo: the btree geometry | ||
| 121 | * @key: the key to update | ||
| 122 | * @val: the value to change it to (must not be %NULL) | ||
| 123 | * | ||
| 124 | * This function returns 0 if the update was successful, or | ||
| 125 | * -%ENOENT if the key could not be found. | ||
| 126 | */ | ||
| 127 | int btree_update(struct btree_head *head, struct btree_geo *geo, | ||
| 128 | unsigned long *key, void *val); | ||
| 129 | /** | ||
| 130 | * btree_remove - remove an entry from the btree | ||
| 131 | * | ||
| 132 | * @head: the btree to update | ||
| 133 | * @geo: the btree geometry | ||
| 134 | * @key: the key to remove | ||
| 135 | * | ||
| 136 | * This function returns the removed entry, or %NULL if the key | ||
| 137 | * could not be found. | ||
| 138 | */ | ||
| 139 | void *btree_remove(struct btree_head *head, struct btree_geo *geo, | ||
| 140 | unsigned long *key); | ||
| 141 | |||
| 142 | /** | ||
| 143 | * btree_merge - merge two btrees | ||
| 144 | * | ||
| 145 | * @target: the tree that gets all the entries | ||
| 146 | * @victim: the tree that gets merged into @target | ||
| 147 | * @geo: the btree geometry | ||
| 148 | * @gfp: allocation flags | ||
| 149 | * | ||
| 150 | * The two trees @target and @victim may not contain the same keys, | ||
| 151 | * that is a bug and triggers a BUG(). This function returns zero | ||
| 152 | * if the trees were merged successfully, and may return a failure | ||
| 153 | * when memory allocation fails, in which case both trees might have | ||
| 154 | * been partially merged, i.e. some entries have been moved from | ||
| 155 | * @victim to @target. | ||
| 156 | */ | ||
| 157 | int btree_merge(struct btree_head *target, struct btree_head *victim, | ||
| 158 | struct btree_geo *geo, gfp_t gfp); | ||
| 159 | |||
| 160 | /** | ||
| 161 | * btree_last - get last entry in btree | ||
| 162 | * | ||
| 163 | * @head: btree head | ||
| 164 | * @geo: btree geometry | ||
| 165 | * @key: last key | ||
| 166 | * | ||
| 167 | * Returns the last entry in the btree, and sets @key to the key | ||
| 168 | * of that entry; returns NULL if the tree is empty, in that case | ||
| 169 | * key is not changed. | ||
| 170 | */ | ||
| 171 | void *btree_last(struct btree_head *head, struct btree_geo *geo, | ||
| 172 | unsigned long *key); | ||
| 173 | |||
| 174 | /** | ||
| 175 | * btree_get_prev - get previous entry | ||
| 176 | * | ||
| 177 | * @head: btree head | ||
| 178 | * @geo: btree geometry | ||
| 179 | * @key: pointer to key | ||
| 180 | * | ||
| 181 | * The function returns the next item right before the value pointed to by | ||
| 182 | * @key, and updates @key with its key, or returns %NULL when there is no | ||
| 183 | * entry with a key smaller than the given key. | ||
| 184 | */ | ||
| 185 | void *btree_get_prev(struct btree_head *head, struct btree_geo *geo, | ||
| 186 | unsigned long *key); | ||
| 187 | |||
| 188 | |||
| 189 | /* internal use, use btree_visitor{l,32,64,128} */ | ||
| 190 | size_t btree_visitor(struct btree_head *head, struct btree_geo *geo, | ||
| 191 | unsigned long opaque, | ||
| 192 | void (*func)(void *elem, unsigned long opaque, | ||
| 193 | unsigned long *key, size_t index, | ||
| 194 | void *func2), | ||
| 195 | void *func2); | ||
| 196 | |||
| 197 | /* internal use, use btree_grim_visitor{l,32,64,128} */ | ||
| 198 | size_t btree_grim_visitor(struct btree_head *head, struct btree_geo *geo, | ||
| 199 | unsigned long opaque, | ||
| 200 | void (*func)(void *elem, unsigned long opaque, | ||
| 201 | unsigned long *key, | ||
| 202 | size_t index, void *func2), | ||
| 203 | void *func2); | ||
| 204 | |||
| 205 | |||
| 206 | #include <linux/btree-128.h> | ||
| 207 | |||
| 208 | extern struct btree_geo btree_geo32; | ||
| 209 | #define BTREE_TYPE_SUFFIX l | ||
| 210 | #define BTREE_TYPE_BITS BITS_PER_LONG | ||
| 211 | #define BTREE_TYPE_GEO &btree_geo32 | ||
| 212 | #define BTREE_KEYTYPE unsigned long | ||
| 213 | #include <linux/btree-type.h> | ||
| 214 | |||
| 215 | #define btree_for_each_safel(head, key, val) \ | ||
| 216 | for (val = btree_lastl(head, &key); \ | ||
| 217 | val; \ | ||
| 218 | val = btree_get_prevl(head, &key)) | ||
| 219 | |||
| 220 | #define BTREE_TYPE_SUFFIX 32 | ||
| 221 | #define BTREE_TYPE_BITS 32 | ||
| 222 | #define BTREE_TYPE_GEO &btree_geo32 | ||
| 223 | #define BTREE_KEYTYPE u32 | ||
| 224 | #include <linux/btree-type.h> | ||
| 225 | |||
| 226 | #define btree_for_each_safe32(head, key, val) \ | ||
| 227 | for (val = btree_last32(head, &key); \ | ||
| 228 | val; \ | ||
| 229 | val = btree_get_prev32(head, &key)) | ||
| 230 | |||
| 231 | extern struct btree_geo btree_geo64; | ||
| 232 | #define BTREE_TYPE_SUFFIX 64 | ||
| 233 | #define BTREE_TYPE_BITS 64 | ||
| 234 | #define BTREE_TYPE_GEO &btree_geo64 | ||
| 235 | #define BTREE_KEYTYPE u64 | ||
| 236 | #include <linux/btree-type.h> | ||
| 237 | |||
| 238 | #define btree_for_each_safe64(head, key, val) \ | ||
| 239 | for (val = btree_last64(head, &key); \ | ||
| 240 | val; \ | ||
| 241 | val = btree_get_prev64(head, &key)) | ||
| 242 | |||
| 243 | #endif | ||
diff --git a/include/linux/can/core.h b/include/linux/can/core.h index 25085cbadcfc..6c507bea275f 100644 --- a/include/linux/can/core.h +++ b/include/linux/can/core.h | |||
| @@ -32,14 +32,12 @@ | |||
| 32 | * struct can_proto - CAN protocol structure | 32 | * struct can_proto - CAN protocol structure |
| 33 | * @type: type argument in socket() syscall, e.g. SOCK_DGRAM. | 33 | * @type: type argument in socket() syscall, e.g. SOCK_DGRAM. |
| 34 | * @protocol: protocol number in socket() syscall. | 34 | * @protocol: protocol number in socket() syscall. |
| 35 | * @capability: capability needed to open the socket, or -1 for no restriction. | ||
| 36 | * @ops: pointer to struct proto_ops for sock->ops. | 35 | * @ops: pointer to struct proto_ops for sock->ops. |
| 37 | * @prot: pointer to struct proto structure. | 36 | * @prot: pointer to struct proto structure. |
| 38 | */ | 37 | */ |
| 39 | struct can_proto { | 38 | struct can_proto { |
| 40 | int type; | 39 | int type; |
| 41 | int protocol; | 40 | int protocol; |
| 42 | int capability; | ||
| 43 | struct proto_ops *ops; | 41 | struct proto_ops *ops; |
| 44 | struct proto *prot; | 42 | struct proto *prot; |
| 45 | }; | 43 | }; |
diff --git a/include/linux/can/dev.h b/include/linux/can/dev.h index 5824b20b5fcb..6e5a7f00223d 100644 --- a/include/linux/can/dev.h +++ b/include/linux/can/dev.h | |||
| @@ -29,8 +29,6 @@ enum can_mode { | |||
| 29 | /* | 29 | /* |
| 30 | * CAN common private data | 30 | * CAN common private data |
| 31 | */ | 31 | */ |
| 32 | #define CAN_ECHO_SKB_MAX 4 | ||
| 33 | |||
| 34 | struct can_priv { | 32 | struct can_priv { |
| 35 | struct can_device_stats can_stats; | 33 | struct can_device_stats can_stats; |
| 36 | 34 | ||
| @@ -40,19 +38,47 @@ struct can_priv { | |||
| 40 | 38 | ||
| 41 | enum can_state state; | 39 | enum can_state state; |
| 42 | u32 ctrlmode; | 40 | u32 ctrlmode; |
| 41 | u32 ctrlmode_supported; | ||
| 43 | 42 | ||
| 44 | int restart_ms; | 43 | int restart_ms; |
| 45 | struct timer_list restart_timer; | 44 | struct timer_list restart_timer; |
| 46 | 45 | ||
| 47 | struct sk_buff *echo_skb[CAN_ECHO_SKB_MAX]; | ||
| 48 | |||
| 49 | int (*do_set_bittiming)(struct net_device *dev); | 46 | int (*do_set_bittiming)(struct net_device *dev); |
| 50 | int (*do_set_mode)(struct net_device *dev, enum can_mode mode); | 47 | int (*do_set_mode)(struct net_device *dev, enum can_mode mode); |
| 51 | int (*do_get_state)(const struct net_device *dev, | 48 | int (*do_get_state)(const struct net_device *dev, |
| 52 | enum can_state *state); | 49 | enum can_state *state); |
| 50 | int (*do_get_berr_counter)(const struct net_device *dev, | ||
| 51 | struct can_berr_counter *bec); | ||
| 52 | |||
| 53 | unsigned int echo_skb_max; | ||
| 54 | struct sk_buff **echo_skb; | ||
| 53 | }; | 55 | }; |
| 54 | 56 | ||
| 55 | struct net_device *alloc_candev(int sizeof_priv); | 57 | /* |
| 58 | * get_can_dlc(value) - helper macro to cast a given data length code (dlc) | ||
| 59 | * to __u8 and ensure the dlc value to be max. 8 bytes. | ||
| 60 | * | ||
| 61 | * To be used in the CAN netdriver receive path to ensure conformance with | ||
| 62 | * ISO 11898-1 Chapter 8.4.2.3 (DLC field) | ||
| 63 | */ | ||
| 64 | #define get_can_dlc(i) (min_t(__u8, (i), 8)) | ||
| 65 | |||
| 66 | /* Drop a given socketbuffer if it does not contain a valid CAN frame. */ | ||
| 67 | static inline int can_dropped_invalid_skb(struct net_device *dev, | ||
| 68 | struct sk_buff *skb) | ||
| 69 | { | ||
| 70 | const struct can_frame *cf = (struct can_frame *)skb->data; | ||
| 71 | |||
| 72 | if (unlikely(skb->len != sizeof(*cf) || cf->can_dlc > 8)) { | ||
| 73 | kfree_skb(skb); | ||
| 74 | dev->stats.tx_dropped++; | ||
| 75 | return 1; | ||
| 76 | } | ||
| 77 | |||
| 78 | return 0; | ||
| 79 | } | ||
| 80 | |||
| 81 | struct net_device *alloc_candev(int sizeof_priv, unsigned int echo_skb_max); | ||
| 56 | void free_candev(struct net_device *dev); | 82 | void free_candev(struct net_device *dev); |
| 57 | 83 | ||
| 58 | int open_candev(struct net_device *dev); | 84 | int open_candev(struct net_device *dev); |
| @@ -64,8 +90,13 @@ void unregister_candev(struct net_device *dev); | |||
| 64 | int can_restart_now(struct net_device *dev); | 90 | int can_restart_now(struct net_device *dev); |
| 65 | void can_bus_off(struct net_device *dev); | 91 | void can_bus_off(struct net_device *dev); |
| 66 | 92 | ||
| 67 | void can_put_echo_skb(struct sk_buff *skb, struct net_device *dev, int idx); | 93 | void can_put_echo_skb(struct sk_buff *skb, struct net_device *dev, |
| 68 | void can_get_echo_skb(struct net_device *dev, int idx); | 94 | unsigned int idx); |
| 69 | void can_free_echo_skb(struct net_device *dev, int idx); | 95 | void can_get_echo_skb(struct net_device *dev, unsigned int idx); |
| 96 | void can_free_echo_skb(struct net_device *dev, unsigned int idx); | ||
| 97 | |||
| 98 | struct sk_buff *alloc_can_skb(struct net_device *dev, struct can_frame **cf); | ||
| 99 | struct sk_buff *alloc_can_err_skb(struct net_device *dev, | ||
| 100 | struct can_frame **cf); | ||
| 70 | 101 | ||
| 71 | #endif /* CAN_DEV_H */ | 102 | #endif /* CAN_DEV_H */ |
diff --git a/include/linux/can/netlink.h b/include/linux/can/netlink.h index 9ecbb7871c0e..3250de935e1a 100644 --- a/include/linux/can/netlink.h +++ b/include/linux/can/netlink.h | |||
| @@ -70,6 +70,14 @@ enum can_state { | |||
| 70 | }; | 70 | }; |
| 71 | 71 | ||
| 72 | /* | 72 | /* |
| 73 | * CAN bus error counters | ||
| 74 | */ | ||
| 75 | struct can_berr_counter { | ||
| 76 | __u16 txerr; | ||
| 77 | __u16 rxerr; | ||
| 78 | }; | ||
| 79 | |||
| 80 | /* | ||
| 73 | * CAN controller mode | 81 | * CAN controller mode |
| 74 | */ | 82 | */ |
| 75 | struct can_ctrlmode { | 83 | struct can_ctrlmode { |
| @@ -77,9 +85,11 @@ struct can_ctrlmode { | |||
| 77 | __u32 flags; | 85 | __u32 flags; |
| 78 | }; | 86 | }; |
| 79 | 87 | ||
| 80 | #define CAN_CTRLMODE_LOOPBACK 0x1 /* Loopback mode */ | 88 | #define CAN_CTRLMODE_LOOPBACK 0x01 /* Loopback mode */ |
| 81 | #define CAN_CTRLMODE_LISTENONLY 0x2 /* Listen-only mode */ | 89 | #define CAN_CTRLMODE_LISTENONLY 0x02 /* Listen-only mode */ |
| 82 | #define CAN_CTRLMODE_3_SAMPLES 0x4 /* Triple sampling mode */ | 90 | #define CAN_CTRLMODE_3_SAMPLES 0x04 /* Triple sampling mode */ |
| 91 | #define CAN_CTRLMODE_ONE_SHOT 0x08 /* One-Shot mode */ | ||
| 92 | #define CAN_CTRLMODE_BERR_REPORTING 0x10 /* Bus-error reporting */ | ||
| 83 | 93 | ||
| 84 | /* | 94 | /* |
| 85 | * CAN device statistics | 95 | * CAN device statistics |
| @@ -105,6 +115,7 @@ enum { | |||
| 105 | IFLA_CAN_CTRLMODE, | 115 | IFLA_CAN_CTRLMODE, |
| 106 | IFLA_CAN_RESTART_MS, | 116 | IFLA_CAN_RESTART_MS, |
| 107 | IFLA_CAN_RESTART, | 117 | IFLA_CAN_RESTART, |
| 118 | IFLA_CAN_BERR_COUNTER, | ||
| 108 | __IFLA_CAN_MAX | 119 | __IFLA_CAN_MAX |
| 109 | }; | 120 | }; |
| 110 | 121 | ||
diff --git a/include/linux/can/platform/mcp251x.h b/include/linux/can/platform/mcp251x.h new file mode 100644 index 000000000000..1448177d86d5 --- /dev/null +++ b/include/linux/can/platform/mcp251x.h | |||
| @@ -0,0 +1,36 @@ | |||
| 1 | #ifndef __CAN_PLATFORM_MCP251X_H__ | ||
| 2 | #define __CAN_PLATFORM_MCP251X_H__ | ||
| 3 | |||
| 4 | /* | ||
| 5 | * | ||
| 6 | * CAN bus driver for Microchip 251x CAN Controller with SPI Interface | ||
| 7 | * | ||
| 8 | */ | ||
| 9 | |||
| 10 | #include <linux/spi/spi.h> | ||
| 11 | |||
| 12 | /** | ||
| 13 | * struct mcp251x_platform_data - MCP251X SPI CAN controller platform data | ||
| 14 | * @oscillator_frequency: - oscillator frequency in Hz | ||
| 15 | * @model: - actual type of chip | ||
| 16 | * @board_specific_setup: - called before probing the chip (power,reset) | ||
| 17 | * @transceiver_enable: - called to power on/off the transceiver | ||
| 18 | * @power_enable: - called to power on/off the mcp *and* the | ||
| 19 | * transceiver | ||
| 20 | * | ||
| 21 | * Please note that you should define power_enable or transceiver_enable or | ||
| 22 | * none of them. Defining both of them is no use. | ||
| 23 | * | ||
| 24 | */ | ||
| 25 | |||
| 26 | struct mcp251x_platform_data { | ||
| 27 | unsigned long oscillator_frequency; | ||
| 28 | int model; | ||
| 29 | #define CAN_MCP251X_MCP2510 0 | ||
| 30 | #define CAN_MCP251X_MCP2515 1 | ||
| 31 | int (*board_specific_setup)(struct spi_device *spi); | ||
| 32 | int (*transceiver_enable)(int enable); | ||
| 33 | int (*power_enable) (int enable); | ||
| 34 | }; | ||
| 35 | |||
| 36 | #endif /* __CAN_PLATFORM_MCP251X_H__ */ | ||
diff --git a/include/linux/can/platform/ti_hecc.h b/include/linux/can/platform/ti_hecc.h new file mode 100644 index 000000000000..af17cb3f7a84 --- /dev/null +++ b/include/linux/can/platform/ti_hecc.h | |||
| @@ -0,0 +1,44 @@ | |||
| 1 | #ifndef __CAN_PLATFORM_TI_HECC_H__ | ||
| 2 | #define __CAN_PLATFORM_TI_HECC_H__ | ||
| 3 | |||
| 4 | /* | ||
| 5 | * TI HECC (High End CAN Controller) driver platform header | ||
| 6 | * | ||
| 7 | * Copyright (C) 2009 Texas Instruments Incorporated - http://www.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 as | ||
| 11 | * published by the Free Software Foundation version 2. | ||
| 12 | * | ||
| 13 | * This program is distributed as is WITHOUT ANY WARRANTY of any | ||
| 14 | * kind, whether express or implied; without even the implied warranty | ||
| 15 | * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 16 | * GNU General Public License for more details. | ||
| 17 | * | ||
| 18 | */ | ||
| 19 | |||
| 20 | /** | ||
| 21 | * struct hecc_platform_data - HECC Platform Data | ||
| 22 | * | ||
| 23 | * @scc_hecc_offset: mostly 0 - should really never change | ||
| 24 | * @scc_ram_offset: SCC RAM offset | ||
| 25 | * @hecc_ram_offset: HECC RAM offset | ||
| 26 | * @mbx_offset: Mailbox RAM offset | ||
| 27 | * @int_line: Interrupt line to use - 0 or 1 | ||
| 28 | * @version: version for future use | ||
| 29 | * @transceiver_switch: platform specific callback fn for transceiver control | ||
| 30 | * | ||
| 31 | * Platform data structure to get all platform specific settings. | ||
| 32 | * this structure also accounts the fact that the IP may have different | ||
| 33 | * RAM and mailbox offsets for different SOC's | ||
| 34 | */ | ||
| 35 | struct ti_hecc_platform_data { | ||
| 36 | u32 scc_hecc_offset; | ||
| 37 | u32 scc_ram_offset; | ||
| 38 | u32 hecc_ram_offset; | ||
| 39 | u32 mbx_offset; | ||
| 40 | u32 int_line; | ||
| 41 | u32 version; | ||
| 42 | void (*transceiver_switch) (int); | ||
| 43 | }; | ||
| 44 | #endif | ||
diff --git a/include/linux/capability.h b/include/linux/capability.h index c8f2a5f70ed5..39e5ff512fbe 100644 --- a/include/linux/capability.h +++ b/include/linux/capability.h | |||
| @@ -92,9 +92,7 @@ struct vfs_cap_data { | |||
| 92 | #define _KERNEL_CAPABILITY_VERSION _LINUX_CAPABILITY_VERSION_3 | 92 | #define _KERNEL_CAPABILITY_VERSION _LINUX_CAPABILITY_VERSION_3 |
| 93 | #define _KERNEL_CAPABILITY_U32S _LINUX_CAPABILITY_U32S_3 | 93 | #define _KERNEL_CAPABILITY_U32S _LINUX_CAPABILITY_U32S_3 |
| 94 | 94 | ||
| 95 | #ifdef CONFIG_SECURITY_FILE_CAPABILITIES | ||
| 96 | extern int file_caps_enabled; | 95 | extern int file_caps_enabled; |
| 97 | #endif | ||
| 98 | 96 | ||
| 99 | typedef struct kernel_cap_struct { | 97 | typedef struct kernel_cap_struct { |
| 100 | __u32 cap[_KERNEL_CAPABILITY_U32S]; | 98 | __u32 cap[_KERNEL_CAPABILITY_U32S]; |
diff --git a/include/linux/cciss_defs.h b/include/linux/cciss_defs.h new file mode 100644 index 000000000000..316b670d4e33 --- /dev/null +++ b/include/linux/cciss_defs.h | |||
| @@ -0,0 +1,130 @@ | |||
| 1 | #ifndef CCISS_DEFS_H | ||
| 2 | #define CCISS_DEFS_H | ||
| 3 | |||
| 4 | #include <linux/types.h> | ||
| 5 | |||
| 6 | /* general boundary definitions */ | ||
| 7 | #define SENSEINFOBYTES 32 /* note that this value may vary | ||
| 8 | between host implementations */ | ||
| 9 | |||
| 10 | /* Command Status value */ | ||
| 11 | #define CMD_SUCCESS 0x0000 | ||
| 12 | #define CMD_TARGET_STATUS 0x0001 | ||
| 13 | #define CMD_DATA_UNDERRUN 0x0002 | ||
| 14 | #define CMD_DATA_OVERRUN 0x0003 | ||
| 15 | #define CMD_INVALID 0x0004 | ||
| 16 | #define CMD_PROTOCOL_ERR 0x0005 | ||
| 17 | #define CMD_HARDWARE_ERR 0x0006 | ||
| 18 | #define CMD_CONNECTION_LOST 0x0007 | ||
| 19 | #define CMD_ABORTED 0x0008 | ||
| 20 | #define CMD_ABORT_FAILED 0x0009 | ||
| 21 | #define CMD_UNSOLICITED_ABORT 0x000A | ||
| 22 | #define CMD_TIMEOUT 0x000B | ||
| 23 | #define CMD_UNABORTABLE 0x000C | ||
| 24 | |||
| 25 | /* transfer direction */ | ||
| 26 | #define XFER_NONE 0x00 | ||
| 27 | #define XFER_WRITE 0x01 | ||
| 28 | #define XFER_READ 0x02 | ||
| 29 | #define XFER_RSVD 0x03 | ||
| 30 | |||
| 31 | /* task attribute */ | ||
| 32 | #define ATTR_UNTAGGED 0x00 | ||
| 33 | #define ATTR_SIMPLE 0x04 | ||
| 34 | #define ATTR_HEADOFQUEUE 0x05 | ||
| 35 | #define ATTR_ORDERED 0x06 | ||
| 36 | #define ATTR_ACA 0x07 | ||
| 37 | |||
| 38 | /* cdb type */ | ||
| 39 | #define TYPE_CMD 0x00 | ||
| 40 | #define TYPE_MSG 0x01 | ||
| 41 | |||
| 42 | /* Type defs used in the following structs */ | ||
| 43 | #define BYTE __u8 | ||
| 44 | #define WORD __u16 | ||
| 45 | #define HWORD __u16 | ||
| 46 | #define DWORD __u32 | ||
| 47 | |||
| 48 | #define CISS_MAX_LUN 1024 | ||
| 49 | |||
| 50 | #define LEVEL2LUN 1 /* index into Target(x) structure, due to byte swapping */ | ||
| 51 | #define LEVEL3LUN 0 | ||
| 52 | |||
| 53 | #pragma pack(1) | ||
| 54 | |||
| 55 | /* Command List Structure */ | ||
| 56 | typedef union _SCSI3Addr_struct { | ||
| 57 | struct { | ||
| 58 | BYTE Dev; | ||
| 59 | BYTE Bus:6; | ||
| 60 | BYTE Mode:2; /* b00 */ | ||
| 61 | } PeripDev; | ||
| 62 | struct { | ||
| 63 | BYTE DevLSB; | ||
| 64 | BYTE DevMSB:6; | ||
| 65 | BYTE Mode:2; /* b01 */ | ||
| 66 | } LogDev; | ||
| 67 | struct { | ||
| 68 | BYTE Dev:5; | ||
| 69 | BYTE Bus:3; | ||
| 70 | BYTE Targ:6; | ||
| 71 | BYTE Mode:2; /* b10 */ | ||
| 72 | } LogUnit; | ||
| 73 | } SCSI3Addr_struct; | ||
| 74 | |||
| 75 | typedef struct _PhysDevAddr_struct { | ||
| 76 | DWORD TargetId:24; | ||
| 77 | DWORD Bus:6; | ||
| 78 | DWORD Mode:2; | ||
| 79 | SCSI3Addr_struct Target[2]; /* 2 level target device addr */ | ||
| 80 | } PhysDevAddr_struct; | ||
| 81 | |||
| 82 | typedef struct _LogDevAddr_struct { | ||
| 83 | DWORD VolId:30; | ||
| 84 | DWORD Mode:2; | ||
| 85 | BYTE reserved[4]; | ||
| 86 | } LogDevAddr_struct; | ||
| 87 | |||
| 88 | typedef union _LUNAddr_struct { | ||
| 89 | BYTE LunAddrBytes[8]; | ||
| 90 | SCSI3Addr_struct SCSI3Lun[4]; | ||
| 91 | PhysDevAddr_struct PhysDev; | ||
| 92 | LogDevAddr_struct LogDev; | ||
| 93 | } LUNAddr_struct; | ||
| 94 | |||
| 95 | typedef struct _RequestBlock_struct { | ||
| 96 | BYTE CDBLen; | ||
| 97 | struct { | ||
| 98 | BYTE Type:3; | ||
| 99 | BYTE Attribute:3; | ||
| 100 | BYTE Direction:2; | ||
| 101 | } Type; | ||
| 102 | HWORD Timeout; | ||
| 103 | BYTE CDB[16]; | ||
| 104 | } RequestBlock_struct; | ||
| 105 | |||
| 106 | typedef union _MoreErrInfo_struct{ | ||
| 107 | struct { | ||
| 108 | BYTE Reserved[3]; | ||
| 109 | BYTE Type; | ||
| 110 | DWORD ErrorInfo; | ||
| 111 | } Common_Info; | ||
| 112 | struct{ | ||
| 113 | BYTE Reserved[2]; | ||
| 114 | BYTE offense_size; /* size of offending entry */ | ||
| 115 | BYTE offense_num; /* byte # of offense 0-base */ | ||
| 116 | DWORD offense_value; | ||
| 117 | } Invalid_Cmd; | ||
| 118 | } MoreErrInfo_struct; | ||
| 119 | typedef struct _ErrorInfo_struct { | ||
| 120 | BYTE ScsiStatus; | ||
| 121 | BYTE SenseLen; | ||
| 122 | HWORD CommandStatus; | ||
| 123 | DWORD ResidualCnt; | ||
| 124 | MoreErrInfo_struct MoreErrInfo; | ||
| 125 | BYTE SenseInfo[SENSEINFOBYTES]; | ||
| 126 | } ErrorInfo_struct; | ||
| 127 | |||
| 128 | #pragma pack() | ||
| 129 | |||
| 130 | #endif /* CCISS_DEFS_H */ | ||
diff --git a/include/linux/cciss_ioctl.h b/include/linux/cciss_ioctl.h index cb57c30081a8..986493f5b92b 100644 --- a/include/linux/cciss_ioctl.h +++ b/include/linux/cciss_ioctl.h | |||
| @@ -3,6 +3,7 @@ | |||
| 3 | 3 | ||
| 4 | #include <linux/types.h> | 4 | #include <linux/types.h> |
| 5 | #include <linux/ioctl.h> | 5 | #include <linux/ioctl.h> |
| 6 | #include <linux/cciss_defs.h> | ||
| 6 | 7 | ||
| 7 | #define CCISS_IOC_MAGIC 'B' | 8 | #define CCISS_IOC_MAGIC 'B' |
| 8 | 9 | ||
| @@ -36,133 +37,6 @@ typedef __u32 DriverVer_type; | |||
| 36 | 37 | ||
| 37 | #define MAX_KMALLOC_SIZE 128000 | 38 | #define MAX_KMALLOC_SIZE 128000 |
| 38 | 39 | ||
| 39 | #ifndef CCISS_CMD_H | ||
| 40 | // This defines are duplicated in cciss_cmd.h in the driver directory | ||
| 41 | |||
| 42 | //general boundary defintions | ||
| 43 | #define SENSEINFOBYTES 32//note that this value may vary between host implementations | ||
| 44 | |||
| 45 | //Command Status value | ||
| 46 | #define CMD_SUCCESS 0x0000 | ||
| 47 | #define CMD_TARGET_STATUS 0x0001 | ||
| 48 | #define CMD_DATA_UNDERRUN 0x0002 | ||
| 49 | #define CMD_DATA_OVERRUN 0x0003 | ||
| 50 | #define CMD_INVALID 0x0004 | ||
| 51 | #define CMD_PROTOCOL_ERR 0x0005 | ||
| 52 | #define CMD_HARDWARE_ERR 0x0006 | ||
| 53 | #define CMD_CONNECTION_LOST 0x0007 | ||
| 54 | #define CMD_ABORTED 0x0008 | ||
| 55 | #define CMD_ABORT_FAILED 0x0009 | ||
| 56 | #define CMD_UNSOLICITED_ABORT 0x000A | ||
| 57 | #define CMD_TIMEOUT 0x000B | ||
| 58 | #define CMD_UNABORTABLE 0x000C | ||
| 59 | |||
| 60 | //transfer direction | ||
| 61 | #define XFER_NONE 0x00 | ||
| 62 | #define XFER_WRITE 0x01 | ||
| 63 | #define XFER_READ 0x02 | ||
| 64 | #define XFER_RSVD 0x03 | ||
| 65 | |||
| 66 | //task attribute | ||
| 67 | #define ATTR_UNTAGGED 0x00 | ||
| 68 | #define ATTR_SIMPLE 0x04 | ||
| 69 | #define ATTR_HEADOFQUEUE 0x05 | ||
| 70 | #define ATTR_ORDERED 0x06 | ||
| 71 | #define ATTR_ACA 0x07 | ||
| 72 | |||
| 73 | //cdb type | ||
| 74 | #define TYPE_CMD 0x00 | ||
| 75 | #define TYPE_MSG 0x01 | ||
| 76 | |||
| 77 | // Type defs used in the following structs | ||
| 78 | #define BYTE __u8 | ||
| 79 | #define WORD __u16 | ||
| 80 | #define HWORD __u16 | ||
| 81 | #define DWORD __u32 | ||
| 82 | |||
| 83 | #define CISS_MAX_LUN 1024 | ||
| 84 | |||
| 85 | #define LEVEL2LUN 1 // index into Target(x) structure, due to byte swapping | ||
| 86 | #define LEVEL3LUN 0 | ||
| 87 | |||
| 88 | #pragma pack(1) | ||
| 89 | |||
| 90 | //Command List Structure | ||
| 91 | typedef union _SCSI3Addr_struct { | ||
| 92 | struct { | ||
| 93 | BYTE Dev; | ||
| 94 | BYTE Bus:6; | ||
| 95 | BYTE Mode:2; // b00 | ||
| 96 | } PeripDev; | ||
| 97 | struct { | ||
| 98 | BYTE DevLSB; | ||
| 99 | BYTE DevMSB:6; | ||
| 100 | BYTE Mode:2; // b01 | ||
| 101 | } LogDev; | ||
| 102 | struct { | ||
| 103 | BYTE Dev:5; | ||
| 104 | BYTE Bus:3; | ||
| 105 | BYTE Targ:6; | ||
| 106 | BYTE Mode:2; // b10 | ||
| 107 | } LogUnit; | ||
| 108 | } SCSI3Addr_struct; | ||
| 109 | |||
| 110 | typedef struct _PhysDevAddr_struct { | ||
| 111 | DWORD TargetId:24; | ||
| 112 | DWORD Bus:6; | ||
| 113 | DWORD Mode:2; | ||
| 114 | SCSI3Addr_struct Target[2]; //2 level target device addr | ||
| 115 | } PhysDevAddr_struct; | ||
| 116 | |||
| 117 | typedef struct _LogDevAddr_struct { | ||
| 118 | DWORD VolId:30; | ||
| 119 | DWORD Mode:2; | ||
| 120 | BYTE reserved[4]; | ||
| 121 | } LogDevAddr_struct; | ||
| 122 | |||
| 123 | typedef union _LUNAddr_struct { | ||
| 124 | BYTE LunAddrBytes[8]; | ||
| 125 | SCSI3Addr_struct SCSI3Lun[4]; | ||
| 126 | PhysDevAddr_struct PhysDev; | ||
| 127 | LogDevAddr_struct LogDev; | ||
| 128 | } LUNAddr_struct; | ||
| 129 | |||
| 130 | typedef struct _RequestBlock_struct { | ||
| 131 | BYTE CDBLen; | ||
| 132 | struct { | ||
| 133 | BYTE Type:3; | ||
| 134 | BYTE Attribute:3; | ||
| 135 | BYTE Direction:2; | ||
| 136 | } Type; | ||
| 137 | HWORD Timeout; | ||
| 138 | BYTE CDB[16]; | ||
| 139 | } RequestBlock_struct; | ||
| 140 | |||
| 141 | typedef union _MoreErrInfo_struct{ | ||
| 142 | struct { | ||
| 143 | BYTE Reserved[3]; | ||
| 144 | BYTE Type; | ||
| 145 | DWORD ErrorInfo; | ||
| 146 | }Common_Info; | ||
| 147 | struct{ | ||
| 148 | BYTE Reserved[2]; | ||
| 149 | BYTE offense_size;//size of offending entry | ||
| 150 | BYTE offense_num; //byte # of offense 0-base | ||
| 151 | DWORD offense_value; | ||
| 152 | }Invalid_Cmd; | ||
| 153 | }MoreErrInfo_struct; | ||
| 154 | typedef struct _ErrorInfo_struct { | ||
| 155 | BYTE ScsiStatus; | ||
| 156 | BYTE SenseLen; | ||
| 157 | HWORD CommandStatus; | ||
| 158 | DWORD ResidualCnt; | ||
| 159 | MoreErrInfo_struct MoreErrInfo; | ||
| 160 | BYTE SenseInfo[SENSEINFOBYTES]; | ||
| 161 | } ErrorInfo_struct; | ||
| 162 | |||
| 163 | #pragma pack() | ||
| 164 | #endif /* CCISS_CMD_H */ | ||
| 165 | |||
| 166 | typedef struct _IOCTL_Command_struct { | 40 | typedef struct _IOCTL_Command_struct { |
| 167 | LUNAddr_struct LUN_info; | 41 | LUNAddr_struct LUN_info; |
| 168 | RequestBlock_struct Request; | 42 | RequestBlock_struct Request; |
diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h index 0008dee66514..8f78073d7caa 100644 --- a/include/linux/cgroup.h +++ b/include/linux/cgroup.h | |||
| @@ -28,6 +28,7 @@ struct css_id; | |||
| 28 | extern int cgroup_init_early(void); | 28 | extern int cgroup_init_early(void); |
| 29 | extern int cgroup_init(void); | 29 | extern int cgroup_init(void); |
| 30 | extern void cgroup_lock(void); | 30 | extern void cgroup_lock(void); |
| 31 | extern int cgroup_lock_is_held(void); | ||
| 31 | extern bool cgroup_lock_live_group(struct cgroup *cgrp); | 32 | extern bool cgroup_lock_live_group(struct cgroup *cgrp); |
| 32 | extern void cgroup_unlock(void); | 33 | extern void cgroup_unlock(void); |
| 33 | extern void cgroup_fork(struct task_struct *p); | 34 | extern void cgroup_fork(struct task_struct *p); |
| @@ -36,16 +37,24 @@ extern void cgroup_post_fork(struct task_struct *p); | |||
| 36 | extern void cgroup_exit(struct task_struct *p, int run_callbacks); | 37 | extern void cgroup_exit(struct task_struct *p, int run_callbacks); |
| 37 | extern int cgroupstats_build(struct cgroupstats *stats, | 38 | extern int cgroupstats_build(struct cgroupstats *stats, |
| 38 | struct dentry *dentry); | 39 | struct dentry *dentry); |
| 40 | extern int cgroup_load_subsys(struct cgroup_subsys *ss); | ||
| 41 | extern void cgroup_unload_subsys(struct cgroup_subsys *ss); | ||
| 39 | 42 | ||
| 40 | extern const struct file_operations proc_cgroup_operations; | 43 | extern const struct file_operations proc_cgroup_operations; |
| 41 | 44 | ||
| 42 | /* Define the enumeration of all cgroup subsystems */ | 45 | /* Define the enumeration of all builtin cgroup subsystems */ |
| 43 | #define SUBSYS(_x) _x ## _subsys_id, | 46 | #define SUBSYS(_x) _x ## _subsys_id, |
| 44 | enum cgroup_subsys_id { | 47 | enum cgroup_subsys_id { |
| 45 | #include <linux/cgroup_subsys.h> | 48 | #include <linux/cgroup_subsys.h> |
| 46 | CGROUP_SUBSYS_COUNT | 49 | CGROUP_BUILTIN_SUBSYS_COUNT |
| 47 | }; | 50 | }; |
| 48 | #undef SUBSYS | 51 | #undef SUBSYS |
| 52 | /* | ||
| 53 | * This define indicates the maximum number of subsystems that can be loaded | ||
| 54 | * at once. We limit to this many since cgroupfs_root has subsys_bits to keep | ||
| 55 | * track of all of them. | ||
| 56 | */ | ||
| 57 | #define CGROUP_SUBSYS_COUNT (BITS_PER_BYTE*sizeof(unsigned long)) | ||
| 49 | 58 | ||
| 50 | /* Per-subsystem/per-cgroup state maintained by the system. */ | 59 | /* Per-subsystem/per-cgroup state maintained by the system. */ |
| 51 | struct cgroup_subsys_state { | 60 | struct cgroup_subsys_state { |
| @@ -75,6 +84,12 @@ enum { | |||
| 75 | CSS_REMOVED, /* This CSS is dead */ | 84 | CSS_REMOVED, /* This CSS is dead */ |
| 76 | }; | 85 | }; |
| 77 | 86 | ||
| 87 | /* Caller must verify that the css is not for root cgroup */ | ||
| 88 | static inline void __css_get(struct cgroup_subsys_state *css, int count) | ||
| 89 | { | ||
| 90 | atomic_add(count, &css->refcnt); | ||
| 91 | } | ||
| 92 | |||
| 78 | /* | 93 | /* |
| 79 | * Call css_get() to hold a reference on the css; it can be used | 94 | * Call css_get() to hold a reference on the css; it can be used |
| 80 | * for a reference obtained via: | 95 | * for a reference obtained via: |
| @@ -86,7 +101,7 @@ static inline void css_get(struct cgroup_subsys_state *css) | |||
| 86 | { | 101 | { |
| 87 | /* We don't need to reference count the root state */ | 102 | /* We don't need to reference count the root state */ |
| 88 | if (!test_bit(CSS_ROOT, &css->flags)) | 103 | if (!test_bit(CSS_ROOT, &css->flags)) |
| 89 | atomic_inc(&css->refcnt); | 104 | __css_get(css, 1); |
| 90 | } | 105 | } |
| 91 | 106 | ||
| 92 | static inline bool css_is_removed(struct cgroup_subsys_state *css) | 107 | static inline bool css_is_removed(struct cgroup_subsys_state *css) |
| @@ -117,11 +132,11 @@ static inline bool css_tryget(struct cgroup_subsys_state *css) | |||
| 117 | * css_get() or css_tryget() | 132 | * css_get() or css_tryget() |
| 118 | */ | 133 | */ |
| 119 | 134 | ||
| 120 | extern void __css_put(struct cgroup_subsys_state *css); | 135 | extern void __css_put(struct cgroup_subsys_state *css, int count); |
| 121 | static inline void css_put(struct cgroup_subsys_state *css) | 136 | static inline void css_put(struct cgroup_subsys_state *css) |
| 122 | { | 137 | { |
| 123 | if (!test_bit(CSS_ROOT, &css->flags)) | 138 | if (!test_bit(CSS_ROOT, &css->flags)) |
| 124 | __css_put(css); | 139 | __css_put(css, 1); |
| 125 | } | 140 | } |
| 126 | 141 | ||
| 127 | /* bits in struct cgroup flags field */ | 142 | /* bits in struct cgroup flags field */ |
| @@ -220,6 +235,10 @@ struct cgroup { | |||
| 220 | 235 | ||
| 221 | /* For RCU-protected deletion */ | 236 | /* For RCU-protected deletion */ |
| 222 | struct rcu_head rcu_head; | 237 | struct rcu_head rcu_head; |
| 238 | |||
| 239 | /* List of events which userspace want to recieve */ | ||
| 240 | struct list_head event_list; | ||
| 241 | spinlock_t event_list_lock; | ||
| 223 | }; | 242 | }; |
| 224 | 243 | ||
| 225 | /* | 244 | /* |
| @@ -257,7 +276,8 @@ struct css_set { | |||
| 257 | /* | 276 | /* |
| 258 | * Set of subsystem states, one for each subsystem. This array | 277 | * Set of subsystem states, one for each subsystem. This array |
| 259 | * is immutable after creation apart from the init_css_set | 278 | * is immutable after creation apart from the init_css_set |
| 260 | * during subsystem registration (at boot time). | 279 | * during subsystem registration (at boot time) and modular subsystem |
| 280 | * loading/unloading. | ||
| 261 | */ | 281 | */ |
| 262 | struct cgroup_subsys_state *subsys[CGROUP_SUBSYS_COUNT]; | 282 | struct cgroup_subsys_state *subsys[CGROUP_SUBSYS_COUNT]; |
| 263 | 283 | ||
| @@ -362,6 +382,23 @@ struct cftype { | |||
| 362 | int (*trigger)(struct cgroup *cgrp, unsigned int event); | 382 | int (*trigger)(struct cgroup *cgrp, unsigned int event); |
| 363 | 383 | ||
| 364 | int (*release)(struct inode *inode, struct file *file); | 384 | int (*release)(struct inode *inode, struct file *file); |
| 385 | |||
| 386 | /* | ||
| 387 | * register_event() callback will be used to add new userspace | ||
| 388 | * waiter for changes related to the cftype. Implement it if | ||
| 389 | * you want to provide this functionality. Use eventfd_signal() | ||
| 390 | * on eventfd to send notification to userspace. | ||
| 391 | */ | ||
| 392 | int (*register_event)(struct cgroup *cgrp, struct cftype *cft, | ||
| 393 | struct eventfd_ctx *eventfd, const char *args); | ||
| 394 | /* | ||
| 395 | * unregister_event() callback will be called when userspace | ||
| 396 | * closes the eventfd or on cgroup removing. | ||
| 397 | * This callback must be implemented, if you want provide | ||
| 398 | * notification functionality. | ||
| 399 | */ | ||
| 400 | int (*unregister_event)(struct cgroup *cgrp, struct cftype *cft, | ||
| 401 | struct eventfd_ctx *eventfd); | ||
| 365 | }; | 402 | }; |
| 366 | 403 | ||
| 367 | struct cgroup_scanner { | 404 | struct cgroup_scanner { |
| @@ -427,6 +464,8 @@ struct cgroup_subsys { | |||
| 427 | void (*destroy)(struct cgroup_subsys *ss, struct cgroup *cgrp); | 464 | void (*destroy)(struct cgroup_subsys *ss, struct cgroup *cgrp); |
| 428 | int (*can_attach)(struct cgroup_subsys *ss, struct cgroup *cgrp, | 465 | int (*can_attach)(struct cgroup_subsys *ss, struct cgroup *cgrp, |
| 429 | struct task_struct *tsk, bool threadgroup); | 466 | struct task_struct *tsk, bool threadgroup); |
| 467 | void (*cancel_attach)(struct cgroup_subsys *ss, struct cgroup *cgrp, | ||
| 468 | struct task_struct *tsk, bool threadgroup); | ||
| 430 | void (*attach)(struct cgroup_subsys *ss, struct cgroup *cgrp, | 469 | void (*attach)(struct cgroup_subsys *ss, struct cgroup *cgrp, |
| 431 | struct cgroup *old_cgrp, struct task_struct *tsk, | 470 | struct cgroup *old_cgrp, struct task_struct *tsk, |
| 432 | bool threadgroup); | 471 | bool threadgroup); |
| @@ -471,6 +510,9 @@ struct cgroup_subsys { | |||
| 471 | /* used when use_id == true */ | 510 | /* used when use_id == true */ |
| 472 | struct idr idr; | 511 | struct idr idr; |
| 473 | spinlock_t id_lock; | 512 | spinlock_t id_lock; |
| 513 | |||
| 514 | /* should be defined only by modular subsystems */ | ||
| 515 | struct module *module; | ||
| 474 | }; | 516 | }; |
| 475 | 517 | ||
| 476 | #define SUBSYS(_x) extern struct cgroup_subsys _x ## _subsys; | 518 | #define SUBSYS(_x) extern struct cgroup_subsys _x ## _subsys; |
| @@ -486,7 +528,10 @@ static inline struct cgroup_subsys_state *cgroup_subsys_state( | |||
| 486 | static inline struct cgroup_subsys_state *task_subsys_state( | 528 | static inline struct cgroup_subsys_state *task_subsys_state( |
| 487 | struct task_struct *task, int subsys_id) | 529 | struct task_struct *task, int subsys_id) |
| 488 | { | 530 | { |
| 489 | return rcu_dereference(task->cgroups->subsys[subsys_id]); | 531 | return rcu_dereference_check(task->cgroups->subsys[subsys_id], |
| 532 | rcu_read_lock_held() || | ||
| 533 | lockdep_is_held(&task->alloc_lock) || | ||
| 534 | cgroup_lock_is_held()); | ||
| 490 | } | 535 | } |
| 491 | 536 | ||
| 492 | static inline struct cgroup* task_cgroup(struct task_struct *task, | 537 | static inline struct cgroup* task_cgroup(struct task_struct *task, |
diff --git a/include/linux/cgroup_subsys.h b/include/linux/cgroup_subsys.h index 9c8d31bacf46..ccefff02b6cb 100644 --- a/include/linux/cgroup_subsys.h +++ b/include/linux/cgroup_subsys.h | |||
| @@ -60,3 +60,9 @@ SUBSYS(net_cls) | |||
| 60 | #endif | 60 | #endif |
| 61 | 61 | ||
| 62 | /* */ | 62 | /* */ |
| 63 | |||
| 64 | #ifdef CONFIG_BLK_CGROUP | ||
| 65 | SUBSYS(blkio) | ||
| 66 | #endif | ||
| 67 | |||
| 68 | /* */ | ||
diff --git a/include/linux/chio.h b/include/linux/chio.h index 519248d8b2b6..d9bac7f97282 100644 --- a/include/linux/chio.h +++ b/include/linux/chio.h | |||
| @@ -21,7 +21,7 @@ | |||
| 21 | * query vendor-specific element types | 21 | * query vendor-specific element types |
| 22 | * | 22 | * |
| 23 | * accessing elements works by specifing type and unit of the element. | 23 | * accessing elements works by specifing type and unit of the element. |
| 24 | * for eample, storage elements are addressed with type = CHET_ST and | 24 | * for example, storage elements are addressed with type = CHET_ST and |
| 25 | * unit = 0 .. cp_nslots-1 | 25 | * unit = 0 .. cp_nslots-1 |
| 26 | * | 26 | * |
| 27 | */ | 27 | */ |
diff --git a/include/linux/circ_buf.h b/include/linux/circ_buf.h index a2ed0591fb19..90f2471dc6f2 100644 --- a/include/linux/circ_buf.h +++ b/include/linux/circ_buf.h | |||
| @@ -1,3 +1,7 @@ | |||
| 1 | /* | ||
| 2 | * See Documentation/circular-buffers.txt for more information. | ||
| 3 | */ | ||
| 4 | |||
| 1 | #ifndef _LINUX_CIRC_BUF_H | 5 | #ifndef _LINUX_CIRC_BUF_H |
| 2 | #define _LINUX_CIRC_BUF_H 1 | 6 | #define _LINUX_CIRC_BUF_H 1 |
| 3 | 7 | ||
diff --git a/include/linux/clockchips.h b/include/linux/clockchips.h index 3a1dbba4d3ae..fc53492b6ad7 100644 --- a/include/linux/clockchips.h +++ b/include/linux/clockchips.h | |||
| @@ -73,14 +73,15 @@ enum clock_event_nofitiers { | |||
| 73 | * @list: list head for the management code | 73 | * @list: list head for the management code |
| 74 | * @mode: operating mode assigned by the management code | 74 | * @mode: operating mode assigned by the management code |
| 75 | * @next_event: local storage for the next event in oneshot mode | 75 | * @next_event: local storage for the next event in oneshot mode |
| 76 | * @retries: number of forced programming retries | ||
| 76 | */ | 77 | */ |
| 77 | struct clock_event_device { | 78 | struct clock_event_device { |
| 78 | const char *name; | 79 | const char *name; |
| 79 | unsigned int features; | 80 | unsigned int features; |
| 80 | unsigned long max_delta_ns; | 81 | u64 max_delta_ns; |
| 81 | unsigned long min_delta_ns; | 82 | u64 min_delta_ns; |
| 82 | unsigned long mult; | 83 | u32 mult; |
| 83 | int shift; | 84 | u32 shift; |
| 84 | int rating; | 85 | int rating; |
| 85 | int irq; | 86 | int irq; |
| 86 | const struct cpumask *cpumask; | 87 | const struct cpumask *cpumask; |
| @@ -93,6 +94,7 @@ struct clock_event_device { | |||
| 93 | struct list_head list; | 94 | struct list_head list; |
| 94 | enum clock_event_mode mode; | 95 | enum clock_event_mode mode; |
| 95 | ktime_t next_event; | 96 | ktime_t next_event; |
| 97 | unsigned long retries; | ||
| 96 | }; | 98 | }; |
| 97 | 99 | ||
| 98 | /* | 100 | /* |
| @@ -116,8 +118,8 @@ static inline unsigned long div_sc(unsigned long ticks, unsigned long nsec, | |||
| 116 | } | 118 | } |
| 117 | 119 | ||
| 118 | /* Clock event layer functions */ | 120 | /* Clock event layer functions */ |
| 119 | extern unsigned long clockevent_delta2ns(unsigned long latch, | 121 | extern u64 clockevent_delta2ns(unsigned long latch, |
| 120 | struct clock_event_device *evt); | 122 | struct clock_event_device *evt); |
| 121 | extern void clockevents_register_device(struct clock_event_device *dev); | 123 | extern void clockevents_register_device(struct clock_event_device *dev); |
| 122 | 124 | ||
| 123 | extern void clockevents_exchange_device(struct clock_event_device *old, | 125 | extern void clockevents_exchange_device(struct clock_event_device *old, |
| @@ -130,6 +132,13 @@ extern int clockevents_program_event(struct clock_event_device *dev, | |||
| 130 | 132 | ||
| 131 | extern void clockevents_handle_noop(struct clock_event_device *dev); | 133 | extern void clockevents_handle_noop(struct clock_event_device *dev); |
| 132 | 134 | ||
| 135 | static inline void | ||
| 136 | clockevents_calc_mult_shift(struct clock_event_device *ce, u32 freq, u32 minsec) | ||
| 137 | { | ||
| 138 | return clocks_calc_mult_shift(&ce->mult, &ce->shift, NSEC_PER_SEC, | ||
| 139 | freq, minsec); | ||
| 140 | } | ||
| 141 | |||
| 133 | #ifdef CONFIG_GENERIC_CLOCKEVENTS | 142 | #ifdef CONFIG_GENERIC_CLOCKEVENTS |
| 134 | extern void clockevents_notify(unsigned long reason, void *arg); | 143 | extern void clockevents_notify(unsigned long reason, void *arg); |
| 135 | #else | 144 | #else |
diff --git a/include/linux/clocksource.h b/include/linux/clocksource.h index 83d2fbd81b93..4bca8b60cdf7 100644 --- a/include/linux/clocksource.h +++ b/include/linux/clocksource.h | |||
| @@ -151,8 +151,10 @@ extern u64 timecounter_cyc2time(struct timecounter *tc, | |||
| 151 | * subtraction of non 64 bit counters | 151 | * subtraction of non 64 bit counters |
| 152 | * @mult: cycle to nanosecond multiplier | 152 | * @mult: cycle to nanosecond multiplier |
| 153 | * @shift: cycle to nanosecond divisor (power of two) | 153 | * @shift: cycle to nanosecond divisor (power of two) |
| 154 | * @max_idle_ns: max idle time permitted by the clocksource (nsecs) | ||
| 154 | * @flags: flags describing special properties | 155 | * @flags: flags describing special properties |
| 155 | * @vread: vsyscall based read | 156 | * @vread: vsyscall based read |
| 157 | * @suspend: suspend function for the clocksource, if necessary | ||
| 156 | * @resume: resume function for the clocksource, if necessary | 158 | * @resume: resume function for the clocksource, if necessary |
| 157 | */ | 159 | */ |
| 158 | struct clocksource { | 160 | struct clocksource { |
| @@ -168,9 +170,11 @@ struct clocksource { | |||
| 168 | cycle_t mask; | 170 | cycle_t mask; |
| 169 | u32 mult; | 171 | u32 mult; |
| 170 | u32 shift; | 172 | u32 shift; |
| 173 | u64 max_idle_ns; | ||
| 171 | unsigned long flags; | 174 | unsigned long flags; |
| 172 | cycle_t (*vread)(void); | 175 | cycle_t (*vread)(void); |
| 173 | void (*resume)(void); | 176 | void (*suspend)(struct clocksource *cs); |
| 177 | void (*resume)(struct clocksource *cs); | ||
| 174 | #ifdef CONFIG_IA64 | 178 | #ifdef CONFIG_IA64 |
| 175 | void *fsys_mmio; /* used by fsyscall asm code */ | 179 | void *fsys_mmio; /* used by fsyscall asm code */ |
| 176 | #define CLKSRC_FSYS_MMIO_SET(mmio, addr) ((mmio) = (addr)) | 180 | #define CLKSRC_FSYS_MMIO_SET(mmio, addr) ((mmio) = (addr)) |
| @@ -275,15 +279,28 @@ extern void clocksource_unregister(struct clocksource*); | |||
| 275 | extern void clocksource_touch_watchdog(void); | 279 | extern void clocksource_touch_watchdog(void); |
| 276 | extern struct clocksource* clocksource_get_next(void); | 280 | extern struct clocksource* clocksource_get_next(void); |
| 277 | extern void clocksource_change_rating(struct clocksource *cs, int rating); | 281 | extern void clocksource_change_rating(struct clocksource *cs, int rating); |
| 282 | extern void clocksource_suspend(void); | ||
| 278 | extern void clocksource_resume(void); | 283 | extern void clocksource_resume(void); |
| 279 | extern struct clocksource * __init __weak clocksource_default_clock(void); | 284 | extern struct clocksource * __init __weak clocksource_default_clock(void); |
| 280 | extern void clocksource_mark_unstable(struct clocksource *cs); | 285 | extern void clocksource_mark_unstable(struct clocksource *cs); |
| 281 | 286 | ||
| 287 | extern void | ||
| 288 | clocks_calc_mult_shift(u32 *mult, u32 *shift, u32 from, u32 to, u32 minsec); | ||
| 289 | |||
| 290 | static inline void | ||
| 291 | clocksource_calc_mult_shift(struct clocksource *cs, u32 freq, u32 minsec) | ||
| 292 | { | ||
| 293 | return clocks_calc_mult_shift(&cs->mult, &cs->shift, freq, | ||
| 294 | NSEC_PER_SEC, minsec); | ||
| 295 | } | ||
| 296 | |||
| 282 | #ifdef CONFIG_GENERIC_TIME_VSYSCALL | 297 | #ifdef CONFIG_GENERIC_TIME_VSYSCALL |
| 283 | extern void update_vsyscall(struct timespec *ts, struct clocksource *c); | 298 | extern void |
| 299 | update_vsyscall(struct timespec *ts, struct clocksource *c, u32 mult); | ||
| 284 | extern void update_vsyscall_tz(void); | 300 | extern void update_vsyscall_tz(void); |
| 285 | #else | 301 | #else |
| 286 | static inline void update_vsyscall(struct timespec *ts, struct clocksource *c) | 302 | static inline void |
| 303 | update_vsyscall(struct timespec *ts, struct clocksource *c, u32 mult) | ||
| 287 | { | 304 | { |
| 288 | } | 305 | } |
| 289 | 306 | ||
diff --git a/include/linux/coda_psdev.h b/include/linux/coda_psdev.h index 5b5d4731f956..8859e2ede9fe 100644 --- a/include/linux/coda_psdev.h +++ b/include/linux/coda_psdev.h | |||
| @@ -7,6 +7,8 @@ | |||
| 7 | #define MAX_CODADEVS 5 /* how many do we allow */ | 7 | #define MAX_CODADEVS 5 /* how many do we allow */ |
| 8 | 8 | ||
| 9 | #ifdef __KERNEL__ | 9 | #ifdef __KERNEL__ |
| 10 | #include <linux/backing-dev.h> | ||
| 11 | |||
| 10 | struct kstatfs; | 12 | struct kstatfs; |
| 11 | 13 | ||
| 12 | /* communication pending/processing queues */ | 14 | /* communication pending/processing queues */ |
| @@ -17,6 +19,7 @@ struct venus_comm { | |||
| 17 | struct list_head vc_processing; | 19 | struct list_head vc_processing; |
| 18 | int vc_inuse; | 20 | int vc_inuse; |
| 19 | struct super_block *vc_sb; | 21 | struct super_block *vc_sb; |
| 22 | struct backing_dev_info bdi; | ||
| 20 | }; | 23 | }; |
| 21 | 24 | ||
| 22 | 25 | ||
diff --git a/include/linux/compat.h b/include/linux/compat.h index af931ee43dd8..717c691ecd8e 100644 --- a/include/linux/compat.h +++ b/include/linux/compat.h | |||
| @@ -10,6 +10,8 @@ | |||
| 10 | #include <linux/stat.h> | 10 | #include <linux/stat.h> |
| 11 | #include <linux/param.h> /* for HZ */ | 11 | #include <linux/param.h> /* for HZ */ |
| 12 | #include <linux/sem.h> | 12 | #include <linux/sem.h> |
| 13 | #include <linux/socket.h> | ||
| 14 | #include <linux/if.h> | ||
| 13 | 15 | ||
| 14 | #include <asm/compat.h> | 16 | #include <asm/compat.h> |
| 15 | #include <asm/siginfo.h> | 17 | #include <asm/siginfo.h> |
| @@ -21,6 +23,7 @@ | |||
| 21 | typedef __compat_uid32_t compat_uid_t; | 23 | typedef __compat_uid32_t compat_uid_t; |
| 22 | typedef __compat_gid32_t compat_gid_t; | 24 | typedef __compat_gid32_t compat_gid_t; |
| 23 | 25 | ||
| 26 | struct compat_sel_arg_struct; | ||
| 24 | struct rusage; | 27 | struct rusage; |
| 25 | 28 | ||
| 26 | struct compat_itimerspec { | 29 | struct compat_itimerspec { |
| @@ -154,6 +157,48 @@ typedef struct compat_sigevent { | |||
| 154 | } _sigev_un; | 157 | } _sigev_un; |
| 155 | } compat_sigevent_t; | 158 | } compat_sigevent_t; |
| 156 | 159 | ||
| 160 | struct compat_ifmap { | ||
| 161 | compat_ulong_t mem_start; | ||
| 162 | compat_ulong_t mem_end; | ||
| 163 | unsigned short base_addr; | ||
| 164 | unsigned char irq; | ||
| 165 | unsigned char dma; | ||
| 166 | unsigned char port; | ||
| 167 | }; | ||
| 168 | |||
| 169 | struct compat_if_settings | ||
| 170 | { | ||
| 171 | unsigned int type; /* Type of physical device or protocol */ | ||
| 172 | unsigned int size; /* Size of the data allocated by the caller */ | ||
| 173 | compat_uptr_t ifs_ifsu; /* union of pointers */ | ||
| 174 | }; | ||
| 175 | |||
| 176 | struct compat_ifreq { | ||
| 177 | union { | ||
| 178 | char ifrn_name[IFNAMSIZ]; /* if name, e.g. "en0" */ | ||
| 179 | } ifr_ifrn; | ||
| 180 | union { | ||
| 181 | struct sockaddr ifru_addr; | ||
| 182 | struct sockaddr ifru_dstaddr; | ||
| 183 | struct sockaddr ifru_broadaddr; | ||
| 184 | struct sockaddr ifru_netmask; | ||
| 185 | struct sockaddr ifru_hwaddr; | ||
| 186 | short ifru_flags; | ||
| 187 | compat_int_t ifru_ivalue; | ||
| 188 | compat_int_t ifru_mtu; | ||
| 189 | struct compat_ifmap ifru_map; | ||
| 190 | char ifru_slave[IFNAMSIZ]; /* Just fits the size */ | ||
| 191 | char ifru_newname[IFNAMSIZ]; | ||
| 192 | compat_caddr_t ifru_data; | ||
| 193 | struct compat_if_settings ifru_settings; | ||
| 194 | } ifr_ifru; | ||
| 195 | }; | ||
| 196 | |||
| 197 | struct compat_ifconf { | ||
| 198 | compat_int_t ifc_len; /* size of buffer */ | ||
| 199 | compat_caddr_t ifcbuf; | ||
| 200 | }; | ||
| 201 | |||
| 157 | struct compat_robust_list { | 202 | struct compat_robust_list { |
| 158 | compat_uptr_t next; | 203 | compat_uptr_t next; |
| 159 | }; | 204 | }; |
| @@ -205,6 +250,8 @@ asmlinkage long compat_sys_select(int n, compat_ulong_t __user *inp, | |||
| 205 | compat_ulong_t __user *outp, compat_ulong_t __user *exp, | 250 | compat_ulong_t __user *outp, compat_ulong_t __user *exp, |
| 206 | struct compat_timeval __user *tvp); | 251 | struct compat_timeval __user *tvp); |
| 207 | 252 | ||
| 253 | asmlinkage long compat_sys_old_select(struct compat_sel_arg_struct __user *arg); | ||
| 254 | |||
| 208 | asmlinkage long compat_sys_wait4(compat_pid_t pid, | 255 | asmlinkage long compat_sys_wait4(compat_pid_t pid, |
| 209 | compat_uint_t __user *stat_addr, int options, | 256 | compat_uint_t __user *stat_addr, int options, |
| 210 | struct compat_rusage __user *ru); | 257 | struct compat_rusage __user *ru); |
diff --git a/include/linux/compiler-gcc.h b/include/linux/compiler-gcc.h index a3ed7cb8ca34..73dcf804bc94 100644 --- a/include/linux/compiler-gcc.h +++ b/include/linux/compiler-gcc.h | |||
| @@ -79,6 +79,7 @@ | |||
| 79 | #define noinline __attribute__((noinline)) | 79 | #define noinline __attribute__((noinline)) |
| 80 | #define __attribute_const__ __attribute__((__const__)) | 80 | #define __attribute_const__ __attribute__((__const__)) |
| 81 | #define __maybe_unused __attribute__((unused)) | 81 | #define __maybe_unused __attribute__((unused)) |
| 82 | #define __always_unused __attribute__((unused)) | ||
| 82 | 83 | ||
| 83 | #define __gcc_header(x) #x | 84 | #define __gcc_header(x) #x |
| 84 | #define _gcc_header(x) __gcc_header(linux/compiler-gcc##x.h) | 85 | #define _gcc_header(x) __gcc_header(linux/compiler-gcc##x.h) |
diff --git a/include/linux/compiler-gcc4.h b/include/linux/compiler-gcc4.h index 450fa597c94d..94dea3ffbfa1 100644 --- a/include/linux/compiler-gcc4.h +++ b/include/linux/compiler-gcc4.h | |||
| @@ -36,4 +36,26 @@ | |||
| 36 | the kernel context */ | 36 | the kernel context */ |
| 37 | #define __cold __attribute__((__cold__)) | 37 | #define __cold __attribute__((__cold__)) |
| 38 | 38 | ||
| 39 | |||
| 40 | #if __GNUC_MINOR__ >= 5 | ||
| 41 | /* | ||
| 42 | * Mark a position in code as unreachable. This can be used to | ||
| 43 | * suppress control flow warnings after asm blocks that transfer | ||
| 44 | * control elsewhere. | ||
| 45 | * | ||
| 46 | * Early snapshots of gcc 4.5 don't support this and we can't detect | ||
| 47 | * this in the preprocessor, but we can live with this because they're | ||
| 48 | * unreleased. Really, we need to have autoconf for the kernel. | ||
| 49 | */ | ||
| 50 | #define unreachable() __builtin_unreachable() | ||
| 51 | #endif | ||
| 52 | |||
| 53 | #endif | ||
| 54 | |||
| 55 | #if __GNUC_MINOR__ > 0 | ||
| 56 | #define __compiletime_object_size(obj) __builtin_object_size(obj, 0) | ||
| 57 | #endif | ||
| 58 | #if __GNUC_MINOR__ >= 4 | ||
| 59 | #define __compiletime_warning(message) __attribute__((warning(message))) | ||
| 60 | #define __compiletime_error(message) __attribute__((error(message))) | ||
| 39 | #endif | 61 | #endif |
diff --git a/include/linux/compiler.h b/include/linux/compiler.h index 04fb5135b4e1..a5a472b10746 100644 --- a/include/linux/compiler.h +++ b/include/linux/compiler.h | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | 5 | ||
| 6 | #ifdef __CHECKER__ | 6 | #ifdef __CHECKER__ |
| 7 | # define __user __attribute__((noderef, address_space(1))) | 7 | # define __user __attribute__((noderef, address_space(1))) |
| 8 | # define __kernel /* default address space */ | 8 | # define __kernel __attribute__((address_space(0))) |
| 9 | # define __safe __attribute__((safe)) | 9 | # define __safe __attribute__((safe)) |
| 10 | # define __force __attribute__((force)) | 10 | # define __force __attribute__((force)) |
| 11 | # define __nocast __attribute__((nocast)) | 11 | # define __nocast __attribute__((nocast)) |
| @@ -15,6 +15,7 @@ | |||
| 15 | # define __acquire(x) __context__(x,1) | 15 | # define __acquire(x) __context__(x,1) |
| 16 | # define __release(x) __context__(x,-1) | 16 | # define __release(x) __context__(x,-1) |
| 17 | # define __cond_lock(x,c) ((c) ? ({ __acquire(x); 1; }) : 0) | 17 | # define __cond_lock(x,c) ((c) ? ({ __acquire(x); 1; }) : 0) |
| 18 | # define __percpu __attribute__((noderef, address_space(3))) | ||
| 18 | extern void __chk_user_ptr(const volatile void __user *); | 19 | extern void __chk_user_ptr(const volatile void __user *); |
| 19 | extern void __chk_io_ptr(const volatile void __iomem *); | 20 | extern void __chk_io_ptr(const volatile void __iomem *); |
| 20 | #else | 21 | #else |
| @@ -32,6 +33,7 @@ extern void __chk_io_ptr(const volatile void __iomem *); | |||
| 32 | # define __acquire(x) (void)0 | 33 | # define __acquire(x) (void)0 |
| 33 | # define __release(x) (void)0 | 34 | # define __release(x) (void)0 |
| 34 | # define __cond_lock(x,c) (c) | 35 | # define __cond_lock(x,c) (c) |
| 36 | # define __percpu | ||
| 35 | #endif | 37 | #endif |
| 36 | 38 | ||
| 37 | #ifdef __KERNEL__ | 39 | #ifdef __KERNEL__ |
| @@ -144,6 +146,11 @@ void ftrace_likely_update(struct ftrace_branch_data *f, int val, int expect); | |||
| 144 | # define barrier() __memory_barrier() | 146 | # define barrier() __memory_barrier() |
| 145 | #endif | 147 | #endif |
| 146 | 148 | ||
| 149 | /* Unreachable code */ | ||
| 150 | #ifndef unreachable | ||
| 151 | # define unreachable() do { } while (1) | ||
| 152 | #endif | ||
| 153 | |||
| 147 | #ifndef RELOC_HIDE | 154 | #ifndef RELOC_HIDE |
| 148 | # define RELOC_HIDE(ptr, off) \ | 155 | # define RELOC_HIDE(ptr, off) \ |
| 149 | ({ unsigned long __ptr; \ | 156 | ({ unsigned long __ptr; \ |
| @@ -213,6 +220,10 @@ void ftrace_likely_update(struct ftrace_branch_data *f, int val, int expect); | |||
| 213 | # define __maybe_unused /* unimplemented */ | 220 | # define __maybe_unused /* unimplemented */ |
| 214 | #endif | 221 | #endif |
| 215 | 222 | ||
| 223 | #ifndef __always_unused | ||
| 224 | # define __always_unused /* unimplemented */ | ||
| 225 | #endif | ||
| 226 | |||
| 216 | #ifndef noinline | 227 | #ifndef noinline |
| 217 | #define noinline | 228 | #define noinline |
| 218 | #endif | 229 | #endif |
| @@ -266,6 +277,17 @@ void ftrace_likely_update(struct ftrace_branch_data *f, int val, int expect); | |||
| 266 | # define __same_type(a, b) __builtin_types_compatible_p(typeof(a), typeof(b)) | 277 | # define __same_type(a, b) __builtin_types_compatible_p(typeof(a), typeof(b)) |
| 267 | #endif | 278 | #endif |
| 268 | 279 | ||
| 280 | /* Compile time object size, -1 for unknown */ | ||
| 281 | #ifndef __compiletime_object_size | ||
| 282 | # define __compiletime_object_size(obj) -1 | ||
| 283 | #endif | ||
| 284 | #ifndef __compiletime_warning | ||
| 285 | # define __compiletime_warning(message) | ||
| 286 | #endif | ||
| 287 | #ifndef __compiletime_error | ||
| 288 | # define __compiletime_error(message) | ||
| 289 | #endif | ||
| 290 | |||
| 269 | /* | 291 | /* |
| 270 | * Prevent the compiler from merging or refetching accesses. The compiler | 292 | * Prevent the compiler from merging or refetching accesses. The compiler |
| 271 | * is also forbidden from reordering successive instances of ACCESS_ONCE(), | 293 | * is also forbidden from reordering successive instances of ACCESS_ONCE(), |
diff --git a/include/linux/connector.h b/include/linux/connector.h index 3a14615fd35c..3a779ffba60b 100644 --- a/include/linux/connector.h +++ b/include/linux/connector.h | |||
| @@ -24,9 +24,6 @@ | |||
| 24 | 24 | ||
| 25 | #include <linux/types.h> | 25 | #include <linux/types.h> |
| 26 | 26 | ||
| 27 | #define CN_IDX_CONNECTOR 0xffffffff | ||
| 28 | #define CN_VAL_CONNECTOR 0xffffffff | ||
| 29 | |||
| 30 | /* | 27 | /* |
| 31 | * Process Events connector unique ids -- used for message routing | 28 | * Process Events connector unique ids -- used for message routing |
| 32 | */ | 29 | */ |
| @@ -43,6 +40,8 @@ | |||
| 43 | #define CN_DST_VAL 0x1 | 40 | #define CN_DST_VAL 0x1 |
| 44 | #define CN_IDX_DM 0x7 /* Device Mapper */ | 41 | #define CN_IDX_DM 0x7 /* Device Mapper */ |
| 45 | #define CN_VAL_DM_USERSPACE_LOG 0x1 | 42 | #define CN_VAL_DM_USERSPACE_LOG 0x1 |
| 43 | #define CN_IDX_DRBD 0x8 | ||
| 44 | #define CN_VAL_DRBD 0x1 | ||
| 46 | 45 | ||
| 47 | #define CN_NETLINK_USERS 8 | 46 | #define CN_NETLINK_USERS 8 |
| 48 | 47 | ||
| @@ -73,30 +72,6 @@ struct cn_msg { | |||
| 73 | __u8 data[0]; | 72 | __u8 data[0]; |
| 74 | }; | 73 | }; |
| 75 | 74 | ||
| 76 | /* | ||
| 77 | * Notify structure - requests notification about | ||
| 78 | * registering/unregistering idx/val in range [first, first+range]. | ||
| 79 | */ | ||
| 80 | struct cn_notify_req { | ||
| 81 | __u32 first; | ||
| 82 | __u32 range; | ||
| 83 | }; | ||
| 84 | |||
| 85 | /* | ||
| 86 | * Main notification control message | ||
| 87 | * *_notify_num - number of appropriate cn_notify_req structures after | ||
| 88 | * this struct. | ||
| 89 | * group - notification receiver's idx. | ||
| 90 | * len - total length of the attached data. | ||
| 91 | */ | ||
| 92 | struct cn_ctl_msg { | ||
| 93 | __u32 idx_notify_num; | ||
| 94 | __u32 val_notify_num; | ||
| 95 | __u32 group; | ||
| 96 | __u32 len; | ||
| 97 | __u8 data[0]; | ||
| 98 | }; | ||
| 99 | |||
| 100 | #ifdef __KERNEL__ | 75 | #ifdef __KERNEL__ |
| 101 | 76 | ||
| 102 | #include <asm/atomic.h> | 77 | #include <asm/atomic.h> |
| @@ -149,11 +124,6 @@ struct cn_callback_entry { | |||
| 149 | u32 seq, group; | 124 | u32 seq, group; |
| 150 | }; | 125 | }; |
| 151 | 126 | ||
| 152 | struct cn_ctl_entry { | ||
| 153 | struct list_head notify_entry; | ||
| 154 | struct cn_ctl_msg *msg; | ||
| 155 | }; | ||
| 156 | |||
| 157 | struct cn_dev { | 127 | struct cn_dev { |
| 158 | struct cb_id id; | 128 | struct cb_id id; |
| 159 | 129 | ||
diff --git a/include/linux/coredump.h b/include/linux/coredump.h new file mode 100644 index 000000000000..8ba66a9d9022 --- /dev/null +++ b/include/linux/coredump.h | |||
| @@ -0,0 +1,45 @@ | |||
| 1 | #ifndef _LINUX_COREDUMP_H | ||
| 2 | #define _LINUX_COREDUMP_H | ||
| 3 | |||
| 4 | #include <linux/types.h> | ||
| 5 | #include <linux/mm.h> | ||
| 6 | #include <linux/fs.h> | ||
| 7 | |||
| 8 | /* | ||
| 9 | * These are the only things you should do on a core-file: use only these | ||
| 10 | * functions to write out all the necessary info. | ||
| 11 | */ | ||
| 12 | static inline int dump_write(struct file *file, const void *addr, int nr) | ||
| 13 | { | ||
| 14 | return file->f_op->write(file, addr, nr, &file->f_pos) == nr; | ||
| 15 | } | ||
| 16 | |||
| 17 | static inline int dump_seek(struct file *file, loff_t off) | ||
| 18 | { | ||
| 19 | int ret = 1; | ||
| 20 | |||
| 21 | if (file->f_op->llseek && file->f_op->llseek != no_llseek) { | ||
| 22 | if (file->f_op->llseek(file, off, SEEK_CUR) < 0) | ||
| 23 | return 0; | ||
| 24 | } else { | ||
| 25 | char *buf = (char *)get_zeroed_page(GFP_KERNEL); | ||
| 26 | |||
| 27 | if (!buf) | ||
| 28 | return 0; | ||
| 29 | while (off > 0) { | ||
| 30 | unsigned long n = off; | ||
| 31 | |||
| 32 | if (n > PAGE_SIZE) | ||
| 33 | n = PAGE_SIZE; | ||
| 34 | if (!dump_write(file, buf, n)) { | ||
| 35 | ret = 0; | ||
| 36 | break; | ||
| 37 | } | ||
| 38 | off -= n; | ||
| 39 | } | ||
| 40 | free_page((unsigned long)buf); | ||
| 41 | } | ||
| 42 | return ret; | ||
| 43 | } | ||
| 44 | |||
| 45 | #endif /* _LINUX_COREDUMP_H */ | ||
diff --git a/include/linux/cpu.h b/include/linux/cpu.h index 47536197ffdd..e287863ac053 100644 --- a/include/linux/cpu.h +++ b/include/linux/cpu.h | |||
| @@ -43,6 +43,8 @@ extern int sched_create_sysfs_power_savings_entries(struct sysdev_class *cls); | |||
| 43 | 43 | ||
| 44 | #ifdef CONFIG_HOTPLUG_CPU | 44 | #ifdef CONFIG_HOTPLUG_CPU |
| 45 | extern void unregister_cpu(struct cpu *cpu); | 45 | extern void unregister_cpu(struct cpu *cpu); |
| 46 | extern ssize_t arch_cpu_probe(const char *, size_t); | ||
| 47 | extern ssize_t arch_cpu_release(const char *, size_t); | ||
| 46 | #endif | 48 | #endif |
| 47 | struct notifier_block; | 49 | struct notifier_block; |
| 48 | 50 | ||
| @@ -115,6 +117,19 @@ extern void put_online_cpus(void); | |||
| 115 | #define unregister_hotcpu_notifier(nb) unregister_cpu_notifier(nb) | 117 | #define unregister_hotcpu_notifier(nb) unregister_cpu_notifier(nb) |
| 116 | int cpu_down(unsigned int cpu); | 118 | int cpu_down(unsigned int cpu); |
| 117 | 119 | ||
| 120 | #ifdef CONFIG_ARCH_CPU_PROBE_RELEASE | ||
| 121 | extern void cpu_hotplug_driver_lock(void); | ||
| 122 | extern void cpu_hotplug_driver_unlock(void); | ||
| 123 | #else | ||
| 124 | static inline void cpu_hotplug_driver_lock(void) | ||
| 125 | { | ||
| 126 | } | ||
| 127 | |||
| 128 | static inline void cpu_hotplug_driver_unlock(void) | ||
| 129 | { | ||
| 130 | } | ||
| 131 | #endif | ||
| 132 | |||
| 118 | #else /* CONFIG_HOTPLUG_CPU */ | 133 | #else /* CONFIG_HOTPLUG_CPU */ |
| 119 | 134 | ||
| 120 | #define get_online_cpus() do { } while (0) | 135 | #define get_online_cpus() do { } while (0) |
diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h index 79a2340d83cd..4de02b10007f 100644 --- a/include/linux/cpufreq.h +++ b/include/linux/cpufreq.h | |||
| @@ -232,6 +232,7 @@ struct cpufreq_driver { | |||
| 232 | /* optional */ | 232 | /* optional */ |
| 233 | unsigned int (*getavg) (struct cpufreq_policy *policy, | 233 | unsigned int (*getavg) (struct cpufreq_policy *policy, |
| 234 | unsigned int cpu); | 234 | unsigned int cpu); |
| 235 | int (*bios_limit) (int cpu, unsigned int *limit); | ||
| 235 | 236 | ||
| 236 | int (*exit) (struct cpufreq_policy *policy); | 237 | int (*exit) (struct cpufreq_policy *policy); |
| 237 | int (*suspend) (struct cpufreq_policy *policy, pm_message_t pmsg); | 238 | int (*suspend) (struct cpufreq_policy *policy, pm_message_t pmsg); |
diff --git a/include/linux/cpumask.h b/include/linux/cpumask.h index 789cf5f920ce..bae6fe24d1f9 100644 --- a/include/linux/cpumask.h +++ b/include/linux/cpumask.h | |||
| @@ -84,14 +84,16 @@ extern const struct cpumask *const cpu_active_mask; | |||
| 84 | #define num_online_cpus() cpumask_weight(cpu_online_mask) | 84 | #define num_online_cpus() cpumask_weight(cpu_online_mask) |
| 85 | #define num_possible_cpus() cpumask_weight(cpu_possible_mask) | 85 | #define num_possible_cpus() cpumask_weight(cpu_possible_mask) |
| 86 | #define num_present_cpus() cpumask_weight(cpu_present_mask) | 86 | #define num_present_cpus() cpumask_weight(cpu_present_mask) |
| 87 | #define num_active_cpus() cpumask_weight(cpu_active_mask) | ||
| 87 | #define cpu_online(cpu) cpumask_test_cpu((cpu), cpu_online_mask) | 88 | #define cpu_online(cpu) cpumask_test_cpu((cpu), cpu_online_mask) |
| 88 | #define cpu_possible(cpu) cpumask_test_cpu((cpu), cpu_possible_mask) | 89 | #define cpu_possible(cpu) cpumask_test_cpu((cpu), cpu_possible_mask) |
| 89 | #define cpu_present(cpu) cpumask_test_cpu((cpu), cpu_present_mask) | 90 | #define cpu_present(cpu) cpumask_test_cpu((cpu), cpu_present_mask) |
| 90 | #define cpu_active(cpu) cpumask_test_cpu((cpu), cpu_active_mask) | 91 | #define cpu_active(cpu) cpumask_test_cpu((cpu), cpu_active_mask) |
| 91 | #else | 92 | #else |
| 92 | #define num_online_cpus() 1 | 93 | #define num_online_cpus() 1U |
| 93 | #define num_possible_cpus() 1 | 94 | #define num_possible_cpus() 1U |
| 94 | #define num_present_cpus() 1 | 95 | #define num_present_cpus() 1U |
| 96 | #define num_active_cpus() 1U | ||
| 95 | #define cpu_online(cpu) ((cpu) == 0) | 97 | #define cpu_online(cpu) ((cpu) == 0) |
| 96 | #define cpu_possible(cpu) ((cpu) == 0) | 98 | #define cpu_possible(cpu) ((cpu) == 0) |
| 97 | #define cpu_present(cpu) ((cpu) == 0) | 99 | #define cpu_present(cpu) ((cpu) == 0) |
| @@ -141,6 +143,8 @@ static inline unsigned int cpumask_any_but(const struct cpumask *mask, | |||
| 141 | 143 | ||
| 142 | #define for_each_cpu(cpu, mask) \ | 144 | #define for_each_cpu(cpu, mask) \ |
| 143 | for ((cpu) = 0; (cpu) < 1; (cpu)++, (void)mask) | 145 | for ((cpu) = 0; (cpu) < 1; (cpu)++, (void)mask) |
| 146 | #define for_each_cpu_not(cpu, mask) \ | ||
| 147 | for ((cpu) = 0; (cpu) < 1; (cpu)++, (void)mask) | ||
| 144 | #define for_each_cpu_and(cpu, mask, and) \ | 148 | #define for_each_cpu_and(cpu, mask, and) \ |
| 145 | for ((cpu) = 0; (cpu) < 1; (cpu)++, (void)mask, (void)and) | 149 | for ((cpu) = 0; (cpu) < 1; (cpu)++, (void)mask, (void)and) |
| 146 | #else | 150 | #else |
| @@ -201,6 +205,18 @@ int cpumask_any_but(const struct cpumask *mask, unsigned int cpu); | |||
| 201 | (cpu) < nr_cpu_ids;) | 205 | (cpu) < nr_cpu_ids;) |
| 202 | 206 | ||
| 203 | /** | 207 | /** |
| 208 | * for_each_cpu_not - iterate over every cpu in a complemented mask | ||
| 209 | * @cpu: the (optionally unsigned) integer iterator | ||
| 210 | * @mask: the cpumask pointer | ||
| 211 | * | ||
| 212 | * After the loop, cpu is >= nr_cpu_ids. | ||
| 213 | */ | ||
| 214 | #define for_each_cpu_not(cpu, mask) \ | ||
| 215 | for ((cpu) = -1; \ | ||
| 216 | (cpu) = cpumask_next_zero((cpu), (mask)), \ | ||
| 217 | (cpu) < nr_cpu_ids;) | ||
| 218 | |||
| 219 | /** | ||
| 204 | * for_each_cpu_and - iterate over every cpu in both masks | 220 | * for_each_cpu_and - iterate over every cpu in both masks |
| 205 | * @cpu: the (optionally unsigned) integer iterator | 221 | * @cpu: the (optionally unsigned) integer iterator |
| 206 | * @mask: the first cpumask pointer | 222 | * @mask: the first cpumask pointer |
diff --git a/include/linux/cred.h b/include/linux/cred.h index 4e3387a89cb9..52507c3e1387 100644 --- a/include/linux/cred.h +++ b/include/linux/cred.h | |||
| @@ -280,7 +280,7 @@ static inline void put_cred(const struct cred *_cred) | |||
| 280 | * task or by holding tasklist_lock to prevent it from being unlinked. | 280 | * task or by holding tasklist_lock to prevent it from being unlinked. |
| 281 | */ | 281 | */ |
| 282 | #define __task_cred(task) \ | 282 | #define __task_cred(task) \ |
| 283 | ((const struct cred *)(rcu_dereference((task)->real_cred))) | 283 | ((const struct cred *)(rcu_dereference_check((task)->real_cred, rcu_read_lock_held() || lockdep_tasklist_lock_is_held()))) |
| 284 | 284 | ||
| 285 | /** | 285 | /** |
| 286 | * get_task_cred - Get another task's objective credentials | 286 | * get_task_cred - Get another task's objective credentials |
diff --git a/include/linux/crypto.h b/include/linux/crypto.h index fd929889e8dc..24d2e30f1b46 100644 --- a/include/linux/crypto.h +++ b/include/linux/crypto.h | |||
| @@ -250,29 +250,6 @@ struct cipher_alg { | |||
| 250 | void (*cia_decrypt)(struct crypto_tfm *tfm, u8 *dst, const u8 *src); | 250 | void (*cia_decrypt)(struct crypto_tfm *tfm, u8 *dst, const u8 *src); |
| 251 | }; | 251 | }; |
| 252 | 252 | ||
| 253 | struct digest_alg { | ||
| 254 | unsigned int dia_digestsize; | ||
| 255 | void (*dia_init)(struct crypto_tfm *tfm); | ||
| 256 | void (*dia_update)(struct crypto_tfm *tfm, const u8 *data, | ||
| 257 | unsigned int len); | ||
| 258 | void (*dia_final)(struct crypto_tfm *tfm, u8 *out); | ||
| 259 | int (*dia_setkey)(struct crypto_tfm *tfm, const u8 *key, | ||
| 260 | unsigned int keylen); | ||
| 261 | }; | ||
| 262 | |||
| 263 | struct hash_alg { | ||
| 264 | int (*init)(struct hash_desc *desc); | ||
| 265 | int (*update)(struct hash_desc *desc, struct scatterlist *sg, | ||
| 266 | unsigned int nbytes); | ||
| 267 | int (*final)(struct hash_desc *desc, u8 *out); | ||
| 268 | int (*digest)(struct hash_desc *desc, struct scatterlist *sg, | ||
| 269 | unsigned int nbytes, u8 *out); | ||
| 270 | int (*setkey)(struct crypto_hash *tfm, const u8 *key, | ||
| 271 | unsigned int keylen); | ||
| 272 | |||
| 273 | unsigned int digestsize; | ||
| 274 | }; | ||
| 275 | |||
| 276 | struct compress_alg { | 253 | struct compress_alg { |
| 277 | int (*coa_compress)(struct crypto_tfm *tfm, const u8 *src, | 254 | int (*coa_compress)(struct crypto_tfm *tfm, const u8 *src, |
| 278 | unsigned int slen, u8 *dst, unsigned int *dlen); | 255 | unsigned int slen, u8 *dst, unsigned int *dlen); |
| @@ -293,8 +270,6 @@ struct rng_alg { | |||
| 293 | #define cra_aead cra_u.aead | 270 | #define cra_aead cra_u.aead |
| 294 | #define cra_blkcipher cra_u.blkcipher | 271 | #define cra_blkcipher cra_u.blkcipher |
| 295 | #define cra_cipher cra_u.cipher | 272 | #define cra_cipher cra_u.cipher |
| 296 | #define cra_digest cra_u.digest | ||
| 297 | #define cra_hash cra_u.hash | ||
| 298 | #define cra_compress cra_u.compress | 273 | #define cra_compress cra_u.compress |
| 299 | #define cra_rng cra_u.rng | 274 | #define cra_rng cra_u.rng |
| 300 | 275 | ||
| @@ -320,8 +295,6 @@ struct crypto_alg { | |||
| 320 | struct aead_alg aead; | 295 | struct aead_alg aead; |
| 321 | struct blkcipher_alg blkcipher; | 296 | struct blkcipher_alg blkcipher; |
| 322 | struct cipher_alg cipher; | 297 | struct cipher_alg cipher; |
| 323 | struct digest_alg digest; | ||
| 324 | struct hash_alg hash; | ||
| 325 | struct compress_alg compress; | 298 | struct compress_alg compress; |
| 326 | struct rng_alg rng; | 299 | struct rng_alg rng; |
| 327 | } cra_u; | 300 | } cra_u; |
diff --git a/include/linux/cryptohash.h b/include/linux/cryptohash.h index c118b2ad9807..ec78a4bbe1d5 100644 --- a/include/linux/cryptohash.h +++ b/include/linux/cryptohash.h | |||
| @@ -2,6 +2,7 @@ | |||
| 2 | #define __CRYPTOHASH_H | 2 | #define __CRYPTOHASH_H |
| 3 | 3 | ||
| 4 | #define SHA_DIGEST_WORDS 5 | 4 | #define SHA_DIGEST_WORDS 5 |
| 5 | #define SHA_MESSAGE_BYTES (512 /*bits*/ / 8) | ||
| 5 | #define SHA_WORKSPACE_WORDS 80 | 6 | #define SHA_WORKSPACE_WORDS 80 |
| 6 | 7 | ||
| 7 | void sha_init(__u32 *buf); | 8 | void sha_init(__u32 *buf); |
diff --git a/include/linux/cs5535.h b/include/linux/cs5535.h new file mode 100644 index 000000000000..d5a1d4810b80 --- /dev/null +++ b/include/linux/cs5535.h | |||
| @@ -0,0 +1,172 @@ | |||
| 1 | /* | ||
| 2 | * AMD CS5535/CS5536 definitions | ||
| 3 | * Copyright (C) 2006 Advanced Micro Devices, Inc. | ||
| 4 | * Copyright (C) 2009 Andres Salomon <dilinger@collabora.co.uk> | ||
| 5 | * | ||
| 6 | * This program is free software; you can redistribute it and/or | ||
| 7 | * modify it under the terms of version 2 of the GNU General Public License | ||
| 8 | * as published by the Free Software Foundation. | ||
| 9 | */ | ||
| 10 | |||
| 11 | #ifndef _CS5535_H | ||
| 12 | #define _CS5535_H | ||
| 13 | |||
| 14 | /* MSRs */ | ||
| 15 | #define MSR_GLIU_P2D_RO0 0x10000029 | ||
| 16 | |||
| 17 | #define MSR_LX_GLD_MSR_CONFIG 0x48002001 | ||
| 18 | #define MSR_LX_MSR_PADSEL 0x48002011 /* NOT 0x48000011; the data | ||
| 19 | * sheet has the wrong value */ | ||
| 20 | #define MSR_GLCP_SYS_RSTPLL 0x4C000014 | ||
| 21 | #define MSR_GLCP_DOTPLL 0x4C000015 | ||
| 22 | |||
| 23 | #define MSR_LBAR_SMB 0x5140000B | ||
| 24 | #define MSR_LBAR_GPIO 0x5140000C | ||
| 25 | #define MSR_LBAR_MFGPT 0x5140000D | ||
| 26 | #define MSR_LBAR_ACPI 0x5140000E | ||
| 27 | #define MSR_LBAR_PMS 0x5140000F | ||
| 28 | |||
| 29 | #define MSR_DIVIL_SOFT_RESET 0x51400017 | ||
| 30 | |||
| 31 | #define MSR_PIC_YSEL_LOW 0x51400020 | ||
| 32 | #define MSR_PIC_YSEL_HIGH 0x51400021 | ||
| 33 | #define MSR_PIC_ZSEL_LOW 0x51400022 | ||
| 34 | #define MSR_PIC_ZSEL_HIGH 0x51400023 | ||
| 35 | #define MSR_PIC_IRQM_LPC 0x51400025 | ||
| 36 | |||
| 37 | #define MSR_MFGPT_IRQ 0x51400028 | ||
| 38 | #define MSR_MFGPT_NR 0x51400029 | ||
| 39 | #define MSR_MFGPT_SETUP 0x5140002B | ||
| 40 | |||
| 41 | #define MSR_LX_SPARE_MSR 0x80000011 /* DC-specific */ | ||
| 42 | |||
| 43 | #define MSR_GX_GLD_MSR_CONFIG 0xC0002001 | ||
| 44 | #define MSR_GX_MSR_PADSEL 0xC0002011 | ||
| 45 | |||
| 46 | /* resource sizes */ | ||
| 47 | #define LBAR_GPIO_SIZE 0xFF | ||
| 48 | #define LBAR_MFGPT_SIZE 0x40 | ||
| 49 | #define LBAR_ACPI_SIZE 0x40 | ||
| 50 | #define LBAR_PMS_SIZE 0x80 | ||
| 51 | |||
| 52 | /* VSA2 magic values */ | ||
| 53 | #define VSA_VRC_INDEX 0xAC1C | ||
| 54 | #define VSA_VRC_DATA 0xAC1E | ||
| 55 | #define VSA_VR_UNLOCK 0xFC53 /* unlock virtual register */ | ||
| 56 | #define VSA_VR_SIGNATURE 0x0003 | ||
| 57 | #define VSA_VR_MEM_SIZE 0x0200 | ||
| 58 | #define AMD_VSA_SIG 0x4132 /* signature is ascii 'VSA2' */ | ||
| 59 | #define GSW_VSA_SIG 0x534d /* General Software signature */ | ||
| 60 | |||
| 61 | #include <linux/io.h> | ||
| 62 | |||
| 63 | static inline int cs5535_has_vsa2(void) | ||
| 64 | { | ||
| 65 | static int has_vsa2 = -1; | ||
| 66 | |||
| 67 | if (has_vsa2 == -1) { | ||
| 68 | uint16_t val; | ||
| 69 | |||
| 70 | /* | ||
| 71 | * The VSA has virtual registers that we can query for a | ||
| 72 | * signature. | ||
| 73 | */ | ||
| 74 | outw(VSA_VR_UNLOCK, VSA_VRC_INDEX); | ||
| 75 | outw(VSA_VR_SIGNATURE, VSA_VRC_INDEX); | ||
| 76 | |||
| 77 | val = inw(VSA_VRC_DATA); | ||
| 78 | has_vsa2 = (val == AMD_VSA_SIG || val == GSW_VSA_SIG); | ||
| 79 | } | ||
| 80 | |||
| 81 | return has_vsa2; | ||
| 82 | } | ||
| 83 | |||
| 84 | /* GPIOs */ | ||
| 85 | #define GPIO_OUTPUT_VAL 0x00 | ||
| 86 | #define GPIO_OUTPUT_ENABLE 0x04 | ||
| 87 | #define GPIO_OUTPUT_OPEN_DRAIN 0x08 | ||
| 88 | #define GPIO_OUTPUT_INVERT 0x0C | ||
| 89 | #define GPIO_OUTPUT_AUX1 0x10 | ||
| 90 | #define GPIO_OUTPUT_AUX2 0x14 | ||
| 91 | #define GPIO_PULL_UP 0x18 | ||
| 92 | #define GPIO_PULL_DOWN 0x1C | ||
| 93 | #define GPIO_INPUT_ENABLE 0x20 | ||
| 94 | #define GPIO_INPUT_INVERT 0x24 | ||
| 95 | #define GPIO_INPUT_FILTER 0x28 | ||
| 96 | #define GPIO_INPUT_EVENT_COUNT 0x2C | ||
| 97 | #define GPIO_READ_BACK 0x30 | ||
| 98 | #define GPIO_INPUT_AUX1 0x34 | ||
| 99 | #define GPIO_EVENTS_ENABLE 0x38 | ||
| 100 | #define GPIO_LOCK_ENABLE 0x3C | ||
| 101 | #define GPIO_POSITIVE_EDGE_EN 0x40 | ||
| 102 | #define GPIO_NEGATIVE_EDGE_EN 0x44 | ||
| 103 | #define GPIO_POSITIVE_EDGE_STS 0x48 | ||
| 104 | #define GPIO_NEGATIVE_EDGE_STS 0x4C | ||
| 105 | |||
| 106 | #define GPIO_MAP_X 0xE0 | ||
| 107 | #define GPIO_MAP_Y 0xE4 | ||
| 108 | #define GPIO_MAP_Z 0xE8 | ||
| 109 | #define GPIO_MAP_W 0xEC | ||
| 110 | |||
| 111 | void cs5535_gpio_set(unsigned offset, unsigned int reg); | ||
| 112 | void cs5535_gpio_clear(unsigned offset, unsigned int reg); | ||
| 113 | int cs5535_gpio_isset(unsigned offset, unsigned int reg); | ||
| 114 | |||
| 115 | /* MFGPTs */ | ||
| 116 | |||
| 117 | #define MFGPT_MAX_TIMERS 8 | ||
| 118 | #define MFGPT_TIMER_ANY (-1) | ||
| 119 | |||
| 120 | #define MFGPT_DOMAIN_WORKING 1 | ||
| 121 | #define MFGPT_DOMAIN_STANDBY 2 | ||
| 122 | #define MFGPT_DOMAIN_ANY (MFGPT_DOMAIN_WORKING | MFGPT_DOMAIN_STANDBY) | ||
| 123 | |||
| 124 | #define MFGPT_CMP1 0 | ||
| 125 | #define MFGPT_CMP2 1 | ||
| 126 | |||
| 127 | #define MFGPT_EVENT_IRQ 0 | ||
| 128 | #define MFGPT_EVENT_NMI 1 | ||
| 129 | #define MFGPT_EVENT_RESET 3 | ||
| 130 | |||
| 131 | #define MFGPT_REG_CMP1 0 | ||
| 132 | #define MFGPT_REG_CMP2 2 | ||
| 133 | #define MFGPT_REG_COUNTER 4 | ||
| 134 | #define MFGPT_REG_SETUP 6 | ||
| 135 | |||
| 136 | #define MFGPT_SETUP_CNTEN (1 << 15) | ||
| 137 | #define MFGPT_SETUP_CMP2 (1 << 14) | ||
| 138 | #define MFGPT_SETUP_CMP1 (1 << 13) | ||
| 139 | #define MFGPT_SETUP_SETUP (1 << 12) | ||
| 140 | #define MFGPT_SETUP_STOPEN (1 << 11) | ||
| 141 | #define MFGPT_SETUP_EXTEN (1 << 10) | ||
| 142 | #define MFGPT_SETUP_REVEN (1 << 5) | ||
| 143 | #define MFGPT_SETUP_CLKSEL (1 << 4) | ||
| 144 | |||
| 145 | struct cs5535_mfgpt_timer; | ||
| 146 | |||
| 147 | extern uint16_t cs5535_mfgpt_read(struct cs5535_mfgpt_timer *timer, | ||
| 148 | uint16_t reg); | ||
| 149 | extern void cs5535_mfgpt_write(struct cs5535_mfgpt_timer *timer, uint16_t reg, | ||
| 150 | uint16_t value); | ||
| 151 | |||
| 152 | extern int cs5535_mfgpt_toggle_event(struct cs5535_mfgpt_timer *timer, int cmp, | ||
| 153 | int event, int enable); | ||
| 154 | extern int cs5535_mfgpt_set_irq(struct cs5535_mfgpt_timer *timer, int cmp, | ||
| 155 | int *irq, int enable); | ||
| 156 | extern struct cs5535_mfgpt_timer *cs5535_mfgpt_alloc_timer(int timer, | ||
| 157 | int domain); | ||
| 158 | extern void cs5535_mfgpt_free_timer(struct cs5535_mfgpt_timer *timer); | ||
| 159 | |||
| 160 | static inline int cs5535_mfgpt_setup_irq(struct cs5535_mfgpt_timer *timer, | ||
| 161 | int cmp, int *irq) | ||
| 162 | { | ||
| 163 | return cs5535_mfgpt_set_irq(timer, cmp, irq, 1); | ||
| 164 | } | ||
| 165 | |||
| 166 | static inline int cs5535_mfgpt_release_irq(struct cs5535_mfgpt_timer *timer, | ||
| 167 | int cmp, int *irq) | ||
| 168 | { | ||
| 169 | return cs5535_mfgpt_set_irq(timer, cmp, irq, 0); | ||
| 170 | } | ||
| 171 | |||
| 172 | #endif | ||
diff --git a/include/linux/ctype.h b/include/linux/ctype.h index afa36392297a..a3d6ee0044f9 100644 --- a/include/linux/ctype.h +++ b/include/linux/ctype.h | |||
| @@ -15,7 +15,7 @@ | |||
| 15 | #define _X 0x40 /* hex digit */ | 15 | #define _X 0x40 /* hex digit */ |
| 16 | #define _SP 0x80 /* hard space (0x20) */ | 16 | #define _SP 0x80 /* hard space (0x20) */ |
| 17 | 17 | ||
| 18 | extern unsigned char _ctype[]; | 18 | extern const unsigned char _ctype[]; |
| 19 | 19 | ||
| 20 | #define __ismask(x) (_ctype[(int)(unsigned char)(x)]) | 20 | #define __ismask(x) (_ctype[(int)(unsigned char)(x)]) |
| 21 | 21 | ||
| @@ -27,6 +27,7 @@ extern unsigned char _ctype[]; | |||
| 27 | #define islower(c) ((__ismask(c)&(_L)) != 0) | 27 | #define islower(c) ((__ismask(c)&(_L)) != 0) |
| 28 | #define isprint(c) ((__ismask(c)&(_P|_U|_L|_D|_SP)) != 0) | 28 | #define isprint(c) ((__ismask(c)&(_P|_U|_L|_D|_SP)) != 0) |
| 29 | #define ispunct(c) ((__ismask(c)&(_P)) != 0) | 29 | #define ispunct(c) ((__ismask(c)&(_P)) != 0) |
| 30 | /* Note: isspace() must return false for %NUL-terminator */ | ||
| 30 | #define isspace(c) ((__ismask(c)&(_S)) != 0) | 31 | #define isspace(c) ((__ismask(c)&(_S)) != 0) |
| 31 | #define isupper(c) ((__ismask(c)&(_U)) != 0) | 32 | #define isupper(c) ((__ismask(c)&(_U)) != 0) |
| 32 | #define isxdigit(c) ((__ismask(c)&(_D|_X)) != 0) | 33 | #define isxdigit(c) ((__ismask(c)&(_D|_X)) != 0) |
diff --git a/include/linux/davinci_emac.h b/include/linux/davinci_emac.h new file mode 100644 index 000000000000..7c930dba477c --- /dev/null +++ b/include/linux/davinci_emac.h | |||
| @@ -0,0 +1,39 @@ | |||
| 1 | /* | ||
| 2 | * TI DaVinci EMAC platform support | ||
| 3 | * | ||
| 4 | * Author: Kevin Hilman, Deep Root Systems, LLC | ||
| 5 | * | ||
| 6 | * 2007 (c) Deep Root Systems, LLC. This file is licensed under | ||
| 7 | * the terms of the GNU General Public License version 2. This program | ||
| 8 | * is licensed "as is" without any warranty of any kind, whether express | ||
| 9 | * or implied. | ||
| 10 | */ | ||
| 11 | #ifndef _LINUX_DAVINCI_EMAC_H | ||
| 12 | #define _LINUX_DAVINCI_EMAC_H | ||
| 13 | |||
| 14 | #include <linux/if_ether.h> | ||
| 15 | #include <linux/memory.h> | ||
| 16 | |||
| 17 | struct emac_platform_data { | ||
| 18 | char mac_addr[ETH_ALEN]; | ||
| 19 | u32 ctrl_reg_offset; | ||
| 20 | u32 ctrl_mod_reg_offset; | ||
| 21 | u32 ctrl_ram_offset; | ||
| 22 | u32 hw_ram_addr; | ||
| 23 | u32 mdio_reg_offset; | ||
| 24 | u32 ctrl_ram_size; | ||
| 25 | u32 phy_mask; | ||
| 26 | u32 mdio_max_freq; | ||
| 27 | u8 rmii_en; | ||
| 28 | u8 version; | ||
| 29 | void (*interrupt_enable) (void); | ||
| 30 | void (*interrupt_disable) (void); | ||
| 31 | }; | ||
| 32 | |||
| 33 | enum { | ||
| 34 | EMAC_VERSION_1, /* DM644x */ | ||
| 35 | EMAC_VERSION_2, /* DM646x */ | ||
| 36 | }; | ||
| 37 | |||
| 38 | void davinci_get_mac_addr(struct memory_accessor *mem_acc, void *context); | ||
| 39 | #endif | ||
diff --git a/include/linux/dcache.h b/include/linux/dcache.h index 30b93b2a01a4..eebb617c17d8 100644 --- a/include/linux/dcache.h +++ b/include/linux/dcache.h | |||
| @@ -186,6 +186,8 @@ d_iput: no no no yes | |||
| 186 | 186 | ||
| 187 | #define DCACHE_FSNOTIFY_PARENT_WATCHED 0x0080 /* Parent inode is watched by some fsnotify listener */ | 187 | #define DCACHE_FSNOTIFY_PARENT_WATCHED 0x0080 /* Parent inode is watched by some fsnotify listener */ |
| 188 | 188 | ||
| 189 | #define DCACHE_CANT_MOUNT 0x0100 | ||
| 190 | |||
| 189 | extern spinlock_t dcache_lock; | 191 | extern spinlock_t dcache_lock; |
| 190 | extern seqlock_t rename_lock; | 192 | extern seqlock_t rename_lock; |
| 191 | 193 | ||
| @@ -358,6 +360,18 @@ static inline int d_unlinked(struct dentry *dentry) | |||
| 358 | return d_unhashed(dentry) && !IS_ROOT(dentry); | 360 | return d_unhashed(dentry) && !IS_ROOT(dentry); |
| 359 | } | 361 | } |
| 360 | 362 | ||
| 363 | static inline int cant_mount(struct dentry *dentry) | ||
| 364 | { | ||
| 365 | return (dentry->d_flags & DCACHE_CANT_MOUNT); | ||
| 366 | } | ||
| 367 | |||
| 368 | static inline void dont_mount(struct dentry *dentry) | ||
| 369 | { | ||
| 370 | spin_lock(&dentry->d_lock); | ||
| 371 | dentry->d_flags |= DCACHE_CANT_MOUNT; | ||
| 372 | spin_unlock(&dentry->d_lock); | ||
| 373 | } | ||
| 374 | |||
| 361 | static inline struct dentry *dget_parent(struct dentry *dentry) | 375 | static inline struct dentry *dget_parent(struct dentry *dentry) |
| 362 | { | 376 | { |
| 363 | struct dentry *ret; | 377 | struct dentry *ret; |
diff --git a/include/linux/decompress/mm.h b/include/linux/decompress/mm.h index 12ff8c3f1d05..ad5ec1d0475e 100644 --- a/include/linux/decompress/mm.h +++ b/include/linux/decompress/mm.h | |||
| @@ -14,18 +14,28 @@ | |||
| 14 | 14 | ||
| 15 | /* Code active when included from pre-boot environment: */ | 15 | /* Code active when included from pre-boot environment: */ |
| 16 | 16 | ||
| 17 | /* | ||
| 18 | * Some architectures want to ensure there is no local data in their | ||
| 19 | * pre-boot environment, so that data can arbitarily relocated (via | ||
| 20 | * GOT references). This is achieved by defining STATIC_RW_DATA to | ||
| 21 | * be null. | ||
| 22 | */ | ||
| 23 | #ifndef STATIC_RW_DATA | ||
| 24 | #define STATIC_RW_DATA static | ||
| 25 | #endif | ||
| 26 | |||
| 17 | /* A trivial malloc implementation, adapted from | 27 | /* A trivial malloc implementation, adapted from |
| 18 | * malloc by Hannu Savolainen 1993 and Matthias Urlichs 1994 | 28 | * malloc by Hannu Savolainen 1993 and Matthias Urlichs 1994 |
| 19 | */ | 29 | */ |
| 20 | static unsigned long malloc_ptr; | 30 | STATIC_RW_DATA unsigned long malloc_ptr; |
| 21 | static int malloc_count; | 31 | STATIC_RW_DATA int malloc_count; |
| 22 | 32 | ||
| 23 | static void *malloc(int size) | 33 | static void *malloc(int size) |
| 24 | { | 34 | { |
| 25 | void *p; | 35 | void *p; |
| 26 | 36 | ||
| 27 | if (size < 0) | 37 | if (size < 0) |
| 28 | error("Malloc error"); | 38 | return NULL; |
| 29 | if (!malloc_ptr) | 39 | if (!malloc_ptr) |
| 30 | malloc_ptr = free_mem_ptr; | 40 | malloc_ptr = free_mem_ptr; |
| 31 | 41 | ||
| @@ -35,7 +45,7 @@ static void *malloc(int size) | |||
| 35 | malloc_ptr += size; | 45 | malloc_ptr += size; |
| 36 | 46 | ||
| 37 | if (free_mem_end_ptr && malloc_ptr >= free_mem_end_ptr) | 47 | if (free_mem_end_ptr && malloc_ptr >= free_mem_end_ptr) |
| 38 | error("Out of memory"); | 48 | return NULL; |
| 39 | 49 | ||
| 40 | malloc_count++; | 50 | malloc_count++; |
| 41 | return p; | 51 | return p; |
diff --git a/include/linux/decompress/unlzo.h b/include/linux/decompress/unlzo.h new file mode 100644 index 000000000000..987229752519 --- /dev/null +++ b/include/linux/decompress/unlzo.h | |||
| @@ -0,0 +1,10 @@ | |||
| 1 | #ifndef DECOMPRESS_UNLZO_H | ||
| 2 | #define DECOMPRESS_UNLZO_H | ||
| 3 | |||
| 4 | int unlzo(unsigned char *inbuf, int len, | ||
| 5 | int(*fill)(void*, unsigned int), | ||
| 6 | int(*flush)(void*, unsigned int), | ||
| 7 | unsigned char *output, | ||
| 8 | int *pos, | ||
| 9 | void(*error)(char *x)); | ||
| 10 | #endif | ||
diff --git a/include/linux/delayacct.h b/include/linux/delayacct.h index 5076fe0c8a96..6cee17c22313 100644 --- a/include/linux/delayacct.h +++ b/include/linux/delayacct.h | |||
| @@ -18,6 +18,7 @@ | |||
| 18 | #define _LINUX_DELAYACCT_H | 18 | #define _LINUX_DELAYACCT_H |
| 19 | 19 | ||
| 20 | #include <linux/sched.h> | 20 | #include <linux/sched.h> |
| 21 | #include <linux/slab.h> | ||
| 21 | 22 | ||
| 22 | /* | 23 | /* |
| 23 | * Per-task flags relevant to delay accounting | 24 | * Per-task flags relevant to delay accounting |
diff --git a/include/linux/device-mapper.h b/include/linux/device-mapper.h index df7607e6dce8..1381cd97b4ed 100644 --- a/include/linux/device-mapper.h +++ b/include/linux/device-mapper.h | |||
| @@ -118,10 +118,9 @@ struct dm_dev { | |||
| 118 | /* | 118 | /* |
| 119 | * Constructors should call these functions to ensure destination devices | 119 | * Constructors should call these functions to ensure destination devices |
| 120 | * are opened/closed correctly. | 120 | * are opened/closed correctly. |
| 121 | * FIXME: too many arguments. | ||
| 122 | */ | 121 | */ |
| 123 | int dm_get_device(struct dm_target *ti, const char *path, sector_t start, | 122 | int dm_get_device(struct dm_target *ti, const char *path, fmode_t mode, |
| 124 | sector_t len, fmode_t mode, struct dm_dev **result); | 123 | struct dm_dev **result); |
| 125 | void dm_put_device(struct dm_target *ti, struct dm_dev *d); | 124 | void dm_put_device(struct dm_target *ti, struct dm_dev *d); |
| 126 | 125 | ||
| 127 | /* | 126 | /* |
| @@ -235,7 +234,7 @@ void dm_uevent_add(struct mapped_device *md, struct list_head *elist); | |||
| 235 | const char *dm_device_name(struct mapped_device *md); | 234 | const char *dm_device_name(struct mapped_device *md); |
| 236 | int dm_copy_name_and_uuid(struct mapped_device *md, char *name, char *uuid); | 235 | int dm_copy_name_and_uuid(struct mapped_device *md, char *name, char *uuid); |
| 237 | struct gendisk *dm_disk(struct mapped_device *md); | 236 | struct gendisk *dm_disk(struct mapped_device *md); |
| 238 | int dm_suspended(struct mapped_device *md); | 237 | int dm_suspended(struct dm_target *ti); |
| 239 | int dm_noflush_suspending(struct dm_target *ti); | 238 | int dm_noflush_suspending(struct dm_target *ti); |
| 240 | union map_info *dm_get_mapinfo(struct bio *bio); | 239 | union map_info *dm_get_mapinfo(struct bio *bio); |
| 241 | union map_info *dm_get_rq_mapinfo(struct request *rq); | 240 | union map_info *dm_get_rq_mapinfo(struct request *rq); |
| @@ -276,7 +275,7 @@ void dm_table_unplug_all(struct dm_table *t); | |||
| 276 | /* | 275 | /* |
| 277 | * Table reference counting. | 276 | * Table reference counting. |
| 278 | */ | 277 | */ |
| 279 | struct dm_table *dm_get_table(struct mapped_device *md); | 278 | struct dm_table *dm_get_live_table(struct mapped_device *md); |
| 280 | void dm_table_get(struct dm_table *t); | 279 | void dm_table_get(struct dm_table *t); |
| 281 | void dm_table_put(struct dm_table *t); | 280 | void dm_table_put(struct dm_table *t); |
| 282 | 281 | ||
| @@ -295,8 +294,10 @@ void dm_table_event(struct dm_table *t); | |||
| 295 | 294 | ||
| 296 | /* | 295 | /* |
| 297 | * The device must be suspended before calling this method. | 296 | * The device must be suspended before calling this method. |
| 297 | * Returns the previous table, which the caller must destroy. | ||
| 298 | */ | 298 | */ |
| 299 | int dm_swap_table(struct mapped_device *md, struct dm_table *t); | 299 | struct dm_table *dm_swap_table(struct mapped_device *md, |
| 300 | struct dm_table *t); | ||
| 300 | 301 | ||
| 301 | /* | 302 | /* |
| 302 | * A wrapper around vmalloc. | 303 | * A wrapper around vmalloc. |
diff --git a/include/linux/device.h b/include/linux/device.h index 2ea3e4921812..182192892d45 100644 --- a/include/linux/device.h +++ b/include/linux/device.h | |||
| @@ -106,7 +106,7 @@ extern int bus_unregister_notifier(struct bus_type *bus, | |||
| 106 | 106 | ||
| 107 | /* All 4 notifers below get called with the target struct device * | 107 | /* All 4 notifers below get called with the target struct device * |
| 108 | * as an argument. Note that those functions are likely to be called | 108 | * as an argument. Note that those functions are likely to be called |
| 109 | * with the device semaphore held in the core, so be careful. | 109 | * with the device lock held in the core, so be careful. |
| 110 | */ | 110 | */ |
| 111 | #define BUS_NOTIFY_ADD_DEVICE 0x00000001 /* device added */ | 111 | #define BUS_NOTIFY_ADD_DEVICE 0x00000001 /* device added */ |
| 112 | #define BUS_NOTIFY_DEL_DEVICE 0x00000002 /* device removed */ | 112 | #define BUS_NOTIFY_DEL_DEVICE 0x00000002 /* device removed */ |
| @@ -166,9 +166,9 @@ struct driver_attribute driver_attr_##_name = \ | |||
| 166 | __ATTR(_name, _mode, _show, _store) | 166 | __ATTR(_name, _mode, _show, _store) |
| 167 | 167 | ||
| 168 | extern int __must_check driver_create_file(struct device_driver *driver, | 168 | extern int __must_check driver_create_file(struct device_driver *driver, |
| 169 | struct driver_attribute *attr); | 169 | const struct driver_attribute *attr); |
| 170 | extern void driver_remove_file(struct device_driver *driver, | 170 | extern void driver_remove_file(struct device_driver *driver, |
| 171 | struct driver_attribute *attr); | 171 | const struct driver_attribute *attr); |
| 172 | 172 | ||
| 173 | extern int __must_check driver_add_kobj(struct device_driver *drv, | 173 | extern int __must_check driver_add_kobj(struct device_driver *drv, |
| 174 | struct kobject *kobj, | 174 | struct kobject *kobj, |
| @@ -251,8 +251,10 @@ extern struct device *class_find_device(struct class *class, | |||
| 251 | 251 | ||
| 252 | struct class_attribute { | 252 | struct class_attribute { |
| 253 | struct attribute attr; | 253 | struct attribute attr; |
| 254 | ssize_t (*show)(struct class *class, char *buf); | 254 | ssize_t (*show)(struct class *class, struct class_attribute *attr, |
| 255 | ssize_t (*store)(struct class *class, const char *buf, size_t count); | 255 | char *buf); |
| 256 | ssize_t (*store)(struct class *class, struct class_attribute *attr, | ||
| 257 | const char *buf, size_t count); | ||
| 256 | }; | 258 | }; |
| 257 | 259 | ||
| 258 | #define CLASS_ATTR(_name, _mode, _show, _store) \ | 260 | #define CLASS_ATTR(_name, _mode, _show, _store) \ |
| @@ -263,6 +265,23 @@ extern int __must_check class_create_file(struct class *class, | |||
| 263 | extern void class_remove_file(struct class *class, | 265 | extern void class_remove_file(struct class *class, |
| 264 | const struct class_attribute *attr); | 266 | const struct class_attribute *attr); |
| 265 | 267 | ||
| 268 | /* Simple class attribute that is just a static string */ | ||
| 269 | |||
| 270 | struct class_attribute_string { | ||
| 271 | struct class_attribute attr; | ||
| 272 | char *str; | ||
| 273 | }; | ||
| 274 | |||
| 275 | /* Currently read-only only */ | ||
| 276 | #define _CLASS_ATTR_STRING(_name, _mode, _str) \ | ||
| 277 | { __ATTR(_name, _mode, show_class_attr_string, NULL), _str } | ||
| 278 | #define CLASS_ATTR_STRING(_name, _mode, _str) \ | ||
| 279 | struct class_attribute_string class_attr_##_name = \ | ||
| 280 | _CLASS_ATTR_STRING(_name, _mode, _str) | ||
| 281 | |||
| 282 | extern ssize_t show_class_attr_string(struct class *class, struct class_attribute *attr, | ||
| 283 | char *buf); | ||
| 284 | |||
| 266 | struct class_interface { | 285 | struct class_interface { |
| 267 | struct list_head node; | 286 | struct list_head node; |
| 268 | struct class *class; | 287 | struct class *class; |
| @@ -319,13 +338,13 @@ struct device_attribute { | |||
| 319 | struct device_attribute dev_attr_##_name = __ATTR(_name, _mode, _show, _store) | 338 | struct device_attribute dev_attr_##_name = __ATTR(_name, _mode, _show, _store) |
| 320 | 339 | ||
| 321 | extern int __must_check device_create_file(struct device *device, | 340 | extern int __must_check device_create_file(struct device *device, |
| 322 | struct device_attribute *entry); | 341 | const struct device_attribute *entry); |
| 323 | extern void device_remove_file(struct device *dev, | 342 | extern void device_remove_file(struct device *dev, |
| 324 | struct device_attribute *attr); | 343 | const struct device_attribute *attr); |
| 325 | extern int __must_check device_create_bin_file(struct device *dev, | 344 | extern int __must_check device_create_bin_file(struct device *dev, |
| 326 | struct bin_attribute *attr); | 345 | const struct bin_attribute *attr); |
| 327 | extern void device_remove_bin_file(struct device *dev, | 346 | extern void device_remove_bin_file(struct device *dev, |
| 328 | struct bin_attribute *attr); | 347 | const struct bin_attribute *attr); |
| 329 | extern int device_schedule_callback_owner(struct device *dev, | 348 | extern int device_schedule_callback_owner(struct device *dev, |
| 330 | void (*func)(struct device *dev), struct module *owner); | 349 | void (*func)(struct device *dev), struct module *owner); |
| 331 | 350 | ||
| @@ -472,6 +491,38 @@ static inline int device_is_registered(struct device *dev) | |||
| 472 | return dev->kobj.state_in_sysfs; | 491 | return dev->kobj.state_in_sysfs; |
| 473 | } | 492 | } |
| 474 | 493 | ||
| 494 | static inline void device_enable_async_suspend(struct device *dev) | ||
| 495 | { | ||
| 496 | if (dev->power.status == DPM_ON) | ||
| 497 | dev->power.async_suspend = true; | ||
| 498 | } | ||
| 499 | |||
| 500 | static inline void device_disable_async_suspend(struct device *dev) | ||
| 501 | { | ||
| 502 | if (dev->power.status == DPM_ON) | ||
| 503 | dev->power.async_suspend = false; | ||
| 504 | } | ||
| 505 | |||
| 506 | static inline bool device_async_suspend_enabled(struct device *dev) | ||
| 507 | { | ||
| 508 | return !!dev->power.async_suspend; | ||
| 509 | } | ||
| 510 | |||
| 511 | static inline void device_lock(struct device *dev) | ||
| 512 | { | ||
| 513 | down(&dev->sem); | ||
| 514 | } | ||
| 515 | |||
| 516 | static inline int device_trylock(struct device *dev) | ||
| 517 | { | ||
| 518 | return down_trylock(&dev->sem); | ||
| 519 | } | ||
| 520 | |||
| 521 | static inline void device_unlock(struct device *dev) | ||
| 522 | { | ||
| 523 | up(&dev->sem); | ||
| 524 | } | ||
| 525 | |||
| 475 | void driver_init(void); | 526 | void driver_init(void); |
| 476 | 527 | ||
| 477 | /* | 528 | /* |
| @@ -558,7 +609,7 @@ extern void wait_for_device_probe(void); | |||
| 558 | #ifdef CONFIG_DEVTMPFS | 609 | #ifdef CONFIG_DEVTMPFS |
| 559 | extern int devtmpfs_create_node(struct device *dev); | 610 | extern int devtmpfs_create_node(struct device *dev); |
| 560 | extern int devtmpfs_delete_node(struct device *dev); | 611 | extern int devtmpfs_delete_node(struct device *dev); |
| 561 | extern int devtmpfs_mount(const char *mountpoint); | 612 | extern int devtmpfs_mount(const char *mntdir); |
| 562 | #else | 613 | #else |
| 563 | static inline int devtmpfs_create_node(struct device *dev) { return 0; } | 614 | static inline int devtmpfs_create_node(struct device *dev) { return 0; } |
| 564 | static inline int devtmpfs_delete_node(struct device *dev) { return 0; } | 615 | static inline int devtmpfs_delete_node(struct device *dev) { return 0; } |
diff --git a/include/linux/dm-dirty-log.h b/include/linux/dm-dirty-log.h index 5e8b11d88f6f..7084503c3405 100644 --- a/include/linux/dm-dirty-log.h +++ b/include/linux/dm-dirty-log.h | |||
| @@ -21,6 +21,7 @@ struct dm_dirty_log_type; | |||
| 21 | 21 | ||
| 22 | struct dm_dirty_log { | 22 | struct dm_dirty_log { |
| 23 | struct dm_dirty_log_type *type; | 23 | struct dm_dirty_log_type *type; |
| 24 | int (*flush_callback_fn)(struct dm_target *ti); | ||
| 24 | void *context; | 25 | void *context; |
| 25 | }; | 26 | }; |
| 26 | 27 | ||
| @@ -136,8 +137,9 @@ int dm_dirty_log_type_unregister(struct dm_dirty_log_type *type); | |||
| 136 | * type->constructor/destructor() directly. | 137 | * type->constructor/destructor() directly. |
| 137 | */ | 138 | */ |
| 138 | struct dm_dirty_log *dm_dirty_log_create(const char *type_name, | 139 | struct dm_dirty_log *dm_dirty_log_create(const char *type_name, |
| 139 | struct dm_target *ti, | 140 | struct dm_target *ti, |
| 140 | unsigned argc, char **argv); | 141 | int (*flush_callback_fn)(struct dm_target *ti), |
| 142 | unsigned argc, char **argv); | ||
| 141 | void dm_dirty_log_destroy(struct dm_dirty_log *log); | 143 | void dm_dirty_log_destroy(struct dm_dirty_log *log); |
| 142 | 144 | ||
| 143 | #endif /* __KERNEL__ */ | 145 | #endif /* __KERNEL__ */ |
diff --git a/include/linux/dm-io.h b/include/linux/dm-io.h index b6bf17ee2f61..5c9186b93fff 100644 --- a/include/linux/dm-io.h +++ b/include/linux/dm-io.h | |||
| @@ -37,14 +37,14 @@ enum dm_io_mem_type { | |||
| 37 | struct dm_io_memory { | 37 | struct dm_io_memory { |
| 38 | enum dm_io_mem_type type; | 38 | enum dm_io_mem_type type; |
| 39 | 39 | ||
| 40 | unsigned offset; | ||
| 41 | |||
| 40 | union { | 42 | union { |
| 41 | struct page_list *pl; | 43 | struct page_list *pl; |
| 42 | struct bio_vec *bvec; | 44 | struct bio_vec *bvec; |
| 43 | void *vma; | 45 | void *vma; |
| 44 | void *addr; | 46 | void *addr; |
| 45 | } ptr; | 47 | } ptr; |
| 46 | |||
| 47 | unsigned offset; | ||
| 48 | }; | 48 | }; |
| 49 | 49 | ||
| 50 | struct dm_io_notify { | 50 | struct dm_io_notify { |
diff --git a/include/linux/dm-ioctl.h b/include/linux/dm-ioctl.h index 2ab84c83c31a..2c445e113790 100644 --- a/include/linux/dm-ioctl.h +++ b/include/linux/dm-ioctl.h | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * Copyright (C) 2001 - 2003 Sistina Software (UK) Limited. | 2 | * Copyright (C) 2001 - 2003 Sistina Software (UK) Limited. |
| 3 | * Copyright (C) 2004 - 2005 Red Hat, Inc. All rights reserved. | 3 | * Copyright (C) 2004 - 2009 Red Hat, Inc. All rights reserved. |
| 4 | * | 4 | * |
| 5 | * This file is released under the LGPL. | 5 | * This file is released under the LGPL. |
| 6 | */ | 6 | */ |
| @@ -266,9 +266,9 @@ enum { | |||
| 266 | #define DM_DEV_SET_GEOMETRY _IOWR(DM_IOCTL, DM_DEV_SET_GEOMETRY_CMD, struct dm_ioctl) | 266 | #define DM_DEV_SET_GEOMETRY _IOWR(DM_IOCTL, DM_DEV_SET_GEOMETRY_CMD, struct dm_ioctl) |
| 267 | 267 | ||
| 268 | #define DM_VERSION_MAJOR 4 | 268 | #define DM_VERSION_MAJOR 4 |
| 269 | #define DM_VERSION_MINOR 15 | 269 | #define DM_VERSION_MINOR 17 |
| 270 | #define DM_VERSION_PATCHLEVEL 0 | 270 | #define DM_VERSION_PATCHLEVEL 0 |
| 271 | #define DM_VERSION_EXTRA "-ioctl (2009-04-01)" | 271 | #define DM_VERSION_EXTRA "-ioctl (2010-03-05)" |
| 272 | 272 | ||
| 273 | /* Status bits */ | 273 | /* Status bits */ |
| 274 | #define DM_READONLY_FLAG (1 << 0) /* In/Out */ | 274 | #define DM_READONLY_FLAG (1 << 0) /* In/Out */ |
| @@ -309,4 +309,16 @@ enum { | |||
| 309 | */ | 309 | */ |
| 310 | #define DM_NOFLUSH_FLAG (1 << 11) /* In */ | 310 | #define DM_NOFLUSH_FLAG (1 << 11) /* In */ |
| 311 | 311 | ||
| 312 | /* | ||
| 313 | * If set, any table information returned will relate to the inactive | ||
| 314 | * table instead of the live one. Always check DM_INACTIVE_PRESENT_FLAG | ||
| 315 | * is set before using the data returned. | ||
| 316 | */ | ||
| 317 | #define DM_QUERY_INACTIVE_TABLE_FLAG (1 << 12) /* In */ | ||
| 318 | |||
| 319 | /* | ||
| 320 | * If set, a uevent was generated for which the caller may need to wait. | ||
| 321 | */ | ||
| 322 | #define DM_UEVENT_GENERATED_FLAG (1 << 13) /* Out */ | ||
| 323 | |||
| 312 | #endif /* _LINUX_DM_IOCTL_H */ | 324 | #endif /* _LINUX_DM_IOCTL_H */ |
diff --git a/include/linux/dm-log-userspace.h b/include/linux/dm-log-userspace.h index 8a1f972c0fe9..0c3c3a2110c4 100644 --- a/include/linux/dm-log-userspace.h +++ b/include/linux/dm-log-userspace.h | |||
| @@ -363,7 +363,7 @@ | |||
| 363 | * various request types above. The remaining 24-bits are currently | 363 | * various request types above. The remaining 24-bits are currently |
| 364 | * set to zero and are reserved for future use and compatibility concerns. | 364 | * set to zero and are reserved for future use and compatibility concerns. |
| 365 | * | 365 | * |
| 366 | * User-space should always use DM_ULOG_REQUEST_TYPE to aquire the | 366 | * User-space should always use DM_ULOG_REQUEST_TYPE to acquire the |
| 367 | * request type from the 'request_type' field to maintain forward compatibility. | 367 | * request type from the 'request_type' field to maintain forward compatibility. |
| 368 | */ | 368 | */ |
| 369 | #define DM_ULOG_REQUEST_MASK 0xFF | 369 | #define DM_ULOG_REQUEST_MASK 0xFF |
diff --git a/include/linux/dm-region-hash.h b/include/linux/dm-region-hash.h index a9e652a41373..9e2a7a401df5 100644 --- a/include/linux/dm-region-hash.h +++ b/include/linux/dm-region-hash.h | |||
| @@ -78,8 +78,7 @@ void dm_rh_dec(struct dm_region_hash *rh, region_t region); | |||
| 78 | /* Delay bios on regions. */ | 78 | /* Delay bios on regions. */ |
| 79 | void dm_rh_delay(struct dm_region_hash *rh, struct bio *bio); | 79 | void dm_rh_delay(struct dm_region_hash *rh, struct bio *bio); |
| 80 | 80 | ||
| 81 | void dm_rh_mark_nosync(struct dm_region_hash *rh, | 81 | void dm_rh_mark_nosync(struct dm_region_hash *rh, struct bio *bio); |
| 82 | struct bio *bio, unsigned done, int error); | ||
| 83 | 82 | ||
| 84 | /* | 83 | /* |
| 85 | * Region recovery control. | 84 | * Region recovery control. |
diff --git a/include/linux/dm9000.h b/include/linux/dm9000.h index c30879cf93bc..96e87693d933 100644 --- a/include/linux/dm9000.h +++ b/include/linux/dm9000.h | |||
| @@ -23,7 +23,7 @@ | |||
| 23 | #define DM9000_PLATF_NO_EEPROM (0x0010) | 23 | #define DM9000_PLATF_NO_EEPROM (0x0010) |
| 24 | #define DM9000_PLATF_SIMPLE_PHY (0x0020) /* Use NSR to find LinkStatus */ | 24 | #define DM9000_PLATF_SIMPLE_PHY (0x0020) /* Use NSR to find LinkStatus */ |
| 25 | 25 | ||
| 26 | /* platfrom data for platfrom device structure's platfrom_data field */ | 26 | /* platform data for platform device structure's platform_data field */ |
| 27 | 27 | ||
| 28 | struct dm9000_plat_data { | 28 | struct dm9000_plat_data { |
| 29 | unsigned int flags; | 29 | unsigned int flags; |
diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h index 91b761846061..ca32ed78b057 100644 --- a/include/linux/dma-mapping.h +++ b/include/linux/dma-mapping.h | |||
| @@ -127,6 +127,14 @@ static inline u64 dma_get_mask(struct device *dev) | |||
| 127 | return DMA_BIT_MASK(32); | 127 | return DMA_BIT_MASK(32); |
| 128 | } | 128 | } |
| 129 | 129 | ||
| 130 | static inline int dma_set_coherent_mask(struct device *dev, u64 mask) | ||
| 131 | { | ||
| 132 | if (!dma_supported(dev, mask)) | ||
| 133 | return -EIO; | ||
| 134 | dev->coherent_dma_mask = mask; | ||
| 135 | return 0; | ||
| 136 | } | ||
| 137 | |||
| 130 | extern u64 dma_get_required_mask(struct device *dev); | 138 | extern u64 dma_get_required_mask(struct device *dev); |
| 131 | 139 | ||
| 132 | static inline unsigned int dma_get_max_seg_size(struct device *dev) | 140 | static inline unsigned int dma_get_max_seg_size(struct device *dev) |
| @@ -232,4 +240,20 @@ struct dma_attrs; | |||
| 232 | 240 | ||
| 233 | #endif /* CONFIG_HAVE_DMA_ATTRS */ | 241 | #endif /* CONFIG_HAVE_DMA_ATTRS */ |
| 234 | 242 | ||
| 243 | #ifdef CONFIG_NEED_DMA_MAP_STATE | ||
| 244 | #define DEFINE_DMA_UNMAP_ADDR(ADDR_NAME) dma_addr_t ADDR_NAME | ||
| 245 | #define DEFINE_DMA_UNMAP_LEN(LEN_NAME) __u32 LEN_NAME | ||
| 246 | #define dma_unmap_addr(PTR, ADDR_NAME) ((PTR)->ADDR_NAME) | ||
| 247 | #define dma_unmap_addr_set(PTR, ADDR_NAME, VAL) (((PTR)->ADDR_NAME) = (VAL)) | ||
| 248 | #define dma_unmap_len(PTR, LEN_NAME) ((PTR)->LEN_NAME) | ||
| 249 | #define dma_unmap_len_set(PTR, LEN_NAME, VAL) (((PTR)->LEN_NAME) = (VAL)) | ||
| 250 | #else | ||
| 251 | #define DEFINE_DMA_UNMAP_ADDR(ADDR_NAME) | ||
| 252 | #define DEFINE_DMA_UNMAP_LEN(LEN_NAME) | ||
| 253 | #define dma_unmap_addr(PTR, ADDR_NAME) (0) | ||
| 254 | #define dma_unmap_addr_set(PTR, ADDR_NAME, VAL) do { } while (0) | ||
| 255 | #define dma_unmap_len(PTR, LEN_NAME) (0) | ||
| 256 | #define dma_unmap_len_set(PTR, LEN_NAME, VAL) do { } while (0) | ||
| 257 | #endif | ||
| 258 | |||
| 235 | #endif | 259 | #endif |
diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h index 2b9f2ac7ed60..20ea12c86fd0 100644 --- a/include/linux/dmaengine.h +++ b/include/linux/dmaengine.h | |||
| @@ -31,6 +31,8 @@ | |||
| 31 | * if dma_cookie_t is >0 it's a DMA request cookie, <0 it's an error code | 31 | * if dma_cookie_t is >0 it's a DMA request cookie, <0 it's an error code |
| 32 | */ | 32 | */ |
| 33 | typedef s32 dma_cookie_t; | 33 | typedef s32 dma_cookie_t; |
| 34 | #define DMA_MIN_COOKIE 1 | ||
| 35 | #define DMA_MAX_COOKIE INT_MAX | ||
| 34 | 36 | ||
| 35 | #define dma_submit_error(cookie) ((cookie) < 0 ? 1 : 0) | 37 | #define dma_submit_error(cookie) ((cookie) < 0 ? 1 : 0) |
| 36 | 38 | ||
| @@ -74,7 +76,7 @@ enum dma_transaction_type { | |||
| 74 | * control completion, and communicate status. | 76 | * control completion, and communicate status. |
| 75 | * @DMA_PREP_INTERRUPT - trigger an interrupt (callback) upon completion of | 77 | * @DMA_PREP_INTERRUPT - trigger an interrupt (callback) upon completion of |
| 76 | * this transaction | 78 | * this transaction |
| 77 | * @DMA_CTRL_ACK - the descriptor cannot be reused until the client | 79 | * @DMA_CTRL_ACK - if clear, the descriptor cannot be reused until the client |
| 78 | * acknowledges receipt, i.e. has has a chance to establish any dependency | 80 | * acknowledges receipt, i.e. has has a chance to establish any dependency |
| 79 | * chains | 81 | * chains |
| 80 | * @DMA_COMPL_SKIP_SRC_UNMAP - set to disable dma-unmapping the source buffer(s) | 82 | * @DMA_COMPL_SKIP_SRC_UNMAP - set to disable dma-unmapping the source buffer(s) |
| @@ -162,7 +164,7 @@ struct dma_chan { | |||
| 162 | struct dma_chan_dev *dev; | 164 | struct dma_chan_dev *dev; |
| 163 | 165 | ||
| 164 | struct list_head device_node; | 166 | struct list_head device_node; |
| 165 | struct dma_chan_percpu *local; | 167 | struct dma_chan_percpu __percpu *local; |
| 166 | int client_count; | 168 | int client_count; |
| 167 | int table_count; | 169 | int table_count; |
| 168 | void *private; | 170 | void *private; |
diff --git a/include/linux/dmar.h b/include/linux/dmar.h index 4a2b162c256a..d7cecc90ed34 100644 --- a/include/linux/dmar.h +++ b/include/linux/dmar.h | |||
| @@ -126,7 +126,9 @@ extern int free_irte(int irq); | |||
| 126 | extern int irq_remapped(int irq); | 126 | extern int irq_remapped(int irq); |
| 127 | extern struct intel_iommu *map_dev_to_ir(struct pci_dev *dev); | 127 | extern struct intel_iommu *map_dev_to_ir(struct pci_dev *dev); |
| 128 | extern struct intel_iommu *map_ioapic_to_ir(int apic); | 128 | extern struct intel_iommu *map_ioapic_to_ir(int apic); |
| 129 | extern struct intel_iommu *map_hpet_to_ir(u8 id); | ||
| 129 | extern int set_ioapic_sid(struct irte *irte, int apic); | 130 | extern int set_ioapic_sid(struct irte *irte, int apic); |
| 131 | extern int set_hpet_sid(struct irte *irte, u8 id); | ||
| 130 | extern int set_msi_sid(struct irte *irte, struct pci_dev *dev); | 132 | extern int set_msi_sid(struct irte *irte, struct pci_dev *dev); |
| 131 | #else | 133 | #else |
| 132 | static inline int alloc_irte(struct intel_iommu *iommu, int irq, u16 count) | 134 | static inline int alloc_irte(struct intel_iommu *iommu, int irq, u16 count) |
| @@ -158,10 +160,18 @@ static inline struct intel_iommu *map_ioapic_to_ir(int apic) | |||
| 158 | { | 160 | { |
| 159 | return NULL; | 161 | return NULL; |
| 160 | } | 162 | } |
| 163 | static inline struct intel_iommu *map_hpet_to_ir(unsigned int hpet_id) | ||
| 164 | { | ||
| 165 | return NULL; | ||
| 166 | } | ||
| 161 | static inline int set_ioapic_sid(struct irte *irte, int apic) | 167 | static inline int set_ioapic_sid(struct irte *irte, int apic) |
| 162 | { | 168 | { |
| 163 | return 0; | 169 | return 0; |
| 164 | } | 170 | } |
| 171 | static inline int set_hpet_sid(struct irte *irte, u8 id) | ||
| 172 | { | ||
| 173 | return -1; | ||
| 174 | } | ||
| 165 | static inline int set_msi_sid(struct irte *irte, struct pci_dev *dev) | 175 | static inline int set_msi_sid(struct irte *irte, struct pci_dev *dev) |
| 166 | { | 176 | { |
| 167 | return 0; | 177 | return 0; |
| @@ -208,16 +218,9 @@ struct dmar_atsr_unit { | |||
| 208 | u8 include_all:1; /* include all ports */ | 218 | u8 include_all:1; /* include all ports */ |
| 209 | }; | 219 | }; |
| 210 | 220 | ||
| 211 | /* Intel DMAR initialization functions */ | ||
| 212 | extern int intel_iommu_init(void); | 221 | extern int intel_iommu_init(void); |
| 213 | #else | 222 | #else /* !CONFIG_DMAR: */ |
| 214 | static inline int intel_iommu_init(void) | 223 | static inline int intel_iommu_init(void) { return -ENODEV; } |
| 215 | { | 224 | #endif /* CONFIG_DMAR */ |
| 216 | #ifdef CONFIG_INTR_REMAP | 225 | |
| 217 | return dmar_dev_scope_init(); | ||
| 218 | #else | ||
| 219 | return -ENODEV; | ||
| 220 | #endif | ||
| 221 | } | ||
| 222 | #endif /* !CONFIG_DMAR */ | ||
| 223 | #endif /* __DMAR_H__ */ | 226 | #endif /* __DMAR_H__ */ |
diff --git a/include/linux/dn.h b/include/linux/dn.h index fe9990823193..9c50445462d9 100644 --- a/include/linux/dn.h +++ b/include/linux/dn.h | |||
| @@ -71,14 +71,12 @@ | |||
| 71 | /* Structures */ | 71 | /* Structures */ |
| 72 | 72 | ||
| 73 | 73 | ||
| 74 | struct dn_naddr | 74 | struct dn_naddr { |
| 75 | { | ||
| 76 | __le16 a_len; | 75 | __le16 a_len; |
| 77 | __u8 a_addr[DN_MAXADDL]; /* Two bytes little endian */ | 76 | __u8 a_addr[DN_MAXADDL]; /* Two bytes little endian */ |
| 78 | }; | 77 | }; |
| 79 | 78 | ||
| 80 | struct sockaddr_dn | 79 | struct sockaddr_dn { |
| 81 | { | ||
| 82 | __u16 sdn_family; | 80 | __u16 sdn_family; |
| 83 | __u8 sdn_flags; | 81 | __u8 sdn_flags; |
| 84 | __u8 sdn_objnum; | 82 | __u8 sdn_objnum; |
| @@ -101,8 +99,7 @@ struct optdata_dn { | |||
| 101 | __u8 opt_data[16]; /* User data */ | 99 | __u8 opt_data[16]; /* User data */ |
| 102 | }; | 100 | }; |
| 103 | 101 | ||
| 104 | struct accessdata_dn | 102 | struct accessdata_dn { |
| 105 | { | ||
| 106 | __u8 acc_accl; | 103 | __u8 acc_accl; |
| 107 | __u8 acc_acc[DN_MAXACCL]; | 104 | __u8 acc_acc[DN_MAXACCL]; |
| 108 | __u8 acc_passl; | 105 | __u8 acc_passl; |
diff --git a/include/linux/drbd.h b/include/linux/drbd.h new file mode 100644 index 000000000000..4341b1a97a34 --- /dev/null +++ b/include/linux/drbd.h | |||
| @@ -0,0 +1,343 @@ | |||
| 1 | /* | ||
| 2 | drbd.h | ||
| 3 | Kernel module for 2.6.x Kernels | ||
| 4 | |||
| 5 | This file is part of DRBD by Philipp Reisner and Lars Ellenberg. | ||
| 6 | |||
| 7 | Copyright (C) 2001-2008, LINBIT Information Technologies GmbH. | ||
| 8 | Copyright (C) 2001-2008, Philipp Reisner <philipp.reisner@linbit.com>. | ||
| 9 | Copyright (C) 2001-2008, Lars Ellenberg <lars.ellenberg@linbit.com>. | ||
| 10 | |||
| 11 | drbd is free software; you can redistribute it and/or modify | ||
| 12 | it under the terms of the GNU General Public License as published by | ||
| 13 | the Free Software Foundation; either version 2, or (at your option) | ||
| 14 | any later version. | ||
| 15 | |||
| 16 | drbd is distributed in the hope that it will be useful, | ||
| 17 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 18 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 19 | GNU General Public License for more details. | ||
| 20 | |||
| 21 | You should have received a copy of the GNU General Public License | ||
| 22 | along with drbd; see the file COPYING. If not, write to | ||
| 23 | the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. | ||
| 24 | |||
| 25 | */ | ||
| 26 | #ifndef DRBD_H | ||
| 27 | #define DRBD_H | ||
| 28 | #include <linux/connector.h> | ||
| 29 | #include <asm/types.h> | ||
| 30 | |||
| 31 | #ifdef __KERNEL__ | ||
| 32 | #include <linux/types.h> | ||
| 33 | #include <asm/byteorder.h> | ||
| 34 | #else | ||
| 35 | #include <sys/types.h> | ||
| 36 | #include <sys/wait.h> | ||
| 37 | #include <limits.h> | ||
| 38 | |||
| 39 | /* Altough the Linux source code makes a difference between | ||
| 40 | generic endianness and the bitfields' endianness, there is no | ||
| 41 | architecture as of Linux-2.6.24-rc4 where the bitfileds' endianness | ||
| 42 | does not match the generic endianness. */ | ||
| 43 | |||
| 44 | #if __BYTE_ORDER == __LITTLE_ENDIAN | ||
| 45 | #define __LITTLE_ENDIAN_BITFIELD | ||
| 46 | #elif __BYTE_ORDER == __BIG_ENDIAN | ||
| 47 | #define __BIG_ENDIAN_BITFIELD | ||
| 48 | #else | ||
| 49 | # error "sorry, weird endianness on this box" | ||
| 50 | #endif | ||
| 51 | |||
| 52 | #endif | ||
| 53 | |||
| 54 | |||
| 55 | extern const char *drbd_buildtag(void); | ||
| 56 | #define REL_VERSION "8.3.7" | ||
| 57 | #define API_VERSION 88 | ||
| 58 | #define PRO_VERSION_MIN 86 | ||
| 59 | #define PRO_VERSION_MAX 92 | ||
| 60 | |||
| 61 | |||
| 62 | enum drbd_io_error_p { | ||
| 63 | EP_PASS_ON, /* FIXME should the better be named "Ignore"? */ | ||
| 64 | EP_CALL_HELPER, | ||
| 65 | EP_DETACH | ||
| 66 | }; | ||
| 67 | |||
| 68 | enum drbd_fencing_p { | ||
| 69 | FP_DONT_CARE, | ||
| 70 | FP_RESOURCE, | ||
| 71 | FP_STONITH | ||
| 72 | }; | ||
| 73 | |||
| 74 | enum drbd_disconnect_p { | ||
| 75 | DP_RECONNECT, | ||
| 76 | DP_DROP_NET_CONF, | ||
| 77 | DP_FREEZE_IO | ||
| 78 | }; | ||
| 79 | |||
| 80 | enum drbd_after_sb_p { | ||
| 81 | ASB_DISCONNECT, | ||
| 82 | ASB_DISCARD_YOUNGER_PRI, | ||
| 83 | ASB_DISCARD_OLDER_PRI, | ||
| 84 | ASB_DISCARD_ZERO_CHG, | ||
| 85 | ASB_DISCARD_LEAST_CHG, | ||
| 86 | ASB_DISCARD_LOCAL, | ||
| 87 | ASB_DISCARD_REMOTE, | ||
| 88 | ASB_CONSENSUS, | ||
| 89 | ASB_DISCARD_SECONDARY, | ||
| 90 | ASB_CALL_HELPER, | ||
| 91 | ASB_VIOLENTLY | ||
| 92 | }; | ||
| 93 | |||
| 94 | /* KEEP the order, do not delete or insert. Only append. */ | ||
| 95 | enum drbd_ret_codes { | ||
| 96 | ERR_CODE_BASE = 100, | ||
| 97 | NO_ERROR = 101, | ||
| 98 | ERR_LOCAL_ADDR = 102, | ||
| 99 | ERR_PEER_ADDR = 103, | ||
| 100 | ERR_OPEN_DISK = 104, | ||
| 101 | ERR_OPEN_MD_DISK = 105, | ||
| 102 | ERR_DISK_NOT_BDEV = 107, | ||
| 103 | ERR_MD_NOT_BDEV = 108, | ||
| 104 | ERR_DISK_TO_SMALL = 111, | ||
| 105 | ERR_MD_DISK_TO_SMALL = 112, | ||
| 106 | ERR_BDCLAIM_DISK = 114, | ||
| 107 | ERR_BDCLAIM_MD_DISK = 115, | ||
| 108 | ERR_MD_IDX_INVALID = 116, | ||
| 109 | ERR_IO_MD_DISK = 118, | ||
| 110 | ERR_MD_INVALID = 119, | ||
| 111 | ERR_AUTH_ALG = 120, | ||
| 112 | ERR_AUTH_ALG_ND = 121, | ||
| 113 | ERR_NOMEM = 122, | ||
| 114 | ERR_DISCARD = 123, | ||
| 115 | ERR_DISK_CONFIGURED = 124, | ||
| 116 | ERR_NET_CONFIGURED = 125, | ||
| 117 | ERR_MANDATORY_TAG = 126, | ||
| 118 | ERR_MINOR_INVALID = 127, | ||
| 119 | ERR_INTR = 129, /* EINTR */ | ||
| 120 | ERR_RESIZE_RESYNC = 130, | ||
| 121 | ERR_NO_PRIMARY = 131, | ||
| 122 | ERR_SYNC_AFTER = 132, | ||
| 123 | ERR_SYNC_AFTER_CYCLE = 133, | ||
| 124 | ERR_PAUSE_IS_SET = 134, | ||
| 125 | ERR_PAUSE_IS_CLEAR = 135, | ||
| 126 | ERR_PACKET_NR = 137, | ||
| 127 | ERR_NO_DISK = 138, | ||
| 128 | ERR_NOT_PROTO_C = 139, | ||
| 129 | ERR_NOMEM_BITMAP = 140, | ||
| 130 | ERR_INTEGRITY_ALG = 141, /* DRBD 8.2 only */ | ||
| 131 | ERR_INTEGRITY_ALG_ND = 142, /* DRBD 8.2 only */ | ||
| 132 | ERR_CPU_MASK_PARSE = 143, /* DRBD 8.2 only */ | ||
| 133 | ERR_CSUMS_ALG = 144, /* DRBD 8.2 only */ | ||
| 134 | ERR_CSUMS_ALG_ND = 145, /* DRBD 8.2 only */ | ||
| 135 | ERR_VERIFY_ALG = 146, /* DRBD 8.2 only */ | ||
| 136 | ERR_VERIFY_ALG_ND = 147, /* DRBD 8.2 only */ | ||
| 137 | ERR_CSUMS_RESYNC_RUNNING= 148, /* DRBD 8.2 only */ | ||
| 138 | ERR_VERIFY_RUNNING = 149, /* DRBD 8.2 only */ | ||
| 139 | ERR_DATA_NOT_CURRENT = 150, | ||
| 140 | ERR_CONNECTED = 151, /* DRBD 8.3 only */ | ||
| 141 | ERR_PERM = 152, | ||
| 142 | |||
| 143 | /* insert new ones above this line */ | ||
| 144 | AFTER_LAST_ERR_CODE | ||
| 145 | }; | ||
| 146 | |||
| 147 | #define DRBD_PROT_A 1 | ||
| 148 | #define DRBD_PROT_B 2 | ||
| 149 | #define DRBD_PROT_C 3 | ||
| 150 | |||
| 151 | enum drbd_role { | ||
| 152 | R_UNKNOWN = 0, | ||
| 153 | R_PRIMARY = 1, /* role */ | ||
| 154 | R_SECONDARY = 2, /* role */ | ||
| 155 | R_MASK = 3, | ||
| 156 | }; | ||
| 157 | |||
| 158 | /* The order of these constants is important. | ||
| 159 | * The lower ones (<C_WF_REPORT_PARAMS) indicate | ||
| 160 | * that there is no socket! | ||
| 161 | * >=C_WF_REPORT_PARAMS ==> There is a socket | ||
| 162 | */ | ||
| 163 | enum drbd_conns { | ||
| 164 | C_STANDALONE, | ||
| 165 | C_DISCONNECTING, /* Temporal state on the way to StandAlone. */ | ||
| 166 | C_UNCONNECTED, /* >= C_UNCONNECTED -> inc_net() succeeds */ | ||
| 167 | |||
| 168 | /* These temporal states are all used on the way | ||
| 169 | * from >= C_CONNECTED to Unconnected. | ||
| 170 | * The 'disconnect reason' states | ||
| 171 | * I do not allow to change beween them. */ | ||
| 172 | C_TIMEOUT, | ||
| 173 | C_BROKEN_PIPE, | ||
| 174 | C_NETWORK_FAILURE, | ||
| 175 | C_PROTOCOL_ERROR, | ||
| 176 | C_TEAR_DOWN, | ||
| 177 | |||
| 178 | C_WF_CONNECTION, | ||
| 179 | C_WF_REPORT_PARAMS, /* we have a socket */ | ||
| 180 | C_CONNECTED, /* we have introduced each other */ | ||
| 181 | C_STARTING_SYNC_S, /* starting full sync by admin request. */ | ||
| 182 | C_STARTING_SYNC_T, /* stariing full sync by admin request. */ | ||
| 183 | C_WF_BITMAP_S, | ||
| 184 | C_WF_BITMAP_T, | ||
| 185 | C_WF_SYNC_UUID, | ||
| 186 | |||
| 187 | /* All SyncStates are tested with this comparison | ||
| 188 | * xx >= C_SYNC_SOURCE && xx <= C_PAUSED_SYNC_T */ | ||
| 189 | C_SYNC_SOURCE, | ||
| 190 | C_SYNC_TARGET, | ||
| 191 | C_VERIFY_S, | ||
| 192 | C_VERIFY_T, | ||
| 193 | C_PAUSED_SYNC_S, | ||
| 194 | C_PAUSED_SYNC_T, | ||
| 195 | C_MASK = 31 | ||
| 196 | }; | ||
| 197 | |||
| 198 | enum drbd_disk_state { | ||
| 199 | D_DISKLESS, | ||
| 200 | D_ATTACHING, /* In the process of reading the meta-data */ | ||
| 201 | D_FAILED, /* Becomes D_DISKLESS as soon as we told it the peer */ | ||
| 202 | /* when >= D_FAILED it is legal to access mdev->bc */ | ||
| 203 | D_NEGOTIATING, /* Late attaching state, we need to talk to the peer */ | ||
| 204 | D_INCONSISTENT, | ||
| 205 | D_OUTDATED, | ||
| 206 | D_UNKNOWN, /* Only used for the peer, never for myself */ | ||
| 207 | D_CONSISTENT, /* Might be D_OUTDATED, might be D_UP_TO_DATE ... */ | ||
| 208 | D_UP_TO_DATE, /* Only this disk state allows applications' IO ! */ | ||
| 209 | D_MASK = 15 | ||
| 210 | }; | ||
| 211 | |||
| 212 | union drbd_state { | ||
| 213 | /* According to gcc's docs is the ... | ||
| 214 | * The order of allocation of bit-fields within a unit (C90 6.5.2.1, C99 6.7.2.1). | ||
| 215 | * Determined by ABI. | ||
| 216 | * pointed out by Maxim Uvarov q<muvarov@ru.mvista.com> | ||
| 217 | * even though we transmit as "cpu_to_be32(state)", | ||
| 218 | * the offsets of the bitfields still need to be swapped | ||
| 219 | * on different endianess. | ||
| 220 | */ | ||
| 221 | struct { | ||
| 222 | #if defined(__LITTLE_ENDIAN_BITFIELD) | ||
| 223 | unsigned role:2 ; /* 3/4 primary/secondary/unknown */ | ||
| 224 | unsigned peer:2 ; /* 3/4 primary/secondary/unknown */ | ||
| 225 | unsigned conn:5 ; /* 17/32 cstates */ | ||
| 226 | unsigned disk:4 ; /* 8/16 from D_DISKLESS to D_UP_TO_DATE */ | ||
| 227 | unsigned pdsk:4 ; /* 8/16 from D_DISKLESS to D_UP_TO_DATE */ | ||
| 228 | unsigned susp:1 ; /* 2/2 IO suspended no/yes */ | ||
| 229 | unsigned aftr_isp:1 ; /* isp .. imposed sync pause */ | ||
| 230 | unsigned peer_isp:1 ; | ||
| 231 | unsigned user_isp:1 ; | ||
| 232 | unsigned _pad:11; /* 0 unused */ | ||
| 233 | #elif defined(__BIG_ENDIAN_BITFIELD) | ||
| 234 | unsigned _pad:11; /* 0 unused */ | ||
| 235 | unsigned user_isp:1 ; | ||
| 236 | unsigned peer_isp:1 ; | ||
| 237 | unsigned aftr_isp:1 ; /* isp .. imposed sync pause */ | ||
| 238 | unsigned susp:1 ; /* 2/2 IO suspended no/yes */ | ||
| 239 | unsigned pdsk:4 ; /* 8/16 from D_DISKLESS to D_UP_TO_DATE */ | ||
| 240 | unsigned disk:4 ; /* 8/16 from D_DISKLESS to D_UP_TO_DATE */ | ||
| 241 | unsigned conn:5 ; /* 17/32 cstates */ | ||
| 242 | unsigned peer:2 ; /* 3/4 primary/secondary/unknown */ | ||
| 243 | unsigned role:2 ; /* 3/4 primary/secondary/unknown */ | ||
| 244 | #else | ||
| 245 | # error "this endianess is not supported" | ||
| 246 | #endif | ||
| 247 | }; | ||
| 248 | unsigned int i; | ||
| 249 | }; | ||
| 250 | |||
| 251 | enum drbd_state_ret_codes { | ||
| 252 | SS_CW_NO_NEED = 4, | ||
| 253 | SS_CW_SUCCESS = 3, | ||
| 254 | SS_NOTHING_TO_DO = 2, | ||
| 255 | SS_SUCCESS = 1, | ||
| 256 | SS_UNKNOWN_ERROR = 0, /* Used to sleep longer in _drbd_request_state */ | ||
| 257 | SS_TWO_PRIMARIES = -1, | ||
| 258 | SS_NO_UP_TO_DATE_DISK = -2, | ||
| 259 | SS_NO_LOCAL_DISK = -4, | ||
| 260 | SS_NO_REMOTE_DISK = -5, | ||
| 261 | SS_CONNECTED_OUTDATES = -6, | ||
| 262 | SS_PRIMARY_NOP = -7, | ||
| 263 | SS_RESYNC_RUNNING = -8, | ||
| 264 | SS_ALREADY_STANDALONE = -9, | ||
| 265 | SS_CW_FAILED_BY_PEER = -10, | ||
| 266 | SS_IS_DISKLESS = -11, | ||
| 267 | SS_DEVICE_IN_USE = -12, | ||
| 268 | SS_NO_NET_CONFIG = -13, | ||
| 269 | SS_NO_VERIFY_ALG = -14, /* drbd-8.2 only */ | ||
| 270 | SS_NEED_CONNECTION = -15, /* drbd-8.2 only */ | ||
| 271 | SS_LOWER_THAN_OUTDATED = -16, | ||
| 272 | SS_NOT_SUPPORTED = -17, /* drbd-8.2 only */ | ||
| 273 | SS_IN_TRANSIENT_STATE = -18, /* Retry after the next state change */ | ||
| 274 | SS_CONCURRENT_ST_CHG = -19, /* Concurrent cluster side state change! */ | ||
| 275 | SS_AFTER_LAST_ERROR = -20, /* Keep this at bottom */ | ||
| 276 | }; | ||
| 277 | |||
| 278 | /* from drbd_strings.c */ | ||
| 279 | extern const char *drbd_conn_str(enum drbd_conns); | ||
| 280 | extern const char *drbd_role_str(enum drbd_role); | ||
| 281 | extern const char *drbd_disk_str(enum drbd_disk_state); | ||
| 282 | extern const char *drbd_set_st_err_str(enum drbd_state_ret_codes); | ||
| 283 | |||
| 284 | #define SHARED_SECRET_MAX 64 | ||
| 285 | |||
| 286 | #define MDF_CONSISTENT (1 << 0) | ||
| 287 | #define MDF_PRIMARY_IND (1 << 1) | ||
| 288 | #define MDF_CONNECTED_IND (1 << 2) | ||
| 289 | #define MDF_FULL_SYNC (1 << 3) | ||
| 290 | #define MDF_WAS_UP_TO_DATE (1 << 4) | ||
| 291 | #define MDF_PEER_OUT_DATED (1 << 5) | ||
| 292 | #define MDF_CRASHED_PRIMARY (1 << 6) | ||
| 293 | |||
| 294 | enum drbd_uuid_index { | ||
| 295 | UI_CURRENT, | ||
| 296 | UI_BITMAP, | ||
| 297 | UI_HISTORY_START, | ||
| 298 | UI_HISTORY_END, | ||
| 299 | UI_SIZE, /* nl-packet: number of dirty bits */ | ||
| 300 | UI_FLAGS, /* nl-packet: flags */ | ||
| 301 | UI_EXTENDED_SIZE /* Everything. */ | ||
| 302 | }; | ||
| 303 | |||
| 304 | enum drbd_timeout_flag { | ||
| 305 | UT_DEFAULT = 0, | ||
| 306 | UT_DEGRADED = 1, | ||
| 307 | UT_PEER_OUTDATED = 2, | ||
| 308 | }; | ||
| 309 | |||
| 310 | #define UUID_JUST_CREATED ((__u64)4) | ||
| 311 | |||
| 312 | #define DRBD_MAGIC 0x83740267 | ||
| 313 | #define BE_DRBD_MAGIC __constant_cpu_to_be32(DRBD_MAGIC) | ||
| 314 | |||
| 315 | /* these are of type "int" */ | ||
| 316 | #define DRBD_MD_INDEX_INTERNAL -1 | ||
| 317 | #define DRBD_MD_INDEX_FLEX_EXT -2 | ||
| 318 | #define DRBD_MD_INDEX_FLEX_INT -3 | ||
| 319 | |||
| 320 | /* Start of the new netlink/connector stuff */ | ||
| 321 | |||
| 322 | #define DRBD_NL_CREATE_DEVICE 0x01 | ||
| 323 | #define DRBD_NL_SET_DEFAULTS 0x02 | ||
| 324 | |||
| 325 | |||
| 326 | /* For searching a vacant cn_idx value */ | ||
| 327 | #define CN_IDX_STEP 6977 | ||
| 328 | |||
| 329 | struct drbd_nl_cfg_req { | ||
| 330 | int packet_type; | ||
| 331 | unsigned int drbd_minor; | ||
| 332 | int flags; | ||
| 333 | unsigned short tag_list[]; | ||
| 334 | }; | ||
| 335 | |||
| 336 | struct drbd_nl_cfg_reply { | ||
| 337 | int packet_type; | ||
| 338 | unsigned int minor; | ||
| 339 | int ret_code; /* enum ret_code or set_st_err_t */ | ||
| 340 | unsigned short tag_list[]; /* only used with get_* calls */ | ||
| 341 | }; | ||
| 342 | |||
| 343 | #endif | ||
diff --git a/include/linux/drbd_limits.h b/include/linux/drbd_limits.h new file mode 100644 index 000000000000..51f47a586ad8 --- /dev/null +++ b/include/linux/drbd_limits.h | |||
| @@ -0,0 +1,137 @@ | |||
| 1 | /* | ||
| 2 | drbd_limits.h | ||
| 3 | This file is part of DRBD by Philipp Reisner and Lars Ellenberg. | ||
| 4 | */ | ||
| 5 | |||
| 6 | /* | ||
| 7 | * Our current limitations. | ||
| 8 | * Some of them are hard limits, | ||
| 9 | * some of them are arbitrary range limits, that make it easier to provide | ||
| 10 | * feedback about nonsense settings for certain configurable values. | ||
| 11 | */ | ||
| 12 | |||
| 13 | #ifndef DRBD_LIMITS_H | ||
| 14 | #define DRBD_LIMITS_H 1 | ||
| 15 | |||
| 16 | #define DEBUG_RANGE_CHECK 0 | ||
| 17 | |||
| 18 | #define DRBD_MINOR_COUNT_MIN 1 | ||
| 19 | #define DRBD_MINOR_COUNT_MAX 255 | ||
| 20 | |||
| 21 | #define DRBD_DIALOG_REFRESH_MIN 0 | ||
| 22 | #define DRBD_DIALOG_REFRESH_MAX 600 | ||
| 23 | |||
| 24 | /* valid port number */ | ||
| 25 | #define DRBD_PORT_MIN 1 | ||
| 26 | #define DRBD_PORT_MAX 0xffff | ||
| 27 | |||
| 28 | /* startup { */ | ||
| 29 | /* if you want more than 3.4 days, disable */ | ||
| 30 | #define DRBD_WFC_TIMEOUT_MIN 0 | ||
| 31 | #define DRBD_WFC_TIMEOUT_MAX 300000 | ||
| 32 | #define DRBD_WFC_TIMEOUT_DEF 0 | ||
| 33 | |||
| 34 | #define DRBD_DEGR_WFC_TIMEOUT_MIN 0 | ||
| 35 | #define DRBD_DEGR_WFC_TIMEOUT_MAX 300000 | ||
| 36 | #define DRBD_DEGR_WFC_TIMEOUT_DEF 0 | ||
| 37 | |||
| 38 | #define DRBD_OUTDATED_WFC_TIMEOUT_MIN 0 | ||
| 39 | #define DRBD_OUTDATED_WFC_TIMEOUT_MAX 300000 | ||
| 40 | #define DRBD_OUTDATED_WFC_TIMEOUT_DEF 0 | ||
| 41 | /* }*/ | ||
| 42 | |||
| 43 | /* net { */ | ||
| 44 | /* timeout, unit centi seconds | ||
| 45 | * more than one minute timeout is not usefull */ | ||
| 46 | #define DRBD_TIMEOUT_MIN 1 | ||
| 47 | #define DRBD_TIMEOUT_MAX 600 | ||
| 48 | #define DRBD_TIMEOUT_DEF 60 /* 6 seconds */ | ||
| 49 | |||
| 50 | /* active connection retries when C_WF_CONNECTION */ | ||
| 51 | #define DRBD_CONNECT_INT_MIN 1 | ||
| 52 | #define DRBD_CONNECT_INT_MAX 120 | ||
| 53 | #define DRBD_CONNECT_INT_DEF 10 /* seconds */ | ||
| 54 | |||
| 55 | /* keep-alive probes when idle */ | ||
| 56 | #define DRBD_PING_INT_MIN 1 | ||
| 57 | #define DRBD_PING_INT_MAX 120 | ||
| 58 | #define DRBD_PING_INT_DEF 10 | ||
| 59 | |||
| 60 | /* timeout for the ping packets.*/ | ||
| 61 | #define DRBD_PING_TIMEO_MIN 1 | ||
| 62 | #define DRBD_PING_TIMEO_MAX 100 | ||
| 63 | #define DRBD_PING_TIMEO_DEF 5 | ||
| 64 | |||
| 65 | /* max number of write requests between write barriers */ | ||
| 66 | #define DRBD_MAX_EPOCH_SIZE_MIN 1 | ||
| 67 | #define DRBD_MAX_EPOCH_SIZE_MAX 20000 | ||
| 68 | #define DRBD_MAX_EPOCH_SIZE_DEF 2048 | ||
| 69 | |||
| 70 | /* I don't think that a tcp send buffer of more than 10M is usefull */ | ||
| 71 | #define DRBD_SNDBUF_SIZE_MIN 0 | ||
| 72 | #define DRBD_SNDBUF_SIZE_MAX (10<<20) | ||
| 73 | #define DRBD_SNDBUF_SIZE_DEF 0 | ||
| 74 | |||
| 75 | #define DRBD_RCVBUF_SIZE_MIN 0 | ||
| 76 | #define DRBD_RCVBUF_SIZE_MAX (10<<20) | ||
| 77 | #define DRBD_RCVBUF_SIZE_DEF 0 | ||
| 78 | |||
| 79 | /* @4k PageSize -> 128kB - 512MB */ | ||
| 80 | #define DRBD_MAX_BUFFERS_MIN 32 | ||
| 81 | #define DRBD_MAX_BUFFERS_MAX 131072 | ||
| 82 | #define DRBD_MAX_BUFFERS_DEF 2048 | ||
| 83 | |||
| 84 | /* @4k PageSize -> 4kB - 512MB */ | ||
| 85 | #define DRBD_UNPLUG_WATERMARK_MIN 1 | ||
| 86 | #define DRBD_UNPLUG_WATERMARK_MAX 131072 | ||
| 87 | #define DRBD_UNPLUG_WATERMARK_DEF (DRBD_MAX_BUFFERS_DEF/16) | ||
| 88 | |||
| 89 | /* 0 is disabled. | ||
| 90 | * 200 should be more than enough even for very short timeouts */ | ||
| 91 | #define DRBD_KO_COUNT_MIN 0 | ||
| 92 | #define DRBD_KO_COUNT_MAX 200 | ||
| 93 | #define DRBD_KO_COUNT_DEF 0 | ||
| 94 | /* } */ | ||
| 95 | |||
| 96 | /* syncer { */ | ||
| 97 | /* FIXME allow rate to be zero? */ | ||
| 98 | #define DRBD_RATE_MIN 1 | ||
| 99 | /* channel bonding 10 GbE, or other hardware */ | ||
| 100 | #define DRBD_RATE_MAX (4 << 20) | ||
| 101 | #define DRBD_RATE_DEF 250 /* kb/second */ | ||
| 102 | |||
| 103 | /* less than 7 would hit performance unneccessarily. | ||
| 104 | * 3833 is the largest prime that still does fit | ||
| 105 | * into 64 sectors of activity log */ | ||
| 106 | #define DRBD_AL_EXTENTS_MIN 7 | ||
| 107 | #define DRBD_AL_EXTENTS_MAX 3833 | ||
| 108 | #define DRBD_AL_EXTENTS_DEF 127 | ||
| 109 | |||
| 110 | #define DRBD_AFTER_MIN -1 | ||
| 111 | #define DRBD_AFTER_MAX 255 | ||
| 112 | #define DRBD_AFTER_DEF -1 | ||
| 113 | |||
| 114 | /* } */ | ||
| 115 | |||
| 116 | /* drbdsetup XY resize -d Z | ||
| 117 | * you are free to reduce the device size to nothing, if you want to. | ||
| 118 | * the upper limit with 64bit kernel, enough ram and flexible meta data | ||
| 119 | * is 16 TB, currently. */ | ||
| 120 | /* DRBD_MAX_SECTORS */ | ||
| 121 | #define DRBD_DISK_SIZE_SECT_MIN 0 | ||
| 122 | #define DRBD_DISK_SIZE_SECT_MAX (16 * (2LLU << 30)) | ||
| 123 | #define DRBD_DISK_SIZE_SECT_DEF 0 /* = disabled = no user size... */ | ||
| 124 | |||
| 125 | #define DRBD_ON_IO_ERROR_DEF EP_PASS_ON | ||
| 126 | #define DRBD_FENCING_DEF FP_DONT_CARE | ||
| 127 | #define DRBD_AFTER_SB_0P_DEF ASB_DISCONNECT | ||
| 128 | #define DRBD_AFTER_SB_1P_DEF ASB_DISCONNECT | ||
| 129 | #define DRBD_AFTER_SB_2P_DEF ASB_DISCONNECT | ||
| 130 | #define DRBD_RR_CONFLICT_DEF ASB_DISCONNECT | ||
| 131 | |||
| 132 | #define DRBD_MAX_BIO_BVECS_MIN 0 | ||
| 133 | #define DRBD_MAX_BIO_BVECS_MAX 128 | ||
| 134 | #define DRBD_MAX_BIO_BVECS_DEF 0 | ||
| 135 | |||
| 136 | #undef RANGE | ||
| 137 | #endif | ||
diff --git a/include/linux/drbd_nl.h b/include/linux/drbd_nl.h new file mode 100644 index 000000000000..f7431a4ca608 --- /dev/null +++ b/include/linux/drbd_nl.h | |||
| @@ -0,0 +1,139 @@ | |||
| 1 | /* | ||
| 2 | PAKET( name, | ||
| 3 | TYPE ( pn, pr, member ) | ||
| 4 | ... | ||
| 5 | ) | ||
| 6 | |||
| 7 | You may never reissue one of the pn arguments | ||
| 8 | */ | ||
| 9 | |||
| 10 | #if !defined(NL_PACKET) || !defined(NL_STRING) || !defined(NL_INTEGER) || !defined(NL_BIT) || !defined(NL_INT64) | ||
| 11 | #error "The macros NL_PACKET, NL_STRING, NL_INTEGER, NL_INT64 and NL_BIT needs to be defined" | ||
| 12 | #endif | ||
| 13 | |||
| 14 | NL_PACKET(primary, 1, | ||
| 15 | NL_BIT( 1, T_MAY_IGNORE, primary_force) | ||
| 16 | ) | ||
| 17 | |||
| 18 | NL_PACKET(secondary, 2, ) | ||
| 19 | |||
| 20 | NL_PACKET(disk_conf, 3, | ||
| 21 | NL_INT64( 2, T_MAY_IGNORE, disk_size) | ||
| 22 | NL_STRING( 3, T_MANDATORY, backing_dev, 128) | ||
| 23 | NL_STRING( 4, T_MANDATORY, meta_dev, 128) | ||
| 24 | NL_INTEGER( 5, T_MANDATORY, meta_dev_idx) | ||
| 25 | NL_INTEGER( 6, T_MAY_IGNORE, on_io_error) | ||
| 26 | NL_INTEGER( 7, T_MAY_IGNORE, fencing) | ||
| 27 | NL_BIT( 37, T_MAY_IGNORE, use_bmbv) | ||
| 28 | NL_BIT( 53, T_MAY_IGNORE, no_disk_flush) | ||
| 29 | NL_BIT( 54, T_MAY_IGNORE, no_md_flush) | ||
| 30 | /* 55 max_bio_size was available in 8.2.6rc2 */ | ||
| 31 | NL_INTEGER( 56, T_MAY_IGNORE, max_bio_bvecs) | ||
| 32 | NL_BIT( 57, T_MAY_IGNORE, no_disk_barrier) | ||
| 33 | NL_BIT( 58, T_MAY_IGNORE, no_disk_drain) | ||
| 34 | ) | ||
| 35 | |||
| 36 | NL_PACKET(detach, 4, ) | ||
| 37 | |||
| 38 | NL_PACKET(net_conf, 5, | ||
| 39 | NL_STRING( 8, T_MANDATORY, my_addr, 128) | ||
| 40 | NL_STRING( 9, T_MANDATORY, peer_addr, 128) | ||
| 41 | NL_STRING( 10, T_MAY_IGNORE, shared_secret, SHARED_SECRET_MAX) | ||
| 42 | NL_STRING( 11, T_MAY_IGNORE, cram_hmac_alg, SHARED_SECRET_MAX) | ||
| 43 | NL_STRING( 44, T_MAY_IGNORE, integrity_alg, SHARED_SECRET_MAX) | ||
| 44 | NL_INTEGER( 14, T_MAY_IGNORE, timeout) | ||
| 45 | NL_INTEGER( 15, T_MANDATORY, wire_protocol) | ||
| 46 | NL_INTEGER( 16, T_MAY_IGNORE, try_connect_int) | ||
| 47 | NL_INTEGER( 17, T_MAY_IGNORE, ping_int) | ||
| 48 | NL_INTEGER( 18, T_MAY_IGNORE, max_epoch_size) | ||
| 49 | NL_INTEGER( 19, T_MAY_IGNORE, max_buffers) | ||
| 50 | NL_INTEGER( 20, T_MAY_IGNORE, unplug_watermark) | ||
| 51 | NL_INTEGER( 21, T_MAY_IGNORE, sndbuf_size) | ||
| 52 | NL_INTEGER( 22, T_MAY_IGNORE, ko_count) | ||
| 53 | NL_INTEGER( 24, T_MAY_IGNORE, after_sb_0p) | ||
| 54 | NL_INTEGER( 25, T_MAY_IGNORE, after_sb_1p) | ||
| 55 | NL_INTEGER( 26, T_MAY_IGNORE, after_sb_2p) | ||
| 56 | NL_INTEGER( 39, T_MAY_IGNORE, rr_conflict) | ||
| 57 | NL_INTEGER( 40, T_MAY_IGNORE, ping_timeo) | ||
| 58 | NL_INTEGER( 67, T_MAY_IGNORE, rcvbuf_size) | ||
| 59 | /* 59 addr_family was available in GIT, never released */ | ||
| 60 | NL_BIT( 60, T_MANDATORY, mind_af) | ||
| 61 | NL_BIT( 27, T_MAY_IGNORE, want_lose) | ||
| 62 | NL_BIT( 28, T_MAY_IGNORE, two_primaries) | ||
| 63 | NL_BIT( 41, T_MAY_IGNORE, always_asbp) | ||
| 64 | NL_BIT( 61, T_MAY_IGNORE, no_cork) | ||
| 65 | NL_BIT( 62, T_MANDATORY, auto_sndbuf_size) | ||
| 66 | NL_BIT( 70, T_MANDATORY, dry_run) | ||
| 67 | ) | ||
| 68 | |||
| 69 | NL_PACKET(disconnect, 6, ) | ||
| 70 | |||
| 71 | NL_PACKET(resize, 7, | ||
| 72 | NL_INT64( 29, T_MAY_IGNORE, resize_size) | ||
| 73 | NL_BIT( 68, T_MAY_IGNORE, resize_force) | ||
| 74 | ) | ||
| 75 | |||
| 76 | NL_PACKET(syncer_conf, 8, | ||
| 77 | NL_INTEGER( 30, T_MAY_IGNORE, rate) | ||
| 78 | NL_INTEGER( 31, T_MAY_IGNORE, after) | ||
| 79 | NL_INTEGER( 32, T_MAY_IGNORE, al_extents) | ||
| 80 | NL_STRING( 52, T_MAY_IGNORE, verify_alg, SHARED_SECRET_MAX) | ||
| 81 | NL_STRING( 51, T_MAY_IGNORE, cpu_mask, 32) | ||
| 82 | NL_STRING( 64, T_MAY_IGNORE, csums_alg, SHARED_SECRET_MAX) | ||
| 83 | NL_BIT( 65, T_MAY_IGNORE, use_rle) | ||
| 84 | ) | ||
| 85 | |||
| 86 | NL_PACKET(invalidate, 9, ) | ||
| 87 | NL_PACKET(invalidate_peer, 10, ) | ||
| 88 | NL_PACKET(pause_sync, 11, ) | ||
| 89 | NL_PACKET(resume_sync, 12, ) | ||
| 90 | NL_PACKET(suspend_io, 13, ) | ||
| 91 | NL_PACKET(resume_io, 14, ) | ||
| 92 | NL_PACKET(outdate, 15, ) | ||
| 93 | NL_PACKET(get_config, 16, ) | ||
| 94 | NL_PACKET(get_state, 17, | ||
| 95 | NL_INTEGER( 33, T_MAY_IGNORE, state_i) | ||
| 96 | ) | ||
| 97 | |||
| 98 | NL_PACKET(get_uuids, 18, | ||
| 99 | NL_STRING( 34, T_MAY_IGNORE, uuids, (UI_SIZE*sizeof(__u64))) | ||
| 100 | NL_INTEGER( 35, T_MAY_IGNORE, uuids_flags) | ||
| 101 | ) | ||
| 102 | |||
| 103 | NL_PACKET(get_timeout_flag, 19, | ||
| 104 | NL_BIT( 36, T_MAY_IGNORE, use_degraded) | ||
| 105 | ) | ||
| 106 | |||
| 107 | NL_PACKET(call_helper, 20, | ||
| 108 | NL_STRING( 38, T_MAY_IGNORE, helper, 32) | ||
| 109 | ) | ||
| 110 | |||
| 111 | /* Tag nr 42 already allocated in drbd-8.1 development. */ | ||
| 112 | |||
| 113 | NL_PACKET(sync_progress, 23, | ||
| 114 | NL_INTEGER( 43, T_MAY_IGNORE, sync_progress) | ||
| 115 | ) | ||
| 116 | |||
| 117 | NL_PACKET(dump_ee, 24, | ||
| 118 | NL_STRING( 45, T_MAY_IGNORE, dump_ee_reason, 32) | ||
| 119 | NL_STRING( 46, T_MAY_IGNORE, seen_digest, SHARED_SECRET_MAX) | ||
| 120 | NL_STRING( 47, T_MAY_IGNORE, calc_digest, SHARED_SECRET_MAX) | ||
| 121 | NL_INT64( 48, T_MAY_IGNORE, ee_sector) | ||
| 122 | NL_INT64( 49, T_MAY_IGNORE, ee_block_id) | ||
| 123 | NL_STRING( 50, T_MAY_IGNORE, ee_data, 32 << 10) | ||
| 124 | ) | ||
| 125 | |||
| 126 | NL_PACKET(start_ov, 25, | ||
| 127 | NL_INT64( 66, T_MAY_IGNORE, start_sector) | ||
| 128 | ) | ||
| 129 | |||
| 130 | NL_PACKET(new_c_uuid, 26, | ||
| 131 | NL_BIT( 63, T_MANDATORY, clear_bm) | ||
| 132 | ) | ||
| 133 | |||
| 134 | #undef NL_PACKET | ||
| 135 | #undef NL_INTEGER | ||
| 136 | #undef NL_INT64 | ||
| 137 | #undef NL_BIT | ||
| 138 | #undef NL_STRING | ||
| 139 | |||
diff --git a/include/linux/drbd_tag_magic.h b/include/linux/drbd_tag_magic.h new file mode 100644 index 000000000000..fcdff8410e99 --- /dev/null +++ b/include/linux/drbd_tag_magic.h | |||
| @@ -0,0 +1,83 @@ | |||
| 1 | #ifndef DRBD_TAG_MAGIC_H | ||
| 2 | #define DRBD_TAG_MAGIC_H | ||
| 3 | |||
| 4 | #define TT_END 0 | ||
| 5 | #define TT_REMOVED 0xE000 | ||
| 6 | |||
| 7 | /* declare packet_type enums */ | ||
| 8 | enum packet_types { | ||
| 9 | #define NL_PACKET(name, number, fields) P_ ## name = number, | ||
| 10 | #define NL_INTEGER(pn, pr, member) | ||
| 11 | #define NL_INT64(pn, pr, member) | ||
| 12 | #define NL_BIT(pn, pr, member) | ||
| 13 | #define NL_STRING(pn, pr, member, len) | ||
| 14 | #include "drbd_nl.h" | ||
| 15 | P_nl_after_last_packet, | ||
| 16 | }; | ||
| 17 | |||
| 18 | /* These struct are used to deduce the size of the tag lists: */ | ||
| 19 | #define NL_PACKET(name, number, fields) \ | ||
| 20 | struct name ## _tag_len_struct { fields }; | ||
| 21 | #define NL_INTEGER(pn, pr, member) \ | ||
| 22 | int member; int tag_and_len ## member; | ||
| 23 | #define NL_INT64(pn, pr, member) \ | ||
| 24 | __u64 member; int tag_and_len ## member; | ||
| 25 | #define NL_BIT(pn, pr, member) \ | ||
| 26 | unsigned char member:1; int tag_and_len ## member; | ||
| 27 | #define NL_STRING(pn, pr, member, len) \ | ||
| 28 | unsigned char member[len]; int member ## _len; \ | ||
| 29 | int tag_and_len ## member; | ||
| 30 | #include "linux/drbd_nl.h" | ||
| 31 | |||
| 32 | /* declate tag-list-sizes */ | ||
| 33 | static const int tag_list_sizes[] = { | ||
| 34 | #define NL_PACKET(name, number, fields) 2 fields , | ||
| 35 | #define NL_INTEGER(pn, pr, member) + 4 + 4 | ||
| 36 | #define NL_INT64(pn, pr, member) + 4 + 8 | ||
| 37 | #define NL_BIT(pn, pr, member) + 4 + 1 | ||
| 38 | #define NL_STRING(pn, pr, member, len) + 4 + (len) | ||
| 39 | #include "drbd_nl.h" | ||
| 40 | }; | ||
| 41 | |||
| 42 | /* The two highest bits are used for the tag type */ | ||
| 43 | #define TT_MASK 0xC000 | ||
| 44 | #define TT_INTEGER 0x0000 | ||
| 45 | #define TT_INT64 0x4000 | ||
| 46 | #define TT_BIT 0x8000 | ||
| 47 | #define TT_STRING 0xC000 | ||
| 48 | /* The next bit indicates if processing of the tag is mandatory */ | ||
| 49 | #define T_MANDATORY 0x2000 | ||
| 50 | #define T_MAY_IGNORE 0x0000 | ||
| 51 | #define TN_MASK 0x1fff | ||
| 52 | /* The remaining 13 bits are used to enumerate the tags */ | ||
| 53 | |||
| 54 | #define tag_type(T) ((T) & TT_MASK) | ||
| 55 | #define tag_number(T) ((T) & TN_MASK) | ||
| 56 | |||
| 57 | /* declare tag enums */ | ||
| 58 | #define NL_PACKET(name, number, fields) fields | ||
| 59 | enum drbd_tags { | ||
| 60 | #define NL_INTEGER(pn, pr, member) T_ ## member = pn | TT_INTEGER | pr , | ||
| 61 | #define NL_INT64(pn, pr, member) T_ ## member = pn | TT_INT64 | pr , | ||
| 62 | #define NL_BIT(pn, pr, member) T_ ## member = pn | TT_BIT | pr , | ||
| 63 | #define NL_STRING(pn, pr, member, len) T_ ## member = pn | TT_STRING | pr , | ||
| 64 | #include "drbd_nl.h" | ||
| 65 | }; | ||
| 66 | |||
| 67 | struct tag { | ||
| 68 | const char *name; | ||
| 69 | int type_n_flags; | ||
| 70 | int max_len; | ||
| 71 | }; | ||
| 72 | |||
| 73 | /* declare tag names */ | ||
| 74 | #define NL_PACKET(name, number, fields) fields | ||
| 75 | static const struct tag tag_descriptions[] = { | ||
| 76 | #define NL_INTEGER(pn, pr, member) [ pn ] = { #member, TT_INTEGER | pr, sizeof(int) }, | ||
| 77 | #define NL_INT64(pn, pr, member) [ pn ] = { #member, TT_INT64 | pr, sizeof(__u64) }, | ||
| 78 | #define NL_BIT(pn, pr, member) [ pn ] = { #member, TT_BIT | pr, sizeof(int) }, | ||
| 79 | #define NL_STRING(pn, pr, member, len) [ pn ] = { #member, TT_STRING | pr, (len) }, | ||
| 80 | #include "drbd_nl.h" | ||
| 81 | }; | ||
| 82 | |||
| 83 | #endif | ||
diff --git a/include/linux/dst.h b/include/linux/dst.h deleted file mode 100644 index e26fed84b1aa..000000000000 --- a/include/linux/dst.h +++ /dev/null | |||
| @@ -1,587 +0,0 @@ | |||
| 1 | /* | ||
| 2 | * 2007+ Copyright (c) Evgeniy Polyakov <johnpol@2ka.mipt.ru> | ||
| 3 | * All rights reserved. | ||
| 4 | * | ||
| 5 | * This program is free software; you can redistribute it and/or modify | ||
| 6 | * it under the terms of the GNU General Public License as published by | ||
| 7 | * the Free Software Foundation; either version 2 of the License, or | ||
| 8 | * (at your option) any later version. | ||
| 9 | * | ||
| 10 | * This program is distributed in the hope that it will be useful, | ||
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 13 | * GNU General Public License for more details. | ||
| 14 | */ | ||
| 15 | |||
| 16 | #ifndef __DST_H | ||
| 17 | #define __DST_H | ||
| 18 | |||
| 19 | #include <linux/types.h> | ||
| 20 | #include <linux/connector.h> | ||
| 21 | |||
| 22 | #define DST_NAMELEN 32 | ||
| 23 | #define DST_NAME "dst" | ||
| 24 | |||
| 25 | enum { | ||
| 26 | /* Remove node with given id from storage */ | ||
| 27 | DST_DEL_NODE = 0, | ||
| 28 | /* Add remote node with given id to the storage */ | ||
| 29 | DST_ADD_REMOTE, | ||
| 30 | /* Add local node with given id to the storage to be exported and used by remote peers */ | ||
| 31 | DST_ADD_EXPORT, | ||
| 32 | /* Crypto initialization command (hash/cipher used to protect the connection) */ | ||
| 33 | DST_CRYPTO, | ||
| 34 | /* Security attributes for given connection (permissions for example) */ | ||
| 35 | DST_SECURITY, | ||
| 36 | /* Register given node in the block layer subsystem */ | ||
| 37 | DST_START, | ||
| 38 | DST_CMD_MAX | ||
| 39 | }; | ||
| 40 | |||
| 41 | struct dst_ctl | ||
| 42 | { | ||
| 43 | /* Storage name */ | ||
| 44 | char name[DST_NAMELEN]; | ||
| 45 | /* Command flags */ | ||
| 46 | __u32 flags; | ||
| 47 | /* Command itself (see above) */ | ||
| 48 | __u32 cmd; | ||
| 49 | /* Maximum number of pages per single request in this device */ | ||
| 50 | __u32 max_pages; | ||
| 51 | /* Stale/error transaction scanning timeout in milliseconds */ | ||
| 52 | __u32 trans_scan_timeout; | ||
| 53 | /* Maximum number of retry sends before completing transaction as broken */ | ||
| 54 | __u32 trans_max_retries; | ||
| 55 | /* Storage size */ | ||
| 56 | __u64 size; | ||
| 57 | }; | ||
| 58 | |||
| 59 | /* Reply command carries completion status */ | ||
| 60 | struct dst_ctl_ack | ||
| 61 | { | ||
| 62 | struct cn_msg msg; | ||
| 63 | int error; | ||
| 64 | int unused[3]; | ||
| 65 | }; | ||
| 66 | |||
| 67 | /* | ||
| 68 | * Unfortunaltely socket address structure is not exported to userspace | ||
| 69 | * and is redefined there. | ||
| 70 | */ | ||
| 71 | #define SADDR_MAX_DATA 128 | ||
| 72 | |||
| 73 | struct saddr { | ||
| 74 | /* address family, AF_xxx */ | ||
| 75 | unsigned short sa_family; | ||
| 76 | /* 14 bytes of protocol address */ | ||
| 77 | char sa_data[SADDR_MAX_DATA]; | ||
| 78 | /* Number of bytes used in sa_data */ | ||
| 79 | unsigned short sa_data_len; | ||
| 80 | }; | ||
| 81 | |||
| 82 | /* Address structure */ | ||
| 83 | struct dst_network_ctl | ||
| 84 | { | ||
| 85 | /* Socket type: datagram, stream...*/ | ||
| 86 | unsigned int type; | ||
| 87 | /* Let me guess, is it a Jupiter diameter? */ | ||
| 88 | unsigned int proto; | ||
| 89 | /* Peer's address */ | ||
| 90 | struct saddr addr; | ||
| 91 | }; | ||
| 92 | |||
| 93 | struct dst_crypto_ctl | ||
| 94 | { | ||
| 95 | /* Cipher and hash names */ | ||
| 96 | char cipher_algo[DST_NAMELEN]; | ||
| 97 | char hash_algo[DST_NAMELEN]; | ||
| 98 | |||
| 99 | /* Key sizes. Can be zero for digest for example */ | ||
| 100 | unsigned int cipher_keysize, hash_keysize; | ||
| 101 | /* Alignment. Calculated by the DST itself. */ | ||
| 102 | unsigned int crypto_attached_size; | ||
| 103 | /* Number of threads to perform crypto operations */ | ||
| 104 | int thread_num; | ||
| 105 | }; | ||
| 106 | |||
| 107 | /* Export security attributes have this bits checked in when client connects */ | ||
| 108 | #define DST_PERM_READ (1<<0) | ||
| 109 | #define DST_PERM_WRITE (1<<1) | ||
| 110 | |||
| 111 | /* | ||
| 112 | * Right now it is simple model, where each remote address | ||
| 113 | * is assigned to set of permissions it is allowed to perform. | ||
| 114 | * In real world block device does not know anything but | ||
| 115 | * reading and writing, so it should be more than enough. | ||
| 116 | */ | ||
| 117 | struct dst_secure_user | ||
| 118 | { | ||
| 119 | unsigned int permissions; | ||
| 120 | struct saddr addr; | ||
| 121 | }; | ||
| 122 | |||
| 123 | /* | ||
| 124 | * Export control command: device to export and network address to accept | ||
| 125 | * clients to work with given device | ||
| 126 | */ | ||
| 127 | struct dst_export_ctl | ||
| 128 | { | ||
| 129 | char device[DST_NAMELEN]; | ||
| 130 | struct dst_network_ctl ctl; | ||
| 131 | }; | ||
| 132 | |||
| 133 | enum { | ||
| 134 | DST_CFG = 1, /* Request remote configuration */ | ||
| 135 | DST_IO, /* IO command */ | ||
| 136 | DST_IO_RESPONSE, /* IO response */ | ||
| 137 | DST_PING, /* Keepalive message */ | ||
| 138 | DST_NCMD_MAX, | ||
| 139 | }; | ||
| 140 | |||
| 141 | struct dst_cmd | ||
| 142 | { | ||
| 143 | /* Network command itself, see above */ | ||
| 144 | __u32 cmd; | ||
| 145 | /* | ||
| 146 | * Size of the attached data | ||
| 147 | * (in most cases, for READ command it means how many bytes were requested) | ||
| 148 | */ | ||
| 149 | __u32 size; | ||
| 150 | /* Crypto size: number of attached bytes with digest/hmac */ | ||
| 151 | __u32 csize; | ||
| 152 | /* Here we can carry secret data */ | ||
| 153 | __u32 reserved; | ||
| 154 | /* Read/write bits, see how they are encoded in bio structure */ | ||
| 155 | __u64 rw; | ||
| 156 | /* BIO flags */ | ||
| 157 | __u64 flags; | ||
| 158 | /* Unique command id (like transaction ID) */ | ||
| 159 | __u64 id; | ||
| 160 | /* Sector to start IO from */ | ||
| 161 | __u64 sector; | ||
| 162 | /* Hash data is placed after this header */ | ||
| 163 | __u8 hash[0]; | ||
| 164 | }; | ||
| 165 | |||
| 166 | /* | ||
| 167 | * Convert command to/from network byte order. | ||
| 168 | * We do not use hton*() functions, since there is | ||
| 169 | * no 64-bit implementation. | ||
| 170 | */ | ||
| 171 | static inline void dst_convert_cmd(struct dst_cmd *c) | ||
| 172 | { | ||
| 173 | c->cmd = __cpu_to_be32(c->cmd); | ||
| 174 | c->csize = __cpu_to_be32(c->csize); | ||
| 175 | c->size = __cpu_to_be32(c->size); | ||
| 176 | c->sector = __cpu_to_be64(c->sector); | ||
| 177 | c->id = __cpu_to_be64(c->id); | ||
| 178 | c->flags = __cpu_to_be64(c->flags); | ||
| 179 | c->rw = __cpu_to_be64(c->rw); | ||
| 180 | } | ||
| 181 | |||
| 182 | /* Transaction id */ | ||
| 183 | typedef __u64 dst_gen_t; | ||
| 184 | |||
| 185 | #ifdef __KERNEL__ | ||
| 186 | |||
| 187 | #include <linux/blkdev.h> | ||
| 188 | #include <linux/bio.h> | ||
| 189 | #include <linux/device.h> | ||
| 190 | #include <linux/mempool.h> | ||
| 191 | #include <linux/net.h> | ||
| 192 | #include <linux/poll.h> | ||
| 193 | #include <linux/rbtree.h> | ||
| 194 | |||
| 195 | #ifdef CONFIG_DST_DEBUG | ||
| 196 | #define dprintk(f, a...) printk(KERN_NOTICE f, ##a) | ||
| 197 | #else | ||
| 198 | static inline void __attribute__ ((format (printf, 1, 2))) | ||
| 199 | dprintk(const char *fmt, ...) {} | ||
| 200 | #endif | ||
| 201 | |||
| 202 | struct dst_node; | ||
| 203 | |||
| 204 | struct dst_trans | ||
| 205 | { | ||
| 206 | /* DST node we are working with */ | ||
| 207 | struct dst_node *n; | ||
| 208 | |||
| 209 | /* Entry inside transaction tree */ | ||
| 210 | struct rb_node trans_entry; | ||
| 211 | |||
| 212 | /* Merlin kills this transaction when this memory cell equals zero */ | ||
| 213 | atomic_t refcnt; | ||
| 214 | |||
| 215 | /* How this transaction should be processed by crypto engine */ | ||
| 216 | short enc; | ||
| 217 | /* How many times this transaction was resent */ | ||
| 218 | short retries; | ||
| 219 | /* Completion status */ | ||
| 220 | int error; | ||
| 221 | |||
| 222 | /* When did we send it to the remote peer */ | ||
| 223 | long send_time; | ||
| 224 | |||
| 225 | /* My name is... | ||
| 226 | * Well, computers does not speak, they have unique id instead */ | ||
| 227 | dst_gen_t gen; | ||
| 228 | |||
| 229 | /* Block IO we are working with */ | ||
| 230 | struct bio *bio; | ||
| 231 | |||
| 232 | /* Network command for above block IO request */ | ||
| 233 | struct dst_cmd cmd; | ||
| 234 | }; | ||
| 235 | |||
| 236 | struct dst_crypto_engine | ||
| 237 | { | ||
| 238 | /* What should we do with all block requests */ | ||
| 239 | struct crypto_hash *hash; | ||
| 240 | struct crypto_ablkcipher *cipher; | ||
| 241 | |||
| 242 | /* Pool of pages used to encrypt data into before sending */ | ||
| 243 | int page_num; | ||
| 244 | struct page **pages; | ||
| 245 | |||
| 246 | /* What to do with current request */ | ||
| 247 | int enc; | ||
| 248 | /* Who we are and where do we go */ | ||
| 249 | struct scatterlist *src, *dst; | ||
| 250 | |||
| 251 | /* Maximum timeout waiting for encryption to be completed */ | ||
| 252 | long timeout; | ||
| 253 | /* IV is a 64-bit sequential counter */ | ||
| 254 | u64 iv; | ||
| 255 | |||
| 256 | /* Secret data */ | ||
| 257 | void *private; | ||
| 258 | |||
| 259 | /* Cached temporary data lives here */ | ||
| 260 | int size; | ||
| 261 | void *data; | ||
| 262 | }; | ||
| 263 | |||
| 264 | struct dst_state | ||
| 265 | { | ||
| 266 | /* The main state protection */ | ||
| 267 | struct mutex state_lock; | ||
| 268 | |||
| 269 | /* Polling machinery for sockets */ | ||
| 270 | wait_queue_t wait; | ||
| 271 | wait_queue_head_t *whead; | ||
| 272 | /* Most of events are being waited here */ | ||
| 273 | wait_queue_head_t thread_wait; | ||
| 274 | |||
| 275 | /* Who owns this? */ | ||
| 276 | struct dst_node *node; | ||
| 277 | |||
| 278 | /* Network address for this state */ | ||
| 279 | struct dst_network_ctl ctl; | ||
| 280 | |||
| 281 | /* Permissions to work with: read-only or rw connection */ | ||
| 282 | u32 permissions; | ||
| 283 | |||
| 284 | /* Called when we need to clean private data */ | ||
| 285 | void (* cleanup)(struct dst_state *st); | ||
| 286 | |||
| 287 | /* Used by the server: BIO completion queues BIOs here */ | ||
| 288 | struct list_head request_list; | ||
| 289 | spinlock_t request_lock; | ||
| 290 | |||
| 291 | /* Guess what? No, it is not number of planets */ | ||
| 292 | atomic_t refcnt; | ||
| 293 | |||
| 294 | /* This flags is set when connection should be dropped */ | ||
| 295 | int need_exit; | ||
| 296 | |||
| 297 | /* | ||
| 298 | * Socket to work with. Second pointer is used for | ||
| 299 | * lockless check if socket was changed before performing | ||
| 300 | * next action (like working with cached polling result) | ||
| 301 | */ | ||
| 302 | struct socket *socket, *read_socket; | ||
| 303 | |||
| 304 | /* Cached preallocated data */ | ||
| 305 | void *data; | ||
| 306 | unsigned int size; | ||
| 307 | |||
| 308 | /* Currently processed command */ | ||
| 309 | struct dst_cmd cmd; | ||
| 310 | }; | ||
| 311 | |||
| 312 | struct dst_info | ||
| 313 | { | ||
| 314 | /* Device size */ | ||
| 315 | u64 size; | ||
| 316 | |||
| 317 | /* Local device name for export devices */ | ||
| 318 | char local[DST_NAMELEN]; | ||
| 319 | |||
| 320 | /* Network setup */ | ||
| 321 | struct dst_network_ctl net; | ||
| 322 | |||
| 323 | /* Sysfs bits use this */ | ||
| 324 | struct device device; | ||
| 325 | }; | ||
| 326 | |||
| 327 | struct dst_node | ||
| 328 | { | ||
| 329 | struct list_head node_entry; | ||
| 330 | |||
| 331 | /* Hi, my name is stored here */ | ||
| 332 | char name[DST_NAMELEN]; | ||
| 333 | /* My cache name is stored here */ | ||
| 334 | char cache_name[DST_NAMELEN]; | ||
| 335 | |||
| 336 | /* Block device attached to given node. | ||
| 337 | * Only valid for exporting nodes */ | ||
| 338 | struct block_device *bdev; | ||
| 339 | /* Network state machine for given peer */ | ||
| 340 | struct dst_state *state; | ||
| 341 | |||
| 342 | /* Block IO machinery */ | ||
| 343 | struct request_queue *queue; | ||
| 344 | struct gendisk *disk; | ||
| 345 | |||
| 346 | /* Number of threads in processing pool */ | ||
| 347 | int thread_num; | ||
| 348 | /* Maximum number of pages in single IO */ | ||
| 349 | int max_pages; | ||
| 350 | |||
| 351 | /* I'm that big in bytes */ | ||
| 352 | loff_t size; | ||
| 353 | |||
| 354 | /* Exported to userspace node information */ | ||
| 355 | struct dst_info *info; | ||
| 356 | |||
| 357 | /* | ||
| 358 | * Security attribute list. | ||
| 359 | * Used only by exporting node currently. | ||
| 360 | */ | ||
| 361 | struct list_head security_list; | ||
| 362 | struct mutex security_lock; | ||
| 363 | |||
| 364 | /* | ||
| 365 | * When this unerflows below zero, university collapses. | ||
| 366 | * But this will not happen, since node will be freed, | ||
| 367 | * when reference counter reaches zero. | ||
| 368 | */ | ||
| 369 | atomic_t refcnt; | ||
| 370 | |||
| 371 | /* How precisely should I be started? */ | ||
| 372 | int (*start)(struct dst_node *); | ||
| 373 | |||
| 374 | /* Crypto capabilities */ | ||
| 375 | struct dst_crypto_ctl crypto; | ||
| 376 | u8 *hash_key; | ||
| 377 | u8 *cipher_key; | ||
| 378 | |||
| 379 | /* Pool of processing thread */ | ||
| 380 | struct thread_pool *pool; | ||
| 381 | |||
| 382 | /* Transaction IDs live here */ | ||
| 383 | atomic_long_t gen; | ||
| 384 | |||
| 385 | /* | ||
| 386 | * How frequently and how many times transaction | ||
| 387 | * tree should be scanned to drop stale objects. | ||
| 388 | */ | ||
| 389 | long trans_scan_timeout; | ||
| 390 | int trans_max_retries; | ||
| 391 | |||
| 392 | /* Small gnomes live here */ | ||
| 393 | struct rb_root trans_root; | ||
| 394 | struct mutex trans_lock; | ||
| 395 | |||
| 396 | /* | ||
| 397 | * Transaction cache/memory pool. | ||
| 398 | * It is big enough to contain not only transaction | ||
| 399 | * itself, but additional crypto data (digest/hmac). | ||
| 400 | */ | ||
| 401 | struct kmem_cache *trans_cache; | ||
| 402 | mempool_t *trans_pool; | ||
| 403 | |||
| 404 | /* This entity scans transaction tree */ | ||
| 405 | struct delayed_work trans_work; | ||
| 406 | |||
| 407 | wait_queue_head_t wait; | ||
| 408 | }; | ||
| 409 | |||
| 410 | /* Kernel representation of the security attribute */ | ||
| 411 | struct dst_secure | ||
| 412 | { | ||
| 413 | struct list_head sec_entry; | ||
| 414 | struct dst_secure_user sec; | ||
| 415 | }; | ||
| 416 | |||
| 417 | int dst_process_bio(struct dst_node *n, struct bio *bio); | ||
| 418 | |||
| 419 | int dst_node_init_connected(struct dst_node *n, struct dst_network_ctl *r); | ||
| 420 | int dst_node_init_listened(struct dst_node *n, struct dst_export_ctl *le); | ||
| 421 | |||
| 422 | static inline struct dst_state *dst_state_get(struct dst_state *st) | ||
| 423 | { | ||
| 424 | BUG_ON(atomic_read(&st->refcnt) == 0); | ||
| 425 | atomic_inc(&st->refcnt); | ||
| 426 | return st; | ||
| 427 | } | ||
| 428 | |||
| 429 | void dst_state_put(struct dst_state *st); | ||
| 430 | |||
| 431 | struct dst_state *dst_state_alloc(struct dst_node *n); | ||
| 432 | int dst_state_socket_create(struct dst_state *st); | ||
| 433 | void dst_state_socket_release(struct dst_state *st); | ||
| 434 | |||
| 435 | void dst_state_exit_connected(struct dst_state *st); | ||
| 436 | |||
| 437 | int dst_state_schedule_receiver(struct dst_state *st); | ||
| 438 | |||
| 439 | void dst_dump_addr(struct socket *sk, struct sockaddr *sa, char *str); | ||
| 440 | |||
| 441 | static inline void dst_state_lock(struct dst_state *st) | ||
| 442 | { | ||
| 443 | mutex_lock(&st->state_lock); | ||
| 444 | } | ||
| 445 | |||
| 446 | static inline void dst_state_unlock(struct dst_state *st) | ||
| 447 | { | ||
| 448 | mutex_unlock(&st->state_lock); | ||
| 449 | } | ||
| 450 | |||
| 451 | void dst_poll_exit(struct dst_state *st); | ||
| 452 | int dst_poll_init(struct dst_state *st); | ||
| 453 | |||
| 454 | static inline unsigned int dst_state_poll(struct dst_state *st) | ||
| 455 | { | ||
| 456 | unsigned int revents = POLLHUP | POLLERR; | ||
| 457 | |||
| 458 | dst_state_lock(st); | ||
| 459 | if (st->socket) | ||
| 460 | revents = st->socket->ops->poll(NULL, st->socket, NULL); | ||
| 461 | dst_state_unlock(st); | ||
| 462 | |||
| 463 | return revents; | ||
| 464 | } | ||
| 465 | |||
| 466 | static inline int dst_thread_setup(void *private, void *data) | ||
| 467 | { | ||
| 468 | return 0; | ||
| 469 | } | ||
| 470 | |||
| 471 | void dst_node_put(struct dst_node *n); | ||
| 472 | |||
| 473 | static inline struct dst_node *dst_node_get(struct dst_node *n) | ||
| 474 | { | ||
| 475 | atomic_inc(&n->refcnt); | ||
| 476 | return n; | ||
| 477 | } | ||
| 478 | |||
| 479 | int dst_data_recv(struct dst_state *st, void *data, unsigned int size); | ||
| 480 | int dst_recv_cdata(struct dst_state *st, void *cdata); | ||
| 481 | int dst_data_send_header(struct socket *sock, | ||
| 482 | void *data, unsigned int size, int more); | ||
| 483 | |||
| 484 | int dst_send_bio(struct dst_state *st, struct dst_cmd *cmd, struct bio *bio); | ||
| 485 | |||
| 486 | int dst_process_io(struct dst_state *st); | ||
| 487 | int dst_export_crypto(struct dst_node *n, struct bio *bio); | ||
| 488 | int dst_export_send_bio(struct bio *bio); | ||
| 489 | int dst_start_export(struct dst_node *n); | ||
| 490 | |||
| 491 | int __init dst_export_init(void); | ||
| 492 | void dst_export_exit(void); | ||
| 493 | |||
| 494 | /* Private structure for export block IO requests */ | ||
| 495 | struct dst_export_priv | ||
| 496 | { | ||
| 497 | struct list_head request_entry; | ||
| 498 | struct dst_state *state; | ||
| 499 | struct bio *bio; | ||
| 500 | struct dst_cmd cmd; | ||
| 501 | }; | ||
| 502 | |||
| 503 | static inline void dst_trans_get(struct dst_trans *t) | ||
| 504 | { | ||
| 505 | atomic_inc(&t->refcnt); | ||
| 506 | } | ||
| 507 | |||
| 508 | struct dst_trans *dst_trans_search(struct dst_node *node, dst_gen_t gen); | ||
| 509 | int dst_trans_remove(struct dst_trans *t); | ||
| 510 | int dst_trans_remove_nolock(struct dst_trans *t); | ||
| 511 | void dst_trans_put(struct dst_trans *t); | ||
| 512 | |||
| 513 | /* | ||
| 514 | * Convert bio into network command. | ||
| 515 | */ | ||
| 516 | static inline void dst_bio_to_cmd(struct bio *bio, struct dst_cmd *cmd, | ||
| 517 | u32 command, u64 id) | ||
| 518 | { | ||
| 519 | cmd->cmd = command; | ||
| 520 | cmd->flags = (bio->bi_flags << BIO_POOL_BITS) >> BIO_POOL_BITS; | ||
| 521 | cmd->rw = bio->bi_rw; | ||
| 522 | cmd->size = bio->bi_size; | ||
| 523 | cmd->csize = 0; | ||
| 524 | cmd->id = id; | ||
| 525 | cmd->sector = bio->bi_sector; | ||
| 526 | }; | ||
| 527 | |||
| 528 | int dst_trans_send(struct dst_trans *t); | ||
| 529 | int dst_trans_crypto(struct dst_trans *t); | ||
| 530 | |||
| 531 | int dst_node_crypto_init(struct dst_node *n, struct dst_crypto_ctl *ctl); | ||
| 532 | void dst_node_crypto_exit(struct dst_node *n); | ||
| 533 | |||
| 534 | static inline int dst_need_crypto(struct dst_node *n) | ||
| 535 | { | ||
| 536 | struct dst_crypto_ctl *c = &n->crypto; | ||
| 537 | /* | ||
| 538 | * Logical OR is appropriate here, but boolean one produces | ||
| 539 | * more optimal code, so it is used instead. | ||
| 540 | */ | ||
| 541 | return (c->hash_algo[0] | c->cipher_algo[0]); | ||
| 542 | } | ||
| 543 | |||
| 544 | int dst_node_trans_init(struct dst_node *n, unsigned int size); | ||
| 545 | void dst_node_trans_exit(struct dst_node *n); | ||
| 546 | |||
| 547 | /* | ||
| 548 | * Pool of threads. | ||
| 549 | * Ready list contains threads currently free to be used, | ||
| 550 | * active one contains threads with some work scheduled for them. | ||
| 551 | * Caller can wait in given queue when thread is ready. | ||
| 552 | */ | ||
| 553 | struct thread_pool | ||
| 554 | { | ||
| 555 | int thread_num; | ||
| 556 | struct mutex thread_lock; | ||
| 557 | struct list_head ready_list, active_list; | ||
| 558 | |||
| 559 | wait_queue_head_t wait; | ||
| 560 | }; | ||
| 561 | |||
| 562 | void thread_pool_del_worker(struct thread_pool *p); | ||
| 563 | void thread_pool_del_worker_id(struct thread_pool *p, unsigned int id); | ||
| 564 | int thread_pool_add_worker(struct thread_pool *p, | ||
| 565 | char *name, | ||
| 566 | unsigned int id, | ||
| 567 | void *(* init)(void *data), | ||
| 568 | void (* cleanup)(void *data), | ||
| 569 | void *data); | ||
| 570 | |||
| 571 | void thread_pool_destroy(struct thread_pool *p); | ||
| 572 | struct thread_pool *thread_pool_create(int num, char *name, | ||
| 573 | void *(* init)(void *data), | ||
| 574 | void (* cleanup)(void *data), | ||
| 575 | void *data); | ||
| 576 | |||
| 577 | int thread_pool_schedule(struct thread_pool *p, | ||
| 578 | int (* setup)(void *stored_private, void *setup_data), | ||
| 579 | int (* action)(void *stored_private, void *setup_data), | ||
| 580 | void *setup_data, long timeout); | ||
| 581 | int thread_pool_schedule_private(struct thread_pool *p, | ||
| 582 | int (* setup)(void *private, void *data), | ||
| 583 | int (* action)(void *private, void *data), | ||
| 584 | void *data, long timeout, void *id); | ||
| 585 | |||
| 586 | #endif /* __KERNEL__ */ | ||
| 587 | #endif /* __DST_H */ | ||
diff --git a/include/linux/dynamic_debug.h b/include/linux/dynamic_debug.h index a0d9422a1569..f8c2e1767500 100644 --- a/include/linux/dynamic_debug.h +++ b/include/linux/dynamic_debug.h | |||
| @@ -57,8 +57,7 @@ extern int ddebug_remove_module(char *mod_name); | |||
| 57 | { KBUILD_MODNAME, __func__, __FILE__, fmt, DEBUG_HASH, \ | 57 | { KBUILD_MODNAME, __func__, __FILE__, fmt, DEBUG_HASH, \ |
| 58 | DEBUG_HASH2, __LINE__, _DPRINTK_FLAGS_DEFAULT }; \ | 58 | DEBUG_HASH2, __LINE__, _DPRINTK_FLAGS_DEFAULT }; \ |
| 59 | if (__dynamic_dbg_enabled(descriptor)) \ | 59 | if (__dynamic_dbg_enabled(descriptor)) \ |
| 60 | printk(KERN_DEBUG KBUILD_MODNAME ":" pr_fmt(fmt), \ | 60 | printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__); \ |
| 61 | ##__VA_ARGS__); \ | ||
| 62 | } while (0) | 61 | } while (0) |
| 63 | 62 | ||
| 64 | 63 | ||
| @@ -69,9 +68,7 @@ extern int ddebug_remove_module(char *mod_name); | |||
| 69 | { KBUILD_MODNAME, __func__, __FILE__, fmt, DEBUG_HASH, \ | 68 | { KBUILD_MODNAME, __func__, __FILE__, fmt, DEBUG_HASH, \ |
| 70 | DEBUG_HASH2, __LINE__, _DPRINTK_FLAGS_DEFAULT }; \ | 69 | DEBUG_HASH2, __LINE__, _DPRINTK_FLAGS_DEFAULT }; \ |
| 71 | if (__dynamic_dbg_enabled(descriptor)) \ | 70 | if (__dynamic_dbg_enabled(descriptor)) \ |
| 72 | dev_printk(KERN_DEBUG, dev, \ | 71 | dev_printk(KERN_DEBUG, dev, fmt, ##__VA_ARGS__); \ |
| 73 | KBUILD_MODNAME ": " fmt, \ | ||
| 74 | ##__VA_ARGS__); \ | ||
| 75 | } while (0) | 72 | } while (0) |
| 76 | 73 | ||
| 77 | #else | 74 | #else |
| @@ -81,8 +78,10 @@ static inline int ddebug_remove_module(char *mod) | |||
| 81 | return 0; | 78 | return 0; |
| 82 | } | 79 | } |
| 83 | 80 | ||
| 84 | #define dynamic_pr_debug(fmt, ...) do { } while (0) | 81 | #define dynamic_pr_debug(fmt, ...) \ |
| 85 | #define dynamic_dev_dbg(dev, format, ...) do { } while (0) | 82 | do { if (0) printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__); } while (0) |
| 83 | #define dynamic_dev_dbg(dev, format, ...) \ | ||
| 84 | do { if (0) dev_printk(KERN_DEBUG, dev, fmt, ##__VA_ARGS__); } while (0) | ||
| 86 | #endif | 85 | #endif |
| 87 | 86 | ||
| 88 | #endif | 87 | #endif |
diff --git a/include/linux/early_res.h b/include/linux/early_res.h new file mode 100644 index 000000000000..29c09f57a13c --- /dev/null +++ b/include/linux/early_res.h | |||
| @@ -0,0 +1,23 @@ | |||
| 1 | #ifndef _LINUX_EARLY_RES_H | ||
| 2 | #define _LINUX_EARLY_RES_H | ||
| 3 | #ifdef __KERNEL__ | ||
| 4 | |||
| 5 | extern void reserve_early(u64 start, u64 end, char *name); | ||
| 6 | extern void reserve_early_overlap_ok(u64 start, u64 end, char *name); | ||
| 7 | extern void free_early(u64 start, u64 end); | ||
| 8 | void free_early_partial(u64 start, u64 end); | ||
| 9 | extern void early_res_to_bootmem(u64 start, u64 end); | ||
| 10 | |||
| 11 | void reserve_early_without_check(u64 start, u64 end, char *name); | ||
| 12 | u64 find_early_area(u64 ei_start, u64 ei_last, u64 start, u64 end, | ||
| 13 | u64 size, u64 align); | ||
| 14 | u64 find_early_area_size(u64 ei_start, u64 ei_last, u64 start, | ||
| 15 | u64 *sizep, u64 align); | ||
| 16 | u64 find_fw_memmap_area(u64 start, u64 end, u64 size, u64 align); | ||
| 17 | u64 get_max_mapped(void); | ||
| 18 | #include <linux/range.h> | ||
| 19 | int get_free_all_memory_range(struct range **rangep, int nodeid); | ||
| 20 | |||
| 21 | #endif /* __KERNEL__ */ | ||
| 22 | |||
| 23 | #endif /* _LINUX_EARLY_RES_H */ | ||
diff --git a/include/linux/efi.h b/include/linux/efi.h index ce4581fbc08b..fb737bc19a8c 100644 --- a/include/linux/efi.h +++ b/include/linux/efi.h | |||
| @@ -280,11 +280,7 @@ efi_guidcmp (efi_guid_t left, efi_guid_t right) | |||
| 280 | static inline char * | 280 | static inline char * |
| 281 | efi_guid_unparse(efi_guid_t *guid, char *out) | 281 | efi_guid_unparse(efi_guid_t *guid, char *out) |
| 282 | { | 282 | { |
| 283 | sprintf(out, "%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x", | 283 | sprintf(out, "%pUl", guid->b); |
| 284 | guid->b[3], guid->b[2], guid->b[1], guid->b[0], | ||
| 285 | guid->b[5], guid->b[4], guid->b[7], guid->b[6], | ||
| 286 | guid->b[8], guid->b[9], guid->b[10], guid->b[11], | ||
| 287 | guid->b[12], guid->b[13], guid->b[14], guid->b[15]); | ||
| 288 | return out; | 284 | return out; |
| 289 | } | 285 | } |
| 290 | 286 | ||
diff --git a/include/linux/elf.h b/include/linux/elf.h index 90a4ed0ea0e5..597858418051 100644 --- a/include/linux/elf.h +++ b/include/linux/elf.h | |||
| @@ -50,6 +50,28 @@ typedef __s64 Elf64_Sxword; | |||
| 50 | 50 | ||
| 51 | #define PT_GNU_STACK (PT_LOOS + 0x474e551) | 51 | #define PT_GNU_STACK (PT_LOOS + 0x474e551) |
| 52 | 52 | ||
| 53 | /* | ||
| 54 | * Extended Numbering | ||
| 55 | * | ||
| 56 | * If the real number of program header table entries is larger than | ||
| 57 | * or equal to PN_XNUM(0xffff), it is set to sh_info field of the | ||
| 58 | * section header at index 0, and PN_XNUM is set to e_phnum | ||
| 59 | * field. Otherwise, the section header at index 0 is zero | ||
| 60 | * initialized, if it exists. | ||
| 61 | * | ||
| 62 | * Specifications are available in: | ||
| 63 | * | ||
| 64 | * - Sun microsystems: Linker and Libraries. | ||
| 65 | * Part No: 817-1984-17, September 2008. | ||
| 66 | * URL: http://docs.sun.com/app/docs/doc/817-1984 | ||
| 67 | * | ||
| 68 | * - System V ABI AMD64 Architecture Processor Supplement | ||
| 69 | * Draft Version 0.99., | ||
| 70 | * May 11, 2009. | ||
| 71 | * URL: http://www.x86-64.org/ | ||
| 72 | */ | ||
| 73 | #define PN_XNUM 0xffff | ||
| 74 | |||
| 53 | /* These constants define the different elf file types */ | 75 | /* These constants define the different elf file types */ |
| 54 | #define ET_NONE 0 | 76 | #define ET_NONE 0 |
| 55 | #define ET_REL 1 | 77 | #define ET_REL 1 |
| @@ -286,7 +308,7 @@ typedef struct elf64_phdr { | |||
| 286 | #define SHN_COMMON 0xfff2 | 308 | #define SHN_COMMON 0xfff2 |
| 287 | #define SHN_HIRESERVE 0xffff | 309 | #define SHN_HIRESERVE 0xffff |
| 288 | 310 | ||
| 289 | typedef struct { | 311 | typedef struct elf32_shdr { |
| 290 | Elf32_Word sh_name; | 312 | Elf32_Word sh_name; |
| 291 | Elf32_Word sh_type; | 313 | Elf32_Word sh_type; |
| 292 | Elf32_Word sh_flags; | 314 | Elf32_Word sh_flags; |
| @@ -349,7 +371,11 @@ typedef struct elf64_shdr { | |||
| 349 | #define ELF_OSABI ELFOSABI_NONE | 371 | #define ELF_OSABI ELFOSABI_NONE |
| 350 | #endif | 372 | #endif |
| 351 | 373 | ||
| 352 | /* Notes used in ET_CORE */ | 374 | /* |
| 375 | * Notes used in ET_CORE. Architectures export some of the arch register sets | ||
| 376 | * using the corresponding note types via the PTRACE_GETREGSET and | ||
| 377 | * PTRACE_SETREGSET requests. | ||
| 378 | */ | ||
| 353 | #define NT_PRSTATUS 1 | 379 | #define NT_PRSTATUS 1 |
| 354 | #define NT_PRFPREG 2 | 380 | #define NT_PRFPREG 2 |
| 355 | #define NT_PRPSINFO 3 | 381 | #define NT_PRPSINFO 3 |
| @@ -361,7 +387,13 @@ typedef struct elf64_shdr { | |||
| 361 | #define NT_PPC_VSX 0x102 /* PowerPC VSX registers */ | 387 | #define NT_PPC_VSX 0x102 /* PowerPC VSX registers */ |
| 362 | #define NT_386_TLS 0x200 /* i386 TLS slots (struct user_desc) */ | 388 | #define NT_386_TLS 0x200 /* i386 TLS slots (struct user_desc) */ |
| 363 | #define NT_386_IOPERM 0x201 /* x86 io permission bitmap (1=deny) */ | 389 | #define NT_386_IOPERM 0x201 /* x86 io permission bitmap (1=deny) */ |
| 364 | #define NT_PRXSTATUS 0x300 /* s390 upper register halves */ | 390 | #define NT_X86_XSTATE 0x202 /* x86 extended state using xsave */ |
| 391 | #define NT_S390_HIGH_GPRS 0x300 /* s390 upper register halves */ | ||
| 392 | #define NT_S390_TIMER 0x301 /* s390 timer register */ | ||
| 393 | #define NT_S390_TODCMP 0x302 /* s390 TOD clock comparator register */ | ||
| 394 | #define NT_S390_TODPREG 0x303 /* s390 TOD programmable register */ | ||
| 395 | #define NT_S390_CTRS 0x304 /* s390 control registers */ | ||
| 396 | #define NT_S390_PREFIX 0x305 /* s390 prefix register */ | ||
| 365 | 397 | ||
| 366 | 398 | ||
| 367 | /* Note header in a PT_NOTE section */ | 399 | /* Note header in a PT_NOTE section */ |
| @@ -384,16 +416,20 @@ typedef struct elf64_note { | |||
| 384 | extern Elf32_Dyn _DYNAMIC []; | 416 | extern Elf32_Dyn _DYNAMIC []; |
| 385 | #define elfhdr elf32_hdr | 417 | #define elfhdr elf32_hdr |
| 386 | #define elf_phdr elf32_phdr | 418 | #define elf_phdr elf32_phdr |
| 419 | #define elf_shdr elf32_shdr | ||
| 387 | #define elf_note elf32_note | 420 | #define elf_note elf32_note |
| 388 | #define elf_addr_t Elf32_Off | 421 | #define elf_addr_t Elf32_Off |
| 422 | #define Elf_Half Elf32_Half | ||
| 389 | 423 | ||
| 390 | #else | 424 | #else |
| 391 | 425 | ||
| 392 | extern Elf64_Dyn _DYNAMIC []; | 426 | extern Elf64_Dyn _DYNAMIC []; |
| 393 | #define elfhdr elf64_hdr | 427 | #define elfhdr elf64_hdr |
| 394 | #define elf_phdr elf64_phdr | 428 | #define elf_phdr elf64_phdr |
| 429 | #define elf_shdr elf64_shdr | ||
| 395 | #define elf_note elf64_note | 430 | #define elf_note elf64_note |
| 396 | #define elf_addr_t Elf64_Off | 431 | #define elf_addr_t Elf64_Off |
| 432 | #define Elf_Half Elf64_Half | ||
| 397 | 433 | ||
| 398 | #endif | 434 | #endif |
| 399 | 435 | ||
diff --git a/include/linux/elfcore.h b/include/linux/elfcore.h index 00d6a68d0421..e687bc3ba4da 100644 --- a/include/linux/elfcore.h +++ b/include/linux/elfcore.h | |||
| @@ -8,6 +8,8 @@ | |||
| 8 | #include <linux/user.h> | 8 | #include <linux/user.h> |
| 9 | #endif | 9 | #endif |
| 10 | #include <linux/ptrace.h> | 10 | #include <linux/ptrace.h> |
| 11 | #include <linux/elf.h> | ||
| 12 | #include <linux/fs.h> | ||
| 11 | 13 | ||
| 12 | struct elf_siginfo | 14 | struct elf_siginfo |
| 13 | { | 15 | { |
| @@ -150,5 +152,20 @@ static inline int elf_core_copy_task_xfpregs(struct task_struct *t, elf_fpxregse | |||
| 150 | 152 | ||
| 151 | #endif /* __KERNEL__ */ | 153 | #endif /* __KERNEL__ */ |
| 152 | 154 | ||
| 155 | /* | ||
| 156 | * These functions parameterize elf_core_dump in fs/binfmt_elf.c to write out | ||
| 157 | * extra segments containing the gate DSO contents. Dumping its | ||
| 158 | * contents makes post-mortem fully interpretable later without matching up | ||
| 159 | * the same kernel and hardware config to see what PC values meant. | ||
| 160 | * Dumping its extra ELF program headers includes all the other information | ||
| 161 | * a debugger needs to easily find how the gate DSO was being used. | ||
| 162 | */ | ||
| 163 | extern Elf_Half elf_core_extra_phdrs(void); | ||
| 164 | extern int | ||
| 165 | elf_core_write_extra_phdrs(struct file *file, loff_t offset, size_t *size, | ||
| 166 | unsigned long limit); | ||
| 167 | extern int | ||
| 168 | elf_core_write_extra_data(struct file *file, size_t *size, unsigned long limit); | ||
| 169 | extern size_t elf_core_extra_data_size(void); | ||
| 153 | 170 | ||
| 154 | #endif /* _LINUX_ELFCORE_H */ | 171 | #endif /* _LINUX_ELFCORE_H */ |
diff --git a/include/linux/enclosure.h b/include/linux/enclosure.h index 90d1c2184112..9a33c5f7e126 100644 --- a/include/linux/enclosure.h +++ b/include/linux/enclosure.h | |||
| @@ -42,6 +42,8 @@ enum enclosure_status { | |||
| 42 | ENCLOSURE_STATUS_NOT_INSTALLED, | 42 | ENCLOSURE_STATUS_NOT_INSTALLED, |
| 43 | ENCLOSURE_STATUS_UNKNOWN, | 43 | ENCLOSURE_STATUS_UNKNOWN, |
| 44 | ENCLOSURE_STATUS_UNAVAILABLE, | 44 | ENCLOSURE_STATUS_UNAVAILABLE, |
| 45 | /* last element for counting purposes */ | ||
| 46 | ENCLOSURE_STATUS_MAX | ||
| 45 | }; | 47 | }; |
| 46 | 48 | ||
| 47 | /* SFF-8485 activity light settings */ | 49 | /* SFF-8485 activity light settings */ |
diff --git a/include/linux/err.h b/include/linux/err.h index ec87f3142bf3..1b12642636c7 100644 --- a/include/linux/err.h +++ b/include/linux/err.h | |||
| @@ -34,6 +34,11 @@ static inline long IS_ERR(const void *ptr) | |||
| 34 | return IS_ERR_VALUE((unsigned long)ptr); | 34 | return IS_ERR_VALUE((unsigned long)ptr); |
| 35 | } | 35 | } |
| 36 | 36 | ||
| 37 | static inline long IS_ERR_OR_NULL(const void *ptr) | ||
| 38 | { | ||
| 39 | return !ptr || IS_ERR_VALUE((unsigned long)ptr); | ||
| 40 | } | ||
| 41 | |||
| 37 | /** | 42 | /** |
| 38 | * ERR_CAST - Explicitly cast an error-valued pointer to another pointer type | 43 | * ERR_CAST - Explicitly cast an error-valued pointer to another pointer type |
| 39 | * @ptr: The pointer to cast. | 44 | * @ptr: The pointer to cast. |
diff --git a/include/linux/errqueue.h b/include/linux/errqueue.h index ec12cc74366f..034072cea853 100644 --- a/include/linux/errqueue.h +++ b/include/linux/errqueue.h | |||
| @@ -3,8 +3,7 @@ | |||
| 3 | 3 | ||
| 4 | #include <linux/types.h> | 4 | #include <linux/types.h> |
| 5 | 5 | ||
| 6 | struct sock_extended_err | 6 | struct sock_extended_err { |
| 7 | { | ||
| 8 | __u32 ee_errno; | 7 | __u32 ee_errno; |
| 9 | __u8 ee_origin; | 8 | __u8 ee_origin; |
| 10 | __u8 ee_type; | 9 | __u8 ee_type; |
| @@ -31,8 +30,7 @@ struct sock_extended_err | |||
| 31 | 30 | ||
| 32 | #define SKB_EXT_ERR(skb) ((struct sock_exterr_skb *) ((skb)->cb)) | 31 | #define SKB_EXT_ERR(skb) ((struct sock_exterr_skb *) ((skb)->cb)) |
| 33 | 32 | ||
| 34 | struct sock_exterr_skb | 33 | struct sock_exterr_skb { |
| 35 | { | ||
| 36 | union { | 34 | union { |
| 37 | struct inet_skb_parm h4; | 35 | struct inet_skb_parm h4; |
| 38 | #if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE) | 36 | #if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE) |
diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h index 15e4eb713694..b33f316bb92e 100644 --- a/include/linux/ethtool.h +++ b/include/linux/ethtool.h | |||
| @@ -49,17 +49,25 @@ static inline __u32 ethtool_cmd_speed(struct ethtool_cmd *ep) | |||
| 49 | return (ep->speed_hi << 16) | ep->speed; | 49 | return (ep->speed_hi << 16) | ep->speed; |
| 50 | } | 50 | } |
| 51 | 51 | ||
| 52 | #define ETHTOOL_FWVERS_LEN 32 | ||
| 52 | #define ETHTOOL_BUSINFO_LEN 32 | 53 | #define ETHTOOL_BUSINFO_LEN 32 |
| 53 | /* these strings are set to whatever the driver author decides... */ | 54 | /* these strings are set to whatever the driver author decides... */ |
| 54 | struct ethtool_drvinfo { | 55 | struct ethtool_drvinfo { |
| 55 | __u32 cmd; | 56 | __u32 cmd; |
| 56 | char driver[32]; /* driver short name, "tulip", "eepro100" */ | 57 | char driver[32]; /* driver short name, "tulip", "eepro100" */ |
| 57 | char version[32]; /* driver version string */ | 58 | char version[32]; /* driver version string */ |
| 58 | char fw_version[32]; /* firmware version string, if applicable */ | 59 | char fw_version[ETHTOOL_FWVERS_LEN]; /* firmware version string */ |
| 59 | char bus_info[ETHTOOL_BUSINFO_LEN]; /* Bus info for this IF. */ | 60 | char bus_info[ETHTOOL_BUSINFO_LEN]; /* Bus info for this IF. */ |
| 60 | /* For PCI devices, use pci_name(pci_dev). */ | 61 | /* For PCI devices, use pci_name(pci_dev). */ |
| 61 | char reserved1[32]; | 62 | char reserved1[32]; |
| 62 | char reserved2[12]; | 63 | char reserved2[12]; |
| 64 | /* | ||
| 65 | * Some struct members below are filled in | ||
| 66 | * using ops->get_sset_count(). Obtaining | ||
| 67 | * this info from ethtool_drvinfo is now | ||
| 68 | * deprecated; Use ETHTOOL_GSSET_INFO | ||
| 69 | * instead. | ||
| 70 | */ | ||
| 63 | __u32 n_priv_flags; /* number of flags valid in ETHTOOL_GPFLAGS */ | 71 | __u32 n_priv_flags; /* number of flags valid in ETHTOOL_GPFLAGS */ |
| 64 | __u32 n_stats; /* number of u64's from ETHTOOL_GSTATS */ | 72 | __u32 n_stats; /* number of u64's from ETHTOOL_GSTATS */ |
| 65 | __u32 testinfo_len; | 73 | __u32 testinfo_len; |
| @@ -241,6 +249,7 @@ enum ethtool_stringset { | |||
| 241 | ETH_SS_TEST = 0, | 249 | ETH_SS_TEST = 0, |
| 242 | ETH_SS_STATS, | 250 | ETH_SS_STATS, |
| 243 | ETH_SS_PRIV_FLAGS, | 251 | ETH_SS_PRIV_FLAGS, |
| 252 | ETH_SS_NTUPLE_FILTERS, | ||
| 244 | }; | 253 | }; |
| 245 | 254 | ||
| 246 | /* for passing string sets for data tagging */ | 255 | /* for passing string sets for data tagging */ |
| @@ -251,6 +260,17 @@ struct ethtool_gstrings { | |||
| 251 | __u8 data[0]; | 260 | __u8 data[0]; |
| 252 | }; | 261 | }; |
| 253 | 262 | ||
| 263 | struct ethtool_sset_info { | ||
| 264 | __u32 cmd; /* ETHTOOL_GSSET_INFO */ | ||
| 265 | __u32 reserved; | ||
| 266 | __u64 sset_mask; /* input: each bit selects an sset to query */ | ||
| 267 | /* output: each bit a returned sset */ | ||
| 268 | __u32 data[0]; /* ETH_SS_xxx count, in order, based on bits | ||
| 269 | in sset_mask. One bit implies one | ||
| 270 | __u32, two bits implies two | ||
| 271 | __u32's, etc. */ | ||
| 272 | }; | ||
| 273 | |||
| 254 | enum ethtool_test_flags { | 274 | enum ethtool_test_flags { |
| 255 | ETH_TEST_FL_OFFLINE = (1 << 0), /* online / offline */ | 275 | ETH_TEST_FL_OFFLINE = (1 << 0), /* online / offline */ |
| 256 | ETH_TEST_FL_FAILED = (1 << 1), /* test passed / failed */ | 276 | ETH_TEST_FL_FAILED = (1 << 1), /* test passed / failed */ |
| @@ -289,6 +309,7 @@ struct ethtool_perm_addr { | |||
| 289 | */ | 309 | */ |
| 290 | enum ethtool_flags { | 310 | enum ethtool_flags { |
| 291 | ETH_FLAG_LRO = (1 << 15), /* LRO is enabled */ | 311 | ETH_FLAG_LRO = (1 << 15), /* LRO is enabled */ |
| 312 | ETH_FLAG_NTUPLE = (1 << 27), /* N-tuple filters enabled */ | ||
| 292 | }; | 313 | }; |
| 293 | 314 | ||
| 294 | /* The following structures are for supporting RX network flow | 315 | /* The following structures are for supporting RX network flow |
| @@ -362,6 +383,35 @@ struct ethtool_rxnfc { | |||
| 362 | __u32 rule_locs[0]; | 383 | __u32 rule_locs[0]; |
| 363 | }; | 384 | }; |
| 364 | 385 | ||
| 386 | struct ethtool_rx_ntuple_flow_spec { | ||
| 387 | __u32 flow_type; | ||
| 388 | union { | ||
| 389 | struct ethtool_tcpip4_spec tcp_ip4_spec; | ||
| 390 | struct ethtool_tcpip4_spec udp_ip4_spec; | ||
| 391 | struct ethtool_tcpip4_spec sctp_ip4_spec; | ||
| 392 | struct ethtool_ah_espip4_spec ah_ip4_spec; | ||
| 393 | struct ethtool_ah_espip4_spec esp_ip4_spec; | ||
| 394 | struct ethtool_rawip4_spec raw_ip4_spec; | ||
| 395 | struct ethtool_ether_spec ether_spec; | ||
| 396 | struct ethtool_usrip4_spec usr_ip4_spec; | ||
| 397 | __u8 hdata[64]; | ||
| 398 | } h_u, m_u; /* entry, mask */ | ||
| 399 | |||
| 400 | __u16 vlan_tag; | ||
| 401 | __u16 vlan_tag_mask; | ||
| 402 | __u64 data; /* user-defined flow spec data */ | ||
| 403 | __u64 data_mask; /* user-defined flow spec mask */ | ||
| 404 | |||
| 405 | /* signed to distinguish between queue and actions (DROP) */ | ||
| 406 | __s32 action; | ||
| 407 | #define ETHTOOL_RXNTUPLE_ACTION_DROP -1 | ||
| 408 | }; | ||
| 409 | |||
| 410 | struct ethtool_rx_ntuple { | ||
| 411 | __u32 cmd; | ||
| 412 | struct ethtool_rx_ntuple_flow_spec fs; | ||
| 413 | }; | ||
| 414 | |||
| 365 | #define ETHTOOL_FLASH_MAX_FILENAME 128 | 415 | #define ETHTOOL_FLASH_MAX_FILENAME 128 |
| 366 | enum ethtool_flash_op_type { | 416 | enum ethtool_flash_op_type { |
| 367 | ETHTOOL_FLASH_ALL_REGIONS = 0, | 417 | ETHTOOL_FLASH_ALL_REGIONS = 0, |
| @@ -376,6 +426,20 @@ struct ethtool_flash { | |||
| 376 | 426 | ||
| 377 | #ifdef __KERNEL__ | 427 | #ifdef __KERNEL__ |
| 378 | 428 | ||
| 429 | #include <linux/rculist.h> | ||
| 430 | |||
| 431 | struct ethtool_rx_ntuple_flow_spec_container { | ||
| 432 | struct ethtool_rx_ntuple_flow_spec fs; | ||
| 433 | struct list_head list; | ||
| 434 | }; | ||
| 435 | |||
| 436 | struct ethtool_rx_ntuple_list { | ||
| 437 | #define ETHTOOL_MAX_NTUPLE_LIST_ENTRY 1024 | ||
| 438 | #define ETHTOOL_MAX_NTUPLE_STRING_PER_ENTRY 14 | ||
| 439 | struct list_head list; | ||
| 440 | unsigned int count; | ||
| 441 | }; | ||
| 442 | |||
| 379 | struct net_device; | 443 | struct net_device; |
| 380 | 444 | ||
| 381 | /* Some generic methods drivers may use in their ethtool_ops */ | 445 | /* Some generic methods drivers may use in their ethtool_ops */ |
| @@ -393,6 +457,7 @@ u32 ethtool_op_get_ufo(struct net_device *dev); | |||
| 393 | int ethtool_op_set_ufo(struct net_device *dev, u32 data); | 457 | int ethtool_op_set_ufo(struct net_device *dev, u32 data); |
| 394 | u32 ethtool_op_get_flags(struct net_device *dev); | 458 | u32 ethtool_op_get_flags(struct net_device *dev); |
| 395 | int ethtool_op_set_flags(struct net_device *dev, u32 data); | 459 | int ethtool_op_set_flags(struct net_device *dev, u32 data); |
| 460 | void ethtool_ntuple_flush(struct net_device *dev); | ||
| 396 | 461 | ||
| 397 | /** | 462 | /** |
| 398 | * ðtool_ops - Alter and report network device settings | 463 | * ðtool_ops - Alter and report network device settings |
| @@ -495,13 +560,12 @@ struct ethtool_ops { | |||
| 495 | u32 (*get_priv_flags)(struct net_device *); | 560 | u32 (*get_priv_flags)(struct net_device *); |
| 496 | int (*set_priv_flags)(struct net_device *, u32); | 561 | int (*set_priv_flags)(struct net_device *, u32); |
| 497 | int (*get_sset_count)(struct net_device *, int); | 562 | int (*get_sset_count)(struct net_device *, int); |
| 498 | |||
| 499 | /* the following hooks are obsolete */ | ||
| 500 | int (*self_test_count)(struct net_device *);/* use get_sset_count */ | ||
| 501 | int (*get_stats_count)(struct net_device *);/* use get_sset_count */ | ||
| 502 | int (*get_rxnfc)(struct net_device *, struct ethtool_rxnfc *, void *); | 563 | int (*get_rxnfc)(struct net_device *, struct ethtool_rxnfc *, void *); |
| 503 | int (*set_rxnfc)(struct net_device *, struct ethtool_rxnfc *); | 564 | int (*set_rxnfc)(struct net_device *, struct ethtool_rxnfc *); |
| 504 | int (*flash_device)(struct net_device *, struct ethtool_flash *); | 565 | int (*flash_device)(struct net_device *, struct ethtool_flash *); |
| 566 | int (*reset)(struct net_device *, u32 *); | ||
| 567 | int (*set_rx_ntuple)(struct net_device *, struct ethtool_rx_ntuple *); | ||
| 568 | int (*get_rx_ntuple)(struct net_device *, u32 stringset, void *); | ||
| 505 | }; | 569 | }; |
| 506 | #endif /* __KERNEL__ */ | 570 | #endif /* __KERNEL__ */ |
| 507 | 571 | ||
| @@ -559,6 +623,10 @@ struct ethtool_ops { | |||
| 559 | #define ETHTOOL_SRXCLSRLDEL 0x00000031 /* Delete RX classification rule */ | 623 | #define ETHTOOL_SRXCLSRLDEL 0x00000031 /* Delete RX classification rule */ |
| 560 | #define ETHTOOL_SRXCLSRLINS 0x00000032 /* Insert RX classification rule */ | 624 | #define ETHTOOL_SRXCLSRLINS 0x00000032 /* Insert RX classification rule */ |
| 561 | #define ETHTOOL_FLASHDEV 0x00000033 /* Flash firmware to device */ | 625 | #define ETHTOOL_FLASHDEV 0x00000033 /* Flash firmware to device */ |
| 626 | #define ETHTOOL_RESET 0x00000034 /* Reset hardware */ | ||
| 627 | #define ETHTOOL_SRXNTUPLE 0x00000035 /* Add an n-tuple filter to device */ | ||
| 628 | #define ETHTOOL_GRXNTUPLE 0x00000036 /* Get n-tuple filters from device */ | ||
| 629 | #define ETHTOOL_GSSET_INFO 0x00000037 /* Get string set info */ | ||
| 562 | 630 | ||
| 563 | /* compatibility with older code */ | 631 | /* compatibility with older code */ |
| 564 | #define SPARC_ETH_GSET ETHTOOL_GSET | 632 | #define SPARC_ETH_GSET ETHTOOL_GSET |
| @@ -633,6 +701,8 @@ struct ethtool_ops { | |||
| 633 | #define PORT_MII 0x02 | 701 | #define PORT_MII 0x02 |
| 634 | #define PORT_FIBRE 0x03 | 702 | #define PORT_FIBRE 0x03 |
| 635 | #define PORT_BNC 0x04 | 703 | #define PORT_BNC 0x04 |
| 704 | #define PORT_DA 0x05 | ||
| 705 | #define PORT_NONE 0xef | ||
| 636 | #define PORT_OTHER 0xff | 706 | #define PORT_OTHER 0xff |
| 637 | 707 | ||
| 638 | /* Which transceiver to use. */ | 708 | /* Which transceiver to use. */ |
| @@ -676,6 +746,8 @@ struct ethtool_ops { | |||
| 676 | #define AH_V6_FLOW 0x0b | 746 | #define AH_V6_FLOW 0x0b |
| 677 | #define ESP_V6_FLOW 0x0c | 747 | #define ESP_V6_FLOW 0x0c |
| 678 | #define IP_USER_FLOW 0x0d | 748 | #define IP_USER_FLOW 0x0d |
| 749 | #define IPV4_FLOW 0x10 | ||
| 750 | #define IPV6_FLOW 0x11 | ||
| 679 | 751 | ||
| 680 | /* L3-L4 network traffic flow hash options */ | 752 | /* L3-L4 network traffic flow hash options */ |
| 681 | #define RXH_L2DA (1 << 1) | 753 | #define RXH_L2DA (1 << 1) |
| @@ -689,4 +761,34 @@ struct ethtool_ops { | |||
| 689 | 761 | ||
| 690 | #define RX_CLS_FLOW_DISC 0xffffffffffffffffULL | 762 | #define RX_CLS_FLOW_DISC 0xffffffffffffffffULL |
| 691 | 763 | ||
| 764 | /* Reset flags */ | ||
| 765 | /* The reset() operation must clear the flags for the components which | ||
| 766 | * were actually reset. On successful return, the flags indicate the | ||
| 767 | * components which were not reset, either because they do not exist | ||
| 768 | * in the hardware or because they cannot be reset independently. The | ||
| 769 | * driver must never reset any components that were not requested. | ||
| 770 | */ | ||
| 771 | enum ethtool_reset_flags { | ||
| 772 | /* These flags represent components dedicated to the interface | ||
| 773 | * the command is addressed to. Shift any flag left by | ||
| 774 | * ETH_RESET_SHARED_SHIFT to reset a shared component of the | ||
| 775 | * same type. | ||
| 776 | */ | ||
| 777 | ETH_RESET_MGMT = 1 << 0, /* Management processor */ | ||
| 778 | ETH_RESET_IRQ = 1 << 1, /* Interrupt requester */ | ||
| 779 | ETH_RESET_DMA = 1 << 2, /* DMA engine */ | ||
| 780 | ETH_RESET_FILTER = 1 << 3, /* Filtering/flow direction */ | ||
| 781 | ETH_RESET_OFFLOAD = 1 << 4, /* Protocol offload */ | ||
| 782 | ETH_RESET_MAC = 1 << 5, /* Media access controller */ | ||
| 783 | ETH_RESET_PHY = 1 << 6, /* Transceiver/PHY */ | ||
| 784 | ETH_RESET_RAM = 1 << 7, /* RAM shared between | ||
| 785 | * multiple components */ | ||
| 786 | |||
| 787 | ETH_RESET_DEDICATED = 0x0000ffff, /* All components dedicated to | ||
| 788 | * this interface */ | ||
| 789 | ETH_RESET_ALL = 0xffffffff, /* All components used by this | ||
| 790 | * interface, even if shared */ | ||
| 791 | }; | ||
| 792 | #define ETH_RESET_SHARED_SHIFT 16 | ||
| 793 | |||
| 692 | #endif /* _LINUX_ETHTOOL_H */ | 794 | #endif /* _LINUX_ETHTOOL_H */ |
diff --git a/include/linux/eventfd.h b/include/linux/eventfd.h index 94dd10366a78..91bb4f27238c 100644 --- a/include/linux/eventfd.h +++ b/include/linux/eventfd.h | |||
| @@ -10,6 +10,7 @@ | |||
| 10 | 10 | ||
| 11 | #include <linux/fcntl.h> | 11 | #include <linux/fcntl.h> |
| 12 | #include <linux/file.h> | 12 | #include <linux/file.h> |
| 13 | #include <linux/wait.h> | ||
| 13 | 14 | ||
| 14 | /* | 15 | /* |
| 15 | * CAREFUL: Check include/asm-generic/fcntl.h when defining | 16 | * CAREFUL: Check include/asm-generic/fcntl.h when defining |
| @@ -34,6 +35,9 @@ struct file *eventfd_fget(int fd); | |||
| 34 | struct eventfd_ctx *eventfd_ctx_fdget(int fd); | 35 | struct eventfd_ctx *eventfd_ctx_fdget(int fd); |
| 35 | struct eventfd_ctx *eventfd_ctx_fileget(struct file *file); | 36 | struct eventfd_ctx *eventfd_ctx_fileget(struct file *file); |
| 36 | int eventfd_signal(struct eventfd_ctx *ctx, int n); | 37 | int eventfd_signal(struct eventfd_ctx *ctx, int n); |
| 38 | ssize_t eventfd_ctx_read(struct eventfd_ctx *ctx, int no_wait, __u64 *cnt); | ||
| 39 | int eventfd_ctx_remove_wait_queue(struct eventfd_ctx *ctx, wait_queue_t *wait, | ||
| 40 | __u64 *cnt); | ||
| 37 | 41 | ||
| 38 | #else /* CONFIG_EVENTFD */ | 42 | #else /* CONFIG_EVENTFD */ |
| 39 | 43 | ||
| @@ -61,6 +65,18 @@ static inline void eventfd_ctx_put(struct eventfd_ctx *ctx) | |||
| 61 | 65 | ||
| 62 | } | 66 | } |
| 63 | 67 | ||
| 68 | static inline ssize_t eventfd_ctx_read(struct eventfd_ctx *ctx, int no_wait, | ||
| 69 | __u64 *cnt) | ||
| 70 | { | ||
| 71 | return -ENOSYS; | ||
| 72 | } | ||
| 73 | |||
| 74 | static inline int eventfd_ctx_remove_wait_queue(struct eventfd_ctx *ctx, | ||
| 75 | wait_queue_t *wait, __u64 *cnt) | ||
| 76 | { | ||
| 77 | return -ENOSYS; | ||
| 78 | } | ||
| 79 | |||
| 64 | #endif | 80 | #endif |
| 65 | 81 | ||
| 66 | #endif /* _LINUX_EVENTFD_H */ | 82 | #endif /* _LINUX_EVENTFD_H */ |
diff --git a/include/linux/exportfs.h b/include/linux/exportfs.h index 27e772cefb6a..a9cd507f8cd2 100644 --- a/include/linux/exportfs.h +++ b/include/linux/exportfs.h | |||
| @@ -96,8 +96,9 @@ struct fid { | |||
| 96 | * @fh_to_parent: find the implied object's parent and get a dentry for it | 96 | * @fh_to_parent: find the implied object's parent and get a dentry for it |
| 97 | * @get_name: find the name for a given inode in a given directory | 97 | * @get_name: find the name for a given inode in a given directory |
| 98 | * @get_parent: find the parent of a given directory | 98 | * @get_parent: find the parent of a given directory |
| 99 | * @commit_metadata: commit metadata changes to stable storage | ||
| 99 | * | 100 | * |
| 100 | * See Documentation/filesystems/Exporting for details on how to use | 101 | * See Documentation/filesystems/nfs/Exporting for details on how to use |
| 101 | * this interface correctly. | 102 | * this interface correctly. |
| 102 | * | 103 | * |
| 103 | * encode_fh: | 104 | * encode_fh: |
| @@ -137,6 +138,9 @@ struct fid { | |||
| 137 | * is also a directory. In the event that it cannot be found, or storage | 138 | * is also a directory. In the event that it cannot be found, or storage |
| 138 | * space cannot be allocated, a %ERR_PTR should be returned. | 139 | * space cannot be allocated, a %ERR_PTR should be returned. |
| 139 | * | 140 | * |
| 141 | * commit_metadata: | ||
| 142 | * @commit_metadata should commit metadata changes to stable storage. | ||
| 143 | * | ||
| 140 | * Locking rules: | 144 | * Locking rules: |
| 141 | * get_parent is called with child->d_inode->i_mutex down | 145 | * get_parent is called with child->d_inode->i_mutex down |
| 142 | * get_name is not (which is possibly inconsistent) | 146 | * get_name is not (which is possibly inconsistent) |
| @@ -152,6 +156,7 @@ struct export_operations { | |||
| 152 | int (*get_name)(struct dentry *parent, char *name, | 156 | int (*get_name)(struct dentry *parent, char *name, |
| 153 | struct dentry *child); | 157 | struct dentry *child); |
| 154 | struct dentry * (*get_parent)(struct dentry *child); | 158 | struct dentry * (*get_parent)(struct dentry *child); |
| 159 | int (*commit_metadata)(struct inode *inode); | ||
| 155 | }; | 160 | }; |
| 156 | 161 | ||
| 157 | extern int exportfs_encode_fh(struct dentry *dentry, struct fid *fid, | 162 | extern int exportfs_encode_fh(struct dentry *dentry, struct fid *fid, |
diff --git a/include/linux/ext2_fs.h b/include/linux/ext2_fs.h index 121720d74e15..2dfa7076e8b6 100644 --- a/include/linux/ext2_fs.h +++ b/include/linux/ext2_fs.h | |||
| @@ -565,14 +565,14 @@ struct ext2_dir_entry_2 { | |||
| 565 | * other bits are reserved for now. | 565 | * other bits are reserved for now. |
| 566 | */ | 566 | */ |
| 567 | enum { | 567 | enum { |
| 568 | EXT2_FT_UNKNOWN, | 568 | EXT2_FT_UNKNOWN = 0, |
| 569 | EXT2_FT_REG_FILE, | 569 | EXT2_FT_REG_FILE = 1, |
| 570 | EXT2_FT_DIR, | 570 | EXT2_FT_DIR = 2, |
| 571 | EXT2_FT_CHRDEV, | 571 | EXT2_FT_CHRDEV = 3, |
| 572 | EXT2_FT_BLKDEV, | 572 | EXT2_FT_BLKDEV = 4, |
| 573 | EXT2_FT_FIFO, | 573 | EXT2_FT_FIFO = 5, |
| 574 | EXT2_FT_SOCK, | 574 | EXT2_FT_SOCK = 6, |
| 575 | EXT2_FT_SYMLINK, | 575 | EXT2_FT_SYMLINK = 7, |
| 576 | EXT2_FT_MAX | 576 | EXT2_FT_MAX |
| 577 | }; | 577 | }; |
| 578 | 578 | ||
diff --git a/include/linux/ext3_fs.h b/include/linux/ext3_fs.h index 7499b3667798..5f494b465097 100644 --- a/include/linux/ext3_fs.h +++ b/include/linux/ext3_fs.h | |||
| @@ -202,14 +202,6 @@ static inline __u32 ext3_mask_flags(umode_t mode, __u32 flags) | |||
| 202 | return flags & EXT3_OTHER_FLMASK; | 202 | return flags & EXT3_OTHER_FLMASK; |
| 203 | } | 203 | } |
| 204 | 204 | ||
| 205 | /* | ||
| 206 | * Inode dynamic state flags | ||
| 207 | */ | ||
| 208 | #define EXT3_STATE_JDATA 0x00000001 /* journaled data exists */ | ||
| 209 | #define EXT3_STATE_NEW 0x00000002 /* inode is newly created */ | ||
| 210 | #define EXT3_STATE_XATTR 0x00000004 /* has in-inode xattrs */ | ||
| 211 | #define EXT3_STATE_FLUSH_ON_CLOSE 0x00000008 | ||
| 212 | |||
| 213 | /* Used to pass group descriptor data when online resize is done */ | 205 | /* Used to pass group descriptor data when online resize is done */ |
| 214 | struct ext3_new_group_input { | 206 | struct ext3_new_group_input { |
| 215 | __u32 group; /* Group number for this data */ | 207 | __u32 group; /* Group number for this data */ |
| @@ -560,6 +552,31 @@ static inline int ext3_valid_inum(struct super_block *sb, unsigned long ino) | |||
| 560 | (ino >= EXT3_FIRST_INO(sb) && | 552 | (ino >= EXT3_FIRST_INO(sb) && |
| 561 | ino <= le32_to_cpu(EXT3_SB(sb)->s_es->s_inodes_count)); | 553 | ino <= le32_to_cpu(EXT3_SB(sb)->s_es->s_inodes_count)); |
| 562 | } | 554 | } |
| 555 | |||
| 556 | /* | ||
| 557 | * Inode dynamic state flags | ||
| 558 | */ | ||
| 559 | enum { | ||
| 560 | EXT3_STATE_JDATA, /* journaled data exists */ | ||
| 561 | EXT3_STATE_NEW, /* inode is newly created */ | ||
| 562 | EXT3_STATE_XATTR, /* has in-inode xattrs */ | ||
| 563 | EXT3_STATE_FLUSH_ON_CLOSE, /* flush dirty pages on close */ | ||
| 564 | }; | ||
| 565 | |||
| 566 | static inline int ext3_test_inode_state(struct inode *inode, int bit) | ||
| 567 | { | ||
| 568 | return test_bit(bit, &EXT3_I(inode)->i_state_flags); | ||
| 569 | } | ||
| 570 | |||
| 571 | static inline void ext3_set_inode_state(struct inode *inode, int bit) | ||
| 572 | { | ||
| 573 | set_bit(bit, &EXT3_I(inode)->i_state_flags); | ||
| 574 | } | ||
| 575 | |||
| 576 | static inline void ext3_clear_inode_state(struct inode *inode, int bit) | ||
| 577 | { | ||
| 578 | clear_bit(bit, &EXT3_I(inode)->i_state_flags); | ||
| 579 | } | ||
| 563 | #else | 580 | #else |
| 564 | /* Assume that user mode programs are passing in an ext3fs superblock, not | 581 | /* Assume that user mode programs are passing in an ext3fs superblock, not |
| 565 | * a kernel struct super_block. This will allow us to call the feature-test | 582 | * a kernel struct super_block. This will allow us to call the feature-test |
| @@ -877,7 +894,7 @@ int ext3_get_blocks_handle(handle_t *handle, struct inode *inode, | |||
| 877 | int create); | 894 | int create); |
| 878 | 895 | ||
| 879 | extern struct inode *ext3_iget(struct super_block *, unsigned long); | 896 | extern struct inode *ext3_iget(struct super_block *, unsigned long); |
| 880 | extern int ext3_write_inode (struct inode *, int); | 897 | extern int ext3_write_inode (struct inode *, struct writeback_control *); |
| 881 | extern int ext3_setattr (struct dentry *, struct iattr *); | 898 | extern int ext3_setattr (struct dentry *, struct iattr *); |
| 882 | extern void ext3_delete_inode (struct inode *); | 899 | extern void ext3_delete_inode (struct inode *); |
| 883 | extern int ext3_sync_inode (handle_t *, struct inode *); | 900 | extern int ext3_sync_inode (handle_t *, struct inode *); |
| @@ -918,6 +935,8 @@ extern void ext3_abort (struct super_block *, const char *, const char *, ...) | |||
| 918 | __attribute__ ((format (printf, 3, 4))); | 935 | __attribute__ ((format (printf, 3, 4))); |
| 919 | extern void ext3_warning (struct super_block *, const char *, const char *, ...) | 936 | extern void ext3_warning (struct super_block *, const char *, const char *, ...) |
| 920 | __attribute__ ((format (printf, 3, 4))); | 937 | __attribute__ ((format (printf, 3, 4))); |
| 938 | extern void ext3_msg(struct super_block *, const char *, const char *, ...) | ||
| 939 | __attribute__ ((format (printf, 3, 4))); | ||
| 921 | extern void ext3_update_dynamic_rev (struct super_block *sb); | 940 | extern void ext3_update_dynamic_rev (struct super_block *sb); |
| 922 | 941 | ||
| 923 | #define ext3_std_error(sb, errno) \ | 942 | #define ext3_std_error(sb, errno) \ |
diff --git a/include/linux/ext3_fs_i.h b/include/linux/ext3_fs_i.h index 93e7428156ba..f42c098aed8d 100644 --- a/include/linux/ext3_fs_i.h +++ b/include/linux/ext3_fs_i.h | |||
| @@ -87,7 +87,7 @@ struct ext3_inode_info { | |||
| 87 | * near to their parent directory's inode. | 87 | * near to their parent directory's inode. |
| 88 | */ | 88 | */ |
| 89 | __u32 i_block_group; | 89 | __u32 i_block_group; |
| 90 | __u32 i_state; /* Dynamic state flags for ext3 */ | 90 | unsigned long i_state_flags; /* Dynamic state flags for ext3 */ |
| 91 | 91 | ||
| 92 | /* block reservation info */ | 92 | /* block reservation info */ |
| 93 | struct ext3_block_alloc_info *i_block_alloc_info; | 93 | struct ext3_block_alloc_info *i_block_alloc_info; |
diff --git a/include/linux/ext3_fs_sb.h b/include/linux/ext3_fs_sb.h index f07f34de2f0e..258088ab3c6b 100644 --- a/include/linux/ext3_fs_sb.h +++ b/include/linux/ext3_fs_sb.h | |||
| @@ -72,6 +72,8 @@ struct ext3_sb_info { | |||
| 72 | struct inode * s_journal_inode; | 72 | struct inode * s_journal_inode; |
| 73 | struct journal_s * s_journal; | 73 | struct journal_s * s_journal; |
| 74 | struct list_head s_orphan; | 74 | struct list_head s_orphan; |
| 75 | struct mutex s_orphan_lock; | ||
| 76 | struct mutex s_resize_lock; | ||
| 75 | unsigned long s_commit_interval; | 77 | unsigned long s_commit_interval; |
| 76 | struct block_device *journal_bdev; | 78 | struct block_device *journal_bdev; |
| 77 | #ifdef CONFIG_JBD_DEBUG | 79 | #ifdef CONFIG_JBD_DEBUG |
diff --git a/include/linux/ext3_jbd.h b/include/linux/ext3_jbd.h index cf82d519be40..d7b5ddca99c2 100644 --- a/include/linux/ext3_jbd.h +++ b/include/linux/ext3_jbd.h | |||
| @@ -44,13 +44,13 @@ | |||
| 44 | 44 | ||
| 45 | #define EXT3_DATA_TRANS_BLOCKS(sb) (EXT3_SINGLEDATA_TRANS_BLOCKS + \ | 45 | #define EXT3_DATA_TRANS_BLOCKS(sb) (EXT3_SINGLEDATA_TRANS_BLOCKS + \ |
| 46 | EXT3_XATTR_TRANS_BLOCKS - 2 + \ | 46 | EXT3_XATTR_TRANS_BLOCKS - 2 + \ |
| 47 | 2*EXT3_QUOTA_TRANS_BLOCKS(sb)) | 47 | EXT3_MAXQUOTAS_TRANS_BLOCKS(sb)) |
| 48 | 48 | ||
| 49 | /* Delete operations potentially hit one directory's namespace plus an | 49 | /* Delete operations potentially hit one directory's namespace plus an |
| 50 | * entire inode, plus arbitrary amounts of bitmap/indirection data. Be | 50 | * entire inode, plus arbitrary amounts of bitmap/indirection data. Be |
| 51 | * generous. We can grow the delete transaction later if necessary. */ | 51 | * generous. We can grow the delete transaction later if necessary. */ |
| 52 | 52 | ||
| 53 | #define EXT3_DELETE_TRANS_BLOCKS(sb) (2 * EXT3_DATA_TRANS_BLOCKS(sb) + 64) | 53 | #define EXT3_DELETE_TRANS_BLOCKS(sb) (EXT3_MAXQUOTAS_TRANS_BLOCKS(sb) + 64) |
| 54 | 54 | ||
| 55 | /* Define an arbitrary limit for the amount of data we will anticipate | 55 | /* Define an arbitrary limit for the amount of data we will anticipate |
| 56 | * writing to any given transaction. For unbounded transactions such as | 56 | * writing to any given transaction. For unbounded transactions such as |
| @@ -86,6 +86,9 @@ | |||
| 86 | #define EXT3_QUOTA_INIT_BLOCKS(sb) 0 | 86 | #define EXT3_QUOTA_INIT_BLOCKS(sb) 0 |
| 87 | #define EXT3_QUOTA_DEL_BLOCKS(sb) 0 | 87 | #define EXT3_QUOTA_DEL_BLOCKS(sb) 0 |
| 88 | #endif | 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)) | ||
| 89 | 92 | ||
| 90 | int | 93 | int |
| 91 | ext3_mark_iloc_dirty(handle_t *handle, | 94 | ext3_mark_iloc_dirty(handle_t *handle, |
diff --git a/include/linux/fault-inject.h b/include/linux/fault-inject.h index 06ca9b21dad2..7b64ad40e4ce 100644 --- a/include/linux/fault-inject.h +++ b/include/linux/fault-inject.h | |||
| @@ -82,9 +82,10 @@ static inline void cleanup_fault_attr_dentries(struct fault_attr *attr) | |||
| 82 | #endif /* CONFIG_FAULT_INJECTION */ | 82 | #endif /* CONFIG_FAULT_INJECTION */ |
| 83 | 83 | ||
| 84 | #ifdef CONFIG_FAILSLAB | 84 | #ifdef CONFIG_FAILSLAB |
| 85 | extern bool should_failslab(size_t size, gfp_t gfpflags); | 85 | extern bool should_failslab(size_t size, gfp_t gfpflags, unsigned long flags); |
| 86 | #else | 86 | #else |
| 87 | static inline bool should_failslab(size_t size, gfp_t gfpflags) | 87 | static inline bool should_failslab(size_t size, gfp_t gfpflags, |
| 88 | unsigned long flags) | ||
| 88 | { | 89 | { |
| 89 | return false; | 90 | return false; |
| 90 | } | 91 | } |
diff --git a/include/linux/fb.h b/include/linux/fb.h index de9c722e7b90..c10163b4c40e 100644 --- a/include/linux/fb.h +++ b/include/linux/fb.h | |||
| @@ -543,6 +543,8 @@ struct fb_cursor_user { | |||
| 543 | #define FB_EVENT_GET_REQ 0x0D | 543 | #define FB_EVENT_GET_REQ 0x0D |
| 544 | /* Unbind from the console if possible */ | 544 | /* Unbind from the console if possible */ |
| 545 | #define FB_EVENT_FB_UNBIND 0x0E | 545 | #define FB_EVENT_FB_UNBIND 0x0E |
| 546 | /* CONSOLE-SPECIFIC: remap all consoles to new fb - for vga switcheroo */ | ||
| 547 | #define FB_EVENT_REMAP_ALL_CONSOLE 0x0F | ||
| 546 | 548 | ||
| 547 | struct fb_event { | 549 | struct fb_event { |
| 548 | struct fb_info *info; | 550 | struct fb_info *info; |
| @@ -763,6 +765,7 @@ struct fb_tile_ops { | |||
| 763 | * takes over; acceleration engine should be in a quiescent state */ | 765 | * takes over; acceleration engine should be in a quiescent state */ |
| 764 | 766 | ||
| 765 | /* hints */ | 767 | /* hints */ |
| 768 | #define FBINFO_VIRTFB 0x0004 /* FB is System RAM, not device. */ | ||
| 766 | #define FBINFO_PARTIAL_PAN_OK 0x0040 /* otw use pan only for double-buffering */ | 769 | #define FBINFO_PARTIAL_PAN_OK 0x0040 /* otw use pan only for double-buffering */ |
| 767 | #define FBINFO_READS_FAST 0x0080 /* soft-copy faster than rendering */ | 770 | #define FBINFO_READS_FAST 0x0080 /* soft-copy faster than rendering */ |
| 768 | 771 | ||
diff --git a/include/linux/fdtable.h b/include/linux/fdtable.h index a2ec74bc4812..013dc529e95f 100644 --- a/include/linux/fdtable.h +++ b/include/linux/fdtable.h | |||
| @@ -57,7 +57,14 @@ struct files_struct { | |||
| 57 | struct file * fd_array[NR_OPEN_DEFAULT]; | 57 | struct file * fd_array[NR_OPEN_DEFAULT]; |
| 58 | }; | 58 | }; |
| 59 | 59 | ||
| 60 | #define files_fdtable(files) (rcu_dereference((files)->fdt)) | 60 | #define rcu_dereference_check_fdtable(files, fdtfd) \ |
| 61 | (rcu_dereference_check((fdtfd), \ | ||
| 62 | rcu_read_lock_held() || \ | ||
| 63 | lockdep_is_held(&(files)->file_lock) || \ | ||
| 64 | atomic_read(&(files)->count) == 1)) | ||
| 65 | |||
| 66 | #define files_fdtable(files) \ | ||
| 67 | (rcu_dereference_check_fdtable((files), (files)->fdt)) | ||
| 61 | 68 | ||
| 62 | struct file_operations; | 69 | struct file_operations; |
| 63 | struct vfsmount; | 70 | struct vfsmount; |
| @@ -78,7 +85,7 @@ static inline struct file * fcheck_files(struct files_struct *files, unsigned in | |||
| 78 | struct fdtable *fdt = files_fdtable(files); | 85 | struct fdtable *fdt = files_fdtable(files); |
| 79 | 86 | ||
| 80 | if (fd < fdt->max_fds) | 87 | if (fd < fdt->max_fds) |
| 81 | file = rcu_dereference(fdt->fd[fd]); | 88 | file = rcu_dereference_check_fdtable(files, fdt->fd[fd]); |
| 82 | return file; | 89 | return file; |
| 83 | } | 90 | } |
| 84 | 91 | ||
diff --git a/include/linux/fib_rules.h b/include/linux/fib_rules.h index 87b606b63f1e..51da65b68b85 100644 --- a/include/linux/fib_rules.h +++ b/include/linux/fib_rules.h | |||
| @@ -8,13 +8,14 @@ | |||
| 8 | #define FIB_RULE_PERMANENT 0x00000001 | 8 | #define FIB_RULE_PERMANENT 0x00000001 |
| 9 | #define FIB_RULE_INVERT 0x00000002 | 9 | #define FIB_RULE_INVERT 0x00000002 |
| 10 | #define FIB_RULE_UNRESOLVED 0x00000004 | 10 | #define FIB_RULE_UNRESOLVED 0x00000004 |
| 11 | #define FIB_RULE_DEV_DETACHED 0x00000008 | 11 | #define FIB_RULE_IIF_DETACHED 0x00000008 |
| 12 | #define FIB_RULE_DEV_DETACHED FIB_RULE_IIF_DETACHED | ||
| 13 | #define FIB_RULE_OIF_DETACHED 0x00000010 | ||
| 12 | 14 | ||
| 13 | /* try to find source address in routing lookups */ | 15 | /* try to find source address in routing lookups */ |
| 14 | #define FIB_RULE_FIND_SADDR 0x00010000 | 16 | #define FIB_RULE_FIND_SADDR 0x00010000 |
| 15 | 17 | ||
| 16 | struct fib_rule_hdr | 18 | struct fib_rule_hdr { |
| 17 | { | ||
| 18 | __u8 family; | 19 | __u8 family; |
| 19 | __u8 dst_len; | 20 | __u8 dst_len; |
| 20 | __u8 src_len; | 21 | __u8 src_len; |
| @@ -28,12 +29,12 @@ struct fib_rule_hdr | |||
| 28 | __u32 flags; | 29 | __u32 flags; |
| 29 | }; | 30 | }; |
| 30 | 31 | ||
| 31 | enum | 32 | enum { |
| 32 | { | ||
| 33 | FRA_UNSPEC, | 33 | FRA_UNSPEC, |
| 34 | FRA_DST, /* destination address */ | 34 | FRA_DST, /* destination address */ |
| 35 | FRA_SRC, /* source address */ | 35 | FRA_SRC, /* source address */ |
| 36 | FRA_IFNAME, /* interface name */ | 36 | FRA_IIFNAME, /* interface name */ |
| 37 | #define FRA_IFNAME FRA_IIFNAME | ||
| 37 | FRA_GOTO, /* target to jump to (FR_ACT_GOTO) */ | 38 | FRA_GOTO, /* target to jump to (FR_ACT_GOTO) */ |
| 38 | FRA_UNUSED2, | 39 | FRA_UNUSED2, |
| 39 | FRA_PRIORITY, /* priority/preference */ | 40 | FRA_PRIORITY, /* priority/preference */ |
| @@ -47,13 +48,13 @@ enum | |||
| 47 | FRA_UNUSED8, | 48 | FRA_UNUSED8, |
| 48 | FRA_TABLE, /* Extended table id */ | 49 | FRA_TABLE, /* Extended table id */ |
| 49 | FRA_FWMASK, /* mask for netfilter mark */ | 50 | FRA_FWMASK, /* mask for netfilter mark */ |
| 51 | FRA_OIFNAME, | ||
| 50 | __FRA_MAX | 52 | __FRA_MAX |
| 51 | }; | 53 | }; |
| 52 | 54 | ||
| 53 | #define FRA_MAX (__FRA_MAX - 1) | 55 | #define FRA_MAX (__FRA_MAX - 1) |
| 54 | 56 | ||
| 55 | enum | 57 | enum { |
| 56 | { | ||
| 57 | FR_ACT_UNSPEC, | 58 | FR_ACT_UNSPEC, |
| 58 | FR_ACT_TO_TBL, /* Pass to fixed table */ | 59 | FR_ACT_TO_TBL, /* Pass to fixed table */ |
| 59 | FR_ACT_GOTO, /* Jump to another rule */ | 60 | FR_ACT_GOTO, /* Jump to another rule */ |
diff --git a/include/linux/fiemap.h b/include/linux/fiemap.h index 934e22d65801..d830747f5c0b 100644 --- a/include/linux/fiemap.h +++ b/include/linux/fiemap.h | |||
| @@ -62,5 +62,7 @@ struct fiemap { | |||
| 62 | #define FIEMAP_EXTENT_MERGED 0x00001000 /* File does not natively | 62 | #define FIEMAP_EXTENT_MERGED 0x00001000 /* File does not natively |
| 63 | * support extents. Result | 63 | * support extents. Result |
| 64 | * merged for efficiency. */ | 64 | * merged for efficiency. */ |
| 65 | #define FIEMAP_EXTENT_SHARED 0x00002000 /* Space shared with other | ||
| 66 | * files. */ | ||
| 65 | 67 | ||
| 66 | #endif /* _LINUX_FIEMAP_H */ | 68 | #endif /* _LINUX_FIEMAP_H */ |
diff --git a/include/linux/file.h b/include/linux/file.h index 335a0a5c316e..5555508fd517 100644 --- a/include/linux/file.h +++ b/include/linux/file.h | |||
| @@ -18,11 +18,9 @@ extern void drop_file_write_access(struct file *file); | |||
| 18 | struct file_operations; | 18 | struct file_operations; |
| 19 | struct vfsmount; | 19 | struct vfsmount; |
| 20 | struct dentry; | 20 | struct dentry; |
| 21 | extern int init_file(struct file *, struct vfsmount *mnt, | 21 | struct path; |
| 22 | struct dentry *dentry, fmode_t mode, | 22 | extern struct file *alloc_file(struct path *, fmode_t mode, |
| 23 | const struct file_operations *fop); | 23 | const struct file_operations *fop); |
| 24 | extern struct file *alloc_file(struct vfsmount *, struct dentry *dentry, | ||
| 25 | fmode_t mode, const struct file_operations *fop); | ||
| 26 | 24 | ||
| 27 | static inline void fput_light(struct file *file, int fput_needed) | 25 | static inline void fput_light(struct file *file, int fput_needed) |
| 28 | { | 26 | { |
diff --git a/include/linux/filter.h b/include/linux/filter.h index 1354aaf6abbe..29a0e3db9f43 100644 --- a/include/linux/filter.h +++ b/include/linux/filter.h | |||
| @@ -23,16 +23,14 @@ | |||
| 23 | * the BPF code definitions which need to match so you can share filters | 23 | * the BPF code definitions which need to match so you can share filters |
| 24 | */ | 24 | */ |
| 25 | 25 | ||
| 26 | struct sock_filter /* Filter block */ | 26 | struct sock_filter { /* Filter block */ |
| 27 | { | ||
| 28 | __u16 code; /* Actual filter code */ | 27 | __u16 code; /* Actual filter code */ |
| 29 | __u8 jt; /* Jump true */ | 28 | __u8 jt; /* Jump true */ |
| 30 | __u8 jf; /* Jump false */ | 29 | __u8 jf; /* Jump false */ |
| 31 | __u32 k; /* Generic multiuse field */ | 30 | __u32 k; /* Generic multiuse field */ |
| 32 | }; | 31 | }; |
| 33 | 32 | ||
| 34 | struct sock_fprog /* Required for SO_ATTACH_FILTER. */ | 33 | struct sock_fprog { /* Required for SO_ATTACH_FILTER. */ |
| 35 | { | ||
| 36 | unsigned short len; /* Number of filter blocks */ | 34 | unsigned short len; /* Number of filter blocks */ |
| 37 | struct sock_filter __user *filter; | 35 | struct sock_filter __user *filter; |
| 38 | }; | 36 | }; |
| @@ -123,7 +121,9 @@ struct sock_fprog /* Required for SO_ATTACH_FILTER. */ | |||
| 123 | #define SKF_AD_IFINDEX 8 | 121 | #define SKF_AD_IFINDEX 8 |
| 124 | #define SKF_AD_NLATTR 12 | 122 | #define SKF_AD_NLATTR 12 |
| 125 | #define SKF_AD_NLATTR_NEST 16 | 123 | #define SKF_AD_NLATTR_NEST 16 |
| 126 | #define SKF_AD_MAX 20 | 124 | #define SKF_AD_MARK 20 |
| 125 | #define SKF_AD_QUEUE 24 | ||
| 126 | #define SKF_AD_MAX 28 | ||
| 127 | #define SKF_NET_OFF (-0x100000) | 127 | #define SKF_NET_OFF (-0x100000) |
| 128 | #define SKF_LL_OFF (-0x200000) | 128 | #define SKF_LL_OFF (-0x200000) |
| 129 | 129 | ||
diff --git a/include/linux/firewire-cdev.h b/include/linux/firewire-cdev.h index c6b3ca3af6df..68f883b30a53 100644 --- a/include/linux/firewire-cdev.h +++ b/include/linux/firewire-cdev.h | |||
| @@ -1,21 +1,26 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * Char device interface. | 2 | * Char device interface. |
| 3 | * | 3 | * |
| 4 | * Copyright (C) 2005-2006 Kristian Hoegsberg <krh@bitplanet.net> | 4 | * Copyright (C) 2005-2007 Kristian Hoegsberg <krh@bitplanet.net> |
| 5 | * | 5 | * |
| 6 | * This program is free software; you can redistribute it and/or modify | 6 | * Permission is hereby granted, free of charge, to any person obtaining a |
| 7 | * it under the terms of the GNU General Public License as published by | 7 | * copy of this software and associated documentation files (the "Software"), |
| 8 | * the Free Software Foundation; either version 2 of the License, or | 8 | * to deal in the Software without restriction, including without limitation |
| 9 | * (at your option) any later version. | 9 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, |
| 10 | * | 10 | * and/or sell copies of the Software, and to permit persons to whom the |
| 11 | * This program is distributed in the hope that it will be useful, | 11 | * Software is furnished to do so, subject to the following conditions: |
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 12 | * |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 13 | * The above copyright notice and this permission notice (including the next |
| 14 | * GNU General Public License for more details. | 14 | * paragraph) shall be included in all copies or substantial portions of the |
| 15 | * | 15 | * Software. |
| 16 | * You should have received a copy of the GNU General Public License | 16 | * |
| 17 | * along with this program; if not, write to the Free Software Foundation, | 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 18 | * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 19 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | ||
| 20 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR | ||
| 21 | * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, | ||
| 22 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | ||
| 23 | * DEALINGS IN THE SOFTWARE. | ||
| 19 | */ | 24 | */ |
| 20 | 25 | ||
| 21 | #ifndef _LINUX_FIREWIRE_CDEV_H | 26 | #ifndef _LINUX_FIREWIRE_CDEV_H |
| @@ -248,13 +253,20 @@ union fw_cdev_event { | |||
| 248 | #define FW_CDEV_IOC_SEND_BROADCAST_REQUEST _IOW('#', 0x12, struct fw_cdev_send_request) | 253 | #define FW_CDEV_IOC_SEND_BROADCAST_REQUEST _IOW('#', 0x12, struct fw_cdev_send_request) |
| 249 | #define FW_CDEV_IOC_SEND_STREAM_PACKET _IOW('#', 0x13, struct fw_cdev_send_stream_packet) | 254 | #define FW_CDEV_IOC_SEND_STREAM_PACKET _IOW('#', 0x13, struct fw_cdev_send_stream_packet) |
| 250 | 255 | ||
| 256 | /* available since kernel version 2.6.34 */ | ||
| 257 | #define FW_CDEV_IOC_GET_CYCLE_TIMER2 _IOWR('#', 0x14, struct fw_cdev_get_cycle_timer2) | ||
| 258 | |||
| 251 | /* | 259 | /* |
| 252 | * FW_CDEV_VERSION History | 260 | * FW_CDEV_VERSION History |
| 253 | * 1 (2.6.22) - initial version | 261 | * 1 (2.6.22) - initial version |
| 254 | * 2 (2.6.30) - changed &fw_cdev_event_iso_interrupt.header if | 262 | * 2 (2.6.30) - changed &fw_cdev_event_iso_interrupt.header if |
| 255 | * &fw_cdev_create_iso_context.header_size is 8 or more | 263 | * &fw_cdev_create_iso_context.header_size is 8 or more |
| 264 | * (2.6.32) - added time stamp to xmit &fw_cdev_event_iso_interrupt | ||
| 265 | * (2.6.33) - IR has always packet-per-buffer semantics now, not one of | ||
| 266 | * dual-buffer or packet-per-buffer depending on hardware | ||
| 267 | * 3 (2.6.34) - made &fw_cdev_get_cycle_timer reliable | ||
| 256 | */ | 268 | */ |
| 257 | #define FW_CDEV_VERSION 2 | 269 | #define FW_CDEV_VERSION 3 |
| 258 | 270 | ||
| 259 | /** | 271 | /** |
| 260 | * struct fw_cdev_get_info - General purpose information ioctl | 272 | * struct fw_cdev_get_info - General purpose information ioctl |
| @@ -340,6 +352,9 @@ struct fw_cdev_send_response { | |||
| 340 | * The @closure field is passed back to userspace in the response event. | 352 | * The @closure field is passed back to userspace in the response event. |
| 341 | * The @handle field is an out parameter, returning a handle to the allocated | 353 | * The @handle field is an out parameter, returning a handle to the allocated |
| 342 | * range to be used for later deallocation of the range. | 354 | * range to be used for later deallocation of the range. |
| 355 | * | ||
| 356 | * The address range is allocated on all local nodes. The address allocation | ||
| 357 | * is exclusive except for the FCP command and response registers. | ||
| 343 | */ | 358 | */ |
| 344 | struct fw_cdev_allocate { | 359 | struct fw_cdev_allocate { |
| 345 | __u64 offset; | 360 | __u64 offset; |
| @@ -377,7 +392,7 @@ struct fw_cdev_initiate_bus_reset { | |||
| 377 | * @immediate: If non-zero, immediate key to insert before pointer | 392 | * @immediate: If non-zero, immediate key to insert before pointer |
| 378 | * @key: Upper 8 bits of root directory pointer | 393 | * @key: Upper 8 bits of root directory pointer |
| 379 | * @data: Userspace pointer to contents of descriptor block | 394 | * @data: Userspace pointer to contents of descriptor block |
| 380 | * @length: Length of descriptor block data, in bytes | 395 | * @length: Length of descriptor block data, in quadlets |
| 381 | * @handle: Handle to the descriptor, written by the kernel | 396 | * @handle: Handle to the descriptor, written by the kernel |
| 382 | * | 397 | * |
| 383 | * Add a descriptor block and optionally a preceding immediate key to the local | 398 | * Add a descriptor block and optionally a preceding immediate key to the local |
| @@ -391,6 +406,8 @@ struct fw_cdev_initiate_bus_reset { | |||
| 391 | * If not 0, the @immediate field specifies an immediate key which will be | 406 | * If not 0, the @immediate field specifies an immediate key which will be |
| 392 | * inserted before the root directory pointer. | 407 | * inserted before the root directory pointer. |
| 393 | * | 408 | * |
| 409 | * @immediate, @key, and @data array elements are CPU-endian quadlets. | ||
| 410 | * | ||
| 394 | * If successful, the kernel adds the descriptor and writes back a handle to the | 411 | * If successful, the kernel adds the descriptor and writes back a handle to the |
| 395 | * kernel-side object to be used for later removal of the descriptor block and | 412 | * kernel-side object to be used for later removal of the descriptor block and |
| 396 | * immediate key. | 413 | * immediate key. |
| @@ -426,7 +443,7 @@ struct fw_cdev_remove_descriptor { | |||
| 426 | * @type: %FW_CDEV_ISO_CONTEXT_TRANSMIT or %FW_CDEV_ISO_CONTEXT_RECEIVE | 443 | * @type: %FW_CDEV_ISO_CONTEXT_TRANSMIT or %FW_CDEV_ISO_CONTEXT_RECEIVE |
| 427 | * @header_size: Header size to strip for receive contexts | 444 | * @header_size: Header size to strip for receive contexts |
| 428 | * @channel: Channel to bind to | 445 | * @channel: Channel to bind to |
| 429 | * @speed: Speed to transmit at | 446 | * @speed: Speed for transmit contexts |
| 430 | * @closure: To be returned in &fw_cdev_event_iso_interrupt | 447 | * @closure: To be returned in &fw_cdev_event_iso_interrupt |
| 431 | * @handle: Handle to context, written back by kernel | 448 | * @handle: Handle to context, written back by kernel |
| 432 | * | 449 | * |
| @@ -439,6 +456,9 @@ struct fw_cdev_remove_descriptor { | |||
| 439 | * If a context was successfully created, the kernel writes back a handle to the | 456 | * If a context was successfully created, the kernel writes back a handle to the |
| 440 | * context, which must be passed in for subsequent operations on that context. | 457 | * context, which must be passed in for subsequent operations on that context. |
| 441 | * | 458 | * |
| 459 | * For receive contexts, @header_size must be at least 4 and must be a multiple | ||
| 460 | * of 4. | ||
| 461 | * | ||
| 442 | * Note that the effect of a @header_size > 4 depends on | 462 | * Note that the effect of a @header_size > 4 depends on |
| 443 | * &fw_cdev_get_info.version, as documented at &fw_cdev_event_iso_interrupt. | 463 | * &fw_cdev_get_info.version, as documented at &fw_cdev_event_iso_interrupt. |
| 444 | */ | 464 | */ |
| @@ -469,10 +489,34 @@ struct fw_cdev_create_iso_context { | |||
| 469 | * | 489 | * |
| 470 | * &struct fw_cdev_iso_packet is used to describe isochronous packet queues. | 490 | * &struct fw_cdev_iso_packet is used to describe isochronous packet queues. |
| 471 | * | 491 | * |
| 472 | * Use the FW_CDEV_ISO_ macros to fill in @control. The sy and tag fields are | 492 | * Use the FW_CDEV_ISO_ macros to fill in @control. |
| 473 | * specified by IEEE 1394a and IEC 61883. | 493 | * |
| 474 | * | 494 | * For transmit packets, the header length must be a multiple of 4 and specifies |
| 475 | * FIXME - finish this documentation | 495 | * the numbers of bytes in @header that will be prepended to the packet's |
| 496 | * payload; these bytes are copied into the kernel and will not be accessed | ||
| 497 | * after the ioctl has returned. The sy and tag fields are copied to the iso | ||
| 498 | * packet header (these fields are specified by IEEE 1394a and IEC 61883-1). | ||
| 499 | * The skip flag specifies that no packet is to be sent in a frame; when using | ||
| 500 | * this, all other fields except the interrupt flag must be zero. | ||
| 501 | * | ||
| 502 | * For receive packets, the header length must be a multiple of the context's | ||
| 503 | * header size; if the header length is larger than the context's header size, | ||
| 504 | * multiple packets are queued for this entry. The sy and tag fields are | ||
| 505 | * ignored. If the sync flag is set, the context drops all packets until | ||
| 506 | * a packet with a matching sy field is received (the sync value to wait for is | ||
| 507 | * specified in the &fw_cdev_start_iso structure). The payload length defines | ||
| 508 | * how many payload bytes can be received for one packet (in addition to payload | ||
| 509 | * quadlets that have been defined as headers and are stripped and returned in | ||
| 510 | * the &fw_cdev_event_iso_interrupt structure). If more bytes are received, the | ||
| 511 | * additional bytes are dropped. If less bytes are received, the remaining | ||
| 512 | * bytes in this part of the payload buffer will not be written to, not even by | ||
| 513 | * the next packet, i.e., packets received in consecutive frames will not | ||
| 514 | * necessarily be consecutive in memory. If an entry has queued multiple | ||
| 515 | * packets, the payload length is divided equally among them. | ||
| 516 | * | ||
| 517 | * When a packet with the interrupt flag set has been completed, the | ||
| 518 | * &fw_cdev_event_iso_interrupt event will be sent. An entry that has queued | ||
| 519 | * multiple receive packets is completed when its last packet is completed. | ||
| 476 | */ | 520 | */ |
| 477 | struct fw_cdev_iso_packet { | 521 | struct fw_cdev_iso_packet { |
| 478 | __u32 control; | 522 | __u32 control; |
| @@ -489,7 +533,7 @@ struct fw_cdev_iso_packet { | |||
| 489 | * Queue a number of isochronous packets for reception or transmission. | 533 | * Queue a number of isochronous packets for reception or transmission. |
| 490 | * This ioctl takes a pointer to an array of &fw_cdev_iso_packet structs, | 534 | * This ioctl takes a pointer to an array of &fw_cdev_iso_packet structs, |
| 491 | * which describe how to transmit from or receive into a contiguous region | 535 | * which describe how to transmit from or receive into a contiguous region |
| 492 | * of a mmap()'ed payload buffer. As part of the packet descriptors, | 536 | * of a mmap()'ed payload buffer. As part of transmit packet descriptors, |
| 493 | * a series of headers can be supplied, which will be prepended to the | 537 | * a series of headers can be supplied, which will be prepended to the |
| 494 | * payload during DMA. | 538 | * payload during DMA. |
| 495 | * | 539 | * |
| @@ -539,14 +583,18 @@ struct fw_cdev_stop_iso { | |||
| 539 | /** | 583 | /** |
| 540 | * struct fw_cdev_get_cycle_timer - read cycle timer register | 584 | * struct fw_cdev_get_cycle_timer - read cycle timer register |
| 541 | * @local_time: system time, in microseconds since the Epoch | 585 | * @local_time: system time, in microseconds since the Epoch |
| 542 | * @cycle_timer: isochronous cycle timer, as per OHCI 1.1 clause 5.13 | 586 | * @cycle_timer: Cycle Time register contents |
| 543 | * | 587 | * |
| 544 | * The %FW_CDEV_IOC_GET_CYCLE_TIMER ioctl reads the isochronous cycle timer | 588 | * The %FW_CDEV_IOC_GET_CYCLE_TIMER ioctl reads the isochronous cycle timer |
| 545 | * and also the system clock. This allows to express the receive time of an | 589 | * and also the system clock (%CLOCK_REALTIME). This allows to express the |
| 546 | * isochronous packet as a system time with microsecond accuracy. | 590 | * receive time of an isochronous packet as a system time. |
| 547 | * | 591 | * |
| 548 | * @cycle_timer consists of 7 bits cycleSeconds, 13 bits cycleCount, and | 592 | * @cycle_timer consists of 7 bits cycleSeconds, 13 bits cycleCount, and |
| 549 | * 12 bits cycleOffset, in host byte order. | 593 | * 12 bits cycleOffset, in host byte order. Cf. the Cycle Time register |
| 594 | * per IEEE 1394 or Isochronous Cycle Timer register per OHCI-1394. | ||
| 595 | * | ||
| 596 | * In version 1 and 2 of the ABI, this ioctl returned unreliable (non- | ||
| 597 | * monotonic) @cycle_timer values on certain controllers. | ||
| 550 | */ | 598 | */ |
| 551 | struct fw_cdev_get_cycle_timer { | 599 | struct fw_cdev_get_cycle_timer { |
| 552 | __u64 local_time; | 600 | __u64 local_time; |
| @@ -554,6 +602,25 @@ struct fw_cdev_get_cycle_timer { | |||
| 554 | }; | 602 | }; |
| 555 | 603 | ||
| 556 | /** | 604 | /** |
| 605 | * struct fw_cdev_get_cycle_timer2 - read cycle timer register | ||
| 606 | * @tv_sec: system time, seconds | ||
| 607 | * @tv_nsec: system time, sub-seconds part in nanoseconds | ||
| 608 | * @clk_id: input parameter, clock from which to get the system time | ||
| 609 | * @cycle_timer: Cycle Time register contents | ||
| 610 | * | ||
| 611 | * The %FW_CDEV_IOC_GET_CYCLE_TIMER2 works like | ||
| 612 | * %FW_CDEV_IOC_GET_CYCLE_TIMER but lets you choose a clock like with POSIX' | ||
| 613 | * clock_gettime function. Supported @clk_id values are POSIX' %CLOCK_REALTIME | ||
| 614 | * and %CLOCK_MONOTONIC and Linux' %CLOCK_MONOTONIC_RAW. | ||
| 615 | */ | ||
| 616 | struct fw_cdev_get_cycle_timer2 { | ||
| 617 | __s64 tv_sec; | ||
| 618 | __s32 tv_nsec; | ||
| 619 | __s32 clk_id; | ||
| 620 | __u32 cycle_timer; | ||
| 621 | }; | ||
| 622 | |||
| 623 | /** | ||
| 557 | * struct fw_cdev_allocate_iso_resource - (De)allocate a channel or bandwidth | 624 | * struct fw_cdev_allocate_iso_resource - (De)allocate a channel or bandwidth |
| 558 | * @closure: Passed back to userspace in correponding iso resource events | 625 | * @closure: Passed back to userspace in correponding iso resource events |
| 559 | * @channels: Isochronous channels of which one is to be (de)allocated | 626 | * @channels: Isochronous channels of which one is to be (de)allocated |
| @@ -585,8 +652,8 @@ struct fw_cdev_get_cycle_timer { | |||
| 585 | * instead of allocated. | 652 | * instead of allocated. |
| 586 | * An %FW_CDEV_EVENT_ISO_RESOURCE_DEALLOCATED event concludes this operation. | 653 | * An %FW_CDEV_EVENT_ISO_RESOURCE_DEALLOCATED event concludes this operation. |
| 587 | * | 654 | * |
| 588 | * To summarize, %FW_CDEV_IOC_DEALLOCATE_ISO_RESOURCE allocates iso resources | 655 | * To summarize, %FW_CDEV_IOC_ALLOCATE_ISO_RESOURCE allocates iso resources |
| 589 | * for the lifetime of the fd or handle. | 656 | * for the lifetime of the fd or @handle. |
| 590 | * In contrast, %FW_CDEV_IOC_ALLOCATE_ISO_RESOURCE_ONCE allocates iso resources | 657 | * In contrast, %FW_CDEV_IOC_ALLOCATE_ISO_RESOURCE_ONCE allocates iso resources |
| 591 | * for the duration of a bus generation. | 658 | * for the duration of a bus generation. |
| 592 | * | 659 | * |
diff --git a/include/linux/firewire-constants.h b/include/linux/firewire-constants.h index b316770a43fd..9b4bb5fbba4b 100644 --- a/include/linux/firewire-constants.h +++ b/include/linux/firewire-constants.h | |||
| @@ -1,3 +1,28 @@ | |||
| 1 | /* | ||
| 2 | * IEEE 1394 constants. | ||
| 3 | * | ||
| 4 | * Copyright (C) 2005-2007 Kristian Hoegsberg <krh@bitplanet.net> | ||
| 5 | * | ||
| 6 | * Permission is hereby granted, free of charge, to any person obtaining a | ||
| 7 | * copy of this software and associated documentation files (the "Software"), | ||
| 8 | * to deal in the Software without restriction, including without limitation | ||
| 9 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||
| 10 | * and/or sell copies of the Software, and to permit persons to whom the | ||
| 11 | * Software is furnished to do so, subject to the following conditions: | ||
| 12 | * | ||
| 13 | * The above copyright notice and this permission notice (including the next | ||
| 14 | * paragraph) shall be included in all copies or substantial portions of the | ||
| 15 | * Software. | ||
| 16 | * | ||
| 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| 18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
| 19 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | ||
| 20 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR | ||
| 21 | * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, | ||
| 22 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | ||
| 23 | * DEALINGS IN THE SOFTWARE. | ||
| 24 | */ | ||
| 25 | |||
| 1 | #ifndef _LINUX_FIREWIRE_CONSTANTS_H | 26 | #ifndef _LINUX_FIREWIRE_CONSTANTS_H |
| 2 | #define _LINUX_FIREWIRE_CONSTANTS_H | 27 | #define _LINUX_FIREWIRE_CONSTANTS_H |
| 3 | 28 | ||
| @@ -21,7 +46,7 @@ | |||
| 21 | #define EXTCODE_WRAP_ADD 0x6 | 46 | #define EXTCODE_WRAP_ADD 0x6 |
| 22 | #define EXTCODE_VENDOR_DEPENDENT 0x7 | 47 | #define EXTCODE_VENDOR_DEPENDENT 0x7 |
| 23 | 48 | ||
| 24 | /* Juju specific tcodes */ | 49 | /* Linux firewire-core (Juju) specific tcodes */ |
| 25 | #define TCODE_LOCK_MASK_SWAP (0x10 | EXTCODE_MASK_SWAP) | 50 | #define TCODE_LOCK_MASK_SWAP (0x10 | EXTCODE_MASK_SWAP) |
| 26 | #define TCODE_LOCK_COMPARE_SWAP (0x10 | EXTCODE_COMPARE_SWAP) | 51 | #define TCODE_LOCK_COMPARE_SWAP (0x10 | EXTCODE_COMPARE_SWAP) |
| 27 | #define TCODE_LOCK_FETCH_ADD (0x10 | EXTCODE_FETCH_ADD) | 52 | #define TCODE_LOCK_FETCH_ADD (0x10 | EXTCODE_FETCH_ADD) |
| @@ -36,7 +61,7 @@ | |||
| 36 | #define RCODE_TYPE_ERROR 0x6 | 61 | #define RCODE_TYPE_ERROR 0x6 |
| 37 | #define RCODE_ADDRESS_ERROR 0x7 | 62 | #define RCODE_ADDRESS_ERROR 0x7 |
| 38 | 63 | ||
| 39 | /* Juju specific rcodes */ | 64 | /* Linux firewire-core (Juju) specific rcodes */ |
| 40 | #define RCODE_SEND_ERROR 0x10 | 65 | #define RCODE_SEND_ERROR 0x10 |
| 41 | #define RCODE_CANCELLED 0x11 | 66 | #define RCODE_CANCELLED 0x11 |
| 42 | #define RCODE_BUSY 0x12 | 67 | #define RCODE_BUSY 0x12 |
diff --git a/include/linux/firewire.h b/include/linux/firewire.h index 7e1d4dec83e7..4bd94bf5e739 100644 --- a/include/linux/firewire.h +++ b/include/linux/firewire.h | |||
| @@ -20,20 +20,6 @@ | |||
| 20 | #define fw_notify(s, args...) printk(KERN_NOTICE KBUILD_MODNAME ": " s, ## args) | 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) | 21 | #define fw_error(s, args...) printk(KERN_ERR KBUILD_MODNAME ": " s, ## args) |
| 22 | 22 | ||
| 23 | static inline void fw_memcpy_from_be32(void *_dst, void *_src, size_t size) | ||
| 24 | { | ||
| 25 | u32 *dst = _dst; | ||
| 26 | __be32 *src = _src; | ||
| 27 | int i; | ||
| 28 | |||
| 29 | for (i = 0; i < size / 4; i++) | ||
| 30 | dst[i] = be32_to_cpu(src[i]); | ||
| 31 | } | ||
| 32 | |||
| 33 | static inline void fw_memcpy_to_be32(void *_dst, void *_src, size_t size) | ||
| 34 | { | ||
| 35 | fw_memcpy_from_be32(_dst, _src, size); | ||
| 36 | } | ||
| 37 | #define CSR_REGISTER_BASE 0xfffff0000000ULL | 23 | #define CSR_REGISTER_BASE 0xfffff0000000ULL |
| 38 | 24 | ||
| 39 | /* register offsets are relative to CSR_REGISTER_BASE */ | 25 | /* register offsets are relative to CSR_REGISTER_BASE */ |
| @@ -79,12 +65,13 @@ static inline void fw_memcpy_to_be32(void *_dst, void *_src, size_t size) | |||
| 79 | #define CSR_DIRECTORY_ID 0x20 | 65 | #define CSR_DIRECTORY_ID 0x20 |
| 80 | 66 | ||
| 81 | struct fw_csr_iterator { | 67 | struct fw_csr_iterator { |
| 82 | u32 *p; | 68 | const u32 *p; |
| 83 | u32 *end; | 69 | const u32 *end; |
| 84 | }; | 70 | }; |
| 85 | 71 | ||
| 86 | void fw_csr_iterator_init(struct fw_csr_iterator *ci, u32 *p); | 72 | void fw_csr_iterator_init(struct fw_csr_iterator *ci, const u32 *p); |
| 87 | int fw_csr_iterator_next(struct fw_csr_iterator *ci, int *key, int *value); | 73 | int fw_csr_iterator_next(struct fw_csr_iterator *ci, int *key, int *value); |
| 74 | int fw_csr_string(const u32 *directory, int key, char *buf, size_t size); | ||
| 88 | 75 | ||
| 89 | extern struct bus_type fw_bus_type; | 76 | extern struct bus_type fw_bus_type; |
| 90 | 77 | ||
| @@ -131,7 +118,7 @@ struct fw_card { | |||
| 131 | 118 | ||
| 132 | bool broadcast_channel_allocated; | 119 | bool broadcast_channel_allocated; |
| 133 | u32 broadcast_channel; | 120 | u32 broadcast_channel; |
| 134 | u32 topology_map[(CSR_TOPOLOGY_MAP_END - CSR_TOPOLOGY_MAP) / 4]; | 121 | __be32 topology_map[(CSR_TOPOLOGY_MAP_END - CSR_TOPOLOGY_MAP) / 4]; |
| 135 | }; | 122 | }; |
| 136 | 123 | ||
| 137 | struct fw_attribute_group { | 124 | struct fw_attribute_group { |
| @@ -176,7 +163,7 @@ struct fw_device { | |||
| 176 | struct mutex client_list_mutex; | 163 | struct mutex client_list_mutex; |
| 177 | struct list_head client_list; | 164 | struct list_head client_list; |
| 178 | 165 | ||
| 179 | u32 *config_rom; | 166 | const u32 *config_rom; |
| 180 | size_t config_rom_length; | 167 | size_t config_rom_length; |
| 181 | int config_rom_retries; | 168 | int config_rom_retries; |
| 182 | unsigned is_local:1; | 169 | unsigned is_local:1; |
| @@ -218,7 +205,7 @@ int fw_device_enable_phys_dma(struct fw_device *device); | |||
| 218 | */ | 205 | */ |
| 219 | struct fw_unit { | 206 | struct fw_unit { |
| 220 | struct device device; | 207 | struct device device; |
| 221 | u32 *directory; | 208 | const u32 *directory; |
| 222 | struct fw_attribute_group attribute_group; | 209 | struct fw_attribute_group attribute_group; |
| 223 | }; | 210 | }; |
| 224 | 211 | ||
| @@ -262,8 +249,8 @@ typedef void (*fw_transaction_callback_t)(struct fw_card *card, int rcode, | |||
| 262 | void *data, size_t length, | 249 | void *data, size_t length, |
| 263 | void *callback_data); | 250 | void *callback_data); |
| 264 | /* | 251 | /* |
| 265 | * Important note: The callback must guarantee that either fw_send_response() | 252 | * Important note: Except for the FCP registers, the callback must guarantee |
| 266 | * or kfree() is called on the @request. | 253 | * that either fw_send_response() or kfree() is called on the @request. |
| 267 | */ | 254 | */ |
| 268 | typedef void (*fw_address_callback_t)(struct fw_card *card, | 255 | typedef void (*fw_address_callback_t)(struct fw_card *card, |
| 269 | struct fw_request *request, | 256 | struct fw_request *request, |
| @@ -281,6 +268,7 @@ struct fw_packet { | |||
| 281 | void *payload; | 268 | void *payload; |
| 282 | size_t payload_length; | 269 | size_t payload_length; |
| 283 | dma_addr_t payload_bus; | 270 | dma_addr_t payload_bus; |
| 271 | bool payload_mapped; | ||
| 284 | u32 timestamp; | 272 | u32 timestamp; |
| 285 | 273 | ||
| 286 | /* | 274 | /* |
diff --git a/include/linux/firmware-map.h b/include/linux/firmware-map.h index 875451f1373a..c6dcc1dfe781 100644 --- a/include/linux/firmware-map.h +++ b/include/linux/firmware-map.h | |||
| @@ -24,17 +24,17 @@ | |||
| 24 | */ | 24 | */ |
| 25 | #ifdef CONFIG_FIRMWARE_MEMMAP | 25 | #ifdef CONFIG_FIRMWARE_MEMMAP |
| 26 | 26 | ||
| 27 | int firmware_map_add(u64 start, u64 end, const char *type); | ||
| 28 | int firmware_map_add_early(u64 start, u64 end, const char *type); | 27 | int firmware_map_add_early(u64 start, u64 end, const char *type); |
| 28 | int firmware_map_add_hotplug(u64 start, u64 end, const char *type); | ||
| 29 | 29 | ||
| 30 | #else /* CONFIG_FIRMWARE_MEMMAP */ | 30 | #else /* CONFIG_FIRMWARE_MEMMAP */ |
| 31 | 31 | ||
| 32 | static inline int firmware_map_add(u64 start, u64 end, const char *type) | 32 | static inline int firmware_map_add_early(u64 start, u64 end, const char *type) |
| 33 | { | 33 | { |
| 34 | return 0; | 34 | return 0; |
| 35 | } | 35 | } |
| 36 | 36 | ||
| 37 | static inline int firmware_map_add_early(u64 start, u64 end, const char *type) | 37 | static inline int firmware_map_add_hotplug(u64 start, u64 end, const char *type) |
| 38 | { | 38 | { |
| 39 | return 0; | 39 | return 0; |
| 40 | } | 40 | } |
diff --git a/include/linux/firmware.h b/include/linux/firmware.h index d31544628436..043811f0d277 100644 --- a/include/linux/firmware.h +++ b/include/linux/firmware.h | |||
| @@ -4,6 +4,7 @@ | |||
| 4 | #include <linux/module.h> | 4 | #include <linux/module.h> |
| 5 | #include <linux/types.h> | 5 | #include <linux/types.h> |
| 6 | #include <linux/compiler.h> | 6 | #include <linux/compiler.h> |
| 7 | #include <linux/gfp.h> | ||
| 7 | 8 | ||
| 8 | #define FW_ACTION_NOHOTPLUG 0 | 9 | #define FW_ACTION_NOHOTPLUG 0 |
| 9 | #define FW_ACTION_HOTPLUG 1 | 10 | #define FW_ACTION_HOTPLUG 1 |
| @@ -38,7 +39,7 @@ int request_firmware(const struct firmware **fw, const char *name, | |||
| 38 | struct device *device); | 39 | struct device *device); |
| 39 | int request_firmware_nowait( | 40 | int request_firmware_nowait( |
| 40 | struct module *module, int uevent, | 41 | struct module *module, int uevent, |
| 41 | const char *name, struct device *device, void *context, | 42 | const char *name, struct device *device, gfp_t gfp, void *context, |
| 42 | void (*cont)(const struct firmware *fw, void *context)); | 43 | void (*cont)(const struct firmware *fw, void *context)); |
| 43 | 44 | ||
| 44 | void release_firmware(const struct firmware *fw); | 45 | void release_firmware(const struct firmware *fw); |
| @@ -51,7 +52,7 @@ static inline int request_firmware(const struct firmware **fw, | |||
| 51 | } | 52 | } |
| 52 | static inline int request_firmware_nowait( | 53 | static inline int request_firmware_nowait( |
| 53 | struct module *module, int uevent, | 54 | struct module *module, int uevent, |
| 54 | const char *name, struct device *device, void *context, | 55 | const char *name, struct device *device, gfp_t gfp, void *context, |
| 55 | void (*cont)(const struct firmware *fw, void *context)) | 56 | void (*cont)(const struct firmware *fw, void *context)) |
| 56 | { | 57 | { |
| 57 | return -EINVAL; | 58 | return -EINVAL; |
diff --git a/include/linux/freezer.h b/include/linux/freezer.h index 5a361f85cfec..da7e52b099f3 100644 --- a/include/linux/freezer.h +++ b/include/linux/freezer.h | |||
| @@ -64,9 +64,12 @@ extern bool freeze_task(struct task_struct *p, bool sig_only); | |||
| 64 | extern void cancel_freezing(struct task_struct *p); | 64 | extern void cancel_freezing(struct task_struct *p); |
| 65 | 65 | ||
| 66 | #ifdef CONFIG_CGROUP_FREEZER | 66 | #ifdef CONFIG_CGROUP_FREEZER |
| 67 | extern int cgroup_frozen(struct task_struct *task); | 67 | extern int cgroup_freezing_or_frozen(struct task_struct *task); |
| 68 | #else /* !CONFIG_CGROUP_FREEZER */ | 68 | #else /* !CONFIG_CGROUP_FREEZER */ |
| 69 | static inline int cgroup_frozen(struct task_struct *task) { return 0; } | 69 | static inline int cgroup_freezing_or_frozen(struct task_struct *task) |
| 70 | { | ||
| 71 | return 0; | ||
| 72 | } | ||
| 70 | #endif /* !CONFIG_CGROUP_FREEZER */ | 73 | #endif /* !CONFIG_CGROUP_FREEZER */ |
| 71 | 74 | ||
| 72 | /* | 75 | /* |
diff --git a/include/linux/fs.h b/include/linux/fs.h index 5c7e0ff370ba..894918440bc8 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h | |||
| @@ -60,24 +60,24 @@ struct inodes_stat_t { | |||
| 60 | */ | 60 | */ |
| 61 | 61 | ||
| 62 | /* file is open for reading */ | 62 | /* file is open for reading */ |
| 63 | #define FMODE_READ ((__force fmode_t)1) | 63 | #define FMODE_READ ((__force fmode_t)0x1) |
| 64 | /* file is open for writing */ | 64 | /* file is open for writing */ |
| 65 | #define FMODE_WRITE ((__force fmode_t)2) | 65 | #define FMODE_WRITE ((__force fmode_t)0x2) |
| 66 | /* file is seekable */ | 66 | /* file is seekable */ |
| 67 | #define FMODE_LSEEK ((__force fmode_t)4) | 67 | #define FMODE_LSEEK ((__force fmode_t)0x4) |
| 68 | /* file can be accessed using pread */ | 68 | /* file can be accessed using pread */ |
| 69 | #define FMODE_PREAD ((__force fmode_t)8) | 69 | #define FMODE_PREAD ((__force fmode_t)0x8) |
| 70 | /* file can be accessed using pwrite */ | 70 | /* file can be accessed using pwrite */ |
| 71 | #define FMODE_PWRITE ((__force fmode_t)16) | 71 | #define FMODE_PWRITE ((__force fmode_t)0x10) |
| 72 | /* File is opened for execution with sys_execve / sys_uselib */ | 72 | /* File is opened for execution with sys_execve / sys_uselib */ |
| 73 | #define FMODE_EXEC ((__force fmode_t)32) | 73 | #define FMODE_EXEC ((__force fmode_t)0x20) |
| 74 | /* File is opened with O_NDELAY (only set for block devices) */ | 74 | /* File is opened with O_NDELAY (only set for block devices) */ |
| 75 | #define FMODE_NDELAY ((__force fmode_t)64) | 75 | #define FMODE_NDELAY ((__force fmode_t)0x40) |
| 76 | /* File is opened with O_EXCL (only set for block devices) */ | 76 | /* File is opened with O_EXCL (only set for block devices) */ |
| 77 | #define FMODE_EXCL ((__force fmode_t)128) | 77 | #define FMODE_EXCL ((__force fmode_t)0x80) |
| 78 | /* File is opened using open(.., 3, ..) and is writeable only for ioctls | 78 | /* File is opened using open(.., 3, ..) and is writeable only for ioctls |
| 79 | (specialy hack for floppy.c) */ | 79 | (specialy hack for floppy.c) */ |
| 80 | #define FMODE_WRITE_IOCTL ((__force fmode_t)256) | 80 | #define FMODE_WRITE_IOCTL ((__force fmode_t)0x100) |
| 81 | 81 | ||
| 82 | /* | 82 | /* |
| 83 | * Don't update ctime and mtime. | 83 | * Don't update ctime and mtime. |
| @@ -85,7 +85,10 @@ struct inodes_stat_t { | |||
| 85 | * Currently a special hack for the XFS open_by_handle ioctl, but we'll | 85 | * Currently a special hack for the XFS open_by_handle ioctl, but we'll |
| 86 | * hopefully graduate it to a proper O_CMTIME flag supported by open(2) soon. | 86 | * hopefully graduate it to a proper O_CMTIME flag supported by open(2) soon. |
| 87 | */ | 87 | */ |
| 88 | #define FMODE_NOCMTIME ((__force fmode_t)2048) | 88 | #define FMODE_NOCMTIME ((__force fmode_t)0x800) |
| 89 | |||
| 90 | /* Expect random access pattern */ | ||
| 91 | #define FMODE_RANDOM ((__force fmode_t)0x1000) | ||
| 89 | 92 | ||
| 90 | /* | 93 | /* |
| 91 | * The below are the various read and write types that we support. Some of | 94 | * The below are the various read and write types that we support. Some of |
| @@ -129,7 +132,7 @@ struct inodes_stat_t { | |||
| 129 | * WRITE_SYNC Like WRITE_SYNC_PLUG, but also unplugs the device | 132 | * WRITE_SYNC Like WRITE_SYNC_PLUG, but also unplugs the device |
| 130 | * immediately after submission. The write equivalent | 133 | * immediately after submission. The write equivalent |
| 131 | * of READ_SYNC. | 134 | * of READ_SYNC. |
| 132 | * WRITE_ODIRECT Special case write for O_DIRECT only. | 135 | * WRITE_ODIRECT_PLUG Special case write for O_DIRECT only. |
| 133 | * SWRITE_SYNC | 136 | * SWRITE_SYNC |
| 134 | * SWRITE_SYNC_PLUG Like WRITE_SYNC/WRITE_SYNC_PLUG, but locks the buffer. | 137 | * SWRITE_SYNC_PLUG Like WRITE_SYNC/WRITE_SYNC_PLUG, but locks the buffer. |
| 135 | * See SWRITE. | 138 | * See SWRITE. |
| @@ -151,7 +154,8 @@ struct inodes_stat_t { | |||
| 151 | #define READ_META (READ | (1 << BIO_RW_META)) | 154 | #define READ_META (READ | (1 << BIO_RW_META)) |
| 152 | #define WRITE_SYNC_PLUG (WRITE | (1 << BIO_RW_SYNCIO) | (1 << BIO_RW_NOIDLE)) | 155 | #define WRITE_SYNC_PLUG (WRITE | (1 << BIO_RW_SYNCIO) | (1 << BIO_RW_NOIDLE)) |
| 153 | #define WRITE_SYNC (WRITE_SYNC_PLUG | (1 << BIO_RW_UNPLUG)) | 156 | #define WRITE_SYNC (WRITE_SYNC_PLUG | (1 << BIO_RW_UNPLUG)) |
| 154 | #define WRITE_ODIRECT (WRITE | (1 << BIO_RW_SYNCIO) | (1 << BIO_RW_UNPLUG)) | 157 | #define WRITE_ODIRECT_PLUG (WRITE | (1 << BIO_RW_SYNCIO)) |
| 158 | #define WRITE_META (WRITE | (1 << BIO_RW_META)) | ||
| 155 | #define SWRITE_SYNC_PLUG \ | 159 | #define SWRITE_SYNC_PLUG \ |
| 156 | (SWRITE | (1 << BIO_RW_SYNCIO) | (1 << BIO_RW_NOIDLE)) | 160 | (SWRITE | (1 << BIO_RW_SYNCIO) | (1 << BIO_RW_NOIDLE)) |
| 157 | #define SWRITE_SYNC (SWRITE_SYNC_PLUG | (1 << BIO_RW_UNPLUG)) | 161 | #define SWRITE_SYNC (SWRITE_SYNC_PLUG | (1 << BIO_RW_UNPLUG)) |
| @@ -304,6 +308,7 @@ struct inodes_stat_t { | |||
| 304 | #define BLKIOOPT _IO(0x12,121) | 308 | #define BLKIOOPT _IO(0x12,121) |
| 305 | #define BLKALIGNOFF _IO(0x12,122) | 309 | #define BLKALIGNOFF _IO(0x12,122) |
| 306 | #define BLKPBSZGET _IO(0x12,123) | 310 | #define BLKPBSZGET _IO(0x12,123) |
| 311 | #define BLKDISCARDZEROES _IO(0x12,124) | ||
| 307 | 312 | ||
| 308 | #define BMAP_IOCTL 1 /* obsolete - kept for compatibility */ | 313 | #define BMAP_IOCTL 1 /* obsolete - kept for compatibility */ |
| 309 | #define FIBMAP _IO(0x00,1) /* bmap access */ | 314 | #define FIBMAP _IO(0x00,1) /* bmap access */ |
| @@ -728,6 +733,7 @@ struct inode { | |||
| 728 | uid_t i_uid; | 733 | uid_t i_uid; |
| 729 | gid_t i_gid; | 734 | gid_t i_gid; |
| 730 | dev_t i_rdev; | 735 | dev_t i_rdev; |
| 736 | unsigned int i_blkbits; | ||
| 731 | u64 i_version; | 737 | u64 i_version; |
| 732 | loff_t i_size; | 738 | loff_t i_size; |
| 733 | #ifdef __NEED_I_SIZE_ORDERED | 739 | #ifdef __NEED_I_SIZE_ORDERED |
| @@ -737,7 +743,6 @@ struct inode { | |||
| 737 | struct timespec i_mtime; | 743 | struct timespec i_mtime; |
| 738 | struct timespec i_ctime; | 744 | struct timespec i_ctime; |
| 739 | blkcnt_t i_blocks; | 745 | blkcnt_t i_blocks; |
| 740 | unsigned int i_blkbits; | ||
| 741 | unsigned short i_bytes; | 746 | unsigned short i_bytes; |
| 742 | umode_t i_mode; | 747 | umode_t i_mode; |
| 743 | spinlock_t i_lock; /* i_blocks, i_bytes, maybe i_size */ | 748 | spinlock_t i_lock; /* i_blocks, i_bytes, maybe i_size */ |
| @@ -1096,10 +1101,6 @@ struct file_lock { | |||
| 1096 | 1101 | ||
| 1097 | extern void send_sigio(struct fown_struct *fown, int fd, int band); | 1102 | extern void send_sigio(struct fown_struct *fown, int fd, int band); |
| 1098 | 1103 | ||
| 1099 | /* fs/sync.c */ | ||
| 1100 | extern int do_sync_mapping_range(struct address_space *mapping, loff_t offset, | ||
| 1101 | loff_t endbyte, unsigned int flags); | ||
| 1102 | |||
| 1103 | #ifdef CONFIG_FILE_LOCKING | 1104 | #ifdef CONFIG_FILE_LOCKING |
| 1104 | extern int fcntl_getlk(struct file *, struct flock __user *); | 1105 | extern int fcntl_getlk(struct file *, struct flock __user *); |
| 1105 | extern int fcntl_setlk(unsigned int, struct file *, unsigned int, | 1106 | extern int fcntl_setlk(unsigned int, struct file *, unsigned int, |
| @@ -1310,6 +1311,8 @@ extern int send_sigurg(struct fown_struct *fown); | |||
| 1310 | #define MNT_FORCE 0x00000001 /* Attempt to forcibily umount */ | 1311 | #define MNT_FORCE 0x00000001 /* Attempt to forcibily umount */ |
| 1311 | #define MNT_DETACH 0x00000002 /* Just detach from the tree */ | 1312 | #define MNT_DETACH 0x00000002 /* Just detach from the tree */ |
| 1312 | #define MNT_EXPIRE 0x00000004 /* Mark for expiry */ | 1313 | #define MNT_EXPIRE 0x00000004 /* Mark for expiry */ |
| 1314 | #define UMOUNT_NOFOLLOW 0x00000008 /* Don't follow symlink on umount */ | ||
| 1315 | #define UMOUNT_UNUSED 0x80000000 /* Flag guaranteed to be unused */ | ||
| 1313 | 1316 | ||
| 1314 | extern struct list_head super_blocks; | 1317 | extern struct list_head super_blocks; |
| 1315 | extern spinlock_t sb_lock; | 1318 | extern spinlock_t sb_lock; |
| @@ -1319,9 +1322,9 @@ extern spinlock_t sb_lock; | |||
| 1319 | struct super_block { | 1322 | struct super_block { |
| 1320 | struct list_head s_list; /* Keep this first */ | 1323 | struct list_head s_list; /* Keep this first */ |
| 1321 | dev_t s_dev; /* search index; _not_ kdev_t */ | 1324 | dev_t s_dev; /* search index; _not_ kdev_t */ |
| 1322 | unsigned long s_blocksize; | ||
| 1323 | unsigned char s_blocksize_bits; | ||
| 1324 | unsigned char s_dirt; | 1325 | unsigned char s_dirt; |
| 1326 | unsigned char s_blocksize_bits; | ||
| 1327 | unsigned long s_blocksize; | ||
| 1325 | loff_t s_maxbytes; /* Max file size */ | 1328 | loff_t s_maxbytes; /* Max file size */ |
| 1326 | struct file_system_type *s_type; | 1329 | struct file_system_type *s_type; |
| 1327 | const struct super_operations *s_op; | 1330 | const struct super_operations *s_op; |
| @@ -1362,16 +1365,16 @@ struct super_block { | |||
| 1362 | void *s_fs_info; /* Filesystem private info */ | 1365 | void *s_fs_info; /* Filesystem private info */ |
| 1363 | fmode_t s_mode; | 1366 | fmode_t s_mode; |
| 1364 | 1367 | ||
| 1368 | /* Granularity of c/m/atime in ns. | ||
| 1369 | Cannot be worse than a second */ | ||
| 1370 | u32 s_time_gran; | ||
| 1371 | |||
| 1365 | /* | 1372 | /* |
| 1366 | * The next field is for VFS *only*. No filesystems have any business | 1373 | * The next field is for VFS *only*. No filesystems have any business |
| 1367 | * even looking at it. You had been warned. | 1374 | * even looking at it. You had been warned. |
| 1368 | */ | 1375 | */ |
| 1369 | struct mutex s_vfs_rename_mutex; /* Kludge */ | 1376 | struct mutex s_vfs_rename_mutex; /* Kludge */ |
| 1370 | 1377 | ||
| 1371 | /* Granularity of c/m/atime in ns. | ||
| 1372 | Cannot be worse than a second */ | ||
| 1373 | u32 s_time_gran; | ||
| 1374 | |||
| 1375 | /* | 1378 | /* |
| 1376 | * Filesystem subtype. If non-empty the filesystem type field | 1379 | * Filesystem subtype. If non-empty the filesystem type field |
| 1377 | * in /proc/mounts will be "type.subtype" | 1380 | * in /proc/mounts will be "type.subtype" |
| @@ -1560,7 +1563,7 @@ struct super_operations { | |||
| 1560 | void (*destroy_inode)(struct inode *); | 1563 | void (*destroy_inode)(struct inode *); |
| 1561 | 1564 | ||
| 1562 | void (*dirty_inode) (struct inode *); | 1565 | void (*dirty_inode) (struct inode *); |
| 1563 | int (*write_inode) (struct inode *, int); | 1566 | int (*write_inode) (struct inode *, struct writeback_control *wbc); |
| 1564 | void (*drop_inode) (struct inode *); | 1567 | void (*drop_inode) (struct inode *); |
| 1565 | void (*delete_inode) (struct inode *); | 1568 | void (*delete_inode) (struct inode *); |
| 1566 | void (*put_super) (struct super_block *); | 1569 | void (*put_super) (struct super_block *); |
| @@ -1592,7 +1595,7 @@ struct super_operations { | |||
| 1592 | * until that flag is cleared. I_WILL_FREE, I_FREEING and I_CLEAR are set at | 1595 | * until that flag is cleared. I_WILL_FREE, I_FREEING and I_CLEAR are set at |
| 1593 | * various stages of removing an inode. | 1596 | * various stages of removing an inode. |
| 1594 | * | 1597 | * |
| 1595 | * Two bits are used for locking and completion notification, I_LOCK and I_SYNC. | 1598 | * Two bits are used for locking and completion notification, I_NEW and I_SYNC. |
| 1596 | * | 1599 | * |
| 1597 | * I_DIRTY_SYNC Inode is dirty, but doesn't have to be written on | 1600 | * I_DIRTY_SYNC Inode is dirty, but doesn't have to be written on |
| 1598 | * fdatasync(). i_atime is the usual cause. | 1601 | * fdatasync(). i_atime is the usual cause. |
| @@ -1601,8 +1604,14 @@ struct super_operations { | |||
| 1601 | * don't have to write inode on fdatasync() when only | 1604 | * don't have to write inode on fdatasync() when only |
| 1602 | * mtime has changed in it. | 1605 | * mtime has changed in it. |
| 1603 | * I_DIRTY_PAGES Inode has dirty pages. Inode itself may be clean. | 1606 | * I_DIRTY_PAGES Inode has dirty pages. Inode itself may be clean. |
| 1604 | * I_NEW get_new_inode() sets i_state to I_LOCK|I_NEW. Both | 1607 | * I_NEW Serves as both a mutex and completion notification. |
| 1605 | * are cleared by unlock_new_inode(), called from iget(). | 1608 | * New inodes set I_NEW. If two processes both create |
| 1609 | * the same inode, one of them will release its inode and | ||
| 1610 | * wait for I_NEW to be released before returning. | ||
| 1611 | * Inodes in I_WILL_FREE, I_FREEING or I_CLEAR state can | ||
| 1612 | * also cause waiting on I_NEW, without I_NEW actually | ||
| 1613 | * being set. find_inode() uses this to prevent returning | ||
| 1614 | * nearly-dead inodes. | ||
| 1606 | * I_WILL_FREE Must be set when calling write_inode_now() if i_count | 1615 | * I_WILL_FREE Must be set when calling write_inode_now() if i_count |
| 1607 | * is zero. I_FREEING must be set when I_WILL_FREE is | 1616 | * is zero. I_FREEING must be set when I_WILL_FREE is |
| 1608 | * cleared. | 1617 | * cleared. |
| @@ -1616,35 +1625,23 @@ struct super_operations { | |||
| 1616 | * prohibited for many purposes. iget() must wait for | 1625 | * prohibited for many purposes. iget() must wait for |
| 1617 | * the inode to be completely released, then create it | 1626 | * the inode to be completely released, then create it |
| 1618 | * anew. Other functions will just ignore such inodes, | 1627 | * anew. Other functions will just ignore such inodes, |
| 1619 | * if appropriate. I_LOCK is used for waiting. | 1628 | * if appropriate. I_NEW is used for waiting. |
| 1620 | * | 1629 | * |
| 1621 | * I_LOCK Serves as both a mutex and completion notification. | 1630 | * I_SYNC Synchonized write of dirty inode data. The bits is |
| 1622 | * New inodes set I_LOCK. If two processes both create | 1631 | * set during data writeback, and cleared with a wakeup |
| 1623 | * the same inode, one of them will release its inode and | 1632 | * on the bit address once it is done. |
| 1624 | * wait for I_LOCK to be released before returning. | ||
| 1625 | * Inodes in I_WILL_FREE, I_FREEING or I_CLEAR state can | ||
| 1626 | * also cause waiting on I_LOCK, without I_LOCK actually | ||
| 1627 | * being set. find_inode() uses this to prevent returning | ||
| 1628 | * nearly-dead inodes. | ||
| 1629 | * I_SYNC Similar to I_LOCK, but limited in scope to writeback | ||
| 1630 | * of inode dirty data. Having a separate lock for this | ||
| 1631 | * purpose reduces latency and prevents some filesystem- | ||
| 1632 | * specific deadlocks. | ||
| 1633 | * | 1633 | * |
| 1634 | * Q: What is the difference between I_WILL_FREE and I_FREEING? | 1634 | * Q: What is the difference between I_WILL_FREE and I_FREEING? |
| 1635 | * Q: igrab() only checks on (I_FREEING|I_WILL_FREE). Should it also check on | ||
| 1636 | * I_CLEAR? If not, why? | ||
| 1637 | */ | 1635 | */ |
| 1638 | #define I_DIRTY_SYNC 1 | 1636 | #define I_DIRTY_SYNC 1 |
| 1639 | #define I_DIRTY_DATASYNC 2 | 1637 | #define I_DIRTY_DATASYNC 2 |
| 1640 | #define I_DIRTY_PAGES 4 | 1638 | #define I_DIRTY_PAGES 4 |
| 1641 | #define I_NEW 8 | 1639 | #define __I_NEW 3 |
| 1640 | #define I_NEW (1 << __I_NEW) | ||
| 1642 | #define I_WILL_FREE 16 | 1641 | #define I_WILL_FREE 16 |
| 1643 | #define I_FREEING 32 | 1642 | #define I_FREEING 32 |
| 1644 | #define I_CLEAR 64 | 1643 | #define I_CLEAR 64 |
| 1645 | #define __I_LOCK 7 | 1644 | #define __I_SYNC 7 |
| 1646 | #define I_LOCK (1 << __I_LOCK) | ||
| 1647 | #define __I_SYNC 8 | ||
| 1648 | #define I_SYNC (1 << __I_SYNC) | 1645 | #define I_SYNC (1 << __I_SYNC) |
| 1649 | 1646 | ||
| 1650 | #define I_DIRTY (I_DIRTY_SYNC | I_DIRTY_DATASYNC | I_DIRTY_PAGES) | 1647 | #define I_DIRTY (I_DIRTY_SYNC | I_DIRTY_DATASYNC | I_DIRTY_PAGES) |
| @@ -1805,7 +1802,8 @@ extern int may_umount(struct vfsmount *); | |||
| 1805 | extern long do_mount(char *, char *, char *, unsigned long, void *); | 1802 | extern long do_mount(char *, char *, char *, unsigned long, void *); |
| 1806 | extern struct vfsmount *collect_mounts(struct path *); | 1803 | extern struct vfsmount *collect_mounts(struct path *); |
| 1807 | extern void drop_collected_mounts(struct vfsmount *); | 1804 | extern void drop_collected_mounts(struct vfsmount *); |
| 1808 | 1805 | extern int iterate_mounts(int (*)(struct vfsmount *, void *), void *, | |
| 1806 | struct vfsmount *); | ||
| 1809 | extern int vfs_statfs(struct dentry *, struct kstatfs *); | 1807 | extern int vfs_statfs(struct dentry *, struct kstatfs *); |
| 1810 | 1808 | ||
| 1811 | extern int current_umask(void); | 1809 | extern int current_umask(void); |
| @@ -2069,12 +2067,6 @@ extern int invalidate_inodes(struct super_block *); | |||
| 2069 | unsigned long invalidate_mapping_pages(struct address_space *mapping, | 2067 | unsigned long invalidate_mapping_pages(struct address_space *mapping, |
| 2070 | pgoff_t start, pgoff_t end); | 2068 | pgoff_t start, pgoff_t end); |
| 2071 | 2069 | ||
| 2072 | static inline unsigned long __deprecated | ||
| 2073 | invalidate_inode_pages(struct address_space *mapping) | ||
| 2074 | { | ||
| 2075 | return invalidate_mapping_pages(mapping, 0, ~0UL); | ||
| 2076 | } | ||
| 2077 | |||
| 2078 | static inline void invalidate_remote_inode(struct inode *inode) | 2070 | static inline void invalidate_remote_inode(struct inode *inode) |
| 2079 | { | 2071 | { |
| 2080 | if (S_ISREG(inode->i_mode) || S_ISDIR(inode->i_mode) || | 2072 | if (S_ISREG(inode->i_mode) || S_ISDIR(inode->i_mode) || |
| @@ -2093,8 +2085,6 @@ extern int filemap_fdatawait_range(struct address_space *, loff_t lstart, | |||
| 2093 | extern int filemap_write_and_wait(struct address_space *mapping); | 2085 | extern int filemap_write_and_wait(struct address_space *mapping); |
| 2094 | extern int filemap_write_and_wait_range(struct address_space *mapping, | 2086 | extern int filemap_write_and_wait_range(struct address_space *mapping, |
| 2095 | loff_t lstart, loff_t lend); | 2087 | loff_t lstart, loff_t lend); |
| 2096 | extern int wait_on_page_writeback_range(struct address_space *mapping, | ||
| 2097 | pgoff_t start, pgoff_t end); | ||
| 2098 | extern int __filemap_fdatawrite_range(struct address_space *mapping, | 2088 | extern int __filemap_fdatawrite_range(struct address_space *mapping, |
| 2099 | loff_t start, loff_t end, int sync_mode); | 2089 | loff_t start, loff_t end, int sync_mode); |
| 2100 | extern int filemap_fdatawrite_range(struct address_space *mapping, | 2090 | extern int filemap_fdatawrite_range(struct address_space *mapping, |
| @@ -2145,6 +2135,7 @@ extern struct file * open_exec(const char *); | |||
| 2145 | 2135 | ||
| 2146 | /* fs/dcache.c -- generic fs support functions */ | 2136 | /* fs/dcache.c -- generic fs support functions */ |
| 2147 | extern int is_subdir(struct dentry *, struct dentry *); | 2137 | extern int is_subdir(struct dentry *, struct dentry *); |
| 2138 | extern int path_is_under(struct path *, struct path *); | ||
| 2148 | extern ino_t find_inode_number(struct dentry *, struct qstr *); | 2139 | extern ino_t find_inode_number(struct dentry *, struct qstr *); |
| 2149 | 2140 | ||
| 2150 | #include <linux/err.h> | 2141 | #include <linux/err.h> |
| @@ -2193,7 +2184,6 @@ static inline void insert_inode_hash(struct inode *inode) { | |||
| 2193 | __insert_inode_hash(inode, inode->i_ino); | 2184 | __insert_inode_hash(inode, inode->i_ino); |
| 2194 | } | 2185 | } |
| 2195 | 2186 | ||
| 2196 | extern struct file * get_empty_filp(void); | ||
| 2197 | extern void file_move(struct file *f, struct list_head *list); | 2187 | extern void file_move(struct file *f, struct list_head *list); |
| 2198 | extern void file_kill(struct file *f); | 2188 | extern void file_kill(struct file *f); |
| 2199 | #ifdef CONFIG_BLOCK | 2189 | #ifdef CONFIG_BLOCK |
| @@ -2225,6 +2215,7 @@ extern int generic_segment_checks(const struct iovec *iov, | |||
| 2225 | /* fs/block_dev.c */ | 2215 | /* fs/block_dev.c */ |
| 2226 | extern ssize_t blkdev_aio_write(struct kiocb *iocb, const struct iovec *iov, | 2216 | extern ssize_t blkdev_aio_write(struct kiocb *iocb, const struct iovec *iov, |
| 2227 | unsigned long nr_segs, loff_t pos); | 2217 | unsigned long nr_segs, loff_t pos); |
| 2218 | extern int blkdev_fsync(struct file *filp, struct dentry *dentry, int datasync); | ||
| 2228 | 2219 | ||
| 2229 | /* fs/splice.c */ | 2220 | /* fs/splice.c */ |
| 2230 | extern ssize_t generic_file_splice_read(struct file *, loff_t *, | 2221 | extern ssize_t generic_file_splice_read(struct file *, loff_t *, |
| @@ -2268,9 +2259,11 @@ ssize_t __blockdev_direct_IO(int rw, struct kiocb *iocb, struct inode *inode, | |||
| 2268 | int lock_type); | 2259 | int lock_type); |
| 2269 | 2260 | ||
| 2270 | enum { | 2261 | enum { |
| 2271 | DIO_LOCKING = 1, /* need locking between buffered and direct access */ | 2262 | /* need locking between buffered and direct access */ |
| 2272 | DIO_NO_LOCKING, /* bdev; no locking at all between buffered/direct */ | 2263 | DIO_LOCKING = 0x01, |
| 2273 | DIO_OWN_LOCKING, /* filesystem locks buffered and direct internally */ | 2264 | |
| 2265 | /* filesystem does not support filling holes */ | ||
| 2266 | DIO_SKIP_HOLES = 0x02, | ||
| 2274 | }; | 2267 | }; |
| 2275 | 2268 | ||
| 2276 | static inline ssize_t blockdev_direct_IO(int rw, struct kiocb *iocb, | 2269 | static inline ssize_t blockdev_direct_IO(int rw, struct kiocb *iocb, |
| @@ -2279,7 +2272,8 @@ static inline ssize_t blockdev_direct_IO(int rw, struct kiocb *iocb, | |||
| 2279 | dio_iodone_t end_io) | 2272 | dio_iodone_t end_io) |
| 2280 | { | 2273 | { |
| 2281 | return __blockdev_direct_IO(rw, iocb, inode, bdev, iov, offset, | 2274 | return __blockdev_direct_IO(rw, iocb, inode, bdev, iov, offset, |
| 2282 | nr_segs, get_block, end_io, DIO_LOCKING); | 2275 | nr_segs, get_block, end_io, |
| 2276 | DIO_LOCKING | DIO_SKIP_HOLES); | ||
| 2283 | } | 2277 | } |
| 2284 | 2278 | ||
| 2285 | static inline ssize_t blockdev_direct_IO_no_locking(int rw, struct kiocb *iocb, | 2279 | static inline ssize_t blockdev_direct_IO_no_locking(int rw, struct kiocb *iocb, |
| @@ -2288,16 +2282,7 @@ static inline ssize_t blockdev_direct_IO_no_locking(int rw, struct kiocb *iocb, | |||
| 2288 | dio_iodone_t end_io) | 2282 | dio_iodone_t end_io) |
| 2289 | { | 2283 | { |
| 2290 | return __blockdev_direct_IO(rw, iocb, inode, bdev, iov, offset, | 2284 | return __blockdev_direct_IO(rw, iocb, inode, bdev, iov, offset, |
| 2291 | nr_segs, get_block, end_io, DIO_NO_LOCKING); | 2285 | nr_segs, get_block, end_io, 0); |
| 2292 | } | ||
| 2293 | |||
| 2294 | static inline ssize_t blockdev_direct_IO_own_locking(int rw, struct kiocb *iocb, | ||
| 2295 | struct inode *inode, struct block_device *bdev, const struct iovec *iov, | ||
| 2296 | loff_t offset, unsigned long nr_segs, get_block_t get_block, | ||
| 2297 | dio_iodone_t end_io) | ||
| 2298 | { | ||
| 2299 | return __blockdev_direct_IO(rw, iocb, inode, bdev, iov, offset, | ||
| 2300 | nr_segs, get_block, end_io, DIO_OWN_LOCKING); | ||
| 2301 | } | 2286 | } |
| 2302 | #endif | 2287 | #endif |
| 2303 | 2288 | ||
| @@ -2317,6 +2302,7 @@ extern const struct inode_operations page_symlink_inode_operations; | |||
| 2317 | extern int generic_readlink(struct dentry *, char __user *, int); | 2302 | extern int generic_readlink(struct dentry *, char __user *, int); |
| 2318 | extern void generic_fillattr(struct inode *, struct kstat *); | 2303 | extern void generic_fillattr(struct inode *, struct kstat *); |
| 2319 | extern int vfs_getattr(struct vfsmount *, struct dentry *, struct kstat *); | 2304 | extern int vfs_getattr(struct vfsmount *, struct dentry *, struct kstat *); |
| 2305 | void __inode_add_bytes(struct inode *inode, loff_t bytes); | ||
| 2320 | void inode_add_bytes(struct inode *inode, loff_t bytes); | 2306 | void inode_add_bytes(struct inode *inode, loff_t bytes); |
| 2321 | void inode_sub_bytes(struct inode *inode, loff_t bytes); | 2307 | void inode_sub_bytes(struct inode *inode, loff_t bytes); |
| 2322 | loff_t inode_get_bytes(struct inode *inode); | 2308 | loff_t inode_get_bytes(struct inode *inode); |
| @@ -2332,8 +2318,9 @@ extern int vfs_fstatat(int , char __user *, struct kstat *, int); | |||
| 2332 | extern int do_vfs_ioctl(struct file *filp, unsigned int fd, unsigned int cmd, | 2318 | extern int do_vfs_ioctl(struct file *filp, unsigned int fd, unsigned int cmd, |
| 2333 | unsigned long arg); | 2319 | unsigned long arg); |
| 2334 | extern int __generic_block_fiemap(struct inode *inode, | 2320 | extern int __generic_block_fiemap(struct inode *inode, |
| 2335 | struct fiemap_extent_info *fieinfo, u64 start, | 2321 | struct fiemap_extent_info *fieinfo, |
| 2336 | u64 len, get_block_t *get_block); | 2322 | loff_t start, loff_t len, |
| 2323 | get_block_t *get_block); | ||
| 2337 | extern int generic_block_fiemap(struct inode *inode, | 2324 | extern int generic_block_fiemap(struct inode *inode, |
| 2338 | struct fiemap_extent_info *fieinfo, u64 start, | 2325 | struct fiemap_extent_info *fieinfo, u64 start, |
| 2339 | u64 len, get_block_t *get_block); | 2326 | u64 len, get_block_t *get_block); |
| @@ -2359,8 +2346,6 @@ extern int simple_rename(struct inode *, struct dentry *, struct inode *, struct | |||
| 2359 | extern int simple_sync_file(struct file *, struct dentry *, int); | 2346 | extern int simple_sync_file(struct file *, struct dentry *, int); |
| 2360 | extern int simple_empty(struct dentry *); | 2347 | extern int simple_empty(struct dentry *); |
| 2361 | extern int simple_readpage(struct file *file, struct page *page); | 2348 | extern int simple_readpage(struct file *file, struct page *page); |
| 2362 | extern int simple_prepare_write(struct file *file, struct page *page, | ||
| 2363 | unsigned offset, unsigned to); | ||
| 2364 | extern int simple_write_begin(struct file *file, struct address_space *mapping, | 2349 | extern int simple_write_begin(struct file *file, struct address_space *mapping, |
| 2365 | loff_t pos, unsigned len, unsigned flags, | 2350 | loff_t pos, unsigned len, unsigned flags, |
| 2366 | struct page **pagep, void **fsdata); | 2351 | struct page **pagep, void **fsdata); |
| @@ -2482,5 +2467,8 @@ int proc_nr_files(struct ctl_table *table, int write, | |||
| 2482 | 2467 | ||
| 2483 | int __init get_filesystem_list(char *buf); | 2468 | int __init get_filesystem_list(char *buf); |
| 2484 | 2469 | ||
| 2470 | #define ACC_MODE(x) ("\004\002\006\006"[(x)&O_ACCMODE]) | ||
| 2471 | #define OPEN_FMODE(flag) ((__force fmode_t)((flag + 1) & O_ACCMODE)) | ||
| 2472 | |||
| 2485 | #endif /* __KERNEL__ */ | 2473 | #endif /* __KERNEL__ */ |
| 2486 | #endif /* _LINUX_FS_H */ | 2474 | #endif /* _LINUX_FS_H */ |
diff --git a/include/linux/fs_stack.h b/include/linux/fs_stack.h index bb516ceeefc9..da317c7163ab 100644 --- a/include/linux/fs_stack.h +++ b/include/linux/fs_stack.h | |||
| @@ -8,10 +8,8 @@ | |||
| 8 | #include <linux/fs.h> | 8 | #include <linux/fs.h> |
| 9 | 9 | ||
| 10 | /* externs for fs/stack.c */ | 10 | /* externs for fs/stack.c */ |
| 11 | extern void fsstack_copy_attr_all(struct inode *dest, const struct inode *src, | 11 | extern void fsstack_copy_attr_all(struct inode *dest, const struct inode *src); |
| 12 | int (*get_nlinks)(struct inode *)); | 12 | extern void fsstack_copy_inode_size(struct inode *dst, struct inode *src); |
| 13 | |||
| 14 | extern void fsstack_copy_inode_size(struct inode *dst, const struct inode *src); | ||
| 15 | 13 | ||
| 16 | /* inlines */ | 14 | /* inlines */ |
| 17 | static inline void fsstack_copy_attr_atime(struct inode *dest, | 15 | static inline void fsstack_copy_attr_atime(struct inode *dest, |
diff --git a/include/linux/fscache-cache.h b/include/linux/fscache-cache.h index 7be0c6fbe880..c57db27ac861 100644 --- a/include/linux/fscache-cache.h +++ b/include/linux/fscache-cache.h | |||
| @@ -105,7 +105,7 @@ struct fscache_operation { | |||
| 105 | /* operation releaser */ | 105 | /* operation releaser */ |
| 106 | fscache_operation_release_t release; | 106 | fscache_operation_release_t release; |
| 107 | 107 | ||
| 108 | #ifdef CONFIG_SLOW_WORK_PROC | 108 | #ifdef CONFIG_SLOW_WORK_DEBUG |
| 109 | const char *name; /* operation name */ | 109 | const char *name; /* operation name */ |
| 110 | const char *state; /* operation state */ | 110 | const char *state; /* operation state */ |
| 111 | #define fscache_set_op_name(OP, N) do { (OP)->name = (N); } while(0) | 111 | #define fscache_set_op_name(OP, N) do { (OP)->name = (N); } while(0) |
diff --git a/include/linux/fsl_devices.h b/include/linux/fsl_devices.h index 43fc95d822d5..28e33fea5107 100644 --- a/include/linux/fsl_devices.h +++ b/include/linux/fsl_devices.h | |||
| @@ -74,7 +74,12 @@ struct spi_device; | |||
| 74 | struct fsl_spi_platform_data { | 74 | struct fsl_spi_platform_data { |
| 75 | u32 initial_spmode; /* initial SPMODE value */ | 75 | u32 initial_spmode; /* initial SPMODE value */ |
| 76 | s16 bus_num; | 76 | s16 bus_num; |
| 77 | bool qe_mode; | 77 | unsigned int flags; |
| 78 | #define SPI_QE_CPU_MODE (1 << 0) /* QE CPU ("PIO") mode */ | ||
| 79 | #define SPI_CPM_MODE (1 << 1) /* CPM/QE ("DMA") mode */ | ||
| 80 | #define SPI_CPM1 (1 << 2) /* SPI unit is in CPM1 block */ | ||
| 81 | #define SPI_CPM2 (1 << 3) /* SPI unit is in CPM2 block */ | ||
| 82 | #define SPI_QE (1 << 4) /* SPI unit is in QE block */ | ||
| 78 | /* board specific information */ | 83 | /* board specific information */ |
| 79 | u16 max_chipselect; | 84 | u16 max_chipselect; |
| 80 | void (*cs_control)(struct spi_device *spi, bool on); | 85 | void (*cs_control)(struct spi_device *spi, bool on); |
| @@ -90,6 +95,10 @@ struct mpc8xx_pcmcia_ops { | |||
| 90 | * lead to a deep sleep (i.e. power removed from the core, | 95 | * lead to a deep sleep (i.e. power removed from the core, |
| 91 | * instead of just the clock). | 96 | * instead of just the clock). |
| 92 | */ | 97 | */ |
| 98 | #if defined(CONFIG_PPC_83xx) && defined(CONFIG_SUSPEND) | ||
| 93 | int fsl_deep_sleep(void); | 99 | int fsl_deep_sleep(void); |
| 100 | #else | ||
| 101 | static inline int fsl_deep_sleep(void) { return 0; } | ||
| 102 | #endif | ||
| 94 | 103 | ||
| 95 | #endif /* _FSL_DEVICE_H_ */ | 104 | #endif /* _FSL_DEVICE_H_ */ |
diff --git a/include/linux/fsnotify.h b/include/linux/fsnotify.h index 936f9aa8bb97..01755909ce81 100644 --- a/include/linux/fsnotify.h +++ b/include/linux/fsnotify.h | |||
| @@ -15,6 +15,7 @@ | |||
| 15 | #include <linux/inotify.h> | 15 | #include <linux/inotify.h> |
| 16 | #include <linux/fsnotify_backend.h> | 16 | #include <linux/fsnotify_backend.h> |
| 17 | #include <linux/audit.h> | 17 | #include <linux/audit.h> |
| 18 | #include <linux/slab.h> | ||
| 18 | 19 | ||
| 19 | /* | 20 | /* |
| 20 | * fsnotify_d_instantiate - instantiate a dentry for inode | 21 | * fsnotify_d_instantiate - instantiate a dentry for inode |
| @@ -65,7 +66,7 @@ static inline void fsnotify_link_count(struct inode *inode) | |||
| 65 | * fsnotify_move - file old_name at old_dir was moved to new_name at new_dir | 66 | * fsnotify_move - file old_name at old_dir was moved to new_name at new_dir |
| 66 | */ | 67 | */ |
| 67 | static inline void fsnotify_move(struct inode *old_dir, struct inode *new_dir, | 68 | static inline void fsnotify_move(struct inode *old_dir, struct inode *new_dir, |
| 68 | const char *old_name, const char *new_name, | 69 | const char *old_name, |
| 69 | int isdir, struct inode *target, struct dentry *moved) | 70 | int isdir, struct inode *target, struct dentry *moved) |
| 70 | { | 71 | { |
| 71 | struct inode *source = moved->d_inode; | 72 | struct inode *source = moved->d_inode; |
| @@ -73,6 +74,7 @@ static inline void fsnotify_move(struct inode *old_dir, struct inode *new_dir, | |||
| 73 | u32 fs_cookie = fsnotify_get_cookie(); | 74 | u32 fs_cookie = fsnotify_get_cookie(); |
| 74 | __u32 old_dir_mask = (FS_EVENT_ON_CHILD | FS_MOVED_FROM); | 75 | __u32 old_dir_mask = (FS_EVENT_ON_CHILD | FS_MOVED_FROM); |
| 75 | __u32 new_dir_mask = (FS_EVENT_ON_CHILD | FS_MOVED_TO); | 76 | __u32 new_dir_mask = (FS_EVENT_ON_CHILD | FS_MOVED_TO); |
| 77 | const char *new_name = moved->d_name.name; | ||
| 76 | 78 | ||
| 77 | if (old_dir == new_dir) | 79 | if (old_dir == new_dir) |
| 78 | old_dir_mask |= FS_DN_RENAME; | 80 | old_dir_mask |= FS_DN_RENAME; |
| @@ -103,7 +105,7 @@ static inline void fsnotify_move(struct inode *old_dir, struct inode *new_dir, | |||
| 103 | inotify_inode_queue_event(source, IN_MOVE_SELF, 0, NULL, NULL); | 105 | inotify_inode_queue_event(source, IN_MOVE_SELF, 0, NULL, NULL); |
| 104 | fsnotify(source, FS_MOVE_SELF, moved->d_inode, FSNOTIFY_EVENT_INODE, NULL, 0); | 106 | fsnotify(source, FS_MOVE_SELF, moved->d_inode, FSNOTIFY_EVENT_INODE, NULL, 0); |
| 105 | } | 107 | } |
| 106 | audit_inode_child(new_name, moved, new_dir); | 108 | audit_inode_child(moved, new_dir); |
| 107 | } | 109 | } |
| 108 | 110 | ||
| 109 | /* | 111 | /* |
| @@ -146,7 +148,7 @@ static inline void fsnotify_create(struct inode *inode, struct dentry *dentry) | |||
| 146 | { | 148 | { |
| 147 | inotify_inode_queue_event(inode, IN_CREATE, 0, dentry->d_name.name, | 149 | inotify_inode_queue_event(inode, IN_CREATE, 0, dentry->d_name.name, |
| 148 | dentry->d_inode); | 150 | dentry->d_inode); |
| 149 | audit_inode_child(dentry->d_name.name, dentry, inode); | 151 | audit_inode_child(dentry, inode); |
| 150 | 152 | ||
| 151 | fsnotify(inode, FS_CREATE, dentry->d_inode, FSNOTIFY_EVENT_INODE, dentry->d_name.name, 0); | 153 | fsnotify(inode, FS_CREATE, dentry->d_inode, FSNOTIFY_EVENT_INODE, dentry->d_name.name, 0); |
| 152 | } | 154 | } |
| @@ -161,7 +163,7 @@ static inline void fsnotify_link(struct inode *dir, struct inode *inode, struct | |||
| 161 | inotify_inode_queue_event(dir, IN_CREATE, 0, new_dentry->d_name.name, | 163 | inotify_inode_queue_event(dir, IN_CREATE, 0, new_dentry->d_name.name, |
| 162 | inode); | 164 | inode); |
| 163 | fsnotify_link_count(inode); | 165 | fsnotify_link_count(inode); |
| 164 | audit_inode_child(new_dentry->d_name.name, new_dentry, dir); | 166 | audit_inode_child(new_dentry, dir); |
| 165 | 167 | ||
| 166 | fsnotify(dir, FS_CREATE, inode, FSNOTIFY_EVENT_INODE, new_dentry->d_name.name, 0); | 168 | fsnotify(dir, FS_CREATE, inode, FSNOTIFY_EVENT_INODE, new_dentry->d_name.name, 0); |
| 167 | } | 169 | } |
| @@ -175,7 +177,7 @@ static inline void fsnotify_mkdir(struct inode *inode, struct dentry *dentry) | |||
| 175 | struct inode *d_inode = dentry->d_inode; | 177 | struct inode *d_inode = dentry->d_inode; |
| 176 | 178 | ||
| 177 | inotify_inode_queue_event(inode, mask, 0, dentry->d_name.name, d_inode); | 179 | inotify_inode_queue_event(inode, mask, 0, dentry->d_name.name, d_inode); |
| 178 | audit_inode_child(dentry->d_name.name, dentry, inode); | 180 | audit_inode_child(dentry, inode); |
| 179 | 181 | ||
| 180 | fsnotify(inode, mask, d_inode, FSNOTIFY_EVENT_INODE, dentry->d_name.name, 0); | 182 | fsnotify(inode, mask, d_inode, FSNOTIFY_EVENT_INODE, dentry->d_name.name, 0); |
| 181 | } | 183 | } |
diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h index 0b4f97d24d7f..01e6adea07ec 100644 --- a/include/linux/ftrace.h +++ b/include/linux/ftrace.h | |||
| @@ -134,6 +134,8 @@ extern void | |||
| 134 | unregister_ftrace_function_probe_func(char *glob, struct ftrace_probe_ops *ops); | 134 | unregister_ftrace_function_probe_func(char *glob, struct ftrace_probe_ops *ops); |
| 135 | extern void unregister_ftrace_function_probe_all(char *glob); | 135 | extern void unregister_ftrace_function_probe_all(char *glob); |
| 136 | 136 | ||
| 137 | extern int ftrace_text_reserved(void *start, void *end); | ||
| 138 | |||
| 137 | enum { | 139 | enum { |
| 138 | FTRACE_FL_FREE = (1 << 0), | 140 | FTRACE_FL_FREE = (1 << 0), |
| 139 | FTRACE_FL_FAILED = (1 << 1), | 141 | FTRACE_FL_FAILED = (1 << 1), |
| @@ -141,7 +143,6 @@ enum { | |||
| 141 | FTRACE_FL_ENABLED = (1 << 3), | 143 | FTRACE_FL_ENABLED = (1 << 3), |
| 142 | FTRACE_FL_NOTRACE = (1 << 4), | 144 | FTRACE_FL_NOTRACE = (1 << 4), |
| 143 | FTRACE_FL_CONVERTED = (1 << 5), | 145 | FTRACE_FL_CONVERTED = (1 << 5), |
| 144 | FTRACE_FL_FROZEN = (1 << 6), | ||
| 145 | }; | 146 | }; |
| 146 | 147 | ||
| 147 | struct dyn_ftrace { | 148 | struct dyn_ftrace { |
| @@ -250,6 +251,10 @@ static inline int unregister_ftrace_command(char *cmd_name) | |||
| 250 | { | 251 | { |
| 251 | return -EINVAL; | 252 | return -EINVAL; |
| 252 | } | 253 | } |
| 254 | static inline int ftrace_text_reserved(void *start, void *end) | ||
| 255 | { | ||
| 256 | return 0; | ||
| 257 | } | ||
| 253 | #endif /* CONFIG_DYNAMIC_FTRACE */ | 258 | #endif /* CONFIG_DYNAMIC_FTRACE */ |
| 254 | 259 | ||
| 255 | /* totally disable ftrace - can not re-enable after this */ | 260 | /* totally disable ftrace - can not re-enable after this */ |
| @@ -511,4 +516,10 @@ static inline void trace_hw_branch_oops(void) {} | |||
| 511 | 516 | ||
| 512 | #endif /* CONFIG_HW_BRANCH_TRACER */ | 517 | #endif /* CONFIG_HW_BRANCH_TRACER */ |
| 513 | 518 | ||
| 519 | #ifdef CONFIG_FTRACE_SYSCALLS | ||
| 520 | |||
| 521 | unsigned long arch_syscall_addr(int nr); | ||
| 522 | |||
| 523 | #endif /* CONFIG_FTRACE_SYSCALLS */ | ||
| 524 | |||
| 514 | #endif /* _LINUX_FTRACE_H */ | 525 | #endif /* _LINUX_FTRACE_H */ |
diff --git a/include/linux/ftrace_event.h b/include/linux/ftrace_event.h index 4ec5e67e18cf..c0f4b364c711 100644 --- a/include/linux/ftrace_event.h +++ b/include/linux/ftrace_event.h | |||
| @@ -5,6 +5,7 @@ | |||
| 5 | #include <linux/trace_seq.h> | 5 | #include <linux/trace_seq.h> |
| 6 | #include <linux/percpu.h> | 6 | #include <linux/percpu.h> |
| 7 | #include <linux/hardirq.h> | 7 | #include <linux/hardirq.h> |
| 8 | #include <linux/perf_event.h> | ||
| 8 | 9 | ||
| 9 | struct trace_array; | 10 | struct trace_array; |
| 10 | struct tracer; | 11 | struct tracer; |
| @@ -57,6 +58,7 @@ struct trace_iterator { | |||
| 57 | /* The below is zeroed out in pipe_read */ | 58 | /* The below is zeroed out in pipe_read */ |
| 58 | struct trace_seq seq; | 59 | struct trace_seq seq; |
| 59 | struct trace_entry *ent; | 60 | struct trace_entry *ent; |
| 61 | int leftover; | ||
| 60 | int cpu; | 62 | int cpu; |
| 61 | u64 ts; | 63 | u64 ts; |
| 62 | 64 | ||
| @@ -117,12 +119,11 @@ struct ftrace_event_call { | |||
| 117 | struct dentry *dir; | 119 | struct dentry *dir; |
| 118 | struct trace_event *event; | 120 | struct trace_event *event; |
| 119 | int enabled; | 121 | int enabled; |
| 120 | int (*regfunc)(void *); | 122 | int (*regfunc)(struct ftrace_event_call *); |
| 121 | void (*unregfunc)(void *); | 123 | void (*unregfunc)(struct ftrace_event_call *); |
| 122 | int id; | 124 | int id; |
| 123 | int (*raw_init)(void); | 125 | const char *print_fmt; |
| 124 | int (*show_format)(struct ftrace_event_call *call, | 126 | int (*raw_init)(struct ftrace_event_call *); |
| 125 | struct trace_seq *s); | ||
| 126 | int (*define_fields)(struct ftrace_event_call *); | 127 | int (*define_fields)(struct ftrace_event_call *); |
| 127 | struct list_head fields; | 128 | struct list_head fields; |
| 128 | int filter_active; | 129 | int filter_active; |
| @@ -130,21 +131,18 @@ struct ftrace_event_call { | |||
| 130 | void *mod; | 131 | void *mod; |
| 131 | void *data; | 132 | void *data; |
| 132 | 133 | ||
| 133 | atomic_t profile_count; | 134 | int perf_refcount; |
| 134 | int (*profile_enable)(void); | 135 | int (*perf_event_enable)(struct ftrace_event_call *); |
| 135 | void (*profile_disable)(void); | 136 | void (*perf_event_disable)(struct ftrace_event_call *); |
| 136 | }; | 137 | }; |
| 137 | 138 | ||
| 138 | #define FTRACE_MAX_PROFILE_SIZE 2048 | 139 | #define PERF_MAX_TRACE_SIZE 2048 |
| 139 | |||
| 140 | extern char *trace_profile_buf; | ||
| 141 | extern char *trace_profile_buf_nmi; | ||
| 142 | 140 | ||
| 143 | #define MAX_FILTER_PRED 32 | 141 | #define MAX_FILTER_PRED 32 |
| 144 | #define MAX_FILTER_STR_VAL 256 /* Should handle KSYM_SYMBOL_LEN */ | 142 | #define MAX_FILTER_STR_VAL 256 /* Should handle KSYM_SYMBOL_LEN */ |
| 145 | 143 | ||
| 146 | extern void destroy_preds(struct ftrace_event_call *call); | 144 | extern void destroy_preds(struct ftrace_event_call *call); |
| 147 | extern int filter_match_preds(struct ftrace_event_call *call, void *rec); | 145 | extern int filter_match_preds(struct event_filter *filter, void *rec); |
| 148 | extern int filter_current_check_discard(struct ring_buffer *buffer, | 146 | extern int filter_current_check_discard(struct ring_buffer *buffer, |
| 149 | struct ftrace_event_call *call, | 147 | struct ftrace_event_call *call, |
| 150 | void *rec, | 148 | void *rec, |
| @@ -157,11 +155,12 @@ enum { | |||
| 157 | FILTER_PTR_STRING, | 155 | FILTER_PTR_STRING, |
| 158 | }; | 156 | }; |
| 159 | 157 | ||
| 160 | extern int trace_define_field(struct ftrace_event_call *call, | 158 | extern int trace_event_raw_init(struct ftrace_event_call *call); |
| 161 | const char *type, const char *name, | 159 | extern int trace_define_field(struct ftrace_event_call *call, const char *type, |
| 162 | int offset, int size, int is_signed, | 160 | const char *name, int offset, int size, |
| 163 | int filter_type); | 161 | int is_signed, int filter_type); |
| 164 | extern int trace_define_common_fields(struct ftrace_event_call *call); | 162 | extern int trace_add_event_call(struct ftrace_event_call *call); |
| 163 | extern void trace_remove_event_call(struct ftrace_event_call *call); | ||
| 165 | 164 | ||
| 166 | #define is_signed_type(type) (((type)(-1)) < 0) | 165 | #define is_signed_type(type) (((type)(-1)) < 0) |
| 167 | 166 | ||
| @@ -186,4 +185,30 @@ do { \ | |||
| 186 | __trace_printk(ip, fmt, ##args); \ | 185 | __trace_printk(ip, fmt, ##args); \ |
| 187 | } while (0) | 186 | } while (0) |
| 188 | 187 | ||
| 188 | #ifdef CONFIG_PERF_EVENTS | ||
| 189 | struct perf_event; | ||
| 190 | |||
| 191 | DECLARE_PER_CPU(struct pt_regs, perf_trace_regs); | ||
| 192 | |||
| 193 | extern int perf_trace_enable(int event_id); | ||
| 194 | extern void perf_trace_disable(int event_id); | ||
| 195 | extern int ftrace_profile_set_filter(struct perf_event *event, int event_id, | ||
| 196 | char *filter_str); | ||
| 197 | extern void ftrace_profile_free_filter(struct perf_event *event); | ||
| 198 | extern void * | ||
| 199 | perf_trace_buf_prepare(int size, unsigned short type, int *rctxp, | ||
| 200 | unsigned long *irq_flags); | ||
| 201 | |||
| 202 | static inline void | ||
| 203 | perf_trace_buf_submit(void *raw_data, int size, int rctx, u64 addr, | ||
| 204 | u64 count, unsigned long irq_flags, struct pt_regs *regs) | ||
| 205 | { | ||
| 206 | struct trace_entry *entry = raw_data; | ||
| 207 | |||
| 208 | perf_tp_event(entry->type, addr, count, raw_data, size, regs); | ||
| 209 | perf_swevent_put_recursion_context(rctx); | ||
| 210 | local_irq_restore(irq_flags); | ||
| 211 | } | ||
| 212 | #endif | ||
| 213 | |||
| 189 | #endif /* _LINUX_FTRACE_EVENT_H */ | 214 | #endif /* _LINUX_FTRACE_EVENT_H */ |
diff --git a/include/linux/gameport.h b/include/linux/gameport.h index 1bc08541c2b9..361d1cc288d0 100644 --- a/include/linux/gameport.h +++ b/include/linux/gameport.h | |||
| @@ -16,6 +16,7 @@ | |||
| 16 | #include <linux/mutex.h> | 16 | #include <linux/mutex.h> |
| 17 | #include <linux/device.h> | 17 | #include <linux/device.h> |
| 18 | #include <linux/timer.h> | 18 | #include <linux/timer.h> |
| 19 | #include <linux/slab.h> | ||
| 19 | 20 | ||
| 20 | struct gameport { | 21 | struct gameport { |
| 21 | 22 | ||
| @@ -46,7 +47,6 @@ struct gameport { | |||
| 46 | struct mutex drv_mutex; /* protects serio->drv so attributes can pin driver */ | 47 | struct mutex drv_mutex; /* protects serio->drv so attributes can pin driver */ |
| 47 | 48 | ||
| 48 | struct device dev; | 49 | struct device dev; |
| 49 | unsigned int registered; /* port has been fully registered with driver core */ | ||
| 50 | 50 | ||
| 51 | struct list_head node; | 51 | struct list_head node; |
| 52 | }; | 52 | }; |
diff --git a/include/linux/gen_stats.h b/include/linux/gen_stats.h index 710e901085d0..552c8a0a12d1 100644 --- a/include/linux/gen_stats.h +++ b/include/linux/gen_stats.h | |||
| @@ -18,13 +18,11 @@ enum { | |||
| 18 | * @bytes: number of seen bytes | 18 | * @bytes: number of seen bytes |
| 19 | * @packets: number of seen packets | 19 | * @packets: number of seen packets |
| 20 | */ | 20 | */ |
| 21 | struct gnet_stats_basic | 21 | struct gnet_stats_basic { |
| 22 | { | ||
| 23 | __u64 bytes; | 22 | __u64 bytes; |
| 24 | __u32 packets; | 23 | __u32 packets; |
| 25 | }; | 24 | }; |
| 26 | struct gnet_stats_basic_packed | 25 | struct gnet_stats_basic_packed { |
| 27 | { | ||
| 28 | __u64 bytes; | 26 | __u64 bytes; |
| 29 | __u32 packets; | 27 | __u32 packets; |
| 30 | } __attribute__ ((packed)); | 28 | } __attribute__ ((packed)); |
| @@ -34,8 +32,7 @@ struct gnet_stats_basic_packed | |||
| 34 | * @bps: current byte rate | 32 | * @bps: current byte rate |
| 35 | * @pps: current packet rate | 33 | * @pps: current packet rate |
| 36 | */ | 34 | */ |
| 37 | struct gnet_stats_rate_est | 35 | struct gnet_stats_rate_est { |
| 38 | { | ||
| 39 | __u32 bps; | 36 | __u32 bps; |
| 40 | __u32 pps; | 37 | __u32 pps; |
| 41 | }; | 38 | }; |
| @@ -48,8 +45,7 @@ struct gnet_stats_rate_est | |||
| 48 | * @requeues: number of requeues | 45 | * @requeues: number of requeues |
| 49 | * @overlimits: number of enqueues over the limit | 46 | * @overlimits: number of enqueues over the limit |
| 50 | */ | 47 | */ |
| 51 | struct gnet_stats_queue | 48 | struct gnet_stats_queue { |
| 52 | { | ||
| 53 | __u32 qlen; | 49 | __u32 qlen; |
| 54 | __u32 backlog; | 50 | __u32 backlog; |
| 55 | __u32 drops; | 51 | __u32 drops; |
| @@ -62,8 +58,7 @@ struct gnet_stats_queue | |||
| 62 | * @interval: sampling period | 58 | * @interval: sampling period |
| 63 | * @ewma_log: the log of measurement window weight | 59 | * @ewma_log: the log of measurement window weight |
| 64 | */ | 60 | */ |
| 65 | struct gnet_estimator | 61 | struct gnet_estimator { |
| 66 | { | ||
| 67 | signed char interval; | 62 | signed char interval; |
| 68 | unsigned char ewma_log; | 63 | unsigned char ewma_log; |
| 69 | }; | 64 | }; |
diff --git a/include/linux/generic_acl.h b/include/linux/generic_acl.h index 886f5faa08cb..ca666d18ed67 100644 --- a/include/linux/generic_acl.h +++ b/include/linux/generic_acl.h | |||
| @@ -1,36 +1,15 @@ | |||
| 1 | /* | 1 | #ifndef LINUX_GENERIC_ACL_H |
| 2 | * include/linux/generic_acl.h | 2 | #define LINUX_GENERIC_ACL_H |
| 3 | * | ||
| 4 | * (C) 2005 Andreas Gruenbacher <agruen@suse.de> | ||
| 5 | * | ||
| 6 | * This file is released under the GPL. | ||
| 7 | */ | ||
| 8 | 3 | ||
| 9 | #ifndef GENERIC_ACL_H | 4 | #include <linux/xattr.h> |
| 10 | #define GENERIC_ACL_H | ||
| 11 | 5 | ||
| 12 | #include <linux/posix_acl.h> | 6 | struct inode; |
| 13 | #include <linux/posix_acl_xattr.h> | ||
| 14 | 7 | ||
| 15 | /** | 8 | extern struct xattr_handler generic_acl_access_handler; |
| 16 | * struct generic_acl_operations - filesystem operations | 9 | extern struct xattr_handler generic_acl_default_handler; |
| 17 | * | ||
| 18 | * Filesystems must make these operations available to the generic | ||
| 19 | * operations. | ||
| 20 | */ | ||
| 21 | struct generic_acl_operations { | ||
| 22 | struct posix_acl *(*getacl)(struct inode *, int); | ||
| 23 | void (*setacl)(struct inode *, int, struct posix_acl *); | ||
| 24 | }; | ||
| 25 | 10 | ||
| 26 | size_t generic_acl_list(struct inode *, struct generic_acl_operations *, int, | 11 | int generic_acl_init(struct inode *, struct inode *); |
| 27 | char *, size_t); | 12 | int generic_acl_chmod(struct inode *); |
| 28 | int generic_acl_get(struct inode *, struct generic_acl_operations *, int, | 13 | int generic_check_acl(struct inode *inode, int mask); |
| 29 | void *, size_t); | ||
| 30 | int generic_acl_set(struct inode *, struct generic_acl_operations *, int, | ||
| 31 | const void *, size_t); | ||
| 32 | int generic_acl_init(struct inode *, struct inode *, | ||
| 33 | struct generic_acl_operations *); | ||
| 34 | int generic_acl_chmod(struct inode *, struct generic_acl_operations *); | ||
| 35 | 14 | ||
| 36 | #endif | 15 | #endif /* LINUX_GENERIC_ACL_H */ |
diff --git a/include/linux/genhd.h b/include/linux/genhd.h index 297df45ffd0a..5f2f4c4d8fb0 100644 --- a/include/linux/genhd.h +++ b/include/linux/genhd.h | |||
| @@ -91,6 +91,7 @@ struct hd_struct { | |||
| 91 | sector_t start_sect; | 91 | sector_t start_sect; |
| 92 | sector_t nr_sects; | 92 | sector_t nr_sects; |
| 93 | sector_t alignment_offset; | 93 | sector_t alignment_offset; |
| 94 | unsigned int discard_alignment; | ||
| 94 | struct device __dev; | 95 | struct device __dev; |
| 95 | struct kobject *holder_dir; | 96 | struct kobject *holder_dir; |
| 96 | int policy, partno; | 97 | int policy, partno; |
| @@ -100,7 +101,7 @@ struct hd_struct { | |||
| 100 | unsigned long stamp; | 101 | unsigned long stamp; |
| 101 | int in_flight[2]; | 102 | int in_flight[2]; |
| 102 | #ifdef CONFIG_SMP | 103 | #ifdef CONFIG_SMP |
| 103 | struct disk_stats *dkstats; | 104 | struct disk_stats __percpu *dkstats; |
| 104 | #else | 105 | #else |
| 105 | struct disk_stats dkstats; | 106 | struct disk_stats dkstats; |
| 106 | #endif | 107 | #endif |
| @@ -108,7 +109,7 @@ struct hd_struct { | |||
| 108 | }; | 109 | }; |
| 109 | 110 | ||
| 110 | #define GENHD_FL_REMOVABLE 1 | 111 | #define GENHD_FL_REMOVABLE 1 |
| 111 | #define GENHD_FL_DRIVERFS 2 | 112 | /* 2 is unused */ |
| 112 | #define GENHD_FL_MEDIA_CHANGE_NOTIFY 4 | 113 | #define GENHD_FL_MEDIA_CHANGE_NOTIFY 4 |
| 113 | #define GENHD_FL_CD 8 | 114 | #define GENHD_FL_CD 8 |
| 114 | #define GENHD_FL_UP 16 | 115 | #define GENHD_FL_UP 16 |
| @@ -255,9 +256,9 @@ extern struct hd_struct *disk_map_sector_rcu(struct gendisk *disk, | |||
| 255 | #define part_stat_read(part, field) \ | 256 | #define part_stat_read(part, field) \ |
| 256 | ({ \ | 257 | ({ \ |
| 257 | typeof((part)->dkstats->field) res = 0; \ | 258 | typeof((part)->dkstats->field) res = 0; \ |
| 258 | int i; \ | 259 | unsigned int _cpu; \ |
| 259 | for_each_possible_cpu(i) \ | 260 | for_each_possible_cpu(_cpu) \ |
| 260 | res += per_cpu_ptr((part)->dkstats, i)->field; \ | 261 | res += per_cpu_ptr((part)->dkstats, _cpu)->field; \ |
| 261 | res; \ | 262 | res; \ |
| 262 | }) | 263 | }) |
| 263 | 264 | ||
diff --git a/include/linux/gfp.h b/include/linux/gfp.h index 557bdad320b6..4c6d41333f98 100644 --- a/include/linux/gfp.h +++ b/include/linux/gfp.h | |||
| @@ -30,7 +30,8 @@ struct vm_area_struct; | |||
| 30 | * _might_ fail. This depends upon the particular VM implementation. | 30 | * _might_ fail. This depends upon the particular VM implementation. |
| 31 | * | 31 | * |
| 32 | * __GFP_NOFAIL: The VM implementation _must_ retry infinitely: the caller | 32 | * __GFP_NOFAIL: The VM implementation _must_ retry infinitely: the caller |
| 33 | * cannot handle allocation failures. | 33 | * cannot handle allocation failures. This modifier is deprecated and no new |
| 34 | * users should be added. | ||
| 34 | * | 35 | * |
| 35 | * __GFP_NORETRY: The VM implementation must not retry indefinitely. | 36 | * __GFP_NORETRY: The VM implementation must not retry indefinitely. |
| 36 | * | 37 | * |
| @@ -83,6 +84,7 @@ struct vm_area_struct; | |||
| 83 | #define GFP_HIGHUSER_MOVABLE (__GFP_WAIT | __GFP_IO | __GFP_FS | \ | 84 | #define GFP_HIGHUSER_MOVABLE (__GFP_WAIT | __GFP_IO | __GFP_FS | \ |
| 84 | __GFP_HARDWALL | __GFP_HIGHMEM | \ | 85 | __GFP_HARDWALL | __GFP_HIGHMEM | \ |
| 85 | __GFP_MOVABLE) | 86 | __GFP_MOVABLE) |
| 87 | #define GFP_IOFS (__GFP_IO | __GFP_FS) | ||
| 86 | 88 | ||
| 87 | #ifdef CONFIG_NUMA | 89 | #ifdef CONFIG_NUMA |
| 88 | #define GFP_THISNODE (__GFP_THISNODE | __GFP_NOWARN | __GFP_NORETRY) | 90 | #define GFP_THISNODE (__GFP_THISNODE | __GFP_NOWARN | __GFP_NORETRY) |
| @@ -325,7 +327,7 @@ void free_pages_exact(void *virt, size_t size); | |||
| 325 | 327 | ||
| 326 | extern void __free_pages(struct page *page, unsigned int order); | 328 | extern void __free_pages(struct page *page, unsigned int order); |
| 327 | extern void free_pages(unsigned long addr, unsigned int order); | 329 | extern void free_pages(unsigned long addr, unsigned int order); |
| 328 | extern void free_hot_page(struct page *page); | 330 | extern void free_hot_cold_page(struct page *page, int cold); |
| 329 | 331 | ||
| 330 | #define __free_page(page) __free_pages((page), 0) | 332 | #define __free_page(page) __free_pages((page), 0) |
| 331 | #define free_page(addr) free_pages((addr),0) | 333 | #define free_page(addr) free_pages((addr),0) |
| @@ -337,9 +339,7 @@ void drain_local_pages(void *dummy); | |||
| 337 | 339 | ||
| 338 | extern gfp_t gfp_allowed_mask; | 340 | extern gfp_t gfp_allowed_mask; |
| 339 | 341 | ||
| 340 | static inline void set_gfp_allowed_mask(gfp_t mask) | 342 | extern void set_gfp_allowed_mask(gfp_t mask); |
| 341 | { | 343 | extern gfp_t clear_gfp_allowed_mask(gfp_t mask); |
| 342 | gfp_allowed_mask = mask; | ||
| 343 | } | ||
| 344 | 344 | ||
| 345 | #endif /* __LINUX_GFP_H */ | 345 | #endif /* __LINUX_GFP_H */ |
diff --git a/include/linux/gfs2_ondisk.h b/include/linux/gfs2_ondisk.h index b80c88dedbbb..4f4462974c14 100644 --- a/include/linux/gfs2_ondisk.h +++ b/include/linux/gfs2_ondisk.h | |||
| @@ -81,7 +81,11 @@ struct gfs2_meta_header { | |||
| 81 | __be32 mh_type; | 81 | __be32 mh_type; |
| 82 | __be64 __pad0; /* Was generation number in gfs1 */ | 82 | __be64 __pad0; /* Was generation number in gfs1 */ |
| 83 | __be32 mh_format; | 83 | __be32 mh_format; |
| 84 | __be32 __pad1; /* Was incarnation number in gfs1 */ | 84 | /* This union is to keep userspace happy */ |
| 85 | union { | ||
| 86 | __be32 mh_jid; /* Was incarnation number in gfs1 */ | ||
| 87 | __be32 __pad1; | ||
| 88 | }; | ||
| 85 | }; | 89 | }; |
| 86 | 90 | ||
| 87 | /* | 91 | /* |
| @@ -176,33 +180,6 @@ struct gfs2_rgrp { | |||
| 176 | }; | 180 | }; |
| 177 | 181 | ||
| 178 | /* | 182 | /* |
| 179 | * quota linked list: user quotas and group quotas form two separate | ||
| 180 | * singly linked lists. ll_next stores uids or gids of next quotas in the | ||
| 181 | * linked list. | ||
| 182 | |||
| 183 | Given the uid/gid, how to calculate the quota file offsets for the corresponding | ||
| 184 | gfs2_quota structures on disk: | ||
| 185 | |||
| 186 | for user quotas, given uid, | ||
| 187 | offset = uid * sizeof(struct gfs2_quota); | ||
| 188 | |||
| 189 | for group quotas, given gid, | ||
| 190 | offset = (gid * sizeof(struct gfs2_quota)) + sizeof(struct gfs2_quota); | ||
| 191 | |||
| 192 | |||
| 193 | uid:0 gid:0 uid:12 gid:12 uid:17 gid:17 uid:5142 gid:5142 | ||
| 194 | +-------+-------+ +-------+-------+ +-------+- - - -+ +- - - -+-------+ | ||
| 195 | | valid | valid | :: | valid | valid | :: | valid | inval | :: | inval | valid | | ||
| 196 | +-------+-------+ +-------+-------+ +-------+- - - -+ +- - - -+-------+ | ||
| 197 | next:12 next:12 next:17 next:5142 next:NULL next:NULL | ||
| 198 | | | | | |<-- user quota list | | ||
| 199 | \______|___________/ \______|___________/ group quota list -->| | ||
| 200 | | | | | ||
| 201 | \__________________/ \_______________________________________/ | ||
| 202 | |||
| 203 | */ | ||
| 204 | |||
| 205 | /* | ||
| 206 | * quota structure | 183 | * quota structure |
| 207 | */ | 184 | */ |
| 208 | 185 | ||
| @@ -210,8 +187,7 @@ struct gfs2_quota { | |||
| 210 | __be64 qu_limit; | 187 | __be64 qu_limit; |
| 211 | __be64 qu_warn; | 188 | __be64 qu_warn; |
| 212 | __be64 qu_value; | 189 | __be64 qu_value; |
| 213 | __be32 qu_ll_next; /* location of next quota in list */ | 190 | __u8 qu_reserved[64]; |
| 214 | __u8 qu_reserved[60]; | ||
| 215 | }; | 191 | }; |
| 216 | 192 | ||
| 217 | /* | 193 | /* |
diff --git a/include/linux/gigaset_dev.h b/include/linux/gigaset_dev.h index 5dc4a316ca37..258ba82937e7 100644 --- a/include/linux/gigaset_dev.h +++ b/include/linux/gigaset_dev.h | |||
| @@ -16,15 +16,23 @@ | |||
| 16 | 16 | ||
| 17 | #include <linux/ioctl.h> | 17 | #include <linux/ioctl.h> |
| 18 | 18 | ||
| 19 | /* The magic IOCTL value for this interface. */ | ||
| 19 | #define GIGASET_IOCTL 0x47 | 20 | #define GIGASET_IOCTL 0x47 |
| 20 | 21 | ||
| 21 | #define GIGVER_DRIVER 0 | 22 | /* enable/disable device control via character device (lock out ISDN subsys) */ |
| 22 | #define GIGVER_COMPAT 1 | 23 | #define GIGASET_REDIR _IOWR(GIGASET_IOCTL, 0, int) |
| 23 | #define GIGVER_FWBASE 2 | ||
| 24 | 24 | ||
| 25 | #define GIGASET_REDIR _IOWR (GIGASET_IOCTL, 0, int) | 25 | /* enable adapter configuration mode (M10x only) */ |
| 26 | #define GIGASET_CONFIG _IOWR (GIGASET_IOCTL, 1, int) | 26 | #define GIGASET_CONFIG _IOWR(GIGASET_IOCTL, 1, int) |
| 27 | #define GIGASET_BRKCHARS _IOW (GIGASET_IOCTL, 2, unsigned char[6]) //FIXME [6] okay? | 27 | |
| 28 | #define GIGASET_VERSION _IOWR (GIGASET_IOCTL, 3, unsigned[4]) | 28 | /* set break characters (M105 only) */ |
| 29 | #define GIGASET_BRKCHARS _IOW(GIGASET_IOCTL, 2, unsigned char[6]) | ||
| 30 | |||
| 31 | /* get version information selected by arg[0] */ | ||
| 32 | #define GIGASET_VERSION _IOWR(GIGASET_IOCTL, 3, unsigned[4]) | ||
| 33 | /* values for GIGASET_VERSION arg[0] */ | ||
| 34 | #define GIGVER_DRIVER 0 /* get driver version */ | ||
| 35 | #define GIGVER_COMPAT 1 /* get interface compatibility version */ | ||
| 36 | #define GIGVER_FWBASE 2 /* get base station firmware version */ | ||
| 29 | 37 | ||
| 30 | #endif | 38 | #endif |
diff --git a/include/linux/gpio.h b/include/linux/gpio.h index 059bd189d35d..4e949a5b5b85 100644 --- a/include/linux/gpio.h +++ b/include/linux/gpio.h | |||
| @@ -99,6 +99,12 @@ static inline int gpio_export_link(struct device *dev, const char *name, | |||
| 99 | return -EINVAL; | 99 | return -EINVAL; |
| 100 | } | 100 | } |
| 101 | 101 | ||
| 102 | static inline int gpio_sysfs_set_active_low(unsigned gpio, int value) | ||
| 103 | { | ||
| 104 | /* GPIO can never have been requested */ | ||
| 105 | WARN_ON(1); | ||
| 106 | return -EINVAL; | ||
| 107 | } | ||
| 102 | 108 | ||
| 103 | static inline void gpio_unexport(unsigned gpio) | 109 | static inline void gpio_unexport(unsigned gpio) |
| 104 | { | 110 | { |
diff --git a/include/linux/gpio_keys.h b/include/linux/gpio_keys.h index 1289fa7623ca..cd0b3f30f48e 100644 --- a/include/linux/gpio_keys.h +++ b/include/linux/gpio_keys.h | |||
| @@ -10,6 +10,7 @@ struct gpio_keys_button { | |||
| 10 | int type; /* input event type (EV_KEY, EV_SW) */ | 10 | int type; /* input event type (EV_KEY, EV_SW) */ |
| 11 | int wakeup; /* configure the button as a wake-up source */ | 11 | int wakeup; /* configure the button as a wake-up source */ |
| 12 | int debounce_interval; /* debounce ticks interval in msecs */ | 12 | int debounce_interval; /* debounce ticks interval in msecs */ |
| 13 | bool can_disable; | ||
| 13 | }; | 14 | }; |
| 14 | 15 | ||
| 15 | struct gpio_keys_platform_data { | 16 | struct gpio_keys_platform_data { |
diff --git a/include/linux/hardirq.h b/include/linux/hardirq.h index 6d527ee82b2b..d5b387669dab 100644 --- a/include/linux/hardirq.h +++ b/include/linux/hardirq.h | |||
| @@ -139,10 +139,34 @@ static inline void account_system_vtime(struct task_struct *tsk) | |||
| 139 | #endif | 139 | #endif |
| 140 | 140 | ||
| 141 | #if defined(CONFIG_NO_HZ) | 141 | #if defined(CONFIG_NO_HZ) |
| 142 | #if defined(CONFIG_TINY_RCU) | ||
| 143 | extern void rcu_enter_nohz(void); | ||
| 144 | extern void rcu_exit_nohz(void); | ||
| 145 | |||
| 146 | static inline void rcu_irq_enter(void) | ||
| 147 | { | ||
| 148 | rcu_exit_nohz(); | ||
| 149 | } | ||
| 150 | |||
| 151 | static inline void rcu_irq_exit(void) | ||
| 152 | { | ||
| 153 | rcu_enter_nohz(); | ||
| 154 | } | ||
| 155 | |||
| 156 | static inline void rcu_nmi_enter(void) | ||
| 157 | { | ||
| 158 | } | ||
| 159 | |||
| 160 | static inline void rcu_nmi_exit(void) | ||
| 161 | { | ||
| 162 | } | ||
| 163 | |||
| 164 | #else | ||
| 142 | extern void rcu_irq_enter(void); | 165 | extern void rcu_irq_enter(void); |
| 143 | extern void rcu_irq_exit(void); | 166 | extern void rcu_irq_exit(void); |
| 144 | extern void rcu_nmi_enter(void); | 167 | extern void rcu_nmi_enter(void); |
| 145 | extern void rcu_nmi_exit(void); | 168 | extern void rcu_nmi_exit(void); |
| 169 | #endif | ||
| 146 | #else | 170 | #else |
| 147 | # define rcu_irq_enter() do { } while (0) | 171 | # define rcu_irq_enter() do { } while (0) |
| 148 | # define rcu_irq_exit() do { } while (0) | 172 | # define rcu_irq_exit() do { } while (0) |
diff --git a/include/linux/hayesesp.h b/include/linux/hayesesp.h deleted file mode 100644 index 92b08cfe4a75..000000000000 --- a/include/linux/hayesesp.h +++ /dev/null | |||
| @@ -1,114 +0,0 @@ | |||
| 1 | #ifndef HAYESESP_H | ||
| 2 | #define HAYESESP_H | ||
| 3 | |||
| 4 | struct hayes_esp_config { | ||
| 5 | short flow_on; | ||
| 6 | short flow_off; | ||
| 7 | short rx_trigger; | ||
| 8 | short tx_trigger; | ||
| 9 | short pio_threshold; | ||
| 10 | unsigned char rx_timeout; | ||
| 11 | char dma_channel; | ||
| 12 | }; | ||
| 13 | |||
| 14 | #ifdef __KERNEL__ | ||
| 15 | |||
| 16 | #define ESP_DMA_CHANNEL 0 | ||
| 17 | #define ESP_RX_TRIGGER 768 | ||
| 18 | #define ESP_TX_TRIGGER 768 | ||
| 19 | #define ESP_FLOW_OFF 1016 | ||
| 20 | #define ESP_FLOW_ON 944 | ||
| 21 | #define ESP_RX_TMOUT 128 | ||
| 22 | #define ESP_PIO_THRESHOLD 32 | ||
| 23 | |||
| 24 | #define ESP_IN_MAJOR 57 /* major dev # for dial in */ | ||
| 25 | #define ESP_OUT_MAJOR 58 /* major dev # for dial out */ | ||
| 26 | #define ESPC_SCALE 3 | ||
| 27 | #define UART_ESI_BASE 0x00 | ||
| 28 | #define UART_ESI_SID 0x01 | ||
| 29 | #define UART_ESI_RX 0x02 | ||
| 30 | #define UART_ESI_TX 0x02 | ||
| 31 | #define UART_ESI_CMD1 0x04 | ||
| 32 | #define UART_ESI_CMD2 0x05 | ||
| 33 | #define UART_ESI_STAT1 0x04 | ||
| 34 | #define UART_ESI_STAT2 0x05 | ||
| 35 | #define UART_ESI_RWS 0x07 | ||
| 36 | |||
| 37 | #define UART_IER_DMA_TMOUT 0x80 | ||
| 38 | #define UART_IER_DMA_TC 0x08 | ||
| 39 | |||
| 40 | #define ESI_SET_IRQ 0x04 | ||
| 41 | #define ESI_SET_DMA_TMOUT 0x05 | ||
| 42 | #define ESI_SET_SRV_MASK 0x06 | ||
| 43 | #define ESI_SET_ERR_MASK 0x07 | ||
| 44 | #define ESI_SET_FLOW_CNTL 0x08 | ||
| 45 | #define ESI_SET_FLOW_CHARS 0x09 | ||
| 46 | #define ESI_SET_FLOW_LVL 0x0a | ||
| 47 | #define ESI_SET_TRIGGER 0x0b | ||
| 48 | #define ESI_SET_RX_TIMEOUT 0x0c | ||
| 49 | #define ESI_SET_FLOW_TMOUT 0x0d | ||
| 50 | #define ESI_WRITE_UART 0x0e | ||
| 51 | #define ESI_READ_UART 0x0f | ||
| 52 | #define ESI_SET_MODE 0x10 | ||
| 53 | #define ESI_GET_ERR_STAT 0x12 | ||
| 54 | #define ESI_GET_UART_STAT 0x13 | ||
| 55 | #define ESI_GET_RX_AVAIL 0x14 | ||
| 56 | #define ESI_GET_TX_AVAIL 0x15 | ||
| 57 | #define ESI_START_DMA_RX 0x16 | ||
| 58 | #define ESI_START_DMA_TX 0x17 | ||
| 59 | #define ESI_ISSUE_BREAK 0x1a | ||
| 60 | #define ESI_FLUSH_RX 0x1b | ||
| 61 | #define ESI_FLUSH_TX 0x1c | ||
| 62 | #define ESI_SET_BAUD 0x1d | ||
| 63 | #define ESI_SET_ENH_IRQ 0x1f | ||
| 64 | #define ESI_SET_REINTR 0x20 | ||
| 65 | #define ESI_SET_PRESCALAR 0x23 | ||
| 66 | #define ESI_NO_COMMAND 0xff | ||
| 67 | |||
| 68 | #define ESP_STAT_RX_TIMEOUT 0x01 | ||
| 69 | #define ESP_STAT_DMA_RX 0x02 | ||
| 70 | #define ESP_STAT_DMA_TX 0x04 | ||
| 71 | #define ESP_STAT_NEVER_DMA 0x08 | ||
| 72 | #define ESP_STAT_USE_PIO 0x10 | ||
| 73 | |||
| 74 | #define ESP_MAGIC 0x53ee | ||
| 75 | #define ESP_XMIT_SIZE 4096 | ||
| 76 | |||
| 77 | struct esp_struct { | ||
| 78 | int magic; | ||
| 79 | struct tty_port port; | ||
| 80 | spinlock_t lock; | ||
| 81 | int io_port; | ||
| 82 | int irq; | ||
| 83 | int read_status_mask; | ||
| 84 | int ignore_status_mask; | ||
| 85 | int timeout; | ||
| 86 | int stat_flags; | ||
| 87 | int custom_divisor; | ||
| 88 | int close_delay; | ||
| 89 | unsigned short closing_wait; | ||
| 90 | unsigned short closing_wait2; | ||
| 91 | int IER; /* Interrupt Enable Register */ | ||
| 92 | int MCR; /* Modem control register */ | ||
| 93 | unsigned long last_active; | ||
| 94 | int line; | ||
| 95 | unsigned char *xmit_buf; | ||
| 96 | int xmit_head; | ||
| 97 | int xmit_tail; | ||
| 98 | int xmit_cnt; | ||
| 99 | wait_queue_head_t break_wait; | ||
| 100 | struct async_icount icount; /* kernel counters for the 4 input interrupts */ | ||
| 101 | struct hayes_esp_config config; /* port configuration */ | ||
| 102 | struct esp_struct *next_port; /* For the linked list */ | ||
| 103 | }; | ||
| 104 | |||
| 105 | struct esp_pio_buffer { | ||
| 106 | unsigned char data[1024]; | ||
| 107 | struct esp_pio_buffer *next; | ||
| 108 | }; | ||
| 109 | |||
| 110 | #endif /* __KERNEL__ */ | ||
| 111 | |||
| 112 | |||
| 113 | #endif /* ESP_H */ | ||
| 114 | |||
diff --git a/include/linux/hid.h b/include/linux/hid.h index 10f628416740..b1344ec4b7fc 100644 --- a/include/linux/hid.h +++ b/include/linux/hid.h | |||
| @@ -312,6 +312,7 @@ struct hid_item { | |||
| 312 | #define HID_QUIRK_MULTI_INPUT 0x00000040 | 312 | #define HID_QUIRK_MULTI_INPUT 0x00000040 |
| 313 | #define HID_QUIRK_SKIP_OUTPUT_REPORTS 0x00010000 | 313 | #define HID_QUIRK_SKIP_OUTPUT_REPORTS 0x00010000 |
| 314 | #define HID_QUIRK_FULLSPEED_INTERVAL 0x10000000 | 314 | #define HID_QUIRK_FULLSPEED_INTERVAL 0x10000000 |
| 315 | #define HID_QUIRK_NO_INIT_REPORTS 0x20000000 | ||
| 315 | 316 | ||
| 316 | /* | 317 | /* |
| 317 | * This is the global environment of the parser. This information is | 318 | * This is the global environment of the parser. This information is |
| @@ -500,7 +501,7 @@ struct hid_device { /* device report descriptor */ | |||
| 500 | void (*hiddev_report_event) (struct hid_device *, struct hid_report *); | 501 | void (*hiddev_report_event) (struct hid_device *, struct hid_report *); |
| 501 | 502 | ||
| 502 | /* handler for raw output data, used by hidraw */ | 503 | /* handler for raw output data, used by hidraw */ |
| 503 | int (*hid_output_raw_report) (struct hid_device *, __u8 *, size_t); | 504 | int (*hid_output_raw_report) (struct hid_device *, __u8 *, size_t, unsigned char); |
| 504 | 505 | ||
| 505 | /* debugging support via debugfs */ | 506 | /* debugging support via debugfs */ |
| 506 | unsigned short debug; | 507 | unsigned short debug; |
| @@ -662,7 +663,7 @@ struct hid_ll_driver { | |||
| 662 | 663 | ||
| 663 | /* Applications from HID Usage Tables 4/8/99 Version 1.1 */ | 664 | /* Applications from HID Usage Tables 4/8/99 Version 1.1 */ |
| 664 | /* We ignore a few input applications that are not widely used */ | 665 | /* We ignore a few input applications that are not widely used */ |
| 665 | #define IS_INPUT_APPLICATION(a) (((a >= 0x00010000) && (a <= 0x00010008)) || (a == 0x00010080) || (a == 0x000c0001) || (a == 0x000d0002)) | 666 | #define IS_INPUT_APPLICATION(a) (((a >= 0x00010000) && (a <= 0x00010008)) || (a == 0x00010080) || (a == 0x000c0001) || ((a >= 0x000d0002) && (a <= 0x000d0006))) |
| 666 | 667 | ||
| 667 | /* HID core API */ | 668 | /* HID core API */ |
| 668 | 669 | ||
| @@ -689,6 +690,7 @@ int hid_input_report(struct hid_device *, int type, u8 *, int, int); | |||
| 689 | int hidinput_find_field(struct hid_device *hid, unsigned int type, unsigned int code, struct hid_field **field); | 690 | int hidinput_find_field(struct hid_device *hid, unsigned int type, unsigned int code, struct hid_field **field); |
| 690 | void hid_output_report(struct hid_report *report, __u8 *data); | 691 | void hid_output_report(struct hid_report *report, __u8 *data); |
| 691 | struct hid_device *hid_allocate_device(void); | 692 | struct hid_device *hid_allocate_device(void); |
| 693 | struct hid_report *hid_register_report(struct hid_device *device, unsigned type, unsigned id); | ||
| 692 | int hid_parse_report(struct hid_device *hid, __u8 *start, unsigned size); | 694 | int hid_parse_report(struct hid_device *hid, __u8 *start, unsigned size); |
| 693 | int hid_check_keys_pressed(struct hid_device *hid); | 695 | int hid_check_keys_pressed(struct hid_device *hid); |
| 694 | int hid_connect(struct hid_device *hid, unsigned int connect_mask); | 696 | int hid_connect(struct hid_device *hid, unsigned int connect_mask); |
diff --git a/include/linux/highmem.h b/include/linux/highmem.h index 211ff4497269..74152c08ad07 100644 --- a/include/linux/highmem.h +++ b/include/linux/highmem.h | |||
| @@ -17,6 +17,12 @@ static inline void flush_anon_page(struct vm_area_struct *vma, struct page *page | |||
| 17 | static inline void flush_kernel_dcache_page(struct page *page) | 17 | static inline void flush_kernel_dcache_page(struct page *page) |
| 18 | { | 18 | { |
| 19 | } | 19 | } |
| 20 | static inline void flush_kernel_vmap_range(void *vaddr, int size) | ||
| 21 | { | ||
| 22 | } | ||
| 23 | static inline void invalidate_kernel_vmap_range(void *vaddr, int size) | ||
| 24 | { | ||
| 25 | } | ||
| 20 | #endif | 26 | #endif |
| 21 | 27 | ||
| 22 | #include <asm/kmap_types.h> | 28 | #include <asm/kmap_types.h> |
| @@ -46,7 +52,7 @@ void kmap_flush_unused(void); | |||
| 46 | 52 | ||
| 47 | static inline unsigned int nr_free_highpages(void) { return 0; } | 53 | static inline unsigned int nr_free_highpages(void) { return 0; } |
| 48 | 54 | ||
| 49 | #define totalhigh_pages 0 | 55 | #define totalhigh_pages 0UL |
| 50 | 56 | ||
| 51 | #ifndef ARCH_HAS_KMAP | 57 | #ifndef ARCH_HAS_KMAP |
| 52 | static inline void *kmap(struct page *page) | 58 | static inline void *kmap(struct page *page) |
diff --git a/include/linux/hil.h b/include/linux/hil.h index 13352d7d0caf..523785a9de70 100644 --- a/include/linux/hil.h +++ b/include/linux/hil.h | |||
| @@ -168,14 +168,14 @@ enum hil_command { | |||
| 168 | HIL_CMD_PR6 = 0x45, /* Prompt6 */ | 168 | HIL_CMD_PR6 = 0x45, /* Prompt6 */ |
| 169 | HIL_CMD_PR7 = 0x46, /* Prompt7 */ | 169 | HIL_CMD_PR7 = 0x46, /* Prompt7 */ |
| 170 | HIL_CMD_PRM = 0x47, /* Prompt (General Purpose) */ | 170 | HIL_CMD_PRM = 0x47, /* Prompt (General Purpose) */ |
| 171 | HIL_CMD_AK1 = 0x48, /* Acknowlege1 */ | 171 | HIL_CMD_AK1 = 0x48, /* Acknowledge1 */ |
| 172 | HIL_CMD_AK2 = 0x49, /* Acknowlege2 */ | 172 | HIL_CMD_AK2 = 0x49, /* Acknowledge2 */ |
| 173 | HIL_CMD_AK3 = 0x4a, /* Acknowlege3 */ | 173 | HIL_CMD_AK3 = 0x4a, /* Acknowledge3 */ |
| 174 | HIL_CMD_AK4 = 0x4b, /* Acknowlege4 */ | 174 | HIL_CMD_AK4 = 0x4b, /* Acknowledge4 */ |
| 175 | HIL_CMD_AK5 = 0x4c, /* Acknowlege5 */ | 175 | HIL_CMD_AK5 = 0x4c, /* Acknowledge5 */ |
| 176 | HIL_CMD_AK6 = 0x4d, /* Acknowlege6 */ | 176 | HIL_CMD_AK6 = 0x4d, /* Acknowledge6 */ |
| 177 | HIL_CMD_AK7 = 0x4e, /* Acknowlege7 */ | 177 | HIL_CMD_AK7 = 0x4e, /* Acknowledge7 */ |
| 178 | HIL_CMD_ACK = 0x4f, /* Acknowlege (General Purpose) */ | 178 | HIL_CMD_ACK = 0x4f, /* Acknowledge (General Purpose) */ |
| 179 | 179 | ||
| 180 | /* 0x50 to 0x78 reserved for future use */ | 180 | /* 0x50 to 0x78 reserved for future use */ |
| 181 | /* 0x80 to 0xEF device-specific commands */ | 181 | /* 0x80 to 0xEF device-specific commands */ |
diff --git a/include/linux/hpet.h b/include/linux/hpet.h index 79f63a27bcef..219ca4f6bea6 100644 --- a/include/linux/hpet.h +++ b/include/linux/hpet.h | |||
| @@ -126,4 +126,6 @@ struct hpet_info { | |||
| 126 | #define HPET_DPI _IO('h', 0x05) /* disable periodic */ | 126 | #define HPET_DPI _IO('h', 0x05) /* disable periodic */ |
| 127 | #define HPET_IRQFREQ _IOW('h', 0x6, unsigned long) /* IRQFREQ usec */ | 127 | #define HPET_IRQFREQ _IOW('h', 0x6, unsigned long) /* IRQFREQ usec */ |
| 128 | 128 | ||
| 129 | #define MAX_HPET_TBS 8 /* maximum hpet timer blocks */ | ||
| 130 | |||
| 129 | #endif /* !__HPET__ */ | 131 | #endif /* !__HPET__ */ |
diff --git a/include/linux/hrtimer.h b/include/linux/hrtimer.h index b984b947f5db..b34823755ee4 100644 --- a/include/linux/hrtimer.h +++ b/include/linux/hrtimer.h | |||
| @@ -162,19 +162,24 @@ struct hrtimer_clock_base { | |||
| 162 | * @expires_next: absolute time of the next event which was scheduled | 162 | * @expires_next: absolute time of the next event which was scheduled |
| 163 | * via clock_set_next_event() | 163 | * via clock_set_next_event() |
| 164 | * @hres_active: State of high resolution mode | 164 | * @hres_active: State of high resolution mode |
| 165 | * @check_clocks: Indictator, when set evaluate time source and clock | 165 | * @hang_detected: The last hrtimer interrupt detected a hang |
| 166 | * event devices whether high resolution mode can be | 166 | * @nr_events: Total number of hrtimer interrupt events |
| 167 | * activated. | 167 | * @nr_retries: Total number of hrtimer interrupt retries |
| 168 | * @nr_events: Total number of timer interrupt events | 168 | * @nr_hangs: Total number of hrtimer interrupt hangs |
| 169 | * @max_hang_time: Maximum time spent in hrtimer_interrupt | ||
| 169 | * @to_pull: LITMUS^RT list of timers to be pulled on this cpu | 170 | * @to_pull: LITMUS^RT list of timers to be pulled on this cpu |
| 170 | */ | 171 | */ |
| 171 | struct hrtimer_cpu_base { | 172 | struct hrtimer_cpu_base { |
| 172 | spinlock_t lock; | 173 | raw_spinlock_t lock; |
| 173 | struct hrtimer_clock_base clock_base[HRTIMER_MAX_CLOCK_BASES]; | 174 | struct hrtimer_clock_base clock_base[HRTIMER_MAX_CLOCK_BASES]; |
| 174 | #ifdef CONFIG_HIGH_RES_TIMERS | 175 | #ifdef CONFIG_HIGH_RES_TIMERS |
| 175 | ktime_t expires_next; | 176 | ktime_t expires_next; |
| 176 | int hres_active; | 177 | int hres_active; |
| 178 | int hang_detected; | ||
| 177 | unsigned long nr_events; | 179 | unsigned long nr_events; |
| 180 | unsigned long nr_retries; | ||
| 181 | unsigned long nr_hangs; | ||
| 182 | ktime_t max_hang_time; | ||
| 178 | #endif | 183 | #endif |
| 179 | struct list_head to_pull; | 184 | struct list_head to_pull; |
| 180 | }; | 185 | }; |
| @@ -460,49 +465,4 @@ extern u64 ktime_divns(const ktime_t kt, s64 div); | |||
| 460 | /* Show pending timers: */ | 465 | /* Show pending timers: */ |
| 461 | extern void sysrq_timer_list_show(void); | 466 | extern void sysrq_timer_list_show(void); |
| 462 | 467 | ||
| 463 | /* | ||
| 464 | * Timer-statistics info: | ||
| 465 | */ | ||
| 466 | #ifdef CONFIG_TIMER_STATS | ||
| 467 | |||
| 468 | extern void timer_stats_update_stats(void *timer, pid_t pid, void *startf, | ||
| 469 | void *timerf, char *comm, | ||
| 470 | unsigned int timer_flag); | ||
| 471 | |||
| 472 | static inline void timer_stats_account_hrtimer(struct hrtimer *timer) | ||
| 473 | { | ||
| 474 | if (likely(!timer->start_site)) | ||
| 475 | return; | ||
| 476 | timer_stats_update_stats(timer, timer->start_pid, timer->start_site, | ||
| 477 | timer->function, timer->start_comm, 0); | ||
| 478 | } | ||
| 479 | |||
| 480 | extern void __timer_stats_hrtimer_set_start_info(struct hrtimer *timer, | ||
| 481 | void *addr); | ||
| 482 | |||
| 483 | static inline void timer_stats_hrtimer_set_start_info(struct hrtimer *timer) | ||
| 484 | { | ||
| 485 | if (likely(!timer_stats_active)) | ||
| 486 | return; | ||
| 487 | __timer_stats_hrtimer_set_start_info(timer, __builtin_return_address(0)); | ||
| 488 | } | ||
| 489 | |||
| 490 | static inline void timer_stats_hrtimer_clear_start_info(struct hrtimer *timer) | ||
| 491 | { | ||
| 492 | timer->start_site = NULL; | ||
| 493 | } | ||
| 494 | #else | ||
| 495 | static inline void timer_stats_account_hrtimer(struct hrtimer *timer) | ||
| 496 | { | ||
| 497 | } | ||
| 498 | |||
| 499 | static inline void timer_stats_hrtimer_set_start_info(struct hrtimer *timer) | ||
| 500 | { | ||
| 501 | } | ||
| 502 | |||
| 503 | static inline void timer_stats_hrtimer_clear_start_info(struct hrtimer *timer) | ||
| 504 | { | ||
| 505 | } | ||
| 506 | #endif | ||
| 507 | |||
| 508 | #endif | 468 | #endif |
diff --git a/include/linux/htcpld.h b/include/linux/htcpld.h new file mode 100644 index 000000000000..ab3f6cb4dddc --- /dev/null +++ b/include/linux/htcpld.h | |||
| @@ -0,0 +1,24 @@ | |||
| 1 | #ifndef __LINUX_HTCPLD_H | ||
| 2 | #define __LINUX_HTCPLD_H | ||
| 3 | |||
| 4 | struct htcpld_chip_platform_data { | ||
| 5 | unsigned int addr; | ||
| 6 | unsigned int reset; | ||
| 7 | unsigned int num_gpios; | ||
| 8 | unsigned int gpio_out_base; | ||
| 9 | unsigned int gpio_in_base; | ||
| 10 | unsigned int irq_base; | ||
| 11 | unsigned int num_irqs; | ||
| 12 | }; | ||
| 13 | |||
| 14 | struct htcpld_core_platform_data { | ||
| 15 | unsigned int int_reset_gpio_hi; | ||
| 16 | unsigned int int_reset_gpio_lo; | ||
| 17 | unsigned int i2c_adapter_id; | ||
| 18 | |||
| 19 | struct htcpld_chip_platform_data *chip; | ||
| 20 | unsigned int num_chip; | ||
| 21 | }; | ||
| 22 | |||
| 23 | #endif /* __LINUX_HTCPLD_H */ | ||
| 24 | |||
diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h index 41a59afc70fa..78b4bc64c006 100644 --- a/include/linux/hugetlb.h +++ b/include/linux/hugetlb.h | |||
| @@ -23,6 +23,12 @@ void reset_vma_resv_huge_pages(struct vm_area_struct *vma); | |||
| 23 | int hugetlb_sysctl_handler(struct ctl_table *, int, void __user *, size_t *, loff_t *); | 23 | int hugetlb_sysctl_handler(struct ctl_table *, int, void __user *, size_t *, loff_t *); |
| 24 | int hugetlb_overcommit_handler(struct ctl_table *, int, void __user *, size_t *, loff_t *); | 24 | int hugetlb_overcommit_handler(struct ctl_table *, int, void __user *, size_t *, loff_t *); |
| 25 | int hugetlb_treat_movable_handler(struct ctl_table *, int, void __user *, size_t *, loff_t *); | 25 | int hugetlb_treat_movable_handler(struct ctl_table *, int, void __user *, size_t *, loff_t *); |
| 26 | |||
| 27 | #ifdef CONFIG_NUMA | ||
| 28 | int hugetlb_mempolicy_sysctl_handler(struct ctl_table *, int, | ||
| 29 | void __user *, size_t *, loff_t *); | ||
| 30 | #endif | ||
| 31 | |||
| 26 | int copy_hugetlb_page_range(struct mm_struct *, struct mm_struct *, struct vm_area_struct *); | 32 | int copy_hugetlb_page_range(struct mm_struct *, struct mm_struct *, struct vm_area_struct *); |
| 27 | int follow_hugetlb_page(struct mm_struct *, struct vm_area_struct *, | 33 | int follow_hugetlb_page(struct mm_struct *, struct vm_area_struct *, |
| 28 | struct page **, struct vm_area_struct **, | 34 | struct page **, struct vm_area_struct **, |
diff --git a/include/linux/hw_breakpoint.h b/include/linux/hw_breakpoint.h new file mode 100644 index 000000000000..c70d27af03f9 --- /dev/null +++ b/include/linux/hw_breakpoint.h | |||
| @@ -0,0 +1,127 @@ | |||
| 1 | #ifndef _LINUX_HW_BREAKPOINT_H | ||
| 2 | #define _LINUX_HW_BREAKPOINT_H | ||
| 3 | |||
| 4 | enum { | ||
| 5 | HW_BREAKPOINT_LEN_1 = 1, | ||
| 6 | HW_BREAKPOINT_LEN_2 = 2, | ||
| 7 | HW_BREAKPOINT_LEN_4 = 4, | ||
| 8 | HW_BREAKPOINT_LEN_8 = 8, | ||
| 9 | }; | ||
| 10 | |||
| 11 | enum { | ||
| 12 | HW_BREAKPOINT_R = 1, | ||
| 13 | HW_BREAKPOINT_W = 2, | ||
| 14 | HW_BREAKPOINT_X = 4, | ||
| 15 | }; | ||
| 16 | |||
| 17 | #ifdef __KERNEL__ | ||
| 18 | |||
| 19 | #include <linux/perf_event.h> | ||
| 20 | |||
| 21 | #ifdef CONFIG_HAVE_HW_BREAKPOINT | ||
| 22 | |||
| 23 | static inline void hw_breakpoint_init(struct perf_event_attr *attr) | ||
| 24 | { | ||
| 25 | memset(attr, 0, sizeof(*attr)); | ||
| 26 | |||
| 27 | attr->type = PERF_TYPE_BREAKPOINT; | ||
| 28 | attr->size = sizeof(*attr); | ||
| 29 | /* | ||
| 30 | * As it's for in-kernel or ptrace use, we want it to be pinned | ||
| 31 | * and to call its callback every hits. | ||
| 32 | */ | ||
| 33 | attr->pinned = 1; | ||
| 34 | attr->sample_period = 1; | ||
| 35 | } | ||
| 36 | |||
| 37 | static inline unsigned long hw_breakpoint_addr(struct perf_event *bp) | ||
| 38 | { | ||
| 39 | return bp->attr.bp_addr; | ||
| 40 | } | ||
| 41 | |||
| 42 | static inline int hw_breakpoint_type(struct perf_event *bp) | ||
| 43 | { | ||
| 44 | return bp->attr.bp_type; | ||
| 45 | } | ||
| 46 | |||
| 47 | static inline unsigned long hw_breakpoint_len(struct perf_event *bp) | ||
| 48 | { | ||
| 49 | return bp->attr.bp_len; | ||
| 50 | } | ||
| 51 | |||
| 52 | extern struct perf_event * | ||
| 53 | register_user_hw_breakpoint(struct perf_event_attr *attr, | ||
| 54 | perf_overflow_handler_t triggered, | ||
| 55 | struct task_struct *tsk); | ||
| 56 | |||
| 57 | /* FIXME: only change from the attr, and don't unregister */ | ||
| 58 | extern int | ||
| 59 | modify_user_hw_breakpoint(struct perf_event *bp, struct perf_event_attr *attr); | ||
| 60 | |||
| 61 | /* | ||
| 62 | * Kernel breakpoints are not associated with any particular thread. | ||
| 63 | */ | ||
| 64 | extern struct perf_event * | ||
| 65 | register_wide_hw_breakpoint_cpu(struct perf_event_attr *attr, | ||
| 66 | perf_overflow_handler_t triggered, | ||
| 67 | int cpu); | ||
| 68 | |||
| 69 | extern struct perf_event * __percpu * | ||
| 70 | register_wide_hw_breakpoint(struct perf_event_attr *attr, | ||
| 71 | perf_overflow_handler_t triggered); | ||
| 72 | |||
| 73 | extern int register_perf_hw_breakpoint(struct perf_event *bp); | ||
| 74 | extern int __register_perf_hw_breakpoint(struct perf_event *bp); | ||
| 75 | extern void unregister_hw_breakpoint(struct perf_event *bp); | ||
| 76 | extern void unregister_wide_hw_breakpoint(struct perf_event * __percpu *cpu_events); | ||
| 77 | |||
| 78 | extern int dbg_reserve_bp_slot(struct perf_event *bp); | ||
| 79 | extern int dbg_release_bp_slot(struct perf_event *bp); | ||
| 80 | extern int reserve_bp_slot(struct perf_event *bp); | ||
| 81 | extern void release_bp_slot(struct perf_event *bp); | ||
| 82 | |||
| 83 | extern void flush_ptrace_hw_breakpoint(struct task_struct *tsk); | ||
| 84 | |||
| 85 | static inline struct arch_hw_breakpoint *counter_arch_bp(struct perf_event *bp) | ||
| 86 | { | ||
| 87 | return &bp->hw.info; | ||
| 88 | } | ||
| 89 | |||
| 90 | #else /* !CONFIG_HAVE_HW_BREAKPOINT */ | ||
| 91 | |||
| 92 | static inline struct perf_event * | ||
| 93 | register_user_hw_breakpoint(struct perf_event_attr *attr, | ||
| 94 | perf_overflow_handler_t triggered, | ||
| 95 | struct task_struct *tsk) { return NULL; } | ||
| 96 | static inline int | ||
| 97 | modify_user_hw_breakpoint(struct perf_event *bp, | ||
| 98 | struct perf_event_attr *attr) { return -ENOSYS; } | ||
| 99 | static inline struct perf_event * | ||
| 100 | register_wide_hw_breakpoint_cpu(struct perf_event_attr *attr, | ||
| 101 | perf_overflow_handler_t triggered, | ||
| 102 | int cpu) { return NULL; } | ||
| 103 | static inline struct perf_event * __percpu * | ||
| 104 | register_wide_hw_breakpoint(struct perf_event_attr *attr, | ||
| 105 | perf_overflow_handler_t triggered) { return NULL; } | ||
| 106 | static inline int | ||
| 107 | register_perf_hw_breakpoint(struct perf_event *bp) { return -ENOSYS; } | ||
| 108 | static inline int | ||
| 109 | __register_perf_hw_breakpoint(struct perf_event *bp) { return -ENOSYS; } | ||
| 110 | static inline void unregister_hw_breakpoint(struct perf_event *bp) { } | ||
| 111 | static inline void | ||
| 112 | unregister_wide_hw_breakpoint(struct perf_event * __percpu *cpu_events) { } | ||
| 113 | static inline int | ||
| 114 | reserve_bp_slot(struct perf_event *bp) {return -ENOSYS; } | ||
| 115 | static inline void release_bp_slot(struct perf_event *bp) { } | ||
| 116 | |||
| 117 | static inline void flush_ptrace_hw_breakpoint(struct task_struct *tsk) { } | ||
| 118 | |||
| 119 | static inline struct arch_hw_breakpoint *counter_arch_bp(struct perf_event *bp) | ||
| 120 | { | ||
| 121 | return NULL; | ||
| 122 | } | ||
| 123 | |||
| 124 | #endif /* CONFIG_HAVE_HW_BREAKPOINT */ | ||
| 125 | #endif /* __KERNEL__ */ | ||
| 126 | |||
| 127 | #endif /* _LINUX_HW_BREAKPOINT_H */ | ||
diff --git a/include/linux/hw_random.h b/include/linux/hw_random.h index 7244456e7e65..9bede7633f74 100644 --- a/include/linux/hw_random.h +++ b/include/linux/hw_random.h | |||
| @@ -22,10 +22,12 @@ | |||
| 22 | * @cleanup: Cleanup callback (can be NULL). | 22 | * @cleanup: Cleanup callback (can be NULL). |
| 23 | * @data_present: Callback to determine if data is available | 23 | * @data_present: Callback to determine if data is available |
| 24 | * on the RNG. If NULL, it is assumed that | 24 | * on the RNG. If NULL, it is assumed that |
| 25 | * there is always data available. | 25 | * there is always data available. *OBSOLETE* |
| 26 | * @data_read: Read data from the RNG device. | 26 | * @data_read: Read data from the RNG device. |
| 27 | * Returns the number of lower random bytes in "data". | 27 | * Returns the number of lower random bytes in "data". |
| 28 | * Must not be NULL. | 28 | * Must not be NULL. *OSOLETE* |
| 29 | * @read: New API. drivers can fill up to max bytes of data | ||
| 30 | * into the buffer. The buffer is aligned for any type. | ||
| 29 | * @priv: Private data, for use by the RNG driver. | 31 | * @priv: Private data, for use by the RNG driver. |
| 30 | */ | 32 | */ |
| 31 | struct hwrng { | 33 | struct hwrng { |
| @@ -34,6 +36,7 @@ struct hwrng { | |||
| 34 | void (*cleanup)(struct hwrng *rng); | 36 | void (*cleanup)(struct hwrng *rng); |
| 35 | int (*data_present)(struct hwrng *rng, int wait); | 37 | int (*data_present)(struct hwrng *rng, int wait); |
| 36 | int (*data_read)(struct hwrng *rng, u32 *data); | 38 | int (*data_read)(struct hwrng *rng, u32 *data); |
| 39 | int (*read)(struct hwrng *rng, void *data, size_t max, bool wait); | ||
| 37 | unsigned long priv; | 40 | unsigned long priv; |
| 38 | 41 | ||
| 39 | /* internal. */ | 42 | /* internal. */ |
diff --git a/include/linux/i2c-algo-bit.h b/include/linux/i2c-algo-bit.h index 111334f5b922..4f98148c11c3 100644 --- a/include/linux/i2c-algo-bit.h +++ b/include/linux/i2c-algo-bit.h | |||
| @@ -36,6 +36,8 @@ struct i2c_algo_bit_data { | |||
| 36 | void (*setscl) (void *data, int state); | 36 | void (*setscl) (void *data, int state); |
| 37 | int (*getsda) (void *data); | 37 | int (*getsda) (void *data); |
| 38 | int (*getscl) (void *data); | 38 | int (*getscl) (void *data); |
| 39 | int (*pre_xfer) (struct i2c_adapter *); | ||
| 40 | void (*post_xfer) (struct i2c_adapter *); | ||
| 39 | 41 | ||
| 40 | /* local settings */ | 42 | /* local settings */ |
| 41 | int udelay; /* half clock cycle time in us, | 43 | int udelay; /* half clock cycle time in us, |
diff --git a/include/linux/i2c-pnx.h b/include/linux/i2c-pnx.h index 9eb07bbc6522..a87124d4d533 100644 --- a/include/linux/i2c-pnx.h +++ b/include/linux/i2c-pnx.h | |||
| @@ -12,9 +12,8 @@ | |||
| 12 | #ifndef __I2C_PNX_H__ | 12 | #ifndef __I2C_PNX_H__ |
| 13 | #define __I2C_PNX_H__ | 13 | #define __I2C_PNX_H__ |
| 14 | 14 | ||
| 15 | #include <linux/pm.h> | ||
| 16 | |||
| 17 | struct platform_device; | 15 | struct platform_device; |
| 16 | struct clk; | ||
| 18 | 17 | ||
| 19 | struct i2c_pnx_mif { | 18 | struct i2c_pnx_mif { |
| 20 | int ret; /* Return value */ | 19 | int ret; /* Return value */ |
| @@ -26,20 +25,18 @@ struct i2c_pnx_mif { | |||
| 26 | }; | 25 | }; |
| 27 | 26 | ||
| 28 | struct i2c_pnx_algo_data { | 27 | struct i2c_pnx_algo_data { |
| 29 | u32 base; | 28 | void __iomem *ioaddr; |
| 30 | u32 ioaddr; | ||
| 31 | int irq; | ||
| 32 | struct i2c_pnx_mif mif; | 29 | struct i2c_pnx_mif mif; |
| 33 | int last; | 30 | int last; |
| 31 | struct clk *clk; | ||
| 32 | struct i2c_pnx_data *i2c_pnx; | ||
| 33 | struct i2c_adapter adapter; | ||
| 34 | }; | 34 | }; |
| 35 | 35 | ||
| 36 | struct i2c_pnx_data { | 36 | struct i2c_pnx_data { |
| 37 | int (*suspend) (struct platform_device *pdev, pm_message_t state); | 37 | const char *name; |
| 38 | int (*resume) (struct platform_device *pdev); | 38 | u32 base; |
| 39 | u32 (*calculate_input_freq) (struct platform_device *pdev); | 39 | int irq; |
| 40 | int (*set_clock_run) (struct platform_device *pdev); | ||
| 41 | int (*set_clock_stop) (struct platform_device *pdev); | ||
| 42 | struct i2c_adapter *adapter; | ||
| 43 | }; | 40 | }; |
| 44 | 41 | ||
| 45 | #endif /* __I2C_PNX_H__ */ | 42 | #endif /* __I2C_PNX_H__ */ |
diff --git a/include/linux/i2c-smbus.h b/include/linux/i2c-smbus.h new file mode 100644 index 000000000000..63f57a8c8b31 --- /dev/null +++ b/include/linux/i2c-smbus.h | |||
| @@ -0,0 +1,50 @@ | |||
| 1 | /* | ||
| 2 | * i2c-smbus.h - SMBus extensions to the I2C protocol | ||
| 3 | * | ||
| 4 | * Copyright (C) 2010 Jean Delvare <khali@linux-fr.org> | ||
| 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, | ||
| 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 | * You should have received a copy of the GNU General Public License | ||
| 17 | * along with this program; if not, write to the Free Software | ||
| 18 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
| 19 | */ | ||
| 20 | |||
| 21 | #ifndef _LINUX_I2C_SMBUS_H | ||
| 22 | #define _LINUX_I2C_SMBUS_H | ||
| 23 | |||
| 24 | #include <linux/i2c.h> | ||
| 25 | |||
| 26 | |||
| 27 | /** | ||
| 28 | * i2c_smbus_alert_setup - platform data for the smbus_alert i2c client | ||
| 29 | * @alert_edge_triggered: whether the alert interrupt is edge (1) or level (0) | ||
| 30 | * triggered | ||
| 31 | * @irq: IRQ number, if the smbus_alert driver should take care of interrupt | ||
| 32 | * handling | ||
| 33 | * | ||
| 34 | * If irq is not specified, the smbus_alert driver doesn't take care of | ||
| 35 | * interrupt handling. In that case it is up to the I2C bus driver to either | ||
| 36 | * handle the interrupts or to poll for alerts. | ||
| 37 | * | ||
| 38 | * If irq is specified then it it crucial that alert_edge_triggered is | ||
| 39 | * properly set. | ||
| 40 | */ | ||
| 41 | struct i2c_smbus_alert_setup { | ||
| 42 | unsigned int alert_edge_triggered:1; | ||
| 43 | int irq; | ||
| 44 | }; | ||
| 45 | |||
| 46 | struct i2c_client *i2c_setup_smbus_alert(struct i2c_adapter *adapter, | ||
| 47 | struct i2c_smbus_alert_setup *setup); | ||
| 48 | int i2c_handle_smbus_alert(struct i2c_client *ara); | ||
| 49 | |||
| 50 | #endif /* _LINUX_I2C_SMBUS_H */ | ||
diff --git a/include/linux/i2c-xiic.h b/include/linux/i2c-xiic.h new file mode 100644 index 000000000000..4f9f2256a97e --- /dev/null +++ b/include/linux/i2c-xiic.h | |||
| @@ -0,0 +1,43 @@ | |||
| 1 | /* | ||
| 2 | * i2c-xiic.h | ||
| 3 | * Copyright (c) 2009 Intel Corporation | ||
| 4 | * | ||
| 5 | * This program is free software; you can redistribute it and/or modify | ||
| 6 | * it under the terms of the GNU General Public License version 2 as | ||
| 7 | * published by the Free Software Foundation. | ||
| 8 | * | ||
| 9 | * This program is distributed in the hope that it will be useful, | ||
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 12 | * GNU General Public License for more details. | ||
| 13 | * | ||
| 14 | * You should have received a copy of the GNU General Public License | ||
| 15 | * along with this program; if not, write to the Free Software | ||
| 16 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
| 17 | */ | ||
| 18 | |||
| 19 | /* Supports: | ||
| 20 | * Xilinx IIC | ||
| 21 | */ | ||
| 22 | |||
| 23 | #ifndef _LINUX_I2C_XIIC_H | ||
| 24 | #define _LINUX_I2C_XIIC_H | ||
| 25 | |||
| 26 | /** | ||
| 27 | * struct xiic_i2c_platform_data - Platform data of the Xilinx I2C driver | ||
| 28 | * @num_devices: Number of devices that shall be added when the driver | ||
| 29 | * is probed. | ||
| 30 | * @devices: The actuall devices to add. | ||
| 31 | * | ||
| 32 | * This purpose of this platform data struct is to be able to provide a number | ||
| 33 | * of devices that should be added to the I2C bus. The reason is that sometimes | ||
| 34 | * the I2C board info is not enough, a new PCI board can for instance be | ||
| 35 | * plugged into a standard PC, and the bus number might be unknown at | ||
| 36 | * early init time. | ||
| 37 | */ | ||
| 38 | struct xiic_i2c_platform_data { | ||
| 39 | u8 num_devices; | ||
| 40 | struct i2c_board_info const *devices; | ||
| 41 | }; | ||
| 42 | |||
| 43 | #endif /* _LINUX_I2C_XIIC_H */ | ||
diff --git a/include/linux/i2c.h b/include/linux/i2c.h index 7b40cda57a70..6ed1d59bfb1e 100644 --- a/include/linux/i2c.h +++ b/include/linux/i2c.h | |||
| @@ -53,6 +53,7 @@ struct i2c_board_info; | |||
| 53 | * on a bus (or read from them). Apart from two basic transfer functions to | 53 | * on a bus (or read from them). Apart from two basic transfer functions to |
| 54 | * transmit one message at a time, a more complex version can be used to | 54 | * transmit one message at a time, a more complex version can be used to |
| 55 | * transmit an arbitrary number of messages without interruption. | 55 | * transmit an arbitrary number of messages without interruption. |
| 56 | * @count must be be less than 64k since msg.len is u16. | ||
| 56 | */ | 57 | */ |
| 57 | extern int i2c_master_send(struct i2c_client *client, const char *buf, | 58 | extern int i2c_master_send(struct i2c_client *client, const char *buf, |
| 58 | int count); | 59 | int count); |
| @@ -110,7 +111,7 @@ extern s32 i2c_smbus_write_i2c_block_data(struct i2c_client *client, | |||
| 110 | * @driver: Device driver model driver | 111 | * @driver: Device driver model driver |
| 111 | * @id_table: List of I2C devices supported by this driver | 112 | * @id_table: List of I2C devices supported by this driver |
| 112 | * @detect: Callback for device detection | 113 | * @detect: Callback for device detection |
| 113 | * @address_data: The I2C addresses to probe, ignore or force (for detect) | 114 | * @address_list: The I2C addresses to probe (for detect) |
| 114 | * @clients: List of detected clients we created (for i2c-core use only) | 115 | * @clients: List of detected clients we created (for i2c-core use only) |
| 115 | * | 116 | * |
| 116 | * The driver.owner field should be set to the module owner of this driver. | 117 | * The driver.owner field should be set to the module owner of this driver. |
| @@ -152,6 +153,13 @@ struct i2c_driver { | |||
| 152 | int (*suspend)(struct i2c_client *, pm_message_t mesg); | 153 | int (*suspend)(struct i2c_client *, pm_message_t mesg); |
| 153 | int (*resume)(struct i2c_client *); | 154 | int (*resume)(struct i2c_client *); |
| 154 | 155 | ||
| 156 | /* Alert callback, for example for the SMBus alert protocol. | ||
| 157 | * The format and meaning of the data value depends on the protocol. | ||
| 158 | * For the SMBus alert protocol, there is a single bit of data passed | ||
| 159 | * as the alert response's low bit ("event flag"). | ||
| 160 | */ | ||
| 161 | void (*alert)(struct i2c_client *, unsigned int data); | ||
| 162 | |||
| 155 | /* a ioctl like command that can be used to perform specific functions | 163 | /* a ioctl like command that can be used to perform specific functions |
| 156 | * with the device. | 164 | * with the device. |
| 157 | */ | 165 | */ |
| @@ -161,8 +169,8 @@ struct i2c_driver { | |||
| 161 | const struct i2c_device_id *id_table; | 169 | const struct i2c_device_id *id_table; |
| 162 | 170 | ||
| 163 | /* Device detection callback for automatic device creation */ | 171 | /* Device detection callback for automatic device creation */ |
| 164 | int (*detect)(struct i2c_client *, int kind, struct i2c_board_info *); | 172 | int (*detect)(struct i2c_client *, struct i2c_board_info *); |
| 165 | const struct i2c_client_address_data *address_data; | 173 | const unsigned short *address_list; |
| 166 | struct list_head clients; | 174 | struct list_head clients; |
| 167 | }; | 175 | }; |
| 168 | #define to_i2c_driver(d) container_of(d, struct i2c_driver, driver) | 176 | #define to_i2c_driver(d) container_of(d, struct i2c_driver, driver) |
| @@ -338,8 +346,7 @@ struct i2c_adapter { | |||
| 338 | void *algo_data; | 346 | void *algo_data; |
| 339 | 347 | ||
| 340 | /* data fields that are valid for all devices */ | 348 | /* data fields that are valid for all devices */ |
| 341 | u8 level; /* nesting level for lockdep */ | 349 | struct rt_mutex bus_lock; |
| 342 | struct mutex bus_lock; | ||
| 343 | 350 | ||
| 344 | int timeout; /* in jiffies */ | 351 | int timeout; /* in jiffies */ |
| 345 | int retries; | 352 | int retries; |
| @@ -348,6 +355,8 @@ struct i2c_adapter { | |||
| 348 | int nr; | 355 | int nr; |
| 349 | char name[48]; | 356 | char name[48]; |
| 350 | struct completion dev_released; | 357 | struct completion dev_released; |
| 358 | |||
| 359 | struct list_head userspace_clients; | ||
| 351 | }; | 360 | }; |
| 352 | #define to_i2c_adapter(d) container_of(d, struct i2c_adapter, dev) | 361 | #define to_i2c_adapter(d) container_of(d, struct i2c_adapter, dev) |
| 353 | 362 | ||
| @@ -367,7 +376,7 @@ static inline void i2c_set_adapdata(struct i2c_adapter *dev, void *data) | |||
| 367 | */ | 376 | */ |
| 368 | static inline void i2c_lock_adapter(struct i2c_adapter *adapter) | 377 | static inline void i2c_lock_adapter(struct i2c_adapter *adapter) |
| 369 | { | 378 | { |
| 370 | mutex_lock(&adapter->bus_lock); | 379 | rt_mutex_lock(&adapter->bus_lock); |
| 371 | } | 380 | } |
| 372 | 381 | ||
| 373 | /** | 382 | /** |
| @@ -376,7 +385,7 @@ static inline void i2c_lock_adapter(struct i2c_adapter *adapter) | |||
| 376 | */ | 385 | */ |
| 377 | static inline void i2c_unlock_adapter(struct i2c_adapter *adapter) | 386 | static inline void i2c_unlock_adapter(struct i2c_adapter *adapter) |
| 378 | { | 387 | { |
| 379 | mutex_unlock(&adapter->bus_lock); | 388 | rt_mutex_unlock(&adapter->bus_lock); |
| 380 | } | 389 | } |
| 381 | 390 | ||
| 382 | /*flags for the client struct: */ | 391 | /*flags for the client struct: */ |
| @@ -392,17 +401,6 @@ static inline void i2c_unlock_adapter(struct i2c_adapter *adapter) | |||
| 392 | #define I2C_CLASS_DDC (1<<3) /* DDC bus on graphics adapters */ | 401 | #define I2C_CLASS_DDC (1<<3) /* DDC bus on graphics adapters */ |
| 393 | #define I2C_CLASS_SPD (1<<7) /* SPD EEPROMs and similar */ | 402 | #define I2C_CLASS_SPD (1<<7) /* SPD EEPROMs and similar */ |
| 394 | 403 | ||
| 395 | /* i2c_client_address_data is the struct for holding default client | ||
| 396 | * addresses for a driver and for the parameters supplied on the | ||
| 397 | * command line | ||
| 398 | */ | ||
| 399 | struct i2c_client_address_data { | ||
| 400 | const unsigned short *normal_i2c; | ||
| 401 | const unsigned short *probe; | ||
| 402 | const unsigned short *ignore; | ||
| 403 | const unsigned short * const *forces; | ||
| 404 | }; | ||
| 405 | |||
| 406 | /* Internal numbers to terminate lists */ | 404 | /* Internal numbers to terminate lists */ |
| 407 | #define I2C_CLIENT_END 0xfffeU | 405 | #define I2C_CLIENT_END 0xfffeU |
| 408 | 406 | ||
| @@ -580,168 +578,4 @@ union i2c_smbus_data { | |||
| 580 | #define I2C_SMBUS_BLOCK_PROC_CALL 7 /* SMBus 2.0 */ | 578 | #define I2C_SMBUS_BLOCK_PROC_CALL 7 /* SMBus 2.0 */ |
| 581 | #define I2C_SMBUS_I2C_BLOCK_DATA 8 | 579 | #define I2C_SMBUS_I2C_BLOCK_DATA 8 |
| 582 | 580 | ||
| 583 | |||
| 584 | #ifdef __KERNEL__ | ||
| 585 | |||
| 586 | /* These defines are used for probing i2c client addresses */ | ||
| 587 | /* The length of the option lists */ | ||
| 588 | #define I2C_CLIENT_MAX_OPTS 48 | ||
| 589 | |||
| 590 | /* Default fill of many variables */ | ||
| 591 | #define I2C_CLIENT_DEFAULTS {I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \ | ||
| 592 | I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \ | ||
| 593 | I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \ | ||
| 594 | I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \ | ||
| 595 | I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \ | ||
| 596 | I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \ | ||
| 597 | I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \ | ||
| 598 | I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \ | ||
| 599 | I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \ | ||
| 600 | I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \ | ||
| 601 | I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \ | ||
| 602 | I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \ | ||
| 603 | I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \ | ||
| 604 | I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \ | ||
| 605 | I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \ | ||
| 606 | I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END} | ||
| 607 | |||
| 608 | /* I2C_CLIENT_MODULE_PARM creates a module parameter, and puts it in the | ||
| 609 | module header */ | ||
| 610 | |||
| 611 | #define I2C_CLIENT_MODULE_PARM(var,desc) \ | ||
| 612 | static unsigned short var[I2C_CLIENT_MAX_OPTS] = I2C_CLIENT_DEFAULTS; \ | ||
| 613 | static unsigned int var##_num; \ | ||
| 614 | module_param_array(var, short, &var##_num, 0); \ | ||
| 615 | MODULE_PARM_DESC(var, desc) | ||
| 616 | |||
| 617 | #define I2C_CLIENT_MODULE_PARM_FORCE(name) \ | ||
| 618 | I2C_CLIENT_MODULE_PARM(force_##name, \ | ||
| 619 | "List of adapter,address pairs which are " \ | ||
| 620 | "unquestionably assumed to contain a `" \ | ||
| 621 | # name "' chip") | ||
| 622 | |||
| 623 | |||
| 624 | #define I2C_CLIENT_INSMOD_COMMON \ | ||
| 625 | I2C_CLIENT_MODULE_PARM(probe, "List of adapter,address pairs to scan " \ | ||
| 626 | "additionally"); \ | ||
| 627 | I2C_CLIENT_MODULE_PARM(ignore, "List of adapter,address pairs not to " \ | ||
| 628 | "scan"); \ | ||
| 629 | static const struct i2c_client_address_data addr_data = { \ | ||
| 630 | .normal_i2c = normal_i2c, \ | ||
| 631 | .probe = probe, \ | ||
| 632 | .ignore = ignore, \ | ||
| 633 | .forces = forces, \ | ||
| 634 | } | ||
| 635 | |||
| 636 | #define I2C_CLIENT_FORCE_TEXT \ | ||
| 637 | "List of adapter,address pairs to boldly assume to be present" | ||
| 638 | |||
| 639 | /* These are the ones you want to use in your own drivers. Pick the one | ||
| 640 | which matches the number of devices the driver differenciates between. */ | ||
| 641 | #define I2C_CLIENT_INSMOD \ | ||
| 642 | I2C_CLIENT_MODULE_PARM(force, I2C_CLIENT_FORCE_TEXT); \ | ||
| 643 | static const unsigned short * const forces[] = { force, NULL }; \ | ||
| 644 | I2C_CLIENT_INSMOD_COMMON | ||
| 645 | |||
| 646 | #define I2C_CLIENT_INSMOD_1(chip1) \ | ||
| 647 | enum chips { any_chip, chip1 }; \ | ||
| 648 | I2C_CLIENT_MODULE_PARM(force, I2C_CLIENT_FORCE_TEXT); \ | ||
| 649 | I2C_CLIENT_MODULE_PARM_FORCE(chip1); \ | ||
| 650 | static const unsigned short * const forces[] = { force, \ | ||
| 651 | force_##chip1, NULL }; \ | ||
| 652 | I2C_CLIENT_INSMOD_COMMON | ||
| 653 | |||
| 654 | #define I2C_CLIENT_INSMOD_2(chip1, chip2) \ | ||
| 655 | enum chips { any_chip, chip1, chip2 }; \ | ||
| 656 | I2C_CLIENT_MODULE_PARM(force, I2C_CLIENT_FORCE_TEXT); \ | ||
| 657 | I2C_CLIENT_MODULE_PARM_FORCE(chip1); \ | ||
| 658 | I2C_CLIENT_MODULE_PARM_FORCE(chip2); \ | ||
| 659 | static const unsigned short * const forces[] = { force, \ | ||
| 660 | force_##chip1, force_##chip2, NULL }; \ | ||
| 661 | I2C_CLIENT_INSMOD_COMMON | ||
| 662 | |||
| 663 | #define I2C_CLIENT_INSMOD_3(chip1, chip2, chip3) \ | ||
| 664 | enum chips { any_chip, chip1, chip2, chip3 }; \ | ||
| 665 | I2C_CLIENT_MODULE_PARM(force, I2C_CLIENT_FORCE_TEXT); \ | ||
| 666 | I2C_CLIENT_MODULE_PARM_FORCE(chip1); \ | ||
| 667 | I2C_CLIENT_MODULE_PARM_FORCE(chip2); \ | ||
| 668 | I2C_CLIENT_MODULE_PARM_FORCE(chip3); \ | ||
| 669 | static const unsigned short * const forces[] = { force, \ | ||
| 670 | force_##chip1, force_##chip2, force_##chip3, NULL }; \ | ||
| 671 | I2C_CLIENT_INSMOD_COMMON | ||
| 672 | |||
| 673 | #define I2C_CLIENT_INSMOD_4(chip1, chip2, chip3, chip4) \ | ||
| 674 | enum chips { any_chip, chip1, chip2, chip3, chip4 }; \ | ||
| 675 | I2C_CLIENT_MODULE_PARM(force, I2C_CLIENT_FORCE_TEXT); \ | ||
| 676 | I2C_CLIENT_MODULE_PARM_FORCE(chip1); \ | ||
| 677 | I2C_CLIENT_MODULE_PARM_FORCE(chip2); \ | ||
| 678 | I2C_CLIENT_MODULE_PARM_FORCE(chip3); \ | ||
| 679 | I2C_CLIENT_MODULE_PARM_FORCE(chip4); \ | ||
| 680 | static const unsigned short * const forces[] = { force, \ | ||
| 681 | force_##chip1, force_##chip2, force_##chip3, \ | ||
| 682 | force_##chip4, NULL}; \ | ||
| 683 | I2C_CLIENT_INSMOD_COMMON | ||
| 684 | |||
| 685 | #define I2C_CLIENT_INSMOD_5(chip1, chip2, chip3, chip4, chip5) \ | ||
| 686 | enum chips { any_chip, chip1, chip2, chip3, chip4, chip5 }; \ | ||
| 687 | I2C_CLIENT_MODULE_PARM(force, I2C_CLIENT_FORCE_TEXT); \ | ||
| 688 | I2C_CLIENT_MODULE_PARM_FORCE(chip1); \ | ||
| 689 | I2C_CLIENT_MODULE_PARM_FORCE(chip2); \ | ||
| 690 | I2C_CLIENT_MODULE_PARM_FORCE(chip3); \ | ||
| 691 | I2C_CLIENT_MODULE_PARM_FORCE(chip4); \ | ||
| 692 | I2C_CLIENT_MODULE_PARM_FORCE(chip5); \ | ||
| 693 | static const unsigned short * const forces[] = { force, \ | ||
| 694 | force_##chip1, force_##chip2, force_##chip3, \ | ||
| 695 | force_##chip4, force_##chip5, NULL }; \ | ||
| 696 | I2C_CLIENT_INSMOD_COMMON | ||
| 697 | |||
| 698 | #define I2C_CLIENT_INSMOD_6(chip1, chip2, chip3, chip4, chip5, chip6) \ | ||
| 699 | enum chips { any_chip, chip1, chip2, chip3, chip4, chip5, chip6 }; \ | ||
| 700 | I2C_CLIENT_MODULE_PARM(force, I2C_CLIENT_FORCE_TEXT); \ | ||
| 701 | I2C_CLIENT_MODULE_PARM_FORCE(chip1); \ | ||
| 702 | I2C_CLIENT_MODULE_PARM_FORCE(chip2); \ | ||
| 703 | I2C_CLIENT_MODULE_PARM_FORCE(chip3); \ | ||
| 704 | I2C_CLIENT_MODULE_PARM_FORCE(chip4); \ | ||
| 705 | I2C_CLIENT_MODULE_PARM_FORCE(chip5); \ | ||
| 706 | I2C_CLIENT_MODULE_PARM_FORCE(chip6); \ | ||
| 707 | static const unsigned short * const forces[] = { force, \ | ||
| 708 | force_##chip1, force_##chip2, force_##chip3, \ | ||
| 709 | force_##chip4, force_##chip5, force_##chip6, NULL }; \ | ||
| 710 | I2C_CLIENT_INSMOD_COMMON | ||
| 711 | |||
| 712 | #define I2C_CLIENT_INSMOD_7(chip1, chip2, chip3, chip4, chip5, chip6, chip7) \ | ||
| 713 | enum chips { any_chip, chip1, chip2, chip3, chip4, chip5, chip6, \ | ||
| 714 | chip7 }; \ | ||
| 715 | I2C_CLIENT_MODULE_PARM(force, I2C_CLIENT_FORCE_TEXT); \ | ||
| 716 | I2C_CLIENT_MODULE_PARM_FORCE(chip1); \ | ||
| 717 | I2C_CLIENT_MODULE_PARM_FORCE(chip2); \ | ||
| 718 | I2C_CLIENT_MODULE_PARM_FORCE(chip3); \ | ||
| 719 | I2C_CLIENT_MODULE_PARM_FORCE(chip4); \ | ||
| 720 | I2C_CLIENT_MODULE_PARM_FORCE(chip5); \ | ||
| 721 | I2C_CLIENT_MODULE_PARM_FORCE(chip6); \ | ||
| 722 | I2C_CLIENT_MODULE_PARM_FORCE(chip7); \ | ||
| 723 | static const unsigned short * const forces[] = { force, \ | ||
| 724 | force_##chip1, force_##chip2, force_##chip3, \ | ||
| 725 | force_##chip4, force_##chip5, force_##chip6, \ | ||
| 726 | force_##chip7, NULL }; \ | ||
| 727 | I2C_CLIENT_INSMOD_COMMON | ||
| 728 | |||
| 729 | #define I2C_CLIENT_INSMOD_8(chip1, chip2, chip3, chip4, chip5, chip6, chip7, chip8) \ | ||
| 730 | enum chips { any_chip, chip1, chip2, chip3, chip4, chip5, chip6, \ | ||
| 731 | chip7, chip8 }; \ | ||
| 732 | I2C_CLIENT_MODULE_PARM(force, I2C_CLIENT_FORCE_TEXT); \ | ||
| 733 | I2C_CLIENT_MODULE_PARM_FORCE(chip1); \ | ||
| 734 | I2C_CLIENT_MODULE_PARM_FORCE(chip2); \ | ||
| 735 | I2C_CLIENT_MODULE_PARM_FORCE(chip3); \ | ||
| 736 | I2C_CLIENT_MODULE_PARM_FORCE(chip4); \ | ||
| 737 | I2C_CLIENT_MODULE_PARM_FORCE(chip5); \ | ||
| 738 | I2C_CLIENT_MODULE_PARM_FORCE(chip6); \ | ||
| 739 | I2C_CLIENT_MODULE_PARM_FORCE(chip7); \ | ||
| 740 | I2C_CLIENT_MODULE_PARM_FORCE(chip8); \ | ||
| 741 | static const unsigned short * const forces[] = { force, \ | ||
| 742 | force_##chip1, force_##chip2, force_##chip3, \ | ||
| 743 | force_##chip4, force_##chip5, force_##chip6, \ | ||
| 744 | force_##chip7, force_##chip8, NULL }; \ | ||
| 745 | I2C_CLIENT_INSMOD_COMMON | ||
| 746 | #endif /* __KERNEL__ */ | ||
| 747 | #endif /* _LINUX_I2C_H */ | 581 | #endif /* _LINUX_I2C_H */ |
diff --git a/include/linux/i2c/adp5588.h b/include/linux/i2c/adp5588.h index fc5db826b48e..02c9af374741 100644 --- a/include/linux/i2c/adp5588.h +++ b/include/linux/i2c/adp5588.h | |||
| @@ -89,4 +89,16 @@ struct adp5588_kpad_platform_data { | |||
| 89 | unsigned short unlock_key2; /* Unlock Key 2 */ | 89 | unsigned short unlock_key2; /* Unlock Key 2 */ |
| 90 | }; | 90 | }; |
| 91 | 91 | ||
| 92 | struct adp5588_gpio_platform_data { | ||
| 93 | unsigned gpio_start; /* GPIO Chip base # */ | ||
| 94 | unsigned pullup_dis_mask; /* Pull-Up Disable Mask */ | ||
| 95 | int (*setup)(struct i2c_client *client, | ||
| 96 | int gpio, unsigned ngpio, | ||
| 97 | void *context); | ||
| 98 | int (*teardown)(struct i2c_client *client, | ||
| 99 | int gpio, unsigned ngpio, | ||
| 100 | void *context); | ||
| 101 | void *context; | ||
| 102 | }; | ||
| 103 | |||
| 92 | #endif | 104 | #endif |
diff --git a/include/linux/i2c/pca953x.h b/include/linux/i2c/pca953x.h index 81736d6a8db7..d5c5a60c8a0b 100644 --- a/include/linux/i2c/pca953x.h +++ b/include/linux/i2c/pca953x.h | |||
| @@ -1,3 +1,9 @@ | |||
| 1 | #ifndef _LINUX_PCA953X_H | ||
| 2 | #define _LINUX_PCA953X_H | ||
| 3 | |||
| 4 | #include <linux/types.h> | ||
| 5 | #include <linux/i2c.h> | ||
| 6 | |||
| 1 | /* platform data for the PCA9539 16-bit I/O expander driver */ | 7 | /* platform data for the PCA9539 16-bit I/O expander driver */ |
| 2 | 8 | ||
| 3 | struct pca953x_platform_data { | 9 | struct pca953x_platform_data { |
| @@ -7,6 +13,9 @@ struct pca953x_platform_data { | |||
| 7 | /* initial polarity inversion setting */ | 13 | /* initial polarity inversion setting */ |
| 8 | uint16_t invert; | 14 | uint16_t invert; |
| 9 | 15 | ||
| 16 | /* interrupt base */ | ||
| 17 | int irq_base; | ||
| 18 | |||
| 10 | void *context; /* param to setup/teardown */ | 19 | void *context; /* param to setup/teardown */ |
| 11 | 20 | ||
| 12 | int (*setup)(struct i2c_client *client, | 21 | int (*setup)(struct i2c_client *client, |
| @@ -17,3 +26,5 @@ struct pca953x_platform_data { | |||
| 17 | void *context); | 26 | void *context); |
| 18 | char **names; | 27 | char **names; |
| 19 | }; | 28 | }; |
| 29 | |||
| 30 | #endif /* _LINUX_PCA953X_H */ | ||
diff --git a/include/linux/i2c/tps65010.h b/include/linux/i2c/tps65010.h index 918c5354d9b8..08aa92278d71 100644 --- a/include/linux/i2c/tps65010.h +++ b/include/linux/i2c/tps65010.h | |||
| @@ -72,6 +72,21 @@ | |||
| 72 | #define TPS_VDCDC1 0x0c | 72 | #define TPS_VDCDC1 0x0c |
| 73 | # define TPS_ENABLE_LP (1 << 3) | 73 | # define TPS_ENABLE_LP (1 << 3) |
| 74 | #define TPS_VDCDC2 0x0d | 74 | #define TPS_VDCDC2 0x0d |
| 75 | # define TPS_LP_COREOFF (1 << 7) | ||
| 76 | # define TPS_VCORE_1_8V (7<<4) | ||
| 77 | # define TPS_VCORE_1_5V (6 << 4) | ||
| 78 | # define TPS_VCORE_1_4V (5 << 4) | ||
| 79 | # define TPS_VCORE_1_3V (4 << 4) | ||
| 80 | # define TPS_VCORE_1_2V (3 << 4) | ||
| 81 | # define TPS_VCORE_1_1V (2 << 4) | ||
| 82 | # define TPS_VCORE_1_0V (1 << 4) | ||
| 83 | # define TPS_VCORE_0_85V (0 << 4) | ||
| 84 | # define TPS_VCORE_LP_1_2V (3 << 2) | ||
| 85 | # define TPS_VCORE_LP_1_1V (2 << 2) | ||
| 86 | # define TPS_VCORE_LP_1_0V (1 << 2) | ||
| 87 | # define TPS_VCORE_LP_0_85V (0 << 2) | ||
| 88 | # define TPS_VIB (1 << 1) | ||
| 89 | # define TPS_VCORE_DISCH (1 << 0) | ||
| 75 | #define TPS_VREGS1 0x0e | 90 | #define TPS_VREGS1 0x0e |
| 76 | # define TPS_LDO2_ENABLE (1 << 7) | 91 | # define TPS_LDO2_ENABLE (1 << 7) |
| 77 | # define TPS_LDO2_OFF (1 << 6) | 92 | # define TPS_LDO2_OFF (1 << 6) |
| @@ -152,6 +167,10 @@ extern int tps65010_config_vregs1(unsigned value); | |||
| 152 | */ | 167 | */ |
| 153 | extern int tps65013_set_low_pwr(unsigned mode); | 168 | extern int tps65013_set_low_pwr(unsigned mode); |
| 154 | 169 | ||
| 170 | /* tps65010_set_vdcdc2 | ||
| 171 | * value to be written to VDCDC2 | ||
| 172 | */ | ||
| 173 | extern int tps65010_config_vdcdc2(unsigned value); | ||
| 155 | 174 | ||
| 156 | struct i2c_client; | 175 | struct i2c_client; |
| 157 | 176 | ||
diff --git a/include/linux/i2c/twl4030.h b/include/linux/i2c/twl.h index 508824ee35e6..fb6784e86d5f 100644 --- a/include/linux/i2c/twl4030.h +++ b/include/linux/i2c/twl.h | |||
| @@ -22,8 +22,8 @@ | |||
| 22 | * | 22 | * |
| 23 | */ | 23 | */ |
| 24 | 24 | ||
| 25 | #ifndef __TWL4030_H_ | 25 | #ifndef __TWL_H_ |
| 26 | #define __TWL4030_H_ | 26 | #define __TWL_H_ |
| 27 | 27 | ||
| 28 | #include <linux/types.h> | 28 | #include <linux/types.h> |
| 29 | #include <linux/input/matrix_keypad.h> | 29 | #include <linux/input/matrix_keypad.h> |
| @@ -61,28 +61,117 @@ | |||
| 61 | #define TWL4030_MODULE_PWMA 0x0E | 61 | #define TWL4030_MODULE_PWMA 0x0E |
| 62 | #define TWL4030_MODULE_PWMB 0x0F | 62 | #define TWL4030_MODULE_PWMB 0x0F |
| 63 | 63 | ||
| 64 | #define TWL5031_MODULE_ACCESSORY 0x10 | ||
| 65 | #define TWL5031_MODULE_INTERRUPTS 0x11 | ||
| 66 | |||
| 64 | /* Slave 3 (i2c address 0x4b) */ | 67 | /* Slave 3 (i2c address 0x4b) */ |
| 65 | #define TWL4030_MODULE_BACKUP 0x10 | 68 | #define TWL4030_MODULE_BACKUP 0x12 |
| 66 | #define TWL4030_MODULE_INT 0x11 | 69 | #define TWL4030_MODULE_INT 0x13 |
| 67 | #define TWL4030_MODULE_PM_MASTER 0x12 | 70 | #define TWL4030_MODULE_PM_MASTER 0x14 |
| 68 | #define TWL4030_MODULE_PM_RECEIVER 0x13 | 71 | #define TWL4030_MODULE_PM_RECEIVER 0x15 |
| 69 | #define TWL4030_MODULE_RTC 0x14 | 72 | #define TWL4030_MODULE_RTC 0x16 |
| 70 | #define TWL4030_MODULE_SECURED_REG 0x15 | 73 | #define TWL4030_MODULE_SECURED_REG 0x17 |
| 74 | |||
| 75 | #define TWL_MODULE_USB TWL4030_MODULE_USB | ||
| 76 | #define TWL_MODULE_AUDIO_VOICE TWL4030_MODULE_AUDIO_VOICE | ||
| 77 | #define TWL_MODULE_PIH TWL4030_MODULE_PIH | ||
| 78 | #define TWL_MODULE_MADC TWL4030_MODULE_MADC | ||
| 79 | #define TWL_MODULE_MAIN_CHARGE TWL4030_MODULE_MAIN_CHARGE | ||
| 80 | #define TWL_MODULE_PM_MASTER TWL4030_MODULE_PM_MASTER | ||
| 81 | #define TWL_MODULE_PM_RECEIVER TWL4030_MODULE_PM_RECEIVER | ||
| 82 | #define TWL_MODULE_RTC TWL4030_MODULE_RTC | ||
| 83 | #define TWL_MODULE_PWM TWL4030_MODULE_PWM0 | ||
| 84 | |||
| 85 | #define TWL6030_MODULE_ID0 0x0D | ||
| 86 | #define TWL6030_MODULE_ID1 0x0E | ||
| 87 | #define TWL6030_MODULE_ID2 0x0F | ||
| 88 | |||
| 89 | #define GPIO_INTR_OFFSET 0 | ||
| 90 | #define KEYPAD_INTR_OFFSET 1 | ||
| 91 | #define BCI_INTR_OFFSET 2 | ||
| 92 | #define MADC_INTR_OFFSET 3 | ||
| 93 | #define USB_INTR_OFFSET 4 | ||
| 94 | #define BCI_PRES_INTR_OFFSET 9 | ||
| 95 | #define USB_PRES_INTR_OFFSET 10 | ||
| 96 | #define RTC_INTR_OFFSET 11 | ||
| 97 | |||
| 98 | /* | ||
| 99 | * Offset from TWL6030_IRQ_BASE / pdata->irq_base | ||
| 100 | */ | ||
| 101 | #define PWR_INTR_OFFSET 0 | ||
| 102 | #define HOTDIE_INTR_OFFSET 12 | ||
| 103 | #define SMPSLDO_INTR_OFFSET 13 | ||
| 104 | #define BATDETECT_INTR_OFFSET 14 | ||
| 105 | #define SIMDETECT_INTR_OFFSET 15 | ||
| 106 | #define MMCDETECT_INTR_OFFSET 16 | ||
| 107 | #define GASGAUGE_INTR_OFFSET 17 | ||
| 108 | #define USBOTG_INTR_OFFSET 4 | ||
| 109 | #define CHARGER_INTR_OFFSET 2 | ||
| 110 | #define RSV_INTR_OFFSET 0 | ||
| 111 | |||
| 112 | /* INT register offsets */ | ||
| 113 | #define REG_INT_STS_A 0x00 | ||
| 114 | #define REG_INT_STS_B 0x01 | ||
| 115 | #define REG_INT_STS_C 0x02 | ||
| 116 | |||
| 117 | #define REG_INT_MSK_LINE_A 0x03 | ||
| 118 | #define REG_INT_MSK_LINE_B 0x04 | ||
| 119 | #define REG_INT_MSK_LINE_C 0x05 | ||
| 120 | |||
| 121 | #define REG_INT_MSK_STS_A 0x06 | ||
| 122 | #define REG_INT_MSK_STS_B 0x07 | ||
| 123 | #define REG_INT_MSK_STS_C 0x08 | ||
| 124 | |||
| 125 | /* MASK INT REG GROUP A */ | ||
| 126 | #define TWL6030_PWR_INT_MASK 0x07 | ||
| 127 | #define TWL6030_RTC_INT_MASK 0x18 | ||
| 128 | #define TWL6030_HOTDIE_INT_MASK 0x20 | ||
| 129 | #define TWL6030_SMPSLDOA_INT_MASK 0xC0 | ||
| 130 | |||
| 131 | /* MASK INT REG GROUP B */ | ||
| 132 | #define TWL6030_SMPSLDOB_INT_MASK 0x01 | ||
| 133 | #define TWL6030_BATDETECT_INT_MASK 0x02 | ||
| 134 | #define TWL6030_SIMDETECT_INT_MASK 0x04 | ||
| 135 | #define TWL6030_MMCDETECT_INT_MASK 0x08 | ||
| 136 | #define TWL6030_GPADC_INT_MASK 0x60 | ||
| 137 | #define TWL6030_GASGAUGE_INT_MASK 0x80 | ||
| 138 | |||
| 139 | /* MASK INT REG GROUP C */ | ||
| 140 | #define TWL6030_USBOTG_INT_MASK 0x0F | ||
| 141 | #define TWL6030_CHARGER_CTRL_INT_MASK 0x10 | ||
| 142 | #define TWL6030_CHARGER_FAULT_INT_MASK 0x60 | ||
| 143 | |||
| 144 | |||
| 145 | #define TWL4030_CLASS_ID 0x4030 | ||
| 146 | #define TWL6030_CLASS_ID 0x6030 | ||
| 147 | unsigned int twl_rev(void); | ||
| 148 | #define GET_TWL_REV (twl_rev()) | ||
| 149 | #define TWL_CLASS_IS(class, id) \ | ||
| 150 | static inline int twl_class_is_ ##class(void) \ | ||
| 151 | { \ | ||
| 152 | return ((id) == (GET_TWL_REV)) ? 1 : 0; \ | ||
| 153 | } | ||
| 154 | |||
| 155 | TWL_CLASS_IS(4030, TWL4030_CLASS_ID) | ||
| 156 | TWL_CLASS_IS(6030, TWL6030_CLASS_ID) | ||
| 71 | 157 | ||
| 72 | /* | 158 | /* |
| 73 | * Read and write single 8-bit registers | 159 | * Read and write single 8-bit registers |
| 74 | */ | 160 | */ |
| 75 | int twl4030_i2c_write_u8(u8 mod_no, u8 val, u8 reg); | 161 | int twl_i2c_write_u8(u8 mod_no, u8 val, u8 reg); |
| 76 | int twl4030_i2c_read_u8(u8 mod_no, u8 *val, u8 reg); | 162 | int twl_i2c_read_u8(u8 mod_no, u8 *val, u8 reg); |
| 77 | 163 | ||
| 78 | /* | 164 | /* |
| 79 | * Read and write several 8-bit registers at once. | 165 | * Read and write several 8-bit registers at once. |
| 80 | * | 166 | * |
| 81 | * IMPORTANT: For twl4030_i2c_write(), allocate num_bytes + 1 | 167 | * IMPORTANT: For twl_i2c_write(), allocate num_bytes + 1 |
| 82 | * for the value, and populate your data starting at offset 1. | 168 | * for the value, and populate your data starting at offset 1. |
| 83 | */ | 169 | */ |
| 84 | int twl4030_i2c_write(u8 mod_no, u8 *value, u8 reg, unsigned num_bytes); | 170 | int twl_i2c_write(u8 mod_no, u8 *value, u8 reg, unsigned num_bytes); |
| 85 | int twl4030_i2c_read(u8 mod_no, u8 *value, u8 reg, unsigned num_bytes); | 171 | int twl_i2c_read(u8 mod_no, u8 *value, u8 reg, unsigned num_bytes); |
| 172 | |||
| 173 | int twl6030_interrupt_unmask(u8 bit_mask, u8 offset); | ||
| 174 | int twl6030_interrupt_mask(u8 bit_mask, u8 offset); | ||
| 86 | 175 | ||
| 87 | /*----------------------------------------------------------------------*/ | 176 | /*----------------------------------------------------------------------*/ |
| 88 | 177 | ||
| @@ -155,6 +244,21 @@ int twl4030_i2c_read(u8 mod_no, u8 *value, u8 reg, unsigned num_bytes); | |||
| 155 | 244 | ||
| 156 | /*----------------------------------------------------------------------*/ | 245 | /*----------------------------------------------------------------------*/ |
| 157 | 246 | ||
| 247 | /*Interface Bit Register (INTBR) offsets | ||
| 248 | *(Use TWL_4030_MODULE_INTBR) | ||
| 249 | */ | ||
| 250 | |||
| 251 | #define REG_GPPUPDCTR1 0x0F | ||
| 252 | |||
| 253 | /*I2C1 and I2C4(SR) SDA/SCL pull-up control bits */ | ||
| 254 | |||
| 255 | #define I2C_SCL_CTRL_PU BIT(0) | ||
| 256 | #define I2C_SDA_CTRL_PU BIT(2) | ||
| 257 | #define SR_I2C_SCL_CTRL_PU BIT(4) | ||
| 258 | #define SR_I2C_SDA_CTRL_PU BIT(6) | ||
| 259 | |||
| 260 | /*----------------------------------------------------------------------*/ | ||
| 261 | |||
| 158 | /* | 262 | /* |
| 159 | * Keypad register offsets (use TWL4030_MODULE_KEYPAD) | 263 | * Keypad register offsets (use TWL4030_MODULE_KEYPAD) |
| 160 | * ... SIH/interrupt only | 264 | * ... SIH/interrupt only |
| @@ -221,6 +325,38 @@ int twl4030_i2c_read(u8 mod_no, u8 *value, u8 reg, unsigned num_bytes); | |||
| 221 | 325 | ||
| 222 | /*----------------------------------------------------------------------*/ | 326 | /*----------------------------------------------------------------------*/ |
| 223 | 327 | ||
| 328 | /* | ||
| 329 | * Accessory Interrupts | ||
| 330 | */ | ||
| 331 | #define TWL5031_ACIIMR_LSB 0x05 | ||
| 332 | #define TWL5031_ACIIMR_MSB 0x06 | ||
| 333 | #define TWL5031_ACIIDR_LSB 0x07 | ||
| 334 | #define TWL5031_ACIIDR_MSB 0x08 | ||
| 335 | #define TWL5031_ACCISR1 0x0F | ||
| 336 | #define TWL5031_ACCIMR1 0x10 | ||
| 337 | #define TWL5031_ACCISR2 0x11 | ||
| 338 | #define TWL5031_ACCIMR2 0x12 | ||
| 339 | #define TWL5031_ACCSIR 0x13 | ||
| 340 | #define TWL5031_ACCEDR1 0x14 | ||
| 341 | #define TWL5031_ACCSIHCTRL 0x15 | ||
| 342 | |||
| 343 | /*----------------------------------------------------------------------*/ | ||
| 344 | |||
| 345 | /* | ||
| 346 | * Battery Charger Controller | ||
| 347 | */ | ||
| 348 | |||
| 349 | #define TWL5031_INTERRUPTS_BCIISR1 0x0 | ||
| 350 | #define TWL5031_INTERRUPTS_BCIIMR1 0x1 | ||
| 351 | #define TWL5031_INTERRUPTS_BCIISR2 0x2 | ||
| 352 | #define TWL5031_INTERRUPTS_BCIIMR2 0x3 | ||
| 353 | #define TWL5031_INTERRUPTS_BCISIR 0x4 | ||
| 354 | #define TWL5031_INTERRUPTS_BCIEDR1 0x5 | ||
| 355 | #define TWL5031_INTERRUPTS_BCIEDR2 0x6 | ||
| 356 | #define TWL5031_INTERRUPTS_BCISIHCTRL 0x7 | ||
| 357 | |||
| 358 | /*----------------------------------------------------------------------*/ | ||
| 359 | |||
| 224 | /* Power bus message definitions */ | 360 | /* Power bus message definitions */ |
| 225 | 361 | ||
| 226 | /* The TWL4030/5030 splits its power-management resources (the various | 362 | /* The TWL4030/5030 splits its power-management resources (the various |
| @@ -250,6 +386,7 @@ int twl4030_i2c_read(u8 mod_no, u8 *value, u8 reg, unsigned num_bytes); | |||
| 250 | 386 | ||
| 251 | #define RES_TYPE_ALL 0x7 | 387 | #define RES_TYPE_ALL 0x7 |
| 252 | 388 | ||
| 389 | /* Resource states */ | ||
| 253 | #define RES_STATE_WRST 0xF | 390 | #define RES_STATE_WRST 0xF |
| 254 | #define RES_STATE_ACTIVE 0xE | 391 | #define RES_STATE_ACTIVE 0xE |
| 255 | #define RES_STATE_SLEEP 0x8 | 392 | #define RES_STATE_SLEEP 0x8 |
| @@ -310,8 +447,18 @@ int twl4030_i2c_read(u8 mod_no, u8 *value, u8 reg, unsigned num_bytes); | |||
| 310 | #define MSG_SINGULAR(devgrp, id, state) \ | 447 | #define MSG_SINGULAR(devgrp, id, state) \ |
| 311 | ((devgrp) << 13 | 0 << 12 | (id) << 4 | (state)) | 448 | ((devgrp) << 13 | 0 << 12 | (id) << 4 | (state)) |
| 312 | 449 | ||
| 450 | #define MSG_BROADCAST_ALL(devgrp, state) \ | ||
| 451 | ((devgrp) << 5 | (state)) | ||
| 452 | |||
| 453 | #define MSG_BROADCAST_REF MSG_BROADCAST_ALL | ||
| 454 | #define MSG_BROADCAST_PROV MSG_BROADCAST_ALL | ||
| 455 | #define MSG_BROADCAST__CLK_RST MSG_BROADCAST_ALL | ||
| 313 | /*----------------------------------------------------------------------*/ | 456 | /*----------------------------------------------------------------------*/ |
| 314 | 457 | ||
| 458 | struct twl4030_clock_init_data { | ||
| 459 | bool ck32k_lowpwr_enable; | ||
| 460 | }; | ||
| 461 | |||
| 315 | struct twl4030_bci_platform_data { | 462 | struct twl4030_bci_platform_data { |
| 316 | int *battery_tmp_tbl; | 463 | int *battery_tmp_tbl; |
| 317 | unsigned int tblsize; | 464 | unsigned int tblsize; |
| @@ -391,38 +538,78 @@ struct twl4030_resconfig { | |||
| 391 | u8 devgroup; /* Processor group that Power resource belongs to */ | 538 | u8 devgroup; /* Processor group that Power resource belongs to */ |
| 392 | u8 type; /* Power resource addressed, 6 / broadcast message */ | 539 | u8 type; /* Power resource addressed, 6 / broadcast message */ |
| 393 | u8 type2; /* Power resource addressed, 3 / broadcast message */ | 540 | u8 type2; /* Power resource addressed, 3 / broadcast message */ |
| 541 | u8 remap_off; /* off state remapping */ | ||
| 542 | u8 remap_sleep; /* sleep state remapping */ | ||
| 394 | }; | 543 | }; |
| 395 | 544 | ||
| 396 | struct twl4030_power_data { | 545 | struct twl4030_power_data { |
| 397 | struct twl4030_script **scripts; | 546 | struct twl4030_script **scripts; |
| 398 | unsigned num; | 547 | unsigned num; |
| 399 | struct twl4030_resconfig *resource_config; | 548 | struct twl4030_resconfig *resource_config; |
| 549 | #define TWL4030_RESCONFIG_UNDEF ((u8)-1) | ||
| 400 | }; | 550 | }; |
| 401 | 551 | ||
| 402 | extern void twl4030_power_init(struct twl4030_power_data *triton2_scripts); | 552 | extern void twl4030_power_init(struct twl4030_power_data *triton2_scripts); |
| 553 | extern int twl4030_remove_script(u8 flags); | ||
| 554 | |||
| 555 | struct twl4030_codec_audio_data { | ||
| 556 | unsigned int audio_mclk; | ||
| 557 | unsigned int ramp_delay_value; | ||
| 558 | unsigned int hs_extmute:1; | ||
| 559 | void (*set_hs_extmute)(int mute); | ||
| 560 | }; | ||
| 561 | |||
| 562 | struct twl4030_codec_vibra_data { | ||
| 563 | unsigned int audio_mclk; | ||
| 564 | unsigned int coexist; | ||
| 565 | }; | ||
| 566 | |||
| 567 | struct twl4030_codec_data { | ||
| 568 | unsigned int audio_mclk; | ||
| 569 | struct twl4030_codec_audio_data *audio; | ||
| 570 | struct twl4030_codec_vibra_data *vibra; | ||
| 571 | |||
| 572 | /* twl6030 */ | ||
| 573 | int audpwron_gpio; /* audio power-on gpio */ | ||
| 574 | int naudint_irq; /* audio interrupt */ | ||
| 575 | }; | ||
| 403 | 576 | ||
| 404 | struct twl4030_platform_data { | 577 | struct twl4030_platform_data { |
| 405 | unsigned irq_base, irq_end; | 578 | unsigned irq_base, irq_end; |
| 579 | struct twl4030_clock_init_data *clock; | ||
| 406 | struct twl4030_bci_platform_data *bci; | 580 | struct twl4030_bci_platform_data *bci; |
| 407 | struct twl4030_gpio_platform_data *gpio; | 581 | struct twl4030_gpio_platform_data *gpio; |
| 408 | struct twl4030_madc_platform_data *madc; | 582 | struct twl4030_madc_platform_data *madc; |
| 409 | struct twl4030_keypad_data *keypad; | 583 | struct twl4030_keypad_data *keypad; |
| 410 | struct twl4030_usb_data *usb; | 584 | struct twl4030_usb_data *usb; |
| 411 | struct twl4030_power_data *power; | 585 | struct twl4030_power_data *power; |
| 586 | struct twl4030_codec_data *codec; | ||
| 412 | 587 | ||
| 413 | /* LDO regulators */ | 588 | /* Common LDO regulators for TWL4030/TWL6030 */ |
| 414 | struct regulator_init_data *vdac; | 589 | struct regulator_init_data *vdac; |
| 590 | struct regulator_init_data *vaux1; | ||
| 591 | struct regulator_init_data *vaux2; | ||
| 592 | struct regulator_init_data *vaux3; | ||
| 593 | /* TWL4030 LDO regulators */ | ||
| 415 | struct regulator_init_data *vpll1; | 594 | struct regulator_init_data *vpll1; |
| 416 | struct regulator_init_data *vpll2; | 595 | struct regulator_init_data *vpll2; |
| 417 | struct regulator_init_data *vmmc1; | 596 | struct regulator_init_data *vmmc1; |
| 418 | struct regulator_init_data *vmmc2; | 597 | struct regulator_init_data *vmmc2; |
| 419 | struct regulator_init_data *vsim; | 598 | struct regulator_init_data *vsim; |
| 420 | struct regulator_init_data *vaux1; | ||
| 421 | struct regulator_init_data *vaux2; | ||
| 422 | struct regulator_init_data *vaux3; | ||
| 423 | struct regulator_init_data *vaux4; | 599 | struct regulator_init_data *vaux4; |
| 424 | 600 | struct regulator_init_data *vio; | |
| 425 | /* REVISIT more to come ... _nothing_ should be hard-wired */ | 601 | struct regulator_init_data *vdd1; |
| 602 | struct regulator_init_data *vdd2; | ||
| 603 | struct regulator_init_data *vintana1; | ||
| 604 | struct regulator_init_data *vintana2; | ||
| 605 | struct regulator_init_data *vintdig; | ||
| 606 | /* TWL6030 LDO regulators */ | ||
| 607 | struct regulator_init_data *vmmc; | ||
| 608 | struct regulator_init_data *vpp; | ||
| 609 | struct regulator_init_data *vusim; | ||
| 610 | struct regulator_init_data *vana; | ||
| 611 | struct regulator_init_data *vcxio; | ||
| 612 | struct regulator_init_data *vusb; | ||
| 426 | }; | 613 | }; |
| 427 | 614 | ||
| 428 | /*----------------------------------------------------------------------*/ | 615 | /*----------------------------------------------------------------------*/ |
| @@ -439,12 +626,7 @@ int twl4030_sih_setup(int module); | |||
| 439 | #define TWL4030_VAUX3_DEV_GRP 0x1F | 626 | #define TWL4030_VAUX3_DEV_GRP 0x1F |
| 440 | #define TWL4030_VAUX3_DEDICATED 0x22 | 627 | #define TWL4030_VAUX3_DEDICATED 0x22 |
| 441 | 628 | ||
| 442 | #if defined(CONFIG_TWL4030_BCI_BATTERY) || \ | 629 | static inline int twl4030charger_usb_en(int enable) { return 0; } |
| 443 | defined(CONFIG_TWL4030_BCI_BATTERY_MODULE) | ||
| 444 | extern int twl4030charger_usb_en(int enable); | ||
| 445 | #else | ||
| 446 | static inline int twl4030charger_usb_en(int enable) { return 0; } | ||
| 447 | #endif | ||
| 448 | 630 | ||
| 449 | /*----------------------------------------------------------------------*/ | 631 | /*----------------------------------------------------------------------*/ |
| 450 | 632 | ||
| @@ -454,6 +636,7 @@ int twl4030_sih_setup(int module); | |||
| 454 | * VIO is generally fixed. | 636 | * VIO is generally fixed. |
| 455 | */ | 637 | */ |
| 456 | 638 | ||
| 639 | /* TWL4030 SMPS/LDO's */ | ||
| 457 | /* EXTERNAL dc-to-dc buck converters */ | 640 | /* EXTERNAL dc-to-dc buck converters */ |
| 458 | #define TWL4030_REG_VDD1 0 | 641 | #define TWL4030_REG_VDD1 0 |
| 459 | #define TWL4030_REG_VDD2 1 | 642 | #define TWL4030_REG_VDD2 1 |
| @@ -480,4 +663,31 @@ int twl4030_sih_setup(int module); | |||
| 480 | #define TWL4030_REG_VUSB1V8 18 | 663 | #define TWL4030_REG_VUSB1V8 18 |
| 481 | #define TWL4030_REG_VUSB3V1 19 | 664 | #define TWL4030_REG_VUSB3V1 19 |
| 482 | 665 | ||
| 666 | /* TWL6030 SMPS/LDO's */ | ||
| 667 | /* EXTERNAL dc-to-dc buck convertor contollable via SR */ | ||
| 668 | #define TWL6030_REG_VDD1 30 | ||
| 669 | #define TWL6030_REG_VDD2 31 | ||
| 670 | #define TWL6030_REG_VDD3 32 | ||
| 671 | |||
| 672 | /* Non SR compliant dc-to-dc buck convertors */ | ||
| 673 | #define TWL6030_REG_VMEM 33 | ||
| 674 | #define TWL6030_REG_V2V1 34 | ||
| 675 | #define TWL6030_REG_V1V29 35 | ||
| 676 | #define TWL6030_REG_V1V8 36 | ||
| 677 | |||
| 678 | /* EXTERNAL LDOs */ | ||
| 679 | #define TWL6030_REG_VAUX1_6030 37 | ||
| 680 | #define TWL6030_REG_VAUX2_6030 38 | ||
| 681 | #define TWL6030_REG_VAUX3_6030 39 | ||
| 682 | #define TWL6030_REG_VMMC 40 | ||
| 683 | #define TWL6030_REG_VPP 41 | ||
| 684 | #define TWL6030_REG_VUSIM 42 | ||
| 685 | #define TWL6030_REG_VANA 43 | ||
| 686 | #define TWL6030_REG_VCXIO 44 | ||
| 687 | #define TWL6030_REG_VDAC 45 | ||
| 688 | #define TWL6030_REG_VUSB 46 | ||
| 689 | |||
| 690 | /* INTERNAL LDOs */ | ||
| 691 | #define TWL6030_REG_VRTC 47 | ||
| 692 | |||
| 483 | #endif /* End of __TWL4030_H */ | 693 | #endif /* End of __TWL4030_H */ |
diff --git a/include/linux/i2o.h b/include/linux/i2o.h index 4c4e57d1f19d..9e7a12d6385d 100644 --- a/include/linux/i2o.h +++ b/include/linux/i2o.h | |||
| @@ -385,7 +385,7 @@ | |||
| 385 | /* defines for max_sectors and max_phys_segments */ | 385 | /* defines for max_sectors and max_phys_segments */ |
| 386 | #define I2O_MAX_SECTORS 1024 | 386 | #define I2O_MAX_SECTORS 1024 |
| 387 | #define I2O_MAX_SECTORS_LIMITED 128 | 387 | #define I2O_MAX_SECTORS_LIMITED 128 |
| 388 | #define I2O_MAX_PHYS_SEGMENTS MAX_PHYS_SEGMENTS | 388 | #define I2O_MAX_PHYS_SEGMENTS BLK_MAX_SEGMENTS |
| 389 | 389 | ||
| 390 | /* | 390 | /* |
| 391 | * Message structures | 391 | * Message structures |
| @@ -782,7 +782,6 @@ extern int i2o_exec_lct_get(struct i2o_controller *); | |||
| 782 | #define to_i2o_driver(drv) container_of(drv,struct i2o_driver, driver) | 782 | #define to_i2o_driver(drv) container_of(drv,struct i2o_driver, driver) |
| 783 | #define to_i2o_device(dev) container_of(dev, struct i2o_device, device) | 783 | #define to_i2o_device(dev) container_of(dev, struct i2o_device, device) |
| 784 | #define to_i2o_controller(dev) container_of(dev, struct i2o_controller, device) | 784 | #define to_i2o_controller(dev) container_of(dev, struct i2o_controller, device) |
| 785 | #define kobj_to_i2o_device(kobj) to_i2o_device(container_of(kobj, struct device, kobj)) | ||
| 786 | 785 | ||
| 787 | /** | 786 | /** |
| 788 | * i2o_out_to_virt - Turn an I2O message to a virtual address | 787 | * i2o_out_to_virt - Turn an I2O message to a virtual address |
diff --git a/include/linux/i8042.h b/include/linux/i8042.h index 60c3360ef6ad..9bf6870ee5f4 100644 --- a/include/linux/i8042.h +++ b/include/linux/i8042.h | |||
| @@ -39,6 +39,10 @@ void i8042_lock_chip(void); | |||
| 39 | void i8042_unlock_chip(void); | 39 | void i8042_unlock_chip(void); |
| 40 | int i8042_command(unsigned char *param, int command); | 40 | int i8042_command(unsigned char *param, int command); |
| 41 | bool i8042_check_port_owner(const struct serio *); | 41 | bool i8042_check_port_owner(const struct serio *); |
| 42 | int i8042_install_filter(bool (*filter)(unsigned char data, unsigned char str, | ||
| 43 | struct serio *serio)); | ||
| 44 | int i8042_remove_filter(bool (*filter)(unsigned char data, unsigned char str, | ||
| 45 | struct serio *serio)); | ||
| 42 | 46 | ||
| 43 | #else | 47 | #else |
| 44 | 48 | ||
| @@ -52,7 +56,7 @@ void i8042_unlock_chip(void) | |||
| 52 | 56 | ||
| 53 | int i8042_command(unsigned char *param, int command) | 57 | int i8042_command(unsigned char *param, int command) |
| 54 | { | 58 | { |
| 55 | return -ENOSYS; | 59 | return -ENODEV; |
| 56 | } | 60 | } |
| 57 | 61 | ||
| 58 | bool i8042_check_port_owner(const struct serio *serio) | 62 | bool i8042_check_port_owner(const struct serio *serio) |
| @@ -60,6 +64,18 @@ bool i8042_check_port_owner(const struct serio *serio) | |||
| 60 | return false; | 64 | return false; |
| 61 | } | 65 | } |
| 62 | 66 | ||
| 67 | int i8042_install_filter(bool (*filter)(unsigned char data, unsigned char str, | ||
| 68 | struct serio *serio)) | ||
| 69 | { | ||
| 70 | return -ENODEV; | ||
| 71 | } | ||
| 72 | |||
| 73 | int i8042_remove_filter(bool (*filter)(unsigned char data, unsigned char str, | ||
| 74 | struct serio *serio)) | ||
| 75 | { | ||
| 76 | return -ENODEV; | ||
| 77 | } | ||
| 78 | |||
| 63 | #endif | 79 | #endif |
| 64 | 80 | ||
| 65 | #endif | 81 | #endif |
diff --git a/include/linux/i82593.h b/include/linux/i82593.h new file mode 100644 index 000000000000..afac5c7a323d --- /dev/null +++ b/include/linux/i82593.h | |||
| @@ -0,0 +1,229 @@ | |||
| 1 | /* | ||
| 2 | * Definitions for Intel 82593 CSMA/CD Core LAN Controller | ||
| 3 | * The definitions are taken from the 1992 users manual with Intel | ||
| 4 | * order number 297125-001. | ||
| 5 | * | ||
| 6 | * /usr/src/pc/RCS/i82593.h,v 1.1 1996/07/17 15:23:12 root Exp | ||
| 7 | * | ||
| 8 | * Copyright 1994, Anders Klemets <klemets@it.kth.se> | ||
| 9 | * | ||
| 10 | * HISTORY | ||
| 11 | * i82593.h,v | ||
| 12 | * Revision 1.4 2005/11/4 09:15:00 baroniunas | ||
| 13 | * Modified copyright with permission of author as follows: | ||
| 14 | * | ||
| 15 | * "If I82539.H is the only file with my copyright statement | ||
| 16 | * that is included in the Source Forge project, then you have | ||
| 17 | * my approval to change the copyright statement to be a GPL | ||
| 18 | * license, in the way you proposed on October 10." | ||
| 19 | * | ||
| 20 | * Revision 1.1 1996/07/17 15:23:12 root | ||
| 21 | * Initial revision | ||
| 22 | * | ||
| 23 | * Revision 1.3 1995/04/05 15:13:58 adj | ||
| 24 | * Initial alpha release | ||
| 25 | * | ||
| 26 | * Revision 1.2 1994/06/16 23:57:31 klemets | ||
| 27 | * Mirrored all the fields in the configuration block. | ||
| 28 | * | ||
| 29 | * Revision 1.1 1994/06/02 20:25:34 klemets | ||
| 30 | * Initial revision | ||
| 31 | * | ||
| 32 | * | ||
| 33 | */ | ||
| 34 | #ifndef _I82593_H | ||
| 35 | #define _I82593_H | ||
| 36 | |||
| 37 | /* Intel 82593 CSMA/CD Core LAN Controller */ | ||
| 38 | |||
| 39 | /* Port 0 Command Register definitions */ | ||
| 40 | |||
| 41 | /* Execution operations */ | ||
| 42 | #define OP0_NOP 0 /* CHNL = 0 */ | ||
| 43 | #define OP0_SWIT_TO_PORT_1 0 /* CHNL = 1 */ | ||
| 44 | #define OP0_IA_SETUP 1 | ||
| 45 | #define OP0_CONFIGURE 2 | ||
| 46 | #define OP0_MC_SETUP 3 | ||
| 47 | #define OP0_TRANSMIT 4 | ||
| 48 | #define OP0_TDR 5 | ||
| 49 | #define OP0_DUMP 6 | ||
| 50 | #define OP0_DIAGNOSE 7 | ||
| 51 | #define OP0_TRANSMIT_NO_CRC 9 | ||
| 52 | #define OP0_RETRANSMIT 12 | ||
| 53 | #define OP0_ABORT 13 | ||
| 54 | /* Reception operations */ | ||
| 55 | #define OP0_RCV_ENABLE 8 | ||
| 56 | #define OP0_RCV_DISABLE 10 | ||
| 57 | #define OP0_STOP_RCV 11 | ||
| 58 | /* Status pointer control operations */ | ||
| 59 | #define OP0_FIX_PTR 15 /* CHNL = 1 */ | ||
| 60 | #define OP0_RLS_PTR 15 /* CHNL = 0 */ | ||
| 61 | #define OP0_RESET 14 | ||
| 62 | |||
| 63 | #define CR0_CHNL (1 << 4) /* 0=Channel 0, 1=Channel 1 */ | ||
| 64 | #define CR0_STATUS_0 0x00 | ||
| 65 | #define CR0_STATUS_1 0x20 | ||
| 66 | #define CR0_STATUS_2 0x40 | ||
| 67 | #define CR0_STATUS_3 0x60 | ||
| 68 | #define CR0_INT_ACK (1 << 7) /* 0=No ack, 1=acknowledge */ | ||
| 69 | |||
| 70 | /* Port 0 Status Register definitions */ | ||
| 71 | |||
| 72 | #define SR0_NO_RESULT 0 /* dummy */ | ||
| 73 | #define SR0_EVENT_MASK 0x0f | ||
| 74 | #define SR0_IA_SETUP_DONE 1 | ||
| 75 | #define SR0_CONFIGURE_DONE 2 | ||
| 76 | #define SR0_MC_SETUP_DONE 3 | ||
| 77 | #define SR0_TRANSMIT_DONE 4 | ||
| 78 | #define SR0_TDR_DONE 5 | ||
| 79 | #define SR0_DUMP_DONE 6 | ||
| 80 | #define SR0_DIAGNOSE_PASSED 7 | ||
| 81 | #define SR0_TRANSMIT_NO_CRC_DONE 9 | ||
| 82 | #define SR0_RETRANSMIT_DONE 12 | ||
| 83 | #define SR0_EXECUTION_ABORTED 13 | ||
| 84 | #define SR0_END_OF_FRAME 8 | ||
| 85 | #define SR0_RECEPTION_ABORTED 10 | ||
| 86 | #define SR0_DIAGNOSE_FAILED 15 | ||
| 87 | #define SR0_STOP_REG_HIT 11 | ||
| 88 | |||
| 89 | #define SR0_CHNL (1 << 4) | ||
| 90 | #define SR0_EXECUTION (1 << 5) | ||
| 91 | #define SR0_RECEPTION (1 << 6) | ||
| 92 | #define SR0_INTERRUPT (1 << 7) | ||
| 93 | #define SR0_BOTH_RX_TX (SR0_EXECUTION | SR0_RECEPTION) | ||
| 94 | |||
| 95 | #define SR3_EXEC_STATE_MASK 0x03 | ||
| 96 | #define SR3_EXEC_IDLE 0 | ||
| 97 | #define SR3_TX_ABORT_IN_PROGRESS 1 | ||
| 98 | #define SR3_EXEC_ACTIVE 2 | ||
| 99 | #define SR3_ABORT_IN_PROGRESS 3 | ||
| 100 | #define SR3_EXEC_CHNL (1 << 2) | ||
| 101 | #define SR3_STP_ON_NO_RSRC (1 << 3) | ||
| 102 | #define SR3_RCVING_NO_RSRC (1 << 4) | ||
| 103 | #define SR3_RCV_STATE_MASK 0x60 | ||
| 104 | #define SR3_RCV_IDLE 0x00 | ||
| 105 | #define SR3_RCV_READY 0x20 | ||
| 106 | #define SR3_RCV_ACTIVE 0x40 | ||
| 107 | #define SR3_RCV_STOP_IN_PROG 0x60 | ||
| 108 | #define SR3_RCV_CHNL (1 << 7) | ||
| 109 | |||
| 110 | /* Port 1 Command Register definitions */ | ||
| 111 | |||
| 112 | #define OP1_NOP 0 | ||
| 113 | #define OP1_SWIT_TO_PORT_0 1 | ||
| 114 | #define OP1_INT_DISABLE 2 | ||
| 115 | #define OP1_INT_ENABLE 3 | ||
| 116 | #define OP1_SET_TS 5 | ||
| 117 | #define OP1_RST_TS 7 | ||
| 118 | #define OP1_POWER_DOWN 8 | ||
| 119 | #define OP1_RESET_RING_MNGMT 11 | ||
| 120 | #define OP1_RESET 14 | ||
| 121 | #define OP1_SEL_RST 15 | ||
| 122 | |||
| 123 | #define CR1_STATUS_4 0x00 | ||
| 124 | #define CR1_STATUS_5 0x20 | ||
| 125 | #define CR1_STATUS_6 0x40 | ||
| 126 | #define CR1_STOP_REG_UPDATE (1 << 7) | ||
| 127 | |||
| 128 | /* Receive frame status bits */ | ||
| 129 | |||
| 130 | #define RX_RCLD (1 << 0) | ||
| 131 | #define RX_IA_MATCH (1 << 1) | ||
| 132 | #define RX_NO_AD_MATCH (1 << 2) | ||
| 133 | #define RX_NO_SFD (1 << 3) | ||
| 134 | #define RX_SRT_FRM (1 << 7) | ||
| 135 | #define RX_OVRRUN (1 << 8) | ||
| 136 | #define RX_ALG_ERR (1 << 10) | ||
| 137 | #define RX_CRC_ERR (1 << 11) | ||
| 138 | #define RX_LEN_ERR (1 << 12) | ||
| 139 | #define RX_RCV_OK (1 << 13) | ||
| 140 | #define RX_TYP_LEN (1 << 15) | ||
| 141 | |||
| 142 | /* Transmit status bits */ | ||
| 143 | |||
| 144 | #define TX_NCOL_MASK 0x0f | ||
| 145 | #define TX_FRTL (1 << 4) | ||
| 146 | #define TX_MAX_COL (1 << 5) | ||
| 147 | #define TX_HRT_BEAT (1 << 6) | ||
| 148 | #define TX_DEFER (1 << 7) | ||
| 149 | #define TX_UND_RUN (1 << 8) | ||
| 150 | #define TX_LOST_CTS (1 << 9) | ||
| 151 | #define TX_LOST_CRS (1 << 10) | ||
| 152 | #define TX_LTCOL (1 << 11) | ||
| 153 | #define TX_OK (1 << 13) | ||
| 154 | #define TX_COLL (1 << 15) | ||
| 155 | |||
| 156 | struct i82593_conf_block { | ||
| 157 | u_char fifo_limit : 4, | ||
| 158 | forgnesi : 1, | ||
| 159 | fifo_32 : 1, | ||
| 160 | d6mod : 1, | ||
| 161 | throttle_enb : 1; | ||
| 162 | u_char throttle : 6, | ||
| 163 | cntrxint : 1, | ||
| 164 | contin : 1; | ||
| 165 | u_char addr_len : 3, | ||
| 166 | acloc : 1, | ||
| 167 | preamb_len : 2, | ||
| 168 | loopback : 2; | ||
| 169 | u_char lin_prio : 3, | ||
| 170 | tbofstop : 1, | ||
| 171 | exp_prio : 3, | ||
| 172 | bof_met : 1; | ||
| 173 | u_char : 4, | ||
| 174 | ifrm_spc : 4; | ||
| 175 | u_char : 5, | ||
| 176 | slottim_low : 3; | ||
| 177 | u_char slottim_hi : 3, | ||
| 178 | : 1, | ||
| 179 | max_retr : 4; | ||
| 180 | u_char prmisc : 1, | ||
| 181 | bc_dis : 1, | ||
| 182 | : 1, | ||
| 183 | crs_1 : 1, | ||
| 184 | nocrc_ins : 1, | ||
| 185 | crc_1632 : 1, | ||
| 186 | : 1, | ||
| 187 | crs_cdt : 1; | ||
| 188 | u_char cs_filter : 3, | ||
| 189 | crs_src : 1, | ||
| 190 | cd_filter : 3, | ||
| 191 | : 1; | ||
| 192 | u_char : 2, | ||
| 193 | min_fr_len : 6; | ||
| 194 | u_char lng_typ : 1, | ||
| 195 | lng_fld : 1, | ||
| 196 | rxcrc_xf : 1, | ||
| 197 | artx : 1, | ||
| 198 | sarec : 1, | ||
| 199 | tx_jabber : 1, /* why is this called max_len in the manual? */ | ||
| 200 | hash_1 : 1, | ||
| 201 | lbpkpol : 1; | ||
| 202 | u_char : 6, | ||
| 203 | fdx : 1, | ||
| 204 | : 1; | ||
| 205 | u_char dummy_6 : 6, /* supposed to be ones */ | ||
| 206 | mult_ia : 1, | ||
| 207 | dis_bof : 1; | ||
| 208 | u_char dummy_1 : 1, /* supposed to be one */ | ||
| 209 | tx_ifs_retrig : 2, | ||
| 210 | mc_all : 1, | ||
| 211 | rcv_mon : 2, | ||
| 212 | frag_acpt : 1, | ||
| 213 | tstrttrs : 1; | ||
| 214 | u_char fretx : 1, | ||
| 215 | runt_eop : 1, | ||
| 216 | hw_sw_pin : 1, | ||
| 217 | big_endn : 1, | ||
| 218 | syncrqs : 1, | ||
| 219 | sttlen : 1, | ||
| 220 | tx_eop : 1, | ||
| 221 | rx_eop : 1; | ||
| 222 | u_char rbuf_size : 5, | ||
| 223 | rcvstop : 1, | ||
| 224 | : 2; | ||
| 225 | }; | ||
| 226 | |||
| 227 | #define I82593_MAX_MULTICAST_ADDRESSES 128 /* Hardware hashed filter */ | ||
| 228 | |||
| 229 | #endif /* _I82593_H */ | ||
diff --git a/include/linux/icmpv6.h b/include/linux/icmpv6.h index c0d8357917e2..4c4c74ec5987 100644 --- a/include/linux/icmpv6.h +++ b/include/linux/icmpv6.h | |||
| @@ -174,8 +174,7 @@ struct icmp6_filter { | |||
| 174 | 174 | ||
| 175 | extern void icmpv6_send(struct sk_buff *skb, | 175 | extern void icmpv6_send(struct sk_buff *skb, |
| 176 | u8 type, u8 code, | 176 | u8 type, u8 code, |
| 177 | __u32 info, | 177 | __u32 info); |
| 178 | struct net_device *dev); | ||
| 179 | 178 | ||
| 180 | extern int icmpv6_init(void); | 179 | extern int icmpv6_init(void); |
| 181 | extern int icmpv6_err_convert(u8 type, u8 code, | 180 | extern int icmpv6_err_convert(u8 type, u8 code, |
diff --git a/include/linux/ide.h b/include/linux/ide.h index e4135d6e0556..3239d1c10acb 100644 --- a/include/linux/ide.h +++ b/include/linux/ide.h | |||
| @@ -125,8 +125,8 @@ struct ide_io_ports { | |||
| 125 | * Timeouts for various operations: | 125 | * Timeouts for various operations: |
| 126 | */ | 126 | */ |
| 127 | enum { | 127 | enum { |
| 128 | /* spec allows up to 20ms */ | 128 | /* spec allows up to 20ms, but CF cards and SSD drives need more */ |
| 129 | WAIT_DRQ = HZ / 10, /* 100ms */ | 129 | WAIT_DRQ = 1 * HZ, /* 1s */ |
| 130 | /* some laptops are very slow */ | 130 | /* some laptops are very slow */ |
| 131 | WAIT_READY = 5 * HZ, /* 5s */ | 131 | WAIT_READY = 5 * HZ, /* 5s */ |
| 132 | /* should be less than 3ms (?), if all ATAPI CD is closed at boot */ | 132 | /* should be less than 3ms (?), if all ATAPI CD is closed at boot */ |
| @@ -515,6 +515,8 @@ struct ide_drive_s { | |||
| 515 | u8 init_speed; /* transfer rate set at boot */ | 515 | u8 init_speed; /* transfer rate set at boot */ |
| 516 | u8 current_speed; /* current transfer rate set */ | 516 | u8 current_speed; /* current transfer rate set */ |
| 517 | u8 desired_speed; /* desired transfer rate set */ | 517 | u8 desired_speed; /* desired transfer rate set */ |
| 518 | u8 pio_mode; /* for ->set_pio_mode _only_ */ | ||
| 519 | u8 dma_mode; /* for ->dma_pio_mode _only_ */ | ||
| 518 | u8 dn; /* now wide spread use */ | 520 | u8 dn; /* now wide spread use */ |
| 519 | u8 acoustic; /* acoustic management */ | 521 | u8 acoustic; /* acoustic management */ |
| 520 | u8 media; /* disk, cdrom, tape, floppy, ... */ | 522 | u8 media; /* disk, cdrom, tape, floppy, ... */ |
| @@ -622,8 +624,8 @@ extern const struct ide_tp_ops default_tp_ops; | |||
| 622 | */ | 624 | */ |
| 623 | struct ide_port_ops { | 625 | struct ide_port_ops { |
| 624 | void (*init_dev)(ide_drive_t *); | 626 | void (*init_dev)(ide_drive_t *); |
| 625 | void (*set_pio_mode)(ide_drive_t *, const u8); | 627 | void (*set_pio_mode)(struct hwif_s *, ide_drive_t *); |
| 626 | void (*set_dma_mode)(ide_drive_t *, const u8); | 628 | void (*set_dma_mode)(struct hwif_s *, ide_drive_t *); |
| 627 | int (*reset_poll)(ide_drive_t *); | 629 | int (*reset_poll)(ide_drive_t *); |
| 628 | void (*pre_reset)(ide_drive_t *); | 630 | void (*pre_reset)(ide_drive_t *); |
| 629 | void (*resetproc)(ide_drive_t *); | 631 | void (*resetproc)(ide_drive_t *); |
| @@ -1167,6 +1169,7 @@ extern void ide_stall_queue(ide_drive_t *drive, unsigned long timeout); | |||
| 1167 | extern void ide_timer_expiry(unsigned long); | 1169 | extern void ide_timer_expiry(unsigned long); |
| 1168 | extern irqreturn_t ide_intr(int irq, void *dev_id); | 1170 | extern irqreturn_t ide_intr(int irq, void *dev_id); |
| 1169 | extern void do_ide_request(struct request_queue *); | 1171 | extern void do_ide_request(struct request_queue *); |
| 1172 | extern void ide_requeue_and_plug(ide_drive_t *drive, struct request *rq); | ||
| 1170 | 1173 | ||
| 1171 | void ide_init_disk(struct gendisk *, ide_drive_t *); | 1174 | void ide_init_disk(struct gendisk *, ide_drive_t *); |
| 1172 | 1175 | ||
| @@ -1494,7 +1497,6 @@ int ide_timing_compute(ide_drive_t *, u8, struct ide_timing *, int, int); | |||
| 1494 | #ifdef CONFIG_IDE_XFER_MODE | 1497 | #ifdef CONFIG_IDE_XFER_MODE |
| 1495 | int ide_scan_pio_blacklist(char *); | 1498 | int ide_scan_pio_blacklist(char *); |
| 1496 | const char *ide_xfer_verbose(u8); | 1499 | const char *ide_xfer_verbose(u8); |
| 1497 | u8 ide_get_best_pio_mode(ide_drive_t *, u8, u8); | ||
| 1498 | int ide_pio_need_iordy(ide_drive_t *, const u8); | 1500 | int ide_pio_need_iordy(ide_drive_t *, const u8); |
| 1499 | int ide_set_pio_mode(ide_drive_t *, u8); | 1501 | int ide_set_pio_mode(ide_drive_t *, u8); |
| 1500 | int ide_set_dma_mode(ide_drive_t *, u8); | 1502 | int ide_set_dma_mode(ide_drive_t *, u8); |
diff --git a/include/linux/ieee80211.h b/include/linux/ieee80211.h index 52e15e079c61..19984958ab7b 100644 --- a/include/linux/ieee80211.h +++ b/include/linux/ieee80211.h | |||
| @@ -115,12 +115,31 @@ | |||
| 115 | #define IEEE80211_MAX_SSID_LEN 32 | 115 | #define IEEE80211_MAX_SSID_LEN 32 |
| 116 | 116 | ||
| 117 | #define IEEE80211_MAX_MESH_ID_LEN 32 | 117 | #define IEEE80211_MAX_MESH_ID_LEN 32 |
| 118 | #define IEEE80211_MESH_CONFIG_LEN 24 | ||
| 119 | 118 | ||
| 120 | #define IEEE80211_QOS_CTL_LEN 2 | 119 | #define IEEE80211_QOS_CTL_LEN 2 |
| 121 | #define IEEE80211_QOS_CTL_TID_MASK 0x000F | 120 | #define IEEE80211_QOS_CTL_TID_MASK 0x000F |
| 122 | #define IEEE80211_QOS_CTL_TAG1D_MASK 0x0007 | 121 | #define IEEE80211_QOS_CTL_TAG1D_MASK 0x0007 |
| 123 | 122 | ||
| 123 | /* U-APSD queue for WMM IEs sent by AP */ | ||
| 124 | #define IEEE80211_WMM_IE_AP_QOSINFO_UAPSD (1<<7) | ||
| 125 | |||
| 126 | /* U-APSD queues for WMM IEs sent by STA */ | ||
| 127 | #define IEEE80211_WMM_IE_STA_QOSINFO_AC_VO (1<<0) | ||
| 128 | #define IEEE80211_WMM_IE_STA_QOSINFO_AC_VI (1<<1) | ||
| 129 | #define IEEE80211_WMM_IE_STA_QOSINFO_AC_BK (1<<2) | ||
| 130 | #define IEEE80211_WMM_IE_STA_QOSINFO_AC_BE (1<<3) | ||
| 131 | #define IEEE80211_WMM_IE_STA_QOSINFO_AC_MASK 0x0f | ||
| 132 | |||
| 133 | /* U-APSD max SP length for WMM IEs sent by STA */ | ||
| 134 | #define IEEE80211_WMM_IE_STA_QOSINFO_SP_ALL 0x00 | ||
| 135 | #define IEEE80211_WMM_IE_STA_QOSINFO_SP_2 0x01 | ||
| 136 | #define IEEE80211_WMM_IE_STA_QOSINFO_SP_4 0x02 | ||
| 137 | #define IEEE80211_WMM_IE_STA_QOSINFO_SP_6 0x03 | ||
| 138 | #define IEEE80211_WMM_IE_STA_QOSINFO_SP_MASK 0x03 | ||
| 139 | #define IEEE80211_WMM_IE_STA_QOSINFO_SP_SHIFT 5 | ||
| 140 | |||
| 141 | #define IEEE80211_HT_CTL_LEN 4 | ||
| 142 | |||
| 124 | struct ieee80211_hdr { | 143 | struct ieee80211_hdr { |
| 125 | __le16 frame_control; | 144 | __le16 frame_control; |
| 126 | __le16 duration_id; | 145 | __le16 duration_id; |
| @@ -131,6 +150,25 @@ struct ieee80211_hdr { | |||
| 131 | u8 addr4[6]; | 150 | u8 addr4[6]; |
| 132 | } __attribute__ ((packed)); | 151 | } __attribute__ ((packed)); |
| 133 | 152 | ||
| 153 | struct ieee80211_hdr_3addr { | ||
| 154 | __le16 frame_control; | ||
| 155 | __le16 duration_id; | ||
| 156 | u8 addr1[6]; | ||
| 157 | u8 addr2[6]; | ||
| 158 | u8 addr3[6]; | ||
| 159 | __le16 seq_ctrl; | ||
| 160 | } __attribute__ ((packed)); | ||
| 161 | |||
| 162 | struct ieee80211_qos_hdr { | ||
| 163 | __le16 frame_control; | ||
| 164 | __le16 duration_id; | ||
| 165 | u8 addr1[6]; | ||
| 166 | u8 addr2[6]; | ||
| 167 | u8 addr3[6]; | ||
| 168 | __le16 seq_ctrl; | ||
| 169 | __le16 qos_ctrl; | ||
| 170 | } __attribute__ ((packed)); | ||
| 171 | |||
| 134 | /** | 172 | /** |
| 135 | * ieee80211_has_tods - check if IEEE80211_FCTL_TODS is set | 173 | * ieee80211_has_tods - check if IEEE80211_FCTL_TODS is set |
| 136 | * @fc: frame control bytes in little-endian byteorder | 174 | * @fc: frame control bytes in little-endian byteorder |
| @@ -472,7 +510,7 @@ static inline int ieee80211_is_cfendack(__le16 fc) | |||
| 472 | } | 510 | } |
| 473 | 511 | ||
| 474 | /** | 512 | /** |
| 475 | * ieee80211_is_nullfunc - check if FTYPE=IEEE80211_FTYPE_DATA and STYPE=IEEE80211_STYPE_NULLFUNC | 513 | * ieee80211_is_nullfunc - check if frame is a regular (non-QoS) nullfunc frame |
| 476 | * @fc: frame control bytes in little-endian byteorder | 514 | * @fc: frame control bytes in little-endian byteorder |
| 477 | */ | 515 | */ |
| 478 | static inline int ieee80211_is_nullfunc(__le16 fc) | 516 | static inline int ieee80211_is_nullfunc(__le16 fc) |
| @@ -481,6 +519,16 @@ static inline int ieee80211_is_nullfunc(__le16 fc) | |||
| 481 | cpu_to_le16(IEEE80211_FTYPE_DATA | IEEE80211_STYPE_NULLFUNC); | 519 | cpu_to_le16(IEEE80211_FTYPE_DATA | IEEE80211_STYPE_NULLFUNC); |
| 482 | } | 520 | } |
| 483 | 521 | ||
| 522 | /** | ||
| 523 | * ieee80211_is_qos_nullfunc - check if frame is a QoS nullfunc frame | ||
| 524 | * @fc: frame control bytes in little-endian byteorder | ||
| 525 | */ | ||
| 526 | static inline int ieee80211_is_qos_nullfunc(__le16 fc) | ||
| 527 | { | ||
| 528 | return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) == | ||
| 529 | cpu_to_le16(IEEE80211_FTYPE_DATA | IEEE80211_STYPE_QOS_NULLFUNC); | ||
| 530 | } | ||
| 531 | |||
| 484 | struct ieee80211s_hdr { | 532 | struct ieee80211s_hdr { |
| 485 | u8 flags; | 533 | u8 flags; |
| 486 | u8 ttl; | 534 | u8 ttl; |
| @@ -544,6 +592,35 @@ struct ieee80211_tim_ie { | |||
| 544 | u8 virtual_map[1]; | 592 | u8 virtual_map[1]; |
| 545 | } __attribute__ ((packed)); | 593 | } __attribute__ ((packed)); |
| 546 | 594 | ||
| 595 | /** | ||
| 596 | * struct ieee80211_meshconf_ie | ||
| 597 | * | ||
| 598 | * This structure refers to "Mesh Configuration information element" | ||
| 599 | */ | ||
| 600 | struct ieee80211_meshconf_ie { | ||
| 601 | u8 meshconf_psel; | ||
| 602 | u8 meshconf_pmetric; | ||
| 603 | u8 meshconf_congest; | ||
| 604 | u8 meshconf_synch; | ||
| 605 | u8 meshconf_auth; | ||
| 606 | u8 meshconf_form; | ||
| 607 | u8 meshconf_cap; | ||
| 608 | } __attribute__ ((packed)); | ||
| 609 | |||
| 610 | /** | ||
| 611 | * struct ieee80211_rann_ie | ||
| 612 | * | ||
| 613 | * This structure refers to "Root Announcement information element" | ||
| 614 | */ | ||
| 615 | struct ieee80211_rann_ie { | ||
| 616 | u8 rann_flags; | ||
| 617 | u8 rann_hopcount; | ||
| 618 | u8 rann_ttl; | ||
| 619 | u8 rann_addr[6]; | ||
| 620 | u32 rann_seq; | ||
| 621 | u32 rann_metric; | ||
| 622 | } __attribute__ ((packed)); | ||
| 623 | |||
| 547 | #define WLAN_SA_QUERY_TR_ID_LEN 2 | 624 | #define WLAN_SA_QUERY_TR_ID_LEN 2 |
| 548 | 625 | ||
| 549 | struct ieee80211_mgmt { | 626 | struct ieee80211_mgmt { |
| @@ -669,6 +746,10 @@ struct ieee80211_mgmt { | |||
| 669 | u8 action; | 746 | u8 action; |
| 670 | u8 trans_id[WLAN_SA_QUERY_TR_ID_LEN]; | 747 | u8 trans_id[WLAN_SA_QUERY_TR_ID_LEN]; |
| 671 | } __attribute__ ((packed)) sa_query; | 748 | } __attribute__ ((packed)) sa_query; |
| 749 | struct { | ||
| 750 | u8 action; | ||
| 751 | u8 smps_control; | ||
| 752 | } __attribute__ ((packed)) ht_smps; | ||
| 672 | } u; | 753 | } u; |
| 673 | } __attribute__ ((packed)) action; | 754 | } __attribute__ ((packed)) action; |
| 674 | } u; | 755 | } u; |
| @@ -733,7 +814,10 @@ struct ieee80211_bar { | |||
| 733 | /** | 814 | /** |
| 734 | * struct ieee80211_mcs_info - MCS information | 815 | * struct ieee80211_mcs_info - MCS information |
| 735 | * @rx_mask: RX mask | 816 | * @rx_mask: RX mask |
| 736 | * @rx_highest: highest supported RX rate | 817 | * @rx_highest: highest supported RX rate. If set represents |
| 818 | * the highest supported RX data rate in units of 1 Mbps. | ||
| 819 | * If this field is 0 this value should not be used to | ||
| 820 | * consider the highest RX data rate supported. | ||
| 737 | * @tx_params: TX parameters | 821 | * @tx_params: TX parameters |
| 738 | */ | 822 | */ |
| 739 | struct ieee80211_mcs_info { | 823 | struct ieee80211_mcs_info { |
| @@ -786,6 +870,7 @@ struct ieee80211_ht_cap { | |||
| 786 | #define IEEE80211_HT_CAP_LDPC_CODING 0x0001 | 870 | #define IEEE80211_HT_CAP_LDPC_CODING 0x0001 |
| 787 | #define IEEE80211_HT_CAP_SUP_WIDTH_20_40 0x0002 | 871 | #define IEEE80211_HT_CAP_SUP_WIDTH_20_40 0x0002 |
| 788 | #define IEEE80211_HT_CAP_SM_PS 0x000C | 872 | #define IEEE80211_HT_CAP_SM_PS 0x000C |
| 873 | #define IEEE80211_HT_CAP_SM_PS_SHIFT 2 | ||
| 789 | #define IEEE80211_HT_CAP_GRN_FLD 0x0010 | 874 | #define IEEE80211_HT_CAP_GRN_FLD 0x0010 |
| 790 | #define IEEE80211_HT_CAP_SGI_20 0x0020 | 875 | #define IEEE80211_HT_CAP_SGI_20 0x0020 |
| 791 | #define IEEE80211_HT_CAP_SGI_40 0x0040 | 876 | #define IEEE80211_HT_CAP_SGI_40 0x0040 |
| @@ -794,13 +879,14 @@ struct ieee80211_ht_cap { | |||
| 794 | #define IEEE80211_HT_CAP_DELAY_BA 0x0400 | 879 | #define IEEE80211_HT_CAP_DELAY_BA 0x0400 |
| 795 | #define IEEE80211_HT_CAP_MAX_AMSDU 0x0800 | 880 | #define IEEE80211_HT_CAP_MAX_AMSDU 0x0800 |
| 796 | #define IEEE80211_HT_CAP_DSSSCCK40 0x1000 | 881 | #define IEEE80211_HT_CAP_DSSSCCK40 0x1000 |
| 797 | #define IEEE80211_HT_CAP_PSMP_SUPPORT 0x2000 | 882 | #define IEEE80211_HT_CAP_RESERVED 0x2000 |
| 798 | #define IEEE80211_HT_CAP_40MHZ_INTOLERANT 0x4000 | 883 | #define IEEE80211_HT_CAP_40MHZ_INTOLERANT 0x4000 |
| 799 | #define IEEE80211_HT_CAP_LSIG_TXOP_PROT 0x8000 | 884 | #define IEEE80211_HT_CAP_LSIG_TXOP_PROT 0x8000 |
| 800 | 885 | ||
| 801 | /* 802.11n HT capability AMPDU settings (for ampdu_params_info) */ | 886 | /* 802.11n HT capability AMPDU settings (for ampdu_params_info) */ |
| 802 | #define IEEE80211_HT_AMPDU_PARM_FACTOR 0x03 | 887 | #define IEEE80211_HT_AMPDU_PARM_FACTOR 0x03 |
| 803 | #define IEEE80211_HT_AMPDU_PARM_DENSITY 0x1C | 888 | #define IEEE80211_HT_AMPDU_PARM_DENSITY 0x1C |
| 889 | #define IEEE80211_HT_AMPDU_PARM_DENSITY_SHIFT 2 | ||
| 804 | 890 | ||
| 805 | /* | 891 | /* |
| 806 | * Maximum length of AMPDU that the STA can receive. | 892 | * Maximum length of AMPDU that the STA can receive. |
| @@ -884,12 +970,17 @@ struct ieee80211_ht_info { | |||
| 884 | #define IEEE80211_MAX_AMPDU_BUF 0x40 | 970 | #define IEEE80211_MAX_AMPDU_BUF 0x40 |
| 885 | 971 | ||
| 886 | 972 | ||
| 887 | /* Spatial Multiplexing Power Save Modes */ | 973 | /* Spatial Multiplexing Power Save Modes (for capability) */ |
| 888 | #define WLAN_HT_CAP_SM_PS_STATIC 0 | 974 | #define WLAN_HT_CAP_SM_PS_STATIC 0 |
| 889 | #define WLAN_HT_CAP_SM_PS_DYNAMIC 1 | 975 | #define WLAN_HT_CAP_SM_PS_DYNAMIC 1 |
| 890 | #define WLAN_HT_CAP_SM_PS_INVALID 2 | 976 | #define WLAN_HT_CAP_SM_PS_INVALID 2 |
| 891 | #define WLAN_HT_CAP_SM_PS_DISABLED 3 | 977 | #define WLAN_HT_CAP_SM_PS_DISABLED 3 |
| 892 | 978 | ||
| 979 | /* for SM power control field lower two bits */ | ||
| 980 | #define WLAN_HT_SMPS_CONTROL_DISABLED 0 | ||
| 981 | #define WLAN_HT_SMPS_CONTROL_STATIC 1 | ||
| 982 | #define WLAN_HT_SMPS_CONTROL_DYNAMIC 3 | ||
| 983 | |||
| 893 | /* Authentication algorithms */ | 984 | /* Authentication algorithms */ |
| 894 | #define WLAN_AUTH_OPEN 0 | 985 | #define WLAN_AUTH_OPEN 0 |
| 895 | #define WLAN_AUTH_SHARED_KEY 1 | 986 | #define WLAN_AUTH_SHARED_KEY 1 |
| @@ -1033,12 +1124,12 @@ enum ieee80211_eid { | |||
| 1033 | WLAN_EID_TIM = 5, | 1124 | WLAN_EID_TIM = 5, |
| 1034 | WLAN_EID_IBSS_PARAMS = 6, | 1125 | WLAN_EID_IBSS_PARAMS = 6, |
| 1035 | WLAN_EID_CHALLENGE = 16, | 1126 | WLAN_EID_CHALLENGE = 16, |
| 1036 | /* 802.11d */ | 1127 | |
| 1037 | WLAN_EID_COUNTRY = 7, | 1128 | WLAN_EID_COUNTRY = 7, |
| 1038 | WLAN_EID_HP_PARAMS = 8, | 1129 | WLAN_EID_HP_PARAMS = 8, |
| 1039 | WLAN_EID_HP_TABLE = 9, | 1130 | WLAN_EID_HP_TABLE = 9, |
| 1040 | WLAN_EID_REQUEST = 10, | 1131 | WLAN_EID_REQUEST = 10, |
| 1041 | /* 802.11e */ | 1132 | |
| 1042 | WLAN_EID_QBSS_LOAD = 11, | 1133 | WLAN_EID_QBSS_LOAD = 11, |
| 1043 | WLAN_EID_EDCA_PARAM_SET = 12, | 1134 | WLAN_EID_EDCA_PARAM_SET = 12, |
| 1044 | WLAN_EID_TSPEC = 13, | 1135 | WLAN_EID_TSPEC = 13, |
| @@ -1060,7 +1151,8 @@ enum ieee80211_eid { | |||
| 1060 | WLAN_EID_PREQ = 68, | 1151 | WLAN_EID_PREQ = 68, |
| 1061 | WLAN_EID_PREP = 69, | 1152 | WLAN_EID_PREP = 69, |
| 1062 | WLAN_EID_PERR = 70, | 1153 | WLAN_EID_PERR = 70, |
| 1063 | /* 802.11h */ | 1154 | WLAN_EID_RANN = 49, /* compatible with FreeBSD */ |
| 1155 | |||
| 1064 | WLAN_EID_PWR_CONSTRAINT = 32, | 1156 | WLAN_EID_PWR_CONSTRAINT = 32, |
| 1065 | WLAN_EID_PWR_CAPABILITY = 33, | 1157 | WLAN_EID_PWR_CAPABILITY = 33, |
| 1066 | WLAN_EID_TPC_REQUEST = 34, | 1158 | WLAN_EID_TPC_REQUEST = 34, |
| @@ -1071,20 +1163,41 @@ enum ieee80211_eid { | |||
| 1071 | WLAN_EID_MEASURE_REPORT = 39, | 1163 | WLAN_EID_MEASURE_REPORT = 39, |
| 1072 | WLAN_EID_QUIET = 40, | 1164 | WLAN_EID_QUIET = 40, |
| 1073 | WLAN_EID_IBSS_DFS = 41, | 1165 | WLAN_EID_IBSS_DFS = 41, |
| 1074 | /* 802.11g */ | 1166 | |
| 1075 | WLAN_EID_ERP_INFO = 42, | 1167 | WLAN_EID_ERP_INFO = 42, |
| 1076 | WLAN_EID_EXT_SUPP_RATES = 50, | 1168 | WLAN_EID_EXT_SUPP_RATES = 50, |
| 1077 | /* 802.11n */ | 1169 | |
| 1078 | WLAN_EID_HT_CAPABILITY = 45, | 1170 | WLAN_EID_HT_CAPABILITY = 45, |
| 1079 | WLAN_EID_HT_INFORMATION = 61, | 1171 | WLAN_EID_HT_INFORMATION = 61, |
| 1080 | /* 802.11i */ | 1172 | |
| 1081 | WLAN_EID_RSN = 48, | 1173 | WLAN_EID_RSN = 48, |
| 1082 | WLAN_EID_TIMEOUT_INTERVAL = 56, | 1174 | WLAN_EID_MMIE = 76, |
| 1083 | WLAN_EID_MMIE = 76 /* 802.11w */, | ||
| 1084 | WLAN_EID_WPA = 221, | 1175 | WLAN_EID_WPA = 221, |
| 1085 | WLAN_EID_GENERIC = 221, | 1176 | WLAN_EID_GENERIC = 221, |
| 1086 | WLAN_EID_VENDOR_SPECIFIC = 221, | 1177 | WLAN_EID_VENDOR_SPECIFIC = 221, |
| 1087 | WLAN_EID_QOS_PARAMETER = 222 | 1178 | WLAN_EID_QOS_PARAMETER = 222, |
| 1179 | |||
| 1180 | WLAN_EID_AP_CHAN_REPORT = 51, | ||
| 1181 | WLAN_EID_NEIGHBOR_REPORT = 52, | ||
| 1182 | WLAN_EID_RCPI = 53, | ||
| 1183 | WLAN_EID_BSS_AVG_ACCESS_DELAY = 63, | ||
| 1184 | WLAN_EID_ANTENNA_INFO = 64, | ||
| 1185 | WLAN_EID_RSNI = 65, | ||
| 1186 | WLAN_EID_MEASUREMENT_PILOT_TX_INFO = 66, | ||
| 1187 | WLAN_EID_BSS_AVAILABLE_CAPACITY = 67, | ||
| 1188 | WLAN_EID_BSS_AC_ACCESS_DELAY = 68, | ||
| 1189 | WLAN_EID_RRM_ENABLED_CAPABILITIES = 70, | ||
| 1190 | WLAN_EID_MULTIPLE_BSSID = 71, | ||
| 1191 | |||
| 1192 | WLAN_EID_MOBILITY_DOMAIN = 54, | ||
| 1193 | WLAN_EID_FAST_BSS_TRANSITION = 55, | ||
| 1194 | WLAN_EID_TIMEOUT_INTERVAL = 56, | ||
| 1195 | WLAN_EID_RIC_DATA = 57, | ||
| 1196 | WLAN_EID_RIC_DESCRIPTOR = 75, | ||
| 1197 | |||
| 1198 | WLAN_EID_DSE_REGISTERED_LOCATION = 58, | ||
| 1199 | WLAN_EID_SUPPORTED_REGULATORY_CLASSES = 59, | ||
| 1200 | WLAN_EID_EXT_CHANSWITCH_ANN = 60, | ||
| 1088 | }; | 1201 | }; |
| 1089 | 1202 | ||
| 1090 | /* Action category code */ | 1203 | /* Action category code */ |
| @@ -1111,6 +1224,18 @@ enum ieee80211_spectrum_mgmt_actioncode { | |||
| 1111 | WLAN_ACTION_SPCT_CHL_SWITCH = 4, | 1224 | WLAN_ACTION_SPCT_CHL_SWITCH = 4, |
| 1112 | }; | 1225 | }; |
| 1113 | 1226 | ||
| 1227 | /* HT action codes */ | ||
| 1228 | enum ieee80211_ht_actioncode { | ||
| 1229 | WLAN_HT_ACTION_NOTIFY_CHANWIDTH = 0, | ||
| 1230 | WLAN_HT_ACTION_SMPS = 1, | ||
| 1231 | WLAN_HT_ACTION_PSMP = 2, | ||
| 1232 | WLAN_HT_ACTION_PCO_PHASE = 3, | ||
| 1233 | WLAN_HT_ACTION_CSI = 4, | ||
| 1234 | WLAN_HT_ACTION_NONCOMPRESSED_BF = 5, | ||
| 1235 | WLAN_HT_ACTION_COMPRESSED_BF = 6, | ||
| 1236 | WLAN_HT_ACTION_ASEL_IDX_FEEDBACK = 7, | ||
| 1237 | }; | ||
| 1238 | |||
| 1114 | /* Security key length */ | 1239 | /* Security key length */ |
| 1115 | enum ieee80211_key_len { | 1240 | enum ieee80211_key_len { |
| 1116 | WLAN_KEY_LEN_WEP40 = 5, | 1241 | WLAN_KEY_LEN_WEP40 = 5, |
| @@ -1227,6 +1352,8 @@ enum ieee80211_sa_query_action { | |||
| 1227 | 1352 | ||
| 1228 | #define WLAN_MAX_KEY_LEN 32 | 1353 | #define WLAN_MAX_KEY_LEN 32 |
| 1229 | 1354 | ||
| 1355 | #define WLAN_PMKID_LEN 16 | ||
| 1356 | |||
| 1230 | /** | 1357 | /** |
| 1231 | * ieee80211_get_qos_ctl - get pointer to qos control bytes | 1358 | * ieee80211_get_qos_ctl - get pointer to qos control bytes |
| 1232 | * @hdr: the frame | 1359 | * @hdr: the frame |
diff --git a/include/linux/if.h b/include/linux/if.h index b9a6229f3be7..3a9f410a296b 100644 --- a/include/linux/if.h +++ b/include/linux/if.h | |||
| @@ -70,6 +70,7 @@ | |||
| 70 | #define IFF_XMIT_DST_RELEASE 0x400 /* dev_hard_start_xmit() is allowed to | 70 | #define IFF_XMIT_DST_RELEASE 0x400 /* dev_hard_start_xmit() is allowed to |
| 71 | * release skb->dst | 71 | * release skb->dst |
| 72 | */ | 72 | */ |
| 73 | #define IFF_DONT_BRIDGE 0x800 /* disallow bridging this ether dev */ | ||
| 73 | 74 | ||
| 74 | #define IF_GET_IFACE 0x0001 /* for querying only */ | 75 | #define IF_GET_IFACE 0x0001 /* for querying only */ |
| 75 | #define IF_GET_PROTO 0x0002 | 76 | #define IF_GET_PROTO 0x0002 |
| @@ -125,8 +126,7 @@ enum { | |||
| 125 | * being very small might be worth keeping for clean configuration. | 126 | * being very small might be worth keeping for clean configuration. |
| 126 | */ | 127 | */ |
| 127 | 128 | ||
| 128 | struct ifmap | 129 | struct ifmap { |
| 129 | { | ||
| 130 | unsigned long mem_start; | 130 | unsigned long mem_start; |
| 131 | unsigned long mem_end; | 131 | unsigned long mem_end; |
| 132 | unsigned short base_addr; | 132 | unsigned short base_addr; |
| @@ -136,8 +136,7 @@ struct ifmap | |||
| 136 | /* 3 bytes spare */ | 136 | /* 3 bytes spare */ |
| 137 | }; | 137 | }; |
| 138 | 138 | ||
| 139 | struct if_settings | 139 | struct if_settings { |
| 140 | { | ||
| 141 | unsigned int type; /* Type of physical device or protocol */ | 140 | unsigned int type; /* Type of physical device or protocol */ |
| 142 | unsigned int size; /* Size of the data allocated by the caller */ | 141 | unsigned int size; /* Size of the data allocated by the caller */ |
| 143 | union { | 142 | union { |
| @@ -161,8 +160,7 @@ struct if_settings | |||
| 161 | * remainder may be interface specific. | 160 | * remainder may be interface specific. |
| 162 | */ | 161 | */ |
| 163 | 162 | ||
| 164 | struct ifreq | 163 | struct ifreq { |
| 165 | { | ||
| 166 | #define IFHWADDRLEN 6 | 164 | #define IFHWADDRLEN 6 |
| 167 | union | 165 | union |
| 168 | { | 166 | { |
| @@ -211,11 +209,9 @@ struct ifreq | |||
| 211 | * must know all networks accessible). | 209 | * must know all networks accessible). |
| 212 | */ | 210 | */ |
| 213 | 211 | ||
| 214 | struct ifconf | 212 | struct ifconf { |
| 215 | { | ||
| 216 | int ifc_len; /* size of buffer */ | 213 | int ifc_len; /* size of buffer */ |
| 217 | union | 214 | union { |
| 218 | { | ||
| 219 | char __user *ifcu_buf; | 215 | char __user *ifcu_buf; |
| 220 | struct ifreq __user *ifcu_req; | 216 | struct ifreq __user *ifcu_req; |
| 221 | } ifc_ifcu; | 217 | } ifc_ifcu; |
diff --git a/include/linux/if_addr.h b/include/linux/if_addr.h index fd9740466757..23357ab81a77 100644 --- a/include/linux/if_addr.h +++ b/include/linux/if_addr.h | |||
| @@ -4,8 +4,7 @@ | |||
| 4 | #include <linux/types.h> | 4 | #include <linux/types.h> |
| 5 | #include <linux/netlink.h> | 5 | #include <linux/netlink.h> |
| 6 | 6 | ||
| 7 | struct ifaddrmsg | 7 | struct ifaddrmsg { |
| 8 | { | ||
| 9 | __u8 ifa_family; | 8 | __u8 ifa_family; |
| 10 | __u8 ifa_prefixlen; /* The prefix length */ | 9 | __u8 ifa_prefixlen; /* The prefix length */ |
| 11 | __u8 ifa_flags; /* Flags */ | 10 | __u8 ifa_flags; /* Flags */ |
| @@ -20,8 +19,7 @@ struct ifaddrmsg | |||
| 20 | * but for point-to-point IFA_ADDRESS is DESTINATION address, | 19 | * but for point-to-point IFA_ADDRESS is DESTINATION address, |
| 21 | * local address is supplied in IFA_LOCAL attribute. | 20 | * local address is supplied in IFA_LOCAL attribute. |
| 22 | */ | 21 | */ |
| 23 | enum | 22 | enum { |
| 24 | { | ||
| 25 | IFA_UNSPEC, | 23 | IFA_UNSPEC, |
| 26 | IFA_ADDRESS, | 24 | IFA_ADDRESS, |
| 27 | IFA_LOCAL, | 25 | IFA_LOCAL, |
| @@ -47,8 +45,7 @@ enum | |||
| 47 | #define IFA_F_TENTATIVE 0x40 | 45 | #define IFA_F_TENTATIVE 0x40 |
| 48 | #define IFA_F_PERMANENT 0x80 | 46 | #define IFA_F_PERMANENT 0x80 |
| 49 | 47 | ||
| 50 | struct ifa_cacheinfo | 48 | struct ifa_cacheinfo { |
| 51 | { | ||
| 52 | __u32 ifa_prefered; | 49 | __u32 ifa_prefered; |
| 53 | __u32 ifa_valid; | 50 | __u32 ifa_valid; |
| 54 | __u32 cstamp; /* created timestamp, hundredths of seconds */ | 51 | __u32 cstamp; /* created timestamp, hundredths of seconds */ |
diff --git a/include/linux/if_addrlabel.h b/include/linux/if_addrlabel.h index 89571f65d6de..54580c298187 100644 --- a/include/linux/if_addrlabel.h +++ b/include/linux/if_addrlabel.h | |||
| @@ -12,8 +12,7 @@ | |||
| 12 | 12 | ||
| 13 | #include <linux/types.h> | 13 | #include <linux/types.h> |
| 14 | 14 | ||
| 15 | struct ifaddrlblmsg | 15 | struct ifaddrlblmsg { |
| 16 | { | ||
| 17 | __u8 ifal_family; /* Address family */ | 16 | __u8 ifal_family; /* Address family */ |
| 18 | __u8 __ifal_reserved; /* Reserved */ | 17 | __u8 __ifal_reserved; /* Reserved */ |
| 19 | __u8 ifal_prefixlen; /* Prefix length */ | 18 | __u8 ifal_prefixlen; /* Prefix length */ |
| @@ -22,8 +21,7 @@ struct ifaddrlblmsg | |||
| 22 | __u32 ifal_seq; /* sequence number */ | 21 | __u32 ifal_seq; /* sequence number */ |
| 23 | }; | 22 | }; |
| 24 | 23 | ||
| 25 | enum | 24 | enum { |
| 26 | { | ||
| 27 | IFAL_ADDRESS = 1, | 25 | IFAL_ADDRESS = 1, |
| 28 | IFAL_LABEL = 2, | 26 | IFAL_LABEL = 2, |
| 29 | __IFAL_MAX | 27 | __IFAL_MAX |
diff --git a/include/linux/if_arcnet.h b/include/linux/if_arcnet.h index 0835debab115..46e34bd0e783 100644 --- a/include/linux/if_arcnet.h +++ b/include/linux/if_arcnet.h | |||
| @@ -56,8 +56,7 @@ | |||
| 56 | /* | 56 | /* |
| 57 | * The RFC1201-specific components of an arcnet packet header. | 57 | * The RFC1201-specific components of an arcnet packet header. |
| 58 | */ | 58 | */ |
| 59 | struct arc_rfc1201 | 59 | struct arc_rfc1201 { |
| 60 | { | ||
| 61 | __u8 proto; /* protocol ID field - varies */ | 60 | __u8 proto; /* protocol ID field - varies */ |
| 62 | __u8 split_flag; /* for use with split packets */ | 61 | __u8 split_flag; /* for use with split packets */ |
| 63 | __be16 sequence; /* sequence number */ | 62 | __be16 sequence; /* sequence number */ |
| @@ -69,8 +68,7 @@ struct arc_rfc1201 | |||
| 69 | /* | 68 | /* |
| 70 | * The RFC1051-specific components. | 69 | * The RFC1051-specific components. |
| 71 | */ | 70 | */ |
| 72 | struct arc_rfc1051 | 71 | struct arc_rfc1051 { |
| 73 | { | ||
| 74 | __u8 proto; /* ARC_P_RFC1051_ARP/RFC1051_IP */ | 72 | __u8 proto; /* ARC_P_RFC1051_ARP/RFC1051_IP */ |
| 75 | __u8 payload[0]; /* 507 bytes */ | 73 | __u8 payload[0]; /* 507 bytes */ |
| 76 | }; | 74 | }; |
| @@ -81,8 +79,7 @@ struct arc_rfc1051 | |||
| 81 | * The ethernet-encap-specific components. We have a real ethernet header | 79 | * The ethernet-encap-specific components. We have a real ethernet header |
| 82 | * and some data. | 80 | * and some data. |
| 83 | */ | 81 | */ |
| 84 | struct arc_eth_encap | 82 | struct arc_eth_encap { |
| 85 | { | ||
| 86 | __u8 proto; /* Always ARC_P_ETHER */ | 83 | __u8 proto; /* Always ARC_P_ETHER */ |
| 87 | struct ethhdr eth; /* standard ethernet header (yuck!) */ | 84 | struct ethhdr eth; /* standard ethernet header (yuck!) */ |
| 88 | __u8 payload[0]; /* 493 bytes */ | 85 | __u8 payload[0]; /* 493 bytes */ |
| @@ -90,8 +87,7 @@ struct arc_eth_encap | |||
| 90 | #define ETH_ENCAP_HDR_SIZE 14 | 87 | #define ETH_ENCAP_HDR_SIZE 14 |
| 91 | 88 | ||
| 92 | 89 | ||
| 93 | struct arc_cap | 90 | struct arc_cap { |
| 94 | { | ||
| 95 | __u8 proto; | 91 | __u8 proto; |
| 96 | __u8 cookie[sizeof(int)]; /* Actually NOT sent over the network */ | 92 | __u8 cookie[sizeof(int)]; /* Actually NOT sent over the network */ |
| 97 | union { | 93 | union { |
| @@ -108,8 +104,7 @@ struct arc_cap | |||
| 108 | * the _end_ of the 512-byte buffer. We hide this complexity inside the | 104 | * the _end_ of the 512-byte buffer. We hide this complexity inside the |
| 109 | * driver. | 105 | * driver. |
| 110 | */ | 106 | */ |
| 111 | struct arc_hardware | 107 | struct arc_hardware { |
| 112 | { | ||
| 113 | __u8 source, /* source ARCnet - filled in automagically */ | 108 | __u8 source, /* source ARCnet - filled in automagically */ |
| 114 | dest, /* destination ARCnet - 0 for broadcast */ | 109 | dest, /* destination ARCnet - 0 for broadcast */ |
| 115 | offset[2]; /* offset bytes (some weird semantics) */ | 110 | offset[2]; /* offset bytes (some weird semantics) */ |
| @@ -120,8 +115,7 @@ struct arc_hardware | |||
| 120 | * This is an ARCnet frame header, as seen by the kernel (and userspace, | 115 | * This is an ARCnet frame header, as seen by the kernel (and userspace, |
| 121 | * when you do a raw packet capture). | 116 | * when you do a raw packet capture). |
| 122 | */ | 117 | */ |
| 123 | struct archdr | 118 | struct archdr { |
| 124 | { | ||
| 125 | /* hardware requirements */ | 119 | /* hardware requirements */ |
| 126 | struct arc_hardware hard; | 120 | struct arc_hardware hard; |
| 127 | 121 | ||
diff --git a/include/linux/if_arp.h b/include/linux/if_arp.h index 282eb37e2dec..e80b7f88f7c6 100644 --- a/include/linux/if_arp.h +++ b/include/linux/if_arp.h | |||
| @@ -133,8 +133,7 @@ struct arpreq_old { | |||
| 133 | * This structure defines an ethernet arp header. | 133 | * This structure defines an ethernet arp header. |
| 134 | */ | 134 | */ |
| 135 | 135 | ||
| 136 | struct arphdr | 136 | struct arphdr { |
| 137 | { | ||
| 138 | __be16 ar_hrd; /* format of hardware address */ | 137 | __be16 ar_hrd; /* format of hardware address */ |
| 139 | __be16 ar_pro; /* format of protocol address */ | 138 | __be16 ar_pro; /* format of protocol address */ |
| 140 | unsigned char ar_hln; /* length of hardware address */ | 139 | unsigned char ar_hln; /* length of hardware address */ |
diff --git a/include/linux/if_bonding.h b/include/linux/if_bonding.h index 65c2d247068b..cd525fae3c98 100644 --- a/include/linux/if_bonding.h +++ b/include/linux/if_bonding.h | |||
| @@ -94,8 +94,7 @@ typedef struct ifbond { | |||
| 94 | __s32 miimon; | 94 | __s32 miimon; |
| 95 | } ifbond; | 95 | } ifbond; |
| 96 | 96 | ||
| 97 | typedef struct ifslave | 97 | typedef struct ifslave { |
| 98 | { | ||
| 99 | __s32 slave_id; /* Used as an IN param to the BOND_SLAVE_INFO_QUERY ioctl */ | 98 | __s32 slave_id; /* Used as an IN param to the BOND_SLAVE_INFO_QUERY ioctl */ |
| 100 | char slave_name[IFNAMSIZ]; | 99 | char slave_name[IFNAMSIZ]; |
| 101 | __s8 link; | 100 | __s8 link; |
diff --git a/include/linux/if_bridge.h b/include/linux/if_bridge.h index 6badb3e2c4e4..938b7e81df95 100644 --- a/include/linux/if_bridge.h +++ b/include/linux/if_bridge.h | |||
| @@ -49,8 +49,7 @@ | |||
| 49 | #define BR_STATE_FORWARDING 3 | 49 | #define BR_STATE_FORWARDING 3 |
| 50 | #define BR_STATE_BLOCKING 4 | 50 | #define BR_STATE_BLOCKING 4 |
| 51 | 51 | ||
| 52 | struct __bridge_info | 52 | struct __bridge_info { |
| 53 | { | ||
| 54 | __u64 designated_root; | 53 | __u64 designated_root; |
| 55 | __u64 bridge_id; | 54 | __u64 bridge_id; |
| 56 | __u32 root_path_cost; | 55 | __u32 root_path_cost; |
| @@ -72,8 +71,7 @@ struct __bridge_info | |||
| 72 | __u32 gc_timer_value; | 71 | __u32 gc_timer_value; |
| 73 | }; | 72 | }; |
| 74 | 73 | ||
| 75 | struct __port_info | 74 | struct __port_info { |
| 76 | { | ||
| 77 | __u64 designated_root; | 75 | __u64 designated_root; |
| 78 | __u64 designated_bridge; | 76 | __u64 designated_bridge; |
| 79 | __u16 port_id; | 77 | __u16 port_id; |
| @@ -89,8 +87,7 @@ struct __port_info | |||
| 89 | __u32 hold_timer_value; | 87 | __u32 hold_timer_value; |
| 90 | }; | 88 | }; |
| 91 | 89 | ||
| 92 | struct __fdb_entry | 90 | struct __fdb_entry { |
| 93 | { | ||
| 94 | __u8 mac_addr[6]; | 91 | __u8 mac_addr[6]; |
| 95 | __u8 port_no; | 92 | __u8 port_no; |
| 96 | __u8 is_local; | 93 | __u8 is_local; |
diff --git a/include/linux/if_ec.h b/include/linux/if_ec.h index e7499aa79783..d85f9f48129f 100644 --- a/include/linux/if_ec.h +++ b/include/linux/if_ec.h | |||
| @@ -5,14 +5,12 @@ | |||
| 5 | 5 | ||
| 6 | /* User visible stuff. Glibc provides its own but libc5 folk will use these */ | 6 | /* User visible stuff. Glibc provides its own but libc5 folk will use these */ |
| 7 | 7 | ||
| 8 | struct ec_addr | 8 | struct ec_addr { |
| 9 | { | ||
| 10 | unsigned char station; /* Station number. */ | 9 | unsigned char station; /* Station number. */ |
| 11 | unsigned char net; /* Network number. */ | 10 | unsigned char net; /* Network number. */ |
| 12 | }; | 11 | }; |
| 13 | 12 | ||
| 14 | struct sockaddr_ec | 13 | struct sockaddr_ec { |
| 15 | { | ||
| 16 | unsigned short sec_family; | 14 | unsigned short sec_family; |
| 17 | unsigned char port; /* Port number. */ | 15 | unsigned char port; /* Port number. */ |
| 18 | unsigned char cb; /* Control/flag byte. */ | 16 | unsigned char cb; /* Control/flag byte. */ |
| @@ -37,8 +35,7 @@ struct sockaddr_ec | |||
| 37 | #define EC_HLEN 6 | 35 | #define EC_HLEN 6 |
| 38 | 36 | ||
| 39 | /* This is what an Econet frame looks like on the wire. */ | 37 | /* This is what an Econet frame looks like on the wire. */ |
| 40 | struct ec_framehdr | 38 | struct ec_framehdr { |
| 41 | { | ||
| 42 | unsigned char dst_stn; | 39 | unsigned char dst_stn; |
| 43 | unsigned char dst_net; | 40 | unsigned char dst_net; |
| 44 | unsigned char src_stn; | 41 | unsigned char src_stn; |
| @@ -62,8 +59,7 @@ static inline struct econet_sock *ec_sk(const struct sock *sk) | |||
| 62 | return (struct econet_sock *)sk; | 59 | return (struct econet_sock *)sk; |
| 63 | } | 60 | } |
| 64 | 61 | ||
| 65 | struct ec_device | 62 | struct ec_device { |
| 66 | { | ||
| 67 | unsigned char station, net; /* Econet protocol address */ | 63 | unsigned char station, net; /* Econet protocol address */ |
| 68 | }; | 64 | }; |
| 69 | 65 | ||
diff --git a/include/linux/if_ether.h b/include/linux/if_ether.h index 580b6004d00e..299b4121f914 100644 --- a/include/linux/if_ether.h +++ b/include/linux/if_ether.h | |||
| @@ -136,13 +136,7 @@ extern struct ctl_table ether_table[]; | |||
| 136 | 136 | ||
| 137 | extern ssize_t sysfs_format_mac(char *buf, const unsigned char *addr, int len); | 137 | extern ssize_t sysfs_format_mac(char *buf, const unsigned char *addr, int len); |
| 138 | 138 | ||
| 139 | /* | ||
| 140 | * Display a 6 byte device address (MAC) in a readable format. | ||
| 141 | */ | ||
| 142 | extern char *print_mac(char *buf, const unsigned char *addr) __deprecated; | ||
| 143 | #define MAC_FMT "%02x:%02x:%02x:%02x:%02x:%02x" | 139 | #define MAC_FMT "%02x:%02x:%02x:%02x:%02x:%02x" |
| 144 | #define MAC_BUF_SIZE 18 | ||
| 145 | #define DECLARE_MAC_BUF(var) char var[MAC_BUF_SIZE] | ||
| 146 | 140 | ||
| 147 | #endif | 141 | #endif |
| 148 | 142 | ||
diff --git a/include/linux/if_fddi.h b/include/linux/if_fddi.h index 45de1046dbbf..5459c5c09930 100644 --- a/include/linux/if_fddi.h +++ b/include/linux/if_fddi.h | |||
| @@ -63,36 +63,32 @@ | |||
| 63 | #define FDDI_UI_CMD 0x03 | 63 | #define FDDI_UI_CMD 0x03 |
| 64 | 64 | ||
| 65 | /* Define 802.2 Type 1 header */ | 65 | /* Define 802.2 Type 1 header */ |
| 66 | struct fddi_8022_1_hdr | 66 | struct fddi_8022_1_hdr { |
| 67 | { | ||
| 68 | __u8 dsap; /* destination service access point */ | 67 | __u8 dsap; /* destination service access point */ |
| 69 | __u8 ssap; /* source service access point */ | 68 | __u8 ssap; /* source service access point */ |
| 70 | __u8 ctrl; /* control byte #1 */ | 69 | __u8 ctrl; /* control byte #1 */ |
| 71 | } __attribute__ ((packed)); | 70 | } __attribute__ ((packed)); |
| 72 | 71 | ||
| 73 | /* Define 802.2 Type 2 header */ | 72 | /* Define 802.2 Type 2 header */ |
| 74 | struct fddi_8022_2_hdr | 73 | struct fddi_8022_2_hdr { |
| 75 | { | ||
| 76 | __u8 dsap; /* destination service access point */ | 74 | __u8 dsap; /* destination service access point */ |
| 77 | __u8 ssap; /* source service access point */ | 75 | __u8 ssap; /* source service access point */ |
| 78 | __u8 ctrl_1; /* control byte #1 */ | 76 | __u8 ctrl_1; /* control byte #1 */ |
| 79 | __u8 ctrl_2; /* control byte #2 */ | 77 | __u8 ctrl_2; /* control byte #2 */ |
| 80 | } __attribute__ ((packed)); | 78 | } __attribute__ ((packed)); |
| 81 | 79 | ||
| 82 | /* Define 802.2 SNAP header */ | 80 | /* Define 802.2 SNAP header */ |
| 83 | #define FDDI_K_OUI_LEN 3 | 81 | #define FDDI_K_OUI_LEN 3 |
| 84 | struct fddi_snap_hdr | 82 | struct fddi_snap_hdr { |
| 85 | { | ||
| 86 | __u8 dsap; /* always 0xAA */ | 83 | __u8 dsap; /* always 0xAA */ |
| 87 | __u8 ssap; /* always 0xAA */ | 84 | __u8 ssap; /* always 0xAA */ |
| 88 | __u8 ctrl; /* always 0x03 */ | 85 | __u8 ctrl; /* always 0x03 */ |
| 89 | __u8 oui[FDDI_K_OUI_LEN]; /* organizational universal id */ | 86 | __u8 oui[FDDI_K_OUI_LEN]; /* organizational universal id */ |
| 90 | __be16 ethertype; /* packet type ID field */ | 87 | __be16 ethertype; /* packet type ID field */ |
| 91 | } __attribute__ ((packed)); | 88 | } __attribute__ ((packed)); |
| 92 | 89 | ||
| 93 | /* Define FDDI LLC frame header */ | 90 | /* Define FDDI LLC frame header */ |
| 94 | struct fddihdr | 91 | struct fddihdr { |
| 95 | { | ||
| 96 | __u8 fc; /* frame control */ | 92 | __u8 fc; /* frame control */ |
| 97 | __u8 daddr[FDDI_K_ALEN]; /* destination address */ | 93 | __u8 daddr[FDDI_K_ALEN]; /* destination address */ |
| 98 | __u8 saddr[FDDI_K_ALEN]; /* source address */ | 94 | __u8 saddr[FDDI_K_ALEN]; /* source address */ |
| @@ -102,7 +98,7 @@ struct fddihdr | |||
| 102 | struct fddi_8022_2_hdr llc_8022_2; | 98 | struct fddi_8022_2_hdr llc_8022_2; |
| 103 | struct fddi_snap_hdr llc_snap; | 99 | struct fddi_snap_hdr llc_snap; |
| 104 | } hdr; | 100 | } hdr; |
| 105 | } __attribute__ ((packed)); | 101 | } __attribute__ ((packed)); |
| 106 | 102 | ||
| 107 | #ifdef __KERNEL__ | 103 | #ifdef __KERNEL__ |
| 108 | #include <linux/netdevice.h> | 104 | #include <linux/netdevice.h> |
| @@ -197,7 +193,7 @@ struct fddi_statistics { | |||
| 197 | __u32 port_pc_withhold[2]; | 193 | __u32 port_pc_withhold[2]; |
| 198 | __u32 port_ler_flag[2]; | 194 | __u32 port_ler_flag[2]; |
| 199 | __u32 port_hardware_present[2]; | 195 | __u32 port_hardware_present[2]; |
| 200 | }; | 196 | }; |
| 201 | #endif /* __KERNEL__ */ | 197 | #endif /* __KERNEL__ */ |
| 202 | 198 | ||
| 203 | #endif /* _LINUX_IF_FDDI_H */ | 199 | #endif /* _LINUX_IF_FDDI_H */ |
diff --git a/include/linux/if_hippi.h b/include/linux/if_hippi.h index 4a7c9940b080..8d038eb8db5c 100644 --- a/include/linux/if_hippi.h +++ b/include/linux/if_hippi.h | |||
| @@ -51,8 +51,7 @@ | |||
| 51 | * HIPPI statistics collection data. | 51 | * HIPPI statistics collection data. |
| 52 | */ | 52 | */ |
| 53 | 53 | ||
| 54 | struct hipnet_statistics | 54 | struct hipnet_statistics { |
| 55 | { | ||
| 56 | int rx_packets; /* total packets received */ | 55 | int rx_packets; /* total packets received */ |
| 57 | int tx_packets; /* total packets transmitted */ | 56 | int tx_packets; /* total packets transmitted */ |
| 58 | int rx_errors; /* bad packets received */ | 57 | int rx_errors; /* bad packets received */ |
| @@ -77,8 +76,7 @@ struct hipnet_statistics | |||
| 77 | }; | 76 | }; |
| 78 | 77 | ||
| 79 | 78 | ||
| 80 | struct hippi_fp_hdr | 79 | struct hippi_fp_hdr { |
| 81 | { | ||
| 82 | #if 0 | 80 | #if 0 |
| 83 | __u8 ulp; /* must contain 4 */ | 81 | __u8 ulp; /* must contain 4 */ |
| 84 | #if defined (__BIG_ENDIAN_BITFIELD) | 82 | #if defined (__BIG_ENDIAN_BITFIELD) |
| @@ -108,8 +106,7 @@ struct hippi_fp_hdr | |||
| 108 | __be32 d2_size; | 106 | __be32 d2_size; |
| 109 | } __attribute__ ((packed)); | 107 | } __attribute__ ((packed)); |
| 110 | 108 | ||
| 111 | struct hippi_le_hdr | 109 | struct hippi_le_hdr { |
| 112 | { | ||
| 113 | #if defined (__BIG_ENDIAN_BITFIELD) | 110 | #if defined (__BIG_ENDIAN_BITFIELD) |
| 114 | __u8 fc:3; | 111 | __u8 fc:3; |
| 115 | __u8 double_wide:1; | 112 | __u8 double_wide:1; |
| @@ -139,8 +136,7 @@ struct hippi_le_hdr | |||
| 139 | * Looks like the dsap and ssap fields have been swapped by mistake in | 136 | * Looks like the dsap and ssap fields have been swapped by mistake in |
| 140 | * RFC 2067 "IP over HIPPI". | 137 | * RFC 2067 "IP over HIPPI". |
| 141 | */ | 138 | */ |
| 142 | struct hippi_snap_hdr | 139 | struct hippi_snap_hdr { |
| 143 | { | ||
| 144 | __u8 dsap; /* always 0xAA */ | 140 | __u8 dsap; /* always 0xAA */ |
| 145 | __u8 ssap; /* always 0xAA */ | 141 | __u8 ssap; /* always 0xAA */ |
| 146 | __u8 ctrl; /* always 0x03 */ | 142 | __u8 ctrl; /* always 0x03 */ |
| @@ -148,8 +144,7 @@ struct hippi_snap_hdr | |||
| 148 | __be16 ethertype; /* packet type ID field */ | 144 | __be16 ethertype; /* packet type ID field */ |
| 149 | } __attribute__ ((packed)); | 145 | } __attribute__ ((packed)); |
| 150 | 146 | ||
| 151 | struct hippi_hdr | 147 | struct hippi_hdr { |
| 152 | { | ||
| 153 | struct hippi_fp_hdr fp; | 148 | struct hippi_fp_hdr fp; |
| 154 | struct hippi_le_hdr le; | 149 | struct hippi_le_hdr le; |
| 155 | struct hippi_snap_hdr snap; | 150 | struct hippi_snap_hdr snap; |
diff --git a/include/linux/if_link.h b/include/linux/if_link.h index 176c5182c515..d94963b379d9 100644 --- a/include/linux/if_link.h +++ b/include/linux/if_link.h | |||
| @@ -5,8 +5,7 @@ | |||
| 5 | #include <linux/netlink.h> | 5 | #include <linux/netlink.h> |
| 6 | 6 | ||
| 7 | /* The struct should be in sync with struct net_device_stats */ | 7 | /* The struct should be in sync with struct net_device_stats */ |
| 8 | struct rtnl_link_stats | 8 | struct rtnl_link_stats { |
| 9 | { | ||
| 10 | __u32 rx_packets; /* total packets received */ | 9 | __u32 rx_packets; /* total packets received */ |
| 11 | __u32 tx_packets; /* total packets transmitted */ | 10 | __u32 tx_packets; /* total packets transmitted */ |
| 12 | __u32 rx_bytes; /* total bytes received */ | 11 | __u32 rx_bytes; /* total bytes received */ |
| @@ -39,8 +38,7 @@ struct rtnl_link_stats | |||
| 39 | }; | 38 | }; |
| 40 | 39 | ||
| 41 | /* The struct should be in sync with struct ifmap */ | 40 | /* The struct should be in sync with struct ifmap */ |
| 42 | struct rtnl_link_ifmap | 41 | struct rtnl_link_ifmap { |
| 43 | { | ||
| 44 | __u64 mem_start; | 42 | __u64 mem_start; |
| 45 | __u64 mem_end; | 43 | __u64 mem_end; |
| 46 | __u64 base_addr; | 44 | __u64 base_addr; |
| @@ -49,8 +47,7 @@ struct rtnl_link_ifmap | |||
| 49 | __u8 port; | 47 | __u8 port; |
| 50 | }; | 48 | }; |
| 51 | 49 | ||
| 52 | enum | 50 | enum { |
| 53 | { | ||
| 54 | IFLA_UNSPEC, | 51 | IFLA_UNSPEC, |
| 55 | IFLA_ADDRESS, | 52 | IFLA_ADDRESS, |
| 56 | IFLA_BROADCAST, | 53 | IFLA_BROADCAST, |
| @@ -81,6 +78,8 @@ enum | |||
| 81 | #define IFLA_LINKINFO IFLA_LINKINFO | 78 | #define IFLA_LINKINFO IFLA_LINKINFO |
| 82 | IFLA_NET_NS_PID, | 79 | IFLA_NET_NS_PID, |
| 83 | IFLA_IFALIAS, | 80 | IFLA_IFALIAS, |
| 81 | IFLA_NUM_VF, /* Number of VFs if device is SR-IOV PF */ | ||
| 82 | IFLA_VFINFO_LIST, | ||
| 84 | __IFLA_MAX | 83 | __IFLA_MAX |
| 85 | }; | 84 | }; |
| 86 | 85 | ||
| @@ -123,8 +122,7 @@ enum | |||
| 123 | */ | 122 | */ |
| 124 | 123 | ||
| 125 | /* Subtype attributes for IFLA_PROTINFO */ | 124 | /* Subtype attributes for IFLA_PROTINFO */ |
| 126 | enum | 125 | enum { |
| 127 | { | ||
| 128 | IFLA_INET6_UNSPEC, | 126 | IFLA_INET6_UNSPEC, |
| 129 | IFLA_INET6_FLAGS, /* link flags */ | 127 | IFLA_INET6_FLAGS, /* link flags */ |
| 130 | IFLA_INET6_CONF, /* sysctl parameters */ | 128 | IFLA_INET6_CONF, /* sysctl parameters */ |
| @@ -137,16 +135,14 @@ enum | |||
| 137 | 135 | ||
| 138 | #define IFLA_INET6_MAX (__IFLA_INET6_MAX - 1) | 136 | #define IFLA_INET6_MAX (__IFLA_INET6_MAX - 1) |
| 139 | 137 | ||
| 140 | struct ifla_cacheinfo | 138 | struct ifla_cacheinfo { |
| 141 | { | ||
| 142 | __u32 max_reasm_len; | 139 | __u32 max_reasm_len; |
| 143 | __u32 tstamp; /* ipv6InterfaceTable updated timestamp */ | 140 | __u32 tstamp; /* ipv6InterfaceTable updated timestamp */ |
| 144 | __u32 reachable_time; | 141 | __u32 reachable_time; |
| 145 | __u32 retrans_time; | 142 | __u32 retrans_time; |
| 146 | }; | 143 | }; |
| 147 | 144 | ||
| 148 | enum | 145 | enum { |
| 149 | { | ||
| 150 | IFLA_INFO_UNSPEC, | 146 | IFLA_INFO_UNSPEC, |
| 151 | IFLA_INFO_KIND, | 147 | IFLA_INFO_KIND, |
| 152 | IFLA_INFO_DATA, | 148 | IFLA_INFO_DATA, |
| @@ -158,8 +154,7 @@ enum | |||
| 158 | 154 | ||
| 159 | /* VLAN section */ | 155 | /* VLAN section */ |
| 160 | 156 | ||
| 161 | enum | 157 | enum { |
| 162 | { | ||
| 163 | IFLA_VLAN_UNSPEC, | 158 | IFLA_VLAN_UNSPEC, |
| 164 | IFLA_VLAN_ID, | 159 | IFLA_VLAN_ID, |
| 165 | IFLA_VLAN_FLAGS, | 160 | IFLA_VLAN_FLAGS, |
| @@ -175,8 +170,7 @@ struct ifla_vlan_flags { | |||
| 175 | __u32 mask; | 170 | __u32 mask; |
| 176 | }; | 171 | }; |
| 177 | 172 | ||
| 178 | enum | 173 | enum { |
| 179 | { | ||
| 180 | IFLA_VLAN_QOS_UNSPEC, | 174 | IFLA_VLAN_QOS_UNSPEC, |
| 181 | IFLA_VLAN_QOS_MAPPING, | 175 | IFLA_VLAN_QOS_MAPPING, |
| 182 | __IFLA_VLAN_QOS_MAX | 176 | __IFLA_VLAN_QOS_MAX |
| @@ -184,10 +178,67 @@ enum | |||
| 184 | 178 | ||
| 185 | #define IFLA_VLAN_QOS_MAX (__IFLA_VLAN_QOS_MAX - 1) | 179 | #define IFLA_VLAN_QOS_MAX (__IFLA_VLAN_QOS_MAX - 1) |
| 186 | 180 | ||
| 187 | struct ifla_vlan_qos_mapping | 181 | struct ifla_vlan_qos_mapping { |
| 188 | { | ||
| 189 | __u32 from; | 182 | __u32 from; |
| 190 | __u32 to; | 183 | __u32 to; |
| 191 | }; | 184 | }; |
| 192 | 185 | ||
| 186 | /* MACVLAN section */ | ||
| 187 | enum { | ||
| 188 | IFLA_MACVLAN_UNSPEC, | ||
| 189 | IFLA_MACVLAN_MODE, | ||
| 190 | __IFLA_MACVLAN_MAX, | ||
| 191 | }; | ||
| 192 | |||
| 193 | #define IFLA_MACVLAN_MAX (__IFLA_MACVLAN_MAX - 1) | ||
| 194 | |||
| 195 | enum macvlan_mode { | ||
| 196 | MACVLAN_MODE_PRIVATE = 1, /* don't talk to other macvlans */ | ||
| 197 | MACVLAN_MODE_VEPA = 2, /* talk to other ports through ext bridge */ | ||
| 198 | MACVLAN_MODE_BRIDGE = 4, /* talk to bridge ports directly */ | ||
| 199 | }; | ||
| 200 | |||
| 201 | /* SR-IOV virtual function managment section */ | ||
| 202 | |||
| 203 | enum { | ||
| 204 | IFLA_VF_INFO_UNSPEC, | ||
| 205 | IFLA_VF_INFO, | ||
| 206 | __IFLA_VF_INFO_MAX, | ||
| 207 | }; | ||
| 208 | |||
| 209 | #define IFLA_VF_INFO_MAX (__IFLA_VF_INFO_MAX - 1) | ||
| 210 | |||
| 211 | enum { | ||
| 212 | IFLA_VF_UNSPEC, | ||
| 213 | IFLA_VF_MAC, /* Hardware queue specific attributes */ | ||
| 214 | IFLA_VF_VLAN, | ||
| 215 | IFLA_VF_TX_RATE, /* TX Bandwidth Allocation */ | ||
| 216 | __IFLA_VF_MAX, | ||
| 217 | }; | ||
| 218 | |||
| 219 | #define IFLA_VF_MAX (__IFLA_VF_MAX - 1) | ||
| 220 | |||
| 221 | struct ifla_vf_mac { | ||
| 222 | __u32 vf; | ||
| 223 | __u8 mac[32]; /* MAX_ADDR_LEN */ | ||
| 224 | }; | ||
| 225 | |||
| 226 | struct ifla_vf_vlan { | ||
| 227 | __u32 vf; | ||
| 228 | __u32 vlan; /* 0 - 4095, 0 disables VLAN filter */ | ||
| 229 | __u32 qos; | ||
| 230 | }; | ||
| 231 | |||
| 232 | struct ifla_vf_tx_rate { | ||
| 233 | __u32 vf; | ||
| 234 | __u32 rate; /* Max TX bandwidth in Mbps, 0 disables throttling */ | ||
| 235 | }; | ||
| 236 | |||
| 237 | struct ifla_vf_info { | ||
| 238 | __u32 vf; | ||
| 239 | __u8 mac[32]; | ||
| 240 | __u32 vlan; | ||
| 241 | __u32 qos; | ||
| 242 | __u32 tx_rate; | ||
| 243 | }; | ||
| 193 | #endif /* _LINUX_IF_LINK_H */ | 244 | #endif /* _LINUX_IF_LINK_H */ |
diff --git a/include/linux/if_macvlan.h b/include/linux/if_macvlan.h index 5f200bac3749..b78a712247da 100644 --- a/include/linux/if_macvlan.h +++ b/include/linux/if_macvlan.h | |||
| @@ -1,6 +1,90 @@ | |||
| 1 | #ifndef _LINUX_IF_MACVLAN_H | 1 | #ifndef _LINUX_IF_MACVLAN_H |
| 2 | #define _LINUX_IF_MACVLAN_H | 2 | #define _LINUX_IF_MACVLAN_H |
| 3 | 3 | ||
| 4 | #include <linux/if_link.h> | ||
| 5 | #include <linux/list.h> | ||
| 6 | #include <linux/netdevice.h> | ||
| 7 | #include <linux/netlink.h> | ||
| 8 | #include <net/netlink.h> | ||
| 9 | |||
| 10 | #if defined(CONFIG_MACVTAP) || defined(CONFIG_MACVTAP_MODULE) | ||
| 11 | struct socket *macvtap_get_socket(struct file *); | ||
| 12 | #else | ||
| 13 | #include <linux/err.h> | ||
| 14 | #include <linux/errno.h> | ||
| 15 | struct file; | ||
| 16 | struct socket; | ||
| 17 | static inline struct socket *macvtap_get_socket(struct file *f) | ||
| 18 | { | ||
| 19 | return ERR_PTR(-EINVAL); | ||
| 20 | } | ||
| 21 | #endif /* CONFIG_MACVTAP */ | ||
| 22 | |||
| 23 | struct macvlan_port; | ||
| 24 | struct macvtap_queue; | ||
| 25 | |||
| 26 | /** | ||
| 27 | * struct macvlan_rx_stats - MACVLAN percpu rx stats | ||
| 28 | * @rx_packets: number of received packets | ||
| 29 | * @rx_bytes: number of received bytes | ||
| 30 | * @multicast: number of received multicast packets | ||
| 31 | * @rx_errors: number of errors | ||
| 32 | */ | ||
| 33 | struct macvlan_rx_stats { | ||
| 34 | unsigned long rx_packets; | ||
| 35 | unsigned long rx_bytes; | ||
| 36 | unsigned long multicast; | ||
| 37 | unsigned long rx_errors; | ||
| 38 | }; | ||
| 39 | |||
| 40 | struct macvlan_dev { | ||
| 41 | struct net_device *dev; | ||
| 42 | struct list_head list; | ||
| 43 | struct hlist_node hlist; | ||
| 44 | struct macvlan_port *port; | ||
| 45 | struct net_device *lowerdev; | ||
| 46 | struct macvlan_rx_stats __percpu *rx_stats; | ||
| 47 | enum macvlan_mode mode; | ||
| 48 | int (*receive)(struct sk_buff *skb); | ||
| 49 | int (*forward)(struct net_device *dev, struct sk_buff *skb); | ||
| 50 | struct macvtap_queue *tap; | ||
| 51 | }; | ||
| 52 | |||
| 53 | static inline void macvlan_count_rx(const struct macvlan_dev *vlan, | ||
| 54 | unsigned int len, bool success, | ||
| 55 | bool multicast) | ||
| 56 | { | ||
| 57 | struct macvlan_rx_stats *rx_stats; | ||
| 58 | |||
| 59 | rx_stats = per_cpu_ptr(vlan->rx_stats, smp_processor_id()); | ||
| 60 | if (likely(success)) { | ||
| 61 | rx_stats->rx_packets++;; | ||
| 62 | rx_stats->rx_bytes += len; | ||
| 63 | if (multicast) | ||
| 64 | rx_stats->multicast++; | ||
| 65 | } else { | ||
| 66 | rx_stats->rx_errors++; | ||
| 67 | } | ||
| 68 | } | ||
| 69 | |||
| 70 | extern int macvlan_common_newlink(struct net *src_net, struct net_device *dev, | ||
| 71 | struct nlattr *tb[], struct nlattr *data[], | ||
| 72 | int (*receive)(struct sk_buff *skb), | ||
| 73 | int (*forward)(struct net_device *dev, | ||
| 74 | struct sk_buff *skb)); | ||
| 75 | |||
| 76 | extern void macvlan_count_rx(const struct macvlan_dev *vlan, | ||
| 77 | unsigned int len, bool success, | ||
| 78 | bool multicast); | ||
| 79 | |||
| 80 | extern void macvlan_dellink(struct net_device *dev, struct list_head *head); | ||
| 81 | |||
| 82 | extern int macvlan_link_register(struct rtnl_link_ops *ops); | ||
| 83 | |||
| 84 | extern netdev_tx_t macvlan_start_xmit(struct sk_buff *skb, | ||
| 85 | struct net_device *dev); | ||
| 86 | |||
| 87 | |||
| 4 | extern struct sk_buff *(*macvlan_handle_frame_hook)(struct sk_buff *); | 88 | extern struct sk_buff *(*macvlan_handle_frame_hook)(struct sk_buff *); |
| 5 | 89 | ||
| 6 | #endif /* _LINUX_IF_MACVLAN_H */ | 90 | #endif /* _LINUX_IF_MACVLAN_H */ |
diff --git a/include/linux/if_packet.h b/include/linux/if_packet.h index dea7d6b7cf98..aa57a5f993fc 100644 --- a/include/linux/if_packet.h +++ b/include/linux/if_packet.h | |||
| @@ -3,15 +3,13 @@ | |||
| 3 | 3 | ||
| 4 | #include <linux/types.h> | 4 | #include <linux/types.h> |
| 5 | 5 | ||
| 6 | struct sockaddr_pkt | 6 | struct sockaddr_pkt { |
| 7 | { | ||
| 8 | unsigned short spkt_family; | 7 | unsigned short spkt_family; |
| 9 | unsigned char spkt_device[14]; | 8 | unsigned char spkt_device[14]; |
| 10 | __be16 spkt_protocol; | 9 | __be16 spkt_protocol; |
| 11 | }; | 10 | }; |
| 12 | 11 | ||
| 13 | struct sockaddr_ll | 12 | struct sockaddr_ll { |
| 14 | { | ||
| 15 | unsigned short sll_family; | 13 | unsigned short sll_family; |
| 16 | __be16 sll_protocol; | 14 | __be16 sll_protocol; |
| 17 | int sll_ifindex; | 15 | int sll_ifindex; |
| @@ -48,15 +46,14 @@ struct sockaddr_ll | |||
| 48 | #define PACKET_RESERVE 12 | 46 | #define PACKET_RESERVE 12 |
| 49 | #define PACKET_TX_RING 13 | 47 | #define PACKET_TX_RING 13 |
| 50 | #define PACKET_LOSS 14 | 48 | #define PACKET_LOSS 14 |
| 49 | #define PACKET_VNET_HDR 15 | ||
| 51 | 50 | ||
| 52 | struct tpacket_stats | 51 | struct tpacket_stats { |
| 53 | { | ||
| 54 | unsigned int tp_packets; | 52 | unsigned int tp_packets; |
| 55 | unsigned int tp_drops; | 53 | unsigned int tp_drops; |
| 56 | }; | 54 | }; |
| 57 | 55 | ||
| 58 | struct tpacket_auxdata | 56 | struct tpacket_auxdata { |
| 59 | { | ||
| 60 | __u32 tp_status; | 57 | __u32 tp_status; |
| 61 | __u32 tp_len; | 58 | __u32 tp_len; |
| 62 | __u32 tp_snaplen; | 59 | __u32 tp_snaplen; |
| @@ -78,8 +75,7 @@ struct tpacket_auxdata | |||
| 78 | #define TP_STATUS_SENDING 0x2 | 75 | #define TP_STATUS_SENDING 0x2 |
| 79 | #define TP_STATUS_WRONG_FORMAT 0x4 | 76 | #define TP_STATUS_WRONG_FORMAT 0x4 |
| 80 | 77 | ||
| 81 | struct tpacket_hdr | 78 | struct tpacket_hdr { |
| 82 | { | ||
| 83 | unsigned long tp_status; | 79 | unsigned long tp_status; |
| 84 | unsigned int tp_len; | 80 | unsigned int tp_len; |
| 85 | unsigned int tp_snaplen; | 81 | unsigned int tp_snaplen; |
| @@ -93,8 +89,7 @@ struct tpacket_hdr | |||
| 93 | #define TPACKET_ALIGN(x) (((x)+TPACKET_ALIGNMENT-1)&~(TPACKET_ALIGNMENT-1)) | 89 | #define TPACKET_ALIGN(x) (((x)+TPACKET_ALIGNMENT-1)&~(TPACKET_ALIGNMENT-1)) |
| 94 | #define TPACKET_HDRLEN (TPACKET_ALIGN(sizeof(struct tpacket_hdr)) + sizeof(struct sockaddr_ll)) | 90 | #define TPACKET_HDRLEN (TPACKET_ALIGN(sizeof(struct tpacket_hdr)) + sizeof(struct sockaddr_ll)) |
| 95 | 91 | ||
| 96 | struct tpacket2_hdr | 92 | struct tpacket2_hdr { |
| 97 | { | ||
| 98 | __u32 tp_status; | 93 | __u32 tp_status; |
| 99 | __u32 tp_len; | 94 | __u32 tp_len; |
| 100 | __u32 tp_snaplen; | 95 | __u32 tp_snaplen; |
| @@ -107,8 +102,7 @@ struct tpacket2_hdr | |||
| 107 | 102 | ||
| 108 | #define TPACKET2_HDRLEN (TPACKET_ALIGN(sizeof(struct tpacket2_hdr)) + sizeof(struct sockaddr_ll)) | 103 | #define TPACKET2_HDRLEN (TPACKET_ALIGN(sizeof(struct tpacket2_hdr)) + sizeof(struct sockaddr_ll)) |
| 109 | 104 | ||
| 110 | enum tpacket_versions | 105 | enum tpacket_versions { |
| 111 | { | ||
| 112 | TPACKET_V1, | 106 | TPACKET_V1, |
| 113 | TPACKET_V2, | 107 | TPACKET_V2, |
| 114 | }; | 108 | }; |
| @@ -126,16 +120,14 @@ enum tpacket_versions | |||
| 126 | - Pad to align to TPACKET_ALIGNMENT=16 | 120 | - Pad to align to TPACKET_ALIGNMENT=16 |
| 127 | */ | 121 | */ |
| 128 | 122 | ||
| 129 | struct tpacket_req | 123 | struct tpacket_req { |
| 130 | { | ||
| 131 | unsigned int tp_block_size; /* Minimal size of contiguous block */ | 124 | unsigned int tp_block_size; /* Minimal size of contiguous block */ |
| 132 | unsigned int tp_block_nr; /* Number of blocks */ | 125 | unsigned int tp_block_nr; /* Number of blocks */ |
| 133 | unsigned int tp_frame_size; /* Size of frame */ | 126 | unsigned int tp_frame_size; /* Size of frame */ |
| 134 | unsigned int tp_frame_nr; /* Total number of frames */ | 127 | unsigned int tp_frame_nr; /* Total number of frames */ |
| 135 | }; | 128 | }; |
| 136 | 129 | ||
| 137 | struct packet_mreq | 130 | struct packet_mreq { |
| 138 | { | ||
| 139 | int mr_ifindex; | 131 | int mr_ifindex; |
| 140 | unsigned short mr_type; | 132 | unsigned short mr_type; |
| 141 | unsigned short mr_alen; | 133 | unsigned short mr_alen; |
diff --git a/include/linux/if_plip.h b/include/linux/if_plip.h index 153a649915a2..6298c7e88b2b 100644 --- a/include/linux/if_plip.h +++ b/include/linux/if_plip.h | |||
| @@ -15,8 +15,7 @@ | |||
| 15 | 15 | ||
| 16 | #define SIOCDEVPLIP SIOCDEVPRIVATE | 16 | #define SIOCDEVPLIP SIOCDEVPRIVATE |
| 17 | 17 | ||
| 18 | struct plipconf | 18 | struct plipconf { |
| 19 | { | ||
| 20 | unsigned short pcmd; | 19 | unsigned short pcmd; |
| 21 | unsigned long nibble; | 20 | unsigned long nibble; |
| 22 | unsigned long trigger; | 21 | unsigned long trigger; |
diff --git a/include/linux/if_pppol2tp.h b/include/linux/if_pppol2tp.h index 3a14b088c8ec..c58baea4a25b 100644 --- a/include/linux/if_pppol2tp.h +++ b/include/linux/if_pppol2tp.h | |||
| @@ -24,8 +24,7 @@ | |||
| 24 | /* Structure used to connect() the socket to a particular tunnel UDP | 24 | /* Structure used to connect() the socket to a particular tunnel UDP |
| 25 | * socket. | 25 | * socket. |
| 26 | */ | 26 | */ |
| 27 | struct pppol2tp_addr | 27 | struct pppol2tp_addr { |
| 28 | { | ||
| 29 | __kernel_pid_t pid; /* pid that owns the fd. | 28 | __kernel_pid_t pid; /* pid that owns the fd. |
| 30 | * 0 => current */ | 29 | * 0 => current */ |
| 31 | int fd; /* FD of UDP socket to use */ | 30 | int fd; /* FD of UDP socket to use */ |
diff --git a/include/linux/if_tun.h b/include/linux/if_tun.h index 3f5fd523b49d..1350a246893a 100644 --- a/include/linux/if_tun.h +++ b/include/linux/if_tun.h | |||
| @@ -18,6 +18,7 @@ | |||
| 18 | 18 | ||
| 19 | #include <linux/types.h> | 19 | #include <linux/types.h> |
| 20 | #include <linux/if_ether.h> | 20 | #include <linux/if_ether.h> |
| 21 | #include <linux/filter.h> | ||
| 21 | 22 | ||
| 22 | /* Read queue size */ | 23 | /* Read queue size */ |
| 23 | #define TUN_READQ_SIZE 500 | 24 | #define TUN_READQ_SIZE 500 |
| @@ -48,6 +49,8 @@ | |||
| 48 | #define TUNGETIFF _IOR('T', 210, unsigned int) | 49 | #define TUNGETIFF _IOR('T', 210, unsigned int) |
| 49 | #define TUNGETSNDBUF _IOR('T', 211, int) | 50 | #define TUNGETSNDBUF _IOR('T', 211, int) |
| 50 | #define TUNSETSNDBUF _IOW('T', 212, int) | 51 | #define TUNSETSNDBUF _IOW('T', 212, int) |
| 52 | #define TUNATTACHFILTER _IOW('T', 213, struct sock_fprog) | ||
| 53 | #define TUNDETACHFILTER _IOW('T', 214, struct sock_fprog) | ||
| 51 | 54 | ||
| 52 | /* TUNSETIFF ifr flags */ | 55 | /* TUNSETIFF ifr flags */ |
| 53 | #define IFF_TUN 0x0001 | 56 | #define IFF_TUN 0x0001 |
| @@ -86,4 +89,18 @@ struct tun_filter { | |||
| 86 | __u8 addr[0][ETH_ALEN]; | 89 | __u8 addr[0][ETH_ALEN]; |
| 87 | }; | 90 | }; |
| 88 | 91 | ||
| 92 | #ifdef __KERNEL__ | ||
| 93 | #if defined(CONFIG_TUN) || defined(CONFIG_TUN_MODULE) | ||
| 94 | struct socket *tun_get_socket(struct file *); | ||
| 95 | #else | ||
| 96 | #include <linux/err.h> | ||
| 97 | #include <linux/errno.h> | ||
| 98 | struct file; | ||
| 99 | struct socket; | ||
| 100 | static inline struct socket *tun_get_socket(struct file *f) | ||
| 101 | { | ||
| 102 | return ERR_PTR(-EINVAL); | ||
| 103 | } | ||
| 104 | #endif /* CONFIG_TUN */ | ||
| 105 | #endif /* __KERNEL__ */ | ||
| 89 | #endif /* __IF_TUN_H */ | 106 | #endif /* __IF_TUN_H */ |
diff --git a/include/linux/if_tunnel.h b/include/linux/if_tunnel.h index 5a9aae4adb44..16b92d008bed 100644 --- a/include/linux/if_tunnel.h +++ b/include/linux/if_tunnel.h | |||
| @@ -2,9 +2,11 @@ | |||
| 2 | #define _IF_TUNNEL_H_ | 2 | #define _IF_TUNNEL_H_ |
| 3 | 3 | ||
| 4 | #include <linux/types.h> | 4 | #include <linux/types.h> |
| 5 | #include <asm/byteorder.h> | ||
| 5 | 6 | ||
| 6 | #ifdef __KERNEL__ | 7 | #ifdef __KERNEL__ |
| 7 | #include <linux/ip.h> | 8 | #include <linux/ip.h> |
| 9 | #include <linux/in6.h> | ||
| 8 | #endif | 10 | #endif |
| 9 | 11 | ||
| 10 | #define SIOCGETTUNNEL (SIOCDEVPRIVATE + 0) | 12 | #define SIOCGETTUNNEL (SIOCDEVPRIVATE + 0) |
| @@ -15,6 +17,10 @@ | |||
| 15 | #define SIOCADDPRL (SIOCDEVPRIVATE + 5) | 17 | #define SIOCADDPRL (SIOCDEVPRIVATE + 5) |
| 16 | #define SIOCDELPRL (SIOCDEVPRIVATE + 6) | 18 | #define SIOCDELPRL (SIOCDEVPRIVATE + 6) |
| 17 | #define SIOCCHGPRL (SIOCDEVPRIVATE + 7) | 19 | #define SIOCCHGPRL (SIOCDEVPRIVATE + 7) |
| 20 | #define SIOCGET6RD (SIOCDEVPRIVATE + 8) | ||
| 21 | #define SIOCADD6RD (SIOCDEVPRIVATE + 9) | ||
| 22 | #define SIOCDEL6RD (SIOCDEVPRIVATE + 10) | ||
| 23 | #define SIOCCHG6RD (SIOCDEVPRIVATE + 11) | ||
| 18 | 24 | ||
| 19 | #define GRE_CSUM __cpu_to_be16(0x8000) | 25 | #define GRE_CSUM __cpu_to_be16(0x8000) |
| 20 | #define GRE_ROUTING __cpu_to_be16(0x4000) | 26 | #define GRE_ROUTING __cpu_to_be16(0x4000) |
| @@ -25,8 +31,7 @@ | |||
| 25 | #define GRE_FLAGS __cpu_to_be16(0x00F8) | 31 | #define GRE_FLAGS __cpu_to_be16(0x00F8) |
| 26 | #define GRE_VERSION __cpu_to_be16(0x0007) | 32 | #define GRE_VERSION __cpu_to_be16(0x0007) |
| 27 | 33 | ||
| 28 | struct ip_tunnel_parm | 34 | struct ip_tunnel_parm { |
| 29 | { | ||
| 30 | char name[IFNAMSIZ]; | 35 | char name[IFNAMSIZ]; |
| 31 | int link; | 36 | int link; |
| 32 | __be16 i_flags; | 37 | __be16 i_flags; |
| @@ -51,8 +56,14 @@ struct ip_tunnel_prl { | |||
| 51 | /* PRL flags */ | 56 | /* PRL flags */ |
| 52 | #define PRL_DEFAULT 0x0001 | 57 | #define PRL_DEFAULT 0x0001 |
| 53 | 58 | ||
| 54 | enum | 59 | struct ip_tunnel_6rd { |
| 55 | { | 60 | struct in6_addr prefix; |
| 61 | __be32 relay_prefix; | ||
| 62 | __u16 prefixlen; | ||
| 63 | __u16 relay_prefixlen; | ||
| 64 | }; | ||
| 65 | |||
| 66 | enum { | ||
| 56 | IFLA_GRE_UNSPEC, | 67 | IFLA_GRE_UNSPEC, |
| 57 | IFLA_GRE_LINK, | 68 | IFLA_GRE_LINK, |
| 58 | IFLA_GRE_IFLAGS, | 69 | IFLA_GRE_IFLAGS, |
diff --git a/include/linux/if_vlan.h b/include/linux/if_vlan.h index 7ff9af1d0f05..3d870fda8c4f 100644 --- a/include/linux/if_vlan.h +++ b/include/linux/if_vlan.h | |||
| @@ -63,7 +63,11 @@ static inline struct vlan_ethhdr *vlan_eth_hdr(const struct sk_buff *skb) | |||
| 63 | return (struct vlan_ethhdr *)skb_mac_header(skb); | 63 | return (struct vlan_ethhdr *)skb_mac_header(skb); |
| 64 | } | 64 | } |
| 65 | 65 | ||
| 66 | #define VLAN_VID_MASK 0xfff | 66 | #define VLAN_PRIO_MASK 0xe000 /* Priority Code Point */ |
| 67 | #define VLAN_PRIO_SHIFT 13 | ||
| 68 | #define VLAN_CFI_MASK 0x1000 /* Canonical Format Indicator */ | ||
| 69 | #define VLAN_TAG_PRESENT VLAN_CFI_MASK | ||
| 70 | #define VLAN_VID_MASK 0x0fff /* VLAN Identifier */ | ||
| 67 | 71 | ||
| 68 | /* found in socket.c */ | 72 | /* found in socket.c */ |
| 69 | extern void vlan_ioctl_set(int (*hook)(struct net *, void __user *)); | 73 | extern void vlan_ioctl_set(int (*hook)(struct net *, void __user *)); |
| @@ -81,6 +85,7 @@ struct vlan_group { | |||
| 81 | * the vlan is attached to. | 85 | * the vlan is attached to. |
| 82 | */ | 86 | */ |
| 83 | unsigned int nr_vlans; | 87 | unsigned int nr_vlans; |
| 88 | int killall; | ||
| 84 | struct hlist_node hlist; /* linked list */ | 89 | struct hlist_node hlist; /* linked list */ |
| 85 | struct net_device **vlan_devices_arrays[VLAN_GROUP_ARRAY_SPLIT_PARTS]; | 90 | struct net_device **vlan_devices_arrays[VLAN_GROUP_ARRAY_SPLIT_PARTS]; |
| 86 | struct rcu_head rcu; | 91 | struct rcu_head rcu; |
| @@ -105,8 +110,8 @@ static inline void vlan_group_set_device(struct vlan_group *vg, | |||
| 105 | array[vlan_id % VLAN_GROUP_ARRAY_PART_LEN] = dev; | 110 | array[vlan_id % VLAN_GROUP_ARRAY_PART_LEN] = dev; |
| 106 | } | 111 | } |
| 107 | 112 | ||
| 108 | #define vlan_tx_tag_present(__skb) ((__skb)->vlan_tci) | 113 | #define vlan_tx_tag_present(__skb) ((__skb)->vlan_tci & VLAN_TAG_PRESENT) |
| 109 | #define vlan_tx_tag_get(__skb) ((__skb)->vlan_tci) | 114 | #define vlan_tx_tag_get(__skb) ((__skb)->vlan_tci & ~VLAN_TAG_PRESENT) |
| 110 | 115 | ||
| 111 | #if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE) | 116 | #if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE) |
| 112 | extern struct net_device *vlan_dev_real_dev(const struct net_device *dev); | 117 | extern struct net_device *vlan_dev_real_dev(const struct net_device *dev); |
| @@ -115,10 +120,12 @@ extern u16 vlan_dev_vlan_id(const struct net_device *dev); | |||
| 115 | extern int __vlan_hwaccel_rx(struct sk_buff *skb, struct vlan_group *grp, | 120 | extern int __vlan_hwaccel_rx(struct sk_buff *skb, struct vlan_group *grp, |
| 116 | u16 vlan_tci, int polling); | 121 | u16 vlan_tci, int polling); |
| 117 | extern int vlan_hwaccel_do_receive(struct sk_buff *skb); | 122 | extern int vlan_hwaccel_do_receive(struct sk_buff *skb); |
| 118 | extern int vlan_gro_receive(struct napi_struct *napi, struct vlan_group *grp, | 123 | extern gro_result_t |
| 119 | unsigned int vlan_tci, struct sk_buff *skb); | 124 | vlan_gro_receive(struct napi_struct *napi, struct vlan_group *grp, |
| 120 | extern int vlan_gro_frags(struct napi_struct *napi, struct vlan_group *grp, | 125 | unsigned int vlan_tci, struct sk_buff *skb); |
| 121 | unsigned int vlan_tci); | 126 | extern gro_result_t |
| 127 | vlan_gro_frags(struct napi_struct *napi, struct vlan_group *grp, | ||
| 128 | unsigned int vlan_tci); | ||
| 122 | 129 | ||
| 123 | #else | 130 | #else |
| 124 | static inline struct net_device *vlan_dev_real_dev(const struct net_device *dev) | 131 | static inline struct net_device *vlan_dev_real_dev(const struct net_device *dev) |
| @@ -145,17 +152,18 @@ static inline int vlan_hwaccel_do_receive(struct sk_buff *skb) | |||
| 145 | return 0; | 152 | return 0; |
| 146 | } | 153 | } |
| 147 | 154 | ||
| 148 | static inline int vlan_gro_receive(struct napi_struct *napi, | 155 | static inline gro_result_t |
| 149 | struct vlan_group *grp, | 156 | vlan_gro_receive(struct napi_struct *napi, struct vlan_group *grp, |
| 150 | unsigned int vlan_tci, struct sk_buff *skb) | 157 | unsigned int vlan_tci, struct sk_buff *skb) |
| 151 | { | 158 | { |
| 152 | return NET_RX_DROP; | 159 | return GRO_DROP; |
| 153 | } | 160 | } |
| 154 | 161 | ||
| 155 | static inline int vlan_gro_frags(struct napi_struct *napi, | 162 | static inline gro_result_t |
| 156 | struct vlan_group *grp, unsigned int vlan_tci) | 163 | vlan_gro_frags(struct napi_struct *napi, struct vlan_group *grp, |
| 164 | unsigned int vlan_tci) | ||
| 157 | { | 165 | { |
| 158 | return NET_RX_DROP; | 166 | return GRO_DROP; |
| 159 | } | 167 | } |
| 160 | #endif | 168 | #endif |
| 161 | 169 | ||
| @@ -231,7 +239,7 @@ static inline struct sk_buff *__vlan_put_tag(struct sk_buff *skb, u16 vlan_tci) | |||
| 231 | static inline struct sk_buff *__vlan_hwaccel_put_tag(struct sk_buff *skb, | 239 | static inline struct sk_buff *__vlan_hwaccel_put_tag(struct sk_buff *skb, |
| 232 | u16 vlan_tci) | 240 | u16 vlan_tci) |
| 233 | { | 241 | { |
| 234 | skb->vlan_tci = vlan_tci; | 242 | skb->vlan_tci = VLAN_TAG_PRESENT | vlan_tci; |
| 235 | return skb; | 243 | return skb; |
| 236 | } | 244 | } |
| 237 | 245 | ||
| @@ -284,7 +292,7 @@ static inline int __vlan_hwaccel_get_tag(const struct sk_buff *skb, | |||
| 284 | u16 *vlan_tci) | 292 | u16 *vlan_tci) |
| 285 | { | 293 | { |
| 286 | if (vlan_tx_tag_present(skb)) { | 294 | if (vlan_tx_tag_present(skb)) { |
| 287 | *vlan_tci = skb->vlan_tci; | 295 | *vlan_tci = vlan_tx_tag_get(skb); |
| 288 | return 0; | 296 | return 0; |
| 289 | } else { | 297 | } else { |
| 290 | *vlan_tci = 0; | 298 | *vlan_tci = 0; |
| @@ -331,6 +339,7 @@ enum vlan_ioctl_cmds { | |||
| 331 | enum vlan_flags { | 339 | enum vlan_flags { |
| 332 | VLAN_FLAG_REORDER_HDR = 0x1, | 340 | VLAN_FLAG_REORDER_HDR = 0x1, |
| 333 | VLAN_FLAG_GVRP = 0x2, | 341 | VLAN_FLAG_GVRP = 0x2, |
| 342 | VLAN_FLAG_LOOSE_BINDING = 0x4, | ||
| 334 | }; | 343 | }; |
| 335 | 344 | ||
| 336 | enum vlan_name_types { | 345 | enum vlan_name_types { |
diff --git a/include/linux/igmp.h b/include/linux/igmp.h index fe158e0e20e6..93fc2449af10 100644 --- a/include/linux/igmp.h +++ b/include/linux/igmp.h | |||
| @@ -27,8 +27,7 @@ | |||
| 27 | * Header in on cable format | 27 | * Header in on cable format |
| 28 | */ | 28 | */ |
| 29 | 29 | ||
| 30 | struct igmphdr | 30 | struct igmphdr { |
| 31 | { | ||
| 32 | __u8 type; | 31 | __u8 type; |
| 33 | __u8 code; /* For newer IGMP */ | 32 | __u8 code; /* For newer IGMP */ |
| 34 | __sum16 csum; | 33 | __sum16 csum; |
| @@ -151,10 +150,10 @@ static inline struct igmpv3_query * | |||
| 151 | extern int sysctl_igmp_max_memberships; | 150 | extern int sysctl_igmp_max_memberships; |
| 152 | extern int sysctl_igmp_max_msf; | 151 | extern int sysctl_igmp_max_msf; |
| 153 | 152 | ||
| 154 | struct ip_sf_socklist | 153 | struct ip_sf_socklist { |
| 155 | { | ||
| 156 | unsigned int sl_max; | 154 | unsigned int sl_max; |
| 157 | unsigned int sl_count; | 155 | unsigned int sl_count; |
| 156 | struct rcu_head rcu; | ||
| 158 | __be32 sl_addr[0]; | 157 | __be32 sl_addr[0]; |
| 159 | }; | 158 | }; |
| 160 | 159 | ||
| @@ -167,16 +166,15 @@ struct ip_sf_socklist | |||
| 167 | this list never used in fast path code | 166 | this list never used in fast path code |
| 168 | */ | 167 | */ |
| 169 | 168 | ||
| 170 | struct ip_mc_socklist | 169 | struct ip_mc_socklist { |
| 171 | { | ||
| 172 | struct ip_mc_socklist *next; | 170 | struct ip_mc_socklist *next; |
| 173 | struct ip_mreqn multi; | 171 | struct ip_mreqn multi; |
| 174 | unsigned int sfmode; /* MCAST_{INCLUDE,EXCLUDE} */ | 172 | unsigned int sfmode; /* MCAST_{INCLUDE,EXCLUDE} */ |
| 175 | struct ip_sf_socklist *sflist; | 173 | struct ip_sf_socklist *sflist; |
| 174 | struct rcu_head rcu; | ||
| 176 | }; | 175 | }; |
| 177 | 176 | ||
| 178 | struct ip_sf_list | 177 | struct ip_sf_list { |
| 179 | { | ||
| 180 | struct ip_sf_list *sf_next; | 178 | struct ip_sf_list *sf_next; |
| 181 | __be32 sf_inaddr; | 179 | __be32 sf_inaddr; |
| 182 | unsigned long sf_count[2]; /* include/exclude counts */ | 180 | unsigned long sf_count[2]; /* include/exclude counts */ |
| @@ -185,8 +183,7 @@ struct ip_sf_list | |||
| 185 | unsigned char sf_crcount; /* retrans. left to send */ | 183 | unsigned char sf_crcount; /* retrans. left to send */ |
| 186 | }; | 184 | }; |
| 187 | 185 | ||
| 188 | struct ip_mc_list | 186 | struct ip_mc_list { |
| 189 | { | ||
| 190 | struct in_device *interface; | 187 | struct in_device *interface; |
| 191 | __be32 multiaddr; | 188 | __be32 multiaddr; |
| 192 | struct ip_sf_list *sources; | 189 | struct ip_sf_list *sources; |
diff --git a/include/linux/ima.h b/include/linux/ima.h index 0e3f2a4c25f6..975837e7d6c0 100644 --- a/include/linux/ima.h +++ b/include/linux/ima.h | |||
| @@ -13,18 +13,14 @@ | |||
| 13 | #include <linux/fs.h> | 13 | #include <linux/fs.h> |
| 14 | struct linux_binprm; | 14 | struct linux_binprm; |
| 15 | 15 | ||
| 16 | #define IMA_COUNT_UPDATE 1 | ||
| 17 | #define IMA_COUNT_LEAVE 0 | ||
| 18 | |||
| 19 | #ifdef CONFIG_IMA | 16 | #ifdef CONFIG_IMA |
| 20 | extern int ima_bprm_check(struct linux_binprm *bprm); | 17 | extern int ima_bprm_check(struct linux_binprm *bprm); |
| 21 | extern int ima_inode_alloc(struct inode *inode); | 18 | extern int ima_inode_alloc(struct inode *inode); |
| 22 | extern void ima_inode_free(struct inode *inode); | 19 | extern void ima_inode_free(struct inode *inode); |
| 23 | extern int ima_path_check(struct path *path, int mask, int update_counts); | 20 | extern int ima_file_check(struct file *file, int mask); |
| 24 | extern void ima_file_free(struct file *file); | 21 | extern void ima_file_free(struct file *file); |
| 25 | extern int ima_file_mmap(struct file *file, unsigned long prot); | 22 | extern int ima_file_mmap(struct file *file, unsigned long prot); |
| 26 | extern void ima_counts_get(struct file *file); | 23 | extern void ima_counts_get(struct file *file); |
| 27 | extern void ima_counts_put(struct path *path, int mask); | ||
| 28 | 24 | ||
| 29 | #else | 25 | #else |
| 30 | static inline int ima_bprm_check(struct linux_binprm *bprm) | 26 | static inline int ima_bprm_check(struct linux_binprm *bprm) |
| @@ -42,7 +38,7 @@ static inline void ima_inode_free(struct inode *inode) | |||
| 42 | return; | 38 | return; |
| 43 | } | 39 | } |
| 44 | 40 | ||
| 45 | static inline int ima_path_check(struct path *path, int mask, int update_counts) | 41 | static inline int ima_file_check(struct file *file, int mask) |
| 46 | { | 42 | { |
| 47 | return 0; | 43 | return 0; |
| 48 | } | 44 | } |
| @@ -62,9 +58,5 @@ static inline void ima_counts_get(struct file *file) | |||
| 62 | return; | 58 | return; |
| 63 | } | 59 | } |
| 64 | 60 | ||
| 65 | static inline void ima_counts_put(struct path *path, int mask) | ||
| 66 | { | ||
| 67 | return; | ||
| 68 | } | ||
| 69 | #endif /* CONFIG_IMA_H */ | 61 | #endif /* CONFIG_IMA_H */ |
| 70 | #endif /* _LINUX_IMA_H */ | 62 | #endif /* _LINUX_IMA_H */ |
diff --git a/include/linux/in.h b/include/linux/in.h index cf196da04ec9..583c76f9c30f 100644 --- a/include/linux/in.h +++ b/include/linux/in.h | |||
| @@ -84,6 +84,8 @@ struct in_addr { | |||
| 84 | #define IP_ORIGDSTADDR 20 | 84 | #define IP_ORIGDSTADDR 20 |
| 85 | #define IP_RECVORIGDSTADDR IP_ORIGDSTADDR | 85 | #define IP_RECVORIGDSTADDR IP_ORIGDSTADDR |
| 86 | 86 | ||
| 87 | #define IP_MINTTL 21 | ||
| 88 | |||
| 87 | /* IP_MTU_DISCOVER values */ | 89 | /* IP_MTU_DISCOVER values */ |
| 88 | #define IP_PMTUDISC_DONT 0 /* Never send DF frames */ | 90 | #define IP_PMTUDISC_DONT 0 /* Never send DF frames */ |
| 89 | #define IP_PMTUDISC_WANT 1 /* Use per route hints */ | 91 | #define IP_PMTUDISC_WANT 1 /* Use per route hints */ |
| @@ -118,14 +120,12 @@ struct in_addr { | |||
| 118 | 120 | ||
| 119 | /* Request struct for multicast socket ops */ | 121 | /* Request struct for multicast socket ops */ |
| 120 | 122 | ||
| 121 | struct ip_mreq | 123 | struct ip_mreq { |
| 122 | { | ||
| 123 | struct in_addr imr_multiaddr; /* IP multicast address of group */ | 124 | struct in_addr imr_multiaddr; /* IP multicast address of group */ |
| 124 | struct in_addr imr_interface; /* local IP address of interface */ | 125 | struct in_addr imr_interface; /* local IP address of interface */ |
| 125 | }; | 126 | }; |
| 126 | 127 | ||
| 127 | struct ip_mreqn | 128 | struct ip_mreqn { |
| 128 | { | ||
| 129 | struct in_addr imr_multiaddr; /* IP multicast address of group */ | 129 | struct in_addr imr_multiaddr; /* IP multicast address of group */ |
| 130 | struct in_addr imr_address; /* local IP address of interface */ | 130 | struct in_addr imr_address; /* local IP address of interface */ |
| 131 | int imr_ifindex; /* Interface index */ | 131 | int imr_ifindex; /* Interface index */ |
| @@ -149,21 +149,18 @@ struct ip_msfilter { | |||
| 149 | (sizeof(struct ip_msfilter) - sizeof(__u32) \ | 149 | (sizeof(struct ip_msfilter) - sizeof(__u32) \ |
| 150 | + (numsrc) * sizeof(__u32)) | 150 | + (numsrc) * sizeof(__u32)) |
| 151 | 151 | ||
| 152 | struct group_req | 152 | struct group_req { |
| 153 | { | ||
| 154 | __u32 gr_interface; /* interface index */ | 153 | __u32 gr_interface; /* interface index */ |
| 155 | struct __kernel_sockaddr_storage gr_group; /* group address */ | 154 | struct __kernel_sockaddr_storage gr_group; /* group address */ |
| 156 | }; | 155 | }; |
| 157 | 156 | ||
| 158 | struct group_source_req | 157 | struct group_source_req { |
| 159 | { | ||
| 160 | __u32 gsr_interface; /* interface index */ | 158 | __u32 gsr_interface; /* interface index */ |
| 161 | struct __kernel_sockaddr_storage gsr_group; /* group address */ | 159 | struct __kernel_sockaddr_storage gsr_group; /* group address */ |
| 162 | struct __kernel_sockaddr_storage gsr_source; /* source address */ | 160 | struct __kernel_sockaddr_storage gsr_source; /* source address */ |
| 163 | }; | 161 | }; |
| 164 | 162 | ||
| 165 | struct group_filter | 163 | struct group_filter { |
| 166 | { | ||
| 167 | __u32 gf_interface; /* interface index */ | 164 | __u32 gf_interface; /* interface index */ |
| 168 | struct __kernel_sockaddr_storage gf_group; /* multicast address */ | 165 | struct __kernel_sockaddr_storage gf_group; /* multicast address */ |
| 169 | __u32 gf_fmode; /* filter mode */ | 166 | __u32 gf_fmode; /* filter mode */ |
| @@ -175,8 +172,7 @@ struct group_filter | |||
| 175 | (sizeof(struct group_filter) - sizeof(struct __kernel_sockaddr_storage) \ | 172 | (sizeof(struct group_filter) - sizeof(struct __kernel_sockaddr_storage) \ |
| 176 | + (numsrc) * sizeof(struct __kernel_sockaddr_storage)) | 173 | + (numsrc) * sizeof(struct __kernel_sockaddr_storage)) |
| 177 | 174 | ||
| 178 | struct in_pktinfo | 175 | struct in_pktinfo { |
| 179 | { | ||
| 180 | int ipi_ifindex; | 176 | int ipi_ifindex; |
| 181 | struct in_addr ipi_spec_dst; | 177 | struct in_addr ipi_spec_dst; |
| 182 | struct in_addr ipi_addr; | 178 | struct in_addr ipi_addr; |
diff --git a/include/linux/in6.h b/include/linux/in6.h index 718bf21c5754..bd55c6e46b2e 100644 --- a/include/linux/in6.h +++ b/include/linux/in6.h | |||
| @@ -27,10 +27,8 @@ | |||
| 27 | * IPv6 address structure | 27 | * IPv6 address structure |
| 28 | */ | 28 | */ |
| 29 | 29 | ||
| 30 | struct in6_addr | 30 | struct in6_addr { |
| 31 | { | 31 | union { |
| 32 | union | ||
| 33 | { | ||
| 34 | __u8 u6_addr8[16]; | 32 | __u8 u6_addr8[16]; |
| 35 | __be16 u6_addr16[8]; | 33 | __be16 u6_addr16[8]; |
| 36 | __be32 u6_addr32[4]; | 34 | __be32 u6_addr32[4]; |
| @@ -75,8 +73,7 @@ struct ipv6_mreq { | |||
| 75 | 73 | ||
| 76 | #define ipv6mr_acaddr ipv6mr_multiaddr | 74 | #define ipv6mr_acaddr ipv6mr_multiaddr |
| 77 | 75 | ||
| 78 | struct in6_flowlabel_req | 76 | struct in6_flowlabel_req { |
| 79 | { | ||
| 80 | struct in6_addr flr_dst; | 77 | struct in6_addr flr_dst; |
| 81 | __be32 flr_label; | 78 | __be32 flr_label; |
| 82 | __u8 flr_action; | 79 | __u8 flr_action; |
| @@ -113,7 +110,7 @@ struct in6_flowlabel_req | |||
| 113 | #define IPV6_FLOWINFO_FLOWLABEL 0x000fffff | 110 | #define IPV6_FLOWINFO_FLOWLABEL 0x000fffff |
| 114 | #define IPV6_FLOWINFO_PRIORITY 0x0ff00000 | 111 | #define IPV6_FLOWINFO_PRIORITY 0x0ff00000 |
| 115 | 112 | ||
| 116 | /* These defintions are obsolete */ | 113 | /* These definitions are obsolete */ |
| 117 | #define IPV6_PRIORITY_UNCHARACTERIZED 0x0000 | 114 | #define IPV6_PRIORITY_UNCHARACTERIZED 0x0000 |
| 118 | #define IPV6_PRIORITY_FILLER 0x0100 | 115 | #define IPV6_PRIORITY_FILLER 0x0100 |
| 119 | #define IPV6_PRIORITY_UNATTENDED 0x0200 | 116 | #define IPV6_PRIORITY_UNATTENDED 0x0200 |
diff --git a/include/linux/inetdevice.h b/include/linux/inetdevice.h index ad27c7da8798..2be1a1a2beb9 100644 --- a/include/linux/inetdevice.h +++ b/include/linux/inetdevice.h | |||
| @@ -10,15 +10,43 @@ | |||
| 10 | #include <linux/timer.h> | 10 | #include <linux/timer.h> |
| 11 | #include <linux/sysctl.h> | 11 | #include <linux/sysctl.h> |
| 12 | 12 | ||
| 13 | struct ipv4_devconf | 13 | enum |
| 14 | { | 14 | { |
| 15 | IPV4_DEVCONF_FORWARDING=1, | ||
| 16 | IPV4_DEVCONF_MC_FORWARDING, | ||
| 17 | IPV4_DEVCONF_PROXY_ARP, | ||
| 18 | IPV4_DEVCONF_ACCEPT_REDIRECTS, | ||
| 19 | IPV4_DEVCONF_SECURE_REDIRECTS, | ||
| 20 | IPV4_DEVCONF_SEND_REDIRECTS, | ||
| 21 | IPV4_DEVCONF_SHARED_MEDIA, | ||
| 22 | IPV4_DEVCONF_RP_FILTER, | ||
| 23 | IPV4_DEVCONF_ACCEPT_SOURCE_ROUTE, | ||
| 24 | IPV4_DEVCONF_BOOTP_RELAY, | ||
| 25 | IPV4_DEVCONF_LOG_MARTIANS, | ||
| 26 | IPV4_DEVCONF_TAG, | ||
| 27 | IPV4_DEVCONF_ARPFILTER, | ||
| 28 | IPV4_DEVCONF_MEDIUM_ID, | ||
| 29 | IPV4_DEVCONF_NOXFRM, | ||
| 30 | IPV4_DEVCONF_NOPOLICY, | ||
| 31 | IPV4_DEVCONF_FORCE_IGMP_VERSION, | ||
| 32 | IPV4_DEVCONF_ARP_ANNOUNCE, | ||
| 33 | IPV4_DEVCONF_ARP_IGNORE, | ||
| 34 | IPV4_DEVCONF_PROMOTE_SECONDARIES, | ||
| 35 | IPV4_DEVCONF_ARP_ACCEPT, | ||
| 36 | IPV4_DEVCONF_ARP_NOTIFY, | ||
| 37 | IPV4_DEVCONF_ACCEPT_LOCAL, | ||
| 38 | IPV4_DEVCONF_SRC_VMARK, | ||
| 39 | IPV4_DEVCONF_PROXY_ARP_PVLAN, | ||
| 40 | __IPV4_DEVCONF_MAX | ||
| 41 | }; | ||
| 42 | |||
| 43 | struct ipv4_devconf { | ||
| 15 | void *sysctl; | 44 | void *sysctl; |
| 16 | int data[__NET_IPV4_CONF_MAX - 1]; | 45 | int data[__IPV4_DEVCONF_MAX - 1]; |
| 17 | DECLARE_BITMAP(state, __NET_IPV4_CONF_MAX - 1); | 46 | DECLARE_BITMAP(state, __IPV4_DEVCONF_MAX - 1); |
| 18 | }; | 47 | }; |
| 19 | 48 | ||
| 20 | struct in_device | 49 | struct in_device { |
| 21 | { | ||
| 22 | struct net_device *dev; | 50 | struct net_device *dev; |
| 23 | atomic_t refcnt; | 51 | atomic_t refcnt; |
| 24 | int dead; | 52 | int dead; |
| @@ -42,7 +70,7 @@ struct in_device | |||
| 42 | struct rcu_head rcu_head; | 70 | struct rcu_head rcu_head; |
| 43 | }; | 71 | }; |
| 44 | 72 | ||
| 45 | #define IPV4_DEVCONF(cnf, attr) ((cnf).data[NET_IPV4_CONF_ ## attr - 1]) | 73 | #define IPV4_DEVCONF(cnf, attr) ((cnf).data[IPV4_DEVCONF_ ## attr - 1]) |
| 46 | #define IPV4_DEVCONF_ALL(net, attr) \ | 74 | #define IPV4_DEVCONF_ALL(net, attr) \ |
| 47 | IPV4_DEVCONF((*(net)->ipv4.devconf_all), attr) | 75 | IPV4_DEVCONF((*(net)->ipv4.devconf_all), attr) |
| 48 | 76 | ||
| @@ -62,13 +90,13 @@ static inline void ipv4_devconf_set(struct in_device *in_dev, int index, | |||
| 62 | 90 | ||
| 63 | static inline void ipv4_devconf_setall(struct in_device *in_dev) | 91 | static inline void ipv4_devconf_setall(struct in_device *in_dev) |
| 64 | { | 92 | { |
| 65 | bitmap_fill(in_dev->cnf.state, __NET_IPV4_CONF_MAX - 1); | 93 | bitmap_fill(in_dev->cnf.state, __IPV4_DEVCONF_MAX - 1); |
| 66 | } | 94 | } |
| 67 | 95 | ||
| 68 | #define IN_DEV_CONF_GET(in_dev, attr) \ | 96 | #define IN_DEV_CONF_GET(in_dev, attr) \ |
| 69 | ipv4_devconf_get((in_dev), NET_IPV4_CONF_ ## attr) | 97 | ipv4_devconf_get((in_dev), IPV4_DEVCONF_ ## attr) |
| 70 | #define IN_DEV_CONF_SET(in_dev, attr, val) \ | 98 | #define IN_DEV_CONF_SET(in_dev, attr, val) \ |
| 71 | ipv4_devconf_set((in_dev), NET_IPV4_CONF_ ## attr, (val)) | 99 | ipv4_devconf_set((in_dev), IPV4_DEVCONF_ ## attr, (val)) |
| 72 | 100 | ||
| 73 | #define IN_DEV_ANDCONF(in_dev, attr) \ | 101 | #define IN_DEV_ANDCONF(in_dev, attr) \ |
| 74 | (IPV4_DEVCONF_ALL(dev_net(in_dev->dev), attr) && \ | 102 | (IPV4_DEVCONF_ALL(dev_net(in_dev->dev), attr) && \ |
| @@ -83,12 +111,15 @@ static inline void ipv4_devconf_setall(struct in_device *in_dev) | |||
| 83 | #define IN_DEV_FORWARD(in_dev) IN_DEV_CONF_GET((in_dev), FORWARDING) | 111 | #define IN_DEV_FORWARD(in_dev) IN_DEV_CONF_GET((in_dev), FORWARDING) |
| 84 | #define IN_DEV_MFORWARD(in_dev) IN_DEV_ANDCONF((in_dev), MC_FORWARDING) | 112 | #define IN_DEV_MFORWARD(in_dev) IN_DEV_ANDCONF((in_dev), MC_FORWARDING) |
| 85 | #define IN_DEV_RPFILTER(in_dev) IN_DEV_MAXCONF((in_dev), RP_FILTER) | 113 | #define IN_DEV_RPFILTER(in_dev) IN_DEV_MAXCONF((in_dev), RP_FILTER) |
| 114 | #define IN_DEV_SRC_VMARK(in_dev) IN_DEV_ORCONF((in_dev), SRC_VMARK) | ||
| 86 | #define IN_DEV_SOURCE_ROUTE(in_dev) IN_DEV_ANDCONF((in_dev), \ | 115 | #define IN_DEV_SOURCE_ROUTE(in_dev) IN_DEV_ANDCONF((in_dev), \ |
| 87 | ACCEPT_SOURCE_ROUTE) | 116 | ACCEPT_SOURCE_ROUTE) |
| 117 | #define IN_DEV_ACCEPT_LOCAL(in_dev) IN_DEV_ORCONF((in_dev), ACCEPT_LOCAL) | ||
| 88 | #define IN_DEV_BOOTP_RELAY(in_dev) IN_DEV_ANDCONF((in_dev), BOOTP_RELAY) | 118 | #define IN_DEV_BOOTP_RELAY(in_dev) IN_DEV_ANDCONF((in_dev), BOOTP_RELAY) |
| 89 | 119 | ||
| 90 | #define IN_DEV_LOG_MARTIANS(in_dev) IN_DEV_ORCONF((in_dev), LOG_MARTIANS) | 120 | #define IN_DEV_LOG_MARTIANS(in_dev) IN_DEV_ORCONF((in_dev), LOG_MARTIANS) |
| 91 | #define IN_DEV_PROXY_ARP(in_dev) IN_DEV_ORCONF((in_dev), PROXY_ARP) | 121 | #define IN_DEV_PROXY_ARP(in_dev) IN_DEV_ORCONF((in_dev), PROXY_ARP) |
| 122 | #define IN_DEV_PROXY_ARP_PVLAN(in_dev) IN_DEV_CONF_GET(in_dev, PROXY_ARP_PVLAN) | ||
| 92 | #define IN_DEV_SHARED_MEDIA(in_dev) IN_DEV_ORCONF((in_dev), SHARED_MEDIA) | 123 | #define IN_DEV_SHARED_MEDIA(in_dev) IN_DEV_ORCONF((in_dev), SHARED_MEDIA) |
| 93 | #define IN_DEV_TX_REDIRECTS(in_dev) IN_DEV_ORCONF((in_dev), SEND_REDIRECTS) | 124 | #define IN_DEV_TX_REDIRECTS(in_dev) IN_DEV_ORCONF((in_dev), SEND_REDIRECTS) |
| 94 | #define IN_DEV_SEC_REDIRECTS(in_dev) IN_DEV_ORCONF((in_dev), \ | 125 | #define IN_DEV_SEC_REDIRECTS(in_dev) IN_DEV_ORCONF((in_dev), \ |
| @@ -110,8 +141,7 @@ static inline void ipv4_devconf_setall(struct in_device *in_dev) | |||
| 110 | #define IN_DEV_ARP_IGNORE(in_dev) IN_DEV_MAXCONF((in_dev), ARP_IGNORE) | 141 | #define IN_DEV_ARP_IGNORE(in_dev) IN_DEV_MAXCONF((in_dev), ARP_IGNORE) |
| 111 | #define IN_DEV_ARP_NOTIFY(in_dev) IN_DEV_MAXCONF((in_dev), ARP_NOTIFY) | 142 | #define IN_DEV_ARP_NOTIFY(in_dev) IN_DEV_MAXCONF((in_dev), ARP_NOTIFY) |
| 112 | 143 | ||
| 113 | struct in_ifaddr | 144 | struct in_ifaddr { |
| 114 | { | ||
| 115 | struct in_ifaddr *ifa_next; | 145 | struct in_ifaddr *ifa_next; |
| 116 | struct in_device *ifa_dev; | 146 | struct in_device *ifa_dev; |
| 117 | struct rcu_head rcu_head; | 147 | struct rcu_head rcu_head; |
diff --git a/include/linux/init.h b/include/linux/init.h index ff8bde520d03..ab1d31f9352b 100644 --- a/include/linux/init.h +++ b/include/linux/init.h | |||
| @@ -149,6 +149,8 @@ void prepare_namespace(void); | |||
| 149 | 149 | ||
| 150 | extern void (*late_time_init)(void); | 150 | extern void (*late_time_init)(void); |
| 151 | 151 | ||
| 152 | extern int initcall_debug; | ||
| 153 | |||
| 152 | #endif | 154 | #endif |
| 153 | 155 | ||
| 154 | #ifndef MODULE | 156 | #ifndef MODULE |
diff --git a/include/linux/init_task.h b/include/linux/init_task.h index 21a6f5d9af22..b1ed1cd8e2a8 100644 --- a/include/linux/init_task.h +++ b/include/linux/init_task.h | |||
| @@ -32,14 +32,6 @@ extern struct fs_struct init_fs; | |||
| 32 | } | 32 | } |
| 33 | 33 | ||
| 34 | extern struct nsproxy init_nsproxy; | 34 | extern struct nsproxy init_nsproxy; |
| 35 | #define INIT_NSPROXY(nsproxy) { \ | ||
| 36 | .pid_ns = &init_pid_ns, \ | ||
| 37 | .count = ATOMIC_INIT(1), \ | ||
| 38 | .uts_ns = &init_uts_ns, \ | ||
| 39 | .mnt_ns = NULL, \ | ||
| 40 | INIT_NET_NS(net_ns) \ | ||
| 41 | INIT_IPC_NS(ipc_ns) \ | ||
| 42 | } | ||
| 43 | 35 | ||
| 44 | #define INIT_SIGHAND(sighand) { \ | 36 | #define INIT_SIGHAND(sighand) { \ |
| 45 | .count = ATOMIC_INIT(1), \ | 37 | .count = ATOMIC_INIT(1), \ |
| @@ -83,16 +75,12 @@ extern struct group_info init_groups; | |||
| 83 | #define INIT_IDS | 75 | #define INIT_IDS |
| 84 | #endif | 76 | #endif |
| 85 | 77 | ||
| 86 | #ifdef CONFIG_SECURITY_FILE_CAPABILITIES | ||
| 87 | /* | 78 | /* |
| 88 | * Because of the reduced scope of CAP_SETPCAP when filesystem | 79 | * Because of the reduced scope of CAP_SETPCAP when filesystem |
| 89 | * capabilities are in effect, it is safe to allow CAP_SETPCAP to | 80 | * capabilities are in effect, it is safe to allow CAP_SETPCAP to |
| 90 | * be available in the default configuration. | 81 | * be available in the default configuration. |
| 91 | */ | 82 | */ |
| 92 | # define CAP_INIT_BSET CAP_FULL_SET | 83 | # define CAP_INIT_BSET CAP_FULL_SET |
| 93 | #else | ||
| 94 | # define CAP_INIT_BSET CAP_INIT_EFF_SET | ||
| 95 | #endif | ||
| 96 | 84 | ||
| 97 | #ifdef CONFIG_TREE_PREEMPT_RCU | 85 | #ifdef CONFIG_TREE_PREEMPT_RCU |
| 98 | #define INIT_TASK_RCU_PREEMPT(tsk) \ | 86 | #define INIT_TASK_RCU_PREEMPT(tsk) \ |
| @@ -169,7 +157,7 @@ extern struct cred init_cred; | |||
| 169 | .journal_info = NULL, \ | 157 | .journal_info = NULL, \ |
| 170 | .cpu_timers = INIT_CPU_TIMERS(tsk.cpu_timers), \ | 158 | .cpu_timers = INIT_CPU_TIMERS(tsk.cpu_timers), \ |
| 171 | .fs_excl = ATOMIC_INIT(0), \ | 159 | .fs_excl = ATOMIC_INIT(0), \ |
| 172 | .pi_lock = __SPIN_LOCK_UNLOCKED(tsk.pi_lock), \ | 160 | .pi_lock = __RAW_SPIN_LOCK_UNLOCKED(tsk.pi_lock), \ |
| 173 | .timer_slack_ns = 50000, /* 50 usec default slack */ \ | 161 | .timer_slack_ns = 50000, /* 50 usec default slack */ \ |
| 174 | .pids = { \ | 162 | .pids = { \ |
| 175 | [PIDTYPE_PID] = INIT_PID_LINK(PIDTYPE_PID), \ | 163 | [PIDTYPE_PID] = INIT_PID_LINK(PIDTYPE_PID), \ |
diff --git a/include/linux/input-polldev.h b/include/linux/input-polldev.h index 597a0077b3c5..5e3dddf8f562 100644 --- a/include/linux/input-polldev.h +++ b/include/linux/input-polldev.h | |||
| @@ -14,12 +14,19 @@ | |||
| 14 | 14 | ||
| 15 | /** | 15 | /** |
| 16 | * struct input_polled_dev - simple polled input device | 16 | * struct input_polled_dev - simple polled input device |
| 17 | * @private: private driver data | 17 | * @private: private driver data. |
| 18 | * @flush: driver-supplied method that flushes device's state upon | 18 | * @open: driver-supplied method that prepares device for polling |
| 19 | * opening (optional) | 19 | * (enabled the device and maybe flushes device state). |
| 20 | * @close: driver-supplied method that is called when device is no | ||
| 21 | * longer being polled. Used to put device into low power mode. | ||
| 20 | * @poll: driver-supplied method that polls the device and posts | 22 | * @poll: driver-supplied method that polls the device and posts |
| 21 | * input events (mandatory). | 23 | * input events (mandatory). |
| 22 | * @poll_interval: specifies how often the poll() method shoudl be called. | 24 | * @poll_interval: specifies how often the poll() method should be called. |
| 25 | * Defaults to 500 msec unless overriden when registering the device. | ||
| 26 | * @poll_interval_max: specifies upper bound for the poll interval. | ||
| 27 | * Defaults to the initial value of @poll_interval. | ||
| 28 | * @poll_interval_min: specifies lower bound for the poll interval. | ||
| 29 | * Defaults to 0. | ||
| 23 | * @input: input device structire associated with the polled device. | 30 | * @input: input device structire associated with the polled device. |
| 24 | * Must be properly initialized by the driver (id, name, phys, bits). | 31 | * Must be properly initialized by the driver (id, name, phys, bits). |
| 25 | * | 32 | * |
| @@ -30,11 +37,16 @@ | |||
| 30 | struct input_polled_dev { | 37 | struct input_polled_dev { |
| 31 | void *private; | 38 | void *private; |
| 32 | 39 | ||
| 33 | void (*flush)(struct input_polled_dev *dev); | 40 | void (*open)(struct input_polled_dev *dev); |
| 41 | void (*close)(struct input_polled_dev *dev); | ||
| 34 | void (*poll)(struct input_polled_dev *dev); | 42 | void (*poll)(struct input_polled_dev *dev); |
| 35 | unsigned int poll_interval; /* msec */ | 43 | unsigned int poll_interval; /* msec */ |
| 44 | unsigned int poll_interval_max; /* msec */ | ||
| 45 | unsigned int poll_interval_min; /* msec */ | ||
| 36 | 46 | ||
| 37 | struct input_dev *input; | 47 | struct input_dev *input; |
| 48 | |||
| 49 | /* private: */ | ||
| 38 | struct delayed_work work; | 50 | struct delayed_work work; |
| 39 | }; | 51 | }; |
| 40 | 52 | ||
diff --git a/include/linux/input.h b/include/linux/input.h index c2b1a7d244d9..7ed2251b33f1 100644 --- a/include/linux/input.h +++ b/include/linux/input.h | |||
| @@ -58,10 +58,10 @@ struct input_absinfo { | |||
| 58 | 58 | ||
| 59 | #define EVIOCGVERSION _IOR('E', 0x01, int) /* get driver version */ | 59 | #define EVIOCGVERSION _IOR('E', 0x01, int) /* get driver version */ |
| 60 | #define EVIOCGID _IOR('E', 0x02, struct input_id) /* get device ID */ | 60 | #define EVIOCGID _IOR('E', 0x02, struct input_id) /* get device ID */ |
| 61 | #define EVIOCGREP _IOR('E', 0x03, int[2]) /* get repeat settings */ | 61 | #define EVIOCGREP _IOR('E', 0x03, unsigned int[2]) /* get repeat settings */ |
| 62 | #define EVIOCSREP _IOW('E', 0x03, int[2]) /* set repeat settings */ | 62 | #define EVIOCSREP _IOW('E', 0x03, unsigned int[2]) /* set repeat settings */ |
| 63 | #define EVIOCGKEYCODE _IOR('E', 0x04, int[2]) /* get keycode */ | 63 | #define EVIOCGKEYCODE _IOR('E', 0x04, unsigned int[2]) /* get keycode */ |
| 64 | #define EVIOCSKEYCODE _IOW('E', 0x04, int[2]) /* set keycode */ | 64 | #define EVIOCSKEYCODE _IOW('E', 0x04, unsigned int[2]) /* set keycode */ |
| 65 | 65 | ||
| 66 | #define EVIOCGNAME(len) _IOC(_IOC_READ, 'E', 0x06, len) /* get device name */ | 66 | #define EVIOCGNAME(len) _IOC(_IOC_READ, 'E', 0x06, len) /* get device name */ |
| 67 | #define EVIOCGPHYS(len) _IOC(_IOC_READ, 'E', 0x07, len) /* get physical location */ | 67 | #define EVIOCGPHYS(len) _IOC(_IOC_READ, 'E', 0x07, len) /* get physical location */ |
| @@ -376,8 +376,9 @@ struct input_absinfo { | |||
| 376 | #define KEY_DISPLAY_OFF 245 /* display device to off state */ | 376 | #define KEY_DISPLAY_OFF 245 /* display device to off state */ |
| 377 | 377 | ||
| 378 | #define KEY_WIMAX 246 | 378 | #define KEY_WIMAX 246 |
| 379 | #define KEY_RFKILL 247 /* Key that controls all radios */ | ||
| 379 | 380 | ||
| 380 | /* Range 248 - 255 is reserved for special needs of AT keyboard driver */ | 381 | /* Code 255 is reserved for special needs of AT keyboard driver */ |
| 381 | 382 | ||
| 382 | #define BTN_MISC 0x100 | 383 | #define BTN_MISC 0x100 |
| 383 | #define BTN_0 0x100 | 384 | #define BTN_0 0x100 |
| @@ -595,6 +596,51 @@ struct input_absinfo { | |||
| 595 | #define KEY_NUMERIC_STAR 0x20a | 596 | #define KEY_NUMERIC_STAR 0x20a |
| 596 | #define KEY_NUMERIC_POUND 0x20b | 597 | #define KEY_NUMERIC_POUND 0x20b |
| 597 | 598 | ||
| 599 | #define KEY_CAMERA_FOCUS 0x210 | ||
| 600 | #define KEY_WPS_BUTTON 0x211 /* WiFi Protected Setup key */ | ||
| 601 | |||
| 602 | #define BTN_TRIGGER_HAPPY 0x2c0 | ||
| 603 | #define BTN_TRIGGER_HAPPY1 0x2c0 | ||
| 604 | #define BTN_TRIGGER_HAPPY2 0x2c1 | ||
| 605 | #define BTN_TRIGGER_HAPPY3 0x2c2 | ||
| 606 | #define BTN_TRIGGER_HAPPY4 0x2c3 | ||
| 607 | #define BTN_TRIGGER_HAPPY5 0x2c4 | ||
| 608 | #define BTN_TRIGGER_HAPPY6 0x2c5 | ||
| 609 | #define BTN_TRIGGER_HAPPY7 0x2c6 | ||
| 610 | #define BTN_TRIGGER_HAPPY8 0x2c7 | ||
| 611 | #define BTN_TRIGGER_HAPPY9 0x2c8 | ||
| 612 | #define BTN_TRIGGER_HAPPY10 0x2c9 | ||
| 613 | #define BTN_TRIGGER_HAPPY11 0x2ca | ||
| 614 | #define BTN_TRIGGER_HAPPY12 0x2cb | ||
| 615 | #define BTN_TRIGGER_HAPPY13 0x2cc | ||
| 616 | #define BTN_TRIGGER_HAPPY14 0x2cd | ||
| 617 | #define BTN_TRIGGER_HAPPY15 0x2ce | ||
| 618 | #define BTN_TRIGGER_HAPPY16 0x2cf | ||
| 619 | #define BTN_TRIGGER_HAPPY17 0x2d0 | ||
| 620 | #define BTN_TRIGGER_HAPPY18 0x2d1 | ||
| 621 | #define BTN_TRIGGER_HAPPY19 0x2d2 | ||
| 622 | #define BTN_TRIGGER_HAPPY20 0x2d3 | ||
| 623 | #define BTN_TRIGGER_HAPPY21 0x2d4 | ||
| 624 | #define BTN_TRIGGER_HAPPY22 0x2d5 | ||
| 625 | #define BTN_TRIGGER_HAPPY23 0x2d6 | ||
| 626 | #define BTN_TRIGGER_HAPPY24 0x2d7 | ||
| 627 | #define BTN_TRIGGER_HAPPY25 0x2d8 | ||
| 628 | #define BTN_TRIGGER_HAPPY26 0x2d9 | ||
| 629 | #define BTN_TRIGGER_HAPPY27 0x2da | ||
| 630 | #define BTN_TRIGGER_HAPPY28 0x2db | ||
| 631 | #define BTN_TRIGGER_HAPPY29 0x2dc | ||
| 632 | #define BTN_TRIGGER_HAPPY30 0x2dd | ||
| 633 | #define BTN_TRIGGER_HAPPY31 0x2de | ||
| 634 | #define BTN_TRIGGER_HAPPY32 0x2df | ||
| 635 | #define BTN_TRIGGER_HAPPY33 0x2e0 | ||
| 636 | #define BTN_TRIGGER_HAPPY34 0x2e1 | ||
| 637 | #define BTN_TRIGGER_HAPPY35 0x2e2 | ||
| 638 | #define BTN_TRIGGER_HAPPY36 0x2e3 | ||
| 639 | #define BTN_TRIGGER_HAPPY37 0x2e4 | ||
| 640 | #define BTN_TRIGGER_HAPPY38 0x2e5 | ||
| 641 | #define BTN_TRIGGER_HAPPY39 0x2e6 | ||
| 642 | #define BTN_TRIGGER_HAPPY40 0x2e7 | ||
| 643 | |||
| 598 | /* We avoid low common keys in module aliases so they don't get huge. */ | 644 | /* We avoid low common keys in module aliases so they don't get huge. */ |
| 599 | #define KEY_MIN_INTERESTING KEY_MUTE | 645 | #define KEY_MIN_INTERESTING KEY_MUTE |
| 600 | #define KEY_MAX 0x2ff | 646 | #define KEY_MAX 0x2ff |
| @@ -658,6 +704,7 @@ struct input_absinfo { | |||
| 658 | #define ABS_MT_TOOL_TYPE 0x37 /* Type of touching device */ | 704 | #define ABS_MT_TOOL_TYPE 0x37 /* Type of touching device */ |
| 659 | #define ABS_MT_BLOB_ID 0x38 /* Group a set of packets as a blob */ | 705 | #define ABS_MT_BLOB_ID 0x38 /* Group a set of packets as a blob */ |
| 660 | #define ABS_MT_TRACKING_ID 0x39 /* Unique ID of initiated contact */ | 706 | #define ABS_MT_TRACKING_ID 0x39 /* Unique ID of initiated contact */ |
| 707 | #define ABS_MT_PRESSURE 0x3a /* Pressure on contact area */ | ||
| 661 | 708 | ||
| 662 | #define ABS_MAX 0x3f | 709 | #define ABS_MAX 0x3f |
| 663 | #define ABS_CNT (ABS_MAX+1) | 710 | #define ABS_CNT (ABS_MAX+1) |
| @@ -677,6 +724,9 @@ struct input_absinfo { | |||
| 677 | #define SW_LINEOUT_INSERT 0x06 /* set = inserted */ | 724 | #define SW_LINEOUT_INSERT 0x06 /* set = inserted */ |
| 678 | #define SW_JACK_PHYSICAL_INSERT 0x07 /* set = mechanical switch set */ | 725 | #define SW_JACK_PHYSICAL_INSERT 0x07 /* set = mechanical switch set */ |
| 679 | #define SW_VIDEOOUT_INSERT 0x08 /* set = inserted */ | 726 | #define SW_VIDEOOUT_INSERT 0x08 /* set = inserted */ |
| 727 | #define SW_CAMERA_LENS_COVER 0x09 /* set = lens covered */ | ||
| 728 | #define SW_KEYPAD_SLIDE 0x0a /* set = keypad slide out */ | ||
| 729 | #define SW_FRONT_PROXIMITY 0x0b /* set = front proximity sensor active */ | ||
| 680 | #define SW_MAX 0x0f | 730 | #define SW_MAX 0x0f |
| 681 | #define SW_CNT (SW_MAX+1) | 731 | #define SW_CNT (SW_MAX+1) |
| 682 | 732 | ||
| @@ -890,7 +940,7 @@ struct ff_periodic_effect { | |||
| 890 | struct ff_envelope envelope; | 940 | struct ff_envelope envelope; |
| 891 | 941 | ||
| 892 | __u32 custom_len; | 942 | __u32 custom_len; |
| 893 | __s16 *custom_data; | 943 | __s16 __user *custom_data; |
| 894 | }; | 944 | }; |
| 895 | 945 | ||
| 896 | /** | 946 | /** |
| @@ -1016,9 +1066,12 @@ struct ff_effect { | |||
| 1016 | * @keycodesize: size of elements in keycode table | 1066 | * @keycodesize: size of elements in keycode table |
| 1017 | * @keycode: map of scancodes to keycodes for this device | 1067 | * @keycode: map of scancodes to keycodes for this device |
| 1018 | * @setkeycode: optional method to alter current keymap, used to implement | 1068 | * @setkeycode: optional method to alter current keymap, used to implement |
| 1019 | * sparse keymaps. If not supplied default mechanism will be used | 1069 | * sparse keymaps. If not supplied default mechanism will be used. |
| 1070 | * The method is being called while holding event_lock and thus must | ||
| 1071 | * not sleep | ||
| 1020 | * @getkeycode: optional method to retrieve current keymap. If not supplied | 1072 | * @getkeycode: optional method to retrieve current keymap. If not supplied |
| 1021 | * default mechanism will be used | 1073 | * default mechanism will be used. The method is being called while |
| 1074 | * holding event_lock and thus must not sleep | ||
| 1022 | * @ff: force feedback structure associated with the device if device | 1075 | * @ff: force feedback structure associated with the device if device |
| 1023 | * supports force feedback effects | 1076 | * supports force feedback effects |
| 1024 | * @repeat_key: stores key code of the last key pressed; used to implement | 1077 | * @repeat_key: stores key code of the last key pressed; used to implement |
| @@ -1035,6 +1088,7 @@ struct ff_effect { | |||
| 1035 | * @absmin: minimum values for events coming from absolute axes | 1088 | * @absmin: minimum values for events coming from absolute axes |
| 1036 | * @absfuzz: describes noisiness for axes | 1089 | * @absfuzz: describes noisiness for axes |
| 1037 | * @absflat: size of the center flat position (used by joydev) | 1090 | * @absflat: size of the center flat position (used by joydev) |
| 1091 | * @absres: resolution used for events coming form absolute axes | ||
| 1038 | * @open: this method is called when the very first user calls | 1092 | * @open: this method is called when the very first user calls |
| 1039 | * input_open_device(). The driver must prepare the device | 1093 | * input_open_device(). The driver must prepare the device |
| 1040 | * to start generating events (start polling thread, | 1094 | * to start generating events (start polling thread, |
| @@ -1088,8 +1142,10 @@ struct input_dev { | |||
| 1088 | unsigned int keycodemax; | 1142 | unsigned int keycodemax; |
| 1089 | unsigned int keycodesize; | 1143 | unsigned int keycodesize; |
| 1090 | void *keycode; | 1144 | void *keycode; |
| 1091 | int (*setkeycode)(struct input_dev *dev, int scancode, int keycode); | 1145 | int (*setkeycode)(struct input_dev *dev, |
| 1092 | int (*getkeycode)(struct input_dev *dev, int scancode, int *keycode); | 1146 | unsigned int scancode, unsigned int keycode); |
| 1147 | int (*getkeycode)(struct input_dev *dev, | ||
| 1148 | unsigned int scancode, unsigned int *keycode); | ||
| 1093 | 1149 | ||
| 1094 | struct ff_device *ff; | 1150 | struct ff_device *ff; |
| 1095 | 1151 | ||
| @@ -1189,6 +1245,10 @@ struct input_handle; | |||
| 1189 | * @event: event handler. This method is being called by input core with | 1245 | * @event: event handler. This method is being called by input core with |
| 1190 | * interrupts disabled and dev->event_lock spinlock held and so | 1246 | * interrupts disabled and dev->event_lock spinlock held and so |
| 1191 | * it may not sleep | 1247 | * it may not sleep |
| 1248 | * @filter: similar to @event; separates normal event handlers from | ||
| 1249 | * "filters". | ||
| 1250 | * @match: called after comparing device's id with handler's id_table | ||
| 1251 | * to perform fine-grained matching between device and handler | ||
| 1192 | * @connect: called when attaching a handler to an input device | 1252 | * @connect: called when attaching a handler to an input device |
| 1193 | * @disconnect: disconnects a handler from input device | 1253 | * @disconnect: disconnects a handler from input device |
| 1194 | * @start: starts handler for given handle. This function is called by | 1254 | * @start: starts handler for given handle. This function is called by |
| @@ -1200,8 +1260,6 @@ struct input_handle; | |||
| 1200 | * @name: name of the handler, to be shown in /proc/bus/input/handlers | 1260 | * @name: name of the handler, to be shown in /proc/bus/input/handlers |
| 1201 | * @id_table: pointer to a table of input_device_ids this driver can | 1261 | * @id_table: pointer to a table of input_device_ids this driver can |
| 1202 | * handle | 1262 | * handle |
| 1203 | * @blacklist: pointer to a table of input_device_ids this driver should | ||
| 1204 | * ignore even if they match @id_table | ||
| 1205 | * @h_list: list of input handles associated with the handler | 1263 | * @h_list: list of input handles associated with the handler |
| 1206 | * @node: for placing the driver onto input_handler_list | 1264 | * @node: for placing the driver onto input_handler_list |
| 1207 | * | 1265 | * |
| @@ -1210,6 +1268,11 @@ struct input_handle; | |||
| 1210 | * same time. All of them will get their copy of input event generated by | 1268 | * same time. All of them will get their copy of input event generated by |
| 1211 | * the device. | 1269 | * the device. |
| 1212 | * | 1270 | * |
| 1271 | * The very same structure is used to implement input filters. Input core | ||
| 1272 | * allows filters to run first and will not pass event to regular handlers | ||
| 1273 | * if any of the filters indicate that the event should be filtered (by | ||
| 1274 | * returning %true from their filter() method). | ||
| 1275 | * | ||
| 1213 | * Note that input core serializes calls to connect() and disconnect() | 1276 | * Note that input core serializes calls to connect() and disconnect() |
| 1214 | * methods. | 1277 | * methods. |
| 1215 | */ | 1278 | */ |
| @@ -1218,6 +1281,8 @@ struct input_handler { | |||
| 1218 | void *private; | 1281 | void *private; |
| 1219 | 1282 | ||
| 1220 | void (*event)(struct input_handle *handle, unsigned int type, unsigned int code, int value); | 1283 | void (*event)(struct input_handle *handle, unsigned int type, unsigned int code, int value); |
| 1284 | bool (*filter)(struct input_handle *handle, unsigned int type, unsigned int code, int value); | ||
| 1285 | bool (*match)(struct input_handler *handler, struct input_dev *dev); | ||
| 1221 | int (*connect)(struct input_handler *handler, struct input_dev *dev, const struct input_device_id *id); | 1286 | int (*connect)(struct input_handler *handler, struct input_dev *dev, const struct input_device_id *id); |
| 1222 | void (*disconnect)(struct input_handle *handle); | 1287 | void (*disconnect)(struct input_handle *handle); |
| 1223 | void (*start)(struct input_handle *handle); | 1288 | void (*start)(struct input_handle *handle); |
| @@ -1227,7 +1292,6 @@ struct input_handler { | |||
| 1227 | const char *name; | 1292 | const char *name; |
| 1228 | 1293 | ||
| 1229 | const struct input_device_id *id_table; | 1294 | const struct input_device_id *id_table; |
| 1230 | const struct input_device_id *blacklist; | ||
| 1231 | 1295 | ||
| 1232 | struct list_head h_list; | 1296 | struct list_head h_list; |
| 1233 | struct list_head node; | 1297 | struct list_head node; |
| @@ -1289,6 +1353,9 @@ void input_unregister_device(struct input_dev *); | |||
| 1289 | int __must_check input_register_handler(struct input_handler *); | 1353 | int __must_check input_register_handler(struct input_handler *); |
| 1290 | void input_unregister_handler(struct input_handler *); | 1354 | void input_unregister_handler(struct input_handler *); |
| 1291 | 1355 | ||
| 1356 | int input_handler_for_each_handle(struct input_handler *, void *data, | ||
| 1357 | int (*fn)(struct input_handle *, void *)); | ||
| 1358 | |||
| 1292 | int input_register_handle(struct input_handle *); | 1359 | int input_register_handle(struct input_handle *); |
| 1293 | void input_unregister_handle(struct input_handle *); | 1360 | void input_unregister_handle(struct input_handle *); |
| 1294 | 1361 | ||
| @@ -1350,8 +1417,10 @@ static inline void input_set_abs_params(struct input_dev *dev, int axis, int min | |||
| 1350 | dev->absbit[BIT_WORD(axis)] |= BIT_MASK(axis); | 1417 | dev->absbit[BIT_WORD(axis)] |= BIT_MASK(axis); |
| 1351 | } | 1418 | } |
| 1352 | 1419 | ||
| 1353 | int input_get_keycode(struct input_dev *dev, int scancode, int *keycode); | 1420 | int input_get_keycode(struct input_dev *dev, |
| 1354 | int input_set_keycode(struct input_dev *dev, int scancode, int keycode); | 1421 | unsigned int scancode, unsigned int *keycode); |
| 1422 | int input_set_keycode(struct input_dev *dev, | ||
| 1423 | unsigned int scancode, unsigned int keycode); | ||
| 1355 | 1424 | ||
| 1356 | extern struct class input_class; | 1425 | extern struct class input_class; |
| 1357 | 1426 | ||
diff --git a/include/linux/input/matrix_keypad.h b/include/linux/input/matrix_keypad.h index b3cd42d50e16..c964cd7f436a 100644 --- a/include/linux/input/matrix_keypad.h +++ b/include/linux/input/matrix_keypad.h | |||
| @@ -41,6 +41,10 @@ struct matrix_keymap_data { | |||
| 41 | * @col_scan_delay_us: delay, measured in microseconds, that is | 41 | * @col_scan_delay_us: delay, measured in microseconds, that is |
| 42 | * needed before we can keypad after activating column gpio | 42 | * needed before we can keypad after activating column gpio |
| 43 | * @debounce_ms: debounce interval in milliseconds | 43 | * @debounce_ms: debounce interval in milliseconds |
| 44 | * @active_low: gpio polarity | ||
| 45 | * @wakeup: controls whether the device should be set up as wakeup | ||
| 46 | * source | ||
| 47 | * @no_autorepeat: disable key autorepeat | ||
| 44 | * | 48 | * |
| 45 | * This structure represents platform-specific data that use used by | 49 | * This structure represents platform-specific data that use used by |
| 46 | * matrix_keypad driver to perform proper initialization. | 50 | * matrix_keypad driver to perform proper initialization. |
| @@ -61,6 +65,7 @@ struct matrix_keypad_platform_data { | |||
| 61 | 65 | ||
| 62 | bool active_low; | 66 | bool active_low; |
| 63 | bool wakeup; | 67 | bool wakeup; |
| 68 | bool no_autorepeat; | ||
| 64 | }; | 69 | }; |
| 65 | 70 | ||
| 66 | /** | 71 | /** |
diff --git a/include/linux/input/sh_keysc.h b/include/linux/input/sh_keysc.h new file mode 100644 index 000000000000..649dc7f12925 --- /dev/null +++ b/include/linux/input/sh_keysc.h | |||
| @@ -0,0 +1,15 @@ | |||
| 1 | #ifndef __SH_KEYSC_H__ | ||
| 2 | #define __SH_KEYSC_H__ | ||
| 3 | |||
| 4 | #define SH_KEYSC_MAXKEYS 49 | ||
| 5 | |||
| 6 | struct sh_keysc_info { | ||
| 7 | enum { SH_KEYSC_MODE_1, SH_KEYSC_MODE_2, SH_KEYSC_MODE_3, | ||
| 8 | SH_KEYSC_MODE_4, SH_KEYSC_MODE_5, SH_KEYSC_MODE_6 } mode; | ||
| 9 | int scan_timing; /* 0 -> 7, see KYCR1, SCN[2:0] */ | ||
| 10 | int delay; | ||
| 11 | int kycr2_delay; | ||
| 12 | int keycodes[SH_KEYSC_MAXKEYS]; /* KEYIN * KEYOUT */ | ||
| 13 | }; | ||
| 14 | |||
| 15 | #endif /* __SH_KEYSC_H__ */ | ||
diff --git a/include/linux/input/sparse-keymap.h b/include/linux/input/sparse-keymap.h new file mode 100644 index 000000000000..52db62064c6e --- /dev/null +++ b/include/linux/input/sparse-keymap.h | |||
| @@ -0,0 +1,62 @@ | |||
| 1 | #ifndef _SPARSE_KEYMAP_H | ||
| 2 | #define _SPARSE_KEYMAP_H | ||
| 3 | |||
| 4 | /* | ||
| 5 | * Copyright (c) 2009 Dmitry Torokhov | ||
| 6 | * | ||
| 7 | * This program is free software; you can redistribute it and/or modify it | ||
| 8 | * under the terms of the GNU General Public License version 2 as published by | ||
| 9 | * the Free Software Foundation. | ||
| 10 | */ | ||
| 11 | |||
| 12 | #define KE_END 0 /* Indicates end of keymap */ | ||
| 13 | #define KE_KEY 1 /* Ordinary key/button */ | ||
| 14 | #define KE_SW 2 /* Switch (predetermined value) */ | ||
| 15 | #define KE_VSW 3 /* Switch (value supplied at runtime) */ | ||
| 16 | #define KE_IGNORE 4 /* Known entry that should be ignored */ | ||
| 17 | #define KE_LAST KE_IGNORE | ||
| 18 | |||
| 19 | /** | ||
| 20 | * struct key_entry - keymap entry for use in sparse keymap | ||
| 21 | * @type: Type of the key entry (KE_KEY, KE_SW, KE_VSW, KE_END); | ||
| 22 | * drivers are allowed to extend the list with their own | ||
| 23 | * private definitions. | ||
| 24 | * @code: Device-specific data identifying the button/switch | ||
| 25 | * @keycode: KEY_* code assigned to a key/button | ||
| 26 | * @sw.code: SW_* code assigned to a switch | ||
| 27 | * @sw.value: Value that should be sent in an input even when KE_SW | ||
| 28 | * switch is toggled. KE_VSW switches ignore this field and | ||
| 29 | * expect driver to supply value for the event. | ||
| 30 | * | ||
| 31 | * This structure defines an entry in a sparse keymap used by some | ||
| 32 | * input devices for which traditional table-based approach is not | ||
| 33 | * suitable. | ||
| 34 | */ | ||
| 35 | struct key_entry { | ||
| 36 | int type; /* See KE_* above */ | ||
| 37 | u32 code; | ||
| 38 | union { | ||
| 39 | u16 keycode; /* For KE_KEY */ | ||
| 40 | struct { /* For KE_SW, KE_VSW */ | ||
| 41 | u8 code; | ||
| 42 | u8 value; /* For KE_SW, ignored by KE_VSW */ | ||
| 43 | } sw; | ||
| 44 | }; | ||
| 45 | }; | ||
| 46 | |||
| 47 | struct key_entry *sparse_keymap_entry_from_scancode(struct input_dev *dev, | ||
| 48 | unsigned int code); | ||
| 49 | struct key_entry *sparse_keymap_entry_from_keycode(struct input_dev *dev, | ||
| 50 | unsigned int code); | ||
| 51 | int sparse_keymap_setup(struct input_dev *dev, | ||
| 52 | const struct key_entry *keymap, | ||
| 53 | int (*setup)(struct input_dev *, struct key_entry *)); | ||
| 54 | void sparse_keymap_free(struct input_dev *dev); | ||
| 55 | |||
| 56 | void sparse_keymap_report_entry(struct input_dev *dev, const struct key_entry *ke, | ||
| 57 | unsigned int value, bool autorelease); | ||
| 58 | |||
| 59 | bool sparse_keymap_report_event(struct input_dev *dev, unsigned int code, | ||
| 60 | unsigned int value, bool autorelease); | ||
| 61 | |||
| 62 | #endif /* _SPARSE_KEYMAP_H */ | ||
diff --git a/include/linux/intel-iommu.h b/include/linux/intel-iommu.h index 4f0a72a9740c..9310c699a37d 100644 --- a/include/linux/intel-iommu.h +++ b/include/linux/intel-iommu.h | |||
| @@ -332,6 +332,7 @@ struct intel_iommu { | |||
| 332 | #ifdef CONFIG_INTR_REMAP | 332 | #ifdef CONFIG_INTR_REMAP |
| 333 | struct ir_table *ir_table; /* Interrupt remapping info */ | 333 | struct ir_table *ir_table; /* Interrupt remapping info */ |
| 334 | #endif | 334 | #endif |
| 335 | int node; | ||
| 335 | }; | 336 | }; |
| 336 | 337 | ||
| 337 | static inline void __iommu_flush_cache( | 338 | static inline void __iommu_flush_cache( |
diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h index 7ca72b74eec7..75f3f00ac1e5 100644 --- a/include/linux/interrupt.h +++ b/include/linux/interrupt.h | |||
| @@ -603,12 +603,6 @@ static inline void init_irq_proc(void) | |||
| 603 | } | 603 | } |
| 604 | #endif | 604 | #endif |
| 605 | 605 | ||
| 606 | #if defined(CONFIG_GENERIC_HARDIRQS) && defined(CONFIG_DEBUG_SHIRQ) | ||
| 607 | extern void debug_poll_all_shared_irqs(void); | ||
| 608 | #else | ||
| 609 | static inline void debug_poll_all_shared_irqs(void) { } | ||
| 610 | #endif | ||
| 611 | |||
| 612 | struct seq_file; | 606 | struct seq_file; |
| 613 | int show_interrupts(struct seq_file *p, void *v); | 607 | int show_interrupts(struct seq_file *p, void *v); |
| 614 | 608 | ||
diff --git a/include/linux/io-mapping.h b/include/linux/io-mapping.h index 97eb928b4924..25085ddd955f 100644 --- a/include/linux/io-mapping.h +++ b/include/linux/io-mapping.h | |||
| @@ -19,6 +19,7 @@ | |||
| 19 | #define _LINUX_IO_MAPPING_H | 19 | #define _LINUX_IO_MAPPING_H |
| 20 | 20 | ||
| 21 | #include <linux/types.h> | 21 | #include <linux/types.h> |
| 22 | #include <linux/slab.h> | ||
| 22 | #include <asm/io.h> | 23 | #include <asm/io.h> |
| 23 | #include <asm/page.h> | 24 | #include <asm/page.h> |
| 24 | #include <asm/iomap.h> | 25 | #include <asm/iomap.h> |
diff --git a/include/linux/iocontext.h b/include/linux/iocontext.h index 4da4a75c3f1e..a0bb301afac0 100644 --- a/include/linux/iocontext.h +++ b/include/linux/iocontext.h | |||
| @@ -4,32 +4,6 @@ | |||
| 4 | #include <linux/radix-tree.h> | 4 | #include <linux/radix-tree.h> |
| 5 | #include <linux/rcupdate.h> | 5 | #include <linux/rcupdate.h> |
| 6 | 6 | ||
| 7 | /* | ||
| 8 | * This is the per-process anticipatory I/O scheduler state. | ||
| 9 | */ | ||
| 10 | struct as_io_context { | ||
| 11 | spinlock_t lock; | ||
| 12 | |||
| 13 | void (*dtor)(struct as_io_context *aic); /* destructor */ | ||
| 14 | void (*exit)(struct as_io_context *aic); /* called on task exit */ | ||
| 15 | |||
| 16 | unsigned long state; | ||
| 17 | atomic_t nr_queued; /* queued reads & sync writes */ | ||
| 18 | atomic_t nr_dispatched; /* number of requests gone to the drivers */ | ||
| 19 | |||
| 20 | /* IO History tracking */ | ||
| 21 | /* Thinktime */ | ||
| 22 | unsigned long last_end_request; | ||
| 23 | unsigned long ttime_total; | ||
| 24 | unsigned long ttime_samples; | ||
| 25 | unsigned long ttime_mean; | ||
| 26 | /* Layout pattern */ | ||
| 27 | unsigned int seek_samples; | ||
| 28 | sector_t last_request_pos; | ||
| 29 | u64 seek_total; | ||
| 30 | sector_t seek_mean; | ||
| 31 | }; | ||
| 32 | |||
| 33 | struct cfq_queue; | 7 | struct cfq_queue; |
| 34 | struct cfq_io_context { | 8 | struct cfq_io_context { |
| 35 | void *key; | 9 | void *key; |
| @@ -40,16 +14,11 @@ struct cfq_io_context { | |||
| 40 | struct io_context *ioc; | 14 | struct io_context *ioc; |
| 41 | 15 | ||
| 42 | unsigned long last_end_request; | 16 | unsigned long last_end_request; |
| 43 | sector_t last_request_pos; | ||
| 44 | 17 | ||
| 45 | unsigned long ttime_total; | 18 | unsigned long ttime_total; |
| 46 | unsigned long ttime_samples; | 19 | unsigned long ttime_samples; |
| 47 | unsigned long ttime_mean; | 20 | unsigned long ttime_mean; |
| 48 | 21 | ||
| 49 | unsigned int seek_samples; | ||
| 50 | u64 seek_total; | ||
| 51 | sector_t seek_mean; | ||
| 52 | |||
| 53 | struct list_head queue_list; | 22 | struct list_head queue_list; |
| 54 | struct hlist_node cic_list; | 23 | struct hlist_node cic_list; |
| 55 | 24 | ||
| @@ -73,13 +42,16 @@ struct io_context { | |||
| 73 | unsigned short ioprio; | 42 | unsigned short ioprio; |
| 74 | unsigned short ioprio_changed; | 43 | unsigned short ioprio_changed; |
| 75 | 44 | ||
| 45 | #if defined(CONFIG_BLK_CGROUP) || defined(CONFIG_BLK_CGROUP_MODULE) | ||
| 46 | unsigned short cgroup_changed; | ||
| 47 | #endif | ||
| 48 | |||
| 76 | /* | 49 | /* |
| 77 | * For request batching | 50 | * For request batching |
| 78 | */ | 51 | */ |
| 79 | unsigned long last_waited; /* Time last woken after wait for request */ | ||
| 80 | int nr_batch_requests; /* Number of requests left in the batch */ | 52 | int nr_batch_requests; /* Number of requests left in the batch */ |
| 53 | unsigned long last_waited; /* Time last woken after wait for request */ | ||
| 81 | 54 | ||
| 82 | struct as_io_context *aic; | ||
| 83 | struct radix_tree_root radix_root; | 55 | struct radix_tree_root radix_root; |
| 84 | struct hlist_head cic_list; | 56 | struct hlist_head cic_list; |
| 85 | void *ioc_data; | 57 | void *ioc_data; |
| @@ -99,14 +71,15 @@ static inline struct io_context *ioc_task_link(struct io_context *ioc) | |||
| 99 | return NULL; | 71 | return NULL; |
| 100 | } | 72 | } |
| 101 | 73 | ||
| 74 | struct task_struct; | ||
| 102 | #ifdef CONFIG_BLOCK | 75 | #ifdef CONFIG_BLOCK |
| 103 | int put_io_context(struct io_context *ioc); | 76 | int put_io_context(struct io_context *ioc); |
| 104 | void exit_io_context(void); | 77 | void exit_io_context(struct task_struct *task); |
| 105 | struct io_context *get_io_context(gfp_t gfp_flags, int node); | 78 | struct io_context *get_io_context(gfp_t gfp_flags, int node); |
| 106 | struct io_context *alloc_io_context(gfp_t gfp_flags, int node); | 79 | struct io_context *alloc_io_context(gfp_t gfp_flags, int node); |
| 107 | void copy_io_context(struct io_context **pdst, struct io_context **psrc); | 80 | void copy_io_context(struct io_context **pdst, struct io_context **psrc); |
| 108 | #else | 81 | #else |
| 109 | static inline void exit_io_context(void) | 82 | static inline void exit_io_context(struct task_struct *task) |
| 110 | { | 83 | { |
| 111 | } | 84 | } |
| 112 | 85 | ||
diff --git a/include/linux/iommu-helper.h b/include/linux/iommu-helper.h index 3b068e5b5671..64d1b638745d 100644 --- a/include/linux/iommu-helper.h +++ b/include/linux/iommu-helper.h | |||
| @@ -14,14 +14,11 @@ static inline unsigned long iommu_device_max_index(unsigned long size, | |||
| 14 | extern int iommu_is_span_boundary(unsigned int index, unsigned int nr, | 14 | extern int iommu_is_span_boundary(unsigned int index, unsigned int nr, |
| 15 | unsigned long shift, | 15 | unsigned long shift, |
| 16 | unsigned long boundary_size); | 16 | unsigned long boundary_size); |
| 17 | extern void iommu_area_reserve(unsigned long *map, unsigned long i, int len); | ||
| 18 | extern unsigned long iommu_area_alloc(unsigned long *map, unsigned long size, | 17 | extern unsigned long iommu_area_alloc(unsigned long *map, unsigned long size, |
| 19 | unsigned long start, unsigned int nr, | 18 | unsigned long start, unsigned int nr, |
| 20 | unsigned long shift, | 19 | unsigned long shift, |
| 21 | unsigned long boundary_size, | 20 | unsigned long boundary_size, |
| 22 | unsigned long align_mask); | 21 | unsigned long align_mask); |
| 23 | extern void iommu_area_free(unsigned long *map, unsigned long start, | ||
| 24 | unsigned int nr); | ||
| 25 | 22 | ||
| 26 | extern unsigned long iommu_num_pages(unsigned long addr, unsigned long len, | 23 | extern unsigned long iommu_num_pages(unsigned long addr, unsigned long len, |
| 27 | unsigned long io_page_size); | 24 | unsigned long io_page_size); |
diff --git a/include/linux/ioport.h b/include/linux/ioport.h index 83aa81297ea3..26fad187d661 100644 --- a/include/linux/ioport.h +++ b/include/linux/ioport.h | |||
| @@ -34,22 +34,24 @@ struct resource_list { | |||
| 34 | */ | 34 | */ |
| 35 | #define IORESOURCE_BITS 0x000000ff /* Bus-specific bits */ | 35 | #define IORESOURCE_BITS 0x000000ff /* Bus-specific bits */ |
| 36 | 36 | ||
| 37 | #define IORESOURCE_TYPE_BITS 0x00000f00 /* Resource type */ | 37 | #define IORESOURCE_TYPE_BITS 0x00001f00 /* Resource type */ |
| 38 | #define IORESOURCE_IO 0x00000100 | 38 | #define IORESOURCE_IO 0x00000100 |
| 39 | #define IORESOURCE_MEM 0x00000200 | 39 | #define IORESOURCE_MEM 0x00000200 |
| 40 | #define IORESOURCE_IRQ 0x00000400 | 40 | #define IORESOURCE_IRQ 0x00000400 |
| 41 | #define IORESOURCE_DMA 0x00000800 | 41 | #define IORESOURCE_DMA 0x00000800 |
| 42 | #define IORESOURCE_BUS 0x00001000 | ||
| 42 | 43 | ||
| 43 | #define IORESOURCE_PREFETCH 0x00001000 /* No side effects */ | 44 | #define IORESOURCE_PREFETCH 0x00002000 /* No side effects */ |
| 44 | #define IORESOURCE_READONLY 0x00002000 | 45 | #define IORESOURCE_READONLY 0x00004000 |
| 45 | #define IORESOURCE_CACHEABLE 0x00004000 | 46 | #define IORESOURCE_CACHEABLE 0x00008000 |
| 46 | #define IORESOURCE_RANGELENGTH 0x00008000 | 47 | #define IORESOURCE_RANGELENGTH 0x00010000 |
| 47 | #define IORESOURCE_SHADOWABLE 0x00010000 | 48 | #define IORESOURCE_SHADOWABLE 0x00020000 |
| 48 | 49 | ||
| 49 | #define IORESOURCE_SIZEALIGN 0x00020000 /* size indicates alignment */ | 50 | #define IORESOURCE_SIZEALIGN 0x00040000 /* size indicates alignment */ |
| 50 | #define IORESOURCE_STARTALIGN 0x00040000 /* start field is alignment */ | 51 | #define IORESOURCE_STARTALIGN 0x00080000 /* start field is alignment */ |
| 51 | 52 | ||
| 52 | #define IORESOURCE_MEM_64 0x00100000 | 53 | #define IORESOURCE_MEM_64 0x00100000 |
| 54 | #define IORESOURCE_WINDOW 0x00200000 /* forwarded by bridge */ | ||
| 53 | 55 | ||
| 54 | #define IORESOURCE_EXCLUSIVE 0x08000000 /* Userland may not map this resource */ | 56 | #define IORESOURCE_EXCLUSIVE 0x08000000 /* Userland may not map this resource */ |
| 55 | #define IORESOURCE_DISABLED 0x10000000 | 57 | #define IORESOURCE_DISABLED 0x10000000 |
| @@ -110,27 +112,32 @@ struct resource_list { | |||
| 110 | extern struct resource ioport_resource; | 112 | extern struct resource ioport_resource; |
| 111 | extern struct resource iomem_resource; | 113 | extern struct resource iomem_resource; |
| 112 | 114 | ||
| 115 | extern struct resource *request_resource_conflict(struct resource *root, struct resource *new); | ||
| 113 | extern int request_resource(struct resource *root, struct resource *new); | 116 | extern int request_resource(struct resource *root, struct resource *new); |
| 114 | extern int release_resource(struct resource *new); | 117 | extern int release_resource(struct resource *new); |
| 118 | void release_child_resources(struct resource *new); | ||
| 115 | extern void reserve_region_with_split(struct resource *root, | 119 | extern void reserve_region_with_split(struct resource *root, |
| 116 | resource_size_t start, resource_size_t end, | 120 | resource_size_t start, resource_size_t end, |
| 117 | const char *name); | 121 | const char *name); |
| 122 | extern struct resource *insert_resource_conflict(struct resource *parent, struct resource *new); | ||
| 118 | extern int insert_resource(struct resource *parent, struct resource *new); | 123 | extern int insert_resource(struct resource *parent, struct resource *new); |
| 119 | extern void insert_resource_expand_to_fit(struct resource *root, struct resource *new); | 124 | extern void insert_resource_expand_to_fit(struct resource *root, struct resource *new); |
| 120 | extern int allocate_resource(struct resource *root, struct resource *new, | 125 | extern int allocate_resource(struct resource *root, struct resource *new, |
| 121 | resource_size_t size, resource_size_t min, | 126 | resource_size_t size, resource_size_t min, |
| 122 | resource_size_t max, resource_size_t align, | 127 | resource_size_t max, resource_size_t align, |
| 123 | void (*alignf)(void *, struct resource *, | 128 | resource_size_t (*alignf)(void *, |
| 124 | resource_size_t, resource_size_t), | 129 | const struct resource *, |
| 130 | resource_size_t, | ||
| 131 | resource_size_t), | ||
| 125 | void *alignf_data); | 132 | void *alignf_data); |
| 126 | int adjust_resource(struct resource *res, resource_size_t start, | 133 | int adjust_resource(struct resource *res, resource_size_t start, |
| 127 | resource_size_t size); | 134 | resource_size_t size); |
| 128 | resource_size_t resource_alignment(struct resource *res); | 135 | resource_size_t resource_alignment(struct resource *res); |
| 129 | static inline resource_size_t resource_size(struct resource *res) | 136 | static inline resource_size_t resource_size(const struct resource *res) |
| 130 | { | 137 | { |
| 131 | return res->end - res->start + 1; | 138 | return res->end - res->start + 1; |
| 132 | } | 139 | } |
| 133 | static inline unsigned long resource_type(struct resource *res) | 140 | static inline unsigned long resource_type(const struct resource *res) |
| 134 | { | 141 | { |
| 135 | return res->flags & IORESOURCE_TYPE_BITS; | 142 | return res->flags & IORESOURCE_TYPE_BITS; |
| 136 | } | 143 | } |
diff --git a/include/linux/ip_vs.h b/include/linux/ip_vs.h index 148265e63e8d..dfc170362842 100644 --- a/include/linux/ip_vs.h +++ b/include/linux/ip_vs.h | |||
| @@ -127,8 +127,7 @@ struct ip_vs_dest_user { | |||
| 127 | /* | 127 | /* |
| 128 | * IPVS statistics object (for user space) | 128 | * IPVS statistics object (for user space) |
| 129 | */ | 129 | */ |
| 130 | struct ip_vs_stats_user | 130 | struct ip_vs_stats_user { |
| 131 | { | ||
| 132 | __u32 conns; /* connections scheduled */ | 131 | __u32 conns; /* connections scheduled */ |
| 133 | __u32 inpkts; /* incoming packets */ | 132 | __u32 inpkts; /* incoming packets */ |
| 134 | __u32 outpkts; /* outgoing packets */ | 133 | __u32 outpkts; /* outgoing packets */ |
diff --git a/include/linux/ipc_namespace.h b/include/linux/ipc_namespace.h index e408722a84c7..51952989ad42 100644 --- a/include/linux/ipc_namespace.h +++ b/include/linux/ipc_namespace.h | |||
| @@ -62,11 +62,6 @@ extern struct ipc_namespace init_ipc_ns; | |||
| 62 | extern atomic_t nr_ipc_ns; | 62 | extern atomic_t nr_ipc_ns; |
| 63 | 63 | ||
| 64 | extern spinlock_t mq_lock; | 64 | extern spinlock_t mq_lock; |
| 65 | #if defined(CONFIG_POSIX_MQUEUE) || defined(CONFIG_SYSVIPC) | ||
| 66 | #define INIT_IPC_NS(ns) .ns = &init_ipc_ns, | ||
| 67 | #else | ||
| 68 | #define INIT_IPC_NS(ns) | ||
| 69 | #endif | ||
| 70 | 65 | ||
| 71 | #ifdef CONFIG_SYSVIPC | 66 | #ifdef CONFIG_SYSVIPC |
| 72 | extern int register_ipcns_notifier(struct ipc_namespace *); | 67 | extern int register_ipcns_notifier(struct ipc_namespace *); |
| @@ -87,7 +82,7 @@ extern int mq_init_ns(struct ipc_namespace *ns); | |||
| 87 | /* default values */ | 82 | /* default values */ |
| 88 | #define DFLT_QUEUESMAX 256 /* max number of message queues */ | 83 | #define DFLT_QUEUESMAX 256 /* max number of message queues */ |
| 89 | #define DFLT_MSGMAX 10 /* max number of messages in each queue */ | 84 | #define DFLT_MSGMAX 10 /* max number of messages in each queue */ |
| 90 | #define HARD_MSGMAX (131072/sizeof(void *)) | 85 | #define HARD_MSGMAX (32768*sizeof(void *)/4) |
| 91 | #define DFLT_MSGSIZEMAX 8192 /* max message size */ | 86 | #define DFLT_MSGSIZEMAX 8192 /* max message size */ |
| 92 | #else | 87 | #else |
| 93 | static inline int mq_init_ns(struct ipc_namespace *ns) { return 0; } | 88 | static inline int mq_init_ns(struct ipc_namespace *ns) { return 0; } |
diff --git a/include/linux/ipmi_smi.h b/include/linux/ipmi_smi.h index f7c9c75a2775..4b48318ac542 100644 --- a/include/linux/ipmi_smi.h +++ b/include/linux/ipmi_smi.h | |||
| @@ -39,7 +39,6 @@ | |||
| 39 | #include <linux/module.h> | 39 | #include <linux/module.h> |
| 40 | #include <linux/device.h> | 40 | #include <linux/device.h> |
| 41 | #include <linux/platform_device.h> | 41 | #include <linux/platform_device.h> |
| 42 | #include <linux/ipmi_smi.h> | ||
| 43 | 42 | ||
| 44 | /* This files describes the interface for IPMI system management interface | 43 | /* This files describes the interface for IPMI system management interface |
| 45 | drivers to bind into the IPMI message handler. */ | 44 | drivers to bind into the IPMI message handler. */ |
diff --git a/include/linux/ipv6.h b/include/linux/ipv6.h index c662efa68289..e0cc9a7db2b5 100644 --- a/include/linux/ipv6.h +++ b/include/linux/ipv6.h | |||
| @@ -167,6 +167,7 @@ struct ipv6_devconf { | |||
| 167 | #endif | 167 | #endif |
| 168 | __s32 disable_ipv6; | 168 | __s32 disable_ipv6; |
| 169 | __s32 accept_dad; | 169 | __s32 accept_dad; |
| 170 | __s32 force_tllao; | ||
| 170 | void *sysctl; | 171 | void *sysctl; |
| 171 | }; | 172 | }; |
| 172 | 173 | ||
| @@ -207,6 +208,7 @@ enum { | |||
| 207 | DEVCONF_MC_FORWARDING, | 208 | DEVCONF_MC_FORWARDING, |
| 208 | DEVCONF_DISABLE_IPV6, | 209 | DEVCONF_DISABLE_IPV6, |
| 209 | DEVCONF_ACCEPT_DAD, | 210 | DEVCONF_ACCEPT_DAD, |
| 211 | DEVCONF_FORCE_TLLAO, | ||
| 210 | DEVCONF_MAX | 212 | DEVCONF_MAX |
| 211 | }; | 213 | }; |
| 212 | 214 | ||
| @@ -503,7 +505,7 @@ static inline struct raw6_sock *raw6_sk(const struct sock *sk) | |||
| 503 | 505 | ||
| 504 | #define INET6_MATCH(__sk, __net, __hash, __saddr, __daddr, __ports, __dif)\ | 506 | #define INET6_MATCH(__sk, __net, __hash, __saddr, __daddr, __ports, __dif)\ |
| 505 | (((__sk)->sk_hash == (__hash)) && sock_net((__sk)) == (__net) && \ | 507 | (((__sk)->sk_hash == (__hash)) && sock_net((__sk)) == (__net) && \ |
| 506 | ((*((__portpair *)&(inet_sk(__sk)->dport))) == (__ports)) && \ | 508 | ((*((__portpair *)&(inet_sk(__sk)->inet_dport))) == (__ports)) && \ |
| 507 | ((__sk)->sk_family == AF_INET6) && \ | 509 | ((__sk)->sk_family == AF_INET6) && \ |
| 508 | ipv6_addr_equal(&inet6_sk(__sk)->daddr, (__saddr)) && \ | 510 | ipv6_addr_equal(&inet6_sk(__sk)->daddr, (__saddr)) && \ |
| 509 | ipv6_addr_equal(&inet6_sk(__sk)->rcv_saddr, (__daddr)) && \ | 511 | ipv6_addr_equal(&inet6_sk(__sk)->rcv_saddr, (__daddr)) && \ |
diff --git a/include/linux/irq.h b/include/linux/irq.h index ae9653dbcd78..707ab122e2e6 100644 --- a/include/linux/irq.h +++ b/include/linux/irq.h | |||
| @@ -90,7 +90,7 @@ struct msi_desc; | |||
| 90 | * @startup: start up the interrupt (defaults to ->enable if NULL) | 90 | * @startup: start up the interrupt (defaults to ->enable if NULL) |
| 91 | * @shutdown: shut down the interrupt (defaults to ->disable if NULL) | 91 | * @shutdown: shut down the interrupt (defaults to ->disable if NULL) |
| 92 | * @enable: enable the interrupt (defaults to chip->unmask if NULL) | 92 | * @enable: enable the interrupt (defaults to chip->unmask if NULL) |
| 93 | * @disable: disable the interrupt (defaults to chip->mask if NULL) | 93 | * @disable: disable the interrupt |
| 94 | * @ack: start of a new interrupt | 94 | * @ack: start of a new interrupt |
| 95 | * @mask: mask an interrupt source | 95 | * @mask: mask an interrupt source |
| 96 | * @mask_ack: ack and mask an interrupt source | 96 | * @mask_ack: ack and mask an interrupt source |
| @@ -192,7 +192,7 @@ struct irq_desc { | |||
| 192 | unsigned int irq_count; /* For detecting broken IRQs */ | 192 | unsigned int irq_count; /* For detecting broken IRQs */ |
| 193 | unsigned long last_unhandled; /* Aging timer for unhandled count */ | 193 | unsigned long last_unhandled; /* Aging timer for unhandled count */ |
| 194 | unsigned int irqs_unhandled; | 194 | unsigned int irqs_unhandled; |
| 195 | spinlock_t lock; | 195 | raw_spinlock_t lock; |
| 196 | #ifdef CONFIG_SMP | 196 | #ifdef CONFIG_SMP |
| 197 | cpumask_var_t affinity; | 197 | cpumask_var_t affinity; |
| 198 | unsigned int node; | 198 | unsigned int node; |
| @@ -282,7 +282,7 @@ extern irqreturn_t handle_IRQ_event(unsigned int irq, struct irqaction *action); | |||
| 282 | 282 | ||
| 283 | /* | 283 | /* |
| 284 | * Built-in IRQ handlers for various IRQ types, | 284 | * Built-in IRQ handlers for various IRQ types, |
| 285 | * callable via desc->chip->handle_irq() | 285 | * callable via desc->handle_irq() |
| 286 | */ | 286 | */ |
| 287 | extern void handle_level_irq(unsigned int irq, struct irq_desc *desc); | 287 | extern void handle_level_irq(unsigned int irq, struct irq_desc *desc); |
| 288 | extern void handle_fasteoi_irq(unsigned int irq, struct irq_desc *desc); | 288 | extern void handle_fasteoi_irq(unsigned int irq, struct irq_desc *desc); |
| @@ -400,7 +400,9 @@ static inline int irq_has_action(unsigned int irq) | |||
| 400 | 400 | ||
| 401 | /* Dynamic irq helper functions */ | 401 | /* Dynamic irq helper functions */ |
| 402 | extern void dynamic_irq_init(unsigned int irq); | 402 | extern void dynamic_irq_init(unsigned int irq); |
| 403 | void dynamic_irq_init_keep_chip_data(unsigned int irq); | ||
| 403 | extern void dynamic_irq_cleanup(unsigned int irq); | 404 | extern void dynamic_irq_cleanup(unsigned int irq); |
| 405 | void dynamic_irq_cleanup_keep_chip_data(unsigned int irq); | ||
| 404 | 406 | ||
| 405 | /* Set/get chip/data for an IRQ: */ | 407 | /* Set/get chip/data for an IRQ: */ |
| 406 | extern int set_irq_chip(unsigned int irq, struct irq_chip *chip); | 408 | extern int set_irq_chip(unsigned int irq, struct irq_chip *chip); |
diff --git a/include/linux/irqflags.h b/include/linux/irqflags.h index b02a3f1d46a0..006bf45eae30 100644 --- a/include/linux/irqflags.h +++ b/include/linux/irqflags.h | |||
| @@ -124,6 +124,6 @@ | |||
| 124 | typecheck(unsigned long, flags); \ | 124 | typecheck(unsigned long, flags); \ |
| 125 | raw_irqs_disabled_flags(flags); \ | 125 | raw_irqs_disabled_flags(flags); \ |
| 126 | }) | 126 | }) |
| 127 | #endif /* CONFIG_X86 */ | 127 | #endif /* CONFIG_TRACE_IRQFLAGS_SUPPORT */ |
| 128 | 128 | ||
| 129 | #endif | 129 | #endif |
diff --git a/include/linux/iscsi_ibft.h b/include/linux/iscsi_ibft.h index 6092487e2950..d2e4042f8f5e 100644 --- a/include/linux/iscsi_ibft.h +++ b/include/linux/iscsi_ibft.h | |||
| @@ -42,9 +42,13 @@ extern struct ibft_table_header *ibft_addr; | |||
| 42 | * mapped address is set in the ibft_addr variable. | 42 | * mapped address is set in the ibft_addr variable. |
| 43 | */ | 43 | */ |
| 44 | #ifdef CONFIG_ISCSI_IBFT_FIND | 44 | #ifdef CONFIG_ISCSI_IBFT_FIND |
| 45 | extern void __init reserve_ibft_region(void); | 45 | unsigned long find_ibft_region(unsigned long *sizep); |
| 46 | #else | 46 | #else |
| 47 | static inline void reserve_ibft_region(void) { } | 47 | static inline unsigned long find_ibft_region(unsigned long *sizep) |
| 48 | { | ||
| 49 | *sizep = 0; | ||
| 50 | return 0; | ||
| 51 | } | ||
| 48 | #endif | 52 | #endif |
| 49 | 53 | ||
| 50 | #endif /* ISCSI_IBFT_H */ | 54 | #endif /* ISCSI_IBFT_H */ |
diff --git a/include/linux/isdn/capilli.h b/include/linux/isdn/capilli.h index 7acb87a44872..11b57c485854 100644 --- a/include/linux/isdn/capilli.h +++ b/include/linux/isdn/capilli.h | |||
| @@ -50,8 +50,7 @@ struct capi_ctr { | |||
| 50 | u16 (*send_message)(struct capi_ctr *, struct sk_buff *skb); | 50 | u16 (*send_message)(struct capi_ctr *, struct sk_buff *skb); |
| 51 | 51 | ||
| 52 | char *(*procinfo)(struct capi_ctr *); | 52 | char *(*procinfo)(struct capi_ctr *); |
| 53 | int (*ctr_read_proc)(char *page, char **start, off_t off, | 53 | const struct file_operations *proc_fops; |
| 54 | int count, int *eof, struct capi_ctr *card); | ||
| 55 | 54 | ||
| 56 | /* filled in before calling ready callback */ | 55 | /* filled in before calling ready callback */ |
| 57 | u8 manu[CAPI_MANUFACTURER_LEN]; /* CAPI_GET_MANUFACTURER */ | 56 | u8 manu[CAPI_MANUFACTURER_LEN]; /* CAPI_GET_MANUFACTURER */ |
| @@ -67,9 +66,10 @@ struct capi_ctr { | |||
| 67 | unsigned long nsentdatapkt; | 66 | unsigned long nsentdatapkt; |
| 68 | 67 | ||
| 69 | int cnr; /* controller number */ | 68 | int cnr; /* controller number */ |
| 70 | volatile unsigned short cardstate; /* controller state */ | 69 | unsigned short state; /* controller state */ |
| 71 | volatile int blocked; /* output blocked */ | 70 | int blocked; /* output blocked */ |
| 72 | int traceflag; /* capi trace */ | 71 | int traceflag; /* capi trace */ |
| 72 | wait_queue_head_t state_wait_queue; | ||
| 73 | 73 | ||
| 74 | struct proc_dir_entry *procent; | 74 | struct proc_dir_entry *procent; |
| 75 | char procfn[128]; | 75 | char procfn[128]; |
diff --git a/include/linux/isicom.h b/include/linux/isicom.h index bbd42197298f..b92e05650639 100644 --- a/include/linux/isicom.h +++ b/include/linux/isicom.h | |||
| @@ -67,6 +67,7 @@ | |||
| 67 | 67 | ||
| 68 | #define FIRMWARE_LOADED 0x0001 | 68 | #define FIRMWARE_LOADED 0x0001 |
| 69 | #define BOARD_ACTIVE 0x0002 | 69 | #define BOARD_ACTIVE 0x0002 |
| 70 | #define BOARD_INIT 0x0004 | ||
| 70 | 71 | ||
| 71 | /* isi_port status bitmap */ | 72 | /* isi_port status bitmap */ |
| 72 | 73 | ||
diff --git a/include/linux/jbd.h b/include/linux/jbd.h index 331530cd3cc6..516a2a27e87a 100644 --- a/include/linux/jbd.h +++ b/include/linux/jbd.h | |||
| @@ -31,6 +31,7 @@ | |||
| 31 | #include <linux/mutex.h> | 31 | #include <linux/mutex.h> |
| 32 | #include <linux/timer.h> | 32 | #include <linux/timer.h> |
| 33 | #include <linux/lockdep.h> | 33 | #include <linux/lockdep.h> |
| 34 | #include <linux/slab.h> | ||
| 34 | 35 | ||
| 35 | #define journal_oom_retry 1 | 36 | #define journal_oom_retry 1 |
| 36 | 37 | ||
| @@ -246,19 +247,8 @@ typedef struct journal_superblock_s | |||
| 246 | 247 | ||
| 247 | #define J_ASSERT(assert) BUG_ON(!(assert)) | 248 | #define J_ASSERT(assert) BUG_ON(!(assert)) |
| 248 | 249 | ||
| 249 | #if defined(CONFIG_BUFFER_DEBUG) | ||
| 250 | void buffer_assertion_failure(struct buffer_head *bh); | ||
| 251 | #define J_ASSERT_BH(bh, expr) \ | ||
| 252 | do { \ | ||
| 253 | if (!(expr)) \ | ||
| 254 | buffer_assertion_failure(bh); \ | ||
| 255 | J_ASSERT(expr); \ | ||
| 256 | } while (0) | ||
| 257 | #define J_ASSERT_JH(jh, expr) J_ASSERT_BH(jh2bh(jh), expr) | ||
| 258 | #else | ||
| 259 | #define J_ASSERT_BH(bh, expr) J_ASSERT(expr) | 250 | #define J_ASSERT_BH(bh, expr) J_ASSERT(expr) |
| 260 | #define J_ASSERT_JH(jh, expr) J_ASSERT(expr) | 251 | #define J_ASSERT_JH(jh, expr) J_ASSERT(expr) |
| 261 | #endif | ||
| 262 | 252 | ||
| 263 | #if defined(JBD_PARANOID_IOFAIL) | 253 | #if defined(JBD_PARANOID_IOFAIL) |
| 264 | #define J_EXPECT(expr, why...) J_ASSERT(expr) | 254 | #define J_EXPECT(expr, why...) J_ASSERT(expr) |
diff --git a/include/linux/jbd2.h b/include/linux/jbd2.h index f1011f7f3d41..a4d2e9f7088a 100644 --- a/include/linux/jbd2.h +++ b/include/linux/jbd2.h | |||
| @@ -30,6 +30,7 @@ | |||
| 30 | #include <linux/bit_spinlock.h> | 30 | #include <linux/bit_spinlock.h> |
| 31 | #include <linux/mutex.h> | 31 | #include <linux/mutex.h> |
| 32 | #include <linux/timer.h> | 32 | #include <linux/timer.h> |
| 33 | #include <linux/slab.h> | ||
| 33 | #endif | 34 | #endif |
| 34 | 35 | ||
| 35 | #define journal_oom_retry 1 | 36 | #define journal_oom_retry 1 |
| @@ -69,15 +70,8 @@ extern u8 jbd2_journal_enable_debug; | |||
| 69 | #define jbd_debug(f, a...) /**/ | 70 | #define jbd_debug(f, a...) /**/ |
| 70 | #endif | 71 | #endif |
| 71 | 72 | ||
| 72 | static inline void *jbd2_alloc(size_t size, gfp_t flags) | 73 | extern void *jbd2_alloc(size_t size, gfp_t flags); |
| 73 | { | 74 | extern void jbd2_free(void *ptr, size_t size); |
| 74 | return (void *)__get_free_pages(flags, get_order(size)); | ||
| 75 | } | ||
| 76 | |||
| 77 | static inline void jbd2_free(void *ptr, size_t size) | ||
| 78 | { | ||
| 79 | free_pages((unsigned long)ptr, get_order(size)); | ||
| 80 | }; | ||
| 81 | 75 | ||
| 82 | #define JBD2_MIN_JOURNAL_BLOCKS 1024 | 76 | #define JBD2_MIN_JOURNAL_BLOCKS 1024 |
| 83 | 77 | ||
| @@ -284,19 +278,8 @@ typedef struct journal_superblock_s | |||
| 284 | 278 | ||
| 285 | #define J_ASSERT(assert) BUG_ON(!(assert)) | 279 | #define J_ASSERT(assert) BUG_ON(!(assert)) |
| 286 | 280 | ||
| 287 | #if defined(CONFIG_BUFFER_DEBUG) | ||
| 288 | void buffer_assertion_failure(struct buffer_head *bh); | ||
| 289 | #define J_ASSERT_BH(bh, expr) \ | ||
| 290 | do { \ | ||
| 291 | if (!(expr)) \ | ||
| 292 | buffer_assertion_failure(bh); \ | ||
| 293 | J_ASSERT(expr); \ | ||
| 294 | } while (0) | ||
| 295 | #define J_ASSERT_JH(jh, expr) J_ASSERT_BH(jh2bh(jh), expr) | ||
| 296 | #else | ||
| 297 | #define J_ASSERT_BH(bh, expr) J_ASSERT(expr) | 281 | #define J_ASSERT_BH(bh, expr) J_ASSERT(expr) |
| 298 | #define J_ASSERT_JH(jh, expr) J_ASSERT(expr) | 282 | #define J_ASSERT_JH(jh, expr) J_ASSERT(expr) |
| 299 | #endif | ||
| 300 | 283 | ||
| 301 | #if defined(JBD2_PARANOID_IOFAIL) | 284 | #if defined(JBD2_PARANOID_IOFAIL) |
| 302 | #define J_EXPECT(expr, why...) J_ASSERT(expr) | 285 | #define J_EXPECT(expr, why...) J_ASSERT(expr) |
| @@ -653,6 +636,7 @@ struct transaction_s | |||
| 653 | * waiting for it to finish. | 636 | * waiting for it to finish. |
| 654 | */ | 637 | */ |
| 655 | unsigned int t_synchronous_commit:1; | 638 | unsigned int t_synchronous_commit:1; |
| 639 | unsigned int t_flushed_data_blocks:1; | ||
| 656 | 640 | ||
| 657 | /* | 641 | /* |
| 658 | * For use by the filesystem to store fs-specific data | 642 | * For use by the filesystem to store fs-specific data |
diff --git a/include/linux/jiffies.h b/include/linux/jiffies.h index 1a9cf78bfce5..6811f4bfc6e7 100644 --- a/include/linux/jiffies.h +++ b/include/linux/jiffies.h | |||
| @@ -307,6 +307,7 @@ extern clock_t jiffies_to_clock_t(long x); | |||
| 307 | extern unsigned long clock_t_to_jiffies(unsigned long x); | 307 | extern unsigned long clock_t_to_jiffies(unsigned long x); |
| 308 | extern u64 jiffies_64_to_clock_t(u64 x); | 308 | extern u64 jiffies_64_to_clock_t(u64 x); |
| 309 | extern u64 nsec_to_clock_t(u64 x); | 309 | extern u64 nsec_to_clock_t(u64 x); |
| 310 | extern unsigned long nsecs_to_jiffies(u64 n); | ||
| 310 | 311 | ||
| 311 | #define TIMESTAMP_SIZE 30 | 312 | #define TIMESTAMP_SIZE 30 |
| 312 | 313 | ||
diff --git a/include/linux/kallsyms.h b/include/linux/kallsyms.h index 792274269f2b..d8e9b3d1c23c 100644 --- a/include/linux/kallsyms.h +++ b/include/linux/kallsyms.h | |||
| @@ -107,18 +107,6 @@ static inline void print_symbol(const char *fmt, unsigned long addr) | |||
| 107 | __builtin_extract_return_addr((void *)addr)); | 107 | __builtin_extract_return_addr((void *)addr)); |
| 108 | } | 108 | } |
| 109 | 109 | ||
| 110 | /* | ||
| 111 | * Pretty-print a function pointer. This function is deprecated. | ||
| 112 | * Please use the "%pF" vsprintf format instead. | ||
| 113 | */ | ||
| 114 | static inline void __deprecated print_fn_descriptor_symbol(const char *fmt, void *addr) | ||
| 115 | { | ||
| 116 | #if defined(CONFIG_IA64) || defined(CONFIG_PPC64) | ||
| 117 | addr = *(void **)addr; | ||
| 118 | #endif | ||
| 119 | print_symbol(fmt, (unsigned long)addr); | ||
| 120 | } | ||
| 121 | |||
| 122 | static inline void print_ip_sym(unsigned long ip) | 110 | static inline void print_ip_sym(unsigned long ip) |
| 123 | { | 111 | { |
| 124 | printk("[<%p>] %pS\n", (void *) ip, (void *) ip); | 112 | printk("[<%p>] %pS\n", (void *) ip, (void *) ip); |
diff --git a/include/linux/kbd_kern.h b/include/linux/kbd_kern.h index 8bdb16bfe5fb..506ad20c18f8 100644 --- a/include/linux/kbd_kern.h +++ b/include/linux/kbd_kern.h | |||
| @@ -161,7 +161,4 @@ static inline void con_schedule_flip(struct tty_struct *t) | |||
| 161 | schedule_delayed_work(&t->buf.work, 0); | 161 | schedule_delayed_work(&t->buf.work, 0); |
| 162 | } | 162 | } |
| 163 | 163 | ||
| 164 | /* mac_hid.c */ | ||
| 165 | extern int mac_hid_mouse_emulate_buttons(int, unsigned int, int); | ||
| 166 | |||
| 167 | #endif | 164 | #endif |
diff --git a/include/linux/kernel-page-flags.h b/include/linux/kernel-page-flags.h new file mode 100644 index 000000000000..bd92a89f4b0a --- /dev/null +++ b/include/linux/kernel-page-flags.h | |||
| @@ -0,0 +1,46 @@ | |||
| 1 | #ifndef LINUX_KERNEL_PAGE_FLAGS_H | ||
| 2 | #define LINUX_KERNEL_PAGE_FLAGS_H | ||
| 3 | |||
| 4 | /* | ||
| 5 | * Stable page flag bits exported to user space | ||
| 6 | */ | ||
| 7 | |||
| 8 | #define KPF_LOCKED 0 | ||
| 9 | #define KPF_ERROR 1 | ||
| 10 | #define KPF_REFERENCED 2 | ||
| 11 | #define KPF_UPTODATE 3 | ||
| 12 | #define KPF_DIRTY 4 | ||
| 13 | #define KPF_LRU 5 | ||
| 14 | #define KPF_ACTIVE 6 | ||
| 15 | #define KPF_SLAB 7 | ||
| 16 | #define KPF_WRITEBACK 8 | ||
| 17 | #define KPF_RECLAIM 9 | ||
| 18 | #define KPF_BUDDY 10 | ||
| 19 | |||
| 20 | /* 11-20: new additions in 2.6.31 */ | ||
| 21 | #define KPF_MMAP 11 | ||
| 22 | #define KPF_ANON 12 | ||
| 23 | #define KPF_SWAPCACHE 13 | ||
| 24 | #define KPF_SWAPBACKED 14 | ||
| 25 | #define KPF_COMPOUND_HEAD 15 | ||
| 26 | #define KPF_COMPOUND_TAIL 16 | ||
| 27 | #define KPF_HUGE 17 | ||
| 28 | #define KPF_UNEVICTABLE 18 | ||
| 29 | #define KPF_HWPOISON 19 | ||
| 30 | #define KPF_NOPAGE 20 | ||
| 31 | |||
| 32 | #define KPF_KSM 21 | ||
| 33 | |||
| 34 | /* kernel hacking assistances | ||
| 35 | * WARNING: subject to change, never rely on them! | ||
| 36 | */ | ||
| 37 | #define KPF_RESERVED 32 | ||
| 38 | #define KPF_MLOCKED 33 | ||
| 39 | #define KPF_MAPPEDTODISK 34 | ||
| 40 | #define KPF_PRIVATE 35 | ||
| 41 | #define KPF_PRIVATE_2 36 | ||
| 42 | #define KPF_OWNER_PRIVATE 37 | ||
| 43 | #define KPF_ARCH 38 | ||
| 44 | #define KPF_UNCACHED 39 | ||
| 45 | |||
| 46 | #endif /* LINUX_KERNEL_PAGE_FLAGS_H */ | ||
diff --git a/include/linux/kernel.h b/include/linux/kernel.h index f4e3184fa054..9365227dbaf6 100644 --- a/include/linux/kernel.h +++ b/include/linux/kernel.h | |||
| @@ -15,7 +15,6 @@ | |||
| 15 | #include <linux/bitops.h> | 15 | #include <linux/bitops.h> |
| 16 | #include <linux/log2.h> | 16 | #include <linux/log2.h> |
| 17 | #include <linux/typecheck.h> | 17 | #include <linux/typecheck.h> |
| 18 | #include <linux/ratelimit.h> | ||
| 19 | #include <linux/dynamic_debug.h> | 18 | #include <linux/dynamic_debug.h> |
| 20 | #include <asm/byteorder.h> | 19 | #include <asm/byteorder.h> |
| 21 | #include <asm/bug.h> | 20 | #include <asm/bug.h> |
| @@ -45,6 +44,16 @@ extern const char linux_proc_banner[]; | |||
| 45 | 44 | ||
| 46 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr)) | 45 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr)) |
| 47 | 46 | ||
| 47 | /* | ||
| 48 | * This looks more complex than it should be. But we need to | ||
| 49 | * get the type for the ~ right in round_down (it needs to be | ||
| 50 | * as wide as the result!), and we want to evaluate the macro | ||
| 51 | * arguments just once each. | ||
| 52 | */ | ||
| 53 | #define __round_mask(x, y) ((__typeof__(x))((y)-1)) | ||
| 54 | #define round_up(x, y) ((((x)-1) | __round_mask(x, y))+1) | ||
| 55 | #define round_down(x, y) ((x) & ~__round_mask(x, y)) | ||
| 56 | |||
| 48 | #define FIELD_SIZEOF(t, f) (sizeof(((t*)0)->f)) | 57 | #define FIELD_SIZEOF(t, f) (sizeof(((t*)0)->f)) |
| 49 | #define DIV_ROUND_UP(n,d) (((n) + (d) - 1) / (d)) | 58 | #define DIV_ROUND_UP(n,d) (((n) + (d) - 1) / (d)) |
| 50 | #define roundup(x, y) ((((x) + ((y) - 1)) / (y)) * (y)) | 59 | #define roundup(x, y) ((((x) + ((y) - 1)) / (y)) * (y)) |
| @@ -125,7 +134,7 @@ extern int _cond_resched(void); | |||
| 125 | #endif | 134 | #endif |
| 126 | 135 | ||
| 127 | #ifdef CONFIG_DEBUG_SPINLOCK_SLEEP | 136 | #ifdef CONFIG_DEBUG_SPINLOCK_SLEEP |
| 128 | void __might_sleep(char *file, int line, int preempt_offset); | 137 | void __might_sleep(const char *file, int line, int preempt_offset); |
| 129 | /** | 138 | /** |
| 130 | * might_sleep - annotation for functions that can sleep | 139 | * might_sleep - annotation for functions that can sleep |
| 131 | * | 140 | * |
| @@ -139,7 +148,8 @@ extern int _cond_resched(void); | |||
| 139 | # define might_sleep() \ | 148 | # define might_sleep() \ |
| 140 | do { __might_sleep(__FILE__, __LINE__, 0); might_resched(); } while (0) | 149 | do { __might_sleep(__FILE__, __LINE__, 0); might_resched(); } while (0) |
| 141 | #else | 150 | #else |
| 142 | static inline void __might_sleep(char *file, int line, int preempt_offset) { } | 151 | static inline void __might_sleep(const char *file, int line, |
| 152 | int preempt_offset) { } | ||
| 143 | # define might_sleep() do { might_resched(); } while (0) | 153 | # define might_sleep() do { might_resched(); } while (0) |
| 144 | #endif | 154 | #endif |
| 145 | 155 | ||
| @@ -241,8 +251,8 @@ asmlinkage int vprintk(const char *fmt, va_list args) | |||
| 241 | asmlinkage int printk(const char * fmt, ...) | 251 | asmlinkage int printk(const char * fmt, ...) |
| 242 | __attribute__ ((format (printf, 1, 2))) __cold; | 252 | __attribute__ ((format (printf, 1, 2))) __cold; |
| 243 | 253 | ||
| 244 | extern struct ratelimit_state printk_ratelimit_state; | 254 | extern int __printk_ratelimit(const char *func); |
| 245 | extern int printk_ratelimit(void); | 255 | #define printk_ratelimit() __printk_ratelimit(__func__) |
| 246 | extern bool printk_timed_ratelimit(unsigned long *caller_jiffies, | 256 | extern bool printk_timed_ratelimit(unsigned long *caller_jiffies, |
| 247 | unsigned int interval_msec); | 257 | unsigned int interval_msec); |
| 248 | 258 | ||
| @@ -252,10 +262,10 @@ extern int printk_delay_msec; | |||
| 252 | * Print a one-time message (analogous to WARN_ONCE() et al): | 262 | * Print a one-time message (analogous to WARN_ONCE() et al): |
| 253 | */ | 263 | */ |
| 254 | #define printk_once(x...) ({ \ | 264 | #define printk_once(x...) ({ \ |
| 255 | static bool __print_once = true; \ | 265 | static bool __print_once; \ |
| 256 | \ | 266 | \ |
| 257 | if (__print_once) { \ | 267 | if (!__print_once) { \ |
| 258 | __print_once = false; \ | 268 | __print_once = true; \ |
| 259 | printk(x); \ | 269 | printk(x); \ |
| 260 | } \ | 270 | } \ |
| 261 | }) | 271 | }) |
| @@ -398,15 +408,58 @@ static inline char *pack_hex_byte(char *buf, u8 byte) | |||
| 398 | printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__) | 408 | printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__) |
| 399 | #elif defined(CONFIG_DYNAMIC_DEBUG) | 409 | #elif defined(CONFIG_DYNAMIC_DEBUG) |
| 400 | /* dynamic_pr_debug() uses pr_fmt() internally so we don't need it here */ | 410 | /* dynamic_pr_debug() uses pr_fmt() internally so we don't need it here */ |
| 401 | #define pr_debug(fmt, ...) do { \ | 411 | #define pr_debug(fmt, ...) \ |
| 402 | dynamic_pr_debug(fmt, ##__VA_ARGS__); \ | 412 | dynamic_pr_debug(fmt, ##__VA_ARGS__) |
| 403 | } while (0) | ||
| 404 | #else | 413 | #else |
| 405 | #define pr_debug(fmt, ...) \ | 414 | #define pr_debug(fmt, ...) \ |
| 406 | ({ if (0) printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__); 0; }) | 415 | ({ if (0) printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__); 0; }) |
| 407 | #endif | 416 | #endif |
| 408 | 417 | ||
| 409 | /* | 418 | /* |
| 419 | * ratelimited messages with local ratelimit_state, | ||
| 420 | * no local ratelimit_state used in the !PRINTK case | ||
| 421 | */ | ||
| 422 | #ifdef CONFIG_PRINTK | ||
| 423 | #define printk_ratelimited(fmt, ...) ({ \ | ||
| 424 | static struct ratelimit_state _rs = { \ | ||
| 425 | .interval = DEFAULT_RATELIMIT_INTERVAL, \ | ||
| 426 | .burst = DEFAULT_RATELIMIT_BURST, \ | ||
| 427 | }; \ | ||
| 428 | \ | ||
| 429 | if (__ratelimit(&_rs)) \ | ||
| 430 | printk(fmt, ##__VA_ARGS__); \ | ||
| 431 | }) | ||
| 432 | #else | ||
| 433 | /* No effect, but we still get type checking even in the !PRINTK case: */ | ||
| 434 | #define printk_ratelimited printk | ||
| 435 | #endif | ||
| 436 | |||
| 437 | #define pr_emerg_ratelimited(fmt, ...) \ | ||
| 438 | printk_ratelimited(KERN_EMERG pr_fmt(fmt), ##__VA_ARGS__) | ||
| 439 | #define pr_alert_ratelimited(fmt, ...) \ | ||
| 440 | printk_ratelimited(KERN_ALERT pr_fmt(fmt), ##__VA_ARGS__) | ||
| 441 | #define pr_crit_ratelimited(fmt, ...) \ | ||
| 442 | printk_ratelimited(KERN_CRIT pr_fmt(fmt), ##__VA_ARGS__) | ||
| 443 | #define pr_err_ratelimited(fmt, ...) \ | ||
| 444 | printk_ratelimited(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__) | ||
| 445 | #define pr_warning_ratelimited(fmt, ...) \ | ||
| 446 | printk_ratelimited(KERN_WARNING pr_fmt(fmt), ##__VA_ARGS__) | ||
| 447 | #define pr_notice_ratelimited(fmt, ...) \ | ||
| 448 | printk_ratelimited(KERN_NOTICE pr_fmt(fmt), ##__VA_ARGS__) | ||
| 449 | #define pr_info_ratelimited(fmt, ...) \ | ||
| 450 | printk_ratelimited(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__) | ||
| 451 | /* no pr_cont_ratelimited, don't do that... */ | ||
| 452 | /* If you are writing a driver, please use dev_dbg instead */ | ||
| 453 | #if defined(DEBUG) | ||
| 454 | #define pr_debug_ratelimited(fmt, ...) \ | ||
| 455 | printk_ratelimited(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__) | ||
| 456 | #else | ||
| 457 | #define pr_debug_ratelimited(fmt, ...) \ | ||
| 458 | ({ if (0) printk_ratelimited(KERN_DEBUG pr_fmt(fmt), \ | ||
| 459 | ##__VA_ARGS__); 0; }) | ||
| 460 | #endif | ||
| 461 | |||
| 462 | /* | ||
| 410 | * General tracing related utility functions - trace_printk(), | 463 | * General tracing related utility functions - trace_printk(), |
| 411 | * tracing_on/tracing_off and tracing_start()/tracing_stop | 464 | * tracing_on/tracing_off and tracing_start()/tracing_stop |
| 412 | * | 465 | * |
| @@ -493,6 +546,8 @@ extern int | |||
| 493 | __trace_printk(unsigned long ip, const char *fmt, ...) | 546 | __trace_printk(unsigned long ip, const char *fmt, ...) |
| 494 | __attribute__ ((format (printf, 2, 3))); | 547 | __attribute__ ((format (printf, 2, 3))); |
| 495 | 548 | ||
| 549 | extern void trace_dump_stack(void); | ||
| 550 | |||
| 496 | /* | 551 | /* |
| 497 | * The double __builtin_constant_p is because gcc will give us an error | 552 | * The double __builtin_constant_p is because gcc will give us an error |
| 498 | * if we try to allocate the static variable to fmt if it is not a | 553 | * if we try to allocate the static variable to fmt if it is not a |
| @@ -526,6 +581,7 @@ trace_printk(const char *fmt, ...) __attribute__ ((format (printf, 1, 2))); | |||
| 526 | static inline void tracing_start(void) { } | 581 | static inline void tracing_start(void) { } |
| 527 | static inline void tracing_stop(void) { } | 582 | static inline void tracing_stop(void) { } |
| 528 | static inline void ftrace_off_permanent(void) { } | 583 | static inline void ftrace_off_permanent(void) { } |
| 584 | static inline void trace_dump_stack(void) { } | ||
| 529 | static inline int | 585 | static inline int |
| 530 | trace_printk(const char *fmt, ...) | 586 | trace_printk(const char *fmt, ...) |
| 531 | { | 587 | { |
| @@ -689,6 +745,10 @@ struct sysinfo { | |||
| 689 | /* Force a compilation error if condition is constant and true */ | 745 | /* Force a compilation error if condition is constant and true */ |
| 690 | #define MAYBE_BUILD_BUG_ON(cond) ((void)sizeof(char[1 - 2 * !!(cond)])) | 746 | #define MAYBE_BUILD_BUG_ON(cond) ((void)sizeof(char[1 - 2 * !!(cond)])) |
| 691 | 747 | ||
| 748 | /* Force a compilation error if a constant expression is not a power of 2 */ | ||
| 749 | #define BUILD_BUG_ON_NOT_POWER_OF_2(n) \ | ||
| 750 | BUILD_BUG_ON((n) == 0 || (((n) & ((n) - 1)) != 0)) | ||
| 751 | |||
| 692 | /* Force a compilation error if condition is true, but also produce a | 752 | /* Force a compilation error if condition is true, but also produce a |
| 693 | result (of value 0 and type size_t), so the expression can be used | 753 | result (of value 0 and type size_t), so the expression can be used |
| 694 | e.g. in a structure initializer (or where-ever else comma expressions | 754 | e.g. in a structure initializer (or where-ever else comma expressions |
diff --git a/include/linux/kernel_stat.h b/include/linux/kernel_stat.h index 348fa8874b52..c059044bc6dc 100644 --- a/include/linux/kernel_stat.h +++ b/include/linux/kernel_stat.h | |||
| @@ -25,6 +25,7 @@ struct cpu_usage_stat { | |||
| 25 | cputime64_t iowait; | 25 | cputime64_t iowait; |
| 26 | cputime64_t steal; | 26 | cputime64_t steal; |
| 27 | cputime64_t guest; | 27 | cputime64_t guest; |
| 28 | cputime64_t guest_nice; | ||
| 28 | }; | 29 | }; |
| 29 | 30 | ||
| 30 | struct kernel_stat { | 31 | struct kernel_stat { |
diff --git a/include/linux/kernelcapi.h b/include/linux/kernelcapi.h index a53e932f80fb..9c2683929fd3 100644 --- a/include/linux/kernelcapi.h +++ b/include/linux/kernelcapi.h | |||
| @@ -48,9 +48,7 @@ typedef struct kcapi_carddef { | |||
| 48 | #include <linux/list.h> | 48 | #include <linux/list.h> |
| 49 | #include <linux/skbuff.h> | 49 | #include <linux/skbuff.h> |
| 50 | #include <linux/workqueue.h> | 50 | #include <linux/workqueue.h> |
| 51 | 51 | #include <linux/notifier.h> | |
| 52 | #define KCI_CONTRUP 0 /* arg: struct capi_profile */ | ||
| 53 | #define KCI_CONTRDOWN 1 /* arg: NULL */ | ||
| 54 | 52 | ||
| 55 | struct capi20_appl { | 53 | struct capi20_appl { |
| 56 | u16 applid; | 54 | u16 applid; |
| @@ -67,11 +65,6 @@ struct capi20_appl { | |||
| 67 | struct sk_buff_head recv_queue; | 65 | struct sk_buff_head recv_queue; |
| 68 | struct work_struct recv_work; | 66 | struct work_struct recv_work; |
| 69 | int release_in_progress; | 67 | int release_in_progress; |
| 70 | |||
| 71 | /* ugly hack to allow for notification of added/removed | ||
| 72 | * controllers. The Right Way (tm) is known. XXX | ||
| 73 | */ | ||
| 74 | void (*callback) (unsigned int cmd, __u32 contr, void *data); | ||
| 75 | }; | 68 | }; |
| 76 | 69 | ||
| 77 | u16 capi20_isinstalled(void); | 70 | u16 capi20_isinstalled(void); |
| @@ -84,11 +77,11 @@ u16 capi20_get_serial(u32 contr, u8 serial[CAPI_SERIAL_LEN]); | |||
| 84 | u16 capi20_get_profile(u32 contr, struct capi_profile *profp); | 77 | u16 capi20_get_profile(u32 contr, struct capi_profile *profp); |
| 85 | int capi20_manufacturer(unsigned int cmd, void __user *data); | 78 | int capi20_manufacturer(unsigned int cmd, void __user *data); |
| 86 | 79 | ||
| 87 | /* temporary hack XXX */ | 80 | #define CAPICTR_UP 0 |
| 88 | void capi20_set_callback(struct capi20_appl *ap, | 81 | #define CAPICTR_DOWN 1 |
| 89 | void (*callback) (unsigned int cmd, __u32 contr, void *data)); | ||
| 90 | |||
| 91 | 82 | ||
| 83 | int register_capictr_notifier(struct notifier_block *nb); | ||
| 84 | int unregister_capictr_notifier(struct notifier_block *nb); | ||
| 92 | 85 | ||
| 93 | #define CAPI_NOERROR 0x0000 | 86 | #define CAPI_NOERROR 0x0000 |
| 94 | 87 | ||
diff --git a/include/linux/kexec.h b/include/linux/kexec.h index adc34f2c6eff..03e8e8dbc577 100644 --- a/include/linux/kexec.h +++ b/include/linux/kexec.h | |||
| @@ -199,13 +199,15 @@ extern struct kimage *kexec_crash_image; | |||
| 199 | */ | 199 | */ |
| 200 | extern struct resource crashk_res; | 200 | extern struct resource crashk_res; |
| 201 | typedef u32 note_buf_t[KEXEC_NOTE_BYTES/4]; | 201 | typedef u32 note_buf_t[KEXEC_NOTE_BYTES/4]; |
| 202 | extern note_buf_t *crash_notes; | 202 | extern note_buf_t __percpu *crash_notes; |
| 203 | extern u32 vmcoreinfo_note[VMCOREINFO_NOTE_SIZE/4]; | 203 | extern u32 vmcoreinfo_note[VMCOREINFO_NOTE_SIZE/4]; |
| 204 | extern size_t vmcoreinfo_size; | 204 | extern size_t vmcoreinfo_size; |
| 205 | extern size_t vmcoreinfo_max_size; | 205 | extern size_t vmcoreinfo_max_size; |
| 206 | 206 | ||
| 207 | int __init parse_crashkernel(char *cmdline, unsigned long long system_ram, | 207 | int __init parse_crashkernel(char *cmdline, unsigned long long system_ram, |
| 208 | unsigned long long *crash_size, unsigned long long *crash_base); | 208 | unsigned long long *crash_size, unsigned long long *crash_base); |
| 209 | int crash_shrink_memory(unsigned long new_size); | ||
| 210 | size_t crash_get_memory_size(void); | ||
| 209 | 211 | ||
| 210 | #else /* !CONFIG_KEXEC */ | 212 | #else /* !CONFIG_KEXEC */ |
| 211 | struct pt_regs; | 213 | struct pt_regs; |
diff --git a/include/linux/kfifo.h b/include/linux/kfifo.h index ad6bdf5a5970..e117b1aee69c 100644 --- a/include/linux/kfifo.h +++ b/include/linux/kfifo.h | |||
| @@ -1,6 +1,7 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * A simple kernel FIFO implementation. | 2 | * A generic kernel FIFO implementation. |
| 3 | * | 3 | * |
| 4 | * Copyright (C) 2009 Stefani Seibold <stefani@seibold.net> | ||
| 4 | * Copyright (C) 2004 Stelian Pop <stelian@popies.net> | 5 | * Copyright (C) 2004 Stelian Pop <stelian@popies.net> |
| 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 |
| @@ -18,6 +19,25 @@ | |||
| 18 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | 19 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
| 19 | * | 20 | * |
| 20 | */ | 21 | */ |
| 22 | |||
| 23 | /* | ||
| 24 | * Howto porting drivers to the new generic fifo API: | ||
| 25 | * | ||
| 26 | * - Modify the declaration of the "struct kfifo *" object into a | ||
| 27 | * in-place "struct kfifo" object | ||
| 28 | * - Init the in-place object with kfifo_alloc() or kfifo_init() | ||
| 29 | * Note: The address of the in-place "struct kfifo" object must be | ||
| 30 | * passed as the first argument to this functions | ||
| 31 | * - Replace the use of __kfifo_put into kfifo_in and __kfifo_get | ||
| 32 | * into kfifo_out | ||
| 33 | * - Replace the use of kfifo_put into kfifo_in_locked and kfifo_get | ||
| 34 | * into kfifo_out_locked | ||
| 35 | * Note: the spinlock pointer formerly passed to kfifo_init/kfifo_alloc | ||
| 36 | * must be passed now to the kfifo_in_locked and kfifo_out_locked | ||
| 37 | * as the last parameter. | ||
| 38 | * - All formerly name __kfifo_* functions has been renamed into kfifo_* | ||
| 39 | */ | ||
| 40 | |||
| 21 | #ifndef _LINUX_KFIFO_H | 41 | #ifndef _LINUX_KFIFO_H |
| 22 | #define _LINUX_KFIFO_H | 42 | #define _LINUX_KFIFO_H |
| 23 | 43 | ||
| @@ -29,26 +49,81 @@ struct kfifo { | |||
| 29 | unsigned int size; /* the size of the allocated buffer */ | 49 | unsigned int size; /* the size of the allocated buffer */ |
| 30 | unsigned int in; /* data is added at offset (in % size) */ | 50 | unsigned int in; /* data is added at offset (in % size) */ |
| 31 | unsigned int out; /* data is extracted from off. (out % size) */ | 51 | unsigned int out; /* data is extracted from off. (out % size) */ |
| 32 | spinlock_t *lock; /* protects concurrent modifications */ | ||
| 33 | }; | 52 | }; |
| 34 | 53 | ||
| 35 | extern struct kfifo *kfifo_init(unsigned char *buffer, unsigned int size, | 54 | /* |
| 36 | gfp_t gfp_mask, spinlock_t *lock); | 55 | * Macros for declaration and initialization of the kfifo datatype |
| 37 | extern struct kfifo *kfifo_alloc(unsigned int size, gfp_t gfp_mask, | 56 | */ |
| 38 | spinlock_t *lock); | 57 | |
| 58 | /* helper macro */ | ||
| 59 | #define __kfifo_initializer(s, b) \ | ||
| 60 | (struct kfifo) { \ | ||
| 61 | .size = s, \ | ||
| 62 | .in = 0, \ | ||
| 63 | .out = 0, \ | ||
| 64 | .buffer = b \ | ||
| 65 | } | ||
| 66 | |||
| 67 | /** | ||
| 68 | * DECLARE_KFIFO - macro to declare a kfifo and the associated buffer | ||
| 69 | * @name: name of the declared kfifo datatype | ||
| 70 | * @size: size of the fifo buffer. Must be a power of two. | ||
| 71 | * | ||
| 72 | * Note1: the macro can be used inside struct or union declaration | ||
| 73 | * Note2: the macro creates two objects: | ||
| 74 | * A kfifo object with the given name and a buffer for the kfifo | ||
| 75 | * object named name##kfifo_buffer | ||
| 76 | */ | ||
| 77 | #define DECLARE_KFIFO(name, size) \ | ||
| 78 | union { \ | ||
| 79 | struct kfifo name; \ | ||
| 80 | unsigned char name##kfifo_buffer[size + sizeof(struct kfifo)]; \ | ||
| 81 | } | ||
| 82 | |||
| 83 | /** | ||
| 84 | * INIT_KFIFO - Initialize a kfifo declared by DECLARE_KFIFO | ||
| 85 | * @name: name of the declared kfifo datatype | ||
| 86 | */ | ||
| 87 | #define INIT_KFIFO(name) \ | ||
| 88 | name = __kfifo_initializer(sizeof(name##kfifo_buffer) - \ | ||
| 89 | sizeof(struct kfifo), \ | ||
| 90 | name##kfifo_buffer + sizeof(struct kfifo)) | ||
| 91 | |||
| 92 | /** | ||
| 93 | * DEFINE_KFIFO - macro to define and initialize a kfifo | ||
| 94 | * @name: name of the declared kfifo datatype | ||
| 95 | * @size: size of the fifo buffer. Must be a power of two. | ||
| 96 | * | ||
| 97 | * Note1: the macro can be used for global and local kfifo data type variables | ||
| 98 | * Note2: the macro creates two objects: | ||
| 99 | * A kfifo object with the given name and a buffer for the kfifo | ||
| 100 | * object named name##kfifo_buffer | ||
| 101 | */ | ||
| 102 | #define DEFINE_KFIFO(name, size) \ | ||
| 103 | unsigned char name##kfifo_buffer[size]; \ | ||
| 104 | struct kfifo name = __kfifo_initializer(size, name##kfifo_buffer) | ||
| 105 | |||
| 106 | extern void kfifo_init(struct kfifo *fifo, void *buffer, | ||
| 107 | unsigned int size); | ||
| 108 | extern __must_check int kfifo_alloc(struct kfifo *fifo, unsigned int size, | ||
| 109 | gfp_t gfp_mask); | ||
| 39 | extern void kfifo_free(struct kfifo *fifo); | 110 | extern void kfifo_free(struct kfifo *fifo); |
| 40 | extern unsigned int __kfifo_put(struct kfifo *fifo, | 111 | extern unsigned int kfifo_in(struct kfifo *fifo, |
| 41 | const unsigned char *buffer, unsigned int len); | 112 | const void *from, unsigned int len); |
| 42 | extern unsigned int __kfifo_get(struct kfifo *fifo, | 113 | extern __must_check unsigned int kfifo_out(struct kfifo *fifo, |
| 43 | unsigned char *buffer, unsigned int len); | 114 | void *to, unsigned int len); |
| 115 | extern __must_check unsigned int kfifo_out_peek(struct kfifo *fifo, | ||
| 116 | void *to, unsigned int len, unsigned offset); | ||
| 44 | 117 | ||
| 45 | /** | 118 | /** |
| 46 | * __kfifo_reset - removes the entire FIFO contents, no locking version | 119 | * kfifo_initialized - Check if kfifo is initialized. |
| 47 | * @fifo: the fifo to be emptied. | 120 | * @fifo: fifo to check |
| 121 | * Return %true if FIFO is initialized, otherwise %false. | ||
| 122 | * Assumes the fifo was 0 before. | ||
| 48 | */ | 123 | */ |
| 49 | static inline void __kfifo_reset(struct kfifo *fifo) | 124 | static inline bool kfifo_initialized(struct kfifo *fifo) |
| 50 | { | 125 | { |
| 51 | fifo->in = fifo->out = 0; | 126 | return fifo->buffer != NULL; |
| 52 | } | 127 | } |
| 53 | 128 | ||
| 54 | /** | 129 | /** |
| @@ -57,96 +132,484 @@ static inline void __kfifo_reset(struct kfifo *fifo) | |||
| 57 | */ | 132 | */ |
| 58 | static inline void kfifo_reset(struct kfifo *fifo) | 133 | static inline void kfifo_reset(struct kfifo *fifo) |
| 59 | { | 134 | { |
| 60 | unsigned long flags; | 135 | fifo->in = fifo->out = 0; |
| 136 | } | ||
| 61 | 137 | ||
| 62 | spin_lock_irqsave(fifo->lock, flags); | 138 | /** |
| 139 | * kfifo_reset_out - skip FIFO contents | ||
| 140 | * @fifo: the fifo to be emptied. | ||
| 141 | */ | ||
| 142 | static inline void kfifo_reset_out(struct kfifo *fifo) | ||
| 143 | { | ||
| 144 | smp_mb(); | ||
| 145 | fifo->out = fifo->in; | ||
| 146 | } | ||
| 63 | 147 | ||
| 64 | __kfifo_reset(fifo); | 148 | /** |
| 149 | * kfifo_size - returns the size of the fifo in bytes | ||
| 150 | * @fifo: the fifo to be used. | ||
| 151 | */ | ||
| 152 | static inline __must_check unsigned int kfifo_size(struct kfifo *fifo) | ||
| 153 | { | ||
| 154 | return fifo->size; | ||
| 155 | } | ||
| 65 | 156 | ||
| 66 | spin_unlock_irqrestore(fifo->lock, flags); | 157 | /** |
| 158 | * kfifo_len - returns the number of used bytes in the FIFO | ||
| 159 | * @fifo: the fifo to be used. | ||
| 160 | */ | ||
| 161 | static inline unsigned int kfifo_len(struct kfifo *fifo) | ||
| 162 | { | ||
| 163 | register unsigned int out; | ||
| 164 | |||
| 165 | out = fifo->out; | ||
| 166 | smp_rmb(); | ||
| 167 | return fifo->in - out; | ||
| 67 | } | 168 | } |
| 68 | 169 | ||
| 69 | /** | 170 | /** |
| 70 | * kfifo_put - puts some data into the FIFO | 171 | * kfifo_is_empty - returns true if the fifo is empty |
| 71 | * @fifo: the fifo to be used. | 172 | * @fifo: the fifo to be used. |
| 72 | * @buffer: the data to be added. | 173 | */ |
| 73 | * @len: the length of the data to be added. | 174 | static inline __must_check int kfifo_is_empty(struct kfifo *fifo) |
| 175 | { | ||
| 176 | return fifo->in == fifo->out; | ||
| 177 | } | ||
| 178 | |||
| 179 | /** | ||
| 180 | * kfifo_is_full - returns true if the fifo is full | ||
| 181 | * @fifo: the fifo to be used. | ||
| 182 | */ | ||
| 183 | static inline __must_check int kfifo_is_full(struct kfifo *fifo) | ||
| 184 | { | ||
| 185 | return kfifo_len(fifo) == kfifo_size(fifo); | ||
| 186 | } | ||
| 187 | |||
| 188 | /** | ||
| 189 | * kfifo_avail - returns the number of bytes available in the FIFO | ||
| 190 | * @fifo: the fifo to be used. | ||
| 191 | */ | ||
| 192 | static inline __must_check unsigned int kfifo_avail(struct kfifo *fifo) | ||
| 193 | { | ||
| 194 | return kfifo_size(fifo) - kfifo_len(fifo); | ||
| 195 | } | ||
| 196 | |||
| 197 | /** | ||
| 198 | * kfifo_in_locked - puts some data into the FIFO using a spinlock for locking | ||
| 199 | * @fifo: the fifo to be used. | ||
| 200 | * @from: the data to be added. | ||
| 201 | * @n: the length of the data to be added. | ||
| 202 | * @lock: pointer to the spinlock to use for locking. | ||
| 74 | * | 203 | * |
| 75 | * This function copies at most @len bytes from the @buffer into | 204 | * This function copies at most @len bytes from the @from buffer into |
| 76 | * the FIFO depending on the free space, and returns the number of | 205 | * the FIFO depending on the free space, and returns the number of |
| 77 | * bytes copied. | 206 | * bytes copied. |
| 78 | */ | 207 | */ |
| 79 | static inline unsigned int kfifo_put(struct kfifo *fifo, | 208 | static inline unsigned int kfifo_in_locked(struct kfifo *fifo, |
| 80 | const unsigned char *buffer, unsigned int len) | 209 | const void *from, unsigned int n, spinlock_t *lock) |
| 81 | { | 210 | { |
| 82 | unsigned long flags; | 211 | unsigned long flags; |
| 83 | unsigned int ret; | 212 | unsigned int ret; |
| 84 | 213 | ||
| 85 | spin_lock_irqsave(fifo->lock, flags); | 214 | spin_lock_irqsave(lock, flags); |
| 86 | 215 | ||
| 87 | ret = __kfifo_put(fifo, buffer, len); | 216 | ret = kfifo_in(fifo, from, n); |
| 88 | 217 | ||
| 89 | spin_unlock_irqrestore(fifo->lock, flags); | 218 | spin_unlock_irqrestore(lock, flags); |
| 90 | 219 | ||
| 91 | return ret; | 220 | return ret; |
| 92 | } | 221 | } |
| 93 | 222 | ||
| 94 | /** | 223 | /** |
| 95 | * kfifo_get - gets some data from the FIFO | 224 | * kfifo_out_locked - gets some data from the FIFO using a spinlock for locking |
| 96 | * @fifo: the fifo to be used. | 225 | * @fifo: the fifo to be used. |
| 97 | * @buffer: where the data must be copied. | 226 | * @to: where the data must be copied. |
| 98 | * @len: the size of the destination buffer. | 227 | * @n: the size of the destination buffer. |
| 228 | * @lock: pointer to the spinlock to use for locking. | ||
| 99 | * | 229 | * |
| 100 | * This function copies at most @len bytes from the FIFO into the | 230 | * This function copies at most @len bytes from the FIFO into the |
| 101 | * @buffer and returns the number of copied bytes. | 231 | * @to buffer and returns the number of copied bytes. |
| 102 | */ | 232 | */ |
| 103 | static inline unsigned int kfifo_get(struct kfifo *fifo, | 233 | static inline __must_check unsigned int kfifo_out_locked(struct kfifo *fifo, |
| 104 | unsigned char *buffer, unsigned int len) | 234 | void *to, unsigned int n, spinlock_t *lock) |
| 105 | { | 235 | { |
| 106 | unsigned long flags; | 236 | unsigned long flags; |
| 107 | unsigned int ret; | 237 | unsigned int ret; |
| 108 | 238 | ||
| 109 | spin_lock_irqsave(fifo->lock, flags); | 239 | spin_lock_irqsave(lock, flags); |
| 240 | |||
| 241 | ret = kfifo_out(fifo, to, n); | ||
| 242 | |||
| 243 | spin_unlock_irqrestore(lock, flags); | ||
| 244 | |||
| 245 | return ret; | ||
| 246 | } | ||
| 247 | |||
| 248 | extern void kfifo_skip(struct kfifo *fifo, unsigned int len); | ||
| 249 | |||
| 250 | extern __must_check int kfifo_from_user(struct kfifo *fifo, | ||
| 251 | const void __user *from, unsigned int n, unsigned *lenout); | ||
| 252 | |||
| 253 | extern __must_check int kfifo_to_user(struct kfifo *fifo, | ||
| 254 | void __user *to, unsigned int n, unsigned *lenout); | ||
| 255 | |||
| 256 | /* | ||
| 257 | * __kfifo_add_out internal helper function for updating the out offset | ||
| 258 | */ | ||
| 259 | static inline void __kfifo_add_out(struct kfifo *fifo, | ||
| 260 | unsigned int off) | ||
| 261 | { | ||
| 262 | smp_mb(); | ||
| 263 | fifo->out += off; | ||
| 264 | } | ||
| 265 | |||
| 266 | /* | ||
| 267 | * __kfifo_add_in internal helper function for updating the in offset | ||
| 268 | */ | ||
| 269 | static inline void __kfifo_add_in(struct kfifo *fifo, | ||
| 270 | unsigned int off) | ||
| 271 | { | ||
| 272 | smp_wmb(); | ||
| 273 | fifo->in += off; | ||
| 274 | } | ||
| 110 | 275 | ||
| 111 | ret = __kfifo_get(fifo, buffer, len); | 276 | /* |
| 277 | * __kfifo_off internal helper function for calculating the index of a | ||
| 278 | * given offeset | ||
| 279 | */ | ||
| 280 | static inline unsigned int __kfifo_off(struct kfifo *fifo, unsigned int off) | ||
| 281 | { | ||
| 282 | return off & (fifo->size - 1); | ||
| 283 | } | ||
| 112 | 284 | ||
| 113 | /* | 285 | /* |
| 114 | * optimization: if the FIFO is empty, set the indices to 0 | 286 | * __kfifo_peek_n internal helper function for determinate the length of |
| 115 | * so we don't wrap the next time | 287 | * the next record in the fifo |
| 116 | */ | 288 | */ |
| 117 | if (fifo->in == fifo->out) | 289 | static inline unsigned int __kfifo_peek_n(struct kfifo *fifo, |
| 118 | fifo->in = fifo->out = 0; | 290 | unsigned int recsize) |
| 291 | { | ||
| 292 | #define __KFIFO_GET(fifo, off, shift) \ | ||
| 293 | ((fifo)->buffer[__kfifo_off((fifo), (fifo)->out+(off))] << (shift)) | ||
| 294 | |||
| 295 | unsigned int l; | ||
| 296 | |||
| 297 | l = __KFIFO_GET(fifo, 0, 0); | ||
| 298 | |||
| 299 | if (--recsize) | ||
| 300 | l |= __KFIFO_GET(fifo, 1, 8); | ||
| 119 | 301 | ||
| 120 | spin_unlock_irqrestore(fifo->lock, flags); | 302 | return l; |
| 303 | #undef __KFIFO_GET | ||
| 304 | } | ||
| 305 | |||
| 306 | /* | ||
| 307 | * __kfifo_poke_n internal helper function for storing the length of | ||
| 308 | * the next record into the fifo | ||
| 309 | */ | ||
| 310 | static inline void __kfifo_poke_n(struct kfifo *fifo, | ||
| 311 | unsigned int recsize, unsigned int n) | ||
| 312 | { | ||
| 313 | #define __KFIFO_PUT(fifo, off, val, shift) \ | ||
| 314 | ( \ | ||
| 315 | (fifo)->buffer[__kfifo_off((fifo), (fifo)->in+(off))] = \ | ||
| 316 | (unsigned char)((val) >> (shift)) \ | ||
| 317 | ) | ||
| 121 | 318 | ||
| 319 | __KFIFO_PUT(fifo, 0, n, 0); | ||
| 320 | |||
| 321 | if (--recsize) | ||
| 322 | __KFIFO_PUT(fifo, 1, n, 8); | ||
| 323 | #undef __KFIFO_PUT | ||
| 324 | } | ||
| 325 | |||
| 326 | /* | ||
| 327 | * __kfifo_in_... internal functions for put date into the fifo | ||
| 328 | * do not call it directly, use kfifo_in_rec() instead | ||
| 329 | */ | ||
| 330 | extern unsigned int __kfifo_in_n(struct kfifo *fifo, | ||
| 331 | const void *from, unsigned int n, unsigned int recsize); | ||
| 332 | |||
| 333 | extern unsigned int __kfifo_in_generic(struct kfifo *fifo, | ||
| 334 | const void *from, unsigned int n, unsigned int recsize); | ||
| 335 | |||
| 336 | static inline unsigned int __kfifo_in_rec(struct kfifo *fifo, | ||
| 337 | const void *from, unsigned int n, unsigned int recsize) | ||
| 338 | { | ||
| 339 | unsigned int ret; | ||
| 340 | |||
| 341 | ret = __kfifo_in_n(fifo, from, n, recsize); | ||
| 342 | |||
| 343 | if (likely(ret == 0)) { | ||
| 344 | if (recsize) | ||
| 345 | __kfifo_poke_n(fifo, recsize, n); | ||
| 346 | __kfifo_add_in(fifo, n + recsize); | ||
| 347 | } | ||
| 122 | return ret; | 348 | return ret; |
| 123 | } | 349 | } |
| 124 | 350 | ||
| 125 | /** | 351 | /** |
| 126 | * __kfifo_len - returns the number of bytes available in the FIFO, no locking version | 352 | * kfifo_in_rec - puts some record data into the FIFO |
| 127 | * @fifo: the fifo to be used. | 353 | * @fifo: the fifo to be used. |
| 354 | * @from: the data to be added. | ||
| 355 | * @n: the length of the data to be added. | ||
| 356 | * @recsize: size of record field | ||
| 357 | * | ||
| 358 | * This function copies @n bytes from the @from into the FIFO and returns | ||
| 359 | * the number of bytes which cannot be copied. | ||
| 360 | * A returned value greater than the @n value means that the record doesn't | ||
| 361 | * fit into the buffer. | ||
| 362 | * | ||
| 363 | * Note that with only one concurrent reader and one concurrent | ||
| 364 | * writer, you don't need extra locking to use these functions. | ||
| 128 | */ | 365 | */ |
| 129 | static inline unsigned int __kfifo_len(struct kfifo *fifo) | 366 | static inline __must_check unsigned int kfifo_in_rec(struct kfifo *fifo, |
| 367 | void *from, unsigned int n, unsigned int recsize) | ||
| 130 | { | 368 | { |
| 131 | return fifo->in - fifo->out; | 369 | if (!__builtin_constant_p(recsize)) |
| 370 | return __kfifo_in_generic(fifo, from, n, recsize); | ||
| 371 | return __kfifo_in_rec(fifo, from, n, recsize); | ||
| 372 | } | ||
| 373 | |||
| 374 | /* | ||
| 375 | * __kfifo_out_... internal functions for get date from the fifo | ||
| 376 | * do not call it directly, use kfifo_out_rec() instead | ||
| 377 | */ | ||
| 378 | extern unsigned int __kfifo_out_n(struct kfifo *fifo, | ||
| 379 | void *to, unsigned int reclen, unsigned int recsize); | ||
| 380 | |||
| 381 | extern unsigned int __kfifo_out_generic(struct kfifo *fifo, | ||
| 382 | void *to, unsigned int n, | ||
| 383 | unsigned int recsize, unsigned int *total); | ||
| 384 | |||
| 385 | static inline unsigned int __kfifo_out_rec(struct kfifo *fifo, | ||
| 386 | void *to, unsigned int n, unsigned int recsize, | ||
| 387 | unsigned int *total) | ||
| 388 | { | ||
| 389 | unsigned int l; | ||
| 390 | |||
| 391 | if (!recsize) { | ||
| 392 | l = n; | ||
| 393 | if (total) | ||
| 394 | *total = l; | ||
| 395 | } else { | ||
| 396 | l = __kfifo_peek_n(fifo, recsize); | ||
| 397 | if (total) | ||
| 398 | *total = l; | ||
| 399 | if (n < l) | ||
| 400 | return l; | ||
| 401 | } | ||
| 402 | |||
| 403 | return __kfifo_out_n(fifo, to, l, recsize); | ||
| 132 | } | 404 | } |
| 133 | 405 | ||
| 134 | /** | 406 | /** |
| 135 | * kfifo_len - returns the number of bytes available in the FIFO | 407 | * kfifo_out_rec - gets some record data from the FIFO |
| 136 | * @fifo: the fifo to be used. | 408 | * @fifo: the fifo to be used. |
| 409 | * @to: where the data must be copied. | ||
| 410 | * @n: the size of the destination buffer. | ||
| 411 | * @recsize: size of record field | ||
| 412 | * @total: pointer where the total number of to copied bytes should stored | ||
| 413 | * | ||
| 414 | * This function copies at most @n bytes from the FIFO to @to and returns the | ||
| 415 | * number of bytes which cannot be copied. | ||
| 416 | * A returned value greater than the @n value means that the record doesn't | ||
| 417 | * fit into the @to buffer. | ||
| 418 | * | ||
| 419 | * Note that with only one concurrent reader and one concurrent | ||
| 420 | * writer, you don't need extra locking to use these functions. | ||
| 137 | */ | 421 | */ |
| 138 | static inline unsigned int kfifo_len(struct kfifo *fifo) | 422 | static inline __must_check unsigned int kfifo_out_rec(struct kfifo *fifo, |
| 423 | void *to, unsigned int n, unsigned int recsize, | ||
| 424 | unsigned int *total) | ||
| 425 | |||
| 139 | { | 426 | { |
| 140 | unsigned long flags; | 427 | if (!__builtin_constant_p(recsize)) |
| 141 | unsigned int ret; | 428 | return __kfifo_out_generic(fifo, to, n, recsize, total); |
| 429 | return __kfifo_out_rec(fifo, to, n, recsize, total); | ||
| 430 | } | ||
| 142 | 431 | ||
| 143 | spin_lock_irqsave(fifo->lock, flags); | 432 | /* |
| 433 | * __kfifo_from_user_... internal functions for transfer from user space into | ||
| 434 | * the fifo. do not call it directly, use kfifo_from_user_rec() instead | ||
| 435 | */ | ||
| 436 | extern unsigned int __kfifo_from_user_n(struct kfifo *fifo, | ||
| 437 | const void __user *from, unsigned int n, unsigned int recsize); | ||
| 438 | |||
| 439 | extern unsigned int __kfifo_from_user_generic(struct kfifo *fifo, | ||
| 440 | const void __user *from, unsigned int n, unsigned int recsize); | ||
| 144 | 441 | ||
| 145 | ret = __kfifo_len(fifo); | 442 | static inline unsigned int __kfifo_from_user_rec(struct kfifo *fifo, |
| 443 | const void __user *from, unsigned int n, unsigned int recsize) | ||
| 444 | { | ||
| 445 | unsigned int ret; | ||
| 146 | 446 | ||
| 147 | spin_unlock_irqrestore(fifo->lock, flags); | 447 | ret = __kfifo_from_user_n(fifo, from, n, recsize); |
| 148 | 448 | ||
| 449 | if (likely(ret == 0)) { | ||
| 450 | if (recsize) | ||
| 451 | __kfifo_poke_n(fifo, recsize, n); | ||
| 452 | __kfifo_add_in(fifo, n + recsize); | ||
| 453 | } | ||
| 149 | return ret; | 454 | return ret; |
| 150 | } | 455 | } |
| 151 | 456 | ||
| 457 | /** | ||
| 458 | * kfifo_from_user_rec - puts some data from user space into the FIFO | ||
| 459 | * @fifo: the fifo to be used. | ||
| 460 | * @from: pointer to the data to be added. | ||
| 461 | * @n: the length of the data to be added. | ||
| 462 | * @recsize: size of record field | ||
| 463 | * | ||
| 464 | * This function copies @n bytes from the @from into the | ||
| 465 | * FIFO and returns the number of bytes which cannot be copied. | ||
| 466 | * | ||
| 467 | * If the returned value is equal or less the @n value, the copy_from_user() | ||
| 468 | * functions has failed. Otherwise the record doesn't fit into the buffer. | ||
| 469 | * | ||
| 470 | * Note that with only one concurrent reader and one concurrent | ||
| 471 | * writer, you don't need extra locking to use these functions. | ||
| 472 | */ | ||
| 473 | static inline __must_check unsigned int kfifo_from_user_rec(struct kfifo *fifo, | ||
| 474 | const void __user *from, unsigned int n, unsigned int recsize) | ||
| 475 | { | ||
| 476 | if (!__builtin_constant_p(recsize)) | ||
| 477 | return __kfifo_from_user_generic(fifo, from, n, recsize); | ||
| 478 | return __kfifo_from_user_rec(fifo, from, n, recsize); | ||
| 479 | } | ||
| 480 | |||
| 481 | /* | ||
| 482 | * __kfifo_to_user_... internal functions for transfer fifo data into user space | ||
| 483 | * do not call it directly, use kfifo_to_user_rec() instead | ||
| 484 | */ | ||
| 485 | extern unsigned int __kfifo_to_user_n(struct kfifo *fifo, | ||
| 486 | void __user *to, unsigned int n, unsigned int reclen, | ||
| 487 | unsigned int recsize); | ||
| 488 | |||
| 489 | extern unsigned int __kfifo_to_user_generic(struct kfifo *fifo, | ||
| 490 | void __user *to, unsigned int n, unsigned int recsize, | ||
| 491 | unsigned int *total); | ||
| 492 | |||
| 493 | static inline unsigned int __kfifo_to_user_rec(struct kfifo *fifo, | ||
| 494 | void __user *to, unsigned int n, | ||
| 495 | unsigned int recsize, unsigned int *total) | ||
| 496 | { | ||
| 497 | unsigned int l; | ||
| 498 | |||
| 499 | if (!recsize) { | ||
| 500 | l = n; | ||
| 501 | if (total) | ||
| 502 | *total = l; | ||
| 503 | } else { | ||
| 504 | l = __kfifo_peek_n(fifo, recsize); | ||
| 505 | if (total) | ||
| 506 | *total = l; | ||
| 507 | if (n < l) | ||
| 508 | return l; | ||
| 509 | } | ||
| 510 | |||
| 511 | return __kfifo_to_user_n(fifo, to, n, l, recsize); | ||
| 512 | } | ||
| 513 | |||
| 514 | /** | ||
| 515 | * kfifo_to_user_rec - gets data from the FIFO and write it to user space | ||
| 516 | * @fifo: the fifo to be used. | ||
| 517 | * @to: where the data must be copied. | ||
| 518 | * @n: the size of the destination buffer. | ||
| 519 | * @recsize: size of record field | ||
| 520 | * @total: pointer where the total number of to copied bytes should stored | ||
| 521 | * | ||
| 522 | * This function copies at most @n bytes from the FIFO to the @to. | ||
| 523 | * In case of an error, the function returns the number of bytes which cannot | ||
| 524 | * be copied. | ||
| 525 | * If the returned value is equal or less the @n value, the copy_to_user() | ||
| 526 | * functions has failed. Otherwise the record doesn't fit into the @to buffer. | ||
| 527 | * | ||
| 528 | * Note that with only one concurrent reader and one concurrent | ||
| 529 | * writer, you don't need extra locking to use these functions. | ||
| 530 | */ | ||
| 531 | static inline __must_check unsigned int kfifo_to_user_rec(struct kfifo *fifo, | ||
| 532 | void __user *to, unsigned int n, unsigned int recsize, | ||
| 533 | unsigned int *total) | ||
| 534 | { | ||
| 535 | if (!__builtin_constant_p(recsize)) | ||
| 536 | return __kfifo_to_user_generic(fifo, to, n, recsize, total); | ||
| 537 | return __kfifo_to_user_rec(fifo, to, n, recsize, total); | ||
| 538 | } | ||
| 539 | |||
| 540 | /* | ||
| 541 | * __kfifo_peek_... internal functions for peek into the next fifo record | ||
| 542 | * do not call it directly, use kfifo_peek_rec() instead | ||
| 543 | */ | ||
| 544 | extern unsigned int __kfifo_peek_generic(struct kfifo *fifo, | ||
| 545 | unsigned int recsize); | ||
| 546 | |||
| 547 | /** | ||
| 548 | * kfifo_peek_rec - gets the size of the next FIFO record data | ||
| 549 | * @fifo: the fifo to be used. | ||
| 550 | * @recsize: size of record field | ||
| 551 | * | ||
| 552 | * This function returns the size of the next FIFO record in number of bytes | ||
| 553 | */ | ||
| 554 | static inline __must_check unsigned int kfifo_peek_rec(struct kfifo *fifo, | ||
| 555 | unsigned int recsize) | ||
| 556 | { | ||
| 557 | if (!__builtin_constant_p(recsize)) | ||
| 558 | return __kfifo_peek_generic(fifo, recsize); | ||
| 559 | if (!recsize) | ||
| 560 | return kfifo_len(fifo); | ||
| 561 | return __kfifo_peek_n(fifo, recsize); | ||
| 562 | } | ||
| 563 | |||
| 564 | /* | ||
| 565 | * __kfifo_skip_... internal functions for skip the next fifo record | ||
| 566 | * do not call it directly, use kfifo_skip_rec() instead | ||
| 567 | */ | ||
| 568 | extern void __kfifo_skip_generic(struct kfifo *fifo, unsigned int recsize); | ||
| 569 | |||
| 570 | static inline void __kfifo_skip_rec(struct kfifo *fifo, | ||
| 571 | unsigned int recsize) | ||
| 572 | { | ||
| 573 | unsigned int l; | ||
| 574 | |||
| 575 | if (recsize) { | ||
| 576 | l = __kfifo_peek_n(fifo, recsize); | ||
| 577 | |||
| 578 | if (l + recsize <= kfifo_len(fifo)) { | ||
| 579 | __kfifo_add_out(fifo, l + recsize); | ||
| 580 | return; | ||
| 581 | } | ||
| 582 | } | ||
| 583 | kfifo_reset_out(fifo); | ||
| 584 | } | ||
| 585 | |||
| 586 | /** | ||
| 587 | * kfifo_skip_rec - skip the next fifo out record | ||
| 588 | * @fifo: the fifo to be used. | ||
| 589 | * @recsize: size of record field | ||
| 590 | * | ||
| 591 | * This function skips the next FIFO record | ||
| 592 | */ | ||
| 593 | static inline void kfifo_skip_rec(struct kfifo *fifo, | ||
| 594 | unsigned int recsize) | ||
| 595 | { | ||
| 596 | if (!__builtin_constant_p(recsize)) | ||
| 597 | __kfifo_skip_generic(fifo, recsize); | ||
| 598 | else | ||
| 599 | __kfifo_skip_rec(fifo, recsize); | ||
| 600 | } | ||
| 601 | |||
| 602 | /** | ||
| 603 | * kfifo_avail_rec - returns the number of bytes available in a record FIFO | ||
| 604 | * @fifo: the fifo to be used. | ||
| 605 | * @recsize: size of record field | ||
| 606 | */ | ||
| 607 | static inline __must_check unsigned int kfifo_avail_rec(struct kfifo *fifo, | ||
| 608 | unsigned int recsize) | ||
| 609 | { | ||
| 610 | unsigned int l = kfifo_size(fifo) - kfifo_len(fifo); | ||
| 611 | |||
| 612 | return (l > recsize) ? l - recsize : 0; | ||
| 613 | } | ||
| 614 | |||
| 152 | #endif | 615 | #endif |
diff --git a/include/linux/kgdb.h b/include/linux/kgdb.h index 6adcc297e354..19ec41a183f5 100644 --- a/include/linux/kgdb.h +++ b/include/linux/kgdb.h | |||
| @@ -29,8 +29,7 @@ struct pt_regs; | |||
| 29 | * | 29 | * |
| 30 | * On some architectures it is required to skip a breakpoint | 30 | * On some architectures it is required to skip a breakpoint |
| 31 | * exception when it occurs after a breakpoint has been removed. | 31 | * exception when it occurs after a breakpoint has been removed. |
| 32 | * This can be implemented in the architecture specific portion of | 32 | * This can be implemented in the architecture specific portion of kgdb. |
| 33 | * for kgdb. | ||
| 34 | */ | 33 | */ |
| 35 | extern int kgdb_skipexception(int exception, struct pt_regs *regs); | 34 | extern int kgdb_skipexception(int exception, struct pt_regs *regs); |
| 36 | 35 | ||
| @@ -65,7 +64,7 @@ struct uart_port; | |||
| 65 | /** | 64 | /** |
| 66 | * kgdb_breakpoint - compiled in breakpoint | 65 | * kgdb_breakpoint - compiled in breakpoint |
| 67 | * | 66 | * |
| 68 | * This will be impelmented a static inline per architecture. This | 67 | * This will be implemented as a static inline per architecture. This |
| 69 | * function is called by the kgdb core to execute an architecture | 68 | * function is called by the kgdb core to execute an architecture |
| 70 | * specific trap to cause kgdb to enter the exception processing. | 69 | * specific trap to cause kgdb to enter the exception processing. |
| 71 | * | 70 | * |
| @@ -190,7 +189,7 @@ kgdb_arch_handle_exception(int vector, int signo, int err_code, | |||
| 190 | * @flags: Current IRQ state | 189 | * @flags: Current IRQ state |
| 191 | * | 190 | * |
| 192 | * On SMP systems, we need to get the attention of the other CPUs | 191 | * On SMP systems, we need to get the attention of the other CPUs |
| 193 | * and get them be in a known state. This should do what is needed | 192 | * and get them into a known state. This should do what is needed |
| 194 | * to get the other CPUs to call kgdb_wait(). Note that on some arches, | 193 | * to get the other CPUs to call kgdb_wait(). Note that on some arches, |
| 195 | * the NMI approach is not used for rounding up all the CPUs. For example, | 194 | * the NMI approach is not used for rounding up all the CPUs. For example, |
| 196 | * in case of MIPS, smp_call_function() is used to roundup CPUs. In | 195 | * in case of MIPS, smp_call_function() is used to roundup CPUs. In |
diff --git a/include/linux/kmemcheck.h b/include/linux/kmemcheck.h index e880d4cf9e22..08d7dc4ddf40 100644 --- a/include/linux/kmemcheck.h +++ b/include/linux/kmemcheck.h | |||
| @@ -36,6 +36,56 @@ int kmemcheck_hide_addr(unsigned long address); | |||
| 36 | 36 | ||
| 37 | bool kmemcheck_is_obj_initialized(unsigned long addr, size_t size); | 37 | bool kmemcheck_is_obj_initialized(unsigned long addr, size_t size); |
| 38 | 38 | ||
| 39 | /* | ||
| 40 | * Bitfield annotations | ||
| 41 | * | ||
| 42 | * How to use: If you have a struct using bitfields, for example | ||
| 43 | * | ||
| 44 | * struct a { | ||
| 45 | * int x:8, y:8; | ||
| 46 | * }; | ||
| 47 | * | ||
| 48 | * then this should be rewritten as | ||
| 49 | * | ||
| 50 | * struct a { | ||
| 51 | * kmemcheck_bitfield_begin(flags); | ||
| 52 | * int x:8, y:8; | ||
| 53 | * kmemcheck_bitfield_end(flags); | ||
| 54 | * }; | ||
| 55 | * | ||
| 56 | * Now the "flags_begin" and "flags_end" members may be used to refer to the | ||
| 57 | * beginning and end, respectively, of the bitfield (and things like | ||
| 58 | * &x.flags_begin is allowed). As soon as the struct is allocated, the bit- | ||
| 59 | * fields should be annotated: | ||
| 60 | * | ||
| 61 | * struct a *a = kmalloc(sizeof(struct a), GFP_KERNEL); | ||
| 62 | * kmemcheck_annotate_bitfield(a, flags); | ||
| 63 | */ | ||
| 64 | #define kmemcheck_bitfield_begin(name) \ | ||
| 65 | int name##_begin[0]; | ||
| 66 | |||
| 67 | #define kmemcheck_bitfield_end(name) \ | ||
| 68 | int name##_end[0]; | ||
| 69 | |||
| 70 | #define kmemcheck_annotate_bitfield(ptr, name) \ | ||
| 71 | do { \ | ||
| 72 | int _n; \ | ||
| 73 | \ | ||
| 74 | if (!ptr) \ | ||
| 75 | break; \ | ||
| 76 | \ | ||
| 77 | _n = (long) &((ptr)->name##_end) \ | ||
| 78 | - (long) &((ptr)->name##_begin); \ | ||
| 79 | MAYBE_BUILD_BUG_ON(_n < 0); \ | ||
| 80 | \ | ||
| 81 | kmemcheck_mark_initialized(&((ptr)->name##_begin), _n); \ | ||
| 82 | } while (0) | ||
| 83 | |||
| 84 | #define kmemcheck_annotate_variable(var) \ | ||
| 85 | do { \ | ||
| 86 | kmemcheck_mark_initialized(&(var), sizeof(var)); \ | ||
| 87 | } while (0) \ | ||
| 88 | |||
| 39 | #else | 89 | #else |
| 40 | #define kmemcheck_enabled 0 | 90 | #define kmemcheck_enabled 0 |
| 41 | 91 | ||
| @@ -106,60 +156,16 @@ static inline bool kmemcheck_is_obj_initialized(unsigned long addr, size_t size) | |||
| 106 | return true; | 156 | return true; |
| 107 | } | 157 | } |
| 108 | 158 | ||
| 109 | #endif /* CONFIG_KMEMCHECK */ | 159 | #define kmemcheck_bitfield_begin(name) |
| 110 | 160 | #define kmemcheck_bitfield_end(name) | |
| 111 | /* | 161 | #define kmemcheck_annotate_bitfield(ptr, name) \ |
| 112 | * Bitfield annotations | 162 | do { \ |
| 113 | * | 163 | } while (0) |
| 114 | * How to use: If you have a struct using bitfields, for example | ||
| 115 | * | ||
| 116 | * struct a { | ||
| 117 | * int x:8, y:8; | ||
| 118 | * }; | ||
| 119 | * | ||
| 120 | * then this should be rewritten as | ||
| 121 | * | ||
| 122 | * struct a { | ||
| 123 | * kmemcheck_bitfield_begin(flags); | ||
| 124 | * int x:8, y:8; | ||
| 125 | * kmemcheck_bitfield_end(flags); | ||
| 126 | * }; | ||
| 127 | * | ||
| 128 | * Now the "flags_begin" and "flags_end" members may be used to refer to the | ||
| 129 | * beginning and end, respectively, of the bitfield (and things like | ||
| 130 | * &x.flags_begin is allowed). As soon as the struct is allocated, the bit- | ||
| 131 | * fields should be annotated: | ||
| 132 | * | ||
| 133 | * struct a *a = kmalloc(sizeof(struct a), GFP_KERNEL); | ||
| 134 | * kmemcheck_annotate_bitfield(a, flags); | ||
| 135 | * | ||
| 136 | * Note: We provide the same definitions for both kmemcheck and non- | ||
| 137 | * kmemcheck kernels. This makes it harder to introduce accidental errors. It | ||
| 138 | * is also allowed to pass NULL pointers to kmemcheck_annotate_bitfield(). | ||
| 139 | */ | ||
| 140 | #define kmemcheck_bitfield_begin(name) \ | ||
| 141 | int name##_begin[0]; | ||
| 142 | |||
| 143 | #define kmemcheck_bitfield_end(name) \ | ||
| 144 | int name##_end[0]; | ||
| 145 | 164 | ||
| 146 | #define kmemcheck_annotate_bitfield(ptr, name) \ | 165 | #define kmemcheck_annotate_variable(var) \ |
| 147 | do { \ | 166 | do { \ |
| 148 | int _n; \ | ||
| 149 | \ | ||
| 150 | if (!ptr) \ | ||
| 151 | break; \ | ||
| 152 | \ | ||
| 153 | _n = (long) &((ptr)->name##_end) \ | ||
| 154 | - (long) &((ptr)->name##_begin); \ | ||
| 155 | MAYBE_BUILD_BUG_ON(_n < 0); \ | ||
| 156 | \ | ||
| 157 | kmemcheck_mark_initialized(&((ptr)->name##_begin), _n); \ | ||
| 158 | } while (0) | 167 | } while (0) |
| 159 | 168 | ||
| 160 | #define kmemcheck_annotate_variable(var) \ | 169 | #endif /* CONFIG_KMEMCHECK */ |
| 161 | do { \ | ||
| 162 | kmemcheck_mark_initialized(&(var), sizeof(var)); \ | ||
| 163 | } while (0) \ | ||
| 164 | 170 | ||
| 165 | #endif /* LINUX_KMEMCHECK_H */ | 171 | #endif /* LINUX_KMEMCHECK_H */ |
diff --git a/include/linux/kmemleak.h b/include/linux/kmemleak.h index 3c7497d46ee9..99d9a6766f7e 100644 --- a/include/linux/kmemleak.h +++ b/include/linux/kmemleak.h | |||
| @@ -32,8 +32,7 @@ extern void kmemleak_padding(const void *ptr, unsigned long offset, | |||
| 32 | size_t size) __ref; | 32 | size_t size) __ref; |
| 33 | extern void kmemleak_not_leak(const void *ptr) __ref; | 33 | extern void kmemleak_not_leak(const void *ptr) __ref; |
| 34 | extern void kmemleak_ignore(const void *ptr) __ref; | 34 | extern void kmemleak_ignore(const void *ptr) __ref; |
| 35 | extern void kmemleak_scan_area(const void *ptr, unsigned long offset, | 35 | extern void kmemleak_scan_area(const void *ptr, size_t size, gfp_t gfp) __ref; |
| 36 | size_t length, gfp_t gfp) __ref; | ||
| 37 | extern void kmemleak_no_scan(const void *ptr) __ref; | 36 | extern void kmemleak_no_scan(const void *ptr) __ref; |
| 38 | 37 | ||
| 39 | static inline void kmemleak_alloc_recursive(const void *ptr, size_t size, | 38 | static inline void kmemleak_alloc_recursive(const void *ptr, size_t size, |
| @@ -84,8 +83,7 @@ static inline void kmemleak_not_leak(const void *ptr) | |||
| 84 | static inline void kmemleak_ignore(const void *ptr) | 83 | static inline void kmemleak_ignore(const void *ptr) |
| 85 | { | 84 | { |
| 86 | } | 85 | } |
| 87 | static inline void kmemleak_scan_area(const void *ptr, unsigned long offset, | 86 | static inline void kmemleak_scan_area(const void *ptr, size_t size, gfp_t gfp) |
| 88 | size_t length, gfp_t gfp) | ||
| 89 | { | 87 | { |
| 90 | } | 88 | } |
| 91 | static inline void kmemleak_erase(void **ptr) | 89 | static inline void kmemleak_erase(void **ptr) |
diff --git a/include/linux/kmod.h b/include/linux/kmod.h index 384ca8bbf1ac..facb27fe7de0 100644 --- a/include/linux/kmod.h +++ b/include/linux/kmod.h | |||
| @@ -27,6 +27,7 @@ | |||
| 27 | #define KMOD_PATH_LEN 256 | 27 | #define KMOD_PATH_LEN 256 |
| 28 | 28 | ||
| 29 | #ifdef CONFIG_MODULES | 29 | #ifdef CONFIG_MODULES |
| 30 | extern char modprobe_path[]; /* for sysctl */ | ||
| 30 | /* modprobe exit status on success, -ve on error. Return value | 31 | /* modprobe exit status on success, -ve on error. Return value |
| 31 | * usually useless though. */ | 32 | * usually useless though. */ |
| 32 | extern int __request_module(bool wait, const char *name, ...) \ | 33 | extern int __request_module(bool wait, const char *name, ...) \ |
diff --git a/include/linux/kmsg_dump.h b/include/linux/kmsg_dump.h new file mode 100644 index 000000000000..24b44145a886 --- /dev/null +++ b/include/linux/kmsg_dump.h | |||
| @@ -0,0 +1,61 @@ | |||
| 1 | /* | ||
| 2 | * linux/include/kmsg_dump.h | ||
| 3 | * | ||
| 4 | * Copyright (C) 2009 Net Insight AB | ||
| 5 | * | ||
| 6 | * Author: Simon Kagstrom <simon.kagstrom@netinsight.net> | ||
| 7 | * | ||
| 8 | * This file is subject to the terms and conditions of the GNU General Public | ||
| 9 | * License. See the file COPYING in the main directory of this archive | ||
| 10 | * for more details. | ||
| 11 | */ | ||
| 12 | #ifndef _LINUX_KMSG_DUMP_H | ||
| 13 | #define _LINUX_KMSG_DUMP_H | ||
| 14 | |||
| 15 | #include <linux/list.h> | ||
| 16 | |||
| 17 | enum kmsg_dump_reason { | ||
| 18 | KMSG_DUMP_OOPS, | ||
| 19 | KMSG_DUMP_PANIC, | ||
| 20 | KMSG_DUMP_KEXEC, | ||
| 21 | }; | ||
| 22 | |||
| 23 | /** | ||
| 24 | * struct kmsg_dumper - kernel crash message dumper structure | ||
| 25 | * @dump: The callback which gets called on crashes. The buffer is passed | ||
| 26 | * as two sections, where s1 (length l1) contains the older | ||
| 27 | * messages and s2 (length l2) contains the newer. | ||
| 28 | * @list: Entry in the dumper list (private) | ||
| 29 | * @registered: Flag that specifies if this is already registered | ||
| 30 | */ | ||
| 31 | struct kmsg_dumper { | ||
| 32 | void (*dump)(struct kmsg_dumper *dumper, enum kmsg_dump_reason reason, | ||
| 33 | const char *s1, unsigned long l1, | ||
| 34 | const char *s2, unsigned long l2); | ||
| 35 | struct list_head list; | ||
| 36 | int registered; | ||
| 37 | }; | ||
| 38 | |||
| 39 | #ifdef CONFIG_PRINTK | ||
| 40 | void kmsg_dump(enum kmsg_dump_reason reason); | ||
| 41 | |||
| 42 | int kmsg_dump_register(struct kmsg_dumper *dumper); | ||
| 43 | |||
| 44 | int kmsg_dump_unregister(struct kmsg_dumper *dumper); | ||
| 45 | #else | ||
| 46 | static inline void kmsg_dump(enum kmsg_dump_reason reason) | ||
| 47 | { | ||
| 48 | } | ||
| 49 | |||
| 50 | static inline int kmsg_dump_register(struct kmsg_dumper *dumper) | ||
| 51 | { | ||
| 52 | return -EINVAL; | ||
| 53 | } | ||
| 54 | |||
| 55 | static inline int kmsg_dump_unregister(struct kmsg_dumper *dumper) | ||
| 56 | { | ||
| 57 | return -EINVAL; | ||
| 58 | } | ||
| 59 | #endif | ||
| 60 | |||
| 61 | #endif /* _LINUX_KMSG_DUMP_H */ | ||
diff --git a/include/linux/kobject.h b/include/linux/kobject.h index 58ae8e00fcdd..3950d3c2850d 100644 --- a/include/linux/kobject.h +++ b/include/linux/kobject.h | |||
| @@ -106,7 +106,7 @@ extern char *kobject_get_path(struct kobject *kobj, gfp_t flag); | |||
| 106 | 106 | ||
| 107 | struct kobj_type { | 107 | struct kobj_type { |
| 108 | void (*release)(struct kobject *kobj); | 108 | void (*release)(struct kobject *kobj); |
| 109 | struct sysfs_ops *sysfs_ops; | 109 | const struct sysfs_ops *sysfs_ops; |
| 110 | struct attribute **default_attrs; | 110 | struct attribute **default_attrs; |
| 111 | }; | 111 | }; |
| 112 | 112 | ||
| @@ -118,9 +118,9 @@ struct kobj_uevent_env { | |||
| 118 | }; | 118 | }; |
| 119 | 119 | ||
| 120 | struct kset_uevent_ops { | 120 | struct kset_uevent_ops { |
| 121 | int (*filter)(struct kset *kset, struct kobject *kobj); | 121 | int (* const filter)(struct kset *kset, struct kobject *kobj); |
| 122 | const char *(*name)(struct kset *kset, struct kobject *kobj); | 122 | const char *(* const name)(struct kset *kset, struct kobject *kobj); |
| 123 | int (*uevent)(struct kset *kset, struct kobject *kobj, | 123 | int (* const uevent)(struct kset *kset, struct kobject *kobj, |
| 124 | struct kobj_uevent_env *env); | 124 | struct kobj_uevent_env *env); |
| 125 | }; | 125 | }; |
| 126 | 126 | ||
| @@ -132,7 +132,7 @@ struct kobj_attribute { | |||
| 132 | const char *buf, size_t count); | 132 | const char *buf, size_t count); |
| 133 | }; | 133 | }; |
| 134 | 134 | ||
| 135 | extern struct sysfs_ops kobj_sysfs_ops; | 135 | extern const struct sysfs_ops kobj_sysfs_ops; |
| 136 | 136 | ||
| 137 | /** | 137 | /** |
| 138 | * struct kset - a set of kobjects of a specific type, belonging to a specific subsystem. | 138 | * struct kset - a set of kobjects of a specific type, belonging to a specific subsystem. |
| @@ -155,14 +155,14 @@ struct kset { | |||
| 155 | struct list_head list; | 155 | struct list_head list; |
| 156 | spinlock_t list_lock; | 156 | spinlock_t list_lock; |
| 157 | struct kobject kobj; | 157 | struct kobject kobj; |
| 158 | struct kset_uevent_ops *uevent_ops; | 158 | const struct kset_uevent_ops *uevent_ops; |
| 159 | }; | 159 | }; |
| 160 | 160 | ||
| 161 | extern void kset_init(struct kset *kset); | 161 | extern void kset_init(struct kset *kset); |
| 162 | extern int __must_check kset_register(struct kset *kset); | 162 | extern int __must_check kset_register(struct kset *kset); |
| 163 | extern void kset_unregister(struct kset *kset); | 163 | extern void kset_unregister(struct kset *kset); |
| 164 | extern struct kset * __must_check kset_create_and_add(const char *name, | 164 | extern struct kset * __must_check kset_create_and_add(const char *name, |
| 165 | struct kset_uevent_ops *u, | 165 | const struct kset_uevent_ops *u, |
| 166 | struct kobject *parent_kobj); | 166 | struct kobject *parent_kobj); |
| 167 | 167 | ||
| 168 | static inline struct kset *to_kset(struct kobject *kobj) | 168 | static inline struct kset *to_kset(struct kobject *kobj) |
diff --git a/include/linux/kprobes.h b/include/linux/kprobes.h index 3a46b7b7abb2..e7d1b2e0070d 100644 --- a/include/linux/kprobes.h +++ b/include/linux/kprobes.h | |||
| @@ -122,6 +122,11 @@ struct kprobe { | |||
| 122 | /* Kprobe status flags */ | 122 | /* Kprobe status flags */ |
| 123 | #define KPROBE_FLAG_GONE 1 /* breakpoint has already gone */ | 123 | #define KPROBE_FLAG_GONE 1 /* breakpoint has already gone */ |
| 124 | #define KPROBE_FLAG_DISABLED 2 /* probe is temporarily disabled */ | 124 | #define KPROBE_FLAG_DISABLED 2 /* probe is temporarily disabled */ |
| 125 | #define KPROBE_FLAG_OPTIMIZED 4 /* | ||
| 126 | * probe is really optimized. | ||
| 127 | * NOTE: | ||
| 128 | * this flag is only for optimized_kprobe. | ||
| 129 | */ | ||
| 125 | 130 | ||
| 126 | /* Has this kprobe gone ? */ | 131 | /* Has this kprobe gone ? */ |
| 127 | static inline int kprobe_gone(struct kprobe *p) | 132 | static inline int kprobe_gone(struct kprobe *p) |
| @@ -134,6 +139,12 @@ static inline int kprobe_disabled(struct kprobe *p) | |||
| 134 | { | 139 | { |
| 135 | return p->flags & (KPROBE_FLAG_DISABLED | KPROBE_FLAG_GONE); | 140 | return p->flags & (KPROBE_FLAG_DISABLED | KPROBE_FLAG_GONE); |
| 136 | } | 141 | } |
| 142 | |||
| 143 | /* Is this kprobe really running optimized path ? */ | ||
| 144 | static inline int kprobe_optimized(struct kprobe *p) | ||
| 145 | { | ||
| 146 | return p->flags & KPROBE_FLAG_OPTIMIZED; | ||
| 147 | } | ||
| 137 | /* | 148 | /* |
| 138 | * Special probe type that uses setjmp-longjmp type tricks to resume | 149 | * Special probe type that uses setjmp-longjmp type tricks to resume |
| 139 | * execution at a specified entry with a matching prototype corresponding | 150 | * execution at a specified entry with a matching prototype corresponding |
| @@ -249,6 +260,39 @@ extern kprobe_opcode_t *get_insn_slot(void); | |||
| 249 | extern void free_insn_slot(kprobe_opcode_t *slot, int dirty); | 260 | extern void free_insn_slot(kprobe_opcode_t *slot, int dirty); |
| 250 | extern void kprobes_inc_nmissed_count(struct kprobe *p); | 261 | extern void kprobes_inc_nmissed_count(struct kprobe *p); |
| 251 | 262 | ||
| 263 | #ifdef CONFIG_OPTPROBES | ||
| 264 | /* | ||
| 265 | * Internal structure for direct jump optimized probe | ||
| 266 | */ | ||
| 267 | struct optimized_kprobe { | ||
| 268 | struct kprobe kp; | ||
| 269 | struct list_head list; /* list for optimizing queue */ | ||
| 270 | struct arch_optimized_insn optinsn; | ||
| 271 | }; | ||
| 272 | |||
| 273 | /* Architecture dependent functions for direct jump optimization */ | ||
| 274 | extern int arch_prepared_optinsn(struct arch_optimized_insn *optinsn); | ||
| 275 | extern int arch_check_optimized_kprobe(struct optimized_kprobe *op); | ||
| 276 | extern int arch_prepare_optimized_kprobe(struct optimized_kprobe *op); | ||
| 277 | extern void arch_remove_optimized_kprobe(struct optimized_kprobe *op); | ||
| 278 | extern int arch_optimize_kprobe(struct optimized_kprobe *op); | ||
| 279 | extern void arch_unoptimize_kprobe(struct optimized_kprobe *op); | ||
| 280 | extern kprobe_opcode_t *get_optinsn_slot(void); | ||
| 281 | extern void free_optinsn_slot(kprobe_opcode_t *slot, int dirty); | ||
| 282 | extern int arch_within_optimized_kprobe(struct optimized_kprobe *op, | ||
| 283 | unsigned long addr); | ||
| 284 | |||
| 285 | extern void opt_pre_handler(struct kprobe *p, struct pt_regs *regs); | ||
| 286 | |||
| 287 | #ifdef CONFIG_SYSCTL | ||
| 288 | extern int sysctl_kprobes_optimization; | ||
| 289 | extern int proc_kprobes_optimization_handler(struct ctl_table *table, | ||
| 290 | int write, void __user *buffer, | ||
| 291 | size_t *length, loff_t *ppos); | ||
| 292 | #endif | ||
| 293 | |||
| 294 | #endif /* CONFIG_OPTPROBES */ | ||
| 295 | |||
| 252 | /* Get the kprobe at this addr (if any) - called with preemption disabled */ | 296 | /* Get the kprobe at this addr (if any) - called with preemption disabled */ |
| 253 | struct kprobe *get_kprobe(void *addr); | 297 | struct kprobe *get_kprobe(void *addr); |
| 254 | void kretprobe_hash_lock(struct task_struct *tsk, | 298 | void kretprobe_hash_lock(struct task_struct *tsk, |
| @@ -296,6 +340,8 @@ void recycle_rp_inst(struct kretprobe_instance *ri, struct hlist_head *head); | |||
| 296 | int disable_kprobe(struct kprobe *kp); | 340 | int disable_kprobe(struct kprobe *kp); |
| 297 | int enable_kprobe(struct kprobe *kp); | 341 | int enable_kprobe(struct kprobe *kp); |
| 298 | 342 | ||
| 343 | void dump_kprobe(struct kprobe *kp); | ||
| 344 | |||
| 299 | #else /* !CONFIG_KPROBES: */ | 345 | #else /* !CONFIG_KPROBES: */ |
| 300 | 346 | ||
| 301 | static inline int kprobes_built_in(void) | 347 | static inline int kprobes_built_in(void) |
diff --git a/include/linux/ksm.h b/include/linux/ksm.h index a485c14ecd5d..43bdab769fc3 100644 --- a/include/linux/ksm.h +++ b/include/linux/ksm.h | |||
| @@ -9,8 +9,12 @@ | |||
| 9 | 9 | ||
| 10 | #include <linux/bitops.h> | 10 | #include <linux/bitops.h> |
| 11 | #include <linux/mm.h> | 11 | #include <linux/mm.h> |
| 12 | #include <linux/pagemap.h> | ||
| 13 | #include <linux/rmap.h> | ||
| 12 | #include <linux/sched.h> | 14 | #include <linux/sched.h> |
| 13 | #include <linux/vmstat.h> | 15 | |
| 16 | struct stable_node; | ||
| 17 | struct mem_cgroup; | ||
| 14 | 18 | ||
| 15 | #ifdef CONFIG_KSM | 19 | #ifdef CONFIG_KSM |
| 16 | int ksm_madvise(struct vm_area_struct *vma, unsigned long start, | 20 | int ksm_madvise(struct vm_area_struct *vma, unsigned long start, |
| @@ -34,46 +38,110 @@ static inline void ksm_exit(struct mm_struct *mm) | |||
| 34 | /* | 38 | /* |
| 35 | * A KSM page is one of those write-protected "shared pages" or "merged pages" | 39 | * A KSM page is one of those write-protected "shared pages" or "merged pages" |
| 36 | * which KSM maps into multiple mms, wherever identical anonymous page content | 40 | * which KSM maps into multiple mms, wherever identical anonymous page content |
| 37 | * is found in VM_MERGEABLE vmas. It's a PageAnon page, with NULL anon_vma. | 41 | * is found in VM_MERGEABLE vmas. It's a PageAnon page, pointing not to any |
| 42 | * anon_vma, but to that page's node of the stable tree. | ||
| 38 | */ | 43 | */ |
| 39 | static inline int PageKsm(struct page *page) | 44 | static inline int PageKsm(struct page *page) |
| 40 | { | 45 | { |
| 41 | return ((unsigned long)page->mapping == PAGE_MAPPING_ANON); | 46 | return ((unsigned long)page->mapping & PAGE_MAPPING_FLAGS) == |
| 47 | (PAGE_MAPPING_ANON | PAGE_MAPPING_KSM); | ||
| 48 | } | ||
| 49 | |||
| 50 | static inline struct stable_node *page_stable_node(struct page *page) | ||
| 51 | { | ||
| 52 | return PageKsm(page) ? page_rmapping(page) : NULL; | ||
| 53 | } | ||
| 54 | |||
| 55 | static inline void set_page_stable_node(struct page *page, | ||
| 56 | struct stable_node *stable_node) | ||
| 57 | { | ||
| 58 | page->mapping = (void *)stable_node + | ||
| 59 | (PAGE_MAPPING_ANON | PAGE_MAPPING_KSM); | ||
| 42 | } | 60 | } |
| 43 | 61 | ||
| 44 | /* | 62 | /* |
| 45 | * But we have to avoid the checking which page_add_anon_rmap() performs. | 63 | * When do_swap_page() first faults in from swap what used to be a KSM page, |
| 64 | * no problem, it will be assigned to this vma's anon_vma; but thereafter, | ||
| 65 | * it might be faulted into a different anon_vma (or perhaps to a different | ||
| 66 | * offset in the same anon_vma). do_swap_page() cannot do all the locking | ||
| 67 | * needed to reconstitute a cross-anon_vma KSM page: for now it has to make | ||
| 68 | * a copy, and leave remerging the pages to a later pass of ksmd. | ||
| 69 | * | ||
| 70 | * We'd like to make this conditional on vma->vm_flags & VM_MERGEABLE, | ||
| 71 | * but what if the vma was unmerged while the page was swapped out? | ||
| 46 | */ | 72 | */ |
| 47 | static inline void page_add_ksm_rmap(struct page *page) | 73 | struct page *ksm_does_need_to_copy(struct page *page, |
| 74 | struct vm_area_struct *vma, unsigned long address); | ||
| 75 | static inline struct page *ksm_might_need_to_copy(struct page *page, | ||
| 76 | struct vm_area_struct *vma, unsigned long address) | ||
| 48 | { | 77 | { |
| 49 | if (atomic_inc_and_test(&page->_mapcount)) { | 78 | struct anon_vma *anon_vma = page_anon_vma(page); |
| 50 | page->mapping = (void *) PAGE_MAPPING_ANON; | 79 | |
| 51 | __inc_zone_page_state(page, NR_ANON_PAGES); | 80 | if (!anon_vma || |
| 52 | } | 81 | (anon_vma == vma->anon_vma && |
| 82 | page->index == linear_page_index(vma, address))) | ||
| 83 | return page; | ||
| 84 | |||
| 85 | return ksm_does_need_to_copy(page, vma, address); | ||
| 53 | } | 86 | } |
| 87 | |||
| 88 | int page_referenced_ksm(struct page *page, | ||
| 89 | struct mem_cgroup *memcg, unsigned long *vm_flags); | ||
| 90 | int try_to_unmap_ksm(struct page *page, enum ttu_flags flags); | ||
| 91 | int rmap_walk_ksm(struct page *page, int (*rmap_one)(struct page *, | ||
| 92 | struct vm_area_struct *, unsigned long, void *), void *arg); | ||
| 93 | void ksm_migrate_page(struct page *newpage, struct page *oldpage); | ||
| 94 | |||
| 54 | #else /* !CONFIG_KSM */ | 95 | #else /* !CONFIG_KSM */ |
| 55 | 96 | ||
| 97 | static inline int ksm_fork(struct mm_struct *mm, struct mm_struct *oldmm) | ||
| 98 | { | ||
| 99 | return 0; | ||
| 100 | } | ||
| 101 | |||
| 102 | static inline void ksm_exit(struct mm_struct *mm) | ||
| 103 | { | ||
| 104 | } | ||
| 105 | |||
| 106 | static inline int PageKsm(struct page *page) | ||
| 107 | { | ||
| 108 | return 0; | ||
| 109 | } | ||
| 110 | |||
| 111 | #ifdef CONFIG_MMU | ||
| 56 | static inline int ksm_madvise(struct vm_area_struct *vma, unsigned long start, | 112 | static inline int ksm_madvise(struct vm_area_struct *vma, unsigned long start, |
| 57 | unsigned long end, int advice, unsigned long *vm_flags) | 113 | unsigned long end, int advice, unsigned long *vm_flags) |
| 58 | { | 114 | { |
| 59 | return 0; | 115 | return 0; |
| 60 | } | 116 | } |
| 61 | 117 | ||
| 62 | static inline int ksm_fork(struct mm_struct *mm, struct mm_struct *oldmm) | 118 | static inline struct page *ksm_might_need_to_copy(struct page *page, |
| 119 | struct vm_area_struct *vma, unsigned long address) | ||
| 120 | { | ||
| 121 | return page; | ||
| 122 | } | ||
| 123 | |||
| 124 | static inline int page_referenced_ksm(struct page *page, | ||
| 125 | struct mem_cgroup *memcg, unsigned long *vm_flags) | ||
| 63 | { | 126 | { |
| 64 | return 0; | 127 | return 0; |
| 65 | } | 128 | } |
| 66 | 129 | ||
| 67 | static inline void ksm_exit(struct mm_struct *mm) | 130 | static inline int try_to_unmap_ksm(struct page *page, enum ttu_flags flags) |
| 68 | { | 131 | { |
| 132 | return 0; | ||
| 69 | } | 133 | } |
| 70 | 134 | ||
| 71 | static inline int PageKsm(struct page *page) | 135 | static inline int rmap_walk_ksm(struct page *page, int (*rmap_one)(struct page*, |
| 136 | struct vm_area_struct *, unsigned long, void *), void *arg) | ||
| 72 | { | 137 | { |
| 73 | return 0; | 138 | return 0; |
| 74 | } | 139 | } |
| 75 | 140 | ||
| 76 | /* No stub required for page_add_ksm_rmap(page) */ | 141 | static inline void ksm_migrate_page(struct page *newpage, struct page *oldpage) |
| 142 | { | ||
| 143 | } | ||
| 144 | #endif /* CONFIG_MMU */ | ||
| 77 | #endif /* !CONFIG_KSM */ | 145 | #endif /* !CONFIG_KSM */ |
| 78 | 146 | ||
| 79 | #endif | 147 | #endif /* __LINUX_KSM_H */ |
diff --git a/include/linux/kvm.h b/include/linux/kvm.h index f8f8900fc5ec..60df9c84ecae 100644 --- a/include/linux/kvm.h +++ b/include/linux/kvm.h | |||
| @@ -14,12 +14,76 @@ | |||
| 14 | 14 | ||
| 15 | #define KVM_API_VERSION 12 | 15 | #define KVM_API_VERSION 12 |
| 16 | 16 | ||
| 17 | /* for KVM_TRACE_ENABLE, deprecated */ | 17 | /* *** Deprecated interfaces *** */ |
| 18 | |||
| 19 | #define KVM_TRC_SHIFT 16 | ||
| 20 | |||
| 21 | #define KVM_TRC_ENTRYEXIT (1 << KVM_TRC_SHIFT) | ||
| 22 | #define KVM_TRC_HANDLER (1 << (KVM_TRC_SHIFT + 1)) | ||
| 23 | |||
| 24 | #define KVM_TRC_VMENTRY (KVM_TRC_ENTRYEXIT + 0x01) | ||
| 25 | #define KVM_TRC_VMEXIT (KVM_TRC_ENTRYEXIT + 0x02) | ||
| 26 | #define KVM_TRC_PAGE_FAULT (KVM_TRC_HANDLER + 0x01) | ||
| 27 | |||
| 28 | #define KVM_TRC_HEAD_SIZE 12 | ||
| 29 | #define KVM_TRC_CYCLE_SIZE 8 | ||
| 30 | #define KVM_TRC_EXTRA_MAX 7 | ||
| 31 | |||
| 32 | #define KVM_TRC_INJ_VIRQ (KVM_TRC_HANDLER + 0x02) | ||
| 33 | #define KVM_TRC_REDELIVER_EVT (KVM_TRC_HANDLER + 0x03) | ||
| 34 | #define KVM_TRC_PEND_INTR (KVM_TRC_HANDLER + 0x04) | ||
| 35 | #define KVM_TRC_IO_READ (KVM_TRC_HANDLER + 0x05) | ||
| 36 | #define KVM_TRC_IO_WRITE (KVM_TRC_HANDLER + 0x06) | ||
| 37 | #define KVM_TRC_CR_READ (KVM_TRC_HANDLER + 0x07) | ||
| 38 | #define KVM_TRC_CR_WRITE (KVM_TRC_HANDLER + 0x08) | ||
| 39 | #define KVM_TRC_DR_READ (KVM_TRC_HANDLER + 0x09) | ||
| 40 | #define KVM_TRC_DR_WRITE (KVM_TRC_HANDLER + 0x0A) | ||
| 41 | #define KVM_TRC_MSR_READ (KVM_TRC_HANDLER + 0x0B) | ||
| 42 | #define KVM_TRC_MSR_WRITE (KVM_TRC_HANDLER + 0x0C) | ||
| 43 | #define KVM_TRC_CPUID (KVM_TRC_HANDLER + 0x0D) | ||
| 44 | #define KVM_TRC_INTR (KVM_TRC_HANDLER + 0x0E) | ||
| 45 | #define KVM_TRC_NMI (KVM_TRC_HANDLER + 0x0F) | ||
| 46 | #define KVM_TRC_VMMCALL (KVM_TRC_HANDLER + 0x10) | ||
| 47 | #define KVM_TRC_HLT (KVM_TRC_HANDLER + 0x11) | ||
| 48 | #define KVM_TRC_CLTS (KVM_TRC_HANDLER + 0x12) | ||
| 49 | #define KVM_TRC_LMSW (KVM_TRC_HANDLER + 0x13) | ||
| 50 | #define KVM_TRC_APIC_ACCESS (KVM_TRC_HANDLER + 0x14) | ||
| 51 | #define KVM_TRC_TDP_FAULT (KVM_TRC_HANDLER + 0x15) | ||
| 52 | #define KVM_TRC_GTLB_WRITE (KVM_TRC_HANDLER + 0x16) | ||
| 53 | #define KVM_TRC_STLB_WRITE (KVM_TRC_HANDLER + 0x17) | ||
| 54 | #define KVM_TRC_STLB_INVAL (KVM_TRC_HANDLER + 0x18) | ||
| 55 | #define KVM_TRC_PPC_INSTR (KVM_TRC_HANDLER + 0x19) | ||
| 56 | |||
| 18 | struct kvm_user_trace_setup { | 57 | struct kvm_user_trace_setup { |
| 19 | __u32 buf_size; /* sub_buffer size of each per-cpu */ | 58 | __u32 buf_size; |
| 20 | __u32 buf_nr; /* the number of sub_buffers of each per-cpu */ | 59 | __u32 buf_nr; |
| 60 | }; | ||
| 61 | |||
| 62 | #define __KVM_DEPRECATED_MAIN_W_0x06 \ | ||
| 63 | _IOW(KVMIO, 0x06, struct kvm_user_trace_setup) | ||
| 64 | #define __KVM_DEPRECATED_MAIN_0x07 _IO(KVMIO, 0x07) | ||
| 65 | #define __KVM_DEPRECATED_MAIN_0x08 _IO(KVMIO, 0x08) | ||
| 66 | |||
| 67 | #define __KVM_DEPRECATED_VM_R_0x70 _IOR(KVMIO, 0x70, struct kvm_assigned_irq) | ||
| 68 | |||
| 69 | struct kvm_breakpoint { | ||
| 70 | __u32 enabled; | ||
| 71 | __u32 padding; | ||
| 72 | __u64 address; | ||
| 73 | }; | ||
| 74 | |||
| 75 | struct kvm_debug_guest { | ||
| 76 | __u32 enabled; | ||
| 77 | __u32 pad; | ||
| 78 | struct kvm_breakpoint breakpoints[4]; | ||
| 79 | __u32 singlestep; | ||
| 21 | }; | 80 | }; |
| 22 | 81 | ||
| 82 | #define __KVM_DEPRECATED_VCPU_W_0x87 _IOW(KVMIO, 0x87, struct kvm_debug_guest) | ||
| 83 | |||
| 84 | /* *** End of deprecated interfaces *** */ | ||
| 85 | |||
| 86 | |||
| 23 | /* for KVM_CREATE_MEMORY_REGION */ | 87 | /* for KVM_CREATE_MEMORY_REGION */ |
| 24 | struct kvm_memory_region { | 88 | struct kvm_memory_region { |
| 25 | __u32 slot; | 89 | __u32 slot; |
| @@ -39,7 +103,7 @@ struct kvm_userspace_memory_region { | |||
| 39 | 103 | ||
| 40 | /* for kvm_memory_region::flags */ | 104 | /* for kvm_memory_region::flags */ |
| 41 | #define KVM_MEM_LOG_DIRTY_PAGES 1UL | 105 | #define KVM_MEM_LOG_DIRTY_PAGES 1UL |
| 42 | 106 | #define KVM_MEMSLOT_INVALID (1UL << 1) | |
| 43 | 107 | ||
| 44 | /* for KVM_IRQ_LINE */ | 108 | /* for KVM_IRQ_LINE */ |
| 45 | struct kvm_irq_level { | 109 | struct kvm_irq_level { |
| @@ -99,6 +163,7 @@ struct kvm_pit_config { | |||
| 99 | 163 | ||
| 100 | /* For KVM_EXIT_INTERNAL_ERROR */ | 164 | /* For KVM_EXIT_INTERNAL_ERROR */ |
| 101 | #define KVM_INTERNAL_ERROR_EMULATION 1 | 165 | #define KVM_INTERNAL_ERROR_EMULATION 1 |
| 166 | #define KVM_INTERNAL_ERROR_SIMUL_EX 2 | ||
| 102 | 167 | ||
| 103 | /* for KVM_RUN, returned by mmap(vcpu_fd, offset=0) */ | 168 | /* for KVM_RUN, returned by mmap(vcpu_fd, offset=0) */ |
| 104 | struct kvm_run { | 169 | struct kvm_run { |
| @@ -116,6 +181,11 @@ struct kvm_run { | |||
| 116 | __u64 cr8; | 181 | __u64 cr8; |
| 117 | __u64 apic_base; | 182 | __u64 apic_base; |
| 118 | 183 | ||
| 184 | #ifdef __KVM_S390 | ||
| 185 | /* the processor status word for s390 */ | ||
| 186 | __u64 psw_mask; /* psw upper half */ | ||
| 187 | __u64 psw_addr; /* psw lower half */ | ||
| 188 | #endif | ||
| 119 | union { | 189 | union { |
| 120 | /* KVM_EXIT_UNKNOWN */ | 190 | /* KVM_EXIT_UNKNOWN */ |
| 121 | struct { | 191 | struct { |
| @@ -167,8 +237,6 @@ struct kvm_run { | |||
| 167 | /* KVM_EXIT_S390_SIEIC */ | 237 | /* KVM_EXIT_S390_SIEIC */ |
| 168 | struct { | 238 | struct { |
| 169 | __u8 icptcode; | 239 | __u8 icptcode; |
| 170 | __u64 mask; /* psw upper half */ | ||
| 171 | __u64 addr; /* psw lower half */ | ||
| 172 | __u16 ipa; | 240 | __u16 ipa; |
| 173 | __u32 ipb; | 241 | __u32 ipb; |
| 174 | } s390_sieic; | 242 | } s390_sieic; |
| @@ -187,6 +255,9 @@ struct kvm_run { | |||
| 187 | } dcr; | 255 | } dcr; |
| 188 | struct { | 256 | struct { |
| 189 | __u32 suberror; | 257 | __u32 suberror; |
| 258 | /* Available with KVM_CAP_INTERNAL_ERROR_DATA: */ | ||
| 259 | __u32 ndata; | ||
| 260 | __u64 data[16]; | ||
| 190 | } internal; | 261 | } internal; |
| 191 | /* Fix the size of the union. */ | 262 | /* Fix the size of the union. */ |
| 192 | char padding[256]; | 263 | char padding[256]; |
| @@ -329,24 +400,6 @@ struct kvm_ioeventfd { | |||
| 329 | __u8 pad[36]; | 400 | __u8 pad[36]; |
| 330 | }; | 401 | }; |
| 331 | 402 | ||
| 332 | #define KVM_TRC_SHIFT 16 | ||
| 333 | /* | ||
| 334 | * kvm trace categories | ||
| 335 | */ | ||
| 336 | #define KVM_TRC_ENTRYEXIT (1 << KVM_TRC_SHIFT) | ||
| 337 | #define KVM_TRC_HANDLER (1 << (KVM_TRC_SHIFT + 1)) /* only 12 bits */ | ||
| 338 | |||
| 339 | /* | ||
| 340 | * kvm trace action | ||
| 341 | */ | ||
| 342 | #define KVM_TRC_VMENTRY (KVM_TRC_ENTRYEXIT + 0x01) | ||
| 343 | #define KVM_TRC_VMEXIT (KVM_TRC_ENTRYEXIT + 0x02) | ||
| 344 | #define KVM_TRC_PAGE_FAULT (KVM_TRC_HANDLER + 0x01) | ||
| 345 | |||
| 346 | #define KVM_TRC_HEAD_SIZE 12 | ||
| 347 | #define KVM_TRC_CYCLE_SIZE 8 | ||
| 348 | #define KVM_TRC_EXTRA_MAX 7 | ||
| 349 | |||
| 350 | #define KVMIO 0xAE | 403 | #define KVMIO 0xAE |
| 351 | 404 | ||
| 352 | /* | 405 | /* |
| @@ -367,12 +420,10 @@ struct kvm_ioeventfd { | |||
| 367 | */ | 420 | */ |
| 368 | #define KVM_GET_VCPU_MMAP_SIZE _IO(KVMIO, 0x04) /* in bytes */ | 421 | #define KVM_GET_VCPU_MMAP_SIZE _IO(KVMIO, 0x04) /* in bytes */ |
| 369 | #define KVM_GET_SUPPORTED_CPUID _IOWR(KVMIO, 0x05, struct kvm_cpuid2) | 422 | #define KVM_GET_SUPPORTED_CPUID _IOWR(KVMIO, 0x05, struct kvm_cpuid2) |
| 370 | /* | 423 | #define KVM_TRACE_ENABLE __KVM_DEPRECATED_MAIN_W_0x06 |
| 371 | * ioctls for kvm trace | 424 | #define KVM_TRACE_PAUSE __KVM_DEPRECATED_MAIN_0x07 |
| 372 | */ | 425 | #define KVM_TRACE_DISABLE __KVM_DEPRECATED_MAIN_0x08 |
| 373 | #define KVM_TRACE_ENABLE _IOW(KVMIO, 0x06, struct kvm_user_trace_setup) | 426 | |
| 374 | #define KVM_TRACE_PAUSE _IO(KVMIO, 0x07) | ||
| 375 | #define KVM_TRACE_DISABLE _IO(KVMIO, 0x08) | ||
| 376 | /* | 427 | /* |
| 377 | * Extension capability list. | 428 | * Extension capability list. |
| 378 | */ | 429 | */ |
| @@ -436,6 +487,21 @@ struct kvm_ioeventfd { | |||
| 436 | #endif | 487 | #endif |
| 437 | #define KVM_CAP_IOEVENTFD 36 | 488 | #define KVM_CAP_IOEVENTFD 36 |
| 438 | #define KVM_CAP_SET_IDENTITY_MAP_ADDR 37 | 489 | #define KVM_CAP_SET_IDENTITY_MAP_ADDR 37 |
| 490 | #ifdef __KVM_HAVE_XEN_HVM | ||
| 491 | #define KVM_CAP_XEN_HVM 38 | ||
| 492 | #endif | ||
| 493 | #define KVM_CAP_ADJUST_CLOCK 39 | ||
| 494 | #define KVM_CAP_INTERNAL_ERROR_DATA 40 | ||
| 495 | #ifdef __KVM_HAVE_VCPU_EVENTS | ||
| 496 | #define KVM_CAP_VCPU_EVENTS 41 | ||
| 497 | #endif | ||
| 498 | #define KVM_CAP_S390_PSW 42 | ||
| 499 | #define KVM_CAP_PPC_SEGSTATE 43 | ||
| 500 | #define KVM_CAP_HYPERV 44 | ||
| 501 | #define KVM_CAP_HYPERV_VAPIC 45 | ||
| 502 | #define KVM_CAP_HYPERV_SPIN 46 | ||
| 503 | #define KVM_CAP_PCI_SEGMENT 47 | ||
| 504 | #define KVM_CAP_X86_ROBUST_SINGLESTEP 51 | ||
| 439 | 505 | ||
| 440 | #ifdef KVM_CAP_IRQ_ROUTING | 506 | #ifdef KVM_CAP_IRQ_ROUTING |
| 441 | 507 | ||
| @@ -488,6 +554,18 @@ struct kvm_x86_mce { | |||
| 488 | }; | 554 | }; |
| 489 | #endif | 555 | #endif |
| 490 | 556 | ||
| 557 | #ifdef KVM_CAP_XEN_HVM | ||
| 558 | struct kvm_xen_hvm_config { | ||
| 559 | __u32 flags; | ||
| 560 | __u32 msr; | ||
| 561 | __u64 blob_addr_32; | ||
| 562 | __u64 blob_addr_64; | ||
| 563 | __u8 blob_size_32; | ||
| 564 | __u8 blob_size_64; | ||
| 565 | __u8 pad2[30]; | ||
| 566 | }; | ||
| 567 | #endif | ||
| 568 | |||
| 491 | #define KVM_IRQFD_FLAG_DEASSIGN (1 << 0) | 569 | #define KVM_IRQFD_FLAG_DEASSIGN (1 << 0) |
| 492 | 570 | ||
| 493 | struct kvm_irqfd { | 571 | struct kvm_irqfd { |
| @@ -497,55 +575,66 @@ struct kvm_irqfd { | |||
| 497 | __u8 pad[20]; | 575 | __u8 pad[20]; |
| 498 | }; | 576 | }; |
| 499 | 577 | ||
| 578 | struct kvm_clock_data { | ||
| 579 | __u64 clock; | ||
| 580 | __u32 flags; | ||
| 581 | __u32 pad[9]; | ||
| 582 | }; | ||
| 583 | |||
| 500 | /* | 584 | /* |
| 501 | * ioctls for VM fds | 585 | * ioctls for VM fds |
| 502 | */ | 586 | */ |
| 503 | #define KVM_SET_MEMORY_REGION _IOW(KVMIO, 0x40, struct kvm_memory_region) | 587 | #define KVM_SET_MEMORY_REGION _IOW(KVMIO, 0x40, struct kvm_memory_region) |
| 504 | /* | 588 | /* |
| 505 | * KVM_CREATE_VCPU receives as a parameter the vcpu slot, and returns | 589 | * KVM_CREATE_VCPU receives as a parameter the vcpu slot, and returns |
| 506 | * a vcpu fd. | 590 | * a vcpu fd. |
| 507 | */ | 591 | */ |
| 508 | #define KVM_CREATE_VCPU _IO(KVMIO, 0x41) | 592 | #define KVM_CREATE_VCPU _IO(KVMIO, 0x41) |
| 509 | #define KVM_GET_DIRTY_LOG _IOW(KVMIO, 0x42, struct kvm_dirty_log) | 593 | #define KVM_GET_DIRTY_LOG _IOW(KVMIO, 0x42, struct kvm_dirty_log) |
| 510 | #define KVM_SET_MEMORY_ALIAS _IOW(KVMIO, 0x43, struct kvm_memory_alias) | 594 | #define KVM_SET_MEMORY_ALIAS _IOW(KVMIO, 0x43, struct kvm_memory_alias) |
| 511 | #define KVM_SET_NR_MMU_PAGES _IO(KVMIO, 0x44) | 595 | #define KVM_SET_NR_MMU_PAGES _IO(KVMIO, 0x44) |
| 512 | #define KVM_GET_NR_MMU_PAGES _IO(KVMIO, 0x45) | 596 | #define KVM_GET_NR_MMU_PAGES _IO(KVMIO, 0x45) |
| 513 | #define KVM_SET_USER_MEMORY_REGION _IOW(KVMIO, 0x46,\ | 597 | #define KVM_SET_USER_MEMORY_REGION _IOW(KVMIO, 0x46, \ |
| 514 | struct kvm_userspace_memory_region) | 598 | struct kvm_userspace_memory_region) |
| 515 | #define KVM_SET_TSS_ADDR _IO(KVMIO, 0x47) | 599 | #define KVM_SET_TSS_ADDR _IO(KVMIO, 0x47) |
| 516 | #define KVM_SET_IDENTITY_MAP_ADDR _IOW(KVMIO, 0x48, __u64) | 600 | #define KVM_SET_IDENTITY_MAP_ADDR _IOW(KVMIO, 0x48, __u64) |
| 517 | /* Device model IOC */ | 601 | /* Device model IOC */ |
| 518 | #define KVM_CREATE_IRQCHIP _IO(KVMIO, 0x60) | 602 | #define KVM_CREATE_IRQCHIP _IO(KVMIO, 0x60) |
| 519 | #define KVM_IRQ_LINE _IOW(KVMIO, 0x61, struct kvm_irq_level) | 603 | #define KVM_IRQ_LINE _IOW(KVMIO, 0x61, struct kvm_irq_level) |
| 520 | #define KVM_GET_IRQCHIP _IOWR(KVMIO, 0x62, struct kvm_irqchip) | 604 | #define KVM_GET_IRQCHIP _IOWR(KVMIO, 0x62, struct kvm_irqchip) |
| 521 | #define KVM_SET_IRQCHIP _IOR(KVMIO, 0x63, struct kvm_irqchip) | 605 | #define KVM_SET_IRQCHIP _IOR(KVMIO, 0x63, struct kvm_irqchip) |
| 522 | #define KVM_CREATE_PIT _IO(KVMIO, 0x64) | 606 | #define KVM_CREATE_PIT _IO(KVMIO, 0x64) |
| 523 | #define KVM_GET_PIT _IOWR(KVMIO, 0x65, struct kvm_pit_state) | 607 | #define KVM_GET_PIT _IOWR(KVMIO, 0x65, struct kvm_pit_state) |
| 524 | #define KVM_SET_PIT _IOR(KVMIO, 0x66, struct kvm_pit_state) | 608 | #define KVM_SET_PIT _IOR(KVMIO, 0x66, struct kvm_pit_state) |
| 525 | #define KVM_IRQ_LINE_STATUS _IOWR(KVMIO, 0x67, struct kvm_irq_level) | 609 | #define KVM_IRQ_LINE_STATUS _IOWR(KVMIO, 0x67, struct kvm_irq_level) |
| 526 | #define KVM_REGISTER_COALESCED_MMIO \ | 610 | #define KVM_REGISTER_COALESCED_MMIO \ |
| 527 | _IOW(KVMIO, 0x67, struct kvm_coalesced_mmio_zone) | 611 | _IOW(KVMIO, 0x67, struct kvm_coalesced_mmio_zone) |
| 528 | #define KVM_UNREGISTER_COALESCED_MMIO \ | 612 | #define KVM_UNREGISTER_COALESCED_MMIO \ |
| 529 | _IOW(KVMIO, 0x68, struct kvm_coalesced_mmio_zone) | 613 | _IOW(KVMIO, 0x68, struct kvm_coalesced_mmio_zone) |
| 530 | #define KVM_ASSIGN_PCI_DEVICE _IOR(KVMIO, 0x69, \ | 614 | #define KVM_ASSIGN_PCI_DEVICE _IOR(KVMIO, 0x69, \ |
| 531 | struct kvm_assigned_pci_dev) | 615 | struct kvm_assigned_pci_dev) |
| 532 | #define KVM_SET_GSI_ROUTING _IOW(KVMIO, 0x6a, struct kvm_irq_routing) | 616 | #define KVM_SET_GSI_ROUTING _IOW(KVMIO, 0x6a, struct kvm_irq_routing) |
| 533 | /* deprecated, replaced by KVM_ASSIGN_DEV_IRQ */ | 617 | /* deprecated, replaced by KVM_ASSIGN_DEV_IRQ */ |
| 534 | #define KVM_ASSIGN_IRQ _IOR(KVMIO, 0x70, \ | 618 | #define KVM_ASSIGN_IRQ __KVM_DEPRECATED_VM_R_0x70 |
| 535 | struct kvm_assigned_irq) | 619 | #define KVM_ASSIGN_DEV_IRQ _IOW(KVMIO, 0x70, struct kvm_assigned_irq) |
| 536 | #define KVM_ASSIGN_DEV_IRQ _IOW(KVMIO, 0x70, struct kvm_assigned_irq) | 620 | #define KVM_REINJECT_CONTROL _IO(KVMIO, 0x71) |
| 537 | #define KVM_REINJECT_CONTROL _IO(KVMIO, 0x71) | 621 | #define KVM_DEASSIGN_PCI_DEVICE _IOW(KVMIO, 0x72, \ |
| 538 | #define KVM_DEASSIGN_PCI_DEVICE _IOW(KVMIO, 0x72, \ | 622 | struct kvm_assigned_pci_dev) |
| 539 | struct kvm_assigned_pci_dev) | 623 | #define KVM_ASSIGN_SET_MSIX_NR _IOW(KVMIO, 0x73, \ |
| 540 | #define KVM_ASSIGN_SET_MSIX_NR \ | 624 | struct kvm_assigned_msix_nr) |
| 541 | _IOW(KVMIO, 0x73, struct kvm_assigned_msix_nr) | 625 | #define KVM_ASSIGN_SET_MSIX_ENTRY _IOW(KVMIO, 0x74, \ |
| 542 | #define KVM_ASSIGN_SET_MSIX_ENTRY \ | 626 | struct kvm_assigned_msix_entry) |
| 543 | _IOW(KVMIO, 0x74, struct kvm_assigned_msix_entry) | 627 | #define KVM_DEASSIGN_DEV_IRQ _IOW(KVMIO, 0x75, struct kvm_assigned_irq) |
| 544 | #define KVM_DEASSIGN_DEV_IRQ _IOW(KVMIO, 0x75, struct kvm_assigned_irq) | 628 | #define KVM_IRQFD _IOW(KVMIO, 0x76, struct kvm_irqfd) |
| 545 | #define KVM_IRQFD _IOW(KVMIO, 0x76, struct kvm_irqfd) | 629 | #define KVM_CREATE_PIT2 _IOW(KVMIO, 0x77, struct kvm_pit_config) |
| 546 | #define KVM_CREATE_PIT2 _IOW(KVMIO, 0x77, struct kvm_pit_config) | 630 | #define KVM_SET_BOOT_CPU_ID _IO(KVMIO, 0x78) |
| 547 | #define KVM_SET_BOOT_CPU_ID _IO(KVMIO, 0x78) | 631 | #define KVM_IOEVENTFD _IOW(KVMIO, 0x79, struct kvm_ioeventfd) |
| 548 | #define KVM_IOEVENTFD _IOW(KVMIO, 0x79, struct kvm_ioeventfd) | 632 | #define KVM_XEN_HVM_CONFIG _IOW(KVMIO, 0x7a, struct kvm_xen_hvm_config) |
| 633 | #define KVM_SET_CLOCK _IOW(KVMIO, 0x7b, struct kvm_clock_data) | ||
| 634 | #define KVM_GET_CLOCK _IOR(KVMIO, 0x7c, struct kvm_clock_data) | ||
| 635 | /* Available with KVM_CAP_PIT_STATE2 */ | ||
| 636 | #define KVM_GET_PIT2 _IOR(KVMIO, 0x9f, struct kvm_pit_state2) | ||
| 637 | #define KVM_SET_PIT2 _IOW(KVMIO, 0xa0, struct kvm_pit_state2) | ||
| 549 | 638 | ||
| 550 | /* | 639 | /* |
| 551 | * ioctls for vcpu fds | 640 | * ioctls for vcpu fds |
| @@ -558,7 +647,7 @@ struct kvm_irqfd { | |||
| 558 | #define KVM_TRANSLATE _IOWR(KVMIO, 0x85, struct kvm_translation) | 647 | #define KVM_TRANSLATE _IOWR(KVMIO, 0x85, struct kvm_translation) |
| 559 | #define KVM_INTERRUPT _IOW(KVMIO, 0x86, struct kvm_interrupt) | 648 | #define KVM_INTERRUPT _IOW(KVMIO, 0x86, struct kvm_interrupt) |
| 560 | /* KVM_DEBUG_GUEST is no longer supported, use KVM_SET_GUEST_DEBUG instead */ | 649 | /* KVM_DEBUG_GUEST is no longer supported, use KVM_SET_GUEST_DEBUG instead */ |
| 561 | #define KVM_DEBUG_GUEST __KVM_DEPRECATED_DEBUG_GUEST | 650 | #define KVM_DEBUG_GUEST __KVM_DEPRECATED_VCPU_W_0x87 |
| 562 | #define KVM_GET_MSRS _IOWR(KVMIO, 0x88, struct kvm_msrs) | 651 | #define KVM_GET_MSRS _IOWR(KVMIO, 0x88, struct kvm_msrs) |
| 563 | #define KVM_SET_MSRS _IOW(KVMIO, 0x89, struct kvm_msrs) | 652 | #define KVM_SET_MSRS _IOW(KVMIO, 0x89, struct kvm_msrs) |
| 564 | #define KVM_SET_CPUID _IOW(KVMIO, 0x8a, struct kvm_cpuid) | 653 | #define KVM_SET_CPUID _IOW(KVMIO, 0x8a, struct kvm_cpuid) |
| @@ -570,7 +659,7 @@ struct kvm_irqfd { | |||
| 570 | #define KVM_SET_CPUID2 _IOW(KVMIO, 0x90, struct kvm_cpuid2) | 659 | #define KVM_SET_CPUID2 _IOW(KVMIO, 0x90, struct kvm_cpuid2) |
| 571 | #define KVM_GET_CPUID2 _IOWR(KVMIO, 0x91, struct kvm_cpuid2) | 660 | #define KVM_GET_CPUID2 _IOWR(KVMIO, 0x91, struct kvm_cpuid2) |
| 572 | /* Available with KVM_CAP_VAPIC */ | 661 | /* Available with KVM_CAP_VAPIC */ |
| 573 | #define KVM_TPR_ACCESS_REPORTING _IOWR(KVMIO, 0x92, struct kvm_tpr_access_ctl) | 662 | #define KVM_TPR_ACCESS_REPORTING _IOWR(KVMIO, 0x92, struct kvm_tpr_access_ctl) |
| 574 | /* Available with KVM_CAP_VAPIC */ | 663 | /* Available with KVM_CAP_VAPIC */ |
| 575 | #define KVM_SET_VAPIC_ADDR _IOW(KVMIO, 0x93, struct kvm_vapic_addr) | 664 | #define KVM_SET_VAPIC_ADDR _IOW(KVMIO, 0x93, struct kvm_vapic_addr) |
| 576 | /* valid for virtual machine (for floating interrupt)_and_ vcpu */ | 665 | /* valid for virtual machine (for floating interrupt)_and_ vcpu */ |
| @@ -582,66 +671,23 @@ struct kvm_irqfd { | |||
| 582 | /* initial ipl psw for s390 */ | 671 | /* initial ipl psw for s390 */ |
| 583 | #define KVM_S390_SET_INITIAL_PSW _IOW(KVMIO, 0x96, struct kvm_s390_psw) | 672 | #define KVM_S390_SET_INITIAL_PSW _IOW(KVMIO, 0x96, struct kvm_s390_psw) |
| 584 | /* initial reset for s390 */ | 673 | /* initial reset for s390 */ |
| 585 | #define KVM_S390_INITIAL_RESET _IO(KVMIO, 0x97) | 674 | #define KVM_S390_INITIAL_RESET _IO(KVMIO, 0x97) |
| 586 | #define KVM_GET_MP_STATE _IOR(KVMIO, 0x98, struct kvm_mp_state) | 675 | #define KVM_GET_MP_STATE _IOR(KVMIO, 0x98, struct kvm_mp_state) |
| 587 | #define KVM_SET_MP_STATE _IOW(KVMIO, 0x99, struct kvm_mp_state) | 676 | #define KVM_SET_MP_STATE _IOW(KVMIO, 0x99, struct kvm_mp_state) |
| 588 | /* Available with KVM_CAP_NMI */ | 677 | /* Available with KVM_CAP_NMI */ |
| 589 | #define KVM_NMI _IO(KVMIO, 0x9a) | 678 | #define KVM_NMI _IO(KVMIO, 0x9a) |
| 590 | /* Available with KVM_CAP_SET_GUEST_DEBUG */ | 679 | /* Available with KVM_CAP_SET_GUEST_DEBUG */ |
| 591 | #define KVM_SET_GUEST_DEBUG _IOW(KVMIO, 0x9b, struct kvm_guest_debug) | 680 | #define KVM_SET_GUEST_DEBUG _IOW(KVMIO, 0x9b, struct kvm_guest_debug) |
| 592 | /* MCE for x86 */ | 681 | /* MCE for x86 */ |
| 593 | #define KVM_X86_SETUP_MCE _IOW(KVMIO, 0x9c, __u64) | 682 | #define KVM_X86_SETUP_MCE _IOW(KVMIO, 0x9c, __u64) |
| 594 | #define KVM_X86_GET_MCE_CAP_SUPPORTED _IOR(KVMIO, 0x9d, __u64) | 683 | #define KVM_X86_GET_MCE_CAP_SUPPORTED _IOR(KVMIO, 0x9d, __u64) |
| 595 | #define KVM_X86_SET_MCE _IOW(KVMIO, 0x9e, struct kvm_x86_mce) | 684 | #define KVM_X86_SET_MCE _IOW(KVMIO, 0x9e, struct kvm_x86_mce) |
| 596 | 685 | /* IA64 stack access */ | |
| 597 | /* | ||
| 598 | * Deprecated interfaces | ||
| 599 | */ | ||
| 600 | struct kvm_breakpoint { | ||
| 601 | __u32 enabled; | ||
| 602 | __u32 padding; | ||
| 603 | __u64 address; | ||
| 604 | }; | ||
| 605 | |||
| 606 | struct kvm_debug_guest { | ||
| 607 | __u32 enabled; | ||
| 608 | __u32 pad; | ||
| 609 | struct kvm_breakpoint breakpoints[4]; | ||
| 610 | __u32 singlestep; | ||
| 611 | }; | ||
| 612 | |||
| 613 | #define __KVM_DEPRECATED_DEBUG_GUEST _IOW(KVMIO, 0x87, struct kvm_debug_guest) | ||
| 614 | |||
| 615 | #define KVM_IA64_VCPU_GET_STACK _IOR(KVMIO, 0x9a, void *) | 686 | #define KVM_IA64_VCPU_GET_STACK _IOR(KVMIO, 0x9a, void *) |
| 616 | #define KVM_IA64_VCPU_SET_STACK _IOW(KVMIO, 0x9b, void *) | 687 | #define KVM_IA64_VCPU_SET_STACK _IOW(KVMIO, 0x9b, void *) |
| 617 | 688 | /* Available with KVM_CAP_VCPU_EVENTS */ | |
| 618 | #define KVM_GET_PIT2 _IOR(KVMIO, 0x9f, struct kvm_pit_state2) | 689 | #define KVM_GET_VCPU_EVENTS _IOR(KVMIO, 0x9f, struct kvm_vcpu_events) |
| 619 | #define KVM_SET_PIT2 _IOW(KVMIO, 0xa0, struct kvm_pit_state2) | 690 | #define KVM_SET_VCPU_EVENTS _IOW(KVMIO, 0xa0, struct kvm_vcpu_events) |
| 620 | |||
| 621 | #define KVM_TRC_INJ_VIRQ (KVM_TRC_HANDLER + 0x02) | ||
| 622 | #define KVM_TRC_REDELIVER_EVT (KVM_TRC_HANDLER + 0x03) | ||
| 623 | #define KVM_TRC_PEND_INTR (KVM_TRC_HANDLER + 0x04) | ||
| 624 | #define KVM_TRC_IO_READ (KVM_TRC_HANDLER + 0x05) | ||
| 625 | #define KVM_TRC_IO_WRITE (KVM_TRC_HANDLER + 0x06) | ||
| 626 | #define KVM_TRC_CR_READ (KVM_TRC_HANDLER + 0x07) | ||
| 627 | #define KVM_TRC_CR_WRITE (KVM_TRC_HANDLER + 0x08) | ||
| 628 | #define KVM_TRC_DR_READ (KVM_TRC_HANDLER + 0x09) | ||
| 629 | #define KVM_TRC_DR_WRITE (KVM_TRC_HANDLER + 0x0A) | ||
| 630 | #define KVM_TRC_MSR_READ (KVM_TRC_HANDLER + 0x0B) | ||
| 631 | #define KVM_TRC_MSR_WRITE (KVM_TRC_HANDLER + 0x0C) | ||
| 632 | #define KVM_TRC_CPUID (KVM_TRC_HANDLER + 0x0D) | ||
| 633 | #define KVM_TRC_INTR (KVM_TRC_HANDLER + 0x0E) | ||
| 634 | #define KVM_TRC_NMI (KVM_TRC_HANDLER + 0x0F) | ||
| 635 | #define KVM_TRC_VMMCALL (KVM_TRC_HANDLER + 0x10) | ||
| 636 | #define KVM_TRC_HLT (KVM_TRC_HANDLER + 0x11) | ||
| 637 | #define KVM_TRC_CLTS (KVM_TRC_HANDLER + 0x12) | ||
| 638 | #define KVM_TRC_LMSW (KVM_TRC_HANDLER + 0x13) | ||
| 639 | #define KVM_TRC_APIC_ACCESS (KVM_TRC_HANDLER + 0x14) | ||
| 640 | #define KVM_TRC_TDP_FAULT (KVM_TRC_HANDLER + 0x15) | ||
| 641 | #define KVM_TRC_GTLB_WRITE (KVM_TRC_HANDLER + 0x16) | ||
| 642 | #define KVM_TRC_STLB_WRITE (KVM_TRC_HANDLER + 0x17) | ||
| 643 | #define KVM_TRC_STLB_INVAL (KVM_TRC_HANDLER + 0x18) | ||
| 644 | #define KVM_TRC_PPC_INSTR (KVM_TRC_HANDLER + 0x19) | ||
| 645 | 691 | ||
| 646 | #define KVM_DEV_ASSIGN_ENABLE_IOMMU (1 << 0) | 692 | #define KVM_DEV_ASSIGN_ENABLE_IOMMU (1 << 0) |
| 647 | 693 | ||
| @@ -650,8 +696,9 @@ struct kvm_assigned_pci_dev { | |||
| 650 | __u32 busnr; | 696 | __u32 busnr; |
| 651 | __u32 devfn; | 697 | __u32 devfn; |
| 652 | __u32 flags; | 698 | __u32 flags; |
| 699 | __u32 segnr; | ||
| 653 | union { | 700 | union { |
| 654 | __u32 reserved[12]; | 701 | __u32 reserved[11]; |
| 655 | }; | 702 | }; |
| 656 | }; | 703 | }; |
| 657 | 704 | ||
| @@ -696,4 +743,4 @@ struct kvm_assigned_msix_entry { | |||
| 696 | __u16 padding[3]; | 743 | __u16 padding[3]; |
| 697 | }; | 744 | }; |
| 698 | 745 | ||
| 699 | #endif | 746 | #endif /* __LINUX_KVM_H */ |
diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h index b7bbb5ddd7ae..169d07758ee5 100644 --- a/include/linux/kvm_host.h +++ b/include/linux/kvm_host.h | |||
| @@ -38,6 +38,7 @@ | |||
| 38 | #define KVM_REQ_MMU_SYNC 7 | 38 | #define KVM_REQ_MMU_SYNC 7 |
| 39 | #define KVM_REQ_KVMCLOCK_UPDATE 8 | 39 | #define KVM_REQ_KVMCLOCK_UPDATE 8 |
| 40 | #define KVM_REQ_KICK 9 | 40 | #define KVM_REQ_KICK 9 |
| 41 | #define KVM_REQ_DEACTIVATE_FPU 10 | ||
| 41 | 42 | ||
| 42 | #define KVM_USERSPACE_IRQ_SOURCE_ID 0 | 43 | #define KVM_USERSPACE_IRQ_SOURCE_ID 0 |
| 43 | 44 | ||
| @@ -53,24 +54,24 @@ extern struct kmem_cache *kvm_vcpu_cache; | |||
| 53 | */ | 54 | */ |
| 54 | struct kvm_io_bus { | 55 | struct kvm_io_bus { |
| 55 | int dev_count; | 56 | int dev_count; |
| 56 | #define NR_IOBUS_DEVS 6 | 57 | #define NR_IOBUS_DEVS 200 |
| 57 | struct kvm_io_device *devs[NR_IOBUS_DEVS]; | 58 | struct kvm_io_device *devs[NR_IOBUS_DEVS]; |
| 58 | }; | 59 | }; |
| 59 | 60 | ||
| 60 | void kvm_io_bus_init(struct kvm_io_bus *bus); | 61 | enum kvm_bus { |
| 61 | void kvm_io_bus_destroy(struct kvm_io_bus *bus); | 62 | KVM_MMIO_BUS, |
| 62 | int kvm_io_bus_write(struct kvm_io_bus *bus, gpa_t addr, int len, | 63 | KVM_PIO_BUS, |
| 63 | const void *val); | 64 | KVM_NR_BUSES |
| 64 | int kvm_io_bus_read(struct kvm_io_bus *bus, gpa_t addr, int len, | 65 | }; |
| 66 | |||
| 67 | int kvm_io_bus_write(struct kvm *kvm, enum kvm_bus bus_idx, gpa_t addr, | ||
| 68 | int len, const void *val); | ||
| 69 | int kvm_io_bus_read(struct kvm *kvm, enum kvm_bus bus_idx, gpa_t addr, int len, | ||
| 65 | void *val); | 70 | void *val); |
| 66 | int __kvm_io_bus_register_dev(struct kvm_io_bus *bus, | 71 | int kvm_io_bus_register_dev(struct kvm *kvm, enum kvm_bus bus_idx, |
| 67 | struct kvm_io_device *dev); | ||
| 68 | int kvm_io_bus_register_dev(struct kvm *kvm, struct kvm_io_bus *bus, | ||
| 69 | struct kvm_io_device *dev); | 72 | struct kvm_io_device *dev); |
| 70 | void __kvm_io_bus_unregister_dev(struct kvm_io_bus *bus, | 73 | int kvm_io_bus_unregister_dev(struct kvm *kvm, enum kvm_bus bus_idx, |
| 71 | struct kvm_io_device *dev); | 74 | struct kvm_io_device *dev); |
| 72 | void kvm_io_bus_unregister_dev(struct kvm *kvm, struct kvm_io_bus *bus, | ||
| 73 | struct kvm_io_device *dev); | ||
| 74 | 75 | ||
| 75 | struct kvm_vcpu { | 76 | struct kvm_vcpu { |
| 76 | struct kvm *kvm; | 77 | struct kvm *kvm; |
| @@ -83,6 +84,8 @@ struct kvm_vcpu { | |||
| 83 | struct kvm_run *run; | 84 | struct kvm_run *run; |
| 84 | unsigned long requests; | 85 | unsigned long requests; |
| 85 | unsigned long guest_debug; | 86 | unsigned long guest_debug; |
| 87 | int srcu_idx; | ||
| 88 | |||
| 86 | int fpu_active; | 89 | int fpu_active; |
| 87 | int guest_fpu_loaded; | 90 | int guest_fpu_loaded; |
| 88 | wait_queue_head_t wq; | 91 | wait_queue_head_t wq; |
| @@ -116,11 +119,16 @@ struct kvm_memory_slot { | |||
| 116 | int user_alloc; | 119 | int user_alloc; |
| 117 | }; | 120 | }; |
| 118 | 121 | ||
| 122 | static inline unsigned long kvm_dirty_bitmap_bytes(struct kvm_memory_slot *memslot) | ||
| 123 | { | ||
| 124 | return ALIGN(memslot->npages, BITS_PER_LONG) / 8; | ||
| 125 | } | ||
| 126 | |||
| 119 | struct kvm_kernel_irq_routing_entry { | 127 | struct kvm_kernel_irq_routing_entry { |
| 120 | u32 gsi; | 128 | u32 gsi; |
| 121 | u32 type; | 129 | u32 type; |
| 122 | int (*set)(struct kvm_kernel_irq_routing_entry *e, | 130 | int (*set)(struct kvm_kernel_irq_routing_entry *e, |
| 123 | struct kvm *kvm, int level); | 131 | struct kvm *kvm, int irq_source_id, int level); |
| 124 | union { | 132 | union { |
| 125 | struct { | 133 | struct { |
| 126 | unsigned irqchip; | 134 | unsigned irqchip; |
| @@ -128,17 +136,41 @@ struct kvm_kernel_irq_routing_entry { | |||
| 128 | } irqchip; | 136 | } irqchip; |
| 129 | struct msi_msg msi; | 137 | struct msi_msg msi; |
| 130 | }; | 138 | }; |
| 131 | struct list_head link; | 139 | struct hlist_node link; |
| 132 | }; | 140 | }; |
| 133 | 141 | ||
| 134 | struct kvm { | 142 | #ifdef __KVM_HAVE_IOAPIC |
| 135 | spinlock_t mmu_lock; | 143 | |
| 136 | spinlock_t requests_lock; | 144 | struct kvm_irq_routing_table { |
| 137 | struct rw_semaphore slots_lock; | 145 | int chip[KVM_NR_IRQCHIPS][KVM_IOAPIC_NUM_PINS]; |
| 138 | struct mm_struct *mm; /* userspace tied to this vm */ | 146 | struct kvm_kernel_irq_routing_entry *rt_entries; |
| 147 | u32 nr_rt_entries; | ||
| 148 | /* | ||
| 149 | * Array indexed by gsi. Each entry contains list of irq chips | ||
| 150 | * the gsi is connected to. | ||
| 151 | */ | ||
| 152 | struct hlist_head map[0]; | ||
| 153 | }; | ||
| 154 | |||
| 155 | #else | ||
| 156 | |||
| 157 | struct kvm_irq_routing_table {}; | ||
| 158 | |||
| 159 | #endif | ||
| 160 | |||
| 161 | struct kvm_memslots { | ||
| 139 | int nmemslots; | 162 | int nmemslots; |
| 140 | struct kvm_memory_slot memslots[KVM_MEMORY_SLOTS + | 163 | struct kvm_memory_slot memslots[KVM_MEMORY_SLOTS + |
| 141 | KVM_PRIVATE_MEM_SLOTS]; | 164 | KVM_PRIVATE_MEM_SLOTS]; |
| 165 | }; | ||
| 166 | |||
| 167 | struct kvm { | ||
| 168 | spinlock_t mmu_lock; | ||
| 169 | raw_spinlock_t requests_lock; | ||
| 170 | struct mutex slots_lock; | ||
| 171 | struct mm_struct *mm; /* userspace tied to this vm */ | ||
| 172 | struct kvm_memslots *memslots; | ||
| 173 | struct srcu_struct srcu; | ||
| 142 | #ifdef CONFIG_KVM_APIC_ARCHITECTURE | 174 | #ifdef CONFIG_KVM_APIC_ARCHITECTURE |
| 143 | u32 bsp_vcpu_id; | 175 | u32 bsp_vcpu_id; |
| 144 | struct kvm_vcpu *bsp_vcpu; | 176 | struct kvm_vcpu *bsp_vcpu; |
| @@ -147,8 +179,7 @@ struct kvm { | |||
| 147 | atomic_t online_vcpus; | 179 | atomic_t online_vcpus; |
| 148 | struct list_head vm_list; | 180 | struct list_head vm_list; |
| 149 | struct mutex lock; | 181 | struct mutex lock; |
| 150 | struct kvm_io_bus mmio_bus; | 182 | struct kvm_io_bus *buses[KVM_NR_BUSES]; |
| 151 | struct kvm_io_bus pio_bus; | ||
| 152 | #ifdef CONFIG_HAVE_KVM_EVENTFD | 183 | #ifdef CONFIG_HAVE_KVM_EVENTFD |
| 153 | struct { | 184 | struct { |
| 154 | spinlock_t lock; | 185 | spinlock_t lock; |
| @@ -166,8 +197,9 @@ struct kvm { | |||
| 166 | 197 | ||
| 167 | struct mutex irq_lock; | 198 | struct mutex irq_lock; |
| 168 | #ifdef CONFIG_HAVE_KVM_IRQCHIP | 199 | #ifdef CONFIG_HAVE_KVM_IRQCHIP |
| 169 | struct list_head irq_routing; /* of kvm_kernel_irq_routing_entry */ | 200 | struct kvm_irq_routing_table *irq_routing; |
| 170 | struct hlist_head mask_notifier_list; | 201 | struct hlist_head mask_notifier_list; |
| 202 | struct hlist_head irq_ack_notifier_list; | ||
| 171 | #endif | 203 | #endif |
| 172 | 204 | ||
| 173 | #ifdef KVM_ARCH_WANT_MMU_NOTIFIER | 205 | #ifdef KVM_ARCH_WANT_MMU_NOTIFIER |
| @@ -229,13 +261,20 @@ int kvm_set_memory_region(struct kvm *kvm, | |||
| 229 | int __kvm_set_memory_region(struct kvm *kvm, | 261 | int __kvm_set_memory_region(struct kvm *kvm, |
| 230 | struct kvm_userspace_memory_region *mem, | 262 | struct kvm_userspace_memory_region *mem, |
| 231 | int user_alloc); | 263 | int user_alloc); |
| 232 | int kvm_arch_set_memory_region(struct kvm *kvm, | 264 | int kvm_arch_prepare_memory_region(struct kvm *kvm, |
| 265 | struct kvm_memory_slot *memslot, | ||
| 266 | struct kvm_memory_slot old, | ||
| 267 | struct kvm_userspace_memory_region *mem, | ||
| 268 | int user_alloc); | ||
| 269 | void kvm_arch_commit_memory_region(struct kvm *kvm, | ||
| 233 | struct kvm_userspace_memory_region *mem, | 270 | struct kvm_userspace_memory_region *mem, |
| 234 | struct kvm_memory_slot old, | 271 | struct kvm_memory_slot old, |
| 235 | int user_alloc); | 272 | int user_alloc); |
| 236 | void kvm_disable_largepages(void); | 273 | void kvm_disable_largepages(void); |
| 237 | void kvm_arch_flush_shadow(struct kvm *kvm); | 274 | void kvm_arch_flush_shadow(struct kvm *kvm); |
| 238 | gfn_t unalias_gfn(struct kvm *kvm, gfn_t gfn); | 275 | gfn_t unalias_gfn(struct kvm *kvm, gfn_t gfn); |
| 276 | gfn_t unalias_gfn_instantiation(struct kvm *kvm, gfn_t gfn); | ||
| 277 | |||
| 239 | struct page *gfn_to_page(struct kvm *kvm, gfn_t gfn); | 278 | struct page *gfn_to_page(struct kvm *kvm, gfn_t gfn); |
| 240 | unsigned long gfn_to_hva(struct kvm *kvm, gfn_t gfn); | 279 | unsigned long gfn_to_hva(struct kvm *kvm, gfn_t gfn); |
| 241 | void kvm_release_page_clean(struct page *page); | 280 | void kvm_release_page_clean(struct page *page); |
| @@ -244,6 +283,9 @@ void kvm_set_page_dirty(struct page *page); | |||
| 244 | void kvm_set_page_accessed(struct page *page); | 283 | void kvm_set_page_accessed(struct page *page); |
| 245 | 284 | ||
| 246 | pfn_t gfn_to_pfn(struct kvm *kvm, gfn_t gfn); | 285 | pfn_t gfn_to_pfn(struct kvm *kvm, gfn_t gfn); |
| 286 | pfn_t gfn_to_pfn_memslot(struct kvm *kvm, | ||
| 287 | struct kvm_memory_slot *slot, gfn_t gfn); | ||
| 288 | int memslot_id(struct kvm *kvm, gfn_t gfn); | ||
| 247 | void kvm_release_pfn_dirty(pfn_t); | 289 | void kvm_release_pfn_dirty(pfn_t); |
| 248 | void kvm_release_pfn_clean(pfn_t pfn); | 290 | void kvm_release_pfn_clean(pfn_t pfn); |
| 249 | void kvm_set_pfn_dirty(pfn_t pfn); | 291 | void kvm_set_pfn_dirty(pfn_t pfn); |
| @@ -263,9 +305,11 @@ int kvm_clear_guest_page(struct kvm *kvm, gfn_t gfn, int offset, int len); | |||
| 263 | int kvm_clear_guest(struct kvm *kvm, gpa_t gpa, unsigned long len); | 305 | int kvm_clear_guest(struct kvm *kvm, gpa_t gpa, unsigned long len); |
| 264 | struct kvm_memory_slot *gfn_to_memslot(struct kvm *kvm, gfn_t gfn); | 306 | struct kvm_memory_slot *gfn_to_memslot(struct kvm *kvm, gfn_t gfn); |
| 265 | int kvm_is_visible_gfn(struct kvm *kvm, gfn_t gfn); | 307 | int kvm_is_visible_gfn(struct kvm *kvm, gfn_t gfn); |
| 308 | unsigned long kvm_host_page_size(struct kvm *kvm, gfn_t gfn); | ||
| 266 | void mark_page_dirty(struct kvm *kvm, gfn_t gfn); | 309 | void mark_page_dirty(struct kvm *kvm, gfn_t gfn); |
| 267 | 310 | ||
| 268 | void kvm_vcpu_block(struct kvm_vcpu *vcpu); | 311 | void kvm_vcpu_block(struct kvm_vcpu *vcpu); |
| 312 | void kvm_vcpu_on_spin(struct kvm_vcpu *vcpu); | ||
| 269 | void kvm_resched(struct kvm_vcpu *vcpu); | 313 | void kvm_resched(struct kvm_vcpu *vcpu); |
| 270 | void kvm_load_guest_fpu(struct kvm_vcpu *vcpu); | 314 | void kvm_load_guest_fpu(struct kvm_vcpu *vcpu); |
| 271 | void kvm_put_guest_fpu(struct kvm_vcpu *vcpu); | 315 | void kvm_put_guest_fpu(struct kvm_vcpu *vcpu); |
| @@ -325,7 +369,7 @@ int kvm_arch_vcpu_setup(struct kvm_vcpu *vcpu); | |||
| 325 | void kvm_arch_vcpu_destroy(struct kvm_vcpu *vcpu); | 369 | void kvm_arch_vcpu_destroy(struct kvm_vcpu *vcpu); |
| 326 | 370 | ||
| 327 | int kvm_arch_vcpu_reset(struct kvm_vcpu *vcpu); | 371 | int kvm_arch_vcpu_reset(struct kvm_vcpu *vcpu); |
| 328 | void kvm_arch_hardware_enable(void *garbage); | 372 | int kvm_arch_hardware_enable(void *garbage); |
| 329 | void kvm_arch_hardware_disable(void *garbage); | 373 | void kvm_arch_hardware_disable(void *garbage); |
| 330 | int kvm_arch_hardware_setup(void); | 374 | int kvm_arch_hardware_setup(void); |
| 331 | void kvm_arch_hardware_unsetup(void); | 375 | void kvm_arch_hardware_unsetup(void); |
| @@ -362,6 +406,7 @@ struct kvm_assigned_dev_kernel { | |||
| 362 | struct work_struct interrupt_work; | 406 | struct work_struct interrupt_work; |
| 363 | struct list_head list; | 407 | struct list_head list; |
| 364 | int assigned_dev_id; | 408 | int assigned_dev_id; |
| 409 | int host_segnr; | ||
| 365 | int host_busnr; | 410 | int host_busnr; |
| 366 | int host_devfn; | 411 | int host_devfn; |
| 367 | unsigned int entries_nr; | 412 | unsigned int entries_nr; |
| @@ -390,7 +435,12 @@ void kvm_unregister_irq_mask_notifier(struct kvm *kvm, int irq, | |||
| 390 | struct kvm_irq_mask_notifier *kimn); | 435 | struct kvm_irq_mask_notifier *kimn); |
| 391 | void kvm_fire_mask_notifiers(struct kvm *kvm, int irq, bool mask); | 436 | void kvm_fire_mask_notifiers(struct kvm *kvm, int irq, bool mask); |
| 392 | 437 | ||
| 393 | int kvm_set_irq(struct kvm *kvm, int irq_source_id, int irq, int level); | 438 | #ifdef __KVM_HAVE_IOAPIC |
| 439 | void kvm_get_intr_delivery_bitmask(struct kvm_ioapic *ioapic, | ||
| 440 | union kvm_ioapic_redirect_entry *entry, | ||
| 441 | unsigned long *deliver_bitmask); | ||
| 442 | #endif | ||
| 443 | int kvm_set_irq(struct kvm *kvm, int irq_source_id, u32 irq, int level); | ||
| 394 | void kvm_notify_acked_irq(struct kvm *kvm, unsigned irqchip, unsigned pin); | 444 | void kvm_notify_acked_irq(struct kvm *kvm, unsigned irqchip, unsigned pin); |
| 395 | void kvm_register_irq_ack_notifier(struct kvm *kvm, | 445 | void kvm_register_irq_ack_notifier(struct kvm *kvm, |
| 396 | struct kvm_irq_ack_notifier *kian); | 446 | struct kvm_irq_ack_notifier *kian); |
| @@ -403,8 +453,7 @@ void kvm_free_irq_source_id(struct kvm *kvm, int irq_source_id); | |||
| 403 | #define KVM_IOMMU_CACHE_COHERENCY 0x1 | 453 | #define KVM_IOMMU_CACHE_COHERENCY 0x1 |
| 404 | 454 | ||
| 405 | #ifdef CONFIG_IOMMU_API | 455 | #ifdef CONFIG_IOMMU_API |
| 406 | int kvm_iommu_map_pages(struct kvm *kvm, gfn_t base_gfn, | 456 | int kvm_iommu_map_pages(struct kvm *kvm, struct kvm_memory_slot *slot); |
| 407 | unsigned long npages); | ||
| 408 | int kvm_iommu_map_guest(struct kvm *kvm); | 457 | int kvm_iommu_map_guest(struct kvm *kvm); |
| 409 | int kvm_iommu_unmap_guest(struct kvm *kvm); | 458 | int kvm_iommu_unmap_guest(struct kvm *kvm); |
| 410 | int kvm_assign_device(struct kvm *kvm, | 459 | int kvm_assign_device(struct kvm *kvm, |
| @@ -454,11 +503,6 @@ static inline void kvm_guest_exit(void) | |||
| 454 | current->flags &= ~PF_VCPU; | 503 | current->flags &= ~PF_VCPU; |
| 455 | } | 504 | } |
| 456 | 505 | ||
| 457 | static inline int memslot_id(struct kvm *kvm, struct kvm_memory_slot *slot) | ||
| 458 | { | ||
| 459 | return slot - kvm->memslots; | ||
| 460 | } | ||
| 461 | |||
| 462 | static inline gpa_t gfn_to_gpa(gfn_t gfn) | 506 | static inline gpa_t gfn_to_gpa(gfn_t gfn) |
| 463 | { | 507 | { |
| 464 | return (gpa_t)gfn << PAGE_SHIFT; | 508 | return (gpa_t)gfn << PAGE_SHIFT; |
| @@ -506,6 +550,10 @@ static inline int mmu_notifier_retry(struct kvm_vcpu *vcpu, unsigned long mmu_se | |||
| 506 | } | 550 | } |
| 507 | #endif | 551 | #endif |
| 508 | 552 | ||
| 553 | #ifndef KVM_ARCH_HAS_UNALIAS_INSTANTIATION | ||
| 554 | #define unalias_gfn_instantiation unalias_gfn | ||
| 555 | #endif | ||
| 556 | |||
| 509 | #ifdef CONFIG_HAVE_KVM_IRQCHIP | 557 | #ifdef CONFIG_HAVE_KVM_IRQCHIP |
| 510 | 558 | ||
| 511 | #define KVM_MAX_IRQ_ROUTES 1024 | 559 | #define KVM_MAX_IRQ_ROUTES 1024 |
| @@ -552,4 +600,21 @@ static inline bool kvm_vcpu_is_bsp(struct kvm_vcpu *vcpu) | |||
| 552 | return vcpu->kvm->bsp_vcpu_id == vcpu->vcpu_id; | 600 | return vcpu->kvm->bsp_vcpu_id == vcpu->vcpu_id; |
| 553 | } | 601 | } |
| 554 | #endif | 602 | #endif |
| 603 | |||
| 604 | #ifdef __KVM_HAVE_DEVICE_ASSIGNMENT | ||
| 605 | |||
| 606 | long kvm_vm_ioctl_assigned_device(struct kvm *kvm, unsigned ioctl, | ||
| 607 | unsigned long arg); | ||
| 608 | |||
| 609 | #else | ||
| 610 | |||
| 611 | static inline long kvm_vm_ioctl_assigned_device(struct kvm *kvm, unsigned ioctl, | ||
| 612 | unsigned long arg) | ||
| 613 | { | ||
| 614 | return -ENOTTY; | ||
| 615 | } | ||
| 616 | |||
| 555 | #endif | 617 | #endif |
| 618 | |||
| 619 | #endif | ||
| 620 | |||
diff --git a/include/linux/lcm.h b/include/linux/lcm.h new file mode 100644 index 000000000000..7bf01d779b45 --- /dev/null +++ b/include/linux/lcm.h | |||
| @@ -0,0 +1,8 @@ | |||
| 1 | #ifndef _LCM_H | ||
| 2 | #define _LCM_H | ||
| 3 | |||
| 4 | #include <linux/compiler.h> | ||
| 5 | |||
| 6 | unsigned long lcm(unsigned long a, unsigned long b) __attribute_const__; | ||
| 7 | |||
| 8 | #endif /* _LCM_H */ | ||
diff --git a/include/linux/leds-lp3944.h b/include/linux/leds-lp3944.h index afc9f9fd70f5..2618aa9063bc 100644 --- a/include/linux/leds-lp3944.h +++ b/include/linux/leds-lp3944.h | |||
| @@ -12,9 +12,6 @@ | |||
| 12 | #ifndef __LINUX_LEDS_LP3944_H | 12 | #ifndef __LINUX_LEDS_LP3944_H |
| 13 | #define __LINUX_LEDS_LP3944_H | 13 | #define __LINUX_LEDS_LP3944_H |
| 14 | 14 | ||
| 15 | #include <linux/leds.h> | ||
| 16 | #include <linux/workqueue.h> | ||
| 17 | |||
| 18 | #define LP3944_LED0 0 | 15 | #define LP3944_LED0 0 |
| 19 | #define LP3944_LED1 1 | 16 | #define LP3944_LED1 1 |
| 20 | #define LP3944_LED2 2 | 17 | #define LP3944_LED2 2 |
diff --git a/include/linux/leds-pca9532.h b/include/linux/leds-pca9532.h index 96eea90f01a8..f158eb1149aa 100644 --- a/include/linux/leds-pca9532.h +++ b/include/linux/leds-pca9532.h | |||
| @@ -32,7 +32,7 @@ struct pca9532_led { | |||
| 32 | struct i2c_client *client; | 32 | struct i2c_client *client; |
| 33 | char *name; | 33 | char *name; |
| 34 | struct led_classdev ldev; | 34 | struct led_classdev ldev; |
| 35 | struct work_struct work; | 35 | struct work_struct work; |
| 36 | enum pca9532_type type; | 36 | enum pca9532_type type; |
| 37 | enum pca9532_state state; | 37 | enum pca9532_state state; |
| 38 | }; | 38 | }; |
diff --git a/include/linux/leds-regulator.h b/include/linux/leds-regulator.h new file mode 100644 index 000000000000..5a8eb389aab8 --- /dev/null +++ b/include/linux/leds-regulator.h | |||
| @@ -0,0 +1,46 @@ | |||
| 1 | /* | ||
| 2 | * leds-regulator.h - platform data structure for regulator driven LEDs. | ||
| 3 | * | ||
| 4 | * Copyright (C) 2009 Antonio Ospite <ospite@studenti.unina.it> | ||
| 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 __LINUX_LEDS_REGULATOR_H | ||
| 13 | #define __LINUX_LEDS_REGULATOR_H | ||
| 14 | |||
| 15 | /* | ||
| 16 | * Use "vled" as supply id when declaring the regulator consumer: | ||
| 17 | * | ||
| 18 | * static struct regulator_consumer_supply pcap_regulator_VVIB_consumers [] = { | ||
| 19 | * { .dev_name = "leds-regulator.0", supply = "vled" }, | ||
| 20 | * }; | ||
| 21 | * | ||
| 22 | * If you have several regulator driven LEDs, you can append a numerical id to | ||
| 23 | * .dev_name as done above, and use the same id when declaring the platform | ||
| 24 | * device: | ||
| 25 | * | ||
| 26 | * static struct led_regulator_platform_data a780_vibrator_data = { | ||
| 27 | * .name = "a780::vibrator", | ||
| 28 | * }; | ||
| 29 | * | ||
| 30 | * static struct platform_device a780_vibrator = { | ||
| 31 | * .name = "leds-regulator", | ||
| 32 | * .id = 0, | ||
| 33 | * .dev = { | ||
| 34 | * .platform_data = &a780_vibrator_data, | ||
| 35 | * }, | ||
| 36 | * }; | ||
| 37 | */ | ||
| 38 | |||
| 39 | #include <linux/leds.h> | ||
| 40 | |||
| 41 | struct led_regulator_platform_data { | ||
| 42 | char *name; /* LED name as expected by LED class */ | ||
| 43 | enum led_brightness brightness; /* initial brightness value */ | ||
| 44 | }; | ||
| 45 | |||
| 46 | #endif /* __LINUX_LEDS_REGULATOR_H */ | ||
diff --git a/include/linux/libata.h b/include/linux/libata.h index 87698640c091..b2f2003b92e5 100644 --- a/include/linux/libata.h +++ b/include/linux/libata.h | |||
| @@ -146,6 +146,7 @@ enum { | |||
| 146 | ATA_DFLAG_SLEEPING = (1 << 15), /* device is sleeping */ | 146 | ATA_DFLAG_SLEEPING = (1 << 15), /* device is sleeping */ |
| 147 | ATA_DFLAG_DUBIOUS_XFER = (1 << 16), /* data transfer not verified */ | 147 | ATA_DFLAG_DUBIOUS_XFER = (1 << 16), /* data transfer not verified */ |
| 148 | ATA_DFLAG_NO_UNLOAD = (1 << 17), /* device doesn't support unload */ | 148 | ATA_DFLAG_NO_UNLOAD = (1 << 17), /* device doesn't support unload */ |
| 149 | ATA_DFLAG_UNLOCK_HPA = (1 << 18), /* unlock HPA */ | ||
| 149 | ATA_DFLAG_INIT_MASK = (1 << 24) - 1, | 150 | ATA_DFLAG_INIT_MASK = (1 << 24) - 1, |
| 150 | 151 | ||
| 151 | ATA_DFLAG_DETACH = (1 << 24), | 152 | ATA_DFLAG_DETACH = (1 << 24), |
| @@ -354,6 +355,9 @@ enum { | |||
| 354 | /* max tries if error condition is still set after ->error_handler */ | 355 | /* max tries if error condition is still set after ->error_handler */ |
| 355 | ATA_EH_MAX_TRIES = 5, | 356 | ATA_EH_MAX_TRIES = 5, |
| 356 | 357 | ||
| 358 | /* sometimes resuming a link requires several retries */ | ||
| 359 | ATA_LINK_RESUME_TRIES = 5, | ||
| 360 | |||
| 357 | /* how hard are we gonna try to probe/recover devices */ | 361 | /* how hard are we gonna try to probe/recover devices */ |
| 358 | ATA_PROBE_MAX_TRIES = 3, | 362 | ATA_PROBE_MAX_TRIES = 3, |
| 359 | ATA_EH_DEV_TRIES = 3, | 363 | ATA_EH_DEV_TRIES = 3, |
| @@ -365,7 +369,7 @@ enum { | |||
| 365 | /* This should match the actual table size of | 369 | /* This should match the actual table size of |
| 366 | * ata_eh_cmd_timeout_table in libata-eh.c. | 370 | * ata_eh_cmd_timeout_table in libata-eh.c. |
| 367 | */ | 371 | */ |
| 368 | ATA_EH_CMD_TIMEOUT_TABLE_SIZE = 5, | 372 | ATA_EH_CMD_TIMEOUT_TABLE_SIZE = 6, |
| 369 | 373 | ||
| 370 | /* Horkage types. May be set by libata or controller on drives | 374 | /* Horkage types. May be set by libata or controller on drives |
| 371 | (some horkage may be drive/controller pair dependant */ | 375 | (some horkage may be drive/controller pair dependant */ |
| @@ -595,6 +599,7 @@ struct ata_device { | |||
| 595 | unsigned int horkage; /* List of broken features */ | 599 | unsigned int horkage; /* List of broken features */ |
| 596 | unsigned long flags; /* ATA_DFLAG_xxx */ | 600 | unsigned long flags; /* ATA_DFLAG_xxx */ |
| 597 | struct scsi_device *sdev; /* attached SCSI device */ | 601 | struct scsi_device *sdev; /* attached SCSI device */ |
| 602 | void *private_data; | ||
| 598 | #ifdef CONFIG_ATA_ACPI | 603 | #ifdef CONFIG_ATA_ACPI |
| 599 | acpi_handle acpi_handle; | 604 | acpi_handle acpi_handle; |
| 600 | union acpi_object *gtf_cache; | 605 | union acpi_object *gtf_cache; |
| @@ -853,6 +858,7 @@ struct ata_port_operations { | |||
| 853 | unsigned int (*sff_data_xfer)(struct ata_device *dev, | 858 | unsigned int (*sff_data_xfer)(struct ata_device *dev, |
| 854 | unsigned char *buf, unsigned int buflen, int rw); | 859 | unsigned char *buf, unsigned int buflen, int rw); |
| 855 | u8 (*sff_irq_on)(struct ata_port *); | 860 | u8 (*sff_irq_on)(struct ata_port *); |
| 861 | bool (*sff_irq_check)(struct ata_port *); | ||
| 856 | void (*sff_irq_clear)(struct ata_port *); | 862 | void (*sff_irq_clear)(struct ata_port *); |
| 857 | 863 | ||
| 858 | void (*bmdma_setup)(struct ata_queued_cmd *qc); | 864 | void (*bmdma_setup)(struct ata_queued_cmd *qc); |
| @@ -1023,7 +1029,7 @@ extern int ata_std_bios_param(struct scsi_device *sdev, | |||
| 1023 | extern int ata_scsi_slave_config(struct scsi_device *sdev); | 1029 | extern int ata_scsi_slave_config(struct scsi_device *sdev); |
| 1024 | extern void ata_scsi_slave_destroy(struct scsi_device *sdev); | 1030 | extern void ata_scsi_slave_destroy(struct scsi_device *sdev); |
| 1025 | extern int ata_scsi_change_queue_depth(struct scsi_device *sdev, | 1031 | extern int ata_scsi_change_queue_depth(struct scsi_device *sdev, |
| 1026 | int queue_depth); | 1032 | int queue_depth, int reason); |
| 1027 | extern struct ata_device *ata_dev_pair(struct ata_device *adev); | 1033 | extern struct ata_device *ata_dev_pair(struct ata_device *adev); |
| 1028 | extern int ata_do_set_mode(struct ata_link *link, struct ata_device **r_failed_dev); | 1034 | extern int ata_do_set_mode(struct ata_link *link, struct ata_device **r_failed_dev); |
| 1029 | 1035 | ||
| @@ -1638,8 +1644,8 @@ extern int ata_pci_sff_activate_host(struct ata_host *host, | |||
| 1638 | irq_handler_t irq_handler, | 1644 | irq_handler_t irq_handler, |
| 1639 | struct scsi_host_template *sht); | 1645 | struct scsi_host_template *sht); |
| 1640 | extern int ata_pci_sff_init_one(struct pci_dev *pdev, | 1646 | extern int ata_pci_sff_init_one(struct pci_dev *pdev, |
| 1641 | const struct ata_port_info * const * ppi, | 1647 | const struct ata_port_info * const * ppi, |
| 1642 | struct scsi_host_template *sht, void *host_priv); | 1648 | struct scsi_host_template *sht, void *host_priv, int hflags); |
| 1643 | #endif /* CONFIG_PCI */ | 1649 | #endif /* CONFIG_PCI */ |
| 1644 | 1650 | ||
| 1645 | /** | 1651 | /** |
diff --git a/include/linux/lis3lv02d.h b/include/linux/lis3lv02d.h index 3cc2f2c53e4c..f1ca0dcc1628 100644 --- a/include/linux/lis3lv02d.h +++ b/include/linux/lis3lv02d.h | |||
| @@ -43,6 +43,21 @@ struct lis3lv02d_platform_data { | |||
| 43 | #define LIS3_WAKEUP_Z_HI (1 << 5) | 43 | #define LIS3_WAKEUP_Z_HI (1 << 5) |
| 44 | unsigned char wakeup_flags; | 44 | unsigned char wakeup_flags; |
| 45 | unsigned char wakeup_thresh; | 45 | unsigned char wakeup_thresh; |
| 46 | #define LIS3_NO_MAP 0 | ||
| 47 | #define LIS3_DEV_X 1 | ||
| 48 | #define LIS3_DEV_Y 2 | ||
| 49 | #define LIS3_DEV_Z 3 | ||
| 50 | #define LIS3_INV_DEV_X -1 | ||
| 51 | #define LIS3_INV_DEV_Y -2 | ||
| 52 | #define LIS3_INV_DEV_Z -3 | ||
| 53 | s8 axis_x; | ||
| 54 | s8 axis_y; | ||
| 55 | s8 axis_z; | ||
| 56 | int (*setup_resources)(void); | ||
| 57 | int (*release_resources)(void); | ||
| 58 | /* Limits for selftest are specified in chip data sheet */ | ||
| 59 | s16 st_min_limits[3]; /* min pass limit x, y, z */ | ||
| 60 | s16 st_max_limits[3]; /* max pass limit x, y, z */ | ||
| 46 | }; | 61 | }; |
| 47 | 62 | ||
| 48 | #endif /* __LIS3LV02D_H_ */ | 63 | #endif /* __LIS3LV02D_H_ */ |
diff --git a/include/linux/list.h b/include/linux/list.h index 969f6e92d089..8392884a2977 100644 --- a/include/linux/list.h +++ b/include/linux/list.h | |||
| @@ -206,6 +206,20 @@ static inline int list_empty_careful(const struct list_head *head) | |||
| 206 | } | 206 | } |
| 207 | 207 | ||
| 208 | /** | 208 | /** |
| 209 | * list_rotate_left - rotate the list to the left | ||
| 210 | * @head: the head of the list | ||
| 211 | */ | ||
| 212 | static inline void list_rotate_left(struct list_head *head) | ||
| 213 | { | ||
| 214 | struct list_head *first; | ||
| 215 | |||
| 216 | if (!list_empty(head)) { | ||
| 217 | first = head->next; | ||
| 218 | list_move_tail(first, head); | ||
| 219 | } | ||
| 220 | } | ||
| 221 | |||
| 222 | /** | ||
| 209 | * list_is_singular - tests whether a list has just one entry. | 223 | * list_is_singular - tests whether a list has just one entry. |
| 210 | * @head: the list to test. | 224 | * @head: the list to test. |
| 211 | */ | 225 | */ |
| @@ -484,7 +498,7 @@ static inline void list_splice_tail_init(struct list_head *list, | |||
| 484 | pos = n, n = list_entry(n->member.next, typeof(*n), member)) | 498 | pos = n, n = list_entry(n->member.next, typeof(*n), member)) |
| 485 | 499 | ||
| 486 | /** | 500 | /** |
| 487 | * list_for_each_entry_safe_continue | 501 | * list_for_each_entry_safe_continue - continue list iteration safe against removal |
| 488 | * @pos: the type * to use as a loop cursor. | 502 | * @pos: the type * to use as a loop cursor. |
| 489 | * @n: another type * to use as temporary storage | 503 | * @n: another type * to use as temporary storage |
| 490 | * @head: the head for your list. | 504 | * @head: the head for your list. |
| @@ -500,7 +514,7 @@ static inline void list_splice_tail_init(struct list_head *list, | |||
| 500 | pos = n, n = list_entry(n->member.next, typeof(*n), member)) | 514 | pos = n, n = list_entry(n->member.next, typeof(*n), member)) |
| 501 | 515 | ||
| 502 | /** | 516 | /** |
| 503 | * list_for_each_entry_safe_from | 517 | * list_for_each_entry_safe_from - iterate over list from current point safe against removal |
| 504 | * @pos: the type * to use as a loop cursor. | 518 | * @pos: the type * to use as a loop cursor. |
| 505 | * @n: another type * to use as temporary storage | 519 | * @n: another type * to use as temporary storage |
| 506 | * @head: the head for your list. | 520 | * @head: the head for your list. |
| @@ -515,7 +529,7 @@ static inline void list_splice_tail_init(struct list_head *list, | |||
| 515 | pos = n, n = list_entry(n->member.next, typeof(*n), member)) | 529 | pos = n, n = list_entry(n->member.next, typeof(*n), member)) |
| 516 | 530 | ||
| 517 | /** | 531 | /** |
| 518 | * list_for_each_entry_safe_reverse | 532 | * list_for_each_entry_safe_reverse - iterate backwards over list safe against removal |
| 519 | * @pos: the type * to use as a loop cursor. | 533 | * @pos: the type * to use as a loop cursor. |
| 520 | * @n: another type * to use as temporary storage | 534 | * @n: another type * to use as temporary storage |
| 521 | * @head: the head for your list. | 535 | * @head: the head for your list. |
diff --git a/include/linux/list_sort.h b/include/linux/list_sort.h new file mode 100644 index 000000000000..1a2df2efb771 --- /dev/null +++ b/include/linux/list_sort.h | |||
| @@ -0,0 +1,11 @@ | |||
| 1 | #ifndef _LINUX_LIST_SORT_H | ||
| 2 | #define _LINUX_LIST_SORT_H | ||
| 3 | |||
| 4 | #include <linux/types.h> | ||
| 5 | |||
| 6 | struct list_head; | ||
| 7 | |||
| 8 | void list_sort(void *priv, struct list_head *head, | ||
| 9 | int (*cmp)(void *priv, struct list_head *a, | ||
| 10 | struct list_head *b)); | ||
| 11 | #endif | ||
diff --git a/include/linux/llc.h b/include/linux/llc.h index 7733585603f1..ad7074ba81af 100644 --- a/include/linux/llc.h +++ b/include/linux/llc.h | |||
| @@ -36,6 +36,7 @@ enum llc_sockopts { | |||
| 36 | LLC_OPT_BUSY_TMR_EXP, /* busy state expire time (secs). */ | 36 | LLC_OPT_BUSY_TMR_EXP, /* busy state expire time (secs). */ |
| 37 | LLC_OPT_TX_WIN, /* tx window size. */ | 37 | LLC_OPT_TX_WIN, /* tx window size. */ |
| 38 | LLC_OPT_RX_WIN, /* rx window size. */ | 38 | LLC_OPT_RX_WIN, /* rx window size. */ |
| 39 | LLC_OPT_PKTINFO, /* ancillary packet information. */ | ||
| 39 | LLC_OPT_MAX | 40 | LLC_OPT_MAX |
| 40 | }; | 41 | }; |
| 41 | 42 | ||
| @@ -70,6 +71,12 @@ enum llc_sockopts { | |||
| 70 | #define LLC_SAP_RM 0xD4 /* Resource Management */ | 71 | #define LLC_SAP_RM 0xD4 /* Resource Management */ |
| 71 | #define LLC_SAP_GLOBAL 0xFF /* Global SAP. */ | 72 | #define LLC_SAP_GLOBAL 0xFF /* Global SAP. */ |
| 72 | 73 | ||
| 74 | struct llc_pktinfo { | ||
| 75 | int lpi_ifindex; | ||
| 76 | unsigned char lpi_sap; | ||
| 77 | unsigned char lpi_mac[IFHWADDRLEN]; | ||
| 78 | }; | ||
| 79 | |||
| 73 | #ifdef __KERNEL__ | 80 | #ifdef __KERNEL__ |
| 74 | #define LLC_SAP_DYN_START 0xC0 | 81 | #define LLC_SAP_DYN_START 0xC0 |
| 75 | #define LLC_SAP_DYN_STOP 0xDE | 82 | #define LLC_SAP_DYN_STOP 0xDE |
diff --git a/include/linux/lmb.h b/include/linux/lmb.h index 2442e3f3d033..f3d14333ebed 100644 --- a/include/linux/lmb.h +++ b/include/linux/lmb.h | |||
| @@ -42,6 +42,7 @@ extern void __init lmb_init(void); | |||
| 42 | extern void __init lmb_analyze(void); | 42 | extern void __init lmb_analyze(void); |
| 43 | extern long lmb_add(u64 base, u64 size); | 43 | extern long lmb_add(u64 base, u64 size); |
| 44 | extern long lmb_remove(u64 base, u64 size); | 44 | extern long lmb_remove(u64 base, u64 size); |
| 45 | extern long __init lmb_free(u64 base, u64 size); | ||
| 45 | extern long __init lmb_reserve(u64 base, u64 size); | 46 | extern long __init lmb_reserve(u64 base, u64 size); |
| 46 | extern u64 __init lmb_alloc_nid(u64 size, u64 align, int nid, | 47 | extern u64 __init lmb_alloc_nid(u64 size, u64 align, int nid, |
| 47 | u64 (*nid_range)(u64, u64, int *)); | 48 | u64 (*nid_range)(u64, u64, int *)); |
| @@ -54,6 +55,7 @@ extern u64 __init lmb_phys_mem_size(void); | |||
| 54 | extern u64 lmb_end_of_DRAM(void); | 55 | extern u64 lmb_end_of_DRAM(void); |
| 55 | extern void __init lmb_enforce_memory_limit(u64 memory_limit); | 56 | extern void __init lmb_enforce_memory_limit(u64 memory_limit); |
| 56 | extern int __init lmb_is_reserved(u64 addr); | 57 | extern int __init lmb_is_reserved(u64 addr); |
| 58 | extern int lmb_is_region_reserved(u64 base, u64 size); | ||
| 57 | extern int lmb_find(struct lmb_property *res); | 59 | extern int lmb_find(struct lmb_property *res); |
| 58 | 60 | ||
| 59 | extern void lmb_dump_all(void); | 61 | extern void lmb_dump_all(void); |
diff --git a/include/linux/lockdep.h b/include/linux/lockdep.h index 9ccf0e286b2a..a03977a96d7e 100644 --- a/include/linux/lockdep.h +++ b/include/linux/lockdep.h | |||
| @@ -12,6 +12,10 @@ | |||
| 12 | struct task_struct; | 12 | struct task_struct; |
| 13 | struct lockdep_map; | 13 | struct lockdep_map; |
| 14 | 14 | ||
| 15 | /* for sysctl */ | ||
| 16 | extern int prove_locking; | ||
| 17 | extern int lock_stat; | ||
| 18 | |||
| 15 | #ifdef CONFIG_LOCKDEP | 19 | #ifdef CONFIG_LOCKDEP |
| 16 | 20 | ||
| 17 | #include <linux/linkage.h> | 21 | #include <linux/linkage.h> |
| @@ -534,4 +538,8 @@ do { \ | |||
| 534 | # define might_lock_read(lock) do { } while (0) | 538 | # define might_lock_read(lock) do { } while (0) |
| 535 | #endif | 539 | #endif |
| 536 | 540 | ||
| 541 | #ifdef CONFIG_PROVE_RCU | ||
| 542 | extern void lockdep_rcu_dereference(const char *file, const int line); | ||
| 543 | #endif | ||
| 544 | |||
| 537 | #endif /* __LINUX_LOCKDEP_H */ | 545 | #endif /* __LINUX_LOCKDEP_H */ |
diff --git a/include/linux/lru_cache.h b/include/linux/lru_cache.h new file mode 100644 index 000000000000..de48d167568b --- /dev/null +++ b/include/linux/lru_cache.h | |||
| @@ -0,0 +1,294 @@ | |||
| 1 | /* | ||
| 2 | lru_cache.c | ||
| 3 | |||
| 4 | This file is part of DRBD by Philipp Reisner and Lars Ellenberg. | ||
| 5 | |||
| 6 | Copyright (C) 2003-2008, LINBIT Information Technologies GmbH. | ||
| 7 | Copyright (C) 2003-2008, Philipp Reisner <philipp.reisner@linbit.com>. | ||
| 8 | Copyright (C) 2003-2008, Lars Ellenberg <lars.ellenberg@linbit.com>. | ||
| 9 | |||
| 10 | drbd 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, or (at your option) | ||
| 13 | any later version. | ||
| 14 | |||
| 15 | drbd is distributed in the hope that it will be useful, | ||
| 16 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 18 | GNU General Public License for more details. | ||
| 19 | |||
| 20 | You should have received a copy of the GNU General Public License | ||
| 21 | along with drbd; see the file COPYING. If not, write to | ||
| 22 | the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. | ||
| 23 | |||
| 24 | */ | ||
| 25 | |||
| 26 | #ifndef LRU_CACHE_H | ||
| 27 | #define LRU_CACHE_H | ||
| 28 | |||
| 29 | #include <linux/list.h> | ||
| 30 | #include <linux/slab.h> | ||
| 31 | #include <linux/bitops.h> | ||
| 32 | #include <linux/string.h> /* for memset */ | ||
| 33 | #include <linux/seq_file.h> | ||
| 34 | |||
| 35 | /* | ||
| 36 | This header file (and its .c file; kernel-doc of functions see there) | ||
| 37 | define a helper framework to easily keep track of index:label associations, | ||
| 38 | and changes to an "active set" of objects, as well as pending transactions, | ||
| 39 | to persistently record those changes. | ||
| 40 | |||
| 41 | We use an LRU policy if it is necessary to "cool down" a region currently in | ||
| 42 | the active set before we can "heat" a previously unused region. | ||
| 43 | |||
| 44 | Because of this later property, it is called "lru_cache". | ||
| 45 | As it actually Tracks Objects in an Active SeT, we could also call it | ||
| 46 | toast (incidentally that is what may happen to the data on the | ||
| 47 | backend storage uppon next resync, if we don't get it right). | ||
| 48 | |||
| 49 | What for? | ||
| 50 | |||
| 51 | We replicate IO (more or less synchronously) to local and remote disk. | ||
| 52 | |||
| 53 | For crash recovery after replication node failure, | ||
| 54 | we need to resync all regions that have been target of in-flight WRITE IO | ||
| 55 | (in use, or "hot", regions), as we don't know wether or not those WRITEs have | ||
| 56 | made it to stable storage. | ||
| 57 | |||
| 58 | To avoid a "full resync", we need to persistently track these regions. | ||
| 59 | |||
| 60 | This is known as "write intent log", and can be implemented as on-disk | ||
| 61 | (coarse or fine grained) bitmap, or other meta data. | ||
| 62 | |||
| 63 | To avoid the overhead of frequent extra writes to this meta data area, | ||
| 64 | usually the condition is softened to regions that _may_ have been target of | ||
| 65 | in-flight WRITE IO, e.g. by only lazily clearing the on-disk write-intent | ||
| 66 | bitmap, trading frequency of meta data transactions against amount of | ||
| 67 | (possibly unnecessary) resync traffic. | ||
| 68 | |||
| 69 | If we set a hard limit on the area that may be "hot" at any given time, we | ||
| 70 | limit the amount of resync traffic needed for crash recovery. | ||
| 71 | |||
| 72 | For recovery after replication link failure, | ||
| 73 | we need to resync all blocks that have been changed on the other replica | ||
| 74 | in the mean time, or, if both replica have been changed independently [*], | ||
| 75 | all blocks that have been changed on either replica in the mean time. | ||
| 76 | [*] usually as a result of a cluster split-brain and insufficient protection. | ||
| 77 | but there are valid use cases to do this on purpose. | ||
| 78 | |||
| 79 | Tracking those blocks can be implemented as "dirty bitmap". | ||
| 80 | Having it fine-grained reduces the amount of resync traffic. | ||
| 81 | It should also be persistent, to allow for reboots (or crashes) | ||
| 82 | while the replication link is down. | ||
| 83 | |||
| 84 | There are various possible implementations for persistently storing | ||
| 85 | write intent log information, three of which are mentioned here. | ||
| 86 | |||
| 87 | "Chunk dirtying" | ||
| 88 | The on-disk "dirty bitmap" may be re-used as "write-intent" bitmap as well. | ||
| 89 | To reduce the frequency of bitmap updates for write-intent log purposes, | ||
| 90 | one could dirty "chunks" (of some size) at a time of the (fine grained) | ||
| 91 | on-disk bitmap, while keeping the in-memory "dirty" bitmap as clean as | ||
| 92 | possible, flushing it to disk again when a previously "hot" (and on-disk | ||
| 93 | dirtied as full chunk) area "cools down" again (no IO in flight anymore, | ||
| 94 | and none expected in the near future either). | ||
| 95 | |||
| 96 | "Explicit (coarse) write intent bitmap" | ||
| 97 | An other implementation could chose a (probably coarse) explicit bitmap, | ||
| 98 | for write-intent log purposes, additionally to the fine grained dirty bitmap. | ||
| 99 | |||
| 100 | "Activity log" | ||
| 101 | Yet an other implementation may keep track of the hot regions, by starting | ||
| 102 | with an empty set, and writing down a journal of region numbers that have | ||
| 103 | become "hot", or have "cooled down" again. | ||
| 104 | |||
| 105 | To be able to use a ring buffer for this journal of changes to the active | ||
| 106 | set, we not only record the actual changes to that set, but also record the | ||
| 107 | not changing members of the set in a round robin fashion. To do so, we use a | ||
| 108 | fixed (but configurable) number of slots which we can identify by index, and | ||
| 109 | associate region numbers (labels) with these indices. | ||
| 110 | For each transaction recording a change to the active set, we record the | ||
| 111 | change itself (index: -old_label, +new_label), and which index is associated | ||
| 112 | with which label (index: current_label) within a certain sliding window that | ||
| 113 | is moved further over the available indices with each such transaction. | ||
| 114 | |||
| 115 | Thus, for crash recovery, if the ringbuffer is sufficiently large, we can | ||
| 116 | accurately reconstruct the active set. | ||
| 117 | |||
| 118 | Sufficiently large depends only on maximum number of active objects, and the | ||
| 119 | size of the sliding window recording "index: current_label" associations within | ||
| 120 | each transaction. | ||
| 121 | |||
| 122 | This is what we call the "activity log". | ||
| 123 | |||
| 124 | Currently we need one activity log transaction per single label change, which | ||
| 125 | does not give much benefit over the "dirty chunks of bitmap" approach, other | ||
| 126 | than potentially less seeks. | ||
| 127 | |||
| 128 | We plan to change the transaction format to support multiple changes per | ||
| 129 | transaction, which then would reduce several (disjoint, "random") updates to | ||
| 130 | the bitmap into one transaction to the activity log ring buffer. | ||
| 131 | */ | ||
| 132 | |||
| 133 | /* this defines an element in a tracked set | ||
| 134 | * .colision is for hash table lookup. | ||
| 135 | * When we process a new IO request, we know its sector, thus can deduce the | ||
| 136 | * region number (label) easily. To do the label -> object lookup without a | ||
| 137 | * full list walk, we use a simple hash table. | ||
| 138 | * | ||
| 139 | * .list is on one of three lists: | ||
| 140 | * in_use: currently in use (refcnt > 0, lc_number != LC_FREE) | ||
| 141 | * lru: unused but ready to be reused or recycled | ||
| 142 | * (ts_refcnt == 0, lc_number != LC_FREE), | ||
| 143 | * free: unused but ready to be recycled | ||
| 144 | * (ts_refcnt == 0, lc_number == LC_FREE), | ||
| 145 | * | ||
| 146 | * an element is said to be "in the active set", | ||
| 147 | * if either on "in_use" or "lru", i.e. lc_number != LC_FREE. | ||
| 148 | * | ||
| 149 | * DRBD currently (May 2009) only uses 61 elements on the resync lru_cache | ||
| 150 | * (total memory usage 2 pages), and up to 3833 elements on the act_log | ||
| 151 | * lru_cache, totalling ~215 kB for 64bit architechture, ~53 pages. | ||
| 152 | * | ||
| 153 | * We usually do not actually free these objects again, but only "recycle" | ||
| 154 | * them, as the change "index: -old_label, +LC_FREE" would need a transaction | ||
| 155 | * as well. Which also means that using a kmem_cache to allocate the objects | ||
| 156 | * from wastes some resources. | ||
| 157 | * But it avoids high order page allocations in kmalloc. | ||
| 158 | */ | ||
| 159 | struct lc_element { | ||
| 160 | struct hlist_node colision; | ||
| 161 | struct list_head list; /* LRU list or free list */ | ||
| 162 | unsigned refcnt; | ||
| 163 | /* back "pointer" into ts_cache->element[index], | ||
| 164 | * for paranoia, and for "ts_element_to_index" */ | ||
| 165 | unsigned lc_index; | ||
| 166 | /* if we want to track a larger set of objects, | ||
| 167 | * it needs to become arch independend u64 */ | ||
| 168 | unsigned lc_number; | ||
| 169 | |||
| 170 | /* special label when on free list */ | ||
| 171 | #define LC_FREE (~0U) | ||
| 172 | }; | ||
| 173 | |||
| 174 | struct lru_cache { | ||
| 175 | /* the least recently used item is kept at lru->prev */ | ||
| 176 | struct list_head lru; | ||
| 177 | struct list_head free; | ||
| 178 | struct list_head in_use; | ||
| 179 | |||
| 180 | /* the pre-created kmem cache to allocate the objects from */ | ||
| 181 | struct kmem_cache *lc_cache; | ||
| 182 | |||
| 183 | /* size of tracked objects, used to memset(,0,) them in lc_reset */ | ||
| 184 | size_t element_size; | ||
| 185 | /* offset of struct lc_element member in the tracked object */ | ||
| 186 | size_t element_off; | ||
| 187 | |||
| 188 | /* number of elements (indices) */ | ||
| 189 | unsigned int nr_elements; | ||
| 190 | /* Arbitrary limit on maximum tracked objects. Practical limit is much | ||
| 191 | * lower due to allocation failures, probably. For typical use cases, | ||
| 192 | * nr_elements should be a few thousand at most. | ||
| 193 | * This also limits the maximum value of ts_element.ts_index, allowing the | ||
| 194 | * 8 high bits of .ts_index to be overloaded with flags in the future. */ | ||
| 195 | #define LC_MAX_ACTIVE (1<<24) | ||
| 196 | |||
| 197 | /* statistics */ | ||
| 198 | unsigned used; /* number of lelements currently on in_use list */ | ||
| 199 | unsigned long hits, misses, starving, dirty, changed; | ||
| 200 | |||
| 201 | /* see below: flag-bits for lru_cache */ | ||
| 202 | unsigned long flags; | ||
| 203 | |||
| 204 | /* when changing the label of an index element */ | ||
| 205 | unsigned int new_number; | ||
| 206 | |||
| 207 | /* for paranoia when changing the label of an index element */ | ||
| 208 | struct lc_element *changing_element; | ||
| 209 | |||
| 210 | void *lc_private; | ||
| 211 | const char *name; | ||
| 212 | |||
| 213 | /* nr_elements there */ | ||
| 214 | struct hlist_head *lc_slot; | ||
| 215 | struct lc_element **lc_element; | ||
| 216 | }; | ||
| 217 | |||
| 218 | |||
| 219 | /* flag-bits for lru_cache */ | ||
| 220 | enum { | ||
| 221 | /* debugging aid, to catch concurrent access early. | ||
| 222 | * user needs to guarantee exclusive access by proper locking! */ | ||
| 223 | __LC_PARANOIA, | ||
| 224 | /* if we need to change the set, but currently there is a changing | ||
| 225 | * transaction pending, we are "dirty", and must deferr further | ||
| 226 | * changing requests */ | ||
| 227 | __LC_DIRTY, | ||
| 228 | /* if we need to change the set, but currently there is no free nor | ||
| 229 | * unused element available, we are "starving", and must not give out | ||
| 230 | * further references, to guarantee that eventually some refcnt will | ||
| 231 | * drop to zero and we will be able to make progress again, changing | ||
| 232 | * the set, writing the transaction. | ||
| 233 | * if the statistics say we are frequently starving, | ||
| 234 | * nr_elements is too small. */ | ||
| 235 | __LC_STARVING, | ||
| 236 | }; | ||
| 237 | #define LC_PARANOIA (1<<__LC_PARANOIA) | ||
| 238 | #define LC_DIRTY (1<<__LC_DIRTY) | ||
| 239 | #define LC_STARVING (1<<__LC_STARVING) | ||
| 240 | |||
| 241 | extern struct lru_cache *lc_create(const char *name, struct kmem_cache *cache, | ||
| 242 | unsigned e_count, size_t e_size, size_t e_off); | ||
| 243 | extern void lc_reset(struct lru_cache *lc); | ||
| 244 | extern void lc_destroy(struct lru_cache *lc); | ||
| 245 | extern void lc_set(struct lru_cache *lc, unsigned int enr, int index); | ||
| 246 | extern void lc_del(struct lru_cache *lc, struct lc_element *element); | ||
| 247 | |||
| 248 | extern struct lc_element *lc_try_get(struct lru_cache *lc, unsigned int enr); | ||
| 249 | extern struct lc_element *lc_find(struct lru_cache *lc, unsigned int enr); | ||
| 250 | extern struct lc_element *lc_get(struct lru_cache *lc, unsigned int enr); | ||
| 251 | extern unsigned int lc_put(struct lru_cache *lc, struct lc_element *e); | ||
| 252 | extern void lc_changed(struct lru_cache *lc, struct lc_element *e); | ||
| 253 | |||
| 254 | struct seq_file; | ||
| 255 | extern size_t lc_seq_printf_stats(struct seq_file *seq, struct lru_cache *lc); | ||
| 256 | |||
| 257 | extern void lc_seq_dump_details(struct seq_file *seq, struct lru_cache *lc, char *utext, | ||
| 258 | void (*detail) (struct seq_file *, struct lc_element *)); | ||
| 259 | |||
| 260 | /** | ||
| 261 | * lc_try_lock - can be used to stop lc_get() from changing the tracked set | ||
| 262 | * @lc: the lru cache to operate on | ||
| 263 | * | ||
| 264 | * Note that the reference counts and order on the active and lru lists may | ||
| 265 | * still change. Returns true if we aquired the lock. | ||
| 266 | */ | ||
| 267 | static inline int lc_try_lock(struct lru_cache *lc) | ||
| 268 | { | ||
| 269 | return !test_and_set_bit(__LC_DIRTY, &lc->flags); | ||
| 270 | } | ||
| 271 | |||
| 272 | /** | ||
| 273 | * lc_unlock - unlock @lc, allow lc_get() to change the set again | ||
| 274 | * @lc: the lru cache to operate on | ||
| 275 | */ | ||
| 276 | static inline void lc_unlock(struct lru_cache *lc) | ||
| 277 | { | ||
| 278 | clear_bit(__LC_DIRTY, &lc->flags); | ||
| 279 | smp_mb__after_clear_bit(); | ||
| 280 | } | ||
| 281 | |||
| 282 | static inline int lc_is_used(struct lru_cache *lc, unsigned int enr) | ||
| 283 | { | ||
| 284 | struct lc_element *e = lc_find(lc, enr); | ||
| 285 | return e && e->refcnt; | ||
| 286 | } | ||
| 287 | |||
| 288 | #define lc_entry(ptr, type, member) \ | ||
| 289 | container_of(ptr, type, member) | ||
| 290 | |||
| 291 | extern struct lc_element *lc_element_by_index(struct lru_cache *lc, unsigned i); | ||
| 292 | extern unsigned int lc_index_of(struct lru_cache *lc, struct lc_element *e); | ||
| 293 | |||
| 294 | #endif | ||
diff --git a/include/linux/lsm_audit.h b/include/linux/lsm_audit.h index 190c37854870..f78f83d7663f 100644 --- a/include/linux/lsm_audit.h +++ b/include/linux/lsm_audit.h | |||
| @@ -26,14 +26,15 @@ | |||
| 26 | 26 | ||
| 27 | /* Auxiliary data to use in generating the audit record. */ | 27 | /* Auxiliary data to use in generating the audit record. */ |
| 28 | struct common_audit_data { | 28 | struct common_audit_data { |
| 29 | char type; | 29 | char type; |
| 30 | #define LSM_AUDIT_DATA_FS 1 | 30 | #define LSM_AUDIT_DATA_FS 1 |
| 31 | #define LSM_AUDIT_DATA_NET 2 | 31 | #define LSM_AUDIT_DATA_NET 2 |
| 32 | #define LSM_AUDIT_DATA_CAP 3 | 32 | #define LSM_AUDIT_DATA_CAP 3 |
| 33 | #define LSM_AUDIT_DATA_IPC 4 | 33 | #define LSM_AUDIT_DATA_IPC 4 |
| 34 | #define LSM_AUDIT_DATA_TASK 5 | 34 | #define LSM_AUDIT_DATA_TASK 5 |
| 35 | #define LSM_AUDIT_DATA_KEY 6 | 35 | #define LSM_AUDIT_DATA_KEY 6 |
| 36 | #define LSM_AUDIT_NO_AUDIT 7 | 36 | #define LSM_AUDIT_NO_AUDIT 7 |
| 37 | #define LSM_AUDIT_DATA_KMOD 8 | ||
| 37 | struct task_struct *tsk; | 38 | struct task_struct *tsk; |
| 38 | union { | 39 | union { |
| 39 | struct { | 40 | struct { |
| @@ -66,6 +67,7 @@ struct common_audit_data { | |||
| 66 | char *key_desc; | 67 | char *key_desc; |
| 67 | } key_struct; | 68 | } key_struct; |
| 68 | #endif | 69 | #endif |
| 70 | char *kmod_name; | ||
| 69 | } u; | 71 | } u; |
| 70 | /* this union contains LSM specific data */ | 72 | /* this union contains LSM specific data */ |
| 71 | union { | 73 | union { |
diff --git a/include/linux/magic.h b/include/linux/magic.h index 76285e01b39e..eb9800f05782 100644 --- a/include/linux/magic.h +++ b/include/linux/magic.h | |||
| @@ -52,7 +52,6 @@ | |||
| 52 | #define CGROUP_SUPER_MAGIC 0x27e0eb | 52 | #define CGROUP_SUPER_MAGIC 0x27e0eb |
| 53 | 53 | ||
| 54 | #define FUTEXFS_SUPER_MAGIC 0xBAD1DEA | 54 | #define FUTEXFS_SUPER_MAGIC 0xBAD1DEA |
| 55 | #define INOTIFYFS_SUPER_MAGIC 0x2BAD1DEA | ||
| 56 | 55 | ||
| 57 | #define STACK_END_MAGIC 0x57AC6E9D | 56 | #define STACK_END_MAGIC 0x57AC6E9D |
| 58 | 57 | ||
diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h index bf9213b2db8f..44301c6affa8 100644 --- a/include/linux/memcontrol.h +++ b/include/linux/memcontrol.h | |||
| @@ -54,6 +54,11 @@ extern void mem_cgroup_rotate_lru_list(struct page *page, enum lru_list lru); | |||
| 54 | extern void mem_cgroup_del_lru(struct page *page); | 54 | extern void mem_cgroup_del_lru(struct page *page); |
| 55 | extern void mem_cgroup_move_lists(struct page *page, | 55 | extern void mem_cgroup_move_lists(struct page *page, |
| 56 | enum lru_list from, enum lru_list to); | 56 | enum lru_list from, enum lru_list to); |
| 57 | |||
| 58 | /* For coalescing uncharge for reducing memcg' overhead*/ | ||
| 59 | extern void mem_cgroup_uncharge_start(void); | ||
| 60 | extern void mem_cgroup_uncharge_end(void); | ||
| 61 | |||
| 57 | extern void mem_cgroup_uncharge_page(struct page *page); | 62 | extern void mem_cgroup_uncharge_page(struct page *page); |
| 58 | extern void mem_cgroup_uncharge_cache_page(struct page *page); | 63 | extern void mem_cgroup_uncharge_cache_page(struct page *page); |
| 59 | extern int mem_cgroup_shmem_charge_fallback(struct page *page, | 64 | extern int mem_cgroup_shmem_charge_fallback(struct page *page, |
| @@ -68,6 +73,7 @@ extern unsigned long mem_cgroup_isolate_pages(unsigned long nr_to_scan, | |||
| 68 | extern void mem_cgroup_out_of_memory(struct mem_cgroup *mem, gfp_t gfp_mask); | 73 | extern void mem_cgroup_out_of_memory(struct mem_cgroup *mem, gfp_t gfp_mask); |
| 69 | int task_in_mem_cgroup(struct task_struct *task, const struct mem_cgroup *mem); | 74 | int task_in_mem_cgroup(struct task_struct *task, const struct mem_cgroup *mem); |
| 70 | 75 | ||
| 76 | extern struct mem_cgroup *try_get_mem_cgroup_from_page(struct page *page); | ||
| 71 | extern struct mem_cgroup *mem_cgroup_from_task(struct task_struct *p); | 77 | extern struct mem_cgroup *mem_cgroup_from_task(struct task_struct *p); |
| 72 | 78 | ||
| 73 | static inline | 79 | static inline |
| @@ -80,6 +86,8 @@ int mm_match_cgroup(const struct mm_struct *mm, const struct mem_cgroup *cgroup) | |||
| 80 | return cgroup == mem; | 86 | return cgroup == mem; |
| 81 | } | 87 | } |
| 82 | 88 | ||
| 89 | extern struct cgroup_subsys_state *mem_cgroup_css(struct mem_cgroup *mem); | ||
| 90 | |||
| 83 | extern int | 91 | extern int |
| 84 | mem_cgroup_prepare_migration(struct page *page, struct mem_cgroup **ptr); | 92 | mem_cgroup_prepare_migration(struct page *page, struct mem_cgroup **ptr); |
| 85 | extern void mem_cgroup_end_migration(struct mem_cgroup *mem, | 93 | extern void mem_cgroup_end_migration(struct mem_cgroup *mem, |
| @@ -116,8 +124,7 @@ static inline bool mem_cgroup_disabled(void) | |||
| 116 | return false; | 124 | return false; |
| 117 | } | 125 | } |
| 118 | 126 | ||
| 119 | extern bool mem_cgroup_oom_called(struct task_struct *task); | 127 | void mem_cgroup_update_file_mapped(struct page *page, int val); |
| 120 | void mem_cgroup_update_mapped_file_stat(struct page *page, int val); | ||
| 121 | unsigned long mem_cgroup_soft_limit_reclaim(struct zone *zone, int order, | 128 | unsigned long mem_cgroup_soft_limit_reclaim(struct zone *zone, int order, |
| 122 | gfp_t gfp_mask, int nid, | 129 | gfp_t gfp_mask, int nid, |
| 123 | int zid); | 130 | int zid); |
| @@ -151,6 +158,14 @@ static inline void mem_cgroup_cancel_charge_swapin(struct mem_cgroup *ptr) | |||
| 151 | { | 158 | { |
| 152 | } | 159 | } |
| 153 | 160 | ||
| 161 | static inline void mem_cgroup_uncharge_start(void) | ||
| 162 | { | ||
| 163 | } | ||
| 164 | |||
| 165 | static inline void mem_cgroup_uncharge_end(void) | ||
| 166 | { | ||
| 167 | } | ||
| 168 | |||
| 154 | static inline void mem_cgroup_uncharge_page(struct page *page) | 169 | static inline void mem_cgroup_uncharge_page(struct page *page) |
| 155 | { | 170 | { |
| 156 | } | 171 | } |
| @@ -189,6 +204,11 @@ mem_cgroup_move_lists(struct page *page, enum lru_list from, enum lru_list to) | |||
| 189 | { | 204 | { |
| 190 | } | 205 | } |
| 191 | 206 | ||
| 207 | static inline struct mem_cgroup *try_get_mem_cgroup_from_page(struct page *page) | ||
| 208 | { | ||
| 209 | return NULL; | ||
| 210 | } | ||
| 211 | |||
| 192 | static inline int mm_match_cgroup(struct mm_struct *mm, struct mem_cgroup *mem) | 212 | static inline int mm_match_cgroup(struct mm_struct *mm, struct mem_cgroup *mem) |
| 193 | { | 213 | { |
| 194 | return 1; | 214 | return 1; |
| @@ -200,6 +220,11 @@ static inline int task_in_mem_cgroup(struct task_struct *task, | |||
| 200 | return 1; | 220 | return 1; |
| 201 | } | 221 | } |
| 202 | 222 | ||
| 223 | static inline struct cgroup_subsys_state *mem_cgroup_css(struct mem_cgroup *mem) | ||
| 224 | { | ||
| 225 | return NULL; | ||
| 226 | } | ||
| 227 | |||
| 203 | static inline int | 228 | static inline int |
| 204 | mem_cgroup_prepare_migration(struct page *page, struct mem_cgroup **ptr) | 229 | mem_cgroup_prepare_migration(struct page *page, struct mem_cgroup **ptr) |
| 205 | { | 230 | { |
| @@ -232,11 +257,6 @@ static inline bool mem_cgroup_disabled(void) | |||
| 232 | return true; | 257 | return true; |
| 233 | } | 258 | } |
| 234 | 259 | ||
| 235 | static inline bool mem_cgroup_oom_called(struct task_struct *task) | ||
| 236 | { | ||
| 237 | return false; | ||
| 238 | } | ||
| 239 | |||
| 240 | static inline int | 260 | static inline int |
| 241 | mem_cgroup_inactive_anon_is_low(struct mem_cgroup *memcg) | 261 | mem_cgroup_inactive_anon_is_low(struct mem_cgroup *memcg) |
| 242 | { | 262 | { |
| @@ -274,7 +294,7 @@ mem_cgroup_print_oom_info(struct mem_cgroup *memcg, struct task_struct *p) | |||
| 274 | { | 294 | { |
| 275 | } | 295 | } |
| 276 | 296 | ||
| 277 | static inline void mem_cgroup_update_mapped_file_stat(struct page *page, | 297 | static inline void mem_cgroup_update_file_mapped(struct page *page, |
| 278 | int val) | 298 | int val) |
| 279 | { | 299 | { |
| 280 | } | 300 | } |
diff --git a/include/linux/memory.h b/include/linux/memory.h index 37fa19b34ef5..85582e1bcee9 100644 --- a/include/linux/memory.h +++ b/include/linux/memory.h | |||
| @@ -36,6 +36,8 @@ struct memory_block { | |||
| 36 | struct sys_device sysdev; | 36 | struct sys_device sysdev; |
| 37 | }; | 37 | }; |
| 38 | 38 | ||
| 39 | int arch_get_memory_phys_device(unsigned long start_pfn); | ||
| 40 | |||
| 39 | /* These states are exposed to userspace as text strings in sysfs */ | 41 | /* These states are exposed to userspace as text strings in sysfs */ |
| 40 | #define MEM_ONLINE (1<<0) /* exposed to userspace */ | 42 | #define MEM_ONLINE (1<<0) /* exposed to userspace */ |
| 41 | #define MEM_GOING_OFFLINE (1<<1) /* exposed to userspace */ | 43 | #define MEM_GOING_OFFLINE (1<<1) /* exposed to userspace */ |
| @@ -50,6 +52,19 @@ struct memory_notify { | |||
| 50 | int status_change_nid; | 52 | int status_change_nid; |
| 51 | }; | 53 | }; |
| 52 | 54 | ||
| 55 | /* | ||
| 56 | * During pageblock isolation, count the number of pages within the | ||
| 57 | * range [start_pfn, start_pfn + nr_pages) which are owned by code | ||
| 58 | * in the notifier chain. | ||
| 59 | */ | ||
| 60 | #define MEM_ISOLATE_COUNT (1<<0) | ||
| 61 | |||
| 62 | struct memory_isolate_notify { | ||
| 63 | unsigned long start_pfn; /* Start of range to check */ | ||
| 64 | unsigned int nr_pages; /* # pages in range to check */ | ||
| 65 | unsigned int pages_found; /* # pages owned found by callbacks */ | ||
| 66 | }; | ||
| 67 | |||
| 53 | struct notifier_block; | 68 | struct notifier_block; |
| 54 | struct mem_section; | 69 | struct mem_section; |
| 55 | 70 | ||
| @@ -76,14 +91,28 @@ static inline int memory_notify(unsigned long val, void *v) | |||
| 76 | { | 91 | { |
| 77 | return 0; | 92 | return 0; |
| 78 | } | 93 | } |
| 94 | static inline int register_memory_isolate_notifier(struct notifier_block *nb) | ||
| 95 | { | ||
| 96 | return 0; | ||
| 97 | } | ||
| 98 | static inline void unregister_memory_isolate_notifier(struct notifier_block *nb) | ||
| 99 | { | ||
| 100 | } | ||
| 101 | static inline int memory_isolate_notify(unsigned long val, void *v) | ||
| 102 | { | ||
| 103 | return 0; | ||
| 104 | } | ||
| 79 | #else | 105 | #else |
| 80 | extern int register_memory_notifier(struct notifier_block *nb); | 106 | extern int register_memory_notifier(struct notifier_block *nb); |
| 81 | extern void unregister_memory_notifier(struct notifier_block *nb); | 107 | extern void unregister_memory_notifier(struct notifier_block *nb); |
| 108 | extern int register_memory_isolate_notifier(struct notifier_block *nb); | ||
| 109 | extern void unregister_memory_isolate_notifier(struct notifier_block *nb); | ||
| 82 | extern int register_new_memory(int, struct mem_section *); | 110 | extern int register_new_memory(int, struct mem_section *); |
| 83 | extern int unregister_memory_section(struct mem_section *); | 111 | extern int unregister_memory_section(struct mem_section *); |
| 84 | extern int memory_dev_init(void); | 112 | extern int memory_dev_init(void); |
| 85 | extern int remove_memory_block(unsigned long, struct mem_section *, int); | 113 | extern int remove_memory_block(unsigned long, struct mem_section *, int); |
| 86 | extern int memory_notify(unsigned long val, void *v); | 114 | extern int memory_notify(unsigned long val, void *v); |
| 115 | extern int memory_isolate_notify(unsigned long val, void *v); | ||
| 87 | extern struct memory_block *find_memory_block(struct mem_section *); | 116 | extern struct memory_block *find_memory_block(struct mem_section *); |
| 88 | #define CONFIG_MEM_BLOCK_SIZE (PAGES_PER_SECTION<<PAGE_SHIFT) | 117 | #define CONFIG_MEM_BLOCK_SIZE (PAGES_PER_SECTION<<PAGE_SHIFT) |
| 89 | enum mem_add_context { BOOT, HOTPLUG }; | 118 | enum mem_add_context { BOOT, HOTPLUG }; |
diff --git a/include/linux/memory_hotplug.h b/include/linux/memory_hotplug.h index fed969281a41..35b07b773e6c 100644 --- a/include/linux/memory_hotplug.h +++ b/include/linux/memory_hotplug.h | |||
| @@ -69,7 +69,6 @@ extern void online_page(struct page *page); | |||
| 69 | /* VM interface that may be used by firmware interface */ | 69 | /* VM interface that may be used by firmware interface */ |
| 70 | extern int online_pages(unsigned long, unsigned long); | 70 | extern int online_pages(unsigned long, unsigned long); |
| 71 | extern void __offline_isolated_pages(unsigned long, unsigned long); | 71 | extern void __offline_isolated_pages(unsigned long, unsigned long); |
| 72 | extern int offline_pages(unsigned long, unsigned long, unsigned long); | ||
| 73 | 72 | ||
| 74 | /* reasonably generic interface to expand the physical pages in a zone */ | 73 | /* reasonably generic interface to expand the physical pages in a zone */ |
| 75 | extern int __add_pages(int nid, struct zone *zone, unsigned long start_pfn, | 74 | extern int __add_pages(int nid, struct zone *zone, unsigned long start_pfn, |
diff --git a/include/linux/mempolicy.h b/include/linux/mempolicy.h index 085c903fe0f1..1cc966cd3e5f 100644 --- a/include/linux/mempolicy.h +++ b/include/linux/mempolicy.h | |||
| @@ -201,6 +201,7 @@ extern void mpol_fix_fork_child_flag(struct task_struct *p); | |||
| 201 | extern struct zonelist *huge_zonelist(struct vm_area_struct *vma, | 201 | extern struct zonelist *huge_zonelist(struct vm_area_struct *vma, |
| 202 | unsigned long addr, gfp_t gfp_flags, | 202 | unsigned long addr, gfp_t gfp_flags, |
| 203 | struct mempolicy **mpol, nodemask_t **nodemask); | 203 | struct mempolicy **mpol, nodemask_t **nodemask); |
| 204 | extern bool init_nodemask_of_mempolicy(nodemask_t *mask); | ||
| 204 | extern unsigned slab_node(struct mempolicy *policy); | 205 | extern unsigned slab_node(struct mempolicy *policy); |
| 205 | 206 | ||
| 206 | extern enum zone_type policy_zone; | 207 | extern enum zone_type policy_zone; |
| @@ -328,6 +329,8 @@ static inline struct zonelist *huge_zonelist(struct vm_area_struct *vma, | |||
| 328 | return node_zonelist(0, gfp_flags); | 329 | return node_zonelist(0, gfp_flags); |
| 329 | } | 330 | } |
| 330 | 331 | ||
| 332 | static inline bool init_nodemask_of_mempolicy(nodemask_t *m) { return false; } | ||
| 333 | |||
| 331 | static inline int do_migrate_pages(struct mm_struct *mm, | 334 | static inline int do_migrate_pages(struct mm_struct *mm, |
| 332 | const nodemask_t *from_nodes, | 335 | const nodemask_t *from_nodes, |
| 333 | const nodemask_t *to_nodes, int flags) | 336 | const nodemask_t *to_nodes, int flags) |
diff --git a/include/linux/mfd/88pm860x.h b/include/linux/mfd/88pm860x.h new file mode 100644 index 000000000000..73f92c5feea2 --- /dev/null +++ b/include/linux/mfd/88pm860x.h | |||
| @@ -0,0 +1,375 @@ | |||
| 1 | /* | ||
| 2 | * Marvell 88PM860x Interface | ||
| 3 | * | ||
| 4 | * Copyright (C) 2009 Marvell International Ltd. | ||
| 5 | * Haojian Zhuang <haojian.zhuang@marvell.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 __LINUX_MFD_88PM860X_H | ||
| 13 | #define __LINUX_MFD_88PM860X_H | ||
| 14 | |||
| 15 | #include <linux/interrupt.h> | ||
| 16 | |||
| 17 | #define MFD_NAME_SIZE (40) | ||
| 18 | |||
| 19 | enum { | ||
| 20 | CHIP_INVALID = 0, | ||
| 21 | CHIP_PM8606, | ||
| 22 | CHIP_PM8607, | ||
| 23 | CHIP_MAX, | ||
| 24 | }; | ||
| 25 | |||
| 26 | enum { | ||
| 27 | PM8606_ID_INVALID, | ||
| 28 | PM8606_ID_BACKLIGHT, | ||
| 29 | PM8606_ID_LED, | ||
| 30 | PM8606_ID_VIBRATOR, | ||
| 31 | PM8606_ID_TOUCH, | ||
| 32 | PM8606_ID_SOUND, | ||
| 33 | PM8606_ID_CHARGER, | ||
| 34 | PM8606_ID_MAX, | ||
| 35 | }; | ||
| 36 | |||
| 37 | enum { | ||
| 38 | PM8606_BACKLIGHT1 = 0, | ||
| 39 | PM8606_BACKLIGHT2, | ||
| 40 | PM8606_BACKLIGHT3, | ||
| 41 | }; | ||
| 42 | |||
| 43 | enum { | ||
| 44 | PM8606_LED1_RED = 0, | ||
| 45 | PM8606_LED1_GREEN, | ||
| 46 | PM8606_LED1_BLUE, | ||
| 47 | PM8606_LED2_RED, | ||
| 48 | PM8606_LED2_GREEN, | ||
| 49 | PM8606_LED2_BLUE, | ||
| 50 | PM8607_LED_VIBRATOR, | ||
| 51 | }; | ||
| 52 | |||
| 53 | |||
| 54 | /* 8606 Registers */ | ||
| 55 | #define PM8606_DCM_BOOST (0x00) | ||
| 56 | #define PM8606_PWM (0x01) | ||
| 57 | |||
| 58 | /* Backlight Registers */ | ||
| 59 | #define PM8606_WLED1A (0x02) | ||
| 60 | #define PM8606_WLED1B (0x03) | ||
| 61 | #define PM8606_WLED2A (0x04) | ||
| 62 | #define PM8606_WLED2B (0x05) | ||
| 63 | #define PM8606_WLED3A (0x06) | ||
| 64 | #define PM8606_WLED3B (0x07) | ||
| 65 | |||
| 66 | /* LED Registers */ | ||
| 67 | #define PM8606_RGB2A (0x08) | ||
| 68 | #define PM8606_RGB2B (0x09) | ||
| 69 | #define PM8606_RGB2C (0x0A) | ||
| 70 | #define PM8606_RGB2D (0x0B) | ||
| 71 | #define PM8606_RGB1A (0x0C) | ||
| 72 | #define PM8606_RGB1B (0x0D) | ||
| 73 | #define PM8606_RGB1C (0x0E) | ||
| 74 | #define PM8606_RGB1D (0x0F) | ||
| 75 | |||
| 76 | #define PM8606_PREREGULATORA (0x10) | ||
| 77 | #define PM8606_PREREGULATORB (0x11) | ||
| 78 | #define PM8606_VIBRATORA (0x12) | ||
| 79 | #define PM8606_VIBRATORB (0x13) | ||
| 80 | #define PM8606_VCHG (0x14) | ||
| 81 | #define PM8606_VSYS (0x15) | ||
| 82 | #define PM8606_MISC (0x16) | ||
| 83 | #define PM8606_CHIP_ID (0x17) | ||
| 84 | #define PM8606_STATUS (0x18) | ||
| 85 | #define PM8606_FLAGS (0x19) | ||
| 86 | #define PM8606_PROTECTA (0x1A) | ||
| 87 | #define PM8606_PROTECTB (0x1B) | ||
| 88 | #define PM8606_PROTECTC (0x1C) | ||
| 89 | |||
| 90 | /* Bit definitions of PM8606 registers */ | ||
| 91 | #define PM8606_DCM_500MA (0x0) /* current limit */ | ||
| 92 | #define PM8606_DCM_750MA (0x1) | ||
| 93 | #define PM8606_DCM_1000MA (0x2) | ||
| 94 | #define PM8606_DCM_1250MA (0x3) | ||
| 95 | #define PM8606_DCM_250MV (0x0 << 2) | ||
| 96 | #define PM8606_DCM_300MV (0x1 << 2) | ||
| 97 | #define PM8606_DCM_350MV (0x2 << 2) | ||
| 98 | #define PM8606_DCM_400MV (0x3 << 2) | ||
| 99 | |||
| 100 | #define PM8606_PWM_31200HZ (0x0) | ||
| 101 | #define PM8606_PWM_15600HZ (0x1) | ||
| 102 | #define PM8606_PWM_7800HZ (0x2) | ||
| 103 | #define PM8606_PWM_3900HZ (0x3) | ||
| 104 | #define PM8606_PWM_1950HZ (0x4) | ||
| 105 | #define PM8606_PWM_976HZ (0x5) | ||
| 106 | #define PM8606_PWM_488HZ (0x6) | ||
| 107 | #define PM8606_PWM_244HZ (0x7) | ||
| 108 | #define PM8606_PWM_FREQ_MASK (0x7) | ||
| 109 | |||
| 110 | #define PM8606_WLED_ON (1 << 0) | ||
| 111 | #define PM8606_WLED_CURRENT(x) ((x & 0x1F) << 1) | ||
| 112 | |||
| 113 | #define PM8606_LED_CURRENT(x) (((x >> 2) & 0x07) << 5) | ||
| 114 | |||
| 115 | #define PM8606_VSYS_EN (1 << 1) | ||
| 116 | |||
| 117 | #define PM8606_MISC_OSC_EN (1 << 4) | ||
| 118 | |||
| 119 | enum { | ||
| 120 | PM8607_ID_BUCK1 = 0, | ||
| 121 | PM8607_ID_BUCK2, | ||
| 122 | PM8607_ID_BUCK3, | ||
| 123 | |||
| 124 | PM8607_ID_LDO1, | ||
| 125 | PM8607_ID_LDO2, | ||
| 126 | PM8607_ID_LDO3, | ||
| 127 | PM8607_ID_LDO4, | ||
| 128 | PM8607_ID_LDO5, | ||
| 129 | PM8607_ID_LDO6, | ||
| 130 | PM8607_ID_LDO7, | ||
| 131 | PM8607_ID_LDO8, | ||
| 132 | PM8607_ID_LDO9, | ||
| 133 | PM8607_ID_LDO10, | ||
| 134 | PM8607_ID_LDO12, | ||
| 135 | PM8607_ID_LDO14, | ||
| 136 | |||
| 137 | PM8607_ID_RG_MAX, | ||
| 138 | }; | ||
| 139 | |||
| 140 | #define PM8607_VERSION (0x40) /* 8607 chip ID */ | ||
| 141 | #define PM8607_VERSION_MASK (0xF0) /* 8607 chip ID mask */ | ||
| 142 | |||
| 143 | /* Interrupt Registers */ | ||
| 144 | #define PM8607_STATUS_1 (0x01) | ||
| 145 | #define PM8607_STATUS_2 (0x02) | ||
| 146 | #define PM8607_INT_STATUS1 (0x03) | ||
| 147 | #define PM8607_INT_STATUS2 (0x04) | ||
| 148 | #define PM8607_INT_STATUS3 (0x05) | ||
| 149 | #define PM8607_INT_MASK_1 (0x06) | ||
| 150 | #define PM8607_INT_MASK_2 (0x07) | ||
| 151 | #define PM8607_INT_MASK_3 (0x08) | ||
| 152 | |||
| 153 | /* Regulator Control Registers */ | ||
| 154 | #define PM8607_LDO1 (0x10) | ||
| 155 | #define PM8607_LDO2 (0x11) | ||
| 156 | #define PM8607_LDO3 (0x12) | ||
| 157 | #define PM8607_LDO4 (0x13) | ||
| 158 | #define PM8607_LDO5 (0x14) | ||
| 159 | #define PM8607_LDO6 (0x15) | ||
| 160 | #define PM8607_LDO7 (0x16) | ||
| 161 | #define PM8607_LDO8 (0x17) | ||
| 162 | #define PM8607_LDO9 (0x18) | ||
| 163 | #define PM8607_LDO10 (0x19) | ||
| 164 | #define PM8607_LDO12 (0x1A) | ||
| 165 | #define PM8607_LDO14 (0x1B) | ||
| 166 | #define PM8607_SLEEP_MODE1 (0x1C) | ||
| 167 | #define PM8607_SLEEP_MODE2 (0x1D) | ||
| 168 | #define PM8607_SLEEP_MODE3 (0x1E) | ||
| 169 | #define PM8607_SLEEP_MODE4 (0x1F) | ||
| 170 | #define PM8607_GO (0x20) | ||
| 171 | #define PM8607_SLEEP_BUCK1 (0x21) | ||
| 172 | #define PM8607_SLEEP_BUCK2 (0x22) | ||
| 173 | #define PM8607_SLEEP_BUCK3 (0x23) | ||
| 174 | #define PM8607_BUCK1 (0x24) | ||
| 175 | #define PM8607_BUCK2 (0x25) | ||
| 176 | #define PM8607_BUCK3 (0x26) | ||
| 177 | #define PM8607_BUCK_CONTROLS (0x27) | ||
| 178 | #define PM8607_SUPPLIES_EN11 (0x2B) | ||
| 179 | #define PM8607_SUPPLIES_EN12 (0x2C) | ||
| 180 | #define PM8607_GROUP1 (0x2D) | ||
| 181 | #define PM8607_GROUP2 (0x2E) | ||
| 182 | #define PM8607_GROUP3 (0x2F) | ||
| 183 | #define PM8607_GROUP4 (0x30) | ||
| 184 | #define PM8607_GROUP5 (0x31) | ||
| 185 | #define PM8607_GROUP6 (0x32) | ||
| 186 | #define PM8607_SUPPLIES_EN21 (0x33) | ||
| 187 | #define PM8607_SUPPLIES_EN22 (0x34) | ||
| 188 | |||
| 189 | /* Vibrator Control Registers */ | ||
| 190 | #define PM8607_VIBRATOR_SET (0x28) | ||
| 191 | #define PM8607_VIBRATOR_PWM (0x29) | ||
| 192 | |||
| 193 | /* GPADC Registers */ | ||
| 194 | #define PM8607_GP_BIAS1 (0x4F) | ||
| 195 | #define PM8607_MEAS_EN1 (0x50) | ||
| 196 | #define PM8607_MEAS_EN2 (0x51) | ||
| 197 | #define PM8607_MEAS_EN3 (0x52) | ||
| 198 | #define PM8607_MEAS_OFF_TIME1 (0x53) | ||
| 199 | #define PM8607_MEAS_OFF_TIME2 (0x54) | ||
| 200 | #define PM8607_TSI_PREBIAS (0x55) /* prebias time */ | ||
| 201 | #define PM8607_PD_PREBIAS (0x56) /* prebias time */ | ||
| 202 | #define PM8607_GPADC_MISC1 (0x57) | ||
| 203 | |||
| 204 | /* RTC Control Registers */ | ||
| 205 | #define PM8607_RTC1 (0xA0) | ||
| 206 | #define PM8607_RTC_COUNTER1 (0xA1) | ||
| 207 | #define PM8607_RTC_COUNTER2 (0xA2) | ||
| 208 | #define PM8607_RTC_COUNTER3 (0xA3) | ||
| 209 | #define PM8607_RTC_COUNTER4 (0xA4) | ||
| 210 | #define PM8607_RTC_EXPIRE1 (0xA5) | ||
| 211 | #define PM8607_RTC_EXPIRE2 (0xA6) | ||
| 212 | #define PM8607_RTC_EXPIRE3 (0xA7) | ||
| 213 | #define PM8607_RTC_EXPIRE4 (0xA8) | ||
| 214 | #define PM8607_RTC_TRIM1 (0xA9) | ||
| 215 | #define PM8607_RTC_TRIM2 (0xAA) | ||
| 216 | #define PM8607_RTC_TRIM3 (0xAB) | ||
| 217 | #define PM8607_RTC_TRIM4 (0xAC) | ||
| 218 | #define PM8607_RTC_MISC1 (0xAD) | ||
| 219 | #define PM8607_RTC_MISC2 (0xAE) | ||
| 220 | #define PM8607_RTC_MISC3 (0xAF) | ||
| 221 | |||
| 222 | /* Misc Registers */ | ||
| 223 | #define PM8607_CHIP_ID (0x00) | ||
| 224 | #define PM8607_B0_MISC1 (0x0C) | ||
| 225 | #define PM8607_LDO1 (0x10) | ||
| 226 | #define PM8607_DVC3 (0x26) | ||
| 227 | #define PM8607_A1_MISC1 (0x40) | ||
| 228 | |||
| 229 | /* bit definitions of Status Query Interface */ | ||
| 230 | #define PM8607_STATUS_CC (1 << 3) | ||
| 231 | #define PM8607_STATUS_PEN (1 << 4) | ||
| 232 | #define PM8607_STATUS_HEADSET (1 << 5) | ||
| 233 | #define PM8607_STATUS_HOOK (1 << 6) | ||
| 234 | #define PM8607_STATUS_MICIN (1 << 7) | ||
| 235 | #define PM8607_STATUS_ONKEY (1 << 8) | ||
| 236 | #define PM8607_STATUS_EXTON (1 << 9) | ||
| 237 | #define PM8607_STATUS_CHG (1 << 10) | ||
| 238 | #define PM8607_STATUS_BAT (1 << 11) | ||
| 239 | #define PM8607_STATUS_VBUS (1 << 12) | ||
| 240 | #define PM8607_STATUS_OV (1 << 13) | ||
| 241 | |||
| 242 | /* bit definitions of BUCK3 */ | ||
| 243 | #define PM8607_BUCK3_DOUBLE (1 << 6) | ||
| 244 | |||
| 245 | /* bit definitions of Misc1 */ | ||
| 246 | #define PM8607_A1_MISC1_PI2C (1 << 0) | ||
| 247 | #define PM8607_B0_MISC1_INV_INT (1 << 0) | ||
| 248 | #define PM8607_B0_MISC1_INT_CLEAR (1 << 1) | ||
| 249 | #define PM8607_B0_MISC1_INT_MASK (1 << 2) | ||
| 250 | #define PM8607_B0_MISC1_PI2C (1 << 3) | ||
| 251 | #define PM8607_B0_MISC1_RESET (1 << 6) | ||
| 252 | |||
| 253 | /* bits definitions of GPADC */ | ||
| 254 | #define PM8607_GPADC_EN (1 << 0) | ||
| 255 | #define PM8607_GPADC_PREBIAS_MASK (3 << 1) | ||
| 256 | #define PM8607_GPADC_SLOT_CYCLE_MASK (3 << 3) /* slow mode */ | ||
| 257 | #define PM8607_GPADC_OFF_SCALE_MASK (3 << 5) /* GP sleep mode */ | ||
| 258 | #define PM8607_GPADC_SW_CAL_MASK (1 << 7) | ||
| 259 | |||
| 260 | #define PM8607_PD_PREBIAS_MASK (0x1F << 0) | ||
| 261 | #define PM8607_PD_PRECHG_MASK (7 << 5) | ||
| 262 | |||
| 263 | /* Interrupt Number in 88PM8607 */ | ||
| 264 | enum { | ||
| 265 | PM8607_IRQ_ONKEY, | ||
| 266 | PM8607_IRQ_EXTON, | ||
| 267 | PM8607_IRQ_CHG, | ||
| 268 | PM8607_IRQ_BAT, | ||
| 269 | PM8607_IRQ_RTC, | ||
| 270 | PM8607_IRQ_CC, | ||
| 271 | PM8607_IRQ_VBAT, | ||
| 272 | PM8607_IRQ_VCHG, | ||
| 273 | PM8607_IRQ_VSYS, | ||
| 274 | PM8607_IRQ_TINT, | ||
| 275 | PM8607_IRQ_GPADC0, | ||
| 276 | PM8607_IRQ_GPADC1, | ||
| 277 | PM8607_IRQ_GPADC2, | ||
| 278 | PM8607_IRQ_GPADC3, | ||
| 279 | PM8607_IRQ_AUDIO_SHORT, | ||
| 280 | PM8607_IRQ_PEN, | ||
| 281 | PM8607_IRQ_HEADSET, | ||
| 282 | PM8607_IRQ_HOOK, | ||
| 283 | PM8607_IRQ_MICIN, | ||
| 284 | PM8607_IRQ_CHG_FAIL, | ||
| 285 | PM8607_IRQ_CHG_DONE, | ||
| 286 | PM8607_IRQ_CHG_FAULT, | ||
| 287 | }; | ||
| 288 | |||
| 289 | enum { | ||
| 290 | PM8607_CHIP_A0 = 0x40, | ||
| 291 | PM8607_CHIP_A1 = 0x41, | ||
| 292 | PM8607_CHIP_B0 = 0x48, | ||
| 293 | }; | ||
| 294 | |||
| 295 | struct pm860x_chip { | ||
| 296 | struct device *dev; | ||
| 297 | struct mutex io_lock; | ||
| 298 | struct mutex irq_lock; | ||
| 299 | struct i2c_client *client; | ||
| 300 | struct i2c_client *companion; /* companion chip client */ | ||
| 301 | |||
| 302 | int buck3_double; /* DVC ramp slope double */ | ||
| 303 | unsigned short companion_addr; | ||
| 304 | int id; | ||
| 305 | int irq_mode; | ||
| 306 | int irq_base; | ||
| 307 | int core_irq; | ||
| 308 | unsigned char chip_version; | ||
| 309 | |||
| 310 | }; | ||
| 311 | |||
| 312 | #define PM8607_MAX_REGULATOR 15 /* 3 Bucks, 12 LDOs */ | ||
| 313 | |||
| 314 | enum { | ||
| 315 | GI2C_PORT = 0, | ||
| 316 | PI2C_PORT, | ||
| 317 | }; | ||
| 318 | |||
| 319 | struct pm860x_backlight_pdata { | ||
| 320 | int id; | ||
| 321 | int pwm; | ||
| 322 | int iset; | ||
| 323 | unsigned long flags; | ||
| 324 | }; | ||
| 325 | |||
| 326 | struct pm860x_led_pdata { | ||
| 327 | int id; | ||
| 328 | int iset; | ||
| 329 | unsigned long flags; | ||
| 330 | }; | ||
| 331 | |||
| 332 | struct pm860x_touch_pdata { | ||
| 333 | int gpadc_prebias; | ||
| 334 | int slot_cycle; | ||
| 335 | int off_scale; | ||
| 336 | int sw_cal; | ||
| 337 | int tsi_prebias; /* time, slot */ | ||
| 338 | int pen_prebias; /* time, slot */ | ||
| 339 | int pen_prechg; /* time, slot */ | ||
| 340 | int res_x; /* resistor of Xplate */ | ||
| 341 | unsigned long flags; | ||
| 342 | }; | ||
| 343 | |||
| 344 | struct pm860x_power_pdata { | ||
| 345 | unsigned fast_charge; /* charge current */ | ||
| 346 | }; | ||
| 347 | |||
| 348 | struct pm860x_platform_data { | ||
| 349 | struct pm860x_backlight_pdata *backlight; | ||
| 350 | struct pm860x_led_pdata *led; | ||
| 351 | struct pm860x_touch_pdata *touch; | ||
| 352 | struct pm860x_power_pdata *power; | ||
| 353 | |||
| 354 | unsigned short companion_addr; /* I2C address of companion chip */ | ||
| 355 | int i2c_port; /* Controlled by GI2C or PI2C */ | ||
| 356 | int irq_mode; /* Clear interrupt by read/write(0/1) */ | ||
| 357 | int irq_base; /* IRQ base number of 88pm860x */ | ||
| 358 | struct regulator_init_data *regulator[PM8607_MAX_REGULATOR]; | ||
| 359 | }; | ||
| 360 | |||
| 361 | extern char pm860x_backlight_name[][MFD_NAME_SIZE]; | ||
| 362 | extern char pm860x_led_name[][MFD_NAME_SIZE]; | ||
| 363 | |||
| 364 | extern int pm860x_reg_read(struct i2c_client *, int); | ||
| 365 | extern int pm860x_reg_write(struct i2c_client *, int, unsigned char); | ||
| 366 | extern int pm860x_bulk_read(struct i2c_client *, int, int, unsigned char *); | ||
| 367 | extern int pm860x_bulk_write(struct i2c_client *, int, int, unsigned char *); | ||
| 368 | extern int pm860x_set_bits(struct i2c_client *, int, unsigned char, | ||
| 369 | unsigned char); | ||
| 370 | |||
| 371 | extern int pm860x_device_init(struct pm860x_chip *chip, | ||
| 372 | struct pm860x_platform_data *pdata); | ||
| 373 | extern void pm860x_device_exit(struct pm860x_chip *chip); | ||
| 374 | |||
| 375 | #endif /* __LINUX_MFD_88PM860X_H */ | ||
diff --git a/include/linux/mfd/ab3100.h b/include/linux/mfd/ab3100.h index e9aa4c9d749d..9a881c305a50 100644 --- a/include/linux/mfd/ab3100.h +++ b/include/linux/mfd/ab3100.h | |||
| @@ -6,7 +6,6 @@ | |||
| 6 | */ | 6 | */ |
| 7 | 7 | ||
| 8 | #include <linux/device.h> | 8 | #include <linux/device.h> |
| 9 | #include <linux/workqueue.h> | ||
| 10 | #include <linux/regulator/machine.h> | 9 | #include <linux/regulator/machine.h> |
| 11 | 10 | ||
| 12 | #ifndef MFD_AB3100_H | 11 | #ifndef MFD_AB3100_H |
| @@ -74,7 +73,6 @@ | |||
| 74 | * @testreg_client: secondary client for test registers | 73 | * @testreg_client: secondary client for test registers |
| 75 | * @chip_name: name of this chip variant | 74 | * @chip_name: name of this chip variant |
| 76 | * @chip_id: 8 bit chip ID for this chip variant | 75 | * @chip_id: 8 bit chip ID for this chip variant |
| 77 | * @work: an event handling worker | ||
| 78 | * @event_subscribers: event subscribers are listed here | 76 | * @event_subscribers: event subscribers are listed here |
| 79 | * @startup_events: a copy of the first reading of the event registers | 77 | * @startup_events: a copy of the first reading of the event registers |
| 80 | * @startup_events_read: whether the first events have been read | 78 | * @startup_events_read: whether the first events have been read |
| @@ -90,7 +88,6 @@ struct ab3100 { | |||
| 90 | struct i2c_client *testreg_client; | 88 | struct i2c_client *testreg_client; |
| 91 | char chip_name[32]; | 89 | char chip_name[32]; |
| 92 | u8 chip_id; | 90 | u8 chip_id; |
| 93 | struct work_struct work; | ||
| 94 | struct blocking_notifier_head event_subscribers; | 91 | struct blocking_notifier_head event_subscribers; |
| 95 | u32 startup_events; | 92 | u32 startup_events; |
| 96 | bool startup_events_read; | 93 | bool startup_events_read; |
diff --git a/include/linux/mfd/ab4500.h b/include/linux/mfd/ab4500.h new file mode 100644 index 000000000000..a42a7033ae53 --- /dev/null +++ b/include/linux/mfd/ab4500.h | |||
| @@ -0,0 +1,262 @@ | |||
| 1 | /* | ||
| 2 | * Copyright (C) 2009 ST-Ericsson | ||
| 3 | * | ||
| 4 | * Author: Srinidhi KASAGAR <srinidhi.kasagar@stericsson.com> | ||
| 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 | * AB4500 device core funtions, for client access | ||
| 11 | */ | ||
| 12 | #ifndef MFD_AB4500_H | ||
| 13 | #define MFD_AB4500_H | ||
| 14 | |||
| 15 | #include <linux/device.h> | ||
| 16 | |||
| 17 | /* | ||
| 18 | * AB4500 bank addresses | ||
| 19 | */ | ||
| 20 | #define AB4500_SYS_CTRL1_BLOCK 0x1 | ||
| 21 | #define AB4500_SYS_CTRL2_BLOCK 0x2 | ||
| 22 | #define AB4500_REGU_CTRL1 0x3 | ||
| 23 | #define AB4500_REGU_CTRL2 0x4 | ||
| 24 | #define AB4500_USB 0x5 | ||
| 25 | #define AB4500_TVOUT 0x6 | ||
| 26 | #define AB4500_DBI 0x7 | ||
| 27 | #define AB4500_ECI_AV_ACC 0x8 | ||
| 28 | #define AB4500_RESERVED 0x9 | ||
| 29 | #define AB4500_GPADC 0xA | ||
| 30 | #define AB4500_CHARGER 0xB | ||
| 31 | #define AB4500_GAS_GAUGE 0xC | ||
| 32 | #define AB4500_AUDIO 0xD | ||
| 33 | #define AB4500_INTERRUPT 0xE | ||
| 34 | #define AB4500_RTC 0xF | ||
| 35 | #define AB4500_MISC 0x10 | ||
| 36 | #define AB4500_DEBUG 0x12 | ||
| 37 | #define AB4500_PROD_TEST 0x13 | ||
| 38 | #define AB4500_OTP_EMUL 0x15 | ||
| 39 | |||
| 40 | /* | ||
| 41 | * System control 1 register offsets. | ||
| 42 | * Bank = 0x01 | ||
| 43 | */ | ||
| 44 | #define AB4500_TURNON_STAT_REG 0x0100 | ||
| 45 | #define AB4500_RESET_STAT_REG 0x0101 | ||
| 46 | #define AB4500_PONKEY1_PRESS_STAT_REG 0x0102 | ||
| 47 | |||
| 48 | #define AB4500_FSM_STAT1_REG 0x0140 | ||
| 49 | #define AB4500_FSM_STAT2_REG 0x0141 | ||
| 50 | #define AB4500_SYSCLK_REQ_STAT_REG 0x0142 | ||
| 51 | #define AB4500_USB_STAT1_REG 0x0143 | ||
| 52 | #define AB4500_USB_STAT2_REG 0x0144 | ||
| 53 | #define AB4500_STATUS_SPARE1_REG 0x0145 | ||
| 54 | #define AB4500_STATUS_SPARE2_REG 0x0146 | ||
| 55 | |||
| 56 | #define AB4500_CTRL1_REG 0x0180 | ||
| 57 | #define AB4500_CTRL2_REG 0x0181 | ||
| 58 | |||
| 59 | /* | ||
| 60 | * System control 2 register offsets. | ||
| 61 | * bank = 0x02 | ||
| 62 | */ | ||
| 63 | #define AB4500_CTRL3_REG 0x0200 | ||
| 64 | #define AB4500_MAIN_WDOG_CTRL_REG 0x0201 | ||
| 65 | #define AB4500_MAIN_WDOG_TIMER_REG 0x0202 | ||
| 66 | #define AB4500_LOW_BAT_REG 0x0203 | ||
| 67 | #define AB4500_BATT_OK_REG 0x0204 | ||
| 68 | #define AB4500_SYSCLK_TIMER_REG 0x0205 | ||
| 69 | #define AB4500_SMPSCLK_CTRL_REG 0x0206 | ||
| 70 | #define AB4500_SMPSCLK_SEL1_REG 0x0207 | ||
| 71 | #define AB4500_SMPSCLK_SEL2_REG 0x0208 | ||
| 72 | #define AB4500_SMPSCLK_SEL3_REG 0x0209 | ||
| 73 | #define AB4500_SYSULPCLK_CONF_REG 0x020A | ||
| 74 | #define AB4500_SYSULPCLK_CTRL1_REG 0x020B | ||
| 75 | #define AB4500_SYSCLK_CTRL_REG 0x020C | ||
| 76 | #define AB4500_SYSCLK_REQ1_VALID_REG 0x020D | ||
| 77 | #define AB4500_SYSCLK_REQ_VALID_REG 0x020E | ||
| 78 | #define AB4500_SYSCTRL_SPARE_REG 0x020F | ||
| 79 | #define AB4500_PAD_CONF_REG 0x0210 | ||
| 80 | |||
| 81 | /* | ||
| 82 | * Regu control1 register offsets | ||
| 83 | * Bank = 0x03 | ||
| 84 | */ | ||
| 85 | #define AB4500_REGU_SERIAL_CTRL1_REG 0x0300 | ||
| 86 | #define AB4500_REGU_SERIAL_CTRL2_REG 0x0301 | ||
| 87 | #define AB4500_REGU_SERIAL_CTRL3_REG 0x0302 | ||
| 88 | #define AB4500_REGU_REQ_CTRL1_REG 0x0303 | ||
| 89 | #define AB4500_REGU_REQ_CTRL2_REG 0x0304 | ||
| 90 | #define AB4500_REGU_REQ_CTRL3_REG 0x0305 | ||
| 91 | #define AB4500_REGU_REQ_CTRL4_REG 0x0306 | ||
| 92 | #define AB4500_REGU_MISC1_REG 0x0380 | ||
| 93 | #define AB4500_REGU_OTGSUPPLY_CTRL_REG 0x0381 | ||
| 94 | #define AB4500_REGU_VUSB_CTRL_REG 0x0382 | ||
| 95 | #define AB4500_REGU_VAUDIO_SUPPLY_REG 0x0383 | ||
| 96 | #define AB4500_REGU_CTRL1_SPARE_REG 0x0384 | ||
| 97 | |||
| 98 | /* | ||
| 99 | * Regu control2 Vmod register offsets | ||
| 100 | */ | ||
| 101 | #define AB4500_REGU_VMOD_REGU_REG 0x0440 | ||
| 102 | #define AB4500_REGU_VMOD_SEL1_REG 0x0441 | ||
| 103 | #define AB4500_REGU_VMOD_SEL2_REG 0x0442 | ||
| 104 | #define AB4500_REGU_CTRL_DISCH_REG 0x0443 | ||
| 105 | #define AB4500_REGU_CTRL_DISCH2_REG 0x0444 | ||
| 106 | |||
| 107 | /* | ||
| 108 | * USB/ULPI register offsets | ||
| 109 | * Bank : 0x5 | ||
| 110 | */ | ||
| 111 | #define AB4500_USB_LINE_STAT_REG 0x0580 | ||
| 112 | #define AB4500_USB_LINE_CTRL1_REG 0x0581 | ||
| 113 | #define AB4500_USB_LINE_CTRL2_REG 0x0582 | ||
| 114 | #define AB4500_USB_LINE_CTRL3_REG 0x0583 | ||
| 115 | #define AB4500_USB_LINE_CTRL4_REG 0x0584 | ||
| 116 | #define AB4500_USB_LINE_CTRL5_REG 0x0585 | ||
| 117 | #define AB4500_USB_OTG_CTRL_REG 0x0587 | ||
| 118 | #define AB4500_USB_OTG_STAT_REG 0x0588 | ||
| 119 | #define AB4500_USB_OTG_STAT_REG 0x0588 | ||
| 120 | #define AB4500_USB_CTRL_SPARE_REG 0x0589 | ||
| 121 | #define AB4500_USB_PHY_CTRL_REG 0x058A | ||
| 122 | |||
| 123 | /* | ||
| 124 | * TVOUT / CTRL register offsets | ||
| 125 | * Bank : 0x06 | ||
| 126 | */ | ||
| 127 | #define AB4500_TVOUT_CTRL_REG 0x0680 | ||
| 128 | |||
| 129 | /* | ||
| 130 | * DBI register offsets | ||
| 131 | * Bank : 0x07 | ||
| 132 | */ | ||
| 133 | #define AB4500_DBI_REG1_REG 0x0700 | ||
| 134 | #define AB4500_DBI_REG2_REG 0x0701 | ||
| 135 | |||
| 136 | /* | ||
| 137 | * ECI regsiter offsets | ||
| 138 | * Bank : 0x08 | ||
| 139 | */ | ||
| 140 | #define AB4500_ECI_CTRL_REG 0x0800 | ||
| 141 | #define AB4500_ECI_HOOKLEVEL_REG 0x0801 | ||
| 142 | #define AB4500_ECI_DATAOUT_REG 0x0802 | ||
| 143 | #define AB4500_ECI_DATAIN_REG 0x0803 | ||
| 144 | |||
| 145 | /* | ||
| 146 | * AV Connector register offsets | ||
| 147 | * Bank : 0x08 | ||
| 148 | */ | ||
| 149 | #define AB4500_AV_CONN_REG 0x0840 | ||
| 150 | |||
| 151 | /* | ||
| 152 | * Accessory detection register offsets | ||
| 153 | * Bank : 0x08 | ||
| 154 | */ | ||
| 155 | #define AB4500_ACC_DET_DB1_REG 0x0880 | ||
| 156 | #define AB4500_ACC_DET_DB2_REG 0x0881 | ||
| 157 | |||
| 158 | /* | ||
| 159 | * GPADC register offsets | ||
| 160 | * Bank : 0x0A | ||
| 161 | */ | ||
| 162 | #define AB4500_GPADC_CTRL1_REG 0x0A00 | ||
| 163 | #define AB4500_GPADC_CTRL2_REG 0x0A01 | ||
| 164 | #define AB4500_GPADC_CTRL3_REG 0x0A02 | ||
| 165 | #define AB4500_GPADC_AUTO_TIMER_REG 0x0A03 | ||
| 166 | #define AB4500_GPADC_STAT_REG 0x0A04 | ||
| 167 | #define AB4500_GPADC_MANDATAL_REG 0x0A05 | ||
| 168 | #define AB4500_GPADC_MANDATAH_REG 0x0A06 | ||
| 169 | #define AB4500_GPADC_AUTODATAL_REG 0x0A07 | ||
| 170 | #define AB4500_GPADC_AUTODATAH_REG 0x0A08 | ||
| 171 | #define AB4500_GPADC_MUX_CTRL_REG 0x0A09 | ||
| 172 | |||
| 173 | /* | ||
| 174 | * Charger / status register offfsets | ||
| 175 | * Bank : 0x0B | ||
| 176 | */ | ||
| 177 | #define AB4500_CH_STATUS1_REG 0x0B00 | ||
| 178 | #define AB4500_CH_STATUS2_REG 0x0B01 | ||
| 179 | #define AB4500_CH_USBCH_STAT1_REG 0x0B02 | ||
| 180 | #define AB4500_CH_USBCH_STAT2_REG 0x0B03 | ||
| 181 | #define AB4500_CH_FSM_STAT_REG 0x0B04 | ||
| 182 | #define AB4500_CH_STAT_REG 0x0B05 | ||
| 183 | |||
| 184 | /* | ||
| 185 | * Charger / control register offfsets | ||
| 186 | * Bank : 0x0B | ||
| 187 | */ | ||
| 188 | #define AB4500_CH_VOLT_LVL_REG 0x0B40 | ||
| 189 | |||
| 190 | /* | ||
| 191 | * Charger / main control register offfsets | ||
| 192 | * Bank : 0x0B | ||
| 193 | */ | ||
| 194 | #define AB4500_MCH_CTRL1 0x0B80 | ||
| 195 | #define AB4500_MCH_CTRL2 0x0B81 | ||
| 196 | #define AB4500_MCH_IPT_CURLVL_REG 0x0B82 | ||
| 197 | #define AB4500_CH_WD_REG 0x0B83 | ||
| 198 | |||
| 199 | /* | ||
| 200 | * Charger / USB control register offsets | ||
| 201 | * Bank : 0x0B | ||
| 202 | */ | ||
| 203 | #define AB4500_USBCH_CTRL1_REG 0x0BC0 | ||
| 204 | #define AB4500_USBCH_CTRL2_REG 0x0BC1 | ||
| 205 | #define AB4500_USBCH_IPT_CRNTLVL_REG 0x0BC2 | ||
| 206 | |||
| 207 | /* | ||
| 208 | * RTC bank register offsets | ||
| 209 | * Bank : 0xF | ||
| 210 | */ | ||
| 211 | #define AB4500_RTC_SOFF_STAT_REG 0x0F00 | ||
| 212 | #define AB4500_RTC_CC_CONF_REG 0x0F01 | ||
| 213 | #define AB4500_RTC_READ_REQ_REG 0x0F02 | ||
| 214 | #define AB4500_RTC_WATCH_TSECMID_REG 0x0F03 | ||
| 215 | #define AB4500_RTC_WATCH_TSECHI_REG 0x0F04 | ||
| 216 | #define AB4500_RTC_WATCH_TMIN_LOW_REG 0x0F05 | ||
| 217 | #define AB4500_RTC_WATCH_TMIN_MID_REG 0x0F06 | ||
| 218 | #define AB4500_RTC_WATCH_TMIN_HI_REG 0x0F07 | ||
| 219 | #define AB4500_RTC_ALRM_MIN_LOW_REG 0x0F08 | ||
| 220 | #define AB4500_RTC_ALRM_MIN_MID_REG 0x0F09 | ||
| 221 | #define AB4500_RTC_ALRM_MIN_HI_REG 0x0F0A | ||
| 222 | #define AB4500_RTC_STAT_REG 0x0F0B | ||
| 223 | #define AB4500_RTC_BKUP_CHG_REG 0x0F0C | ||
| 224 | #define AB4500_RTC_FORCE_BKUP_REG 0x0F0D | ||
| 225 | #define AB4500_RTC_CALIB_REG 0x0F0E | ||
| 226 | #define AB4500_RTC_SWITCH_STAT_REG 0x0F0F | ||
| 227 | |||
| 228 | /* | ||
| 229 | * PWM Out generators | ||
| 230 | * Bank: 0x10 | ||
| 231 | */ | ||
| 232 | #define AB4500_PWM_OUT_CTRL1_REG 0x1060 | ||
| 233 | #define AB4500_PWM_OUT_CTRL2_REG 0x1061 | ||
| 234 | #define AB4500_PWM_OUT_CTRL3_REG 0x1062 | ||
| 235 | #define AB4500_PWM_OUT_CTRL4_REG 0x1063 | ||
| 236 | #define AB4500_PWM_OUT_CTRL5_REG 0x1064 | ||
| 237 | #define AB4500_PWM_OUT_CTRL6_REG 0x1065 | ||
| 238 | #define AB4500_PWM_OUT_CTRL7_REG 0x1066 | ||
| 239 | |||
| 240 | #define AB4500_I2C_PAD_CTRL_REG 0x1067 | ||
| 241 | #define AB4500_REV_REG 0x1080 | ||
| 242 | |||
| 243 | /** | ||
| 244 | * struct ab4500 | ||
| 245 | * @spi: spi device structure | ||
| 246 | * @tx_buf: transmit buffer | ||
| 247 | * @rx_buf: receive buffer | ||
| 248 | * @lock: sync primitive | ||
| 249 | */ | ||
| 250 | struct ab4500 { | ||
| 251 | struct spi_device *spi; | ||
| 252 | unsigned long tx_buf[4]; | ||
| 253 | unsigned long rx_buf[4]; | ||
| 254 | struct mutex lock; | ||
| 255 | }; | ||
| 256 | |||
| 257 | int ab4500_write(struct ab4500 *ab4500, unsigned char block, | ||
| 258 | unsigned long addr, unsigned char data); | ||
| 259 | int ab4500_read(struct ab4500 *ab4500, unsigned char block, | ||
| 260 | unsigned long addr); | ||
| 261 | |||
| 262 | #endif /* MFD_AB4500_H */ | ||
diff --git a/include/linux/mfd/adp5520.h b/include/linux/mfd/adp5520.h new file mode 100644 index 000000000000..ac37558a4673 --- /dev/null +++ b/include/linux/mfd/adp5520.h | |||
| @@ -0,0 +1,299 @@ | |||
| 1 | /* | ||
| 2 | * Definitions and platform data for Analog Devices | ||
| 3 | * ADP5520/ADP5501 MFD PMICs (Backlight, LED, GPIO and Keys) | ||
| 4 | * | ||
| 5 | * Copyright 2009 Analog Devices Inc. | ||
| 6 | * | ||
| 7 | * Licensed under the GPL-2 or later. | ||
| 8 | */ | ||
| 9 | |||
| 10 | |||
| 11 | #ifndef __LINUX_MFD_ADP5520_H | ||
| 12 | #define __LINUX_MFD_ADP5520_H | ||
| 13 | |||
| 14 | #define ID_ADP5520 5520 | ||
| 15 | #define ID_ADP5501 5501 | ||
| 16 | |||
| 17 | /* | ||
| 18 | * ADP5520/ADP5501 Register Map | ||
| 19 | */ | ||
| 20 | |||
| 21 | #define ADP5520_MODE_STATUS 0x00 | ||
| 22 | #define ADP5520_INTERRUPT_ENABLE 0x01 | ||
| 23 | #define ADP5520_BL_CONTROL 0x02 | ||
| 24 | #define ADP5520_BL_TIME 0x03 | ||
| 25 | #define ADP5520_BL_FADE 0x04 | ||
| 26 | #define ADP5520_DAYLIGHT_MAX 0x05 | ||
| 27 | #define ADP5520_DAYLIGHT_DIM 0x06 | ||
| 28 | #define ADP5520_OFFICE_MAX 0x07 | ||
| 29 | #define ADP5520_OFFICE_DIM 0x08 | ||
| 30 | #define ADP5520_DARK_MAX 0x09 | ||
| 31 | #define ADP5520_DARK_DIM 0x0A | ||
| 32 | #define ADP5520_BL_VALUE 0x0B | ||
| 33 | #define ADP5520_ALS_CMPR_CFG 0x0C | ||
| 34 | #define ADP5520_L2_TRIP 0x0D | ||
| 35 | #define ADP5520_L2_HYS 0x0E | ||
| 36 | #define ADP5520_L3_TRIP 0x0F | ||
| 37 | #define ADP5520_L3_HYS 0x10 | ||
| 38 | #define ADP5520_LED_CONTROL 0x11 | ||
| 39 | #define ADP5520_LED_TIME 0x12 | ||
| 40 | #define ADP5520_LED_FADE 0x13 | ||
| 41 | #define ADP5520_LED1_CURRENT 0x14 | ||
| 42 | #define ADP5520_LED2_CURRENT 0x15 | ||
| 43 | #define ADP5520_LED3_CURRENT 0x16 | ||
| 44 | |||
| 45 | /* | ||
| 46 | * ADP5520 Register Map | ||
| 47 | */ | ||
| 48 | |||
| 49 | #define ADP5520_GPIO_CFG_1 0x17 | ||
| 50 | #define ADP5520_GPIO_CFG_2 0x18 | ||
| 51 | #define ADP5520_GPIO_IN 0x19 | ||
| 52 | #define ADP5520_GPIO_OUT 0x1A | ||
| 53 | #define ADP5520_GPIO_INT_EN 0x1B | ||
| 54 | #define ADP5520_GPIO_INT_STAT 0x1C | ||
| 55 | #define ADP5520_GPIO_INT_LVL 0x1D | ||
| 56 | #define ADP5520_GPIO_DEBOUNCE 0x1E | ||
| 57 | #define ADP5520_GPIO_PULLUP 0x1F | ||
| 58 | #define ADP5520_KP_INT_STAT_1 0x20 | ||
| 59 | #define ADP5520_KP_INT_STAT_2 0x21 | ||
| 60 | #define ADP5520_KR_INT_STAT_1 0x22 | ||
| 61 | #define ADP5520_KR_INT_STAT_2 0x23 | ||
| 62 | #define ADP5520_KEY_STAT_1 0x24 | ||
| 63 | #define ADP5520_KEY_STAT_2 0x25 | ||
| 64 | |||
| 65 | /* | ||
| 66 | * MODE_STATUS bits | ||
| 67 | */ | ||
| 68 | |||
| 69 | #define ADP5520_nSTNBY (1 << 7) | ||
| 70 | #define ADP5520_BL_EN (1 << 6) | ||
| 71 | #define ADP5520_DIM_EN (1 << 5) | ||
| 72 | #define ADP5520_OVP_INT (1 << 4) | ||
| 73 | #define ADP5520_CMPR_INT (1 << 3) | ||
| 74 | #define ADP5520_GPI_INT (1 << 2) | ||
| 75 | #define ADP5520_KR_INT (1 << 1) | ||
| 76 | #define ADP5520_KP_INT (1 << 0) | ||
| 77 | |||
| 78 | /* | ||
| 79 | * INTERRUPT_ENABLE bits | ||
| 80 | */ | ||
| 81 | |||
| 82 | #define ADP5520_AUTO_LD_EN (1 << 4) | ||
| 83 | #define ADP5520_CMPR_IEN (1 << 3) | ||
| 84 | #define ADP5520_OVP_IEN (1 << 2) | ||
| 85 | #define ADP5520_KR_IEN (1 << 1) | ||
| 86 | #define ADP5520_KP_IEN (1 << 0) | ||
| 87 | |||
| 88 | /* | ||
| 89 | * BL_CONTROL bits | ||
| 90 | */ | ||
| 91 | |||
| 92 | #define ADP5520_BL_LVL ((x) << 5) | ||
| 93 | #define ADP5520_BL_LAW ((x) << 4) | ||
| 94 | #define ADP5520_BL_AUTO_ADJ (1 << 3) | ||
| 95 | #define ADP5520_OVP_EN (1 << 2) | ||
| 96 | #define ADP5520_FOVR (1 << 1) | ||
| 97 | #define ADP5520_KP_BL_EN (1 << 0) | ||
| 98 | |||
| 99 | /* | ||
| 100 | * ALS_CMPR_CFG bits | ||
| 101 | */ | ||
| 102 | |||
| 103 | #define ADP5520_L3_OUT (1 << 3) | ||
| 104 | #define ADP5520_L2_OUT (1 << 2) | ||
| 105 | #define ADP5520_L3_EN (1 << 1) | ||
| 106 | |||
| 107 | #define ADP5020_MAX_BRIGHTNESS 0x7F | ||
| 108 | |||
| 109 | #define FADE_VAL(in, out) ((0xF & (in)) | ((0xF & (out)) << 4)) | ||
| 110 | #define BL_CTRL_VAL(law, auto) (((1 & (auto)) << 3) | ((0x3 & (law)) << 4)) | ||
| 111 | #define ALS_CMPR_CFG_VAL(filt, l3_en) (((0x7 & filt) << 5) | l3_en) | ||
| 112 | |||
| 113 | /* | ||
| 114 | * LEDs subdevice bits and masks | ||
| 115 | */ | ||
| 116 | |||
| 117 | #define ADP5520_01_MAXLEDS 3 | ||
| 118 | |||
| 119 | #define ADP5520_FLAG_LED_MASK 0x3 | ||
| 120 | #define ADP5520_FLAG_OFFT_SHIFT 8 | ||
| 121 | #define ADP5520_FLAG_OFFT_MASK 0x3 | ||
| 122 | |||
| 123 | #define ADP5520_R3_MODE (1 << 5) | ||
| 124 | #define ADP5520_C3_MODE (1 << 4) | ||
| 125 | #define ADP5520_LED_LAW (1 << 3) | ||
| 126 | #define ADP5520_LED3_EN (1 << 2) | ||
| 127 | #define ADP5520_LED2_EN (1 << 1) | ||
| 128 | #define ADP5520_LED1_EN (1 << 0) | ||
| 129 | |||
| 130 | /* | ||
| 131 | * GPIO subdevice bits and masks | ||
| 132 | */ | ||
| 133 | |||
| 134 | #define ADP5520_MAXGPIOS 8 | ||
| 135 | |||
| 136 | #define ADP5520_GPIO_C3 (1 << 7) /* LED2 or GPIO7 aka C3 */ | ||
| 137 | #define ADP5520_GPIO_C2 (1 << 6) | ||
| 138 | #define ADP5520_GPIO_C1 (1 << 5) | ||
| 139 | #define ADP5520_GPIO_C0 (1 << 4) | ||
| 140 | #define ADP5520_GPIO_R3 (1 << 3) /* LED3 or GPIO3 aka R3 */ | ||
| 141 | #define ADP5520_GPIO_R2 (1 << 2) | ||
| 142 | #define ADP5520_GPIO_R1 (1 << 1) | ||
| 143 | #define ADP5520_GPIO_R0 (1 << 0) | ||
| 144 | |||
| 145 | struct adp5520_gpio_platform_data { | ||
| 146 | unsigned gpio_start; | ||
| 147 | u8 gpio_en_mask; | ||
| 148 | u8 gpio_pullup_mask; | ||
| 149 | }; | ||
| 150 | |||
| 151 | /* | ||
| 152 | * Keypad subdevice bits and masks | ||
| 153 | */ | ||
| 154 | |||
| 155 | #define ADP5520_MAXKEYS 16 | ||
| 156 | |||
| 157 | #define ADP5520_COL_C3 (1 << 7) /* LED2 or GPIO7 aka C3 */ | ||
| 158 | #define ADP5520_COL_C2 (1 << 6) | ||
| 159 | #define ADP5520_COL_C1 (1 << 5) | ||
| 160 | #define ADP5520_COL_C0 (1 << 4) | ||
| 161 | #define ADP5520_ROW_R3 (1 << 3) /* LED3 or GPIO3 aka R3 */ | ||
| 162 | #define ADP5520_ROW_R2 (1 << 2) | ||
| 163 | #define ADP5520_ROW_R1 (1 << 1) | ||
| 164 | #define ADP5520_ROW_R0 (1 << 0) | ||
| 165 | |||
| 166 | #define ADP5520_KEY(row, col) (col + row * 4) | ||
| 167 | #define ADP5520_KEYMAPSIZE ADP5520_MAXKEYS | ||
| 168 | |||
| 169 | struct adp5520_keys_platform_data { | ||
| 170 | int rows_en_mask; /* Number of rows */ | ||
| 171 | int cols_en_mask; /* Number of columns */ | ||
| 172 | const unsigned short *keymap; /* Pointer to keymap */ | ||
| 173 | unsigned short keymapsize; /* Keymap size */ | ||
| 174 | unsigned repeat:1; /* Enable key repeat */ | ||
| 175 | }; | ||
| 176 | |||
| 177 | |||
| 178 | /* | ||
| 179 | * LEDs subdevice platform data | ||
| 180 | */ | ||
| 181 | |||
| 182 | #define FLAG_ID_ADP5520_LED1_ADP5501_LED0 1 /* ADP5520 PIN ILED */ | ||
| 183 | #define FLAG_ID_ADP5520_LED2_ADP5501_LED1 2 /* ADP5520 PIN C3 */ | ||
| 184 | #define FLAG_ID_ADP5520_LED3_ADP5501_LED2 3 /* ADP5520 PIN R3 */ | ||
| 185 | |||
| 186 | #define ADP5520_LED_DIS_BLINK (0 << ADP5520_FLAG_OFFT_SHIFT) | ||
| 187 | #define ADP5520_LED_OFFT_600ms (1 << ADP5520_FLAG_OFFT_SHIFT) | ||
| 188 | #define ADP5520_LED_OFFT_800ms (2 << ADP5520_FLAG_OFFT_SHIFT) | ||
| 189 | #define ADP5520_LED_OFFT_1200ms (3 << ADP5520_FLAG_OFFT_SHIFT) | ||
| 190 | |||
| 191 | #define ADP5520_LED_ONT_200ms 0 | ||
| 192 | #define ADP5520_LED_ONT_600ms 1 | ||
| 193 | #define ADP5520_LED_ONT_800ms 2 | ||
| 194 | #define ADP5520_LED_ONT_1200ms 3 | ||
| 195 | |||
| 196 | struct adp5520_leds_platform_data { | ||
| 197 | int num_leds; | ||
| 198 | struct led_info *leds; | ||
| 199 | u8 fade_in; /* Backlight Fade-In Timer */ | ||
| 200 | u8 fade_out; /* Backlight Fade-Out Timer */ | ||
| 201 | u8 led_on_time; | ||
| 202 | }; | ||
| 203 | |||
| 204 | /* | ||
| 205 | * Backlight subdevice platform data | ||
| 206 | */ | ||
| 207 | |||
| 208 | #define ADP5520_FADE_T_DIS 0 /* Fade Timer Disabled */ | ||
| 209 | #define ADP5520_FADE_T_300ms 1 /* 0.3 Sec */ | ||
| 210 | #define ADP5520_FADE_T_600ms 2 | ||
| 211 | #define ADP5520_FADE_T_900ms 3 | ||
| 212 | #define ADP5520_FADE_T_1200ms 4 | ||
| 213 | #define ADP5520_FADE_T_1500ms 5 | ||
| 214 | #define ADP5520_FADE_T_1800ms 6 | ||
| 215 | #define ADP5520_FADE_T_2100ms 7 | ||
| 216 | #define ADP5520_FADE_T_2400ms 8 | ||
| 217 | #define ADP5520_FADE_T_2700ms 9 | ||
| 218 | #define ADP5520_FADE_T_3000ms 10 | ||
| 219 | #define ADP5520_FADE_T_3500ms 11 | ||
| 220 | #define ADP5520_FADE_T_4000ms 12 | ||
| 221 | #define ADP5520_FADE_T_4500ms 13 | ||
| 222 | #define ADP5520_FADE_T_5000ms 14 | ||
| 223 | #define ADP5520_FADE_T_5500ms 15 /* 5.5 Sec */ | ||
| 224 | |||
| 225 | #define ADP5520_BL_LAW_LINEAR 0 | ||
| 226 | #define ADP5520_BL_LAW_SQUARE 1 | ||
| 227 | #define ADP5520_BL_LAW_CUBIC1 2 | ||
| 228 | #define ADP5520_BL_LAW_CUBIC2 3 | ||
| 229 | |||
| 230 | #define ADP5520_BL_AMBL_FILT_80ms 0 /* Light sensor filter time */ | ||
| 231 | #define ADP5520_BL_AMBL_FILT_160ms 1 | ||
| 232 | #define ADP5520_BL_AMBL_FILT_320ms 2 | ||
| 233 | #define ADP5520_BL_AMBL_FILT_640ms 3 | ||
| 234 | #define ADP5520_BL_AMBL_FILT_1280ms 4 | ||
| 235 | #define ADP5520_BL_AMBL_FILT_2560ms 5 | ||
| 236 | #define ADP5520_BL_AMBL_FILT_5120ms 6 | ||
| 237 | #define ADP5520_BL_AMBL_FILT_10240ms 7 /* 10.24 sec */ | ||
| 238 | |||
| 239 | /* | ||
| 240 | * Blacklight current 0..30mA | ||
| 241 | */ | ||
| 242 | #define ADP5520_BL_CUR_mA(I) ((I * 127) / 30) | ||
| 243 | |||
| 244 | /* | ||
| 245 | * L2 comparator current 0..1000uA | ||
| 246 | */ | ||
| 247 | #define ADP5520_L2_COMP_CURR_uA(I) ((I * 255) / 1000) | ||
| 248 | |||
| 249 | /* | ||
| 250 | * L3 comparator current 0..127uA | ||
| 251 | */ | ||
| 252 | #define ADP5520_L3_COMP_CURR_uA(I) ((I * 255) / 127) | ||
| 253 | |||
| 254 | struct adp5520_backlight_platform_data { | ||
| 255 | u8 fade_in; /* Backlight Fade-In Timer */ | ||
| 256 | u8 fade_out; /* Backlight Fade-Out Timer */ | ||
| 257 | u8 fade_led_law; /* fade-on/fade-off transfer characteristic */ | ||
| 258 | |||
| 259 | u8 en_ambl_sens; /* 1 = enable ambient light sensor */ | ||
| 260 | u8 abml_filt; /* Light sensor filter time */ | ||
| 261 | u8 l1_daylight_max; /* use BL_CUR_mA(I) 0 <= I <= 30 mA */ | ||
| 262 | u8 l1_daylight_dim; /* typ = 0, use BL_CUR_mA(I) 0 <= I <= 30 mA */ | ||
| 263 | u8 l2_office_max; /* use BL_CUR_mA(I) 0 <= I <= 30 mA */ | ||
| 264 | u8 l2_office_dim; /* typ = 0, use BL_CUR_mA(I) 0 <= I <= 30 mA */ | ||
| 265 | u8 l3_dark_max; /* use BL_CUR_mA(I) 0 <= I <= 30 mA */ | ||
| 266 | u8 l3_dark_dim; /* typ = 0, use BL_CUR_mA(I) 0 <= I <= 30 mA */ | ||
| 267 | u8 l2_trip; /* use L2_COMP_CURR_uA(I) 0 <= I <= 1000 uA */ | ||
| 268 | u8 l2_hyst; /* use L2_COMP_CURR_uA(I) 0 <= I <= 1000 uA */ | ||
| 269 | u8 l3_trip; /* use L3_COMP_CURR_uA(I) 0 <= I <= 127 uA */ | ||
| 270 | u8 l3_hyst; /* use L3_COMP_CURR_uA(I) 0 <= I <= 127 uA */ | ||
| 271 | }; | ||
| 272 | |||
| 273 | /* | ||
| 274 | * MFD chip platform data | ||
| 275 | */ | ||
| 276 | |||
| 277 | struct adp5520_platform_data { | ||
| 278 | struct adp5520_keys_platform_data *keys; | ||
| 279 | struct adp5520_gpio_platform_data *gpio; | ||
| 280 | struct adp5520_leds_platform_data *leds; | ||
| 281 | struct adp5520_backlight_platform_data *backlight; | ||
| 282 | }; | ||
| 283 | |||
| 284 | /* | ||
| 285 | * MFD chip functions | ||
| 286 | */ | ||
| 287 | |||
| 288 | extern int adp5520_read(struct device *dev, int reg, uint8_t *val); | ||
| 289 | extern int adp5520_write(struct device *dev, int reg, u8 val); | ||
| 290 | extern int adp5520_clr_bits(struct device *dev, int reg, uint8_t bit_mask); | ||
| 291 | extern int adp5520_set_bits(struct device *dev, int reg, uint8_t bit_mask); | ||
| 292 | |||
| 293 | extern int adp5520_register_notifier(struct device *dev, | ||
| 294 | struct notifier_block *nb, unsigned int events); | ||
| 295 | |||
| 296 | extern int adp5520_unregister_notifier(struct device *dev, | ||
| 297 | struct notifier_block *nb, unsigned int events); | ||
| 298 | |||
| 299 | #endif /* __LINUX_MFD_ADP5520_H */ | ||
diff --git a/include/linux/mfd/da903x.h b/include/linux/mfd/da903x.h index c63b65c94429..0aa3a1a49ee3 100644 --- a/include/linux/mfd/da903x.h +++ b/include/linux/mfd/da903x.h | |||
| @@ -96,6 +96,10 @@ struct da9034_touch_pdata { | |||
| 96 | int y_inverted; | 96 | int y_inverted; |
| 97 | }; | 97 | }; |
| 98 | 98 | ||
| 99 | struct da9034_backlight_pdata { | ||
| 100 | int output_current; /* output current of WLED, from 0-31 (in mA) */ | ||
| 101 | }; | ||
| 102 | |||
| 99 | /* DA9030 battery charger data */ | 103 | /* DA9030 battery charger data */ |
| 100 | struct power_supply_info; | 104 | struct power_supply_info; |
| 101 | 105 | ||
diff --git a/include/linux/mfd/ezx-pcap.h b/include/linux/mfd/ezx-pcap.h index e5124ceea769..40c372165f3e 100644 --- a/include/linux/mfd/ezx-pcap.h +++ b/include/linux/mfd/ezx-pcap.h | |||
| @@ -45,7 +45,7 @@ void pcap_set_ts_bits(struct pcap_chip *, u32); | |||
| 45 | #define PCAP_CLEAR_INTERRUPT_REGISTER 0x01ffffff | 45 | #define PCAP_CLEAR_INTERRUPT_REGISTER 0x01ffffff |
| 46 | #define PCAP_MASK_ALL_INTERRUPT 0x01ffffff | 46 | #define PCAP_MASK_ALL_INTERRUPT 0x01ffffff |
| 47 | 47 | ||
| 48 | /* registers acessible by both pcap ports */ | 48 | /* registers accessible by both pcap ports */ |
| 49 | #define PCAP_REG_ISR 0x0 /* Interrupt Status */ | 49 | #define PCAP_REG_ISR 0x0 /* Interrupt Status */ |
| 50 | #define PCAP_REG_MSR 0x1 /* Interrupt Mask */ | 50 | #define PCAP_REG_MSR 0x1 /* Interrupt Mask */ |
| 51 | #define PCAP_REG_PSTAT 0x2 /* Processor Status */ | 51 | #define PCAP_REG_PSTAT 0x2 /* Processor Status */ |
| @@ -67,7 +67,7 @@ void pcap_set_ts_bits(struct pcap_chip *, u32); | |||
| 67 | #define PCAP_REG_VENDOR_TEST1 0x1e | 67 | #define PCAP_REG_VENDOR_TEST1 0x1e |
| 68 | #define PCAP_REG_VENDOR_TEST2 0x1f | 68 | #define PCAP_REG_VENDOR_TEST2 0x1f |
| 69 | 69 | ||
| 70 | /* registers acessible by pcap port 1 only (a1200, e2 & e6) */ | 70 | /* registers accessible by pcap port 1 only (a1200, e2 & e6) */ |
| 71 | #define PCAP_REG_INT_SEL 0x3 /* Interrupt Select */ | 71 | #define PCAP_REG_INT_SEL 0x3 /* Interrupt Select */ |
| 72 | #define PCAP_REG_SWCTRL 0x4 /* Switching Regulator Control */ | 72 | #define PCAP_REG_SWCTRL 0x4 /* Switching Regulator Control */ |
| 73 | #define PCAP_REG_VREG1 0x5 /* Regulator Bank 1 Control */ | 73 | #define PCAP_REG_VREG1 0x5 /* Regulator Bank 1 Control */ |
| @@ -231,9 +231,6 @@ void pcap_set_ts_bits(struct pcap_chip *, u32); | |||
| 231 | #define PCAP_LED_4MA 1 | 231 | #define PCAP_LED_4MA 1 |
| 232 | #define PCAP_LED_5MA 2 | 232 | #define PCAP_LED_5MA 2 |
| 233 | #define PCAP_LED_9MA 3 | 233 | #define PCAP_LED_9MA 3 |
| 234 | #define PCAP_LED_GPIO_VAL_MASK 0x00ffffff | ||
| 235 | #define PCAP_LED_GPIO_EN 0x01000000 | ||
| 236 | #define PCAP_LED_GPIO_INVERT 0x02000000 | ||
| 237 | #define PCAP_LED_T_MASK 0xf | 234 | #define PCAP_LED_T_MASK 0xf |
| 238 | #define PCAP_LED_C_MASK 0x3 | 235 | #define PCAP_LED_C_MASK 0x3 |
| 239 | #define PCAP_BL_MASK 0x1f | 236 | #define PCAP_BL_MASK 0x1f |
diff --git a/include/linux/mfd/max8925.h b/include/linux/mfd/max8925.h new file mode 100644 index 000000000000..5259dfe8c585 --- /dev/null +++ b/include/linux/mfd/max8925.h | |||
| @@ -0,0 +1,253 @@ | |||
| 1 | /* | ||
| 2 | * Maxim8925 Interface | ||
| 3 | * | ||
| 4 | * Copyright (C) 2009 Marvell International Ltd. | ||
| 5 | * Haojian Zhuang <haojian.zhuang@marvell.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 __LINUX_MFD_MAX8925_H | ||
| 13 | #define __LINUX_MFD_MAX8925_H | ||
| 14 | |||
| 15 | #include <linux/mutex.h> | ||
| 16 | #include <linux/interrupt.h> | ||
| 17 | |||
| 18 | /* Unified sub device IDs for MAX8925 */ | ||
| 19 | enum { | ||
| 20 | MAX8925_ID_SD1, | ||
| 21 | MAX8925_ID_SD2, | ||
| 22 | MAX8925_ID_SD3, | ||
| 23 | MAX8925_ID_LDO1, | ||
| 24 | MAX8925_ID_LDO2, | ||
| 25 | MAX8925_ID_LDO3, | ||
| 26 | MAX8925_ID_LDO4, | ||
| 27 | MAX8925_ID_LDO5, | ||
| 28 | MAX8925_ID_LDO6, | ||
| 29 | MAX8925_ID_LDO7, | ||
| 30 | MAX8925_ID_LDO8, | ||
| 31 | MAX8925_ID_LDO9, | ||
| 32 | MAX8925_ID_LDO10, | ||
| 33 | MAX8925_ID_LDO11, | ||
| 34 | MAX8925_ID_LDO12, | ||
| 35 | MAX8925_ID_LDO13, | ||
| 36 | MAX8925_ID_LDO14, | ||
| 37 | MAX8925_ID_LDO15, | ||
| 38 | MAX8925_ID_LDO16, | ||
| 39 | MAX8925_ID_LDO17, | ||
| 40 | MAX8925_ID_LDO18, | ||
| 41 | MAX8925_ID_LDO19, | ||
| 42 | MAX8925_ID_LDO20, | ||
| 43 | MAX8925_ID_MAX, | ||
| 44 | }; | ||
| 45 | |||
| 46 | enum { | ||
| 47 | /* | ||
| 48 | * Charging current threshold trigger going from fast charge | ||
| 49 | * to TOPOFF charge. From 5% to 20% of fasting charging current. | ||
| 50 | */ | ||
| 51 | MAX8925_TOPOFF_THR_5PER, | ||
| 52 | MAX8925_TOPOFF_THR_10PER, | ||
| 53 | MAX8925_TOPOFF_THR_15PER, | ||
| 54 | MAX8925_TOPOFF_THR_20PER, | ||
| 55 | }; | ||
| 56 | |||
| 57 | enum { | ||
| 58 | /* Fast charging current */ | ||
| 59 | MAX8925_FCHG_85MA, | ||
| 60 | MAX8925_FCHG_300MA, | ||
| 61 | MAX8925_FCHG_460MA, | ||
| 62 | MAX8925_FCHG_600MA, | ||
| 63 | MAX8925_FCHG_700MA, | ||
| 64 | MAX8925_FCHG_800MA, | ||
| 65 | MAX8925_FCHG_900MA, | ||
| 66 | MAX8925_FCHG_1000MA, | ||
| 67 | }; | ||
| 68 | |||
| 69 | /* Charger registers */ | ||
| 70 | #define MAX8925_CHG_IRQ1 (0x7e) | ||
| 71 | #define MAX8925_CHG_IRQ2 (0x7f) | ||
| 72 | #define MAX8925_CHG_IRQ1_MASK (0x80) | ||
| 73 | #define MAX8925_CHG_IRQ2_MASK (0x81) | ||
| 74 | #define MAX8925_CHG_STATUS (0x82) | ||
| 75 | |||
| 76 | /* GPM registers */ | ||
| 77 | #define MAX8925_SYSENSEL (0x00) | ||
| 78 | #define MAX8925_ON_OFF_IRQ1 (0x01) | ||
| 79 | #define MAX8925_ON_OFF_IRQ1_MASK (0x02) | ||
| 80 | #define MAX8925_ON_OFF_STATUS (0x03) | ||
| 81 | #define MAX8925_ON_OFF_IRQ2 (0x0d) | ||
| 82 | #define MAX8925_ON_OFF_IRQ2_MASK (0x0e) | ||
| 83 | #define MAX8925_RESET_CNFG (0x0f) | ||
| 84 | |||
| 85 | /* Touch registers */ | ||
| 86 | #define MAX8925_TSC_IRQ (0x00) | ||
| 87 | #define MAX8925_TSC_IRQ_MASK (0x01) | ||
| 88 | #define MAX8925_TSC_CNFG1 (0x02) | ||
| 89 | #define MAX8925_ADC_SCHED (0x10) | ||
| 90 | #define MAX8925_ADC_RES_END (0x6f) | ||
| 91 | |||
| 92 | #define MAX8925_NREF_OK (1 << 4) | ||
| 93 | |||
| 94 | /* RTC registers */ | ||
| 95 | #define MAX8925_ALARM0_CNTL (0x18) | ||
| 96 | #define MAX8925_ALARM1_CNTL (0x19) | ||
| 97 | #define MAX8925_RTC_IRQ (0x1c) | ||
| 98 | #define MAX8925_RTC_IRQ_MASK (0x1d) | ||
| 99 | #define MAX8925_MPL_CNTL (0x1e) | ||
| 100 | |||
| 101 | /* WLED registers */ | ||
| 102 | #define MAX8925_WLED_MODE_CNTL (0x84) | ||
| 103 | #define MAX8925_WLED_CNTL (0x85) | ||
| 104 | |||
| 105 | /* MAX8925 Registers */ | ||
| 106 | #define MAX8925_SDCTL1 (0x04) | ||
| 107 | #define MAX8925_SDCTL2 (0x07) | ||
| 108 | #define MAX8925_SDCTL3 (0x0A) | ||
| 109 | #define MAX8925_SDV1 (0x06) | ||
| 110 | #define MAX8925_SDV2 (0x09) | ||
| 111 | #define MAX8925_SDV3 (0x0C) | ||
| 112 | #define MAX8925_LDOCTL1 (0x18) | ||
| 113 | #define MAX8925_LDOCTL2 (0x1C) | ||
| 114 | #define MAX8925_LDOCTL3 (0x20) | ||
| 115 | #define MAX8925_LDOCTL4 (0x24) | ||
| 116 | #define MAX8925_LDOCTL5 (0x28) | ||
| 117 | #define MAX8925_LDOCTL6 (0x2C) | ||
| 118 | #define MAX8925_LDOCTL7 (0x30) | ||
| 119 | #define MAX8925_LDOCTL8 (0x34) | ||
| 120 | #define MAX8925_LDOCTL9 (0x38) | ||
| 121 | #define MAX8925_LDOCTL10 (0x3C) | ||
| 122 | #define MAX8925_LDOCTL11 (0x40) | ||
| 123 | #define MAX8925_LDOCTL12 (0x44) | ||
| 124 | #define MAX8925_LDOCTL13 (0x48) | ||
| 125 | #define MAX8925_LDOCTL14 (0x4C) | ||
| 126 | #define MAX8925_LDOCTL15 (0x50) | ||
| 127 | #define MAX8925_LDOCTL16 (0x10) | ||
| 128 | #define MAX8925_LDOCTL17 (0x14) | ||
| 129 | #define MAX8925_LDOCTL18 (0x72) | ||
| 130 | #define MAX8925_LDOCTL19 (0x5C) | ||
| 131 | #define MAX8925_LDOCTL20 (0x9C) | ||
| 132 | #define MAX8925_LDOVOUT1 (0x1A) | ||
| 133 | #define MAX8925_LDOVOUT2 (0x1E) | ||
| 134 | #define MAX8925_LDOVOUT3 (0x22) | ||
| 135 | #define MAX8925_LDOVOUT4 (0x26) | ||
| 136 | #define MAX8925_LDOVOUT5 (0x2A) | ||
| 137 | #define MAX8925_LDOVOUT6 (0x2E) | ||
| 138 | #define MAX8925_LDOVOUT7 (0x32) | ||
| 139 | #define MAX8925_LDOVOUT8 (0x36) | ||
| 140 | #define MAX8925_LDOVOUT9 (0x3A) | ||
| 141 | #define MAX8925_LDOVOUT10 (0x3E) | ||
| 142 | #define MAX8925_LDOVOUT11 (0x42) | ||
| 143 | #define MAX8925_LDOVOUT12 (0x46) | ||
| 144 | #define MAX8925_LDOVOUT13 (0x4A) | ||
| 145 | #define MAX8925_LDOVOUT14 (0x4E) | ||
| 146 | #define MAX8925_LDOVOUT15 (0x52) | ||
| 147 | #define MAX8925_LDOVOUT16 (0x12) | ||
| 148 | #define MAX8925_LDOVOUT17 (0x16) | ||
| 149 | #define MAX8925_LDOVOUT18 (0x74) | ||
| 150 | #define MAX8925_LDOVOUT19 (0x5E) | ||
| 151 | #define MAX8925_LDOVOUT20 (0x9E) | ||
| 152 | |||
| 153 | /* bit definitions */ | ||
| 154 | #define CHG_IRQ1_MASK (0x07) | ||
| 155 | #define CHG_IRQ2_MASK (0xff) | ||
| 156 | #define ON_OFF_IRQ1_MASK (0xff) | ||
| 157 | #define ON_OFF_IRQ2_MASK (0x03) | ||
| 158 | #define TSC_IRQ_MASK (0x03) | ||
| 159 | #define RTC_IRQ_MASK (0x0c) | ||
| 160 | |||
| 161 | #define MAX8925_MAX_REGULATOR (23) | ||
| 162 | |||
| 163 | #define MAX8925_NAME_SIZE (32) | ||
| 164 | |||
| 165 | /* IRQ definitions */ | ||
| 166 | enum { | ||
| 167 | MAX8925_IRQ_VCHG_DC_OVP, | ||
| 168 | MAX8925_IRQ_VCHG_DC_F, | ||
| 169 | MAX8925_IRQ_VCHG_DC_R, | ||
| 170 | MAX8925_IRQ_VCHG_USB_OVP, | ||
| 171 | MAX8925_IRQ_VCHG_USB_F, | ||
| 172 | MAX8925_IRQ_VCHG_USB_R, | ||
| 173 | MAX8925_IRQ_VCHG_THM_OK_R, | ||
| 174 | MAX8925_IRQ_VCHG_THM_OK_F, | ||
| 175 | MAX8925_IRQ_VCHG_SYSLOW_F, | ||
| 176 | MAX8925_IRQ_VCHG_SYSLOW_R, | ||
| 177 | MAX8925_IRQ_VCHG_RST, | ||
| 178 | MAX8925_IRQ_VCHG_DONE, | ||
| 179 | MAX8925_IRQ_VCHG_TOPOFF, | ||
| 180 | MAX8925_IRQ_VCHG_TMR_FAULT, | ||
| 181 | MAX8925_IRQ_GPM_RSTIN, | ||
| 182 | MAX8925_IRQ_GPM_MPL, | ||
| 183 | MAX8925_IRQ_GPM_SW_3SEC, | ||
| 184 | MAX8925_IRQ_GPM_EXTON_F, | ||
| 185 | MAX8925_IRQ_GPM_EXTON_R, | ||
| 186 | MAX8925_IRQ_GPM_SW_1SEC, | ||
| 187 | MAX8925_IRQ_GPM_SW_F, | ||
| 188 | MAX8925_IRQ_GPM_SW_R, | ||
| 189 | MAX8925_IRQ_GPM_SYSCKEN_F, | ||
| 190 | MAX8925_IRQ_GPM_SYSCKEN_R, | ||
| 191 | MAX8925_IRQ_RTC_ALARM1, | ||
| 192 | MAX8925_IRQ_RTC_ALARM0, | ||
| 193 | MAX8925_IRQ_TSC_STICK, | ||
| 194 | MAX8925_IRQ_TSC_NSTICK, | ||
| 195 | MAX8925_NR_IRQS, | ||
| 196 | }; | ||
| 197 | |||
| 198 | struct max8925_chip { | ||
| 199 | struct device *dev; | ||
| 200 | struct i2c_client *i2c; | ||
| 201 | struct i2c_client *adc; | ||
| 202 | struct i2c_client *rtc; | ||
| 203 | struct mutex io_lock; | ||
| 204 | struct mutex irq_lock; | ||
| 205 | |||
| 206 | int irq_base; | ||
| 207 | int core_irq; | ||
| 208 | int tsc_irq; | ||
| 209 | }; | ||
| 210 | |||
| 211 | struct max8925_backlight_pdata { | ||
| 212 | int lxw_scl; /* 0/1 -- 0.8Ohm/0.4Ohm */ | ||
| 213 | int lxw_freq; /* 700KHz ~ 1400KHz */ | ||
| 214 | int dual_string; /* 0/1 -- single/dual string */ | ||
| 215 | }; | ||
| 216 | |||
| 217 | struct max8925_touch_pdata { | ||
| 218 | unsigned int flags; | ||
| 219 | }; | ||
| 220 | |||
| 221 | struct max8925_power_pdata { | ||
| 222 | int (*set_charger)(int); | ||
| 223 | unsigned batt_detect:1; | ||
| 224 | unsigned topoff_threshold:2; | ||
| 225 | unsigned fast_charge:3; /* charge current */ | ||
| 226 | }; | ||
| 227 | |||
| 228 | /* | ||
| 229 | * irq_base: stores IRQ base number of MAX8925 in platform | ||
| 230 | * tsc_irq: stores IRQ number of MAX8925 TSC | ||
| 231 | */ | ||
| 232 | struct max8925_platform_data { | ||
| 233 | struct max8925_backlight_pdata *backlight; | ||
| 234 | struct max8925_touch_pdata *touch; | ||
| 235 | struct max8925_power_pdata *power; | ||
| 236 | struct regulator_init_data *regulator[MAX8925_MAX_REGULATOR]; | ||
| 237 | |||
| 238 | int irq_base; | ||
| 239 | int tsc_irq; | ||
| 240 | }; | ||
| 241 | |||
| 242 | extern int max8925_reg_read(struct i2c_client *, int); | ||
| 243 | extern int max8925_reg_write(struct i2c_client *, int, unsigned char); | ||
| 244 | extern int max8925_bulk_read(struct i2c_client *, int, int, unsigned char *); | ||
| 245 | extern int max8925_bulk_write(struct i2c_client *, int, int, unsigned char *); | ||
| 246 | extern int max8925_set_bits(struct i2c_client *, int, unsigned char, | ||
| 247 | unsigned char); | ||
| 248 | |||
| 249 | extern int max8925_device_init(struct max8925_chip *, | ||
| 250 | struct max8925_platform_data *); | ||
| 251 | extern void max8925_device_exit(struct max8925_chip *); | ||
| 252 | #endif /* __LINUX_MFD_MAX8925_H */ | ||
| 253 | |||
diff --git a/include/linux/mfd/mc13783-private.h b/include/linux/mfd/mc13783-private.h index 47e698cb0f16..95cf9360553f 100644 --- a/include/linux/mfd/mc13783-private.h +++ b/include/linux/mfd/mc13783-private.h | |||
| @@ -24,52 +24,23 @@ | |||
| 24 | 24 | ||
| 25 | #include <linux/platform_device.h> | 25 | #include <linux/platform_device.h> |
| 26 | #include <linux/mfd/mc13783.h> | 26 | #include <linux/mfd/mc13783.h> |
| 27 | #include <linux/workqueue.h> | ||
| 28 | #include <linux/mutex.h> | 27 | #include <linux/mutex.h> |
| 29 | 28 | #include <linux/interrupt.h> | |
| 30 | struct mc13783_irq { | ||
| 31 | void (*handler)(int, void *); | ||
| 32 | void *data; | ||
| 33 | }; | ||
| 34 | |||
| 35 | #define MC13783_NUM_IRQ 2 | ||
| 36 | #define MC13783_IRQ_TS 0 | ||
| 37 | #define MC13783_IRQ_REGULATOR 1 | ||
| 38 | |||
| 39 | #define MC13783_ADC_MODE_TS 1 | ||
| 40 | #define MC13783_ADC_MODE_SINGLE_CHAN 2 | ||
| 41 | #define MC13783_ADC_MODE_MULT_CHAN 3 | ||
| 42 | 29 | ||
| 43 | struct mc13783 { | 30 | struct mc13783 { |
| 44 | int revision; | 31 | struct spi_device *spidev; |
| 45 | struct device *dev; | 32 | struct mutex lock; |
| 46 | struct spi_device *spi_device; | ||
| 47 | |||
| 48 | int (*read_dev)(void *data, char reg, int count, u32 *dst); | ||
| 49 | int (*write_dev)(void *data, char reg, int count, const u32 *src); | ||
| 50 | |||
| 51 | struct mutex io_lock; | ||
| 52 | void *io_data; | ||
| 53 | int irq; | 33 | int irq; |
| 54 | unsigned int flags; | 34 | int flags; |
| 55 | 35 | ||
| 56 | struct mc13783_irq irq_handler[MC13783_NUM_IRQ]; | 36 | irq_handler_t irqhandler[MC13783_NUM_IRQ]; |
| 57 | struct work_struct work; | 37 | void *irqdata[MC13783_NUM_IRQ]; |
| 58 | struct completion adc_done; | ||
| 59 | unsigned int ts_active; | ||
| 60 | struct mutex adc_conv_lock; | ||
| 61 | 38 | ||
| 39 | /* XXX these should go as platformdata to the regulator subdevice */ | ||
| 62 | struct mc13783_regulator_init_data *regulators; | 40 | struct mc13783_regulator_init_data *regulators; |
| 63 | int num_regulators; | 41 | int num_regulators; |
| 64 | }; | 42 | }; |
| 65 | 43 | ||
| 66 | int mc13783_reg_read(struct mc13783 *, int reg_num, u32 *); | ||
| 67 | int mc13783_reg_write(struct mc13783 *, int, u32); | ||
| 68 | int mc13783_set_bits(struct mc13783 *, int, u32, u32); | ||
| 69 | int mc13783_free_irq(struct mc13783 *mc13783, int irq); | ||
| 70 | int mc13783_register_irq(struct mc13783 *mc13783, int irq, | ||
| 71 | void (*handler) (int, void *), void *data); | ||
| 72 | |||
| 73 | #define MC13783_REG_INTERRUPT_STATUS_0 0 | 44 | #define MC13783_REG_INTERRUPT_STATUS_0 0 |
| 74 | #define MC13783_REG_INTERRUPT_MASK_0 1 | 45 | #define MC13783_REG_INTERRUPT_MASK_0 1 |
| 75 | #define MC13783_REG_INTERRUPT_SENSE_0 2 | 46 | #define MC13783_REG_INTERRUPT_SENSE_0 2 |
| @@ -136,55 +107,6 @@ int mc13783_register_irq(struct mc13783 *mc13783, int irq, | |||
| 136 | #define MC13783_REG_TEST_3 63 | 107 | #define MC13783_REG_TEST_3 63 |
| 137 | #define MC13783_REG_NB 64 | 108 | #define MC13783_REG_NB 64 |
| 138 | 109 | ||
| 139 | |||
| 140 | /* | ||
| 141 | * Interrupt Status | ||
| 142 | */ | ||
| 143 | #define MC13783_INT_STAT_ADCDONEI (1 << 0) | ||
| 144 | #define MC13783_INT_STAT_ADCBISDONEI (1 << 1) | ||
| 145 | #define MC13783_INT_STAT_TSI (1 << 2) | ||
| 146 | #define MC13783_INT_STAT_WHIGHI (1 << 3) | ||
| 147 | #define MC13783_INT_STAT_WLOWI (1 << 4) | ||
| 148 | #define MC13783_INT_STAT_CHGDETI (1 << 6) | ||
| 149 | #define MC13783_INT_STAT_CHGOVI (1 << 7) | ||
| 150 | #define MC13783_INT_STAT_CHGREVI (1 << 8) | ||
| 151 | #define MC13783_INT_STAT_CHGSHORTI (1 << 9) | ||
| 152 | #define MC13783_INT_STAT_CCCVI (1 << 10) | ||
| 153 | #define MC13783_INT_STAT_CHGCURRI (1 << 11) | ||
| 154 | #define MC13783_INT_STAT_BPONI (1 << 12) | ||
| 155 | #define MC13783_INT_STAT_LOBATLI (1 << 13) | ||
| 156 | #define MC13783_INT_STAT_LOBATHI (1 << 14) | ||
| 157 | #define MC13783_INT_STAT_UDPI (1 << 15) | ||
| 158 | #define MC13783_INT_STAT_USBI (1 << 16) | ||
| 159 | #define MC13783_INT_STAT_IDI (1 << 19) | ||
| 160 | #define MC13783_INT_STAT_Unused (1 << 20) | ||
| 161 | #define MC13783_INT_STAT_SE1I (1 << 21) | ||
| 162 | #define MC13783_INT_STAT_CKDETI (1 << 22) | ||
| 163 | #define MC13783_INT_STAT_UDMI (1 << 23) | ||
| 164 | |||
| 165 | /* | ||
| 166 | * Interrupt Mask | ||
| 167 | */ | ||
| 168 | #define MC13783_INT_MASK_ADCDONEM (1 << 0) | ||
| 169 | #define MC13783_INT_MASK_ADCBISDONEM (1 << 1) | ||
| 170 | #define MC13783_INT_MASK_TSM (1 << 2) | ||
| 171 | #define MC13783_INT_MASK_WHIGHM (1 << 3) | ||
| 172 | #define MC13783_INT_MASK_WLOWM (1 << 4) | ||
| 173 | #define MC13783_INT_MASK_CHGDETM (1 << 6) | ||
| 174 | #define MC13783_INT_MASK_CHGOVM (1 << 7) | ||
| 175 | #define MC13783_INT_MASK_CHGREVM (1 << 8) | ||
| 176 | #define MC13783_INT_MASK_CHGSHORTM (1 << 9) | ||
| 177 | #define MC13783_INT_MASK_CCCVM (1 << 10) | ||
| 178 | #define MC13783_INT_MASK_CHGCURRM (1 << 11) | ||
| 179 | #define MC13783_INT_MASK_BPONM (1 << 12) | ||
| 180 | #define MC13783_INT_MASK_LOBATLM (1 << 13) | ||
| 181 | #define MC13783_INT_MASK_LOBATHM (1 << 14) | ||
| 182 | #define MC13783_INT_MASK_UDPM (1 << 15) | ||
| 183 | #define MC13783_INT_MASK_USBM (1 << 16) | ||
| 184 | #define MC13783_INT_MASK_IDM (1 << 19) | ||
| 185 | #define MC13783_INT_MASK_SE1M (1 << 21) | ||
| 186 | #define MC13783_INT_MASK_CKDETM (1 << 22) | ||
| 187 | |||
| 188 | /* | 110 | /* |
| 189 | * Reg Regulator Mode 0 | 111 | * Reg Regulator Mode 0 |
| 190 | */ | 112 | */ |
| @@ -284,113 +206,15 @@ int mc13783_register_irq(struct mc13783 *mc13783, int irq, | |||
| 284 | #define MC13783_SWCTRL_SW3_STBY (1 << 21) | 206 | #define MC13783_SWCTRL_SW3_STBY (1 << 21) |
| 285 | #define MC13783_SWCTRL_SW3_MODE (1 << 22) | 207 | #define MC13783_SWCTRL_SW3_MODE (1 << 22) |
| 286 | 208 | ||
| 287 | /* | 209 | static inline int mc13783_set_bits(struct mc13783 *mc13783, unsigned int offset, |
| 288 | * ADC/Touch | 210 | u32 mask, u32 val) |
| 289 | */ | 211 | { |
| 290 | #define MC13783_ADC0_LICELLCON (1 << 0) | 212 | int ret; |
| 291 | #define MC13783_ADC0_CHRGICON (1 << 1) | 213 | mc13783_lock(mc13783); |
| 292 | #define MC13783_ADC0_BATICON (1 << 2) | 214 | ret = mc13783_reg_rmw(mc13783, offset, mask, val); |
| 293 | #define MC13783_ADC0_RTHEN (1 << 3) | 215 | mc13783_unlock(mc13783); |
| 294 | #define MC13783_ADC0_DTHEN (1 << 4) | ||
| 295 | #define MC13783_ADC0_UIDEN (1 << 5) | ||
| 296 | #define MC13783_ADC0_ADOUTEN (1 << 6) | ||
| 297 | #define MC13783_ADC0_ADOUTPER (1 << 7) | ||
| 298 | #define MC13783_ADC0_ADREFEN (1 << 10) | ||
| 299 | #define MC13783_ADC0_ADREFMODE (1 << 11) | ||
| 300 | #define MC13783_ADC0_TSMOD0 (1 << 12) | ||
| 301 | #define MC13783_ADC0_TSMOD1 (1 << 13) | ||
| 302 | #define MC13783_ADC0_TSMOD2 (1 << 14) | ||
| 303 | #define MC13783_ADC0_CHRGRAWDIV (1 << 15) | ||
| 304 | #define MC13783_ADC0_ADINC1 (1 << 16) | ||
| 305 | #define MC13783_ADC0_ADINC2 (1 << 17) | ||
| 306 | #define MC13783_ADC0_WCOMP (1 << 18) | ||
| 307 | #define MC13783_ADC0_ADCBIS0 (1 << 23) | ||
| 308 | |||
| 309 | #define MC13783_ADC1_ADEN (1 << 0) | ||
| 310 | #define MC13783_ADC1_RAND (1 << 1) | ||
| 311 | #define MC13783_ADC1_ADSEL (1 << 3) | ||
| 312 | #define MC13783_ADC1_TRIGMASK (1 << 4) | ||
| 313 | #define MC13783_ADC1_ADA10 (1 << 5) | ||
| 314 | #define MC13783_ADC1_ADA11 (1 << 6) | ||
| 315 | #define MC13783_ADC1_ADA12 (1 << 7) | ||
| 316 | #define MC13783_ADC1_ADA20 (1 << 8) | ||
| 317 | #define MC13783_ADC1_ADA21 (1 << 9) | ||
| 318 | #define MC13783_ADC1_ADA22 (1 << 10) | ||
| 319 | #define MC13783_ADC1_ATO0 (1 << 11) | ||
| 320 | #define MC13783_ADC1_ATO1 (1 << 12) | ||
| 321 | #define MC13783_ADC1_ATO2 (1 << 13) | ||
| 322 | #define MC13783_ADC1_ATO3 (1 << 14) | ||
| 323 | #define MC13783_ADC1_ATO4 (1 << 15) | ||
| 324 | #define MC13783_ADC1_ATO5 (1 << 16) | ||
| 325 | #define MC13783_ADC1_ATO6 (1 << 17) | ||
| 326 | #define MC13783_ADC1_ATO7 (1 << 18) | ||
| 327 | #define MC13783_ADC1_ATOX (1 << 19) | ||
| 328 | #define MC13783_ADC1_ASC (1 << 20) | ||
| 329 | #define MC13783_ADC1_ADTRIGIGN (1 << 21) | ||
| 330 | #define MC13783_ADC1_ADONESHOT (1 << 22) | ||
| 331 | #define MC13783_ADC1_ADCBIS1 (1 << 23) | ||
| 332 | |||
| 333 | #define MC13783_ADC1_CHAN0_SHIFT 5 | ||
| 334 | #define MC13783_ADC1_CHAN1_SHIFT 8 | ||
| 335 | |||
| 336 | #define MC13783_ADC2_ADD10 (1 << 2) | ||
| 337 | #define MC13783_ADC2_ADD11 (1 << 3) | ||
| 338 | #define MC13783_ADC2_ADD12 (1 << 4) | ||
| 339 | #define MC13783_ADC2_ADD13 (1 << 5) | ||
| 340 | #define MC13783_ADC2_ADD14 (1 << 6) | ||
| 341 | #define MC13783_ADC2_ADD15 (1 << 7) | ||
| 342 | #define MC13783_ADC2_ADD16 (1 << 8) | ||
| 343 | #define MC13783_ADC2_ADD17 (1 << 9) | ||
| 344 | #define MC13783_ADC2_ADD18 (1 << 10) | ||
| 345 | #define MC13783_ADC2_ADD19 (1 << 11) | ||
| 346 | #define MC13783_ADC2_ADD20 (1 << 14) | ||
| 347 | #define MC13783_ADC2_ADD21 (1 << 15) | ||
| 348 | #define MC13783_ADC2_ADD22 (1 << 16) | ||
| 349 | #define MC13783_ADC2_ADD23 (1 << 17) | ||
| 350 | #define MC13783_ADC2_ADD24 (1 << 18) | ||
| 351 | #define MC13783_ADC2_ADD25 (1 << 19) | ||
| 352 | #define MC13783_ADC2_ADD26 (1 << 20) | ||
| 353 | #define MC13783_ADC2_ADD27 (1 << 21) | ||
| 354 | #define MC13783_ADC2_ADD28 (1 << 22) | ||
| 355 | #define MC13783_ADC2_ADD29 (1 << 23) | ||
| 356 | 216 | ||
| 357 | #define MC13783_ADC3_WHIGH0 (1 << 0) | 217 | return ret; |
| 358 | #define MC13783_ADC3_WHIGH1 (1 << 1) | 218 | } |
| 359 | #define MC13783_ADC3_WHIGH2 (1 << 2) | ||
| 360 | #define MC13783_ADC3_WHIGH3 (1 << 3) | ||
| 361 | #define MC13783_ADC3_WHIGH4 (1 << 4) | ||
| 362 | #define MC13783_ADC3_WHIGH5 (1 << 5) | ||
| 363 | #define MC13783_ADC3_ICID0 (1 << 6) | ||
| 364 | #define MC13783_ADC3_ICID1 (1 << 7) | ||
| 365 | #define MC13783_ADC3_ICID2 (1 << 8) | ||
| 366 | #define MC13783_ADC3_WLOW0 (1 << 9) | ||
| 367 | #define MC13783_ADC3_WLOW1 (1 << 10) | ||
| 368 | #define MC13783_ADC3_WLOW2 (1 << 11) | ||
| 369 | #define MC13783_ADC3_WLOW3 (1 << 12) | ||
| 370 | #define MC13783_ADC3_WLOW4 (1 << 13) | ||
| 371 | #define MC13783_ADC3_WLOW5 (1 << 14) | ||
| 372 | #define MC13783_ADC3_ADCBIS2 (1 << 23) | ||
| 373 | |||
| 374 | #define MC13783_ADC4_ADDBIS10 (1 << 2) | ||
| 375 | #define MC13783_ADC4_ADDBIS11 (1 << 3) | ||
| 376 | #define MC13783_ADC4_ADDBIS12 (1 << 4) | ||
| 377 | #define MC13783_ADC4_ADDBIS13 (1 << 5) | ||
| 378 | #define MC13783_ADC4_ADDBIS14 (1 << 6) | ||
| 379 | #define MC13783_ADC4_ADDBIS15 (1 << 7) | ||
| 380 | #define MC13783_ADC4_ADDBIS16 (1 << 8) | ||
| 381 | #define MC13783_ADC4_ADDBIS17 (1 << 9) | ||
| 382 | #define MC13783_ADC4_ADDBIS18 (1 << 10) | ||
| 383 | #define MC13783_ADC4_ADDBIS19 (1 << 11) | ||
| 384 | #define MC13783_ADC4_ADDBIS20 (1 << 14) | ||
| 385 | #define MC13783_ADC4_ADDBIS21 (1 << 15) | ||
| 386 | #define MC13783_ADC4_ADDBIS22 (1 << 16) | ||
| 387 | #define MC13783_ADC4_ADDBIS23 (1 << 17) | ||
| 388 | #define MC13783_ADC4_ADDBIS24 (1 << 18) | ||
| 389 | #define MC13783_ADC4_ADDBIS25 (1 << 19) | ||
| 390 | #define MC13783_ADC4_ADDBIS26 (1 << 20) | ||
| 391 | #define MC13783_ADC4_ADDBIS27 (1 << 21) | ||
| 392 | #define MC13783_ADC4_ADDBIS28 (1 << 22) | ||
| 393 | #define MC13783_ADC4_ADDBIS29 (1 << 23) | ||
| 394 | 219 | ||
| 395 | #endif /* __LINUX_MFD_MC13783_PRIV_H */ | 220 | #endif /* __LINUX_MFD_MC13783_PRIV_H */ |
| 396 | |||
diff --git a/include/linux/mfd/mc13783.h b/include/linux/mfd/mc13783.h index b3a2a7243573..8895d9d8879c 100644 --- a/include/linux/mfd/mc13783.h +++ b/include/linux/mfd/mc13783.h | |||
| @@ -1,28 +1,70 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * Copyright 2009 Pengutronix, Sascha Hauer <s.hauer@pengutronix.de> | 2 | * Copyright 2009 Pengutronix |
| 3 | * Uwe Kleine-Koenig <u.kleine-koenig@pengutronix.de> | ||
| 3 | * | 4 | * |
| 4 | * Initial development of this code was funded by | 5 | * This program is free software; you can redistribute it and/or modify it under |
| 5 | * Phytec Messtechnik GmbH, http://www.phytec.de | 6 | * the terms of the GNU General Public License version 2 as published by the |
| 6 | * | 7 | * Free Software Foundation. |
| 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 | */ | 8 | */ |
| 9 | #ifndef __LINUX_MFD_MC13783_H | ||
| 10 | #define __LINUX_MFD_MC13783_H | ||
| 21 | 11 | ||
| 22 | #ifndef __INCLUDE_LINUX_MFD_MC13783_H | 12 | #include <linux/interrupt.h> |
| 23 | #define __INCLUDE_LINUX_MFD_MC13783_H | ||
| 24 | 13 | ||
| 25 | struct mc13783; | 14 | struct mc13783; |
| 15 | |||
| 16 | void mc13783_lock(struct mc13783 *mc13783); | ||
| 17 | void mc13783_unlock(struct mc13783 *mc13783); | ||
| 18 | |||
| 19 | int mc13783_reg_read(struct mc13783 *mc13783, unsigned int offset, u32 *val); | ||
| 20 | int mc13783_reg_write(struct mc13783 *mc13783, unsigned int offset, u32 val); | ||
| 21 | int mc13783_reg_rmw(struct mc13783 *mc13783, unsigned int offset, | ||
| 22 | u32 mask, u32 val); | ||
| 23 | |||
| 24 | int mc13783_irq_request(struct mc13783 *mc13783, int irq, | ||
| 25 | irq_handler_t handler, const char *name, void *dev); | ||
| 26 | int mc13783_irq_request_nounmask(struct mc13783 *mc13783, int irq, | ||
| 27 | irq_handler_t handler, const char *name, void *dev); | ||
| 28 | int mc13783_irq_free(struct mc13783 *mc13783, int irq, void *dev); | ||
| 29 | |||
| 30 | int mc13783_irq_mask(struct mc13783 *mc13783, int irq); | ||
| 31 | int mc13783_irq_unmask(struct mc13783 *mc13783, int irq); | ||
| 32 | int mc13783_irq_status(struct mc13783 *mc13783, int irq, | ||
| 33 | int *enabled, int *pending); | ||
| 34 | int mc13783_irq_ack(struct mc13783 *mc13783, int irq); | ||
| 35 | |||
| 36 | static inline int mc13783_mask(struct mc13783 *mc13783, int irq) __deprecated; | ||
| 37 | static inline int mc13783_mask(struct mc13783 *mc13783, int irq) | ||
| 38 | { | ||
| 39 | return mc13783_irq_mask(mc13783, irq); | ||
| 40 | } | ||
| 41 | |||
| 42 | static inline int mc13783_unmask(struct mc13783 *mc13783, int irq) __deprecated; | ||
| 43 | static inline int mc13783_unmask(struct mc13783 *mc13783, int irq) | ||
| 44 | { | ||
| 45 | return mc13783_irq_unmask(mc13783, irq); | ||
| 46 | } | ||
| 47 | |||
| 48 | static inline int mc13783_ackirq(struct mc13783 *mc13783, int irq) __deprecated; | ||
| 49 | static inline int mc13783_ackirq(struct mc13783 *mc13783, int irq) | ||
| 50 | { | ||
| 51 | return mc13783_irq_ack(mc13783, irq); | ||
| 52 | } | ||
| 53 | |||
| 54 | #define MC13783_ADC0 43 | ||
| 55 | #define MC13783_ADC0_ADREFEN (1 << 10) | ||
| 56 | #define MC13783_ADC0_ADREFMODE (1 << 11) | ||
| 57 | #define MC13783_ADC0_TSMOD0 (1 << 12) | ||
| 58 | #define MC13783_ADC0_TSMOD1 (1 << 13) | ||
| 59 | #define MC13783_ADC0_TSMOD2 (1 << 14) | ||
| 60 | #define MC13783_ADC0_ADINC1 (1 << 16) | ||
| 61 | #define MC13783_ADC0_ADINC2 (1 << 17) | ||
| 62 | |||
| 63 | #define MC13783_ADC0_TSMOD_MASK (MC13783_ADC0_TSMOD0 | \ | ||
| 64 | MC13783_ADC0_TSMOD1 | \ | ||
| 65 | MC13783_ADC0_TSMOD2) | ||
| 66 | |||
| 67 | /* to be cleaned up */ | ||
| 26 | struct regulator_init_data; | 68 | struct regulator_init_data; |
| 27 | 69 | ||
| 28 | struct mc13783_regulator_init_data { | 70 | struct mc13783_regulator_init_data { |
| @@ -30,23 +72,30 @@ struct mc13783_regulator_init_data { | |||
| 30 | struct regulator_init_data *init_data; | 72 | struct regulator_init_data *init_data; |
| 31 | }; | 73 | }; |
| 32 | 74 | ||
| 33 | struct mc13783_platform_data { | 75 | struct mc13783_regulator_platform_data { |
| 34 | struct mc13783_regulator_init_data *regulators; | ||
| 35 | int num_regulators; | 76 | int num_regulators; |
| 36 | unsigned int flags; | 77 | struct mc13783_regulator_init_data *regulators; |
| 37 | }; | 78 | }; |
| 38 | 79 | ||
| 39 | /* mc13783_platform_data flags */ | 80 | struct mc13783_platform_data { |
| 81 | int num_regulators; | ||
| 82 | struct mc13783_regulator_init_data *regulators; | ||
| 83 | |||
| 40 | #define MC13783_USE_TOUCHSCREEN (1 << 0) | 84 | #define MC13783_USE_TOUCHSCREEN (1 << 0) |
| 41 | #define MC13783_USE_CODEC (1 << 1) | 85 | #define MC13783_USE_CODEC (1 << 1) |
| 42 | #define MC13783_USE_ADC (1 << 2) | 86 | #define MC13783_USE_ADC (1 << 2) |
| 43 | #define MC13783_USE_RTC (1 << 3) | 87 | #define MC13783_USE_RTC (1 << 3) |
| 44 | #define MC13783_USE_REGULATOR (1 << 4) | 88 | #define MC13783_USE_REGULATOR (1 << 4) |
| 89 | unsigned int flags; | ||
| 90 | }; | ||
| 91 | |||
| 92 | #define MC13783_ADC_MODE_TS 1 | ||
| 93 | #define MC13783_ADC_MODE_SINGLE_CHAN 2 | ||
| 94 | #define MC13783_ADC_MODE_MULT_CHAN 3 | ||
| 45 | 95 | ||
| 46 | int mc13783_adc_do_conversion(struct mc13783 *mc13783, unsigned int mode, | 96 | int mc13783_adc_do_conversion(struct mc13783 *mc13783, unsigned int mode, |
| 47 | unsigned int channel, unsigned int *sample); | 97 | unsigned int channel, unsigned int *sample); |
| 48 | 98 | ||
| 49 | void mc13783_adc_set_ts_status(struct mc13783 *mc13783, unsigned int status); | ||
| 50 | 99 | ||
| 51 | #define MC13783_SW_SW1A 0 | 100 | #define MC13783_SW_SW1A 0 |
| 52 | #define MC13783_SW_SW1B 1 | 101 | #define MC13783_SW_SW1B 1 |
| @@ -79,6 +128,49 @@ void mc13783_adc_set_ts_status(struct mc13783 *mc13783, unsigned int status); | |||
| 79 | #define MC13783_REGU_V2 28 | 128 | #define MC13783_REGU_V2 28 |
| 80 | #define MC13783_REGU_V3 29 | 129 | #define MC13783_REGU_V3 29 |
| 81 | #define MC13783_REGU_V4 30 | 130 | #define MC13783_REGU_V4 30 |
| 131 | #define MC13783_REGU_PWGT1SPI 31 | ||
| 132 | #define MC13783_REGU_PWGT2SPI 32 | ||
| 82 | 133 | ||
| 83 | #endif /* __INCLUDE_LINUX_MFD_MC13783_H */ | 134 | #define MC13783_IRQ_ADCDONE 0 |
| 135 | #define MC13783_IRQ_ADCBISDONE 1 | ||
| 136 | #define MC13783_IRQ_TS 2 | ||
| 137 | #define MC13783_IRQ_WHIGH 3 | ||
| 138 | #define MC13783_IRQ_WLOW 4 | ||
| 139 | #define MC13783_IRQ_CHGDET 6 | ||
| 140 | #define MC13783_IRQ_CHGOV 7 | ||
| 141 | #define MC13783_IRQ_CHGREV 8 | ||
| 142 | #define MC13783_IRQ_CHGSHORT 9 | ||
| 143 | #define MC13783_IRQ_CCCV 10 | ||
| 144 | #define MC13783_IRQ_CHGCURR 11 | ||
| 145 | #define MC13783_IRQ_BPON 12 | ||
| 146 | #define MC13783_IRQ_LOBATL 13 | ||
| 147 | #define MC13783_IRQ_LOBATH 14 | ||
| 148 | #define MC13783_IRQ_UDP 15 | ||
| 149 | #define MC13783_IRQ_USB 16 | ||
| 150 | #define MC13783_IRQ_ID 19 | ||
| 151 | #define MC13783_IRQ_SE1 21 | ||
| 152 | #define MC13783_IRQ_CKDET 22 | ||
| 153 | #define MC13783_IRQ_UDM 23 | ||
| 154 | #define MC13783_IRQ_1HZ 24 | ||
| 155 | #define MC13783_IRQ_TODA 25 | ||
| 156 | #define MC13783_IRQ_ONOFD1 27 | ||
| 157 | #define MC13783_IRQ_ONOFD2 28 | ||
| 158 | #define MC13783_IRQ_ONOFD3 29 | ||
| 159 | #define MC13783_IRQ_SYSRST 30 | ||
| 160 | #define MC13783_IRQ_RTCRST 31 | ||
| 161 | #define MC13783_IRQ_PC 32 | ||
| 162 | #define MC13783_IRQ_WARM 33 | ||
| 163 | #define MC13783_IRQ_MEMHLD 34 | ||
| 164 | #define MC13783_IRQ_PWRRDY 35 | ||
| 165 | #define MC13783_IRQ_THWARNL 36 | ||
| 166 | #define MC13783_IRQ_THWARNH 37 | ||
| 167 | #define MC13783_IRQ_CLK 38 | ||
| 168 | #define MC13783_IRQ_SEMAF 39 | ||
| 169 | #define MC13783_IRQ_MC2B 41 | ||
| 170 | #define MC13783_IRQ_HSDET 42 | ||
| 171 | #define MC13783_IRQ_HSL 43 | ||
| 172 | #define MC13783_IRQ_ALSPTH 44 | ||
| 173 | #define MC13783_IRQ_AHSSHORT 45 | ||
| 174 | #define MC13783_NUM_IRQ 46 | ||
| 84 | 175 | ||
| 176 | #endif /* __LINUX_MFD_MC13783_H */ | ||
diff --git a/include/linux/mfd/mcp.h b/include/linux/mfd/mcp.h new file mode 100644 index 000000000000..ee496708e38b --- /dev/null +++ b/include/linux/mfd/mcp.h | |||
| @@ -0,0 +1,69 @@ | |||
| 1 | /* | ||
| 2 | * linux/drivers/mfd/mcp.h | ||
| 3 | * | ||
| 4 | * Copyright (C) 2001 Russell King, All Rights Reserved. | ||
| 5 | * | ||
| 6 | * This program is free software; you can redistribute it and/or modify | ||
| 7 | * it under the terms of the GNU General Public License as published by | ||
| 8 | * the Free Software Foundation; either version 2 of the License. | ||
| 9 | */ | ||
| 10 | #ifndef MCP_H | ||
| 11 | #define MCP_H | ||
| 12 | |||
| 13 | #include <mach/dma.h> | ||
| 14 | |||
| 15 | struct mcp_ops; | ||
| 16 | |||
| 17 | struct mcp { | ||
| 18 | struct module *owner; | ||
| 19 | struct mcp_ops *ops; | ||
| 20 | spinlock_t lock; | ||
| 21 | int use_count; | ||
| 22 | unsigned int sclk_rate; | ||
| 23 | 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; | ||
| 29 | int gpio_base; | ||
| 30 | }; | ||
| 31 | |||
| 32 | struct mcp_ops { | ||
| 33 | void (*set_telecom_divisor)(struct mcp *, unsigned int); | ||
| 34 | void (*set_audio_divisor)(struct mcp *, unsigned int); | ||
| 35 | void (*reg_write)(struct mcp *, unsigned int, unsigned int); | ||
| 36 | unsigned int (*reg_read)(struct mcp *, unsigned int); | ||
| 37 | void (*enable)(struct mcp *); | ||
| 38 | void (*disable)(struct mcp *); | ||
| 39 | }; | ||
| 40 | |||
| 41 | void mcp_set_telecom_divisor(struct mcp *, unsigned int); | ||
| 42 | void mcp_set_audio_divisor(struct mcp *, unsigned int); | ||
| 43 | void mcp_reg_write(struct mcp *, unsigned int, unsigned int); | ||
| 44 | unsigned int mcp_reg_read(struct mcp *, unsigned int); | ||
| 45 | void mcp_enable(struct mcp *); | ||
| 46 | void mcp_disable(struct mcp *); | ||
| 47 | #define mcp_get_sclk_rate(mcp) ((mcp)->sclk_rate) | ||
| 48 | |||
| 49 | struct mcp *mcp_host_alloc(struct device *, size_t); | ||
| 50 | int mcp_host_register(struct mcp *); | ||
| 51 | void mcp_host_unregister(struct mcp *); | ||
| 52 | |||
| 53 | struct mcp_driver { | ||
| 54 | struct device_driver drv; | ||
| 55 | int (*probe)(struct mcp *); | ||
| 56 | void (*remove)(struct mcp *); | ||
| 57 | int (*suspend)(struct mcp *, pm_message_t); | ||
| 58 | int (*resume)(struct mcp *); | ||
| 59 | }; | ||
| 60 | |||
| 61 | int mcp_driver_register(struct mcp_driver *); | ||
| 62 | void mcp_driver_unregister(struct mcp_driver *); | ||
| 63 | |||
| 64 | #define mcp_get_drvdata(mcp) dev_get_drvdata(&(mcp)->attached_device) | ||
| 65 | #define mcp_set_drvdata(mcp,d) dev_set_drvdata(&(mcp)->attached_device, d) | ||
| 66 | |||
| 67 | #define mcp_priv(mcp) ((void *)((mcp)+1)) | ||
| 68 | |||
| 69 | #endif | ||
diff --git a/include/linux/mfd/pcf50633/core.h b/include/linux/mfd/pcf50633/core.h index 9aba7b779fbc..3398bd9aab11 100644 --- a/include/linux/mfd/pcf50633/core.h +++ b/include/linux/mfd/pcf50633/core.h | |||
| @@ -29,7 +29,12 @@ struct pcf50633_platform_data { | |||
| 29 | char **batteries; | 29 | char **batteries; |
| 30 | int num_batteries; | 30 | int num_batteries; |
| 31 | 31 | ||
| 32 | int charging_restart_interval; | 32 | /* |
| 33 | * Should be set accordingly to the reference resistor used, see | ||
| 34 | * I_{ch(ref)} charger reference current in the pcf50633 User | ||
| 35 | * Manual. | ||
| 36 | */ | ||
| 37 | int charger_reference_current_ma; | ||
| 33 | 38 | ||
| 34 | /* Callbacks */ | 39 | /* Callbacks */ |
| 35 | void (*probe_done)(struct pcf50633 *); | 40 | void (*probe_done)(struct pcf50633 *); |
| @@ -40,10 +45,6 @@ struct pcf50633_platform_data { | |||
| 40 | u8 resumers[5]; | 45 | u8 resumers[5]; |
| 41 | }; | 46 | }; |
| 42 | 47 | ||
| 43 | struct pcf50633_subdev_pdata { | ||
| 44 | struct pcf50633 *pcf; | ||
| 45 | }; | ||
| 46 | |||
| 47 | struct pcf50633_irq { | 48 | struct pcf50633_irq { |
| 48 | void (*handler) (int, void *); | 49 | void (*handler) (int, void *); |
| 49 | void *data; | 50 | void *data; |
| @@ -217,5 +218,9 @@ enum pcf50633_reg_int5 { | |||
| 217 | #define PCF50633_REG_LEDCTL 0x2a | 218 | #define PCF50633_REG_LEDCTL 0x2a |
| 218 | #define PCF50633_REG_LEDDIM 0x2b | 219 | #define PCF50633_REG_LEDDIM 0x2b |
| 219 | 220 | ||
| 220 | #endif | 221 | static inline struct pcf50633 *dev_to_pcf50633(struct device *dev) |
| 222 | { | ||
| 223 | return dev_get_drvdata(dev); | ||
| 224 | } | ||
| 221 | 225 | ||
| 226 | #endif | ||
diff --git a/include/linux/mfd/pcf50633/mbc.h b/include/linux/mfd/pcf50633/mbc.h index 4119579acf2c..df4f5fa88de3 100644 --- a/include/linux/mfd/pcf50633/mbc.h +++ b/include/linux/mfd/pcf50633/mbc.h | |||
| @@ -128,6 +128,7 @@ enum pcf50633_reg_mbcs3 { | |||
| 128 | int pcf50633_mbc_usb_curlim_set(struct pcf50633 *pcf, int ma); | 128 | int pcf50633_mbc_usb_curlim_set(struct pcf50633 *pcf, int ma); |
| 129 | 129 | ||
| 130 | int pcf50633_mbc_get_status(struct pcf50633 *); | 130 | int pcf50633_mbc_get_status(struct pcf50633 *); |
| 131 | int pcf50633_mbc_get_usb_online_status(struct pcf50633 *); | ||
| 131 | 132 | ||
| 132 | #endif | 133 | #endif |
| 133 | 134 | ||
diff --git a/include/linux/mfd/sh_mobile_sdhi.h b/include/linux/mfd/sh_mobile_sdhi.h new file mode 100644 index 000000000000..3bcd7163485c --- /dev/null +++ b/include/linux/mfd/sh_mobile_sdhi.h | |||
| @@ -0,0 +1,8 @@ | |||
| 1 | #ifndef __SH_MOBILE_SDHI_H__ | ||
| 2 | #define __SH_MOBILE_SDHI_H__ | ||
| 3 | |||
| 4 | struct sh_mobile_sdhi_info { | ||
| 5 | void (*set_pwr)(struct platform_device *pdev, int state); | ||
| 6 | }; | ||
| 7 | |||
| 8 | #endif /* __SH_MOBILE_SDHI_H__ */ | ||
diff --git a/include/linux/mfd/tmio.h b/include/linux/mfd/tmio.h index 6b9c5d06690c..c3f7dff8effc 100644 --- a/include/linux/mfd/tmio.h +++ b/include/linux/mfd/tmio.h | |||
| @@ -2,6 +2,8 @@ | |||
| 2 | #define MFD_TMIO_H | 2 | #define MFD_TMIO_H |
| 3 | 3 | ||
| 4 | #include <linux/fb.h> | 4 | #include <linux/fb.h> |
| 5 | #include <linux/io.h> | ||
| 6 | #include <linux/platform_device.h> | ||
| 5 | 7 | ||
| 6 | #define tmio_ioread8(addr) readb(addr) | 8 | #define tmio_ioread8(addr) readb(addr) |
| 7 | #define tmio_ioread16(addr) readw(addr) | 9 | #define tmio_ioread16(addr) readw(addr) |
| @@ -18,11 +20,49 @@ | |||
| 18 | writew((val) >> 16, (addr) + 2); \ | 20 | writew((val) >> 16, (addr) + 2); \ |
| 19 | } while (0) | 21 | } while (0) |
| 20 | 22 | ||
| 23 | #define CNF_CMD 0x04 | ||
| 24 | #define CNF_CTL_BASE 0x10 | ||
| 25 | #define CNF_INT_PIN 0x3d | ||
| 26 | #define CNF_STOP_CLK_CTL 0x40 | ||
| 27 | #define CNF_GCLK_CTL 0x41 | ||
| 28 | #define CNF_SD_CLK_MODE 0x42 | ||
| 29 | #define CNF_PIN_STATUS 0x44 | ||
| 30 | #define CNF_PWR_CTL_1 0x48 | ||
| 31 | #define CNF_PWR_CTL_2 0x49 | ||
| 32 | #define CNF_PWR_CTL_3 0x4a | ||
| 33 | #define CNF_CARD_DETECT_MODE 0x4c | ||
| 34 | #define CNF_SD_SLOT 0x50 | ||
| 35 | #define CNF_EXT_GCLK_CTL_1 0xf0 | ||
| 36 | #define CNF_EXT_GCLK_CTL_2 0xf1 | ||
| 37 | #define CNF_EXT_GCLK_CTL_3 0xf9 | ||
| 38 | #define CNF_SD_LED_EN_1 0xfa | ||
| 39 | #define CNF_SD_LED_EN_2 0xfe | ||
| 40 | |||
| 41 | #define SDCREN 0x2 /* Enable access to MMC CTL regs. (flag in COMMAND_REG)*/ | ||
| 42 | |||
| 43 | #define sd_config_write8(base, shift, reg, val) \ | ||
| 44 | tmio_iowrite8((val), (base) + ((reg) << (shift))) | ||
| 45 | #define sd_config_write16(base, shift, reg, val) \ | ||
| 46 | tmio_iowrite16((val), (base) + ((reg) << (shift))) | ||
| 47 | #define sd_config_write32(base, shift, reg, val) \ | ||
| 48 | do { \ | ||
| 49 | tmio_iowrite16((val), (base) + ((reg) << (shift))); \ | ||
| 50 | tmio_iowrite16((val) >> 16, (base) + ((reg + 2) << (shift))); \ | ||
| 51 | } while (0) | ||
| 52 | |||
| 53 | int tmio_core_mmc_enable(void __iomem *cnf, int shift, unsigned long base); | ||
| 54 | int tmio_core_mmc_resume(void __iomem *cnf, int shift, unsigned long base); | ||
| 55 | void tmio_core_mmc_pwr(void __iomem *cnf, int shift, int state); | ||
| 56 | void tmio_core_mmc_clk_div(void __iomem *cnf, int shift, int state); | ||
| 57 | |||
| 21 | /* | 58 | /* |
| 22 | * data for the MMC controller | 59 | * data for the MMC controller |
| 23 | */ | 60 | */ |
| 24 | struct tmio_mmc_data { | 61 | struct tmio_mmc_data { |
| 25 | const unsigned int hclk; | 62 | unsigned int hclk; |
| 63 | unsigned long capabilities; | ||
| 64 | void (*set_pwr)(struct platform_device *host, int state); | ||
| 65 | void (*set_clk_div)(struct platform_device *host, int state); | ||
| 26 | }; | 66 | }; |
| 27 | 67 | ||
| 28 | /* | 68 | /* |
diff --git a/include/linux/mfd/twl4030-codec.h b/include/linux/mfd/twl4030-codec.h new file mode 100644 index 000000000000..2ec317c68e59 --- /dev/null +++ b/include/linux/mfd/twl4030-codec.h | |||
| @@ -0,0 +1,272 @@ | |||
| 1 | /* | ||
| 2 | * MFD driver for twl4030 codec submodule | ||
| 3 | * | ||
| 4 | * Author: Peter Ujfalusi <peter.ujfalusi@nokia.com> | ||
| 5 | * | ||
| 6 | * Copyright: (C) 2009 Nokia Corporation | ||
| 7 | * | ||
| 8 | * This program is free software; you can redistribute it and/or modify | ||
| 9 | * it under the terms of the GNU General Public License version 2 as | ||
| 10 | * published by the Free Software Foundation. | ||
| 11 | * | ||
| 12 | * 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 __TWL4030_CODEC_H__ | ||
| 25 | #define __TWL4030_CODEC_H__ | ||
| 26 | |||
| 27 | /* Codec registers */ | ||
| 28 | #define TWL4030_REG_CODEC_MODE 0x01 | ||
| 29 | #define TWL4030_REG_OPTION 0x02 | ||
| 30 | #define TWL4030_REG_UNKNOWN 0x03 | ||
| 31 | #define TWL4030_REG_MICBIAS_CTL 0x04 | ||
| 32 | #define TWL4030_REG_ANAMICL 0x05 | ||
| 33 | #define TWL4030_REG_ANAMICR 0x06 | ||
| 34 | #define TWL4030_REG_AVADC_CTL 0x07 | ||
| 35 | #define TWL4030_REG_ADCMICSEL 0x08 | ||
| 36 | #define TWL4030_REG_DIGMIXING 0x09 | ||
| 37 | #define TWL4030_REG_ATXL1PGA 0x0A | ||
| 38 | #define TWL4030_REG_ATXR1PGA 0x0B | ||
| 39 | #define TWL4030_REG_AVTXL2PGA 0x0C | ||
| 40 | #define TWL4030_REG_AVTXR2PGA 0x0D | ||
| 41 | #define TWL4030_REG_AUDIO_IF 0x0E | ||
| 42 | #define TWL4030_REG_VOICE_IF 0x0F | ||
| 43 | #define TWL4030_REG_ARXR1PGA 0x10 | ||
| 44 | #define TWL4030_REG_ARXL1PGA 0x11 | ||
| 45 | #define TWL4030_REG_ARXR2PGA 0x12 | ||
| 46 | #define TWL4030_REG_ARXL2PGA 0x13 | ||
| 47 | #define TWL4030_REG_VRXPGA 0x14 | ||
| 48 | #define TWL4030_REG_VSTPGA 0x15 | ||
| 49 | #define TWL4030_REG_VRX2ARXPGA 0x16 | ||
| 50 | #define TWL4030_REG_AVDAC_CTL 0x17 | ||
| 51 | #define TWL4030_REG_ARX2VTXPGA 0x18 | ||
| 52 | #define TWL4030_REG_ARXL1_APGA_CTL 0x19 | ||
| 53 | #define TWL4030_REG_ARXR1_APGA_CTL 0x1A | ||
| 54 | #define TWL4030_REG_ARXL2_APGA_CTL 0x1B | ||
| 55 | #define TWL4030_REG_ARXR2_APGA_CTL 0x1C | ||
| 56 | #define TWL4030_REG_ATX2ARXPGA 0x1D | ||
| 57 | #define TWL4030_REG_BT_IF 0x1E | ||
| 58 | #define TWL4030_REG_BTPGA 0x1F | ||
| 59 | #define TWL4030_REG_BTSTPGA 0x20 | ||
| 60 | #define TWL4030_REG_EAR_CTL 0x21 | ||
| 61 | #define TWL4030_REG_HS_SEL 0x22 | ||
| 62 | #define TWL4030_REG_HS_GAIN_SET 0x23 | ||
| 63 | #define TWL4030_REG_HS_POPN_SET 0x24 | ||
| 64 | #define TWL4030_REG_PREDL_CTL 0x25 | ||
| 65 | #define TWL4030_REG_PREDR_CTL 0x26 | ||
| 66 | #define TWL4030_REG_PRECKL_CTL 0x27 | ||
| 67 | #define TWL4030_REG_PRECKR_CTL 0x28 | ||
| 68 | #define TWL4030_REG_HFL_CTL 0x29 | ||
| 69 | #define TWL4030_REG_HFR_CTL 0x2A | ||
| 70 | #define TWL4030_REG_ALC_CTL 0x2B | ||
| 71 | #define TWL4030_REG_ALC_SET1 0x2C | ||
| 72 | #define TWL4030_REG_ALC_SET2 0x2D | ||
| 73 | #define TWL4030_REG_BOOST_CTL 0x2E | ||
| 74 | #define TWL4030_REG_SOFTVOL_CTL 0x2F | ||
| 75 | #define TWL4030_REG_DTMF_FREQSEL 0x30 | ||
| 76 | #define TWL4030_REG_DTMF_TONEXT1H 0x31 | ||
| 77 | #define TWL4030_REG_DTMF_TONEXT1L 0x32 | ||
| 78 | #define TWL4030_REG_DTMF_TONEXT2H 0x33 | ||
| 79 | #define TWL4030_REG_DTMF_TONEXT2L 0x34 | ||
| 80 | #define TWL4030_REG_DTMF_TONOFF 0x35 | ||
| 81 | #define TWL4030_REG_DTMF_WANONOFF 0x36 | ||
| 82 | #define TWL4030_REG_I2S_RX_SCRAMBLE_H 0x37 | ||
| 83 | #define TWL4030_REG_I2S_RX_SCRAMBLE_M 0x38 | ||
| 84 | #define TWL4030_REG_I2S_RX_SCRAMBLE_L 0x39 | ||
| 85 | #define TWL4030_REG_APLL_CTL 0x3A | ||
| 86 | #define TWL4030_REG_DTMF_CTL 0x3B | ||
| 87 | #define TWL4030_REG_DTMF_PGA_CTL2 0x3C | ||
| 88 | #define TWL4030_REG_DTMF_PGA_CTL1 0x3D | ||
| 89 | #define TWL4030_REG_MISC_SET_1 0x3E | ||
| 90 | #define TWL4030_REG_PCMBTMUX 0x3F | ||
| 91 | #define TWL4030_REG_RX_PATH_SEL 0x43 | ||
| 92 | #define TWL4030_REG_VDL_APGA_CTL 0x44 | ||
| 93 | #define TWL4030_REG_VIBRA_CTL 0x45 | ||
| 94 | #define TWL4030_REG_VIBRA_SET 0x46 | ||
| 95 | #define TWL4030_REG_VIBRA_PWM_SET 0x47 | ||
| 96 | #define TWL4030_REG_ANAMIC_GAIN 0x48 | ||
| 97 | #define TWL4030_REG_MISC_SET_2 0x49 | ||
| 98 | |||
| 99 | /* Bitfield Definitions */ | ||
| 100 | |||
| 101 | /* TWL4030_CODEC_MODE (0x01) Fields */ | ||
| 102 | #define TWL4030_APLL_RATE 0xF0 | ||
| 103 | #define TWL4030_APLL_RATE_8000 0x00 | ||
| 104 | #define TWL4030_APLL_RATE_11025 0x10 | ||
| 105 | #define TWL4030_APLL_RATE_12000 0x20 | ||
| 106 | #define TWL4030_APLL_RATE_16000 0x40 | ||
| 107 | #define TWL4030_APLL_RATE_22050 0x50 | ||
| 108 | #define TWL4030_APLL_RATE_24000 0x60 | ||
| 109 | #define TWL4030_APLL_RATE_32000 0x80 | ||
| 110 | #define TWL4030_APLL_RATE_44100 0x90 | ||
| 111 | #define TWL4030_APLL_RATE_48000 0xA0 | ||
| 112 | #define TWL4030_APLL_RATE_96000 0xE0 | ||
| 113 | #define TWL4030_SEL_16K 0x08 | ||
| 114 | #define TWL4030_CODECPDZ 0x02 | ||
| 115 | #define TWL4030_OPT_MODE 0x01 | ||
| 116 | #define TWL4030_OPTION_1 (1 << 0) | ||
| 117 | #define TWL4030_OPTION_2 (0 << 0) | ||
| 118 | |||
| 119 | /* TWL4030_OPTION (0x02) Fields */ | ||
| 120 | #define TWL4030_ATXL1_EN (1 << 0) | ||
| 121 | #define TWL4030_ATXR1_EN (1 << 1) | ||
| 122 | #define TWL4030_ATXL2_VTXL_EN (1 << 2) | ||
| 123 | #define TWL4030_ATXR2_VTXR_EN (1 << 3) | ||
| 124 | #define TWL4030_ARXL1_VRX_EN (1 << 4) | ||
| 125 | #define TWL4030_ARXR1_EN (1 << 5) | ||
| 126 | #define TWL4030_ARXL2_EN (1 << 6) | ||
| 127 | #define TWL4030_ARXR2_EN (1 << 7) | ||
| 128 | |||
| 129 | /* TWL4030_REG_MICBIAS_CTL (0x04) Fields */ | ||
| 130 | #define TWL4030_MICBIAS2_CTL 0x40 | ||
| 131 | #define TWL4030_MICBIAS1_CTL 0x20 | ||
| 132 | #define TWL4030_HSMICBIAS_EN 0x04 | ||
| 133 | #define TWL4030_MICBIAS2_EN 0x02 | ||
| 134 | #define TWL4030_MICBIAS1_EN 0x01 | ||
| 135 | |||
| 136 | /* ANAMICL (0x05) Fields */ | ||
| 137 | #define TWL4030_CNCL_OFFSET_START 0x80 | ||
| 138 | #define TWL4030_OFFSET_CNCL_SEL 0x60 | ||
| 139 | #define TWL4030_OFFSET_CNCL_SEL_ARX1 0x00 | ||
| 140 | #define TWL4030_OFFSET_CNCL_SEL_ARX2 0x20 | ||
| 141 | #define TWL4030_OFFSET_CNCL_SEL_VRX 0x40 | ||
| 142 | #define TWL4030_OFFSET_CNCL_SEL_ALL 0x60 | ||
| 143 | #define TWL4030_MICAMPL_EN 0x10 | ||
| 144 | #define TWL4030_CKMIC_EN 0x08 | ||
| 145 | #define TWL4030_AUXL_EN 0x04 | ||
| 146 | #define TWL4030_HSMIC_EN 0x02 | ||
| 147 | #define TWL4030_MAINMIC_EN 0x01 | ||
| 148 | |||
| 149 | /* ANAMICR (0x06) Fields */ | ||
| 150 | #define TWL4030_MICAMPR_EN 0x10 | ||
| 151 | #define TWL4030_AUXR_EN 0x04 | ||
| 152 | #define TWL4030_SUBMIC_EN 0x01 | ||
| 153 | |||
| 154 | /* AVADC_CTL (0x07) Fields */ | ||
| 155 | #define TWL4030_ADCL_EN 0x08 | ||
| 156 | #define TWL4030_AVADC_CLK_PRIORITY 0x04 | ||
| 157 | #define TWL4030_ADCR_EN 0x02 | ||
| 158 | |||
| 159 | /* TWL4030_REG_ADCMICSEL (0x08) Fields */ | ||
| 160 | #define TWL4030_DIGMIC1_EN 0x08 | ||
| 161 | #define TWL4030_TX2IN_SEL 0x04 | ||
| 162 | #define TWL4030_DIGMIC0_EN 0x02 | ||
| 163 | #define TWL4030_TX1IN_SEL 0x01 | ||
| 164 | |||
| 165 | /* AUDIO_IF (0x0E) Fields */ | ||
| 166 | #define TWL4030_AIF_SLAVE_EN 0x80 | ||
| 167 | #define TWL4030_DATA_WIDTH 0x60 | ||
| 168 | #define TWL4030_DATA_WIDTH_16S_16W 0x00 | ||
| 169 | #define TWL4030_DATA_WIDTH_32S_16W 0x40 | ||
| 170 | #define TWL4030_DATA_WIDTH_32S_24W 0x60 | ||
| 171 | #define TWL4030_AIF_FORMAT 0x18 | ||
| 172 | #define TWL4030_AIF_FORMAT_CODEC 0x00 | ||
| 173 | #define TWL4030_AIF_FORMAT_LEFT 0x08 | ||
| 174 | #define TWL4030_AIF_FORMAT_RIGHT 0x10 | ||
| 175 | #define TWL4030_AIF_FORMAT_TDM 0x18 | ||
| 176 | #define TWL4030_AIF_TRI_EN 0x04 | ||
| 177 | #define TWL4030_CLK256FS_EN 0x02 | ||
| 178 | #define TWL4030_AIF_EN 0x01 | ||
| 179 | |||
| 180 | /* VOICE_IF (0x0F) Fields */ | ||
| 181 | #define TWL4030_VIF_SLAVE_EN 0x80 | ||
| 182 | #define TWL4030_VIF_DIN_EN 0x40 | ||
| 183 | #define TWL4030_VIF_DOUT_EN 0x20 | ||
| 184 | #define TWL4030_VIF_SWAP 0x10 | ||
| 185 | #define TWL4030_VIF_FORMAT 0x08 | ||
| 186 | #define TWL4030_VIF_TRI_EN 0x04 | ||
| 187 | #define TWL4030_VIF_SUB_EN 0x02 | ||
| 188 | #define TWL4030_VIF_EN 0x01 | ||
| 189 | |||
| 190 | /* EAR_CTL (0x21) */ | ||
| 191 | #define TWL4030_EAR_GAIN 0x30 | ||
| 192 | |||
| 193 | /* HS_GAIN_SET (0x23) Fields */ | ||
| 194 | #define TWL4030_HSR_GAIN 0x0C | ||
| 195 | #define TWL4030_HSR_GAIN_PWR_DOWN 0x00 | ||
| 196 | #define TWL4030_HSR_GAIN_PLUS_6DB 0x04 | ||
| 197 | #define TWL4030_HSR_GAIN_0DB 0x08 | ||
| 198 | #define TWL4030_HSR_GAIN_MINUS_6DB 0x0C | ||
| 199 | #define TWL4030_HSL_GAIN 0x03 | ||
| 200 | #define TWL4030_HSL_GAIN_PWR_DOWN 0x00 | ||
| 201 | #define TWL4030_HSL_GAIN_PLUS_6DB 0x01 | ||
| 202 | #define TWL4030_HSL_GAIN_0DB 0x02 | ||
| 203 | #define TWL4030_HSL_GAIN_MINUS_6DB 0x03 | ||
| 204 | |||
| 205 | /* HS_POPN_SET (0x24) Fields */ | ||
| 206 | #define TWL4030_VMID_EN 0x40 | ||
| 207 | #define TWL4030_EXTMUTE 0x20 | ||
| 208 | #define TWL4030_RAMP_DELAY 0x1C | ||
| 209 | #define TWL4030_RAMP_DELAY_20MS 0x00 | ||
| 210 | #define TWL4030_RAMP_DELAY_40MS 0x04 | ||
| 211 | #define TWL4030_RAMP_DELAY_81MS 0x08 | ||
| 212 | #define TWL4030_RAMP_DELAY_161MS 0x0C | ||
| 213 | #define TWL4030_RAMP_DELAY_323MS 0x10 | ||
| 214 | #define TWL4030_RAMP_DELAY_645MS 0x14 | ||
| 215 | #define TWL4030_RAMP_DELAY_1291MS 0x18 | ||
| 216 | #define TWL4030_RAMP_DELAY_2581MS 0x1C | ||
| 217 | #define TWL4030_RAMP_EN 0x02 | ||
| 218 | |||
| 219 | /* PREDL_CTL (0x25) */ | ||
| 220 | #define TWL4030_PREDL_GAIN 0x30 | ||
| 221 | |||
| 222 | /* PREDR_CTL (0x26) */ | ||
| 223 | #define TWL4030_PREDR_GAIN 0x30 | ||
| 224 | |||
| 225 | /* PRECKL_CTL (0x27) */ | ||
| 226 | #define TWL4030_PRECKL_GAIN 0x30 | ||
| 227 | |||
| 228 | /* PRECKR_CTL (0x28) */ | ||
| 229 | #define TWL4030_PRECKR_GAIN 0x30 | ||
| 230 | |||
| 231 | /* HFL_CTL (0x29, 0x2A) Fields */ | ||
| 232 | #define TWL4030_HF_CTL_HB_EN 0x04 | ||
| 233 | #define TWL4030_HF_CTL_LOOP_EN 0x08 | ||
| 234 | #define TWL4030_HF_CTL_RAMP_EN 0x10 | ||
| 235 | #define TWL4030_HF_CTL_REF_EN 0x20 | ||
| 236 | |||
| 237 | /* APLL_CTL (0x3A) Fields */ | ||
| 238 | #define TWL4030_APLL_EN 0x10 | ||
| 239 | #define TWL4030_APLL_INFREQ 0x0F | ||
| 240 | #define TWL4030_APLL_INFREQ_19200KHZ 0x05 | ||
| 241 | #define TWL4030_APLL_INFREQ_26000KHZ 0x06 | ||
| 242 | #define TWL4030_APLL_INFREQ_38400KHZ 0x0F | ||
| 243 | |||
| 244 | /* REG_MISC_SET_1 (0x3E) Fields */ | ||
| 245 | #define TWL4030_CLK64_EN 0x80 | ||
| 246 | #define TWL4030_SCRAMBLE_EN 0x40 | ||
| 247 | #define TWL4030_FMLOOP_EN 0x20 | ||
| 248 | #define TWL4030_SMOOTH_ANAVOL_EN 0x02 | ||
| 249 | #define TWL4030_DIGMIC_LR_SWAP_EN 0x01 | ||
| 250 | |||
| 251 | /* VIBRA_CTL (0x45) */ | ||
| 252 | #define TWL4030_VIBRA_EN 0x01 | ||
| 253 | #define TWL4030_VIBRA_DIR 0x02 | ||
| 254 | #define TWL4030_VIBRA_AUDIO_SEL_L1 (0x00 << 2) | ||
| 255 | #define TWL4030_VIBRA_AUDIO_SEL_R1 (0x01 << 2) | ||
| 256 | #define TWL4030_VIBRA_AUDIO_SEL_L2 (0x02 << 2) | ||
| 257 | #define TWL4030_VIBRA_AUDIO_SEL_R2 (0x03 << 2) | ||
| 258 | #define TWL4030_VIBRA_SEL 0x10 | ||
| 259 | #define TWL4030_VIBRA_DIR_SEL 0x20 | ||
| 260 | |||
| 261 | /* TWL4030 codec resource IDs */ | ||
| 262 | enum twl4030_codec_res { | ||
| 263 | TWL4030_CODEC_RES_POWER = 0, | ||
| 264 | TWL4030_CODEC_RES_APLL, | ||
| 265 | TWL4030_CODEC_RES_MAX, | ||
| 266 | }; | ||
| 267 | |||
| 268 | int twl4030_codec_disable_resource(enum twl4030_codec_res id); | ||
| 269 | int twl4030_codec_enable_resource(enum twl4030_codec_res id); | ||
| 270 | unsigned int twl4030_codec_get_mclk(void); | ||
| 271 | |||
| 272 | #endif /* End of __TWL4030_CODEC_H__ */ | ||
diff --git a/include/linux/mfd/ucb1x00.h b/include/linux/mfd/ucb1x00.h new file mode 100644 index 000000000000..4321f044d1e4 --- /dev/null +++ b/include/linux/mfd/ucb1x00.h | |||
| @@ -0,0 +1,259 @@ | |||
| 1 | /* | ||
| 2 | * linux/include/mfd/ucb1x00.h | ||
| 3 | * | ||
| 4 | * Copyright (C) 2001 Russell King, All Rights Reserved. | ||
| 5 | * | ||
| 6 | * This program is free software; you can redistribute it and/or modify | ||
| 7 | * it under the terms of the GNU General Public License as published by | ||
| 8 | * the Free Software Foundation; either version 2 of the License. | ||
| 9 | */ | ||
| 10 | #ifndef UCB1200_H | ||
| 11 | #define UCB1200_H | ||
| 12 | |||
| 13 | #include <linux/mfd/mcp.h> | ||
| 14 | #include <linux/gpio.h> | ||
| 15 | #include <linux/semaphore.h> | ||
| 16 | |||
| 17 | #define UCB_IO_DATA 0x00 | ||
| 18 | #define UCB_IO_DIR 0x01 | ||
| 19 | |||
| 20 | #define UCB_IO_0 (1 << 0) | ||
| 21 | #define UCB_IO_1 (1 << 1) | ||
| 22 | #define UCB_IO_2 (1 << 2) | ||
| 23 | #define UCB_IO_3 (1 << 3) | ||
| 24 | #define UCB_IO_4 (1 << 4) | ||
| 25 | #define UCB_IO_5 (1 << 5) | ||
| 26 | #define UCB_IO_6 (1 << 6) | ||
| 27 | #define UCB_IO_7 (1 << 7) | ||
| 28 | #define UCB_IO_8 (1 << 8) | ||
| 29 | #define UCB_IO_9 (1 << 9) | ||
| 30 | |||
| 31 | #define UCB_IE_RIS 0x02 | ||
| 32 | #define UCB_IE_FAL 0x03 | ||
| 33 | #define UCB_IE_STATUS 0x04 | ||
| 34 | #define UCB_IE_CLEAR 0x04 | ||
| 35 | #define UCB_IE_ADC (1 << 11) | ||
| 36 | #define UCB_IE_TSPX (1 << 12) | ||
| 37 | #define UCB_IE_TSMX (1 << 13) | ||
| 38 | #define UCB_IE_TCLIP (1 << 14) | ||
| 39 | #define UCB_IE_ACLIP (1 << 15) | ||
| 40 | |||
| 41 | #define UCB_IRQ_TSPX 12 | ||
| 42 | |||
| 43 | #define UCB_TC_A 0x05 | ||
| 44 | #define UCB_TC_A_LOOP (1 << 7) /* UCB1200 */ | ||
| 45 | #define UCB_TC_A_AMPL (1 << 7) /* UCB1300 */ | ||
| 46 | |||
| 47 | #define UCB_TC_B 0x06 | ||
| 48 | #define UCB_TC_B_VOICE_ENA (1 << 3) | ||
| 49 | #define UCB_TC_B_CLIP (1 << 4) | ||
| 50 | #define UCB_TC_B_ATT (1 << 6) | ||
| 51 | #define UCB_TC_B_SIDE_ENA (1 << 11) | ||
| 52 | #define UCB_TC_B_MUTE (1 << 13) | ||
| 53 | #define UCB_TC_B_IN_ENA (1 << 14) | ||
| 54 | #define UCB_TC_B_OUT_ENA (1 << 15) | ||
| 55 | |||
| 56 | #define UCB_AC_A 0x07 | ||
| 57 | #define UCB_AC_B 0x08 | ||
| 58 | #define UCB_AC_B_LOOP (1 << 8) | ||
| 59 | #define UCB_AC_B_MUTE (1 << 13) | ||
| 60 | #define UCB_AC_B_IN_ENA (1 << 14) | ||
| 61 | #define UCB_AC_B_OUT_ENA (1 << 15) | ||
| 62 | |||
| 63 | #define UCB_TS_CR 0x09 | ||
| 64 | #define UCB_TS_CR_TSMX_POW (1 << 0) | ||
| 65 | #define UCB_TS_CR_TSPX_POW (1 << 1) | ||
| 66 | #define UCB_TS_CR_TSMY_POW (1 << 2) | ||
| 67 | #define UCB_TS_CR_TSPY_POW (1 << 3) | ||
| 68 | #define UCB_TS_CR_TSMX_GND (1 << 4) | ||
| 69 | #define UCB_TS_CR_TSPX_GND (1 << 5) | ||
| 70 | #define UCB_TS_CR_TSMY_GND (1 << 6) | ||
| 71 | #define UCB_TS_CR_TSPY_GND (1 << 7) | ||
| 72 | #define UCB_TS_CR_MODE_INT (0 << 8) | ||
| 73 | #define UCB_TS_CR_MODE_PRES (1 << 8) | ||
| 74 | #define UCB_TS_CR_MODE_POS (2 << 8) | ||
| 75 | #define UCB_TS_CR_BIAS_ENA (1 << 11) | ||
| 76 | #define UCB_TS_CR_TSPX_LOW (1 << 12) | ||
| 77 | #define UCB_TS_CR_TSMX_LOW (1 << 13) | ||
| 78 | |||
| 79 | #define UCB_ADC_CR 0x0a | ||
| 80 | #define UCB_ADC_SYNC_ENA (1 << 0) | ||
| 81 | #define UCB_ADC_VREFBYP_CON (1 << 1) | ||
| 82 | #define UCB_ADC_INP_TSPX (0 << 2) | ||
| 83 | #define UCB_ADC_INP_TSMX (1 << 2) | ||
| 84 | #define UCB_ADC_INP_TSPY (2 << 2) | ||
| 85 | #define UCB_ADC_INP_TSMY (3 << 2) | ||
| 86 | #define UCB_ADC_INP_AD0 (4 << 2) | ||
| 87 | #define UCB_ADC_INP_AD1 (5 << 2) | ||
| 88 | #define UCB_ADC_INP_AD2 (6 << 2) | ||
| 89 | #define UCB_ADC_INP_AD3 (7 << 2) | ||
| 90 | #define UCB_ADC_EXT_REF (1 << 5) | ||
| 91 | #define UCB_ADC_START (1 << 7) | ||
| 92 | #define UCB_ADC_ENA (1 << 15) | ||
| 93 | |||
| 94 | #define UCB_ADC_DATA 0x0b | ||
| 95 | #define UCB_ADC_DAT_VAL (1 << 15) | ||
| 96 | #define UCB_ADC_DAT(x) (((x) & 0x7fe0) >> 5) | ||
| 97 | |||
| 98 | #define UCB_ID 0x0c | ||
| 99 | #define UCB_ID_1200 0x1004 | ||
| 100 | #define UCB_ID_1300 0x1005 | ||
| 101 | #define UCB_ID_TC35143 0x9712 | ||
| 102 | |||
| 103 | #define UCB_MODE 0x0d | ||
| 104 | #define UCB_MODE_DYN_VFLAG_ENA (1 << 12) | ||
| 105 | #define UCB_MODE_AUD_OFF_CAN (1 << 13) | ||
| 106 | |||
| 107 | |||
| 108 | struct ucb1x00_irq { | ||
| 109 | void *devid; | ||
| 110 | void (*fn)(int, void *); | ||
| 111 | }; | ||
| 112 | |||
| 113 | struct ucb1x00 { | ||
| 114 | spinlock_t lock; | ||
| 115 | struct mcp *mcp; | ||
| 116 | unsigned int irq; | ||
| 117 | struct semaphore adc_sem; | ||
| 118 | spinlock_t io_lock; | ||
| 119 | u16 id; | ||
| 120 | u16 io_dir; | ||
| 121 | u16 io_out; | ||
| 122 | u16 adc_cr; | ||
| 123 | u16 irq_fal_enbl; | ||
| 124 | u16 irq_ris_enbl; | ||
| 125 | struct ucb1x00_irq irq_handler[16]; | ||
| 126 | struct device dev; | ||
| 127 | struct list_head node; | ||
| 128 | struct list_head devs; | ||
| 129 | struct gpio_chip gpio; | ||
| 130 | }; | ||
| 131 | |||
| 132 | struct ucb1x00_driver; | ||
| 133 | |||
| 134 | struct ucb1x00_dev { | ||
| 135 | struct list_head dev_node; | ||
| 136 | struct list_head drv_node; | ||
| 137 | struct ucb1x00 *ucb; | ||
| 138 | struct ucb1x00_driver *drv; | ||
| 139 | void *priv; | ||
| 140 | }; | ||
| 141 | |||
| 142 | struct ucb1x00_driver { | ||
| 143 | struct list_head node; | ||
| 144 | struct list_head devs; | ||
| 145 | int (*add)(struct ucb1x00_dev *dev); | ||
| 146 | void (*remove)(struct ucb1x00_dev *dev); | ||
| 147 | int (*suspend)(struct ucb1x00_dev *dev, pm_message_t state); | ||
| 148 | int (*resume)(struct ucb1x00_dev *dev); | ||
| 149 | }; | ||
| 150 | |||
| 151 | #define classdev_to_ucb1x00(cd) container_of(cd, struct ucb1x00, dev) | ||
| 152 | |||
| 153 | int ucb1x00_register_driver(struct ucb1x00_driver *); | ||
| 154 | void ucb1x00_unregister_driver(struct ucb1x00_driver *); | ||
| 155 | |||
| 156 | /** | ||
| 157 | * ucb1x00_clkrate - return the UCB1x00 SIB clock rate | ||
| 158 | * @ucb: UCB1x00 structure describing chip | ||
| 159 | * | ||
| 160 | * Return the SIB clock rate in Hz. | ||
| 161 | */ | ||
| 162 | static inline unsigned int ucb1x00_clkrate(struct ucb1x00 *ucb) | ||
| 163 | { | ||
| 164 | return mcp_get_sclk_rate(ucb->mcp); | ||
| 165 | } | ||
| 166 | |||
| 167 | /** | ||
| 168 | * ucb1x00_enable - enable the UCB1x00 SIB clock | ||
| 169 | * @ucb: UCB1x00 structure describing chip | ||
| 170 | * | ||
| 171 | * Enable the SIB clock. This can be called multiple times. | ||
| 172 | */ | ||
| 173 | static inline void ucb1x00_enable(struct ucb1x00 *ucb) | ||
| 174 | { | ||
| 175 | mcp_enable(ucb->mcp); | ||
| 176 | } | ||
| 177 | |||
| 178 | /** | ||
| 179 | * ucb1x00_disable - disable the UCB1x00 SIB clock | ||
| 180 | * @ucb: UCB1x00 structure describing chip | ||
| 181 | * | ||
| 182 | * Disable the SIB clock. The SIB clock will only be disabled | ||
| 183 | * when the number of ucb1x00_enable calls match the number of | ||
| 184 | * ucb1x00_disable calls. | ||
| 185 | */ | ||
| 186 | static inline void ucb1x00_disable(struct ucb1x00 *ucb) | ||
| 187 | { | ||
| 188 | mcp_disable(ucb->mcp); | ||
| 189 | } | ||
| 190 | |||
| 191 | /** | ||
| 192 | * ucb1x00_reg_write - write a UCB1x00 register | ||
| 193 | * @ucb: UCB1x00 structure describing chip | ||
| 194 | * @reg: UCB1x00 4-bit register index to write | ||
| 195 | * @val: UCB1x00 16-bit value to write | ||
| 196 | * | ||
| 197 | * Write the UCB1x00 register @reg with value @val. The SIB | ||
| 198 | * clock must be running for this function to return. | ||
| 199 | */ | ||
| 200 | static inline void ucb1x00_reg_write(struct ucb1x00 *ucb, unsigned int reg, unsigned int val) | ||
| 201 | { | ||
| 202 | mcp_reg_write(ucb->mcp, reg, val); | ||
| 203 | } | ||
| 204 | |||
| 205 | /** | ||
| 206 | * ucb1x00_reg_read - read a UCB1x00 register | ||
| 207 | * @ucb: UCB1x00 structure describing chip | ||
| 208 | * @reg: UCB1x00 4-bit register index to write | ||
| 209 | * | ||
| 210 | * Read the UCB1x00 register @reg and return its value. The SIB | ||
| 211 | * clock must be running for this function to return. | ||
| 212 | */ | ||
| 213 | static inline unsigned int ucb1x00_reg_read(struct ucb1x00 *ucb, unsigned int reg) | ||
| 214 | { | ||
| 215 | return mcp_reg_read(ucb->mcp, reg); | ||
| 216 | } | ||
| 217 | /** | ||
| 218 | * ucb1x00_set_audio_divisor - | ||
| 219 | * @ucb: UCB1x00 structure describing chip | ||
| 220 | * @div: SIB clock divisor | ||
| 221 | */ | ||
| 222 | static inline void ucb1x00_set_audio_divisor(struct ucb1x00 *ucb, unsigned int div) | ||
| 223 | { | ||
| 224 | mcp_set_audio_divisor(ucb->mcp, div); | ||
| 225 | } | ||
| 226 | |||
| 227 | /** | ||
| 228 | * ucb1x00_set_telecom_divisor - | ||
| 229 | * @ucb: UCB1x00 structure describing chip | ||
| 230 | * @div: SIB clock divisor | ||
| 231 | */ | ||
| 232 | static inline void ucb1x00_set_telecom_divisor(struct ucb1x00 *ucb, unsigned int div) | ||
| 233 | { | ||
| 234 | mcp_set_telecom_divisor(ucb->mcp, div); | ||
| 235 | } | ||
| 236 | |||
| 237 | void ucb1x00_io_set_dir(struct ucb1x00 *ucb, unsigned int, unsigned int); | ||
| 238 | void ucb1x00_io_write(struct ucb1x00 *ucb, unsigned int, unsigned int); | ||
| 239 | unsigned int ucb1x00_io_read(struct ucb1x00 *ucb); | ||
| 240 | |||
| 241 | #define UCB_NOSYNC (0) | ||
| 242 | #define UCB_SYNC (1) | ||
| 243 | |||
| 244 | unsigned int ucb1x00_adc_read(struct ucb1x00 *ucb, int adc_channel, int sync); | ||
| 245 | void ucb1x00_adc_enable(struct ucb1x00 *ucb); | ||
| 246 | void ucb1x00_adc_disable(struct ucb1x00 *ucb); | ||
| 247 | |||
| 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 | ||
diff --git a/include/linux/mfd/wm831x/core.h b/include/linux/mfd/wm831x/core.h index 91eb493bf14c..5915f6e3d9ab 100644 --- a/include/linux/mfd/wm831x/core.h +++ b/include/linux/mfd/wm831x/core.h | |||
| @@ -15,8 +15,8 @@ | |||
| 15 | #ifndef __MFD_WM831X_CORE_H__ | 15 | #ifndef __MFD_WM831X_CORE_H__ |
| 16 | #define __MFD_WM831X_CORE_H__ | 16 | #define __MFD_WM831X_CORE_H__ |
| 17 | 17 | ||
| 18 | #include <linux/completion.h> | ||
| 18 | #include <linux/interrupt.h> | 19 | #include <linux/interrupt.h> |
| 19 | #include <linux/workqueue.h> | ||
| 20 | 20 | ||
| 21 | /* | 21 | /* |
| 22 | * Register values. | 22 | * Register values. |
| @@ -117,6 +117,7 @@ | |||
| 117 | #define WM831X_DC3_SLEEP_CONTROL 0x4063 | 117 | #define WM831X_DC3_SLEEP_CONTROL 0x4063 |
| 118 | #define WM831X_DC4_CONTROL 0x4064 | 118 | #define WM831X_DC4_CONTROL 0x4064 |
| 119 | #define WM831X_DC4_SLEEP_CONTROL 0x4065 | 119 | #define WM831X_DC4_SLEEP_CONTROL 0x4065 |
| 120 | #define WM832X_DC4_SLEEP_CONTROL 0x4067 | ||
| 120 | #define WM831X_EPE1_CONTROL 0x4066 | 121 | #define WM831X_EPE1_CONTROL 0x4066 |
| 121 | #define WM831X_EPE2_CONTROL 0x4067 | 122 | #define WM831X_EPE2_CONTROL 0x4067 |
| 122 | #define WM831X_LDO1_CONTROL 0x4068 | 123 | #define WM831X_LDO1_CONTROL 0x4068 |
| @@ -235,6 +236,8 @@ | |||
| 235 | 236 | ||
| 236 | struct regulator_dev; | 237 | struct regulator_dev; |
| 237 | 238 | ||
| 239 | #define WM831X_NUM_IRQ_REGS 5 | ||
| 240 | |||
| 238 | struct wm831x { | 241 | struct wm831x { |
| 239 | struct mutex io_lock; | 242 | struct mutex io_lock; |
| 240 | 243 | ||
| @@ -248,12 +251,18 @@ struct wm831x { | |||
| 248 | 251 | ||
| 249 | int irq; /* Our chip IRQ */ | 252 | int irq; /* Our chip IRQ */ |
| 250 | struct mutex irq_lock; | 253 | struct mutex irq_lock; |
| 251 | struct workqueue_struct *irq_wq; | ||
| 252 | struct work_struct irq_work; | ||
| 253 | unsigned int irq_base; | 254 | unsigned int irq_base; |
| 254 | int irq_masks[5]; | 255 | int irq_masks_cur[WM831X_NUM_IRQ_REGS]; /* Currently active value */ |
| 256 | int irq_masks_cache[WM831X_NUM_IRQ_REGS]; /* Cached hardware value */ | ||
| 257 | |||
| 258 | /* Chip revision based flags */ | ||
| 259 | unsigned has_gpio_ena:1; /* Has GPIO enable bit */ | ||
| 260 | unsigned has_cs_sts:1; /* Has current sink status bit */ | ||
| 261 | |||
| 262 | int num_gpio; | ||
| 255 | 263 | ||
| 256 | struct mutex auxadc_lock; | 264 | struct mutex auxadc_lock; |
| 265 | struct completion auxadc_done; | ||
| 257 | 266 | ||
| 258 | /* The WM831x has a security key blocking access to certain | 267 | /* The WM831x has a security key blocking access to certain |
| 259 | * registers. The mutex is taken by the accessors for locking | 268 | * registers. The mutex is taken by the accessors for locking |
| @@ -278,12 +287,30 @@ int wm831x_bulk_read(struct wm831x *wm831x, unsigned short reg, | |||
| 278 | int wm831x_irq_init(struct wm831x *wm831x, int irq); | 287 | int wm831x_irq_init(struct wm831x *wm831x, int irq); |
| 279 | void wm831x_irq_exit(struct wm831x *wm831x); | 288 | void wm831x_irq_exit(struct wm831x *wm831x); |
| 280 | 289 | ||
| 281 | int __must_check wm831x_request_irq(struct wm831x *wm831x, | 290 | static inline int __must_check wm831x_request_irq(struct wm831x *wm831x, |
| 282 | unsigned int irq, irq_handler_t handler, | 291 | unsigned int irq, |
| 283 | unsigned long flags, const char *name, | 292 | irq_handler_t handler, |
| 284 | void *dev); | 293 | unsigned long flags, |
| 285 | void wm831x_free_irq(struct wm831x *wm831x, unsigned int, void *); | 294 | const char *name, |
| 286 | void wm831x_disable_irq(struct wm831x *wm831x, int irq); | 295 | void *dev) |
| 287 | void wm831x_enable_irq(struct wm831x *wm831x, int irq); | 296 | { |
| 297 | return request_threaded_irq(irq, NULL, handler, flags, name, dev); | ||
| 298 | } | ||
| 299 | |||
| 300 | static inline void wm831x_free_irq(struct wm831x *wm831x, | ||
| 301 | unsigned int irq, void *dev) | ||
| 302 | { | ||
| 303 | free_irq(irq, dev); | ||
| 304 | } | ||
| 305 | |||
| 306 | static inline void wm831x_disable_irq(struct wm831x *wm831x, int irq) | ||
| 307 | { | ||
| 308 | disable_irq(irq); | ||
| 309 | } | ||
| 310 | |||
| 311 | static inline void wm831x_enable_irq(struct wm831x *wm831x, int irq) | ||
| 312 | { | ||
| 313 | enable_irq(irq); | ||
| 314 | } | ||
| 288 | 315 | ||
| 289 | #endif | 316 | #endif |
diff --git a/include/linux/mfd/wm831x/gpio.h b/include/linux/mfd/wm831x/gpio.h index 2835614af0e3..9b163c58865f 100644 --- a/include/linux/mfd/wm831x/gpio.h +++ b/include/linux/mfd/wm831x/gpio.h | |||
| @@ -41,6 +41,10 @@ | |||
| 41 | #define WM831X_GPN_OD_MASK 0x0200 /* GPN_OD */ | 41 | #define WM831X_GPN_OD_MASK 0x0200 /* GPN_OD */ |
| 42 | #define WM831X_GPN_OD_SHIFT 9 /* GPN_OD */ | 42 | #define WM831X_GPN_OD_SHIFT 9 /* GPN_OD */ |
| 43 | #define WM831X_GPN_OD_WIDTH 1 /* GPN_OD */ | 43 | #define WM831X_GPN_OD_WIDTH 1 /* GPN_OD */ |
| 44 | #define WM831X_GPN_ENA 0x0080 /* GPN_ENA */ | ||
| 45 | #define WM831X_GPN_ENA_MASK 0x0080 /* GPN_ENA */ | ||
| 46 | #define WM831X_GPN_ENA_SHIFT 7 /* GPN_ENA */ | ||
| 47 | #define WM831X_GPN_ENA_WIDTH 1 /* GPN_ENA */ | ||
| 44 | #define WM831X_GPN_TRI 0x0080 /* GPN_TRI */ | 48 | #define WM831X_GPN_TRI 0x0080 /* GPN_TRI */ |
| 45 | #define WM831X_GPN_TRI_MASK 0x0080 /* GPN_TRI */ | 49 | #define WM831X_GPN_TRI_MASK 0x0080 /* GPN_TRI */ |
| 46 | #define WM831X_GPN_TRI_SHIFT 7 /* GPN_TRI */ | 50 | #define WM831X_GPN_TRI_SHIFT 7 /* GPN_TRI */ |
diff --git a/include/linux/mfd/wm831x/pdata.h b/include/linux/mfd/wm831x/pdata.h index 90d820260aad..fd322aca33ba 100644 --- a/include/linux/mfd/wm831x/pdata.h +++ b/include/linux/mfd/wm831x/pdata.h | |||
| @@ -41,6 +41,23 @@ struct wm831x_battery_pdata { | |||
| 41 | int timeout; /** Charge cycle timeout, in minutes */ | 41 | int timeout; /** Charge cycle timeout, in minutes */ |
| 42 | }; | 42 | }; |
| 43 | 43 | ||
| 44 | /** | ||
| 45 | * Configuration for the WM831x DC-DC BuckWise convertors. This | ||
| 46 | * should be passed as driver_data in the regulator_init_data. | ||
| 47 | * | ||
| 48 | * Currently all the configuration is for the fast DVS switching | ||
| 49 | * support of the devices. This allows MFPs on the device to be | ||
| 50 | * configured as an input to switch between two output voltages, | ||
| 51 | * allowing voltage transitions without the expense of an access over | ||
| 52 | * I2C or SPI buses. | ||
| 53 | */ | ||
| 54 | struct wm831x_buckv_pdata { | ||
| 55 | int dvs_gpio; /** CPU GPIO to use for DVS switching */ | ||
| 56 | int dvs_control_src; /** Hardware DVS source to use (1 or 2) */ | ||
| 57 | int dvs_init_state; /** DVS state to expect on startup */ | ||
| 58 | int dvs_state_gpio; /** CPU GPIO to use for monitoring status */ | ||
| 59 | }; | ||
| 60 | |||
| 44 | /* Sources for status LED configuration. Values are register values | 61 | /* Sources for status LED configuration. Values are register values |
| 45 | * plus 1 to allow for a zero default for preserve. | 62 | * plus 1 to allow for a zero default for preserve. |
| 46 | */ | 63 | */ |
| @@ -91,6 +108,7 @@ struct wm831x_pdata { | |||
| 91 | /** Called after subdevices are set up */ | 108 | /** Called after subdevices are set up */ |
| 92 | int (*post_init)(struct wm831x *wm831x); | 109 | int (*post_init)(struct wm831x *wm831x); |
| 93 | 110 | ||
| 111 | int irq_base; | ||
| 94 | int gpio_base; | 112 | int gpio_base; |
| 95 | struct wm831x_backlight_pdata *backlight; | 113 | struct wm831x_backlight_pdata *backlight; |
| 96 | struct wm831x_backup_pdata *backup; | 114 | struct wm831x_backup_pdata *backup; |
diff --git a/include/linux/mfd/wm8350/core.h b/include/linux/mfd/wm8350/core.h index 1d595de6a055..98fcc977e82b 100644 --- a/include/linux/mfd/wm8350/core.h +++ b/include/linux/mfd/wm8350/core.h | |||
| @@ -15,7 +15,8 @@ | |||
| 15 | 15 | ||
| 16 | #include <linux/kernel.h> | 16 | #include <linux/kernel.h> |
| 17 | #include <linux/mutex.h> | 17 | #include <linux/mutex.h> |
| 18 | #include <linux/workqueue.h> | 18 | #include <linux/interrupt.h> |
| 19 | #include <linux/completion.h> | ||
| 19 | 20 | ||
| 20 | #include <linux/mfd/wm8350/audio.h> | 21 | #include <linux/mfd/wm8350/audio.h> |
| 21 | #include <linux/mfd/wm8350/gpio.h> | 22 | #include <linux/mfd/wm8350/gpio.h> |
| @@ -579,6 +580,8 @@ | |||
| 579 | 580 | ||
| 580 | #define WM8350_NUM_IRQ 63 | 581 | #define WM8350_NUM_IRQ 63 |
| 581 | 582 | ||
| 583 | #define WM8350_NUM_IRQ_REGS 7 | ||
| 584 | |||
| 582 | struct wm8350_reg_access { | 585 | struct wm8350_reg_access { |
| 583 | u16 readable; /* Mask of readable bits */ | 586 | u16 readable; /* Mask of readable bits */ |
| 584 | u16 writable; /* Mask of writable bits */ | 587 | u16 writable; /* Mask of writable bits */ |
| @@ -600,11 +603,6 @@ extern const u16 wm8352_mode3_defaults[]; | |||
| 600 | 603 | ||
| 601 | struct wm8350; | 604 | struct wm8350; |
| 602 | 605 | ||
| 603 | struct wm8350_irq { | ||
| 604 | void (*handler) (struct wm8350 *, int, void *); | ||
| 605 | void *data; | ||
| 606 | }; | ||
| 607 | |||
| 608 | struct wm8350_hwmon { | 606 | struct wm8350_hwmon { |
| 609 | struct platform_device *pdev; | 607 | struct platform_device *pdev; |
| 610 | struct device *classdev; | 608 | struct device *classdev; |
| @@ -624,11 +622,13 @@ struct wm8350 { | |||
| 624 | u16 *reg_cache; | 622 | u16 *reg_cache; |
| 625 | 623 | ||
| 626 | struct mutex auxadc_mutex; | 624 | struct mutex auxadc_mutex; |
| 625 | struct completion auxadc_done; | ||
| 627 | 626 | ||
| 628 | /* Interrupt handling */ | 627 | /* Interrupt handling */ |
| 629 | struct mutex irq_mutex; /* IRQ table mutex */ | 628 | struct mutex irq_lock; |
| 630 | struct wm8350_irq irq[WM8350_NUM_IRQ]; | ||
| 631 | int chip_irq; | 629 | int chip_irq; |
| 630 | int irq_base; | ||
| 631 | u16 irq_masks[WM8350_NUM_IRQ_REGS]; | ||
| 632 | 632 | ||
| 633 | /* Client devices */ | 633 | /* Client devices */ |
| 634 | struct wm8350_codec codec; | 634 | struct wm8350_codec codec; |
| @@ -646,10 +646,14 @@ struct wm8350 { | |||
| 646 | * @init: Function called during driver initialisation. Should be | 646 | * @init: Function called during driver initialisation. Should be |
| 647 | * used by the platform to configure GPIO functions and similar. | 647 | * used by the platform to configure GPIO functions and similar. |
| 648 | * @irq_high: Set if WM8350 IRQ is active high. | 648 | * @irq_high: Set if WM8350 IRQ is active high. |
| 649 | * @irq_base: Base IRQ for genirq (not currently used). | ||
| 650 | * @gpio_base: Base for gpiolib. | ||
| 649 | */ | 651 | */ |
| 650 | struct wm8350_platform_data { | 652 | struct wm8350_platform_data { |
| 651 | int (*init)(struct wm8350 *wm8350); | 653 | int (*init)(struct wm8350 *wm8350); |
| 652 | int irq_high; | 654 | int irq_high; |
| 655 | int irq_base; | ||
| 656 | int gpio_base; | ||
| 653 | }; | 657 | }; |
| 654 | 658 | ||
| 655 | 659 | ||
| @@ -675,12 +679,35 @@ int wm8350_block_write(struct wm8350 *wm8350, int reg, int size, u16 *src); | |||
| 675 | /* | 679 | /* |
| 676 | * WM8350 internal interrupts | 680 | * WM8350 internal interrupts |
| 677 | */ | 681 | */ |
| 678 | int wm8350_register_irq(struct wm8350 *wm8350, int irq, | 682 | static inline int wm8350_register_irq(struct wm8350 *wm8350, int irq, |
| 679 | void (*handler) (struct wm8350 *, int, void *), | 683 | irq_handler_t handler, |
| 680 | void *data); | 684 | unsigned long flags, |
| 681 | int wm8350_free_irq(struct wm8350 *wm8350, int irq); | 685 | const char *name, void *data) |
| 682 | int wm8350_mask_irq(struct wm8350 *wm8350, int irq); | 686 | { |
| 683 | int wm8350_unmask_irq(struct wm8350 *wm8350, int irq); | 687 | if (!wm8350->irq_base) |
| 684 | 688 | return -ENODEV; | |
| 689 | |||
| 690 | return request_threaded_irq(irq + wm8350->irq_base, NULL, | ||
| 691 | handler, flags, name, data); | ||
| 692 | } | ||
| 693 | |||
| 694 | static inline void wm8350_free_irq(struct wm8350 *wm8350, int irq, void *data) | ||
| 695 | { | ||
| 696 | free_irq(irq + wm8350->irq_base, data); | ||
| 697 | } | ||
| 698 | |||
| 699 | static inline void wm8350_mask_irq(struct wm8350 *wm8350, int irq) | ||
| 700 | { | ||
| 701 | disable_irq(irq + wm8350->irq_base); | ||
| 702 | } | ||
| 703 | |||
| 704 | static inline void wm8350_unmask_irq(struct wm8350 *wm8350, int irq) | ||
| 705 | { | ||
| 706 | enable_irq(irq + wm8350->irq_base); | ||
| 707 | } | ||
| 708 | |||
| 709 | int wm8350_irq_init(struct wm8350 *wm8350, int irq, | ||
| 710 | struct wm8350_platform_data *pdata); | ||
| 711 | int wm8350_irq_exit(struct wm8350 *wm8350); | ||
| 685 | 712 | ||
| 686 | #endif | 713 | #endif |
diff --git a/include/linux/mfd/wm8350/gpio.h b/include/linux/mfd/wm8350/gpio.h index ed91e8f5d298..d657bcd6d955 100644 --- a/include/linux/mfd/wm8350/gpio.h +++ b/include/linux/mfd/wm8350/gpio.h | |||
| @@ -29,6 +29,7 @@ | |||
| 29 | #define WM8350_GPIO_FUNCTION_SELECT_2 0x8D | 29 | #define WM8350_GPIO_FUNCTION_SELECT_2 0x8D |
| 30 | #define WM8350_GPIO_FUNCTION_SELECT_3 0x8E | 30 | #define WM8350_GPIO_FUNCTION_SELECT_3 0x8E |
| 31 | #define WM8350_GPIO_FUNCTION_SELECT_4 0x8F | 31 | #define WM8350_GPIO_FUNCTION_SELECT_4 0x8F |
| 32 | #define WM8350_GPIO_LEVEL 0xE6 | ||
| 32 | 33 | ||
| 33 | /* | 34 | /* |
| 34 | * GPIO Functions | 35 | * GPIO Functions |
| @@ -173,6 +174,24 @@ | |||
| 173 | #define WM8350_GPIO_DEBOUNCE_ON 1 | 174 | #define WM8350_GPIO_DEBOUNCE_ON 1 |
| 174 | 175 | ||
| 175 | /* | 176 | /* |
| 177 | * R30 (0x1E) - GPIO Interrupt Status | ||
| 178 | */ | ||
| 179 | #define WM8350_GP12_EINT 0x1000 | ||
| 180 | #define WM8350_GP11_EINT 0x0800 | ||
| 181 | #define WM8350_GP10_EINT 0x0400 | ||
| 182 | #define WM8350_GP9_EINT 0x0200 | ||
| 183 | #define WM8350_GP8_EINT 0x0100 | ||
| 184 | #define WM8350_GP7_EINT 0x0080 | ||
| 185 | #define WM8350_GP6_EINT 0x0040 | ||
| 186 | #define WM8350_GP5_EINT 0x0020 | ||
| 187 | #define WM8350_GP4_EINT 0x0010 | ||
| 188 | #define WM8350_GP3_EINT 0x0008 | ||
| 189 | #define WM8350_GP2_EINT 0x0004 | ||
| 190 | #define WM8350_GP1_EINT 0x0002 | ||
| 191 | #define WM8350_GP0_EINT 0x0001 | ||
| 192 | |||
| 193 | |||
| 194 | /* | ||
| 176 | * R128 (0x80) - GPIO Debounce | 195 | * R128 (0x80) - GPIO Debounce |
| 177 | */ | 196 | */ |
| 178 | #define WM8350_GP12_DB 0x1000 | 197 | #define WM8350_GP12_DB 0x1000 |
diff --git a/include/linux/mfd/wm8350/pmic.h b/include/linux/mfd/wm8350/pmic.h index be3264e286e0..e786fe9841ef 100644 --- a/include/linux/mfd/wm8350/pmic.h +++ b/include/linux/mfd/wm8350/pmic.h | |||
| @@ -666,20 +666,20 @@ | |||
| 666 | #define WM8350_ISINK_FLASH_DUR_64MS (1 << 8) | 666 | #define WM8350_ISINK_FLASH_DUR_64MS (1 << 8) |
| 667 | #define WM8350_ISINK_FLASH_DUR_96MS (2 << 8) | 667 | #define WM8350_ISINK_FLASH_DUR_96MS (2 << 8) |
| 668 | #define WM8350_ISINK_FLASH_DUR_1024MS (3 << 8) | 668 | #define WM8350_ISINK_FLASH_DUR_1024MS (3 << 8) |
| 669 | #define WM8350_ISINK_FLASH_ON_INSTANT (0 << 4) | 669 | #define WM8350_ISINK_FLASH_ON_INSTANT (0 << 0) |
| 670 | #define WM8350_ISINK_FLASH_ON_0_25S (1 << 4) | 670 | #define WM8350_ISINK_FLASH_ON_0_25S (1 << 0) |
| 671 | #define WM8350_ISINK_FLASH_ON_0_50S (2 << 4) | 671 | #define WM8350_ISINK_FLASH_ON_0_50S (2 << 0) |
| 672 | #define WM8350_ISINK_FLASH_ON_1_00S (3 << 4) | 672 | #define WM8350_ISINK_FLASH_ON_1_00S (3 << 0) |
| 673 | #define WM8350_ISINK_FLASH_ON_1_95S (1 << 4) | 673 | #define WM8350_ISINK_FLASH_ON_1_95S (1 << 0) |
| 674 | #define WM8350_ISINK_FLASH_ON_3_91S (2 << 4) | 674 | #define WM8350_ISINK_FLASH_ON_3_91S (2 << 0) |
| 675 | #define WM8350_ISINK_FLASH_ON_7_80S (3 << 4) | 675 | #define WM8350_ISINK_FLASH_ON_7_80S (3 << 0) |
| 676 | #define WM8350_ISINK_FLASH_OFF_INSTANT (0 << 0) | 676 | #define WM8350_ISINK_FLASH_OFF_INSTANT (0 << 4) |
| 677 | #define WM8350_ISINK_FLASH_OFF_0_25S (1 << 0) | 677 | #define WM8350_ISINK_FLASH_OFF_0_25S (1 << 4) |
| 678 | #define WM8350_ISINK_FLASH_OFF_0_50S (2 << 0) | 678 | #define WM8350_ISINK_FLASH_OFF_0_50S (2 << 4) |
| 679 | #define WM8350_ISINK_FLASH_OFF_1_00S (3 << 0) | 679 | #define WM8350_ISINK_FLASH_OFF_1_00S (3 << 4) |
| 680 | #define WM8350_ISINK_FLASH_OFF_1_95S (1 << 0) | 680 | #define WM8350_ISINK_FLASH_OFF_1_95S (1 << 4) |
| 681 | #define WM8350_ISINK_FLASH_OFF_3_91S (2 << 0) | 681 | #define WM8350_ISINK_FLASH_OFF_3_91S (2 << 4) |
| 682 | #define WM8350_ISINK_FLASH_OFF_7_80S (3 << 0) | 682 | #define WM8350_ISINK_FLASH_OFF_7_80S (3 << 4) |
| 683 | 683 | ||
| 684 | /* | 684 | /* |
| 685 | * Regulator Interrupts. | 685 | * Regulator Interrupts. |
diff --git a/include/linux/mfd/wm8350/rtc.h b/include/linux/mfd/wm8350/rtc.h index 24add2bef6c9..ebd72ffc62d1 100644 --- a/include/linux/mfd/wm8350/rtc.h +++ b/include/linux/mfd/wm8350/rtc.h | |||
| @@ -263,6 +263,7 @@ struct wm8350_rtc { | |||
| 263 | struct platform_device *pdev; | 263 | struct platform_device *pdev; |
| 264 | struct rtc_device *rtc; | 264 | struct rtc_device *rtc; |
| 265 | int alarm_enabled; /* used over suspend/resume */ | 265 | int alarm_enabled; /* used over suspend/resume */ |
| 266 | int update_enabled; | ||
| 266 | }; | 267 | }; |
| 267 | 268 | ||
| 268 | #endif | 269 | #endif |
diff --git a/include/linux/mfd/wm8994/core.h b/include/linux/mfd/wm8994/core.h new file mode 100644 index 000000000000..b06ff2846748 --- /dev/null +++ b/include/linux/mfd/wm8994/core.h | |||
| @@ -0,0 +1,54 @@ | |||
| 1 | /* | ||
| 2 | * include/linux/mfd/wm8994/core.h -- Core interface for WM8994 | ||
| 3 | * | ||
| 4 | * Copyright 2009 Wolfson Microelectronics PLC. | ||
| 5 | * | ||
| 6 | * Author: Mark Brown <broonie@opensource.wolfsonmicro.com> | ||
| 7 | * | ||
| 8 | * This program is free software; you can redistribute it and/or modify it | ||
| 9 | * under the terms of the GNU General Public License as published by the | ||
| 10 | * Free Software Foundation; either version 2 of the License, or (at your | ||
| 11 | * option) any later version. | ||
| 12 | * | ||
| 13 | */ | ||
| 14 | |||
| 15 | #ifndef __MFD_WM8994_CORE_H__ | ||
| 16 | #define __MFD_WM8994_CORE_H__ | ||
| 17 | |||
| 18 | struct regulator_dev; | ||
| 19 | struct regulator_bulk_data; | ||
| 20 | |||
| 21 | #define WM8994_NUM_GPIO_REGS 11 | ||
| 22 | #define WM8994_NUM_LDO_REGS 2 | ||
| 23 | |||
| 24 | struct wm8994 { | ||
| 25 | struct mutex io_lock; | ||
| 26 | |||
| 27 | struct device *dev; | ||
| 28 | int (*read_dev)(struct wm8994 *wm8994, unsigned short reg, | ||
| 29 | int bytes, void *dest); | ||
| 30 | int (*write_dev)(struct wm8994 *wm8994, unsigned short reg, | ||
| 31 | int bytes, void *src); | ||
| 32 | |||
| 33 | void *control_data; | ||
| 34 | |||
| 35 | int gpio_base; | ||
| 36 | |||
| 37 | /* Used over suspend/resume */ | ||
| 38 | u16 ldo_regs[WM8994_NUM_LDO_REGS]; | ||
| 39 | u16 gpio_regs[WM8994_NUM_GPIO_REGS]; | ||
| 40 | |||
| 41 | struct regulator_dev *dbvdd; | ||
| 42 | struct regulator_bulk_data *supplies; | ||
| 43 | }; | ||
| 44 | |||
| 45 | /* Device I/O API */ | ||
| 46 | int wm8994_reg_read(struct wm8994 *wm8994, unsigned short reg); | ||
| 47 | int wm8994_reg_write(struct wm8994 *wm8994, unsigned short reg, | ||
| 48 | unsigned short val); | ||
| 49 | int wm8994_set_bits(struct wm8994 *wm8994, unsigned short reg, | ||
| 50 | unsigned short mask, unsigned short val); | ||
| 51 | int wm8994_bulk_read(struct wm8994 *wm8994, unsigned short reg, | ||
| 52 | int count, u16 *buf); | ||
| 53 | |||
| 54 | #endif | ||
diff --git a/include/linux/mfd/wm8994/gpio.h b/include/linux/mfd/wm8994/gpio.h new file mode 100644 index 000000000000..b4d4c22991e8 --- /dev/null +++ b/include/linux/mfd/wm8994/gpio.h | |||
| @@ -0,0 +1,72 @@ | |||
| 1 | /* | ||
| 2 | * include/linux/mfd/wm8994/gpio.h - GPIO configuration for WM8994 | ||
| 3 | * | ||
| 4 | * Copyright 2009 Wolfson Microelectronics PLC. | ||
| 5 | * | ||
| 6 | * Author: Mark Brown <broonie@opensource.wolfsonmicro.com> | ||
| 7 | * | ||
| 8 | * This program is free software; you can redistribute it and/or modify it | ||
| 9 | * under the terms of the GNU General Public License as published by the | ||
| 10 | * Free Software Foundation; either version 2 of the License, or (at your | ||
| 11 | * option) any later version. | ||
| 12 | * | ||
| 13 | */ | ||
| 14 | |||
| 15 | #ifndef __MFD_WM8994_GPIO_H__ | ||
| 16 | #define __MFD_WM8994_GPIO_H__ | ||
| 17 | |||
| 18 | #define WM8994_GPIO_MAX 11 | ||
| 19 | |||
| 20 | #define WM8994_GP_FN_PIN_SPECIFIC 0 | ||
| 21 | #define WM8994_GP_FN_GPIO 1 | ||
| 22 | #define WM8994_GP_FN_SDOUT 2 | ||
| 23 | #define WM8994_GP_FN_IRQ 3 | ||
| 24 | #define WM8994_GP_FN_TEMPERATURE 4 | ||
| 25 | #define WM8994_GP_FN_MICBIAS1_DET 5 | ||
| 26 | #define WM8994_GP_FN_MICBIAS1_SHORT 6 | ||
| 27 | #define WM8994_GP_FN_MICBIAS2_DET 7 | ||
| 28 | #define WM8994_GP_FN_MICBIAS2_SHORT 8 | ||
| 29 | #define WM8994_GP_FN_FLL1_LOCK 9 | ||
| 30 | #define WM8994_GP_FN_FLL2_LOCK 10 | ||
| 31 | #define WM8994_GP_FN_SRC1_LOCK 11 | ||
| 32 | #define WM8994_GP_FN_SRC2_LOCK 12 | ||
| 33 | #define WM8994_GP_FN_DRC1_ACT 13 | ||
| 34 | #define WM8994_GP_FN_DRC2_ACT 14 | ||
| 35 | #define WM8994_GP_FN_DRC3_ACT 15 | ||
| 36 | #define WM8994_GP_FN_WSEQ_STATUS 16 | ||
| 37 | #define WM8994_GP_FN_FIFO_ERROR 17 | ||
| 38 | #define WM8994_GP_FN_OPCLK 18 | ||
| 39 | |||
| 40 | #define WM8994_GPN_DIR 0x8000 /* GPN_DIR */ | ||
| 41 | #define WM8994_GPN_DIR_MASK 0x8000 /* GPN_DIR */ | ||
| 42 | #define WM8994_GPN_DIR_SHIFT 15 /* GPN_DIR */ | ||
| 43 | #define WM8994_GPN_DIR_WIDTH 1 /* GPN_DIR */ | ||
| 44 | #define WM8994_GPN_PU 0x4000 /* GPN_PU */ | ||
| 45 | #define WM8994_GPN_PU_MASK 0x4000 /* GPN_PU */ | ||
| 46 | #define WM8994_GPN_PU_SHIFT 14 /* GPN_PU */ | ||
| 47 | #define WM8994_GPN_PU_WIDTH 1 /* GPN_PU */ | ||
| 48 | #define WM8994_GPN_PD 0x2000 /* GPN_PD */ | ||
| 49 | #define WM8994_GPN_PD_MASK 0x2000 /* GPN_PD */ | ||
| 50 | #define WM8994_GPN_PD_SHIFT 13 /* GPN_PD */ | ||
| 51 | #define WM8994_GPN_PD_WIDTH 1 /* GPN_PD */ | ||
| 52 | #define WM8994_GPN_POL 0x0400 /* GPN_POL */ | ||
| 53 | #define WM8994_GPN_POL_MASK 0x0400 /* GPN_POL */ | ||
| 54 | #define WM8994_GPN_POL_SHIFT 10 /* GPN_POL */ | ||
| 55 | #define WM8994_GPN_POL_WIDTH 1 /* GPN_POL */ | ||
| 56 | #define WM8994_GPN_OP_CFG 0x0200 /* GPN_OP_CFG */ | ||
| 57 | #define WM8994_GPN_OP_CFG_MASK 0x0200 /* GPN_OP_CFG */ | ||
| 58 | #define WM8994_GPN_OP_CFG_SHIFT 9 /* GPN_OP_CFG */ | ||
| 59 | #define WM8994_GPN_OP_CFG_WIDTH 1 /* GPN_OP_CFG */ | ||
| 60 | #define WM8994_GPN_DB 0x0100 /* GPN_DB */ | ||
| 61 | #define WM8994_GPN_DB_MASK 0x0100 /* GPN_DB */ | ||
| 62 | #define WM8994_GPN_DB_SHIFT 8 /* GPN_DB */ | ||
| 63 | #define WM8994_GPN_DB_WIDTH 1 /* GPN_DB */ | ||
| 64 | #define WM8994_GPN_LVL 0x0040 /* GPN_LVL */ | ||
| 65 | #define WM8994_GPN_LVL_MASK 0x0040 /* GPN_LVL */ | ||
| 66 | #define WM8994_GPN_LVL_SHIFT 6 /* GPN_LVL */ | ||
| 67 | #define WM8994_GPN_LVL_WIDTH 1 /* GPN_LVL */ | ||
| 68 | #define WM8994_GPN_FN_MASK 0x001F /* GPN_FN - [4:0] */ | ||
| 69 | #define WM8994_GPN_FN_SHIFT 0 /* GPN_FN - [4:0] */ | ||
| 70 | #define WM8994_GPN_FN_WIDTH 5 /* GPN_FN - [4:0] */ | ||
| 71 | |||
| 72 | #endif | ||
diff --git a/include/linux/mfd/wm8994/pdata.h b/include/linux/mfd/wm8994/pdata.h new file mode 100644 index 000000000000..70d6a8687dc5 --- /dev/null +++ b/include/linux/mfd/wm8994/pdata.h | |||
| @@ -0,0 +1,97 @@ | |||
| 1 | /* | ||
| 2 | * include/linux/mfd/wm8994/pdata.h -- Platform data for WM8994 | ||
| 3 | * | ||
| 4 | * Copyright 2009 Wolfson Microelectronics PLC. | ||
| 5 | * | ||
| 6 | * Author: Mark Brown <broonie@opensource.wolfsonmicro.com> | ||
| 7 | * | ||
| 8 | * This program is free software; you can redistribute it and/or modify it | ||
| 9 | * under the terms of the GNU General Public License as published by the | ||
| 10 | * Free Software Foundation; either version 2 of the License, or (at your | ||
| 11 | * option) any later version. | ||
| 12 | * | ||
| 13 | */ | ||
| 14 | |||
| 15 | #ifndef __MFD_WM8994_PDATA_H__ | ||
| 16 | #define __MFD_WM8994_PDATA_H__ | ||
| 17 | |||
| 18 | #define WM8994_NUM_LDO 2 | ||
| 19 | #define WM8994_NUM_GPIO 11 | ||
| 20 | |||
| 21 | struct wm8994_ldo_pdata { | ||
| 22 | /** GPIOs to enable regulator, 0 or less if not available */ | ||
| 23 | int enable; | ||
| 24 | |||
| 25 | const char *supply; | ||
| 26 | struct regulator_init_data *init_data; | ||
| 27 | }; | ||
| 28 | |||
| 29 | #define WM8994_CONFIGURE_GPIO 0x8000 | ||
| 30 | |||
| 31 | #define WM8994_DRC_REGS 5 | ||
| 32 | #define WM8994_EQ_REGS 19 | ||
| 33 | |||
| 34 | /** | ||
| 35 | * DRC configurations are specified with a label and a set of register | ||
| 36 | * values to write (the enable bits will be ignored). At runtime an | ||
| 37 | * enumerated control will be presented for each DRC block allowing | ||
| 38 | * the user to choose the configration to use. | ||
| 39 | * | ||
| 40 | * Configurations may be generated by hand or by using the DRC control | ||
| 41 | * panel provided by the WISCE - see http://www.wolfsonmicro.com/wisce/ | ||
| 42 | * for details. | ||
| 43 | */ | ||
| 44 | struct wm8994_drc_cfg { | ||
| 45 | const char *name; | ||
| 46 | u16 regs[WM8994_DRC_REGS]; | ||
| 47 | }; | ||
| 48 | |||
| 49 | /** | ||
| 50 | * ReTune Mobile configurations are specified with a label, sample | ||
| 51 | * rate and set of values to write (the enable bits will be ignored). | ||
| 52 | * | ||
| 53 | * Configurations are expected to be generated using the ReTune Mobile | ||
| 54 | * control panel in WISCE - see http://www.wolfsonmicro.com/wisce/ | ||
| 55 | */ | ||
| 56 | struct wm8994_retune_mobile_cfg { | ||
| 57 | const char *name; | ||
| 58 | unsigned int rate; | ||
| 59 | u16 regs[WM8994_EQ_REGS]; | ||
| 60 | }; | ||
| 61 | |||
| 62 | struct wm8994_pdata { | ||
| 63 | int gpio_base; | ||
| 64 | |||
| 65 | /** | ||
| 66 | * Default values for GPIOs if non-zero, WM8994_CONFIGURE_GPIO | ||
| 67 | * can be used for all zero values. | ||
| 68 | */ | ||
| 69 | int gpio_defaults[WM8994_NUM_GPIO]; | ||
| 70 | |||
| 71 | struct wm8994_ldo_pdata ldo[WM8994_NUM_LDO]; | ||
| 72 | |||
| 73 | |||
| 74 | int num_drc_cfgs; | ||
| 75 | struct wm8994_drc_cfg *drc_cfgs; | ||
| 76 | |||
| 77 | int num_retune_mobile_cfgs; | ||
| 78 | struct wm8994_retune_mobile_cfg *retune_mobile_cfgs; | ||
| 79 | |||
| 80 | /* LINEOUT can be differential or single ended */ | ||
| 81 | unsigned int lineout1_diff:1; | ||
| 82 | unsigned int lineout2_diff:1; | ||
| 83 | |||
| 84 | /* Common mode feedback */ | ||
| 85 | unsigned int lineout1fb:1; | ||
| 86 | unsigned int lineout2fb:1; | ||
| 87 | |||
| 88 | /* Microphone biases: 0=0.9*AVDD1 1=0.65*AVVD1 */ | ||
| 89 | unsigned int micbias1_lvl:1; | ||
| 90 | unsigned int micbias2_lvl:1; | ||
| 91 | |||
| 92 | /* Jack detect threashold levels, see datasheet for values */ | ||
| 93 | unsigned int jd_scthr:2; | ||
| 94 | unsigned int jd_thr:2; | ||
| 95 | }; | ||
| 96 | |||
| 97 | #endif | ||
diff --git a/include/linux/mfd/wm8994/registers.h b/include/linux/mfd/wm8994/registers.h new file mode 100644 index 000000000000..967f62f54159 --- /dev/null +++ b/include/linux/mfd/wm8994/registers.h | |||
| @@ -0,0 +1,4292 @@ | |||
| 1 | /* | ||
| 2 | * include/linux/mfd/wm8994/registers.h -- Register definitions for WM8994 | ||
| 3 | * | ||
| 4 | * Copyright 2009 Wolfson Microelectronics PLC. | ||
| 5 | * | ||
| 6 | * Author: Mark Brown <broonie@opensource.wolfsonmicro.com> | ||
| 7 | * | ||
| 8 | * This program is free software; you can redistribute it and/or modify it | ||
| 9 | * under the terms of the GNU General Public License as published by the | ||
| 10 | * Free Software Foundation; either version 2 of the License, or (at your | ||
| 11 | * option) any later version. | ||
| 12 | * | ||
| 13 | */ | ||
| 14 | |||
| 15 | #ifndef __MFD_WM8994_REGISTERS_H__ | ||
| 16 | #define __MFD_WM8994_REGISTERS_H__ | ||
| 17 | |||
| 18 | /* | ||
| 19 | * Register values. | ||
| 20 | */ | ||
| 21 | #define WM8994_SOFTWARE_RESET 0x00 | ||
| 22 | #define WM8994_POWER_MANAGEMENT_1 0x01 | ||
| 23 | #define WM8994_POWER_MANAGEMENT_2 0x02 | ||
| 24 | #define WM8994_POWER_MANAGEMENT_3 0x03 | ||
| 25 | #define WM8994_POWER_MANAGEMENT_4 0x04 | ||
| 26 | #define WM8994_POWER_MANAGEMENT_5 0x05 | ||
| 27 | #define WM8994_POWER_MANAGEMENT_6 0x06 | ||
| 28 | #define WM8994_INPUT_MIXER_1 0x15 | ||
| 29 | #define WM8994_LEFT_LINE_INPUT_1_2_VOLUME 0x18 | ||
| 30 | #define WM8994_LEFT_LINE_INPUT_3_4_VOLUME 0x19 | ||
| 31 | #define WM8994_RIGHT_LINE_INPUT_1_2_VOLUME 0x1A | ||
| 32 | #define WM8994_RIGHT_LINE_INPUT_3_4_VOLUME 0x1B | ||
| 33 | #define WM8994_LEFT_OUTPUT_VOLUME 0x1C | ||
| 34 | #define WM8994_RIGHT_OUTPUT_VOLUME 0x1D | ||
| 35 | #define WM8994_LINE_OUTPUTS_VOLUME 0x1E | ||
| 36 | #define WM8994_HPOUT2_VOLUME 0x1F | ||
| 37 | #define WM8994_LEFT_OPGA_VOLUME 0x20 | ||
| 38 | #define WM8994_RIGHT_OPGA_VOLUME 0x21 | ||
| 39 | #define WM8994_SPKMIXL_ATTENUATION 0x22 | ||
| 40 | #define WM8994_SPKMIXR_ATTENUATION 0x23 | ||
| 41 | #define WM8994_SPKOUT_MIXERS 0x24 | ||
| 42 | #define WM8994_CLASSD 0x25 | ||
| 43 | #define WM8994_SPEAKER_VOLUME_LEFT 0x26 | ||
| 44 | #define WM8994_SPEAKER_VOLUME_RIGHT 0x27 | ||
| 45 | #define WM8994_INPUT_MIXER_2 0x28 | ||
| 46 | #define WM8994_INPUT_MIXER_3 0x29 | ||
| 47 | #define WM8994_INPUT_MIXER_4 0x2A | ||
| 48 | #define WM8994_INPUT_MIXER_5 0x2B | ||
| 49 | #define WM8994_INPUT_MIXER_6 0x2C | ||
| 50 | #define WM8994_OUTPUT_MIXER_1 0x2D | ||
| 51 | #define WM8994_OUTPUT_MIXER_2 0x2E | ||
| 52 | #define WM8994_OUTPUT_MIXER_3 0x2F | ||
| 53 | #define WM8994_OUTPUT_MIXER_4 0x30 | ||
| 54 | #define WM8994_OUTPUT_MIXER_5 0x31 | ||
| 55 | #define WM8994_OUTPUT_MIXER_6 0x32 | ||
| 56 | #define WM8994_HPOUT2_MIXER 0x33 | ||
| 57 | #define WM8994_LINE_MIXER_1 0x34 | ||
| 58 | #define WM8994_LINE_MIXER_2 0x35 | ||
| 59 | #define WM8994_SPEAKER_MIXER 0x36 | ||
| 60 | #define WM8994_ADDITIONAL_CONTROL 0x37 | ||
| 61 | #define WM8994_ANTIPOP_1 0x38 | ||
| 62 | #define WM8994_ANTIPOP_2 0x39 | ||
| 63 | #define WM8994_MICBIAS 0x3A | ||
| 64 | #define WM8994_LDO_1 0x3B | ||
| 65 | #define WM8994_LDO_2 0x3C | ||
| 66 | #define WM8994_CHARGE_PUMP_1 0x4C | ||
| 67 | #define WM8994_CLASS_W_1 0x51 | ||
| 68 | #define WM8994_DC_SERVO_1 0x54 | ||
| 69 | #define WM8994_DC_SERVO_2 0x55 | ||
| 70 | #define WM8994_DC_SERVO_4 0x57 | ||
| 71 | #define WM8994_DC_SERVO_READBACK 0x58 | ||
| 72 | #define WM8994_ANALOGUE_HP_1 0x60 | ||
| 73 | #define WM8994_CHIP_REVISION 0x100 | ||
| 74 | #define WM8994_CONTROL_INTERFACE 0x101 | ||
| 75 | #define WM8994_WRITE_SEQUENCER_CTRL_1 0x110 | ||
| 76 | #define WM8994_WRITE_SEQUENCER_CTRL_2 0x111 | ||
| 77 | #define WM8994_AIF1_CLOCKING_1 0x200 | ||
| 78 | #define WM8994_AIF1_CLOCKING_2 0x201 | ||
| 79 | #define WM8994_AIF2_CLOCKING_1 0x204 | ||
| 80 | #define WM8994_AIF2_CLOCKING_2 0x205 | ||
| 81 | #define WM8994_CLOCKING_1 0x208 | ||
| 82 | #define WM8994_CLOCKING_2 0x209 | ||
| 83 | #define WM8994_AIF1_RATE 0x210 | ||
| 84 | #define WM8994_AIF2_RATE 0x211 | ||
| 85 | #define WM8994_RATE_STATUS 0x212 | ||
| 86 | #define WM8994_FLL1_CONTROL_1 0x220 | ||
| 87 | #define WM8994_FLL1_CONTROL_2 0x221 | ||
| 88 | #define WM8994_FLL1_CONTROL_3 0x222 | ||
| 89 | #define WM8994_FLL1_CONTROL_4 0x223 | ||
| 90 | #define WM8994_FLL1_CONTROL_5 0x224 | ||
| 91 | #define WM8994_FLL2_CONTROL_1 0x240 | ||
| 92 | #define WM8994_FLL2_CONTROL_2 0x241 | ||
| 93 | #define WM8994_FLL2_CONTROL_3 0x242 | ||
| 94 | #define WM8994_FLL2_CONTROL_4 0x243 | ||
| 95 | #define WM8994_FLL2_CONTROL_5 0x244 | ||
| 96 | #define WM8994_AIF1_CONTROL_1 0x300 | ||
| 97 | #define WM8994_AIF1_CONTROL_2 0x301 | ||
| 98 | #define WM8994_AIF1_MASTER_SLAVE 0x302 | ||
| 99 | #define WM8994_AIF1_BCLK 0x303 | ||
| 100 | #define WM8994_AIF1ADC_LRCLK 0x304 | ||
| 101 | #define WM8994_AIF1DAC_LRCLK 0x305 | ||
| 102 | #define WM8994_AIF1DAC_DATA 0x306 | ||
| 103 | #define WM8994_AIF1ADC_DATA 0x307 | ||
| 104 | #define WM8994_AIF2_CONTROL_1 0x310 | ||
| 105 | #define WM8994_AIF2_CONTROL_2 0x311 | ||
| 106 | #define WM8994_AIF2_MASTER_SLAVE 0x312 | ||
| 107 | #define WM8994_AIF2_BCLK 0x313 | ||
| 108 | #define WM8994_AIF2ADC_LRCLK 0x314 | ||
| 109 | #define WM8994_AIF2DAC_LRCLK 0x315 | ||
| 110 | #define WM8994_AIF2DAC_DATA 0x316 | ||
| 111 | #define WM8994_AIF2ADC_DATA 0x317 | ||
| 112 | #define WM8994_AIF1_ADC1_LEFT_VOLUME 0x400 | ||
| 113 | #define WM8994_AIF1_ADC1_RIGHT_VOLUME 0x401 | ||
| 114 | #define WM8994_AIF1_DAC1_LEFT_VOLUME 0x402 | ||
| 115 | #define WM8994_AIF1_DAC1_RIGHT_VOLUME 0x403 | ||
| 116 | #define WM8994_AIF1_ADC2_LEFT_VOLUME 0x404 | ||
| 117 | #define WM8994_AIF1_ADC2_RIGHT_VOLUME 0x405 | ||
| 118 | #define WM8994_AIF1_DAC2_LEFT_VOLUME 0x406 | ||
| 119 | #define WM8994_AIF1_DAC2_RIGHT_VOLUME 0x407 | ||
| 120 | #define WM8994_AIF1_ADC1_FILTERS 0x410 | ||
| 121 | #define WM8994_AIF1_ADC2_FILTERS 0x411 | ||
| 122 | #define WM8994_AIF1_DAC1_FILTERS_1 0x420 | ||
| 123 | #define WM8994_AIF1_DAC1_FILTERS_2 0x421 | ||
| 124 | #define WM8994_AIF1_DAC2_FILTERS_1 0x422 | ||
| 125 | #define WM8994_AIF1_DAC2_FILTERS_2 0x423 | ||
| 126 | #define WM8994_AIF1_DRC1_1 0x440 | ||
| 127 | #define WM8994_AIF1_DRC1_2 0x441 | ||
| 128 | #define WM8994_AIF1_DRC1_3 0x442 | ||
| 129 | #define WM8994_AIF1_DRC1_4 0x443 | ||
| 130 | #define WM8994_AIF1_DRC1_5 0x444 | ||
| 131 | #define WM8994_AIF1_DRC2_1 0x450 | ||
| 132 | #define WM8994_AIF1_DRC2_2 0x451 | ||
| 133 | #define WM8994_AIF1_DRC2_3 0x452 | ||
| 134 | #define WM8994_AIF1_DRC2_4 0x453 | ||
| 135 | #define WM8994_AIF1_DRC2_5 0x454 | ||
| 136 | #define WM8994_AIF1_DAC1_EQ_GAINS_1 0x480 | ||
| 137 | #define WM8994_AIF1_DAC1_EQ_GAINS_2 0x481 | ||
| 138 | #define WM8994_AIF1_DAC1_EQ_BAND_1_A 0x482 | ||
| 139 | #define WM8994_AIF1_DAC1_EQ_BAND_1_B 0x483 | ||
| 140 | #define WM8994_AIF1_DAC1_EQ_BAND_1_PG 0x484 | ||
| 141 | #define WM8994_AIF1_DAC1_EQ_BAND_2_A 0x485 | ||
| 142 | #define WM8994_AIF1_DAC1_EQ_BAND_2_B 0x486 | ||
| 143 | #define WM8994_AIF1_DAC1_EQ_BAND_2_C 0x487 | ||
| 144 | #define WM8994_AIF1_DAC1_EQ_BAND_2_PG 0x488 | ||
| 145 | #define WM8994_AIF1_DAC1_EQ_BAND_3_A 0x489 | ||
| 146 | #define WM8994_AIF1_DAC1_EQ_BAND_3_B 0x48A | ||
| 147 | #define WM8994_AIF1_DAC1_EQ_BAND_3_C 0x48B | ||
| 148 | #define WM8994_AIF1_DAC1_EQ_BAND_3_PG 0x48C | ||
| 149 | #define WM8994_AIF1_DAC1_EQ_BAND_4_A 0x48D | ||
| 150 | #define WM8994_AIF1_DAC1_EQ_BAND_4_B 0x48E | ||
| 151 | #define WM8994_AIF1_DAC1_EQ_BAND_4_C 0x48F | ||
| 152 | #define WM8994_AIF1_DAC1_EQ_BAND_4_PG 0x490 | ||
| 153 | #define WM8994_AIF1_DAC1_EQ_BAND_5_A 0x491 | ||
| 154 | #define WM8994_AIF1_DAC1_EQ_BAND_5_B 0x492 | ||
| 155 | #define WM8994_AIF1_DAC1_EQ_BAND_5_PG 0x493 | ||
| 156 | #define WM8994_AIF1_DAC2_EQ_GAINS_1 0x4A0 | ||
| 157 | #define WM8994_AIF1_DAC2_EQ_GAINS_2 0x4A1 | ||
| 158 | #define WM8994_AIF1_DAC2_EQ_BAND_1_A 0x4A2 | ||
| 159 | #define WM8994_AIF1_DAC2_EQ_BAND_1_B 0x4A3 | ||
| 160 | #define WM8994_AIF1_DAC2_EQ_BAND_1_PG 0x4A4 | ||
| 161 | #define WM8994_AIF1_DAC2_EQ_BAND_2_A 0x4A5 | ||
| 162 | #define WM8994_AIF1_DAC2_EQ_BAND_2_B 0x4A6 | ||
| 163 | #define WM8994_AIF1_DAC2_EQ_BAND_2_C 0x4A7 | ||
| 164 | #define WM8994_AIF1_DAC2_EQ_BAND_2_PG 0x4A8 | ||
| 165 | #define WM8994_AIF1_DAC2_EQ_BAND_3_A 0x4A9 | ||
| 166 | #define WM8994_AIF1_DAC2_EQ_BAND_3_B 0x4AA | ||
| 167 | #define WM8994_AIF1_DAC2_EQ_BAND_3_C 0x4AB | ||
| 168 | #define WM8994_AIF1_DAC2_EQ_BAND_3_PG 0x4AC | ||
| 169 | #define WM8994_AIF1_DAC2_EQ_BAND_4_A 0x4AD | ||
| 170 | #define WM8994_AIF1_DAC2_EQ_BAND_4_B 0x4AE | ||
| 171 | #define WM8994_AIF1_DAC2_EQ_BAND_4_C 0x4AF | ||
| 172 | #define WM8994_AIF1_DAC2_EQ_BAND_4_PG 0x4B0 | ||
| 173 | #define WM8994_AIF1_DAC2_EQ_BAND_5_A 0x4B1 | ||
| 174 | #define WM8994_AIF1_DAC2_EQ_BAND_5_B 0x4B2 | ||
| 175 | #define WM8994_AIF1_DAC2_EQ_BAND_5_PG 0x4B3 | ||
| 176 | #define WM8994_AIF2_ADC_LEFT_VOLUME 0x500 | ||
| 177 | #define WM8994_AIF2_ADC_RIGHT_VOLUME 0x501 | ||
| 178 | #define WM8994_AIF2_DAC_LEFT_VOLUME 0x502 | ||
| 179 | #define WM8994_AIF2_DAC_RIGHT_VOLUME 0x503 | ||
| 180 | #define WM8994_AIF2_ADC_FILTERS 0x510 | ||
| 181 | #define WM8994_AIF2_DAC_FILTERS_1 0x520 | ||
| 182 | #define WM8994_AIF2_DAC_FILTERS_2 0x521 | ||
| 183 | #define WM8994_AIF2_DRC_1 0x540 | ||
| 184 | #define WM8994_AIF2_DRC_2 0x541 | ||
| 185 | #define WM8994_AIF2_DRC_3 0x542 | ||
| 186 | #define WM8994_AIF2_DRC_4 0x543 | ||
| 187 | #define WM8994_AIF2_DRC_5 0x544 | ||
| 188 | #define WM8994_AIF2_EQ_GAINS_1 0x580 | ||
| 189 | #define WM8994_AIF2_EQ_GAINS_2 0x581 | ||
| 190 | #define WM8994_AIF2_EQ_BAND_1_A 0x582 | ||
| 191 | #define WM8994_AIF2_EQ_BAND_1_B 0x583 | ||
| 192 | #define WM8994_AIF2_EQ_BAND_1_PG 0x584 | ||
| 193 | #define WM8994_AIF2_EQ_BAND_2_A 0x585 | ||
| 194 | #define WM8994_AIF2_EQ_BAND_2_B 0x586 | ||
| 195 | #define WM8994_AIF2_EQ_BAND_2_C 0x587 | ||
| 196 | #define WM8994_AIF2_EQ_BAND_2_PG 0x588 | ||
| 197 | #define WM8994_AIF2_EQ_BAND_3_A 0x589 | ||
| 198 | #define WM8994_AIF2_EQ_BAND_3_B 0x58A | ||
| 199 | #define WM8994_AIF2_EQ_BAND_3_C 0x58B | ||
| 200 | #define WM8994_AIF2_EQ_BAND_3_PG 0x58C | ||
| 201 | #define WM8994_AIF2_EQ_BAND_4_A 0x58D | ||
| 202 | #define WM8994_AIF2_EQ_BAND_4_B 0x58E | ||
| 203 | #define WM8994_AIF2_EQ_BAND_4_C 0x58F | ||
| 204 | #define WM8994_AIF2_EQ_BAND_4_PG 0x590 | ||
| 205 | #define WM8994_AIF2_EQ_BAND_5_A 0x591 | ||
| 206 | #define WM8994_AIF2_EQ_BAND_5_B 0x592 | ||
| 207 | #define WM8994_AIF2_EQ_BAND_5_PG 0x593 | ||
| 208 | #define WM8994_DAC1_MIXER_VOLUMES 0x600 | ||
| 209 | #define WM8994_DAC1_LEFT_MIXER_ROUTING 0x601 | ||
| 210 | #define WM8994_DAC1_RIGHT_MIXER_ROUTING 0x602 | ||
| 211 | #define WM8994_DAC2_MIXER_VOLUMES 0x603 | ||
| 212 | #define WM8994_DAC2_LEFT_MIXER_ROUTING 0x604 | ||
| 213 | #define WM8994_DAC2_RIGHT_MIXER_ROUTING 0x605 | ||
| 214 | #define WM8994_AIF1_ADC1_LEFT_MIXER_ROUTING 0x606 | ||
| 215 | #define WM8994_AIF1_ADC1_RIGHT_MIXER_ROUTING 0x607 | ||
| 216 | #define WM8994_AIF1_ADC2_LEFT_MIXER_ROUTING 0x608 | ||
| 217 | #define WM8994_AIF1_ADC2_RIGHT_MIXER_ROUTING 0x609 | ||
| 218 | #define WM8994_DAC1_LEFT_VOLUME 0x610 | ||
| 219 | #define WM8994_DAC1_RIGHT_VOLUME 0x611 | ||
| 220 | #define WM8994_DAC2_LEFT_VOLUME 0x612 | ||
| 221 | #define WM8994_DAC2_RIGHT_VOLUME 0x613 | ||
| 222 | #define WM8994_DAC_SOFTMUTE 0x614 | ||
| 223 | #define WM8994_OVERSAMPLING 0x620 | ||
| 224 | #define WM8994_SIDETONE 0x621 | ||
| 225 | #define WM8994_GPIO_1 0x700 | ||
| 226 | #define WM8994_GPIO_2 0x701 | ||
| 227 | #define WM8994_GPIO_3 0x702 | ||
| 228 | #define WM8994_GPIO_4 0x703 | ||
| 229 | #define WM8994_GPIO_5 0x704 | ||
| 230 | #define WM8994_GPIO_6 0x705 | ||
| 231 | #define WM8994_GPIO_7 0x706 | ||
| 232 | #define WM8994_GPIO_8 0x707 | ||
| 233 | #define WM8994_GPIO_9 0x708 | ||
| 234 | #define WM8994_GPIO_10 0x709 | ||
| 235 | #define WM8994_GPIO_11 0x70A | ||
| 236 | #define WM8994_PULL_CONTROL_1 0x720 | ||
| 237 | #define WM8994_PULL_CONTROL_2 0x721 | ||
| 238 | #define WM8994_INTERRUPT_STATUS_1 0x730 | ||
| 239 | #define WM8994_INTERRUPT_STATUS_2 0x731 | ||
| 240 | #define WM8994_INTERRUPT_RAW_STATUS_2 0x732 | ||
| 241 | #define WM8994_INTERRUPT_STATUS_1_MASK 0x738 | ||
| 242 | #define WM8994_INTERRUPT_STATUS_2_MASK 0x739 | ||
| 243 | #define WM8994_INTERRUPT_CONTROL 0x740 | ||
| 244 | #define WM8994_IRQ_DEBOUNCE 0x748 | ||
| 245 | #define WM8994_WRITE_SEQUENCER_0 0x3000 | ||
| 246 | #define WM8994_WRITE_SEQUENCER_1 0x3001 | ||
| 247 | #define WM8994_WRITE_SEQUENCER_2 0x3002 | ||
| 248 | #define WM8994_WRITE_SEQUENCER_3 0x3003 | ||
| 249 | #define WM8994_WRITE_SEQUENCER_4 0x3004 | ||
| 250 | #define WM8994_WRITE_SEQUENCER_5 0x3005 | ||
| 251 | #define WM8994_WRITE_SEQUENCER_6 0x3006 | ||
| 252 | #define WM8994_WRITE_SEQUENCER_7 0x3007 | ||
| 253 | #define WM8994_WRITE_SEQUENCER_8 0x3008 | ||
| 254 | #define WM8994_WRITE_SEQUENCER_9 0x3009 | ||
| 255 | #define WM8994_WRITE_SEQUENCER_10 0x300A | ||
| 256 | #define WM8994_WRITE_SEQUENCER_11 0x300B | ||
| 257 | #define WM8994_WRITE_SEQUENCER_12 0x300C | ||
| 258 | #define WM8994_WRITE_SEQUENCER_13 0x300D | ||
| 259 | #define WM8994_WRITE_SEQUENCER_14 0x300E | ||
| 260 | #define WM8994_WRITE_SEQUENCER_15 0x300F | ||
| 261 | #define WM8994_WRITE_SEQUENCER_16 0x3010 | ||
| 262 | #define WM8994_WRITE_SEQUENCER_17 0x3011 | ||
| 263 | #define WM8994_WRITE_SEQUENCER_18 0x3012 | ||
| 264 | #define WM8994_WRITE_SEQUENCER_19 0x3013 | ||
| 265 | #define WM8994_WRITE_SEQUENCER_20 0x3014 | ||
| 266 | #define WM8994_WRITE_SEQUENCER_21 0x3015 | ||
| 267 | #define WM8994_WRITE_SEQUENCER_22 0x3016 | ||
| 268 | #define WM8994_WRITE_SEQUENCER_23 0x3017 | ||
| 269 | #define WM8994_WRITE_SEQUENCER_24 0x3018 | ||
| 270 | #define WM8994_WRITE_SEQUENCER_25 0x3019 | ||
| 271 | #define WM8994_WRITE_SEQUENCER_26 0x301A | ||
| 272 | #define WM8994_WRITE_SEQUENCER_27 0x301B | ||
| 273 | #define WM8994_WRITE_SEQUENCER_28 0x301C | ||
| 274 | #define WM8994_WRITE_SEQUENCER_29 0x301D | ||
| 275 | #define WM8994_WRITE_SEQUENCER_30 0x301E | ||
| 276 | #define WM8994_WRITE_SEQUENCER_31 0x301F | ||
| 277 | #define WM8994_WRITE_SEQUENCER_32 0x3020 | ||
| 278 | #define WM8994_WRITE_SEQUENCER_33 0x3021 | ||
| 279 | #define WM8994_WRITE_SEQUENCER_34 0x3022 | ||
| 280 | #define WM8994_WRITE_SEQUENCER_35 0x3023 | ||
| 281 | #define WM8994_WRITE_SEQUENCER_36 0x3024 | ||
| 282 | #define WM8994_WRITE_SEQUENCER_37 0x3025 | ||
| 283 | #define WM8994_WRITE_SEQUENCER_38 0x3026 | ||
| 284 | #define WM8994_WRITE_SEQUENCER_39 0x3027 | ||
| 285 | #define WM8994_WRITE_SEQUENCER_40 0x3028 | ||
| 286 | #define WM8994_WRITE_SEQUENCER_41 0x3029 | ||
| 287 | #define WM8994_WRITE_SEQUENCER_42 0x302A | ||
| 288 | #define WM8994_WRITE_SEQUENCER_43 0x302B | ||
| 289 | #define WM8994_WRITE_SEQUENCER_44 0x302C | ||
| 290 | #define WM8994_WRITE_SEQUENCER_45 0x302D | ||
| 291 | #define WM8994_WRITE_SEQUENCER_46 0x302E | ||
| 292 | #define WM8994_WRITE_SEQUENCER_47 0x302F | ||
| 293 | #define WM8994_WRITE_SEQUENCER_48 0x3030 | ||
| 294 | #define WM8994_WRITE_SEQUENCER_49 0x3031 | ||
| 295 | #define WM8994_WRITE_SEQUENCER_50 0x3032 | ||
| 296 | #define WM8994_WRITE_SEQUENCER_51 0x3033 | ||
| 297 | #define WM8994_WRITE_SEQUENCER_52 0x3034 | ||
| 298 | #define WM8994_WRITE_SEQUENCER_53 0x3035 | ||
| 299 | #define WM8994_WRITE_SEQUENCER_54 0x3036 | ||
| 300 | #define WM8994_WRITE_SEQUENCER_55 0x3037 | ||
| 301 | #define WM8994_WRITE_SEQUENCER_56 0x3038 | ||
| 302 | #define WM8994_WRITE_SEQUENCER_57 0x3039 | ||
| 303 | #define WM8994_WRITE_SEQUENCER_58 0x303A | ||
| 304 | #define WM8994_WRITE_SEQUENCER_59 0x303B | ||
| 305 | #define WM8994_WRITE_SEQUENCER_60 0x303C | ||
| 306 | #define WM8994_WRITE_SEQUENCER_61 0x303D | ||
| 307 | #define WM8994_WRITE_SEQUENCER_62 0x303E | ||
| 308 | #define WM8994_WRITE_SEQUENCER_63 0x303F | ||
| 309 | #define WM8994_WRITE_SEQUENCER_64 0x3040 | ||
| 310 | #define WM8994_WRITE_SEQUENCER_65 0x3041 | ||
| 311 | #define WM8994_WRITE_SEQUENCER_66 0x3042 | ||
| 312 | #define WM8994_WRITE_SEQUENCER_67 0x3043 | ||
| 313 | #define WM8994_WRITE_SEQUENCER_68 0x3044 | ||
| 314 | #define WM8994_WRITE_SEQUENCER_69 0x3045 | ||
| 315 | #define WM8994_WRITE_SEQUENCER_70 0x3046 | ||
| 316 | #define WM8994_WRITE_SEQUENCER_71 0x3047 | ||
| 317 | #define WM8994_WRITE_SEQUENCER_72 0x3048 | ||
| 318 | #define WM8994_WRITE_SEQUENCER_73 0x3049 | ||
| 319 | #define WM8994_WRITE_SEQUENCER_74 0x304A | ||
| 320 | #define WM8994_WRITE_SEQUENCER_75 0x304B | ||
| 321 | #define WM8994_WRITE_SEQUENCER_76 0x304C | ||
| 322 | #define WM8994_WRITE_SEQUENCER_77 0x304D | ||
| 323 | #define WM8994_WRITE_SEQUENCER_78 0x304E | ||
| 324 | #define WM8994_WRITE_SEQUENCER_79 0x304F | ||
| 325 | #define WM8994_WRITE_SEQUENCER_80 0x3050 | ||
| 326 | #define WM8994_WRITE_SEQUENCER_81 0x3051 | ||
| 327 | #define WM8994_WRITE_SEQUENCER_82 0x3052 | ||
| 328 | #define WM8994_WRITE_SEQUENCER_83 0x3053 | ||
| 329 | #define WM8994_WRITE_SEQUENCER_84 0x3054 | ||
| 330 | #define WM8994_WRITE_SEQUENCER_85 0x3055 | ||
| 331 | #define WM8994_WRITE_SEQUENCER_86 0x3056 | ||
| 332 | #define WM8994_WRITE_SEQUENCER_87 0x3057 | ||
| 333 | #define WM8994_WRITE_SEQUENCER_88 0x3058 | ||
| 334 | #define WM8994_WRITE_SEQUENCER_89 0x3059 | ||
| 335 | #define WM8994_WRITE_SEQUENCER_90 0x305A | ||
| 336 | #define WM8994_WRITE_SEQUENCER_91 0x305B | ||
| 337 | #define WM8994_WRITE_SEQUENCER_92 0x305C | ||
| 338 | #define WM8994_WRITE_SEQUENCER_93 0x305D | ||
| 339 | #define WM8994_WRITE_SEQUENCER_94 0x305E | ||
| 340 | #define WM8994_WRITE_SEQUENCER_95 0x305F | ||
| 341 | #define WM8994_WRITE_SEQUENCER_96 0x3060 | ||
| 342 | #define WM8994_WRITE_SEQUENCER_97 0x3061 | ||
| 343 | #define WM8994_WRITE_SEQUENCER_98 0x3062 | ||
| 344 | #define WM8994_WRITE_SEQUENCER_99 0x3063 | ||
| 345 | #define WM8994_WRITE_SEQUENCER_100 0x3064 | ||
| 346 | #define WM8994_WRITE_SEQUENCER_101 0x3065 | ||
| 347 | #define WM8994_WRITE_SEQUENCER_102 0x3066 | ||
| 348 | #define WM8994_WRITE_SEQUENCER_103 0x3067 | ||
| 349 | #define WM8994_WRITE_SEQUENCER_104 0x3068 | ||
| 350 | #define WM8994_WRITE_SEQUENCER_105 0x3069 | ||
| 351 | #define WM8994_WRITE_SEQUENCER_106 0x306A | ||
| 352 | #define WM8994_WRITE_SEQUENCER_107 0x306B | ||
| 353 | #define WM8994_WRITE_SEQUENCER_108 0x306C | ||
| 354 | #define WM8994_WRITE_SEQUENCER_109 0x306D | ||
| 355 | #define WM8994_WRITE_SEQUENCER_110 0x306E | ||
| 356 | #define WM8994_WRITE_SEQUENCER_111 0x306F | ||
| 357 | #define WM8994_WRITE_SEQUENCER_112 0x3070 | ||
| 358 | #define WM8994_WRITE_SEQUENCER_113 0x3071 | ||
| 359 | #define WM8994_WRITE_SEQUENCER_114 0x3072 | ||
| 360 | #define WM8994_WRITE_SEQUENCER_115 0x3073 | ||
| 361 | #define WM8994_WRITE_SEQUENCER_116 0x3074 | ||
| 362 | #define WM8994_WRITE_SEQUENCER_117 0x3075 | ||
| 363 | #define WM8994_WRITE_SEQUENCER_118 0x3076 | ||
| 364 | #define WM8994_WRITE_SEQUENCER_119 0x3077 | ||
| 365 | #define WM8994_WRITE_SEQUENCER_120 0x3078 | ||
| 366 | #define WM8994_WRITE_SEQUENCER_121 0x3079 | ||
| 367 | #define WM8994_WRITE_SEQUENCER_122 0x307A | ||
| 368 | #define WM8994_WRITE_SEQUENCER_123 0x307B | ||
| 369 | #define WM8994_WRITE_SEQUENCER_124 0x307C | ||
| 370 | #define WM8994_WRITE_SEQUENCER_125 0x307D | ||
| 371 | #define WM8994_WRITE_SEQUENCER_126 0x307E | ||
| 372 | #define WM8994_WRITE_SEQUENCER_127 0x307F | ||
| 373 | #define WM8994_WRITE_SEQUENCER_128 0x3080 | ||
| 374 | #define WM8994_WRITE_SEQUENCER_129 0x3081 | ||
| 375 | #define WM8994_WRITE_SEQUENCER_130 0x3082 | ||
| 376 | #define WM8994_WRITE_SEQUENCER_131 0x3083 | ||
| 377 | #define WM8994_WRITE_SEQUENCER_132 0x3084 | ||
| 378 | #define WM8994_WRITE_SEQUENCER_133 0x3085 | ||
| 379 | #define WM8994_WRITE_SEQUENCER_134 0x3086 | ||
| 380 | #define WM8994_WRITE_SEQUENCER_135 0x3087 | ||
| 381 | #define WM8994_WRITE_SEQUENCER_136 0x3088 | ||
| 382 | #define WM8994_WRITE_SEQUENCER_137 0x3089 | ||
| 383 | #define WM8994_WRITE_SEQUENCER_138 0x308A | ||
| 384 | #define WM8994_WRITE_SEQUENCER_139 0x308B | ||
| 385 | #define WM8994_WRITE_SEQUENCER_140 0x308C | ||
| 386 | #define WM8994_WRITE_SEQUENCER_141 0x308D | ||
| 387 | #define WM8994_WRITE_SEQUENCER_142 0x308E | ||
| 388 | #define WM8994_WRITE_SEQUENCER_143 0x308F | ||
| 389 | #define WM8994_WRITE_SEQUENCER_144 0x3090 | ||
| 390 | #define WM8994_WRITE_SEQUENCER_145 0x3091 | ||
| 391 | #define WM8994_WRITE_SEQUENCER_146 0x3092 | ||
| 392 | #define WM8994_WRITE_SEQUENCER_147 0x3093 | ||
| 393 | #define WM8994_WRITE_SEQUENCER_148 0x3094 | ||
| 394 | #define WM8994_WRITE_SEQUENCER_149 0x3095 | ||
| 395 | #define WM8994_WRITE_SEQUENCER_150 0x3096 | ||
| 396 | #define WM8994_WRITE_SEQUENCER_151 0x3097 | ||
| 397 | #define WM8994_WRITE_SEQUENCER_152 0x3098 | ||
| 398 | #define WM8994_WRITE_SEQUENCER_153 0x3099 | ||
| 399 | #define WM8994_WRITE_SEQUENCER_154 0x309A | ||
| 400 | #define WM8994_WRITE_SEQUENCER_155 0x309B | ||
| 401 | #define WM8994_WRITE_SEQUENCER_156 0x309C | ||
| 402 | #define WM8994_WRITE_SEQUENCER_157 0x309D | ||
| 403 | #define WM8994_WRITE_SEQUENCER_158 0x309E | ||
| 404 | #define WM8994_WRITE_SEQUENCER_159 0x309F | ||
| 405 | #define WM8994_WRITE_SEQUENCER_160 0x30A0 | ||
| 406 | #define WM8994_WRITE_SEQUENCER_161 0x30A1 | ||
| 407 | #define WM8994_WRITE_SEQUENCER_162 0x30A2 | ||
| 408 | #define WM8994_WRITE_SEQUENCER_163 0x30A3 | ||
| 409 | #define WM8994_WRITE_SEQUENCER_164 0x30A4 | ||
| 410 | #define WM8994_WRITE_SEQUENCER_165 0x30A5 | ||
| 411 | #define WM8994_WRITE_SEQUENCER_166 0x30A6 | ||
| 412 | #define WM8994_WRITE_SEQUENCER_167 0x30A7 | ||
| 413 | #define WM8994_WRITE_SEQUENCER_168 0x30A8 | ||
| 414 | #define WM8994_WRITE_SEQUENCER_169 0x30A9 | ||
| 415 | #define WM8994_WRITE_SEQUENCER_170 0x30AA | ||
| 416 | #define WM8994_WRITE_SEQUENCER_171 0x30AB | ||
| 417 | #define WM8994_WRITE_SEQUENCER_172 0x30AC | ||
| 418 | #define WM8994_WRITE_SEQUENCER_173 0x30AD | ||
| 419 | #define WM8994_WRITE_SEQUENCER_174 0x30AE | ||
| 420 | #define WM8994_WRITE_SEQUENCER_175 0x30AF | ||
| 421 | #define WM8994_WRITE_SEQUENCER_176 0x30B0 | ||
| 422 | #define WM8994_WRITE_SEQUENCER_177 0x30B1 | ||
| 423 | #define WM8994_WRITE_SEQUENCER_178 0x30B2 | ||
| 424 | #define WM8994_WRITE_SEQUENCER_179 0x30B3 | ||
| 425 | #define WM8994_WRITE_SEQUENCER_180 0x30B4 | ||
| 426 | #define WM8994_WRITE_SEQUENCER_181 0x30B5 | ||
| 427 | #define WM8994_WRITE_SEQUENCER_182 0x30B6 | ||
| 428 | #define WM8994_WRITE_SEQUENCER_183 0x30B7 | ||
| 429 | #define WM8994_WRITE_SEQUENCER_184 0x30B8 | ||
| 430 | #define WM8994_WRITE_SEQUENCER_185 0x30B9 | ||
| 431 | #define WM8994_WRITE_SEQUENCER_186 0x30BA | ||
| 432 | #define WM8994_WRITE_SEQUENCER_187 0x30BB | ||
| 433 | #define WM8994_WRITE_SEQUENCER_188 0x30BC | ||
| 434 | #define WM8994_WRITE_SEQUENCER_189 0x30BD | ||
| 435 | #define WM8994_WRITE_SEQUENCER_190 0x30BE | ||
| 436 | #define WM8994_WRITE_SEQUENCER_191 0x30BF | ||
| 437 | #define WM8994_WRITE_SEQUENCER_192 0x30C0 | ||
| 438 | #define WM8994_WRITE_SEQUENCER_193 0x30C1 | ||
| 439 | #define WM8994_WRITE_SEQUENCER_194 0x30C2 | ||
| 440 | #define WM8994_WRITE_SEQUENCER_195 0x30C3 | ||
| 441 | #define WM8994_WRITE_SEQUENCER_196 0x30C4 | ||
| 442 | #define WM8994_WRITE_SEQUENCER_197 0x30C5 | ||
| 443 | #define WM8994_WRITE_SEQUENCER_198 0x30C6 | ||
| 444 | #define WM8994_WRITE_SEQUENCER_199 0x30C7 | ||
| 445 | #define WM8994_WRITE_SEQUENCER_200 0x30C8 | ||
| 446 | #define WM8994_WRITE_SEQUENCER_201 0x30C9 | ||
| 447 | #define WM8994_WRITE_SEQUENCER_202 0x30CA | ||
| 448 | #define WM8994_WRITE_SEQUENCER_203 0x30CB | ||
| 449 | #define WM8994_WRITE_SEQUENCER_204 0x30CC | ||
| 450 | #define WM8994_WRITE_SEQUENCER_205 0x30CD | ||
| 451 | #define WM8994_WRITE_SEQUENCER_206 0x30CE | ||
| 452 | #define WM8994_WRITE_SEQUENCER_207 0x30CF | ||
| 453 | #define WM8994_WRITE_SEQUENCER_208 0x30D0 | ||
| 454 | #define WM8994_WRITE_SEQUENCER_209 0x30D1 | ||
| 455 | #define WM8994_WRITE_SEQUENCER_210 0x30D2 | ||
| 456 | #define WM8994_WRITE_SEQUENCER_211 0x30D3 | ||
| 457 | #define WM8994_WRITE_SEQUENCER_212 0x30D4 | ||
| 458 | #define WM8994_WRITE_SEQUENCER_213 0x30D5 | ||
| 459 | #define WM8994_WRITE_SEQUENCER_214 0x30D6 | ||
| 460 | #define WM8994_WRITE_SEQUENCER_215 0x30D7 | ||
| 461 | #define WM8994_WRITE_SEQUENCER_216 0x30D8 | ||
| 462 | #define WM8994_WRITE_SEQUENCER_217 0x30D9 | ||
| 463 | #define WM8994_WRITE_SEQUENCER_218 0x30DA | ||
| 464 | #define WM8994_WRITE_SEQUENCER_219 0x30DB | ||
| 465 | #define WM8994_WRITE_SEQUENCER_220 0x30DC | ||
| 466 | #define WM8994_WRITE_SEQUENCER_221 0x30DD | ||
| 467 | #define WM8994_WRITE_SEQUENCER_222 0x30DE | ||
| 468 | #define WM8994_WRITE_SEQUENCER_223 0x30DF | ||
| 469 | #define WM8994_WRITE_SEQUENCER_224 0x30E0 | ||
| 470 | #define WM8994_WRITE_SEQUENCER_225 0x30E1 | ||
| 471 | #define WM8994_WRITE_SEQUENCER_226 0x30E2 | ||
| 472 | #define WM8994_WRITE_SEQUENCER_227 0x30E3 | ||
| 473 | #define WM8994_WRITE_SEQUENCER_228 0x30E4 | ||
| 474 | #define WM8994_WRITE_SEQUENCER_229 0x30E5 | ||
| 475 | #define WM8994_WRITE_SEQUENCER_230 0x30E6 | ||
| 476 | #define WM8994_WRITE_SEQUENCER_231 0x30E7 | ||
| 477 | #define WM8994_WRITE_SEQUENCER_232 0x30E8 | ||
| 478 | #define WM8994_WRITE_SEQUENCER_233 0x30E9 | ||
| 479 | #define WM8994_WRITE_SEQUENCER_234 0x30EA | ||
| 480 | #define WM8994_WRITE_SEQUENCER_235 0x30EB | ||
| 481 | #define WM8994_WRITE_SEQUENCER_236 0x30EC | ||
| 482 | #define WM8994_WRITE_SEQUENCER_237 0x30ED | ||
| 483 | #define WM8994_WRITE_SEQUENCER_238 0x30EE | ||
| 484 | #define WM8994_WRITE_SEQUENCER_239 0x30EF | ||
| 485 | #define WM8994_WRITE_SEQUENCER_240 0x30F0 | ||
| 486 | #define WM8994_WRITE_SEQUENCER_241 0x30F1 | ||
| 487 | #define WM8994_WRITE_SEQUENCER_242 0x30F2 | ||
| 488 | #define WM8994_WRITE_SEQUENCER_243 0x30F3 | ||
| 489 | #define WM8994_WRITE_SEQUENCER_244 0x30F4 | ||
| 490 | #define WM8994_WRITE_SEQUENCER_245 0x30F5 | ||
| 491 | #define WM8994_WRITE_SEQUENCER_246 0x30F6 | ||
| 492 | #define WM8994_WRITE_SEQUENCER_247 0x30F7 | ||
| 493 | #define WM8994_WRITE_SEQUENCER_248 0x30F8 | ||
| 494 | #define WM8994_WRITE_SEQUENCER_249 0x30F9 | ||
| 495 | #define WM8994_WRITE_SEQUENCER_250 0x30FA | ||
| 496 | #define WM8994_WRITE_SEQUENCER_251 0x30FB | ||
| 497 | #define WM8994_WRITE_SEQUENCER_252 0x30FC | ||
| 498 | #define WM8994_WRITE_SEQUENCER_253 0x30FD | ||
| 499 | #define WM8994_WRITE_SEQUENCER_254 0x30FE | ||
| 500 | #define WM8994_WRITE_SEQUENCER_255 0x30FF | ||
| 501 | #define WM8994_WRITE_SEQUENCER_256 0x3100 | ||
| 502 | #define WM8994_WRITE_SEQUENCER_257 0x3101 | ||
| 503 | #define WM8994_WRITE_SEQUENCER_258 0x3102 | ||
| 504 | #define WM8994_WRITE_SEQUENCER_259 0x3103 | ||
| 505 | #define WM8994_WRITE_SEQUENCER_260 0x3104 | ||
| 506 | #define WM8994_WRITE_SEQUENCER_261 0x3105 | ||
| 507 | #define WM8994_WRITE_SEQUENCER_262 0x3106 | ||
| 508 | #define WM8994_WRITE_SEQUENCER_263 0x3107 | ||
| 509 | #define WM8994_WRITE_SEQUENCER_264 0x3108 | ||
| 510 | #define WM8994_WRITE_SEQUENCER_265 0x3109 | ||
| 511 | #define WM8994_WRITE_SEQUENCER_266 0x310A | ||
| 512 | #define WM8994_WRITE_SEQUENCER_267 0x310B | ||
| 513 | #define WM8994_WRITE_SEQUENCER_268 0x310C | ||
| 514 | #define WM8994_WRITE_SEQUENCER_269 0x310D | ||
| 515 | #define WM8994_WRITE_SEQUENCER_270 0x310E | ||
| 516 | #define WM8994_WRITE_SEQUENCER_271 0x310F | ||
| 517 | #define WM8994_WRITE_SEQUENCER_272 0x3110 | ||
| 518 | #define WM8994_WRITE_SEQUENCER_273 0x3111 | ||
| 519 | #define WM8994_WRITE_SEQUENCER_274 0x3112 | ||
| 520 | #define WM8994_WRITE_SEQUENCER_275 0x3113 | ||
| 521 | #define WM8994_WRITE_SEQUENCER_276 0x3114 | ||
| 522 | #define WM8994_WRITE_SEQUENCER_277 0x3115 | ||
| 523 | #define WM8994_WRITE_SEQUENCER_278 0x3116 | ||
| 524 | #define WM8994_WRITE_SEQUENCER_279 0x3117 | ||
| 525 | #define WM8994_WRITE_SEQUENCER_280 0x3118 | ||
| 526 | #define WM8994_WRITE_SEQUENCER_281 0x3119 | ||
| 527 | #define WM8994_WRITE_SEQUENCER_282 0x311A | ||
| 528 | #define WM8994_WRITE_SEQUENCER_283 0x311B | ||
| 529 | #define WM8994_WRITE_SEQUENCER_284 0x311C | ||
| 530 | #define WM8994_WRITE_SEQUENCER_285 0x311D | ||
| 531 | #define WM8994_WRITE_SEQUENCER_286 0x311E | ||
| 532 | #define WM8994_WRITE_SEQUENCER_287 0x311F | ||
| 533 | #define WM8994_WRITE_SEQUENCER_288 0x3120 | ||
| 534 | #define WM8994_WRITE_SEQUENCER_289 0x3121 | ||
| 535 | #define WM8994_WRITE_SEQUENCER_290 0x3122 | ||
| 536 | #define WM8994_WRITE_SEQUENCER_291 0x3123 | ||
| 537 | #define WM8994_WRITE_SEQUENCER_292 0x3124 | ||
| 538 | #define WM8994_WRITE_SEQUENCER_293 0x3125 | ||
| 539 | #define WM8994_WRITE_SEQUENCER_294 0x3126 | ||
| 540 | #define WM8994_WRITE_SEQUENCER_295 0x3127 | ||
| 541 | #define WM8994_WRITE_SEQUENCER_296 0x3128 | ||
| 542 | #define WM8994_WRITE_SEQUENCER_297 0x3129 | ||
| 543 | #define WM8994_WRITE_SEQUENCER_298 0x312A | ||
| 544 | #define WM8994_WRITE_SEQUENCER_299 0x312B | ||
| 545 | #define WM8994_WRITE_SEQUENCER_300 0x312C | ||
| 546 | #define WM8994_WRITE_SEQUENCER_301 0x312D | ||
| 547 | #define WM8994_WRITE_SEQUENCER_302 0x312E | ||
| 548 | #define WM8994_WRITE_SEQUENCER_303 0x312F | ||
| 549 | #define WM8994_WRITE_SEQUENCER_304 0x3130 | ||
| 550 | #define WM8994_WRITE_SEQUENCER_305 0x3131 | ||
| 551 | #define WM8994_WRITE_SEQUENCER_306 0x3132 | ||
| 552 | #define WM8994_WRITE_SEQUENCER_307 0x3133 | ||
| 553 | #define WM8994_WRITE_SEQUENCER_308 0x3134 | ||
| 554 | #define WM8994_WRITE_SEQUENCER_309 0x3135 | ||
| 555 | #define WM8994_WRITE_SEQUENCER_310 0x3136 | ||
| 556 | #define WM8994_WRITE_SEQUENCER_311 0x3137 | ||
| 557 | #define WM8994_WRITE_SEQUENCER_312 0x3138 | ||
| 558 | #define WM8994_WRITE_SEQUENCER_313 0x3139 | ||
| 559 | #define WM8994_WRITE_SEQUENCER_314 0x313A | ||
| 560 | #define WM8994_WRITE_SEQUENCER_315 0x313B | ||
| 561 | #define WM8994_WRITE_SEQUENCER_316 0x313C | ||
| 562 | #define WM8994_WRITE_SEQUENCER_317 0x313D | ||
| 563 | #define WM8994_WRITE_SEQUENCER_318 0x313E | ||
| 564 | #define WM8994_WRITE_SEQUENCER_319 0x313F | ||
| 565 | #define WM8994_WRITE_SEQUENCER_320 0x3140 | ||
| 566 | #define WM8994_WRITE_SEQUENCER_321 0x3141 | ||
| 567 | #define WM8994_WRITE_SEQUENCER_322 0x3142 | ||
| 568 | #define WM8994_WRITE_SEQUENCER_323 0x3143 | ||
| 569 | #define WM8994_WRITE_SEQUENCER_324 0x3144 | ||
| 570 | #define WM8994_WRITE_SEQUENCER_325 0x3145 | ||
| 571 | #define WM8994_WRITE_SEQUENCER_326 0x3146 | ||
| 572 | #define WM8994_WRITE_SEQUENCER_327 0x3147 | ||
| 573 | #define WM8994_WRITE_SEQUENCER_328 0x3148 | ||
| 574 | #define WM8994_WRITE_SEQUENCER_329 0x3149 | ||
| 575 | #define WM8994_WRITE_SEQUENCER_330 0x314A | ||
| 576 | #define WM8994_WRITE_SEQUENCER_331 0x314B | ||
| 577 | #define WM8994_WRITE_SEQUENCER_332 0x314C | ||
| 578 | #define WM8994_WRITE_SEQUENCER_333 0x314D | ||
| 579 | #define WM8994_WRITE_SEQUENCER_334 0x314E | ||
| 580 | #define WM8994_WRITE_SEQUENCER_335 0x314F | ||
| 581 | #define WM8994_WRITE_SEQUENCER_336 0x3150 | ||
| 582 | #define WM8994_WRITE_SEQUENCER_337 0x3151 | ||
| 583 | #define WM8994_WRITE_SEQUENCER_338 0x3152 | ||
| 584 | #define WM8994_WRITE_SEQUENCER_339 0x3153 | ||
| 585 | #define WM8994_WRITE_SEQUENCER_340 0x3154 | ||
| 586 | #define WM8994_WRITE_SEQUENCER_341 0x3155 | ||
| 587 | #define WM8994_WRITE_SEQUENCER_342 0x3156 | ||
| 588 | #define WM8994_WRITE_SEQUENCER_343 0x3157 | ||
| 589 | #define WM8994_WRITE_SEQUENCER_344 0x3158 | ||
| 590 | #define WM8994_WRITE_SEQUENCER_345 0x3159 | ||
| 591 | #define WM8994_WRITE_SEQUENCER_346 0x315A | ||
| 592 | #define WM8994_WRITE_SEQUENCER_347 0x315B | ||
| 593 | #define WM8994_WRITE_SEQUENCER_348 0x315C | ||
| 594 | #define WM8994_WRITE_SEQUENCER_349 0x315D | ||
| 595 | #define WM8994_WRITE_SEQUENCER_350 0x315E | ||
| 596 | #define WM8994_WRITE_SEQUENCER_351 0x315F | ||
| 597 | #define WM8994_WRITE_SEQUENCER_352 0x3160 | ||
| 598 | #define WM8994_WRITE_SEQUENCER_353 0x3161 | ||
| 599 | #define WM8994_WRITE_SEQUENCER_354 0x3162 | ||
| 600 | #define WM8994_WRITE_SEQUENCER_355 0x3163 | ||
| 601 | #define WM8994_WRITE_SEQUENCER_356 0x3164 | ||
| 602 | #define WM8994_WRITE_SEQUENCER_357 0x3165 | ||
| 603 | #define WM8994_WRITE_SEQUENCER_358 0x3166 | ||
| 604 | #define WM8994_WRITE_SEQUENCER_359 0x3167 | ||
| 605 | #define WM8994_WRITE_SEQUENCER_360 0x3168 | ||
| 606 | #define WM8994_WRITE_SEQUENCER_361 0x3169 | ||
| 607 | #define WM8994_WRITE_SEQUENCER_362 0x316A | ||
| 608 | #define WM8994_WRITE_SEQUENCER_363 0x316B | ||
| 609 | #define WM8994_WRITE_SEQUENCER_364 0x316C | ||
| 610 | #define WM8994_WRITE_SEQUENCER_365 0x316D | ||
| 611 | #define WM8994_WRITE_SEQUENCER_366 0x316E | ||
| 612 | #define WM8994_WRITE_SEQUENCER_367 0x316F | ||
| 613 | #define WM8994_WRITE_SEQUENCER_368 0x3170 | ||
| 614 | #define WM8994_WRITE_SEQUENCER_369 0x3171 | ||
| 615 | #define WM8994_WRITE_SEQUENCER_370 0x3172 | ||
| 616 | #define WM8994_WRITE_SEQUENCER_371 0x3173 | ||
| 617 | #define WM8994_WRITE_SEQUENCER_372 0x3174 | ||
| 618 | #define WM8994_WRITE_SEQUENCER_373 0x3175 | ||
| 619 | #define WM8994_WRITE_SEQUENCER_374 0x3176 | ||
| 620 | #define WM8994_WRITE_SEQUENCER_375 0x3177 | ||
| 621 | #define WM8994_WRITE_SEQUENCER_376 0x3178 | ||
| 622 | #define WM8994_WRITE_SEQUENCER_377 0x3179 | ||
| 623 | #define WM8994_WRITE_SEQUENCER_378 0x317A | ||
| 624 | #define WM8994_WRITE_SEQUENCER_379 0x317B | ||
| 625 | #define WM8994_WRITE_SEQUENCER_380 0x317C | ||
| 626 | #define WM8994_WRITE_SEQUENCER_381 0x317D | ||
| 627 | #define WM8994_WRITE_SEQUENCER_382 0x317E | ||
| 628 | #define WM8994_WRITE_SEQUENCER_383 0x317F | ||
| 629 | #define WM8994_WRITE_SEQUENCER_384 0x3180 | ||
| 630 | #define WM8994_WRITE_SEQUENCER_385 0x3181 | ||
| 631 | #define WM8994_WRITE_SEQUENCER_386 0x3182 | ||
| 632 | #define WM8994_WRITE_SEQUENCER_387 0x3183 | ||
| 633 | #define WM8994_WRITE_SEQUENCER_388 0x3184 | ||
| 634 | #define WM8994_WRITE_SEQUENCER_389 0x3185 | ||
| 635 | #define WM8994_WRITE_SEQUENCER_390 0x3186 | ||
| 636 | #define WM8994_WRITE_SEQUENCER_391 0x3187 | ||
| 637 | #define WM8994_WRITE_SEQUENCER_392 0x3188 | ||
| 638 | #define WM8994_WRITE_SEQUENCER_393 0x3189 | ||
| 639 | #define WM8994_WRITE_SEQUENCER_394 0x318A | ||
| 640 | #define WM8994_WRITE_SEQUENCER_395 0x318B | ||
| 641 | #define WM8994_WRITE_SEQUENCER_396 0x318C | ||
| 642 | #define WM8994_WRITE_SEQUENCER_397 0x318D | ||
| 643 | #define WM8994_WRITE_SEQUENCER_398 0x318E | ||
| 644 | #define WM8994_WRITE_SEQUENCER_399 0x318F | ||
| 645 | #define WM8994_WRITE_SEQUENCER_400 0x3190 | ||
| 646 | #define WM8994_WRITE_SEQUENCER_401 0x3191 | ||
| 647 | #define WM8994_WRITE_SEQUENCER_402 0x3192 | ||
| 648 | #define WM8994_WRITE_SEQUENCER_403 0x3193 | ||
| 649 | #define WM8994_WRITE_SEQUENCER_404 0x3194 | ||
| 650 | #define WM8994_WRITE_SEQUENCER_405 0x3195 | ||
| 651 | #define WM8994_WRITE_SEQUENCER_406 0x3196 | ||
| 652 | #define WM8994_WRITE_SEQUENCER_407 0x3197 | ||
| 653 | #define WM8994_WRITE_SEQUENCER_408 0x3198 | ||
| 654 | #define WM8994_WRITE_SEQUENCER_409 0x3199 | ||
| 655 | #define WM8994_WRITE_SEQUENCER_410 0x319A | ||
| 656 | #define WM8994_WRITE_SEQUENCER_411 0x319B | ||
| 657 | #define WM8994_WRITE_SEQUENCER_412 0x319C | ||
| 658 | #define WM8994_WRITE_SEQUENCER_413 0x319D | ||
| 659 | #define WM8994_WRITE_SEQUENCER_414 0x319E | ||
| 660 | #define WM8994_WRITE_SEQUENCER_415 0x319F | ||
| 661 | #define WM8994_WRITE_SEQUENCER_416 0x31A0 | ||
| 662 | #define WM8994_WRITE_SEQUENCER_417 0x31A1 | ||
| 663 | #define WM8994_WRITE_SEQUENCER_418 0x31A2 | ||
| 664 | #define WM8994_WRITE_SEQUENCER_419 0x31A3 | ||
| 665 | #define WM8994_WRITE_SEQUENCER_420 0x31A4 | ||
| 666 | #define WM8994_WRITE_SEQUENCER_421 0x31A5 | ||
| 667 | #define WM8994_WRITE_SEQUENCER_422 0x31A6 | ||
| 668 | #define WM8994_WRITE_SEQUENCER_423 0x31A7 | ||
| 669 | #define WM8994_WRITE_SEQUENCER_424 0x31A8 | ||
| 670 | #define WM8994_WRITE_SEQUENCER_425 0x31A9 | ||
| 671 | #define WM8994_WRITE_SEQUENCER_426 0x31AA | ||
| 672 | #define WM8994_WRITE_SEQUENCER_427 0x31AB | ||
| 673 | #define WM8994_WRITE_SEQUENCER_428 0x31AC | ||
| 674 | #define WM8994_WRITE_SEQUENCER_429 0x31AD | ||
| 675 | #define WM8994_WRITE_SEQUENCER_430 0x31AE | ||
| 676 | #define WM8994_WRITE_SEQUENCER_431 0x31AF | ||
| 677 | #define WM8994_WRITE_SEQUENCER_432 0x31B0 | ||
| 678 | #define WM8994_WRITE_SEQUENCER_433 0x31B1 | ||
| 679 | #define WM8994_WRITE_SEQUENCER_434 0x31B2 | ||
| 680 | #define WM8994_WRITE_SEQUENCER_435 0x31B3 | ||
| 681 | #define WM8994_WRITE_SEQUENCER_436 0x31B4 | ||
| 682 | #define WM8994_WRITE_SEQUENCER_437 0x31B5 | ||
| 683 | #define WM8994_WRITE_SEQUENCER_438 0x31B6 | ||
| 684 | #define WM8994_WRITE_SEQUENCER_439 0x31B7 | ||
| 685 | #define WM8994_WRITE_SEQUENCER_440 0x31B8 | ||
| 686 | #define WM8994_WRITE_SEQUENCER_441 0x31B9 | ||
| 687 | #define WM8994_WRITE_SEQUENCER_442 0x31BA | ||
| 688 | #define WM8994_WRITE_SEQUENCER_443 0x31BB | ||
| 689 | #define WM8994_WRITE_SEQUENCER_444 0x31BC | ||
| 690 | #define WM8994_WRITE_SEQUENCER_445 0x31BD | ||
| 691 | #define WM8994_WRITE_SEQUENCER_446 0x31BE | ||
| 692 | #define WM8994_WRITE_SEQUENCER_447 0x31BF | ||
| 693 | #define WM8994_WRITE_SEQUENCER_448 0x31C0 | ||
| 694 | #define WM8994_WRITE_SEQUENCER_449 0x31C1 | ||
| 695 | #define WM8994_WRITE_SEQUENCER_450 0x31C2 | ||
| 696 | #define WM8994_WRITE_SEQUENCER_451 0x31C3 | ||
| 697 | #define WM8994_WRITE_SEQUENCER_452 0x31C4 | ||
| 698 | #define WM8994_WRITE_SEQUENCER_453 0x31C5 | ||
| 699 | #define WM8994_WRITE_SEQUENCER_454 0x31C6 | ||
| 700 | #define WM8994_WRITE_SEQUENCER_455 0x31C7 | ||
| 701 | #define WM8994_WRITE_SEQUENCER_456 0x31C8 | ||
| 702 | #define WM8994_WRITE_SEQUENCER_457 0x31C9 | ||
| 703 | #define WM8994_WRITE_SEQUENCER_458 0x31CA | ||
| 704 | #define WM8994_WRITE_SEQUENCER_459 0x31CB | ||
| 705 | #define WM8994_WRITE_SEQUENCER_460 0x31CC | ||
| 706 | #define WM8994_WRITE_SEQUENCER_461 0x31CD | ||
| 707 | #define WM8994_WRITE_SEQUENCER_462 0x31CE | ||
| 708 | #define WM8994_WRITE_SEQUENCER_463 0x31CF | ||
| 709 | #define WM8994_WRITE_SEQUENCER_464 0x31D0 | ||
| 710 | #define WM8994_WRITE_SEQUENCER_465 0x31D1 | ||
| 711 | #define WM8994_WRITE_SEQUENCER_466 0x31D2 | ||
| 712 | #define WM8994_WRITE_SEQUENCER_467 0x31D3 | ||
| 713 | #define WM8994_WRITE_SEQUENCER_468 0x31D4 | ||
| 714 | #define WM8994_WRITE_SEQUENCER_469 0x31D5 | ||
| 715 | #define WM8994_WRITE_SEQUENCER_470 0x31D6 | ||
| 716 | #define WM8994_WRITE_SEQUENCER_471 0x31D7 | ||
| 717 | #define WM8994_WRITE_SEQUENCER_472 0x31D8 | ||
| 718 | #define WM8994_WRITE_SEQUENCER_473 0x31D9 | ||
| 719 | #define WM8994_WRITE_SEQUENCER_474 0x31DA | ||
| 720 | #define WM8994_WRITE_SEQUENCER_475 0x31DB | ||
| 721 | #define WM8994_WRITE_SEQUENCER_476 0x31DC | ||
| 722 | #define WM8994_WRITE_SEQUENCER_477 0x31DD | ||
| 723 | #define WM8994_WRITE_SEQUENCER_478 0x31DE | ||
| 724 | #define WM8994_WRITE_SEQUENCER_479 0x31DF | ||
| 725 | #define WM8994_WRITE_SEQUENCER_480 0x31E0 | ||
| 726 | #define WM8994_WRITE_SEQUENCER_481 0x31E1 | ||
| 727 | #define WM8994_WRITE_SEQUENCER_482 0x31E2 | ||
| 728 | #define WM8994_WRITE_SEQUENCER_483 0x31E3 | ||
| 729 | #define WM8994_WRITE_SEQUENCER_484 0x31E4 | ||
| 730 | #define WM8994_WRITE_SEQUENCER_485 0x31E5 | ||
| 731 | #define WM8994_WRITE_SEQUENCER_486 0x31E6 | ||
| 732 | #define WM8994_WRITE_SEQUENCER_487 0x31E7 | ||
| 733 | #define WM8994_WRITE_SEQUENCER_488 0x31E8 | ||
| 734 | #define WM8994_WRITE_SEQUENCER_489 0x31E9 | ||
| 735 | #define WM8994_WRITE_SEQUENCER_490 0x31EA | ||
| 736 | #define WM8994_WRITE_SEQUENCER_491 0x31EB | ||
| 737 | #define WM8994_WRITE_SEQUENCER_492 0x31EC | ||
| 738 | #define WM8994_WRITE_SEQUENCER_493 0x31ED | ||
| 739 | #define WM8994_WRITE_SEQUENCER_494 0x31EE | ||
| 740 | #define WM8994_WRITE_SEQUENCER_495 0x31EF | ||
| 741 | #define WM8994_WRITE_SEQUENCER_496 0x31F0 | ||
| 742 | #define WM8994_WRITE_SEQUENCER_497 0x31F1 | ||
| 743 | #define WM8994_WRITE_SEQUENCER_498 0x31F2 | ||
| 744 | #define WM8994_WRITE_SEQUENCER_499 0x31F3 | ||
| 745 | #define WM8994_WRITE_SEQUENCER_500 0x31F4 | ||
| 746 | #define WM8994_WRITE_SEQUENCER_501 0x31F5 | ||
| 747 | #define WM8994_WRITE_SEQUENCER_502 0x31F6 | ||
| 748 | #define WM8994_WRITE_SEQUENCER_503 0x31F7 | ||
| 749 | #define WM8994_WRITE_SEQUENCER_504 0x31F8 | ||
| 750 | #define WM8994_WRITE_SEQUENCER_505 0x31F9 | ||
| 751 | #define WM8994_WRITE_SEQUENCER_506 0x31FA | ||
| 752 | #define WM8994_WRITE_SEQUENCER_507 0x31FB | ||
| 753 | #define WM8994_WRITE_SEQUENCER_508 0x31FC | ||
| 754 | #define WM8994_WRITE_SEQUENCER_509 0x31FD | ||
| 755 | #define WM8994_WRITE_SEQUENCER_510 0x31FE | ||
| 756 | #define WM8994_WRITE_SEQUENCER_511 0x31FF | ||
| 757 | |||
| 758 | #define WM8994_REGISTER_COUNT 736 | ||
| 759 | #define WM8994_MAX_REGISTER 0x31FF | ||
| 760 | #define WM8994_MAX_CACHED_REGISTER 0x749 | ||
| 761 | |||
| 762 | /* | ||
| 763 | * Field Definitions. | ||
| 764 | */ | ||
| 765 | |||
| 766 | /* | ||
| 767 | * R0 (0x00) - Software Reset | ||
| 768 | */ | ||
| 769 | #define WM8994_SW_RESET_MASK 0xFFFF /* SW_RESET - [15:0] */ | ||
| 770 | #define WM8994_SW_RESET_SHIFT 0 /* SW_RESET - [15:0] */ | ||
| 771 | #define WM8994_SW_RESET_WIDTH 16 /* SW_RESET - [15:0] */ | ||
| 772 | |||
| 773 | /* | ||
| 774 | * R1 (0x01) - Power Management (1) | ||
| 775 | */ | ||
| 776 | #define WM8994_SPKOUTR_ENA 0x2000 /* SPKOUTR_ENA */ | ||
| 777 | #define WM8994_SPKOUTR_ENA_MASK 0x2000 /* SPKOUTR_ENA */ | ||
| 778 | #define WM8994_SPKOUTR_ENA_SHIFT 13 /* SPKOUTR_ENA */ | ||
| 779 | #define WM8994_SPKOUTR_ENA_WIDTH 1 /* SPKOUTR_ENA */ | ||
| 780 | #define WM8994_SPKOUTL_ENA 0x1000 /* SPKOUTL_ENA */ | ||
| 781 | #define WM8994_SPKOUTL_ENA_MASK 0x1000 /* SPKOUTL_ENA */ | ||
| 782 | #define WM8994_SPKOUTL_ENA_SHIFT 12 /* SPKOUTL_ENA */ | ||
| 783 | #define WM8994_SPKOUTL_ENA_WIDTH 1 /* SPKOUTL_ENA */ | ||
| 784 | #define WM8994_HPOUT2_ENA 0x0800 /* HPOUT2_ENA */ | ||
| 785 | #define WM8994_HPOUT2_ENA_MASK 0x0800 /* HPOUT2_ENA */ | ||
| 786 | #define WM8994_HPOUT2_ENA_SHIFT 11 /* HPOUT2_ENA */ | ||
| 787 | #define WM8994_HPOUT2_ENA_WIDTH 1 /* HPOUT2_ENA */ | ||
| 788 | #define WM8994_HPOUT1L_ENA 0x0200 /* HPOUT1L_ENA */ | ||
| 789 | #define WM8994_HPOUT1L_ENA_MASK 0x0200 /* HPOUT1L_ENA */ | ||
| 790 | #define WM8994_HPOUT1L_ENA_SHIFT 9 /* HPOUT1L_ENA */ | ||
| 791 | #define WM8994_HPOUT1L_ENA_WIDTH 1 /* HPOUT1L_ENA */ | ||
| 792 | #define WM8994_HPOUT1R_ENA 0x0100 /* HPOUT1R_ENA */ | ||
| 793 | #define WM8994_HPOUT1R_ENA_MASK 0x0100 /* HPOUT1R_ENA */ | ||
| 794 | #define WM8994_HPOUT1R_ENA_SHIFT 8 /* HPOUT1R_ENA */ | ||
| 795 | #define WM8994_HPOUT1R_ENA_WIDTH 1 /* HPOUT1R_ENA */ | ||
| 796 | #define WM8994_MICB2_ENA 0x0020 /* MICB2_ENA */ | ||
| 797 | #define WM8994_MICB2_ENA_MASK 0x0020 /* MICB2_ENA */ | ||
| 798 | #define WM8994_MICB2_ENA_SHIFT 5 /* MICB2_ENA */ | ||
| 799 | #define WM8994_MICB2_ENA_WIDTH 1 /* MICB2_ENA */ | ||
| 800 | #define WM8994_MICB1_ENA 0x0010 /* MICB1_ENA */ | ||
| 801 | #define WM8994_MICB1_ENA_MASK 0x0010 /* MICB1_ENA */ | ||
| 802 | #define WM8994_MICB1_ENA_SHIFT 4 /* MICB1_ENA */ | ||
| 803 | #define WM8994_MICB1_ENA_WIDTH 1 /* MICB1_ENA */ | ||
| 804 | #define WM8994_VMID_SEL_MASK 0x0006 /* VMID_SEL - [2:1] */ | ||
| 805 | #define WM8994_VMID_SEL_SHIFT 1 /* VMID_SEL - [2:1] */ | ||
| 806 | #define WM8994_VMID_SEL_WIDTH 2 /* VMID_SEL - [2:1] */ | ||
| 807 | #define WM8994_BIAS_ENA 0x0001 /* BIAS_ENA */ | ||
| 808 | #define WM8994_BIAS_ENA_MASK 0x0001 /* BIAS_ENA */ | ||
| 809 | #define WM8994_BIAS_ENA_SHIFT 0 /* BIAS_ENA */ | ||
| 810 | #define WM8994_BIAS_ENA_WIDTH 1 /* BIAS_ENA */ | ||
| 811 | |||
| 812 | /* | ||
| 813 | * R2 (0x02) - Power Management (2) | ||
| 814 | */ | ||
| 815 | #define WM8994_TSHUT_ENA 0x4000 /* TSHUT_ENA */ | ||
| 816 | #define WM8994_TSHUT_ENA_MASK 0x4000 /* TSHUT_ENA */ | ||
| 817 | #define WM8994_TSHUT_ENA_SHIFT 14 /* TSHUT_ENA */ | ||
| 818 | #define WM8994_TSHUT_ENA_WIDTH 1 /* TSHUT_ENA */ | ||
| 819 | #define WM8994_TSHUT_OPDIS 0x2000 /* TSHUT_OPDIS */ | ||
| 820 | #define WM8994_TSHUT_OPDIS_MASK 0x2000 /* TSHUT_OPDIS */ | ||
| 821 | #define WM8994_TSHUT_OPDIS_SHIFT 13 /* TSHUT_OPDIS */ | ||
| 822 | #define WM8994_TSHUT_OPDIS_WIDTH 1 /* TSHUT_OPDIS */ | ||
| 823 | #define WM8994_OPCLK_ENA 0x0800 /* OPCLK_ENA */ | ||
| 824 | #define WM8994_OPCLK_ENA_MASK 0x0800 /* OPCLK_ENA */ | ||
| 825 | #define WM8994_OPCLK_ENA_SHIFT 11 /* OPCLK_ENA */ | ||
| 826 | #define WM8994_OPCLK_ENA_WIDTH 1 /* OPCLK_ENA */ | ||
| 827 | #define WM8994_MIXINL_ENA 0x0200 /* MIXINL_ENA */ | ||
| 828 | #define WM8994_MIXINL_ENA_MASK 0x0200 /* MIXINL_ENA */ | ||
| 829 | #define WM8994_MIXINL_ENA_SHIFT 9 /* MIXINL_ENA */ | ||
| 830 | #define WM8994_MIXINL_ENA_WIDTH 1 /* MIXINL_ENA */ | ||
| 831 | #define WM8994_MIXINR_ENA 0x0100 /* MIXINR_ENA */ | ||
| 832 | #define WM8994_MIXINR_ENA_MASK 0x0100 /* MIXINR_ENA */ | ||
| 833 | #define WM8994_MIXINR_ENA_SHIFT 8 /* MIXINR_ENA */ | ||
| 834 | #define WM8994_MIXINR_ENA_WIDTH 1 /* MIXINR_ENA */ | ||
| 835 | #define WM8994_IN2L_ENA 0x0080 /* IN2L_ENA */ | ||
| 836 | #define WM8994_IN2L_ENA_MASK 0x0080 /* IN2L_ENA */ | ||
| 837 | #define WM8994_IN2L_ENA_SHIFT 7 /* IN2L_ENA */ | ||
| 838 | #define WM8994_IN2L_ENA_WIDTH 1 /* IN2L_ENA */ | ||
| 839 | #define WM8994_IN1L_ENA 0x0040 /* IN1L_ENA */ | ||
| 840 | #define WM8994_IN1L_ENA_MASK 0x0040 /* IN1L_ENA */ | ||
| 841 | #define WM8994_IN1L_ENA_SHIFT 6 /* IN1L_ENA */ | ||
| 842 | #define WM8994_IN1L_ENA_WIDTH 1 /* IN1L_ENA */ | ||
| 843 | #define WM8994_IN2R_ENA 0x0020 /* IN2R_ENA */ | ||
| 844 | #define WM8994_IN2R_ENA_MASK 0x0020 /* IN2R_ENA */ | ||
| 845 | #define WM8994_IN2R_ENA_SHIFT 5 /* IN2R_ENA */ | ||
| 846 | #define WM8994_IN2R_ENA_WIDTH 1 /* IN2R_ENA */ | ||
| 847 | #define WM8994_IN1R_ENA 0x0010 /* IN1R_ENA */ | ||
| 848 | #define WM8994_IN1R_ENA_MASK 0x0010 /* IN1R_ENA */ | ||
| 849 | #define WM8994_IN1R_ENA_SHIFT 4 /* IN1R_ENA */ | ||
| 850 | #define WM8994_IN1R_ENA_WIDTH 1 /* IN1R_ENA */ | ||
| 851 | |||
| 852 | /* | ||
| 853 | * R3 (0x03) - Power Management (3) | ||
| 854 | */ | ||
| 855 | #define WM8994_LINEOUT1N_ENA 0x2000 /* LINEOUT1N_ENA */ | ||
| 856 | #define WM8994_LINEOUT1N_ENA_MASK 0x2000 /* LINEOUT1N_ENA */ | ||
| 857 | #define WM8994_LINEOUT1N_ENA_SHIFT 13 /* LINEOUT1N_ENA */ | ||
| 858 | #define WM8994_LINEOUT1N_ENA_WIDTH 1 /* LINEOUT1N_ENA */ | ||
| 859 | #define WM8994_LINEOUT1P_ENA 0x1000 /* LINEOUT1P_ENA */ | ||
| 860 | #define WM8994_LINEOUT1P_ENA_MASK 0x1000 /* LINEOUT1P_ENA */ | ||
| 861 | #define WM8994_LINEOUT1P_ENA_SHIFT 12 /* LINEOUT1P_ENA */ | ||
| 862 | #define WM8994_LINEOUT1P_ENA_WIDTH 1 /* LINEOUT1P_ENA */ | ||
| 863 | #define WM8994_LINEOUT2N_ENA 0x0800 /* LINEOUT2N_ENA */ | ||
| 864 | #define WM8994_LINEOUT2N_ENA_MASK 0x0800 /* LINEOUT2N_ENA */ | ||
| 865 | #define WM8994_LINEOUT2N_ENA_SHIFT 11 /* LINEOUT2N_ENA */ | ||
| 866 | #define WM8994_LINEOUT2N_ENA_WIDTH 1 /* LINEOUT2N_ENA */ | ||
| 867 | #define WM8994_LINEOUT2P_ENA 0x0400 /* LINEOUT2P_ENA */ | ||
| 868 | #define WM8994_LINEOUT2P_ENA_MASK 0x0400 /* LINEOUT2P_ENA */ | ||
| 869 | #define WM8994_LINEOUT2P_ENA_SHIFT 10 /* LINEOUT2P_ENA */ | ||
| 870 | #define WM8994_LINEOUT2P_ENA_WIDTH 1 /* LINEOUT2P_ENA */ | ||
| 871 | #define WM8994_SPKRVOL_ENA 0x0200 /* SPKRVOL_ENA */ | ||
| 872 | #define WM8994_SPKRVOL_ENA_MASK 0x0200 /* SPKRVOL_ENA */ | ||
| 873 | #define WM8994_SPKRVOL_ENA_SHIFT 9 /* SPKRVOL_ENA */ | ||
| 874 | #define WM8994_SPKRVOL_ENA_WIDTH 1 /* SPKRVOL_ENA */ | ||
| 875 | #define WM8994_SPKLVOL_ENA 0x0100 /* SPKLVOL_ENA */ | ||
| 876 | #define WM8994_SPKLVOL_ENA_MASK 0x0100 /* SPKLVOL_ENA */ | ||
| 877 | #define WM8994_SPKLVOL_ENA_SHIFT 8 /* SPKLVOL_ENA */ | ||
| 878 | #define WM8994_SPKLVOL_ENA_WIDTH 1 /* SPKLVOL_ENA */ | ||
| 879 | #define WM8994_MIXOUTLVOL_ENA 0x0080 /* MIXOUTLVOL_ENA */ | ||
| 880 | #define WM8994_MIXOUTLVOL_ENA_MASK 0x0080 /* MIXOUTLVOL_ENA */ | ||
| 881 | #define WM8994_MIXOUTLVOL_ENA_SHIFT 7 /* MIXOUTLVOL_ENA */ | ||
| 882 | #define WM8994_MIXOUTLVOL_ENA_WIDTH 1 /* MIXOUTLVOL_ENA */ | ||
| 883 | #define WM8994_MIXOUTRVOL_ENA 0x0040 /* MIXOUTRVOL_ENA */ | ||
| 884 | #define WM8994_MIXOUTRVOL_ENA_MASK 0x0040 /* MIXOUTRVOL_ENA */ | ||
| 885 | #define WM8994_MIXOUTRVOL_ENA_SHIFT 6 /* MIXOUTRVOL_ENA */ | ||
| 886 | #define WM8994_MIXOUTRVOL_ENA_WIDTH 1 /* MIXOUTRVOL_ENA */ | ||
| 887 | #define WM8994_MIXOUTL_ENA 0x0020 /* MIXOUTL_ENA */ | ||
| 888 | #define WM8994_MIXOUTL_ENA_MASK 0x0020 /* MIXOUTL_ENA */ | ||
| 889 | #define WM8994_MIXOUTL_ENA_SHIFT 5 /* MIXOUTL_ENA */ | ||
| 890 | #define WM8994_MIXOUTL_ENA_WIDTH 1 /* MIXOUTL_ENA */ | ||
| 891 | #define WM8994_MIXOUTR_ENA 0x0010 /* MIXOUTR_ENA */ | ||
| 892 | #define WM8994_MIXOUTR_ENA_MASK 0x0010 /* MIXOUTR_ENA */ | ||
| 893 | #define WM8994_MIXOUTR_ENA_SHIFT 4 /* MIXOUTR_ENA */ | ||
| 894 | #define WM8994_MIXOUTR_ENA_WIDTH 1 /* MIXOUTR_ENA */ | ||
| 895 | |||
| 896 | /* | ||
| 897 | * R4 (0x04) - Power Management (4) | ||
| 898 | */ | ||
| 899 | #define WM8994_AIF2ADCL_ENA 0x2000 /* AIF2ADCL_ENA */ | ||
| 900 | #define WM8994_AIF2ADCL_ENA_MASK 0x2000 /* AIF2ADCL_ENA */ | ||
| 901 | #define WM8994_AIF2ADCL_ENA_SHIFT 13 /* AIF2ADCL_ENA */ | ||
| 902 | #define WM8994_AIF2ADCL_ENA_WIDTH 1 /* AIF2ADCL_ENA */ | ||
| 903 | #define WM8994_AIF2ADCR_ENA 0x1000 /* AIF2ADCR_ENA */ | ||
| 904 | #define WM8994_AIF2ADCR_ENA_MASK 0x1000 /* AIF2ADCR_ENA */ | ||
| 905 | #define WM8994_AIF2ADCR_ENA_SHIFT 12 /* AIF2ADCR_ENA */ | ||
| 906 | #define WM8994_AIF2ADCR_ENA_WIDTH 1 /* AIF2ADCR_ENA */ | ||
| 907 | #define WM8994_AIF1ADC2L_ENA 0x0800 /* AIF1ADC2L_ENA */ | ||
| 908 | #define WM8994_AIF1ADC2L_ENA_MASK 0x0800 /* AIF1ADC2L_ENA */ | ||
| 909 | #define WM8994_AIF1ADC2L_ENA_SHIFT 11 /* AIF1ADC2L_ENA */ | ||
| 910 | #define WM8994_AIF1ADC2L_ENA_WIDTH 1 /* AIF1ADC2L_ENA */ | ||
| 911 | #define WM8994_AIF1ADC2R_ENA 0x0400 /* AIF1ADC2R_ENA */ | ||
| 912 | #define WM8994_AIF1ADC2R_ENA_MASK 0x0400 /* AIF1ADC2R_ENA */ | ||
| 913 | #define WM8994_AIF1ADC2R_ENA_SHIFT 10 /* AIF1ADC2R_ENA */ | ||
| 914 | #define WM8994_AIF1ADC2R_ENA_WIDTH 1 /* AIF1ADC2R_ENA */ | ||
| 915 | #define WM8994_AIF1ADC1L_ENA 0x0200 /* AIF1ADC1L_ENA */ | ||
| 916 | #define WM8994_AIF1ADC1L_ENA_MASK 0x0200 /* AIF1ADC1L_ENA */ | ||
| 917 | #define WM8994_AIF1ADC1L_ENA_SHIFT 9 /* AIF1ADC1L_ENA */ | ||
| 918 | #define WM8994_AIF1ADC1L_ENA_WIDTH 1 /* AIF1ADC1L_ENA */ | ||
| 919 | #define WM8994_AIF1ADC1R_ENA 0x0100 /* AIF1ADC1R_ENA */ | ||
| 920 | #define WM8994_AIF1ADC1R_ENA_MASK 0x0100 /* AIF1ADC1R_ENA */ | ||
| 921 | #define WM8994_AIF1ADC1R_ENA_SHIFT 8 /* AIF1ADC1R_ENA */ | ||
| 922 | #define WM8994_AIF1ADC1R_ENA_WIDTH 1 /* AIF1ADC1R_ENA */ | ||
| 923 | #define WM8994_DMIC2L_ENA 0x0020 /* DMIC2L_ENA */ | ||
| 924 | #define WM8994_DMIC2L_ENA_MASK 0x0020 /* DMIC2L_ENA */ | ||
| 925 | #define WM8994_DMIC2L_ENA_SHIFT 5 /* DMIC2L_ENA */ | ||
| 926 | #define WM8994_DMIC2L_ENA_WIDTH 1 /* DMIC2L_ENA */ | ||
| 927 | #define WM8994_DMIC2R_ENA 0x0010 /* DMIC2R_ENA */ | ||
| 928 | #define WM8994_DMIC2R_ENA_MASK 0x0010 /* DMIC2R_ENA */ | ||
| 929 | #define WM8994_DMIC2R_ENA_SHIFT 4 /* DMIC2R_ENA */ | ||
| 930 | #define WM8994_DMIC2R_ENA_WIDTH 1 /* DMIC2R_ENA */ | ||
| 931 | #define WM8994_DMIC1L_ENA 0x0008 /* DMIC1L_ENA */ | ||
| 932 | #define WM8994_DMIC1L_ENA_MASK 0x0008 /* DMIC1L_ENA */ | ||
| 933 | #define WM8994_DMIC1L_ENA_SHIFT 3 /* DMIC1L_ENA */ | ||
| 934 | #define WM8994_DMIC1L_ENA_WIDTH 1 /* DMIC1L_ENA */ | ||
| 935 | #define WM8994_DMIC1R_ENA 0x0004 /* DMIC1R_ENA */ | ||
| 936 | #define WM8994_DMIC1R_ENA_MASK 0x0004 /* DMIC1R_ENA */ | ||
| 937 | #define WM8994_DMIC1R_ENA_SHIFT 2 /* DMIC1R_ENA */ | ||
| 938 | #define WM8994_DMIC1R_ENA_WIDTH 1 /* DMIC1R_ENA */ | ||
| 939 | #define WM8994_ADCL_ENA 0x0002 /* ADCL_ENA */ | ||
| 940 | #define WM8994_ADCL_ENA_MASK 0x0002 /* ADCL_ENA */ | ||
| 941 | #define WM8994_ADCL_ENA_SHIFT 1 /* ADCL_ENA */ | ||
| 942 | #define WM8994_ADCL_ENA_WIDTH 1 /* ADCL_ENA */ | ||
| 943 | #define WM8994_ADCR_ENA 0x0001 /* ADCR_ENA */ | ||
| 944 | #define WM8994_ADCR_ENA_MASK 0x0001 /* ADCR_ENA */ | ||
| 945 | #define WM8994_ADCR_ENA_SHIFT 0 /* ADCR_ENA */ | ||
| 946 | #define WM8994_ADCR_ENA_WIDTH 1 /* ADCR_ENA */ | ||
| 947 | |||
| 948 | /* | ||
| 949 | * R5 (0x05) - Power Management (5) | ||
| 950 | */ | ||
| 951 | #define WM8994_AIF2DACL_ENA 0x2000 /* AIF2DACL_ENA */ | ||
| 952 | #define WM8994_AIF2DACL_ENA_MASK 0x2000 /* AIF2DACL_ENA */ | ||
| 953 | #define WM8994_AIF2DACL_ENA_SHIFT 13 /* AIF2DACL_ENA */ | ||
| 954 | #define WM8994_AIF2DACL_ENA_WIDTH 1 /* AIF2DACL_ENA */ | ||
| 955 | #define WM8994_AIF2DACR_ENA 0x1000 /* AIF2DACR_ENA */ | ||
| 956 | #define WM8994_AIF2DACR_ENA_MASK 0x1000 /* AIF2DACR_ENA */ | ||
| 957 | #define WM8994_AIF2DACR_ENA_SHIFT 12 /* AIF2DACR_ENA */ | ||
| 958 | #define WM8994_AIF2DACR_ENA_WIDTH 1 /* AIF2DACR_ENA */ | ||
| 959 | #define WM8994_AIF1DAC2L_ENA 0x0800 /* AIF1DAC2L_ENA */ | ||
| 960 | #define WM8994_AIF1DAC2L_ENA_MASK 0x0800 /* AIF1DAC2L_ENA */ | ||
| 961 | #define WM8994_AIF1DAC2L_ENA_SHIFT 11 /* AIF1DAC2L_ENA */ | ||
| 962 | #define WM8994_AIF1DAC2L_ENA_WIDTH 1 /* AIF1DAC2L_ENA */ | ||
| 963 | #define WM8994_AIF1DAC2R_ENA 0x0400 /* AIF1DAC2R_ENA */ | ||
| 964 | #define WM8994_AIF1DAC2R_ENA_MASK 0x0400 /* AIF1DAC2R_ENA */ | ||
| 965 | #define WM8994_AIF1DAC2R_ENA_SHIFT 10 /* AIF1DAC2R_ENA */ | ||
| 966 | #define WM8994_AIF1DAC2R_ENA_WIDTH 1 /* AIF1DAC2R_ENA */ | ||
| 967 | #define WM8994_AIF1DAC1L_ENA 0x0200 /* AIF1DAC1L_ENA */ | ||
| 968 | #define WM8994_AIF1DAC1L_ENA_MASK 0x0200 /* AIF1DAC1L_ENA */ | ||
| 969 | #define WM8994_AIF1DAC1L_ENA_SHIFT 9 /* AIF1DAC1L_ENA */ | ||
| 970 | #define WM8994_AIF1DAC1L_ENA_WIDTH 1 /* AIF1DAC1L_ENA */ | ||
| 971 | #define WM8994_AIF1DAC1R_ENA 0x0100 /* AIF1DAC1R_ENA */ | ||
| 972 | #define WM8994_AIF1DAC1R_ENA_MASK 0x0100 /* AIF1DAC1R_ENA */ | ||
| 973 | #define WM8994_AIF1DAC1R_ENA_SHIFT 8 /* AIF1DAC1R_ENA */ | ||
| 974 | #define WM8994_AIF1DAC1R_ENA_WIDTH 1 /* AIF1DAC1R_ENA */ | ||
| 975 | #define WM8994_DAC2L_ENA 0x0008 /* DAC2L_ENA */ | ||
| 976 | #define WM8994_DAC2L_ENA_MASK 0x0008 /* DAC2L_ENA */ | ||
| 977 | #define WM8994_DAC2L_ENA_SHIFT 3 /* DAC2L_ENA */ | ||
| 978 | #define WM8994_DAC2L_ENA_WIDTH 1 /* DAC2L_ENA */ | ||
| 979 | #define WM8994_DAC2R_ENA 0x0004 /* DAC2R_ENA */ | ||
| 980 | #define WM8994_DAC2R_ENA_MASK 0x0004 /* DAC2R_ENA */ | ||
| 981 | #define WM8994_DAC2R_ENA_SHIFT 2 /* DAC2R_ENA */ | ||
| 982 | #define WM8994_DAC2R_ENA_WIDTH 1 /* DAC2R_ENA */ | ||
| 983 | #define WM8994_DAC1L_ENA 0x0002 /* DAC1L_ENA */ | ||
| 984 | #define WM8994_DAC1L_ENA_MASK 0x0002 /* DAC1L_ENA */ | ||
| 985 | #define WM8994_DAC1L_ENA_SHIFT 1 /* DAC1L_ENA */ | ||
| 986 | #define WM8994_DAC1L_ENA_WIDTH 1 /* DAC1L_ENA */ | ||
| 987 | #define WM8994_DAC1R_ENA 0x0001 /* DAC1R_ENA */ | ||
| 988 | #define WM8994_DAC1R_ENA_MASK 0x0001 /* DAC1R_ENA */ | ||
| 989 | #define WM8994_DAC1R_ENA_SHIFT 0 /* DAC1R_ENA */ | ||
| 990 | #define WM8994_DAC1R_ENA_WIDTH 1 /* DAC1R_ENA */ | ||
| 991 | |||
| 992 | /* | ||
| 993 | * R6 (0x06) - Power Management (6) | ||
| 994 | */ | ||
| 995 | #define WM8994_AIF3_TRI 0x0020 /* AIF3_TRI */ | ||
| 996 | #define WM8994_AIF3_TRI_MASK 0x0020 /* AIF3_TRI */ | ||
| 997 | #define WM8994_AIF3_TRI_SHIFT 5 /* AIF3_TRI */ | ||
| 998 | #define WM8994_AIF3_TRI_WIDTH 1 /* AIF3_TRI */ | ||
| 999 | #define WM8994_AIF3_ADCDAT_SRC_MASK 0x0018 /* AIF3_ADCDAT_SRC - [4:3] */ | ||
| 1000 | #define WM8994_AIF3_ADCDAT_SRC_SHIFT 3 /* AIF3_ADCDAT_SRC - [4:3] */ | ||
| 1001 | #define WM8994_AIF3_ADCDAT_SRC_WIDTH 2 /* AIF3_ADCDAT_SRC - [4:3] */ | ||
| 1002 | #define WM8994_AIF2_ADCDAT_SRC 0x0004 /* AIF2_ADCDAT_SRC */ | ||
| 1003 | #define WM8994_AIF2_ADCDAT_SRC_MASK 0x0004 /* AIF2_ADCDAT_SRC */ | ||
| 1004 | #define WM8994_AIF2_ADCDAT_SRC_SHIFT 2 /* AIF2_ADCDAT_SRC */ | ||
| 1005 | #define WM8994_AIF2_ADCDAT_SRC_WIDTH 1 /* AIF2_ADCDAT_SRC */ | ||
| 1006 | #define WM8994_AIF2_DACDAT_SRC 0x0002 /* AIF2_DACDAT_SRC */ | ||
| 1007 | #define WM8994_AIF2_DACDAT_SRC_MASK 0x0002 /* AIF2_DACDAT_SRC */ | ||
| 1008 | #define WM8994_AIF2_DACDAT_SRC_SHIFT 1 /* AIF2_DACDAT_SRC */ | ||
| 1009 | #define WM8994_AIF2_DACDAT_SRC_WIDTH 1 /* AIF2_DACDAT_SRC */ | ||
| 1010 | #define WM8994_AIF1_DACDAT_SRC 0x0001 /* AIF1_DACDAT_SRC */ | ||
| 1011 | #define WM8994_AIF1_DACDAT_SRC_MASK 0x0001 /* AIF1_DACDAT_SRC */ | ||
| 1012 | #define WM8994_AIF1_DACDAT_SRC_SHIFT 0 /* AIF1_DACDAT_SRC */ | ||
| 1013 | #define WM8994_AIF1_DACDAT_SRC_WIDTH 1 /* AIF1_DACDAT_SRC */ | ||
| 1014 | |||
| 1015 | /* | ||
| 1016 | * R21 (0x15) - Input Mixer (1) | ||
| 1017 | */ | ||
| 1018 | #define WM8994_IN1RP_MIXINR_BOOST 0x0100 /* IN1RP_MIXINR_BOOST */ | ||
| 1019 | #define WM8994_IN1RP_MIXINR_BOOST_MASK 0x0100 /* IN1RP_MIXINR_BOOST */ | ||
| 1020 | #define WM8994_IN1RP_MIXINR_BOOST_SHIFT 8 /* IN1RP_MIXINR_BOOST */ | ||
| 1021 | #define WM8994_IN1RP_MIXINR_BOOST_WIDTH 1 /* IN1RP_MIXINR_BOOST */ | ||
| 1022 | #define WM8994_IN1LP_MIXINL_BOOST 0x0080 /* IN1LP_MIXINL_BOOST */ | ||
| 1023 | #define WM8994_IN1LP_MIXINL_BOOST_MASK 0x0080 /* IN1LP_MIXINL_BOOST */ | ||
| 1024 | #define WM8994_IN1LP_MIXINL_BOOST_SHIFT 7 /* IN1LP_MIXINL_BOOST */ | ||
| 1025 | #define WM8994_IN1LP_MIXINL_BOOST_WIDTH 1 /* IN1LP_MIXINL_BOOST */ | ||
| 1026 | #define WM8994_INPUTS_CLAMP 0x0040 /* INPUTS_CLAMP */ | ||
| 1027 | #define WM8994_INPUTS_CLAMP_MASK 0x0040 /* INPUTS_CLAMP */ | ||
| 1028 | #define WM8994_INPUTS_CLAMP_SHIFT 6 /* INPUTS_CLAMP */ | ||
| 1029 | #define WM8994_INPUTS_CLAMP_WIDTH 1 /* INPUTS_CLAMP */ | ||
| 1030 | |||
| 1031 | /* | ||
| 1032 | * R24 (0x18) - Left Line Input 1&2 Volume | ||
| 1033 | */ | ||
| 1034 | #define WM8994_IN1_VU 0x0100 /* IN1_VU */ | ||
| 1035 | #define WM8994_IN1_VU_MASK 0x0100 /* IN1_VU */ | ||
| 1036 | #define WM8994_IN1_VU_SHIFT 8 /* IN1_VU */ | ||
| 1037 | #define WM8994_IN1_VU_WIDTH 1 /* IN1_VU */ | ||
| 1038 | #define WM8994_IN1L_MUTE 0x0080 /* IN1L_MUTE */ | ||
| 1039 | #define WM8994_IN1L_MUTE_MASK 0x0080 /* IN1L_MUTE */ | ||
| 1040 | #define WM8994_IN1L_MUTE_SHIFT 7 /* IN1L_MUTE */ | ||
| 1041 | #define WM8994_IN1L_MUTE_WIDTH 1 /* IN1L_MUTE */ | ||
| 1042 | #define WM8994_IN1L_ZC 0x0040 /* IN1L_ZC */ | ||
| 1043 | #define WM8994_IN1L_ZC_MASK 0x0040 /* IN1L_ZC */ | ||
| 1044 | #define WM8994_IN1L_ZC_SHIFT 6 /* IN1L_ZC */ | ||
| 1045 | #define WM8994_IN1L_ZC_WIDTH 1 /* IN1L_ZC */ | ||
| 1046 | #define WM8994_IN1L_VOL_MASK 0x001F /* IN1L_VOL - [4:0] */ | ||
| 1047 | #define WM8994_IN1L_VOL_SHIFT 0 /* IN1L_VOL - [4:0] */ | ||
| 1048 | #define WM8994_IN1L_VOL_WIDTH 5 /* IN1L_VOL - [4:0] */ | ||
| 1049 | |||
| 1050 | /* | ||
| 1051 | * R25 (0x19) - Left Line Input 3&4 Volume | ||
| 1052 | */ | ||
| 1053 | #define WM8994_IN2_VU 0x0100 /* IN2_VU */ | ||
| 1054 | #define WM8994_IN2_VU_MASK 0x0100 /* IN2_VU */ | ||
| 1055 | #define WM8994_IN2_VU_SHIFT 8 /* IN2_VU */ | ||
| 1056 | #define WM8994_IN2_VU_WIDTH 1 /* IN2_VU */ | ||
| 1057 | #define WM8994_IN2L_MUTE 0x0080 /* IN2L_MUTE */ | ||
| 1058 | #define WM8994_IN2L_MUTE_MASK 0x0080 /* IN2L_MUTE */ | ||
| 1059 | #define WM8994_IN2L_MUTE_SHIFT 7 /* IN2L_MUTE */ | ||
| 1060 | #define WM8994_IN2L_MUTE_WIDTH 1 /* IN2L_MUTE */ | ||
| 1061 | #define WM8994_IN2L_ZC 0x0040 /* IN2L_ZC */ | ||
| 1062 | #define WM8994_IN2L_ZC_MASK 0x0040 /* IN2L_ZC */ | ||
| 1063 | #define WM8994_IN2L_ZC_SHIFT 6 /* IN2L_ZC */ | ||
| 1064 | #define WM8994_IN2L_ZC_WIDTH 1 /* IN2L_ZC */ | ||
| 1065 | #define WM8994_IN2L_VOL_MASK 0x001F /* IN2L_VOL - [4:0] */ | ||
| 1066 | #define WM8994_IN2L_VOL_SHIFT 0 /* IN2L_VOL - [4:0] */ | ||
| 1067 | #define WM8994_IN2L_VOL_WIDTH 5 /* IN2L_VOL - [4:0] */ | ||
| 1068 | |||
| 1069 | /* | ||
| 1070 | * R26 (0x1A) - Right Line Input 1&2 Volume | ||
| 1071 | */ | ||
| 1072 | #define WM8994_IN1_VU 0x0100 /* IN1_VU */ | ||
| 1073 | #define WM8994_IN1_VU_MASK 0x0100 /* IN1_VU */ | ||
| 1074 | #define WM8994_IN1_VU_SHIFT 8 /* IN1_VU */ | ||
| 1075 | #define WM8994_IN1_VU_WIDTH 1 /* IN1_VU */ | ||
| 1076 | #define WM8994_IN1R_MUTE 0x0080 /* IN1R_MUTE */ | ||
| 1077 | #define WM8994_IN1R_MUTE_MASK 0x0080 /* IN1R_MUTE */ | ||
| 1078 | #define WM8994_IN1R_MUTE_SHIFT 7 /* IN1R_MUTE */ | ||
| 1079 | #define WM8994_IN1R_MUTE_WIDTH 1 /* IN1R_MUTE */ | ||
| 1080 | #define WM8994_IN1R_ZC 0x0040 /* IN1R_ZC */ | ||
| 1081 | #define WM8994_IN1R_ZC_MASK 0x0040 /* IN1R_ZC */ | ||
| 1082 | #define WM8994_IN1R_ZC_SHIFT 6 /* IN1R_ZC */ | ||
| 1083 | #define WM8994_IN1R_ZC_WIDTH 1 /* IN1R_ZC */ | ||
| 1084 | #define WM8994_IN1R_VOL_MASK 0x001F /* IN1R_VOL - [4:0] */ | ||
| 1085 | #define WM8994_IN1R_VOL_SHIFT 0 /* IN1R_VOL - [4:0] */ | ||
| 1086 | #define WM8994_IN1R_VOL_WIDTH 5 /* IN1R_VOL - [4:0] */ | ||
| 1087 | |||
| 1088 | /* | ||
| 1089 | * R27 (0x1B) - Right Line Input 3&4 Volume | ||
| 1090 | */ | ||
| 1091 | #define WM8994_IN2_VU 0x0100 /* IN2_VU */ | ||
| 1092 | #define WM8994_IN2_VU_MASK 0x0100 /* IN2_VU */ | ||
| 1093 | #define WM8994_IN2_VU_SHIFT 8 /* IN2_VU */ | ||
| 1094 | #define WM8994_IN2_VU_WIDTH 1 /* IN2_VU */ | ||
| 1095 | #define WM8994_IN2R_MUTE 0x0080 /* IN2R_MUTE */ | ||
| 1096 | #define WM8994_IN2R_MUTE_MASK 0x0080 /* IN2R_MUTE */ | ||
| 1097 | #define WM8994_IN2R_MUTE_SHIFT 7 /* IN2R_MUTE */ | ||
| 1098 | #define WM8994_IN2R_MUTE_WIDTH 1 /* IN2R_MUTE */ | ||
| 1099 | #define WM8994_IN2R_ZC 0x0040 /* IN2R_ZC */ | ||
| 1100 | #define WM8994_IN2R_ZC_MASK 0x0040 /* IN2R_ZC */ | ||
| 1101 | #define WM8994_IN2R_ZC_SHIFT 6 /* IN2R_ZC */ | ||
| 1102 | #define WM8994_IN2R_ZC_WIDTH 1 /* IN2R_ZC */ | ||
| 1103 | #define WM8994_IN2R_VOL_MASK 0x001F /* IN2R_VOL - [4:0] */ | ||
| 1104 | #define WM8994_IN2R_VOL_SHIFT 0 /* IN2R_VOL - [4:0] */ | ||
| 1105 | #define WM8994_IN2R_VOL_WIDTH 5 /* IN2R_VOL - [4:0] */ | ||
| 1106 | |||
| 1107 | /* | ||
| 1108 | * R28 (0x1C) - Left Output Volume | ||
| 1109 | */ | ||
| 1110 | #define WM8994_HPOUT1_VU 0x0100 /* HPOUT1_VU */ | ||
| 1111 | #define WM8994_HPOUT1_VU_MASK 0x0100 /* HPOUT1_VU */ | ||
| 1112 | #define WM8994_HPOUT1_VU_SHIFT 8 /* HPOUT1_VU */ | ||
| 1113 | #define WM8994_HPOUT1_VU_WIDTH 1 /* HPOUT1_VU */ | ||
| 1114 | #define WM8994_HPOUT1L_ZC 0x0080 /* HPOUT1L_ZC */ | ||
| 1115 | #define WM8994_HPOUT1L_ZC_MASK 0x0080 /* HPOUT1L_ZC */ | ||
| 1116 | #define WM8994_HPOUT1L_ZC_SHIFT 7 /* HPOUT1L_ZC */ | ||
| 1117 | #define WM8994_HPOUT1L_ZC_WIDTH 1 /* HPOUT1L_ZC */ | ||
| 1118 | #define WM8994_HPOUT1L_MUTE_N 0x0040 /* HPOUT1L_MUTE_N */ | ||
| 1119 | #define WM8994_HPOUT1L_MUTE_N_MASK 0x0040 /* HPOUT1L_MUTE_N */ | ||
| 1120 | #define WM8994_HPOUT1L_MUTE_N_SHIFT 6 /* HPOUT1L_MUTE_N */ | ||
| 1121 | #define WM8994_HPOUT1L_MUTE_N_WIDTH 1 /* HPOUT1L_MUTE_N */ | ||
| 1122 | #define WM8994_HPOUT1L_VOL_MASK 0x003F /* HPOUT1L_VOL - [5:0] */ | ||
| 1123 | #define WM8994_HPOUT1L_VOL_SHIFT 0 /* HPOUT1L_VOL - [5:0] */ | ||
| 1124 | #define WM8994_HPOUT1L_VOL_WIDTH 6 /* HPOUT1L_VOL - [5:0] */ | ||
| 1125 | |||
| 1126 | /* | ||
| 1127 | * R29 (0x1D) - Right Output Volume | ||
| 1128 | */ | ||
| 1129 | #define WM8994_HPOUT1_VU 0x0100 /* HPOUT1_VU */ | ||
| 1130 | #define WM8994_HPOUT1_VU_MASK 0x0100 /* HPOUT1_VU */ | ||
| 1131 | #define WM8994_HPOUT1_VU_SHIFT 8 /* HPOUT1_VU */ | ||
| 1132 | #define WM8994_HPOUT1_VU_WIDTH 1 /* HPOUT1_VU */ | ||
| 1133 | #define WM8994_HPOUT1R_ZC 0x0080 /* HPOUT1R_ZC */ | ||
| 1134 | #define WM8994_HPOUT1R_ZC_MASK 0x0080 /* HPOUT1R_ZC */ | ||
| 1135 | #define WM8994_HPOUT1R_ZC_SHIFT 7 /* HPOUT1R_ZC */ | ||
| 1136 | #define WM8994_HPOUT1R_ZC_WIDTH 1 /* HPOUT1R_ZC */ | ||
| 1137 | #define WM8994_HPOUT1R_MUTE_N 0x0040 /* HPOUT1R_MUTE_N */ | ||
| 1138 | #define WM8994_HPOUT1R_MUTE_N_MASK 0x0040 /* HPOUT1R_MUTE_N */ | ||
| 1139 | #define WM8994_HPOUT1R_MUTE_N_SHIFT 6 /* HPOUT1R_MUTE_N */ | ||
| 1140 | #define WM8994_HPOUT1R_MUTE_N_WIDTH 1 /* HPOUT1R_MUTE_N */ | ||
| 1141 | #define WM8994_HPOUT1R_VOL_MASK 0x003F /* HPOUT1R_VOL - [5:0] */ | ||
| 1142 | #define WM8994_HPOUT1R_VOL_SHIFT 0 /* HPOUT1R_VOL - [5:0] */ | ||
| 1143 | #define WM8994_HPOUT1R_VOL_WIDTH 6 /* HPOUT1R_VOL - [5:0] */ | ||
| 1144 | |||
| 1145 | /* | ||
| 1146 | * R30 (0x1E) - Line Outputs Volume | ||
| 1147 | */ | ||
| 1148 | #define WM8994_LINEOUT1N_MUTE 0x0040 /* LINEOUT1N_MUTE */ | ||
| 1149 | #define WM8994_LINEOUT1N_MUTE_MASK 0x0040 /* LINEOUT1N_MUTE */ | ||
| 1150 | #define WM8994_LINEOUT1N_MUTE_SHIFT 6 /* LINEOUT1N_MUTE */ | ||
| 1151 | #define WM8994_LINEOUT1N_MUTE_WIDTH 1 /* LINEOUT1N_MUTE */ | ||
| 1152 | #define WM8994_LINEOUT1P_MUTE 0x0020 /* LINEOUT1P_MUTE */ | ||
| 1153 | #define WM8994_LINEOUT1P_MUTE_MASK 0x0020 /* LINEOUT1P_MUTE */ | ||
| 1154 | #define WM8994_LINEOUT1P_MUTE_SHIFT 5 /* LINEOUT1P_MUTE */ | ||
| 1155 | #define WM8994_LINEOUT1P_MUTE_WIDTH 1 /* LINEOUT1P_MUTE */ | ||
| 1156 | #define WM8994_LINEOUT1_VOL 0x0010 /* LINEOUT1_VOL */ | ||
| 1157 | #define WM8994_LINEOUT1_VOL_MASK 0x0010 /* LINEOUT1_VOL */ | ||
| 1158 | #define WM8994_LINEOUT1_VOL_SHIFT 4 /* LINEOUT1_VOL */ | ||
| 1159 | #define WM8994_LINEOUT1_VOL_WIDTH 1 /* LINEOUT1_VOL */ | ||
| 1160 | #define WM8994_LINEOUT2N_MUTE 0x0004 /* LINEOUT2N_MUTE */ | ||
| 1161 | #define WM8994_LINEOUT2N_MUTE_MASK 0x0004 /* LINEOUT2N_MUTE */ | ||
| 1162 | #define WM8994_LINEOUT2N_MUTE_SHIFT 2 /* LINEOUT2N_MUTE */ | ||
| 1163 | #define WM8994_LINEOUT2N_MUTE_WIDTH 1 /* LINEOUT2N_MUTE */ | ||
| 1164 | #define WM8994_LINEOUT2P_MUTE 0x0002 /* LINEOUT2P_MUTE */ | ||
| 1165 | #define WM8994_LINEOUT2P_MUTE_MASK 0x0002 /* LINEOUT2P_MUTE */ | ||
| 1166 | #define WM8994_LINEOUT2P_MUTE_SHIFT 1 /* LINEOUT2P_MUTE */ | ||
| 1167 | #define WM8994_LINEOUT2P_MUTE_WIDTH 1 /* LINEOUT2P_MUTE */ | ||
| 1168 | #define WM8994_LINEOUT2_VOL 0x0001 /* LINEOUT2_VOL */ | ||
| 1169 | #define WM8994_LINEOUT2_VOL_MASK 0x0001 /* LINEOUT2_VOL */ | ||
| 1170 | #define WM8994_LINEOUT2_VOL_SHIFT 0 /* LINEOUT2_VOL */ | ||
| 1171 | #define WM8994_LINEOUT2_VOL_WIDTH 1 /* LINEOUT2_VOL */ | ||
| 1172 | |||
| 1173 | /* | ||
| 1174 | * R31 (0x1F) - HPOUT2 Volume | ||
| 1175 | */ | ||
| 1176 | #define WM8994_HPOUT2_MUTE 0x0020 /* HPOUT2_MUTE */ | ||
| 1177 | #define WM8994_HPOUT2_MUTE_MASK 0x0020 /* HPOUT2_MUTE */ | ||
| 1178 | #define WM8994_HPOUT2_MUTE_SHIFT 5 /* HPOUT2_MUTE */ | ||
| 1179 | #define WM8994_HPOUT2_MUTE_WIDTH 1 /* HPOUT2_MUTE */ | ||
| 1180 | #define WM8994_HPOUT2_VOL 0x0010 /* HPOUT2_VOL */ | ||
| 1181 | #define WM8994_HPOUT2_VOL_MASK 0x0010 /* HPOUT2_VOL */ | ||
| 1182 | #define WM8994_HPOUT2_VOL_SHIFT 4 /* HPOUT2_VOL */ | ||
| 1183 | #define WM8994_HPOUT2_VOL_WIDTH 1 /* HPOUT2_VOL */ | ||
| 1184 | |||
| 1185 | /* | ||
| 1186 | * R32 (0x20) - Left OPGA Volume | ||
| 1187 | */ | ||
| 1188 | #define WM8994_MIXOUT_VU 0x0100 /* MIXOUT_VU */ | ||
| 1189 | #define WM8994_MIXOUT_VU_MASK 0x0100 /* MIXOUT_VU */ | ||
| 1190 | #define WM8994_MIXOUT_VU_SHIFT 8 /* MIXOUT_VU */ | ||
| 1191 | #define WM8994_MIXOUT_VU_WIDTH 1 /* MIXOUT_VU */ | ||
| 1192 | #define WM8994_MIXOUTL_ZC 0x0080 /* MIXOUTL_ZC */ | ||
| 1193 | #define WM8994_MIXOUTL_ZC_MASK 0x0080 /* MIXOUTL_ZC */ | ||
| 1194 | #define WM8994_MIXOUTL_ZC_SHIFT 7 /* MIXOUTL_ZC */ | ||
| 1195 | #define WM8994_MIXOUTL_ZC_WIDTH 1 /* MIXOUTL_ZC */ | ||
| 1196 | #define WM8994_MIXOUTL_MUTE_N 0x0040 /* MIXOUTL_MUTE_N */ | ||
| 1197 | #define WM8994_MIXOUTL_MUTE_N_MASK 0x0040 /* MIXOUTL_MUTE_N */ | ||
| 1198 | #define WM8994_MIXOUTL_MUTE_N_SHIFT 6 /* MIXOUTL_MUTE_N */ | ||
| 1199 | #define WM8994_MIXOUTL_MUTE_N_WIDTH 1 /* MIXOUTL_MUTE_N */ | ||
| 1200 | #define WM8994_MIXOUTL_VOL_MASK 0x003F /* MIXOUTL_VOL - [5:0] */ | ||
| 1201 | #define WM8994_MIXOUTL_VOL_SHIFT 0 /* MIXOUTL_VOL - [5:0] */ | ||
| 1202 | #define WM8994_MIXOUTL_VOL_WIDTH 6 /* MIXOUTL_VOL - [5:0] */ | ||
| 1203 | |||
| 1204 | /* | ||
| 1205 | * R33 (0x21) - Right OPGA Volume | ||
| 1206 | */ | ||
| 1207 | #define WM8994_MIXOUT_VU 0x0100 /* MIXOUT_VU */ | ||
| 1208 | #define WM8994_MIXOUT_VU_MASK 0x0100 /* MIXOUT_VU */ | ||
| 1209 | #define WM8994_MIXOUT_VU_SHIFT 8 /* MIXOUT_VU */ | ||
| 1210 | #define WM8994_MIXOUT_VU_WIDTH 1 /* MIXOUT_VU */ | ||
| 1211 | #define WM8994_MIXOUTR_ZC 0x0080 /* MIXOUTR_ZC */ | ||
| 1212 | #define WM8994_MIXOUTR_ZC_MASK 0x0080 /* MIXOUTR_ZC */ | ||
| 1213 | #define WM8994_MIXOUTR_ZC_SHIFT 7 /* MIXOUTR_ZC */ | ||
| 1214 | #define WM8994_MIXOUTR_ZC_WIDTH 1 /* MIXOUTR_ZC */ | ||
| 1215 | #define WM8994_MIXOUTR_MUTE_N 0x0040 /* MIXOUTR_MUTE_N */ | ||
| 1216 | #define WM8994_MIXOUTR_MUTE_N_MASK 0x0040 /* MIXOUTR_MUTE_N */ | ||
| 1217 | #define WM8994_MIXOUTR_MUTE_N_SHIFT 6 /* MIXOUTR_MUTE_N */ | ||
| 1218 | #define WM8994_MIXOUTR_MUTE_N_WIDTH 1 /* MIXOUTR_MUTE_N */ | ||
| 1219 | #define WM8994_MIXOUTR_VOL_MASK 0x003F /* MIXOUTR_VOL - [5:0] */ | ||
| 1220 | #define WM8994_MIXOUTR_VOL_SHIFT 0 /* MIXOUTR_VOL - [5:0] */ | ||
| 1221 | #define WM8994_MIXOUTR_VOL_WIDTH 6 /* MIXOUTR_VOL - [5:0] */ | ||
| 1222 | |||
| 1223 | /* | ||
| 1224 | * R34 (0x22) - SPKMIXL Attenuation | ||
| 1225 | */ | ||
| 1226 | #define WM8994_DAC2L_SPKMIXL_VOL 0x0040 /* DAC2L_SPKMIXL_VOL */ | ||
| 1227 | #define WM8994_DAC2L_SPKMIXL_VOL_MASK 0x0040 /* DAC2L_SPKMIXL_VOL */ | ||
| 1228 | #define WM8994_DAC2L_SPKMIXL_VOL_SHIFT 6 /* DAC2L_SPKMIXL_VOL */ | ||
| 1229 | #define WM8994_DAC2L_SPKMIXL_VOL_WIDTH 1 /* DAC2L_SPKMIXL_VOL */ | ||
| 1230 | #define WM8994_MIXINL_SPKMIXL_VOL 0x0020 /* MIXINL_SPKMIXL_VOL */ | ||
| 1231 | #define WM8994_MIXINL_SPKMIXL_VOL_MASK 0x0020 /* MIXINL_SPKMIXL_VOL */ | ||
| 1232 | #define WM8994_MIXINL_SPKMIXL_VOL_SHIFT 5 /* MIXINL_SPKMIXL_VOL */ | ||
| 1233 | #define WM8994_MIXINL_SPKMIXL_VOL_WIDTH 1 /* MIXINL_SPKMIXL_VOL */ | ||
| 1234 | #define WM8994_IN1LP_SPKMIXL_VOL 0x0010 /* IN1LP_SPKMIXL_VOL */ | ||
| 1235 | #define WM8994_IN1LP_SPKMIXL_VOL_MASK 0x0010 /* IN1LP_SPKMIXL_VOL */ | ||
| 1236 | #define WM8994_IN1LP_SPKMIXL_VOL_SHIFT 4 /* IN1LP_SPKMIXL_VOL */ | ||
| 1237 | #define WM8994_IN1LP_SPKMIXL_VOL_WIDTH 1 /* IN1LP_SPKMIXL_VOL */ | ||
| 1238 | #define WM8994_MIXOUTL_SPKMIXL_VOL 0x0008 /* MIXOUTL_SPKMIXL_VOL */ | ||
| 1239 | #define WM8994_MIXOUTL_SPKMIXL_VOL_MASK 0x0008 /* MIXOUTL_SPKMIXL_VOL */ | ||
| 1240 | #define WM8994_MIXOUTL_SPKMIXL_VOL_SHIFT 3 /* MIXOUTL_SPKMIXL_VOL */ | ||
| 1241 | #define WM8994_MIXOUTL_SPKMIXL_VOL_WIDTH 1 /* MIXOUTL_SPKMIXL_VOL */ | ||
| 1242 | #define WM8994_DAC1L_SPKMIXL_VOL 0x0004 /* DAC1L_SPKMIXL_VOL */ | ||
| 1243 | #define WM8994_DAC1L_SPKMIXL_VOL_MASK 0x0004 /* DAC1L_SPKMIXL_VOL */ | ||
| 1244 | #define WM8994_DAC1L_SPKMIXL_VOL_SHIFT 2 /* DAC1L_SPKMIXL_VOL */ | ||
| 1245 | #define WM8994_DAC1L_SPKMIXL_VOL_WIDTH 1 /* DAC1L_SPKMIXL_VOL */ | ||
| 1246 | #define WM8994_SPKMIXL_VOL_MASK 0x0003 /* SPKMIXL_VOL - [1:0] */ | ||
| 1247 | #define WM8994_SPKMIXL_VOL_SHIFT 0 /* SPKMIXL_VOL - [1:0] */ | ||
| 1248 | #define WM8994_SPKMIXL_VOL_WIDTH 2 /* SPKMIXL_VOL - [1:0] */ | ||
| 1249 | |||
| 1250 | /* | ||
| 1251 | * R35 (0x23) - SPKMIXR Attenuation | ||
| 1252 | */ | ||
| 1253 | #define WM8994_SPKOUT_CLASSAB 0x0100 /* SPKOUT_CLASSAB */ | ||
| 1254 | #define WM8994_SPKOUT_CLASSAB_MASK 0x0100 /* SPKOUT_CLASSAB */ | ||
| 1255 | #define WM8994_SPKOUT_CLASSAB_SHIFT 8 /* SPKOUT_CLASSAB */ | ||
| 1256 | #define WM8994_SPKOUT_CLASSAB_WIDTH 1 /* SPKOUT_CLASSAB */ | ||
| 1257 | #define WM8994_DAC2R_SPKMIXR_VOL 0x0040 /* DAC2R_SPKMIXR_VOL */ | ||
| 1258 | #define WM8994_DAC2R_SPKMIXR_VOL_MASK 0x0040 /* DAC2R_SPKMIXR_VOL */ | ||
| 1259 | #define WM8994_DAC2R_SPKMIXR_VOL_SHIFT 6 /* DAC2R_SPKMIXR_VOL */ | ||
| 1260 | #define WM8994_DAC2R_SPKMIXR_VOL_WIDTH 1 /* DAC2R_SPKMIXR_VOL */ | ||
| 1261 | #define WM8994_MIXINR_SPKMIXR_VOL 0x0020 /* MIXINR_SPKMIXR_VOL */ | ||
| 1262 | #define WM8994_MIXINR_SPKMIXR_VOL_MASK 0x0020 /* MIXINR_SPKMIXR_VOL */ | ||
| 1263 | #define WM8994_MIXINR_SPKMIXR_VOL_SHIFT 5 /* MIXINR_SPKMIXR_VOL */ | ||
| 1264 | #define WM8994_MIXINR_SPKMIXR_VOL_WIDTH 1 /* MIXINR_SPKMIXR_VOL */ | ||
| 1265 | #define WM8994_IN1RP_SPKMIXR_VOL 0x0010 /* IN1RP_SPKMIXR_VOL */ | ||
| 1266 | #define WM8994_IN1RP_SPKMIXR_VOL_MASK 0x0010 /* IN1RP_SPKMIXR_VOL */ | ||
| 1267 | #define WM8994_IN1RP_SPKMIXR_VOL_SHIFT 4 /* IN1RP_SPKMIXR_VOL */ | ||
| 1268 | #define WM8994_IN1RP_SPKMIXR_VOL_WIDTH 1 /* IN1RP_SPKMIXR_VOL */ | ||
| 1269 | #define WM8994_MIXOUTR_SPKMIXR_VOL 0x0008 /* MIXOUTR_SPKMIXR_VOL */ | ||
| 1270 | #define WM8994_MIXOUTR_SPKMIXR_VOL_MASK 0x0008 /* MIXOUTR_SPKMIXR_VOL */ | ||
| 1271 | #define WM8994_MIXOUTR_SPKMIXR_VOL_SHIFT 3 /* MIXOUTR_SPKMIXR_VOL */ | ||
| 1272 | #define WM8994_MIXOUTR_SPKMIXR_VOL_WIDTH 1 /* MIXOUTR_SPKMIXR_VOL */ | ||
| 1273 | #define WM8994_DAC1R_SPKMIXR_VOL 0x0004 /* DAC1R_SPKMIXR_VOL */ | ||
| 1274 | #define WM8994_DAC1R_SPKMIXR_VOL_MASK 0x0004 /* DAC1R_SPKMIXR_VOL */ | ||
| 1275 | #define WM8994_DAC1R_SPKMIXR_VOL_SHIFT 2 /* DAC1R_SPKMIXR_VOL */ | ||
| 1276 | #define WM8994_DAC1R_SPKMIXR_VOL_WIDTH 1 /* DAC1R_SPKMIXR_VOL */ | ||
| 1277 | #define WM8994_SPKMIXR_VOL_MASK 0x0003 /* SPKMIXR_VOL - [1:0] */ | ||
| 1278 | #define WM8994_SPKMIXR_VOL_SHIFT 0 /* SPKMIXR_VOL - [1:0] */ | ||
| 1279 | #define WM8994_SPKMIXR_VOL_WIDTH 2 /* SPKMIXR_VOL - [1:0] */ | ||
| 1280 | |||
| 1281 | /* | ||
| 1282 | * R36 (0x24) - SPKOUT Mixers | ||
| 1283 | */ | ||
| 1284 | #define WM8994_IN2LRP_TO_SPKOUTL 0x0020 /* IN2LRP_TO_SPKOUTL */ | ||
| 1285 | #define WM8994_IN2LRP_TO_SPKOUTL_MASK 0x0020 /* IN2LRP_TO_SPKOUTL */ | ||
| 1286 | #define WM8994_IN2LRP_TO_SPKOUTL_SHIFT 5 /* IN2LRP_TO_SPKOUTL */ | ||
| 1287 | #define WM8994_IN2LRP_TO_SPKOUTL_WIDTH 1 /* IN2LRP_TO_SPKOUTL */ | ||
| 1288 | #define WM8994_SPKMIXL_TO_SPKOUTL 0x0010 /* SPKMIXL_TO_SPKOUTL */ | ||
| 1289 | #define WM8994_SPKMIXL_TO_SPKOUTL_MASK 0x0010 /* SPKMIXL_TO_SPKOUTL */ | ||
| 1290 | #define WM8994_SPKMIXL_TO_SPKOUTL_SHIFT 4 /* SPKMIXL_TO_SPKOUTL */ | ||
| 1291 | #define WM8994_SPKMIXL_TO_SPKOUTL_WIDTH 1 /* SPKMIXL_TO_SPKOUTL */ | ||
| 1292 | #define WM8994_SPKMIXR_TO_SPKOUTL 0x0008 /* SPKMIXR_TO_SPKOUTL */ | ||
| 1293 | #define WM8994_SPKMIXR_TO_SPKOUTL_MASK 0x0008 /* SPKMIXR_TO_SPKOUTL */ | ||
| 1294 | #define WM8994_SPKMIXR_TO_SPKOUTL_SHIFT 3 /* SPKMIXR_TO_SPKOUTL */ | ||
| 1295 | #define WM8994_SPKMIXR_TO_SPKOUTL_WIDTH 1 /* SPKMIXR_TO_SPKOUTL */ | ||
| 1296 | #define WM8994_IN2LRP_TO_SPKOUTR 0x0004 /* IN2LRP_TO_SPKOUTR */ | ||
| 1297 | #define WM8994_IN2LRP_TO_SPKOUTR_MASK 0x0004 /* IN2LRP_TO_SPKOUTR */ | ||
| 1298 | #define WM8994_IN2LRP_TO_SPKOUTR_SHIFT 2 /* IN2LRP_TO_SPKOUTR */ | ||
| 1299 | #define WM8994_IN2LRP_TO_SPKOUTR_WIDTH 1 /* IN2LRP_TO_SPKOUTR */ | ||
| 1300 | #define WM8994_SPKMIXL_TO_SPKOUTR 0x0002 /* SPKMIXL_TO_SPKOUTR */ | ||
| 1301 | #define WM8994_SPKMIXL_TO_SPKOUTR_MASK 0x0002 /* SPKMIXL_TO_SPKOUTR */ | ||
| 1302 | #define WM8994_SPKMIXL_TO_SPKOUTR_SHIFT 1 /* SPKMIXL_TO_SPKOUTR */ | ||
| 1303 | #define WM8994_SPKMIXL_TO_SPKOUTR_WIDTH 1 /* SPKMIXL_TO_SPKOUTR */ | ||
| 1304 | #define WM8994_SPKMIXR_TO_SPKOUTR 0x0001 /* SPKMIXR_TO_SPKOUTR */ | ||
| 1305 | #define WM8994_SPKMIXR_TO_SPKOUTR_MASK 0x0001 /* SPKMIXR_TO_SPKOUTR */ | ||
| 1306 | #define WM8994_SPKMIXR_TO_SPKOUTR_SHIFT 0 /* SPKMIXR_TO_SPKOUTR */ | ||
| 1307 | #define WM8994_SPKMIXR_TO_SPKOUTR_WIDTH 1 /* SPKMIXR_TO_SPKOUTR */ | ||
| 1308 | |||
| 1309 | /* | ||
| 1310 | * R37 (0x25) - ClassD | ||
| 1311 | */ | ||
| 1312 | #define WM8994_SPKOUTL_BOOST_MASK 0x0038 /* SPKOUTL_BOOST - [5:3] */ | ||
| 1313 | #define WM8994_SPKOUTL_BOOST_SHIFT 3 /* SPKOUTL_BOOST - [5:3] */ | ||
| 1314 | #define WM8994_SPKOUTL_BOOST_WIDTH 3 /* SPKOUTL_BOOST - [5:3] */ | ||
| 1315 | #define WM8994_SPKOUTR_BOOST_MASK 0x0007 /* SPKOUTR_BOOST - [2:0] */ | ||
| 1316 | #define WM8994_SPKOUTR_BOOST_SHIFT 0 /* SPKOUTR_BOOST - [2:0] */ | ||
| 1317 | #define WM8994_SPKOUTR_BOOST_WIDTH 3 /* SPKOUTR_BOOST - [2:0] */ | ||
| 1318 | |||
| 1319 | /* | ||
| 1320 | * R38 (0x26) - Speaker Volume Left | ||
| 1321 | */ | ||
| 1322 | #define WM8994_SPKOUT_VU 0x0100 /* SPKOUT_VU */ | ||
| 1323 | #define WM8994_SPKOUT_VU_MASK 0x0100 /* SPKOUT_VU */ | ||
| 1324 | #define WM8994_SPKOUT_VU_SHIFT 8 /* SPKOUT_VU */ | ||
| 1325 | #define WM8994_SPKOUT_VU_WIDTH 1 /* SPKOUT_VU */ | ||
| 1326 | #define WM8994_SPKOUTL_ZC 0x0080 /* SPKOUTL_ZC */ | ||
| 1327 | #define WM8994_SPKOUTL_ZC_MASK 0x0080 /* SPKOUTL_ZC */ | ||
| 1328 | #define WM8994_SPKOUTL_ZC_SHIFT 7 /* SPKOUTL_ZC */ | ||
| 1329 | #define WM8994_SPKOUTL_ZC_WIDTH 1 /* SPKOUTL_ZC */ | ||
| 1330 | #define WM8994_SPKOUTL_MUTE_N 0x0040 /* SPKOUTL_MUTE_N */ | ||
| 1331 | #define WM8994_SPKOUTL_MUTE_N_MASK 0x0040 /* SPKOUTL_MUTE_N */ | ||
| 1332 | #define WM8994_SPKOUTL_MUTE_N_SHIFT 6 /* SPKOUTL_MUTE_N */ | ||
| 1333 | #define WM8994_SPKOUTL_MUTE_N_WIDTH 1 /* SPKOUTL_MUTE_N */ | ||
| 1334 | #define WM8994_SPKOUTL_VOL_MASK 0x003F /* SPKOUTL_VOL - [5:0] */ | ||
| 1335 | #define WM8994_SPKOUTL_VOL_SHIFT 0 /* SPKOUTL_VOL - [5:0] */ | ||
| 1336 | #define WM8994_SPKOUTL_VOL_WIDTH 6 /* SPKOUTL_VOL - [5:0] */ | ||
| 1337 | |||
| 1338 | /* | ||
| 1339 | * R39 (0x27) - Speaker Volume Right | ||
| 1340 | */ | ||
| 1341 | #define WM8994_SPKOUT_VU 0x0100 /* SPKOUT_VU */ | ||
| 1342 | #define WM8994_SPKOUT_VU_MASK 0x0100 /* SPKOUT_VU */ | ||
| 1343 | #define WM8994_SPKOUT_VU_SHIFT 8 /* SPKOUT_VU */ | ||
| 1344 | #define WM8994_SPKOUT_VU_WIDTH 1 /* SPKOUT_VU */ | ||
| 1345 | #define WM8994_SPKOUTR_ZC 0x0080 /* SPKOUTR_ZC */ | ||
| 1346 | #define WM8994_SPKOUTR_ZC_MASK 0x0080 /* SPKOUTR_ZC */ | ||
| 1347 | #define WM8994_SPKOUTR_ZC_SHIFT 7 /* SPKOUTR_ZC */ | ||
| 1348 | #define WM8994_SPKOUTR_ZC_WIDTH 1 /* SPKOUTR_ZC */ | ||
| 1349 | #define WM8994_SPKOUTR_MUTE_N 0x0040 /* SPKOUTR_MUTE_N */ | ||
| 1350 | #define WM8994_SPKOUTR_MUTE_N_MASK 0x0040 /* SPKOUTR_MUTE_N */ | ||
| 1351 | #define WM8994_SPKOUTR_MUTE_N_SHIFT 6 /* SPKOUTR_MUTE_N */ | ||
| 1352 | #define WM8994_SPKOUTR_MUTE_N_WIDTH 1 /* SPKOUTR_MUTE_N */ | ||
| 1353 | #define WM8994_SPKOUTR_VOL_MASK 0x003F /* SPKOUTR_VOL - [5:0] */ | ||
| 1354 | #define WM8994_SPKOUTR_VOL_SHIFT 0 /* SPKOUTR_VOL - [5:0] */ | ||
| 1355 | #define WM8994_SPKOUTR_VOL_WIDTH 6 /* SPKOUTR_VOL - [5:0] */ | ||
| 1356 | |||
| 1357 | /* | ||
| 1358 | * R40 (0x28) - Input Mixer (2) | ||
| 1359 | */ | ||
| 1360 | #define WM8994_IN2LP_TO_IN2L 0x0080 /* IN2LP_TO_IN2L */ | ||
| 1361 | #define WM8994_IN2LP_TO_IN2L_MASK 0x0080 /* IN2LP_TO_IN2L */ | ||
| 1362 | #define WM8994_IN2LP_TO_IN2L_SHIFT 7 /* IN2LP_TO_IN2L */ | ||
| 1363 | #define WM8994_IN2LP_TO_IN2L_WIDTH 1 /* IN2LP_TO_IN2L */ | ||
| 1364 | #define WM8994_IN2LN_TO_IN2L 0x0040 /* IN2LN_TO_IN2L */ | ||
| 1365 | #define WM8994_IN2LN_TO_IN2L_MASK 0x0040 /* IN2LN_TO_IN2L */ | ||
| 1366 | #define WM8994_IN2LN_TO_IN2L_SHIFT 6 /* IN2LN_TO_IN2L */ | ||
| 1367 | #define WM8994_IN2LN_TO_IN2L_WIDTH 1 /* IN2LN_TO_IN2L */ | ||
| 1368 | #define WM8994_IN1LP_TO_IN1L 0x0020 /* IN1LP_TO_IN1L */ | ||
| 1369 | #define WM8994_IN1LP_TO_IN1L_MASK 0x0020 /* IN1LP_TO_IN1L */ | ||
| 1370 | #define WM8994_IN1LP_TO_IN1L_SHIFT 5 /* IN1LP_TO_IN1L */ | ||
| 1371 | #define WM8994_IN1LP_TO_IN1L_WIDTH 1 /* IN1LP_TO_IN1L */ | ||
| 1372 | #define WM8994_IN1LN_TO_IN1L 0x0010 /* IN1LN_TO_IN1L */ | ||
| 1373 | #define WM8994_IN1LN_TO_IN1L_MASK 0x0010 /* IN1LN_TO_IN1L */ | ||
| 1374 | #define WM8994_IN1LN_TO_IN1L_SHIFT 4 /* IN1LN_TO_IN1L */ | ||
| 1375 | #define WM8994_IN1LN_TO_IN1L_WIDTH 1 /* IN1LN_TO_IN1L */ | ||
| 1376 | #define WM8994_IN2RP_TO_IN2R 0x0008 /* IN2RP_TO_IN2R */ | ||
| 1377 | #define WM8994_IN2RP_TO_IN2R_MASK 0x0008 /* IN2RP_TO_IN2R */ | ||
| 1378 | #define WM8994_IN2RP_TO_IN2R_SHIFT 3 /* IN2RP_TO_IN2R */ | ||
| 1379 | #define WM8994_IN2RP_TO_IN2R_WIDTH 1 /* IN2RP_TO_IN2R */ | ||
| 1380 | #define WM8994_IN2RN_TO_IN2R 0x0004 /* IN2RN_TO_IN2R */ | ||
| 1381 | #define WM8994_IN2RN_TO_IN2R_MASK 0x0004 /* IN2RN_TO_IN2R */ | ||
| 1382 | #define WM8994_IN2RN_TO_IN2R_SHIFT 2 /* IN2RN_TO_IN2R */ | ||
| 1383 | #define WM8994_IN2RN_TO_IN2R_WIDTH 1 /* IN2RN_TO_IN2R */ | ||
| 1384 | #define WM8994_IN1RP_TO_IN1R 0x0002 /* IN1RP_TO_IN1R */ | ||
| 1385 | #define WM8994_IN1RP_TO_IN1R_MASK 0x0002 /* IN1RP_TO_IN1R */ | ||
| 1386 | #define WM8994_IN1RP_TO_IN1R_SHIFT 1 /* IN1RP_TO_IN1R */ | ||
| 1387 | #define WM8994_IN1RP_TO_IN1R_WIDTH 1 /* IN1RP_TO_IN1R */ | ||
| 1388 | #define WM8994_IN1RN_TO_IN1R 0x0001 /* IN1RN_TO_IN1R */ | ||
| 1389 | #define WM8994_IN1RN_TO_IN1R_MASK 0x0001 /* IN1RN_TO_IN1R */ | ||
| 1390 | #define WM8994_IN1RN_TO_IN1R_SHIFT 0 /* IN1RN_TO_IN1R */ | ||
| 1391 | #define WM8994_IN1RN_TO_IN1R_WIDTH 1 /* IN1RN_TO_IN1R */ | ||
| 1392 | |||
| 1393 | /* | ||
| 1394 | * R41 (0x29) - Input Mixer (3) | ||
| 1395 | */ | ||
| 1396 | #define WM8994_IN2L_TO_MIXINL 0x0100 /* IN2L_TO_MIXINL */ | ||
| 1397 | #define WM8994_IN2L_TO_MIXINL_MASK 0x0100 /* IN2L_TO_MIXINL */ | ||
| 1398 | #define WM8994_IN2L_TO_MIXINL_SHIFT 8 /* IN2L_TO_MIXINL */ | ||
| 1399 | #define WM8994_IN2L_TO_MIXINL_WIDTH 1 /* IN2L_TO_MIXINL */ | ||
| 1400 | #define WM8994_IN2L_MIXINL_VOL 0x0080 /* IN2L_MIXINL_VOL */ | ||
| 1401 | #define WM8994_IN2L_MIXINL_VOL_MASK 0x0080 /* IN2L_MIXINL_VOL */ | ||
| 1402 | #define WM8994_IN2L_MIXINL_VOL_SHIFT 7 /* IN2L_MIXINL_VOL */ | ||
| 1403 | #define WM8994_IN2L_MIXINL_VOL_WIDTH 1 /* IN2L_MIXINL_VOL */ | ||
| 1404 | #define WM8994_IN1L_TO_MIXINL 0x0020 /* IN1L_TO_MIXINL */ | ||
| 1405 | #define WM8994_IN1L_TO_MIXINL_MASK 0x0020 /* IN1L_TO_MIXINL */ | ||
| 1406 | #define WM8994_IN1L_TO_MIXINL_SHIFT 5 /* IN1L_TO_MIXINL */ | ||
| 1407 | #define WM8994_IN1L_TO_MIXINL_WIDTH 1 /* IN1L_TO_MIXINL */ | ||
| 1408 | #define WM8994_IN1L_MIXINL_VOL 0x0010 /* IN1L_MIXINL_VOL */ | ||
| 1409 | #define WM8994_IN1L_MIXINL_VOL_MASK 0x0010 /* IN1L_MIXINL_VOL */ | ||
| 1410 | #define WM8994_IN1L_MIXINL_VOL_SHIFT 4 /* IN1L_MIXINL_VOL */ | ||
| 1411 | #define WM8994_IN1L_MIXINL_VOL_WIDTH 1 /* IN1L_MIXINL_VOL */ | ||
| 1412 | #define WM8994_MIXOUTL_MIXINL_VOL_MASK 0x0007 /* MIXOUTL_MIXINL_VOL - [2:0] */ | ||
| 1413 | #define WM8994_MIXOUTL_MIXINL_VOL_SHIFT 0 /* MIXOUTL_MIXINL_VOL - [2:0] */ | ||
| 1414 | #define WM8994_MIXOUTL_MIXINL_VOL_WIDTH 3 /* MIXOUTL_MIXINL_VOL - [2:0] */ | ||
| 1415 | |||
| 1416 | /* | ||
| 1417 | * R42 (0x2A) - Input Mixer (4) | ||
| 1418 | */ | ||
| 1419 | #define WM8994_IN2R_TO_MIXINR 0x0100 /* IN2R_TO_MIXINR */ | ||
| 1420 | #define WM8994_IN2R_TO_MIXINR_MASK 0x0100 /* IN2R_TO_MIXINR */ | ||
| 1421 | #define WM8994_IN2R_TO_MIXINR_SHIFT 8 /* IN2R_TO_MIXINR */ | ||
| 1422 | #define WM8994_IN2R_TO_MIXINR_WIDTH 1 /* IN2R_TO_MIXINR */ | ||
| 1423 | #define WM8994_IN2R_MIXINR_VOL 0x0080 /* IN2R_MIXINR_VOL */ | ||
| 1424 | #define WM8994_IN2R_MIXINR_VOL_MASK 0x0080 /* IN2R_MIXINR_VOL */ | ||
| 1425 | #define WM8994_IN2R_MIXINR_VOL_SHIFT 7 /* IN2R_MIXINR_VOL */ | ||
| 1426 | #define WM8994_IN2R_MIXINR_VOL_WIDTH 1 /* IN2R_MIXINR_VOL */ | ||
| 1427 | #define WM8994_IN1R_TO_MIXINR 0x0020 /* IN1R_TO_MIXINR */ | ||
| 1428 | #define WM8994_IN1R_TO_MIXINR_MASK 0x0020 /* IN1R_TO_MIXINR */ | ||
| 1429 | #define WM8994_IN1R_TO_MIXINR_SHIFT 5 /* IN1R_TO_MIXINR */ | ||
| 1430 | #define WM8994_IN1R_TO_MIXINR_WIDTH 1 /* IN1R_TO_MIXINR */ | ||
| 1431 | #define WM8994_IN1R_MIXINR_VOL 0x0010 /* IN1R_MIXINR_VOL */ | ||
| 1432 | #define WM8994_IN1R_MIXINR_VOL_MASK 0x0010 /* IN1R_MIXINR_VOL */ | ||
| 1433 | #define WM8994_IN1R_MIXINR_VOL_SHIFT 4 /* IN1R_MIXINR_VOL */ | ||
| 1434 | #define WM8994_IN1R_MIXINR_VOL_WIDTH 1 /* IN1R_MIXINR_VOL */ | ||
| 1435 | #define WM8994_MIXOUTR_MIXINR_VOL_MASK 0x0007 /* MIXOUTR_MIXINR_VOL - [2:0] */ | ||
| 1436 | #define WM8994_MIXOUTR_MIXINR_VOL_SHIFT 0 /* MIXOUTR_MIXINR_VOL - [2:0] */ | ||
| 1437 | #define WM8994_MIXOUTR_MIXINR_VOL_WIDTH 3 /* MIXOUTR_MIXINR_VOL - [2:0] */ | ||
| 1438 | |||
| 1439 | /* | ||
| 1440 | * R43 (0x2B) - Input Mixer (5) | ||
| 1441 | */ | ||
| 1442 | #define WM8994_IN1LP_MIXINL_VOL_MASK 0x01C0 /* IN1LP_MIXINL_VOL - [8:6] */ | ||
| 1443 | #define WM8994_IN1LP_MIXINL_VOL_SHIFT 6 /* IN1LP_MIXINL_VOL - [8:6] */ | ||
| 1444 | #define WM8994_IN1LP_MIXINL_VOL_WIDTH 3 /* IN1LP_MIXINL_VOL - [8:6] */ | ||
| 1445 | #define WM8994_IN2LRP_MIXINL_VOL_MASK 0x0007 /* IN2LRP_MIXINL_VOL - [2:0] */ | ||
| 1446 | #define WM8994_IN2LRP_MIXINL_VOL_SHIFT 0 /* IN2LRP_MIXINL_VOL - [2:0] */ | ||
| 1447 | #define WM8994_IN2LRP_MIXINL_VOL_WIDTH 3 /* IN2LRP_MIXINL_VOL - [2:0] */ | ||
| 1448 | |||
| 1449 | /* | ||
| 1450 | * R44 (0x2C) - Input Mixer (6) | ||
| 1451 | */ | ||
| 1452 | #define WM8994_IN1RP_MIXINR_VOL_MASK 0x01C0 /* IN1RP_MIXINR_VOL - [8:6] */ | ||
| 1453 | #define WM8994_IN1RP_MIXINR_VOL_SHIFT 6 /* IN1RP_MIXINR_VOL - [8:6] */ | ||
| 1454 | #define WM8994_IN1RP_MIXINR_VOL_WIDTH 3 /* IN1RP_MIXINR_VOL - [8:6] */ | ||
| 1455 | #define WM8994_IN2LRP_MIXINR_VOL_MASK 0x0007 /* IN2LRP_MIXINR_VOL - [2:0] */ | ||
| 1456 | #define WM8994_IN2LRP_MIXINR_VOL_SHIFT 0 /* IN2LRP_MIXINR_VOL - [2:0] */ | ||
| 1457 | #define WM8994_IN2LRP_MIXINR_VOL_WIDTH 3 /* IN2LRP_MIXINR_VOL - [2:0] */ | ||
| 1458 | |||
| 1459 | /* | ||
| 1460 | * R45 (0x2D) - Output Mixer (1) | ||
| 1461 | */ | ||
| 1462 | #define WM8994_DAC1L_TO_HPOUT1L 0x0100 /* DAC1L_TO_HPOUT1L */ | ||
| 1463 | #define WM8994_DAC1L_TO_HPOUT1L_MASK 0x0100 /* DAC1L_TO_HPOUT1L */ | ||
| 1464 | #define WM8994_DAC1L_TO_HPOUT1L_SHIFT 8 /* DAC1L_TO_HPOUT1L */ | ||
| 1465 | #define WM8994_DAC1L_TO_HPOUT1L_WIDTH 1 /* DAC1L_TO_HPOUT1L */ | ||
| 1466 | #define WM8994_MIXINR_TO_MIXOUTL 0x0080 /* MIXINR_TO_MIXOUTL */ | ||
| 1467 | #define WM8994_MIXINR_TO_MIXOUTL_MASK 0x0080 /* MIXINR_TO_MIXOUTL */ | ||
| 1468 | #define WM8994_MIXINR_TO_MIXOUTL_SHIFT 7 /* MIXINR_TO_MIXOUTL */ | ||
| 1469 | #define WM8994_MIXINR_TO_MIXOUTL_WIDTH 1 /* MIXINR_TO_MIXOUTL */ | ||
| 1470 | #define WM8994_MIXINL_TO_MIXOUTL 0x0040 /* MIXINL_TO_MIXOUTL */ | ||
| 1471 | #define WM8994_MIXINL_TO_MIXOUTL_MASK 0x0040 /* MIXINL_TO_MIXOUTL */ | ||
| 1472 | #define WM8994_MIXINL_TO_MIXOUTL_SHIFT 6 /* MIXINL_TO_MIXOUTL */ | ||
| 1473 | #define WM8994_MIXINL_TO_MIXOUTL_WIDTH 1 /* MIXINL_TO_MIXOUTL */ | ||
| 1474 | #define WM8994_IN2RN_TO_MIXOUTL 0x0020 /* IN2RN_TO_MIXOUTL */ | ||
| 1475 | #define WM8994_IN2RN_TO_MIXOUTL_MASK 0x0020 /* IN2RN_TO_MIXOUTL */ | ||
| 1476 | #define WM8994_IN2RN_TO_MIXOUTL_SHIFT 5 /* IN2RN_TO_MIXOUTL */ | ||
| 1477 | #define WM8994_IN2RN_TO_MIXOUTL_WIDTH 1 /* IN2RN_TO_MIXOUTL */ | ||
| 1478 | #define WM8994_IN2LN_TO_MIXOUTL 0x0010 /* IN2LN_TO_MIXOUTL */ | ||
| 1479 | #define WM8994_IN2LN_TO_MIXOUTL_MASK 0x0010 /* IN2LN_TO_MIXOUTL */ | ||
| 1480 | #define WM8994_IN2LN_TO_MIXOUTL_SHIFT 4 /* IN2LN_TO_MIXOUTL */ | ||
| 1481 | #define WM8994_IN2LN_TO_MIXOUTL_WIDTH 1 /* IN2LN_TO_MIXOUTL */ | ||
| 1482 | #define WM8994_IN1R_TO_MIXOUTL 0x0008 /* IN1R_TO_MIXOUTL */ | ||
| 1483 | #define WM8994_IN1R_TO_MIXOUTL_MASK 0x0008 /* IN1R_TO_MIXOUTL */ | ||
| 1484 | #define WM8994_IN1R_TO_MIXOUTL_SHIFT 3 /* IN1R_TO_MIXOUTL */ | ||
| 1485 | #define WM8994_IN1R_TO_MIXOUTL_WIDTH 1 /* IN1R_TO_MIXOUTL */ | ||
| 1486 | #define WM8994_IN1L_TO_MIXOUTL 0x0004 /* IN1L_TO_MIXOUTL */ | ||
| 1487 | #define WM8994_IN1L_TO_MIXOUTL_MASK 0x0004 /* IN1L_TO_MIXOUTL */ | ||
| 1488 | #define WM8994_IN1L_TO_MIXOUTL_SHIFT 2 /* IN1L_TO_MIXOUTL */ | ||
| 1489 | #define WM8994_IN1L_TO_MIXOUTL_WIDTH 1 /* IN1L_TO_MIXOUTL */ | ||
| 1490 | #define WM8994_IN2LP_TO_MIXOUTL 0x0002 /* IN2LP_TO_MIXOUTL */ | ||
| 1491 | #define WM8994_IN2LP_TO_MIXOUTL_MASK 0x0002 /* IN2LP_TO_MIXOUTL */ | ||
| 1492 | #define WM8994_IN2LP_TO_MIXOUTL_SHIFT 1 /* IN2LP_TO_MIXOUTL */ | ||
| 1493 | #define WM8994_IN2LP_TO_MIXOUTL_WIDTH 1 /* IN2LP_TO_MIXOUTL */ | ||
| 1494 | #define WM8994_DAC1L_TO_MIXOUTL 0x0001 /* DAC1L_TO_MIXOUTL */ | ||
| 1495 | #define WM8994_DAC1L_TO_MIXOUTL_MASK 0x0001 /* DAC1L_TO_MIXOUTL */ | ||
| 1496 | #define WM8994_DAC1L_TO_MIXOUTL_SHIFT 0 /* DAC1L_TO_MIXOUTL */ | ||
| 1497 | #define WM8994_DAC1L_TO_MIXOUTL_WIDTH 1 /* DAC1L_TO_MIXOUTL */ | ||
| 1498 | |||
| 1499 | /* | ||
| 1500 | * R46 (0x2E) - Output Mixer (2) | ||
| 1501 | */ | ||
| 1502 | #define WM8994_DAC1R_TO_HPOUT1R 0x0100 /* DAC1R_TO_HPOUT1R */ | ||
| 1503 | #define WM8994_DAC1R_TO_HPOUT1R_MASK 0x0100 /* DAC1R_TO_HPOUT1R */ | ||
| 1504 | #define WM8994_DAC1R_TO_HPOUT1R_SHIFT 8 /* DAC1R_TO_HPOUT1R */ | ||
| 1505 | #define WM8994_DAC1R_TO_HPOUT1R_WIDTH 1 /* DAC1R_TO_HPOUT1R */ | ||
| 1506 | #define WM8994_MIXINL_TO_MIXOUTR 0x0080 /* MIXINL_TO_MIXOUTR */ | ||
| 1507 | #define WM8994_MIXINL_TO_MIXOUTR_MASK 0x0080 /* MIXINL_TO_MIXOUTR */ | ||
| 1508 | #define WM8994_MIXINL_TO_MIXOUTR_SHIFT 7 /* MIXINL_TO_MIXOUTR */ | ||
| 1509 | #define WM8994_MIXINL_TO_MIXOUTR_WIDTH 1 /* MIXINL_TO_MIXOUTR */ | ||
| 1510 | #define WM8994_MIXINR_TO_MIXOUTR 0x0040 /* MIXINR_TO_MIXOUTR */ | ||
| 1511 | #define WM8994_MIXINR_TO_MIXOUTR_MASK 0x0040 /* MIXINR_TO_MIXOUTR */ | ||
| 1512 | #define WM8994_MIXINR_TO_MIXOUTR_SHIFT 6 /* MIXINR_TO_MIXOUTR */ | ||
| 1513 | #define WM8994_MIXINR_TO_MIXOUTR_WIDTH 1 /* MIXINR_TO_MIXOUTR */ | ||
| 1514 | #define WM8994_IN2LN_TO_MIXOUTR 0x0020 /* IN2LN_TO_MIXOUTR */ | ||
| 1515 | #define WM8994_IN2LN_TO_MIXOUTR_MASK 0x0020 /* IN2LN_TO_MIXOUTR */ | ||
| 1516 | #define WM8994_IN2LN_TO_MIXOUTR_SHIFT 5 /* IN2LN_TO_MIXOUTR */ | ||
| 1517 | #define WM8994_IN2LN_TO_MIXOUTR_WIDTH 1 /* IN2LN_TO_MIXOUTR */ | ||
| 1518 | #define WM8994_IN2RN_TO_MIXOUTR 0x0010 /* IN2RN_TO_MIXOUTR */ | ||
| 1519 | #define WM8994_IN2RN_TO_MIXOUTR_MASK 0x0010 /* IN2RN_TO_MIXOUTR */ | ||
| 1520 | #define WM8994_IN2RN_TO_MIXOUTR_SHIFT 4 /* IN2RN_TO_MIXOUTR */ | ||
| 1521 | #define WM8994_IN2RN_TO_MIXOUTR_WIDTH 1 /* IN2RN_TO_MIXOUTR */ | ||
| 1522 | #define WM8994_IN1L_TO_MIXOUTR 0x0008 /* IN1L_TO_MIXOUTR */ | ||
| 1523 | #define WM8994_IN1L_TO_MIXOUTR_MASK 0x0008 /* IN1L_TO_MIXOUTR */ | ||
| 1524 | #define WM8994_IN1L_TO_MIXOUTR_SHIFT 3 /* IN1L_TO_MIXOUTR */ | ||
| 1525 | #define WM8994_IN1L_TO_MIXOUTR_WIDTH 1 /* IN1L_TO_MIXOUTR */ | ||
| 1526 | #define WM8994_IN1R_TO_MIXOUTR 0x0004 /* IN1R_TO_MIXOUTR */ | ||
| 1527 | #define WM8994_IN1R_TO_MIXOUTR_MASK 0x0004 /* IN1R_TO_MIXOUTR */ | ||
| 1528 | #define WM8994_IN1R_TO_MIXOUTR_SHIFT 2 /* IN1R_TO_MIXOUTR */ | ||
| 1529 | #define WM8994_IN1R_TO_MIXOUTR_WIDTH 1 /* IN1R_TO_MIXOUTR */ | ||
| 1530 | #define WM8994_IN2RP_TO_MIXOUTR 0x0002 /* IN2RP_TO_MIXOUTR */ | ||
| 1531 | #define WM8994_IN2RP_TO_MIXOUTR_MASK 0x0002 /* IN2RP_TO_MIXOUTR */ | ||
| 1532 | #define WM8994_IN2RP_TO_MIXOUTR_SHIFT 1 /* IN2RP_TO_MIXOUTR */ | ||
| 1533 | #define WM8994_IN2RP_TO_MIXOUTR_WIDTH 1 /* IN2RP_TO_MIXOUTR */ | ||
| 1534 | #define WM8994_DAC1R_TO_MIXOUTR 0x0001 /* DAC1R_TO_MIXOUTR */ | ||
| 1535 | #define WM8994_DAC1R_TO_MIXOUTR_MASK 0x0001 /* DAC1R_TO_MIXOUTR */ | ||
| 1536 | #define WM8994_DAC1R_TO_MIXOUTR_SHIFT 0 /* DAC1R_TO_MIXOUTR */ | ||
| 1537 | #define WM8994_DAC1R_TO_MIXOUTR_WIDTH 1 /* DAC1R_TO_MIXOUTR */ | ||
| 1538 | |||
| 1539 | /* | ||
| 1540 | * R47 (0x2F) - Output Mixer (3) | ||
| 1541 | */ | ||
| 1542 | #define WM8994_IN2LP_MIXOUTL_VOL_MASK 0x0E00 /* IN2LP_MIXOUTL_VOL - [11:9] */ | ||
| 1543 | #define WM8994_IN2LP_MIXOUTL_VOL_SHIFT 9 /* IN2LP_MIXOUTL_VOL - [11:9] */ | ||
| 1544 | #define WM8994_IN2LP_MIXOUTL_VOL_WIDTH 3 /* IN2LP_MIXOUTL_VOL - [11:9] */ | ||
| 1545 | #define WM8994_IN2LN_MIXOUTL_VOL_MASK 0x01C0 /* IN2LN_MIXOUTL_VOL - [8:6] */ | ||
| 1546 | #define WM8994_IN2LN_MIXOUTL_VOL_SHIFT 6 /* IN2LN_MIXOUTL_VOL - [8:6] */ | ||
| 1547 | #define WM8994_IN2LN_MIXOUTL_VOL_WIDTH 3 /* IN2LN_MIXOUTL_VOL - [8:6] */ | ||
| 1548 | #define WM8994_IN1R_MIXOUTL_VOL_MASK 0x0038 /* IN1R_MIXOUTL_VOL - [5:3] */ | ||
| 1549 | #define WM8994_IN1R_MIXOUTL_VOL_SHIFT 3 /* IN1R_MIXOUTL_VOL - [5:3] */ | ||
| 1550 | #define WM8994_IN1R_MIXOUTL_VOL_WIDTH 3 /* IN1R_MIXOUTL_VOL - [5:3] */ | ||
| 1551 | #define WM8994_IN1L_MIXOUTL_VOL_MASK 0x0007 /* IN1L_MIXOUTL_VOL - [2:0] */ | ||
| 1552 | #define WM8994_IN1L_MIXOUTL_VOL_SHIFT 0 /* IN1L_MIXOUTL_VOL - [2:0] */ | ||
| 1553 | #define WM8994_IN1L_MIXOUTL_VOL_WIDTH 3 /* IN1L_MIXOUTL_VOL - [2:0] */ | ||
| 1554 | |||
| 1555 | /* | ||
| 1556 | * R48 (0x30) - Output Mixer (4) | ||
| 1557 | */ | ||
| 1558 | #define WM8994_IN2RP_MIXOUTR_VOL_MASK 0x0E00 /* IN2RP_MIXOUTR_VOL - [11:9] */ | ||
| 1559 | #define WM8994_IN2RP_MIXOUTR_VOL_SHIFT 9 /* IN2RP_MIXOUTR_VOL - [11:9] */ | ||
| 1560 | #define WM8994_IN2RP_MIXOUTR_VOL_WIDTH 3 /* IN2RP_MIXOUTR_VOL - [11:9] */ | ||
| 1561 | #define WM8994_IN2RN_MIXOUTR_VOL_MASK 0x01C0 /* IN2RN_MIXOUTR_VOL - [8:6] */ | ||
| 1562 | #define WM8994_IN2RN_MIXOUTR_VOL_SHIFT 6 /* IN2RN_MIXOUTR_VOL - [8:6] */ | ||
| 1563 | #define WM8994_IN2RN_MIXOUTR_VOL_WIDTH 3 /* IN2RN_MIXOUTR_VOL - [8:6] */ | ||
| 1564 | #define WM8994_IN1L_MIXOUTR_VOL_MASK 0x0038 /* IN1L_MIXOUTR_VOL - [5:3] */ | ||
| 1565 | #define WM8994_IN1L_MIXOUTR_VOL_SHIFT 3 /* IN1L_MIXOUTR_VOL - [5:3] */ | ||
| 1566 | #define WM8994_IN1L_MIXOUTR_VOL_WIDTH 3 /* IN1L_MIXOUTR_VOL - [5:3] */ | ||
| 1567 | #define WM8994_IN1R_MIXOUTR_VOL_MASK 0x0007 /* IN1R_MIXOUTR_VOL - [2:0] */ | ||
| 1568 | #define WM8994_IN1R_MIXOUTR_VOL_SHIFT 0 /* IN1R_MIXOUTR_VOL - [2:0] */ | ||
| 1569 | #define WM8994_IN1R_MIXOUTR_VOL_WIDTH 3 /* IN1R_MIXOUTR_VOL - [2:0] */ | ||
| 1570 | |||
| 1571 | /* | ||
| 1572 | * R49 (0x31) - Output Mixer (5) | ||
| 1573 | */ | ||
| 1574 | #define WM8994_DAC1L_MIXOUTL_VOL_MASK 0x0E00 /* DAC1L_MIXOUTL_VOL - [11:9] */ | ||
| 1575 | #define WM8994_DAC1L_MIXOUTL_VOL_SHIFT 9 /* DAC1L_MIXOUTL_VOL - [11:9] */ | ||
| 1576 | #define WM8994_DAC1L_MIXOUTL_VOL_WIDTH 3 /* DAC1L_MIXOUTL_VOL - [11:9] */ | ||
| 1577 | #define WM8994_IN2RN_MIXOUTL_VOL_MASK 0x01C0 /* IN2RN_MIXOUTL_VOL - [8:6] */ | ||
| 1578 | #define WM8994_IN2RN_MIXOUTL_VOL_SHIFT 6 /* IN2RN_MIXOUTL_VOL - [8:6] */ | ||
| 1579 | #define WM8994_IN2RN_MIXOUTL_VOL_WIDTH 3 /* IN2RN_MIXOUTL_VOL - [8:6] */ | ||
| 1580 | #define WM8994_MIXINR_MIXOUTL_VOL_MASK 0x0038 /* MIXINR_MIXOUTL_VOL - [5:3] */ | ||
| 1581 | #define WM8994_MIXINR_MIXOUTL_VOL_SHIFT 3 /* MIXINR_MIXOUTL_VOL - [5:3] */ | ||
| 1582 | #define WM8994_MIXINR_MIXOUTL_VOL_WIDTH 3 /* MIXINR_MIXOUTL_VOL - [5:3] */ | ||
| 1583 | #define WM8994_MIXINL_MIXOUTL_VOL_MASK 0x0007 /* MIXINL_MIXOUTL_VOL - [2:0] */ | ||
| 1584 | #define WM8994_MIXINL_MIXOUTL_VOL_SHIFT 0 /* MIXINL_MIXOUTL_VOL - [2:0] */ | ||
| 1585 | #define WM8994_MIXINL_MIXOUTL_VOL_WIDTH 3 /* MIXINL_MIXOUTL_VOL - [2:0] */ | ||
| 1586 | |||
| 1587 | /* | ||
| 1588 | * R50 (0x32) - Output Mixer (6) | ||
| 1589 | */ | ||
| 1590 | #define WM8994_DAC1R_MIXOUTR_VOL_MASK 0x0E00 /* DAC1R_MIXOUTR_VOL - [11:9] */ | ||
| 1591 | #define WM8994_DAC1R_MIXOUTR_VOL_SHIFT 9 /* DAC1R_MIXOUTR_VOL - [11:9] */ | ||
| 1592 | #define WM8994_DAC1R_MIXOUTR_VOL_WIDTH 3 /* DAC1R_MIXOUTR_VOL - [11:9] */ | ||
| 1593 | #define WM8994_IN2LN_MIXOUTR_VOL_MASK 0x01C0 /* IN2LN_MIXOUTR_VOL - [8:6] */ | ||
| 1594 | #define WM8994_IN2LN_MIXOUTR_VOL_SHIFT 6 /* IN2LN_MIXOUTR_VOL - [8:6] */ | ||
| 1595 | #define WM8994_IN2LN_MIXOUTR_VOL_WIDTH 3 /* IN2LN_MIXOUTR_VOL - [8:6] */ | ||
| 1596 | #define WM8994_MIXINL_MIXOUTR_VOL_MASK 0x0038 /* MIXINL_MIXOUTR_VOL - [5:3] */ | ||
| 1597 | #define WM8994_MIXINL_MIXOUTR_VOL_SHIFT 3 /* MIXINL_MIXOUTR_VOL - [5:3] */ | ||
| 1598 | #define WM8994_MIXINL_MIXOUTR_VOL_WIDTH 3 /* MIXINL_MIXOUTR_VOL - [5:3] */ | ||
| 1599 | #define WM8994_MIXINR_MIXOUTR_VOL_MASK 0x0007 /* MIXINR_MIXOUTR_VOL - [2:0] */ | ||
| 1600 | #define WM8994_MIXINR_MIXOUTR_VOL_SHIFT 0 /* MIXINR_MIXOUTR_VOL - [2:0] */ | ||
| 1601 | #define WM8994_MIXINR_MIXOUTR_VOL_WIDTH 3 /* MIXINR_MIXOUTR_VOL - [2:0] */ | ||
| 1602 | |||
| 1603 | /* | ||
| 1604 | * R51 (0x33) - HPOUT2 Mixer | ||
| 1605 | */ | ||
| 1606 | #define WM8994_IN2LRP_TO_HPOUT2 0x0020 /* IN2LRP_TO_HPOUT2 */ | ||
| 1607 | #define WM8994_IN2LRP_TO_HPOUT2_MASK 0x0020 /* IN2LRP_TO_HPOUT2 */ | ||
| 1608 | #define WM8994_IN2LRP_TO_HPOUT2_SHIFT 5 /* IN2LRP_TO_HPOUT2 */ | ||
| 1609 | #define WM8994_IN2LRP_TO_HPOUT2_WIDTH 1 /* IN2LRP_TO_HPOUT2 */ | ||
| 1610 | #define WM8994_MIXOUTLVOL_TO_HPOUT2 0x0010 /* MIXOUTLVOL_TO_HPOUT2 */ | ||
| 1611 | #define WM8994_MIXOUTLVOL_TO_HPOUT2_MASK 0x0010 /* MIXOUTLVOL_TO_HPOUT2 */ | ||
| 1612 | #define WM8994_MIXOUTLVOL_TO_HPOUT2_SHIFT 4 /* MIXOUTLVOL_TO_HPOUT2 */ | ||
| 1613 | #define WM8994_MIXOUTLVOL_TO_HPOUT2_WIDTH 1 /* MIXOUTLVOL_TO_HPOUT2 */ | ||
| 1614 | #define WM8994_MIXOUTRVOL_TO_HPOUT2 0x0008 /* MIXOUTRVOL_TO_HPOUT2 */ | ||
| 1615 | #define WM8994_MIXOUTRVOL_TO_HPOUT2_MASK 0x0008 /* MIXOUTRVOL_TO_HPOUT2 */ | ||
| 1616 | #define WM8994_MIXOUTRVOL_TO_HPOUT2_SHIFT 3 /* MIXOUTRVOL_TO_HPOUT2 */ | ||
| 1617 | #define WM8994_MIXOUTRVOL_TO_HPOUT2_WIDTH 1 /* MIXOUTRVOL_TO_HPOUT2 */ | ||
| 1618 | |||
| 1619 | /* | ||
| 1620 | * R52 (0x34) - Line Mixer (1) | ||
| 1621 | */ | ||
| 1622 | #define WM8994_MIXOUTL_TO_LINEOUT1N 0x0040 /* MIXOUTL_TO_LINEOUT1N */ | ||
| 1623 | #define WM8994_MIXOUTL_TO_LINEOUT1N_MASK 0x0040 /* MIXOUTL_TO_LINEOUT1N */ | ||
| 1624 | #define WM8994_MIXOUTL_TO_LINEOUT1N_SHIFT 6 /* MIXOUTL_TO_LINEOUT1N */ | ||
| 1625 | #define WM8994_MIXOUTL_TO_LINEOUT1N_WIDTH 1 /* MIXOUTL_TO_LINEOUT1N */ | ||
| 1626 | #define WM8994_MIXOUTR_TO_LINEOUT1N 0x0020 /* MIXOUTR_TO_LINEOUT1N */ | ||
| 1627 | #define WM8994_MIXOUTR_TO_LINEOUT1N_MASK 0x0020 /* MIXOUTR_TO_LINEOUT1N */ | ||
| 1628 | #define WM8994_MIXOUTR_TO_LINEOUT1N_SHIFT 5 /* MIXOUTR_TO_LINEOUT1N */ | ||
| 1629 | #define WM8994_MIXOUTR_TO_LINEOUT1N_WIDTH 1 /* MIXOUTR_TO_LINEOUT1N */ | ||
| 1630 | #define WM8994_LINEOUT1_MODE 0x0010 /* LINEOUT1_MODE */ | ||
| 1631 | #define WM8994_LINEOUT1_MODE_MASK 0x0010 /* LINEOUT1_MODE */ | ||
| 1632 | #define WM8994_LINEOUT1_MODE_SHIFT 4 /* LINEOUT1_MODE */ | ||
| 1633 | #define WM8994_LINEOUT1_MODE_WIDTH 1 /* LINEOUT1_MODE */ | ||
| 1634 | #define WM8994_IN1R_TO_LINEOUT1P 0x0004 /* IN1R_TO_LINEOUT1P */ | ||
| 1635 | #define WM8994_IN1R_TO_LINEOUT1P_MASK 0x0004 /* IN1R_TO_LINEOUT1P */ | ||
| 1636 | #define WM8994_IN1R_TO_LINEOUT1P_SHIFT 2 /* IN1R_TO_LINEOUT1P */ | ||
| 1637 | #define WM8994_IN1R_TO_LINEOUT1P_WIDTH 1 /* IN1R_TO_LINEOUT1P */ | ||
| 1638 | #define WM8994_IN1L_TO_LINEOUT1P 0x0002 /* IN1L_TO_LINEOUT1P */ | ||
| 1639 | #define WM8994_IN1L_TO_LINEOUT1P_MASK 0x0002 /* IN1L_TO_LINEOUT1P */ | ||
| 1640 | #define WM8994_IN1L_TO_LINEOUT1P_SHIFT 1 /* IN1L_TO_LINEOUT1P */ | ||
| 1641 | #define WM8994_IN1L_TO_LINEOUT1P_WIDTH 1 /* IN1L_TO_LINEOUT1P */ | ||
| 1642 | #define WM8994_MIXOUTL_TO_LINEOUT1P 0x0001 /* MIXOUTL_TO_LINEOUT1P */ | ||
| 1643 | #define WM8994_MIXOUTL_TO_LINEOUT1P_MASK 0x0001 /* MIXOUTL_TO_LINEOUT1P */ | ||
| 1644 | #define WM8994_MIXOUTL_TO_LINEOUT1P_SHIFT 0 /* MIXOUTL_TO_LINEOUT1P */ | ||
| 1645 | #define WM8994_MIXOUTL_TO_LINEOUT1P_WIDTH 1 /* MIXOUTL_TO_LINEOUT1P */ | ||
| 1646 | |||
| 1647 | /* | ||
| 1648 | * R53 (0x35) - Line Mixer (2) | ||
| 1649 | */ | ||
| 1650 | #define WM8994_MIXOUTR_TO_LINEOUT2N 0x0040 /* MIXOUTR_TO_LINEOUT2N */ | ||
| 1651 | #define WM8994_MIXOUTR_TO_LINEOUT2N_MASK 0x0040 /* MIXOUTR_TO_LINEOUT2N */ | ||
| 1652 | #define WM8994_MIXOUTR_TO_LINEOUT2N_SHIFT 6 /* MIXOUTR_TO_LINEOUT2N */ | ||
| 1653 | #define WM8994_MIXOUTR_TO_LINEOUT2N_WIDTH 1 /* MIXOUTR_TO_LINEOUT2N */ | ||
| 1654 | #define WM8994_MIXOUTL_TO_LINEOUT2N 0x0020 /* MIXOUTL_TO_LINEOUT2N */ | ||
| 1655 | #define WM8994_MIXOUTL_TO_LINEOUT2N_MASK 0x0020 /* MIXOUTL_TO_LINEOUT2N */ | ||
| 1656 | #define WM8994_MIXOUTL_TO_LINEOUT2N_SHIFT 5 /* MIXOUTL_TO_LINEOUT2N */ | ||
| 1657 | #define WM8994_MIXOUTL_TO_LINEOUT2N_WIDTH 1 /* MIXOUTL_TO_LINEOUT2N */ | ||
| 1658 | #define WM8994_LINEOUT2_MODE 0x0010 /* LINEOUT2_MODE */ | ||
| 1659 | #define WM8994_LINEOUT2_MODE_MASK 0x0010 /* LINEOUT2_MODE */ | ||
| 1660 | #define WM8994_LINEOUT2_MODE_SHIFT 4 /* LINEOUT2_MODE */ | ||
| 1661 | #define WM8994_LINEOUT2_MODE_WIDTH 1 /* LINEOUT2_MODE */ | ||
| 1662 | #define WM8994_IN1L_TO_LINEOUT2P 0x0004 /* IN1L_TO_LINEOUT2P */ | ||
| 1663 | #define WM8994_IN1L_TO_LINEOUT2P_MASK 0x0004 /* IN1L_TO_LINEOUT2P */ | ||
| 1664 | #define WM8994_IN1L_TO_LINEOUT2P_SHIFT 2 /* IN1L_TO_LINEOUT2P */ | ||
| 1665 | #define WM8994_IN1L_TO_LINEOUT2P_WIDTH 1 /* IN1L_TO_LINEOUT2P */ | ||
| 1666 | #define WM8994_IN1R_TO_LINEOUT2P 0x0002 /* IN1R_TO_LINEOUT2P */ | ||
| 1667 | #define WM8994_IN1R_TO_LINEOUT2P_MASK 0x0002 /* IN1R_TO_LINEOUT2P */ | ||
| 1668 | #define WM8994_IN1R_TO_LINEOUT2P_SHIFT 1 /* IN1R_TO_LINEOUT2P */ | ||
| 1669 | #define WM8994_IN1R_TO_LINEOUT2P_WIDTH 1 /* IN1R_TO_LINEOUT2P */ | ||
| 1670 | #define WM8994_MIXOUTR_TO_LINEOUT2P 0x0001 /* MIXOUTR_TO_LINEOUT2P */ | ||
| 1671 | #define WM8994_MIXOUTR_TO_LINEOUT2P_MASK 0x0001 /* MIXOUTR_TO_LINEOUT2P */ | ||
| 1672 | #define WM8994_MIXOUTR_TO_LINEOUT2P_SHIFT 0 /* MIXOUTR_TO_LINEOUT2P */ | ||
| 1673 | #define WM8994_MIXOUTR_TO_LINEOUT2P_WIDTH 1 /* MIXOUTR_TO_LINEOUT2P */ | ||
| 1674 | |||
| 1675 | /* | ||
| 1676 | * R54 (0x36) - Speaker Mixer | ||
| 1677 | */ | ||
| 1678 | #define WM8994_DAC2L_TO_SPKMIXL 0x0200 /* DAC2L_TO_SPKMIXL */ | ||
| 1679 | #define WM8994_DAC2L_TO_SPKMIXL_MASK 0x0200 /* DAC2L_TO_SPKMIXL */ | ||
| 1680 | #define WM8994_DAC2L_TO_SPKMIXL_SHIFT 9 /* DAC2L_TO_SPKMIXL */ | ||
| 1681 | #define WM8994_DAC2L_TO_SPKMIXL_WIDTH 1 /* DAC2L_TO_SPKMIXL */ | ||
| 1682 | #define WM8994_DAC2R_TO_SPKMIXR 0x0100 /* DAC2R_TO_SPKMIXR */ | ||
| 1683 | #define WM8994_DAC2R_TO_SPKMIXR_MASK 0x0100 /* DAC2R_TO_SPKMIXR */ | ||
| 1684 | #define WM8994_DAC2R_TO_SPKMIXR_SHIFT 8 /* DAC2R_TO_SPKMIXR */ | ||
| 1685 | #define WM8994_DAC2R_TO_SPKMIXR_WIDTH 1 /* DAC2R_TO_SPKMIXR */ | ||
| 1686 | #define WM8994_MIXINL_TO_SPKMIXL 0x0080 /* MIXINL_TO_SPKMIXL */ | ||
| 1687 | #define WM8994_MIXINL_TO_SPKMIXL_MASK 0x0080 /* MIXINL_TO_SPKMIXL */ | ||
| 1688 | #define WM8994_MIXINL_TO_SPKMIXL_SHIFT 7 /* MIXINL_TO_SPKMIXL */ | ||
| 1689 | #define WM8994_MIXINL_TO_SPKMIXL_WIDTH 1 /* MIXINL_TO_SPKMIXL */ | ||
| 1690 | #define WM8994_MIXINR_TO_SPKMIXR 0x0040 /* MIXINR_TO_SPKMIXR */ | ||
| 1691 | #define WM8994_MIXINR_TO_SPKMIXR_MASK 0x0040 /* MIXINR_TO_SPKMIXR */ | ||
| 1692 | #define WM8994_MIXINR_TO_SPKMIXR_SHIFT 6 /* MIXINR_TO_SPKMIXR */ | ||
| 1693 | #define WM8994_MIXINR_TO_SPKMIXR_WIDTH 1 /* MIXINR_TO_SPKMIXR */ | ||
| 1694 | #define WM8994_IN1LP_TO_SPKMIXL 0x0020 /* IN1LP_TO_SPKMIXL */ | ||
| 1695 | #define WM8994_IN1LP_TO_SPKMIXL_MASK 0x0020 /* IN1LP_TO_SPKMIXL */ | ||
| 1696 | #define WM8994_IN1LP_TO_SPKMIXL_SHIFT 5 /* IN1LP_TO_SPKMIXL */ | ||
| 1697 | #define WM8994_IN1LP_TO_SPKMIXL_WIDTH 1 /* IN1LP_TO_SPKMIXL */ | ||
| 1698 | #define WM8994_IN1RP_TO_SPKMIXR 0x0010 /* IN1RP_TO_SPKMIXR */ | ||
| 1699 | #define WM8994_IN1RP_TO_SPKMIXR_MASK 0x0010 /* IN1RP_TO_SPKMIXR */ | ||
| 1700 | #define WM8994_IN1RP_TO_SPKMIXR_SHIFT 4 /* IN1RP_TO_SPKMIXR */ | ||
| 1701 | #define WM8994_IN1RP_TO_SPKMIXR_WIDTH 1 /* IN1RP_TO_SPKMIXR */ | ||
| 1702 | #define WM8994_MIXOUTL_TO_SPKMIXL 0x0008 /* MIXOUTL_TO_SPKMIXL */ | ||
| 1703 | #define WM8994_MIXOUTL_TO_SPKMIXL_MASK 0x0008 /* MIXOUTL_TO_SPKMIXL */ | ||
| 1704 | #define WM8994_MIXOUTL_TO_SPKMIXL_SHIFT 3 /* MIXOUTL_TO_SPKMIXL */ | ||
| 1705 | #define WM8994_MIXOUTL_TO_SPKMIXL_WIDTH 1 /* MIXOUTL_TO_SPKMIXL */ | ||
| 1706 | #define WM8994_MIXOUTR_TO_SPKMIXR 0x0004 /* MIXOUTR_TO_SPKMIXR */ | ||
| 1707 | #define WM8994_MIXOUTR_TO_SPKMIXR_MASK 0x0004 /* MIXOUTR_TO_SPKMIXR */ | ||
| 1708 | #define WM8994_MIXOUTR_TO_SPKMIXR_SHIFT 2 /* MIXOUTR_TO_SPKMIXR */ | ||
| 1709 | #define WM8994_MIXOUTR_TO_SPKMIXR_WIDTH 1 /* MIXOUTR_TO_SPKMIXR */ | ||
| 1710 | #define WM8994_DAC1L_TO_SPKMIXL 0x0002 /* DAC1L_TO_SPKMIXL */ | ||
| 1711 | #define WM8994_DAC1L_TO_SPKMIXL_MASK 0x0002 /* DAC1L_TO_SPKMIXL */ | ||
| 1712 | #define WM8994_DAC1L_TO_SPKMIXL_SHIFT 1 /* DAC1L_TO_SPKMIXL */ | ||
| 1713 | #define WM8994_DAC1L_TO_SPKMIXL_WIDTH 1 /* DAC1L_TO_SPKMIXL */ | ||
| 1714 | #define WM8994_DAC1R_TO_SPKMIXR 0x0001 /* DAC1R_TO_SPKMIXR */ | ||
| 1715 | #define WM8994_DAC1R_TO_SPKMIXR_MASK 0x0001 /* DAC1R_TO_SPKMIXR */ | ||
| 1716 | #define WM8994_DAC1R_TO_SPKMIXR_SHIFT 0 /* DAC1R_TO_SPKMIXR */ | ||
| 1717 | #define WM8994_DAC1R_TO_SPKMIXR_WIDTH 1 /* DAC1R_TO_SPKMIXR */ | ||
| 1718 | |||
| 1719 | /* | ||
| 1720 | * R55 (0x37) - Additional Control | ||
| 1721 | */ | ||
| 1722 | #define WM8994_LINEOUT1_FB 0x0080 /* LINEOUT1_FB */ | ||
| 1723 | #define WM8994_LINEOUT1_FB_MASK 0x0080 /* LINEOUT1_FB */ | ||
| 1724 | #define WM8994_LINEOUT1_FB_SHIFT 7 /* LINEOUT1_FB */ | ||
| 1725 | #define WM8994_LINEOUT1_FB_WIDTH 1 /* LINEOUT1_FB */ | ||
| 1726 | #define WM8994_LINEOUT2_FB 0x0040 /* LINEOUT2_FB */ | ||
| 1727 | #define WM8994_LINEOUT2_FB_MASK 0x0040 /* LINEOUT2_FB */ | ||
| 1728 | #define WM8994_LINEOUT2_FB_SHIFT 6 /* LINEOUT2_FB */ | ||
| 1729 | #define WM8994_LINEOUT2_FB_WIDTH 1 /* LINEOUT2_FB */ | ||
| 1730 | #define WM8994_VROI 0x0001 /* VROI */ | ||
| 1731 | #define WM8994_VROI_MASK 0x0001 /* VROI */ | ||
| 1732 | #define WM8994_VROI_SHIFT 0 /* VROI */ | ||
| 1733 | #define WM8994_VROI_WIDTH 1 /* VROI */ | ||
| 1734 | |||
| 1735 | /* | ||
| 1736 | * R56 (0x38) - AntiPOP (1) | ||
| 1737 | */ | ||
| 1738 | #define WM8994_LINEOUT_VMID_BUF_ENA 0x0080 /* LINEOUT_VMID_BUF_ENA */ | ||
| 1739 | #define WM8994_LINEOUT_VMID_BUF_ENA_MASK 0x0080 /* LINEOUT_VMID_BUF_ENA */ | ||
| 1740 | #define WM8994_LINEOUT_VMID_BUF_ENA_SHIFT 7 /* LINEOUT_VMID_BUF_ENA */ | ||
| 1741 | #define WM8994_LINEOUT_VMID_BUF_ENA_WIDTH 1 /* LINEOUT_VMID_BUF_ENA */ | ||
| 1742 | #define WM8994_HPOUT2_IN_ENA 0x0040 /* HPOUT2_IN_ENA */ | ||
| 1743 | #define WM8994_HPOUT2_IN_ENA_MASK 0x0040 /* HPOUT2_IN_ENA */ | ||
| 1744 | #define WM8994_HPOUT2_IN_ENA_SHIFT 6 /* HPOUT2_IN_ENA */ | ||
| 1745 | #define WM8994_HPOUT2_IN_ENA_WIDTH 1 /* HPOUT2_IN_ENA */ | ||
| 1746 | #define WM8994_LINEOUT1_DISCH 0x0020 /* LINEOUT1_DISCH */ | ||
| 1747 | #define WM8994_LINEOUT1_DISCH_MASK 0x0020 /* LINEOUT1_DISCH */ | ||
| 1748 | #define WM8994_LINEOUT1_DISCH_SHIFT 5 /* LINEOUT1_DISCH */ | ||
| 1749 | #define WM8994_LINEOUT1_DISCH_WIDTH 1 /* LINEOUT1_DISCH */ | ||
| 1750 | #define WM8994_LINEOUT2_DISCH 0x0010 /* LINEOUT2_DISCH */ | ||
| 1751 | #define WM8994_LINEOUT2_DISCH_MASK 0x0010 /* LINEOUT2_DISCH */ | ||
| 1752 | #define WM8994_LINEOUT2_DISCH_SHIFT 4 /* LINEOUT2_DISCH */ | ||
| 1753 | #define WM8994_LINEOUT2_DISCH_WIDTH 1 /* LINEOUT2_DISCH */ | ||
| 1754 | |||
| 1755 | /* | ||
| 1756 | * R57 (0x39) - AntiPOP (2) | ||
| 1757 | */ | ||
| 1758 | #define WM8994_MICB2_DISCH 0x0100 /* MICB2_DISCH */ | ||
| 1759 | #define WM8994_MICB2_DISCH_MASK 0x0100 /* MICB2_DISCH */ | ||
| 1760 | #define WM8994_MICB2_DISCH_SHIFT 8 /* MICB2_DISCH */ | ||
| 1761 | #define WM8994_MICB2_DISCH_WIDTH 1 /* MICB2_DISCH */ | ||
| 1762 | #define WM8994_MICB1_DISCH 0x0080 /* MICB1_DISCH */ | ||
| 1763 | #define WM8994_MICB1_DISCH_MASK 0x0080 /* MICB1_DISCH */ | ||
| 1764 | #define WM8994_MICB1_DISCH_SHIFT 7 /* MICB1_DISCH */ | ||
| 1765 | #define WM8994_MICB1_DISCH_WIDTH 1 /* MICB1_DISCH */ | ||
| 1766 | #define WM8994_VMID_RAMP_MASK 0x0060 /* VMID_RAMP - [6:5] */ | ||
| 1767 | #define WM8994_VMID_RAMP_SHIFT 5 /* VMID_RAMP - [6:5] */ | ||
| 1768 | #define WM8994_VMID_RAMP_WIDTH 2 /* VMID_RAMP - [6:5] */ | ||
| 1769 | #define WM8994_VMID_BUF_ENA 0x0008 /* VMID_BUF_ENA */ | ||
| 1770 | #define WM8994_VMID_BUF_ENA_MASK 0x0008 /* VMID_BUF_ENA */ | ||
| 1771 | #define WM8994_VMID_BUF_ENA_SHIFT 3 /* VMID_BUF_ENA */ | ||
| 1772 | #define WM8994_VMID_BUF_ENA_WIDTH 1 /* VMID_BUF_ENA */ | ||
| 1773 | #define WM8994_STARTUP_BIAS_ENA 0x0004 /* STARTUP_BIAS_ENA */ | ||
| 1774 | #define WM8994_STARTUP_BIAS_ENA_MASK 0x0004 /* STARTUP_BIAS_ENA */ | ||
| 1775 | #define WM8994_STARTUP_BIAS_ENA_SHIFT 2 /* STARTUP_BIAS_ENA */ | ||
| 1776 | #define WM8994_STARTUP_BIAS_ENA_WIDTH 1 /* STARTUP_BIAS_ENA */ | ||
| 1777 | #define WM8994_BIAS_SRC 0x0002 /* BIAS_SRC */ | ||
| 1778 | #define WM8994_BIAS_SRC_MASK 0x0002 /* BIAS_SRC */ | ||
| 1779 | #define WM8994_BIAS_SRC_SHIFT 1 /* BIAS_SRC */ | ||
| 1780 | #define WM8994_BIAS_SRC_WIDTH 1 /* BIAS_SRC */ | ||
| 1781 | #define WM8994_VMID_DISCH 0x0001 /* VMID_DISCH */ | ||
| 1782 | #define WM8994_VMID_DISCH_MASK 0x0001 /* VMID_DISCH */ | ||
| 1783 | #define WM8994_VMID_DISCH_SHIFT 0 /* VMID_DISCH */ | ||
| 1784 | #define WM8994_VMID_DISCH_WIDTH 1 /* VMID_DISCH */ | ||
| 1785 | |||
| 1786 | /* | ||
| 1787 | * R58 (0x3A) - MICBIAS | ||
| 1788 | */ | ||
| 1789 | #define WM8994_MICD_SCTHR_MASK 0x00C0 /* MICD_SCTHR - [7:6] */ | ||
| 1790 | #define WM8994_MICD_SCTHR_SHIFT 6 /* MICD_SCTHR - [7:6] */ | ||
| 1791 | #define WM8994_MICD_SCTHR_WIDTH 2 /* MICD_SCTHR - [7:6] */ | ||
| 1792 | #define WM8994_MICD_THR_MASK 0x0038 /* MICD_THR - [5:3] */ | ||
| 1793 | #define WM8994_MICD_THR_SHIFT 3 /* MICD_THR - [5:3] */ | ||
| 1794 | #define WM8994_MICD_THR_WIDTH 3 /* MICD_THR - [5:3] */ | ||
| 1795 | #define WM8994_MICD_ENA 0x0004 /* MICD_ENA */ | ||
| 1796 | #define WM8994_MICD_ENA_MASK 0x0004 /* MICD_ENA */ | ||
| 1797 | #define WM8994_MICD_ENA_SHIFT 2 /* MICD_ENA */ | ||
| 1798 | #define WM8994_MICD_ENA_WIDTH 1 /* MICD_ENA */ | ||
| 1799 | #define WM8994_MICB2_LVL 0x0002 /* MICB2_LVL */ | ||
| 1800 | #define WM8994_MICB2_LVL_MASK 0x0002 /* MICB2_LVL */ | ||
| 1801 | #define WM8994_MICB2_LVL_SHIFT 1 /* MICB2_LVL */ | ||
| 1802 | #define WM8994_MICB2_LVL_WIDTH 1 /* MICB2_LVL */ | ||
| 1803 | #define WM8994_MICB1_LVL 0x0001 /* MICB1_LVL */ | ||
| 1804 | #define WM8994_MICB1_LVL_MASK 0x0001 /* MICB1_LVL */ | ||
| 1805 | #define WM8994_MICB1_LVL_SHIFT 0 /* MICB1_LVL */ | ||
| 1806 | #define WM8994_MICB1_LVL_WIDTH 1 /* MICB1_LVL */ | ||
| 1807 | |||
| 1808 | /* | ||
| 1809 | * R59 (0x3B) - LDO 1 | ||
| 1810 | */ | ||
| 1811 | #define WM8994_LDO1_VSEL_MASK 0x000E /* LDO1_VSEL - [3:1] */ | ||
| 1812 | #define WM8994_LDO1_VSEL_SHIFT 1 /* LDO1_VSEL - [3:1] */ | ||
| 1813 | #define WM8994_LDO1_VSEL_WIDTH 3 /* LDO1_VSEL - [3:1] */ | ||
| 1814 | #define WM8994_LDO1_DISCH 0x0001 /* LDO1_DISCH */ | ||
| 1815 | #define WM8994_LDO1_DISCH_MASK 0x0001 /* LDO1_DISCH */ | ||
| 1816 | #define WM8994_LDO1_DISCH_SHIFT 0 /* LDO1_DISCH */ | ||
| 1817 | #define WM8994_LDO1_DISCH_WIDTH 1 /* LDO1_DISCH */ | ||
| 1818 | |||
| 1819 | /* | ||
| 1820 | * R60 (0x3C) - LDO 2 | ||
| 1821 | */ | ||
| 1822 | #define WM8994_LDO2_VSEL_MASK 0x0006 /* LDO2_VSEL - [2:1] */ | ||
| 1823 | #define WM8994_LDO2_VSEL_SHIFT 1 /* LDO2_VSEL - [2:1] */ | ||
| 1824 | #define WM8994_LDO2_VSEL_WIDTH 2 /* LDO2_VSEL - [2:1] */ | ||
| 1825 | #define WM8994_LDO2_DISCH 0x0001 /* LDO2_DISCH */ | ||
| 1826 | #define WM8994_LDO2_DISCH_MASK 0x0001 /* LDO2_DISCH */ | ||
| 1827 | #define WM8994_LDO2_DISCH_SHIFT 0 /* LDO2_DISCH */ | ||
| 1828 | #define WM8994_LDO2_DISCH_WIDTH 1 /* LDO2_DISCH */ | ||
| 1829 | |||
| 1830 | /* | ||
| 1831 | * R76 (0x4C) - Charge Pump (1) | ||
| 1832 | */ | ||
| 1833 | #define WM8994_CP_ENA 0x8000 /* CP_ENA */ | ||
| 1834 | #define WM8994_CP_ENA_MASK 0x8000 /* CP_ENA */ | ||
| 1835 | #define WM8994_CP_ENA_SHIFT 15 /* CP_ENA */ | ||
| 1836 | #define WM8994_CP_ENA_WIDTH 1 /* CP_ENA */ | ||
| 1837 | |||
| 1838 | /* | ||
| 1839 | * R81 (0x51) - Class W (1) | ||
| 1840 | */ | ||
| 1841 | #define WM8994_CP_DYN_SRC_SEL_MASK 0x0300 /* CP_DYN_SRC_SEL - [9:8] */ | ||
| 1842 | #define WM8994_CP_DYN_SRC_SEL_SHIFT 8 /* CP_DYN_SRC_SEL - [9:8] */ | ||
| 1843 | #define WM8994_CP_DYN_SRC_SEL_WIDTH 2 /* CP_DYN_SRC_SEL - [9:8] */ | ||
| 1844 | #define WM8994_CP_DYN_PWR 0x0001 /* CP_DYN_PWR */ | ||
| 1845 | #define WM8994_CP_DYN_PWR_MASK 0x0001 /* CP_DYN_PWR */ | ||
| 1846 | #define WM8994_CP_DYN_PWR_SHIFT 0 /* CP_DYN_PWR */ | ||
| 1847 | #define WM8994_CP_DYN_PWR_WIDTH 1 /* CP_DYN_PWR */ | ||
| 1848 | |||
| 1849 | /* | ||
| 1850 | * R84 (0x54) - DC Servo (1) | ||
| 1851 | */ | ||
| 1852 | #define WM8994_DCS_TRIG_SINGLE_1 0x2000 /* DCS_TRIG_SINGLE_1 */ | ||
| 1853 | #define WM8994_DCS_TRIG_SINGLE_1_MASK 0x2000 /* DCS_TRIG_SINGLE_1 */ | ||
| 1854 | #define WM8994_DCS_TRIG_SINGLE_1_SHIFT 13 /* DCS_TRIG_SINGLE_1 */ | ||
| 1855 | #define WM8994_DCS_TRIG_SINGLE_1_WIDTH 1 /* DCS_TRIG_SINGLE_1 */ | ||
| 1856 | #define WM8994_DCS_TRIG_SINGLE_0 0x1000 /* DCS_TRIG_SINGLE_0 */ | ||
| 1857 | #define WM8994_DCS_TRIG_SINGLE_0_MASK 0x1000 /* DCS_TRIG_SINGLE_0 */ | ||
| 1858 | #define WM8994_DCS_TRIG_SINGLE_0_SHIFT 12 /* DCS_TRIG_SINGLE_0 */ | ||
| 1859 | #define WM8994_DCS_TRIG_SINGLE_0_WIDTH 1 /* DCS_TRIG_SINGLE_0 */ | ||
| 1860 | #define WM8994_DCS_TRIG_SERIES_1 0x0200 /* DCS_TRIG_SERIES_1 */ | ||
| 1861 | #define WM8994_DCS_TRIG_SERIES_1_MASK 0x0200 /* DCS_TRIG_SERIES_1 */ | ||
| 1862 | #define WM8994_DCS_TRIG_SERIES_1_SHIFT 9 /* DCS_TRIG_SERIES_1 */ | ||
| 1863 | #define WM8994_DCS_TRIG_SERIES_1_WIDTH 1 /* DCS_TRIG_SERIES_1 */ | ||
| 1864 | #define WM8994_DCS_TRIG_SERIES_0 0x0100 /* DCS_TRIG_SERIES_0 */ | ||
| 1865 | #define WM8994_DCS_TRIG_SERIES_0_MASK 0x0100 /* DCS_TRIG_SERIES_0 */ | ||
| 1866 | #define WM8994_DCS_TRIG_SERIES_0_SHIFT 8 /* DCS_TRIG_SERIES_0 */ | ||
| 1867 | #define WM8994_DCS_TRIG_SERIES_0_WIDTH 1 /* DCS_TRIG_SERIES_0 */ | ||
| 1868 | #define WM8994_DCS_TRIG_STARTUP_1 0x0020 /* DCS_TRIG_STARTUP_1 */ | ||
| 1869 | #define WM8994_DCS_TRIG_STARTUP_1_MASK 0x0020 /* DCS_TRIG_STARTUP_1 */ | ||
| 1870 | #define WM8994_DCS_TRIG_STARTUP_1_SHIFT 5 /* DCS_TRIG_STARTUP_1 */ | ||
| 1871 | #define WM8994_DCS_TRIG_STARTUP_1_WIDTH 1 /* DCS_TRIG_STARTUP_1 */ | ||
| 1872 | #define WM8994_DCS_TRIG_STARTUP_0 0x0010 /* DCS_TRIG_STARTUP_0 */ | ||
| 1873 | #define WM8994_DCS_TRIG_STARTUP_0_MASK 0x0010 /* DCS_TRIG_STARTUP_0 */ | ||
| 1874 | #define WM8994_DCS_TRIG_STARTUP_0_SHIFT 4 /* DCS_TRIG_STARTUP_0 */ | ||
| 1875 | #define WM8994_DCS_TRIG_STARTUP_0_WIDTH 1 /* DCS_TRIG_STARTUP_0 */ | ||
| 1876 | #define WM8994_DCS_TRIG_DAC_WR_1 0x0008 /* DCS_TRIG_DAC_WR_1 */ | ||
| 1877 | #define WM8994_DCS_TRIG_DAC_WR_1_MASK 0x0008 /* DCS_TRIG_DAC_WR_1 */ | ||
| 1878 | #define WM8994_DCS_TRIG_DAC_WR_1_SHIFT 3 /* DCS_TRIG_DAC_WR_1 */ | ||
| 1879 | #define WM8994_DCS_TRIG_DAC_WR_1_WIDTH 1 /* DCS_TRIG_DAC_WR_1 */ | ||
| 1880 | #define WM8994_DCS_TRIG_DAC_WR_0 0x0004 /* DCS_TRIG_DAC_WR_0 */ | ||
| 1881 | #define WM8994_DCS_TRIG_DAC_WR_0_MASK 0x0004 /* DCS_TRIG_DAC_WR_0 */ | ||
| 1882 | #define WM8994_DCS_TRIG_DAC_WR_0_SHIFT 2 /* DCS_TRIG_DAC_WR_0 */ | ||
| 1883 | #define WM8994_DCS_TRIG_DAC_WR_0_WIDTH 1 /* DCS_TRIG_DAC_WR_0 */ | ||
| 1884 | #define WM8994_DCS_ENA_CHAN_1 0x0002 /* DCS_ENA_CHAN_1 */ | ||
| 1885 | #define WM8994_DCS_ENA_CHAN_1_MASK 0x0002 /* DCS_ENA_CHAN_1 */ | ||
| 1886 | #define WM8994_DCS_ENA_CHAN_1_SHIFT 1 /* DCS_ENA_CHAN_1 */ | ||
| 1887 | #define WM8994_DCS_ENA_CHAN_1_WIDTH 1 /* DCS_ENA_CHAN_1 */ | ||
| 1888 | #define WM8994_DCS_ENA_CHAN_0 0x0001 /* DCS_ENA_CHAN_0 */ | ||
| 1889 | #define WM8994_DCS_ENA_CHAN_0_MASK 0x0001 /* DCS_ENA_CHAN_0 */ | ||
| 1890 | #define WM8994_DCS_ENA_CHAN_0_SHIFT 0 /* DCS_ENA_CHAN_0 */ | ||
| 1891 | #define WM8994_DCS_ENA_CHAN_0_WIDTH 1 /* DCS_ENA_CHAN_0 */ | ||
| 1892 | |||
| 1893 | /* | ||
| 1894 | * R85 (0x55) - DC Servo (2) | ||
| 1895 | */ | ||
| 1896 | #define WM8994_DCS_SERIES_NO_01_MASK 0x0FE0 /* DCS_SERIES_NO_01 - [11:5] */ | ||
| 1897 | #define WM8994_DCS_SERIES_NO_01_SHIFT 5 /* DCS_SERIES_NO_01 - [11:5] */ | ||
| 1898 | #define WM8994_DCS_SERIES_NO_01_WIDTH 7 /* DCS_SERIES_NO_01 - [11:5] */ | ||
| 1899 | #define WM8994_DCS_TIMER_PERIOD_01_MASK 0x000F /* DCS_TIMER_PERIOD_01 - [3:0] */ | ||
| 1900 | #define WM8994_DCS_TIMER_PERIOD_01_SHIFT 0 /* DCS_TIMER_PERIOD_01 - [3:0] */ | ||
| 1901 | #define WM8994_DCS_TIMER_PERIOD_01_WIDTH 4 /* DCS_TIMER_PERIOD_01 - [3:0] */ | ||
| 1902 | |||
| 1903 | /* | ||
| 1904 | * R87 (0x57) - DC Servo (4) | ||
| 1905 | */ | ||
| 1906 | #define WM8994_DCS_DAC_WR_VAL_1_MASK 0xFF00 /* DCS_DAC_WR_VAL_1 - [15:8] */ | ||
| 1907 | #define WM8994_DCS_DAC_WR_VAL_1_SHIFT 8 /* DCS_DAC_WR_VAL_1 - [15:8] */ | ||
| 1908 | #define WM8994_DCS_DAC_WR_VAL_1_WIDTH 8 /* DCS_DAC_WR_VAL_1 - [15:8] */ | ||
| 1909 | #define WM8994_DCS_DAC_WR_VAL_0_MASK 0x00FF /* DCS_DAC_WR_VAL_0 - [7:0] */ | ||
| 1910 | #define WM8994_DCS_DAC_WR_VAL_0_SHIFT 0 /* DCS_DAC_WR_VAL_0 - [7:0] */ | ||
| 1911 | #define WM8994_DCS_DAC_WR_VAL_0_WIDTH 8 /* DCS_DAC_WR_VAL_0 - [7:0] */ | ||
| 1912 | |||
| 1913 | /* | ||
| 1914 | * R88 (0x58) - DC Servo Readback | ||
| 1915 | */ | ||
| 1916 | #define WM8994_DCS_CAL_COMPLETE_MASK 0x0300 /* DCS_CAL_COMPLETE - [9:8] */ | ||
| 1917 | #define WM8994_DCS_CAL_COMPLETE_SHIFT 8 /* DCS_CAL_COMPLETE - [9:8] */ | ||
| 1918 | #define WM8994_DCS_CAL_COMPLETE_WIDTH 2 /* DCS_CAL_COMPLETE - [9:8] */ | ||
| 1919 | #define WM8994_DCS_DAC_WR_COMPLETE_MASK 0x0030 /* DCS_DAC_WR_COMPLETE - [5:4] */ | ||
| 1920 | #define WM8994_DCS_DAC_WR_COMPLETE_SHIFT 4 /* DCS_DAC_WR_COMPLETE - [5:4] */ | ||
| 1921 | #define WM8994_DCS_DAC_WR_COMPLETE_WIDTH 2 /* DCS_DAC_WR_COMPLETE - [5:4] */ | ||
| 1922 | #define WM8994_DCS_STARTUP_COMPLETE_MASK 0x0003 /* DCS_STARTUP_COMPLETE - [1:0] */ | ||
| 1923 | #define WM8994_DCS_STARTUP_COMPLETE_SHIFT 0 /* DCS_STARTUP_COMPLETE - [1:0] */ | ||
| 1924 | #define WM8994_DCS_STARTUP_COMPLETE_WIDTH 2 /* DCS_STARTUP_COMPLETE - [1:0] */ | ||
| 1925 | |||
| 1926 | /* | ||
| 1927 | * R96 (0x60) - Analogue HP (1) | ||
| 1928 | */ | ||
| 1929 | #define WM8994_HPOUT1L_RMV_SHORT 0x0080 /* HPOUT1L_RMV_SHORT */ | ||
| 1930 | #define WM8994_HPOUT1L_RMV_SHORT_MASK 0x0080 /* HPOUT1L_RMV_SHORT */ | ||
| 1931 | #define WM8994_HPOUT1L_RMV_SHORT_SHIFT 7 /* HPOUT1L_RMV_SHORT */ | ||
| 1932 | #define WM8994_HPOUT1L_RMV_SHORT_WIDTH 1 /* HPOUT1L_RMV_SHORT */ | ||
| 1933 | #define WM8994_HPOUT1L_OUTP 0x0040 /* HPOUT1L_OUTP */ | ||
| 1934 | #define WM8994_HPOUT1L_OUTP_MASK 0x0040 /* HPOUT1L_OUTP */ | ||
| 1935 | #define WM8994_HPOUT1L_OUTP_SHIFT 6 /* HPOUT1L_OUTP */ | ||
| 1936 | #define WM8994_HPOUT1L_OUTP_WIDTH 1 /* HPOUT1L_OUTP */ | ||
| 1937 | #define WM8994_HPOUT1L_DLY 0x0020 /* HPOUT1L_DLY */ | ||
| 1938 | #define WM8994_HPOUT1L_DLY_MASK 0x0020 /* HPOUT1L_DLY */ | ||
| 1939 | #define WM8994_HPOUT1L_DLY_SHIFT 5 /* HPOUT1L_DLY */ | ||
| 1940 | #define WM8994_HPOUT1L_DLY_WIDTH 1 /* HPOUT1L_DLY */ | ||
| 1941 | #define WM8994_HPOUT1R_RMV_SHORT 0x0008 /* HPOUT1R_RMV_SHORT */ | ||
| 1942 | #define WM8994_HPOUT1R_RMV_SHORT_MASK 0x0008 /* HPOUT1R_RMV_SHORT */ | ||
| 1943 | #define WM8994_HPOUT1R_RMV_SHORT_SHIFT 3 /* HPOUT1R_RMV_SHORT */ | ||
| 1944 | #define WM8994_HPOUT1R_RMV_SHORT_WIDTH 1 /* HPOUT1R_RMV_SHORT */ | ||
| 1945 | #define WM8994_HPOUT1R_OUTP 0x0004 /* HPOUT1R_OUTP */ | ||
| 1946 | #define WM8994_HPOUT1R_OUTP_MASK 0x0004 /* HPOUT1R_OUTP */ | ||
| 1947 | #define WM8994_HPOUT1R_OUTP_SHIFT 2 /* HPOUT1R_OUTP */ | ||
| 1948 | #define WM8994_HPOUT1R_OUTP_WIDTH 1 /* HPOUT1R_OUTP */ | ||
| 1949 | #define WM8994_HPOUT1R_DLY 0x0002 /* HPOUT1R_DLY */ | ||
| 1950 | #define WM8994_HPOUT1R_DLY_MASK 0x0002 /* HPOUT1R_DLY */ | ||
| 1951 | #define WM8994_HPOUT1R_DLY_SHIFT 1 /* HPOUT1R_DLY */ | ||
| 1952 | #define WM8994_HPOUT1R_DLY_WIDTH 1 /* HPOUT1R_DLY */ | ||
| 1953 | |||
| 1954 | /* | ||
| 1955 | * R256 (0x100) - Chip Revision | ||
| 1956 | */ | ||
| 1957 | #define WM8994_CHIP_REV_MASK 0x000F /* CHIP_REV - [3:0] */ | ||
| 1958 | #define WM8994_CHIP_REV_SHIFT 0 /* CHIP_REV - [3:0] */ | ||
| 1959 | #define WM8994_CHIP_REV_WIDTH 4 /* CHIP_REV - [3:0] */ | ||
| 1960 | |||
| 1961 | /* | ||
| 1962 | * R257 (0x101) - Control Interface | ||
| 1963 | */ | ||
| 1964 | #define WM8994_SPI_CONTRD 0x0040 /* SPI_CONTRD */ | ||
| 1965 | #define WM8994_SPI_CONTRD_MASK 0x0040 /* SPI_CONTRD */ | ||
| 1966 | #define WM8994_SPI_CONTRD_SHIFT 6 /* SPI_CONTRD */ | ||
| 1967 | #define WM8994_SPI_CONTRD_WIDTH 1 /* SPI_CONTRD */ | ||
| 1968 | #define WM8994_SPI_4WIRE 0x0020 /* SPI_4WIRE */ | ||
| 1969 | #define WM8994_SPI_4WIRE_MASK 0x0020 /* SPI_4WIRE */ | ||
| 1970 | #define WM8994_SPI_4WIRE_SHIFT 5 /* SPI_4WIRE */ | ||
| 1971 | #define WM8994_SPI_4WIRE_WIDTH 1 /* SPI_4WIRE */ | ||
| 1972 | #define WM8994_SPI_CFG 0x0010 /* SPI_CFG */ | ||
| 1973 | #define WM8994_SPI_CFG_MASK 0x0010 /* SPI_CFG */ | ||
| 1974 | #define WM8994_SPI_CFG_SHIFT 4 /* SPI_CFG */ | ||
| 1975 | #define WM8994_SPI_CFG_WIDTH 1 /* SPI_CFG */ | ||
| 1976 | #define WM8994_AUTO_INC 0x0004 /* AUTO_INC */ | ||
| 1977 | #define WM8994_AUTO_INC_MASK 0x0004 /* AUTO_INC */ | ||
| 1978 | #define WM8994_AUTO_INC_SHIFT 2 /* AUTO_INC */ | ||
| 1979 | #define WM8994_AUTO_INC_WIDTH 1 /* AUTO_INC */ | ||
| 1980 | |||
| 1981 | /* | ||
| 1982 | * R272 (0x110) - Write Sequencer Ctrl (1) | ||
| 1983 | */ | ||
| 1984 | #define WM8994_WSEQ_ENA 0x8000 /* WSEQ_ENA */ | ||
| 1985 | #define WM8994_WSEQ_ENA_MASK 0x8000 /* WSEQ_ENA */ | ||
| 1986 | #define WM8994_WSEQ_ENA_SHIFT 15 /* WSEQ_ENA */ | ||
| 1987 | #define WM8994_WSEQ_ENA_WIDTH 1 /* WSEQ_ENA */ | ||
| 1988 | #define WM8994_WSEQ_ABORT 0x0200 /* WSEQ_ABORT */ | ||
| 1989 | #define WM8994_WSEQ_ABORT_MASK 0x0200 /* WSEQ_ABORT */ | ||
| 1990 | #define WM8994_WSEQ_ABORT_SHIFT 9 /* WSEQ_ABORT */ | ||
| 1991 | #define WM8994_WSEQ_ABORT_WIDTH 1 /* WSEQ_ABORT */ | ||
| 1992 | #define WM8994_WSEQ_START 0x0100 /* WSEQ_START */ | ||
| 1993 | #define WM8994_WSEQ_START_MASK 0x0100 /* WSEQ_START */ | ||
| 1994 | #define WM8994_WSEQ_START_SHIFT 8 /* WSEQ_START */ | ||
| 1995 | #define WM8994_WSEQ_START_WIDTH 1 /* WSEQ_START */ | ||
| 1996 | #define WM8994_WSEQ_START_INDEX_MASK 0x007F /* WSEQ_START_INDEX - [6:0] */ | ||
| 1997 | #define WM8994_WSEQ_START_INDEX_SHIFT 0 /* WSEQ_START_INDEX - [6:0] */ | ||
| 1998 | #define WM8994_WSEQ_START_INDEX_WIDTH 7 /* WSEQ_START_INDEX - [6:0] */ | ||
| 1999 | |||
| 2000 | /* | ||
| 2001 | * R273 (0x111) - Write Sequencer Ctrl (2) | ||
| 2002 | */ | ||
| 2003 | #define WM8994_WSEQ_BUSY 0x0100 /* WSEQ_BUSY */ | ||
| 2004 | #define WM8994_WSEQ_BUSY_MASK 0x0100 /* WSEQ_BUSY */ | ||
| 2005 | #define WM8994_WSEQ_BUSY_SHIFT 8 /* WSEQ_BUSY */ | ||
| 2006 | #define WM8994_WSEQ_BUSY_WIDTH 1 /* WSEQ_BUSY */ | ||
| 2007 | #define WM8994_WSEQ_CURRENT_INDEX_MASK 0x007F /* WSEQ_CURRENT_INDEX - [6:0] */ | ||
| 2008 | #define WM8994_WSEQ_CURRENT_INDEX_SHIFT 0 /* WSEQ_CURRENT_INDEX - [6:0] */ | ||
| 2009 | #define WM8994_WSEQ_CURRENT_INDEX_WIDTH 7 /* WSEQ_CURRENT_INDEX - [6:0] */ | ||
| 2010 | |||
| 2011 | /* | ||
| 2012 | * R512 (0x200) - AIF1 Clocking (1) | ||
| 2013 | */ | ||
| 2014 | #define WM8994_AIF1CLK_SRC_MASK 0x0018 /* AIF1CLK_SRC - [4:3] */ | ||
| 2015 | #define WM8994_AIF1CLK_SRC_SHIFT 3 /* AIF1CLK_SRC - [4:3] */ | ||
| 2016 | #define WM8994_AIF1CLK_SRC_WIDTH 2 /* AIF1CLK_SRC - [4:3] */ | ||
| 2017 | #define WM8994_AIF1CLK_INV 0x0004 /* AIF1CLK_INV */ | ||
| 2018 | #define WM8994_AIF1CLK_INV_MASK 0x0004 /* AIF1CLK_INV */ | ||
| 2019 | #define WM8994_AIF1CLK_INV_SHIFT 2 /* AIF1CLK_INV */ | ||
| 2020 | #define WM8994_AIF1CLK_INV_WIDTH 1 /* AIF1CLK_INV */ | ||
| 2021 | #define WM8994_AIF1CLK_DIV 0x0002 /* AIF1CLK_DIV */ | ||
| 2022 | #define WM8994_AIF1CLK_DIV_MASK 0x0002 /* AIF1CLK_DIV */ | ||
| 2023 | #define WM8994_AIF1CLK_DIV_SHIFT 1 /* AIF1CLK_DIV */ | ||
| 2024 | #define WM8994_AIF1CLK_DIV_WIDTH 1 /* AIF1CLK_DIV */ | ||
| 2025 | #define WM8994_AIF1CLK_ENA 0x0001 /* AIF1CLK_ENA */ | ||
| 2026 | #define WM8994_AIF1CLK_ENA_MASK 0x0001 /* AIF1CLK_ENA */ | ||
| 2027 | #define WM8994_AIF1CLK_ENA_SHIFT 0 /* AIF1CLK_ENA */ | ||
| 2028 | #define WM8994_AIF1CLK_ENA_WIDTH 1 /* AIF1CLK_ENA */ | ||
| 2029 | |||
| 2030 | /* | ||
| 2031 | * R513 (0x201) - AIF1 Clocking (2) | ||
| 2032 | */ | ||
| 2033 | #define WM8994_AIF1DAC_DIV_MASK 0x0038 /* AIF1DAC_DIV - [5:3] */ | ||
| 2034 | #define WM8994_AIF1DAC_DIV_SHIFT 3 /* AIF1DAC_DIV - [5:3] */ | ||
| 2035 | #define WM8994_AIF1DAC_DIV_WIDTH 3 /* AIF1DAC_DIV - [5:3] */ | ||
| 2036 | #define WM8994_AIF1ADC_DIV_MASK 0x0007 /* AIF1ADC_DIV - [2:0] */ | ||
| 2037 | #define WM8994_AIF1ADC_DIV_SHIFT 0 /* AIF1ADC_DIV - [2:0] */ | ||
| 2038 | #define WM8994_AIF1ADC_DIV_WIDTH 3 /* AIF1ADC_DIV - [2:0] */ | ||
| 2039 | |||
| 2040 | /* | ||
| 2041 | * R516 (0x204) - AIF2 Clocking (1) | ||
| 2042 | */ | ||
| 2043 | #define WM8994_AIF2CLK_SRC_MASK 0x0018 /* AIF2CLK_SRC - [4:3] */ | ||
| 2044 | #define WM8994_AIF2CLK_SRC_SHIFT 3 /* AIF2CLK_SRC - [4:3] */ | ||
| 2045 | #define WM8994_AIF2CLK_SRC_WIDTH 2 /* AIF2CLK_SRC - [4:3] */ | ||
| 2046 | #define WM8994_AIF2CLK_INV 0x0004 /* AIF2CLK_INV */ | ||
| 2047 | #define WM8994_AIF2CLK_INV_MASK 0x0004 /* AIF2CLK_INV */ | ||
| 2048 | #define WM8994_AIF2CLK_INV_SHIFT 2 /* AIF2CLK_INV */ | ||
| 2049 | #define WM8994_AIF2CLK_INV_WIDTH 1 /* AIF2CLK_INV */ | ||
| 2050 | #define WM8994_AIF2CLK_DIV 0x0002 /* AIF2CLK_DIV */ | ||
| 2051 | #define WM8994_AIF2CLK_DIV_MASK 0x0002 /* AIF2CLK_DIV */ | ||
| 2052 | #define WM8994_AIF2CLK_DIV_SHIFT 1 /* AIF2CLK_DIV */ | ||
| 2053 | #define WM8994_AIF2CLK_DIV_WIDTH 1 /* AIF2CLK_DIV */ | ||
| 2054 | #define WM8994_AIF2CLK_ENA 0x0001 /* AIF2CLK_ENA */ | ||
| 2055 | #define WM8994_AIF2CLK_ENA_MASK 0x0001 /* AIF2CLK_ENA */ | ||
| 2056 | #define WM8994_AIF2CLK_ENA_SHIFT 0 /* AIF2CLK_ENA */ | ||
| 2057 | #define WM8994_AIF2CLK_ENA_WIDTH 1 /* AIF2CLK_ENA */ | ||
| 2058 | |||
| 2059 | /* | ||
| 2060 | * R517 (0x205) - AIF2 Clocking (2) | ||
| 2061 | */ | ||
| 2062 | #define WM8994_AIF2DAC_DIV_MASK 0x0038 /* AIF2DAC_DIV - [5:3] */ | ||
| 2063 | #define WM8994_AIF2DAC_DIV_SHIFT 3 /* AIF2DAC_DIV - [5:3] */ | ||
| 2064 | #define WM8994_AIF2DAC_DIV_WIDTH 3 /* AIF2DAC_DIV - [5:3] */ | ||
| 2065 | #define WM8994_AIF2ADC_DIV_MASK 0x0007 /* AIF2ADC_DIV - [2:0] */ | ||
| 2066 | #define WM8994_AIF2ADC_DIV_SHIFT 0 /* AIF2ADC_DIV - [2:0] */ | ||
| 2067 | #define WM8994_AIF2ADC_DIV_WIDTH 3 /* AIF2ADC_DIV - [2:0] */ | ||
| 2068 | |||
| 2069 | /* | ||
| 2070 | * R520 (0x208) - Clocking (1) | ||
| 2071 | */ | ||
| 2072 | #define WM8994_TOCLK_ENA 0x0010 /* TOCLK_ENA */ | ||
| 2073 | #define WM8994_TOCLK_ENA_MASK 0x0010 /* TOCLK_ENA */ | ||
| 2074 | #define WM8994_TOCLK_ENA_SHIFT 4 /* TOCLK_ENA */ | ||
| 2075 | #define WM8994_TOCLK_ENA_WIDTH 1 /* TOCLK_ENA */ | ||
| 2076 | #define WM8994_AIF1DSPCLK_ENA 0x0008 /* AIF1DSPCLK_ENA */ | ||
| 2077 | #define WM8994_AIF1DSPCLK_ENA_MASK 0x0008 /* AIF1DSPCLK_ENA */ | ||
| 2078 | #define WM8994_AIF1DSPCLK_ENA_SHIFT 3 /* AIF1DSPCLK_ENA */ | ||
| 2079 | #define WM8994_AIF1DSPCLK_ENA_WIDTH 1 /* AIF1DSPCLK_ENA */ | ||
| 2080 | #define WM8994_AIF2DSPCLK_ENA 0x0004 /* AIF2DSPCLK_ENA */ | ||
| 2081 | #define WM8994_AIF2DSPCLK_ENA_MASK 0x0004 /* AIF2DSPCLK_ENA */ | ||
| 2082 | #define WM8994_AIF2DSPCLK_ENA_SHIFT 2 /* AIF2DSPCLK_ENA */ | ||
| 2083 | #define WM8994_AIF2DSPCLK_ENA_WIDTH 1 /* AIF2DSPCLK_ENA */ | ||
| 2084 | #define WM8994_SYSDSPCLK_ENA 0x0002 /* SYSDSPCLK_ENA */ | ||
| 2085 | #define WM8994_SYSDSPCLK_ENA_MASK 0x0002 /* SYSDSPCLK_ENA */ | ||
| 2086 | #define WM8994_SYSDSPCLK_ENA_SHIFT 1 /* SYSDSPCLK_ENA */ | ||
| 2087 | #define WM8994_SYSDSPCLK_ENA_WIDTH 1 /* SYSDSPCLK_ENA */ | ||
| 2088 | #define WM8994_SYSCLK_SRC 0x0001 /* SYSCLK_SRC */ | ||
| 2089 | #define WM8994_SYSCLK_SRC_MASK 0x0001 /* SYSCLK_SRC */ | ||
| 2090 | #define WM8994_SYSCLK_SRC_SHIFT 0 /* SYSCLK_SRC */ | ||
| 2091 | #define WM8994_SYSCLK_SRC_WIDTH 1 /* SYSCLK_SRC */ | ||
| 2092 | |||
| 2093 | /* | ||
| 2094 | * R521 (0x209) - Clocking (2) | ||
| 2095 | */ | ||
| 2096 | #define WM8994_TOCLK_DIV_MASK 0x0700 /* TOCLK_DIV - [10:8] */ | ||
| 2097 | #define WM8994_TOCLK_DIV_SHIFT 8 /* TOCLK_DIV - [10:8] */ | ||
| 2098 | #define WM8994_TOCLK_DIV_WIDTH 3 /* TOCLK_DIV - [10:8] */ | ||
| 2099 | #define WM8994_DBCLK_DIV_MASK 0x0070 /* DBCLK_DIV - [6:4] */ | ||
| 2100 | #define WM8994_DBCLK_DIV_SHIFT 4 /* DBCLK_DIV - [6:4] */ | ||
| 2101 | #define WM8994_DBCLK_DIV_WIDTH 3 /* DBCLK_DIV - [6:4] */ | ||
| 2102 | #define WM8994_OPCLK_DIV_MASK 0x0007 /* OPCLK_DIV - [2:0] */ | ||
| 2103 | #define WM8994_OPCLK_DIV_SHIFT 0 /* OPCLK_DIV - [2:0] */ | ||
| 2104 | #define WM8994_OPCLK_DIV_WIDTH 3 /* OPCLK_DIV - [2:0] */ | ||
| 2105 | |||
| 2106 | /* | ||
| 2107 | * R528 (0x210) - AIF1 Rate | ||
| 2108 | */ | ||
| 2109 | #define WM8994_AIF1_SR_MASK 0x00F0 /* AIF1_SR - [7:4] */ | ||
| 2110 | #define WM8994_AIF1_SR_SHIFT 4 /* AIF1_SR - [7:4] */ | ||
| 2111 | #define WM8994_AIF1_SR_WIDTH 4 /* AIF1_SR - [7:4] */ | ||
| 2112 | #define WM8994_AIF1CLK_RATE_MASK 0x000F /* AIF1CLK_RATE - [3:0] */ | ||
| 2113 | #define WM8994_AIF1CLK_RATE_SHIFT 0 /* AIF1CLK_RATE - [3:0] */ | ||
| 2114 | #define WM8994_AIF1CLK_RATE_WIDTH 4 /* AIF1CLK_RATE - [3:0] */ | ||
| 2115 | |||
| 2116 | /* | ||
| 2117 | * R529 (0x211) - AIF2 Rate | ||
| 2118 | */ | ||
| 2119 | #define WM8994_AIF2_SR_MASK 0x00F0 /* AIF2_SR - [7:4] */ | ||
| 2120 | #define WM8994_AIF2_SR_SHIFT 4 /* AIF2_SR - [7:4] */ | ||
| 2121 | #define WM8994_AIF2_SR_WIDTH 4 /* AIF2_SR - [7:4] */ | ||
| 2122 | #define WM8994_AIF2CLK_RATE_MASK 0x000F /* AIF2CLK_RATE - [3:0] */ | ||
| 2123 | #define WM8994_AIF2CLK_RATE_SHIFT 0 /* AIF2CLK_RATE - [3:0] */ | ||
| 2124 | #define WM8994_AIF2CLK_RATE_WIDTH 4 /* AIF2CLK_RATE - [3:0] */ | ||
| 2125 | |||
| 2126 | /* | ||
| 2127 | * R530 (0x212) - Rate Status | ||
| 2128 | */ | ||
| 2129 | #define WM8994_SR_ERROR_MASK 0x000F /* SR_ERROR - [3:0] */ | ||
| 2130 | #define WM8994_SR_ERROR_SHIFT 0 /* SR_ERROR - [3:0] */ | ||
| 2131 | #define WM8994_SR_ERROR_WIDTH 4 /* SR_ERROR - [3:0] */ | ||
| 2132 | |||
| 2133 | /* | ||
| 2134 | * R544 (0x220) - FLL1 Control (1) | ||
| 2135 | */ | ||
| 2136 | #define WM8994_FLL1_FRAC 0x0004 /* FLL1_FRAC */ | ||
| 2137 | #define WM8994_FLL1_FRAC_MASK 0x0004 /* FLL1_FRAC */ | ||
| 2138 | #define WM8994_FLL1_FRAC_SHIFT 2 /* FLL1_FRAC */ | ||
| 2139 | #define WM8994_FLL1_FRAC_WIDTH 1 /* FLL1_FRAC */ | ||
| 2140 | #define WM8994_FLL1_OSC_ENA 0x0002 /* FLL1_OSC_ENA */ | ||
| 2141 | #define WM8994_FLL1_OSC_ENA_MASK 0x0002 /* FLL1_OSC_ENA */ | ||
| 2142 | #define WM8994_FLL1_OSC_ENA_SHIFT 1 /* FLL1_OSC_ENA */ | ||
| 2143 | #define WM8994_FLL1_OSC_ENA_WIDTH 1 /* FLL1_OSC_ENA */ | ||
| 2144 | #define WM8994_FLL1_ENA 0x0001 /* FLL1_ENA */ | ||
| 2145 | #define WM8994_FLL1_ENA_MASK 0x0001 /* FLL1_ENA */ | ||
| 2146 | #define WM8994_FLL1_ENA_SHIFT 0 /* FLL1_ENA */ | ||
| 2147 | #define WM8994_FLL1_ENA_WIDTH 1 /* FLL1_ENA */ | ||
| 2148 | |||
| 2149 | /* | ||
| 2150 | * R545 (0x221) - FLL1 Control (2) | ||
| 2151 | */ | ||
| 2152 | #define WM8994_FLL1_OUTDIV_MASK 0x3F00 /* FLL1_OUTDIV - [13:8] */ | ||
| 2153 | #define WM8994_FLL1_OUTDIV_SHIFT 8 /* FLL1_OUTDIV - [13:8] */ | ||
| 2154 | #define WM8994_FLL1_OUTDIV_WIDTH 6 /* FLL1_OUTDIV - [13:8] */ | ||
| 2155 | #define WM8994_FLL1_CTRL_RATE_MASK 0x0070 /* FLL1_CTRL_RATE - [6:4] */ | ||
| 2156 | #define WM8994_FLL1_CTRL_RATE_SHIFT 4 /* FLL1_CTRL_RATE - [6:4] */ | ||
| 2157 | #define WM8994_FLL1_CTRL_RATE_WIDTH 3 /* FLL1_CTRL_RATE - [6:4] */ | ||
| 2158 | #define WM8994_FLL1_FRATIO_MASK 0x0007 /* FLL1_FRATIO - [2:0] */ | ||
| 2159 | #define WM8994_FLL1_FRATIO_SHIFT 0 /* FLL1_FRATIO - [2:0] */ | ||
| 2160 | #define WM8994_FLL1_FRATIO_WIDTH 3 /* FLL1_FRATIO - [2:0] */ | ||
| 2161 | |||
| 2162 | /* | ||
| 2163 | * R546 (0x222) - FLL1 Control (3) | ||
| 2164 | */ | ||
| 2165 | #define WM8994_FLL1_K_MASK 0xFFFF /* FLL1_K - [15:0] */ | ||
| 2166 | #define WM8994_FLL1_K_SHIFT 0 /* FLL1_K - [15:0] */ | ||
| 2167 | #define WM8994_FLL1_K_WIDTH 16 /* FLL1_K - [15:0] */ | ||
| 2168 | |||
| 2169 | /* | ||
| 2170 | * R547 (0x223) - FLL1 Control (4) | ||
| 2171 | */ | ||
| 2172 | #define WM8994_FLL1_N_MASK 0x7FE0 /* FLL1_N - [14:5] */ | ||
| 2173 | #define WM8994_FLL1_N_SHIFT 5 /* FLL1_N - [14:5] */ | ||
| 2174 | #define WM8994_FLL1_N_WIDTH 10 /* FLL1_N - [14:5] */ | ||
| 2175 | #define WM8994_FLL1_LOOP_GAIN_MASK 0x000F /* FLL1_LOOP_GAIN - [3:0] */ | ||
| 2176 | #define WM8994_FLL1_LOOP_GAIN_SHIFT 0 /* FLL1_LOOP_GAIN - [3:0] */ | ||
| 2177 | #define WM8994_FLL1_LOOP_GAIN_WIDTH 4 /* FLL1_LOOP_GAIN - [3:0] */ | ||
| 2178 | |||
| 2179 | /* | ||
| 2180 | * R548 (0x224) - FLL1 Control (5) | ||
| 2181 | */ | ||
| 2182 | #define WM8994_FLL1_FRC_NCO_VAL_MASK 0x1F80 /* FLL1_FRC_NCO_VAL - [12:7] */ | ||
| 2183 | #define WM8994_FLL1_FRC_NCO_VAL_SHIFT 7 /* FLL1_FRC_NCO_VAL - [12:7] */ | ||
| 2184 | #define WM8994_FLL1_FRC_NCO_VAL_WIDTH 6 /* FLL1_FRC_NCO_VAL - [12:7] */ | ||
| 2185 | #define WM8994_FLL1_FRC_NCO 0x0040 /* FLL1_FRC_NCO */ | ||
| 2186 | #define WM8994_FLL1_FRC_NCO_MASK 0x0040 /* FLL1_FRC_NCO */ | ||
| 2187 | #define WM8994_FLL1_FRC_NCO_SHIFT 6 /* FLL1_FRC_NCO */ | ||
| 2188 | #define WM8994_FLL1_FRC_NCO_WIDTH 1 /* FLL1_FRC_NCO */ | ||
| 2189 | #define WM8994_FLL1_REFCLK_DIV_MASK 0x0018 /* FLL1_REFCLK_DIV - [4:3] */ | ||
| 2190 | #define WM8994_FLL1_REFCLK_DIV_SHIFT 3 /* FLL1_REFCLK_DIV - [4:3] */ | ||
| 2191 | #define WM8994_FLL1_REFCLK_DIV_WIDTH 2 /* FLL1_REFCLK_DIV - [4:3] */ | ||
| 2192 | #define WM8994_FLL1_REFCLK_SRC_MASK 0x0003 /* FLL1_REFCLK_SRC - [1:0] */ | ||
| 2193 | #define WM8994_FLL1_REFCLK_SRC_SHIFT 0 /* FLL1_REFCLK_SRC - [1:0] */ | ||
| 2194 | #define WM8994_FLL1_REFCLK_SRC_WIDTH 2 /* FLL1_REFCLK_SRC - [1:0] */ | ||
| 2195 | |||
| 2196 | /* | ||
| 2197 | * R576 (0x240) - FLL2 Control (1) | ||
| 2198 | */ | ||
| 2199 | #define WM8994_FLL2_FRAC 0x0004 /* FLL2_FRAC */ | ||
| 2200 | #define WM8994_FLL2_FRAC_MASK 0x0004 /* FLL2_FRAC */ | ||
| 2201 | #define WM8994_FLL2_FRAC_SHIFT 2 /* FLL2_FRAC */ | ||
| 2202 | #define WM8994_FLL2_FRAC_WIDTH 1 /* FLL2_FRAC */ | ||
| 2203 | #define WM8994_FLL2_OSC_ENA 0x0002 /* FLL2_OSC_ENA */ | ||
| 2204 | #define WM8994_FLL2_OSC_ENA_MASK 0x0002 /* FLL2_OSC_ENA */ | ||
| 2205 | #define WM8994_FLL2_OSC_ENA_SHIFT 1 /* FLL2_OSC_ENA */ | ||
| 2206 | #define WM8994_FLL2_OSC_ENA_WIDTH 1 /* FLL2_OSC_ENA */ | ||
| 2207 | #define WM8994_FLL2_ENA 0x0001 /* FLL2_ENA */ | ||
| 2208 | #define WM8994_FLL2_ENA_MASK 0x0001 /* FLL2_ENA */ | ||
| 2209 | #define WM8994_FLL2_ENA_SHIFT 0 /* FLL2_ENA */ | ||
| 2210 | #define WM8994_FLL2_ENA_WIDTH 1 /* FLL2_ENA */ | ||
| 2211 | |||
| 2212 | /* | ||
| 2213 | * R577 (0x241) - FLL2 Control (2) | ||
| 2214 | */ | ||
| 2215 | #define WM8994_FLL2_OUTDIV_MASK 0x3F00 /* FLL2_OUTDIV - [13:8] */ | ||
| 2216 | #define WM8994_FLL2_OUTDIV_SHIFT 8 /* FLL2_OUTDIV - [13:8] */ | ||
| 2217 | #define WM8994_FLL2_OUTDIV_WIDTH 6 /* FLL2_OUTDIV - [13:8] */ | ||
| 2218 | #define WM8994_FLL2_CTRL_RATE_MASK 0x0070 /* FLL2_CTRL_RATE - [6:4] */ | ||
| 2219 | #define WM8994_FLL2_CTRL_RATE_SHIFT 4 /* FLL2_CTRL_RATE - [6:4] */ | ||
| 2220 | #define WM8994_FLL2_CTRL_RATE_WIDTH 3 /* FLL2_CTRL_RATE - [6:4] */ | ||
| 2221 | #define WM8994_FLL2_FRATIO_MASK 0x0007 /* FLL2_FRATIO - [2:0] */ | ||
| 2222 | #define WM8994_FLL2_FRATIO_SHIFT 0 /* FLL2_FRATIO - [2:0] */ | ||
| 2223 | #define WM8994_FLL2_FRATIO_WIDTH 3 /* FLL2_FRATIO - [2:0] */ | ||
| 2224 | |||
| 2225 | /* | ||
| 2226 | * R578 (0x242) - FLL2 Control (3) | ||
| 2227 | */ | ||
| 2228 | #define WM8994_FLL2_K_MASK 0xFFFF /* FLL2_K - [15:0] */ | ||
| 2229 | #define WM8994_FLL2_K_SHIFT 0 /* FLL2_K - [15:0] */ | ||
| 2230 | #define WM8994_FLL2_K_WIDTH 16 /* FLL2_K - [15:0] */ | ||
| 2231 | |||
| 2232 | /* | ||
| 2233 | * R579 (0x243) - FLL2 Control (4) | ||
| 2234 | */ | ||
| 2235 | #define WM8994_FLL2_N_MASK 0x7FE0 /* FLL2_N - [14:5] */ | ||
| 2236 | #define WM8994_FLL2_N_SHIFT 5 /* FLL2_N - [14:5] */ | ||
| 2237 | #define WM8994_FLL2_N_WIDTH 10 /* FLL2_N - [14:5] */ | ||
| 2238 | #define WM8994_FLL2_LOOP_GAIN_MASK 0x000F /* FLL2_LOOP_GAIN - [3:0] */ | ||
| 2239 | #define WM8994_FLL2_LOOP_GAIN_SHIFT 0 /* FLL2_LOOP_GAIN - [3:0] */ | ||
| 2240 | #define WM8994_FLL2_LOOP_GAIN_WIDTH 4 /* FLL2_LOOP_GAIN - [3:0] */ | ||
| 2241 | |||
| 2242 | /* | ||
| 2243 | * R580 (0x244) - FLL2 Control (5) | ||
| 2244 | */ | ||
| 2245 | #define WM8994_FLL2_FRC_NCO_VAL_MASK 0x1F80 /* FLL2_FRC_NCO_VAL - [12:7] */ | ||
| 2246 | #define WM8994_FLL2_FRC_NCO_VAL_SHIFT 7 /* FLL2_FRC_NCO_VAL - [12:7] */ | ||
| 2247 | #define WM8994_FLL2_FRC_NCO_VAL_WIDTH 6 /* FLL2_FRC_NCO_VAL - [12:7] */ | ||
| 2248 | #define WM8994_FLL2_FRC_NCO 0x0040 /* FLL2_FRC_NCO */ | ||
| 2249 | #define WM8994_FLL2_FRC_NCO_MASK 0x0040 /* FLL2_FRC_NCO */ | ||
| 2250 | #define WM8994_FLL2_FRC_NCO_SHIFT 6 /* FLL2_FRC_NCO */ | ||
| 2251 | #define WM8994_FLL2_FRC_NCO_WIDTH 1 /* FLL2_FRC_NCO */ | ||
| 2252 | #define WM8994_FLL2_REFCLK_DIV_MASK 0x0018 /* FLL2_REFCLK_DIV - [4:3] */ | ||
| 2253 | #define WM8994_FLL2_REFCLK_DIV_SHIFT 3 /* FLL2_REFCLK_DIV - [4:3] */ | ||
| 2254 | #define WM8994_FLL2_REFCLK_DIV_WIDTH 2 /* FLL2_REFCLK_DIV - [4:3] */ | ||
| 2255 | #define WM8994_FLL2_REFCLK_SRC_MASK 0x0003 /* FLL2_REFCLK_SRC - [1:0] */ | ||
| 2256 | #define WM8994_FLL2_REFCLK_SRC_SHIFT 0 /* FLL2_REFCLK_SRC - [1:0] */ | ||
| 2257 | #define WM8994_FLL2_REFCLK_SRC_WIDTH 2 /* FLL2_REFCLK_SRC - [1:0] */ | ||
| 2258 | |||
| 2259 | /* | ||
| 2260 | * R768 (0x300) - AIF1 Control (1) | ||
| 2261 | */ | ||
| 2262 | #define WM8994_AIF1ADCL_SRC 0x8000 /* AIF1ADCL_SRC */ | ||
| 2263 | #define WM8994_AIF1ADCL_SRC_MASK 0x8000 /* AIF1ADCL_SRC */ | ||
| 2264 | #define WM8994_AIF1ADCL_SRC_SHIFT 15 /* AIF1ADCL_SRC */ | ||
| 2265 | #define WM8994_AIF1ADCL_SRC_WIDTH 1 /* AIF1ADCL_SRC */ | ||
| 2266 | #define WM8994_AIF1ADCR_SRC 0x4000 /* AIF1ADCR_SRC */ | ||
| 2267 | #define WM8994_AIF1ADCR_SRC_MASK 0x4000 /* AIF1ADCR_SRC */ | ||
| 2268 | #define WM8994_AIF1ADCR_SRC_SHIFT 14 /* AIF1ADCR_SRC */ | ||
| 2269 | #define WM8994_AIF1ADCR_SRC_WIDTH 1 /* AIF1ADCR_SRC */ | ||
| 2270 | #define WM8994_AIF1ADC_TDM 0x2000 /* AIF1ADC_TDM */ | ||
| 2271 | #define WM8994_AIF1ADC_TDM_MASK 0x2000 /* AIF1ADC_TDM */ | ||
| 2272 | #define WM8994_AIF1ADC_TDM_SHIFT 13 /* AIF1ADC_TDM */ | ||
| 2273 | #define WM8994_AIF1ADC_TDM_WIDTH 1 /* AIF1ADC_TDM */ | ||
| 2274 | #define WM8994_AIF1_BCLK_INV 0x0100 /* AIF1_BCLK_INV */ | ||
| 2275 | #define WM8994_AIF1_BCLK_INV_MASK 0x0100 /* AIF1_BCLK_INV */ | ||
| 2276 | #define WM8994_AIF1_BCLK_INV_SHIFT 8 /* AIF1_BCLK_INV */ | ||
| 2277 | #define WM8994_AIF1_BCLK_INV_WIDTH 1 /* AIF1_BCLK_INV */ | ||
| 2278 | #define WM8994_AIF1_LRCLK_INV 0x0080 /* AIF1_LRCLK_INV */ | ||
| 2279 | #define WM8994_AIF1_LRCLK_INV_MASK 0x0080 /* AIF1_LRCLK_INV */ | ||
| 2280 | #define WM8994_AIF1_LRCLK_INV_SHIFT 7 /* AIF1_LRCLK_INV */ | ||
| 2281 | #define WM8994_AIF1_LRCLK_INV_WIDTH 1 /* AIF1_LRCLK_INV */ | ||
| 2282 | #define WM8994_AIF1_WL_MASK 0x0060 /* AIF1_WL - [6:5] */ | ||
| 2283 | #define WM8994_AIF1_WL_SHIFT 5 /* AIF1_WL - [6:5] */ | ||
| 2284 | #define WM8994_AIF1_WL_WIDTH 2 /* AIF1_WL - [6:5] */ | ||
| 2285 | #define WM8994_AIF1_FMT_MASK 0x0018 /* AIF1_FMT - [4:3] */ | ||
| 2286 | #define WM8994_AIF1_FMT_SHIFT 3 /* AIF1_FMT - [4:3] */ | ||
| 2287 | #define WM8994_AIF1_FMT_WIDTH 2 /* AIF1_FMT - [4:3] */ | ||
| 2288 | |||
| 2289 | /* | ||
| 2290 | * R769 (0x301) - AIF1 Control (2) | ||
| 2291 | */ | ||
| 2292 | #define WM8994_AIF1DACL_SRC 0x8000 /* AIF1DACL_SRC */ | ||
| 2293 | #define WM8994_AIF1DACL_SRC_MASK 0x8000 /* AIF1DACL_SRC */ | ||
| 2294 | #define WM8994_AIF1DACL_SRC_SHIFT 15 /* AIF1DACL_SRC */ | ||
| 2295 | #define WM8994_AIF1DACL_SRC_WIDTH 1 /* AIF1DACL_SRC */ | ||
| 2296 | #define WM8994_AIF1DACR_SRC 0x4000 /* AIF1DACR_SRC */ | ||
| 2297 | #define WM8994_AIF1DACR_SRC_MASK 0x4000 /* AIF1DACR_SRC */ | ||
| 2298 | #define WM8994_AIF1DACR_SRC_SHIFT 14 /* AIF1DACR_SRC */ | ||
| 2299 | #define WM8994_AIF1DACR_SRC_WIDTH 1 /* AIF1DACR_SRC */ | ||
| 2300 | #define WM8994_AIF1DAC_BOOST_MASK 0x0C00 /* AIF1DAC_BOOST - [11:10] */ | ||
| 2301 | #define WM8994_AIF1DAC_BOOST_SHIFT 10 /* AIF1DAC_BOOST - [11:10] */ | ||
| 2302 | #define WM8994_AIF1DAC_BOOST_WIDTH 2 /* AIF1DAC_BOOST - [11:10] */ | ||
| 2303 | #define WM8994_AIF1_MONO 0x0100 /* AIF1_MONO */ | ||
| 2304 | #define WM8994_AIF1_MONO_MASK 0x0100 /* AIF1_MONO */ | ||
| 2305 | #define WM8994_AIF1_MONO_SHIFT 8 /* AIF1_MONO */ | ||
| 2306 | #define WM8994_AIF1_MONO_WIDTH 1 /* AIF1_MONO */ | ||
| 2307 | #define WM8994_AIF1DAC_COMP 0x0010 /* AIF1DAC_COMP */ | ||
| 2308 | #define WM8994_AIF1DAC_COMP_MASK 0x0010 /* AIF1DAC_COMP */ | ||
| 2309 | #define WM8994_AIF1DAC_COMP_SHIFT 4 /* AIF1DAC_COMP */ | ||
| 2310 | #define WM8994_AIF1DAC_COMP_WIDTH 1 /* AIF1DAC_COMP */ | ||
| 2311 | #define WM8994_AIF1DAC_COMPMODE 0x0008 /* AIF1DAC_COMPMODE */ | ||
| 2312 | #define WM8994_AIF1DAC_COMPMODE_MASK 0x0008 /* AIF1DAC_COMPMODE */ | ||
| 2313 | #define WM8994_AIF1DAC_COMPMODE_SHIFT 3 /* AIF1DAC_COMPMODE */ | ||
| 2314 | #define WM8994_AIF1DAC_COMPMODE_WIDTH 1 /* AIF1DAC_COMPMODE */ | ||
| 2315 | #define WM8994_AIF1ADC_COMP 0x0004 /* AIF1ADC_COMP */ | ||
| 2316 | #define WM8994_AIF1ADC_COMP_MASK 0x0004 /* AIF1ADC_COMP */ | ||
| 2317 | #define WM8994_AIF1ADC_COMP_SHIFT 2 /* AIF1ADC_COMP */ | ||
| 2318 | #define WM8994_AIF1ADC_COMP_WIDTH 1 /* AIF1ADC_COMP */ | ||
| 2319 | #define WM8994_AIF1ADC_COMPMODE 0x0002 /* AIF1ADC_COMPMODE */ | ||
| 2320 | #define WM8994_AIF1ADC_COMPMODE_MASK 0x0002 /* AIF1ADC_COMPMODE */ | ||
| 2321 | #define WM8994_AIF1ADC_COMPMODE_SHIFT 1 /* AIF1ADC_COMPMODE */ | ||
| 2322 | #define WM8994_AIF1ADC_COMPMODE_WIDTH 1 /* AIF1ADC_COMPMODE */ | ||
| 2323 | #define WM8994_AIF1_LOOPBACK 0x0001 /* AIF1_LOOPBACK */ | ||
| 2324 | #define WM8994_AIF1_LOOPBACK_MASK 0x0001 /* AIF1_LOOPBACK */ | ||
| 2325 | #define WM8994_AIF1_LOOPBACK_SHIFT 0 /* AIF1_LOOPBACK */ | ||
| 2326 | #define WM8994_AIF1_LOOPBACK_WIDTH 1 /* AIF1_LOOPBACK */ | ||
| 2327 | |||
| 2328 | /* | ||
| 2329 | * R770 (0x302) - AIF1 Master/Slave | ||
| 2330 | */ | ||
| 2331 | #define WM8994_AIF1_TRI 0x8000 /* AIF1_TRI */ | ||
| 2332 | #define WM8994_AIF1_TRI_MASK 0x8000 /* AIF1_TRI */ | ||
| 2333 | #define WM8994_AIF1_TRI_SHIFT 15 /* AIF1_TRI */ | ||
| 2334 | #define WM8994_AIF1_TRI_WIDTH 1 /* AIF1_TRI */ | ||
| 2335 | #define WM8994_AIF1_MSTR 0x4000 /* AIF1_MSTR */ | ||
| 2336 | #define WM8994_AIF1_MSTR_MASK 0x4000 /* AIF1_MSTR */ | ||
| 2337 | #define WM8994_AIF1_MSTR_SHIFT 14 /* AIF1_MSTR */ | ||
| 2338 | #define WM8994_AIF1_MSTR_WIDTH 1 /* AIF1_MSTR */ | ||
| 2339 | #define WM8994_AIF1_CLK_FRC 0x2000 /* AIF1_CLK_FRC */ | ||
| 2340 | #define WM8994_AIF1_CLK_FRC_MASK 0x2000 /* AIF1_CLK_FRC */ | ||
| 2341 | #define WM8994_AIF1_CLK_FRC_SHIFT 13 /* AIF1_CLK_FRC */ | ||
| 2342 | #define WM8994_AIF1_CLK_FRC_WIDTH 1 /* AIF1_CLK_FRC */ | ||
| 2343 | #define WM8994_AIF1_LRCLK_FRC 0x1000 /* AIF1_LRCLK_FRC */ | ||
| 2344 | #define WM8994_AIF1_LRCLK_FRC_MASK 0x1000 /* AIF1_LRCLK_FRC */ | ||
| 2345 | #define WM8994_AIF1_LRCLK_FRC_SHIFT 12 /* AIF1_LRCLK_FRC */ | ||
| 2346 | #define WM8994_AIF1_LRCLK_FRC_WIDTH 1 /* AIF1_LRCLK_FRC */ | ||
| 2347 | |||
| 2348 | /* | ||
| 2349 | * R771 (0x303) - AIF1 BCLK | ||
| 2350 | */ | ||
| 2351 | #define WM8994_AIF1_BCLK_DIV_MASK 0x01F0 /* AIF1_BCLK_DIV - [8:4] */ | ||
| 2352 | #define WM8994_AIF1_BCLK_DIV_SHIFT 4 /* AIF1_BCLK_DIV - [8:4] */ | ||
| 2353 | #define WM8994_AIF1_BCLK_DIV_WIDTH 5 /* AIF1_BCLK_DIV - [8:4] */ | ||
| 2354 | |||
| 2355 | /* | ||
| 2356 | * R772 (0x304) - AIF1ADC LRCLK | ||
| 2357 | */ | ||
| 2358 | #define WM8994_AIF1ADC_LRCLK_DIR 0x0800 /* AIF1ADC_LRCLK_DIR */ | ||
| 2359 | #define WM8994_AIF1ADC_LRCLK_DIR_MASK 0x0800 /* AIF1ADC_LRCLK_DIR */ | ||
| 2360 | #define WM8994_AIF1ADC_LRCLK_DIR_SHIFT 11 /* AIF1ADC_LRCLK_DIR */ | ||
| 2361 | #define WM8994_AIF1ADC_LRCLK_DIR_WIDTH 1 /* AIF1ADC_LRCLK_DIR */ | ||
| 2362 | #define WM8994_AIF1ADC_RATE_MASK 0x07FF /* AIF1ADC_RATE - [10:0] */ | ||
| 2363 | #define WM8994_AIF1ADC_RATE_SHIFT 0 /* AIF1ADC_RATE - [10:0] */ | ||
| 2364 | #define WM8994_AIF1ADC_RATE_WIDTH 11 /* AIF1ADC_RATE - [10:0] */ | ||
| 2365 | |||
| 2366 | /* | ||
| 2367 | * R773 (0x305) - AIF1DAC LRCLK | ||
| 2368 | */ | ||
| 2369 | #define WM8994_AIF1DAC_LRCLK_DIR 0x0800 /* AIF1DAC_LRCLK_DIR */ | ||
| 2370 | #define WM8994_AIF1DAC_LRCLK_DIR_MASK 0x0800 /* AIF1DAC_LRCLK_DIR */ | ||
| 2371 | #define WM8994_AIF1DAC_LRCLK_DIR_SHIFT 11 /* AIF1DAC_LRCLK_DIR */ | ||
| 2372 | #define WM8994_AIF1DAC_LRCLK_DIR_WIDTH 1 /* AIF1DAC_LRCLK_DIR */ | ||
| 2373 | #define WM8994_AIF1DAC_RATE_MASK 0x07FF /* AIF1DAC_RATE - [10:0] */ | ||
| 2374 | #define WM8994_AIF1DAC_RATE_SHIFT 0 /* AIF1DAC_RATE - [10:0] */ | ||
| 2375 | #define WM8994_AIF1DAC_RATE_WIDTH 11 /* AIF1DAC_RATE - [10:0] */ | ||
| 2376 | |||
| 2377 | /* | ||
| 2378 | * R774 (0x306) - AIF1DAC Data | ||
| 2379 | */ | ||
| 2380 | #define WM8994_AIF1DACL_DAT_INV 0x0002 /* AIF1DACL_DAT_INV */ | ||
| 2381 | #define WM8994_AIF1DACL_DAT_INV_MASK 0x0002 /* AIF1DACL_DAT_INV */ | ||
| 2382 | #define WM8994_AIF1DACL_DAT_INV_SHIFT 1 /* AIF1DACL_DAT_INV */ | ||
| 2383 | #define WM8994_AIF1DACL_DAT_INV_WIDTH 1 /* AIF1DACL_DAT_INV */ | ||
| 2384 | #define WM8994_AIF1DACR_DAT_INV 0x0001 /* AIF1DACR_DAT_INV */ | ||
| 2385 | #define WM8994_AIF1DACR_DAT_INV_MASK 0x0001 /* AIF1DACR_DAT_INV */ | ||
| 2386 | #define WM8994_AIF1DACR_DAT_INV_SHIFT 0 /* AIF1DACR_DAT_INV */ | ||
| 2387 | #define WM8994_AIF1DACR_DAT_INV_WIDTH 1 /* AIF1DACR_DAT_INV */ | ||
| 2388 | |||
| 2389 | /* | ||
| 2390 | * R775 (0x307) - AIF1ADC Data | ||
| 2391 | */ | ||
| 2392 | #define WM8994_AIF1ADCL_DAT_INV 0x0002 /* AIF1ADCL_DAT_INV */ | ||
| 2393 | #define WM8994_AIF1ADCL_DAT_INV_MASK 0x0002 /* AIF1ADCL_DAT_INV */ | ||
| 2394 | #define WM8994_AIF1ADCL_DAT_INV_SHIFT 1 /* AIF1ADCL_DAT_INV */ | ||
| 2395 | #define WM8994_AIF1ADCL_DAT_INV_WIDTH 1 /* AIF1ADCL_DAT_INV */ | ||
| 2396 | #define WM8994_AIF1ADCR_DAT_INV 0x0001 /* AIF1ADCR_DAT_INV */ | ||
| 2397 | #define WM8994_AIF1ADCR_DAT_INV_MASK 0x0001 /* AIF1ADCR_DAT_INV */ | ||
| 2398 | #define WM8994_AIF1ADCR_DAT_INV_SHIFT 0 /* AIF1ADCR_DAT_INV */ | ||
| 2399 | #define WM8994_AIF1ADCR_DAT_INV_WIDTH 1 /* AIF1ADCR_DAT_INV */ | ||
| 2400 | |||
| 2401 | /* | ||
| 2402 | * R784 (0x310) - AIF2 Control (1) | ||
| 2403 | */ | ||
| 2404 | #define WM8994_AIF2ADCL_SRC 0x8000 /* AIF2ADCL_SRC */ | ||
| 2405 | #define WM8994_AIF2ADCL_SRC_MASK 0x8000 /* AIF2ADCL_SRC */ | ||
| 2406 | #define WM8994_AIF2ADCL_SRC_SHIFT 15 /* AIF2ADCL_SRC */ | ||
| 2407 | #define WM8994_AIF2ADCL_SRC_WIDTH 1 /* AIF2ADCL_SRC */ | ||
| 2408 | #define WM8994_AIF2ADCR_SRC 0x4000 /* AIF2ADCR_SRC */ | ||
| 2409 | #define WM8994_AIF2ADCR_SRC_MASK 0x4000 /* AIF2ADCR_SRC */ | ||
| 2410 | #define WM8994_AIF2ADCR_SRC_SHIFT 14 /* AIF2ADCR_SRC */ | ||
| 2411 | #define WM8994_AIF2ADCR_SRC_WIDTH 1 /* AIF2ADCR_SRC */ | ||
| 2412 | #define WM8994_AIF2ADC_TDM 0x2000 /* AIF2ADC_TDM */ | ||
| 2413 | #define WM8994_AIF2ADC_TDM_MASK 0x2000 /* AIF2ADC_TDM */ | ||
| 2414 | #define WM8994_AIF2ADC_TDM_SHIFT 13 /* AIF2ADC_TDM */ | ||
| 2415 | #define WM8994_AIF2ADC_TDM_WIDTH 1 /* AIF2ADC_TDM */ | ||
| 2416 | #define WM8994_AIF2ADC_TDM_CHAN 0x1000 /* AIF2ADC_TDM_CHAN */ | ||
| 2417 | #define WM8994_AIF2ADC_TDM_CHAN_MASK 0x1000 /* AIF2ADC_TDM_CHAN */ | ||
| 2418 | #define WM8994_AIF2ADC_TDM_CHAN_SHIFT 12 /* AIF2ADC_TDM_CHAN */ | ||
| 2419 | #define WM8994_AIF2ADC_TDM_CHAN_WIDTH 1 /* AIF2ADC_TDM_CHAN */ | ||
| 2420 | #define WM8994_AIF2_BCLK_INV 0x0100 /* AIF2_BCLK_INV */ | ||
| 2421 | #define WM8994_AIF2_BCLK_INV_MASK 0x0100 /* AIF2_BCLK_INV */ | ||
| 2422 | #define WM8994_AIF2_BCLK_INV_SHIFT 8 /* AIF2_BCLK_INV */ | ||
| 2423 | #define WM8994_AIF2_BCLK_INV_WIDTH 1 /* AIF2_BCLK_INV */ | ||
| 2424 | #define WM8994_AIF2_LRCLK_INV 0x0080 /* AIF2_LRCLK_INV */ | ||
| 2425 | #define WM8994_AIF2_LRCLK_INV_MASK 0x0080 /* AIF2_LRCLK_INV */ | ||
| 2426 | #define WM8994_AIF2_LRCLK_INV_SHIFT 7 /* AIF2_LRCLK_INV */ | ||
| 2427 | #define WM8994_AIF2_LRCLK_INV_WIDTH 1 /* AIF2_LRCLK_INV */ | ||
| 2428 | #define WM8994_AIF2_WL_MASK 0x0060 /* AIF2_WL - [6:5] */ | ||
| 2429 | #define WM8994_AIF2_WL_SHIFT 5 /* AIF2_WL - [6:5] */ | ||
| 2430 | #define WM8994_AIF2_WL_WIDTH 2 /* AIF2_WL - [6:5] */ | ||
| 2431 | #define WM8994_AIF2_FMT_MASK 0x0018 /* AIF2_FMT - [4:3] */ | ||
| 2432 | #define WM8994_AIF2_FMT_SHIFT 3 /* AIF2_FMT - [4:3] */ | ||
| 2433 | #define WM8994_AIF2_FMT_WIDTH 2 /* AIF2_FMT - [4:3] */ | ||
| 2434 | |||
| 2435 | /* | ||
| 2436 | * R785 (0x311) - AIF2 Control (2) | ||
| 2437 | */ | ||
| 2438 | #define WM8994_AIF2DACL_SRC 0x8000 /* AIF2DACL_SRC */ | ||
| 2439 | #define WM8994_AIF2DACL_SRC_MASK 0x8000 /* AIF2DACL_SRC */ | ||
| 2440 | #define WM8994_AIF2DACL_SRC_SHIFT 15 /* AIF2DACL_SRC */ | ||
| 2441 | #define WM8994_AIF2DACL_SRC_WIDTH 1 /* AIF2DACL_SRC */ | ||
| 2442 | #define WM8994_AIF2DACR_SRC 0x4000 /* AIF2DACR_SRC */ | ||
| 2443 | #define WM8994_AIF2DACR_SRC_MASK 0x4000 /* AIF2DACR_SRC */ | ||
| 2444 | #define WM8994_AIF2DACR_SRC_SHIFT 14 /* AIF2DACR_SRC */ | ||
| 2445 | #define WM8994_AIF2DACR_SRC_WIDTH 1 /* AIF2DACR_SRC */ | ||
| 2446 | #define WM8994_AIF2DAC_TDM 0x2000 /* AIF2DAC_TDM */ | ||
| 2447 | #define WM8994_AIF2DAC_TDM_MASK 0x2000 /* AIF2DAC_TDM */ | ||
| 2448 | #define WM8994_AIF2DAC_TDM_SHIFT 13 /* AIF2DAC_TDM */ | ||
| 2449 | #define WM8994_AIF2DAC_TDM_WIDTH 1 /* AIF2DAC_TDM */ | ||
| 2450 | #define WM8994_AIF2DAC_TDM_CHAN 0x1000 /* AIF2DAC_TDM_CHAN */ | ||
| 2451 | #define WM8994_AIF2DAC_TDM_CHAN_MASK 0x1000 /* AIF2DAC_TDM_CHAN */ | ||
| 2452 | #define WM8994_AIF2DAC_TDM_CHAN_SHIFT 12 /* AIF2DAC_TDM_CHAN */ | ||
| 2453 | #define WM8994_AIF2DAC_TDM_CHAN_WIDTH 1 /* AIF2DAC_TDM_CHAN */ | ||
| 2454 | #define WM8994_AIF2DAC_BOOST_MASK 0x0C00 /* AIF2DAC_BOOST - [11:10] */ | ||
| 2455 | #define WM8994_AIF2DAC_BOOST_SHIFT 10 /* AIF2DAC_BOOST - [11:10] */ | ||
| 2456 | #define WM8994_AIF2DAC_BOOST_WIDTH 2 /* AIF2DAC_BOOST - [11:10] */ | ||
| 2457 | #define WM8994_AIF2_MONO 0x0100 /* AIF2_MONO */ | ||
| 2458 | #define WM8994_AIF2_MONO_MASK 0x0100 /* AIF2_MONO */ | ||
| 2459 | #define WM8994_AIF2_MONO_SHIFT 8 /* AIF2_MONO */ | ||
| 2460 | #define WM8994_AIF2_MONO_WIDTH 1 /* AIF2_MONO */ | ||
| 2461 | #define WM8994_AIF2DAC_COMP 0x0010 /* AIF2DAC_COMP */ | ||
| 2462 | #define WM8994_AIF2DAC_COMP_MASK 0x0010 /* AIF2DAC_COMP */ | ||
| 2463 | #define WM8994_AIF2DAC_COMP_SHIFT 4 /* AIF2DAC_COMP */ | ||
| 2464 | #define WM8994_AIF2DAC_COMP_WIDTH 1 /* AIF2DAC_COMP */ | ||
| 2465 | #define WM8994_AIF2DAC_COMPMODE 0x0008 /* AIF2DAC_COMPMODE */ | ||
| 2466 | #define WM8994_AIF2DAC_COMPMODE_MASK 0x0008 /* AIF2DAC_COMPMODE */ | ||
| 2467 | #define WM8994_AIF2DAC_COMPMODE_SHIFT 3 /* AIF2DAC_COMPMODE */ | ||
| 2468 | #define WM8994_AIF2DAC_COMPMODE_WIDTH 1 /* AIF2DAC_COMPMODE */ | ||
| 2469 | #define WM8994_AIF2ADC_COMP 0x0004 /* AIF2ADC_COMP */ | ||
| 2470 | #define WM8994_AIF2ADC_COMP_MASK 0x0004 /* AIF2ADC_COMP */ | ||
| 2471 | #define WM8994_AIF2ADC_COMP_SHIFT 2 /* AIF2ADC_COMP */ | ||
| 2472 | #define WM8994_AIF2ADC_COMP_WIDTH 1 /* AIF2ADC_COMP */ | ||
| 2473 | #define WM8994_AIF2ADC_COMPMODE 0x0002 /* AIF2ADC_COMPMODE */ | ||
| 2474 | #define WM8994_AIF2ADC_COMPMODE_MASK 0x0002 /* AIF2ADC_COMPMODE */ | ||
| 2475 | #define WM8994_AIF2ADC_COMPMODE_SHIFT 1 /* AIF2ADC_COMPMODE */ | ||
| 2476 | #define WM8994_AIF2ADC_COMPMODE_WIDTH 1 /* AIF2ADC_COMPMODE */ | ||
| 2477 | #define WM8994_AIF2_LOOPBACK 0x0001 /* AIF2_LOOPBACK */ | ||
| 2478 | #define WM8994_AIF2_LOOPBACK_MASK 0x0001 /* AIF2_LOOPBACK */ | ||
| 2479 | #define WM8994_AIF2_LOOPBACK_SHIFT 0 /* AIF2_LOOPBACK */ | ||
| 2480 | #define WM8994_AIF2_LOOPBACK_WIDTH 1 /* AIF2_LOOPBACK */ | ||
| 2481 | |||
| 2482 | /* | ||
| 2483 | * R786 (0x312) - AIF2 Master/Slave | ||
| 2484 | */ | ||
| 2485 | #define WM8994_AIF2_TRI 0x8000 /* AIF2_TRI */ | ||
| 2486 | #define WM8994_AIF2_TRI_MASK 0x8000 /* AIF2_TRI */ | ||
| 2487 | #define WM8994_AIF2_TRI_SHIFT 15 /* AIF2_TRI */ | ||
| 2488 | #define WM8994_AIF2_TRI_WIDTH 1 /* AIF2_TRI */ | ||
| 2489 | #define WM8994_AIF2_MSTR 0x4000 /* AIF2_MSTR */ | ||
| 2490 | #define WM8994_AIF2_MSTR_MASK 0x4000 /* AIF2_MSTR */ | ||
| 2491 | #define WM8994_AIF2_MSTR_SHIFT 14 /* AIF2_MSTR */ | ||
| 2492 | #define WM8994_AIF2_MSTR_WIDTH 1 /* AIF2_MSTR */ | ||
| 2493 | #define WM8994_AIF2_CLK_FRC 0x2000 /* AIF2_CLK_FRC */ | ||
| 2494 | #define WM8994_AIF2_CLK_FRC_MASK 0x2000 /* AIF2_CLK_FRC */ | ||
| 2495 | #define WM8994_AIF2_CLK_FRC_SHIFT 13 /* AIF2_CLK_FRC */ | ||
| 2496 | #define WM8994_AIF2_CLK_FRC_WIDTH 1 /* AIF2_CLK_FRC */ | ||
| 2497 | #define WM8994_AIF2_LRCLK_FRC 0x1000 /* AIF2_LRCLK_FRC */ | ||
| 2498 | #define WM8994_AIF2_LRCLK_FRC_MASK 0x1000 /* AIF2_LRCLK_FRC */ | ||
| 2499 | #define WM8994_AIF2_LRCLK_FRC_SHIFT 12 /* AIF2_LRCLK_FRC */ | ||
| 2500 | #define WM8994_AIF2_LRCLK_FRC_WIDTH 1 /* AIF2_LRCLK_FRC */ | ||
| 2501 | |||
| 2502 | /* | ||
| 2503 | * R787 (0x313) - AIF2 BCLK | ||
| 2504 | */ | ||
| 2505 | #define WM8994_AIF2_BCLK_DIV_MASK 0x01F0 /* AIF2_BCLK_DIV - [8:4] */ | ||
| 2506 | #define WM8994_AIF2_BCLK_DIV_SHIFT 4 /* AIF2_BCLK_DIV - [8:4] */ | ||
| 2507 | #define WM8994_AIF2_BCLK_DIV_WIDTH 5 /* AIF2_BCLK_DIV - [8:4] */ | ||
| 2508 | |||
| 2509 | /* | ||
| 2510 | * R788 (0x314) - AIF2ADC LRCLK | ||
| 2511 | */ | ||
| 2512 | #define WM8994_AIF2ADC_LRCLK_DIR 0x0800 /* AIF2ADC_LRCLK_DIR */ | ||
| 2513 | #define WM8994_AIF2ADC_LRCLK_DIR_MASK 0x0800 /* AIF2ADC_LRCLK_DIR */ | ||
| 2514 | #define WM8994_AIF2ADC_LRCLK_DIR_SHIFT 11 /* AIF2ADC_LRCLK_DIR */ | ||
| 2515 | #define WM8994_AIF2ADC_LRCLK_DIR_WIDTH 1 /* AIF2ADC_LRCLK_DIR */ | ||
| 2516 | #define WM8994_AIF2ADC_RATE_MASK 0x07FF /* AIF2ADC_RATE - [10:0] */ | ||
| 2517 | #define WM8994_AIF2ADC_RATE_SHIFT 0 /* AIF2ADC_RATE - [10:0] */ | ||
| 2518 | #define WM8994_AIF2ADC_RATE_WIDTH 11 /* AIF2ADC_RATE - [10:0] */ | ||
| 2519 | |||
| 2520 | /* | ||
| 2521 | * R789 (0x315) - AIF2DAC LRCLK | ||
| 2522 | */ | ||
| 2523 | #define WM8994_AIF2DAC_LRCLK_DIR 0x0800 /* AIF2DAC_LRCLK_DIR */ | ||
| 2524 | #define WM8994_AIF2DAC_LRCLK_DIR_MASK 0x0800 /* AIF2DAC_LRCLK_DIR */ | ||
| 2525 | #define WM8994_AIF2DAC_LRCLK_DIR_SHIFT 11 /* AIF2DAC_LRCLK_DIR */ | ||
| 2526 | #define WM8994_AIF2DAC_LRCLK_DIR_WIDTH 1 /* AIF2DAC_LRCLK_DIR */ | ||
| 2527 | #define WM8994_AIF2DAC_RATE_MASK 0x07FF /* AIF2DAC_RATE - [10:0] */ | ||
| 2528 | #define WM8994_AIF2DAC_RATE_SHIFT 0 /* AIF2DAC_RATE - [10:0] */ | ||
| 2529 | #define WM8994_AIF2DAC_RATE_WIDTH 11 /* AIF2DAC_RATE - [10:0] */ | ||
| 2530 | |||
| 2531 | /* | ||
| 2532 | * R790 (0x316) - AIF2DAC Data | ||
| 2533 | */ | ||
| 2534 | #define WM8994_AIF2DACL_DAT_INV 0x0002 /* AIF2DACL_DAT_INV */ | ||
| 2535 | #define WM8994_AIF2DACL_DAT_INV_MASK 0x0002 /* AIF2DACL_DAT_INV */ | ||
| 2536 | #define WM8994_AIF2DACL_DAT_INV_SHIFT 1 /* AIF2DACL_DAT_INV */ | ||
| 2537 | #define WM8994_AIF2DACL_DAT_INV_WIDTH 1 /* AIF2DACL_DAT_INV */ | ||
| 2538 | #define WM8994_AIF2DACR_DAT_INV 0x0001 /* AIF2DACR_DAT_INV */ | ||
| 2539 | #define WM8994_AIF2DACR_DAT_INV_MASK 0x0001 /* AIF2DACR_DAT_INV */ | ||
| 2540 | #define WM8994_AIF2DACR_DAT_INV_SHIFT 0 /* AIF2DACR_DAT_INV */ | ||
| 2541 | #define WM8994_AIF2DACR_DAT_INV_WIDTH 1 /* AIF2DACR_DAT_INV */ | ||
| 2542 | |||
| 2543 | /* | ||
| 2544 | * R791 (0x317) - AIF2ADC Data | ||
| 2545 | */ | ||
| 2546 | #define WM8994_AIF2ADCL_DAT_INV 0x0002 /* AIF2ADCL_DAT_INV */ | ||
| 2547 | #define WM8994_AIF2ADCL_DAT_INV_MASK 0x0002 /* AIF2ADCL_DAT_INV */ | ||
| 2548 | #define WM8994_AIF2ADCL_DAT_INV_SHIFT 1 /* AIF2ADCL_DAT_INV */ | ||
| 2549 | #define WM8994_AIF2ADCL_DAT_INV_WIDTH 1 /* AIF2ADCL_DAT_INV */ | ||
| 2550 | #define WM8994_AIF2ADCR_DAT_INV 0x0001 /* AIF2ADCR_DAT_INV */ | ||
| 2551 | #define WM8994_AIF2ADCR_DAT_INV_MASK 0x0001 /* AIF2ADCR_DAT_INV */ | ||
| 2552 | #define WM8994_AIF2ADCR_DAT_INV_SHIFT 0 /* AIF2ADCR_DAT_INV */ | ||
| 2553 | #define WM8994_AIF2ADCR_DAT_INV_WIDTH 1 /* AIF2ADCR_DAT_INV */ | ||
| 2554 | |||
| 2555 | /* | ||
| 2556 | * R1024 (0x400) - AIF1 ADC1 Left Volume | ||
| 2557 | */ | ||
| 2558 | #define WM8994_AIF1ADC1_VU 0x0100 /* AIF1ADC1_VU */ | ||
| 2559 | #define WM8994_AIF1ADC1_VU_MASK 0x0100 /* AIF1ADC1_VU */ | ||
| 2560 | #define WM8994_AIF1ADC1_VU_SHIFT 8 /* AIF1ADC1_VU */ | ||
| 2561 | #define WM8994_AIF1ADC1_VU_WIDTH 1 /* AIF1ADC1_VU */ | ||
| 2562 | #define WM8994_AIF1ADC1L_VOL_MASK 0x00FF /* AIF1ADC1L_VOL - [7:0] */ | ||
| 2563 | #define WM8994_AIF1ADC1L_VOL_SHIFT 0 /* AIF1ADC1L_VOL - [7:0] */ | ||
| 2564 | #define WM8994_AIF1ADC1L_VOL_WIDTH 8 /* AIF1ADC1L_VOL - [7:0] */ | ||
| 2565 | |||
| 2566 | /* | ||
| 2567 | * R1025 (0x401) - AIF1 ADC1 Right Volume | ||
| 2568 | */ | ||
| 2569 | #define WM8994_AIF1ADC1_VU 0x0100 /* AIF1ADC1_VU */ | ||
| 2570 | #define WM8994_AIF1ADC1_VU_MASK 0x0100 /* AIF1ADC1_VU */ | ||
| 2571 | #define WM8994_AIF1ADC1_VU_SHIFT 8 /* AIF1ADC1_VU */ | ||
| 2572 | #define WM8994_AIF1ADC1_VU_WIDTH 1 /* AIF1ADC1_VU */ | ||
| 2573 | #define WM8994_AIF1ADC1R_VOL_MASK 0x00FF /* AIF1ADC1R_VOL - [7:0] */ | ||
| 2574 | #define WM8994_AIF1ADC1R_VOL_SHIFT 0 /* AIF1ADC1R_VOL - [7:0] */ | ||
| 2575 | #define WM8994_AIF1ADC1R_VOL_WIDTH 8 /* AIF1ADC1R_VOL - [7:0] */ | ||
| 2576 | |||
| 2577 | /* | ||
| 2578 | * R1026 (0x402) - AIF1 DAC1 Left Volume | ||
| 2579 | */ | ||
| 2580 | #define WM8994_AIF1DAC1_VU 0x0100 /* AIF1DAC1_VU */ | ||
| 2581 | #define WM8994_AIF1DAC1_VU_MASK 0x0100 /* AIF1DAC1_VU */ | ||
| 2582 | #define WM8994_AIF1DAC1_VU_SHIFT 8 /* AIF1DAC1_VU */ | ||
| 2583 | #define WM8994_AIF1DAC1_VU_WIDTH 1 /* AIF1DAC1_VU */ | ||
| 2584 | #define WM8994_AIF1DAC1L_VOL_MASK 0x00FF /* AIF1DAC1L_VOL - [7:0] */ | ||
| 2585 | #define WM8994_AIF1DAC1L_VOL_SHIFT 0 /* AIF1DAC1L_VOL - [7:0] */ | ||
| 2586 | #define WM8994_AIF1DAC1L_VOL_WIDTH 8 /* AIF1DAC1L_VOL - [7:0] */ | ||
| 2587 | |||
| 2588 | /* | ||
| 2589 | * R1027 (0x403) - AIF1 DAC1 Right Volume | ||
| 2590 | */ | ||
| 2591 | #define WM8994_AIF1DAC1_VU 0x0100 /* AIF1DAC1_VU */ | ||
| 2592 | #define WM8994_AIF1DAC1_VU_MASK 0x0100 /* AIF1DAC1_VU */ | ||
| 2593 | #define WM8994_AIF1DAC1_VU_SHIFT 8 /* AIF1DAC1_VU */ | ||
| 2594 | #define WM8994_AIF1DAC1_VU_WIDTH 1 /* AIF1DAC1_VU */ | ||
| 2595 | #define WM8994_AIF1DAC1R_VOL_MASK 0x00FF /* AIF1DAC1R_VOL - [7:0] */ | ||
| 2596 | #define WM8994_AIF1DAC1R_VOL_SHIFT 0 /* AIF1DAC1R_VOL - [7:0] */ | ||
| 2597 | #define WM8994_AIF1DAC1R_VOL_WIDTH 8 /* AIF1DAC1R_VOL - [7:0] */ | ||
| 2598 | |||
| 2599 | /* | ||
| 2600 | * R1028 (0x404) - AIF1 ADC2 Left Volume | ||
| 2601 | */ | ||
| 2602 | #define WM8994_AIF1ADC2_VU 0x0100 /* AIF1ADC2_VU */ | ||
| 2603 | #define WM8994_AIF1ADC2_VU_MASK 0x0100 /* AIF1ADC2_VU */ | ||
| 2604 | #define WM8994_AIF1ADC2_VU_SHIFT 8 /* AIF1ADC2_VU */ | ||
| 2605 | #define WM8994_AIF1ADC2_VU_WIDTH 1 /* AIF1ADC2_VU */ | ||
| 2606 | #define WM8994_AIF1ADC2L_VOL_MASK 0x00FF /* AIF1ADC2L_VOL - [7:0] */ | ||
| 2607 | #define WM8994_AIF1ADC2L_VOL_SHIFT 0 /* AIF1ADC2L_VOL - [7:0] */ | ||
| 2608 | #define WM8994_AIF1ADC2L_VOL_WIDTH 8 /* AIF1ADC2L_VOL - [7:0] */ | ||
| 2609 | |||
| 2610 | /* | ||
| 2611 | * R1029 (0x405) - AIF1 ADC2 Right Volume | ||
| 2612 | */ | ||
| 2613 | #define WM8994_AIF1ADC2_VU 0x0100 /* AIF1ADC2_VU */ | ||
| 2614 | #define WM8994_AIF1ADC2_VU_MASK 0x0100 /* AIF1ADC2_VU */ | ||
| 2615 | #define WM8994_AIF1ADC2_VU_SHIFT 8 /* AIF1ADC2_VU */ | ||
| 2616 | #define WM8994_AIF1ADC2_VU_WIDTH 1 /* AIF1ADC2_VU */ | ||
| 2617 | #define WM8994_AIF1ADC2R_VOL_MASK 0x00FF /* AIF1ADC2R_VOL - [7:0] */ | ||
| 2618 | #define WM8994_AIF1ADC2R_VOL_SHIFT 0 /* AIF1ADC2R_VOL - [7:0] */ | ||
| 2619 | #define WM8994_AIF1ADC2R_VOL_WIDTH 8 /* AIF1ADC2R_VOL - [7:0] */ | ||
| 2620 | |||
| 2621 | /* | ||
| 2622 | * R1030 (0x406) - AIF1 DAC2 Left Volume | ||
| 2623 | */ | ||
| 2624 | #define WM8994_AIF1DAC2_VU 0x0100 /* AIF1DAC2_VU */ | ||
| 2625 | #define WM8994_AIF1DAC2_VU_MASK 0x0100 /* AIF1DAC2_VU */ | ||
| 2626 | #define WM8994_AIF1DAC2_VU_SHIFT 8 /* AIF1DAC2_VU */ | ||
| 2627 | #define WM8994_AIF1DAC2_VU_WIDTH 1 /* AIF1DAC2_VU */ | ||
| 2628 | #define WM8994_AIF1DAC2L_VOL_MASK 0x00FF /* AIF1DAC2L_VOL - [7:0] */ | ||
| 2629 | #define WM8994_AIF1DAC2L_VOL_SHIFT 0 /* AIF1DAC2L_VOL - [7:0] */ | ||
| 2630 | #define WM8994_AIF1DAC2L_VOL_WIDTH 8 /* AIF1DAC2L_VOL - [7:0] */ | ||
| 2631 | |||
| 2632 | /* | ||
| 2633 | * R1031 (0x407) - AIF1 DAC2 Right Volume | ||
| 2634 | */ | ||
| 2635 | #define WM8994_AIF1DAC2_VU 0x0100 /* AIF1DAC2_VU */ | ||
| 2636 | #define WM8994_AIF1DAC2_VU_MASK 0x0100 /* AIF1DAC2_VU */ | ||
| 2637 | #define WM8994_AIF1DAC2_VU_SHIFT 8 /* AIF1DAC2_VU */ | ||
| 2638 | #define WM8994_AIF1DAC2_VU_WIDTH 1 /* AIF1DAC2_VU */ | ||
| 2639 | #define WM8994_AIF1DAC2R_VOL_MASK 0x00FF /* AIF1DAC2R_VOL - [7:0] */ | ||
| 2640 | #define WM8994_AIF1DAC2R_VOL_SHIFT 0 /* AIF1DAC2R_VOL - [7:0] */ | ||
| 2641 | #define WM8994_AIF1DAC2R_VOL_WIDTH 8 /* AIF1DAC2R_VOL - [7:0] */ | ||
| 2642 | |||
| 2643 | /* | ||
| 2644 | * R1040 (0x410) - AIF1 ADC1 Filters | ||
| 2645 | */ | ||
| 2646 | #define WM8994_AIF1ADC_4FS 0x8000 /* AIF1ADC_4FS */ | ||
| 2647 | #define WM8994_AIF1ADC_4FS_MASK 0x8000 /* AIF1ADC_4FS */ | ||
| 2648 | #define WM8994_AIF1ADC_4FS_SHIFT 15 /* AIF1ADC_4FS */ | ||
| 2649 | #define WM8994_AIF1ADC_4FS_WIDTH 1 /* AIF1ADC_4FS */ | ||
| 2650 | #define WM8994_AIF1ADC1_HPF_CUT_MASK 0x6000 /* AIF1ADC1_HPF_CUT - [14:13] */ | ||
| 2651 | #define WM8994_AIF1ADC1_HPF_CUT_SHIFT 13 /* AIF1ADC1_HPF_CUT - [14:13] */ | ||
| 2652 | #define WM8994_AIF1ADC1_HPF_CUT_WIDTH 2 /* AIF1ADC1_HPF_CUT - [14:13] */ | ||
| 2653 | #define WM8994_AIF1ADC1L_HPF 0x1000 /* AIF1ADC1L_HPF */ | ||
| 2654 | #define WM8994_AIF1ADC1L_HPF_MASK 0x1000 /* AIF1ADC1L_HPF */ | ||
| 2655 | #define WM8994_AIF1ADC1L_HPF_SHIFT 12 /* AIF1ADC1L_HPF */ | ||
| 2656 | #define WM8994_AIF1ADC1L_HPF_WIDTH 1 /* AIF1ADC1L_HPF */ | ||
| 2657 | #define WM8994_AIF1ADC1R_HPF 0x0800 /* AIF1ADC1R_HPF */ | ||
| 2658 | #define WM8994_AIF1ADC1R_HPF_MASK 0x0800 /* AIF1ADC1R_HPF */ | ||
| 2659 | #define WM8994_AIF1ADC1R_HPF_SHIFT 11 /* AIF1ADC1R_HPF */ | ||
| 2660 | #define WM8994_AIF1ADC1R_HPF_WIDTH 1 /* AIF1ADC1R_HPF */ | ||
| 2661 | |||
| 2662 | /* | ||
| 2663 | * R1041 (0x411) - AIF1 ADC2 Filters | ||
| 2664 | */ | ||
| 2665 | #define WM8994_AIF1ADC2_HPF_CUT_MASK 0x6000 /* AIF1ADC2_HPF_CUT - [14:13] */ | ||
| 2666 | #define WM8994_AIF1ADC2_HPF_CUT_SHIFT 13 /* AIF1ADC2_HPF_CUT - [14:13] */ | ||
| 2667 | #define WM8994_AIF1ADC2_HPF_CUT_WIDTH 2 /* AIF1ADC2_HPF_CUT - [14:13] */ | ||
| 2668 | #define WM8994_AIF1ADC2L_HPF 0x1000 /* AIF1ADC2L_HPF */ | ||
| 2669 | #define WM8994_AIF1ADC2L_HPF_MASK 0x1000 /* AIF1ADC2L_HPF */ | ||
| 2670 | #define WM8994_AIF1ADC2L_HPF_SHIFT 12 /* AIF1ADC2L_HPF */ | ||
| 2671 | #define WM8994_AIF1ADC2L_HPF_WIDTH 1 /* AIF1ADC2L_HPF */ | ||
| 2672 | #define WM8994_AIF1ADC2R_HPF 0x0800 /* AIF1ADC2R_HPF */ | ||
| 2673 | #define WM8994_AIF1ADC2R_HPF_MASK 0x0800 /* AIF1ADC2R_HPF */ | ||
| 2674 | #define WM8994_AIF1ADC2R_HPF_SHIFT 11 /* AIF1ADC2R_HPF */ | ||
| 2675 | #define WM8994_AIF1ADC2R_HPF_WIDTH 1 /* AIF1ADC2R_HPF */ | ||
| 2676 | |||
| 2677 | /* | ||
| 2678 | * R1056 (0x420) - AIF1 DAC1 Filters (1) | ||
| 2679 | */ | ||
| 2680 | #define WM8994_AIF1DAC1_MUTE 0x0200 /* AIF1DAC1_MUTE */ | ||
| 2681 | #define WM8994_AIF1DAC1_MUTE_MASK 0x0200 /* AIF1DAC1_MUTE */ | ||
| 2682 | #define WM8994_AIF1DAC1_MUTE_SHIFT 9 /* AIF1DAC1_MUTE */ | ||
| 2683 | #define WM8994_AIF1DAC1_MUTE_WIDTH 1 /* AIF1DAC1_MUTE */ | ||
| 2684 | #define WM8994_AIF1DAC1_MONO 0x0080 /* AIF1DAC1_MONO */ | ||
| 2685 | #define WM8994_AIF1DAC1_MONO_MASK 0x0080 /* AIF1DAC1_MONO */ | ||
| 2686 | #define WM8994_AIF1DAC1_MONO_SHIFT 7 /* AIF1DAC1_MONO */ | ||
| 2687 | #define WM8994_AIF1DAC1_MONO_WIDTH 1 /* AIF1DAC1_MONO */ | ||
| 2688 | #define WM8994_AIF1DAC1_MUTERATE 0x0020 /* AIF1DAC1_MUTERATE */ | ||
| 2689 | #define WM8994_AIF1DAC1_MUTERATE_MASK 0x0020 /* AIF1DAC1_MUTERATE */ | ||
| 2690 | #define WM8994_AIF1DAC1_MUTERATE_SHIFT 5 /* AIF1DAC1_MUTERATE */ | ||
| 2691 | #define WM8994_AIF1DAC1_MUTERATE_WIDTH 1 /* AIF1DAC1_MUTERATE */ | ||
| 2692 | #define WM8994_AIF1DAC1_UNMUTE_RAMP 0x0010 /* AIF1DAC1_UNMUTE_RAMP */ | ||
| 2693 | #define WM8994_AIF1DAC1_UNMUTE_RAMP_MASK 0x0010 /* AIF1DAC1_UNMUTE_RAMP */ | ||
| 2694 | #define WM8994_AIF1DAC1_UNMUTE_RAMP_SHIFT 4 /* AIF1DAC1_UNMUTE_RAMP */ | ||
| 2695 | #define WM8994_AIF1DAC1_UNMUTE_RAMP_WIDTH 1 /* AIF1DAC1_UNMUTE_RAMP */ | ||
| 2696 | #define WM8994_AIF1DAC1_DEEMP_MASK 0x0006 /* AIF1DAC1_DEEMP - [2:1] */ | ||
| 2697 | #define WM8994_AIF1DAC1_DEEMP_SHIFT 1 /* AIF1DAC1_DEEMP - [2:1] */ | ||
| 2698 | #define WM8994_AIF1DAC1_DEEMP_WIDTH 2 /* AIF1DAC1_DEEMP - [2:1] */ | ||
| 2699 | |||
| 2700 | /* | ||
| 2701 | * R1057 (0x421) - AIF1 DAC1 Filters (2) | ||
| 2702 | */ | ||
| 2703 | #define WM8994_AIF1DAC1_3D_GAIN_MASK 0x3E00 /* AIF1DAC1_3D_GAIN - [13:9] */ | ||
| 2704 | #define WM8994_AIF1DAC1_3D_GAIN_SHIFT 9 /* AIF1DAC1_3D_GAIN - [13:9] */ | ||
| 2705 | #define WM8994_AIF1DAC1_3D_GAIN_WIDTH 5 /* AIF1DAC1_3D_GAIN - [13:9] */ | ||
| 2706 | #define WM8994_AIF1DAC1_3D_ENA 0x0100 /* AIF1DAC1_3D_ENA */ | ||
| 2707 | #define WM8994_AIF1DAC1_3D_ENA_MASK 0x0100 /* AIF1DAC1_3D_ENA */ | ||
| 2708 | #define WM8994_AIF1DAC1_3D_ENA_SHIFT 8 /* AIF1DAC1_3D_ENA */ | ||
| 2709 | #define WM8994_AIF1DAC1_3D_ENA_WIDTH 1 /* AIF1DAC1_3D_ENA */ | ||
| 2710 | |||
| 2711 | /* | ||
| 2712 | * R1058 (0x422) - AIF1 DAC2 Filters (1) | ||
| 2713 | */ | ||
| 2714 | #define WM8994_AIF1DAC2_MUTE 0x0200 /* AIF1DAC2_MUTE */ | ||
| 2715 | #define WM8994_AIF1DAC2_MUTE_MASK 0x0200 /* AIF1DAC2_MUTE */ | ||
| 2716 | #define WM8994_AIF1DAC2_MUTE_SHIFT 9 /* AIF1DAC2_MUTE */ | ||
| 2717 | #define WM8994_AIF1DAC2_MUTE_WIDTH 1 /* AIF1DAC2_MUTE */ | ||
| 2718 | #define WM8994_AIF1DAC2_MONO 0x0080 /* AIF1DAC2_MONO */ | ||
| 2719 | #define WM8994_AIF1DAC2_MONO_MASK 0x0080 /* AIF1DAC2_MONO */ | ||
| 2720 | #define WM8994_AIF1DAC2_MONO_SHIFT 7 /* AIF1DAC2_MONO */ | ||
| 2721 | #define WM8994_AIF1DAC2_MONO_WIDTH 1 /* AIF1DAC2_MONO */ | ||
| 2722 | #define WM8994_AIF1DAC2_MUTERATE 0x0020 /* AIF1DAC2_MUTERATE */ | ||
| 2723 | #define WM8994_AIF1DAC2_MUTERATE_MASK 0x0020 /* AIF1DAC2_MUTERATE */ | ||
| 2724 | #define WM8994_AIF1DAC2_MUTERATE_SHIFT 5 /* AIF1DAC2_MUTERATE */ | ||
| 2725 | #define WM8994_AIF1DAC2_MUTERATE_WIDTH 1 /* AIF1DAC2_MUTERATE */ | ||
| 2726 | #define WM8994_AIF1DAC2_UNMUTE_RAMP 0x0010 /* AIF1DAC2_UNMUTE_RAMP */ | ||
| 2727 | #define WM8994_AIF1DAC2_UNMUTE_RAMP_MASK 0x0010 /* AIF1DAC2_UNMUTE_RAMP */ | ||
| 2728 | #define WM8994_AIF1DAC2_UNMUTE_RAMP_SHIFT 4 /* AIF1DAC2_UNMUTE_RAMP */ | ||
| 2729 | #define WM8994_AIF1DAC2_UNMUTE_RAMP_WIDTH 1 /* AIF1DAC2_UNMUTE_RAMP */ | ||
| 2730 | #define WM8994_AIF1DAC2_DEEMP_MASK 0x0006 /* AIF1DAC2_DEEMP - [2:1] */ | ||
| 2731 | #define WM8994_AIF1DAC2_DEEMP_SHIFT 1 /* AIF1DAC2_DEEMP - [2:1] */ | ||
| 2732 | #define WM8994_AIF1DAC2_DEEMP_WIDTH 2 /* AIF1DAC2_DEEMP - [2:1] */ | ||
| 2733 | |||
| 2734 | /* | ||
| 2735 | * R1059 (0x423) - AIF1 DAC2 Filters (2) | ||
| 2736 | */ | ||
| 2737 | #define WM8994_AIF1DAC2_3D_GAIN_MASK 0x3E00 /* AIF1DAC2_3D_GAIN - [13:9] */ | ||
| 2738 | #define WM8994_AIF1DAC2_3D_GAIN_SHIFT 9 /* AIF1DAC2_3D_GAIN - [13:9] */ | ||
| 2739 | #define WM8994_AIF1DAC2_3D_GAIN_WIDTH 5 /* AIF1DAC2_3D_GAIN - [13:9] */ | ||
| 2740 | #define WM8994_AIF1DAC2_3D_ENA 0x0100 /* AIF1DAC2_3D_ENA */ | ||
| 2741 | #define WM8994_AIF1DAC2_3D_ENA_MASK 0x0100 /* AIF1DAC2_3D_ENA */ | ||
| 2742 | #define WM8994_AIF1DAC2_3D_ENA_SHIFT 8 /* AIF1DAC2_3D_ENA */ | ||
| 2743 | #define WM8994_AIF1DAC2_3D_ENA_WIDTH 1 /* AIF1DAC2_3D_ENA */ | ||
| 2744 | |||
| 2745 | /* | ||
| 2746 | * R1088 (0x440) - AIF1 DRC1 (1) | ||
| 2747 | */ | ||
| 2748 | #define WM8994_AIF1DRC1_SIG_DET_RMS_MASK 0xF800 /* AIF1DRC1_SIG_DET_RMS - [15:11] */ | ||
| 2749 | #define WM8994_AIF1DRC1_SIG_DET_RMS_SHIFT 11 /* AIF1DRC1_SIG_DET_RMS - [15:11] */ | ||
| 2750 | #define WM8994_AIF1DRC1_SIG_DET_RMS_WIDTH 5 /* AIF1DRC1_SIG_DET_RMS - [15:11] */ | ||
| 2751 | #define WM8994_AIF1DRC1_SIG_DET_PK_MASK 0x0600 /* AIF1DRC1_SIG_DET_PK - [10:9] */ | ||
| 2752 | #define WM8994_AIF1DRC1_SIG_DET_PK_SHIFT 9 /* AIF1DRC1_SIG_DET_PK - [10:9] */ | ||
| 2753 | #define WM8994_AIF1DRC1_SIG_DET_PK_WIDTH 2 /* AIF1DRC1_SIG_DET_PK - [10:9] */ | ||
| 2754 | #define WM8994_AIF1DRC1_NG_ENA 0x0100 /* AIF1DRC1_NG_ENA */ | ||
| 2755 | #define WM8994_AIF1DRC1_NG_ENA_MASK 0x0100 /* AIF1DRC1_NG_ENA */ | ||
| 2756 | #define WM8994_AIF1DRC1_NG_ENA_SHIFT 8 /* AIF1DRC1_NG_ENA */ | ||
| 2757 | #define WM8994_AIF1DRC1_NG_ENA_WIDTH 1 /* AIF1DRC1_NG_ENA */ | ||
| 2758 | #define WM8994_AIF1DRC1_SIG_DET_MODE 0x0080 /* AIF1DRC1_SIG_DET_MODE */ | ||
| 2759 | #define WM8994_AIF1DRC1_SIG_DET_MODE_MASK 0x0080 /* AIF1DRC1_SIG_DET_MODE */ | ||
| 2760 | #define WM8994_AIF1DRC1_SIG_DET_MODE_SHIFT 7 /* AIF1DRC1_SIG_DET_MODE */ | ||
| 2761 | #define WM8994_AIF1DRC1_SIG_DET_MODE_WIDTH 1 /* AIF1DRC1_SIG_DET_MODE */ | ||
| 2762 | #define WM8994_AIF1DRC1_SIG_DET 0x0040 /* AIF1DRC1_SIG_DET */ | ||
| 2763 | #define WM8994_AIF1DRC1_SIG_DET_MASK 0x0040 /* AIF1DRC1_SIG_DET */ | ||
| 2764 | #define WM8994_AIF1DRC1_SIG_DET_SHIFT 6 /* AIF1DRC1_SIG_DET */ | ||
| 2765 | #define WM8994_AIF1DRC1_SIG_DET_WIDTH 1 /* AIF1DRC1_SIG_DET */ | ||
| 2766 | #define WM8994_AIF1DRC1_KNEE2_OP_ENA 0x0020 /* AIF1DRC1_KNEE2_OP_ENA */ | ||
| 2767 | #define WM8994_AIF1DRC1_KNEE2_OP_ENA_MASK 0x0020 /* AIF1DRC1_KNEE2_OP_ENA */ | ||
| 2768 | #define WM8994_AIF1DRC1_KNEE2_OP_ENA_SHIFT 5 /* AIF1DRC1_KNEE2_OP_ENA */ | ||
| 2769 | #define WM8994_AIF1DRC1_KNEE2_OP_ENA_WIDTH 1 /* AIF1DRC1_KNEE2_OP_ENA */ | ||
| 2770 | #define WM8994_AIF1DRC1_QR 0x0010 /* AIF1DRC1_QR */ | ||
| 2771 | #define WM8994_AIF1DRC1_QR_MASK 0x0010 /* AIF1DRC1_QR */ | ||
| 2772 | #define WM8994_AIF1DRC1_QR_SHIFT 4 /* AIF1DRC1_QR */ | ||
| 2773 | #define WM8994_AIF1DRC1_QR_WIDTH 1 /* AIF1DRC1_QR */ | ||
| 2774 | #define WM8994_AIF1DRC1_ANTICLIP 0x0008 /* AIF1DRC1_ANTICLIP */ | ||
| 2775 | #define WM8994_AIF1DRC1_ANTICLIP_MASK 0x0008 /* AIF1DRC1_ANTICLIP */ | ||
| 2776 | #define WM8994_AIF1DRC1_ANTICLIP_SHIFT 3 /* AIF1DRC1_ANTICLIP */ | ||
| 2777 | #define WM8994_AIF1DRC1_ANTICLIP_WIDTH 1 /* AIF1DRC1_ANTICLIP */ | ||
| 2778 | #define WM8994_AIF1DAC1_DRC_ENA 0x0004 /* AIF1DAC1_DRC_ENA */ | ||
| 2779 | #define WM8994_AIF1DAC1_DRC_ENA_MASK 0x0004 /* AIF1DAC1_DRC_ENA */ | ||
| 2780 | #define WM8994_AIF1DAC1_DRC_ENA_SHIFT 2 /* AIF1DAC1_DRC_ENA */ | ||
| 2781 | #define WM8994_AIF1DAC1_DRC_ENA_WIDTH 1 /* AIF1DAC1_DRC_ENA */ | ||
| 2782 | #define WM8994_AIF1ADC1L_DRC_ENA 0x0002 /* AIF1ADC1L_DRC_ENA */ | ||
| 2783 | #define WM8994_AIF1ADC1L_DRC_ENA_MASK 0x0002 /* AIF1ADC1L_DRC_ENA */ | ||
| 2784 | #define WM8994_AIF1ADC1L_DRC_ENA_SHIFT 1 /* AIF1ADC1L_DRC_ENA */ | ||
| 2785 | #define WM8994_AIF1ADC1L_DRC_ENA_WIDTH 1 /* AIF1ADC1L_DRC_ENA */ | ||
| 2786 | #define WM8994_AIF1ADC1R_DRC_ENA 0x0001 /* AIF1ADC1R_DRC_ENA */ | ||
| 2787 | #define WM8994_AIF1ADC1R_DRC_ENA_MASK 0x0001 /* AIF1ADC1R_DRC_ENA */ | ||
| 2788 | #define WM8994_AIF1ADC1R_DRC_ENA_SHIFT 0 /* AIF1ADC1R_DRC_ENA */ | ||
| 2789 | #define WM8994_AIF1ADC1R_DRC_ENA_WIDTH 1 /* AIF1ADC1R_DRC_ENA */ | ||
| 2790 | |||
| 2791 | /* | ||
| 2792 | * R1089 (0x441) - AIF1 DRC1 (2) | ||
| 2793 | */ | ||
| 2794 | #define WM8994_AIF1DRC1_ATK_MASK 0x1E00 /* AIF1DRC1_ATK - [12:9] */ | ||
| 2795 | #define WM8994_AIF1DRC1_ATK_SHIFT 9 /* AIF1DRC1_ATK - [12:9] */ | ||
| 2796 | #define WM8994_AIF1DRC1_ATK_WIDTH 4 /* AIF1DRC1_ATK - [12:9] */ | ||
| 2797 | #define WM8994_AIF1DRC1_DCY_MASK 0x01E0 /* AIF1DRC1_DCY - [8:5] */ | ||
| 2798 | #define WM8994_AIF1DRC1_DCY_SHIFT 5 /* AIF1DRC1_DCY - [8:5] */ | ||
| 2799 | #define WM8994_AIF1DRC1_DCY_WIDTH 4 /* AIF1DRC1_DCY - [8:5] */ | ||
| 2800 | #define WM8994_AIF1DRC1_MINGAIN_MASK 0x001C /* AIF1DRC1_MINGAIN - [4:2] */ | ||
| 2801 | #define WM8994_AIF1DRC1_MINGAIN_SHIFT 2 /* AIF1DRC1_MINGAIN - [4:2] */ | ||
| 2802 | #define WM8994_AIF1DRC1_MINGAIN_WIDTH 3 /* AIF1DRC1_MINGAIN - [4:2] */ | ||
| 2803 | #define WM8994_AIF1DRC1_MAXGAIN_MASK 0x0003 /* AIF1DRC1_MAXGAIN - [1:0] */ | ||
| 2804 | #define WM8994_AIF1DRC1_MAXGAIN_SHIFT 0 /* AIF1DRC1_MAXGAIN - [1:0] */ | ||
| 2805 | #define WM8994_AIF1DRC1_MAXGAIN_WIDTH 2 /* AIF1DRC1_MAXGAIN - [1:0] */ | ||
| 2806 | |||
| 2807 | /* | ||
| 2808 | * R1090 (0x442) - AIF1 DRC1 (3) | ||
| 2809 | */ | ||
| 2810 | #define WM8994_AIF1DRC1_NG_MINGAIN_MASK 0xF000 /* AIF1DRC1_NG_MINGAIN - [15:12] */ | ||
| 2811 | #define WM8994_AIF1DRC1_NG_MINGAIN_SHIFT 12 /* AIF1DRC1_NG_MINGAIN - [15:12] */ | ||
| 2812 | #define WM8994_AIF1DRC1_NG_MINGAIN_WIDTH 4 /* AIF1DRC1_NG_MINGAIN - [15:12] */ | ||
| 2813 | #define WM8994_AIF1DRC1_NG_EXP_MASK 0x0C00 /* AIF1DRC1_NG_EXP - [11:10] */ | ||
| 2814 | #define WM8994_AIF1DRC1_NG_EXP_SHIFT 10 /* AIF1DRC1_NG_EXP - [11:10] */ | ||
| 2815 | #define WM8994_AIF1DRC1_NG_EXP_WIDTH 2 /* AIF1DRC1_NG_EXP - [11:10] */ | ||
| 2816 | #define WM8994_AIF1DRC1_QR_THR_MASK 0x0300 /* AIF1DRC1_QR_THR - [9:8] */ | ||
| 2817 | #define WM8994_AIF1DRC1_QR_THR_SHIFT 8 /* AIF1DRC1_QR_THR - [9:8] */ | ||
| 2818 | #define WM8994_AIF1DRC1_QR_THR_WIDTH 2 /* AIF1DRC1_QR_THR - [9:8] */ | ||
| 2819 | #define WM8994_AIF1DRC1_QR_DCY_MASK 0x00C0 /* AIF1DRC1_QR_DCY - [7:6] */ | ||
| 2820 | #define WM8994_AIF1DRC1_QR_DCY_SHIFT 6 /* AIF1DRC1_QR_DCY - [7:6] */ | ||
| 2821 | #define WM8994_AIF1DRC1_QR_DCY_WIDTH 2 /* AIF1DRC1_QR_DCY - [7:6] */ | ||
| 2822 | #define WM8994_AIF1DRC1_HI_COMP_MASK 0x0038 /* AIF1DRC1_HI_COMP - [5:3] */ | ||
| 2823 | #define WM8994_AIF1DRC1_HI_COMP_SHIFT 3 /* AIF1DRC1_HI_COMP - [5:3] */ | ||
| 2824 | #define WM8994_AIF1DRC1_HI_COMP_WIDTH 3 /* AIF1DRC1_HI_COMP - [5:3] */ | ||
| 2825 | #define WM8994_AIF1DRC1_LO_COMP_MASK 0x0007 /* AIF1DRC1_LO_COMP - [2:0] */ | ||
| 2826 | #define WM8994_AIF1DRC1_LO_COMP_SHIFT 0 /* AIF1DRC1_LO_COMP - [2:0] */ | ||
| 2827 | #define WM8994_AIF1DRC1_LO_COMP_WIDTH 3 /* AIF1DRC1_LO_COMP - [2:0] */ | ||
| 2828 | |||
| 2829 | /* | ||
| 2830 | * R1091 (0x443) - AIF1 DRC1 (4) | ||
| 2831 | */ | ||
| 2832 | #define WM8994_AIF1DRC1_KNEE_IP_MASK 0x07E0 /* AIF1DRC1_KNEE_IP - [10:5] */ | ||
| 2833 | #define WM8994_AIF1DRC1_KNEE_IP_SHIFT 5 /* AIF1DRC1_KNEE_IP - [10:5] */ | ||
| 2834 | #define WM8994_AIF1DRC1_KNEE_IP_WIDTH 6 /* AIF1DRC1_KNEE_IP - [10:5] */ | ||
| 2835 | #define WM8994_AIF1DRC1_KNEE_OP_MASK 0x001F /* AIF1DRC1_KNEE_OP - [4:0] */ | ||
| 2836 | #define WM8994_AIF1DRC1_KNEE_OP_SHIFT 0 /* AIF1DRC1_KNEE_OP - [4:0] */ | ||
| 2837 | #define WM8994_AIF1DRC1_KNEE_OP_WIDTH 5 /* AIF1DRC1_KNEE_OP - [4:0] */ | ||
| 2838 | |||
| 2839 | /* | ||
| 2840 | * R1092 (0x444) - AIF1 DRC1 (5) | ||
| 2841 | */ | ||
| 2842 | #define WM8994_AIF1DRC1_KNEE2_IP_MASK 0x03E0 /* AIF1DRC1_KNEE2_IP - [9:5] */ | ||
| 2843 | #define WM8994_AIF1DRC1_KNEE2_IP_SHIFT 5 /* AIF1DRC1_KNEE2_IP - [9:5] */ | ||
| 2844 | #define WM8994_AIF1DRC1_KNEE2_IP_WIDTH 5 /* AIF1DRC1_KNEE2_IP - [9:5] */ | ||
| 2845 | #define WM8994_AIF1DRC1_KNEE2_OP_MASK 0x001F /* AIF1DRC1_KNEE2_OP - [4:0] */ | ||
| 2846 | #define WM8994_AIF1DRC1_KNEE2_OP_SHIFT 0 /* AIF1DRC1_KNEE2_OP - [4:0] */ | ||
| 2847 | #define WM8994_AIF1DRC1_KNEE2_OP_WIDTH 5 /* AIF1DRC1_KNEE2_OP - [4:0] */ | ||
| 2848 | |||
| 2849 | /* | ||
| 2850 | * R1104 (0x450) - AIF1 DRC2 (1) | ||
| 2851 | */ | ||
| 2852 | #define WM8994_AIF1DRC2_SIG_DET_RMS_MASK 0xF800 /* AIF1DRC2_SIG_DET_RMS - [15:11] */ | ||
| 2853 | #define WM8994_AIF1DRC2_SIG_DET_RMS_SHIFT 11 /* AIF1DRC2_SIG_DET_RMS - [15:11] */ | ||
| 2854 | #define WM8994_AIF1DRC2_SIG_DET_RMS_WIDTH 5 /* AIF1DRC2_SIG_DET_RMS - [15:11] */ | ||
| 2855 | #define WM8994_AIF1DRC2_SIG_DET_PK_MASK 0x0600 /* AIF1DRC2_SIG_DET_PK - [10:9] */ | ||
| 2856 | #define WM8994_AIF1DRC2_SIG_DET_PK_SHIFT 9 /* AIF1DRC2_SIG_DET_PK - [10:9] */ | ||
| 2857 | #define WM8994_AIF1DRC2_SIG_DET_PK_WIDTH 2 /* AIF1DRC2_SIG_DET_PK - [10:9] */ | ||
| 2858 | #define WM8994_AIF1DRC2_NG_ENA 0x0100 /* AIF1DRC2_NG_ENA */ | ||
| 2859 | #define WM8994_AIF1DRC2_NG_ENA_MASK 0x0100 /* AIF1DRC2_NG_ENA */ | ||
| 2860 | #define WM8994_AIF1DRC2_NG_ENA_SHIFT 8 /* AIF1DRC2_NG_ENA */ | ||
| 2861 | #define WM8994_AIF1DRC2_NG_ENA_WIDTH 1 /* AIF1DRC2_NG_ENA */ | ||
| 2862 | #define WM8994_AIF1DRC2_SIG_DET_MODE 0x0080 /* AIF1DRC2_SIG_DET_MODE */ | ||
| 2863 | #define WM8994_AIF1DRC2_SIG_DET_MODE_MASK 0x0080 /* AIF1DRC2_SIG_DET_MODE */ | ||
| 2864 | #define WM8994_AIF1DRC2_SIG_DET_MODE_SHIFT 7 /* AIF1DRC2_SIG_DET_MODE */ | ||
| 2865 | #define WM8994_AIF1DRC2_SIG_DET_MODE_WIDTH 1 /* AIF1DRC2_SIG_DET_MODE */ | ||
| 2866 | #define WM8994_AIF1DRC2_SIG_DET 0x0040 /* AIF1DRC2_SIG_DET */ | ||
| 2867 | #define WM8994_AIF1DRC2_SIG_DET_MASK 0x0040 /* AIF1DRC2_SIG_DET */ | ||
| 2868 | #define WM8994_AIF1DRC2_SIG_DET_SHIFT 6 /* AIF1DRC2_SIG_DET */ | ||
| 2869 | #define WM8994_AIF1DRC2_SIG_DET_WIDTH 1 /* AIF1DRC2_SIG_DET */ | ||
| 2870 | #define WM8994_AIF1DRC2_KNEE2_OP_ENA 0x0020 /* AIF1DRC2_KNEE2_OP_ENA */ | ||
| 2871 | #define WM8994_AIF1DRC2_KNEE2_OP_ENA_MASK 0x0020 /* AIF1DRC2_KNEE2_OP_ENA */ | ||
| 2872 | #define WM8994_AIF1DRC2_KNEE2_OP_ENA_SHIFT 5 /* AIF1DRC2_KNEE2_OP_ENA */ | ||
| 2873 | #define WM8994_AIF1DRC2_KNEE2_OP_ENA_WIDTH 1 /* AIF1DRC2_KNEE2_OP_ENA */ | ||
| 2874 | #define WM8994_AIF1DRC2_QR 0x0010 /* AIF1DRC2_QR */ | ||
| 2875 | #define WM8994_AIF1DRC2_QR_MASK 0x0010 /* AIF1DRC2_QR */ | ||
| 2876 | #define WM8994_AIF1DRC2_QR_SHIFT 4 /* AIF1DRC2_QR */ | ||
| 2877 | #define WM8994_AIF1DRC2_QR_WIDTH 1 /* AIF1DRC2_QR */ | ||
| 2878 | #define WM8994_AIF1DRC2_ANTICLIP 0x0008 /* AIF1DRC2_ANTICLIP */ | ||
| 2879 | #define WM8994_AIF1DRC2_ANTICLIP_MASK 0x0008 /* AIF1DRC2_ANTICLIP */ | ||
| 2880 | #define WM8994_AIF1DRC2_ANTICLIP_SHIFT 3 /* AIF1DRC2_ANTICLIP */ | ||
| 2881 | #define WM8994_AIF1DRC2_ANTICLIP_WIDTH 1 /* AIF1DRC2_ANTICLIP */ | ||
| 2882 | #define WM8994_AIF1DAC2_DRC_ENA 0x0004 /* AIF1DAC2_DRC_ENA */ | ||
| 2883 | #define WM8994_AIF1DAC2_DRC_ENA_MASK 0x0004 /* AIF1DAC2_DRC_ENA */ | ||
| 2884 | #define WM8994_AIF1DAC2_DRC_ENA_SHIFT 2 /* AIF1DAC2_DRC_ENA */ | ||
| 2885 | #define WM8994_AIF1DAC2_DRC_ENA_WIDTH 1 /* AIF1DAC2_DRC_ENA */ | ||
| 2886 | #define WM8994_AIF1ADC2L_DRC_ENA 0x0002 /* AIF1ADC2L_DRC_ENA */ | ||
| 2887 | #define WM8994_AIF1ADC2L_DRC_ENA_MASK 0x0002 /* AIF1ADC2L_DRC_ENA */ | ||
| 2888 | #define WM8994_AIF1ADC2L_DRC_ENA_SHIFT 1 /* AIF1ADC2L_DRC_ENA */ | ||
| 2889 | #define WM8994_AIF1ADC2L_DRC_ENA_WIDTH 1 /* AIF1ADC2L_DRC_ENA */ | ||
| 2890 | #define WM8994_AIF1ADC2R_DRC_ENA 0x0001 /* AIF1ADC2R_DRC_ENA */ | ||
| 2891 | #define WM8994_AIF1ADC2R_DRC_ENA_MASK 0x0001 /* AIF1ADC2R_DRC_ENA */ | ||
| 2892 | #define WM8994_AIF1ADC2R_DRC_ENA_SHIFT 0 /* AIF1ADC2R_DRC_ENA */ | ||
| 2893 | #define WM8994_AIF1ADC2R_DRC_ENA_WIDTH 1 /* AIF1ADC2R_DRC_ENA */ | ||
| 2894 | |||
| 2895 | /* | ||
| 2896 | * R1105 (0x451) - AIF1 DRC2 (2) | ||
| 2897 | */ | ||
| 2898 | #define WM8994_AIF1DRC2_ATK_MASK 0x1E00 /* AIF1DRC2_ATK - [12:9] */ | ||
| 2899 | #define WM8994_AIF1DRC2_ATK_SHIFT 9 /* AIF1DRC2_ATK - [12:9] */ | ||
| 2900 | #define WM8994_AIF1DRC2_ATK_WIDTH 4 /* AIF1DRC2_ATK - [12:9] */ | ||
| 2901 | #define WM8994_AIF1DRC2_DCY_MASK 0x01E0 /* AIF1DRC2_DCY - [8:5] */ | ||
| 2902 | #define WM8994_AIF1DRC2_DCY_SHIFT 5 /* AIF1DRC2_DCY - [8:5] */ | ||
| 2903 | #define WM8994_AIF1DRC2_DCY_WIDTH 4 /* AIF1DRC2_DCY - [8:5] */ | ||
| 2904 | #define WM8994_AIF1DRC2_MINGAIN_MASK 0x001C /* AIF1DRC2_MINGAIN - [4:2] */ | ||
| 2905 | #define WM8994_AIF1DRC2_MINGAIN_SHIFT 2 /* AIF1DRC2_MINGAIN - [4:2] */ | ||
| 2906 | #define WM8994_AIF1DRC2_MINGAIN_WIDTH 3 /* AIF1DRC2_MINGAIN - [4:2] */ | ||
| 2907 | #define WM8994_AIF1DRC2_MAXGAIN_MASK 0x0003 /* AIF1DRC2_MAXGAIN - [1:0] */ | ||
| 2908 | #define WM8994_AIF1DRC2_MAXGAIN_SHIFT 0 /* AIF1DRC2_MAXGAIN - [1:0] */ | ||
| 2909 | #define WM8994_AIF1DRC2_MAXGAIN_WIDTH 2 /* AIF1DRC2_MAXGAIN - [1:0] */ | ||
| 2910 | |||
| 2911 | /* | ||
| 2912 | * R1106 (0x452) - AIF1 DRC2 (3) | ||
| 2913 | */ | ||
| 2914 | #define WM8994_AIF1DRC2_NG_MINGAIN_MASK 0xF000 /* AIF1DRC2_NG_MINGAIN - [15:12] */ | ||
| 2915 | #define WM8994_AIF1DRC2_NG_MINGAIN_SHIFT 12 /* AIF1DRC2_NG_MINGAIN - [15:12] */ | ||
| 2916 | #define WM8994_AIF1DRC2_NG_MINGAIN_WIDTH 4 /* AIF1DRC2_NG_MINGAIN - [15:12] */ | ||
| 2917 | #define WM8994_AIF1DRC2_NG_EXP_MASK 0x0C00 /* AIF1DRC2_NG_EXP - [11:10] */ | ||
| 2918 | #define WM8994_AIF1DRC2_NG_EXP_SHIFT 10 /* AIF1DRC2_NG_EXP - [11:10] */ | ||
| 2919 | #define WM8994_AIF1DRC2_NG_EXP_WIDTH 2 /* AIF1DRC2_NG_EXP - [11:10] */ | ||
| 2920 | #define WM8994_AIF1DRC2_QR_THR_MASK 0x0300 /* AIF1DRC2_QR_THR - [9:8] */ | ||
| 2921 | #define WM8994_AIF1DRC2_QR_THR_SHIFT 8 /* AIF1DRC2_QR_THR - [9:8] */ | ||
| 2922 | #define WM8994_AIF1DRC2_QR_THR_WIDTH 2 /* AIF1DRC2_QR_THR - [9:8] */ | ||
| 2923 | #define WM8994_AIF1DRC2_QR_DCY_MASK 0x00C0 /* AIF1DRC2_QR_DCY - [7:6] */ | ||
| 2924 | #define WM8994_AIF1DRC2_QR_DCY_SHIFT 6 /* AIF1DRC2_QR_DCY - [7:6] */ | ||
| 2925 | #define WM8994_AIF1DRC2_QR_DCY_WIDTH 2 /* AIF1DRC2_QR_DCY - [7:6] */ | ||
| 2926 | #define WM8994_AIF1DRC2_HI_COMP_MASK 0x0038 /* AIF1DRC2_HI_COMP - [5:3] */ | ||
| 2927 | #define WM8994_AIF1DRC2_HI_COMP_SHIFT 3 /* AIF1DRC2_HI_COMP - [5:3] */ | ||
| 2928 | #define WM8994_AIF1DRC2_HI_COMP_WIDTH 3 /* AIF1DRC2_HI_COMP - [5:3] */ | ||
| 2929 | #define WM8994_AIF1DRC2_LO_COMP_MASK 0x0007 /* AIF1DRC2_LO_COMP - [2:0] */ | ||
| 2930 | #define WM8994_AIF1DRC2_LO_COMP_SHIFT 0 /* AIF1DRC2_LO_COMP - [2:0] */ | ||
| 2931 | #define WM8994_AIF1DRC2_LO_COMP_WIDTH 3 /* AIF1DRC2_LO_COMP - [2:0] */ | ||
| 2932 | |||
| 2933 | /* | ||
| 2934 | * R1107 (0x453) - AIF1 DRC2 (4) | ||
| 2935 | */ | ||
| 2936 | #define WM8994_AIF1DRC2_KNEE_IP_MASK 0x07E0 /* AIF1DRC2_KNEE_IP - [10:5] */ | ||
| 2937 | #define WM8994_AIF1DRC2_KNEE_IP_SHIFT 5 /* AIF1DRC2_KNEE_IP - [10:5] */ | ||
| 2938 | #define WM8994_AIF1DRC2_KNEE_IP_WIDTH 6 /* AIF1DRC2_KNEE_IP - [10:5] */ | ||
| 2939 | #define WM8994_AIF1DRC2_KNEE_OP_MASK 0x001F /* AIF1DRC2_KNEE_OP - [4:0] */ | ||
| 2940 | #define WM8994_AIF1DRC2_KNEE_OP_SHIFT 0 /* AIF1DRC2_KNEE_OP - [4:0] */ | ||
| 2941 | #define WM8994_AIF1DRC2_KNEE_OP_WIDTH 5 /* AIF1DRC2_KNEE_OP - [4:0] */ | ||
| 2942 | |||
| 2943 | /* | ||
| 2944 | * R1108 (0x454) - AIF1 DRC2 (5) | ||
| 2945 | */ | ||
| 2946 | #define WM8994_AIF1DRC2_KNEE2_IP_MASK 0x03E0 /* AIF1DRC2_KNEE2_IP - [9:5] */ | ||
| 2947 | #define WM8994_AIF1DRC2_KNEE2_IP_SHIFT 5 /* AIF1DRC2_KNEE2_IP - [9:5] */ | ||
| 2948 | #define WM8994_AIF1DRC2_KNEE2_IP_WIDTH 5 /* AIF1DRC2_KNEE2_IP - [9:5] */ | ||
| 2949 | #define WM8994_AIF1DRC2_KNEE2_OP_MASK 0x001F /* AIF1DRC2_KNEE2_OP - [4:0] */ | ||
| 2950 | #define WM8994_AIF1DRC2_KNEE2_OP_SHIFT 0 /* AIF1DRC2_KNEE2_OP - [4:0] */ | ||
| 2951 | #define WM8994_AIF1DRC2_KNEE2_OP_WIDTH 5 /* AIF1DRC2_KNEE2_OP - [4:0] */ | ||
| 2952 | |||
| 2953 | /* | ||
| 2954 | * R1152 (0x480) - AIF1 DAC1 EQ Gains (1) | ||
| 2955 | */ | ||
| 2956 | #define WM8994_AIF1DAC1_EQ_B1_GAIN_MASK 0xF800 /* AIF1DAC1_EQ_B1_GAIN - [15:11] */ | ||
| 2957 | #define WM8994_AIF1DAC1_EQ_B1_GAIN_SHIFT 11 /* AIF1DAC1_EQ_B1_GAIN - [15:11] */ | ||
| 2958 | #define WM8994_AIF1DAC1_EQ_B1_GAIN_WIDTH 5 /* AIF1DAC1_EQ_B1_GAIN - [15:11] */ | ||
| 2959 | #define WM8994_AIF1DAC1_EQ_B2_GAIN_MASK 0x07C0 /* AIF1DAC1_EQ_B2_GAIN - [10:6] */ | ||
| 2960 | #define WM8994_AIF1DAC1_EQ_B2_GAIN_SHIFT 6 /* AIF1DAC1_EQ_B2_GAIN - [10:6] */ | ||
| 2961 | #define WM8994_AIF1DAC1_EQ_B2_GAIN_WIDTH 5 /* AIF1DAC1_EQ_B2_GAIN - [10:6] */ | ||
| 2962 | #define WM8994_AIF1DAC1_EQ_B3_GAIN_MASK 0x003E /* AIF1DAC1_EQ_B3_GAIN - [5:1] */ | ||
| 2963 | #define WM8994_AIF1DAC1_EQ_B3_GAIN_SHIFT 1 /* AIF1DAC1_EQ_B3_GAIN - [5:1] */ | ||
| 2964 | #define WM8994_AIF1DAC1_EQ_B3_GAIN_WIDTH 5 /* AIF1DAC1_EQ_B3_GAIN - [5:1] */ | ||
| 2965 | #define WM8994_AIF1DAC1_EQ_ENA 0x0001 /* AIF1DAC1_EQ_ENA */ | ||
| 2966 | #define WM8994_AIF1DAC1_EQ_ENA_MASK 0x0001 /* AIF1DAC1_EQ_ENA */ | ||
| 2967 | #define WM8994_AIF1DAC1_EQ_ENA_SHIFT 0 /* AIF1DAC1_EQ_ENA */ | ||
| 2968 | #define WM8994_AIF1DAC1_EQ_ENA_WIDTH 1 /* AIF1DAC1_EQ_ENA */ | ||
| 2969 | |||
| 2970 | /* | ||
| 2971 | * R1153 (0x481) - AIF1 DAC1 EQ Gains (2) | ||
| 2972 | */ | ||
| 2973 | #define WM8994_AIF1DAC1_EQ_B4_GAIN_MASK 0xF800 /* AIF1DAC1_EQ_B4_GAIN - [15:11] */ | ||
| 2974 | #define WM8994_AIF1DAC1_EQ_B4_GAIN_SHIFT 11 /* AIF1DAC1_EQ_B4_GAIN - [15:11] */ | ||
| 2975 | #define WM8994_AIF1DAC1_EQ_B4_GAIN_WIDTH 5 /* AIF1DAC1_EQ_B4_GAIN - [15:11] */ | ||
| 2976 | #define WM8994_AIF1DAC1_EQ_B5_GAIN_MASK 0x07C0 /* AIF1DAC1_EQ_B5_GAIN - [10:6] */ | ||
| 2977 | #define WM8994_AIF1DAC1_EQ_B5_GAIN_SHIFT 6 /* AIF1DAC1_EQ_B5_GAIN - [10:6] */ | ||
| 2978 | #define WM8994_AIF1DAC1_EQ_B5_GAIN_WIDTH 5 /* AIF1DAC1_EQ_B5_GAIN - [10:6] */ | ||
| 2979 | |||
| 2980 | /* | ||
| 2981 | * R1154 (0x482) - AIF1 DAC1 EQ Band 1 A | ||
| 2982 | */ | ||
| 2983 | #define WM8994_AIF1DAC1_EQ_B1_A_MASK 0xFFFF /* AIF1DAC1_EQ_B1_A - [15:0] */ | ||
| 2984 | #define WM8994_AIF1DAC1_EQ_B1_A_SHIFT 0 /* AIF1DAC1_EQ_B1_A - [15:0] */ | ||
| 2985 | #define WM8994_AIF1DAC1_EQ_B1_A_WIDTH 16 /* AIF1DAC1_EQ_B1_A - [15:0] */ | ||
| 2986 | |||
| 2987 | /* | ||
| 2988 | * R1155 (0x483) - AIF1 DAC1 EQ Band 1 B | ||
| 2989 | */ | ||
| 2990 | #define WM8994_AIF1DAC1_EQ_B1_B_MASK 0xFFFF /* AIF1DAC1_EQ_B1_B - [15:0] */ | ||
| 2991 | #define WM8994_AIF1DAC1_EQ_B1_B_SHIFT 0 /* AIF1DAC1_EQ_B1_B - [15:0] */ | ||
| 2992 | #define WM8994_AIF1DAC1_EQ_B1_B_WIDTH 16 /* AIF1DAC1_EQ_B1_B - [15:0] */ | ||
| 2993 | |||
| 2994 | /* | ||
| 2995 | * R1156 (0x484) - AIF1 DAC1 EQ Band 1 PG | ||
| 2996 | */ | ||
| 2997 | #define WM8994_AIF1DAC1_EQ_B1_PG_MASK 0xFFFF /* AIF1DAC1_EQ_B1_PG - [15:0] */ | ||
| 2998 | #define WM8994_AIF1DAC1_EQ_B1_PG_SHIFT 0 /* AIF1DAC1_EQ_B1_PG - [15:0] */ | ||
| 2999 | #define WM8994_AIF1DAC1_EQ_B1_PG_WIDTH 16 /* AIF1DAC1_EQ_B1_PG - [15:0] */ | ||
| 3000 | |||
| 3001 | /* | ||
| 3002 | * R1157 (0x485) - AIF1 DAC1 EQ Band 2 A | ||
| 3003 | */ | ||
| 3004 | #define WM8994_AIF1DAC1_EQ_B2_A_MASK 0xFFFF /* AIF1DAC1_EQ_B2_A - [15:0] */ | ||
| 3005 | #define WM8994_AIF1DAC1_EQ_B2_A_SHIFT 0 /* AIF1DAC1_EQ_B2_A - [15:0] */ | ||
| 3006 | #define WM8994_AIF1DAC1_EQ_B2_A_WIDTH 16 /* AIF1DAC1_EQ_B2_A - [15:0] */ | ||
| 3007 | |||
| 3008 | /* | ||
| 3009 | * R1158 (0x486) - AIF1 DAC1 EQ Band 2 B | ||
| 3010 | */ | ||
| 3011 | #define WM8994_AIF1DAC1_EQ_B2_B_MASK 0xFFFF /* AIF1DAC1_EQ_B2_B - [15:0] */ | ||
| 3012 | #define WM8994_AIF1DAC1_EQ_B2_B_SHIFT 0 /* AIF1DAC1_EQ_B2_B - [15:0] */ | ||
| 3013 | #define WM8994_AIF1DAC1_EQ_B2_B_WIDTH 16 /* AIF1DAC1_EQ_B2_B - [15:0] */ | ||
| 3014 | |||
| 3015 | /* | ||
| 3016 | * R1159 (0x487) - AIF1 DAC1 EQ Band 2 C | ||
| 3017 | */ | ||
| 3018 | #define WM8994_AIF1DAC1_EQ_B2_C_MASK 0xFFFF /* AIF1DAC1_EQ_B2_C - [15:0] */ | ||
| 3019 | #define WM8994_AIF1DAC1_EQ_B2_C_SHIFT 0 /* AIF1DAC1_EQ_B2_C - [15:0] */ | ||
| 3020 | #define WM8994_AIF1DAC1_EQ_B2_C_WIDTH 16 /* AIF1DAC1_EQ_B2_C - [15:0] */ | ||
| 3021 | |||
| 3022 | /* | ||
| 3023 | * R1160 (0x488) - AIF1 DAC1 EQ Band 2 PG | ||
| 3024 | */ | ||
| 3025 | #define WM8994_AIF1DAC1_EQ_B2_PG_MASK 0xFFFF /* AIF1DAC1_EQ_B2_PG - [15:0] */ | ||
| 3026 | #define WM8994_AIF1DAC1_EQ_B2_PG_SHIFT 0 /* AIF1DAC1_EQ_B2_PG - [15:0] */ | ||
| 3027 | #define WM8994_AIF1DAC1_EQ_B2_PG_WIDTH 16 /* AIF1DAC1_EQ_B2_PG - [15:0] */ | ||
| 3028 | |||
| 3029 | /* | ||
| 3030 | * R1161 (0x489) - AIF1 DAC1 EQ Band 3 A | ||
| 3031 | */ | ||
| 3032 | #define WM8994_AIF1DAC1_EQ_B3_A_MASK 0xFFFF /* AIF1DAC1_EQ_B3_A - [15:0] */ | ||
| 3033 | #define WM8994_AIF1DAC1_EQ_B3_A_SHIFT 0 /* AIF1DAC1_EQ_B3_A - [15:0] */ | ||
| 3034 | #define WM8994_AIF1DAC1_EQ_B3_A_WIDTH 16 /* AIF1DAC1_EQ_B3_A - [15:0] */ | ||
| 3035 | |||
| 3036 | /* | ||
| 3037 | * R1162 (0x48A) - AIF1 DAC1 EQ Band 3 B | ||
| 3038 | */ | ||
| 3039 | #define WM8994_AIF1DAC1_EQ_B3_B_MASK 0xFFFF /* AIF1DAC1_EQ_B3_B - [15:0] */ | ||
| 3040 | #define WM8994_AIF1DAC1_EQ_B3_B_SHIFT 0 /* AIF1DAC1_EQ_B3_B - [15:0] */ | ||
| 3041 | #define WM8994_AIF1DAC1_EQ_B3_B_WIDTH 16 /* AIF1DAC1_EQ_B3_B - [15:0] */ | ||
| 3042 | |||
| 3043 | /* | ||
| 3044 | * R1163 (0x48B) - AIF1 DAC1 EQ Band 3 C | ||
| 3045 | */ | ||
| 3046 | #define WM8994_AIF1DAC1_EQ_B3_C_MASK 0xFFFF /* AIF1DAC1_EQ_B3_C - [15:0] */ | ||
| 3047 | #define WM8994_AIF1DAC1_EQ_B3_C_SHIFT 0 /* AIF1DAC1_EQ_B3_C - [15:0] */ | ||
| 3048 | #define WM8994_AIF1DAC1_EQ_B3_C_WIDTH 16 /* AIF1DAC1_EQ_B3_C - [15:0] */ | ||
| 3049 | |||
| 3050 | /* | ||
| 3051 | * R1164 (0x48C) - AIF1 DAC1 EQ Band 3 PG | ||
| 3052 | */ | ||
| 3053 | #define WM8994_AIF1DAC1_EQ_B3_PG_MASK 0xFFFF /* AIF1DAC1_EQ_B3_PG - [15:0] */ | ||
| 3054 | #define WM8994_AIF1DAC1_EQ_B3_PG_SHIFT 0 /* AIF1DAC1_EQ_B3_PG - [15:0] */ | ||
| 3055 | #define WM8994_AIF1DAC1_EQ_B3_PG_WIDTH 16 /* AIF1DAC1_EQ_B3_PG - [15:0] */ | ||
| 3056 | |||
| 3057 | /* | ||
| 3058 | * R1165 (0x48D) - AIF1 DAC1 EQ Band 4 A | ||
| 3059 | */ | ||
| 3060 | #define WM8994_AIF1DAC1_EQ_B4_A_MASK 0xFFFF /* AIF1DAC1_EQ_B4_A - [15:0] */ | ||
| 3061 | #define WM8994_AIF1DAC1_EQ_B4_A_SHIFT 0 /* AIF1DAC1_EQ_B4_A - [15:0] */ | ||
| 3062 | #define WM8994_AIF1DAC1_EQ_B4_A_WIDTH 16 /* AIF1DAC1_EQ_B4_A - [15:0] */ | ||
| 3063 | |||
| 3064 | /* | ||
| 3065 | * R1166 (0x48E) - AIF1 DAC1 EQ Band 4 B | ||
| 3066 | */ | ||
| 3067 | #define WM8994_AIF1DAC1_EQ_B4_B_MASK 0xFFFF /* AIF1DAC1_EQ_B4_B - [15:0] */ | ||
| 3068 | #define WM8994_AIF1DAC1_EQ_B4_B_SHIFT 0 /* AIF1DAC1_EQ_B4_B - [15:0] */ | ||
| 3069 | #define WM8994_AIF1DAC1_EQ_B4_B_WIDTH 16 /* AIF1DAC1_EQ_B4_B - [15:0] */ | ||
| 3070 | |||
| 3071 | /* | ||
| 3072 | * R1167 (0x48F) - AIF1 DAC1 EQ Band 4 C | ||
| 3073 | */ | ||
| 3074 | #define WM8994_AIF1DAC1_EQ_B4_C_MASK 0xFFFF /* AIF1DAC1_EQ_B4_C - [15:0] */ | ||
| 3075 | #define WM8994_AIF1DAC1_EQ_B4_C_SHIFT 0 /* AIF1DAC1_EQ_B4_C - [15:0] */ | ||
| 3076 | #define WM8994_AIF1DAC1_EQ_B4_C_WIDTH 16 /* AIF1DAC1_EQ_B4_C - [15:0] */ | ||
| 3077 | |||
| 3078 | /* | ||
| 3079 | * R1168 (0x490) - AIF1 DAC1 EQ Band 4 PG | ||
| 3080 | */ | ||
| 3081 | #define WM8994_AIF1DAC1_EQ_B4_PG_MASK 0xFFFF /* AIF1DAC1_EQ_B4_PG - [15:0] */ | ||
| 3082 | #define WM8994_AIF1DAC1_EQ_B4_PG_SHIFT 0 /* AIF1DAC1_EQ_B4_PG - [15:0] */ | ||
| 3083 | #define WM8994_AIF1DAC1_EQ_B4_PG_WIDTH 16 /* AIF1DAC1_EQ_B4_PG - [15:0] */ | ||
| 3084 | |||
| 3085 | /* | ||
| 3086 | * R1169 (0x491) - AIF1 DAC1 EQ Band 5 A | ||
| 3087 | */ | ||
| 3088 | #define WM8994_AIF1DAC1_EQ_B5_A_MASK 0xFFFF /* AIF1DAC1_EQ_B5_A - [15:0] */ | ||
| 3089 | #define WM8994_AIF1DAC1_EQ_B5_A_SHIFT 0 /* AIF1DAC1_EQ_B5_A - [15:0] */ | ||
| 3090 | #define WM8994_AIF1DAC1_EQ_B5_A_WIDTH 16 /* AIF1DAC1_EQ_B5_A - [15:0] */ | ||
| 3091 | |||
| 3092 | /* | ||
| 3093 | * R1170 (0x492) - AIF1 DAC1 EQ Band 5 B | ||
| 3094 | */ | ||
| 3095 | #define WM8994_AIF1DAC1_EQ_B5_B_MASK 0xFFFF /* AIF1DAC1_EQ_B5_B - [15:0] */ | ||
| 3096 | #define WM8994_AIF1DAC1_EQ_B5_B_SHIFT 0 /* AIF1DAC1_EQ_B5_B - [15:0] */ | ||
| 3097 | #define WM8994_AIF1DAC1_EQ_B5_B_WIDTH 16 /* AIF1DAC1_EQ_B5_B - [15:0] */ | ||
| 3098 | |||
| 3099 | /* | ||
| 3100 | * R1171 (0x493) - AIF1 DAC1 EQ Band 5 PG | ||
| 3101 | */ | ||
| 3102 | #define WM8994_AIF1DAC1_EQ_B5_PG_MASK 0xFFFF /* AIF1DAC1_EQ_B5_PG - [15:0] */ | ||
| 3103 | #define WM8994_AIF1DAC1_EQ_B5_PG_SHIFT 0 /* AIF1DAC1_EQ_B5_PG - [15:0] */ | ||
| 3104 | #define WM8994_AIF1DAC1_EQ_B5_PG_WIDTH 16 /* AIF1DAC1_EQ_B5_PG - [15:0] */ | ||
| 3105 | |||
| 3106 | /* | ||
| 3107 | * R1184 (0x4A0) - AIF1 DAC2 EQ Gains (1) | ||
| 3108 | */ | ||
| 3109 | #define WM8994_AIF1DAC2_EQ_B1_GAIN_MASK 0xF800 /* AIF1DAC2_EQ_B1_GAIN - [15:11] */ | ||
| 3110 | #define WM8994_AIF1DAC2_EQ_B1_GAIN_SHIFT 11 /* AIF1DAC2_EQ_B1_GAIN - [15:11] */ | ||
| 3111 | #define WM8994_AIF1DAC2_EQ_B1_GAIN_WIDTH 5 /* AIF1DAC2_EQ_B1_GAIN - [15:11] */ | ||
| 3112 | #define WM8994_AIF1DAC2_EQ_B2_GAIN_MASK 0x07C0 /* AIF1DAC2_EQ_B2_GAIN - [10:6] */ | ||
| 3113 | #define WM8994_AIF1DAC2_EQ_B2_GAIN_SHIFT 6 /* AIF1DAC2_EQ_B2_GAIN - [10:6] */ | ||
| 3114 | #define WM8994_AIF1DAC2_EQ_B2_GAIN_WIDTH 5 /* AIF1DAC2_EQ_B2_GAIN - [10:6] */ | ||
| 3115 | #define WM8994_AIF1DAC2_EQ_B3_GAIN_MASK 0x003E /* AIF1DAC2_EQ_B3_GAIN - [5:1] */ | ||
| 3116 | #define WM8994_AIF1DAC2_EQ_B3_GAIN_SHIFT 1 /* AIF1DAC2_EQ_B3_GAIN - [5:1] */ | ||
| 3117 | #define WM8994_AIF1DAC2_EQ_B3_GAIN_WIDTH 5 /* AIF1DAC2_EQ_B3_GAIN - [5:1] */ | ||
| 3118 | #define WM8994_AIF1DAC2_EQ_ENA 0x0001 /* AIF1DAC2_EQ_ENA */ | ||
| 3119 | #define WM8994_AIF1DAC2_EQ_ENA_MASK 0x0001 /* AIF1DAC2_EQ_ENA */ | ||
| 3120 | #define WM8994_AIF1DAC2_EQ_ENA_SHIFT 0 /* AIF1DAC2_EQ_ENA */ | ||
| 3121 | #define WM8994_AIF1DAC2_EQ_ENA_WIDTH 1 /* AIF1DAC2_EQ_ENA */ | ||
| 3122 | |||
| 3123 | /* | ||
| 3124 | * R1185 (0x4A1) - AIF1 DAC2 EQ Gains (2) | ||
| 3125 | */ | ||
| 3126 | #define WM8994_AIF1DAC2_EQ_B4_GAIN_MASK 0xF800 /* AIF1DAC2_EQ_B4_GAIN - [15:11] */ | ||
| 3127 | #define WM8994_AIF1DAC2_EQ_B4_GAIN_SHIFT 11 /* AIF1DAC2_EQ_B4_GAIN - [15:11] */ | ||
| 3128 | #define WM8994_AIF1DAC2_EQ_B4_GAIN_WIDTH 5 /* AIF1DAC2_EQ_B4_GAIN - [15:11] */ | ||
| 3129 | #define WM8994_AIF1DAC2_EQ_B5_GAIN_MASK 0x07C0 /* AIF1DAC2_EQ_B5_GAIN - [10:6] */ | ||
| 3130 | #define WM8994_AIF1DAC2_EQ_B5_GAIN_SHIFT 6 /* AIF1DAC2_EQ_B5_GAIN - [10:6] */ | ||
| 3131 | #define WM8994_AIF1DAC2_EQ_B5_GAIN_WIDTH 5 /* AIF1DAC2_EQ_B5_GAIN - [10:6] */ | ||
| 3132 | |||
| 3133 | /* | ||
| 3134 | * R1186 (0x4A2) - AIF1 DAC2 EQ Band 1 A | ||
| 3135 | */ | ||
| 3136 | #define WM8994_AIF1DAC2_EQ_B1_A_MASK 0xFFFF /* AIF1DAC2_EQ_B1_A - [15:0] */ | ||
| 3137 | #define WM8994_AIF1DAC2_EQ_B1_A_SHIFT 0 /* AIF1DAC2_EQ_B1_A - [15:0] */ | ||
| 3138 | #define WM8994_AIF1DAC2_EQ_B1_A_WIDTH 16 /* AIF1DAC2_EQ_B1_A - [15:0] */ | ||
| 3139 | |||
| 3140 | /* | ||
| 3141 | * R1187 (0x4A3) - AIF1 DAC2 EQ Band 1 B | ||
| 3142 | */ | ||
| 3143 | #define WM8994_AIF1DAC2_EQ_B1_B_MASK 0xFFFF /* AIF1DAC2_EQ_B1_B - [15:0] */ | ||
| 3144 | #define WM8994_AIF1DAC2_EQ_B1_B_SHIFT 0 /* AIF1DAC2_EQ_B1_B - [15:0] */ | ||
| 3145 | #define WM8994_AIF1DAC2_EQ_B1_B_WIDTH 16 /* AIF1DAC2_EQ_B1_B - [15:0] */ | ||
| 3146 | |||
| 3147 | /* | ||
| 3148 | * R1188 (0x4A4) - AIF1 DAC2 EQ Band 1 PG | ||
| 3149 | */ | ||
| 3150 | #define WM8994_AIF1DAC2_EQ_B1_PG_MASK 0xFFFF /* AIF1DAC2_EQ_B1_PG - [15:0] */ | ||
| 3151 | #define WM8994_AIF1DAC2_EQ_B1_PG_SHIFT 0 /* AIF1DAC2_EQ_B1_PG - [15:0] */ | ||
| 3152 | #define WM8994_AIF1DAC2_EQ_B1_PG_WIDTH 16 /* AIF1DAC2_EQ_B1_PG - [15:0] */ | ||
| 3153 | |||
| 3154 | /* | ||
| 3155 | * R1189 (0x4A5) - AIF1 DAC2 EQ Band 2 A | ||
| 3156 | */ | ||
| 3157 | #define WM8994_AIF1DAC2_EQ_B2_A_MASK 0xFFFF /* AIF1DAC2_EQ_B2_A - [15:0] */ | ||
| 3158 | #define WM8994_AIF1DAC2_EQ_B2_A_SHIFT 0 /* AIF1DAC2_EQ_B2_A - [15:0] */ | ||
| 3159 | #define WM8994_AIF1DAC2_EQ_B2_A_WIDTH 16 /* AIF1DAC2_EQ_B2_A - [15:0] */ | ||
| 3160 | |||
| 3161 | /* | ||
| 3162 | * R1190 (0x4A6) - AIF1 DAC2 EQ Band 2 B | ||
| 3163 | */ | ||
| 3164 | #define WM8994_AIF1DAC2_EQ_B2_B_MASK 0xFFFF /* AIF1DAC2_EQ_B2_B - [15:0] */ | ||
| 3165 | #define WM8994_AIF1DAC2_EQ_B2_B_SHIFT 0 /* AIF1DAC2_EQ_B2_B - [15:0] */ | ||
| 3166 | #define WM8994_AIF1DAC2_EQ_B2_B_WIDTH 16 /* AIF1DAC2_EQ_B2_B - [15:0] */ | ||
| 3167 | |||
| 3168 | /* | ||
| 3169 | * R1191 (0x4A7) - AIF1 DAC2 EQ Band 2 C | ||
| 3170 | */ | ||
| 3171 | #define WM8994_AIF1DAC2_EQ_B2_C_MASK 0xFFFF /* AIF1DAC2_EQ_B2_C - [15:0] */ | ||
| 3172 | #define WM8994_AIF1DAC2_EQ_B2_C_SHIFT 0 /* AIF1DAC2_EQ_B2_C - [15:0] */ | ||
| 3173 | #define WM8994_AIF1DAC2_EQ_B2_C_WIDTH 16 /* AIF1DAC2_EQ_B2_C - [15:0] */ | ||
| 3174 | |||
| 3175 | /* | ||
| 3176 | * R1192 (0x4A8) - AIF1 DAC2 EQ Band 2 PG | ||
| 3177 | */ | ||
| 3178 | #define WM8994_AIF1DAC2_EQ_B2_PG_MASK 0xFFFF /* AIF1DAC2_EQ_B2_PG - [15:0] */ | ||
| 3179 | #define WM8994_AIF1DAC2_EQ_B2_PG_SHIFT 0 /* AIF1DAC2_EQ_B2_PG - [15:0] */ | ||
| 3180 | #define WM8994_AIF1DAC2_EQ_B2_PG_WIDTH 16 /* AIF1DAC2_EQ_B2_PG - [15:0] */ | ||
| 3181 | |||
| 3182 | /* | ||
| 3183 | * R1193 (0x4A9) - AIF1 DAC2 EQ Band 3 A | ||
| 3184 | */ | ||
| 3185 | #define WM8994_AIF1DAC2_EQ_B3_A_MASK 0xFFFF /* AIF1DAC2_EQ_B3_A - [15:0] */ | ||
| 3186 | #define WM8994_AIF1DAC2_EQ_B3_A_SHIFT 0 /* AIF1DAC2_EQ_B3_A - [15:0] */ | ||
| 3187 | #define WM8994_AIF1DAC2_EQ_B3_A_WIDTH 16 /* AIF1DAC2_EQ_B3_A - [15:0] */ | ||
| 3188 | |||
| 3189 | /* | ||
| 3190 | * R1194 (0x4AA) - AIF1 DAC2 EQ Band 3 B | ||
| 3191 | */ | ||
| 3192 | #define WM8994_AIF1DAC2_EQ_B3_B_MASK 0xFFFF /* AIF1DAC2_EQ_B3_B - [15:0] */ | ||
| 3193 | #define WM8994_AIF1DAC2_EQ_B3_B_SHIFT 0 /* AIF1DAC2_EQ_B3_B - [15:0] */ | ||
| 3194 | #define WM8994_AIF1DAC2_EQ_B3_B_WIDTH 16 /* AIF1DAC2_EQ_B3_B - [15:0] */ | ||
| 3195 | |||
| 3196 | /* | ||
| 3197 | * R1195 (0x4AB) - AIF1 DAC2 EQ Band 3 C | ||
| 3198 | */ | ||
| 3199 | #define WM8994_AIF1DAC2_EQ_B3_C_MASK 0xFFFF /* AIF1DAC2_EQ_B3_C - [15:0] */ | ||
| 3200 | #define WM8994_AIF1DAC2_EQ_B3_C_SHIFT 0 /* AIF1DAC2_EQ_B3_C - [15:0] */ | ||
| 3201 | #define WM8994_AIF1DAC2_EQ_B3_C_WIDTH 16 /* AIF1DAC2_EQ_B3_C - [15:0] */ | ||
| 3202 | |||
| 3203 | /* | ||
| 3204 | * R1196 (0x4AC) - AIF1 DAC2 EQ Band 3 PG | ||
| 3205 | */ | ||
| 3206 | #define WM8994_AIF1DAC2_EQ_B3_PG_MASK 0xFFFF /* AIF1DAC2_EQ_B3_PG - [15:0] */ | ||
| 3207 | #define WM8994_AIF1DAC2_EQ_B3_PG_SHIFT 0 /* AIF1DAC2_EQ_B3_PG - [15:0] */ | ||
| 3208 | #define WM8994_AIF1DAC2_EQ_B3_PG_WIDTH 16 /* AIF1DAC2_EQ_B3_PG - [15:0] */ | ||
| 3209 | |||
| 3210 | /* | ||
| 3211 | * R1197 (0x4AD) - AIF1 DAC2 EQ Band 4 A | ||
| 3212 | */ | ||
| 3213 | #define WM8994_AIF1DAC2_EQ_B4_A_MASK 0xFFFF /* AIF1DAC2_EQ_B4_A - [15:0] */ | ||
| 3214 | #define WM8994_AIF1DAC2_EQ_B4_A_SHIFT 0 /* AIF1DAC2_EQ_B4_A - [15:0] */ | ||
| 3215 | #define WM8994_AIF1DAC2_EQ_B4_A_WIDTH 16 /* AIF1DAC2_EQ_B4_A - [15:0] */ | ||
| 3216 | |||
| 3217 | /* | ||
| 3218 | * R1198 (0x4AE) - AIF1 DAC2 EQ Band 4 B | ||
| 3219 | */ | ||
| 3220 | #define WM8994_AIF1DAC2_EQ_B4_B_MASK 0xFFFF /* AIF1DAC2_EQ_B4_B - [15:0] */ | ||
| 3221 | #define WM8994_AIF1DAC2_EQ_B4_B_SHIFT 0 /* AIF1DAC2_EQ_B4_B - [15:0] */ | ||
| 3222 | #define WM8994_AIF1DAC2_EQ_B4_B_WIDTH 16 /* AIF1DAC2_EQ_B4_B - [15:0] */ | ||
| 3223 | |||
| 3224 | /* | ||
| 3225 | * R1199 (0x4AF) - AIF1 DAC2 EQ Band 4 C | ||
| 3226 | */ | ||
| 3227 | #define WM8994_AIF1DAC2_EQ_B4_C_MASK 0xFFFF /* AIF1DAC2_EQ_B4_C - [15:0] */ | ||
| 3228 | #define WM8994_AIF1DAC2_EQ_B4_C_SHIFT 0 /* AIF1DAC2_EQ_B4_C - [15:0] */ | ||
| 3229 | #define WM8994_AIF1DAC2_EQ_B4_C_WIDTH 16 /* AIF1DAC2_EQ_B4_C - [15:0] */ | ||
| 3230 | |||
| 3231 | /* | ||
| 3232 | * R1200 (0x4B0) - AIF1 DAC2 EQ Band 4 PG | ||
| 3233 | */ | ||
| 3234 | #define WM8994_AIF1DAC2_EQ_B4_PG_MASK 0xFFFF /* AIF1DAC2_EQ_B4_PG - [15:0] */ | ||
| 3235 | #define WM8994_AIF1DAC2_EQ_B4_PG_SHIFT 0 /* AIF1DAC2_EQ_B4_PG - [15:0] */ | ||
| 3236 | #define WM8994_AIF1DAC2_EQ_B4_PG_WIDTH 16 /* AIF1DAC2_EQ_B4_PG - [15:0] */ | ||
| 3237 | |||
| 3238 | /* | ||
| 3239 | * R1201 (0x4B1) - AIF1 DAC2 EQ Band 5 A | ||
| 3240 | */ | ||
| 3241 | #define WM8994_AIF1DAC2_EQ_B5_A_MASK 0xFFFF /* AIF1DAC2_EQ_B5_A - [15:0] */ | ||
| 3242 | #define WM8994_AIF1DAC2_EQ_B5_A_SHIFT 0 /* AIF1DAC2_EQ_B5_A - [15:0] */ | ||
| 3243 | #define WM8994_AIF1DAC2_EQ_B5_A_WIDTH 16 /* AIF1DAC2_EQ_B5_A - [15:0] */ | ||
| 3244 | |||
| 3245 | /* | ||
| 3246 | * R1202 (0x4B2) - AIF1 DAC2 EQ Band 5 B | ||
| 3247 | */ | ||
| 3248 | #define WM8994_AIF1DAC2_EQ_B5_B_MASK 0xFFFF /* AIF1DAC2_EQ_B5_B - [15:0] */ | ||
| 3249 | #define WM8994_AIF1DAC2_EQ_B5_B_SHIFT 0 /* AIF1DAC2_EQ_B5_B - [15:0] */ | ||
| 3250 | #define WM8994_AIF1DAC2_EQ_B5_B_WIDTH 16 /* AIF1DAC2_EQ_B5_B - [15:0] */ | ||
| 3251 | |||
| 3252 | /* | ||
| 3253 | * R1203 (0x4B3) - AIF1 DAC2 EQ Band 5 PG | ||
| 3254 | */ | ||
| 3255 | #define WM8994_AIF1DAC2_EQ_B5_PG_MASK 0xFFFF /* AIF1DAC2_EQ_B5_PG - [15:0] */ | ||
| 3256 | #define WM8994_AIF1DAC2_EQ_B5_PG_SHIFT 0 /* AIF1DAC2_EQ_B5_PG - [15:0] */ | ||
| 3257 | #define WM8994_AIF1DAC2_EQ_B5_PG_WIDTH 16 /* AIF1DAC2_EQ_B5_PG - [15:0] */ | ||
| 3258 | |||
| 3259 | /* | ||
| 3260 | * R1280 (0x500) - AIF2 ADC Left Volume | ||
| 3261 | */ | ||
| 3262 | #define WM8994_AIF2ADC_VU 0x0100 /* AIF2ADC_VU */ | ||
| 3263 | #define WM8994_AIF2ADC_VU_MASK 0x0100 /* AIF2ADC_VU */ | ||
| 3264 | #define WM8994_AIF2ADC_VU_SHIFT 8 /* AIF2ADC_VU */ | ||
| 3265 | #define WM8994_AIF2ADC_VU_WIDTH 1 /* AIF2ADC_VU */ | ||
| 3266 | #define WM8994_AIF2ADCL_VOL_MASK 0x00FF /* AIF2ADCL_VOL - [7:0] */ | ||
| 3267 | #define WM8994_AIF2ADCL_VOL_SHIFT 0 /* AIF2ADCL_VOL - [7:0] */ | ||
| 3268 | #define WM8994_AIF2ADCL_VOL_WIDTH 8 /* AIF2ADCL_VOL - [7:0] */ | ||
| 3269 | |||
| 3270 | /* | ||
| 3271 | * R1281 (0x501) - AIF2 ADC Right Volume | ||
| 3272 | */ | ||
| 3273 | #define WM8994_AIF2ADC_VU 0x0100 /* AIF2ADC_VU */ | ||
| 3274 | #define WM8994_AIF2ADC_VU_MASK 0x0100 /* AIF2ADC_VU */ | ||
| 3275 | #define WM8994_AIF2ADC_VU_SHIFT 8 /* AIF2ADC_VU */ | ||
| 3276 | #define WM8994_AIF2ADC_VU_WIDTH 1 /* AIF2ADC_VU */ | ||
| 3277 | #define WM8994_AIF2ADCR_VOL_MASK 0x00FF /* AIF2ADCR_VOL - [7:0] */ | ||
| 3278 | #define WM8994_AIF2ADCR_VOL_SHIFT 0 /* AIF2ADCR_VOL - [7:0] */ | ||
| 3279 | #define WM8994_AIF2ADCR_VOL_WIDTH 8 /* AIF2ADCR_VOL - [7:0] */ | ||
| 3280 | |||
| 3281 | /* | ||
| 3282 | * R1282 (0x502) - AIF2 DAC Left Volume | ||
| 3283 | */ | ||
| 3284 | #define WM8994_AIF2DAC_VU 0x0100 /* AIF2DAC_VU */ | ||
| 3285 | #define WM8994_AIF2DAC_VU_MASK 0x0100 /* AIF2DAC_VU */ | ||
| 3286 | #define WM8994_AIF2DAC_VU_SHIFT 8 /* AIF2DAC_VU */ | ||
| 3287 | #define WM8994_AIF2DAC_VU_WIDTH 1 /* AIF2DAC_VU */ | ||
| 3288 | #define WM8994_AIF2DACL_VOL_MASK 0x00FF /* AIF2DACL_VOL - [7:0] */ | ||
| 3289 | #define WM8994_AIF2DACL_VOL_SHIFT 0 /* AIF2DACL_VOL - [7:0] */ | ||
| 3290 | #define WM8994_AIF2DACL_VOL_WIDTH 8 /* AIF2DACL_VOL - [7:0] */ | ||
| 3291 | |||
| 3292 | /* | ||
| 3293 | * R1283 (0x503) - AIF2 DAC Right Volume | ||
| 3294 | */ | ||
| 3295 | #define WM8994_AIF2DAC_VU 0x0100 /* AIF2DAC_VU */ | ||
| 3296 | #define WM8994_AIF2DAC_VU_MASK 0x0100 /* AIF2DAC_VU */ | ||
| 3297 | #define WM8994_AIF2DAC_VU_SHIFT 8 /* AIF2DAC_VU */ | ||
| 3298 | #define WM8994_AIF2DAC_VU_WIDTH 1 /* AIF2DAC_VU */ | ||
| 3299 | #define WM8994_AIF2DACR_VOL_MASK 0x00FF /* AIF2DACR_VOL - [7:0] */ | ||
| 3300 | #define WM8994_AIF2DACR_VOL_SHIFT 0 /* AIF2DACR_VOL - [7:0] */ | ||
| 3301 | #define WM8994_AIF2DACR_VOL_WIDTH 8 /* AIF2DACR_VOL - [7:0] */ | ||
| 3302 | |||
| 3303 | /* | ||
| 3304 | * R1296 (0x510) - AIF2 ADC Filters | ||
| 3305 | */ | ||
| 3306 | #define WM8994_AIF2ADC_4FS 0x8000 /* AIF2ADC_4FS */ | ||
| 3307 | #define WM8994_AIF2ADC_4FS_MASK 0x8000 /* AIF2ADC_4FS */ | ||
| 3308 | #define WM8994_AIF2ADC_4FS_SHIFT 15 /* AIF2ADC_4FS */ | ||
| 3309 | #define WM8994_AIF2ADC_4FS_WIDTH 1 /* AIF2ADC_4FS */ | ||
| 3310 | #define WM8994_AIF2ADC_HPF_CUT_MASK 0x6000 /* AIF2ADC_HPF_CUT - [14:13] */ | ||
| 3311 | #define WM8994_AIF2ADC_HPF_CUT_SHIFT 13 /* AIF2ADC_HPF_CUT - [14:13] */ | ||
| 3312 | #define WM8994_AIF2ADC_HPF_CUT_WIDTH 2 /* AIF2ADC_HPF_CUT - [14:13] */ | ||
| 3313 | #define WM8994_AIF2ADCL_HPF 0x1000 /* AIF2ADCL_HPF */ | ||
| 3314 | #define WM8994_AIF2ADCL_HPF_MASK 0x1000 /* AIF2ADCL_HPF */ | ||
| 3315 | #define WM8994_AIF2ADCL_HPF_SHIFT 12 /* AIF2ADCL_HPF */ | ||
| 3316 | #define WM8994_AIF2ADCL_HPF_WIDTH 1 /* AIF2ADCL_HPF */ | ||
| 3317 | #define WM8994_AIF2ADCR_HPF 0x0800 /* AIF2ADCR_HPF */ | ||
| 3318 | #define WM8994_AIF2ADCR_HPF_MASK 0x0800 /* AIF2ADCR_HPF */ | ||
| 3319 | #define WM8994_AIF2ADCR_HPF_SHIFT 11 /* AIF2ADCR_HPF */ | ||
| 3320 | #define WM8994_AIF2ADCR_HPF_WIDTH 1 /* AIF2ADCR_HPF */ | ||
| 3321 | |||
| 3322 | /* | ||
| 3323 | * R1312 (0x520) - AIF2 DAC Filters (1) | ||
| 3324 | */ | ||
| 3325 | #define WM8994_AIF2DAC_MUTE 0x0200 /* AIF2DAC_MUTE */ | ||
| 3326 | #define WM8994_AIF2DAC_MUTE_MASK 0x0200 /* AIF2DAC_MUTE */ | ||
| 3327 | #define WM8994_AIF2DAC_MUTE_SHIFT 9 /* AIF2DAC_MUTE */ | ||
| 3328 | #define WM8994_AIF2DAC_MUTE_WIDTH 1 /* AIF2DAC_MUTE */ | ||
| 3329 | #define WM8994_AIF2DAC_MONO 0x0080 /* AIF2DAC_MONO */ | ||
| 3330 | #define WM8994_AIF2DAC_MONO_MASK 0x0080 /* AIF2DAC_MONO */ | ||
| 3331 | #define WM8994_AIF2DAC_MONO_SHIFT 7 /* AIF2DAC_MONO */ | ||
| 3332 | #define WM8994_AIF2DAC_MONO_WIDTH 1 /* AIF2DAC_MONO */ | ||
| 3333 | #define WM8994_AIF2DAC_MUTERATE 0x0020 /* AIF2DAC_MUTERATE */ | ||
| 3334 | #define WM8994_AIF2DAC_MUTERATE_MASK 0x0020 /* AIF2DAC_MUTERATE */ | ||
| 3335 | #define WM8994_AIF2DAC_MUTERATE_SHIFT 5 /* AIF2DAC_MUTERATE */ | ||
| 3336 | #define WM8994_AIF2DAC_MUTERATE_WIDTH 1 /* AIF2DAC_MUTERATE */ | ||
| 3337 | #define WM8994_AIF2DAC_UNMUTE_RAMP 0x0010 /* AIF2DAC_UNMUTE_RAMP */ | ||
| 3338 | #define WM8994_AIF2DAC_UNMUTE_RAMP_MASK 0x0010 /* AIF2DAC_UNMUTE_RAMP */ | ||
| 3339 | #define WM8994_AIF2DAC_UNMUTE_RAMP_SHIFT 4 /* AIF2DAC_UNMUTE_RAMP */ | ||
| 3340 | #define WM8994_AIF2DAC_UNMUTE_RAMP_WIDTH 1 /* AIF2DAC_UNMUTE_RAMP */ | ||
| 3341 | #define WM8994_AIF2DAC_DEEMP_MASK 0x0006 /* AIF2DAC_DEEMP - [2:1] */ | ||
| 3342 | #define WM8994_AIF2DAC_DEEMP_SHIFT 1 /* AIF2DAC_DEEMP - [2:1] */ | ||
| 3343 | #define WM8994_AIF2DAC_DEEMP_WIDTH 2 /* AIF2DAC_DEEMP - [2:1] */ | ||
| 3344 | |||
| 3345 | /* | ||
| 3346 | * R1313 (0x521) - AIF2 DAC Filters (2) | ||
| 3347 | */ | ||
| 3348 | #define WM8994_AIF2DAC_3D_GAIN_MASK 0x3E00 /* AIF2DAC_3D_GAIN - [13:9] */ | ||
| 3349 | #define WM8994_AIF2DAC_3D_GAIN_SHIFT 9 /* AIF2DAC_3D_GAIN - [13:9] */ | ||
| 3350 | #define WM8994_AIF2DAC_3D_GAIN_WIDTH 5 /* AIF2DAC_3D_GAIN - [13:9] */ | ||
| 3351 | #define WM8994_AIF2DAC_3D_ENA 0x0100 /* AIF2DAC_3D_ENA */ | ||
| 3352 | #define WM8994_AIF2DAC_3D_ENA_MASK 0x0100 /* AIF2DAC_3D_ENA */ | ||
| 3353 | #define WM8994_AIF2DAC_3D_ENA_SHIFT 8 /* AIF2DAC_3D_ENA */ | ||
| 3354 | #define WM8994_AIF2DAC_3D_ENA_WIDTH 1 /* AIF2DAC_3D_ENA */ | ||
| 3355 | |||
| 3356 | /* | ||
| 3357 | * R1344 (0x540) - AIF2 DRC (1) | ||
| 3358 | */ | ||
| 3359 | #define WM8994_AIF2DRC_SIG_DET_RMS_MASK 0xF800 /* AIF2DRC_SIG_DET_RMS - [15:11] */ | ||
| 3360 | #define WM8994_AIF2DRC_SIG_DET_RMS_SHIFT 11 /* AIF2DRC_SIG_DET_RMS - [15:11] */ | ||
| 3361 | #define WM8994_AIF2DRC_SIG_DET_RMS_WIDTH 5 /* AIF2DRC_SIG_DET_RMS - [15:11] */ | ||
| 3362 | #define WM8994_AIF2DRC_SIG_DET_PK_MASK 0x0600 /* AIF2DRC_SIG_DET_PK - [10:9] */ | ||
| 3363 | #define WM8994_AIF2DRC_SIG_DET_PK_SHIFT 9 /* AIF2DRC_SIG_DET_PK - [10:9] */ | ||
| 3364 | #define WM8994_AIF2DRC_SIG_DET_PK_WIDTH 2 /* AIF2DRC_SIG_DET_PK - [10:9] */ | ||
| 3365 | #define WM8994_AIF2DRC_NG_ENA 0x0100 /* AIF2DRC_NG_ENA */ | ||
| 3366 | #define WM8994_AIF2DRC_NG_ENA_MASK 0x0100 /* AIF2DRC_NG_ENA */ | ||
| 3367 | #define WM8994_AIF2DRC_NG_ENA_SHIFT 8 /* AIF2DRC_NG_ENA */ | ||
| 3368 | #define WM8994_AIF2DRC_NG_ENA_WIDTH 1 /* AIF2DRC_NG_ENA */ | ||
| 3369 | #define WM8994_AIF2DRC_SIG_DET_MODE 0x0080 /* AIF2DRC_SIG_DET_MODE */ | ||
| 3370 | #define WM8994_AIF2DRC_SIG_DET_MODE_MASK 0x0080 /* AIF2DRC_SIG_DET_MODE */ | ||
| 3371 | #define WM8994_AIF2DRC_SIG_DET_MODE_SHIFT 7 /* AIF2DRC_SIG_DET_MODE */ | ||
| 3372 | #define WM8994_AIF2DRC_SIG_DET_MODE_WIDTH 1 /* AIF2DRC_SIG_DET_MODE */ | ||
| 3373 | #define WM8994_AIF2DRC_SIG_DET 0x0040 /* AIF2DRC_SIG_DET */ | ||
| 3374 | #define WM8994_AIF2DRC_SIG_DET_MASK 0x0040 /* AIF2DRC_SIG_DET */ | ||
| 3375 | #define WM8994_AIF2DRC_SIG_DET_SHIFT 6 /* AIF2DRC_SIG_DET */ | ||
| 3376 | #define WM8994_AIF2DRC_SIG_DET_WIDTH 1 /* AIF2DRC_SIG_DET */ | ||
| 3377 | #define WM8994_AIF2DRC_KNEE2_OP_ENA 0x0020 /* AIF2DRC_KNEE2_OP_ENA */ | ||
| 3378 | #define WM8994_AIF2DRC_KNEE2_OP_ENA_MASK 0x0020 /* AIF2DRC_KNEE2_OP_ENA */ | ||
| 3379 | #define WM8994_AIF2DRC_KNEE2_OP_ENA_SHIFT 5 /* AIF2DRC_KNEE2_OP_ENA */ | ||
| 3380 | #define WM8994_AIF2DRC_KNEE2_OP_ENA_WIDTH 1 /* AIF2DRC_KNEE2_OP_ENA */ | ||
| 3381 | #define WM8994_AIF2DRC_QR 0x0010 /* AIF2DRC_QR */ | ||
| 3382 | #define WM8994_AIF2DRC_QR_MASK 0x0010 /* AIF2DRC_QR */ | ||
| 3383 | #define WM8994_AIF2DRC_QR_SHIFT 4 /* AIF2DRC_QR */ | ||
| 3384 | #define WM8994_AIF2DRC_QR_WIDTH 1 /* AIF2DRC_QR */ | ||
| 3385 | #define WM8994_AIF2DRC_ANTICLIP 0x0008 /* AIF2DRC_ANTICLIP */ | ||
| 3386 | #define WM8994_AIF2DRC_ANTICLIP_MASK 0x0008 /* AIF2DRC_ANTICLIP */ | ||
| 3387 | #define WM8994_AIF2DRC_ANTICLIP_SHIFT 3 /* AIF2DRC_ANTICLIP */ | ||
| 3388 | #define WM8994_AIF2DRC_ANTICLIP_WIDTH 1 /* AIF2DRC_ANTICLIP */ | ||
| 3389 | #define WM8994_AIF2DAC_DRC_ENA 0x0004 /* AIF2DAC_DRC_ENA */ | ||
| 3390 | #define WM8994_AIF2DAC_DRC_ENA_MASK 0x0004 /* AIF2DAC_DRC_ENA */ | ||
| 3391 | #define WM8994_AIF2DAC_DRC_ENA_SHIFT 2 /* AIF2DAC_DRC_ENA */ | ||
| 3392 | #define WM8994_AIF2DAC_DRC_ENA_WIDTH 1 /* AIF2DAC_DRC_ENA */ | ||
| 3393 | #define WM8994_AIF2ADCL_DRC_ENA 0x0002 /* AIF2ADCL_DRC_ENA */ | ||
| 3394 | #define WM8994_AIF2ADCL_DRC_ENA_MASK 0x0002 /* AIF2ADCL_DRC_ENA */ | ||
| 3395 | #define WM8994_AIF2ADCL_DRC_ENA_SHIFT 1 /* AIF2ADCL_DRC_ENA */ | ||
| 3396 | #define WM8994_AIF2ADCL_DRC_ENA_WIDTH 1 /* AIF2ADCL_DRC_ENA */ | ||
| 3397 | #define WM8994_AIF2ADCR_DRC_ENA 0x0001 /* AIF2ADCR_DRC_ENA */ | ||
| 3398 | #define WM8994_AIF2ADCR_DRC_ENA_MASK 0x0001 /* AIF2ADCR_DRC_ENA */ | ||
| 3399 | #define WM8994_AIF2ADCR_DRC_ENA_SHIFT 0 /* AIF2ADCR_DRC_ENA */ | ||
| 3400 | #define WM8994_AIF2ADCR_DRC_ENA_WIDTH 1 /* AIF2ADCR_DRC_ENA */ | ||
| 3401 | |||
| 3402 | /* | ||
| 3403 | * R1345 (0x541) - AIF2 DRC (2) | ||
| 3404 | */ | ||
| 3405 | #define WM8994_AIF2DRC_ATK_MASK 0x1E00 /* AIF2DRC_ATK - [12:9] */ | ||
| 3406 | #define WM8994_AIF2DRC_ATK_SHIFT 9 /* AIF2DRC_ATK - [12:9] */ | ||
| 3407 | #define WM8994_AIF2DRC_ATK_WIDTH 4 /* AIF2DRC_ATK - [12:9] */ | ||
| 3408 | #define WM8994_AIF2DRC_DCY_MASK 0x01E0 /* AIF2DRC_DCY - [8:5] */ | ||
| 3409 | #define WM8994_AIF2DRC_DCY_SHIFT 5 /* AIF2DRC_DCY - [8:5] */ | ||
| 3410 | #define WM8994_AIF2DRC_DCY_WIDTH 4 /* AIF2DRC_DCY - [8:5] */ | ||
| 3411 | #define WM8994_AIF2DRC_MINGAIN_MASK 0x001C /* AIF2DRC_MINGAIN - [4:2] */ | ||
| 3412 | #define WM8994_AIF2DRC_MINGAIN_SHIFT 2 /* AIF2DRC_MINGAIN - [4:2] */ | ||
| 3413 | #define WM8994_AIF2DRC_MINGAIN_WIDTH 3 /* AIF2DRC_MINGAIN - [4:2] */ | ||
| 3414 | #define WM8994_AIF2DRC_MAXGAIN_MASK 0x0003 /* AIF2DRC_MAXGAIN - [1:0] */ | ||
| 3415 | #define WM8994_AIF2DRC_MAXGAIN_SHIFT 0 /* AIF2DRC_MAXGAIN - [1:0] */ | ||
| 3416 | #define WM8994_AIF2DRC_MAXGAIN_WIDTH 2 /* AIF2DRC_MAXGAIN - [1:0] */ | ||
| 3417 | |||
| 3418 | /* | ||
| 3419 | * R1346 (0x542) - AIF2 DRC (3) | ||
| 3420 | */ | ||
| 3421 | #define WM8994_AIF2DRC_NG_MINGAIN_MASK 0xF000 /* AIF2DRC_NG_MINGAIN - [15:12] */ | ||
| 3422 | #define WM8994_AIF2DRC_NG_MINGAIN_SHIFT 12 /* AIF2DRC_NG_MINGAIN - [15:12] */ | ||
| 3423 | #define WM8994_AIF2DRC_NG_MINGAIN_WIDTH 4 /* AIF2DRC_NG_MINGAIN - [15:12] */ | ||
| 3424 | #define WM8994_AIF2DRC_NG_EXP_MASK 0x0C00 /* AIF2DRC_NG_EXP - [11:10] */ | ||
| 3425 | #define WM8994_AIF2DRC_NG_EXP_SHIFT 10 /* AIF2DRC_NG_EXP - [11:10] */ | ||
| 3426 | #define WM8994_AIF2DRC_NG_EXP_WIDTH 2 /* AIF2DRC_NG_EXP - [11:10] */ | ||
| 3427 | #define WM8994_AIF2DRC_QR_THR_MASK 0x0300 /* AIF2DRC_QR_THR - [9:8] */ | ||
| 3428 | #define WM8994_AIF2DRC_QR_THR_SHIFT 8 /* AIF2DRC_QR_THR - [9:8] */ | ||
| 3429 | #define WM8994_AIF2DRC_QR_THR_WIDTH 2 /* AIF2DRC_QR_THR - [9:8] */ | ||
| 3430 | #define WM8994_AIF2DRC_QR_DCY_MASK 0x00C0 /* AIF2DRC_QR_DCY - [7:6] */ | ||
| 3431 | #define WM8994_AIF2DRC_QR_DCY_SHIFT 6 /* AIF2DRC_QR_DCY - [7:6] */ | ||
| 3432 | #define WM8994_AIF2DRC_QR_DCY_WIDTH 2 /* AIF2DRC_QR_DCY - [7:6] */ | ||
| 3433 | #define WM8994_AIF2DRC_HI_COMP_MASK 0x0038 /* AIF2DRC_HI_COMP - [5:3] */ | ||
| 3434 | #define WM8994_AIF2DRC_HI_COMP_SHIFT 3 /* AIF2DRC_HI_COMP - [5:3] */ | ||
| 3435 | #define WM8994_AIF2DRC_HI_COMP_WIDTH 3 /* AIF2DRC_HI_COMP - [5:3] */ | ||
| 3436 | #define WM8994_AIF2DRC_LO_COMP_MASK 0x0007 /* AIF2DRC_LO_COMP - [2:0] */ | ||
| 3437 | #define WM8994_AIF2DRC_LO_COMP_SHIFT 0 /* AIF2DRC_LO_COMP - [2:0] */ | ||
| 3438 | #define WM8994_AIF2DRC_LO_COMP_WIDTH 3 /* AIF2DRC_LO_COMP - [2:0] */ | ||
| 3439 | |||
| 3440 | /* | ||
| 3441 | * R1347 (0x543) - AIF2 DRC (4) | ||
| 3442 | */ | ||
| 3443 | #define WM8994_AIF2DRC_KNEE_IP_MASK 0x07E0 /* AIF2DRC_KNEE_IP - [10:5] */ | ||
| 3444 | #define WM8994_AIF2DRC_KNEE_IP_SHIFT 5 /* AIF2DRC_KNEE_IP - [10:5] */ | ||
| 3445 | #define WM8994_AIF2DRC_KNEE_IP_WIDTH 6 /* AIF2DRC_KNEE_IP - [10:5] */ | ||
| 3446 | #define WM8994_AIF2DRC_KNEE_OP_MASK 0x001F /* AIF2DRC_KNEE_OP - [4:0] */ | ||
| 3447 | #define WM8994_AIF2DRC_KNEE_OP_SHIFT 0 /* AIF2DRC_KNEE_OP - [4:0] */ | ||
| 3448 | #define WM8994_AIF2DRC_KNEE_OP_WIDTH 5 /* AIF2DRC_KNEE_OP - [4:0] */ | ||
| 3449 | |||
| 3450 | /* | ||
| 3451 | * R1348 (0x544) - AIF2 DRC (5) | ||
| 3452 | */ | ||
| 3453 | #define WM8994_AIF2DRC_KNEE2_IP_MASK 0x03E0 /* AIF2DRC_KNEE2_IP - [9:5] */ | ||
| 3454 | #define WM8994_AIF2DRC_KNEE2_IP_SHIFT 5 /* AIF2DRC_KNEE2_IP - [9:5] */ | ||
| 3455 | #define WM8994_AIF2DRC_KNEE2_IP_WIDTH 5 /* AIF2DRC_KNEE2_IP - [9:5] */ | ||
| 3456 | #define WM8994_AIF2DRC_KNEE2_OP_MASK 0x001F /* AIF2DRC_KNEE2_OP - [4:0] */ | ||
| 3457 | #define WM8994_AIF2DRC_KNEE2_OP_SHIFT 0 /* AIF2DRC_KNEE2_OP - [4:0] */ | ||
| 3458 | #define WM8994_AIF2DRC_KNEE2_OP_WIDTH 5 /* AIF2DRC_KNEE2_OP - [4:0] */ | ||
| 3459 | |||
| 3460 | /* | ||
| 3461 | * R1408 (0x580) - AIF2 EQ Gains (1) | ||
| 3462 | */ | ||
| 3463 | #define WM8994_AIF2DAC_EQ_B1_GAIN_MASK 0xF800 /* AIF2DAC_EQ_B1_GAIN - [15:11] */ | ||
| 3464 | #define WM8994_AIF2DAC_EQ_B1_GAIN_SHIFT 11 /* AIF2DAC_EQ_B1_GAIN - [15:11] */ | ||
| 3465 | #define WM8994_AIF2DAC_EQ_B1_GAIN_WIDTH 5 /* AIF2DAC_EQ_B1_GAIN - [15:11] */ | ||
| 3466 | #define WM8994_AIF2DAC_EQ_B2_GAIN_MASK 0x07C0 /* AIF2DAC_EQ_B2_GAIN - [10:6] */ | ||
| 3467 | #define WM8994_AIF2DAC_EQ_B2_GAIN_SHIFT 6 /* AIF2DAC_EQ_B2_GAIN - [10:6] */ | ||
| 3468 | #define WM8994_AIF2DAC_EQ_B2_GAIN_WIDTH 5 /* AIF2DAC_EQ_B2_GAIN - [10:6] */ | ||
| 3469 | #define WM8994_AIF2DAC_EQ_B3_GAIN_MASK 0x003E /* AIF2DAC_EQ_B3_GAIN - [5:1] */ | ||
| 3470 | #define WM8994_AIF2DAC_EQ_B3_GAIN_SHIFT 1 /* AIF2DAC_EQ_B3_GAIN - [5:1] */ | ||
| 3471 | #define WM8994_AIF2DAC_EQ_B3_GAIN_WIDTH 5 /* AIF2DAC_EQ_B3_GAIN - [5:1] */ | ||
| 3472 | #define WM8994_AIF2DAC_EQ_ENA 0x0001 /* AIF2DAC_EQ_ENA */ | ||
| 3473 | #define WM8994_AIF2DAC_EQ_ENA_MASK 0x0001 /* AIF2DAC_EQ_ENA */ | ||
| 3474 | #define WM8994_AIF2DAC_EQ_ENA_SHIFT 0 /* AIF2DAC_EQ_ENA */ | ||
| 3475 | #define WM8994_AIF2DAC_EQ_ENA_WIDTH 1 /* AIF2DAC_EQ_ENA */ | ||
| 3476 | |||
| 3477 | /* | ||
| 3478 | * R1409 (0x581) - AIF2 EQ Gains (2) | ||
| 3479 | */ | ||
| 3480 | #define WM8994_AIF2DAC_EQ_B4_GAIN_MASK 0xF800 /* AIF2DAC_EQ_B4_GAIN - [15:11] */ | ||
| 3481 | #define WM8994_AIF2DAC_EQ_B4_GAIN_SHIFT 11 /* AIF2DAC_EQ_B4_GAIN - [15:11] */ | ||
| 3482 | #define WM8994_AIF2DAC_EQ_B4_GAIN_WIDTH 5 /* AIF2DAC_EQ_B4_GAIN - [15:11] */ | ||
| 3483 | #define WM8994_AIF2DAC_EQ_B5_GAIN_MASK 0x07C0 /* AIF2DAC_EQ_B5_GAIN - [10:6] */ | ||
| 3484 | #define WM8994_AIF2DAC_EQ_B5_GAIN_SHIFT 6 /* AIF2DAC_EQ_B5_GAIN - [10:6] */ | ||
| 3485 | #define WM8994_AIF2DAC_EQ_B5_GAIN_WIDTH 5 /* AIF2DAC_EQ_B5_GAIN - [10:6] */ | ||
| 3486 | |||
| 3487 | /* | ||
| 3488 | * R1410 (0x582) - AIF2 EQ Band 1 A | ||
| 3489 | */ | ||
| 3490 | #define WM8994_AIF2DAC_EQ_B1_A_MASK 0xFFFF /* AIF2DAC_EQ_B1_A - [15:0] */ | ||
| 3491 | #define WM8994_AIF2DAC_EQ_B1_A_SHIFT 0 /* AIF2DAC_EQ_B1_A - [15:0] */ | ||
| 3492 | #define WM8994_AIF2DAC_EQ_B1_A_WIDTH 16 /* AIF2DAC_EQ_B1_A - [15:0] */ | ||
| 3493 | |||
| 3494 | /* | ||
| 3495 | * R1411 (0x583) - AIF2 EQ Band 1 B | ||
| 3496 | */ | ||
| 3497 | #define WM8994_AIF2DAC_EQ_B1_B_MASK 0xFFFF /* AIF2DAC_EQ_B1_B - [15:0] */ | ||
| 3498 | #define WM8994_AIF2DAC_EQ_B1_B_SHIFT 0 /* AIF2DAC_EQ_B1_B - [15:0] */ | ||
| 3499 | #define WM8994_AIF2DAC_EQ_B1_B_WIDTH 16 /* AIF2DAC_EQ_B1_B - [15:0] */ | ||
| 3500 | |||
| 3501 | /* | ||
| 3502 | * R1412 (0x584) - AIF2 EQ Band 1 PG | ||
| 3503 | */ | ||
| 3504 | #define WM8994_AIF2DAC_EQ_B1_PG_MASK 0xFFFF /* AIF2DAC_EQ_B1_PG - [15:0] */ | ||
| 3505 | #define WM8994_AIF2DAC_EQ_B1_PG_SHIFT 0 /* AIF2DAC_EQ_B1_PG - [15:0] */ | ||
| 3506 | #define WM8994_AIF2DAC_EQ_B1_PG_WIDTH 16 /* AIF2DAC_EQ_B1_PG - [15:0] */ | ||
| 3507 | |||
| 3508 | /* | ||
| 3509 | * R1413 (0x585) - AIF2 EQ Band 2 A | ||
| 3510 | */ | ||
| 3511 | #define WM8994_AIF2DAC_EQ_B2_A_MASK 0xFFFF /* AIF2DAC_EQ_B2_A - [15:0] */ | ||
| 3512 | #define WM8994_AIF2DAC_EQ_B2_A_SHIFT 0 /* AIF2DAC_EQ_B2_A - [15:0] */ | ||
| 3513 | #define WM8994_AIF2DAC_EQ_B2_A_WIDTH 16 /* AIF2DAC_EQ_B2_A - [15:0] */ | ||
| 3514 | |||
| 3515 | /* | ||
| 3516 | * R1414 (0x586) - AIF2 EQ Band 2 B | ||
| 3517 | */ | ||
| 3518 | #define WM8994_AIF2DAC_EQ_B2_B_MASK 0xFFFF /* AIF2DAC_EQ_B2_B - [15:0] */ | ||
| 3519 | #define WM8994_AIF2DAC_EQ_B2_B_SHIFT 0 /* AIF2DAC_EQ_B2_B - [15:0] */ | ||
| 3520 | #define WM8994_AIF2DAC_EQ_B2_B_WIDTH 16 /* AIF2DAC_EQ_B2_B - [15:0] */ | ||
| 3521 | |||
| 3522 | /* | ||
| 3523 | * R1415 (0x587) - AIF2 EQ Band 2 C | ||
| 3524 | */ | ||
| 3525 | #define WM8994_AIF2DAC_EQ_B2_C_MASK 0xFFFF /* AIF2DAC_EQ_B2_C - [15:0] */ | ||
| 3526 | #define WM8994_AIF2DAC_EQ_B2_C_SHIFT 0 /* AIF2DAC_EQ_B2_C - [15:0] */ | ||
| 3527 | #define WM8994_AIF2DAC_EQ_B2_C_WIDTH 16 /* AIF2DAC_EQ_B2_C - [15:0] */ | ||
| 3528 | |||
| 3529 | /* | ||
| 3530 | * R1416 (0x588) - AIF2 EQ Band 2 PG | ||
| 3531 | */ | ||
| 3532 | #define WM8994_AIF2DAC_EQ_B2_PG_MASK 0xFFFF /* AIF2DAC_EQ_B2_PG - [15:0] */ | ||
| 3533 | #define WM8994_AIF2DAC_EQ_B2_PG_SHIFT 0 /* AIF2DAC_EQ_B2_PG - [15:0] */ | ||
| 3534 | #define WM8994_AIF2DAC_EQ_B2_PG_WIDTH 16 /* AIF2DAC_EQ_B2_PG - [15:0] */ | ||
| 3535 | |||
| 3536 | /* | ||
| 3537 | * R1417 (0x589) - AIF2 EQ Band 3 A | ||
| 3538 | */ | ||
| 3539 | #define WM8994_AIF2DAC_EQ_B3_A_MASK 0xFFFF /* AIF2DAC_EQ_B3_A - [15:0] */ | ||
| 3540 | #define WM8994_AIF2DAC_EQ_B3_A_SHIFT 0 /* AIF2DAC_EQ_B3_A - [15:0] */ | ||
| 3541 | #define WM8994_AIF2DAC_EQ_B3_A_WIDTH 16 /* AIF2DAC_EQ_B3_A - [15:0] */ | ||
| 3542 | |||
| 3543 | /* | ||
| 3544 | * R1418 (0x58A) - AIF2 EQ Band 3 B | ||
| 3545 | */ | ||
| 3546 | #define WM8994_AIF2DAC_EQ_B3_B_MASK 0xFFFF /* AIF2DAC_EQ_B3_B - [15:0] */ | ||
| 3547 | #define WM8994_AIF2DAC_EQ_B3_B_SHIFT 0 /* AIF2DAC_EQ_B3_B - [15:0] */ | ||
| 3548 | #define WM8994_AIF2DAC_EQ_B3_B_WIDTH 16 /* AIF2DAC_EQ_B3_B - [15:0] */ | ||
| 3549 | |||
| 3550 | /* | ||
| 3551 | * R1419 (0x58B) - AIF2 EQ Band 3 C | ||
| 3552 | */ | ||
| 3553 | #define WM8994_AIF2DAC_EQ_B3_C_MASK 0xFFFF /* AIF2DAC_EQ_B3_C - [15:0] */ | ||
| 3554 | #define WM8994_AIF2DAC_EQ_B3_C_SHIFT 0 /* AIF2DAC_EQ_B3_C - [15:0] */ | ||
| 3555 | #define WM8994_AIF2DAC_EQ_B3_C_WIDTH 16 /* AIF2DAC_EQ_B3_C - [15:0] */ | ||
| 3556 | |||
| 3557 | /* | ||
| 3558 | * R1420 (0x58C) - AIF2 EQ Band 3 PG | ||
| 3559 | */ | ||
| 3560 | #define WM8994_AIF2DAC_EQ_B3_PG_MASK 0xFFFF /* AIF2DAC_EQ_B3_PG - [15:0] */ | ||
| 3561 | #define WM8994_AIF2DAC_EQ_B3_PG_SHIFT 0 /* AIF2DAC_EQ_B3_PG - [15:0] */ | ||
| 3562 | #define WM8994_AIF2DAC_EQ_B3_PG_WIDTH 16 /* AIF2DAC_EQ_B3_PG - [15:0] */ | ||
| 3563 | |||
| 3564 | /* | ||
| 3565 | * R1421 (0x58D) - AIF2 EQ Band 4 A | ||
| 3566 | */ | ||
| 3567 | #define WM8994_AIF2DAC_EQ_B4_A_MASK 0xFFFF /* AIF2DAC_EQ_B4_A - [15:0] */ | ||
| 3568 | #define WM8994_AIF2DAC_EQ_B4_A_SHIFT 0 /* AIF2DAC_EQ_B4_A - [15:0] */ | ||
| 3569 | #define WM8994_AIF2DAC_EQ_B4_A_WIDTH 16 /* AIF2DAC_EQ_B4_A - [15:0] */ | ||
| 3570 | |||
| 3571 | /* | ||
| 3572 | * R1422 (0x58E) - AIF2 EQ Band 4 B | ||
| 3573 | */ | ||
| 3574 | #define WM8994_AIF2DAC_EQ_B4_B_MASK 0xFFFF /* AIF2DAC_EQ_B4_B - [15:0] */ | ||
| 3575 | #define WM8994_AIF2DAC_EQ_B4_B_SHIFT 0 /* AIF2DAC_EQ_B4_B - [15:0] */ | ||
| 3576 | #define WM8994_AIF2DAC_EQ_B4_B_WIDTH 16 /* AIF2DAC_EQ_B4_B - [15:0] */ | ||
| 3577 | |||
| 3578 | /* | ||
| 3579 | * R1423 (0x58F) - AIF2 EQ Band 4 C | ||
| 3580 | */ | ||
| 3581 | #define WM8994_AIF2DAC_EQ_B4_C_MASK 0xFFFF /* AIF2DAC_EQ_B4_C - [15:0] */ | ||
| 3582 | #define WM8994_AIF2DAC_EQ_B4_C_SHIFT 0 /* AIF2DAC_EQ_B4_C - [15:0] */ | ||
| 3583 | #define WM8994_AIF2DAC_EQ_B4_C_WIDTH 16 /* AIF2DAC_EQ_B4_C - [15:0] */ | ||
| 3584 | |||
| 3585 | /* | ||
| 3586 | * R1424 (0x590) - AIF2 EQ Band 4 PG | ||
| 3587 | */ | ||
| 3588 | #define WM8994_AIF2DAC_EQ_B4_PG_MASK 0xFFFF /* AIF2DAC_EQ_B4_PG - [15:0] */ | ||
| 3589 | #define WM8994_AIF2DAC_EQ_B4_PG_SHIFT 0 /* AIF2DAC_EQ_B4_PG - [15:0] */ | ||
| 3590 | #define WM8994_AIF2DAC_EQ_B4_PG_WIDTH 16 /* AIF2DAC_EQ_B4_PG - [15:0] */ | ||
| 3591 | |||
| 3592 | /* | ||
| 3593 | * R1425 (0x591) - AIF2 EQ Band 5 A | ||
| 3594 | */ | ||
| 3595 | #define WM8994_AIF2DAC_EQ_B5_A_MASK 0xFFFF /* AIF2DAC_EQ_B5_A - [15:0] */ | ||
| 3596 | #define WM8994_AIF2DAC_EQ_B5_A_SHIFT 0 /* AIF2DAC_EQ_B5_A - [15:0] */ | ||
| 3597 | #define WM8994_AIF2DAC_EQ_B5_A_WIDTH 16 /* AIF2DAC_EQ_B5_A - [15:0] */ | ||
| 3598 | |||
| 3599 | /* | ||
| 3600 | * R1426 (0x592) - AIF2 EQ Band 5 B | ||
| 3601 | */ | ||
| 3602 | #define WM8994_AIF2DAC_EQ_B5_B_MASK 0xFFFF /* AIF2DAC_EQ_B5_B - [15:0] */ | ||
| 3603 | #define WM8994_AIF2DAC_EQ_B5_B_SHIFT 0 /* AIF2DAC_EQ_B5_B - [15:0] */ | ||
| 3604 | #define WM8994_AIF2DAC_EQ_B5_B_WIDTH 16 /* AIF2DAC_EQ_B5_B - [15:0] */ | ||
| 3605 | |||
| 3606 | /* | ||
| 3607 | * R1427 (0x593) - AIF2 EQ Band 5 PG | ||
| 3608 | */ | ||
| 3609 | #define WM8994_AIF2DAC_EQ_B5_PG_MASK 0xFFFF /* AIF2DAC_EQ_B5_PG - [15:0] */ | ||
| 3610 | #define WM8994_AIF2DAC_EQ_B5_PG_SHIFT 0 /* AIF2DAC_EQ_B5_PG - [15:0] */ | ||
| 3611 | #define WM8994_AIF2DAC_EQ_B5_PG_WIDTH 16 /* AIF2DAC_EQ_B5_PG - [15:0] */ | ||
| 3612 | |||
| 3613 | /* | ||
| 3614 | * R1536 (0x600) - DAC1 Mixer Volumes | ||
| 3615 | */ | ||
| 3616 | #define WM8994_ADCR_DAC1_VOL_MASK 0x01E0 /* ADCR_DAC1_VOL - [8:5] */ | ||
| 3617 | #define WM8994_ADCR_DAC1_VOL_SHIFT 5 /* ADCR_DAC1_VOL - [8:5] */ | ||
| 3618 | #define WM8994_ADCR_DAC1_VOL_WIDTH 4 /* ADCR_DAC1_VOL - [8:5] */ | ||
| 3619 | #define WM8994_ADCL_DAC1_VOL_MASK 0x000F /* ADCL_DAC1_VOL - [3:0] */ | ||
| 3620 | #define WM8994_ADCL_DAC1_VOL_SHIFT 0 /* ADCL_DAC1_VOL - [3:0] */ | ||
| 3621 | #define WM8994_ADCL_DAC1_VOL_WIDTH 4 /* ADCL_DAC1_VOL - [3:0] */ | ||
| 3622 | |||
| 3623 | /* | ||
| 3624 | * R1537 (0x601) - DAC1 Left Mixer Routing | ||
| 3625 | */ | ||
| 3626 | #define WM8994_ADCR_TO_DAC1L 0x0020 /* ADCR_TO_DAC1L */ | ||
| 3627 | #define WM8994_ADCR_TO_DAC1L_MASK 0x0020 /* ADCR_TO_DAC1L */ | ||
| 3628 | #define WM8994_ADCR_TO_DAC1L_SHIFT 5 /* ADCR_TO_DAC1L */ | ||
| 3629 | #define WM8994_ADCR_TO_DAC1L_WIDTH 1 /* ADCR_TO_DAC1L */ | ||
| 3630 | #define WM8994_ADCL_TO_DAC1L 0x0010 /* ADCL_TO_DAC1L */ | ||
| 3631 | #define WM8994_ADCL_TO_DAC1L_MASK 0x0010 /* ADCL_TO_DAC1L */ | ||
| 3632 | #define WM8994_ADCL_TO_DAC1L_SHIFT 4 /* ADCL_TO_DAC1L */ | ||
| 3633 | #define WM8994_ADCL_TO_DAC1L_WIDTH 1 /* ADCL_TO_DAC1L */ | ||
| 3634 | #define WM8994_AIF2DACL_TO_DAC1L 0x0004 /* AIF2DACL_TO_DAC1L */ | ||
| 3635 | #define WM8994_AIF2DACL_TO_DAC1L_MASK 0x0004 /* AIF2DACL_TO_DAC1L */ | ||
| 3636 | #define WM8994_AIF2DACL_TO_DAC1L_SHIFT 2 /* AIF2DACL_TO_DAC1L */ | ||
| 3637 | #define WM8994_AIF2DACL_TO_DAC1L_WIDTH 1 /* AIF2DACL_TO_DAC1L */ | ||
| 3638 | #define WM8994_AIF1DAC2L_TO_DAC1L 0x0002 /* AIF1DAC2L_TO_DAC1L */ | ||
| 3639 | #define WM8994_AIF1DAC2L_TO_DAC1L_MASK 0x0002 /* AIF1DAC2L_TO_DAC1L */ | ||
| 3640 | #define WM8994_AIF1DAC2L_TO_DAC1L_SHIFT 1 /* AIF1DAC2L_TO_DAC1L */ | ||
| 3641 | #define WM8994_AIF1DAC2L_TO_DAC1L_WIDTH 1 /* AIF1DAC2L_TO_DAC1L */ | ||
| 3642 | #define WM8994_AIF1DAC1L_TO_DAC1L 0x0001 /* AIF1DAC1L_TO_DAC1L */ | ||
| 3643 | #define WM8994_AIF1DAC1L_TO_DAC1L_MASK 0x0001 /* AIF1DAC1L_TO_DAC1L */ | ||
| 3644 | #define WM8994_AIF1DAC1L_TO_DAC1L_SHIFT 0 /* AIF1DAC1L_TO_DAC1L */ | ||
| 3645 | #define WM8994_AIF1DAC1L_TO_DAC1L_WIDTH 1 /* AIF1DAC1L_TO_DAC1L */ | ||
| 3646 | |||
| 3647 | /* | ||
| 3648 | * R1538 (0x602) - DAC1 Right Mixer Routing | ||
| 3649 | */ | ||
| 3650 | #define WM8994_ADCR_TO_DAC1R 0x0020 /* ADCR_TO_DAC1R */ | ||
| 3651 | #define WM8994_ADCR_TO_DAC1R_MASK 0x0020 /* ADCR_TO_DAC1R */ | ||
| 3652 | #define WM8994_ADCR_TO_DAC1R_SHIFT 5 /* ADCR_TO_DAC1R */ | ||
| 3653 | #define WM8994_ADCR_TO_DAC1R_WIDTH 1 /* ADCR_TO_DAC1R */ | ||
| 3654 | #define WM8994_ADCL_TO_DAC1R 0x0010 /* ADCL_TO_DAC1R */ | ||
| 3655 | #define WM8994_ADCL_TO_DAC1R_MASK 0x0010 /* ADCL_TO_DAC1R */ | ||
| 3656 | #define WM8994_ADCL_TO_DAC1R_SHIFT 4 /* ADCL_TO_DAC1R */ | ||
| 3657 | #define WM8994_ADCL_TO_DAC1R_WIDTH 1 /* ADCL_TO_DAC1R */ | ||
| 3658 | #define WM8994_AIF2DACR_TO_DAC1R 0x0004 /* AIF2DACR_TO_DAC1R */ | ||
| 3659 | #define WM8994_AIF2DACR_TO_DAC1R_MASK 0x0004 /* AIF2DACR_TO_DAC1R */ | ||
| 3660 | #define WM8994_AIF2DACR_TO_DAC1R_SHIFT 2 /* AIF2DACR_TO_DAC1R */ | ||
| 3661 | #define WM8994_AIF2DACR_TO_DAC1R_WIDTH 1 /* AIF2DACR_TO_DAC1R */ | ||
| 3662 | #define WM8994_AIF1DAC2R_TO_DAC1R 0x0002 /* AIF1DAC2R_TO_DAC1R */ | ||
| 3663 | #define WM8994_AIF1DAC2R_TO_DAC1R_MASK 0x0002 /* AIF1DAC2R_TO_DAC1R */ | ||
| 3664 | #define WM8994_AIF1DAC2R_TO_DAC1R_SHIFT 1 /* AIF1DAC2R_TO_DAC1R */ | ||
| 3665 | #define WM8994_AIF1DAC2R_TO_DAC1R_WIDTH 1 /* AIF1DAC2R_TO_DAC1R */ | ||
| 3666 | #define WM8994_AIF1DAC1R_TO_DAC1R 0x0001 /* AIF1DAC1R_TO_DAC1R */ | ||
| 3667 | #define WM8994_AIF1DAC1R_TO_DAC1R_MASK 0x0001 /* AIF1DAC1R_TO_DAC1R */ | ||
| 3668 | #define WM8994_AIF1DAC1R_TO_DAC1R_SHIFT 0 /* AIF1DAC1R_TO_DAC1R */ | ||
| 3669 | #define WM8994_AIF1DAC1R_TO_DAC1R_WIDTH 1 /* AIF1DAC1R_TO_DAC1R */ | ||
| 3670 | |||
| 3671 | /* | ||
| 3672 | * R1539 (0x603) - DAC2 Mixer Volumes | ||
| 3673 | */ | ||
| 3674 | #define WM8994_ADCR_DAC2_VOL_MASK 0x01E0 /* ADCR_DAC2_VOL - [8:5] */ | ||
| 3675 | #define WM8994_ADCR_DAC2_VOL_SHIFT 5 /* ADCR_DAC2_VOL - [8:5] */ | ||
| 3676 | #define WM8994_ADCR_DAC2_VOL_WIDTH 4 /* ADCR_DAC2_VOL - [8:5] */ | ||
| 3677 | #define WM8994_ADCL_DAC2_VOL_MASK 0x000F /* ADCL_DAC2_VOL - [3:0] */ | ||
| 3678 | #define WM8994_ADCL_DAC2_VOL_SHIFT 0 /* ADCL_DAC2_VOL - [3:0] */ | ||
| 3679 | #define WM8994_ADCL_DAC2_VOL_WIDTH 4 /* ADCL_DAC2_VOL - [3:0] */ | ||
| 3680 | |||
| 3681 | /* | ||
| 3682 | * R1540 (0x604) - DAC2 Left Mixer Routing | ||
| 3683 | */ | ||
| 3684 | #define WM8994_ADCR_TO_DAC2L 0x0020 /* ADCR_TO_DAC2L */ | ||
| 3685 | #define WM8994_ADCR_TO_DAC2L_MASK 0x0020 /* ADCR_TO_DAC2L */ | ||
| 3686 | #define WM8994_ADCR_TO_DAC2L_SHIFT 5 /* ADCR_TO_DAC2L */ | ||
| 3687 | #define WM8994_ADCR_TO_DAC2L_WIDTH 1 /* ADCR_TO_DAC2L */ | ||
| 3688 | #define WM8994_ADCL_TO_DAC2L 0x0010 /* ADCL_TO_DAC2L */ | ||
| 3689 | #define WM8994_ADCL_TO_DAC2L_MASK 0x0010 /* ADCL_TO_DAC2L */ | ||
| 3690 | #define WM8994_ADCL_TO_DAC2L_SHIFT 4 /* ADCL_TO_DAC2L */ | ||
| 3691 | #define WM8994_ADCL_TO_DAC2L_WIDTH 1 /* ADCL_TO_DAC2L */ | ||
| 3692 | #define WM8994_AIF2DACL_TO_DAC2L 0x0004 /* AIF2DACL_TO_DAC2L */ | ||
| 3693 | #define WM8994_AIF2DACL_TO_DAC2L_MASK 0x0004 /* AIF2DACL_TO_DAC2L */ | ||
| 3694 | #define WM8994_AIF2DACL_TO_DAC2L_SHIFT 2 /* AIF2DACL_TO_DAC2L */ | ||
| 3695 | #define WM8994_AIF2DACL_TO_DAC2L_WIDTH 1 /* AIF2DACL_TO_DAC2L */ | ||
| 3696 | #define WM8994_AIF1DAC2L_TO_DAC2L 0x0002 /* AIF1DAC2L_TO_DAC2L */ | ||
| 3697 | #define WM8994_AIF1DAC2L_TO_DAC2L_MASK 0x0002 /* AIF1DAC2L_TO_DAC2L */ | ||
| 3698 | #define WM8994_AIF1DAC2L_TO_DAC2L_SHIFT 1 /* AIF1DAC2L_TO_DAC2L */ | ||
| 3699 | #define WM8994_AIF1DAC2L_TO_DAC2L_WIDTH 1 /* AIF1DAC2L_TO_DAC2L */ | ||
| 3700 | #define WM8994_AIF1DAC1L_TO_DAC2L 0x0001 /* AIF1DAC1L_TO_DAC2L */ | ||
| 3701 | #define WM8994_AIF1DAC1L_TO_DAC2L_MASK 0x0001 /* AIF1DAC1L_TO_DAC2L */ | ||
| 3702 | #define WM8994_AIF1DAC1L_TO_DAC2L_SHIFT 0 /* AIF1DAC1L_TO_DAC2L */ | ||
| 3703 | #define WM8994_AIF1DAC1L_TO_DAC2L_WIDTH 1 /* AIF1DAC1L_TO_DAC2L */ | ||
| 3704 | |||
| 3705 | /* | ||
| 3706 | * R1541 (0x605) - DAC2 Right Mixer Routing | ||
| 3707 | */ | ||
| 3708 | #define WM8994_ADCR_TO_DAC2R 0x0020 /* ADCR_TO_DAC2R */ | ||
| 3709 | #define WM8994_ADCR_TO_DAC2R_MASK 0x0020 /* ADCR_TO_DAC2R */ | ||
| 3710 | #define WM8994_ADCR_TO_DAC2R_SHIFT 5 /* ADCR_TO_DAC2R */ | ||
| 3711 | #define WM8994_ADCR_TO_DAC2R_WIDTH 1 /* ADCR_TO_DAC2R */ | ||
| 3712 | #define WM8994_ADCL_TO_DAC2R 0x0010 /* ADCL_TO_DAC2R */ | ||
| 3713 | #define WM8994_ADCL_TO_DAC2R_MASK 0x0010 /* ADCL_TO_DAC2R */ | ||
| 3714 | #define WM8994_ADCL_TO_DAC2R_SHIFT 4 /* ADCL_TO_DAC2R */ | ||
| 3715 | #define WM8994_ADCL_TO_DAC2R_WIDTH 1 /* ADCL_TO_DAC2R */ | ||
| 3716 | #define WM8994_AIF2DACR_TO_DAC2R 0x0004 /* AIF2DACR_TO_DAC2R */ | ||
| 3717 | #define WM8994_AIF2DACR_TO_DAC2R_MASK 0x0004 /* AIF2DACR_TO_DAC2R */ | ||
| 3718 | #define WM8994_AIF2DACR_TO_DAC2R_SHIFT 2 /* AIF2DACR_TO_DAC2R */ | ||
| 3719 | #define WM8994_AIF2DACR_TO_DAC2R_WIDTH 1 /* AIF2DACR_TO_DAC2R */ | ||
| 3720 | #define WM8994_AIF1DAC2R_TO_DAC2R 0x0002 /* AIF1DAC2R_TO_DAC2R */ | ||
| 3721 | #define WM8994_AIF1DAC2R_TO_DAC2R_MASK 0x0002 /* AIF1DAC2R_TO_DAC2R */ | ||
| 3722 | #define WM8994_AIF1DAC2R_TO_DAC2R_SHIFT 1 /* AIF1DAC2R_TO_DAC2R */ | ||
| 3723 | #define WM8994_AIF1DAC2R_TO_DAC2R_WIDTH 1 /* AIF1DAC2R_TO_DAC2R */ | ||
| 3724 | #define WM8994_AIF1DAC1R_TO_DAC2R 0x0001 /* AIF1DAC1R_TO_DAC2R */ | ||
| 3725 | #define WM8994_AIF1DAC1R_TO_DAC2R_MASK 0x0001 /* AIF1DAC1R_TO_DAC2R */ | ||
| 3726 | #define WM8994_AIF1DAC1R_TO_DAC2R_SHIFT 0 /* AIF1DAC1R_TO_DAC2R */ | ||
| 3727 | #define WM8994_AIF1DAC1R_TO_DAC2R_WIDTH 1 /* AIF1DAC1R_TO_DAC2R */ | ||
| 3728 | |||
| 3729 | /* | ||
| 3730 | * R1542 (0x606) - AIF1 ADC1 Left Mixer Routing | ||
| 3731 | */ | ||
| 3732 | #define WM8994_ADC1L_TO_AIF1ADC1L 0x0002 /* ADC1L_TO_AIF1ADC1L */ | ||
| 3733 | #define WM8994_ADC1L_TO_AIF1ADC1L_MASK 0x0002 /* ADC1L_TO_AIF1ADC1L */ | ||
| 3734 | #define WM8994_ADC1L_TO_AIF1ADC1L_SHIFT 1 /* ADC1L_TO_AIF1ADC1L */ | ||
| 3735 | #define WM8994_ADC1L_TO_AIF1ADC1L_WIDTH 1 /* ADC1L_TO_AIF1ADC1L */ | ||
| 3736 | #define WM8994_AIF2DACL_TO_AIF1ADC1L 0x0001 /* AIF2DACL_TO_AIF1ADC1L */ | ||
| 3737 | #define WM8994_AIF2DACL_TO_AIF1ADC1L_MASK 0x0001 /* AIF2DACL_TO_AIF1ADC1L */ | ||
| 3738 | #define WM8994_AIF2DACL_TO_AIF1ADC1L_SHIFT 0 /* AIF2DACL_TO_AIF1ADC1L */ | ||
| 3739 | #define WM8994_AIF2DACL_TO_AIF1ADC1L_WIDTH 1 /* AIF2DACL_TO_AIF1ADC1L */ | ||
| 3740 | |||
| 3741 | /* | ||
| 3742 | * R1543 (0x607) - AIF1 ADC1 Right Mixer Routing | ||
| 3743 | */ | ||
| 3744 | #define WM8994_ADC1R_TO_AIF1ADC1R 0x0002 /* ADC1R_TO_AIF1ADC1R */ | ||
| 3745 | #define WM8994_ADC1R_TO_AIF1ADC1R_MASK 0x0002 /* ADC1R_TO_AIF1ADC1R */ | ||
| 3746 | #define WM8994_ADC1R_TO_AIF1ADC1R_SHIFT 1 /* ADC1R_TO_AIF1ADC1R */ | ||
| 3747 | #define WM8994_ADC1R_TO_AIF1ADC1R_WIDTH 1 /* ADC1R_TO_AIF1ADC1R */ | ||
| 3748 | #define WM8994_AIF2DACR_TO_AIF1ADC1R 0x0001 /* AIF2DACR_TO_AIF1ADC1R */ | ||
| 3749 | #define WM8994_AIF2DACR_TO_AIF1ADC1R_MASK 0x0001 /* AIF2DACR_TO_AIF1ADC1R */ | ||
| 3750 | #define WM8994_AIF2DACR_TO_AIF1ADC1R_SHIFT 0 /* AIF2DACR_TO_AIF1ADC1R */ | ||
| 3751 | #define WM8994_AIF2DACR_TO_AIF1ADC1R_WIDTH 1 /* AIF2DACR_TO_AIF1ADC1R */ | ||
| 3752 | |||
| 3753 | /* | ||
| 3754 | * R1544 (0x608) - AIF1 ADC2 Left Mixer Routing | ||
| 3755 | */ | ||
| 3756 | #define WM8994_ADC2L_TO_AIF1ADC2L 0x0002 /* ADC2L_TO_AIF1ADC2L */ | ||
| 3757 | #define WM8994_ADC2L_TO_AIF1ADC2L_MASK 0x0002 /* ADC2L_TO_AIF1ADC2L */ | ||
| 3758 | #define WM8994_ADC2L_TO_AIF1ADC2L_SHIFT 1 /* ADC2L_TO_AIF1ADC2L */ | ||
| 3759 | #define WM8994_ADC2L_TO_AIF1ADC2L_WIDTH 1 /* ADC2L_TO_AIF1ADC2L */ | ||
| 3760 | #define WM8994_AIF2DACL_TO_AIF1ADC2L 0x0001 /* AIF2DACL_TO_AIF1ADC2L */ | ||
| 3761 | #define WM8994_AIF2DACL_TO_AIF1ADC2L_MASK 0x0001 /* AIF2DACL_TO_AIF1ADC2L */ | ||
| 3762 | #define WM8994_AIF2DACL_TO_AIF1ADC2L_SHIFT 0 /* AIF2DACL_TO_AIF1ADC2L */ | ||
| 3763 | #define WM8994_AIF2DACL_TO_AIF1ADC2L_WIDTH 1 /* AIF2DACL_TO_AIF1ADC2L */ | ||
| 3764 | |||
| 3765 | /* | ||
| 3766 | * R1545 (0x609) - AIF1 ADC2 Right mixer Routing | ||
| 3767 | */ | ||
| 3768 | #define WM8994_ADC2R_TO_AIF1ADC2R 0x0002 /* ADC2R_TO_AIF1ADC2R */ | ||
| 3769 | #define WM8994_ADC2R_TO_AIF1ADC2R_MASK 0x0002 /* ADC2R_TO_AIF1ADC2R */ | ||
| 3770 | #define WM8994_ADC2R_TO_AIF1ADC2R_SHIFT 1 /* ADC2R_TO_AIF1ADC2R */ | ||
| 3771 | #define WM8994_ADC2R_TO_AIF1ADC2R_WIDTH 1 /* ADC2R_TO_AIF1ADC2R */ | ||
| 3772 | #define WM8994_AIF2DACR_TO_AIF1ADC2R 0x0001 /* AIF2DACR_TO_AIF1ADC2R */ | ||
| 3773 | #define WM8994_AIF2DACR_TO_AIF1ADC2R_MASK 0x0001 /* AIF2DACR_TO_AIF1ADC2R */ | ||
| 3774 | #define WM8994_AIF2DACR_TO_AIF1ADC2R_SHIFT 0 /* AIF2DACR_TO_AIF1ADC2R */ | ||
| 3775 | #define WM8994_AIF2DACR_TO_AIF1ADC2R_WIDTH 1 /* AIF2DACR_TO_AIF1ADC2R */ | ||
| 3776 | |||
| 3777 | /* | ||
| 3778 | * R1552 (0x610) - DAC1 Left Volume | ||
| 3779 | */ | ||
| 3780 | #define WM8994_DAC1L_MUTE 0x0200 /* DAC1L_MUTE */ | ||
| 3781 | #define WM8994_DAC1L_MUTE_MASK 0x0200 /* DAC1L_MUTE */ | ||
| 3782 | #define WM8994_DAC1L_MUTE_SHIFT 9 /* DAC1L_MUTE */ | ||
| 3783 | #define WM8994_DAC1L_MUTE_WIDTH 1 /* DAC1L_MUTE */ | ||
| 3784 | #define WM8994_DAC1_VU 0x0100 /* DAC1_VU */ | ||
| 3785 | #define WM8994_DAC1_VU_MASK 0x0100 /* DAC1_VU */ | ||
| 3786 | #define WM8994_DAC1_VU_SHIFT 8 /* DAC1_VU */ | ||
| 3787 | #define WM8994_DAC1_VU_WIDTH 1 /* DAC1_VU */ | ||
| 3788 | #define WM8994_DAC1L_VOL_MASK 0x00FF /* DAC1L_VOL - [7:0] */ | ||
| 3789 | #define WM8994_DAC1L_VOL_SHIFT 0 /* DAC1L_VOL - [7:0] */ | ||
| 3790 | #define WM8994_DAC1L_VOL_WIDTH 8 /* DAC1L_VOL - [7:0] */ | ||
| 3791 | |||
| 3792 | /* | ||
| 3793 | * R1553 (0x611) - DAC1 Right Volume | ||
| 3794 | */ | ||
| 3795 | #define WM8994_DAC1R_MUTE 0x0200 /* DAC1R_MUTE */ | ||
| 3796 | #define WM8994_DAC1R_MUTE_MASK 0x0200 /* DAC1R_MUTE */ | ||
| 3797 | #define WM8994_DAC1R_MUTE_SHIFT 9 /* DAC1R_MUTE */ | ||
| 3798 | #define WM8994_DAC1R_MUTE_WIDTH 1 /* DAC1R_MUTE */ | ||
| 3799 | #define WM8994_DAC1_VU 0x0100 /* DAC1_VU */ | ||
| 3800 | #define WM8994_DAC1_VU_MASK 0x0100 /* DAC1_VU */ | ||
| 3801 | #define WM8994_DAC1_VU_SHIFT 8 /* DAC1_VU */ | ||
| 3802 | #define WM8994_DAC1_VU_WIDTH 1 /* DAC1_VU */ | ||
| 3803 | #define WM8994_DAC1R_VOL_MASK 0x00FF /* DAC1R_VOL - [7:0] */ | ||
| 3804 | #define WM8994_DAC1R_VOL_SHIFT 0 /* DAC1R_VOL - [7:0] */ | ||
| 3805 | #define WM8994_DAC1R_VOL_WIDTH 8 /* DAC1R_VOL - [7:0] */ | ||
| 3806 | |||
| 3807 | /* | ||
| 3808 | * R1554 (0x612) - DAC2 Left Volume | ||
| 3809 | */ | ||
| 3810 | #define WM8994_DAC2L_MUTE 0x0200 /* DAC2L_MUTE */ | ||
| 3811 | #define WM8994_DAC2L_MUTE_MASK 0x0200 /* DAC2L_MUTE */ | ||
| 3812 | #define WM8994_DAC2L_MUTE_SHIFT 9 /* DAC2L_MUTE */ | ||
| 3813 | #define WM8994_DAC2L_MUTE_WIDTH 1 /* DAC2L_MUTE */ | ||
| 3814 | #define WM8994_DAC2_VU 0x0100 /* DAC2_VU */ | ||
| 3815 | #define WM8994_DAC2_VU_MASK 0x0100 /* DAC2_VU */ | ||
| 3816 | #define WM8994_DAC2_VU_SHIFT 8 /* DAC2_VU */ | ||
| 3817 | #define WM8994_DAC2_VU_WIDTH 1 /* DAC2_VU */ | ||
| 3818 | #define WM8994_DAC2L_VOL_MASK 0x00FF /* DAC2L_VOL - [7:0] */ | ||
| 3819 | #define WM8994_DAC2L_VOL_SHIFT 0 /* DAC2L_VOL - [7:0] */ | ||
| 3820 | #define WM8994_DAC2L_VOL_WIDTH 8 /* DAC2L_VOL - [7:0] */ | ||
| 3821 | |||
| 3822 | /* | ||
| 3823 | * R1555 (0x613) - DAC2 Right Volume | ||
| 3824 | */ | ||
| 3825 | #define WM8994_DAC2R_MUTE 0x0200 /* DAC2R_MUTE */ | ||
| 3826 | #define WM8994_DAC2R_MUTE_MASK 0x0200 /* DAC2R_MUTE */ | ||
| 3827 | #define WM8994_DAC2R_MUTE_SHIFT 9 /* DAC2R_MUTE */ | ||
| 3828 | #define WM8994_DAC2R_MUTE_WIDTH 1 /* DAC2R_MUTE */ | ||
| 3829 | #define WM8994_DAC2_VU 0x0100 /* DAC2_VU */ | ||
| 3830 | #define WM8994_DAC2_VU_MASK 0x0100 /* DAC2_VU */ | ||
| 3831 | #define WM8994_DAC2_VU_SHIFT 8 /* DAC2_VU */ | ||
| 3832 | #define WM8994_DAC2_VU_WIDTH 1 /* DAC2_VU */ | ||
| 3833 | #define WM8994_DAC2R_VOL_MASK 0x00FF /* DAC2R_VOL - [7:0] */ | ||
| 3834 | #define WM8994_DAC2R_VOL_SHIFT 0 /* DAC2R_VOL - [7:0] */ | ||
| 3835 | #define WM8994_DAC2R_VOL_WIDTH 8 /* DAC2R_VOL - [7:0] */ | ||
| 3836 | |||
| 3837 | /* | ||
| 3838 | * R1556 (0x614) - DAC Softmute | ||
| 3839 | */ | ||
| 3840 | #define WM8994_DAC_SOFTMUTEMODE 0x0002 /* DAC_SOFTMUTEMODE */ | ||
| 3841 | #define WM8994_DAC_SOFTMUTEMODE_MASK 0x0002 /* DAC_SOFTMUTEMODE */ | ||
| 3842 | #define WM8994_DAC_SOFTMUTEMODE_SHIFT 1 /* DAC_SOFTMUTEMODE */ | ||
| 3843 | #define WM8994_DAC_SOFTMUTEMODE_WIDTH 1 /* DAC_SOFTMUTEMODE */ | ||
| 3844 | #define WM8994_DAC_MUTERATE 0x0001 /* DAC_MUTERATE */ | ||
| 3845 | #define WM8994_DAC_MUTERATE_MASK 0x0001 /* DAC_MUTERATE */ | ||
| 3846 | #define WM8994_DAC_MUTERATE_SHIFT 0 /* DAC_MUTERATE */ | ||
| 3847 | #define WM8994_DAC_MUTERATE_WIDTH 1 /* DAC_MUTERATE */ | ||
| 3848 | |||
| 3849 | /* | ||
| 3850 | * R1568 (0x620) - Oversampling | ||
| 3851 | */ | ||
| 3852 | #define WM8994_ADC_OSR128 0x0002 /* ADC_OSR128 */ | ||
| 3853 | #define WM8994_ADC_OSR128_MASK 0x0002 /* ADC_OSR128 */ | ||
| 3854 | #define WM8994_ADC_OSR128_SHIFT 1 /* ADC_OSR128 */ | ||
| 3855 | #define WM8994_ADC_OSR128_WIDTH 1 /* ADC_OSR128 */ | ||
| 3856 | #define WM8994_DAC_OSR128 0x0001 /* DAC_OSR128 */ | ||
| 3857 | #define WM8994_DAC_OSR128_MASK 0x0001 /* DAC_OSR128 */ | ||
| 3858 | #define WM8994_DAC_OSR128_SHIFT 0 /* DAC_OSR128 */ | ||
| 3859 | #define WM8994_DAC_OSR128_WIDTH 1 /* DAC_OSR128 */ | ||
| 3860 | |||
| 3861 | /* | ||
| 3862 | * R1569 (0x621) - Sidetone | ||
| 3863 | */ | ||
| 3864 | #define WM8994_ST_HPF_CUT_MASK 0x0380 /* ST_HPF_CUT - [9:7] */ | ||
| 3865 | #define WM8994_ST_HPF_CUT_SHIFT 7 /* ST_HPF_CUT - [9:7] */ | ||
| 3866 | #define WM8994_ST_HPF_CUT_WIDTH 3 /* ST_HPF_CUT - [9:7] */ | ||
| 3867 | #define WM8994_ST_HPF 0x0040 /* ST_HPF */ | ||
| 3868 | #define WM8994_ST_HPF_MASK 0x0040 /* ST_HPF */ | ||
| 3869 | #define WM8994_ST_HPF_SHIFT 6 /* ST_HPF */ | ||
| 3870 | #define WM8994_ST_HPF_WIDTH 1 /* ST_HPF */ | ||
| 3871 | #define WM8994_STR_SEL 0x0002 /* STR_SEL */ | ||
| 3872 | #define WM8994_STR_SEL_MASK 0x0002 /* STR_SEL */ | ||
| 3873 | #define WM8994_STR_SEL_SHIFT 1 /* STR_SEL */ | ||
| 3874 | #define WM8994_STR_SEL_WIDTH 1 /* STR_SEL */ | ||
| 3875 | #define WM8994_STL_SEL 0x0001 /* STL_SEL */ | ||
| 3876 | #define WM8994_STL_SEL_MASK 0x0001 /* STL_SEL */ | ||
| 3877 | #define WM8994_STL_SEL_SHIFT 0 /* STL_SEL */ | ||
| 3878 | #define WM8994_STL_SEL_WIDTH 1 /* STL_SEL */ | ||
| 3879 | |||
| 3880 | /* | ||
| 3881 | * R1824 (0x720) - Pull Control (1) | ||
| 3882 | */ | ||
| 3883 | #define WM8994_DMICDAT2_PU 0x0800 /* DMICDAT2_PU */ | ||
| 3884 | #define WM8994_DMICDAT2_PU_MASK 0x0800 /* DMICDAT2_PU */ | ||
| 3885 | #define WM8994_DMICDAT2_PU_SHIFT 11 /* DMICDAT2_PU */ | ||
| 3886 | #define WM8994_DMICDAT2_PU_WIDTH 1 /* DMICDAT2_PU */ | ||
| 3887 | #define WM8994_DMICDAT2_PD 0x0400 /* DMICDAT2_PD */ | ||
| 3888 | #define WM8994_DMICDAT2_PD_MASK 0x0400 /* DMICDAT2_PD */ | ||
| 3889 | #define WM8994_DMICDAT2_PD_SHIFT 10 /* DMICDAT2_PD */ | ||
| 3890 | #define WM8994_DMICDAT2_PD_WIDTH 1 /* DMICDAT2_PD */ | ||
| 3891 | #define WM8994_DMICDAT1_PU 0x0200 /* DMICDAT1_PU */ | ||
| 3892 | #define WM8994_DMICDAT1_PU_MASK 0x0200 /* DMICDAT1_PU */ | ||
| 3893 | #define WM8994_DMICDAT1_PU_SHIFT 9 /* DMICDAT1_PU */ | ||
| 3894 | #define WM8994_DMICDAT1_PU_WIDTH 1 /* DMICDAT1_PU */ | ||
| 3895 | #define WM8994_DMICDAT1_PD 0x0100 /* DMICDAT1_PD */ | ||
| 3896 | #define WM8994_DMICDAT1_PD_MASK 0x0100 /* DMICDAT1_PD */ | ||
| 3897 | #define WM8994_DMICDAT1_PD_SHIFT 8 /* DMICDAT1_PD */ | ||
| 3898 | #define WM8994_DMICDAT1_PD_WIDTH 1 /* DMICDAT1_PD */ | ||
| 3899 | #define WM8994_MCLK1_PU 0x0080 /* MCLK1_PU */ | ||
| 3900 | #define WM8994_MCLK1_PU_MASK 0x0080 /* MCLK1_PU */ | ||
| 3901 | #define WM8994_MCLK1_PU_SHIFT 7 /* MCLK1_PU */ | ||
| 3902 | #define WM8994_MCLK1_PU_WIDTH 1 /* MCLK1_PU */ | ||
| 3903 | #define WM8994_MCLK1_PD 0x0040 /* MCLK1_PD */ | ||
| 3904 | #define WM8994_MCLK1_PD_MASK 0x0040 /* MCLK1_PD */ | ||
| 3905 | #define WM8994_MCLK1_PD_SHIFT 6 /* MCLK1_PD */ | ||
| 3906 | #define WM8994_MCLK1_PD_WIDTH 1 /* MCLK1_PD */ | ||
| 3907 | #define WM8994_DACDAT1_PU 0x0020 /* DACDAT1_PU */ | ||
| 3908 | #define WM8994_DACDAT1_PU_MASK 0x0020 /* DACDAT1_PU */ | ||
| 3909 | #define WM8994_DACDAT1_PU_SHIFT 5 /* DACDAT1_PU */ | ||
| 3910 | #define WM8994_DACDAT1_PU_WIDTH 1 /* DACDAT1_PU */ | ||
| 3911 | #define WM8994_DACDAT1_PD 0x0010 /* DACDAT1_PD */ | ||
| 3912 | #define WM8994_DACDAT1_PD_MASK 0x0010 /* DACDAT1_PD */ | ||
| 3913 | #define WM8994_DACDAT1_PD_SHIFT 4 /* DACDAT1_PD */ | ||
| 3914 | #define WM8994_DACDAT1_PD_WIDTH 1 /* DACDAT1_PD */ | ||
| 3915 | #define WM8994_DACLRCLK1_PU 0x0008 /* DACLRCLK1_PU */ | ||
| 3916 | #define WM8994_DACLRCLK1_PU_MASK 0x0008 /* DACLRCLK1_PU */ | ||
| 3917 | #define WM8994_DACLRCLK1_PU_SHIFT 3 /* DACLRCLK1_PU */ | ||
| 3918 | #define WM8994_DACLRCLK1_PU_WIDTH 1 /* DACLRCLK1_PU */ | ||
| 3919 | #define WM8994_DACLRCLK1_PD 0x0004 /* DACLRCLK1_PD */ | ||
| 3920 | #define WM8994_DACLRCLK1_PD_MASK 0x0004 /* DACLRCLK1_PD */ | ||
| 3921 | #define WM8994_DACLRCLK1_PD_SHIFT 2 /* DACLRCLK1_PD */ | ||
| 3922 | #define WM8994_DACLRCLK1_PD_WIDTH 1 /* DACLRCLK1_PD */ | ||
| 3923 | #define WM8994_BCLK1_PU 0x0002 /* BCLK1_PU */ | ||
| 3924 | #define WM8994_BCLK1_PU_MASK 0x0002 /* BCLK1_PU */ | ||
| 3925 | #define WM8994_BCLK1_PU_SHIFT 1 /* BCLK1_PU */ | ||
| 3926 | #define WM8994_BCLK1_PU_WIDTH 1 /* BCLK1_PU */ | ||
| 3927 | #define WM8994_BCLK1_PD 0x0001 /* BCLK1_PD */ | ||
| 3928 | #define WM8994_BCLK1_PD_MASK 0x0001 /* BCLK1_PD */ | ||
| 3929 | #define WM8994_BCLK1_PD_SHIFT 0 /* BCLK1_PD */ | ||
| 3930 | #define WM8994_BCLK1_PD_WIDTH 1 /* BCLK1_PD */ | ||
| 3931 | |||
| 3932 | /* | ||
| 3933 | * R1825 (0x721) - Pull Control (2) | ||
| 3934 | */ | ||
| 3935 | #define WM8994_CSNADDR_PD 0x0100 /* CSNADDR_PD */ | ||
| 3936 | #define WM8994_CSNADDR_PD_MASK 0x0100 /* CSNADDR_PD */ | ||
| 3937 | #define WM8994_CSNADDR_PD_SHIFT 8 /* CSNADDR_PD */ | ||
| 3938 | #define WM8994_CSNADDR_PD_WIDTH 1 /* CSNADDR_PD */ | ||
| 3939 | #define WM8994_LDO2ENA_PD 0x0040 /* LDO2ENA_PD */ | ||
| 3940 | #define WM8994_LDO2ENA_PD_MASK 0x0040 /* LDO2ENA_PD */ | ||
| 3941 | #define WM8994_LDO2ENA_PD_SHIFT 6 /* LDO2ENA_PD */ | ||
| 3942 | #define WM8994_LDO2ENA_PD_WIDTH 1 /* LDO2ENA_PD */ | ||
| 3943 | #define WM8994_LDO1ENA_PD 0x0010 /* LDO1ENA_PD */ | ||
| 3944 | #define WM8994_LDO1ENA_PD_MASK 0x0010 /* LDO1ENA_PD */ | ||
| 3945 | #define WM8994_LDO1ENA_PD_SHIFT 4 /* LDO1ENA_PD */ | ||
| 3946 | #define WM8994_LDO1ENA_PD_WIDTH 1 /* LDO1ENA_PD */ | ||
| 3947 | #define WM8994_CIFMODE_PD 0x0004 /* CIFMODE_PD */ | ||
| 3948 | #define WM8994_CIFMODE_PD_MASK 0x0004 /* CIFMODE_PD */ | ||
| 3949 | #define WM8994_CIFMODE_PD_SHIFT 2 /* CIFMODE_PD */ | ||
| 3950 | #define WM8994_CIFMODE_PD_WIDTH 1 /* CIFMODE_PD */ | ||
| 3951 | #define WM8994_SPKMODE_PU 0x0002 /* SPKMODE_PU */ | ||
| 3952 | #define WM8994_SPKMODE_PU_MASK 0x0002 /* SPKMODE_PU */ | ||
| 3953 | #define WM8994_SPKMODE_PU_SHIFT 1 /* SPKMODE_PU */ | ||
| 3954 | #define WM8994_SPKMODE_PU_WIDTH 1 /* SPKMODE_PU */ | ||
| 3955 | |||
| 3956 | /* | ||
| 3957 | * R1840 (0x730) - Interrupt Status 1 | ||
| 3958 | */ | ||
| 3959 | #define WM8994_GP11_EINT 0x0400 /* GP11_EINT */ | ||
| 3960 | #define WM8994_GP11_EINT_MASK 0x0400 /* GP11_EINT */ | ||
| 3961 | #define WM8994_GP11_EINT_SHIFT 10 /* GP11_EINT */ | ||
| 3962 | #define WM8994_GP11_EINT_WIDTH 1 /* GP11_EINT */ | ||
| 3963 | #define WM8994_GP10_EINT 0x0200 /* GP10_EINT */ | ||
| 3964 | #define WM8994_GP10_EINT_MASK 0x0200 /* GP10_EINT */ | ||
| 3965 | #define WM8994_GP10_EINT_SHIFT 9 /* GP10_EINT */ | ||
| 3966 | #define WM8994_GP10_EINT_WIDTH 1 /* GP10_EINT */ | ||
| 3967 | #define WM8994_GP9_EINT 0x0100 /* GP9_EINT */ | ||
| 3968 | #define WM8994_GP9_EINT_MASK 0x0100 /* GP9_EINT */ | ||
| 3969 | #define WM8994_GP9_EINT_SHIFT 8 /* GP9_EINT */ | ||
| 3970 | #define WM8994_GP9_EINT_WIDTH 1 /* GP9_EINT */ | ||
| 3971 | #define WM8994_GP8_EINT 0x0080 /* GP8_EINT */ | ||
| 3972 | #define WM8994_GP8_EINT_MASK 0x0080 /* GP8_EINT */ | ||
| 3973 | #define WM8994_GP8_EINT_SHIFT 7 /* GP8_EINT */ | ||
| 3974 | #define WM8994_GP8_EINT_WIDTH 1 /* GP8_EINT */ | ||
| 3975 | #define WM8994_GP7_EINT 0x0040 /* GP7_EINT */ | ||
| 3976 | #define WM8994_GP7_EINT_MASK 0x0040 /* GP7_EINT */ | ||
| 3977 | #define WM8994_GP7_EINT_SHIFT 6 /* GP7_EINT */ | ||
| 3978 | #define WM8994_GP7_EINT_WIDTH 1 /* GP7_EINT */ | ||
| 3979 | #define WM8994_GP6_EINT 0x0020 /* GP6_EINT */ | ||
| 3980 | #define WM8994_GP6_EINT_MASK 0x0020 /* GP6_EINT */ | ||
| 3981 | #define WM8994_GP6_EINT_SHIFT 5 /* GP6_EINT */ | ||
| 3982 | #define WM8994_GP6_EINT_WIDTH 1 /* GP6_EINT */ | ||
| 3983 | #define WM8994_GP5_EINT 0x0010 /* GP5_EINT */ | ||
| 3984 | #define WM8994_GP5_EINT_MASK 0x0010 /* GP5_EINT */ | ||
| 3985 | #define WM8994_GP5_EINT_SHIFT 4 /* GP5_EINT */ | ||
| 3986 | #define WM8994_GP5_EINT_WIDTH 1 /* GP5_EINT */ | ||
| 3987 | #define WM8994_GP4_EINT 0x0008 /* GP4_EINT */ | ||
| 3988 | #define WM8994_GP4_EINT_MASK 0x0008 /* GP4_EINT */ | ||
| 3989 | #define WM8994_GP4_EINT_SHIFT 3 /* GP4_EINT */ | ||
| 3990 | #define WM8994_GP4_EINT_WIDTH 1 /* GP4_EINT */ | ||
| 3991 | #define WM8994_GP3_EINT 0x0004 /* GP3_EINT */ | ||
| 3992 | #define WM8994_GP3_EINT_MASK 0x0004 /* GP3_EINT */ | ||
| 3993 | #define WM8994_GP3_EINT_SHIFT 2 /* GP3_EINT */ | ||
| 3994 | #define WM8994_GP3_EINT_WIDTH 1 /* GP3_EINT */ | ||
| 3995 | #define WM8994_GP2_EINT 0x0002 /* GP2_EINT */ | ||
| 3996 | #define WM8994_GP2_EINT_MASK 0x0002 /* GP2_EINT */ | ||
| 3997 | #define WM8994_GP2_EINT_SHIFT 1 /* GP2_EINT */ | ||
| 3998 | #define WM8994_GP2_EINT_WIDTH 1 /* GP2_EINT */ | ||
| 3999 | #define WM8994_GP1_EINT 0x0001 /* GP1_EINT */ | ||
| 4000 | #define WM8994_GP1_EINT_MASK 0x0001 /* GP1_EINT */ | ||
| 4001 | #define WM8994_GP1_EINT_SHIFT 0 /* GP1_EINT */ | ||
| 4002 | #define WM8994_GP1_EINT_WIDTH 1 /* GP1_EINT */ | ||
| 4003 | |||
| 4004 | /* | ||
| 4005 | * R1841 (0x731) - Interrupt Status 2 | ||
| 4006 | */ | ||
| 4007 | #define WM8994_TEMP_WARN_EINT 0x8000 /* TEMP_WARN_EINT */ | ||
| 4008 | #define WM8994_TEMP_WARN_EINT_MASK 0x8000 /* TEMP_WARN_EINT */ | ||
| 4009 | #define WM8994_TEMP_WARN_EINT_SHIFT 15 /* TEMP_WARN_EINT */ | ||
| 4010 | #define WM8994_TEMP_WARN_EINT_WIDTH 1 /* TEMP_WARN_EINT */ | ||
| 4011 | #define WM8994_DCS_DONE_EINT 0x4000 /* DCS_DONE_EINT */ | ||
| 4012 | #define WM8994_DCS_DONE_EINT_MASK 0x4000 /* DCS_DONE_EINT */ | ||
| 4013 | #define WM8994_DCS_DONE_EINT_SHIFT 14 /* DCS_DONE_EINT */ | ||
| 4014 | #define WM8994_DCS_DONE_EINT_WIDTH 1 /* DCS_DONE_EINT */ | ||
| 4015 | #define WM8994_WSEQ_DONE_EINT 0x2000 /* WSEQ_DONE_EINT */ | ||
| 4016 | #define WM8994_WSEQ_DONE_EINT_MASK 0x2000 /* WSEQ_DONE_EINT */ | ||
| 4017 | #define WM8994_WSEQ_DONE_EINT_SHIFT 13 /* WSEQ_DONE_EINT */ | ||
| 4018 | #define WM8994_WSEQ_DONE_EINT_WIDTH 1 /* WSEQ_DONE_EINT */ | ||
| 4019 | #define WM8994_FIFOS_ERR_EINT 0x1000 /* FIFOS_ERR_EINT */ | ||
| 4020 | #define WM8994_FIFOS_ERR_EINT_MASK 0x1000 /* FIFOS_ERR_EINT */ | ||
| 4021 | #define WM8994_FIFOS_ERR_EINT_SHIFT 12 /* FIFOS_ERR_EINT */ | ||
| 4022 | #define WM8994_FIFOS_ERR_EINT_WIDTH 1 /* FIFOS_ERR_EINT */ | ||
| 4023 | #define WM8994_AIF2DRC_SIG_DET_EINT 0x0800 /* AIF2DRC_SIG_DET_EINT */ | ||
| 4024 | #define WM8994_AIF2DRC_SIG_DET_EINT_MASK 0x0800 /* AIF2DRC_SIG_DET_EINT */ | ||
| 4025 | #define WM8994_AIF2DRC_SIG_DET_EINT_SHIFT 11 /* AIF2DRC_SIG_DET_EINT */ | ||
| 4026 | #define WM8994_AIF2DRC_SIG_DET_EINT_WIDTH 1 /* AIF2DRC_SIG_DET_EINT */ | ||
| 4027 | #define WM8994_AIF1DRC2_SIG_DET_EINT 0x0400 /* AIF1DRC2_SIG_DET_EINT */ | ||
| 4028 | #define WM8994_AIF1DRC2_SIG_DET_EINT_MASK 0x0400 /* AIF1DRC2_SIG_DET_EINT */ | ||
| 4029 | #define WM8994_AIF1DRC2_SIG_DET_EINT_SHIFT 10 /* AIF1DRC2_SIG_DET_EINT */ | ||
| 4030 | #define WM8994_AIF1DRC2_SIG_DET_EINT_WIDTH 1 /* AIF1DRC2_SIG_DET_EINT */ | ||
| 4031 | #define WM8994_AIF1DRC1_SIG_DET_EINT 0x0200 /* AIF1DRC1_SIG_DET_EINT */ | ||
| 4032 | #define WM8994_AIF1DRC1_SIG_DET_EINT_MASK 0x0200 /* AIF1DRC1_SIG_DET_EINT */ | ||
| 4033 | #define WM8994_AIF1DRC1_SIG_DET_EINT_SHIFT 9 /* AIF1DRC1_SIG_DET_EINT */ | ||
| 4034 | #define WM8994_AIF1DRC1_SIG_DET_EINT_WIDTH 1 /* AIF1DRC1_SIG_DET_EINT */ | ||
| 4035 | #define WM8994_SRC2_LOCK_EINT 0x0100 /* SRC2_LOCK_EINT */ | ||
| 4036 | #define WM8994_SRC2_LOCK_EINT_MASK 0x0100 /* SRC2_LOCK_EINT */ | ||
| 4037 | #define WM8994_SRC2_LOCK_EINT_SHIFT 8 /* SRC2_LOCK_EINT */ | ||
| 4038 | #define WM8994_SRC2_LOCK_EINT_WIDTH 1 /* SRC2_LOCK_EINT */ | ||
| 4039 | #define WM8994_SRC1_LOCK_EINT 0x0080 /* SRC1_LOCK_EINT */ | ||
| 4040 | #define WM8994_SRC1_LOCK_EINT_MASK 0x0080 /* SRC1_LOCK_EINT */ | ||
| 4041 | #define WM8994_SRC1_LOCK_EINT_SHIFT 7 /* SRC1_LOCK_EINT */ | ||
| 4042 | #define WM8994_SRC1_LOCK_EINT_WIDTH 1 /* SRC1_LOCK_EINT */ | ||
| 4043 | #define WM8994_FLL2_LOCK_EINT 0x0040 /* FLL2_LOCK_EINT */ | ||
| 4044 | #define WM8994_FLL2_LOCK_EINT_MASK 0x0040 /* FLL2_LOCK_EINT */ | ||
| 4045 | #define WM8994_FLL2_LOCK_EINT_SHIFT 6 /* FLL2_LOCK_EINT */ | ||
| 4046 | #define WM8994_FLL2_LOCK_EINT_WIDTH 1 /* FLL2_LOCK_EINT */ | ||
| 4047 | #define WM8994_FLL1_LOCK_EINT 0x0020 /* FLL1_LOCK_EINT */ | ||
| 4048 | #define WM8994_FLL1_LOCK_EINT_MASK 0x0020 /* FLL1_LOCK_EINT */ | ||
| 4049 | #define WM8994_FLL1_LOCK_EINT_SHIFT 5 /* FLL1_LOCK_EINT */ | ||
| 4050 | #define WM8994_FLL1_LOCK_EINT_WIDTH 1 /* FLL1_LOCK_EINT */ | ||
| 4051 | #define WM8994_MIC2_SHRT_EINT 0x0010 /* MIC2_SHRT_EINT */ | ||
| 4052 | #define WM8994_MIC2_SHRT_EINT_MASK 0x0010 /* MIC2_SHRT_EINT */ | ||
| 4053 | #define WM8994_MIC2_SHRT_EINT_SHIFT 4 /* MIC2_SHRT_EINT */ | ||
| 4054 | #define WM8994_MIC2_SHRT_EINT_WIDTH 1 /* MIC2_SHRT_EINT */ | ||
| 4055 | #define WM8994_MIC2_DET_EINT 0x0008 /* MIC2_DET_EINT */ | ||
| 4056 | #define WM8994_MIC2_DET_EINT_MASK 0x0008 /* MIC2_DET_EINT */ | ||
| 4057 | #define WM8994_MIC2_DET_EINT_SHIFT 3 /* MIC2_DET_EINT */ | ||
| 4058 | #define WM8994_MIC2_DET_EINT_WIDTH 1 /* MIC2_DET_EINT */ | ||
| 4059 | #define WM8994_MIC1_SHRT_EINT 0x0004 /* MIC1_SHRT_EINT */ | ||
| 4060 | #define WM8994_MIC1_SHRT_EINT_MASK 0x0004 /* MIC1_SHRT_EINT */ | ||
| 4061 | #define WM8994_MIC1_SHRT_EINT_SHIFT 2 /* MIC1_SHRT_EINT */ | ||
| 4062 | #define WM8994_MIC1_SHRT_EINT_WIDTH 1 /* MIC1_SHRT_EINT */ | ||
| 4063 | #define WM8994_MIC1_DET_EINT 0x0002 /* MIC1_DET_EINT */ | ||
| 4064 | #define WM8994_MIC1_DET_EINT_MASK 0x0002 /* MIC1_DET_EINT */ | ||
| 4065 | #define WM8994_MIC1_DET_EINT_SHIFT 1 /* MIC1_DET_EINT */ | ||
| 4066 | #define WM8994_MIC1_DET_EINT_WIDTH 1 /* MIC1_DET_EINT */ | ||
| 4067 | #define WM8994_TEMP_SHUT_EINT 0x0001 /* TEMP_SHUT_EINT */ | ||
| 4068 | #define WM8994_TEMP_SHUT_EINT_MASK 0x0001 /* TEMP_SHUT_EINT */ | ||
| 4069 | #define WM8994_TEMP_SHUT_EINT_SHIFT 0 /* TEMP_SHUT_EINT */ | ||
| 4070 | #define WM8994_TEMP_SHUT_EINT_WIDTH 1 /* TEMP_SHUT_EINT */ | ||
| 4071 | |||
| 4072 | /* | ||
| 4073 | * R1842 (0x732) - Interrupt Raw Status 2 | ||
| 4074 | */ | ||
| 4075 | #define WM8994_TEMP_WARN_STS 0x8000 /* TEMP_WARN_STS */ | ||
| 4076 | #define WM8994_TEMP_WARN_STS_MASK 0x8000 /* TEMP_WARN_STS */ | ||
| 4077 | #define WM8994_TEMP_WARN_STS_SHIFT 15 /* TEMP_WARN_STS */ | ||
| 4078 | #define WM8994_TEMP_WARN_STS_WIDTH 1 /* TEMP_WARN_STS */ | ||
| 4079 | #define WM8994_DCS_DONE_STS 0x4000 /* DCS_DONE_STS */ | ||
| 4080 | #define WM8994_DCS_DONE_STS_MASK 0x4000 /* DCS_DONE_STS */ | ||
| 4081 | #define WM8994_DCS_DONE_STS_SHIFT 14 /* DCS_DONE_STS */ | ||
| 4082 | #define WM8994_DCS_DONE_STS_WIDTH 1 /* DCS_DONE_STS */ | ||
| 4083 | #define WM8994_WSEQ_DONE_STS 0x2000 /* WSEQ_DONE_STS */ | ||
| 4084 | #define WM8994_WSEQ_DONE_STS_MASK 0x2000 /* WSEQ_DONE_STS */ | ||
| 4085 | #define WM8994_WSEQ_DONE_STS_SHIFT 13 /* WSEQ_DONE_STS */ | ||
| 4086 | #define WM8994_WSEQ_DONE_STS_WIDTH 1 /* WSEQ_DONE_STS */ | ||
| 4087 | #define WM8994_FIFOS_ERR_STS 0x1000 /* FIFOS_ERR_STS */ | ||
| 4088 | #define WM8994_FIFOS_ERR_STS_MASK 0x1000 /* FIFOS_ERR_STS */ | ||
| 4089 | #define WM8994_FIFOS_ERR_STS_SHIFT 12 /* FIFOS_ERR_STS */ | ||
| 4090 | #define WM8994_FIFOS_ERR_STS_WIDTH 1 /* FIFOS_ERR_STS */ | ||
| 4091 | #define WM8994_AIF2DRC_SIG_DET_STS 0x0800 /* AIF2DRC_SIG_DET_STS */ | ||
| 4092 | #define WM8994_AIF2DRC_SIG_DET_STS_MASK 0x0800 /* AIF2DRC_SIG_DET_STS */ | ||
| 4093 | #define WM8994_AIF2DRC_SIG_DET_STS_SHIFT 11 /* AIF2DRC_SIG_DET_STS */ | ||
| 4094 | #define WM8994_AIF2DRC_SIG_DET_STS_WIDTH 1 /* AIF2DRC_SIG_DET_STS */ | ||
| 4095 | #define WM8994_AIF1DRC2_SIG_DET_STS 0x0400 /* AIF1DRC2_SIG_DET_STS */ | ||
| 4096 | #define WM8994_AIF1DRC2_SIG_DET_STS_MASK 0x0400 /* AIF1DRC2_SIG_DET_STS */ | ||
| 4097 | #define WM8994_AIF1DRC2_SIG_DET_STS_SHIFT 10 /* AIF1DRC2_SIG_DET_STS */ | ||
| 4098 | #define WM8994_AIF1DRC2_SIG_DET_STS_WIDTH 1 /* AIF1DRC2_SIG_DET_STS */ | ||
| 4099 | #define WM8994_AIF1DRC1_SIG_DET_STS 0x0200 /* AIF1DRC1_SIG_DET_STS */ | ||
| 4100 | #define WM8994_AIF1DRC1_SIG_DET_STS_MASK 0x0200 /* AIF1DRC1_SIG_DET_STS */ | ||
| 4101 | #define WM8994_AIF1DRC1_SIG_DET_STS_SHIFT 9 /* AIF1DRC1_SIG_DET_STS */ | ||
| 4102 | #define WM8994_AIF1DRC1_SIG_DET_STS_WIDTH 1 /* AIF1DRC1_SIG_DET_STS */ | ||
| 4103 | #define WM8994_SRC2_LOCK_STS 0x0100 /* SRC2_LOCK_STS */ | ||
| 4104 | #define WM8994_SRC2_LOCK_STS_MASK 0x0100 /* SRC2_LOCK_STS */ | ||
| 4105 | #define WM8994_SRC2_LOCK_STS_SHIFT 8 /* SRC2_LOCK_STS */ | ||
| 4106 | #define WM8994_SRC2_LOCK_STS_WIDTH 1 /* SRC2_LOCK_STS */ | ||
| 4107 | #define WM8994_SRC1_LOCK_STS 0x0080 /* SRC1_LOCK_STS */ | ||
| 4108 | #define WM8994_SRC1_LOCK_STS_MASK 0x0080 /* SRC1_LOCK_STS */ | ||
| 4109 | #define WM8994_SRC1_LOCK_STS_SHIFT 7 /* SRC1_LOCK_STS */ | ||
| 4110 | #define WM8994_SRC1_LOCK_STS_WIDTH 1 /* SRC1_LOCK_STS */ | ||
| 4111 | #define WM8994_FLL2_LOCK_STS 0x0040 /* FLL2_LOCK_STS */ | ||
| 4112 | #define WM8994_FLL2_LOCK_STS_MASK 0x0040 /* FLL2_LOCK_STS */ | ||
| 4113 | #define WM8994_FLL2_LOCK_STS_SHIFT 6 /* FLL2_LOCK_STS */ | ||
| 4114 | #define WM8994_FLL2_LOCK_STS_WIDTH 1 /* FLL2_LOCK_STS */ | ||
| 4115 | #define WM8994_FLL1_LOCK_STS 0x0020 /* FLL1_LOCK_STS */ | ||
| 4116 | #define WM8994_FLL1_LOCK_STS_MASK 0x0020 /* FLL1_LOCK_STS */ | ||
| 4117 | #define WM8994_FLL1_LOCK_STS_SHIFT 5 /* FLL1_LOCK_STS */ | ||
| 4118 | #define WM8994_FLL1_LOCK_STS_WIDTH 1 /* FLL1_LOCK_STS */ | ||
| 4119 | #define WM8994_MIC2_SHRT_STS 0x0010 /* MIC2_SHRT_STS */ | ||
| 4120 | #define WM8994_MIC2_SHRT_STS_MASK 0x0010 /* MIC2_SHRT_STS */ | ||
| 4121 | #define WM8994_MIC2_SHRT_STS_SHIFT 4 /* MIC2_SHRT_STS */ | ||
| 4122 | #define WM8994_MIC2_SHRT_STS_WIDTH 1 /* MIC2_SHRT_STS */ | ||
| 4123 | #define WM8994_MIC2_DET_STS 0x0008 /* MIC2_DET_STS */ | ||
| 4124 | #define WM8994_MIC2_DET_STS_MASK 0x0008 /* MIC2_DET_STS */ | ||
| 4125 | #define WM8994_MIC2_DET_STS_SHIFT 3 /* MIC2_DET_STS */ | ||
| 4126 | #define WM8994_MIC2_DET_STS_WIDTH 1 /* MIC2_DET_STS */ | ||
| 4127 | #define WM8994_MIC1_SHRT_STS 0x0004 /* MIC1_SHRT_STS */ | ||
| 4128 | #define WM8994_MIC1_SHRT_STS_MASK 0x0004 /* MIC1_SHRT_STS */ | ||
| 4129 | #define WM8994_MIC1_SHRT_STS_SHIFT 2 /* MIC1_SHRT_STS */ | ||
| 4130 | #define WM8994_MIC1_SHRT_STS_WIDTH 1 /* MIC1_SHRT_STS */ | ||
| 4131 | #define WM8994_MIC1_DET_STS 0x0002 /* MIC1_DET_STS */ | ||
| 4132 | #define WM8994_MIC1_DET_STS_MASK 0x0002 /* MIC1_DET_STS */ | ||
| 4133 | #define WM8994_MIC1_DET_STS_SHIFT 1 /* MIC1_DET_STS */ | ||
| 4134 | #define WM8994_MIC1_DET_STS_WIDTH 1 /* MIC1_DET_STS */ | ||
| 4135 | #define WM8994_TEMP_SHUT_STS 0x0001 /* TEMP_SHUT_STS */ | ||
| 4136 | #define WM8994_TEMP_SHUT_STS_MASK 0x0001 /* TEMP_SHUT_STS */ | ||
| 4137 | #define WM8994_TEMP_SHUT_STS_SHIFT 0 /* TEMP_SHUT_STS */ | ||
| 4138 | #define WM8994_TEMP_SHUT_STS_WIDTH 1 /* TEMP_SHUT_STS */ | ||
| 4139 | |||
| 4140 | /* | ||
| 4141 | * R1848 (0x738) - Interrupt Status 1 Mask | ||
| 4142 | */ | ||
| 4143 | #define WM8994_IM_GP11_EINT 0x0400 /* IM_GP11_EINT */ | ||
| 4144 | #define WM8994_IM_GP11_EINT_MASK 0x0400 /* IM_GP11_EINT */ | ||
| 4145 | #define WM8994_IM_GP11_EINT_SHIFT 10 /* IM_GP11_EINT */ | ||
| 4146 | #define WM8994_IM_GP11_EINT_WIDTH 1 /* IM_GP11_EINT */ | ||
| 4147 | #define WM8994_IM_GP10_EINT 0x0200 /* IM_GP10_EINT */ | ||
| 4148 | #define WM8994_IM_GP10_EINT_MASK 0x0200 /* IM_GP10_EINT */ | ||
| 4149 | #define WM8994_IM_GP10_EINT_SHIFT 9 /* IM_GP10_EINT */ | ||
| 4150 | #define WM8994_IM_GP10_EINT_WIDTH 1 /* IM_GP10_EINT */ | ||
| 4151 | #define WM8994_IM_GP9_EINT 0x0100 /* IM_GP9_EINT */ | ||
| 4152 | #define WM8994_IM_GP9_EINT_MASK 0x0100 /* IM_GP9_EINT */ | ||
| 4153 | #define WM8994_IM_GP9_EINT_SHIFT 8 /* IM_GP9_EINT */ | ||
| 4154 | #define WM8994_IM_GP9_EINT_WIDTH 1 /* IM_GP9_EINT */ | ||
| 4155 | #define WM8994_IM_GP8_EINT 0x0080 /* IM_GP8_EINT */ | ||
| 4156 | #define WM8994_IM_GP8_EINT_MASK 0x0080 /* IM_GP8_EINT */ | ||
| 4157 | #define WM8994_IM_GP8_EINT_SHIFT 7 /* IM_GP8_EINT */ | ||
| 4158 | #define WM8994_IM_GP8_EINT_WIDTH 1 /* IM_GP8_EINT */ | ||
| 4159 | #define WM8994_IM_GP7_EINT 0x0040 /* IM_GP7_EINT */ | ||
| 4160 | #define WM8994_IM_GP7_EINT_MASK 0x0040 /* IM_GP7_EINT */ | ||
| 4161 | #define WM8994_IM_GP7_EINT_SHIFT 6 /* IM_GP7_EINT */ | ||
| 4162 | #define WM8994_IM_GP7_EINT_WIDTH 1 /* IM_GP7_EINT */ | ||
| 4163 | #define WM8994_IM_GP6_EINT 0x0020 /* IM_GP6_EINT */ | ||
| 4164 | #define WM8994_IM_GP6_EINT_MASK 0x0020 /* IM_GP6_EINT */ | ||
| 4165 | #define WM8994_IM_GP6_EINT_SHIFT 5 /* IM_GP6_EINT */ | ||
| 4166 | #define WM8994_IM_GP6_EINT_WIDTH 1 /* IM_GP6_EINT */ | ||
| 4167 | #define WM8994_IM_GP5_EINT 0x0010 /* IM_GP5_EINT */ | ||
| 4168 | #define WM8994_IM_GP5_EINT_MASK 0x0010 /* IM_GP5_EINT */ | ||
| 4169 | #define WM8994_IM_GP5_EINT_SHIFT 4 /* IM_GP5_EINT */ | ||
| 4170 | #define WM8994_IM_GP5_EINT_WIDTH 1 /* IM_GP5_EINT */ | ||
| 4171 | #define WM8994_IM_GP4_EINT 0x0008 /* IM_GP4_EINT */ | ||
| 4172 | #define WM8994_IM_GP4_EINT_MASK 0x0008 /* IM_GP4_EINT */ | ||
| 4173 | #define WM8994_IM_GP4_EINT_SHIFT 3 /* IM_GP4_EINT */ | ||
| 4174 | #define WM8994_IM_GP4_EINT_WIDTH 1 /* IM_GP4_EINT */ | ||
| 4175 | #define WM8994_IM_GP3_EINT 0x0004 /* IM_GP3_EINT */ | ||
| 4176 | #define WM8994_IM_GP3_EINT_MASK 0x0004 /* IM_GP3_EINT */ | ||
| 4177 | #define WM8994_IM_GP3_EINT_SHIFT 2 /* IM_GP3_EINT */ | ||
| 4178 | #define WM8994_IM_GP3_EINT_WIDTH 1 /* IM_GP3_EINT */ | ||
| 4179 | #define WM8994_IM_GP2_EINT 0x0002 /* IM_GP2_EINT */ | ||
| 4180 | #define WM8994_IM_GP2_EINT_MASK 0x0002 /* IM_GP2_EINT */ | ||
| 4181 | #define WM8994_IM_GP2_EINT_SHIFT 1 /* IM_GP2_EINT */ | ||
| 4182 | #define WM8994_IM_GP2_EINT_WIDTH 1 /* IM_GP2_EINT */ | ||
| 4183 | #define WM8994_IM_GP1_EINT 0x0001 /* IM_GP1_EINT */ | ||
| 4184 | #define WM8994_IM_GP1_EINT_MASK 0x0001 /* IM_GP1_EINT */ | ||
| 4185 | #define WM8994_IM_GP1_EINT_SHIFT 0 /* IM_GP1_EINT */ | ||
| 4186 | #define WM8994_IM_GP1_EINT_WIDTH 1 /* IM_GP1_EINT */ | ||
| 4187 | |||
| 4188 | /* | ||
| 4189 | * R1849 (0x739) - Interrupt Status 2 Mask | ||
| 4190 | */ | ||
| 4191 | #define WM8994_IM_TEMP_WARN_EINT 0x8000 /* IM_TEMP_WARN_EINT */ | ||
| 4192 | #define WM8994_IM_TEMP_WARN_EINT_MASK 0x8000 /* IM_TEMP_WARN_EINT */ | ||
| 4193 | #define WM8994_IM_TEMP_WARN_EINT_SHIFT 15 /* IM_TEMP_WARN_EINT */ | ||
| 4194 | #define WM8994_IM_TEMP_WARN_EINT_WIDTH 1 /* IM_TEMP_WARN_EINT */ | ||
| 4195 | #define WM8994_IM_DCS_DONE_EINT 0x4000 /* IM_DCS_DONE_EINT */ | ||
| 4196 | #define WM8994_IM_DCS_DONE_EINT_MASK 0x4000 /* IM_DCS_DONE_EINT */ | ||
| 4197 | #define WM8994_IM_DCS_DONE_EINT_SHIFT 14 /* IM_DCS_DONE_EINT */ | ||
| 4198 | #define WM8994_IM_DCS_DONE_EINT_WIDTH 1 /* IM_DCS_DONE_EINT */ | ||
| 4199 | #define WM8994_IM_WSEQ_DONE_EINT 0x2000 /* IM_WSEQ_DONE_EINT */ | ||
| 4200 | #define WM8994_IM_WSEQ_DONE_EINT_MASK 0x2000 /* IM_WSEQ_DONE_EINT */ | ||
| 4201 | #define WM8994_IM_WSEQ_DONE_EINT_SHIFT 13 /* IM_WSEQ_DONE_EINT */ | ||
| 4202 | #define WM8994_IM_WSEQ_DONE_EINT_WIDTH 1 /* IM_WSEQ_DONE_EINT */ | ||
| 4203 | #define WM8994_IM_FIFOS_ERR_EINT 0x1000 /* IM_FIFOS_ERR_EINT */ | ||
| 4204 | #define WM8994_IM_FIFOS_ERR_EINT_MASK 0x1000 /* IM_FIFOS_ERR_EINT */ | ||
| 4205 | #define WM8994_IM_FIFOS_ERR_EINT_SHIFT 12 /* IM_FIFOS_ERR_EINT */ | ||
| 4206 | #define WM8994_IM_FIFOS_ERR_EINT_WIDTH 1 /* IM_FIFOS_ERR_EINT */ | ||
| 4207 | #define WM8994_IM_AIF2DRC_SIG_DET_EINT 0x0800 /* IM_AIF2DRC_SIG_DET_EINT */ | ||
| 4208 | #define WM8994_IM_AIF2DRC_SIG_DET_EINT_MASK 0x0800 /* IM_AIF2DRC_SIG_DET_EINT */ | ||
| 4209 | #define WM8994_IM_AIF2DRC_SIG_DET_EINT_SHIFT 11 /* IM_AIF2DRC_SIG_DET_EINT */ | ||
| 4210 | #define WM8994_IM_AIF2DRC_SIG_DET_EINT_WIDTH 1 /* IM_AIF2DRC_SIG_DET_EINT */ | ||
| 4211 | #define WM8994_IM_AIF1DRC2_SIG_DET_EINT 0x0400 /* IM_AIF1DRC2_SIG_DET_EINT */ | ||
| 4212 | #define WM8994_IM_AIF1DRC2_SIG_DET_EINT_MASK 0x0400 /* IM_AIF1DRC2_SIG_DET_EINT */ | ||
| 4213 | #define WM8994_IM_AIF1DRC2_SIG_DET_EINT_SHIFT 10 /* IM_AIF1DRC2_SIG_DET_EINT */ | ||
| 4214 | #define WM8994_IM_AIF1DRC2_SIG_DET_EINT_WIDTH 1 /* IM_AIF1DRC2_SIG_DET_EINT */ | ||
| 4215 | #define WM8994_IM_AIF1DRC1_SIG_DET_EINT 0x0200 /* IM_AIF1DRC1_SIG_DET_EINT */ | ||
| 4216 | #define WM8994_IM_AIF1DRC1_SIG_DET_EINT_MASK 0x0200 /* IM_AIF1DRC1_SIG_DET_EINT */ | ||
| 4217 | #define WM8994_IM_AIF1DRC1_SIG_DET_EINT_SHIFT 9 /* IM_AIF1DRC1_SIG_DET_EINT */ | ||
| 4218 | #define WM8994_IM_AIF1DRC1_SIG_DET_EINT_WIDTH 1 /* IM_AIF1DRC1_SIG_DET_EINT */ | ||
| 4219 | #define WM8994_IM_SRC2_LOCK_EINT 0x0100 /* IM_SRC2_LOCK_EINT */ | ||
| 4220 | #define WM8994_IM_SRC2_LOCK_EINT_MASK 0x0100 /* IM_SRC2_LOCK_EINT */ | ||
| 4221 | #define WM8994_IM_SRC2_LOCK_EINT_SHIFT 8 /* IM_SRC2_LOCK_EINT */ | ||
| 4222 | #define WM8994_IM_SRC2_LOCK_EINT_WIDTH 1 /* IM_SRC2_LOCK_EINT */ | ||
| 4223 | #define WM8994_IM_SRC1_LOCK_EINT 0x0080 /* IM_SRC1_LOCK_EINT */ | ||
| 4224 | #define WM8994_IM_SRC1_LOCK_EINT_MASK 0x0080 /* IM_SRC1_LOCK_EINT */ | ||
| 4225 | #define WM8994_IM_SRC1_LOCK_EINT_SHIFT 7 /* IM_SRC1_LOCK_EINT */ | ||
| 4226 | #define WM8994_IM_SRC1_LOCK_EINT_WIDTH 1 /* IM_SRC1_LOCK_EINT */ | ||
| 4227 | #define WM8994_IM_FLL2_LOCK_EINT 0x0040 /* IM_FLL2_LOCK_EINT */ | ||
| 4228 | #define WM8994_IM_FLL2_LOCK_EINT_MASK 0x0040 /* IM_FLL2_LOCK_EINT */ | ||
| 4229 | #define WM8994_IM_FLL2_LOCK_EINT_SHIFT 6 /* IM_FLL2_LOCK_EINT */ | ||
| 4230 | #define WM8994_IM_FLL2_LOCK_EINT_WIDTH 1 /* IM_FLL2_LOCK_EINT */ | ||
| 4231 | #define WM8994_IM_FLL1_LOCK_EINT 0x0020 /* IM_FLL1_LOCK_EINT */ | ||
| 4232 | #define WM8994_IM_FLL1_LOCK_EINT_MASK 0x0020 /* IM_FLL1_LOCK_EINT */ | ||
| 4233 | #define WM8994_IM_FLL1_LOCK_EINT_SHIFT 5 /* IM_FLL1_LOCK_EINT */ | ||
| 4234 | #define WM8994_IM_FLL1_LOCK_EINT_WIDTH 1 /* IM_FLL1_LOCK_EINT */ | ||
| 4235 | #define WM8994_IM_MIC2_SHRT_EINT 0x0010 /* IM_MIC2_SHRT_EINT */ | ||
| 4236 | #define WM8994_IM_MIC2_SHRT_EINT_MASK 0x0010 /* IM_MIC2_SHRT_EINT */ | ||
| 4237 | #define WM8994_IM_MIC2_SHRT_EINT_SHIFT 4 /* IM_MIC2_SHRT_EINT */ | ||
| 4238 | #define WM8994_IM_MIC2_SHRT_EINT_WIDTH 1 /* IM_MIC2_SHRT_EINT */ | ||
| 4239 | #define WM8994_IM_MIC2_DET_EINT 0x0008 /* IM_MIC2_DET_EINT */ | ||
| 4240 | #define WM8994_IM_MIC2_DET_EINT_MASK 0x0008 /* IM_MIC2_DET_EINT */ | ||
| 4241 | #define WM8994_IM_MIC2_DET_EINT_SHIFT 3 /* IM_MIC2_DET_EINT */ | ||
| 4242 | #define WM8994_IM_MIC2_DET_EINT_WIDTH 1 /* IM_MIC2_DET_EINT */ | ||
| 4243 | #define WM8994_IM_MIC1_SHRT_EINT 0x0004 /* IM_MIC1_SHRT_EINT */ | ||
| 4244 | #define WM8994_IM_MIC1_SHRT_EINT_MASK 0x0004 /* IM_MIC1_SHRT_EINT */ | ||
| 4245 | #define WM8994_IM_MIC1_SHRT_EINT_SHIFT 2 /* IM_MIC1_SHRT_EINT */ | ||
| 4246 | #define WM8994_IM_MIC1_SHRT_EINT_WIDTH 1 /* IM_MIC1_SHRT_EINT */ | ||
| 4247 | #define WM8994_IM_MIC1_DET_EINT 0x0002 /* IM_MIC1_DET_EINT */ | ||
| 4248 | #define WM8994_IM_MIC1_DET_EINT_MASK 0x0002 /* IM_MIC1_DET_EINT */ | ||
| 4249 | #define WM8994_IM_MIC1_DET_EINT_SHIFT 1 /* IM_MIC1_DET_EINT */ | ||
| 4250 | #define WM8994_IM_MIC1_DET_EINT_WIDTH 1 /* IM_MIC1_DET_EINT */ | ||
| 4251 | #define WM8994_IM_TEMP_SHUT_EINT 0x0001 /* IM_TEMP_SHUT_EINT */ | ||
| 4252 | #define WM8994_IM_TEMP_SHUT_EINT_MASK 0x0001 /* IM_TEMP_SHUT_EINT */ | ||
| 4253 | #define WM8994_IM_TEMP_SHUT_EINT_SHIFT 0 /* IM_TEMP_SHUT_EINT */ | ||
| 4254 | #define WM8994_IM_TEMP_SHUT_EINT_WIDTH 1 /* IM_TEMP_SHUT_EINT */ | ||
| 4255 | |||
| 4256 | /* | ||
| 4257 | * R1856 (0x740) - Interrupt Control | ||
| 4258 | */ | ||
| 4259 | #define WM8994_IM_IRQ 0x0001 /* IM_IRQ */ | ||
| 4260 | #define WM8994_IM_IRQ_MASK 0x0001 /* IM_IRQ */ | ||
| 4261 | #define WM8994_IM_IRQ_SHIFT 0 /* IM_IRQ */ | ||
| 4262 | #define WM8994_IM_IRQ_WIDTH 1 /* IM_IRQ */ | ||
| 4263 | |||
| 4264 | /* | ||
| 4265 | * R1864 (0x748) - IRQ Debounce | ||
| 4266 | */ | ||
| 4267 | #define WM8994_TEMP_WARN_DB 0x0020 /* TEMP_WARN_DB */ | ||
| 4268 | #define WM8994_TEMP_WARN_DB_MASK 0x0020 /* TEMP_WARN_DB */ | ||
| 4269 | #define WM8994_TEMP_WARN_DB_SHIFT 5 /* TEMP_WARN_DB */ | ||
| 4270 | #define WM8994_TEMP_WARN_DB_WIDTH 1 /* TEMP_WARN_DB */ | ||
| 4271 | #define WM8994_MIC2_SHRT_DB 0x0010 /* MIC2_SHRT_DB */ | ||
| 4272 | #define WM8994_MIC2_SHRT_DB_MASK 0x0010 /* MIC2_SHRT_DB */ | ||
| 4273 | #define WM8994_MIC2_SHRT_DB_SHIFT 4 /* MIC2_SHRT_DB */ | ||
| 4274 | #define WM8994_MIC2_SHRT_DB_WIDTH 1 /* MIC2_SHRT_DB */ | ||
| 4275 | #define WM8994_MIC2_DET_DB 0x0008 /* MIC2_DET_DB */ | ||
| 4276 | #define WM8994_MIC2_DET_DB_MASK 0x0008 /* MIC2_DET_DB */ | ||
| 4277 | #define WM8994_MIC2_DET_DB_SHIFT 3 /* MIC2_DET_DB */ | ||
| 4278 | #define WM8994_MIC2_DET_DB_WIDTH 1 /* MIC2_DET_DB */ | ||
| 4279 | #define WM8994_MIC1_SHRT_DB 0x0004 /* MIC1_SHRT_DB */ | ||
| 4280 | #define WM8994_MIC1_SHRT_DB_MASK 0x0004 /* MIC1_SHRT_DB */ | ||
| 4281 | #define WM8994_MIC1_SHRT_DB_SHIFT 2 /* MIC1_SHRT_DB */ | ||
| 4282 | #define WM8994_MIC1_SHRT_DB_WIDTH 1 /* MIC1_SHRT_DB */ | ||
| 4283 | #define WM8994_MIC1_DET_DB 0x0002 /* MIC1_DET_DB */ | ||
| 4284 | #define WM8994_MIC1_DET_DB_MASK 0x0002 /* MIC1_DET_DB */ | ||
| 4285 | #define WM8994_MIC1_DET_DB_SHIFT 1 /* MIC1_DET_DB */ | ||
| 4286 | #define WM8994_MIC1_DET_DB_WIDTH 1 /* MIC1_DET_DB */ | ||
| 4287 | #define WM8994_TEMP_SHUT_DB 0x0001 /* TEMP_SHUT_DB */ | ||
| 4288 | #define WM8994_TEMP_SHUT_DB_MASK 0x0001 /* TEMP_SHUT_DB */ | ||
| 4289 | #define WM8994_TEMP_SHUT_DB_SHIFT 0 /* TEMP_SHUT_DB */ | ||
| 4290 | #define WM8994_TEMP_SHUT_DB_WIDTH 1 /* TEMP_SHUT_DB */ | ||
| 4291 | |||
| 4292 | #endif | ||
diff --git a/include/linux/migrate.h b/include/linux/migrate.h index 527602cdea1c..7f085c97c799 100644 --- a/include/linux/migrate.h +++ b/include/linux/migrate.h | |||
| @@ -12,7 +12,8 @@ typedef struct page *new_page_t(struct page *, unsigned long private, int **); | |||
| 12 | extern int putback_lru_pages(struct list_head *l); | 12 | extern int putback_lru_pages(struct list_head *l); |
| 13 | extern int migrate_page(struct address_space *, | 13 | extern int migrate_page(struct address_space *, |
| 14 | struct page *, struct page *); | 14 | struct page *, struct page *); |
| 15 | extern int migrate_pages(struct list_head *l, new_page_t x, unsigned long); | 15 | extern int migrate_pages(struct list_head *l, new_page_t x, |
| 16 | unsigned long private, int offlining); | ||
| 16 | 17 | ||
| 17 | extern int fail_migrate_page(struct address_space *, | 18 | extern int fail_migrate_page(struct address_space *, |
| 18 | struct page *, struct page *); | 19 | struct page *, struct page *); |
| @@ -26,10 +27,7 @@ extern int migrate_vmas(struct mm_struct *mm, | |||
| 26 | 27 | ||
| 27 | static inline int putback_lru_pages(struct list_head *l) { return 0; } | 28 | static inline int putback_lru_pages(struct list_head *l) { return 0; } |
| 28 | static inline int migrate_pages(struct list_head *l, new_page_t x, | 29 | static inline int migrate_pages(struct list_head *l, new_page_t x, |
| 29 | unsigned long private) { return -ENOSYS; } | 30 | unsigned long private, int offlining) { return -ENOSYS; } |
| 30 | |||
| 31 | static inline int migrate_pages_to(struct list_head *pagelist, | ||
| 32 | struct vm_area_struct *vma, int dest) { return 0; } | ||
| 33 | 31 | ||
| 34 | static inline int migrate_prep(void) { return -ENOSYS; } | 32 | static inline int migrate_prep(void) { return -ENOSYS; } |
| 35 | 33 | ||
diff --git a/include/linux/miscdevice.h b/include/linux/miscdevice.h index adaf3c15e449..8b5f7cc0fba6 100644 --- a/include/linux/miscdevice.h +++ b/include/linux/miscdevice.h | |||
| @@ -30,6 +30,7 @@ | |||
| 30 | #define HPET_MINOR 228 | 30 | #define HPET_MINOR 228 |
| 31 | #define FUSE_MINOR 229 | 31 | #define FUSE_MINOR 229 |
| 32 | #define KVM_MINOR 232 | 32 | #define KVM_MINOR 232 |
| 33 | #define VHOST_NET_MINOR 233 | ||
| 33 | #define MISC_DYNAMIC_MINOR 255 | 34 | #define MISC_DYNAMIC_MINOR 255 |
| 34 | 35 | ||
| 35 | struct device; | 36 | struct device; |
diff --git a/include/linux/mlx4/device.h b/include/linux/mlx4/device.h index ce7cc6c7bcbb..e92d1bfdb330 100644 --- a/include/linux/mlx4/device.h +++ b/include/linux/mlx4/device.h | |||
| @@ -61,6 +61,7 @@ enum { | |||
| 61 | MLX4_DEV_CAP_FLAG_BAD_PKEY_CNTR = 1 << 8, | 61 | MLX4_DEV_CAP_FLAG_BAD_PKEY_CNTR = 1 << 8, |
| 62 | MLX4_DEV_CAP_FLAG_BAD_QKEY_CNTR = 1 << 9, | 62 | MLX4_DEV_CAP_FLAG_BAD_QKEY_CNTR = 1 << 9, |
| 63 | MLX4_DEV_CAP_FLAG_DPDP = 1 << 12, | 63 | MLX4_DEV_CAP_FLAG_DPDP = 1 << 12, |
| 64 | MLX4_DEV_CAP_FLAG_BLH = 1 << 15, | ||
| 64 | MLX4_DEV_CAP_FLAG_MEM_WINDOW = 1 << 16, | 65 | MLX4_DEV_CAP_FLAG_MEM_WINDOW = 1 << 16, |
| 65 | MLX4_DEV_CAP_FLAG_APM = 1 << 17, | 66 | MLX4_DEV_CAP_FLAG_APM = 1 << 17, |
| 66 | MLX4_DEV_CAP_FLAG_ATOMIC = 1 << 18, | 67 | MLX4_DEV_CAP_FLAG_ATOMIC = 1 << 18, |
diff --git a/include/linux/mm.h b/include/linux/mm.h index 24c395694f4d..462acaf36f3a 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h | |||
| @@ -12,6 +12,7 @@ | |||
| 12 | #include <linux/prio_tree.h> | 12 | #include <linux/prio_tree.h> |
| 13 | #include <linux/debug_locks.h> | 13 | #include <linux/debug_locks.h> |
| 14 | #include <linux/mm_types.h> | 14 | #include <linux/mm_types.h> |
| 15 | #include <linux/range.h> | ||
| 15 | 16 | ||
| 16 | struct mempolicy; | 17 | struct mempolicy; |
| 17 | struct anon_vma; | 18 | struct anon_vma; |
| @@ -265,6 +266,8 @@ static inline int get_page_unless_zero(struct page *page) | |||
| 265 | return atomic_inc_not_zero(&page->_count); | 266 | return atomic_inc_not_zero(&page->_count); |
| 266 | } | 267 | } |
| 267 | 268 | ||
| 269 | extern int page_is_ram(unsigned long pfn); | ||
| 270 | |||
| 268 | /* Support for virtually mapped pages */ | 271 | /* Support for virtually mapped pages */ |
| 269 | struct page *vmalloc_to_page(const void *addr); | 272 | struct page *vmalloc_to_page(const void *addr); |
| 270 | unsigned long vmalloc_to_pfn(const void *addr); | 273 | unsigned long vmalloc_to_pfn(const void *addr); |
| @@ -620,13 +623,22 @@ void page_address_init(void); | |||
| 620 | /* | 623 | /* |
| 621 | * On an anonymous page mapped into a user virtual memory area, | 624 | * On an anonymous page mapped into a user virtual memory area, |
| 622 | * page->mapping points to its anon_vma, not to a struct address_space; | 625 | * page->mapping points to its anon_vma, not to a struct address_space; |
| 623 | * with the PAGE_MAPPING_ANON bit set to distinguish it. | 626 | * with the PAGE_MAPPING_ANON bit set to distinguish it. See rmap.h. |
| 627 | * | ||
| 628 | * On an anonymous page in a VM_MERGEABLE area, if CONFIG_KSM is enabled, | ||
| 629 | * the PAGE_MAPPING_KSM bit may be set along with the PAGE_MAPPING_ANON bit; | ||
| 630 | * and then page->mapping points, not to an anon_vma, but to a private | ||
| 631 | * structure which KSM associates with that merged page. See ksm.h. | ||
| 632 | * | ||
| 633 | * PAGE_MAPPING_KSM without PAGE_MAPPING_ANON is currently never used. | ||
| 624 | * | 634 | * |
| 625 | * Please note that, confusingly, "page_mapping" refers to the inode | 635 | * Please note that, confusingly, "page_mapping" refers to the inode |
| 626 | * address_space which maps the page from disk; whereas "page_mapped" | 636 | * address_space which maps the page from disk; whereas "page_mapped" |
| 627 | * refers to user virtual address space into which the page is mapped. | 637 | * refers to user virtual address space into which the page is mapped. |
| 628 | */ | 638 | */ |
| 629 | #define PAGE_MAPPING_ANON 1 | 639 | #define PAGE_MAPPING_ANON 1 |
| 640 | #define PAGE_MAPPING_KSM 2 | ||
| 641 | #define PAGE_MAPPING_FLAGS (PAGE_MAPPING_ANON | PAGE_MAPPING_KSM) | ||
| 630 | 642 | ||
| 631 | extern struct address_space swapper_space; | 643 | extern struct address_space swapper_space; |
| 632 | static inline struct address_space *page_mapping(struct page *page) | 644 | static inline struct address_space *page_mapping(struct page *page) |
| @@ -634,16 +646,19 @@ static inline struct address_space *page_mapping(struct page *page) | |||
| 634 | struct address_space *mapping = page->mapping; | 646 | struct address_space *mapping = page->mapping; |
| 635 | 647 | ||
| 636 | VM_BUG_ON(PageSlab(page)); | 648 | VM_BUG_ON(PageSlab(page)); |
| 637 | #ifdef CONFIG_SWAP | ||
| 638 | if (unlikely(PageSwapCache(page))) | 649 | if (unlikely(PageSwapCache(page))) |
| 639 | mapping = &swapper_space; | 650 | mapping = &swapper_space; |
| 640 | else | 651 | else if (unlikely((unsigned long)mapping & PAGE_MAPPING_ANON)) |
| 641 | #endif | ||
| 642 | if (unlikely((unsigned long)mapping & PAGE_MAPPING_ANON)) | ||
| 643 | mapping = NULL; | 652 | mapping = NULL; |
| 644 | return mapping; | 653 | return mapping; |
| 645 | } | 654 | } |
| 646 | 655 | ||
| 656 | /* Neutral page->mapping pointer to address_space or anon_vma or other */ | ||
| 657 | static inline void *page_rmapping(struct page *page) | ||
| 658 | { | ||
| 659 | return (void *)((unsigned long)page->mapping & ~PAGE_MAPPING_FLAGS); | ||
| 660 | } | ||
| 661 | |||
| 647 | static inline int PageAnon(struct page *page) | 662 | static inline int PageAnon(struct page *page) |
| 648 | { | 663 | { |
| 649 | return ((unsigned long)page->mapping & PAGE_MAPPING_ANON) != 0; | 664 | return ((unsigned long)page->mapping & PAGE_MAPPING_ANON) != 0; |
| @@ -758,6 +773,7 @@ unsigned long unmap_vmas(struct mmu_gather **tlb, | |||
| 758 | * @pmd_entry: if set, called for each non-empty PMD (3rd-level) entry | 773 | * @pmd_entry: if set, called for each non-empty PMD (3rd-level) entry |
| 759 | * @pte_entry: if set, called for each non-empty PTE (4th-level) entry | 774 | * @pte_entry: if set, called for each non-empty PTE (4th-level) entry |
| 760 | * @pte_hole: if set, called for each hole at all levels | 775 | * @pte_hole: if set, called for each hole at all levels |
| 776 | * @hugetlb_entry: if set, called for each hugetlb entry | ||
| 761 | * | 777 | * |
| 762 | * (see walk_page_range for more details) | 778 | * (see walk_page_range for more details) |
| 763 | */ | 779 | */ |
| @@ -767,6 +783,8 @@ struct mm_walk { | |||
| 767 | int (*pmd_entry)(pmd_t *, unsigned long, unsigned long, struct mm_walk *); | 783 | int (*pmd_entry)(pmd_t *, unsigned long, unsigned long, struct mm_walk *); |
| 768 | int (*pte_entry)(pte_t *, unsigned long, unsigned long, struct mm_walk *); | 784 | int (*pte_entry)(pte_t *, unsigned long, unsigned long, struct mm_walk *); |
| 769 | int (*pte_hole)(unsigned long, unsigned long, struct mm_walk *); | 785 | int (*pte_hole)(unsigned long, unsigned long, struct mm_walk *); |
| 786 | int (*hugetlb_entry)(pte_t *, unsigned long, | ||
| 787 | unsigned long, unsigned long, struct mm_walk *); | ||
| 770 | struct mm_struct *mm; | 788 | struct mm_struct *mm; |
| 771 | void *private; | 789 | void *private; |
| 772 | }; | 790 | }; |
| @@ -852,6 +870,114 @@ extern int mprotect_fixup(struct vm_area_struct *vma, | |||
| 852 | */ | 870 | */ |
| 853 | int __get_user_pages_fast(unsigned long start, int nr_pages, int write, | 871 | int __get_user_pages_fast(unsigned long start, int nr_pages, int write, |
| 854 | struct page **pages); | 872 | struct page **pages); |
| 873 | /* | ||
| 874 | * per-process(per-mm_struct) statistics. | ||
| 875 | */ | ||
| 876 | #if defined(SPLIT_RSS_COUNTING) | ||
| 877 | /* | ||
| 878 | * The mm counters are not protected by its page_table_lock, | ||
| 879 | * so must be incremented atomically. | ||
| 880 | */ | ||
| 881 | static inline void set_mm_counter(struct mm_struct *mm, int member, long value) | ||
| 882 | { | ||
| 883 | atomic_long_set(&mm->rss_stat.count[member], value); | ||
| 884 | } | ||
| 885 | |||
| 886 | unsigned long get_mm_counter(struct mm_struct *mm, int member); | ||
| 887 | |||
| 888 | static inline void add_mm_counter(struct mm_struct *mm, int member, long value) | ||
| 889 | { | ||
| 890 | atomic_long_add(value, &mm->rss_stat.count[member]); | ||
| 891 | } | ||
| 892 | |||
| 893 | static inline void inc_mm_counter(struct mm_struct *mm, int member) | ||
| 894 | { | ||
| 895 | atomic_long_inc(&mm->rss_stat.count[member]); | ||
| 896 | } | ||
| 897 | |||
| 898 | static inline void dec_mm_counter(struct mm_struct *mm, int member) | ||
| 899 | { | ||
| 900 | atomic_long_dec(&mm->rss_stat.count[member]); | ||
| 901 | } | ||
| 902 | |||
| 903 | #else /* !USE_SPLIT_PTLOCKS */ | ||
| 904 | /* | ||
| 905 | * The mm counters are protected by its page_table_lock, | ||
| 906 | * so can be incremented directly. | ||
| 907 | */ | ||
| 908 | static inline void set_mm_counter(struct mm_struct *mm, int member, long value) | ||
| 909 | { | ||
| 910 | mm->rss_stat.count[member] = value; | ||
| 911 | } | ||
| 912 | |||
| 913 | static inline unsigned long get_mm_counter(struct mm_struct *mm, int member) | ||
| 914 | { | ||
| 915 | return mm->rss_stat.count[member]; | ||
| 916 | } | ||
| 917 | |||
| 918 | static inline void add_mm_counter(struct mm_struct *mm, int member, long value) | ||
| 919 | { | ||
| 920 | mm->rss_stat.count[member] += value; | ||
| 921 | } | ||
| 922 | |||
| 923 | static inline void inc_mm_counter(struct mm_struct *mm, int member) | ||
| 924 | { | ||
| 925 | mm->rss_stat.count[member]++; | ||
| 926 | } | ||
| 927 | |||
| 928 | static inline void dec_mm_counter(struct mm_struct *mm, int member) | ||
| 929 | { | ||
| 930 | mm->rss_stat.count[member]--; | ||
| 931 | } | ||
| 932 | |||
| 933 | #endif /* !USE_SPLIT_PTLOCKS */ | ||
| 934 | |||
| 935 | static inline unsigned long get_mm_rss(struct mm_struct *mm) | ||
| 936 | { | ||
| 937 | return get_mm_counter(mm, MM_FILEPAGES) + | ||
| 938 | get_mm_counter(mm, MM_ANONPAGES); | ||
| 939 | } | ||
| 940 | |||
| 941 | static inline unsigned long get_mm_hiwater_rss(struct mm_struct *mm) | ||
| 942 | { | ||
| 943 | return max(mm->hiwater_rss, get_mm_rss(mm)); | ||
| 944 | } | ||
| 945 | |||
| 946 | static inline unsigned long get_mm_hiwater_vm(struct mm_struct *mm) | ||
| 947 | { | ||
| 948 | return max(mm->hiwater_vm, mm->total_vm); | ||
| 949 | } | ||
| 950 | |||
| 951 | static inline void update_hiwater_rss(struct mm_struct *mm) | ||
| 952 | { | ||
| 953 | unsigned long _rss = get_mm_rss(mm); | ||
| 954 | |||
| 955 | if ((mm)->hiwater_rss < _rss) | ||
| 956 | (mm)->hiwater_rss = _rss; | ||
| 957 | } | ||
| 958 | |||
| 959 | static inline void update_hiwater_vm(struct mm_struct *mm) | ||
| 960 | { | ||
| 961 | if (mm->hiwater_vm < mm->total_vm) | ||
| 962 | mm->hiwater_vm = mm->total_vm; | ||
| 963 | } | ||
| 964 | |||
| 965 | static inline void setmax_mm_hiwater_rss(unsigned long *maxrss, | ||
| 966 | struct mm_struct *mm) | ||
| 967 | { | ||
| 968 | unsigned long hiwater_rss = get_mm_hiwater_rss(mm); | ||
| 969 | |||
| 970 | if (*maxrss < hiwater_rss) | ||
| 971 | *maxrss = hiwater_rss; | ||
| 972 | } | ||
| 973 | |||
| 974 | #if defined(SPLIT_RSS_COUNTING) | ||
| 975 | void sync_mm_rss(struct task_struct *task, struct mm_struct *mm); | ||
| 976 | #else | ||
| 977 | static inline void sync_mm_rss(struct task_struct *task, struct mm_struct *mm) | ||
| 978 | { | ||
| 979 | } | ||
| 980 | #endif | ||
| 855 | 981 | ||
| 856 | /* | 982 | /* |
| 857 | * A callback you can register to apply pressure to ageable caches. | 983 | * A callback you can register to apply pressure to ageable caches. |
| @@ -1022,6 +1148,9 @@ extern void add_active_range(unsigned int nid, unsigned long start_pfn, | |||
| 1022 | extern void remove_active_range(unsigned int nid, unsigned long start_pfn, | 1148 | extern void remove_active_range(unsigned int nid, unsigned long start_pfn, |
| 1023 | unsigned long end_pfn); | 1149 | unsigned long end_pfn); |
| 1024 | extern void remove_all_active_ranges(void); | 1150 | extern void remove_all_active_ranges(void); |
| 1151 | void sort_node_map(void); | ||
| 1152 | unsigned long __absent_pages_in_range(int nid, unsigned long start_pfn, | ||
| 1153 | unsigned long end_pfn); | ||
| 1025 | extern unsigned long absent_pages_in_range(unsigned long start_pfn, | 1154 | extern unsigned long absent_pages_in_range(unsigned long start_pfn, |
| 1026 | unsigned long end_pfn); | 1155 | unsigned long end_pfn); |
| 1027 | extern void get_pfn_range_for_nid(unsigned int nid, | 1156 | extern void get_pfn_range_for_nid(unsigned int nid, |
| @@ -1029,6 +1158,10 @@ extern void get_pfn_range_for_nid(unsigned int nid, | |||
| 1029 | extern unsigned long find_min_pfn_with_active_regions(void); | 1158 | extern unsigned long find_min_pfn_with_active_regions(void); |
| 1030 | extern void free_bootmem_with_active_regions(int nid, | 1159 | extern void free_bootmem_with_active_regions(int nid, |
| 1031 | unsigned long max_low_pfn); | 1160 | unsigned long max_low_pfn); |
| 1161 | int add_from_early_node_map(struct range *range, int az, | ||
| 1162 | int nr_range, int nid); | ||
| 1163 | void *__alloc_memory_core_early(int nodeid, u64 size, u64 align, | ||
| 1164 | u64 goal, u64 limit); | ||
| 1032 | typedef int (*work_fn_t)(unsigned long, unsigned long, void *); | 1165 | typedef int (*work_fn_t)(unsigned long, unsigned long, void *); |
| 1033 | extern void work_with_active_regions(int nid, work_fn_t work_fn, void *data); | 1166 | extern void work_with_active_regions(int nid, work_fn_t work_fn, void *data); |
| 1034 | extern void sparse_memory_present_with_active_regions(int nid); | 1167 | extern void sparse_memory_present_with_active_regions(int nid); |
| @@ -1061,16 +1194,13 @@ extern void si_meminfo(struct sysinfo * val); | |||
| 1061 | extern void si_meminfo_node(struct sysinfo *val, int nid); | 1194 | extern void si_meminfo_node(struct sysinfo *val, int nid); |
| 1062 | extern int after_bootmem; | 1195 | extern int after_bootmem; |
| 1063 | 1196 | ||
| 1064 | #ifdef CONFIG_NUMA | ||
| 1065 | extern void setup_per_cpu_pageset(void); | 1197 | extern void setup_per_cpu_pageset(void); |
| 1066 | #else | ||
| 1067 | static inline void setup_per_cpu_pageset(void) {} | ||
| 1068 | #endif | ||
| 1069 | 1198 | ||
| 1070 | extern void zone_pcp_update(struct zone *zone); | 1199 | extern void zone_pcp_update(struct zone *zone); |
| 1071 | 1200 | ||
| 1072 | /* nommu.c */ | 1201 | /* nommu.c */ |
| 1073 | extern atomic_long_t mmap_pages_allocated; | 1202 | extern atomic_long_t mmap_pages_allocated; |
| 1203 | extern int nommu_shrink_inode_mappings(struct inode *, size_t, size_t); | ||
| 1074 | 1204 | ||
| 1075 | /* prio_tree.c */ | 1205 | /* prio_tree.c */ |
| 1076 | void vma_prio_tree_add(struct vm_area_struct *, struct vm_area_struct *old); | 1206 | void vma_prio_tree_add(struct vm_area_struct *, struct vm_area_struct *old); |
| @@ -1092,7 +1222,7 @@ static inline void vma_nonlinear_insert(struct vm_area_struct *vma, | |||
| 1092 | 1222 | ||
| 1093 | /* mmap.c */ | 1223 | /* mmap.c */ |
| 1094 | extern int __vm_enough_memory(struct mm_struct *mm, long pages, int cap_sys_admin); | 1224 | extern int __vm_enough_memory(struct mm_struct *mm, long pages, int cap_sys_admin); |
| 1095 | extern void vma_adjust(struct vm_area_struct *vma, unsigned long start, | 1225 | extern int vma_adjust(struct vm_area_struct *vma, unsigned long start, |
| 1096 | unsigned long end, pgoff_t pgoff, struct vm_area_struct *insert); | 1226 | unsigned long end, pgoff_t pgoff, struct vm_area_struct *insert); |
| 1097 | extern struct vm_area_struct *vma_merge(struct mm_struct *, | 1227 | extern struct vm_area_struct *vma_merge(struct mm_struct *, |
| 1098 | struct vm_area_struct *prev, unsigned long addr, unsigned long end, | 1228 | struct vm_area_struct *prev, unsigned long addr, unsigned long end, |
| @@ -1300,12 +1430,19 @@ extern int randomize_va_space; | |||
| 1300 | const char * arch_vma_name(struct vm_area_struct *vma); | 1430 | const char * arch_vma_name(struct vm_area_struct *vma); |
| 1301 | void print_vma_addr(char *prefix, unsigned long rip); | 1431 | void print_vma_addr(char *prefix, unsigned long rip); |
| 1302 | 1432 | ||
| 1433 | void sparse_mem_maps_populate_node(struct page **map_map, | ||
| 1434 | unsigned long pnum_begin, | ||
| 1435 | unsigned long pnum_end, | ||
| 1436 | unsigned long map_count, | ||
| 1437 | int nodeid); | ||
| 1438 | |||
| 1303 | struct page *sparse_mem_map_populate(unsigned long pnum, int nid); | 1439 | struct page *sparse_mem_map_populate(unsigned long pnum, int nid); |
| 1304 | pgd_t *vmemmap_pgd_populate(unsigned long addr, int node); | 1440 | pgd_t *vmemmap_pgd_populate(unsigned long addr, int node); |
| 1305 | pud_t *vmemmap_pud_populate(pgd_t *pgd, unsigned long addr, int node); | 1441 | pud_t *vmemmap_pud_populate(pgd_t *pgd, unsigned long addr, int node); |
| 1306 | pmd_t *vmemmap_pmd_populate(pud_t *pud, unsigned long addr, int node); | 1442 | pmd_t *vmemmap_pmd_populate(pud_t *pud, unsigned long addr, int node); |
| 1307 | pte_t *vmemmap_pte_populate(pmd_t *pmd, unsigned long addr, int node); | 1443 | pte_t *vmemmap_pte_populate(pmd_t *pmd, unsigned long addr, int node); |
| 1308 | void *vmemmap_alloc_block(unsigned long size, int node); | 1444 | void *vmemmap_alloc_block(unsigned long size, int node); |
| 1445 | void *vmemmap_alloc_block_buf(unsigned long size, int node); | ||
| 1309 | void vmemmap_verify(pte_t *, int, unsigned long, unsigned long); | 1446 | void vmemmap_verify(pte_t *, int, unsigned long, unsigned long); |
| 1310 | int vmemmap_populate_basepages(struct page *start_page, | 1447 | int vmemmap_populate_basepages(struct page *start_page, |
| 1311 | unsigned long pages, int node); | 1448 | unsigned long pages, int node); |
| @@ -1316,11 +1453,19 @@ extern int account_locked_memory(struct mm_struct *mm, struct rlimit *rlim, | |||
| 1316 | size_t size); | 1453 | size_t size); |
| 1317 | extern void refund_locked_memory(struct mm_struct *mm, size_t size); | 1454 | extern void refund_locked_memory(struct mm_struct *mm, size_t size); |
| 1318 | 1455 | ||
| 1456 | enum mf_flags { | ||
| 1457 | MF_COUNT_INCREASED = 1 << 0, | ||
| 1458 | }; | ||
| 1319 | extern void memory_failure(unsigned long pfn, int trapno); | 1459 | extern void memory_failure(unsigned long pfn, int trapno); |
| 1320 | extern int __memory_failure(unsigned long pfn, int trapno, int ref); | 1460 | extern int __memory_failure(unsigned long pfn, int trapno, int flags); |
| 1461 | extern int unpoison_memory(unsigned long pfn); | ||
| 1321 | extern int sysctl_memory_failure_early_kill; | 1462 | extern int sysctl_memory_failure_early_kill; |
| 1322 | extern int sysctl_memory_failure_recovery; | 1463 | extern int sysctl_memory_failure_recovery; |
| 1464 | extern void shake_page(struct page *p, int access); | ||
| 1323 | extern atomic_long_t mce_bad_pages; | 1465 | extern atomic_long_t mce_bad_pages; |
| 1466 | extern int soft_offline_page(struct page *page, int flags); | ||
| 1467 | |||
| 1468 | extern void dump_page(struct page *page); | ||
| 1324 | 1469 | ||
| 1325 | #endif /* __KERNEL__ */ | 1470 | #endif /* __KERNEL__ */ |
| 1326 | #endif /* _LINUX_MM_H */ | 1471 | #endif /* _LINUX_MM_H */ |
diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h index 84a524afb3dc..b8bb9a6a1f37 100644 --- a/include/linux/mm_types.h +++ b/include/linux/mm_types.h | |||
| @@ -24,12 +24,6 @@ struct address_space; | |||
| 24 | 24 | ||
| 25 | #define USE_SPLIT_PTLOCKS (NR_CPUS >= CONFIG_SPLIT_PTLOCK_CPUS) | 25 | #define USE_SPLIT_PTLOCKS (NR_CPUS >= CONFIG_SPLIT_PTLOCK_CPUS) |
| 26 | 26 | ||
| 27 | #if USE_SPLIT_PTLOCKS | ||
| 28 | typedef atomic_long_t mm_counter_t; | ||
| 29 | #else /* !USE_SPLIT_PTLOCKS */ | ||
| 30 | typedef unsigned long mm_counter_t; | ||
| 31 | #endif /* !USE_SPLIT_PTLOCKS */ | ||
| 32 | |||
| 33 | /* | 27 | /* |
| 34 | * Each physical page in the system has a struct page associated with | 28 | * Each physical page in the system has a struct page associated with |
| 35 | * it to keep track of whatever it is we are using the page for at the | 29 | * it to keep track of whatever it is we are using the page for at the |
| @@ -122,7 +116,9 @@ struct vm_region { | |||
| 122 | unsigned long vm_pgoff; /* the offset in vm_file corresponding to vm_start */ | 116 | unsigned long vm_pgoff; /* the offset in vm_file corresponding to vm_start */ |
| 123 | struct file *vm_file; /* the backing file or NULL */ | 117 | struct file *vm_file; /* the backing file or NULL */ |
| 124 | 118 | ||
| 125 | atomic_t vm_usage; /* region usage count */ | 119 | int vm_usage; /* region usage count (access under nommu_region_sem) */ |
| 120 | bool vm_icache_flushed : 1; /* true if the icache has been flushed for | ||
| 121 | * this region */ | ||
| 126 | }; | 122 | }; |
| 127 | 123 | ||
| 128 | /* | 124 | /* |
| @@ -167,7 +163,8 @@ struct vm_area_struct { | |||
| 167 | * can only be in the i_mmap tree. An anonymous MAP_PRIVATE, stack | 163 | * can only be in the i_mmap tree. An anonymous MAP_PRIVATE, stack |
| 168 | * or brk vma (with NULL file) can only be in an anon_vma list. | 164 | * or brk vma (with NULL file) can only be in an anon_vma list. |
| 169 | */ | 165 | */ |
| 170 | struct list_head anon_vma_node; /* Serialized by anon_vma->lock */ | 166 | struct list_head anon_vma_chain; /* Serialized by mmap_sem & |
| 167 | * page_table_lock */ | ||
| 171 | struct anon_vma *anon_vma; /* Serialized by page_table_lock */ | 168 | struct anon_vma *anon_vma; /* Serialized by page_table_lock */ |
| 172 | 169 | ||
| 173 | /* Function pointers to deal with this struct. */ | 170 | /* Function pointers to deal with this struct. */ |
| @@ -199,14 +196,39 @@ struct core_state { | |||
| 199 | struct completion startup; | 196 | struct completion startup; |
| 200 | }; | 197 | }; |
| 201 | 198 | ||
| 199 | enum { | ||
| 200 | MM_FILEPAGES, | ||
| 201 | MM_ANONPAGES, | ||
| 202 | MM_SWAPENTS, | ||
| 203 | NR_MM_COUNTERS | ||
| 204 | }; | ||
| 205 | |||
| 206 | #if USE_SPLIT_PTLOCKS && defined(CONFIG_MMU) | ||
| 207 | #define SPLIT_RSS_COUNTING | ||
| 208 | struct mm_rss_stat { | ||
| 209 | atomic_long_t count[NR_MM_COUNTERS]; | ||
| 210 | }; | ||
| 211 | /* per-thread cached information, */ | ||
| 212 | struct task_rss_stat { | ||
| 213 | int events; /* for synchronization threshold */ | ||
| 214 | int count[NR_MM_COUNTERS]; | ||
| 215 | }; | ||
| 216 | #else /* !USE_SPLIT_PTLOCKS */ | ||
| 217 | struct mm_rss_stat { | ||
| 218 | unsigned long count[NR_MM_COUNTERS]; | ||
| 219 | }; | ||
| 220 | #endif /* !USE_SPLIT_PTLOCKS */ | ||
| 221 | |||
| 202 | struct mm_struct { | 222 | struct mm_struct { |
| 203 | struct vm_area_struct * mmap; /* list of VMAs */ | 223 | struct vm_area_struct * mmap; /* list of VMAs */ |
| 204 | struct rb_root mm_rb; | 224 | struct rb_root mm_rb; |
| 205 | struct vm_area_struct * mmap_cache; /* last find_vma result */ | 225 | struct vm_area_struct * mmap_cache; /* last find_vma result */ |
| 226 | #ifdef CONFIG_MMU | ||
| 206 | unsigned long (*get_unmapped_area) (struct file *filp, | 227 | unsigned long (*get_unmapped_area) (struct file *filp, |
| 207 | unsigned long addr, unsigned long len, | 228 | unsigned long addr, unsigned long len, |
| 208 | unsigned long pgoff, unsigned long flags); | 229 | unsigned long pgoff, unsigned long flags); |
| 209 | void (*unmap_area) (struct mm_struct *mm, unsigned long addr); | 230 | void (*unmap_area) (struct mm_struct *mm, unsigned long addr); |
| 231 | #endif | ||
| 210 | unsigned long mmap_base; /* base of mmap area */ | 232 | unsigned long mmap_base; /* base of mmap area */ |
| 211 | unsigned long task_size; /* size of task vm space */ | 233 | unsigned long task_size; /* size of task vm space */ |
| 212 | unsigned long cached_hole_size; /* if non-zero, the largest hole below free_area_cache */ | 234 | unsigned long cached_hole_size; /* if non-zero, the largest hole below free_area_cache */ |
| @@ -223,11 +245,6 @@ struct mm_struct { | |||
| 223 | * by mmlist_lock | 245 | * by mmlist_lock |
| 224 | */ | 246 | */ |
| 225 | 247 | ||
| 226 | /* Special counters, in some configurations protected by the | ||
| 227 | * page_table_lock, in other configurations by being atomic. | ||
| 228 | */ | ||
| 229 | mm_counter_t _file_rss; | ||
| 230 | mm_counter_t _anon_rss; | ||
| 231 | 248 | ||
| 232 | unsigned long hiwater_rss; /* High-watermark of RSS usage */ | 249 | unsigned long hiwater_rss; /* High-watermark of RSS usage */ |
| 233 | unsigned long hiwater_vm; /* High-water virtual memory usage */ | 250 | unsigned long hiwater_vm; /* High-water virtual memory usage */ |
| @@ -240,6 +257,12 @@ struct mm_struct { | |||
| 240 | 257 | ||
| 241 | unsigned long saved_auxv[AT_VECTOR_SIZE]; /* for /proc/PID/auxv */ | 258 | unsigned long saved_auxv[AT_VECTOR_SIZE]; /* for /proc/PID/auxv */ |
| 242 | 259 | ||
| 260 | /* | ||
| 261 | * Special counters, in some configurations protected by the | ||
| 262 | * page_table_lock, in other configurations by being atomic. | ||
| 263 | */ | ||
| 264 | struct mm_rss_stat rss_stat; | ||
| 265 | |||
| 243 | struct linux_binfmt *binfmt; | 266 | struct linux_binfmt *binfmt; |
| 244 | 267 | ||
| 245 | cpumask_t cpu_vm_mask; | 268 | cpumask_t cpu_vm_mask; |
diff --git a/include/linux/mmc/card.h b/include/linux/mmc/card.h index 2ee22e8af110..d02d2c6e0cfe 100644 --- a/include/linux/mmc/card.h +++ b/include/linux/mmc/card.h | |||
| @@ -99,6 +99,8 @@ struct mmc_card { | |||
| 99 | #define MMC_STATE_BLOCKADDR (1<<3) /* card uses block-addressing */ | 99 | #define MMC_STATE_BLOCKADDR (1<<3) /* card uses block-addressing */ |
| 100 | unsigned int quirks; /* card quirks */ | 100 | unsigned int quirks; /* card quirks */ |
| 101 | #define MMC_QUIRK_LENIENT_FN0 (1<<0) /* allow SDIO FN0 writes outside of the VS CCCR range */ | 101 | #define MMC_QUIRK_LENIENT_FN0 (1<<0) /* allow SDIO FN0 writes outside of the VS CCCR range */ |
| 102 | #define MMC_QUIRK_BLKSZ_FOR_BYTE_MODE (1<<1) /* use func->cur_blksize */ | ||
| 103 | /* for byte mode */ | ||
| 102 | 104 | ||
| 103 | u32 raw_cid[4]; /* raw card CID */ | 105 | u32 raw_cid[4]; /* raw card CID */ |
| 104 | u32 raw_csd[4]; /* raw card CSD */ | 106 | u32 raw_csd[4]; /* raw card CSD */ |
| @@ -139,6 +141,11 @@ static inline int mmc_card_lenient_fn0(const struct mmc_card *c) | |||
| 139 | return c->quirks & MMC_QUIRK_LENIENT_FN0; | 141 | return c->quirks & MMC_QUIRK_LENIENT_FN0; |
| 140 | } | 142 | } |
| 141 | 143 | ||
| 144 | static inline int mmc_blksz_for_byte_mode(const struct mmc_card *c) | ||
| 145 | { | ||
| 146 | return c->quirks & MMC_QUIRK_BLKSZ_FOR_BYTE_MODE; | ||
| 147 | } | ||
| 148 | |||
| 142 | #define mmc_card_name(c) ((c)->cid.prod_name) | 149 | #define mmc_card_name(c) ((c)->cid.prod_name) |
| 143 | #define mmc_card_id(c) (dev_name(&(c)->dev)) | 150 | #define mmc_card_id(c) (dev_name(&(c)->dev)) |
| 144 | 151 | ||
diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h index eaf36364b7d4..43eaf5ca5848 100644 --- a/include/linux/mmc/host.h +++ b/include/linux/mmc/host.h | |||
| @@ -14,6 +14,7 @@ | |||
| 14 | #include <linux/sched.h> | 14 | #include <linux/sched.h> |
| 15 | 15 | ||
| 16 | #include <linux/mmc/core.h> | 16 | #include <linux/mmc/core.h> |
| 17 | #include <linux/mmc/pm.h> | ||
| 17 | 18 | ||
| 18 | struct mmc_ios { | 19 | struct mmc_ios { |
| 19 | unsigned int clock; /* clock rate */ | 20 | unsigned int clock; /* clock rate */ |
| @@ -152,6 +153,8 @@ struct mmc_host { | |||
| 152 | #define MMC_CAP_NONREMOVABLE (1 << 8) /* Nonremovable e.g. eMMC */ | 153 | #define MMC_CAP_NONREMOVABLE (1 << 8) /* Nonremovable e.g. eMMC */ |
| 153 | #define MMC_CAP_WAIT_WHILE_BUSY (1 << 9) /* Waits while card is busy */ | 154 | #define MMC_CAP_WAIT_WHILE_BUSY (1 << 9) /* Waits while card is busy */ |
| 154 | 155 | ||
| 156 | mmc_pm_flag_t pm_caps; /* supported pm features */ | ||
| 157 | |||
| 155 | /* host specific block data */ | 158 | /* host specific block data */ |
| 156 | unsigned int max_seg_size; /* see blk_queue_max_segment_size */ | 159 | unsigned int max_seg_size; /* see blk_queue_max_segment_size */ |
| 157 | unsigned short max_hw_segs; /* see blk_queue_max_hw_segments */ | 160 | unsigned short max_hw_segs; /* see blk_queue_max_hw_segments */ |
| @@ -197,6 +200,8 @@ struct mmc_host { | |||
| 197 | struct task_struct *sdio_irq_thread; | 200 | struct task_struct *sdio_irq_thread; |
| 198 | atomic_t sdio_irq_thread_abort; | 201 | atomic_t sdio_irq_thread_abort; |
| 199 | 202 | ||
| 203 | mmc_pm_flag_t pm_flags; /* requested pm features */ | ||
| 204 | |||
| 200 | #ifdef CONFIG_LEDS_TRIGGERS | 205 | #ifdef CONFIG_LEDS_TRIGGERS |
| 201 | struct led_trigger *led; /* activity led */ | 206 | struct led_trigger *led; /* activity led */ |
| 202 | #endif | 207 | #endif |
diff --git a/include/linux/mmc/mmc.h b/include/linux/mmc/mmc.h index c02c8db73701..8a49cbf0376d 100644 --- a/include/linux/mmc/mmc.h +++ b/include/linux/mmc/mmc.h | |||
| @@ -268,6 +268,7 @@ struct _mmc_csd { | |||
| 268 | 268 | ||
| 269 | #define EXT_CSD_CARD_TYPE_26 (1<<0) /* Card can run at 26MHz */ | 269 | #define EXT_CSD_CARD_TYPE_26 (1<<0) /* Card can run at 26MHz */ |
| 270 | #define EXT_CSD_CARD_TYPE_52 (1<<1) /* Card can run at 52MHz */ | 270 | #define EXT_CSD_CARD_TYPE_52 (1<<1) /* Card can run at 52MHz */ |
| 271 | #define EXT_CSD_CARD_TYPE_MASK 0x3 /* Mask out reserved and DDR bits */ | ||
| 271 | 272 | ||
| 272 | #define EXT_CSD_BUS_WIDTH_1 0 /* Card is in 1 bit mode */ | 273 | #define EXT_CSD_BUS_WIDTH_1 0 /* Card is in 1 bit mode */ |
| 273 | #define EXT_CSD_BUS_WIDTH_4 1 /* Card is in 4 bit mode */ | 274 | #define EXT_CSD_BUS_WIDTH_4 1 /* Card is in 4 bit mode */ |
diff --git a/include/linux/mmc/pm.h b/include/linux/mmc/pm.h new file mode 100644 index 000000000000..d37aac49cf9a --- /dev/null +++ b/include/linux/mmc/pm.h | |||
| @@ -0,0 +1,30 @@ | |||
| 1 | /* | ||
| 2 | * linux/include/linux/mmc/pm.h | ||
| 3 | * | ||
| 4 | * Author: Nicolas Pitre | ||
| 5 | * Copyright: (C) 2009 Marvell Technology Group Ltd. | ||
| 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_MMC_PM_H | ||
| 13 | #define LINUX_MMC_PM_H | ||
| 14 | |||
| 15 | /* | ||
| 16 | * These flags are used to describe power management features that | ||
| 17 | * some cards (typically SDIO cards) might wish to benefit from when | ||
| 18 | * the host system is being suspended. There are several layers of | ||
| 19 | * abstractions involved, from the host controller driver, to the MMC core | ||
| 20 | * code, to the SDIO core code, to finally get to the actual SDIO function | ||
| 21 | * driver. This file is therefore used for common definitions shared across | ||
| 22 | * all those layers. | ||
| 23 | */ | ||
| 24 | |||
| 25 | typedef unsigned int mmc_pm_flag_t; | ||
| 26 | |||
| 27 | #define MMC_PM_KEEP_POWER (1 << 0) /* preserve card power during suspend */ | ||
| 28 | #define MMC_PM_WAKE_SDIO_IRQ (1 << 1) /* wake up host system on SDIO IRQ assertion */ | ||
| 29 | |||
| 30 | #endif | ||
diff --git a/include/linux/mmc/sdio.h b/include/linux/mmc/sdio.h index 47ba464f5170..0ebaef577ff5 100644 --- a/include/linux/mmc/sdio.h +++ b/include/linux/mmc/sdio.h | |||
| @@ -95,6 +95,8 @@ | |||
| 95 | #define SDIO_BUS_WIDTH_1BIT 0x00 | 95 | #define SDIO_BUS_WIDTH_1BIT 0x00 |
| 96 | #define SDIO_BUS_WIDTH_4BIT 0x02 | 96 | #define SDIO_BUS_WIDTH_4BIT 0x02 |
| 97 | 97 | ||
| 98 | #define SDIO_BUS_ASYNC_INT 0x20 | ||
| 99 | |||
| 98 | #define SDIO_BUS_CD_DISABLE 0x80 /* disable pull-up on DAT3 (pin 1) */ | 100 | #define SDIO_BUS_CD_DISABLE 0x80 /* disable pull-up on DAT3 (pin 1) */ |
| 99 | 101 | ||
| 100 | #define SDIO_CCCR_CAPS 0x08 | 102 | #define SDIO_CCCR_CAPS 0x08 |
diff --git a/include/linux/mmc/sdio_func.h b/include/linux/mmc/sdio_func.h index ac3ab683fec6..c6c0cceba5fe 100644 --- a/include/linux/mmc/sdio_func.h +++ b/include/linux/mmc/sdio_func.h | |||
| @@ -15,6 +15,8 @@ | |||
| 15 | #include <linux/device.h> | 15 | #include <linux/device.h> |
| 16 | #include <linux/mod_devicetable.h> | 16 | #include <linux/mod_devicetable.h> |
| 17 | 17 | ||
| 18 | #include <linux/mmc/pm.h> | ||
| 19 | |||
| 18 | struct mmc_card; | 20 | struct mmc_card; |
| 19 | struct sdio_func; | 21 | struct sdio_func; |
| 20 | 22 | ||
| @@ -153,5 +155,8 @@ extern unsigned char sdio_f0_readb(struct sdio_func *func, | |||
| 153 | extern void sdio_f0_writeb(struct sdio_func *func, unsigned char b, | 155 | extern void sdio_f0_writeb(struct sdio_func *func, unsigned char b, |
| 154 | unsigned int addr, int *err_ret); | 156 | unsigned int addr, int *err_ret); |
| 155 | 157 | ||
| 158 | extern mmc_pm_flag_t sdio_get_host_pm_caps(struct sdio_func *func); | ||
| 159 | extern int sdio_set_host_pm_flags(struct sdio_func *func, mmc_pm_flag_t flags); | ||
| 160 | |||
| 156 | #endif | 161 | #endif |
| 157 | 162 | ||
diff --git a/include/linux/mmc/sdio_ids.h b/include/linux/mmc/sdio_ids.h index 2dbfb5a05994..33b2ea09a4ad 100644 --- a/include/linux/mmc/sdio_ids.h +++ b/include/linux/mmc/sdio_ids.h | |||
| @@ -28,6 +28,7 @@ | |||
| 28 | #define SDIO_DEVICE_ID_INTEL_IWMC3200TOP 0x1404 | 28 | #define SDIO_DEVICE_ID_INTEL_IWMC3200TOP 0x1404 |
| 29 | #define SDIO_DEVICE_ID_INTEL_IWMC3200GPS 0x1405 | 29 | #define SDIO_DEVICE_ID_INTEL_IWMC3200GPS 0x1405 |
| 30 | #define SDIO_DEVICE_ID_INTEL_IWMC3200BT 0x1406 | 30 | #define SDIO_DEVICE_ID_INTEL_IWMC3200BT 0x1406 |
| 31 | #define SDIO_DEVICE_ID_INTEL_IWMC3200WIMAX_2G5 0x1407 | ||
| 31 | 32 | ||
| 32 | #define SDIO_VENDOR_ID_MARVELL 0x02df | 33 | #define SDIO_VENDOR_ID_MARVELL 0x02df |
| 33 | #define SDIO_DEVICE_ID_MARVELL_LIBERTAS 0x9103 | 34 | #define SDIO_DEVICE_ID_MARVELL_LIBERTAS 0x9103 |
diff --git a/include/linux/mmdebug.h b/include/linux/mmdebug.h index 8a5509877192..ee24ef8ab616 100644 --- a/include/linux/mmdebug.h +++ b/include/linux/mmdebug.h | |||
| @@ -1,8 +1,6 @@ | |||
| 1 | #ifndef LINUX_MM_DEBUG_H | 1 | #ifndef LINUX_MM_DEBUG_H |
| 2 | #define LINUX_MM_DEBUG_H 1 | 2 | #define LINUX_MM_DEBUG_H 1 |
| 3 | 3 | ||
| 4 | #include <linux/autoconf.h> | ||
| 5 | |||
| 6 | #ifdef CONFIG_DEBUG_VM | 4 | #ifdef CONFIG_DEBUG_VM |
| 7 | #define VM_BUG_ON(cond) BUG_ON(cond) | 5 | #define VM_BUG_ON(cond) BUG_ON(cond) |
| 8 | #else | 6 | #else |
diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h index 6f7561730d88..cf9e458e96b0 100644 --- a/include/linux/mmzone.h +++ b/include/linux/mmzone.h | |||
| @@ -15,7 +15,7 @@ | |||
| 15 | #include <linux/seqlock.h> | 15 | #include <linux/seqlock.h> |
| 16 | #include <linux/nodemask.h> | 16 | #include <linux/nodemask.h> |
| 17 | #include <linux/pageblock-flags.h> | 17 | #include <linux/pageblock-flags.h> |
| 18 | #include <linux/bounds.h> | 18 | #include <generated/bounds.h> |
| 19 | #include <asm/atomic.h> | 19 | #include <asm/atomic.h> |
| 20 | #include <asm/page.h> | 20 | #include <asm/page.h> |
| 21 | 21 | ||
| @@ -184,13 +184,7 @@ struct per_cpu_pageset { | |||
| 184 | s8 stat_threshold; | 184 | s8 stat_threshold; |
| 185 | s8 vm_stat_diff[NR_VM_ZONE_STAT_ITEMS]; | 185 | s8 vm_stat_diff[NR_VM_ZONE_STAT_ITEMS]; |
| 186 | #endif | 186 | #endif |
| 187 | } ____cacheline_aligned_in_smp; | 187 | }; |
| 188 | |||
| 189 | #ifdef CONFIG_NUMA | ||
| 190 | #define zone_pcp(__z, __cpu) ((__z)->pageset[(__cpu)]) | ||
| 191 | #else | ||
| 192 | #define zone_pcp(__z, __cpu) (&(__z)->pageset[(__cpu)]) | ||
| 193 | #endif | ||
| 194 | 188 | ||
| 195 | #endif /* !__GENERATING_BOUNDS.H */ | 189 | #endif /* !__GENERATING_BOUNDS.H */ |
| 196 | 190 | ||
| @@ -306,14 +300,13 @@ struct zone { | |||
| 306 | */ | 300 | */ |
| 307 | unsigned long min_unmapped_pages; | 301 | unsigned long min_unmapped_pages; |
| 308 | unsigned long min_slab_pages; | 302 | unsigned long min_slab_pages; |
| 309 | struct per_cpu_pageset *pageset[NR_CPUS]; | ||
| 310 | #else | ||
| 311 | struct per_cpu_pageset pageset[NR_CPUS]; | ||
| 312 | #endif | 303 | #endif |
| 304 | struct per_cpu_pageset __percpu *pageset; | ||
| 313 | /* | 305 | /* |
| 314 | * free areas of different sizes | 306 | * free areas of different sizes |
| 315 | */ | 307 | */ |
| 316 | spinlock_t lock; | 308 | spinlock_t lock; |
| 309 | int all_unreclaimable; /* All pages pinned */ | ||
| 317 | #ifdef CONFIG_MEMORY_HOTPLUG | 310 | #ifdef CONFIG_MEMORY_HOTPLUG |
| 318 | /* see spanned/present_pages for more description */ | 311 | /* see spanned/present_pages for more description */ |
| 319 | seqlock_t span_seqlock; | 312 | seqlock_t span_seqlock; |
| @@ -349,7 +342,7 @@ struct zone { | |||
| 349 | * prev_priority holds the scanning priority for this zone. It is | 342 | * prev_priority holds the scanning priority for this zone. It is |
| 350 | * defined as the scanning priority at which we achieved our reclaim | 343 | * defined as the scanning priority at which we achieved our reclaim |
| 351 | * target at the previous try_to_free_pages() or balance_pgdat() | 344 | * target at the previous try_to_free_pages() or balance_pgdat() |
| 352 | * invokation. | 345 | * invocation. |
| 353 | * | 346 | * |
| 354 | * We use prev_priority as a measure of how much stress page reclaim is | 347 | * We use prev_priority as a measure of how much stress page reclaim is |
| 355 | * under - it drives the swappiness decision: whether to unmap mapped | 348 | * under - it drives the swappiness decision: whether to unmap mapped |
| @@ -425,7 +418,6 @@ struct zone { | |||
| 425 | } ____cacheline_internodealigned_in_smp; | 418 | } ____cacheline_internodealigned_in_smp; |
| 426 | 419 | ||
| 427 | typedef enum { | 420 | typedef enum { |
| 428 | ZONE_ALL_UNRECLAIMABLE, /* all pages pinned */ | ||
| 429 | ZONE_RECLAIM_LOCKED, /* prevents concurrent reclaim */ | 421 | ZONE_RECLAIM_LOCKED, /* prevents concurrent reclaim */ |
| 430 | ZONE_OOM_LOCKED, /* zone is in OOM killer zonelist */ | 422 | ZONE_OOM_LOCKED, /* zone is in OOM killer zonelist */ |
| 431 | } zone_flags_t; | 423 | } zone_flags_t; |
| @@ -445,11 +437,6 @@ static inline void zone_clear_flag(struct zone *zone, zone_flags_t flag) | |||
| 445 | clear_bit(flag, &zone->flags); | 437 | clear_bit(flag, &zone->flags); |
| 446 | } | 438 | } |
| 447 | 439 | ||
| 448 | static inline int zone_is_all_unreclaimable(const struct zone *zone) | ||
| 449 | { | ||
| 450 | return test_bit(ZONE_ALL_UNRECLAIMABLE, &zone->flags); | ||
| 451 | } | ||
| 452 | |||
| 453 | static inline int zone_is_reclaim_locked(const struct zone *zone) | 440 | static inline int zone_is_reclaim_locked(const struct zone *zone) |
| 454 | { | 441 | { |
| 455 | return test_bit(ZONE_RECLAIM_LOCKED, &zone->flags); | 442 | return test_bit(ZONE_RECLAIM_LOCKED, &zone->flags); |
| @@ -620,7 +607,9 @@ typedef struct pglist_data { | |||
| 620 | struct page_cgroup *node_page_cgroup; | 607 | struct page_cgroup *node_page_cgroup; |
| 621 | #endif | 608 | #endif |
| 622 | #endif | 609 | #endif |
| 610 | #ifndef CONFIG_NO_BOOTMEM | ||
| 623 | struct bootmem_data *bdata; | 611 | struct bootmem_data *bdata; |
| 612 | #endif | ||
| 624 | #ifdef CONFIG_MEMORY_HOTPLUG | 613 | #ifdef CONFIG_MEMORY_HOTPLUG |
| 625 | /* | 614 | /* |
| 626 | * Must be held any time you expect node_start_pfn, node_present_pages | 615 | * Must be held any time you expect node_start_pfn, node_present_pages |
diff --git a/include/linux/mnt_namespace.h b/include/linux/mnt_namespace.h index d74785c2393a..0b89efc6f215 100644 --- a/include/linux/mnt_namespace.h +++ b/include/linux/mnt_namespace.h | |||
| @@ -35,6 +35,7 @@ static inline void get_mnt_ns(struct mnt_namespace *ns) | |||
| 35 | extern const struct seq_operations mounts_op; | 35 | extern const struct seq_operations mounts_op; |
| 36 | extern const struct seq_operations mountinfo_op; | 36 | extern const struct seq_operations mountinfo_op; |
| 37 | extern const struct seq_operations mountstats_op; | 37 | extern const struct seq_operations mountstats_op; |
| 38 | extern int mnt_had_events(struct proc_mounts *); | ||
| 38 | 39 | ||
| 39 | #endif | 40 | #endif |
| 40 | #endif | 41 | #endif |
diff --git a/include/linux/module.h b/include/linux/module.h index 482efc865acf..515d53ae6a79 100644 --- a/include/linux/module.h +++ b/include/linux/module.h | |||
| @@ -17,7 +17,7 @@ | |||
| 17 | #include <linux/moduleparam.h> | 17 | #include <linux/moduleparam.h> |
| 18 | #include <linux/tracepoint.h> | 18 | #include <linux/tracepoint.h> |
| 19 | 19 | ||
| 20 | #include <asm/local.h> | 20 | #include <linux/percpu.h> |
| 21 | #include <asm/module.h> | 21 | #include <asm/module.h> |
| 22 | 22 | ||
| 23 | #include <trace/events/module.h> | 23 | #include <trace/events/module.h> |
| @@ -25,8 +25,10 @@ | |||
| 25 | /* Not Yet Implemented */ | 25 | /* Not Yet Implemented */ |
| 26 | #define MODULE_SUPPORTED_DEVICE(name) | 26 | #define MODULE_SUPPORTED_DEVICE(name) |
| 27 | 27 | ||
| 28 | /* some toolchains uses a `_' prefix for all user symbols */ | 28 | /* Some toolchains use a `_' prefix for all user symbols. */ |
| 29 | #ifndef MODULE_SYMBOL_PREFIX | 29 | #ifdef CONFIG_SYMBOL_PREFIX |
| 30 | #define MODULE_SYMBOL_PREFIX CONFIG_SYMBOL_PREFIX | ||
| 31 | #else | ||
| 30 | #define MODULE_SYMBOL_PREFIX "" | 32 | #define MODULE_SYMBOL_PREFIX "" |
| 31 | #endif | 33 | #endif |
| 32 | 34 | ||
| @@ -173,6 +175,7 @@ struct notifier_block; | |||
| 173 | 175 | ||
| 174 | #ifdef CONFIG_MODULES | 176 | #ifdef CONFIG_MODULES |
| 175 | 177 | ||
| 178 | extern int modules_disabled; /* for sysctl */ | ||
| 176 | /* Get/put a kernel symbol (calls must be symmetric) */ | 179 | /* Get/put a kernel symbol (calls must be symmetric) */ |
| 177 | void *__symbol_get(const char *symbol); | 180 | void *__symbol_get(const char *symbol); |
| 178 | void *__symbol_get_gpl(const char *symbol); | 181 | void *__symbol_get_gpl(const char *symbol); |
| @@ -327,8 +330,11 @@ struct module | |||
| 327 | struct module_notes_attrs *notes_attrs; | 330 | struct module_notes_attrs *notes_attrs; |
| 328 | #endif | 331 | #endif |
| 329 | 332 | ||
| 333 | #ifdef CONFIG_SMP | ||
| 330 | /* Per-cpu data. */ | 334 | /* Per-cpu data. */ |
| 331 | void *percpu; | 335 | void __percpu *percpu; |
| 336 | unsigned int percpu_size; | ||
| 337 | #endif | ||
| 332 | 338 | ||
| 333 | /* The command line arguments (may be mangled). People like | 339 | /* The command line arguments (may be mangled). People like |
| 334 | keeping pointers to this stuff */ | 340 | keeping pointers to this stuff */ |
| @@ -361,11 +367,10 @@ struct module | |||
| 361 | /* Destruction function. */ | 367 | /* Destruction function. */ |
| 362 | void (*exit)(void); | 368 | void (*exit)(void); |
| 363 | 369 | ||
| 364 | #ifdef CONFIG_SMP | 370 | struct module_ref { |
| 365 | char *refptr; | 371 | unsigned int incs; |
| 366 | #else | 372 | unsigned int decs; |
| 367 | local_t ref; | 373 | } __percpu *refptr; |
| 368 | #endif | ||
| 369 | #endif | 374 | #endif |
| 370 | 375 | ||
| 371 | #ifdef CONFIG_CONSTRUCTORS | 376 | #ifdef CONFIG_CONSTRUCTORS |
| @@ -391,6 +396,7 @@ static inline int module_is_live(struct module *mod) | |||
| 391 | struct module *__module_text_address(unsigned long addr); | 396 | struct module *__module_text_address(unsigned long addr); |
| 392 | struct module *__module_address(unsigned long addr); | 397 | struct module *__module_address(unsigned long addr); |
| 393 | bool is_module_address(unsigned long addr); | 398 | bool is_module_address(unsigned long addr); |
| 399 | bool is_module_percpu_address(unsigned long addr); | ||
| 394 | bool is_module_text_address(unsigned long addr); | 400 | bool is_module_text_address(unsigned long addr); |
| 395 | 401 | ||
| 396 | static inline int within_module_core(unsigned long addr, struct module *mod) | 402 | static inline int within_module_core(unsigned long addr, struct module *mod) |
| @@ -452,25 +458,16 @@ void __symbol_put(const char *symbol); | |||
| 452 | #define symbol_put(x) __symbol_put(MODULE_SYMBOL_PREFIX #x) | 458 | #define symbol_put(x) __symbol_put(MODULE_SYMBOL_PREFIX #x) |
| 453 | void symbol_put_addr(void *addr); | 459 | void symbol_put_addr(void *addr); |
| 454 | 460 | ||
| 455 | static inline local_t *__module_ref_addr(struct module *mod, int cpu) | ||
| 456 | { | ||
| 457 | #ifdef CONFIG_SMP | ||
| 458 | return (local_t *) (mod->refptr + per_cpu_offset(cpu)); | ||
| 459 | #else | ||
| 460 | return &mod->ref; | ||
| 461 | #endif | ||
| 462 | } | ||
| 463 | |||
| 464 | /* Sometimes we know we already have a refcount, and it's easier not | 461 | /* Sometimes we know we already have a refcount, and it's easier not |
| 465 | to handle the error case (which only happens with rmmod --wait). */ | 462 | to handle the error case (which only happens with rmmod --wait). */ |
| 466 | static inline void __module_get(struct module *module) | 463 | static inline void __module_get(struct module *module) |
| 467 | { | 464 | { |
| 468 | if (module) { | 465 | if (module) { |
| 469 | unsigned int cpu = get_cpu(); | 466 | preempt_disable(); |
| 470 | local_inc(__module_ref_addr(module, cpu)); | 467 | __this_cpu_inc(module->refptr->incs); |
| 471 | trace_module_get(module, _THIS_IP_, | 468 | trace_module_get(module, _THIS_IP_, |
| 472 | local_read(__module_ref_addr(module, cpu))); | 469 | __this_cpu_read(module->refptr->incs)); |
| 473 | put_cpu(); | 470 | preempt_enable(); |
| 474 | } | 471 | } |
| 475 | } | 472 | } |
| 476 | 473 | ||
| @@ -479,15 +476,16 @@ static inline int try_module_get(struct module *module) | |||
| 479 | int ret = 1; | 476 | int ret = 1; |
| 480 | 477 | ||
| 481 | if (module) { | 478 | if (module) { |
| 482 | unsigned int cpu = get_cpu(); | 479 | preempt_disable(); |
| 480 | |||
| 483 | if (likely(module_is_live(module))) { | 481 | if (likely(module_is_live(module))) { |
| 484 | local_inc(__module_ref_addr(module, cpu)); | 482 | __this_cpu_inc(module->refptr->incs); |
| 485 | trace_module_get(module, _THIS_IP_, | 483 | trace_module_get(module, _THIS_IP_, |
| 486 | local_read(__module_ref_addr(module, cpu))); | 484 | __this_cpu_read(module->refptr->incs)); |
| 487 | } | 485 | } else |
| 488 | else | ||
| 489 | ret = 0; | 486 | ret = 0; |
| 490 | put_cpu(); | 487 | |
| 488 | preempt_enable(); | ||
| 491 | } | 489 | } |
| 492 | return ret; | 490 | return ret; |
| 493 | } | 491 | } |
| @@ -569,6 +567,11 @@ static inline bool is_module_address(unsigned long addr) | |||
| 569 | return false; | 567 | return false; |
| 570 | } | 568 | } |
| 571 | 569 | ||
| 570 | static inline bool is_module_percpu_address(unsigned long addr) | ||
| 571 | { | ||
| 572 | return false; | ||
| 573 | } | ||
| 574 | |||
| 572 | static inline bool is_module_text_address(unsigned long addr) | 575 | static inline bool is_module_text_address(unsigned long addr) |
| 573 | { | 576 | { |
| 574 | return false; | 577 | return false; |
diff --git a/include/linux/mount.h b/include/linux/mount.h index 5d5275364867..4bd05474d11d 100644 --- a/include/linux/mount.h +++ b/include/linux/mount.h | |||
| @@ -34,7 +34,18 @@ struct mnt_namespace; | |||
| 34 | 34 | ||
| 35 | #define MNT_SHARED 0x1000 /* if the vfsmount is a shared mount */ | 35 | #define MNT_SHARED 0x1000 /* if the vfsmount is a shared mount */ |
| 36 | #define MNT_UNBINDABLE 0x2000 /* if the vfsmount is a unbindable mount */ | 36 | #define MNT_UNBINDABLE 0x2000 /* if the vfsmount is a unbindable mount */ |
| 37 | #define MNT_PNODE_MASK 0x3000 /* propagation flag mask */ | 37 | /* |
| 38 | * MNT_SHARED_MASK is the set of flags that should be cleared when a | ||
| 39 | * mount becomes shared. Currently, this is only the flag that says a | ||
| 40 | * mount cannot be bind mounted, since this is how we create a mount | ||
| 41 | * that shares events with another mount. If you add a new MNT_* | ||
| 42 | * flag, consider how it interacts with shared mounts. | ||
| 43 | */ | ||
| 44 | #define MNT_SHARED_MASK (MNT_UNBINDABLE) | ||
| 45 | #define MNT_PROPAGATION_MASK (MNT_SHARED | MNT_UNBINDABLE) | ||
| 46 | |||
| 47 | |||
| 48 | #define MNT_INTERNAL 0x4000 | ||
| 38 | 49 | ||
| 39 | struct vfsmount { | 50 | struct vfsmount { |
| 40 | struct list_head mnt_hash; | 51 | struct list_head mnt_hash; |
| @@ -66,7 +77,7 @@ struct vfsmount { | |||
| 66 | int mnt_pinned; | 77 | int mnt_pinned; |
| 67 | int mnt_ghosts; | 78 | int mnt_ghosts; |
| 68 | #ifdef CONFIG_SMP | 79 | #ifdef CONFIG_SMP |
| 69 | int *mnt_writers; | 80 | int __percpu *mnt_writers; |
| 70 | #else | 81 | #else |
| 71 | int mnt_writers; | 82 | int mnt_writers; |
| 72 | #endif | 83 | #endif |
| @@ -123,7 +134,6 @@ extern int do_add_mount(struct vfsmount *newmnt, struct path *path, | |||
| 123 | 134 | ||
| 124 | extern void mark_mounts_for_expiry(struct list_head *mounts); | 135 | extern void mark_mounts_for_expiry(struct list_head *mounts); |
| 125 | 136 | ||
| 126 | extern spinlock_t vfsmount_lock; | ||
| 127 | extern dev_t name_to_dev_t(char *name); | 137 | extern dev_t name_to_dev_t(char *name); |
| 128 | 138 | ||
| 129 | #endif /* _LINUX_MOUNT_H */ | 139 | #endif /* _LINUX_MOUNT_H */ |
diff --git a/include/linux/mroute.h b/include/linux/mroute.h index 08bc776d05e2..c5f3d53548e2 100644 --- a/include/linux/mroute.h +++ b/include/linux/mroute.h | |||
| @@ -59,20 +59,24 @@ struct vifctl { | |||
| 59 | unsigned char vifc_flags; /* VIFF_ flags */ | 59 | unsigned char vifc_flags; /* VIFF_ flags */ |
| 60 | unsigned char vifc_threshold; /* ttl limit */ | 60 | unsigned char vifc_threshold; /* ttl limit */ |
| 61 | unsigned int vifc_rate_limit; /* Rate limiter values (NI) */ | 61 | unsigned int vifc_rate_limit; /* Rate limiter values (NI) */ |
| 62 | struct in_addr vifc_lcl_addr; /* Our address */ | 62 | union { |
| 63 | struct in_addr vifc_lcl_addr; /* Local interface address */ | ||
| 64 | int vifc_lcl_ifindex; /* Local interface index */ | ||
| 65 | }; | ||
| 63 | struct in_addr vifc_rmt_addr; /* IPIP tunnel addr */ | 66 | struct in_addr vifc_rmt_addr; /* IPIP tunnel addr */ |
| 64 | }; | 67 | }; |
| 65 | 68 | ||
| 66 | #define VIFF_TUNNEL 0x1 /* IPIP tunnel */ | 69 | #define VIFF_TUNNEL 0x1 /* IPIP tunnel */ |
| 67 | #define VIFF_SRCRT 0x2 /* NI */ | 70 | #define VIFF_SRCRT 0x2 /* NI */ |
| 68 | #define VIFF_REGISTER 0x4 /* register vif */ | 71 | #define VIFF_REGISTER 0x4 /* register vif */ |
| 72 | #define VIFF_USE_IFINDEX 0x8 /* use vifc_lcl_ifindex instead of | ||
| 73 | vifc_lcl_addr to find an interface */ | ||
| 69 | 74 | ||
| 70 | /* | 75 | /* |
| 71 | * Cache manipulation structures for mrouted and PIMd | 76 | * Cache manipulation structures for mrouted and PIMd |
| 72 | */ | 77 | */ |
| 73 | 78 | ||
| 74 | struct mfcctl | 79 | struct mfcctl { |
| 75 | { | ||
| 76 | struct in_addr mfcc_origin; /* Origin of mcast */ | 80 | struct in_addr mfcc_origin; /* Origin of mcast */ |
| 77 | struct in_addr mfcc_mcastgrp; /* Group in question */ | 81 | struct in_addr mfcc_mcastgrp; /* Group in question */ |
| 78 | vifi_t mfcc_parent; /* Where it arrived */ | 82 | vifi_t mfcc_parent; /* Where it arrived */ |
| @@ -87,8 +91,7 @@ struct mfcctl | |||
| 87 | * Group count retrieval for mrouted | 91 | * Group count retrieval for mrouted |
| 88 | */ | 92 | */ |
| 89 | 93 | ||
| 90 | struct sioc_sg_req | 94 | struct sioc_sg_req { |
| 91 | { | ||
| 92 | struct in_addr src; | 95 | struct in_addr src; |
| 93 | struct in_addr grp; | 96 | struct in_addr grp; |
| 94 | unsigned long pktcnt; | 97 | unsigned long pktcnt; |
| @@ -100,8 +103,7 @@ struct sioc_sg_req | |||
| 100 | * To get vif packet counts | 103 | * To get vif packet counts |
| 101 | */ | 104 | */ |
| 102 | 105 | ||
| 103 | struct sioc_vif_req | 106 | struct sioc_vif_req { |
| 104 | { | ||
| 105 | vifi_t vifi; /* Which iface */ | 107 | vifi_t vifi; /* Which iface */ |
| 106 | unsigned long icount; /* In packets */ | 108 | unsigned long icount; /* In packets */ |
| 107 | unsigned long ocount; /* Out packets */ | 109 | unsigned long ocount; /* Out packets */ |
| @@ -114,8 +116,7 @@ struct sioc_vif_req | |||
| 114 | * data. Magically happens to be like an IP packet as per the original | 116 | * data. Magically happens to be like an IP packet as per the original |
| 115 | */ | 117 | */ |
| 116 | 118 | ||
| 117 | struct igmpmsg | 119 | struct igmpmsg { |
| 118 | { | ||
| 119 | __u32 unused1,unused2; | 120 | __u32 unused1,unused2; |
| 120 | unsigned char im_msgtype; /* What is this */ | 121 | unsigned char im_msgtype; /* What is this */ |
| 121 | unsigned char im_mbz; /* Must be zero */ | 122 | unsigned char im_mbz; /* Must be zero */ |
| @@ -176,8 +177,7 @@ static inline int ip_mr_init(void) | |||
| 176 | } | 177 | } |
| 177 | #endif | 178 | #endif |
| 178 | 179 | ||
| 179 | struct vif_device | 180 | struct vif_device { |
| 180 | { | ||
| 181 | struct net_device *dev; /* Device we are using */ | 181 | struct net_device *dev; /* Device we are using */ |
| 182 | unsigned long bytes_in,bytes_out; | 182 | unsigned long bytes_in,bytes_out; |
| 183 | unsigned long pkt_in,pkt_out; /* Statistics */ | 183 | unsigned long pkt_in,pkt_out; /* Statistics */ |
| @@ -190,8 +190,7 @@ struct vif_device | |||
| 190 | 190 | ||
| 191 | #define VIFF_STATIC 0x8000 | 191 | #define VIFF_STATIC 0x8000 |
| 192 | 192 | ||
| 193 | struct mfc_cache | 193 | struct mfc_cache { |
| 194 | { | ||
| 195 | struct mfc_cache *next; /* Next entry on cache line */ | 194 | struct mfc_cache *next; /* Next entry on cache line */ |
| 196 | #ifdef CONFIG_NET_NS | 195 | #ifdef CONFIG_NET_NS |
| 197 | struct net *mfc_net; | 196 | struct net *mfc_net; |
diff --git a/include/linux/mroute6.h b/include/linux/mroute6.h index b191865a6ca3..2caa1a8e525d 100644 --- a/include/linux/mroute6.h +++ b/include/linux/mroute6.h | |||
| @@ -75,8 +75,7 @@ struct mif6ctl { | |||
| 75 | * Cache manipulation structures for mrouted and PIMd | 75 | * Cache manipulation structures for mrouted and PIMd |
| 76 | */ | 76 | */ |
| 77 | 77 | ||
| 78 | struct mf6cctl | 78 | struct mf6cctl { |
| 79 | { | ||
| 80 | struct sockaddr_in6 mf6cc_origin; /* Origin of mcast */ | 79 | struct sockaddr_in6 mf6cc_origin; /* Origin of mcast */ |
| 81 | struct sockaddr_in6 mf6cc_mcastgrp; /* Group in question */ | 80 | struct sockaddr_in6 mf6cc_mcastgrp; /* Group in question */ |
| 82 | mifi_t mf6cc_parent; /* Where it arrived */ | 81 | mifi_t mf6cc_parent; /* Where it arrived */ |
| @@ -87,8 +86,7 @@ struct mf6cctl | |||
| 87 | * Group count retrieval for pim6sd | 86 | * Group count retrieval for pim6sd |
| 88 | */ | 87 | */ |
| 89 | 88 | ||
| 90 | struct sioc_sg_req6 | 89 | struct sioc_sg_req6 { |
| 91 | { | ||
| 92 | struct sockaddr_in6 src; | 90 | struct sockaddr_in6 src; |
| 93 | struct sockaddr_in6 grp; | 91 | struct sockaddr_in6 grp; |
| 94 | unsigned long pktcnt; | 92 | unsigned long pktcnt; |
| @@ -100,8 +98,7 @@ struct sioc_sg_req6 | |||
| 100 | * To get vif packet counts | 98 | * To get vif packet counts |
| 101 | */ | 99 | */ |
| 102 | 100 | ||
| 103 | struct sioc_mif_req6 | 101 | struct sioc_mif_req6 { |
| 104 | { | ||
| 105 | mifi_t mifi; /* Which iface */ | 102 | mifi_t mifi; /* Which iface */ |
| 106 | unsigned long icount; /* In packets */ | 103 | unsigned long icount; /* In packets */ |
| 107 | unsigned long ocount; /* Out packets */ | 104 | unsigned long ocount; /* Out packets */ |
| @@ -172,8 +169,7 @@ static inline void ip6_mr_cleanup(void) | |||
| 172 | } | 169 | } |
| 173 | #endif | 170 | #endif |
| 174 | 171 | ||
| 175 | struct mif_device | 172 | struct mif_device { |
| 176 | { | ||
| 177 | struct net_device *dev; /* Device we are using */ | 173 | struct net_device *dev; /* Device we are using */ |
| 178 | unsigned long bytes_in,bytes_out; | 174 | unsigned long bytes_in,bytes_out; |
| 179 | unsigned long pkt_in,pkt_out; /* Statistics */ | 175 | unsigned long pkt_in,pkt_out; /* Statistics */ |
| @@ -185,8 +181,7 @@ struct mif_device | |||
| 185 | 181 | ||
| 186 | #define VIFF_STATIC 0x8000 | 182 | #define VIFF_STATIC 0x8000 |
| 187 | 183 | ||
| 188 | struct mfc6_cache | 184 | struct mfc6_cache { |
| 189 | { | ||
| 190 | struct mfc6_cache *next; /* Next entry on cache line */ | 185 | struct mfc6_cache *next; /* Next entry on cache line */ |
| 191 | #ifdef CONFIG_NET_NS | 186 | #ifdef CONFIG_NET_NS |
| 192 | struct net *mfc6_net; | 187 | struct net *mfc6_net; |
diff --git a/include/linux/msdos_fs.h b/include/linux/msdos_fs.h index ce38f1caa5e1..34066e65fdeb 100644 --- a/include/linux/msdos_fs.h +++ b/include/linux/msdos_fs.h | |||
| @@ -15,6 +15,7 @@ | |||
| 15 | #define MSDOS_DPB_BITS 4 /* log2(MSDOS_DPB) */ | 15 | #define MSDOS_DPB_BITS 4 /* log2(MSDOS_DPB) */ |
| 16 | #define MSDOS_DPS (SECTOR_SIZE / sizeof(struct msdos_dir_entry)) | 16 | #define MSDOS_DPS (SECTOR_SIZE / sizeof(struct msdos_dir_entry)) |
| 17 | #define MSDOS_DPS_BITS 4 /* log2(MSDOS_DPS) */ | 17 | #define MSDOS_DPS_BITS 4 /* log2(MSDOS_DPS) */ |
| 18 | #define MSDOS_LONGNAME 256 /* maximum name length */ | ||
| 18 | #define CF_LE_W(v) le16_to_cpu(v) | 19 | #define CF_LE_W(v) le16_to_cpu(v) |
| 19 | #define CF_LE_L(v) le32_to_cpu(v) | 20 | #define CF_LE_L(v) le32_to_cpu(v) |
| 20 | #define CT_LE_W(v) cpu_to_le16(v) | 21 | #define CT_LE_W(v) cpu_to_le16(v) |
| @@ -47,8 +48,8 @@ | |||
| 47 | #define DELETED_FLAG 0xe5 /* marks file as deleted when in name[0] */ | 48 | #define DELETED_FLAG 0xe5 /* marks file as deleted when in name[0] */ |
| 48 | #define IS_FREE(n) (!*(n) || *(n) == DELETED_FLAG) | 49 | #define IS_FREE(n) (!*(n) || *(n) == DELETED_FLAG) |
| 49 | 50 | ||
| 51 | #define FAT_LFN_LEN 255 /* maximum long name length */ | ||
| 50 | #define MSDOS_NAME 11 /* maximum name length */ | 52 | #define MSDOS_NAME 11 /* maximum name length */ |
| 51 | #define MSDOS_LONGNAME 256 /* maximum name length */ | ||
| 52 | #define MSDOS_SLOTS 21 /* max # of slots for short and long names */ | 53 | #define MSDOS_SLOTS 21 /* max # of slots for short and long names */ |
| 53 | #define MSDOS_DOT ". " /* ".", padded to MSDOS_NAME chars */ | 54 | #define MSDOS_DOT ". " /* ".", padded to MSDOS_NAME chars */ |
| 54 | #define MSDOS_DOTDOT ".. " /* "..", padded to MSDOS_NAME chars */ | 55 | #define MSDOS_DOTDOT ".. " /* "..", padded to MSDOS_NAME chars */ |
diff --git a/include/linux/mtd/bbm.h b/include/linux/mtd/bbm.h index fff8c53e5434..9c3757c5759d 100644 --- a/include/linux/mtd/bbm.h +++ b/include/linux/mtd/bbm.h | |||
| @@ -19,22 +19,21 @@ | |||
| 19 | 19 | ||
| 20 | /** | 20 | /** |
| 21 | * struct nand_bbt_descr - bad block table descriptor | 21 | * struct nand_bbt_descr - bad block table descriptor |
| 22 | * @options: options for this descriptor | 22 | * @options: options for this descriptor |
| 23 | * @pages: the page(s) where we find the bbt, used with | 23 | * @pages: the page(s) where we find the bbt, used with option BBT_ABSPAGE |
| 24 | * option BBT_ABSPAGE when bbt is searched, | 24 | * when bbt is searched, then we store the found bbts pages here. |
| 25 | * then we store the found bbts pages here. | 25 | * Its an array and supports up to 8 chips now |
| 26 | * Its an array and supports up to 8 chips now | 26 | * @offs: offset of the pattern in the oob area of the page |
| 27 | * @offs: offset of the pattern in the oob area of the page | 27 | * @veroffs: offset of the bbt version counter in the oob are of the page |
| 28 | * @veroffs: offset of the bbt version counter in the oob area of the page | 28 | * @version: version read from the bbt page during scan |
| 29 | * @version: version read from the bbt page during scan | 29 | * @len: length of the pattern, if 0 no pattern check is performed |
| 30 | * @len: length of the pattern, if 0 no pattern check is performed | 30 | * @maxblocks: maximum number of blocks to search for a bbt. This number of |
| 31 | * @maxblocks: maximum number of blocks to search for a bbt. This | 31 | * blocks is reserved at the end of the device where the tables are |
| 32 | * number of blocks is reserved at the end of the device | 32 | * written. |
| 33 | * where the tables are written. | 33 | * @reserved_block_code: if non-0, this pattern denotes a reserved (rather than |
| 34 | * @reserved_block_code: if non-0, this pattern denotes a reserved | 34 | * bad) block in the stored bbt |
| 35 | * (rather than bad) block in the stored bbt | 35 | * @pattern: pattern to identify bad block table or factory marked good / |
| 36 | * @pattern: pattern to identify bad block table or factory marked | 36 | * bad blocks, can be NULL, if len = 0 |
| 37 | * good / bad blocks, can be NULL, if len = 0 | ||
| 38 | * | 37 | * |
| 39 | * Descriptor for the bad block table marker and the descriptor for the | 38 | * Descriptor for the bad block table marker and the descriptor for the |
| 40 | * pattern which identifies good and bad blocks. The assumption is made | 39 | * pattern which identifies good and bad blocks. The assumption is made |
| @@ -90,7 +89,9 @@ struct nand_bbt_descr { | |||
| 90 | /* | 89 | /* |
| 91 | * Constants for oob configuration | 90 | * Constants for oob configuration |
| 92 | */ | 91 | */ |
| 93 | #define ONENAND_BADBLOCK_POS 0 | 92 | #define NAND_SMALL_BADBLOCK_POS 5 |
| 93 | #define NAND_LARGE_BADBLOCK_POS 0 | ||
| 94 | #define ONENAND_BADBLOCK_POS 0 | ||
| 94 | 95 | ||
| 95 | /* | 96 | /* |
| 96 | * Bad block scanning errors | 97 | * Bad block scanning errors |
diff --git a/include/linux/mtd/cfi.h b/include/linux/mtd/cfi.h index 88d3d8fbf9f2..df89f4275232 100644 --- a/include/linux/mtd/cfi.h +++ b/include/linux/mtd/cfi.h | |||
| @@ -518,10 +518,11 @@ struct cfi_fixup { | |||
| 518 | #define CFI_MFR_ANY 0xffff | 518 | #define CFI_MFR_ANY 0xffff |
| 519 | #define CFI_ID_ANY 0xffff | 519 | #define CFI_ID_ANY 0xffff |
| 520 | 520 | ||
| 521 | #define CFI_MFR_AMD 0x0001 | 521 | #define CFI_MFR_AMD 0x0001 |
| 522 | #define CFI_MFR_ATMEL 0x001F | 522 | #define CFI_MFR_INTEL 0x0089 |
| 523 | #define CFI_MFR_SAMSUNG 0x00EC | 523 | #define CFI_MFR_ATMEL 0x001F |
| 524 | #define CFI_MFR_ST 0x0020 /* STMicroelectronics */ | 524 | #define CFI_MFR_SAMSUNG 0x00EC |
| 525 | #define CFI_MFR_ST 0x0020 /* STMicroelectronics */ | ||
| 525 | 526 | ||
| 526 | void cfi_fixup(struct mtd_info *mtd, struct cfi_fixup* fixups); | 527 | void cfi_fixup(struct mtd_info *mtd, struct cfi_fixup* fixups); |
| 527 | 528 | ||
diff --git a/include/linux/mtd/flashchip.h b/include/linux/mtd/flashchip.h index d4f38c5fd44e..d0bf422ae374 100644 --- a/include/linux/mtd/flashchip.h +++ b/include/linux/mtd/flashchip.h | |||
| @@ -38,6 +38,15 @@ typedef enum { | |||
| 38 | FL_XIP_WHILE_ERASING, | 38 | FL_XIP_WHILE_ERASING, |
| 39 | FL_XIP_WHILE_WRITING, | 39 | FL_XIP_WHILE_WRITING, |
| 40 | FL_SHUTDOWN, | 40 | FL_SHUTDOWN, |
| 41 | /* These 2 come from nand_state_t, which has been unified here */ | ||
| 42 | FL_READING, | ||
| 43 | FL_CACHEDPRG, | ||
| 44 | /* These 4 come from onenand_state_t, which has been unified here */ | ||
| 45 | FL_RESETING, | ||
| 46 | FL_OTPING, | ||
| 47 | FL_PREPARING_ERASE, | ||
| 48 | FL_VERIFYING_ERASE, | ||
| 49 | |||
| 41 | FL_UNKNOWN | 50 | FL_UNKNOWN |
| 42 | } flstate_t; | 51 | } flstate_t; |
| 43 | 52 | ||
diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h index 7a232a9bdd62..ccab9dfc5217 100644 --- a/include/linux/mtd/nand.h +++ b/include/linux/mtd/nand.h | |||
| @@ -21,6 +21,8 @@ | |||
| 21 | #include <linux/wait.h> | 21 | #include <linux/wait.h> |
| 22 | #include <linux/spinlock.h> | 22 | #include <linux/spinlock.h> |
| 23 | #include <linux/mtd/mtd.h> | 23 | #include <linux/mtd/mtd.h> |
| 24 | #include <linux/mtd/flashchip.h> | ||
| 25 | #include <linux/mtd/bbm.h> | ||
| 24 | 26 | ||
| 25 | struct mtd_info; | 27 | struct mtd_info; |
| 26 | /* Scan and identify a NAND device */ | 28 | /* Scan and identify a NAND device */ |
| @@ -168,7 +170,6 @@ typedef enum { | |||
| 168 | /* Chip does not allow subpage writes */ | 170 | /* Chip does not allow subpage writes */ |
| 169 | #define NAND_NO_SUBPAGE_WRITE 0x00000200 | 171 | #define NAND_NO_SUBPAGE_WRITE 0x00000200 |
| 170 | 172 | ||
| 171 | |||
| 172 | /* Options valid for Samsung large page devices */ | 173 | /* Options valid for Samsung large page devices */ |
| 173 | #define NAND_SAMSUNG_LP_OPTIONS \ | 174 | #define NAND_SAMSUNG_LP_OPTIONS \ |
| 174 | (NAND_NO_PADDING | NAND_CACHEPRG | NAND_COPYBACK) | 175 | (NAND_NO_PADDING | NAND_CACHEPRG | NAND_COPYBACK) |
| @@ -194,6 +195,9 @@ typedef enum { | |||
| 194 | /* This option is defined if the board driver allocates its own buffers | 195 | /* This option is defined if the board driver allocates its own buffers |
| 195 | (e.g. because it needs them DMA-coherent */ | 196 | (e.g. because it needs them DMA-coherent */ |
| 196 | #define NAND_OWN_BUFFERS 0x00040000 | 197 | #define NAND_OWN_BUFFERS 0x00040000 |
| 198 | /* Chip may not exist, so silence any errors in scan */ | ||
| 199 | #define NAND_SCAN_SILENT_NODEV 0x00080000 | ||
| 200 | |||
| 197 | /* Options set by nand scan */ | 201 | /* Options set by nand scan */ |
| 198 | /* Nand scan has allocated controller struct */ | 202 | /* Nand scan has allocated controller struct */ |
| 199 | #define NAND_CONTROLLER_ALLOC 0x80000000 | 203 | #define NAND_CONTROLLER_ALLOC 0x80000000 |
| @@ -202,20 +206,6 @@ typedef enum { | |||
| 202 | #define NAND_CI_CHIPNR_MSK 0x03 | 206 | #define NAND_CI_CHIPNR_MSK 0x03 |
| 203 | #define NAND_CI_CELLTYPE_MSK 0x0C | 207 | #define NAND_CI_CELLTYPE_MSK 0x0C |
| 204 | 208 | ||
| 205 | /* | ||
| 206 | * nand_state_t - chip states | ||
| 207 | * Enumeration for NAND flash chip state | ||
| 208 | */ | ||
| 209 | typedef enum { | ||
| 210 | FL_READY, | ||
| 211 | FL_READING, | ||
| 212 | FL_WRITING, | ||
| 213 | FL_ERASING, | ||
| 214 | FL_SYNCING, | ||
| 215 | FL_CACHEDPRG, | ||
| 216 | FL_PM_SUSPENDED, | ||
| 217 | } nand_state_t; | ||
| 218 | |||
| 219 | /* Keep gcc happy */ | 209 | /* Keep gcc happy */ |
| 220 | struct nand_chip; | 210 | struct nand_chip; |
| 221 | 211 | ||
| @@ -402,7 +392,7 @@ struct nand_chip { | |||
| 402 | uint8_t cellinfo; | 392 | uint8_t cellinfo; |
| 403 | int badblockpos; | 393 | int badblockpos; |
| 404 | 394 | ||
| 405 | nand_state_t state; | 395 | flstate_t state; |
| 406 | 396 | ||
| 407 | uint8_t *oob_poi; | 397 | uint8_t *oob_poi; |
| 408 | struct nand_hw_control *controller; | 398 | struct nand_hw_control *controller; |
| @@ -470,75 +460,6 @@ struct nand_manufacturers { | |||
| 470 | extern struct nand_flash_dev nand_flash_ids[]; | 460 | extern struct nand_flash_dev nand_flash_ids[]; |
| 471 | extern struct nand_manufacturers nand_manuf_ids[]; | 461 | extern struct nand_manufacturers nand_manuf_ids[]; |
| 472 | 462 | ||
| 473 | /** | ||
| 474 | * struct nand_bbt_descr - bad block table descriptor | ||
| 475 | * @options: options for this descriptor | ||
| 476 | * @pages: the page(s) where we find the bbt, used with option BBT_ABSPAGE | ||
| 477 | * when bbt is searched, then we store the found bbts pages here. | ||
| 478 | * Its an array and supports up to 8 chips now | ||
| 479 | * @offs: offset of the pattern in the oob area of the page | ||
| 480 | * @veroffs: offset of the bbt version counter in the oob are of the page | ||
| 481 | * @version: version read from the bbt page during scan | ||
| 482 | * @len: length of the pattern, if 0 no pattern check is performed | ||
| 483 | * @maxblocks: maximum number of blocks to search for a bbt. This number of | ||
| 484 | * blocks is reserved at the end of the device where the tables are | ||
| 485 | * written. | ||
| 486 | * @reserved_block_code: if non-0, this pattern denotes a reserved (rather than | ||
| 487 | * bad) block in the stored bbt | ||
| 488 | * @pattern: pattern to identify bad block table or factory marked good / | ||
| 489 | * bad blocks, can be NULL, if len = 0 | ||
| 490 | * | ||
| 491 | * Descriptor for the bad block table marker and the descriptor for the | ||
| 492 | * pattern which identifies good and bad blocks. The assumption is made | ||
| 493 | * that the pattern and the version count are always located in the oob area | ||
| 494 | * of the first block. | ||
| 495 | */ | ||
| 496 | struct nand_bbt_descr { | ||
| 497 | int options; | ||
| 498 | int pages[NAND_MAX_CHIPS]; | ||
| 499 | int offs; | ||
| 500 | int veroffs; | ||
| 501 | uint8_t version[NAND_MAX_CHIPS]; | ||
| 502 | int len; | ||
| 503 | int maxblocks; | ||
| 504 | int reserved_block_code; | ||
| 505 | uint8_t *pattern; | ||
| 506 | }; | ||
| 507 | |||
| 508 | /* Options for the bad block table descriptors */ | ||
| 509 | |||
| 510 | /* The number of bits used per block in the bbt on the device */ | ||
| 511 | #define NAND_BBT_NRBITS_MSK 0x0000000F | ||
| 512 | #define NAND_BBT_1BIT 0x00000001 | ||
| 513 | #define NAND_BBT_2BIT 0x00000002 | ||
| 514 | #define NAND_BBT_4BIT 0x00000004 | ||
| 515 | #define NAND_BBT_8BIT 0x00000008 | ||
| 516 | /* The bad block table is in the last good block of the device */ | ||
| 517 | #define NAND_BBT_LASTBLOCK 0x00000010 | ||
| 518 | /* The bbt is at the given page, else we must scan for the bbt */ | ||
| 519 | #define NAND_BBT_ABSPAGE 0x00000020 | ||
| 520 | /* The bbt is at the given page, else we must scan for the bbt */ | ||
| 521 | #define NAND_BBT_SEARCH 0x00000040 | ||
| 522 | /* bbt is stored per chip on multichip devices */ | ||
| 523 | #define NAND_BBT_PERCHIP 0x00000080 | ||
| 524 | /* bbt has a version counter at offset veroffs */ | ||
| 525 | #define NAND_BBT_VERSION 0x00000100 | ||
| 526 | /* Create a bbt if none axists */ | ||
| 527 | #define NAND_BBT_CREATE 0x00000200 | ||
| 528 | /* Search good / bad pattern through all pages of a block */ | ||
| 529 | #define NAND_BBT_SCANALLPAGES 0x00000400 | ||
| 530 | /* Scan block empty during good / bad block scan */ | ||
| 531 | #define NAND_BBT_SCANEMPTY 0x00000800 | ||
| 532 | /* Write bbt if neccecary */ | ||
| 533 | #define NAND_BBT_WRITE 0x00001000 | ||
| 534 | /* Read and write back block contents when writing bbt */ | ||
| 535 | #define NAND_BBT_SAVECONTENT 0x00002000 | ||
| 536 | /* Search good / bad pattern on the first and the second page */ | ||
| 537 | #define NAND_BBT_SCAN2NDPAGE 0x00004000 | ||
| 538 | |||
| 539 | /* The maximum number of blocks to scan for a bbt */ | ||
| 540 | #define NAND_BBT_SCAN_MAXBLOCKS 4 | ||
| 541 | |||
| 542 | extern int nand_scan_bbt(struct mtd_info *mtd, struct nand_bbt_descr *bd); | 463 | extern int nand_scan_bbt(struct mtd_info *mtd, struct nand_bbt_descr *bd); |
| 543 | extern int nand_update_bbt(struct mtd_info *mtd, loff_t offs); | 464 | extern int nand_update_bbt(struct mtd_info *mtd, loff_t offs); |
| 544 | extern int nand_default_bbt(struct mtd_info *mtd); | 465 | extern int nand_default_bbt(struct mtd_info *mtd); |
| @@ -548,12 +469,6 @@ extern int nand_erase_nand(struct mtd_info *mtd, struct erase_info *instr, | |||
| 548 | extern int nand_do_read(struct mtd_info *mtd, loff_t from, size_t len, | 469 | extern int nand_do_read(struct mtd_info *mtd, loff_t from, size_t len, |
| 549 | size_t * retlen, uint8_t * buf); | 470 | size_t * retlen, uint8_t * buf); |
| 550 | 471 | ||
| 551 | /* | ||
| 552 | * Constants for oob configuration | ||
| 553 | */ | ||
| 554 | #define NAND_SMALL_BADBLOCK_POS 5 | ||
| 555 | #define NAND_LARGE_BADBLOCK_POS 0 | ||
| 556 | |||
| 557 | /** | 472 | /** |
| 558 | * struct platform_nand_chip - chip level device structure | 473 | * struct platform_nand_chip - chip level device structure |
| 559 | * @nr_chips: max. number of chips to scan for | 474 | * @nr_chips: max. number of chips to scan for |
diff --git a/include/linux/mtd/nand_ecc.h b/include/linux/mtd/nand_ecc.h index 052ea8ca2434..41bc013571d0 100644 --- a/include/linux/mtd/nand_ecc.h +++ b/include/linux/mtd/nand_ecc.h | |||
| @@ -16,7 +16,13 @@ | |||
| 16 | struct mtd_info; | 16 | struct mtd_info; |
| 17 | 17 | ||
| 18 | /* | 18 | /* |
| 19 | * Calculate 3 byte ECC code for 256 byte block | 19 | * Calculate 3 byte ECC code for eccsize byte block |
| 20 | */ | ||
| 21 | void __nand_calculate_ecc(const u_char *dat, unsigned int eccsize, | ||
| 22 | u_char *ecc_code); | ||
| 23 | |||
| 24 | /* | ||
| 25 | * Calculate 3 byte ECC code for 256/512 byte block | ||
| 20 | */ | 26 | */ |
| 21 | int nand_calculate_ecc(struct mtd_info *mtd, const u_char *dat, u_char *ecc_code); | 27 | int nand_calculate_ecc(struct mtd_info *mtd, const u_char *dat, u_char *ecc_code); |
| 22 | 28 | ||
| @@ -27,7 +33,7 @@ int __nand_correct_data(u_char *dat, u_char *read_ecc, u_char *calc_ecc, | |||
| 27 | unsigned int eccsize); | 33 | unsigned int eccsize); |
| 28 | 34 | ||
| 29 | /* | 35 | /* |
| 30 | * Detect and correct a 1 bit error for 256 byte block | 36 | * Detect and correct a 1 bit error for 256/512 byte block |
| 31 | */ | 37 | */ |
| 32 | int nand_correct_data(struct mtd_info *mtd, u_char *dat, u_char *read_ecc, u_char *calc_ecc); | 38 | int nand_correct_data(struct mtd_info *mtd, u_char *dat, u_char *read_ecc, u_char *calc_ecc); |
| 33 | 39 | ||
diff --git a/include/linux/mtd/onenand.h b/include/linux/mtd/onenand.h index 4e49f3350678..5509eb06b326 100644 --- a/include/linux/mtd/onenand.h +++ b/include/linux/mtd/onenand.h | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * linux/include/linux/mtd/onenand.h | 2 | * linux/include/linux/mtd/onenand.h |
| 3 | * | 3 | * |
| 4 | * Copyright (C) 2005-2007 Samsung Electronics | 4 | * Copyright © 2005-2009 Samsung Electronics |
| 5 | * Kyungmin Park <kyungmin.park@samsung.com> | 5 | * Kyungmin Park <kyungmin.park@samsung.com> |
| 6 | * | 6 | * |
| 7 | * 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 |
| @@ -14,6 +14,7 @@ | |||
| 14 | 14 | ||
| 15 | #include <linux/spinlock.h> | 15 | #include <linux/spinlock.h> |
| 16 | #include <linux/completion.h> | 16 | #include <linux/completion.h> |
| 17 | #include <linux/mtd/flashchip.h> | ||
| 17 | #include <linux/mtd/onenand_regs.h> | 18 | #include <linux/mtd/onenand_regs.h> |
| 18 | #include <linux/mtd/bbm.h> | 19 | #include <linux/mtd/bbm.h> |
| 19 | 20 | ||
| @@ -25,22 +26,6 @@ extern int onenand_scan(struct mtd_info *mtd, int max_chips); | |||
| 25 | /* Free resources held by the OneNAND device */ | 26 | /* Free resources held by the OneNAND device */ |
| 26 | extern void onenand_release(struct mtd_info *mtd); | 27 | extern void onenand_release(struct mtd_info *mtd); |
| 27 | 28 | ||
| 28 | /* | ||
| 29 | * onenand_state_t - chip states | ||
| 30 | * Enumeration for OneNAND flash chip state | ||
| 31 | */ | ||
| 32 | typedef enum { | ||
| 33 | FL_READY, | ||
| 34 | FL_READING, | ||
| 35 | FL_WRITING, | ||
| 36 | FL_ERASING, | ||
| 37 | FL_SYNCING, | ||
| 38 | FL_LOCKING, | ||
| 39 | FL_RESETING, | ||
| 40 | FL_OTPING, | ||
| 41 | FL_PM_SUSPENDED, | ||
| 42 | } onenand_state_t; | ||
| 43 | |||
| 44 | /** | 29 | /** |
| 45 | * struct onenand_bufferram - OneNAND BufferRAM Data | 30 | * struct onenand_bufferram - OneNAND BufferRAM Data |
| 46 | * @blockpage: block & page address in BufferRAM | 31 | * @blockpage: block & page address in BufferRAM |
| @@ -137,7 +122,7 @@ struct onenand_chip { | |||
| 137 | 122 | ||
| 138 | spinlock_t chip_lock; | 123 | spinlock_t chip_lock; |
| 139 | wait_queue_head_t wq; | 124 | wait_queue_head_t wq; |
| 140 | onenand_state_t state; | 125 | flstate_t state; |
| 141 | unsigned char *page_buf; | 126 | unsigned char *page_buf; |
| 142 | unsigned char *oob_buf; | 127 | unsigned char *oob_buf; |
| 143 | 128 | ||
| @@ -152,6 +137,8 @@ struct onenand_chip { | |||
| 152 | /* | 137 | /* |
| 153 | * Helper macros | 138 | * Helper macros |
| 154 | */ | 139 | */ |
| 140 | #define ONENAND_PAGES_PER_BLOCK (1<<6) | ||
| 141 | |||
| 155 | #define ONENAND_CURRENT_BUFFERRAM(this) (this->bufferram_index) | 142 | #define ONENAND_CURRENT_BUFFERRAM(this) (this->bufferram_index) |
| 156 | #define ONENAND_NEXT_BUFFERRAM(this) (this->bufferram_index ^ 1) | 143 | #define ONENAND_NEXT_BUFFERRAM(this) (this->bufferram_index ^ 1) |
| 157 | #define ONENAND_SET_NEXT_BUFFERRAM(this) (this->bufferram_index ^= 1) | 144 | #define ONENAND_SET_NEXT_BUFFERRAM(this) (this->bufferram_index ^= 1) |
diff --git a/include/linux/mtd/onenand_regs.h b/include/linux/mtd/onenand_regs.h index acadbf53a69f..cd6f3b431195 100644 --- a/include/linux/mtd/onenand_regs.h +++ b/include/linux/mtd/onenand_regs.h | |||
| @@ -131,6 +131,8 @@ | |||
| 131 | #define ONENAND_CMD_LOCK_TIGHT (0x2C) | 131 | #define ONENAND_CMD_LOCK_TIGHT (0x2C) |
| 132 | #define ONENAND_CMD_UNLOCK_ALL (0x27) | 132 | #define ONENAND_CMD_UNLOCK_ALL (0x27) |
| 133 | #define ONENAND_CMD_ERASE (0x94) | 133 | #define ONENAND_CMD_ERASE (0x94) |
| 134 | #define ONENAND_CMD_MULTIBLOCK_ERASE (0x95) | ||
| 135 | #define ONENAND_CMD_ERASE_VERIFY (0x71) | ||
| 134 | #define ONENAND_CMD_RESET (0xF0) | 136 | #define ONENAND_CMD_RESET (0xF0) |
| 135 | #define ONENAND_CMD_OTP_ACCESS (0x65) | 137 | #define ONENAND_CMD_OTP_ACCESS (0x65) |
| 136 | #define ONENAND_CMD_READID (0x90) | 138 | #define ONENAND_CMD_READID (0x90) |
diff --git a/include/linux/mtd/pismo.h b/include/linux/mtd/pismo.h new file mode 100644 index 000000000000..8dfb7e1421c5 --- /dev/null +++ b/include/linux/mtd/pismo.h | |||
| @@ -0,0 +1,17 @@ | |||
| 1 | /* | ||
| 2 | * PISMO memory driver - http://www.pismoworld.org/ | ||
| 3 | * | ||
| 4 | * This program is free software; you can redistribute it and/or modify | ||
| 5 | * it under the terms of the GNU General Public License as published by | ||
| 6 | * the Free Software Foundation; either version 2 of the License. | ||
| 7 | */ | ||
| 8 | #ifndef __LINUX_MTD_PISMO_H | ||
| 9 | #define __LINUX_MTD_PISMO_H | ||
| 10 | |||
| 11 | struct pismo_pdata { | ||
| 12 | void (*set_vpp)(void *, int); | ||
| 13 | void *vpp_data; | ||
| 14 | phys_addr_t cs_addrs[5]; | ||
| 15 | }; | ||
| 16 | |||
| 17 | #endif | ||
diff --git a/include/linux/mtd/sh_flctl.h b/include/linux/mtd/sh_flctl.h index e77c1cea404d..ab77609ec337 100644 --- a/include/linux/mtd/sh_flctl.h +++ b/include/linux/mtd/sh_flctl.h | |||
| @@ -51,6 +51,8 @@ | |||
| 51 | #define _4ECCCNTEN (0x1 << 24) | 51 | #define _4ECCCNTEN (0x1 << 24) |
| 52 | #define _4ECCEN (0x1 << 23) | 52 | #define _4ECCEN (0x1 << 23) |
| 53 | #define _4ECCCORRECT (0x1 << 22) | 53 | #define _4ECCCORRECT (0x1 << 22) |
| 54 | #define SHBUSSEL (0x1 << 20) | ||
| 55 | #define SEL_16BIT (0x1 << 19) | ||
| 54 | #define SNAND_E (0x1 << 18) /* SNAND (0=512 1=2048)*/ | 56 | #define SNAND_E (0x1 << 18) /* SNAND (0=512 1=2048)*/ |
| 55 | #define QTSEL_E (0x1 << 17) | 57 | #define QTSEL_E (0x1 << 17) |
| 56 | #define ENDIAN (0x1 << 16) /* 1 = little endian */ | 58 | #define ENDIAN (0x1 << 16) /* 1 = little endian */ |
| @@ -96,6 +98,7 @@ | |||
| 96 | struct sh_flctl { | 98 | struct sh_flctl { |
| 97 | struct mtd_info mtd; | 99 | struct mtd_info mtd; |
| 98 | struct nand_chip chip; | 100 | struct nand_chip chip; |
| 101 | struct platform_device *pdev; | ||
| 99 | void __iomem *reg; | 102 | void __iomem *reg; |
| 100 | 103 | ||
| 101 | uint8_t done_buff[2048 + 64]; /* max size 2048 + 64 */ | 104 | uint8_t done_buff[2048 + 64]; /* max size 2048 + 64 */ |
diff --git a/include/linux/mtd/ubi.h b/include/linux/mtd/ubi.h index 6913b71d9ab2..b31bd9e9bca3 100644 --- a/include/linux/mtd/ubi.h +++ b/include/linux/mtd/ubi.h | |||
| @@ -174,6 +174,8 @@ void ubi_get_volume_info(struct ubi_volume_desc *desc, | |||
| 174 | struct ubi_volume_desc *ubi_open_volume(int ubi_num, int vol_id, int mode); | 174 | struct ubi_volume_desc *ubi_open_volume(int ubi_num, int vol_id, int mode); |
| 175 | struct ubi_volume_desc *ubi_open_volume_nm(int ubi_num, const char *name, | 175 | struct ubi_volume_desc *ubi_open_volume_nm(int ubi_num, const char *name, |
| 176 | int mode); | 176 | int mode); |
| 177 | struct ubi_volume_desc *ubi_open_volume_path(const char *pathname, int mode); | ||
| 178 | |||
| 177 | int ubi_register_volume_notifier(struct notifier_block *nb, | 179 | int ubi_register_volume_notifier(struct notifier_block *nb, |
| 178 | int ignore_existing); | 180 | int ignore_existing); |
| 179 | int ubi_unregister_volume_notifier(struct notifier_block *nb); | 181 | int ubi_unregister_volume_notifier(struct notifier_block *nb); |
diff --git a/include/linux/namei.h b/include/linux/namei.h index ec0f607b364a..05b441d93642 100644 --- a/include/linux/namei.h +++ b/include/linux/namei.h | |||
| @@ -72,11 +72,8 @@ extern int vfs_path_lookup(struct dentry *, struct vfsmount *, | |||
| 72 | 72 | ||
| 73 | extern struct file *lookup_instantiate_filp(struct nameidata *nd, struct dentry *dentry, | 73 | extern struct file *lookup_instantiate_filp(struct nameidata *nd, struct dentry *dentry, |
| 74 | int (*open)(struct inode *, struct file *)); | 74 | int (*open)(struct inode *, struct file *)); |
| 75 | extern struct file *nameidata_to_filp(struct nameidata *nd, int flags); | ||
| 76 | extern void release_open_intent(struct nameidata *); | ||
| 77 | 75 | ||
| 78 | extern struct dentry *lookup_one_len(const char *, struct dentry *, int); | 76 | extern struct dentry *lookup_one_len(const char *, struct dentry *, int); |
| 79 | extern struct dentry *lookup_one_noperm(const char *, struct dentry *); | ||
| 80 | 77 | ||
| 81 | extern int follow_down(struct path *); | 78 | extern int follow_down(struct path *); |
| 82 | extern int follow_up(struct path *); | 79 | extern int follow_up(struct path *); |
diff --git a/include/linux/ncp_fs_sb.h b/include/linux/ncp_fs_sb.h index 6330fc76b00f..5ec9ca671687 100644 --- a/include/linux/ncp_fs_sb.h +++ b/include/linux/ncp_fs_sb.h | |||
| @@ -12,6 +12,7 @@ | |||
| 12 | #include <linux/ncp_mount.h> | 12 | #include <linux/ncp_mount.h> |
| 13 | #include <linux/net.h> | 13 | #include <linux/net.h> |
| 14 | #include <linux/mutex.h> | 14 | #include <linux/mutex.h> |
| 15 | #include <linux/backing-dev.h> | ||
| 15 | 16 | ||
| 16 | #ifdef __KERNEL__ | 17 | #ifdef __KERNEL__ |
| 17 | 18 | ||
| @@ -127,6 +128,7 @@ struct ncp_server { | |||
| 127 | size_t len; | 128 | size_t len; |
| 128 | __u8 data[128]; | 129 | __u8 data[128]; |
| 129 | } unexpected_packet; | 130 | } unexpected_packet; |
| 131 | struct backing_dev_info bdi; | ||
| 130 | }; | 132 | }; |
| 131 | 133 | ||
| 132 | extern void ncp_tcp_rcv_proc(struct work_struct *work); | 134 | extern void ncp_tcp_rcv_proc(struct work_struct *work); |
diff --git a/include/linux/neighbour.h b/include/linux/neighbour.h index 12c9de138451..a7003b7a695d 100644 --- a/include/linux/neighbour.h +++ b/include/linux/neighbour.h | |||
| @@ -4,8 +4,7 @@ | |||
| 4 | #include <linux/types.h> | 4 | #include <linux/types.h> |
| 5 | #include <linux/netlink.h> | 5 | #include <linux/netlink.h> |
| 6 | 6 | ||
| 7 | struct ndmsg | 7 | struct ndmsg { |
| 8 | { | ||
| 9 | __u8 ndm_family; | 8 | __u8 ndm_family; |
| 10 | __u8 ndm_pad1; | 9 | __u8 ndm_pad1; |
| 11 | __u16 ndm_pad2; | 10 | __u16 ndm_pad2; |
| @@ -15,8 +14,7 @@ struct ndmsg | |||
| 15 | __u8 ndm_type; | 14 | __u8 ndm_type; |
| 16 | }; | 15 | }; |
| 17 | 16 | ||
| 18 | enum | 17 | enum { |
| 19 | { | ||
| 20 | NDA_UNSPEC, | 18 | NDA_UNSPEC, |
| 21 | NDA_DST, | 19 | NDA_DST, |
| 22 | NDA_LLADDR, | 20 | NDA_LLADDR, |
| @@ -56,8 +54,7 @@ enum | |||
| 56 | NUD_PERMANENT is also cannot be deleted by garbage collectors. | 54 | NUD_PERMANENT is also cannot be deleted by garbage collectors. |
| 57 | */ | 55 | */ |
| 58 | 56 | ||
| 59 | struct nda_cacheinfo | 57 | struct nda_cacheinfo { |
| 60 | { | ||
| 61 | __u32 ndm_confirmed; | 58 | __u32 ndm_confirmed; |
| 62 | __u32 ndm_used; | 59 | __u32 ndm_used; |
| 63 | __u32 ndm_updated; | 60 | __u32 ndm_updated; |
| @@ -89,8 +86,7 @@ struct nda_cacheinfo | |||
| 89 | * device. | 86 | * device. |
| 90 | ****/ | 87 | ****/ |
| 91 | 88 | ||
| 92 | struct ndt_stats | 89 | struct ndt_stats { |
| 93 | { | ||
| 94 | __u64 ndts_allocs; | 90 | __u64 ndts_allocs; |
| 95 | __u64 ndts_destroys; | 91 | __u64 ndts_destroys; |
| 96 | __u64 ndts_hash_grows; | 92 | __u64 ndts_hash_grows; |
| @@ -124,15 +120,13 @@ enum { | |||
| 124 | }; | 120 | }; |
| 125 | #define NDTPA_MAX (__NDTPA_MAX - 1) | 121 | #define NDTPA_MAX (__NDTPA_MAX - 1) |
| 126 | 122 | ||
| 127 | struct ndtmsg | 123 | struct ndtmsg { |
| 128 | { | ||
| 129 | __u8 ndtm_family; | 124 | __u8 ndtm_family; |
| 130 | __u8 ndtm_pad1; | 125 | __u8 ndtm_pad1; |
| 131 | __u16 ndtm_pad2; | 126 | __u16 ndtm_pad2; |
| 132 | }; | 127 | }; |
| 133 | 128 | ||
| 134 | struct ndt_config | 129 | struct ndt_config { |
| 135 | { | ||
| 136 | __u16 ndtc_key_len; | 130 | __u16 ndtc_key_len; |
| 137 | __u16 ndtc_entry_size; | 131 | __u16 ndtc_entry_size; |
| 138 | __u32 ndtc_entries; | 132 | __u32 ndtc_entries; |
diff --git a/include/linux/net.h b/include/linux/net.h index 529a0931711d..4157b5d42bd6 100644 --- a/include/linux/net.h +++ b/include/linux/net.h | |||
| @@ -41,6 +41,7 @@ | |||
| 41 | #define SYS_SENDMSG 16 /* sys_sendmsg(2) */ | 41 | #define SYS_SENDMSG 16 /* sys_sendmsg(2) */ |
| 42 | #define SYS_RECVMSG 17 /* sys_recvmsg(2) */ | 42 | #define SYS_RECVMSG 17 /* sys_recvmsg(2) */ |
| 43 | #define SYS_ACCEPT4 18 /* sys_accept4(2) */ | 43 | #define SYS_ACCEPT4 18 /* sys_accept4(2) */ |
| 44 | #define SYS_RECVMMSG 19 /* sys_recvmmsg(2) */ | ||
| 44 | 45 | ||
| 45 | typedef enum { | 46 | typedef enum { |
| 46 | SS_FREE = 0, /* not allocated */ | 47 | SS_FREE = 0, /* not allocated */ |
| @@ -173,18 +174,22 @@ struct proto_ops { | |||
| 173 | struct poll_table_struct *wait); | 174 | struct poll_table_struct *wait); |
| 174 | int (*ioctl) (struct socket *sock, unsigned int cmd, | 175 | int (*ioctl) (struct socket *sock, unsigned int cmd, |
| 175 | unsigned long arg); | 176 | unsigned long arg); |
| 177 | #ifdef CONFIG_COMPAT | ||
| 176 | int (*compat_ioctl) (struct socket *sock, unsigned int cmd, | 178 | int (*compat_ioctl) (struct socket *sock, unsigned int cmd, |
| 177 | unsigned long arg); | 179 | unsigned long arg); |
| 180 | #endif | ||
| 178 | int (*listen) (struct socket *sock, int len); | 181 | int (*listen) (struct socket *sock, int len); |
| 179 | int (*shutdown) (struct socket *sock, int flags); | 182 | int (*shutdown) (struct socket *sock, int flags); |
| 180 | int (*setsockopt)(struct socket *sock, int level, | 183 | int (*setsockopt)(struct socket *sock, int level, |
| 181 | int optname, char __user *optval, unsigned int optlen); | 184 | int optname, char __user *optval, unsigned int optlen); |
| 182 | int (*getsockopt)(struct socket *sock, int level, | 185 | int (*getsockopt)(struct socket *sock, int level, |
| 183 | int optname, char __user *optval, int __user *optlen); | 186 | int optname, char __user *optval, int __user *optlen); |
| 187 | #ifdef CONFIG_COMPAT | ||
| 184 | int (*compat_setsockopt)(struct socket *sock, int level, | 188 | int (*compat_setsockopt)(struct socket *sock, int level, |
| 185 | int optname, char __user *optval, unsigned int optlen); | 189 | int optname, char __user *optval, unsigned int optlen); |
| 186 | int (*compat_getsockopt)(struct socket *sock, int level, | 190 | int (*compat_getsockopt)(struct socket *sock, int level, |
| 187 | int optname, char __user *optval, int __user *optlen); | 191 | int optname, char __user *optval, int __user *optlen); |
| 192 | #endif | ||
| 188 | int (*sendmsg) (struct kiocb *iocb, struct socket *sock, | 193 | int (*sendmsg) (struct kiocb *iocb, struct socket *sock, |
| 189 | struct msghdr *m, size_t total_len); | 194 | struct msghdr *m, size_t total_len); |
| 190 | int (*recvmsg) (struct kiocb *iocb, struct socket *sock, | 195 | int (*recvmsg) (struct kiocb *iocb, struct socket *sock, |
| @@ -198,9 +203,13 @@ struct proto_ops { | |||
| 198 | struct pipe_inode_info *pipe, size_t len, unsigned int flags); | 203 | struct pipe_inode_info *pipe, size_t len, unsigned int flags); |
| 199 | }; | 204 | }; |
| 200 | 205 | ||
| 206 | #define DECLARE_SOCKADDR(type, dst, src) \ | ||
| 207 | type dst = ({ __sockaddr_check_size(sizeof(*dst)); (type) src; }) | ||
| 208 | |||
| 201 | struct net_proto_family { | 209 | struct net_proto_family { |
| 202 | int family; | 210 | int family; |
| 203 | int (*create)(struct net *net, struct socket *sock, int protocol); | 211 | int (*create)(struct net *net, struct socket *sock, |
| 212 | int protocol, int kern); | ||
| 204 | struct module *owner; | 213 | struct module *owner; |
| 205 | }; | 214 | }; |
| 206 | 215 | ||
| @@ -263,89 +272,6 @@ extern int kernel_sock_ioctl(struct socket *sock, int cmd, unsigned long arg); | |||
| 263 | extern int kernel_sock_shutdown(struct socket *sock, | 272 | extern int kernel_sock_shutdown(struct socket *sock, |
| 264 | enum sock_shutdown_cmd how); | 273 | enum sock_shutdown_cmd how); |
| 265 | 274 | ||
| 266 | #ifndef CONFIG_SMP | ||
| 267 | #define SOCKOPS_WRAPPED(name) name | ||
| 268 | #define SOCKOPS_WRAP(name, fam) | ||
| 269 | #else | ||
| 270 | |||
| 271 | #define SOCKOPS_WRAPPED(name) __unlocked_##name | ||
| 272 | |||
| 273 | #define SOCKCALL_WRAP(name, call, parms, args) \ | ||
| 274 | static int __lock_##name##_##call parms \ | ||
| 275 | { \ | ||
| 276 | int ret; \ | ||
| 277 | lock_kernel(); \ | ||
| 278 | ret = __unlocked_##name##_ops.call args ;\ | ||
| 279 | unlock_kernel(); \ | ||
| 280 | return ret; \ | ||
| 281 | } | ||
| 282 | |||
| 283 | #define SOCKCALL_UWRAP(name, call, parms, args) \ | ||
| 284 | static unsigned int __lock_##name##_##call parms \ | ||
| 285 | { \ | ||
| 286 | int ret; \ | ||
| 287 | lock_kernel(); \ | ||
| 288 | ret = __unlocked_##name##_ops.call args ;\ | ||
| 289 | unlock_kernel(); \ | ||
| 290 | return ret; \ | ||
| 291 | } | ||
| 292 | |||
| 293 | |||
| 294 | #define SOCKOPS_WRAP(name, fam) \ | ||
| 295 | SOCKCALL_WRAP(name, release, (struct socket *sock), (sock)) \ | ||
| 296 | SOCKCALL_WRAP(name, bind, (struct socket *sock, struct sockaddr *uaddr, int addr_len), \ | ||
| 297 | (sock, uaddr, addr_len)) \ | ||
| 298 | SOCKCALL_WRAP(name, connect, (struct socket *sock, struct sockaddr * uaddr, \ | ||
| 299 | int addr_len, int flags), \ | ||
| 300 | (sock, uaddr, addr_len, flags)) \ | ||
| 301 | SOCKCALL_WRAP(name, socketpair, (struct socket *sock1, struct socket *sock2), \ | ||
| 302 | (sock1, sock2)) \ | ||
| 303 | SOCKCALL_WRAP(name, accept, (struct socket *sock, struct socket *newsock, \ | ||
| 304 | int flags), (sock, newsock, flags)) \ | ||
| 305 | SOCKCALL_WRAP(name, getname, (struct socket *sock, struct sockaddr *uaddr, \ | ||
| 306 | int *addr_len, int peer), (sock, uaddr, addr_len, peer)) \ | ||
| 307 | SOCKCALL_UWRAP(name, poll, (struct file *file, struct socket *sock, struct poll_table_struct *wait), \ | ||
| 308 | (file, sock, wait)) \ | ||
| 309 | SOCKCALL_WRAP(name, ioctl, (struct socket *sock, unsigned int cmd, \ | ||
| 310 | unsigned long arg), (sock, cmd, arg)) \ | ||
| 311 | SOCKCALL_WRAP(name, compat_ioctl, (struct socket *sock, unsigned int cmd, \ | ||
| 312 | unsigned long arg), (sock, cmd, arg)) \ | ||
| 313 | SOCKCALL_WRAP(name, listen, (struct socket *sock, int len), (sock, len)) \ | ||
| 314 | SOCKCALL_WRAP(name, shutdown, (struct socket *sock, int flags), (sock, flags)) \ | ||
| 315 | SOCKCALL_WRAP(name, setsockopt, (struct socket *sock, int level, int optname, \ | ||
| 316 | char __user *optval, unsigned int optlen), (sock, level, optname, optval, optlen)) \ | ||
| 317 | SOCKCALL_WRAP(name, getsockopt, (struct socket *sock, int level, int optname, \ | ||
| 318 | char __user *optval, int __user *optlen), (sock, level, optname, optval, optlen)) \ | ||
| 319 | SOCKCALL_WRAP(name, sendmsg, (struct kiocb *iocb, struct socket *sock, struct msghdr *m, size_t len), \ | ||
| 320 | (iocb, sock, m, len)) \ | ||
| 321 | SOCKCALL_WRAP(name, recvmsg, (struct kiocb *iocb, struct socket *sock, struct msghdr *m, size_t len, int flags), \ | ||
| 322 | (iocb, sock, m, len, flags)) \ | ||
| 323 | SOCKCALL_WRAP(name, mmap, (struct file *file, struct socket *sock, struct vm_area_struct *vma), \ | ||
| 324 | (file, sock, vma)) \ | ||
| 325 | \ | ||
| 326 | static const struct proto_ops name##_ops = { \ | ||
| 327 | .family = fam, \ | ||
| 328 | .owner = THIS_MODULE, \ | ||
| 329 | .release = __lock_##name##_release, \ | ||
| 330 | .bind = __lock_##name##_bind, \ | ||
| 331 | .connect = __lock_##name##_connect, \ | ||
| 332 | .socketpair = __lock_##name##_socketpair, \ | ||
| 333 | .accept = __lock_##name##_accept, \ | ||
| 334 | .getname = __lock_##name##_getname, \ | ||
| 335 | .poll = __lock_##name##_poll, \ | ||
| 336 | .ioctl = __lock_##name##_ioctl, \ | ||
| 337 | .compat_ioctl = __lock_##name##_compat_ioctl, \ | ||
| 338 | .listen = __lock_##name##_listen, \ | ||
| 339 | .shutdown = __lock_##name##_shutdown, \ | ||
| 340 | .setsockopt = __lock_##name##_setsockopt, \ | ||
| 341 | .getsockopt = __lock_##name##_getsockopt, \ | ||
| 342 | .sendmsg = __lock_##name##_sendmsg, \ | ||
| 343 | .recvmsg = __lock_##name##_recvmsg, \ | ||
| 344 | .mmap = __lock_##name##_mmap, \ | ||
| 345 | }; | ||
| 346 | |||
| 347 | #endif | ||
| 348 | |||
| 349 | #define MODULE_ALIAS_NETPROTO(proto) \ | 275 | #define MODULE_ALIAS_NETPROTO(proto) \ |
| 350 | MODULE_ALIAS("net-pf-" __stringify(proto)) | 276 | MODULE_ALIAS("net-pf-" __stringify(proto)) |
| 351 | 277 | ||
| @@ -358,6 +284,7 @@ static const struct proto_ops name##_ops = { \ | |||
| 358 | 284 | ||
| 359 | #ifdef CONFIG_SYSCTL | 285 | #ifdef CONFIG_SYSCTL |
| 360 | #include <linux/sysctl.h> | 286 | #include <linux/sysctl.h> |
| 287 | #include <linux/ratelimit.h> | ||
| 361 | extern struct ratelimit_state net_ratelimit_state; | 288 | extern struct ratelimit_state net_ratelimit_state; |
| 362 | #endif | 289 | #endif |
| 363 | 290 | ||
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index 812a5f3c2abe..fa8b47637997 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h | |||
| @@ -28,6 +28,7 @@ | |||
| 28 | #include <linux/if.h> | 28 | #include <linux/if.h> |
| 29 | #include <linux/if_ether.h> | 29 | #include <linux/if_ether.h> |
| 30 | #include <linux/if_packet.h> | 30 | #include <linux/if_packet.h> |
| 31 | #include <linux/if_link.h> | ||
| 31 | 32 | ||
| 32 | #ifdef __KERNEL__ | 33 | #ifdef __KERNEL__ |
| 33 | #include <linux/timer.h> | 34 | #include <linux/timer.h> |
| @@ -63,30 +64,69 @@ struct wireless_dev; | |||
| 63 | #define HAVE_FREE_NETDEV /* free_netdev() */ | 64 | #define HAVE_FREE_NETDEV /* free_netdev() */ |
| 64 | #define HAVE_NETDEV_PRIV /* netdev_priv() */ | 65 | #define HAVE_NETDEV_PRIV /* netdev_priv() */ |
| 65 | 66 | ||
| 66 | #define NET_XMIT_SUCCESS 0 | ||
| 67 | #define NET_XMIT_DROP 1 /* skb dropped */ | ||
| 68 | #define NET_XMIT_CN 2 /* congestion notification */ | ||
| 69 | #define NET_XMIT_POLICED 3 /* skb is shot by police */ | ||
| 70 | #define NET_XMIT_MASK 0xFFFF /* qdisc flags in net/sch_generic.h */ | ||
| 71 | |||
| 72 | /* Backlog congestion levels */ | 67 | /* Backlog congestion levels */ |
| 73 | #define NET_RX_SUCCESS 0 /* keep 'em coming, baby */ | 68 | #define NET_RX_SUCCESS 0 /* keep 'em coming, baby */ |
| 74 | #define NET_RX_DROP 1 /* packet dropped */ | 69 | #define NET_RX_DROP 1 /* packet dropped */ |
| 70 | |||
| 71 | /* | ||
| 72 | * Transmit return codes: transmit return codes originate from three different | ||
| 73 | * namespaces: | ||
| 74 | * | ||
| 75 | * - qdisc return codes | ||
| 76 | * - driver transmit return codes | ||
| 77 | * - errno values | ||
| 78 | * | ||
| 79 | * Drivers are allowed to return any one of those in their hard_start_xmit() | ||
| 80 | * function. Real network devices commonly used with qdiscs should only return | ||
| 81 | * the driver transmit return codes though - when qdiscs are used, the actual | ||
| 82 | * transmission happens asynchronously, so the value is not propagated to | ||
| 83 | * higher layers. Virtual network devices transmit synchronously, in this case | ||
| 84 | * the driver transmit return codes are consumed by dev_queue_xmit(), all | ||
| 85 | * others are propagated to higher layers. | ||
| 86 | */ | ||
| 87 | |||
| 88 | /* qdisc ->enqueue() return codes. */ | ||
| 89 | #define NET_XMIT_SUCCESS 0x00 | ||
| 90 | #define NET_XMIT_DROP 0x01 /* skb dropped */ | ||
| 91 | #define NET_XMIT_CN 0x02 /* congestion notification */ | ||
| 92 | #define NET_XMIT_POLICED 0x03 /* skb is shot by police */ | ||
| 93 | #define NET_XMIT_MASK 0x0f /* qdisc flags in net/sch_generic.h */ | ||
| 75 | 94 | ||
| 76 | /* NET_XMIT_CN is special. It does not guarantee that this packet is lost. It | 95 | /* NET_XMIT_CN is special. It does not guarantee that this packet is lost. It |
| 77 | * indicates that the device will soon be dropping packets, or already drops | 96 | * indicates that the device will soon be dropping packets, or already drops |
| 78 | * some packets of the same priority; prompting us to send less aggressively. */ | 97 | * some packets of the same priority; prompting us to send less aggressively. */ |
| 79 | #define net_xmit_eval(e) ((e) == NET_XMIT_CN? 0 : (e)) | 98 | #define net_xmit_eval(e) ((e) == NET_XMIT_CN ? 0 : (e)) |
| 80 | #define net_xmit_errno(e) ((e) != NET_XMIT_CN ? -ENOBUFS : 0) | 99 | #define net_xmit_errno(e) ((e) != NET_XMIT_CN ? -ENOBUFS : 0) |
| 81 | 100 | ||
| 82 | /* Driver transmit return codes */ | 101 | /* Driver transmit return codes */ |
| 102 | #define NETDEV_TX_MASK 0xf0 | ||
| 103 | |||
| 83 | enum netdev_tx { | 104 | enum netdev_tx { |
| 84 | NETDEV_TX_OK = 0, /* driver took care of packet */ | 105 | __NETDEV_TX_MIN = INT_MIN, /* make sure enum is signed */ |
| 85 | NETDEV_TX_BUSY, /* driver tx path was busy*/ | 106 | NETDEV_TX_OK = 0x00, /* driver took care of packet */ |
| 86 | NETDEV_TX_LOCKED = -1, /* driver tx lock was already taken */ | 107 | NETDEV_TX_BUSY = 0x10, /* driver tx path was busy*/ |
| 108 | NETDEV_TX_LOCKED = 0x20, /* driver tx lock was already taken */ | ||
| 87 | }; | 109 | }; |
| 88 | typedef enum netdev_tx netdev_tx_t; | 110 | typedef enum netdev_tx netdev_tx_t; |
| 89 | 111 | ||
| 112 | /* | ||
| 113 | * Current order: NETDEV_TX_MASK > NET_XMIT_MASK >= 0 is significant; | ||
| 114 | * hard_start_xmit() return < NET_XMIT_MASK means skb was consumed. | ||
| 115 | */ | ||
| 116 | static inline bool dev_xmit_complete(int rc) | ||
| 117 | { | ||
| 118 | /* | ||
| 119 | * Positive cases with an skb consumed by a driver: | ||
| 120 | * - successful transmission (rc == NETDEV_TX_OK) | ||
| 121 | * - error while transmitting (rc < 0) | ||
| 122 | * - error while queueing to a different device (rc & NET_XMIT_MASK) | ||
| 123 | */ | ||
| 124 | if (likely(rc < NET_XMIT_MASK)) | ||
| 125 | return true; | ||
| 126 | |||
| 127 | return false; | ||
| 128 | } | ||
| 129 | |||
| 90 | #endif | 130 | #endif |
| 91 | 131 | ||
| 92 | #define MAX_ADDR_LEN 32 /* Largest hardware address length */ | 132 | #define MAX_ADDR_LEN 32 /* Largest hardware address length */ |
| @@ -97,7 +137,7 @@ typedef enum netdev_tx netdev_tx_t; | |||
| 97 | * used. | 137 | * used. |
| 98 | */ | 138 | */ |
| 99 | 139 | ||
| 100 | #if defined(CONFIG_WLAN_80211) || defined(CONFIG_AX25) || defined(CONFIG_AX25_MODULE) | 140 | #if defined(CONFIG_WLAN) || defined(CONFIG_AX25) || defined(CONFIG_AX25_MODULE) |
| 101 | # if defined(CONFIG_MAC80211_MESH) | 141 | # if defined(CONFIG_MAC80211_MESH) |
| 102 | # define LL_MAX_HEADER 128 | 142 | # define LL_MAX_HEADER 128 |
| 103 | # else | 143 | # else |
| @@ -125,8 +165,7 @@ typedef enum netdev_tx netdev_tx_t; | |||
| 125 | * with byte counters. | 165 | * with byte counters. |
| 126 | */ | 166 | */ |
| 127 | 167 | ||
| 128 | struct net_device_stats | 168 | struct net_device_stats { |
| 129 | { | ||
| 130 | unsigned long rx_packets; /* total packets received */ | 169 | unsigned long rx_packets; /* total packets received */ |
| 131 | unsigned long tx_packets; /* total packets transmitted */ | 170 | unsigned long tx_packets; /* total packets transmitted */ |
| 132 | unsigned long rx_bytes; /* total bytes received */ | 171 | unsigned long rx_bytes; /* total bytes received */ |
| @@ -179,8 +218,7 @@ struct neighbour; | |||
| 179 | struct neigh_parms; | 218 | struct neigh_parms; |
| 180 | struct sk_buff; | 219 | struct sk_buff; |
| 181 | 220 | ||
| 182 | struct netif_rx_stats | 221 | struct netif_rx_stats { |
| 183 | { | ||
| 184 | unsigned total; | 222 | unsigned total; |
| 185 | unsigned dropped; | 223 | unsigned dropped; |
| 186 | unsigned time_squeeze; | 224 | unsigned time_squeeze; |
| @@ -189,8 +227,7 @@ struct netif_rx_stats | |||
| 189 | 227 | ||
| 190 | DECLARE_PER_CPU(struct netif_rx_stats, netdev_rx_stat); | 228 | DECLARE_PER_CPU(struct netif_rx_stats, netdev_rx_stat); |
| 191 | 229 | ||
| 192 | struct dev_addr_list | 230 | struct dev_addr_list { |
| 193 | { | ||
| 194 | struct dev_addr_list *next; | 231 | struct dev_addr_list *next; |
| 195 | u8 da_addr[MAX_ADDR_LEN]; | 232 | u8 da_addr[MAX_ADDR_LEN]; |
| 196 | u8 da_addrlen; | 233 | u8 da_addrlen; |
| @@ -227,8 +264,18 @@ struct netdev_hw_addr_list { | |||
| 227 | int count; | 264 | int count; |
| 228 | }; | 265 | }; |
| 229 | 266 | ||
| 230 | struct hh_cache | 267 | #define netdev_uc_count(dev) ((dev)->uc.count) |
| 231 | { | 268 | #define netdev_uc_empty(dev) ((dev)->uc.count == 0) |
| 269 | #define netdev_for_each_uc_addr(ha, dev) \ | ||
| 270 | list_for_each_entry(ha, &dev->uc.list, list) | ||
| 271 | |||
| 272 | #define netdev_mc_count(dev) ((dev)->mc_count) | ||
| 273 | #define netdev_mc_empty(dev) (netdev_mc_count(dev) == 0) | ||
| 274 | |||
| 275 | #define netdev_for_each_mc_addr(mclist, dev) \ | ||
| 276 | for (mclist = dev->mc_list; mclist; mclist = mclist->next) | ||
| 277 | |||
| 278 | struct hh_cache { | ||
| 232 | struct hh_cache *hh_next; /* Next entry */ | 279 | struct hh_cache *hh_next; /* Next entry */ |
| 233 | atomic_t hh_refcnt; /* number of users */ | 280 | atomic_t hh_refcnt; /* number of users */ |
| 234 | /* | 281 | /* |
| @@ -291,8 +338,7 @@ struct header_ops { | |||
| 291 | * code. | 338 | * code. |
| 292 | */ | 339 | */ |
| 293 | 340 | ||
| 294 | enum netdev_state_t | 341 | enum netdev_state_t { |
| 295 | { | ||
| 296 | __LINK_STATE_START, | 342 | __LINK_STATE_START, |
| 297 | __LINK_STATE_PRESENT, | 343 | __LINK_STATE_PRESENT, |
| 298 | __LINK_STATE_NOCARRIER, | 344 | __LINK_STATE_NOCARRIER, |
| @@ -341,20 +387,20 @@ struct napi_struct { | |||
| 341 | struct sk_buff *skb; | 387 | struct sk_buff *skb; |
| 342 | }; | 388 | }; |
| 343 | 389 | ||
| 344 | enum | 390 | enum { |
| 345 | { | ||
| 346 | NAPI_STATE_SCHED, /* Poll is scheduled */ | 391 | NAPI_STATE_SCHED, /* Poll is scheduled */ |
| 347 | NAPI_STATE_DISABLE, /* Disable pending */ | 392 | NAPI_STATE_DISABLE, /* Disable pending */ |
| 348 | NAPI_STATE_NPSVC, /* Netpoll - don't dequeue from poll_list */ | 393 | NAPI_STATE_NPSVC, /* Netpoll - don't dequeue from poll_list */ |
| 349 | }; | 394 | }; |
| 350 | 395 | ||
| 351 | enum { | 396 | enum gro_result { |
| 352 | GRO_MERGED, | 397 | GRO_MERGED, |
| 353 | GRO_MERGED_FREE, | 398 | GRO_MERGED_FREE, |
| 354 | GRO_HELD, | 399 | GRO_HELD, |
| 355 | GRO_NORMAL, | 400 | GRO_NORMAL, |
| 356 | GRO_DROP, | 401 | GRO_DROP, |
| 357 | }; | 402 | }; |
| 403 | typedef enum gro_result gro_result_t; | ||
| 358 | 404 | ||
| 359 | extern void __napi_schedule(struct napi_struct *n); | 405 | extern void __napi_schedule(struct napi_struct *n); |
| 360 | 406 | ||
| @@ -457,8 +503,7 @@ static inline void napi_synchronize(const struct napi_struct *n) | |||
| 457 | # define napi_synchronize(n) barrier() | 503 | # define napi_synchronize(n) barrier() |
| 458 | #endif | 504 | #endif |
| 459 | 505 | ||
| 460 | enum netdev_queue_state_t | 506 | enum netdev_queue_state_t { |
| 461 | { | ||
| 462 | __QUEUE_STATE_XOFF, | 507 | __QUEUE_STATE_XOFF, |
| 463 | __QUEUE_STATE_FROZEN, | 508 | __QUEUE_STATE_FROZEN, |
| 464 | }; | 509 | }; |
| @@ -577,6 +622,13 @@ struct netdev_queue { | |||
| 577 | * this function is called when a VLAN id is unregistered. | 622 | * this function is called when a VLAN id is unregistered. |
| 578 | * | 623 | * |
| 579 | * void (*ndo_poll_controller)(struct net_device *dev); | 624 | * void (*ndo_poll_controller)(struct net_device *dev); |
| 625 | * | ||
| 626 | * SR-IOV management functions. | ||
| 627 | * int (*ndo_set_vf_mac)(struct net_device *dev, int vf, u8* mac); | ||
| 628 | * int (*ndo_set_vf_vlan)(struct net_device *dev, int vf, u16 vlan, u8 qos); | ||
| 629 | * int (*ndo_set_vf_tx_rate)(struct net_device *dev, int vf, int rate); | ||
| 630 | * int (*ndo_get_vf_config)(struct net_device *dev, | ||
| 631 | * int vf, struct ifla_vf_info *ivf); | ||
| 580 | */ | 632 | */ |
| 581 | #define HAVE_NET_DEVICE_OPS | 633 | #define HAVE_NET_DEVICE_OPS |
| 582 | struct net_device_ops { | 634 | struct net_device_ops { |
| @@ -588,30 +640,21 @@ struct net_device_ops { | |||
| 588 | struct net_device *dev); | 640 | struct net_device *dev); |
| 589 | u16 (*ndo_select_queue)(struct net_device *dev, | 641 | u16 (*ndo_select_queue)(struct net_device *dev, |
| 590 | struct sk_buff *skb); | 642 | struct sk_buff *skb); |
| 591 | #define HAVE_CHANGE_RX_FLAGS | ||
| 592 | void (*ndo_change_rx_flags)(struct net_device *dev, | 643 | void (*ndo_change_rx_flags)(struct net_device *dev, |
| 593 | int flags); | 644 | int flags); |
| 594 | #define HAVE_SET_RX_MODE | ||
| 595 | void (*ndo_set_rx_mode)(struct net_device *dev); | 645 | void (*ndo_set_rx_mode)(struct net_device *dev); |
| 596 | #define HAVE_MULTICAST | ||
| 597 | void (*ndo_set_multicast_list)(struct net_device *dev); | 646 | void (*ndo_set_multicast_list)(struct net_device *dev); |
| 598 | #define HAVE_SET_MAC_ADDR | ||
| 599 | int (*ndo_set_mac_address)(struct net_device *dev, | 647 | int (*ndo_set_mac_address)(struct net_device *dev, |
| 600 | void *addr); | 648 | void *addr); |
| 601 | #define HAVE_VALIDATE_ADDR | ||
| 602 | int (*ndo_validate_addr)(struct net_device *dev); | 649 | int (*ndo_validate_addr)(struct net_device *dev); |
| 603 | #define HAVE_PRIVATE_IOCTL | ||
| 604 | int (*ndo_do_ioctl)(struct net_device *dev, | 650 | int (*ndo_do_ioctl)(struct net_device *dev, |
| 605 | struct ifreq *ifr, int cmd); | 651 | struct ifreq *ifr, int cmd); |
| 606 | #define HAVE_SET_CONFIG | ||
| 607 | int (*ndo_set_config)(struct net_device *dev, | 652 | int (*ndo_set_config)(struct net_device *dev, |
| 608 | struct ifmap *map); | 653 | struct ifmap *map); |
| 609 | #define HAVE_CHANGE_MTU | ||
| 610 | int (*ndo_change_mtu)(struct net_device *dev, | 654 | int (*ndo_change_mtu)(struct net_device *dev, |
| 611 | int new_mtu); | 655 | int new_mtu); |
| 612 | int (*ndo_neigh_setup)(struct net_device *dev, | 656 | int (*ndo_neigh_setup)(struct net_device *dev, |
| 613 | struct neigh_parms *); | 657 | struct neigh_parms *); |
| 614 | #define HAVE_TX_TIMEOUT | ||
| 615 | void (*ndo_tx_timeout) (struct net_device *dev); | 658 | void (*ndo_tx_timeout) (struct net_device *dev); |
| 616 | 659 | ||
| 617 | struct net_device_stats* (*ndo_get_stats)(struct net_device *dev); | 660 | struct net_device_stats* (*ndo_get_stats)(struct net_device *dev); |
| @@ -623,9 +666,17 @@ struct net_device_ops { | |||
| 623 | void (*ndo_vlan_rx_kill_vid)(struct net_device *dev, | 666 | void (*ndo_vlan_rx_kill_vid)(struct net_device *dev, |
| 624 | unsigned short vid); | 667 | unsigned short vid); |
| 625 | #ifdef CONFIG_NET_POLL_CONTROLLER | 668 | #ifdef CONFIG_NET_POLL_CONTROLLER |
| 626 | #define HAVE_NETDEV_POLL | ||
| 627 | void (*ndo_poll_controller)(struct net_device *dev); | 669 | void (*ndo_poll_controller)(struct net_device *dev); |
| 628 | #endif | 670 | #endif |
| 671 | int (*ndo_set_vf_mac)(struct net_device *dev, | ||
| 672 | int queue, u8 *mac); | ||
| 673 | int (*ndo_set_vf_vlan)(struct net_device *dev, | ||
| 674 | int queue, u16 vlan, u8 qos); | ||
| 675 | int (*ndo_set_vf_tx_rate)(struct net_device *dev, | ||
| 676 | int vf, int rate); | ||
| 677 | int (*ndo_get_vf_config)(struct net_device *dev, | ||
| 678 | int vf, | ||
| 679 | struct ifla_vf_info *ivf); | ||
| 629 | #if defined(CONFIG_FCOE) || defined(CONFIG_FCOE_MODULE) | 680 | #if defined(CONFIG_FCOE) || defined(CONFIG_FCOE_MODULE) |
| 630 | int (*ndo_fcoe_enable)(struct net_device *dev); | 681 | int (*ndo_fcoe_enable)(struct net_device *dev); |
| 631 | int (*ndo_fcoe_disable)(struct net_device *dev); | 682 | int (*ndo_fcoe_disable)(struct net_device *dev); |
| @@ -635,6 +686,10 @@ struct net_device_ops { | |||
| 635 | unsigned int sgc); | 686 | unsigned int sgc); |
| 636 | int (*ndo_fcoe_ddp_done)(struct net_device *dev, | 687 | int (*ndo_fcoe_ddp_done)(struct net_device *dev, |
| 637 | u16 xid); | 688 | u16 xid); |
| 689 | #define NETDEV_FCOE_WWNN 0 | ||
| 690 | #define NETDEV_FCOE_WWPN 1 | ||
| 691 | int (*ndo_fcoe_get_wwn)(struct net_device *dev, | ||
| 692 | u64 *wwn, int type); | ||
| 638 | #endif | 693 | #endif |
| 639 | }; | 694 | }; |
| 640 | 695 | ||
| @@ -648,8 +703,7 @@ struct net_device_ops { | |||
| 648 | * moves out. | 703 | * moves out. |
| 649 | */ | 704 | */ |
| 650 | 705 | ||
| 651 | struct net_device | 706 | struct net_device { |
| 652 | { | ||
| 653 | 707 | ||
| 654 | /* | 708 | /* |
| 655 | * This is the first field of the "visible" part of this structure | 709 | * This is the first field of the "visible" part of this structure |
| @@ -683,6 +737,7 @@ struct net_device | |||
| 683 | 737 | ||
| 684 | struct list_head dev_list; | 738 | struct list_head dev_list; |
| 685 | struct list_head napi_list; | 739 | struct list_head napi_list; |
| 740 | struct list_head unreg_list; | ||
| 686 | 741 | ||
| 687 | /* Net device features */ | 742 | /* Net device features */ |
| 688 | unsigned long features; | 743 | unsigned long features; |
| @@ -708,6 +763,7 @@ struct net_device | |||
| 708 | #define NETIF_F_FCOE_CRC (1 << 24) /* FCoE CRC32 */ | 763 | #define NETIF_F_FCOE_CRC (1 << 24) /* FCoE CRC32 */ |
| 709 | #define NETIF_F_SCTP_CSUM (1 << 25) /* SCTP checksum offload */ | 764 | #define NETIF_F_SCTP_CSUM (1 << 25) /* SCTP checksum offload */ |
| 710 | #define NETIF_F_FCOE_MTU (1 << 26) /* Supports max FCoE MTU, 2158 bytes*/ | 765 | #define NETIF_F_FCOE_MTU (1 << 26) /* Supports max FCoE MTU, 2158 bytes*/ |
| 766 | #define NETIF_F_NTUPLE (1 << 27) /* N-tuple filters supported */ | ||
| 711 | 767 | ||
| 712 | /* Segmentation offload features */ | 768 | /* Segmentation offload features */ |
| 713 | #define NETIF_F_GSO_SHIFT 16 | 769 | #define NETIF_F_GSO_SHIFT 16 |
| @@ -859,7 +915,7 @@ struct net_device | |||
| 859 | /* device index hash chain */ | 915 | /* device index hash chain */ |
| 860 | struct hlist_node index_hlist; | 916 | struct hlist_node index_hlist; |
| 861 | 917 | ||
| 862 | struct net_device *link_watch_next; | 918 | struct list_head link_watch_list; |
| 863 | 919 | ||
| 864 | /* register/unregister state machine */ | 920 | /* register/unregister state machine */ |
| 865 | enum { NETREG_UNINITIALIZED=0, | 921 | enum { NETREG_UNINITIALIZED=0, |
| @@ -868,7 +924,12 @@ struct net_device | |||
| 868 | NETREG_UNREGISTERED, /* completed unregister todo */ | 924 | NETREG_UNREGISTERED, /* completed unregister todo */ |
| 869 | NETREG_RELEASED, /* called free_netdev */ | 925 | NETREG_RELEASED, /* called free_netdev */ |
| 870 | NETREG_DUMMY, /* dummy device for NAPI poll */ | 926 | NETREG_DUMMY, /* dummy device for NAPI poll */ |
| 871 | } reg_state; | 927 | } reg_state:16; |
| 928 | |||
| 929 | enum { | ||
| 930 | RTNL_LINK_INITIALIZED, | ||
| 931 | RTNL_LINK_INITIALIZING, | ||
| 932 | } rtnl_link_state:16; | ||
| 872 | 933 | ||
| 873 | /* Called from unregister, can be used to call free_netdev */ | 934 | /* Called from unregister, can be used to call free_netdev */ |
| 874 | void (*destructor)(struct net_device *dev); | 935 | void (*destructor)(struct net_device *dev); |
| @@ -894,8 +955,8 @@ struct net_device | |||
| 894 | 955 | ||
| 895 | /* class/net/name entry */ | 956 | /* class/net/name entry */ |
| 896 | struct device dev; | 957 | struct device dev; |
| 897 | /* space for optional statistics and wireless sysfs groups */ | 958 | /* space for optional device, statistics, and wireless sysfs groups */ |
| 898 | const struct attribute_group *sysfs_groups[3]; | 959 | const struct attribute_group *sysfs_groups[4]; |
| 899 | 960 | ||
| 900 | /* rtnetlink link ops */ | 961 | /* rtnetlink link ops */ |
| 901 | const struct rtnl_link_ops *rtnl_link_ops; | 962 | const struct rtnl_link_ops *rtnl_link_ops; |
| @@ -909,13 +970,15 @@ struct net_device | |||
| 909 | 970 | ||
| 910 | #ifdef CONFIG_DCB | 971 | #ifdef CONFIG_DCB |
| 911 | /* Data Center Bridging netlink ops */ | 972 | /* Data Center Bridging netlink ops */ |
| 912 | struct dcbnl_rtnl_ops *dcbnl_ops; | 973 | const struct dcbnl_rtnl_ops *dcbnl_ops; |
| 913 | #endif | 974 | #endif |
| 914 | 975 | ||
| 915 | #if defined(CONFIG_FCOE) || defined(CONFIG_FCOE_MODULE) | 976 | #if defined(CONFIG_FCOE) || defined(CONFIG_FCOE_MODULE) |
| 916 | /* max exchange id for FCoE LRO by ddp */ | 977 | /* max exchange id for FCoE LRO by ddp */ |
| 917 | unsigned int fcoe_ddp_xid; | 978 | unsigned int fcoe_ddp_xid; |
| 918 | #endif | 979 | #endif |
| 980 | /* n-tuple filter list attached to this device */ | ||
| 981 | struct ethtool_rx_ntuple_list ethtool_ntuple_list; | ||
| 919 | }; | 982 | }; |
| 920 | #define to_net_dev(d) container_of(d, struct net_device, dev) | 983 | #define to_net_dev(d) container_of(d, struct net_device, dev) |
| 921 | 984 | ||
| @@ -972,6 +1035,15 @@ static inline bool netdev_uses_dsa_tags(struct net_device *dev) | |||
| 972 | return 0; | 1035 | return 0; |
| 973 | } | 1036 | } |
| 974 | 1037 | ||
| 1038 | #ifndef CONFIG_NET_NS | ||
| 1039 | static inline void skb_set_dev(struct sk_buff *skb, struct net_device *dev) | ||
| 1040 | { | ||
| 1041 | skb->dev = dev; | ||
| 1042 | } | ||
| 1043 | #else /* CONFIG_NET_NS */ | ||
| 1044 | void skb_set_dev(struct sk_buff *skb, struct net_device *dev); | ||
| 1045 | #endif | ||
| 1046 | |||
| 975 | static inline bool netdev_uses_trailer_tags(struct net_device *dev) | 1047 | static inline bool netdev_uses_trailer_tags(struct net_device *dev) |
| 976 | { | 1048 | { |
| 977 | #ifdef CONFIG_NET_DSA_TAG_TRAILER | 1049 | #ifdef CONFIG_NET_DSA_TAG_TRAILER |
| @@ -1075,10 +1147,16 @@ extern rwlock_t dev_base_lock; /* Device list lock */ | |||
| 1075 | 1147 | ||
| 1076 | #define for_each_netdev(net, d) \ | 1148 | #define for_each_netdev(net, d) \ |
| 1077 | list_for_each_entry(d, &(net)->dev_base_head, dev_list) | 1149 | list_for_each_entry(d, &(net)->dev_base_head, dev_list) |
| 1150 | #define for_each_netdev_reverse(net, d) \ | ||
| 1151 | list_for_each_entry_reverse(d, &(net)->dev_base_head, dev_list) | ||
| 1152 | #define for_each_netdev_rcu(net, d) \ | ||
| 1153 | list_for_each_entry_rcu(d, &(net)->dev_base_head, dev_list) | ||
| 1078 | #define for_each_netdev_safe(net, d, n) \ | 1154 | #define for_each_netdev_safe(net, d, n) \ |
| 1079 | list_for_each_entry_safe(d, n, &(net)->dev_base_head, dev_list) | 1155 | list_for_each_entry_safe(d, n, &(net)->dev_base_head, dev_list) |
| 1080 | #define for_each_netdev_continue(net, d) \ | 1156 | #define for_each_netdev_continue(net, d) \ |
| 1081 | list_for_each_entry_continue(d, &(net)->dev_base_head, dev_list) | 1157 | list_for_each_entry_continue(d, &(net)->dev_base_head, dev_list) |
| 1158 | #define for_each_netdev_continue_rcu(net, d) \ | ||
| 1159 | list_for_each_entry_continue_rcu(d, &(net)->dev_base_head, dev_list) | ||
| 1082 | #define net_device_entry(lh) list_entry(lh, struct net_device, dev_list) | 1160 | #define net_device_entry(lh) list_entry(lh, struct net_device, dev_list) |
| 1083 | 1161 | ||
| 1084 | static inline struct net_device *next_net_device(struct net_device *dev) | 1162 | static inline struct net_device *next_net_device(struct net_device *dev) |
| @@ -1091,6 +1169,16 @@ static inline struct net_device *next_net_device(struct net_device *dev) | |||
| 1091 | return lh == &net->dev_base_head ? NULL : net_device_entry(lh); | 1169 | return lh == &net->dev_base_head ? NULL : net_device_entry(lh); |
| 1092 | } | 1170 | } |
| 1093 | 1171 | ||
| 1172 | static inline struct net_device *next_net_device_rcu(struct net_device *dev) | ||
| 1173 | { | ||
| 1174 | struct list_head *lh; | ||
| 1175 | struct net *net; | ||
| 1176 | |||
| 1177 | net = dev_net(dev); | ||
| 1178 | lh = rcu_dereference(dev->dev_list.next); | ||
| 1179 | return lh == &net->dev_base_head ? NULL : net_device_entry(lh); | ||
| 1180 | } | ||
| 1181 | |||
| 1094 | static inline struct net_device *first_net_device(struct net *net) | 1182 | static inline struct net_device *first_net_device(struct net *net) |
| 1095 | { | 1183 | { |
| 1096 | return list_empty(&net->dev_base_head) ? NULL : | 1184 | return list_empty(&net->dev_base_head) ? NULL : |
| @@ -1109,6 +1197,7 @@ extern void __dev_remove_pack(struct packet_type *pt); | |||
| 1109 | extern struct net_device *dev_get_by_flags(struct net *net, unsigned short flags, | 1197 | extern struct net_device *dev_get_by_flags(struct net *net, unsigned short flags, |
| 1110 | unsigned short mask); | 1198 | unsigned short mask); |
| 1111 | extern struct net_device *dev_get_by_name(struct net *net, const char *name); | 1199 | extern struct net_device *dev_get_by_name(struct net *net, const char *name); |
| 1200 | extern struct net_device *dev_get_by_name_rcu(struct net *net, const char *name); | ||
| 1112 | extern struct net_device *__dev_get_by_name(struct net *net, const char *name); | 1201 | extern struct net_device *__dev_get_by_name(struct net *net, const char *name); |
| 1113 | extern int dev_alloc_name(struct net_device *dev, const char *name); | 1202 | extern int dev_alloc_name(struct net_device *dev, const char *name); |
| 1114 | extern int dev_open(struct net_device *dev); | 1203 | extern int dev_open(struct net_device *dev); |
| @@ -1116,7 +1205,14 @@ extern int dev_close(struct net_device *dev); | |||
| 1116 | extern void dev_disable_lro(struct net_device *dev); | 1205 | extern void dev_disable_lro(struct net_device *dev); |
| 1117 | extern int dev_queue_xmit(struct sk_buff *skb); | 1206 | extern int dev_queue_xmit(struct sk_buff *skb); |
| 1118 | extern int register_netdevice(struct net_device *dev); | 1207 | extern int register_netdevice(struct net_device *dev); |
| 1119 | extern void unregister_netdevice(struct net_device *dev); | 1208 | extern void unregister_netdevice_queue(struct net_device *dev, |
| 1209 | struct list_head *head); | ||
| 1210 | extern void unregister_netdevice_many(struct list_head *head); | ||
| 1211 | static inline void unregister_netdevice(struct net_device *dev) | ||
| 1212 | { | ||
| 1213 | unregister_netdevice_queue(dev, NULL); | ||
| 1214 | } | ||
| 1215 | |||
| 1120 | extern void free_netdev(struct net_device *dev); | 1216 | extern void free_netdev(struct net_device *dev); |
| 1121 | extern void synchronize_net(void); | 1217 | extern void synchronize_net(void); |
| 1122 | extern int register_netdevice_notifier(struct notifier_block *nb); | 1218 | extern int register_netdevice_notifier(struct notifier_block *nb); |
| @@ -1127,6 +1223,7 @@ extern void netdev_resync_ops(struct net_device *dev); | |||
| 1127 | extern int call_netdevice_notifiers(unsigned long val, struct net_device *dev); | 1223 | extern int call_netdevice_notifiers(unsigned long val, struct net_device *dev); |
| 1128 | extern struct net_device *dev_get_by_index(struct net *net, int ifindex); | 1224 | extern struct net_device *dev_get_by_index(struct net *net, int ifindex); |
| 1129 | extern struct net_device *__dev_get_by_index(struct net *net, int ifindex); | 1225 | extern struct net_device *__dev_get_by_index(struct net *net, int ifindex); |
| 1226 | extern struct net_device *dev_get_by_index_rcu(struct net *net, int ifindex); | ||
| 1130 | extern int dev_restart(struct net_device *dev); | 1227 | extern int dev_restart(struct net_device *dev); |
| 1131 | #ifdef CONFIG_NETPOLL_TRAP | 1228 | #ifdef CONFIG_NETPOLL_TRAP |
| 1132 | extern int netpoll_trap(void); | 1229 | extern int netpoll_trap(void); |
| @@ -1212,8 +1309,7 @@ static inline int unregister_gifconf(unsigned int family) | |||
| 1212 | * Incoming packets are placed on per-cpu queues so that | 1309 | * Incoming packets are placed on per-cpu queues so that |
| 1213 | * no locking is needed. | 1310 | * no locking is needed. |
| 1214 | */ | 1311 | */ |
| 1215 | struct softnet_data | 1312 | struct softnet_data { |
| 1216 | { | ||
| 1217 | struct Qdisc *output_queue; | 1313 | struct Qdisc *output_queue; |
| 1218 | struct sk_buff_head input_pkt_queue; | 1314 | struct sk_buff_head input_pkt_queue; |
| 1219 | struct list_head poll_list; | 1315 | struct list_head poll_list; |
| @@ -1466,19 +1562,19 @@ extern int netif_rx(struct sk_buff *skb); | |||
| 1466 | extern int netif_rx_ni(struct sk_buff *skb); | 1562 | extern int netif_rx_ni(struct sk_buff *skb); |
| 1467 | #define HAVE_NETIF_RECEIVE_SKB 1 | 1563 | #define HAVE_NETIF_RECEIVE_SKB 1 |
| 1468 | extern int netif_receive_skb(struct sk_buff *skb); | 1564 | extern int netif_receive_skb(struct sk_buff *skb); |
| 1469 | extern void napi_gro_flush(struct napi_struct *napi); | 1565 | extern gro_result_t dev_gro_receive(struct napi_struct *napi, |
| 1470 | extern int dev_gro_receive(struct napi_struct *napi, | ||
| 1471 | struct sk_buff *skb); | 1566 | struct sk_buff *skb); |
| 1472 | extern int napi_skb_finish(int ret, struct sk_buff *skb); | 1567 | extern gro_result_t napi_skb_finish(gro_result_t ret, struct sk_buff *skb); |
| 1473 | extern int napi_gro_receive(struct napi_struct *napi, | 1568 | extern gro_result_t napi_gro_receive(struct napi_struct *napi, |
| 1474 | struct sk_buff *skb); | 1569 | struct sk_buff *skb); |
| 1475 | extern void napi_reuse_skb(struct napi_struct *napi, | 1570 | extern void napi_reuse_skb(struct napi_struct *napi, |
| 1476 | struct sk_buff *skb); | 1571 | struct sk_buff *skb); |
| 1477 | extern struct sk_buff * napi_get_frags(struct napi_struct *napi); | 1572 | extern struct sk_buff * napi_get_frags(struct napi_struct *napi); |
| 1478 | extern int napi_frags_finish(struct napi_struct *napi, | 1573 | extern gro_result_t napi_frags_finish(struct napi_struct *napi, |
| 1479 | struct sk_buff *skb, int ret); | 1574 | struct sk_buff *skb, |
| 1575 | gro_result_t ret); | ||
| 1480 | extern struct sk_buff * napi_frags_skb(struct napi_struct *napi); | 1576 | extern struct sk_buff * napi_frags_skb(struct napi_struct *napi); |
| 1481 | extern int napi_gro_frags(struct napi_struct *napi); | 1577 | extern gro_result_t napi_gro_frags(struct napi_struct *napi); |
| 1482 | 1578 | ||
| 1483 | static inline void napi_free_frags(struct napi_struct *napi) | 1579 | static inline void napi_free_frags(struct napi_struct *napi) |
| 1484 | { | 1580 | { |
| @@ -1491,7 +1587,9 @@ extern int dev_valid_name(const char *name); | |||
| 1491 | extern int dev_ioctl(struct net *net, unsigned int cmd, void __user *); | 1587 | extern int dev_ioctl(struct net *net, unsigned int cmd, void __user *); |
| 1492 | extern int dev_ethtool(struct net *net, struct ifreq *); | 1588 | extern int dev_ethtool(struct net *net, struct ifreq *); |
| 1493 | extern unsigned dev_get_flags(const struct net_device *); | 1589 | extern unsigned dev_get_flags(const struct net_device *); |
| 1590 | extern int __dev_change_flags(struct net_device *, unsigned int flags); | ||
| 1494 | extern int dev_change_flags(struct net_device *, unsigned); | 1591 | extern int dev_change_flags(struct net_device *, unsigned); |
| 1592 | extern void __dev_notify_flags(struct net_device *, unsigned int old_flags); | ||
| 1495 | extern int dev_change_name(struct net_device *, const char *); | 1593 | extern int dev_change_name(struct net_device *, const char *); |
| 1496 | extern int dev_set_alias(struct net_device *, const char *, size_t); | 1594 | extern int dev_set_alias(struct net_device *, const char *, size_t); |
| 1497 | extern int dev_change_net_namespace(struct net_device *, | 1595 | extern int dev_change_net_namespace(struct net_device *, |
| @@ -1502,6 +1600,8 @@ extern int dev_set_mac_address(struct net_device *, | |||
| 1502 | extern int dev_hard_start_xmit(struct sk_buff *skb, | 1600 | extern int dev_hard_start_xmit(struct sk_buff *skb, |
| 1503 | struct net_device *dev, | 1601 | struct net_device *dev, |
| 1504 | struct netdev_queue *txq); | 1602 | struct netdev_queue *txq); |
| 1603 | extern int dev_forward_skb(struct net_device *dev, | ||
| 1604 | struct sk_buff *skb); | ||
| 1505 | 1605 | ||
| 1506 | extern int netdev_budget; | 1606 | extern int netdev_budget; |
| 1507 | 1607 | ||
| @@ -1540,6 +1640,7 @@ static inline void dev_hold(struct net_device *dev) | |||
| 1540 | */ | 1640 | */ |
| 1541 | 1641 | ||
| 1542 | extern void linkwatch_fire_event(struct net_device *dev); | 1642 | extern void linkwatch_fire_event(struct net_device *dev); |
| 1643 | extern void linkwatch_forget_dev(struct net_device *dev); | ||
| 1543 | 1644 | ||
| 1544 | /** | 1645 | /** |
| 1545 | * netif_carrier_ok - test if carrier present | 1646 | * netif_carrier_ok - test if carrier present |
| @@ -1609,7 +1710,8 @@ static inline int netif_dormant(const struct net_device *dev) | |||
| 1609 | * | 1710 | * |
| 1610 | * Check if carrier is operational | 1711 | * Check if carrier is operational |
| 1611 | */ | 1712 | */ |
| 1612 | static inline int netif_oper_up(const struct net_device *dev) { | 1713 | static inline int netif_oper_up(const struct net_device *dev) |
| 1714 | { | ||
| 1613 | return (dev->operstate == IF_OPER_UP || | 1715 | return (dev->operstate == IF_OPER_UP || |
| 1614 | dev->operstate == IF_OPER_UNKNOWN /* backward compat */); | 1716 | dev->operstate == IF_OPER_UNKNOWN /* backward compat */); |
| 1615 | } | 1717 | } |
| @@ -1880,6 +1982,7 @@ extern void netdev_features_change(struct net_device *dev); | |||
| 1880 | extern void dev_load(struct net *net, const char *name); | 1982 | extern void dev_load(struct net *net, const char *name); |
| 1881 | extern void dev_mcast_init(void); | 1983 | extern void dev_mcast_init(void); |
| 1882 | extern const struct net_device_stats *dev_get_stats(struct net_device *dev); | 1984 | extern const struct net_device_stats *dev_get_stats(struct net_device *dev); |
| 1985 | extern void dev_txq_stats_fold(const struct net_device *dev, struct net_device_stats *stats); | ||
| 1883 | 1986 | ||
| 1884 | extern int netdev_max_backlog; | 1987 | extern int netdev_max_backlog; |
| 1885 | extern int weight_p; | 1988 | extern int weight_p; |
| @@ -1914,6 +2017,9 @@ unsigned long netdev_increment_features(unsigned long all, unsigned long one, | |||
| 1914 | unsigned long mask); | 2017 | unsigned long mask); |
| 1915 | unsigned long netdev_fix_features(unsigned long features, const char *name); | 2018 | unsigned long netdev_fix_features(unsigned long features, const char *name); |
| 1916 | 2019 | ||
| 2020 | void netif_stacked_transfer_operstate(const struct net_device *rootdev, | ||
| 2021 | struct net_device *dev); | ||
| 2022 | |||
| 1917 | static inline int net_gso_ok(int features, int gso_type) | 2023 | static inline int net_gso_ok(int features, int gso_type) |
| 1918 | { | 2024 | { |
| 1919 | int feature = gso_type << NETIF_F_GSO_SHIFT; | 2025 | int feature = gso_type << NETIF_F_GSO_SHIFT; |
| @@ -1953,12 +2059,12 @@ static inline void skb_bond_set_mac_by_master(struct sk_buff *skb, | |||
| 1953 | * duplicates except for 802.3ad ETH_P_SLOW, alb non-mcast/bcast, and | 2059 | * duplicates except for 802.3ad ETH_P_SLOW, alb non-mcast/bcast, and |
| 1954 | * ARP on active-backup slaves with arp_validate enabled. | 2060 | * ARP on active-backup slaves with arp_validate enabled. |
| 1955 | */ | 2061 | */ |
| 1956 | static inline int skb_bond_should_drop(struct sk_buff *skb) | 2062 | static inline int skb_bond_should_drop(struct sk_buff *skb, |
| 2063 | struct net_device *master) | ||
| 1957 | { | 2064 | { |
| 1958 | struct net_device *dev = skb->dev; | ||
| 1959 | struct net_device *master = dev->master; | ||
| 1960 | |||
| 1961 | if (master) { | 2065 | if (master) { |
| 2066 | struct net_device *dev = skb->dev; | ||
| 2067 | |||
| 1962 | if (master->priv_flags & IFF_MASTER_ARPMON) | 2068 | if (master->priv_flags & IFF_MASTER_ARPMON) |
| 1963 | dev->last_rx = jiffies; | 2069 | dev->last_rx = jiffies; |
| 1964 | 2070 | ||
| @@ -2013,6 +2119,130 @@ static inline u32 dev_ethtool_get_flags(struct net_device *dev) | |||
| 2013 | return 0; | 2119 | return 0; |
| 2014 | return dev->ethtool_ops->get_flags(dev); | 2120 | return dev->ethtool_ops->get_flags(dev); |
| 2015 | } | 2121 | } |
| 2122 | |||
| 2123 | /* Logging, debugging and troubleshooting/diagnostic helpers. */ | ||
| 2124 | |||
| 2125 | /* netdev_printk helpers, similar to dev_printk */ | ||
| 2126 | |||
| 2127 | static inline const char *netdev_name(const struct net_device *dev) | ||
| 2128 | { | ||
| 2129 | if (dev->reg_state != NETREG_REGISTERED) | ||
| 2130 | return "(unregistered net_device)"; | ||
| 2131 | return dev->name; | ||
| 2132 | } | ||
| 2133 | |||
| 2134 | #define netdev_printk(level, netdev, format, args...) \ | ||
| 2135 | dev_printk(level, (netdev)->dev.parent, \ | ||
| 2136 | "%s: " format, \ | ||
| 2137 | netdev_name(netdev), ##args) | ||
| 2138 | |||
| 2139 | #define netdev_emerg(dev, format, args...) \ | ||
| 2140 | netdev_printk(KERN_EMERG, dev, format, ##args) | ||
| 2141 | #define netdev_alert(dev, format, args...) \ | ||
| 2142 | netdev_printk(KERN_ALERT, dev, format, ##args) | ||
| 2143 | #define netdev_crit(dev, format, args...) \ | ||
| 2144 | netdev_printk(KERN_CRIT, dev, format, ##args) | ||
| 2145 | #define netdev_err(dev, format, args...) \ | ||
| 2146 | netdev_printk(KERN_ERR, dev, format, ##args) | ||
| 2147 | #define netdev_warn(dev, format, args...) \ | ||
| 2148 | netdev_printk(KERN_WARNING, dev, format, ##args) | ||
| 2149 | #define netdev_notice(dev, format, args...) \ | ||
| 2150 | netdev_printk(KERN_NOTICE, dev, format, ##args) | ||
| 2151 | #define netdev_info(dev, format, args...) \ | ||
| 2152 | netdev_printk(KERN_INFO, dev, format, ##args) | ||
| 2153 | |||
| 2154 | #if defined(DEBUG) | ||
| 2155 | #define netdev_dbg(__dev, format, args...) \ | ||
| 2156 | netdev_printk(KERN_DEBUG, __dev, format, ##args) | ||
| 2157 | #elif defined(CONFIG_DYNAMIC_DEBUG) | ||
| 2158 | #define netdev_dbg(__dev, format, args...) \ | ||
| 2159 | do { \ | ||
| 2160 | dynamic_dev_dbg((__dev)->dev.parent, "%s: " format, \ | ||
| 2161 | netdev_name(__dev), ##args); \ | ||
| 2162 | } while (0) | ||
| 2163 | #else | ||
| 2164 | #define netdev_dbg(__dev, format, args...) \ | ||
| 2165 | ({ \ | ||
| 2166 | if (0) \ | ||
| 2167 | netdev_printk(KERN_DEBUG, __dev, format, ##args); \ | ||
| 2168 | 0; \ | ||
| 2169 | }) | ||
| 2170 | #endif | ||
| 2171 | |||
| 2172 | #if defined(VERBOSE_DEBUG) | ||
| 2173 | #define netdev_vdbg netdev_dbg | ||
| 2174 | #else | ||
| 2175 | |||
| 2176 | #define netdev_vdbg(dev, format, args...) \ | ||
| 2177 | ({ \ | ||
| 2178 | if (0) \ | ||
| 2179 | netdev_printk(KERN_DEBUG, dev, format, ##args); \ | ||
| 2180 | 0; \ | ||
| 2181 | }) | ||
| 2182 | #endif | ||
| 2183 | |||
| 2184 | /* | ||
| 2185 | * netdev_WARN() acts like dev_printk(), but with the key difference | ||
| 2186 | * of using a WARN/WARN_ON to get the message out, including the | ||
| 2187 | * file/line information and a backtrace. | ||
| 2188 | */ | ||
| 2189 | #define netdev_WARN(dev, format, args...) \ | ||
| 2190 | WARN(1, "netdevice: %s\n" format, netdev_name(dev), ##args); | ||
| 2191 | |||
| 2192 | /* netif printk helpers, similar to netdev_printk */ | ||
| 2193 | |||
| 2194 | #define netif_printk(priv, type, level, dev, fmt, args...) \ | ||
| 2195 | do { \ | ||
| 2196 | if (netif_msg_##type(priv)) \ | ||
| 2197 | netdev_printk(level, (dev), fmt, ##args); \ | ||
| 2198 | } while (0) | ||
| 2199 | |||
| 2200 | #define netif_emerg(priv, type, dev, fmt, args...) \ | ||
| 2201 | netif_printk(priv, type, KERN_EMERG, dev, fmt, ##args) | ||
| 2202 | #define netif_alert(priv, type, dev, fmt, args...) \ | ||
| 2203 | netif_printk(priv, type, KERN_ALERT, dev, fmt, ##args) | ||
| 2204 | #define netif_crit(priv, type, dev, fmt, args...) \ | ||
| 2205 | netif_printk(priv, type, KERN_CRIT, dev, fmt, ##args) | ||
| 2206 | #define netif_err(priv, type, dev, fmt, args...) \ | ||
| 2207 | netif_printk(priv, type, KERN_ERR, dev, fmt, ##args) | ||
| 2208 | #define netif_warn(priv, type, dev, fmt, args...) \ | ||
| 2209 | netif_printk(priv, type, KERN_WARNING, dev, fmt, ##args) | ||
| 2210 | #define netif_notice(priv, type, dev, fmt, args...) \ | ||
| 2211 | netif_printk(priv, type, KERN_NOTICE, dev, fmt, ##args) | ||
| 2212 | #define netif_info(priv, type, dev, fmt, args...) \ | ||
| 2213 | netif_printk(priv, type, KERN_INFO, (dev), fmt, ##args) | ||
| 2214 | |||
| 2215 | #if defined(DEBUG) | ||
| 2216 | #define netif_dbg(priv, type, dev, format, args...) \ | ||
| 2217 | netif_printk(priv, type, KERN_DEBUG, dev, format, ##args) | ||
| 2218 | #elif defined(CONFIG_DYNAMIC_DEBUG) | ||
| 2219 | #define netif_dbg(priv, type, netdev, format, args...) \ | ||
| 2220 | do { \ | ||
| 2221 | if (netif_msg_##type(priv)) \ | ||
| 2222 | dynamic_dev_dbg((netdev)->dev.parent, \ | ||
| 2223 | "%s: " format, \ | ||
| 2224 | netdev_name(netdev), ##args); \ | ||
| 2225 | } while (0) | ||
| 2226 | #else | ||
| 2227 | #define netif_dbg(priv, type, dev, format, args...) \ | ||
| 2228 | ({ \ | ||
| 2229 | if (0) \ | ||
| 2230 | netif_printk(priv, type, KERN_DEBUG, dev, format, ##args); \ | ||
| 2231 | 0; \ | ||
| 2232 | }) | ||
| 2233 | #endif | ||
| 2234 | |||
| 2235 | #if defined(VERBOSE_DEBUG) | ||
| 2236 | #define netif_vdbg netdev_dbg | ||
| 2237 | #else | ||
| 2238 | #define netif_vdbg(priv, type, dev, format, args...) \ | ||
| 2239 | ({ \ | ||
| 2240 | if (0) \ | ||
| 2241 | netif_printk(KERN_DEBUG, dev, format, ##args); \ | ||
| 2242 | 0; \ | ||
| 2243 | }) | ||
| 2244 | #endif | ||
| 2245 | |||
| 2016 | #endif /* __KERNEL__ */ | 2246 | #endif /* __KERNEL__ */ |
| 2017 | 2247 | ||
| 2018 | #endif /* _LINUX_NETDEVICE_H */ | 2248 | #endif /* _LINUX_NETDEVICE_H */ |
diff --git a/include/linux/netfilter.h b/include/linux/netfilter.h index 6132b5e6d9d3..89341c32631a 100644 --- a/include/linux/netfilter.h +++ b/include/linux/netfilter.h | |||
| @@ -93,8 +93,7 @@ typedef unsigned int nf_hookfn(unsigned int hooknum, | |||
| 93 | const struct net_device *out, | 93 | const struct net_device *out, |
| 94 | int (*okfn)(struct sk_buff *)); | 94 | int (*okfn)(struct sk_buff *)); |
| 95 | 95 | ||
| 96 | struct nf_hook_ops | 96 | struct nf_hook_ops { |
| 97 | { | ||
| 98 | struct list_head list; | 97 | struct list_head list; |
| 99 | 98 | ||
| 100 | /* User fills in from here down. */ | 99 | /* User fills in from here down. */ |
| @@ -106,8 +105,7 @@ struct nf_hook_ops | |||
| 106 | int priority; | 105 | int priority; |
| 107 | }; | 106 | }; |
| 108 | 107 | ||
| 109 | struct nf_sockopt_ops | 108 | struct nf_sockopt_ops { |
| 110 | { | ||
| 111 | struct list_head list; | 109 | struct list_head list; |
| 112 | 110 | ||
| 113 | u_int8_t pf; | 111 | u_int8_t pf; |
| @@ -116,15 +114,17 @@ struct nf_sockopt_ops | |||
| 116 | int set_optmin; | 114 | int set_optmin; |
| 117 | int set_optmax; | 115 | int set_optmax; |
| 118 | int (*set)(struct sock *sk, int optval, void __user *user, unsigned int len); | 116 | int (*set)(struct sock *sk, int optval, void __user *user, unsigned int len); |
| 117 | #ifdef CONFIG_COMPAT | ||
| 119 | int (*compat_set)(struct sock *sk, int optval, | 118 | int (*compat_set)(struct sock *sk, int optval, |
| 120 | void __user *user, unsigned int len); | 119 | void __user *user, unsigned int len); |
| 121 | 120 | #endif | |
| 122 | int get_optmin; | 121 | int get_optmin; |
| 123 | int get_optmax; | 122 | int get_optmax; |
| 124 | int (*get)(struct sock *sk, int optval, void __user *user, int *len); | 123 | int (*get)(struct sock *sk, int optval, void __user *user, int *len); |
| 124 | #ifdef CONFIG_COMPAT | ||
| 125 | int (*compat_get)(struct sock *sk, int optval, | 125 | int (*compat_get)(struct sock *sk, int optval, |
| 126 | void __user *user, int *len); | 126 | void __user *user, int *len); |
| 127 | 127 | #endif | |
| 128 | /* Use the module struct to lock set/get code in place */ | 128 | /* Use the module struct to lock set/get code in place */ |
| 129 | struct module *owner; | 129 | struct module *owner; |
| 130 | }; | 130 | }; |
| @@ -163,11 +163,8 @@ static inline int nf_hook_thresh(u_int8_t pf, unsigned int hook, | |||
| 163 | struct sk_buff *skb, | 163 | struct sk_buff *skb, |
| 164 | struct net_device *indev, | 164 | struct net_device *indev, |
| 165 | struct net_device *outdev, | 165 | struct net_device *outdev, |
| 166 | int (*okfn)(struct sk_buff *), int thresh, | 166 | int (*okfn)(struct sk_buff *), int thresh) |
| 167 | int cond) | ||
| 168 | { | 167 | { |
| 169 | if (!cond) | ||
| 170 | return 1; | ||
| 171 | #ifndef CONFIG_NETFILTER_DEBUG | 168 | #ifndef CONFIG_NETFILTER_DEBUG |
| 172 | if (list_empty(&nf_hooks[pf][hook])) | 169 | if (list_empty(&nf_hooks[pf][hook])) |
| 173 | return 1; | 170 | return 1; |
| @@ -179,7 +176,7 @@ static inline int nf_hook(u_int8_t pf, unsigned int hook, struct sk_buff *skb, | |||
| 179 | struct net_device *indev, struct net_device *outdev, | 176 | struct net_device *indev, struct net_device *outdev, |
| 180 | int (*okfn)(struct sk_buff *)) | 177 | int (*okfn)(struct sk_buff *)) |
| 181 | { | 178 | { |
| 182 | return nf_hook_thresh(pf, hook, skb, indev, outdev, okfn, INT_MIN, 1); | 179 | return nf_hook_thresh(pf, hook, skb, indev, outdev, okfn, INT_MIN); |
| 183 | } | 180 | } |
| 184 | 181 | ||
| 185 | /* Activate hook; either okfn or kfree_skb called, unless a hook | 182 | /* Activate hook; either okfn or kfree_skb called, unless a hook |
| @@ -199,36 +196,49 @@ static inline int nf_hook(u_int8_t pf, unsigned int hook, struct sk_buff *skb, | |||
| 199 | coders :) | 196 | coders :) |
| 200 | */ | 197 | */ |
| 201 | 198 | ||
| 202 | /* This is gross, but inline doesn't cut it for avoiding the function | 199 | static inline int |
| 203 | call in fast path: gcc doesn't inline (needs value tracking?). --RR */ | 200 | NF_HOOK_THRESH(uint8_t pf, unsigned int hook, struct sk_buff *skb, |
| 204 | 201 | struct net_device *in, struct net_device *out, | |
| 205 | /* HX: It's slightly less gross now. */ | 202 | int (*okfn)(struct sk_buff *), int thresh) |
| 203 | { | ||
| 204 | int ret = nf_hook_thresh(pf, hook, skb, in, out, okfn, thresh); | ||
| 205 | if (ret == 1) | ||
| 206 | ret = okfn(skb); | ||
| 207 | return ret; | ||
| 208 | } | ||
| 206 | 209 | ||
| 207 | #define NF_HOOK_THRESH(pf, hook, skb, indev, outdev, okfn, thresh) \ | 210 | static inline int |
| 208 | ({int __ret; \ | 211 | NF_HOOK_COND(uint8_t pf, unsigned int hook, struct sk_buff *skb, |
| 209 | if ((__ret=nf_hook_thresh(pf, hook, (skb), indev, outdev, okfn, thresh, 1)) == 1)\ | 212 | struct net_device *in, struct net_device *out, |
| 210 | __ret = (okfn)(skb); \ | 213 | int (*okfn)(struct sk_buff *), bool cond) |
| 211 | __ret;}) | 214 | { |
| 215 | int ret; | ||
| 212 | 216 | ||
| 213 | #define NF_HOOK_COND(pf, hook, skb, indev, outdev, okfn, cond) \ | 217 | if (!cond || |
| 214 | ({int __ret; \ | 218 | (ret = nf_hook_thresh(pf, hook, skb, in, out, okfn, INT_MIN) == 1)) |
| 215 | if ((__ret=nf_hook_thresh(pf, hook, (skb), indev, outdev, okfn, INT_MIN, cond)) == 1)\ | 219 | ret = okfn(skb); |
| 216 | __ret = (okfn)(skb); \ | 220 | return ret; |
| 217 | __ret;}) | 221 | } |
| 218 | 222 | ||
| 219 | #define NF_HOOK(pf, hook, skb, indev, outdev, okfn) \ | 223 | static inline int |
| 220 | NF_HOOK_THRESH(pf, hook, skb, indev, outdev, okfn, INT_MIN) | 224 | NF_HOOK(uint8_t pf, unsigned int hook, struct sk_buff *skb, |
| 225 | struct net_device *in, struct net_device *out, | ||
| 226 | int (*okfn)(struct sk_buff *)) | ||
| 227 | { | ||
| 228 | return NF_HOOK_THRESH(pf, hook, skb, in, out, okfn, INT_MIN); | ||
| 229 | } | ||
| 221 | 230 | ||
| 222 | /* Call setsockopt() */ | 231 | /* Call setsockopt() */ |
| 223 | int nf_setsockopt(struct sock *sk, u_int8_t pf, int optval, char __user *opt, | 232 | int nf_setsockopt(struct sock *sk, u_int8_t pf, int optval, char __user *opt, |
| 224 | unsigned int len); | 233 | unsigned int len); |
| 225 | int nf_getsockopt(struct sock *sk, u_int8_t pf, int optval, char __user *opt, | 234 | int nf_getsockopt(struct sock *sk, u_int8_t pf, int optval, char __user *opt, |
| 226 | int *len); | 235 | int *len); |
| 227 | 236 | #ifdef CONFIG_COMPAT | |
| 228 | int compat_nf_setsockopt(struct sock *sk, u_int8_t pf, int optval, | 237 | int compat_nf_setsockopt(struct sock *sk, u_int8_t pf, int optval, |
| 229 | char __user *opt, unsigned int len); | 238 | char __user *opt, unsigned int len); |
| 230 | int compat_nf_getsockopt(struct sock *sk, u_int8_t pf, int optval, | 239 | int compat_nf_getsockopt(struct sock *sk, u_int8_t pf, int optval, |
| 231 | char __user *opt, int *len); | 240 | char __user *opt, int *len); |
| 241 | #endif | ||
| 232 | 242 | ||
| 233 | /* Call this before modifying an existing packet: ensures it is | 243 | /* Call this before modifying an existing packet: ensures it is |
| 234 | modifiable and linear to the point you care about (writable_len). | 244 | modifiable and linear to the point you care about (writable_len). |
| @@ -327,8 +337,7 @@ static inline int nf_hook_thresh(u_int8_t pf, unsigned int hook, | |||
| 327 | struct sk_buff *skb, | 337 | struct sk_buff *skb, |
| 328 | struct net_device *indev, | 338 | struct net_device *indev, |
| 329 | struct net_device *outdev, | 339 | struct net_device *outdev, |
| 330 | int (*okfn)(struct sk_buff *), int thresh, | 340 | int (*okfn)(struct sk_buff *), int thresh) |
| 331 | int cond) | ||
| 332 | { | 341 | { |
| 333 | return okfn(skb); | 342 | return okfn(skb); |
| 334 | } | 343 | } |
diff --git a/include/linux/netfilter/Kbuild b/include/linux/netfilter/Kbuild index 2aea50399c0b..a5a63e41b8af 100644 --- a/include/linux/netfilter/Kbuild +++ b/include/linux/netfilter/Kbuild | |||
| @@ -6,6 +6,7 @@ header-y += nfnetlink_queue.h | |||
| 6 | header-y += xt_CLASSIFY.h | 6 | header-y += xt_CLASSIFY.h |
| 7 | header-y += xt_CONNMARK.h | 7 | header-y += xt_CONNMARK.h |
| 8 | header-y += xt_CONNSECMARK.h | 8 | header-y += xt_CONNSECMARK.h |
| 9 | header-y += xt_CT.h | ||
| 9 | header-y += xt_DSCP.h | 10 | header-y += xt_DSCP.h |
| 10 | header-y += xt_LED.h | 11 | header-y += xt_LED.h |
| 11 | header-y += xt_MARK.h | 12 | header-y += xt_MARK.h |
diff --git a/include/linux/netfilter/nf_conntrack_common.h b/include/linux/netfilter/nf_conntrack_common.h index a8248ee422b7..c608677dda60 100644 --- a/include/linux/netfilter/nf_conntrack_common.h +++ b/include/linux/netfilter/nf_conntrack_common.h | |||
| @@ -3,8 +3,7 @@ | |||
| 3 | /* Connection state tracking for netfilter. This is separated from, | 3 | /* Connection state tracking for netfilter. This is separated from, |
| 4 | but required by, the NAT layer; it can also be used by an iptables | 4 | but required by, the NAT layer; it can also be used by an iptables |
| 5 | extension. */ | 5 | extension. */ |
| 6 | enum ip_conntrack_info | 6 | enum ip_conntrack_info { |
| 7 | { | ||
| 8 | /* Part of an established connection (either direction). */ | 7 | /* Part of an established connection (either direction). */ |
| 9 | IP_CT_ESTABLISHED, | 8 | IP_CT_ESTABLISHED, |
| 10 | 9 | ||
| @@ -73,11 +72,32 @@ enum ip_conntrack_status { | |||
| 73 | /* Connection has fixed timeout. */ | 72 | /* Connection has fixed timeout. */ |
| 74 | IPS_FIXED_TIMEOUT_BIT = 10, | 73 | IPS_FIXED_TIMEOUT_BIT = 10, |
| 75 | IPS_FIXED_TIMEOUT = (1 << IPS_FIXED_TIMEOUT_BIT), | 74 | IPS_FIXED_TIMEOUT = (1 << IPS_FIXED_TIMEOUT_BIT), |
| 75 | |||
| 76 | /* Conntrack is a template */ | ||
| 77 | IPS_TEMPLATE_BIT = 11, | ||
| 78 | IPS_TEMPLATE = (1 << IPS_TEMPLATE_BIT), | ||
| 79 | }; | ||
| 80 | |||
| 81 | /* Connection tracking event types */ | ||
| 82 | enum ip_conntrack_events { | ||
| 83 | IPCT_NEW, /* new conntrack */ | ||
| 84 | IPCT_RELATED, /* related conntrack */ | ||
| 85 | IPCT_DESTROY, /* destroyed conntrack */ | ||
| 86 | IPCT_REPLY, /* connection has seen two-way traffic */ | ||
| 87 | IPCT_ASSURED, /* connection status has changed to assured */ | ||
| 88 | IPCT_PROTOINFO, /* protocol information has changed */ | ||
| 89 | IPCT_HELPER, /* new helper has been set */ | ||
| 90 | IPCT_MARK, /* new mark has been set */ | ||
| 91 | IPCT_NATSEQADJ, /* NAT is doing sequence adjustment */ | ||
| 92 | IPCT_SECMARK, /* new security mark has been set */ | ||
| 93 | }; | ||
| 94 | |||
| 95 | enum ip_conntrack_expect_events { | ||
| 96 | IPEXP_NEW, /* new expectation */ | ||
| 76 | }; | 97 | }; |
| 77 | 98 | ||
| 78 | #ifdef __KERNEL__ | 99 | #ifdef __KERNEL__ |
| 79 | struct ip_conntrack_stat | 100 | struct ip_conntrack_stat { |
| 80 | { | ||
| 81 | unsigned int searched; | 101 | unsigned int searched; |
| 82 | unsigned int found; | 102 | unsigned int found; |
| 83 | unsigned int new; | 103 | unsigned int new; |
diff --git a/include/linux/netfilter/nf_conntrack_ftp.h b/include/linux/netfilter/nf_conntrack_ftp.h index 47727d7546ea..3e3aa08980c3 100644 --- a/include/linux/netfilter/nf_conntrack_ftp.h +++ b/include/linux/netfilter/nf_conntrack_ftp.h | |||
| @@ -3,8 +3,7 @@ | |||
| 3 | /* FTP tracking. */ | 3 | /* FTP tracking. */ |
| 4 | 4 | ||
| 5 | /* This enum is exposed to userspace */ | 5 | /* This enum is exposed to userspace */ |
| 6 | enum nf_ct_ftp_type | 6 | enum nf_ct_ftp_type { |
| 7 | { | ||
| 8 | /* PORT command from client */ | 7 | /* PORT command from client */ |
| 9 | NF_CT_FTP_PORT, | 8 | NF_CT_FTP_PORT, |
| 10 | /* PASV response from server */ | 9 | /* PASV response from server */ |
diff --git a/include/linux/netfilter/nf_conntrack_sctp.h b/include/linux/netfilter/nf_conntrack_sctp.h index 768f78c4ac53..ceeefe6681b5 100644 --- a/include/linux/netfilter/nf_conntrack_sctp.h +++ b/include/linux/netfilter/nf_conntrack_sctp.h | |||
| @@ -16,8 +16,7 @@ enum sctp_conntrack { | |||
| 16 | SCTP_CONNTRACK_MAX | 16 | SCTP_CONNTRACK_MAX |
| 17 | }; | 17 | }; |
| 18 | 18 | ||
| 19 | struct ip_ct_sctp | 19 | struct ip_ct_sctp { |
| 20 | { | ||
| 21 | enum sctp_conntrack state; | 20 | enum sctp_conntrack state; |
| 22 | 21 | ||
| 23 | __be32 vtag[IP_CT_DIR_MAX]; | 22 | __be32 vtag[IP_CT_DIR_MAX]; |
diff --git a/include/linux/netfilter/nf_conntrack_sip.h b/include/linux/netfilter/nf_conntrack_sip.h index 23aa2ec6b7b7..ff8cfbcf3b81 100644 --- a/include/linux/netfilter/nf_conntrack_sip.h +++ b/include/linux/netfilter/nf_conntrack_sip.h | |||
| @@ -14,6 +14,7 @@ enum sip_expectation_classes { | |||
| 14 | SIP_EXPECT_SIGNALLING, | 14 | SIP_EXPECT_SIGNALLING, |
| 15 | SIP_EXPECT_AUDIO, | 15 | SIP_EXPECT_AUDIO, |
| 16 | SIP_EXPECT_VIDEO, | 16 | SIP_EXPECT_VIDEO, |
| 17 | SIP_EXPECT_IMAGE, | ||
| 17 | __SIP_EXPECT_MAX | 18 | __SIP_EXPECT_MAX |
| 18 | }; | 19 | }; |
| 19 | #define SIP_EXPECT_MAX (__SIP_EXPECT_MAX - 1) | 20 | #define SIP_EXPECT_MAX (__SIP_EXPECT_MAX - 1) |
| @@ -34,10 +35,10 @@ struct sdp_media_type { | |||
| 34 | struct sip_handler { | 35 | struct sip_handler { |
| 35 | const char *method; | 36 | const char *method; |
| 36 | unsigned int len; | 37 | unsigned int len; |
| 37 | int (*request)(struct sk_buff *skb, | 38 | int (*request)(struct sk_buff *skb, unsigned int dataoff, |
| 38 | const char **dptr, unsigned int *datalen, | 39 | const char **dptr, unsigned int *datalen, |
| 39 | unsigned int cseq); | 40 | unsigned int cseq); |
| 40 | int (*response)(struct sk_buff *skb, | 41 | int (*response)(struct sk_buff *skb, unsigned int dataoff, |
| 41 | const char **dptr, unsigned int *datalen, | 42 | const char **dptr, unsigned int *datalen, |
| 42 | unsigned int cseq, unsigned int code); | 43 | unsigned int cseq, unsigned int code); |
| 43 | }; | 44 | }; |
| @@ -84,7 +85,8 @@ enum sip_header_types { | |||
| 84 | SIP_HDR_FROM, | 85 | SIP_HDR_FROM, |
| 85 | SIP_HDR_TO, | 86 | SIP_HDR_TO, |
| 86 | SIP_HDR_CONTACT, | 87 | SIP_HDR_CONTACT, |
| 87 | SIP_HDR_VIA, | 88 | SIP_HDR_VIA_UDP, |
| 89 | SIP_HDR_VIA_TCP, | ||
| 88 | SIP_HDR_EXPIRES, | 90 | SIP_HDR_EXPIRES, |
| 89 | SIP_HDR_CONTENT_LENGTH, | 91 | SIP_HDR_CONTENT_LENGTH, |
| 90 | }; | 92 | }; |
| @@ -100,33 +102,40 @@ enum sdp_header_types { | |||
| 100 | }; | 102 | }; |
| 101 | 103 | ||
| 102 | extern unsigned int (*nf_nat_sip_hook)(struct sk_buff *skb, | 104 | extern unsigned int (*nf_nat_sip_hook)(struct sk_buff *skb, |
| 105 | unsigned int dataoff, | ||
| 103 | const char **dptr, | 106 | const char **dptr, |
| 104 | unsigned int *datalen); | 107 | unsigned int *datalen); |
| 108 | extern void (*nf_nat_sip_seq_adjust_hook)(struct sk_buff *skb, s16 off); | ||
| 105 | extern unsigned int (*nf_nat_sip_expect_hook)(struct sk_buff *skb, | 109 | extern unsigned int (*nf_nat_sip_expect_hook)(struct sk_buff *skb, |
| 110 | unsigned int dataoff, | ||
| 106 | const char **dptr, | 111 | const char **dptr, |
| 107 | unsigned int *datalen, | 112 | unsigned int *datalen, |
| 108 | struct nf_conntrack_expect *exp, | 113 | struct nf_conntrack_expect *exp, |
| 109 | unsigned int matchoff, | 114 | unsigned int matchoff, |
| 110 | unsigned int matchlen); | 115 | unsigned int matchlen); |
| 111 | extern unsigned int (*nf_nat_sdp_addr_hook)(struct sk_buff *skb, | 116 | extern unsigned int (*nf_nat_sdp_addr_hook)(struct sk_buff *skb, |
| 112 | const char **dptr, | ||
| 113 | unsigned int dataoff, | 117 | unsigned int dataoff, |
| 118 | const char **dptr, | ||
| 114 | unsigned int *datalen, | 119 | unsigned int *datalen, |
| 120 | unsigned int sdpoff, | ||
| 115 | enum sdp_header_types type, | 121 | enum sdp_header_types type, |
| 116 | enum sdp_header_types term, | 122 | enum sdp_header_types term, |
| 117 | const union nf_inet_addr *addr); | 123 | const union nf_inet_addr *addr); |
| 118 | extern unsigned int (*nf_nat_sdp_port_hook)(struct sk_buff *skb, | 124 | extern unsigned int (*nf_nat_sdp_port_hook)(struct sk_buff *skb, |
| 125 | unsigned int dataoff, | ||
| 119 | const char **dptr, | 126 | const char **dptr, |
| 120 | unsigned int *datalen, | 127 | unsigned int *datalen, |
| 121 | unsigned int matchoff, | 128 | unsigned int matchoff, |
| 122 | unsigned int matchlen, | 129 | unsigned int matchlen, |
| 123 | u_int16_t port); | 130 | u_int16_t port); |
| 124 | extern unsigned int (*nf_nat_sdp_session_hook)(struct sk_buff *skb, | 131 | extern unsigned int (*nf_nat_sdp_session_hook)(struct sk_buff *skb, |
| 125 | const char **dptr, | ||
| 126 | unsigned int dataoff, | 132 | unsigned int dataoff, |
| 133 | const char **dptr, | ||
| 127 | unsigned int *datalen, | 134 | unsigned int *datalen, |
| 135 | unsigned int sdpoff, | ||
| 128 | const union nf_inet_addr *addr); | 136 | const union nf_inet_addr *addr); |
| 129 | extern unsigned int (*nf_nat_sdp_media_hook)(struct sk_buff *skb, | 137 | extern unsigned int (*nf_nat_sdp_media_hook)(struct sk_buff *skb, |
| 138 | unsigned int dataoff, | ||
| 130 | const char **dptr, | 139 | const char **dptr, |
| 131 | unsigned int *datalen, | 140 | unsigned int *datalen, |
| 132 | struct nf_conntrack_expect *rtp_exp, | 141 | struct nf_conntrack_expect *rtp_exp, |
diff --git a/include/linux/netfilter/nf_conntrack_tcp.h b/include/linux/netfilter/nf_conntrack_tcp.h index 4352feed2377..6e135f97e59a 100644 --- a/include/linux/netfilter/nf_conntrack_tcp.h +++ b/include/linux/netfilter/nf_conntrack_tcp.h | |||
| @@ -55,8 +55,7 @@ struct ip_ct_tcp_state { | |||
| 55 | u_int8_t flags; /* per direction options */ | 55 | u_int8_t flags; /* per direction options */ |
| 56 | }; | 56 | }; |
| 57 | 57 | ||
| 58 | struct ip_ct_tcp | 58 | struct ip_ct_tcp { |
| 59 | { | ||
| 60 | struct ip_ct_tcp_state seen[2]; /* connection parameters per direction */ | 59 | struct ip_ct_tcp_state seen[2]; /* connection parameters per direction */ |
| 61 | u_int8_t state; /* state of the connection (enum tcp_conntrack) */ | 60 | u_int8_t state; /* state of the connection (enum tcp_conntrack) */ |
| 62 | /* For detecting stale connections */ | 61 | /* For detecting stale connections */ |
| @@ -67,6 +66,9 @@ struct ip_ct_tcp | |||
| 67 | u_int32_t last_ack; /* Last sequence number seen in opposite dir */ | 66 | u_int32_t last_ack; /* Last sequence number seen in opposite dir */ |
| 68 | u_int32_t last_end; /* Last seq + len */ | 67 | u_int32_t last_end; /* Last seq + len */ |
| 69 | u_int16_t last_win; /* Last window advertisement seen in dir */ | 68 | u_int16_t last_win; /* Last window advertisement seen in dir */ |
| 69 | /* For SYN packets while we may be out-of-sync */ | ||
| 70 | u_int8_t last_wscale; /* Last window scaling factor seen */ | ||
| 71 | u_int8_t last_flags; /* Last flags set */ | ||
| 70 | }; | 72 | }; |
| 71 | 73 | ||
| 72 | #endif /* __KERNEL__ */ | 74 | #endif /* __KERNEL__ */ |
diff --git a/include/linux/netfilter/nfnetlink.h b/include/linux/netfilter/nfnetlink.h index 9f00da287f2c..361d6b5630ee 100644 --- a/include/linux/netfilter/nfnetlink.h +++ b/include/linux/netfilter/nfnetlink.h | |||
| @@ -55,8 +55,7 @@ struct nfgenmsg { | |||
| 55 | #include <linux/capability.h> | 55 | #include <linux/capability.h> |
| 56 | #include <net/netlink.h> | 56 | #include <net/netlink.h> |
| 57 | 57 | ||
| 58 | struct nfnl_callback | 58 | struct nfnl_callback { |
| 59 | { | ||
| 60 | int (*call)(struct sock *nl, struct sk_buff *skb, | 59 | int (*call)(struct sock *nl, struct sk_buff *skb, |
| 61 | const struct nlmsghdr *nlh, | 60 | const struct nlmsghdr *nlh, |
| 62 | const struct nlattr * const cda[]); | 61 | const struct nlattr * const cda[]); |
| @@ -64,8 +63,7 @@ struct nfnl_callback | |||
| 64 | const u_int16_t attr_count; /* number of nlattr's */ | 63 | const u_int16_t attr_count; /* number of nlattr's */ |
| 65 | }; | 64 | }; |
| 66 | 65 | ||
| 67 | struct nfnetlink_subsystem | 66 | struct nfnetlink_subsystem { |
| 68 | { | ||
| 69 | const char *name; | 67 | const char *name; |
| 70 | __u8 subsys_id; /* nfnetlink subsystem ID */ | 68 | __u8 subsys_id; /* nfnetlink subsystem ID */ |
| 71 | __u8 cb_count; /* number of callbacks */ | 69 | __u8 cb_count; /* number of callbacks */ |
| @@ -75,11 +73,11 @@ struct nfnetlink_subsystem | |||
| 75 | extern int nfnetlink_subsys_register(const struct nfnetlink_subsystem *n); | 73 | extern int nfnetlink_subsys_register(const struct nfnetlink_subsystem *n); |
| 76 | extern int nfnetlink_subsys_unregister(const struct nfnetlink_subsystem *n); | 74 | extern int nfnetlink_subsys_unregister(const struct nfnetlink_subsystem *n); |
| 77 | 75 | ||
| 78 | extern int nfnetlink_has_listeners(unsigned int group); | 76 | extern int nfnetlink_has_listeners(struct net *net, unsigned int group); |
| 79 | extern int nfnetlink_send(struct sk_buff *skb, u32 pid, unsigned group, | 77 | extern int nfnetlink_send(struct sk_buff *skb, struct net *net, u32 pid, unsigned group, |
| 80 | int echo, gfp_t flags); | 78 | int echo, gfp_t flags); |
| 81 | extern void nfnetlink_set_err(u32 pid, u32 group, int error); | 79 | extern int nfnetlink_set_err(struct net *net, u32 pid, u32 group, int error); |
| 82 | extern int nfnetlink_unicast(struct sk_buff *skb, u_int32_t pid, int flags); | 80 | extern int nfnetlink_unicast(struct sk_buff *skb, struct net *net, u_int32_t pid, int flags); |
| 83 | 81 | ||
| 84 | extern void nfnl_lock(void); | 82 | extern void nfnl_lock(void); |
| 85 | extern void nfnl_unlock(void); | 83 | extern void nfnl_unlock(void); |
diff --git a/include/linux/netfilter/nfnetlink_compat.h b/include/linux/netfilter/nfnetlink_compat.h index eda55cabceec..ffb95036bbd4 100644 --- a/include/linux/netfilter/nfnetlink_compat.h +++ b/include/linux/netfilter/nfnetlink_compat.h | |||
| @@ -21,8 +21,7 @@ | |||
| 21 | * ! nfnetlink use the same attributes methods. - J. Schulist. | 21 | * ! nfnetlink use the same attributes methods. - J. Schulist. |
| 22 | */ | 22 | */ |
| 23 | 23 | ||
| 24 | struct nfattr | 24 | struct nfattr { |
| 25 | { | ||
| 26 | __u16 nfa_len; | 25 | __u16 nfa_len; |
| 27 | __u16 nfa_type; /* we use 15 bits for the type, and the highest | 26 | __u16 nfa_type; /* we use 15 bits for the type, and the highest |
| 28 | * bit to indicate whether the payload is nested */ | 27 | * bit to indicate whether the payload is nested */ |
diff --git a/include/linux/netfilter/nfnetlink_conntrack.h b/include/linux/netfilter/nfnetlink_conntrack.h index ed4ef8d0b11b..9ed534c991b9 100644 --- a/include/linux/netfilter/nfnetlink_conntrack.h +++ b/include/linux/netfilter/nfnetlink_conntrack.h | |||
| @@ -40,6 +40,7 @@ enum ctattr_type { | |||
| 40 | CTA_NAT_SEQ_ADJ_ORIG, | 40 | CTA_NAT_SEQ_ADJ_ORIG, |
| 41 | CTA_NAT_SEQ_ADJ_REPLY, | 41 | CTA_NAT_SEQ_ADJ_REPLY, |
| 42 | CTA_SECMARK, | 42 | CTA_SECMARK, |
| 43 | CTA_ZONE, | ||
| 43 | __CTA_MAX | 44 | __CTA_MAX |
| 44 | }; | 45 | }; |
| 45 | #define CTA_MAX (__CTA_MAX - 1) | 46 | #define CTA_MAX (__CTA_MAX - 1) |
| @@ -159,6 +160,7 @@ enum ctattr_expect { | |||
| 159 | CTA_EXPECT_TIMEOUT, | 160 | CTA_EXPECT_TIMEOUT, |
| 160 | CTA_EXPECT_ID, | 161 | CTA_EXPECT_ID, |
| 161 | CTA_EXPECT_HELP_NAME, | 162 | CTA_EXPECT_HELP_NAME, |
| 163 | CTA_EXPECT_ZONE, | ||
| 162 | __CTA_EXPECT_MAX | 164 | __CTA_EXPECT_MAX |
| 163 | }; | 165 | }; |
| 164 | #define CTA_EXPECT_MAX (__CTA_EXPECT_MAX - 1) | 166 | #define CTA_EXPECT_MAX (__CTA_EXPECT_MAX - 1) |
diff --git a/include/linux/netfilter/x_tables.h b/include/linux/netfilter/x_tables.h index 812cb153cabb..84c7c928e9eb 100644 --- a/include/linux/netfilter/x_tables.h +++ b/include/linux/netfilter/x_tables.h | |||
| @@ -6,8 +6,7 @@ | |||
| 6 | #define XT_FUNCTION_MAXNAMELEN 30 | 6 | #define XT_FUNCTION_MAXNAMELEN 30 |
| 7 | #define XT_TABLE_MAXNAMELEN 32 | 7 | #define XT_TABLE_MAXNAMELEN 32 |
| 8 | 8 | ||
| 9 | struct xt_entry_match | 9 | struct xt_entry_match { |
| 10 | { | ||
| 11 | union { | 10 | union { |
| 12 | struct { | 11 | struct { |
| 13 | __u16 match_size; | 12 | __u16 match_size; |
| @@ -31,8 +30,7 @@ struct xt_entry_match | |||
| 31 | unsigned char data[0]; | 30 | unsigned char data[0]; |
| 32 | }; | 31 | }; |
| 33 | 32 | ||
| 34 | struct xt_entry_target | 33 | struct xt_entry_target { |
| 35 | { | ||
| 36 | union { | 34 | union { |
| 37 | struct { | 35 | struct { |
| 38 | __u16 target_size; | 36 | __u16 target_size; |
| @@ -64,16 +62,14 @@ struct xt_entry_target | |||
| 64 | }, \ | 62 | }, \ |
| 65 | } | 63 | } |
| 66 | 64 | ||
| 67 | struct xt_standard_target | 65 | struct xt_standard_target { |
| 68 | { | ||
| 69 | struct xt_entry_target target; | 66 | struct xt_entry_target target; |
| 70 | int verdict; | 67 | int verdict; |
| 71 | }; | 68 | }; |
| 72 | 69 | ||
| 73 | /* The argument to IPT_SO_GET_REVISION_*. Returns highest revision | 70 | /* The argument to IPT_SO_GET_REVISION_*. Returns highest revision |
| 74 | * kernel supports, if >= revision. */ | 71 | * kernel supports, if >= revision. */ |
| 75 | struct xt_get_revision | 72 | struct xt_get_revision { |
| 76 | { | ||
| 77 | char name[XT_FUNCTION_MAXNAMELEN-1]; | 73 | char name[XT_FUNCTION_MAXNAMELEN-1]; |
| 78 | 74 | ||
| 79 | __u8 revision; | 75 | __u8 revision; |
| @@ -90,16 +86,14 @@ struct xt_get_revision | |||
| 90 | * ip6t_entry and arpt_entry. This sucks, and it is a hack. It will be my | 86 | * ip6t_entry and arpt_entry. This sucks, and it is a hack. It will be my |
| 91 | * personal pleasure to remove it -HW | 87 | * personal pleasure to remove it -HW |
| 92 | */ | 88 | */ |
| 93 | struct _xt_align | 89 | struct _xt_align { |
| 94 | { | ||
| 95 | __u8 u8; | 90 | __u8 u8; |
| 96 | __u16 u16; | 91 | __u16 u16; |
| 97 | __u32 u32; | 92 | __u32 u32; |
| 98 | __u64 u64; | 93 | __u64 u64; |
| 99 | }; | 94 | }; |
| 100 | 95 | ||
| 101 | #define XT_ALIGN(s) (((s) + (__alignof__(struct _xt_align)-1)) \ | 96 | #define XT_ALIGN(s) ALIGN((s), __alignof__(struct _xt_align)) |
| 102 | & ~(__alignof__(struct _xt_align)-1)) | ||
| 103 | 97 | ||
| 104 | /* Standard return verdict, or do jump. */ | 98 | /* Standard return verdict, or do jump. */ |
| 105 | #define XT_STANDARD_TARGET "" | 99 | #define XT_STANDARD_TARGET "" |
| @@ -109,14 +103,12 @@ struct _xt_align | |||
| 109 | #define SET_COUNTER(c,b,p) do { (c).bcnt = (b); (c).pcnt = (p); } while(0) | 103 | #define SET_COUNTER(c,b,p) do { (c).bcnt = (b); (c).pcnt = (p); } while(0) |
| 110 | #define ADD_COUNTER(c,b,p) do { (c).bcnt += (b); (c).pcnt += (p); } while(0) | 104 | #define ADD_COUNTER(c,b,p) do { (c).bcnt += (b); (c).pcnt += (p); } while(0) |
| 111 | 105 | ||
| 112 | struct xt_counters | 106 | struct xt_counters { |
| 113 | { | ||
| 114 | __u64 pcnt, bcnt; /* Packet and byte counters */ | 107 | __u64 pcnt, bcnt; /* Packet and byte counters */ |
| 115 | }; | 108 | }; |
| 116 | 109 | ||
| 117 | /* The argument to IPT_SO_ADD_COUNTERS. */ | 110 | /* The argument to IPT_SO_ADD_COUNTERS. */ |
| 118 | struct xt_counters_info | 111 | struct xt_counters_info { |
| 119 | { | ||
| 120 | /* Which table. */ | 112 | /* Which table. */ |
| 121 | char name[XT_TABLE_MAXNAMELEN]; | 113 | char name[XT_TABLE_MAXNAMELEN]; |
| 122 | 114 | ||
| @@ -128,6 +120,7 @@ struct xt_counters_info | |||
| 128 | 120 | ||
| 129 | #define XT_INV_PROTO 0x40 /* Invert the sense of PROTO. */ | 121 | #define XT_INV_PROTO 0x40 /* Invert the sense of PROTO. */ |
| 130 | 122 | ||
| 123 | #ifndef __KERNEL__ | ||
| 131 | /* fn returns 0 to continue iteration */ | 124 | /* fn returns 0 to continue iteration */ |
| 132 | #define XT_MATCH_ITERATE(type, e, fn, args...) \ | 125 | #define XT_MATCH_ITERATE(type, e, fn, args...) \ |
| 133 | ({ \ | 126 | ({ \ |
| @@ -171,6 +164,22 @@ struct xt_counters_info | |||
| 171 | #define XT_ENTRY_ITERATE(type, entries, size, fn, args...) \ | 164 | #define XT_ENTRY_ITERATE(type, entries, size, fn, args...) \ |
| 172 | XT_ENTRY_ITERATE_CONTINUE(type, entries, size, 0, fn, args) | 165 | XT_ENTRY_ITERATE_CONTINUE(type, entries, size, 0, fn, args) |
| 173 | 166 | ||
| 167 | #endif /* !__KERNEL__ */ | ||
| 168 | |||
| 169 | /* pos is normally a struct ipt_entry/ip6t_entry/etc. */ | ||
| 170 | #define xt_entry_foreach(pos, ehead, esize) \ | ||
| 171 | for ((pos) = (typeof(pos))(ehead); \ | ||
| 172 | (pos) < (typeof(pos))((char *)(ehead) + (esize)); \ | ||
| 173 | (pos) = (typeof(pos))((char *)(pos) + (pos)->next_offset)) | ||
| 174 | |||
| 175 | /* can only be xt_entry_match, so no use of typeof here */ | ||
| 176 | #define xt_ematch_foreach(pos, entry) \ | ||
| 177 | for ((pos) = (struct xt_entry_match *)entry->elems; \ | ||
| 178 | (pos) < (struct xt_entry_match *)((char *)(entry) + \ | ||
| 179 | (entry)->target_offset); \ | ||
| 180 | (pos) = (struct xt_entry_match *)((char *)(pos) + \ | ||
| 181 | (pos)->u.match_size)) | ||
| 182 | |||
| 174 | #ifdef __KERNEL__ | 183 | #ifdef __KERNEL__ |
| 175 | 184 | ||
| 176 | #include <linux/netdevice.h> | 185 | #include <linux/netdevice.h> |
| @@ -212,6 +221,7 @@ struct xt_match_param { | |||
| 212 | * @hook_mask: via which hooks the new rule is reachable | 221 | * @hook_mask: via which hooks the new rule is reachable |
| 213 | */ | 222 | */ |
| 214 | struct xt_mtchk_param { | 223 | struct xt_mtchk_param { |
| 224 | struct net *net; | ||
| 215 | const char *table; | 225 | const char *table; |
| 216 | const void *entryinfo; | 226 | const void *entryinfo; |
| 217 | const struct xt_match *match; | 227 | const struct xt_match *match; |
| @@ -222,6 +232,7 @@ struct xt_mtchk_param { | |||
| 222 | 232 | ||
| 223 | /* Match destructor parameters */ | 233 | /* Match destructor parameters */ |
| 224 | struct xt_mtdtor_param { | 234 | struct xt_mtdtor_param { |
| 235 | struct net *net; | ||
| 225 | const struct xt_match *match; | 236 | const struct xt_match *match; |
| 226 | void *matchinfo; | 237 | void *matchinfo; |
| 227 | u_int8_t family; | 238 | u_int8_t family; |
| @@ -254,6 +265,7 @@ struct xt_target_param { | |||
| 254 | * Other fields see above. | 265 | * Other fields see above. |
| 255 | */ | 266 | */ |
| 256 | struct xt_tgchk_param { | 267 | struct xt_tgchk_param { |
| 268 | struct net *net; | ||
| 257 | const char *table; | 269 | const char *table; |
| 258 | const void *entryinfo; | 270 | const void *entryinfo; |
| 259 | const struct xt_target *target; | 271 | const struct xt_target *target; |
| @@ -264,13 +276,13 @@ struct xt_tgchk_param { | |||
| 264 | 276 | ||
| 265 | /* Target destructor parameters */ | 277 | /* Target destructor parameters */ |
| 266 | struct xt_tgdtor_param { | 278 | struct xt_tgdtor_param { |
| 279 | struct net *net; | ||
| 267 | const struct xt_target *target; | 280 | const struct xt_target *target; |
| 268 | void *targinfo; | 281 | void *targinfo; |
| 269 | u_int8_t family; | 282 | u_int8_t family; |
| 270 | }; | 283 | }; |
| 271 | 284 | ||
| 272 | struct xt_match | 285 | struct xt_match { |
| 273 | { | ||
| 274 | struct list_head list; | 286 | struct list_head list; |
| 275 | 287 | ||
| 276 | const char name[XT_FUNCTION_MAXNAMELEN-1]; | 288 | const char name[XT_FUNCTION_MAXNAMELEN-1]; |
| @@ -289,11 +301,11 @@ struct xt_match | |||
| 289 | 301 | ||
| 290 | /* Called when entry of this type deleted. */ | 302 | /* Called when entry of this type deleted. */ |
| 291 | void (*destroy)(const struct xt_mtdtor_param *); | 303 | void (*destroy)(const struct xt_mtdtor_param *); |
| 292 | 304 | #ifdef CONFIG_COMPAT | |
| 293 | /* Called when userspace align differs from kernel space one */ | 305 | /* Called when userspace align differs from kernel space one */ |
| 294 | void (*compat_from_user)(void *dst, void *src); | 306 | void (*compat_from_user)(void *dst, const void *src); |
| 295 | int (*compat_to_user)(void __user *dst, void *src); | 307 | int (*compat_to_user)(void __user *dst, const void *src); |
| 296 | 308 | #endif | |
| 297 | /* Set this to THIS_MODULE if you are a module, otherwise NULL */ | 309 | /* Set this to THIS_MODULE if you are a module, otherwise NULL */ |
| 298 | struct module *me; | 310 | struct module *me; |
| 299 | 311 | ||
| @@ -302,7 +314,9 @@ struct xt_match | |||
| 302 | 314 | ||
| 303 | const char *table; | 315 | const char *table; |
| 304 | unsigned int matchsize; | 316 | unsigned int matchsize; |
| 317 | #ifdef CONFIG_COMPAT | ||
| 305 | unsigned int compatsize; | 318 | unsigned int compatsize; |
| 319 | #endif | ||
| 306 | unsigned int hooks; | 320 | unsigned int hooks; |
| 307 | unsigned short proto; | 321 | unsigned short proto; |
| 308 | 322 | ||
| @@ -310,8 +324,7 @@ struct xt_match | |||
| 310 | }; | 324 | }; |
| 311 | 325 | ||
| 312 | /* Registration hooks for targets. */ | 326 | /* Registration hooks for targets. */ |
| 313 | struct xt_target | 327 | struct xt_target { |
| 314 | { | ||
| 315 | struct list_head list; | 328 | struct list_head list; |
| 316 | 329 | ||
| 317 | const char name[XT_FUNCTION_MAXNAMELEN-1]; | 330 | const char name[XT_FUNCTION_MAXNAMELEN-1]; |
| @@ -330,17 +343,19 @@ struct xt_target | |||
| 330 | 343 | ||
| 331 | /* Called when entry of this type deleted. */ | 344 | /* Called when entry of this type deleted. */ |
| 332 | void (*destroy)(const struct xt_tgdtor_param *); | 345 | void (*destroy)(const struct xt_tgdtor_param *); |
| 333 | 346 | #ifdef CONFIG_COMPAT | |
| 334 | /* Called when userspace align differs from kernel space one */ | 347 | /* Called when userspace align differs from kernel space one */ |
| 335 | void (*compat_from_user)(void *dst, void *src); | 348 | void (*compat_from_user)(void *dst, const void *src); |
| 336 | int (*compat_to_user)(void __user *dst, void *src); | 349 | int (*compat_to_user)(void __user *dst, const void *src); |
| 337 | 350 | #endif | |
| 338 | /* Set this to THIS_MODULE if you are a module, otherwise NULL */ | 351 | /* Set this to THIS_MODULE if you are a module, otherwise NULL */ |
| 339 | struct module *me; | 352 | struct module *me; |
| 340 | 353 | ||
| 341 | const char *table; | 354 | const char *table; |
| 342 | unsigned int targetsize; | 355 | unsigned int targetsize; |
| 356 | #ifdef CONFIG_COMPAT | ||
| 343 | unsigned int compatsize; | 357 | unsigned int compatsize; |
| 358 | #endif | ||
| 344 | unsigned int hooks; | 359 | unsigned int hooks; |
| 345 | unsigned short proto; | 360 | unsigned short proto; |
| 346 | 361 | ||
| @@ -349,8 +364,7 @@ struct xt_target | |||
| 349 | }; | 364 | }; |
| 350 | 365 | ||
| 351 | /* Furniture shopping... */ | 366 | /* Furniture shopping... */ |
| 352 | struct xt_table | 367 | struct xt_table { |
| 353 | { | ||
| 354 | struct list_head list; | 368 | struct list_head list; |
| 355 | 369 | ||
| 356 | /* What hooks you will enter on */ | 370 | /* What hooks you will enter on */ |
| @@ -363,6 +377,7 @@ struct xt_table | |||
| 363 | struct module *me; | 377 | struct module *me; |
| 364 | 378 | ||
| 365 | u_int8_t af; /* address/protocol family */ | 379 | u_int8_t af; /* address/protocol family */ |
| 380 | int priority; /* hook order */ | ||
| 366 | 381 | ||
| 367 | /* A unique name... */ | 382 | /* A unique name... */ |
| 368 | const char name[XT_TABLE_MAXNAMELEN]; | 383 | const char name[XT_TABLE_MAXNAMELEN]; |
| @@ -371,8 +386,7 @@ struct xt_table | |||
| 371 | #include <linux/netfilter_ipv4.h> | 386 | #include <linux/netfilter_ipv4.h> |
| 372 | 387 | ||
| 373 | /* The table itself */ | 388 | /* The table itself */ |
| 374 | struct xt_table_info | 389 | struct xt_table_info { |
| 375 | { | ||
| 376 | /* Size per table */ | 390 | /* Size per table */ |
| 377 | unsigned int size; | 391 | unsigned int size; |
| 378 | /* Number of entries: FIXME. --RR */ | 392 | /* Number of entries: FIXME. --RR */ |
| @@ -525,11 +539,13 @@ static inline unsigned long ifname_compare_aligned(const char *_a, | |||
| 525 | return ret; | 539 | return ret; |
| 526 | } | 540 | } |
| 527 | 541 | ||
| 542 | extern struct nf_hook_ops *xt_hook_link(const struct xt_table *, nf_hookfn *); | ||
| 543 | extern void xt_hook_unlink(const struct xt_table *, struct nf_hook_ops *); | ||
| 544 | |||
| 528 | #ifdef CONFIG_COMPAT | 545 | #ifdef CONFIG_COMPAT |
| 529 | #include <net/compat.h> | 546 | #include <net/compat.h> |
| 530 | 547 | ||
| 531 | struct compat_xt_entry_match | 548 | struct compat_xt_entry_match { |
| 532 | { | ||
| 533 | union { | 549 | union { |
| 534 | struct { | 550 | struct { |
| 535 | u_int16_t match_size; | 551 | u_int16_t match_size; |
| @@ -545,8 +561,7 @@ struct compat_xt_entry_match | |||
| 545 | unsigned char data[0]; | 561 | unsigned char data[0]; |
| 546 | }; | 562 | }; |
| 547 | 563 | ||
| 548 | struct compat_xt_entry_target | 564 | struct compat_xt_entry_target { |
| 549 | { | ||
| 550 | union { | 565 | union { |
| 551 | struct { | 566 | struct { |
| 552 | u_int16_t target_size; | 567 | u_int16_t target_size; |
| @@ -566,42 +581,42 @@ struct compat_xt_entry_target | |||
| 566 | * need to change whole approach in order to calculate align as function of | 581 | * need to change whole approach in order to calculate align as function of |
| 567 | * current task alignment */ | 582 | * current task alignment */ |
| 568 | 583 | ||
| 569 | struct compat_xt_counters | 584 | struct compat_xt_counters { |
| 570 | { | 585 | compat_u64 pcnt, bcnt; /* Packet and byte counters */ |
| 571 | #if defined(CONFIG_X86_64) || defined(CONFIG_IA64) | ||
| 572 | u_int32_t cnt[4]; | ||
| 573 | #else | ||
| 574 | u_int64_t cnt[2]; | ||
| 575 | #endif | ||
| 576 | }; | 586 | }; |
| 577 | 587 | ||
| 578 | struct compat_xt_counters_info | 588 | struct compat_xt_counters_info { |
| 579 | { | ||
| 580 | char name[XT_TABLE_MAXNAMELEN]; | 589 | char name[XT_TABLE_MAXNAMELEN]; |
| 581 | compat_uint_t num_counters; | 590 | compat_uint_t num_counters; |
| 582 | struct compat_xt_counters counters[0]; | 591 | struct compat_xt_counters counters[0]; |
| 583 | }; | 592 | }; |
| 584 | 593 | ||
| 585 | #define COMPAT_XT_ALIGN(s) (((s) + (__alignof__(struct compat_xt_counters)-1)) \ | 594 | struct _compat_xt_align { |
| 586 | & ~(__alignof__(struct compat_xt_counters)-1)) | 595 | __u8 u8; |
| 596 | __u16 u16; | ||
| 597 | __u32 u32; | ||
| 598 | compat_u64 u64; | ||
| 599 | }; | ||
| 600 | |||
| 601 | #define COMPAT_XT_ALIGN(s) ALIGN((s), __alignof__(struct _compat_xt_align)) | ||
| 587 | 602 | ||
| 588 | extern void xt_compat_lock(u_int8_t af); | 603 | extern void xt_compat_lock(u_int8_t af); |
| 589 | extern void xt_compat_unlock(u_int8_t af); | 604 | extern void xt_compat_unlock(u_int8_t af); |
| 590 | 605 | ||
| 591 | extern int xt_compat_add_offset(u_int8_t af, unsigned int offset, short delta); | 606 | extern int xt_compat_add_offset(u_int8_t af, unsigned int offset, short delta); |
| 592 | extern void xt_compat_flush_offsets(u_int8_t af); | 607 | extern void xt_compat_flush_offsets(u_int8_t af); |
| 593 | extern short xt_compat_calc_jump(u_int8_t af, unsigned int offset); | 608 | extern int xt_compat_calc_jump(u_int8_t af, unsigned int offset); |
| 594 | 609 | ||
| 595 | extern int xt_compat_match_offset(const struct xt_match *match); | 610 | extern int xt_compat_match_offset(const struct xt_match *match); |
| 596 | extern int xt_compat_match_from_user(struct xt_entry_match *m, | 611 | extern int xt_compat_match_from_user(struct xt_entry_match *m, |
| 597 | void **dstptr, unsigned int *size); | 612 | void **dstptr, unsigned int *size); |
| 598 | extern int xt_compat_match_to_user(struct xt_entry_match *m, | 613 | extern int xt_compat_match_to_user(const struct xt_entry_match *m, |
| 599 | void __user **dstptr, unsigned int *size); | 614 | void __user **dstptr, unsigned int *size); |
| 600 | 615 | ||
| 601 | extern int xt_compat_target_offset(const struct xt_target *target); | 616 | extern int xt_compat_target_offset(const struct xt_target *target); |
| 602 | extern void xt_compat_target_from_user(struct xt_entry_target *t, | 617 | extern void xt_compat_target_from_user(struct xt_entry_target *t, |
| 603 | void **dstptr, unsigned int *size); | 618 | void **dstptr, unsigned int *size); |
| 604 | extern int xt_compat_target_to_user(struct xt_entry_target *t, | 619 | extern int xt_compat_target_to_user(const struct xt_entry_target *t, |
| 605 | void __user **dstptr, unsigned int *size); | 620 | void __user **dstptr, unsigned int *size); |
| 606 | 621 | ||
| 607 | #endif /* CONFIG_COMPAT */ | 622 | #endif /* CONFIG_COMPAT */ |
diff --git a/include/linux/netfilter/xt_CT.h b/include/linux/netfilter/xt_CT.h new file mode 100644 index 000000000000..1b564106891d --- /dev/null +++ b/include/linux/netfilter/xt_CT.h | |||
| @@ -0,0 +1,17 @@ | |||
| 1 | #ifndef _XT_CT_H | ||
| 2 | #define _XT_CT_H | ||
| 3 | |||
| 4 | #define XT_CT_NOTRACK 0x1 | ||
| 5 | |||
| 6 | struct xt_ct_target_info { | ||
| 7 | u_int16_t flags; | ||
| 8 | u_int16_t zone; | ||
| 9 | u_int32_t ct_events; | ||
| 10 | u_int32_t exp_events; | ||
| 11 | char helper[16]; | ||
| 12 | |||
| 13 | /* Used internally by the kernel */ | ||
| 14 | struct nf_conn *ct __attribute__((aligned(8))); | ||
| 15 | }; | ||
| 16 | |||
| 17 | #endif /* _XT_CT_H */ | ||
diff --git a/include/linux/netfilter/xt_connbytes.h b/include/linux/netfilter/xt_connbytes.h index 52bd6153b996..92fcbb0d193e 100644 --- a/include/linux/netfilter/xt_connbytes.h +++ b/include/linux/netfilter/xt_connbytes.h | |||
| @@ -15,8 +15,7 @@ enum xt_connbytes_direction { | |||
| 15 | XT_CONNBYTES_DIR_BOTH, | 15 | XT_CONNBYTES_DIR_BOTH, |
| 16 | }; | 16 | }; |
| 17 | 17 | ||
| 18 | struct xt_connbytes_info | 18 | struct xt_connbytes_info { |
| 19 | { | ||
| 20 | struct { | 19 | struct { |
| 21 | aligned_u64 from; /* count to be matched */ | 20 | aligned_u64 from; /* count to be matched */ |
| 22 | aligned_u64 to; /* count to be matched */ | 21 | aligned_u64 to; /* count to be matched */ |
diff --git a/include/linux/netfilter/xt_esp.h b/include/linux/netfilter/xt_esp.h index ef6fa4747d0a..ee6882408000 100644 --- a/include/linux/netfilter/xt_esp.h +++ b/include/linux/netfilter/xt_esp.h | |||
| @@ -3,8 +3,7 @@ | |||
| 3 | 3 | ||
| 4 | #include <linux/types.h> | 4 | #include <linux/types.h> |
| 5 | 5 | ||
| 6 | struct xt_esp | 6 | struct xt_esp { |
| 7 | { | ||
| 8 | __u32 spis[2]; /* Security Parameter Index */ | 7 | __u32 spis[2]; /* Security Parameter Index */ |
| 9 | __u8 invflags; /* Inverse flags */ | 8 | __u8 invflags; /* Inverse flags */ |
| 10 | }; | 9 | }; |
diff --git a/include/linux/netfilter/xt_multiport.h b/include/linux/netfilter/xt_multiport.h index 185db499fcbc..5b7e72dfffc5 100644 --- a/include/linux/netfilter/xt_multiport.h +++ b/include/linux/netfilter/xt_multiport.h | |||
| @@ -3,8 +3,7 @@ | |||
| 3 | 3 | ||
| 4 | #include <linux/types.h> | 4 | #include <linux/types.h> |
| 5 | 5 | ||
| 6 | enum xt_multiport_flags | 6 | enum xt_multiport_flags { |
| 7 | { | ||
| 8 | XT_MULTIPORT_SOURCE, | 7 | XT_MULTIPORT_SOURCE, |
| 9 | XT_MULTIPORT_DESTINATION, | 8 | XT_MULTIPORT_DESTINATION, |
| 10 | XT_MULTIPORT_EITHER | 9 | XT_MULTIPORT_EITHER |
| @@ -13,15 +12,13 @@ enum xt_multiport_flags | |||
| 13 | #define XT_MULTI_PORTS 15 | 12 | #define XT_MULTI_PORTS 15 |
| 14 | 13 | ||
| 15 | /* Must fit inside union xt_matchinfo: 16 bytes */ | 14 | /* Must fit inside union xt_matchinfo: 16 bytes */ |
| 16 | struct xt_multiport | 15 | struct xt_multiport { |
| 17 | { | ||
| 18 | __u8 flags; /* Type of comparison */ | 16 | __u8 flags; /* Type of comparison */ |
| 19 | __u8 count; /* Number of ports */ | 17 | __u8 count; /* Number of ports */ |
| 20 | __u16 ports[XT_MULTI_PORTS]; /* Ports */ | 18 | __u16 ports[XT_MULTI_PORTS]; /* Ports */ |
| 21 | }; | 19 | }; |
| 22 | 20 | ||
| 23 | struct xt_multiport_v1 | 21 | struct xt_multiport_v1 { |
| 24 | { | ||
| 25 | __u8 flags; /* Type of comparison */ | 22 | __u8 flags; /* Type of comparison */ |
| 26 | __u8 count; /* Number of ports */ | 23 | __u8 count; /* Number of ports */ |
| 27 | __u16 ports[XT_MULTI_PORTS]; /* Ports */ | 24 | __u16 ports[XT_MULTI_PORTS]; /* Ports */ |
diff --git a/include/linux/netfilter/xt_policy.h b/include/linux/netfilter/xt_policy.h index 7bb64e7c853d..be8ead05c316 100644 --- a/include/linux/netfilter/xt_policy.h +++ b/include/linux/netfilter/xt_policy.h | |||
| @@ -5,22 +5,19 @@ | |||
| 5 | 5 | ||
| 6 | #define XT_POLICY_MAX_ELEM 4 | 6 | #define XT_POLICY_MAX_ELEM 4 |
| 7 | 7 | ||
| 8 | enum xt_policy_flags | 8 | enum xt_policy_flags { |
| 9 | { | ||
| 10 | XT_POLICY_MATCH_IN = 0x1, | 9 | XT_POLICY_MATCH_IN = 0x1, |
| 11 | XT_POLICY_MATCH_OUT = 0x2, | 10 | XT_POLICY_MATCH_OUT = 0x2, |
| 12 | XT_POLICY_MATCH_NONE = 0x4, | 11 | XT_POLICY_MATCH_NONE = 0x4, |
| 13 | XT_POLICY_MATCH_STRICT = 0x8, | 12 | XT_POLICY_MATCH_STRICT = 0x8, |
| 14 | }; | 13 | }; |
| 15 | 14 | ||
| 16 | enum xt_policy_modes | 15 | enum xt_policy_modes { |
| 17 | { | ||
| 18 | XT_POLICY_MODE_TRANSPORT, | 16 | XT_POLICY_MODE_TRANSPORT, |
| 19 | XT_POLICY_MODE_TUNNEL | 17 | XT_POLICY_MODE_TUNNEL |
| 20 | }; | 18 | }; |
| 21 | 19 | ||
| 22 | struct xt_policy_spec | 20 | struct xt_policy_spec { |
| 23 | { | ||
| 24 | __u8 saddr:1, | 21 | __u8 saddr:1, |
| 25 | daddr:1, | 22 | daddr:1, |
| 26 | proto:1, | 23 | proto:1, |
| @@ -30,15 +27,13 @@ struct xt_policy_spec | |||
| 30 | }; | 27 | }; |
| 31 | 28 | ||
| 32 | #ifndef __KERNEL__ | 29 | #ifndef __KERNEL__ |
| 33 | union xt_policy_addr | 30 | union xt_policy_addr { |
| 34 | { | ||
| 35 | struct in_addr a4; | 31 | struct in_addr a4; |
| 36 | struct in6_addr a6; | 32 | struct in6_addr a6; |
| 37 | }; | 33 | }; |
| 38 | #endif | 34 | #endif |
| 39 | 35 | ||
| 40 | struct xt_policy_elem | 36 | struct xt_policy_elem { |
| 41 | { | ||
| 42 | union { | 37 | union { |
| 43 | #ifdef __KERNEL__ | 38 | #ifdef __KERNEL__ |
| 44 | struct { | 39 | struct { |
| @@ -65,8 +60,7 @@ struct xt_policy_elem | |||
| 65 | struct xt_policy_spec invert; | 60 | struct xt_policy_spec invert; |
| 66 | }; | 61 | }; |
| 67 | 62 | ||
| 68 | struct xt_policy_info | 63 | struct xt_policy_info { |
| 69 | { | ||
| 70 | struct xt_policy_elem pol[XT_POLICY_MAX_ELEM]; | 64 | struct xt_policy_elem pol[XT_POLICY_MAX_ELEM]; |
| 71 | __u16 flags; | 65 | __u16 flags; |
| 72 | __u16 len; | 66 | __u16 len; |
diff --git a/include/linux/netfilter/xt_state.h b/include/linux/netfilter/xt_state.h index c06f32edee07..7b32de886613 100644 --- a/include/linux/netfilter/xt_state.h +++ b/include/linux/netfilter/xt_state.h | |||
| @@ -6,8 +6,7 @@ | |||
| 6 | 6 | ||
| 7 | #define XT_STATE_UNTRACKED (1 << (IP_CT_NUMBER + 1)) | 7 | #define XT_STATE_UNTRACKED (1 << (IP_CT_NUMBER + 1)) |
| 8 | 8 | ||
| 9 | struct xt_state_info | 9 | struct xt_state_info { |
| 10 | { | ||
| 11 | unsigned int statemask; | 10 | unsigned int statemask; |
| 12 | }; | 11 | }; |
| 13 | #endif /*_XT_STATE_H*/ | 12 | #endif /*_XT_STATE_H*/ |
diff --git a/include/linux/netfilter/xt_string.h b/include/linux/netfilter/xt_string.h index ecbb95fc89ed..235347c02eab 100644 --- a/include/linux/netfilter/xt_string.h +++ b/include/linux/netfilter/xt_string.h | |||
| @@ -11,8 +11,7 @@ enum { | |||
| 11 | XT_STRING_FLAG_IGNORECASE = 0x02 | 11 | XT_STRING_FLAG_IGNORECASE = 0x02 |
| 12 | }; | 12 | }; |
| 13 | 13 | ||
| 14 | struct xt_string_info | 14 | struct xt_string_info { |
| 15 | { | ||
| 16 | __u16 from_offset; | 15 | __u16 from_offset; |
| 17 | __u16 to_offset; | 16 | __u16 to_offset; |
| 18 | char algo[XT_STRING_MAX_ALGO_NAME_SIZE]; | 17 | char algo[XT_STRING_MAX_ALGO_NAME_SIZE]; |
diff --git a/include/linux/netfilter/xt_tcpudp.h b/include/linux/netfilter/xt_tcpudp.h index a490a0bc1d29..38aa7b399021 100644 --- a/include/linux/netfilter/xt_tcpudp.h +++ b/include/linux/netfilter/xt_tcpudp.h | |||
| @@ -4,8 +4,7 @@ | |||
| 4 | #include <linux/types.h> | 4 | #include <linux/types.h> |
| 5 | 5 | ||
| 6 | /* TCP matching stuff */ | 6 | /* TCP matching stuff */ |
| 7 | struct xt_tcp | 7 | struct xt_tcp { |
| 8 | { | ||
| 9 | __u16 spts[2]; /* Source port range. */ | 8 | __u16 spts[2]; /* Source port range. */ |
| 10 | __u16 dpts[2]; /* Destination port range. */ | 9 | __u16 dpts[2]; /* Destination port range. */ |
| 11 | __u8 option; /* TCP Option iff non-zero*/ | 10 | __u8 option; /* TCP Option iff non-zero*/ |
| @@ -22,8 +21,7 @@ struct xt_tcp | |||
| 22 | #define XT_TCP_INV_MASK 0x0F /* All possible flags. */ | 21 | #define XT_TCP_INV_MASK 0x0F /* All possible flags. */ |
| 23 | 22 | ||
| 24 | /* UDP matching stuff */ | 23 | /* UDP matching stuff */ |
| 25 | struct xt_udp | 24 | struct xt_udp { |
| 26 | { | ||
| 27 | __u16 spts[2]; /* Source port range. */ | 25 | __u16 spts[2]; /* Source port range. */ |
| 28 | __u16 dpts[2]; /* Destination port range. */ | 26 | __u16 dpts[2]; /* Destination port range. */ |
| 29 | __u8 invflags; /* Inverse flags */ | 27 | __u8 invflags; /* Inverse flags */ |
diff --git a/include/linux/netfilter_arp/arp_tables.h b/include/linux/netfilter_arp/arp_tables.h index 6fe3e6aa10db..e9948c0560f6 100644 --- a/include/linux/netfilter_arp/arp_tables.h +++ b/include/linux/netfilter_arp/arp_tables.h | |||
| @@ -132,8 +132,7 @@ struct arpt_entry | |||
| 132 | #define ARPT_RETURN XT_RETURN | 132 | #define ARPT_RETURN XT_RETURN |
| 133 | 133 | ||
| 134 | /* The argument to ARPT_SO_GET_INFO */ | 134 | /* The argument to ARPT_SO_GET_INFO */ |
| 135 | struct arpt_getinfo | 135 | struct arpt_getinfo { |
| 136 | { | ||
| 137 | /* Which table: caller fills this in. */ | 136 | /* Which table: caller fills this in. */ |
| 138 | char name[ARPT_TABLE_MAXNAMELEN]; | 137 | char name[ARPT_TABLE_MAXNAMELEN]; |
| 139 | 138 | ||
| @@ -155,8 +154,7 @@ struct arpt_getinfo | |||
| 155 | }; | 154 | }; |
| 156 | 155 | ||
| 157 | /* The argument to ARPT_SO_SET_REPLACE. */ | 156 | /* The argument to ARPT_SO_SET_REPLACE. */ |
| 158 | struct arpt_replace | 157 | struct arpt_replace { |
| 159 | { | ||
| 160 | /* Which table. */ | 158 | /* Which table. */ |
| 161 | char name[ARPT_TABLE_MAXNAMELEN]; | 159 | char name[ARPT_TABLE_MAXNAMELEN]; |
| 162 | 160 | ||
| @@ -191,8 +189,7 @@ struct arpt_replace | |||
| 191 | #define arpt_counters xt_counters | 189 | #define arpt_counters xt_counters |
| 192 | 190 | ||
| 193 | /* The argument to ARPT_SO_GET_ENTRIES. */ | 191 | /* The argument to ARPT_SO_GET_ENTRIES. */ |
| 194 | struct arpt_get_entries | 192 | struct arpt_get_entries { |
| 195 | { | ||
| 196 | /* Which table: user fills this in. */ | 193 | /* Which table: user fills this in. */ |
| 197 | char name[ARPT_TABLE_MAXNAMELEN]; | 194 | char name[ARPT_TABLE_MAXNAMELEN]; |
| 198 | 195 | ||
| @@ -214,9 +211,11 @@ static __inline__ struct arpt_entry_target *arpt_get_target(struct arpt_entry *e | |||
| 214 | return (void *)e + e->target_offset; | 211 | return (void *)e + e->target_offset; |
| 215 | } | 212 | } |
| 216 | 213 | ||
| 214 | #ifndef __KERNEL__ | ||
| 217 | /* fn returns 0 to continue iteration */ | 215 | /* fn returns 0 to continue iteration */ |
| 218 | #define ARPT_ENTRY_ITERATE(entries, size, fn, args...) \ | 216 | #define ARPT_ENTRY_ITERATE(entries, size, fn, args...) \ |
| 219 | XT_ENTRY_ITERATE(struct arpt_entry, entries, size, fn, ## args) | 217 | XT_ENTRY_ITERATE(struct arpt_entry, entries, size, fn, ## args) |
| 218 | #endif | ||
| 220 | 219 | ||
| 221 | /* | 220 | /* |
| 222 | * Main firewall chains definitions and global var's definitions. | 221 | * Main firewall chains definitions and global var's definitions. |
| @@ -224,20 +223,17 @@ static __inline__ struct arpt_entry_target *arpt_get_target(struct arpt_entry *e | |||
| 224 | #ifdef __KERNEL__ | 223 | #ifdef __KERNEL__ |
| 225 | 224 | ||
| 226 | /* Standard entry. */ | 225 | /* Standard entry. */ |
| 227 | struct arpt_standard | 226 | struct arpt_standard { |
| 228 | { | ||
| 229 | struct arpt_entry entry; | 227 | struct arpt_entry entry; |
| 230 | struct arpt_standard_target target; | 228 | struct arpt_standard_target target; |
| 231 | }; | 229 | }; |
| 232 | 230 | ||
| 233 | struct arpt_error_target | 231 | struct arpt_error_target { |
| 234 | { | ||
| 235 | struct arpt_entry_target target; | 232 | struct arpt_entry_target target; |
| 236 | char errorname[ARPT_FUNCTION_MAXNAMELEN]; | 233 | char errorname[ARPT_FUNCTION_MAXNAMELEN]; |
| 237 | }; | 234 | }; |
| 238 | 235 | ||
| 239 | struct arpt_error | 236 | struct arpt_error { |
| 240 | { | ||
| 241 | struct arpt_entry entry; | 237 | struct arpt_entry entry; |
| 242 | struct arpt_error_target target; | 238 | struct arpt_error_target target; |
| 243 | }; | 239 | }; |
| @@ -264,6 +260,7 @@ struct arpt_error | |||
| 264 | .target.errorname = "ERROR", \ | 260 | .target.errorname = "ERROR", \ |
| 265 | } | 261 | } |
| 266 | 262 | ||
| 263 | extern void *arpt_alloc_initial_table(const struct xt_table *); | ||
| 267 | extern struct xt_table *arpt_register_table(struct net *net, | 264 | extern struct xt_table *arpt_register_table(struct net *net, |
| 268 | const struct xt_table *table, | 265 | const struct xt_table *table, |
| 269 | const struct arpt_replace *repl); | 266 | const struct arpt_replace *repl); |
| @@ -279,8 +276,7 @@ extern unsigned int arpt_do_table(struct sk_buff *skb, | |||
| 279 | #ifdef CONFIG_COMPAT | 276 | #ifdef CONFIG_COMPAT |
| 280 | #include <net/compat.h> | 277 | #include <net/compat.h> |
| 281 | 278 | ||
| 282 | struct compat_arpt_entry | 279 | struct compat_arpt_entry { |
| 283 | { | ||
| 284 | struct arpt_arp arp; | 280 | struct arpt_arp arp; |
| 285 | u_int16_t target_offset; | 281 | u_int16_t target_offset; |
| 286 | u_int16_t next_offset; | 282 | u_int16_t next_offset; |
| @@ -297,14 +293,6 @@ compat_arpt_get_target(struct compat_arpt_entry *e) | |||
| 297 | 293 | ||
| 298 | #define COMPAT_ARPT_ALIGN(s) COMPAT_XT_ALIGN(s) | 294 | #define COMPAT_ARPT_ALIGN(s) COMPAT_XT_ALIGN(s) |
| 299 | 295 | ||
| 300 | /* fn returns 0 to continue iteration */ | ||
| 301 | #define COMPAT_ARPT_ENTRY_ITERATE(entries, size, fn, args...) \ | ||
| 302 | XT_ENTRY_ITERATE(struct compat_arpt_entry, entries, size, fn, ## args) | ||
| 303 | |||
| 304 | #define COMPAT_ARPT_ENTRY_ITERATE_CONTINUE(entries, size, n, fn, args...) \ | ||
| 305 | XT_ENTRY_ITERATE_CONTINUE(struct compat_arpt_entry, entries, size, n, \ | ||
| 306 | fn, ## args) | ||
| 307 | |||
| 308 | #endif /* CONFIG_COMPAT */ | 296 | #endif /* CONFIG_COMPAT */ |
| 309 | #endif /*__KERNEL__*/ | 297 | #endif /*__KERNEL__*/ |
| 310 | #endif /* _ARPTABLES_H */ | 298 | #endif /* _ARPTABLES_H */ |
diff --git a/include/linux/netfilter_bridge/ebt_802_3.h b/include/linux/netfilter_bridge/ebt_802_3.h index a11b0c2017fd..c73ef0b18bdc 100644 --- a/include/linux/netfilter_bridge/ebt_802_3.h +++ b/include/linux/netfilter_bridge/ebt_802_3.h | |||
| @@ -58,8 +58,7 @@ static inline struct ebt_802_3_hdr *ebt_802_3_hdr(const struct sk_buff *skb) | |||
| 58 | } | 58 | } |
| 59 | #endif | 59 | #endif |
| 60 | 60 | ||
| 61 | struct ebt_802_3_info | 61 | struct ebt_802_3_info { |
| 62 | { | ||
| 63 | uint8_t sap; | 62 | uint8_t sap; |
| 64 | __be16 type; | 63 | __be16 type; |
| 65 | uint8_t bitmask; | 64 | uint8_t bitmask; |
diff --git a/include/linux/netfilter_bridge/ebt_among.h b/include/linux/netfilter_bridge/ebt_among.h index 7654069233ca..0009558609a7 100644 --- a/include/linux/netfilter_bridge/ebt_among.h +++ b/include/linux/netfilter_bridge/ebt_among.h | |||
| @@ -29,14 +29,12 @@ | |||
| 29 | * Yes, it is a memory overhead, but in 2003 AD, who cares? | 29 | * Yes, it is a memory overhead, but in 2003 AD, who cares? |
| 30 | */ | 30 | */ |
| 31 | 31 | ||
| 32 | struct ebt_mac_wormhash_tuple | 32 | struct ebt_mac_wormhash_tuple { |
| 33 | { | ||
| 34 | uint32_t cmp[2]; | 33 | uint32_t cmp[2]; |
| 35 | __be32 ip; | 34 | __be32 ip; |
| 36 | }; | 35 | }; |
| 37 | 36 | ||
| 38 | struct ebt_mac_wormhash | 37 | struct ebt_mac_wormhash { |
| 39 | { | ||
| 40 | int table[257]; | 38 | int table[257]; |
| 41 | int poolsize; | 39 | int poolsize; |
| 42 | struct ebt_mac_wormhash_tuple pool[0]; | 40 | struct ebt_mac_wormhash_tuple pool[0]; |
| @@ -45,8 +43,7 @@ struct ebt_mac_wormhash | |||
| 45 | #define ebt_mac_wormhash_size(x) ((x) ? sizeof(struct ebt_mac_wormhash) \ | 43 | #define ebt_mac_wormhash_size(x) ((x) ? sizeof(struct ebt_mac_wormhash) \ |
| 46 | + (x)->poolsize * sizeof(struct ebt_mac_wormhash_tuple) : 0) | 44 | + (x)->poolsize * sizeof(struct ebt_mac_wormhash_tuple) : 0) |
| 47 | 45 | ||
| 48 | struct ebt_among_info | 46 | struct ebt_among_info { |
| 49 | { | ||
| 50 | int wh_dst_ofs; | 47 | int wh_dst_ofs; |
| 51 | int wh_src_ofs; | 48 | int wh_src_ofs; |
| 52 | int bitmask; | 49 | int bitmask; |
diff --git a/include/linux/netfilter_bridge/ebt_arpreply.h b/include/linux/netfilter_bridge/ebt_arpreply.h index 96a8339960e0..7e77896e1fbf 100644 --- a/include/linux/netfilter_bridge/ebt_arpreply.h +++ b/include/linux/netfilter_bridge/ebt_arpreply.h | |||
| @@ -1,8 +1,7 @@ | |||
| 1 | #ifndef __LINUX_BRIDGE_EBT_ARPREPLY_H | 1 | #ifndef __LINUX_BRIDGE_EBT_ARPREPLY_H |
| 2 | #define __LINUX_BRIDGE_EBT_ARPREPLY_H | 2 | #define __LINUX_BRIDGE_EBT_ARPREPLY_H |
| 3 | 3 | ||
| 4 | struct ebt_arpreply_info | 4 | struct ebt_arpreply_info { |
| 5 | { | ||
| 6 | unsigned char mac[ETH_ALEN]; | 5 | unsigned char mac[ETH_ALEN]; |
| 7 | int target; | 6 | int target; |
| 8 | }; | 7 | }; |
diff --git a/include/linux/netfilter_bridge/ebt_ip.h b/include/linux/netfilter_bridge/ebt_ip.h index d6847475bf2e..6a708fb92241 100644 --- a/include/linux/netfilter_bridge/ebt_ip.h +++ b/include/linux/netfilter_bridge/ebt_ip.h | |||
| @@ -26,8 +26,7 @@ | |||
| 26 | #define EBT_IP_MATCH "ip" | 26 | #define EBT_IP_MATCH "ip" |
| 27 | 27 | ||
| 28 | /* the same values are used for the invflags */ | 28 | /* the same values are used for the invflags */ |
| 29 | struct ebt_ip_info | 29 | struct ebt_ip_info { |
| 30 | { | ||
| 31 | __be32 saddr; | 30 | __be32 saddr; |
| 32 | __be32 daddr; | 31 | __be32 daddr; |
| 33 | __be32 smsk; | 32 | __be32 smsk; |
diff --git a/include/linux/netfilter_bridge/ebt_ip6.h b/include/linux/netfilter_bridge/ebt_ip6.h index 2273c3ae33ca..e5de98701519 100644 --- a/include/linux/netfilter_bridge/ebt_ip6.h +++ b/include/linux/netfilter_bridge/ebt_ip6.h | |||
| @@ -23,8 +23,7 @@ | |||
| 23 | #define EBT_IP6_MATCH "ip6" | 23 | #define EBT_IP6_MATCH "ip6" |
| 24 | 24 | ||
| 25 | /* the same values are used for the invflags */ | 25 | /* the same values are used for the invflags */ |
| 26 | struct ebt_ip6_info | 26 | struct ebt_ip6_info { |
| 27 | { | ||
| 28 | struct in6_addr saddr; | 27 | struct in6_addr saddr; |
| 29 | struct in6_addr daddr; | 28 | struct in6_addr daddr; |
| 30 | struct in6_addr smsk; | 29 | struct in6_addr smsk; |
diff --git a/include/linux/netfilter_bridge/ebt_limit.h b/include/linux/netfilter_bridge/ebt_limit.h index d8b65000afe4..4bf76b751676 100644 --- a/include/linux/netfilter_bridge/ebt_limit.h +++ b/include/linux/netfilter_bridge/ebt_limit.h | |||
| @@ -9,8 +9,7 @@ | |||
| 9 | /* 1/10,000 sec period => max of 10,000/sec. Min rate is then 429490 | 9 | /* 1/10,000 sec period => max of 10,000/sec. Min rate is then 429490 |
| 10 | seconds, or one every 59 hours. */ | 10 | seconds, or one every 59 hours. */ |
| 11 | 11 | ||
| 12 | struct ebt_limit_info | 12 | struct ebt_limit_info { |
| 13 | { | ||
| 14 | u_int32_t avg; /* Average secs between packets * scale */ | 13 | u_int32_t avg; /* Average secs between packets * scale */ |
| 15 | u_int32_t burst; /* Period multiplier for upper limit. */ | 14 | u_int32_t burst; /* Period multiplier for upper limit. */ |
| 16 | 15 | ||
diff --git a/include/linux/netfilter_bridge/ebt_log.h b/include/linux/netfilter_bridge/ebt_log.h index b76e653157e5..cc2cdfb764bc 100644 --- a/include/linux/netfilter_bridge/ebt_log.h +++ b/include/linux/netfilter_bridge/ebt_log.h | |||
| @@ -9,8 +9,7 @@ | |||
| 9 | #define EBT_LOG_PREFIX_SIZE 30 | 9 | #define EBT_LOG_PREFIX_SIZE 30 |
| 10 | #define EBT_LOG_WATCHER "log" | 10 | #define EBT_LOG_WATCHER "log" |
| 11 | 11 | ||
| 12 | struct ebt_log_info | 12 | struct ebt_log_info { |
| 13 | { | ||
| 14 | uint8_t loglevel; | 13 | uint8_t loglevel; |
| 15 | uint8_t prefix[EBT_LOG_PREFIX_SIZE]; | 14 | uint8_t prefix[EBT_LOG_PREFIX_SIZE]; |
| 16 | uint32_t bitmask; | 15 | uint32_t bitmask; |
diff --git a/include/linux/netfilter_bridge/ebt_mark_m.h b/include/linux/netfilter_bridge/ebt_mark_m.h index 301524ff1065..9ceb10ec0ed6 100644 --- a/include/linux/netfilter_bridge/ebt_mark_m.h +++ b/include/linux/netfilter_bridge/ebt_mark_m.h | |||
| @@ -4,8 +4,7 @@ | |||
| 4 | #define EBT_MARK_AND 0x01 | 4 | #define EBT_MARK_AND 0x01 |
| 5 | #define EBT_MARK_OR 0x02 | 5 | #define EBT_MARK_OR 0x02 |
| 6 | #define EBT_MARK_MASK (EBT_MARK_AND | EBT_MARK_OR) | 6 | #define EBT_MARK_MASK (EBT_MARK_AND | EBT_MARK_OR) |
| 7 | struct ebt_mark_m_info | 7 | struct ebt_mark_m_info { |
| 8 | { | ||
| 9 | unsigned long mark, mask; | 8 | unsigned long mark, mask; |
| 10 | uint8_t invert; | 9 | uint8_t invert; |
| 11 | uint8_t bitmask; | 10 | uint8_t bitmask; |
diff --git a/include/linux/netfilter_bridge/ebt_mark_t.h b/include/linux/netfilter_bridge/ebt_mark_t.h index 6270f6f33693..7d5a268a4311 100644 --- a/include/linux/netfilter_bridge/ebt_mark_t.h +++ b/include/linux/netfilter_bridge/ebt_mark_t.h | |||
| @@ -13,8 +13,7 @@ | |||
| 13 | #define MARK_AND_VALUE (0xffffffd0) | 13 | #define MARK_AND_VALUE (0xffffffd0) |
| 14 | #define MARK_XOR_VALUE (0xffffffc0) | 14 | #define MARK_XOR_VALUE (0xffffffc0) |
| 15 | 15 | ||
| 16 | struct ebt_mark_t_info | 16 | struct ebt_mark_t_info { |
| 17 | { | ||
| 18 | unsigned long mark; | 17 | unsigned long mark; |
| 19 | /* EBT_ACCEPT, EBT_DROP, EBT_CONTINUE or EBT_RETURN */ | 18 | /* EBT_ACCEPT, EBT_DROP, EBT_CONTINUE or EBT_RETURN */ |
| 20 | int target; | 19 | int target; |
diff --git a/include/linux/netfilter_bridge/ebt_nat.h b/include/linux/netfilter_bridge/ebt_nat.h index 435b886a51aa..5e74e3b03bd6 100644 --- a/include/linux/netfilter_bridge/ebt_nat.h +++ b/include/linux/netfilter_bridge/ebt_nat.h | |||
| @@ -2,8 +2,7 @@ | |||
| 2 | #define __LINUX_BRIDGE_EBT_NAT_H | 2 | #define __LINUX_BRIDGE_EBT_NAT_H |
| 3 | 3 | ||
| 4 | #define NAT_ARP_BIT (0x00000010) | 4 | #define NAT_ARP_BIT (0x00000010) |
| 5 | struct ebt_nat_info | 5 | struct ebt_nat_info { |
| 6 | { | ||
| 7 | unsigned char mac[ETH_ALEN]; | 6 | unsigned char mac[ETH_ALEN]; |
| 8 | /* EBT_ACCEPT, EBT_DROP, EBT_CONTINUE or EBT_RETURN */ | 7 | /* EBT_ACCEPT, EBT_DROP, EBT_CONTINUE or EBT_RETURN */ |
| 9 | int target; | 8 | int target; |
diff --git a/include/linux/netfilter_bridge/ebt_pkttype.h b/include/linux/netfilter_bridge/ebt_pkttype.h index 0d64bbb29c66..51a799840931 100644 --- a/include/linux/netfilter_bridge/ebt_pkttype.h +++ b/include/linux/netfilter_bridge/ebt_pkttype.h | |||
| @@ -1,8 +1,7 @@ | |||
| 1 | #ifndef __LINUX_BRIDGE_EBT_PKTTYPE_H | 1 | #ifndef __LINUX_BRIDGE_EBT_PKTTYPE_H |
| 2 | #define __LINUX_BRIDGE_EBT_PKTTYPE_H | 2 | #define __LINUX_BRIDGE_EBT_PKTTYPE_H |
| 3 | 3 | ||
| 4 | struct ebt_pkttype_info | 4 | struct ebt_pkttype_info { |
| 5 | { | ||
| 6 | uint8_t pkt_type; | 5 | uint8_t pkt_type; |
| 7 | uint8_t invert; | 6 | uint8_t invert; |
| 8 | }; | 7 | }; |
diff --git a/include/linux/netfilter_bridge/ebt_redirect.h b/include/linux/netfilter_bridge/ebt_redirect.h index 5c67990fce39..dd9622ce8488 100644 --- a/include/linux/netfilter_bridge/ebt_redirect.h +++ b/include/linux/netfilter_bridge/ebt_redirect.h | |||
| @@ -1,8 +1,7 @@ | |||
| 1 | #ifndef __LINUX_BRIDGE_EBT_REDIRECT_H | 1 | #ifndef __LINUX_BRIDGE_EBT_REDIRECT_H |
| 2 | #define __LINUX_BRIDGE_EBT_REDIRECT_H | 2 | #define __LINUX_BRIDGE_EBT_REDIRECT_H |
| 3 | 3 | ||
| 4 | struct ebt_redirect_info | 4 | struct ebt_redirect_info { |
| 5 | { | ||
| 6 | /* EBT_ACCEPT, EBT_DROP, EBT_CONTINUE or EBT_RETURN */ | 5 | /* EBT_ACCEPT, EBT_DROP, EBT_CONTINUE or EBT_RETURN */ |
| 7 | int target; | 6 | int target; |
| 8 | }; | 7 | }; |
diff --git a/include/linux/netfilter_bridge/ebt_stp.h b/include/linux/netfilter_bridge/ebt_stp.h index e5fd67850f4d..e503a0aa2728 100644 --- a/include/linux/netfilter_bridge/ebt_stp.h +++ b/include/linux/netfilter_bridge/ebt_stp.h | |||
| @@ -20,8 +20,7 @@ | |||
| 20 | 20 | ||
| 21 | #define EBT_STP_MATCH "stp" | 21 | #define EBT_STP_MATCH "stp" |
| 22 | 22 | ||
| 23 | struct ebt_stp_config_info | 23 | struct ebt_stp_config_info { |
| 24 | { | ||
| 25 | uint8_t flags; | 24 | uint8_t flags; |
| 26 | uint16_t root_priol, root_priou; | 25 | uint16_t root_priol, root_priou; |
| 27 | char root_addr[6], root_addrmsk[6]; | 26 | char root_addr[6], root_addrmsk[6]; |
| @@ -35,8 +34,7 @@ struct ebt_stp_config_info | |||
| 35 | uint16_t forward_delayl, forward_delayu; | 34 | uint16_t forward_delayl, forward_delayu; |
| 36 | }; | 35 | }; |
| 37 | 36 | ||
| 38 | struct ebt_stp_info | 37 | struct ebt_stp_info { |
| 39 | { | ||
| 40 | uint8_t type; | 38 | uint8_t type; |
| 41 | struct ebt_stp_config_info config; | 39 | struct ebt_stp_config_info config; |
| 42 | uint16_t bitmask; | 40 | uint16_t bitmask; |
diff --git a/include/linux/netfilter_bridge/ebtables.h b/include/linux/netfilter_bridge/ebtables.h index ea281e6a2048..1c6f0c5f530e 100644 --- a/include/linux/netfilter_bridge/ebtables.h +++ b/include/linux/netfilter_bridge/ebtables.h | |||
| @@ -34,14 +34,12 @@ | |||
| 34 | struct xt_match; | 34 | struct xt_match; |
| 35 | struct xt_target; | 35 | struct xt_target; |
| 36 | 36 | ||
| 37 | struct ebt_counter | 37 | struct ebt_counter { |
| 38 | { | ||
| 39 | uint64_t pcnt; | 38 | uint64_t pcnt; |
| 40 | uint64_t bcnt; | 39 | uint64_t bcnt; |
| 41 | }; | 40 | }; |
| 42 | 41 | ||
| 43 | struct ebt_replace | 42 | struct ebt_replace { |
| 44 | { | ||
| 45 | char name[EBT_TABLE_MAXNAMELEN]; | 43 | char name[EBT_TABLE_MAXNAMELEN]; |
| 46 | unsigned int valid_hooks; | 44 | unsigned int valid_hooks; |
| 47 | /* nr of rules in the table */ | 45 | /* nr of rules in the table */ |
| @@ -57,8 +55,7 @@ struct ebt_replace | |||
| 57 | char __user *entries; | 55 | char __user *entries; |
| 58 | }; | 56 | }; |
| 59 | 57 | ||
| 60 | struct ebt_replace_kernel | 58 | struct ebt_replace_kernel { |
| 61 | { | ||
| 62 | char name[EBT_TABLE_MAXNAMELEN]; | 59 | char name[EBT_TABLE_MAXNAMELEN]; |
| 63 | unsigned int valid_hooks; | 60 | unsigned int valid_hooks; |
| 64 | /* nr of rules in the table */ | 61 | /* nr of rules in the table */ |
| @@ -120,8 +117,7 @@ struct ebt_entries { | |||
| 120 | #define EBT_INV_MASK (EBT_IPROTO | EBT_IIN | EBT_IOUT | EBT_ILOGICALIN \ | 117 | #define EBT_INV_MASK (EBT_IPROTO | EBT_IIN | EBT_IOUT | EBT_ILOGICALIN \ |
| 121 | | EBT_ILOGICALOUT | EBT_ISOURCE | EBT_IDEST) | 118 | | EBT_ILOGICALOUT | EBT_ISOURCE | EBT_IDEST) |
| 122 | 119 | ||
| 123 | struct ebt_entry_match | 120 | struct ebt_entry_match { |
| 124 | { | ||
| 125 | union { | 121 | union { |
| 126 | char name[EBT_FUNCTION_MAXNAMELEN]; | 122 | char name[EBT_FUNCTION_MAXNAMELEN]; |
| 127 | struct xt_match *match; | 123 | struct xt_match *match; |
| @@ -131,8 +127,7 @@ struct ebt_entry_match | |||
| 131 | unsigned char data[0] __attribute__ ((aligned (__alignof__(struct ebt_replace)))); | 127 | unsigned char data[0] __attribute__ ((aligned (__alignof__(struct ebt_replace)))); |
| 132 | }; | 128 | }; |
| 133 | 129 | ||
| 134 | struct ebt_entry_watcher | 130 | struct ebt_entry_watcher { |
| 135 | { | ||
| 136 | union { | 131 | union { |
| 137 | char name[EBT_FUNCTION_MAXNAMELEN]; | 132 | char name[EBT_FUNCTION_MAXNAMELEN]; |
| 138 | struct xt_target *watcher; | 133 | struct xt_target *watcher; |
| @@ -142,8 +137,7 @@ struct ebt_entry_watcher | |||
| 142 | unsigned char data[0] __attribute__ ((aligned (__alignof__(struct ebt_replace)))); | 137 | unsigned char data[0] __attribute__ ((aligned (__alignof__(struct ebt_replace)))); |
| 143 | }; | 138 | }; |
| 144 | 139 | ||
| 145 | struct ebt_entry_target | 140 | struct ebt_entry_target { |
| 146 | { | ||
| 147 | union { | 141 | union { |
| 148 | char name[EBT_FUNCTION_MAXNAMELEN]; | 142 | char name[EBT_FUNCTION_MAXNAMELEN]; |
| 149 | struct xt_target *target; | 143 | struct xt_target *target; |
| @@ -154,8 +148,7 @@ struct ebt_entry_target | |||
| 154 | }; | 148 | }; |
| 155 | 149 | ||
| 156 | #define EBT_STANDARD_TARGET "standard" | 150 | #define EBT_STANDARD_TARGET "standard" |
| 157 | struct ebt_standard_target | 151 | struct ebt_standard_target { |
| 158 | { | ||
| 159 | struct ebt_entry_target target; | 152 | struct ebt_entry_target target; |
| 160 | int verdict; | 153 | int verdict; |
| 161 | }; | 154 | }; |
| @@ -206,8 +199,7 @@ struct ebt_entry { | |||
| 206 | #define EBT_MATCH 0 | 199 | #define EBT_MATCH 0 |
| 207 | #define EBT_NOMATCH 1 | 200 | #define EBT_NOMATCH 1 |
| 208 | 201 | ||
| 209 | struct ebt_match | 202 | struct ebt_match { |
| 210 | { | ||
| 211 | struct list_head list; | 203 | struct list_head list; |
| 212 | const char name[EBT_FUNCTION_MAXNAMELEN]; | 204 | const char name[EBT_FUNCTION_MAXNAMELEN]; |
| 213 | bool (*match)(const struct sk_buff *skb, const struct net_device *in, | 205 | bool (*match)(const struct sk_buff *skb, const struct net_device *in, |
| @@ -224,8 +216,7 @@ struct ebt_match | |||
| 224 | struct module *me; | 216 | struct module *me; |
| 225 | }; | 217 | }; |
| 226 | 218 | ||
| 227 | struct ebt_watcher | 219 | struct ebt_watcher { |
| 228 | { | ||
| 229 | struct list_head list; | 220 | struct list_head list; |
| 230 | const char name[EBT_FUNCTION_MAXNAMELEN]; | 221 | const char name[EBT_FUNCTION_MAXNAMELEN]; |
| 231 | unsigned int (*target)(struct sk_buff *skb, | 222 | unsigned int (*target)(struct sk_buff *skb, |
| @@ -242,8 +233,7 @@ struct ebt_watcher | |||
| 242 | struct module *me; | 233 | struct module *me; |
| 243 | }; | 234 | }; |
| 244 | 235 | ||
| 245 | struct ebt_target | 236 | struct ebt_target { |
| 246 | { | ||
| 247 | struct list_head list; | 237 | struct list_head list; |
| 248 | const char name[EBT_FUNCTION_MAXNAMELEN]; | 238 | const char name[EBT_FUNCTION_MAXNAMELEN]; |
| 249 | /* returns one of the standard EBT_* verdicts */ | 239 | /* returns one of the standard EBT_* verdicts */ |
| @@ -262,15 +252,13 @@ struct ebt_target | |||
| 262 | }; | 252 | }; |
| 263 | 253 | ||
| 264 | /* used for jumping from and into user defined chains (udc) */ | 254 | /* used for jumping from and into user defined chains (udc) */ |
| 265 | struct ebt_chainstack | 255 | struct ebt_chainstack { |
| 266 | { | ||
| 267 | struct ebt_entries *chaininfo; /* pointer to chain data */ | 256 | struct ebt_entries *chaininfo; /* pointer to chain data */ |
| 268 | struct ebt_entry *e; /* pointer to entry data */ | 257 | struct ebt_entry *e; /* pointer to entry data */ |
| 269 | unsigned int n; /* n'th entry */ | 258 | unsigned int n; /* n'th entry */ |
| 270 | }; | 259 | }; |
| 271 | 260 | ||
| 272 | struct ebt_table_info | 261 | struct ebt_table_info { |
| 273 | { | ||
| 274 | /* total size of the entries */ | 262 | /* total size of the entries */ |
| 275 | unsigned int entries_size; | 263 | unsigned int entries_size; |
| 276 | unsigned int nentries; | 264 | unsigned int nentries; |
| @@ -282,8 +270,7 @@ struct ebt_table_info | |||
| 282 | struct ebt_counter counters[0] ____cacheline_aligned; | 270 | struct ebt_counter counters[0] ____cacheline_aligned; |
| 283 | }; | 271 | }; |
| 284 | 272 | ||
| 285 | struct ebt_table | 273 | struct ebt_table { |
| 286 | { | ||
| 287 | struct list_head list; | 274 | struct list_head list; |
| 288 | char name[EBT_TABLE_MAXNAMELEN]; | 275 | char name[EBT_TABLE_MAXNAMELEN]; |
| 289 | struct ebt_replace_kernel *table; | 276 | struct ebt_replace_kernel *table; |
| @@ -302,7 +289,7 @@ struct ebt_table | |||
| 302 | ~(__alignof__(struct ebt_replace)-1)) | 289 | ~(__alignof__(struct ebt_replace)-1)) |
| 303 | extern struct ebt_table *ebt_register_table(struct net *net, | 290 | extern struct ebt_table *ebt_register_table(struct net *net, |
| 304 | const struct ebt_table *table); | 291 | const struct ebt_table *table); |
| 305 | extern void ebt_unregister_table(struct ebt_table *table); | 292 | extern void ebt_unregister_table(struct net *net, struct ebt_table *table); |
| 306 | extern unsigned int ebt_do_table(unsigned int hook, struct sk_buff *skb, | 293 | extern unsigned int ebt_do_table(unsigned int hook, struct sk_buff *skb, |
| 307 | const struct net_device *in, const struct net_device *out, | 294 | const struct net_device *in, const struct net_device *out, |
| 308 | struct ebt_table *table); | 295 | struct ebt_table *table); |
diff --git a/include/linux/netfilter_ipv4/ip_tables.h b/include/linux/netfilter_ipv4/ip_tables.h index 61fafc868a7b..704a7b6e8169 100644 --- a/include/linux/netfilter_ipv4/ip_tables.h +++ b/include/linux/netfilter_ipv4/ip_tables.h | |||
| @@ -76,8 +76,7 @@ struct ipt_ip { | |||
| 76 | /* This structure defines each of the firewall rules. Consists of 3 | 76 | /* This structure defines each of the firewall rules. Consists of 3 |
| 77 | parts which are 1) general IP header stuff 2) match specific | 77 | parts which are 1) general IP header stuff 2) match specific |
| 78 | stuff 3) the target to perform if the rule matches */ | 78 | stuff 3) the target to perform if the rule matches */ |
| 79 | struct ipt_entry | 79 | struct ipt_entry { |
| 80 | { | ||
| 81 | struct ipt_ip ip; | 80 | struct ipt_ip ip; |
| 82 | 81 | ||
| 83 | /* Mark with fields that we care about. */ | 82 | /* Mark with fields that we care about. */ |
| @@ -135,8 +134,7 @@ struct ipt_entry | |||
| 135 | #define IPT_UDP_INV_MASK XT_UDP_INV_MASK | 134 | #define IPT_UDP_INV_MASK XT_UDP_INV_MASK |
| 136 | 135 | ||
| 137 | /* ICMP matching stuff */ | 136 | /* ICMP matching stuff */ |
| 138 | struct ipt_icmp | 137 | struct ipt_icmp { |
| 139 | { | ||
| 140 | u_int8_t type; /* type to match */ | 138 | u_int8_t type; /* type to match */ |
| 141 | u_int8_t code[2]; /* range of code */ | 139 | u_int8_t code[2]; /* range of code */ |
| 142 | u_int8_t invflags; /* Inverse flags */ | 140 | u_int8_t invflags; /* Inverse flags */ |
| @@ -146,8 +144,7 @@ struct ipt_icmp | |||
| 146 | #define IPT_ICMP_INV 0x01 /* Invert the sense of type/code test */ | 144 | #define IPT_ICMP_INV 0x01 /* Invert the sense of type/code test */ |
| 147 | 145 | ||
| 148 | /* The argument to IPT_SO_GET_INFO */ | 146 | /* The argument to IPT_SO_GET_INFO */ |
| 149 | struct ipt_getinfo | 147 | struct ipt_getinfo { |
| 150 | { | ||
| 151 | /* Which table: caller fills this in. */ | 148 | /* Which table: caller fills this in. */ |
| 152 | char name[IPT_TABLE_MAXNAMELEN]; | 149 | char name[IPT_TABLE_MAXNAMELEN]; |
| 153 | 150 | ||
| @@ -169,8 +166,7 @@ struct ipt_getinfo | |||
| 169 | }; | 166 | }; |
| 170 | 167 | ||
| 171 | /* The argument to IPT_SO_SET_REPLACE. */ | 168 | /* The argument to IPT_SO_SET_REPLACE. */ |
| 172 | struct ipt_replace | 169 | struct ipt_replace { |
| 173 | { | ||
| 174 | /* Which table. */ | 170 | /* Which table. */ |
| 175 | char name[IPT_TABLE_MAXNAMELEN]; | 171 | char name[IPT_TABLE_MAXNAMELEN]; |
| 176 | 172 | ||
| @@ -204,8 +200,7 @@ struct ipt_replace | |||
| 204 | #define ipt_counters_info xt_counters_info | 200 | #define ipt_counters_info xt_counters_info |
| 205 | 201 | ||
| 206 | /* The argument to IPT_SO_GET_ENTRIES. */ | 202 | /* The argument to IPT_SO_GET_ENTRIES. */ |
| 207 | struct ipt_get_entries | 203 | struct ipt_get_entries { |
| 208 | { | ||
| 209 | /* Which table: user fills this in. */ | 204 | /* Which table: user fills this in. */ |
| 210 | char name[IPT_TABLE_MAXNAMELEN]; | 205 | char name[IPT_TABLE_MAXNAMELEN]; |
| 211 | 206 | ||
| @@ -228,6 +223,7 @@ ipt_get_target(struct ipt_entry *e) | |||
| 228 | return (void *)e + e->target_offset; | 223 | return (void *)e + e->target_offset; |
| 229 | } | 224 | } |
| 230 | 225 | ||
| 226 | #ifndef __KERNEL__ | ||
| 231 | /* fn returns 0 to continue iteration */ | 227 | /* fn returns 0 to continue iteration */ |
| 232 | #define IPT_MATCH_ITERATE(e, fn, args...) \ | 228 | #define IPT_MATCH_ITERATE(e, fn, args...) \ |
| 233 | XT_MATCH_ITERATE(struct ipt_entry, e, fn, ## args) | 229 | XT_MATCH_ITERATE(struct ipt_entry, e, fn, ## args) |
| @@ -235,6 +231,7 @@ ipt_get_target(struct ipt_entry *e) | |||
| 235 | /* fn returns 0 to continue iteration */ | 231 | /* fn returns 0 to continue iteration */ |
| 236 | #define IPT_ENTRY_ITERATE(entries, size, fn, args...) \ | 232 | #define IPT_ENTRY_ITERATE(entries, size, fn, args...) \ |
| 237 | XT_ENTRY_ITERATE(struct ipt_entry, entries, size, fn, ## args) | 233 | XT_ENTRY_ITERATE(struct ipt_entry, entries, size, fn, ## args) |
| 234 | #endif | ||
| 238 | 235 | ||
| 239 | /* | 236 | /* |
| 240 | * Main firewall chains definitions and global var's definitions. | 237 | * Main firewall chains definitions and global var's definitions. |
| @@ -247,23 +244,20 @@ extern void ipt_init(void) __init; | |||
| 247 | extern struct xt_table *ipt_register_table(struct net *net, | 244 | extern struct xt_table *ipt_register_table(struct net *net, |
| 248 | const struct xt_table *table, | 245 | const struct xt_table *table, |
| 249 | const struct ipt_replace *repl); | 246 | const struct ipt_replace *repl); |
| 250 | extern void ipt_unregister_table(struct xt_table *table); | 247 | extern void ipt_unregister_table(struct net *net, struct xt_table *table); |
| 251 | 248 | ||
| 252 | /* Standard entry. */ | 249 | /* Standard entry. */ |
| 253 | struct ipt_standard | 250 | struct ipt_standard { |
| 254 | { | ||
| 255 | struct ipt_entry entry; | 251 | struct ipt_entry entry; |
| 256 | struct ipt_standard_target target; | 252 | struct ipt_standard_target target; |
| 257 | }; | 253 | }; |
| 258 | 254 | ||
| 259 | struct ipt_error_target | 255 | struct ipt_error_target { |
| 260 | { | ||
| 261 | struct ipt_entry_target target; | 256 | struct ipt_entry_target target; |
| 262 | char errorname[IPT_FUNCTION_MAXNAMELEN]; | 257 | char errorname[IPT_FUNCTION_MAXNAMELEN]; |
| 263 | }; | 258 | }; |
| 264 | 259 | ||
| 265 | struct ipt_error | 260 | struct ipt_error { |
| 266 | { | ||
| 267 | struct ipt_entry entry; | 261 | struct ipt_entry entry; |
| 268 | struct ipt_error_target target; | 262 | struct ipt_error_target target; |
| 269 | }; | 263 | }; |
| @@ -290,6 +284,7 @@ struct ipt_error | |||
| 290 | .target.errorname = "ERROR", \ | 284 | .target.errorname = "ERROR", \ |
| 291 | } | 285 | } |
| 292 | 286 | ||
| 287 | extern void *ipt_alloc_initial_table(const struct xt_table *); | ||
| 293 | extern unsigned int ipt_do_table(struct sk_buff *skb, | 288 | extern unsigned int ipt_do_table(struct sk_buff *skb, |
| 294 | unsigned int hook, | 289 | unsigned int hook, |
| 295 | const struct net_device *in, | 290 | const struct net_device *in, |
| @@ -301,8 +296,7 @@ extern unsigned int ipt_do_table(struct sk_buff *skb, | |||
| 301 | #ifdef CONFIG_COMPAT | 296 | #ifdef CONFIG_COMPAT |
| 302 | #include <net/compat.h> | 297 | #include <net/compat.h> |
| 303 | 298 | ||
| 304 | struct compat_ipt_entry | 299 | struct compat_ipt_entry { |
| 305 | { | ||
| 306 | struct ipt_ip ip; | 300 | struct ipt_ip ip; |
| 307 | compat_uint_t nfcache; | 301 | compat_uint_t nfcache; |
| 308 | u_int16_t target_offset; | 302 | u_int16_t target_offset; |
| @@ -321,19 +315,6 @@ compat_ipt_get_target(struct compat_ipt_entry *e) | |||
| 321 | 315 | ||
| 322 | #define COMPAT_IPT_ALIGN(s) COMPAT_XT_ALIGN(s) | 316 | #define COMPAT_IPT_ALIGN(s) COMPAT_XT_ALIGN(s) |
| 323 | 317 | ||
| 324 | /* fn returns 0 to continue iteration */ | ||
| 325 | #define COMPAT_IPT_MATCH_ITERATE(e, fn, args...) \ | ||
| 326 | XT_MATCH_ITERATE(struct compat_ipt_entry, e, fn, ## args) | ||
| 327 | |||
| 328 | /* fn returns 0 to continue iteration */ | ||
| 329 | #define COMPAT_IPT_ENTRY_ITERATE(entries, size, fn, args...) \ | ||
| 330 | XT_ENTRY_ITERATE(struct compat_ipt_entry, entries, size, fn, ## args) | ||
| 331 | |||
| 332 | /* fn returns 0 to continue iteration */ | ||
| 333 | #define COMPAT_IPT_ENTRY_ITERATE_CONTINUE(entries, size, n, fn, args...) \ | ||
| 334 | XT_ENTRY_ITERATE_CONTINUE(struct compat_ipt_entry, entries, size, n, \ | ||
| 335 | fn, ## args) | ||
| 336 | |||
| 337 | #endif /* CONFIG_COMPAT */ | 318 | #endif /* CONFIG_COMPAT */ |
| 338 | #endif /*__KERNEL__*/ | 319 | #endif /*__KERNEL__*/ |
| 339 | #endif /* _IPTABLES_H */ | 320 | #endif /* _IPTABLES_H */ |
diff --git a/include/linux/netfilter_ipv4/ipt_SAME.h b/include/linux/netfilter_ipv4/ipt_SAME.h index be6e682a85ec..2529660c5b38 100644 --- a/include/linux/netfilter_ipv4/ipt_SAME.h +++ b/include/linux/netfilter_ipv4/ipt_SAME.h | |||
| @@ -5,8 +5,7 @@ | |||
| 5 | 5 | ||
| 6 | #define IPT_SAME_NODST 0x01 | 6 | #define IPT_SAME_NODST 0x01 |
| 7 | 7 | ||
| 8 | struct ipt_same_info | 8 | struct ipt_same_info { |
| 9 | { | ||
| 10 | unsigned char info; | 9 | unsigned char info; |
| 11 | u_int32_t rangesize; | 10 | u_int32_t rangesize; |
| 12 | u_int32_t ipnum; | 11 | u_int32_t ipnum; |
diff --git a/include/linux/netfilter_ipv4/ipt_ah.h b/include/linux/netfilter_ipv4/ipt_ah.h index 7b9a2ac7adb9..2e555b4d05e3 100644 --- a/include/linux/netfilter_ipv4/ipt_ah.h +++ b/include/linux/netfilter_ipv4/ipt_ah.h | |||
| @@ -1,8 +1,7 @@ | |||
| 1 | #ifndef _IPT_AH_H | 1 | #ifndef _IPT_AH_H |
| 2 | #define _IPT_AH_H | 2 | #define _IPT_AH_H |
| 3 | 3 | ||
| 4 | struct ipt_ah | 4 | struct ipt_ah { |
| 5 | { | ||
| 6 | u_int32_t spis[2]; /* Security Parameter Index */ | 5 | u_int32_t spis[2]; /* Security Parameter Index */ |
| 7 | u_int8_t invflags; /* Inverse flags */ | 6 | u_int8_t invflags; /* Inverse flags */ |
| 8 | }; | 7 | }; |
diff --git a/include/linux/netfilter_ipv6.h b/include/linux/netfilter_ipv6.h index d654873aa25a..1f7e300094cd 100644 --- a/include/linux/netfilter_ipv6.h +++ b/include/linux/netfilter_ipv6.h | |||
| @@ -59,6 +59,7 @@ | |||
| 59 | enum nf_ip6_hook_priorities { | 59 | enum nf_ip6_hook_priorities { |
| 60 | NF_IP6_PRI_FIRST = INT_MIN, | 60 | NF_IP6_PRI_FIRST = INT_MIN, |
| 61 | NF_IP6_PRI_CONNTRACK_DEFRAG = -400, | 61 | NF_IP6_PRI_CONNTRACK_DEFRAG = -400, |
| 62 | NF_IP6_PRI_RAW = -300, | ||
| 62 | NF_IP6_PRI_SELINUX_FIRST = -225, | 63 | NF_IP6_PRI_SELINUX_FIRST = -225, |
| 63 | NF_IP6_PRI_CONNTRACK = -200, | 64 | NF_IP6_PRI_CONNTRACK = -200, |
| 64 | NF_IP6_PRI_MANGLE = -150, | 65 | NF_IP6_PRI_MANGLE = -150, |
diff --git a/include/linux/netfilter_ipv6/ip6_tables.h b/include/linux/netfilter_ipv6/ip6_tables.h index a64e1451ac38..e5ba03d783c6 100644 --- a/include/linux/netfilter_ipv6/ip6_tables.h +++ b/include/linux/netfilter_ipv6/ip6_tables.h | |||
| @@ -88,8 +88,7 @@ struct ip6t_ip6 { | |||
| 88 | /* This structure defines each of the firewall rules. Consists of 3 | 88 | /* This structure defines each of the firewall rules. Consists of 3 |
| 89 | parts which are 1) general IP header stuff 2) match specific | 89 | parts which are 1) general IP header stuff 2) match specific |
| 90 | stuff 3) the target to perform if the rule matches */ | 90 | stuff 3) the target to perform if the rule matches */ |
| 91 | struct ip6t_entry | 91 | struct ip6t_entry { |
| 92 | { | ||
| 93 | struct ip6t_ip6 ipv6; | 92 | struct ip6t_ip6 ipv6; |
| 94 | 93 | ||
| 95 | /* Mark with fields that we care about. */ | 94 | /* Mark with fields that we care about. */ |
| @@ -111,20 +110,17 @@ struct ip6t_entry | |||
| 111 | }; | 110 | }; |
| 112 | 111 | ||
| 113 | /* Standard entry */ | 112 | /* Standard entry */ |
| 114 | struct ip6t_standard | 113 | struct ip6t_standard { |
| 115 | { | ||
| 116 | struct ip6t_entry entry; | 114 | struct ip6t_entry entry; |
| 117 | struct ip6t_standard_target target; | 115 | struct ip6t_standard_target target; |
| 118 | }; | 116 | }; |
| 119 | 117 | ||
| 120 | struct ip6t_error_target | 118 | struct ip6t_error_target { |
| 121 | { | ||
| 122 | struct ip6t_entry_target target; | 119 | struct ip6t_entry_target target; |
| 123 | char errorname[IP6T_FUNCTION_MAXNAMELEN]; | 120 | char errorname[IP6T_FUNCTION_MAXNAMELEN]; |
| 124 | }; | 121 | }; |
| 125 | 122 | ||
| 126 | struct ip6t_error | 123 | struct ip6t_error { |
| 127 | { | ||
| 128 | struct ip6t_entry entry; | 124 | struct ip6t_entry entry; |
| 129 | struct ip6t_error_target target; | 125 | struct ip6t_error_target target; |
| 130 | }; | 126 | }; |
| @@ -195,8 +191,7 @@ struct ip6t_error | |||
| 195 | #define IP6T_UDP_INV_MASK XT_UDP_INV_MASK | 191 | #define IP6T_UDP_INV_MASK XT_UDP_INV_MASK |
| 196 | 192 | ||
| 197 | /* ICMP matching stuff */ | 193 | /* ICMP matching stuff */ |
| 198 | struct ip6t_icmp | 194 | struct ip6t_icmp { |
| 199 | { | ||
| 200 | u_int8_t type; /* type to match */ | 195 | u_int8_t type; /* type to match */ |
| 201 | u_int8_t code[2]; /* range of code */ | 196 | u_int8_t code[2]; /* range of code */ |
| 202 | u_int8_t invflags; /* Inverse flags */ | 197 | u_int8_t invflags; /* Inverse flags */ |
| @@ -206,8 +201,7 @@ struct ip6t_icmp | |||
| 206 | #define IP6T_ICMP_INV 0x01 /* Invert the sense of type/code test */ | 201 | #define IP6T_ICMP_INV 0x01 /* Invert the sense of type/code test */ |
| 207 | 202 | ||
| 208 | /* The argument to IP6T_SO_GET_INFO */ | 203 | /* The argument to IP6T_SO_GET_INFO */ |
| 209 | struct ip6t_getinfo | 204 | struct ip6t_getinfo { |
| 210 | { | ||
| 211 | /* Which table: caller fills this in. */ | 205 | /* Which table: caller fills this in. */ |
| 212 | char name[IP6T_TABLE_MAXNAMELEN]; | 206 | char name[IP6T_TABLE_MAXNAMELEN]; |
| 213 | 207 | ||
| @@ -229,8 +223,7 @@ struct ip6t_getinfo | |||
| 229 | }; | 223 | }; |
| 230 | 224 | ||
| 231 | /* The argument to IP6T_SO_SET_REPLACE. */ | 225 | /* The argument to IP6T_SO_SET_REPLACE. */ |
| 232 | struct ip6t_replace | 226 | struct ip6t_replace { |
| 233 | { | ||
| 234 | /* Which table. */ | 227 | /* Which table. */ |
| 235 | char name[IP6T_TABLE_MAXNAMELEN]; | 228 | char name[IP6T_TABLE_MAXNAMELEN]; |
| 236 | 229 | ||
| @@ -264,8 +257,7 @@ struct ip6t_replace | |||
| 264 | #define ip6t_counters_info xt_counters_info | 257 | #define ip6t_counters_info xt_counters_info |
| 265 | 258 | ||
| 266 | /* The argument to IP6T_SO_GET_ENTRIES. */ | 259 | /* The argument to IP6T_SO_GET_ENTRIES. */ |
| 267 | struct ip6t_get_entries | 260 | struct ip6t_get_entries { |
| 268 | { | ||
| 269 | /* Which table: user fills this in. */ | 261 | /* Which table: user fills this in. */ |
| 270 | char name[IP6T_TABLE_MAXNAMELEN]; | 262 | char name[IP6T_TABLE_MAXNAMELEN]; |
| 271 | 263 | ||
| @@ -288,6 +280,7 @@ ip6t_get_target(struct ip6t_entry *e) | |||
| 288 | return (void *)e + e->target_offset; | 280 | return (void *)e + e->target_offset; |
| 289 | } | 281 | } |
| 290 | 282 | ||
| 283 | #ifndef __KERNEL__ | ||
| 291 | /* fn returns 0 to continue iteration */ | 284 | /* fn returns 0 to continue iteration */ |
| 292 | #define IP6T_MATCH_ITERATE(e, fn, args...) \ | 285 | #define IP6T_MATCH_ITERATE(e, fn, args...) \ |
| 293 | XT_MATCH_ITERATE(struct ip6t_entry, e, fn, ## args) | 286 | XT_MATCH_ITERATE(struct ip6t_entry, e, fn, ## args) |
| @@ -295,6 +288,7 @@ ip6t_get_target(struct ip6t_entry *e) | |||
| 295 | /* fn returns 0 to continue iteration */ | 288 | /* fn returns 0 to continue iteration */ |
| 296 | #define IP6T_ENTRY_ITERATE(entries, size, fn, args...) \ | 289 | #define IP6T_ENTRY_ITERATE(entries, size, fn, args...) \ |
| 297 | XT_ENTRY_ITERATE(struct ip6t_entry, entries, size, fn, ## args) | 290 | XT_ENTRY_ITERATE(struct ip6t_entry, entries, size, fn, ## args) |
| 291 | #endif | ||
| 298 | 292 | ||
| 299 | /* | 293 | /* |
| 300 | * Main firewall chains definitions and global var's definitions. | 294 | * Main firewall chains definitions and global var's definitions. |
| @@ -305,10 +299,11 @@ ip6t_get_target(struct ip6t_entry *e) | |||
| 305 | #include <linux/init.h> | 299 | #include <linux/init.h> |
| 306 | extern void ip6t_init(void) __init; | 300 | extern void ip6t_init(void) __init; |
| 307 | 301 | ||
| 302 | extern void *ip6t_alloc_initial_table(const struct xt_table *); | ||
| 308 | extern struct xt_table *ip6t_register_table(struct net *net, | 303 | extern struct xt_table *ip6t_register_table(struct net *net, |
| 309 | const struct xt_table *table, | 304 | const struct xt_table *table, |
| 310 | const struct ip6t_replace *repl); | 305 | const struct ip6t_replace *repl); |
| 311 | extern void ip6t_unregister_table(struct xt_table *table); | 306 | extern void ip6t_unregister_table(struct net *net, struct xt_table *table); |
| 312 | extern unsigned int ip6t_do_table(struct sk_buff *skb, | 307 | extern unsigned int ip6t_do_table(struct sk_buff *skb, |
| 313 | unsigned int hook, | 308 | unsigned int hook, |
| 314 | const struct net_device *in, | 309 | const struct net_device *in, |
| @@ -330,8 +325,7 @@ extern int ip6_masked_addrcmp(const struct in6_addr *addr1, | |||
| 330 | #ifdef CONFIG_COMPAT | 325 | #ifdef CONFIG_COMPAT |
| 331 | #include <net/compat.h> | 326 | #include <net/compat.h> |
| 332 | 327 | ||
| 333 | struct compat_ip6t_entry | 328 | struct compat_ip6t_entry { |
| 334 | { | ||
| 335 | struct ip6t_ip6 ipv6; | 329 | struct ip6t_ip6 ipv6; |
| 336 | compat_uint_t nfcache; | 330 | compat_uint_t nfcache; |
| 337 | u_int16_t target_offset; | 331 | u_int16_t target_offset; |
| @@ -349,18 +343,6 @@ compat_ip6t_get_target(struct compat_ip6t_entry *e) | |||
| 349 | 343 | ||
| 350 | #define COMPAT_IP6T_ALIGN(s) COMPAT_XT_ALIGN(s) | 344 | #define COMPAT_IP6T_ALIGN(s) COMPAT_XT_ALIGN(s) |
| 351 | 345 | ||
| 352 | /* fn returns 0 to continue iteration */ | ||
| 353 | #define COMPAT_IP6T_MATCH_ITERATE(e, fn, args...) \ | ||
| 354 | XT_MATCH_ITERATE(struct compat_ip6t_entry, e, fn, ## args) | ||
| 355 | |||
| 356 | /* fn returns 0 to continue iteration */ | ||
| 357 | #define COMPAT_IP6T_ENTRY_ITERATE(entries, size, fn, args...) \ | ||
| 358 | XT_ENTRY_ITERATE(struct compat_ip6t_entry, entries, size, fn, ## args) | ||
| 359 | |||
| 360 | #define COMPAT_IP6T_ENTRY_ITERATE_CONTINUE(entries, size, n, fn, args...) \ | ||
| 361 | XT_ENTRY_ITERATE_CONTINUE(struct compat_ip6t_entry, entries, size, n, \ | ||
| 362 | fn, ## args) | ||
| 363 | |||
| 364 | #endif /* CONFIG_COMPAT */ | 346 | #endif /* CONFIG_COMPAT */ |
| 365 | #endif /*__KERNEL__*/ | 347 | #endif /*__KERNEL__*/ |
| 366 | #endif /* _IP6_TABLES_H */ | 348 | #endif /* _IP6_TABLES_H */ |
diff --git a/include/linux/netfilter_ipv6/ip6t_ah.h b/include/linux/netfilter_ipv6/ip6t_ah.h index 8531879eb464..17a745cfb2c7 100644 --- a/include/linux/netfilter_ipv6/ip6t_ah.h +++ b/include/linux/netfilter_ipv6/ip6t_ah.h | |||
| @@ -1,8 +1,7 @@ | |||
| 1 | #ifndef _IP6T_AH_H | 1 | #ifndef _IP6T_AH_H |
| 2 | #define _IP6T_AH_H | 2 | #define _IP6T_AH_H |
| 3 | 3 | ||
| 4 | struct ip6t_ah | 4 | struct ip6t_ah { |
| 5 | { | ||
| 6 | u_int32_t spis[2]; /* Security Parameter Index */ | 5 | u_int32_t spis[2]; /* Security Parameter Index */ |
| 7 | u_int32_t hdrlen; /* Header Length */ | 6 | u_int32_t hdrlen; /* Header Length */ |
| 8 | u_int8_t hdrres; /* Test of the Reserved Filed */ | 7 | u_int8_t hdrres; /* Test of the Reserved Filed */ |
diff --git a/include/linux/netfilter_ipv6/ip6t_frag.h b/include/linux/netfilter_ipv6/ip6t_frag.h index 66070a0d6dfc..3724d0850920 100644 --- a/include/linux/netfilter_ipv6/ip6t_frag.h +++ b/include/linux/netfilter_ipv6/ip6t_frag.h | |||
| @@ -1,8 +1,7 @@ | |||
| 1 | #ifndef _IP6T_FRAG_H | 1 | #ifndef _IP6T_FRAG_H |
| 2 | #define _IP6T_FRAG_H | 2 | #define _IP6T_FRAG_H |
| 3 | 3 | ||
| 4 | struct ip6t_frag | 4 | struct ip6t_frag { |
| 5 | { | ||
| 6 | u_int32_t ids[2]; /* Security Parameter Index */ | 5 | u_int32_t ids[2]; /* Security Parameter Index */ |
| 7 | u_int32_t hdrlen; /* Header Length */ | 6 | u_int32_t hdrlen; /* Header Length */ |
| 8 | u_int8_t flags; /* */ | 7 | u_int8_t flags; /* */ |
diff --git a/include/linux/netfilter_ipv6/ip6t_ipv6header.h b/include/linux/netfilter_ipv6/ip6t_ipv6header.h index 51c53fc9c44a..01dfd445596a 100644 --- a/include/linux/netfilter_ipv6/ip6t_ipv6header.h +++ b/include/linux/netfilter_ipv6/ip6t_ipv6header.h | |||
| @@ -8,8 +8,7 @@ on whether they contain certain headers */ | |||
| 8 | #ifndef __IPV6HEADER_H | 8 | #ifndef __IPV6HEADER_H |
| 9 | #define __IPV6HEADER_H | 9 | #define __IPV6HEADER_H |
| 10 | 10 | ||
| 11 | struct ip6t_ipv6header_info | 11 | struct ip6t_ipv6header_info { |
| 12 | { | ||
| 13 | u_int8_t matchflags; | 12 | u_int8_t matchflags; |
| 14 | u_int8_t invflags; | 13 | u_int8_t invflags; |
| 15 | u_int8_t modeflag; | 14 | u_int8_t modeflag; |
diff --git a/include/linux/netfilter_ipv6/ip6t_mh.h b/include/linux/netfilter_ipv6/ip6t_mh.h index b9ca9a5f74d0..18549bca2d1f 100644 --- a/include/linux/netfilter_ipv6/ip6t_mh.h +++ b/include/linux/netfilter_ipv6/ip6t_mh.h | |||
| @@ -2,8 +2,7 @@ | |||
| 2 | #define _IP6T_MH_H | 2 | #define _IP6T_MH_H |
| 3 | 3 | ||
| 4 | /* MH matching stuff */ | 4 | /* MH matching stuff */ |
| 5 | struct ip6t_mh | 5 | struct ip6t_mh { |
| 6 | { | ||
| 7 | u_int8_t types[2]; /* MH type range */ | 6 | u_int8_t types[2]; /* MH type range */ |
| 8 | u_int8_t invflags; /* Inverse flags */ | 7 | u_int8_t invflags; /* Inverse flags */ |
| 9 | }; | 8 | }; |
diff --git a/include/linux/netfilter_ipv6/ip6t_opts.h b/include/linux/netfilter_ipv6/ip6t_opts.h index a07e36380ae8..62d89bcd9f9c 100644 --- a/include/linux/netfilter_ipv6/ip6t_opts.h +++ b/include/linux/netfilter_ipv6/ip6t_opts.h | |||
| @@ -3,8 +3,7 @@ | |||
| 3 | 3 | ||
| 4 | #define IP6T_OPTS_OPTSNR 16 | 4 | #define IP6T_OPTS_OPTSNR 16 |
| 5 | 5 | ||
| 6 | struct ip6t_opts | 6 | struct ip6t_opts { |
| 7 | { | ||
| 8 | u_int32_t hdrlen; /* Header Length */ | 7 | u_int32_t hdrlen; /* Header Length */ |
| 9 | u_int8_t flags; /* */ | 8 | u_int8_t flags; /* */ |
| 10 | u_int8_t invflags; /* Inverse flags */ | 9 | u_int8_t invflags; /* Inverse flags */ |
diff --git a/include/linux/netfilter_ipv6/ip6t_rt.h b/include/linux/netfilter_ipv6/ip6t_rt.h index 52156023e8db..ab91bfd2cd00 100644 --- a/include/linux/netfilter_ipv6/ip6t_rt.h +++ b/include/linux/netfilter_ipv6/ip6t_rt.h | |||
| @@ -5,8 +5,7 @@ | |||
| 5 | 5 | ||
| 6 | #define IP6T_RT_HOPS 16 | 6 | #define IP6T_RT_HOPS 16 |
| 7 | 7 | ||
| 8 | struct ip6t_rt | 8 | struct ip6t_rt { |
| 9 | { | ||
| 10 | u_int32_t rt_type; /* Routing Type */ | 9 | u_int32_t rt_type; /* Routing Type */ |
| 11 | u_int32_t segsleft[2]; /* Segments Left */ | 10 | u_int32_t segsleft[2]; /* Segments Left */ |
| 12 | u_int32_t hdrlen; /* Header Length */ | 11 | u_int32_t hdrlen; /* Header Length */ |
diff --git a/include/linux/netlink.h b/include/linux/netlink.h index ab5d3126831f..6eaca5e1e8ca 100644 --- a/include/linux/netlink.h +++ b/include/linux/netlink.h | |||
| @@ -29,16 +29,14 @@ | |||
| 29 | 29 | ||
| 30 | struct net; | 30 | struct net; |
| 31 | 31 | ||
| 32 | struct sockaddr_nl | 32 | struct sockaddr_nl { |
| 33 | { | ||
| 34 | sa_family_t nl_family; /* AF_NETLINK */ | 33 | sa_family_t nl_family; /* AF_NETLINK */ |
| 35 | unsigned short nl_pad; /* zero */ | 34 | unsigned short nl_pad; /* zero */ |
| 36 | __u32 nl_pid; /* port ID */ | 35 | __u32 nl_pid; /* port ID */ |
| 37 | __u32 nl_groups; /* multicast groups mask */ | 36 | __u32 nl_groups; /* multicast groups mask */ |
| 38 | }; | 37 | }; |
| 39 | 38 | ||
| 40 | struct nlmsghdr | 39 | struct nlmsghdr { |
| 41 | { | ||
| 42 | __u32 nlmsg_len; /* Length of message including header */ | 40 | __u32 nlmsg_len; /* Length of message including header */ |
| 43 | __u16 nlmsg_type; /* Message content */ | 41 | __u16 nlmsg_type; /* Message content */ |
| 44 | __u16 nlmsg_flags; /* Additional flags */ | 42 | __u16 nlmsg_flags; /* Additional flags */ |
| @@ -94,8 +92,7 @@ struct nlmsghdr | |||
| 94 | 92 | ||
| 95 | #define NLMSG_MIN_TYPE 0x10 /* < 0x10: reserved control messages */ | 93 | #define NLMSG_MIN_TYPE 0x10 /* < 0x10: reserved control messages */ |
| 96 | 94 | ||
| 97 | struct nlmsgerr | 95 | struct nlmsgerr { |
| 98 | { | ||
| 99 | int error; | 96 | int error; |
| 100 | struct nlmsghdr msg; | 97 | struct nlmsghdr msg; |
| 101 | }; | 98 | }; |
| @@ -106,8 +103,7 @@ struct nlmsgerr | |||
| 106 | #define NETLINK_BROADCAST_ERROR 4 | 103 | #define NETLINK_BROADCAST_ERROR 4 |
| 107 | #define NETLINK_NO_ENOBUFS 5 | 104 | #define NETLINK_NO_ENOBUFS 5 |
| 108 | 105 | ||
| 109 | struct nl_pktinfo | 106 | struct nl_pktinfo { |
| 110 | { | ||
| 111 | __u32 group; | 107 | __u32 group; |
| 112 | }; | 108 | }; |
| 113 | 109 | ||
| @@ -127,8 +123,7 @@ enum { | |||
| 127 | * <-------------- nlattr->nla_len --------------> | 123 | * <-------------- nlattr->nla_len --------------> |
| 128 | */ | 124 | */ |
| 129 | 125 | ||
| 130 | struct nlattr | 126 | struct nlattr { |
| 131 | { | ||
| 132 | __u16 nla_len; | 127 | __u16 nla_len; |
| 133 | __u16 nla_type; | 128 | __u16 nla_type; |
| 134 | }; | 129 | }; |
| @@ -161,8 +156,7 @@ static inline struct nlmsghdr *nlmsg_hdr(const struct sk_buff *skb) | |||
| 161 | return (struct nlmsghdr *)skb->data; | 156 | return (struct nlmsghdr *)skb->data; |
| 162 | } | 157 | } |
| 163 | 158 | ||
| 164 | struct netlink_skb_parms | 159 | struct netlink_skb_parms { |
| 165 | { | ||
| 166 | struct ucred creds; /* Skb credentials */ | 160 | struct ucred creds; /* Skb credentials */ |
| 167 | __u32 pid; | 161 | __u32 pid; |
| 168 | __u32 dst_group; | 162 | __u32 dst_group; |
| @@ -194,7 +188,7 @@ extern int netlink_has_listeners(struct sock *sk, unsigned int group); | |||
| 194 | extern int netlink_unicast(struct sock *ssk, struct sk_buff *skb, __u32 pid, int nonblock); | 188 | extern int netlink_unicast(struct sock *ssk, struct sk_buff *skb, __u32 pid, int nonblock); |
| 195 | extern int netlink_broadcast(struct sock *ssk, struct sk_buff *skb, __u32 pid, | 189 | extern int netlink_broadcast(struct sock *ssk, struct sk_buff *skb, __u32 pid, |
| 196 | __u32 group, gfp_t allocation); | 190 | __u32 group, gfp_t allocation); |
| 197 | extern void netlink_set_err(struct sock *ssk, __u32 pid, __u32 group, int code); | 191 | extern int netlink_set_err(struct sock *ssk, __u32 pid, __u32 group, int code); |
| 198 | extern int netlink_register_notifier(struct notifier_block *nb); | 192 | extern int netlink_register_notifier(struct notifier_block *nb); |
| 199 | extern int netlink_unregister_notifier(struct notifier_block *nb); | 193 | extern int netlink_unregister_notifier(struct notifier_block *nb); |
| 200 | 194 | ||
| @@ -220,8 +214,7 @@ int netlink_sendskb(struct sock *sk, struct sk_buff *skb); | |||
| 220 | #define NLMSG_DEFAULT_SIZE (NLMSG_GOODSIZE - NLMSG_HDRLEN) | 214 | #define NLMSG_DEFAULT_SIZE (NLMSG_GOODSIZE - NLMSG_HDRLEN) |
| 221 | 215 | ||
| 222 | 216 | ||
| 223 | struct netlink_callback | 217 | struct netlink_callback { |
| 224 | { | ||
| 225 | struct sk_buff *skb; | 218 | struct sk_buff *skb; |
| 226 | const struct nlmsghdr *nlh; | 219 | const struct nlmsghdr *nlh; |
| 227 | int (*dump)(struct sk_buff * skb, | 220 | int (*dump)(struct sk_buff * skb, |
| @@ -231,8 +224,7 @@ struct netlink_callback | |||
| 231 | long args[6]; | 224 | long args[6]; |
| 232 | }; | 225 | }; |
| 233 | 226 | ||
| 234 | struct netlink_notify | 227 | struct netlink_notify { |
| 235 | { | ||
| 236 | struct net *net; | 228 | struct net *net; |
| 237 | int pid; | 229 | int pid; |
| 238 | int protocol; | 230 | int protocol; |
diff --git a/include/linux/netpoll.h b/include/linux/netpoll.h index 2524267210d3..a765ea898549 100644 --- a/include/linux/netpoll.h +++ b/include/linux/netpoll.h | |||
| @@ -21,15 +21,20 @@ struct netpoll { | |||
| 21 | __be32 local_ip, remote_ip; | 21 | __be32 local_ip, remote_ip; |
| 22 | u16 local_port, remote_port; | 22 | u16 local_port, remote_port; |
| 23 | u8 remote_mac[ETH_ALEN]; | 23 | u8 remote_mac[ETH_ALEN]; |
| 24 | |||
| 25 | struct list_head rx; /* rx_np list element */ | ||
| 24 | }; | 26 | }; |
| 25 | 27 | ||
| 26 | struct netpoll_info { | 28 | struct netpoll_info { |
| 27 | atomic_t refcnt; | 29 | atomic_t refcnt; |
| 30 | |||
| 28 | int rx_flags; | 31 | int rx_flags; |
| 29 | spinlock_t rx_lock; | 32 | spinlock_t rx_lock; |
| 30 | struct netpoll *rx_np; /* netpoll that registered an rx_hook */ | 33 | struct list_head rx_np; /* netpolls that registered an rx_hook */ |
| 34 | |||
| 31 | struct sk_buff_head arp_tx; /* list of arp requests to reply to */ | 35 | struct sk_buff_head arp_tx; /* list of arp requests to reply to */ |
| 32 | struct sk_buff_head txq; | 36 | struct sk_buff_head txq; |
| 37 | |||
| 33 | struct delayed_work tx_work; | 38 | struct delayed_work tx_work; |
| 34 | }; | 39 | }; |
| 35 | 40 | ||
| @@ -51,7 +56,7 @@ static inline int netpoll_rx(struct sk_buff *skb) | |||
| 51 | unsigned long flags; | 56 | unsigned long flags; |
| 52 | int ret = 0; | 57 | int ret = 0; |
| 53 | 58 | ||
| 54 | if (!npinfo || (!npinfo->rx_np && !npinfo->rx_flags)) | 59 | if (!npinfo || (list_empty(&npinfo->rx_np) && !npinfo->rx_flags)) |
| 55 | return 0; | 60 | return 0; |
| 56 | 61 | ||
| 57 | spin_lock_irqsave(&npinfo->rx_lock, flags); | 62 | spin_lock_irqsave(&npinfo->rx_lock, flags); |
| @@ -67,7 +72,7 @@ static inline int netpoll_rx_on(struct sk_buff *skb) | |||
| 67 | { | 72 | { |
| 68 | struct netpoll_info *npinfo = skb->dev->npinfo; | 73 | struct netpoll_info *npinfo = skb->dev->npinfo; |
| 69 | 74 | ||
| 70 | return npinfo && (npinfo->rx_np || npinfo->rx_flags); | 75 | return npinfo && (!list_empty(&npinfo->rx_np) || npinfo->rx_flags); |
| 71 | } | 76 | } |
| 72 | 77 | ||
| 73 | static inline int netpoll_receive_skb(struct sk_buff *skb) | 78 | static inline int netpoll_receive_skb(struct sk_buff *skb) |
diff --git a/include/linux/nfs4.h b/include/linux/nfs4.h index c4c060208109..9b8299af3741 100644 --- a/include/linux/nfs4.h +++ b/include/linux/nfs4.h | |||
| @@ -128,6 +128,8 @@ | |||
| 128 | #define SEQ4_STATUS_RECALLABLE_STATE_REVOKED 0x00000040 | 128 | #define SEQ4_STATUS_RECALLABLE_STATE_REVOKED 0x00000040 |
| 129 | #define SEQ4_STATUS_LEASE_MOVED 0x00000080 | 129 | #define SEQ4_STATUS_LEASE_MOVED 0x00000080 |
| 130 | #define SEQ4_STATUS_RESTART_RECLAIM_NEEDED 0x00000100 | 130 | #define SEQ4_STATUS_RESTART_RECLAIM_NEEDED 0x00000100 |
| 131 | #define SEQ4_STATUS_CB_PATH_DOWN_SESSION 0x00000200 | ||
| 132 | #define SEQ4_STATUS_BACKCHANNEL_FAULT 0x00000400 | ||
| 131 | 133 | ||
| 132 | #define NFS4_MAX_UINT64 (~(u64)0) | 134 | #define NFS4_MAX_UINT64 (~(u64)0) |
| 133 | 135 | ||
| @@ -528,6 +530,7 @@ enum { | |||
| 528 | NFSPROC4_CLNT_DESTROY_SESSION, | 530 | NFSPROC4_CLNT_DESTROY_SESSION, |
| 529 | NFSPROC4_CLNT_SEQUENCE, | 531 | NFSPROC4_CLNT_SEQUENCE, |
| 530 | NFSPROC4_CLNT_GET_LEASE_TIME, | 532 | NFSPROC4_CLNT_GET_LEASE_TIME, |
| 533 | NFSPROC4_CLNT_RECLAIM_COMPLETE, | ||
| 531 | }; | 534 | }; |
| 532 | 535 | ||
| 533 | /* nfs41 types */ | 536 | /* nfs41 types */ |
diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h index d09db1bc9083..07ce4609fe50 100644 --- a/include/linux/nfs_fs.h +++ b/include/linux/nfs_fs.h | |||
| @@ -33,9 +33,6 @@ | |||
| 33 | #define FLUSH_STABLE 4 /* commit to stable storage */ | 33 | #define FLUSH_STABLE 4 /* commit to stable storage */ |
| 34 | #define FLUSH_LOWPRI 8 /* low priority background flush */ | 34 | #define FLUSH_LOWPRI 8 /* low priority background flush */ |
| 35 | #define FLUSH_HIGHPRI 16 /* high priority memory reclaim flush */ | 35 | #define FLUSH_HIGHPRI 16 /* high priority memory reclaim flush */ |
| 36 | #define FLUSH_NOCOMMIT 32 /* Don't send the NFSv3/v4 COMMIT */ | ||
| 37 | #define FLUSH_INVALIDATE 64 /* Invalidate the page cache */ | ||
| 38 | #define FLUSH_NOWRITEPAGE 128 /* Don't call writepage() */ | ||
| 39 | 36 | ||
| 40 | #ifdef __KERNEL__ | 37 | #ifdef __KERNEL__ |
| 41 | 38 | ||
| @@ -166,6 +163,7 @@ struct nfs_inode { | |||
| 166 | struct radix_tree_root nfs_page_tree; | 163 | struct radix_tree_root nfs_page_tree; |
| 167 | 164 | ||
| 168 | unsigned long npages; | 165 | unsigned long npages; |
| 166 | unsigned long ncommit; | ||
| 169 | 167 | ||
| 170 | /* Open contexts for shared mmap writes */ | 168 | /* Open contexts for shared mmap writes */ |
| 171 | struct list_head open_files; | 169 | struct list_head open_files; |
| @@ -211,6 +209,7 @@ struct nfs_inode { | |||
| 211 | #define NFS_INO_FLUSHING (4) /* inode is flushing out data */ | 209 | #define NFS_INO_FLUSHING (4) /* inode is flushing out data */ |
| 212 | #define NFS_INO_FSCACHE (5) /* inode can be cached by FS-Cache */ | 210 | #define NFS_INO_FSCACHE (5) /* inode can be cached by FS-Cache */ |
| 213 | #define NFS_INO_FSCACHE_LOCK (6) /* FS-Cache cookie management lock */ | 211 | #define NFS_INO_FSCACHE_LOCK (6) /* FS-Cache cookie management lock */ |
| 212 | #define NFS_INO_COMMIT (7) /* inode is committing unstable writes */ | ||
| 214 | 213 | ||
| 215 | static inline struct nfs_inode *NFS_I(const struct inode *inode) | 214 | static inline struct nfs_inode *NFS_I(const struct inode *inode) |
| 216 | { | 215 | { |
| @@ -349,7 +348,6 @@ extern int nfs_attribute_timeout(struct inode *inode); | |||
| 349 | extern int nfs_revalidate_inode(struct nfs_server *server, struct inode *inode); | 348 | extern int nfs_revalidate_inode(struct nfs_server *server, struct inode *inode); |
| 350 | extern int __nfs_revalidate_inode(struct nfs_server *, struct inode *); | 349 | extern int __nfs_revalidate_inode(struct nfs_server *, struct inode *); |
| 351 | extern int nfs_revalidate_mapping(struct inode *inode, struct address_space *mapping); | 350 | extern int nfs_revalidate_mapping(struct inode *inode, struct address_space *mapping); |
| 352 | extern int nfs_revalidate_mapping_nolock(struct inode *inode, struct address_space *mapping); | ||
| 353 | extern int nfs_setattr(struct dentry *, struct iattr *); | 351 | extern int nfs_setattr(struct dentry *, struct iattr *); |
| 354 | extern void nfs_setattr_update_inode(struct inode *inode, struct iattr *attr); | 352 | extern void nfs_setattr_update_inode(struct inode *inode, struct iattr *attr); |
| 355 | extern struct nfs_open_context *get_nfs_open_context(struct nfs_open_context *ctx); | 353 | extern struct nfs_open_context *get_nfs_open_context(struct nfs_open_context *ctx); |
| @@ -477,21 +475,12 @@ extern int nfs_writeback_done(struct rpc_task *, struct nfs_write_data *); | |||
| 477 | * Try to write back everything synchronously (but check the | 475 | * Try to write back everything synchronously (but check the |
| 478 | * return value!) | 476 | * return value!) |
| 479 | */ | 477 | */ |
| 480 | extern long nfs_sync_mapping_wait(struct address_space *, struct writeback_control *, int); | ||
| 481 | extern int nfs_wb_all(struct inode *inode); | 478 | extern int nfs_wb_all(struct inode *inode); |
| 482 | extern int nfs_wb_nocommit(struct inode *inode); | ||
| 483 | extern int nfs_wb_page(struct inode *inode, struct page* page); | 479 | extern int nfs_wb_page(struct inode *inode, struct page* page); |
| 484 | extern int nfs_wb_page_cancel(struct inode *inode, struct page* page); | 480 | extern int nfs_wb_page_cancel(struct inode *inode, struct page* page); |
| 485 | #if defined(CONFIG_NFS_V3) || defined(CONFIG_NFS_V4) | 481 | #if defined(CONFIG_NFS_V3) || defined(CONFIG_NFS_V4) |
| 486 | extern int nfs_commit_inode(struct inode *, int); | ||
| 487 | extern struct nfs_write_data *nfs_commitdata_alloc(void); | 482 | extern struct nfs_write_data *nfs_commitdata_alloc(void); |
| 488 | extern void nfs_commit_free(struct nfs_write_data *wdata); | 483 | extern void nfs_commit_free(struct nfs_write_data *wdata); |
| 489 | #else | ||
| 490 | static inline int | ||
| 491 | nfs_commit_inode(struct inode *inode, int how) | ||
| 492 | { | ||
| 493 | return 0; | ||
| 494 | } | ||
| 495 | #endif | 484 | #endif |
| 496 | 485 | ||
| 497 | static inline int | 486 | static inline int |
diff --git a/include/linux/nfs_fs_sb.h b/include/linux/nfs_fs_sb.h index 320569eabe3b..e82957acea56 100644 --- a/include/linux/nfs_fs_sb.h +++ b/include/linux/nfs_fs_sb.h | |||
| @@ -105,7 +105,7 @@ struct nfs_server { | |||
| 105 | struct rpc_clnt * client; /* RPC client handle */ | 105 | struct rpc_clnt * client; /* RPC client handle */ |
| 106 | struct rpc_clnt * client_acl; /* ACL RPC client handle */ | 106 | struct rpc_clnt * client_acl; /* ACL RPC client handle */ |
| 107 | struct nlm_host *nlm_host; /* NLM client handle */ | 107 | struct nlm_host *nlm_host; /* NLM client handle */ |
| 108 | struct nfs_iostats * io_stats; /* I/O statistics */ | 108 | struct nfs_iostats __percpu *io_stats; /* I/O statistics */ |
| 109 | struct backing_dev_info backing_dev_info; | 109 | struct backing_dev_info backing_dev_info; |
| 110 | atomic_long_t writeback; /* number of writeback pages */ | 110 | atomic_long_t writeback; /* number of writeback pages */ |
| 111 | int flags; /* various flags */ | 111 | int flags; /* various flags */ |
| @@ -176,6 +176,7 @@ struct nfs_server { | |||
| 176 | #define NFS_CAP_ATIME (1U << 11) | 176 | #define NFS_CAP_ATIME (1U << 11) |
| 177 | #define NFS_CAP_CTIME (1U << 12) | 177 | #define NFS_CAP_CTIME (1U << 12) |
| 178 | #define NFS_CAP_MTIME (1U << 13) | 178 | #define NFS_CAP_MTIME (1U << 13) |
| 179 | #define NFS_CAP_POSIX_LOCK (1U << 14) | ||
| 179 | 180 | ||
| 180 | 181 | ||
| 181 | /* maximum number of slots to use */ | 182 | /* maximum number of slots to use */ |
| @@ -193,6 +194,8 @@ struct nfs4_slot_table { | |||
| 193 | int max_slots; /* # slots in table */ | 194 | int max_slots; /* # slots in table */ |
| 194 | int highest_used_slotid; /* sent to server on each SEQ. | 195 | int highest_used_slotid; /* sent to server on each SEQ. |
| 195 | * op for dynamic resizing */ | 196 | * op for dynamic resizing */ |
| 197 | int target_max_slots; /* Set by CB_RECALL_SLOT as | ||
| 198 | * the new max_slots */ | ||
| 196 | }; | 199 | }; |
| 197 | 200 | ||
| 198 | static inline int slot_idx(struct nfs4_slot_table *tbl, struct nfs4_slot *sp) | 201 | static inline int slot_idx(struct nfs4_slot_table *tbl, struct nfs4_slot *sp) |
| @@ -209,6 +212,7 @@ struct nfs4_session { | |||
| 209 | unsigned long session_state; | 212 | unsigned long session_state; |
| 210 | u32 hash_alg; | 213 | u32 hash_alg; |
| 211 | u32 ssv_len; | 214 | u32 ssv_len; |
| 215 | struct completion complete; | ||
| 212 | 216 | ||
| 213 | /* The fore and back channel */ | 217 | /* The fore and back channel */ |
| 214 | struct nfs4_channel_attrs fc_attrs; | 218 | struct nfs4_channel_attrs fc_attrs; |
diff --git a/include/linux/nfs_xdr.h b/include/linux/nfs_xdr.h index 62f63fb0c4c8..89b28812ec24 100644 --- a/include/linux/nfs_xdr.h +++ b/include/linux/nfs_xdr.h | |||
| @@ -2,6 +2,7 @@ | |||
| 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> | ||
| 5 | 6 | ||
| 6 | /* | 7 | /* |
| 7 | * To change the maximum rsize and wsize supported by the NFS client, adjust | 8 | * To change the maximum rsize and wsize supported by the NFS client, adjust |
| @@ -170,8 +171,9 @@ struct nfs4_sequence_args { | |||
| 170 | struct nfs4_sequence_res { | 171 | struct nfs4_sequence_res { |
| 171 | struct nfs4_session *sr_session; | 172 | struct nfs4_session *sr_session; |
| 172 | u8 sr_slotid; /* slot used to send request */ | 173 | u8 sr_slotid; /* slot used to send request */ |
| 173 | unsigned long sr_renewal_time; | ||
| 174 | int sr_status; /* sequence operation status */ | 174 | int sr_status; /* sequence operation status */ |
| 175 | unsigned long sr_renewal_time; | ||
| 176 | u32 sr_status_flags; | ||
| 175 | }; | 177 | }; |
| 176 | 178 | ||
| 177 | struct nfs4_get_lease_time_args { | 179 | struct nfs4_get_lease_time_args { |
| @@ -938,6 +940,16 @@ struct nfs41_create_session_args { | |||
| 938 | struct nfs41_create_session_res { | 940 | struct nfs41_create_session_res { |
| 939 | struct nfs_client *client; | 941 | struct nfs_client *client; |
| 940 | }; | 942 | }; |
| 943 | |||
| 944 | struct nfs41_reclaim_complete_args { | ||
| 945 | /* In the future extend to include curr_fh for use with migration */ | ||
| 946 | unsigned char one_fs:1; | ||
| 947 | struct nfs4_sequence_args seq_args; | ||
| 948 | }; | ||
| 949 | |||
| 950 | struct nfs41_reclaim_complete_res { | ||
| 951 | struct nfs4_sequence_res seq_res; | ||
| 952 | }; | ||
| 941 | #endif /* CONFIG_NFS_V4_1 */ | 953 | #endif /* CONFIG_NFS_V4_1 */ |
| 942 | 954 | ||
| 943 | struct nfs_page; | 955 | struct nfs_page; |
diff --git a/include/linux/nfsacl.h b/include/linux/nfsacl.h index 43011b69297c..f321b578edeb 100644 --- a/include/linux/nfsacl.h +++ b/include/linux/nfsacl.h | |||
| @@ -29,6 +29,7 @@ | |||
| 29 | #ifdef __KERNEL__ | 29 | #ifdef __KERNEL__ |
| 30 | 30 | ||
| 31 | #include <linux/posix_acl.h> | 31 | #include <linux/posix_acl.h> |
| 32 | #include <linux/sunrpc/xdr.h> | ||
| 32 | 33 | ||
| 33 | /* Maximum number of ACL entries over NFS */ | 34 | /* Maximum number of ACL entries over NFS */ |
| 34 | #define NFS_ACL_MAX_ENTRIES 1024 | 35 | #define NFS_ACL_MAX_ENTRIES 1024 |
diff --git a/include/linux/nfsd/cache.h b/include/linux/nfsd/cache.h deleted file mode 100644 index 3a3f58934f5e..000000000000 --- a/include/linux/nfsd/cache.h +++ /dev/null | |||
| @@ -1,86 +0,0 @@ | |||
| 1 | /* | ||
| 2 | * include/linux/nfsd/cache.h | ||
| 3 | * | ||
| 4 | * Request reply cache. This was heavily inspired by the | ||
| 5 | * implementation in 4.3BSD/4.4BSD. | ||
| 6 | * | ||
| 7 | * Copyright (C) 1995, 1996 Olaf Kirch <okir@monad.swb.de> | ||
| 8 | */ | ||
| 9 | |||
| 10 | #ifndef NFSCACHE_H | ||
| 11 | #define NFSCACHE_H | ||
| 12 | |||
| 13 | #include <linux/in.h> | ||
| 14 | #include <linux/uio.h> | ||
| 15 | |||
| 16 | /* | ||
| 17 | * Representation of a reply cache entry. | ||
| 18 | */ | ||
| 19 | struct svc_cacherep { | ||
| 20 | struct hlist_node c_hash; | ||
| 21 | struct list_head c_lru; | ||
| 22 | |||
| 23 | unsigned char c_state, /* unused, inprog, done */ | ||
| 24 | c_type, /* status, buffer */ | ||
| 25 | c_secure : 1; /* req came from port < 1024 */ | ||
| 26 | struct sockaddr_in c_addr; | ||
| 27 | __be32 c_xid; | ||
| 28 | u32 c_prot; | ||
| 29 | u32 c_proc; | ||
| 30 | u32 c_vers; | ||
| 31 | unsigned long c_timestamp; | ||
| 32 | union { | ||
| 33 | struct kvec u_vec; | ||
| 34 | __be32 u_status; | ||
| 35 | } c_u; | ||
| 36 | }; | ||
| 37 | |||
| 38 | #define c_replvec c_u.u_vec | ||
| 39 | #define c_replstat c_u.u_status | ||
| 40 | |||
| 41 | /* cache entry states */ | ||
| 42 | enum { | ||
| 43 | RC_UNUSED, | ||
| 44 | RC_INPROG, | ||
| 45 | RC_DONE | ||
| 46 | }; | ||
| 47 | |||
| 48 | /* return values */ | ||
| 49 | enum { | ||
| 50 | RC_DROPIT, | ||
| 51 | RC_REPLY, | ||
| 52 | RC_DOIT, | ||
| 53 | RC_INTR | ||
| 54 | }; | ||
| 55 | |||
| 56 | /* | ||
| 57 | * Cache types. | ||
| 58 | * We may want to add more types one day, e.g. for diropres and | ||
| 59 | * attrstat replies. Using cache entries with fixed length instead | ||
| 60 | * of buffer pointers may be more efficient. | ||
| 61 | */ | ||
| 62 | enum { | ||
| 63 | RC_NOCACHE, | ||
| 64 | RC_REPLSTAT, | ||
| 65 | RC_REPLBUFF, | ||
| 66 | }; | ||
| 67 | |||
| 68 | /* | ||
| 69 | * If requests are retransmitted within this interval, they're dropped. | ||
| 70 | */ | ||
| 71 | #define RC_DELAY (HZ/5) | ||
| 72 | |||
| 73 | int nfsd_reply_cache_init(void); | ||
| 74 | void nfsd_reply_cache_shutdown(void); | ||
| 75 | int nfsd_cache_lookup(struct svc_rqst *, int); | ||
| 76 | void nfsd_cache_update(struct svc_rqst *, int, __be32 *); | ||
| 77 | |||
| 78 | #ifdef CONFIG_NFSD_V4 | ||
| 79 | void nfsd4_set_statp(struct svc_rqst *rqstp, __be32 *statp); | ||
| 80 | #else /* CONFIG_NFSD_V4 */ | ||
| 81 | static inline void nfsd4_set_statp(struct svc_rqst *rqstp, __be32 *statp) | ||
| 82 | { | ||
| 83 | } | ||
| 84 | #endif /* CONFIG_NFSD_V4 */ | ||
| 85 | |||
| 86 | #endif /* NFSCACHE_H */ | ||
diff --git a/include/linux/nfsd/export.h b/include/linux/nfsd/export.h index a6d9ef2bb34a..8ae78a61eea4 100644 --- a/include/linux/nfsd/export.h +++ b/include/linux/nfsd/export.h | |||
| @@ -12,7 +12,7 @@ | |||
| 12 | 12 | ||
| 13 | # include <linux/types.h> | 13 | # include <linux/types.h> |
| 14 | #ifdef __KERNEL__ | 14 | #ifdef __KERNEL__ |
| 15 | # include <linux/in.h> | 15 | # include <linux/nfsd/nfsfh.h> |
| 16 | #endif | 16 | #endif |
| 17 | 17 | ||
| 18 | /* | 18 | /* |
| @@ -39,11 +39,23 @@ | |||
| 39 | #define NFSEXP_FSID 0x2000 | 39 | #define NFSEXP_FSID 0x2000 |
| 40 | #define NFSEXP_CROSSMOUNT 0x4000 | 40 | #define NFSEXP_CROSSMOUNT 0x4000 |
| 41 | #define NFSEXP_NOACL 0x8000 /* reserved for possible ACL related use */ | 41 | #define NFSEXP_NOACL 0x8000 /* reserved for possible ACL related use */ |
| 42 | #define NFSEXP_ALLFLAGS 0xFE3F | 42 | /* |
| 43 | * The NFSEXP_V4ROOT flag causes the kernel to give access only to NFSv4 | ||
| 44 | * clients, and only to the single directory that is the root of the | ||
| 45 | * export; further lookup and readdir operations are treated as if every | ||
| 46 | * subdirectory was a mountpoint, and ignored if they are not themselves | ||
| 47 | * exported. This is used by nfsd and mountd to construct the NFSv4 | ||
| 48 | * pseudofilesystem, which provides access only to paths leading to each | ||
| 49 | * exported filesystem. | ||
| 50 | */ | ||
| 51 | #define NFSEXP_V4ROOT 0x10000 | ||
| 52 | /* All flags that we claim to support. (Note we don't support NOACL.) */ | ||
| 53 | #define NFSEXP_ALLFLAGS 0x17E3F | ||
| 43 | 54 | ||
| 44 | /* The flags that may vary depending on security flavor: */ | 55 | /* The flags that may vary depending on security flavor: */ |
| 45 | #define NFSEXP_SECINFO_FLAGS (NFSEXP_READONLY | NFSEXP_ROOTSQUASH \ | 56 | #define NFSEXP_SECINFO_FLAGS (NFSEXP_READONLY | NFSEXP_ROOTSQUASH \ |
| 46 | | NFSEXP_ALLSQUASH) | 57 | | NFSEXP_ALLSQUASH \ |
| 58 | | NFSEXP_INSECURE_PORT) | ||
| 47 | 59 | ||
| 48 | #ifdef __KERNEL__ | 60 | #ifdef __KERNEL__ |
| 49 | 61 | ||
| @@ -108,7 +120,6 @@ struct svc_expkey { | |||
| 108 | struct path ek_path; | 120 | struct path ek_path; |
| 109 | }; | 121 | }; |
| 110 | 122 | ||
| 111 | #define EX_SECURE(exp) (!((exp)->ex_flags & NFSEXP_INSECURE_PORT)) | ||
| 112 | #define EX_ISSYNC(exp) (!((exp)->ex_flags & NFSEXP_ASYNC)) | 123 | #define EX_ISSYNC(exp) (!((exp)->ex_flags & NFSEXP_ASYNC)) |
| 113 | #define EX_NOHIDE(exp) ((exp)->ex_flags & NFSEXP_NOHIDE) | 124 | #define EX_NOHIDE(exp) ((exp)->ex_flags & NFSEXP_NOHIDE) |
| 114 | #define EX_WGATHER(exp) ((exp)->ex_flags & NFSEXP_GATHERED_WRITES) | 125 | #define EX_WGATHER(exp) ((exp)->ex_flags & NFSEXP_GATHERED_WRITES) |
diff --git a/include/linux/nfsd/nfsd.h b/include/linux/nfsd/nfsd.h deleted file mode 100644 index 510ffdd5020e..000000000000 --- a/include/linux/nfsd/nfsd.h +++ /dev/null | |||
| @@ -1,424 +0,0 @@ | |||
| 1 | /* | ||
| 2 | * linux/include/linux/nfsd/nfsd.h | ||
| 3 | * | ||
| 4 | * Hodge-podge collection of knfsd-related stuff. | ||
| 5 | * I will sort this out later. | ||
| 6 | * | ||
| 7 | * Copyright (C) 1995-1997 Olaf Kirch <okir@monad.swb.de> | ||
| 8 | */ | ||
| 9 | |||
| 10 | #ifndef LINUX_NFSD_NFSD_H | ||
| 11 | #define LINUX_NFSD_NFSD_H | ||
| 12 | |||
| 13 | #include <linux/types.h> | ||
| 14 | #include <linux/unistd.h> | ||
| 15 | #include <linux/fs.h> | ||
| 16 | #include <linux/posix_acl.h> | ||
| 17 | #include <linux/mount.h> | ||
| 18 | |||
| 19 | #include <linux/nfsd/debug.h> | ||
| 20 | #include <linux/nfsd/nfsfh.h> | ||
| 21 | #include <linux/nfsd/export.h> | ||
| 22 | #include <linux/nfsd/stats.h> | ||
| 23 | /* | ||
| 24 | * nfsd version | ||
| 25 | */ | ||
| 26 | #define NFSD_SUPPORTED_MINOR_VERSION 1 | ||
| 27 | |||
| 28 | /* | ||
| 29 | * Flags for nfsd_permission | ||
| 30 | */ | ||
| 31 | #define NFSD_MAY_NOP 0 | ||
| 32 | #define NFSD_MAY_EXEC 1 /* == MAY_EXEC */ | ||
| 33 | #define NFSD_MAY_WRITE 2 /* == MAY_WRITE */ | ||
| 34 | #define NFSD_MAY_READ 4 /* == MAY_READ */ | ||
| 35 | #define NFSD_MAY_SATTR 8 | ||
| 36 | #define NFSD_MAY_TRUNC 16 | ||
| 37 | #define NFSD_MAY_LOCK 32 | ||
| 38 | #define NFSD_MAY_OWNER_OVERRIDE 64 | ||
| 39 | #define NFSD_MAY_LOCAL_ACCESS 128 /* IRIX doing local access check on device special file*/ | ||
| 40 | #define NFSD_MAY_BYPASS_GSS_ON_ROOT 256 | ||
| 41 | |||
| 42 | #define NFSD_MAY_CREATE (NFSD_MAY_EXEC|NFSD_MAY_WRITE) | ||
| 43 | #define NFSD_MAY_REMOVE (NFSD_MAY_EXEC|NFSD_MAY_WRITE|NFSD_MAY_TRUNC) | ||
| 44 | |||
| 45 | /* | ||
| 46 | * Callback function for readdir | ||
| 47 | */ | ||
| 48 | struct readdir_cd { | ||
| 49 | __be32 err; /* 0, nfserr, or nfserr_eof */ | ||
| 50 | }; | ||
| 51 | typedef int (*nfsd_dirop_t)(struct inode *, struct dentry *, int, int); | ||
| 52 | |||
| 53 | extern struct svc_program nfsd_program; | ||
| 54 | extern struct svc_version nfsd_version2, nfsd_version3, | ||
| 55 | nfsd_version4; | ||
| 56 | extern u32 nfsd_supported_minorversion; | ||
| 57 | extern struct mutex nfsd_mutex; | ||
| 58 | extern struct svc_serv *nfsd_serv; | ||
| 59 | extern spinlock_t nfsd_drc_lock; | ||
| 60 | extern unsigned int nfsd_drc_max_mem; | ||
| 61 | extern unsigned int nfsd_drc_mem_used; | ||
| 62 | |||
| 63 | extern const struct seq_operations nfs_exports_op; | ||
| 64 | |||
| 65 | /* | ||
| 66 | * Function prototypes. | ||
| 67 | */ | ||
| 68 | int nfsd_svc(unsigned short port, int nrservs); | ||
| 69 | int nfsd_dispatch(struct svc_rqst *rqstp, __be32 *statp); | ||
| 70 | |||
| 71 | int nfsd_nrthreads(void); | ||
| 72 | int nfsd_nrpools(void); | ||
| 73 | int nfsd_get_nrthreads(int n, int *); | ||
| 74 | int nfsd_set_nrthreads(int n, int *); | ||
| 75 | |||
| 76 | /* nfsd/vfs.c */ | ||
| 77 | int fh_lock_parent(struct svc_fh *, struct dentry *); | ||
| 78 | int nfsd_racache_init(int); | ||
| 79 | void nfsd_racache_shutdown(void); | ||
| 80 | int nfsd_cross_mnt(struct svc_rqst *rqstp, struct dentry **dpp, | ||
| 81 | struct svc_export **expp); | ||
| 82 | __be32 nfsd_lookup(struct svc_rqst *, struct svc_fh *, | ||
| 83 | const char *, unsigned int, struct svc_fh *); | ||
| 84 | __be32 nfsd_lookup_dentry(struct svc_rqst *, struct svc_fh *, | ||
| 85 | const char *, unsigned int, | ||
| 86 | struct svc_export **, struct dentry **); | ||
| 87 | __be32 nfsd_setattr(struct svc_rqst *, struct svc_fh *, | ||
| 88 | struct iattr *, int, time_t); | ||
| 89 | #ifdef CONFIG_NFSD_V4 | ||
| 90 | __be32 nfsd4_set_nfs4_acl(struct svc_rqst *, struct svc_fh *, | ||
| 91 | struct nfs4_acl *); | ||
| 92 | int nfsd4_get_nfs4_acl(struct svc_rqst *, struct dentry *, struct nfs4_acl **); | ||
| 93 | #endif /* CONFIG_NFSD_V4 */ | ||
| 94 | __be32 nfsd_create(struct svc_rqst *, struct svc_fh *, | ||
| 95 | char *name, int len, struct iattr *attrs, | ||
| 96 | int type, dev_t rdev, struct svc_fh *res); | ||
| 97 | #ifdef CONFIG_NFSD_V3 | ||
| 98 | __be32 nfsd_access(struct svc_rqst *, struct svc_fh *, u32 *, u32 *); | ||
| 99 | __be32 nfsd_create_v3(struct svc_rqst *, struct svc_fh *, | ||
| 100 | char *name, int len, struct iattr *attrs, | ||
| 101 | struct svc_fh *res, int createmode, | ||
| 102 | u32 *verifier, int *truncp, int *created); | ||
| 103 | __be32 nfsd_commit(struct svc_rqst *, struct svc_fh *, | ||
| 104 | loff_t, unsigned long); | ||
| 105 | #endif /* CONFIG_NFSD_V3 */ | ||
| 106 | __be32 nfsd_open(struct svc_rqst *, struct svc_fh *, int, | ||
| 107 | int, struct file **); | ||
| 108 | void nfsd_close(struct file *); | ||
| 109 | __be32 nfsd_read(struct svc_rqst *, struct svc_fh *, struct file *, | ||
| 110 | loff_t, struct kvec *, int, unsigned long *); | ||
| 111 | __be32 nfsd_write(struct svc_rqst *, struct svc_fh *,struct file *, | ||
| 112 | loff_t, struct kvec *,int, unsigned long *, int *); | ||
| 113 | __be32 nfsd_readlink(struct svc_rqst *, struct svc_fh *, | ||
| 114 | char *, int *); | ||
| 115 | __be32 nfsd_symlink(struct svc_rqst *, struct svc_fh *, | ||
| 116 | char *name, int len, char *path, int plen, | ||
| 117 | struct svc_fh *res, struct iattr *); | ||
| 118 | __be32 nfsd_link(struct svc_rqst *, struct svc_fh *, | ||
| 119 | char *, int, struct svc_fh *); | ||
| 120 | __be32 nfsd_rename(struct svc_rqst *, | ||
| 121 | struct svc_fh *, char *, int, | ||
| 122 | struct svc_fh *, char *, int); | ||
| 123 | __be32 nfsd_remove(struct svc_rqst *, | ||
| 124 | struct svc_fh *, char *, int); | ||
| 125 | __be32 nfsd_unlink(struct svc_rqst *, struct svc_fh *, int type, | ||
| 126 | char *name, int len); | ||
| 127 | int nfsd_truncate(struct svc_rqst *, struct svc_fh *, | ||
| 128 | unsigned long size); | ||
| 129 | __be32 nfsd_readdir(struct svc_rqst *, struct svc_fh *, | ||
| 130 | loff_t *, struct readdir_cd *, filldir_t); | ||
| 131 | __be32 nfsd_statfs(struct svc_rqst *, struct svc_fh *, | ||
| 132 | struct kstatfs *, int access); | ||
| 133 | |||
| 134 | int nfsd_notify_change(struct inode *, struct iattr *); | ||
| 135 | __be32 nfsd_permission(struct svc_rqst *, struct svc_export *, | ||
| 136 | struct dentry *, int); | ||
| 137 | int nfsd_sync_dir(struct dentry *dp); | ||
| 138 | |||
| 139 | #if defined(CONFIG_NFSD_V2_ACL) || defined(CONFIG_NFSD_V3_ACL) | ||
| 140 | #ifdef CONFIG_NFSD_V2_ACL | ||
| 141 | extern struct svc_version nfsd_acl_version2; | ||
| 142 | #else | ||
| 143 | #define nfsd_acl_version2 NULL | ||
| 144 | #endif | ||
| 145 | #ifdef CONFIG_NFSD_V3_ACL | ||
| 146 | extern struct svc_version nfsd_acl_version3; | ||
| 147 | #else | ||
| 148 | #define nfsd_acl_version3 NULL | ||
| 149 | #endif | ||
| 150 | struct posix_acl *nfsd_get_posix_acl(struct svc_fh *, int); | ||
| 151 | int nfsd_set_posix_acl(struct svc_fh *, int, struct posix_acl *); | ||
| 152 | #endif | ||
| 153 | |||
| 154 | enum vers_op {NFSD_SET, NFSD_CLEAR, NFSD_TEST, NFSD_AVAIL }; | ||
| 155 | int nfsd_vers(int vers, enum vers_op change); | ||
| 156 | int nfsd_minorversion(u32 minorversion, enum vers_op change); | ||
| 157 | void nfsd_reset_versions(void); | ||
| 158 | int nfsd_create_serv(void); | ||
| 159 | |||
| 160 | extern int nfsd_max_blksize; | ||
| 161 | |||
| 162 | /* | ||
| 163 | * NFSv4 State | ||
| 164 | */ | ||
| 165 | #ifdef CONFIG_NFSD_V4 | ||
| 166 | extern unsigned int max_delegations; | ||
| 167 | int nfs4_state_init(void); | ||
| 168 | void nfsd4_free_slabs(void); | ||
| 169 | int nfs4_state_start(void); | ||
| 170 | void nfs4_state_shutdown(void); | ||
| 171 | time_t nfs4_lease_time(void); | ||
| 172 | void nfs4_reset_lease(time_t leasetime); | ||
| 173 | int nfs4_reset_recoverydir(char *recdir); | ||
| 174 | #else | ||
| 175 | static inline int nfs4_state_init(void) { return 0; } | ||
| 176 | static inline void nfsd4_free_slabs(void) { } | ||
| 177 | static inline int nfs4_state_start(void) { return 0; } | ||
| 178 | static inline void nfs4_state_shutdown(void) { } | ||
| 179 | static inline time_t nfs4_lease_time(void) { return 0; } | ||
| 180 | static inline void nfs4_reset_lease(time_t leasetime) { } | ||
| 181 | static inline int nfs4_reset_recoverydir(char *recdir) { return 0; } | ||
| 182 | #endif | ||
| 183 | |||
| 184 | /* | ||
| 185 | * lockd binding | ||
| 186 | */ | ||
| 187 | void nfsd_lockd_init(void); | ||
| 188 | void nfsd_lockd_shutdown(void); | ||
| 189 | |||
| 190 | |||
| 191 | /* | ||
| 192 | * These macros provide pre-xdr'ed values for faster operation. | ||
| 193 | */ | ||
| 194 | #define nfs_ok cpu_to_be32(NFS_OK) | ||
| 195 | #define nfserr_perm cpu_to_be32(NFSERR_PERM) | ||
| 196 | #define nfserr_noent cpu_to_be32(NFSERR_NOENT) | ||
| 197 | #define nfserr_io cpu_to_be32(NFSERR_IO) | ||
| 198 | #define nfserr_nxio cpu_to_be32(NFSERR_NXIO) | ||
| 199 | #define nfserr_eagain cpu_to_be32(NFSERR_EAGAIN) | ||
| 200 | #define nfserr_acces cpu_to_be32(NFSERR_ACCES) | ||
| 201 | #define nfserr_exist cpu_to_be32(NFSERR_EXIST) | ||
| 202 | #define nfserr_xdev cpu_to_be32(NFSERR_XDEV) | ||
| 203 | #define nfserr_nodev cpu_to_be32(NFSERR_NODEV) | ||
| 204 | #define nfserr_notdir cpu_to_be32(NFSERR_NOTDIR) | ||
| 205 | #define nfserr_isdir cpu_to_be32(NFSERR_ISDIR) | ||
| 206 | #define nfserr_inval cpu_to_be32(NFSERR_INVAL) | ||
| 207 | #define nfserr_fbig cpu_to_be32(NFSERR_FBIG) | ||
| 208 | #define nfserr_nospc cpu_to_be32(NFSERR_NOSPC) | ||
| 209 | #define nfserr_rofs cpu_to_be32(NFSERR_ROFS) | ||
| 210 | #define nfserr_mlink cpu_to_be32(NFSERR_MLINK) | ||
| 211 | #define nfserr_opnotsupp cpu_to_be32(NFSERR_OPNOTSUPP) | ||
| 212 | #define nfserr_nametoolong cpu_to_be32(NFSERR_NAMETOOLONG) | ||
| 213 | #define nfserr_notempty cpu_to_be32(NFSERR_NOTEMPTY) | ||
| 214 | #define nfserr_dquot cpu_to_be32(NFSERR_DQUOT) | ||
| 215 | #define nfserr_stale cpu_to_be32(NFSERR_STALE) | ||
| 216 | #define nfserr_remote cpu_to_be32(NFSERR_REMOTE) | ||
| 217 | #define nfserr_wflush cpu_to_be32(NFSERR_WFLUSH) | ||
| 218 | #define nfserr_badhandle cpu_to_be32(NFSERR_BADHANDLE) | ||
| 219 | #define nfserr_notsync cpu_to_be32(NFSERR_NOT_SYNC) | ||
| 220 | #define nfserr_badcookie cpu_to_be32(NFSERR_BAD_COOKIE) | ||
| 221 | #define nfserr_notsupp cpu_to_be32(NFSERR_NOTSUPP) | ||
| 222 | #define nfserr_toosmall cpu_to_be32(NFSERR_TOOSMALL) | ||
| 223 | #define nfserr_serverfault cpu_to_be32(NFSERR_SERVERFAULT) | ||
| 224 | #define nfserr_badtype cpu_to_be32(NFSERR_BADTYPE) | ||
| 225 | #define nfserr_jukebox cpu_to_be32(NFSERR_JUKEBOX) | ||
| 226 | #define nfserr_denied cpu_to_be32(NFSERR_DENIED) | ||
| 227 | #define nfserr_deadlock cpu_to_be32(NFSERR_DEADLOCK) | ||
| 228 | #define nfserr_expired cpu_to_be32(NFSERR_EXPIRED) | ||
| 229 | #define nfserr_bad_cookie cpu_to_be32(NFSERR_BAD_COOKIE) | ||
| 230 | #define nfserr_same cpu_to_be32(NFSERR_SAME) | ||
| 231 | #define nfserr_clid_inuse cpu_to_be32(NFSERR_CLID_INUSE) | ||
| 232 | #define nfserr_stale_clientid cpu_to_be32(NFSERR_STALE_CLIENTID) | ||
| 233 | #define nfserr_resource cpu_to_be32(NFSERR_RESOURCE) | ||
| 234 | #define nfserr_moved cpu_to_be32(NFSERR_MOVED) | ||
| 235 | #define nfserr_nofilehandle cpu_to_be32(NFSERR_NOFILEHANDLE) | ||
| 236 | #define nfserr_minor_vers_mismatch cpu_to_be32(NFSERR_MINOR_VERS_MISMATCH) | ||
| 237 | #define nfserr_share_denied cpu_to_be32(NFSERR_SHARE_DENIED) | ||
| 238 | #define nfserr_stale_stateid cpu_to_be32(NFSERR_STALE_STATEID) | ||
| 239 | #define nfserr_old_stateid cpu_to_be32(NFSERR_OLD_STATEID) | ||
| 240 | #define nfserr_bad_stateid cpu_to_be32(NFSERR_BAD_STATEID) | ||
| 241 | #define nfserr_bad_seqid cpu_to_be32(NFSERR_BAD_SEQID) | ||
| 242 | #define nfserr_symlink cpu_to_be32(NFSERR_SYMLINK) | ||
| 243 | #define nfserr_not_same cpu_to_be32(NFSERR_NOT_SAME) | ||
| 244 | #define nfserr_restorefh cpu_to_be32(NFSERR_RESTOREFH) | ||
| 245 | #define nfserr_attrnotsupp cpu_to_be32(NFSERR_ATTRNOTSUPP) | ||
| 246 | #define nfserr_bad_xdr cpu_to_be32(NFSERR_BAD_XDR) | ||
| 247 | #define nfserr_openmode cpu_to_be32(NFSERR_OPENMODE) | ||
| 248 | #define nfserr_locks_held cpu_to_be32(NFSERR_LOCKS_HELD) | ||
| 249 | #define nfserr_op_illegal cpu_to_be32(NFSERR_OP_ILLEGAL) | ||
| 250 | #define nfserr_grace cpu_to_be32(NFSERR_GRACE) | ||
| 251 | #define nfserr_no_grace cpu_to_be32(NFSERR_NO_GRACE) | ||
| 252 | #define nfserr_reclaim_bad cpu_to_be32(NFSERR_RECLAIM_BAD) | ||
| 253 | #define nfserr_badname cpu_to_be32(NFSERR_BADNAME) | ||
| 254 | #define nfserr_cb_path_down cpu_to_be32(NFSERR_CB_PATH_DOWN) | ||
| 255 | #define nfserr_locked cpu_to_be32(NFSERR_LOCKED) | ||
| 256 | #define nfserr_wrongsec cpu_to_be32(NFSERR_WRONGSEC) | ||
| 257 | #define nfserr_badiomode cpu_to_be32(NFS4ERR_BADIOMODE) | ||
| 258 | #define nfserr_badlayout cpu_to_be32(NFS4ERR_BADLAYOUT) | ||
| 259 | #define nfserr_bad_session_digest cpu_to_be32(NFS4ERR_BAD_SESSION_DIGEST) | ||
| 260 | #define nfserr_badsession cpu_to_be32(NFS4ERR_BADSESSION) | ||
| 261 | #define nfserr_badslot cpu_to_be32(NFS4ERR_BADSLOT) | ||
| 262 | #define nfserr_complete_already cpu_to_be32(NFS4ERR_COMPLETE_ALREADY) | ||
| 263 | #define nfserr_conn_not_bound_to_session cpu_to_be32(NFS4ERR_CONN_NOT_BOUND_TO_SESSION) | ||
| 264 | #define nfserr_deleg_already_wanted cpu_to_be32(NFS4ERR_DELEG_ALREADY_WANTED) | ||
| 265 | #define nfserr_back_chan_busy cpu_to_be32(NFS4ERR_BACK_CHAN_BUSY) | ||
| 266 | #define nfserr_layouttrylater cpu_to_be32(NFS4ERR_LAYOUTTRYLATER) | ||
| 267 | #define nfserr_layoutunavailable cpu_to_be32(NFS4ERR_LAYOUTUNAVAILABLE) | ||
| 268 | #define nfserr_nomatching_layout cpu_to_be32(NFS4ERR_NOMATCHING_LAYOUT) | ||
| 269 | #define nfserr_recallconflict cpu_to_be32(NFS4ERR_RECALLCONFLICT) | ||
| 270 | #define nfserr_unknown_layouttype cpu_to_be32(NFS4ERR_UNKNOWN_LAYOUTTYPE) | ||
| 271 | #define nfserr_seq_misordered cpu_to_be32(NFS4ERR_SEQ_MISORDERED) | ||
| 272 | #define nfserr_sequence_pos cpu_to_be32(NFS4ERR_SEQUENCE_POS) | ||
| 273 | #define nfserr_req_too_big cpu_to_be32(NFS4ERR_REQ_TOO_BIG) | ||
| 274 | #define nfserr_rep_too_big cpu_to_be32(NFS4ERR_REP_TOO_BIG) | ||
| 275 | #define nfserr_rep_too_big_to_cache cpu_to_be32(NFS4ERR_REP_TOO_BIG_TO_CACHE) | ||
| 276 | #define nfserr_retry_uncached_rep cpu_to_be32(NFS4ERR_RETRY_UNCACHED_REP) | ||
| 277 | #define nfserr_unsafe_compound cpu_to_be32(NFS4ERR_UNSAFE_COMPOUND) | ||
| 278 | #define nfserr_too_many_ops cpu_to_be32(NFS4ERR_TOO_MANY_OPS) | ||
| 279 | #define nfserr_op_not_in_session cpu_to_be32(NFS4ERR_OP_NOT_IN_SESSION) | ||
| 280 | #define nfserr_hash_alg_unsupp cpu_to_be32(NFS4ERR_HASH_ALG_UNSUPP) | ||
| 281 | #define nfserr_clientid_busy cpu_to_be32(NFS4ERR_CLIENTID_BUSY) | ||
| 282 | #define nfserr_pnfs_io_hole cpu_to_be32(NFS4ERR_PNFS_IO_HOLE) | ||
| 283 | #define nfserr_seq_false_retry cpu_to_be32(NFS4ERR_SEQ_FALSE_RETRY) | ||
| 284 | #define nfserr_bad_high_slot cpu_to_be32(NFS4ERR_BAD_HIGH_SLOT) | ||
| 285 | #define nfserr_deadsession cpu_to_be32(NFS4ERR_DEADSESSION) | ||
| 286 | #define nfserr_encr_alg_unsupp cpu_to_be32(NFS4ERR_ENCR_ALG_UNSUPP) | ||
| 287 | #define nfserr_pnfs_no_layout cpu_to_be32(NFS4ERR_PNFS_NO_LAYOUT) | ||
| 288 | #define nfserr_not_only_op cpu_to_be32(NFS4ERR_NOT_ONLY_OP) | ||
| 289 | #define nfserr_wrong_cred cpu_to_be32(NFS4ERR_WRONG_CRED) | ||
| 290 | #define nfserr_wrong_type cpu_to_be32(NFS4ERR_WRONG_TYPE) | ||
| 291 | #define nfserr_dirdeleg_unavail cpu_to_be32(NFS4ERR_DIRDELEG_UNAVAIL) | ||
| 292 | #define nfserr_reject_deleg cpu_to_be32(NFS4ERR_REJECT_DELEG) | ||
| 293 | #define nfserr_returnconflict cpu_to_be32(NFS4ERR_RETURNCONFLICT) | ||
| 294 | #define nfserr_deleg_revoked cpu_to_be32(NFS4ERR_DELEG_REVOKED) | ||
| 295 | |||
| 296 | /* error codes for internal use */ | ||
| 297 | /* if a request fails due to kmalloc failure, it gets dropped. | ||
| 298 | * Client should resend eventually | ||
| 299 | */ | ||
| 300 | #define nfserr_dropit cpu_to_be32(30000) | ||
| 301 | /* end-of-file indicator in readdir */ | ||
| 302 | #define nfserr_eof cpu_to_be32(30001) | ||
| 303 | /* replay detected */ | ||
| 304 | #define nfserr_replay_me cpu_to_be32(11001) | ||
| 305 | /* nfs41 replay detected */ | ||
| 306 | #define nfserr_replay_cache cpu_to_be32(11002) | ||
| 307 | |||
| 308 | /* Check for dir entries '.' and '..' */ | ||
| 309 | #define isdotent(n, l) (l < 3 && n[0] == '.' && (l == 1 || n[1] == '.')) | ||
| 310 | |||
| 311 | /* | ||
| 312 | * Time of server startup | ||
| 313 | */ | ||
| 314 | extern struct timeval nfssvc_boot; | ||
| 315 | |||
| 316 | #ifdef CONFIG_NFSD_V4 | ||
| 317 | |||
| 318 | /* before processing a COMPOUND operation, we have to check that there | ||
| 319 | * is enough space in the buffer for XDR encode to succeed. otherwise, | ||
| 320 | * we might process an operation with side effects, and be unable to | ||
| 321 | * tell the client that the operation succeeded. | ||
| 322 | * | ||
| 323 | * COMPOUND_SLACK_SPACE - this is the minimum bytes of buffer space | ||
| 324 | * needed to encode an "ordinary" _successful_ operation. (GETATTR, | ||
| 325 | * READ, READDIR, and READLINK have their own buffer checks.) if we | ||
| 326 | * fall below this level, we fail the next operation with NFS4ERR_RESOURCE. | ||
| 327 | * | ||
| 328 | * COMPOUND_ERR_SLACK_SPACE - this is the minimum bytes of buffer space | ||
| 329 | * needed to encode an operation which has failed with NFS4ERR_RESOURCE. | ||
| 330 | * care is taken to ensure that we never fall below this level for any | ||
| 331 | * reason. | ||
| 332 | */ | ||
| 333 | #define COMPOUND_SLACK_SPACE 140 /* OP_GETFH */ | ||
| 334 | #define COMPOUND_ERR_SLACK_SPACE 12 /* OP_SETATTR */ | ||
| 335 | |||
| 336 | #define NFSD_LEASE_TIME (nfs4_lease_time()) | ||
| 337 | #define NFSD_LAUNDROMAT_MINTIMEOUT 10 /* seconds */ | ||
| 338 | |||
| 339 | /* | ||
| 340 | * The following attributes are currently not supported by the NFSv4 server: | ||
| 341 | * ARCHIVE (deprecated anyway) | ||
| 342 | * HIDDEN (unlikely to be supported any time soon) | ||
| 343 | * MIMETYPE (unlikely to be supported any time soon) | ||
| 344 | * QUOTA_* (will be supported in a forthcoming patch) | ||
| 345 | * SYSTEM (unlikely to be supported any time soon) | ||
| 346 | * TIME_BACKUP (unlikely to be supported any time soon) | ||
| 347 | * TIME_CREATE (unlikely to be supported any time soon) | ||
| 348 | */ | ||
| 349 | #define NFSD4_SUPPORTED_ATTRS_WORD0 \ | ||
| 350 | (FATTR4_WORD0_SUPPORTED_ATTRS | FATTR4_WORD0_TYPE | FATTR4_WORD0_FH_EXPIRE_TYPE \ | ||
| 351 | | FATTR4_WORD0_CHANGE | FATTR4_WORD0_SIZE | FATTR4_WORD0_LINK_SUPPORT \ | ||
| 352 | | FATTR4_WORD0_SYMLINK_SUPPORT | FATTR4_WORD0_NAMED_ATTR | FATTR4_WORD0_FSID \ | ||
| 353 | | FATTR4_WORD0_UNIQUE_HANDLES | FATTR4_WORD0_LEASE_TIME | FATTR4_WORD0_RDATTR_ERROR \ | ||
| 354 | | FATTR4_WORD0_ACLSUPPORT | FATTR4_WORD0_CANSETTIME | FATTR4_WORD0_CASE_INSENSITIVE \ | ||
| 355 | | FATTR4_WORD0_CASE_PRESERVING | FATTR4_WORD0_CHOWN_RESTRICTED \ | ||
| 356 | | FATTR4_WORD0_FILEHANDLE | FATTR4_WORD0_FILEID | FATTR4_WORD0_FILES_AVAIL \ | ||
| 357 | | FATTR4_WORD0_FILES_FREE | FATTR4_WORD0_FILES_TOTAL | FATTR4_WORD0_FS_LOCATIONS | FATTR4_WORD0_HOMOGENEOUS \ | ||
| 358 | | FATTR4_WORD0_MAXFILESIZE | FATTR4_WORD0_MAXLINK | FATTR4_WORD0_MAXNAME \ | ||
| 359 | | FATTR4_WORD0_MAXREAD | FATTR4_WORD0_MAXWRITE | FATTR4_WORD0_ACL) | ||
| 360 | |||
| 361 | #define NFSD4_SUPPORTED_ATTRS_WORD1 \ | ||
| 362 | (FATTR4_WORD1_MODE | FATTR4_WORD1_NO_TRUNC | FATTR4_WORD1_NUMLINKS \ | ||
| 363 | | FATTR4_WORD1_OWNER | FATTR4_WORD1_OWNER_GROUP | FATTR4_WORD1_RAWDEV \ | ||
| 364 | | FATTR4_WORD1_SPACE_AVAIL | FATTR4_WORD1_SPACE_FREE | FATTR4_WORD1_SPACE_TOTAL \ | ||
| 365 | | FATTR4_WORD1_SPACE_USED | FATTR4_WORD1_TIME_ACCESS | FATTR4_WORD1_TIME_ACCESS_SET \ | ||
| 366 | | FATTR4_WORD1_TIME_DELTA | FATTR4_WORD1_TIME_METADATA \ | ||
| 367 | | FATTR4_WORD1_TIME_MODIFY | FATTR4_WORD1_TIME_MODIFY_SET | FATTR4_WORD1_MOUNTED_ON_FILEID) | ||
| 368 | |||
| 369 | #define NFSD4_SUPPORTED_ATTRS_WORD2 0 | ||
| 370 | |||
| 371 | #define NFSD4_1_SUPPORTED_ATTRS_WORD0 \ | ||
| 372 | NFSD4_SUPPORTED_ATTRS_WORD0 | ||
| 373 | |||
| 374 | #define NFSD4_1_SUPPORTED_ATTRS_WORD1 \ | ||
| 375 | NFSD4_SUPPORTED_ATTRS_WORD1 | ||
| 376 | |||
| 377 | #define NFSD4_1_SUPPORTED_ATTRS_WORD2 \ | ||
| 378 | (NFSD4_SUPPORTED_ATTRS_WORD2 | FATTR4_WORD2_SUPPATTR_EXCLCREAT) | ||
| 379 | |||
| 380 | static inline u32 nfsd_suppattrs0(u32 minorversion) | ||
| 381 | { | ||
| 382 | return minorversion ? NFSD4_1_SUPPORTED_ATTRS_WORD0 | ||
| 383 | : NFSD4_SUPPORTED_ATTRS_WORD0; | ||
| 384 | } | ||
| 385 | |||
| 386 | static inline u32 nfsd_suppattrs1(u32 minorversion) | ||
| 387 | { | ||
| 388 | return minorversion ? NFSD4_1_SUPPORTED_ATTRS_WORD1 | ||
| 389 | : NFSD4_SUPPORTED_ATTRS_WORD1; | ||
| 390 | } | ||
| 391 | |||
| 392 | static inline u32 nfsd_suppattrs2(u32 minorversion) | ||
| 393 | { | ||
| 394 | return minorversion ? NFSD4_1_SUPPORTED_ATTRS_WORD2 | ||
| 395 | : NFSD4_SUPPORTED_ATTRS_WORD2; | ||
| 396 | } | ||
| 397 | |||
| 398 | /* These will return ERR_INVAL if specified in GETATTR or READDIR. */ | ||
| 399 | #define NFSD_WRITEONLY_ATTRS_WORD1 \ | ||
| 400 | (FATTR4_WORD1_TIME_ACCESS_SET | FATTR4_WORD1_TIME_MODIFY_SET) | ||
| 401 | |||
| 402 | /* These are the only attrs allowed in CREATE/OPEN/SETATTR. */ | ||
| 403 | #define NFSD_WRITEABLE_ATTRS_WORD0 \ | ||
| 404 | (FATTR4_WORD0_SIZE | FATTR4_WORD0_ACL ) | ||
| 405 | #define NFSD_WRITEABLE_ATTRS_WORD1 \ | ||
| 406 | (FATTR4_WORD1_MODE | FATTR4_WORD1_OWNER | FATTR4_WORD1_OWNER_GROUP \ | ||
| 407 | | FATTR4_WORD1_TIME_ACCESS_SET | FATTR4_WORD1_TIME_MODIFY_SET) | ||
| 408 | #define NFSD_WRITEABLE_ATTRS_WORD2 0 | ||
| 409 | |||
| 410 | #define NFSD_SUPPATTR_EXCLCREAT_WORD0 \ | ||
| 411 | NFSD_WRITEABLE_ATTRS_WORD0 | ||
| 412 | /* | ||
| 413 | * we currently store the exclusive create verifier in the v_{a,m}time | ||
| 414 | * attributes so the client can't set these at create time using EXCLUSIVE4_1 | ||
| 415 | */ | ||
| 416 | #define NFSD_SUPPATTR_EXCLCREAT_WORD1 \ | ||
| 417 | (NFSD_WRITEABLE_ATTRS_WORD1 & \ | ||
| 418 | ~(FATTR4_WORD1_TIME_ACCESS_SET | FATTR4_WORD1_TIME_MODIFY_SET)) | ||
| 419 | #define NFSD_SUPPATTR_EXCLCREAT_WORD2 \ | ||
| 420 | NFSD_WRITEABLE_ATTRS_WORD2 | ||
| 421 | |||
| 422 | #endif /* CONFIG_NFSD_V4 */ | ||
| 423 | |||
| 424 | #endif /* LINUX_NFSD_NFSD_H */ | ||
diff --git a/include/linux/nfsd/nfsfh.h b/include/linux/nfsd/nfsfh.h index 8f641c908450..65e333afaee4 100644 --- a/include/linux/nfsd/nfsfh.h +++ b/include/linux/nfsd/nfsfh.h | |||
| @@ -16,11 +16,9 @@ | |||
| 16 | 16 | ||
| 17 | # include <linux/types.h> | 17 | # include <linux/types.h> |
| 18 | #ifdef __KERNEL__ | 18 | #ifdef __KERNEL__ |
| 19 | # include <linux/string.h> | 19 | # include <linux/sunrpc/svc.h> |
| 20 | # include <linux/fs.h> | ||
| 21 | #endif | 20 | #endif |
| 22 | #include <linux/nfsd/const.h> | 21 | #include <linux/nfsd/const.h> |
| 23 | #include <linux/nfsd/debug.h> | ||
| 24 | 22 | ||
| 25 | /* | 23 | /* |
| 26 | * This is the old "dentry style" Linux NFSv2 file handle. | 24 | * This is the old "dentry style" Linux NFSv2 file handle. |
| @@ -164,208 +162,6 @@ typedef struct svc_fh { | |||
| 164 | 162 | ||
| 165 | } svc_fh; | 163 | } svc_fh; |
| 166 | 164 | ||
| 167 | enum nfsd_fsid { | ||
| 168 | FSID_DEV = 0, | ||
| 169 | FSID_NUM, | ||
| 170 | FSID_MAJOR_MINOR, | ||
| 171 | FSID_ENCODE_DEV, | ||
| 172 | FSID_UUID4_INUM, | ||
| 173 | FSID_UUID8, | ||
| 174 | FSID_UUID16, | ||
| 175 | FSID_UUID16_INUM, | ||
| 176 | }; | ||
| 177 | |||
| 178 | enum fsid_source { | ||
| 179 | FSIDSOURCE_DEV, | ||
| 180 | FSIDSOURCE_FSID, | ||
| 181 | FSIDSOURCE_UUID, | ||
| 182 | }; | ||
| 183 | extern enum fsid_source fsid_source(struct svc_fh *fhp); | ||
| 184 | |||
| 185 | |||
| 186 | /* This might look a little large to "inline" but in all calls except | ||
| 187 | * one, 'vers' is constant so moste of the function disappears. | ||
| 188 | */ | ||
| 189 | static inline void mk_fsid(int vers, u32 *fsidv, dev_t dev, ino_t ino, | ||
| 190 | u32 fsid, unsigned char *uuid) | ||
| 191 | { | ||
| 192 | u32 *up; | ||
| 193 | switch(vers) { | ||
| 194 | case FSID_DEV: | ||
| 195 | fsidv[0] = htonl((MAJOR(dev)<<16) | | ||
| 196 | MINOR(dev)); | ||
| 197 | fsidv[1] = ino_t_to_u32(ino); | ||
| 198 | break; | ||
| 199 | case FSID_NUM: | ||
| 200 | fsidv[0] = fsid; | ||
| 201 | break; | ||
| 202 | case FSID_MAJOR_MINOR: | ||
| 203 | fsidv[0] = htonl(MAJOR(dev)); | ||
| 204 | fsidv[1] = htonl(MINOR(dev)); | ||
| 205 | fsidv[2] = ino_t_to_u32(ino); | ||
| 206 | break; | ||
| 207 | |||
| 208 | case FSID_ENCODE_DEV: | ||
| 209 | fsidv[0] = new_encode_dev(dev); | ||
| 210 | fsidv[1] = ino_t_to_u32(ino); | ||
| 211 | break; | ||
| 212 | |||
| 213 | case FSID_UUID4_INUM: | ||
| 214 | /* 4 byte fsid and inode number */ | ||
| 215 | up = (u32*)uuid; | ||
| 216 | fsidv[0] = ino_t_to_u32(ino); | ||
| 217 | fsidv[1] = up[0] ^ up[1] ^ up[2] ^ up[3]; | ||
| 218 | break; | ||
| 219 | |||
| 220 | case FSID_UUID8: | ||
| 221 | /* 8 byte fsid */ | ||
| 222 | up = (u32*)uuid; | ||
| 223 | fsidv[0] = up[0] ^ up[2]; | ||
| 224 | fsidv[1] = up[1] ^ up[3]; | ||
| 225 | break; | ||
| 226 | |||
| 227 | case FSID_UUID16: | ||
| 228 | /* 16 byte fsid - NFSv3+ only */ | ||
| 229 | memcpy(fsidv, uuid, 16); | ||
| 230 | break; | ||
| 231 | |||
| 232 | case FSID_UUID16_INUM: | ||
| 233 | /* 8 byte inode and 16 byte fsid */ | ||
| 234 | *(u64*)fsidv = (u64)ino; | ||
| 235 | memcpy(fsidv+2, uuid, 16); | ||
| 236 | break; | ||
| 237 | default: BUG(); | ||
| 238 | } | ||
| 239 | } | ||
| 240 | |||
| 241 | static inline int key_len(int type) | ||
| 242 | { | ||
| 243 | switch(type) { | ||
| 244 | case FSID_DEV: return 8; | ||
| 245 | case FSID_NUM: return 4; | ||
| 246 | case FSID_MAJOR_MINOR: return 12; | ||
| 247 | case FSID_ENCODE_DEV: return 8; | ||
| 248 | case FSID_UUID4_INUM: return 8; | ||
| 249 | case FSID_UUID8: return 8; | ||
| 250 | case FSID_UUID16: return 16; | ||
| 251 | case FSID_UUID16_INUM: return 24; | ||
| 252 | default: return 0; | ||
| 253 | } | ||
| 254 | } | ||
| 255 | |||
| 256 | /* | ||
| 257 | * Shorthand for dprintk()'s | ||
| 258 | */ | ||
| 259 | extern char * SVCFH_fmt(struct svc_fh *fhp); | ||
| 260 | |||
| 261 | /* | ||
| 262 | * Function prototypes | ||
| 263 | */ | ||
| 264 | __be32 fh_verify(struct svc_rqst *, struct svc_fh *, int, int); | ||
| 265 | __be32 fh_compose(struct svc_fh *, struct svc_export *, struct dentry *, struct svc_fh *); | ||
| 266 | __be32 fh_update(struct svc_fh *); | ||
| 267 | void fh_put(struct svc_fh *); | ||
| 268 | |||
| 269 | static __inline__ struct svc_fh * | ||
| 270 | fh_copy(struct svc_fh *dst, struct svc_fh *src) | ||
| 271 | { | ||
| 272 | WARN_ON(src->fh_dentry || src->fh_locked); | ||
| 273 | |||
| 274 | *dst = *src; | ||
| 275 | return dst; | ||
| 276 | } | ||
| 277 | |||
| 278 | static inline void | ||
| 279 | fh_copy_shallow(struct knfsd_fh *dst, struct knfsd_fh *src) | ||
| 280 | { | ||
| 281 | dst->fh_size = src->fh_size; | ||
| 282 | memcpy(&dst->fh_base, &src->fh_base, src->fh_size); | ||
| 283 | } | ||
| 284 | |||
| 285 | static __inline__ struct svc_fh * | ||
| 286 | fh_init(struct svc_fh *fhp, int maxsize) | ||
| 287 | { | ||
| 288 | memset(fhp, 0, sizeof(*fhp)); | ||
| 289 | fhp->fh_maxsize = maxsize; | ||
| 290 | return fhp; | ||
| 291 | } | ||
| 292 | |||
| 293 | #ifdef CONFIG_NFSD_V3 | ||
| 294 | /* | ||
| 295 | * Fill in the pre_op attr for the wcc data | ||
| 296 | */ | ||
| 297 | static inline void | ||
| 298 | fill_pre_wcc(struct svc_fh *fhp) | ||
| 299 | { | ||
| 300 | struct inode *inode; | ||
| 301 | |||
| 302 | inode = fhp->fh_dentry->d_inode; | ||
| 303 | if (!fhp->fh_pre_saved) { | ||
| 304 | fhp->fh_pre_mtime = inode->i_mtime; | ||
| 305 | fhp->fh_pre_ctime = inode->i_ctime; | ||
| 306 | fhp->fh_pre_size = inode->i_size; | ||
| 307 | fhp->fh_pre_change = inode->i_version; | ||
| 308 | fhp->fh_pre_saved = 1; | ||
| 309 | } | ||
| 310 | } | ||
| 311 | |||
| 312 | extern void fill_post_wcc(struct svc_fh *); | ||
| 313 | #else | ||
| 314 | #define fill_pre_wcc(ignored) | ||
| 315 | #define fill_post_wcc(notused) | ||
| 316 | #endif /* CONFIG_NFSD_V3 */ | ||
| 317 | |||
| 318 | |||
| 319 | /* | ||
| 320 | * Lock a file handle/inode | ||
| 321 | * NOTE: both fh_lock and fh_unlock are done "by hand" in | ||
| 322 | * vfs.c:nfsd_rename as it needs to grab 2 i_mutex's at once | ||
| 323 | * so, any changes here should be reflected there. | ||
| 324 | */ | ||
| 325 | |||
| 326 | static inline void | ||
| 327 | fh_lock_nested(struct svc_fh *fhp, unsigned int subclass) | ||
| 328 | { | ||
| 329 | struct dentry *dentry = fhp->fh_dentry; | ||
| 330 | struct inode *inode; | ||
| 331 | |||
| 332 | dfprintk(FILEOP, "nfsd: fh_lock(%s) locked = %d\n", | ||
| 333 | SVCFH_fmt(fhp), fhp->fh_locked); | ||
| 334 | |||
| 335 | BUG_ON(!dentry); | ||
| 336 | |||
| 337 | if (fhp->fh_locked) { | ||
| 338 | printk(KERN_WARNING "fh_lock: %s/%s already locked!\n", | ||
| 339 | dentry->d_parent->d_name.name, dentry->d_name.name); | ||
| 340 | return; | ||
| 341 | } | ||
| 342 | |||
| 343 | inode = dentry->d_inode; | ||
| 344 | mutex_lock_nested(&inode->i_mutex, subclass); | ||
| 345 | fill_pre_wcc(fhp); | ||
| 346 | fhp->fh_locked = 1; | ||
| 347 | } | ||
| 348 | |||
| 349 | static inline void | ||
| 350 | fh_lock(struct svc_fh *fhp) | ||
| 351 | { | ||
| 352 | fh_lock_nested(fhp, I_MUTEX_NORMAL); | ||
| 353 | } | ||
| 354 | |||
| 355 | /* | ||
| 356 | * Unlock a file handle/inode | ||
| 357 | */ | ||
| 358 | static inline void | ||
| 359 | fh_unlock(struct svc_fh *fhp) | ||
| 360 | { | ||
| 361 | BUG_ON(!fhp->fh_dentry); | ||
| 362 | |||
| 363 | if (fhp->fh_locked) { | ||
| 364 | fill_post_wcc(fhp); | ||
| 365 | mutex_unlock(&fhp->fh_dentry->d_inode->i_mutex); | ||
| 366 | fhp->fh_locked = 0; | ||
| 367 | } | ||
| 368 | } | ||
| 369 | #endif /* __KERNEL__ */ | 165 | #endif /* __KERNEL__ */ |
| 370 | 166 | ||
| 371 | 167 | ||
diff --git a/include/linux/nfsd/state.h b/include/linux/nfsd/state.h deleted file mode 100644 index b38d11324189..000000000000 --- a/include/linux/nfsd/state.h +++ /dev/null | |||
| @@ -1,404 +0,0 @@ | |||
| 1 | /* | ||
| 2 | * linux/include/nfsd/state.h | ||
| 3 | * | ||
| 4 | * Copyright (c) 2001 The Regents of the University of Michigan. | ||
| 5 | * All rights reserved. | ||
| 6 | * | ||
| 7 | * Kendrick Smith <kmsmith@umich.edu> | ||
| 8 | * Andy Adamson <andros@umich.edu> | ||
| 9 | * | ||
| 10 | * Redistribution and use in source and binary forms, with or without | ||
| 11 | * modification, are permitted provided that the following conditions | ||
| 12 | * are met: | ||
| 13 | * | ||
| 14 | * 1. Redistributions of source code must retain the above copyright | ||
| 15 | * notice, this list of conditions and the following disclaimer. | ||
| 16 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 17 | * notice, this list of conditions and the following disclaimer in the | ||
| 18 | * documentation and/or other materials provided with the distribution. | ||
| 19 | * 3. Neither the name of the University nor the names of its | ||
| 20 | * contributors may be used to endorse or promote products derived | ||
| 21 | * from this software without specific prior written permission. | ||
| 22 | * | ||
| 23 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED | ||
| 24 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF | ||
| 25 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
| 26 | * DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | ||
| 27 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | ||
| 28 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | ||
| 29 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR | ||
| 30 | * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF | ||
| 31 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | ||
| 32 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
| 33 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
| 34 | * | ||
| 35 | */ | ||
| 36 | |||
| 37 | #ifndef _NFSD4_STATE_H | ||
| 38 | #define _NFSD4_STATE_H | ||
| 39 | |||
| 40 | #include <linux/list.h> | ||
| 41 | #include <linux/kref.h> | ||
| 42 | #include <linux/sunrpc/clnt.h> | ||
| 43 | |||
| 44 | typedef struct { | ||
| 45 | u32 cl_boot; | ||
| 46 | u32 cl_id; | ||
| 47 | } clientid_t; | ||
| 48 | |||
| 49 | typedef struct { | ||
| 50 | u32 so_boot; | ||
| 51 | u32 so_stateownerid; | ||
| 52 | u32 so_fileid; | ||
| 53 | } stateid_opaque_t; | ||
| 54 | |||
| 55 | typedef struct { | ||
| 56 | u32 si_generation; | ||
| 57 | stateid_opaque_t si_opaque; | ||
| 58 | } stateid_t; | ||
| 59 | #define si_boot si_opaque.so_boot | ||
| 60 | #define si_stateownerid si_opaque.so_stateownerid | ||
| 61 | #define si_fileid si_opaque.so_fileid | ||
| 62 | |||
| 63 | struct nfsd4_cb_sequence { | ||
| 64 | /* args/res */ | ||
| 65 | u32 cbs_minorversion; | ||
| 66 | struct nfs4_client *cbs_clp; | ||
| 67 | }; | ||
| 68 | |||
| 69 | struct nfs4_delegation { | ||
| 70 | struct list_head dl_perfile; | ||
| 71 | struct list_head dl_perclnt; | ||
| 72 | struct list_head dl_recall_lru; /* delegation recalled */ | ||
| 73 | atomic_t dl_count; /* ref count */ | ||
| 74 | struct nfs4_client *dl_client; | ||
| 75 | struct nfs4_file *dl_file; | ||
| 76 | struct file_lock *dl_flock; | ||
| 77 | struct file *dl_vfs_file; | ||
| 78 | u32 dl_type; | ||
| 79 | time_t dl_time; | ||
| 80 | /* For recall: */ | ||
| 81 | u32 dl_ident; | ||
| 82 | stateid_t dl_stateid; | ||
| 83 | struct knfsd_fh dl_fh; | ||
| 84 | int dl_retries; | ||
| 85 | }; | ||
| 86 | |||
| 87 | /* client delegation callback info */ | ||
| 88 | struct nfs4_cb_conn { | ||
| 89 | /* SETCLIENTID info */ | ||
| 90 | struct sockaddr_storage cb_addr; | ||
| 91 | size_t cb_addrlen; | ||
| 92 | u32 cb_prog; | ||
| 93 | u32 cb_minorversion; | ||
| 94 | u32 cb_ident; /* minorversion 0 only */ | ||
| 95 | /* RPC client info */ | ||
| 96 | atomic_t cb_set; /* successful CB_NULL call */ | ||
| 97 | struct rpc_clnt * cb_client; | ||
| 98 | }; | ||
| 99 | |||
| 100 | /* Maximum number of slots per session. 160 is useful for long haul TCP */ | ||
| 101 | #define NFSD_MAX_SLOTS_PER_SESSION 160 | ||
| 102 | /* Maximum number of operations per session compound */ | ||
| 103 | #define NFSD_MAX_OPS_PER_COMPOUND 16 | ||
| 104 | /* Maximum session per slot cache size */ | ||
| 105 | #define NFSD_SLOT_CACHE_SIZE 1024 | ||
| 106 | /* Maximum number of NFSD_SLOT_CACHE_SIZE slots per session */ | ||
| 107 | #define NFSD_CACHE_SIZE_SLOTS_PER_SESSION 32 | ||
| 108 | #define NFSD_MAX_MEM_PER_SESSION \ | ||
| 109 | (NFSD_CACHE_SIZE_SLOTS_PER_SESSION * NFSD_SLOT_CACHE_SIZE) | ||
| 110 | |||
| 111 | struct nfsd4_slot { | ||
| 112 | bool sl_inuse; | ||
| 113 | bool sl_cachethis; | ||
| 114 | u16 sl_opcnt; | ||
| 115 | u32 sl_seqid; | ||
| 116 | __be32 sl_status; | ||
| 117 | u32 sl_datalen; | ||
| 118 | char sl_data[]; | ||
| 119 | }; | ||
| 120 | |||
| 121 | struct nfsd4_channel_attrs { | ||
| 122 | u32 headerpadsz; | ||
| 123 | u32 maxreq_sz; | ||
| 124 | u32 maxresp_sz; | ||
| 125 | u32 maxresp_cached; | ||
| 126 | u32 maxops; | ||
| 127 | u32 maxreqs; | ||
| 128 | u32 nr_rdma_attrs; | ||
| 129 | u32 rdma_attrs; | ||
| 130 | }; | ||
| 131 | |||
| 132 | struct nfsd4_create_session { | ||
| 133 | clientid_t clientid; | ||
| 134 | struct nfs4_sessionid sessionid; | ||
| 135 | u32 seqid; | ||
| 136 | u32 flags; | ||
| 137 | struct nfsd4_channel_attrs fore_channel; | ||
| 138 | struct nfsd4_channel_attrs back_channel; | ||
| 139 | u32 callback_prog; | ||
| 140 | u32 uid; | ||
| 141 | u32 gid; | ||
| 142 | }; | ||
| 143 | |||
| 144 | /* The single slot clientid cache structure */ | ||
| 145 | struct nfsd4_clid_slot { | ||
| 146 | u32 sl_seqid; | ||
| 147 | __be32 sl_status; | ||
| 148 | struct nfsd4_create_session sl_cr_ses; | ||
| 149 | }; | ||
| 150 | |||
| 151 | struct nfsd4_session { | ||
| 152 | struct kref se_ref; | ||
| 153 | struct list_head se_hash; /* hash by sessionid */ | ||
| 154 | struct list_head se_perclnt; | ||
| 155 | u32 se_flags; | ||
| 156 | struct nfs4_client *se_client; /* for expire_client */ | ||
| 157 | struct nfs4_sessionid se_sessionid; | ||
| 158 | struct nfsd4_channel_attrs se_fchannel; | ||
| 159 | struct nfsd4_channel_attrs se_bchannel; | ||
| 160 | struct nfsd4_slot *se_slots[]; /* forward channel slots */ | ||
| 161 | }; | ||
| 162 | |||
| 163 | static inline void | ||
| 164 | nfsd4_put_session(struct nfsd4_session *ses) | ||
| 165 | { | ||
| 166 | extern void free_session(struct kref *kref); | ||
| 167 | kref_put(&ses->se_ref, free_session); | ||
| 168 | } | ||
| 169 | |||
| 170 | static inline void | ||
| 171 | nfsd4_get_session(struct nfsd4_session *ses) | ||
| 172 | { | ||
| 173 | kref_get(&ses->se_ref); | ||
| 174 | } | ||
| 175 | |||
| 176 | /* formatted contents of nfs4_sessionid */ | ||
| 177 | struct nfsd4_sessionid { | ||
| 178 | clientid_t clientid; | ||
| 179 | u32 sequence; | ||
| 180 | u32 reserved; | ||
| 181 | }; | ||
| 182 | |||
| 183 | #define HEXDIR_LEN 33 /* hex version of 16 byte md5 of cl_name plus '\0' */ | ||
| 184 | |||
| 185 | /* | ||
| 186 | * struct nfs4_client - one per client. Clientids live here. | ||
| 187 | * o Each nfs4_client is hashed by clientid. | ||
| 188 | * | ||
| 189 | * o Each nfs4_clients is also hashed by name | ||
| 190 | * (the opaque quantity initially sent by the client to identify itself). | ||
| 191 | * | ||
| 192 | * o cl_perclient list is used to ensure no dangling stateowner references | ||
| 193 | * when we expire the nfs4_client | ||
| 194 | */ | ||
| 195 | struct nfs4_client { | ||
| 196 | struct list_head cl_idhash; /* hash by cl_clientid.id */ | ||
| 197 | struct list_head cl_strhash; /* hash by cl_name */ | ||
| 198 | struct list_head cl_openowners; | ||
| 199 | struct list_head cl_delegations; | ||
| 200 | struct list_head cl_lru; /* tail queue */ | ||
| 201 | struct xdr_netobj cl_name; /* id generated by client */ | ||
| 202 | char cl_recdir[HEXDIR_LEN]; /* recovery dir */ | ||
| 203 | nfs4_verifier cl_verifier; /* generated by client */ | ||
| 204 | time_t cl_time; /* time of last lease renewal */ | ||
| 205 | struct sockaddr_storage cl_addr; /* client ipaddress */ | ||
| 206 | u32 cl_flavor; /* setclientid pseudoflavor */ | ||
| 207 | char *cl_principal; /* setclientid principal name */ | ||
| 208 | struct svc_cred cl_cred; /* setclientid principal */ | ||
| 209 | clientid_t cl_clientid; /* generated by server */ | ||
| 210 | nfs4_verifier cl_confirm; /* generated by server */ | ||
| 211 | struct nfs4_cb_conn cl_cb_conn; /* callback info */ | ||
| 212 | atomic_t cl_count; /* ref count */ | ||
| 213 | u32 cl_firststate; /* recovery dir creation */ | ||
| 214 | |||
| 215 | /* for nfs41 */ | ||
| 216 | struct list_head cl_sessions; | ||
| 217 | struct nfsd4_clid_slot cl_cs_slot; /* create_session slot */ | ||
| 218 | u32 cl_exchange_flags; | ||
| 219 | struct nfs4_sessionid cl_sessionid; | ||
| 220 | |||
| 221 | /* for nfs41 callbacks */ | ||
| 222 | /* We currently support a single back channel with a single slot */ | ||
| 223 | unsigned long cl_cb_slot_busy; | ||
| 224 | u32 cl_cb_seq_nr; | ||
| 225 | struct svc_xprt *cl_cb_xprt; /* 4.1 callback transport */ | ||
| 226 | struct rpc_wait_queue cl_cb_waitq; /* backchannel callers may */ | ||
| 227 | /* wait here for slots */ | ||
| 228 | }; | ||
| 229 | |||
| 230 | /* struct nfs4_client_reset | ||
| 231 | * one per old client. Populates reset_str_hashtbl. Filled from conf_id_hashtbl | ||
| 232 | * upon lease reset, or from upcall to state_daemon (to read in state | ||
| 233 | * from non-volitile storage) upon reboot. | ||
| 234 | */ | ||
| 235 | struct nfs4_client_reclaim { | ||
| 236 | struct list_head cr_strhash; /* hash by cr_name */ | ||
| 237 | char cr_recdir[HEXDIR_LEN]; /* recover dir */ | ||
| 238 | }; | ||
| 239 | |||
| 240 | static inline void | ||
| 241 | update_stateid(stateid_t *stateid) | ||
| 242 | { | ||
| 243 | stateid->si_generation++; | ||
| 244 | } | ||
| 245 | |||
| 246 | /* A reasonable value for REPLAY_ISIZE was estimated as follows: | ||
| 247 | * The OPEN response, typically the largest, requires | ||
| 248 | * 4(status) + 8(stateid) + 20(changeinfo) + 4(rflags) + 8(verifier) + | ||
| 249 | * 4(deleg. type) + 8(deleg. stateid) + 4(deleg. recall flag) + | ||
| 250 | * 20(deleg. space limit) + ~32(deleg. ace) = 112 bytes | ||
| 251 | */ | ||
| 252 | |||
| 253 | #define NFSD4_REPLAY_ISIZE 112 | ||
| 254 | |||
| 255 | /* | ||
| 256 | * Replay buffer, where the result of the last seqid-mutating operation | ||
| 257 | * is cached. | ||
| 258 | */ | ||
| 259 | struct nfs4_replay { | ||
| 260 | __be32 rp_status; | ||
| 261 | unsigned int rp_buflen; | ||
| 262 | char *rp_buf; | ||
| 263 | unsigned intrp_allocated; | ||
| 264 | struct knfsd_fh rp_openfh; | ||
| 265 | char rp_ibuf[NFSD4_REPLAY_ISIZE]; | ||
| 266 | }; | ||
| 267 | |||
| 268 | /* | ||
| 269 | * nfs4_stateowner can either be an open_owner, or a lock_owner | ||
| 270 | * | ||
| 271 | * so_idhash: stateid_hashtbl[] for open owner, lockstateid_hashtbl[] | ||
| 272 | * for lock_owner | ||
| 273 | * so_strhash: ownerstr_hashtbl[] for open_owner, lock_ownerstr_hashtbl[] | ||
| 274 | * for lock_owner | ||
| 275 | * so_perclient: nfs4_client->cl_perclient entry - used when nfs4_client | ||
| 276 | * struct is reaped. | ||
| 277 | * so_perfilestate: heads the list of nfs4_stateid (either open or lock) | ||
| 278 | * and is used to ensure no dangling nfs4_stateid references when we | ||
| 279 | * release a stateowner. | ||
| 280 | * so_perlockowner: (open) nfs4_stateid->st_perlockowner entry - used when | ||
| 281 | * close is called to reap associated byte-range locks | ||
| 282 | * so_close_lru: (open) stateowner is placed on this list instead of being | ||
| 283 | * reaped (when so_perfilestate is empty) to hold the last close replay. | ||
| 284 | * reaped by laundramat thread after lease period. | ||
| 285 | */ | ||
| 286 | struct nfs4_stateowner { | ||
| 287 | struct kref so_ref; | ||
| 288 | struct list_head so_idhash; /* hash by so_id */ | ||
| 289 | struct list_head so_strhash; /* hash by op_name */ | ||
| 290 | struct list_head so_perclient; | ||
| 291 | struct list_head so_stateids; | ||
| 292 | struct list_head so_perstateid; /* for lockowners only */ | ||
| 293 | struct list_head so_close_lru; /* tail queue */ | ||
| 294 | time_t so_time; /* time of placement on so_close_lru */ | ||
| 295 | int so_is_open_owner; /* 1=openowner,0=lockowner */ | ||
| 296 | u32 so_id; | ||
| 297 | struct nfs4_client * so_client; | ||
| 298 | /* after increment in ENCODE_SEQID_OP_TAIL, represents the next | ||
| 299 | * sequence id expected from the client: */ | ||
| 300 | u32 so_seqid; | ||
| 301 | struct xdr_netobj so_owner; /* open owner name */ | ||
| 302 | int so_confirmed; /* successful OPEN_CONFIRM? */ | ||
| 303 | struct nfs4_replay so_replay; | ||
| 304 | }; | ||
| 305 | |||
| 306 | /* | ||
| 307 | * nfs4_file: a file opened by some number of (open) nfs4_stateowners. | ||
| 308 | * o fi_perfile list is used to search for conflicting | ||
| 309 | * share_acces, share_deny on the file. | ||
| 310 | */ | ||
| 311 | struct nfs4_file { | ||
| 312 | atomic_t fi_ref; | ||
| 313 | struct list_head fi_hash; /* hash by "struct inode *" */ | ||
| 314 | struct list_head fi_stateids; | ||
| 315 | struct list_head fi_delegations; | ||
| 316 | struct inode *fi_inode; | ||
| 317 | u32 fi_id; /* used with stateowner->so_id | ||
| 318 | * for stateid_hashtbl hash */ | ||
| 319 | bool fi_had_conflict; | ||
| 320 | }; | ||
| 321 | |||
| 322 | /* | ||
| 323 | * nfs4_stateid can either be an open stateid or (eventually) a lock stateid | ||
| 324 | * | ||
| 325 | * (open)nfs4_stateid: one per (open)nfs4_stateowner, nfs4_file | ||
| 326 | * | ||
| 327 | * st_hash: stateid_hashtbl[] entry or lockstateid_hashtbl entry | ||
| 328 | * st_perfile: file_hashtbl[] entry. | ||
| 329 | * st_perfile_state: nfs4_stateowner->so_perfilestate | ||
| 330 | * st_perlockowner: (open stateid) list of lock nfs4_stateowners | ||
| 331 | * st_access_bmap: used only for open stateid | ||
| 332 | * st_deny_bmap: used only for open stateid | ||
| 333 | * st_openstp: open stateid lock stateid was derived from | ||
| 334 | * | ||
| 335 | * XXX: open stateids and lock stateids have diverged sufficiently that | ||
| 336 | * we should consider defining separate structs for the two cases. | ||
| 337 | */ | ||
| 338 | |||
| 339 | struct nfs4_stateid { | ||
| 340 | struct list_head st_hash; | ||
| 341 | struct list_head st_perfile; | ||
| 342 | struct list_head st_perstateowner; | ||
| 343 | struct list_head st_lockowners; | ||
| 344 | struct nfs4_stateowner * st_stateowner; | ||
| 345 | struct nfs4_file * st_file; | ||
| 346 | stateid_t st_stateid; | ||
| 347 | struct file * st_vfs_file; | ||
| 348 | unsigned long st_access_bmap; | ||
| 349 | unsigned long st_deny_bmap; | ||
| 350 | struct nfs4_stateid * st_openstp; | ||
| 351 | }; | ||
| 352 | |||
| 353 | /* flags for preprocess_seqid_op() */ | ||
| 354 | #define HAS_SESSION 0x00000001 | ||
| 355 | #define CONFIRM 0x00000002 | ||
| 356 | #define OPEN_STATE 0x00000004 | ||
| 357 | #define LOCK_STATE 0x00000008 | ||
| 358 | #define RD_STATE 0x00000010 | ||
| 359 | #define WR_STATE 0x00000020 | ||
| 360 | #define CLOSE_STATE 0x00000040 | ||
| 361 | |||
| 362 | #define seqid_mutating_err(err) \ | ||
| 363 | (((err) != nfserr_stale_clientid) && \ | ||
| 364 | ((err) != nfserr_bad_seqid) && \ | ||
| 365 | ((err) != nfserr_stale_stateid) && \ | ||
| 366 | ((err) != nfserr_bad_stateid)) | ||
| 367 | |||
| 368 | struct nfsd4_compound_state; | ||
| 369 | |||
| 370 | extern __be32 nfs4_preprocess_stateid_op(struct nfsd4_compound_state *cstate, | ||
| 371 | stateid_t *stateid, int flags, struct file **filp); | ||
| 372 | extern void nfs4_lock_state(void); | ||
| 373 | extern void nfs4_unlock_state(void); | ||
| 374 | extern int nfs4_in_grace(void); | ||
| 375 | extern __be32 nfs4_check_open_reclaim(clientid_t *clid); | ||
| 376 | extern void put_nfs4_client(struct nfs4_client *clp); | ||
| 377 | extern void nfs4_free_stateowner(struct kref *kref); | ||
| 378 | extern int set_callback_cred(void); | ||
| 379 | extern void nfsd4_probe_callback(struct nfs4_client *clp); | ||
| 380 | extern void nfsd4_cb_recall(struct nfs4_delegation *dp); | ||
| 381 | extern void nfs4_put_delegation(struct nfs4_delegation *dp); | ||
| 382 | extern __be32 nfs4_make_rec_clidname(char *clidname, struct xdr_netobj *clname); | ||
| 383 | extern void nfsd4_init_recdir(char *recdir_name); | ||
| 384 | extern int nfsd4_recdir_load(void); | ||
| 385 | extern void nfsd4_shutdown_recdir(void); | ||
| 386 | extern int nfs4_client_to_reclaim(const char *name); | ||
| 387 | extern int nfs4_has_reclaimed_state(const char *name, bool use_exchange_id); | ||
| 388 | extern void nfsd4_recdir_purge_old(void); | ||
| 389 | extern int nfsd4_create_clid_dir(struct nfs4_client *clp); | ||
| 390 | extern void nfsd4_remove_clid_dir(struct nfs4_client *clp); | ||
| 391 | |||
| 392 | static inline void | ||
| 393 | nfs4_put_stateowner(struct nfs4_stateowner *so) | ||
| 394 | { | ||
| 395 | kref_put(&so->so_ref, nfs4_free_stateowner); | ||
| 396 | } | ||
| 397 | |||
| 398 | static inline void | ||
| 399 | nfs4_get_stateowner(struct nfs4_stateowner *so) | ||
| 400 | { | ||
| 401 | kref_get(&so->so_ref); | ||
| 402 | } | ||
| 403 | |||
| 404 | #endif /* NFSD4_STATE_H */ | ||
diff --git a/include/linux/nfsd/syscall.h b/include/linux/nfsd/syscall.h index 7a3b565b898f..812bc1e160dc 100644 --- a/include/linux/nfsd/syscall.h +++ b/include/linux/nfsd/syscall.h | |||
| @@ -9,14 +9,8 @@ | |||
| 9 | #ifndef NFSD_SYSCALL_H | 9 | #ifndef NFSD_SYSCALL_H |
| 10 | #define NFSD_SYSCALL_H | 10 | #define NFSD_SYSCALL_H |
| 11 | 11 | ||
| 12 | # include <linux/types.h> | 12 | #include <linux/types.h> |
| 13 | #ifdef __KERNEL__ | ||
| 14 | # include <linux/in.h> | ||
| 15 | #endif | ||
| 16 | #include <linux/posix_types.h> | ||
| 17 | #include <linux/nfsd/const.h> | ||
| 18 | #include <linux/nfsd/export.h> | 13 | #include <linux/nfsd/export.h> |
| 19 | #include <linux/nfsd/nfsfh.h> | ||
| 20 | 14 | ||
| 21 | /* | 15 | /* |
| 22 | * Version of the syscall interface | 16 | * Version of the syscall interface |
diff --git a/include/linux/nfsd/xdr.h b/include/linux/nfsd/xdr.h deleted file mode 100644 index a0132ef58f21..000000000000 --- a/include/linux/nfsd/xdr.h +++ /dev/null | |||
| @@ -1,177 +0,0 @@ | |||
| 1 | /* | ||
| 2 | * linux/include/linux/nfsd/xdr.h | ||
| 3 | * | ||
| 4 | * XDR types for nfsd. This is mainly a typing exercise. | ||
| 5 | */ | ||
| 6 | |||
| 7 | #ifndef LINUX_NFSD_H | ||
| 8 | #define LINUX_NFSD_H | ||
| 9 | |||
| 10 | #include <linux/fs.h> | ||
| 11 | #include <linux/vfs.h> | ||
| 12 | #include <linux/nfs.h> | ||
| 13 | |||
| 14 | struct nfsd_fhandle { | ||
| 15 | struct svc_fh fh; | ||
| 16 | }; | ||
| 17 | |||
| 18 | struct nfsd_sattrargs { | ||
| 19 | struct svc_fh fh; | ||
| 20 | struct iattr attrs; | ||
| 21 | }; | ||
| 22 | |||
| 23 | struct nfsd_diropargs { | ||
| 24 | struct svc_fh fh; | ||
| 25 | char * name; | ||
| 26 | unsigned int len; | ||
| 27 | }; | ||
| 28 | |||
| 29 | struct nfsd_readargs { | ||
| 30 | struct svc_fh fh; | ||
| 31 | __u32 offset; | ||
| 32 | __u32 count; | ||
| 33 | int vlen; | ||
| 34 | }; | ||
| 35 | |||
| 36 | struct nfsd_writeargs { | ||
| 37 | svc_fh fh; | ||
| 38 | __u32 offset; | ||
| 39 | int len; | ||
| 40 | int vlen; | ||
| 41 | }; | ||
| 42 | |||
| 43 | struct nfsd_createargs { | ||
| 44 | struct svc_fh fh; | ||
| 45 | char * name; | ||
| 46 | unsigned int len; | ||
| 47 | struct iattr attrs; | ||
| 48 | }; | ||
| 49 | |||
| 50 | struct nfsd_renameargs { | ||
| 51 | struct svc_fh ffh; | ||
| 52 | char * fname; | ||
| 53 | unsigned int flen; | ||
| 54 | struct svc_fh tfh; | ||
| 55 | char * tname; | ||
| 56 | unsigned int tlen; | ||
| 57 | }; | ||
| 58 | |||
| 59 | struct nfsd_readlinkargs { | ||
| 60 | struct svc_fh fh; | ||
| 61 | char * buffer; | ||
| 62 | }; | ||
| 63 | |||
| 64 | struct nfsd_linkargs { | ||
| 65 | struct svc_fh ffh; | ||
| 66 | struct svc_fh tfh; | ||
| 67 | char * tname; | ||
| 68 | unsigned int tlen; | ||
| 69 | }; | ||
| 70 | |||
| 71 | struct nfsd_symlinkargs { | ||
| 72 | struct svc_fh ffh; | ||
| 73 | char * fname; | ||
| 74 | unsigned int flen; | ||
| 75 | char * tname; | ||
| 76 | unsigned int tlen; | ||
| 77 | struct iattr attrs; | ||
| 78 | }; | ||
| 79 | |||
| 80 | struct nfsd_readdirargs { | ||
| 81 | struct svc_fh fh; | ||
| 82 | __u32 cookie; | ||
| 83 | __u32 count; | ||
| 84 | __be32 * buffer; | ||
| 85 | }; | ||
| 86 | |||
| 87 | struct nfsd_attrstat { | ||
| 88 | struct svc_fh fh; | ||
| 89 | struct kstat stat; | ||
| 90 | }; | ||
| 91 | |||
| 92 | struct nfsd_diropres { | ||
| 93 | struct svc_fh fh; | ||
| 94 | struct kstat stat; | ||
| 95 | }; | ||
| 96 | |||
| 97 | struct nfsd_readlinkres { | ||
| 98 | int len; | ||
| 99 | }; | ||
| 100 | |||
| 101 | struct nfsd_readres { | ||
| 102 | struct svc_fh fh; | ||
| 103 | unsigned long count; | ||
| 104 | struct kstat stat; | ||
| 105 | }; | ||
| 106 | |||
| 107 | struct nfsd_readdirres { | ||
| 108 | int count; | ||
| 109 | |||
| 110 | struct readdir_cd common; | ||
| 111 | __be32 * buffer; | ||
| 112 | int buflen; | ||
| 113 | __be32 * offset; | ||
| 114 | }; | ||
| 115 | |||
| 116 | struct nfsd_statfsres { | ||
| 117 | struct kstatfs stats; | ||
| 118 | }; | ||
| 119 | |||
| 120 | /* | ||
| 121 | * Storage requirements for XDR arguments and results. | ||
| 122 | */ | ||
| 123 | union nfsd_xdrstore { | ||
| 124 | struct nfsd_sattrargs sattr; | ||
| 125 | struct nfsd_diropargs dirop; | ||
| 126 | struct nfsd_readargs read; | ||
| 127 | struct nfsd_writeargs write; | ||
| 128 | struct nfsd_createargs create; | ||
| 129 | struct nfsd_renameargs rename; | ||
| 130 | struct nfsd_linkargs link; | ||
| 131 | struct nfsd_symlinkargs symlink; | ||
| 132 | struct nfsd_readdirargs readdir; | ||
| 133 | }; | ||
| 134 | |||
| 135 | #define NFS2_SVC_XDRSIZE sizeof(union nfsd_xdrstore) | ||
| 136 | |||
| 137 | |||
| 138 | int nfssvc_decode_void(struct svc_rqst *, __be32 *, void *); | ||
| 139 | int nfssvc_decode_fhandle(struct svc_rqst *, __be32 *, struct nfsd_fhandle *); | ||
| 140 | int nfssvc_decode_sattrargs(struct svc_rqst *, __be32 *, | ||
| 141 | struct nfsd_sattrargs *); | ||
| 142 | int nfssvc_decode_diropargs(struct svc_rqst *, __be32 *, | ||
| 143 | struct nfsd_diropargs *); | ||
| 144 | int nfssvc_decode_readargs(struct svc_rqst *, __be32 *, | ||
| 145 | struct nfsd_readargs *); | ||
| 146 | int nfssvc_decode_writeargs(struct svc_rqst *, __be32 *, | ||
| 147 | struct nfsd_writeargs *); | ||
| 148 | int nfssvc_decode_createargs(struct svc_rqst *, __be32 *, | ||
| 149 | struct nfsd_createargs *); | ||
| 150 | int nfssvc_decode_renameargs(struct svc_rqst *, __be32 *, | ||
| 151 | struct nfsd_renameargs *); | ||
| 152 | int nfssvc_decode_readlinkargs(struct svc_rqst *, __be32 *, | ||
| 153 | struct nfsd_readlinkargs *); | ||
| 154 | int nfssvc_decode_linkargs(struct svc_rqst *, __be32 *, | ||
| 155 | struct nfsd_linkargs *); | ||
| 156 | int nfssvc_decode_symlinkargs(struct svc_rqst *, __be32 *, | ||
| 157 | struct nfsd_symlinkargs *); | ||
| 158 | int nfssvc_decode_readdirargs(struct svc_rqst *, __be32 *, | ||
| 159 | struct nfsd_readdirargs *); | ||
| 160 | int nfssvc_encode_void(struct svc_rqst *, __be32 *, void *); | ||
| 161 | int nfssvc_encode_attrstat(struct svc_rqst *, __be32 *, struct nfsd_attrstat *); | ||
| 162 | int nfssvc_encode_diropres(struct svc_rqst *, __be32 *, struct nfsd_diropres *); | ||
| 163 | int nfssvc_encode_readlinkres(struct svc_rqst *, __be32 *, struct nfsd_readlinkres *); | ||
| 164 | int nfssvc_encode_readres(struct svc_rqst *, __be32 *, struct nfsd_readres *); | ||
| 165 | int nfssvc_encode_statfsres(struct svc_rqst *, __be32 *, struct nfsd_statfsres *); | ||
| 166 | int nfssvc_encode_readdirres(struct svc_rqst *, __be32 *, struct nfsd_readdirres *); | ||
| 167 | |||
| 168 | int nfssvc_encode_entry(void *, const char *name, | ||
| 169 | int namlen, loff_t offset, u64 ino, unsigned int); | ||
| 170 | |||
| 171 | int nfssvc_release_fhandle(struct svc_rqst *, __be32 *, struct nfsd_fhandle *); | ||
| 172 | |||
| 173 | /* Helper functions for NFSv2 ACL code */ | ||
| 174 | __be32 *nfs2svc_encode_fattr(struct svc_rqst *rqstp, __be32 *p, struct svc_fh *fhp); | ||
| 175 | __be32 *nfs2svc_decode_fh(__be32 *p, struct svc_fh *fhp); | ||
| 176 | |||
| 177 | #endif /* LINUX_NFSD_H */ | ||
diff --git a/include/linux/nfsd/xdr3.h b/include/linux/nfsd/xdr3.h deleted file mode 100644 index 421eddd65a25..000000000000 --- a/include/linux/nfsd/xdr3.h +++ /dev/null | |||
| @@ -1,346 +0,0 @@ | |||
| 1 | /* | ||
| 2 | * linux/include/linux/nfsd/xdr3.h | ||
| 3 | * | ||
| 4 | * XDR types for NFSv3 in nfsd. | ||
| 5 | * | ||
| 6 | * Copyright (C) 1996-1998, Olaf Kirch <okir@monad.swb.de> | ||
| 7 | */ | ||
| 8 | |||
| 9 | #ifndef _LINUX_NFSD_XDR3_H | ||
| 10 | #define _LINUX_NFSD_XDR3_H | ||
| 11 | |||
| 12 | #include <linux/nfsd/xdr.h> | ||
| 13 | |||
| 14 | struct nfsd3_sattrargs { | ||
| 15 | struct svc_fh fh; | ||
| 16 | struct iattr attrs; | ||
| 17 | int check_guard; | ||
| 18 | time_t guardtime; | ||
| 19 | }; | ||
| 20 | |||
| 21 | struct nfsd3_diropargs { | ||
| 22 | struct svc_fh fh; | ||
| 23 | char * name; | ||
| 24 | unsigned int len; | ||
| 25 | }; | ||
| 26 | |||
| 27 | struct nfsd3_accessargs { | ||
| 28 | struct svc_fh fh; | ||
| 29 | unsigned int access; | ||
| 30 | }; | ||
| 31 | |||
| 32 | struct nfsd3_readargs { | ||
| 33 | struct svc_fh fh; | ||
| 34 | __u64 offset; | ||
| 35 | __u32 count; | ||
| 36 | int vlen; | ||
| 37 | }; | ||
| 38 | |||
| 39 | struct nfsd3_writeargs { | ||
| 40 | svc_fh fh; | ||
| 41 | __u64 offset; | ||
| 42 | __u32 count; | ||
| 43 | int stable; | ||
| 44 | __u32 len; | ||
| 45 | int vlen; | ||
| 46 | }; | ||
| 47 | |||
| 48 | struct nfsd3_createargs { | ||
| 49 | struct svc_fh fh; | ||
| 50 | char * name; | ||
| 51 | unsigned int len; | ||
| 52 | int createmode; | ||
| 53 | struct iattr attrs; | ||
| 54 | __be32 * verf; | ||
| 55 | }; | ||
| 56 | |||
| 57 | struct nfsd3_mknodargs { | ||
| 58 | struct svc_fh fh; | ||
| 59 | char * name; | ||
| 60 | unsigned int len; | ||
| 61 | __u32 ftype; | ||
| 62 | __u32 major, minor; | ||
| 63 | struct iattr attrs; | ||
| 64 | }; | ||
| 65 | |||
| 66 | struct nfsd3_renameargs { | ||
| 67 | struct svc_fh ffh; | ||
| 68 | char * fname; | ||
| 69 | unsigned int flen; | ||
| 70 | struct svc_fh tfh; | ||
| 71 | char * tname; | ||
| 72 | unsigned int tlen; | ||
| 73 | }; | ||
| 74 | |||
| 75 | struct nfsd3_readlinkargs { | ||
| 76 | struct svc_fh fh; | ||
| 77 | char * buffer; | ||
| 78 | }; | ||
| 79 | |||
| 80 | struct nfsd3_linkargs { | ||
| 81 | struct svc_fh ffh; | ||
| 82 | struct svc_fh tfh; | ||
| 83 | char * tname; | ||
| 84 | unsigned int tlen; | ||
| 85 | }; | ||
| 86 | |||
| 87 | struct nfsd3_symlinkargs { | ||
| 88 | struct svc_fh ffh; | ||
| 89 | char * fname; | ||
| 90 | unsigned int flen; | ||
| 91 | char * tname; | ||
| 92 | unsigned int tlen; | ||
| 93 | struct iattr attrs; | ||
| 94 | }; | ||
| 95 | |||
| 96 | struct nfsd3_readdirargs { | ||
| 97 | struct svc_fh fh; | ||
| 98 | __u64 cookie; | ||
| 99 | __u32 dircount; | ||
| 100 | __u32 count; | ||
| 101 | __be32 * verf; | ||
| 102 | __be32 * buffer; | ||
| 103 | }; | ||
| 104 | |||
| 105 | struct nfsd3_commitargs { | ||
| 106 | struct svc_fh fh; | ||
| 107 | __u64 offset; | ||
| 108 | __u32 count; | ||
| 109 | }; | ||
| 110 | |||
| 111 | struct nfsd3_getaclargs { | ||
| 112 | struct svc_fh fh; | ||
| 113 | int mask; | ||
| 114 | }; | ||
| 115 | |||
| 116 | struct posix_acl; | ||
| 117 | struct nfsd3_setaclargs { | ||
| 118 | struct svc_fh fh; | ||
| 119 | int mask; | ||
| 120 | struct posix_acl *acl_access; | ||
| 121 | struct posix_acl *acl_default; | ||
| 122 | }; | ||
| 123 | |||
| 124 | struct nfsd3_attrstat { | ||
| 125 | __be32 status; | ||
| 126 | struct svc_fh fh; | ||
| 127 | struct kstat stat; | ||
| 128 | }; | ||
| 129 | |||
| 130 | /* LOOKUP, CREATE, MKDIR, SYMLINK, MKNOD */ | ||
| 131 | struct nfsd3_diropres { | ||
| 132 | __be32 status; | ||
| 133 | struct svc_fh dirfh; | ||
| 134 | struct svc_fh fh; | ||
| 135 | }; | ||
| 136 | |||
| 137 | struct nfsd3_accessres { | ||
| 138 | __be32 status; | ||
| 139 | struct svc_fh fh; | ||
| 140 | __u32 access; | ||
| 141 | }; | ||
| 142 | |||
| 143 | struct nfsd3_readlinkres { | ||
| 144 | __be32 status; | ||
| 145 | struct svc_fh fh; | ||
| 146 | __u32 len; | ||
| 147 | }; | ||
| 148 | |||
| 149 | struct nfsd3_readres { | ||
| 150 | __be32 status; | ||
| 151 | struct svc_fh fh; | ||
| 152 | unsigned long count; | ||
| 153 | int eof; | ||
| 154 | }; | ||
| 155 | |||
| 156 | struct nfsd3_writeres { | ||
| 157 | __be32 status; | ||
| 158 | struct svc_fh fh; | ||
| 159 | unsigned long count; | ||
| 160 | int committed; | ||
| 161 | }; | ||
| 162 | |||
| 163 | struct nfsd3_renameres { | ||
| 164 | __be32 status; | ||
| 165 | struct svc_fh ffh; | ||
| 166 | struct svc_fh tfh; | ||
| 167 | }; | ||
| 168 | |||
| 169 | struct nfsd3_linkres { | ||
| 170 | __be32 status; | ||
| 171 | struct svc_fh tfh; | ||
| 172 | struct svc_fh fh; | ||
| 173 | }; | ||
| 174 | |||
| 175 | struct nfsd3_readdirres { | ||
| 176 | __be32 status; | ||
| 177 | struct svc_fh fh; | ||
| 178 | int count; | ||
| 179 | __be32 verf[2]; | ||
| 180 | |||
| 181 | struct readdir_cd common; | ||
| 182 | __be32 * buffer; | ||
| 183 | int buflen; | ||
| 184 | __be32 * offset; | ||
| 185 | __be32 * offset1; | ||
| 186 | struct svc_rqst * rqstp; | ||
| 187 | |||
| 188 | }; | ||
| 189 | |||
| 190 | struct nfsd3_fsstatres { | ||
| 191 | __be32 status; | ||
| 192 | struct kstatfs stats; | ||
| 193 | __u32 invarsec; | ||
| 194 | }; | ||
| 195 | |||
| 196 | struct nfsd3_fsinfores { | ||
| 197 | __be32 status; | ||
| 198 | __u32 f_rtmax; | ||
| 199 | __u32 f_rtpref; | ||
| 200 | __u32 f_rtmult; | ||
| 201 | __u32 f_wtmax; | ||
| 202 | __u32 f_wtpref; | ||
| 203 | __u32 f_wtmult; | ||
| 204 | __u32 f_dtpref; | ||
| 205 | __u64 f_maxfilesize; | ||
| 206 | __u32 f_properties; | ||
| 207 | }; | ||
| 208 | |||
| 209 | struct nfsd3_pathconfres { | ||
| 210 | __be32 status; | ||
| 211 | __u32 p_link_max; | ||
| 212 | __u32 p_name_max; | ||
| 213 | __u32 p_no_trunc; | ||
| 214 | __u32 p_chown_restricted; | ||
| 215 | __u32 p_case_insensitive; | ||
| 216 | __u32 p_case_preserving; | ||
| 217 | }; | ||
| 218 | |||
| 219 | struct nfsd3_commitres { | ||
| 220 | __be32 status; | ||
| 221 | struct svc_fh fh; | ||
| 222 | }; | ||
| 223 | |||
| 224 | struct nfsd3_getaclres { | ||
| 225 | __be32 status; | ||
| 226 | struct svc_fh fh; | ||
| 227 | int mask; | ||
| 228 | struct posix_acl *acl_access; | ||
| 229 | struct posix_acl *acl_default; | ||
| 230 | }; | ||
| 231 | |||
| 232 | /* dummy type for release */ | ||
| 233 | struct nfsd3_fhandle_pair { | ||
| 234 | __u32 dummy; | ||
| 235 | struct svc_fh fh1; | ||
| 236 | struct svc_fh fh2; | ||
| 237 | }; | ||
| 238 | |||
| 239 | /* | ||
| 240 | * Storage requirements for XDR arguments and results. | ||
| 241 | */ | ||
| 242 | union nfsd3_xdrstore { | ||
| 243 | struct nfsd3_sattrargs sattrargs; | ||
| 244 | struct nfsd3_diropargs diropargs; | ||
| 245 | struct nfsd3_readargs readargs; | ||
| 246 | struct nfsd3_writeargs writeargs; | ||
| 247 | struct nfsd3_createargs createargs; | ||
| 248 | struct nfsd3_renameargs renameargs; | ||
| 249 | struct nfsd3_linkargs linkargs; | ||
| 250 | struct nfsd3_symlinkargs symlinkargs; | ||
| 251 | struct nfsd3_readdirargs readdirargs; | ||
| 252 | struct nfsd3_diropres diropres; | ||
| 253 | struct nfsd3_accessres accessres; | ||
| 254 | struct nfsd3_readlinkres readlinkres; | ||
| 255 | struct nfsd3_readres readres; | ||
| 256 | struct nfsd3_writeres writeres; | ||
| 257 | struct nfsd3_renameres renameres; | ||
| 258 | struct nfsd3_linkres linkres; | ||
| 259 | struct nfsd3_readdirres readdirres; | ||
| 260 | struct nfsd3_fsstatres fsstatres; | ||
| 261 | struct nfsd3_fsinfores fsinfores; | ||
| 262 | struct nfsd3_pathconfres pathconfres; | ||
| 263 | struct nfsd3_commitres commitres; | ||
| 264 | struct nfsd3_getaclres getaclres; | ||
| 265 | }; | ||
| 266 | |||
| 267 | #define NFS3_SVC_XDRSIZE sizeof(union nfsd3_xdrstore) | ||
| 268 | |||
| 269 | int nfs3svc_decode_fhandle(struct svc_rqst *, __be32 *, struct nfsd_fhandle *); | ||
| 270 | int nfs3svc_decode_sattrargs(struct svc_rqst *, __be32 *, | ||
| 271 | struct nfsd3_sattrargs *); | ||
| 272 | int nfs3svc_decode_diropargs(struct svc_rqst *, __be32 *, | ||
| 273 | struct nfsd3_diropargs *); | ||
| 274 | int nfs3svc_decode_accessargs(struct svc_rqst *, __be32 *, | ||
| 275 | struct nfsd3_accessargs *); | ||
| 276 | int nfs3svc_decode_readargs(struct svc_rqst *, __be32 *, | ||
| 277 | struct nfsd3_readargs *); | ||
| 278 | int nfs3svc_decode_writeargs(struct svc_rqst *, __be32 *, | ||
| 279 | struct nfsd3_writeargs *); | ||
| 280 | int nfs3svc_decode_createargs(struct svc_rqst *, __be32 *, | ||
| 281 | struct nfsd3_createargs *); | ||
| 282 | int nfs3svc_decode_mkdirargs(struct svc_rqst *, __be32 *, | ||
| 283 | struct nfsd3_createargs *); | ||
| 284 | int nfs3svc_decode_mknodargs(struct svc_rqst *, __be32 *, | ||
| 285 | struct nfsd3_mknodargs *); | ||
| 286 | int nfs3svc_decode_renameargs(struct svc_rqst *, __be32 *, | ||
| 287 | struct nfsd3_renameargs *); | ||
| 288 | int nfs3svc_decode_readlinkargs(struct svc_rqst *, __be32 *, | ||
| 289 | struct nfsd3_readlinkargs *); | ||
| 290 | int nfs3svc_decode_linkargs(struct svc_rqst *, __be32 *, | ||
| 291 | struct nfsd3_linkargs *); | ||
| 292 | int nfs3svc_decode_symlinkargs(struct svc_rqst *, __be32 *, | ||
| 293 | struct nfsd3_symlinkargs *); | ||
| 294 | int nfs3svc_decode_readdirargs(struct svc_rqst *, __be32 *, | ||
| 295 | struct nfsd3_readdirargs *); | ||
| 296 | int nfs3svc_decode_readdirplusargs(struct svc_rqst *, __be32 *, | ||
| 297 | struct nfsd3_readdirargs *); | ||
| 298 | int nfs3svc_decode_commitargs(struct svc_rqst *, __be32 *, | ||
| 299 | struct nfsd3_commitargs *); | ||
| 300 | int nfs3svc_encode_voidres(struct svc_rqst *, __be32 *, void *); | ||
| 301 | int nfs3svc_encode_attrstat(struct svc_rqst *, __be32 *, | ||
| 302 | struct nfsd3_attrstat *); | ||
| 303 | int nfs3svc_encode_wccstat(struct svc_rqst *, __be32 *, | ||
| 304 | struct nfsd3_attrstat *); | ||
| 305 | int nfs3svc_encode_diropres(struct svc_rqst *, __be32 *, | ||
| 306 | struct nfsd3_diropres *); | ||
| 307 | int nfs3svc_encode_accessres(struct svc_rqst *, __be32 *, | ||
| 308 | struct nfsd3_accessres *); | ||
| 309 | int nfs3svc_encode_readlinkres(struct svc_rqst *, __be32 *, | ||
| 310 | struct nfsd3_readlinkres *); | ||
| 311 | int nfs3svc_encode_readres(struct svc_rqst *, __be32 *, struct nfsd3_readres *); | ||
| 312 | int nfs3svc_encode_writeres(struct svc_rqst *, __be32 *, struct nfsd3_writeres *); | ||
| 313 | int nfs3svc_encode_createres(struct svc_rqst *, __be32 *, | ||
| 314 | struct nfsd3_diropres *); | ||
| 315 | int nfs3svc_encode_renameres(struct svc_rqst *, __be32 *, | ||
| 316 | struct nfsd3_renameres *); | ||
| 317 | int nfs3svc_encode_linkres(struct svc_rqst *, __be32 *, | ||
| 318 | struct nfsd3_linkres *); | ||
| 319 | int nfs3svc_encode_readdirres(struct svc_rqst *, __be32 *, | ||
| 320 | struct nfsd3_readdirres *); | ||
| 321 | int nfs3svc_encode_fsstatres(struct svc_rqst *, __be32 *, | ||
| 322 | struct nfsd3_fsstatres *); | ||
| 323 | int nfs3svc_encode_fsinfores(struct svc_rqst *, __be32 *, | ||
| 324 | struct nfsd3_fsinfores *); | ||
| 325 | int nfs3svc_encode_pathconfres(struct svc_rqst *, __be32 *, | ||
| 326 | struct nfsd3_pathconfres *); | ||
| 327 | int nfs3svc_encode_commitres(struct svc_rqst *, __be32 *, | ||
| 328 | struct nfsd3_commitres *); | ||
| 329 | |||
| 330 | int nfs3svc_release_fhandle(struct svc_rqst *, __be32 *, | ||
| 331 | struct nfsd3_attrstat *); | ||
| 332 | int nfs3svc_release_fhandle2(struct svc_rqst *, __be32 *, | ||
| 333 | struct nfsd3_fhandle_pair *); | ||
| 334 | int nfs3svc_encode_entry(void *, const char *name, | ||
| 335 | int namlen, loff_t offset, u64 ino, | ||
| 336 | unsigned int); | ||
| 337 | int nfs3svc_encode_entry_plus(void *, const char *name, | ||
| 338 | int namlen, loff_t offset, u64 ino, | ||
| 339 | unsigned int); | ||
| 340 | /* Helper functions for NFSv3 ACL code */ | ||
| 341 | __be32 *nfs3svc_encode_post_op_attr(struct svc_rqst *rqstp, __be32 *p, | ||
| 342 | struct svc_fh *fhp); | ||
| 343 | __be32 *nfs3svc_decode_fh(__be32 *p, struct svc_fh *fhp); | ||
| 344 | |||
| 345 | |||
| 346 | #endif /* _LINUX_NFSD_XDR3_H */ | ||
diff --git a/include/linux/nfsd/xdr4.h b/include/linux/nfsd/xdr4.h deleted file mode 100644 index 73164c2b3d29..000000000000 --- a/include/linux/nfsd/xdr4.h +++ /dev/null | |||
| @@ -1,563 +0,0 @@ | |||
| 1 | /* | ||
| 2 | * include/linux/nfsd/xdr4.h | ||
| 3 | * | ||
| 4 | * Server-side types for NFSv4. | ||
| 5 | * | ||
| 6 | * Copyright (c) 2002 The Regents of the University of Michigan. | ||
| 7 | * All rights reserved. | ||
| 8 | * | ||
| 9 | * Kendrick Smith <kmsmith@umich.edu> | ||
| 10 | * Andy Adamson <andros@umich.edu> | ||
| 11 | * | ||
| 12 | * Redistribution and use in source and binary forms, with or without | ||
| 13 | * modification, are permitted provided that the following conditions | ||
| 14 | * are met: | ||
| 15 | * | ||
| 16 | * 1. Redistributions of source code must retain the above copyright | ||
| 17 | * notice, this list of conditions and the following disclaimer. | ||
| 18 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 19 | * notice, this list of conditions and the following disclaimer in the | ||
| 20 | * documentation and/or other materials provided with the distribution. | ||
| 21 | * 3. Neither the name of the University nor the names of its | ||
| 22 | * contributors may be used to endorse or promote products derived | ||
| 23 | * from this software without specific prior written permission. | ||
| 24 | * | ||
| 25 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED | ||
| 26 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF | ||
| 27 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
| 28 | * DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | ||
| 29 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | ||
| 30 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | ||
| 31 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR | ||
| 32 | * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF | ||
| 33 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | ||
| 34 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
| 35 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
| 36 | * | ||
| 37 | */ | ||
| 38 | |||
| 39 | #ifndef _LINUX_NFSD_XDR4_H | ||
| 40 | #define _LINUX_NFSD_XDR4_H | ||
| 41 | |||
| 42 | #include <linux/nfs4.h> | ||
| 43 | |||
| 44 | #define NFSD4_MAX_TAGLEN 128 | ||
| 45 | #define XDR_LEN(n) (((n) + 3) & ~3) | ||
| 46 | |||
| 47 | struct nfsd4_compound_state { | ||
| 48 | struct svc_fh current_fh; | ||
| 49 | struct svc_fh save_fh; | ||
| 50 | struct nfs4_stateowner *replay_owner; | ||
| 51 | /* For sessions DRC */ | ||
| 52 | struct nfsd4_session *session; | ||
| 53 | struct nfsd4_slot *slot; | ||
| 54 | __be32 *datap; | ||
| 55 | size_t iovlen; | ||
| 56 | u32 minorversion; | ||
| 57 | u32 status; | ||
| 58 | }; | ||
| 59 | |||
| 60 | static inline bool nfsd4_has_session(struct nfsd4_compound_state *cs) | ||
| 61 | { | ||
| 62 | return cs->slot != NULL; | ||
| 63 | } | ||
| 64 | |||
| 65 | struct nfsd4_change_info { | ||
| 66 | u32 atomic; | ||
| 67 | bool change_supported; | ||
| 68 | u32 before_ctime_sec; | ||
| 69 | u32 before_ctime_nsec; | ||
| 70 | u64 before_change; | ||
| 71 | u32 after_ctime_sec; | ||
| 72 | u32 after_ctime_nsec; | ||
| 73 | u64 after_change; | ||
| 74 | }; | ||
| 75 | |||
| 76 | struct nfsd4_access { | ||
| 77 | u32 ac_req_access; /* request */ | ||
| 78 | u32 ac_supported; /* response */ | ||
| 79 | u32 ac_resp_access; /* response */ | ||
| 80 | }; | ||
| 81 | |||
| 82 | struct nfsd4_close { | ||
| 83 | u32 cl_seqid; /* request */ | ||
| 84 | stateid_t cl_stateid; /* request+response */ | ||
| 85 | struct nfs4_stateowner * cl_stateowner; /* response */ | ||
| 86 | }; | ||
| 87 | |||
| 88 | struct nfsd4_commit { | ||
| 89 | u64 co_offset; /* request */ | ||
| 90 | u32 co_count; /* request */ | ||
| 91 | nfs4_verifier co_verf; /* response */ | ||
| 92 | }; | ||
| 93 | |||
| 94 | struct nfsd4_create { | ||
| 95 | u32 cr_namelen; /* request */ | ||
| 96 | char * cr_name; /* request */ | ||
| 97 | u32 cr_type; /* request */ | ||
| 98 | union { /* request */ | ||
| 99 | struct { | ||
| 100 | u32 namelen; | ||
| 101 | char *name; | ||
| 102 | } link; /* NF4LNK */ | ||
| 103 | struct { | ||
| 104 | u32 specdata1; | ||
| 105 | u32 specdata2; | ||
| 106 | } dev; /* NF4BLK, NF4CHR */ | ||
| 107 | } u; | ||
| 108 | u32 cr_bmval[3]; /* request */ | ||
| 109 | struct iattr cr_iattr; /* request */ | ||
| 110 | struct nfsd4_change_info cr_cinfo; /* response */ | ||
| 111 | struct nfs4_acl *cr_acl; | ||
| 112 | }; | ||
| 113 | #define cr_linklen u.link.namelen | ||
| 114 | #define cr_linkname u.link.name | ||
| 115 | #define cr_specdata1 u.dev.specdata1 | ||
| 116 | #define cr_specdata2 u.dev.specdata2 | ||
| 117 | |||
| 118 | struct nfsd4_delegreturn { | ||
| 119 | stateid_t dr_stateid; | ||
| 120 | }; | ||
| 121 | |||
| 122 | struct nfsd4_getattr { | ||
| 123 | u32 ga_bmval[3]; /* request */ | ||
| 124 | struct svc_fh *ga_fhp; /* response */ | ||
| 125 | }; | ||
| 126 | |||
| 127 | struct nfsd4_link { | ||
| 128 | u32 li_namelen; /* request */ | ||
| 129 | char * li_name; /* request */ | ||
| 130 | struct nfsd4_change_info li_cinfo; /* response */ | ||
| 131 | }; | ||
| 132 | |||
| 133 | struct nfsd4_lock_denied { | ||
| 134 | clientid_t ld_clientid; | ||
| 135 | struct nfs4_stateowner *ld_sop; | ||
| 136 | u64 ld_start; | ||
| 137 | u64 ld_length; | ||
| 138 | u32 ld_type; | ||
| 139 | }; | ||
| 140 | |||
| 141 | struct nfsd4_lock { | ||
| 142 | /* request */ | ||
| 143 | u32 lk_type; | ||
| 144 | u32 lk_reclaim; /* boolean */ | ||
| 145 | u64 lk_offset; | ||
| 146 | u64 lk_length; | ||
| 147 | u32 lk_is_new; | ||
| 148 | union { | ||
| 149 | struct { | ||
| 150 | u32 open_seqid; | ||
| 151 | stateid_t open_stateid; | ||
| 152 | u32 lock_seqid; | ||
| 153 | clientid_t clientid; | ||
| 154 | struct xdr_netobj owner; | ||
| 155 | } new; | ||
| 156 | struct { | ||
| 157 | stateid_t lock_stateid; | ||
| 158 | u32 lock_seqid; | ||
| 159 | } old; | ||
| 160 | } v; | ||
| 161 | |||
| 162 | /* response */ | ||
| 163 | union { | ||
| 164 | struct { | ||
| 165 | stateid_t stateid; | ||
| 166 | } ok; | ||
| 167 | struct nfsd4_lock_denied denied; | ||
| 168 | } u; | ||
| 169 | /* The lk_replay_owner is the open owner in the open_to_lock_owner | ||
| 170 | * case and the lock owner otherwise: */ | ||
| 171 | struct nfs4_stateowner *lk_replay_owner; | ||
| 172 | }; | ||
| 173 | #define lk_new_open_seqid v.new.open_seqid | ||
| 174 | #define lk_new_open_stateid v.new.open_stateid | ||
| 175 | #define lk_new_lock_seqid v.new.lock_seqid | ||
| 176 | #define lk_new_clientid v.new.clientid | ||
| 177 | #define lk_new_owner v.new.owner | ||
| 178 | #define lk_old_lock_stateid v.old.lock_stateid | ||
| 179 | #define lk_old_lock_seqid v.old.lock_seqid | ||
| 180 | |||
| 181 | #define lk_rflags u.ok.rflags | ||
| 182 | #define lk_resp_stateid u.ok.stateid | ||
| 183 | #define lk_denied u.denied | ||
| 184 | |||
| 185 | |||
| 186 | struct nfsd4_lockt { | ||
| 187 | u32 lt_type; | ||
| 188 | clientid_t lt_clientid; | ||
| 189 | struct xdr_netobj lt_owner; | ||
| 190 | u64 lt_offset; | ||
| 191 | u64 lt_length; | ||
| 192 | struct nfs4_stateowner * lt_stateowner; | ||
| 193 | struct nfsd4_lock_denied lt_denied; | ||
| 194 | }; | ||
| 195 | |||
| 196 | |||
| 197 | struct nfsd4_locku { | ||
| 198 | u32 lu_type; | ||
| 199 | u32 lu_seqid; | ||
| 200 | stateid_t lu_stateid; | ||
| 201 | u64 lu_offset; | ||
| 202 | u64 lu_length; | ||
| 203 | struct nfs4_stateowner *lu_stateowner; | ||
| 204 | }; | ||
| 205 | |||
| 206 | |||
| 207 | struct nfsd4_lookup { | ||
| 208 | u32 lo_len; /* request */ | ||
| 209 | char * lo_name; /* request */ | ||
| 210 | }; | ||
| 211 | |||
| 212 | struct nfsd4_putfh { | ||
| 213 | u32 pf_fhlen; /* request */ | ||
| 214 | char *pf_fhval; /* request */ | ||
| 215 | }; | ||
| 216 | |||
| 217 | struct nfsd4_open { | ||
| 218 | u32 op_claim_type; /* request */ | ||
| 219 | struct xdr_netobj op_fname; /* request - everything but CLAIM_PREV */ | ||
| 220 | u32 op_delegate_type; /* request - CLAIM_PREV only */ | ||
| 221 | stateid_t op_delegate_stateid; /* request - response */ | ||
| 222 | u32 op_create; /* request */ | ||
| 223 | u32 op_createmode; /* request */ | ||
| 224 | u32 op_bmval[3]; /* request */ | ||
| 225 | struct iattr iattr; /* UNCHECKED4, GUARDED4, EXCLUSIVE4_1 */ | ||
| 226 | nfs4_verifier verf; /* EXCLUSIVE4 */ | ||
| 227 | clientid_t op_clientid; /* request */ | ||
| 228 | struct xdr_netobj op_owner; /* request */ | ||
| 229 | u32 op_seqid; /* request */ | ||
| 230 | u32 op_share_access; /* request */ | ||
| 231 | u32 op_share_deny; /* request */ | ||
| 232 | stateid_t op_stateid; /* response */ | ||
| 233 | u32 op_recall; /* recall */ | ||
| 234 | struct nfsd4_change_info op_cinfo; /* response */ | ||
| 235 | u32 op_rflags; /* response */ | ||
| 236 | int op_truncate; /* used during processing */ | ||
| 237 | struct nfs4_stateowner *op_stateowner; /* used during processing */ | ||
| 238 | struct nfs4_acl *op_acl; | ||
| 239 | }; | ||
| 240 | #define op_iattr iattr | ||
| 241 | #define op_verf verf | ||
| 242 | |||
| 243 | struct nfsd4_open_confirm { | ||
| 244 | stateid_t oc_req_stateid /* request */; | ||
| 245 | u32 oc_seqid /* request */; | ||
| 246 | stateid_t oc_resp_stateid /* response */; | ||
| 247 | struct nfs4_stateowner * oc_stateowner; /* response */ | ||
| 248 | }; | ||
| 249 | |||
| 250 | struct nfsd4_open_downgrade { | ||
| 251 | stateid_t od_stateid; | ||
| 252 | u32 od_seqid; | ||
| 253 | u32 od_share_access; | ||
| 254 | u32 od_share_deny; | ||
| 255 | struct nfs4_stateowner *od_stateowner; | ||
| 256 | }; | ||
| 257 | |||
| 258 | |||
| 259 | struct nfsd4_read { | ||
| 260 | stateid_t rd_stateid; /* request */ | ||
| 261 | u64 rd_offset; /* request */ | ||
| 262 | u32 rd_length; /* request */ | ||
| 263 | int rd_vlen; | ||
| 264 | struct file *rd_filp; | ||
| 265 | |||
| 266 | struct svc_rqst *rd_rqstp; /* response */ | ||
| 267 | struct svc_fh * rd_fhp; /* response */ | ||
| 268 | }; | ||
| 269 | |||
| 270 | struct nfsd4_readdir { | ||
| 271 | u64 rd_cookie; /* request */ | ||
| 272 | nfs4_verifier rd_verf; /* request */ | ||
| 273 | u32 rd_dircount; /* request */ | ||
| 274 | u32 rd_maxcount; /* request */ | ||
| 275 | u32 rd_bmval[3]; /* request */ | ||
| 276 | struct svc_rqst *rd_rqstp; /* response */ | ||
| 277 | struct svc_fh * rd_fhp; /* response */ | ||
| 278 | |||
| 279 | struct readdir_cd common; | ||
| 280 | __be32 * buffer; | ||
| 281 | int buflen; | ||
| 282 | __be32 * offset; | ||
| 283 | }; | ||
| 284 | |||
| 285 | struct nfsd4_release_lockowner { | ||
| 286 | clientid_t rl_clientid; | ||
| 287 | struct xdr_netobj rl_owner; | ||
| 288 | }; | ||
| 289 | struct nfsd4_readlink { | ||
| 290 | struct svc_rqst *rl_rqstp; /* request */ | ||
| 291 | struct svc_fh * rl_fhp; /* request */ | ||
| 292 | }; | ||
| 293 | |||
| 294 | struct nfsd4_remove { | ||
| 295 | u32 rm_namelen; /* request */ | ||
| 296 | char * rm_name; /* request */ | ||
| 297 | struct nfsd4_change_info rm_cinfo; /* response */ | ||
| 298 | }; | ||
| 299 | |||
| 300 | struct nfsd4_rename { | ||
| 301 | u32 rn_snamelen; /* request */ | ||
| 302 | char * rn_sname; /* request */ | ||
| 303 | u32 rn_tnamelen; /* request */ | ||
| 304 | char * rn_tname; /* request */ | ||
| 305 | struct nfsd4_change_info rn_sinfo; /* response */ | ||
| 306 | struct nfsd4_change_info rn_tinfo; /* response */ | ||
| 307 | }; | ||
| 308 | |||
| 309 | struct nfsd4_secinfo { | ||
| 310 | u32 si_namelen; /* request */ | ||
| 311 | char *si_name; /* request */ | ||
| 312 | struct svc_export *si_exp; /* response */ | ||
| 313 | }; | ||
| 314 | |||
| 315 | struct nfsd4_setattr { | ||
| 316 | stateid_t sa_stateid; /* request */ | ||
| 317 | u32 sa_bmval[3]; /* request */ | ||
| 318 | struct iattr sa_iattr; /* request */ | ||
| 319 | struct nfs4_acl *sa_acl; | ||
| 320 | }; | ||
| 321 | |||
| 322 | struct nfsd4_setclientid { | ||
| 323 | nfs4_verifier se_verf; /* request */ | ||
| 324 | u32 se_namelen; /* request */ | ||
| 325 | char * se_name; /* request */ | ||
| 326 | u32 se_callback_prog; /* request */ | ||
| 327 | u32 se_callback_netid_len; /* request */ | ||
| 328 | char * se_callback_netid_val; /* request */ | ||
| 329 | u32 se_callback_addr_len; /* request */ | ||
| 330 | char * se_callback_addr_val; /* request */ | ||
| 331 | u32 se_callback_ident; /* request */ | ||
| 332 | clientid_t se_clientid; /* response */ | ||
| 333 | nfs4_verifier se_confirm; /* response */ | ||
| 334 | }; | ||
| 335 | |||
| 336 | struct nfsd4_setclientid_confirm { | ||
| 337 | clientid_t sc_clientid; | ||
| 338 | nfs4_verifier sc_confirm; | ||
| 339 | }; | ||
| 340 | |||
| 341 | /* also used for NVERIFY */ | ||
| 342 | struct nfsd4_verify { | ||
| 343 | u32 ve_bmval[3]; /* request */ | ||
| 344 | u32 ve_attrlen; /* request */ | ||
| 345 | char * ve_attrval; /* request */ | ||
| 346 | }; | ||
| 347 | |||
| 348 | struct nfsd4_write { | ||
| 349 | stateid_t wr_stateid; /* request */ | ||
| 350 | u64 wr_offset; /* request */ | ||
| 351 | u32 wr_stable_how; /* request */ | ||
| 352 | u32 wr_buflen; /* request */ | ||
| 353 | int wr_vlen; | ||
| 354 | |||
| 355 | u32 wr_bytes_written; /* response */ | ||
| 356 | u32 wr_how_written; /* response */ | ||
| 357 | nfs4_verifier wr_verifier; /* response */ | ||
| 358 | }; | ||
| 359 | |||
| 360 | struct nfsd4_exchange_id { | ||
| 361 | nfs4_verifier verifier; | ||
| 362 | struct xdr_netobj clname; | ||
| 363 | u32 flags; | ||
| 364 | clientid_t clientid; | ||
| 365 | u32 seqid; | ||
| 366 | int spa_how; | ||
| 367 | }; | ||
| 368 | |||
| 369 | struct nfsd4_sequence { | ||
| 370 | struct nfs4_sessionid sessionid; /* request/response */ | ||
| 371 | u32 seqid; /* request/response */ | ||
| 372 | u32 slotid; /* request/response */ | ||
| 373 | u32 maxslots; /* request/response */ | ||
| 374 | u32 cachethis; /* request */ | ||
| 375 | #if 0 | ||
| 376 | u32 target_maxslots; /* response */ | ||
| 377 | u32 status_flags; /* response */ | ||
| 378 | #endif /* not yet */ | ||
| 379 | }; | ||
| 380 | |||
| 381 | struct nfsd4_destroy_session { | ||
| 382 | struct nfs4_sessionid sessionid; | ||
| 383 | }; | ||
| 384 | |||
| 385 | struct nfsd4_op { | ||
| 386 | int opnum; | ||
| 387 | __be32 status; | ||
| 388 | union { | ||
| 389 | struct nfsd4_access access; | ||
| 390 | struct nfsd4_close close; | ||
| 391 | struct nfsd4_commit commit; | ||
| 392 | struct nfsd4_create create; | ||
| 393 | struct nfsd4_delegreturn delegreturn; | ||
| 394 | struct nfsd4_getattr getattr; | ||
| 395 | struct svc_fh * getfh; | ||
| 396 | struct nfsd4_link link; | ||
| 397 | struct nfsd4_lock lock; | ||
| 398 | struct nfsd4_lockt lockt; | ||
| 399 | struct nfsd4_locku locku; | ||
| 400 | struct nfsd4_lookup lookup; | ||
| 401 | struct nfsd4_verify nverify; | ||
| 402 | struct nfsd4_open open; | ||
| 403 | struct nfsd4_open_confirm open_confirm; | ||
| 404 | struct nfsd4_open_downgrade open_downgrade; | ||
| 405 | struct nfsd4_putfh putfh; | ||
| 406 | struct nfsd4_read read; | ||
| 407 | struct nfsd4_readdir readdir; | ||
| 408 | struct nfsd4_readlink readlink; | ||
| 409 | struct nfsd4_remove remove; | ||
| 410 | struct nfsd4_rename rename; | ||
| 411 | clientid_t renew; | ||
| 412 | struct nfsd4_secinfo secinfo; | ||
| 413 | struct nfsd4_setattr setattr; | ||
| 414 | struct nfsd4_setclientid setclientid; | ||
| 415 | struct nfsd4_setclientid_confirm setclientid_confirm; | ||
| 416 | struct nfsd4_verify verify; | ||
| 417 | struct nfsd4_write write; | ||
| 418 | struct nfsd4_release_lockowner release_lockowner; | ||
| 419 | |||
| 420 | /* NFSv4.1 */ | ||
| 421 | struct nfsd4_exchange_id exchange_id; | ||
| 422 | struct nfsd4_create_session create_session; | ||
| 423 | struct nfsd4_destroy_session destroy_session; | ||
| 424 | struct nfsd4_sequence sequence; | ||
| 425 | } u; | ||
| 426 | struct nfs4_replay * replay; | ||
| 427 | }; | ||
| 428 | |||
| 429 | struct nfsd4_compoundargs { | ||
| 430 | /* scratch variables for XDR decode */ | ||
| 431 | __be32 * p; | ||
| 432 | __be32 * end; | ||
| 433 | struct page ** pagelist; | ||
| 434 | int pagelen; | ||
| 435 | __be32 tmp[8]; | ||
| 436 | __be32 * tmpp; | ||
| 437 | struct tmpbuf { | ||
| 438 | struct tmpbuf *next; | ||
| 439 | void (*release)(const void *); | ||
| 440 | void *buf; | ||
| 441 | } *to_free; | ||
| 442 | |||
| 443 | struct svc_rqst *rqstp; | ||
| 444 | |||
| 445 | u32 taglen; | ||
| 446 | char * tag; | ||
| 447 | u32 minorversion; | ||
| 448 | u32 opcnt; | ||
| 449 | struct nfsd4_op *ops; | ||
| 450 | struct nfsd4_op iops[8]; | ||
| 451 | }; | ||
| 452 | |||
| 453 | struct nfsd4_compoundres { | ||
| 454 | /* scratch variables for XDR encode */ | ||
| 455 | __be32 * p; | ||
| 456 | __be32 * end; | ||
| 457 | struct xdr_buf * xbuf; | ||
| 458 | struct svc_rqst * rqstp; | ||
| 459 | |||
| 460 | u32 taglen; | ||
| 461 | char * tag; | ||
| 462 | u32 opcnt; | ||
| 463 | __be32 * tagp; /* tag, opcount encode location */ | ||
| 464 | struct nfsd4_compound_state cstate; | ||
| 465 | }; | ||
| 466 | |||
| 467 | static inline bool nfsd4_is_solo_sequence(struct nfsd4_compoundres *resp) | ||
| 468 | { | ||
| 469 | struct nfsd4_compoundargs *args = resp->rqstp->rq_argp; | ||
| 470 | return resp->opcnt == 1 && args->ops[0].opnum == OP_SEQUENCE; | ||
| 471 | } | ||
| 472 | |||
| 473 | static inline bool nfsd4_not_cached(struct nfsd4_compoundres *resp) | ||
| 474 | { | ||
| 475 | return !resp->cstate.slot->sl_cachethis || nfsd4_is_solo_sequence(resp); | ||
| 476 | } | ||
| 477 | |||
| 478 | #define NFS4_SVC_XDRSIZE sizeof(struct nfsd4_compoundargs) | ||
| 479 | |||
| 480 | static inline void | ||
| 481 | set_change_info(struct nfsd4_change_info *cinfo, struct svc_fh *fhp) | ||
| 482 | { | ||
| 483 | BUG_ON(!fhp->fh_pre_saved || !fhp->fh_post_saved); | ||
| 484 | cinfo->atomic = 1; | ||
| 485 | cinfo->change_supported = IS_I_VERSION(fhp->fh_dentry->d_inode); | ||
| 486 | if (cinfo->change_supported) { | ||
| 487 | cinfo->before_change = fhp->fh_pre_change; | ||
| 488 | cinfo->after_change = fhp->fh_post_change; | ||
| 489 | } else { | ||
| 490 | cinfo->before_ctime_sec = fhp->fh_pre_ctime.tv_sec; | ||
| 491 | cinfo->before_ctime_nsec = fhp->fh_pre_ctime.tv_nsec; | ||
| 492 | cinfo->after_ctime_sec = fhp->fh_post_attr.ctime.tv_sec; | ||
| 493 | cinfo->after_ctime_nsec = fhp->fh_post_attr.ctime.tv_nsec; | ||
| 494 | } | ||
| 495 | } | ||
| 496 | |||
| 497 | int nfs4svc_encode_voidres(struct svc_rqst *, __be32 *, void *); | ||
| 498 | int nfs4svc_decode_compoundargs(struct svc_rqst *, __be32 *, | ||
| 499 | struct nfsd4_compoundargs *); | ||
| 500 | int nfs4svc_encode_compoundres(struct svc_rqst *, __be32 *, | ||
| 501 | struct nfsd4_compoundres *); | ||
| 502 | void nfsd4_encode_operation(struct nfsd4_compoundres *, struct nfsd4_op *); | ||
| 503 | void nfsd4_encode_replay(struct nfsd4_compoundres *resp, struct nfsd4_op *op); | ||
| 504 | __be32 nfsd4_encode_fattr(struct svc_fh *fhp, struct svc_export *exp, | ||
| 505 | struct dentry *dentry, __be32 *buffer, int *countp, | ||
| 506 | u32 *bmval, struct svc_rqst *, int ignore_crossmnt); | ||
| 507 | extern __be32 nfsd4_setclientid(struct svc_rqst *rqstp, | ||
| 508 | struct nfsd4_compound_state *, | ||
| 509 | struct nfsd4_setclientid *setclid); | ||
| 510 | extern __be32 nfsd4_setclientid_confirm(struct svc_rqst *rqstp, | ||
| 511 | struct nfsd4_compound_state *, | ||
| 512 | struct nfsd4_setclientid_confirm *setclientid_confirm); | ||
| 513 | extern void nfsd4_store_cache_entry(struct nfsd4_compoundres *resp); | ||
| 514 | extern __be32 nfsd4_replay_cache_entry(struct nfsd4_compoundres *resp, | ||
| 515 | struct nfsd4_sequence *seq); | ||
| 516 | extern __be32 nfsd4_exchange_id(struct svc_rqst *rqstp, | ||
| 517 | struct nfsd4_compound_state *, | ||
| 518 | struct nfsd4_exchange_id *); | ||
| 519 | extern __be32 nfsd4_create_session(struct svc_rqst *, | ||
| 520 | struct nfsd4_compound_state *, | ||
| 521 | struct nfsd4_create_session *); | ||
| 522 | extern __be32 nfsd4_sequence(struct svc_rqst *, | ||
| 523 | struct nfsd4_compound_state *, | ||
| 524 | struct nfsd4_sequence *); | ||
| 525 | extern __be32 nfsd4_destroy_session(struct svc_rqst *, | ||
| 526 | struct nfsd4_compound_state *, | ||
| 527 | struct nfsd4_destroy_session *); | ||
| 528 | extern __be32 nfsd4_process_open1(struct nfsd4_compound_state *, | ||
| 529 | struct nfsd4_open *open); | ||
| 530 | extern __be32 nfsd4_process_open2(struct svc_rqst *rqstp, | ||
| 531 | struct svc_fh *current_fh, struct nfsd4_open *open); | ||
| 532 | extern __be32 nfsd4_open_confirm(struct svc_rqst *rqstp, | ||
| 533 | struct nfsd4_compound_state *, struct nfsd4_open_confirm *oc); | ||
| 534 | extern __be32 nfsd4_close(struct svc_rqst *rqstp, | ||
| 535 | struct nfsd4_compound_state *, | ||
| 536 | struct nfsd4_close *close); | ||
| 537 | extern __be32 nfsd4_open_downgrade(struct svc_rqst *rqstp, | ||
| 538 | struct nfsd4_compound_state *, | ||
| 539 | struct nfsd4_open_downgrade *od); | ||
| 540 | extern __be32 nfsd4_lock(struct svc_rqst *rqstp, struct nfsd4_compound_state *, | ||
| 541 | struct nfsd4_lock *lock); | ||
| 542 | extern __be32 nfsd4_lockt(struct svc_rqst *rqstp, | ||
| 543 | struct nfsd4_compound_state *, | ||
| 544 | struct nfsd4_lockt *lockt); | ||
| 545 | extern __be32 nfsd4_locku(struct svc_rqst *rqstp, | ||
| 546 | struct nfsd4_compound_state *, | ||
| 547 | struct nfsd4_locku *locku); | ||
| 548 | extern __be32 | ||
| 549 | nfsd4_release_lockowner(struct svc_rqst *rqstp, | ||
| 550 | struct nfsd4_compound_state *, | ||
| 551 | struct nfsd4_release_lockowner *rlockowner); | ||
| 552 | extern void nfsd4_release_compoundargs(struct nfsd4_compoundargs *); | ||
| 553 | extern __be32 nfsd4_delegreturn(struct svc_rqst *rqstp, | ||
| 554 | struct nfsd4_compound_state *, struct nfsd4_delegreturn *dr); | ||
| 555 | extern __be32 nfsd4_renew(struct svc_rqst *rqstp, | ||
| 556 | struct nfsd4_compound_state *, clientid_t *clid); | ||
| 557 | #endif | ||
| 558 | |||
| 559 | /* | ||
| 560 | * Local variables: | ||
| 561 | * c-basic-offset: 8 | ||
| 562 | * End: | ||
| 563 | */ | ||
diff --git a/include/linux/nilfs2_fs.h b/include/linux/nilfs2_fs.h index ce520402e840..640702e97457 100644 --- a/include/linux/nilfs2_fs.h +++ b/include/linux/nilfs2_fs.h | |||
| @@ -151,6 +151,9 @@ struct nilfs_super_root { | |||
| 151 | #define NILFS_MOUNT_BARRIER 0x1000 /* Use block barriers */ | 151 | #define NILFS_MOUNT_BARRIER 0x1000 /* Use block barriers */ |
| 152 | #define NILFS_MOUNT_STRICT_ORDER 0x2000 /* Apply strict in-order | 152 | #define NILFS_MOUNT_STRICT_ORDER 0x2000 /* Apply strict in-order |
| 153 | semantics also for data */ | 153 | semantics also for data */ |
| 154 | #define NILFS_MOUNT_NORECOVERY 0x4000 /* Disable write access during | ||
| 155 | mount-time recovery */ | ||
| 156 | #define NILFS_MOUNT_DISCARD 0x8000 /* Issue DISCARD requests */ | ||
| 154 | 157 | ||
| 155 | 158 | ||
| 156 | /** | 159 | /** |
| @@ -403,6 +406,28 @@ struct nilfs_segment_summary { | |||
| 403 | #define NILFS_SS_GC 0x0010 /* segment written for cleaner operation */ | 406 | #define NILFS_SS_GC 0x0010 /* segment written for cleaner operation */ |
| 404 | 407 | ||
| 405 | /** | 408 | /** |
| 409 | * struct nilfs_btree_node - B-tree node | ||
| 410 | * @bn_flags: flags | ||
| 411 | * @bn_level: level | ||
| 412 | * @bn_nchildren: number of children | ||
| 413 | * @bn_pad: padding | ||
| 414 | */ | ||
| 415 | struct nilfs_btree_node { | ||
| 416 | __u8 bn_flags; | ||
| 417 | __u8 bn_level; | ||
| 418 | __le16 bn_nchildren; | ||
| 419 | __le32 bn_pad; | ||
| 420 | }; | ||
| 421 | |||
| 422 | /* flags */ | ||
| 423 | #define NILFS_BTREE_NODE_ROOT 0x01 | ||
| 424 | |||
| 425 | /* level */ | ||
| 426 | #define NILFS_BTREE_LEVEL_DATA 0 | ||
| 427 | #define NILFS_BTREE_LEVEL_NODE_MIN (NILFS_BTREE_LEVEL_DATA + 1) | ||
| 428 | #define NILFS_BTREE_LEVEL_MAX 14 | ||
| 429 | |||
| 430 | /** | ||
| 406 | * struct nilfs_palloc_group_desc - block group descriptor | 431 | * struct nilfs_palloc_group_desc - block group descriptor |
| 407 | * @pg_nfrees: number of free entries in block group | 432 | * @pg_nfrees: number of free entries in block group |
| 408 | */ | 433 | */ |
diff --git a/include/linux/nl80211.h b/include/linux/nl80211.h index a8d71ed43a0e..28ba20fda3e2 100644 --- a/include/linux/nl80211.h +++ b/include/linux/nl80211.h | |||
| @@ -3,7 +3,7 @@ | |||
| 3 | /* | 3 | /* |
| 4 | * 802.11 netlink interface public header | 4 | * 802.11 netlink interface public header |
| 5 | * | 5 | * |
| 6 | * Copyright 2006, 2007, 2008 Johannes Berg <johannes@sipsolutions.net> | 6 | * Copyright 2006-2010 Johannes Berg <johannes@sipsolutions.net> |
| 7 | * Copyright 2008 Michael Wu <flamingice@sourmilk.net> | 7 | * Copyright 2008 Michael Wu <flamingice@sourmilk.net> |
| 8 | * Copyright 2008 Luis Carlos Cobo <luisca@cozybit.com> | 8 | * Copyright 2008 Luis Carlos Cobo <luisca@cozybit.com> |
| 9 | * Copyright 2008 Michael Buesch <mb@bu3sch.de> | 9 | * Copyright 2008 Michael Buesch <mb@bu3sch.de> |
| @@ -160,6 +160,11 @@ | |||
| 160 | * @NL80211_CMD_SCAN_ABORTED: scan was aborted, for unspecified reasons, | 160 | * @NL80211_CMD_SCAN_ABORTED: scan was aborted, for unspecified reasons, |
| 161 | * partial scan results may be available | 161 | * partial scan results may be available |
| 162 | * | 162 | * |
| 163 | * @NL80211_CMD_GET_SURVEY: get survey resuls, e.g. channel occupation | ||
| 164 | * or noise level | ||
| 165 | * @NL80211_CMD_NEW_SURVEY_RESULTS: survey data notification (as a reply to | ||
| 166 | * NL80211_CMD_GET_SURVEY and on the "scan" multicast group) | ||
| 167 | * | ||
| 163 | * @NL80211_CMD_REG_CHANGE: indicates to userspace the regulatory domain | 168 | * @NL80211_CMD_REG_CHANGE: indicates to userspace the regulatory domain |
| 164 | * has been changed and provides details of the request information | 169 | * has been changed and provides details of the request information |
| 165 | * that caused the change such as who initiated the regulatory request | 170 | * that caused the change such as who initiated the regulatory request |
| @@ -265,6 +270,60 @@ | |||
| 265 | * @NL80211_CMD_SET_WIPHY_NETNS: Set a wiphy's netns. Note that all devices | 270 | * @NL80211_CMD_SET_WIPHY_NETNS: Set a wiphy's netns. Note that all devices |
| 266 | * associated with this wiphy must be down and will follow. | 271 | * associated with this wiphy must be down and will follow. |
| 267 | * | 272 | * |
| 273 | * @NL80211_CMD_REMAIN_ON_CHANNEL: Request to remain awake on the specified | ||
| 274 | * channel for the specified amount of time. This can be used to do | ||
| 275 | * off-channel operations like transmit a Public Action frame and wait for | ||
| 276 | * a response while being associated to an AP on another channel. | ||
| 277 | * %NL80211_ATTR_WIPHY or %NL80211_ATTR_IFINDEX is used to specify which | ||
| 278 | * radio is used. %NL80211_ATTR_WIPHY_FREQ is used to specify the | ||
| 279 | * frequency for the operation and %NL80211_ATTR_WIPHY_CHANNEL_TYPE may be | ||
| 280 | * optionally used to specify additional channel parameters. | ||
| 281 | * %NL80211_ATTR_DURATION is used to specify the duration in milliseconds | ||
| 282 | * to remain on the channel. This command is also used as an event to | ||
| 283 | * notify when the requested duration starts (it may take a while for the | ||
| 284 | * driver to schedule this time due to other concurrent needs for the | ||
| 285 | * radio). | ||
| 286 | * When called, this operation returns a cookie (%NL80211_ATTR_COOKIE) | ||
| 287 | * that will be included with any events pertaining to this request; | ||
| 288 | * the cookie is also used to cancel the request. | ||
| 289 | * @NL80211_CMD_CANCEL_REMAIN_ON_CHANNEL: This command can be used to cancel a | ||
| 290 | * pending remain-on-channel duration if the desired operation has been | ||
| 291 | * completed prior to expiration of the originally requested duration. | ||
| 292 | * %NL80211_ATTR_WIPHY or %NL80211_ATTR_IFINDEX is used to specify the | ||
| 293 | * radio. The %NL80211_ATTR_COOKIE attribute must be given as well to | ||
| 294 | * uniquely identify the request. | ||
| 295 | * This command is also used as an event to notify when a requested | ||
| 296 | * remain-on-channel duration has expired. | ||
| 297 | * | ||
| 298 | * @NL80211_CMD_SET_TX_BITRATE_MASK: Set the mask of rates to be used in TX | ||
| 299 | * rate selection. %NL80211_ATTR_IFINDEX is used to specify the interface | ||
| 300 | * and @NL80211_ATTR_TX_RATES the set of allowed rates. | ||
| 301 | * | ||
| 302 | * @NL80211_CMD_REGISTER_ACTION: Register for receiving certain action frames | ||
| 303 | * (via @NL80211_CMD_ACTION) for processing in userspace. This command | ||
| 304 | * requires an interface index and a match attribute containing the first | ||
| 305 | * few bytes of the frame that should match, e.g. a single byte for only | ||
| 306 | * a category match or four bytes for vendor frames including the OUI. | ||
| 307 | * The registration cannot be dropped, but is removed automatically | ||
| 308 | * when the netlink socket is closed. Multiple registrations can be made. | ||
| 309 | * @NL80211_CMD_ACTION: Action frame TX request and RX notification. This | ||
| 310 | * command is used both as a request to transmit an Action frame and as an | ||
| 311 | * event indicating reception of an Action frame that was not processed in | ||
| 312 | * kernel code, but is for us (i.e., which may need to be processed in a | ||
| 313 | * user space application). %NL80211_ATTR_FRAME is used to specify the | ||
| 314 | * frame contents (including header). %NL80211_ATTR_WIPHY_FREQ (and | ||
| 315 | * optionally %NL80211_ATTR_WIPHY_CHANNEL_TYPE) is used to indicate on | ||
| 316 | * which channel the frame is to be transmitted or was received. This | ||
| 317 | * channel has to be the current channel (remain-on-channel or the | ||
| 318 | * operational channel). When called, this operation returns a cookie | ||
| 319 | * (%NL80211_ATTR_COOKIE) that will be included with the TX status event | ||
| 320 | * pertaining to the TX request. | ||
| 321 | * @NL80211_CMD_ACTION_TX_STATUS: Report TX status of an Action frame | ||
| 322 | * transmitted with %NL80211_CMD_ACTION. %NL80211_ATTR_COOKIE identifies | ||
| 323 | * the TX command and %NL80211_ATTR_FRAME includes the contents of the | ||
| 324 | * frame. %NL80211_ATTR_ACK flag is included if the recipient acknowledged | ||
| 325 | * the frame. | ||
| 326 | * | ||
| 268 | * @NL80211_CMD_MAX: highest used command number | 327 | * @NL80211_CMD_MAX: highest used command number |
| 269 | * @__NL80211_CMD_AFTER_LAST: internal use | 328 | * @__NL80211_CMD_AFTER_LAST: internal use |
| 270 | */ | 329 | */ |
| @@ -341,6 +400,25 @@ enum nl80211_commands { | |||
| 341 | 400 | ||
| 342 | NL80211_CMD_SET_WIPHY_NETNS, | 401 | NL80211_CMD_SET_WIPHY_NETNS, |
| 343 | 402 | ||
| 403 | NL80211_CMD_GET_SURVEY, | ||
| 404 | NL80211_CMD_NEW_SURVEY_RESULTS, | ||
| 405 | |||
| 406 | NL80211_CMD_SET_PMKSA, | ||
| 407 | NL80211_CMD_DEL_PMKSA, | ||
| 408 | NL80211_CMD_FLUSH_PMKSA, | ||
| 409 | |||
| 410 | NL80211_CMD_REMAIN_ON_CHANNEL, | ||
| 411 | NL80211_CMD_CANCEL_REMAIN_ON_CHANNEL, | ||
| 412 | |||
| 413 | NL80211_CMD_SET_TX_BITRATE_MASK, | ||
| 414 | |||
| 415 | NL80211_CMD_REGISTER_ACTION, | ||
| 416 | NL80211_CMD_ACTION, | ||
| 417 | NL80211_CMD_ACTION_TX_STATUS, | ||
| 418 | |||
| 419 | NL80211_CMD_SET_POWER_SAVE, | ||
| 420 | NL80211_CMD_GET_POWER_SAVE, | ||
| 421 | |||
| 344 | /* add new commands above here */ | 422 | /* add new commands above here */ |
| 345 | 423 | ||
| 346 | /* used to define NL80211_CMD_MAX below */ | 424 | /* used to define NL80211_CMD_MAX below */ |
| @@ -390,6 +468,8 @@ enum nl80211_commands { | |||
| 390 | * @NL80211_ATTR_WIPHY_RTS_THRESHOLD: RTS threshold (TX frames with length | 468 | * @NL80211_ATTR_WIPHY_RTS_THRESHOLD: RTS threshold (TX frames with length |
| 391 | * larger than or equal to this use RTS/CTS handshake); allowed range: | 469 | * larger than or equal to this use RTS/CTS handshake); allowed range: |
| 392 | * 0..65536, disable with (u32)-1; dot11RTSThreshold; u32 | 470 | * 0..65536, disable with (u32)-1; dot11RTSThreshold; u32 |
| 471 | * @NL80211_ATTR_WIPHY_COVERAGE_CLASS: Coverage Class as defined by IEEE 802.11 | ||
| 472 | * section 7.3.2.9; dot11CoverageClass; u8 | ||
| 393 | * | 473 | * |
| 394 | * @NL80211_ATTR_IFINDEX: network interface index of the device to operate on | 474 | * @NL80211_ATTR_IFINDEX: network interface index of the device to operate on |
| 395 | * @NL80211_ATTR_IFNAME: network interface name | 475 | * @NL80211_ATTR_IFNAME: network interface name |
| @@ -584,6 +664,33 @@ enum nl80211_commands { | |||
| 584 | * changed then the list changed and the dump should be repeated | 664 | * changed then the list changed and the dump should be repeated |
| 585 | * completely from scratch. | 665 | * completely from scratch. |
| 586 | * | 666 | * |
| 667 | * @NL80211_ATTR_4ADDR: Use 4-address frames on a virtual interface | ||
| 668 | * | ||
| 669 | * @NL80211_ATTR_SURVEY_INFO: survey information about a channel, part of | ||
| 670 | * the survey response for %NL80211_CMD_GET_SURVEY, nested attribute | ||
| 671 | * containing info as possible, see &enum survey_info. | ||
| 672 | * | ||
| 673 | * @NL80211_ATTR_PMKID: PMK material for PMKSA caching. | ||
| 674 | * @NL80211_ATTR_MAX_NUM_PMKIDS: maximum number of PMKIDs a firmware can | ||
| 675 | * cache, a wiphy attribute. | ||
| 676 | * | ||
| 677 | * @NL80211_ATTR_DURATION: Duration of an operation in milliseconds, u32. | ||
| 678 | * | ||
| 679 | * @NL80211_ATTR_COOKIE: Generic 64-bit cookie to identify objects. | ||
| 680 | * | ||
| 681 | * @NL80211_ATTR_TX_RATES: Nested set of attributes | ||
| 682 | * (enum nl80211_tx_rate_attributes) describing TX rates per band. The | ||
| 683 | * enum nl80211_band value is used as the index (nla_type() of the nested | ||
| 684 | * data. If a band is not included, it will be configured to allow all | ||
| 685 | * rates based on negotiated supported rates information. This attribute | ||
| 686 | * is used with %NL80211_CMD_SET_TX_BITRATE_MASK. | ||
| 687 | * | ||
| 688 | * @NL80211_ATTR_FRAME_MATCH: A binary attribute which typically must contain | ||
| 689 | * at least one byte, currently used with @NL80211_CMD_REGISTER_ACTION. | ||
| 690 | * | ||
| 691 | * @NL80211_ATTR_ACK: Flag attribute indicating that the frame was | ||
| 692 | * acknowledged by the recipient. | ||
| 693 | * | ||
| 587 | * @NL80211_ATTR_MAX: highest attribute number currently defined | 694 | * @NL80211_ATTR_MAX: highest attribute number currently defined |
| 588 | * @__NL80211_ATTR_AFTER_LAST: internal use | 695 | * @__NL80211_ATTR_AFTER_LAST: internal use |
| 589 | */ | 696 | */ |
| @@ -714,6 +821,27 @@ enum nl80211_attrs { | |||
| 714 | 821 | ||
| 715 | NL80211_ATTR_PID, | 822 | NL80211_ATTR_PID, |
| 716 | 823 | ||
| 824 | NL80211_ATTR_4ADDR, | ||
| 825 | |||
| 826 | NL80211_ATTR_SURVEY_INFO, | ||
| 827 | |||
| 828 | NL80211_ATTR_PMKID, | ||
| 829 | NL80211_ATTR_MAX_NUM_PMKIDS, | ||
| 830 | |||
| 831 | NL80211_ATTR_DURATION, | ||
| 832 | |||
| 833 | NL80211_ATTR_COOKIE, | ||
| 834 | |||
| 835 | NL80211_ATTR_WIPHY_COVERAGE_CLASS, | ||
| 836 | |||
| 837 | NL80211_ATTR_TX_RATES, | ||
| 838 | |||
| 839 | NL80211_ATTR_FRAME_MATCH, | ||
| 840 | |||
| 841 | NL80211_ATTR_ACK, | ||
| 842 | |||
| 843 | NL80211_ATTR_PS_STATE, | ||
| 844 | |||
| 717 | /* add attributes here, update the policy in nl80211.c */ | 845 | /* add attributes here, update the policy in nl80211.c */ |
| 718 | 846 | ||
| 719 | __NL80211_ATTR_AFTER_LAST, | 847 | __NL80211_ATTR_AFTER_LAST, |
| @@ -895,14 +1023,14 @@ enum nl80211_sta_info { | |||
| 895 | * | 1023 | * |
| 896 | * @NL80211_MPATH_FLAG_ACTIVE: the mesh path is active | 1024 | * @NL80211_MPATH_FLAG_ACTIVE: the mesh path is active |
| 897 | * @NL80211_MPATH_FLAG_RESOLVING: the mesh path discovery process is running | 1025 | * @NL80211_MPATH_FLAG_RESOLVING: the mesh path discovery process is running |
| 898 | * @NL80211_MPATH_FLAG_DSN_VALID: the mesh path contains a valid DSN | 1026 | * @NL80211_MPATH_FLAG_SN_VALID: the mesh path contains a valid SN |
| 899 | * @NL80211_MPATH_FLAG_FIXED: the mesh path has been manually set | 1027 | * @NL80211_MPATH_FLAG_FIXED: the mesh path has been manually set |
| 900 | * @NL80211_MPATH_FLAG_RESOLVED: the mesh path discovery process succeeded | 1028 | * @NL80211_MPATH_FLAG_RESOLVED: the mesh path discovery process succeeded |
| 901 | */ | 1029 | */ |
| 902 | enum nl80211_mpath_flags { | 1030 | enum nl80211_mpath_flags { |
| 903 | NL80211_MPATH_FLAG_ACTIVE = 1<<0, | 1031 | NL80211_MPATH_FLAG_ACTIVE = 1<<0, |
| 904 | NL80211_MPATH_FLAG_RESOLVING = 1<<1, | 1032 | NL80211_MPATH_FLAG_RESOLVING = 1<<1, |
| 905 | NL80211_MPATH_FLAG_DSN_VALID = 1<<2, | 1033 | NL80211_MPATH_FLAG_SN_VALID = 1<<2, |
| 906 | NL80211_MPATH_FLAG_FIXED = 1<<3, | 1034 | NL80211_MPATH_FLAG_FIXED = 1<<3, |
| 907 | NL80211_MPATH_FLAG_RESOLVED = 1<<4, | 1035 | NL80211_MPATH_FLAG_RESOLVED = 1<<4, |
| 908 | }; | 1036 | }; |
| @@ -915,7 +1043,7 @@ enum nl80211_mpath_flags { | |||
| 915 | * | 1043 | * |
| 916 | * @__NL80211_MPATH_INFO_INVALID: attribute number 0 is reserved | 1044 | * @__NL80211_MPATH_INFO_INVALID: attribute number 0 is reserved |
| 917 | * @NL80211_ATTR_MPATH_FRAME_QLEN: number of queued frames for this destination | 1045 | * @NL80211_ATTR_MPATH_FRAME_QLEN: number of queued frames for this destination |
| 918 | * @NL80211_ATTR_MPATH_DSN: destination sequence number | 1046 | * @NL80211_ATTR_MPATH_SN: destination sequence number |
| 919 | * @NL80211_ATTR_MPATH_METRIC: metric (cost) of this mesh path | 1047 | * @NL80211_ATTR_MPATH_METRIC: metric (cost) of this mesh path |
| 920 | * @NL80211_ATTR_MPATH_EXPTIME: expiration time for the path, in msec from now | 1048 | * @NL80211_ATTR_MPATH_EXPTIME: expiration time for the path, in msec from now |
| 921 | * @NL80211_ATTR_MPATH_FLAGS: mesh path flags, enumerated in | 1049 | * @NL80211_ATTR_MPATH_FLAGS: mesh path flags, enumerated in |
| @@ -926,7 +1054,7 @@ enum nl80211_mpath_flags { | |||
| 926 | enum nl80211_mpath_info { | 1054 | enum nl80211_mpath_info { |
| 927 | __NL80211_MPATH_INFO_INVALID, | 1055 | __NL80211_MPATH_INFO_INVALID, |
| 928 | NL80211_MPATH_INFO_FRAME_QLEN, | 1056 | NL80211_MPATH_INFO_FRAME_QLEN, |
| 929 | NL80211_MPATH_INFO_DSN, | 1057 | NL80211_MPATH_INFO_SN, |
| 930 | NL80211_MPATH_INFO_METRIC, | 1058 | NL80211_MPATH_INFO_METRIC, |
| 931 | NL80211_MPATH_INFO_EXPTIME, | 1059 | NL80211_MPATH_INFO_EXPTIME, |
| 932 | NL80211_MPATH_INFO_FLAGS, | 1060 | NL80211_MPATH_INFO_FLAGS, |
| @@ -1117,6 +1245,26 @@ enum nl80211_reg_rule_flags { | |||
| 1117 | }; | 1245 | }; |
| 1118 | 1246 | ||
| 1119 | /** | 1247 | /** |
| 1248 | * enum nl80211_survey_info - survey information | ||
| 1249 | * | ||
| 1250 | * These attribute types are used with %NL80211_ATTR_SURVEY_INFO | ||
| 1251 | * when getting information about a survey. | ||
| 1252 | * | ||
| 1253 | * @__NL80211_SURVEY_INFO_INVALID: attribute number 0 is reserved | ||
| 1254 | * @NL80211_SURVEY_INFO_FREQUENCY: center frequency of channel | ||
| 1255 | * @NL80211_SURVEY_INFO_NOISE: noise level of channel (u8, dBm) | ||
| 1256 | */ | ||
| 1257 | enum nl80211_survey_info { | ||
| 1258 | __NL80211_SURVEY_INFO_INVALID, | ||
| 1259 | NL80211_SURVEY_INFO_FREQUENCY, | ||
| 1260 | NL80211_SURVEY_INFO_NOISE, | ||
| 1261 | |||
| 1262 | /* keep last */ | ||
| 1263 | __NL80211_SURVEY_INFO_AFTER_LAST, | ||
| 1264 | NL80211_SURVEY_INFO_MAX = __NL80211_SURVEY_INFO_AFTER_LAST - 1 | ||
| 1265 | }; | ||
| 1266 | |||
| 1267 | /** | ||
| 1120 | * enum nl80211_mntr_flags - monitor configuration flags | 1268 | * enum nl80211_mntr_flags - monitor configuration flags |
| 1121 | * | 1269 | * |
| 1122 | * Monitor configuration flags. | 1270 | * Monitor configuration flags. |
| @@ -1196,6 +1344,8 @@ enum nl80211_mntr_flags { | |||
| 1196 | * @NL80211_MESHCONF_HWMP_NET_DIAM_TRVS_TIME: The interval of time (in TUs) | 1344 | * @NL80211_MESHCONF_HWMP_NET_DIAM_TRVS_TIME: The interval of time (in TUs) |
| 1197 | * that it takes for an HWMP information element to propagate across the mesh | 1345 | * that it takes for an HWMP information element to propagate across the mesh |
| 1198 | * | 1346 | * |
| 1347 | * @NL80211_MESHCONF_ROOTMODE: whether root mode is enabled or not | ||
| 1348 | * | ||
| 1199 | * @NL80211_MESHCONF_ATTR_MAX: highest possible mesh configuration attribute | 1349 | * @NL80211_MESHCONF_ATTR_MAX: highest possible mesh configuration attribute |
| 1200 | * | 1350 | * |
| 1201 | * @__NL80211_MESHCONF_ATTR_AFTER_LAST: internal use | 1351 | * @__NL80211_MESHCONF_ATTR_AFTER_LAST: internal use |
| @@ -1215,6 +1365,7 @@ enum nl80211_meshconf_params { | |||
| 1215 | NL80211_MESHCONF_HWMP_ACTIVE_PATH_TIMEOUT, | 1365 | NL80211_MESHCONF_HWMP_ACTIVE_PATH_TIMEOUT, |
| 1216 | NL80211_MESHCONF_HWMP_PREQ_MIN_INTERVAL, | 1366 | NL80211_MESHCONF_HWMP_PREQ_MIN_INTERVAL, |
| 1217 | NL80211_MESHCONF_HWMP_NET_DIAM_TRVS_TIME, | 1367 | NL80211_MESHCONF_HWMP_NET_DIAM_TRVS_TIME, |
| 1368 | NL80211_MESHCONF_HWMP_ROOTMODE, | ||
| 1218 | 1369 | ||
| 1219 | /* keep last */ | 1370 | /* keep last */ |
| 1220 | __NL80211_MESHCONF_ATTR_AFTER_LAST, | 1371 | __NL80211_MESHCONF_ATTR_AFTER_LAST, |
| @@ -1271,12 +1422,20 @@ enum nl80211_channel_type { | |||
| 1271 | * @NL80211_BSS_BEACON_INTERVAL: beacon interval of the (I)BSS (u16) | 1422 | * @NL80211_BSS_BEACON_INTERVAL: beacon interval of the (I)BSS (u16) |
| 1272 | * @NL80211_BSS_CAPABILITY: capability field (CPU order, u16) | 1423 | * @NL80211_BSS_CAPABILITY: capability field (CPU order, u16) |
| 1273 | * @NL80211_BSS_INFORMATION_ELEMENTS: binary attribute containing the | 1424 | * @NL80211_BSS_INFORMATION_ELEMENTS: binary attribute containing the |
| 1274 | * raw information elements from the probe response/beacon (bin) | 1425 | * raw information elements from the probe response/beacon (bin); |
| 1426 | * if the %NL80211_BSS_BEACON_IES attribute is present, the IEs here are | ||
| 1427 | * from a Probe Response frame; otherwise they are from a Beacon frame. | ||
| 1428 | * However, if the driver does not indicate the source of the IEs, these | ||
| 1429 | * IEs may be from either frame subtype. | ||
| 1275 | * @NL80211_BSS_SIGNAL_MBM: signal strength of probe response/beacon | 1430 | * @NL80211_BSS_SIGNAL_MBM: signal strength of probe response/beacon |
| 1276 | * in mBm (100 * dBm) (s32) | 1431 | * in mBm (100 * dBm) (s32) |
| 1277 | * @NL80211_BSS_SIGNAL_UNSPEC: signal strength of the probe response/beacon | 1432 | * @NL80211_BSS_SIGNAL_UNSPEC: signal strength of the probe response/beacon |
| 1278 | * in unspecified units, scaled to 0..100 (u8) | 1433 | * in unspecified units, scaled to 0..100 (u8) |
| 1279 | * @NL80211_BSS_STATUS: status, if this BSS is "used" | 1434 | * @NL80211_BSS_STATUS: status, if this BSS is "used" |
| 1435 | * @NL80211_BSS_SEEN_MS_AGO: age of this BSS entry in ms | ||
| 1436 | * @NL80211_BSS_BEACON_IES: binary attribute containing the raw information | ||
| 1437 | * elements from a Beacon frame (bin); not present if no Beacon frame has | ||
| 1438 | * yet been received | ||
| 1280 | * @__NL80211_BSS_AFTER_LAST: internal | 1439 | * @__NL80211_BSS_AFTER_LAST: internal |
| 1281 | * @NL80211_BSS_MAX: highest BSS attribute | 1440 | * @NL80211_BSS_MAX: highest BSS attribute |
| 1282 | */ | 1441 | */ |
| @@ -1291,6 +1450,8 @@ enum nl80211_bss { | |||
| 1291 | NL80211_BSS_SIGNAL_MBM, | 1450 | NL80211_BSS_SIGNAL_MBM, |
| 1292 | NL80211_BSS_SIGNAL_UNSPEC, | 1451 | NL80211_BSS_SIGNAL_UNSPEC, |
| 1293 | NL80211_BSS_STATUS, | 1452 | NL80211_BSS_STATUS, |
| 1453 | NL80211_BSS_SEEN_MS_AGO, | ||
| 1454 | NL80211_BSS_BEACON_IES, | ||
| 1294 | 1455 | ||
| 1295 | /* keep last */ | 1456 | /* keep last */ |
| 1296 | __NL80211_BSS_AFTER_LAST, | 1457 | __NL80211_BSS_AFTER_LAST, |
| @@ -1388,4 +1549,38 @@ enum nl80211_key_attributes { | |||
| 1388 | NL80211_KEY_MAX = __NL80211_KEY_AFTER_LAST - 1 | 1549 | NL80211_KEY_MAX = __NL80211_KEY_AFTER_LAST - 1 |
| 1389 | }; | 1550 | }; |
| 1390 | 1551 | ||
| 1552 | /** | ||
| 1553 | * enum nl80211_tx_rate_attributes - TX rate set attributes | ||
| 1554 | * @__NL80211_TXRATE_INVALID: invalid | ||
| 1555 | * @NL80211_TXRATE_LEGACY: Legacy (non-MCS) rates allowed for TX rate selection | ||
| 1556 | * in an array of rates as defined in IEEE 802.11 7.3.2.2 (u8 values with | ||
| 1557 | * 1 = 500 kbps) but without the IE length restriction (at most | ||
| 1558 | * %NL80211_MAX_SUPP_RATES in a single array). | ||
| 1559 | * @__NL80211_TXRATE_AFTER_LAST: internal | ||
| 1560 | * @NL80211_TXRATE_MAX: highest TX rate attribute | ||
| 1561 | */ | ||
| 1562 | enum nl80211_tx_rate_attributes { | ||
| 1563 | __NL80211_TXRATE_INVALID, | ||
| 1564 | NL80211_TXRATE_LEGACY, | ||
| 1565 | |||
| 1566 | /* keep last */ | ||
| 1567 | __NL80211_TXRATE_AFTER_LAST, | ||
| 1568 | NL80211_TXRATE_MAX = __NL80211_TXRATE_AFTER_LAST - 1 | ||
| 1569 | }; | ||
| 1570 | |||
| 1571 | /** | ||
| 1572 | * enum nl80211_band - Frequency band | ||
| 1573 | * @NL80211_BAND_2GHZ - 2.4 GHz ISM band | ||
| 1574 | * @NL80211_BAND_5GHZ - around 5 GHz band (4.9 - 5.7 GHz) | ||
| 1575 | */ | ||
| 1576 | enum nl80211_band { | ||
| 1577 | NL80211_BAND_2GHZ, | ||
| 1578 | NL80211_BAND_5GHZ, | ||
| 1579 | }; | ||
| 1580 | |||
| 1581 | enum nl80211_ps_state { | ||
| 1582 | NL80211_PS_DISABLED, | ||
| 1583 | NL80211_PS_ENABLED, | ||
| 1584 | }; | ||
| 1585 | |||
| 1391 | #endif /* __LINUX_NL80211_H */ | 1586 | #endif /* __LINUX_NL80211_H */ |
diff --git a/include/linux/nl802154.h b/include/linux/nl802154.h index b7d9435d5a9f..33d9f5175109 100644 --- a/include/linux/nl802154.h +++ b/include/linux/nl802154.h | |||
| @@ -65,6 +65,9 @@ enum { | |||
| 65 | IEEE802154_ATTR_SEC, | 65 | IEEE802154_ATTR_SEC, |
| 66 | 66 | ||
| 67 | IEEE802154_ATTR_PAGE, | 67 | IEEE802154_ATTR_PAGE, |
| 68 | IEEE802154_ATTR_CHANNEL_PAGE_LIST, | ||
| 69 | |||
| 70 | IEEE802154_ATTR_PHY_NAME, | ||
| 68 | 71 | ||
| 69 | __IEEE802154_ATTR_MAX, | 72 | __IEEE802154_ATTR_MAX, |
| 70 | }; | 73 | }; |
| @@ -114,6 +117,9 @@ enum { | |||
| 114 | IEEE802154_RX_ENABLE_CONF, /* Not supported yet */ | 117 | IEEE802154_RX_ENABLE_CONF, /* Not supported yet */ |
| 115 | 118 | ||
| 116 | IEEE802154_LIST_IFACE, | 119 | IEEE802154_LIST_IFACE, |
| 120 | IEEE802154_LIST_PHY, | ||
| 121 | IEEE802154_ADD_IFACE, | ||
| 122 | IEEE802154_DEL_IFACE, | ||
| 117 | 123 | ||
| 118 | __IEEE802154_CMD_MAX, | 124 | __IEEE802154_CMD_MAX, |
| 119 | }; | 125 | }; |
diff --git a/include/linux/node.h b/include/linux/node.h index 681a697b9a86..06292dac3eab 100644 --- a/include/linux/node.h +++ b/include/linux/node.h | |||
| @@ -21,13 +21,19 @@ | |||
| 21 | 21 | ||
| 22 | #include <linux/sysdev.h> | 22 | #include <linux/sysdev.h> |
| 23 | #include <linux/cpumask.h> | 23 | #include <linux/cpumask.h> |
| 24 | #include <linux/workqueue.h> | ||
| 24 | 25 | ||
| 25 | struct node { | 26 | struct node { |
| 26 | struct sys_device sysdev; | 27 | struct sys_device sysdev; |
| 28 | |||
| 29 | #if defined(CONFIG_MEMORY_HOTPLUG_SPARSE) && defined(CONFIG_HUGETLBFS) | ||
| 30 | struct work_struct node_work; | ||
| 31 | #endif | ||
| 27 | }; | 32 | }; |
| 28 | 33 | ||
| 29 | struct memory_block; | 34 | struct memory_block; |
| 30 | extern struct node node_devices[]; | 35 | extern struct node node_devices[]; |
| 36 | typedef void (*node_registration_func_t)(struct node *); | ||
| 31 | 37 | ||
| 32 | extern int register_node(struct node *, int, struct node *); | 38 | extern int register_node(struct node *, int, struct node *); |
| 33 | extern void unregister_node(struct node *node); | 39 | extern void unregister_node(struct node *node); |
| @@ -39,6 +45,11 @@ extern int unregister_cpu_under_node(unsigned int cpu, unsigned int nid); | |||
| 39 | extern int register_mem_sect_under_node(struct memory_block *mem_blk, | 45 | extern int register_mem_sect_under_node(struct memory_block *mem_blk, |
| 40 | int nid); | 46 | int nid); |
| 41 | extern int unregister_mem_sect_under_nodes(struct memory_block *mem_blk); | 47 | extern int unregister_mem_sect_under_nodes(struct memory_block *mem_blk); |
| 48 | |||
| 49 | #ifdef CONFIG_HUGETLBFS | ||
| 50 | extern void register_hugetlbfs_with_node(node_registration_func_t doregister, | ||
| 51 | node_registration_func_t unregister); | ||
| 52 | #endif | ||
| 42 | #else | 53 | #else |
| 43 | static inline int register_one_node(int nid) | 54 | static inline int register_one_node(int nid) |
| 44 | { | 55 | { |
| @@ -65,6 +76,11 @@ static inline int unregister_mem_sect_under_nodes(struct memory_block *mem_blk) | |||
| 65 | { | 76 | { |
| 66 | return 0; | 77 | return 0; |
| 67 | } | 78 | } |
| 79 | |||
| 80 | static inline void register_hugetlbfs_with_node(node_registration_func_t reg, | ||
| 81 | node_registration_func_t unreg) | ||
| 82 | { | ||
| 83 | } | ||
| 68 | #endif | 84 | #endif |
| 69 | 85 | ||
| 70 | #define to_node(sys_device) container_of(sys_device, struct node, sysdev) | 86 | #define to_node(sys_device) container_of(sys_device, struct node, sysdev) |
diff --git a/include/linux/nodemask.h b/include/linux/nodemask.h index b359c4a9ec9e..dba35e413371 100644 --- a/include/linux/nodemask.h +++ b/include/linux/nodemask.h | |||
| @@ -69,8 +69,6 @@ | |||
| 69 | * int node_online(node) Is some node online? | 69 | * int node_online(node) Is some node online? |
| 70 | * int node_possible(node) Is some node possible? | 70 | * int node_possible(node) Is some node possible? |
| 71 | * | 71 | * |
| 72 | * int any_online_node(mask) First online node in mask | ||
| 73 | * | ||
| 74 | * node_set_online(node) set bit 'node' in node_online_map | 72 | * node_set_online(node) set bit 'node' in node_online_map |
| 75 | * node_set_offline(node) clear bit 'node' in node_online_map | 73 | * node_set_offline(node) clear bit 'node' in node_online_map |
| 76 | * | 74 | * |
| @@ -245,14 +243,19 @@ static inline int __next_node(int n, const nodemask_t *srcp) | |||
| 245 | return min_t(int,MAX_NUMNODES,find_next_bit(srcp->bits, MAX_NUMNODES, n+1)); | 243 | return min_t(int,MAX_NUMNODES,find_next_bit(srcp->bits, MAX_NUMNODES, n+1)); |
| 246 | } | 244 | } |
| 247 | 245 | ||
| 246 | static inline void init_nodemask_of_node(nodemask_t *mask, int node) | ||
| 247 | { | ||
| 248 | nodes_clear(*mask); | ||
| 249 | node_set(node, *mask); | ||
| 250 | } | ||
| 251 | |||
| 248 | #define nodemask_of_node(node) \ | 252 | #define nodemask_of_node(node) \ |
| 249 | ({ \ | 253 | ({ \ |
| 250 | typeof(_unused_nodemask_arg_) m; \ | 254 | typeof(_unused_nodemask_arg_) m; \ |
| 251 | if (sizeof(m) == sizeof(unsigned long)) { \ | 255 | if (sizeof(m) == sizeof(unsigned long)) { \ |
| 252 | m.bits[0] = 1UL<<(node); \ | 256 | m.bits[0] = 1UL << (node); \ |
| 253 | } else { \ | 257 | } else { \ |
| 254 | nodes_clear(m); \ | 258 | init_nodemask_of_node(&m, (node)); \ |
| 255 | node_set((node), m); \ | ||
| 256 | } \ | 259 | } \ |
| 257 | m; \ | 260 | m; \ |
| 258 | }) | 261 | }) |
| @@ -462,15 +465,6 @@ static inline int num_node_state(enum node_states state) | |||
| 462 | #define node_online_map node_states[N_ONLINE] | 465 | #define node_online_map node_states[N_ONLINE] |
| 463 | #define node_possible_map node_states[N_POSSIBLE] | 466 | #define node_possible_map node_states[N_POSSIBLE] |
| 464 | 467 | ||
| 465 | #define any_online_node(mask) \ | ||
| 466 | ({ \ | ||
| 467 | int node; \ | ||
| 468 | for_each_node_mask(node, (mask)) \ | ||
| 469 | if (node_online(node)) \ | ||
| 470 | break; \ | ||
| 471 | node; \ | ||
| 472 | }) | ||
| 473 | |||
| 474 | #define num_online_nodes() num_node_state(N_ONLINE) | 468 | #define num_online_nodes() num_node_state(N_ONLINE) |
| 475 | #define num_possible_nodes() num_node_state(N_POSSIBLE) | 469 | #define num_possible_nodes() num_node_state(N_POSSIBLE) |
| 476 | #define node_online(node) node_state((node), N_ONLINE) | 470 | #define node_online(node) node_state((node), N_ONLINE) |
| @@ -480,15 +474,17 @@ static inline int num_node_state(enum node_states state) | |||
| 480 | #define for_each_online_node(node) for_each_node_state(node, N_ONLINE) | 474 | #define for_each_online_node(node) for_each_node_state(node, N_ONLINE) |
| 481 | 475 | ||
| 482 | /* | 476 | /* |
| 483 | * For nodemask scrach area.(See CPUMASK_ALLOC() in cpumask.h) | 477 | * For nodemask scrach area. |
| 478 | * NODEMASK_ALLOC(type, name) allocates an object with a specified type and | ||
| 479 | * name. | ||
| 484 | */ | 480 | */ |
| 485 | 481 | #if NODES_SHIFT > 8 /* nodemask_t > 256 bytes */ | |
| 486 | #if NODES_SHIFT > 8 /* nodemask_t > 64 bytes */ | 482 | #define NODEMASK_ALLOC(type, name, gfp_flags) \ |
| 487 | #define NODEMASK_ALLOC(x, m) struct x *m = kmalloc(sizeof(*m), GFP_KERNEL) | 483 | type *name = kmalloc(sizeof(*name), gfp_flags) |
| 488 | #define NODEMASK_FREE(m) kfree(m) | 484 | #define NODEMASK_FREE(m) kfree(m) |
| 489 | #else | 485 | #else |
| 490 | #define NODEMASK_ALLOC(x, m) struct x _m, *m = &_m | 486 | #define NODEMASK_ALLOC(type, name, gfp_flags) type _##name, *name = &_##name |
| 491 | #define NODEMASK_FREE(m) | 487 | #define NODEMASK_FREE(m) do {} while (0) |
| 492 | #endif | 488 | #endif |
| 493 | 489 | ||
| 494 | /* A example struture for using NODEMASK_ALLOC, used in mempolicy. */ | 490 | /* A example struture for using NODEMASK_ALLOC, used in mempolicy. */ |
| @@ -497,8 +493,10 @@ struct nodemask_scratch { | |||
| 497 | nodemask_t mask2; | 493 | nodemask_t mask2; |
| 498 | }; | 494 | }; |
| 499 | 495 | ||
| 500 | #define NODEMASK_SCRATCH(x) NODEMASK_ALLOC(nodemask_scratch, x) | 496 | #define NODEMASK_SCRATCH(x) \ |
| 501 | #define NODEMASK_SCRATCH_FREE(x) NODEMASK_FREE(x) | 497 | NODEMASK_ALLOC(struct nodemask_scratch, x, \ |
| 498 | GFP_KERNEL | __GFP_NORETRY) | ||
| 499 | #define NODEMASK_SCRATCH_FREE(x) NODEMASK_FREE(x) | ||
| 502 | 500 | ||
| 503 | 501 | ||
| 504 | #endif /* __LINUX_NODEMASK_H */ | 502 | #endif /* __LINUX_NODEMASK_H */ |
diff --git a/include/linux/notifier.h b/include/linux/notifier.h index 44428d247dbe..fee6c2f68075 100644 --- a/include/linux/notifier.h +++ b/include/linux/notifier.h | |||
| @@ -201,6 +201,8 @@ static inline int notifier_to_errno(int ret) | |||
| 201 | #define NETDEV_PRE_UP 0x000D | 201 | #define NETDEV_PRE_UP 0x000D |
| 202 | #define NETDEV_BONDING_OLDTYPE 0x000E | 202 | #define NETDEV_BONDING_OLDTYPE 0x000E |
| 203 | #define NETDEV_BONDING_NEWTYPE 0x000F | 203 | #define NETDEV_BONDING_NEWTYPE 0x000F |
| 204 | #define NETDEV_POST_INIT 0x0010 | ||
| 205 | #define NETDEV_UNREGISTER_BATCH 0x0011 | ||
| 204 | 206 | ||
| 205 | #define SYS_DOWN 0x0001 /* Notify of system down */ | 207 | #define SYS_DOWN 0x0001 /* Notify of system down */ |
| 206 | #define SYS_RESTART SYS_DOWN | 208 | #define SYS_RESTART SYS_DOWN |
diff --git a/include/linux/numa.h b/include/linux/numa.h index a31a7301b159..3aaa31603a86 100644 --- a/include/linux/numa.h +++ b/include/linux/numa.h | |||
| @@ -10,4 +10,6 @@ | |||
| 10 | 10 | ||
| 11 | #define MAX_NUMNODES (1 << NODES_SHIFT) | 11 | #define MAX_NUMNODES (1 << NODES_SHIFT) |
| 12 | 12 | ||
| 13 | #define NUMA_NO_NODE (-1) | ||
| 14 | |||
| 13 | #endif /* _LINUX_NUMA_H */ | 15 | #endif /* _LINUX_NUMA_H */ |
diff --git a/include/linux/of.h b/include/linux/of.h index 7be2d1043c16..a367e19bb3af 100644 --- a/include/linux/of.h +++ b/include/linux/of.h | |||
| @@ -17,14 +17,128 @@ | |||
| 17 | */ | 17 | */ |
| 18 | #include <linux/types.h> | 18 | #include <linux/types.h> |
| 19 | #include <linux/bitops.h> | 19 | #include <linux/bitops.h> |
| 20 | #include <linux/kref.h> | ||
| 20 | #include <linux/mod_devicetable.h> | 21 | #include <linux/mod_devicetable.h> |
| 22 | #include <linux/spinlock.h> | ||
| 23 | |||
| 24 | #include <asm/byteorder.h> | ||
| 25 | |||
| 26 | #ifdef CONFIG_OF | ||
| 27 | |||
| 28 | typedef u32 phandle; | ||
| 29 | typedef u32 ihandle; | ||
| 30 | |||
| 31 | struct property { | ||
| 32 | char *name; | ||
| 33 | int length; | ||
| 34 | void *value; | ||
| 35 | struct property *next; | ||
| 36 | unsigned long _flags; | ||
| 37 | unsigned int unique_id; | ||
| 38 | }; | ||
| 39 | |||
| 40 | #if defined(CONFIG_SPARC) | ||
| 41 | struct of_irq_controller; | ||
| 42 | #endif | ||
| 43 | |||
| 44 | struct device_node { | ||
| 45 | const char *name; | ||
| 46 | const char *type; | ||
| 47 | phandle phandle; | ||
| 48 | char *full_name; | ||
| 49 | |||
| 50 | struct property *properties; | ||
| 51 | struct property *deadprops; /* removed properties */ | ||
| 52 | struct device_node *parent; | ||
| 53 | struct device_node *child; | ||
| 54 | struct device_node *sibling; | ||
| 55 | struct device_node *next; /* next device of same type */ | ||
| 56 | struct device_node *allnext; /* next in list of all nodes */ | ||
| 57 | struct proc_dir_entry *pde; /* this node's proc directory */ | ||
| 58 | struct kref kref; | ||
| 59 | unsigned long _flags; | ||
| 60 | void *data; | ||
| 61 | #if defined(CONFIG_SPARC) | ||
| 62 | char *path_component_name; | ||
| 63 | unsigned int unique_id; | ||
| 64 | struct of_irq_controller *irq_trans; | ||
| 65 | #endif | ||
| 66 | }; | ||
| 67 | |||
| 68 | /* Pointer for first entry in chain of all nodes. */ | ||
| 69 | extern struct device_node *allnodes; | ||
| 70 | extern struct device_node *of_chosen; | ||
| 71 | extern rwlock_t devtree_lock; | ||
| 72 | |||
| 73 | static inline int of_node_check_flag(struct device_node *n, unsigned long flag) | ||
| 74 | { | ||
| 75 | return test_bit(flag, &n->_flags); | ||
| 76 | } | ||
| 77 | |||
| 78 | static inline void of_node_set_flag(struct device_node *n, unsigned long flag) | ||
| 79 | { | ||
| 80 | set_bit(flag, &n->_flags); | ||
| 81 | } | ||
| 82 | |||
| 83 | extern struct device_node *of_find_all_nodes(struct device_node *prev); | ||
| 84 | |||
| 85 | #if defined(CONFIG_SPARC) | ||
| 86 | /* Dummy ref counting routines - to be implemented later */ | ||
| 87 | static inline struct device_node *of_node_get(struct device_node *node) | ||
| 88 | { | ||
| 89 | return node; | ||
| 90 | } | ||
| 91 | static inline void of_node_put(struct device_node *node) | ||
| 92 | { | ||
| 93 | } | ||
| 94 | |||
| 95 | #else | ||
| 96 | extern struct device_node *of_node_get(struct device_node *node); | ||
| 97 | extern void of_node_put(struct device_node *node); | ||
| 98 | #endif | ||
| 99 | |||
| 100 | /* | ||
| 101 | * OF address retreival & translation | ||
| 102 | */ | ||
| 103 | |||
| 104 | /* Helper to read a big number; size is in cells (not bytes) */ | ||
| 105 | static inline u64 of_read_number(const __be32 *cell, int size) | ||
| 106 | { | ||
| 107 | u64 r = 0; | ||
| 108 | while (size--) | ||
| 109 | r = (r << 32) | be32_to_cpu(*(cell++)); | ||
| 110 | return r; | ||
| 111 | } | ||
| 112 | |||
| 113 | /* Like of_read_number, but we want an unsigned long result */ | ||
| 114 | static inline unsigned long of_read_ulong(const __be32 *cell, int size) | ||
| 115 | { | ||
| 116 | /* toss away upper bits if unsigned long is smaller than u64 */ | ||
| 117 | return of_read_number(cell, size); | ||
| 118 | } | ||
| 21 | 119 | ||
| 22 | #include <asm/prom.h> | 120 | #include <asm/prom.h> |
| 23 | 121 | ||
| 122 | /* Default #address and #size cells. Allow arch asm/prom.h to override */ | ||
| 123 | #if !defined(OF_ROOT_NODE_ADDR_CELLS_DEFAULT) | ||
| 124 | #define OF_ROOT_NODE_ADDR_CELLS_DEFAULT 1 | ||
| 125 | #define OF_ROOT_NODE_SIZE_CELLS_DEFAULT 1 | ||
| 126 | #endif | ||
| 127 | |||
| 128 | /* Default string compare functions, Allow arch asm/prom.h to override */ | ||
| 129 | #if !defined(of_compat_cmp) | ||
| 130 | #define of_compat_cmp(s1, s2, l) strcasecmp((s1), (s2)) | ||
| 131 | #define of_prop_cmp(s1, s2) strcmp((s1), (s2)) | ||
| 132 | #define of_node_cmp(s1, s2) strcasecmp((s1), (s2)) | ||
| 133 | #endif | ||
| 134 | |||
| 24 | /* flag descriptions */ | 135 | /* flag descriptions */ |
| 25 | #define OF_DYNAMIC 1 /* node and properties were allocated via kmalloc */ | 136 | #define OF_DYNAMIC 1 /* node and properties were allocated via kmalloc */ |
| 26 | #define OF_DETACHED 2 /* node has been detached from the device tree */ | 137 | #define OF_DETACHED 2 /* node has been detached from the device tree */ |
| 27 | 138 | ||
| 139 | #define OF_IS_DYNAMIC(x) test_bit(OF_DYNAMIC, &x->_flags) | ||
| 140 | #define OF_MARK_DYNAMIC(x) set_bit(OF_DYNAMIC, &x->_flags) | ||
| 141 | |||
| 28 | #define OF_BAD_ADDR ((u64)-1) | 142 | #define OF_BAD_ADDR ((u64)-1) |
| 29 | 143 | ||
| 30 | extern struct device_node *of_find_node_by_name(struct device_node *from, | 144 | extern struct device_node *of_find_node_by_name(struct device_node *from, |
| @@ -84,4 +198,19 @@ extern int of_parse_phandles_with_args(struct device_node *np, | |||
| 84 | const char *list_name, const char *cells_name, int index, | 198 | const char *list_name, const char *cells_name, int index, |
| 85 | struct device_node **out_node, const void **out_args); | 199 | struct device_node **out_node, const void **out_args); |
| 86 | 200 | ||
| 201 | extern int of_machine_is_compatible(const char *compat); | ||
| 202 | |||
| 203 | extern int prom_add_property(struct device_node* np, struct property* prop); | ||
| 204 | extern int prom_remove_property(struct device_node *np, struct property *prop); | ||
| 205 | extern int prom_update_property(struct device_node *np, | ||
| 206 | struct property *newprop, | ||
| 207 | struct property *oldprop); | ||
| 208 | |||
| 209 | #if defined(CONFIG_OF_DYNAMIC) | ||
| 210 | /* For updating the device tree at runtime */ | ||
| 211 | extern void of_attach_node(struct device_node *); | ||
| 212 | extern void of_detach_node(struct device_node *); | ||
| 213 | #endif | ||
| 214 | |||
| 215 | #endif /* CONFIG_OF */ | ||
| 87 | #endif /* _LINUX_OF_H */ | 216 | #endif /* _LINUX_OF_H */ |
diff --git a/include/linux/of_fdt.h b/include/linux/of_fdt.h new file mode 100644 index 000000000000..a1ca92ccb0ff --- /dev/null +++ b/include/linux/of_fdt.h | |||
| @@ -0,0 +1,103 @@ | |||
| 1 | /* | ||
| 2 | * Definitions for working with the Flattened Device Tree data format | ||
| 3 | * | ||
| 4 | * Copyright 2009 Benjamin Herrenschmidt, IBM Corp | ||
| 5 | * benh@kernel.crashing.org | ||
| 6 | * | ||
| 7 | * This program is free software; you can redistribute it and/or | ||
| 8 | * modify it under the terms of the GNU General Public License | ||
| 9 | * version 2 as published by the Free Software Foundation. | ||
| 10 | */ | ||
| 11 | |||
| 12 | #ifndef _LINUX_OF_FDT_H | ||
| 13 | #define _LINUX_OF_FDT_H | ||
| 14 | |||
| 15 | #include <linux/types.h> | ||
| 16 | #include <linux/init.h> | ||
| 17 | |||
| 18 | /* Definitions used by the flattened device tree */ | ||
| 19 | #define OF_DT_HEADER 0xd00dfeed /* marker */ | ||
| 20 | #define OF_DT_BEGIN_NODE 0x1 /* Start of node, full name */ | ||
| 21 | #define OF_DT_END_NODE 0x2 /* End node */ | ||
| 22 | #define OF_DT_PROP 0x3 /* Property: name off, size, | ||
| 23 | * content */ | ||
| 24 | #define OF_DT_NOP 0x4 /* nop */ | ||
| 25 | #define OF_DT_END 0x9 | ||
| 26 | |||
| 27 | #define OF_DT_VERSION 0x10 | ||
| 28 | |||
| 29 | #ifndef __ASSEMBLY__ | ||
| 30 | /* | ||
| 31 | * This is what gets passed to the kernel by prom_init or kexec | ||
| 32 | * | ||
| 33 | * The dt struct contains the device tree structure, full pathes and | ||
| 34 | * property contents. The dt strings contain a separate block with just | ||
| 35 | * the strings for the property names, and is fully page aligned and | ||
| 36 | * self contained in a page, so that it can be kept around by the kernel, | ||
| 37 | * each property name appears only once in this page (cheap compression) | ||
| 38 | * | ||
| 39 | * the mem_rsvmap contains a map of reserved ranges of physical memory, | ||
| 40 | * passing it here instead of in the device-tree itself greatly simplifies | ||
| 41 | * the job of everybody. It's just a list of u64 pairs (base/size) that | ||
| 42 | * ends when size is 0 | ||
| 43 | */ | ||
| 44 | struct boot_param_header { | ||
| 45 | __be32 magic; /* magic word OF_DT_HEADER */ | ||
| 46 | __be32 totalsize; /* total size of DT block */ | ||
| 47 | __be32 off_dt_struct; /* offset to structure */ | ||
| 48 | __be32 off_dt_strings; /* offset to strings */ | ||
| 49 | __be32 off_mem_rsvmap; /* offset to memory reserve map */ | ||
| 50 | __be32 version; /* format version */ | ||
| 51 | __be32 last_comp_version; /* last compatible version */ | ||
| 52 | /* version 2 fields below */ | ||
| 53 | __be32 boot_cpuid_phys; /* Physical CPU id we're booting on */ | ||
| 54 | /* version 3 fields below */ | ||
| 55 | __be32 dt_strings_size; /* size of the DT strings block */ | ||
| 56 | /* version 17 fields below */ | ||
| 57 | __be32 dt_struct_size; /* size of the DT structure block */ | ||
| 58 | }; | ||
| 59 | |||
| 60 | /* TBD: Temporary export of fdt globals - remove when code fully merged */ | ||
| 61 | extern int __initdata dt_root_addr_cells; | ||
| 62 | extern int __initdata dt_root_size_cells; | ||
| 63 | extern struct boot_param_header *initial_boot_params; | ||
| 64 | |||
| 65 | /* For scanning the flat device-tree at boot time */ | ||
| 66 | extern char *find_flat_dt_string(u32 offset); | ||
| 67 | extern int of_scan_flat_dt(int (*it)(unsigned long node, const char *uname, | ||
| 68 | int depth, void *data), | ||
| 69 | void *data); | ||
| 70 | extern void *of_get_flat_dt_prop(unsigned long node, const char *name, | ||
| 71 | unsigned long *size); | ||
| 72 | extern int of_flat_dt_is_compatible(unsigned long node, const char *name); | ||
| 73 | extern unsigned long of_get_flat_dt_root(void); | ||
| 74 | extern void early_init_dt_scan_chosen_arch(unsigned long node); | ||
| 75 | extern int early_init_dt_scan_chosen(unsigned long node, const char *uname, | ||
| 76 | int depth, void *data); | ||
| 77 | extern void early_init_dt_check_for_initrd(unsigned long node); | ||
| 78 | extern int early_init_dt_scan_memory(unsigned long node, const char *uname, | ||
| 79 | int depth, void *data); | ||
| 80 | extern void early_init_dt_add_memory_arch(u64 base, u64 size); | ||
| 81 | extern u64 early_init_dt_alloc_memory_arch(u64 size, u64 align); | ||
| 82 | extern u64 dt_mem_next_cell(int s, __be32 **cellp); | ||
| 83 | |||
| 84 | /* | ||
| 85 | * If BLK_DEV_INITRD, the fdt early init code will call this function, | ||
| 86 | * to be provided by the arch code. start and end are specified as | ||
| 87 | * physical addresses. | ||
| 88 | */ | ||
| 89 | #ifdef CONFIG_BLK_DEV_INITRD | ||
| 90 | extern void early_init_dt_setup_initrd_arch(unsigned long start, | ||
| 91 | unsigned long end); | ||
| 92 | #endif | ||
| 93 | |||
| 94 | /* Early flat tree scan hooks */ | ||
| 95 | extern int early_init_dt_scan_root(unsigned long node, const char *uname, | ||
| 96 | int depth, void *data); | ||
| 97 | |||
| 98 | /* Other Prototypes */ | ||
| 99 | extern void unflatten_device_tree(void); | ||
| 100 | extern void early_init_devtree(void *); | ||
| 101 | |||
| 102 | #endif /* __ASSEMBLY__ */ | ||
| 103 | #endif /* _LINUX_OF_FDT_H */ | ||
diff --git a/include/linux/omapfb.h b/include/linux/omapfb.h new file mode 100644 index 000000000000..9bdd91486b49 --- /dev/null +++ b/include/linux/omapfb.h | |||
| @@ -0,0 +1,260 @@ | |||
| 1 | /* | ||
| 2 | * File: include/linux/omapfb.h | ||
| 3 | * | ||
| 4 | * Framebuffer driver for TI OMAP boards | ||
| 5 | * | ||
| 6 | * Copyright (C) 2004 Nokia Corporation | ||
| 7 | * Author: Imre Deak <imre.deak@nokia.com> | ||
| 8 | * | ||
| 9 | * This program is free software; you can redistribute it and/or modify it | ||
| 10 | * under the terms of the GNU General Public License as published by the | ||
| 11 | * Free Software Foundation; either version 2 of the License, or (at your | ||
| 12 | * option) any later version. | ||
| 13 | * | ||
| 14 | * This program is distributed in the hope that it will be useful, but | ||
| 15 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| 17 | * General Public License for more details. | ||
| 18 | * | ||
| 19 | * You should have received a copy of the GNU General Public License along | ||
| 20 | * with this program; if not, write to the Free Software Foundation, Inc., | ||
| 21 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | ||
| 22 | */ | ||
| 23 | |||
| 24 | #ifndef __LINUX_OMAPFB_H__ | ||
| 25 | #define __LINUX_OMAPFB_H__ | ||
| 26 | |||
| 27 | #include <linux/fb.h> | ||
| 28 | #include <linux/ioctl.h> | ||
| 29 | #include <linux/types.h> | ||
| 30 | |||
| 31 | /* IOCTL commands. */ | ||
| 32 | |||
| 33 | #define OMAP_IOW(num, dtype) _IOW('O', num, dtype) | ||
| 34 | #define OMAP_IOR(num, dtype) _IOR('O', num, dtype) | ||
| 35 | #define OMAP_IOWR(num, dtype) _IOWR('O', num, dtype) | ||
| 36 | #define OMAP_IO(num) _IO('O', num) | ||
| 37 | |||
| 38 | #define OMAPFB_MIRROR OMAP_IOW(31, int) | ||
| 39 | #define OMAPFB_SYNC_GFX OMAP_IO(37) | ||
| 40 | #define OMAPFB_VSYNC OMAP_IO(38) | ||
| 41 | #define OMAPFB_SET_UPDATE_MODE OMAP_IOW(40, int) | ||
| 42 | #define OMAPFB_GET_CAPS OMAP_IOR(42, struct omapfb_caps) | ||
| 43 | #define OMAPFB_GET_UPDATE_MODE OMAP_IOW(43, int) | ||
| 44 | #define OMAPFB_LCD_TEST OMAP_IOW(45, int) | ||
| 45 | #define OMAPFB_CTRL_TEST OMAP_IOW(46, int) | ||
| 46 | #define OMAPFB_UPDATE_WINDOW_OLD OMAP_IOW(47, struct omapfb_update_window_old) | ||
| 47 | #define OMAPFB_SET_COLOR_KEY OMAP_IOW(50, struct omapfb_color_key) | ||
| 48 | #define OMAPFB_GET_COLOR_KEY OMAP_IOW(51, struct omapfb_color_key) | ||
| 49 | #define OMAPFB_SETUP_PLANE OMAP_IOW(52, struct omapfb_plane_info) | ||
| 50 | #define OMAPFB_QUERY_PLANE OMAP_IOW(53, struct omapfb_plane_info) | ||
| 51 | #define OMAPFB_UPDATE_WINDOW OMAP_IOW(54, struct omapfb_update_window) | ||
| 52 | #define OMAPFB_SETUP_MEM OMAP_IOW(55, struct omapfb_mem_info) | ||
| 53 | #define OMAPFB_QUERY_MEM OMAP_IOW(56, struct omapfb_mem_info) | ||
| 54 | #define OMAPFB_WAITFORVSYNC OMAP_IO(57) | ||
| 55 | #define OMAPFB_MEMORY_READ OMAP_IOR(58, struct omapfb_memory_read) | ||
| 56 | #define OMAPFB_GET_OVERLAY_COLORMODE OMAP_IOR(59, struct omapfb_ovl_colormode) | ||
| 57 | #define OMAPFB_WAITFORGO OMAP_IO(60) | ||
| 58 | #define OMAPFB_GET_VRAM_INFO OMAP_IOR(61, struct omapfb_vram_info) | ||
| 59 | #define OMAPFB_SET_TEARSYNC OMAP_IOW(62, struct omapfb_tearsync_info) | ||
| 60 | #define OMAPFB_GET_DISPLAY_INFO OMAP_IOR(63, struct omapfb_display_info) | ||
| 61 | |||
| 62 | #define OMAPFB_CAPS_GENERIC_MASK 0x00000fff | ||
| 63 | #define OMAPFB_CAPS_LCDC_MASK 0x00fff000 | ||
| 64 | #define OMAPFB_CAPS_PANEL_MASK 0xff000000 | ||
| 65 | |||
| 66 | #define OMAPFB_CAPS_MANUAL_UPDATE 0x00001000 | ||
| 67 | #define OMAPFB_CAPS_TEARSYNC 0x00002000 | ||
| 68 | #define OMAPFB_CAPS_PLANE_RELOCATE_MEM 0x00004000 | ||
| 69 | #define OMAPFB_CAPS_PLANE_SCALE 0x00008000 | ||
| 70 | #define OMAPFB_CAPS_WINDOW_PIXEL_DOUBLE 0x00010000 | ||
| 71 | #define OMAPFB_CAPS_WINDOW_SCALE 0x00020000 | ||
| 72 | #define OMAPFB_CAPS_WINDOW_OVERLAY 0x00040000 | ||
| 73 | #define OMAPFB_CAPS_WINDOW_ROTATE 0x00080000 | ||
| 74 | #define OMAPFB_CAPS_SET_BACKLIGHT 0x01000000 | ||
| 75 | |||
| 76 | /* Values from DSP must map to lower 16-bits */ | ||
| 77 | #define OMAPFB_FORMAT_MASK 0x00ff | ||
| 78 | #define OMAPFB_FORMAT_FLAG_DOUBLE 0x0100 | ||
| 79 | #define OMAPFB_FORMAT_FLAG_TEARSYNC 0x0200 | ||
| 80 | #define OMAPFB_FORMAT_FLAG_FORCE_VSYNC 0x0400 | ||
| 81 | #define OMAPFB_FORMAT_FLAG_ENABLE_OVERLAY 0x0800 | ||
| 82 | #define OMAPFB_FORMAT_FLAG_DISABLE_OVERLAY 0x1000 | ||
| 83 | |||
| 84 | #define OMAPFB_MEMTYPE_SDRAM 0 | ||
| 85 | #define OMAPFB_MEMTYPE_SRAM 1 | ||
| 86 | #define OMAPFB_MEMTYPE_MAX 1 | ||
| 87 | |||
| 88 | enum omapfb_color_format { | ||
| 89 | OMAPFB_COLOR_RGB565 = 0, | ||
| 90 | OMAPFB_COLOR_YUV422, | ||
| 91 | OMAPFB_COLOR_YUV420, | ||
| 92 | OMAPFB_COLOR_CLUT_8BPP, | ||
| 93 | OMAPFB_COLOR_CLUT_4BPP, | ||
| 94 | OMAPFB_COLOR_CLUT_2BPP, | ||
| 95 | OMAPFB_COLOR_CLUT_1BPP, | ||
| 96 | OMAPFB_COLOR_RGB444, | ||
| 97 | OMAPFB_COLOR_YUY422, | ||
| 98 | |||
| 99 | OMAPFB_COLOR_ARGB16, | ||
| 100 | OMAPFB_COLOR_RGB24U, /* RGB24, 32-bit container */ | ||
| 101 | OMAPFB_COLOR_RGB24P, /* RGB24, 24-bit container */ | ||
| 102 | OMAPFB_COLOR_ARGB32, | ||
| 103 | OMAPFB_COLOR_RGBA32, | ||
| 104 | OMAPFB_COLOR_RGBX32, | ||
| 105 | }; | ||
| 106 | |||
| 107 | struct omapfb_update_window { | ||
| 108 | __u32 x, y; | ||
| 109 | __u32 width, height; | ||
| 110 | __u32 format; | ||
| 111 | __u32 out_x, out_y; | ||
| 112 | __u32 out_width, out_height; | ||
| 113 | __u32 reserved[8]; | ||
| 114 | }; | ||
| 115 | |||
| 116 | struct omapfb_update_window_old { | ||
| 117 | __u32 x, y; | ||
| 118 | __u32 width, height; | ||
| 119 | __u32 format; | ||
| 120 | }; | ||
| 121 | |||
| 122 | enum omapfb_plane { | ||
| 123 | OMAPFB_PLANE_GFX = 0, | ||
| 124 | OMAPFB_PLANE_VID1, | ||
| 125 | OMAPFB_PLANE_VID2, | ||
| 126 | }; | ||
| 127 | |||
| 128 | enum omapfb_channel_out { | ||
| 129 | OMAPFB_CHANNEL_OUT_LCD = 0, | ||
| 130 | OMAPFB_CHANNEL_OUT_DIGIT, | ||
| 131 | }; | ||
| 132 | |||
| 133 | struct omapfb_plane_info { | ||
| 134 | __u32 pos_x; | ||
| 135 | __u32 pos_y; | ||
| 136 | __u8 enabled; | ||
| 137 | __u8 channel_out; | ||
| 138 | __u8 mirror; | ||
| 139 | __u8 reserved1; | ||
| 140 | __u32 out_width; | ||
| 141 | __u32 out_height; | ||
| 142 | __u32 reserved2[12]; | ||
| 143 | }; | ||
| 144 | |||
| 145 | struct omapfb_mem_info { | ||
| 146 | __u32 size; | ||
| 147 | __u8 type; | ||
| 148 | __u8 reserved[3]; | ||
| 149 | }; | ||
| 150 | |||
| 151 | struct omapfb_caps { | ||
| 152 | __u32 ctrl; | ||
| 153 | __u32 plane_color; | ||
| 154 | __u32 wnd_color; | ||
| 155 | }; | ||
| 156 | |||
| 157 | enum omapfb_color_key_type { | ||
| 158 | OMAPFB_COLOR_KEY_DISABLED = 0, | ||
| 159 | OMAPFB_COLOR_KEY_GFX_DST, | ||
| 160 | OMAPFB_COLOR_KEY_VID_SRC, | ||
| 161 | }; | ||
| 162 | |||
| 163 | struct omapfb_color_key { | ||
| 164 | __u8 channel_out; | ||
| 165 | __u32 background; | ||
| 166 | __u32 trans_key; | ||
| 167 | __u8 key_type; | ||
| 168 | }; | ||
| 169 | |||
| 170 | enum omapfb_update_mode { | ||
| 171 | OMAPFB_UPDATE_DISABLED = 0, | ||
| 172 | OMAPFB_AUTO_UPDATE, | ||
| 173 | OMAPFB_MANUAL_UPDATE | ||
| 174 | }; | ||
| 175 | |||
| 176 | struct omapfb_memory_read { | ||
| 177 | __u16 x; | ||
| 178 | __u16 y; | ||
| 179 | __u16 w; | ||
| 180 | __u16 h; | ||
| 181 | size_t buffer_size; | ||
| 182 | void __user *buffer; | ||
| 183 | }; | ||
| 184 | |||
| 185 | struct omapfb_ovl_colormode { | ||
| 186 | __u8 overlay_idx; | ||
| 187 | __u8 mode_idx; | ||
| 188 | __u32 bits_per_pixel; | ||
| 189 | __u32 nonstd; | ||
| 190 | struct fb_bitfield red; | ||
| 191 | struct fb_bitfield green; | ||
| 192 | struct fb_bitfield blue; | ||
| 193 | struct fb_bitfield transp; | ||
| 194 | }; | ||
| 195 | |||
| 196 | struct omapfb_vram_info { | ||
| 197 | __u32 total; | ||
| 198 | __u32 free; | ||
| 199 | __u32 largest_free_block; | ||
| 200 | __u32 reserved[5]; | ||
| 201 | }; | ||
| 202 | |||
| 203 | struct omapfb_tearsync_info { | ||
| 204 | __u8 enabled; | ||
| 205 | __u8 reserved1[3]; | ||
| 206 | __u16 line; | ||
| 207 | __u16 reserved2; | ||
| 208 | }; | ||
| 209 | |||
| 210 | struct omapfb_display_info { | ||
| 211 | __u16 xres; | ||
| 212 | __u16 yres; | ||
| 213 | __u32 width; /* phys width of the display in micrometers */ | ||
| 214 | __u32 height; /* phys height of the display in micrometers */ | ||
| 215 | __u32 reserved[5]; | ||
| 216 | }; | ||
| 217 | |||
| 218 | #ifdef __KERNEL__ | ||
| 219 | |||
| 220 | #include <plat/board.h> | ||
| 221 | |||
| 222 | #ifdef CONFIG_ARCH_OMAP1 | ||
| 223 | #define OMAPFB_PLANE_NUM 1 | ||
| 224 | #else | ||
| 225 | #define OMAPFB_PLANE_NUM 3 | ||
| 226 | #endif | ||
| 227 | |||
| 228 | struct omapfb_mem_region { | ||
| 229 | u32 paddr; | ||
| 230 | void __iomem *vaddr; | ||
| 231 | unsigned long size; | ||
| 232 | u8 type; /* OMAPFB_PLANE_MEM_* */ | ||
| 233 | enum omapfb_color_format format;/* OMAPFB_COLOR_* */ | ||
| 234 | unsigned format_used:1; /* Must be set when format is set. | ||
| 235 | * Needed b/c of the badly chosen 0 | ||
| 236 | * base for OMAPFB_COLOR_* values | ||
| 237 | */ | ||
| 238 | unsigned alloc:1; /* allocated by the driver */ | ||
| 239 | unsigned map:1; /* kernel mapped by the driver */ | ||
| 240 | }; | ||
| 241 | |||
| 242 | struct omapfb_mem_desc { | ||
| 243 | int region_cnt; | ||
| 244 | struct omapfb_mem_region region[OMAPFB_PLANE_NUM]; | ||
| 245 | }; | ||
| 246 | |||
| 247 | struct omapfb_platform_data { | ||
| 248 | struct omap_lcd_config lcd; | ||
| 249 | struct omapfb_mem_desc mem_desc; | ||
| 250 | void *ctrl_platform_data; | ||
| 251 | }; | ||
| 252 | |||
| 253 | /* in arch/arm/plat-omap/fb.c */ | ||
| 254 | extern void omapfb_set_platform_data(struct omapfb_platform_data *data); | ||
| 255 | extern void omapfb_set_ctrl_platform_data(void *pdata); | ||
| 256 | extern void omapfb_reserve_sdram(void); | ||
| 257 | |||
| 258 | #endif | ||
| 259 | |||
| 260 | #endif /* __OMAPFB_H */ | ||
diff --git a/include/linux/oom.h b/include/linux/oom.h index 6aac5fe4f6f1..537662315627 100644 --- a/include/linux/oom.h +++ b/include/linux/oom.h | |||
| @@ -10,6 +10,7 @@ | |||
| 10 | #ifdef __KERNEL__ | 10 | #ifdef __KERNEL__ |
| 11 | 11 | ||
| 12 | #include <linux/types.h> | 12 | #include <linux/types.h> |
| 13 | #include <linux/nodemask.h> | ||
| 13 | 14 | ||
| 14 | struct zonelist; | 15 | struct zonelist; |
| 15 | struct notifier_block; | 16 | struct notifier_block; |
| @@ -26,7 +27,8 @@ enum oom_constraint { | |||
| 26 | extern int try_set_zone_oom(struct zonelist *zonelist, gfp_t gfp_flags); | 27 | extern int try_set_zone_oom(struct zonelist *zonelist, gfp_t gfp_flags); |
| 27 | extern void clear_zonelist_oom(struct zonelist *zonelist, gfp_t gfp_flags); | 28 | extern void clear_zonelist_oom(struct zonelist *zonelist, gfp_t gfp_flags); |
| 28 | 29 | ||
| 29 | extern void out_of_memory(struct zonelist *zonelist, gfp_t gfp_mask, int order); | 30 | extern void out_of_memory(struct zonelist *zonelist, gfp_t gfp_mask, |
| 31 | int order, nodemask_t *mask); | ||
| 30 | extern int register_oom_notifier(struct notifier_block *nb); | 32 | extern int register_oom_notifier(struct notifier_block *nb); |
| 31 | extern int unregister_oom_notifier(struct notifier_block *nb); | 33 | extern int unregister_oom_notifier(struct notifier_block *nb); |
| 32 | 34 | ||
diff --git a/include/linux/padata.h b/include/linux/padata.h new file mode 100644 index 000000000000..51611da9c498 --- /dev/null +++ b/include/linux/padata.h | |||
| @@ -0,0 +1,88 @@ | |||
| 1 | /* | ||
| 2 | * padata.h - header for the padata parallelization interface | ||
| 3 | * | ||
| 4 | * Copyright (C) 2008, 2009 secunet Security Networks AG | ||
| 5 | * Copyright (C) 2008, 2009 Steffen Klassert <steffen.klassert@secunet.com> | ||
| 6 | * | ||
| 7 | * This program is free software; you can redistribute it and/or modify it | ||
| 8 | * under the terms and conditions of the GNU General Public License, | ||
| 9 | * version 2, as published by the Free Software Foundation. | ||
| 10 | * | ||
| 11 | * This program is distributed in the hope it will be useful, but WITHOUT | ||
| 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
| 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
| 14 | * more details. | ||
| 15 | * | ||
| 16 | * You should have received a copy of the GNU General Public License along with | ||
| 17 | * this program; if not, write to the Free Software Foundation, Inc., | ||
| 18 | * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. | ||
| 19 | */ | ||
| 20 | |||
| 21 | #ifndef PADATA_H | ||
| 22 | #define PADATA_H | ||
| 23 | |||
| 24 | #include <linux/workqueue.h> | ||
| 25 | #include <linux/spinlock.h> | ||
| 26 | #include <linux/list.h> | ||
| 27 | |||
| 28 | struct padata_priv { | ||
| 29 | struct list_head list; | ||
| 30 | struct parallel_data *pd; | ||
| 31 | int cb_cpu; | ||
| 32 | int seq_nr; | ||
| 33 | int info; | ||
| 34 | void (*parallel)(struct padata_priv *padata); | ||
| 35 | void (*serial)(struct padata_priv *padata); | ||
| 36 | }; | ||
| 37 | |||
| 38 | struct padata_list { | ||
| 39 | struct list_head list; | ||
| 40 | spinlock_t lock; | ||
| 41 | }; | ||
| 42 | |||
| 43 | struct padata_queue { | ||
| 44 | struct padata_list parallel; | ||
| 45 | struct padata_list reorder; | ||
| 46 | struct padata_list serial; | ||
| 47 | struct work_struct pwork; | ||
| 48 | struct work_struct swork; | ||
| 49 | struct parallel_data *pd; | ||
| 50 | atomic_t num_obj; | ||
| 51 | int cpu_index; | ||
| 52 | }; | ||
| 53 | |||
| 54 | struct parallel_data { | ||
| 55 | struct padata_instance *pinst; | ||
| 56 | struct padata_queue *queue; | ||
| 57 | atomic_t seq_nr; | ||
| 58 | atomic_t reorder_objects; | ||
| 59 | atomic_t refcnt; | ||
| 60 | unsigned int max_seq_nr; | ||
| 61 | cpumask_var_t cpumask; | ||
| 62 | spinlock_t lock; | ||
| 63 | }; | ||
| 64 | |||
| 65 | struct padata_instance { | ||
| 66 | struct notifier_block cpu_notifier; | ||
| 67 | struct workqueue_struct *wq; | ||
| 68 | struct parallel_data *pd; | ||
| 69 | cpumask_var_t cpumask; | ||
| 70 | struct mutex lock; | ||
| 71 | u8 flags; | ||
| 72 | #define PADATA_INIT 1 | ||
| 73 | #define PADATA_RESET 2 | ||
| 74 | }; | ||
| 75 | |||
| 76 | extern struct padata_instance *padata_alloc(const struct cpumask *cpumask, | ||
| 77 | struct workqueue_struct *wq); | ||
| 78 | extern void padata_free(struct padata_instance *pinst); | ||
| 79 | extern int padata_do_parallel(struct padata_instance *pinst, | ||
| 80 | struct padata_priv *padata, int cb_cpu); | ||
| 81 | extern void padata_do_serial(struct padata_priv *padata); | ||
| 82 | extern int padata_set_cpumask(struct padata_instance *pinst, | ||
| 83 | cpumask_var_t cpumask); | ||
| 84 | extern int padata_add_cpu(struct padata_instance *pinst, int cpu); | ||
| 85 | extern int padata_remove_cpu(struct padata_instance *pinst, int cpu); | ||
| 86 | extern void padata_start(struct padata_instance *pinst); | ||
| 87 | extern void padata_stop(struct padata_instance *pinst); | ||
| 88 | #endif | ||
diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h index 6b202b173955..5b59f35dcb8f 100644 --- a/include/linux/page-flags.h +++ b/include/linux/page-flags.h | |||
| @@ -8,7 +8,7 @@ | |||
| 8 | #include <linux/types.h> | 8 | #include <linux/types.h> |
| 9 | #ifndef __GENERATING_BOUNDS_H | 9 | #ifndef __GENERATING_BOUNDS_H |
| 10 | #include <linux/mm_types.h> | 10 | #include <linux/mm_types.h> |
| 11 | #include <linux/bounds.h> | 11 | #include <generated/bounds.h> |
| 12 | #endif /* !__GENERATING_BOUNDS_H */ | 12 | #endif /* !__GENERATING_BOUNDS_H */ |
| 13 | 13 | ||
| 14 | /* | 14 | /* |
| @@ -99,7 +99,7 @@ enum pageflags { | |||
| 99 | PG_buddy, /* Page is free, on buddy lists */ | 99 | PG_buddy, /* Page is free, on buddy lists */ |
| 100 | PG_swapbacked, /* Page is backed by RAM/swap */ | 100 | PG_swapbacked, /* Page is backed by RAM/swap */ |
| 101 | PG_unevictable, /* Page is "unevictable" */ | 101 | PG_unevictable, /* Page is "unevictable" */ |
| 102 | #ifdef CONFIG_HAVE_MLOCKED_PAGE_BIT | 102 | #ifdef CONFIG_MMU |
| 103 | PG_mlocked, /* Page is vma mlocked */ | 103 | PG_mlocked, /* Page is vma mlocked */ |
| 104 | #endif | 104 | #endif |
| 105 | #ifdef CONFIG_ARCH_USES_PG_UNCACHED | 105 | #ifdef CONFIG_ARCH_USES_PG_UNCACHED |
| @@ -259,12 +259,10 @@ PAGEFLAG_FALSE(SwapCache) | |||
| 259 | PAGEFLAG(Unevictable, unevictable) __CLEARPAGEFLAG(Unevictable, unevictable) | 259 | PAGEFLAG(Unevictable, unevictable) __CLEARPAGEFLAG(Unevictable, unevictable) |
| 260 | TESTCLEARFLAG(Unevictable, unevictable) | 260 | TESTCLEARFLAG(Unevictable, unevictable) |
| 261 | 261 | ||
| 262 | #ifdef CONFIG_HAVE_MLOCKED_PAGE_BIT | 262 | #ifdef CONFIG_MMU |
| 263 | #define MLOCK_PAGES 1 | ||
| 264 | PAGEFLAG(Mlocked, mlocked) __CLEARPAGEFLAG(Mlocked, mlocked) | 263 | PAGEFLAG(Mlocked, mlocked) __CLEARPAGEFLAG(Mlocked, mlocked) |
| 265 | TESTSCFLAG(Mlocked, mlocked) __TESTCLEARFLAG(Mlocked, mlocked) | 264 | TESTSCFLAG(Mlocked, mlocked) __TESTCLEARFLAG(Mlocked, mlocked) |
| 266 | #else | 265 | #else |
| 267 | #define MLOCK_PAGES 0 | ||
| 268 | PAGEFLAG_FALSE(Mlocked) SETPAGEFLAG_NOOP(Mlocked) | 266 | PAGEFLAG_FALSE(Mlocked) SETPAGEFLAG_NOOP(Mlocked) |
| 269 | TESTCLEARFLAG_FALSE(Mlocked) __TESTCLEARFLAG_FALSE(Mlocked) | 267 | TESTCLEARFLAG_FALSE(Mlocked) __TESTCLEARFLAG_FALSE(Mlocked) |
| 270 | #endif | 268 | #endif |
| @@ -277,13 +275,15 @@ PAGEFLAG_FALSE(Uncached) | |||
| 277 | 275 | ||
| 278 | #ifdef CONFIG_MEMORY_FAILURE | 276 | #ifdef CONFIG_MEMORY_FAILURE |
| 279 | PAGEFLAG(HWPoison, hwpoison) | 277 | PAGEFLAG(HWPoison, hwpoison) |
| 280 | TESTSETFLAG(HWPoison, hwpoison) | 278 | TESTSCFLAG(HWPoison, hwpoison) |
| 281 | #define __PG_HWPOISON (1UL << PG_hwpoison) | 279 | #define __PG_HWPOISON (1UL << PG_hwpoison) |
| 282 | #else | 280 | #else |
| 283 | PAGEFLAG_FALSE(HWPoison) | 281 | PAGEFLAG_FALSE(HWPoison) |
| 284 | #define __PG_HWPOISON 0 | 282 | #define __PG_HWPOISON 0 |
| 285 | #endif | 283 | #endif |
| 286 | 284 | ||
| 285 | u64 stable_page_flags(struct page *page); | ||
| 286 | |||
| 287 | static inline int PageUptodate(struct page *page) | 287 | static inline int PageUptodate(struct page *page) |
| 288 | { | 288 | { |
| 289 | int ret = test_bit(PG_uptodate, &(page)->flags); | 289 | int ret = test_bit(PG_uptodate, &(page)->flags); |
| @@ -393,7 +393,7 @@ static inline void __ClearPageTail(struct page *page) | |||
| 393 | 393 | ||
| 394 | #endif /* !PAGEFLAGS_EXTENDED */ | 394 | #endif /* !PAGEFLAGS_EXTENDED */ |
| 395 | 395 | ||
| 396 | #ifdef CONFIG_HAVE_MLOCKED_PAGE_BIT | 396 | #ifdef CONFIG_MMU |
| 397 | #define __PG_MLOCKED (1 << PG_mlocked) | 397 | #define __PG_MLOCKED (1 << PG_mlocked) |
| 398 | #else | 398 | #else |
| 399 | #define __PG_MLOCKED 0 | 399 | #define __PG_MLOCKED 0 |
diff --git a/include/linux/page_cgroup.h b/include/linux/page_cgroup.h index 4b938d4f3ac2..aef22ae2af47 100644 --- a/include/linux/page_cgroup.h +++ b/include/linux/page_cgroup.h | |||
| @@ -39,6 +39,7 @@ enum { | |||
| 39 | PCG_CACHE, /* charged as cache */ | 39 | PCG_CACHE, /* charged as cache */ |
| 40 | PCG_USED, /* this object is in use. */ | 40 | PCG_USED, /* this object is in use. */ |
| 41 | PCG_ACCT_LRU, /* page has been accounted for */ | 41 | PCG_ACCT_LRU, /* page has been accounted for */ |
| 42 | PCG_FILE_MAPPED, /* page is accounted as "mapped" */ | ||
| 42 | }; | 43 | }; |
| 43 | 44 | ||
| 44 | #define TESTPCGFLAG(uname, lname) \ | 45 | #define TESTPCGFLAG(uname, lname) \ |
| @@ -57,6 +58,8 @@ static inline void ClearPageCgroup##uname(struct page_cgroup *pc) \ | |||
| 57 | static inline int TestClearPageCgroup##uname(struct page_cgroup *pc) \ | 58 | static inline int TestClearPageCgroup##uname(struct page_cgroup *pc) \ |
| 58 | { return test_and_clear_bit(PCG_##lname, &pc->flags); } | 59 | { return test_and_clear_bit(PCG_##lname, &pc->flags); } |
| 59 | 60 | ||
| 61 | TESTPCGFLAG(Locked, LOCK) | ||
| 62 | |||
| 60 | /* Cache flag is set only once (at allocation) */ | 63 | /* Cache flag is set only once (at allocation) */ |
| 61 | TESTPCGFLAG(Cache, CACHE) | 64 | TESTPCGFLAG(Cache, CACHE) |
| 62 | CLEARPCGFLAG(Cache, CACHE) | 65 | CLEARPCGFLAG(Cache, CACHE) |
| @@ -71,6 +74,11 @@ CLEARPCGFLAG(AcctLRU, ACCT_LRU) | |||
| 71 | TESTPCGFLAG(AcctLRU, ACCT_LRU) | 74 | TESTPCGFLAG(AcctLRU, ACCT_LRU) |
| 72 | TESTCLEARPCGFLAG(AcctLRU, ACCT_LRU) | 75 | TESTCLEARPCGFLAG(AcctLRU, ACCT_LRU) |
| 73 | 76 | ||
| 77 | |||
| 78 | SETPCGFLAG(FileMapped, FILE_MAPPED) | ||
| 79 | CLEARPCGFLAG(FileMapped, FILE_MAPPED) | ||
| 80 | TESTPCGFLAG(FileMapped, FILE_MAPPED) | ||
| 81 | |||
| 74 | static inline int page_cgroup_nid(struct page_cgroup *pc) | 82 | static inline int page_cgroup_nid(struct page_cgroup *pc) |
| 75 | { | 83 | { |
| 76 | return page_to_nid(pc->page); | 84 | return page_to_nid(pc->page); |
| @@ -86,11 +94,6 @@ static inline void lock_page_cgroup(struct page_cgroup *pc) | |||
| 86 | bit_spin_lock(PCG_LOCK, &pc->flags); | 94 | bit_spin_lock(PCG_LOCK, &pc->flags); |
| 87 | } | 95 | } |
| 88 | 96 | ||
| 89 | static inline int trylock_page_cgroup(struct page_cgroup *pc) | ||
| 90 | { | ||
| 91 | return bit_spin_trylock(PCG_LOCK, &pc->flags); | ||
| 92 | } | ||
| 93 | |||
| 94 | static inline void unlock_page_cgroup(struct page_cgroup *pc) | 97 | static inline void unlock_page_cgroup(struct page_cgroup *pc) |
| 95 | { | 98 | { |
| 96 | bit_spin_unlock(PCG_LOCK, &pc->flags); | 99 | bit_spin_unlock(PCG_LOCK, &pc->flags); |
| @@ -121,6 +124,8 @@ static inline void __init page_cgroup_init_flatmem(void) | |||
| 121 | #include <linux/swap.h> | 124 | #include <linux/swap.h> |
| 122 | 125 | ||
| 123 | #ifdef CONFIG_CGROUP_MEM_RES_CTLR_SWAP | 126 | #ifdef CONFIG_CGROUP_MEM_RES_CTLR_SWAP |
| 127 | extern unsigned short swap_cgroup_cmpxchg(swp_entry_t ent, | ||
| 128 | unsigned short old, unsigned short new); | ||
| 124 | extern unsigned short swap_cgroup_record(swp_entry_t ent, unsigned short id); | 129 | extern unsigned short swap_cgroup_record(swp_entry_t ent, unsigned short id); |
| 125 | extern unsigned short lookup_swap_cgroup(swp_entry_t ent); | 130 | extern unsigned short lookup_swap_cgroup(swp_entry_t ent); |
| 126 | extern int swap_cgroup_swapon(int type, unsigned long max_pages); | 131 | extern int swap_cgroup_swapon(int type, unsigned long max_pages); |
diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h index ed5d7501e181..3c62ed408492 100644 --- a/include/linux/pagemap.h +++ b/include/linux/pagemap.h | |||
| @@ -253,6 +253,8 @@ extern struct page * read_cache_page_async(struct address_space *mapping, | |||
| 253 | extern struct page * read_cache_page(struct address_space *mapping, | 253 | extern struct page * read_cache_page(struct address_space *mapping, |
| 254 | pgoff_t index, filler_t *filler, | 254 | pgoff_t index, filler_t *filler, |
| 255 | void *data); | 255 | void *data); |
| 256 | extern struct page * read_cache_page_gfp(struct address_space *mapping, | ||
| 257 | pgoff_t index, gfp_t gfp_mask); | ||
| 256 | extern int read_cache_pages(struct address_space *mapping, | 258 | extern int read_cache_pages(struct address_space *mapping, |
| 257 | struct list_head *pages, filler_t *filler, void *data); | 259 | struct list_head *pages, filler_t *filler, void *data); |
| 258 | 260 | ||
diff --git a/include/linux/pci-acpi.h b/include/linux/pci-acpi.h index 93a7c08f869d..c8b6473c5f42 100644 --- a/include/linux/pci-acpi.h +++ b/include/linux/pci-acpi.h | |||
| @@ -11,6 +11,13 @@ | |||
| 11 | #include <linux/acpi.h> | 11 | #include <linux/acpi.h> |
| 12 | 12 | ||
| 13 | #ifdef CONFIG_ACPI | 13 | #ifdef CONFIG_ACPI |
| 14 | extern acpi_status pci_acpi_add_bus_pm_notifier(struct acpi_device *dev, | ||
| 15 | struct pci_bus *pci_bus); | ||
| 16 | extern acpi_status pci_acpi_remove_bus_pm_notifier(struct acpi_device *dev); | ||
| 17 | extern acpi_status pci_acpi_add_pm_notifier(struct acpi_device *dev, | ||
| 18 | struct pci_dev *pci_dev); | ||
| 19 | extern acpi_status pci_acpi_remove_pm_notifier(struct acpi_device *dev); | ||
| 20 | |||
| 14 | static inline acpi_handle acpi_find_root_bridge_handle(struct pci_dev *pdev) | 21 | static inline acpi_handle acpi_find_root_bridge_handle(struct pci_dev *pdev) |
| 15 | { | 22 | { |
| 16 | struct pci_bus *pbus = pdev->bus; | 23 | struct pci_bus *pbus = pdev->bus; |
diff --git a/include/linux/pci-dma.h b/include/linux/pci-dma.h new file mode 100644 index 000000000000..549a041f9c08 --- /dev/null +++ b/include/linux/pci-dma.h | |||
| @@ -0,0 +1,11 @@ | |||
| 1 | #ifndef _LINUX_PCI_DMA_H | ||
| 2 | #define _LINUX_PCI_DMA_H | ||
| 3 | |||
| 4 | #define DECLARE_PCI_UNMAP_ADDR(ADDR_NAME) DEFINE_DMA_UNMAP_ADDR(ADDR_NAME); | ||
| 5 | #define DECLARE_PCI_UNMAP_LEN(LEN_NAME) DEFINE_DMA_UNMAP_LEN(LEN_NAME); | ||
| 6 | #define pci_unmap_addr dma_unmap_addr | ||
| 7 | #define pci_unmap_addr_set dma_unmap_addr_set | ||
| 8 | #define pci_unmap_len dma_unmap_len | ||
| 9 | #define pci_unmap_len_set dma_unmap_len_set | ||
| 10 | |||
| 11 | #endif | ||
diff --git a/include/linux/pci.h b/include/linux/pci.h index f5c7cd343e56..a788fa12ff31 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h | |||
| @@ -187,6 +187,33 @@ enum pci_bus_flags { | |||
| 187 | PCI_BUS_FLAGS_NO_MMRBC = (__force pci_bus_flags_t) 2, | 187 | PCI_BUS_FLAGS_NO_MMRBC = (__force pci_bus_flags_t) 2, |
| 188 | }; | 188 | }; |
| 189 | 189 | ||
| 190 | /* Based on the PCI Hotplug Spec, but some values are made up by us */ | ||
| 191 | enum pci_bus_speed { | ||
| 192 | PCI_SPEED_33MHz = 0x00, | ||
| 193 | PCI_SPEED_66MHz = 0x01, | ||
| 194 | PCI_SPEED_66MHz_PCIX = 0x02, | ||
| 195 | PCI_SPEED_100MHz_PCIX = 0x03, | ||
| 196 | PCI_SPEED_133MHz_PCIX = 0x04, | ||
| 197 | PCI_SPEED_66MHz_PCIX_ECC = 0x05, | ||
| 198 | PCI_SPEED_100MHz_PCIX_ECC = 0x06, | ||
| 199 | PCI_SPEED_133MHz_PCIX_ECC = 0x07, | ||
| 200 | PCI_SPEED_66MHz_PCIX_266 = 0x09, | ||
| 201 | PCI_SPEED_100MHz_PCIX_266 = 0x0a, | ||
| 202 | PCI_SPEED_133MHz_PCIX_266 = 0x0b, | ||
| 203 | AGP_UNKNOWN = 0x0c, | ||
| 204 | AGP_1X = 0x0d, | ||
| 205 | AGP_2X = 0x0e, | ||
| 206 | AGP_4X = 0x0f, | ||
| 207 | AGP_8X = 0x10, | ||
| 208 | PCI_SPEED_66MHz_PCIX_533 = 0x11, | ||
| 209 | PCI_SPEED_100MHz_PCIX_533 = 0x12, | ||
| 210 | PCI_SPEED_133MHz_PCIX_533 = 0x13, | ||
| 211 | PCIE_SPEED_2_5GT = 0x14, | ||
| 212 | PCIE_SPEED_5_0GT = 0x15, | ||
| 213 | PCIE_SPEED_8_0GT = 0x16, | ||
| 214 | PCI_SPEED_UNKNOWN = 0xff, | ||
| 215 | }; | ||
| 216 | |||
| 190 | struct pci_cap_saved_state { | 217 | struct pci_cap_saved_state { |
| 191 | struct hlist_node next; | 218 | struct hlist_node next; |
| 192 | char cap_nr; | 219 | char cap_nr; |
| @@ -218,6 +245,7 @@ struct pci_dev { | |||
| 218 | unsigned int class; /* 3 bytes: (base,sub,prog-if) */ | 245 | unsigned int class; /* 3 bytes: (base,sub,prog-if) */ |
| 219 | u8 revision; /* PCI revision, low byte of class word */ | 246 | u8 revision; /* PCI revision, low byte of class word */ |
| 220 | u8 hdr_type; /* PCI header type (`multi' flag masked out) */ | 247 | u8 hdr_type; /* PCI header type (`multi' flag masked out) */ |
| 248 | u8 pcie_cap; /* PCI-E capability offset */ | ||
| 221 | u8 pcie_type; /* PCI-E device/port type */ | 249 | u8 pcie_type; /* PCI-E device/port type */ |
| 222 | u8 rom_base_reg; /* which config register controls the ROM */ | 250 | u8 rom_base_reg; /* which config register controls the ROM */ |
| 223 | u8 pin; /* which interrupt pin this device uses */ | 251 | u8 pin; /* which interrupt pin this device uses */ |
| @@ -238,10 +266,12 @@ struct pci_dev { | |||
| 238 | configuration space */ | 266 | configuration space */ |
| 239 | unsigned int pme_support:5; /* Bitmask of states from which PME# | 267 | unsigned int pme_support:5; /* Bitmask of states from which PME# |
| 240 | can be generated */ | 268 | can be generated */ |
| 269 | unsigned int pme_interrupt:1; | ||
| 241 | unsigned int d1_support:1; /* Low power state D1 is supported */ | 270 | unsigned int d1_support:1; /* Low power state D1 is supported */ |
| 242 | unsigned int d2_support:1; /* Low power state D2 is supported */ | 271 | unsigned int d2_support:1; /* Low power state D2 is supported */ |
| 243 | unsigned int no_d1d2:1; /* Only allow D0 and D3 */ | 272 | unsigned int no_d1d2:1; /* Only allow D0 and D3 */ |
| 244 | unsigned int wakeup_prepared:1; | 273 | unsigned int wakeup_prepared:1; |
| 274 | unsigned int d3_delay; /* D3->D0 transition time in ms */ | ||
| 245 | 275 | ||
| 246 | #ifdef CONFIG_PCIEASPM | 276 | #ifdef CONFIG_PCIEASPM |
| 247 | struct pcie_link_state *link_state; /* ASPM link state. */ | 277 | struct pcie_link_state *link_state; /* ASPM link state. */ |
| @@ -273,13 +303,15 @@ struct pci_dev { | |||
| 273 | unsigned int msix_enabled:1; | 303 | unsigned int msix_enabled:1; |
| 274 | unsigned int ari_enabled:1; /* ARI forwarding */ | 304 | unsigned int ari_enabled:1; /* ARI forwarding */ |
| 275 | unsigned int is_managed:1; | 305 | unsigned int is_managed:1; |
| 276 | unsigned int is_pcie:1; | 306 | unsigned int is_pcie:1; /* Obsolete. Will be removed. |
| 307 | Use pci_is_pcie() instead */ | ||
| 277 | unsigned int needs_freset:1; /* Dev requires fundamental reset */ | 308 | unsigned int needs_freset:1; /* Dev requires fundamental reset */ |
| 278 | unsigned int state_saved:1; | 309 | unsigned int state_saved:1; |
| 279 | unsigned int is_physfn:1; | 310 | unsigned int is_physfn:1; |
| 280 | unsigned int is_virtfn:1; | 311 | unsigned int is_virtfn:1; |
| 281 | unsigned int reset_fn:1; | 312 | unsigned int reset_fn:1; |
| 282 | unsigned int is_hotplug_bridge:1; | 313 | unsigned int is_hotplug_bridge:1; |
| 314 | unsigned int aer_firmware_first:1; | ||
| 283 | pci_dev_flags_t dev_flags; | 315 | pci_dev_flags_t dev_flags; |
| 284 | atomic_t enable_cnt; /* pci_enable_device has been called */ | 316 | atomic_t enable_cnt; /* pci_enable_device has been called */ |
| 285 | 317 | ||
| @@ -332,9 +364,26 @@ static inline void pci_add_saved_cap(struct pci_dev *pci_dev, | |||
| 332 | hlist_add_head(&new_cap->next, &pci_dev->saved_cap_space); | 364 | hlist_add_head(&new_cap->next, &pci_dev->saved_cap_space); |
| 333 | } | 365 | } |
| 334 | 366 | ||
| 335 | #ifndef PCI_BUS_NUM_RESOURCES | 367 | /* |
| 336 | #define PCI_BUS_NUM_RESOURCES 16 | 368 | * The first PCI_BRIDGE_RESOURCE_NUM PCI bus resources (those that correspond |
| 337 | #endif | 369 | * to P2P or CardBus bridge windows) go in a table. Additional ones (for |
| 370 | * buses below host bridges or subtractive decode bridges) go in the list. | ||
| 371 | * Use pci_bus_for_each_resource() to iterate through all the resources. | ||
| 372 | */ | ||
| 373 | |||
| 374 | /* | ||
| 375 | * PCI_SUBTRACTIVE_DECODE means the bridge forwards the window implicitly | ||
| 376 | * and there's no way to program the bridge with the details of the window. | ||
| 377 | * This does not apply to ACPI _CRS windows, even with the _DEC subtractive- | ||
| 378 | * decode bit set, because they are explicit and can be programmed with _SRS. | ||
| 379 | */ | ||
| 380 | #define PCI_SUBTRACTIVE_DECODE 0x1 | ||
| 381 | |||
| 382 | struct pci_bus_resource { | ||
| 383 | struct list_head list; | ||
| 384 | struct resource *res; | ||
| 385 | unsigned int flags; | ||
| 386 | }; | ||
| 338 | 387 | ||
| 339 | #define PCI_REGION_FLAG_MASK 0x0fU /* These bits of resource flags tell us the PCI region flags */ | 388 | #define PCI_REGION_FLAG_MASK 0x0fU /* These bits of resource flags tell us the PCI region flags */ |
| 340 | 389 | ||
| @@ -345,8 +394,8 @@ struct pci_bus { | |||
| 345 | struct list_head devices; /* list of devices on this bus */ | 394 | struct list_head devices; /* list of devices on this bus */ |
| 346 | struct pci_dev *self; /* bridge device as seen by parent */ | 395 | struct pci_dev *self; /* bridge device as seen by parent */ |
| 347 | struct list_head slots; /* list of slots on this bus */ | 396 | struct list_head slots; /* list of slots on this bus */ |
| 348 | struct resource *resource[PCI_BUS_NUM_RESOURCES]; | 397 | struct resource *resource[PCI_BRIDGE_RESOURCE_NUM]; |
| 349 | /* address space routed to this bus */ | 398 | struct list_head resources; /* address space routed to this bus */ |
| 350 | 399 | ||
| 351 | struct pci_ops *ops; /* configuration access functions */ | 400 | struct pci_ops *ops; /* configuration access functions */ |
| 352 | void *sysdata; /* hook for sys-specific extension */ | 401 | void *sysdata; /* hook for sys-specific extension */ |
| @@ -356,6 +405,8 @@ struct pci_bus { | |||
| 356 | unsigned char primary; /* number of primary bridge */ | 405 | unsigned char primary; /* number of primary bridge */ |
| 357 | unsigned char secondary; /* number of secondary bridge */ | 406 | unsigned char secondary; /* number of secondary bridge */ |
| 358 | unsigned char subordinate; /* max number of subordinate buses */ | 407 | unsigned char subordinate; /* max number of subordinate buses */ |
| 408 | unsigned char max_bus_speed; /* enum pci_bus_speed */ | ||
| 409 | unsigned char cur_bus_speed; /* enum pci_bus_speed */ | ||
| 359 | 410 | ||
| 360 | char name[48]; | 411 | char name[48]; |
| 361 | 412 | ||
| @@ -560,10 +611,14 @@ int __must_check pcibios_enable_device(struct pci_dev *, int mask); | |||
| 560 | char *pcibios_setup(char *str); | 611 | char *pcibios_setup(char *str); |
| 561 | 612 | ||
| 562 | /* Used only when drivers/pci/setup.c is used */ | 613 | /* Used only when drivers/pci/setup.c is used */ |
| 563 | void pcibios_align_resource(void *, struct resource *, resource_size_t, | 614 | resource_size_t pcibios_align_resource(void *, const struct resource *, |
| 615 | resource_size_t, | ||
| 564 | resource_size_t); | 616 | resource_size_t); |
| 565 | void pcibios_update_irq(struct pci_dev *, int irq); | 617 | void pcibios_update_irq(struct pci_dev *, int irq); |
| 566 | 618 | ||
| 619 | /* Weak but can be overriden by arch */ | ||
| 620 | void pci_fixup_cardbus(struct pci_bus *); | ||
| 621 | |||
| 567 | /* Generic PCI functions used internally */ | 622 | /* Generic PCI functions used internally */ |
| 568 | 623 | ||
| 569 | extern struct pci_bus *pci_find_bus(int domain, int busnr); | 624 | extern struct pci_bus *pci_find_bus(int domain, int busnr); |
| @@ -583,6 +638,7 @@ struct pci_bus *pci_create_bus(struct device *parent, int bus, | |||
| 583 | struct pci_ops *ops, void *sysdata); | 638 | struct pci_ops *ops, void *sysdata); |
| 584 | struct pci_bus *pci_add_new_bus(struct pci_bus *parent, struct pci_dev *dev, | 639 | struct pci_bus *pci_add_new_bus(struct pci_bus *parent, struct pci_dev *dev, |
| 585 | int busnr); | 640 | int busnr); |
| 641 | void pcie_update_link_speed(struct pci_bus *bus, u16 link_status); | ||
| 586 | struct pci_slot *pci_create_slot(struct pci_bus *parent, int slot_nr, | 642 | struct pci_slot *pci_create_slot(struct pci_bus *parent, int slot_nr, |
| 587 | const char *name, | 643 | const char *name, |
| 588 | struct hotplug_slot *hotplug); | 644 | struct hotplug_slot *hotplug); |
| @@ -606,15 +662,12 @@ extern void pci_remove_bus_device(struct pci_dev *dev); | |||
| 606 | extern void pci_stop_bus_device(struct pci_dev *dev); | 662 | extern void pci_stop_bus_device(struct pci_dev *dev); |
| 607 | void pci_setup_cardbus(struct pci_bus *bus); | 663 | void pci_setup_cardbus(struct pci_bus *bus); |
| 608 | extern void pci_sort_breadthfirst(void); | 664 | extern void pci_sort_breadthfirst(void); |
| 665 | #define dev_is_pci(d) ((d)->bus == &pci_bus_type) | ||
| 666 | #define dev_is_pf(d) ((dev_is_pci(d) ? to_pci_dev(d)->is_physfn : false)) | ||
| 667 | #define dev_num_vf(d) ((dev_is_pci(d) ? pci_num_vf(to_pci_dev(d)) : 0)) | ||
| 609 | 668 | ||
| 610 | /* Generic PCI functions exported to card drivers */ | 669 | /* Generic PCI functions exported to card drivers */ |
| 611 | 670 | ||
| 612 | #ifdef CONFIG_PCI_LEGACY | ||
| 613 | struct pci_dev __deprecated *pci_find_device(unsigned int vendor, | ||
| 614 | unsigned int device, | ||
| 615 | struct pci_dev *from); | ||
| 616 | #endif /* CONFIG_PCI_LEGACY */ | ||
| 617 | |||
| 618 | enum pci_lost_interrupt_reason { | 671 | enum pci_lost_interrupt_reason { |
| 619 | PCI_LOST_IRQ_NO_INFORMATION = 0, | 672 | PCI_LOST_IRQ_NO_INFORMATION = 0, |
| 620 | PCI_LOST_IRQ_DISABLE_MSI, | 673 | PCI_LOST_IRQ_DISABLE_MSI, |
| @@ -625,6 +678,8 @@ enum pci_lost_interrupt_reason pci_lost_interrupt(struct pci_dev *dev); | |||
| 625 | int pci_find_capability(struct pci_dev *dev, int cap); | 678 | int pci_find_capability(struct pci_dev *dev, int cap); |
| 626 | int pci_find_next_capability(struct pci_dev *dev, u8 pos, int cap); | 679 | int pci_find_next_capability(struct pci_dev *dev, u8 pos, int cap); |
| 627 | int pci_find_ext_capability(struct pci_dev *dev, int cap); | 680 | int pci_find_ext_capability(struct pci_dev *dev, int cap); |
| 681 | int pci_bus_find_ext_capability(struct pci_bus *bus, unsigned int devfn, | ||
| 682 | int cap); | ||
| 628 | int pci_find_ht_capability(struct pci_dev *dev, int ht_cap); | 683 | int pci_find_ht_capability(struct pci_dev *dev, int ht_cap); |
| 629 | int pci_find_next_ht_capability(struct pci_dev *dev, int pos, int ht_cap); | 684 | int pci_find_next_ht_capability(struct pci_dev *dev, int pos, int ht_cap); |
| 630 | struct pci_bus *pci_find_next_bus(const struct pci_bus *from); | 685 | struct pci_bus *pci_find_next_bus(const struct pci_bus *from); |
| @@ -635,7 +690,13 @@ struct pci_dev *pci_get_subsys(unsigned int vendor, unsigned int device, | |||
| 635 | unsigned int ss_vendor, unsigned int ss_device, | 690 | unsigned int ss_vendor, unsigned int ss_device, |
| 636 | struct pci_dev *from); | 691 | struct pci_dev *from); |
| 637 | struct pci_dev *pci_get_slot(struct pci_bus *bus, unsigned int devfn); | 692 | struct pci_dev *pci_get_slot(struct pci_bus *bus, unsigned int devfn); |
| 638 | struct pci_dev *pci_get_bus_and_slot(unsigned int bus, unsigned int devfn); | 693 | struct pci_dev *pci_get_domain_bus_and_slot(int domain, unsigned int bus, |
| 694 | unsigned int devfn); | ||
| 695 | static inline struct pci_dev *pci_get_bus_and_slot(unsigned int bus, | ||
| 696 | unsigned int devfn) | ||
| 697 | { | ||
| 698 | return pci_get_domain_bus_and_slot(0, bus, devfn); | ||
| 699 | } | ||
| 639 | struct pci_dev *pci_get_class(unsigned int class, struct pci_dev *from); | 700 | struct pci_dev *pci_get_class(unsigned int class, struct pci_dev *from); |
| 640 | int pci_dev_present(const struct pci_device_id *ids); | 701 | int pci_dev_present(const struct pci_device_id *ids); |
| 641 | 702 | ||
| @@ -701,14 +762,13 @@ void pci_disable_device(struct pci_dev *dev); | |||
| 701 | void pci_set_master(struct pci_dev *dev); | 762 | void pci_set_master(struct pci_dev *dev); |
| 702 | void pci_clear_master(struct pci_dev *dev); | 763 | void pci_clear_master(struct pci_dev *dev); |
| 703 | int pci_set_pcie_reset_state(struct pci_dev *dev, enum pcie_reset_state state); | 764 | int pci_set_pcie_reset_state(struct pci_dev *dev, enum pcie_reset_state state); |
| 765 | int pci_set_cacheline_size(struct pci_dev *dev); | ||
| 704 | #define HAVE_PCI_SET_MWI | 766 | #define HAVE_PCI_SET_MWI |
| 705 | int __must_check pci_set_mwi(struct pci_dev *dev); | 767 | int __must_check pci_set_mwi(struct pci_dev *dev); |
| 706 | int pci_try_set_mwi(struct pci_dev *dev); | 768 | int pci_try_set_mwi(struct pci_dev *dev); |
| 707 | void pci_clear_mwi(struct pci_dev *dev); | 769 | void pci_clear_mwi(struct pci_dev *dev); |
| 708 | void pci_intx(struct pci_dev *dev, int enable); | 770 | void pci_intx(struct pci_dev *dev, int enable); |
| 709 | void pci_msi_off(struct pci_dev *dev); | 771 | void pci_msi_off(struct pci_dev *dev); |
| 710 | int pci_set_dma_mask(struct pci_dev *dev, u64 mask); | ||
| 711 | int pci_set_consistent_dma_mask(struct pci_dev *dev, u64 mask); | ||
| 712 | int pci_set_dma_max_seg_size(struct pci_dev *dev, unsigned int size); | 772 | int pci_set_dma_max_seg_size(struct pci_dev *dev, unsigned int size); |
| 713 | int pci_set_dma_seg_boundary(struct pci_dev *dev, unsigned long mask); | 773 | int pci_set_dma_seg_boundary(struct pci_dev *dev, unsigned long mask); |
| 714 | int pcix_get_max_mmrbc(struct pci_dev *dev); | 774 | int pcix_get_max_mmrbc(struct pci_dev *dev); |
| @@ -737,11 +797,23 @@ int pci_set_power_state(struct pci_dev *dev, pci_power_t state); | |||
| 737 | pci_power_t pci_choose_state(struct pci_dev *dev, pm_message_t state); | 797 | pci_power_t pci_choose_state(struct pci_dev *dev, pm_message_t state); |
| 738 | bool pci_pme_capable(struct pci_dev *dev, pci_power_t state); | 798 | bool pci_pme_capable(struct pci_dev *dev, pci_power_t state); |
| 739 | void pci_pme_active(struct pci_dev *dev, bool enable); | 799 | void pci_pme_active(struct pci_dev *dev, bool enable); |
| 740 | int pci_enable_wake(struct pci_dev *dev, pci_power_t state, bool enable); | 800 | int __pci_enable_wake(struct pci_dev *dev, pci_power_t state, |
| 801 | bool runtime, bool enable); | ||
| 741 | int pci_wake_from_d3(struct pci_dev *dev, bool enable); | 802 | int pci_wake_from_d3(struct pci_dev *dev, bool enable); |
| 742 | pci_power_t pci_target_state(struct pci_dev *dev); | 803 | pci_power_t pci_target_state(struct pci_dev *dev); |
| 743 | int pci_prepare_to_sleep(struct pci_dev *dev); | 804 | int pci_prepare_to_sleep(struct pci_dev *dev); |
| 744 | int pci_back_from_sleep(struct pci_dev *dev); | 805 | int pci_back_from_sleep(struct pci_dev *dev); |
| 806 | bool pci_dev_run_wake(struct pci_dev *dev); | ||
| 807 | |||
| 808 | static inline int pci_enable_wake(struct pci_dev *dev, pci_power_t state, | ||
| 809 | bool enable) | ||
| 810 | { | ||
| 811 | return __pci_enable_wake(dev, state, false, enable); | ||
| 812 | } | ||
| 813 | |||
| 814 | /* For use by arch with custom probe code */ | ||
| 815 | void set_pcie_port_type(struct pci_dev *pdev); | ||
| 816 | void set_pcie_hotplug_bridge(struct pci_dev *pdev); | ||
| 745 | 817 | ||
| 746 | /* Functions for PCI Hotplug drivers to use */ | 818 | /* Functions for PCI Hotplug drivers to use */ |
| 747 | int pci_bus_find_capability(struct pci_bus *bus, unsigned int devfn, int cap); | 819 | int pci_bus_find_capability(struct pci_bus *bus, unsigned int devfn, int cap); |
| @@ -759,6 +831,7 @@ void pci_bus_assign_resources(const struct pci_bus *bus); | |||
| 759 | void pci_bus_size_bridges(struct pci_bus *bus); | 831 | void pci_bus_size_bridges(struct pci_bus *bus); |
| 760 | int pci_claim_resource(struct pci_dev *, int); | 832 | int pci_claim_resource(struct pci_dev *, int); |
| 761 | void pci_assign_unassigned_resources(void); | 833 | void pci_assign_unassigned_resources(void); |
| 834 | void pci_assign_unassigned_bridge_resources(struct pci_dev *bridge); | ||
| 762 | void pdev_enable_device(struct pci_dev *); | 835 | void pdev_enable_device(struct pci_dev *); |
| 763 | void pdev_sort_resources(struct pci_dev *, struct resource_list *); | 836 | void pdev_sort_resources(struct pci_dev *, struct resource_list *); |
| 764 | int pci_enable_resources(struct pci_dev *, int mask); | 837 | int pci_enable_resources(struct pci_dev *, int mask); |
| @@ -776,12 +849,23 @@ int pci_request_selected_regions_exclusive(struct pci_dev *, int, const char *); | |||
| 776 | void pci_release_selected_regions(struct pci_dev *, int); | 849 | void pci_release_selected_regions(struct pci_dev *, int); |
| 777 | 850 | ||
| 778 | /* drivers/pci/bus.c */ | 851 | /* drivers/pci/bus.c */ |
| 852 | void pci_bus_add_resource(struct pci_bus *bus, struct resource *res, unsigned int flags); | ||
| 853 | struct resource *pci_bus_resource_n(const struct pci_bus *bus, int n); | ||
| 854 | void pci_bus_remove_resources(struct pci_bus *bus); | ||
| 855 | |||
| 856 | #define pci_bus_for_each_resource(bus, res, i) \ | ||
| 857 | for (i = 0; \ | ||
| 858 | (res = pci_bus_resource_n(bus, i)) || i < PCI_BRIDGE_RESOURCE_NUM; \ | ||
| 859 | i++) | ||
| 860 | |||
| 779 | int __must_check pci_bus_alloc_resource(struct pci_bus *bus, | 861 | int __must_check pci_bus_alloc_resource(struct pci_bus *bus, |
| 780 | struct resource *res, resource_size_t size, | 862 | struct resource *res, resource_size_t size, |
| 781 | resource_size_t align, resource_size_t min, | 863 | resource_size_t align, resource_size_t min, |
| 782 | unsigned int type_mask, | 864 | unsigned int type_mask, |
| 783 | void (*alignf)(void *, struct resource *, | 865 | resource_size_t (*alignf)(void *, |
| 784 | resource_size_t, resource_size_t), | 866 | const struct resource *, |
| 867 | resource_size_t, | ||
| 868 | resource_size_t), | ||
| 785 | void *alignf_data); | 869 | void *alignf_data); |
| 786 | void pci_enable_bridges(struct pci_bus *bus); | 870 | void pci_enable_bridges(struct pci_bus *bus); |
| 787 | 871 | ||
| @@ -818,6 +902,7 @@ int pci_set_vga_state(struct pci_dev *pdev, bool decode, | |||
| 818 | unsigned int command_bits, bool change_bridge); | 902 | unsigned int command_bits, bool change_bridge); |
| 819 | /* kmem_cache style wrapper around pci_alloc_consistent() */ | 903 | /* kmem_cache style wrapper around pci_alloc_consistent() */ |
| 820 | 904 | ||
| 905 | #include <linux/pci-dma.h> | ||
| 821 | #include <linux/dmapool.h> | 906 | #include <linux/dmapool.h> |
| 822 | 907 | ||
| 823 | #define pci_pool dma_pool | 908 | #define pci_pool dma_pool |
| @@ -942,6 +1027,11 @@ static inline int pci_proc_domain(struct pci_bus *bus) | |||
| 942 | } | 1027 | } |
| 943 | #endif /* CONFIG_PCI_DOMAINS */ | 1028 | #endif /* CONFIG_PCI_DOMAINS */ |
| 944 | 1029 | ||
| 1030 | /* some architectures require additional setup to direct VGA traffic */ | ||
| 1031 | typedef int (*arch_set_vga_state_t)(struct pci_dev *pdev, bool decode, | ||
| 1032 | unsigned int command_bits, bool change_bridge); | ||
| 1033 | extern void pci_register_set_vga_state(arch_set_vga_state_t func); | ||
| 1034 | |||
| 945 | #else /* CONFIG_PCI is not enabled */ | 1035 | #else /* CONFIG_PCI is not enabled */ |
| 946 | 1036 | ||
| 947 | /* | 1037 | /* |
| @@ -960,13 +1050,6 @@ static inline int pci_proc_domain(struct pci_bus *bus) | |||
| 960 | _PCI_NOP_ALL(read, *) | 1050 | _PCI_NOP_ALL(read, *) |
| 961 | _PCI_NOP_ALL(write,) | 1051 | _PCI_NOP_ALL(write,) |
| 962 | 1052 | ||
| 963 | static inline struct pci_dev *pci_find_device(unsigned int vendor, | ||
| 964 | unsigned int device, | ||
| 965 | struct pci_dev *from) | ||
| 966 | { | ||
| 967 | return NULL; | ||
| 968 | } | ||
| 969 | |||
| 970 | static inline struct pci_dev *pci_get_device(unsigned int vendor, | 1053 | static inline struct pci_dev *pci_get_device(unsigned int vendor, |
| 971 | unsigned int device, | 1054 | unsigned int device, |
| 972 | struct pci_dev *from) | 1055 | struct pci_dev *from) |
| @@ -1116,6 +1199,9 @@ static inline struct pci_dev *pci_get_bus_and_slot(unsigned int bus, | |||
| 1116 | unsigned int devfn) | 1199 | unsigned int devfn) |
| 1117 | { return NULL; } | 1200 | { return NULL; } |
| 1118 | 1201 | ||
| 1202 | #define dev_is_pci(d) (false) | ||
| 1203 | #define dev_is_pf(d) (false) | ||
| 1204 | #define dev_num_vf(d) (0) | ||
| 1119 | #endif /* CONFIG_PCI */ | 1205 | #endif /* CONFIG_PCI */ |
| 1120 | 1206 | ||
| 1121 | /* Include architecture-dependent settings and functions */ | 1207 | /* Include architecture-dependent settings and functions */ |
| @@ -1224,8 +1310,12 @@ enum pci_fixup_pass { | |||
| 1224 | DECLARE_PCI_FIXUP_SECTION(.pci_fixup_suspend, \ | 1310 | DECLARE_PCI_FIXUP_SECTION(.pci_fixup_suspend, \ |
| 1225 | suspend##vendor##device##hook, vendor, device, hook) | 1311 | suspend##vendor##device##hook, vendor, device, hook) |
| 1226 | 1312 | ||
| 1227 | 1313 | #ifdef CONFIG_PCI_QUIRKS | |
| 1228 | void pci_fixup_device(enum pci_fixup_pass pass, struct pci_dev *dev); | 1314 | void pci_fixup_device(enum pci_fixup_pass pass, struct pci_dev *dev); |
| 1315 | #else | ||
| 1316 | static inline void pci_fixup_device(enum pci_fixup_pass pass, | ||
| 1317 | struct pci_dev *dev) {} | ||
| 1318 | #endif | ||
| 1229 | 1319 | ||
| 1230 | void __iomem *pcim_iomap(struct pci_dev *pdev, int bar, unsigned long maxlen); | 1320 | void __iomem *pcim_iomap(struct pci_dev *pdev, int bar, unsigned long maxlen); |
| 1231 | void pcim_iounmap(struct pci_dev *pdev, void __iomem *addr); | 1321 | void pcim_iounmap(struct pci_dev *pdev, void __iomem *addr); |
| @@ -1246,6 +1336,8 @@ extern int pci_pci_problems; | |||
| 1246 | 1336 | ||
| 1247 | extern unsigned long pci_cardbus_io_size; | 1337 | extern unsigned long pci_cardbus_io_size; |
| 1248 | extern unsigned long pci_cardbus_mem_size; | 1338 | extern unsigned long pci_cardbus_mem_size; |
| 1339 | extern u8 __devinitdata pci_dfl_cache_line_size; | ||
| 1340 | extern u8 pci_cache_line_size; | ||
| 1249 | 1341 | ||
| 1250 | extern unsigned long pci_hotplug_io_size; | 1342 | extern unsigned long pci_hotplug_io_size; |
| 1251 | extern unsigned long pci_hotplug_mem_size; | 1343 | extern unsigned long pci_hotplug_mem_size; |
| @@ -1271,6 +1363,7 @@ void __iomem *pci_ioremap_bar(struct pci_dev *pdev, int bar); | |||
| 1271 | extern int pci_enable_sriov(struct pci_dev *dev, int nr_virtfn); | 1363 | extern int pci_enable_sriov(struct pci_dev *dev, int nr_virtfn); |
| 1272 | extern void pci_disable_sriov(struct pci_dev *dev); | 1364 | extern void pci_disable_sriov(struct pci_dev *dev); |
| 1273 | extern irqreturn_t pci_sriov_migration(struct pci_dev *dev); | 1365 | extern irqreturn_t pci_sriov_migration(struct pci_dev *dev); |
| 1366 | extern int pci_num_vf(struct pci_dev *dev); | ||
| 1274 | #else | 1367 | #else |
| 1275 | static inline int pci_enable_sriov(struct pci_dev *dev, int nr_virtfn) | 1368 | static inline int pci_enable_sriov(struct pci_dev *dev, int nr_virtfn) |
| 1276 | { | 1369 | { |
| @@ -1283,6 +1376,10 @@ static inline irqreturn_t pci_sriov_migration(struct pci_dev *dev) | |||
| 1283 | { | 1376 | { |
| 1284 | return IRQ_NONE; | 1377 | return IRQ_NONE; |
| 1285 | } | 1378 | } |
| 1379 | static inline int pci_num_vf(struct pci_dev *dev) | ||
| 1380 | { | ||
| 1381 | return 0; | ||
| 1382 | } | ||
| 1286 | #endif | 1383 | #endif |
| 1287 | 1384 | ||
| 1288 | #if defined(CONFIG_HOTPLUG_PCI) || defined(CONFIG_HOTPLUG_PCI_MODULE) | 1385 | #if defined(CONFIG_HOTPLUG_PCI) || defined(CONFIG_HOTPLUG_PCI_MODULE) |
| @@ -1290,5 +1387,122 @@ extern void pci_hp_create_module_link(struct pci_slot *pci_slot); | |||
| 1290 | extern void pci_hp_remove_module_link(struct pci_slot *pci_slot); | 1387 | extern void pci_hp_remove_module_link(struct pci_slot *pci_slot); |
| 1291 | #endif | 1388 | #endif |
| 1292 | 1389 | ||
| 1390 | /** | ||
| 1391 | * pci_pcie_cap - get the saved PCIe capability offset | ||
| 1392 | * @dev: PCI device | ||
| 1393 | * | ||
| 1394 | * PCIe capability offset is calculated at PCI device initialization | ||
| 1395 | * time and saved in the data structure. This function returns saved | ||
| 1396 | * PCIe capability offset. Using this instead of pci_find_capability() | ||
| 1397 | * reduces unnecessary search in the PCI configuration space. If you | ||
| 1398 | * need to calculate PCIe capability offset from raw device for some | ||
| 1399 | * reasons, please use pci_find_capability() instead. | ||
| 1400 | */ | ||
| 1401 | static inline int pci_pcie_cap(struct pci_dev *dev) | ||
| 1402 | { | ||
| 1403 | return dev->pcie_cap; | ||
| 1404 | } | ||
| 1405 | |||
| 1406 | /** | ||
| 1407 | * pci_is_pcie - check if the PCI device is PCI Express capable | ||
| 1408 | * @dev: PCI device | ||
| 1409 | * | ||
| 1410 | * Retrun true if the PCI device is PCI Express capable, false otherwise. | ||
| 1411 | */ | ||
| 1412 | static inline bool pci_is_pcie(struct pci_dev *dev) | ||
| 1413 | { | ||
| 1414 | return !!pci_pcie_cap(dev); | ||
| 1415 | } | ||
| 1416 | |||
| 1417 | void pci_request_acs(void); | ||
| 1418 | |||
| 1419 | |||
| 1420 | #define PCI_VPD_LRDT 0x80 /* Large Resource Data Type */ | ||
| 1421 | #define PCI_VPD_LRDT_ID(x) (x | PCI_VPD_LRDT) | ||
| 1422 | |||
| 1423 | /* Large Resource Data Type Tag Item Names */ | ||
| 1424 | #define PCI_VPD_LTIN_ID_STRING 0x02 /* Identifier String */ | ||
| 1425 | #define PCI_VPD_LTIN_RO_DATA 0x10 /* Read-Only Data */ | ||
| 1426 | #define PCI_VPD_LTIN_RW_DATA 0x11 /* Read-Write Data */ | ||
| 1427 | |||
| 1428 | #define PCI_VPD_LRDT_ID_STRING PCI_VPD_LRDT_ID(PCI_VPD_LTIN_ID_STRING) | ||
| 1429 | #define PCI_VPD_LRDT_RO_DATA PCI_VPD_LRDT_ID(PCI_VPD_LTIN_RO_DATA) | ||
| 1430 | #define PCI_VPD_LRDT_RW_DATA PCI_VPD_LRDT_ID(PCI_VPD_LTIN_RW_DATA) | ||
| 1431 | |||
| 1432 | /* Small Resource Data Type Tag Item Names */ | ||
| 1433 | #define PCI_VPD_STIN_END 0x78 /* End */ | ||
| 1434 | |||
| 1435 | #define PCI_VPD_SRDT_END PCI_VPD_STIN_END | ||
| 1436 | |||
| 1437 | #define PCI_VPD_SRDT_TIN_MASK 0x78 | ||
| 1438 | #define PCI_VPD_SRDT_LEN_MASK 0x07 | ||
| 1439 | |||
| 1440 | #define PCI_VPD_LRDT_TAG_SIZE 3 | ||
| 1441 | #define PCI_VPD_SRDT_TAG_SIZE 1 | ||
| 1442 | |||
| 1443 | #define PCI_VPD_INFO_FLD_HDR_SIZE 3 | ||
| 1444 | |||
| 1445 | #define PCI_VPD_RO_KEYWORD_PARTNO "PN" | ||
| 1446 | #define PCI_VPD_RO_KEYWORD_MFR_ID "MN" | ||
| 1447 | #define PCI_VPD_RO_KEYWORD_VENDOR0 "V0" | ||
| 1448 | |||
| 1449 | /** | ||
| 1450 | * pci_vpd_lrdt_size - Extracts the Large Resource Data Type length | ||
| 1451 | * @lrdt: Pointer to the beginning of the Large Resource Data Type tag | ||
| 1452 | * | ||
| 1453 | * Returns the extracted Large Resource Data Type length. | ||
| 1454 | */ | ||
| 1455 | static inline u16 pci_vpd_lrdt_size(const u8 *lrdt) | ||
| 1456 | { | ||
| 1457 | return (u16)lrdt[1] + ((u16)lrdt[2] << 8); | ||
| 1458 | } | ||
| 1459 | |||
| 1460 | /** | ||
| 1461 | * pci_vpd_srdt_size - Extracts the Small Resource Data Type length | ||
| 1462 | * @lrdt: Pointer to the beginning of the Small Resource Data Type tag | ||
| 1463 | * | ||
| 1464 | * Returns the extracted Small Resource Data Type length. | ||
| 1465 | */ | ||
| 1466 | static inline u8 pci_vpd_srdt_size(const u8 *srdt) | ||
| 1467 | { | ||
| 1468 | return (*srdt) & PCI_VPD_SRDT_LEN_MASK; | ||
| 1469 | } | ||
| 1470 | |||
| 1471 | /** | ||
| 1472 | * pci_vpd_info_field_size - Extracts the information field length | ||
| 1473 | * @lrdt: Pointer to the beginning of an information field header | ||
| 1474 | * | ||
| 1475 | * Returns the extracted information field length. | ||
| 1476 | */ | ||
| 1477 | static inline u8 pci_vpd_info_field_size(const u8 *info_field) | ||
| 1478 | { | ||
| 1479 | return info_field[2]; | ||
| 1480 | } | ||
| 1481 | |||
| 1482 | /** | ||
| 1483 | * pci_vpd_find_tag - Locates the Resource Data Type tag provided | ||
| 1484 | * @buf: Pointer to buffered vpd data | ||
| 1485 | * @off: The offset into the buffer at which to begin the search | ||
| 1486 | * @len: The length of the vpd buffer | ||
| 1487 | * @rdt: The Resource Data Type to search for | ||
| 1488 | * | ||
| 1489 | * Returns the index where the Resource Data Type was found or | ||
| 1490 | * -ENOENT otherwise. | ||
| 1491 | */ | ||
| 1492 | int pci_vpd_find_tag(const u8 *buf, unsigned int off, unsigned int len, u8 rdt); | ||
| 1493 | |||
| 1494 | /** | ||
| 1495 | * pci_vpd_find_info_keyword - Locates an information field keyword in the VPD | ||
| 1496 | * @buf: Pointer to buffered vpd data | ||
| 1497 | * @off: The offset into the buffer at which to begin the search | ||
| 1498 | * @len: The length of the buffer area, relative to off, in which to search | ||
| 1499 | * @kw: The keyword to search for | ||
| 1500 | * | ||
| 1501 | * Returns the index where the information field keyword was found or | ||
| 1502 | * -ENOENT otherwise. | ||
| 1503 | */ | ||
| 1504 | int pci_vpd_find_info_keyword(const u8 *buf, unsigned int off, | ||
| 1505 | unsigned int len, const char *kw); | ||
| 1506 | |||
| 1293 | #endif /* __KERNEL__ */ | 1507 | #endif /* __KERNEL__ */ |
| 1294 | #endif /* LINUX_PCI_H */ | 1508 | #endif /* LINUX_PCI_H */ |
diff --git a/include/linux/pci_hotplug.h b/include/linux/pci_hotplug.h index 652ba797696d..5d09cbafa7db 100644 --- a/include/linux/pci_hotplug.h +++ b/include/linux/pci_hotplug.h | |||
| @@ -28,26 +28,6 @@ | |||
| 28 | #ifndef _PCI_HOTPLUG_H | 28 | #ifndef _PCI_HOTPLUG_H |
| 29 | #define _PCI_HOTPLUG_H | 29 | #define _PCI_HOTPLUG_H |
| 30 | 30 | ||
| 31 | |||
| 32 | /* These values come from the PCI Hotplug Spec */ | ||
| 33 | enum pci_bus_speed { | ||
| 34 | PCI_SPEED_33MHz = 0x00, | ||
| 35 | PCI_SPEED_66MHz = 0x01, | ||
| 36 | PCI_SPEED_66MHz_PCIX = 0x02, | ||
| 37 | PCI_SPEED_100MHz_PCIX = 0x03, | ||
| 38 | PCI_SPEED_133MHz_PCIX = 0x04, | ||
| 39 | PCI_SPEED_66MHz_PCIX_ECC = 0x05, | ||
| 40 | PCI_SPEED_100MHz_PCIX_ECC = 0x06, | ||
| 41 | PCI_SPEED_133MHz_PCIX_ECC = 0x07, | ||
| 42 | PCI_SPEED_66MHz_PCIX_266 = 0x09, | ||
| 43 | PCI_SPEED_100MHz_PCIX_266 = 0x0a, | ||
| 44 | PCI_SPEED_133MHz_PCIX_266 = 0x0b, | ||
| 45 | PCI_SPEED_66MHz_PCIX_533 = 0x11, | ||
| 46 | PCI_SPEED_100MHz_PCIX_533 = 0x12, | ||
| 47 | PCI_SPEED_133MHz_PCIX_533 = 0x13, | ||
| 48 | PCI_SPEED_UNKNOWN = 0xff, | ||
| 49 | }; | ||
| 50 | |||
| 51 | /* These values come from the PCI Express Spec */ | 31 | /* These values come from the PCI Express Spec */ |
| 52 | enum pcie_link_width { | 32 | enum pcie_link_width { |
| 53 | PCIE_LNK_WIDTH_RESRV = 0x00, | 33 | PCIE_LNK_WIDTH_RESRV = 0x00, |
| @@ -61,12 +41,6 @@ enum pcie_link_width { | |||
| 61 | PCIE_LNK_WIDTH_UNKNOWN = 0xFF, | 41 | PCIE_LNK_WIDTH_UNKNOWN = 0xFF, |
| 62 | }; | 42 | }; |
| 63 | 43 | ||
| 64 | enum pcie_link_speed { | ||
| 65 | PCIE_2_5GB = 0x14, | ||
| 66 | PCIE_5_0GB = 0x15, | ||
| 67 | PCIE_LNK_SPEED_UNKNOWN = 0xFF, | ||
| 68 | }; | ||
| 69 | |||
| 70 | /** | 44 | /** |
| 71 | * struct hotplug_slot_ops -the callbacks that the hotplug pci core can use | 45 | * struct hotplug_slot_ops -the callbacks that the hotplug pci core can use |
| 72 | * @owner: The module owner of this structure | 46 | * @owner: The module owner of this structure |
| @@ -89,12 +63,6 @@ enum pcie_link_speed { | |||
| 89 | * @get_adapter_status: Called to get see if an adapter is present in the slot or not. | 63 | * @get_adapter_status: Called to get see if an adapter is present in the slot or not. |
| 90 | * If this field is NULL, the value passed in the struct hotplug_slot_info | 64 | * If this field is NULL, the value passed in the struct hotplug_slot_info |
| 91 | * will be used when this value is requested by a user. | 65 | * will be used when this value is requested by a user. |
| 92 | * @get_max_bus_speed: Called to get the max bus speed for a slot. | ||
| 93 | * If this field is NULL, the value passed in the struct hotplug_slot_info | ||
| 94 | * will be used when this value is requested by a user. | ||
| 95 | * @get_cur_bus_speed: Called to get the current bus speed for a slot. | ||
| 96 | * If this field is NULL, the value passed in the struct hotplug_slot_info | ||
| 97 | * will be used when this value is requested by a user. | ||
| 98 | * | 66 | * |
| 99 | * The table of function pointers that is passed to the hotplug pci core by a | 67 | * The table of function pointers that is passed to the hotplug pci core by a |
| 100 | * hotplug pci driver. These functions are called by the hotplug pci core when | 68 | * hotplug pci driver. These functions are called by the hotplug pci core when |
| @@ -112,17 +80,14 @@ struct hotplug_slot_ops { | |||
| 112 | int (*get_attention_status) (struct hotplug_slot *slot, u8 *value); | 80 | int (*get_attention_status) (struct hotplug_slot *slot, u8 *value); |
| 113 | int (*get_latch_status) (struct hotplug_slot *slot, u8 *value); | 81 | int (*get_latch_status) (struct hotplug_slot *slot, u8 *value); |
| 114 | int (*get_adapter_status) (struct hotplug_slot *slot, u8 *value); | 82 | int (*get_adapter_status) (struct hotplug_slot *slot, u8 *value); |
| 115 | int (*get_max_bus_speed) (struct hotplug_slot *slot, enum pci_bus_speed *value); | ||
| 116 | int (*get_cur_bus_speed) (struct hotplug_slot *slot, enum pci_bus_speed *value); | ||
| 117 | }; | 83 | }; |
| 118 | 84 | ||
| 119 | /** | 85 | /** |
| 120 | * struct hotplug_slot_info - used to notify the hotplug pci core of the state of the slot | 86 | * struct hotplug_slot_info - used to notify the hotplug pci core of the state of the slot |
| 121 | * @power: if power is enabled or not (1/0) | 87 | * @power_status: if power is enabled or not (1/0) |
| 122 | * @attention_status: if the attention light is enabled or not (1/0) | 88 | * @attention_status: if the attention light is enabled or not (1/0) |
| 123 | * @latch_status: if the latch (if any) is open or closed (1/0) | 89 | * @latch_status: if the latch (if any) is open or closed (1/0) |
| 124 | * @adapter_present: if there is a pci board present in the slot or not (1/0) | 90 | * @adapter_status: if there is a pci board present in the slot or not (1/0) |
| 125 | * @address: (domain << 16 | bus << 8 | dev) | ||
| 126 | * | 91 | * |
| 127 | * Used to notify the hotplug pci core of the status of a specific slot. | 92 | * Used to notify the hotplug pci core of the status of a specific slot. |
| 128 | */ | 93 | */ |
| @@ -131,8 +96,6 @@ struct hotplug_slot_info { | |||
| 131 | u8 attention_status; | 96 | u8 attention_status; |
| 132 | u8 latch_status; | 97 | u8 latch_status; |
| 133 | u8 adapter_status; | 98 | u8 adapter_status; |
| 134 | enum pci_bus_speed max_bus_speed; | ||
| 135 | enum pci_bus_speed cur_bus_speed; | ||
| 136 | }; | 99 | }; |
| 137 | 100 | ||
| 138 | /** | 101 | /** |
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h index 84cf1f3b7838..9f688d243b86 100644 --- a/include/linux/pci_ids.h +++ b/include/linux/pci_ids.h | |||
| @@ -770,7 +770,6 @@ | |||
| 770 | #define PCI_VENDOR_ID_TI 0x104c | 770 | #define PCI_VENDOR_ID_TI 0x104c |
| 771 | #define PCI_DEVICE_ID_TI_TVP4020 0x3d07 | 771 | #define PCI_DEVICE_ID_TI_TVP4020 0x3d07 |
| 772 | #define PCI_DEVICE_ID_TI_4450 0x8011 | 772 | #define PCI_DEVICE_ID_TI_4450 0x8011 |
| 773 | #define PCI_DEVICE_ID_TI_TSB43AB22 0x8023 | ||
| 774 | #define PCI_DEVICE_ID_TI_XX21_XX11 0x8031 | 773 | #define PCI_DEVICE_ID_TI_XX21_XX11 0x8031 |
| 775 | #define PCI_DEVICE_ID_TI_XX21_XX11_FM 0x8033 | 774 | #define PCI_DEVICE_ID_TI_XX21_XX11_FM 0x8033 |
| 776 | #define PCI_DEVICE_ID_TI_XX21_XX11_SD 0x8034 | 775 | #define PCI_DEVICE_ID_TI_XX21_XX11_SD 0x8034 |
| @@ -1496,9 +1495,10 @@ | |||
| 1496 | #define PCI_DEVICE_ID_SBE_WANXL400 0x0104 | 1495 | #define PCI_DEVICE_ID_SBE_WANXL400 0x0104 |
| 1497 | 1496 | ||
| 1498 | #define PCI_VENDOR_ID_TOSHIBA 0x1179 | 1497 | #define PCI_VENDOR_ID_TOSHIBA 0x1179 |
| 1499 | #define PCI_DEVICE_ID_TOSHIBA_PICCOLO 0x0102 | 1498 | #define PCI_DEVICE_ID_TOSHIBA_PICCOLO_1 0x0101 |
| 1500 | #define PCI_DEVICE_ID_TOSHIBA_PICCOLO_1 0x0103 | 1499 | #define PCI_DEVICE_ID_TOSHIBA_PICCOLO_2 0x0102 |
| 1501 | #define PCI_DEVICE_ID_TOSHIBA_PICCOLO_2 0x0105 | 1500 | #define PCI_DEVICE_ID_TOSHIBA_PICCOLO_3 0x0103 |
| 1501 | #define PCI_DEVICE_ID_TOSHIBA_PICCOLO_5 0x0105 | ||
| 1502 | #define PCI_DEVICE_ID_TOSHIBA_TOPIC95 0x060a | 1502 | #define PCI_DEVICE_ID_TOSHIBA_TOPIC95 0x060a |
| 1503 | #define PCI_DEVICE_ID_TOSHIBA_TOPIC97 0x060f | 1503 | #define PCI_DEVICE_ID_TOSHIBA_TOPIC97 0x060f |
| 1504 | #define PCI_DEVICE_ID_TOSHIBA_TOPIC100 0x0617 | 1504 | #define PCI_DEVICE_ID_TOSHIBA_TOPIC100 0x0617 |
| @@ -1586,6 +1586,8 @@ | |||
| 1586 | #define PCI_VENDOR_ID_COMPEX 0x11f6 | 1586 | #define PCI_VENDOR_ID_COMPEX 0x11f6 |
| 1587 | #define PCI_DEVICE_ID_COMPEX_ENET100VG4 0x0112 | 1587 | #define PCI_DEVICE_ID_COMPEX_ENET100VG4 0x0112 |
| 1588 | 1588 | ||
| 1589 | #define PCI_VENDOR_ID_PMC_Sierra 0x11f8 | ||
| 1590 | |||
| 1589 | #define PCI_VENDOR_ID_RP 0x11fe | 1591 | #define PCI_VENDOR_ID_RP 0x11fe |
| 1590 | #define PCI_DEVICE_ID_RP32INTF 0x0001 | 1592 | #define PCI_DEVICE_ID_RP32INTF 0x0001 |
| 1591 | #define PCI_DEVICE_ID_RP8INTF 0x0002 | 1593 | #define PCI_DEVICE_ID_RP8INTF 0x0002 |
| @@ -1633,6 +1635,8 @@ | |||
| 1633 | #define PCI_DEVICE_ID_O2_6730 0x673a | 1635 | #define PCI_DEVICE_ID_O2_6730 0x673a |
| 1634 | #define PCI_DEVICE_ID_O2_6832 0x6832 | 1636 | #define PCI_DEVICE_ID_O2_6832 0x6832 |
| 1635 | #define PCI_DEVICE_ID_O2_6836 0x6836 | 1637 | #define PCI_DEVICE_ID_O2_6836 0x6836 |
| 1638 | #define PCI_DEVICE_ID_O2_6812 0x6872 | ||
| 1639 | #define PCI_DEVICE_ID_O2_6933 0x6933 | ||
| 1636 | 1640 | ||
| 1637 | #define PCI_VENDOR_ID_3DFX 0x121a | 1641 | #define PCI_VENDOR_ID_3DFX 0x121a |
| 1638 | #define PCI_DEVICE_ID_3DFX_VOODOO 0x0001 | 1642 | #define PCI_DEVICE_ID_3DFX_VOODOO 0x0001 |
| @@ -2290,6 +2294,20 @@ | |||
| 2290 | #define PCI_DEVICE_ID_MPC8536 0x0051 | 2294 | #define PCI_DEVICE_ID_MPC8536 0x0051 |
| 2291 | #define PCI_DEVICE_ID_P2020E 0x0070 | 2295 | #define PCI_DEVICE_ID_P2020E 0x0070 |
| 2292 | #define PCI_DEVICE_ID_P2020 0x0071 | 2296 | #define PCI_DEVICE_ID_P2020 0x0071 |
| 2297 | #define PCI_DEVICE_ID_P2010E 0x0078 | ||
| 2298 | #define PCI_DEVICE_ID_P2010 0x0079 | ||
| 2299 | #define PCI_DEVICE_ID_P1020E 0x0100 | ||
| 2300 | #define PCI_DEVICE_ID_P1020 0x0101 | ||
| 2301 | #define PCI_DEVICE_ID_P1011E 0x0108 | ||
| 2302 | #define PCI_DEVICE_ID_P1011 0x0109 | ||
| 2303 | #define PCI_DEVICE_ID_P1022E 0x0110 | ||
| 2304 | #define PCI_DEVICE_ID_P1022 0x0111 | ||
| 2305 | #define PCI_DEVICE_ID_P1013E 0x0118 | ||
| 2306 | #define PCI_DEVICE_ID_P1013 0x0119 | ||
| 2307 | #define PCI_DEVICE_ID_P4080E 0x0400 | ||
| 2308 | #define PCI_DEVICE_ID_P4080 0x0401 | ||
| 2309 | #define PCI_DEVICE_ID_P4040E 0x0408 | ||
| 2310 | #define PCI_DEVICE_ID_P4040 0x0409 | ||
| 2293 | #define PCI_DEVICE_ID_MPC8641 0x7010 | 2311 | #define PCI_DEVICE_ID_MPC8641 0x7010 |
| 2294 | #define PCI_DEVICE_ID_MPC8641D 0x7011 | 2312 | #define PCI_DEVICE_ID_MPC8641D 0x7011 |
| 2295 | #define PCI_DEVICE_ID_MPC8610 0x7018 | 2313 | #define PCI_DEVICE_ID_MPC8610 0x7018 |
| @@ -2314,6 +2332,8 @@ | |||
| 2314 | #define PCI_VENDOR_ID_KORENIX 0x1982 | 2332 | #define PCI_VENDOR_ID_KORENIX 0x1982 |
| 2315 | #define PCI_DEVICE_ID_KORENIX_JETCARDF0 0x1600 | 2333 | #define PCI_DEVICE_ID_KORENIX_JETCARDF0 0x1600 |
| 2316 | #define PCI_DEVICE_ID_KORENIX_JETCARDF1 0x16ff | 2334 | #define PCI_DEVICE_ID_KORENIX_JETCARDF1 0x16ff |
| 2335 | #define PCI_DEVICE_ID_KORENIX_JETCARDF2 0x1700 | ||
| 2336 | #define PCI_DEVICE_ID_KORENIX_JETCARDF3 0x17ff | ||
| 2317 | 2337 | ||
| 2318 | #define PCI_VENDOR_ID_QMI 0x1a32 | 2338 | #define PCI_VENDOR_ID_QMI 0x1a32 |
| 2319 | 2339 | ||
| @@ -2398,6 +2418,9 @@ | |||
| 2398 | #define PCI_DEVICE_ID_INTEL_82840_HB 0x1a21 | 2418 | #define PCI_DEVICE_ID_INTEL_82840_HB 0x1a21 |
| 2399 | #define PCI_DEVICE_ID_INTEL_82845_HB 0x1a30 | 2419 | #define PCI_DEVICE_ID_INTEL_82845_HB 0x1a30 |
| 2400 | #define PCI_DEVICE_ID_INTEL_IOAT 0x1a38 | 2420 | #define PCI_DEVICE_ID_INTEL_IOAT 0x1a38 |
| 2421 | #define PCI_DEVICE_ID_INTEL_CPT_SMBUS 0x1c22 | ||
| 2422 | #define PCI_DEVICE_ID_INTEL_CPT_LPC1 0x1c42 | ||
| 2423 | #define PCI_DEVICE_ID_INTEL_CPT_LPC2 0x1c43 | ||
| 2401 | #define PCI_DEVICE_ID_INTEL_82801AA_0 0x2410 | 2424 | #define PCI_DEVICE_ID_INTEL_82801AA_0 0x2410 |
| 2402 | #define PCI_DEVICE_ID_INTEL_82801AA_1 0x2411 | 2425 | #define PCI_DEVICE_ID_INTEL_82801AA_1 0x2411 |
| 2403 | #define PCI_DEVICE_ID_INTEL_82801AA_3 0x2413 | 2426 | #define PCI_DEVICE_ID_INTEL_82801AA_3 0x2413 |
| @@ -2675,6 +2698,7 @@ | |||
| 2675 | #define PCI_DEVICE_ID_NETMOS_9835 0x9835 | 2698 | #define PCI_DEVICE_ID_NETMOS_9835 0x9835 |
| 2676 | #define PCI_DEVICE_ID_NETMOS_9845 0x9845 | 2699 | #define PCI_DEVICE_ID_NETMOS_9845 0x9845 |
| 2677 | #define PCI_DEVICE_ID_NETMOS_9855 0x9855 | 2700 | #define PCI_DEVICE_ID_NETMOS_9855 0x9855 |
| 2701 | #define PCI_DEVICE_ID_NETMOS_9865 0x9865 | ||
| 2678 | #define PCI_DEVICE_ID_NETMOS_9901 0x9901 | 2702 | #define PCI_DEVICE_ID_NETMOS_9901 0x9901 |
| 2679 | 2703 | ||
| 2680 | #define PCI_VENDOR_ID_3COM_2 0xa727 | 2704 | #define PCI_VENDOR_ID_3COM_2 0xa727 |
diff --git a/include/linux/pci_regs.h b/include/linux/pci_regs.h index dd0bed4f1cf0..c8f302991b66 100644 --- a/include/linux/pci_regs.h +++ b/include/linux/pci_regs.h | |||
| @@ -365,6 +365,11 @@ | |||
| 365 | #define PCI_X_STATUS_266MHZ 0x40000000 /* 266 MHz capable */ | 365 | #define PCI_X_STATUS_266MHZ 0x40000000 /* 266 MHz capable */ |
| 366 | #define PCI_X_STATUS_533MHZ 0x80000000 /* 533 MHz capable */ | 366 | #define PCI_X_STATUS_533MHZ 0x80000000 /* 533 MHz capable */ |
| 367 | 367 | ||
| 368 | /* PCI Bridge Subsystem ID registers */ | ||
| 369 | |||
| 370 | #define PCI_SSVID_VENDOR_ID 4 /* PCI-Bridge subsystem vendor id register */ | ||
| 371 | #define PCI_SSVID_DEVICE_ID 6 /* PCI-Bridge subsystem device id register */ | ||
| 372 | |||
| 368 | /* PCI Express capability registers */ | 373 | /* PCI Express capability registers */ |
| 369 | 374 | ||
| 370 | #define PCI_EXP_FLAGS 2 /* Capabilities register */ | 375 | #define PCI_EXP_FLAGS 2 /* Capabilities register */ |
| @@ -502,6 +507,8 @@ | |||
| 502 | #define PCI_EXT_CAP_ID_VC 2 | 507 | #define PCI_EXT_CAP_ID_VC 2 |
| 503 | #define PCI_EXT_CAP_ID_DSN 3 | 508 | #define PCI_EXT_CAP_ID_DSN 3 |
| 504 | #define PCI_EXT_CAP_ID_PWR 4 | 509 | #define PCI_EXT_CAP_ID_PWR 4 |
| 510 | #define PCI_EXT_CAP_ID_VNDR 11 | ||
| 511 | #define PCI_EXT_CAP_ID_ACS 13 | ||
| 505 | #define PCI_EXT_CAP_ID_ARI 14 | 512 | #define PCI_EXT_CAP_ID_ARI 14 |
| 506 | #define PCI_EXT_CAP_ID_ATS 15 | 513 | #define PCI_EXT_CAP_ID_ATS 15 |
| 507 | #define PCI_EXT_CAP_ID_SRIOV 16 | 514 | #define PCI_EXT_CAP_ID_SRIOV 16 |
| @@ -662,4 +669,16 @@ | |||
| 662 | #define PCI_SRIOV_VFM_MO 0x2 /* Active.MigrateOut */ | 669 | #define PCI_SRIOV_VFM_MO 0x2 /* Active.MigrateOut */ |
| 663 | #define PCI_SRIOV_VFM_AV 0x3 /* Active.Available */ | 670 | #define PCI_SRIOV_VFM_AV 0x3 /* Active.Available */ |
| 664 | 671 | ||
| 672 | /* Access Control Service */ | ||
| 673 | #define PCI_ACS_CAP 0x04 /* ACS Capability Register */ | ||
| 674 | #define PCI_ACS_SV 0x01 /* Source Validation */ | ||
| 675 | #define PCI_ACS_TB 0x02 /* Translation Blocking */ | ||
| 676 | #define PCI_ACS_RR 0x04 /* P2P Request Redirect */ | ||
| 677 | #define PCI_ACS_CR 0x08 /* P2P Completion Redirect */ | ||
| 678 | #define PCI_ACS_UF 0x10 /* Upstream Forwarding */ | ||
| 679 | #define PCI_ACS_EC 0x20 /* P2P Egress Control */ | ||
| 680 | #define PCI_ACS_DT 0x40 /* Direct Translated P2P */ | ||
| 681 | #define PCI_ACS_CTRL 0x06 /* ACS Control Register */ | ||
| 682 | #define PCI_ACS_EGRESS_CTL_V 0x08 /* ACS Egress Control Vector */ | ||
| 683 | |||
| 665 | #endif /* LINUX_PCI_REGS_H */ | 684 | #endif /* LINUX_PCI_REGS_H */ |
diff --git a/include/linux/pcieport_if.h b/include/linux/pcieport_if.h index b4c79545330b..6775532b92a9 100644 --- a/include/linux/pcieport_if.h +++ b/include/linux/pcieport_if.h | |||
| @@ -10,10 +10,7 @@ | |||
| 10 | #define _PCIEPORT_IF_H_ | 10 | #define _PCIEPORT_IF_H_ |
| 11 | 11 | ||
| 12 | /* Port Type */ | 12 | /* Port Type */ |
| 13 | #define PCIE_RC_PORT 4 /* Root port of RC */ | 13 | #define PCIE_ANY_PORT (~0) |
| 14 | #define PCIE_SW_UPSTREAM_PORT 5 /* Upstream port of Switch */ | ||
| 15 | #define PCIE_SW_DOWNSTREAM_PORT 6 /* Downstream port of Switch */ | ||
| 16 | #define PCIE_ANY_PORT 7 | ||
| 17 | 14 | ||
| 18 | /* Service Type */ | 15 | /* Service Type */ |
| 19 | #define PCIE_PORT_SERVICE_PME_SHIFT 0 /* Power Management Event */ | 16 | #define PCIE_PORT_SERVICE_PME_SHIFT 0 /* Power Management Event */ |
| @@ -25,17 +22,6 @@ | |||
| 25 | #define PCIE_PORT_SERVICE_VC_SHIFT 3 /* Virtual Channel */ | 22 | #define PCIE_PORT_SERVICE_VC_SHIFT 3 /* Virtual Channel */ |
| 26 | #define PCIE_PORT_SERVICE_VC (1 << PCIE_PORT_SERVICE_VC_SHIFT) | 23 | #define PCIE_PORT_SERVICE_VC (1 << PCIE_PORT_SERVICE_VC_SHIFT) |
| 27 | 24 | ||
| 28 | /* Root/Upstream/Downstream Port's Interrupt Mode */ | ||
| 29 | #define PCIE_PORT_NO_IRQ (-1) | ||
| 30 | #define PCIE_PORT_INTx_MODE 0 | ||
| 31 | #define PCIE_PORT_MSI_MODE 1 | ||
| 32 | #define PCIE_PORT_MSIX_MODE 2 | ||
| 33 | |||
| 34 | struct pcie_port_data { | ||
| 35 | int port_type; /* Type of the port */ | ||
| 36 | int port_irq_mode; /* [0:INTx | 1:MSI | 2:MSI-X] */ | ||
| 37 | }; | ||
| 38 | |||
| 39 | struct pcie_device { | 25 | struct pcie_device { |
| 40 | int irq; /* Service IRQ/MSI/MSI-X Vector */ | 26 | int irq; /* Service IRQ/MSI/MSI-X Vector */ |
| 41 | struct pci_dev *port; /* Root/Upstream/Downstream Port */ | 27 | struct pci_dev *port; /* Root/Upstream/Downstream Port */ |
diff --git a/include/linux/percpu-defs.h b/include/linux/percpu-defs.h index 9bd03193ecd4..68567c0b3a5d 100644 --- a/include/linux/percpu-defs.h +++ b/include/linux/percpu-defs.h | |||
| @@ -2,12 +2,6 @@ | |||
| 2 | #define _LINUX_PERCPU_DEFS_H | 2 | #define _LINUX_PERCPU_DEFS_H |
| 3 | 3 | ||
| 4 | /* | 4 | /* |
| 5 | * Determine the real variable name from the name visible in the | ||
| 6 | * kernel sources. | ||
| 7 | */ | ||
| 8 | #define per_cpu_var(var) per_cpu__##var | ||
| 9 | |||
| 10 | /* | ||
| 11 | * Base implementations of per-CPU variable declarations and definitions, where | 5 | * Base implementations of per-CPU variable declarations and definitions, where |
| 12 | * the section in which the variable is to be placed is provided by the | 6 | * the section in which the variable is to be placed is provided by the |
| 13 | * 'sec' argument. This may be used to affect the parameters governing the | 7 | * 'sec' argument. This may be used to affect the parameters governing the |
| @@ -18,13 +12,23 @@ | |||
| 18 | * that section. | 12 | * that section. |
| 19 | */ | 13 | */ |
| 20 | #define __PCPU_ATTRS(sec) \ | 14 | #define __PCPU_ATTRS(sec) \ |
| 21 | __attribute__((section(PER_CPU_BASE_SECTION sec))) \ | 15 | __percpu __attribute__((section(PER_CPU_BASE_SECTION sec))) \ |
| 22 | PER_CPU_ATTRIBUTES | 16 | PER_CPU_ATTRIBUTES |
| 23 | 17 | ||
| 24 | #define __PCPU_DUMMY_ATTRS \ | 18 | #define __PCPU_DUMMY_ATTRS \ |
| 25 | __attribute__((section(".discard"), unused)) | 19 | __attribute__((section(".discard"), unused)) |
| 26 | 20 | ||
| 27 | /* | 21 | /* |
| 22 | * Macro which verifies @ptr is a percpu pointer without evaluating | ||
| 23 | * @ptr. This is to be used in percpu accessors to verify that the | ||
| 24 | * input parameter is a percpu pointer. | ||
| 25 | */ | ||
| 26 | #define __verify_pcpu_ptr(ptr) do { \ | ||
| 27 | const void __percpu *__vpp_verify = (typeof(ptr))NULL; \ | ||
| 28 | (void)__vpp_verify; \ | ||
| 29 | } while (0) | ||
| 30 | |||
| 31 | /* | ||
| 28 | * s390 and alpha modules require percpu variables to be defined as | 32 | * s390 and alpha modules require percpu variables to be defined as |
| 29 | * weak to force the compiler to generate GOT based external | 33 | * weak to force the compiler to generate GOT based external |
| 30 | * references for them. This is necessary because percpu sections | 34 | * references for them. This is necessary because percpu sections |
| @@ -56,23 +60,24 @@ | |||
| 56 | */ | 60 | */ |
| 57 | #define DECLARE_PER_CPU_SECTION(type, name, sec) \ | 61 | #define DECLARE_PER_CPU_SECTION(type, name, sec) \ |
| 58 | extern __PCPU_DUMMY_ATTRS char __pcpu_scope_##name; \ | 62 | extern __PCPU_DUMMY_ATTRS char __pcpu_scope_##name; \ |
| 59 | extern __PCPU_ATTRS(sec) __typeof__(type) per_cpu__##name | 63 | extern __PCPU_ATTRS(sec) __typeof__(type) name |
| 60 | 64 | ||
| 61 | #define DEFINE_PER_CPU_SECTION(type, name, sec) \ | 65 | #define DEFINE_PER_CPU_SECTION(type, name, sec) \ |
| 62 | __PCPU_DUMMY_ATTRS char __pcpu_scope_##name; \ | 66 | __PCPU_DUMMY_ATTRS char __pcpu_scope_##name; \ |
| 67 | extern __PCPU_DUMMY_ATTRS char __pcpu_unique_##name; \ | ||
| 63 | __PCPU_DUMMY_ATTRS char __pcpu_unique_##name; \ | 68 | __PCPU_DUMMY_ATTRS char __pcpu_unique_##name; \ |
| 64 | __PCPU_ATTRS(sec) PER_CPU_DEF_ATTRIBUTES __weak \ | 69 | __PCPU_ATTRS(sec) PER_CPU_DEF_ATTRIBUTES __weak \ |
| 65 | __typeof__(type) per_cpu__##name | 70 | __typeof__(type) name |
| 66 | #else | 71 | #else |
| 67 | /* | 72 | /* |
| 68 | * Normal declaration and definition macros. | 73 | * Normal declaration and definition macros. |
| 69 | */ | 74 | */ |
| 70 | #define DECLARE_PER_CPU_SECTION(type, name, sec) \ | 75 | #define DECLARE_PER_CPU_SECTION(type, name, sec) \ |
| 71 | extern __PCPU_ATTRS(sec) __typeof__(type) per_cpu__##name | 76 | extern __PCPU_ATTRS(sec) __typeof__(type) name |
| 72 | 77 | ||
| 73 | #define DEFINE_PER_CPU_SECTION(type, name, sec) \ | 78 | #define DEFINE_PER_CPU_SECTION(type, name, sec) \ |
| 74 | __PCPU_ATTRS(sec) PER_CPU_DEF_ATTRIBUTES \ | 79 | __PCPU_ATTRS(sec) PER_CPU_DEF_ATTRIBUTES \ |
| 75 | __typeof__(type) per_cpu__##name | 80 | __typeof__(type) name |
| 76 | #endif | 81 | #endif |
| 77 | 82 | ||
| 78 | /* | 83 | /* |
| @@ -134,10 +139,16 @@ | |||
| 134 | __aligned(PAGE_SIZE) | 139 | __aligned(PAGE_SIZE) |
| 135 | 140 | ||
| 136 | /* | 141 | /* |
| 137 | * Intermodule exports for per-CPU variables. | 142 | * Intermodule exports for per-CPU variables. sparse forgets about |
| 143 | * address space across EXPORT_SYMBOL(), change EXPORT_SYMBOL() to | ||
| 144 | * noop if __CHECKER__. | ||
| 138 | */ | 145 | */ |
| 139 | #define EXPORT_PER_CPU_SYMBOL(var) EXPORT_SYMBOL(per_cpu__##var) | 146 | #ifndef __CHECKER__ |
| 140 | #define EXPORT_PER_CPU_SYMBOL_GPL(var) EXPORT_SYMBOL_GPL(per_cpu__##var) | 147 | #define EXPORT_PER_CPU_SYMBOL(var) EXPORT_SYMBOL(var) |
| 141 | 148 | #define EXPORT_PER_CPU_SYMBOL_GPL(var) EXPORT_SYMBOL_GPL(var) | |
| 149 | #else | ||
| 150 | #define EXPORT_PER_CPU_SYMBOL(var) | ||
| 151 | #define EXPORT_PER_CPU_SYMBOL_GPL(var) | ||
| 152 | #endif | ||
| 142 | 153 | ||
| 143 | #endif /* _LINUX_PERCPU_DEFS_H */ | 154 | #endif /* _LINUX_PERCPU_DEFS_H */ |
diff --git a/include/linux/percpu.h b/include/linux/percpu.h index 878836ca999c..d3a38d687104 100644 --- a/include/linux/percpu.h +++ b/include/linux/percpu.h | |||
| @@ -2,10 +2,10 @@ | |||
| 2 | #define __LINUX_PERCPU_H | 2 | #define __LINUX_PERCPU_H |
| 3 | 3 | ||
| 4 | #include <linux/preempt.h> | 4 | #include <linux/preempt.h> |
| 5 | #include <linux/slab.h> /* For kmalloc() */ | ||
| 6 | #include <linux/smp.h> | 5 | #include <linux/smp.h> |
| 7 | #include <linux/cpumask.h> | 6 | #include <linux/cpumask.h> |
| 8 | #include <linux/pfn.h> | 7 | #include <linux/pfn.h> |
| 8 | #include <linux/init.h> | ||
| 9 | 9 | ||
| 10 | #include <asm/percpu.h> | 10 | #include <asm/percpu.h> |
| 11 | 11 | ||
| @@ -27,14 +27,19 @@ | |||
| 27 | * we force a syntax error here if it isn't. | 27 | * we force a syntax error here if it isn't. |
| 28 | */ | 28 | */ |
| 29 | #define get_cpu_var(var) (*({ \ | 29 | #define get_cpu_var(var) (*({ \ |
| 30 | extern int simple_identifier_##var(void); \ | ||
| 31 | preempt_disable(); \ | 30 | preempt_disable(); \ |
| 32 | &__get_cpu_var(var); })) | 31 | &__get_cpu_var(var); })) |
| 33 | #define put_cpu_var(var) preempt_enable() | ||
| 34 | 32 | ||
| 35 | #ifdef CONFIG_SMP | 33 | /* |
| 34 | * The weird & is necessary because sparse considers (void)(var) to be | ||
| 35 | * a direct dereference of percpu variable (var). | ||
| 36 | */ | ||
| 37 | #define put_cpu_var(var) do { \ | ||
| 38 | (void)&(var); \ | ||
| 39 | preempt_enable(); \ | ||
| 40 | } while (0) | ||
| 36 | 41 | ||
| 37 | #ifndef CONFIG_HAVE_LEGACY_PER_CPU_AREA | 42 | #ifdef CONFIG_SMP |
| 38 | 43 | ||
| 39 | /* minimum unit size, also is the maximum supported allocation size */ | 44 | /* minimum unit size, also is the maximum supported allocation size */ |
| 40 | #define PCPU_MIN_UNIT_SIZE PFN_ALIGN(64 << 10) | 45 | #define PCPU_MIN_UNIT_SIZE PFN_ALIGN(64 << 10) |
| @@ -129,31 +134,8 @@ extern int __init pcpu_page_first_chunk(size_t reserved_size, | |||
| 129 | */ | 134 | */ |
| 130 | #define per_cpu_ptr(ptr, cpu) SHIFT_PERCPU_PTR((ptr), per_cpu_offset((cpu))) | 135 | #define per_cpu_ptr(ptr, cpu) SHIFT_PERCPU_PTR((ptr), per_cpu_offset((cpu))) |
| 131 | 136 | ||
| 132 | extern void *__alloc_reserved_percpu(size_t size, size_t align); | 137 | extern void __percpu *__alloc_reserved_percpu(size_t size, size_t align); |
| 133 | 138 | extern bool is_kernel_percpu_address(unsigned long addr); | |
| 134 | #else /* CONFIG_HAVE_LEGACY_PER_CPU_AREA */ | ||
| 135 | |||
| 136 | struct percpu_data { | ||
| 137 | void *ptrs[1]; | ||
| 138 | }; | ||
| 139 | |||
| 140 | /* pointer disguising messes up the kmemleak objects tracking */ | ||
| 141 | #ifndef CONFIG_DEBUG_KMEMLEAK | ||
| 142 | #define __percpu_disguise(pdata) (struct percpu_data *)~(unsigned long)(pdata) | ||
| 143 | #else | ||
| 144 | #define __percpu_disguise(pdata) (struct percpu_data *)(pdata) | ||
| 145 | #endif | ||
| 146 | |||
| 147 | #define per_cpu_ptr(ptr, cpu) \ | ||
| 148 | ({ \ | ||
| 149 | struct percpu_data *__p = __percpu_disguise(ptr); \ | ||
| 150 | (__typeof__(ptr))__p->ptrs[(cpu)]; \ | ||
| 151 | }) | ||
| 152 | |||
| 153 | #endif /* CONFIG_HAVE_LEGACY_PER_CPU_AREA */ | ||
| 154 | |||
| 155 | extern void *__alloc_percpu(size_t size, size_t align); | ||
| 156 | extern void free_percpu(void *__pdata); | ||
| 157 | 139 | ||
| 158 | #ifndef CONFIG_HAVE_SETUP_PER_CPU_AREA | 140 | #ifndef CONFIG_HAVE_SETUP_PER_CPU_AREA |
| 159 | extern void __init setup_per_cpu_areas(void); | 141 | extern void __init setup_per_cpu_areas(void); |
| @@ -163,20 +145,10 @@ extern void __init setup_per_cpu_areas(void); | |||
| 163 | 145 | ||
| 164 | #define per_cpu_ptr(ptr, cpu) ({ (void)(cpu); (ptr); }) | 146 | #define per_cpu_ptr(ptr, cpu) ({ (void)(cpu); (ptr); }) |
| 165 | 147 | ||
| 166 | static inline void *__alloc_percpu(size_t size, size_t align) | 148 | /* can't distinguish from other static vars, always false */ |
| 149 | static inline bool is_kernel_percpu_address(unsigned long addr) | ||
| 167 | { | 150 | { |
| 168 | /* | 151 | return false; |
| 169 | * Can't easily make larger alignment work with kmalloc. WARN | ||
| 170 | * on it. Larger alignment should only be used for module | ||
| 171 | * percpu sections on SMP for which this path isn't used. | ||
| 172 | */ | ||
| 173 | WARN_ON_ONCE(align > SMP_CACHE_BYTES); | ||
| 174 | return kzalloc(size, GFP_KERNEL); | ||
| 175 | } | ||
| 176 | |||
| 177 | static inline void free_percpu(void *p) | ||
| 178 | { | ||
| 179 | kfree(p); | ||
| 180 | } | 152 | } |
| 181 | 153 | ||
| 182 | static inline void __init setup_per_cpu_areas(void) { } | 154 | static inline void __init setup_per_cpu_areas(void) { } |
| @@ -188,8 +160,12 @@ static inline void *pcpu_lpage_remapped(void *kaddr) | |||
| 188 | 160 | ||
| 189 | #endif /* CONFIG_SMP */ | 161 | #endif /* CONFIG_SMP */ |
| 190 | 162 | ||
| 191 | #define alloc_percpu(type) (type *)__alloc_percpu(sizeof(type), \ | 163 | extern void __percpu *__alloc_percpu(size_t size, size_t align); |
| 192 | __alignof__(type)) | 164 | extern void free_percpu(void __percpu *__pdata); |
| 165 | extern phys_addr_t per_cpu_ptr_to_phys(void *addr); | ||
| 166 | |||
| 167 | #define alloc_percpu(type) \ | ||
| 168 | (typeof(type) __percpu *)__alloc_percpu(sizeof(type), __alignof__(type)) | ||
| 193 | 169 | ||
| 194 | /* | 170 | /* |
| 195 | * Optional methods for optimized non-lvalue per-cpu variable access. | 171 | * Optional methods for optimized non-lvalue per-cpu variable access. |
| @@ -206,17 +182,19 @@ static inline void *pcpu_lpage_remapped(void *kaddr) | |||
| 206 | #ifndef percpu_read | 182 | #ifndef percpu_read |
| 207 | # define percpu_read(var) \ | 183 | # define percpu_read(var) \ |
| 208 | ({ \ | 184 | ({ \ |
| 209 | typeof(per_cpu_var(var)) __tmp_var__; \ | 185 | typeof(var) *pr_ptr__ = &(var); \ |
| 210 | __tmp_var__ = get_cpu_var(var); \ | 186 | typeof(var) pr_ret__; \ |
| 211 | put_cpu_var(var); \ | 187 | pr_ret__ = get_cpu_var(*pr_ptr__); \ |
| 212 | __tmp_var__; \ | 188 | put_cpu_var(*pr_ptr__); \ |
| 189 | pr_ret__; \ | ||
| 213 | }) | 190 | }) |
| 214 | #endif | 191 | #endif |
| 215 | 192 | ||
| 216 | #define __percpu_generic_to_op(var, val, op) \ | 193 | #define __percpu_generic_to_op(var, val, op) \ |
| 217 | do { \ | 194 | do { \ |
| 218 | get_cpu_var(var) op val; \ | 195 | typeof(var) *pgto_ptr__ = &(var); \ |
| 219 | put_cpu_var(var); \ | 196 | get_cpu_var(*pgto_ptr__) op val; \ |
| 197 | put_cpu_var(*pgto_ptr__); \ | ||
| 220 | } while (0) | 198 | } while (0) |
| 221 | 199 | ||
| 222 | #ifndef percpu_write | 200 | #ifndef percpu_write |
| @@ -243,4 +221,405 @@ do { \ | |||
| 243 | # define percpu_xor(var, val) __percpu_generic_to_op(var, (val), ^=) | 221 | # define percpu_xor(var, val) __percpu_generic_to_op(var, (val), ^=) |
| 244 | #endif | 222 | #endif |
| 245 | 223 | ||
| 224 | /* | ||
| 225 | * Branching function to split up a function into a set of functions that | ||
| 226 | * are called for different scalar sizes of the objects handled. | ||
| 227 | */ | ||
| 228 | |||
| 229 | extern void __bad_size_call_parameter(void); | ||
| 230 | |||
| 231 | #define __pcpu_size_call_return(stem, variable) \ | ||
| 232 | ({ typeof(variable) pscr_ret__; \ | ||
| 233 | __verify_pcpu_ptr(&(variable)); \ | ||
| 234 | switch(sizeof(variable)) { \ | ||
| 235 | case 1: pscr_ret__ = stem##1(variable);break; \ | ||
| 236 | case 2: pscr_ret__ = stem##2(variable);break; \ | ||
| 237 | case 4: pscr_ret__ = stem##4(variable);break; \ | ||
| 238 | case 8: pscr_ret__ = stem##8(variable);break; \ | ||
| 239 | default: \ | ||
| 240 | __bad_size_call_parameter();break; \ | ||
| 241 | } \ | ||
| 242 | pscr_ret__; \ | ||
| 243 | }) | ||
| 244 | |||
| 245 | #define __pcpu_size_call(stem, variable, ...) \ | ||
| 246 | do { \ | ||
| 247 | __verify_pcpu_ptr(&(variable)); \ | ||
| 248 | switch(sizeof(variable)) { \ | ||
| 249 | case 1: stem##1(variable, __VA_ARGS__);break; \ | ||
| 250 | case 2: stem##2(variable, __VA_ARGS__);break; \ | ||
| 251 | case 4: stem##4(variable, __VA_ARGS__);break; \ | ||
| 252 | case 8: stem##8(variable, __VA_ARGS__);break; \ | ||
| 253 | default: \ | ||
| 254 | __bad_size_call_parameter();break; \ | ||
| 255 | } \ | ||
| 256 | } while (0) | ||
| 257 | |||
| 258 | /* | ||
| 259 | * Optimized manipulation for memory allocated through the per cpu | ||
| 260 | * allocator or for addresses of per cpu variables. | ||
| 261 | * | ||
| 262 | * These operation guarantee exclusivity of access for other operations | ||
| 263 | * on the *same* processor. The assumption is that per cpu data is only | ||
| 264 | * accessed by a single processor instance (the current one). | ||
| 265 | * | ||
| 266 | * The first group is used for accesses that must be done in a | ||
| 267 | * preemption safe way since we know that the context is not preempt | ||
| 268 | * safe. Interrupts may occur. If the interrupt modifies the variable | ||
| 269 | * too then RMW actions will not be reliable. | ||
| 270 | * | ||
| 271 | * The arch code can provide optimized functions in two ways: | ||
| 272 | * | ||
| 273 | * 1. Override the function completely. F.e. define this_cpu_add(). | ||
| 274 | * The arch must then ensure that the various scalar format passed | ||
| 275 | * are handled correctly. | ||
| 276 | * | ||
| 277 | * 2. Provide functions for certain scalar sizes. F.e. provide | ||
| 278 | * this_cpu_add_2() to provide per cpu atomic operations for 2 byte | ||
| 279 | * sized RMW actions. If arch code does not provide operations for | ||
| 280 | * a scalar size then the fallback in the generic code will be | ||
| 281 | * used. | ||
| 282 | */ | ||
| 283 | |||
| 284 | #define _this_cpu_generic_read(pcp) \ | ||
| 285 | ({ typeof(pcp) ret__; \ | ||
| 286 | preempt_disable(); \ | ||
| 287 | ret__ = *this_cpu_ptr(&(pcp)); \ | ||
| 288 | preempt_enable(); \ | ||
| 289 | ret__; \ | ||
| 290 | }) | ||
| 291 | |||
| 292 | #ifndef this_cpu_read | ||
| 293 | # ifndef this_cpu_read_1 | ||
| 294 | # define this_cpu_read_1(pcp) _this_cpu_generic_read(pcp) | ||
| 295 | # endif | ||
| 296 | # ifndef this_cpu_read_2 | ||
| 297 | # define this_cpu_read_2(pcp) _this_cpu_generic_read(pcp) | ||
| 298 | # endif | ||
| 299 | # ifndef this_cpu_read_4 | ||
| 300 | # define this_cpu_read_4(pcp) _this_cpu_generic_read(pcp) | ||
| 301 | # endif | ||
| 302 | # ifndef this_cpu_read_8 | ||
| 303 | # define this_cpu_read_8(pcp) _this_cpu_generic_read(pcp) | ||
| 304 | # endif | ||
| 305 | # define this_cpu_read(pcp) __pcpu_size_call_return(this_cpu_read_, (pcp)) | ||
| 306 | #endif | ||
| 307 | |||
| 308 | #define _this_cpu_generic_to_op(pcp, val, op) \ | ||
| 309 | do { \ | ||
| 310 | preempt_disable(); \ | ||
| 311 | *__this_cpu_ptr(&(pcp)) op val; \ | ||
| 312 | preempt_enable(); \ | ||
| 313 | } while (0) | ||
| 314 | |||
| 315 | #ifndef this_cpu_write | ||
| 316 | # ifndef this_cpu_write_1 | ||
| 317 | # define this_cpu_write_1(pcp, val) _this_cpu_generic_to_op((pcp), (val), =) | ||
| 318 | # endif | ||
| 319 | # ifndef this_cpu_write_2 | ||
| 320 | # define this_cpu_write_2(pcp, val) _this_cpu_generic_to_op((pcp), (val), =) | ||
| 321 | # endif | ||
| 322 | # ifndef this_cpu_write_4 | ||
| 323 | # define this_cpu_write_4(pcp, val) _this_cpu_generic_to_op((pcp), (val), =) | ||
| 324 | # endif | ||
| 325 | # ifndef this_cpu_write_8 | ||
| 326 | # define this_cpu_write_8(pcp, val) _this_cpu_generic_to_op((pcp), (val), =) | ||
| 327 | # endif | ||
| 328 | # define this_cpu_write(pcp, val) __pcpu_size_call(this_cpu_write_, (pcp), (val)) | ||
| 329 | #endif | ||
| 330 | |||
| 331 | #ifndef this_cpu_add | ||
| 332 | # ifndef this_cpu_add_1 | ||
| 333 | # define this_cpu_add_1(pcp, val) _this_cpu_generic_to_op((pcp), (val), +=) | ||
| 334 | # endif | ||
| 335 | # ifndef this_cpu_add_2 | ||
| 336 | # define this_cpu_add_2(pcp, val) _this_cpu_generic_to_op((pcp), (val), +=) | ||
| 337 | # endif | ||
| 338 | # ifndef this_cpu_add_4 | ||
| 339 | # define this_cpu_add_4(pcp, val) _this_cpu_generic_to_op((pcp), (val), +=) | ||
| 340 | # endif | ||
| 341 | # ifndef this_cpu_add_8 | ||
| 342 | # define this_cpu_add_8(pcp, val) _this_cpu_generic_to_op((pcp), (val), +=) | ||
| 343 | # endif | ||
| 344 | # define this_cpu_add(pcp, val) __pcpu_size_call(this_cpu_add_, (pcp), (val)) | ||
| 345 | #endif | ||
| 346 | |||
| 347 | #ifndef this_cpu_sub | ||
| 348 | # define this_cpu_sub(pcp, val) this_cpu_add((pcp), -(val)) | ||
| 349 | #endif | ||
| 350 | |||
| 351 | #ifndef this_cpu_inc | ||
| 352 | # define this_cpu_inc(pcp) this_cpu_add((pcp), 1) | ||
| 353 | #endif | ||
| 354 | |||
| 355 | #ifndef this_cpu_dec | ||
| 356 | # define this_cpu_dec(pcp) this_cpu_sub((pcp), 1) | ||
| 357 | #endif | ||
| 358 | |||
| 359 | #ifndef this_cpu_and | ||
| 360 | # ifndef this_cpu_and_1 | ||
| 361 | # define this_cpu_and_1(pcp, val) _this_cpu_generic_to_op((pcp), (val), &=) | ||
| 362 | # endif | ||
| 363 | # ifndef this_cpu_and_2 | ||
| 364 | # define this_cpu_and_2(pcp, val) _this_cpu_generic_to_op((pcp), (val), &=) | ||
| 365 | # endif | ||
| 366 | # ifndef this_cpu_and_4 | ||
| 367 | # define this_cpu_and_4(pcp, val) _this_cpu_generic_to_op((pcp), (val), &=) | ||
| 368 | # endif | ||
| 369 | # ifndef this_cpu_and_8 | ||
| 370 | # define this_cpu_and_8(pcp, val) _this_cpu_generic_to_op((pcp), (val), &=) | ||
| 371 | # endif | ||
| 372 | # define this_cpu_and(pcp, val) __pcpu_size_call(this_cpu_and_, (pcp), (val)) | ||
| 373 | #endif | ||
| 374 | |||
| 375 | #ifndef this_cpu_or | ||
| 376 | # ifndef this_cpu_or_1 | ||
| 377 | # define this_cpu_or_1(pcp, val) _this_cpu_generic_to_op((pcp), (val), |=) | ||
| 378 | # endif | ||
| 379 | # ifndef this_cpu_or_2 | ||
| 380 | # define this_cpu_or_2(pcp, val) _this_cpu_generic_to_op((pcp), (val), |=) | ||
| 381 | # endif | ||
| 382 | # ifndef this_cpu_or_4 | ||
| 383 | # define this_cpu_or_4(pcp, val) _this_cpu_generic_to_op((pcp), (val), |=) | ||
| 384 | # endif | ||
| 385 | # ifndef this_cpu_or_8 | ||
| 386 | # define this_cpu_or_8(pcp, val) _this_cpu_generic_to_op((pcp), (val), |=) | ||
| 387 | # endif | ||
| 388 | # define this_cpu_or(pcp, val) __pcpu_size_call(this_cpu_or_, (pcp), (val)) | ||
| 389 | #endif | ||
| 390 | |||
| 391 | #ifndef this_cpu_xor | ||
| 392 | # ifndef this_cpu_xor_1 | ||
| 393 | # define this_cpu_xor_1(pcp, val) _this_cpu_generic_to_op((pcp), (val), ^=) | ||
| 394 | # endif | ||
| 395 | # ifndef this_cpu_xor_2 | ||
| 396 | # define this_cpu_xor_2(pcp, val) _this_cpu_generic_to_op((pcp), (val), ^=) | ||
| 397 | # endif | ||
| 398 | # ifndef this_cpu_xor_4 | ||
| 399 | # define this_cpu_xor_4(pcp, val) _this_cpu_generic_to_op((pcp), (val), ^=) | ||
| 400 | # endif | ||
| 401 | # ifndef this_cpu_xor_8 | ||
| 402 | # define this_cpu_xor_8(pcp, val) _this_cpu_generic_to_op((pcp), (val), ^=) | ||
| 403 | # endif | ||
| 404 | # define this_cpu_xor(pcp, val) __pcpu_size_call(this_cpu_or_, (pcp), (val)) | ||
| 405 | #endif | ||
| 406 | |||
| 407 | /* | ||
| 408 | * Generic percpu operations that do not require preemption handling. | ||
| 409 | * Either we do not care about races or the caller has the | ||
| 410 | * responsibility of handling preemptions issues. Arch code can still | ||
| 411 | * override these instructions since the arch per cpu code may be more | ||
| 412 | * efficient and may actually get race freeness for free (that is the | ||
| 413 | * case for x86 for example). | ||
| 414 | * | ||
| 415 | * If there is no other protection through preempt disable and/or | ||
| 416 | * disabling interupts then one of these RMW operations can show unexpected | ||
| 417 | * behavior because the execution thread was rescheduled on another processor | ||
| 418 | * or an interrupt occurred and the same percpu variable was modified from | ||
| 419 | * the interrupt context. | ||
| 420 | */ | ||
| 421 | #ifndef __this_cpu_read | ||
| 422 | # ifndef __this_cpu_read_1 | ||
| 423 | # define __this_cpu_read_1(pcp) (*__this_cpu_ptr(&(pcp))) | ||
| 424 | # endif | ||
| 425 | # ifndef __this_cpu_read_2 | ||
| 426 | # define __this_cpu_read_2(pcp) (*__this_cpu_ptr(&(pcp))) | ||
| 427 | # endif | ||
| 428 | # ifndef __this_cpu_read_4 | ||
| 429 | # define __this_cpu_read_4(pcp) (*__this_cpu_ptr(&(pcp))) | ||
| 430 | # endif | ||
| 431 | # ifndef __this_cpu_read_8 | ||
| 432 | # define __this_cpu_read_8(pcp) (*__this_cpu_ptr(&(pcp))) | ||
| 433 | # endif | ||
| 434 | # define __this_cpu_read(pcp) __pcpu_size_call_return(__this_cpu_read_, (pcp)) | ||
| 435 | #endif | ||
| 436 | |||
| 437 | #define __this_cpu_generic_to_op(pcp, val, op) \ | ||
| 438 | do { \ | ||
| 439 | *__this_cpu_ptr(&(pcp)) op val; \ | ||
| 440 | } while (0) | ||
| 441 | |||
| 442 | #ifndef __this_cpu_write | ||
| 443 | # ifndef __this_cpu_write_1 | ||
| 444 | # define __this_cpu_write_1(pcp, val) __this_cpu_generic_to_op((pcp), (val), =) | ||
| 445 | # endif | ||
| 446 | # ifndef __this_cpu_write_2 | ||
| 447 | # define __this_cpu_write_2(pcp, val) __this_cpu_generic_to_op((pcp), (val), =) | ||
| 448 | # endif | ||
| 449 | # ifndef __this_cpu_write_4 | ||
| 450 | # define __this_cpu_write_4(pcp, val) __this_cpu_generic_to_op((pcp), (val), =) | ||
| 451 | # endif | ||
| 452 | # ifndef __this_cpu_write_8 | ||
| 453 | # define __this_cpu_write_8(pcp, val) __this_cpu_generic_to_op((pcp), (val), =) | ||
| 454 | # endif | ||
| 455 | # define __this_cpu_write(pcp, val) __pcpu_size_call(__this_cpu_write_, (pcp), (val)) | ||
| 456 | #endif | ||
| 457 | |||
| 458 | #ifndef __this_cpu_add | ||
| 459 | # ifndef __this_cpu_add_1 | ||
| 460 | # define __this_cpu_add_1(pcp, val) __this_cpu_generic_to_op((pcp), (val), +=) | ||
| 461 | # endif | ||
| 462 | # ifndef __this_cpu_add_2 | ||
| 463 | # define __this_cpu_add_2(pcp, val) __this_cpu_generic_to_op((pcp), (val), +=) | ||
| 464 | # endif | ||
| 465 | # ifndef __this_cpu_add_4 | ||
| 466 | # define __this_cpu_add_4(pcp, val) __this_cpu_generic_to_op((pcp), (val), +=) | ||
| 467 | # endif | ||
| 468 | # ifndef __this_cpu_add_8 | ||
| 469 | # define __this_cpu_add_8(pcp, val) __this_cpu_generic_to_op((pcp), (val), +=) | ||
| 470 | # endif | ||
| 471 | # define __this_cpu_add(pcp, val) __pcpu_size_call(__this_cpu_add_, (pcp), (val)) | ||
| 472 | #endif | ||
| 473 | |||
| 474 | #ifndef __this_cpu_sub | ||
| 475 | # define __this_cpu_sub(pcp, val) __this_cpu_add((pcp), -(val)) | ||
| 476 | #endif | ||
| 477 | |||
| 478 | #ifndef __this_cpu_inc | ||
| 479 | # define __this_cpu_inc(pcp) __this_cpu_add((pcp), 1) | ||
| 480 | #endif | ||
| 481 | |||
| 482 | #ifndef __this_cpu_dec | ||
| 483 | # define __this_cpu_dec(pcp) __this_cpu_sub((pcp), 1) | ||
| 484 | #endif | ||
| 485 | |||
| 486 | #ifndef __this_cpu_and | ||
| 487 | # ifndef __this_cpu_and_1 | ||
| 488 | # define __this_cpu_and_1(pcp, val) __this_cpu_generic_to_op((pcp), (val), &=) | ||
| 489 | # endif | ||
| 490 | # ifndef __this_cpu_and_2 | ||
| 491 | # define __this_cpu_and_2(pcp, val) __this_cpu_generic_to_op((pcp), (val), &=) | ||
| 492 | # endif | ||
| 493 | # ifndef __this_cpu_and_4 | ||
| 494 | # define __this_cpu_and_4(pcp, val) __this_cpu_generic_to_op((pcp), (val), &=) | ||
| 495 | # endif | ||
| 496 | # ifndef __this_cpu_and_8 | ||
| 497 | # define __this_cpu_and_8(pcp, val) __this_cpu_generic_to_op((pcp), (val), &=) | ||
| 498 | # endif | ||
| 499 | # define __this_cpu_and(pcp, val) __pcpu_size_call(__this_cpu_and_, (pcp), (val)) | ||
| 500 | #endif | ||
| 501 | |||
| 502 | #ifndef __this_cpu_or | ||
| 503 | # ifndef __this_cpu_or_1 | ||
| 504 | # define __this_cpu_or_1(pcp, val) __this_cpu_generic_to_op((pcp), (val), |=) | ||
| 505 | # endif | ||
| 506 | # ifndef __this_cpu_or_2 | ||
| 507 | # define __this_cpu_or_2(pcp, val) __this_cpu_generic_to_op((pcp), (val), |=) | ||
| 508 | # endif | ||
| 509 | # ifndef __this_cpu_or_4 | ||
| 510 | # define __this_cpu_or_4(pcp, val) __this_cpu_generic_to_op((pcp), (val), |=) | ||
| 511 | # endif | ||
| 512 | # ifndef __this_cpu_or_8 | ||
| 513 | # define __this_cpu_or_8(pcp, val) __this_cpu_generic_to_op((pcp), (val), |=) | ||
| 514 | # endif | ||
| 515 | # define __this_cpu_or(pcp, val) __pcpu_size_call(__this_cpu_or_, (pcp), (val)) | ||
| 516 | #endif | ||
| 517 | |||
| 518 | #ifndef __this_cpu_xor | ||
| 519 | # ifndef __this_cpu_xor_1 | ||
| 520 | # define __this_cpu_xor_1(pcp, val) __this_cpu_generic_to_op((pcp), (val), ^=) | ||
| 521 | # endif | ||
| 522 | # ifndef __this_cpu_xor_2 | ||
| 523 | # define __this_cpu_xor_2(pcp, val) __this_cpu_generic_to_op((pcp), (val), ^=) | ||
| 524 | # endif | ||
| 525 | # ifndef __this_cpu_xor_4 | ||
| 526 | # define __this_cpu_xor_4(pcp, val) __this_cpu_generic_to_op((pcp), (val), ^=) | ||
| 527 | # endif | ||
| 528 | # ifndef __this_cpu_xor_8 | ||
| 529 | # define __this_cpu_xor_8(pcp, val) __this_cpu_generic_to_op((pcp), (val), ^=) | ||
| 530 | # endif | ||
| 531 | # define __this_cpu_xor(pcp, val) __pcpu_size_call(__this_cpu_xor_, (pcp), (val)) | ||
| 532 | #endif | ||
| 533 | |||
| 534 | /* | ||
| 535 | * IRQ safe versions of the per cpu RMW operations. Note that these operations | ||
| 536 | * are *not* safe against modification of the same variable from another | ||
| 537 | * processors (which one gets when using regular atomic operations) | ||
| 538 | . They are guaranteed to be atomic vs. local interrupts and | ||
| 539 | * preemption only. | ||
| 540 | */ | ||
| 541 | #define irqsafe_cpu_generic_to_op(pcp, val, op) \ | ||
| 542 | do { \ | ||
| 543 | unsigned long flags; \ | ||
| 544 | local_irq_save(flags); \ | ||
| 545 | *__this_cpu_ptr(&(pcp)) op val; \ | ||
| 546 | local_irq_restore(flags); \ | ||
| 547 | } while (0) | ||
| 548 | |||
| 549 | #ifndef irqsafe_cpu_add | ||
| 550 | # ifndef irqsafe_cpu_add_1 | ||
| 551 | # define irqsafe_cpu_add_1(pcp, val) irqsafe_cpu_generic_to_op((pcp), (val), +=) | ||
| 552 | # endif | ||
| 553 | # ifndef irqsafe_cpu_add_2 | ||
| 554 | # define irqsafe_cpu_add_2(pcp, val) irqsafe_cpu_generic_to_op((pcp), (val), +=) | ||
| 555 | # endif | ||
| 556 | # ifndef irqsafe_cpu_add_4 | ||
| 557 | # define irqsafe_cpu_add_4(pcp, val) irqsafe_cpu_generic_to_op((pcp), (val), +=) | ||
| 558 | # endif | ||
| 559 | # ifndef irqsafe_cpu_add_8 | ||
| 560 | # define irqsafe_cpu_add_8(pcp, val) irqsafe_cpu_generic_to_op((pcp), (val), +=) | ||
| 561 | # endif | ||
| 562 | # define irqsafe_cpu_add(pcp, val) __pcpu_size_call(irqsafe_cpu_add_, (pcp), (val)) | ||
| 563 | #endif | ||
| 564 | |||
| 565 | #ifndef irqsafe_cpu_sub | ||
| 566 | # define irqsafe_cpu_sub(pcp, val) irqsafe_cpu_add((pcp), -(val)) | ||
| 567 | #endif | ||
| 568 | |||
| 569 | #ifndef irqsafe_cpu_inc | ||
| 570 | # define irqsafe_cpu_inc(pcp) irqsafe_cpu_add((pcp), 1) | ||
| 571 | #endif | ||
| 572 | |||
| 573 | #ifndef irqsafe_cpu_dec | ||
| 574 | # define irqsafe_cpu_dec(pcp) irqsafe_cpu_sub((pcp), 1) | ||
| 575 | #endif | ||
| 576 | |||
| 577 | #ifndef irqsafe_cpu_and | ||
| 578 | # ifndef irqsafe_cpu_and_1 | ||
| 579 | # define irqsafe_cpu_and_1(pcp, val) irqsafe_cpu_generic_to_op((pcp), (val), &=) | ||
| 580 | # endif | ||
| 581 | # ifndef irqsafe_cpu_and_2 | ||
| 582 | # define irqsafe_cpu_and_2(pcp, val) irqsafe_cpu_generic_to_op((pcp), (val), &=) | ||
| 583 | # endif | ||
| 584 | # ifndef irqsafe_cpu_and_4 | ||
| 585 | # define irqsafe_cpu_and_4(pcp, val) irqsafe_cpu_generic_to_op((pcp), (val), &=) | ||
| 586 | # endif | ||
| 587 | # ifndef irqsafe_cpu_and_8 | ||
| 588 | # define irqsafe_cpu_and_8(pcp, val) irqsafe_cpu_generic_to_op((pcp), (val), &=) | ||
| 589 | # endif | ||
| 590 | # define irqsafe_cpu_and(pcp, val) __pcpu_size_call(irqsafe_cpu_and_, (val)) | ||
| 591 | #endif | ||
| 592 | |||
| 593 | #ifndef irqsafe_cpu_or | ||
| 594 | # ifndef irqsafe_cpu_or_1 | ||
| 595 | # define irqsafe_cpu_or_1(pcp, val) irqsafe_cpu_generic_to_op((pcp), (val), |=) | ||
| 596 | # endif | ||
| 597 | # ifndef irqsafe_cpu_or_2 | ||
| 598 | # define irqsafe_cpu_or_2(pcp, val) irqsafe_cpu_generic_to_op((pcp), (val), |=) | ||
| 599 | # endif | ||
| 600 | # ifndef irqsafe_cpu_or_4 | ||
| 601 | # define irqsafe_cpu_or_4(pcp, val) irqsafe_cpu_generic_to_op((pcp), (val), |=) | ||
| 602 | # endif | ||
| 603 | # ifndef irqsafe_cpu_or_8 | ||
| 604 | # define irqsafe_cpu_or_8(pcp, val) irqsafe_cpu_generic_to_op((pcp), (val), |=) | ||
| 605 | # endif | ||
| 606 | # define irqsafe_cpu_or(pcp, val) __pcpu_size_call(irqsafe_cpu_or_, (val)) | ||
| 607 | #endif | ||
| 608 | |||
| 609 | #ifndef irqsafe_cpu_xor | ||
| 610 | # ifndef irqsafe_cpu_xor_1 | ||
| 611 | # define irqsafe_cpu_xor_1(pcp, val) irqsafe_cpu_generic_to_op((pcp), (val), ^=) | ||
| 612 | # endif | ||
| 613 | # ifndef irqsafe_cpu_xor_2 | ||
| 614 | # define irqsafe_cpu_xor_2(pcp, val) irqsafe_cpu_generic_to_op((pcp), (val), ^=) | ||
| 615 | # endif | ||
| 616 | # ifndef irqsafe_cpu_xor_4 | ||
| 617 | # define irqsafe_cpu_xor_4(pcp, val) irqsafe_cpu_generic_to_op((pcp), (val), ^=) | ||
| 618 | # endif | ||
| 619 | # ifndef irqsafe_cpu_xor_8 | ||
| 620 | # define irqsafe_cpu_xor_8(pcp, val) irqsafe_cpu_generic_to_op((pcp), (val), ^=) | ||
| 621 | # endif | ||
| 622 | # define irqsafe_cpu_xor(pcp, val) __pcpu_size_call(irqsafe_cpu_xor_, (val)) | ||
| 623 | #endif | ||
| 624 | |||
| 246 | #endif /* __LINUX_PERCPU_H */ | 625 | #endif /* __LINUX_PERCPU_H */ |
diff --git a/include/linux/percpu_counter.h b/include/linux/percpu_counter.h index a7684a513994..c88d67b59394 100644 --- a/include/linux/percpu_counter.h +++ b/include/linux/percpu_counter.h | |||
| @@ -21,7 +21,7 @@ struct percpu_counter { | |||
| 21 | #ifdef CONFIG_HOTPLUG_CPU | 21 | #ifdef CONFIG_HOTPLUG_CPU |
| 22 | struct list_head list; /* All percpu_counters are on a list */ | 22 | struct list_head list; /* All percpu_counters are on a list */ |
| 23 | #endif | 23 | #endif |
| 24 | s32 *counters; | 24 | s32 __percpu *counters; |
| 25 | }; | 25 | }; |
| 26 | 26 | ||
| 27 | extern int percpu_counter_batch; | 27 | extern int percpu_counter_batch; |
| @@ -98,9 +98,6 @@ static inline void percpu_counter_set(struct percpu_counter *fbc, s64 amount) | |||
| 98 | fbc->count = amount; | 98 | fbc->count = amount; |
| 99 | } | 99 | } |
| 100 | 100 | ||
| 101 | #define __percpu_counter_add(fbc, amount, batch) \ | ||
| 102 | percpu_counter_add(fbc, amount) | ||
| 103 | |||
| 104 | static inline void | 101 | static inline void |
| 105 | percpu_counter_add(struct percpu_counter *fbc, s64 amount) | 102 | percpu_counter_add(struct percpu_counter *fbc, s64 amount) |
| 106 | { | 103 | { |
| @@ -109,6 +106,12 @@ percpu_counter_add(struct percpu_counter *fbc, s64 amount) | |||
| 109 | preempt_enable(); | 106 | preempt_enable(); |
| 110 | } | 107 | } |
| 111 | 108 | ||
| 109 | static inline void | ||
| 110 | __percpu_counter_add(struct percpu_counter *fbc, s64 amount, s32 batch) | ||
| 111 | { | ||
| 112 | percpu_counter_add(fbc, amount); | ||
| 113 | } | ||
| 114 | |||
| 112 | static inline s64 percpu_counter_read(struct percpu_counter *fbc) | 115 | static inline s64 percpu_counter_read(struct percpu_counter *fbc) |
| 113 | { | 116 | { |
| 114 | return fbc->count; | 117 | return fbc->count; |
diff --git a/include/linux/perf_counter.h b/include/linux/perf_counter.h deleted file mode 100644 index 7b7fbf433cff..000000000000 --- a/include/linux/perf_counter.h +++ /dev/null | |||
| @@ -1,441 +0,0 @@ | |||
| 1 | /* | ||
| 2 | * NOTE: this file will be removed in a future kernel release, it is | ||
| 3 | * provided as a courtesy copy of user-space code that relies on the | ||
| 4 | * old (pre-rename) symbols and constants. | ||
| 5 | * | ||
| 6 | * Performance events: | ||
| 7 | * | ||
| 8 | * Copyright (C) 2008-2009, Thomas Gleixner <tglx@linutronix.de> | ||
| 9 | * Copyright (C) 2008-2009, Red Hat, Inc., Ingo Molnar | ||
| 10 | * Copyright (C) 2008-2009, Red Hat, Inc., Peter Zijlstra | ||
| 11 | * | ||
| 12 | * Data type definitions, declarations, prototypes. | ||
| 13 | * | ||
| 14 | * Started by: Thomas Gleixner and Ingo Molnar | ||
| 15 | * | ||
| 16 | * For licencing details see kernel-base/COPYING | ||
| 17 | */ | ||
| 18 | #ifndef _LINUX_PERF_COUNTER_H | ||
| 19 | #define _LINUX_PERF_COUNTER_H | ||
| 20 | |||
| 21 | #include <linux/types.h> | ||
| 22 | #include <linux/ioctl.h> | ||
| 23 | #include <asm/byteorder.h> | ||
| 24 | |||
| 25 | /* | ||
| 26 | * User-space ABI bits: | ||
| 27 | */ | ||
| 28 | |||
| 29 | /* | ||
| 30 | * attr.type | ||
| 31 | */ | ||
| 32 | enum perf_type_id { | ||
| 33 | PERF_TYPE_HARDWARE = 0, | ||
| 34 | PERF_TYPE_SOFTWARE = 1, | ||
| 35 | PERF_TYPE_TRACEPOINT = 2, | ||
| 36 | PERF_TYPE_HW_CACHE = 3, | ||
| 37 | PERF_TYPE_RAW = 4, | ||
| 38 | |||
| 39 | PERF_TYPE_MAX, /* non-ABI */ | ||
| 40 | }; | ||
| 41 | |||
| 42 | /* | ||
| 43 | * Generalized performance counter event types, used by the | ||
| 44 | * attr.event_id parameter of the sys_perf_counter_open() | ||
| 45 | * syscall: | ||
| 46 | */ | ||
| 47 | enum perf_hw_id { | ||
| 48 | /* | ||
| 49 | * Common hardware events, generalized by the kernel: | ||
| 50 | */ | ||
| 51 | PERF_COUNT_HW_CPU_CYCLES = 0, | ||
| 52 | PERF_COUNT_HW_INSTRUCTIONS = 1, | ||
| 53 | PERF_COUNT_HW_CACHE_REFERENCES = 2, | ||
| 54 | PERF_COUNT_HW_CACHE_MISSES = 3, | ||
| 55 | PERF_COUNT_HW_BRANCH_INSTRUCTIONS = 4, | ||
| 56 | PERF_COUNT_HW_BRANCH_MISSES = 5, | ||
| 57 | PERF_COUNT_HW_BUS_CYCLES = 6, | ||
| 58 | |||
| 59 | PERF_COUNT_HW_MAX, /* non-ABI */ | ||
| 60 | }; | ||
| 61 | |||
| 62 | /* | ||
| 63 | * Generalized hardware cache counters: | ||
| 64 | * | ||
| 65 | * { L1-D, L1-I, LLC, ITLB, DTLB, BPU } x | ||
| 66 | * { read, write, prefetch } x | ||
| 67 | * { accesses, misses } | ||
| 68 | */ | ||
| 69 | enum perf_hw_cache_id { | ||
| 70 | PERF_COUNT_HW_CACHE_L1D = 0, | ||
| 71 | PERF_COUNT_HW_CACHE_L1I = 1, | ||
| 72 | PERF_COUNT_HW_CACHE_LL = 2, | ||
| 73 | PERF_COUNT_HW_CACHE_DTLB = 3, | ||
| 74 | PERF_COUNT_HW_CACHE_ITLB = 4, | ||
| 75 | PERF_COUNT_HW_CACHE_BPU = 5, | ||
| 76 | |||
| 77 | PERF_COUNT_HW_CACHE_MAX, /* non-ABI */ | ||
| 78 | }; | ||
| 79 | |||
| 80 | enum perf_hw_cache_op_id { | ||
| 81 | PERF_COUNT_HW_CACHE_OP_READ = 0, | ||
| 82 | PERF_COUNT_HW_CACHE_OP_WRITE = 1, | ||
| 83 | PERF_COUNT_HW_CACHE_OP_PREFETCH = 2, | ||
| 84 | |||
| 85 | PERF_COUNT_HW_CACHE_OP_MAX, /* non-ABI */ | ||
| 86 | }; | ||
| 87 | |||
| 88 | enum perf_hw_cache_op_result_id { | ||
| 89 | PERF_COUNT_HW_CACHE_RESULT_ACCESS = 0, | ||
| 90 | PERF_COUNT_HW_CACHE_RESULT_MISS = 1, | ||
| 91 | |||
| 92 | PERF_COUNT_HW_CACHE_RESULT_MAX, /* non-ABI */ | ||
| 93 | }; | ||
| 94 | |||
| 95 | /* | ||
| 96 | * Special "software" counters provided by the kernel, even if the hardware | ||
| 97 | * does not support performance counters. These counters measure various | ||
| 98 | * physical and sw events of the kernel (and allow the profiling of them as | ||
| 99 | * well): | ||
| 100 | */ | ||
| 101 | enum perf_sw_ids { | ||
| 102 | PERF_COUNT_SW_CPU_CLOCK = 0, | ||
| 103 | PERF_COUNT_SW_TASK_CLOCK = 1, | ||
| 104 | PERF_COUNT_SW_PAGE_FAULTS = 2, | ||
| 105 | PERF_COUNT_SW_CONTEXT_SWITCHES = 3, | ||
| 106 | PERF_COUNT_SW_CPU_MIGRATIONS = 4, | ||
| 107 | PERF_COUNT_SW_PAGE_FAULTS_MIN = 5, | ||
| 108 | PERF_COUNT_SW_PAGE_FAULTS_MAJ = 6, | ||
| 109 | |||
| 110 | PERF_COUNT_SW_MAX, /* non-ABI */ | ||
| 111 | }; | ||
| 112 | |||
| 113 | /* | ||
| 114 | * Bits that can be set in attr.sample_type to request information | ||
| 115 | * in the overflow packets. | ||
| 116 | */ | ||
| 117 | enum perf_counter_sample_format { | ||
| 118 | PERF_SAMPLE_IP = 1U << 0, | ||
| 119 | PERF_SAMPLE_TID = 1U << 1, | ||
| 120 | PERF_SAMPLE_TIME = 1U << 2, | ||
| 121 | PERF_SAMPLE_ADDR = 1U << 3, | ||
| 122 | PERF_SAMPLE_READ = 1U << 4, | ||
| 123 | PERF_SAMPLE_CALLCHAIN = 1U << 5, | ||
| 124 | PERF_SAMPLE_ID = 1U << 6, | ||
| 125 | PERF_SAMPLE_CPU = 1U << 7, | ||
| 126 | PERF_SAMPLE_PERIOD = 1U << 8, | ||
| 127 | PERF_SAMPLE_STREAM_ID = 1U << 9, | ||
| 128 | PERF_SAMPLE_RAW = 1U << 10, | ||
| 129 | |||
| 130 | PERF_SAMPLE_MAX = 1U << 11, /* non-ABI */ | ||
| 131 | }; | ||
| 132 | |||
| 133 | /* | ||
| 134 | * The format of the data returned by read() on a perf counter fd, | ||
| 135 | * as specified by attr.read_format: | ||
| 136 | * | ||
| 137 | * struct read_format { | ||
| 138 | * { u64 value; | ||
| 139 | * { u64 time_enabled; } && PERF_FORMAT_ENABLED | ||
| 140 | * { u64 time_running; } && PERF_FORMAT_RUNNING | ||
| 141 | * { u64 id; } && PERF_FORMAT_ID | ||
| 142 | * } && !PERF_FORMAT_GROUP | ||
| 143 | * | ||
| 144 | * { u64 nr; | ||
| 145 | * { u64 time_enabled; } && PERF_FORMAT_ENABLED | ||
| 146 | * { u64 time_running; } && PERF_FORMAT_RUNNING | ||
| 147 | * { u64 value; | ||
| 148 | * { u64 id; } && PERF_FORMAT_ID | ||
| 149 | * } cntr[nr]; | ||
| 150 | * } && PERF_FORMAT_GROUP | ||
| 151 | * }; | ||
| 152 | */ | ||
| 153 | enum perf_counter_read_format { | ||
| 154 | PERF_FORMAT_TOTAL_TIME_ENABLED = 1U << 0, | ||
| 155 | PERF_FORMAT_TOTAL_TIME_RUNNING = 1U << 1, | ||
| 156 | PERF_FORMAT_ID = 1U << 2, | ||
| 157 | PERF_FORMAT_GROUP = 1U << 3, | ||
| 158 | |||
| 159 | PERF_FORMAT_MAX = 1U << 4, /* non-ABI */ | ||
| 160 | }; | ||
| 161 | |||
| 162 | #define PERF_ATTR_SIZE_VER0 64 /* sizeof first published struct */ | ||
| 163 | |||
| 164 | /* | ||
| 165 | * Hardware event to monitor via a performance monitoring counter: | ||
| 166 | */ | ||
| 167 | struct perf_counter_attr { | ||
| 168 | |||
| 169 | /* | ||
| 170 | * Major type: hardware/software/tracepoint/etc. | ||
| 171 | */ | ||
| 172 | __u32 type; | ||
| 173 | |||
| 174 | /* | ||
| 175 | * Size of the attr structure, for fwd/bwd compat. | ||
| 176 | */ | ||
| 177 | __u32 size; | ||
| 178 | |||
| 179 | /* | ||
| 180 | * Type specific configuration information. | ||
| 181 | */ | ||
| 182 | __u64 config; | ||
| 183 | |||
| 184 | union { | ||
| 185 | __u64 sample_period; | ||
| 186 | __u64 sample_freq; | ||
| 187 | }; | ||
| 188 | |||
| 189 | __u64 sample_type; | ||
| 190 | __u64 read_format; | ||
| 191 | |||
| 192 | __u64 disabled : 1, /* off by default */ | ||
| 193 | inherit : 1, /* children inherit it */ | ||
| 194 | pinned : 1, /* must always be on PMU */ | ||
| 195 | exclusive : 1, /* only group on PMU */ | ||
| 196 | exclude_user : 1, /* don't count user */ | ||
| 197 | exclude_kernel : 1, /* ditto kernel */ | ||
| 198 | exclude_hv : 1, /* ditto hypervisor */ | ||
| 199 | exclude_idle : 1, /* don't count when idle */ | ||
| 200 | mmap : 1, /* include mmap data */ | ||
| 201 | comm : 1, /* include comm data */ | ||
| 202 | freq : 1, /* use freq, not period */ | ||
| 203 | inherit_stat : 1, /* per task counts */ | ||
| 204 | enable_on_exec : 1, /* next exec enables */ | ||
| 205 | task : 1, /* trace fork/exit */ | ||
| 206 | watermark : 1, /* wakeup_watermark */ | ||
| 207 | |||
| 208 | __reserved_1 : 49; | ||
| 209 | |||
| 210 | union { | ||
| 211 | __u32 wakeup_events; /* wakeup every n events */ | ||
| 212 | __u32 wakeup_watermark; /* bytes before wakeup */ | ||
| 213 | }; | ||
| 214 | __u32 __reserved_2; | ||
| 215 | |||
| 216 | __u64 __reserved_3; | ||
| 217 | }; | ||
| 218 | |||
| 219 | /* | ||
| 220 | * Ioctls that can be done on a perf counter fd: | ||
| 221 | */ | ||
| 222 | #define PERF_COUNTER_IOC_ENABLE _IO ('$', 0) | ||
| 223 | #define PERF_COUNTER_IOC_DISABLE _IO ('$', 1) | ||
| 224 | #define PERF_COUNTER_IOC_REFRESH _IO ('$', 2) | ||
| 225 | #define PERF_COUNTER_IOC_RESET _IO ('$', 3) | ||
| 226 | #define PERF_COUNTER_IOC_PERIOD _IOW('$', 4, u64) | ||
| 227 | #define PERF_COUNTER_IOC_SET_OUTPUT _IO ('$', 5) | ||
| 228 | |||
| 229 | enum perf_counter_ioc_flags { | ||
| 230 | PERF_IOC_FLAG_GROUP = 1U << 0, | ||
| 231 | }; | ||
| 232 | |||
| 233 | /* | ||
| 234 | * Structure of the page that can be mapped via mmap | ||
| 235 | */ | ||
| 236 | struct perf_counter_mmap_page { | ||
| 237 | __u32 version; /* version number of this structure */ | ||
| 238 | __u32 compat_version; /* lowest version this is compat with */ | ||
| 239 | |||
| 240 | /* | ||
| 241 | * Bits needed to read the hw counters in user-space. | ||
| 242 | * | ||
| 243 | * u32 seq; | ||
| 244 | * s64 count; | ||
| 245 | * | ||
| 246 | * do { | ||
| 247 | * seq = pc->lock; | ||
| 248 | * | ||
| 249 | * barrier() | ||
| 250 | * if (pc->index) { | ||
| 251 | * count = pmc_read(pc->index - 1); | ||
| 252 | * count += pc->offset; | ||
| 253 | * } else | ||
| 254 | * goto regular_read; | ||
| 255 | * | ||
| 256 | * barrier(); | ||
| 257 | * } while (pc->lock != seq); | ||
| 258 | * | ||
| 259 | * NOTE: for obvious reason this only works on self-monitoring | ||
| 260 | * processes. | ||
| 261 | */ | ||
| 262 | __u32 lock; /* seqlock for synchronization */ | ||
| 263 | __u32 index; /* hardware counter identifier */ | ||
| 264 | __s64 offset; /* add to hardware counter value */ | ||
| 265 | __u64 time_enabled; /* time counter active */ | ||
| 266 | __u64 time_running; /* time counter on cpu */ | ||
| 267 | |||
| 268 | /* | ||
| 269 | * Hole for extension of the self monitor capabilities | ||
| 270 | */ | ||
| 271 | |||
| 272 | __u64 __reserved[123]; /* align to 1k */ | ||
| 273 | |||
| 274 | /* | ||
| 275 | * Control data for the mmap() data buffer. | ||
| 276 | * | ||
| 277 | * User-space reading the @data_head value should issue an rmb(), on | ||
| 278 | * SMP capable platforms, after reading this value -- see | ||
| 279 | * perf_counter_wakeup(). | ||
| 280 | * | ||
| 281 | * When the mapping is PROT_WRITE the @data_tail value should be | ||
| 282 | * written by userspace to reflect the last read data. In this case | ||
| 283 | * the kernel will not over-write unread data. | ||
| 284 | */ | ||
| 285 | __u64 data_head; /* head in the data section */ | ||
| 286 | __u64 data_tail; /* user-space written tail */ | ||
| 287 | }; | ||
| 288 | |||
| 289 | #define PERF_EVENT_MISC_CPUMODE_MASK (3 << 0) | ||
| 290 | #define PERF_EVENT_MISC_CPUMODE_UNKNOWN (0 << 0) | ||
| 291 | #define PERF_EVENT_MISC_KERNEL (1 << 0) | ||
| 292 | #define PERF_EVENT_MISC_USER (2 << 0) | ||
| 293 | #define PERF_EVENT_MISC_HYPERVISOR (3 << 0) | ||
| 294 | |||
| 295 | struct perf_event_header { | ||
| 296 | __u32 type; | ||
| 297 | __u16 misc; | ||
| 298 | __u16 size; | ||
| 299 | }; | ||
| 300 | |||
| 301 | enum perf_event_type { | ||
| 302 | |||
| 303 | /* | ||
| 304 | * The MMAP events record the PROT_EXEC mappings so that we can | ||
| 305 | * correlate userspace IPs to code. They have the following structure: | ||
| 306 | * | ||
| 307 | * struct { | ||
| 308 | * struct perf_event_header header; | ||
| 309 | * | ||
| 310 | * u32 pid, tid; | ||
| 311 | * u64 addr; | ||
| 312 | * u64 len; | ||
| 313 | * u64 pgoff; | ||
| 314 | * char filename[]; | ||
| 315 | * }; | ||
| 316 | */ | ||
| 317 | PERF_EVENT_MMAP = 1, | ||
| 318 | |||
| 319 | /* | ||
| 320 | * struct { | ||
| 321 | * struct perf_event_header header; | ||
| 322 | * u64 id; | ||
| 323 | * u64 lost; | ||
| 324 | * }; | ||
| 325 | */ | ||
| 326 | PERF_EVENT_LOST = 2, | ||
| 327 | |||
| 328 | /* | ||
| 329 | * struct { | ||
| 330 | * struct perf_event_header header; | ||
| 331 | * | ||
| 332 | * u32 pid, tid; | ||
| 333 | * char comm[]; | ||
| 334 | * }; | ||
| 335 | */ | ||
| 336 | PERF_EVENT_COMM = 3, | ||
| 337 | |||
| 338 | /* | ||
| 339 | * struct { | ||
| 340 | * struct perf_event_header header; | ||
| 341 | * u32 pid, ppid; | ||
| 342 | * u32 tid, ptid; | ||
| 343 | * u64 time; | ||
| 344 | * }; | ||
| 345 | */ | ||
| 346 | PERF_EVENT_EXIT = 4, | ||
| 347 | |||
| 348 | /* | ||
| 349 | * struct { | ||
| 350 | * struct perf_event_header header; | ||
| 351 | * u64 time; | ||
| 352 | * u64 id; | ||
| 353 | * u64 stream_id; | ||
| 354 | * }; | ||
| 355 | */ | ||
| 356 | PERF_EVENT_THROTTLE = 5, | ||
| 357 | PERF_EVENT_UNTHROTTLE = 6, | ||
| 358 | |||
| 359 | /* | ||
| 360 | * struct { | ||
| 361 | * struct perf_event_header header; | ||
| 362 | * u32 pid, ppid; | ||
| 363 | * u32 tid, ptid; | ||
| 364 | * u64 time; | ||
| 365 | * }; | ||
| 366 | */ | ||
| 367 | PERF_EVENT_FORK = 7, | ||
| 368 | |||
| 369 | /* | ||
| 370 | * struct { | ||
| 371 | * struct perf_event_header header; | ||
| 372 | * u32 pid, tid; | ||
| 373 | * | ||
| 374 | * struct read_format values; | ||
| 375 | * }; | ||
| 376 | */ | ||
| 377 | PERF_EVENT_READ = 8, | ||
| 378 | |||
| 379 | /* | ||
| 380 | * struct { | ||
| 381 | * struct perf_event_header header; | ||
| 382 | * | ||
| 383 | * { u64 ip; } && PERF_SAMPLE_IP | ||
| 384 | * { u32 pid, tid; } && PERF_SAMPLE_TID | ||
| 385 | * { u64 time; } && PERF_SAMPLE_TIME | ||
| 386 | * { u64 addr; } && PERF_SAMPLE_ADDR | ||
| 387 | * { u64 id; } && PERF_SAMPLE_ID | ||
| 388 | * { u64 stream_id;} && PERF_SAMPLE_STREAM_ID | ||
| 389 | * { u32 cpu, res; } && PERF_SAMPLE_CPU | ||
| 390 | * { u64 period; } && PERF_SAMPLE_PERIOD | ||
| 391 | * | ||
| 392 | * { struct read_format values; } && PERF_SAMPLE_READ | ||
| 393 | * | ||
| 394 | * { u64 nr, | ||
| 395 | * u64 ips[nr]; } && PERF_SAMPLE_CALLCHAIN | ||
| 396 | * | ||
| 397 | * # | ||
| 398 | * # The RAW record below is opaque data wrt the ABI | ||
| 399 | * # | ||
| 400 | * # That is, the ABI doesn't make any promises wrt to | ||
| 401 | * # the stability of its content, it may vary depending | ||
| 402 | * # on event, hardware, kernel version and phase of | ||
| 403 | * # the moon. | ||
| 404 | * # | ||
| 405 | * # In other words, PERF_SAMPLE_RAW contents are not an ABI. | ||
| 406 | * # | ||
| 407 | * | ||
| 408 | * { u32 size; | ||
| 409 | * char data[size];}&& PERF_SAMPLE_RAW | ||
| 410 | * }; | ||
| 411 | */ | ||
| 412 | PERF_EVENT_SAMPLE = 9, | ||
| 413 | |||
| 414 | PERF_EVENT_MAX, /* non-ABI */ | ||
| 415 | }; | ||
| 416 | |||
| 417 | enum perf_callchain_context { | ||
| 418 | PERF_CONTEXT_HV = (__u64)-32, | ||
| 419 | PERF_CONTEXT_KERNEL = (__u64)-128, | ||
| 420 | PERF_CONTEXT_USER = (__u64)-512, | ||
| 421 | |||
| 422 | PERF_CONTEXT_GUEST = (__u64)-2048, | ||
| 423 | PERF_CONTEXT_GUEST_KERNEL = (__u64)-2176, | ||
| 424 | PERF_CONTEXT_GUEST_USER = (__u64)-2560, | ||
| 425 | |||
| 426 | PERF_CONTEXT_MAX = (__u64)-4095, | ||
| 427 | }; | ||
| 428 | |||
| 429 | #define PERF_FLAG_FD_NO_GROUP (1U << 0) | ||
| 430 | #define PERF_FLAG_FD_OUTPUT (1U << 1) | ||
| 431 | |||
| 432 | /* | ||
| 433 | * In case some app still references the old symbols: | ||
| 434 | */ | ||
| 435 | |||
| 436 | #define __NR_perf_counter_open __NR_perf_event_open | ||
| 437 | |||
| 438 | #define PR_TASK_PERF_COUNTERS_DISABLE PR_TASK_PERF_EVENTS_DISABLE | ||
| 439 | #define PR_TASK_PERF_COUNTERS_ENABLE PR_TASK_PERF_EVENTS_ENABLE | ||
| 440 | |||
| 441 | #endif /* _LINUX_PERF_COUNTER_H */ | ||
diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h index 9e7012689a84..c8e375440403 100644 --- a/include/linux/perf_event.h +++ b/include/linux/perf_event.h | |||
| @@ -31,6 +31,7 @@ enum perf_type_id { | |||
| 31 | PERF_TYPE_TRACEPOINT = 2, | 31 | PERF_TYPE_TRACEPOINT = 2, |
| 32 | PERF_TYPE_HW_CACHE = 3, | 32 | PERF_TYPE_HW_CACHE = 3, |
| 33 | PERF_TYPE_RAW = 4, | 33 | PERF_TYPE_RAW = 4, |
| 34 | PERF_TYPE_BREAKPOINT = 5, | ||
| 34 | 35 | ||
| 35 | PERF_TYPE_MAX, /* non-ABI */ | 36 | PERF_TYPE_MAX, /* non-ABI */ |
| 36 | }; | 37 | }; |
| @@ -102,6 +103,8 @@ enum perf_sw_ids { | |||
| 102 | PERF_COUNT_SW_CPU_MIGRATIONS = 4, | 103 | PERF_COUNT_SW_CPU_MIGRATIONS = 4, |
| 103 | PERF_COUNT_SW_PAGE_FAULTS_MIN = 5, | 104 | PERF_COUNT_SW_PAGE_FAULTS_MIN = 5, |
| 104 | PERF_COUNT_SW_PAGE_FAULTS_MAJ = 6, | 105 | PERF_COUNT_SW_PAGE_FAULTS_MAJ = 6, |
| 106 | PERF_COUNT_SW_ALIGNMENT_FAULTS = 7, | ||
| 107 | PERF_COUNT_SW_EMULATION_FAULTS = 8, | ||
| 105 | 108 | ||
| 106 | PERF_COUNT_SW_MAX, /* non-ABI */ | 109 | PERF_COUNT_SW_MAX, /* non-ABI */ |
| 107 | }; | 110 | }; |
| @@ -207,9 +210,10 @@ struct perf_event_attr { | |||
| 207 | __u32 wakeup_events; /* wakeup every n events */ | 210 | __u32 wakeup_events; /* wakeup every n events */ |
| 208 | __u32 wakeup_watermark; /* bytes before wakeup */ | 211 | __u32 wakeup_watermark; /* bytes before wakeup */ |
| 209 | }; | 212 | }; |
| 210 | __u32 __reserved_2; | ||
| 211 | 213 | ||
| 212 | __u64 __reserved_3; | 214 | __u32 bp_type; |
| 215 | __u64 bp_addr; | ||
| 216 | __u64 bp_len; | ||
| 213 | }; | 217 | }; |
| 214 | 218 | ||
| 215 | /* | 219 | /* |
| @@ -219,8 +223,9 @@ struct perf_event_attr { | |||
| 219 | #define PERF_EVENT_IOC_DISABLE _IO ('$', 1) | 223 | #define PERF_EVENT_IOC_DISABLE _IO ('$', 1) |
| 220 | #define PERF_EVENT_IOC_REFRESH _IO ('$', 2) | 224 | #define PERF_EVENT_IOC_REFRESH _IO ('$', 2) |
| 221 | #define PERF_EVENT_IOC_RESET _IO ('$', 3) | 225 | #define PERF_EVENT_IOC_RESET _IO ('$', 3) |
| 222 | #define PERF_EVENT_IOC_PERIOD _IOW('$', 4, u64) | 226 | #define PERF_EVENT_IOC_PERIOD _IOW('$', 4, __u64) |
| 223 | #define PERF_EVENT_IOC_SET_OUTPUT _IO ('$', 5) | 227 | #define PERF_EVENT_IOC_SET_OUTPUT _IO ('$', 5) |
| 228 | #define PERF_EVENT_IOC_SET_FILTER _IOW('$', 6, char *) | ||
| 224 | 229 | ||
| 225 | enum perf_event_ioc_flags { | 230 | enum perf_event_ioc_flags { |
| 226 | PERF_IOC_FLAG_GROUP = 1U << 0, | 231 | PERF_IOC_FLAG_GROUP = 1U << 0, |
| @@ -283,7 +288,7 @@ struct perf_event_mmap_page { | |||
| 283 | }; | 288 | }; |
| 284 | 289 | ||
| 285 | #define PERF_RECORD_MISC_CPUMODE_MASK (3 << 0) | 290 | #define PERF_RECORD_MISC_CPUMODE_MASK (3 << 0) |
| 286 | #define PERF_RECORD_MISC_CPUMODE_UNKNOWN (0 << 0) | 291 | #define PERF_RECORD_MISC_CPUMODE_UNKNOWN (0 << 0) |
| 287 | #define PERF_RECORD_MISC_KERNEL (1 << 0) | 292 | #define PERF_RECORD_MISC_KERNEL (1 << 0) |
| 288 | #define PERF_RECORD_MISC_USER (2 << 0) | 293 | #define PERF_RECORD_MISC_USER (2 << 0) |
| 289 | #define PERF_RECORD_MISC_HYPERVISOR (3 << 0) | 294 | #define PERF_RECORD_MISC_HYPERVISOR (3 << 0) |
| @@ -349,8 +354,8 @@ enum perf_event_type { | |||
| 349 | * u64 stream_id; | 354 | * u64 stream_id; |
| 350 | * }; | 355 | * }; |
| 351 | */ | 356 | */ |
| 352 | PERF_RECORD_THROTTLE = 5, | 357 | PERF_RECORD_THROTTLE = 5, |
| 353 | PERF_RECORD_UNTHROTTLE = 6, | 358 | PERF_RECORD_UNTHROTTLE = 6, |
| 354 | 359 | ||
| 355 | /* | 360 | /* |
| 356 | * struct { | 361 | * struct { |
| @@ -364,10 +369,10 @@ enum perf_event_type { | |||
| 364 | 369 | ||
| 365 | /* | 370 | /* |
| 366 | * struct { | 371 | * struct { |
| 367 | * struct perf_event_header header; | 372 | * struct perf_event_header header; |
| 368 | * u32 pid, tid; | 373 | * u32 pid, tid; |
| 369 | * | 374 | * |
| 370 | * struct read_format values; | 375 | * struct read_format values; |
| 371 | * }; | 376 | * }; |
| 372 | */ | 377 | */ |
| 373 | PERF_RECORD_READ = 8, | 378 | PERF_RECORD_READ = 8, |
| @@ -405,7 +410,7 @@ enum perf_event_type { | |||
| 405 | * char data[size];}&& PERF_SAMPLE_RAW | 410 | * char data[size];}&& PERF_SAMPLE_RAW |
| 406 | * }; | 411 | * }; |
| 407 | */ | 412 | */ |
| 408 | PERF_RECORD_SAMPLE = 9, | 413 | PERF_RECORD_SAMPLE = 9, |
| 409 | 414 | ||
| 410 | PERF_RECORD_MAX, /* non-ABI */ | 415 | PERF_RECORD_MAX, /* non-ABI */ |
| 411 | }; | 416 | }; |
| @@ -434,6 +439,10 @@ enum perf_callchain_context { | |||
| 434 | # include <asm/perf_event.h> | 439 | # include <asm/perf_event.h> |
| 435 | #endif | 440 | #endif |
| 436 | 441 | ||
| 442 | #ifdef CONFIG_HAVE_HW_BREAKPOINT | ||
| 443 | #include <asm/hw_breakpoint.h> | ||
| 444 | #endif | ||
| 445 | |||
| 437 | #include <linux/list.h> | 446 | #include <linux/list.h> |
| 438 | #include <linux/mutex.h> | 447 | #include <linux/mutex.h> |
| 439 | #include <linux/rculist.h> | 448 | #include <linux/rculist.h> |
| @@ -443,6 +452,8 @@ enum perf_callchain_context { | |||
| 443 | #include <linux/fs.h> | 452 | #include <linux/fs.h> |
| 444 | #include <linux/pid_namespace.h> | 453 | #include <linux/pid_namespace.h> |
| 445 | #include <linux/workqueue.h> | 454 | #include <linux/workqueue.h> |
| 455 | #include <linux/ftrace.h> | ||
| 456 | #include <linux/cpu.h> | ||
| 446 | #include <asm/atomic.h> | 457 | #include <asm/atomic.h> |
| 447 | 458 | ||
| 448 | #define PERF_MAX_STACK_DEPTH 255 | 459 | #define PERF_MAX_STACK_DEPTH 255 |
| @@ -467,14 +478,20 @@ struct hw_perf_event { | |||
| 467 | union { | 478 | union { |
| 468 | struct { /* hardware */ | 479 | struct { /* hardware */ |
| 469 | u64 config; | 480 | u64 config; |
| 481 | u64 last_tag; | ||
| 470 | unsigned long config_base; | 482 | unsigned long config_base; |
| 471 | unsigned long event_base; | 483 | unsigned long event_base; |
| 472 | int idx; | 484 | int idx; |
| 485 | int last_cpu; | ||
| 473 | }; | 486 | }; |
| 474 | struct { /* software */ | 487 | struct { /* software */ |
| 475 | s64 remaining; | 488 | s64 remaining; |
| 476 | struct hrtimer hrtimer; | 489 | struct hrtimer hrtimer; |
| 477 | }; | 490 | }; |
| 491 | #ifdef CONFIG_HAVE_HW_BREAKPOINT | ||
| 492 | /* breakpoint */ | ||
| 493 | struct arch_hw_breakpoint info; | ||
| 494 | #endif | ||
| 478 | }; | 495 | }; |
| 479 | atomic64_t prev_count; | 496 | atomic64_t prev_count; |
| 480 | u64 sample_period; | 497 | u64 sample_period; |
| @@ -482,9 +499,8 @@ struct hw_perf_event { | |||
| 482 | atomic64_t period_left; | 499 | atomic64_t period_left; |
| 483 | u64 interrupts; | 500 | u64 interrupts; |
| 484 | 501 | ||
| 485 | u64 freq_count; | 502 | u64 freq_time_stamp; |
| 486 | u64 freq_interrupts; | 503 | u64 freq_count_stamp; |
| 487 | u64 freq_stamp; | ||
| 488 | #endif | 504 | #endif |
| 489 | }; | 505 | }; |
| 490 | 506 | ||
| @@ -496,6 +512,8 @@ struct perf_event; | |||
| 496 | struct pmu { | 512 | struct pmu { |
| 497 | int (*enable) (struct perf_event *event); | 513 | int (*enable) (struct perf_event *event); |
| 498 | void (*disable) (struct perf_event *event); | 514 | void (*disable) (struct perf_event *event); |
| 515 | int (*start) (struct perf_event *event); | ||
| 516 | void (*stop) (struct perf_event *event); | ||
| 499 | void (*read) (struct perf_event *event); | 517 | void (*read) (struct perf_event *event); |
| 500 | void (*unthrottle) (struct perf_event *event); | 518 | void (*unthrottle) (struct perf_event *event); |
| 501 | }; | 519 | }; |
| @@ -543,6 +561,16 @@ struct perf_pending_entry { | |||
| 543 | void (*func)(struct perf_pending_entry *); | 561 | void (*func)(struct perf_pending_entry *); |
| 544 | }; | 562 | }; |
| 545 | 563 | ||
| 564 | struct perf_sample_data; | ||
| 565 | |||
| 566 | typedef void (*perf_overflow_handler_t)(struct perf_event *, int, | ||
| 567 | struct perf_sample_data *, | ||
| 568 | struct pt_regs *regs); | ||
| 569 | |||
| 570 | enum perf_group_flag { | ||
| 571 | PERF_GROUP_SOFTWARE = 0x1, | ||
| 572 | }; | ||
| 573 | |||
| 546 | /** | 574 | /** |
| 547 | * struct perf_event - performance event kernel representation: | 575 | * struct perf_event - performance event kernel representation: |
| 548 | */ | 576 | */ |
| @@ -552,6 +580,7 @@ struct perf_event { | |||
| 552 | struct list_head event_entry; | 580 | struct list_head event_entry; |
| 553 | struct list_head sibling_list; | 581 | struct list_head sibling_list; |
| 554 | int nr_siblings; | 582 | int nr_siblings; |
| 583 | int group_flags; | ||
| 555 | struct perf_event *group_leader; | 584 | struct perf_event *group_leader; |
| 556 | struct perf_event *output; | 585 | struct perf_event *output; |
| 557 | const struct pmu *pmu; | 586 | const struct pmu *pmu; |
| @@ -585,7 +614,7 @@ struct perf_event { | |||
| 585 | u64 tstamp_running; | 614 | u64 tstamp_running; |
| 586 | u64 tstamp_stopped; | 615 | u64 tstamp_stopped; |
| 587 | 616 | ||
| 588 | struct perf_event_attr attr; | 617 | struct perf_event_attr attr; |
| 589 | struct hw_perf_event hw; | 618 | struct hw_perf_event hw; |
| 590 | 619 | ||
| 591 | struct perf_event_context *ctx; | 620 | struct perf_event_context *ctx; |
| @@ -633,7 +662,14 @@ struct perf_event { | |||
| 633 | 662 | ||
| 634 | struct pid_namespace *ns; | 663 | struct pid_namespace *ns; |
| 635 | u64 id; | 664 | u64 id; |
| 665 | |||
| 666 | perf_overflow_handler_t overflow_handler; | ||
| 667 | |||
| 668 | #ifdef CONFIG_EVENT_TRACING | ||
| 669 | struct event_filter *filter; | ||
| 636 | #endif | 670 | #endif |
| 671 | |||
| 672 | #endif /* CONFIG_PERF_EVENTS */ | ||
| 637 | }; | 673 | }; |
| 638 | 674 | ||
| 639 | /** | 675 | /** |
| @@ -646,7 +682,7 @@ struct perf_event_context { | |||
| 646 | * Protect the states of the events in the list, | 682 | * Protect the states of the events in the list, |
| 647 | * nr_active, and the list: | 683 | * nr_active, and the list: |
| 648 | */ | 684 | */ |
| 649 | spinlock_t lock; | 685 | raw_spinlock_t lock; |
| 650 | /* | 686 | /* |
| 651 | * Protect the list of events. Locking either mutex or lock | 687 | * Protect the list of events. Locking either mutex or lock |
| 652 | * is sufficient to ensure the list doesn't change; to change | 688 | * is sufficient to ensure the list doesn't change; to change |
| @@ -654,7 +690,8 @@ struct perf_event_context { | |||
| 654 | */ | 690 | */ |
| 655 | struct mutex mutex; | 691 | struct mutex mutex; |
| 656 | 692 | ||
| 657 | struct list_head group_list; | 693 | struct list_head pinned_groups; |
| 694 | struct list_head flexible_groups; | ||
| 658 | struct list_head event_list; | 695 | struct list_head event_list; |
| 659 | int nr_events; | 696 | int nr_events; |
| 660 | int nr_active; | 697 | int nr_active; |
| @@ -706,7 +743,6 @@ struct perf_output_handle { | |||
| 706 | int nmi; | 743 | int nmi; |
| 707 | int sample; | 744 | int sample; |
| 708 | int locked; | 745 | int locked; |
| 709 | unsigned long flags; | ||
| 710 | }; | 746 | }; |
| 711 | 747 | ||
| 712 | #ifdef CONFIG_PERF_EVENTS | 748 | #ifdef CONFIG_PERF_EVENTS |
| @@ -718,10 +754,9 @@ extern int perf_max_events; | |||
| 718 | 754 | ||
| 719 | extern const struct pmu *hw_perf_event_init(struct perf_event *event); | 755 | extern const struct pmu *hw_perf_event_init(struct perf_event *event); |
| 720 | 756 | ||
| 721 | extern void perf_event_task_sched_in(struct task_struct *task, int cpu); | 757 | extern void perf_event_task_sched_in(struct task_struct *task); |
| 722 | extern void perf_event_task_sched_out(struct task_struct *task, | 758 | extern void perf_event_task_sched_out(struct task_struct *task, struct task_struct *next); |
| 723 | struct task_struct *next, int cpu); | 759 | extern void perf_event_task_tick(struct task_struct *task); |
| 724 | extern void perf_event_task_tick(struct task_struct *task, int cpu); | ||
| 725 | extern int perf_event_init_task(struct task_struct *child); | 760 | extern int perf_event_init_task(struct task_struct *child); |
| 726 | extern void perf_event_exit_task(struct task_struct *child); | 761 | extern void perf_event_exit_task(struct task_struct *child); |
| 727 | extern void perf_event_free_task(struct task_struct *task); | 762 | extern void perf_event_free_task(struct task_struct *task); |
| @@ -736,8 +771,16 @@ extern int perf_event_task_disable(void); | |||
| 736 | extern int perf_event_task_enable(void); | 771 | extern int perf_event_task_enable(void); |
| 737 | extern int hw_perf_group_sched_in(struct perf_event *group_leader, | 772 | extern int hw_perf_group_sched_in(struct perf_event *group_leader, |
| 738 | struct perf_cpu_context *cpuctx, | 773 | struct perf_cpu_context *cpuctx, |
| 739 | struct perf_event_context *ctx, int cpu); | 774 | struct perf_event_context *ctx); |
| 740 | extern void perf_event_update_userpage(struct perf_event *event); | 775 | extern void perf_event_update_userpage(struct perf_event *event); |
| 776 | extern int perf_event_release_kernel(struct perf_event *event); | ||
| 777 | extern struct perf_event * | ||
| 778 | perf_event_create_kernel_counter(struct perf_event_attr *attr, | ||
| 779 | int cpu, | ||
| 780 | pid_t pid, | ||
| 781 | perf_overflow_handler_t callback); | ||
| 782 | extern u64 perf_event_read_value(struct perf_event *event, | ||
| 783 | u64 *enabled, u64 *running); | ||
| 741 | 784 | ||
| 742 | struct perf_sample_data { | 785 | struct perf_sample_data { |
| 743 | u64 type; | 786 | u64 type; |
| @@ -760,6 +803,13 @@ struct perf_sample_data { | |||
| 760 | struct perf_raw_record *raw; | 803 | struct perf_raw_record *raw; |
| 761 | }; | 804 | }; |
| 762 | 805 | ||
| 806 | static inline | ||
| 807 | void perf_sample_data_init(struct perf_sample_data *data, u64 addr) | ||
| 808 | { | ||
| 809 | data->addr = addr; | ||
| 810 | data->raw = NULL; | ||
| 811 | } | ||
| 812 | |||
| 763 | extern void perf_output_sample(struct perf_output_handle *handle, | 813 | extern void perf_output_sample(struct perf_output_handle *handle, |
| 764 | struct perf_event_header *header, | 814 | struct perf_event_header *header, |
| 765 | struct perf_sample_data *data, | 815 | struct perf_sample_data *data, |
| @@ -778,20 +828,70 @@ extern int perf_event_overflow(struct perf_event *event, int nmi, | |||
| 778 | */ | 828 | */ |
| 779 | static inline int is_software_event(struct perf_event *event) | 829 | static inline int is_software_event(struct perf_event *event) |
| 780 | { | 830 | { |
| 781 | return (event->attr.type != PERF_TYPE_RAW) && | 831 | switch (event->attr.type) { |
| 782 | (event->attr.type != PERF_TYPE_HARDWARE) && | 832 | case PERF_TYPE_SOFTWARE: |
| 783 | (event->attr.type != PERF_TYPE_HW_CACHE); | 833 | case PERF_TYPE_TRACEPOINT: |
| 834 | /* for now the breakpoint stuff also works as software event */ | ||
| 835 | case PERF_TYPE_BREAKPOINT: | ||
| 836 | return 1; | ||
| 837 | } | ||
| 838 | return 0; | ||
| 784 | } | 839 | } |
| 785 | 840 | ||
| 786 | extern atomic_t perf_swevent_enabled[PERF_COUNT_SW_MAX]; | 841 | extern atomic_t perf_swevent_enabled[PERF_COUNT_SW_MAX]; |
| 787 | 842 | ||
| 788 | extern void __perf_sw_event(u32, u64, int, struct pt_regs *, u64); | 843 | extern void __perf_sw_event(u32, u64, int, struct pt_regs *, u64); |
| 789 | 844 | ||
| 845 | extern void | ||
| 846 | perf_arch_fetch_caller_regs(struct pt_regs *regs, unsigned long ip, int skip); | ||
| 847 | |||
| 848 | /* | ||
| 849 | * Take a snapshot of the regs. Skip ip and frame pointer to | ||
| 850 | * the nth caller. We only need a few of the regs: | ||
| 851 | * - ip for PERF_SAMPLE_IP | ||
| 852 | * - cs for user_mode() tests | ||
| 853 | * - bp for callchains | ||
| 854 | * - eflags, for future purposes, just in case | ||
| 855 | */ | ||
| 856 | static inline void perf_fetch_caller_regs(struct pt_regs *regs, int skip) | ||
| 857 | { | ||
| 858 | unsigned long ip; | ||
| 859 | |||
| 860 | memset(regs, 0, sizeof(*regs)); | ||
| 861 | |||
| 862 | switch (skip) { | ||
| 863 | case 1 : | ||
| 864 | ip = CALLER_ADDR0; | ||
| 865 | break; | ||
| 866 | case 2 : | ||
| 867 | ip = CALLER_ADDR1; | ||
| 868 | break; | ||
| 869 | case 3 : | ||
| 870 | ip = CALLER_ADDR2; | ||
| 871 | break; | ||
| 872 | case 4: | ||
| 873 | ip = CALLER_ADDR3; | ||
| 874 | break; | ||
| 875 | /* No need to support further for now */ | ||
| 876 | default: | ||
| 877 | ip = 0; | ||
| 878 | } | ||
| 879 | |||
| 880 | return perf_arch_fetch_caller_regs(regs, ip, skip); | ||
| 881 | } | ||
| 882 | |||
| 790 | static inline void | 883 | static inline void |
| 791 | perf_sw_event(u32 event_id, u64 nr, int nmi, struct pt_regs *regs, u64 addr) | 884 | perf_sw_event(u32 event_id, u64 nr, int nmi, struct pt_regs *regs, u64 addr) |
| 792 | { | 885 | { |
| 793 | if (atomic_read(&perf_swevent_enabled[event_id])) | 886 | if (atomic_read(&perf_swevent_enabled[event_id])) { |
| 887 | struct pt_regs hot_regs; | ||
| 888 | |||
| 889 | if (!regs) { | ||
| 890 | perf_fetch_caller_regs(&hot_regs, 1); | ||
| 891 | regs = &hot_regs; | ||
| 892 | } | ||
| 794 | __perf_sw_event(event_id, nr, nmi, regs, addr); | 893 | __perf_sw_event(event_id, nr, nmi, regs, addr); |
| 894 | } | ||
| 795 | } | 895 | } |
| 796 | 896 | ||
| 797 | extern void __perf_event_mmap(struct vm_area_struct *vma); | 897 | extern void __perf_event_mmap(struct vm_area_struct *vma); |
| @@ -811,9 +911,25 @@ extern int sysctl_perf_event_paranoid; | |||
| 811 | extern int sysctl_perf_event_mlock; | 911 | extern int sysctl_perf_event_mlock; |
| 812 | extern int sysctl_perf_event_sample_rate; | 912 | extern int sysctl_perf_event_sample_rate; |
| 813 | 913 | ||
| 914 | static inline bool perf_paranoid_tracepoint_raw(void) | ||
| 915 | { | ||
| 916 | return sysctl_perf_event_paranoid > -1; | ||
| 917 | } | ||
| 918 | |||
| 919 | static inline bool perf_paranoid_cpu(void) | ||
| 920 | { | ||
| 921 | return sysctl_perf_event_paranoid > 0; | ||
| 922 | } | ||
| 923 | |||
| 924 | static inline bool perf_paranoid_kernel(void) | ||
| 925 | { | ||
| 926 | return sysctl_perf_event_paranoid > 1; | ||
| 927 | } | ||
| 928 | |||
| 814 | extern void perf_event_init(void); | 929 | extern void perf_event_init(void); |
| 815 | extern void perf_tp_event(int event_id, u64 addr, u64 count, | 930 | extern void perf_tp_event(int event_id, u64 addr, u64 count, void *record, |
| 816 | void *record, int entry_size); | 931 | int entry_size, struct pt_regs *regs); |
| 932 | extern void perf_bp_event(struct perf_event *event, void *data); | ||
| 817 | 933 | ||
| 818 | #ifndef perf_misc_flags | 934 | #ifndef perf_misc_flags |
| 819 | #define perf_misc_flags(regs) (user_mode(regs) ? PERF_RECORD_MISC_USER : \ | 935 | #define perf_misc_flags(regs) (user_mode(regs) ? PERF_RECORD_MISC_USER : \ |
| @@ -827,14 +943,18 @@ extern int perf_output_begin(struct perf_output_handle *handle, | |||
| 827 | extern void perf_output_end(struct perf_output_handle *handle); | 943 | extern void perf_output_end(struct perf_output_handle *handle); |
| 828 | extern void perf_output_copy(struct perf_output_handle *handle, | 944 | extern void perf_output_copy(struct perf_output_handle *handle, |
| 829 | const void *buf, unsigned int len); | 945 | const void *buf, unsigned int len); |
| 946 | extern int perf_swevent_get_recursion_context(void); | ||
| 947 | extern void perf_swevent_put_recursion_context(int rctx); | ||
| 948 | extern void perf_event_enable(struct perf_event *event); | ||
| 949 | extern void perf_event_disable(struct perf_event *event); | ||
| 830 | #else | 950 | #else |
| 831 | static inline void | 951 | static inline void |
| 832 | perf_event_task_sched_in(struct task_struct *task, int cpu) { } | 952 | perf_event_task_sched_in(struct task_struct *task) { } |
| 833 | static inline void | 953 | static inline void |
| 834 | perf_event_task_sched_out(struct task_struct *task, | 954 | perf_event_task_sched_out(struct task_struct *task, |
| 835 | struct task_struct *next, int cpu) { } | 955 | struct task_struct *next) { } |
| 836 | static inline void | 956 | static inline void |
| 837 | perf_event_task_tick(struct task_struct *task, int cpu) { } | 957 | perf_event_task_tick(struct task_struct *task) { } |
| 838 | static inline int perf_event_init_task(struct task_struct *child) { return 0; } | 958 | static inline int perf_event_init_task(struct task_struct *child) { return 0; } |
| 839 | static inline void perf_event_exit_task(struct task_struct *child) { } | 959 | static inline void perf_event_exit_task(struct task_struct *child) { } |
| 840 | static inline void perf_event_free_task(struct task_struct *task) { } | 960 | static inline void perf_event_free_task(struct task_struct *task) { } |
| @@ -848,16 +968,37 @@ static inline int perf_event_task_enable(void) { return -EINVAL; } | |||
| 848 | static inline void | 968 | static inline void |
| 849 | perf_sw_event(u32 event_id, u64 nr, int nmi, | 969 | perf_sw_event(u32 event_id, u64 nr, int nmi, |
| 850 | struct pt_regs *regs, u64 addr) { } | 970 | struct pt_regs *regs, u64 addr) { } |
| 971 | static inline void | ||
| 972 | perf_bp_event(struct perf_event *event, void *data) { } | ||
| 851 | 973 | ||
| 852 | static inline void perf_event_mmap(struct vm_area_struct *vma) { } | 974 | static inline void perf_event_mmap(struct vm_area_struct *vma) { } |
| 853 | static inline void perf_event_comm(struct task_struct *tsk) { } | 975 | static inline void perf_event_comm(struct task_struct *tsk) { } |
| 854 | static inline void perf_event_fork(struct task_struct *tsk) { } | 976 | static inline void perf_event_fork(struct task_struct *tsk) { } |
| 855 | static inline void perf_event_init(void) { } | 977 | static inline void perf_event_init(void) { } |
| 856 | 978 | static inline int perf_swevent_get_recursion_context(void) { return -1; } | |
| 979 | static inline void perf_swevent_put_recursion_context(int rctx) { } | ||
| 980 | static inline void perf_event_enable(struct perf_event *event) { } | ||
| 981 | static inline void perf_event_disable(struct perf_event *event) { } | ||
| 857 | #endif | 982 | #endif |
| 858 | 983 | ||
| 859 | #define perf_output_put(handle, x) \ | 984 | #define perf_output_put(handle, x) \ |
| 860 | perf_output_copy((handle), &(x), sizeof(x)) | 985 | perf_output_copy((handle), &(x), sizeof(x)) |
| 861 | 986 | ||
| 987 | /* | ||
| 988 | * This has to have a higher priority than migration_notifier in sched.c. | ||
| 989 | */ | ||
| 990 | #define perf_cpu_notifier(fn) \ | ||
| 991 | do { \ | ||
| 992 | static struct notifier_block fn##_nb __cpuinitdata = \ | ||
| 993 | { .notifier_call = fn, .priority = 20 }; \ | ||
| 994 | fn(&fn##_nb, (unsigned long)CPU_UP_PREPARE, \ | ||
| 995 | (void *)(unsigned long)smp_processor_id()); \ | ||
| 996 | fn(&fn##_nb, (unsigned long)CPU_STARTING, \ | ||
| 997 | (void *)(unsigned long)smp_processor_id()); \ | ||
| 998 | fn(&fn##_nb, (unsigned long)CPU_ONLINE, \ | ||
| 999 | (void *)(unsigned long)smp_processor_id()); \ | ||
| 1000 | register_cpu_notifier(&fn##_nb); \ | ||
| 1001 | } while (0) | ||
| 1002 | |||
| 862 | #endif /* __KERNEL__ */ | 1003 | #endif /* __KERNEL__ */ |
| 863 | #endif /* _LINUX_PERF_EVENT_H */ | 1004 | #endif /* _LINUX_PERF_EVENT_H */ |
diff --git a/include/linux/pfkeyv2.h b/include/linux/pfkeyv2.h index 228b0b6306b0..0b80c806631f 100644 --- a/include/linux/pfkeyv2.h +++ b/include/linux/pfkeyv2.h | |||
| @@ -315,6 +315,7 @@ struct sadb_x_kmaddress { | |||
| 315 | #define SADB_X_EALG_AES_GCM_ICV12 19 | 315 | #define SADB_X_EALG_AES_GCM_ICV12 19 |
| 316 | #define SADB_X_EALG_AES_GCM_ICV16 20 | 316 | #define SADB_X_EALG_AES_GCM_ICV16 20 |
| 317 | #define SADB_X_EALG_CAMELLIACBC 22 | 317 | #define SADB_X_EALG_CAMELLIACBC 22 |
| 318 | #define SADB_X_EALG_NULL_AES_GMAC 23 | ||
| 318 | #define SADB_EALG_MAX 253 /* last EALG */ | 319 | #define SADB_EALG_MAX 253 /* last EALG */ |
| 319 | /* private allocations should use 249-255 (RFC2407) */ | 320 | /* private allocations should use 249-255 (RFC2407) */ |
| 320 | #define SADB_X_EALG_SERPENTCBC 252 /* draft-ietf-ipsec-ciph-aes-cbc-00 */ | 321 | #define SADB_X_EALG_SERPENTCBC 252 /* draft-ietf-ipsec-ciph-aes-cbc-00 */ |
diff --git a/include/linux/phy.h b/include/linux/phy.h index b1368b8f6572..14d7fdf6a90a 100644 --- a/include/linux/phy.h +++ b/include/linux/phy.h | |||
| @@ -447,10 +447,12 @@ struct phy_device* get_phy_device(struct mii_bus *bus, int addr); | |||
| 447 | int phy_device_register(struct phy_device *phy); | 447 | int phy_device_register(struct phy_device *phy); |
| 448 | int phy_clear_interrupt(struct phy_device *phydev); | 448 | int phy_clear_interrupt(struct phy_device *phydev); |
| 449 | int phy_config_interrupt(struct phy_device *phydev, u32 interrupts); | 449 | int phy_config_interrupt(struct phy_device *phydev, u32 interrupts); |
| 450 | int phy_init_hw(struct phy_device *phydev); | ||
| 450 | int phy_attach_direct(struct net_device *dev, struct phy_device *phydev, | 451 | int phy_attach_direct(struct net_device *dev, struct phy_device *phydev, |
| 451 | u32 flags, phy_interface_t interface); | 452 | u32 flags, phy_interface_t interface); |
| 452 | struct phy_device * phy_attach(struct net_device *dev, | 453 | struct phy_device * phy_attach(struct net_device *dev, |
| 453 | const char *bus_id, u32 flags, phy_interface_t interface); | 454 | const char *bus_id, u32 flags, phy_interface_t interface); |
| 455 | struct phy_device *phy_find_first(struct mii_bus *bus); | ||
| 454 | int phy_connect_direct(struct net_device *dev, struct phy_device *phydev, | 456 | int phy_connect_direct(struct net_device *dev, struct phy_device *phydev, |
| 455 | void (*handler)(struct net_device *), u32 flags, | 457 | void (*handler)(struct net_device *), u32 flags, |
| 456 | phy_interface_t interface); | 458 | phy_interface_t interface); |
| @@ -484,6 +486,7 @@ void phy_driver_unregister(struct phy_driver *drv); | |||
| 484 | int phy_driver_register(struct phy_driver *new_driver); | 486 | int phy_driver_register(struct phy_driver *new_driver); |
| 485 | void phy_prepare_link(struct phy_device *phydev, | 487 | void phy_prepare_link(struct phy_device *phydev, |
| 486 | void (*adjust_link)(struct net_device *)); | 488 | void (*adjust_link)(struct net_device *)); |
| 489 | void phy_state_machine(struct work_struct *work); | ||
| 487 | void phy_start_machine(struct phy_device *phydev, | 490 | void phy_start_machine(struct phy_device *phydev, |
| 488 | void (*handler)(struct net_device *)); | 491 | void (*handler)(struct net_device *)); |
| 489 | void phy_stop_machine(struct phy_device *phydev); | 492 | void phy_stop_machine(struct phy_device *phydev); |
diff --git a/include/linux/pkt_cls.h b/include/linux/pkt_cls.h index 3c842edff388..7f6ba8658abe 100644 --- a/include/linux/pkt_cls.h +++ b/include/linux/pkt_cls.h | |||
| @@ -75,8 +75,7 @@ bits 9,10,11: redirect counter - redirect TTL. Loop avoidance | |||
| 75 | #define SET_TC_AT(v,n) ((V_TC_AT(n)) | (v & ~M_TC_AT)) | 75 | #define SET_TC_AT(v,n) ((V_TC_AT(n)) | (v & ~M_TC_AT)) |
| 76 | 76 | ||
| 77 | /* Action attributes */ | 77 | /* Action attributes */ |
| 78 | enum | 78 | enum { |
| 79 | { | ||
| 80 | TCA_ACT_UNSPEC, | 79 | TCA_ACT_UNSPEC, |
| 81 | TCA_ACT_KIND, | 80 | TCA_ACT_KIND, |
| 82 | TCA_ACT_OPTIONS, | 81 | TCA_ACT_OPTIONS, |
| @@ -108,8 +107,7 @@ enum | |||
| 108 | #define TC_ACT_JUMP 0x10000000 | 107 | #define TC_ACT_JUMP 0x10000000 |
| 109 | 108 | ||
| 110 | /* Action type identifiers*/ | 109 | /* Action type identifiers*/ |
| 111 | enum | 110 | enum { |
| 112 | { | ||
| 113 | TCA_ID_UNSPEC=0, | 111 | TCA_ID_UNSPEC=0, |
| 114 | TCA_ID_POLICE=1, | 112 | TCA_ID_POLICE=1, |
| 115 | /* other actions go here */ | 113 | /* other actions go here */ |
| @@ -118,8 +116,7 @@ enum | |||
| 118 | 116 | ||
| 119 | #define TCA_ID_MAX __TCA_ID_MAX | 117 | #define TCA_ID_MAX __TCA_ID_MAX |
| 120 | 118 | ||
| 121 | struct tc_police | 119 | struct tc_police { |
| 122 | { | ||
| 123 | __u32 index; | 120 | __u32 index; |
| 124 | int action; | 121 | int action; |
| 125 | #define TC_POLICE_UNSPEC TC_ACT_UNSPEC | 122 | #define TC_POLICE_UNSPEC TC_ACT_UNSPEC |
| @@ -138,15 +135,13 @@ struct tc_police | |||
| 138 | __u32 capab; | 135 | __u32 capab; |
| 139 | }; | 136 | }; |
| 140 | 137 | ||
| 141 | struct tcf_t | 138 | struct tcf_t { |
| 142 | { | ||
| 143 | __u64 install; | 139 | __u64 install; |
| 144 | __u64 lastuse; | 140 | __u64 lastuse; |
| 145 | __u64 expires; | 141 | __u64 expires; |
| 146 | }; | 142 | }; |
| 147 | 143 | ||
| 148 | struct tc_cnt | 144 | struct tc_cnt { |
| 149 | { | ||
| 150 | int refcnt; | 145 | int refcnt; |
| 151 | int bindcnt; | 146 | int bindcnt; |
| 152 | }; | 147 | }; |
| @@ -158,8 +153,7 @@ struct tc_cnt | |||
| 158 | int refcnt; \ | 153 | int refcnt; \ |
| 159 | int bindcnt | 154 | int bindcnt |
| 160 | 155 | ||
| 161 | enum | 156 | enum { |
| 162 | { | ||
| 163 | TCA_POLICE_UNSPEC, | 157 | TCA_POLICE_UNSPEC, |
| 164 | TCA_POLICE_TBF, | 158 | TCA_POLICE_TBF, |
| 165 | TCA_POLICE_RATE, | 159 | TCA_POLICE_RATE, |
| @@ -182,8 +176,7 @@ enum | |||
| 182 | #define TC_U32_UNSPEC 0 | 176 | #define TC_U32_UNSPEC 0 |
| 183 | #define TC_U32_ROOT (0xFFF00000) | 177 | #define TC_U32_ROOT (0xFFF00000) |
| 184 | 178 | ||
| 185 | enum | 179 | enum { |
| 186 | { | ||
| 187 | TCA_U32_UNSPEC, | 180 | TCA_U32_UNSPEC, |
| 188 | TCA_U32_CLASSID, | 181 | TCA_U32_CLASSID, |
| 189 | TCA_U32_HASH, | 182 | TCA_U32_HASH, |
| @@ -200,16 +193,14 @@ enum | |||
| 200 | 193 | ||
| 201 | #define TCA_U32_MAX (__TCA_U32_MAX - 1) | 194 | #define TCA_U32_MAX (__TCA_U32_MAX - 1) |
| 202 | 195 | ||
| 203 | struct tc_u32_key | 196 | struct tc_u32_key { |
| 204 | { | ||
| 205 | __be32 mask; | 197 | __be32 mask; |
| 206 | __be32 val; | 198 | __be32 val; |
| 207 | int off; | 199 | int off; |
| 208 | int offmask; | 200 | int offmask; |
| 209 | }; | 201 | }; |
| 210 | 202 | ||
| 211 | struct tc_u32_sel | 203 | struct tc_u32_sel { |
| 212 | { | ||
| 213 | unsigned char flags; | 204 | unsigned char flags; |
| 214 | unsigned char offshift; | 205 | unsigned char offshift; |
| 215 | unsigned char nkeys; | 206 | unsigned char nkeys; |
| @@ -223,15 +214,13 @@ struct tc_u32_sel | |||
| 223 | struct tc_u32_key keys[0]; | 214 | struct tc_u32_key keys[0]; |
| 224 | }; | 215 | }; |
| 225 | 216 | ||
| 226 | struct tc_u32_mark | 217 | struct tc_u32_mark { |
| 227 | { | ||
| 228 | __u32 val; | 218 | __u32 val; |
| 229 | __u32 mask; | 219 | __u32 mask; |
| 230 | __u32 success; | 220 | __u32 success; |
| 231 | }; | 221 | }; |
| 232 | 222 | ||
| 233 | struct tc_u32_pcnt | 223 | struct tc_u32_pcnt { |
| 234 | { | ||
| 235 | __u64 rcnt; | 224 | __u64 rcnt; |
| 236 | __u64 rhit; | 225 | __u64 rhit; |
| 237 | __u64 kcnts[0]; | 226 | __u64 kcnts[0]; |
| @@ -249,8 +238,7 @@ struct tc_u32_pcnt | |||
| 249 | 238 | ||
| 250 | /* RSVP filter */ | 239 | /* RSVP filter */ |
| 251 | 240 | ||
| 252 | enum | 241 | enum { |
| 253 | { | ||
| 254 | TCA_RSVP_UNSPEC, | 242 | TCA_RSVP_UNSPEC, |
| 255 | TCA_RSVP_CLASSID, | 243 | TCA_RSVP_CLASSID, |
| 256 | TCA_RSVP_DST, | 244 | TCA_RSVP_DST, |
| @@ -263,15 +251,13 @@ enum | |||
| 263 | 251 | ||
| 264 | #define TCA_RSVP_MAX (__TCA_RSVP_MAX - 1 ) | 252 | #define TCA_RSVP_MAX (__TCA_RSVP_MAX - 1 ) |
| 265 | 253 | ||
| 266 | struct tc_rsvp_gpi | 254 | struct tc_rsvp_gpi { |
| 267 | { | ||
| 268 | __u32 key; | 255 | __u32 key; |
| 269 | __u32 mask; | 256 | __u32 mask; |
| 270 | int offset; | 257 | int offset; |
| 271 | }; | 258 | }; |
| 272 | 259 | ||
| 273 | struct tc_rsvp_pinfo | 260 | struct tc_rsvp_pinfo { |
| 274 | { | ||
| 275 | struct tc_rsvp_gpi dpi; | 261 | struct tc_rsvp_gpi dpi; |
| 276 | struct tc_rsvp_gpi spi; | 262 | struct tc_rsvp_gpi spi; |
| 277 | __u8 protocol; | 263 | __u8 protocol; |
| @@ -282,8 +268,7 @@ struct tc_rsvp_pinfo | |||
| 282 | 268 | ||
| 283 | /* ROUTE filter */ | 269 | /* ROUTE filter */ |
| 284 | 270 | ||
| 285 | enum | 271 | enum { |
| 286 | { | ||
| 287 | TCA_ROUTE4_UNSPEC, | 272 | TCA_ROUTE4_UNSPEC, |
| 288 | TCA_ROUTE4_CLASSID, | 273 | TCA_ROUTE4_CLASSID, |
| 289 | TCA_ROUTE4_TO, | 274 | TCA_ROUTE4_TO, |
| @@ -299,8 +284,7 @@ enum | |||
| 299 | 284 | ||
| 300 | /* FW filter */ | 285 | /* FW filter */ |
| 301 | 286 | ||
| 302 | enum | 287 | enum { |
| 303 | { | ||
| 304 | TCA_FW_UNSPEC, | 288 | TCA_FW_UNSPEC, |
| 305 | TCA_FW_CLASSID, | 289 | TCA_FW_CLASSID, |
| 306 | TCA_FW_POLICE, | 290 | TCA_FW_POLICE, |
| @@ -314,8 +298,7 @@ enum | |||
| 314 | 298 | ||
| 315 | /* TC index filter */ | 299 | /* TC index filter */ |
| 316 | 300 | ||
| 317 | enum | 301 | enum { |
| 318 | { | ||
| 319 | TCA_TCINDEX_UNSPEC, | 302 | TCA_TCINDEX_UNSPEC, |
| 320 | TCA_TCINDEX_HASH, | 303 | TCA_TCINDEX_HASH, |
| 321 | TCA_TCINDEX_MASK, | 304 | TCA_TCINDEX_MASK, |
| @@ -331,8 +314,7 @@ enum | |||
| 331 | 314 | ||
| 332 | /* Flow filter */ | 315 | /* Flow filter */ |
| 333 | 316 | ||
| 334 | enum | 317 | enum { |
| 335 | { | ||
| 336 | FLOW_KEY_SRC, | 318 | FLOW_KEY_SRC, |
| 337 | FLOW_KEY_DST, | 319 | FLOW_KEY_DST, |
| 338 | FLOW_KEY_PROTO, | 320 | FLOW_KEY_PROTO, |
| @@ -355,14 +337,12 @@ enum | |||
| 355 | 337 | ||
| 356 | #define FLOW_KEY_MAX (__FLOW_KEY_MAX - 1) | 338 | #define FLOW_KEY_MAX (__FLOW_KEY_MAX - 1) |
| 357 | 339 | ||
| 358 | enum | 340 | enum { |
| 359 | { | ||
| 360 | FLOW_MODE_MAP, | 341 | FLOW_MODE_MAP, |
| 361 | FLOW_MODE_HASH, | 342 | FLOW_MODE_HASH, |
| 362 | }; | 343 | }; |
| 363 | 344 | ||
| 364 | enum | 345 | enum { |
| 365 | { | ||
| 366 | TCA_FLOW_UNSPEC, | 346 | TCA_FLOW_UNSPEC, |
| 367 | TCA_FLOW_KEYS, | 347 | TCA_FLOW_KEYS, |
| 368 | TCA_FLOW_MODE, | 348 | TCA_FLOW_MODE, |
| @@ -383,8 +363,7 @@ enum | |||
| 383 | 363 | ||
| 384 | /* Basic filter */ | 364 | /* Basic filter */ |
| 385 | 365 | ||
| 386 | enum | 366 | enum { |
| 387 | { | ||
| 388 | TCA_BASIC_UNSPEC, | 367 | TCA_BASIC_UNSPEC, |
| 389 | TCA_BASIC_CLASSID, | 368 | TCA_BASIC_CLASSID, |
| 390 | TCA_BASIC_EMATCHES, | 369 | TCA_BASIC_EMATCHES, |
| @@ -398,8 +377,7 @@ enum | |||
| 398 | 377 | ||
| 399 | /* Cgroup classifier */ | 378 | /* Cgroup classifier */ |
| 400 | 379 | ||
| 401 | enum | 380 | enum { |
| 402 | { | ||
| 403 | TCA_CGROUP_UNSPEC, | 381 | TCA_CGROUP_UNSPEC, |
| 404 | TCA_CGROUP_ACT, | 382 | TCA_CGROUP_ACT, |
| 405 | TCA_CGROUP_POLICE, | 383 | TCA_CGROUP_POLICE, |
| @@ -411,14 +389,12 @@ enum | |||
| 411 | 389 | ||
| 412 | /* Extended Matches */ | 390 | /* Extended Matches */ |
| 413 | 391 | ||
| 414 | struct tcf_ematch_tree_hdr | 392 | struct tcf_ematch_tree_hdr { |
| 415 | { | ||
| 416 | __u16 nmatches; | 393 | __u16 nmatches; |
| 417 | __u16 progid; | 394 | __u16 progid; |
| 418 | }; | 395 | }; |
| 419 | 396 | ||
| 420 | enum | 397 | enum { |
| 421 | { | ||
| 422 | TCA_EMATCH_TREE_UNSPEC, | 398 | TCA_EMATCH_TREE_UNSPEC, |
| 423 | TCA_EMATCH_TREE_HDR, | 399 | TCA_EMATCH_TREE_HDR, |
| 424 | TCA_EMATCH_TREE_LIST, | 400 | TCA_EMATCH_TREE_LIST, |
| @@ -426,8 +402,7 @@ enum | |||
| 426 | }; | 402 | }; |
| 427 | #define TCA_EMATCH_TREE_MAX (__TCA_EMATCH_TREE_MAX - 1) | 403 | #define TCA_EMATCH_TREE_MAX (__TCA_EMATCH_TREE_MAX - 1) |
| 428 | 404 | ||
| 429 | struct tcf_ematch_hdr | 405 | struct tcf_ematch_hdr { |
| 430 | { | ||
| 431 | __u16 matchid; | 406 | __u16 matchid; |
| 432 | __u16 kind; | 407 | __u16 kind; |
| 433 | __u16 flags; | 408 | __u16 flags; |
| @@ -457,8 +432,7 @@ struct tcf_ematch_hdr | |||
| 457 | #define TCF_EM_REL_MASK 3 | 432 | #define TCF_EM_REL_MASK 3 |
| 458 | #define TCF_EM_REL_VALID(v) (((v) & TCF_EM_REL_MASK) != TCF_EM_REL_MASK) | 433 | #define TCF_EM_REL_VALID(v) (((v) & TCF_EM_REL_MASK) != TCF_EM_REL_MASK) |
| 459 | 434 | ||
| 460 | enum | 435 | enum { |
| 461 | { | ||
| 462 | TCF_LAYER_LINK, | 436 | TCF_LAYER_LINK, |
| 463 | TCF_LAYER_NETWORK, | 437 | TCF_LAYER_NETWORK, |
| 464 | TCF_LAYER_TRANSPORT, | 438 | TCF_LAYER_TRANSPORT, |
| @@ -479,13 +453,11 @@ enum | |||
| 479 | #define TCF_EM_VLAN 6 | 453 | #define TCF_EM_VLAN 6 |
| 480 | #define TCF_EM_MAX 6 | 454 | #define TCF_EM_MAX 6 |
| 481 | 455 | ||
| 482 | enum | 456 | enum { |
| 483 | { | ||
| 484 | TCF_EM_PROG_TC | 457 | TCF_EM_PROG_TC |
| 485 | }; | 458 | }; |
| 486 | 459 | ||
| 487 | enum | 460 | enum { |
| 488 | { | ||
| 489 | TCF_EM_OPND_EQ, | 461 | TCF_EM_OPND_EQ, |
| 490 | TCF_EM_OPND_GT, | 462 | TCF_EM_OPND_GT, |
| 491 | TCF_EM_OPND_LT | 463 | TCF_EM_OPND_LT |
diff --git a/include/linux/pkt_sched.h b/include/linux/pkt_sched.h index d51a2b3e221e..2cfa4bc8dea6 100644 --- a/include/linux/pkt_sched.h +++ b/include/linux/pkt_sched.h | |||
| @@ -29,8 +29,7 @@ | |||
| 29 | Particular schedulers may have also their private records. | 29 | Particular schedulers may have also their private records. |
| 30 | */ | 30 | */ |
| 31 | 31 | ||
| 32 | struct tc_stats | 32 | struct tc_stats { |
| 33 | { | ||
| 34 | __u64 bytes; /* NUmber of enqueues bytes */ | 33 | __u64 bytes; /* NUmber of enqueues bytes */ |
| 35 | __u32 packets; /* Number of enqueued packets */ | 34 | __u32 packets; /* Number of enqueued packets */ |
| 36 | __u32 drops; /* Packets dropped because of lack of resources */ | 35 | __u32 drops; /* Packets dropped because of lack of resources */ |
| @@ -42,8 +41,7 @@ struct tc_stats | |||
| 42 | __u32 backlog; | 41 | __u32 backlog; |
| 43 | }; | 42 | }; |
| 44 | 43 | ||
| 45 | struct tc_estimator | 44 | struct tc_estimator { |
| 46 | { | ||
| 47 | signed char interval; | 45 | signed char interval; |
| 48 | unsigned char ewma_log; | 46 | unsigned char ewma_log; |
| 49 | }; | 47 | }; |
| @@ -75,8 +73,7 @@ struct tc_estimator | |||
| 75 | #define TC_H_ROOT (0xFFFFFFFFU) | 73 | #define TC_H_ROOT (0xFFFFFFFFU) |
| 76 | #define TC_H_INGRESS (0xFFFFFFF1U) | 74 | #define TC_H_INGRESS (0xFFFFFFF1U) |
| 77 | 75 | ||
| 78 | struct tc_ratespec | 76 | struct tc_ratespec { |
| 79 | { | ||
| 80 | unsigned char cell_log; | 77 | unsigned char cell_log; |
| 81 | unsigned char __reserved; | 78 | unsigned char __reserved; |
| 82 | unsigned short overhead; | 79 | unsigned short overhead; |
| @@ -109,8 +106,7 @@ enum { | |||
| 109 | 106 | ||
| 110 | /* FIFO section */ | 107 | /* FIFO section */ |
| 111 | 108 | ||
| 112 | struct tc_fifo_qopt | 109 | struct tc_fifo_qopt { |
| 113 | { | ||
| 114 | __u32 limit; /* Queue length: bytes for bfifo, packets for pfifo */ | 110 | __u32 limit; /* Queue length: bytes for bfifo, packets for pfifo */ |
| 115 | }; | 111 | }; |
| 116 | 112 | ||
| @@ -119,8 +115,7 @@ struct tc_fifo_qopt | |||
| 119 | #define TCQ_PRIO_BANDS 16 | 115 | #define TCQ_PRIO_BANDS 16 |
| 120 | #define TCQ_MIN_PRIO_BANDS 2 | 116 | #define TCQ_MIN_PRIO_BANDS 2 |
| 121 | 117 | ||
| 122 | struct tc_prio_qopt | 118 | struct tc_prio_qopt { |
| 123 | { | ||
| 124 | int bands; /* Number of bands */ | 119 | int bands; /* Number of bands */ |
| 125 | __u8 priomap[TC_PRIO_MAX+1]; /* Map: logical priority -> PRIO band */ | 120 | __u8 priomap[TC_PRIO_MAX+1]; /* Map: logical priority -> PRIO band */ |
| 126 | }; | 121 | }; |
| @@ -134,8 +129,7 @@ struct tc_multiq_qopt { | |||
| 134 | 129 | ||
| 135 | /* TBF section */ | 130 | /* TBF section */ |
| 136 | 131 | ||
| 137 | struct tc_tbf_qopt | 132 | struct tc_tbf_qopt { |
| 138 | { | ||
| 139 | struct tc_ratespec rate; | 133 | struct tc_ratespec rate; |
| 140 | struct tc_ratespec peakrate; | 134 | struct tc_ratespec peakrate; |
| 141 | __u32 limit; | 135 | __u32 limit; |
| @@ -143,8 +137,7 @@ struct tc_tbf_qopt | |||
| 143 | __u32 mtu; | 137 | __u32 mtu; |
| 144 | }; | 138 | }; |
| 145 | 139 | ||
| 146 | enum | 140 | enum { |
| 147 | { | ||
| 148 | TCA_TBF_UNSPEC, | 141 | TCA_TBF_UNSPEC, |
| 149 | TCA_TBF_PARMS, | 142 | TCA_TBF_PARMS, |
| 150 | TCA_TBF_RTAB, | 143 | TCA_TBF_RTAB, |
| @@ -161,8 +154,7 @@ enum | |||
| 161 | 154 | ||
| 162 | /* SFQ section */ | 155 | /* SFQ section */ |
| 163 | 156 | ||
| 164 | struct tc_sfq_qopt | 157 | struct tc_sfq_qopt { |
| 165 | { | ||
| 166 | unsigned quantum; /* Bytes per round allocated to flow */ | 158 | unsigned quantum; /* Bytes per round allocated to flow */ |
| 167 | int perturb_period; /* Period of hash perturbation */ | 159 | int perturb_period; /* Period of hash perturbation */ |
| 168 | __u32 limit; /* Maximal packets in queue */ | 160 | __u32 limit; /* Maximal packets in queue */ |
| @@ -170,8 +162,7 @@ struct tc_sfq_qopt | |||
| 170 | unsigned flows; /* Maximal number of flows */ | 162 | unsigned flows; /* Maximal number of flows */ |
| 171 | }; | 163 | }; |
| 172 | 164 | ||
| 173 | struct tc_sfq_xstats | 165 | struct tc_sfq_xstats { |
| 174 | { | ||
| 175 | __s32 allot; | 166 | __s32 allot; |
| 176 | }; | 167 | }; |
| 177 | 168 | ||
| @@ -186,8 +177,7 @@ struct tc_sfq_xstats | |||
| 186 | 177 | ||
| 187 | /* RED section */ | 178 | /* RED section */ |
| 188 | 179 | ||
| 189 | enum | 180 | enum { |
| 190 | { | ||
| 191 | TCA_RED_UNSPEC, | 181 | TCA_RED_UNSPEC, |
| 192 | TCA_RED_PARMS, | 182 | TCA_RED_PARMS, |
| 193 | TCA_RED_STAB, | 183 | TCA_RED_STAB, |
| @@ -196,8 +186,7 @@ enum | |||
| 196 | 186 | ||
| 197 | #define TCA_RED_MAX (__TCA_RED_MAX - 1) | 187 | #define TCA_RED_MAX (__TCA_RED_MAX - 1) |
| 198 | 188 | ||
| 199 | struct tc_red_qopt | 189 | struct tc_red_qopt { |
| 200 | { | ||
| 201 | __u32 limit; /* HARD maximal queue length (bytes) */ | 190 | __u32 limit; /* HARD maximal queue length (bytes) */ |
| 202 | __u32 qth_min; /* Min average length threshold (bytes) */ | 191 | __u32 qth_min; /* Min average length threshold (bytes) */ |
| 203 | __u32 qth_max; /* Max average length threshold (bytes) */ | 192 | __u32 qth_max; /* Max average length threshold (bytes) */ |
| @@ -209,8 +198,7 @@ struct tc_red_qopt | |||
| 209 | #define TC_RED_HARDDROP 2 | 198 | #define TC_RED_HARDDROP 2 |
| 210 | }; | 199 | }; |
| 211 | 200 | ||
| 212 | struct tc_red_xstats | 201 | struct tc_red_xstats { |
| 213 | { | ||
| 214 | __u32 early; /* Early drops */ | 202 | __u32 early; /* Early drops */ |
| 215 | __u32 pdrop; /* Drops due to queue limits */ | 203 | __u32 pdrop; /* Drops due to queue limits */ |
| 216 | __u32 other; /* Drops due to drop() calls */ | 204 | __u32 other; /* Drops due to drop() calls */ |
| @@ -221,8 +209,7 @@ struct tc_red_xstats | |||
| 221 | 209 | ||
| 222 | #define MAX_DPs 16 | 210 | #define MAX_DPs 16 |
| 223 | 211 | ||
| 224 | enum | 212 | enum { |
| 225 | { | ||
| 226 | TCA_GRED_UNSPEC, | 213 | TCA_GRED_UNSPEC, |
| 227 | TCA_GRED_PARMS, | 214 | TCA_GRED_PARMS, |
| 228 | TCA_GRED_STAB, | 215 | TCA_GRED_STAB, |
| @@ -232,8 +219,7 @@ enum | |||
| 232 | 219 | ||
| 233 | #define TCA_GRED_MAX (__TCA_GRED_MAX - 1) | 220 | #define TCA_GRED_MAX (__TCA_GRED_MAX - 1) |
| 234 | 221 | ||
| 235 | struct tc_gred_qopt | 222 | struct tc_gred_qopt { |
| 236 | { | ||
| 237 | __u32 limit; /* HARD maximal queue length (bytes) */ | 223 | __u32 limit; /* HARD maximal queue length (bytes) */ |
| 238 | __u32 qth_min; /* Min average length threshold (bytes) */ | 224 | __u32 qth_min; /* Min average length threshold (bytes) */ |
| 239 | __u32 qth_max; /* Max average length threshold (bytes) */ | 225 | __u32 qth_max; /* Max average length threshold (bytes) */ |
| @@ -253,8 +239,7 @@ struct tc_gred_qopt | |||
| 253 | }; | 239 | }; |
| 254 | 240 | ||
| 255 | /* gred setup */ | 241 | /* gred setup */ |
| 256 | struct tc_gred_sopt | 242 | struct tc_gred_sopt { |
| 257 | { | ||
| 258 | __u32 DPs; | 243 | __u32 DPs; |
| 259 | __u32 def_DP; | 244 | __u32 def_DP; |
| 260 | __u8 grio; | 245 | __u8 grio; |
| @@ -267,8 +252,7 @@ struct tc_gred_sopt | |||
| 267 | #define TC_HTB_MAXDEPTH 8 | 252 | #define TC_HTB_MAXDEPTH 8 |
| 268 | #define TC_HTB_PROTOVER 3 /* the same as HTB and TC's major */ | 253 | #define TC_HTB_PROTOVER 3 /* the same as HTB and TC's major */ |
| 269 | 254 | ||
| 270 | struct tc_htb_opt | 255 | struct tc_htb_opt { |
| 271 | { | ||
| 272 | struct tc_ratespec rate; | 256 | struct tc_ratespec rate; |
| 273 | struct tc_ratespec ceil; | 257 | struct tc_ratespec ceil; |
| 274 | __u32 buffer; | 258 | __u32 buffer; |
| @@ -277,8 +261,7 @@ struct tc_htb_opt | |||
| 277 | __u32 level; /* out only */ | 261 | __u32 level; /* out only */ |
| 278 | __u32 prio; | 262 | __u32 prio; |
| 279 | }; | 263 | }; |
| 280 | struct tc_htb_glob | 264 | struct tc_htb_glob { |
| 281 | { | ||
| 282 | __u32 version; /* to match HTB/TC */ | 265 | __u32 version; /* to match HTB/TC */ |
| 283 | __u32 rate2quantum; /* bps->quantum divisor */ | 266 | __u32 rate2quantum; /* bps->quantum divisor */ |
| 284 | __u32 defcls; /* default class number */ | 267 | __u32 defcls; /* default class number */ |
| @@ -287,8 +270,7 @@ struct tc_htb_glob | |||
| 287 | /* stats */ | 270 | /* stats */ |
| 288 | __u32 direct_pkts; /* count of non shapped packets */ | 271 | __u32 direct_pkts; /* count of non shapped packets */ |
| 289 | }; | 272 | }; |
| 290 | enum | 273 | enum { |
| 291 | { | ||
| 292 | TCA_HTB_UNSPEC, | 274 | TCA_HTB_UNSPEC, |
| 293 | TCA_HTB_PARMS, | 275 | TCA_HTB_PARMS, |
| 294 | TCA_HTB_INIT, | 276 | TCA_HTB_INIT, |
| @@ -299,8 +281,7 @@ enum | |||
| 299 | 281 | ||
| 300 | #define TCA_HTB_MAX (__TCA_HTB_MAX - 1) | 282 | #define TCA_HTB_MAX (__TCA_HTB_MAX - 1) |
| 301 | 283 | ||
| 302 | struct tc_htb_xstats | 284 | struct tc_htb_xstats { |
| 303 | { | ||
| 304 | __u32 lends; | 285 | __u32 lends; |
| 305 | __u32 borrows; | 286 | __u32 borrows; |
| 306 | __u32 giants; /* too big packets (rate will not be accurate) */ | 287 | __u32 giants; /* too big packets (rate will not be accurate) */ |
| @@ -310,28 +291,24 @@ struct tc_htb_xstats | |||
| 310 | 291 | ||
| 311 | /* HFSC section */ | 292 | /* HFSC section */ |
| 312 | 293 | ||
| 313 | struct tc_hfsc_qopt | 294 | struct tc_hfsc_qopt { |
| 314 | { | ||
| 315 | __u16 defcls; /* default class */ | 295 | __u16 defcls; /* default class */ |
| 316 | }; | 296 | }; |
| 317 | 297 | ||
| 318 | struct tc_service_curve | 298 | struct tc_service_curve { |
| 319 | { | ||
| 320 | __u32 m1; /* slope of the first segment in bps */ | 299 | __u32 m1; /* slope of the first segment in bps */ |
| 321 | __u32 d; /* x-projection of the first segment in us */ | 300 | __u32 d; /* x-projection of the first segment in us */ |
| 322 | __u32 m2; /* slope of the second segment in bps */ | 301 | __u32 m2; /* slope of the second segment in bps */ |
| 323 | }; | 302 | }; |
| 324 | 303 | ||
| 325 | struct tc_hfsc_stats | 304 | struct tc_hfsc_stats { |
| 326 | { | ||
| 327 | __u64 work; /* total work done */ | 305 | __u64 work; /* total work done */ |
| 328 | __u64 rtwork; /* work done by real-time criteria */ | 306 | __u64 rtwork; /* work done by real-time criteria */ |
| 329 | __u32 period; /* current period */ | 307 | __u32 period; /* current period */ |
| 330 | __u32 level; /* class level in hierarchy */ | 308 | __u32 level; /* class level in hierarchy */ |
| 331 | }; | 309 | }; |
| 332 | 310 | ||
| 333 | enum | 311 | enum { |
| 334 | { | ||
| 335 | TCA_HFSC_UNSPEC, | 312 | TCA_HFSC_UNSPEC, |
| 336 | TCA_HFSC_RSC, | 313 | TCA_HFSC_RSC, |
| 337 | TCA_HFSC_FSC, | 314 | TCA_HFSC_FSC, |
| @@ -348,8 +325,7 @@ enum | |||
| 348 | #define TC_CBQ_MAXLEVEL 8 | 325 | #define TC_CBQ_MAXLEVEL 8 |
| 349 | #define TC_CBQ_DEF_EWMA 5 | 326 | #define TC_CBQ_DEF_EWMA 5 |
| 350 | 327 | ||
| 351 | struct tc_cbq_lssopt | 328 | struct tc_cbq_lssopt { |
| 352 | { | ||
| 353 | unsigned char change; | 329 | unsigned char change; |
| 354 | unsigned char flags; | 330 | unsigned char flags; |
| 355 | #define TCF_CBQ_LSS_BOUNDED 1 | 331 | #define TCF_CBQ_LSS_BOUNDED 1 |
| @@ -368,8 +344,7 @@ struct tc_cbq_lssopt | |||
| 368 | __u32 avpkt; | 344 | __u32 avpkt; |
| 369 | }; | 345 | }; |
| 370 | 346 | ||
| 371 | struct tc_cbq_wrropt | 347 | struct tc_cbq_wrropt { |
| 372 | { | ||
| 373 | unsigned char flags; | 348 | unsigned char flags; |
| 374 | unsigned char priority; | 349 | unsigned char priority; |
| 375 | unsigned char cpriority; | 350 | unsigned char cpriority; |
| @@ -378,8 +353,7 @@ struct tc_cbq_wrropt | |||
| 378 | __u32 weight; | 353 | __u32 weight; |
| 379 | }; | 354 | }; |
| 380 | 355 | ||
| 381 | struct tc_cbq_ovl | 356 | struct tc_cbq_ovl { |
| 382 | { | ||
| 383 | unsigned char strategy; | 357 | unsigned char strategy; |
| 384 | #define TC_CBQ_OVL_CLASSIC 0 | 358 | #define TC_CBQ_OVL_CLASSIC 0 |
| 385 | #define TC_CBQ_OVL_DELAY 1 | 359 | #define TC_CBQ_OVL_DELAY 1 |
| @@ -391,30 +365,26 @@ struct tc_cbq_ovl | |||
| 391 | __u32 penalty; | 365 | __u32 penalty; |
| 392 | }; | 366 | }; |
| 393 | 367 | ||
| 394 | struct tc_cbq_police | 368 | struct tc_cbq_police { |
| 395 | { | ||
| 396 | unsigned char police; | 369 | unsigned char police; |
| 397 | unsigned char __res1; | 370 | unsigned char __res1; |
| 398 | unsigned short __res2; | 371 | unsigned short __res2; |
| 399 | }; | 372 | }; |
| 400 | 373 | ||
| 401 | struct tc_cbq_fopt | 374 | struct tc_cbq_fopt { |
| 402 | { | ||
| 403 | __u32 split; | 375 | __u32 split; |
| 404 | __u32 defmap; | 376 | __u32 defmap; |
| 405 | __u32 defchange; | 377 | __u32 defchange; |
| 406 | }; | 378 | }; |
| 407 | 379 | ||
| 408 | struct tc_cbq_xstats | 380 | struct tc_cbq_xstats { |
| 409 | { | ||
| 410 | __u32 borrows; | 381 | __u32 borrows; |
| 411 | __u32 overactions; | 382 | __u32 overactions; |
| 412 | __s32 avgidle; | 383 | __s32 avgidle; |
| 413 | __s32 undertime; | 384 | __s32 undertime; |
| 414 | }; | 385 | }; |
| 415 | 386 | ||
| 416 | enum | 387 | enum { |
| 417 | { | ||
| 418 | TCA_CBQ_UNSPEC, | 388 | TCA_CBQ_UNSPEC, |
| 419 | TCA_CBQ_LSSOPT, | 389 | TCA_CBQ_LSSOPT, |
| 420 | TCA_CBQ_WRROPT, | 390 | TCA_CBQ_WRROPT, |
| @@ -459,8 +429,7 @@ enum { | |||
| 459 | 429 | ||
| 460 | /* Network emulator */ | 430 | /* Network emulator */ |
| 461 | 431 | ||
| 462 | enum | 432 | enum { |
| 463 | { | ||
| 464 | TCA_NETEM_UNSPEC, | 433 | TCA_NETEM_UNSPEC, |
| 465 | TCA_NETEM_CORR, | 434 | TCA_NETEM_CORR, |
| 466 | TCA_NETEM_DELAY_DIST, | 435 | TCA_NETEM_DELAY_DIST, |
| @@ -471,8 +440,7 @@ enum | |||
| 471 | 440 | ||
| 472 | #define TCA_NETEM_MAX (__TCA_NETEM_MAX - 1) | 441 | #define TCA_NETEM_MAX (__TCA_NETEM_MAX - 1) |
| 473 | 442 | ||
| 474 | struct tc_netem_qopt | 443 | struct tc_netem_qopt { |
| 475 | { | ||
| 476 | __u32 latency; /* added delay (us) */ | 444 | __u32 latency; /* added delay (us) */ |
| 477 | __u32 limit; /* fifo limit (packets) */ | 445 | __u32 limit; /* fifo limit (packets) */ |
| 478 | __u32 loss; /* random packet loss (0=none ~0=100%) */ | 446 | __u32 loss; /* random packet loss (0=none ~0=100%) */ |
| @@ -481,21 +449,18 @@ struct tc_netem_qopt | |||
| 481 | __u32 jitter; /* random jitter in latency (us) */ | 449 | __u32 jitter; /* random jitter in latency (us) */ |
| 482 | }; | 450 | }; |
| 483 | 451 | ||
| 484 | struct tc_netem_corr | 452 | struct tc_netem_corr { |
| 485 | { | ||
| 486 | __u32 delay_corr; /* delay correlation */ | 453 | __u32 delay_corr; /* delay correlation */ |
| 487 | __u32 loss_corr; /* packet loss correlation */ | 454 | __u32 loss_corr; /* packet loss correlation */ |
| 488 | __u32 dup_corr; /* duplicate correlation */ | 455 | __u32 dup_corr; /* duplicate correlation */ |
| 489 | }; | 456 | }; |
| 490 | 457 | ||
| 491 | struct tc_netem_reorder | 458 | struct tc_netem_reorder { |
| 492 | { | ||
| 493 | __u32 probability; | 459 | __u32 probability; |
| 494 | __u32 correlation; | 460 | __u32 correlation; |
| 495 | }; | 461 | }; |
| 496 | 462 | ||
| 497 | struct tc_netem_corrupt | 463 | struct tc_netem_corrupt { |
| 498 | { | ||
| 499 | __u32 probability; | 464 | __u32 probability; |
| 500 | __u32 correlation; | 465 | __u32 correlation; |
| 501 | }; | 466 | }; |
| @@ -504,8 +469,7 @@ struct tc_netem_corrupt | |||
| 504 | 469 | ||
| 505 | /* DRR */ | 470 | /* DRR */ |
| 506 | 471 | ||
| 507 | enum | 472 | enum { |
| 508 | { | ||
| 509 | TCA_DRR_UNSPEC, | 473 | TCA_DRR_UNSPEC, |
| 510 | TCA_DRR_QUANTUM, | 474 | TCA_DRR_QUANTUM, |
| 511 | __TCA_DRR_MAX | 475 | __TCA_DRR_MAX |
| @@ -513,8 +477,7 @@ enum | |||
| 513 | 477 | ||
| 514 | #define TCA_DRR_MAX (__TCA_DRR_MAX - 1) | 478 | #define TCA_DRR_MAX (__TCA_DRR_MAX - 1) |
| 515 | 479 | ||
| 516 | struct tc_drr_stats | 480 | struct tc_drr_stats { |
| 517 | { | ||
| 518 | __u32 deficit; | 481 | __u32 deficit; |
| 519 | }; | 482 | }; |
| 520 | 483 | ||
diff --git a/include/linux/pktcdvd.h b/include/linux/pktcdvd.h index d745f5b6c7b0..721301b0a908 100644 --- a/include/linux/pktcdvd.h +++ b/include/linux/pktcdvd.h | |||
| @@ -30,7 +30,7 @@ | |||
| 30 | 30 | ||
| 31 | /* | 31 | /* |
| 32 | * use drive write caching -- we need deferred error handling to be | 32 | * use drive write caching -- we need deferred error handling to be |
| 33 | * able to sucessfully recover with this option (drive will return good | 33 | * able to successfully recover with this option (drive will return good |
| 34 | * status as soon as the cdb is validated). | 34 | * status as soon as the cdb is validated). |
| 35 | */ | 35 | */ |
| 36 | #if defined(CONFIG_CDROM_PKTCDVD_WCACHE) | 36 | #if defined(CONFIG_CDROM_PKTCDVD_WCACHE) |
| @@ -163,10 +163,8 @@ struct packet_iosched | |||
| 163 | atomic_t attention; /* Set to non-zero when queue processing is needed */ | 163 | atomic_t attention; /* Set to non-zero when queue processing is needed */ |
| 164 | int writing; /* Non-zero when writing, zero when reading */ | 164 | int writing; /* Non-zero when writing, zero when reading */ |
| 165 | spinlock_t lock; /* Protecting read/write queue manipulations */ | 165 | spinlock_t lock; /* Protecting read/write queue manipulations */ |
| 166 | struct bio *read_queue; | 166 | struct bio_list read_queue; |
| 167 | struct bio *read_queue_tail; | 167 | struct bio_list write_queue; |
| 168 | struct bio *write_queue; | ||
| 169 | struct bio *write_queue_tail; | ||
| 170 | sector_t last_write; /* The sector where the last write ended */ | 168 | sector_t last_write; /* The sector where the last write ended */ |
| 171 | int successive_reads; | 169 | int successive_reads; |
| 172 | }; | 170 | }; |
| @@ -206,8 +204,8 @@ struct packet_data | |||
| 206 | spinlock_t lock; /* Lock protecting state transitions and */ | 204 | spinlock_t lock; /* Lock protecting state transitions and */ |
| 207 | /* orig_bios list */ | 205 | /* orig_bios list */ |
| 208 | 206 | ||
| 209 | struct bio *orig_bios; /* Original bios passed to pkt_make_request */ | 207 | struct bio_list orig_bios; /* Original bios passed to pkt_make_request */ |
| 210 | struct bio *orig_bios_tail;/* that will be handled by this packet */ | 208 | /* that will be handled by this packet */ |
| 211 | int write_size; /* Total size of all bios in the orig_bios */ | 209 | int write_size; /* Total size of all bios in the orig_bios */ |
| 212 | /* list, measured in number of frames */ | 210 | /* list, measured in number of frames */ |
| 213 | 211 | ||
diff --git a/include/linux/platform_device.h b/include/linux/platform_device.h index 3c6675c2444b..212da17d06af 100644 --- a/include/linux/platform_device.h +++ b/include/linux/platform_device.h | |||
| @@ -21,7 +21,7 @@ struct platform_device { | |||
| 21 | u32 num_resources; | 21 | u32 num_resources; |
| 22 | struct resource * resource; | 22 | struct resource * resource; |
| 23 | 23 | ||
| 24 | struct platform_device_id *id_entry; | 24 | const struct platform_device_id *id_entry; |
| 25 | 25 | ||
| 26 | /* arch specific additions */ | 26 | /* arch specific additions */ |
| 27 | struct pdev_archdata archdata; | 27 | struct pdev_archdata archdata; |
| @@ -62,7 +62,7 @@ struct platform_driver { | |||
| 62 | int (*suspend)(struct platform_device *, pm_message_t state); | 62 | int (*suspend)(struct platform_device *, pm_message_t state); |
| 63 | int (*resume)(struct platform_device *); | 63 | int (*resume)(struct platform_device *); |
| 64 | struct device_driver driver; | 64 | struct device_driver driver; |
| 65 | struct platform_device_id *id_table; | 65 | const struct platform_device_id *id_table; |
| 66 | }; | 66 | }; |
| 67 | 67 | ||
| 68 | extern int platform_driver_register(struct platform_driver *); | 68 | extern int platform_driver_register(struct platform_driver *); |
| @@ -77,12 +77,19 @@ extern int platform_driver_probe(struct platform_driver *driver, | |||
| 77 | #define platform_get_drvdata(_dev) dev_get_drvdata(&(_dev)->dev) | 77 | #define platform_get_drvdata(_dev) dev_get_drvdata(&(_dev)->dev) |
| 78 | #define platform_set_drvdata(_dev,data) dev_set_drvdata(&(_dev)->dev, (data)) | 78 | #define platform_set_drvdata(_dev,data) dev_set_drvdata(&(_dev)->dev, (data)) |
| 79 | 79 | ||
| 80 | extern struct platform_device *platform_create_bundle(struct platform_driver *driver, | ||
| 81 | int (*probe)(struct platform_device *), | ||
| 82 | struct resource *res, unsigned int n_res, | ||
| 83 | const void *data, size_t size); | ||
| 84 | |||
| 80 | /* early platform driver interface */ | 85 | /* early platform driver interface */ |
| 81 | struct early_platform_driver { | 86 | struct early_platform_driver { |
| 82 | const char *class_str; | 87 | const char *class_str; |
| 83 | struct platform_driver *pdrv; | 88 | struct platform_driver *pdrv; |
| 84 | struct list_head list; | 89 | struct list_head list; |
| 85 | int requested_id; | 90 | int requested_id; |
| 91 | char *buffer; | ||
| 92 | int bufsize; | ||
| 86 | }; | 93 | }; |
| 87 | 94 | ||
| 88 | #define EARLY_PLATFORM_ID_UNSET -2 | 95 | #define EARLY_PLATFORM_ID_UNSET -2 |
| @@ -102,21 +109,29 @@ extern int early_platform_driver_probe(char *class_str, | |||
| 102 | int nr_probe, int user_only); | 109 | int nr_probe, int user_only); |
| 103 | extern void early_platform_cleanup(void); | 110 | extern void early_platform_cleanup(void); |
| 104 | 111 | ||
| 112 | #define early_platform_init(class_string, platdrv) \ | ||
| 113 | early_platform_init_buffer(class_string, platdrv, NULL, 0) | ||
| 105 | 114 | ||
| 106 | #ifndef MODULE | 115 | #ifndef MODULE |
| 107 | #define early_platform_init(class_string, platform_driver) \ | 116 | #define early_platform_init_buffer(class_string, platdrv, buf, bufsiz) \ |
| 108 | static __initdata struct early_platform_driver early_driver = { \ | 117 | static __initdata struct early_platform_driver early_driver = { \ |
| 109 | .class_str = class_string, \ | 118 | .class_str = class_string, \ |
| 110 | .pdrv = platform_driver, \ | 119 | .buffer = buf, \ |
| 120 | .bufsize = bufsiz, \ | ||
| 121 | .pdrv = platdrv, \ | ||
| 111 | .requested_id = EARLY_PLATFORM_ID_UNSET, \ | 122 | .requested_id = EARLY_PLATFORM_ID_UNSET, \ |
| 112 | }; \ | 123 | }; \ |
| 113 | static int __init early_platform_driver_setup_func(char *buf) \ | 124 | static int __init early_platform_driver_setup_func(char *buffer) \ |
| 114 | { \ | 125 | { \ |
| 115 | return early_platform_driver_register(&early_driver, buf); \ | 126 | return early_platform_driver_register(&early_driver, buffer); \ |
| 116 | } \ | 127 | } \ |
| 117 | early_param(class_string, early_platform_driver_setup_func) | 128 | early_param(class_string, early_platform_driver_setup_func) |
| 118 | #else /* MODULE */ | 129 | #else /* MODULE */ |
| 119 | #define early_platform_init(class_string, platform_driver) | 130 | #define early_platform_init_buffer(class_string, platdrv, buf, bufsiz) \ |
| 131 | static inline char *early_platform_driver_setup_func(void) \ | ||
| 132 | { \ | ||
| 133 | return bufsiz ? buf : NULL; \ | ||
| 134 | } | ||
| 120 | #endif /* MODULE */ | 135 | #endif /* MODULE */ |
| 121 | 136 | ||
| 122 | #endif /* _PLATFORM_DEVICE_H_ */ | 137 | #endif /* _PLATFORM_DEVICE_H_ */ |
diff --git a/include/linux/plist.h b/include/linux/plist.h index 45926d77d6ac..6898985e7b38 100644 --- a/include/linux/plist.h +++ b/include/linux/plist.h | |||
| @@ -45,7 +45,7 @@ | |||
| 45 | * the insertion of new nodes. There are no nodes with duplicate | 45 | * the insertion of new nodes. There are no nodes with duplicate |
| 46 | * priorites on the list. | 46 | * priorites on the list. |
| 47 | * | 47 | * |
| 48 | * The nodes on the node_list is ordered by priority and can contain | 48 | * The nodes on the node_list are ordered by priority and can contain |
| 49 | * entries which have the same priority. Those entries are ordered | 49 | * entries which have the same priority. Those entries are ordered |
| 50 | * FIFO | 50 | * FIFO |
| 51 | * | 51 | * |
| @@ -81,7 +81,8 @@ struct plist_head { | |||
| 81 | struct list_head prio_list; | 81 | struct list_head prio_list; |
| 82 | struct list_head node_list; | 82 | struct list_head node_list; |
| 83 | #ifdef CONFIG_DEBUG_PI_LIST | 83 | #ifdef CONFIG_DEBUG_PI_LIST |
| 84 | spinlock_t *lock; | 84 | raw_spinlock_t *rawlock; |
| 85 | spinlock_t *spinlock; | ||
| 85 | #endif | 86 | #endif |
| 86 | }; | 87 | }; |
| 87 | 88 | ||
| @@ -91,9 +92,11 @@ struct plist_node { | |||
| 91 | }; | 92 | }; |
| 92 | 93 | ||
| 93 | #ifdef CONFIG_DEBUG_PI_LIST | 94 | #ifdef CONFIG_DEBUG_PI_LIST |
| 94 | # define PLIST_HEAD_LOCK_INIT(_lock) .lock = _lock | 95 | # define PLIST_HEAD_LOCK_INIT(_lock) .spinlock = _lock |
| 96 | # define PLIST_HEAD_LOCK_INIT_RAW(_lock) .rawlock = _lock | ||
| 95 | #else | 97 | #else |
| 96 | # define PLIST_HEAD_LOCK_INIT(_lock) | 98 | # define PLIST_HEAD_LOCK_INIT(_lock) |
| 99 | # define PLIST_HEAD_LOCK_INIT_RAW(_lock) | ||
| 97 | #endif | 100 | #endif |
| 98 | 101 | ||
| 99 | #define _PLIST_HEAD_INIT(head) \ | 102 | #define _PLIST_HEAD_INIT(head) \ |
| @@ -107,11 +110,22 @@ struct plist_node { | |||
| 107 | */ | 110 | */ |
| 108 | #define PLIST_HEAD_INIT(head, _lock) \ | 111 | #define PLIST_HEAD_INIT(head, _lock) \ |
| 109 | { \ | 112 | { \ |
| 110 | _PLIST_HEAD_INIT(head), \ | 113 | _PLIST_HEAD_INIT(head), \ |
| 111 | PLIST_HEAD_LOCK_INIT(&(_lock)) \ | 114 | PLIST_HEAD_LOCK_INIT(&(_lock)) \ |
| 112 | } | 115 | } |
| 113 | 116 | ||
| 114 | /** | 117 | /** |
| 118 | * PLIST_HEAD_INIT_RAW - static struct plist_head initializer | ||
| 119 | * @head: struct plist_head variable name | ||
| 120 | * @_lock: lock to initialize for this list | ||
| 121 | */ | ||
| 122 | #define PLIST_HEAD_INIT_RAW(head, _lock) \ | ||
| 123 | { \ | ||
| 124 | _PLIST_HEAD_INIT(head), \ | ||
| 125 | PLIST_HEAD_LOCK_INIT_RAW(&(_lock)) \ | ||
| 126 | } | ||
| 127 | |||
| 128 | /** | ||
| 115 | * PLIST_NODE_INIT - static struct plist_node initializer | 129 | * PLIST_NODE_INIT - static struct plist_node initializer |
| 116 | * @node: struct plist_node variable name | 130 | * @node: struct plist_node variable name |
| 117 | * @__prio: initial node priority | 131 | * @__prio: initial node priority |
| @@ -119,13 +133,13 @@ struct plist_node { | |||
| 119 | #define PLIST_NODE_INIT(node, __prio) \ | 133 | #define PLIST_NODE_INIT(node, __prio) \ |
| 120 | { \ | 134 | { \ |
| 121 | .prio = (__prio), \ | 135 | .prio = (__prio), \ |
| 122 | .plist = { _PLIST_HEAD_INIT((node).plist) }, \ | 136 | .plist = { _PLIST_HEAD_INIT((node).plist) }, \ |
| 123 | } | 137 | } |
| 124 | 138 | ||
| 125 | /** | 139 | /** |
| 126 | * plist_head_init - dynamic struct plist_head initializer | 140 | * plist_head_init - dynamic struct plist_head initializer |
| 127 | * @head: &struct plist_head pointer | 141 | * @head: &struct plist_head pointer |
| 128 | * @lock: list spinlock, remembered for debugging | 142 | * @lock: spinlock protecting the list (debugging) |
| 129 | */ | 143 | */ |
| 130 | static inline void | 144 | static inline void |
| 131 | plist_head_init(struct plist_head *head, spinlock_t *lock) | 145 | plist_head_init(struct plist_head *head, spinlock_t *lock) |
| @@ -133,7 +147,24 @@ plist_head_init(struct plist_head *head, spinlock_t *lock) | |||
| 133 | INIT_LIST_HEAD(&head->prio_list); | 147 | INIT_LIST_HEAD(&head->prio_list); |
| 134 | INIT_LIST_HEAD(&head->node_list); | 148 | INIT_LIST_HEAD(&head->node_list); |
| 135 | #ifdef CONFIG_DEBUG_PI_LIST | 149 | #ifdef CONFIG_DEBUG_PI_LIST |
| 136 | head->lock = lock; | 150 | head->spinlock = lock; |
| 151 | head->rawlock = NULL; | ||
| 152 | #endif | ||
| 153 | } | ||
| 154 | |||
| 155 | /** | ||
| 156 | * plist_head_init_raw - dynamic struct plist_head initializer | ||
| 157 | * @head: &struct plist_head pointer | ||
| 158 | * @lock: raw_spinlock protecting the list (debugging) | ||
| 159 | */ | ||
| 160 | static inline void | ||
| 161 | plist_head_init_raw(struct plist_head *head, raw_spinlock_t *lock) | ||
| 162 | { | ||
| 163 | INIT_LIST_HEAD(&head->prio_list); | ||
| 164 | INIT_LIST_HEAD(&head->node_list); | ||
| 165 | #ifdef CONFIG_DEBUG_PI_LIST | ||
| 166 | head->rawlock = lock; | ||
| 167 | head->spinlock = NULL; | ||
| 137 | #endif | 168 | #endif |
| 138 | } | 169 | } |
| 139 | 170 | ||
| @@ -234,7 +265,7 @@ static inline int plist_node_empty(const struct plist_node *node) | |||
| 234 | * | 265 | * |
| 235 | * Assumes the plist is _not_ empty. | 266 | * Assumes the plist is _not_ empty. |
| 236 | */ | 267 | */ |
| 237 | static inline struct plist_node* plist_first(const struct plist_head *head) | 268 | static inline struct plist_node *plist_first(const struct plist_head *head) |
| 238 | { | 269 | { |
| 239 | return list_entry(head->node_list.next, | 270 | return list_entry(head->node_list.next, |
| 240 | struct plist_node, plist.node_list); | 271 | struct plist_node, plist.node_list); |
diff --git a/include/linux/pm.h b/include/linux/pm.h index 3b7e04b95bd2..8e258c727971 100644 --- a/include/linux/pm.h +++ b/include/linux/pm.h | |||
| @@ -26,6 +26,7 @@ | |||
| 26 | #include <linux/spinlock.h> | 26 | #include <linux/spinlock.h> |
| 27 | #include <linux/wait.h> | 27 | #include <linux/wait.h> |
| 28 | #include <linux/timer.h> | 28 | #include <linux/timer.h> |
| 29 | #include <linux/completion.h> | ||
| 29 | 30 | ||
| 30 | /* | 31 | /* |
| 31 | * Callbacks for platform drivers to implement. | 32 | * Callbacks for platform drivers to implement. |
| @@ -178,9 +179,10 @@ typedef struct pm_message { | |||
| 178 | * This need not mean that the device should be put into a low power state. | 179 | * This need not mean that the device should be put into a low power state. |
| 179 | * For example, if the device is behind a link which is about to be turned | 180 | * For example, if the device is behind a link which is about to be turned |
| 180 | * off, the device may remain at full power. If the device does go to low | 181 | * off, the device may remain at full power. If the device does go to low |
| 181 | * power and if device_may_wakeup(dev) is true, remote wake-up (i.e., a | 182 | * power and is capable of generating run-time wake-up events, remote |
| 182 | * hardware mechanism allowing the device to request a change of its power | 183 | * wake-up (i.e., a hardware mechanism allowing the device to request a |
| 183 | * state, such as PCI PME) should be enabled for it. | 184 | * change of its power state via a wake-up event, such as PCI PME) should |
| 185 | * be enabled for it. | ||
| 184 | * | 186 | * |
| 185 | * @runtime_resume: Put the device into the fully active state in response to a | 187 | * @runtime_resume: Put the device into the fully active state in response to a |
| 186 | * wake-up event generated by hardware or at the request of software. If | 188 | * wake-up event generated by hardware or at the request of software. If |
| @@ -213,20 +215,59 @@ struct dev_pm_ops { | |||
| 213 | int (*runtime_idle)(struct device *dev); | 215 | int (*runtime_idle)(struct device *dev); |
| 214 | }; | 216 | }; |
| 215 | 217 | ||
| 216 | /* | 218 | #ifdef CONFIG_PM_SLEEP |
| 217 | * Use this if you want to use the same suspend and resume callbacks for suspend | 219 | #define SET_SYSTEM_SLEEP_PM_OPS(suspend_fn, resume_fn) \ |
| 218 | * to RAM and hibernation. | ||
| 219 | */ | ||
| 220 | #define SIMPLE_DEV_PM_OPS(name, suspend_fn, resume_fn) \ | ||
| 221 | struct dev_pm_ops name = { \ | ||
| 222 | .suspend = suspend_fn, \ | 220 | .suspend = suspend_fn, \ |
| 223 | .resume = resume_fn, \ | 221 | .resume = resume_fn, \ |
| 224 | .freeze = suspend_fn, \ | 222 | .freeze = suspend_fn, \ |
| 225 | .thaw = resume_fn, \ | 223 | .thaw = resume_fn, \ |
| 226 | .poweroff = suspend_fn, \ | 224 | .poweroff = suspend_fn, \ |
| 227 | .restore = resume_fn, \ | 225 | .restore = resume_fn, |
| 226 | #else | ||
| 227 | #define SET_SYSTEM_SLEEP_PM_OPS(suspend_fn, resume_fn) | ||
| 228 | #endif | ||
| 229 | |||
| 230 | #ifdef CONFIG_PM_RUNTIME | ||
| 231 | #define SET_RUNTIME_PM_OPS(suspend_fn, resume_fn, idle_fn) \ | ||
| 232 | .runtime_suspend = suspend_fn, \ | ||
| 233 | .runtime_resume = resume_fn, \ | ||
| 234 | .runtime_idle = idle_fn, | ||
| 235 | #else | ||
| 236 | #define SET_RUNTIME_PM_OPS(suspend_fn, resume_fn, idle_fn) | ||
| 237 | #endif | ||
| 238 | |||
| 239 | /* | ||
| 240 | * Use this if you want to use the same suspend and resume callbacks for suspend | ||
| 241 | * to RAM and hibernation. | ||
| 242 | */ | ||
| 243 | #define SIMPLE_DEV_PM_OPS(name, suspend_fn, resume_fn) \ | ||
| 244 | const struct dev_pm_ops name = { \ | ||
| 245 | SET_SYSTEM_SLEEP_PM_OPS(suspend_fn, resume_fn) \ | ||
| 246 | } | ||
| 247 | |||
| 248 | /* | ||
| 249 | * Use this for defining a set of PM operations to be used in all situations | ||
| 250 | * (sustem suspend, hibernation or runtime PM). | ||
| 251 | */ | ||
| 252 | #define UNIVERSAL_DEV_PM_OPS(name, suspend_fn, resume_fn, idle_fn) \ | ||
| 253 | const struct dev_pm_ops name = { \ | ||
| 254 | SET_SYSTEM_SLEEP_PM_OPS(suspend_fn, resume_fn) \ | ||
| 255 | SET_RUNTIME_PM_OPS(suspend_fn, resume_fn, idle_fn) \ | ||
| 228 | } | 256 | } |
| 229 | 257 | ||
| 258 | /* | ||
| 259 | * Use this for subsystems (bus types, device types, device classes) that don't | ||
| 260 | * need any special suspend/resume handling in addition to invoking the PM | ||
| 261 | * callbacks provided by device drivers supporting both the system sleep PM and | ||
| 262 | * runtime PM, make the pm member point to generic_subsys_pm_ops. | ||
| 263 | */ | ||
| 264 | #ifdef CONFIG_PM_OPS | ||
| 265 | extern struct dev_pm_ops generic_subsys_pm_ops; | ||
| 266 | #define GENERIC_SUBSYS_PM_OPS (&generic_subsys_pm_ops) | ||
| 267 | #else | ||
| 268 | #define GENERIC_SUBSYS_PM_OPS NULL | ||
| 269 | #endif | ||
| 270 | |||
| 230 | /** | 271 | /** |
| 231 | * PM_EVENT_ messages | 272 | * PM_EVENT_ messages |
| 232 | * | 273 | * |
| @@ -411,9 +452,11 @@ struct dev_pm_info { | |||
| 411 | pm_message_t power_state; | 452 | pm_message_t power_state; |
| 412 | unsigned int can_wakeup:1; | 453 | unsigned int can_wakeup:1; |
| 413 | unsigned int should_wakeup:1; | 454 | unsigned int should_wakeup:1; |
| 455 | unsigned async_suspend:1; | ||
| 414 | enum dpm_state status; /* Owned by the PM core */ | 456 | enum dpm_state status; /* Owned by the PM core */ |
| 415 | #ifdef CONFIG_PM_SLEEP | 457 | #ifdef CONFIG_PM_SLEEP |
| 416 | struct list_head entry; | 458 | struct list_head entry; |
| 459 | struct completion completion; | ||
| 417 | #endif | 460 | #endif |
| 418 | #ifdef CONFIG_PM_RUNTIME | 461 | #ifdef CONFIG_PM_RUNTIME |
| 419 | struct timer_list suspend_timer; | 462 | struct timer_list suspend_timer; |
| @@ -428,6 +471,8 @@ struct dev_pm_info { | |||
| 428 | unsigned int idle_notification:1; | 471 | unsigned int idle_notification:1; |
| 429 | unsigned int request_pending:1; | 472 | unsigned int request_pending:1; |
| 430 | unsigned int deferred_resume:1; | 473 | unsigned int deferred_resume:1; |
| 474 | unsigned int run_wake:1; | ||
| 475 | unsigned int runtime_auto:1; | ||
| 431 | enum rpm_request request; | 476 | enum rpm_request request; |
| 432 | enum rpm_status runtime_status; | 477 | enum rpm_status runtime_status; |
| 433 | int runtime_error; | 478 | int runtime_error; |
| @@ -506,6 +551,7 @@ extern void __suspend_report_result(const char *function, void *fn, int ret); | |||
| 506 | __suspend_report_result(__func__, fn, ret); \ | 551 | __suspend_report_result(__func__, fn, ret); \ |
| 507 | } while (0) | 552 | } while (0) |
| 508 | 553 | ||
| 554 | extern void device_pm_wait_for_dev(struct device *sub, struct device *dev); | ||
| 509 | #else /* !CONFIG_PM_SLEEP */ | 555 | #else /* !CONFIG_PM_SLEEP */ |
| 510 | 556 | ||
| 511 | #define device_pm_lock() do {} while (0) | 557 | #define device_pm_lock() do {} while (0) |
| @@ -518,6 +564,7 @@ static inline int dpm_suspend_start(pm_message_t state) | |||
| 518 | 564 | ||
| 519 | #define suspend_report_result(fn, ret) do {} while (0) | 565 | #define suspend_report_result(fn, ret) do {} while (0) |
| 520 | 566 | ||
| 567 | static inline void device_pm_wait_for_dev(struct device *a, struct device *b) {} | ||
| 521 | #endif /* !CONFIG_PM_SLEEP */ | 568 | #endif /* !CONFIG_PM_SLEEP */ |
| 522 | 569 | ||
| 523 | /* How to reorder dpm_list after device_move() */ | 570 | /* How to reorder dpm_list after device_move() */ |
diff --git a/include/linux/pm_runtime.h b/include/linux/pm_runtime.h index 44087044910f..b776db737244 100644 --- a/include/linux/pm_runtime.h +++ b/include/linux/pm_runtime.h | |||
| @@ -28,6 +28,8 @@ extern int __pm_runtime_set_status(struct device *dev, unsigned int status); | |||
| 28 | extern int pm_runtime_barrier(struct device *dev); | 28 | extern int pm_runtime_barrier(struct device *dev); |
| 29 | extern void pm_runtime_enable(struct device *dev); | 29 | extern void pm_runtime_enable(struct device *dev); |
| 30 | extern void __pm_runtime_disable(struct device *dev, bool check_resume); | 30 | extern void __pm_runtime_disable(struct device *dev, bool check_resume); |
| 31 | extern void pm_runtime_allow(struct device *dev); | ||
| 32 | extern void pm_runtime_forbid(struct device *dev); | ||
| 31 | 33 | ||
| 32 | static inline bool pm_children_suspended(struct device *dev) | 34 | static inline bool pm_children_suspended(struct device *dev) |
| 33 | { | 35 | { |
| @@ -50,6 +52,21 @@ static inline void pm_runtime_put_noidle(struct device *dev) | |||
| 50 | atomic_add_unless(&dev->power.usage_count, -1, 0); | 52 | atomic_add_unless(&dev->power.usage_count, -1, 0); |
| 51 | } | 53 | } |
| 52 | 54 | ||
| 55 | static inline bool device_run_wake(struct device *dev) | ||
| 56 | { | ||
| 57 | return dev->power.run_wake; | ||
| 58 | } | ||
| 59 | |||
| 60 | static inline void device_set_run_wake(struct device *dev, bool enable) | ||
| 61 | { | ||
| 62 | dev->power.run_wake = enable; | ||
| 63 | } | ||
| 64 | |||
| 65 | static inline bool pm_runtime_suspended(struct device *dev) | ||
| 66 | { | ||
| 67 | return dev->power.runtime_status == RPM_SUSPENDED; | ||
| 68 | } | ||
| 69 | |||
| 53 | #else /* !CONFIG_PM_RUNTIME */ | 70 | #else /* !CONFIG_PM_RUNTIME */ |
| 54 | 71 | ||
| 55 | static inline int pm_runtime_idle(struct device *dev) { return -ENOSYS; } | 72 | static inline int pm_runtime_idle(struct device *dev) { return -ENOSYS; } |
| @@ -68,11 +85,16 @@ static inline int __pm_runtime_set_status(struct device *dev, | |||
| 68 | static inline int pm_runtime_barrier(struct device *dev) { return 0; } | 85 | static inline int pm_runtime_barrier(struct device *dev) { return 0; } |
| 69 | static inline void pm_runtime_enable(struct device *dev) {} | 86 | static inline void pm_runtime_enable(struct device *dev) {} |
| 70 | static inline void __pm_runtime_disable(struct device *dev, bool c) {} | 87 | static inline void __pm_runtime_disable(struct device *dev, bool c) {} |
| 88 | static inline void pm_runtime_allow(struct device *dev) {} | ||
| 89 | static inline void pm_runtime_forbid(struct device *dev) {} | ||
| 71 | 90 | ||
| 72 | static inline bool pm_children_suspended(struct device *dev) { return false; } | 91 | static inline bool pm_children_suspended(struct device *dev) { return false; } |
| 73 | static inline void pm_suspend_ignore_children(struct device *dev, bool en) {} | 92 | static inline void pm_suspend_ignore_children(struct device *dev, bool en) {} |
| 74 | static inline void pm_runtime_get_noresume(struct device *dev) {} | 93 | static inline void pm_runtime_get_noresume(struct device *dev) {} |
| 75 | static inline void pm_runtime_put_noidle(struct device *dev) {} | 94 | static inline void pm_runtime_put_noidle(struct device *dev) {} |
| 95 | static inline bool device_run_wake(struct device *dev) { return false; } | ||
| 96 | static inline void device_set_run_wake(struct device *dev, bool enable) {} | ||
| 97 | static inline bool pm_runtime_suspended(struct device *dev) { return false; } | ||
| 76 | 98 | ||
| 77 | #endif /* !CONFIG_PM_RUNTIME */ | 99 | #endif /* !CONFIG_PM_RUNTIME */ |
| 78 | 100 | ||
diff --git a/include/linux/pnp.h b/include/linux/pnp.h index fddfafaed024..7c4193eb0072 100644 --- a/include/linux/pnp.h +++ b/include/linux/pnp.h | |||
| @@ -334,6 +334,19 @@ extern struct pnp_protocol pnpbios_protocol; | |||
| 334 | #define pnp_device_is_pnpbios(dev) 0 | 334 | #define pnp_device_is_pnpbios(dev) 0 |
| 335 | #endif | 335 | #endif |
| 336 | 336 | ||
| 337 | #ifdef CONFIG_PNPACPI | ||
| 338 | extern struct pnp_protocol pnpacpi_protocol; | ||
| 339 | |||
| 340 | static inline struct acpi_device *pnp_acpi_device(struct pnp_dev *dev) | ||
| 341 | { | ||
| 342 | if (dev->protocol == &pnpacpi_protocol) | ||
| 343 | return dev->data; | ||
| 344 | return NULL; | ||
| 345 | } | ||
| 346 | #else | ||
| 347 | #define pnp_acpi_device(dev) 0 | ||
| 348 | #endif | ||
| 349 | |||
| 337 | /* status */ | 350 | /* status */ |
| 338 | #define PNP_READY 0x0000 | 351 | #define PNP_READY 0x0000 |
| 339 | #define PNP_ATTACHED 0x0001 | 352 | #define PNP_ATTACHED 0x0001 |
diff --git a/include/linux/poison.h b/include/linux/poison.h index 7fc194aef8c2..34066ffd893d 100644 --- a/include/linux/poison.h +++ b/include/linux/poison.h | |||
| @@ -2,13 +2,25 @@ | |||
| 2 | #define _LINUX_POISON_H | 2 | #define _LINUX_POISON_H |
| 3 | 3 | ||
| 4 | /********** include/linux/list.h **********/ | 4 | /********** include/linux/list.h **********/ |
| 5 | |||
| 6 | /* | ||
| 7 | * Architectures might want to move the poison pointer offset | ||
| 8 | * into some well-recognized area such as 0xdead000000000000, | ||
| 9 | * that is also not mappable by user-space exploits: | ||
| 10 | */ | ||
| 11 | #ifdef CONFIG_ILLEGAL_POINTER_VALUE | ||
| 12 | # define POISON_POINTER_DELTA _AC(CONFIG_ILLEGAL_POINTER_VALUE, UL) | ||
| 13 | #else | ||
| 14 | # define POISON_POINTER_DELTA 0 | ||
| 15 | #endif | ||
| 16 | |||
| 5 | /* | 17 | /* |
| 6 | * These are non-NULL pointers that will result in page faults | 18 | * These are non-NULL pointers that will result in page faults |
| 7 | * under normal circumstances, used to verify that nobody uses | 19 | * under normal circumstances, used to verify that nobody uses |
| 8 | * non-initialized list entries. | 20 | * non-initialized list entries. |
| 9 | */ | 21 | */ |
| 10 | #define LIST_POISON1 ((void *) 0x00100100) | 22 | #define LIST_POISON1 ((void *) 0x00100100 + POISON_POINTER_DELTA) |
| 11 | #define LIST_POISON2 ((void *) 0x00200200) | 23 | #define LIST_POISON2 ((void *) 0x00200200 + POISON_POINTER_DELTA) |
| 12 | 24 | ||
| 13 | /********** include/linux/timer.h **********/ | 25 | /********** include/linux/timer.h **********/ |
| 14 | /* | 26 | /* |
| @@ -36,6 +48,15 @@ | |||
| 36 | #define POISON_FREE 0x6b /* for use-after-free poisoning */ | 48 | #define POISON_FREE 0x6b /* for use-after-free poisoning */ |
| 37 | #define POISON_END 0xa5 /* end-byte of poisoning */ | 49 | #define POISON_END 0xa5 /* end-byte of poisoning */ |
| 38 | 50 | ||
| 51 | /********** mm/hugetlb.c **********/ | ||
| 52 | /* | ||
| 53 | * Private mappings of hugetlb pages use this poisoned value for | ||
| 54 | * page->mapping. The core VM should not be doing anything with this mapping | ||
| 55 | * but futex requires the existence of some page->mapping value even though it | ||
| 56 | * is unused if PAGE_MAPPING_ANON is set. | ||
| 57 | */ | ||
| 58 | #define HUGETLB_POISON ((void *)(0x00300300 + POISON_POINTER_DELTA + PAGE_MAPPING_ANON)) | ||
| 59 | |||
| 39 | /********** arch/$ARCH/mm/init.c **********/ | 60 | /********** arch/$ARCH/mm/init.c **********/ |
| 40 | #define POISON_FREE_INITMEM 0xcc | 61 | #define POISON_FREE_INITMEM 0xcc |
| 41 | 62 | ||
diff --git a/include/linux/poll.h b/include/linux/poll.h index 6673743946f7..600cc1fde64d 100644 --- a/include/linux/poll.h +++ b/include/linux/poll.h | |||
| @@ -10,8 +10,10 @@ | |||
| 10 | #include <linux/wait.h> | 10 | #include <linux/wait.h> |
| 11 | #include <linux/string.h> | 11 | #include <linux/string.h> |
| 12 | #include <linux/fs.h> | 12 | #include <linux/fs.h> |
| 13 | #include <linux/sysctl.h> | ||
| 13 | #include <asm/uaccess.h> | 14 | #include <asm/uaccess.h> |
| 14 | 15 | ||
| 16 | extern struct ctl_table epoll_table[]; /* for sysctl */ | ||
| 15 | /* ~832 bytes of stack space used max in sys_select/sys_poll before allocating | 17 | /* ~832 bytes of stack space used max in sys_select/sys_poll before allocating |
| 16 | additional memory. */ | 18 | additional memory. */ |
| 17 | #define MAX_STACK_ALLOC 832 | 19 | #define MAX_STACK_ALLOC 832 |
diff --git a/include/linux/posix_acl.h b/include/linux/posix_acl.h index 065a3652a3ea..67608161df6b 100644 --- a/include/linux/posix_acl.h +++ b/include/linux/posix_acl.h | |||
| @@ -147,6 +147,20 @@ static inline void forget_cached_acl(struct inode *inode, int type) | |||
| 147 | if (old != ACL_NOT_CACHED) | 147 | if (old != ACL_NOT_CACHED) |
| 148 | posix_acl_release(old); | 148 | posix_acl_release(old); |
| 149 | } | 149 | } |
| 150 | |||
| 151 | static inline void forget_all_cached_acls(struct inode *inode) | ||
| 152 | { | ||
| 153 | struct posix_acl *old_access, *old_default; | ||
| 154 | spin_lock(&inode->i_lock); | ||
| 155 | old_access = inode->i_acl; | ||
| 156 | old_default = inode->i_default_acl; | ||
| 157 | inode->i_acl = inode->i_default_acl = ACL_NOT_CACHED; | ||
| 158 | spin_unlock(&inode->i_lock); | ||
| 159 | if (old_access != ACL_NOT_CACHED) | ||
| 160 | posix_acl_release(old_access); | ||
| 161 | if (old_default != ACL_NOT_CACHED) | ||
| 162 | posix_acl_release(old_default); | ||
| 163 | } | ||
| 150 | #endif | 164 | #endif |
| 151 | 165 | ||
| 152 | static inline void cache_no_acl(struct inode *inode) | 166 | static inline void cache_no_acl(struct inode *inode) |
diff --git a/include/linux/power_supply.h b/include/linux/power_supply.h index b5d096d3a9be..ebd2b8fb00d0 100644 --- a/include/linux/power_supply.h +++ b/include/linux/power_supply.h | |||
| @@ -82,6 +82,7 @@ enum power_supply_property { | |||
| 82 | POWER_SUPPLY_PROP_PRESENT, | 82 | POWER_SUPPLY_PROP_PRESENT, |
| 83 | POWER_SUPPLY_PROP_ONLINE, | 83 | POWER_SUPPLY_PROP_ONLINE, |
| 84 | POWER_SUPPLY_PROP_TECHNOLOGY, | 84 | POWER_SUPPLY_PROP_TECHNOLOGY, |
| 85 | POWER_SUPPLY_PROP_CYCLE_COUNT, | ||
| 85 | POWER_SUPPLY_PROP_VOLTAGE_MAX, | 86 | POWER_SUPPLY_PROP_VOLTAGE_MAX, |
| 86 | POWER_SUPPLY_PROP_VOLTAGE_MIN, | 87 | POWER_SUPPLY_PROP_VOLTAGE_MIN, |
| 87 | POWER_SUPPLY_PROP_VOLTAGE_MAX_DESIGN, | 88 | POWER_SUPPLY_PROP_VOLTAGE_MAX_DESIGN, |
diff --git a/include/linux/preempt.h b/include/linux/preempt.h index 72b1a10a59b6..2e681d9555bd 100644 --- a/include/linux/preempt.h +++ b/include/linux/preempt.h | |||
| @@ -105,6 +105,11 @@ struct preempt_notifier; | |||
| 105 | * @sched_out: we've just been preempted | 105 | * @sched_out: we've just been preempted |
| 106 | * notifier: struct preempt_notifier for the task being preempted | 106 | * notifier: struct preempt_notifier for the task being preempted |
| 107 | * next: the task that's kicking us out | 107 | * next: the task that's kicking us out |
| 108 | * | ||
| 109 | * Please note that sched_in and out are called under different | ||
| 110 | * contexts. sched_out is called with rq lock held and irq disabled | ||
| 111 | * while sched_in is called without rq lock and irq enabled. This | ||
| 112 | * difference is intentional and depended upon by its users. | ||
| 108 | */ | 113 | */ |
| 109 | struct preempt_ops { | 114 | struct preempt_ops { |
| 110 | void (*sched_in)(struct preempt_notifier *notifier, int cpu); | 115 | void (*sched_in)(struct preempt_notifier *notifier, int cpu); |
diff --git a/include/linux/ptrace.h b/include/linux/ptrace.h index 7456d7d87a19..e1fb60729979 100644 --- a/include/linux/ptrace.h +++ b/include/linux/ptrace.h | |||
| @@ -27,6 +27,26 @@ | |||
| 27 | #define PTRACE_GETSIGINFO 0x4202 | 27 | #define PTRACE_GETSIGINFO 0x4202 |
| 28 | #define PTRACE_SETSIGINFO 0x4203 | 28 | #define PTRACE_SETSIGINFO 0x4203 |
| 29 | 29 | ||
| 30 | /* | ||
| 31 | * Generic ptrace interface that exports the architecture specific regsets | ||
| 32 | * using the corresponding NT_* types (which are also used in the core dump). | ||
| 33 | * Please note that the NT_PRSTATUS note type in a core dump contains a full | ||
| 34 | * 'struct elf_prstatus'. But the user_regset for NT_PRSTATUS contains just the | ||
| 35 | * elf_gregset_t that is the pr_reg field of 'struct elf_prstatus'. For all the | ||
| 36 | * other user_regset flavors, the user_regset layout and the ELF core dump note | ||
| 37 | * payload are exactly the same layout. | ||
| 38 | * | ||
| 39 | * This interface usage is as follows: | ||
| 40 | * struct iovec iov = { buf, len}; | ||
| 41 | * | ||
| 42 | * ret = ptrace(PTRACE_GETREGSET/PTRACE_SETREGSET, pid, NT_XXX_TYPE, &iov); | ||
| 43 | * | ||
| 44 | * On the successful completion, iov.len will be updated by the kernel, | ||
| 45 | * specifying how much the kernel has written/read to/from the user's iov.buf. | ||
| 46 | */ | ||
| 47 | #define PTRACE_GETREGSET 0x4204 | ||
| 48 | #define PTRACE_SETREGSET 0x4205 | ||
| 49 | |||
| 30 | /* options set using PTRACE_SETOPTIONS */ | 50 | /* options set using PTRACE_SETOPTIONS */ |
| 31 | #define PTRACE_O_TRACESYSGOOD 0x00000001 | 51 | #define PTRACE_O_TRACESYSGOOD 0x00000001 |
| 32 | #define PTRACE_O_TRACEFORK 0x00000002 | 52 | #define PTRACE_O_TRACEFORK 0x00000002 |
| @@ -105,12 +125,7 @@ static inline int ptrace_reparented(struct task_struct *child) | |||
| 105 | { | 125 | { |
| 106 | return child->real_parent != child->parent; | 126 | return child->real_parent != child->parent; |
| 107 | } | 127 | } |
| 108 | static inline void ptrace_link(struct task_struct *child, | 128 | |
| 109 | struct task_struct *new_parent) | ||
| 110 | { | ||
| 111 | if (unlikely(child->ptrace)) | ||
| 112 | __ptrace_link(child, new_parent); | ||
| 113 | } | ||
| 114 | static inline void ptrace_unlink(struct task_struct *child) | 129 | static inline void ptrace_unlink(struct task_struct *child) |
| 115 | { | 130 | { |
| 116 | if (unlikely(child->ptrace)) | 131 | if (unlikely(child->ptrace)) |
| @@ -169,9 +184,9 @@ static inline void ptrace_init_task(struct task_struct *child, bool ptrace) | |||
| 169 | INIT_LIST_HEAD(&child->ptraced); | 184 | INIT_LIST_HEAD(&child->ptraced); |
| 170 | child->parent = child->real_parent; | 185 | child->parent = child->real_parent; |
| 171 | child->ptrace = 0; | 186 | child->ptrace = 0; |
| 172 | if (unlikely(ptrace)) { | 187 | if (unlikely(ptrace) && (current->ptrace & PT_PTRACED)) { |
| 173 | child->ptrace = current->ptrace; | 188 | child->ptrace = current->ptrace; |
| 174 | ptrace_link(child, current->parent); | 189 | __ptrace_link(child, current->parent); |
| 175 | } | 190 | } |
| 176 | } | 191 | } |
| 177 | 192 | ||
| @@ -249,6 +264,9 @@ static inline void user_enable_single_step(struct task_struct *task) | |||
| 249 | static inline void user_disable_single_step(struct task_struct *task) | 264 | static inline void user_disable_single_step(struct task_struct *task) |
| 250 | { | 265 | { |
| 251 | } | 266 | } |
| 267 | #else | ||
| 268 | extern void user_enable_single_step(struct task_struct *); | ||
| 269 | extern void user_disable_single_step(struct task_struct *); | ||
| 252 | #endif /* arch_has_single_step */ | 270 | #endif /* arch_has_single_step */ |
| 253 | 271 | ||
| 254 | #ifndef arch_has_block_step | 272 | #ifndef arch_has_block_step |
| @@ -276,8 +294,22 @@ static inline void user_enable_block_step(struct task_struct *task) | |||
| 276 | { | 294 | { |
| 277 | BUG(); /* This can never be called. */ | 295 | BUG(); /* This can never be called. */ |
| 278 | } | 296 | } |
| 297 | #else | ||
| 298 | extern void user_enable_block_step(struct task_struct *); | ||
| 279 | #endif /* arch_has_block_step */ | 299 | #endif /* arch_has_block_step */ |
| 280 | 300 | ||
| 301 | #ifdef ARCH_HAS_USER_SINGLE_STEP_INFO | ||
| 302 | extern void user_single_step_siginfo(struct task_struct *tsk, | ||
| 303 | struct pt_regs *regs, siginfo_t *info); | ||
| 304 | #else | ||
| 305 | static inline void user_single_step_siginfo(struct task_struct *tsk, | ||
| 306 | struct pt_regs *regs, siginfo_t *info) | ||
| 307 | { | ||
| 308 | memset(info, 0, sizeof(*info)); | ||
| 309 | info->si_signo = SIGTRAP; | ||
| 310 | } | ||
| 311 | #endif | ||
| 312 | |||
| 281 | #ifndef arch_ptrace_stop_needed | 313 | #ifndef arch_ptrace_stop_needed |
| 282 | /** | 314 | /** |
| 283 | * arch_ptrace_stop_needed - Decide whether arch_ptrace_stop() should be called | 315 | * arch_ptrace_stop_needed - Decide whether arch_ptrace_stop() should be called |
diff --git a/include/linux/pwm_backlight.h b/include/linux/pwm_backlight.h index 7a9754c96775..01b3d759f1fc 100644 --- a/include/linux/pwm_backlight.h +++ b/include/linux/pwm_backlight.h | |||
| @@ -10,7 +10,7 @@ struct platform_pwm_backlight_data { | |||
| 10 | unsigned int dft_brightness; | 10 | unsigned int dft_brightness; |
| 11 | unsigned int pwm_period_ns; | 11 | unsigned int pwm_period_ns; |
| 12 | int (*init)(struct device *dev); | 12 | int (*init)(struct device *dev); |
| 13 | int (*notify)(int brightness); | 13 | int (*notify)(struct device *dev, int brightness); |
| 14 | void (*exit)(struct device *dev); | 14 | void (*exit)(struct device *dev); |
| 15 | }; | 15 | }; |
| 16 | 16 | ||
diff --git a/include/linux/quota.h b/include/linux/quota.h index 78c48895b12a..b462916b2a0a 100644 --- a/include/linux/quota.h +++ b/include/linux/quota.h | |||
| @@ -73,6 +73,8 @@ | |||
| 73 | /* Quota format type IDs */ | 73 | /* Quota format type IDs */ |
| 74 | #define QFMT_VFS_OLD 1 | 74 | #define QFMT_VFS_OLD 1 |
| 75 | #define QFMT_VFS_V0 2 | 75 | #define QFMT_VFS_V0 2 |
| 76 | #define QFMT_OCFS2 3 | ||
| 77 | #define QFMT_VFS_V1 4 | ||
| 76 | 78 | ||
| 77 | /* Size of block in which space limits are passed through the quota | 79 | /* Size of block in which space limits are passed through the quota |
| 78 | * interface */ | 80 | * interface */ |
| @@ -277,9 +279,6 @@ struct dquot { | |||
| 277 | struct mem_dqblk dq_dqb; /* Diskquota usage */ | 279 | struct mem_dqblk dq_dqb; /* Diskquota usage */ |
| 278 | }; | 280 | }; |
| 279 | 281 | ||
| 280 | #define QUOTA_OK 0 | ||
| 281 | #define NO_QUOTA 1 | ||
| 282 | |||
| 283 | /* Operations which must be implemented by each quota format */ | 282 | /* Operations which must be implemented by each quota format */ |
| 284 | struct quota_format_ops { | 283 | struct quota_format_ops { |
| 285 | int (*check_quota_file)(struct super_block *sb, int type); /* Detect whether file is in our format */ | 284 | int (*check_quota_file)(struct super_block *sb, int type); /* Detect whether file is in our format */ |
| @@ -293,13 +292,6 @@ struct quota_format_ops { | |||
| 293 | 292 | ||
| 294 | /* Operations working with dquots */ | 293 | /* Operations working with dquots */ |
| 295 | struct dquot_operations { | 294 | struct dquot_operations { |
| 296 | int (*initialize) (struct inode *, int); | ||
| 297 | int (*drop) (struct inode *); | ||
| 298 | int (*alloc_space) (struct inode *, qsize_t, int); | ||
| 299 | int (*alloc_inode) (const struct inode *, qsize_t); | ||
| 300 | int (*free_space) (struct inode *, qsize_t); | ||
| 301 | int (*free_inode) (const struct inode *, qsize_t); | ||
| 302 | int (*transfer) (struct inode *, struct iattr *); | ||
| 303 | int (*write_dquot) (struct dquot *); /* Ordinary dquot write */ | 295 | int (*write_dquot) (struct dquot *); /* Ordinary dquot write */ |
| 304 | struct dquot *(*alloc_dquot)(struct super_block *, int); /* Allocate memory for new dquot */ | 296 | struct dquot *(*alloc_dquot)(struct super_block *, int); /* Allocate memory for new dquot */ |
| 305 | void (*destroy_dquot)(struct dquot *); /* Free memory for dquot */ | 297 | void (*destroy_dquot)(struct dquot *); /* Free memory for dquot */ |
| @@ -307,21 +299,16 @@ struct dquot_operations { | |||
| 307 | int (*release_dquot) (struct dquot *); /* Quota is going to be deleted from disk */ | 299 | int (*release_dquot) (struct dquot *); /* Quota is going to be deleted from disk */ |
| 308 | int (*mark_dirty) (struct dquot *); /* Dquot is marked dirty */ | 300 | int (*mark_dirty) (struct dquot *); /* Dquot is marked dirty */ |
| 309 | int (*write_info) (struct super_block *, int); /* Write of quota "superblock" */ | 301 | int (*write_info) (struct super_block *, int); /* Write of quota "superblock" */ |
| 310 | /* reserve quota for delayed block allocation */ | 302 | /* get reserved quota for delayed alloc, value returned is managed by |
| 311 | int (*reserve_space) (struct inode *, qsize_t, int); | 303 | * quota code only */ |
| 312 | /* claim reserved quota for delayed alloc */ | 304 | qsize_t *(*get_reserved_space) (struct inode *); |
| 313 | int (*claim_space) (struct inode *, qsize_t); | ||
| 314 | /* release rsved quota for delayed alloc */ | ||
| 315 | void (*release_rsv) (struct inode *, qsize_t); | ||
| 316 | /* get reserved quota for delayed alloc */ | ||
| 317 | qsize_t (*get_reserved_space) (struct inode *); | ||
| 318 | }; | 305 | }; |
| 319 | 306 | ||
| 320 | /* Operations handling requests from userspace */ | 307 | /* Operations handling requests from userspace */ |
| 321 | struct quotactl_ops { | 308 | struct quotactl_ops { |
| 322 | int (*quota_on)(struct super_block *, int, int, char *, int); | 309 | int (*quota_on)(struct super_block *, int, int, char *, int); |
| 323 | int (*quota_off)(struct super_block *, int, int); | 310 | int (*quota_off)(struct super_block *, int, int); |
| 324 | int (*quota_sync)(struct super_block *, int); | 311 | int (*quota_sync)(struct super_block *, int, int); |
| 325 | int (*get_info)(struct super_block *, int, struct if_dqinfo *); | 312 | int (*get_info)(struct super_block *, int, struct if_dqinfo *); |
| 326 | int (*set_info)(struct super_block *, int, struct if_dqinfo *); | 313 | int (*set_info)(struct super_block *, int, struct if_dqinfo *); |
| 327 | int (*get_dqblk)(struct super_block *, int, qid_t, struct if_dqblk *); | 314 | int (*get_dqblk)(struct super_block *, int, qid_t, struct if_dqblk *); |
| @@ -334,7 +321,7 @@ struct quotactl_ops { | |||
| 334 | 321 | ||
| 335 | struct quota_format_type { | 322 | struct quota_format_type { |
| 336 | int qf_fmt_id; /* Quota format id */ | 323 | int qf_fmt_id; /* Quota format id */ |
| 337 | struct quota_format_ops *qf_ops; /* Operations of format */ | 324 | const struct quota_format_ops *qf_ops; /* Operations of format */ |
| 338 | struct module *qf_owner; /* Module implementing quota format */ | 325 | struct module *qf_owner; /* Module implementing quota format */ |
| 339 | struct quota_format_type *qf_next; | 326 | struct quota_format_type *qf_next; |
| 340 | }; | 327 | }; |
| @@ -354,27 +341,37 @@ enum { | |||
| 354 | #define DQUOT_STATE_FLAGS (DQUOT_USAGE_ENABLED | DQUOT_LIMITS_ENABLED | \ | 341 | #define DQUOT_STATE_FLAGS (DQUOT_USAGE_ENABLED | DQUOT_LIMITS_ENABLED | \ |
| 355 | DQUOT_SUSPENDED) | 342 | DQUOT_SUSPENDED) |
| 356 | /* Other quota flags */ | 343 | /* Other quota flags */ |
| 357 | #define DQUOT_QUOTA_SYS_FILE (1 << 6) /* Quota file is a special | 344 | #define DQUOT_STATE_LAST (_DQUOT_STATE_FLAGS * MAXQUOTAS) |
| 345 | #define DQUOT_QUOTA_SYS_FILE (1 << DQUOT_STATE_LAST) | ||
| 346 | /* Quota file is a special | ||
| 358 | * system file and user cannot | 347 | * system file and user cannot |
| 359 | * touch it. Filesystem is | 348 | * touch it. Filesystem is |
| 360 | * responsible for setting | 349 | * responsible for setting |
| 361 | * S_NOQUOTA, S_NOATIME flags | 350 | * S_NOQUOTA, S_NOATIME flags |
| 362 | */ | 351 | */ |
| 363 | #define DQUOT_NEGATIVE_USAGE (1 << 7) /* Allow negative quota usage */ | 352 | #define DQUOT_NEGATIVE_USAGE (1 << (DQUOT_STATE_LAST + 1)) |
| 353 | /* Allow negative quota usage */ | ||
| 364 | 354 | ||
| 365 | static inline unsigned int dquot_state_flag(unsigned int flags, int type) | 355 | static inline unsigned int dquot_state_flag(unsigned int flags, int type) |
| 366 | { | 356 | { |
| 367 | if (type == USRQUOTA) | 357 | return flags << _DQUOT_STATE_FLAGS * type; |
| 368 | return flags; | ||
| 369 | return flags << _DQUOT_STATE_FLAGS; | ||
| 370 | } | 358 | } |
| 371 | 359 | ||
| 372 | static inline unsigned int dquot_generic_flag(unsigned int flags, int type) | 360 | static inline unsigned int dquot_generic_flag(unsigned int flags, int type) |
| 373 | { | 361 | { |
| 374 | if (type == USRQUOTA) | 362 | return (flags >> _DQUOT_STATE_FLAGS * type) & DQUOT_STATE_FLAGS; |
| 375 | return flags; | 363 | } |
| 376 | return flags >> _DQUOT_STATE_FLAGS; | 364 | |
| 365 | #ifdef CONFIG_QUOTA_NETLINK_INTERFACE | ||
| 366 | extern void quota_send_warning(short type, unsigned int id, dev_t dev, | ||
| 367 | const char warntype); | ||
| 368 | #else | ||
| 369 | static inline void quota_send_warning(short type, unsigned int id, dev_t dev, | ||
| 370 | const char warntype) | ||
| 371 | { | ||
| 372 | return; | ||
| 377 | } | 373 | } |
| 374 | #endif /* CONFIG_QUOTA_NETLINK_INTERFACE */ | ||
| 378 | 375 | ||
| 379 | struct quota_info { | 376 | struct quota_info { |
| 380 | unsigned int flags; /* Flags for diskquotas on this device */ | 377 | unsigned int flags; /* Flags for diskquotas on this device */ |
| @@ -383,7 +380,7 @@ struct quota_info { | |||
| 383 | struct rw_semaphore dqptr_sem; /* serialize ops using quota_info struct, pointers from inode to dquots */ | 380 | struct rw_semaphore dqptr_sem; /* serialize ops using quota_info struct, pointers from inode to dquots */ |
| 384 | struct inode *files[MAXQUOTAS]; /* inodes of quotafiles */ | 381 | struct inode *files[MAXQUOTAS]; /* inodes of quotafiles */ |
| 385 | struct mem_dqinfo info[MAXQUOTAS]; /* Information for each quota type */ | 382 | struct mem_dqinfo info[MAXQUOTAS]; /* Information for each quota type */ |
| 386 | struct quota_format_ops *ops[MAXQUOTAS]; /* Operations for each type */ | 383 | const struct quota_format_ops *ops[MAXQUOTAS]; /* Operations for each type */ |
| 387 | }; | 384 | }; |
| 388 | 385 | ||
| 389 | int register_quota_format(struct quota_format_type *fmt); | 386 | int register_quota_format(struct quota_format_type *fmt); |
diff --git a/include/linux/quotaops.h b/include/linux/quotaops.h index 3ebb23153640..e6fa7acce290 100644 --- a/include/linux/quotaops.h +++ b/include/linux/quotaops.h | |||
| @@ -19,15 +19,12 @@ static inline struct quota_info *sb_dqopt(struct super_block *sb) | |||
| 19 | /* | 19 | /* |
| 20 | * declaration of quota_function calls in kernel. | 20 | * declaration of quota_function calls in kernel. |
| 21 | */ | 21 | */ |
| 22 | void sync_quota_sb(struct super_block *sb, int type); | 22 | void inode_add_rsv_space(struct inode *inode, qsize_t number); |
| 23 | static inline void writeout_quota_sb(struct super_block *sb, int type) | 23 | void inode_claim_rsv_space(struct inode *inode, qsize_t number); |
| 24 | { | 24 | void inode_sub_rsv_space(struct inode *inode, qsize_t number); |
| 25 | if (sb->s_qcop->quota_sync) | ||
| 26 | sb->s_qcop->quota_sync(sb, type); | ||
| 27 | } | ||
| 28 | 25 | ||
| 29 | int dquot_initialize(struct inode *inode, int type); | 26 | void dquot_initialize(struct inode *inode); |
| 30 | int dquot_drop(struct inode *inode); | 27 | void dquot_drop(struct inode *inode); |
| 31 | struct dquot *dqget(struct super_block *sb, unsigned int id, int type); | 28 | struct dquot *dqget(struct super_block *sb, unsigned int id, int type); |
| 32 | void dqput(struct dquot *dquot); | 29 | void dqput(struct dquot *dquot); |
| 33 | int dquot_scan_active(struct super_block *sb, | 30 | int dquot_scan_active(struct super_block *sb, |
| @@ -36,24 +33,23 @@ int dquot_scan_active(struct super_block *sb, | |||
| 36 | struct dquot *dquot_alloc(struct super_block *sb, int type); | 33 | struct dquot *dquot_alloc(struct super_block *sb, int type); |
| 37 | void dquot_destroy(struct dquot *dquot); | 34 | void dquot_destroy(struct dquot *dquot); |
| 38 | 35 | ||
| 39 | int dquot_alloc_space(struct inode *inode, qsize_t number, int prealloc); | 36 | int __dquot_alloc_space(struct inode *inode, qsize_t number, |
| 40 | int dquot_alloc_inode(const struct inode *inode, qsize_t number); | 37 | int warn, int reserve); |
| 38 | void __dquot_free_space(struct inode *inode, qsize_t number, int reserve); | ||
| 41 | 39 | ||
| 42 | int dquot_reserve_space(struct inode *inode, qsize_t number, int prealloc); | 40 | int dquot_alloc_inode(const struct inode *inode); |
| 43 | int dquot_claim_space(struct inode *inode, qsize_t number); | ||
| 44 | void dquot_release_reserved_space(struct inode *inode, qsize_t number); | ||
| 45 | qsize_t dquot_get_reserved_space(struct inode *inode); | ||
| 46 | 41 | ||
| 47 | int dquot_free_space(struct inode *inode, qsize_t number); | 42 | int dquot_claim_space_nodirty(struct inode *inode, qsize_t number); |
| 48 | int dquot_free_inode(const struct inode *inode, qsize_t number); | 43 | void dquot_free_inode(const struct inode *inode); |
| 49 | 44 | ||
| 50 | int dquot_transfer(struct inode *inode, struct iattr *iattr); | ||
| 51 | int dquot_commit(struct dquot *dquot); | 45 | int dquot_commit(struct dquot *dquot); |
| 52 | int dquot_acquire(struct dquot *dquot); | 46 | int dquot_acquire(struct dquot *dquot); |
| 53 | int dquot_release(struct dquot *dquot); | 47 | int dquot_release(struct dquot *dquot); |
| 54 | int dquot_commit_info(struct super_block *sb, int type); | 48 | int dquot_commit_info(struct super_block *sb, int type); |
| 55 | int dquot_mark_dquot_dirty(struct dquot *dquot); | 49 | int dquot_mark_dquot_dirty(struct dquot *dquot); |
| 56 | 50 | ||
| 51 | int dquot_file_open(struct inode *inode, struct file *file); | ||
| 52 | |||
| 57 | int vfs_quota_on(struct super_block *sb, int type, int format_id, | 53 | int vfs_quota_on(struct super_block *sb, int type, int format_id, |
| 58 | char *path, int remount); | 54 | char *path, int remount); |
| 59 | int vfs_quota_enable(struct inode *inode, int type, int format_id, | 55 | int vfs_quota_enable(struct inode *inode, int type, int format_id, |
| @@ -64,14 +60,13 @@ int vfs_quota_on_mount(struct super_block *sb, char *qf_name, | |||
| 64 | int format_id, int type); | 60 | int format_id, int type); |
| 65 | int vfs_quota_off(struct super_block *sb, int type, int remount); | 61 | int vfs_quota_off(struct super_block *sb, int type, int remount); |
| 66 | int vfs_quota_disable(struct super_block *sb, int type, unsigned int flags); | 62 | int vfs_quota_disable(struct super_block *sb, int type, unsigned int flags); |
| 67 | int vfs_quota_sync(struct super_block *sb, int type); | 63 | int vfs_quota_sync(struct super_block *sb, int type, int wait); |
| 68 | int vfs_get_dqinfo(struct super_block *sb, int type, struct if_dqinfo *ii); | 64 | int vfs_get_dqinfo(struct super_block *sb, int type, struct if_dqinfo *ii); |
| 69 | int vfs_set_dqinfo(struct super_block *sb, int type, struct if_dqinfo *ii); | 65 | int vfs_set_dqinfo(struct super_block *sb, int type, struct if_dqinfo *ii); |
| 70 | int vfs_get_dqblk(struct super_block *sb, int type, qid_t id, struct if_dqblk *di); | 66 | int vfs_get_dqblk(struct super_block *sb, int type, qid_t id, struct if_dqblk *di); |
| 71 | int vfs_set_dqblk(struct super_block *sb, int type, qid_t id, struct if_dqblk *di); | 67 | int vfs_set_dqblk(struct super_block *sb, int type, qid_t id, struct if_dqblk *di); |
| 72 | 68 | ||
| 73 | void vfs_dq_drop(struct inode *inode); | 69 | int dquot_transfer(struct inode *inode, struct iattr *iattr); |
| 74 | int vfs_dq_transfer(struct inode *inode, struct iattr *iattr); | ||
| 75 | int vfs_dq_quota_on_remount(struct super_block *sb); | 70 | int vfs_dq_quota_on_remount(struct super_block *sb); |
| 76 | 71 | ||
| 77 | static inline struct mem_dqinfo *sb_dqinfo(struct super_block *sb, int type) | 72 | static inline struct mem_dqinfo *sb_dqinfo(struct super_block *sb, int type) |
| @@ -83,53 +78,56 @@ static inline struct mem_dqinfo *sb_dqinfo(struct super_block *sb, int type) | |||
| 83 | * Functions for checking status of quota | 78 | * Functions for checking status of quota |
| 84 | */ | 79 | */ |
| 85 | 80 | ||
| 86 | static inline int sb_has_quota_usage_enabled(struct super_block *sb, int type) | 81 | static inline bool sb_has_quota_usage_enabled(struct super_block *sb, int type) |
| 87 | { | 82 | { |
| 88 | return sb_dqopt(sb)->flags & | 83 | return sb_dqopt(sb)->flags & |
| 89 | dquot_state_flag(DQUOT_USAGE_ENABLED, type); | 84 | dquot_state_flag(DQUOT_USAGE_ENABLED, type); |
| 90 | } | 85 | } |
| 91 | 86 | ||
| 92 | static inline int sb_has_quota_limits_enabled(struct super_block *sb, int type) | 87 | static inline bool sb_has_quota_limits_enabled(struct super_block *sb, int type) |
| 93 | { | 88 | { |
| 94 | return sb_dqopt(sb)->flags & | 89 | return sb_dqopt(sb)->flags & |
| 95 | dquot_state_flag(DQUOT_LIMITS_ENABLED, type); | 90 | dquot_state_flag(DQUOT_LIMITS_ENABLED, type); |
| 96 | } | 91 | } |
| 97 | 92 | ||
| 98 | static inline int sb_has_quota_suspended(struct super_block *sb, int type) | 93 | static inline bool sb_has_quota_suspended(struct super_block *sb, int type) |
| 99 | { | 94 | { |
| 100 | return sb_dqopt(sb)->flags & | 95 | return sb_dqopt(sb)->flags & |
| 101 | dquot_state_flag(DQUOT_SUSPENDED, type); | 96 | dquot_state_flag(DQUOT_SUSPENDED, type); |
| 102 | } | 97 | } |
| 103 | 98 | ||
| 104 | static inline int sb_any_quota_suspended(struct super_block *sb) | 99 | static inline unsigned sb_any_quota_suspended(struct super_block *sb) |
| 105 | { | 100 | { |
| 106 | return sb_has_quota_suspended(sb, USRQUOTA) || | 101 | unsigned type, tmsk = 0; |
| 107 | sb_has_quota_suspended(sb, GRPQUOTA); | 102 | for (type = 0; type < MAXQUOTAS; type++) |
| 103 | tmsk |= sb_has_quota_suspended(sb, type) << type; | ||
| 104 | return tmsk; | ||
| 108 | } | 105 | } |
| 109 | 106 | ||
| 110 | /* Does kernel know about any quota information for given sb + type? */ | 107 | /* Does kernel know about any quota information for given sb + type? */ |
| 111 | static inline int sb_has_quota_loaded(struct super_block *sb, int type) | 108 | static inline bool sb_has_quota_loaded(struct super_block *sb, int type) |
| 112 | { | 109 | { |
| 113 | /* Currently if anything is on, then quota usage is on as well */ | 110 | /* Currently if anything is on, then quota usage is on as well */ |
| 114 | return sb_has_quota_usage_enabled(sb, type); | 111 | return sb_has_quota_usage_enabled(sb, type); |
| 115 | } | 112 | } |
| 116 | 113 | ||
| 117 | static inline int sb_any_quota_loaded(struct super_block *sb) | 114 | static inline unsigned sb_any_quota_loaded(struct super_block *sb) |
| 118 | { | 115 | { |
| 119 | return sb_has_quota_loaded(sb, USRQUOTA) || | 116 | unsigned type, tmsk = 0; |
| 120 | sb_has_quota_loaded(sb, GRPQUOTA); | 117 | for (type = 0; type < MAXQUOTAS; type++) |
| 118 | tmsk |= sb_has_quota_loaded(sb, type) << type; | ||
| 119 | return tmsk; | ||
| 121 | } | 120 | } |
| 122 | 121 | ||
| 123 | static inline int sb_has_quota_active(struct super_block *sb, int type) | 122 | static inline bool sb_has_quota_active(struct super_block *sb, int type) |
| 124 | { | 123 | { |
| 125 | return sb_has_quota_loaded(sb, type) && | 124 | return sb_has_quota_loaded(sb, type) && |
| 126 | !sb_has_quota_suspended(sb, type); | 125 | !sb_has_quota_suspended(sb, type); |
| 127 | } | 126 | } |
| 128 | 127 | ||
| 129 | static inline int sb_any_quota_active(struct super_block *sb) | 128 | static inline unsigned sb_any_quota_active(struct super_block *sb) |
| 130 | { | 129 | { |
| 131 | return sb_has_quota_active(sb, USRQUOTA) || | 130 | return sb_any_quota_loaded(sb) & ~sb_any_quota_suspended(sb); |
| 132 | sb_has_quota_active(sb, GRPQUOTA); | ||
| 133 | } | 131 | } |
| 134 | 132 | ||
| 135 | /* | 133 | /* |
| @@ -141,122 +139,6 @@ extern const struct quotactl_ops vfs_quotactl_ops; | |||
| 141 | #define sb_dquot_ops (&dquot_operations) | 139 | #define sb_dquot_ops (&dquot_operations) |
| 142 | #define sb_quotactl_ops (&vfs_quotactl_ops) | 140 | #define sb_quotactl_ops (&vfs_quotactl_ops) |
| 143 | 141 | ||
| 144 | /* It is better to call this function outside of any transaction as it might | ||
| 145 | * need a lot of space in journal for dquot structure allocation. */ | ||
| 146 | static inline void vfs_dq_init(struct inode *inode) | ||
| 147 | { | ||
| 148 | BUG_ON(!inode->i_sb); | ||
| 149 | if (sb_any_quota_active(inode->i_sb) && !IS_NOQUOTA(inode)) | ||
| 150 | inode->i_sb->dq_op->initialize(inode, -1); | ||
| 151 | } | ||
| 152 | |||
| 153 | /* The following allocation/freeing/transfer functions *must* be called inside | ||
| 154 | * a transaction (deadlocks possible otherwise) */ | ||
| 155 | static inline int vfs_dq_prealloc_space_nodirty(struct inode *inode, qsize_t nr) | ||
| 156 | { | ||
| 157 | if (sb_any_quota_active(inode->i_sb)) { | ||
| 158 | /* Used space is updated in alloc_space() */ | ||
| 159 | if (inode->i_sb->dq_op->alloc_space(inode, nr, 1) == NO_QUOTA) | ||
| 160 | return 1; | ||
| 161 | } | ||
| 162 | else | ||
| 163 | inode_add_bytes(inode, nr); | ||
| 164 | return 0; | ||
| 165 | } | ||
| 166 | |||
| 167 | static inline int vfs_dq_prealloc_space(struct inode *inode, qsize_t nr) | ||
| 168 | { | ||
| 169 | int ret; | ||
| 170 | if (!(ret = vfs_dq_prealloc_space_nodirty(inode, nr))) | ||
| 171 | mark_inode_dirty(inode); | ||
| 172 | return ret; | ||
| 173 | } | ||
| 174 | |||
| 175 | static inline int vfs_dq_alloc_space_nodirty(struct inode *inode, qsize_t nr) | ||
| 176 | { | ||
| 177 | if (sb_any_quota_active(inode->i_sb)) { | ||
| 178 | /* Used space is updated in alloc_space() */ | ||
| 179 | if (inode->i_sb->dq_op->alloc_space(inode, nr, 0) == NO_QUOTA) | ||
| 180 | return 1; | ||
| 181 | } | ||
| 182 | else | ||
| 183 | inode_add_bytes(inode, nr); | ||
| 184 | return 0; | ||
| 185 | } | ||
| 186 | |||
| 187 | static inline int vfs_dq_alloc_space(struct inode *inode, qsize_t nr) | ||
| 188 | { | ||
| 189 | int ret; | ||
| 190 | if (!(ret = vfs_dq_alloc_space_nodirty(inode, nr))) | ||
| 191 | mark_inode_dirty(inode); | ||
| 192 | return ret; | ||
| 193 | } | ||
| 194 | |||
| 195 | static inline int vfs_dq_reserve_space(struct inode *inode, qsize_t nr) | ||
| 196 | { | ||
| 197 | if (sb_any_quota_active(inode->i_sb)) { | ||
| 198 | /* Used space is updated in alloc_space() */ | ||
| 199 | if (inode->i_sb->dq_op->reserve_space(inode, nr, 0) == NO_QUOTA) | ||
| 200 | return 1; | ||
| 201 | } | ||
| 202 | return 0; | ||
| 203 | } | ||
| 204 | |||
| 205 | static inline int vfs_dq_alloc_inode(struct inode *inode) | ||
| 206 | { | ||
| 207 | if (sb_any_quota_active(inode->i_sb)) { | ||
| 208 | vfs_dq_init(inode); | ||
| 209 | if (inode->i_sb->dq_op->alloc_inode(inode, 1) == NO_QUOTA) | ||
| 210 | return 1; | ||
| 211 | } | ||
| 212 | return 0; | ||
| 213 | } | ||
| 214 | |||
| 215 | /* | ||
| 216 | * Convert in-memory reserved quotas to real consumed quotas | ||
| 217 | */ | ||
| 218 | static inline int vfs_dq_claim_space(struct inode *inode, qsize_t nr) | ||
| 219 | { | ||
| 220 | if (sb_any_quota_active(inode->i_sb)) { | ||
| 221 | if (inode->i_sb->dq_op->claim_space(inode, nr) == NO_QUOTA) | ||
| 222 | return 1; | ||
| 223 | } else | ||
| 224 | inode_add_bytes(inode, nr); | ||
| 225 | |||
| 226 | mark_inode_dirty(inode); | ||
| 227 | return 0; | ||
| 228 | } | ||
| 229 | |||
| 230 | /* | ||
| 231 | * Release reserved (in-memory) quotas | ||
| 232 | */ | ||
| 233 | static inline | ||
| 234 | void vfs_dq_release_reservation_space(struct inode *inode, qsize_t nr) | ||
| 235 | { | ||
| 236 | if (sb_any_quota_active(inode->i_sb)) | ||
| 237 | inode->i_sb->dq_op->release_rsv(inode, nr); | ||
| 238 | } | ||
| 239 | |||
| 240 | static inline void vfs_dq_free_space_nodirty(struct inode *inode, qsize_t nr) | ||
| 241 | { | ||
| 242 | if (sb_any_quota_active(inode->i_sb)) | ||
| 243 | inode->i_sb->dq_op->free_space(inode, nr); | ||
| 244 | else | ||
| 245 | inode_sub_bytes(inode, nr); | ||
| 246 | } | ||
| 247 | |||
| 248 | static inline void vfs_dq_free_space(struct inode *inode, qsize_t nr) | ||
| 249 | { | ||
| 250 | vfs_dq_free_space_nodirty(inode, nr); | ||
| 251 | mark_inode_dirty(inode); | ||
| 252 | } | ||
| 253 | |||
| 254 | static inline void vfs_dq_free_inode(struct inode *inode) | ||
| 255 | { | ||
| 256 | if (sb_any_quota_active(inode->i_sb)) | ||
| 257 | inode->i_sb->dq_op->free_inode(inode, 1); | ||
| 258 | } | ||
| 259 | |||
| 260 | /* Cannot be called inside a transaction */ | 142 | /* Cannot be called inside a transaction */ |
| 261 | static inline int vfs_dq_off(struct super_block *sb, int remount) | 143 | static inline int vfs_dq_off(struct super_block *sb, int remount) |
| 262 | { | 144 | { |
| @@ -316,28 +198,20 @@ static inline int sb_any_quota_active(struct super_block *sb) | |||
| 316 | #define sb_dquot_ops (NULL) | 198 | #define sb_dquot_ops (NULL) |
| 317 | #define sb_quotactl_ops (NULL) | 199 | #define sb_quotactl_ops (NULL) |
| 318 | 200 | ||
| 319 | static inline void vfs_dq_init(struct inode *inode) | 201 | static inline void dquot_initialize(struct inode *inode) |
| 320 | { | 202 | { |
| 321 | } | 203 | } |
| 322 | 204 | ||
| 323 | static inline void vfs_dq_drop(struct inode *inode) | 205 | static inline void dquot_drop(struct inode *inode) |
| 324 | { | 206 | { |
| 325 | } | 207 | } |
| 326 | 208 | ||
| 327 | static inline int vfs_dq_alloc_inode(struct inode *inode) | 209 | static inline int dquot_alloc_inode(const struct inode *inode) |
| 328 | { | 210 | { |
| 329 | return 0; | 211 | return 0; |
| 330 | } | 212 | } |
| 331 | 213 | ||
| 332 | static inline void vfs_dq_free_inode(struct inode *inode) | 214 | static inline void dquot_free_inode(const struct inode *inode) |
| 333 | { | ||
| 334 | } | ||
| 335 | |||
| 336 | static inline void sync_quota_sb(struct super_block *sb, int type) | ||
| 337 | { | ||
| 338 | } | ||
| 339 | |||
| 340 | static inline void writeout_quota_sb(struct super_block *sb, int type) | ||
| 341 | { | 215 | { |
| 342 | } | 216 | } |
| 343 | 217 | ||
| @@ -351,110 +225,116 @@ static inline int vfs_dq_quota_on_remount(struct super_block *sb) | |||
| 351 | return 0; | 225 | return 0; |
| 352 | } | 226 | } |
| 353 | 227 | ||
| 354 | static inline int vfs_dq_transfer(struct inode *inode, struct iattr *iattr) | 228 | static inline int dquot_transfer(struct inode *inode, struct iattr *iattr) |
| 355 | { | 229 | { |
| 356 | return 0; | 230 | return 0; |
| 357 | } | 231 | } |
| 358 | 232 | ||
| 359 | static inline int vfs_dq_prealloc_space_nodirty(struct inode *inode, qsize_t nr) | 233 | static inline int __dquot_alloc_space(struct inode *inode, qsize_t number, |
| 234 | int warn, int reserve) | ||
| 360 | { | 235 | { |
| 361 | inode_add_bytes(inode, nr); | 236 | if (!reserve) |
| 237 | inode_add_bytes(inode, number); | ||
| 362 | return 0; | 238 | return 0; |
| 363 | } | 239 | } |
| 364 | 240 | ||
| 365 | static inline int vfs_dq_prealloc_space(struct inode *inode, qsize_t nr) | 241 | static inline void __dquot_free_space(struct inode *inode, qsize_t number, |
| 242 | int reserve) | ||
| 366 | { | 243 | { |
| 367 | vfs_dq_prealloc_space_nodirty(inode, nr); | 244 | if (!reserve) |
| 368 | mark_inode_dirty(inode); | 245 | inode_sub_bytes(inode, number); |
| 369 | return 0; | ||
| 370 | } | 246 | } |
| 371 | 247 | ||
| 372 | static inline int vfs_dq_alloc_space_nodirty(struct inode *inode, qsize_t nr) | 248 | static inline int dquot_claim_space_nodirty(struct inode *inode, qsize_t number) |
| 373 | { | 249 | { |
| 374 | inode_add_bytes(inode, nr); | 250 | inode_add_bytes(inode, number); |
| 375 | return 0; | 251 | return 0; |
| 376 | } | 252 | } |
| 377 | 253 | ||
| 378 | static inline int vfs_dq_alloc_space(struct inode *inode, qsize_t nr) | 254 | #define dquot_file_open generic_file_open |
| 255 | |||
| 256 | #endif /* CONFIG_QUOTA */ | ||
| 257 | |||
| 258 | static inline int dquot_alloc_space_nodirty(struct inode *inode, qsize_t nr) | ||
| 379 | { | 259 | { |
| 380 | vfs_dq_alloc_space_nodirty(inode, nr); | 260 | return __dquot_alloc_space(inode, nr, 1, 0); |
| 381 | mark_inode_dirty(inode); | ||
| 382 | return 0; | ||
| 383 | } | 261 | } |
| 384 | 262 | ||
| 385 | static inline int vfs_dq_reserve_space(struct inode *inode, qsize_t nr) | 263 | static inline int dquot_alloc_space(struct inode *inode, qsize_t nr) |
| 386 | { | 264 | { |
| 387 | return 0; | 265 | int ret; |
| 266 | |||
| 267 | ret = dquot_alloc_space_nodirty(inode, nr); | ||
| 268 | if (!ret) | ||
| 269 | mark_inode_dirty(inode); | ||
| 270 | return ret; | ||
| 388 | } | 271 | } |
| 389 | 272 | ||
| 390 | static inline int vfs_dq_claim_space(struct inode *inode, qsize_t nr) | 273 | static inline int dquot_alloc_block_nodirty(struct inode *inode, qsize_t nr) |
| 391 | { | 274 | { |
| 392 | return vfs_dq_alloc_space(inode, nr); | 275 | return dquot_alloc_space_nodirty(inode, nr << inode->i_blkbits); |
| 393 | } | 276 | } |
| 394 | 277 | ||
| 395 | static inline | 278 | static inline int dquot_alloc_block(struct inode *inode, qsize_t nr) |
| 396 | int vfs_dq_release_reservation_space(struct inode *inode, qsize_t nr) | ||
| 397 | { | 279 | { |
| 398 | return 0; | 280 | return dquot_alloc_space(inode, nr << inode->i_blkbits); |
| 399 | } | 281 | } |
| 400 | 282 | ||
| 401 | static inline void vfs_dq_free_space_nodirty(struct inode *inode, qsize_t nr) | 283 | static inline int dquot_prealloc_block_nodirty(struct inode *inode, qsize_t nr) |
| 402 | { | 284 | { |
| 403 | inode_sub_bytes(inode, nr); | 285 | return __dquot_alloc_space(inode, nr << inode->i_blkbits, 0, 0); |
| 404 | } | 286 | } |
| 405 | 287 | ||
| 406 | static inline void vfs_dq_free_space(struct inode *inode, qsize_t nr) | 288 | static inline int dquot_prealloc_block(struct inode *inode, qsize_t nr) |
| 407 | { | 289 | { |
| 408 | vfs_dq_free_space_nodirty(inode, nr); | 290 | int ret; |
| 409 | mark_inode_dirty(inode); | ||
| 410 | } | ||
| 411 | |||
| 412 | #endif /* CONFIG_QUOTA */ | ||
| 413 | 291 | ||
| 414 | static inline int vfs_dq_prealloc_block_nodirty(struct inode *inode, qsize_t nr) | 292 | ret = dquot_prealloc_block_nodirty(inode, nr); |
| 415 | { | 293 | if (!ret) |
| 416 | return vfs_dq_prealloc_space_nodirty(inode, nr << inode->i_blkbits); | 294 | mark_inode_dirty(inode); |
| 295 | return ret; | ||
| 417 | } | 296 | } |
| 418 | 297 | ||
| 419 | static inline int vfs_dq_prealloc_block(struct inode *inode, qsize_t nr) | 298 | static inline int dquot_reserve_block(struct inode *inode, qsize_t nr) |
| 420 | { | 299 | { |
| 421 | return vfs_dq_prealloc_space(inode, nr << inode->i_blkbits); | 300 | return __dquot_alloc_space(inode, nr << inode->i_blkbits, 1, 1); |
| 422 | } | 301 | } |
| 423 | 302 | ||
| 424 | static inline int vfs_dq_alloc_block_nodirty(struct inode *inode, qsize_t nr) | 303 | static inline int dquot_claim_block(struct inode *inode, qsize_t nr) |
| 425 | { | 304 | { |
| 426 | return vfs_dq_alloc_space_nodirty(inode, nr << inode->i_blkbits); | 305 | int ret; |
| 427 | } | ||
| 428 | 306 | ||
| 429 | static inline int vfs_dq_alloc_block(struct inode *inode, qsize_t nr) | 307 | ret = dquot_claim_space_nodirty(inode, nr << inode->i_blkbits); |
| 430 | { | 308 | if (!ret) |
| 431 | return vfs_dq_alloc_space(inode, nr << inode->i_blkbits); | 309 | mark_inode_dirty(inode); |
| 310 | return ret; | ||
| 432 | } | 311 | } |
| 433 | 312 | ||
| 434 | static inline int vfs_dq_reserve_block(struct inode *inode, qsize_t nr) | 313 | static inline void dquot_free_space_nodirty(struct inode *inode, qsize_t nr) |
| 435 | { | 314 | { |
| 436 | return vfs_dq_reserve_space(inode, nr << inode->i_blkbits); | 315 | __dquot_free_space(inode, nr, 0); |
| 437 | } | 316 | } |
| 438 | 317 | ||
| 439 | static inline int vfs_dq_claim_block(struct inode *inode, qsize_t nr) | 318 | static inline void dquot_free_space(struct inode *inode, qsize_t nr) |
| 440 | { | 319 | { |
| 441 | return vfs_dq_claim_space(inode, nr << inode->i_blkbits); | 320 | dquot_free_space_nodirty(inode, nr); |
| 321 | mark_inode_dirty(inode); | ||
| 442 | } | 322 | } |
| 443 | 323 | ||
| 444 | static inline | 324 | static inline void dquot_free_block_nodirty(struct inode *inode, qsize_t nr) |
| 445 | void vfs_dq_release_reservation_block(struct inode *inode, qsize_t nr) | ||
| 446 | { | 325 | { |
| 447 | vfs_dq_release_reservation_space(inode, nr << inode->i_blkbits); | 326 | dquot_free_space_nodirty(inode, nr << inode->i_blkbits); |
| 448 | } | 327 | } |
| 449 | 328 | ||
| 450 | static inline void vfs_dq_free_block_nodirty(struct inode *inode, qsize_t nr) | 329 | static inline void dquot_free_block(struct inode *inode, qsize_t nr) |
| 451 | { | 330 | { |
| 452 | vfs_dq_free_space_nodirty(inode, nr << inode->i_blkbits); | 331 | dquot_free_space(inode, nr << inode->i_blkbits); |
| 453 | } | 332 | } |
| 454 | 333 | ||
| 455 | static inline void vfs_dq_free_block(struct inode *inode, qsize_t nr) | 334 | static inline void dquot_release_reservation_block(struct inode *inode, |
| 335 | qsize_t nr) | ||
| 456 | { | 336 | { |
| 457 | vfs_dq_free_space(inode, nr << inode->i_blkbits); | 337 | __dquot_free_space(inode, nr << inode->i_blkbits, 1); |
| 458 | } | 338 | } |
| 459 | 339 | ||
| 460 | #endif /* _LINUX_QUOTAOPS_ */ | 340 | #endif /* _LINUX_QUOTAOPS_ */ |
diff --git a/include/linux/radix-tree.h b/include/linux/radix-tree.h index c5da74918096..55ca73cf25e5 100644 --- a/include/linux/radix-tree.h +++ b/include/linux/radix-tree.h | |||
| @@ -121,6 +121,13 @@ do { \ | |||
| 121 | * (Note, rcu_assign_pointer and rcu_dereference are not needed to control | 121 | * (Note, rcu_assign_pointer and rcu_dereference are not needed to control |
| 122 | * access to data items when inserting into or looking up from the radix tree) | 122 | * access to data items when inserting into or looking up from the radix tree) |
| 123 | * | 123 | * |
| 124 | * Note that the value returned by radix_tree_tag_get() may not be relied upon | ||
| 125 | * if only the RCU read lock is held. Functions to set/clear tags and to | ||
| 126 | * delete nodes running concurrently with it may affect its result such that | ||
| 127 | * two consecutive reads in the same locked section may return different | ||
| 128 | * values. If reliability is required, modification functions must also be | ||
| 129 | * excluded from concurrency. | ||
| 130 | * | ||
| 124 | * radix_tree_tagged is able to be called without locking or RCU. | 131 | * radix_tree_tagged is able to be called without locking or RCU. |
| 125 | */ | 132 | */ |
| 126 | 133 | ||
diff --git a/include/linux/raid/pq.h b/include/linux/raid/pq.h index d92480f8285c..1cbbd2c11aa9 100644 --- a/include/linux/raid/pq.h +++ b/include/linux/raid/pq.h | |||
| @@ -78,6 +78,25 @@ struct raid6_calls { | |||
| 78 | /* Selected algorithm */ | 78 | /* Selected algorithm */ |
| 79 | extern struct raid6_calls raid6_call; | 79 | extern struct raid6_calls raid6_call; |
| 80 | 80 | ||
| 81 | /* Various routine sets */ | ||
| 82 | extern const struct raid6_calls raid6_intx1; | ||
| 83 | extern const struct raid6_calls raid6_intx2; | ||
| 84 | extern const struct raid6_calls raid6_intx4; | ||
| 85 | extern const struct raid6_calls raid6_intx8; | ||
| 86 | extern const struct raid6_calls raid6_intx16; | ||
| 87 | extern const struct raid6_calls raid6_intx32; | ||
| 88 | extern const struct raid6_calls raid6_mmxx1; | ||
| 89 | extern const struct raid6_calls raid6_mmxx2; | ||
| 90 | extern const struct raid6_calls raid6_sse1x1; | ||
| 91 | extern const struct raid6_calls raid6_sse1x2; | ||
| 92 | extern const struct raid6_calls raid6_sse2x1; | ||
| 93 | extern const struct raid6_calls raid6_sse2x2; | ||
| 94 | extern const struct raid6_calls raid6_sse2x4; | ||
| 95 | extern const struct raid6_calls raid6_altivec1; | ||
| 96 | extern const struct raid6_calls raid6_altivec2; | ||
| 97 | extern const struct raid6_calls raid6_altivec4; | ||
| 98 | extern const struct raid6_calls raid6_altivec8; | ||
| 99 | |||
| 81 | /* Algorithm list */ | 100 | /* Algorithm list */ |
| 82 | extern const struct raid6_calls * const raid6_algos[]; | 101 | extern const struct raid6_calls * const raid6_algos[]; |
| 83 | int raid6_select_algo(void); | 102 | int raid6_select_algo(void); |
diff --git a/include/linux/raid_class.h b/include/linux/raid_class.h index 6b537f1ac96c..31e1ff69efc8 100644 --- a/include/linux/raid_class.h +++ b/include/linux/raid_class.h | |||
| @@ -32,6 +32,7 @@ enum raid_level { | |||
| 32 | RAID_LEVEL_0, | 32 | RAID_LEVEL_0, |
| 33 | RAID_LEVEL_1, | 33 | RAID_LEVEL_1, |
| 34 | RAID_LEVEL_10, | 34 | RAID_LEVEL_10, |
| 35 | RAID_LEVEL_1E, | ||
| 35 | RAID_LEVEL_3, | 36 | RAID_LEVEL_3, |
| 36 | RAID_LEVEL_4, | 37 | RAID_LEVEL_4, |
| 37 | RAID_LEVEL_5, | 38 | RAID_LEVEL_5, |
diff --git a/include/linux/range.h b/include/linux/range.h new file mode 100644 index 000000000000..bd184a5db791 --- /dev/null +++ b/include/linux/range.h | |||
| @@ -0,0 +1,30 @@ | |||
| 1 | #ifndef _LINUX_RANGE_H | ||
| 2 | #define _LINUX_RANGE_H | ||
| 3 | |||
| 4 | struct range { | ||
| 5 | u64 start; | ||
| 6 | u64 end; | ||
| 7 | }; | ||
| 8 | |||
| 9 | int add_range(struct range *range, int az, int nr_range, | ||
| 10 | u64 start, u64 end); | ||
| 11 | |||
| 12 | |||
| 13 | int add_range_with_merge(struct range *range, int az, int nr_range, | ||
| 14 | u64 start, u64 end); | ||
| 15 | |||
| 16 | void subtract_range(struct range *range, int az, u64 start, u64 end); | ||
| 17 | |||
| 18 | int clean_sort_range(struct range *range, int az); | ||
| 19 | |||
| 20 | void sort_range(struct range *range, int nr_range); | ||
| 21 | |||
| 22 | #define MAX_RESOURCE ((resource_size_t)~0) | ||
| 23 | static inline resource_size_t cap_resource(u64 val) | ||
| 24 | { | ||
| 25 | if (val > MAX_RESOURCE) | ||
| 26 | return MAX_RESOURCE; | ||
| 27 | |||
| 28 | return val; | ||
| 29 | } | ||
| 30 | #endif | ||
diff --git a/include/linux/ratelimit.h b/include/linux/ratelimit.h index 00044b856453..668cf1bef030 100644 --- a/include/linux/ratelimit.h +++ b/include/linux/ratelimit.h | |||
| @@ -1,20 +1,31 @@ | |||
| 1 | #ifndef _LINUX_RATELIMIT_H | 1 | #ifndef _LINUX_RATELIMIT_H |
| 2 | #define _LINUX_RATELIMIT_H | 2 | #define _LINUX_RATELIMIT_H |
| 3 | |||
| 3 | #include <linux/param.h> | 4 | #include <linux/param.h> |
| 5 | #include <linux/spinlock_types.h> | ||
| 4 | 6 | ||
| 5 | #define DEFAULT_RATELIMIT_INTERVAL (5 * HZ) | 7 | #define DEFAULT_RATELIMIT_INTERVAL (5 * HZ) |
| 6 | #define DEFAULT_RATELIMIT_BURST 10 | 8 | #define DEFAULT_RATELIMIT_BURST 10 |
| 7 | 9 | ||
| 8 | struct ratelimit_state { | 10 | struct ratelimit_state { |
| 9 | int interval; | 11 | spinlock_t lock; /* protect the state */ |
| 10 | int burst; | 12 | |
| 11 | int printed; | 13 | int interval; |
| 12 | int missed; | 14 | int burst; |
| 13 | unsigned long begin; | 15 | int printed; |
| 16 | int missed; | ||
| 17 | unsigned long begin; | ||
| 14 | }; | 18 | }; |
| 15 | 19 | ||
| 16 | #define DEFINE_RATELIMIT_STATE(name, interval, burst) \ | 20 | #define DEFINE_RATELIMIT_STATE(name, interval_init, burst_init) \ |
| 17 | struct ratelimit_state name = {interval, burst,} | 21 | \ |
| 22 | struct ratelimit_state name = { \ | ||
| 23 | .lock = __SPIN_LOCK_UNLOCKED(name.lock), \ | ||
| 24 | .interval = interval_init, \ | ||
| 25 | .burst = burst_init, \ | ||
| 26 | } | ||
| 27 | |||
| 28 | extern int ___ratelimit(struct ratelimit_state *rs, const char *func); | ||
| 29 | #define __ratelimit(state) ___ratelimit(state, __func__) | ||
| 18 | 30 | ||
| 19 | extern int __ratelimit(struct ratelimit_state *rs); | 31 | #endif /* _LINUX_RATELIMIT_H */ |
| 20 | #endif | ||
diff --git a/include/linux/rbtree.h b/include/linux/rbtree.h index 9c295411d01f..5210a5c60877 100644 --- a/include/linux/rbtree.h +++ b/include/linux/rbtree.h | |||
| @@ -25,10 +25,10 @@ | |||
| 25 | 25 | ||
| 26 | Some example of insert and search follows here. The search is a plain | 26 | Some example of insert and search follows here. The search is a plain |
| 27 | normal search over an ordered tree. The insert instead must be implemented | 27 | normal search over an ordered tree. The insert instead must be implemented |
| 28 | int two steps: as first thing the code must insert the element in | 28 | in two steps: First, the code must insert the element in order as a red leaf |
| 29 | order as a red leaf in the tree, then the support library function | 29 | in the tree, and then the support library function rb_insert_color() must |
| 30 | rb_insert_color() must be called. Such function will do the | 30 | be called. Such function will do the not trivial work to rebalance the |
| 31 | not trivial work to rebalance the rbtree if necessary. | 31 | rbtree, if necessary. |
| 32 | 32 | ||
| 33 | ----------------------------------------------------------------------- | 33 | ----------------------------------------------------------------------- |
| 34 | static inline struct page * rb_search_page_cache(struct inode * inode, | 34 | static inline struct page * rb_search_page_cache(struct inode * inode, |
diff --git a/include/linux/rculist.h b/include/linux/rculist.h index 5710f43bbc9e..2c9b46cff3d7 100644 --- a/include/linux/rculist.h +++ b/include/linux/rculist.h | |||
| @@ -208,7 +208,7 @@ static inline void list_splice_init_rcu(struct list_head *list, | |||
| 208 | * primitives such as list_add_rcu() as long as it's guarded by rcu_read_lock(). | 208 | * primitives such as list_add_rcu() as long as it's guarded by rcu_read_lock(). |
| 209 | */ | 209 | */ |
| 210 | #define list_entry_rcu(ptr, type, member) \ | 210 | #define list_entry_rcu(ptr, type, member) \ |
| 211 | container_of(rcu_dereference(ptr), type, member) | 211 | container_of(rcu_dereference_raw(ptr), type, member) |
| 212 | 212 | ||
| 213 | /** | 213 | /** |
| 214 | * list_first_entry_rcu - get the first element from a list | 214 | * list_first_entry_rcu - get the first element from a list |
| @@ -225,9 +225,9 @@ static inline void list_splice_init_rcu(struct list_head *list, | |||
| 225 | list_entry_rcu((ptr)->next, type, member) | 225 | list_entry_rcu((ptr)->next, type, member) |
| 226 | 226 | ||
| 227 | #define __list_for_each_rcu(pos, head) \ | 227 | #define __list_for_each_rcu(pos, head) \ |
| 228 | for (pos = rcu_dereference((head)->next); \ | 228 | for (pos = rcu_dereference_raw((head)->next); \ |
| 229 | pos != (head); \ | 229 | pos != (head); \ |
| 230 | pos = rcu_dereference(pos->next)) | 230 | pos = rcu_dereference_raw(pos->next)) |
| 231 | 231 | ||
| 232 | /** | 232 | /** |
| 233 | * list_for_each_entry_rcu - iterate over rcu list of given type | 233 | * list_for_each_entry_rcu - iterate over rcu list of given type |
| @@ -257,9 +257,23 @@ static inline void list_splice_init_rcu(struct list_head *list, | |||
| 257 | * as long as the traversal is guarded by rcu_read_lock(). | 257 | * as long as the traversal is guarded by rcu_read_lock(). |
| 258 | */ | 258 | */ |
| 259 | #define list_for_each_continue_rcu(pos, head) \ | 259 | #define list_for_each_continue_rcu(pos, head) \ |
| 260 | for ((pos) = rcu_dereference((pos)->next); \ | 260 | for ((pos) = rcu_dereference_raw((pos)->next); \ |
| 261 | prefetch((pos)->next), (pos) != (head); \ | 261 | prefetch((pos)->next), (pos) != (head); \ |
| 262 | (pos) = rcu_dereference((pos)->next)) | 262 | (pos) = rcu_dereference_raw((pos)->next)) |
| 263 | |||
| 264 | /** | ||
| 265 | * list_for_each_entry_continue_rcu - continue iteration over list of given type | ||
| 266 | * @pos: the type * to use as a loop cursor. | ||
| 267 | * @head: the head for your list. | ||
| 268 | * @member: the name of the list_struct within the struct. | ||
| 269 | * | ||
| 270 | * Continue to iterate over list of given type, continuing after | ||
| 271 | * the current position. | ||
| 272 | */ | ||
| 273 | #define list_for_each_entry_continue_rcu(pos, head, member) \ | ||
| 274 | for (pos = list_entry_rcu(pos->member.next, typeof(*pos), member); \ | ||
| 275 | prefetch(pos->member.next), &pos->member != (head); \ | ||
| 276 | pos = list_entry_rcu(pos->member.next, typeof(*pos), member)) | ||
| 263 | 277 | ||
| 264 | /** | 278 | /** |
| 265 | * hlist_del_rcu - deletes entry from hash list without re-initialization | 279 | * hlist_del_rcu - deletes entry from hash list without re-initialization |
| @@ -392,6 +406,11 @@ static inline void hlist_add_after_rcu(struct hlist_node *prev, | |||
| 392 | n->next->pprev = &n->next; | 406 | n->next->pprev = &n->next; |
| 393 | } | 407 | } |
| 394 | 408 | ||
| 409 | #define __hlist_for_each_rcu(pos, head) \ | ||
| 410 | for (pos = rcu_dereference((head)->first); \ | ||
| 411 | pos && ({ prefetch(pos->next); 1; }); \ | ||
| 412 | pos = rcu_dereference(pos->next)) | ||
| 413 | |||
| 395 | /** | 414 | /** |
| 396 | * hlist_for_each_entry_rcu - iterate over rcu list of given type | 415 | * hlist_for_each_entry_rcu - iterate over rcu list of given type |
| 397 | * @tpos: the type * to use as a loop cursor. | 416 | * @tpos: the type * to use as a loop cursor. |
| @@ -404,10 +423,10 @@ static inline void hlist_add_after_rcu(struct hlist_node *prev, | |||
| 404 | * as long as the traversal is guarded by rcu_read_lock(). | 423 | * as long as the traversal is guarded by rcu_read_lock(). |
| 405 | */ | 424 | */ |
| 406 | #define hlist_for_each_entry_rcu(tpos, pos, head, member) \ | 425 | #define hlist_for_each_entry_rcu(tpos, pos, head, member) \ |
| 407 | for (pos = rcu_dereference((head)->first); \ | 426 | for (pos = rcu_dereference_raw((head)->first); \ |
| 408 | pos && ({ prefetch(pos->next); 1; }) && \ | 427 | pos && ({ prefetch(pos->next); 1; }) && \ |
| 409 | ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1; }); \ | 428 | ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1; }); \ |
| 410 | pos = rcu_dereference(pos->next)) | 429 | pos = rcu_dereference_raw(pos->next)) |
| 411 | 430 | ||
| 412 | #endif /* __KERNEL__ */ | 431 | #endif /* __KERNEL__ */ |
| 413 | #endif | 432 | #endif |
diff --git a/include/linux/rculist_nulls.h b/include/linux/rculist_nulls.h index 589a40919f01..b70ffe53cb9f 100644 --- a/include/linux/rculist_nulls.h +++ b/include/linux/rculist_nulls.h | |||
| @@ -101,10 +101,10 @@ static inline void hlist_nulls_add_head_rcu(struct hlist_nulls_node *n, | |||
| 101 | * | 101 | * |
| 102 | */ | 102 | */ |
| 103 | #define hlist_nulls_for_each_entry_rcu(tpos, pos, head, member) \ | 103 | #define hlist_nulls_for_each_entry_rcu(tpos, pos, head, member) \ |
| 104 | for (pos = rcu_dereference((head)->first); \ | 104 | for (pos = rcu_dereference_raw((head)->first); \ |
| 105 | (!is_a_nulls(pos)) && \ | 105 | (!is_a_nulls(pos)) && \ |
| 106 | ({ tpos = hlist_nulls_entry(pos, typeof(*tpos), member); 1; }); \ | 106 | ({ tpos = hlist_nulls_entry(pos, typeof(*tpos), member); 1; }); \ |
| 107 | pos = rcu_dereference(pos->next)) | 107 | pos = rcu_dereference_raw(pos->next)) |
| 108 | 108 | ||
| 109 | #endif | 109 | #endif |
| 110 | #endif | 110 | #endif |
diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h index 3ebd0b7bcb08..db266bbed23f 100644 --- a/include/linux/rcupdate.h +++ b/include/linux/rcupdate.h | |||
| @@ -41,6 +41,10 @@ | |||
| 41 | #include <linux/lockdep.h> | 41 | #include <linux/lockdep.h> |
| 42 | #include <linux/completion.h> | 42 | #include <linux/completion.h> |
| 43 | 43 | ||
| 44 | #ifdef CONFIG_RCU_TORTURE_TEST | ||
| 45 | extern int rcutorture_runnable; /* for sysctl */ | ||
| 46 | #endif /* #ifdef CONFIG_RCU_TORTURE_TEST */ | ||
| 47 | |||
| 44 | /** | 48 | /** |
| 45 | * struct rcu_head - callback structure for use with RCU | 49 | * struct rcu_head - callback structure for use with RCU |
| 46 | * @next: next update requests in a list | 50 | * @next: next update requests in a list |
| @@ -52,11 +56,6 @@ struct rcu_head { | |||
| 52 | }; | 56 | }; |
| 53 | 57 | ||
| 54 | /* Exported common interfaces */ | 58 | /* Exported common interfaces */ |
| 55 | #ifdef CONFIG_TREE_PREEMPT_RCU | ||
| 56 | extern void synchronize_rcu(void); | ||
| 57 | #else /* #ifdef CONFIG_TREE_PREEMPT_RCU */ | ||
| 58 | #define synchronize_rcu synchronize_sched | ||
| 59 | #endif /* #else #ifdef CONFIG_TREE_PREEMPT_RCU */ | ||
| 60 | extern void synchronize_rcu_bh(void); | 59 | extern void synchronize_rcu_bh(void); |
| 61 | extern void synchronize_sched(void); | 60 | extern void synchronize_sched(void); |
| 62 | extern void rcu_barrier(void); | 61 | extern void rcu_barrier(void); |
| @@ -67,12 +66,13 @@ extern int sched_expedited_torture_stats(char *page); | |||
| 67 | 66 | ||
| 68 | /* Internal to kernel */ | 67 | /* Internal to kernel */ |
| 69 | extern void rcu_init(void); | 68 | extern void rcu_init(void); |
| 70 | extern void rcu_scheduler_starting(void); | ||
| 71 | extern int rcu_needs_cpu(int cpu); | ||
| 72 | extern int rcu_scheduler_active; | 69 | extern int rcu_scheduler_active; |
| 70 | extern void rcu_scheduler_starting(void); | ||
| 73 | 71 | ||
| 74 | #if defined(CONFIG_TREE_RCU) || defined(CONFIG_TREE_PREEMPT_RCU) | 72 | #if defined(CONFIG_TREE_RCU) || defined(CONFIG_TREE_PREEMPT_RCU) |
| 75 | #include <linux/rcutree.h> | 73 | #include <linux/rcutree.h> |
| 74 | #elif defined(CONFIG_TINY_RCU) | ||
| 75 | #include <linux/rcutiny.h> | ||
| 76 | #else | 76 | #else |
| 77 | #error "Unknown RCU implementation specified to kernel configuration" | 77 | #error "Unknown RCU implementation specified to kernel configuration" |
| 78 | #endif | 78 | #endif |
| @@ -84,14 +84,185 @@ extern int rcu_scheduler_active; | |||
| 84 | } while (0) | 84 | } while (0) |
| 85 | 85 | ||
| 86 | #ifdef CONFIG_DEBUG_LOCK_ALLOC | 86 | #ifdef CONFIG_DEBUG_LOCK_ALLOC |
| 87 | |||
| 87 | extern struct lockdep_map rcu_lock_map; | 88 | extern struct lockdep_map rcu_lock_map; |
| 88 | # define rcu_read_acquire() \ | 89 | # define rcu_read_acquire() \ |
| 89 | lock_acquire(&rcu_lock_map, 0, 0, 2, 1, NULL, _THIS_IP_) | 90 | lock_acquire(&rcu_lock_map, 0, 0, 2, 1, NULL, _THIS_IP_) |
| 90 | # define rcu_read_release() lock_release(&rcu_lock_map, 1, _THIS_IP_) | 91 | # define rcu_read_release() lock_release(&rcu_lock_map, 1, _THIS_IP_) |
| 91 | #else | 92 | |
| 92 | # define rcu_read_acquire() do { } while (0) | 93 | extern struct lockdep_map rcu_bh_lock_map; |
| 93 | # define rcu_read_release() do { } while (0) | 94 | # define rcu_read_acquire_bh() \ |
| 94 | #endif | 95 | lock_acquire(&rcu_bh_lock_map, 0, 0, 2, 1, NULL, _THIS_IP_) |
| 96 | # define rcu_read_release_bh() lock_release(&rcu_bh_lock_map, 1, _THIS_IP_) | ||
| 97 | |||
| 98 | extern struct lockdep_map rcu_sched_lock_map; | ||
| 99 | # define rcu_read_acquire_sched() \ | ||
| 100 | lock_acquire(&rcu_sched_lock_map, 0, 0, 2, 1, NULL, _THIS_IP_) | ||
| 101 | # define rcu_read_release_sched() \ | ||
| 102 | lock_release(&rcu_sched_lock_map, 1, _THIS_IP_) | ||
| 103 | |||
| 104 | extern int debug_lockdep_rcu_enabled(void); | ||
| 105 | |||
| 106 | /** | ||
| 107 | * rcu_read_lock_held - might we be in RCU read-side critical section? | ||
| 108 | * | ||
| 109 | * If CONFIG_PROVE_LOCKING is selected and enabled, returns nonzero iff in | ||
| 110 | * an RCU read-side critical section. In absence of CONFIG_PROVE_LOCKING, | ||
| 111 | * this assumes we are in an RCU read-side critical section unless it can | ||
| 112 | * prove otherwise. | ||
| 113 | * | ||
| 114 | * Check rcu_scheduler_active to prevent false positives during boot. | ||
| 115 | */ | ||
| 116 | static inline int rcu_read_lock_held(void) | ||
| 117 | { | ||
| 118 | if (!debug_lockdep_rcu_enabled()) | ||
| 119 | return 1; | ||
| 120 | return lock_is_held(&rcu_lock_map); | ||
| 121 | } | ||
| 122 | |||
| 123 | /* | ||
| 124 | * rcu_read_lock_bh_held() is defined out of line to avoid #include-file | ||
| 125 | * hell. | ||
| 126 | */ | ||
| 127 | extern int rcu_read_lock_bh_held(void); | ||
| 128 | |||
| 129 | /** | ||
| 130 | * rcu_read_lock_sched_held - might we be in RCU-sched read-side critical section? | ||
| 131 | * | ||
| 132 | * If CONFIG_PROVE_LOCKING is selected and enabled, returns nonzero iff in an | ||
| 133 | * RCU-sched read-side critical section. In absence of CONFIG_PROVE_LOCKING, | ||
| 134 | * this assumes we are in an RCU-sched read-side critical section unless it | ||
| 135 | * can prove otherwise. Note that disabling of preemption (including | ||
| 136 | * disabling irqs) counts as an RCU-sched read-side critical section. | ||
| 137 | * | ||
| 138 | * Check rcu_scheduler_active to prevent false positives during boot. | ||
| 139 | */ | ||
| 140 | #ifdef CONFIG_PREEMPT | ||
| 141 | static inline int rcu_read_lock_sched_held(void) | ||
| 142 | { | ||
| 143 | int lockdep_opinion = 0; | ||
| 144 | |||
| 145 | if (!debug_lockdep_rcu_enabled()) | ||
| 146 | return 1; | ||
| 147 | if (debug_locks) | ||
| 148 | lockdep_opinion = lock_is_held(&rcu_sched_lock_map); | ||
| 149 | return lockdep_opinion || preempt_count() != 0 || irqs_disabled(); | ||
| 150 | } | ||
| 151 | #else /* #ifdef CONFIG_PREEMPT */ | ||
| 152 | static inline int rcu_read_lock_sched_held(void) | ||
| 153 | { | ||
| 154 | return 1; | ||
| 155 | } | ||
| 156 | #endif /* #else #ifdef CONFIG_PREEMPT */ | ||
| 157 | |||
| 158 | #else /* #ifdef CONFIG_DEBUG_LOCK_ALLOC */ | ||
| 159 | |||
| 160 | # define rcu_read_acquire() do { } while (0) | ||
| 161 | # define rcu_read_release() do { } while (0) | ||
| 162 | # define rcu_read_acquire_bh() do { } while (0) | ||
| 163 | # define rcu_read_release_bh() do { } while (0) | ||
| 164 | # define rcu_read_acquire_sched() do { } while (0) | ||
| 165 | # define rcu_read_release_sched() do { } while (0) | ||
| 166 | |||
| 167 | static inline int rcu_read_lock_held(void) | ||
| 168 | { | ||
| 169 | return 1; | ||
| 170 | } | ||
| 171 | |||
| 172 | static inline int rcu_read_lock_bh_held(void) | ||
| 173 | { | ||
| 174 | return 1; | ||
| 175 | } | ||
| 176 | |||
| 177 | #ifdef CONFIG_PREEMPT | ||
| 178 | static inline int rcu_read_lock_sched_held(void) | ||
| 179 | { | ||
| 180 | return !rcu_scheduler_active || preempt_count() != 0 || irqs_disabled(); | ||
| 181 | } | ||
| 182 | #else /* #ifdef CONFIG_PREEMPT */ | ||
| 183 | static inline int rcu_read_lock_sched_held(void) | ||
| 184 | { | ||
| 185 | return 1; | ||
| 186 | } | ||
| 187 | #endif /* #else #ifdef CONFIG_PREEMPT */ | ||
| 188 | |||
| 189 | #endif /* #else #ifdef CONFIG_DEBUG_LOCK_ALLOC */ | ||
| 190 | |||
| 191 | #ifdef CONFIG_PROVE_RCU | ||
| 192 | |||
| 193 | extern int rcu_my_thread_group_empty(void); | ||
| 194 | |||
| 195 | /** | ||
| 196 | * rcu_dereference_check - rcu_dereference with debug checking | ||
| 197 | * @p: The pointer to read, prior to dereferencing | ||
| 198 | * @c: The conditions under which the dereference will take place | ||
| 199 | * | ||
| 200 | * Do an rcu_dereference(), but check that the conditions under which the | ||
| 201 | * dereference will take place are correct. Typically the conditions indicate | ||
| 202 | * the various locking conditions that should be held at that point. The check | ||
| 203 | * should return true if the conditions are satisfied. | ||
| 204 | * | ||
| 205 | * For example: | ||
| 206 | * | ||
| 207 | * bar = rcu_dereference_check(foo->bar, rcu_read_lock_held() || | ||
| 208 | * lockdep_is_held(&foo->lock)); | ||
| 209 | * | ||
| 210 | * could be used to indicate to lockdep that foo->bar may only be dereferenced | ||
| 211 | * if either the RCU read lock is held, or that the lock required to replace | ||
| 212 | * the bar struct at foo->bar is held. | ||
| 213 | * | ||
| 214 | * Note that the list of conditions may also include indications of when a lock | ||
| 215 | * need not be held, for example during initialisation or destruction of the | ||
| 216 | * target struct: | ||
| 217 | * | ||
| 218 | * bar = rcu_dereference_check(foo->bar, rcu_read_lock_held() || | ||
| 219 | * lockdep_is_held(&foo->lock) || | ||
| 220 | * atomic_read(&foo->usage) == 0); | ||
| 221 | */ | ||
| 222 | #define rcu_dereference_check(p, c) \ | ||
| 223 | ({ \ | ||
| 224 | if (debug_lockdep_rcu_enabled() && !(c)) \ | ||
| 225 | lockdep_rcu_dereference(__FILE__, __LINE__); \ | ||
| 226 | rcu_dereference_raw(p); \ | ||
| 227 | }) | ||
| 228 | |||
| 229 | /** | ||
| 230 | * rcu_dereference_protected - fetch RCU pointer when updates prevented | ||
| 231 | * | ||
| 232 | * Return the value of the specified RCU-protected pointer, but omit | ||
| 233 | * both the smp_read_barrier_depends() and the ACCESS_ONCE(). This | ||
| 234 | * is useful in cases where update-side locks prevent the value of the | ||
| 235 | * pointer from changing. Please note that this primitive does -not- | ||
| 236 | * prevent the compiler from repeating this reference or combining it | ||
| 237 | * with other references, so it should not be used without protection | ||
| 238 | * of appropriate locks. | ||
| 239 | */ | ||
| 240 | #define rcu_dereference_protected(p, c) \ | ||
| 241 | ({ \ | ||
| 242 | if (debug_lockdep_rcu_enabled() && !(c)) \ | ||
| 243 | lockdep_rcu_dereference(__FILE__, __LINE__); \ | ||
| 244 | (p); \ | ||
| 245 | }) | ||
| 246 | |||
| 247 | #else /* #ifdef CONFIG_PROVE_RCU */ | ||
| 248 | |||
| 249 | #define rcu_dereference_check(p, c) rcu_dereference_raw(p) | ||
| 250 | #define rcu_dereference_protected(p, c) (p) | ||
| 251 | |||
| 252 | #endif /* #else #ifdef CONFIG_PROVE_RCU */ | ||
| 253 | |||
| 254 | /** | ||
| 255 | * rcu_access_pointer - fetch RCU pointer with no dereferencing | ||
| 256 | * | ||
| 257 | * Return the value of the specified RCU-protected pointer, but omit the | ||
| 258 | * smp_read_barrier_depends() and keep the ACCESS_ONCE(). This is useful | ||
| 259 | * when the value of this pointer is accessed, but the pointer is not | ||
| 260 | * dereferenced, for example, when testing an RCU-protected pointer against | ||
| 261 | * NULL. This may also be used in cases where update-side locks prevent | ||
| 262 | * the value of the pointer from changing, but rcu_dereference_protected() | ||
| 263 | * is a lighter-weight primitive for this use case. | ||
| 264 | */ | ||
| 265 | #define rcu_access_pointer(p) ACCESS_ONCE(p) | ||
| 95 | 266 | ||
| 96 | /** | 267 | /** |
| 97 | * rcu_read_lock - mark the beginning of an RCU read-side critical section. | 268 | * rcu_read_lock - mark the beginning of an RCU read-side critical section. |
| @@ -166,7 +337,7 @@ static inline void rcu_read_lock_bh(void) | |||
| 166 | { | 337 | { |
| 167 | __rcu_read_lock_bh(); | 338 | __rcu_read_lock_bh(); |
| 168 | __acquire(RCU_BH); | 339 | __acquire(RCU_BH); |
| 169 | rcu_read_acquire(); | 340 | rcu_read_acquire_bh(); |
| 170 | } | 341 | } |
| 171 | 342 | ||
| 172 | /* | 343 | /* |
| @@ -176,7 +347,7 @@ static inline void rcu_read_lock_bh(void) | |||
| 176 | */ | 347 | */ |
| 177 | static inline void rcu_read_unlock_bh(void) | 348 | static inline void rcu_read_unlock_bh(void) |
| 178 | { | 349 | { |
| 179 | rcu_read_release(); | 350 | rcu_read_release_bh(); |
| 180 | __release(RCU_BH); | 351 | __release(RCU_BH); |
| 181 | __rcu_read_unlock_bh(); | 352 | __rcu_read_unlock_bh(); |
| 182 | } | 353 | } |
| @@ -194,7 +365,7 @@ static inline void rcu_read_lock_sched(void) | |||
| 194 | { | 365 | { |
| 195 | preempt_disable(); | 366 | preempt_disable(); |
| 196 | __acquire(RCU_SCHED); | 367 | __acquire(RCU_SCHED); |
| 197 | rcu_read_acquire(); | 368 | rcu_read_acquire_sched(); |
| 198 | } | 369 | } |
| 199 | 370 | ||
| 200 | /* Used by lockdep and tracing: cannot be traced, cannot call lockdep. */ | 371 | /* Used by lockdep and tracing: cannot be traced, cannot call lockdep. */ |
| @@ -211,7 +382,7 @@ static inline notrace void rcu_read_lock_sched_notrace(void) | |||
| 211 | */ | 382 | */ |
| 212 | static inline void rcu_read_unlock_sched(void) | 383 | static inline void rcu_read_unlock_sched(void) |
| 213 | { | 384 | { |
| 214 | rcu_read_release(); | 385 | rcu_read_release_sched(); |
| 215 | __release(RCU_SCHED); | 386 | __release(RCU_SCHED); |
| 216 | preempt_enable(); | 387 | preempt_enable(); |
| 217 | } | 388 | } |
| @@ -225,22 +396,49 @@ static inline notrace void rcu_read_unlock_sched_notrace(void) | |||
| 225 | 396 | ||
| 226 | 397 | ||
| 227 | /** | 398 | /** |
| 228 | * rcu_dereference - fetch an RCU-protected pointer in an | 399 | * rcu_dereference_raw - fetch an RCU-protected pointer |
| 229 | * RCU read-side critical section. This pointer may later | 400 | * |
| 230 | * be safely dereferenced. | 401 | * The caller must be within some flavor of RCU read-side critical |
| 402 | * section, or must be otherwise preventing the pointer from changing, | ||
| 403 | * for example, by holding an appropriate lock. This pointer may later | ||
| 404 | * be safely dereferenced. It is the caller's responsibility to have | ||
| 405 | * done the right thing, as this primitive does no checking of any kind. | ||
| 231 | * | 406 | * |
| 232 | * Inserts memory barriers on architectures that require them | 407 | * Inserts memory barriers on architectures that require them |
| 233 | * (currently only the Alpha), and, more importantly, documents | 408 | * (currently only the Alpha), and, more importantly, documents |
| 234 | * exactly which pointers are protected by RCU. | 409 | * exactly which pointers are protected by RCU. |
| 235 | */ | 410 | */ |
| 236 | 411 | #define rcu_dereference_raw(p) ({ \ | |
| 237 | #define rcu_dereference(p) ({ \ | ||
| 238 | typeof(p) _________p1 = ACCESS_ONCE(p); \ | 412 | typeof(p) _________p1 = ACCESS_ONCE(p); \ |
| 239 | smp_read_barrier_depends(); \ | 413 | smp_read_barrier_depends(); \ |
| 240 | (_________p1); \ | 414 | (_________p1); \ |
| 241 | }) | 415 | }) |
| 242 | 416 | ||
| 243 | /** | 417 | /** |
| 418 | * rcu_dereference - fetch an RCU-protected pointer, checking for RCU | ||
| 419 | * | ||
| 420 | * Makes rcu_dereference_check() do the dirty work. | ||
| 421 | */ | ||
| 422 | #define rcu_dereference(p) \ | ||
| 423 | rcu_dereference_check(p, rcu_read_lock_held()) | ||
| 424 | |||
| 425 | /** | ||
| 426 | * rcu_dereference_bh - fetch an RCU-protected pointer, checking for RCU-bh | ||
| 427 | * | ||
| 428 | * Makes rcu_dereference_check() do the dirty work. | ||
| 429 | */ | ||
| 430 | #define rcu_dereference_bh(p) \ | ||
| 431 | rcu_dereference_check(p, rcu_read_lock_bh_held()) | ||
| 432 | |||
| 433 | /** | ||
| 434 | * rcu_dereference_sched - fetch RCU-protected pointer, checking for RCU-sched | ||
| 435 | * | ||
| 436 | * Makes rcu_dereference_check() do the dirty work. | ||
| 437 | */ | ||
| 438 | #define rcu_dereference_sched(p) \ | ||
| 439 | rcu_dereference_check(p, rcu_read_lock_sched_held()) | ||
| 440 | |||
| 441 | /** | ||
| 244 | * rcu_assign_pointer - assign (publicize) a pointer to a newly | 442 | * rcu_assign_pointer - assign (publicize) a pointer to a newly |
| 245 | * initialized structure that will be dereferenced by RCU read-side | 443 | * initialized structure that will be dereferenced by RCU read-side |
| 246 | * critical sections. Returns the value assigned. | 444 | * critical sections. Returns the value assigned. |
diff --git a/include/linux/rcutiny.h b/include/linux/rcutiny.h new file mode 100644 index 000000000000..a5195875480a --- /dev/null +++ b/include/linux/rcutiny.h | |||
| @@ -0,0 +1,117 @@ | |||
| 1 | /* | ||
| 2 | * Read-Copy Update mechanism for mutual exclusion, the Bloatwatch edition. | ||
| 3 | * | ||
| 4 | * This program is free software; you can redistribute it and/or modify | ||
| 5 | * it under the terms of the GNU General Public License as published by | ||
| 6 | * the Free Software Foundation; either version 2 of the License, or | ||
| 7 | * (at your option) any later version. | ||
| 8 | * | ||
| 9 | * This program is distributed in the hope that it will be useful, | ||
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 12 | * GNU General Public License for more details. | ||
| 13 | * | ||
| 14 | * You should have received a copy of the GNU General Public License | ||
| 15 | * along with this program; if not, write to the Free Software | ||
| 16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | ||
| 17 | * | ||
| 18 | * Copyright IBM Corporation, 2008 | ||
| 19 | * | ||
| 20 | * Author: Paul E. McKenney <paulmck@linux.vnet.ibm.com> | ||
| 21 | * | ||
| 22 | * For detailed explanation of Read-Copy Update mechanism see - | ||
| 23 | * Documentation/RCU | ||
| 24 | */ | ||
| 25 | #ifndef __LINUX_TINY_H | ||
| 26 | #define __LINUX_TINY_H | ||
| 27 | |||
| 28 | #include <linux/cache.h> | ||
| 29 | |||
| 30 | void rcu_sched_qs(int cpu); | ||
| 31 | void rcu_bh_qs(int cpu); | ||
| 32 | |||
| 33 | #define __rcu_read_lock() preempt_disable() | ||
| 34 | #define __rcu_read_unlock() preempt_enable() | ||
| 35 | #define __rcu_read_lock_bh() local_bh_disable() | ||
| 36 | #define __rcu_read_unlock_bh() local_bh_enable() | ||
| 37 | #define call_rcu_sched call_rcu | ||
| 38 | |||
| 39 | #define rcu_init_sched() do { } while (0) | ||
| 40 | extern void rcu_check_callbacks(int cpu, int user); | ||
| 41 | |||
| 42 | static inline int rcu_needs_cpu(int cpu) | ||
| 43 | { | ||
| 44 | return 0; | ||
| 45 | } | ||
| 46 | |||
| 47 | /* | ||
| 48 | * Return the number of grace periods. | ||
| 49 | */ | ||
| 50 | static inline long rcu_batches_completed(void) | ||
| 51 | { | ||
| 52 | return 0; | ||
| 53 | } | ||
| 54 | |||
| 55 | /* | ||
| 56 | * Return the number of bottom-half grace periods. | ||
| 57 | */ | ||
| 58 | static inline long rcu_batches_completed_bh(void) | ||
| 59 | { | ||
| 60 | return 0; | ||
| 61 | } | ||
| 62 | |||
| 63 | extern int rcu_expedited_torture_stats(char *page); | ||
| 64 | |||
| 65 | static inline void rcu_force_quiescent_state(void) | ||
| 66 | { | ||
| 67 | } | ||
| 68 | |||
| 69 | static inline void rcu_bh_force_quiescent_state(void) | ||
| 70 | { | ||
| 71 | } | ||
| 72 | |||
| 73 | static inline void rcu_sched_force_quiescent_state(void) | ||
| 74 | { | ||
| 75 | } | ||
| 76 | |||
| 77 | #define synchronize_rcu synchronize_sched | ||
| 78 | |||
| 79 | static inline void synchronize_rcu_expedited(void) | ||
| 80 | { | ||
| 81 | synchronize_sched(); | ||
| 82 | } | ||
| 83 | |||
| 84 | static inline void synchronize_rcu_bh_expedited(void) | ||
| 85 | { | ||
| 86 | synchronize_sched(); | ||
| 87 | } | ||
| 88 | |||
| 89 | struct notifier_block; | ||
| 90 | |||
| 91 | #ifdef CONFIG_NO_HZ | ||
| 92 | |||
| 93 | extern void rcu_enter_nohz(void); | ||
| 94 | extern void rcu_exit_nohz(void); | ||
| 95 | |||
| 96 | #else /* #ifdef CONFIG_NO_HZ */ | ||
| 97 | |||
| 98 | static inline void rcu_enter_nohz(void) | ||
| 99 | { | ||
| 100 | } | ||
| 101 | |||
| 102 | static inline void rcu_exit_nohz(void) | ||
| 103 | { | ||
| 104 | } | ||
| 105 | |||
| 106 | #endif /* #else #ifdef CONFIG_NO_HZ */ | ||
| 107 | |||
| 108 | static inline void exit_rcu(void) | ||
| 109 | { | ||
| 110 | } | ||
| 111 | |||
| 112 | static inline int rcu_preempt_depth(void) | ||
| 113 | { | ||
| 114 | return 0; | ||
| 115 | } | ||
| 116 | |||
| 117 | #endif /* __LINUX_RCUTINY_H */ | ||
diff --git a/include/linux/rcutree.h b/include/linux/rcutree.h index 9642c6bcb399..42cc3a04779e 100644 --- a/include/linux/rcutree.h +++ b/include/linux/rcutree.h | |||
| @@ -34,8 +34,6 @@ struct notifier_block; | |||
| 34 | 34 | ||
| 35 | extern void rcu_sched_qs(int cpu); | 35 | extern void rcu_sched_qs(int cpu); |
| 36 | extern void rcu_bh_qs(int cpu); | 36 | extern void rcu_bh_qs(int cpu); |
| 37 | extern int rcu_cpu_notify(struct notifier_block *self, | ||
| 38 | unsigned long action, void *hcpu); | ||
| 39 | extern int rcu_needs_cpu(int cpu); | 37 | extern int rcu_needs_cpu(int cpu); |
| 40 | extern int rcu_expedited_torture_stats(char *page); | 38 | extern int rcu_expedited_torture_stats(char *page); |
| 41 | 39 | ||
| @@ -43,8 +41,15 @@ extern int rcu_expedited_torture_stats(char *page); | |||
| 43 | 41 | ||
| 44 | extern void __rcu_read_lock(void); | 42 | extern void __rcu_read_lock(void); |
| 45 | extern void __rcu_read_unlock(void); | 43 | extern void __rcu_read_unlock(void); |
| 44 | extern void synchronize_rcu(void); | ||
| 46 | extern void exit_rcu(void); | 45 | extern void exit_rcu(void); |
| 47 | 46 | ||
| 47 | /* | ||
| 48 | * Defined as macro as it is a very low level header | ||
| 49 | * included from areas that don't even know about current | ||
| 50 | */ | ||
| 51 | #define rcu_preempt_depth() (current->rcu_read_lock_nesting) | ||
| 52 | |||
| 48 | #else /* #ifdef CONFIG_TREE_PREEMPT_RCU */ | 53 | #else /* #ifdef CONFIG_TREE_PREEMPT_RCU */ |
| 49 | 54 | ||
| 50 | static inline void __rcu_read_lock(void) | 55 | static inline void __rcu_read_lock(void) |
| @@ -57,12 +62,17 @@ static inline void __rcu_read_unlock(void) | |||
| 57 | preempt_enable(); | 62 | preempt_enable(); |
| 58 | } | 63 | } |
| 59 | 64 | ||
| 60 | #define __synchronize_sched() synchronize_rcu() | 65 | #define synchronize_rcu synchronize_sched |
| 61 | 66 | ||
| 62 | static inline void exit_rcu(void) | 67 | static inline void exit_rcu(void) |
| 63 | { | 68 | { |
| 64 | } | 69 | } |
| 65 | 70 | ||
| 71 | static inline int rcu_preempt_depth(void) | ||
| 72 | { | ||
| 73 | return 0; | ||
| 74 | } | ||
| 75 | |||
| 66 | #endif /* #else #ifdef CONFIG_TREE_PREEMPT_RCU */ | 76 | #endif /* #else #ifdef CONFIG_TREE_PREEMPT_RCU */ |
| 67 | 77 | ||
| 68 | static inline void __rcu_read_lock_bh(void) | 78 | static inline void __rcu_read_lock_bh(void) |
| @@ -83,12 +93,14 @@ static inline void synchronize_rcu_bh_expedited(void) | |||
| 83 | synchronize_sched_expedited(); | 93 | synchronize_sched_expedited(); |
| 84 | } | 94 | } |
| 85 | 95 | ||
| 86 | extern void __rcu_init(void); | ||
| 87 | extern void rcu_check_callbacks(int cpu, int user); | 96 | extern void rcu_check_callbacks(int cpu, int user); |
| 88 | 97 | ||
| 89 | extern long rcu_batches_completed(void); | 98 | extern long rcu_batches_completed(void); |
| 90 | extern long rcu_batches_completed_bh(void); | 99 | extern long rcu_batches_completed_bh(void); |
| 91 | extern long rcu_batches_completed_sched(void); | 100 | extern long rcu_batches_completed_sched(void); |
| 101 | extern void rcu_force_quiescent_state(void); | ||
| 102 | extern void rcu_bh_force_quiescent_state(void); | ||
| 103 | extern void rcu_sched_force_quiescent_state(void); | ||
| 92 | 104 | ||
| 93 | #ifdef CONFIG_NO_HZ | 105 | #ifdef CONFIG_NO_HZ |
| 94 | void rcu_enter_nohz(void); | 106 | void rcu_enter_nohz(void); |
diff --git a/include/linux/rds.h b/include/linux/rds.h index 89d46e1afbb1..cab4994c2f63 100644 --- a/include/linux/rds.h +++ b/include/linux/rds.h | |||
| @@ -56,6 +56,7 @@ | |||
| 56 | /* deprecated: RDS_BARRIER 4 */ | 56 | /* deprecated: RDS_BARRIER 4 */ |
| 57 | #define RDS_RECVERR 5 | 57 | #define RDS_RECVERR 5 |
| 58 | #define RDS_CONG_MONITOR 6 | 58 | #define RDS_CONG_MONITOR 6 |
| 59 | #define RDS_GET_MR_FOR_DEST 7 | ||
| 59 | 60 | ||
| 60 | /* | 61 | /* |
| 61 | * Control message types for SOL_RDS. | 62 | * Control message types for SOL_RDS. |
| @@ -224,6 +225,13 @@ struct rds_get_mr_args { | |||
| 224 | uint64_t flags; | 225 | uint64_t flags; |
| 225 | }; | 226 | }; |
| 226 | 227 | ||
| 228 | struct rds_get_mr_for_dest_args { | ||
| 229 | struct sockaddr_storage dest_addr; | ||
| 230 | struct rds_iovec vec; | ||
| 231 | u_int64_t cookie_addr; | ||
| 232 | uint64_t flags; | ||
| 233 | }; | ||
| 234 | |||
| 227 | struct rds_free_mr_args { | 235 | struct rds_free_mr_args { |
| 228 | rds_rdma_cookie_t cookie; | 236 | rds_rdma_cookie_t cookie; |
| 229 | u_int64_t flags; | 237 | u_int64_t flags; |
diff --git a/include/linux/reboot.h b/include/linux/reboot.h index 988e55fe649b..3005d5a7fce5 100644 --- a/include/linux/reboot.h +++ b/include/linux/reboot.h | |||
| @@ -64,6 +64,7 @@ extern void kernel_restart(char *cmd); | |||
| 64 | extern void kernel_halt(void); | 64 | extern void kernel_halt(void); |
| 65 | extern void kernel_power_off(void); | 65 | extern void kernel_power_off(void); |
| 66 | 66 | ||
| 67 | extern int C_A_D; /* for sysctl */ | ||
| 67 | void ctrl_alt_del(void); | 68 | void ctrl_alt_del(void); |
| 68 | 69 | ||
| 69 | #define POWEROFF_CMD_PATH_LEN 256 | 70 | #define POWEROFF_CMD_PATH_LEN 256 |
diff --git a/include/linux/regulator/consumer.h b/include/linux/regulator/consumer.h index 490c5b37b6d7..ebd747265294 100644 --- a/include/linux/regulator/consumer.h +++ b/include/linux/regulator/consumer.h | |||
| @@ -35,6 +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> | ||
| 39 | |||
| 38 | /* | 40 | /* |
| 39 | * Regulator operating modes. | 41 | * Regulator operating modes. |
| 40 | * | 42 | * |
| @@ -87,8 +89,9 @@ | |||
| 87 | * REGULATION_OUT Regulator output is out of regulation. | 89 | * REGULATION_OUT Regulator output is out of regulation. |
| 88 | * FAIL Regulator output has failed. | 90 | * FAIL Regulator output has failed. |
| 89 | * OVER_TEMP Regulator over temp. | 91 | * OVER_TEMP Regulator over temp. |
| 90 | * FORCE_DISABLE Regulator shut down by software. | 92 | * FORCE_DISABLE Regulator forcibly shut down by software. |
| 91 | * VOLTAGE_CHANGE Regulator voltage changed. | 93 | * VOLTAGE_CHANGE Regulator voltage changed. |
| 94 | * DISABLE Regulator was disabled. | ||
| 92 | * | 95 | * |
| 93 | * NOTE: These events can be OR'ed together when passed into handler. | 96 | * NOTE: These events can be OR'ed together when passed into handler. |
| 94 | */ | 97 | */ |
| @@ -100,6 +103,7 @@ | |||
| 100 | #define REGULATOR_EVENT_OVER_TEMP 0x10 | 103 | #define REGULATOR_EVENT_OVER_TEMP 0x10 |
| 101 | #define REGULATOR_EVENT_FORCE_DISABLE 0x20 | 104 | #define REGULATOR_EVENT_FORCE_DISABLE 0x20 |
| 102 | #define REGULATOR_EVENT_VOLTAGE_CHANGE 0x40 | 105 | #define REGULATOR_EVENT_VOLTAGE_CHANGE 0x40 |
| 106 | #define REGULATOR_EVENT_DISABLE 0x80 | ||
| 103 | 107 | ||
| 104 | struct regulator; | 108 | struct regulator; |
| 105 | 109 | ||
| @@ -179,9 +183,13 @@ static inline struct regulator *__must_check regulator_get(struct device *dev, | |||
| 179 | { | 183 | { |
| 180 | /* Nothing except the stubbed out regulator API should be | 184 | /* Nothing except the stubbed out regulator API should be |
| 181 | * looking at the value except to check if it is an error | 185 | * looking at the value except to check if it is an error |
| 182 | * value so the actual return value doesn't matter. | 186 | * value. Drivers are free to handle NULL specifically by |
| 187 | * skipping all regulator API calls, but they don't have to. | ||
| 188 | * Drivers which don't, should make sure they properly handle | ||
| 189 | * corner cases of the API, such as regulator_get_voltage() | ||
| 190 | * returning 0. | ||
| 183 | */ | 191 | */ |
| 184 | return (struct regulator *)id; | 192 | return NULL; |
| 185 | } | 193 | } |
| 186 | static inline void regulator_put(struct regulator *regulator) | 194 | static inline void regulator_put(struct regulator *regulator) |
| 187 | { | 195 | { |
diff --git a/include/linux/regulator/driver.h b/include/linux/regulator/driver.h index 31f2055eae28..592cd7c642c2 100644 --- a/include/linux/regulator/driver.h +++ b/include/linux/regulator/driver.h | |||
| @@ -58,6 +58,9 @@ enum regulator_status { | |||
| 58 | * @get_optimum_mode: Get the most efficient operating mode for the regulator | 58 | * @get_optimum_mode: Get the most efficient operating mode for the regulator |
| 59 | * when running with the specified parameters. | 59 | * when running with the specified parameters. |
| 60 | * | 60 | * |
| 61 | * @enable_time: Time taken for the regulator voltage output voltage to | ||
| 62 | * stabalise after being enabled, in microseconds. | ||
| 63 | * | ||
| 61 | * @set_suspend_voltage: Set the voltage for the regulator when the system | 64 | * @set_suspend_voltage: Set the voltage for the regulator when the system |
| 62 | * is suspended. | 65 | * is suspended. |
| 63 | * @set_suspend_enable: Mark the regulator as enabled when the system is | 66 | * @set_suspend_enable: Mark the regulator as enabled when the system is |
| @@ -93,6 +96,9 @@ struct regulator_ops { | |||
| 93 | int (*set_mode) (struct regulator_dev *, unsigned int mode); | 96 | int (*set_mode) (struct regulator_dev *, unsigned int mode); |
| 94 | unsigned int (*get_mode) (struct regulator_dev *); | 97 | unsigned int (*get_mode) (struct regulator_dev *); |
| 95 | 98 | ||
| 99 | /* Time taken to enable the regulator */ | ||
| 100 | int (*enable_time) (struct regulator_dev *); | ||
| 101 | |||
| 96 | /* report regulator status ... most other accessors report | 102 | /* report regulator status ... most other accessors report |
| 97 | * control inputs, this reports results of combining inputs | 103 | * control inputs, this reports results of combining inputs |
| 98 | * from Linux (and other sources) with the actual load. | 104 | * from Linux (and other sources) with the actual load. |
diff --git a/include/linux/regulator/fixed.h b/include/linux/regulator/fixed.h index e94a4a1c7c8a..ffd7d508e726 100644 --- a/include/linux/regulator/fixed.h +++ b/include/linux/regulator/fixed.h | |||
| @@ -25,6 +25,7 @@ struct regulator_init_data; | |||
| 25 | * @microvolts: Output voltage of regulator | 25 | * @microvolts: Output voltage of regulator |
| 26 | * @gpio: GPIO to use for enable control | 26 | * @gpio: GPIO to use for enable control |
| 27 | * set to -EINVAL if not used | 27 | * set to -EINVAL if not used |
| 28 | * @startup_delay: Start-up time in microseconds | ||
| 28 | * @enable_high: Polarity of enable GPIO | 29 | * @enable_high: Polarity of enable GPIO |
| 29 | * 1 = Active high, 0 = Active low | 30 | * 1 = Active high, 0 = Active low |
| 30 | * @enabled_at_boot: Whether regulator has been enabled at | 31 | * @enabled_at_boot: Whether regulator has been enabled at |
| @@ -41,6 +42,7 @@ struct fixed_voltage_config { | |||
| 41 | const char *supply_name; | 42 | const char *supply_name; |
| 42 | int microvolts; | 43 | int microvolts; |
| 43 | int gpio; | 44 | int gpio; |
| 45 | unsigned startup_delay; | ||
| 44 | unsigned enable_high:1; | 46 | unsigned enable_high:1; |
| 45 | unsigned enabled_at_boot:1; | 47 | unsigned enabled_at_boot:1; |
| 46 | struct regulator_init_data *init_data; | 48 | struct regulator_init_data *init_data; |
diff --git a/include/linux/regulator/machine.h b/include/linux/regulator/machine.h index 87f5f176d4ef..234a8476cba8 100644 --- a/include/linux/regulator/machine.h +++ b/include/linux/regulator/machine.h | |||
| @@ -43,16 +43,20 @@ struct regulator; | |||
| 43 | /** | 43 | /** |
| 44 | * struct regulator_state - regulator state during low power system states | 44 | * struct regulator_state - regulator state during low power system states |
| 45 | * | 45 | * |
| 46 | * This describes a regulators state during a system wide low power state. | 46 | * This describes a regulators state during a system wide low power |
| 47 | * state. One of enabled or disabled must be set for the | ||
| 48 | * configuration to be applied. | ||
| 47 | * | 49 | * |
| 48 | * @uV: Operating voltage during suspend. | 50 | * @uV: Operating voltage during suspend. |
| 49 | * @mode: Operating mode during suspend. | 51 | * @mode: Operating mode during suspend. |
| 50 | * @enabled: Enabled during suspend. | 52 | * @enabled: Enabled during suspend. |
| 53 | * @disabled: Disabled during suspend. | ||
| 51 | */ | 54 | */ |
| 52 | struct regulator_state { | 55 | struct regulator_state { |
| 53 | int uV; /* suspend voltage */ | 56 | int uV; /* suspend voltage */ |
| 54 | unsigned int mode; /* suspend regulator operating mode */ | 57 | unsigned int mode; /* suspend regulator operating mode */ |
| 55 | int enabled; /* is regulator enabled in this suspend state */ | 58 | int enabled; /* is regulator enabled in this suspend state */ |
| 59 | int disabled; /* is the regulator disbled in this suspend state */ | ||
| 56 | }; | 60 | }; |
| 57 | 61 | ||
| 58 | /** | 62 | /** |
diff --git a/include/linux/regulator/max8649.h b/include/linux/regulator/max8649.h new file mode 100644 index 000000000000..417d14ecd5cb --- /dev/null +++ b/include/linux/regulator/max8649.h | |||
| @@ -0,0 +1,44 @@ | |||
| 1 | /* | ||
| 2 | * Interface of Maxim max8649 | ||
| 3 | * | ||
| 4 | * Copyright (C) 2009-2010 Marvell International Ltd. | ||
| 5 | * Haojian Zhuang <haojian.zhuang@marvell.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 __LINUX_REGULATOR_MAX8649_H | ||
| 13 | #define __LINUX_REGULATOR_MAX8649_H | ||
| 14 | |||
| 15 | #include <linux/regulator/machine.h> | ||
| 16 | |||
| 17 | enum { | ||
| 18 | MAX8649_EXTCLK_26MHZ = 0, | ||
| 19 | MAX8649_EXTCLK_13MHZ, | ||
| 20 | MAX8649_EXTCLK_19MHZ, /* 19.2MHz */ | ||
| 21 | }; | ||
| 22 | |||
| 23 | enum { | ||
| 24 | MAX8649_RAMP_32MV = 0, | ||
| 25 | MAX8649_RAMP_16MV, | ||
| 26 | MAX8649_RAMP_8MV, | ||
| 27 | MAX8649_RAMP_4MV, | ||
| 28 | MAX8649_RAMP_2MV, | ||
| 29 | MAX8649_RAMP_1MV, | ||
| 30 | MAX8649_RAMP_0_5MV, | ||
| 31 | MAX8649_RAMP_0_25MV, | ||
| 32 | }; | ||
| 33 | |||
| 34 | struct max8649_platform_data { | ||
| 35 | struct regulator_init_data *regulator; | ||
| 36 | |||
| 37 | unsigned mode:2; /* bit[1:0] = VID1,VID0 */ | ||
| 38 | unsigned extclk_freq:2; | ||
| 39 | unsigned extclk:1; | ||
| 40 | unsigned ramp_timing:3; | ||
| 41 | unsigned ramp_down:1; | ||
| 42 | }; | ||
| 43 | |||
| 44 | #endif /* __LINUX_REGULATOR_MAX8649_H */ | ||
diff --git a/include/linux/regulator/max8660.h b/include/linux/regulator/max8660.h new file mode 100644 index 000000000000..9936763621c7 --- /dev/null +++ b/include/linux/regulator/max8660.h | |||
| @@ -0,0 +1,57 @@ | |||
| 1 | /* | ||
| 2 | * max8660.h -- Voltage regulation for the Maxim 8660/8661 | ||
| 3 | * | ||
| 4 | * Copyright (C) 2009 Wolfram Sang, Pengutronix e.K. | ||
| 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; version 2 of the License. | ||
| 9 | * | ||
| 10 | * This program is distributed in the hope that it will be useful, | ||
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 13 | * GNU General Public License for more details. | ||
| 14 | * | ||
| 15 | * You should have received a copy of the GNU General Public License | ||
| 16 | * along with this program; if not, write to the Free Software | ||
| 17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
| 18 | */ | ||
| 19 | |||
| 20 | #ifndef __LINUX_REGULATOR_MAX8660_H | ||
| 21 | #define __LINUX_REGULATOR_MAX8660_H | ||
| 22 | |||
| 23 | #include <linux/regulator/machine.h> | ||
| 24 | |||
| 25 | enum { | ||
| 26 | MAX8660_V3, | ||
| 27 | MAX8660_V4, | ||
| 28 | MAX8660_V5, | ||
| 29 | MAX8660_V6, | ||
| 30 | MAX8660_V7, | ||
| 31 | MAX8660_V_END, | ||
| 32 | }; | ||
| 33 | |||
| 34 | /** | ||
| 35 | * max8660_subdev_data - regulator subdev data | ||
| 36 | * @id: regulator id | ||
| 37 | * @name: regulator name | ||
| 38 | * @platform_data: regulator init data | ||
| 39 | */ | ||
| 40 | struct max8660_subdev_data { | ||
| 41 | int id; | ||
| 42 | char *name; | ||
| 43 | struct regulator_init_data *platform_data; | ||
| 44 | }; | ||
| 45 | |||
| 46 | /** | ||
| 47 | * max8660_platform_data - platform data for max8660 | ||
| 48 | * @num_subdevs: number of regulators used | ||
| 49 | * @subdevs: pointer to regulators used | ||
| 50 | * @en34_is_high: if EN34 is driven high, regulators cannot be en-/disabled. | ||
| 51 | */ | ||
| 52 | struct max8660_platform_data { | ||
| 53 | int num_subdevs; | ||
| 54 | struct max8660_subdev_data *subdevs; | ||
| 55 | unsigned en34_is_high:1; | ||
| 56 | }; | ||
| 57 | #endif | ||
diff --git a/include/linux/reiserfs_fs.h b/include/linux/reiserfs_fs.h index dd31e7bae35c..3b603f474186 100644 --- a/include/linux/reiserfs_fs.h +++ b/include/linux/reiserfs_fs.h | |||
| @@ -52,11 +52,89 @@ | |||
| 52 | #define REISERFS_IOC32_GETVERSION FS_IOC32_GETVERSION | 52 | #define REISERFS_IOC32_GETVERSION FS_IOC32_GETVERSION |
| 53 | #define REISERFS_IOC32_SETVERSION FS_IOC32_SETVERSION | 53 | #define REISERFS_IOC32_SETVERSION FS_IOC32_SETVERSION |
| 54 | 54 | ||
| 55 | /* Locking primitives */ | 55 | /* |
| 56 | /* Right now we are still falling back to (un)lock_kernel, but eventually that | 56 | * Locking primitives. The write lock is a per superblock |
| 57 | would evolve into real per-fs locks */ | 57 | * special mutex that has properties close to the Big Kernel Lock |
| 58 | #define reiserfs_write_lock( sb ) lock_kernel() | 58 | * which was used in the previous locking scheme. |
| 59 | #define reiserfs_write_unlock( sb ) unlock_kernel() | 59 | */ |
| 60 | void reiserfs_write_lock(struct super_block *s); | ||
| 61 | void reiserfs_write_unlock(struct super_block *s); | ||
| 62 | int reiserfs_write_lock_once(struct super_block *s); | ||
| 63 | void reiserfs_write_unlock_once(struct super_block *s, int lock_depth); | ||
| 64 | |||
| 65 | #ifdef CONFIG_REISERFS_CHECK | ||
| 66 | void reiserfs_lock_check_recursive(struct super_block *s); | ||
| 67 | #else | ||
| 68 | static inline void reiserfs_lock_check_recursive(struct super_block *s) { } | ||
| 69 | #endif | ||
| 70 | |||
| 71 | /* | ||
| 72 | * Several mutexes depend on the write lock. | ||
| 73 | * However sometimes we want to relax the write lock while we hold | ||
| 74 | * these mutexes, according to the release/reacquire on schedule() | ||
| 75 | * properties of the Bkl that were used. | ||
| 76 | * Reiserfs performances and locking were based on this scheme. | ||
| 77 | * Now that the write lock is a mutex and not the bkl anymore, doing so | ||
| 78 | * may result in a deadlock: | ||
| 79 | * | ||
| 80 | * A acquire write_lock | ||
| 81 | * A acquire j_commit_mutex | ||
| 82 | * A release write_lock and wait for something | ||
| 83 | * B acquire write_lock | ||
| 84 | * B can't acquire j_commit_mutex and sleep | ||
| 85 | * A can't acquire write lock anymore | ||
| 86 | * deadlock | ||
| 87 | * | ||
| 88 | * What we do here is avoiding such deadlock by playing the same game | ||
| 89 | * than the Bkl: if we can't acquire a mutex that depends on the write lock, | ||
| 90 | * we release the write lock, wait a bit and then retry. | ||
| 91 | * | ||
| 92 | * The mutexes concerned by this hack are: | ||
| 93 | * - The commit mutex of a journal list | ||
| 94 | * - The flush mutex | ||
| 95 | * - The journal lock | ||
| 96 | * - The inode mutex | ||
| 97 | */ | ||
| 98 | static inline void reiserfs_mutex_lock_safe(struct mutex *m, | ||
| 99 | struct super_block *s) | ||
| 100 | { | ||
| 101 | reiserfs_lock_check_recursive(s); | ||
| 102 | reiserfs_write_unlock(s); | ||
| 103 | mutex_lock(m); | ||
| 104 | reiserfs_write_lock(s); | ||
| 105 | } | ||
| 106 | |||
| 107 | static inline void | ||
| 108 | reiserfs_mutex_lock_nested_safe(struct mutex *m, unsigned int subclass, | ||
| 109 | struct super_block *s) | ||
| 110 | { | ||
| 111 | reiserfs_lock_check_recursive(s); | ||
| 112 | reiserfs_write_unlock(s); | ||
| 113 | mutex_lock_nested(m, subclass); | ||
| 114 | reiserfs_write_lock(s); | ||
| 115 | } | ||
| 116 | |||
| 117 | static inline void | ||
| 118 | reiserfs_down_read_safe(struct rw_semaphore *sem, struct super_block *s) | ||
| 119 | { | ||
| 120 | reiserfs_lock_check_recursive(s); | ||
| 121 | reiserfs_write_unlock(s); | ||
| 122 | down_read(sem); | ||
| 123 | reiserfs_write_lock(s); | ||
| 124 | } | ||
| 125 | |||
| 126 | /* | ||
| 127 | * When we schedule, we usually want to also release the write lock, | ||
| 128 | * according to the previous bkl based locking scheme of reiserfs. | ||
| 129 | */ | ||
| 130 | static inline void reiserfs_cond_resched(struct super_block *s) | ||
| 131 | { | ||
| 132 | if (need_resched()) { | ||
| 133 | reiserfs_write_unlock(s); | ||
| 134 | schedule(); | ||
| 135 | reiserfs_write_lock(s); | ||
| 136 | } | ||
| 137 | } | ||
| 60 | 138 | ||
| 61 | struct fid; | 139 | struct fid; |
| 62 | 140 | ||
| @@ -1329,7 +1407,11 @@ static inline loff_t max_reiserfs_offset(struct inode *inode) | |||
| 1329 | #define get_generation(s) atomic_read (&fs_generation(s)) | 1407 | #define get_generation(s) atomic_read (&fs_generation(s)) |
| 1330 | #define FILESYSTEM_CHANGED_TB(tb) (get_generation((tb)->tb_sb) != (tb)->fs_gen) | 1408 | #define FILESYSTEM_CHANGED_TB(tb) (get_generation((tb)->tb_sb) != (tb)->fs_gen) |
| 1331 | #define __fs_changed(gen,s) (gen != get_generation (s)) | 1409 | #define __fs_changed(gen,s) (gen != get_generation (s)) |
| 1332 | #define fs_changed(gen,s) ({cond_resched(); __fs_changed(gen, s);}) | 1410 | #define fs_changed(gen,s) \ |
| 1411 | ({ \ | ||
| 1412 | reiserfs_cond_resched(s); \ | ||
| 1413 | __fs_changed(gen, s); \ | ||
| 1414 | }) | ||
| 1333 | 1415 | ||
| 1334 | /***************************************************************************/ | 1416 | /***************************************************************************/ |
| 1335 | /* FIXATE NODES */ | 1417 | /* FIXATE NODES */ |
| @@ -1952,7 +2034,7 @@ void reiserfs_read_locked_inode(struct inode *inode, | |||
| 1952 | int reiserfs_find_actor(struct inode *inode, void *p); | 2034 | int reiserfs_find_actor(struct inode *inode, void *p); |
| 1953 | int reiserfs_init_locked_inode(struct inode *inode, void *p); | 2035 | int reiserfs_init_locked_inode(struct inode *inode, void *p); |
| 1954 | void reiserfs_delete_inode(struct inode *inode); | 2036 | void reiserfs_delete_inode(struct inode *inode); |
| 1955 | int reiserfs_write_inode(struct inode *inode, int); | 2037 | int reiserfs_write_inode(struct inode *inode, struct writeback_control *wbc); |
| 1956 | int reiserfs_get_block(struct inode *inode, sector_t block, | 2038 | int reiserfs_get_block(struct inode *inode, sector_t block, |
| 1957 | struct buffer_head *bh_result, int create); | 2039 | struct buffer_head *bh_result, int create); |
| 1958 | struct dentry *reiserfs_fh_to_dentry(struct super_block *sb, struct fid *fid, | 2040 | struct dentry *reiserfs_fh_to_dentry(struct super_block *sb, struct fid *fid, |
| @@ -1995,25 +2077,12 @@ void set_de_name_and_namelen(struct reiserfs_dir_entry *de); | |||
| 1995 | int search_by_entry_key(struct super_block *sb, const struct cpu_key *key, | 2077 | int search_by_entry_key(struct super_block *sb, const struct cpu_key *key, |
| 1996 | struct treepath *path, struct reiserfs_dir_entry *de); | 2078 | struct treepath *path, struct reiserfs_dir_entry *de); |
| 1997 | struct dentry *reiserfs_get_parent(struct dentry *); | 2079 | struct dentry *reiserfs_get_parent(struct dentry *); |
| 1998 | /* procfs.c */ | ||
| 1999 | |||
| 2000 | #if defined( CONFIG_PROC_FS ) && defined( CONFIG_REISERFS_PROC_INFO ) | ||
| 2001 | #define REISERFS_PROC_INFO | ||
| 2002 | #else | ||
| 2003 | #undef REISERFS_PROC_INFO | ||
| 2004 | #endif | ||
| 2005 | 2080 | ||
| 2081 | #ifdef CONFIG_REISERFS_PROC_INFO | ||
| 2006 | int reiserfs_proc_info_init(struct super_block *sb); | 2082 | int reiserfs_proc_info_init(struct super_block *sb); |
| 2007 | int reiserfs_proc_info_done(struct super_block *sb); | 2083 | int reiserfs_proc_info_done(struct super_block *sb); |
| 2008 | struct proc_dir_entry *reiserfs_proc_register_global(char *name, | ||
| 2009 | read_proc_t * func); | ||
| 2010 | void reiserfs_proc_unregister_global(const char *name); | ||
| 2011 | int reiserfs_proc_info_global_init(void); | 2084 | int reiserfs_proc_info_global_init(void); |
| 2012 | int reiserfs_proc_info_global_done(void); | 2085 | int reiserfs_proc_info_global_done(void); |
| 2013 | int reiserfs_global_version_in_proc(char *buffer, char **start, off_t offset, | ||
| 2014 | int count, int *eof, void *data); | ||
| 2015 | |||
| 2016 | #if defined( REISERFS_PROC_INFO ) | ||
| 2017 | 2086 | ||
| 2018 | #define PROC_EXP( e ) e | 2087 | #define PROC_EXP( e ) e |
| 2019 | 2088 | ||
| @@ -2028,6 +2097,26 @@ int reiserfs_global_version_in_proc(char *buffer, char **start, off_t offset, | |||
| 2028 | PROC_INFO_ADD( sb, free_at[ ( level ) ], B_FREE_SPACE( bh ) ); \ | 2097 | PROC_INFO_ADD( sb, free_at[ ( level ) ], B_FREE_SPACE( bh ) ); \ |
| 2029 | PROC_INFO_ADD( sb, items_at[ ( level ) ], B_NR_ITEMS( bh ) ) | 2098 | PROC_INFO_ADD( sb, items_at[ ( level ) ], B_NR_ITEMS( bh ) ) |
| 2030 | #else | 2099 | #else |
| 2100 | static inline int reiserfs_proc_info_init(struct super_block *sb) | ||
| 2101 | { | ||
| 2102 | return 0; | ||
| 2103 | } | ||
| 2104 | |||
| 2105 | static inline int reiserfs_proc_info_done(struct super_block *sb) | ||
| 2106 | { | ||
| 2107 | return 0; | ||
| 2108 | } | ||
| 2109 | |||
| 2110 | static inline int reiserfs_proc_info_global_init(void) | ||
| 2111 | { | ||
| 2112 | return 0; | ||
| 2113 | } | ||
| 2114 | |||
| 2115 | static inline int reiserfs_proc_info_global_done(void) | ||
| 2116 | { | ||
| 2117 | return 0; | ||
| 2118 | } | ||
| 2119 | |||
| 2031 | #define PROC_EXP( e ) | 2120 | #define PROC_EXP( e ) |
| 2032 | #define VOID_V ( ( void ) 0 ) | 2121 | #define VOID_V ( ( void ) 0 ) |
| 2033 | #define PROC_INFO_MAX( sb, field, value ) VOID_V | 2122 | #define PROC_INFO_MAX( sb, field, value ) VOID_V |
| @@ -2258,8 +2347,7 @@ __u32 r5_hash(const signed char *msg, int len); | |||
| 2258 | #define SPARE_SPACE 500 | 2347 | #define SPARE_SPACE 500 |
| 2259 | 2348 | ||
| 2260 | /* prototypes from ioctl.c */ | 2349 | /* prototypes from ioctl.c */ |
| 2261 | int reiserfs_ioctl(struct inode *inode, struct file *filp, | 2350 | long reiserfs_ioctl(struct file *filp, unsigned int cmd, unsigned long arg); |
| 2262 | unsigned int cmd, unsigned long arg); | ||
| 2263 | long reiserfs_compat_ioctl(struct file *filp, | 2351 | long reiserfs_compat_ioctl(struct file *filp, |
| 2264 | unsigned int cmd, unsigned long arg); | 2352 | unsigned int cmd, unsigned long arg); |
| 2265 | int reiserfs_unpack(struct inode *inode, struct file *filp); | 2353 | int reiserfs_unpack(struct inode *inode, struct file *filp); |
diff --git a/include/linux/reiserfs_fs_sb.h b/include/linux/reiserfs_fs_sb.h index dab68bbed675..52c83b6a758a 100644 --- a/include/linux/reiserfs_fs_sb.h +++ b/include/linux/reiserfs_fs_sb.h | |||
| @@ -7,6 +7,8 @@ | |||
| 7 | #ifdef __KERNEL__ | 7 | #ifdef __KERNEL__ |
| 8 | #include <linux/workqueue.h> | 8 | #include <linux/workqueue.h> |
| 9 | #include <linux/rwsem.h> | 9 | #include <linux/rwsem.h> |
| 10 | #include <linux/mutex.h> | ||
| 11 | #include <linux/sched.h> | ||
| 10 | #endif | 12 | #endif |
| 11 | 13 | ||
| 12 | typedef enum { | 14 | typedef enum { |
| @@ -355,6 +357,13 @@ struct reiserfs_sb_info { | |||
| 355 | struct reiserfs_journal *s_journal; /* pointer to journal information */ | 357 | struct reiserfs_journal *s_journal; /* pointer to journal information */ |
| 356 | unsigned short s_mount_state; /* reiserfs state (valid, invalid) */ | 358 | unsigned short s_mount_state; /* reiserfs state (valid, invalid) */ |
| 357 | 359 | ||
| 360 | /* Serialize writers access, replace the old bkl */ | ||
| 361 | struct mutex lock; | ||
| 362 | /* Owner of the lock (can be recursive) */ | ||
| 363 | struct task_struct *lock_owner; | ||
| 364 | /* Depth of the lock, start from -1 like the bkl */ | ||
| 365 | int lock_depth; | ||
| 366 | |||
| 358 | /* Comment? -Hans */ | 367 | /* Comment? -Hans */ |
| 359 | void (*end_io_handler) (struct buffer_head *, int); | 368 | void (*end_io_handler) (struct buffer_head *, int); |
| 360 | hashf_t s_hash_function; /* pointer to function which is used | 369 | hashf_t s_hash_function; /* pointer to function which is used |
| @@ -408,6 +417,17 @@ struct reiserfs_sb_info { | |||
| 408 | char *s_qf_names[MAXQUOTAS]; | 417 | char *s_qf_names[MAXQUOTAS]; |
| 409 | int s_jquota_fmt; | 418 | int s_jquota_fmt; |
| 410 | #endif | 419 | #endif |
| 420 | #ifdef CONFIG_REISERFS_CHECK | ||
| 421 | |||
| 422 | struct tree_balance *cur_tb; /* | ||
| 423 | * Detects whether more than one | ||
| 424 | * copy of tb exists per superblock | ||
| 425 | * as a means of checking whether | ||
| 426 | * do_balance is executing concurrently | ||
| 427 | * against another tree reader/writer | ||
| 428 | * on a same mount point. | ||
| 429 | */ | ||
| 430 | #endif | ||
| 411 | }; | 431 | }; |
| 412 | 432 | ||
| 413 | /* Definitions of reiserfs on-disk properties: */ | 433 | /* Definitions of reiserfs on-disk properties: */ |
diff --git a/include/linux/reiserfs_xattr.h b/include/linux/reiserfs_xattr.h index 99928dce37ea..7fa02b4af838 100644 --- a/include/linux/reiserfs_xattr.h +++ b/include/linux/reiserfs_xattr.h | |||
| @@ -70,6 +70,11 @@ int reiserfs_security_write(struct reiserfs_transaction_handle *th, | |||
| 70 | void reiserfs_security_free(struct reiserfs_security_handle *sec); | 70 | void reiserfs_security_free(struct reiserfs_security_handle *sec); |
| 71 | #endif | 71 | #endif |
| 72 | 72 | ||
| 73 | static inline int reiserfs_xattrs_initialized(struct super_block *sb) | ||
| 74 | { | ||
| 75 | return REISERFS_SB(sb)->priv_root != NULL; | ||
| 76 | } | ||
| 77 | |||
| 73 | #define xattr_size(size) ((size) + sizeof(struct reiserfs_xattr_header)) | 78 | #define xattr_size(size) ((size) + sizeof(struct reiserfs_xattr_header)) |
| 74 | static inline loff_t reiserfs_xattr_nblocks(struct inode *inode, loff_t size) | 79 | static inline loff_t reiserfs_xattr_nblocks(struct inode *inode, loff_t size) |
| 75 | { | 80 | { |
diff --git a/include/linux/resource.h b/include/linux/resource.h index 40fc7e626082..f1e914eefeab 100644 --- a/include/linux/resource.h +++ b/include/linux/resource.h | |||
| @@ -3,8 +3,6 @@ | |||
| 3 | 3 | ||
| 4 | #include <linux/time.h> | 4 | #include <linux/time.h> |
| 5 | 5 | ||
| 6 | struct task_struct; | ||
| 7 | |||
| 8 | /* | 6 | /* |
| 9 | * Resource control/accounting header file for linux | 7 | * Resource control/accounting header file for linux |
| 10 | */ | 8 | */ |
| @@ -70,6 +68,12 @@ struct rlimit { | |||
| 70 | */ | 68 | */ |
| 71 | #include <asm/resource.h> | 69 | #include <asm/resource.h> |
| 72 | 70 | ||
| 71 | #ifdef __KERNEL__ | ||
| 72 | |||
| 73 | struct task_struct; | ||
| 74 | |||
| 73 | int getrusage(struct task_struct *p, int who, struct rusage __user *ru); | 75 | int getrusage(struct task_struct *p, int who, struct rusage __user *ru); |
| 74 | 76 | ||
| 77 | #endif /* __KERNEL__ */ | ||
| 78 | |||
| 75 | #endif | 79 | #endif |
diff --git a/include/linux/resume-trace.h b/include/linux/resume-trace.h index c9ba2fdf807d..bc8c3881c729 100644 --- a/include/linux/resume-trace.h +++ b/include/linux/resume-trace.h | |||
| @@ -6,6 +6,11 @@ | |||
| 6 | 6 | ||
| 7 | extern int pm_trace_enabled; | 7 | extern int pm_trace_enabled; |
| 8 | 8 | ||
| 9 | static inline int pm_trace_is_enabled(void) | ||
| 10 | { | ||
| 11 | return pm_trace_enabled; | ||
| 12 | } | ||
| 13 | |||
| 9 | struct device; | 14 | struct device; |
| 10 | extern void set_trace_device(struct device *); | 15 | extern void set_trace_device(struct device *); |
| 11 | extern void generate_resume_trace(const void *tracedata, unsigned int user); | 16 | extern void generate_resume_trace(const void *tracedata, unsigned int user); |
| @@ -17,6 +22,8 @@ extern void generate_resume_trace(const void *tracedata, unsigned int user); | |||
| 17 | 22 | ||
| 18 | #else | 23 | #else |
| 19 | 24 | ||
| 25 | static inline int pm_trace_is_enabled(void) { return 0; } | ||
| 26 | |||
| 20 | #define TRACE_DEVICE(dev) do { } while (0) | 27 | #define TRACE_DEVICE(dev) do { } while (0) |
| 21 | #define TRACE_RESUME(dev) do { } while (0) | 28 | #define TRACE_RESUME(dev) do { } while (0) |
| 22 | 29 | ||
diff --git a/include/linux/rfkill.h b/include/linux/rfkill.h index 3392c59d2706..4f82326eb294 100644 --- a/include/linux/rfkill.h +++ b/include/linux/rfkill.h | |||
| @@ -29,12 +29,14 @@ | |||
| 29 | /** | 29 | /** |
| 30 | * enum rfkill_type - type of rfkill switch. | 30 | * enum rfkill_type - type of rfkill switch. |
| 31 | * | 31 | * |
| 32 | * @RFKILL_TYPE_ALL: toggles all switches (userspace only) | 32 | * @RFKILL_TYPE_ALL: toggles all switches (requests only - not a switch type) |
| 33 | * @RFKILL_TYPE_WLAN: switch is on a 802.11 wireless network device. | 33 | * @RFKILL_TYPE_WLAN: switch is on a 802.11 wireless network device. |
| 34 | * @RFKILL_TYPE_BLUETOOTH: switch is on a bluetooth device. | 34 | * @RFKILL_TYPE_BLUETOOTH: switch is on a bluetooth device. |
| 35 | * @RFKILL_TYPE_UWB: switch is on a ultra wideband device. | 35 | * @RFKILL_TYPE_UWB: switch is on a ultra wideband device. |
| 36 | * @RFKILL_TYPE_WIMAX: switch is on a WiMAX device. | 36 | * @RFKILL_TYPE_WIMAX: switch is on a WiMAX device. |
| 37 | * @RFKILL_TYPE_WWAN: switch is on a wireless WAN device. | 37 | * @RFKILL_TYPE_WWAN: switch is on a wireless WAN device. |
| 38 | * @RFKILL_TYPE_GPS: switch is on a GPS device. | ||
| 39 | * @RFKILL_TYPE_FM: switch is on a FM radio device. | ||
| 38 | * @NUM_RFKILL_TYPES: number of defined rfkill types | 40 | * @NUM_RFKILL_TYPES: number of defined rfkill types |
| 39 | */ | 41 | */ |
| 40 | enum rfkill_type { | 42 | enum rfkill_type { |
| @@ -45,6 +47,7 @@ enum rfkill_type { | |||
| 45 | RFKILL_TYPE_WIMAX, | 47 | RFKILL_TYPE_WIMAX, |
| 46 | RFKILL_TYPE_WWAN, | 48 | RFKILL_TYPE_WWAN, |
| 47 | RFKILL_TYPE_GPS, | 49 | RFKILL_TYPE_GPS, |
| 50 | RFKILL_TYPE_FM, | ||
| 48 | NUM_RFKILL_TYPES, | 51 | NUM_RFKILL_TYPES, |
| 49 | }; | 52 | }; |
| 50 | 53 | ||
diff --git a/include/linux/rmap.h b/include/linux/rmap.h index cb0ba7032609..d25bd224d370 100644 --- a/include/linux/rmap.h +++ b/include/linux/rmap.h | |||
| @@ -26,6 +26,9 @@ | |||
| 26 | */ | 26 | */ |
| 27 | struct anon_vma { | 27 | struct anon_vma { |
| 28 | spinlock_t lock; /* Serialize access to vma list */ | 28 | spinlock_t lock; /* Serialize access to vma list */ |
| 29 | #ifdef CONFIG_KSM | ||
| 30 | atomic_t ksm_refcount; | ||
| 31 | #endif | ||
| 29 | /* | 32 | /* |
| 30 | * NOTE: the LSB of the head.next is set by | 33 | * NOTE: the LSB of the head.next is set by |
| 31 | * mm_take_all_locks() _after_ taking the above lock. So the | 34 | * mm_take_all_locks() _after_ taking the above lock. So the |
| @@ -34,10 +37,58 @@ struct anon_vma { | |||
| 34 | * is serialized by a system wide lock only visible to | 37 | * is serialized by a system wide lock only visible to |
| 35 | * mm_take_all_locks() (mm_all_locks_mutex). | 38 | * mm_take_all_locks() (mm_all_locks_mutex). |
| 36 | */ | 39 | */ |
| 37 | struct list_head head; /* List of private "related" vmas */ | 40 | struct list_head head; /* Chain of private "related" vmas */ |
| 41 | }; | ||
| 42 | |||
| 43 | /* | ||
| 44 | * The copy-on-write semantics of fork mean that an anon_vma | ||
| 45 | * can become associated with multiple processes. Furthermore, | ||
| 46 | * each child process will have its own anon_vma, where new | ||
| 47 | * pages for that process are instantiated. | ||
| 48 | * | ||
| 49 | * This structure allows us to find the anon_vmas associated | ||
| 50 | * with a VMA, or the VMAs associated with an anon_vma. | ||
| 51 | * The "same_vma" list contains the anon_vma_chains linking | ||
| 52 | * all the anon_vmas associated with this VMA. | ||
| 53 | * The "same_anon_vma" list contains the anon_vma_chains | ||
| 54 | * which link all the VMAs associated with this anon_vma. | ||
| 55 | */ | ||
| 56 | struct anon_vma_chain { | ||
| 57 | struct vm_area_struct *vma; | ||
| 58 | struct anon_vma *anon_vma; | ||
| 59 | struct list_head same_vma; /* locked by mmap_sem & page_table_lock */ | ||
| 60 | struct list_head same_anon_vma; /* locked by anon_vma->lock */ | ||
| 38 | }; | 61 | }; |
| 39 | 62 | ||
| 40 | #ifdef CONFIG_MMU | 63 | #ifdef CONFIG_MMU |
| 64 | #ifdef CONFIG_KSM | ||
| 65 | static inline void ksm_refcount_init(struct anon_vma *anon_vma) | ||
| 66 | { | ||
| 67 | atomic_set(&anon_vma->ksm_refcount, 0); | ||
| 68 | } | ||
| 69 | |||
| 70 | static inline int ksm_refcount(struct anon_vma *anon_vma) | ||
| 71 | { | ||
| 72 | return atomic_read(&anon_vma->ksm_refcount); | ||
| 73 | } | ||
| 74 | #else | ||
| 75 | static inline void ksm_refcount_init(struct anon_vma *anon_vma) | ||
| 76 | { | ||
| 77 | } | ||
| 78 | |||
| 79 | static inline int ksm_refcount(struct anon_vma *anon_vma) | ||
| 80 | { | ||
| 81 | return 0; | ||
| 82 | } | ||
| 83 | #endif /* CONFIG_KSM */ | ||
| 84 | |||
| 85 | static inline struct anon_vma *page_anon_vma(struct page *page) | ||
| 86 | { | ||
| 87 | if (((unsigned long)page->mapping & PAGE_MAPPING_FLAGS) != | ||
| 88 | PAGE_MAPPING_ANON) | ||
| 89 | return NULL; | ||
| 90 | return page_rmapping(page); | ||
| 91 | } | ||
| 41 | 92 | ||
| 42 | static inline void anon_vma_lock(struct vm_area_struct *vma) | 93 | static inline void anon_vma_lock(struct vm_area_struct *vma) |
| 43 | { | 94 | { |
| @@ -58,14 +109,23 @@ static inline void anon_vma_unlock(struct vm_area_struct *vma) | |||
| 58 | */ | 109 | */ |
| 59 | void anon_vma_init(void); /* create anon_vma_cachep */ | 110 | void anon_vma_init(void); /* create anon_vma_cachep */ |
| 60 | int anon_vma_prepare(struct vm_area_struct *); | 111 | int anon_vma_prepare(struct vm_area_struct *); |
| 61 | void __anon_vma_merge(struct vm_area_struct *, struct vm_area_struct *); | 112 | void unlink_anon_vmas(struct vm_area_struct *); |
| 62 | void anon_vma_unlink(struct vm_area_struct *); | 113 | int anon_vma_clone(struct vm_area_struct *, struct vm_area_struct *); |
| 63 | void anon_vma_link(struct vm_area_struct *); | 114 | int anon_vma_fork(struct vm_area_struct *, struct vm_area_struct *); |
| 64 | void __anon_vma_link(struct vm_area_struct *); | 115 | void __anon_vma_link(struct vm_area_struct *); |
| 116 | void anon_vma_free(struct anon_vma *); | ||
| 117 | |||
| 118 | static inline void anon_vma_merge(struct vm_area_struct *vma, | ||
| 119 | struct vm_area_struct *next) | ||
| 120 | { | ||
| 121 | VM_BUG_ON(vma->anon_vma != next->anon_vma); | ||
| 122 | unlink_anon_vmas(next); | ||
| 123 | } | ||
| 65 | 124 | ||
| 66 | /* | 125 | /* |
| 67 | * rmap interfaces called when adding or removing pte of page | 126 | * rmap interfaces called when adding or removing pte of page |
| 68 | */ | 127 | */ |
| 128 | void page_move_anon_rmap(struct page *, struct vm_area_struct *, unsigned long); | ||
| 69 | void page_add_anon_rmap(struct page *, struct vm_area_struct *, unsigned long); | 129 | void page_add_anon_rmap(struct page *, struct vm_area_struct *, unsigned long); |
| 70 | void page_add_new_anon_rmap(struct page *, struct vm_area_struct *, unsigned long); | 130 | void page_add_new_anon_rmap(struct page *, struct vm_area_struct *, unsigned long); |
| 71 | void page_add_file_rmap(struct page *); | 131 | void page_add_file_rmap(struct page *); |
| @@ -81,6 +141,9 @@ static inline void page_dup_rmap(struct page *page) | |||
| 81 | */ | 141 | */ |
| 82 | int page_referenced(struct page *, int is_locked, | 142 | int page_referenced(struct page *, int is_locked, |
| 83 | struct mem_cgroup *cnt, unsigned long *vm_flags); | 143 | struct mem_cgroup *cnt, unsigned long *vm_flags); |
| 144 | int page_referenced_one(struct page *, struct vm_area_struct *, | ||
| 145 | unsigned long address, unsigned int *mapcount, unsigned long *vm_flags); | ||
| 146 | |||
| 84 | enum ttu_flags { | 147 | enum ttu_flags { |
| 85 | TTU_UNMAP = 0, /* unmap mode */ | 148 | TTU_UNMAP = 0, /* unmap mode */ |
| 86 | TTU_MIGRATION = 1, /* migration mode */ | 149 | TTU_MIGRATION = 1, /* migration mode */ |
| @@ -94,6 +157,8 @@ enum ttu_flags { | |||
| 94 | #define TTU_ACTION(x) ((x) & TTU_ACTION_MASK) | 157 | #define TTU_ACTION(x) ((x) & TTU_ACTION_MASK) |
| 95 | 158 | ||
| 96 | int try_to_unmap(struct page *, enum ttu_flags flags); | 159 | int try_to_unmap(struct page *, enum ttu_flags flags); |
| 160 | int try_to_unmap_one(struct page *, struct vm_area_struct *, | ||
| 161 | unsigned long address, enum ttu_flags flags); | ||
| 97 | 162 | ||
| 98 | /* | 163 | /* |
| 99 | * Called from mm/filemap_xip.c to unmap empty zero page | 164 | * Called from mm/filemap_xip.c to unmap empty zero page |
| @@ -127,6 +192,12 @@ struct anon_vma *page_lock_anon_vma(struct page *page); | |||
| 127 | void page_unlock_anon_vma(struct anon_vma *anon_vma); | 192 | void page_unlock_anon_vma(struct anon_vma *anon_vma); |
| 128 | int page_mapped_in_vma(struct page *page, struct vm_area_struct *vma); | 193 | int page_mapped_in_vma(struct page *page, struct vm_area_struct *vma); |
| 129 | 194 | ||
| 195 | /* | ||
| 196 | * Called by migrate.c to remove migration ptes, but might be used more later. | ||
| 197 | */ | ||
| 198 | int rmap_walk(struct page *page, int (*rmap_one)(struct page *, | ||
| 199 | struct vm_area_struct *, unsigned long, void *), void *arg); | ||
| 200 | |||
| 130 | #else /* !CONFIG_MMU */ | 201 | #else /* !CONFIG_MMU */ |
| 131 | 202 | ||
| 132 | #define anon_vma_init() do {} while (0) | 203 | #define anon_vma_init() do {} while (0) |
| @@ -138,7 +209,7 @@ static inline int page_referenced(struct page *page, int is_locked, | |||
| 138 | unsigned long *vm_flags) | 209 | unsigned long *vm_flags) |
| 139 | { | 210 | { |
| 140 | *vm_flags = 0; | 211 | *vm_flags = 0; |
| 141 | return TestClearPageReferenced(page); | 212 | return 0; |
| 142 | } | 213 | } |
| 143 | 214 | ||
| 144 | #define try_to_unmap(page, refs) SWAP_FAIL | 215 | #define try_to_unmap(page, refs) SWAP_FAIL |
diff --git a/include/linux/route.h b/include/linux/route.h index f7ed35d5e653..6600708311c8 100644 --- a/include/linux/route.h +++ b/include/linux/route.h | |||
| @@ -27,8 +27,7 @@ | |||
| 27 | #include <linux/compiler.h> | 27 | #include <linux/compiler.h> |
| 28 | 28 | ||
| 29 | /* This structure gets passed by the SIOCADDRT and SIOCDELRT calls. */ | 29 | /* This structure gets passed by the SIOCADDRT and SIOCDELRT calls. */ |
| 30 | struct rtentry | 30 | struct rtentry { |
| 31 | { | ||
| 32 | unsigned long rt_pad1; | 31 | unsigned long rt_pad1; |
| 33 | struct sockaddr rt_dst; /* target address */ | 32 | struct sockaddr rt_dst; /* target address */ |
| 34 | struct sockaddr rt_gateway; /* gateway addr (RTF_GATEWAY) */ | 33 | struct sockaddr rt_gateway; /* gateway addr (RTF_GATEWAY) */ |
diff --git a/include/linux/rtc.h b/include/linux/rtc.h index 60f88a7fb13d..14dbc83ded20 100644 --- a/include/linux/rtc.h +++ b/include/linux/rtc.h | |||
| @@ -238,6 +238,12 @@ static inline bool is_leap_year(unsigned int year) | |||
| 238 | return (!(year % 4) && (year % 100)) || !(year % 400); | 238 | return (!(year % 4) && (year % 100)) || !(year % 400); |
| 239 | } | 239 | } |
| 240 | 240 | ||
| 241 | #ifdef CONFIG_RTC_HCTOSYS | ||
| 242 | extern int rtc_hctosys_ret; | ||
| 243 | #else | ||
| 244 | #define rtc_hctosys_ret -ENODEV | ||
| 245 | #endif | ||
| 246 | |||
| 241 | #endif /* __KERNEL__ */ | 247 | #endif /* __KERNEL__ */ |
| 242 | 248 | ||
| 243 | #endif /* _LINUX_RTC_H_ */ | 249 | #endif /* _LINUX_RTC_H_ */ |
diff --git a/include/linux/rtmutex.h b/include/linux/rtmutex.h index f19b00b7d530..8d522ffeda33 100644 --- a/include/linux/rtmutex.h +++ b/include/linux/rtmutex.h | |||
| @@ -16,6 +16,8 @@ | |||
| 16 | #include <linux/plist.h> | 16 | #include <linux/plist.h> |
| 17 | #include <linux/spinlock_types.h> | 17 | #include <linux/spinlock_types.h> |
| 18 | 18 | ||
| 19 | extern int max_lock_depth; /* for sysctl */ | ||
| 20 | |||
| 19 | /** | 21 | /** |
| 20 | * The rt_mutex structure | 22 | * The rt_mutex structure |
| 21 | * | 23 | * |
| @@ -24,7 +26,7 @@ | |||
| 24 | * @owner: the mutex owner | 26 | * @owner: the mutex owner |
| 25 | */ | 27 | */ |
| 26 | struct rt_mutex { | 28 | struct rt_mutex { |
| 27 | spinlock_t wait_lock; | 29 | raw_spinlock_t wait_lock; |
| 28 | struct plist_head wait_list; | 30 | struct plist_head wait_list; |
| 29 | struct task_struct *owner; | 31 | struct task_struct *owner; |
| 30 | #ifdef CONFIG_DEBUG_RT_MUTEXES | 32 | #ifdef CONFIG_DEBUG_RT_MUTEXES |
| @@ -63,8 +65,8 @@ struct hrtimer_sleeper; | |||
| 63 | #endif | 65 | #endif |
| 64 | 66 | ||
| 65 | #define __RT_MUTEX_INITIALIZER(mutexname) \ | 67 | #define __RT_MUTEX_INITIALIZER(mutexname) \ |
| 66 | { .wait_lock = __SPIN_LOCK_UNLOCKED(mutexname.wait_lock) \ | 68 | { .wait_lock = __RAW_SPIN_LOCK_UNLOCKED(mutexname.wait_lock) \ |
| 67 | , .wait_list = PLIST_HEAD_INIT(mutexname.wait_list, mutexname.wait_lock) \ | 69 | , .wait_list = PLIST_HEAD_INIT_RAW(mutexname.wait_list, mutexname.wait_lock) \ |
| 68 | , .owner = NULL \ | 70 | , .owner = NULL \ |
| 69 | __DEBUG_RT_MUTEX_INITIALIZER(mutexname)} | 71 | __DEBUG_RT_MUTEX_INITIALIZER(mutexname)} |
| 70 | 72 | ||
diff --git a/include/linux/rtnetlink.h b/include/linux/rtnetlink.h index adf2068d12b5..d1c7c90e9cd4 100644 --- a/include/linux/rtnetlink.h +++ b/include/linux/rtnetlink.h | |||
| @@ -127,8 +127,7 @@ enum { | |||
| 127 | with attribute type. | 127 | with attribute type. |
| 128 | */ | 128 | */ |
| 129 | 129 | ||
| 130 | struct rtattr | 130 | struct rtattr { |
| 131 | { | ||
| 132 | unsigned short rta_len; | 131 | unsigned short rta_len; |
| 133 | unsigned short rta_type; | 132 | unsigned short rta_type; |
| 134 | }; | 133 | }; |
| @@ -154,8 +153,7 @@ struct rtattr | |||
| 154 | * Definitions used in routing table administration. | 153 | * Definitions used in routing table administration. |
| 155 | ****/ | 154 | ****/ |
| 156 | 155 | ||
| 157 | struct rtmsg | 156 | struct rtmsg { |
| 158 | { | ||
| 159 | unsigned char rtm_family; | 157 | unsigned char rtm_family; |
| 160 | unsigned char rtm_dst_len; | 158 | unsigned char rtm_dst_len; |
| 161 | unsigned char rtm_src_len; | 159 | unsigned char rtm_src_len; |
| @@ -171,8 +169,7 @@ struct rtmsg | |||
| 171 | 169 | ||
| 172 | /* rtm_type */ | 170 | /* rtm_type */ |
| 173 | 171 | ||
| 174 | enum | 172 | enum { |
| 175 | { | ||
| 176 | RTN_UNSPEC, | 173 | RTN_UNSPEC, |
| 177 | RTN_UNICAST, /* Gateway or direct route */ | 174 | RTN_UNICAST, /* Gateway or direct route */ |
| 178 | RTN_LOCAL, /* Accept locally */ | 175 | RTN_LOCAL, /* Accept locally */ |
| @@ -230,8 +227,7 @@ enum | |||
| 230 | could be assigned a value between UNIVERSE and LINK. | 227 | could be assigned a value between UNIVERSE and LINK. |
| 231 | */ | 228 | */ |
| 232 | 229 | ||
| 233 | enum rt_scope_t | 230 | enum rt_scope_t { |
| 234 | { | ||
| 235 | RT_SCOPE_UNIVERSE=0, | 231 | RT_SCOPE_UNIVERSE=0, |
| 236 | /* User defined values */ | 232 | /* User defined values */ |
| 237 | RT_SCOPE_SITE=200, | 233 | RT_SCOPE_SITE=200, |
| @@ -249,8 +245,7 @@ enum rt_scope_t | |||
| 249 | 245 | ||
| 250 | /* Reserved table identifiers */ | 246 | /* Reserved table identifiers */ |
| 251 | 247 | ||
| 252 | enum rt_class_t | 248 | enum rt_class_t { |
| 253 | { | ||
| 254 | RT_TABLE_UNSPEC=0, | 249 | RT_TABLE_UNSPEC=0, |
| 255 | /* User defined values */ | 250 | /* User defined values */ |
| 256 | RT_TABLE_COMPAT=252, | 251 | RT_TABLE_COMPAT=252, |
| @@ -263,8 +258,7 @@ enum rt_class_t | |||
| 263 | 258 | ||
| 264 | /* Routing message attributes */ | 259 | /* Routing message attributes */ |
| 265 | 260 | ||
| 266 | enum rtattr_type_t | 261 | enum rtattr_type_t { |
| 267 | { | ||
| 268 | RTA_UNSPEC, | 262 | RTA_UNSPEC, |
| 269 | RTA_DST, | 263 | RTA_DST, |
| 270 | RTA_SRC, | 264 | RTA_SRC, |
| @@ -298,8 +292,7 @@ enum rtattr_type_t | |||
| 298 | * and rtt for different paths from multipath. | 292 | * and rtt for different paths from multipath. |
| 299 | */ | 293 | */ |
| 300 | 294 | ||
| 301 | struct rtnexthop | 295 | struct rtnexthop { |
| 302 | { | ||
| 303 | unsigned short rtnh_len; | 296 | unsigned short rtnh_len; |
| 304 | unsigned char rtnh_flags; | 297 | unsigned char rtnh_flags; |
| 305 | unsigned char rtnh_hops; | 298 | unsigned char rtnh_hops; |
| @@ -325,8 +318,7 @@ struct rtnexthop | |||
| 325 | 318 | ||
| 326 | /* RTM_CACHEINFO */ | 319 | /* RTM_CACHEINFO */ |
| 327 | 320 | ||
| 328 | struct rta_cacheinfo | 321 | struct rta_cacheinfo { |
| 329 | { | ||
| 330 | __u32 rta_clntref; | 322 | __u32 rta_clntref; |
| 331 | __u32 rta_lastuse; | 323 | __u32 rta_lastuse; |
| 332 | __s32 rta_expires; | 324 | __s32 rta_expires; |
| @@ -341,8 +333,7 @@ struct rta_cacheinfo | |||
| 341 | 333 | ||
| 342 | /* RTM_METRICS --- array of struct rtattr with types of RTAX_* */ | 334 | /* RTM_METRICS --- array of struct rtattr with types of RTAX_* */ |
| 343 | 335 | ||
| 344 | enum | 336 | enum { |
| 345 | { | ||
| 346 | RTAX_UNSPEC, | 337 | RTAX_UNSPEC, |
| 347 | #define RTAX_UNSPEC RTAX_UNSPEC | 338 | #define RTAX_UNSPEC RTAX_UNSPEC |
| 348 | RTAX_LOCK, | 339 | RTAX_LOCK, |
| @@ -371,6 +362,8 @@ enum | |||
| 371 | #define RTAX_FEATURES RTAX_FEATURES | 362 | #define RTAX_FEATURES RTAX_FEATURES |
| 372 | RTAX_RTO_MIN, | 363 | RTAX_RTO_MIN, |
| 373 | #define RTAX_RTO_MIN RTAX_RTO_MIN | 364 | #define RTAX_RTO_MIN RTAX_RTO_MIN |
| 365 | RTAX_INITRWND, | ||
| 366 | #define RTAX_INITRWND RTAX_INITRWND | ||
| 374 | __RTAX_MAX | 367 | __RTAX_MAX |
| 375 | }; | 368 | }; |
| 376 | 369 | ||
| @@ -381,8 +374,7 @@ enum | |||
| 381 | #define RTAX_FEATURE_TIMESTAMP 0x00000004 | 374 | #define RTAX_FEATURE_TIMESTAMP 0x00000004 |
| 382 | #define RTAX_FEATURE_ALLFRAG 0x00000008 | 375 | #define RTAX_FEATURE_ALLFRAG 0x00000008 |
| 383 | 376 | ||
| 384 | struct rta_session | 377 | struct rta_session { |
| 385 | { | ||
| 386 | __u8 proto; | 378 | __u8 proto; |
| 387 | __u8 pad1; | 379 | __u8 pad1; |
| 388 | __u16 pad2; | 380 | __u16 pad2; |
| @@ -407,8 +399,7 @@ struct rta_session | |||
| 407 | * General form of address family dependent message. | 399 | * General form of address family dependent message. |
| 408 | ****/ | 400 | ****/ |
| 409 | 401 | ||
| 410 | struct rtgenmsg | 402 | struct rtgenmsg { |
| 411 | { | ||
| 412 | unsigned char rtgen_family; | 403 | unsigned char rtgen_family; |
| 413 | }; | 404 | }; |
| 414 | 405 | ||
| @@ -421,8 +412,7 @@ struct rtgenmsg | |||
| 421 | * on network protocol. | 412 | * on network protocol. |
| 422 | */ | 413 | */ |
| 423 | 414 | ||
| 424 | struct ifinfomsg | 415 | struct ifinfomsg { |
| 425 | { | ||
| 426 | unsigned char ifi_family; | 416 | unsigned char ifi_family; |
| 427 | unsigned char __ifi_pad; | 417 | unsigned char __ifi_pad; |
| 428 | unsigned short ifi_type; /* ARPHRD_* */ | 418 | unsigned short ifi_type; /* ARPHRD_* */ |
| @@ -435,8 +425,7 @@ struct ifinfomsg | |||
| 435 | * prefix information | 425 | * prefix information |
| 436 | ****/ | 426 | ****/ |
| 437 | 427 | ||
| 438 | struct prefixmsg | 428 | struct prefixmsg { |
| 439 | { | ||
| 440 | unsigned char prefix_family; | 429 | unsigned char prefix_family; |
| 441 | unsigned char prefix_pad1; | 430 | unsigned char prefix_pad1; |
| 442 | unsigned short prefix_pad2; | 431 | unsigned short prefix_pad2; |
| @@ -457,8 +446,7 @@ enum | |||
| 457 | 446 | ||
| 458 | #define PREFIX_MAX (__PREFIX_MAX - 1) | 447 | #define PREFIX_MAX (__PREFIX_MAX - 1) |
| 459 | 448 | ||
| 460 | struct prefix_cacheinfo | 449 | struct prefix_cacheinfo { |
| 461 | { | ||
| 462 | __u32 preferred_time; | 450 | __u32 preferred_time; |
| 463 | __u32 valid_time; | 451 | __u32 valid_time; |
| 464 | }; | 452 | }; |
| @@ -468,8 +456,7 @@ struct prefix_cacheinfo | |||
| 468 | * Traffic control messages. | 456 | * Traffic control messages. |
| 469 | ****/ | 457 | ****/ |
| 470 | 458 | ||
| 471 | struct tcmsg | 459 | struct tcmsg { |
| 472 | { | ||
| 473 | unsigned char tcm_family; | 460 | unsigned char tcm_family; |
| 474 | unsigned char tcm__pad1; | 461 | unsigned char tcm__pad1; |
| 475 | unsigned short tcm__pad2; | 462 | unsigned short tcm__pad2; |
| @@ -479,8 +466,7 @@ struct tcmsg | |||
| 479 | __u32 tcm_info; | 466 | __u32 tcm_info; |
| 480 | }; | 467 | }; |
| 481 | 468 | ||
| 482 | enum | 469 | enum { |
| 483 | { | ||
| 484 | TCA_UNSPEC, | 470 | TCA_UNSPEC, |
| 485 | TCA_KIND, | 471 | TCA_KIND, |
| 486 | TCA_OPTIONS, | 472 | TCA_OPTIONS, |
| @@ -502,8 +488,7 @@ enum | |||
| 502 | * Neighbor Discovery userland options | 488 | * Neighbor Discovery userland options |
| 503 | ****/ | 489 | ****/ |
| 504 | 490 | ||
| 505 | struct nduseroptmsg | 491 | struct nduseroptmsg { |
| 506 | { | ||
| 507 | unsigned char nduseropt_family; | 492 | unsigned char nduseropt_family; |
| 508 | unsigned char nduseropt_pad1; | 493 | unsigned char nduseropt_pad1; |
| 509 | unsigned short nduseropt_opts_len; /* Total length of options */ | 494 | unsigned short nduseropt_opts_len; /* Total length of options */ |
| @@ -515,8 +500,7 @@ struct nduseroptmsg | |||
| 515 | /* Followed by one or more ND options */ | 500 | /* Followed by one or more ND options */ |
| 516 | }; | 501 | }; |
| 517 | 502 | ||
| 518 | enum | 503 | enum { |
| 519 | { | ||
| 520 | NDUSEROPT_UNSPEC, | 504 | NDUSEROPT_UNSPEC, |
| 521 | NDUSEROPT_SRCADDR, | 505 | NDUSEROPT_SRCADDR, |
| 522 | __NDUSEROPT_MAX | 506 | __NDUSEROPT_MAX |
| @@ -598,8 +582,7 @@ enum rtnetlink_groups { | |||
| 598 | #define RTNLGRP_MAX (__RTNLGRP_MAX - 1) | 582 | #define RTNLGRP_MAX (__RTNLGRP_MAX - 1) |
| 599 | 583 | ||
| 600 | /* TC action piece */ | 584 | /* TC action piece */ |
| 601 | struct tcamsg | 585 | struct tcamsg { |
| 602 | { | ||
| 603 | unsigned char tca_family; | 586 | unsigned char tca_family; |
| 604 | unsigned char tca__pad1; | 587 | unsigned char tca__pad1; |
| 605 | unsigned short tca__pad2; | 588 | unsigned short tca__pad2; |
| @@ -754,6 +737,9 @@ extern void rtnl_lock(void); | |||
| 754 | extern void rtnl_unlock(void); | 737 | extern void rtnl_unlock(void); |
| 755 | extern int rtnl_trylock(void); | 738 | extern int rtnl_trylock(void); |
| 756 | extern int rtnl_is_locked(void); | 739 | extern int rtnl_is_locked(void); |
| 740 | #ifdef CONFIG_PROVE_LOCKING | ||
| 741 | extern int lockdep_rtnl_is_held(void); | ||
| 742 | #endif /* #ifdef CONFIG_PROVE_LOCKING */ | ||
| 757 | 743 | ||
| 758 | extern void rtnetlink_init(void); | 744 | extern void rtnetlink_init(void); |
| 759 | extern void __rtnl_unlock(void); | 745 | extern void __rtnl_unlock(void); |
diff --git a/include/linux/rwlock.h b/include/linux/rwlock.h new file mode 100644 index 000000000000..bc2994ed66e1 --- /dev/null +++ b/include/linux/rwlock.h | |||
| @@ -0,0 +1,125 @@ | |||
| 1 | #ifndef __LINUX_RWLOCK_H | ||
| 2 | #define __LINUX_RWLOCK_H | ||
| 3 | |||
| 4 | #ifndef __LINUX_SPINLOCK_H | ||
| 5 | # error "please don't include this file directly" | ||
| 6 | #endif | ||
| 7 | |||
| 8 | /* | ||
| 9 | * rwlock related methods | ||
| 10 | * | ||
| 11 | * split out from spinlock.h | ||
| 12 | * | ||
| 13 | * portions Copyright 2005, Red Hat, Inc., Ingo Molnar | ||
| 14 | * Released under the General Public License (GPL). | ||
| 15 | */ | ||
| 16 | |||
| 17 | #ifdef CONFIG_DEBUG_SPINLOCK | ||
| 18 | extern void __rwlock_init(rwlock_t *lock, const char *name, | ||
| 19 | struct lock_class_key *key); | ||
| 20 | # define rwlock_init(lock) \ | ||
| 21 | do { \ | ||
| 22 | static struct lock_class_key __key; \ | ||
| 23 | \ | ||
| 24 | __rwlock_init((lock), #lock, &__key); \ | ||
| 25 | } while (0) | ||
| 26 | #else | ||
| 27 | # define rwlock_init(lock) \ | ||
| 28 | do { *(lock) = __RW_LOCK_UNLOCKED(lock); } while (0) | ||
| 29 | #endif | ||
| 30 | |||
| 31 | #ifdef CONFIG_DEBUG_SPINLOCK | ||
| 32 | extern void do_raw_read_lock(rwlock_t *lock) __acquires(lock); | ||
| 33 | #define do_raw_read_lock_flags(lock, flags) do_raw_read_lock(lock) | ||
| 34 | extern int do_raw_read_trylock(rwlock_t *lock); | ||
| 35 | extern void do_raw_read_unlock(rwlock_t *lock) __releases(lock); | ||
| 36 | extern void do_raw_write_lock(rwlock_t *lock) __acquires(lock); | ||
| 37 | #define do_raw_write_lock_flags(lock, flags) do_raw_write_lock(lock) | ||
| 38 | extern int do_raw_write_trylock(rwlock_t *lock); | ||
| 39 | extern void do_raw_write_unlock(rwlock_t *lock) __releases(lock); | ||
| 40 | #else | ||
| 41 | # define do_raw_read_lock(rwlock) do {__acquire(lock); arch_read_lock(&(rwlock)->raw_lock); } while (0) | ||
| 42 | # define do_raw_read_lock_flags(lock, flags) \ | ||
| 43 | do {__acquire(lock); arch_read_lock_flags(&(lock)->raw_lock, *(flags)); } while (0) | ||
| 44 | # define do_raw_read_trylock(rwlock) arch_read_trylock(&(rwlock)->raw_lock) | ||
| 45 | # define do_raw_read_unlock(rwlock) do {arch_read_unlock(&(rwlock)->raw_lock); __release(lock); } while (0) | ||
| 46 | # define do_raw_write_lock(rwlock) do {__acquire(lock); arch_write_lock(&(rwlock)->raw_lock); } while (0) | ||
| 47 | # define do_raw_write_lock_flags(lock, flags) \ | ||
| 48 | do {__acquire(lock); arch_write_lock_flags(&(lock)->raw_lock, *(flags)); } while (0) | ||
| 49 | # define do_raw_write_trylock(rwlock) arch_write_trylock(&(rwlock)->raw_lock) | ||
| 50 | # define do_raw_write_unlock(rwlock) do {arch_write_unlock(&(rwlock)->raw_lock); __release(lock); } while (0) | ||
| 51 | #endif | ||
| 52 | |||
| 53 | #define read_can_lock(rwlock) arch_read_can_lock(&(rwlock)->raw_lock) | ||
| 54 | #define write_can_lock(rwlock) arch_write_can_lock(&(rwlock)->raw_lock) | ||
| 55 | |||
| 56 | /* | ||
| 57 | * Define the various rw_lock methods. Note we define these | ||
| 58 | * regardless of whether CONFIG_SMP or CONFIG_PREEMPT are set. The various | ||
| 59 | * methods are defined as nops in the case they are not required. | ||
| 60 | */ | ||
| 61 | #define read_trylock(lock) __cond_lock(lock, _raw_read_trylock(lock)) | ||
| 62 | #define write_trylock(lock) __cond_lock(lock, _raw_write_trylock(lock)) | ||
| 63 | |||
| 64 | #define write_lock(lock) _raw_write_lock(lock) | ||
| 65 | #define read_lock(lock) _raw_read_lock(lock) | ||
| 66 | |||
| 67 | #if defined(CONFIG_SMP) || defined(CONFIG_DEBUG_SPINLOCK) | ||
| 68 | |||
| 69 | #define read_lock_irqsave(lock, flags) \ | ||
| 70 | do { \ | ||
| 71 | typecheck(unsigned long, flags); \ | ||
| 72 | flags = _raw_read_lock_irqsave(lock); \ | ||
| 73 | } while (0) | ||
| 74 | #define write_lock_irqsave(lock, flags) \ | ||
| 75 | do { \ | ||
| 76 | typecheck(unsigned long, flags); \ | ||
| 77 | flags = _raw_write_lock_irqsave(lock); \ | ||
| 78 | } while (0) | ||
| 79 | |||
| 80 | #else | ||
| 81 | |||
| 82 | #define read_lock_irqsave(lock, flags) \ | ||
| 83 | do { \ | ||
| 84 | typecheck(unsigned long, flags); \ | ||
| 85 | _raw_read_lock_irqsave(lock, flags); \ | ||
| 86 | } while (0) | ||
| 87 | #define write_lock_irqsave(lock, flags) \ | ||
| 88 | do { \ | ||
| 89 | typecheck(unsigned long, flags); \ | ||
| 90 | _raw_write_lock_irqsave(lock, flags); \ | ||
| 91 | } while (0) | ||
| 92 | |||
| 93 | #endif | ||
| 94 | |||
| 95 | #define read_lock_irq(lock) _raw_read_lock_irq(lock) | ||
| 96 | #define read_lock_bh(lock) _raw_read_lock_bh(lock) | ||
| 97 | #define write_lock_irq(lock) _raw_write_lock_irq(lock) | ||
| 98 | #define write_lock_bh(lock) _raw_write_lock_bh(lock) | ||
| 99 | #define read_unlock(lock) _raw_read_unlock(lock) | ||
| 100 | #define write_unlock(lock) _raw_write_unlock(lock) | ||
| 101 | #define read_unlock_irq(lock) _raw_read_unlock_irq(lock) | ||
| 102 | #define write_unlock_irq(lock) _raw_write_unlock_irq(lock) | ||
| 103 | |||
| 104 | #define read_unlock_irqrestore(lock, flags) \ | ||
| 105 | do { \ | ||
| 106 | typecheck(unsigned long, flags); \ | ||
| 107 | _raw_read_unlock_irqrestore(lock, flags); \ | ||
| 108 | } while (0) | ||
| 109 | #define read_unlock_bh(lock) _raw_read_unlock_bh(lock) | ||
| 110 | |||
| 111 | #define write_unlock_irqrestore(lock, flags) \ | ||
| 112 | do { \ | ||
| 113 | typecheck(unsigned long, flags); \ | ||
| 114 | _raw_write_unlock_irqrestore(lock, flags); \ | ||
| 115 | } while (0) | ||
| 116 | #define write_unlock_bh(lock) _raw_write_unlock_bh(lock) | ||
| 117 | |||
| 118 | #define write_trylock_irqsave(lock, flags) \ | ||
| 119 | ({ \ | ||
| 120 | local_irq_save(flags); \ | ||
| 121 | write_trylock(lock) ? \ | ||
| 122 | 1 : ({ local_irq_restore(flags); 0; }); \ | ||
| 123 | }) | ||
| 124 | |||
| 125 | #endif /* __LINUX_RWLOCK_H */ | ||
diff --git a/include/linux/rwlock_api_smp.h b/include/linux/rwlock_api_smp.h new file mode 100644 index 000000000000..9c9f0495d37c --- /dev/null +++ b/include/linux/rwlock_api_smp.h | |||
| @@ -0,0 +1,282 @@ | |||
| 1 | #ifndef __LINUX_RWLOCK_API_SMP_H | ||
| 2 | #define __LINUX_RWLOCK_API_SMP_H | ||
| 3 | |||
| 4 | #ifndef __LINUX_SPINLOCK_API_SMP_H | ||
| 5 | # error "please don't include this file directly" | ||
| 6 | #endif | ||
| 7 | |||
| 8 | /* | ||
| 9 | * include/linux/rwlock_api_smp.h | ||
| 10 | * | ||
| 11 | * spinlock API declarations on SMP (and debug) | ||
| 12 | * (implemented in kernel/spinlock.c) | ||
| 13 | * | ||
| 14 | * portions Copyright 2005, Red Hat, Inc., Ingo Molnar | ||
| 15 | * Released under the General Public License (GPL). | ||
| 16 | */ | ||
| 17 | |||
| 18 | void __lockfunc _raw_read_lock(rwlock_t *lock) __acquires(lock); | ||
| 19 | void __lockfunc _raw_write_lock(rwlock_t *lock) __acquires(lock); | ||
| 20 | void __lockfunc _raw_read_lock_bh(rwlock_t *lock) __acquires(lock); | ||
| 21 | void __lockfunc _raw_write_lock_bh(rwlock_t *lock) __acquires(lock); | ||
| 22 | void __lockfunc _raw_read_lock_irq(rwlock_t *lock) __acquires(lock); | ||
| 23 | void __lockfunc _raw_write_lock_irq(rwlock_t *lock) __acquires(lock); | ||
| 24 | unsigned long __lockfunc _raw_read_lock_irqsave(rwlock_t *lock) | ||
| 25 | __acquires(lock); | ||
| 26 | unsigned long __lockfunc _raw_write_lock_irqsave(rwlock_t *lock) | ||
| 27 | __acquires(lock); | ||
| 28 | int __lockfunc _raw_read_trylock(rwlock_t *lock); | ||
| 29 | int __lockfunc _raw_write_trylock(rwlock_t *lock); | ||
| 30 | void __lockfunc _raw_read_unlock(rwlock_t *lock) __releases(lock); | ||
| 31 | void __lockfunc _raw_write_unlock(rwlock_t *lock) __releases(lock); | ||
| 32 | void __lockfunc _raw_read_unlock_bh(rwlock_t *lock) __releases(lock); | ||
| 33 | void __lockfunc _raw_write_unlock_bh(rwlock_t *lock) __releases(lock); | ||
| 34 | void __lockfunc _raw_read_unlock_irq(rwlock_t *lock) __releases(lock); | ||
| 35 | void __lockfunc _raw_write_unlock_irq(rwlock_t *lock) __releases(lock); | ||
| 36 | void __lockfunc | ||
| 37 | _raw_read_unlock_irqrestore(rwlock_t *lock, unsigned long flags) | ||
| 38 | __releases(lock); | ||
| 39 | void __lockfunc | ||
| 40 | _raw_write_unlock_irqrestore(rwlock_t *lock, unsigned long flags) | ||
| 41 | __releases(lock); | ||
| 42 | |||
| 43 | #ifdef CONFIG_INLINE_READ_LOCK | ||
| 44 | #define _raw_read_lock(lock) __raw_read_lock(lock) | ||
| 45 | #endif | ||
| 46 | |||
| 47 | #ifdef CONFIG_INLINE_WRITE_LOCK | ||
| 48 | #define _raw_write_lock(lock) __raw_write_lock(lock) | ||
| 49 | #endif | ||
| 50 | |||
| 51 | #ifdef CONFIG_INLINE_READ_LOCK_BH | ||
| 52 | #define _raw_read_lock_bh(lock) __raw_read_lock_bh(lock) | ||
| 53 | #endif | ||
| 54 | |||
| 55 | #ifdef CONFIG_INLINE_WRITE_LOCK_BH | ||
| 56 | #define _raw_write_lock_bh(lock) __raw_write_lock_bh(lock) | ||
| 57 | #endif | ||
| 58 | |||
| 59 | #ifdef CONFIG_INLINE_READ_LOCK_IRQ | ||
| 60 | #define _raw_read_lock_irq(lock) __raw_read_lock_irq(lock) | ||
| 61 | #endif | ||
| 62 | |||
| 63 | #ifdef CONFIG_INLINE_WRITE_LOCK_IRQ | ||
| 64 | #define _raw_write_lock_irq(lock) __raw_write_lock_irq(lock) | ||
| 65 | #endif | ||
| 66 | |||
| 67 | #ifdef CONFIG_INLINE_READ_LOCK_IRQSAVE | ||
| 68 | #define _raw_read_lock_irqsave(lock) __raw_read_lock_irqsave(lock) | ||
| 69 | #endif | ||
| 70 | |||
| 71 | #ifdef CONFIG_INLINE_WRITE_LOCK_IRQSAVE | ||
| 72 | #define _raw_write_lock_irqsave(lock) __raw_write_lock_irqsave(lock) | ||
| 73 | #endif | ||
| 74 | |||
| 75 | #ifdef CONFIG_INLINE_READ_TRYLOCK | ||
| 76 | #define _raw_read_trylock(lock) __raw_read_trylock(lock) | ||
| 77 | #endif | ||
| 78 | |||
| 79 | #ifdef CONFIG_INLINE_WRITE_TRYLOCK | ||
| 80 | #define _raw_write_trylock(lock) __raw_write_trylock(lock) | ||
| 81 | #endif | ||
| 82 | |||
| 83 | #ifdef CONFIG_INLINE_READ_UNLOCK | ||
| 84 | #define _raw_read_unlock(lock) __raw_read_unlock(lock) | ||
| 85 | #endif | ||
| 86 | |||
| 87 | #ifdef CONFIG_INLINE_WRITE_UNLOCK | ||
| 88 | #define _raw_write_unlock(lock) __raw_write_unlock(lock) | ||
| 89 | #endif | ||
| 90 | |||
| 91 | #ifdef CONFIG_INLINE_READ_UNLOCK_BH | ||
| 92 | #define _raw_read_unlock_bh(lock) __raw_read_unlock_bh(lock) | ||
| 93 | #endif | ||
| 94 | |||
| 95 | #ifdef CONFIG_INLINE_WRITE_UNLOCK_BH | ||
| 96 | #define _raw_write_unlock_bh(lock) __raw_write_unlock_bh(lock) | ||
| 97 | #endif | ||
| 98 | |||
| 99 | #ifdef CONFIG_INLINE_READ_UNLOCK_IRQ | ||
| 100 | #define _raw_read_unlock_irq(lock) __raw_read_unlock_irq(lock) | ||
| 101 | #endif | ||
| 102 | |||
| 103 | #ifdef CONFIG_INLINE_WRITE_UNLOCK_IRQ | ||
| 104 | #define _raw_write_unlock_irq(lock) __raw_write_unlock_irq(lock) | ||
| 105 | #endif | ||
| 106 | |||
| 107 | #ifdef CONFIG_INLINE_READ_UNLOCK_IRQRESTORE | ||
| 108 | #define _raw_read_unlock_irqrestore(lock, flags) \ | ||
| 109 | __raw_read_unlock_irqrestore(lock, flags) | ||
| 110 | #endif | ||
| 111 | |||
| 112 | #ifdef CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE | ||
| 113 | #define _raw_write_unlock_irqrestore(lock, flags) \ | ||
| 114 | __raw_write_unlock_irqrestore(lock, flags) | ||
| 115 | #endif | ||
| 116 | |||
| 117 | static inline int __raw_read_trylock(rwlock_t *lock) | ||
| 118 | { | ||
| 119 | preempt_disable(); | ||
| 120 | if (do_raw_read_trylock(lock)) { | ||
| 121 | rwlock_acquire_read(&lock->dep_map, 0, 1, _RET_IP_); | ||
| 122 | return 1; | ||
| 123 | } | ||
| 124 | preempt_enable(); | ||
| 125 | return 0; | ||
| 126 | } | ||
| 127 | |||
| 128 | static inline int __raw_write_trylock(rwlock_t *lock) | ||
| 129 | { | ||
| 130 | preempt_disable(); | ||
| 131 | if (do_raw_write_trylock(lock)) { | ||
| 132 | rwlock_acquire(&lock->dep_map, 0, 1, _RET_IP_); | ||
| 133 | return 1; | ||
| 134 | } | ||
| 135 | preempt_enable(); | ||
| 136 | return 0; | ||
| 137 | } | ||
| 138 | |||
| 139 | /* | ||
| 140 | * If lockdep is enabled then we use the non-preemption spin-ops | ||
| 141 | * even on CONFIG_PREEMPT, because lockdep assumes that interrupts are | ||
| 142 | * not re-enabled during lock-acquire (which the preempt-spin-ops do): | ||
| 143 | */ | ||
| 144 | #if !defined(CONFIG_GENERIC_LOCKBREAK) || defined(CONFIG_DEBUG_LOCK_ALLOC) | ||
| 145 | |||
| 146 | static inline void __raw_read_lock(rwlock_t *lock) | ||
| 147 | { | ||
| 148 | preempt_disable(); | ||
| 149 | rwlock_acquire_read(&lock->dep_map, 0, 0, _RET_IP_); | ||
| 150 | LOCK_CONTENDED(lock, do_raw_read_trylock, do_raw_read_lock); | ||
| 151 | } | ||
| 152 | |||
| 153 | static inline unsigned long __raw_read_lock_irqsave(rwlock_t *lock) | ||
| 154 | { | ||
| 155 | unsigned long flags; | ||
| 156 | |||
| 157 | local_irq_save(flags); | ||
| 158 | preempt_disable(); | ||
| 159 | rwlock_acquire_read(&lock->dep_map, 0, 0, _RET_IP_); | ||
| 160 | LOCK_CONTENDED_FLAGS(lock, do_raw_read_trylock, do_raw_read_lock, | ||
| 161 | do_raw_read_lock_flags, &flags); | ||
| 162 | return flags; | ||
| 163 | } | ||
| 164 | |||
| 165 | static inline void __raw_read_lock_irq(rwlock_t *lock) | ||
| 166 | { | ||
| 167 | local_irq_disable(); | ||
| 168 | preempt_disable(); | ||
| 169 | rwlock_acquire_read(&lock->dep_map, 0, 0, _RET_IP_); | ||
| 170 | LOCK_CONTENDED(lock, do_raw_read_trylock, do_raw_read_lock); | ||
| 171 | } | ||
| 172 | |||
| 173 | static inline void __raw_read_lock_bh(rwlock_t *lock) | ||
| 174 | { | ||
| 175 | local_bh_disable(); | ||
| 176 | preempt_disable(); | ||
| 177 | rwlock_acquire_read(&lock->dep_map, 0, 0, _RET_IP_); | ||
| 178 | LOCK_CONTENDED(lock, do_raw_read_trylock, do_raw_read_lock); | ||
| 179 | } | ||
| 180 | |||
| 181 | static inline unsigned long __raw_write_lock_irqsave(rwlock_t *lock) | ||
| 182 | { | ||
| 183 | unsigned long flags; | ||
| 184 | |||
| 185 | local_irq_save(flags); | ||
| 186 | preempt_disable(); | ||
| 187 | rwlock_acquire(&lock->dep_map, 0, 0, _RET_IP_); | ||
| 188 | LOCK_CONTENDED_FLAGS(lock, do_raw_write_trylock, do_raw_write_lock, | ||
| 189 | do_raw_write_lock_flags, &flags); | ||
| 190 | return flags; | ||
| 191 | } | ||
| 192 | |||
| 193 | static inline void __raw_write_lock_irq(rwlock_t *lock) | ||
| 194 | { | ||
| 195 | local_irq_disable(); | ||
| 196 | preempt_disable(); | ||
| 197 | rwlock_acquire(&lock->dep_map, 0, 0, _RET_IP_); | ||
| 198 | LOCK_CONTENDED(lock, do_raw_write_trylock, do_raw_write_lock); | ||
| 199 | } | ||
| 200 | |||
| 201 | static inline void __raw_write_lock_bh(rwlock_t *lock) | ||
| 202 | { | ||
| 203 | local_bh_disable(); | ||
| 204 | preempt_disable(); | ||
| 205 | rwlock_acquire(&lock->dep_map, 0, 0, _RET_IP_); | ||
| 206 | LOCK_CONTENDED(lock, do_raw_write_trylock, do_raw_write_lock); | ||
| 207 | } | ||
| 208 | |||
| 209 | static inline void __raw_write_lock(rwlock_t *lock) | ||
| 210 | { | ||
| 211 | preempt_disable(); | ||
| 212 | rwlock_acquire(&lock->dep_map, 0, 0, _RET_IP_); | ||
| 213 | LOCK_CONTENDED(lock, do_raw_write_trylock, do_raw_write_lock); | ||
| 214 | } | ||
| 215 | |||
| 216 | #endif /* CONFIG_PREEMPT */ | ||
| 217 | |||
| 218 | static inline void __raw_write_unlock(rwlock_t *lock) | ||
| 219 | { | ||
| 220 | rwlock_release(&lock->dep_map, 1, _RET_IP_); | ||
| 221 | do_raw_write_unlock(lock); | ||
| 222 | preempt_enable(); | ||
| 223 | } | ||
| 224 | |||
| 225 | static inline void __raw_read_unlock(rwlock_t *lock) | ||
| 226 | { | ||
| 227 | rwlock_release(&lock->dep_map, 1, _RET_IP_); | ||
| 228 | do_raw_read_unlock(lock); | ||
| 229 | preempt_enable(); | ||
| 230 | } | ||
| 231 | |||
| 232 | static inline void | ||
| 233 | __raw_read_unlock_irqrestore(rwlock_t *lock, unsigned long flags) | ||
| 234 | { | ||
| 235 | rwlock_release(&lock->dep_map, 1, _RET_IP_); | ||
| 236 | do_raw_read_unlock(lock); | ||
| 237 | local_irq_restore(flags); | ||
| 238 | preempt_enable(); | ||
| 239 | } | ||
| 240 | |||
| 241 | static inline void __raw_read_unlock_irq(rwlock_t *lock) | ||
| 242 | { | ||
| 243 | rwlock_release(&lock->dep_map, 1, _RET_IP_); | ||
| 244 | do_raw_read_unlock(lock); | ||
| 245 | local_irq_enable(); | ||
| 246 | preempt_enable(); | ||
| 247 | } | ||
| 248 | |||
| 249 | static inline void __raw_read_unlock_bh(rwlock_t *lock) | ||
| 250 | { | ||
| 251 | rwlock_release(&lock->dep_map, 1, _RET_IP_); | ||
| 252 | do_raw_read_unlock(lock); | ||
| 253 | preempt_enable_no_resched(); | ||
| 254 | local_bh_enable_ip((unsigned long)__builtin_return_address(0)); | ||
| 255 | } | ||
| 256 | |||
| 257 | static inline void __raw_write_unlock_irqrestore(rwlock_t *lock, | ||
| 258 | unsigned long flags) | ||
| 259 | { | ||
| 260 | rwlock_release(&lock->dep_map, 1, _RET_IP_); | ||
| 261 | do_raw_write_unlock(lock); | ||
| 262 | local_irq_restore(flags); | ||
| 263 | preempt_enable(); | ||
| 264 | } | ||
| 265 | |||
| 266 | static inline void __raw_write_unlock_irq(rwlock_t *lock) | ||
| 267 | { | ||
| 268 | rwlock_release(&lock->dep_map, 1, _RET_IP_); | ||
| 269 | do_raw_write_unlock(lock); | ||
| 270 | local_irq_enable(); | ||
| 271 | preempt_enable(); | ||
| 272 | } | ||
| 273 | |||
| 274 | static inline void __raw_write_unlock_bh(rwlock_t *lock) | ||
| 275 | { | ||
| 276 | rwlock_release(&lock->dep_map, 1, _RET_IP_); | ||
| 277 | do_raw_write_unlock(lock); | ||
| 278 | preempt_enable_no_resched(); | ||
| 279 | local_bh_enable_ip((unsigned long)__builtin_return_address(0)); | ||
| 280 | } | ||
| 281 | |||
| 282 | #endif /* __LINUX_RWLOCK_API_SMP_H */ | ||
diff --git a/include/linux/rwlock_types.h b/include/linux/rwlock_types.h new file mode 100644 index 000000000000..bd31808c7d8e --- /dev/null +++ b/include/linux/rwlock_types.h | |||
| @@ -0,0 +1,56 @@ | |||
| 1 | #ifndef __LINUX_RWLOCK_TYPES_H | ||
| 2 | #define __LINUX_RWLOCK_TYPES_H | ||
| 3 | |||
| 4 | /* | ||
| 5 | * include/linux/rwlock_types.h - generic rwlock type definitions | ||
| 6 | * and initializers | ||
| 7 | * | ||
| 8 | * portions Copyright 2005, Red Hat, Inc., Ingo Molnar | ||
| 9 | * Released under the General Public License (GPL). | ||
| 10 | */ | ||
| 11 | typedef struct { | ||
| 12 | arch_rwlock_t raw_lock; | ||
| 13 | #ifdef CONFIG_GENERIC_LOCKBREAK | ||
| 14 | unsigned int break_lock; | ||
| 15 | #endif | ||
| 16 | #ifdef CONFIG_DEBUG_SPINLOCK | ||
| 17 | unsigned int magic, owner_cpu; | ||
| 18 | void *owner; | ||
| 19 | #endif | ||
| 20 | #ifdef CONFIG_DEBUG_LOCK_ALLOC | ||
| 21 | struct lockdep_map dep_map; | ||
| 22 | #endif | ||
| 23 | } rwlock_t; | ||
| 24 | |||
| 25 | #define RWLOCK_MAGIC 0xdeaf1eed | ||
| 26 | |||
| 27 | #ifdef CONFIG_DEBUG_LOCK_ALLOC | ||
| 28 | # define RW_DEP_MAP_INIT(lockname) .dep_map = { .name = #lockname } | ||
| 29 | #else | ||
| 30 | # define RW_DEP_MAP_INIT(lockname) | ||
| 31 | #endif | ||
| 32 | |||
| 33 | #ifdef CONFIG_DEBUG_SPINLOCK | ||
| 34 | #define __RW_LOCK_UNLOCKED(lockname) \ | ||
| 35 | (rwlock_t) { .raw_lock = __ARCH_RW_LOCK_UNLOCKED, \ | ||
| 36 | .magic = RWLOCK_MAGIC, \ | ||
| 37 | .owner = SPINLOCK_OWNER_INIT, \ | ||
| 38 | .owner_cpu = -1, \ | ||
| 39 | RW_DEP_MAP_INIT(lockname) } | ||
| 40 | #else | ||
| 41 | #define __RW_LOCK_UNLOCKED(lockname) \ | ||
| 42 | (rwlock_t) { .raw_lock = __ARCH_RW_LOCK_UNLOCKED, \ | ||
| 43 | RW_DEP_MAP_INIT(lockname) } | ||
| 44 | #endif | ||
| 45 | |||
| 46 | /* | ||
| 47 | * RW_LOCK_UNLOCKED defeat lockdep state tracking and is hence | ||
| 48 | * deprecated. | ||
| 49 | * | ||
| 50 | * Please use DEFINE_RWLOCK() or __RW_LOCK_UNLOCKED() as appropriate. | ||
| 51 | */ | ||
| 52 | #define RW_LOCK_UNLOCKED __RW_LOCK_UNLOCKED(old_style_rw_init) | ||
| 53 | |||
| 54 | #define DEFINE_RWLOCK(x) rwlock_t x = __RW_LOCK_UNLOCKED(x) | ||
| 55 | |||
| 56 | #endif /* __LINUX_RWLOCK_TYPES_H */ | ||
diff --git a/include/linux/rwsem-spinlock.h b/include/linux/rwsem-spinlock.h index 6c3c0f6c261f..bdfcc2527970 100644 --- a/include/linux/rwsem-spinlock.h +++ b/include/linux/rwsem-spinlock.h | |||
| @@ -68,11 +68,7 @@ extern int __down_write_trylock(struct rw_semaphore *sem); | |||
| 68 | extern void __up_read(struct rw_semaphore *sem); | 68 | extern void __up_read(struct rw_semaphore *sem); |
| 69 | extern void __up_write(struct rw_semaphore *sem); | 69 | extern void __up_write(struct rw_semaphore *sem); |
| 70 | extern void __downgrade_write(struct rw_semaphore *sem); | 70 | extern void __downgrade_write(struct rw_semaphore *sem); |
| 71 | 71 | extern int rwsem_is_locked(struct rw_semaphore *sem); | |
| 72 | static inline int rwsem_is_locked(struct rw_semaphore *sem) | ||
| 73 | { | ||
| 74 | return (sem->activity != 0); | ||
| 75 | } | ||
| 76 | 72 | ||
| 77 | #endif /* __KERNEL__ */ | 73 | #endif /* __KERNEL__ */ |
| 78 | #endif /* _LINUX_RWSEM_SPINLOCK_H */ | 74 | #endif /* _LINUX_RWSEM_SPINLOCK_H */ |
diff --git a/include/linux/sched.h b/include/linux/sched.h index 724814191fe9..225347d97d47 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h | |||
| @@ -100,7 +100,7 @@ struct sched_param { | |||
| 100 | struct exec_domain; | 100 | struct exec_domain; |
| 101 | struct futex_pi_state; | 101 | struct futex_pi_state; |
| 102 | struct robust_list_head; | 102 | struct robust_list_head; |
| 103 | struct bio; | 103 | struct bio_list; |
| 104 | struct fs_struct; | 104 | struct fs_struct; |
| 105 | struct bts_context; | 105 | struct bts_context; |
| 106 | struct perf_event_context; | 106 | struct perf_event_context; |
| @@ -148,7 +148,6 @@ extern unsigned long this_cpu_load(void); | |||
| 148 | 148 | ||
| 149 | 149 | ||
| 150 | extern void calc_global_load(void); | 150 | extern void calc_global_load(void); |
| 151 | extern u64 cpu_nr_migrations(int cpu); | ||
| 152 | 151 | ||
| 153 | extern unsigned long get_parent_ip(unsigned long addr); | 152 | extern unsigned long get_parent_ip(unsigned long addr); |
| 154 | 153 | ||
| @@ -174,8 +173,6 @@ print_cfs_rq(struct seq_file *m, int cpu, struct cfs_rq *cfs_rq) | |||
| 174 | } | 173 | } |
| 175 | #endif | 174 | #endif |
| 176 | 175 | ||
| 177 | extern unsigned long long time_sync_thresh; | ||
| 178 | |||
| 179 | /* | 176 | /* |
| 180 | * Task state bitmask. NOTE! These bits are also | 177 | * Task state bitmask. NOTE! These bits are also |
| 181 | * encoded in fs/proc/array.c: get_task_state(). | 178 | * encoded in fs/proc/array.c: get_task_state(). |
| @@ -198,6 +195,12 @@ extern unsigned long long time_sync_thresh; | |||
| 198 | #define TASK_DEAD 64 | 195 | #define TASK_DEAD 64 |
| 199 | #define TASK_WAKEKILL 128 | 196 | #define TASK_WAKEKILL 128 |
| 200 | #define TASK_WAKING 256 | 197 | #define TASK_WAKING 256 |
| 198 | #define TASK_STATE_MAX 512 | ||
| 199 | |||
| 200 | #define TASK_STATE_TO_CHAR_STR "RSDTtZXxKW" | ||
| 201 | |||
| 202 | extern char ___assert_task_state[1 - 2*!!( | ||
| 203 | sizeof(TASK_STATE_TO_CHAR_STR)-1 != ilog2(TASK_STATE_MAX)+1)]; | ||
| 201 | 204 | ||
| 202 | /* Convenience macros for the sake of set_task_state */ | 205 | /* Convenience macros for the sake of set_task_state */ |
| 203 | #define TASK_KILLABLE (TASK_WAKEKILL | TASK_UNINTERRUPTIBLE) | 206 | #define TASK_KILLABLE (TASK_WAKEKILL | TASK_UNINTERRUPTIBLE) |
| @@ -258,6 +261,10 @@ extern spinlock_t mmlist_lock; | |||
| 258 | 261 | ||
| 259 | struct task_struct; | 262 | struct task_struct; |
| 260 | 263 | ||
| 264 | #ifdef CONFIG_PROVE_RCU | ||
| 265 | extern int lockdep_tasklist_lock_is_held(void); | ||
| 266 | #endif /* #ifdef CONFIG_PROVE_RCU */ | ||
| 267 | |||
| 261 | extern void sched_init(void); | 268 | extern void sched_init(void); |
| 262 | extern void sched_init_smp(void); | 269 | extern void sched_init_smp(void); |
| 263 | extern asmlinkage void schedule_tail(struct task_struct *prev); | 270 | extern asmlinkage void schedule_tail(struct task_struct *prev); |
| @@ -310,6 +317,7 @@ extern void sched_show_task(struct task_struct *p); | |||
| 310 | #ifdef CONFIG_DETECT_SOFTLOCKUP | 317 | #ifdef CONFIG_DETECT_SOFTLOCKUP |
| 311 | extern void softlockup_tick(void); | 318 | extern void softlockup_tick(void); |
| 312 | extern void touch_softlockup_watchdog(void); | 319 | extern void touch_softlockup_watchdog(void); |
| 320 | extern void touch_softlockup_watchdog_sync(void); | ||
| 313 | extern void touch_all_softlockup_watchdogs(void); | 321 | extern void touch_all_softlockup_watchdogs(void); |
| 314 | extern int proc_dosoftlockup_thresh(struct ctl_table *table, int write, | 322 | extern int proc_dosoftlockup_thresh(struct ctl_table *table, int write, |
| 315 | void __user *buffer, | 323 | void __user *buffer, |
| @@ -323,6 +331,9 @@ static inline void softlockup_tick(void) | |||
| 323 | static inline void touch_softlockup_watchdog(void) | 331 | static inline void touch_softlockup_watchdog(void) |
| 324 | { | 332 | { |
| 325 | } | 333 | } |
| 334 | static inline void touch_softlockup_watchdog_sync(void) | ||
| 335 | { | ||
| 336 | } | ||
| 326 | static inline void touch_all_softlockup_watchdogs(void) | 337 | static inline void touch_all_softlockup_watchdogs(void) |
| 327 | { | 338 | { |
| 328 | } | 339 | } |
| @@ -352,7 +363,6 @@ extern signed long schedule_timeout(signed long timeout); | |||
| 352 | extern signed long schedule_timeout_interruptible(signed long timeout); | 363 | extern signed long schedule_timeout_interruptible(signed long timeout); |
| 353 | extern signed long schedule_timeout_killable(signed long timeout); | 364 | extern signed long schedule_timeout_killable(signed long timeout); |
| 354 | extern signed long schedule_timeout_uninterruptible(signed long timeout); | 365 | extern signed long schedule_timeout_uninterruptible(signed long timeout); |
| 355 | asmlinkage void __schedule(void); | ||
| 356 | asmlinkage void schedule(void); | 366 | asmlinkage void schedule(void); |
| 357 | extern int mutex_spin_on_owner(struct mutex *lock, struct thread_info *owner); | 367 | extern int mutex_spin_on_owner(struct mutex *lock, struct thread_info *owner); |
| 358 | 368 | ||
| @@ -378,6 +388,8 @@ extern int sysctl_max_map_count; | |||
| 378 | 388 | ||
| 379 | #include <linux/aio.h> | 389 | #include <linux/aio.h> |
| 380 | 390 | ||
| 391 | #ifdef CONFIG_MMU | ||
| 392 | extern void arch_pick_mmap_layout(struct mm_struct *mm); | ||
| 381 | extern unsigned long | 393 | extern unsigned long |
| 382 | arch_get_unmapped_area(struct file *, unsigned long, unsigned long, | 394 | arch_get_unmapped_area(struct file *, unsigned long, unsigned long, |
| 383 | unsigned long, unsigned long); | 395 | unsigned long, unsigned long); |
| @@ -387,61 +399,10 @@ arch_get_unmapped_area_topdown(struct file *filp, unsigned long addr, | |||
| 387 | unsigned long flags); | 399 | unsigned long flags); |
| 388 | extern void arch_unmap_area(struct mm_struct *, unsigned long); | 400 | extern void arch_unmap_area(struct mm_struct *, unsigned long); |
| 389 | extern void arch_unmap_area_topdown(struct mm_struct *, unsigned long); | 401 | extern void arch_unmap_area_topdown(struct mm_struct *, unsigned long); |
| 402 | #else | ||
| 403 | static inline void arch_pick_mmap_layout(struct mm_struct *mm) {} | ||
| 404 | #endif | ||
| 390 | 405 | ||
| 391 | #if USE_SPLIT_PTLOCKS | ||
| 392 | /* | ||
| 393 | * The mm counters are not protected by its page_table_lock, | ||
| 394 | * so must be incremented atomically. | ||
| 395 | */ | ||
| 396 | #define set_mm_counter(mm, member, value) atomic_long_set(&(mm)->_##member, value) | ||
| 397 | #define get_mm_counter(mm, member) ((unsigned long)atomic_long_read(&(mm)->_##member)) | ||
| 398 | #define add_mm_counter(mm, member, value) atomic_long_add(value, &(mm)->_##member) | ||
| 399 | #define inc_mm_counter(mm, member) atomic_long_inc(&(mm)->_##member) | ||
| 400 | #define dec_mm_counter(mm, member) atomic_long_dec(&(mm)->_##member) | ||
| 401 | |||
| 402 | #else /* !USE_SPLIT_PTLOCKS */ | ||
| 403 | /* | ||
| 404 | * The mm counters are protected by its page_table_lock, | ||
| 405 | * so can be incremented directly. | ||
| 406 | */ | ||
| 407 | #define set_mm_counter(mm, member, value) (mm)->_##member = (value) | ||
| 408 | #define get_mm_counter(mm, member) ((mm)->_##member) | ||
| 409 | #define add_mm_counter(mm, member, value) (mm)->_##member += (value) | ||
| 410 | #define inc_mm_counter(mm, member) (mm)->_##member++ | ||
| 411 | #define dec_mm_counter(mm, member) (mm)->_##member-- | ||
| 412 | |||
| 413 | #endif /* !USE_SPLIT_PTLOCKS */ | ||
| 414 | |||
| 415 | #define get_mm_rss(mm) \ | ||
| 416 | (get_mm_counter(mm, file_rss) + get_mm_counter(mm, anon_rss)) | ||
| 417 | #define update_hiwater_rss(mm) do { \ | ||
| 418 | unsigned long _rss = get_mm_rss(mm); \ | ||
| 419 | if ((mm)->hiwater_rss < _rss) \ | ||
| 420 | (mm)->hiwater_rss = _rss; \ | ||
| 421 | } while (0) | ||
| 422 | #define update_hiwater_vm(mm) do { \ | ||
| 423 | if ((mm)->hiwater_vm < (mm)->total_vm) \ | ||
| 424 | (mm)->hiwater_vm = (mm)->total_vm; \ | ||
| 425 | } while (0) | ||
| 426 | |||
| 427 | static inline unsigned long get_mm_hiwater_rss(struct mm_struct *mm) | ||
| 428 | { | ||
| 429 | return max(mm->hiwater_rss, get_mm_rss(mm)); | ||
| 430 | } | ||
| 431 | |||
| 432 | static inline void setmax_mm_hiwater_rss(unsigned long *maxrss, | ||
| 433 | struct mm_struct *mm) | ||
| 434 | { | ||
| 435 | unsigned long hiwater_rss = get_mm_hiwater_rss(mm); | ||
| 436 | |||
| 437 | if (*maxrss < hiwater_rss) | ||
| 438 | *maxrss = hiwater_rss; | ||
| 439 | } | ||
| 440 | |||
| 441 | static inline unsigned long get_mm_hiwater_vm(struct mm_struct *mm) | ||
| 442 | { | ||
| 443 | return max(mm->hiwater_vm, mm->total_vm); | ||
| 444 | } | ||
| 445 | 406 | ||
| 446 | extern void set_dumpable(struct mm_struct *mm, int value); | 407 | extern void set_dumpable(struct mm_struct *mm, int value); |
| 447 | extern int get_dumpable(struct mm_struct *mm); | 408 | extern int get_dumpable(struct mm_struct *mm); |
| @@ -631,6 +592,9 @@ struct signal_struct { | |||
| 631 | cputime_t utime, stime, cutime, cstime; | 592 | cputime_t utime, stime, cutime, cstime; |
| 632 | cputime_t gtime; | 593 | cputime_t gtime; |
| 633 | cputime_t cgtime; | 594 | cputime_t cgtime; |
| 595 | #ifndef CONFIG_VIRT_CPU_ACCOUNTING | ||
| 596 | cputime_t prev_utime, prev_stime; | ||
| 597 | #endif | ||
| 634 | unsigned long nvcsw, nivcsw, cnvcsw, cnivcsw; | 598 | unsigned long nvcsw, nivcsw, cnvcsw, cnivcsw; |
| 635 | unsigned long min_flt, maj_flt, cmin_flt, cmaj_flt; | 599 | unsigned long min_flt, maj_flt, cmin_flt, cmaj_flt; |
| 636 | unsigned long inblock, oublock, cinblock, coublock; | 600 | unsigned long inblock, oublock, cinblock, coublock; |
| @@ -729,14 +693,6 @@ struct user_struct { | |||
| 729 | uid_t uid; | 693 | uid_t uid; |
| 730 | struct user_namespace *user_ns; | 694 | struct user_namespace *user_ns; |
| 731 | 695 | ||
| 732 | #ifdef CONFIG_USER_SCHED | ||
| 733 | struct task_group *tg; | ||
| 734 | #ifdef CONFIG_SYSFS | ||
| 735 | struct kobject kobj; | ||
| 736 | struct delayed_work work; | ||
| 737 | #endif | ||
| 738 | #endif | ||
| 739 | |||
| 740 | #ifdef CONFIG_PERF_EVENTS | 696 | #ifdef CONFIG_PERF_EVENTS |
| 741 | atomic_long_t locked_vm; | 697 | atomic_long_t locked_vm; |
| 742 | #endif | 698 | #endif |
| @@ -867,7 +823,10 @@ static inline int sd_balance_for_mc_power(void) | |||
| 867 | if (sched_smt_power_savings) | 823 | if (sched_smt_power_savings) |
| 868 | return SD_POWERSAVINGS_BALANCE; | 824 | return SD_POWERSAVINGS_BALANCE; |
| 869 | 825 | ||
| 870 | return SD_PREFER_SIBLING; | 826 | if (!sched_mc_power_savings) |
| 827 | return SD_PREFER_SIBLING; | ||
| 828 | |||
| 829 | return 0; | ||
| 871 | } | 830 | } |
| 872 | 831 | ||
| 873 | static inline int sd_balance_for_package_power(void) | 832 | static inline int sd_balance_for_package_power(void) |
| @@ -1016,9 +975,13 @@ static inline struct cpumask *sched_domain_span(struct sched_domain *sd) | |||
| 1016 | return to_cpumask(sd->span); | 975 | return to_cpumask(sd->span); |
| 1017 | } | 976 | } |
| 1018 | 977 | ||
| 1019 | extern void partition_sched_domains(int ndoms_new, struct cpumask *doms_new, | 978 | extern void partition_sched_domains(int ndoms_new, cpumask_var_t doms_new[], |
| 1020 | struct sched_domain_attr *dattr_new); | 979 | struct sched_domain_attr *dattr_new); |
| 1021 | 980 | ||
| 981 | /* Allocate an array of sched domains, for partition_sched_domains(). */ | ||
| 982 | cpumask_var_t *alloc_sched_domains(unsigned int ndoms); | ||
| 983 | void free_sched_domains(cpumask_var_t doms[], unsigned int ndoms); | ||
| 984 | |||
| 1022 | /* Test a flag in parent sched domain */ | 985 | /* Test a flag in parent sched domain */ |
| 1023 | static inline int test_sd_parent(struct sched_domain *sd, int flag) | 986 | static inline int test_sd_parent(struct sched_domain *sd, int flag) |
| 1024 | { | 987 | { |
| @@ -1036,7 +999,7 @@ unsigned long default_scale_smt_power(struct sched_domain *sd, int cpu); | |||
| 1036 | struct sched_domain_attr; | 999 | struct sched_domain_attr; |
| 1037 | 1000 | ||
| 1038 | static inline void | 1001 | static inline void |
| 1039 | partition_sched_domains(int ndoms_new, struct cpumask *doms_new, | 1002 | partition_sched_domains(int ndoms_new, cpumask_var_t doms_new[], |
| 1040 | struct sched_domain_attr *dattr_new) | 1003 | struct sched_domain_attr *dattr_new) |
| 1041 | { | 1004 | { |
| 1042 | } | 1005 | } |
| @@ -1069,7 +1032,8 @@ struct sched_domain; | |||
| 1069 | struct sched_class { | 1032 | struct sched_class { |
| 1070 | const struct sched_class *next; | 1033 | const struct sched_class *next; |
| 1071 | 1034 | ||
| 1072 | void (*enqueue_task) (struct rq *rq, struct task_struct *p, int wakeup); | 1035 | void (*enqueue_task) (struct rq *rq, struct task_struct *p, int wakeup, |
| 1036 | bool head); | ||
| 1073 | void (*dequeue_task) (struct rq *rq, struct task_struct *p, int sleep); | 1037 | void (*dequeue_task) (struct rq *rq, struct task_struct *p, int sleep); |
| 1074 | void (*yield_task) (struct rq *rq); | 1038 | void (*yield_task) (struct rq *rq); |
| 1075 | 1039 | ||
| @@ -1081,17 +1045,10 @@ struct sched_class { | |||
| 1081 | #ifdef CONFIG_SMP | 1045 | #ifdef CONFIG_SMP |
| 1082 | int (*select_task_rq)(struct task_struct *p, int sd_flag, int flags); | 1046 | int (*select_task_rq)(struct task_struct *p, int sd_flag, int flags); |
| 1083 | 1047 | ||
| 1084 | unsigned long (*load_balance) (struct rq *this_rq, int this_cpu, | ||
| 1085 | struct rq *busiest, unsigned long max_load_move, | ||
| 1086 | struct sched_domain *sd, enum cpu_idle_type idle, | ||
| 1087 | int *all_pinned, int *this_best_prio); | ||
| 1088 | |||
| 1089 | int (*move_one_task) (struct rq *this_rq, int this_cpu, | ||
| 1090 | struct rq *busiest, struct sched_domain *sd, | ||
| 1091 | enum cpu_idle_type idle); | ||
| 1092 | void (*pre_schedule) (struct rq *this_rq, struct task_struct *task); | 1048 | void (*pre_schedule) (struct rq *this_rq, struct task_struct *task); |
| 1093 | void (*post_schedule) (struct rq *this_rq); | 1049 | void (*post_schedule) (struct rq *this_rq); |
| 1094 | void (*task_wake_up) (struct rq *this_rq, struct task_struct *task); | 1050 | void (*task_waking) (struct rq *this_rq, struct task_struct *task); |
| 1051 | void (*task_woken) (struct rq *this_rq, struct task_struct *task); | ||
| 1095 | 1052 | ||
| 1096 | void (*set_cpus_allowed)(struct task_struct *p, | 1053 | void (*set_cpus_allowed)(struct task_struct *p, |
| 1097 | const struct cpumask *newmask); | 1054 | const struct cpumask *newmask); |
| @@ -1102,7 +1059,7 @@ struct sched_class { | |||
| 1102 | 1059 | ||
| 1103 | void (*set_curr_task) (struct rq *rq); | 1060 | void (*set_curr_task) (struct rq *rq); |
| 1104 | void (*task_tick) (struct rq *rq, struct task_struct *p, int queued); | 1061 | void (*task_tick) (struct rq *rq, struct task_struct *p, int queued); |
| 1105 | void (*task_new) (struct rq *rq, struct task_struct *p); | 1062 | void (*task_fork) (struct task_struct *p); |
| 1106 | 1063 | ||
| 1107 | void (*switched_from) (struct rq *this_rq, struct task_struct *task, | 1064 | void (*switched_from) (struct rq *this_rq, struct task_struct *task, |
| 1108 | int running); | 1065 | int running); |
| @@ -1111,10 +1068,11 @@ struct sched_class { | |||
| 1111 | void (*prio_changed) (struct rq *this_rq, struct task_struct *task, | 1068 | void (*prio_changed) (struct rq *this_rq, struct task_struct *task, |
| 1112 | int oldprio, int running); | 1069 | int oldprio, int running); |
| 1113 | 1070 | ||
| 1114 | unsigned int (*get_rr_interval) (struct task_struct *task); | 1071 | unsigned int (*get_rr_interval) (struct rq *rq, |
| 1072 | struct task_struct *task); | ||
| 1115 | 1073 | ||
| 1116 | #ifdef CONFIG_FAIR_GROUP_SCHED | 1074 | #ifdef CONFIG_FAIR_GROUP_SCHED |
| 1117 | void (*moved_group) (struct task_struct *p); | 1075 | void (*moved_group) (struct task_struct *p, int on_rq); |
| 1118 | #endif | 1076 | #endif |
| 1119 | }; | 1077 | }; |
| 1120 | 1078 | ||
| @@ -1151,8 +1109,6 @@ struct sched_entity { | |||
| 1151 | u64 start_runtime; | 1109 | u64 start_runtime; |
| 1152 | u64 avg_wakeup; | 1110 | u64 avg_wakeup; |
| 1153 | 1111 | ||
| 1154 | u64 avg_running; | ||
| 1155 | |||
| 1156 | #ifdef CONFIG_SCHEDSTATS | 1112 | #ifdef CONFIG_SCHEDSTATS |
| 1157 | u64 wait_start; | 1113 | u64 wait_start; |
| 1158 | u64 wait_max; | 1114 | u64 wait_max; |
| @@ -1175,7 +1131,6 @@ struct sched_entity { | |||
| 1175 | u64 nr_failed_migrations_running; | 1131 | u64 nr_failed_migrations_running; |
| 1176 | u64 nr_failed_migrations_hot; | 1132 | u64 nr_failed_migrations_hot; |
| 1177 | u64 nr_forced_migrations; | 1133 | u64 nr_forced_migrations; |
| 1178 | u64 nr_forced2_migrations; | ||
| 1179 | 1134 | ||
| 1180 | u64 nr_wakeups; | 1135 | u64 nr_wakeups; |
| 1181 | u64 nr_wakeups_sync; | 1136 | u64 nr_wakeups_sync; |
| @@ -1273,7 +1228,9 @@ struct task_struct { | |||
| 1273 | struct plist_node pushable_tasks; | 1228 | struct plist_node pushable_tasks; |
| 1274 | 1229 | ||
| 1275 | struct mm_struct *mm, *active_mm; | 1230 | struct mm_struct *mm, *active_mm; |
| 1276 | 1231 | #if defined(SPLIT_RSS_COUNTING) | |
| 1232 | struct task_rss_stat rss_stat; | ||
| 1233 | #endif | ||
| 1277 | /* task state */ | 1234 | /* task state */ |
| 1278 | int exit_state; | 1235 | int exit_state; |
| 1279 | int exit_code, exit_signal; | 1236 | int exit_code, exit_signal; |
| @@ -1335,7 +1292,9 @@ struct task_struct { | |||
| 1335 | 1292 | ||
| 1336 | cputime_t utime, stime, utimescaled, stimescaled; | 1293 | cputime_t utime, stime, utimescaled, stimescaled; |
| 1337 | cputime_t gtime; | 1294 | cputime_t gtime; |
| 1295 | #ifndef CONFIG_VIRT_CPU_ACCOUNTING | ||
| 1338 | cputime_t prev_utime, prev_stime; | 1296 | cputime_t prev_utime, prev_stime; |
| 1297 | #endif | ||
| 1339 | unsigned long nvcsw, nivcsw; /* context switch counts */ | 1298 | unsigned long nvcsw, nivcsw; /* context switch counts */ |
| 1340 | struct timespec start_time; /* monotonic time */ | 1299 | struct timespec start_time; /* monotonic time */ |
| 1341 | struct timespec real_start_time; /* boot based time */ | 1300 | struct timespec real_start_time; /* boot based time */ |
| @@ -1358,7 +1317,7 @@ struct task_struct { | |||
| 1358 | char comm[TASK_COMM_LEN]; /* executable name excluding path | 1317 | char comm[TASK_COMM_LEN]; /* executable name excluding path |
| 1359 | - access with [gs]et_task_comm (which lock | 1318 | - access with [gs]et_task_comm (which lock |
| 1360 | it with task_lock()) | 1319 | it with task_lock()) |
| 1361 | - initialized normally by flush_old_exec */ | 1320 | - initialized normally by setup_new_exec */ |
| 1362 | /* file system info */ | 1321 | /* file system info */ |
| 1363 | int link_count, total_link_count; | 1322 | int link_count, total_link_count; |
| 1364 | #ifdef CONFIG_SYSVIPC | 1323 | #ifdef CONFIG_SYSVIPC |
| @@ -1410,7 +1369,7 @@ struct task_struct { | |||
| 1410 | #endif | 1369 | #endif |
| 1411 | 1370 | ||
| 1412 | /* Protection of the PI data structures: */ | 1371 | /* Protection of the PI data structures: */ |
| 1413 | spinlock_t pi_lock; | 1372 | raw_spinlock_t pi_lock; |
| 1414 | 1373 | ||
| 1415 | #ifdef CONFIG_RT_MUTEXES | 1374 | #ifdef CONFIG_RT_MUTEXES |
| 1416 | /* PI waiters blocked on a rt_mutex held by this task */ | 1375 | /* PI waiters blocked on a rt_mutex held by this task */ |
| @@ -1425,17 +1384,17 @@ struct task_struct { | |||
| 1425 | #endif | 1384 | #endif |
| 1426 | #ifdef CONFIG_TRACE_IRQFLAGS | 1385 | #ifdef CONFIG_TRACE_IRQFLAGS |
| 1427 | unsigned int irq_events; | 1386 | unsigned int irq_events; |
| 1428 | int hardirqs_enabled; | ||
| 1429 | unsigned long hardirq_enable_ip; | 1387 | unsigned long hardirq_enable_ip; |
| 1430 | unsigned int hardirq_enable_event; | ||
| 1431 | unsigned long hardirq_disable_ip; | 1388 | unsigned long hardirq_disable_ip; |
| 1389 | unsigned int hardirq_enable_event; | ||
| 1432 | unsigned int hardirq_disable_event; | 1390 | unsigned int hardirq_disable_event; |
| 1433 | int softirqs_enabled; | 1391 | int hardirqs_enabled; |
| 1392 | int hardirq_context; | ||
| 1434 | unsigned long softirq_disable_ip; | 1393 | unsigned long softirq_disable_ip; |
| 1435 | unsigned int softirq_disable_event; | ||
| 1436 | unsigned long softirq_enable_ip; | 1394 | unsigned long softirq_enable_ip; |
| 1395 | unsigned int softirq_disable_event; | ||
| 1437 | unsigned int softirq_enable_event; | 1396 | unsigned int softirq_enable_event; |
| 1438 | int hardirq_context; | 1397 | int softirqs_enabled; |
| 1439 | int softirq_context; | 1398 | int softirq_context; |
| 1440 | #endif | 1399 | #endif |
| 1441 | #ifdef CONFIG_LOCKDEP | 1400 | #ifdef CONFIG_LOCKDEP |
| @@ -1451,7 +1410,7 @@ struct task_struct { | |||
| 1451 | void *journal_info; | 1410 | void *journal_info; |
| 1452 | 1411 | ||
| 1453 | /* stacked block device info */ | 1412 | /* stacked block device info */ |
| 1454 | struct bio *bio_list, **bio_tail; | 1413 | struct bio_list *bio_list; |
| 1455 | 1414 | ||
| 1456 | /* VM state */ | 1415 | /* VM state */ |
| 1457 | struct reclaim_state *reclaim_state; | 1416 | struct reclaim_state *reclaim_state; |
| @@ -1529,7 +1488,7 @@ struct task_struct { | |||
| 1529 | 1488 | ||
| 1530 | struct list_head *scm_work_list; | 1489 | struct list_head *scm_work_list; |
| 1531 | #ifdef CONFIG_FUNCTION_GRAPH_TRACER | 1490 | #ifdef CONFIG_FUNCTION_GRAPH_TRACER |
| 1532 | /* Index of current stored adress in ret_stack */ | 1491 | /* Index of current stored address in ret_stack */ |
| 1533 | int curr_ret_stack; | 1492 | int curr_ret_stack; |
| 1534 | /* Stack of return addresses for return function tracing */ | 1493 | /* Stack of return addresses for return function tracing */ |
| 1535 | struct ftrace_ret_stack *ret_stack; | 1494 | struct ftrace_ret_stack *ret_stack; |
| @@ -1549,11 +1508,18 @@ struct task_struct { | |||
| 1549 | /* bitmask of trace recursion */ | 1508 | /* bitmask of trace recursion */ |
| 1550 | unsigned long trace_recursion; | 1509 | unsigned long trace_recursion; |
| 1551 | #endif /* CONFIG_TRACING */ | 1510 | #endif /* CONFIG_TRACING */ |
| 1552 | unsigned long stack_start; | 1511 | #ifdef CONFIG_CGROUP_MEM_RES_CTLR /* memcg uses this to do batch job */ |
| 1512 | struct memcg_batch_info { | ||
| 1513 | int do_batch; /* incremented when batch uncharge started */ | ||
| 1514 | struct mem_cgroup *memcg; /* target memcg of uncharge */ | ||
| 1515 | unsigned long bytes; /* uncharged usage */ | ||
| 1516 | unsigned long memsw_bytes; /* uncharged mem+swap usage */ | ||
| 1517 | } memcg_batch; | ||
| 1518 | #endif | ||
| 1553 | }; | 1519 | }; |
| 1554 | 1520 | ||
| 1555 | /* Future-safe accessor for struct task_struct's cpus_allowed. */ | 1521 | /* Future-safe accessor for struct task_struct's cpus_allowed. */ |
| 1556 | #define tsk_cpumask(tsk) (&(tsk)->cpus_allowed) | 1522 | #define tsk_cpus_allowed(tsk) (&(tsk)->cpus_allowed) |
| 1557 | 1523 | ||
| 1558 | /* | 1524 | /* |
| 1559 | * Priority of a process goes from 0..MAX_PRIO-1, valid RT | 1525 | * Priority of a process goes from 0..MAX_PRIO-1, valid RT |
| @@ -1731,9 +1697,8 @@ static inline void put_task_struct(struct task_struct *t) | |||
| 1731 | __put_task_struct(t); | 1697 | __put_task_struct(t); |
| 1732 | } | 1698 | } |
| 1733 | 1699 | ||
| 1734 | extern cputime_t task_utime(struct task_struct *p); | 1700 | extern void task_times(struct task_struct *p, cputime_t *ut, cputime_t *st); |
| 1735 | extern cputime_t task_stime(struct task_struct *p); | 1701 | extern void thread_group_times(struct task_struct *p, cputime_t *ut, cputime_t *st); |
| 1736 | extern cputime_t task_gtime(struct task_struct *p); | ||
| 1737 | 1702 | ||
| 1738 | /* | 1703 | /* |
| 1739 | * Per process flags | 1704 | * Per process flags |
| @@ -1847,7 +1812,8 @@ static inline int set_cpus_allowed(struct task_struct *p, cpumask_t new_mask) | |||
| 1847 | extern int sched_clock_stable; | 1812 | extern int sched_clock_stable; |
| 1848 | #endif | 1813 | #endif |
| 1849 | 1814 | ||
| 1850 | extern unsigned long long sched_clock(void); | 1815 | /* ftrace calls sched_clock() directly */ |
| 1816 | extern unsigned long long notrace sched_clock(void); | ||
| 1851 | 1817 | ||
| 1852 | extern void sched_clock_init(void); | 1818 | extern void sched_clock_init(void); |
| 1853 | extern u64 sched_clock_cpu(int cpu); | 1819 | extern u64 sched_clock_cpu(int cpu); |
| @@ -1910,14 +1876,22 @@ extern unsigned int sysctl_sched_wakeup_granularity; | |||
| 1910 | extern unsigned int sysctl_sched_shares_ratelimit; | 1876 | extern unsigned int sysctl_sched_shares_ratelimit; |
| 1911 | extern unsigned int sysctl_sched_shares_thresh; | 1877 | extern unsigned int sysctl_sched_shares_thresh; |
| 1912 | extern unsigned int sysctl_sched_child_runs_first; | 1878 | extern unsigned int sysctl_sched_child_runs_first; |
| 1879 | |||
| 1880 | enum sched_tunable_scaling { | ||
| 1881 | SCHED_TUNABLESCALING_NONE, | ||
| 1882 | SCHED_TUNABLESCALING_LOG, | ||
| 1883 | SCHED_TUNABLESCALING_LINEAR, | ||
| 1884 | SCHED_TUNABLESCALING_END, | ||
| 1885 | }; | ||
| 1886 | extern enum sched_tunable_scaling sysctl_sched_tunable_scaling; | ||
| 1887 | |||
| 1913 | #ifdef CONFIG_SCHED_DEBUG | 1888 | #ifdef CONFIG_SCHED_DEBUG |
| 1914 | extern unsigned int sysctl_sched_features; | ||
| 1915 | extern unsigned int sysctl_sched_migration_cost; | 1889 | extern unsigned int sysctl_sched_migration_cost; |
| 1916 | extern unsigned int sysctl_sched_nr_migrate; | 1890 | extern unsigned int sysctl_sched_nr_migrate; |
| 1917 | extern unsigned int sysctl_sched_time_avg; | 1891 | extern unsigned int sysctl_sched_time_avg; |
| 1918 | extern unsigned int sysctl_timer_migration; | 1892 | extern unsigned int sysctl_timer_migration; |
| 1919 | 1893 | ||
| 1920 | int sched_nr_latency_handler(struct ctl_table *table, int write, | 1894 | int sched_proc_update_handler(struct ctl_table *table, int write, |
| 1921 | void __user *buffer, size_t *length, | 1895 | void __user *buffer, size_t *length, |
| 1922 | loff_t *ppos); | 1896 | loff_t *ppos); |
| 1923 | #endif | 1897 | #endif |
| @@ -2073,7 +2047,6 @@ extern int kill_proc_info(int, struct siginfo *, pid_t); | |||
| 2073 | extern int do_notify_parent(struct task_struct *, int); | 2047 | extern int do_notify_parent(struct task_struct *, int); |
| 2074 | extern void __wake_up_parent(struct task_struct *p, struct task_struct *parent); | 2048 | extern void __wake_up_parent(struct task_struct *p, struct task_struct *parent); |
| 2075 | extern void force_sig(int, struct task_struct *); | 2049 | extern void force_sig(int, struct task_struct *); |
| 2076 | extern void force_sig_specific(int, struct task_struct *); | ||
| 2077 | extern int send_sig(int, struct task_struct *, int); | 2050 | extern int send_sig(int, struct task_struct *, int); |
| 2078 | extern void zap_other_threads(struct task_struct *p); | 2051 | extern void zap_other_threads(struct task_struct *p); |
| 2079 | extern struct sigqueue *sigqueue_alloc(void); | 2052 | extern struct sigqueue *sigqueue_alloc(void); |
| @@ -2092,16 +2065,18 @@ static inline int kill_cad_pid(int sig, int priv) | |||
| 2092 | #define SEND_SIG_PRIV ((struct siginfo *) 1) | 2065 | #define SEND_SIG_PRIV ((struct siginfo *) 1) |
| 2093 | #define SEND_SIG_FORCED ((struct siginfo *) 2) | 2066 | #define SEND_SIG_FORCED ((struct siginfo *) 2) |
| 2094 | 2067 | ||
| 2095 | static inline int is_si_special(const struct siginfo *info) | 2068 | /* |
| 2096 | { | 2069 | * True if we are on the alternate signal stack. |
| 2097 | return info <= SEND_SIG_FORCED; | 2070 | */ |
| 2098 | } | ||
| 2099 | |||
| 2100 | /* True if we are on the alternate signal stack. */ | ||
| 2101 | |||
| 2102 | static inline int on_sig_stack(unsigned long sp) | 2071 | static inline int on_sig_stack(unsigned long sp) |
| 2103 | { | 2072 | { |
| 2104 | return (sp - current->sas_ss_sp < current->sas_ss_size); | 2073 | #ifdef CONFIG_STACK_GROWSUP |
| 2074 | return sp >= current->sas_ss_sp && | ||
| 2075 | sp - current->sas_ss_sp < current->sas_ss_size; | ||
| 2076 | #else | ||
| 2077 | return sp > current->sas_ss_sp && | ||
| 2078 | sp - current->sas_ss_sp <= current->sas_ss_size; | ||
| 2079 | #endif | ||
| 2105 | } | 2080 | } |
| 2106 | 2081 | ||
| 2107 | static inline int sas_ss_flags(unsigned long sp) | 2082 | static inline int sas_ss_flags(unsigned long sp) |
| @@ -2430,9 +2405,7 @@ void thread_group_cputimer(struct task_struct *tsk, struct task_cputime *times); | |||
| 2430 | 2405 | ||
| 2431 | static inline void thread_group_cputime_init(struct signal_struct *sig) | 2406 | static inline void thread_group_cputime_init(struct signal_struct *sig) |
| 2432 | { | 2407 | { |
| 2433 | sig->cputimer.cputime = INIT_CPUTIME; | ||
| 2434 | spin_lock_init(&sig->cputimer.lock); | 2408 | spin_lock_init(&sig->cputimer.lock); |
| 2435 | sig->cputimer.running = 0; | ||
| 2436 | } | 2409 | } |
| 2437 | 2410 | ||
| 2438 | static inline void thread_group_cputime_free(struct signal_struct *sig) | 2411 | static inline void thread_group_cputime_free(struct signal_struct *sig) |
| @@ -2475,8 +2448,6 @@ static inline void set_task_cpu(struct task_struct *p, unsigned int cpu) | |||
| 2475 | 2448 | ||
| 2476 | #endif /* CONFIG_SMP */ | 2449 | #endif /* CONFIG_SMP */ |
| 2477 | 2450 | ||
| 2478 | extern void arch_pick_mmap_layout(struct mm_struct *mm); | ||
| 2479 | |||
| 2480 | #ifdef CONFIG_TRACING | 2451 | #ifdef CONFIG_TRACING |
| 2481 | extern void | 2452 | extern void |
| 2482 | __trace_special(void *__tr, void *__data, | 2453 | __trace_special(void *__tr, void *__data, |
| @@ -2494,13 +2465,9 @@ extern long sched_getaffinity(pid_t pid, struct cpumask *mask); | |||
| 2494 | 2465 | ||
| 2495 | extern void normalize_rt_tasks(void); | 2466 | extern void normalize_rt_tasks(void); |
| 2496 | 2467 | ||
| 2497 | #ifdef CONFIG_GROUP_SCHED | 2468 | #ifdef CONFIG_CGROUP_SCHED |
| 2498 | 2469 | ||
| 2499 | extern struct task_group init_task_group; | 2470 | extern struct task_group init_task_group; |
| 2500 | #ifdef CONFIG_USER_SCHED | ||
| 2501 | extern struct task_group root_task_group; | ||
| 2502 | extern void set_tg_uid(struct user_struct *user); | ||
| 2503 | #endif | ||
| 2504 | 2471 | ||
| 2505 | extern struct task_group *sched_create_group(struct task_group *parent); | 2472 | extern struct task_group *sched_create_group(struct task_group *parent); |
| 2506 | extern void sched_destroy_group(struct task_group *tg); | 2473 | extern void sched_destroy_group(struct task_group *tg); |
| @@ -2585,7 +2552,27 @@ static inline void mm_init_owner(struct mm_struct *mm, struct task_struct *p) | |||
| 2585 | } | 2552 | } |
| 2586 | #endif /* CONFIG_MM_OWNER */ | 2553 | #endif /* CONFIG_MM_OWNER */ |
| 2587 | 2554 | ||
| 2588 | #define TASK_STATE_TO_CHAR_STR "RSDTtZX" | 2555 | static inline unsigned long task_rlimit(const struct task_struct *tsk, |
| 2556 | unsigned int limit) | ||
| 2557 | { | ||
| 2558 | return ACCESS_ONCE(tsk->signal->rlim[limit].rlim_cur); | ||
| 2559 | } | ||
| 2560 | |||
| 2561 | static inline unsigned long task_rlimit_max(const struct task_struct *tsk, | ||
| 2562 | unsigned int limit) | ||
| 2563 | { | ||
| 2564 | return ACCESS_ONCE(tsk->signal->rlim[limit].rlim_max); | ||
| 2565 | } | ||
| 2566 | |||
| 2567 | static inline unsigned long rlimit(unsigned int limit) | ||
| 2568 | { | ||
| 2569 | return task_rlimit(current, limit); | ||
| 2570 | } | ||
| 2571 | |||
| 2572 | static inline unsigned long rlimit_max(unsigned int limit) | ||
| 2573 | { | ||
| 2574 | return task_rlimit_max(current, limit); | ||
| 2575 | } | ||
| 2589 | 2576 | ||
| 2590 | #endif /* __KERNEL__ */ | 2577 | #endif /* __KERNEL__ */ |
| 2591 | 2578 | ||
diff --git a/include/linux/screen_info.h b/include/linux/screen_info.h index 1ee2c05142f6..899fbb487c94 100644 --- a/include/linux/screen_info.h +++ b/include/linux/screen_info.h | |||
| @@ -14,7 +14,8 @@ struct screen_info { | |||
| 14 | __u16 orig_video_page; /* 0x04 */ | 14 | __u16 orig_video_page; /* 0x04 */ |
| 15 | __u8 orig_video_mode; /* 0x06 */ | 15 | __u8 orig_video_mode; /* 0x06 */ |
| 16 | __u8 orig_video_cols; /* 0x07 */ | 16 | __u8 orig_video_cols; /* 0x07 */ |
| 17 | __u16 unused2; /* 0x08 */ | 17 | __u8 flags; /* 0x08 */ |
| 18 | __u8 unused2; /* 0x09 */ | ||
| 18 | __u16 orig_video_ega_bx;/* 0x0a */ | 19 | __u16 orig_video_ega_bx;/* 0x0a */ |
| 19 | __u16 unused3; /* 0x0c */ | 20 | __u16 unused3; /* 0x0c */ |
| 20 | __u8 orig_video_lines; /* 0x0e */ | 21 | __u8 orig_video_lines; /* 0x0e */ |
| @@ -65,6 +66,8 @@ struct screen_info { | |||
| 65 | 66 | ||
| 66 | #define VIDEO_TYPE_EFI 0x70 /* EFI graphic mode */ | 67 | #define VIDEO_TYPE_EFI 0x70 /* EFI graphic mode */ |
| 67 | 68 | ||
| 69 | #define VIDEO_FLAGS_NOCURSOR (1 << 0) /* The video mode has no cursor set */ | ||
| 70 | |||
| 68 | #ifdef __KERNEL__ | 71 | #ifdef __KERNEL__ |
| 69 | extern struct screen_info screen_info; | 72 | extern struct screen_info screen_info; |
| 70 | 73 | ||
diff --git a/include/linux/sctp.h b/include/linux/sctp.h index b464b9d3d242..c20d3ce673c0 100644 --- a/include/linux/sctp.h +++ b/include/linux/sctp.h | |||
| @@ -242,6 +242,7 @@ enum { | |||
| 242 | SCTP_DATA_FIRST_FRAG = 0x02, | 242 | SCTP_DATA_FIRST_FRAG = 0x02, |
| 243 | SCTP_DATA_NOT_FRAG = 0x03, | 243 | SCTP_DATA_NOT_FRAG = 0x03, |
| 244 | SCTP_DATA_UNORDERED = 0x04, | 244 | SCTP_DATA_UNORDERED = 0x04, |
| 245 | SCTP_DATA_SACK_IMM = 0x08, | ||
| 245 | }; | 246 | }; |
| 246 | enum { SCTP_DATA_FRAG_MASK = 0x03, }; | 247 | enum { SCTP_DATA_FRAG_MASK = 0x03, }; |
| 247 | 248 | ||
diff --git a/include/linux/securebits.h b/include/linux/securebits.h index d2c5ed845bcc..33406174cbe8 100644 --- a/include/linux/securebits.h +++ b/include/linux/securebits.h | |||
| @@ -1,6 +1,15 @@ | |||
| 1 | #ifndef _LINUX_SECUREBITS_H | 1 | #ifndef _LINUX_SECUREBITS_H |
| 2 | #define _LINUX_SECUREBITS_H 1 | 2 | #define _LINUX_SECUREBITS_H 1 |
| 3 | 3 | ||
| 4 | /* Each securesetting is implemented using two bits. One bit specifies | ||
| 5 | whether the setting is on or off. The other bit specify whether the | ||
| 6 | setting is locked or not. A setting which is locked cannot be | ||
| 7 | changed from user-level. */ | ||
| 8 | #define issecure_mask(X) (1 << (X)) | ||
| 9 | #ifdef __KERNEL__ | ||
| 10 | #define issecure(X) (issecure_mask(X) & current_cred_xxx(securebits)) | ||
| 11 | #endif | ||
| 12 | |||
| 4 | #define SECUREBITS_DEFAULT 0x00000000 | 13 | #define SECUREBITS_DEFAULT 0x00000000 |
| 5 | 14 | ||
| 6 | /* When set UID 0 has no special privileges. When unset, we support | 15 | /* When set UID 0 has no special privileges. When unset, we support |
| @@ -12,6 +21,9 @@ | |||
| 12 | #define SECURE_NOROOT 0 | 21 | #define SECURE_NOROOT 0 |
| 13 | #define SECURE_NOROOT_LOCKED 1 /* make bit-0 immutable */ | 22 | #define SECURE_NOROOT_LOCKED 1 /* make bit-0 immutable */ |
| 14 | 23 | ||
| 24 | #define SECBIT_NOROOT (issecure_mask(SECURE_NOROOT)) | ||
| 25 | #define SECBIT_NOROOT_LOCKED (issecure_mask(SECURE_NOROOT_LOCKED)) | ||
| 26 | |||
| 15 | /* When set, setuid to/from uid 0 does not trigger capability-"fixup". | 27 | /* When set, setuid to/from uid 0 does not trigger capability-"fixup". |
| 16 | When unset, to provide compatiblility with old programs relying on | 28 | When unset, to provide compatiblility with old programs relying on |
| 17 | set*uid to gain/lose privilege, transitions to/from uid 0 cause | 29 | set*uid to gain/lose privilege, transitions to/from uid 0 cause |
| @@ -19,6 +31,10 @@ | |||
| 19 | #define SECURE_NO_SETUID_FIXUP 2 | 31 | #define SECURE_NO_SETUID_FIXUP 2 |
| 20 | #define SECURE_NO_SETUID_FIXUP_LOCKED 3 /* make bit-2 immutable */ | 32 | #define SECURE_NO_SETUID_FIXUP_LOCKED 3 /* make bit-2 immutable */ |
| 21 | 33 | ||
| 34 | #define SECBIT_NO_SETUID_FIXUP (issecure_mask(SECURE_NO_SETUID_FIXUP)) | ||
| 35 | #define SECBIT_NO_SETUID_FIXUP_LOCKED \ | ||
| 36 | (issecure_mask(SECURE_NO_SETUID_FIXUP_LOCKED)) | ||
| 37 | |||
| 22 | /* When set, a process can retain its capabilities even after | 38 | /* When set, a process can retain its capabilities even after |
| 23 | transitioning to a non-root user (the set-uid fixup suppressed by | 39 | transitioning to a non-root user (the set-uid fixup suppressed by |
| 24 | bit 2). Bit-4 is cleared when a process calls exec(); setting both | 40 | bit 2). Bit-4 is cleared when a process calls exec(); setting both |
| @@ -27,12 +43,8 @@ | |||
| 27 | #define SECURE_KEEP_CAPS 4 | 43 | #define SECURE_KEEP_CAPS 4 |
| 28 | #define SECURE_KEEP_CAPS_LOCKED 5 /* make bit-4 immutable */ | 44 | #define SECURE_KEEP_CAPS_LOCKED 5 /* make bit-4 immutable */ |
| 29 | 45 | ||
| 30 | /* Each securesetting is implemented using two bits. One bit specifies | 46 | #define SECBIT_KEEP_CAPS (issecure_mask(SECURE_KEEP_CAPS)) |
| 31 | whether the setting is on or off. The other bit specify whether the | 47 | #define SECBIT_KEEP_CAPS_LOCKED (issecure_mask(SECURE_KEEP_CAPS_LOCKED)) |
| 32 | setting is locked or not. A setting which is locked cannot be | ||
| 33 | changed from user-level. */ | ||
| 34 | #define issecure_mask(X) (1 << (X)) | ||
| 35 | #define issecure(X) (issecure_mask(X) & current_cred_xxx(securebits)) | ||
| 36 | 48 | ||
| 37 | #define SECURE_ALL_BITS (issecure_mask(SECURE_NOROOT) | \ | 49 | #define SECURE_ALL_BITS (issecure_mask(SECURE_NOROOT) | \ |
| 38 | issecure_mask(SECURE_NO_SETUID_FIXUP) | \ | 50 | issecure_mask(SECURE_NO_SETUID_FIXUP) | \ |
diff --git a/include/linux/security.h b/include/linux/security.h index 239e40d0450b..3158dd982d27 100644 --- a/include/linux/security.h +++ b/include/linux/security.h | |||
| @@ -33,7 +33,7 @@ | |||
| 33 | #include <linux/sched.h> | 33 | #include <linux/sched.h> |
| 34 | #include <linux/key.h> | 34 | #include <linux/key.h> |
| 35 | #include <linux/xfrm.h> | 35 | #include <linux/xfrm.h> |
| 36 | #include <linux/gfp.h> | 36 | #include <linux/slab.h> |
| 37 | #include <net/flow.h> | 37 | #include <net/flow.h> |
| 38 | 38 | ||
| 39 | /* Maximum number of letters for an LSM name string */ | 39 | /* Maximum number of letters for an LSM name string */ |
| @@ -76,7 +76,7 @@ extern int cap_task_prctl(int option, unsigned long arg2, unsigned long arg3, | |||
| 76 | extern int cap_task_setscheduler(struct task_struct *p, int policy, struct sched_param *lp); | 76 | extern int cap_task_setscheduler(struct task_struct *p, int policy, struct sched_param *lp); |
| 77 | extern int cap_task_setioprio(struct task_struct *p, int ioprio); | 77 | extern int cap_task_setioprio(struct task_struct *p, int ioprio); |
| 78 | extern int cap_task_setnice(struct task_struct *p, int nice); | 78 | extern int cap_task_setnice(struct task_struct *p, int nice); |
| 79 | extern int cap_syslog(int type); | 79 | extern int cap_syslog(int type, bool from_file); |
| 80 | extern int cap_vm_enough_memory(struct mm_struct *mm, long pages); | 80 | extern int cap_vm_enough_memory(struct mm_struct *mm, long pages); |
| 81 | 81 | ||
| 82 | struct msghdr; | 82 | struct msghdr; |
| @@ -95,8 +95,15 @@ struct seq_file; | |||
| 95 | extern int cap_netlink_send(struct sock *sk, struct sk_buff *skb); | 95 | extern int cap_netlink_send(struct sock *sk, struct sk_buff *skb); |
| 96 | extern int cap_netlink_recv(struct sk_buff *skb, int cap); | 96 | extern int cap_netlink_recv(struct sk_buff *skb, int cap); |
| 97 | 97 | ||
| 98 | void reset_security_ops(void); | ||
| 99 | |||
| 100 | #ifdef CONFIG_MMU | ||
| 98 | extern unsigned long mmap_min_addr; | 101 | extern unsigned long mmap_min_addr; |
| 99 | extern unsigned long dac_mmap_min_addr; | 102 | extern unsigned long dac_mmap_min_addr; |
| 103 | #else | ||
| 104 | #define dac_mmap_min_addr 0UL | ||
| 105 | #endif | ||
| 106 | |||
| 100 | /* | 107 | /* |
| 101 | * Values used in the task_security_ops calls | 108 | * Values used in the task_security_ops calls |
| 102 | */ | 109 | */ |
| @@ -121,6 +128,7 @@ struct request_sock; | |||
| 121 | #define LSM_UNSAFE_PTRACE 2 | 128 | #define LSM_UNSAFE_PTRACE 2 |
| 122 | #define LSM_UNSAFE_PTRACE_CAP 4 | 129 | #define LSM_UNSAFE_PTRACE_CAP 4 |
| 123 | 130 | ||
| 131 | #ifdef CONFIG_MMU | ||
| 124 | /* | 132 | /* |
| 125 | * If a hint addr is less than mmap_min_addr change hint to be as | 133 | * If a hint addr is less than mmap_min_addr change hint to be as |
| 126 | * low as possible but still greater than mmap_min_addr | 134 | * low as possible but still greater than mmap_min_addr |
| @@ -135,6 +143,7 @@ static inline unsigned long round_hint_to_min(unsigned long hint) | |||
| 135 | } | 143 | } |
| 136 | extern int mmap_min_addr_handler(struct ctl_table *table, int write, | 144 | extern int mmap_min_addr_handler(struct ctl_table *table, int write, |
| 137 | void __user *buffer, size_t *lenp, loff_t *ppos); | 145 | void __user *buffer, size_t *lenp, loff_t *ppos); |
| 146 | #endif | ||
| 138 | 147 | ||
| 139 | #ifdef CONFIG_SECURITY | 148 | #ifdef CONFIG_SECURITY |
| 140 | 149 | ||
| @@ -447,6 +456,22 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts) | |||
| 447 | * @new_dir contains the path structure for parent of the new link. | 456 | * @new_dir contains the path structure for parent of the new link. |
| 448 | * @new_dentry contains the dentry structure of the new link. | 457 | * @new_dentry contains the dentry structure of the new link. |
| 449 | * Return 0 if permission is granted. | 458 | * Return 0 if permission is granted. |
| 459 | * @path_chmod: | ||
| 460 | * Check for permission to change DAC's permission of a file or directory. | ||
| 461 | * @dentry contains the dentry structure. | ||
| 462 | * @mnt contains the vfsmnt structure. | ||
| 463 | * @mode contains DAC's mode. | ||
| 464 | * Return 0 if permission is granted. | ||
| 465 | * @path_chown: | ||
| 466 | * Check for permission to change owner/group of a file or directory. | ||
| 467 | * @path contains the path structure. | ||
| 468 | * @uid contains new owner's ID. | ||
| 469 | * @gid contains new group's ID. | ||
| 470 | * Return 0 if permission is granted. | ||
| 471 | * @path_chroot: | ||
| 472 | * Check for permission to change root directory. | ||
| 473 | * @path contains the path structure. | ||
| 474 | * Return 0 if permission is granted. | ||
| 450 | * @inode_readlink: | 475 | * @inode_readlink: |
| 451 | * Check the permission to read the symbolic link. | 476 | * Check the permission to read the symbolic link. |
| 452 | * @dentry contains the dentry structure for the file link. | 477 | * @dentry contains the dentry structure for the file link. |
| @@ -690,6 +715,7 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts) | |||
| 690 | * @kernel_module_request: | 715 | * @kernel_module_request: |
| 691 | * Ability to trigger the kernel to automatically upcall to userspace for | 716 | * Ability to trigger the kernel to automatically upcall to userspace for |
| 692 | * userspace to load a kernel module with the given name. | 717 | * userspace to load a kernel module with the given name. |
| 718 | * @kmod_name name of the module requested by the kernel | ||
| 693 | * Return 0 if successful. | 719 | * Return 0 if successful. |
| 694 | * @task_setuid: | 720 | * @task_setuid: |
| 695 | * Check permission before setting one or more of the user identity | 721 | * Check permission before setting one or more of the user identity |
| @@ -961,6 +987,7 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts) | |||
| 961 | * Check permissions on incoming network packets. This hook is distinct | 987 | * Check permissions on incoming network packets. This hook is distinct |
| 962 | * from Netfilter's IP input hooks since it is the first time that the | 988 | * from Netfilter's IP input hooks since it is the first time that the |
| 963 | * incoming sk_buff @skb has been associated with a particular socket, @sk. | 989 | * incoming sk_buff @skb has been associated with a particular socket, @sk. |
| 990 | * Must not sleep inside this hook because some callers hold spinlocks. | ||
| 964 | * @sk contains the sock (not socket) associated with the incoming sk_buff. | 991 | * @sk contains the sock (not socket) associated with the incoming sk_buff. |
| 965 | * @skb contains the incoming network data. | 992 | * @skb contains the incoming network data. |
| 966 | * @socket_getpeersec_stream: | 993 | * @socket_getpeersec_stream: |
| @@ -1324,6 +1351,7 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts) | |||
| 1324 | * logging to the console. | 1351 | * logging to the console. |
| 1325 | * See the syslog(2) manual page for an explanation of the @type values. | 1352 | * See the syslog(2) manual page for an explanation of the @type values. |
| 1326 | * @type contains the type of action. | 1353 | * @type contains the type of action. |
| 1354 | * @from_file indicates the context of action (if it came from /proc). | ||
| 1327 | * Return 0 if permission is granted. | 1355 | * Return 0 if permission is granted. |
| 1328 | * @settime: | 1356 | * @settime: |
| 1329 | * Check permission to change the system time. | 1357 | * Check permission to change the system time. |
| @@ -1438,7 +1466,7 @@ struct security_operations { | |||
| 1438 | int (*sysctl) (struct ctl_table *table, int op); | 1466 | int (*sysctl) (struct ctl_table *table, int op); |
| 1439 | int (*quotactl) (int cmds, int type, int id, struct super_block *sb); | 1467 | int (*quotactl) (int cmds, int type, int id, struct super_block *sb); |
| 1440 | int (*quota_on) (struct dentry *dentry); | 1468 | int (*quota_on) (struct dentry *dentry); |
| 1441 | int (*syslog) (int type); | 1469 | int (*syslog) (int type, bool from_file); |
| 1442 | int (*settime) (struct timespec *ts, struct timezone *tz); | 1470 | int (*settime) (struct timespec *ts, struct timezone *tz); |
| 1443 | int (*vm_enough_memory) (struct mm_struct *mm, long pages); | 1471 | int (*vm_enough_memory) (struct mm_struct *mm, long pages); |
| 1444 | 1472 | ||
| @@ -1488,6 +1516,10 @@ struct security_operations { | |||
| 1488 | struct dentry *new_dentry); | 1516 | struct dentry *new_dentry); |
| 1489 | int (*path_rename) (struct path *old_dir, struct dentry *old_dentry, | 1517 | int (*path_rename) (struct path *old_dir, struct dentry *old_dentry, |
| 1490 | struct path *new_dir, struct dentry *new_dentry); | 1518 | struct path *new_dir, struct dentry *new_dentry); |
| 1519 | int (*path_chmod) (struct dentry *dentry, struct vfsmount *mnt, | ||
| 1520 | mode_t mode); | ||
| 1521 | int (*path_chown) (struct path *path, uid_t uid, gid_t gid); | ||
| 1522 | int (*path_chroot) (struct path *path); | ||
| 1491 | #endif | 1523 | #endif |
| 1492 | 1524 | ||
| 1493 | int (*inode_alloc_security) (struct inode *inode); | 1525 | int (*inode_alloc_security) (struct inode *inode); |
| @@ -1557,7 +1589,7 @@ struct security_operations { | |||
| 1557 | void (*cred_transfer)(struct cred *new, const struct cred *old); | 1589 | void (*cred_transfer)(struct cred *new, const struct cred *old); |
| 1558 | int (*kernel_act_as)(struct cred *new, u32 secid); | 1590 | int (*kernel_act_as)(struct cred *new, u32 secid); |
| 1559 | int (*kernel_create_files_as)(struct cred *new, struct inode *inode); | 1591 | int (*kernel_create_files_as)(struct cred *new, struct inode *inode); |
| 1560 | int (*kernel_module_request)(void); | 1592 | int (*kernel_module_request)(char *kmod_name); |
| 1561 | int (*task_setuid) (uid_t id0, uid_t id1, uid_t id2, int flags); | 1593 | int (*task_setuid) (uid_t id0, uid_t id1, uid_t id2, int flags); |
| 1562 | int (*task_fix_setuid) (struct cred *new, const struct cred *old, | 1594 | int (*task_fix_setuid) (struct cred *new, const struct cred *old, |
| 1563 | int flags); | 1595 | int flags); |
| @@ -1733,7 +1765,7 @@ int security_acct(struct file *file); | |||
| 1733 | int security_sysctl(struct ctl_table *table, int op); | 1765 | int security_sysctl(struct ctl_table *table, int op); |
| 1734 | int security_quotactl(int cmds, int type, int id, struct super_block *sb); | 1766 | int security_quotactl(int cmds, int type, int id, struct super_block *sb); |
| 1735 | int security_quota_on(struct dentry *dentry); | 1767 | int security_quota_on(struct dentry *dentry); |
| 1736 | int security_syslog(int type); | 1768 | int security_syslog(int type, bool from_file); |
| 1737 | int security_settime(struct timespec *ts, struct timezone *tz); | 1769 | int security_settime(struct timespec *ts, struct timezone *tz); |
| 1738 | int security_vm_enough_memory(long pages); | 1770 | int security_vm_enough_memory(long pages); |
| 1739 | int security_vm_enough_memory_mm(struct mm_struct *mm, long pages); | 1771 | int security_vm_enough_memory_mm(struct mm_struct *mm, long pages); |
| @@ -1822,7 +1854,7 @@ void security_commit_creds(struct cred *new, const struct cred *old); | |||
| 1822 | void security_transfer_creds(struct cred *new, const struct cred *old); | 1854 | void security_transfer_creds(struct cred *new, const struct cred *old); |
| 1823 | int security_kernel_act_as(struct cred *new, u32 secid); | 1855 | int security_kernel_act_as(struct cred *new, u32 secid); |
| 1824 | int security_kernel_create_files_as(struct cred *new, struct inode *inode); | 1856 | int security_kernel_create_files_as(struct cred *new, struct inode *inode); |
| 1825 | int security_kernel_module_request(void); | 1857 | int security_kernel_module_request(char *kmod_name); |
| 1826 | int security_task_setuid(uid_t id0, uid_t id1, uid_t id2, int flags); | 1858 | int security_task_setuid(uid_t id0, uid_t id1, uid_t id2, int flags); |
| 1827 | int security_task_fix_setuid(struct cred *new, const struct cred *old, | 1859 | int security_task_fix_setuid(struct cred *new, const struct cred *old, |
| 1828 | int flags); | 1860 | int flags); |
| @@ -1979,9 +2011,9 @@ static inline int security_quota_on(struct dentry *dentry) | |||
| 1979 | return 0; | 2011 | return 0; |
| 1980 | } | 2012 | } |
| 1981 | 2013 | ||
| 1982 | static inline int security_syslog(int type) | 2014 | static inline int security_syslog(int type, bool from_file) |
| 1983 | { | 2015 | { |
| 1984 | return cap_syslog(type); | 2016 | return cap_syslog(type, from_file); |
| 1985 | } | 2017 | } |
| 1986 | 2018 | ||
| 1987 | static inline int security_settime(struct timespec *ts, struct timezone *tz) | 2019 | static inline int security_settime(struct timespec *ts, struct timezone *tz) |
| @@ -2387,7 +2419,7 @@ static inline int security_kernel_create_files_as(struct cred *cred, | |||
| 2387 | return 0; | 2419 | return 0; |
| 2388 | } | 2420 | } |
| 2389 | 2421 | ||
| 2390 | static inline int security_kernel_module_request(void) | 2422 | static inline int security_kernel_module_request(char *kmod_name) |
| 2391 | { | 2423 | { |
| 2392 | return 0; | 2424 | return 0; |
| 2393 | } | 2425 | } |
| @@ -2952,6 +2984,10 @@ int security_path_link(struct dentry *old_dentry, struct path *new_dir, | |||
| 2952 | struct dentry *new_dentry); | 2984 | struct dentry *new_dentry); |
| 2953 | int security_path_rename(struct path *old_dir, struct dentry *old_dentry, | 2985 | int security_path_rename(struct path *old_dir, struct dentry *old_dentry, |
| 2954 | struct path *new_dir, struct dentry *new_dentry); | 2986 | struct path *new_dir, struct dentry *new_dentry); |
| 2987 | int security_path_chmod(struct dentry *dentry, struct vfsmount *mnt, | ||
| 2988 | mode_t mode); | ||
| 2989 | int security_path_chown(struct path *path, uid_t uid, gid_t gid); | ||
| 2990 | int security_path_chroot(struct path *path); | ||
| 2955 | #else /* CONFIG_SECURITY_PATH */ | 2991 | #else /* CONFIG_SECURITY_PATH */ |
| 2956 | static inline int security_path_unlink(struct path *dir, struct dentry *dentry) | 2992 | static inline int security_path_unlink(struct path *dir, struct dentry *dentry) |
| 2957 | { | 2993 | { |
| @@ -3001,6 +3037,23 @@ static inline int security_path_rename(struct path *old_dir, | |||
| 3001 | { | 3037 | { |
| 3002 | return 0; | 3038 | return 0; |
| 3003 | } | 3039 | } |
| 3040 | |||
| 3041 | static inline int security_path_chmod(struct dentry *dentry, | ||
| 3042 | struct vfsmount *mnt, | ||
| 3043 | mode_t mode) | ||
| 3044 | { | ||
| 3045 | return 0; | ||
| 3046 | } | ||
| 3047 | |||
| 3048 | static inline int security_path_chown(struct path *path, uid_t uid, gid_t gid) | ||
| 3049 | { | ||
| 3050 | return 0; | ||
| 3051 | } | ||
| 3052 | |||
| 3053 | static inline int security_path_chroot(struct path *path) | ||
| 3054 | { | ||
| 3055 | return 0; | ||
| 3056 | } | ||
| 3004 | #endif /* CONFIG_SECURITY_PATH */ | 3057 | #endif /* CONFIG_SECURITY_PATH */ |
| 3005 | 3058 | ||
| 3006 | #ifdef CONFIG_KEYS | 3059 | #ifdef CONFIG_KEYS |
diff --git a/include/linux/sem.h b/include/linux/sem.h index 1b191c176bcd..8a4adbef8a0f 100644 --- a/include/linux/sem.h +++ b/include/linux/sem.h | |||
| @@ -86,6 +86,7 @@ struct task_struct; | |||
| 86 | struct sem { | 86 | struct sem { |
| 87 | int semval; /* current value */ | 87 | int semval; /* current value */ |
| 88 | int sempid; /* pid of last operation */ | 88 | int sempid; /* pid of last operation */ |
| 89 | struct list_head sem_pending; /* pending single-sop operations */ | ||
| 89 | }; | 90 | }; |
| 90 | 91 | ||
| 91 | /* One sem_array data structure for each set of semaphores in the system. */ | 92 | /* One sem_array data structure for each set of semaphores in the system. */ |
| @@ -96,11 +97,13 @@ struct sem_array { | |||
| 96 | struct sem *sem_base; /* ptr to first semaphore in array */ | 97 | struct sem *sem_base; /* ptr to first semaphore in array */ |
| 97 | struct list_head sem_pending; /* pending operations to be processed */ | 98 | struct list_head sem_pending; /* pending operations to be processed */ |
| 98 | struct list_head list_id; /* undo requests on this array */ | 99 | struct list_head list_id; /* undo requests on this array */ |
| 99 | unsigned long sem_nsems; /* no. of semaphores in array */ | 100 | int sem_nsems; /* no. of semaphores in array */ |
| 101 | int complex_count; /* pending complex operations */ | ||
| 100 | }; | 102 | }; |
| 101 | 103 | ||
| 102 | /* One queue for each sleeping process in the system. */ | 104 | /* One queue for each sleeping process in the system. */ |
| 103 | struct sem_queue { | 105 | struct sem_queue { |
| 106 | struct list_head simple_list; /* queue of pending operations */ | ||
| 104 | struct list_head list; /* queue of pending operations */ | 107 | struct list_head list; /* queue of pending operations */ |
| 105 | struct task_struct *sleeper; /* this process */ | 108 | struct task_struct *sleeper; /* this process */ |
| 106 | struct sem_undo *undo; /* undo structure */ | 109 | struct sem_undo *undo; /* undo structure */ |
diff --git a/include/linux/seq_file.h b/include/linux/seq_file.h index 8366d8f12e53..03c0232b4169 100644 --- a/include/linux/seq_file.h +++ b/include/linux/seq_file.h | |||
| @@ -135,4 +135,22 @@ extern struct list_head *seq_list_start_head(struct list_head *head, | |||
| 135 | extern struct list_head *seq_list_next(void *v, struct list_head *head, | 135 | extern struct list_head *seq_list_next(void *v, struct list_head *head, |
| 136 | loff_t *ppos); | 136 | loff_t *ppos); |
| 137 | 137 | ||
| 138 | /* | ||
| 139 | * Helpers for iteration over hlist_head-s in seq_files | ||
| 140 | */ | ||
| 141 | |||
| 142 | extern struct hlist_node *seq_hlist_start(struct hlist_head *head, | ||
| 143 | loff_t pos); | ||
| 144 | extern struct hlist_node *seq_hlist_start_head(struct hlist_head *head, | ||
| 145 | loff_t pos); | ||
| 146 | extern struct hlist_node *seq_hlist_next(void *v, struct hlist_head *head, | ||
| 147 | loff_t *ppos); | ||
| 148 | |||
| 149 | extern struct hlist_node *seq_hlist_start_rcu(struct hlist_head *head, | ||
| 150 | loff_t pos); | ||
| 151 | extern struct hlist_node *seq_hlist_start_head_rcu(struct hlist_head *head, | ||
| 152 | loff_t pos); | ||
| 153 | extern struct hlist_node *seq_hlist_next_rcu(void *v, | ||
| 154 | struct hlist_head *head, | ||
| 155 | loff_t *ppos); | ||
| 138 | #endif | 156 | #endif |
diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h index db532ce288be..78dd1e7120a9 100644 --- a/include/linux/serial_core.h +++ b/include/linux/serial_core.h | |||
| @@ -179,6 +179,9 @@ | |||
| 179 | /* BCM63xx family SoCs */ | 179 | /* BCM63xx family SoCs */ |
| 180 | #define PORT_BCM63XX 89 | 180 | #define PORT_BCM63XX 89 |
| 181 | 181 | ||
| 182 | /* Aeroflex Gaisler GRLIB APBUART */ | ||
| 183 | #define PORT_APBUART 90 | ||
| 184 | |||
| 182 | #ifdef __KERNEL__ | 185 | #ifdef __KERNEL__ |
| 183 | 186 | ||
| 184 | #include <linux/compiler.h> | 187 | #include <linux/compiler.h> |
| @@ -488,9 +491,13 @@ uart_handle_dcd_change(struct uart_port *uport, unsigned int status) | |||
| 488 | { | 491 | { |
| 489 | struct uart_state *state = uport->state; | 492 | struct uart_state *state = uport->state; |
| 490 | struct tty_port *port = &state->port; | 493 | struct tty_port *port = &state->port; |
| 494 | struct tty_ldisc *ld = tty_ldisc_ref(port->tty); | ||
| 495 | struct timespec ts; | ||
| 491 | 496 | ||
| 492 | uport->icount.dcd++; | 497 | if (ld && ld->ops->dcd_change) |
| 498 | getnstimeofday(&ts); | ||
| 493 | 499 | ||
| 500 | uport->icount.dcd++; | ||
| 494 | #ifdef CONFIG_HARD_PPS | 501 | #ifdef CONFIG_HARD_PPS |
| 495 | if ((uport->flags & UPF_HARDPPS_CD) && status) | 502 | if ((uport->flags & UPF_HARDPPS_CD) && status) |
| 496 | hardpps(); | 503 | hardpps(); |
| @@ -502,6 +509,11 @@ uart_handle_dcd_change(struct uart_port *uport, unsigned int status) | |||
| 502 | else if (port->tty) | 509 | else if (port->tty) |
| 503 | tty_hangup(port->tty); | 510 | tty_hangup(port->tty); |
| 504 | } | 511 | } |
| 512 | |||
| 513 | if (ld && ld->ops->dcd_change) | ||
| 514 | ld->ops->dcd_change(port->tty, status, &ts); | ||
| 515 | if (ld) | ||
| 516 | tty_ldisc_deref(ld); | ||
| 505 | } | 517 | } |
| 506 | 518 | ||
| 507 | /** | 519 | /** |
diff --git a/include/linux/serial_reg.h b/include/linux/serial_reg.h index 850db2e80510..cf9327c051ad 100644 --- a/include/linux/serial_reg.h +++ b/include/linux/serial_reg.h | |||
| @@ -216,10 +216,10 @@ | |||
| 216 | 216 | ||
| 217 | #define UART_IIR_TOD 0x08 /* Character Timeout Indication Detected */ | 217 | #define UART_IIR_TOD 0x08 /* Character Timeout Indication Detected */ |
| 218 | 218 | ||
| 219 | #define UART_FCR_PXAR1 0x00 /* receive FIFO treshold = 1 */ | 219 | #define UART_FCR_PXAR1 0x00 /* receive FIFO threshold = 1 */ |
| 220 | #define UART_FCR_PXAR8 0x40 /* receive FIFO treshold = 8 */ | 220 | #define UART_FCR_PXAR8 0x40 /* receive FIFO threshold = 8 */ |
| 221 | #define UART_FCR_PXAR16 0x80 /* receive FIFO treshold = 16 */ | 221 | #define UART_FCR_PXAR16 0x80 /* receive FIFO threshold = 16 */ |
| 222 | #define UART_FCR_PXAR32 0xc0 /* receive FIFO treshold = 32 */ | 222 | #define UART_FCR_PXAR32 0xc0 /* receive FIFO threshold = 32 */ |
| 223 | 223 | ||
| 224 | 224 | ||
| 225 | 225 | ||
diff --git a/include/linux/serial_sci.h b/include/linux/serial_sci.h index 1c297ddc9d5a..193d4bfe42ff 100644 --- a/include/linux/serial_sci.h +++ b/include/linux/serial_sci.h | |||
| @@ -2,6 +2,9 @@ | |||
| 2 | #define __LINUX_SERIAL_SCI_H | 2 | #define __LINUX_SERIAL_SCI_H |
| 3 | 3 | ||
| 4 | #include <linux/serial_core.h> | 4 | #include <linux/serial_core.h> |
| 5 | #ifdef CONFIG_SERIAL_SH_SCI_DMA | ||
| 6 | #include <asm/dmaengine.h> | ||
| 7 | #endif | ||
| 5 | 8 | ||
| 6 | /* | 9 | /* |
| 7 | * Generic header for SuperH SCI(F) (used by sh/sh64/h8300 and related parts) | 10 | * Generic header for SuperH SCI(F) (used by sh/sh64/h8300 and related parts) |
| @@ -16,6 +19,8 @@ enum { | |||
| 16 | SCIx_NR_IRQS, | 19 | SCIx_NR_IRQS, |
| 17 | }; | 20 | }; |
| 18 | 21 | ||
| 22 | struct device; | ||
| 23 | |||
| 19 | /* | 24 | /* |
| 20 | * Platform device specific platform_data struct | 25 | * Platform device specific platform_data struct |
| 21 | */ | 26 | */ |
| @@ -26,6 +31,11 @@ struct plat_sci_port { | |||
| 26 | unsigned int type; /* SCI / SCIF / IRDA */ | 31 | unsigned int type; /* SCI / SCIF / IRDA */ |
| 27 | upf_t flags; /* UPF_* flags */ | 32 | upf_t flags; /* UPF_* flags */ |
| 28 | char *clk; /* clock string */ | 33 | char *clk; /* clock string */ |
| 34 | struct device *dma_dev; | ||
| 35 | #ifdef CONFIG_SERIAL_SH_SCI_DMA | ||
| 36 | enum sh_dmae_slave_chan_id dma_slave_tx; | ||
| 37 | enum sh_dmae_slave_chan_id dma_slave_rx; | ||
| 38 | #endif | ||
| 29 | }; | 39 | }; |
| 30 | 40 | ||
| 31 | #endif /* __LINUX_SERIAL_SCI_H */ | 41 | #endif /* __LINUX_SERIAL_SCI_H */ |
diff --git a/include/linux/serio.h b/include/linux/serio.h index a640bc2afe76..64b473066b9a 100644 --- a/include/linux/serio.h +++ b/include/linux/serio.h | |||
| @@ -30,7 +30,6 @@ struct serio { | |||
| 30 | char phys[32]; | 30 | char phys[32]; |
| 31 | 31 | ||
| 32 | bool manual_bind; | 32 | bool manual_bind; |
| 33 | bool registered; /* port has been fully registered with driver core */ | ||
| 34 | 33 | ||
| 35 | struct serio_device_id id; | 34 | struct serio_device_id id; |
| 36 | 35 | ||
| @@ -136,25 +135,6 @@ static inline void serio_continue_rx(struct serio *serio) | |||
| 136 | spin_unlock_irq(&serio->lock); | 135 | spin_unlock_irq(&serio->lock); |
| 137 | } | 136 | } |
| 138 | 137 | ||
| 139 | /* | ||
| 140 | * Use the following functions to pin serio's driver in process context | ||
| 141 | */ | ||
| 142 | static inline int serio_pin_driver(struct serio *serio) | ||
| 143 | { | ||
| 144 | return mutex_lock_interruptible(&serio->drv_mutex); | ||
| 145 | } | ||
| 146 | |||
| 147 | static inline void serio_pin_driver_uninterruptible(struct serio *serio) | ||
| 148 | { | ||
| 149 | mutex_lock(&serio->drv_mutex); | ||
| 150 | } | ||
| 151 | |||
| 152 | static inline void serio_unpin_driver(struct serio *serio) | ||
| 153 | { | ||
| 154 | mutex_unlock(&serio->drv_mutex); | ||
| 155 | } | ||
| 156 | |||
| 157 | |||
| 158 | #endif | 138 | #endif |
| 159 | 139 | ||
| 160 | /* | 140 | /* |
| @@ -215,5 +195,6 @@ static inline void serio_unpin_driver(struct serio *serio) | |||
| 215 | #define SERIO_INEXIO 0x37 | 195 | #define SERIO_INEXIO 0x37 |
| 216 | #define SERIO_TOUCHIT213 0x38 | 196 | #define SERIO_TOUCHIT213 0x38 |
| 217 | #define SERIO_W8001 0x39 | 197 | #define SERIO_W8001 0x39 |
| 198 | #define SERIO_DYNAPRO 0x3a | ||
| 218 | 199 | ||
| 219 | #endif | 200 | #endif |
diff --git a/include/linux/sh_intc.h b/include/linux/sh_intc.h index 68e212ff9dde..51d288d8ac88 100644 --- a/include/linux/sh_intc.h +++ b/include/linux/sh_intc.h | |||
| @@ -45,7 +45,7 @@ struct intc_sense_reg { | |||
| 45 | #define INTC_SMP(stride, nr) | 45 | #define INTC_SMP(stride, nr) |
| 46 | #endif | 46 | #endif |
| 47 | 47 | ||
| 48 | struct intc_desc { | 48 | struct intc_hw_desc { |
| 49 | struct intc_vect *vectors; | 49 | struct intc_vect *vectors; |
| 50 | unsigned int nr_vectors; | 50 | unsigned int nr_vectors; |
| 51 | struct intc_group *groups; | 51 | struct intc_group *groups; |
| @@ -56,36 +56,46 @@ struct intc_desc { | |||
| 56 | unsigned int nr_prio_regs; | 56 | unsigned int nr_prio_regs; |
| 57 | struct intc_sense_reg *sense_regs; | 57 | struct intc_sense_reg *sense_regs; |
| 58 | unsigned int nr_sense_regs; | 58 | unsigned int nr_sense_regs; |
| 59 | char *name; | ||
| 60 | #if defined(CONFIG_CPU_SH3) || defined(CONFIG_CPU_SH4A) | ||
| 61 | struct intc_mask_reg *ack_regs; | 59 | struct intc_mask_reg *ack_regs; |
| 62 | unsigned int nr_ack_regs; | 60 | unsigned int nr_ack_regs; |
| 63 | #endif | ||
| 64 | }; | 61 | }; |
| 65 | 62 | ||
| 66 | #define _INTC_ARRAY(a) a, sizeof(a)/sizeof(*a) | 63 | #define _INTC_ARRAY(a) a, sizeof(a)/sizeof(*a) |
| 64 | #define INTC_HW_DESC(vectors, groups, mask_regs, \ | ||
| 65 | prio_regs, sense_regs, ack_regs) \ | ||
| 66 | { \ | ||
| 67 | _INTC_ARRAY(vectors), _INTC_ARRAY(groups), \ | ||
| 68 | _INTC_ARRAY(mask_regs), _INTC_ARRAY(prio_regs), \ | ||
| 69 | _INTC_ARRAY(sense_regs), _INTC_ARRAY(ack_regs), \ | ||
| 70 | } | ||
| 71 | |||
| 72 | struct intc_desc { | ||
| 73 | char *name; | ||
| 74 | intc_enum force_enable; | ||
| 75 | intc_enum force_disable; | ||
| 76 | struct intc_hw_desc hw; | ||
| 77 | }; | ||
| 78 | |||
| 67 | #define DECLARE_INTC_DESC(symbol, chipname, vectors, groups, \ | 79 | #define DECLARE_INTC_DESC(symbol, chipname, vectors, groups, \ |
| 68 | mask_regs, prio_regs, sense_regs) \ | 80 | mask_regs, prio_regs, sense_regs) \ |
| 69 | struct intc_desc symbol __initdata = { \ | 81 | struct intc_desc symbol __initdata = { \ |
| 70 | _INTC_ARRAY(vectors), _INTC_ARRAY(groups), \ | 82 | .name = chipname, \ |
| 71 | _INTC_ARRAY(mask_regs), _INTC_ARRAY(prio_regs), \ | 83 | .hw = INTC_HW_DESC(vectors, groups, mask_regs, \ |
| 72 | _INTC_ARRAY(sense_regs), \ | 84 | prio_regs, sense_regs, NULL), \ |
| 73 | chipname, \ | ||
| 74 | } | 85 | } |
| 75 | 86 | ||
| 76 | #if defined(CONFIG_CPU_SH3) || defined(CONFIG_CPU_SH4A) | ||
| 77 | #define DECLARE_INTC_DESC_ACK(symbol, chipname, vectors, groups, \ | 87 | #define DECLARE_INTC_DESC_ACK(symbol, chipname, vectors, groups, \ |
| 78 | mask_regs, prio_regs, sense_regs, ack_regs) \ | 88 | mask_regs, prio_regs, sense_regs, ack_regs) \ |
| 79 | struct intc_desc symbol __initdata = { \ | 89 | struct intc_desc symbol __initdata = { \ |
| 80 | _INTC_ARRAY(vectors), _INTC_ARRAY(groups), \ | 90 | .name = chipname, \ |
| 81 | _INTC_ARRAY(mask_regs), _INTC_ARRAY(prio_regs), \ | 91 | .hw = INTC_HW_DESC(vectors, groups, mask_regs, \ |
| 82 | _INTC_ARRAY(sense_regs), \ | 92 | prio_regs, sense_regs, ack_regs), \ |
| 83 | chipname, \ | ||
| 84 | _INTC_ARRAY(ack_regs), \ | ||
| 85 | } | 93 | } |
| 86 | #endif | ||
| 87 | 94 | ||
| 88 | void __init register_intc_controller(struct intc_desc *desc); | 95 | void __init register_intc_controller(struct intc_desc *desc); |
| 89 | int intc_set_priority(unsigned int irq, unsigned int prio); | 96 | int intc_set_priority(unsigned int irq, unsigned int prio); |
| 90 | 97 | ||
| 98 | int reserve_irq_vector(unsigned int irq); | ||
| 99 | void reserve_irq_legacy(void); | ||
| 100 | |||
| 91 | #endif /* __SH_INTC_H */ | 101 | #endif /* __SH_INTC_H */ |
diff --git a/include/linux/sh_pfc.h b/include/linux/sh_pfc.h new file mode 100644 index 000000000000..07c08af9f8f6 --- /dev/null +++ b/include/linux/sh_pfc.h | |||
| @@ -0,0 +1,96 @@ | |||
| 1 | /* | ||
| 2 | * SuperH Pin Function Controller Support | ||
| 3 | * | ||
| 4 | * Copyright (c) 2008 Magnus Damm | ||
| 5 | * | ||
| 6 | * This file is subject to the terms and conditions of the GNU General Public | ||
| 7 | * License. See the file "COPYING" in the main directory of this archive | ||
| 8 | * for more details. | ||
| 9 | */ | ||
| 10 | |||
| 11 | #ifndef __SH_PFC_H | ||
| 12 | #define __SH_PFC_H | ||
| 13 | |||
| 14 | #include <asm-generic/gpio.h> | ||
| 15 | |||
| 16 | typedef unsigned short pinmux_enum_t; | ||
| 17 | typedef unsigned short pinmux_flag_t; | ||
| 18 | |||
| 19 | #define PINMUX_TYPE_NONE 0 | ||
| 20 | #define PINMUX_TYPE_FUNCTION 1 | ||
| 21 | #define PINMUX_TYPE_GPIO 2 | ||
| 22 | #define PINMUX_TYPE_OUTPUT 3 | ||
| 23 | #define PINMUX_TYPE_INPUT 4 | ||
| 24 | #define PINMUX_TYPE_INPUT_PULLUP 5 | ||
| 25 | #define PINMUX_TYPE_INPUT_PULLDOWN 6 | ||
| 26 | |||
| 27 | #define PINMUX_FLAG_TYPE (0x7) | ||
| 28 | #define PINMUX_FLAG_WANT_PULLUP (1 << 3) | ||
| 29 | #define PINMUX_FLAG_WANT_PULLDOWN (1 << 4) | ||
| 30 | |||
| 31 | #define PINMUX_FLAG_DBIT_SHIFT 5 | ||
| 32 | #define PINMUX_FLAG_DBIT (0x1f << PINMUX_FLAG_DBIT_SHIFT) | ||
| 33 | #define PINMUX_FLAG_DREG_SHIFT 10 | ||
| 34 | #define PINMUX_FLAG_DREG (0x3f << PINMUX_FLAG_DREG_SHIFT) | ||
| 35 | |||
| 36 | struct pinmux_gpio { | ||
| 37 | pinmux_enum_t enum_id; | ||
| 38 | pinmux_flag_t flags; | ||
| 39 | }; | ||
| 40 | |||
| 41 | #define PINMUX_GPIO(gpio, data_or_mark) [gpio] = { data_or_mark } | ||
| 42 | #define PINMUX_DATA(data_or_mark, ids...) data_or_mark, ids, 0 | ||
| 43 | |||
| 44 | struct pinmux_cfg_reg { | ||
| 45 | unsigned long reg, reg_width, field_width; | ||
| 46 | unsigned long *cnt; | ||
| 47 | pinmux_enum_t *enum_ids; | ||
| 48 | }; | ||
| 49 | |||
| 50 | #define PINMUX_CFG_REG(name, r, r_width, f_width) \ | ||
| 51 | .reg = r, .reg_width = r_width, .field_width = f_width, \ | ||
| 52 | .cnt = (unsigned long [r_width / f_width]) {}, \ | ||
| 53 | .enum_ids = (pinmux_enum_t [(r_width / f_width) * (1 << f_width)]) \ | ||
| 54 | |||
| 55 | struct pinmux_data_reg { | ||
| 56 | unsigned long reg, reg_width, reg_shadow; | ||
| 57 | pinmux_enum_t *enum_ids; | ||
| 58 | }; | ||
| 59 | |||
| 60 | #define PINMUX_DATA_REG(name, r, r_width) \ | ||
| 61 | .reg = r, .reg_width = r_width, \ | ||
| 62 | .enum_ids = (pinmux_enum_t [r_width]) \ | ||
| 63 | |||
| 64 | struct pinmux_range { | ||
| 65 | pinmux_enum_t begin; | ||
| 66 | pinmux_enum_t end; | ||
| 67 | pinmux_enum_t force; | ||
| 68 | }; | ||
| 69 | |||
| 70 | struct pinmux_info { | ||
| 71 | char *name; | ||
| 72 | pinmux_enum_t reserved_id; | ||
| 73 | struct pinmux_range data; | ||
| 74 | struct pinmux_range input; | ||
| 75 | struct pinmux_range input_pd; | ||
| 76 | struct pinmux_range input_pu; | ||
| 77 | struct pinmux_range output; | ||
| 78 | struct pinmux_range mark; | ||
| 79 | struct pinmux_range function; | ||
| 80 | |||
| 81 | unsigned first_gpio, last_gpio; | ||
| 82 | |||
| 83 | struct pinmux_gpio *gpios; | ||
| 84 | struct pinmux_cfg_reg *cfg_regs; | ||
| 85 | struct pinmux_data_reg *data_regs; | ||
| 86 | |||
| 87 | pinmux_enum_t *gpio_data; | ||
| 88 | unsigned int gpio_data_size; | ||
| 89 | |||
| 90 | unsigned long *gpio_in_use; | ||
| 91 | struct gpio_chip chip; | ||
| 92 | }; | ||
| 93 | |||
| 94 | int register_pinmux(struct pinmux_info *pip); | ||
| 95 | |||
| 96 | #endif /* __SH_PFC_H */ | ||
diff --git a/include/linux/shmem_fs.h b/include/linux/shmem_fs.h index deee7afd8d66..e164291fb3e7 100644 --- a/include/linux/shmem_fs.h +++ b/include/linux/shmem_fs.h | |||
| @@ -41,20 +41,4 @@ static inline struct shmem_inode_info *SHMEM_I(struct inode *inode) | |||
| 41 | extern int init_tmpfs(void); | 41 | extern int init_tmpfs(void); |
| 42 | extern int shmem_fill_super(struct super_block *sb, void *data, int silent); | 42 | extern int shmem_fill_super(struct super_block *sb, void *data, int silent); |
| 43 | 43 | ||
| 44 | #ifdef CONFIG_TMPFS_POSIX_ACL | ||
| 45 | int shmem_check_acl(struct inode *, int); | ||
| 46 | int shmem_acl_init(struct inode *, struct inode *); | ||
| 47 | |||
| 48 | extern struct xattr_handler shmem_xattr_acl_access_handler; | ||
| 49 | extern struct xattr_handler shmem_xattr_acl_default_handler; | ||
| 50 | |||
| 51 | extern struct generic_acl_operations shmem_acl_ops; | ||
| 52 | |||
| 53 | #else | ||
| 54 | static inline int shmem_acl_init(struct inode *inode, struct inode *dir) | ||
| 55 | { | ||
| 56 | return 0; | ||
| 57 | } | ||
| 58 | #endif /* CONFIG_TMPFS_POSIX_ACL */ | ||
| 59 | |||
| 60 | #endif | 44 | #endif |
diff --git a/include/linux/signal.h b/include/linux/signal.h index ab9272cc270c..fcd2b14b1932 100644 --- a/include/linux/signal.h +++ b/include/linux/signal.h | |||
| @@ -7,6 +7,8 @@ | |||
| 7 | #ifdef __KERNEL__ | 7 | #ifdef __KERNEL__ |
| 8 | #include <linux/list.h> | 8 | #include <linux/list.h> |
| 9 | 9 | ||
| 10 | /* for sysctl */ | ||
| 11 | extern int print_fatal_signals; | ||
| 10 | /* | 12 | /* |
| 11 | * Real Time signals may be queued. | 13 | * Real Time signals may be queued. |
| 12 | */ | 14 | */ |
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index bcdd6606f468..124f90cd5a38 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h | |||
| @@ -190,9 +190,6 @@ struct skb_shared_info { | |||
| 190 | atomic_t dataref; | 190 | atomic_t dataref; |
| 191 | unsigned short nr_frags; | 191 | unsigned short nr_frags; |
| 192 | unsigned short gso_size; | 192 | unsigned short gso_size; |
| 193 | #ifdef CONFIG_HAS_DMA | ||
| 194 | dma_addr_t dma_head; | ||
| 195 | #endif | ||
| 196 | /* Warning: this field is not always filled in (UFO)! */ | 193 | /* Warning: this field is not always filled in (UFO)! */ |
| 197 | unsigned short gso_segs; | 194 | unsigned short gso_segs; |
| 198 | unsigned short gso_type; | 195 | unsigned short gso_type; |
| @@ -201,9 +198,6 @@ struct skb_shared_info { | |||
| 201 | struct sk_buff *frag_list; | 198 | struct sk_buff *frag_list; |
| 202 | struct skb_shared_hwtstamps hwtstamps; | 199 | struct skb_shared_hwtstamps hwtstamps; |
| 203 | skb_frag_t frags[MAX_SKB_FRAGS]; | 200 | skb_frag_t frags[MAX_SKB_FRAGS]; |
| 204 | #ifdef CONFIG_HAS_DMA | ||
| 205 | dma_addr_t dma_maps[MAX_SKB_FRAGS]; | ||
| 206 | #endif | ||
| 207 | /* Intermediate layers must ensure that destructor_arg | 201 | /* Intermediate layers must ensure that destructor_arg |
| 208 | * remains valid until skb destructor */ | 202 | * remains valid until skb destructor */ |
| 209 | void * destructor_arg; | 203 | void * destructor_arg; |
| @@ -299,7 +293,7 @@ typedef unsigned char *sk_buff_data_t; | |||
| 299 | * @nfctinfo: Relationship of this skb to the connection | 293 | * @nfctinfo: Relationship of this skb to the connection |
| 300 | * @nfct_reasm: netfilter conntrack re-assembly pointer | 294 | * @nfct_reasm: netfilter conntrack re-assembly pointer |
| 301 | * @nf_bridge: Saved data about a bridged frame - see br_netfilter.c | 295 | * @nf_bridge: Saved data about a bridged frame - see br_netfilter.c |
| 302 | * @iif: ifindex of device we arrived on | 296 | * @skb_iif: ifindex of device we arrived on |
| 303 | * @queue_mapping: Queue mapping for multiqueue devices | 297 | * @queue_mapping: Queue mapping for multiqueue devices |
| 304 | * @tc_index: Traffic control index | 298 | * @tc_index: Traffic control index |
| 305 | * @tc_verd: traffic control verdict | 299 | * @tc_verd: traffic control verdict |
| @@ -315,22 +309,23 @@ struct sk_buff { | |||
| 315 | struct sk_buff *next; | 309 | struct sk_buff *next; |
| 316 | struct sk_buff *prev; | 310 | struct sk_buff *prev; |
| 317 | 311 | ||
| 318 | struct sock *sk; | ||
| 319 | ktime_t tstamp; | 312 | ktime_t tstamp; |
| 313 | |||
| 314 | struct sock *sk; | ||
| 320 | struct net_device *dev; | 315 | struct net_device *dev; |
| 321 | 316 | ||
| 322 | unsigned long _skb_dst; | ||
| 323 | #ifdef CONFIG_XFRM | ||
| 324 | struct sec_path *sp; | ||
| 325 | #endif | ||
| 326 | /* | 317 | /* |
| 327 | * This is the control buffer. It is free to use for every | 318 | * This is the control buffer. It is free to use for every |
| 328 | * layer. Please put your private variables there. If you | 319 | * layer. Please put your private variables there. If you |
| 329 | * want to keep them across layers you have to do a skb_clone() | 320 | * want to keep them across layers you have to do a skb_clone() |
| 330 | * first. This is owned by whoever has the skb queued ATM. | 321 | * first. This is owned by whoever has the skb queued ATM. |
| 331 | */ | 322 | */ |
| 332 | char cb[48]; | 323 | char cb[48] __aligned(8); |
| 333 | 324 | ||
| 325 | unsigned long _skb_dst; | ||
| 326 | #ifdef CONFIG_XFRM | ||
| 327 | struct sec_path *sp; | ||
| 328 | #endif | ||
| 334 | unsigned int len, | 329 | unsigned int len, |
| 335 | data_len; | 330 | data_len; |
| 336 | __u16 mac_len, | 331 | __u16 mac_len, |
| @@ -354,8 +349,8 @@ struct sk_buff { | |||
| 354 | ipvs_property:1, | 349 | ipvs_property:1, |
| 355 | peeked:1, | 350 | peeked:1, |
| 356 | nf_trace:1; | 351 | nf_trace:1; |
| 357 | __be16 protocol:16; | ||
| 358 | kmemcheck_bitfield_end(flags1); | 352 | kmemcheck_bitfield_end(flags1); |
| 353 | __be16 protocol; | ||
| 359 | 354 | ||
| 360 | void (*destructor)(struct sk_buff *skb); | 355 | void (*destructor)(struct sk_buff *skb); |
| 361 | #if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE) | 356 | #if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE) |
| @@ -366,7 +361,7 @@ struct sk_buff { | |||
| 366 | struct nf_bridge_info *nf_bridge; | 361 | struct nf_bridge_info *nf_bridge; |
| 367 | #endif | 362 | #endif |
| 368 | 363 | ||
| 369 | int iif; | 364 | int skb_iif; |
| 370 | #ifdef CONFIG_NET_SCHED | 365 | #ifdef CONFIG_NET_SCHED |
| 371 | __u16 tc_index; /* traffic control index */ | 366 | __u16 tc_index; /* traffic control index */ |
| 372 | #ifdef CONFIG_NET_CLS_ACT | 367 | #ifdef CONFIG_NET_CLS_ACT |
| @@ -389,8 +384,10 @@ struct sk_buff { | |||
| 389 | #ifdef CONFIG_NETWORK_SECMARK | 384 | #ifdef CONFIG_NETWORK_SECMARK |
| 390 | __u32 secmark; | 385 | __u32 secmark; |
| 391 | #endif | 386 | #endif |
| 392 | 387 | union { | |
| 393 | __u32 mark; | 388 | __u32 mark; |
| 389 | __u32 dropcount; | ||
| 390 | }; | ||
| 394 | 391 | ||
| 395 | __u16 vlan_tci; | 392 | __u16 vlan_tci; |
| 396 | 393 | ||
| @@ -414,14 +411,6 @@ struct sk_buff { | |||
| 414 | 411 | ||
| 415 | #include <asm/system.h> | 412 | #include <asm/system.h> |
| 416 | 413 | ||
| 417 | #ifdef CONFIG_HAS_DMA | ||
| 418 | #include <linux/dma-mapping.h> | ||
| 419 | extern int skb_dma_map(struct device *dev, struct sk_buff *skb, | ||
| 420 | enum dma_data_direction dir); | ||
| 421 | extern void skb_dma_unmap(struct device *dev, struct sk_buff *skb, | ||
| 422 | enum dma_data_direction dir); | ||
| 423 | #endif | ||
| 424 | |||
| 425 | static inline struct dst_entry *skb_dst(const struct sk_buff *skb) | 414 | static inline struct dst_entry *skb_dst(const struct sk_buff *skb) |
| 426 | { | 415 | { |
| 427 | return (struct dst_entry *)skb->_skb_dst; | 416 | return (struct dst_entry *)skb->_skb_dst; |
| @@ -489,8 +478,7 @@ extern int skb_append_datato_frags(struct sock *sk, struct sk_buff *skb, | |||
| 489 | int len,int odd, struct sk_buff *skb), | 478 | int len,int odd, struct sk_buff *skb), |
| 490 | void *from, int length); | 479 | void *from, int length); |
| 491 | 480 | ||
| 492 | struct skb_seq_state | 481 | struct skb_seq_state { |
| 493 | { | ||
| 494 | __u32 lower_offset; | 482 | __u32 lower_offset; |
| 495 | __u32 upper_offset; | 483 | __u32 upper_offset; |
| 496 | __u32 frag_idx; | 484 | __u32 frag_idx; |
| @@ -745,7 +733,7 @@ static inline struct sk_buff *skb_unshare(struct sk_buff *skb, | |||
| 745 | } | 733 | } |
| 746 | 734 | ||
| 747 | /** | 735 | /** |
| 748 | * skb_peek | 736 | * skb_peek - peek at the head of an &sk_buff_head |
| 749 | * @list_: list to peek at | 737 | * @list_: list to peek at |
| 750 | * | 738 | * |
| 751 | * Peek an &sk_buff. Unlike most other operations you _MUST_ | 739 | * Peek an &sk_buff. Unlike most other operations you _MUST_ |
| @@ -766,7 +754,7 @@ static inline struct sk_buff *skb_peek(struct sk_buff_head *list_) | |||
| 766 | } | 754 | } |
| 767 | 755 | ||
| 768 | /** | 756 | /** |
| 769 | * skb_peek_tail | 757 | * skb_peek_tail - peek at the tail of an &sk_buff_head |
| 770 | * @list_: list to peek at | 758 | * @list_: list to peek at |
| 771 | * | 759 | * |
| 772 | * Peek an &sk_buff. Unlike most other operations you _MUST_ | 760 | * Peek an &sk_buff. Unlike most other operations you _MUST_ |
| @@ -1489,6 +1477,16 @@ static inline struct sk_buff *netdev_alloc_skb(struct net_device *dev, | |||
| 1489 | return __netdev_alloc_skb(dev, length, GFP_ATOMIC); | 1477 | return __netdev_alloc_skb(dev, length, GFP_ATOMIC); |
| 1490 | } | 1478 | } |
| 1491 | 1479 | ||
| 1480 | static inline struct sk_buff *netdev_alloc_skb_ip_align(struct net_device *dev, | ||
| 1481 | unsigned int length) | ||
| 1482 | { | ||
| 1483 | struct sk_buff *skb = netdev_alloc_skb(dev, length + NET_IP_ALIGN); | ||
| 1484 | |||
| 1485 | if (NET_IP_ALIGN && skb) | ||
| 1486 | skb_reserve(skb, NET_IP_ALIGN); | ||
| 1487 | return skb; | ||
| 1488 | } | ||
| 1489 | |||
| 1492 | extern struct page *__netdev_alloc_page(struct net_device *dev, gfp_t gfp_mask); | 1490 | extern struct page *__netdev_alloc_page(struct net_device *dev, gfp_t gfp_mask); |
| 1493 | 1491 | ||
| 1494 | /** | 1492 | /** |
diff --git a/include/linux/slab.h b/include/linux/slab.h index 2da8372519f5..49d1247cd6d9 100644 --- a/include/linux/slab.h +++ b/include/linux/slab.h | |||
| @@ -70,6 +70,11 @@ | |||
| 70 | #else | 70 | #else |
| 71 | # define SLAB_NOTRACK 0x00000000UL | 71 | # define SLAB_NOTRACK 0x00000000UL |
| 72 | #endif | 72 | #endif |
| 73 | #ifdef CONFIG_FAILSLAB | ||
| 74 | # define SLAB_FAILSLAB 0x02000000UL /* Fault injection mark */ | ||
| 75 | #else | ||
| 76 | # define SLAB_FAILSLAB 0x00000000UL | ||
| 77 | #endif | ||
| 73 | 78 | ||
| 74 | /* The following flags affect the page allocator grouping pages by mobility */ | 79 | /* The following flags affect the page allocator grouping pages by mobility */ |
| 75 | #define SLAB_RECLAIM_ACCOUNT 0x00020000UL /* Objects are reclaimable */ | 80 | #define SLAB_RECLAIM_ACCOUNT 0x00020000UL /* Objects are reclaimable */ |
| @@ -101,6 +106,7 @@ int kmem_cache_shrink(struct kmem_cache *); | |||
| 101 | void kmem_cache_free(struct kmem_cache *, void *); | 106 | void kmem_cache_free(struct kmem_cache *, void *); |
| 102 | unsigned int kmem_cache_size(struct kmem_cache *); | 107 | unsigned int kmem_cache_size(struct kmem_cache *); |
| 103 | const char *kmem_cache_name(struct kmem_cache *); | 108 | const char *kmem_cache_name(struct kmem_cache *); |
| 109 | int kern_ptr_validate(const void *ptr, unsigned long size); | ||
| 104 | int kmem_ptr_validate(struct kmem_cache *cachep, const void *ptr); | 110 | int kmem_ptr_validate(struct kmem_cache *cachep, const void *ptr); |
| 105 | 111 | ||
| 106 | /* | 112 | /* |
diff --git a/include/linux/slab_def.h b/include/linux/slab_def.h index 850d057500de..ca6b2b317991 100644 --- a/include/linux/slab_def.h +++ b/include/linux/slab_def.h | |||
| @@ -110,7 +110,7 @@ extern struct cache_sizes malloc_sizes[]; | |||
| 110 | void *kmem_cache_alloc(struct kmem_cache *, gfp_t); | 110 | void *kmem_cache_alloc(struct kmem_cache *, gfp_t); |
| 111 | void *__kmalloc(size_t size, gfp_t flags); | 111 | void *__kmalloc(size_t size, gfp_t flags); |
| 112 | 112 | ||
| 113 | #ifdef CONFIG_KMEMTRACE | 113 | #ifdef CONFIG_TRACING |
| 114 | extern void *kmem_cache_alloc_notrace(struct kmem_cache *cachep, gfp_t flags); | 114 | extern void *kmem_cache_alloc_notrace(struct kmem_cache *cachep, gfp_t flags); |
| 115 | extern size_t slab_buffer_size(struct kmem_cache *cachep); | 115 | extern size_t slab_buffer_size(struct kmem_cache *cachep); |
| 116 | #else | 116 | #else |
| @@ -166,7 +166,7 @@ found: | |||
| 166 | extern void *__kmalloc_node(size_t size, gfp_t flags, int node); | 166 | extern void *__kmalloc_node(size_t size, gfp_t flags, int node); |
| 167 | extern void *kmem_cache_alloc_node(struct kmem_cache *, gfp_t flags, int node); | 167 | extern void *kmem_cache_alloc_node(struct kmem_cache *, gfp_t flags, int node); |
| 168 | 168 | ||
| 169 | #ifdef CONFIG_KMEMTRACE | 169 | #ifdef CONFIG_TRACING |
| 170 | extern void *kmem_cache_alloc_node_notrace(struct kmem_cache *cachep, | 170 | extern void *kmem_cache_alloc_node_notrace(struct kmem_cache *cachep, |
| 171 | gfp_t flags, | 171 | gfp_t flags, |
| 172 | int nodeid); | 172 | int nodeid); |
diff --git a/include/linux/slub_def.h b/include/linux/slub_def.h index 5ad70a60fd74..0249d4175bac 100644 --- a/include/linux/slub_def.h +++ b/include/linux/slub_def.h | |||
| @@ -38,8 +38,6 @@ struct kmem_cache_cpu { | |||
| 38 | void **freelist; /* Pointer to first free per cpu object */ | 38 | void **freelist; /* Pointer to first free per cpu object */ |
| 39 | struct page *page; /* The slab from which we are allocating */ | 39 | struct page *page; /* The slab from which we are allocating */ |
| 40 | int node; /* The node of the page (or -1 for debug) */ | 40 | int node; /* The node of the page (or -1 for debug) */ |
| 41 | unsigned int offset; /* Freepointer offset (in word units) */ | ||
| 42 | unsigned int objsize; /* Size of an object (from kmem_cache) */ | ||
| 43 | #ifdef CONFIG_SLUB_STATS | 41 | #ifdef CONFIG_SLUB_STATS |
| 44 | unsigned stat[NR_SLUB_STAT_ITEMS]; | 42 | unsigned stat[NR_SLUB_STAT_ITEMS]; |
| 45 | #endif | 43 | #endif |
| @@ -69,6 +67,7 @@ struct kmem_cache_order_objects { | |||
| 69 | * Slab cache management. | 67 | * Slab cache management. |
| 70 | */ | 68 | */ |
| 71 | struct kmem_cache { | 69 | struct kmem_cache { |
| 70 | struct kmem_cache_cpu *cpu_slab; | ||
| 72 | /* Used for retriving partial slabs etc */ | 71 | /* Used for retriving partial slabs etc */ |
| 73 | unsigned long flags; | 72 | unsigned long flags; |
| 74 | int size; /* The size of an object including meta data */ | 73 | int size; /* The size of an object including meta data */ |
| @@ -104,11 +103,6 @@ struct kmem_cache { | |||
| 104 | int remote_node_defrag_ratio; | 103 | int remote_node_defrag_ratio; |
| 105 | struct kmem_cache_node *node[MAX_NUMNODES]; | 104 | struct kmem_cache_node *node[MAX_NUMNODES]; |
| 106 | #endif | 105 | #endif |
| 107 | #ifdef CONFIG_SMP | ||
| 108 | struct kmem_cache_cpu *cpu_slab[NR_CPUS]; | ||
| 109 | #else | ||
| 110 | struct kmem_cache_cpu cpu_slab; | ||
| 111 | #endif | ||
| 112 | }; | 106 | }; |
| 113 | 107 | ||
| 114 | /* | 108 | /* |
| @@ -135,11 +129,21 @@ struct kmem_cache { | |||
| 135 | 129 | ||
| 136 | #define SLUB_PAGE_SHIFT (PAGE_SHIFT + 2) | 130 | #define SLUB_PAGE_SHIFT (PAGE_SHIFT + 2) |
| 137 | 131 | ||
| 132 | #ifdef CONFIG_ZONE_DMA | ||
| 133 | #define SLUB_DMA __GFP_DMA | ||
| 134 | /* Reserve extra caches for potential DMA use */ | ||
| 135 | #define KMALLOC_CACHES (2 * SLUB_PAGE_SHIFT - 6) | ||
| 136 | #else | ||
| 137 | /* Disable DMA functionality */ | ||
| 138 | #define SLUB_DMA (__force gfp_t)0 | ||
| 139 | #define KMALLOC_CACHES SLUB_PAGE_SHIFT | ||
| 140 | #endif | ||
| 141 | |||
| 138 | /* | 142 | /* |
| 139 | * We keep the general caches in an array of slab caches that are used for | 143 | * We keep the general caches in an array of slab caches that are used for |
| 140 | * 2^x bytes of allocations. | 144 | * 2^x bytes of allocations. |
| 141 | */ | 145 | */ |
| 142 | extern struct kmem_cache kmalloc_caches[SLUB_PAGE_SHIFT]; | 146 | extern struct kmem_cache kmalloc_caches[KMALLOC_CACHES]; |
| 143 | 147 | ||
| 144 | /* | 148 | /* |
| 145 | * Sorry that the following has to be that ugly but some versions of GCC | 149 | * Sorry that the following has to be that ugly but some versions of GCC |
| @@ -207,17 +211,10 @@ static __always_inline struct kmem_cache *kmalloc_slab(size_t size) | |||
| 207 | return &kmalloc_caches[index]; | 211 | return &kmalloc_caches[index]; |
| 208 | } | 212 | } |
| 209 | 213 | ||
| 210 | #ifdef CONFIG_ZONE_DMA | ||
| 211 | #define SLUB_DMA __GFP_DMA | ||
| 212 | #else | ||
| 213 | /* Disable DMA functionality */ | ||
| 214 | #define SLUB_DMA (__force gfp_t)0 | ||
| 215 | #endif | ||
| 216 | |||
| 217 | void *kmem_cache_alloc(struct kmem_cache *, gfp_t); | 214 | void *kmem_cache_alloc(struct kmem_cache *, gfp_t); |
| 218 | void *__kmalloc(size_t size, gfp_t flags); | 215 | void *__kmalloc(size_t size, gfp_t flags); |
| 219 | 216 | ||
| 220 | #ifdef CONFIG_KMEMTRACE | 217 | #ifdef CONFIG_TRACING |
| 221 | extern void *kmem_cache_alloc_notrace(struct kmem_cache *s, gfp_t gfpflags); | 218 | extern void *kmem_cache_alloc_notrace(struct kmem_cache *s, gfp_t gfpflags); |
| 222 | #else | 219 | #else |
| 223 | static __always_inline void * | 220 | static __always_inline void * |
| @@ -266,7 +263,7 @@ static __always_inline void *kmalloc(size_t size, gfp_t flags) | |||
| 266 | void *__kmalloc_node(size_t size, gfp_t flags, int node); | 263 | void *__kmalloc_node(size_t size, gfp_t flags, int node); |
| 267 | void *kmem_cache_alloc_node(struct kmem_cache *, gfp_t flags, int node); | 264 | void *kmem_cache_alloc_node(struct kmem_cache *, gfp_t flags, int node); |
| 268 | 265 | ||
| 269 | #ifdef CONFIG_KMEMTRACE | 266 | #ifdef CONFIG_TRACING |
| 270 | extern void *kmem_cache_alloc_node_notrace(struct kmem_cache *s, | 267 | extern void *kmem_cache_alloc_node_notrace(struct kmem_cache *s, |
| 271 | gfp_t gfpflags, | 268 | gfp_t gfpflags, |
| 272 | int node); | 269 | int node); |
diff --git a/include/linux/sm501-regs.h b/include/linux/sm501-regs.h index d53642d2d899..67ed2c542831 100644 --- a/include/linux/sm501-regs.h +++ b/include/linux/sm501-regs.h | |||
| @@ -31,6 +31,8 @@ | |||
| 31 | #define SM501_SYSCTRL_PCI_SUBSYS_LOCK (1<<11) | 31 | #define SM501_SYSCTRL_PCI_SUBSYS_LOCK (1<<11) |
| 32 | #define SM501_SYSCTRL_PCI_BURST_READ_EN (1<<15) | 32 | #define SM501_SYSCTRL_PCI_BURST_READ_EN (1<<15) |
| 33 | 33 | ||
| 34 | #define SM501_SYSCTRL_2D_ENGINE_STATUS (1<<19) | ||
| 35 | |||
| 34 | /* miscellaneous control */ | 36 | /* miscellaneous control */ |
| 35 | 37 | ||
| 36 | #define SM501_MISC_CONTROL (0x000004) | 38 | #define SM501_MISC_CONTROL (0x000004) |
diff --git a/include/linux/smb_fs_sb.h b/include/linux/smb_fs_sb.h index 8a060a7040d8..bb947dd1fba9 100644 --- a/include/linux/smb_fs_sb.h +++ b/include/linux/smb_fs_sb.h | |||
| @@ -10,6 +10,7 @@ | |||
| 10 | #define _SMB_FS_SB | 10 | #define _SMB_FS_SB |
| 11 | 11 | ||
| 12 | #include <linux/types.h> | 12 | #include <linux/types.h> |
| 13 | #include <linux/backing-dev.h> | ||
| 13 | #include <linux/smb.h> | 14 | #include <linux/smb.h> |
| 14 | 15 | ||
| 15 | /* | 16 | /* |
| @@ -74,6 +75,8 @@ struct smb_sb_info { | |||
| 74 | struct smb_ops *ops; | 75 | struct smb_ops *ops; |
| 75 | 76 | ||
| 76 | struct super_block *super_block; | 77 | struct super_block *super_block; |
| 78 | |||
| 79 | struct backing_dev_info bdi; | ||
| 77 | }; | 80 | }; |
| 78 | 81 | ||
| 79 | static inline int | 82 | static inline int |
diff --git a/include/linux/smp.h b/include/linux/smp.h index 76bb3e45351f..f86d40768e7f 100644 --- a/include/linux/smp.h +++ b/include/linux/smp.h | |||
| @@ -76,6 +76,9 @@ void smp_call_function_many(const struct cpumask *mask, | |||
| 76 | void __smp_call_function_single(int cpuid, struct call_single_data *data, | 76 | void __smp_call_function_single(int cpuid, struct call_single_data *data, |
| 77 | int wait); | 77 | int wait); |
| 78 | 78 | ||
| 79 | int smp_call_function_any(const struct cpumask *mask, | ||
| 80 | void (*func)(void *info), void *info, int wait); | ||
| 81 | |||
| 79 | /* | 82 | /* |
| 80 | * sends a 'pull timer' event to a remote CPU | 83 | * sends a 'pull timer' event to a remote CPU |
| 81 | */ | 84 | */ |
| @@ -142,15 +145,21 @@ static inline void smp_send_reschedule(int cpu) { } | |||
| 142 | #define smp_prepare_boot_cpu() do {} while (0) | 145 | #define smp_prepare_boot_cpu() do {} while (0) |
| 143 | #define smp_call_function_many(mask, func, info, wait) \ | 146 | #define smp_call_function_many(mask, func, info, wait) \ |
| 144 | (up_smp_call_function(func, info)) | 147 | (up_smp_call_function(func, info)) |
| 145 | static inline void init_call_single_data(void) | 148 | static inline void init_call_single_data(void) { } |
| 149 | |||
| 150 | static inline int | ||
| 151 | smp_call_function_any(const struct cpumask *mask, void (*func)(void *info), | ||
| 152 | void *info, int wait) | ||
| 146 | { | 153 | { |
| 154 | return smp_call_function_single(0, func, info, wait); | ||
| 147 | } | 155 | } |
| 156 | |||
| 148 | #endif /* !SMP */ | 157 | #endif /* !SMP */ |
| 149 | 158 | ||
| 150 | /* | 159 | /* |
| 151 | * smp_processor_id(): get the current CPU ID. | 160 | * smp_processor_id(): get the current CPU ID. |
| 152 | * | 161 | * |
| 153 | * if DEBUG_PREEMPT is enabled the we check whether it is | 162 | * if DEBUG_PREEMPT is enabled then we check whether it is |
| 154 | * used in a preemption-safe way. (smp_processor_id() is safe | 163 | * used in a preemption-safe way. (smp_processor_id() is safe |
| 155 | * if it's used in a preemption-off critical section, or in | 164 | * if it's used in a preemption-off critical section, or in |
| 156 | * a thread that is bound to the current CPU.) | 165 | * a thread that is bound to the current CPU.) |
diff --git a/include/linux/smp_lock.h b/include/linux/smp_lock.h index 813be59bf345..2ea1dd1ba21c 100644 --- a/include/linux/smp_lock.h +++ b/include/linux/smp_lock.h | |||
| @@ -24,8 +24,21 @@ static inline int reacquire_kernel_lock(struct task_struct *task) | |||
| 24 | return 0; | 24 | return 0; |
| 25 | } | 25 | } |
| 26 | 26 | ||
| 27 | extern void __lockfunc lock_kernel(void) __acquires(kernel_lock); | 27 | extern void __lockfunc |
| 28 | extern void __lockfunc unlock_kernel(void) __releases(kernel_lock); | 28 | _lock_kernel(const char *func, const char *file, int line) |
| 29 | __acquires(kernel_lock); | ||
| 30 | |||
| 31 | extern void __lockfunc | ||
| 32 | _unlock_kernel(const char *func, const char *file, int line) | ||
| 33 | __releases(kernel_lock); | ||
| 34 | |||
| 35 | #define lock_kernel() do { \ | ||
| 36 | _lock_kernel(__func__, __FILE__, __LINE__); \ | ||
| 37 | } while (0) | ||
| 38 | |||
| 39 | #define unlock_kernel() do { \ | ||
| 40 | _unlock_kernel(__func__, __FILE__, __LINE__); \ | ||
| 41 | } while (0) | ||
| 29 | 42 | ||
| 30 | /* | 43 | /* |
| 31 | * Various legacy drivers don't really need the BKL in a specific | 44 | * Various legacy drivers don't really need the BKL in a specific |
| @@ -41,8 +54,8 @@ static inline void cycle_kernel_lock(void) | |||
| 41 | 54 | ||
| 42 | #else | 55 | #else |
| 43 | 56 | ||
| 44 | #define lock_kernel() do { } while(0) | 57 | #define lock_kernel() |
| 45 | #define unlock_kernel() do { } while(0) | 58 | #define unlock_kernel() |
| 46 | #define release_kernel_lock(task) do { } while(0) | 59 | #define release_kernel_lock(task) do { } while(0) |
| 47 | #define cycle_kernel_lock() do { } while(0) | 60 | #define cycle_kernel_lock() do { } while(0) |
| 48 | #define reacquire_kernel_lock(task) 0 | 61 | #define reacquire_kernel_lock(task) 0 |
diff --git a/include/linux/smsc911x.h b/include/linux/smsc911x.h index 5241e4fb4eca..7144e8aa1e41 100644 --- a/include/linux/smsc911x.h +++ b/include/linux/smsc911x.h | |||
| @@ -30,6 +30,7 @@ struct smsc911x_platform_config { | |||
| 30 | unsigned int irq_type; | 30 | unsigned int irq_type; |
| 31 | unsigned int flags; | 31 | unsigned int flags; |
| 32 | phy_interface_t phy_interface; | 32 | phy_interface_t phy_interface; |
| 33 | unsigned char mac[6]; | ||
| 33 | }; | 34 | }; |
| 34 | 35 | ||
| 35 | /* Constants for platform_device irq polarity configuration */ | 36 | /* Constants for platform_device irq polarity configuration */ |
diff --git a/include/linux/snmp.h b/include/linux/snmp.h index 0f953fe40413..4435d1084755 100644 --- a/include/linux/snmp.h +++ b/include/linux/snmp.h | |||
| @@ -225,6 +225,8 @@ enum | |||
| 225 | LINUX_MIB_SACKSHIFTED, | 225 | LINUX_MIB_SACKSHIFTED, |
| 226 | LINUX_MIB_SACKMERGED, | 226 | LINUX_MIB_SACKMERGED, |
| 227 | LINUX_MIB_SACKSHIFTFALLBACK, | 227 | LINUX_MIB_SACKSHIFTFALLBACK, |
| 228 | LINUX_MIB_TCPBACKLOGDROP, | ||
| 229 | LINUX_MIB_TCPMINTTLDROP, /* RFC 5082 */ | ||
| 228 | __LINUX_MIB_MAX | 230 | __LINUX_MIB_MAX |
| 229 | }; | 231 | }; |
| 230 | 232 | ||
| @@ -257,6 +259,7 @@ enum | |||
| 257 | LINUX_MIB_XFRMOUTPOLBLOCK, /* XfrmOutPolBlock */ | 259 | LINUX_MIB_XFRMOUTPOLBLOCK, /* XfrmOutPolBlock */ |
| 258 | LINUX_MIB_XFRMOUTPOLDEAD, /* XfrmOutPolDead */ | 260 | LINUX_MIB_XFRMOUTPOLDEAD, /* XfrmOutPolDead */ |
| 259 | LINUX_MIB_XFRMOUTPOLERROR, /* XfrmOutPolError */ | 261 | LINUX_MIB_XFRMOUTPOLERROR, /* XfrmOutPolError */ |
| 262 | LINUX_MIB_XFRMFWDHDRERROR, /* XfrmFwdHdrError*/ | ||
| 260 | __LINUX_MIB_XFRMMAX | 263 | __LINUX_MIB_XFRMMAX |
| 261 | }; | 264 | }; |
| 262 | 265 | ||
diff --git a/include/linux/socket.h b/include/linux/socket.h index 3273a0c5043b..354cc5617f8b 100644 --- a/include/linux/socket.h +++ b/include/linux/socket.h | |||
| @@ -24,6 +24,9 @@ struct __kernel_sockaddr_storage { | |||
| 24 | #include <linux/types.h> /* pid_t */ | 24 | #include <linux/types.h> /* pid_t */ |
| 25 | #include <linux/compiler.h> /* __user */ | 25 | #include <linux/compiler.h> /* __user */ |
| 26 | 26 | ||
| 27 | #define __sockaddr_check_size(size) \ | ||
| 28 | BUILD_BUG_ON(((size) > sizeof(struct __kernel_sockaddr_storage))) | ||
| 29 | |||
| 27 | #ifdef __KERNEL__ | 30 | #ifdef __KERNEL__ |
| 28 | # ifdef CONFIG_PROC_FS | 31 | # ifdef CONFIG_PROC_FS |
| 29 | struct seq_file; | 32 | struct seq_file; |
| @@ -65,6 +68,12 @@ struct msghdr { | |||
| 65 | unsigned msg_flags; | 68 | unsigned msg_flags; |
| 66 | }; | 69 | }; |
| 67 | 70 | ||
| 71 | /* For recvmmsg/sendmmsg */ | ||
| 72 | struct mmsghdr { | ||
| 73 | struct msghdr msg_hdr; | ||
| 74 | unsigned msg_len; | ||
| 75 | }; | ||
| 76 | |||
| 68 | /* | 77 | /* |
| 69 | * POSIX 1003.1g - ancillary data object information | 78 | * POSIX 1003.1g - ancillary data object information |
| 70 | * Ancillary data consits of a sequence of pairs of | 79 | * Ancillary data consits of a sequence of pairs of |
| @@ -246,6 +255,7 @@ struct ucred { | |||
| 246 | #define MSG_ERRQUEUE 0x2000 /* Fetch message from error queue */ | 255 | #define MSG_ERRQUEUE 0x2000 /* Fetch message from error queue */ |
| 247 | #define MSG_NOSIGNAL 0x4000 /* Do not generate SIGPIPE */ | 256 | #define MSG_NOSIGNAL 0x4000 /* Do not generate SIGPIPE */ |
| 248 | #define MSG_MORE 0x8000 /* Sender will send more */ | 257 | #define MSG_MORE 0x8000 /* Sender will send more */ |
| 258 | #define MSG_WAITFORONE 0x10000 /* recvmmsg(): block until 1+ packets avail */ | ||
| 249 | 259 | ||
| 250 | #define MSG_EOF MSG_FIN | 260 | #define MSG_EOF MSG_FIN |
| 251 | 261 | ||
| @@ -312,6 +322,10 @@ extern int move_addr_to_user(struct sockaddr *kaddr, int klen, void __user *uadd | |||
| 312 | extern int move_addr_to_kernel(void __user *uaddr, int ulen, struct sockaddr *kaddr); | 322 | extern int move_addr_to_kernel(void __user *uaddr, int ulen, struct sockaddr *kaddr); |
| 313 | extern int put_cmsg(struct msghdr*, int level, int type, int len, void *data); | 323 | extern int put_cmsg(struct msghdr*, int level, int type, int len, void *data); |
| 314 | 324 | ||
| 325 | struct timespec; | ||
| 326 | |||
| 327 | extern int __sys_recvmmsg(int fd, struct mmsghdr __user *mmsg, unsigned int vlen, | ||
| 328 | unsigned int flags, struct timespec *timeout); | ||
| 315 | #endif | 329 | #endif |
| 316 | #endif /* not kernel and not glibc */ | 330 | #endif /* not kernel and not glibc */ |
| 317 | #endif /* _LINUX_SOCKET_H */ | 331 | #endif /* _LINUX_SOCKET_H */ |
diff --git a/include/linux/sonypi.h b/include/linux/sonypi.h index 34c4475ac4a2..4f95c1aac2fd 100644 --- a/include/linux/sonypi.h +++ b/include/linux/sonypi.h | |||
| @@ -111,6 +111,7 @@ | |||
| 111 | #define SONYPI_EVENT_VOLUME_INC_PRESSED 69 | 111 | #define SONYPI_EVENT_VOLUME_INC_PRESSED 69 |
| 112 | #define SONYPI_EVENT_VOLUME_DEC_PRESSED 70 | 112 | #define SONYPI_EVENT_VOLUME_DEC_PRESSED 70 |
| 113 | #define SONYPI_EVENT_BRIGHTNESS_PRESSED 71 | 113 | #define SONYPI_EVENT_BRIGHTNESS_PRESSED 71 |
| 114 | #define SONYPI_EVENT_MEDIA_PRESSED 72 | ||
| 114 | 115 | ||
| 115 | /* get/set brightness */ | 116 | /* get/set brightness */ |
| 116 | #define SONYPI_IOCGBRT _IOR('v', 0, __u8) | 117 | #define SONYPI_IOCGBRT _IOR('v', 0, __u8) |
diff --git a/include/linux/spi/ad7879.h b/include/linux/spi/ad7879.h index 4231104c9afa..6334cee1a3be 100644 --- a/include/linux/spi/ad7879.h +++ b/include/linux/spi/ad7879.h | |||
| @@ -28,8 +28,12 @@ struct ad7879_platform_data { | |||
| 28 | * 1 = 4, 2 = 8, 3 = 16 (median > averaging) | 28 | * 1 = 4, 2 = 8, 3 = 16 (median > averaging) |
| 29 | */ | 29 | */ |
| 30 | u8 median; | 30 | u8 median; |
| 31 | /* 1 = AUX/VBAT/GPIO set to GPIO Output */ | 31 | /* 1 = AUX/VBAT/GPIO export GPIO to gpiolib |
| 32 | u8 gpio_output; | 32 | * requires CONFIG_GPIOLIB |
| 33 | /* Initial GPIO pin state (valid if gpio_output = 1) */ | 33 | */ |
| 34 | u8 gpio_default; | 34 | bool gpio_export; |
| 35 | /* identifies the first GPIO number handled by this chip; | ||
| 36 | * or, if negative, requests dynamic ID allocation. | ||
| 37 | */ | ||
| 38 | s32 gpio_base; | ||
| 35 | }; | 39 | }; |
diff --git a/include/linux/spi/ads7846.h b/include/linux/spi/ads7846.h index 51948eb6927a..b4ae570d3c98 100644 --- a/include/linux/spi/ads7846.h +++ b/include/linux/spi/ads7846.h | |||
| @@ -12,7 +12,7 @@ enum ads7846_filter { | |||
| 12 | }; | 12 | }; |
| 13 | 13 | ||
| 14 | struct ads7846_platform_data { | 14 | struct ads7846_platform_data { |
| 15 | u16 model; /* 7843, 7845, 7846. */ | 15 | u16 model; /* 7843, 7845, 7846, 7873. */ |
| 16 | u16 vref_delay_usecs; /* 0 for external vref; etc */ | 16 | u16 vref_delay_usecs; /* 0 for external vref; etc */ |
| 17 | u16 vref_mv; /* external vref value, milliVolts */ | 17 | u16 vref_mv; /* external vref value, milliVolts */ |
| 18 | bool keep_vref_on; /* set to keep vref on for differential | 18 | bool keep_vref_on; /* set to keep vref on for differential |
| @@ -53,5 +53,6 @@ struct ads7846_platform_data { | |||
| 53 | int (*filter) (void *filter_data, int data_idx, int *val); | 53 | int (*filter) (void *filter_data, int data_idx, int *val); |
| 54 | void (*filter_cleanup)(void *filter_data); | 54 | void (*filter_cleanup)(void *filter_data); |
| 55 | void (*wait_for_sync)(void); | 55 | void (*wait_for_sync)(void); |
| 56 | bool wakeup; | ||
| 56 | }; | 57 | }; |
| 57 | 58 | ||
diff --git a/include/linux/spi/dw_spi.h b/include/linux/spi/dw_spi.h new file mode 100644 index 000000000000..cc813f95a2f2 --- /dev/null +++ b/include/linux/spi/dw_spi.h | |||
| @@ -0,0 +1,217 @@ | |||
| 1 | #ifndef DW_SPI_HEADER_H | ||
| 2 | #define DW_SPI_HEADER_H | ||
| 3 | #include <linux/io.h> | ||
| 4 | |||
| 5 | /* Bit fields in CTRLR0 */ | ||
| 6 | #define SPI_DFS_OFFSET 0 | ||
| 7 | |||
| 8 | #define SPI_FRF_OFFSET 4 | ||
| 9 | #define SPI_FRF_SPI 0x0 | ||
| 10 | #define SPI_FRF_SSP 0x1 | ||
| 11 | #define SPI_FRF_MICROWIRE 0x2 | ||
| 12 | #define SPI_FRF_RESV 0x3 | ||
| 13 | |||
| 14 | #define SPI_MODE_OFFSET 6 | ||
| 15 | #define SPI_SCPH_OFFSET 6 | ||
| 16 | #define SPI_SCOL_OFFSET 7 | ||
| 17 | #define SPI_TMOD_OFFSET 8 | ||
| 18 | #define SPI_TMOD_TR 0x0 /* xmit & recv */ | ||
| 19 | #define SPI_TMOD_TO 0x1 /* xmit only */ | ||
| 20 | #define SPI_TMOD_RO 0x2 /* recv only */ | ||
| 21 | #define SPI_TMOD_EPROMREAD 0x3 /* eeprom read mode */ | ||
| 22 | |||
| 23 | #define SPI_SLVOE_OFFSET 10 | ||
| 24 | #define SPI_SRL_OFFSET 11 | ||
| 25 | #define SPI_CFS_OFFSET 12 | ||
| 26 | |||
| 27 | /* Bit fields in SR, 7 bits */ | ||
| 28 | #define SR_MASK 0x7f /* cover 7 bits */ | ||
| 29 | #define SR_BUSY (1 << 0) | ||
| 30 | #define SR_TF_NOT_FULL (1 << 1) | ||
| 31 | #define SR_TF_EMPT (1 << 2) | ||
| 32 | #define SR_RF_NOT_EMPT (1 << 3) | ||
| 33 | #define SR_RF_FULL (1 << 4) | ||
| 34 | #define SR_TX_ERR (1 << 5) | ||
| 35 | #define SR_DCOL (1 << 6) | ||
| 36 | |||
| 37 | /* Bit fields in ISR, IMR, RISR, 7 bits */ | ||
| 38 | #define SPI_INT_TXEI (1 << 0) | ||
| 39 | #define SPI_INT_TXOI (1 << 1) | ||
| 40 | #define SPI_INT_RXUI (1 << 2) | ||
| 41 | #define SPI_INT_RXOI (1 << 3) | ||
| 42 | #define SPI_INT_RXFI (1 << 4) | ||
| 43 | #define SPI_INT_MSTI (1 << 5) | ||
| 44 | |||
| 45 | /* TX RX interrupt level threshhold, max can be 256 */ | ||
| 46 | #define SPI_INT_THRESHOLD 32 | ||
| 47 | |||
| 48 | enum dw_ssi_type { | ||
| 49 | SSI_MOTO_SPI = 0, | ||
| 50 | SSI_TI_SSP, | ||
| 51 | SSI_NS_MICROWIRE, | ||
| 52 | }; | ||
| 53 | |||
| 54 | struct dw_spi_reg { | ||
| 55 | u32 ctrl0; | ||
| 56 | u32 ctrl1; | ||
| 57 | u32 ssienr; | ||
| 58 | u32 mwcr; | ||
| 59 | u32 ser; | ||
| 60 | u32 baudr; | ||
| 61 | u32 txfltr; | ||
| 62 | u32 rxfltr; | ||
| 63 | u32 txflr; | ||
| 64 | u32 rxflr; | ||
| 65 | u32 sr; | ||
| 66 | u32 imr; | ||
| 67 | u32 isr; | ||
| 68 | u32 risr; | ||
| 69 | u32 txoicr; | ||
| 70 | u32 rxoicr; | ||
| 71 | u32 rxuicr; | ||
| 72 | u32 msticr; | ||
| 73 | u32 icr; | ||
| 74 | u32 dmacr; | ||
| 75 | u32 dmatdlr; | ||
| 76 | u32 dmardlr; | ||
| 77 | u32 idr; | ||
| 78 | u32 version; | ||
| 79 | u32 dr; /* Currently oper as 32 bits, | ||
| 80 | though only low 16 bits matters */ | ||
| 81 | } __packed; | ||
| 82 | |||
| 83 | struct dw_spi { | ||
| 84 | struct spi_master *master; | ||
| 85 | struct spi_device *cur_dev; | ||
| 86 | struct device *parent_dev; | ||
| 87 | enum dw_ssi_type type; | ||
| 88 | |||
| 89 | void __iomem *regs; | ||
| 90 | unsigned long paddr; | ||
| 91 | u32 iolen; | ||
| 92 | int irq; | ||
| 93 | u32 fifo_len; /* depth of the FIFO buffer */ | ||
| 94 | u32 max_freq; /* max bus freq supported */ | ||
| 95 | |||
| 96 | u16 bus_num; | ||
| 97 | u16 num_cs; /* supported slave numbers */ | ||
| 98 | |||
| 99 | /* Driver message queue */ | ||
| 100 | struct workqueue_struct *workqueue; | ||
| 101 | struct work_struct pump_messages; | ||
| 102 | spinlock_t lock; | ||
| 103 | struct list_head queue; | ||
| 104 | int busy; | ||
| 105 | int run; | ||
| 106 | |||
| 107 | /* Message Transfer pump */ | ||
| 108 | struct tasklet_struct pump_transfers; | ||
| 109 | |||
| 110 | /* Current message transfer state info */ | ||
| 111 | struct spi_message *cur_msg; | ||
| 112 | struct spi_transfer *cur_transfer; | ||
| 113 | struct chip_data *cur_chip; | ||
| 114 | struct chip_data *prev_chip; | ||
| 115 | size_t len; | ||
| 116 | void *tx; | ||
| 117 | void *tx_end; | ||
| 118 | void *rx; | ||
| 119 | void *rx_end; | ||
| 120 | int dma_mapped; | ||
| 121 | dma_addr_t rx_dma; | ||
| 122 | dma_addr_t tx_dma; | ||
| 123 | size_t rx_map_len; | ||
| 124 | size_t tx_map_len; | ||
| 125 | u8 n_bytes; /* current is a 1/2 bytes op */ | ||
| 126 | u8 max_bits_per_word; /* maxim is 16b */ | ||
| 127 | u32 dma_width; | ||
| 128 | int cs_change; | ||
| 129 | int (*write)(struct dw_spi *dws); | ||
| 130 | int (*read)(struct dw_spi *dws); | ||
| 131 | irqreturn_t (*transfer_handler)(struct dw_spi *dws); | ||
| 132 | void (*cs_control)(u32 command); | ||
| 133 | |||
| 134 | /* Dma info */ | ||
| 135 | int dma_inited; | ||
| 136 | struct dma_chan *txchan; | ||
| 137 | struct dma_chan *rxchan; | ||
| 138 | int txdma_done; | ||
| 139 | int rxdma_done; | ||
| 140 | u64 tx_param; | ||
| 141 | u64 rx_param; | ||
| 142 | struct device *dma_dev; | ||
| 143 | dma_addr_t dma_addr; | ||
| 144 | |||
| 145 | /* Bus interface info */ | ||
| 146 | void *priv; | ||
| 147 | #ifdef CONFIG_DEBUG_FS | ||
| 148 | struct dentry *debugfs; | ||
| 149 | #endif | ||
| 150 | }; | ||
| 151 | |||
| 152 | #define dw_readl(dw, name) \ | ||
| 153 | __raw_readl(&(((struct dw_spi_reg *)dw->regs)->name)) | ||
| 154 | #define dw_writel(dw, name, val) \ | ||
| 155 | __raw_writel((val), &(((struct dw_spi_reg *)dw->regs)->name)) | ||
| 156 | #define dw_readw(dw, name) \ | ||
| 157 | __raw_readw(&(((struct dw_spi_reg *)dw->regs)->name)) | ||
| 158 | #define dw_writew(dw, name, val) \ | ||
| 159 | __raw_writew((val), &(((struct dw_spi_reg *)dw->regs)->name)) | ||
| 160 | |||
| 161 | static inline void spi_enable_chip(struct dw_spi *dws, int enable) | ||
| 162 | { | ||
| 163 | dw_writel(dws, ssienr, (enable ? 1 : 0)); | ||
| 164 | } | ||
| 165 | |||
| 166 | static inline void spi_set_clk(struct dw_spi *dws, u16 div) | ||
| 167 | { | ||
| 168 | dw_writel(dws, baudr, div); | ||
| 169 | } | ||
| 170 | |||
| 171 | static inline void spi_chip_sel(struct dw_spi *dws, u16 cs) | ||
| 172 | { | ||
| 173 | if (cs > dws->num_cs) | ||
| 174 | return; | ||
| 175 | |||
| 176 | if (dws->cs_control) | ||
| 177 | dws->cs_control(1); | ||
| 178 | |||
| 179 | dw_writel(dws, ser, 1 << cs); | ||
| 180 | } | ||
| 181 | |||
| 182 | /* Disable IRQ bits */ | ||
| 183 | static inline void spi_mask_intr(struct dw_spi *dws, u32 mask) | ||
| 184 | { | ||
| 185 | u32 new_mask; | ||
| 186 | |||
| 187 | new_mask = dw_readl(dws, imr) & ~mask; | ||
| 188 | dw_writel(dws, imr, new_mask); | ||
| 189 | } | ||
| 190 | |||
| 191 | /* Enable IRQ bits */ | ||
| 192 | static inline void spi_umask_intr(struct dw_spi *dws, u32 mask) | ||
| 193 | { | ||
| 194 | u32 new_mask; | ||
| 195 | |||
| 196 | new_mask = dw_readl(dws, imr) | mask; | ||
| 197 | dw_writel(dws, imr, new_mask); | ||
| 198 | } | ||
| 199 | |||
| 200 | /* | ||
| 201 | * Each SPI slave device to work with dw_api controller should | ||
| 202 | * has such a structure claiming its working mode (PIO/DMA etc), | ||
| 203 | * which can be save in the "controller_data" member of the | ||
| 204 | * struct spi_device | ||
| 205 | */ | ||
| 206 | struct dw_spi_chip { | ||
| 207 | u8 poll_mode; /* 0 for contoller polling mode */ | ||
| 208 | u8 type; /* SPI/SSP/Micrwire */ | ||
| 209 | u8 enable_dma; | ||
| 210 | void (*cs_control)(u32 command); | ||
| 211 | }; | ||
| 212 | |||
| 213 | extern int dw_spi_add_host(struct dw_spi *dws); | ||
| 214 | extern void dw_spi_remove_host(struct dw_spi *dws); | ||
| 215 | extern int dw_spi_suspend_host(struct dw_spi *dws); | ||
| 216 | extern int dw_spi_resume_host(struct dw_spi *dws); | ||
| 217 | #endif /* DW_SPI_HEADER_H */ | ||
diff --git a/include/linux/spi/l4f00242t03.h b/include/linux/spi/l4f00242t03.h new file mode 100644 index 000000000000..aee1dbda4edc --- /dev/null +++ b/include/linux/spi/l4f00242t03.h | |||
| @@ -0,0 +1,31 @@ | |||
| 1 | /* | ||
| 2 | * l4f00242t03.h -- Platform glue for Epson L4F00242T03 LCD | ||
| 3 | * | ||
| 4 | * Copyright (c) 2009 Alberto Panizzo <maramaopercheseimorto@gmail.com> | ||
| 5 | * Based on Marek Vasut work in lms283gf05.h | ||
| 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 | * 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 | * You should have received a copy of the GNU General Public License | ||
| 17 | * along with this program; if not, write to the Free Software | ||
| 18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
| 19 | */ | ||
| 20 | |||
| 21 | #ifndef _INCLUDE_LINUX_SPI_L4F00242T03_H_ | ||
| 22 | #define _INCLUDE_LINUX_SPI_L4F00242T03_H_ | ||
| 23 | |||
| 24 | struct l4f00242t03_pdata { | ||
| 25 | unsigned int reset_gpio; | ||
| 26 | unsigned int data_enable_gpio; | ||
| 27 | const char *io_supply; /* will be set to 1.8 V */ | ||
| 28 | const char *core_supply; /* will be set to 2.8 V */ | ||
| 29 | }; | ||
| 30 | |||
| 31 | #endif /* _INCLUDE_LINUX_SPI_L4F00242T03_H_ */ | ||
diff --git a/include/linux/spi/max7301.h b/include/linux/spi/max7301.h index 6dfd83f19b4b..34af0a3477bf 100644 --- a/include/linux/spi/max7301.h +++ b/include/linux/spi/max7301.h | |||
| @@ -1,9 +1,27 @@ | |||
| 1 | #ifndef LINUX_SPI_MAX7301_H | 1 | #ifndef LINUX_SPI_MAX7301_H |
| 2 | #define LINUX_SPI_MAX7301_H | 2 | #define LINUX_SPI_MAX7301_H |
| 3 | 3 | ||
| 4 | #include <linux/gpio.h> | ||
| 5 | |||
| 6 | /* | ||
| 7 | * Some registers must be read back to modify. | ||
| 8 | * To save time we cache them here in memory | ||
| 9 | */ | ||
| 10 | struct max7301 { | ||
| 11 | struct mutex lock; | ||
| 12 | u8 port_config[8]; /* field 0 is unused */ | ||
| 13 | u32 out_level; /* cached output levels */ | ||
| 14 | struct gpio_chip chip; | ||
| 15 | struct device *dev; | ||
| 16 | int (*write)(struct device *dev, unsigned int reg, unsigned int val); | ||
| 17 | int (*read)(struct device *dev, unsigned int reg); | ||
| 18 | }; | ||
| 19 | |||
| 4 | struct max7301_platform_data { | 20 | struct max7301_platform_data { |
| 5 | /* number assigned to the first GPIO */ | 21 | /* number assigned to the first GPIO */ |
| 6 | unsigned base; | 22 | unsigned base; |
| 7 | }; | 23 | }; |
| 8 | 24 | ||
| 25 | extern int __max730x_remove(struct device *dev); | ||
| 26 | extern int __max730x_probe(struct max7301 *ts); | ||
| 9 | #endif | 27 | #endif |
diff --git a/include/linux/spi/sh_msiof.h b/include/linux/spi/sh_msiof.h new file mode 100644 index 000000000000..2e8db3d2d2e5 --- /dev/null +++ b/include/linux/spi/sh_msiof.h | |||
| @@ -0,0 +1,10 @@ | |||
| 1 | #ifndef __SPI_SH_MSIOF_H__ | ||
| 2 | #define __SPI_SH_MSIOF_H__ | ||
| 3 | |||
| 4 | struct sh_msiof_spi_info { | ||
| 5 | int tx_fifo_override; | ||
| 6 | int rx_fifo_override; | ||
| 7 | u16 num_chipselect; | ||
| 8 | }; | ||
| 9 | |||
| 10 | #endif /* __SPI_SH_MSIOF_H__ */ | ||
diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h index 97b60b37f445..af56071b06f9 100644 --- a/include/linux/spi/spi.h +++ b/include/linux/spi/spi.h | |||
| @@ -21,6 +21,7 @@ | |||
| 21 | 21 | ||
| 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 | 25 | ||
| 25 | /* | 26 | /* |
| 26 | * INTERFACES between SPI master-side drivers and SPI infrastructure. | 27 | * INTERFACES between SPI master-side drivers and SPI infrastructure. |
diff --git a/include/linux/spi/spi_bitbang.h b/include/linux/spi/spi_bitbang.h index eed4254bd503..3274c507b8a9 100644 --- a/include/linux/spi/spi_bitbang.h +++ b/include/linux/spi/spi_bitbang.h | |||
| @@ -15,7 +15,7 @@ | |||
| 15 | * Some hardware works well with requests at spi_transfer scope: | 15 | * Some hardware works well with requests at spi_transfer scope: |
| 16 | * | 16 | * |
| 17 | * - Drivers leveraging smarter hardware, with fifos or DMA; or for half | 17 | * - Drivers leveraging smarter hardware, with fifos or DMA; or for half |
| 18 | * duplex (MicroWire) controllers. Provide chipslect() and txrx_bufs(), | 18 | * duplex (MicroWire) controllers. Provide chipselect() and txrx_bufs(), |
| 19 | * and custom setup()/cleanup() methods. | 19 | * and custom setup()/cleanup() methods. |
| 20 | */ | 20 | */ |
| 21 | 21 | ||
diff --git a/include/linux/spi/wl12xx.h b/include/linux/spi/wl12xx.h index 11430cab2aad..aed64ed3dc8a 100644 --- a/include/linux/spi/wl12xx.h +++ b/include/linux/spi/wl12xx.h | |||
| @@ -26,6 +26,7 @@ | |||
| 26 | 26 | ||
| 27 | struct wl12xx_platform_data { | 27 | struct wl12xx_platform_data { |
| 28 | void (*set_power)(bool enable); | 28 | void (*set_power)(bool enable); |
| 29 | bool use_eeprom; | ||
| 29 | }; | 30 | }; |
| 30 | 31 | ||
| 31 | #endif | 32 | #endif |
diff --git a/include/linux/spi/xilinx_spi.h b/include/linux/spi/xilinx_spi.h new file mode 100644 index 000000000000..6f17278810b0 --- /dev/null +++ b/include/linux/spi/xilinx_spi.h | |||
| @@ -0,0 +1,20 @@ | |||
| 1 | #ifndef __LINUX_SPI_XILINX_SPI_H | ||
| 2 | #define __LINUX_SPI_XILINX_SPI_H | ||
| 3 | |||
| 4 | /** | ||
| 5 | * struct xspi_platform_data - Platform data of the Xilinx SPI driver | ||
| 6 | * @num_chipselect: Number of chip select by the IP. | ||
| 7 | * @little_endian: If registers should be accessed little endian or not. | ||
| 8 | * @bits_per_word: Number of bits per word. | ||
| 9 | * @devices: Devices to add when the driver is probed. | ||
| 10 | * @num_devices: Number of devices in the devices array. | ||
| 11 | */ | ||
| 12 | struct xspi_platform_data { | ||
| 13 | u16 num_chipselect; | ||
| 14 | bool little_endian; | ||
| 15 | u8 bits_per_word; | ||
| 16 | struct spi_board_info *devices; | ||
| 17 | u8 num_devices; | ||
| 18 | }; | ||
| 19 | |||
| 20 | #endif /* __LINUX_SPI_XILINX_SPI_H */ | ||
diff --git a/include/linux/spinlock.h b/include/linux/spinlock.h index f0ca7a7a1757..89fac6a3f78b 100644 --- a/include/linux/spinlock.h +++ b/include/linux/spinlock.h | |||
| @@ -8,13 +8,13 @@ | |||
| 8 | * | 8 | * |
| 9 | * on SMP builds: | 9 | * on SMP builds: |
| 10 | * | 10 | * |
| 11 | * asm/spinlock_types.h: contains the raw_spinlock_t/raw_rwlock_t and the | 11 | * asm/spinlock_types.h: contains the arch_spinlock_t/arch_rwlock_t and the |
| 12 | * initializers | 12 | * initializers |
| 13 | * | 13 | * |
| 14 | * linux/spinlock_types.h: | 14 | * linux/spinlock_types.h: |
| 15 | * defines the generic type and initializers | 15 | * defines the generic type and initializers |
| 16 | * | 16 | * |
| 17 | * asm/spinlock.h: contains the __raw_spin_*()/etc. lowlevel | 17 | * asm/spinlock.h: contains the arch_spin_*()/etc. lowlevel |
| 18 | * implementations, mostly inline assembly code | 18 | * implementations, mostly inline assembly code |
| 19 | * | 19 | * |
| 20 | * (also included on UP-debug builds:) | 20 | * (also included on UP-debug builds:) |
| @@ -34,7 +34,7 @@ | |||
| 34 | * defines the generic type and initializers | 34 | * defines the generic type and initializers |
| 35 | * | 35 | * |
| 36 | * linux/spinlock_up.h: | 36 | * linux/spinlock_up.h: |
| 37 | * contains the __raw_spin_*()/etc. version of UP | 37 | * contains the arch_spin_*()/etc. version of UP |
| 38 | * builds. (which are NOPs on non-debug, non-preempt | 38 | * builds. (which are NOPs on non-debug, non-preempt |
| 39 | * builds) | 39 | * builds) |
| 40 | * | 40 | * |
| @@ -75,14 +75,12 @@ | |||
| 75 | #define __lockfunc __attribute__((section(".spinlock.text"))) | 75 | #define __lockfunc __attribute__((section(".spinlock.text"))) |
| 76 | 76 | ||
| 77 | /* | 77 | /* |
| 78 | * Pull the raw_spinlock_t and raw_rwlock_t definitions: | 78 | * Pull the arch_spinlock_t and arch_rwlock_t definitions: |
| 79 | */ | 79 | */ |
| 80 | #include <linux/spinlock_types.h> | 80 | #include <linux/spinlock_types.h> |
| 81 | 81 | ||
| 82 | extern int __lockfunc generic__raw_read_trylock(raw_rwlock_t *lock); | ||
| 83 | |||
| 84 | /* | 82 | /* |
| 85 | * Pull the __raw*() functions/declarations (UP-nondebug doesnt need them): | 83 | * Pull the arch_spin*() functions/declarations (UP-nondebug doesnt need them): |
| 86 | */ | 84 | */ |
| 87 | #ifdef CONFIG_SMP | 85 | #ifdef CONFIG_SMP |
| 88 | # include <asm/spinlock.h> | 86 | # include <asm/spinlock.h> |
| @@ -91,45 +89,31 @@ extern int __lockfunc generic__raw_read_trylock(raw_rwlock_t *lock); | |||
| 91 | #endif | 89 | #endif |
| 92 | 90 | ||
| 93 | #ifdef CONFIG_DEBUG_SPINLOCK | 91 | #ifdef CONFIG_DEBUG_SPINLOCK |
| 94 | extern void __spin_lock_init(spinlock_t *lock, const char *name, | 92 | extern void __raw_spin_lock_init(raw_spinlock_t *lock, const char *name, |
| 95 | struct lock_class_key *key); | 93 | struct lock_class_key *key); |
| 96 | # define spin_lock_init(lock) \ | 94 | # define raw_spin_lock_init(lock) \ |
| 97 | do { \ | 95 | do { \ |
| 98 | static struct lock_class_key __key; \ | 96 | static struct lock_class_key __key; \ |
| 99 | \ | 97 | \ |
| 100 | __spin_lock_init((lock), #lock, &__key); \ | 98 | __raw_spin_lock_init((lock), #lock, &__key); \ |
| 101 | } while (0) | 99 | } while (0) |
| 102 | 100 | ||
| 103 | #else | 101 | #else |
| 104 | # define spin_lock_init(lock) \ | 102 | # define raw_spin_lock_init(lock) \ |
| 105 | do { *(lock) = SPIN_LOCK_UNLOCKED; } while (0) | 103 | do { *(lock) = __RAW_SPIN_LOCK_UNLOCKED(lock); } while (0) |
| 106 | #endif | ||
| 107 | |||
| 108 | #ifdef CONFIG_DEBUG_SPINLOCK | ||
| 109 | extern void __rwlock_init(rwlock_t *lock, const char *name, | ||
| 110 | struct lock_class_key *key); | ||
| 111 | # define rwlock_init(lock) \ | ||
| 112 | do { \ | ||
| 113 | static struct lock_class_key __key; \ | ||
| 114 | \ | ||
| 115 | __rwlock_init((lock), #lock, &__key); \ | ||
| 116 | } while (0) | ||
| 117 | #else | ||
| 118 | # define rwlock_init(lock) \ | ||
| 119 | do { *(lock) = RW_LOCK_UNLOCKED; } while (0) | ||
| 120 | #endif | 104 | #endif |
| 121 | 105 | ||
| 122 | #define spin_is_locked(lock) __raw_spin_is_locked(&(lock)->raw_lock) | 106 | #define raw_spin_is_locked(lock) arch_spin_is_locked(&(lock)->raw_lock) |
| 123 | 107 | ||
| 124 | #ifdef CONFIG_GENERIC_LOCKBREAK | 108 | #ifdef CONFIG_GENERIC_LOCKBREAK |
| 125 | #define spin_is_contended(lock) ((lock)->break_lock) | 109 | #define raw_spin_is_contended(lock) ((lock)->break_lock) |
| 126 | #else | 110 | #else |
| 127 | 111 | ||
| 128 | #ifdef __raw_spin_is_contended | 112 | #ifdef arch_spin_is_contended |
| 129 | #define spin_is_contended(lock) __raw_spin_is_contended(&(lock)->raw_lock) | 113 | #define raw_spin_is_contended(lock) arch_spin_is_contended(&(lock)->raw_lock) |
| 130 | #else | 114 | #else |
| 131 | #define spin_is_contended(lock) (((void)(lock), 0)) | 115 | #define raw_spin_is_contended(lock) (((void)(lock), 0)) |
| 132 | #endif /*__raw_spin_is_contended*/ | 116 | #endif /*arch_spin_is_contended*/ |
| 133 | #endif | 117 | #endif |
| 134 | 118 | ||
| 135 | /* The lock does not imply full memory barrier. */ | 119 | /* The lock does not imply full memory barrier. */ |
| @@ -138,182 +122,263 @@ static inline void smp_mb__after_lock(void) { smp_mb(); } | |||
| 138 | #endif | 122 | #endif |
| 139 | 123 | ||
| 140 | /** | 124 | /** |
| 141 | * spin_unlock_wait - wait until the spinlock gets unlocked | 125 | * raw_spin_unlock_wait - wait until the spinlock gets unlocked |
| 142 | * @lock: the spinlock in question. | 126 | * @lock: the spinlock in question. |
| 143 | */ | 127 | */ |
| 144 | #define spin_unlock_wait(lock) __raw_spin_unlock_wait(&(lock)->raw_lock) | 128 | #define raw_spin_unlock_wait(lock) arch_spin_unlock_wait(&(lock)->raw_lock) |
| 145 | 129 | ||
| 146 | #ifdef CONFIG_DEBUG_SPINLOCK | 130 | #ifdef CONFIG_DEBUG_SPINLOCK |
| 147 | extern void _raw_spin_lock(spinlock_t *lock); | 131 | extern void do_raw_spin_lock(raw_spinlock_t *lock) __acquires(lock); |
| 148 | #define _raw_spin_lock_flags(lock, flags) _raw_spin_lock(lock) | 132 | #define do_raw_spin_lock_flags(lock, flags) do_raw_spin_lock(lock) |
| 149 | extern int _raw_spin_trylock(spinlock_t *lock); | 133 | extern int do_raw_spin_trylock(raw_spinlock_t *lock); |
| 150 | extern void _raw_spin_unlock(spinlock_t *lock); | 134 | extern void do_raw_spin_unlock(raw_spinlock_t *lock) __releases(lock); |
| 151 | extern void _raw_read_lock(rwlock_t *lock); | ||
| 152 | #define _raw_read_lock_flags(lock, flags) _raw_read_lock(lock) | ||
| 153 | extern int _raw_read_trylock(rwlock_t *lock); | ||
| 154 | extern void _raw_read_unlock(rwlock_t *lock); | ||
| 155 | extern void _raw_write_lock(rwlock_t *lock); | ||
| 156 | #define _raw_write_lock_flags(lock, flags) _raw_write_lock(lock) | ||
| 157 | extern int _raw_write_trylock(rwlock_t *lock); | ||
| 158 | extern void _raw_write_unlock(rwlock_t *lock); | ||
| 159 | #else | 135 | #else |
| 160 | # define _raw_spin_lock(lock) __raw_spin_lock(&(lock)->raw_lock) | 136 | static inline void do_raw_spin_lock(raw_spinlock_t *lock) __acquires(lock) |
| 161 | # define _raw_spin_lock_flags(lock, flags) \ | 137 | { |
| 162 | __raw_spin_lock_flags(&(lock)->raw_lock, *(flags)) | 138 | __acquire(lock); |
| 163 | # define _raw_spin_trylock(lock) __raw_spin_trylock(&(lock)->raw_lock) | 139 | arch_spin_lock(&lock->raw_lock); |
| 164 | # define _raw_spin_unlock(lock) __raw_spin_unlock(&(lock)->raw_lock) | 140 | } |
| 165 | # define _raw_read_lock(rwlock) __raw_read_lock(&(rwlock)->raw_lock) | 141 | |
| 166 | # define _raw_read_lock_flags(lock, flags) \ | 142 | static inline void |
| 167 | __raw_read_lock_flags(&(lock)->raw_lock, *(flags)) | 143 | do_raw_spin_lock_flags(raw_spinlock_t *lock, unsigned long *flags) __acquires(lock) |
| 168 | # define _raw_read_trylock(rwlock) __raw_read_trylock(&(rwlock)->raw_lock) | 144 | { |
| 169 | # define _raw_read_unlock(rwlock) __raw_read_unlock(&(rwlock)->raw_lock) | 145 | __acquire(lock); |
| 170 | # define _raw_write_lock(rwlock) __raw_write_lock(&(rwlock)->raw_lock) | 146 | arch_spin_lock_flags(&lock->raw_lock, *flags); |
| 171 | # define _raw_write_lock_flags(lock, flags) \ | 147 | } |
| 172 | __raw_write_lock_flags(&(lock)->raw_lock, *(flags)) | 148 | |
| 173 | # define _raw_write_trylock(rwlock) __raw_write_trylock(&(rwlock)->raw_lock) | 149 | static inline int do_raw_spin_trylock(raw_spinlock_t *lock) |
| 174 | # define _raw_write_unlock(rwlock) __raw_write_unlock(&(rwlock)->raw_lock) | 150 | { |
| 151 | return arch_spin_trylock(&(lock)->raw_lock); | ||
| 152 | } | ||
| 153 | |||
| 154 | static inline void do_raw_spin_unlock(raw_spinlock_t *lock) __releases(lock) | ||
| 155 | { | ||
| 156 | arch_spin_unlock(&lock->raw_lock); | ||
| 157 | __release(lock); | ||
| 158 | } | ||
| 175 | #endif | 159 | #endif |
| 176 | 160 | ||
| 177 | #define read_can_lock(rwlock) __raw_read_can_lock(&(rwlock)->raw_lock) | ||
| 178 | #define write_can_lock(rwlock) __raw_write_can_lock(&(rwlock)->raw_lock) | ||
| 179 | |||
| 180 | /* | 161 | /* |
| 181 | * Define the various spin_lock and rw_lock methods. Note we define these | 162 | * Define the various spin_lock methods. Note we define these |
| 182 | * regardless of whether CONFIG_SMP or CONFIG_PREEMPT are set. The various | 163 | * regardless of whether CONFIG_SMP or CONFIG_PREEMPT are set. The |
| 183 | * methods are defined as nops in the case they are not required. | 164 | * various methods are defined as nops in the case they are not |
| 165 | * required. | ||
| 184 | */ | 166 | */ |
| 185 | #define spin_trylock(lock) __cond_lock(lock, _spin_trylock(lock)) | 167 | #define raw_spin_trylock(lock) __cond_lock(lock, _raw_spin_trylock(lock)) |
| 186 | #define read_trylock(lock) __cond_lock(lock, _read_trylock(lock)) | ||
| 187 | #define write_trylock(lock) __cond_lock(lock, _write_trylock(lock)) | ||
| 188 | 168 | ||
| 189 | #define spin_lock(lock) _spin_lock(lock) | 169 | #define raw_spin_lock(lock) _raw_spin_lock(lock) |
| 190 | 170 | ||
| 191 | #ifdef CONFIG_DEBUG_LOCK_ALLOC | 171 | #ifdef CONFIG_DEBUG_LOCK_ALLOC |
| 192 | # define spin_lock_nested(lock, subclass) _spin_lock_nested(lock, subclass) | 172 | # define raw_spin_lock_nested(lock, subclass) \ |
| 193 | # define spin_lock_nest_lock(lock, nest_lock) \ | 173 | _raw_spin_lock_nested(lock, subclass) |
| 174 | |||
| 175 | # define raw_spin_lock_nest_lock(lock, nest_lock) \ | ||
| 194 | do { \ | 176 | do { \ |
| 195 | typecheck(struct lockdep_map *, &(nest_lock)->dep_map);\ | 177 | typecheck(struct lockdep_map *, &(nest_lock)->dep_map);\ |
| 196 | _spin_lock_nest_lock(lock, &(nest_lock)->dep_map); \ | 178 | _raw_spin_lock_nest_lock(lock, &(nest_lock)->dep_map); \ |
| 197 | } while (0) | 179 | } while (0) |
| 198 | #else | 180 | #else |
| 199 | # define spin_lock_nested(lock, subclass) _spin_lock(lock) | 181 | # define raw_spin_lock_nested(lock, subclass) _raw_spin_lock(lock) |
| 200 | # define spin_lock_nest_lock(lock, nest_lock) _spin_lock(lock) | 182 | # define raw_spin_lock_nest_lock(lock, nest_lock) _raw_spin_lock(lock) |
| 201 | #endif | 183 | #endif |
| 202 | 184 | ||
| 203 | #define write_lock(lock) _write_lock(lock) | ||
| 204 | #define read_lock(lock) _read_lock(lock) | ||
| 205 | |||
| 206 | #if defined(CONFIG_SMP) || defined(CONFIG_DEBUG_SPINLOCK) | 185 | #if defined(CONFIG_SMP) || defined(CONFIG_DEBUG_SPINLOCK) |
| 207 | 186 | ||
| 208 | #define spin_lock_irqsave(lock, flags) \ | 187 | #define raw_spin_lock_irqsave(lock, flags) \ |
| 209 | do { \ | 188 | do { \ |
| 210 | typecheck(unsigned long, flags); \ | 189 | typecheck(unsigned long, flags); \ |
| 211 | flags = _spin_lock_irqsave(lock); \ | 190 | flags = _raw_spin_lock_irqsave(lock); \ |
| 212 | } while (0) | ||
| 213 | #define read_lock_irqsave(lock, flags) \ | ||
| 214 | do { \ | ||
| 215 | typecheck(unsigned long, flags); \ | ||
| 216 | flags = _read_lock_irqsave(lock); \ | ||
| 217 | } while (0) | ||
| 218 | #define write_lock_irqsave(lock, flags) \ | ||
| 219 | do { \ | ||
| 220 | typecheck(unsigned long, flags); \ | ||
| 221 | flags = _write_lock_irqsave(lock); \ | ||
| 222 | } while (0) | 191 | } while (0) |
| 223 | 192 | ||
| 224 | #ifdef CONFIG_DEBUG_LOCK_ALLOC | 193 | #ifdef CONFIG_DEBUG_LOCK_ALLOC |
| 225 | #define spin_lock_irqsave_nested(lock, flags, subclass) \ | 194 | #define raw_spin_lock_irqsave_nested(lock, flags, subclass) \ |
| 226 | do { \ | 195 | do { \ |
| 227 | typecheck(unsigned long, flags); \ | 196 | typecheck(unsigned long, flags); \ |
| 228 | flags = _spin_lock_irqsave_nested(lock, subclass); \ | 197 | flags = _raw_spin_lock_irqsave_nested(lock, subclass); \ |
| 229 | } while (0) | 198 | } while (0) |
| 230 | #else | 199 | #else |
| 231 | #define spin_lock_irqsave_nested(lock, flags, subclass) \ | 200 | #define raw_spin_lock_irqsave_nested(lock, flags, subclass) \ |
| 232 | do { \ | 201 | do { \ |
| 233 | typecheck(unsigned long, flags); \ | 202 | typecheck(unsigned long, flags); \ |
| 234 | flags = _spin_lock_irqsave(lock); \ | 203 | flags = _raw_spin_lock_irqsave(lock); \ |
| 235 | } while (0) | 204 | } while (0) |
| 236 | #endif | 205 | #endif |
| 237 | 206 | ||
| 238 | #else | 207 | #else |
| 239 | 208 | ||
| 240 | #define spin_lock_irqsave(lock, flags) \ | 209 | #define raw_spin_lock_irqsave(lock, flags) \ |
| 241 | do { \ | ||
| 242 | typecheck(unsigned long, flags); \ | ||
| 243 | _spin_lock_irqsave(lock, flags); \ | ||
| 244 | } while (0) | ||
| 245 | #define read_lock_irqsave(lock, flags) \ | ||
| 246 | do { \ | 210 | do { \ |
| 247 | typecheck(unsigned long, flags); \ | 211 | typecheck(unsigned long, flags); \ |
| 248 | _read_lock_irqsave(lock, flags); \ | 212 | _raw_spin_lock_irqsave(lock, flags); \ |
| 249 | } while (0) | 213 | } while (0) |
| 250 | #define write_lock_irqsave(lock, flags) \ | 214 | |
| 251 | do { \ | 215 | #define raw_spin_lock_irqsave_nested(lock, flags, subclass) \ |
| 252 | typecheck(unsigned long, flags); \ | 216 | raw_spin_lock_irqsave(lock, flags) |
| 253 | _write_lock_irqsave(lock, flags); \ | ||
| 254 | } while (0) | ||
| 255 | #define spin_lock_irqsave_nested(lock, flags, subclass) \ | ||
| 256 | spin_lock_irqsave(lock, flags) | ||
| 257 | 217 | ||
| 258 | #endif | 218 | #endif |
| 259 | 219 | ||
| 260 | #define spin_lock_irq(lock) _spin_lock_irq(lock) | 220 | #define raw_spin_lock_irq(lock) _raw_spin_lock_irq(lock) |
| 261 | #define spin_lock_bh(lock) _spin_lock_bh(lock) | 221 | #define raw_spin_lock_bh(lock) _raw_spin_lock_bh(lock) |
| 262 | #define read_lock_irq(lock) _read_lock_irq(lock) | 222 | #define raw_spin_unlock(lock) _raw_spin_unlock(lock) |
| 263 | #define read_lock_bh(lock) _read_lock_bh(lock) | 223 | #define raw_spin_unlock_irq(lock) _raw_spin_unlock_irq(lock) |
| 264 | #define write_lock_irq(lock) _write_lock_irq(lock) | ||
| 265 | #define write_lock_bh(lock) _write_lock_bh(lock) | ||
| 266 | #define spin_unlock(lock) _spin_unlock(lock) | ||
| 267 | #define read_unlock(lock) _read_unlock(lock) | ||
| 268 | #define write_unlock(lock) _write_unlock(lock) | ||
| 269 | #define spin_unlock_irq(lock) _spin_unlock_irq(lock) | ||
| 270 | #define read_unlock_irq(lock) _read_unlock_irq(lock) | ||
| 271 | #define write_unlock_irq(lock) _write_unlock_irq(lock) | ||
| 272 | |||
| 273 | #define spin_unlock_irqrestore(lock, flags) \ | ||
| 274 | do { \ | ||
| 275 | typecheck(unsigned long, flags); \ | ||
| 276 | _spin_unlock_irqrestore(lock, flags); \ | ||
| 277 | } while (0) | ||
| 278 | #define spin_unlock_bh(lock) _spin_unlock_bh(lock) | ||
| 279 | 224 | ||
| 280 | #define read_unlock_irqrestore(lock, flags) \ | 225 | #define raw_spin_unlock_irqrestore(lock, flags) \ |
| 281 | do { \ | 226 | do { \ |
| 282 | typecheck(unsigned long, flags); \ | 227 | typecheck(unsigned long, flags); \ |
| 283 | _read_unlock_irqrestore(lock, flags); \ | 228 | _raw_spin_unlock_irqrestore(lock, flags); \ |
| 284 | } while (0) | 229 | } while (0) |
| 285 | #define read_unlock_bh(lock) _read_unlock_bh(lock) | 230 | #define raw_spin_unlock_bh(lock) _raw_spin_unlock_bh(lock) |
| 286 | 231 | ||
| 287 | #define write_unlock_irqrestore(lock, flags) \ | 232 | #define raw_spin_trylock_bh(lock) \ |
| 288 | do { \ | 233 | __cond_lock(lock, _raw_spin_trylock_bh(lock)) |
| 289 | typecheck(unsigned long, flags); \ | ||
| 290 | _write_unlock_irqrestore(lock, flags); \ | ||
| 291 | } while (0) | ||
| 292 | #define write_unlock_bh(lock) _write_unlock_bh(lock) | ||
| 293 | 234 | ||
| 294 | #define spin_trylock_bh(lock) __cond_lock(lock, _spin_trylock_bh(lock)) | 235 | #define raw_spin_trylock_irq(lock) \ |
| 295 | |||
| 296 | #define spin_trylock_irq(lock) \ | ||
| 297 | ({ \ | 236 | ({ \ |
| 298 | local_irq_disable(); \ | 237 | local_irq_disable(); \ |
| 299 | spin_trylock(lock) ? \ | 238 | raw_spin_trylock(lock) ? \ |
| 300 | 1 : ({ local_irq_enable(); 0; }); \ | 239 | 1 : ({ local_irq_enable(); 0; }); \ |
| 301 | }) | 240 | }) |
| 302 | 241 | ||
| 303 | #define spin_trylock_irqsave(lock, flags) \ | 242 | #define raw_spin_trylock_irqsave(lock, flags) \ |
| 304 | ({ \ | 243 | ({ \ |
| 305 | local_irq_save(flags); \ | 244 | local_irq_save(flags); \ |
| 306 | spin_trylock(lock) ? \ | 245 | raw_spin_trylock(lock) ? \ |
| 307 | 1 : ({ local_irq_restore(flags); 0; }); \ | 246 | 1 : ({ local_irq_restore(flags); 0; }); \ |
| 308 | }) | 247 | }) |
| 309 | 248 | ||
| 310 | #define write_trylock_irqsave(lock, flags) \ | 249 | /** |
| 311 | ({ \ | 250 | * raw_spin_can_lock - would raw_spin_trylock() succeed? |
| 312 | local_irq_save(flags); \ | 251 | * @lock: the spinlock in question. |
| 313 | write_trylock(lock) ? \ | 252 | */ |
| 314 | 1 : ({ local_irq_restore(flags); 0; }); \ | 253 | #define raw_spin_can_lock(lock) (!raw_spin_is_locked(lock)) |
| 254 | |||
| 255 | /* Include rwlock functions */ | ||
| 256 | #include <linux/rwlock.h> | ||
| 257 | |||
| 258 | /* | ||
| 259 | * Pull the _spin_*()/_read_*()/_write_*() functions/declarations: | ||
| 260 | */ | ||
| 261 | #if defined(CONFIG_SMP) || defined(CONFIG_DEBUG_SPINLOCK) | ||
| 262 | # include <linux/spinlock_api_smp.h> | ||
| 263 | #else | ||
| 264 | # include <linux/spinlock_api_up.h> | ||
| 265 | #endif | ||
| 266 | |||
| 267 | /* | ||
| 268 | * Map the spin_lock functions to the raw variants for PREEMPT_RT=n | ||
| 269 | */ | ||
| 270 | |||
| 271 | static inline raw_spinlock_t *spinlock_check(spinlock_t *lock) | ||
| 272 | { | ||
| 273 | return &lock->rlock; | ||
| 274 | } | ||
| 275 | |||
| 276 | #define spin_lock_init(_lock) \ | ||
| 277 | do { \ | ||
| 278 | spinlock_check(_lock); \ | ||
| 279 | raw_spin_lock_init(&(_lock)->rlock); \ | ||
| 280 | } while (0) | ||
| 281 | |||
| 282 | static inline void spin_lock(spinlock_t *lock) | ||
| 283 | { | ||
| 284 | raw_spin_lock(&lock->rlock); | ||
| 285 | } | ||
| 286 | |||
| 287 | static inline void spin_lock_bh(spinlock_t *lock) | ||
| 288 | { | ||
| 289 | raw_spin_lock_bh(&lock->rlock); | ||
| 290 | } | ||
| 291 | |||
| 292 | static inline int spin_trylock(spinlock_t *lock) | ||
| 293 | { | ||
| 294 | return raw_spin_trylock(&lock->rlock); | ||
| 295 | } | ||
| 296 | |||
| 297 | #define spin_lock_nested(lock, subclass) \ | ||
| 298 | do { \ | ||
| 299 | raw_spin_lock_nested(spinlock_check(lock), subclass); \ | ||
| 300 | } while (0) | ||
| 301 | |||
| 302 | #define spin_lock_nest_lock(lock, nest_lock) \ | ||
| 303 | do { \ | ||
| 304 | raw_spin_lock_nest_lock(spinlock_check(lock), nest_lock); \ | ||
| 305 | } while (0) | ||
| 306 | |||
| 307 | static inline void spin_lock_irq(spinlock_t *lock) | ||
| 308 | { | ||
| 309 | raw_spin_lock_irq(&lock->rlock); | ||
| 310 | } | ||
| 311 | |||
| 312 | #define spin_lock_irqsave(lock, flags) \ | ||
| 313 | do { \ | ||
| 314 | raw_spin_lock_irqsave(spinlock_check(lock), flags); \ | ||
| 315 | } while (0) | ||
| 316 | |||
| 317 | #define spin_lock_irqsave_nested(lock, flags, subclass) \ | ||
| 318 | do { \ | ||
| 319 | raw_spin_lock_irqsave_nested(spinlock_check(lock), flags, subclass); \ | ||
| 320 | } while (0) | ||
| 321 | |||
| 322 | static inline void spin_unlock(spinlock_t *lock) | ||
| 323 | { | ||
| 324 | raw_spin_unlock(&lock->rlock); | ||
| 325 | } | ||
| 326 | |||
| 327 | static inline void spin_unlock_bh(spinlock_t *lock) | ||
| 328 | { | ||
| 329 | raw_spin_unlock_bh(&lock->rlock); | ||
| 330 | } | ||
| 331 | |||
| 332 | static inline void spin_unlock_irq(spinlock_t *lock) | ||
| 333 | { | ||
| 334 | raw_spin_unlock_irq(&lock->rlock); | ||
| 335 | } | ||
| 336 | |||
| 337 | static inline void spin_unlock_irqrestore(spinlock_t *lock, unsigned long flags) | ||
| 338 | { | ||
| 339 | raw_spin_unlock_irqrestore(&lock->rlock, flags); | ||
| 340 | } | ||
| 341 | |||
| 342 | static inline int spin_trylock_bh(spinlock_t *lock) | ||
| 343 | { | ||
| 344 | return raw_spin_trylock_bh(&lock->rlock); | ||
| 345 | } | ||
| 346 | |||
| 347 | static inline int spin_trylock_irq(spinlock_t *lock) | ||
| 348 | { | ||
| 349 | return raw_spin_trylock_irq(&lock->rlock); | ||
| 350 | } | ||
| 351 | |||
| 352 | #define spin_trylock_irqsave(lock, flags) \ | ||
| 353 | ({ \ | ||
| 354 | raw_spin_trylock_irqsave(spinlock_check(lock), flags); \ | ||
| 315 | }) | 355 | }) |
| 316 | 356 | ||
| 357 | static inline void spin_unlock_wait(spinlock_t *lock) | ||
| 358 | { | ||
| 359 | raw_spin_unlock_wait(&lock->rlock); | ||
| 360 | } | ||
| 361 | |||
| 362 | static inline int spin_is_locked(spinlock_t *lock) | ||
| 363 | { | ||
| 364 | return raw_spin_is_locked(&lock->rlock); | ||
| 365 | } | ||
| 366 | |||
| 367 | static inline int spin_is_contended(spinlock_t *lock) | ||
| 368 | { | ||
| 369 | return raw_spin_is_contended(&lock->rlock); | ||
| 370 | } | ||
| 371 | |||
| 372 | static inline int spin_can_lock(spinlock_t *lock) | ||
| 373 | { | ||
| 374 | return raw_spin_can_lock(&lock->rlock); | ||
| 375 | } | ||
| 376 | |||
| 377 | static inline void assert_spin_locked(spinlock_t *lock) | ||
| 378 | { | ||
| 379 | assert_raw_spin_locked(&lock->rlock); | ||
| 380 | } | ||
| 381 | |||
| 317 | /* | 382 | /* |
| 318 | * Pull the atomic_t declaration: | 383 | * Pull the atomic_t declaration: |
| 319 | * (asm-mips/atomic.h needs above definitions) | 384 | * (asm-mips/atomic.h needs above definitions) |
| @@ -331,19 +396,4 @@ extern int _atomic_dec_and_lock(atomic_t *atomic, spinlock_t *lock); | |||
| 331 | #define atomic_dec_and_lock(atomic, lock) \ | 396 | #define atomic_dec_and_lock(atomic, lock) \ |
| 332 | __cond_lock(lock, _atomic_dec_and_lock(atomic, lock)) | 397 | __cond_lock(lock, _atomic_dec_and_lock(atomic, lock)) |
| 333 | 398 | ||
| 334 | /** | ||
| 335 | * spin_can_lock - would spin_trylock() succeed? | ||
| 336 | * @lock: the spinlock in question. | ||
| 337 | */ | ||
| 338 | #define spin_can_lock(lock) (!spin_is_locked(lock)) | ||
| 339 | |||
| 340 | /* | ||
| 341 | * Pull the _spin_*()/_read_*()/_write_*() functions/declarations: | ||
| 342 | */ | ||
| 343 | #if defined(CONFIG_SMP) || defined(CONFIG_DEBUG_SPINLOCK) | ||
| 344 | # include <linux/spinlock_api_smp.h> | ||
| 345 | #else | ||
| 346 | # include <linux/spinlock_api_up.h> | ||
| 347 | #endif | ||
| 348 | |||
| 349 | #endif /* __LINUX_SPINLOCK_H */ | 399 | #endif /* __LINUX_SPINLOCK_H */ |
diff --git a/include/linux/spinlock_api_smp.h b/include/linux/spinlock_api_smp.h index 7a7e18fc2415..e253ccd7a604 100644 --- a/include/linux/spinlock_api_smp.h +++ b/include/linux/spinlock_api_smp.h | |||
| @@ -17,184 +17,76 @@ | |||
| 17 | 17 | ||
| 18 | int in_lock_functions(unsigned long addr); | 18 | int in_lock_functions(unsigned long addr); |
| 19 | 19 | ||
| 20 | #define assert_spin_locked(x) BUG_ON(!spin_is_locked(x)) | 20 | #define assert_raw_spin_locked(x) BUG_ON(!raw_spin_is_locked(x)) |
| 21 | 21 | ||
| 22 | void __lockfunc _spin_lock(spinlock_t *lock) __acquires(lock); | 22 | void __lockfunc _raw_spin_lock(raw_spinlock_t *lock) __acquires(lock); |
| 23 | void __lockfunc _spin_lock_nested(spinlock_t *lock, int subclass) | 23 | void __lockfunc _raw_spin_lock_nested(raw_spinlock_t *lock, int subclass) |
| 24 | __acquires(lock); | 24 | __acquires(lock); |
| 25 | void __lockfunc _spin_lock_nest_lock(spinlock_t *lock, struct lockdep_map *map) | 25 | void __lockfunc |
| 26 | __acquires(lock); | 26 | _raw_spin_lock_nest_lock(raw_spinlock_t *lock, struct lockdep_map *map) |
| 27 | void __lockfunc _read_lock(rwlock_t *lock) __acquires(lock); | 27 | __acquires(lock); |
| 28 | void __lockfunc _write_lock(rwlock_t *lock) __acquires(lock); | 28 | void __lockfunc _raw_spin_lock_bh(raw_spinlock_t *lock) __acquires(lock); |
| 29 | void __lockfunc _spin_lock_bh(spinlock_t *lock) __acquires(lock); | 29 | void __lockfunc _raw_spin_lock_irq(raw_spinlock_t *lock) |
| 30 | void __lockfunc _read_lock_bh(rwlock_t *lock) __acquires(lock); | 30 | __acquires(lock); |
| 31 | void __lockfunc _write_lock_bh(rwlock_t *lock) __acquires(lock); | ||
| 32 | void __lockfunc _spin_lock_irq(spinlock_t *lock) __acquires(lock); | ||
| 33 | void __lockfunc _read_lock_irq(rwlock_t *lock) __acquires(lock); | ||
| 34 | void __lockfunc _write_lock_irq(rwlock_t *lock) __acquires(lock); | ||
| 35 | unsigned long __lockfunc _spin_lock_irqsave(spinlock_t *lock) | ||
| 36 | __acquires(lock); | ||
| 37 | unsigned long __lockfunc _spin_lock_irqsave_nested(spinlock_t *lock, int subclass) | ||
| 38 | __acquires(lock); | ||
| 39 | unsigned long __lockfunc _read_lock_irqsave(rwlock_t *lock) | ||
| 40 | __acquires(lock); | ||
| 41 | unsigned long __lockfunc _write_lock_irqsave(rwlock_t *lock) | ||
| 42 | __acquires(lock); | ||
| 43 | int __lockfunc _spin_trylock(spinlock_t *lock); | ||
| 44 | int __lockfunc _read_trylock(rwlock_t *lock); | ||
| 45 | int __lockfunc _write_trylock(rwlock_t *lock); | ||
| 46 | int __lockfunc _spin_trylock_bh(spinlock_t *lock); | ||
| 47 | void __lockfunc _spin_unlock(spinlock_t *lock) __releases(lock); | ||
| 48 | void __lockfunc _read_unlock(rwlock_t *lock) __releases(lock); | ||
| 49 | void __lockfunc _write_unlock(rwlock_t *lock) __releases(lock); | ||
| 50 | void __lockfunc _spin_unlock_bh(spinlock_t *lock) __releases(lock); | ||
| 51 | void __lockfunc _read_unlock_bh(rwlock_t *lock) __releases(lock); | ||
| 52 | void __lockfunc _write_unlock_bh(rwlock_t *lock) __releases(lock); | ||
| 53 | void __lockfunc _spin_unlock_irq(spinlock_t *lock) __releases(lock); | ||
| 54 | void __lockfunc _read_unlock_irq(rwlock_t *lock) __releases(lock); | ||
| 55 | void __lockfunc _write_unlock_irq(rwlock_t *lock) __releases(lock); | ||
| 56 | void __lockfunc _spin_unlock_irqrestore(spinlock_t *lock, unsigned long flags) | ||
| 57 | __releases(lock); | ||
| 58 | void __lockfunc _read_unlock_irqrestore(rwlock_t *lock, unsigned long flags) | ||
| 59 | __releases(lock); | ||
| 60 | void __lockfunc _write_unlock_irqrestore(rwlock_t *lock, unsigned long flags) | ||
| 61 | __releases(lock); | ||
| 62 | 31 | ||
| 63 | /* | 32 | unsigned long __lockfunc _raw_spin_lock_irqsave(raw_spinlock_t *lock) |
| 64 | * We inline the unlock functions in the nondebug case: | 33 | __acquires(lock); |
| 65 | */ | 34 | unsigned long __lockfunc |
| 66 | #if !defined(CONFIG_DEBUG_SPINLOCK) && !defined(CONFIG_PREEMPT) | 35 | _raw_spin_lock_irqsave_nested(raw_spinlock_t *lock, int subclass) |
| 67 | #define __always_inline__spin_unlock | 36 | __acquires(lock); |
| 68 | #define __always_inline__read_unlock | 37 | int __lockfunc _raw_spin_trylock(raw_spinlock_t *lock); |
| 69 | #define __always_inline__write_unlock | 38 | int __lockfunc _raw_spin_trylock_bh(raw_spinlock_t *lock); |
| 70 | #define __always_inline__spin_unlock_irq | 39 | void __lockfunc _raw_spin_unlock(raw_spinlock_t *lock) __releases(lock); |
| 71 | #define __always_inline__read_unlock_irq | 40 | void __lockfunc _raw_spin_unlock_bh(raw_spinlock_t *lock) __releases(lock); |
| 72 | #define __always_inline__write_unlock_irq | 41 | void __lockfunc _raw_spin_unlock_irq(raw_spinlock_t *lock) __releases(lock); |
| 73 | #endif | 42 | void __lockfunc |
| 74 | 43 | _raw_spin_unlock_irqrestore(raw_spinlock_t *lock, unsigned long flags) | |
| 75 | #ifndef CONFIG_DEBUG_SPINLOCK | 44 | __releases(lock); |
| 76 | #ifndef CONFIG_GENERIC_LOCKBREAK | ||
| 77 | |||
| 78 | #ifdef __always_inline__spin_lock | ||
| 79 | #define _spin_lock(lock) __spin_lock(lock) | ||
| 80 | #endif | ||
| 81 | |||
| 82 | #ifdef __always_inline__read_lock | ||
| 83 | #define _read_lock(lock) __read_lock(lock) | ||
| 84 | #endif | ||
| 85 | |||
| 86 | #ifdef __always_inline__write_lock | ||
| 87 | #define _write_lock(lock) __write_lock(lock) | ||
| 88 | #endif | ||
| 89 | |||
| 90 | #ifdef __always_inline__spin_lock_bh | ||
| 91 | #define _spin_lock_bh(lock) __spin_lock_bh(lock) | ||
| 92 | #endif | ||
| 93 | |||
| 94 | #ifdef __always_inline__read_lock_bh | ||
| 95 | #define _read_lock_bh(lock) __read_lock_bh(lock) | ||
| 96 | #endif | ||
| 97 | |||
| 98 | #ifdef __always_inline__write_lock_bh | ||
| 99 | #define _write_lock_bh(lock) __write_lock_bh(lock) | ||
| 100 | #endif | ||
| 101 | |||
| 102 | #ifdef __always_inline__spin_lock_irq | ||
| 103 | #define _spin_lock_irq(lock) __spin_lock_irq(lock) | ||
| 104 | #endif | ||
| 105 | 45 | ||
| 106 | #ifdef __always_inline__read_lock_irq | 46 | #ifdef CONFIG_INLINE_SPIN_LOCK |
| 107 | #define _read_lock_irq(lock) __read_lock_irq(lock) | 47 | #define _raw_spin_lock(lock) __raw_spin_lock(lock) |
| 108 | #endif | 48 | #endif |
| 109 | 49 | ||
| 110 | #ifdef __always_inline__write_lock_irq | 50 | #ifdef CONFIG_INLINE_SPIN_LOCK_BH |
| 111 | #define _write_lock_irq(lock) __write_lock_irq(lock) | 51 | #define _raw_spin_lock_bh(lock) __raw_spin_lock_bh(lock) |
| 112 | #endif | 52 | #endif |
| 113 | 53 | ||
| 114 | #ifdef __always_inline__spin_lock_irqsave | 54 | #ifdef CONFIG_INLINE_SPIN_LOCK_IRQ |
| 115 | #define _spin_lock_irqsave(lock) __spin_lock_irqsave(lock) | 55 | #define _raw_spin_lock_irq(lock) __raw_spin_lock_irq(lock) |
| 116 | #endif | 56 | #endif |
| 117 | 57 | ||
| 118 | #ifdef __always_inline__read_lock_irqsave | 58 | #ifdef CONFIG_INLINE_SPIN_LOCK_IRQSAVE |
| 119 | #define _read_lock_irqsave(lock) __read_lock_irqsave(lock) | 59 | #define _raw_spin_lock_irqsave(lock) __raw_spin_lock_irqsave(lock) |
| 120 | #endif | 60 | #endif |
| 121 | 61 | ||
| 122 | #ifdef __always_inline__write_lock_irqsave | 62 | #ifdef CONFIG_INLINE_SPIN_TRYLOCK |
| 123 | #define _write_lock_irqsave(lock) __write_lock_irqsave(lock) | 63 | #define _raw_spin_trylock(lock) __raw_spin_trylock(lock) |
| 124 | #endif | 64 | #endif |
| 125 | 65 | ||
| 126 | #endif /* !CONFIG_GENERIC_LOCKBREAK */ | 66 | #ifdef CONFIG_INLINE_SPIN_TRYLOCK_BH |
| 127 | 67 | #define _raw_spin_trylock_bh(lock) __raw_spin_trylock_bh(lock) | |
| 128 | #ifdef __always_inline__spin_trylock | ||
| 129 | #define _spin_trylock(lock) __spin_trylock(lock) | ||
| 130 | #endif | ||
| 131 | |||
| 132 | #ifdef __always_inline__read_trylock | ||
| 133 | #define _read_trylock(lock) __read_trylock(lock) | ||
| 134 | #endif | ||
| 135 | |||
| 136 | #ifdef __always_inline__write_trylock | ||
| 137 | #define _write_trylock(lock) __write_trylock(lock) | ||
| 138 | #endif | ||
| 139 | |||
| 140 | #ifdef __always_inline__spin_trylock_bh | ||
| 141 | #define _spin_trylock_bh(lock) __spin_trylock_bh(lock) | ||
| 142 | #endif | ||
| 143 | |||
| 144 | #ifdef __always_inline__spin_unlock | ||
| 145 | #define _spin_unlock(lock) __spin_unlock(lock) | ||
| 146 | #endif | 68 | #endif |
| 147 | 69 | ||
| 148 | #ifdef __always_inline__read_unlock | 70 | #ifdef CONFIG_INLINE_SPIN_UNLOCK |
| 149 | #define _read_unlock(lock) __read_unlock(lock) | 71 | #define _raw_spin_unlock(lock) __raw_spin_unlock(lock) |
| 150 | #endif | 72 | #endif |
| 151 | 73 | ||
| 152 | #ifdef __always_inline__write_unlock | 74 | #ifdef CONFIG_INLINE_SPIN_UNLOCK_BH |
| 153 | #define _write_unlock(lock) __write_unlock(lock) | 75 | #define _raw_spin_unlock_bh(lock) __raw_spin_unlock_bh(lock) |
| 154 | #endif | 76 | #endif |
| 155 | 77 | ||
| 156 | #ifdef __always_inline__spin_unlock_bh | 78 | #ifdef CONFIG_INLINE_SPIN_UNLOCK_IRQ |
| 157 | #define _spin_unlock_bh(lock) __spin_unlock_bh(lock) | 79 | #define _raw_spin_unlock_irq(lock) __raw_spin_unlock_irq(lock) |
| 158 | #endif | 80 | #endif |
| 159 | 81 | ||
| 160 | #ifdef __always_inline__read_unlock_bh | 82 | #ifdef CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE |
| 161 | #define _read_unlock_bh(lock) __read_unlock_bh(lock) | 83 | #define _raw_spin_unlock_irqrestore(lock, flags) __raw_spin_unlock_irqrestore(lock, flags) |
| 162 | #endif | 84 | #endif |
| 163 | 85 | ||
| 164 | #ifdef __always_inline__write_unlock_bh | 86 | static inline int __raw_spin_trylock(raw_spinlock_t *lock) |
| 165 | #define _write_unlock_bh(lock) __write_unlock_bh(lock) | ||
| 166 | #endif | ||
| 167 | |||
| 168 | #ifdef __always_inline__spin_unlock_irq | ||
| 169 | #define _spin_unlock_irq(lock) __spin_unlock_irq(lock) | ||
| 170 | #endif | ||
| 171 | |||
| 172 | #ifdef __always_inline__read_unlock_irq | ||
| 173 | #define _read_unlock_irq(lock) __read_unlock_irq(lock) | ||
| 174 | #endif | ||
| 175 | |||
| 176 | #ifdef __always_inline__write_unlock_irq | ||
| 177 | #define _write_unlock_irq(lock) __write_unlock_irq(lock) | ||
| 178 | #endif | ||
| 179 | |||
| 180 | #ifdef __always_inline__spin_unlock_irqrestore | ||
| 181 | #define _spin_unlock_irqrestore(lock, flags) __spin_unlock_irqrestore(lock, flags) | ||
| 182 | #endif | ||
| 183 | |||
| 184 | #ifdef __always_inline__read_unlock_irqrestore | ||
| 185 | #define _read_unlock_irqrestore(lock, flags) __read_unlock_irqrestore(lock, flags) | ||
| 186 | #endif | ||
| 187 | |||
| 188 | #ifdef __always_inline__write_unlock_irqrestore | ||
| 189 | #define _write_unlock_irqrestore(lock, flags) __write_unlock_irqrestore(lock, flags) | ||
| 190 | #endif | ||
| 191 | |||
| 192 | #endif /* CONFIG_DEBUG_SPINLOCK */ | ||
| 193 | |||
| 194 | static inline int __spin_trylock(spinlock_t *lock) | ||
| 195 | { | 87 | { |
| 196 | preempt_disable(); | 88 | preempt_disable(); |
| 197 | if (_raw_spin_trylock(lock)) { | 89 | if (do_raw_spin_trylock(lock)) { |
| 198 | spin_acquire(&lock->dep_map, 0, 1, _RET_IP_); | 90 | spin_acquire(&lock->dep_map, 0, 1, _RET_IP_); |
| 199 | return 1; | 91 | return 1; |
| 200 | } | 92 | } |
| @@ -202,28 +94,6 @@ static inline int __spin_trylock(spinlock_t *lock) | |||
| 202 | return 0; | 94 | return 0; |
| 203 | } | 95 | } |
| 204 | 96 | ||
| 205 | static inline int __read_trylock(rwlock_t *lock) | ||
| 206 | { | ||
| 207 | preempt_disable(); | ||
| 208 | if (_raw_read_trylock(lock)) { | ||
| 209 | rwlock_acquire_read(&lock->dep_map, 0, 1, _RET_IP_); | ||
| 210 | return 1; | ||
| 211 | } | ||
| 212 | preempt_enable(); | ||
| 213 | return 0; | ||
| 214 | } | ||
| 215 | |||
| 216 | static inline int __write_trylock(rwlock_t *lock) | ||
| 217 | { | ||
| 218 | preempt_disable(); | ||
| 219 | if (_raw_write_trylock(lock)) { | ||
| 220 | rwlock_acquire(&lock->dep_map, 0, 1, _RET_IP_); | ||
| 221 | return 1; | ||
| 222 | } | ||
| 223 | preempt_enable(); | ||
| 224 | return 0; | ||
| 225 | } | ||
| 226 | |||
| 227 | /* | 97 | /* |
| 228 | * If lockdep is enabled then we use the non-preemption spin-ops | 98 | * If lockdep is enabled then we use the non-preemption spin-ops |
| 229 | * even on CONFIG_PREEMPT, because lockdep assumes that interrupts are | 99 | * even on CONFIG_PREEMPT, because lockdep assumes that interrupts are |
| @@ -231,14 +101,7 @@ static inline int __write_trylock(rwlock_t *lock) | |||
| 231 | */ | 101 | */ |
| 232 | #if !defined(CONFIG_GENERIC_LOCKBREAK) || defined(CONFIG_DEBUG_LOCK_ALLOC) | 102 | #if !defined(CONFIG_GENERIC_LOCKBREAK) || defined(CONFIG_DEBUG_LOCK_ALLOC) |
| 233 | 103 | ||
| 234 | static inline void __read_lock(rwlock_t *lock) | 104 | static inline unsigned long __raw_spin_lock_irqsave(raw_spinlock_t *lock) |
| 235 | { | ||
| 236 | preempt_disable(); | ||
| 237 | rwlock_acquire_read(&lock->dep_map, 0, 0, _RET_IP_); | ||
| 238 | LOCK_CONTENDED(lock, _raw_read_trylock, _raw_read_lock); | ||
| 239 | } | ||
| 240 | |||
| 241 | static inline unsigned long __spin_lock_irqsave(spinlock_t *lock) | ||
| 242 | { | 105 | { |
| 243 | unsigned long flags; | 106 | unsigned long flags; |
| 244 | 107 | ||
| @@ -247,205 +110,79 @@ static inline unsigned long __spin_lock_irqsave(spinlock_t *lock) | |||
| 247 | spin_acquire(&lock->dep_map, 0, 0, _RET_IP_); | 110 | spin_acquire(&lock->dep_map, 0, 0, _RET_IP_); |
| 248 | /* | 111 | /* |
| 249 | * On lockdep we dont want the hand-coded irq-enable of | 112 | * On lockdep we dont want the hand-coded irq-enable of |
| 250 | * _raw_spin_lock_flags() code, because lockdep assumes | 113 | * do_raw_spin_lock_flags() code, because lockdep assumes |
| 251 | * that interrupts are not re-enabled during lock-acquire: | 114 | * that interrupts are not re-enabled during lock-acquire: |
| 252 | */ | 115 | */ |
| 253 | #ifdef CONFIG_LOCKDEP | 116 | #ifdef CONFIG_LOCKDEP |
| 254 | LOCK_CONTENDED(lock, _raw_spin_trylock, _raw_spin_lock); | 117 | LOCK_CONTENDED(lock, do_raw_spin_trylock, do_raw_spin_lock); |
| 255 | #else | 118 | #else |
| 256 | _raw_spin_lock_flags(lock, &flags); | 119 | do_raw_spin_lock_flags(lock, &flags); |
| 257 | #endif | 120 | #endif |
| 258 | return flags; | 121 | return flags; |
| 259 | } | 122 | } |
| 260 | 123 | ||
| 261 | static inline void __spin_lock_irq(spinlock_t *lock) | 124 | static inline void __raw_spin_lock_irq(raw_spinlock_t *lock) |
| 262 | { | 125 | { |
| 263 | local_irq_disable(); | 126 | local_irq_disable(); |
| 264 | preempt_disable(); | 127 | preempt_disable(); |
| 265 | spin_acquire(&lock->dep_map, 0, 0, _RET_IP_); | 128 | spin_acquire(&lock->dep_map, 0, 0, _RET_IP_); |
| 266 | LOCK_CONTENDED(lock, _raw_spin_trylock, _raw_spin_lock); | 129 | LOCK_CONTENDED(lock, do_raw_spin_trylock, do_raw_spin_lock); |
| 267 | } | 130 | } |
| 268 | 131 | ||
| 269 | static inline void __spin_lock_bh(spinlock_t *lock) | 132 | static inline void __raw_spin_lock_bh(raw_spinlock_t *lock) |
| 270 | { | 133 | { |
| 271 | local_bh_disable(); | 134 | local_bh_disable(); |
| 272 | preempt_disable(); | 135 | preempt_disable(); |
| 273 | spin_acquire(&lock->dep_map, 0, 0, _RET_IP_); | 136 | spin_acquire(&lock->dep_map, 0, 0, _RET_IP_); |
| 274 | LOCK_CONTENDED(lock, _raw_spin_trylock, _raw_spin_lock); | 137 | LOCK_CONTENDED(lock, do_raw_spin_trylock, do_raw_spin_lock); |
| 275 | } | 138 | } |
| 276 | 139 | ||
| 277 | static inline unsigned long __read_lock_irqsave(rwlock_t *lock) | 140 | static inline void __raw_spin_lock(raw_spinlock_t *lock) |
| 278 | { | ||
| 279 | unsigned long flags; | ||
| 280 | |||
| 281 | local_irq_save(flags); | ||
| 282 | preempt_disable(); | ||
| 283 | rwlock_acquire_read(&lock->dep_map, 0, 0, _RET_IP_); | ||
| 284 | LOCK_CONTENDED_FLAGS(lock, _raw_read_trylock, _raw_read_lock, | ||
| 285 | _raw_read_lock_flags, &flags); | ||
| 286 | return flags; | ||
| 287 | } | ||
| 288 | |||
| 289 | static inline void __read_lock_irq(rwlock_t *lock) | ||
| 290 | { | ||
| 291 | local_irq_disable(); | ||
| 292 | preempt_disable(); | ||
| 293 | rwlock_acquire_read(&lock->dep_map, 0, 0, _RET_IP_); | ||
| 294 | LOCK_CONTENDED(lock, _raw_read_trylock, _raw_read_lock); | ||
| 295 | } | ||
| 296 | |||
| 297 | static inline void __read_lock_bh(rwlock_t *lock) | ||
| 298 | { | ||
| 299 | local_bh_disable(); | ||
| 300 | preempt_disable(); | ||
| 301 | rwlock_acquire_read(&lock->dep_map, 0, 0, _RET_IP_); | ||
| 302 | LOCK_CONTENDED(lock, _raw_read_trylock, _raw_read_lock); | ||
| 303 | } | ||
| 304 | |||
| 305 | static inline unsigned long __write_lock_irqsave(rwlock_t *lock) | ||
| 306 | { | ||
| 307 | unsigned long flags; | ||
| 308 | |||
| 309 | local_irq_save(flags); | ||
| 310 | preempt_disable(); | ||
| 311 | rwlock_acquire(&lock->dep_map, 0, 0, _RET_IP_); | ||
| 312 | LOCK_CONTENDED_FLAGS(lock, _raw_write_trylock, _raw_write_lock, | ||
| 313 | _raw_write_lock_flags, &flags); | ||
| 314 | return flags; | ||
| 315 | } | ||
| 316 | |||
| 317 | static inline void __write_lock_irq(rwlock_t *lock) | ||
| 318 | { | ||
| 319 | local_irq_disable(); | ||
| 320 | preempt_disable(); | ||
| 321 | rwlock_acquire(&lock->dep_map, 0, 0, _RET_IP_); | ||
| 322 | LOCK_CONTENDED(lock, _raw_write_trylock, _raw_write_lock); | ||
| 323 | } | ||
| 324 | |||
| 325 | static inline void __write_lock_bh(rwlock_t *lock) | ||
| 326 | { | ||
| 327 | local_bh_disable(); | ||
| 328 | preempt_disable(); | ||
| 329 | rwlock_acquire(&lock->dep_map, 0, 0, _RET_IP_); | ||
| 330 | LOCK_CONTENDED(lock, _raw_write_trylock, _raw_write_lock); | ||
| 331 | } | ||
| 332 | |||
| 333 | static inline void __spin_lock(spinlock_t *lock) | ||
| 334 | { | 141 | { |
| 335 | preempt_disable(); | 142 | preempt_disable(); |
| 336 | spin_acquire(&lock->dep_map, 0, 0, _RET_IP_); | 143 | spin_acquire(&lock->dep_map, 0, 0, _RET_IP_); |
| 337 | LOCK_CONTENDED(lock, _raw_spin_trylock, _raw_spin_lock); | 144 | LOCK_CONTENDED(lock, do_raw_spin_trylock, do_raw_spin_lock); |
| 338 | } | ||
| 339 | |||
| 340 | static inline void __write_lock(rwlock_t *lock) | ||
| 341 | { | ||
| 342 | preempt_disable(); | ||
| 343 | rwlock_acquire(&lock->dep_map, 0, 0, _RET_IP_); | ||
| 344 | LOCK_CONTENDED(lock, _raw_write_trylock, _raw_write_lock); | ||
| 345 | } | 145 | } |
| 346 | 146 | ||
| 347 | #endif /* CONFIG_PREEMPT */ | 147 | #endif /* CONFIG_PREEMPT */ |
| 348 | 148 | ||
| 349 | static inline void __spin_unlock(spinlock_t *lock) | 149 | static inline void __raw_spin_unlock(raw_spinlock_t *lock) |
| 350 | { | 150 | { |
| 351 | spin_release(&lock->dep_map, 1, _RET_IP_); | 151 | spin_release(&lock->dep_map, 1, _RET_IP_); |
| 352 | _raw_spin_unlock(lock); | 152 | do_raw_spin_unlock(lock); |
| 353 | preempt_enable(); | ||
| 354 | } | ||
| 355 | |||
| 356 | static inline void __write_unlock(rwlock_t *lock) | ||
| 357 | { | ||
| 358 | rwlock_release(&lock->dep_map, 1, _RET_IP_); | ||
| 359 | _raw_write_unlock(lock); | ||
| 360 | preempt_enable(); | 153 | preempt_enable(); |
| 361 | } | 154 | } |
| 362 | 155 | ||
| 363 | static inline void __read_unlock(rwlock_t *lock) | 156 | static inline void __raw_spin_unlock_irqrestore(raw_spinlock_t *lock, |
| 364 | { | ||
| 365 | rwlock_release(&lock->dep_map, 1, _RET_IP_); | ||
| 366 | _raw_read_unlock(lock); | ||
| 367 | preempt_enable(); | ||
| 368 | } | ||
| 369 | |||
| 370 | static inline void __spin_unlock_irqrestore(spinlock_t *lock, | ||
| 371 | unsigned long flags) | 157 | unsigned long flags) |
| 372 | { | 158 | { |
| 373 | spin_release(&lock->dep_map, 1, _RET_IP_); | 159 | spin_release(&lock->dep_map, 1, _RET_IP_); |
| 374 | _raw_spin_unlock(lock); | 160 | do_raw_spin_unlock(lock); |
| 375 | local_irq_restore(flags); | 161 | local_irq_restore(flags); |
| 376 | preempt_enable(); | 162 | preempt_enable(); |
| 377 | } | 163 | } |
| 378 | 164 | ||
| 379 | static inline void __spin_unlock_irq(spinlock_t *lock) | 165 | static inline void __raw_spin_unlock_irq(raw_spinlock_t *lock) |
| 380 | { | 166 | { |
| 381 | spin_release(&lock->dep_map, 1, _RET_IP_); | 167 | spin_release(&lock->dep_map, 1, _RET_IP_); |
| 382 | _raw_spin_unlock(lock); | 168 | do_raw_spin_unlock(lock); |
| 383 | local_irq_enable(); | 169 | local_irq_enable(); |
| 384 | preempt_enable(); | 170 | preempt_enable(); |
| 385 | } | 171 | } |
| 386 | 172 | ||
| 387 | static inline void __spin_unlock_bh(spinlock_t *lock) | 173 | static inline void __raw_spin_unlock_bh(raw_spinlock_t *lock) |
| 388 | { | 174 | { |
| 389 | spin_release(&lock->dep_map, 1, _RET_IP_); | 175 | spin_release(&lock->dep_map, 1, _RET_IP_); |
| 390 | _raw_spin_unlock(lock); | 176 | do_raw_spin_unlock(lock); |
| 391 | preempt_enable_no_resched(); | 177 | preempt_enable_no_resched(); |
| 392 | local_bh_enable_ip((unsigned long)__builtin_return_address(0)); | 178 | local_bh_enable_ip((unsigned long)__builtin_return_address(0)); |
| 393 | } | 179 | } |
| 394 | 180 | ||
| 395 | static inline void __read_unlock_irqrestore(rwlock_t *lock, unsigned long flags) | 181 | static inline int __raw_spin_trylock_bh(raw_spinlock_t *lock) |
| 396 | { | ||
| 397 | rwlock_release(&lock->dep_map, 1, _RET_IP_); | ||
| 398 | _raw_read_unlock(lock); | ||
| 399 | local_irq_restore(flags); | ||
| 400 | preempt_enable(); | ||
| 401 | } | ||
| 402 | |||
| 403 | static inline void __read_unlock_irq(rwlock_t *lock) | ||
| 404 | { | ||
| 405 | rwlock_release(&lock->dep_map, 1, _RET_IP_); | ||
| 406 | _raw_read_unlock(lock); | ||
| 407 | local_irq_enable(); | ||
| 408 | preempt_enable(); | ||
| 409 | } | ||
| 410 | |||
| 411 | static inline void __read_unlock_bh(rwlock_t *lock) | ||
| 412 | { | ||
| 413 | rwlock_release(&lock->dep_map, 1, _RET_IP_); | ||
| 414 | _raw_read_unlock(lock); | ||
| 415 | preempt_enable_no_resched(); | ||
| 416 | local_bh_enable_ip((unsigned long)__builtin_return_address(0)); | ||
| 417 | } | ||
| 418 | |||
| 419 | static inline void __write_unlock_irqrestore(rwlock_t *lock, | ||
| 420 | unsigned long flags) | ||
| 421 | { | ||
| 422 | rwlock_release(&lock->dep_map, 1, _RET_IP_); | ||
| 423 | _raw_write_unlock(lock); | ||
| 424 | local_irq_restore(flags); | ||
| 425 | preempt_enable(); | ||
| 426 | } | ||
| 427 | |||
| 428 | static inline void __write_unlock_irq(rwlock_t *lock) | ||
| 429 | { | ||
| 430 | rwlock_release(&lock->dep_map, 1, _RET_IP_); | ||
| 431 | _raw_write_unlock(lock); | ||
| 432 | local_irq_enable(); | ||
| 433 | preempt_enable(); | ||
| 434 | } | ||
| 435 | |||
| 436 | static inline void __write_unlock_bh(rwlock_t *lock) | ||
| 437 | { | ||
| 438 | rwlock_release(&lock->dep_map, 1, _RET_IP_); | ||
| 439 | _raw_write_unlock(lock); | ||
| 440 | preempt_enable_no_resched(); | ||
| 441 | local_bh_enable_ip((unsigned long)__builtin_return_address(0)); | ||
| 442 | } | ||
| 443 | |||
| 444 | static inline int __spin_trylock_bh(spinlock_t *lock) | ||
| 445 | { | 182 | { |
| 446 | local_bh_disable(); | 183 | local_bh_disable(); |
| 447 | preempt_disable(); | 184 | preempt_disable(); |
| 448 | if (_raw_spin_trylock(lock)) { | 185 | if (do_raw_spin_trylock(lock)) { |
| 449 | spin_acquire(&lock->dep_map, 0, 1, _RET_IP_); | 186 | spin_acquire(&lock->dep_map, 0, 1, _RET_IP_); |
| 450 | return 1; | 187 | return 1; |
| 451 | } | 188 | } |
| @@ -454,4 +191,6 @@ static inline int __spin_trylock_bh(spinlock_t *lock) | |||
| 454 | return 0; | 191 | return 0; |
| 455 | } | 192 | } |
| 456 | 193 | ||
| 194 | #include <linux/rwlock_api_smp.h> | ||
| 195 | |||
| 457 | #endif /* __LINUX_SPINLOCK_API_SMP_H */ | 196 | #endif /* __LINUX_SPINLOCK_API_SMP_H */ |
diff --git a/include/linux/spinlock_api_up.h b/include/linux/spinlock_api_up.h index 04e1d3164576..af1f47229e70 100644 --- a/include/linux/spinlock_api_up.h +++ b/include/linux/spinlock_api_up.h | |||
| @@ -16,7 +16,7 @@ | |||
| 16 | 16 | ||
| 17 | #define in_lock_functions(ADDR) 0 | 17 | #define in_lock_functions(ADDR) 0 |
| 18 | 18 | ||
| 19 | #define assert_spin_locked(lock) do { (void)(lock); } while (0) | 19 | #define assert_raw_spin_locked(lock) do { (void)(lock); } while (0) |
| 20 | 20 | ||
| 21 | /* | 21 | /* |
| 22 | * In the UP-nondebug case there's no real locking going on, so the | 22 | * In the UP-nondebug case there's no real locking going on, so the |
| @@ -40,7 +40,8 @@ | |||
| 40 | do { preempt_enable(); __release(lock); (void)(lock); } while (0) | 40 | do { preempt_enable(); __release(lock); (void)(lock); } while (0) |
| 41 | 41 | ||
| 42 | #define __UNLOCK_BH(lock) \ | 42 | #define __UNLOCK_BH(lock) \ |
| 43 | do { preempt_enable_no_resched(); local_bh_enable(); __release(lock); (void)(lock); } while (0) | 43 | do { preempt_enable_no_resched(); local_bh_enable(); \ |
| 44 | __release(lock); (void)(lock); } while (0) | ||
| 44 | 45 | ||
| 45 | #define __UNLOCK_IRQ(lock) \ | 46 | #define __UNLOCK_IRQ(lock) \ |
| 46 | do { local_irq_enable(); __UNLOCK(lock); } while (0) | 47 | do { local_irq_enable(); __UNLOCK(lock); } while (0) |
| @@ -48,34 +49,37 @@ | |||
| 48 | #define __UNLOCK_IRQRESTORE(lock, flags) \ | 49 | #define __UNLOCK_IRQRESTORE(lock, flags) \ |
| 49 | do { local_irq_restore(flags); __UNLOCK(lock); } while (0) | 50 | do { local_irq_restore(flags); __UNLOCK(lock); } while (0) |
| 50 | 51 | ||
| 51 | #define _spin_lock(lock) __LOCK(lock) | 52 | #define _raw_spin_lock(lock) __LOCK(lock) |
| 52 | #define _spin_lock_nested(lock, subclass) __LOCK(lock) | 53 | #define _raw_spin_lock_nested(lock, subclass) __LOCK(lock) |
| 53 | #define _read_lock(lock) __LOCK(lock) | 54 | #define _raw_read_lock(lock) __LOCK(lock) |
| 54 | #define _write_lock(lock) __LOCK(lock) | 55 | #define _raw_write_lock(lock) __LOCK(lock) |
| 55 | #define _spin_lock_bh(lock) __LOCK_BH(lock) | 56 | #define _raw_spin_lock_bh(lock) __LOCK_BH(lock) |
| 56 | #define _read_lock_bh(lock) __LOCK_BH(lock) | 57 | #define _raw_read_lock_bh(lock) __LOCK_BH(lock) |
| 57 | #define _write_lock_bh(lock) __LOCK_BH(lock) | 58 | #define _raw_write_lock_bh(lock) __LOCK_BH(lock) |
| 58 | #define _spin_lock_irq(lock) __LOCK_IRQ(lock) | 59 | #define _raw_spin_lock_irq(lock) __LOCK_IRQ(lock) |
| 59 | #define _read_lock_irq(lock) __LOCK_IRQ(lock) | 60 | #define _raw_read_lock_irq(lock) __LOCK_IRQ(lock) |
| 60 | #define _write_lock_irq(lock) __LOCK_IRQ(lock) | 61 | #define _raw_write_lock_irq(lock) __LOCK_IRQ(lock) |
| 61 | #define _spin_lock_irqsave(lock, flags) __LOCK_IRQSAVE(lock, flags) | 62 | #define _raw_spin_lock_irqsave(lock, flags) __LOCK_IRQSAVE(lock, flags) |
| 62 | #define _read_lock_irqsave(lock, flags) __LOCK_IRQSAVE(lock, flags) | 63 | #define _raw_read_lock_irqsave(lock, flags) __LOCK_IRQSAVE(lock, flags) |
| 63 | #define _write_lock_irqsave(lock, flags) __LOCK_IRQSAVE(lock, flags) | 64 | #define _raw_write_lock_irqsave(lock, flags) __LOCK_IRQSAVE(lock, flags) |
| 64 | #define _spin_trylock(lock) ({ __LOCK(lock); 1; }) | 65 | #define _raw_spin_trylock(lock) ({ __LOCK(lock); 1; }) |
| 65 | #define _read_trylock(lock) ({ __LOCK(lock); 1; }) | 66 | #define _raw_read_trylock(lock) ({ __LOCK(lock); 1; }) |
| 66 | #define _write_trylock(lock) ({ __LOCK(lock); 1; }) | 67 | #define _raw_write_trylock(lock) ({ __LOCK(lock); 1; }) |
| 67 | #define _spin_trylock_bh(lock) ({ __LOCK_BH(lock); 1; }) | 68 | #define _raw_spin_trylock_bh(lock) ({ __LOCK_BH(lock); 1; }) |
| 68 | #define _spin_unlock(lock) __UNLOCK(lock) | 69 | #define _raw_spin_unlock(lock) __UNLOCK(lock) |
| 69 | #define _read_unlock(lock) __UNLOCK(lock) | 70 | #define _raw_read_unlock(lock) __UNLOCK(lock) |
| 70 | #define _write_unlock(lock) __UNLOCK(lock) | 71 | #define _raw_write_unlock(lock) __UNLOCK(lock) |
| 71 | #define _spin_unlock_bh(lock) __UNLOCK_BH(lock) | 72 | #define _raw_spin_unlock_bh(lock) __UNLOCK_BH(lock) |
| 72 | #define _write_unlock_bh(lock) __UNLOCK_BH(lock) | 73 | #define _raw_write_unlock_bh(lock) __UNLOCK_BH(lock) |
| 73 | #define _read_unlock_bh(lock) __UNLOCK_BH(lock) | 74 | #define _raw_read_unlock_bh(lock) __UNLOCK_BH(lock) |
| 74 | #define _spin_unlock_irq(lock) __UNLOCK_IRQ(lock) | 75 | #define _raw_spin_unlock_irq(lock) __UNLOCK_IRQ(lock) |
| 75 | #define _read_unlock_irq(lock) __UNLOCK_IRQ(lock) | 76 | #define _raw_read_unlock_irq(lock) __UNLOCK_IRQ(lock) |
| 76 | #define _write_unlock_irq(lock) __UNLOCK_IRQ(lock) | 77 | #define _raw_write_unlock_irq(lock) __UNLOCK_IRQ(lock) |
| 77 | #define _spin_unlock_irqrestore(lock, flags) __UNLOCK_IRQRESTORE(lock, flags) | 78 | #define _raw_spin_unlock_irqrestore(lock, flags) \ |
| 78 | #define _read_unlock_irqrestore(lock, flags) __UNLOCK_IRQRESTORE(lock, flags) | 79 | __UNLOCK_IRQRESTORE(lock, flags) |
| 79 | #define _write_unlock_irqrestore(lock, flags) __UNLOCK_IRQRESTORE(lock, flags) | 80 | #define _raw_read_unlock_irqrestore(lock, flags) \ |
| 81 | __UNLOCK_IRQRESTORE(lock, flags) | ||
| 82 | #define _raw_write_unlock_irqrestore(lock, flags) \ | ||
| 83 | __UNLOCK_IRQRESTORE(lock, flags) | ||
| 80 | 84 | ||
| 81 | #endif /* __LINUX_SPINLOCK_API_UP_H */ | 85 | #endif /* __LINUX_SPINLOCK_API_UP_H */ |
diff --git a/include/linux/spinlock_types.h b/include/linux/spinlock_types.h index 68d88f71f1a2..851b7783720d 100644 --- a/include/linux/spinlock_types.h +++ b/include/linux/spinlock_types.h | |||
| @@ -17,8 +17,8 @@ | |||
| 17 | 17 | ||
| 18 | #include <linux/lockdep.h> | 18 | #include <linux/lockdep.h> |
| 19 | 19 | ||
| 20 | typedef struct { | 20 | typedef struct raw_spinlock { |
| 21 | raw_spinlock_t raw_lock; | 21 | arch_spinlock_t raw_lock; |
| 22 | #ifdef CONFIG_GENERIC_LOCKBREAK | 22 | #ifdef CONFIG_GENERIC_LOCKBREAK |
| 23 | unsigned int break_lock; | 23 | unsigned int break_lock; |
| 24 | #endif | 24 | #endif |
| @@ -29,26 +29,10 @@ typedef struct { | |||
| 29 | #ifdef CONFIG_DEBUG_LOCK_ALLOC | 29 | #ifdef CONFIG_DEBUG_LOCK_ALLOC |
| 30 | struct lockdep_map dep_map; | 30 | struct lockdep_map dep_map; |
| 31 | #endif | 31 | #endif |
| 32 | } spinlock_t; | 32 | } raw_spinlock_t; |
| 33 | 33 | ||
| 34 | #define SPINLOCK_MAGIC 0xdead4ead | 34 | #define SPINLOCK_MAGIC 0xdead4ead |
| 35 | 35 | ||
| 36 | typedef struct { | ||
| 37 | raw_rwlock_t raw_lock; | ||
| 38 | #ifdef CONFIG_GENERIC_LOCKBREAK | ||
| 39 | unsigned int break_lock; | ||
| 40 | #endif | ||
| 41 | #ifdef CONFIG_DEBUG_SPINLOCK | ||
| 42 | unsigned int magic, owner_cpu; | ||
| 43 | void *owner; | ||
| 44 | #endif | ||
| 45 | #ifdef CONFIG_DEBUG_LOCK_ALLOC | ||
| 46 | struct lockdep_map dep_map; | ||
| 47 | #endif | ||
| 48 | } rwlock_t; | ||
| 49 | |||
| 50 | #define RWLOCK_MAGIC 0xdeaf1eed | ||
| 51 | |||
| 52 | #define SPINLOCK_OWNER_INIT ((void *)-1L) | 36 | #define SPINLOCK_OWNER_INIT ((void *)-1L) |
| 53 | 37 | ||
| 54 | #ifdef CONFIG_DEBUG_LOCK_ALLOC | 38 | #ifdef CONFIG_DEBUG_LOCK_ALLOC |
| @@ -57,44 +41,56 @@ typedef struct { | |||
| 57 | # define SPIN_DEP_MAP_INIT(lockname) | 41 | # define SPIN_DEP_MAP_INIT(lockname) |
| 58 | #endif | 42 | #endif |
| 59 | 43 | ||
| 60 | #ifdef CONFIG_DEBUG_LOCK_ALLOC | 44 | #ifdef CONFIG_DEBUG_SPINLOCK |
| 61 | # define RW_DEP_MAP_INIT(lockname) .dep_map = { .name = #lockname } | 45 | # define SPIN_DEBUG_INIT(lockname) \ |
| 46 | .magic = SPINLOCK_MAGIC, \ | ||
| 47 | .owner_cpu = -1, \ | ||
| 48 | .owner = SPINLOCK_OWNER_INIT, | ||
| 62 | #else | 49 | #else |
| 63 | # define RW_DEP_MAP_INIT(lockname) | 50 | # define SPIN_DEBUG_INIT(lockname) |
| 64 | #endif | 51 | #endif |
| 65 | 52 | ||
| 66 | #ifdef CONFIG_DEBUG_SPINLOCK | 53 | #define __RAW_SPIN_LOCK_INITIALIZER(lockname) \ |
| 67 | # define __SPIN_LOCK_UNLOCKED(lockname) \ | 54 | { \ |
| 68 | (spinlock_t) { .raw_lock = __RAW_SPIN_LOCK_UNLOCKED, \ | 55 | .raw_lock = __ARCH_SPIN_LOCK_UNLOCKED, \ |
| 69 | .magic = SPINLOCK_MAGIC, \ | 56 | SPIN_DEBUG_INIT(lockname) \ |
| 70 | .owner = SPINLOCK_OWNER_INIT, \ | 57 | SPIN_DEP_MAP_INIT(lockname) } |
| 71 | .owner_cpu = -1, \ | 58 | |
| 72 | SPIN_DEP_MAP_INIT(lockname) } | 59 | #define __RAW_SPIN_LOCK_UNLOCKED(lockname) \ |
| 73 | #define __RW_LOCK_UNLOCKED(lockname) \ | 60 | (raw_spinlock_t) __RAW_SPIN_LOCK_INITIALIZER(lockname) |
| 74 | (rwlock_t) { .raw_lock = __RAW_RW_LOCK_UNLOCKED, \ | 61 | |
| 75 | .magic = RWLOCK_MAGIC, \ | 62 | #define DEFINE_RAW_SPINLOCK(x) raw_spinlock_t x = __RAW_SPIN_LOCK_UNLOCKED(x) |
| 76 | .owner = SPINLOCK_OWNER_INIT, \ | 63 | |
| 77 | .owner_cpu = -1, \ | 64 | typedef struct spinlock { |
| 78 | RW_DEP_MAP_INIT(lockname) } | 65 | union { |
| 79 | #else | 66 | struct raw_spinlock rlock; |
| 80 | # define __SPIN_LOCK_UNLOCKED(lockname) \ | 67 | |
| 81 | (spinlock_t) { .raw_lock = __RAW_SPIN_LOCK_UNLOCKED, \ | 68 | #ifdef CONFIG_DEBUG_LOCK_ALLOC |
| 82 | SPIN_DEP_MAP_INIT(lockname) } | 69 | # define LOCK_PADSIZE (offsetof(struct raw_spinlock, dep_map)) |
| 83 | #define __RW_LOCK_UNLOCKED(lockname) \ | 70 | struct { |
| 84 | (rwlock_t) { .raw_lock = __RAW_RW_LOCK_UNLOCKED, \ | 71 | u8 __padding[LOCK_PADSIZE]; |
| 85 | RW_DEP_MAP_INIT(lockname) } | 72 | struct lockdep_map dep_map; |
| 73 | }; | ||
| 86 | #endif | 74 | #endif |
| 75 | }; | ||
| 76 | } spinlock_t; | ||
| 77 | |||
| 78 | #define __SPIN_LOCK_INITIALIZER(lockname) \ | ||
| 79 | { { .rlock = __RAW_SPIN_LOCK_INITIALIZER(lockname) } } | ||
| 80 | |||
| 81 | #define __SPIN_LOCK_UNLOCKED(lockname) \ | ||
| 82 | (spinlock_t ) __SPIN_LOCK_INITIALIZER(lockname) | ||
| 87 | 83 | ||
| 88 | /* | 84 | /* |
| 89 | * SPIN_LOCK_UNLOCKED and RW_LOCK_UNLOCKED defeat lockdep state tracking and | 85 | * SPIN_LOCK_UNLOCKED defeats lockdep state tracking and is hence |
| 90 | * are hence deprecated. | 86 | * deprecated. |
| 91 | * Please use DEFINE_SPINLOCK()/DEFINE_RWLOCK() or | 87 | * Please use DEFINE_SPINLOCK() or __SPIN_LOCK_UNLOCKED() as |
| 92 | * __SPIN_LOCK_UNLOCKED()/__RW_LOCK_UNLOCKED() as appropriate. | 88 | * appropriate. |
| 93 | */ | 89 | */ |
| 94 | #define SPIN_LOCK_UNLOCKED __SPIN_LOCK_UNLOCKED(old_style_spin_init) | 90 | #define SPIN_LOCK_UNLOCKED __SPIN_LOCK_UNLOCKED(old_style_spin_init) |
| 95 | #define RW_LOCK_UNLOCKED __RW_LOCK_UNLOCKED(old_style_rw_init) | ||
| 96 | 91 | ||
| 97 | #define DEFINE_SPINLOCK(x) spinlock_t x = __SPIN_LOCK_UNLOCKED(x) | 92 | #define DEFINE_SPINLOCK(x) spinlock_t x = __SPIN_LOCK_UNLOCKED(x) |
| 98 | #define DEFINE_RWLOCK(x) rwlock_t x = __RW_LOCK_UNLOCKED(x) | 93 | |
| 94 | #include <linux/rwlock_types.h> | ||
| 99 | 95 | ||
| 100 | #endif /* __LINUX_SPINLOCK_TYPES_H */ | 96 | #endif /* __LINUX_SPINLOCK_TYPES_H */ |
diff --git a/include/linux/spinlock_types_up.h b/include/linux/spinlock_types_up.h index 04135b0e198e..c09b6407ae1b 100644 --- a/include/linux/spinlock_types_up.h +++ b/include/linux/spinlock_types_up.h | |||
| @@ -16,22 +16,22 @@ | |||
| 16 | 16 | ||
| 17 | typedef struct { | 17 | typedef struct { |
| 18 | volatile unsigned int slock; | 18 | volatile unsigned int slock; |
| 19 | } raw_spinlock_t; | 19 | } arch_spinlock_t; |
| 20 | 20 | ||
| 21 | #define __RAW_SPIN_LOCK_UNLOCKED { 1 } | 21 | #define __ARCH_SPIN_LOCK_UNLOCKED { 1 } |
| 22 | 22 | ||
| 23 | #else | 23 | #else |
| 24 | 24 | ||
| 25 | typedef struct { } raw_spinlock_t; | 25 | typedef struct { } arch_spinlock_t; |
| 26 | 26 | ||
| 27 | #define __RAW_SPIN_LOCK_UNLOCKED { } | 27 | #define __ARCH_SPIN_LOCK_UNLOCKED { } |
| 28 | 28 | ||
| 29 | #endif | 29 | #endif |
| 30 | 30 | ||
| 31 | typedef struct { | 31 | typedef struct { |
| 32 | /* no debug version on UP */ | 32 | /* no debug version on UP */ |
| 33 | } raw_rwlock_t; | 33 | } arch_rwlock_t; |
| 34 | 34 | ||
| 35 | #define __RAW_RW_LOCK_UNLOCKED { } | 35 | #define __ARCH_RW_LOCK_UNLOCKED { } |
| 36 | 36 | ||
| 37 | #endif /* __LINUX_SPINLOCK_TYPES_UP_H */ | 37 | #endif /* __LINUX_SPINLOCK_TYPES_UP_H */ |
diff --git a/include/linux/spinlock_up.h b/include/linux/spinlock_up.h index d4841ed8215b..b14f6a91e19f 100644 --- a/include/linux/spinlock_up.h +++ b/include/linux/spinlock_up.h | |||
| @@ -18,21 +18,21 @@ | |||
| 18 | */ | 18 | */ |
| 19 | 19 | ||
| 20 | #ifdef CONFIG_DEBUG_SPINLOCK | 20 | #ifdef CONFIG_DEBUG_SPINLOCK |
| 21 | #define __raw_spin_is_locked(x) ((x)->slock == 0) | 21 | #define arch_spin_is_locked(x) ((x)->slock == 0) |
| 22 | 22 | ||
| 23 | static inline void __raw_spin_lock(raw_spinlock_t *lock) | 23 | static inline void arch_spin_lock(arch_spinlock_t *lock) |
| 24 | { | 24 | { |
| 25 | lock->slock = 0; | 25 | lock->slock = 0; |
| 26 | } | 26 | } |
| 27 | 27 | ||
| 28 | static inline void | 28 | static inline void |
| 29 | __raw_spin_lock_flags(raw_spinlock_t *lock, unsigned long flags) | 29 | arch_spin_lock_flags(arch_spinlock_t *lock, unsigned long flags) |
| 30 | { | 30 | { |
| 31 | local_irq_save(flags); | 31 | local_irq_save(flags); |
| 32 | lock->slock = 0; | 32 | lock->slock = 0; |
| 33 | } | 33 | } |
| 34 | 34 | ||
| 35 | static inline int __raw_spin_trylock(raw_spinlock_t *lock) | 35 | static inline int arch_spin_trylock(arch_spinlock_t *lock) |
| 36 | { | 36 | { |
| 37 | char oldval = lock->slock; | 37 | char oldval = lock->slock; |
| 38 | 38 | ||
| @@ -41,7 +41,7 @@ static inline int __raw_spin_trylock(raw_spinlock_t *lock) | |||
| 41 | return oldval > 0; | 41 | return oldval > 0; |
| 42 | } | 42 | } |
| 43 | 43 | ||
| 44 | static inline void __raw_spin_unlock(raw_spinlock_t *lock) | 44 | static inline void arch_spin_unlock(arch_spinlock_t *lock) |
| 45 | { | 45 | { |
| 46 | lock->slock = 1; | 46 | lock->slock = 1; |
| 47 | } | 47 | } |
| @@ -49,28 +49,28 @@ static inline void __raw_spin_unlock(raw_spinlock_t *lock) | |||
| 49 | /* | 49 | /* |
| 50 | * Read-write spinlocks. No debug version. | 50 | * Read-write spinlocks. No debug version. |
| 51 | */ | 51 | */ |
| 52 | #define __raw_read_lock(lock) do { (void)(lock); } while (0) | 52 | #define arch_read_lock(lock) do { (void)(lock); } while (0) |
| 53 | #define __raw_write_lock(lock) do { (void)(lock); } while (0) | 53 | #define arch_write_lock(lock) do { (void)(lock); } while (0) |
| 54 | #define __raw_read_trylock(lock) ({ (void)(lock); 1; }) | 54 | #define arch_read_trylock(lock) ({ (void)(lock); 1; }) |
| 55 | #define __raw_write_trylock(lock) ({ (void)(lock); 1; }) | 55 | #define arch_write_trylock(lock) ({ (void)(lock); 1; }) |
| 56 | #define __raw_read_unlock(lock) do { (void)(lock); } while (0) | 56 | #define arch_read_unlock(lock) do { (void)(lock); } while (0) |
| 57 | #define __raw_write_unlock(lock) do { (void)(lock); } while (0) | 57 | #define arch_write_unlock(lock) do { (void)(lock); } while (0) |
| 58 | 58 | ||
| 59 | #else /* DEBUG_SPINLOCK */ | 59 | #else /* DEBUG_SPINLOCK */ |
| 60 | #define __raw_spin_is_locked(lock) ((void)(lock), 0) | 60 | #define arch_spin_is_locked(lock) ((void)(lock), 0) |
| 61 | /* for sched.c and kernel_lock.c: */ | 61 | /* for sched.c and kernel_lock.c: */ |
| 62 | # define __raw_spin_lock(lock) do { (void)(lock); } while (0) | 62 | # define arch_spin_lock(lock) do { (void)(lock); } while (0) |
| 63 | # define __raw_spin_lock_flags(lock, flags) do { (void)(lock); } while (0) | 63 | # define arch_spin_lock_flags(lock, flags) do { (void)(lock); } while (0) |
| 64 | # define __raw_spin_unlock(lock) do { (void)(lock); } while (0) | 64 | # define arch_spin_unlock(lock) do { (void)(lock); } while (0) |
| 65 | # define __raw_spin_trylock(lock) ({ (void)(lock); 1; }) | 65 | # define arch_spin_trylock(lock) ({ (void)(lock); 1; }) |
| 66 | #endif /* DEBUG_SPINLOCK */ | 66 | #endif /* DEBUG_SPINLOCK */ |
| 67 | 67 | ||
| 68 | #define __raw_spin_is_contended(lock) (((void)(lock), 0)) | 68 | #define arch_spin_is_contended(lock) (((void)(lock), 0)) |
| 69 | 69 | ||
| 70 | #define __raw_read_can_lock(lock) (((void)(lock), 1)) | 70 | #define arch_read_can_lock(lock) (((void)(lock), 1)) |
| 71 | #define __raw_write_can_lock(lock) (((void)(lock), 1)) | 71 | #define arch_write_can_lock(lock) (((void)(lock), 1)) |
| 72 | 72 | ||
| 73 | #define __raw_spin_unlock_wait(lock) \ | 73 | #define arch_spin_unlock_wait(lock) \ |
| 74 | do { cpu_relax(); } while (__raw_spin_is_locked(lock)) | 74 | do { cpu_relax(); } while (arch_spin_is_locked(lock)) |
| 75 | 75 | ||
| 76 | #endif /* __LINUX_SPINLOCK_UP_H */ | 76 | #endif /* __LINUX_SPINLOCK_UP_H */ |
diff --git a/include/linux/srcu.h b/include/linux/srcu.h index aca0eee53930..4d5ecb222af9 100644 --- a/include/linux/srcu.h +++ b/include/linux/srcu.h | |||
| @@ -33,8 +33,11 @@ struct srcu_struct_array { | |||
| 33 | 33 | ||
| 34 | struct srcu_struct { | 34 | struct srcu_struct { |
| 35 | int completed; | 35 | int completed; |
| 36 | struct srcu_struct_array *per_cpu_ref; | 36 | struct srcu_struct_array __percpu *per_cpu_ref; |
| 37 | struct mutex mutex; | 37 | struct mutex mutex; |
| 38 | #ifdef CONFIG_DEBUG_LOCK_ALLOC | ||
| 39 | struct lockdep_map dep_map; | ||
| 40 | #endif /* #ifdef CONFIG_DEBUG_LOCK_ALLOC */ | ||
| 38 | }; | 41 | }; |
| 39 | 42 | ||
| 40 | #ifndef CONFIG_PREEMPT | 43 | #ifndef CONFIG_PREEMPT |
| @@ -43,11 +46,100 @@ struct srcu_struct { | |||
| 43 | #define srcu_barrier() | 46 | #define srcu_barrier() |
| 44 | #endif /* #else #ifndef CONFIG_PREEMPT */ | 47 | #endif /* #else #ifndef CONFIG_PREEMPT */ |
| 45 | 48 | ||
| 49 | #ifdef CONFIG_DEBUG_LOCK_ALLOC | ||
| 50 | |||
| 51 | int __init_srcu_struct(struct srcu_struct *sp, const char *name, | ||
| 52 | struct lock_class_key *key); | ||
| 53 | |||
| 54 | #define init_srcu_struct(sp) \ | ||
| 55 | ({ \ | ||
| 56 | static struct lock_class_key __srcu_key; \ | ||
| 57 | \ | ||
| 58 | __init_srcu_struct((sp), #sp, &__srcu_key); \ | ||
| 59 | }) | ||
| 60 | |||
| 61 | # define srcu_read_acquire(sp) \ | ||
| 62 | lock_acquire(&(sp)->dep_map, 0, 0, 2, 1, NULL, _THIS_IP_) | ||
| 63 | # define srcu_read_release(sp) \ | ||
| 64 | lock_release(&(sp)->dep_map, 1, _THIS_IP_) | ||
| 65 | |||
| 66 | #else /* #ifdef CONFIG_DEBUG_LOCK_ALLOC */ | ||
| 67 | |||
| 46 | int init_srcu_struct(struct srcu_struct *sp); | 68 | int init_srcu_struct(struct srcu_struct *sp); |
| 69 | |||
| 70 | # define srcu_read_acquire(sp) do { } while (0) | ||
| 71 | # define srcu_read_release(sp) do { } while (0) | ||
| 72 | |||
| 73 | #endif /* #else #ifdef CONFIG_DEBUG_LOCK_ALLOC */ | ||
| 74 | |||
| 47 | void cleanup_srcu_struct(struct srcu_struct *sp); | 75 | void cleanup_srcu_struct(struct srcu_struct *sp); |
| 48 | int srcu_read_lock(struct srcu_struct *sp) __acquires(sp); | 76 | int __srcu_read_lock(struct srcu_struct *sp) __acquires(sp); |
| 49 | void srcu_read_unlock(struct srcu_struct *sp, int idx) __releases(sp); | 77 | void __srcu_read_unlock(struct srcu_struct *sp, int idx) __releases(sp); |
| 50 | void synchronize_srcu(struct srcu_struct *sp); | 78 | void synchronize_srcu(struct srcu_struct *sp); |
| 79 | void synchronize_srcu_expedited(struct srcu_struct *sp); | ||
| 51 | long srcu_batches_completed(struct srcu_struct *sp); | 80 | long srcu_batches_completed(struct srcu_struct *sp); |
| 52 | 81 | ||
| 82 | #ifdef CONFIG_DEBUG_LOCK_ALLOC | ||
| 83 | |||
| 84 | /** | ||
| 85 | * srcu_read_lock_held - might we be in SRCU read-side critical section? | ||
| 86 | * | ||
| 87 | * If CONFIG_PROVE_LOCKING is selected and enabled, returns nonzero iff in | ||
| 88 | * an SRCU read-side critical section. In absence of CONFIG_PROVE_LOCKING, | ||
| 89 | * this assumes we are in an SRCU read-side critical section unless it can | ||
| 90 | * prove otherwise. | ||
| 91 | */ | ||
| 92 | static inline int srcu_read_lock_held(struct srcu_struct *sp) | ||
| 93 | { | ||
| 94 | if (debug_locks) | ||
| 95 | return lock_is_held(&sp->dep_map); | ||
| 96 | return 1; | ||
| 97 | } | ||
| 98 | |||
| 99 | #else /* #ifdef CONFIG_DEBUG_LOCK_ALLOC */ | ||
| 100 | |||
| 101 | static inline int srcu_read_lock_held(struct srcu_struct *sp) | ||
| 102 | { | ||
| 103 | return 1; | ||
| 104 | } | ||
| 105 | |||
| 106 | #endif /* #else #ifdef CONFIG_DEBUG_LOCK_ALLOC */ | ||
| 107 | |||
| 108 | /** | ||
| 109 | * srcu_dereference - fetch SRCU-protected pointer with checking | ||
| 110 | * | ||
| 111 | * Makes rcu_dereference_check() do the dirty work. | ||
| 112 | */ | ||
| 113 | #define srcu_dereference(p, sp) \ | ||
| 114 | rcu_dereference_check(p, srcu_read_lock_held(sp)) | ||
| 115 | |||
| 116 | /** | ||
| 117 | * srcu_read_lock - register a new reader for an SRCU-protected structure. | ||
| 118 | * @sp: srcu_struct in which to register the new reader. | ||
| 119 | * | ||
| 120 | * Enter an SRCU read-side critical section. Note that SRCU read-side | ||
| 121 | * critical sections may be nested. | ||
| 122 | */ | ||
| 123 | static inline int srcu_read_lock(struct srcu_struct *sp) __acquires(sp) | ||
| 124 | { | ||
| 125 | int retval = __srcu_read_lock(sp); | ||
| 126 | |||
| 127 | srcu_read_acquire(sp); | ||
| 128 | return retval; | ||
| 129 | } | ||
| 130 | |||
| 131 | /** | ||
| 132 | * srcu_read_unlock - unregister a old reader from an SRCU-protected structure. | ||
| 133 | * @sp: srcu_struct in which to unregister the old reader. | ||
| 134 | * @idx: return value from corresponding srcu_read_lock(). | ||
| 135 | * | ||
| 136 | * Exit an SRCU read-side critical section. | ||
| 137 | */ | ||
| 138 | static inline void srcu_read_unlock(struct srcu_struct *sp, int idx) | ||
| 139 | __releases(sp) | ||
| 140 | { | ||
| 141 | srcu_read_release(sp); | ||
| 142 | __srcu_read_unlock(sp, idx); | ||
| 143 | } | ||
| 144 | |||
| 53 | #endif | 145 | #endif |
diff --git a/include/linux/ssb/ssb.h b/include/linux/ssb/ssb.h index 3d0a9ff24f01..24f988547361 100644 --- a/include/linux/ssb/ssb.h +++ b/include/linux/ssb/ssb.h | |||
| @@ -269,7 +269,8 @@ struct ssb_bus { | |||
| 269 | 269 | ||
| 270 | const struct ssb_bus_ops *ops; | 270 | const struct ssb_bus_ops *ops; |
| 271 | 271 | ||
| 272 | /* The core in the basic address register window. (PCI bus only) */ | 272 | /* The core currently mapped into the MMIO window. |
| 273 | * Not valid on all host-buses. So don't use outside of SSB. */ | ||
| 273 | struct ssb_device *mapped_device; | 274 | struct ssb_device *mapped_device; |
| 274 | union { | 275 | union { |
| 275 | /* Currently mapped PCMCIA segment. (bustype == SSB_BUSTYPE_PCMCIA only) */ | 276 | /* Currently mapped PCMCIA segment. (bustype == SSB_BUSTYPE_PCMCIA only) */ |
| @@ -281,14 +282,17 @@ struct ssb_bus { | |||
| 281 | * On PCMCIA-host busses this is used to protect the whole MMIO access. */ | 282 | * On PCMCIA-host busses this is used to protect the whole MMIO access. */ |
| 282 | spinlock_t bar_lock; | 283 | spinlock_t bar_lock; |
| 283 | 284 | ||
| 284 | /* The bus this backplane is running on. */ | 285 | /* The host-bus this backplane is running on. */ |
| 285 | enum ssb_bustype bustype; | 286 | enum ssb_bustype bustype; |
| 286 | /* Pointer to the PCI bus (only valid if bustype == SSB_BUSTYPE_PCI). */ | 287 | /* Pointers to the host-bus. Check bustype before using any of these pointers. */ |
| 287 | struct pci_dev *host_pci; | 288 | union { |
| 288 | /* Pointer to the PCMCIA device (only if bustype == SSB_BUSTYPE_PCMCIA). */ | 289 | /* Pointer to the PCI bus (only valid if bustype == SSB_BUSTYPE_PCI). */ |
| 289 | struct pcmcia_device *host_pcmcia; | 290 | struct pci_dev *host_pci; |
| 290 | /* Pointer to the SDIO device (only if bustype == SSB_BUSTYPE_SDIO). */ | 291 | /* Pointer to the PCMCIA device (only if bustype == SSB_BUSTYPE_PCMCIA). */ |
| 291 | struct sdio_func *host_sdio; | 292 | struct pcmcia_device *host_pcmcia; |
| 293 | /* Pointer to the SDIO device (only if bustype == SSB_BUSTYPE_SDIO). */ | ||
| 294 | struct sdio_func *host_sdio; | ||
| 295 | }; | ||
| 292 | 296 | ||
| 293 | /* See enum ssb_quirks */ | 297 | /* See enum ssb_quirks */ |
| 294 | unsigned int quirks; | 298 | unsigned int quirks; |
diff --git a/include/linux/stmmac.h b/include/linux/stmmac.h new file mode 100644 index 000000000000..32bfd1a8a48d --- /dev/null +++ b/include/linux/stmmac.h | |||
| @@ -0,0 +1,53 @@ | |||
| 1 | /******************************************************************************* | ||
| 2 | |||
| 3 | Header file for stmmac platform data | ||
| 4 | |||
| 5 | Copyright (C) 2009 STMicroelectronics Ltd | ||
| 6 | |||
| 7 | This program is free software; you can redistribute it and/or modify it | ||
| 8 | under the terms and conditions of the GNU General Public License, | ||
| 9 | version 2, as published by the Free Software Foundation. | ||
| 10 | |||
| 11 | This program is distributed in the hope it will be useful, but WITHOUT | ||
| 12 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
| 13 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
| 14 | more details. | ||
| 15 | |||
| 16 | You should have received a copy of the GNU General Public License along with | ||
| 17 | this program; if not, write to the Free Software Foundation, Inc., | ||
| 18 | 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. | ||
| 19 | |||
| 20 | The full GNU General Public License is included in this distribution in | ||
| 21 | the file called "COPYING". | ||
| 22 | |||
| 23 | Author: Giuseppe Cavallaro <peppe.cavallaro@st.com> | ||
| 24 | *******************************************************************************/ | ||
| 25 | |||
| 26 | #ifndef __STMMAC_PLATFORM_DATA | ||
| 27 | #define __STMMAC_PLATFORM_DATA | ||
| 28 | |||
| 29 | /* platfrom data for platfrom device structure's platfrom_data field */ | ||
| 30 | |||
| 31 | /* Private data for the STM on-board ethernet driver */ | ||
| 32 | struct plat_stmmacenet_data { | ||
| 33 | int bus_id; | ||
| 34 | int pbl; | ||
| 35 | int has_gmac; | ||
| 36 | void (*fix_mac_speed)(void *priv, unsigned int speed); | ||
| 37 | void (*bus_setup)(unsigned long ioaddr); | ||
| 38 | #ifdef CONFIG_STM_DRIVERS | ||
| 39 | struct stm_pad_config *pad_config; | ||
| 40 | #endif | ||
| 41 | void *bsp_priv; | ||
| 42 | }; | ||
| 43 | |||
| 44 | struct plat_stmmacphy_data { | ||
| 45 | int bus_id; | ||
| 46 | int phy_addr; | ||
| 47 | unsigned int phy_mask; | ||
| 48 | int interface; | ||
| 49 | int (*phy_reset)(void *priv); | ||
| 50 | void *priv; | ||
| 51 | }; | ||
| 52 | #endif | ||
| 53 | |||
diff --git a/include/linux/string.h b/include/linux/string.h index b8508868d5ad..a716ee2a8adb 100644 --- a/include/linux/string.h +++ b/include/linux/string.h | |||
| @@ -62,9 +62,20 @@ extern char * strnchr(const char *, size_t, int); | |||
| 62 | #ifndef __HAVE_ARCH_STRRCHR | 62 | #ifndef __HAVE_ARCH_STRRCHR |
| 63 | extern char * strrchr(const char *,int); | 63 | extern char * strrchr(const char *,int); |
| 64 | #endif | 64 | #endif |
| 65 | extern char * __must_check strstrip(char *); | 65 | extern char * __must_check skip_spaces(const char *); |
| 66 | |||
| 67 | extern char *strim(char *); | ||
| 68 | |||
| 69 | static inline __must_check char *strstrip(char *str) | ||
| 70 | { | ||
| 71 | return strim(str); | ||
| 72 | } | ||
| 73 | |||
| 66 | #ifndef __HAVE_ARCH_STRSTR | 74 | #ifndef __HAVE_ARCH_STRSTR |
| 67 | extern char * strstr(const char *,const char *); | 75 | extern char * strstr(const char *, const char *); |
| 76 | #endif | ||
| 77 | #ifndef __HAVE_ARCH_STRNSTR | ||
| 78 | extern char * strnstr(const char *, const char *, size_t); | ||
| 68 | #endif | 79 | #endif |
| 69 | #ifndef __HAVE_ARCH_STRLEN | 80 | #ifndef __HAVE_ARCH_STRLEN |
| 70 | extern __kernel_size_t strlen(const char *); | 81 | extern __kernel_size_t strlen(const char *); |
diff --git a/include/linux/sunrpc/bc_xprt.h b/include/linux/sunrpc/bc_xprt.h index 6508f0dc0eff..7c91260c44a9 100644 --- a/include/linux/sunrpc/bc_xprt.h +++ b/include/linux/sunrpc/bc_xprt.h | |||
| @@ -36,14 +36,32 @@ 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 *, int max_reqs); |
| 39 | void bc_release_request(struct rpc_task *); | ||
| 40 | int bc_send(struct rpc_rqst *req); | 39 | int bc_send(struct rpc_rqst *req); |
| 40 | |||
| 41 | /* | ||
| 42 | * Determine if a shared backchannel is in use | ||
| 43 | */ | ||
| 44 | static inline int svc_is_backchannel(const struct svc_rqst *rqstp) | ||
| 45 | { | ||
| 46 | if (rqstp->rq_server->bc_xprt) | ||
| 47 | return 1; | ||
| 48 | return 0; | ||
| 49 | } | ||
| 41 | #else /* CONFIG_NFS_V4_1 */ | 50 | #else /* CONFIG_NFS_V4_1 */ |
| 42 | static inline int xprt_setup_backchannel(struct rpc_xprt *xprt, | 51 | static inline int xprt_setup_backchannel(struct rpc_xprt *xprt, |
| 43 | unsigned int min_reqs) | 52 | unsigned int min_reqs) |
| 44 | { | 53 | { |
| 45 | return 0; | 54 | return 0; |
| 46 | } | 55 | } |
| 56 | |||
| 57 | static inline int svc_is_backchannel(const struct svc_rqst *rqstp) | ||
| 58 | { | ||
| 59 | return 0; | ||
| 60 | } | ||
| 61 | |||
| 62 | static inline void xprt_free_bc_request(struct rpc_rqst *req) | ||
| 63 | { | ||
| 64 | } | ||
| 47 | #endif /* CONFIG_NFS_V4_1 */ | 65 | #endif /* CONFIG_NFS_V4_1 */ |
| 48 | #endif /* _LINUX_SUNRPC_BC_XPRT_H */ | 66 | #endif /* _LINUX_SUNRPC_BC_XPRT_H */ |
| 49 | 67 | ||
diff --git a/include/linux/sunrpc/debug.h b/include/linux/sunrpc/debug.h index 10709cbe96fd..c2786f20016f 100644 --- a/include/linux/sunrpc/debug.h +++ b/include/linux/sunrpc/debug.h | |||
| @@ -28,9 +28,6 @@ | |||
| 28 | 28 | ||
| 29 | #ifdef __KERNEL__ | 29 | #ifdef __KERNEL__ |
| 30 | 30 | ||
| 31 | #include <linux/timer.h> | ||
| 32 | #include <linux/workqueue.h> | ||
| 33 | |||
| 34 | /* | 31 | /* |
| 35 | * Enable RPC debugging/profiling. | 32 | * Enable RPC debugging/profiling. |
| 36 | */ | 33 | */ |
diff --git a/include/linux/sunrpc/rpc_rdma.h b/include/linux/sunrpc/rpc_rdma.h index 87b895d5c786..b78f16b1dea3 100644 --- a/include/linux/sunrpc/rpc_rdma.h +++ b/include/linux/sunrpc/rpc_rdma.h | |||
| @@ -40,6 +40,8 @@ | |||
| 40 | #ifndef _LINUX_SUNRPC_RPC_RDMA_H | 40 | #ifndef _LINUX_SUNRPC_RPC_RDMA_H |
| 41 | #define _LINUX_SUNRPC_RPC_RDMA_H | 41 | #define _LINUX_SUNRPC_RPC_RDMA_H |
| 42 | 42 | ||
| 43 | #include <linux/types.h> | ||
| 44 | |||
| 43 | struct rpcrdma_segment { | 45 | struct rpcrdma_segment { |
| 44 | __be32 rs_handle; /* Registered memory handle */ | 46 | __be32 rs_handle; /* Registered memory handle */ |
| 45 | __be32 rs_length; /* Length of the chunk in bytes */ | 47 | __be32 rs_length; /* Length of the chunk in bytes */ |
diff --git a/include/linux/sunrpc/sched.h b/include/linux/sunrpc/sched.h index 401097781fc0..7bc7fd5291ce 100644 --- a/include/linux/sunrpc/sched.h +++ b/include/linux/sunrpc/sched.h | |||
| @@ -130,12 +130,14 @@ struct rpc_task_setup { | |||
| 130 | #define RPC_TASK_DYNAMIC 0x0080 /* task was kmalloc'ed */ | 130 | #define RPC_TASK_DYNAMIC 0x0080 /* task was kmalloc'ed */ |
| 131 | #define RPC_TASK_KILLED 0x0100 /* task was killed */ | 131 | #define RPC_TASK_KILLED 0x0100 /* task was killed */ |
| 132 | #define RPC_TASK_SOFT 0x0200 /* Use soft timeouts */ | 132 | #define RPC_TASK_SOFT 0x0200 /* Use soft timeouts */ |
| 133 | #define RPC_TASK_SOFTCONN 0x0400 /* Fail if can't connect */ | ||
| 133 | 134 | ||
| 134 | #define RPC_IS_ASYNC(t) ((t)->tk_flags & RPC_TASK_ASYNC) | 135 | #define RPC_IS_ASYNC(t) ((t)->tk_flags & RPC_TASK_ASYNC) |
| 135 | #define RPC_IS_SWAPPER(t) ((t)->tk_flags & RPC_TASK_SWAPPER) | 136 | #define RPC_IS_SWAPPER(t) ((t)->tk_flags & RPC_TASK_SWAPPER) |
| 136 | #define RPC_DO_ROOTOVERRIDE(t) ((t)->tk_flags & RPC_TASK_ROOTCREDS) | 137 | #define RPC_DO_ROOTOVERRIDE(t) ((t)->tk_flags & RPC_TASK_ROOTCREDS) |
| 137 | #define RPC_ASSASSINATED(t) ((t)->tk_flags & RPC_TASK_KILLED) | 138 | #define RPC_ASSASSINATED(t) ((t)->tk_flags & RPC_TASK_KILLED) |
| 138 | #define RPC_IS_SOFT(t) ((t)->tk_flags & RPC_TASK_SOFT) | 139 | #define RPC_IS_SOFT(t) ((t)->tk_flags & RPC_TASK_SOFT) |
| 140 | #define RPC_IS_SOFTCONN(t) ((t)->tk_flags & RPC_TASK_SOFTCONN) | ||
| 139 | 141 | ||
| 140 | #define RPC_TASK_RUNNING 0 | 142 | #define RPC_TASK_RUNNING 0 |
| 141 | #define RPC_TASK_QUEUED 1 | 143 | #define RPC_TASK_QUEUED 1 |
| @@ -171,7 +173,8 @@ struct rpc_task_setup { | |||
| 171 | #define RPC_PRIORITY_LOW (-1) | 173 | #define RPC_PRIORITY_LOW (-1) |
| 172 | #define RPC_PRIORITY_NORMAL (0) | 174 | #define RPC_PRIORITY_NORMAL (0) |
| 173 | #define RPC_PRIORITY_HIGH (1) | 175 | #define RPC_PRIORITY_HIGH (1) |
| 174 | #define RPC_NR_PRIORITY (1 + RPC_PRIORITY_HIGH - RPC_PRIORITY_LOW) | 176 | #define RPC_PRIORITY_PRIVILEGED (2) |
| 177 | #define RPC_NR_PRIORITY (1 + RPC_PRIORITY_PRIVILEGED - RPC_PRIORITY_LOW) | ||
| 175 | 178 | ||
| 176 | struct rpc_timer { | 179 | struct rpc_timer { |
| 177 | struct timer_list timer; | 180 | struct timer_list timer; |
| @@ -227,6 +230,7 @@ void rpc_wake_up_queued_task(struct rpc_wait_queue *, | |||
| 227 | void rpc_wake_up(struct rpc_wait_queue *); | 230 | void rpc_wake_up(struct rpc_wait_queue *); |
| 228 | struct rpc_task *rpc_wake_up_next(struct rpc_wait_queue *); | 231 | struct rpc_task *rpc_wake_up_next(struct rpc_wait_queue *); |
| 229 | void rpc_wake_up_status(struct rpc_wait_queue *, int); | 232 | void rpc_wake_up_status(struct rpc_wait_queue *, int); |
| 233 | int rpc_queue_empty(struct rpc_wait_queue *); | ||
| 230 | void rpc_delay(struct rpc_task *, unsigned long); | 234 | void rpc_delay(struct rpc_task *, unsigned long); |
| 231 | void * rpc_malloc(struct rpc_task *, size_t); | 235 | void * rpc_malloc(struct rpc_task *, size_t); |
| 232 | void rpc_free(void *); | 236 | void rpc_free(void *); |
| @@ -252,6 +256,16 @@ static inline int rpc_wait_for_completion_task(struct rpc_task *task) | |||
| 252 | return __rpc_wait_for_completion_task(task, NULL); | 256 | return __rpc_wait_for_completion_task(task, NULL); |
| 253 | } | 257 | } |
| 254 | 258 | ||
| 259 | static inline void rpc_task_set_priority(struct rpc_task *task, unsigned char prio) | ||
| 260 | { | ||
| 261 | task->tk_priority = prio - RPC_PRIORITY_LOW; | ||
| 262 | } | ||
| 263 | |||
| 264 | static inline int rpc_task_has_priority(struct rpc_task *task, unsigned char prio) | ||
| 265 | { | ||
| 266 | return (task->tk_priority + RPC_PRIORITY_LOW == prio); | ||
| 267 | } | ||
| 268 | |||
| 255 | #ifdef RPC_DEBUG | 269 | #ifdef RPC_DEBUG |
| 256 | static inline const char * rpc_qname(struct rpc_wait_queue *q) | 270 | static inline const char * rpc_qname(struct rpc_wait_queue *q) |
| 257 | { | 271 | { |
diff --git a/include/linux/sunrpc/svc.h b/include/linux/sunrpc/svc.h index 52e8cb0a7569..5a3085b9b394 100644 --- a/include/linux/sunrpc/svc.h +++ b/include/linux/sunrpc/svc.h | |||
| @@ -29,7 +29,6 @@ struct svc_pool_stats { | |||
| 29 | unsigned long packets; | 29 | unsigned long packets; |
| 30 | unsigned long sockets_queued; | 30 | unsigned long sockets_queued; |
| 31 | unsigned long threads_woken; | 31 | unsigned long threads_woken; |
| 32 | unsigned long overloads_avoided; | ||
| 33 | unsigned long threads_timedout; | 32 | unsigned long threads_timedout; |
| 34 | }; | 33 | }; |
| 35 | 34 | ||
| @@ -50,7 +49,6 @@ struct svc_pool { | |||
| 50 | struct list_head sp_sockets; /* pending sockets */ | 49 | struct list_head sp_sockets; /* pending sockets */ |
| 51 | unsigned int sp_nrthreads; /* # of threads in pool */ | 50 | unsigned int sp_nrthreads; /* # of threads in pool */ |
| 52 | struct list_head sp_all_threads; /* all server threads */ | 51 | struct list_head sp_all_threads; /* all server threads */ |
| 53 | int sp_nwaking; /* number of threads woken but not yet active */ | ||
| 54 | struct svc_pool_stats sp_stats; /* statistics on pool operation */ | 52 | struct svc_pool_stats sp_stats; /* statistics on pool operation */ |
| 55 | } ____cacheline_aligned_in_smp; | 53 | } ____cacheline_aligned_in_smp; |
| 56 | 54 | ||
| @@ -275,16 +273,11 @@ struct svc_rqst { | |||
| 275 | struct auth_domain * rq_client; /* RPC peer info */ | 273 | struct auth_domain * rq_client; /* RPC peer info */ |
| 276 | struct auth_domain * rq_gssclient; /* "gss/"-style peer info */ | 274 | struct auth_domain * rq_gssclient; /* "gss/"-style peer info */ |
| 277 | struct svc_cacherep * rq_cacherep; /* cache info */ | 275 | struct svc_cacherep * rq_cacherep; /* cache info */ |
| 278 | struct knfsd_fh * rq_reffh; /* Referrence filehandle, used to | ||
| 279 | * determine what device number | ||
| 280 | * to report (real or virtual) | ||
| 281 | */ | ||
| 282 | int rq_splice_ok; /* turned off in gss privacy | 276 | int rq_splice_ok; /* turned off in gss privacy |
| 283 | * to prevent encrypting page | 277 | * to prevent encrypting page |
| 284 | * cache pages */ | 278 | * cache pages */ |
| 285 | wait_queue_head_t rq_wait; /* synchronization */ | 279 | wait_queue_head_t rq_wait; /* synchronization */ |
| 286 | struct task_struct *rq_task; /* service thread */ | 280 | struct task_struct *rq_task; /* service thread */ |
| 287 | int rq_waking; /* 1 if thread is being woken */ | ||
| 288 | }; | 281 | }; |
| 289 | 282 | ||
| 290 | /* | 283 | /* |
diff --git a/include/linux/swap.h b/include/linux/swap.h index 4ec90019c1a4..1f59d9340c4d 100644 --- a/include/linux/swap.h +++ b/include/linux/swap.h | |||
| @@ -145,38 +145,43 @@ enum { | |||
| 145 | SWP_DISCARDABLE = (1 << 2), /* blkdev supports discard */ | 145 | SWP_DISCARDABLE = (1 << 2), /* blkdev supports discard */ |
| 146 | SWP_DISCARDING = (1 << 3), /* now discarding a free cluster */ | 146 | SWP_DISCARDING = (1 << 3), /* now discarding a free cluster */ |
| 147 | SWP_SOLIDSTATE = (1 << 4), /* blkdev seeks are cheap */ | 147 | SWP_SOLIDSTATE = (1 << 4), /* blkdev seeks are cheap */ |
| 148 | SWP_CONTINUED = (1 << 5), /* swap_map has count continuation */ | ||
| 148 | /* add others here before... */ | 149 | /* add others here before... */ |
| 149 | SWP_SCANNING = (1 << 8), /* refcount in scan_swap_map */ | 150 | SWP_SCANNING = (1 << 8), /* refcount in scan_swap_map */ |
| 150 | }; | 151 | }; |
| 151 | 152 | ||
| 152 | #define SWAP_CLUSTER_MAX 32 | 153 | #define SWAP_CLUSTER_MAX 32 |
| 153 | 154 | ||
| 154 | #define SWAP_MAP_MAX 0x7ffe | 155 | #define SWAP_MAP_MAX 0x3e /* Max duplication count, in first swap_map */ |
| 155 | #define SWAP_MAP_BAD 0x7fff | 156 | #define SWAP_MAP_BAD 0x3f /* Note pageblock is bad, in first swap_map */ |
| 156 | #define SWAP_HAS_CACHE 0x8000 /* There is a swap cache of entry. */ | 157 | #define SWAP_HAS_CACHE 0x40 /* Flag page is cached, in first swap_map */ |
| 157 | #define SWAP_COUNT_MASK (~SWAP_HAS_CACHE) | 158 | #define SWAP_CONT_MAX 0x7f /* Max count, in each swap_map continuation */ |
| 159 | #define COUNT_CONTINUED 0x80 /* See swap_map continuation for full count */ | ||
| 160 | #define SWAP_MAP_SHMEM 0xbf /* Owned by shmem/tmpfs, in first swap_map */ | ||
| 161 | |||
| 158 | /* | 162 | /* |
| 159 | * The in-memory structure used to track swap areas. | 163 | * The in-memory structure used to track swap areas. |
| 160 | */ | 164 | */ |
| 161 | struct swap_info_struct { | 165 | struct swap_info_struct { |
| 162 | unsigned long flags; | 166 | unsigned long flags; /* SWP_USED etc: see above */ |
| 163 | int prio; /* swap priority */ | 167 | signed short prio; /* swap priority of this type */ |
| 164 | int next; /* next entry on swap list */ | 168 | signed char type; /* strange name for an index */ |
| 165 | struct file *swap_file; | 169 | signed char next; /* next type on the swap list */ |
| 166 | struct block_device *bdev; | 170 | unsigned int max; /* extent of the swap_map */ |
| 167 | struct list_head extent_list; | 171 | unsigned char *swap_map; /* vmalloc'ed array of usage counts */ |
| 168 | struct swap_extent *curr_swap_extent; | 172 | unsigned int lowest_bit; /* index of first free in swap_map */ |
| 169 | unsigned short *swap_map; | 173 | unsigned int highest_bit; /* index of last free in swap_map */ |
| 170 | unsigned int lowest_bit; | 174 | unsigned int pages; /* total of usable pages of swap */ |
| 171 | unsigned int highest_bit; | 175 | unsigned int inuse_pages; /* number of those currently in use */ |
| 176 | unsigned int cluster_next; /* likely index for next allocation */ | ||
| 177 | unsigned int cluster_nr; /* countdown to next cluster search */ | ||
| 172 | unsigned int lowest_alloc; /* while preparing discard cluster */ | 178 | unsigned int lowest_alloc; /* while preparing discard cluster */ |
| 173 | unsigned int highest_alloc; /* while preparing discard cluster */ | 179 | unsigned int highest_alloc; /* while preparing discard cluster */ |
| 174 | unsigned int cluster_next; | 180 | struct swap_extent *curr_swap_extent; |
| 175 | unsigned int cluster_nr; | 181 | struct swap_extent first_swap_extent; |
| 176 | unsigned int pages; | 182 | struct block_device *bdev; /* swap device or bdev of swap file */ |
| 177 | unsigned int max; | 183 | struct file *swap_file; /* seldom referenced */ |
| 178 | unsigned int inuse_pages; | 184 | unsigned int old_block_size; /* seldom referenced */ |
| 179 | unsigned int old_block_size; | ||
| 180 | }; | 185 | }; |
| 181 | 186 | ||
| 182 | struct swap_list_t { | 187 | struct swap_list_t { |
| @@ -273,6 +278,7 @@ extern int scan_unevictable_register_node(struct node *node); | |||
| 273 | extern void scan_unevictable_unregister_node(struct node *node); | 278 | extern void scan_unevictable_unregister_node(struct node *node); |
| 274 | 279 | ||
| 275 | extern int kswapd_run(int nid); | 280 | extern int kswapd_run(int nid); |
| 281 | extern void kswapd_stop(int nid); | ||
| 276 | 282 | ||
| 277 | #ifdef CONFIG_MMU | 283 | #ifdef CONFIG_MMU |
| 278 | /* linux/mm/shmem.c */ | 284 | /* linux/mm/shmem.c */ |
| @@ -309,17 +315,18 @@ extern long total_swap_pages; | |||
| 309 | extern void si_swapinfo(struct sysinfo *); | 315 | extern void si_swapinfo(struct sysinfo *); |
| 310 | extern swp_entry_t get_swap_page(void); | 316 | extern swp_entry_t get_swap_page(void); |
| 311 | extern swp_entry_t get_swap_page_of_type(int); | 317 | extern swp_entry_t get_swap_page_of_type(int); |
| 312 | extern void swap_duplicate(swp_entry_t); | ||
| 313 | extern int swapcache_prepare(swp_entry_t); | ||
| 314 | extern int valid_swaphandles(swp_entry_t, unsigned long *); | 318 | extern int valid_swaphandles(swp_entry_t, unsigned long *); |
| 319 | extern int add_swap_count_continuation(swp_entry_t, gfp_t); | ||
| 320 | extern void swap_shmem_alloc(swp_entry_t); | ||
| 321 | extern int swap_duplicate(swp_entry_t); | ||
| 322 | extern int swapcache_prepare(swp_entry_t); | ||
| 315 | extern void swap_free(swp_entry_t); | 323 | extern void swap_free(swp_entry_t); |
| 316 | extern void swapcache_free(swp_entry_t, struct page *page); | 324 | extern void swapcache_free(swp_entry_t, struct page *page); |
| 317 | extern int free_swap_and_cache(swp_entry_t); | 325 | extern int free_swap_and_cache(swp_entry_t); |
| 318 | extern int swap_type_of(dev_t, sector_t, struct block_device **); | 326 | extern int swap_type_of(dev_t, sector_t, struct block_device **); |
| 319 | extern unsigned int count_swap_pages(int, int); | 327 | extern unsigned int count_swap_pages(int, int); |
| 320 | extern sector_t map_swap_page(struct swap_info_struct *, pgoff_t); | 328 | extern sector_t map_swap_page(struct page *, struct block_device **); |
| 321 | extern sector_t swapdev_block(int, pgoff_t); | 329 | extern sector_t swapdev_block(int, pgoff_t); |
| 322 | extern struct swap_info_struct *get_swap_info_struct(unsigned); | ||
| 323 | extern int reuse_swap_page(struct page *); | 330 | extern int reuse_swap_page(struct page *); |
| 324 | extern int try_to_free_swap(struct page *); | 331 | extern int try_to_free_swap(struct page *); |
| 325 | struct backing_dev_info; | 332 | struct backing_dev_info; |
| @@ -348,6 +355,7 @@ static inline void disable_swap_token(void) | |||
| 348 | #ifdef CONFIG_CGROUP_MEM_RES_CTLR | 355 | #ifdef CONFIG_CGROUP_MEM_RES_CTLR |
| 349 | extern void | 356 | extern void |
| 350 | mem_cgroup_uncharge_swapcache(struct page *page, swp_entry_t ent, bool swapout); | 357 | mem_cgroup_uncharge_swapcache(struct page *page, swp_entry_t ent, bool swapout); |
| 358 | extern int mem_cgroup_count_swap_user(swp_entry_t ent, struct page **pagep); | ||
| 351 | #else | 359 | #else |
| 352 | static inline void | 360 | static inline void |
| 353 | mem_cgroup_uncharge_swapcache(struct page *page, swp_entry_t ent, bool swapout) | 361 | mem_cgroup_uncharge_swapcache(struct page *page, swp_entry_t ent, bool swapout) |
| @@ -384,8 +392,18 @@ static inline void show_swap_cache_info(void) | |||
| 384 | #define free_swap_and_cache(swp) is_migration_entry(swp) | 392 | #define free_swap_and_cache(swp) is_migration_entry(swp) |
| 385 | #define swapcache_prepare(swp) is_migration_entry(swp) | 393 | #define swapcache_prepare(swp) is_migration_entry(swp) |
| 386 | 394 | ||
| 387 | static inline void swap_duplicate(swp_entry_t swp) | 395 | static inline int add_swap_count_continuation(swp_entry_t swp, gfp_t gfp_mask) |
| 388 | { | 396 | { |
| 397 | return 0; | ||
| 398 | } | ||
| 399 | |||
| 400 | static inline void swap_shmem_alloc(swp_entry_t swp) | ||
| 401 | { | ||
| 402 | } | ||
| 403 | |||
| 404 | static inline int swap_duplicate(swp_entry_t swp) | ||
| 405 | { | ||
| 406 | return 0; | ||
| 389 | } | 407 | } |
| 390 | 408 | ||
| 391 | static inline void swap_free(swp_entry_t swp) | 409 | static inline void swap_free(swp_entry_t swp) |
| @@ -468,6 +486,14 @@ mem_cgroup_uncharge_swapcache(struct page *page, swp_entry_t ent) | |||
| 468 | { | 486 | { |
| 469 | } | 487 | } |
| 470 | 488 | ||
| 489 | #ifdef CONFIG_CGROUP_MEM_RES_CTLR | ||
| 490 | static inline int | ||
| 491 | mem_cgroup_count_swap_user(swp_entry_t ent, struct page **pagep) | ||
| 492 | { | ||
| 493 | return 0; | ||
| 494 | } | ||
| 495 | #endif | ||
| 496 | |||
| 471 | #endif /* CONFIG_SWAP */ | 497 | #endif /* CONFIG_SWAP */ |
| 472 | #endif /* __KERNEL__*/ | 498 | #endif /* __KERNEL__*/ |
| 473 | #endif /* _LINUX_SWAP_H */ | 499 | #endif /* _LINUX_SWAP_H */ |
diff --git a/include/linux/swiotlb.h b/include/linux/swiotlb.h index 73b1f1cec423..febedcf67c7e 100644 --- a/include/linux/swiotlb.h +++ b/include/linux/swiotlb.h | |||
| @@ -7,6 +7,8 @@ struct device; | |||
| 7 | struct dma_attrs; | 7 | struct dma_attrs; |
| 8 | struct scatterlist; | 8 | struct scatterlist; |
| 9 | 9 | ||
| 10 | extern int swiotlb_force; | ||
| 11 | |||
| 10 | /* | 12 | /* |
| 11 | * Maximum allowable number of contiguous slabs to map, | 13 | * Maximum allowable number of contiguous slabs to map, |
| 12 | * must be a power of 2. What is the appropriate value ? | 14 | * must be a power of 2. What is the appropriate value ? |
| @@ -20,8 +22,7 @@ struct scatterlist; | |||
| 20 | */ | 22 | */ |
| 21 | #define IO_TLB_SHIFT 11 | 23 | #define IO_TLB_SHIFT 11 |
| 22 | 24 | ||
| 23 | extern void | 25 | extern void swiotlb_init(int verbose); |
| 24 | swiotlb_init(void); | ||
| 25 | 26 | ||
| 26 | extern void | 27 | extern void |
| 27 | *swiotlb_alloc_coherent(struct device *hwdev, size_t size, | 28 | *swiotlb_alloc_coherent(struct device *hwdev, size_t size, |
| @@ -88,4 +89,11 @@ swiotlb_dma_mapping_error(struct device *hwdev, dma_addr_t dma_addr); | |||
| 88 | extern int | 89 | extern int |
| 89 | swiotlb_dma_supported(struct device *hwdev, u64 mask); | 90 | swiotlb_dma_supported(struct device *hwdev, u64 mask); |
| 90 | 91 | ||
| 92 | #ifdef CONFIG_SWIOTLB | ||
| 93 | extern void __init swiotlb_free(void); | ||
| 94 | #else | ||
| 95 | static inline void swiotlb_free(void) { } | ||
| 96 | #endif | ||
| 97 | |||
| 98 | extern void swiotlb_print_info(void); | ||
| 91 | #endif /* __LINUX_SWIOTLB_H */ | 99 | #endif /* __LINUX_SWIOTLB_H */ |
diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h index a990ace1a838..057929b0a651 100644 --- a/include/linux/syscalls.h +++ b/include/linux/syscalls.h | |||
| @@ -23,16 +23,21 @@ struct kexec_segment; | |||
| 23 | struct linux_dirent; | 23 | struct linux_dirent; |
| 24 | struct linux_dirent64; | 24 | struct linux_dirent64; |
| 25 | struct list_head; | 25 | struct list_head; |
| 26 | struct mmap_arg_struct; | ||
| 26 | struct msgbuf; | 27 | struct msgbuf; |
| 27 | struct msghdr; | 28 | struct msghdr; |
| 29 | struct mmsghdr; | ||
| 28 | struct msqid_ds; | 30 | struct msqid_ds; |
| 29 | struct new_utsname; | 31 | struct new_utsname; |
| 30 | struct nfsctl_arg; | 32 | struct nfsctl_arg; |
| 31 | struct __old_kernel_stat; | 33 | struct __old_kernel_stat; |
| 34 | struct oldold_utsname; | ||
| 35 | struct old_utsname; | ||
| 32 | struct pollfd; | 36 | struct pollfd; |
| 33 | struct rlimit; | 37 | struct rlimit; |
| 34 | struct rusage; | 38 | struct rusage; |
| 35 | struct sched_param; | 39 | struct sched_param; |
| 40 | struct sel_arg_struct; | ||
| 36 | struct semaphore; | 41 | struct semaphore; |
| 37 | struct sembuf; | 42 | struct sembuf; |
| 38 | struct shmid_ds; | 43 | struct shmid_ds; |
| @@ -98,44 +103,21 @@ struct perf_event_attr; | |||
| 98 | #define __SC_TEST5(t5, a5, ...) __SC_TEST(t5); __SC_TEST4(__VA_ARGS__) | 103 | #define __SC_TEST5(t5, a5, ...) __SC_TEST(t5); __SC_TEST4(__VA_ARGS__) |
| 99 | #define __SC_TEST6(t6, a6, ...) __SC_TEST(t6); __SC_TEST5(__VA_ARGS__) | 104 | #define __SC_TEST6(t6, a6, ...) __SC_TEST(t6); __SC_TEST5(__VA_ARGS__) |
| 100 | 105 | ||
| 101 | #ifdef CONFIG_EVENT_PROFILE | 106 | #ifdef CONFIG_PERF_EVENTS |
| 102 | #define TRACE_SYS_ENTER_PROFILE(sname) \ | 107 | |
| 103 | static int prof_sysenter_enable_##sname(void) \ | 108 | #define TRACE_SYS_ENTER_PERF_INIT(sname) \ |
| 104 | { \ | 109 | .perf_event_enable = perf_sysenter_enable, \ |
| 105 | return reg_prof_syscall_enter("sys"#sname); \ | 110 | .perf_event_disable = perf_sysenter_disable, |
| 106 | } \ | 111 | |
| 107 | \ | 112 | #define TRACE_SYS_EXIT_PERF_INIT(sname) \ |
| 108 | static void prof_sysenter_disable_##sname(void) \ | 113 | .perf_event_enable = perf_sysexit_enable, \ |
| 109 | { \ | 114 | .perf_event_disable = perf_sysexit_disable, |
| 110 | unreg_prof_syscall_enter("sys"#sname); \ | ||
| 111 | } | ||
| 112 | |||
| 113 | #define TRACE_SYS_EXIT_PROFILE(sname) \ | ||
| 114 | static int prof_sysexit_enable_##sname(void) \ | ||
| 115 | { \ | ||
| 116 | return reg_prof_syscall_exit("sys"#sname); \ | ||
| 117 | } \ | ||
| 118 | \ | ||
| 119 | static void prof_sysexit_disable_##sname(void) \ | ||
| 120 | { \ | ||
| 121 | unreg_prof_syscall_exit("sys"#sname); \ | ||
| 122 | } | ||
| 123 | |||
| 124 | #define TRACE_SYS_ENTER_PROFILE_INIT(sname) \ | ||
| 125 | .profile_count = ATOMIC_INIT(-1), \ | ||
| 126 | .profile_enable = prof_sysenter_enable_##sname, \ | ||
| 127 | .profile_disable = prof_sysenter_disable_##sname, | ||
| 128 | |||
| 129 | #define TRACE_SYS_EXIT_PROFILE_INIT(sname) \ | ||
| 130 | .profile_count = ATOMIC_INIT(-1), \ | ||
| 131 | .profile_enable = prof_sysexit_enable_##sname, \ | ||
| 132 | .profile_disable = prof_sysexit_disable_##sname, | ||
| 133 | #else | 115 | #else |
| 134 | #define TRACE_SYS_ENTER_PROFILE(sname) | 116 | #define TRACE_SYS_ENTER_PERF(sname) |
| 135 | #define TRACE_SYS_ENTER_PROFILE_INIT(sname) | 117 | #define TRACE_SYS_ENTER_PERF_INIT(sname) |
| 136 | #define TRACE_SYS_EXIT_PROFILE(sname) | 118 | #define TRACE_SYS_EXIT_PERF(sname) |
| 137 | #define TRACE_SYS_EXIT_PROFILE_INIT(sname) | 119 | #define TRACE_SYS_EXIT_PERF_INIT(sname) |
| 138 | #endif | 120 | #endif /* CONFIG_PERF_EVENTS */ |
| 139 | 121 | ||
| 140 | #ifdef CONFIG_FTRACE_SYSCALLS | 122 | #ifdef CONFIG_FTRACE_SYSCALLS |
| 141 | #define __SC_STR_ADECL1(t, a) #a | 123 | #define __SC_STR_ADECL1(t, a) #a |
| @@ -153,75 +135,47 @@ static void prof_sysexit_disable_##sname(void) \ | |||
| 153 | #define __SC_STR_TDECL6(t, a, ...) #t, __SC_STR_TDECL5(__VA_ARGS__) | 135 | #define __SC_STR_TDECL6(t, a, ...) #t, __SC_STR_TDECL5(__VA_ARGS__) |
| 154 | 136 | ||
| 155 | #define SYSCALL_TRACE_ENTER_EVENT(sname) \ | 137 | #define SYSCALL_TRACE_ENTER_EVENT(sname) \ |
| 156 | static struct ftrace_event_call event_enter_##sname; \ | 138 | static const struct syscall_metadata __syscall_meta_##sname; \ |
| 157 | struct trace_event enter_syscall_print_##sname = { \ | 139 | static struct ftrace_event_call \ |
| 140 | __attribute__((__aligned__(4))) event_enter_##sname; \ | ||
| 141 | static struct trace_event enter_syscall_print_##sname = { \ | ||
| 158 | .trace = print_syscall_enter, \ | 142 | .trace = print_syscall_enter, \ |
| 159 | }; \ | 143 | }; \ |
| 160 | static int init_enter_##sname(void) \ | ||
| 161 | { \ | ||
| 162 | int num, id; \ | ||
| 163 | num = syscall_name_to_nr("sys"#sname); \ | ||
| 164 | if (num < 0) \ | ||
| 165 | return -ENOSYS; \ | ||
| 166 | id = register_ftrace_event(&enter_syscall_print_##sname);\ | ||
| 167 | if (!id) \ | ||
| 168 | return -ENODEV; \ | ||
| 169 | event_enter_##sname.id = id; \ | ||
| 170 | set_syscall_enter_id(num, id); \ | ||
| 171 | INIT_LIST_HEAD(&event_enter_##sname.fields); \ | ||
| 172 | return 0; \ | ||
| 173 | } \ | ||
| 174 | TRACE_SYS_ENTER_PROFILE(sname); \ | ||
| 175 | static struct ftrace_event_call __used \ | 144 | static struct ftrace_event_call __used \ |
| 176 | __attribute__((__aligned__(4))) \ | 145 | __attribute__((__aligned__(4))) \ |
| 177 | __attribute__((section("_ftrace_events"))) \ | 146 | __attribute__((section("_ftrace_events"))) \ |
| 178 | event_enter_##sname = { \ | 147 | event_enter_##sname = { \ |
| 179 | .name = "sys_enter"#sname, \ | 148 | .name = "sys_enter"#sname, \ |
| 180 | .system = "syscalls", \ | 149 | .system = "syscalls", \ |
| 181 | .event = &event_syscall_enter, \ | 150 | .event = &enter_syscall_print_##sname, \ |
| 182 | .raw_init = init_enter_##sname, \ | 151 | .raw_init = init_syscall_trace, \ |
| 183 | .show_format = syscall_enter_format, \ | ||
| 184 | .define_fields = syscall_enter_define_fields, \ | 152 | .define_fields = syscall_enter_define_fields, \ |
| 185 | .regfunc = reg_event_syscall_enter, \ | 153 | .regfunc = reg_event_syscall_enter, \ |
| 186 | .unregfunc = unreg_event_syscall_enter, \ | 154 | .unregfunc = unreg_event_syscall_enter, \ |
| 187 | .data = "sys"#sname, \ | 155 | .data = (void *)&__syscall_meta_##sname,\ |
| 188 | TRACE_SYS_ENTER_PROFILE_INIT(sname) \ | 156 | TRACE_SYS_ENTER_PERF_INIT(sname) \ |
| 189 | } | 157 | } |
| 190 | 158 | ||
| 191 | #define SYSCALL_TRACE_EXIT_EVENT(sname) \ | 159 | #define SYSCALL_TRACE_EXIT_EVENT(sname) \ |
| 192 | static struct ftrace_event_call event_exit_##sname; \ | 160 | static const struct syscall_metadata __syscall_meta_##sname; \ |
| 193 | struct trace_event exit_syscall_print_##sname = { \ | 161 | static struct ftrace_event_call \ |
| 162 | __attribute__((__aligned__(4))) event_exit_##sname; \ | ||
| 163 | static struct trace_event exit_syscall_print_##sname = { \ | ||
| 194 | .trace = print_syscall_exit, \ | 164 | .trace = print_syscall_exit, \ |
| 195 | }; \ | 165 | }; \ |
| 196 | static int init_exit_##sname(void) \ | ||
| 197 | { \ | ||
| 198 | int num, id; \ | ||
| 199 | num = syscall_name_to_nr("sys"#sname); \ | ||
| 200 | if (num < 0) \ | ||
| 201 | return -ENOSYS; \ | ||
| 202 | id = register_ftrace_event(&exit_syscall_print_##sname);\ | ||
| 203 | if (!id) \ | ||
| 204 | return -ENODEV; \ | ||
| 205 | event_exit_##sname.id = id; \ | ||
| 206 | set_syscall_exit_id(num, id); \ | ||
| 207 | INIT_LIST_HEAD(&event_exit_##sname.fields); \ | ||
| 208 | return 0; \ | ||
| 209 | } \ | ||
| 210 | TRACE_SYS_EXIT_PROFILE(sname); \ | ||
| 211 | static struct ftrace_event_call __used \ | 166 | static struct ftrace_event_call __used \ |
| 212 | __attribute__((__aligned__(4))) \ | 167 | __attribute__((__aligned__(4))) \ |
| 213 | __attribute__((section("_ftrace_events"))) \ | 168 | __attribute__((section("_ftrace_events"))) \ |
| 214 | event_exit_##sname = { \ | 169 | event_exit_##sname = { \ |
| 215 | .name = "sys_exit"#sname, \ | 170 | .name = "sys_exit"#sname, \ |
| 216 | .system = "syscalls", \ | 171 | .system = "syscalls", \ |
| 217 | .event = &event_syscall_exit, \ | 172 | .event = &exit_syscall_print_##sname, \ |
| 218 | .raw_init = init_exit_##sname, \ | 173 | .raw_init = init_syscall_trace, \ |
| 219 | .show_format = syscall_exit_format, \ | ||
| 220 | .define_fields = syscall_exit_define_fields, \ | 174 | .define_fields = syscall_exit_define_fields, \ |
| 221 | .regfunc = reg_event_syscall_exit, \ | 175 | .regfunc = reg_event_syscall_exit, \ |
| 222 | .unregfunc = unreg_event_syscall_exit, \ | 176 | .unregfunc = unreg_event_syscall_exit, \ |
| 223 | .data = "sys"#sname, \ | 177 | .data = (void *)&__syscall_meta_##sname,\ |
| 224 | TRACE_SYS_EXIT_PROFILE_INIT(sname) \ | 178 | TRACE_SYS_EXIT_PERF_INIT(sname) \ |
| 225 | } | 179 | } |
| 226 | 180 | ||
| 227 | #define SYSCALL_METADATA(sname, nb) \ | 181 | #define SYSCALL_METADATA(sname, nb) \ |
| @@ -245,7 +199,7 @@ static void prof_sysexit_disable_##sname(void) \ | |||
| 245 | static const struct syscall_metadata __used \ | 199 | static const struct syscall_metadata __used \ |
| 246 | __attribute__((__aligned__(4))) \ | 200 | __attribute__((__aligned__(4))) \ |
| 247 | __attribute__((section("__syscalls_metadata"))) \ | 201 | __attribute__((section("__syscalls_metadata"))) \ |
| 248 | __syscall_meta_##sname = { \ | 202 | __syscall_meta__##sname = { \ |
| 249 | .name = "sys_"#sname, \ | 203 | .name = "sys_"#sname, \ |
| 250 | .nb_args = 0, \ | 204 | .nb_args = 0, \ |
| 251 | .enter_event = &event_enter__##sname, \ | 205 | .enter_event = &event_enter__##sname, \ |
| @@ -677,6 +631,9 @@ asmlinkage long sys_recv(int, void __user *, size_t, unsigned); | |||
| 677 | asmlinkage long sys_recvfrom(int, void __user *, size_t, unsigned, | 631 | asmlinkage long sys_recvfrom(int, void __user *, size_t, unsigned, |
| 678 | struct sockaddr __user *, int __user *); | 632 | struct sockaddr __user *, int __user *); |
| 679 | asmlinkage long sys_recvmsg(int fd, struct msghdr __user *msg, unsigned flags); | 633 | asmlinkage long sys_recvmsg(int fd, struct msghdr __user *msg, unsigned flags); |
| 634 | asmlinkage long sys_recvmmsg(int fd, struct mmsghdr __user *msg, | ||
| 635 | unsigned int vlen, unsigned flags, | ||
| 636 | struct timespec __user *timeout); | ||
| 680 | asmlinkage long sys_socket(int, int, int); | 637 | asmlinkage long sys_socket(int, int, int); |
| 681 | asmlinkage long sys_socketpair(int, int, int, int __user *); | 638 | asmlinkage long sys_socketpair(int, int, int, int __user *); |
| 682 | asmlinkage long sys_socketcall(int call, unsigned long __user *args); | 639 | asmlinkage long sys_socketcall(int call, unsigned long __user *args); |
| @@ -685,6 +642,7 @@ asmlinkage long sys_poll(struct pollfd __user *ufds, unsigned int nfds, | |||
| 685 | long timeout); | 642 | long timeout); |
| 686 | asmlinkage long sys_select(int n, fd_set __user *inp, fd_set __user *outp, | 643 | asmlinkage long sys_select(int n, fd_set __user *inp, fd_set __user *outp, |
| 687 | fd_set __user *exp, struct timeval __user *tvp); | 644 | fd_set __user *exp, struct timeval __user *tvp); |
| 645 | asmlinkage long sys_old_select(struct sel_arg_struct __user *arg); | ||
| 688 | asmlinkage long sys_epoll_create(int size); | 646 | asmlinkage long sys_epoll_create(int size); |
| 689 | asmlinkage long sys_epoll_create1(int flags); | 647 | asmlinkage long sys_epoll_create1(int flags); |
| 690 | asmlinkage long sys_epoll_ctl(int epfd, int op, int fd, | 648 | asmlinkage long sys_epoll_ctl(int epfd, int op, int fd, |
| @@ -699,6 +657,8 @@ asmlinkage long sys_gethostname(char __user *name, int len); | |||
| 699 | asmlinkage long sys_sethostname(char __user *name, int len); | 657 | asmlinkage long sys_sethostname(char __user *name, int len); |
| 700 | asmlinkage long sys_setdomainname(char __user *name, int len); | 658 | asmlinkage long sys_setdomainname(char __user *name, int len); |
| 701 | asmlinkage long sys_newuname(struct new_utsname __user *name); | 659 | asmlinkage long sys_newuname(struct new_utsname __user *name); |
| 660 | asmlinkage long sys_uname(struct old_utsname __user *); | ||
| 661 | asmlinkage long sys_olduname(struct oldold_utsname __user *); | ||
| 702 | 662 | ||
| 703 | asmlinkage long sys_getrlimit(unsigned int resource, | 663 | asmlinkage long sys_getrlimit(unsigned int resource, |
| 704 | struct rlimit __user *rlim); | 664 | struct rlimit __user *rlim); |
| @@ -728,6 +688,8 @@ asmlinkage long sys_shmat(int shmid, char __user *shmaddr, int shmflg); | |||
| 728 | asmlinkage long sys_shmget(key_t key, size_t size, int flag); | 688 | asmlinkage long sys_shmget(key_t key, size_t size, int flag); |
| 729 | asmlinkage long sys_shmdt(char __user *shmaddr); | 689 | asmlinkage long sys_shmdt(char __user *shmaddr); |
| 730 | asmlinkage long sys_shmctl(int shmid, int cmd, struct shmid_ds __user *buf); | 690 | asmlinkage long sys_shmctl(int shmid, int cmd, struct shmid_ds __user *buf); |
| 691 | asmlinkage long sys_ipc(unsigned int call, int first, unsigned long second, | ||
| 692 | unsigned long third, void __user *ptr, long fifth); | ||
| 731 | 693 | ||
| 732 | asmlinkage long sys_mq_open(const char __user *name, int oflag, mode_t mode, struct mq_attr __user *attr); | 694 | asmlinkage long sys_mq_open(const char __user *name, int oflag, mode_t mode, struct mq_attr __user *attr); |
| 733 | asmlinkage long sys_mq_unlink(const char __user *name); | 695 | asmlinkage long sys_mq_unlink(const char __user *name); |
| @@ -879,4 +841,10 @@ int kernel_execve(const char *filename, char *const argv[], char *const envp[]); | |||
| 879 | asmlinkage long sys_perf_event_open( | 841 | asmlinkage long sys_perf_event_open( |
| 880 | struct perf_event_attr __user *attr_uptr, | 842 | struct perf_event_attr __user *attr_uptr, |
| 881 | pid_t pid, int cpu, int group_fd, unsigned long flags); | 843 | pid_t pid, int cpu, int group_fd, unsigned long flags); |
| 844 | |||
| 845 | asmlinkage long sys_mmap_pgoff(unsigned long addr, unsigned long len, | ||
| 846 | unsigned long prot, unsigned long flags, | ||
| 847 | unsigned long fd, unsigned long pgoff); | ||
| 848 | asmlinkage long sys_old_mmap(struct mmap_arg_struct __user *arg); | ||
| 849 | |||
| 882 | #endif | 850 | #endif |
diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h index 1e4743ee6831..f66014c90c9f 100644 --- a/include/linux/sysctl.h +++ b/include/linux/sysctl.h | |||
| @@ -15,9 +15,6 @@ | |||
| 15 | ** The kernel will then return -ENOTDIR to any application using | 15 | ** The kernel will then return -ENOTDIR to any application using |
| 16 | ** the old binary interface. | 16 | ** the old binary interface. |
| 17 | ** | 17 | ** |
| 18 | ** For new interfaces unless you really need a binary number | ||
| 19 | ** please use CTL_UNNUMBERED. | ||
| 20 | ** | ||
| 21 | **************************************************************** | 18 | **************************************************************** |
| 22 | **************************************************************** | 19 | **************************************************************** |
| 23 | */ | 20 | */ |
| @@ -50,12 +47,6 @@ struct __sysctl_args { | |||
| 50 | 47 | ||
| 51 | /* Top-level names: */ | 48 | /* Top-level names: */ |
| 52 | 49 | ||
| 53 | /* For internal pattern-matching use only: */ | ||
| 54 | #ifdef __KERNEL__ | ||
| 55 | #define CTL_NONE 0 | ||
| 56 | #define CTL_UNNUMBERED CTL_NONE /* sysctl without a binary number */ | ||
| 57 | #endif | ||
| 58 | |||
| 59 | enum | 50 | enum |
| 60 | { | 51 | { |
| 61 | CTL_KERN=1, /* General kernel info and control */ | 52 | CTL_KERN=1, /* General kernel info and control */ |
| @@ -98,8 +89,8 @@ enum | |||
| 98 | KERN_VERSION=4, /* string: compile time info */ | 89 | KERN_VERSION=4, /* string: compile time info */ |
| 99 | KERN_SECUREMASK=5, /* struct: maximum rights mask */ | 90 | KERN_SECUREMASK=5, /* struct: maximum rights mask */ |
| 100 | KERN_PROF=6, /* table: profiling information */ | 91 | KERN_PROF=6, /* table: profiling information */ |
| 101 | KERN_NODENAME=7, | 92 | KERN_NODENAME=7, /* string: hostname */ |
| 102 | KERN_DOMAINNAME=8, | 93 | KERN_DOMAINNAME=8, /* string: domainname */ |
| 103 | 94 | ||
| 104 | KERN_PANIC=15, /* int: panic timeout */ | 95 | KERN_PANIC=15, /* int: panic timeout */ |
| 105 | KERN_REALROOTDEV=16, /* real root device to mount after initrd */ | 96 | KERN_REALROOTDEV=16, /* real root device to mount after initrd */ |
| @@ -111,8 +102,8 @@ enum | |||
| 111 | KERN_PPC_HTABRECLAIM=25, /* turn htab reclaimation on/off on PPC */ | 102 | KERN_PPC_HTABRECLAIM=25, /* turn htab reclaimation on/off on PPC */ |
| 112 | KERN_PPC_ZEROPAGED=26, /* turn idle page zeroing on/off on PPC */ | 103 | KERN_PPC_ZEROPAGED=26, /* turn idle page zeroing on/off on PPC */ |
| 113 | KERN_PPC_POWERSAVE_NAP=27, /* use nap mode for power saving */ | 104 | KERN_PPC_POWERSAVE_NAP=27, /* use nap mode for power saving */ |
| 114 | KERN_MODPROBE=28, | 105 | KERN_MODPROBE=28, /* string: modprobe path */ |
| 115 | KERN_SG_BIG_BUFF=29, | 106 | KERN_SG_BIG_BUFF=29, /* int: sg driver reserved buffer size */ |
| 116 | KERN_ACCT=30, /* BSD process accounting parameters */ | 107 | KERN_ACCT=30, /* BSD process accounting parameters */ |
| 117 | KERN_PPC_L2CR=31, /* l2cr register on PPC */ | 108 | KERN_PPC_L2CR=31, /* l2cr register on PPC */ |
| 118 | 109 | ||
| @@ -159,7 +150,7 @@ enum | |||
| 159 | KERN_ACPI_VIDEO_FLAGS=71, /* int: flags for setting up video after ACPI sleep */ | 150 | KERN_ACPI_VIDEO_FLAGS=71, /* int: flags for setting up video after ACPI sleep */ |
| 160 | KERN_IA64_UNALIGNED=72, /* int: ia64 unaligned userland trap enable */ | 151 | KERN_IA64_UNALIGNED=72, /* int: ia64 unaligned userland trap enable */ |
| 161 | KERN_COMPAT_LOG=73, /* int: print compat layer messages */ | 152 | KERN_COMPAT_LOG=73, /* int: print compat layer messages */ |
| 162 | KERN_MAX_LOCK_DEPTH=74, | 153 | KERN_MAX_LOCK_DEPTH=74, /* int: rtmutex's maximum lock depth */ |
| 163 | KERN_NMI_WATCHDOG=75, /* int: enable/disable nmi watchdog */ | 154 | KERN_NMI_WATCHDOG=75, /* int: enable/disable nmi watchdog */ |
| 164 | KERN_PANIC_ON_NMI=76, /* int: whether we will panic on an unrecovered */ | 155 | KERN_PANIC_ON_NMI=76, /* int: whether we will panic on an unrecovered */ |
| 165 | }; | 156 | }; |
| @@ -490,7 +481,6 @@ enum | |||
| 490 | NET_IPV4_CONF_PROMOTE_SECONDARIES=20, | 481 | NET_IPV4_CONF_PROMOTE_SECONDARIES=20, |
| 491 | NET_IPV4_CONF_ARP_ACCEPT=21, | 482 | NET_IPV4_CONF_ARP_ACCEPT=21, |
| 492 | NET_IPV4_CONF_ARP_NOTIFY=22, | 483 | NET_IPV4_CONF_ARP_NOTIFY=22, |
| 493 | __NET_IPV4_CONF_MAX | ||
| 494 | }; | 484 | }; |
| 495 | 485 | ||
| 496 | /* /proc/sys/net/ipv4/netfilter */ | 486 | /* /proc/sys/net/ipv4/netfilter */ |
| @@ -606,7 +596,6 @@ enum { | |||
| 606 | NET_NEIGH_GC_THRESH3=16, | 596 | NET_NEIGH_GC_THRESH3=16, |
| 607 | NET_NEIGH_RETRANS_TIME_MS=17, | 597 | NET_NEIGH_RETRANS_TIME_MS=17, |
| 608 | NET_NEIGH_REACHABLE_TIME_MS=18, | 598 | NET_NEIGH_REACHABLE_TIME_MS=18, |
| 609 | __NET_NEIGH_MAX | ||
| 610 | }; | 599 | }; |
| 611 | 600 | ||
| 612 | /* /proc/sys/net/dccp */ | 601 | /* /proc/sys/net/dccp */ |
| @@ -972,10 +961,6 @@ extern int sysctl_perm(struct ctl_table_root *root, | |||
| 972 | 961 | ||
| 973 | typedef struct ctl_table ctl_table; | 962 | typedef struct ctl_table ctl_table; |
| 974 | 963 | ||
| 975 | typedef int ctl_handler (struct ctl_table *table, | ||
| 976 | void __user *oldval, size_t __user *oldlenp, | ||
| 977 | void __user *newval, size_t newlen); | ||
| 978 | |||
| 979 | typedef int proc_handler (struct ctl_table *ctl, int write, | 964 | typedef int proc_handler (struct ctl_table *ctl, int write, |
| 980 | void __user *buffer, size_t *lenp, loff_t *ppos); | 965 | void __user *buffer, size_t *lenp, loff_t *ppos); |
| 981 | 966 | ||
| @@ -996,21 +981,10 @@ extern int proc_doulongvec_minmax(struct ctl_table *, int, | |||
| 996 | extern int proc_doulongvec_ms_jiffies_minmax(struct ctl_table *table, int, | 981 | extern int proc_doulongvec_ms_jiffies_minmax(struct ctl_table *table, int, |
| 997 | void __user *, size_t *, loff_t *); | 982 | void __user *, size_t *, loff_t *); |
| 998 | 983 | ||
| 999 | extern int do_sysctl (int __user *name, int nlen, | ||
| 1000 | void __user *oldval, size_t __user *oldlenp, | ||
| 1001 | void __user *newval, size_t newlen); | ||
| 1002 | |||
| 1003 | extern ctl_handler sysctl_data; | ||
| 1004 | extern ctl_handler sysctl_string; | ||
| 1005 | extern ctl_handler sysctl_intvec; | ||
| 1006 | extern ctl_handler sysctl_jiffies; | ||
| 1007 | extern ctl_handler sysctl_ms_jiffies; | ||
| 1008 | |||
| 1009 | |||
| 1010 | /* | 984 | /* |
| 1011 | * Register a set of sysctl names by calling register_sysctl_table | 985 | * Register a set of sysctl names by calling register_sysctl_table |
| 1012 | * with an initialised array of struct ctl_table's. An entry with zero | 986 | * with an initialised array of struct ctl_table's. An entry with |
| 1013 | * ctl_name and NULL procname terminates the table. table->de will be | 987 | * NULL procname terminates the table. table->de will be |
| 1014 | * set up by the registration and need not be initialised in advance. | 988 | * set up by the registration and need not be initialised in advance. |
| 1015 | * | 989 | * |
| 1016 | * sysctl names can be mirrored automatically under /proc/sys. The | 990 | * sysctl names can be mirrored automatically under /proc/sys. The |
| @@ -1023,24 +997,11 @@ extern ctl_handler sysctl_ms_jiffies; | |||
| 1023 | * under /proc; non-leaf nodes will be represented by directories. A | 997 | * under /proc; non-leaf nodes will be represented by directories. A |
| 1024 | * null procname disables /proc mirroring at this node. | 998 | * null procname disables /proc mirroring at this node. |
| 1025 | * | 999 | * |
| 1026 | * sysctl entries with a zero ctl_name will not be available through | ||
| 1027 | * the binary sysctl interface. | ||
| 1028 | * | ||
| 1029 | * sysctl(2) can automatically manage read and write requests through | 1000 | * sysctl(2) can automatically manage read and write requests through |
| 1030 | * the sysctl table. The data and maxlen fields of the ctl_table | 1001 | * the sysctl table. The data and maxlen fields of the ctl_table |
| 1031 | * struct enable minimal validation of the values being written to be | 1002 | * struct enable minimal validation of the values being written to be |
| 1032 | * performed, and the mode field allows minimal authentication. | 1003 | * performed, and the mode field allows minimal authentication. |
| 1033 | * | 1004 | * |
| 1034 | * More sophisticated management can be enabled by the provision of a | ||
| 1035 | * strategy routine with the table entry. This will be called before | ||
| 1036 | * any automatic read or write of the data is performed. | ||
| 1037 | * | ||
| 1038 | * The strategy routine may return: | ||
| 1039 | * <0: Error occurred (error is passed to user process) | ||
| 1040 | * 0: OK - proceed with automatic read or write. | ||
| 1041 | * >0: OK - read or write has been done by the strategy routine, so | ||
| 1042 | * return immediately. | ||
| 1043 | * | ||
| 1044 | * There must be a proc_handler routine for any terminal nodes | 1005 | * There must be a proc_handler routine for any terminal nodes |
| 1045 | * mirrored under /proc/sys (non-terminals are handled by a built-in | 1006 | * mirrored under /proc/sys (non-terminals are handled by a built-in |
| 1046 | * directory handler). Several default handlers are available to | 1007 | * directory handler). Several default handlers are available to |
| @@ -1050,7 +1011,6 @@ extern ctl_handler sysctl_ms_jiffies; | |||
| 1050 | /* A sysctl table is an array of struct ctl_table: */ | 1011 | /* A sysctl table is an array of struct ctl_table: */ |
| 1051 | struct ctl_table | 1012 | struct ctl_table |
| 1052 | { | 1013 | { |
| 1053 | int ctl_name; /* Binary ID */ | ||
| 1054 | const char *procname; /* Text ID for /proc/sys, or zero */ | 1014 | const char *procname; /* Text ID for /proc/sys, or zero */ |
| 1055 | void *data; | 1015 | void *data; |
| 1056 | int maxlen; | 1016 | int maxlen; |
| @@ -1058,7 +1018,6 @@ struct ctl_table | |||
| 1058 | struct ctl_table *child; | 1018 | struct ctl_table *child; |
| 1059 | struct ctl_table *parent; /* Automatically set */ | 1019 | struct ctl_table *parent; /* Automatically set */ |
| 1060 | proc_handler *proc_handler; /* Callback for text formatting */ | 1020 | proc_handler *proc_handler; /* Callback for text formatting */ |
| 1061 | ctl_handler *strategy; /* Callback function for all r/w */ | ||
| 1062 | void *extra1; | 1021 | void *extra1; |
| 1063 | void *extra2; | 1022 | void *extra2; |
| 1064 | }; | 1023 | }; |
| @@ -1092,7 +1051,6 @@ struct ctl_table_header | |||
| 1092 | /* struct ctl_path describes where in the hierarchy a table is added */ | 1051 | /* struct ctl_path describes where in the hierarchy a table is added */ |
| 1093 | struct ctl_path { | 1052 | struct ctl_path { |
| 1094 | const char *procname; | 1053 | const char *procname; |
| 1095 | int ctl_name; | ||
| 1096 | }; | 1054 | }; |
| 1097 | 1055 | ||
| 1098 | void register_sysctl_root(struct ctl_table_root *root); | 1056 | void register_sysctl_root(struct ctl_table_root *root); |
diff --git a/include/linux/sysdev.h b/include/linux/sysdev.h index f395bb3fa2f2..1154c29f4101 100644 --- a/include/linux/sysdev.h +++ b/include/linux/sysdev.h | |||
| @@ -27,10 +27,12 @@ | |||
| 27 | 27 | ||
| 28 | 28 | ||
| 29 | struct sys_device; | 29 | struct sys_device; |
| 30 | struct sysdev_class_attribute; | ||
| 30 | 31 | ||
| 31 | struct sysdev_class { | 32 | struct sysdev_class { |
| 32 | const char *name; | 33 | const char *name; |
| 33 | struct list_head drivers; | 34 | struct list_head drivers; |
| 35 | struct sysdev_class_attribute **attrs; | ||
| 34 | 36 | ||
| 35 | /* Default operations for these types of devices */ | 37 | /* Default operations for these types of devices */ |
| 36 | int (*shutdown)(struct sys_device *); | 38 | int (*shutdown)(struct sys_device *); |
| @@ -41,8 +43,10 @@ struct sysdev_class { | |||
| 41 | 43 | ||
| 42 | struct sysdev_class_attribute { | 44 | struct sysdev_class_attribute { |
| 43 | struct attribute attr; | 45 | struct attribute attr; |
| 44 | ssize_t (*show)(struct sysdev_class *, char *); | 46 | ssize_t (*show)(struct sysdev_class *, struct sysdev_class_attribute *, |
| 45 | ssize_t (*store)(struct sysdev_class *, const char *, size_t); | 47 | char *); |
| 48 | ssize_t (*store)(struct sysdev_class *, struct sysdev_class_attribute *, | ||
| 49 | const char *, size_t); | ||
| 46 | }; | 50 | }; |
| 47 | 51 | ||
| 48 | #define _SYSDEV_CLASS_ATTR(_name,_mode,_show,_store) \ | 52 | #define _SYSDEV_CLASS_ATTR(_name,_mode,_show,_store) \ |
| @@ -119,6 +123,19 @@ struct sysdev_attribute { | |||
| 119 | extern int sysdev_create_file(struct sys_device *, struct sysdev_attribute *); | 123 | extern int sysdev_create_file(struct sys_device *, struct sysdev_attribute *); |
| 120 | extern void sysdev_remove_file(struct sys_device *, struct sysdev_attribute *); | 124 | extern void sysdev_remove_file(struct sys_device *, struct sysdev_attribute *); |
| 121 | 125 | ||
| 126 | /* Create/remove NULL terminated attribute list */ | ||
| 127 | static inline int | ||
| 128 | sysdev_create_files(struct sys_device *d, struct sysdev_attribute **a) | ||
| 129 | { | ||
| 130 | return sysfs_create_files(&d->kobj, (const struct attribute **)a); | ||
| 131 | } | ||
| 132 | |||
| 133 | static inline void | ||
| 134 | sysdev_remove_files(struct sys_device *d, struct sysdev_attribute **a) | ||
| 135 | { | ||
| 136 | return sysfs_remove_files(&d->kobj, (const struct attribute **)a); | ||
| 137 | } | ||
| 138 | |||
| 122 | struct sysdev_ext_attribute { | 139 | struct sysdev_ext_attribute { |
| 123 | struct sysdev_attribute attr; | 140 | struct sysdev_attribute attr; |
| 124 | void *var; | 141 | void *var; |
diff --git a/include/linux/sysfs.h b/include/linux/sysfs.h index 9d68fed50f11..f0496b3d1811 100644 --- a/include/linux/sysfs.h +++ b/include/linux/sysfs.h | |||
| @@ -15,6 +15,7 @@ | |||
| 15 | #include <linux/compiler.h> | 15 | #include <linux/compiler.h> |
| 16 | #include <linux/errno.h> | 16 | #include <linux/errno.h> |
| 17 | #include <linux/list.h> | 17 | #include <linux/list.h> |
| 18 | #include <linux/lockdep.h> | ||
| 18 | #include <asm/atomic.h> | 19 | #include <asm/atomic.h> |
| 19 | 20 | ||
| 20 | struct kobject; | 21 | struct kobject; |
| @@ -29,8 +30,33 @@ struct attribute { | |||
| 29 | const char *name; | 30 | const char *name; |
| 30 | struct module *owner; | 31 | struct module *owner; |
| 31 | mode_t mode; | 32 | mode_t mode; |
| 33 | #ifdef CONFIG_DEBUG_LOCK_ALLOC | ||
| 34 | struct lock_class_key *key; | ||
| 35 | struct lock_class_key skey; | ||
| 36 | #endif | ||
| 32 | }; | 37 | }; |
| 33 | 38 | ||
| 39 | /** | ||
| 40 | * sysfs_attr_init - initialize a dynamically allocated sysfs attribute | ||
| 41 | * @attr: struct attribute to initialize | ||
| 42 | * | ||
| 43 | * Initialize a dynamically allocated struct attribute so we can | ||
| 44 | * make lockdep happy. This is a new requirement for attributes | ||
| 45 | * and initially this is only needed when lockdep is enabled. | ||
| 46 | * Lockdep gives a nice error when your attribute is added to | ||
| 47 | * sysfs if you don't have this. | ||
| 48 | */ | ||
| 49 | #ifdef CONFIG_DEBUG_LOCK_ALLOC | ||
| 50 | #define sysfs_attr_init(attr) \ | ||
| 51 | do { \ | ||
| 52 | static struct lock_class_key __key; \ | ||
| 53 | \ | ||
| 54 | (attr)->key = &__key; \ | ||
| 55 | } while(0) | ||
| 56 | #else | ||
| 57 | #define sysfs_attr_init(attr) do {} while(0) | ||
| 58 | #endif | ||
| 59 | |||
| 34 | struct attribute_group { | 60 | struct attribute_group { |
| 35 | const char *name; | 61 | const char *name; |
| 36 | mode_t (*is_visible)(struct kobject *, | 62 | mode_t (*is_visible)(struct kobject *, |
| @@ -74,6 +100,18 @@ struct bin_attribute { | |||
| 74 | struct vm_area_struct *vma); | 100 | struct vm_area_struct *vma); |
| 75 | }; | 101 | }; |
| 76 | 102 | ||
| 103 | /** | ||
| 104 | * sysfs_bin_attr_init - initialize a dynamically allocated bin_attribute | ||
| 105 | * @attr: struct bin_attribute to initialize | ||
| 106 | * | ||
| 107 | * Initialize a dynamically allocated struct bin_attribute so we | ||
| 108 | * can make lockdep happy. This is a new requirement for | ||
| 109 | * attributes and initially this is only needed when lockdep is | ||
| 110 | * enabled. Lockdep gives a nice error when your attribute is | ||
| 111 | * added to sysfs if you don't have this. | ||
| 112 | */ | ||
| 113 | #define sysfs_bin_attr_init(bin_attr) sysfs_attr_init(&(bin_attr)->attr) | ||
| 114 | |||
| 77 | struct sysfs_ops { | 115 | struct sysfs_ops { |
| 78 | ssize_t (*show)(struct kobject *, struct attribute *,char *); | 116 | ssize_t (*show)(struct kobject *, struct attribute *,char *); |
| 79 | ssize_t (*store)(struct kobject *,struct attribute *,const char *, size_t); | 117 | ssize_t (*store)(struct kobject *,struct attribute *,const char *, size_t); |
| @@ -94,13 +132,17 @@ int __must_check sysfs_move_dir(struct kobject *kobj, | |||
| 94 | 132 | ||
| 95 | int __must_check sysfs_create_file(struct kobject *kobj, | 133 | int __must_check sysfs_create_file(struct kobject *kobj, |
| 96 | const struct attribute *attr); | 134 | const struct attribute *attr); |
| 135 | int __must_check sysfs_create_files(struct kobject *kobj, | ||
| 136 | const struct attribute **attr); | ||
| 97 | int __must_check sysfs_chmod_file(struct kobject *kobj, struct attribute *attr, | 137 | int __must_check sysfs_chmod_file(struct kobject *kobj, struct attribute *attr, |
| 98 | mode_t mode); | 138 | mode_t mode); |
| 99 | void sysfs_remove_file(struct kobject *kobj, const struct attribute *attr); | 139 | void sysfs_remove_file(struct kobject *kobj, const struct attribute *attr); |
| 140 | void sysfs_remove_files(struct kobject *kobj, const struct attribute **attr); | ||
| 100 | 141 | ||
| 101 | int __must_check sysfs_create_bin_file(struct kobject *kobj, | 142 | int __must_check sysfs_create_bin_file(struct kobject *kobj, |
| 102 | struct bin_attribute *attr); | 143 | const struct bin_attribute *attr); |
| 103 | void sysfs_remove_bin_file(struct kobject *kobj, struct bin_attribute *attr); | 144 | void sysfs_remove_bin_file(struct kobject *kobj, |
| 145 | const struct bin_attribute *attr); | ||
| 104 | 146 | ||
| 105 | int __must_check sysfs_create_link(struct kobject *kobj, struct kobject *target, | 147 | int __must_check sysfs_create_link(struct kobject *kobj, struct kobject *target, |
| 106 | const char *name); | 148 | const char *name); |
| @@ -109,6 +151,9 @@ int __must_check sysfs_create_link_nowarn(struct kobject *kobj, | |||
| 109 | const char *name); | 151 | const char *name); |
| 110 | void sysfs_remove_link(struct kobject *kobj, const char *name); | 152 | void sysfs_remove_link(struct kobject *kobj, const char *name); |
| 111 | 153 | ||
| 154 | int sysfs_rename_link(struct kobject *kobj, struct kobject *target, | ||
| 155 | const char *old_name, const char *new_name); | ||
| 156 | |||
| 112 | int __must_check sysfs_create_group(struct kobject *kobj, | 157 | int __must_check sysfs_create_group(struct kobject *kobj, |
| 113 | const struct attribute_group *grp); | 158 | const struct attribute_group *grp); |
| 114 | int sysfs_update_group(struct kobject *kobj, | 159 | int sysfs_update_group(struct kobject *kobj, |
| @@ -163,6 +208,12 @@ static inline int sysfs_create_file(struct kobject *kobj, | |||
| 163 | return 0; | 208 | return 0; |
| 164 | } | 209 | } |
| 165 | 210 | ||
| 211 | static inline int sysfs_create_files(struct kobject *kobj, | ||
| 212 | const struct attribute **attr) | ||
| 213 | { | ||
| 214 | return 0; | ||
| 215 | } | ||
| 216 | |||
| 166 | static inline int sysfs_chmod_file(struct kobject *kobj, | 217 | static inline int sysfs_chmod_file(struct kobject *kobj, |
| 167 | struct attribute *attr, mode_t mode) | 218 | struct attribute *attr, mode_t mode) |
| 168 | { | 219 | { |
| @@ -174,14 +225,19 @@ static inline void sysfs_remove_file(struct kobject *kobj, | |||
| 174 | { | 225 | { |
| 175 | } | 226 | } |
| 176 | 227 | ||
| 228 | static inline void sysfs_remove_files(struct kobject *kobj, | ||
| 229 | const struct attribute **attr) | ||
| 230 | { | ||
| 231 | } | ||
| 232 | |||
| 177 | static inline int sysfs_create_bin_file(struct kobject *kobj, | 233 | static inline int sysfs_create_bin_file(struct kobject *kobj, |
| 178 | struct bin_attribute *attr) | 234 | const struct bin_attribute *attr) |
| 179 | { | 235 | { |
| 180 | return 0; | 236 | return 0; |
| 181 | } | 237 | } |
| 182 | 238 | ||
| 183 | static inline void sysfs_remove_bin_file(struct kobject *kobj, | 239 | static inline void sysfs_remove_bin_file(struct kobject *kobj, |
| 184 | struct bin_attribute *attr) | 240 | const struct bin_attribute *attr) |
| 185 | { | 241 | { |
| 186 | } | 242 | } |
| 187 | 243 | ||
| @@ -202,6 +258,12 @@ static inline void sysfs_remove_link(struct kobject *kobj, const char *name) | |||
| 202 | { | 258 | { |
| 203 | } | 259 | } |
| 204 | 260 | ||
| 261 | static inline int sysfs_rename_link(struct kobject *k, struct kobject *t, | ||
| 262 | const char *old_name, const char *new_name) | ||
| 263 | { | ||
| 264 | return 0; | ||
| 265 | } | ||
| 266 | |||
| 205 | static inline int sysfs_create_group(struct kobject *kobj, | 267 | static inline int sysfs_create_group(struct kobject *kobj, |
| 206 | const struct attribute_group *grp) | 268 | const struct attribute_group *grp) |
| 207 | { | 269 | { |
diff --git a/include/linux/syslog.h b/include/linux/syslog.h new file mode 100644 index 000000000000..38911391a139 --- /dev/null +++ b/include/linux/syslog.h | |||
| @@ -0,0 +1,52 @@ | |||
| 1 | /* Syslog internals | ||
| 2 | * | ||
| 3 | * Copyright 2010 Canonical, Ltd. | ||
| 4 | * Author: Kees Cook <kees.cook@canonical.com> | ||
| 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, or (at your option) | ||
| 9 | * any later version. | ||
| 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 | * You should have received a copy of the GNU General Public License | ||
| 17 | * along with this program; see the file COPYING. If not, write to | ||
| 18 | * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. | ||
| 19 | */ | ||
| 20 | |||
| 21 | #ifndef _LINUX_SYSLOG_H | ||
| 22 | #define _LINUX_SYSLOG_H | ||
| 23 | |||
| 24 | /* Close the log. Currently a NOP. */ | ||
| 25 | #define SYSLOG_ACTION_CLOSE 0 | ||
| 26 | /* Open the log. Currently a NOP. */ | ||
| 27 | #define SYSLOG_ACTION_OPEN 1 | ||
| 28 | /* Read from the log. */ | ||
| 29 | #define SYSLOG_ACTION_READ 2 | ||
| 30 | /* Read all messages remaining in the ring buffer. */ | ||
| 31 | #define SYSLOG_ACTION_READ_ALL 3 | ||
| 32 | /* Read and clear all messages remaining in the ring buffer */ | ||
| 33 | #define SYSLOG_ACTION_READ_CLEAR 4 | ||
| 34 | /* Clear ring buffer. */ | ||
| 35 | #define SYSLOG_ACTION_CLEAR 5 | ||
| 36 | /* Disable printk's to console */ | ||
| 37 | #define SYSLOG_ACTION_CONSOLE_OFF 6 | ||
| 38 | /* Enable printk's to console */ | ||
| 39 | #define SYSLOG_ACTION_CONSOLE_ON 7 | ||
| 40 | /* Set level of messages printed to console */ | ||
| 41 | #define SYSLOG_ACTION_CONSOLE_LEVEL 8 | ||
| 42 | /* Return number of unread characters in the log buffer */ | ||
| 43 | #define SYSLOG_ACTION_SIZE_UNREAD 9 | ||
| 44 | /* Return size of the log buffer */ | ||
| 45 | #define SYSLOG_ACTION_SIZE_BUFFER 10 | ||
| 46 | |||
| 47 | #define SYSLOG_FROM_CALL 0 | ||
| 48 | #define SYSLOG_FROM_FILE 1 | ||
| 49 | |||
| 50 | int do_syslog(int type, char __user *buf, int count, bool from_file); | ||
| 51 | |||
| 52 | #endif /* _LINUX_SYSLOG_H */ | ||
diff --git a/include/linux/taskstats_kern.h b/include/linux/taskstats_kern.h index 3398f4553269..58de6edf751f 100644 --- a/include/linux/taskstats_kern.h +++ b/include/linux/taskstats_kern.h | |||
| @@ -9,16 +9,12 @@ | |||
| 9 | 9 | ||
| 10 | #include <linux/taskstats.h> | 10 | #include <linux/taskstats.h> |
| 11 | #include <linux/sched.h> | 11 | #include <linux/sched.h> |
| 12 | #include <linux/slab.h> | ||
| 12 | 13 | ||
| 13 | #ifdef CONFIG_TASKSTATS | 14 | #ifdef CONFIG_TASKSTATS |
| 14 | extern struct kmem_cache *taskstats_cache; | 15 | extern struct kmem_cache *taskstats_cache; |
| 15 | extern struct mutex taskstats_exit_mutex; | 16 | extern struct mutex taskstats_exit_mutex; |
| 16 | 17 | ||
| 17 | static inline void taskstats_tgid_init(struct signal_struct *sig) | ||
| 18 | { | ||
| 19 | sig->stats = NULL; | ||
| 20 | } | ||
| 21 | |||
| 22 | static inline void taskstats_tgid_free(struct signal_struct *sig) | 18 | static inline void taskstats_tgid_free(struct signal_struct *sig) |
| 23 | { | 19 | { |
| 24 | if (sig->stats) | 20 | if (sig->stats) |
| @@ -30,8 +26,6 @@ extern void taskstats_init_early(void); | |||
| 30 | #else | 26 | #else |
| 31 | static inline void taskstats_exit(struct task_struct *tsk, int group_dead) | 27 | static inline void taskstats_exit(struct task_struct *tsk, int group_dead) |
| 32 | {} | 28 | {} |
| 33 | static inline void taskstats_tgid_init(struct signal_struct *sig) | ||
| 34 | {} | ||
| 35 | static inline void taskstats_tgid_free(struct signal_struct *sig) | 29 | static inline void taskstats_tgid_free(struct signal_struct *sig) |
| 36 | {} | 30 | {} |
| 37 | static inline void taskstats_init_early(void) | 31 | static inline void taskstats_init_early(void) |
diff --git a/include/linux/tc_act/tc_defact.h b/include/linux/tc_act/tc_defact.h index 964f473af0f0..6f65d07c7ce2 100644 --- a/include/linux/tc_act/tc_defact.h +++ b/include/linux/tc_act/tc_defact.h | |||
| @@ -3,13 +3,11 @@ | |||
| 3 | 3 | ||
| 4 | #include <linux/pkt_cls.h> | 4 | #include <linux/pkt_cls.h> |
| 5 | 5 | ||
| 6 | struct tc_defact | 6 | struct tc_defact { |
| 7 | { | ||
| 8 | tc_gen; | 7 | tc_gen; |
| 9 | }; | 8 | }; |
| 10 | 9 | ||
| 11 | enum | 10 | enum { |
| 12 | { | ||
| 13 | TCA_DEF_UNSPEC, | 11 | TCA_DEF_UNSPEC, |
| 14 | TCA_DEF_TM, | 12 | TCA_DEF_TM, |
| 15 | TCA_DEF_PARMS, | 13 | TCA_DEF_PARMS, |
diff --git a/include/linux/tc_act/tc_gact.h b/include/linux/tc_act/tc_gact.h index e895c0a39629..f7bf94eed510 100644 --- a/include/linux/tc_act/tc_gact.h +++ b/include/linux/tc_act/tc_gact.h | |||
| @@ -5,14 +5,12 @@ | |||
| 5 | #include <linux/pkt_cls.h> | 5 | #include <linux/pkt_cls.h> |
| 6 | 6 | ||
| 7 | #define TCA_ACT_GACT 5 | 7 | #define TCA_ACT_GACT 5 |
| 8 | struct tc_gact | 8 | struct tc_gact { |
| 9 | { | ||
| 10 | tc_gen; | 9 | tc_gen; |
| 11 | 10 | ||
| 12 | }; | 11 | }; |
| 13 | 12 | ||
| 14 | struct tc_gact_p | 13 | struct tc_gact_p { |
| 15 | { | ||
| 16 | #define PGACT_NONE 0 | 14 | #define PGACT_NONE 0 |
| 17 | #define PGACT_NETRAND 1 | 15 | #define PGACT_NETRAND 1 |
| 18 | #define PGACT_DETERM 2 | 16 | #define PGACT_DETERM 2 |
| @@ -22,8 +20,7 @@ struct tc_gact_p | |||
| 22 | int paction; | 20 | int paction; |
| 23 | }; | 21 | }; |
| 24 | 22 | ||
| 25 | enum | 23 | enum { |
| 26 | { | ||
| 27 | TCA_GACT_UNSPEC, | 24 | TCA_GACT_UNSPEC, |
| 28 | TCA_GACT_TM, | 25 | TCA_GACT_TM, |
| 29 | TCA_GACT_PARMS, | 26 | TCA_GACT_PARMS, |
diff --git a/include/linux/tc_act/tc_ipt.h b/include/linux/tc_act/tc_ipt.h index 4b6f7b6c7a79..a2335563d21f 100644 --- a/include/linux/tc_act/tc_ipt.h +++ b/include/linux/tc_act/tc_ipt.h | |||
| @@ -5,8 +5,7 @@ | |||
| 5 | 5 | ||
| 6 | #define TCA_ACT_IPT 6 | 6 | #define TCA_ACT_IPT 6 |
| 7 | 7 | ||
| 8 | enum | 8 | enum { |
| 9 | { | ||
| 10 | TCA_IPT_UNSPEC, | 9 | TCA_IPT_UNSPEC, |
| 11 | TCA_IPT_TABLE, | 10 | TCA_IPT_TABLE, |
| 12 | TCA_IPT_HOOK, | 11 | TCA_IPT_HOOK, |
diff --git a/include/linux/tc_act/tc_mirred.h b/include/linux/tc_act/tc_mirred.h index 0a99ab60d610..7561750e8fd6 100644 --- a/include/linux/tc_act/tc_mirred.h +++ b/include/linux/tc_act/tc_mirred.h | |||
| @@ -10,15 +10,13 @@ | |||
| 10 | #define TCA_INGRESS_REDIR 3 /* packet redirect to INGRESS*/ | 10 | #define TCA_INGRESS_REDIR 3 /* packet redirect to INGRESS*/ |
| 11 | #define TCA_INGRESS_MIRROR 4 /* mirror packet to INGRESS */ | 11 | #define TCA_INGRESS_MIRROR 4 /* mirror packet to INGRESS */ |
| 12 | 12 | ||
| 13 | struct tc_mirred | 13 | struct tc_mirred { |
| 14 | { | ||
| 15 | tc_gen; | 14 | tc_gen; |
| 16 | int eaction; /* one of IN/EGRESS_MIRROR/REDIR */ | 15 | int eaction; /* one of IN/EGRESS_MIRROR/REDIR */ |
| 17 | __u32 ifindex; /* ifindex of egress port */ | 16 | __u32 ifindex; /* ifindex of egress port */ |
| 18 | }; | 17 | }; |
| 19 | 18 | ||
| 20 | enum | 19 | enum { |
| 21 | { | ||
| 22 | TCA_MIRRED_UNSPEC, | 20 | TCA_MIRRED_UNSPEC, |
| 23 | TCA_MIRRED_TM, | 21 | TCA_MIRRED_TM, |
| 24 | TCA_MIRRED_PARMS, | 22 | TCA_MIRRED_PARMS, |
diff --git a/include/linux/tc_act/tc_nat.h b/include/linux/tc_act/tc_nat.h index e7cf31e8ba79..6663aeba0b9a 100644 --- a/include/linux/tc_act/tc_nat.h +++ b/include/linux/tc_act/tc_nat.h | |||
| @@ -6,8 +6,7 @@ | |||
| 6 | 6 | ||
| 7 | #define TCA_ACT_NAT 9 | 7 | #define TCA_ACT_NAT 9 |
| 8 | 8 | ||
| 9 | enum | 9 | enum { |
| 10 | { | ||
| 11 | TCA_NAT_UNSPEC, | 10 | TCA_NAT_UNSPEC, |
| 12 | TCA_NAT_PARMS, | 11 | TCA_NAT_PARMS, |
| 13 | TCA_NAT_TM, | 12 | TCA_NAT_TM, |
| @@ -17,8 +16,7 @@ enum | |||
| 17 | 16 | ||
| 18 | #define TCA_NAT_FLAG_EGRESS 1 | 17 | #define TCA_NAT_FLAG_EGRESS 1 |
| 19 | 18 | ||
| 20 | struct tc_nat | 19 | struct tc_nat { |
| 21 | { | ||
| 22 | tc_gen; | 20 | tc_gen; |
| 23 | __be32 old_addr; | 21 | __be32 old_addr; |
| 24 | __be32 new_addr; | 22 | __be32 new_addr; |
diff --git a/include/linux/tc_act/tc_pedit.h b/include/linux/tc_act/tc_pedit.h index 54ce9064115a..716cfabcd5b2 100644 --- a/include/linux/tc_act/tc_pedit.h +++ b/include/linux/tc_act/tc_pedit.h | |||
| @@ -6,8 +6,7 @@ | |||
| 6 | 6 | ||
| 7 | #define TCA_ACT_PEDIT 7 | 7 | #define TCA_ACT_PEDIT 7 |
| 8 | 8 | ||
| 9 | enum | 9 | enum { |
| 10 | { | ||
| 11 | TCA_PEDIT_UNSPEC, | 10 | TCA_PEDIT_UNSPEC, |
| 12 | TCA_PEDIT_TM, | 11 | TCA_PEDIT_TM, |
| 13 | TCA_PEDIT_PARMS, | 12 | TCA_PEDIT_PARMS, |
| @@ -15,8 +14,7 @@ enum | |||
| 15 | }; | 14 | }; |
| 16 | #define TCA_PEDIT_MAX (__TCA_PEDIT_MAX - 1) | 15 | #define TCA_PEDIT_MAX (__TCA_PEDIT_MAX - 1) |
| 17 | 16 | ||
| 18 | struct tc_pedit_key | 17 | struct tc_pedit_key { |
| 19 | { | ||
| 20 | __u32 mask; /* AND */ | 18 | __u32 mask; /* AND */ |
| 21 | __u32 val; /*XOR */ | 19 | __u32 val; /*XOR */ |
| 22 | __u32 off; /*offset */ | 20 | __u32 off; /*offset */ |
| @@ -25,8 +23,7 @@ struct tc_pedit_key | |||
| 25 | __u32 shift; | 23 | __u32 shift; |
| 26 | }; | 24 | }; |
| 27 | 25 | ||
| 28 | struct tc_pedit_sel | 26 | struct tc_pedit_sel { |
| 29 | { | ||
| 30 | tc_gen; | 27 | tc_gen; |
| 31 | unsigned char nkeys; | 28 | unsigned char nkeys; |
| 32 | unsigned char flags; | 29 | unsigned char flags; |
diff --git a/include/linux/tc_act/tc_skbedit.h b/include/linux/tc_act/tc_skbedit.h index a14e461a7af7..7a2e910a5f08 100644 --- a/include/linux/tc_act/tc_skbedit.h +++ b/include/linux/tc_act/tc_skbedit.h | |||
| @@ -26,6 +26,7 @@ | |||
| 26 | 26 | ||
| 27 | #define SKBEDIT_F_PRIORITY 0x1 | 27 | #define SKBEDIT_F_PRIORITY 0x1 |
| 28 | #define SKBEDIT_F_QUEUE_MAPPING 0x2 | 28 | #define SKBEDIT_F_QUEUE_MAPPING 0x2 |
| 29 | #define SKBEDIT_F_MARK 0x4 | ||
| 29 | 30 | ||
| 30 | struct tc_skbedit { | 31 | struct tc_skbedit { |
| 31 | tc_gen; | 32 | tc_gen; |
| @@ -37,6 +38,7 @@ enum { | |||
| 37 | TCA_SKBEDIT_PARMS, | 38 | TCA_SKBEDIT_PARMS, |
| 38 | TCA_SKBEDIT_PRIORITY, | 39 | TCA_SKBEDIT_PRIORITY, |
| 39 | TCA_SKBEDIT_QUEUE_MAPPING, | 40 | TCA_SKBEDIT_QUEUE_MAPPING, |
| 41 | TCA_SKBEDIT_MARK, | ||
| 40 | __TCA_SKBEDIT_MAX | 42 | __TCA_SKBEDIT_MAX |
| 41 | }; | 43 | }; |
| 42 | #define TCA_SKBEDIT_MAX (__TCA_SKBEDIT_MAX - 1) | 44 | #define TCA_SKBEDIT_MAX (__TCA_SKBEDIT_MAX - 1) |
diff --git a/include/linux/tc_ematch/tc_em_cmp.h b/include/linux/tc_ematch/tc_em_cmp.h index 38e7f7b25ec2..f34bb1bae083 100644 --- a/include/linux/tc_ematch/tc_em_cmp.h +++ b/include/linux/tc_ematch/tc_em_cmp.h | |||
| @@ -4,8 +4,7 @@ | |||
| 4 | #include <linux/types.h> | 4 | #include <linux/types.h> |
| 5 | #include <linux/pkt_cls.h> | 5 | #include <linux/pkt_cls.h> |
| 6 | 6 | ||
| 7 | struct tcf_em_cmp | 7 | struct tcf_em_cmp { |
| 8 | { | ||
| 9 | __u32 val; | 8 | __u32 val; |
| 10 | __u32 mask; | 9 | __u32 mask; |
| 11 | __u16 off; | 10 | __u16 off; |
| @@ -15,8 +14,7 @@ struct tcf_em_cmp | |||
| 15 | __u8 opnd:4; | 14 | __u8 opnd:4; |
| 16 | }; | 15 | }; |
| 17 | 16 | ||
| 18 | enum | 17 | enum { |
| 19 | { | ||
| 20 | TCF_EM_ALIGN_U8 = 1, | 18 | TCF_EM_ALIGN_U8 = 1, |
| 21 | TCF_EM_ALIGN_U16 = 2, | 19 | TCF_EM_ALIGN_U16 = 2, |
| 22 | TCF_EM_ALIGN_U32 = 4 | 20 | TCF_EM_ALIGN_U32 = 4 |
diff --git a/include/linux/tc_ematch/tc_em_meta.h b/include/linux/tc_ematch/tc_em_meta.h index dcfb733fa1f6..0864206ec1a3 100644 --- a/include/linux/tc_ematch/tc_em_meta.h +++ b/include/linux/tc_ematch/tc_em_meta.h | |||
| @@ -4,8 +4,7 @@ | |||
| 4 | #include <linux/types.h> | 4 | #include <linux/types.h> |
| 5 | #include <linux/pkt_cls.h> | 5 | #include <linux/pkt_cls.h> |
| 6 | 6 | ||
| 7 | enum | 7 | enum { |
| 8 | { | ||
| 9 | TCA_EM_META_UNSPEC, | 8 | TCA_EM_META_UNSPEC, |
| 10 | TCA_EM_META_HDR, | 9 | TCA_EM_META_HDR, |
| 11 | TCA_EM_META_LVALUE, | 10 | TCA_EM_META_LVALUE, |
| @@ -14,8 +13,7 @@ enum | |||
| 14 | }; | 13 | }; |
| 15 | #define TCA_EM_META_MAX (__TCA_EM_META_MAX - 1) | 14 | #define TCA_EM_META_MAX (__TCA_EM_META_MAX - 1) |
| 16 | 15 | ||
| 17 | struct tcf_meta_val | 16 | struct tcf_meta_val { |
| 18 | { | ||
| 19 | __u16 kind; | 17 | __u16 kind; |
| 20 | __u8 shift; | 18 | __u8 shift; |
| 21 | __u8 op; | 19 | __u8 op; |
| @@ -26,16 +24,14 @@ struct tcf_meta_val | |||
| 26 | #define TCF_META_ID_MASK 0x7ff | 24 | #define TCF_META_ID_MASK 0x7ff |
| 27 | #define TCF_META_ID(kind) ((kind) & TCF_META_ID_MASK) | 25 | #define TCF_META_ID(kind) ((kind) & TCF_META_ID_MASK) |
| 28 | 26 | ||
| 29 | enum | 27 | enum { |
| 30 | { | ||
| 31 | TCF_META_TYPE_VAR, | 28 | TCF_META_TYPE_VAR, |
| 32 | TCF_META_TYPE_INT, | 29 | TCF_META_TYPE_INT, |
| 33 | __TCF_META_TYPE_MAX | 30 | __TCF_META_TYPE_MAX |
| 34 | }; | 31 | }; |
| 35 | #define TCF_META_TYPE_MAX (__TCF_META_TYPE_MAX - 1) | 32 | #define TCF_META_TYPE_MAX (__TCF_META_TYPE_MAX - 1) |
| 36 | 33 | ||
| 37 | enum | 34 | enum { |
| 38 | { | ||
| 39 | TCF_META_ID_VALUE, | 35 | TCF_META_ID_VALUE, |
| 40 | TCF_META_ID_RANDOM, | 36 | TCF_META_ID_RANDOM, |
| 41 | TCF_META_ID_LOADAVG_0, | 37 | TCF_META_ID_LOADAVG_0, |
| @@ -87,8 +83,7 @@ enum | |||
| 87 | }; | 83 | }; |
| 88 | #define TCF_META_ID_MAX (__TCF_META_ID_MAX - 1) | 84 | #define TCF_META_ID_MAX (__TCF_META_ID_MAX - 1) |
| 89 | 85 | ||
| 90 | struct tcf_meta_hdr | 86 | struct tcf_meta_hdr { |
| 91 | { | ||
| 92 | struct tcf_meta_val left; | 87 | struct tcf_meta_val left; |
| 93 | struct tcf_meta_val right; | 88 | struct tcf_meta_val right; |
| 94 | }; | 89 | }; |
diff --git a/include/linux/tc_ematch/tc_em_nbyte.h b/include/linux/tc_ematch/tc_em_nbyte.h index 9ed8c2e58488..7172cfb999c1 100644 --- a/include/linux/tc_ematch/tc_em_nbyte.h +++ b/include/linux/tc_ematch/tc_em_nbyte.h | |||
| @@ -4,8 +4,7 @@ | |||
| 4 | #include <linux/types.h> | 4 | #include <linux/types.h> |
| 5 | #include <linux/pkt_cls.h> | 5 | #include <linux/pkt_cls.h> |
| 6 | 6 | ||
| 7 | struct tcf_em_nbyte | 7 | struct tcf_em_nbyte { |
| 8 | { | ||
| 9 | __u16 off; | 8 | __u16 off; |
| 10 | __u16 len:12; | 9 | __u16 len:12; |
| 11 | __u8 layer:4; | 10 | __u8 layer:4; |
diff --git a/include/linux/tc_ematch/tc_em_text.h b/include/linux/tc_ematch/tc_em_text.h index d12a73a225fc..5aac4045ba88 100644 --- a/include/linux/tc_ematch/tc_em_text.h +++ b/include/linux/tc_ematch/tc_em_text.h | |||
| @@ -6,8 +6,7 @@ | |||
| 6 | 6 | ||
| 7 | #define TC_EM_TEXT_ALGOSIZ 16 | 7 | #define TC_EM_TEXT_ALGOSIZ 16 |
| 8 | 8 | ||
| 9 | struct tcf_em_text | 9 | struct tcf_em_text { |
| 10 | { | ||
| 11 | char algo[TC_EM_TEXT_ALGOSIZ]; | 10 | char algo[TC_EM_TEXT_ALGOSIZ]; |
| 12 | __u16 from_offset; | 11 | __u16 from_offset; |
| 13 | __u16 to_offset; | 12 | __u16 to_offset; |
diff --git a/include/linux/tcp.h b/include/linux/tcp.h index 61723a7c21fe..a778ee024590 100644 --- a/include/linux/tcp.h +++ b/include/linux/tcp.h | |||
| @@ -81,6 +81,12 @@ enum { | |||
| 81 | TCP_DATA_OFFSET = __cpu_to_be32(0xF0000000) | 81 | TCP_DATA_OFFSET = __cpu_to_be32(0xF0000000) |
| 82 | }; | 82 | }; |
| 83 | 83 | ||
| 84 | /* | ||
| 85 | * TCP general constants | ||
| 86 | */ | ||
| 87 | #define TCP_MSS_DEFAULT 536U /* IPv4 (RFC1122, RFC2581) */ | ||
| 88 | #define TCP_MSS_DESIRED 1220U /* IPv6 (tunneled), EDNS0 (RFC3226) */ | ||
| 89 | |||
| 84 | /* TCP socket options */ | 90 | /* TCP socket options */ |
| 85 | #define TCP_NODELAY 1 /* Turn off Nagle's algorithm. */ | 91 | #define TCP_NODELAY 1 /* Turn off Nagle's algorithm. */ |
| 86 | #define TCP_MAXSEG 2 /* Limit MSS */ | 92 | #define TCP_MAXSEG 2 /* Limit MSS */ |
| @@ -96,14 +102,17 @@ enum { | |||
| 96 | #define TCP_QUICKACK 12 /* Block/reenable quick acks */ | 102 | #define TCP_QUICKACK 12 /* Block/reenable quick acks */ |
| 97 | #define TCP_CONGESTION 13 /* Congestion control algorithm */ | 103 | #define TCP_CONGESTION 13 /* Congestion control algorithm */ |
| 98 | #define TCP_MD5SIG 14 /* TCP MD5 Signature (RFC2385) */ | 104 | #define TCP_MD5SIG 14 /* TCP MD5 Signature (RFC2385) */ |
| 105 | #define TCP_COOKIE_TRANSACTIONS 15 /* TCP Cookie Transactions */ | ||
| 106 | #define TCP_THIN_LINEAR_TIMEOUTS 16 /* Use linear timeouts for thin streams*/ | ||
| 107 | #define TCP_THIN_DUPACK 17 /* Fast retrans. after 1 dupack */ | ||
| 99 | 108 | ||
| 109 | /* for TCP_INFO socket option */ | ||
| 100 | #define TCPI_OPT_TIMESTAMPS 1 | 110 | #define TCPI_OPT_TIMESTAMPS 1 |
| 101 | #define TCPI_OPT_SACK 2 | 111 | #define TCPI_OPT_SACK 2 |
| 102 | #define TCPI_OPT_WSCALE 4 | 112 | #define TCPI_OPT_WSCALE 4 |
| 103 | #define TCPI_OPT_ECN 8 | 113 | #define TCPI_OPT_ECN 8 |
| 104 | 114 | ||
| 105 | enum tcp_ca_state | 115 | enum tcp_ca_state { |
| 106 | { | ||
| 107 | TCP_CA_Open = 0, | 116 | TCP_CA_Open = 0, |
| 108 | #define TCPF_CA_Open (1<<TCP_CA_Open) | 117 | #define TCPF_CA_Open (1<<TCP_CA_Open) |
| 109 | TCP_CA_Disorder = 1, | 118 | TCP_CA_Disorder = 1, |
| @@ -116,8 +125,7 @@ enum tcp_ca_state | |||
| 116 | #define TCPF_CA_Loss (1<<TCP_CA_Loss) | 125 | #define TCPF_CA_Loss (1<<TCP_CA_Loss) |
| 117 | }; | 126 | }; |
| 118 | 127 | ||
| 119 | struct tcp_info | 128 | struct tcp_info { |
| 120 | { | ||
| 121 | __u8 tcpi_state; | 129 | __u8 tcpi_state; |
| 122 | __u8 tcpi_ca_state; | 130 | __u8 tcpi_ca_state; |
| 123 | __u8 tcpi_retransmits; | 131 | __u8 tcpi_retransmits; |
| @@ -170,6 +178,30 @@ struct tcp_md5sig { | |||
| 170 | __u8 tcpm_key[TCP_MD5SIG_MAXKEYLEN]; /* key (binary) */ | 178 | __u8 tcpm_key[TCP_MD5SIG_MAXKEYLEN]; /* key (binary) */ |
| 171 | }; | 179 | }; |
| 172 | 180 | ||
| 181 | /* for TCP_COOKIE_TRANSACTIONS (TCPCT) socket option */ | ||
| 182 | #define TCP_COOKIE_MIN 8 /* 64-bits */ | ||
| 183 | #define TCP_COOKIE_MAX 16 /* 128-bits */ | ||
| 184 | #define TCP_COOKIE_PAIR_SIZE (2*TCP_COOKIE_MAX) | ||
| 185 | |||
| 186 | /* Flags for both getsockopt and setsockopt */ | ||
| 187 | #define TCP_COOKIE_IN_ALWAYS (1 << 0) /* Discard SYN without cookie */ | ||
| 188 | #define TCP_COOKIE_OUT_NEVER (1 << 1) /* Prohibit outgoing cookies, | ||
| 189 | * supercedes everything. */ | ||
| 190 | |||
| 191 | /* Flags for getsockopt */ | ||
| 192 | #define TCP_S_DATA_IN (1 << 2) /* Was data received? */ | ||
| 193 | #define TCP_S_DATA_OUT (1 << 3) /* Was data sent? */ | ||
| 194 | |||
| 195 | /* TCP_COOKIE_TRANSACTIONS data */ | ||
| 196 | struct tcp_cookie_transactions { | ||
| 197 | __u16 tcpct_flags; /* see above */ | ||
| 198 | __u8 __tcpct_pad1; /* zero */ | ||
| 199 | __u8 tcpct_cookie_desired; /* bytes */ | ||
| 200 | __u16 tcpct_s_data_desired; /* bytes of variable data */ | ||
| 201 | __u16 tcpct_used; /* bytes in value */ | ||
| 202 | __u8 tcpct_value[TCP_MSS_DEFAULT]; | ||
| 203 | }; | ||
| 204 | |||
| 173 | #ifdef __KERNEL__ | 205 | #ifdef __KERNEL__ |
| 174 | 206 | ||
| 175 | #include <linux/skbuff.h> | 207 | #include <linux/skbuff.h> |
| @@ -217,26 +249,38 @@ struct tcp_options_received { | |||
| 217 | sack_ok : 4, /* SACK seen on SYN packet */ | 249 | sack_ok : 4, /* SACK seen on SYN packet */ |
| 218 | snd_wscale : 4, /* Window scaling received from sender */ | 250 | snd_wscale : 4, /* Window scaling received from sender */ |
| 219 | rcv_wscale : 4; /* Window scaling to send to receiver */ | 251 | rcv_wscale : 4; /* Window scaling to send to receiver */ |
| 220 | /* SACKs data */ | 252 | u8 cookie_plus:6, /* bytes in authenticator/cookie option */ |
| 253 | cookie_out_never:1, | ||
| 254 | cookie_in_always:1; | ||
| 221 | u8 num_sacks; /* Number of SACK blocks */ | 255 | u8 num_sacks; /* Number of SACK blocks */ |
| 222 | u16 user_mss; /* mss requested by user in ioctl */ | 256 | u16 user_mss; /* mss requested by user in ioctl */ |
| 223 | u16 mss_clamp; /* Maximal mss, negotiated at connection setup */ | 257 | u16 mss_clamp; /* Maximal mss, negotiated at connection setup */ |
| 224 | }; | 258 | }; |
| 225 | 259 | ||
| 260 | static inline void tcp_clear_options(struct tcp_options_received *rx_opt) | ||
| 261 | { | ||
| 262 | rx_opt->tstamp_ok = rx_opt->sack_ok = 0; | ||
| 263 | rx_opt->wscale_ok = rx_opt->snd_wscale = 0; | ||
| 264 | rx_opt->cookie_plus = 0; | ||
| 265 | } | ||
| 266 | |||
| 226 | /* This is the max number of SACKS that we'll generate and process. It's safe | 267 | /* This is the max number of SACKS that we'll generate and process. It's safe |
| 227 | * to increse this, although since: | 268 | * to increase this, although since: |
| 228 | * size = TCPOLEN_SACK_BASE_ALIGNED (4) + n * TCPOLEN_SACK_PERBLOCK (8) | 269 | * size = TCPOLEN_SACK_BASE_ALIGNED (4) + n * TCPOLEN_SACK_PERBLOCK (8) |
| 229 | * only four options will fit in a standard TCP header */ | 270 | * only four options will fit in a standard TCP header */ |
| 230 | #define TCP_NUM_SACKS 4 | 271 | #define TCP_NUM_SACKS 4 |
| 231 | 272 | ||
| 273 | struct tcp_cookie_values; | ||
| 274 | struct tcp_request_sock_ops; | ||
| 275 | |||
| 232 | struct tcp_request_sock { | 276 | struct tcp_request_sock { |
| 233 | struct inet_request_sock req; | 277 | struct inet_request_sock req; |
| 234 | #ifdef CONFIG_TCP_MD5SIG | 278 | #ifdef CONFIG_TCP_MD5SIG |
| 235 | /* Only used by TCP MD5 Signature so far. */ | 279 | /* Only used by TCP MD5 Signature so far. */ |
| 236 | const struct tcp_request_sock_ops *af_specific; | 280 | const struct tcp_request_sock_ops *af_specific; |
| 237 | #endif | 281 | #endif |
| 238 | u32 rcv_isn; | 282 | u32 rcv_isn; |
| 239 | u32 snt_isn; | 283 | u32 snt_isn; |
| 240 | }; | 284 | }; |
| 241 | 285 | ||
| 242 | static inline struct tcp_request_sock *tcp_rsk(const struct request_sock *req) | 286 | static inline struct tcp_request_sock *tcp_rsk(const struct request_sock *req) |
| @@ -298,7 +342,10 @@ struct tcp_sock { | |||
| 298 | u32 frto_highmark; /* snd_nxt when RTO occurred */ | 342 | u32 frto_highmark; /* snd_nxt when RTO occurred */ |
| 299 | u16 advmss; /* Advertised MSS */ | 343 | u16 advmss; /* Advertised MSS */ |
| 300 | u8 frto_counter; /* Number of new acks after RTO */ | 344 | u8 frto_counter; /* Number of new acks after RTO */ |
| 301 | u8 nonagle; /* Disable Nagle algorithm? */ | 345 | u8 nonagle : 4,/* Disable Nagle algorithm? */ |
| 346 | thin_lto : 1,/* Use linear timeouts for thin streams */ | ||
| 347 | thin_dupack : 1,/* Fast retransmit on first dupack */ | ||
| 348 | unused : 2; | ||
| 302 | 349 | ||
| 303 | /* RTT measurement */ | 350 | /* RTT measurement */ |
| 304 | u32 srtt; /* smoothed round trip time << 3 */ | 351 | u32 srtt; /* smoothed round trip time << 3 */ |
| @@ -406,6 +453,12 @@ struct tcp_sock { | |||
| 406 | /* TCP MD5 Signature Option information */ | 453 | /* TCP MD5 Signature Option information */ |
| 407 | struct tcp_md5sig_info *md5sig_info; | 454 | struct tcp_md5sig_info *md5sig_info; |
| 408 | #endif | 455 | #endif |
| 456 | |||
| 457 | /* When the cookie options are generated and exchanged, then this | ||
| 458 | * object holds a reference to them (cookie_values->kref). Also | ||
| 459 | * contains related tcp_cookie_transactions fields. | ||
| 460 | */ | ||
| 461 | struct tcp_cookie_values *cookie_values; | ||
| 409 | }; | 462 | }; |
| 410 | 463 | ||
| 411 | static inline struct tcp_sock *tcp_sk(const struct sock *sk) | 464 | static inline struct tcp_sock *tcp_sk(const struct sock *sk) |
| @@ -424,6 +477,10 @@ struct tcp_timewait_sock { | |||
| 424 | u16 tw_md5_keylen; | 477 | u16 tw_md5_keylen; |
| 425 | u8 tw_md5_key[TCP_MD5SIG_MAXKEYLEN]; | 478 | u8 tw_md5_key[TCP_MD5SIG_MAXKEYLEN]; |
| 426 | #endif | 479 | #endif |
| 480 | /* Few sockets in timewait have cookies; in that case, then this | ||
| 481 | * object holds a reference to them (tw_cookie_values->kref). | ||
| 482 | */ | ||
| 483 | struct tcp_cookie_values *tw_cookie_values; | ||
| 427 | }; | 484 | }; |
| 428 | 485 | ||
| 429 | static inline struct tcp_timewait_sock *tcp_twsk(const struct sock *sk) | 486 | static inline struct tcp_timewait_sock *tcp_twsk(const struct sock *sk) |
| @@ -431,6 +488,6 @@ static inline struct tcp_timewait_sock *tcp_twsk(const struct sock *sk) | |||
| 431 | return (struct tcp_timewait_sock *)sk; | 488 | return (struct tcp_timewait_sock *)sk; |
| 432 | } | 489 | } |
| 433 | 490 | ||
| 434 | #endif | 491 | #endif /* __KERNEL__ */ |
| 435 | 492 | ||
| 436 | #endif /* _LINUX_TCP_H */ | 493 | #endif /* _LINUX_TCP_H */ |
diff --git a/include/linux/tick.h b/include/linux/tick.h index 4f9ba058abdb..25d0cf41d3fd 100644 --- a/include/linux/tick.h +++ b/include/linux/tick.h | |||
| @@ -43,6 +43,7 @@ enum tick_nohz_mode { | |||
| 43 | * @idle_exittime: Time when the idle state was left | 43 | * @idle_exittime: Time when the idle state was left |
| 44 | * @idle_sleeptime: Sum of the time slept in idle with sched tick stopped | 44 | * @idle_sleeptime: Sum of the time slept in idle with sched tick stopped |
| 45 | * @sleep_length: Duration of the current idle sleep | 45 | * @sleep_length: Duration of the current idle sleep |
| 46 | * @do_timer_lst: CPU was the last one doing do_timer before going idle | ||
| 46 | */ | 47 | */ |
| 47 | struct tick_sched { | 48 | struct tick_sched { |
| 48 | struct hrtimer sched_timer; | 49 | struct hrtimer sched_timer; |
| @@ -64,6 +65,7 @@ struct tick_sched { | |||
| 64 | unsigned long last_jiffies; | 65 | unsigned long last_jiffies; |
| 65 | unsigned long next_jiffies; | 66 | unsigned long next_jiffies; |
| 66 | ktime_t idle_expires; | 67 | ktime_t idle_expires; |
| 68 | int do_timer_last; | ||
| 67 | }; | 69 | }; |
| 68 | 70 | ||
| 69 | extern void __init tick_init(void); | 71 | extern void __init tick_init(void); |
| @@ -103,6 +105,9 @@ extern int tick_check_oneshot_change(int allow_nohz); | |||
| 103 | extern struct tick_sched *tick_get_tick_sched(int cpu); | 105 | extern struct tick_sched *tick_get_tick_sched(int cpu); |
| 104 | extern void tick_check_idle(int cpu); | 106 | extern void tick_check_idle(int cpu); |
| 105 | extern int tick_oneshot_mode_active(void); | 107 | extern int tick_oneshot_mode_active(void); |
| 108 | # ifndef arch_needs_cpu | ||
| 109 | # define arch_needs_cpu(cpu) (0) | ||
| 110 | # endif | ||
| 106 | # else | 111 | # else |
| 107 | static inline void tick_clock_notify(void) { } | 112 | static inline void tick_clock_notify(void) { } |
| 108 | static inline int tick_check_oneshot_change(int allow_nohz) { return 0; } | 113 | static inline int tick_check_oneshot_change(int allow_nohz) { return 0; } |
diff --git a/include/linux/timb_gpio.h b/include/linux/timb_gpio.h new file mode 100644 index 000000000000..ce456eaae861 --- /dev/null +++ b/include/linux/timb_gpio.h | |||
| @@ -0,0 +1,37 @@ | |||
| 1 | /* | ||
| 2 | * timb_gpio.h timberdale FPGA GPIO driver, platform data definition | ||
| 3 | * Copyright (c) 2009 Intel Corporation | ||
| 4 | * | ||
| 5 | * This program is free software; you can redistribute it and/or modify | ||
| 6 | * it under the terms of the GNU General Public License version 2 as | ||
| 7 | * published by the Free Software Foundation. | ||
| 8 | * | ||
| 9 | * This program is distributed in the hope that it will be useful, | ||
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 12 | * GNU General Public License for more details. | ||
| 13 | * | ||
| 14 | * You should have received a copy of the GNU General Public License | ||
| 15 | * along with this program; if not, write to the Free Software | ||
| 16 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
| 17 | */ | ||
| 18 | |||
| 19 | #ifndef _LINUX_TIMB_GPIO_H | ||
| 20 | #define _LINUX_TIMB_GPIO_H | ||
| 21 | |||
| 22 | /** | ||
| 23 | * struct timbgpio_platform_data - Platform data of the Timberdale GPIO driver | ||
| 24 | * @gpio_base The number of the first GPIO pin, set to -1 for | ||
| 25 | * dynamic number allocation. | ||
| 26 | * @nr_pins Number of pins that is supported by the hardware (1-32) | ||
| 27 | * @irq_base If IRQ is supported by the hardware, this is the base | ||
| 28 | * number of IRQ:s. One IRQ per pin will be used. Set to | ||
| 29 | * -1 if IRQ:s is not supported. | ||
| 30 | */ | ||
| 31 | struct timbgpio_platform_data { | ||
| 32 | int gpio_base; | ||
| 33 | int nr_pins; | ||
| 34 | int irq_base; | ||
| 35 | }; | ||
| 36 | |||
| 37 | #endif | ||
diff --git a/include/linux/time.h b/include/linux/time.h index fe04e5ef6a59..6e026e45a179 100644 --- a/include/linux/time.h +++ b/include/linux/time.h | |||
| @@ -148,6 +148,7 @@ extern void monotonic_to_bootbased(struct timespec *ts); | |||
| 148 | 148 | ||
| 149 | extern struct timespec timespec_trunc(struct timespec t, unsigned gran); | 149 | extern struct timespec timespec_trunc(struct timespec t, unsigned gran); |
| 150 | extern int timekeeping_valid_for_hres(void); | 150 | extern int timekeeping_valid_for_hres(void); |
| 151 | extern u64 timekeeping_max_deferment(void); | ||
| 151 | extern void update_wall_time(void); | 152 | extern void update_wall_time(void); |
| 152 | extern void update_xtime_cache(u64 nsec); | 153 | extern void update_xtime_cache(u64 nsec); |
| 153 | extern void timekeeping_leap_insert(int leapsecond); | 154 | extern void timekeeping_leap_insert(int leapsecond); |
diff --git a/include/linux/timex.h b/include/linux/timex.h index e6967d10d9e5..7a082b32d8e1 100644 --- a/include/linux/timex.h +++ b/include/linux/timex.h | |||
| @@ -115,13 +115,16 @@ struct timex { | |||
| 115 | #define ADJ_OFFSET_SS_READ 0xa001 /* read-only adjtime */ | 115 | #define ADJ_OFFSET_SS_READ 0xa001 /* read-only adjtime */ |
| 116 | #endif | 116 | #endif |
| 117 | 117 | ||
| 118 | /* xntp 3.4 compatibility names */ | 118 | /* NTP userland likes the MOD_ prefix better */ |
| 119 | #define MOD_OFFSET ADJ_OFFSET | 119 | #define MOD_OFFSET ADJ_OFFSET |
| 120 | #define MOD_FREQUENCY ADJ_FREQUENCY | 120 | #define MOD_FREQUENCY ADJ_FREQUENCY |
| 121 | #define MOD_MAXERROR ADJ_MAXERROR | 121 | #define MOD_MAXERROR ADJ_MAXERROR |
| 122 | #define MOD_ESTERROR ADJ_ESTERROR | 122 | #define MOD_ESTERROR ADJ_ESTERROR |
| 123 | #define MOD_STATUS ADJ_STATUS | 123 | #define MOD_STATUS ADJ_STATUS |
| 124 | #define MOD_TIMECONST ADJ_TIMECONST | 124 | #define MOD_TIMECONST ADJ_TIMECONST |
| 125 | #define MOD_TAI ADJ_TAI | ||
| 126 | #define MOD_MICRO ADJ_MICRO | ||
| 127 | #define MOD_NANO ADJ_NANO | ||
| 125 | 128 | ||
| 126 | 129 | ||
| 127 | /* | 130 | /* |
| @@ -235,9 +238,6 @@ extern int tickadj; /* amount of adjustment per tick */ | |||
| 235 | * phase-lock loop variables | 238 | * phase-lock loop variables |
| 236 | */ | 239 | */ |
| 237 | extern int time_status; /* clock synchronization status bits */ | 240 | extern int time_status; /* clock synchronization status bits */ |
| 238 | extern long time_maxerror; /* maximum error */ | ||
| 239 | extern long time_esterror; /* estimated error */ | ||
| 240 | |||
| 241 | extern long time_adjust; /* The amount of adjtime left */ | 241 | extern long time_adjust; /* The amount of adjtime left */ |
| 242 | 242 | ||
| 243 | extern void ntp_init(void); | 243 | extern void ntp_init(void); |
| @@ -261,11 +261,7 @@ static inline int ntp_synced(void) | |||
| 261 | 261 | ||
| 262 | #define NTP_SCALE_SHIFT 32 | 262 | #define NTP_SCALE_SHIFT 32 |
| 263 | 263 | ||
| 264 | #ifdef CONFIG_NO_HZ | ||
| 265 | #define NTP_INTERVAL_FREQ (2) | ||
| 266 | #else | ||
| 267 | #define NTP_INTERVAL_FREQ (HZ) | 264 | #define NTP_INTERVAL_FREQ (HZ) |
| 268 | #endif | ||
| 269 | #define NTP_INTERVAL_LENGTH (NSEC_PER_SEC/NTP_INTERVAL_FREQ) | 265 | #define NTP_INTERVAL_LENGTH (NSEC_PER_SEC/NTP_INTERVAL_FREQ) |
| 270 | 266 | ||
| 271 | /* Returns how long ticks are at present, in ns / 2^NTP_SCALE_SHIFT. */ | 267 | /* Returns how long ticks are at present, in ns / 2^NTP_SCALE_SHIFT. */ |
diff --git a/include/linux/topology.h b/include/linux/topology.h index 57e63579bfdd..5b81156780b1 100644 --- a/include/linux/topology.h +++ b/include/linux/topology.h | |||
| @@ -99,7 +99,7 @@ int arch_update_cpu_topology(void); | |||
| 99 | | 1*SD_WAKE_AFFINE \ | 99 | | 1*SD_WAKE_AFFINE \ |
| 100 | | 1*SD_SHARE_CPUPOWER \ | 100 | | 1*SD_SHARE_CPUPOWER \ |
| 101 | | 0*SD_POWERSAVINGS_BALANCE \ | 101 | | 0*SD_POWERSAVINGS_BALANCE \ |
| 102 | | 0*SD_SHARE_PKG_RESOURCES \ | 102 | | 1*SD_SHARE_PKG_RESOURCES \ |
| 103 | | 0*SD_SERIALIZE \ | 103 | | 0*SD_SERIALIZE \ |
| 104 | | 0*SD_PREFER_SIBLING \ | 104 | | 0*SD_PREFER_SIBLING \ |
| 105 | , \ | 105 | , \ |
diff --git a/include/linux/tpm.h b/include/linux/tpm.h index 3338b3f5c21a..ac5d1c1285d9 100644 --- a/include/linux/tpm.h +++ b/include/linux/tpm.h | |||
| @@ -27,9 +27,16 @@ | |||
| 27 | */ | 27 | */ |
| 28 | #define TPM_ANY_NUM 0xFFFF | 28 | #define TPM_ANY_NUM 0xFFFF |
| 29 | 29 | ||
| 30 | #if defined(CONFIG_TCG_TPM) | 30 | #if defined(CONFIG_TCG_TPM) || defined(CONFIG_TCG_TPM_MODULE) |
| 31 | 31 | ||
| 32 | extern int tpm_pcr_read(u32 chip_num, int pcr_idx, u8 *res_buf); | 32 | extern int tpm_pcr_read(u32 chip_num, int pcr_idx, u8 *res_buf); |
| 33 | extern int tpm_pcr_extend(u32 chip_num, int pcr_idx, const u8 *hash); | 33 | extern int tpm_pcr_extend(u32 chip_num, int pcr_idx, const u8 *hash); |
| 34 | #else | ||
| 35 | static inline int tpm_pcr_read(u32 chip_num, int pcr_idx, u8 *res_buf) { | ||
| 36 | return -ENODEV; | ||
| 37 | } | ||
| 38 | static inline int tpm_pcr_extend(u32 chip_num, int pcr_idx, const u8 *hash) { | ||
| 39 | return -ENODEV; | ||
| 40 | } | ||
| 34 | #endif | 41 | #endif |
| 35 | #endif | 42 | #endif |
diff --git a/include/linux/trace_seq.h b/include/linux/trace_seq.h index 09077f6ed128..5cf397ceb726 100644 --- a/include/linux/trace_seq.h +++ b/include/linux/trace_seq.h | |||
| @@ -14,6 +14,7 @@ struct trace_seq { | |||
| 14 | unsigned char buffer[PAGE_SIZE]; | 14 | unsigned char buffer[PAGE_SIZE]; |
| 15 | unsigned int len; | 15 | unsigned int len; |
| 16 | unsigned int readpos; | 16 | unsigned int readpos; |
| 17 | int full; | ||
| 17 | }; | 18 | }; |
| 18 | 19 | ||
| 19 | static inline void | 20 | static inline void |
| @@ -21,6 +22,7 @@ trace_seq_init(struct trace_seq *s) | |||
| 21 | { | 22 | { |
| 22 | s->len = 0; | 23 | s->len = 0; |
| 23 | s->readpos = 0; | 24 | s->readpos = 0; |
| 25 | s->full = 0; | ||
| 24 | } | 26 | } |
| 25 | 27 | ||
| 26 | /* | 28 | /* |
| @@ -33,7 +35,7 @@ extern int trace_seq_vprintf(struct trace_seq *s, const char *fmt, va_list args) | |||
| 33 | __attribute__ ((format (printf, 2, 0))); | 35 | __attribute__ ((format (printf, 2, 0))); |
| 34 | extern int | 36 | extern int |
| 35 | trace_seq_bprintf(struct trace_seq *s, const char *fmt, const u32 *binary); | 37 | trace_seq_bprintf(struct trace_seq *s, const char *fmt, const u32 *binary); |
| 36 | extern void trace_print_seq(struct seq_file *m, struct trace_seq *s); | 38 | extern int trace_print_seq(struct seq_file *m, struct trace_seq *s); |
| 37 | extern ssize_t trace_seq_to_user(struct trace_seq *s, char __user *ubuf, | 39 | extern ssize_t trace_seq_to_user(struct trace_seq *s, char __user *ubuf, |
| 38 | size_t cnt); | 40 | size_t cnt); |
| 39 | extern int trace_seq_puts(struct trace_seq *s, const char *str); | 41 | extern int trace_seq_puts(struct trace_seq *s, const char *str); |
| @@ -55,8 +57,9 @@ trace_seq_bprintf(struct trace_seq *s, const char *fmt, const u32 *binary) | |||
| 55 | return 0; | 57 | return 0; |
| 56 | } | 58 | } |
| 57 | 59 | ||
| 58 | static inline void trace_print_seq(struct seq_file *m, struct trace_seq *s) | 60 | static inline int trace_print_seq(struct seq_file *m, struct trace_seq *s) |
| 59 | { | 61 | { |
| 62 | return 0; | ||
| 60 | } | 63 | } |
| 61 | static inline ssize_t trace_seq_to_user(struct trace_seq *s, char __user *ubuf, | 64 | static inline ssize_t trace_seq_to_user(struct trace_seq *s, char __user *ubuf, |
| 62 | size_t cnt) | 65 | size_t cnt) |
diff --git a/include/linux/tracehook.h b/include/linux/tracehook.h index 1eb44a924e56..10db0102a890 100644 --- a/include/linux/tracehook.h +++ b/include/linux/tracehook.h | |||
| @@ -134,6 +134,13 @@ static inline __must_check int tracehook_report_syscall_entry( | |||
| 134 | */ | 134 | */ |
| 135 | static inline void tracehook_report_syscall_exit(struct pt_regs *regs, int step) | 135 | static inline void tracehook_report_syscall_exit(struct pt_regs *regs, int step) |
| 136 | { | 136 | { |
| 137 | if (step) { | ||
| 138 | siginfo_t info; | ||
| 139 | user_single_step_siginfo(current, regs, &info); | ||
| 140 | force_sig_info(SIGTRAP, &info, current); | ||
| 141 | return; | ||
| 142 | } | ||
| 143 | |||
| 137 | ptrace_report_syscall(regs); | 144 | ptrace_report_syscall(regs); |
| 138 | } | 145 | } |
| 139 | 146 | ||
diff --git a/include/linux/tracepoint.h b/include/linux/tracepoint.h index 2aac8a83e89b..78b4bd3be496 100644 --- a/include/linux/tracepoint.h +++ b/include/linux/tracepoint.h | |||
| @@ -49,7 +49,7 @@ struct tracepoint { | |||
| 49 | void **it_func; \ | 49 | void **it_func; \ |
| 50 | \ | 50 | \ |
| 51 | rcu_read_lock_sched_notrace(); \ | 51 | rcu_read_lock_sched_notrace(); \ |
| 52 | it_func = rcu_dereference((tp)->funcs); \ | 52 | it_func = rcu_dereference_sched((tp)->funcs); \ |
| 53 | if (it_func) { \ | 53 | if (it_func) { \ |
| 54 | do { \ | 54 | do { \ |
| 55 | ((void(*)(proto))(*it_func))(args); \ | 55 | ((void(*)(proto))(*it_func))(args); \ |
| @@ -280,6 +280,12 @@ static inline void tracepoint_synchronize_unregister(void) | |||
| 280 | * TRACE_EVENT_FN to perform any (un)registration work. | 280 | * TRACE_EVENT_FN to perform any (un)registration work. |
| 281 | */ | 281 | */ |
| 282 | 282 | ||
| 283 | #define DECLARE_EVENT_CLASS(name, proto, args, tstruct, assign, print) | ||
| 284 | #define DEFINE_EVENT(template, name, proto, args) \ | ||
| 285 | DECLARE_TRACE(name, PARAMS(proto), PARAMS(args)) | ||
| 286 | #define DEFINE_EVENT_PRINT(template, name, proto, args, print) \ | ||
| 287 | DECLARE_TRACE(name, PARAMS(proto), PARAMS(args)) | ||
| 288 | |||
| 283 | #define TRACE_EVENT(name, proto, args, struct, assign, print) \ | 289 | #define TRACE_EVENT(name, proto, args, struct, assign, print) \ |
| 284 | DECLARE_TRACE(name, PARAMS(proto), PARAMS(args)) | 290 | DECLARE_TRACE(name, PARAMS(proto), PARAMS(args)) |
| 285 | #define TRACE_EVENT_FN(name, proto, args, struct, \ | 291 | #define TRACE_EVENT_FN(name, proto, args, struct, \ |
diff --git a/include/linux/tty.h b/include/linux/tty.h index f0f43d08d8b8..4409967db0c4 100644 --- a/include/linux/tty.h +++ b/include/linux/tty.h | |||
| @@ -68,6 +68,17 @@ struct tty_buffer { | |||
| 68 | unsigned long data[0]; | 68 | unsigned long data[0]; |
| 69 | }; | 69 | }; |
| 70 | 70 | ||
| 71 | /* | ||
| 72 | * We default to dicing tty buffer allocations to this many characters | ||
| 73 | * in order to avoid multiple page allocations. We know the size of | ||
| 74 | * tty_buffer itself but it must also be taken into account that the | ||
| 75 | * the buffer is 256 byte aligned. See tty_buffer_find for the allocation | ||
| 76 | * logic this must match | ||
| 77 | */ | ||
| 78 | |||
| 79 | #define TTY_BUFFER_PAGE (((PAGE_SIZE - sizeof(struct tty_buffer)) / 2) & ~0xFF) | ||
| 80 | |||
| 81 | |||
| 71 | struct tty_bufhead { | 82 | struct tty_bufhead { |
| 72 | struct delayed_work work; | 83 | struct delayed_work work; |
| 73 | spinlock_t lock; | 84 | spinlock_t lock; |
| @@ -190,9 +201,17 @@ struct tty_port_operations { | |||
| 190 | /* Control the DTR line */ | 201 | /* Control the DTR line */ |
| 191 | void (*dtr_rts)(struct tty_port *port, int raise); | 202 | void (*dtr_rts)(struct tty_port *port, int raise); |
| 192 | /* Called when the last close completes or a hangup finishes | 203 | /* Called when the last close completes or a hangup finishes |
| 193 | IFF the port was initialized. Do not use to free resources */ | 204 | IFF the port was initialized. Do not use to free resources. Called |
| 205 | under the port mutex to serialize against activate/shutdowns */ | ||
| 194 | void (*shutdown)(struct tty_port *port); | 206 | void (*shutdown)(struct tty_port *port); |
| 195 | void (*drop)(struct tty_port *port); | 207 | void (*drop)(struct tty_port *port); |
| 208 | /* Called under the port mutex from tty_port_open, serialized using | ||
| 209 | the port mutex */ | ||
| 210 | /* FIXME: long term getting the tty argument *out* of this would be | ||
| 211 | good for consoles */ | ||
| 212 | int (*activate)(struct tty_port *port, struct tty_struct *tty); | ||
| 213 | /* Called on the final put of a port */ | ||
| 214 | void (*destruct)(struct tty_port *port); | ||
| 196 | }; | 215 | }; |
| 197 | 216 | ||
| 198 | struct tty_port { | 217 | struct tty_port { |
| @@ -205,13 +224,16 @@ struct tty_port { | |||
| 205 | wait_queue_head_t close_wait; /* Close waiters */ | 224 | wait_queue_head_t close_wait; /* Close waiters */ |
| 206 | wait_queue_head_t delta_msr_wait; /* Modem status change */ | 225 | wait_queue_head_t delta_msr_wait; /* Modem status change */ |
| 207 | unsigned long flags; /* TTY flags ASY_*/ | 226 | unsigned long flags; /* TTY flags ASY_*/ |
| 227 | unsigned char console:1; /* port is a console */ | ||
| 208 | struct mutex mutex; /* Locking */ | 228 | struct mutex mutex; /* Locking */ |
| 229 | struct mutex buf_mutex; /* Buffer alloc lock */ | ||
| 209 | unsigned char *xmit_buf; /* Optional buffer */ | 230 | unsigned char *xmit_buf; /* Optional buffer */ |
| 210 | unsigned int close_delay; /* Close port delay */ | 231 | unsigned int close_delay; /* Close port delay */ |
| 211 | unsigned int closing_wait; /* Delay for output */ | 232 | unsigned int closing_wait; /* Delay for output */ |
| 212 | int drain_delay; /* Set to zero if no pure time | 233 | int drain_delay; /* Set to zero if no pure time |
| 213 | based drain is needed else | 234 | based drain is needed else |
| 214 | set to size of fifo */ | 235 | set to size of fifo */ |
| 236 | struct kref kref; /* Ref counter */ | ||
| 215 | }; | 237 | }; |
| 216 | 238 | ||
| 217 | /* | 239 | /* |
| @@ -340,8 +362,6 @@ extern void tty_write_flush(struct tty_struct *); | |||
| 340 | 362 | ||
| 341 | extern struct ktermios tty_std_termios; | 363 | extern struct ktermios tty_std_termios; |
| 342 | 364 | ||
| 343 | extern int kmsg_redirect; | ||
| 344 | |||
| 345 | extern void console_init(void); | 365 | extern void console_init(void); |
| 346 | extern int vcs_init(void); | 366 | extern int vcs_init(void); |
| 347 | 367 | ||
| @@ -439,7 +459,7 @@ extern void initialize_tty_struct(struct tty_struct *tty, | |||
| 439 | struct tty_driver *driver, int idx); | 459 | struct tty_driver *driver, int idx); |
| 440 | extern struct tty_struct *tty_init_dev(struct tty_driver *driver, int idx, | 460 | extern struct tty_struct *tty_init_dev(struct tty_driver *driver, int idx, |
| 441 | int first_ok); | 461 | int first_ok); |
| 442 | extern void tty_release_dev(struct file *filp); | 462 | extern int tty_release(struct inode *inode, struct file *filp); |
| 443 | extern int tty_init_termios(struct tty_struct *tty); | 463 | extern int tty_init_termios(struct tty_struct *tty); |
| 444 | 464 | ||
| 445 | extern struct tty_struct *tty_pair_get_tty(struct tty_struct *tty); | 465 | extern struct tty_struct *tty_pair_get_tty(struct tty_struct *tty); |
| @@ -454,6 +474,15 @@ extern int tty_write_lock(struct tty_struct *tty, int ndelay); | |||
| 454 | extern void tty_port_init(struct tty_port *port); | 474 | extern void tty_port_init(struct tty_port *port); |
| 455 | extern int tty_port_alloc_xmit_buf(struct tty_port *port); | 475 | extern int tty_port_alloc_xmit_buf(struct tty_port *port); |
| 456 | extern void tty_port_free_xmit_buf(struct tty_port *port); | 476 | extern void tty_port_free_xmit_buf(struct tty_port *port); |
| 477 | extern void tty_port_put(struct tty_port *port); | ||
| 478 | |||
| 479 | static inline struct tty_port *tty_port_get(struct tty_port *port) | ||
| 480 | { | ||
| 481 | if (port) | ||
| 482 | kref_get(&port->kref); | ||
| 483 | return port; | ||
| 484 | } | ||
| 485 | |||
| 457 | extern struct tty_struct *tty_port_tty_get(struct tty_port *port); | 486 | extern struct tty_struct *tty_port_tty_get(struct tty_port *port); |
| 458 | extern void tty_port_tty_set(struct tty_port *port, struct tty_struct *tty); | 487 | extern void tty_port_tty_set(struct tty_port *port, struct tty_struct *tty); |
| 459 | extern int tty_port_carrier_raised(struct tty_port *port); | 488 | extern int tty_port_carrier_raised(struct tty_port *port); |
| @@ -467,7 +496,9 @@ extern int tty_port_close_start(struct tty_port *port, | |||
| 467 | extern void tty_port_close_end(struct tty_port *port, struct tty_struct *tty); | 496 | extern void tty_port_close_end(struct tty_port *port, struct tty_struct *tty); |
| 468 | extern void tty_port_close(struct tty_port *port, | 497 | extern void tty_port_close(struct tty_port *port, |
| 469 | struct tty_struct *tty, struct file *filp); | 498 | struct tty_struct *tty, struct file *filp); |
| 470 | extern inline int tty_port_users(struct tty_port *port) | 499 | extern int tty_port_open(struct tty_port *port, |
| 500 | struct tty_struct *tty, struct file *filp); | ||
| 501 | static inline int tty_port_users(struct tty_port *port) | ||
| 471 | { | 502 | { |
| 472 | return port->count + port->blocked_open; | 503 | return port->count + port->blocked_open; |
| 473 | } | 504 | } |
| @@ -485,6 +516,7 @@ extern void tty_ldisc_enable(struct tty_struct *tty); | |||
| 485 | 516 | ||
| 486 | /* n_tty.c */ | 517 | /* n_tty.c */ |
| 487 | extern struct tty_ldisc_ops tty_ldisc_N_TTY; | 518 | extern struct tty_ldisc_ops tty_ldisc_N_TTY; |
| 519 | extern void n_tty_inherit_ops(struct tty_ldisc_ops *ops); | ||
| 488 | 520 | ||
| 489 | /* tty_audit.c */ | 521 | /* tty_audit.c */ |
| 490 | #ifdef CONFIG_AUDIT | 522 | #ifdef CONFIG_AUDIT |
diff --git a/include/linux/tty_flip.h b/include/linux/tty_flip.h index eb677cf56106..9239d033a0a3 100644 --- a/include/linux/tty_flip.h +++ b/include/linux/tty_flip.h | |||
| @@ -2,8 +2,8 @@ | |||
| 2 | #define _LINUX_TTY_FLIP_H | 2 | #define _LINUX_TTY_FLIP_H |
| 3 | 3 | ||
| 4 | extern int tty_buffer_request_room(struct tty_struct *tty, size_t size); | 4 | extern int tty_buffer_request_room(struct tty_struct *tty, size_t size); |
| 5 | extern int tty_insert_flip_string(struct tty_struct *tty, const unsigned char *chars, size_t size); | ||
| 6 | extern int tty_insert_flip_string_flags(struct tty_struct *tty, const unsigned char *chars, const char *flags, size_t size); | 5 | extern int tty_insert_flip_string_flags(struct tty_struct *tty, const unsigned char *chars, const char *flags, size_t size); |
| 6 | extern int tty_insert_flip_string_fixed_flag(struct tty_struct *tty, const unsigned char *chars, char flag, size_t size); | ||
| 7 | extern int tty_prepare_flip_string(struct tty_struct *tty, unsigned char **chars, size_t size); | 7 | extern int tty_prepare_flip_string(struct tty_struct *tty, unsigned char **chars, size_t size); |
| 8 | extern int tty_prepare_flip_string_flags(struct tty_struct *tty, unsigned char **chars, char **flags, size_t size); | 8 | extern int tty_prepare_flip_string_flags(struct tty_struct *tty, unsigned char **chars, char **flags, size_t size); |
| 9 | void tty_schedule_flip(struct tty_struct *tty); | 9 | void tty_schedule_flip(struct tty_struct *tty); |
| @@ -20,4 +20,9 @@ static inline int tty_insert_flip_char(struct tty_struct *tty, | |||
| 20 | return tty_insert_flip_string_flags(tty, &ch, &flag, 1); | 20 | return tty_insert_flip_string_flags(tty, &ch, &flag, 1); |
| 21 | } | 21 | } |
| 22 | 22 | ||
| 23 | static inline int tty_insert_flip_string(struct tty_struct *tty, const unsigned char *chars, size_t size) | ||
| 24 | { | ||
| 25 | return tty_insert_flip_string_fixed_flag(tty, chars, TTY_NORMAL, size); | ||
| 26 | } | ||
| 27 | |||
| 23 | #endif /* _LINUX_TTY_FLIP_H */ | 28 | #endif /* _LINUX_TTY_FLIP_H */ |
diff --git a/include/linux/tty_ldisc.h b/include/linux/tty_ldisc.h index 0c4ee9b88f85..526d66f066a3 100644 --- a/include/linux/tty_ldisc.h +++ b/include/linux/tty_ldisc.h | |||
| @@ -99,6 +99,12 @@ | |||
| 99 | * cease I/O to the tty driver. Can sleep. The driver should | 99 | * cease I/O to the tty driver. Can sleep. The driver should |
| 100 | * seek to perform this action quickly but should wait until | 100 | * seek to perform this action quickly but should wait until |
| 101 | * any pending driver I/O is completed. | 101 | * any pending driver I/O is completed. |
| 102 | * | ||
| 103 | * void (*dcd_change)(struct tty_struct *tty, unsigned int status, | ||
| 104 | * struct timespec *ts) | ||
| 105 | * | ||
| 106 | * Tells the discipline that the DCD pin has changed its status and | ||
| 107 | * the relative timestamp. Pointer ts can be NULL. | ||
| 102 | */ | 108 | */ |
| 103 | 109 | ||
| 104 | #include <linux/fs.h> | 110 | #include <linux/fs.h> |
| @@ -136,6 +142,8 @@ struct tty_ldisc_ops { | |||
| 136 | void (*receive_buf)(struct tty_struct *, const unsigned char *cp, | 142 | void (*receive_buf)(struct tty_struct *, const unsigned char *cp, |
| 137 | char *fp, int count); | 143 | char *fp, int count); |
| 138 | void (*write_wakeup)(struct tty_struct *); | 144 | void (*write_wakeup)(struct tty_struct *); |
| 145 | void (*dcd_change)(struct tty_struct *, unsigned int, | ||
| 146 | struct timespec *); | ||
| 139 | 147 | ||
| 140 | struct module *owner; | 148 | struct module *owner; |
| 141 | 149 | ||
diff --git a/include/linux/uaccess.h b/include/linux/uaccess.h index 6b58367d145e..d512d98dfb7d 100644 --- a/include/linux/uaccess.h +++ b/include/linux/uaccess.h | |||
| @@ -94,6 +94,7 @@ static inline unsigned long __copy_from_user_nocache(void *to, | |||
| 94 | * happens, handle that and return -EFAULT. | 94 | * happens, handle that and return -EFAULT. |
| 95 | */ | 95 | */ |
| 96 | extern long probe_kernel_read(void *dst, void *src, size_t size); | 96 | extern long probe_kernel_read(void *dst, void *src, size_t size); |
| 97 | extern long __probe_kernel_read(void *dst, void *src, size_t size); | ||
| 97 | 98 | ||
| 98 | /* | 99 | /* |
| 99 | * probe_kernel_write(): safely attempt to write to a location | 100 | * probe_kernel_write(): safely attempt to write to a location |
| @@ -104,6 +105,7 @@ extern long probe_kernel_read(void *dst, void *src, size_t size); | |||
| 104 | * Safely write to address @dst from the buffer at @src. If a kernel fault | 105 | * Safely write to address @dst from the buffer at @src. If a kernel fault |
| 105 | * happens, handle that and return -EFAULT. | 106 | * happens, handle that and return -EFAULT. |
| 106 | */ | 107 | */ |
| 107 | extern long probe_kernel_write(void *dst, void *src, size_t size); | 108 | extern long notrace probe_kernel_write(void *dst, void *src, size_t size); |
| 109 | extern long notrace __probe_kernel_write(void *dst, void *src, size_t size); | ||
| 108 | 110 | ||
| 109 | #endif /* __LINUX_UACCESS_H__ */ | 111 | #endif /* __LINUX_UACCESS_H__ */ |
diff --git a/include/linux/ucb1400.h b/include/linux/ucb1400.h index adb44066680c..1b4790911052 100644 --- a/include/linux/ucb1400.h +++ b/include/linux/ucb1400.h | |||
| @@ -110,6 +110,10 @@ struct ucb1400 { | |||
| 110 | struct platform_device *ucb1400_gpio; | 110 | struct platform_device *ucb1400_gpio; |
| 111 | }; | 111 | }; |
| 112 | 112 | ||
| 113 | struct ucb1400_pdata { | ||
| 114 | int irq; | ||
| 115 | }; | ||
| 116 | |||
| 113 | static inline u16 ucb1400_reg_read(struct snd_ac97 *ac97, u16 reg) | 117 | static inline u16 ucb1400_reg_read(struct snd_ac97 *ac97, u16 reg) |
| 114 | { | 118 | { |
| 115 | return ac97->bus->ops->read(ac97, reg); | 119 | return ac97->bus->ops->read(ac97, reg); |
diff --git a/include/linux/udp.h b/include/linux/udp.h index 0cf5c4c0ec81..03f72a2ba028 100644 --- a/include/linux/udp.h +++ b/include/linux/udp.h | |||
| @@ -45,16 +45,19 @@ static inline struct udphdr *udp_hdr(const struct sk_buff *skb) | |||
| 45 | return (struct udphdr *)skb_transport_header(skb); | 45 | return (struct udphdr *)skb_transport_header(skb); |
| 46 | } | 46 | } |
| 47 | 47 | ||
| 48 | #define UDP_HTABLE_SIZE 128 | 48 | #define UDP_HTABLE_SIZE_MIN (CONFIG_BASE_SMALL ? 128 : 256) |
| 49 | 49 | ||
| 50 | static inline int udp_hashfn(struct net *net, const unsigned num) | 50 | static inline int udp_hashfn(struct net *net, unsigned num, unsigned mask) |
| 51 | { | 51 | { |
| 52 | return (num + net_hash_mix(net)) & (UDP_HTABLE_SIZE - 1); | 52 | return (num + net_hash_mix(net)) & mask; |
| 53 | } | 53 | } |
| 54 | 54 | ||
| 55 | struct udp_sock { | 55 | struct udp_sock { |
| 56 | /* inet_sock has to be the first member */ | 56 | /* inet_sock has to be the first member */ |
| 57 | struct inet_sock inet; | 57 | struct inet_sock inet; |
| 58 | #define udp_port_hash inet.sk.__sk_common.skc_u16hashes[0] | ||
| 59 | #define udp_portaddr_hash inet.sk.__sk_common.skc_u16hashes[1] | ||
| 60 | #define udp_portaddr_node inet.sk.__sk_common.skc_portaddr_node | ||
| 58 | int pending; /* Any pending frames ? */ | 61 | int pending; /* Any pending frames ? */ |
| 59 | unsigned int corkflag; /* Cork is required */ | 62 | unsigned int corkflag; /* Cork is required */ |
| 60 | __u16 encap_type; /* Is this an Encapsulation socket? */ | 63 | __u16 encap_type; /* Is this an Encapsulation socket? */ |
| @@ -85,6 +88,12 @@ static inline struct udp_sock *udp_sk(const struct sock *sk) | |||
| 85 | return (struct udp_sock *)sk; | 88 | return (struct udp_sock *)sk; |
| 86 | } | 89 | } |
| 87 | 90 | ||
| 91 | #define udp_portaddr_for_each_entry(__sk, node, list) \ | ||
| 92 | hlist_nulls_for_each_entry(__sk, node, list, __sk_common.skc_portaddr_node) | ||
| 93 | |||
| 94 | #define udp_portaddr_for_each_entry_rcu(__sk, node, list) \ | ||
| 95 | hlist_nulls_for_each_entry_rcu(__sk, node, list, __sk_common.skc_portaddr_node) | ||
| 96 | |||
| 88 | #define IS_UDPLITE(__sk) (udp_sk(__sk)->pcflag) | 97 | #define IS_UDPLITE(__sk) (udp_sk(__sk)->pcflag) |
| 89 | 98 | ||
| 90 | #endif | 99 | #endif |
diff --git a/include/linux/usb.h b/include/linux/usb.h index a34fa89f1474..739f1fd1cc15 100644 --- a/include/linux/usb.h +++ b/include/linux/usb.h | |||
| @@ -122,7 +122,6 @@ enum usb_interface_condition { | |||
| 122 | * number from the USB core by calling usb_register_dev(). | 122 | * number from the USB core by calling usb_register_dev(). |
| 123 | * @condition: binding state of the interface: not bound, binding | 123 | * @condition: binding state of the interface: not bound, binding |
| 124 | * (in probe()), bound to a driver, or unbinding (in disconnect()) | 124 | * (in probe()), bound to a driver, or unbinding (in disconnect()) |
| 125 | * @is_active: flag set when the interface is bound and not suspended. | ||
| 126 | * @sysfs_files_created: sysfs attributes exist | 125 | * @sysfs_files_created: sysfs attributes exist |
| 127 | * @ep_devs_created: endpoint child pseudo-devices exist | 126 | * @ep_devs_created: endpoint child pseudo-devices exist |
| 128 | * @unregistering: flag set when the interface is being unregistered | 127 | * @unregistering: flag set when the interface is being unregistered |
| @@ -135,8 +134,7 @@ enum usb_interface_condition { | |||
| 135 | * @dev: driver model's view of this device | 134 | * @dev: driver model's view of this device |
| 136 | * @usb_dev: if an interface is bound to the USB major, this will point | 135 | * @usb_dev: if an interface is bound to the USB major, this will point |
| 137 | * to the sysfs representation for that device. | 136 | * to the sysfs representation for that device. |
| 138 | * @pm_usage_cnt: PM usage counter for this interface; autosuspend is not | 137 | * @pm_usage_cnt: PM usage counter for this interface |
| 139 | * allowed unless the counter is 0. | ||
| 140 | * @reset_ws: Used for scheduling resets from atomic context. | 138 | * @reset_ws: Used for scheduling resets from atomic context. |
| 141 | * @reset_running: set to 1 if the interface is currently running a | 139 | * @reset_running: set to 1 if the interface is currently running a |
| 142 | * queued reset so that usb_cancel_queued_reset() doesn't try to | 140 | * queued reset so that usb_cancel_queued_reset() doesn't try to |
| @@ -184,7 +182,6 @@ struct usb_interface { | |||
| 184 | int minor; /* minor number this interface is | 182 | int minor; /* minor number this interface is |
| 185 | * bound to */ | 183 | * bound to */ |
| 186 | enum usb_interface_condition condition; /* state of binding */ | 184 | enum usb_interface_condition condition; /* state of binding */ |
| 187 | unsigned is_active:1; /* the interface is not suspended */ | ||
| 188 | unsigned sysfs_files_created:1; /* the sysfs attributes exist */ | 185 | unsigned sysfs_files_created:1; /* the sysfs attributes exist */ |
| 189 | unsigned ep_devs_created:1; /* endpoint "devices" exist */ | 186 | unsigned ep_devs_created:1; /* endpoint "devices" exist */ |
| 190 | unsigned unregistering:1; /* unregistration is in progress */ | 187 | unsigned unregistering:1; /* unregistration is in progress */ |
| @@ -192,6 +189,7 @@ struct usb_interface { | |||
| 192 | unsigned needs_altsetting0:1; /* switch to altsetting 0 is pending */ | 189 | unsigned needs_altsetting0:1; /* switch to altsetting 0 is pending */ |
| 193 | unsigned needs_binding:1; /* needs delayed unbind/rebind */ | 190 | unsigned needs_binding:1; /* needs delayed unbind/rebind */ |
| 194 | unsigned reset_running:1; | 191 | unsigned reset_running:1; |
| 192 | unsigned resetting_device:1; /* true: bandwidth alloc after reset */ | ||
| 195 | 193 | ||
| 196 | struct device dev; /* interface specific device info */ | 194 | struct device dev; /* interface specific device info */ |
| 197 | struct device *usb_dev; | 195 | struct device *usb_dev; |
| @@ -331,12 +329,14 @@ struct usb_bus { | |||
| 331 | u8 otg_port; /* 0, or number of OTG/HNP port */ | 329 | u8 otg_port; /* 0, or number of OTG/HNP port */ |
| 332 | unsigned is_b_host:1; /* true during some HNP roleswitches */ | 330 | unsigned is_b_host:1; /* true during some HNP roleswitches */ |
| 333 | unsigned b_hnp_enable:1; /* OTG: did A-Host enable HNP? */ | 331 | unsigned b_hnp_enable:1; /* OTG: did A-Host enable HNP? */ |
| 332 | unsigned sg_tablesize; /* 0 or largest number of sg list entries */ | ||
| 334 | 333 | ||
| 335 | int devnum_next; /* Next open device number in | 334 | int devnum_next; /* Next open device number in |
| 336 | * round-robin allocation */ | 335 | * round-robin allocation */ |
| 337 | 336 | ||
| 338 | struct usb_devmap devmap; /* device address allocation map */ | 337 | struct usb_devmap devmap; /* device address allocation map */ |
| 339 | struct usb_device *root_hub; /* Root hub */ | 338 | struct usb_device *root_hub; /* Root hub */ |
| 339 | struct usb_bus *hs_companion; /* Companion EHCI bus, if any */ | ||
| 340 | struct list_head bus_list; /* list of busses */ | 340 | struct list_head bus_list; /* list of busses */ |
| 341 | 341 | ||
| 342 | int bandwidth_allocated; /* on this bus: how much of the time | 342 | int bandwidth_allocated; /* on this bus: how much of the time |
| @@ -398,7 +398,6 @@ struct usb_tt; | |||
| 398 | * @portnum: parent port number (origin 1) | 398 | * @portnum: parent port number (origin 1) |
| 399 | * @level: number of USB hub ancestors | 399 | * @level: number of USB hub ancestors |
| 400 | * @can_submit: URBs may be submitted | 400 | * @can_submit: URBs may be submitted |
| 401 | * @discon_suspended: disconnected while suspended | ||
| 402 | * @persist_enabled: USB_PERSIST enabled for this device | 401 | * @persist_enabled: USB_PERSIST enabled for this device |
| 403 | * @have_langid: whether string_langid is valid | 402 | * @have_langid: whether string_langid is valid |
| 404 | * @authorized: policy has said we can use it; | 403 | * @authorized: policy has said we can use it; |
| @@ -418,22 +417,15 @@ struct usb_tt; | |||
| 418 | * @usbfs_dentry: usbfs dentry entry for the device | 417 | * @usbfs_dentry: usbfs dentry entry for the device |
| 419 | * @maxchild: number of ports if hub | 418 | * @maxchild: number of ports if hub |
| 420 | * @children: child devices - USB devices that are attached to this hub | 419 | * @children: child devices - USB devices that are attached to this hub |
| 421 | * @pm_usage_cnt: usage counter for autosuspend | ||
| 422 | * @quirks: quirks of the whole device | 420 | * @quirks: quirks of the whole device |
| 423 | * @urbnum: number of URBs submitted for the whole device | 421 | * @urbnum: number of URBs submitted for the whole device |
| 424 | * @active_duration: total time device is not suspended | 422 | * @active_duration: total time device is not suspended |
| 425 | * @autosuspend: for delayed autosuspends | ||
| 426 | * @autoresume: for autoresumes requested while in_interrupt | ||
| 427 | * @pm_mutex: protects PM operations | ||
| 428 | * @last_busy: time of last use | 423 | * @last_busy: time of last use |
| 429 | * @autosuspend_delay: in jiffies | 424 | * @autosuspend_delay: in jiffies |
| 430 | * @connect_time: time device was first connected | 425 | * @connect_time: time device was first connected |
| 431 | * @auto_pm: autosuspend/resume in progress | ||
| 432 | * @do_remote_wakeup: remote wakeup should be enabled | 426 | * @do_remote_wakeup: remote wakeup should be enabled |
| 433 | * @reset_resume: needs reset instead of resume | 427 | * @reset_resume: needs reset instead of resume |
| 434 | * @autosuspend_disabled: autosuspend disabled by the user | 428 | * @autosuspend_disabled: autosuspend disabled by the user |
| 435 | * @autoresume_disabled: autoresume disabled by the user | ||
| 436 | * @skip_sys_resume: skip the next system resume | ||
| 437 | * @wusb_dev: if this is a Wireless USB device, link to the WUSB | 429 | * @wusb_dev: if this is a Wireless USB device, link to the WUSB |
| 438 | * specific data for the device. | 430 | * specific data for the device. |
| 439 | * @slot_id: Slot ID assigned by xHCI | 431 | * @slot_id: Slot ID assigned by xHCI |
| @@ -474,7 +466,6 @@ struct usb_device { | |||
| 474 | u8 level; | 466 | u8 level; |
| 475 | 467 | ||
| 476 | unsigned can_submit:1; | 468 | unsigned can_submit:1; |
| 477 | unsigned discon_suspended:1; | ||
| 478 | unsigned persist_enabled:1; | 469 | unsigned persist_enabled:1; |
| 479 | unsigned have_langid:1; | 470 | unsigned have_langid:1; |
| 480 | unsigned authorized:1; | 471 | unsigned authorized:1; |
| @@ -498,27 +489,19 @@ struct usb_device { | |||
| 498 | int maxchild; | 489 | int maxchild; |
| 499 | struct usb_device *children[USB_MAXCHILDREN]; | 490 | struct usb_device *children[USB_MAXCHILDREN]; |
| 500 | 491 | ||
| 501 | int pm_usage_cnt; | ||
| 502 | u32 quirks; | 492 | u32 quirks; |
| 503 | atomic_t urbnum; | 493 | atomic_t urbnum; |
| 504 | 494 | ||
| 505 | unsigned long active_duration; | 495 | unsigned long active_duration; |
| 506 | 496 | ||
| 507 | #ifdef CONFIG_PM | 497 | #ifdef CONFIG_PM |
| 508 | struct delayed_work autosuspend; | ||
| 509 | struct work_struct autoresume; | ||
| 510 | struct mutex pm_mutex; | ||
| 511 | |||
| 512 | unsigned long last_busy; | 498 | unsigned long last_busy; |
| 513 | int autosuspend_delay; | 499 | int autosuspend_delay; |
| 514 | unsigned long connect_time; | 500 | unsigned long connect_time; |
| 515 | 501 | ||
| 516 | unsigned auto_pm:1; | ||
| 517 | unsigned do_remote_wakeup:1; | 502 | unsigned do_remote_wakeup:1; |
| 518 | unsigned reset_resume:1; | 503 | unsigned reset_resume:1; |
| 519 | unsigned autosuspend_disabled:1; | 504 | unsigned autosuspend_disabled:1; |
| 520 | unsigned autoresume_disabled:1; | ||
| 521 | unsigned skip_sys_resume:1; | ||
| 522 | #endif | 505 | #endif |
| 523 | struct wusb_dev *wusb_dev; | 506 | struct wusb_dev *wusb_dev; |
| 524 | int slot_id; | 507 | int slot_id; |
| @@ -529,9 +512,9 @@ extern struct usb_device *usb_get_dev(struct usb_device *dev); | |||
| 529 | extern void usb_put_dev(struct usb_device *dev); | 512 | extern void usb_put_dev(struct usb_device *dev); |
| 530 | 513 | ||
| 531 | /* USB device locking */ | 514 | /* USB device locking */ |
| 532 | #define usb_lock_device(udev) down(&(udev)->dev.sem) | 515 | #define usb_lock_device(udev) device_lock(&(udev)->dev) |
| 533 | #define usb_unlock_device(udev) up(&(udev)->dev.sem) | 516 | #define usb_unlock_device(udev) device_unlock(&(udev)->dev) |
| 534 | #define usb_trylock_device(udev) down_trylock(&(udev)->dev.sem) | 517 | #define usb_trylock_device(udev) device_trylock(&(udev)->dev) |
| 535 | extern int usb_lock_device_for_reset(struct usb_device *udev, | 518 | extern int usb_lock_device_for_reset(struct usb_device *udev, |
| 536 | const struct usb_interface *iface); | 519 | const struct usb_interface *iface); |
| 537 | 520 | ||
| @@ -543,23 +526,15 @@ extern struct usb_device *usb_find_device(u16 vendor_id, u16 product_id); | |||
| 543 | 526 | ||
| 544 | /* USB autosuspend and autoresume */ | 527 | /* USB autosuspend and autoresume */ |
| 545 | #ifdef CONFIG_USB_SUSPEND | 528 | #ifdef CONFIG_USB_SUSPEND |
| 546 | extern int usb_autopm_set_interface(struct usb_interface *intf); | 529 | extern int usb_enable_autosuspend(struct usb_device *udev); |
| 530 | extern int usb_disable_autosuspend(struct usb_device *udev); | ||
| 531 | |||
| 547 | extern int usb_autopm_get_interface(struct usb_interface *intf); | 532 | extern int usb_autopm_get_interface(struct usb_interface *intf); |
| 548 | extern void usb_autopm_put_interface(struct usb_interface *intf); | 533 | extern void usb_autopm_put_interface(struct usb_interface *intf); |
| 549 | extern int usb_autopm_get_interface_async(struct usb_interface *intf); | 534 | extern int usb_autopm_get_interface_async(struct usb_interface *intf); |
| 550 | extern void usb_autopm_put_interface_async(struct usb_interface *intf); | 535 | extern void usb_autopm_put_interface_async(struct usb_interface *intf); |
| 551 | 536 | extern void usb_autopm_get_interface_no_resume(struct usb_interface *intf); | |
| 552 | static inline void usb_autopm_enable(struct usb_interface *intf) | 537 | extern void usb_autopm_put_interface_no_suspend(struct usb_interface *intf); |
| 553 | { | ||
| 554 | atomic_set(&intf->pm_usage_cnt, 0); | ||
| 555 | usb_autopm_set_interface(intf); | ||
| 556 | } | ||
| 557 | |||
| 558 | static inline void usb_autopm_disable(struct usb_interface *intf) | ||
| 559 | { | ||
| 560 | atomic_set(&intf->pm_usage_cnt, 1); | ||
| 561 | usb_autopm_set_interface(intf); | ||
| 562 | } | ||
| 563 | 538 | ||
| 564 | static inline void usb_mark_last_busy(struct usb_device *udev) | 539 | static inline void usb_mark_last_busy(struct usb_device *udev) |
| 565 | { | 540 | { |
| @@ -568,12 +543,13 @@ static inline void usb_mark_last_busy(struct usb_device *udev) | |||
| 568 | 543 | ||
| 569 | #else | 544 | #else |
| 570 | 545 | ||
| 571 | static inline int usb_autopm_set_interface(struct usb_interface *intf) | 546 | static inline int usb_enable_autosuspend(struct usb_device *udev) |
| 547 | { return 0; } | ||
| 548 | static inline int usb_disable_autosuspend(struct usb_device *udev) | ||
| 572 | { return 0; } | 549 | { return 0; } |
| 573 | 550 | ||
| 574 | static inline int usb_autopm_get_interface(struct usb_interface *intf) | 551 | static inline int usb_autopm_get_interface(struct usb_interface *intf) |
| 575 | { return 0; } | 552 | { return 0; } |
| 576 | |||
| 577 | static inline int usb_autopm_get_interface_async(struct usb_interface *intf) | 553 | static inline int usb_autopm_get_interface_async(struct usb_interface *intf) |
| 578 | { return 0; } | 554 | { return 0; } |
| 579 | 555 | ||
| @@ -581,9 +557,11 @@ static inline void usb_autopm_put_interface(struct usb_interface *intf) | |||
| 581 | { } | 557 | { } |
| 582 | static inline void usb_autopm_put_interface_async(struct usb_interface *intf) | 558 | static inline void usb_autopm_put_interface_async(struct usb_interface *intf) |
| 583 | { } | 559 | { } |
| 584 | static inline void usb_autopm_enable(struct usb_interface *intf) | 560 | static inline void usb_autopm_get_interface_no_resume( |
| 561 | struct usb_interface *intf) | ||
| 585 | { } | 562 | { } |
| 586 | static inline void usb_autopm_disable(struct usb_interface *intf) | 563 | static inline void usb_autopm_put_interface_no_suspend( |
| 564 | struct usb_interface *intf) | ||
| 587 | { } | 565 | { } |
| 588 | static inline void usb_mark_last_busy(struct usb_device *udev) | 566 | static inline void usb_mark_last_busy(struct usb_device *udev) |
| 589 | { } | 567 | { } |
| @@ -626,6 +604,10 @@ extern struct usb_interface *usb_ifnum_to_if(const struct usb_device *dev, | |||
| 626 | unsigned ifnum); | 604 | unsigned ifnum); |
| 627 | extern struct usb_host_interface *usb_altnum_to_altsetting( | 605 | extern struct usb_host_interface *usb_altnum_to_altsetting( |
| 628 | const struct usb_interface *intf, unsigned int altnum); | 606 | const struct usb_interface *intf, unsigned int altnum); |
| 607 | extern struct usb_host_interface *usb_find_alt_setting( | ||
| 608 | struct usb_host_config *config, | ||
| 609 | unsigned int iface_num, | ||
| 610 | unsigned int alt_num); | ||
| 629 | 611 | ||
| 630 | 612 | ||
| 631 | /** | 613 | /** |
| @@ -1073,7 +1055,8 @@ typedef void (*usb_complete_t)(struct urb *); | |||
| 1073 | * @number_of_packets: Lists the number of ISO transfer buffers. | 1055 | * @number_of_packets: Lists the number of ISO transfer buffers. |
| 1074 | * @interval: Specifies the polling interval for interrupt or isochronous | 1056 | * @interval: Specifies the polling interval for interrupt or isochronous |
| 1075 | * transfers. The units are frames (milliseconds) for full and low | 1057 | * transfers. The units are frames (milliseconds) for full and low |
| 1076 | * speed devices, and microframes (1/8 millisecond) for highspeed ones. | 1058 | * speed devices, and microframes (1/8 millisecond) for highspeed |
| 1059 | * and SuperSpeed devices. | ||
| 1077 | * @error_count: Returns the number of ISO transfers that reported errors. | 1060 | * @error_count: Returns the number of ISO transfers that reported errors. |
| 1078 | * @context: For use in completion functions. This normally points to | 1061 | * @context: For use in completion functions. This normally points to |
| 1079 | * request-specific driver context. | 1062 | * request-specific driver context. |
| @@ -1102,7 +1085,7 @@ typedef void (*usb_complete_t)(struct urb *); | |||
| 1102 | * Alternatively, drivers may pass the URB_NO_xxx_DMA_MAP transfer flags, | 1085 | * Alternatively, drivers may pass the URB_NO_xxx_DMA_MAP transfer flags, |
| 1103 | * which tell the host controller driver that no such mapping is needed since | 1086 | * which tell the host controller driver that no such mapping is needed since |
| 1104 | * the device driver is DMA-aware. For example, a device driver might | 1087 | * the device driver is DMA-aware. For example, a device driver might |
| 1105 | * allocate a DMA buffer with usb_buffer_alloc() or call usb_buffer_map(). | 1088 | * allocate a DMA buffer with usb_alloc_coherent() or call usb_buffer_map(). |
| 1106 | * When these transfer flags are provided, host controller drivers will | 1089 | * When these transfer flags are provided, host controller drivers will |
| 1107 | * attempt to use the dma addresses found in the transfer_dma and/or | 1090 | * attempt to use the dma addresses found in the transfer_dma and/or |
| 1108 | * setup_dma fields rather than determining a dma address themselves. | 1091 | * setup_dma fields rather than determining a dma address themselves. |
| @@ -1304,9 +1287,16 @@ static inline void usb_fill_bulk_urb(struct urb *urb, | |||
| 1304 | * | 1287 | * |
| 1305 | * Initializes a interrupt urb with the proper information needed to submit | 1288 | * Initializes a interrupt urb with the proper information needed to submit |
| 1306 | * it to a device. | 1289 | * it to a device. |
| 1307 | * Note that high speed interrupt endpoints use a logarithmic encoding of | 1290 | * |
| 1308 | * the endpoint interval, and express polling intervals in microframes | 1291 | * Note that High Speed and SuperSpeed interrupt endpoints use a logarithmic |
| 1309 | * (eight per millisecond) rather than in frames (one per millisecond). | 1292 | * encoding of the endpoint interval, and express polling intervals in |
| 1293 | * microframes (eight per millisecond) rather than in frames (one per | ||
| 1294 | * millisecond). | ||
| 1295 | * | ||
| 1296 | * Wireless USB also uses the logarithmic encoding, but specifies it in units of | ||
| 1297 | * 128us instead of 125us. For Wireless USB devices, the interval is passed | ||
| 1298 | * through to the host controller, rather than being translated into microframe | ||
| 1299 | * units. | ||
| 1310 | */ | 1300 | */ |
| 1311 | static inline void usb_fill_int_urb(struct urb *urb, | 1301 | static inline void usb_fill_int_urb(struct urb *urb, |
| 1312 | struct usb_device *dev, | 1302 | struct usb_device *dev, |
| @@ -1323,7 +1313,7 @@ static inline void usb_fill_int_urb(struct urb *urb, | |||
| 1323 | urb->transfer_buffer_length = buffer_length; | 1313 | urb->transfer_buffer_length = buffer_length; |
| 1324 | urb->complete = complete_fn; | 1314 | urb->complete = complete_fn; |
| 1325 | urb->context = context; | 1315 | urb->context = context; |
| 1326 | if (dev->speed == USB_SPEED_HIGH) | 1316 | if (dev->speed == USB_SPEED_HIGH || dev->speed == USB_SPEED_SUPER) |
| 1327 | urb->interval = 1 << (interval - 1); | 1317 | urb->interval = 1 << (interval - 1); |
| 1328 | else | 1318 | else |
| 1329 | urb->interval = interval; | 1319 | urb->interval = interval; |
| @@ -1376,11 +1366,23 @@ static inline int usb_urb_dir_out(struct urb *urb) | |||
| 1376 | return (urb->transfer_flags & URB_DIR_MASK) == URB_DIR_OUT; | 1366 | return (urb->transfer_flags & URB_DIR_MASK) == URB_DIR_OUT; |
| 1377 | } | 1367 | } |
| 1378 | 1368 | ||
| 1379 | void *usb_buffer_alloc(struct usb_device *dev, size_t size, | 1369 | void *usb_alloc_coherent(struct usb_device *dev, size_t size, |
| 1380 | gfp_t mem_flags, dma_addr_t *dma); | 1370 | gfp_t mem_flags, dma_addr_t *dma); |
| 1381 | void usb_buffer_free(struct usb_device *dev, size_t size, | 1371 | void usb_free_coherent(struct usb_device *dev, size_t size, |
| 1382 | void *addr, dma_addr_t dma); | 1372 | void *addr, dma_addr_t dma); |
| 1383 | 1373 | ||
| 1374 | /* Compatible macros while we switch over */ | ||
| 1375 | static inline void *usb_buffer_alloc(struct usb_device *dev, size_t size, | ||
| 1376 | gfp_t mem_flags, dma_addr_t *dma) | ||
| 1377 | { | ||
| 1378 | return usb_alloc_coherent(dev, size, mem_flags, dma); | ||
| 1379 | } | ||
| 1380 | static inline void usb_buffer_free(struct usb_device *dev, size_t size, | ||
| 1381 | void *addr, dma_addr_t dma) | ||
| 1382 | { | ||
| 1383 | return usb_free_coherent(dev, size, addr, dma); | ||
| 1384 | } | ||
| 1385 | |||
| 1384 | #if 0 | 1386 | #if 0 |
| 1385 | struct urb *usb_buffer_map(struct urb *urb); | 1387 | struct urb *usb_buffer_map(struct urb *urb); |
| 1386 | void usb_buffer_dmasync(struct urb *urb); | 1388 | void usb_buffer_dmasync(struct urb *urb); |
| @@ -1584,14 +1586,18 @@ extern void usb_register_notify(struct notifier_block *nb); | |||
| 1584 | extern void usb_unregister_notify(struct notifier_block *nb); | 1586 | extern void usb_unregister_notify(struct notifier_block *nb); |
| 1585 | 1587 | ||
| 1586 | #ifdef DEBUG | 1588 | #ifdef DEBUG |
| 1587 | #define dbg(format, arg...) printk(KERN_DEBUG "%s: " format "\n" , \ | 1589 | #define dbg(format, arg...) \ |
| 1588 | __FILE__ , ## arg) | 1590 | printk(KERN_DEBUG "%s: " format "\n", __FILE__, ##arg) |
| 1589 | #else | 1591 | #else |
| 1590 | #define dbg(format, arg...) do {} while (0) | 1592 | #define dbg(format, arg...) \ |
| 1593 | do { \ | ||
| 1594 | if (0) \ | ||
| 1595 | printk(KERN_DEBUG "%s: " format "\n", __FILE__, ##arg); \ | ||
| 1596 | } while (0) | ||
| 1591 | #endif | 1597 | #endif |
| 1592 | 1598 | ||
| 1593 | #define err(format, arg...) printk(KERN_ERR KBUILD_MODNAME ": " \ | 1599 | #define err(format, arg...) \ |
| 1594 | format "\n" , ## arg) | 1600 | printk(KERN_ERR KBUILD_MODNAME ": " format "\n", ##arg) |
| 1595 | 1601 | ||
| 1596 | /* debugfs stuff */ | 1602 | /* debugfs stuff */ |
| 1597 | extern struct dentry *usb_debug_root; | 1603 | extern struct dentry *usb_debug_root; |
diff --git a/include/linux/usb/Kbuild b/include/linux/usb/Kbuild index 54c446309a2a..29fd73b0bffc 100644 --- a/include/linux/usb/Kbuild +++ b/include/linux/usb/Kbuild | |||
| @@ -5,4 +5,3 @@ header-y += gadgetfs.h | |||
| 5 | header-y += midi.h | 5 | header-y += midi.h |
| 6 | header-y += g_printer.h | 6 | header-y += g_printer.h |
| 7 | header-y += tmc.h | 7 | header-y += tmc.h |
| 8 | header-y += vstusb.h | ||
diff --git a/include/linux/usb/atmel_usba_udc.h b/include/linux/usb/atmel_usba_udc.h index 6311fa2d9f82..baf41c8616e9 100644 --- a/include/linux/usb/atmel_usba_udc.h +++ b/include/linux/usb/atmel_usba_udc.h | |||
| @@ -15,6 +15,7 @@ struct usba_ep_data { | |||
| 15 | 15 | ||
| 16 | struct usba_platform_data { | 16 | struct usba_platform_data { |
| 17 | int vbus_pin; | 17 | int vbus_pin; |
| 18 | int vbus_pin_inverted; | ||
| 18 | int num_ep; | 19 | int num_ep; |
| 19 | struct usba_ep_data ep[0]; | 20 | struct usba_ep_data ep[0]; |
| 20 | }; | 21 | }; |
diff --git a/include/linux/usb/audio.h b/include/linux/usb/audio.h index eaf9dffe0a01..4d3e450e2b03 100644 --- a/include/linux/usb/audio.h +++ b/include/linux/usb/audio.h | |||
| @@ -25,6 +25,9 @@ | |||
| 25 | #define USB_SUBCLASS_AUDIOSTREAMING 0x02 | 25 | #define USB_SUBCLASS_AUDIOSTREAMING 0x02 |
| 26 | #define USB_SUBCLASS_MIDISTREAMING 0x03 | 26 | #define USB_SUBCLASS_MIDISTREAMING 0x03 |
| 27 | 27 | ||
| 28 | #define UAC_VERSION_1 0x00 | ||
| 29 | #define UAC_VERSION_2 0x20 | ||
| 30 | |||
| 28 | /* A.5 Audio Class-Specific AC Interface Descriptor Subtypes */ | 31 | /* A.5 Audio Class-Specific AC Interface Descriptor Subtypes */ |
| 29 | #define UAC_HEADER 0x01 | 32 | #define UAC_HEADER 0x01 |
| 30 | #define UAC_INPUT_TERMINAL 0x02 | 33 | #define UAC_INPUT_TERMINAL 0x02 |
| @@ -32,8 +35,17 @@ | |||
| 32 | #define UAC_MIXER_UNIT 0x04 | 35 | #define UAC_MIXER_UNIT 0x04 |
| 33 | #define UAC_SELECTOR_UNIT 0x05 | 36 | #define UAC_SELECTOR_UNIT 0x05 |
| 34 | #define UAC_FEATURE_UNIT 0x06 | 37 | #define UAC_FEATURE_UNIT 0x06 |
| 35 | #define UAC_PROCESSING_UNIT 0x07 | 38 | #define UAC_PROCESSING_UNIT_V1 0x07 |
| 36 | #define UAC_EXTENSION_UNIT 0x08 | 39 | #define UAC_EXTENSION_UNIT_V1 0x08 |
| 40 | |||
| 41 | /* UAC v2.0 types */ | ||
| 42 | #define UAC_EFFECT_UNIT 0x07 | ||
| 43 | #define UAC_PROCESSING_UNIT_V2 0x08 | ||
| 44 | #define UAC_EXTENSION_UNIT_V2 0x09 | ||
| 45 | #define UAC_CLOCK_SOURCE 0x0a | ||
| 46 | #define UAC_CLOCK_SELECTOR 0x0b | ||
| 47 | #define UAC_CLOCK_MULTIPLIER 0x0c | ||
| 48 | #define UAC_SAMPLE_RATE_CONVERTER 0x0d | ||
| 37 | 49 | ||
| 38 | /* A.6 Audio Class-Specific AS Interface Descriptor Subtypes */ | 50 | /* A.6 Audio Class-Specific AS Interface Descriptor Subtypes */ |
| 39 | #define UAC_AS_GENERAL 0x01 | 51 | #define UAC_AS_GENERAL 0x01 |
| @@ -66,6 +78,10 @@ | |||
| 66 | 78 | ||
| 67 | #define UAC_GET_STAT 0xff | 79 | #define UAC_GET_STAT 0xff |
| 68 | 80 | ||
| 81 | /* Audio class v2.0 handles all the parameter calls differently */ | ||
| 82 | #define UAC2_CS_CUR 0x01 | ||
| 83 | #define UAC2_CS_RANGE 0x02 | ||
| 84 | |||
| 69 | /* MIDI - A.1 MS Class-Specific Interface Descriptor Subtypes */ | 85 | /* MIDI - A.1 MS Class-Specific Interface Descriptor Subtypes */ |
| 70 | #define UAC_MS_HEADER 0x01 | 86 | #define UAC_MS_HEADER 0x01 |
| 71 | #define UAC_MIDI_IN_JACK 0x02 | 87 | #define UAC_MIDI_IN_JACK 0x02 |
| @@ -81,7 +97,7 @@ | |||
| 81 | 97 | ||
| 82 | /* Terminal Control Selectors */ | 98 | /* Terminal Control Selectors */ |
| 83 | /* 4.3.2 Class-Specific AC Interface Descriptor */ | 99 | /* 4.3.2 Class-Specific AC Interface Descriptor */ |
| 84 | struct uac_ac_header_descriptor { | 100 | struct uac_ac_header_descriptor_v1 { |
| 85 | __u8 bLength; /* 8 + n */ | 101 | __u8 bLength; /* 8 + n */ |
| 86 | __u8 bDescriptorType; /* USB_DT_CS_INTERFACE */ | 102 | __u8 bDescriptorType; /* USB_DT_CS_INTERFACE */ |
| 87 | __u8 bDescriptorSubtype; /* UAC_MS_HEADER */ | 103 | __u8 bDescriptorSubtype; /* UAC_MS_HEADER */ |
| @@ -95,7 +111,7 @@ struct uac_ac_header_descriptor { | |||
| 95 | 111 | ||
| 96 | /* As above, but more useful for defining your own descriptors: */ | 112 | /* As above, but more useful for defining your own descriptors: */ |
| 97 | #define DECLARE_UAC_AC_HEADER_DESCRIPTOR(n) \ | 113 | #define DECLARE_UAC_AC_HEADER_DESCRIPTOR(n) \ |
| 98 | struct uac_ac_header_descriptor_##n { \ | 114 | struct uac_ac_header_descriptor_v1_##n { \ |
| 99 | __u8 bLength; \ | 115 | __u8 bLength; \ |
| 100 | __u8 bDescriptorType; \ | 116 | __u8 bDescriptorType; \ |
| 101 | __u8 bDescriptorSubtype; \ | 117 | __u8 bDescriptorSubtype; \ |
| @@ -130,8 +146,12 @@ struct uac_input_terminal_descriptor { | |||
| 130 | #define UAC_INPUT_TERMINAL_MICROPHONE_ARRAY 0x205 | 146 | #define UAC_INPUT_TERMINAL_MICROPHONE_ARRAY 0x205 |
| 131 | #define UAC_INPUT_TERMINAL_PROC_MICROPHONE_ARRAY 0x206 | 147 | #define UAC_INPUT_TERMINAL_PROC_MICROPHONE_ARRAY 0x206 |
| 132 | 148 | ||
| 149 | /* Terminals - control selectors */ | ||
| 150 | |||
| 151 | #define UAC_TERMINAL_CS_COPY_PROTECT_CONTROL 0x01 | ||
| 152 | |||
| 133 | /* 4.3.2.2 Output Terminal Descriptor */ | 153 | /* 4.3.2.2 Output Terminal Descriptor */ |
| 134 | struct uac_output_terminal_descriptor { | 154 | struct uac_output_terminal_descriptor_v1 { |
| 135 | __u8 bLength; /* in bytes: 9 */ | 155 | __u8 bLength; /* in bytes: 9 */ |
| 136 | __u8 bDescriptorType; /* CS_INTERFACE descriptor type */ | 156 | __u8 bDescriptorType; /* CS_INTERFACE descriptor type */ |
| 137 | __u8 bDescriptorSubtype; /* OUTPUT_TERMINAL descriptor subtype */ | 157 | __u8 bDescriptorSubtype; /* OUTPUT_TERMINAL descriptor subtype */ |
| @@ -171,7 +191,7 @@ struct uac_feature_unit_descriptor_##ch { \ | |||
| 171 | } __attribute__ ((packed)) | 191 | } __attribute__ ((packed)) |
| 172 | 192 | ||
| 173 | /* 4.5.2 Class-Specific AS Interface Descriptor */ | 193 | /* 4.5.2 Class-Specific AS Interface Descriptor */ |
| 174 | struct uac_as_header_descriptor { | 194 | struct uac_as_header_descriptor_v1 { |
| 175 | __u8 bLength; /* in bytes: 7 */ | 195 | __u8 bLength; /* in bytes: 7 */ |
| 176 | __u8 bDescriptorType; /* USB_DT_CS_INTERFACE */ | 196 | __u8 bDescriptorType; /* USB_DT_CS_INTERFACE */ |
| 177 | __u8 bDescriptorSubtype; /* AS_GENERAL */ | 197 | __u8 bDescriptorSubtype; /* AS_GENERAL */ |
| @@ -180,6 +200,19 @@ struct uac_as_header_descriptor { | |||
| 180 | __le16 wFormatTag; /* The Audio Data Format */ | 200 | __le16 wFormatTag; /* The Audio Data Format */ |
| 181 | } __attribute__ ((packed)); | 201 | } __attribute__ ((packed)); |
| 182 | 202 | ||
| 203 | struct uac_as_header_descriptor_v2 { | ||
| 204 | __u8 bLength; | ||
| 205 | __u8 bDescriptorType; | ||
| 206 | __u8 bDescriptorSubtype; | ||
| 207 | __u8 bTerminalLink; | ||
| 208 | __u8 bmControls; | ||
| 209 | __u8 bFormatType; | ||
| 210 | __u32 bmFormats; | ||
| 211 | __u8 bNrChannels; | ||
| 212 | __u32 bmChannelConfig; | ||
| 213 | __u8 iChannelNames; | ||
| 214 | } __attribute__((packed)); | ||
| 215 | |||
| 183 | #define UAC_DT_AS_HEADER_SIZE 7 | 216 | #define UAC_DT_AS_HEADER_SIZE 7 |
| 184 | 217 | ||
| 185 | /* Formats - A.1.1 Audio Data Format Type I Codes */ | 218 | /* Formats - A.1.1 Audio Data Format Type I Codes */ |
| @@ -232,11 +265,62 @@ struct uac_format_type_i_discrete_descriptor_##n { \ | |||
| 232 | 265 | ||
| 233 | #define UAC_FORMAT_TYPE_I_DISCRETE_DESC_SIZE(n) (8 + (n * 3)) | 266 | #define UAC_FORMAT_TYPE_I_DISCRETE_DESC_SIZE(n) (8 + (n * 3)) |
| 234 | 267 | ||
| 268 | struct uac_format_type_i_ext_descriptor { | ||
| 269 | __u8 bLength; | ||
| 270 | __u8 bDescriptorType; | ||
| 271 | __u8 bDescriptorSubtype; | ||
| 272 | __u8 bFormatType; | ||
| 273 | __u8 bSubslotSize; | ||
| 274 | __u8 bBitResolution; | ||
| 275 | __u8 bHeaderLength; | ||
| 276 | __u8 bControlSize; | ||
| 277 | __u8 bSideBandProtocol; | ||
| 278 | } __attribute__((packed)); | ||
| 279 | |||
| 280 | |||
| 281 | /* Formats - Audio Data Format Type I Codes */ | ||
| 282 | |||
| 283 | #define UAC_FORMAT_TYPE_II_MPEG 0x1001 | ||
| 284 | #define UAC_FORMAT_TYPE_II_AC3 0x1002 | ||
| 285 | |||
| 286 | struct uac_format_type_ii_discrete_descriptor { | ||
| 287 | __u8 bLength; | ||
| 288 | __u8 bDescriptorType; | ||
| 289 | __u8 bDescriptorSubtype; | ||
| 290 | __u8 bFormatType; | ||
| 291 | __le16 wMaxBitRate; | ||
| 292 | __le16 wSamplesPerFrame; | ||
| 293 | __u8 bSamFreqType; | ||
| 294 | __u8 tSamFreq[][3]; | ||
| 295 | } __attribute__((packed)); | ||
| 296 | |||
| 297 | struct uac_format_type_ii_ext_descriptor { | ||
| 298 | __u8 bLength; | ||
| 299 | __u8 bDescriptorType; | ||
| 300 | __u8 bDescriptorSubtype; | ||
| 301 | __u8 bFormatType; | ||
| 302 | __u16 wMaxBitRate; | ||
| 303 | __u16 wSamplesPerFrame; | ||
| 304 | __u8 bHeaderLength; | ||
| 305 | __u8 bSideBandProtocol; | ||
| 306 | } __attribute__((packed)); | ||
| 307 | |||
| 308 | /* type III */ | ||
| 309 | #define UAC_FORMAT_TYPE_III_IEC1937_AC3 0x2001 | ||
| 310 | #define UAC_FORMAT_TYPE_III_IEC1937_MPEG1_LAYER1 0x2002 | ||
| 311 | #define UAC_FORMAT_TYPE_III_IEC1937_MPEG2_NOEXT 0x2003 | ||
| 312 | #define UAC_FORMAT_TYPE_III_IEC1937_MPEG2_EXT 0x2004 | ||
| 313 | #define UAC_FORMAT_TYPE_III_IEC1937_MPEG2_LAYER1_LS 0x2005 | ||
| 314 | #define UAC_FORMAT_TYPE_III_IEC1937_MPEG2_LAYER23_LS 0x2006 | ||
| 315 | |||
| 235 | /* Formats - A.2 Format Type Codes */ | 316 | /* Formats - A.2 Format Type Codes */ |
| 236 | #define UAC_FORMAT_TYPE_UNDEFINED 0x0 | 317 | #define UAC_FORMAT_TYPE_UNDEFINED 0x0 |
| 237 | #define UAC_FORMAT_TYPE_I 0x1 | 318 | #define UAC_FORMAT_TYPE_I 0x1 |
| 238 | #define UAC_FORMAT_TYPE_II 0x2 | 319 | #define UAC_FORMAT_TYPE_II 0x2 |
| 239 | #define UAC_FORMAT_TYPE_III 0x3 | 320 | #define UAC_FORMAT_TYPE_III 0x3 |
| 321 | #define UAC_EXT_FORMAT_TYPE_I 0x81 | ||
| 322 | #define UAC_EXT_FORMAT_TYPE_II 0x82 | ||
| 323 | #define UAC_EXT_FORMAT_TYPE_III 0x83 | ||
| 240 | 324 | ||
| 241 | struct uac_iso_endpoint_descriptor { | 325 | struct uac_iso_endpoint_descriptor { |
| 242 | __u8 bLength; /* in bytes: 7 */ | 326 | __u8 bLength; /* in bytes: 7 */ |
| @@ -252,7 +336,31 @@ struct uac_iso_endpoint_descriptor { | |||
| 252 | #define UAC_EP_CS_ATTR_PITCH_CONTROL 0x02 | 336 | #define UAC_EP_CS_ATTR_PITCH_CONTROL 0x02 |
| 253 | #define UAC_EP_CS_ATTR_FILL_MAX 0x80 | 337 | #define UAC_EP_CS_ATTR_FILL_MAX 0x80 |
| 254 | 338 | ||
| 339 | /* Audio class v2.0: CLOCK_SOURCE descriptor */ | ||
| 340 | |||
| 341 | struct uac_clock_source_descriptor { | ||
| 342 | __u8 bLength; | ||
| 343 | __u8 bDescriptorType; | ||
| 344 | __u8 bDescriptorSubtype; | ||
| 345 | __u8 bClockID; | ||
| 346 | __u8 bmAttributes; | ||
| 347 | __u8 bmControls; | ||
| 348 | __u8 bAssocTerminal; | ||
| 349 | __u8 iClockSource; | ||
| 350 | } __attribute__((packed)); | ||
| 351 | |||
| 255 | /* A.10.2 Feature Unit Control Selectors */ | 352 | /* A.10.2 Feature Unit Control Selectors */ |
| 353 | |||
| 354 | struct uac_feature_unit_descriptor { | ||
| 355 | __u8 bLength; | ||
| 356 | __u8 bDescriptorType; | ||
| 357 | __u8 bDescriptorSubtype; | ||
| 358 | __u8 bUnitID; | ||
| 359 | __u8 bSourceID; | ||
| 360 | __u8 bControlSize; | ||
| 361 | __u8 controls[0]; /* variable length */ | ||
| 362 | } __attribute__((packed)); | ||
| 363 | |||
| 256 | #define UAC_FU_CONTROL_UNDEFINED 0x00 | 364 | #define UAC_FU_CONTROL_UNDEFINED 0x00 |
| 257 | #define UAC_MUTE_CONTROL 0x01 | 365 | #define UAC_MUTE_CONTROL 0x01 |
| 258 | #define UAC_VOLUME_CONTROL 0x02 | 366 | #define UAC_VOLUME_CONTROL 0x02 |
diff --git a/include/linux/usb/ch9.h b/include/linux/usb/ch9.h index 94012e649d86..e58369ff8168 100644 --- a/include/linux/usb/ch9.h +++ b/include/linux/usb/ch9.h | |||
| @@ -775,7 +775,7 @@ enum usb_device_speed { | |||
| 775 | USB_SPEED_UNKNOWN = 0, /* enumerating */ | 775 | USB_SPEED_UNKNOWN = 0, /* enumerating */ |
| 776 | USB_SPEED_LOW, USB_SPEED_FULL, /* usb 1.1 */ | 776 | USB_SPEED_LOW, USB_SPEED_FULL, /* usb 1.1 */ |
| 777 | USB_SPEED_HIGH, /* usb 2.0 */ | 777 | USB_SPEED_HIGH, /* usb 2.0 */ |
| 778 | USB_SPEED_VARIABLE, /* wireless (usb 2.5) */ | 778 | USB_SPEED_WIRELESS, /* wireless (usb 2.5) */ |
| 779 | USB_SPEED_SUPER, /* usb 3.0 */ | 779 | USB_SPEED_SUPER, /* usb 3.0 */ |
| 780 | }; | 780 | }; |
| 781 | 781 | ||
diff --git a/include/linux/usb/composite.h b/include/linux/usb/composite.h index 4f6bb3d2160e..738ea1a691cb 100644 --- a/include/linux/usb/composite.h +++ b/include/linux/usb/composite.h | |||
| @@ -127,6 +127,7 @@ struct usb_function { | |||
| 127 | /* private: */ | 127 | /* private: */ |
| 128 | /* internals */ | 128 | /* internals */ |
| 129 | struct list_head list; | 129 | struct list_head list; |
| 130 | DECLARE_BITMAP(endpoints, 32); | ||
| 130 | }; | 131 | }; |
| 131 | 132 | ||
| 132 | int usb_add_function(struct usb_configuration *, struct usb_function *); | 133 | int usb_add_function(struct usb_configuration *, struct usb_function *); |
diff --git a/include/linux/usb/gadget.h b/include/linux/usb/gadget.h index bbf45d500b6d..f4b7ca516cdd 100644 --- a/include/linux/usb/gadget.h +++ b/include/linux/usb/gadget.h | |||
| @@ -15,6 +15,8 @@ | |||
| 15 | #ifndef __LINUX_USB_GADGET_H | 15 | #ifndef __LINUX_USB_GADGET_H |
| 16 | #define __LINUX_USB_GADGET_H | 16 | #define __LINUX_USB_GADGET_H |
| 17 | 17 | ||
| 18 | #include <linux/slab.h> | ||
| 19 | |||
| 18 | struct usb_ep; | 20 | struct usb_ep; |
| 19 | 21 | ||
| 20 | /** | 22 | /** |
diff --git a/include/linux/usb/musb.h b/include/linux/usb/musb.h index d43755669261..7acef0234c0e 100644 --- a/include/linux/usb/musb.h +++ b/include/linux/usb/musb.h | |||
| @@ -30,26 +30,26 @@ struct musb_hdrc_eps_bits { | |||
| 30 | struct musb_hdrc_config { | 30 | struct musb_hdrc_config { |
| 31 | /* MUSB configuration-specific details */ | 31 | /* MUSB configuration-specific details */ |
| 32 | unsigned multipoint:1; /* multipoint device */ | 32 | unsigned multipoint:1; /* multipoint device */ |
| 33 | unsigned dyn_fifo:1; /* supports dynamic fifo sizing */ | 33 | unsigned dyn_fifo:1 __deprecated; /* supports dynamic fifo sizing */ |
| 34 | unsigned soft_con:1; /* soft connect required */ | 34 | unsigned soft_con:1 __deprecated; /* soft connect required */ |
| 35 | unsigned utm_16:1; /* utm data witdh is 16 bits */ | 35 | unsigned utm_16:1 __deprecated; /* utm data witdh is 16 bits */ |
| 36 | unsigned big_endian:1; /* true if CPU uses big-endian */ | 36 | unsigned big_endian:1; /* true if CPU uses big-endian */ |
| 37 | unsigned mult_bulk_tx:1; /* Tx ep required for multbulk pkts */ | 37 | unsigned mult_bulk_tx:1; /* Tx ep required for multbulk pkts */ |
| 38 | unsigned mult_bulk_rx:1; /* Rx ep required for multbulk pkts */ | 38 | unsigned mult_bulk_rx:1; /* Rx ep required for multbulk pkts */ |
| 39 | unsigned high_iso_tx:1; /* Tx ep required for HB iso */ | 39 | unsigned high_iso_tx:1; /* Tx ep required for HB iso */ |
| 40 | unsigned high_iso_rx:1; /* Rx ep required for HD iso */ | 40 | unsigned high_iso_rx:1; /* Rx ep required for HD iso */ |
| 41 | unsigned dma:1; /* supports DMA */ | 41 | unsigned dma:1 __deprecated; /* supports DMA */ |
| 42 | unsigned vendor_req:1; /* vendor registers required */ | 42 | unsigned vendor_req:1 __deprecated; /* vendor registers required */ |
| 43 | 43 | ||
| 44 | u8 num_eps; /* number of endpoints _with_ ep0 */ | 44 | u8 num_eps; /* number of endpoints _with_ ep0 */ |
| 45 | u8 dma_channels; /* number of dma channels */ | 45 | u8 dma_channels __deprecated; /* number of dma channels */ |
| 46 | u8 dyn_fifo_size; /* dynamic size in bytes */ | 46 | u8 dyn_fifo_size; /* dynamic size in bytes */ |
| 47 | u8 vendor_ctrl; /* vendor control reg width */ | 47 | u8 vendor_ctrl __deprecated; /* vendor control reg width */ |
| 48 | u8 vendor_stat; /* vendor status reg witdh */ | 48 | u8 vendor_stat __deprecated; /* vendor status reg witdh */ |
| 49 | u8 dma_req_chan; /* bitmask for required dma channels */ | 49 | u8 dma_req_chan __deprecated; /* bitmask for required dma channels */ |
| 50 | u8 ram_bits; /* ram address size */ | 50 | u8 ram_bits; /* ram address size */ |
| 51 | 51 | ||
| 52 | struct musb_hdrc_eps_bits *eps_bits; | 52 | struct musb_hdrc_eps_bits *eps_bits __deprecated; |
| 53 | #ifdef CONFIG_BLACKFIN | 53 | #ifdef CONFIG_BLACKFIN |
| 54 | /* A GPIO controlling VRSEL in Blackfin */ | 54 | /* A GPIO controlling VRSEL in Blackfin */ |
| 55 | unsigned int gpio_vrsel; | 55 | unsigned int gpio_vrsel; |
| @@ -76,6 +76,9 @@ struct musb_hdrc_platform_data { | |||
| 76 | /* (HOST or OTG) msec/2 after VBUS on till power good */ | 76 | /* (HOST or OTG) msec/2 after VBUS on till power good */ |
| 77 | u8 potpgt; | 77 | u8 potpgt; |
| 78 | 78 | ||
| 79 | /* (HOST or OTG) program PHY for external Vbus */ | ||
| 80 | unsigned extvbus:1; | ||
| 81 | |||
| 79 | /* Power the device on or off */ | 82 | /* Power the device on or off */ |
| 80 | int (*set_power)(int state); | 83 | int (*set_power)(int state); |
| 81 | 84 | ||
| @@ -84,6 +87,9 @@ struct musb_hdrc_platform_data { | |||
| 84 | 87 | ||
| 85 | /* MUSB configuration-specific details */ | 88 | /* MUSB configuration-specific details */ |
| 86 | struct musb_hdrc_config *config; | 89 | struct musb_hdrc_config *config; |
| 90 | |||
| 91 | /* Architecture specific board data */ | ||
| 92 | void *board_data; | ||
| 87 | }; | 93 | }; |
| 88 | 94 | ||
| 89 | 95 | ||
diff --git a/include/linux/usb/otg.h b/include/linux/usb/otg.h index 2443c0e7a80c..f8302d036a76 100644 --- a/include/linux/usb/otg.h +++ b/include/linux/usb/otg.h | |||
| @@ -9,6 +9,8 @@ | |||
| 9 | #ifndef __LINUX_USB_OTG_H | 9 | #ifndef __LINUX_USB_OTG_H |
| 10 | #define __LINUX_USB_OTG_H | 10 | #define __LINUX_USB_OTG_H |
| 11 | 11 | ||
| 12 | #include <linux/notifier.h> | ||
| 13 | |||
| 12 | /* OTG defines lots of enumeration states before device reset */ | 14 | /* OTG defines lots of enumeration states before device reset */ |
| 13 | enum usb_otg_state { | 15 | enum usb_otg_state { |
| 14 | OTG_STATE_UNDEFINED = 0, | 16 | OTG_STATE_UNDEFINED = 0, |
| @@ -33,6 +35,31 @@ enum usb_otg_state { | |||
| 33 | OTG_STATE_A_VBUS_ERR, | 35 | OTG_STATE_A_VBUS_ERR, |
| 34 | }; | 36 | }; |
| 35 | 37 | ||
| 38 | enum usb_xceiv_events { | ||
| 39 | USB_EVENT_NONE, /* no events or cable disconnected */ | ||
| 40 | USB_EVENT_VBUS, /* vbus valid event */ | ||
| 41 | USB_EVENT_ID, /* id was grounded */ | ||
| 42 | USB_EVENT_CHARGER, /* usb dedicated charger */ | ||
| 43 | USB_EVENT_ENUMERATED, /* gadget driver enumerated */ | ||
| 44 | }; | ||
| 45 | |||
| 46 | #define USB_OTG_PULLUP_ID (1 << 0) | ||
| 47 | #define USB_OTG_PULLDOWN_DP (1 << 1) | ||
| 48 | #define USB_OTG_PULLDOWN_DM (1 << 2) | ||
| 49 | #define USB_OTG_EXT_VBUS_INDICATOR (1 << 3) | ||
| 50 | #define USB_OTG_DRV_VBUS (1 << 4) | ||
| 51 | #define USB_OTG_DRV_VBUS_EXT (1 << 5) | ||
| 52 | |||
| 53 | struct otg_transceiver; | ||
| 54 | |||
| 55 | /* for transceivers connected thru an ULPI interface, the user must | ||
| 56 | * provide access ops | ||
| 57 | */ | ||
| 58 | struct otg_io_access_ops { | ||
| 59 | int (*read)(struct otg_transceiver *otg, u32 reg); | ||
| 60 | int (*write)(struct otg_transceiver *otg, u32 val, u32 reg); | ||
| 61 | }; | ||
| 62 | |||
| 36 | /* | 63 | /* |
| 37 | * the otg driver needs to interact with both device side and host side | 64 | * the otg driver needs to interact with both device side and host side |
| 38 | * usb controllers. it decides which controller is active at a given | 65 | * usb controllers. it decides which controller is active at a given |
| @@ -42,6 +69,7 @@ enum usb_otg_state { | |||
| 42 | struct otg_transceiver { | 69 | struct otg_transceiver { |
| 43 | struct device *dev; | 70 | struct device *dev; |
| 44 | const char *label; | 71 | const char *label; |
| 72 | unsigned int flags; | ||
| 45 | 73 | ||
| 46 | u8 default_a; | 74 | u8 default_a; |
| 47 | enum usb_otg_state state; | 75 | enum usb_otg_state state; |
| @@ -49,10 +77,20 @@ struct otg_transceiver { | |||
| 49 | struct usb_bus *host; | 77 | struct usb_bus *host; |
| 50 | struct usb_gadget *gadget; | 78 | struct usb_gadget *gadget; |
| 51 | 79 | ||
| 80 | struct otg_io_access_ops *io_ops; | ||
| 81 | void __iomem *io_priv; | ||
| 82 | |||
| 83 | /* for notification of usb_xceiv_events */ | ||
| 84 | struct blocking_notifier_head notifier; | ||
| 85 | |||
| 52 | /* to pass extra port status to the root hub */ | 86 | /* to pass extra port status to the root hub */ |
| 53 | u16 port_status; | 87 | u16 port_status; |
| 54 | u16 port_change; | 88 | u16 port_change; |
| 55 | 89 | ||
| 90 | /* initialize/shutdown the OTG controller */ | ||
| 91 | int (*init)(struct otg_transceiver *otg); | ||
| 92 | void (*shutdown)(struct otg_transceiver *otg); | ||
| 93 | |||
| 56 | /* bind/unbind the host controller */ | 94 | /* bind/unbind the host controller */ |
| 57 | int (*set_host)(struct otg_transceiver *otg, | 95 | int (*set_host)(struct otg_transceiver *otg, |
| 58 | struct usb_bus *host); | 96 | struct usb_bus *host); |
| @@ -65,6 +103,10 @@ struct otg_transceiver { | |||
| 65 | int (*set_power)(struct otg_transceiver *otg, | 103 | int (*set_power)(struct otg_transceiver *otg, |
| 66 | unsigned mA); | 104 | unsigned mA); |
| 67 | 105 | ||
| 106 | /* effective for A-peripheral, ignored for B devices */ | ||
| 107 | int (*set_vbus)(struct otg_transceiver *otg, | ||
| 108 | bool enabled); | ||
| 109 | |||
| 68 | /* for non-OTG B devices: set transceiver into suspend mode */ | 110 | /* for non-OTG B devices: set transceiver into suspend mode */ |
| 69 | int (*set_suspend)(struct otg_transceiver *otg, | 111 | int (*set_suspend)(struct otg_transceiver *otg, |
| 70 | int suspend); | 112 | int suspend); |
| @@ -81,10 +123,52 @@ struct otg_transceiver { | |||
| 81 | /* for board-specific init logic */ | 123 | /* for board-specific init logic */ |
| 82 | extern int otg_set_transceiver(struct otg_transceiver *); | 124 | extern int otg_set_transceiver(struct otg_transceiver *); |
| 83 | 125 | ||
| 126 | #if defined(CONFIG_NOP_USB_XCEIV) || defined(CONFIG_NOP_USB_XCEIV_MODULE) | ||
| 84 | /* sometimes transceivers are accessed only through e.g. ULPI */ | 127 | /* sometimes transceivers are accessed only through e.g. ULPI */ |
| 85 | extern void usb_nop_xceiv_register(void); | 128 | extern void usb_nop_xceiv_register(void); |
| 86 | extern void usb_nop_xceiv_unregister(void); | 129 | extern void usb_nop_xceiv_unregister(void); |
| 130 | #else | ||
| 131 | static inline void usb_nop_xceiv_register(void) | ||
| 132 | { | ||
| 133 | } | ||
| 134 | |||
| 135 | static inline void usb_nop_xceiv_unregister(void) | ||
| 136 | { | ||
| 137 | } | ||
| 138 | #endif | ||
| 87 | 139 | ||
| 140 | /* helpers for direct access thru low-level io interface */ | ||
| 141 | static inline int otg_io_read(struct otg_transceiver *otg, u32 reg) | ||
| 142 | { | ||
| 143 | if (otg->io_ops && otg->io_ops->read) | ||
| 144 | return otg->io_ops->read(otg, reg); | ||
| 145 | |||
| 146 | return -EINVAL; | ||
| 147 | } | ||
| 148 | |||
| 149 | static inline int otg_io_write(struct otg_transceiver *otg, u32 reg, u32 val) | ||
| 150 | { | ||
| 151 | if (otg->io_ops && otg->io_ops->write) | ||
| 152 | return otg->io_ops->write(otg, reg, val); | ||
| 153 | |||
| 154 | return -EINVAL; | ||
| 155 | } | ||
| 156 | |||
| 157 | static inline int | ||
| 158 | otg_init(struct otg_transceiver *otg) | ||
| 159 | { | ||
| 160 | if (otg->init) | ||
| 161 | return otg->init(otg); | ||
| 162 | |||
| 163 | return 0; | ||
| 164 | } | ||
| 165 | |||
| 166 | static inline void | ||
| 167 | otg_shutdown(struct otg_transceiver *otg) | ||
| 168 | { | ||
| 169 | if (otg->shutdown) | ||
| 170 | otg->shutdown(otg); | ||
| 171 | } | ||
| 88 | 172 | ||
| 89 | /* for usb host and peripheral controller drivers */ | 173 | /* for usb host and peripheral controller drivers */ |
| 90 | extern struct otg_transceiver *otg_get_transceiver(void); | 174 | extern struct otg_transceiver *otg_get_transceiver(void); |
| @@ -97,6 +181,12 @@ otg_start_hnp(struct otg_transceiver *otg) | |||
| 97 | return otg->start_hnp(otg); | 181 | return otg->start_hnp(otg); |
| 98 | } | 182 | } |
| 99 | 183 | ||
| 184 | /* Context: can sleep */ | ||
| 185 | static inline int | ||
| 186 | otg_set_vbus(struct otg_transceiver *otg, bool enabled) | ||
| 187 | { | ||
| 188 | return otg->set_vbus(otg, enabled); | ||
| 189 | } | ||
| 100 | 190 | ||
| 101 | /* for HCDs */ | 191 | /* for HCDs */ |
| 102 | static inline int | 192 | static inline int |
| @@ -105,7 +195,6 @@ otg_set_host(struct otg_transceiver *otg, struct usb_bus *host) | |||
| 105 | return otg->set_host(otg, host); | 195 | return otg->set_host(otg, host); |
| 106 | } | 196 | } |
| 107 | 197 | ||
| 108 | |||
| 109 | /* for usb peripheral controller drivers */ | 198 | /* for usb peripheral controller drivers */ |
| 110 | 199 | ||
| 111 | /* Context: can sleep */ | 200 | /* Context: can sleep */ |
| @@ -137,6 +226,18 @@ otg_start_srp(struct otg_transceiver *otg) | |||
| 137 | return otg->start_srp(otg); | 226 | return otg->start_srp(otg); |
| 138 | } | 227 | } |
| 139 | 228 | ||
| 229 | /* notifiers */ | ||
| 230 | static inline int | ||
| 231 | otg_register_notifier(struct otg_transceiver *otg, struct notifier_block *nb) | ||
| 232 | { | ||
| 233 | return blocking_notifier_chain_register(&otg->notifier, nb); | ||
| 234 | } | ||
| 235 | |||
| 236 | static inline void | ||
| 237 | otg_unregister_notifier(struct otg_transceiver *otg, struct notifier_block *nb) | ||
| 238 | { | ||
| 239 | blocking_notifier_chain_unregister(&otg->notifier, nb); | ||
| 240 | } | ||
| 140 | 241 | ||
| 141 | /* for OTG controller drivers (and maybe other stuff) */ | 242 | /* for OTG controller drivers (and maybe other stuff) */ |
| 142 | extern int usb_bus_start_enum(struct usb_bus *bus, unsigned port_num); | 243 | extern int usb_bus_start_enum(struct usb_bus *bus, unsigned port_num); |
diff --git a/include/linux/usb/quirks.h b/include/linux/usb/quirks.h index 2526f3bbd273..0a555dd131fc 100644 --- a/include/linux/usb/quirks.h +++ b/include/linux/usb/quirks.h | |||
| @@ -19,4 +19,7 @@ | |||
| 19 | /* device can't handle its Configuration or Interface strings */ | 19 | /* device can't handle its Configuration or Interface strings */ |
| 20 | #define USB_QUIRK_CONFIG_INTF_STRINGS 0x00000008 | 20 | #define USB_QUIRK_CONFIG_INTF_STRINGS 0x00000008 |
| 21 | 21 | ||
| 22 | /*device will morph if reset, don't use reset for handling errors */ | ||
| 23 | #define USB_QUIRK_RESET_MORPHS 0x00000010 | ||
| 24 | |||
| 22 | #endif /* __LINUX_USB_QUIRKS_H */ | 25 | #endif /* __LINUX_USB_QUIRKS_H */ |
diff --git a/include/linux/usb/serial.h b/include/linux/usb/serial.h index ce911ebf91e8..0a458b861933 100644 --- a/include/linux/usb/serial.h +++ b/include/linux/usb/serial.h | |||
| @@ -16,6 +16,7 @@ | |||
| 16 | #include <linux/kref.h> | 16 | #include <linux/kref.h> |
| 17 | #include <linux/mutex.h> | 17 | #include <linux/mutex.h> |
| 18 | #include <linux/sysrq.h> | 18 | #include <linux/sysrq.h> |
| 19 | #include <linux/kfifo.h> | ||
| 19 | 20 | ||
| 20 | #define SERIAL_TTY_MAJOR 188 /* Nice legal number now */ | 21 | #define SERIAL_TTY_MAJOR 188 /* Nice legal number now */ |
| 21 | #define SERIAL_TTY_MINORS 254 /* loads of devices :) */ | 22 | #define SERIAL_TTY_MINORS 254 /* loads of devices :) */ |
| @@ -39,8 +40,6 @@ enum port_dev_state { | |||
| 39 | * @serial: pointer back to the struct usb_serial owner of this port. | 40 | * @serial: pointer back to the struct usb_serial owner of this port. |
| 40 | * @port: pointer to the corresponding tty_port for this port. | 41 | * @port: pointer to the corresponding tty_port for this port. |
| 41 | * @lock: spinlock to grab when updating portions of this structure. | 42 | * @lock: spinlock to grab when updating portions of this structure. |
| 42 | * @mutex: mutex used to synchronize serial_open() and serial_close() | ||
| 43 | * access for this port. | ||
| 44 | * @number: the number of the port (the minor number). | 43 | * @number: the number of the port (the minor number). |
| 45 | * @interrupt_in_buffer: pointer to the interrupt in buffer for this port. | 44 | * @interrupt_in_buffer: pointer to the interrupt in buffer for this port. |
| 46 | * @interrupt_in_urb: pointer to the interrupt in struct urb for this port. | 45 | * @interrupt_in_urb: pointer to the interrupt in struct urb for this port. |
| @@ -77,7 +76,6 @@ struct usb_serial_port { | |||
| 77 | struct usb_serial *serial; | 76 | struct usb_serial *serial; |
| 78 | struct tty_port port; | 77 | struct tty_port port; |
| 79 | spinlock_t lock; | 78 | spinlock_t lock; |
| 80 | struct mutex mutex; | ||
| 81 | unsigned char number; | 79 | unsigned char number; |
| 82 | 80 | ||
| 83 | unsigned char *interrupt_in_buffer; | 81 | unsigned char *interrupt_in_buffer; |
| @@ -97,7 +95,7 @@ struct usb_serial_port { | |||
| 97 | unsigned char *bulk_out_buffer; | 95 | unsigned char *bulk_out_buffer; |
| 98 | int bulk_out_size; | 96 | int bulk_out_size; |
| 99 | struct urb *write_urb; | 97 | struct urb *write_urb; |
| 100 | struct kfifo *write_fifo; | 98 | struct kfifo write_fifo; |
| 101 | int write_urb_busy; | 99 | int write_urb_busy; |
| 102 | __u8 bulk_out_endpointAddress; | 100 | __u8 bulk_out_endpointAddress; |
| 103 | 101 | ||
| @@ -353,14 +351,11 @@ static inline void usb_serial_debug_data(int debug, | |||
| 353 | 351 | ||
| 354 | /* Use our own dbg macro */ | 352 | /* Use our own dbg macro */ |
| 355 | #undef dbg | 353 | #undef dbg |
| 356 | #define dbg(format, arg...) \ | 354 | #define dbg(format, arg...) \ |
| 357 | do { \ | 355 | do { \ |
| 358 | if (debug) \ | 356 | if (debug) \ |
| 359 | printk(KERN_DEBUG "%s: " format "\n" , __FILE__ , \ | 357 | printk(KERN_DEBUG "%s: " format "\n", __FILE__, ##arg); \ |
| 360 | ## arg); \ | 358 | } while (0) |
| 361 | } while (0) | ||
| 362 | |||
| 363 | |||
| 364 | 359 | ||
| 365 | #endif /* __LINUX_USB_SERIAL_H */ | 360 | #endif /* __LINUX_USB_SERIAL_H */ |
| 366 | 361 | ||
diff --git a/include/linux/usb/ulpi.h b/include/linux/usb/ulpi.h new file mode 100644 index 000000000000..20675c6ebc4d --- /dev/null +++ b/include/linux/usb/ulpi.h | |||
| @@ -0,0 +1,7 @@ | |||
| 1 | #ifndef __LINUX_USB_ULPI_H | ||
| 2 | #define __LINUX_USB_ULPI_H | ||
| 3 | |||
| 4 | struct otg_transceiver *otg_ulpi_create(struct otg_io_access_ops *ops, | ||
| 5 | unsigned int flags); | ||
| 6 | |||
| 7 | #endif /* __LINUX_USB_ULPI_H */ | ||
diff --git a/include/linux/usb/usbnet.h b/include/linux/usb/usbnet.h index f81473052059..df1e83dd9a54 100644 --- a/include/linux/usb/usbnet.h +++ b/include/linux/usb/usbnet.h | |||
| @@ -55,6 +55,7 @@ struct usbnet { | |||
| 55 | struct sk_buff_head done; | 55 | struct sk_buff_head done; |
| 56 | struct sk_buff_head rxq_pause; | 56 | struct sk_buff_head rxq_pause; |
| 57 | struct urb *interrupt; | 57 | struct urb *interrupt; |
| 58 | struct usb_anchor deferred; | ||
| 58 | struct tasklet_struct bh; | 59 | struct tasklet_struct bh; |
| 59 | 60 | ||
| 60 | struct work_struct kevent; | 61 | struct work_struct kevent; |
| @@ -65,6 +66,8 @@ struct usbnet { | |||
| 65 | # define EVENT_STS_SPLIT 3 | 66 | # define EVENT_STS_SPLIT 3 |
| 66 | # define EVENT_LINK_RESET 4 | 67 | # define EVENT_LINK_RESET 4 |
| 67 | # define EVENT_RX_PAUSED 5 | 68 | # define EVENT_RX_PAUSED 5 |
| 69 | # define EVENT_DEV_WAKING 6 | ||
| 70 | # define EVENT_DEV_ASLEEP 7 | ||
| 68 | }; | 71 | }; |
| 69 | 72 | ||
| 70 | static inline struct usb_driver *driver_of(struct usb_interface *intf) | 73 | static inline struct usb_driver *driver_of(struct usb_interface *intf) |
| @@ -90,7 +93,9 @@ struct driver_info { | |||
| 90 | #define FLAG_WLAN 0x0080 /* use "wlan%d" names */ | 93 | #define FLAG_WLAN 0x0080 /* use "wlan%d" names */ |
| 91 | #define FLAG_AVOID_UNLINK_URBS 0x0100 /* don't unlink urbs at usbnet_stop() */ | 94 | #define FLAG_AVOID_UNLINK_URBS 0x0100 /* don't unlink urbs at usbnet_stop() */ |
| 92 | #define FLAG_SEND_ZLP 0x0200 /* hw requires ZLPs are sent */ | 95 | #define FLAG_SEND_ZLP 0x0200 /* hw requires ZLPs are sent */ |
| 96 | #define FLAG_WWAN 0x0400 /* use "wwan%d" names */ | ||
| 93 | 97 | ||
| 98 | #define FLAG_LINK_INTR 0x0800 /* updates link (carrier) status */ | ||
| 94 | 99 | ||
| 95 | /* init device ... can sleep, or cause probe() failure */ | 100 | /* init device ... can sleep, or cause probe() failure */ |
| 96 | int (*bind)(struct usbnet *, struct usb_interface *); | 101 | int (*bind)(struct usbnet *, struct usb_interface *); |
| @@ -107,6 +112,9 @@ struct driver_info { | |||
| 107 | /* see if peer is connected ... can sleep */ | 112 | /* see if peer is connected ... can sleep */ |
| 108 | int (*check_connect)(struct usbnet *); | 113 | int (*check_connect)(struct usbnet *); |
| 109 | 114 | ||
| 115 | /* (dis)activate runtime power management */ | ||
| 116 | int (*manage_power)(struct usbnet *, int); | ||
| 117 | |||
| 110 | /* for status polling */ | 118 | /* for status polling */ |
| 111 | void (*status)(struct usbnet *, struct urb *); | 119 | void (*status)(struct usbnet *, struct urb *); |
| 112 | 120 | ||
| @@ -206,25 +214,4 @@ extern void usbnet_set_msglevel (struct net_device *, u32); | |||
| 206 | extern void usbnet_get_drvinfo (struct net_device *, struct ethtool_drvinfo *); | 214 | extern void usbnet_get_drvinfo (struct net_device *, struct ethtool_drvinfo *); |
| 207 | extern int usbnet_nway_reset(struct net_device *net); | 215 | extern int usbnet_nway_reset(struct net_device *net); |
| 208 | 216 | ||
| 209 | /* messaging support includes the interface name, so it must not be | ||
| 210 | * used before it has one ... notably, in minidriver bind() calls. | ||
| 211 | */ | ||
| 212 | #ifdef DEBUG | ||
| 213 | #define devdbg(usbnet, fmt, arg...) \ | ||
| 214 | printk(KERN_DEBUG "%s: " fmt "\n" , (usbnet)->net->name , ## arg) | ||
| 215 | #else | ||
| 216 | #define devdbg(usbnet, fmt, arg...) \ | ||
| 217 | ({ if (0) printk(KERN_DEBUG "%s: " fmt "\n" , (usbnet)->net->name , \ | ||
| 218 | ## arg); 0; }) | ||
| 219 | #endif | ||
| 220 | |||
| 221 | #define deverr(usbnet, fmt, arg...) \ | ||
| 222 | printk(KERN_ERR "%s: " fmt "\n" , (usbnet)->net->name , ## arg) | ||
| 223 | #define devwarn(usbnet, fmt, arg...) \ | ||
| 224 | printk(KERN_WARNING "%s: " fmt "\n" , (usbnet)->net->name , ## arg) | ||
| 225 | |||
| 226 | #define devinfo(usbnet, fmt, arg...) \ | ||
| 227 | printk(KERN_INFO "%s: " fmt "\n" , (usbnet)->net->name , ## arg); \ | ||
| 228 | |||
| 229 | |||
| 230 | #endif /* __LINUX_USB_USBNET_H */ | 217 | #endif /* __LINUX_USB_USBNET_H */ |
diff --git a/include/linux/usb/vstusb.h b/include/linux/usb/vstusb.h deleted file mode 100644 index 1cfac67191ff..000000000000 --- a/include/linux/usb/vstusb.h +++ /dev/null | |||
| @@ -1,71 +0,0 @@ | |||
| 1 | /***************************************************************************** | ||
| 2 | * File: drivers/usb/misc/vstusb.h | ||
| 3 | * | ||
| 4 | * Purpose: Support for the bulk USB Vernier Spectrophotometers | ||
| 5 | * | ||
| 6 | * Author: EQware Engineering, Inc. | ||
| 7 | * Oregon City, OR, USA 97045 | ||
| 8 | * | ||
| 9 | * Copyright: 2007, 2008 | ||
| 10 | * Vernier Software & Technology | ||
| 11 | * Beaverton, OR, USA 97005 | ||
| 12 | * | ||
| 13 | * Web: www.vernier.com | ||
| 14 | * | ||
| 15 | * This program is free software; you can redistribute it and/or modify | ||
| 16 | * it under the terms of the GNU General Public License version 2 as | ||
| 17 | * published by the Free Software Foundation. | ||
| 18 | * | ||
| 19 | *****************************************************************************/ | ||
| 20 | /***************************************************************************** | ||
| 21 | * | ||
| 22 | * The vstusb module is a standard usb 'client' driver running on top of the | ||
| 23 | * standard usb host controller stack. | ||
| 24 | * | ||
| 25 | * In general, vstusb supports standard bulk usb pipes. It supports multiple | ||
| 26 | * devices and multiple pipes per device. | ||
| 27 | * | ||
| 28 | * The vstusb driver supports two interfaces: | ||
| 29 | * 1 - ioctl SEND_PIPE/RECV_PIPE - a general bulk write/read msg | ||
| 30 | * interface to any pipe with timeout support; | ||
| 31 | * 2 - standard read/write with ioctl config - offers standard read/write | ||
| 32 | * interface with ioctl configured pipes and timeouts. | ||
| 33 | * | ||
| 34 | * Both interfaces can be signal from other process and will abort its i/o | ||
| 35 | * operation. | ||
| 36 | * | ||
| 37 | * A timeout of 0 means NO timeout. The user can still terminate the read via | ||
| 38 | * signal. | ||
| 39 | * | ||
| 40 | * If using multiple threads with this driver, the user should ensure that | ||
| 41 | * any reads, writes, or ioctls are complete before closing the device. | ||
| 42 | * Changing read/write timeouts or pipes takes effect on next read/write. | ||
| 43 | * | ||
| 44 | *****************************************************************************/ | ||
| 45 | |||
| 46 | struct vstusb_args { | ||
| 47 | union { | ||
| 48 | /* this struct is used for IOCTL_VSTUSB_SEND_PIPE, * | ||
| 49 | * IOCTL_VSTUSB_RECV_PIPE, and read()/write() fops */ | ||
| 50 | struct { | ||
| 51 | void __user *buffer; | ||
| 52 | size_t count; | ||
| 53 | unsigned int timeout_ms; | ||
| 54 | int pipe; | ||
| 55 | }; | ||
| 56 | |||
| 57 | /* this one is used for IOCTL_VSTUSB_CONFIG_RW */ | ||
| 58 | struct { | ||
| 59 | int rd_pipe; | ||
| 60 | int rd_timeout_ms; | ||
| 61 | int wr_pipe; | ||
| 62 | int wr_timeout_ms; | ||
| 63 | }; | ||
| 64 | }; | ||
| 65 | }; | ||
| 66 | |||
| 67 | #define VST_IOC_MAGIC 'L' | ||
| 68 | #define VST_IOC_FIRST 0x20 | ||
| 69 | #define IOCTL_VSTUSB_SEND_PIPE _IO(VST_IOC_MAGIC, VST_IOC_FIRST) | ||
| 70 | #define IOCTL_VSTUSB_RECV_PIPE _IO(VST_IOC_MAGIC, VST_IOC_FIRST + 1) | ||
| 71 | #define IOCTL_VSTUSB_CONFIG_RW _IO(VST_IOC_MAGIC, VST_IOC_FIRST + 2) | ||
diff --git a/include/linux/usb/wusb.h b/include/linux/usb/wusb.h index 429c631d2aad..63ebdcc5dda6 100644 --- a/include/linux/usb/wusb.h +++ b/include/linux/usb/wusb.h | |||
| @@ -74,7 +74,7 @@ enum { | |||
| 74 | * WUSB defines that CHIDs, CDIDs and CKs are a 16 byte string of | 74 | * WUSB defines that CHIDs, CDIDs and CKs are a 16 byte string of |
| 75 | * data. In order to avoid confusion and enforce types, we wrap it. | 75 | * data. In order to avoid confusion and enforce types, we wrap it. |
| 76 | * | 76 | * |
| 77 | * Make it packed, as we use it in some hw defintions. | 77 | * Make it packed, as we use it in some hw definitions. |
| 78 | */ | 78 | */ |
| 79 | struct wusb_ckhdid { | 79 | struct wusb_ckhdid { |
| 80 | u8 data[16]; | 80 | u8 data[16]; |
diff --git a/include/linux/usb_usual.h b/include/linux/usb_usual.h index 3d15fb9bc116..a4b947e470a5 100644 --- a/include/linux/usb_usual.h +++ b/include/linux/usb_usual.h | |||
| @@ -56,7 +56,9 @@ | |||
| 56 | US_FLAG(SANE_SENSE, 0x00008000) \ | 56 | US_FLAG(SANE_SENSE, 0x00008000) \ |
| 57 | /* Sane Sense (> 18 bytes) */ \ | 57 | /* Sane Sense (> 18 bytes) */ \ |
| 58 | US_FLAG(CAPACITY_OK, 0x00010000) \ | 58 | US_FLAG(CAPACITY_OK, 0x00010000) \ |
| 59 | /* READ CAPACITY response is correct */ | 59 | /* READ CAPACITY response is correct */ \ |
| 60 | US_FLAG(BAD_SENSE, 0x00020000) \ | ||
| 61 | /* Bad Sense (never more than 18 bytes) */ | ||
| 60 | 62 | ||
| 61 | #define US_FLAG(name, value) US_FL_##name = value , | 63 | #define US_FLAG(name, value) US_FL_##name = value , |
| 62 | enum { US_DO_ALL_FLAGS }; | 64 | enum { US_DO_ALL_FLAGS }; |
diff --git a/include/linux/usbdevice_fs.h b/include/linux/usbdevice_fs.h index b2a7d8ba6ee3..15591d2ea400 100644 --- a/include/linux/usbdevice_fs.h +++ b/include/linux/usbdevice_fs.h | |||
| @@ -128,6 +128,29 @@ struct usbdevfs_hub_portinfo { | |||
| 128 | #ifdef __KERNEL__ | 128 | #ifdef __KERNEL__ |
| 129 | #ifdef CONFIG_COMPAT | 129 | #ifdef CONFIG_COMPAT |
| 130 | #include <linux/compat.h> | 130 | #include <linux/compat.h> |
| 131 | |||
| 132 | struct usbdevfs_ctrltransfer32 { | ||
| 133 | u8 bRequestType; | ||
| 134 | u8 bRequest; | ||
| 135 | u16 wValue; | ||
| 136 | u16 wIndex; | ||
| 137 | u16 wLength; | ||
| 138 | u32 timeout; /* in milliseconds */ | ||
| 139 | compat_caddr_t data; | ||
| 140 | }; | ||
| 141 | |||
| 142 | struct usbdevfs_bulktransfer32 { | ||
| 143 | compat_uint_t ep; | ||
| 144 | compat_uint_t len; | ||
| 145 | compat_uint_t timeout; /* in milliseconds */ | ||
| 146 | compat_caddr_t data; | ||
| 147 | }; | ||
| 148 | |||
| 149 | struct usbdevfs_disconnectsignal32 { | ||
| 150 | compat_int_t signr; | ||
| 151 | compat_caddr_t context; | ||
| 152 | }; | ||
| 153 | |||
| 131 | struct usbdevfs_urb32 { | 154 | struct usbdevfs_urb32 { |
| 132 | unsigned char type; | 155 | unsigned char type; |
| 133 | unsigned char endpoint; | 156 | unsigned char endpoint; |
| @@ -153,7 +176,9 @@ struct usbdevfs_ioctl32 { | |||
| 153 | #endif /* __KERNEL__ */ | 176 | #endif /* __KERNEL__ */ |
| 154 | 177 | ||
| 155 | #define USBDEVFS_CONTROL _IOWR('U', 0, struct usbdevfs_ctrltransfer) | 178 | #define USBDEVFS_CONTROL _IOWR('U', 0, struct usbdevfs_ctrltransfer) |
| 179 | #define USBDEVFS_CONTROL32 _IOWR('U', 0, struct usbdevfs_ctrltransfer32) | ||
| 156 | #define USBDEVFS_BULK _IOWR('U', 2, struct usbdevfs_bulktransfer) | 180 | #define USBDEVFS_BULK _IOWR('U', 2, struct usbdevfs_bulktransfer) |
| 181 | #define USBDEVFS_BULK32 _IOWR('U', 2, struct usbdevfs_bulktransfer32) | ||
| 157 | #define USBDEVFS_RESETEP _IOR('U', 3, unsigned int) | 182 | #define USBDEVFS_RESETEP _IOR('U', 3, unsigned int) |
| 158 | #define USBDEVFS_SETINTERFACE _IOR('U', 4, struct usbdevfs_setinterface) | 183 | #define USBDEVFS_SETINTERFACE _IOR('U', 4, struct usbdevfs_setinterface) |
| 159 | #define USBDEVFS_SETCONFIGURATION _IOR('U', 5, unsigned int) | 184 | #define USBDEVFS_SETCONFIGURATION _IOR('U', 5, unsigned int) |
| @@ -166,6 +191,7 @@ struct usbdevfs_ioctl32 { | |||
| 166 | #define USBDEVFS_REAPURBNDELAY _IOW('U', 13, void *) | 191 | #define USBDEVFS_REAPURBNDELAY _IOW('U', 13, void *) |
| 167 | #define USBDEVFS_REAPURBNDELAY32 _IOW('U', 13, __u32) | 192 | #define USBDEVFS_REAPURBNDELAY32 _IOW('U', 13, __u32) |
| 168 | #define USBDEVFS_DISCSIGNAL _IOR('U', 14, struct usbdevfs_disconnectsignal) | 193 | #define USBDEVFS_DISCSIGNAL _IOR('U', 14, struct usbdevfs_disconnectsignal) |
| 194 | #define USBDEVFS_DISCSIGNAL32 _IOR('U', 14, struct usbdevfs_disconnectsignal32) | ||
| 169 | #define USBDEVFS_CLAIMINTERFACE _IOR('U', 15, unsigned int) | 195 | #define USBDEVFS_CLAIMINTERFACE _IOR('U', 15, unsigned int) |
| 170 | #define USBDEVFS_RELEASEINTERFACE _IOR('U', 16, unsigned int) | 196 | #define USBDEVFS_RELEASEINTERFACE _IOR('U', 16, unsigned int) |
| 171 | #define USBDEVFS_CONNECTINFO _IOW('U', 17, struct usbdevfs_connectinfo) | 197 | #define USBDEVFS_CONNECTINFO _IOW('U', 17, struct usbdevfs_connectinfo) |
diff --git a/include/linux/user-return-notifier.h b/include/linux/user-return-notifier.h new file mode 100644 index 000000000000..9c4a445bb43c --- /dev/null +++ b/include/linux/user-return-notifier.h | |||
| @@ -0,0 +1,49 @@ | |||
| 1 | #ifndef _LINUX_USER_RETURN_NOTIFIER_H | ||
| 2 | #define _LINUX_USER_RETURN_NOTIFIER_H | ||
| 3 | |||
| 4 | #ifdef CONFIG_USER_RETURN_NOTIFIER | ||
| 5 | |||
| 6 | #include <linux/list.h> | ||
| 7 | #include <linux/sched.h> | ||
| 8 | |||
| 9 | struct user_return_notifier { | ||
| 10 | void (*on_user_return)(struct user_return_notifier *urn); | ||
| 11 | struct hlist_node link; | ||
| 12 | }; | ||
| 13 | |||
| 14 | |||
| 15 | void user_return_notifier_register(struct user_return_notifier *urn); | ||
| 16 | void user_return_notifier_unregister(struct user_return_notifier *urn); | ||
| 17 | |||
| 18 | static inline void propagate_user_return_notify(struct task_struct *prev, | ||
| 19 | struct task_struct *next) | ||
| 20 | { | ||
| 21 | if (test_tsk_thread_flag(prev, TIF_USER_RETURN_NOTIFY)) { | ||
| 22 | clear_tsk_thread_flag(prev, TIF_USER_RETURN_NOTIFY); | ||
| 23 | set_tsk_thread_flag(next, TIF_USER_RETURN_NOTIFY); | ||
| 24 | } | ||
| 25 | } | ||
| 26 | |||
| 27 | void fire_user_return_notifiers(void); | ||
| 28 | |||
| 29 | static inline void clear_user_return_notifier(struct task_struct *p) | ||
| 30 | { | ||
| 31 | clear_tsk_thread_flag(p, TIF_USER_RETURN_NOTIFY); | ||
| 32 | } | ||
| 33 | |||
| 34 | #else | ||
| 35 | |||
| 36 | struct user_return_notifier {}; | ||
| 37 | |||
| 38 | static inline void propagate_user_return_notify(struct task_struct *prev, | ||
| 39 | struct task_struct *next) | ||
| 40 | { | ||
| 41 | } | ||
| 42 | |||
| 43 | static inline void fire_user_return_notifiers(void) {} | ||
| 44 | |||
| 45 | static inline void clear_user_return_notifier(struct task_struct *p) {} | ||
| 46 | |||
| 47 | #endif | ||
| 48 | |||
| 49 | #endif | ||
diff --git a/include/linux/vermagic.h b/include/linux/vermagic.h index 79b9837d9ca0..cf97b5b9d1fe 100644 --- a/include/linux/vermagic.h +++ b/include/linux/vermagic.h | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | #include <linux/utsrelease.h> | 1 | #include <generated/utsrelease.h> |
| 2 | #include <linux/module.h> | 2 | #include <linux/module.h> |
| 3 | 3 | ||
| 4 | /* Simply sanity version stamp for modules. */ | 4 | /* Simply sanity version stamp for modules. */ |
diff --git a/include/linux/vga_switcheroo.h b/include/linux/vga_switcheroo.h new file mode 100644 index 000000000000..ae9ab13b963d --- /dev/null +++ b/include/linux/vga_switcheroo.h | |||
| @@ -0,0 +1,57 @@ | |||
| 1 | /* | ||
| 2 | * Copyright (c) 2010 Red Hat Inc. | ||
| 3 | * Author : Dave Airlie <airlied@redhat.com> | ||
| 4 | * | ||
| 5 | * Licensed under GPLv2 | ||
| 6 | * | ||
| 7 | * vga_switcheroo.h - Support for laptop with dual GPU using one set of outputs | ||
| 8 | */ | ||
| 9 | |||
| 10 | #include <linux/fb.h> | ||
| 11 | |||
| 12 | enum vga_switcheroo_state { | ||
| 13 | VGA_SWITCHEROO_OFF, | ||
| 14 | VGA_SWITCHEROO_ON, | ||
| 15 | }; | ||
| 16 | |||
| 17 | enum vga_switcheroo_client_id { | ||
| 18 | VGA_SWITCHEROO_IGD, | ||
| 19 | VGA_SWITCHEROO_DIS, | ||
| 20 | VGA_SWITCHEROO_MAX_CLIENTS, | ||
| 21 | }; | ||
| 22 | |||
| 23 | struct vga_switcheroo_handler { | ||
| 24 | int (*switchto)(enum vga_switcheroo_client_id id); | ||
| 25 | int (*power_state)(enum vga_switcheroo_client_id id, | ||
| 26 | enum vga_switcheroo_state state); | ||
| 27 | int (*init)(void); | ||
| 28 | int (*get_client_id)(struct pci_dev *pdev); | ||
| 29 | }; | ||
| 30 | |||
| 31 | |||
| 32 | #if defined(CONFIG_VGA_SWITCHEROO) | ||
| 33 | void vga_switcheroo_unregister_client(struct pci_dev *dev); | ||
| 34 | int vga_switcheroo_register_client(struct pci_dev *dev, | ||
| 35 | void (*set_gpu_state)(struct pci_dev *dev, enum vga_switcheroo_state), | ||
| 36 | bool (*can_switch)(struct pci_dev *dev)); | ||
| 37 | |||
| 38 | void vga_switcheroo_client_fb_set(struct pci_dev *dev, | ||
| 39 | struct fb_info *info); | ||
| 40 | |||
| 41 | int vga_switcheroo_register_handler(struct vga_switcheroo_handler *handler); | ||
| 42 | void vga_switcheroo_unregister_handler(void); | ||
| 43 | |||
| 44 | int vga_switcheroo_process_delayed_switch(void); | ||
| 45 | |||
| 46 | #else | ||
| 47 | |||
| 48 | static inline void vga_switcheroo_unregister_client(struct pci_dev *dev) {} | ||
| 49 | static inline int vga_switcheroo_register_client(struct pci_dev *dev, | ||
| 50 | void (*set_gpu_state)(struct pci_dev *dev, enum vga_switcheroo_state), | ||
| 51 | bool (*can_switch)(struct pci_dev *dev)) { return 0; } | ||
| 52 | static inline void vga_switcheroo_client_fb_set(struct pci_dev *dev, struct fb_info *info) {} | ||
| 53 | static inline int vga_switcheroo_register_handler(struct vga_switcheroo_handler *handler) { return 0; } | ||
| 54 | static inline void vga_switcheroo_unregister_handler(void) {} | ||
| 55 | static inline int vga_switcheroo_process_delayed_switch(void) { return 0; } | ||
| 56 | |||
| 57 | #endif | ||
diff --git a/include/linux/vhost.h b/include/linux/vhost.h new file mode 100644 index 000000000000..e847f1e30756 --- /dev/null +++ b/include/linux/vhost.h | |||
| @@ -0,0 +1,130 @@ | |||
| 1 | #ifndef _LINUX_VHOST_H | ||
| 2 | #define _LINUX_VHOST_H | ||
| 3 | /* Userspace interface for in-kernel virtio accelerators. */ | ||
| 4 | |||
| 5 | /* vhost is used to reduce the number of system calls involved in virtio. | ||
| 6 | * | ||
| 7 | * Existing virtio net code is used in the guest without modification. | ||
| 8 | * | ||
| 9 | * This header includes interface used by userspace hypervisor for | ||
| 10 | * device configuration. | ||
| 11 | */ | ||
| 12 | |||
| 13 | #include <linux/types.h> | ||
| 14 | #include <linux/compiler.h> | ||
| 15 | #include <linux/ioctl.h> | ||
| 16 | #include <linux/virtio_config.h> | ||
| 17 | #include <linux/virtio_ring.h> | ||
| 18 | |||
| 19 | struct vhost_vring_state { | ||
| 20 | unsigned int index; | ||
| 21 | unsigned int num; | ||
| 22 | }; | ||
| 23 | |||
| 24 | struct vhost_vring_file { | ||
| 25 | unsigned int index; | ||
| 26 | int fd; /* Pass -1 to unbind from file. */ | ||
| 27 | |||
| 28 | }; | ||
| 29 | |||
| 30 | struct vhost_vring_addr { | ||
| 31 | unsigned int index; | ||
| 32 | /* Option flags. */ | ||
| 33 | unsigned int flags; | ||
| 34 | /* Flag values: */ | ||
| 35 | /* Whether log address is valid. If set enables logging. */ | ||
| 36 | #define VHOST_VRING_F_LOG 0 | ||
| 37 | |||
| 38 | /* Start of array of descriptors (virtually contiguous) */ | ||
| 39 | __u64 desc_user_addr; | ||
| 40 | /* Used structure address. Must be 32 bit aligned */ | ||
| 41 | __u64 used_user_addr; | ||
| 42 | /* Available structure address. Must be 16 bit aligned */ | ||
| 43 | __u64 avail_user_addr; | ||
| 44 | /* Logging support. */ | ||
| 45 | /* Log writes to used structure, at offset calculated from specified | ||
| 46 | * address. Address must be 32 bit aligned. */ | ||
| 47 | __u64 log_guest_addr; | ||
| 48 | }; | ||
| 49 | |||
| 50 | struct vhost_memory_region { | ||
| 51 | __u64 guest_phys_addr; | ||
| 52 | __u64 memory_size; /* bytes */ | ||
| 53 | __u64 userspace_addr; | ||
| 54 | __u64 flags_padding; /* No flags are currently specified. */ | ||
| 55 | }; | ||
| 56 | |||
| 57 | /* All region addresses and sizes must be 4K aligned. */ | ||
| 58 | #define VHOST_PAGE_SIZE 0x1000 | ||
| 59 | |||
| 60 | struct vhost_memory { | ||
| 61 | __u32 nregions; | ||
| 62 | __u32 padding; | ||
| 63 | struct vhost_memory_region regions[0]; | ||
| 64 | }; | ||
| 65 | |||
| 66 | /* ioctls */ | ||
| 67 | |||
| 68 | #define VHOST_VIRTIO 0xAF | ||
| 69 | |||
| 70 | /* Features bitmask for forward compatibility. Transport bits are used for | ||
| 71 | * vhost specific features. */ | ||
| 72 | #define VHOST_GET_FEATURES _IOR(VHOST_VIRTIO, 0x00, __u64) | ||
| 73 | #define VHOST_SET_FEATURES _IOW(VHOST_VIRTIO, 0x00, __u64) | ||
| 74 | |||
| 75 | /* Set current process as the (exclusive) owner of this file descriptor. This | ||
| 76 | * must be called before any other vhost command. Further calls to | ||
| 77 | * VHOST_OWNER_SET fail until VHOST_OWNER_RESET is called. */ | ||
| 78 | #define VHOST_SET_OWNER _IO(VHOST_VIRTIO, 0x01) | ||
| 79 | /* Give up ownership, and reset the device to default values. | ||
| 80 | * Allows subsequent call to VHOST_OWNER_SET to succeed. */ | ||
| 81 | #define VHOST_RESET_OWNER _IO(VHOST_VIRTIO, 0x02) | ||
| 82 | |||
| 83 | /* Set up/modify memory layout */ | ||
| 84 | #define VHOST_SET_MEM_TABLE _IOW(VHOST_VIRTIO, 0x03, struct vhost_memory) | ||
| 85 | |||
| 86 | /* Write logging setup. */ | ||
| 87 | /* Memory writes can optionally be logged by setting bit at an offset | ||
| 88 | * (calculated from the physical address) from specified log base. | ||
| 89 | * The bit is set using an atomic 32 bit operation. */ | ||
| 90 | /* Set base address for logging. */ | ||
| 91 | #define VHOST_SET_LOG_BASE _IOW(VHOST_VIRTIO, 0x04, __u64) | ||
| 92 | /* Specify an eventfd file descriptor to signal on log write. */ | ||
| 93 | #define VHOST_SET_LOG_FD _IOW(VHOST_VIRTIO, 0x07, int) | ||
| 94 | |||
| 95 | /* Ring setup. */ | ||
| 96 | /* Set number of descriptors in ring. This parameter can not | ||
| 97 | * be modified while ring is running (bound to a device). */ | ||
| 98 | #define VHOST_SET_VRING_NUM _IOW(VHOST_VIRTIO, 0x10, struct vhost_vring_state) | ||
| 99 | /* Set addresses for the ring. */ | ||
| 100 | #define VHOST_SET_VRING_ADDR _IOW(VHOST_VIRTIO, 0x11, struct vhost_vring_addr) | ||
| 101 | /* Base value where queue looks for available descriptors */ | ||
| 102 | #define VHOST_SET_VRING_BASE _IOW(VHOST_VIRTIO, 0x12, struct vhost_vring_state) | ||
| 103 | /* Get accessor: reads index, writes value in num */ | ||
| 104 | #define VHOST_GET_VRING_BASE _IOWR(VHOST_VIRTIO, 0x12, struct vhost_vring_state) | ||
| 105 | |||
| 106 | /* The following ioctls use eventfd file descriptors to signal and poll | ||
| 107 | * for events. */ | ||
| 108 | |||
| 109 | /* Set eventfd to poll for added buffers */ | ||
| 110 | #define VHOST_SET_VRING_KICK _IOW(VHOST_VIRTIO, 0x20, struct vhost_vring_file) | ||
| 111 | /* Set eventfd to signal when buffers have beed used */ | ||
| 112 | #define VHOST_SET_VRING_CALL _IOW(VHOST_VIRTIO, 0x21, struct vhost_vring_file) | ||
| 113 | /* Set eventfd to signal an error */ | ||
| 114 | #define VHOST_SET_VRING_ERR _IOW(VHOST_VIRTIO, 0x22, struct vhost_vring_file) | ||
| 115 | |||
| 116 | /* VHOST_NET specific defines */ | ||
| 117 | |||
| 118 | /* Attach virtio net ring to a raw socket, or tap device. | ||
| 119 | * The socket must be already bound to an ethernet device, this device will be | ||
| 120 | * used for transmit. Pass fd -1 to unbind from the socket and the transmit | ||
| 121 | * device. This can be used to stop the ring (e.g. for migration). */ | ||
| 122 | #define VHOST_NET_SET_BACKEND _IOW(VHOST_VIRTIO, 0x30, struct vhost_vring_file) | ||
| 123 | |||
| 124 | /* Feature bits */ | ||
| 125 | /* Log all write descriptors. Can be changed while device is active. */ | ||
| 126 | #define VHOST_F_LOG_ALL 26 | ||
| 127 | /* vhost-net should add virtio_net_hdr for RX, and strip for TX packets. */ | ||
| 128 | #define VHOST_NET_F_VIRTIO_NET_HDR 27 | ||
| 129 | |||
| 130 | #endif | ||
diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h index b59e78c57161..3793d168b44d 100644 --- a/include/linux/videodev2.h +++ b/include/linux/videodev2.h | |||
| @@ -294,6 +294,7 @@ struct v4l2_pix_format { | |||
| 294 | 294 | ||
| 295 | /* Grey formats */ | 295 | /* Grey formats */ |
| 296 | #define V4L2_PIX_FMT_GREY v4l2_fourcc('G', 'R', 'E', 'Y') /* 8 Greyscale */ | 296 | #define V4L2_PIX_FMT_GREY v4l2_fourcc('G', 'R', 'E', 'Y') /* 8 Greyscale */ |
| 297 | #define V4L2_PIX_FMT_Y10 v4l2_fourcc('Y', '1', '0', ' ') /* 10 Greyscale */ | ||
| 297 | #define V4L2_PIX_FMT_Y16 v4l2_fourcc('Y', '1', '6', ' ') /* 16 Greyscale */ | 298 | #define V4L2_PIX_FMT_Y16 v4l2_fourcc('Y', '1', '6', ' ') /* 16 Greyscale */ |
| 298 | 299 | ||
| 299 | /* Palette formats */ | 300 | /* Palette formats */ |
| @@ -329,7 +330,11 @@ struct v4l2_pix_format { | |||
| 329 | #define V4L2_PIX_FMT_SBGGR8 v4l2_fourcc('B', 'A', '8', '1') /* 8 BGBG.. GRGR.. */ | 330 | #define V4L2_PIX_FMT_SBGGR8 v4l2_fourcc('B', 'A', '8', '1') /* 8 BGBG.. GRGR.. */ |
| 330 | #define V4L2_PIX_FMT_SGBRG8 v4l2_fourcc('G', 'B', 'R', 'G') /* 8 GBGB.. RGRG.. */ | 331 | #define V4L2_PIX_FMT_SGBRG8 v4l2_fourcc('G', 'B', 'R', 'G') /* 8 GBGB.. RGRG.. */ |
| 331 | #define V4L2_PIX_FMT_SGRBG8 v4l2_fourcc('G', 'R', 'B', 'G') /* 8 GRGR.. BGBG.. */ | 332 | #define V4L2_PIX_FMT_SGRBG8 v4l2_fourcc('G', 'R', 'B', 'G') /* 8 GRGR.. BGBG.. */ |
| 332 | #define V4L2_PIX_FMT_SGRBG10 v4l2_fourcc('B', 'A', '1', '0') /* 10bit raw bayer */ | 333 | #define V4L2_PIX_FMT_SRGGB8 v4l2_fourcc('R', 'G', 'G', 'B') /* 8 RGRG.. GBGB.. */ |
| 334 | #define V4L2_PIX_FMT_SBGGR10 v4l2_fourcc('B', 'G', '1', '0') /* 10 BGBG.. GRGR.. */ | ||
| 335 | #define V4L2_PIX_FMT_SGBRG10 v4l2_fourcc('G', 'B', '1', '0') /* 10 GBGB.. RGRG.. */ | ||
| 336 | #define V4L2_PIX_FMT_SGRBG10 v4l2_fourcc('B', 'A', '1', '0') /* 10 GRGR.. BGBG.. */ | ||
| 337 | #define V4L2_PIX_FMT_SRGGB10 v4l2_fourcc('R', 'G', '1', '0') /* 10 RGRG.. GBGB.. */ | ||
| 333 | /* 10bit raw bayer DPCM compressed to 8 bits */ | 338 | /* 10bit raw bayer DPCM compressed to 8 bits */ |
| 334 | #define V4L2_PIX_FMT_SGRBG10DPCM8 v4l2_fourcc('B', 'D', '1', '0') | 339 | #define V4L2_PIX_FMT_SGRBG10DPCM8 v4l2_fourcc('B', 'D', '1', '0') |
| 335 | /* | 340 | /* |
| @@ -345,6 +350,7 @@ struct v4l2_pix_format { | |||
| 345 | #define V4L2_PIX_FMT_MPEG v4l2_fourcc('M', 'P', 'E', 'G') /* MPEG-1/2/4 */ | 350 | #define V4L2_PIX_FMT_MPEG v4l2_fourcc('M', 'P', 'E', 'G') /* MPEG-1/2/4 */ |
| 346 | 351 | ||
| 347 | /* Vendor-specific formats */ | 352 | /* Vendor-specific formats */ |
| 353 | #define V4L2_PIX_FMT_CPIA1 v4l2_fourcc('C', 'P', 'I', 'A') /* cpia1 YUV */ | ||
| 348 | #define V4L2_PIX_FMT_WNVA v4l2_fourcc('W', 'N', 'V', 'A') /* Winnov hw compress */ | 354 | #define V4L2_PIX_FMT_WNVA v4l2_fourcc('W', 'N', 'V', 'A') /* Winnov hw compress */ |
| 349 | #define V4L2_PIX_FMT_SN9C10X v4l2_fourcc('S', '9', '1', '0') /* SN9C10x compression */ | 355 | #define V4L2_PIX_FMT_SN9C10X v4l2_fourcc('S', '9', '1', '0') /* SN9C10x compression */ |
| 350 | #define V4L2_PIX_FMT_SN9C20X_I420 v4l2_fourcc('S', '9', '2', '0') /* SN9C20x YUV 4:2:0 */ | 356 | #define V4L2_PIX_FMT_SN9C20X_I420 v4l2_fourcc('S', '9', '2', '0') /* SN9C20x YUV 4:2:0 */ |
| @@ -357,10 +363,12 @@ struct v4l2_pix_format { | |||
| 357 | #define V4L2_PIX_FMT_SPCA561 v4l2_fourcc('S', '5', '6', '1') /* compressed GBRG bayer */ | 363 | #define V4L2_PIX_FMT_SPCA561 v4l2_fourcc('S', '5', '6', '1') /* compressed GBRG bayer */ |
| 358 | #define V4L2_PIX_FMT_PAC207 v4l2_fourcc('P', '2', '0', '7') /* compressed BGGR bayer */ | 364 | #define V4L2_PIX_FMT_PAC207 v4l2_fourcc('P', '2', '0', '7') /* compressed BGGR bayer */ |
| 359 | #define V4L2_PIX_FMT_MR97310A v4l2_fourcc('M', '3', '1', '0') /* compressed BGGR bayer */ | 365 | #define V4L2_PIX_FMT_MR97310A v4l2_fourcc('M', '3', '1', '0') /* compressed BGGR bayer */ |
| 366 | #define V4L2_PIX_FMT_SN9C2028 v4l2_fourcc('S', 'O', 'N', 'X') /* compressed GBRG bayer */ | ||
| 360 | #define V4L2_PIX_FMT_SQ905C v4l2_fourcc('9', '0', '5', 'C') /* compressed RGGB bayer */ | 367 | #define V4L2_PIX_FMT_SQ905C v4l2_fourcc('9', '0', '5', 'C') /* compressed RGGB bayer */ |
| 361 | #define V4L2_PIX_FMT_PJPG v4l2_fourcc('P', 'J', 'P', 'G') /* Pixart 73xx JPEG */ | 368 | #define V4L2_PIX_FMT_PJPG v4l2_fourcc('P', 'J', 'P', 'G') /* Pixart 73xx JPEG */ |
| 362 | #define V4L2_PIX_FMT_OV511 v4l2_fourcc('O', '5', '1', '1') /* ov511 JPEG */ | 369 | #define V4L2_PIX_FMT_OV511 v4l2_fourcc('O', '5', '1', '1') /* ov511 JPEG */ |
| 363 | #define V4L2_PIX_FMT_OV518 v4l2_fourcc('O', '5', '1', '8') /* ov518 JPEG */ | 370 | #define V4L2_PIX_FMT_OV518 v4l2_fourcc('O', '5', '1', '8') /* ov518 JPEG */ |
| 371 | #define V4L2_PIX_FMT_STV0680 v4l2_fourcc('S', '6', '8', '0') /* stv0680 bayer */ | ||
| 364 | 372 | ||
| 365 | /* | 373 | /* |
| 366 | * F O R M A T E N U M E R A T I O N | 374 | * F O R M A T E N U M E R A T I O N |
| @@ -490,7 +498,7 @@ struct v4l2_jpegcompression { | |||
| 490 | * you do, leave them untouched. | 498 | * you do, leave them untouched. |
| 491 | * Inluding less markers will make the | 499 | * Inluding less markers will make the |
| 492 | * resulting code smaller, but there will | 500 | * resulting code smaller, but there will |
| 493 | * be fewer aplications which can read it. | 501 | * be fewer applications which can read it. |
| 494 | * The presence of the APP and COM marker | 502 | * The presence of the APP and COM marker |
| 495 | * is influenced by APP_len and COM_len | 503 | * is influenced by APP_len and COM_len |
| 496 | * ONLY, not by this property! */ | 504 | * ONLY, not by this property! */ |
| @@ -563,6 +571,7 @@ struct v4l2_framebuffer { | |||
| 563 | #define V4L2_FBUF_CAP_LOCAL_ALPHA 0x0010 | 571 | #define V4L2_FBUF_CAP_LOCAL_ALPHA 0x0010 |
| 564 | #define V4L2_FBUF_CAP_GLOBAL_ALPHA 0x0020 | 572 | #define V4L2_FBUF_CAP_GLOBAL_ALPHA 0x0020 |
| 565 | #define V4L2_FBUF_CAP_LOCAL_INV_ALPHA 0x0040 | 573 | #define V4L2_FBUF_CAP_LOCAL_INV_ALPHA 0x0040 |
| 574 | #define V4L2_FBUF_CAP_SRC_CHROMAKEY 0x0080 | ||
| 566 | /* Flags for the 'flags' field. */ | 575 | /* Flags for the 'flags' field. */ |
| 567 | #define V4L2_FBUF_FLAG_PRIMARY 0x0001 | 576 | #define V4L2_FBUF_FLAG_PRIMARY 0x0001 |
| 568 | #define V4L2_FBUF_FLAG_OVERLAY 0x0002 | 577 | #define V4L2_FBUF_FLAG_OVERLAY 0x0002 |
| @@ -570,6 +579,7 @@ struct v4l2_framebuffer { | |||
| 570 | #define V4L2_FBUF_FLAG_LOCAL_ALPHA 0x0008 | 579 | #define V4L2_FBUF_FLAG_LOCAL_ALPHA 0x0008 |
| 571 | #define V4L2_FBUF_FLAG_GLOBAL_ALPHA 0x0010 | 580 | #define V4L2_FBUF_FLAG_GLOBAL_ALPHA 0x0010 |
| 572 | #define V4L2_FBUF_FLAG_LOCAL_INV_ALPHA 0x0020 | 581 | #define V4L2_FBUF_FLAG_LOCAL_INV_ALPHA 0x0020 |
| 582 | #define V4L2_FBUF_FLAG_SRC_CHROMAKEY 0x0040 | ||
| 573 | 583 | ||
| 574 | struct v4l2_clip { | 584 | struct v4l2_clip { |
| 575 | struct v4l2_rect c; | 585 | struct v4l2_rect c; |
| @@ -729,6 +739,99 @@ struct v4l2_standard { | |||
| 729 | }; | 739 | }; |
| 730 | 740 | ||
| 731 | /* | 741 | /* |
| 742 | * V I D E O T I M I N G S D V P R E S E T | ||
| 743 | */ | ||
| 744 | struct v4l2_dv_preset { | ||
| 745 | __u32 preset; | ||
| 746 | __u32 reserved[4]; | ||
| 747 | }; | ||
| 748 | |||
| 749 | /* | ||
| 750 | * D V P R E S E T S E N U M E R A T I O N | ||
| 751 | */ | ||
| 752 | struct v4l2_dv_enum_preset { | ||
| 753 | __u32 index; | ||
| 754 | __u32 preset; | ||
| 755 | __u8 name[32]; /* Name of the preset timing */ | ||
| 756 | __u32 width; | ||
| 757 | __u32 height; | ||
| 758 | __u32 reserved[4]; | ||
| 759 | }; | ||
| 760 | |||
| 761 | /* | ||
| 762 | * D V P R E S E T V A L U E S | ||
| 763 | */ | ||
| 764 | #define V4L2_DV_INVALID 0 | ||
| 765 | #define V4L2_DV_480P59_94 1 /* BT.1362 */ | ||
| 766 | #define V4L2_DV_576P50 2 /* BT.1362 */ | ||
| 767 | #define V4L2_DV_720P24 3 /* SMPTE 296M */ | ||
| 768 | #define V4L2_DV_720P25 4 /* SMPTE 296M */ | ||
| 769 | #define V4L2_DV_720P30 5 /* SMPTE 296M */ | ||
| 770 | #define V4L2_DV_720P50 6 /* SMPTE 296M */ | ||
| 771 | #define V4L2_DV_720P59_94 7 /* SMPTE 274M */ | ||
| 772 | #define V4L2_DV_720P60 8 /* SMPTE 274M/296M */ | ||
| 773 | #define V4L2_DV_1080I29_97 9 /* BT.1120/ SMPTE 274M */ | ||
| 774 | #define V4L2_DV_1080I30 10 /* BT.1120/ SMPTE 274M */ | ||
| 775 | #define V4L2_DV_1080I25 11 /* BT.1120 */ | ||
| 776 | #define V4L2_DV_1080I50 12 /* SMPTE 296M */ | ||
| 777 | #define V4L2_DV_1080I60 13 /* SMPTE 296M */ | ||
| 778 | #define V4L2_DV_1080P24 14 /* SMPTE 296M */ | ||
| 779 | #define V4L2_DV_1080P25 15 /* SMPTE 296M */ | ||
| 780 | #define V4L2_DV_1080P30 16 /* SMPTE 296M */ | ||
| 781 | #define V4L2_DV_1080P50 17 /* BT.1120 */ | ||
| 782 | #define V4L2_DV_1080P60 18 /* BT.1120 */ | ||
| 783 | |||
| 784 | /* | ||
| 785 | * D V B T T I M I N G S | ||
| 786 | */ | ||
| 787 | |||
| 788 | /* BT.656/BT.1120 timing data */ | ||
| 789 | struct v4l2_bt_timings { | ||
| 790 | __u32 width; /* width in pixels */ | ||
| 791 | __u32 height; /* height in lines */ | ||
| 792 | __u32 interlaced; /* Interlaced or progressive */ | ||
| 793 | __u32 polarities; /* Positive or negative polarity */ | ||
| 794 | __u64 pixelclock; /* Pixel clock in HZ. Ex. 74.25MHz->74250000 */ | ||
| 795 | __u32 hfrontporch; /* Horizpontal front porch in pixels */ | ||
| 796 | __u32 hsync; /* Horizontal Sync length in pixels */ | ||
| 797 | __u32 hbackporch; /* Horizontal back porch in pixels */ | ||
| 798 | __u32 vfrontporch; /* Vertical front porch in pixels */ | ||
| 799 | __u32 vsync; /* Vertical Sync length in lines */ | ||
| 800 | __u32 vbackporch; /* Vertical back porch in lines */ | ||
| 801 | __u32 il_vfrontporch; /* Vertical front porch for bottom field of | ||
| 802 | * interlaced field formats | ||
| 803 | */ | ||
| 804 | __u32 il_vsync; /* Vertical sync length for bottom field of | ||
| 805 | * interlaced field formats | ||
| 806 | */ | ||
| 807 | __u32 il_vbackporch; /* Vertical back porch for bottom field of | ||
| 808 | * interlaced field formats | ||
| 809 | */ | ||
| 810 | __u32 reserved[16]; | ||
| 811 | } __attribute__ ((packed)); | ||
| 812 | |||
| 813 | /* Interlaced or progressive format */ | ||
| 814 | #define V4L2_DV_PROGRESSIVE 0 | ||
| 815 | #define V4L2_DV_INTERLACED 1 | ||
| 816 | |||
| 817 | /* Polarities. If bit is not set, it is assumed to be negative polarity */ | ||
| 818 | #define V4L2_DV_VSYNC_POS_POL 0x00000001 | ||
| 819 | #define V4L2_DV_HSYNC_POS_POL 0x00000002 | ||
| 820 | |||
| 821 | |||
| 822 | /* DV timings */ | ||
| 823 | struct v4l2_dv_timings { | ||
| 824 | __u32 type; | ||
| 825 | union { | ||
| 826 | struct v4l2_bt_timings bt; | ||
| 827 | __u32 reserved[32]; | ||
| 828 | }; | ||
| 829 | } __attribute__ ((packed)); | ||
| 830 | |||
| 831 | /* Values for the type field */ | ||
| 832 | #define V4L2_DV_BT_656_1120 0 /* BT.656/1120 timing type */ | ||
| 833 | |||
| 834 | /* | ||
| 732 | * V I D E O I N P U T S | 835 | * V I D E O I N P U T S |
| 733 | */ | 836 | */ |
| 734 | struct v4l2_input { | 837 | struct v4l2_input { |
| @@ -739,7 +842,8 @@ struct v4l2_input { | |||
| 739 | __u32 tuner; /* Associated tuner */ | 842 | __u32 tuner; /* Associated tuner */ |
| 740 | v4l2_std_id std; | 843 | v4l2_std_id std; |
| 741 | __u32 status; | 844 | __u32 status; |
| 742 | __u32 reserved[4]; | 845 | __u32 capabilities; |
| 846 | __u32 reserved[3]; | ||
| 743 | }; | 847 | }; |
| 744 | 848 | ||
| 745 | /* Values for the 'type' field */ | 849 | /* Values for the 'type' field */ |
| @@ -770,6 +874,11 @@ struct v4l2_input { | |||
| 770 | #define V4L2_IN_ST_NO_ACCESS 0x02000000 /* Conditional access denied */ | 874 | #define V4L2_IN_ST_NO_ACCESS 0x02000000 /* Conditional access denied */ |
| 771 | #define V4L2_IN_ST_VTR 0x04000000 /* VTR time constant */ | 875 | #define V4L2_IN_ST_VTR 0x04000000 /* VTR time constant */ |
| 772 | 876 | ||
| 877 | /* capabilities flags */ | ||
| 878 | #define V4L2_IN_CAP_PRESETS 0x00000001 /* Supports S_DV_PRESET */ | ||
| 879 | #define V4L2_IN_CAP_CUSTOM_TIMINGS 0x00000002 /* Supports S_DV_TIMINGS */ | ||
| 880 | #define V4L2_IN_CAP_STD 0x00000004 /* Supports S_STD */ | ||
| 881 | |||
| 773 | /* | 882 | /* |
| 774 | * V I D E O O U T P U T S | 883 | * V I D E O O U T P U T S |
| 775 | */ | 884 | */ |
| @@ -780,13 +889,19 @@ struct v4l2_output { | |||
| 780 | __u32 audioset; /* Associated audios (bitfield) */ | 889 | __u32 audioset; /* Associated audios (bitfield) */ |
| 781 | __u32 modulator; /* Associated modulator */ | 890 | __u32 modulator; /* Associated modulator */ |
| 782 | v4l2_std_id std; | 891 | v4l2_std_id std; |
| 783 | __u32 reserved[4]; | 892 | __u32 capabilities; |
| 893 | __u32 reserved[3]; | ||
| 784 | }; | 894 | }; |
| 785 | /* Values for the 'type' field */ | 895 | /* Values for the 'type' field */ |
| 786 | #define V4L2_OUTPUT_TYPE_MODULATOR 1 | 896 | #define V4L2_OUTPUT_TYPE_MODULATOR 1 |
| 787 | #define V4L2_OUTPUT_TYPE_ANALOG 2 | 897 | #define V4L2_OUTPUT_TYPE_ANALOG 2 |
| 788 | #define V4L2_OUTPUT_TYPE_ANALOGVGAOVERLAY 3 | 898 | #define V4L2_OUTPUT_TYPE_ANALOGVGAOVERLAY 3 |
| 789 | 899 | ||
| 900 | /* capabilities flags */ | ||
| 901 | #define V4L2_OUT_CAP_PRESETS 0x00000001 /* Supports S_DV_PRESET */ | ||
| 902 | #define V4L2_OUT_CAP_CUSTOM_TIMINGS 0x00000002 /* Supports S_DV_TIMINGS */ | ||
| 903 | #define V4L2_OUT_CAP_STD 0x00000004 /* Supports S_STD */ | ||
| 904 | |||
| 790 | /* | 905 | /* |
| 791 | * C O N T R O L S | 906 | * C O N T R O L S |
| 792 | */ | 907 | */ |
| @@ -912,8 +1027,10 @@ enum v4l2_colorfx { | |||
| 912 | #define V4L2_CID_AUTOBRIGHTNESS (V4L2_CID_BASE+32) | 1027 | #define V4L2_CID_AUTOBRIGHTNESS (V4L2_CID_BASE+32) |
| 913 | #define V4L2_CID_BAND_STOP_FILTER (V4L2_CID_BASE+33) | 1028 | #define V4L2_CID_BAND_STOP_FILTER (V4L2_CID_BASE+33) |
| 914 | 1029 | ||
| 1030 | #define V4L2_CID_ROTATE (V4L2_CID_BASE+34) | ||
| 1031 | #define V4L2_CID_BG_COLOR (V4L2_CID_BASE+35) | ||
| 915 | /* last CID + 1 */ | 1032 | /* last CID + 1 */ |
| 916 | #define V4L2_CID_LASTP1 (V4L2_CID_BASE+34) | 1033 | #define V4L2_CID_LASTP1 (V4L2_CID_BASE+36) |
| 917 | 1034 | ||
| 918 | /* MPEG-class control IDs defined by V4L2 */ | 1035 | /* MPEG-class control IDs defined by V4L2 */ |
| 919 | #define V4L2_CID_MPEG_BASE (V4L2_CTRL_CLASS_MPEG | 0x900) | 1036 | #define V4L2_CID_MPEG_BASE (V4L2_CTRL_CLASS_MPEG | 0x900) |
| @@ -1619,6 +1736,13 @@ struct v4l2_dbg_chip_ident { | |||
| 1619 | #endif | 1736 | #endif |
| 1620 | 1737 | ||
| 1621 | #define VIDIOC_S_HW_FREQ_SEEK _IOW('V', 82, struct v4l2_hw_freq_seek) | 1738 | #define VIDIOC_S_HW_FREQ_SEEK _IOW('V', 82, struct v4l2_hw_freq_seek) |
| 1739 | #define VIDIOC_ENUM_DV_PRESETS _IOWR('V', 83, struct v4l2_dv_enum_preset) | ||
| 1740 | #define VIDIOC_S_DV_PRESET _IOWR('V', 84, struct v4l2_dv_preset) | ||
| 1741 | #define VIDIOC_G_DV_PRESET _IOWR('V', 85, struct v4l2_dv_preset) | ||
| 1742 | #define VIDIOC_QUERY_DV_PRESET _IOR('V', 86, struct v4l2_dv_preset) | ||
| 1743 | #define VIDIOC_S_DV_TIMINGS _IOWR('V', 87, struct v4l2_dv_timings) | ||
| 1744 | #define VIDIOC_G_DV_TIMINGS _IOWR('V', 88, struct v4l2_dv_timings) | ||
| 1745 | |||
| 1622 | /* Reminder: when adding new ioctls please add support for them to | 1746 | /* Reminder: when adding new ioctls please add support for them to |
| 1623 | drivers/media/video/v4l2-compat-ioctl32.c as well! */ | 1747 | drivers/media/video/v4l2-compat-ioctl32.c as well! */ |
| 1624 | 1748 | ||
diff --git a/include/linux/virtio.h b/include/linux/virtio.h index 057a2e010758..40d1709bdbf4 100644 --- a/include/linux/virtio.h +++ b/include/linux/virtio.h | |||
| @@ -51,6 +51,9 @@ struct virtqueue { | |||
| 51 | * This re-enables callbacks; it returns "false" if there are pending | 51 | * This re-enables callbacks; it returns "false" if there are pending |
| 52 | * buffers in the queue, to detect a possible race between the driver | 52 | * buffers in the queue, to detect a possible race between the driver |
| 53 | * checking for more work, and enabling callbacks. | 53 | * checking for more work, and enabling callbacks. |
| 54 | * @detach_unused_buf: detach first unused buffer | ||
| 55 | * vq: the struct virtqueue we're talking about. | ||
| 56 | * Returns NULL or the "data" token handed to add_buf | ||
| 54 | * | 57 | * |
| 55 | * Locking rules are straightforward: the driver is responsible for | 58 | * Locking rules are straightforward: the driver is responsible for |
| 56 | * locking. No two operations may be invoked simultaneously, with the exception | 59 | * locking. No two operations may be invoked simultaneously, with the exception |
| @@ -71,6 +74,7 @@ struct virtqueue_ops { | |||
| 71 | 74 | ||
| 72 | void (*disable_cb)(struct virtqueue *vq); | 75 | void (*disable_cb)(struct virtqueue *vq); |
| 73 | bool (*enable_cb)(struct virtqueue *vq); | 76 | bool (*enable_cb)(struct virtqueue *vq); |
| 77 | void *(*detach_unused_buf)(struct virtqueue *vq); | ||
| 74 | }; | 78 | }; |
| 75 | 79 | ||
| 76 | /** | 80 | /** |
| @@ -94,6 +98,7 @@ struct virtio_device { | |||
| 94 | void *priv; | 98 | void *priv; |
| 95 | }; | 99 | }; |
| 96 | 100 | ||
| 101 | #define dev_to_virtio(dev) container_of(dev, struct virtio_device, dev) | ||
| 97 | int register_virtio_device(struct virtio_device *dev); | 102 | int register_virtio_device(struct virtio_device *dev); |
| 98 | void unregister_virtio_device(struct virtio_device *dev); | 103 | void unregister_virtio_device(struct virtio_device *dev); |
| 99 | 104 | ||
diff --git a/include/linux/virtio_9p.h b/include/linux/virtio_9p.h index 095e10d148b4..5cf11765146b 100644 --- a/include/linux/virtio_9p.h +++ b/include/linux/virtio_9p.h | |||
| @@ -5,7 +5,16 @@ | |||
| 5 | #include <linux/virtio_ids.h> | 5 | #include <linux/virtio_ids.h> |
| 6 | #include <linux/virtio_config.h> | 6 | #include <linux/virtio_config.h> |
| 7 | 7 | ||
| 8 | /* Maximum number of virtio channels per partition (1 for now) */ | 8 | /* The feature bitmap for virtio 9P */ |
| 9 | #define MAX_9P_CHAN 1 | 9 | |
| 10 | /* The mount point is specified in a config variable */ | ||
| 11 | #define VIRTIO_9P_MOUNT_TAG 0 | ||
| 12 | |||
| 13 | struct virtio_9p_config { | ||
| 14 | /* length of the tag name */ | ||
| 15 | __u16 tag_len; | ||
| 16 | /* non-NULL terminated tag name */ | ||
| 17 | __u8 tag[0]; | ||
| 18 | } __attribute__((packed)); | ||
| 10 | 19 | ||
| 11 | #endif /* _LINUX_VIRTIO_9P_H */ | 20 | #endif /* _LINUX_VIRTIO_9P_H */ |
diff --git a/include/linux/virtio_balloon.h b/include/linux/virtio_balloon.h index 1418f048cb34..a50ecd1b81a2 100644 --- a/include/linux/virtio_balloon.h +++ b/include/linux/virtio_balloon.h | |||
| @@ -7,6 +7,7 @@ | |||
| 7 | 7 | ||
| 8 | /* The feature bitmap for virtio balloon */ | 8 | /* The feature bitmap for virtio balloon */ |
| 9 | #define VIRTIO_BALLOON_F_MUST_TELL_HOST 0 /* Tell before reclaiming pages */ | 9 | #define VIRTIO_BALLOON_F_MUST_TELL_HOST 0 /* Tell before reclaiming pages */ |
| 10 | #define VIRTIO_BALLOON_F_STATS_VQ 1 /* Memory Stats virtqueue */ | ||
| 10 | 11 | ||
| 11 | /* Size of a PFN in the balloon interface. */ | 12 | /* Size of a PFN in the balloon interface. */ |
| 12 | #define VIRTIO_BALLOON_PFN_SHIFT 12 | 13 | #define VIRTIO_BALLOON_PFN_SHIFT 12 |
| @@ -18,4 +19,18 @@ struct virtio_balloon_config | |||
| 18 | /* Number of pages we've actually got in balloon. */ | 19 | /* Number of pages we've actually got in balloon. */ |
| 19 | __le32 actual; | 20 | __le32 actual; |
| 20 | }; | 21 | }; |
| 22 | |||
| 23 | #define VIRTIO_BALLOON_S_SWAP_IN 0 /* Amount of memory swapped in */ | ||
| 24 | #define VIRTIO_BALLOON_S_SWAP_OUT 1 /* Amount of memory swapped out */ | ||
| 25 | #define VIRTIO_BALLOON_S_MAJFLT 2 /* Number of major faults */ | ||
| 26 | #define VIRTIO_BALLOON_S_MINFLT 3 /* Number of minor faults */ | ||
| 27 | #define VIRTIO_BALLOON_S_MEMFREE 4 /* Total amount of free memory */ | ||
| 28 | #define VIRTIO_BALLOON_S_MEMTOT 5 /* Total amount of memory */ | ||
| 29 | #define VIRTIO_BALLOON_S_NR 6 | ||
| 30 | |||
| 31 | struct virtio_balloon_stat { | ||
| 32 | u16 tag; | ||
| 33 | u64 val; | ||
| 34 | } __attribute__((packed)); | ||
| 35 | |||
| 21 | #endif /* _LINUX_VIRTIO_BALLOON_H */ | 36 | #endif /* _LINUX_VIRTIO_BALLOON_H */ |
diff --git a/include/linux/virtio_blk.h b/include/linux/virtio_blk.h index fd294c56d571..e52029e98919 100644 --- a/include/linux/virtio_blk.h +++ b/include/linux/virtio_blk.h | |||
| @@ -15,6 +15,7 @@ | |||
| 15 | #define VIRTIO_BLK_F_BLK_SIZE 6 /* Block size of disk is available*/ | 15 | #define VIRTIO_BLK_F_BLK_SIZE 6 /* Block size of disk is available*/ |
| 16 | #define VIRTIO_BLK_F_SCSI 7 /* Supports scsi command passthru */ | 16 | #define VIRTIO_BLK_F_SCSI 7 /* Supports scsi command passthru */ |
| 17 | #define VIRTIO_BLK_F_FLUSH 9 /* Cache flush command support */ | 17 | #define VIRTIO_BLK_F_FLUSH 9 /* Cache flush command support */ |
| 18 | #define VIRTIO_BLK_F_TOPOLOGY 10 /* Topology information is available */ | ||
| 18 | 19 | ||
| 19 | struct virtio_blk_config { | 20 | struct virtio_blk_config { |
| 20 | /* The capacity (in 512-byte sectors). */ | 21 | /* The capacity (in 512-byte sectors). */ |
| @@ -29,8 +30,20 @@ struct virtio_blk_config { | |||
| 29 | __u8 heads; | 30 | __u8 heads; |
| 30 | __u8 sectors; | 31 | __u8 sectors; |
| 31 | } geometry; | 32 | } geometry; |
| 33 | |||
| 32 | /* block size of device (if VIRTIO_BLK_F_BLK_SIZE) */ | 34 | /* block size of device (if VIRTIO_BLK_F_BLK_SIZE) */ |
| 33 | __u32 blk_size; | 35 | __u32 blk_size; |
| 36 | |||
| 37 | /* the next 4 entries are guarded by VIRTIO_BLK_F_TOPOLOGY */ | ||
| 38 | /* exponent for physical block per logical block. */ | ||
| 39 | __u8 physical_block_exp; | ||
| 40 | /* alignment offset in logical blocks. */ | ||
| 41 | __u8 alignment_offset; | ||
| 42 | /* minimum I/O size without performance penalty in logical blocks. */ | ||
| 43 | __u16 min_io_size; | ||
| 44 | /* optimal sustained I/O size in logical blocks. */ | ||
| 45 | __u32 opt_io_size; | ||
| 46 | |||
| 34 | } __attribute__((packed)); | 47 | } __attribute__((packed)); |
| 35 | 48 | ||
| 36 | /* | 49 | /* |
diff --git a/include/linux/virtio_console.h b/include/linux/virtio_console.h index fe885174cc1f..92228a8fbcbc 100644 --- a/include/linux/virtio_console.h +++ b/include/linux/virtio_console.h | |||
| @@ -3,8 +3,12 @@ | |||
| 3 | #include <linux/types.h> | 3 | #include <linux/types.h> |
| 4 | #include <linux/virtio_ids.h> | 4 | #include <linux/virtio_ids.h> |
| 5 | #include <linux/virtio_config.h> | 5 | #include <linux/virtio_config.h> |
| 6 | /* This header, excluding the #ifdef __KERNEL__ part, is BSD licensed so | 6 | /* |
| 7 | * anyone can use the definitions to implement compatible drivers/servers. */ | 7 | * This header, excluding the #ifdef __KERNEL__ part, is BSD licensed so |
| 8 | * anyone can use the definitions to implement compatible drivers/servers. | ||
| 9 | * | ||
| 10 | * Copyright (C) Red Hat, Inc., 2009, 2010 | ||
| 11 | */ | ||
| 8 | 12 | ||
| 9 | /* Feature bits */ | 13 | /* Feature bits */ |
| 10 | #define VIRTIO_CONSOLE_F_SIZE 0 /* Does host provide console size? */ | 14 | #define VIRTIO_CONSOLE_F_SIZE 0 /* Does host provide console size? */ |
| @@ -16,7 +20,6 @@ struct virtio_console_config { | |||
| 16 | __u16 rows; | 20 | __u16 rows; |
| 17 | } __attribute__((packed)); | 21 | } __attribute__((packed)); |
| 18 | 22 | ||
| 19 | |||
| 20 | #ifdef __KERNEL__ | 23 | #ifdef __KERNEL__ |
| 21 | int __init virtio_cons_early_init(int (*put_chars)(u32, const char *, int)); | 24 | int __init virtio_cons_early_init(int (*put_chars)(u32, const char *, int)); |
| 22 | #endif /* __KERNEL__ */ | 25 | #endif /* __KERNEL__ */ |
diff --git a/include/linux/vmstat.h b/include/linux/vmstat.h index 2d0f222388a8..117f0dd8ad03 100644 --- a/include/linux/vmstat.h +++ b/include/linux/vmstat.h | |||
| @@ -40,6 +40,8 @@ enum vm_event_item { PGPGIN, PGPGOUT, PSWPIN, PSWPOUT, | |||
| 40 | PGSCAN_ZONE_RECLAIM_FAILED, | 40 | PGSCAN_ZONE_RECLAIM_FAILED, |
| 41 | #endif | 41 | #endif |
| 42 | PGINODESTEAL, SLABS_SCANNED, KSWAPD_STEAL, KSWAPD_INODESTEAL, | 42 | PGINODESTEAL, SLABS_SCANNED, KSWAPD_STEAL, KSWAPD_INODESTEAL, |
| 43 | KSWAPD_LOW_WMARK_HIT_QUICKLY, KSWAPD_HIGH_WMARK_HIT_QUICKLY, | ||
| 44 | KSWAPD_SKIP_CONGESTION_WAIT, | ||
| 43 | PAGEOUTRUN, ALLOCSTALL, PGROTATED, | 45 | PAGEOUTRUN, ALLOCSTALL, PGROTATED, |
| 44 | #ifdef CONFIG_HUGETLB_PAGE | 46 | #ifdef CONFIG_HUGETLB_PAGE |
| 45 | HTLB_BUDDY_PGALLOC, HTLB_BUDDY_PGALLOC_FAIL, | 47 | HTLB_BUDDY_PGALLOC, HTLB_BUDDY_PGALLOC_FAIL, |
| @@ -76,24 +78,22 @@ DECLARE_PER_CPU(struct vm_event_state, vm_event_states); | |||
| 76 | 78 | ||
| 77 | static inline void __count_vm_event(enum vm_event_item item) | 79 | static inline void __count_vm_event(enum vm_event_item item) |
| 78 | { | 80 | { |
| 79 | __get_cpu_var(vm_event_states).event[item]++; | 81 | __this_cpu_inc(vm_event_states.event[item]); |
| 80 | } | 82 | } |
| 81 | 83 | ||
| 82 | static inline void count_vm_event(enum vm_event_item item) | 84 | static inline void count_vm_event(enum vm_event_item item) |
| 83 | { | 85 | { |
| 84 | get_cpu_var(vm_event_states).event[item]++; | 86 | this_cpu_inc(vm_event_states.event[item]); |
| 85 | put_cpu(); | ||
| 86 | } | 87 | } |
| 87 | 88 | ||
| 88 | static inline void __count_vm_events(enum vm_event_item item, long delta) | 89 | static inline void __count_vm_events(enum vm_event_item item, long delta) |
| 89 | { | 90 | { |
| 90 | __get_cpu_var(vm_event_states).event[item] += delta; | 91 | __this_cpu_add(vm_event_states.event[item], delta); |
| 91 | } | 92 | } |
| 92 | 93 | ||
| 93 | static inline void count_vm_events(enum vm_event_item item, long delta) | 94 | static inline void count_vm_events(enum vm_event_item item, long delta) |
| 94 | { | 95 | { |
| 95 | get_cpu_var(vm_event_states).event[item] += delta; | 96 | this_cpu_add(vm_event_states.event[item], delta); |
| 96 | put_cpu(); | ||
| 97 | } | 97 | } |
| 98 | 98 | ||
| 99 | extern void all_vm_events(unsigned long *); | 99 | extern void all_vm_events(unsigned long *); |
diff --git a/include/linux/vt.h b/include/linux/vt.h index 7ffa11f06232..d5dd0bc408fd 100644 --- a/include/linux/vt.h +++ b/include/linux/vt.h | |||
| @@ -84,4 +84,23 @@ struct vt_setactivate { | |||
| 84 | 84 | ||
| 85 | #define VT_SETACTIVATE 0x560F /* Activate and set the mode of a console */ | 85 | #define VT_SETACTIVATE 0x560F /* Activate and set the mode of a console */ |
| 86 | 86 | ||
| 87 | #ifdef __KERNEL__ | ||
| 88 | |||
| 89 | #ifdef CONFIG_VT_CONSOLE | ||
| 90 | |||
| 91 | extern int vt_kmsg_redirect(int new); | ||
| 92 | |||
| 93 | #else | ||
| 94 | |||
| 95 | static inline int vt_kmsg_redirect(int new) | ||
| 96 | { | ||
| 97 | return 0; | ||
| 98 | } | ||
| 99 | |||
| 100 | #endif | ||
| 101 | |||
| 102 | #endif /* __KERNEL__ */ | ||
| 103 | |||
| 104 | #define vt_get_kmsg_redirect() vt_kmsg_redirect(-1) | ||
| 105 | |||
| 87 | #endif /* _LINUX_VT_H */ | 106 | #endif /* _LINUX_VT_H */ |
diff --git a/include/linux/vt_kern.h b/include/linux/vt_kern.h index c0c4e1103a73..7f56db4a79f0 100644 --- a/include/linux/vt_kern.h +++ b/include/linux/vt_kern.h | |||
| @@ -110,6 +110,7 @@ extern char con_buf[CON_BUF_SIZE]; | |||
| 110 | extern struct mutex con_buf_mtx; | 110 | extern struct mutex con_buf_mtx; |
| 111 | extern char vt_dont_switch; | 111 | extern char vt_dont_switch; |
| 112 | extern int default_utf8; | 112 | extern int default_utf8; |
| 113 | extern int global_cursor_default; | ||
| 113 | 114 | ||
| 114 | struct vt_spawn_console { | 115 | struct vt_spawn_console { |
| 115 | spinlock_t lock; | 116 | spinlock_t lock; |
| @@ -130,4 +131,6 @@ struct vt_notifier_param { | |||
| 130 | extern int register_vt_notifier(struct notifier_block *nb); | 131 | extern int register_vt_notifier(struct notifier_block *nb); |
| 131 | extern int unregister_vt_notifier(struct notifier_block *nb); | 132 | extern int unregister_vt_notifier(struct notifier_block *nb); |
| 132 | 133 | ||
| 134 | extern void hide_boot_cursor(bool hide); | ||
| 135 | |||
| 133 | #endif /* _VT_KERN_H */ | 136 | #endif /* _VT_KERN_H */ |
diff --git a/include/linux/wimax/debug.h b/include/linux/wimax/debug.h index c703e0340423..57031b4d12f2 100644 --- a/include/linux/wimax/debug.h +++ b/include/linux/wimax/debug.h | |||
| @@ -155,6 +155,7 @@ | |||
| 155 | 155 | ||
| 156 | #include <linux/types.h> | 156 | #include <linux/types.h> |
| 157 | #include <linux/device.h> | 157 | #include <linux/device.h> |
| 158 | #include <linux/slab.h> | ||
| 158 | 159 | ||
| 159 | 160 | ||
| 160 | /* Backend stuff */ | 161 | /* Backend stuff */ |
| @@ -450,4 +451,76 @@ do { \ | |||
| 450 | }) | 451 | }) |
| 451 | 452 | ||
| 452 | 453 | ||
| 454 | static inline | ||
| 455 | void d_submodule_set(struct d_level *d_level, size_t d_level_size, | ||
| 456 | const char *submodule, u8 level, const char *tag) | ||
| 457 | { | ||
| 458 | struct d_level *itr, *top; | ||
| 459 | int index = -1; | ||
| 460 | |||
| 461 | for (itr = d_level, top = itr + d_level_size; itr < top; itr++) { | ||
| 462 | index++; | ||
| 463 | if (itr->name == NULL) { | ||
| 464 | printk(KERN_ERR "%s: itr->name NULL?? (%p, #%d)\n", | ||
| 465 | tag, itr, index); | ||
| 466 | continue; | ||
| 467 | } | ||
| 468 | if (!strcmp(itr->name, submodule)) { | ||
| 469 | itr->level = level; | ||
| 470 | return; | ||
| 471 | } | ||
| 472 | } | ||
| 473 | printk(KERN_ERR "%s: unknown submodule %s\n", tag, submodule); | ||
| 474 | } | ||
| 475 | |||
| 476 | |||
| 477 | /** | ||
| 478 | * d_parse_params - Parse a string with debug parameters from the | ||
| 479 | * command line | ||
| 480 | * | ||
| 481 | * @d_level: level structure (D_LEVEL) | ||
| 482 | * @d_level_size: number of items in the level structure | ||
| 483 | * (D_LEVEL_SIZE). | ||
| 484 | * @_params: string with the parameters; this is a space (not tab!) | ||
| 485 | * separated list of NAME:VALUE, where value is the debug level | ||
| 486 | * and NAME is the name of the submodule. | ||
| 487 | * @tag: string for error messages (example: MODULE.ARGNAME). | ||
| 488 | */ | ||
| 489 | static inline | ||
| 490 | void d_parse_params(struct d_level *d_level, size_t d_level_size, | ||
| 491 | const char *_params, const char *tag) | ||
| 492 | { | ||
| 493 | char submodule[130], *params, *params_orig, *token, *colon; | ||
| 494 | unsigned level, tokens; | ||
| 495 | |||
| 496 | if (_params == NULL) | ||
| 497 | return; | ||
| 498 | params_orig = kstrdup(_params, GFP_KERNEL); | ||
| 499 | params = params_orig; | ||
| 500 | while (1) { | ||
| 501 | token = strsep(¶ms, " "); | ||
| 502 | if (token == NULL) | ||
| 503 | break; | ||
| 504 | if (*token == '\0') /* eat joint spaces */ | ||
| 505 | continue; | ||
| 506 | /* kernel's sscanf %s eats until whitespace, so we | ||
| 507 | * replace : by \n so it doesn't get eaten later by | ||
| 508 | * strsep */ | ||
| 509 | colon = strchr(token, ':'); | ||
| 510 | if (colon != NULL) | ||
| 511 | *colon = '\n'; | ||
| 512 | tokens = sscanf(token, "%s\n%u", submodule, &level); | ||
| 513 | if (colon != NULL) | ||
| 514 | *colon = ':'; /* set back, for error messages */ | ||
| 515 | if (tokens == 2) | ||
| 516 | d_submodule_set(d_level, d_level_size, | ||
| 517 | submodule, level, tag); | ||
| 518 | else | ||
| 519 | printk(KERN_ERR "%s: can't parse '%s' as a " | ||
| 520 | "SUBMODULE:LEVEL (%d tokens)\n", | ||
| 521 | tag, token, tokens); | ||
| 522 | } | ||
| 523 | kfree(params_orig); | ||
| 524 | } | ||
| 525 | |||
| 453 | #endif /* #ifndef __debug__h__ */ | 526 | #endif /* #ifndef __debug__h__ */ |
diff --git a/include/linux/wimax/i2400m.h b/include/linux/wimax/i2400m.h index 433693ef2bb0..62d356153565 100644 --- a/include/linux/wimax/i2400m.h +++ b/include/linux/wimax/i2400m.h | |||
| @@ -138,7 +138,7 @@ struct i2400m_bcf_hdr { | |||
| 138 | __le32 module_id; | 138 | __le32 module_id; |
| 139 | __le32 module_vendor; | 139 | __le32 module_vendor; |
| 140 | __le32 date; /* BCD YYYMMDD */ | 140 | __le32 date; /* BCD YYYMMDD */ |
| 141 | __le32 size; | 141 | __le32 size; /* in dwords */ |
| 142 | __le32 key_size; /* in dwords */ | 142 | __le32 key_size; /* in dwords */ |
| 143 | __le32 modulus_size; /* in dwords */ | 143 | __le32 modulus_size; /* in dwords */ |
| 144 | __le32 exponent_size; /* in dwords */ | 144 | __le32 exponent_size; /* in dwords */ |
| @@ -168,16 +168,6 @@ enum i2400m_brh { | |||
| 168 | }; | 168 | }; |
| 169 | 169 | ||
| 170 | 170 | ||
| 171 | /* Constants for bcf->module_id */ | ||
| 172 | enum i2400m_bcf_mod_id { | ||
| 173 | /* Firmware file carries its own pokes -- pokes are a set of | ||
| 174 | * magical values that have to be written in certain memory | ||
| 175 | * addresses to get the device up and ready for firmware | ||
| 176 | * download when it is in non-signed boot mode. */ | ||
| 177 | I2400M_BCF_MOD_ID_POKES = 0x000000001, | ||
| 178 | }; | ||
| 179 | |||
| 180 | |||
| 181 | /** | 171 | /** |
| 182 | * i2400m_bootrom_header - Header for a boot-mode command | 172 | * i2400m_bootrom_header - Header for a boot-mode command |
| 183 | * | 173 | * |
| @@ -276,6 +266,7 @@ enum { | |||
| 276 | I2400M_WARM_RESET_BARKER = 0x50f750f7, | 266 | I2400M_WARM_RESET_BARKER = 0x50f750f7, |
| 277 | I2400M_NBOOT_BARKER = 0xdeadbeef, | 267 | I2400M_NBOOT_BARKER = 0xdeadbeef, |
| 278 | I2400M_SBOOT_BARKER = 0x0ff1c1a1, | 268 | I2400M_SBOOT_BARKER = 0x0ff1c1a1, |
| 269 | I2400M_SBOOT_BARKER_6050 = 0x80000001, | ||
| 279 | I2400M_ACK_BARKER = 0xfeedbabe, | 270 | I2400M_ACK_BARKER = 0xfeedbabe, |
| 280 | I2400M_D2H_MSG_BARKER = 0xbeefbabe, | 271 | I2400M_D2H_MSG_BARKER = 0xbeefbabe, |
| 281 | }; | 272 | }; |
diff --git a/include/linux/workqueue.h b/include/linux/workqueue.h index cf24c20de9e4..9466e860d8c2 100644 --- a/include/linux/workqueue.h +++ b/include/linux/workqueue.h | |||
| @@ -25,6 +25,7 @@ typedef void (*work_func_t)(struct work_struct *work); | |||
| 25 | struct work_struct { | 25 | struct work_struct { |
| 26 | atomic_long_t data; | 26 | atomic_long_t data; |
| 27 | #define WORK_STRUCT_PENDING 0 /* T if work item pending execution */ | 27 | #define WORK_STRUCT_PENDING 0 /* T if work item pending execution */ |
| 28 | #define WORK_STRUCT_STATIC 1 /* static initializer (debugobjects) */ | ||
| 28 | #define WORK_STRUCT_FLAG_MASK (3UL) | 29 | #define WORK_STRUCT_FLAG_MASK (3UL) |
| 29 | #define WORK_STRUCT_WQ_DATA_MASK (~WORK_STRUCT_FLAG_MASK) | 30 | #define WORK_STRUCT_WQ_DATA_MASK (~WORK_STRUCT_FLAG_MASK) |
| 30 | struct list_head entry; | 31 | struct list_head entry; |
| @@ -35,6 +36,7 @@ struct work_struct { | |||
| 35 | }; | 36 | }; |
| 36 | 37 | ||
| 37 | #define WORK_DATA_INIT() ATOMIC_LONG_INIT(0) | 38 | #define WORK_DATA_INIT() ATOMIC_LONG_INIT(0) |
| 39 | #define WORK_DATA_STATIC_INIT() ATOMIC_LONG_INIT(2) | ||
| 38 | 40 | ||
| 39 | struct delayed_work { | 41 | struct delayed_work { |
| 40 | struct work_struct work; | 42 | struct work_struct work; |
| @@ -63,7 +65,7 @@ struct execute_work { | |||
| 63 | #endif | 65 | #endif |
| 64 | 66 | ||
| 65 | #define __WORK_INITIALIZER(n, f) { \ | 67 | #define __WORK_INITIALIZER(n, f) { \ |
| 66 | .data = WORK_DATA_INIT(), \ | 68 | .data = WORK_DATA_STATIC_INIT(), \ |
| 67 | .entry = { &(n).entry, &(n).entry }, \ | 69 | .entry = { &(n).entry, &(n).entry }, \ |
| 68 | .func = (f), \ | 70 | .func = (f), \ |
| 69 | __WORK_INIT_LOCKDEP_MAP(#n, &(n)) \ | 71 | __WORK_INIT_LOCKDEP_MAP(#n, &(n)) \ |
| @@ -91,6 +93,14 @@ struct execute_work { | |||
| 91 | #define PREPARE_DELAYED_WORK(_work, _func) \ | 93 | #define PREPARE_DELAYED_WORK(_work, _func) \ |
| 92 | PREPARE_WORK(&(_work)->work, (_func)) | 94 | PREPARE_WORK(&(_work)->work, (_func)) |
| 93 | 95 | ||
| 96 | #ifdef CONFIG_DEBUG_OBJECTS_WORK | ||
| 97 | extern void __init_work(struct work_struct *work, int onstack); | ||
| 98 | extern void destroy_work_on_stack(struct work_struct *work); | ||
| 99 | #else | ||
| 100 | static inline void __init_work(struct work_struct *work, int onstack) { } | ||
| 101 | static inline void destroy_work_on_stack(struct work_struct *work) { } | ||
| 102 | #endif | ||
| 103 | |||
| 94 | /* | 104 | /* |
| 95 | * initialize all of a work item in one go | 105 | * initialize all of a work item in one go |
| 96 | * | 106 | * |
| @@ -99,24 +109,36 @@ struct execute_work { | |||
| 99 | * to generate better code. | 109 | * to generate better code. |
| 100 | */ | 110 | */ |
| 101 | #ifdef CONFIG_LOCKDEP | 111 | #ifdef CONFIG_LOCKDEP |
| 102 | #define INIT_WORK(_work, _func) \ | 112 | #define __INIT_WORK(_work, _func, _onstack) \ |
| 103 | do { \ | 113 | do { \ |
| 104 | static struct lock_class_key __key; \ | 114 | static struct lock_class_key __key; \ |
| 105 | \ | 115 | \ |
| 116 | __init_work((_work), _onstack); \ | ||
| 106 | (_work)->data = (atomic_long_t) WORK_DATA_INIT(); \ | 117 | (_work)->data = (atomic_long_t) WORK_DATA_INIT(); \ |
| 107 | lockdep_init_map(&(_work)->lockdep_map, #_work, &__key, 0);\ | 118 | lockdep_init_map(&(_work)->lockdep_map, #_work, &__key, 0);\ |
| 108 | INIT_LIST_HEAD(&(_work)->entry); \ | 119 | INIT_LIST_HEAD(&(_work)->entry); \ |
| 109 | PREPARE_WORK((_work), (_func)); \ | 120 | PREPARE_WORK((_work), (_func)); \ |
| 110 | } while (0) | 121 | } while (0) |
| 111 | #else | 122 | #else |
| 112 | #define INIT_WORK(_work, _func) \ | 123 | #define __INIT_WORK(_work, _func, _onstack) \ |
| 113 | do { \ | 124 | do { \ |
| 125 | __init_work((_work), _onstack); \ | ||
| 114 | (_work)->data = (atomic_long_t) WORK_DATA_INIT(); \ | 126 | (_work)->data = (atomic_long_t) WORK_DATA_INIT(); \ |
| 115 | INIT_LIST_HEAD(&(_work)->entry); \ | 127 | INIT_LIST_HEAD(&(_work)->entry); \ |
| 116 | PREPARE_WORK((_work), (_func)); \ | 128 | PREPARE_WORK((_work), (_func)); \ |
| 117 | } while (0) | 129 | } while (0) |
| 118 | #endif | 130 | #endif |
| 119 | 131 | ||
| 132 | #define INIT_WORK(_work, _func) \ | ||
| 133 | do { \ | ||
| 134 | __INIT_WORK((_work), (_func), 0); \ | ||
| 135 | } while (0) | ||
| 136 | |||
| 137 | #define INIT_WORK_ON_STACK(_work, _func) \ | ||
| 138 | do { \ | ||
| 139 | __INIT_WORK((_work), (_func), 1); \ | ||
| 140 | } while (0) | ||
| 141 | |||
| 120 | #define INIT_DELAYED_WORK(_work, _func) \ | 142 | #define INIT_DELAYED_WORK(_work, _func) \ |
| 121 | do { \ | 143 | do { \ |
| 122 | INIT_WORK(&(_work)->work, (_func)); \ | 144 | INIT_WORK(&(_work)->work, (_func)); \ |
| @@ -125,22 +147,16 @@ struct execute_work { | |||
| 125 | 147 | ||
| 126 | #define INIT_DELAYED_WORK_ON_STACK(_work, _func) \ | 148 | #define INIT_DELAYED_WORK_ON_STACK(_work, _func) \ |
| 127 | do { \ | 149 | do { \ |
| 128 | INIT_WORK(&(_work)->work, (_func)); \ | 150 | INIT_WORK_ON_STACK(&(_work)->work, (_func)); \ |
| 129 | init_timer_on_stack(&(_work)->timer); \ | 151 | init_timer_on_stack(&(_work)->timer); \ |
| 130 | } while (0) | 152 | } while (0) |
| 131 | 153 | ||
| 132 | #define INIT_DELAYED_WORK_DEFERRABLE(_work, _func) \ | 154 | #define INIT_DELAYED_WORK_DEFERRABLE(_work, _func) \ |
| 133 | do { \ | 155 | do { \ |
| 134 | INIT_WORK(&(_work)->work, (_func)); \ | 156 | INIT_WORK(&(_work)->work, (_func)); \ |
| 135 | init_timer_deferrable(&(_work)->timer); \ | 157 | init_timer_deferrable(&(_work)->timer); \ |
| 136 | } while (0) | 158 | } while (0) |
| 137 | 159 | ||
| 138 | #define INIT_DELAYED_WORK_ON_STACK(_work, _func) \ | ||
| 139 | do { \ | ||
| 140 | INIT_WORK(&(_work)->work, (_func)); \ | ||
| 141 | init_timer_on_stack(&(_work)->timer); \ | ||
| 142 | } while (0) | ||
| 143 | |||
| 144 | /** | 160 | /** |
| 145 | * work_pending - Find out whether a work item is currently pending | 161 | * work_pending - Find out whether a work item is currently pending |
| 146 | * @work: The work item in question | 162 | * @work: The work item in question |
diff --git a/include/linux/writeback.h b/include/linux/writeback.h index 66ebddcff664..36520ded3e06 100644 --- a/include/linux/writeback.h +++ b/include/linux/writeback.h | |||
| @@ -34,6 +34,9 @@ struct writeback_control { | |||
| 34 | enum writeback_sync_modes sync_mode; | 34 | enum writeback_sync_modes sync_mode; |
| 35 | unsigned long *older_than_this; /* If !NULL, only write back inodes | 35 | unsigned long *older_than_this; /* If !NULL, only write back inodes |
| 36 | older than this */ | 36 | older than this */ |
| 37 | unsigned long wb_start; /* Time writeback_inodes_wb was | ||
| 38 | called. This is needed to avoid | ||
| 39 | extra jobs and livelock */ | ||
| 37 | long nr_to_write; /* Write this many pages, and decrement | 40 | long nr_to_write; /* Write this many pages, and decrement |
| 38 | this for each page written */ | 41 | this for each page written */ |
| 39 | long pages_skipped; /* Pages which were not written */ | 42 | long pages_skipped; /* Pages which were not written */ |
| @@ -49,6 +52,7 @@ struct writeback_control { | |||
| 49 | unsigned nonblocking:1; /* Don't get stuck on request queues */ | 52 | unsigned nonblocking:1; /* Don't get stuck on request queues */ |
| 50 | unsigned encountered_congestion:1; /* An output: a queue is full */ | 53 | unsigned encountered_congestion:1; /* An output: a queue is full */ |
| 51 | unsigned for_kupdate:1; /* A kupdate writeback */ | 54 | unsigned for_kupdate:1; /* A kupdate writeback */ |
| 55 | unsigned for_background:1; /* A background writeback */ | ||
| 52 | unsigned for_reclaim:1; /* Invoked from the page allocator */ | 56 | unsigned for_reclaim:1; /* Invoked from the page allocator */ |
| 53 | unsigned range_cyclic:1; /* range_start is cyclic */ | 57 | unsigned range_cyclic:1; /* range_start is cyclic */ |
| 54 | unsigned more_io:1; /* more io to be dispatched */ | 58 | unsigned more_io:1; /* more io to be dispatched */ |
| @@ -69,6 +73,7 @@ struct writeback_control { | |||
| 69 | struct bdi_writeback; | 73 | struct bdi_writeback; |
| 70 | int inode_wait(void *); | 74 | int inode_wait(void *); |
| 71 | void writeback_inodes_sb(struct super_block *); | 75 | void writeback_inodes_sb(struct super_block *); |
| 76 | int writeback_inodes_sb_if_idle(struct super_block *); | ||
| 72 | void sync_inodes_sb(struct super_block *); | 77 | void sync_inodes_sb(struct super_block *); |
| 73 | void writeback_inodes_wbc(struct writeback_control *wbc); | 78 | void writeback_inodes_wbc(struct writeback_control *wbc); |
| 74 | long wb_do_writeback(struct bdi_writeback *wb, int force_wait); | 79 | long wb_do_writeback(struct bdi_writeback *wb, int force_wait); |
| @@ -78,8 +83,7 @@ void wakeup_flusher_threads(long nr_pages); | |||
| 78 | static inline void wait_on_inode(struct inode *inode) | 83 | static inline void wait_on_inode(struct inode *inode) |
| 79 | { | 84 | { |
| 80 | might_sleep(); | 85 | might_sleep(); |
| 81 | wait_on_bit(&inode->i_state, __I_LOCK, inode_wait, | 86 | wait_on_bit(&inode->i_state, __I_NEW, inode_wait, TASK_UNINTERRUPTIBLE); |
| 82 | TASK_UNINTERRUPTIBLE); | ||
| 83 | } | 87 | } |
| 84 | static inline void inode_sync_wait(struct inode *inode) | 88 | static inline void inode_sync_wait(struct inode *inode) |
| 85 | { | 89 | { |
diff --git a/include/linux/x25.h b/include/linux/x25.h index d035e4e87d07..6450a7f12074 100644 --- a/include/linux/x25.h +++ b/include/linux/x25.h | |||
| @@ -25,6 +25,7 @@ | |||
| 25 | #define SIOCX25SENDCALLACCPT (SIOCPROTOPRIVATE + 9) | 25 | #define SIOCX25SENDCALLACCPT (SIOCPROTOPRIVATE + 9) |
| 26 | #define SIOCX25GDTEFACILITIES (SIOCPROTOPRIVATE + 10) | 26 | #define SIOCX25GDTEFACILITIES (SIOCPROTOPRIVATE + 10) |
| 27 | #define SIOCX25SDTEFACILITIES (SIOCPROTOPRIVATE + 11) | 27 | #define SIOCX25SDTEFACILITIES (SIOCPROTOPRIVATE + 11) |
| 28 | #define SIOCX25SCAUSEDIAG (SIOCPROTOPRIVATE + 12) | ||
| 28 | 29 | ||
| 29 | /* | 30 | /* |
| 30 | * Values for {get,set}sockopt. | 31 | * Values for {get,set}sockopt. |
diff --git a/include/linux/xattr.h b/include/linux/xattr.h index 5c84af8c5f6f..fb9b7e6e1e2d 100644 --- a/include/linux/xattr.h +++ b/include/linux/xattr.h | |||
| @@ -38,12 +38,13 @@ struct dentry; | |||
| 38 | 38 | ||
| 39 | struct xattr_handler { | 39 | struct xattr_handler { |
| 40 | char *prefix; | 40 | char *prefix; |
| 41 | size_t (*list)(struct inode *inode, char *list, size_t list_size, | 41 | int flags; /* fs private flags passed back to the handlers */ |
| 42 | const char *name, size_t name_len); | 42 | size_t (*list)(struct dentry *dentry, char *list, size_t list_size, |
| 43 | int (*get)(struct inode *inode, const char *name, void *buffer, | 43 | const char *name, size_t name_len, int handler_flags); |
| 44 | size_t size); | 44 | int (*get)(struct dentry *dentry, const char *name, void *buffer, |
| 45 | int (*set)(struct inode *inode, const char *name, const void *buffer, | 45 | size_t size, int handler_flags); |
| 46 | size_t size, int flags); | 46 | int (*set)(struct dentry *dentry, const char *name, const void *buffer, |
| 47 | size_t size, int flags, int handler_flags); | ||
| 47 | }; | 48 | }; |
| 48 | 49 | ||
| 49 | ssize_t xattr_getsecurity(struct inode *, const char *, void *, size_t); | 50 | ssize_t xattr_getsecurity(struct inode *, const char *, void *, size_t); |
diff --git a/include/linux/xfrm.h b/include/linux/xfrm.h index 2d4ec15abaca..b971e3848493 100644 --- a/include/linux/xfrm.h +++ b/include/linux/xfrm.h | |||
| @@ -10,8 +10,7 @@ | |||
| 10 | /* Structure to encapsulate addresses. I do not want to use | 10 | /* Structure to encapsulate addresses. I do not want to use |
| 11 | * "standard" structure. My apologies. | 11 | * "standard" structure. My apologies. |
| 12 | */ | 12 | */ |
| 13 | typedef union | 13 | typedef union { |
| 14 | { | ||
| 15 | __be32 a4; | 14 | __be32 a4; |
| 16 | __be32 a6[4]; | 15 | __be32 a6[4]; |
| 17 | } xfrm_address_t; | 16 | } xfrm_address_t; |
| @@ -20,8 +19,7 @@ typedef union | |||
| 20 | * the state by (spi,daddr,ah/esp) or to store information about | 19 | * the state by (spi,daddr,ah/esp) or to store information about |
| 21 | * spi, protocol and tunnel address on output. | 20 | * spi, protocol and tunnel address on output. |
| 22 | */ | 21 | */ |
| 23 | struct xfrm_id | 22 | struct xfrm_id { |
| 24 | { | ||
| 25 | xfrm_address_t daddr; | 23 | xfrm_address_t daddr; |
| 26 | __be32 spi; | 24 | __be32 spi; |
| 27 | __u8 proto; | 25 | __u8 proto; |
| @@ -45,8 +43,7 @@ struct xfrm_sec_ctx { | |||
| 45 | 43 | ||
| 46 | /* Selector, used as selector both on policy rules (SPD) and SAs. */ | 44 | /* Selector, used as selector both on policy rules (SPD) and SAs. */ |
| 47 | 45 | ||
| 48 | struct xfrm_selector | 46 | struct xfrm_selector { |
| 49 | { | ||
| 50 | xfrm_address_t daddr; | 47 | xfrm_address_t daddr; |
| 51 | xfrm_address_t saddr; | 48 | xfrm_address_t saddr; |
| 52 | __be16 dport; | 49 | __be16 dport; |
| @@ -63,8 +60,7 @@ struct xfrm_selector | |||
| 63 | 60 | ||
| 64 | #define XFRM_INF (~(__u64)0) | 61 | #define XFRM_INF (~(__u64)0) |
| 65 | 62 | ||
| 66 | struct xfrm_lifetime_cfg | 63 | struct xfrm_lifetime_cfg { |
| 67 | { | ||
| 68 | __u64 soft_byte_limit; | 64 | __u64 soft_byte_limit; |
| 69 | __u64 hard_byte_limit; | 65 | __u64 hard_byte_limit; |
| 70 | __u64 soft_packet_limit; | 66 | __u64 soft_packet_limit; |
| @@ -75,16 +71,14 @@ struct xfrm_lifetime_cfg | |||
| 75 | __u64 hard_use_expires_seconds; | 71 | __u64 hard_use_expires_seconds; |
| 76 | }; | 72 | }; |
| 77 | 73 | ||
| 78 | struct xfrm_lifetime_cur | 74 | struct xfrm_lifetime_cur { |
| 79 | { | ||
| 80 | __u64 bytes; | 75 | __u64 bytes; |
| 81 | __u64 packets; | 76 | __u64 packets; |
| 82 | __u64 add_time; | 77 | __u64 add_time; |
| 83 | __u64 use_time; | 78 | __u64 use_time; |
| 84 | }; | 79 | }; |
| 85 | 80 | ||
| 86 | struct xfrm_replay_state | 81 | struct xfrm_replay_state { |
| 87 | { | ||
| 88 | __u32 oseq; | 82 | __u32 oseq; |
| 89 | __u32 seq; | 83 | __u32 seq; |
| 90 | __u32 bitmap; | 84 | __u32 bitmap; |
| @@ -96,6 +90,13 @@ struct xfrm_algo { | |||
| 96 | char alg_key[0]; | 90 | char alg_key[0]; |
| 97 | }; | 91 | }; |
| 98 | 92 | ||
| 93 | struct xfrm_algo_auth { | ||
| 94 | char alg_name[64]; | ||
| 95 | unsigned int alg_key_len; /* in bits */ | ||
| 96 | unsigned int alg_trunc_len; /* in bits */ | ||
| 97 | char alg_key[0]; | ||
| 98 | }; | ||
| 99 | |||
| 99 | struct xfrm_algo_aead { | 100 | struct xfrm_algo_aead { |
| 100 | char alg_name[64]; | 101 | char alg_name[64]; |
| 101 | unsigned int alg_key_len; /* in bits */ | 102 | unsigned int alg_key_len; /* in bits */ |
| @@ -109,16 +110,14 @@ struct xfrm_stats { | |||
| 109 | __u32 integrity_failed; | 110 | __u32 integrity_failed; |
| 110 | }; | 111 | }; |
| 111 | 112 | ||
| 112 | enum | 113 | enum { |
| 113 | { | ||
| 114 | XFRM_POLICY_TYPE_MAIN = 0, | 114 | XFRM_POLICY_TYPE_MAIN = 0, |
| 115 | XFRM_POLICY_TYPE_SUB = 1, | 115 | XFRM_POLICY_TYPE_SUB = 1, |
| 116 | XFRM_POLICY_TYPE_MAX = 2, | 116 | XFRM_POLICY_TYPE_MAX = 2, |
| 117 | XFRM_POLICY_TYPE_ANY = 255 | 117 | XFRM_POLICY_TYPE_ANY = 255 |
| 118 | }; | 118 | }; |
| 119 | 119 | ||
| 120 | enum | 120 | enum { |
| 121 | { | ||
| 122 | XFRM_POLICY_IN = 0, | 121 | XFRM_POLICY_IN = 0, |
| 123 | XFRM_POLICY_OUT = 1, | 122 | XFRM_POLICY_OUT = 1, |
| 124 | XFRM_POLICY_FWD = 2, | 123 | XFRM_POLICY_FWD = 2, |
| @@ -126,8 +125,7 @@ enum | |||
| 126 | XFRM_POLICY_MAX = 3 | 125 | XFRM_POLICY_MAX = 3 |
| 127 | }; | 126 | }; |
| 128 | 127 | ||
| 129 | enum | 128 | enum { |
| 130 | { | ||
| 131 | XFRM_SHARE_ANY, /* No limitations */ | 129 | XFRM_SHARE_ANY, /* No limitations */ |
| 132 | XFRM_SHARE_SESSION, /* For this session only */ | 130 | XFRM_SHARE_SESSION, /* For this session only */ |
| 133 | XFRM_SHARE_USER, /* For this user only */ | 131 | XFRM_SHARE_USER, /* For this user only */ |
| @@ -269,8 +267,8 @@ enum xfrm_attr_type_t { | |||
| 269 | XFRMA_ALG_COMP, /* struct xfrm_algo */ | 267 | XFRMA_ALG_COMP, /* struct xfrm_algo */ |
| 270 | XFRMA_ENCAP, /* struct xfrm_algo + struct xfrm_encap_tmpl */ | 268 | XFRMA_ENCAP, /* struct xfrm_algo + struct xfrm_encap_tmpl */ |
| 271 | XFRMA_TMPL, /* 1 or more struct xfrm_user_tmpl */ | 269 | XFRMA_TMPL, /* 1 or more struct xfrm_user_tmpl */ |
| 272 | XFRMA_SA, | 270 | XFRMA_SA, /* struct xfrm_usersa_info */ |
| 273 | XFRMA_POLICY, | 271 | XFRMA_POLICY, /*struct xfrm_userpolicy_info */ |
| 274 | XFRMA_SEC_CTX, /* struct xfrm_sec_ctx */ | 272 | XFRMA_SEC_CTX, /* struct xfrm_sec_ctx */ |
| 275 | XFRMA_LTIME_VAL, | 273 | XFRMA_LTIME_VAL, |
| 276 | XFRMA_REPLAY_VAL, | 274 | XFRMA_REPLAY_VAL, |
| @@ -278,16 +276,23 @@ enum xfrm_attr_type_t { | |||
| 278 | XFRMA_ETIMER_THRESH, | 276 | XFRMA_ETIMER_THRESH, |
| 279 | XFRMA_SRCADDR, /* xfrm_address_t */ | 277 | XFRMA_SRCADDR, /* xfrm_address_t */ |
| 280 | XFRMA_COADDR, /* xfrm_address_t */ | 278 | XFRMA_COADDR, /* xfrm_address_t */ |
| 281 | XFRMA_LASTUSED, | 279 | XFRMA_LASTUSED, /* unsigned long */ |
| 282 | XFRMA_POLICY_TYPE, /* struct xfrm_userpolicy_type */ | 280 | XFRMA_POLICY_TYPE, /* struct xfrm_userpolicy_type */ |
| 283 | XFRMA_MIGRATE, | 281 | XFRMA_MIGRATE, |
| 284 | XFRMA_ALG_AEAD, /* struct xfrm_algo_aead */ | 282 | XFRMA_ALG_AEAD, /* struct xfrm_algo_aead */ |
| 285 | XFRMA_KMADDRESS, /* struct xfrm_user_kmaddress */ | 283 | XFRMA_KMADDRESS, /* struct xfrm_user_kmaddress */ |
| 284 | XFRMA_ALG_AUTH_TRUNC, /* struct xfrm_algo_auth */ | ||
| 285 | XFRMA_MARK, /* struct xfrm_mark */ | ||
| 286 | __XFRMA_MAX | 286 | __XFRMA_MAX |
| 287 | 287 | ||
| 288 | #define XFRMA_MAX (__XFRMA_MAX - 1) | 288 | #define XFRMA_MAX (__XFRMA_MAX - 1) |
| 289 | }; | 289 | }; |
| 290 | 290 | ||
| 291 | struct xfrm_mark { | ||
| 292 | __u32 v; /* value */ | ||
| 293 | __u32 m; /* mask */ | ||
| 294 | }; | ||
| 295 | |||
| 291 | enum xfrm_sadattr_type_t { | 296 | enum xfrm_sadattr_type_t { |
| 292 | XFRMA_SAD_UNSPEC, | 297 | XFRMA_SAD_UNSPEC, |
| 293 | XFRMA_SAD_CNT, | 298 | XFRMA_SAD_CNT, |
diff --git a/include/litmus/fdso.h b/include/litmus/fdso.h index 286e10f86de0..61f1b5baf42c 100644 --- a/include/litmus/fdso.h +++ b/include/litmus/fdso.h | |||
| @@ -10,6 +10,7 @@ | |||
| 10 | #include <asm/atomic.h> | 10 | #include <asm/atomic.h> |
| 11 | 11 | ||
| 12 | #include <linux/fs.h> | 12 | #include <linux/fs.h> |
| 13 | #include <linux/slab.h> | ||
| 13 | 14 | ||
| 14 | #define MAX_OBJECT_DESCRIPTORS 32 | 15 | #define MAX_OBJECT_DESCRIPTORS 32 |
| 15 | 16 | ||
diff --git a/include/litmus/rt_domain.h b/include/litmus/rt_domain.h index b452be1d2256..9bf980713474 100644 --- a/include/litmus/rt_domain.h +++ b/include/litmus/rt_domain.h | |||
| @@ -22,16 +22,16 @@ struct release_queue { | |||
| 22 | 22 | ||
| 23 | typedef struct _rt_domain { | 23 | typedef struct _rt_domain { |
| 24 | /* runnable rt tasks are in here */ | 24 | /* runnable rt tasks are in here */ |
| 25 | spinlock_t ready_lock; | 25 | raw_spinlock_t ready_lock; |
| 26 | struct bheap ready_queue; | 26 | struct bheap ready_queue; |
| 27 | 27 | ||
| 28 | /* real-time tasks waiting for release are in here */ | 28 | /* real-time tasks waiting for release are in here */ |
| 29 | spinlock_t release_lock; | 29 | raw_spinlock_t release_lock; |
| 30 | struct release_queue release_queue; | 30 | struct release_queue release_queue; |
| 31 | int release_master; | 31 | int release_master; |
| 32 | 32 | ||
| 33 | /* for moving tasks to the release queue */ | 33 | /* for moving tasks to the release queue */ |
| 34 | spinlock_t tobe_lock; | 34 | raw_spinlock_t tobe_lock; |
| 35 | struct list_head tobe_released; | 35 | struct list_head tobe_released; |
| 36 | 36 | ||
| 37 | /* how do we check if we need to kick another CPU? */ | 37 | /* how do we check if we need to kick another CPU? */ |
| @@ -109,17 +109,17 @@ static inline void add_ready(rt_domain_t* rt, struct task_struct *new) | |||
| 109 | { | 109 | { |
| 110 | unsigned long flags; | 110 | unsigned long flags; |
| 111 | /* first we need the write lock for rt_ready_queue */ | 111 | /* first we need the write lock for rt_ready_queue */ |
| 112 | spin_lock_irqsave(&rt->ready_lock, flags); | 112 | raw_spin_lock_irqsave(&rt->ready_lock, flags); |
| 113 | __add_ready(rt, new); | 113 | __add_ready(rt, new); |
| 114 | spin_unlock_irqrestore(&rt->ready_lock, flags); | 114 | raw_spin_unlock_irqrestore(&rt->ready_lock, flags); |
| 115 | } | 115 | } |
| 116 | 116 | ||
| 117 | static inline void merge_ready(rt_domain_t* rt, struct bheap* tasks) | 117 | static inline void merge_ready(rt_domain_t* rt, struct bheap* tasks) |
| 118 | { | 118 | { |
| 119 | unsigned long flags; | 119 | unsigned long flags; |
| 120 | spin_lock_irqsave(&rt->ready_lock, flags); | 120 | raw_spin_lock_irqsave(&rt->ready_lock, flags); |
| 121 | __merge_ready(rt, tasks); | 121 | __merge_ready(rt, tasks); |
| 122 | spin_unlock_irqrestore(&rt->ready_lock, flags); | 122 | raw_spin_unlock_irqrestore(&rt->ready_lock, flags); |
| 123 | } | 123 | } |
| 124 | 124 | ||
| 125 | static inline struct task_struct* take_ready(rt_domain_t* rt) | 125 | static inline struct task_struct* take_ready(rt_domain_t* rt) |
| @@ -127,9 +127,9 @@ static inline struct task_struct* take_ready(rt_domain_t* rt) | |||
| 127 | unsigned long flags; | 127 | unsigned long flags; |
| 128 | struct task_struct* ret; | 128 | struct task_struct* ret; |
| 129 | /* first we need the write lock for rt_ready_queue */ | 129 | /* first we need the write lock for rt_ready_queue */ |
| 130 | spin_lock_irqsave(&rt->ready_lock, flags); | 130 | raw_spin_lock_irqsave(&rt->ready_lock, flags); |
| 131 | ret = __take_ready(rt); | 131 | ret = __take_ready(rt); |
| 132 | spin_unlock_irqrestore(&rt->ready_lock, flags); | 132 | raw_spin_unlock_irqrestore(&rt->ready_lock, flags); |
| 133 | return ret; | 133 | return ret; |
| 134 | } | 134 | } |
| 135 | 135 | ||
| @@ -138,9 +138,9 @@ static inline void add_release(rt_domain_t* rt, struct task_struct *task) | |||
| 138 | { | 138 | { |
| 139 | unsigned long flags; | 139 | unsigned long flags; |
| 140 | /* first we need the write lock for rt_ready_queue */ | 140 | /* first we need the write lock for rt_ready_queue */ |
| 141 | spin_lock_irqsave(&rt->tobe_lock, flags); | 141 | raw_spin_lock_irqsave(&rt->tobe_lock, flags); |
| 142 | __add_release(rt, task); | 142 | __add_release(rt, task); |
| 143 | spin_unlock_irqrestore(&rt->tobe_lock, flags); | 143 | raw_spin_unlock_irqrestore(&rt->tobe_lock, flags); |
| 144 | } | 144 | } |
| 145 | 145 | ||
| 146 | static inline int __jobs_pending(rt_domain_t* rt) | 146 | static inline int __jobs_pending(rt_domain_t* rt) |
| @@ -153,9 +153,9 @@ static inline int jobs_pending(rt_domain_t* rt) | |||
| 153 | unsigned long flags; | 153 | unsigned long flags; |
| 154 | int ret; | 154 | int ret; |
| 155 | /* first we need the write lock for rt_ready_queue */ | 155 | /* first we need the write lock for rt_ready_queue */ |
| 156 | spin_lock_irqsave(&rt->ready_lock, flags); | 156 | raw_spin_lock_irqsave(&rt->ready_lock, flags); |
| 157 | ret = !bheap_empty(&rt->ready_queue); | 157 | ret = !bheap_empty(&rt->ready_queue); |
| 158 | spin_unlock_irqrestore(&rt->ready_lock, flags); | 158 | raw_spin_unlock_irqrestore(&rt->ready_lock, flags); |
| 159 | return ret; | 159 | return ret; |
| 160 | } | 160 | } |
| 161 | 161 | ||
diff --git a/include/math-emu/op-common.h b/include/math-emu/op-common.h index f456534dcaf9..fd882261225e 100644 --- a/include/math-emu/op-common.h +++ b/include/math-emu/op-common.h | |||
| @@ -29,7 +29,7 @@ | |||
| 29 | _FP_FRAC_DECL_##wc(X) | 29 | _FP_FRAC_DECL_##wc(X) |
| 30 | 30 | ||
| 31 | /* | 31 | /* |
| 32 | * Finish truely unpacking a native fp value by classifying the kind | 32 | * Finish truly unpacking a native fp value by classifying the kind |
| 33 | * of fp value and normalizing both the exponent and the fraction. | 33 | * of fp value and normalizing both the exponent and the fraction. |
| 34 | */ | 34 | */ |
| 35 | 35 | ||
diff --git a/include/media/cx25840.h b/include/media/cx25840.h index 2c3fbaa33f74..0b0cb1776796 100644 --- a/include/media/cx25840.h +++ b/include/media/cx25840.h | |||
| @@ -84,6 +84,7 @@ enum cx25840_video_input { | |||
| 84 | CX25840_NONE0_CH3 = 0x80000080, | 84 | CX25840_NONE0_CH3 = 0x80000080, |
| 85 | CX25840_NONE1_CH3 = 0x800000c0, | 85 | CX25840_NONE1_CH3 = 0x800000c0, |
| 86 | CX25840_SVIDEO_ON = 0x80000100, | 86 | CX25840_SVIDEO_ON = 0x80000100, |
| 87 | CX25840_COMPONENT_ON = 0x80000200, | ||
| 87 | }; | 88 | }; |
| 88 | 89 | ||
| 89 | enum cx25840_audio_input { | 90 | enum cx25840_audio_input { |
diff --git a/include/media/davinci/isif.h b/include/media/davinci/isif.h new file mode 100644 index 000000000000..b0b74ad618cc --- /dev/null +++ b/include/media/davinci/isif.h | |||
| @@ -0,0 +1,531 @@ | |||
| 1 | /* | ||
| 2 | * Copyright (C) 2008-2009 Texas Instruments Inc | ||
| 3 | * | ||
| 4 | * This program is free software; you can redistribute it and/or modify | ||
| 5 | * it under the terms of the GNU General Public License as published by | ||
| 6 | * the Free Software Foundation; either version 2 of the License, or | ||
| 7 | * (at your option) any later version. | ||
| 8 | * | ||
| 9 | * This program is distributed in the hope that it will be useful, | ||
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 12 | * GNU General Public License for more details. | ||
| 13 | * | ||
| 14 | * You should have received a copy of the GNU General Public License | ||
| 15 | * along with this program; if not, write to the Free Software | ||
| 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
| 17 | * | ||
| 18 | * isif header file | ||
| 19 | */ | ||
| 20 | #ifndef _ISIF_H | ||
| 21 | #define _ISIF_H | ||
| 22 | |||
| 23 | #include <media/davinci/ccdc_types.h> | ||
| 24 | #include <media/davinci/vpfe_types.h> | ||
| 25 | |||
| 26 | /* isif float type S8Q8/U8Q8 */ | ||
| 27 | struct isif_float_8 { | ||
| 28 | /* 8 bit integer part */ | ||
| 29 | __u8 integer; | ||
| 30 | /* 8 bit decimal part */ | ||
| 31 | __u8 decimal; | ||
| 32 | }; | ||
| 33 | |||
| 34 | /* isif float type U16Q16/S16Q16 */ | ||
| 35 | struct isif_float_16 { | ||
| 36 | /* 16 bit integer part */ | ||
| 37 | __u16 integer; | ||
| 38 | /* 16 bit decimal part */ | ||
| 39 | __u16 decimal; | ||
| 40 | }; | ||
| 41 | |||
| 42 | /************************************************************************ | ||
| 43 | * Vertical Defect Correction parameters | ||
| 44 | ***********************************************************************/ | ||
| 45 | /* Defect Correction (DFC) table entry */ | ||
| 46 | struct isif_vdfc_entry { | ||
| 47 | /* vertical position of defect */ | ||
| 48 | __u16 pos_vert; | ||
| 49 | /* horizontal position of defect */ | ||
| 50 | __u16 pos_horz; | ||
| 51 | /* | ||
| 52 | * Defect level of Vertical line defect position. This is subtracted | ||
| 53 | * from the data at the defect position | ||
| 54 | */ | ||
| 55 | __u8 level_at_pos; | ||
| 56 | /* | ||
| 57 | * Defect level of the pixels upper than the vertical line defect. | ||
| 58 | * This is subtracted from the data | ||
| 59 | */ | ||
| 60 | __u8 level_up_pixels; | ||
| 61 | /* | ||
| 62 | * Defect level of the pixels lower than the vertical line defect. | ||
| 63 | * This is subtracted from the data | ||
| 64 | */ | ||
| 65 | __u8 level_low_pixels; | ||
| 66 | }; | ||
| 67 | |||
| 68 | #define ISIF_VDFC_TABLE_SIZE 8 | ||
| 69 | struct isif_dfc { | ||
| 70 | /* enable vertical defect correction */ | ||
| 71 | __u8 en; | ||
| 72 | /* Defect level subtraction. Just fed through if saturating */ | ||
| 73 | #define ISIF_VDFC_NORMAL 0 | ||
| 74 | /* | ||
| 75 | * Defect level subtraction. Horizontal interpolation ((i-2)+(i+2))/2 | ||
| 76 | * if data saturating | ||
| 77 | */ | ||
| 78 | #define ISIF_VDFC_HORZ_INTERPOL_IF_SAT 1 | ||
| 79 | /* Horizontal interpolation (((i-2)+(i+2))/2) */ | ||
| 80 | #define ISIF_VDFC_HORZ_INTERPOL 2 | ||
| 81 | /* one of the vertical defect correction modes above */ | ||
| 82 | __u8 corr_mode; | ||
| 83 | /* 0 - whole line corrected, 1 - not pixels upper than the defect */ | ||
| 84 | __u8 corr_whole_line; | ||
| 85 | #define ISIF_VDFC_NO_SHIFT 0 | ||
| 86 | #define ISIF_VDFC_SHIFT_1 1 | ||
| 87 | #define ISIF_VDFC_SHIFT_2 2 | ||
| 88 | #define ISIF_VDFC_SHIFT_3 3 | ||
| 89 | #define ISIF_VDFC_SHIFT_4 4 | ||
| 90 | /* | ||
| 91 | * defect level shift value. level_at_pos, level_upper_pos, | ||
| 92 | * and level_lower_pos can be shifted up by this value. Choose | ||
| 93 | * one of the values above | ||
| 94 | */ | ||
| 95 | __u8 def_level_shift; | ||
| 96 | /* defect saturation level */ | ||
| 97 | __u16 def_sat_level; | ||
| 98 | /* number of vertical defects. Max is ISIF_VDFC_TABLE_SIZE */ | ||
| 99 | __u16 num_vdefects; | ||
| 100 | /* VDFC table ptr */ | ||
| 101 | struct isif_vdfc_entry table[ISIF_VDFC_TABLE_SIZE]; | ||
| 102 | }; | ||
| 103 | |||
| 104 | struct isif_horz_bclamp { | ||
| 105 | |||
| 106 | /* Horizontal clamp disabled. Only vertical clamp value is subtracted */ | ||
| 107 | #define ISIF_HORZ_BC_DISABLE 0 | ||
| 108 | /* | ||
| 109 | * Horizontal clamp value is calculated and subtracted from image data | ||
| 110 | * along with vertical clamp value | ||
| 111 | */ | ||
| 112 | #define ISIF_HORZ_BC_CLAMP_CALC_ENABLED 1 | ||
| 113 | /* | ||
| 114 | * Horizontal clamp value calculated from previous image is subtracted | ||
| 115 | * from image data along with vertical clamp value. | ||
| 116 | */ | ||
| 117 | #define ISIF_HORZ_BC_CLAMP_NOT_UPDATED 2 | ||
| 118 | /* horizontal clamp mode. One of the values above */ | ||
| 119 | __u8 mode; | ||
| 120 | /* | ||
| 121 | * pixel value limit enable. | ||
| 122 | * 0 - limit disabled | ||
| 123 | * 1 - pixel value limited to 1023 | ||
| 124 | */ | ||
| 125 | __u8 clamp_pix_limit; | ||
| 126 | /* Select Most left window for bc calculation */ | ||
| 127 | #define ISIF_SEL_MOST_LEFT_WIN 0 | ||
| 128 | /* Select Most right window for bc calculation */ | ||
| 129 | #define ISIF_SEL_MOST_RIGHT_WIN 1 | ||
| 130 | /* Select most left or right window for clamp val calculation */ | ||
| 131 | __u8 base_win_sel_calc; | ||
| 132 | /* Window count per color for calculation. range 1-32 */ | ||
| 133 | __u8 win_count_calc; | ||
| 134 | /* Window start position - horizontal for calculation. 0 - 8191 */ | ||
| 135 | __u16 win_start_h_calc; | ||
| 136 | /* Window start position - vertical for calculation 0 - 8191 */ | ||
| 137 | __u16 win_start_v_calc; | ||
| 138 | #define ISIF_HORZ_BC_SZ_H_2PIXELS 0 | ||
| 139 | #define ISIF_HORZ_BC_SZ_H_4PIXELS 1 | ||
| 140 | #define ISIF_HORZ_BC_SZ_H_8PIXELS 2 | ||
| 141 | #define ISIF_HORZ_BC_SZ_H_16PIXELS 3 | ||
| 142 | /* Width of the sample window in pixels for calculation */ | ||
| 143 | __u8 win_h_sz_calc; | ||
| 144 | #define ISIF_HORZ_BC_SZ_V_32PIXELS 0 | ||
| 145 | #define ISIF_HORZ_BC_SZ_V_64PIXELS 1 | ||
| 146 | #define ISIF_HORZ_BC_SZ_V_128PIXELS 2 | ||
| 147 | #define ISIF_HORZ_BC_SZ_V_256PIXELS 3 | ||
| 148 | /* Height of the sample window in pixels for calculation */ | ||
| 149 | __u8 win_v_sz_calc; | ||
| 150 | }; | ||
| 151 | |||
| 152 | /************************************************************************ | ||
| 153 | * Black Clamp parameters | ||
| 154 | ***********************************************************************/ | ||
| 155 | struct isif_vert_bclamp { | ||
| 156 | /* Reset value used is the clamp value calculated */ | ||
| 157 | #define ISIF_VERT_BC_USE_HORZ_CLAMP_VAL 0 | ||
| 158 | /* Reset value used is reset_clamp_val configured */ | ||
| 159 | #define ISIF_VERT_BC_USE_CONFIG_CLAMP_VAL 1 | ||
| 160 | /* No update, previous image value is used */ | ||
| 161 | #define ISIF_VERT_BC_NO_UPDATE 2 | ||
| 162 | /* | ||
| 163 | * Reset value selector for vertical clamp calculation. Use one of | ||
| 164 | * the above values | ||
| 165 | */ | ||
| 166 | __u8 reset_val_sel; | ||
| 167 | /* U8Q8. Line average coefficient used in vertical clamp calculation */ | ||
| 168 | __u8 line_ave_coef; | ||
| 169 | /* Height of the optical black region for calculation */ | ||
| 170 | __u16 ob_v_sz_calc; | ||
| 171 | /* Optical black region start position - horizontal. 0 - 8191 */ | ||
| 172 | __u16 ob_start_h; | ||
| 173 | /* Optical black region start position - vertical 0 - 8191 */ | ||
| 174 | __u16 ob_start_v; | ||
| 175 | }; | ||
| 176 | |||
| 177 | struct isif_black_clamp { | ||
| 178 | /* | ||
| 179 | * This offset value is added irrespective of the clamp enable status. | ||
| 180 | * S13 | ||
| 181 | */ | ||
| 182 | __u16 dc_offset; | ||
| 183 | /* | ||
| 184 | * Enable black/digital clamp value to be subtracted from the image data | ||
| 185 | */ | ||
| 186 | __u8 en; | ||
| 187 | /* | ||
| 188 | * black clamp mode. same/separate clamp for 4 colors | ||
| 189 | * 0 - disable - same clamp value for all colors | ||
| 190 | * 1 - clamp value calculated separately for all colors | ||
| 191 | */ | ||
| 192 | __u8 bc_mode_color; | ||
| 193 | /* Vrtical start position for bc subtraction */ | ||
| 194 | __u16 vert_start_sub; | ||
| 195 | /* Black clamp for horizontal direction */ | ||
| 196 | struct isif_horz_bclamp horz; | ||
| 197 | /* Black clamp for vertical direction */ | ||
| 198 | struct isif_vert_bclamp vert; | ||
| 199 | }; | ||
| 200 | |||
| 201 | /************************************************************************* | ||
| 202 | ** Color Space Convertion (CSC) | ||
| 203 | *************************************************************************/ | ||
| 204 | #define ISIF_CSC_NUM_COEFF 16 | ||
| 205 | struct isif_color_space_conv { | ||
| 206 | /* Enable color space conversion */ | ||
| 207 | __u8 en; | ||
| 208 | /* | ||
| 209 | * csc coeffient table. S8Q5, M00 at index 0, M01 at index 1, and | ||
| 210 | * so forth | ||
| 211 | */ | ||
| 212 | struct isif_float_8 coeff[ISIF_CSC_NUM_COEFF]; | ||
| 213 | }; | ||
| 214 | |||
| 215 | |||
| 216 | /************************************************************************* | ||
| 217 | ** Black Compensation parameters | ||
| 218 | *************************************************************************/ | ||
| 219 | struct isif_black_comp { | ||
| 220 | /* Comp for Red */ | ||
| 221 | __s8 r_comp; | ||
| 222 | /* Comp for Gr */ | ||
| 223 | __s8 gr_comp; | ||
| 224 | /* Comp for Blue */ | ||
| 225 | __s8 b_comp; | ||
| 226 | /* Comp for Gb */ | ||
| 227 | __s8 gb_comp; | ||
| 228 | }; | ||
| 229 | |||
| 230 | /************************************************************************* | ||
| 231 | ** Gain parameters | ||
| 232 | *************************************************************************/ | ||
| 233 | struct isif_gain { | ||
| 234 | /* Gain for Red or ye */ | ||
| 235 | struct isif_float_16 r_ye; | ||
| 236 | /* Gain for Gr or cy */ | ||
| 237 | struct isif_float_16 gr_cy; | ||
| 238 | /* Gain for Gb or g */ | ||
| 239 | struct isif_float_16 gb_g; | ||
| 240 | /* Gain for Blue or mg */ | ||
| 241 | struct isif_float_16 b_mg; | ||
| 242 | }; | ||
| 243 | |||
| 244 | #define ISIF_LINEAR_TAB_SIZE 192 | ||
| 245 | /************************************************************************* | ||
| 246 | ** Linearization parameters | ||
| 247 | *************************************************************************/ | ||
| 248 | struct isif_linearize { | ||
| 249 | /* Enable or Disable linearization of data */ | ||
| 250 | __u8 en; | ||
| 251 | /* Shift value applied */ | ||
| 252 | __u8 corr_shft; | ||
| 253 | /* scale factor applied U11Q10 */ | ||
| 254 | struct isif_float_16 scale_fact; | ||
| 255 | /* Size of the linear table */ | ||
| 256 | __u16 table[ISIF_LINEAR_TAB_SIZE]; | ||
| 257 | }; | ||
| 258 | |||
| 259 | /* Color patterns */ | ||
| 260 | #define ISIF_RED 0 | ||
| 261 | #define ISIF_GREEN_RED 1 | ||
| 262 | #define ISIF_GREEN_BLUE 2 | ||
| 263 | #define ISIF_BLUE 3 | ||
| 264 | struct isif_col_pat { | ||
| 265 | __u8 olop; | ||
| 266 | __u8 olep; | ||
| 267 | __u8 elop; | ||
| 268 | __u8 elep; | ||
| 269 | }; | ||
| 270 | |||
| 271 | /************************************************************************* | ||
| 272 | ** Data formatter parameters | ||
| 273 | *************************************************************************/ | ||
| 274 | struct isif_fmtplen { | ||
| 275 | /* | ||
| 276 | * number of program entries for SET0, range 1 - 16 | ||
| 277 | * when fmtmode is ISIF_SPLIT, 1 - 8 when fmtmode is | ||
| 278 | * ISIF_COMBINE | ||
| 279 | */ | ||
| 280 | __u16 plen0; | ||
| 281 | /* | ||
| 282 | * number of program entries for SET1, range 1 - 16 | ||
| 283 | * when fmtmode is ISIF_SPLIT, 1 - 8 when fmtmode is | ||
| 284 | * ISIF_COMBINE | ||
| 285 | */ | ||
| 286 | __u16 plen1; | ||
| 287 | /** | ||
| 288 | * number of program entries for SET2, range 1 - 16 | ||
| 289 | * when fmtmode is ISIF_SPLIT, 1 - 8 when fmtmode is | ||
| 290 | * ISIF_COMBINE | ||
| 291 | */ | ||
| 292 | __u16 plen2; | ||
| 293 | /** | ||
| 294 | * number of program entries for SET3, range 1 - 16 | ||
| 295 | * when fmtmode is ISIF_SPLIT, 1 - 8 when fmtmode is | ||
| 296 | * ISIF_COMBINE | ||
| 297 | */ | ||
| 298 | __u16 plen3; | ||
| 299 | }; | ||
| 300 | |||
| 301 | struct isif_fmt_cfg { | ||
| 302 | #define ISIF_SPLIT 0 | ||
| 303 | #define ISIF_COMBINE 1 | ||
| 304 | /* Split or combine or line alternate */ | ||
| 305 | __u8 fmtmode; | ||
| 306 | /* enable or disable line alternating mode */ | ||
| 307 | __u8 ln_alter_en; | ||
| 308 | #define ISIF_1LINE 0 | ||
| 309 | #define ISIF_2LINES 1 | ||
| 310 | #define ISIF_3LINES 2 | ||
| 311 | #define ISIF_4LINES 3 | ||
| 312 | /* Split/combine line number */ | ||
| 313 | __u8 lnum; | ||
| 314 | /* Address increment Range 1 - 16 */ | ||
| 315 | __u8 addrinc; | ||
| 316 | }; | ||
| 317 | |||
| 318 | struct isif_fmt_addr_ptr { | ||
| 319 | /* Initial address */ | ||
| 320 | __u32 init_addr; | ||
| 321 | /* output line number */ | ||
| 322 | #define ISIF_1STLINE 0 | ||
| 323 | #define ISIF_2NDLINE 1 | ||
| 324 | #define ISIF_3RDLINE 2 | ||
| 325 | #define ISIF_4THLINE 3 | ||
| 326 | __u8 out_line; | ||
| 327 | }; | ||
| 328 | |||
| 329 | struct isif_fmtpgm_ap { | ||
| 330 | /* program address pointer */ | ||
| 331 | __u8 pgm_aptr; | ||
| 332 | /* program address increment or decrement */ | ||
| 333 | __u8 pgmupdt; | ||
| 334 | }; | ||
| 335 | |||
| 336 | struct isif_data_formatter { | ||
| 337 | /* Enable/Disable data formatter */ | ||
| 338 | __u8 en; | ||
| 339 | /* data formatter configuration */ | ||
| 340 | struct isif_fmt_cfg cfg; | ||
| 341 | /* Formatter program entries length */ | ||
| 342 | struct isif_fmtplen plen; | ||
| 343 | /* first pixel in a line fed to formatter */ | ||
| 344 | __u16 fmtrlen; | ||
| 345 | /* HD interval for output line. Only valid when split line */ | ||
| 346 | __u16 fmthcnt; | ||
| 347 | /* formatter address pointers */ | ||
| 348 | struct isif_fmt_addr_ptr fmtaddr_ptr[16]; | ||
| 349 | /* program enable/disable */ | ||
| 350 | __u8 pgm_en[32]; | ||
| 351 | /* program address pointers */ | ||
| 352 | struct isif_fmtpgm_ap fmtpgm_ap[32]; | ||
| 353 | }; | ||
| 354 | |||
| 355 | struct isif_df_csc { | ||
| 356 | /* Color Space Conversion confguration, 0 - csc, 1 - df */ | ||
| 357 | __u8 df_or_csc; | ||
| 358 | /* csc configuration valid if df_or_csc is 0 */ | ||
| 359 | struct isif_color_space_conv csc; | ||
| 360 | /* data formatter configuration valid if df_or_csc is 1 */ | ||
| 361 | struct isif_data_formatter df; | ||
| 362 | /* start pixel in a line at the input */ | ||
| 363 | __u32 start_pix; | ||
| 364 | /* number of pixels in input line */ | ||
| 365 | __u32 num_pixels; | ||
| 366 | /* start line at the input */ | ||
| 367 | __u32 start_line; | ||
| 368 | /* number of lines at the input */ | ||
| 369 | __u32 num_lines; | ||
| 370 | }; | ||
| 371 | |||
| 372 | struct isif_gain_offsets_adj { | ||
| 373 | /* Gain adjustment per color */ | ||
| 374 | struct isif_gain gain; | ||
| 375 | /* Offset adjustment */ | ||
| 376 | __u16 offset; | ||
| 377 | /* Enable or Disable Gain adjustment for SDRAM data */ | ||
| 378 | __u8 gain_sdram_en; | ||
| 379 | /* Enable or Disable Gain adjustment for IPIPE data */ | ||
| 380 | __u8 gain_ipipe_en; | ||
| 381 | /* Enable or Disable Gain adjustment for H3A data */ | ||
| 382 | __u8 gain_h3a_en; | ||
| 383 | /* Enable or Disable Gain adjustment for SDRAM data */ | ||
| 384 | __u8 offset_sdram_en; | ||
| 385 | /* Enable or Disable Gain adjustment for IPIPE data */ | ||
| 386 | __u8 offset_ipipe_en; | ||
| 387 | /* Enable or Disable Gain adjustment for H3A data */ | ||
| 388 | __u8 offset_h3a_en; | ||
| 389 | }; | ||
| 390 | |||
| 391 | struct isif_cul { | ||
| 392 | /* Horizontal Cull pattern for odd lines */ | ||
| 393 | __u8 hcpat_odd; | ||
| 394 | /* Horizontal Cull pattern for even lines */ | ||
| 395 | __u8 hcpat_even; | ||
| 396 | /* Vertical Cull pattern */ | ||
| 397 | __u8 vcpat; | ||
| 398 | /* Enable or disable lpf. Apply when cull is enabled */ | ||
| 399 | __u8 en_lpf; | ||
| 400 | }; | ||
| 401 | |||
| 402 | struct isif_compress { | ||
| 403 | #define ISIF_ALAW 0 | ||
| 404 | #define ISIF_DPCM 1 | ||
| 405 | #define ISIF_NO_COMPRESSION 2 | ||
| 406 | /* Compression Algorithm used */ | ||
| 407 | __u8 alg; | ||
| 408 | /* Choose Predictor1 for DPCM compression */ | ||
| 409 | #define ISIF_DPCM_PRED1 0 | ||
| 410 | /* Choose Predictor2 for DPCM compression */ | ||
| 411 | #define ISIF_DPCM_PRED2 1 | ||
| 412 | /* Predictor for DPCM compression */ | ||
| 413 | __u8 pred; | ||
| 414 | }; | ||
| 415 | |||
| 416 | /* all the stuff in this struct will be provided by userland */ | ||
| 417 | struct isif_config_params_raw { | ||
| 418 | /* Linearization parameters for image sensor data input */ | ||
| 419 | struct isif_linearize linearize; | ||
| 420 | /* Data formatter or CSC */ | ||
| 421 | struct isif_df_csc df_csc; | ||
| 422 | /* Defect Pixel Correction (DFC) confguration */ | ||
| 423 | struct isif_dfc dfc; | ||
| 424 | /* Black/Digital Clamp configuration */ | ||
| 425 | struct isif_black_clamp bclamp; | ||
| 426 | /* Gain, offset adjustments */ | ||
| 427 | struct isif_gain_offsets_adj gain_offset; | ||
| 428 | /* Culling */ | ||
| 429 | struct isif_cul culling; | ||
| 430 | /* A-Law and DPCM compression options */ | ||
| 431 | struct isif_compress compress; | ||
| 432 | /* horizontal offset for Gain/LSC/DFC */ | ||
| 433 | __u16 horz_offset; | ||
| 434 | /* vertical offset for Gain/LSC/DFC */ | ||
| 435 | __u16 vert_offset; | ||
| 436 | /* color pattern for field 0 */ | ||
| 437 | struct isif_col_pat col_pat_field0; | ||
| 438 | /* color pattern for field 1 */ | ||
| 439 | struct isif_col_pat col_pat_field1; | ||
| 440 | #define ISIF_NO_SHIFT 0 | ||
| 441 | #define ISIF_1BIT_SHIFT 1 | ||
| 442 | #define ISIF_2BIT_SHIFT 2 | ||
| 443 | #define ISIF_3BIT_SHIFT 3 | ||
| 444 | #define ISIF_4BIT_SHIFT 4 | ||
| 445 | #define ISIF_5BIT_SHIFT 5 | ||
| 446 | #define ISIF_6BIT_SHIFT 6 | ||
| 447 | /* Data shift applied before storing to SDRAM */ | ||
| 448 | __u8 data_shift; | ||
| 449 | /* enable input test pattern generation */ | ||
| 450 | __u8 test_pat_gen; | ||
| 451 | }; | ||
| 452 | |||
| 453 | #ifdef __KERNEL__ | ||
| 454 | struct isif_ycbcr_config { | ||
| 455 | /* isif pixel format */ | ||
| 456 | enum ccdc_pixfmt pix_fmt; | ||
| 457 | /* isif frame format */ | ||
| 458 | enum ccdc_frmfmt frm_fmt; | ||
| 459 | /* ISIF crop window */ | ||
| 460 | struct v4l2_rect win; | ||
| 461 | /* field polarity */ | ||
| 462 | enum vpfe_pin_pol fid_pol; | ||
| 463 | /* interface VD polarity */ | ||
| 464 | enum vpfe_pin_pol vd_pol; | ||
| 465 | /* interface HD polarity */ | ||
| 466 | enum vpfe_pin_pol hd_pol; | ||
| 467 | /* isif pix order. Only used for ycbcr capture */ | ||
| 468 | enum ccdc_pixorder pix_order; | ||
| 469 | /* isif buffer type. Only used for ycbcr capture */ | ||
| 470 | enum ccdc_buftype buf_type; | ||
| 471 | }; | ||
| 472 | |||
| 473 | /* MSB of image data connected to sensor port */ | ||
| 474 | enum isif_data_msb { | ||
| 475 | ISIF_BIT_MSB_15, | ||
| 476 | ISIF_BIT_MSB_14, | ||
| 477 | ISIF_BIT_MSB_13, | ||
| 478 | ISIF_BIT_MSB_12, | ||
| 479 | ISIF_BIT_MSB_11, | ||
| 480 | ISIF_BIT_MSB_10, | ||
| 481 | ISIF_BIT_MSB_9, | ||
| 482 | ISIF_BIT_MSB_8, | ||
| 483 | ISIF_BIT_MSB_7 | ||
| 484 | }; | ||
| 485 | |||
| 486 | enum isif_cfa_pattern { | ||
| 487 | ISIF_CFA_PAT_MOSAIC, | ||
| 488 | ISIF_CFA_PAT_STRIPE | ||
| 489 | }; | ||
| 490 | |||
| 491 | struct isif_params_raw { | ||
| 492 | /* isif pixel format */ | ||
| 493 | enum ccdc_pixfmt pix_fmt; | ||
| 494 | /* isif frame format */ | ||
| 495 | enum ccdc_frmfmt frm_fmt; | ||
| 496 | /* video window */ | ||
| 497 | struct v4l2_rect win; | ||
| 498 | /* field polarity */ | ||
| 499 | enum vpfe_pin_pol fid_pol; | ||
| 500 | /* interface VD polarity */ | ||
| 501 | enum vpfe_pin_pol vd_pol; | ||
| 502 | /* interface HD polarity */ | ||
| 503 | enum vpfe_pin_pol hd_pol; | ||
| 504 | /* buffer type. Applicable for interlaced mode */ | ||
| 505 | enum ccdc_buftype buf_type; | ||
| 506 | /* Gain values */ | ||
| 507 | struct isif_gain gain; | ||
| 508 | /* cfa pattern */ | ||
| 509 | enum isif_cfa_pattern cfa_pat; | ||
| 510 | /* Data MSB position */ | ||
| 511 | enum isif_data_msb data_msb; | ||
| 512 | /* Enable horizontal flip */ | ||
| 513 | unsigned char horz_flip_en; | ||
| 514 | /* Enable image invert vertically */ | ||
| 515 | unsigned char image_invert_en; | ||
| 516 | |||
| 517 | /* all the userland defined stuff*/ | ||
| 518 | struct isif_config_params_raw config_params; | ||
| 519 | }; | ||
| 520 | |||
| 521 | enum isif_data_pack { | ||
| 522 | ISIF_PACK_16BIT, | ||
| 523 | ISIF_PACK_12BIT, | ||
| 524 | ISIF_PACK_8BIT | ||
| 525 | }; | ||
| 526 | |||
| 527 | #define ISIF_WIN_NTSC {0, 0, 720, 480} | ||
| 528 | #define ISIF_WIN_VGA {0, 0, 640, 480} | ||
| 529 | |||
| 530 | #endif | ||
| 531 | #endif | ||
diff --git a/include/media/davinci/vpfe_capture.h b/include/media/davinci/vpfe_capture.h index 71d8982e13ff..4314a5f6a087 100644 --- a/include/media/davinci/vpfe_capture.h +++ b/include/media/davinci/vpfe_capture.h | |||
| @@ -83,6 +83,8 @@ struct vpfe_subdev_info { | |||
| 83 | struct vpfe_config { | 83 | struct vpfe_config { |
| 84 | /* Number of sub devices connected to vpfe */ | 84 | /* Number of sub devices connected to vpfe */ |
| 85 | int num_subdevs; | 85 | int num_subdevs; |
| 86 | /* i2c bus adapter no */ | ||
| 87 | int i2c_adapter_id; | ||
| 86 | /* information about each subdev */ | 88 | /* information about each subdev */ |
| 87 | struct vpfe_subdev_info *sub_devs; | 89 | struct vpfe_subdev_info *sub_devs; |
| 88 | /* evm card info */ | 90 | /* evm card info */ |
| @@ -163,7 +165,7 @@ struct vpfe_device { | |||
| 163 | u8 started; | 165 | u8 started; |
| 164 | /* | 166 | /* |
| 165 | * offset where second field starts from the starting of the | 167 | * offset where second field starts from the starting of the |
| 166 | * buffer for field seperated YCbCr formats | 168 | * buffer for field separated YCbCr formats |
| 167 | */ | 169 | */ |
| 168 | u32 field_off; | 170 | u32 field_off; |
| 169 | }; | 171 | }; |
diff --git a/include/media/davinci/vpss.h b/include/media/davinci/vpss.h index fcdff745fae2..c59cc029c74a 100644 --- a/include/media/davinci/vpss.h +++ b/include/media/davinci/vpss.h | |||
| @@ -29,7 +29,19 @@ | |||
| 29 | /* selector for ccdc input selection on DM355 */ | 29 | /* selector for ccdc input selection on DM355 */ |
| 30 | enum vpss_ccdc_source_sel { | 30 | enum vpss_ccdc_source_sel { |
| 31 | VPSS_CCDCIN, | 31 | VPSS_CCDCIN, |
| 32 | VPSS_HSSIIN | 32 | VPSS_HSSIIN, |
| 33 | VPSS_PGLPBK, /* for DM365 only */ | ||
| 34 | VPSS_CCDCPG /* for DM365 only */ | ||
| 35 | }; | ||
| 36 | |||
| 37 | struct vpss_sync_pol { | ||
| 38 | unsigned int ccdpg_hdpol:1; | ||
| 39 | unsigned int ccdpg_vdpol:1; | ||
| 40 | }; | ||
| 41 | |||
| 42 | struct vpss_pg_frame_size { | ||
| 43 | short hlpfr; | ||
| 44 | short pplen; | ||
| 33 | }; | 45 | }; |
| 34 | 46 | ||
| 35 | /* Used for enable/diable VPSS Clock */ | 47 | /* Used for enable/diable VPSS Clock */ |
| @@ -47,12 +59,38 @@ enum vpss_clock_sel { | |||
| 47 | */ | 59 | */ |
| 48 | VPSS_VENC_CLOCK_SEL, | 60 | VPSS_VENC_CLOCK_SEL, |
| 49 | VPSS_VPBE_CLOCK, | 61 | VPSS_VPBE_CLOCK, |
| 62 | /* DM365 only clocks */ | ||
| 63 | VPSS_IPIPEIF_CLOCK, | ||
| 64 | VPSS_RSZ_CLOCK, | ||
| 65 | VPSS_BL_CLOCK, | ||
| 66 | /* | ||
| 67 | * When using VPSS_PCLK_INTERNAL in vpss_enable_clock() api | ||
| 68 | * following applies:- | ||
| 69 | * en = 0 disable internal PCLK | ||
| 70 | * en = 1 enables internal PCLK | ||
| 71 | */ | ||
| 72 | VPSS_PCLK_INTERNAL, | ||
| 73 | /* | ||
| 74 | * When using VPSS_PSYNC_CLOCK_SEL in vpss_enable_clock() api | ||
| 75 | * following applies:- | ||
| 76 | * en = 0 enables MMR clock | ||
| 77 | * en = 1 enables VPSS clock | ||
| 78 | */ | ||
| 79 | VPSS_PSYNC_CLOCK_SEL, | ||
| 80 | VPSS_LDC_CLOCK_SEL, | ||
| 81 | VPSS_OSD_CLOCK_SEL, | ||
| 82 | VPSS_FDIF_CLOCK, | ||
| 83 | VPSS_LDC_CLOCK | ||
| 50 | }; | 84 | }; |
| 51 | 85 | ||
| 52 | /* select input to ccdc on dm355 */ | 86 | /* select input to ccdc on dm355 */ |
| 53 | int vpss_select_ccdc_source(enum vpss_ccdc_source_sel src_sel); | 87 | int vpss_select_ccdc_source(enum vpss_ccdc_source_sel src_sel); |
| 54 | /* enable/disable a vpss clock, 0 - success, -1 - failure */ | 88 | /* enable/disable a vpss clock, 0 - success, -1 - failure */ |
| 55 | int vpss_enable_clock(enum vpss_clock_sel clock_sel, int en); | 89 | int vpss_enable_clock(enum vpss_clock_sel clock_sel, int en); |
| 90 | /* set sync polarity, only for DM365*/ | ||
| 91 | void dm365_vpss_set_sync_pol(struct vpss_sync_pol); | ||
| 92 | /* set the PG_FRAME_SIZE register, only for DM365 */ | ||
| 93 | void dm365_vpss_set_pg_frame_size(struct vpss_pg_frame_size); | ||
| 56 | 94 | ||
| 57 | /* wbl reset for dm644x */ | 95 | /* wbl reset for dm644x */ |
| 58 | enum vpss_wbl_sel { | 96 | enum vpss_wbl_sel { |
| @@ -65,5 +103,6 @@ enum vpss_wbl_sel { | |||
| 65 | VPSS_PCR_PREV_WBL_0, | 103 | VPSS_PCR_PREV_WBL_0, |
| 66 | VPSS_PCR_CCDC_WBL_O, | 104 | VPSS_PCR_CCDC_WBL_O, |
| 67 | }; | 105 | }; |
| 106 | /* clear wbl overflow flag for DM6446 */ | ||
| 68 | int vpss_clear_wbl_overflow(enum vpss_wbl_sel wbl_sel); | 107 | int vpss_clear_wbl_overflow(enum vpss_wbl_sel wbl_sel); |
| 69 | #endif | 108 | #endif |
diff --git a/include/media/ir-common.h b/include/media/ir-common.h index 29f0e53cff94..c66298062d39 100644 --- a/include/media/ir-common.h +++ b/include/media/ir-common.h | |||
| @@ -26,26 +26,7 @@ | |||
| 26 | #include <linux/input.h> | 26 | #include <linux/input.h> |
| 27 | #include <linux/workqueue.h> | 27 | #include <linux/workqueue.h> |
| 28 | #include <linux/interrupt.h> | 28 | #include <linux/interrupt.h> |
| 29 | 29 | #include <media/ir-core.h> | |
| 30 | #define IR_TYPE_RC5 1 | ||
| 31 | #define IR_TYPE_PD 2 /* Pulse distance encoded IR */ | ||
| 32 | #define IR_TYPE_OTHER 99 | ||
| 33 | |||
| 34 | #define IR_KEYTAB_TYPE u32 | ||
| 35 | #define IR_KEYTAB_SIZE 128 /* enougth for rc5, probably need more some day */ | ||
| 36 | |||
| 37 | struct ir_scancode { | ||
| 38 | u16 scancode; | ||
| 39 | u32 keycode; | ||
| 40 | }; | ||
| 41 | |||
| 42 | struct ir_scancode_table { | ||
| 43 | struct ir_scancode *scan; | ||
| 44 | int size; | ||
| 45 | }; | ||
| 46 | |||
| 47 | #define IR_KEYCODE(tab,code) (((unsigned)code < IR_KEYTAB_SIZE) \ | ||
| 48 | ? tab[code] : KEY_RESERVED) | ||
| 49 | 30 | ||
| 50 | #define RC5_START(x) (((x)>>12)&3) | 31 | #define RC5_START(x) (((x)>>12)&3) |
| 51 | #define RC5_TOGGLE(x) (((x)>>11)&1) | 32 | #define RC5_TOGGLE(x) (((x)>>11)&1) |
| @@ -54,12 +35,10 @@ struct ir_scancode_table { | |||
| 54 | 35 | ||
| 55 | struct ir_input_state { | 36 | struct ir_input_state { |
| 56 | /* configuration */ | 37 | /* configuration */ |
| 57 | int ir_type; | 38 | u64 ir_type; |
| 58 | IR_KEYTAB_TYPE ir_codes[IR_KEYTAB_SIZE]; | ||
| 59 | 39 | ||
| 60 | /* key info */ | 40 | /* key info */ |
| 61 | u32 ir_raw; /* raw data */ | 41 | u32 ir_key; /* ir scancode */ |
| 62 | u32 ir_key; /* ir key code */ | ||
| 63 | u32 keycode; /* linux key code */ | 42 | u32 keycode; /* linux key code */ |
| 64 | int keypressed; /* current state */ | 43 | int keypressed; /* current state */ |
| 65 | }; | 44 | }; |
| @@ -102,20 +81,23 @@ struct card_ir { | |||
| 102 | struct tasklet_struct tlet; | 81 | struct tasklet_struct tlet; |
| 103 | }; | 82 | }; |
| 104 | 83 | ||
| 105 | void ir_input_init(struct input_dev *dev, struct ir_input_state *ir, | 84 | /* Routines from ir-functions.c */ |
| 106 | int ir_type, struct ir_scancode_table *ir_codes); | 85 | |
| 86 | int ir_input_init(struct input_dev *dev, struct ir_input_state *ir, | ||
| 87 | const u64 ir_type); | ||
| 107 | void ir_input_nokey(struct input_dev *dev, struct ir_input_state *ir); | 88 | void ir_input_nokey(struct input_dev *dev, struct ir_input_state *ir); |
| 108 | void ir_input_keydown(struct input_dev *dev, struct ir_input_state *ir, | 89 | void ir_input_keydown(struct input_dev *dev, struct ir_input_state *ir, |
| 109 | u32 ir_key, u32 ir_raw); | 90 | u32 ir_key); |
| 110 | u32 ir_extract_bits(u32 data, u32 mask); | 91 | u32 ir_extract_bits(u32 data, u32 mask); |
| 111 | int ir_dump_samples(u32 *samples, int count); | 92 | int ir_dump_samples(u32 *samples, int count); |
| 112 | int ir_decode_biphase(u32 *samples, int count, int low, int high); | 93 | int ir_decode_biphase(u32 *samples, int count, int low, int high); |
| 113 | int ir_decode_pulsedistance(u32 *samples, int count, int low, int high); | 94 | int ir_decode_pulsedistance(u32 *samples, int count, int low, int high); |
| 95 | u32 ir_rc5_decode(unsigned int code); | ||
| 114 | 96 | ||
| 115 | void ir_rc5_timer_end(unsigned long data); | 97 | void ir_rc5_timer_end(unsigned long data); |
| 116 | void ir_rc5_timer_keyup(unsigned long data); | 98 | void ir_rc5_timer_keyup(unsigned long data); |
| 117 | 99 | ||
| 118 | /* Keymaps to be used by other modules */ | 100 | /* scancode->keycode map tables from ir-keymaps.c */ |
| 119 | 101 | ||
| 120 | extern struct ir_scancode_table ir_codes_empty_table; | 102 | extern struct ir_scancode_table ir_codes_empty_table; |
| 121 | extern struct ir_scancode_table ir_codes_avermedia_table; | 103 | extern struct ir_scancode_table ir_codes_avermedia_table; |
| @@ -150,6 +132,7 @@ extern struct ir_scancode_table ir_codes_rc5_tv_table; | |||
| 150 | extern struct ir_scancode_table ir_codes_winfast_table; | 132 | extern struct ir_scancode_table ir_codes_winfast_table; |
| 151 | extern struct ir_scancode_table ir_codes_pinnacle_color_table; | 133 | extern struct ir_scancode_table ir_codes_pinnacle_color_table; |
| 152 | extern struct ir_scancode_table ir_codes_hauppauge_new_table; | 134 | extern struct ir_scancode_table ir_codes_hauppauge_new_table; |
| 135 | extern struct ir_scancode_table ir_codes_rc5_hauppauge_new_table; | ||
| 153 | extern struct ir_scancode_table ir_codes_npgtech_table; | 136 | extern struct ir_scancode_table ir_codes_npgtech_table; |
| 154 | extern struct ir_scancode_table ir_codes_norwood_table; | 137 | extern struct ir_scancode_table ir_codes_norwood_table; |
| 155 | extern struct ir_scancode_table ir_codes_proteus_2309_table; | 138 | extern struct ir_scancode_table ir_codes_proteus_2309_table; |
| @@ -172,8 +155,13 @@ extern struct ir_scancode_table ir_codes_ati_tv_wonder_hd_600_table; | |||
| 172 | extern struct ir_scancode_table ir_codes_kworld_plus_tv_analog_table; | 155 | extern struct ir_scancode_table ir_codes_kworld_plus_tv_analog_table; |
| 173 | extern struct ir_scancode_table ir_codes_kaiomy_table; | 156 | extern struct ir_scancode_table ir_codes_kaiomy_table; |
| 174 | extern struct ir_scancode_table ir_codes_dm1105_nec_table; | 157 | extern struct ir_scancode_table ir_codes_dm1105_nec_table; |
| 158 | extern struct ir_scancode_table ir_codes_tevii_nec_table; | ||
| 159 | extern struct ir_scancode_table ir_codes_tbs_nec_table; | ||
| 175 | extern struct ir_scancode_table ir_codes_evga_indtube_table; | 160 | extern struct ir_scancode_table ir_codes_evga_indtube_table; |
| 176 | extern struct ir_scancode_table ir_codes_terratec_cinergy_xs_table; | 161 | extern struct ir_scancode_table ir_codes_terratec_cinergy_xs_table; |
| 177 | extern struct ir_scancode_table ir_codes_videomate_s350_table; | 162 | extern struct ir_scancode_table ir_codes_videomate_s350_table; |
| 178 | extern struct ir_scancode_table ir_codes_gadmei_rm008z_table; | 163 | extern struct ir_scancode_table ir_codes_gadmei_rm008z_table; |
| 164 | extern struct ir_scancode_table ir_codes_nec_terratec_cinergy_xs_table; | ||
| 165 | extern struct ir_scancode_table ir_codes_winfast_usbii_deluxe_table; | ||
| 166 | extern struct ir_scancode_table ir_codes_kworld_315u_table; | ||
| 179 | #endif | 167 | #endif |
diff --git a/include/media/ir-core.h b/include/media/ir-core.h new file mode 100644 index 000000000000..61c223bc3953 --- /dev/null +++ b/include/media/ir-core.h | |||
| @@ -0,0 +1,74 @@ | |||
| 1 | /* | ||
| 2 | * Remote Controller core header | ||
| 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 | |||
| 14 | #ifndef _IR_CORE | ||
| 15 | #define _IR_CORE | ||
| 16 | |||
| 17 | #include <linux/input.h> | ||
| 18 | #include <linux/spinlock.h> | ||
| 19 | |||
| 20 | extern int ir_core_debug; | ||
| 21 | #define IR_dprintk(level, fmt, arg...) if (ir_core_debug >= level) \ | ||
| 22 | printk(KERN_DEBUG "%s: " fmt , __func__, ## arg) | ||
| 23 | |||
| 24 | #define IR_TYPE_UNKNOWN 0 | ||
| 25 | #define IR_TYPE_RC5 (1 << 0) /* Philips RC5 protocol */ | ||
| 26 | #define IR_TYPE_PD (1 << 1) /* Pulse distance encoded IR */ | ||
| 27 | #define IR_TYPE_NEC (1 << 2) | ||
| 28 | #define IR_TYPE_OTHER (((u64)1) << 63l) | ||
| 29 | |||
| 30 | struct ir_scancode { | ||
| 31 | u16 scancode; | ||
| 32 | u32 keycode; | ||
| 33 | }; | ||
| 34 | |||
| 35 | struct ir_scancode_table { | ||
| 36 | struct ir_scancode *scan; | ||
| 37 | int size; | ||
| 38 | u64 ir_type; | ||
| 39 | spinlock_t lock; | ||
| 40 | }; | ||
| 41 | |||
| 42 | struct ir_dev_props { | ||
| 43 | unsigned long allowed_protos; | ||
| 44 | void *priv; | ||
| 45 | int (*change_protocol)(void *priv, u64 ir_type); | ||
| 46 | }; | ||
| 47 | |||
| 48 | |||
| 49 | struct ir_input_dev { | ||
| 50 | struct input_dev *dev; /* Input device*/ | ||
| 51 | struct ir_scancode_table rc_tab; /* scan/key table */ | ||
| 52 | unsigned long devno; /* device number */ | ||
| 53 | struct attribute_group attr; /* IR attributes */ | ||
| 54 | struct device *class_dev; /* virtual class dev */ | ||
| 55 | const struct ir_dev_props *props; /* Device properties */ | ||
| 56 | }; | ||
| 57 | #define to_ir_input_dev(_attr) container_of(_attr, struct ir_input_dev, attr) | ||
| 58 | |||
| 59 | /* Routines from ir-keytable.c */ | ||
| 60 | |||
| 61 | u32 ir_g_keycode_from_table(struct input_dev *input_dev, | ||
| 62 | u32 scancode); | ||
| 63 | |||
| 64 | int ir_input_register(struct input_dev *dev, | ||
| 65 | const struct ir_scancode_table *ir_codes, | ||
| 66 | const struct ir_dev_props *props); | ||
| 67 | void ir_input_unregister(struct input_dev *input_dev); | ||
| 68 | |||
| 69 | /* Routines from ir-sysfs.c */ | ||
| 70 | |||
| 71 | int ir_register_class(struct input_dev *input_dev); | ||
| 72 | void ir_unregister_class(struct input_dev *input_dev); | ||
| 73 | |||
| 74 | #endif | ||
diff --git a/include/media/ir-kbd-i2c.h b/include/media/ir-kbd-i2c.h index aaf65e8b1a40..9142936603cc 100644 --- a/include/media/ir-kbd-i2c.h +++ b/include/media/ir-kbd-i2c.h | |||
| @@ -36,7 +36,7 @@ enum ir_kbd_get_key_fn { | |||
| 36 | struct IR_i2c_init_data { | 36 | struct IR_i2c_init_data { |
| 37 | struct ir_scancode_table *ir_codes; | 37 | struct ir_scancode_table *ir_codes; |
| 38 | const char *name; | 38 | const char *name; |
| 39 | int type; /* IR_TYPE_RC5, IR_TYPE_PD, etc */ | 39 | u64 type; /* IR_TYPE_RC5, IR_TYPE_PD, etc */ |
| 40 | /* | 40 | /* |
| 41 | * Specify either a function pointer or a value indicating one of | 41 | * Specify either a function pointer or a value indicating one of |
| 42 | * ir_kbd_i2c's internal get_key functions | 42 | * ir_kbd_i2c's internal get_key functions |
diff --git a/include/media/mt9t112.h b/include/media/mt9t112.h new file mode 100644 index 000000000000..a43c74ab05ec --- /dev/null +++ b/include/media/mt9t112.h | |||
| @@ -0,0 +1,30 @@ | |||
| 1 | /* mt9t112 Camera | ||
| 2 | * | ||
| 3 | * Copyright (C) 2009 Renesas Solutions Corp. | ||
| 4 | * Kuninori Morimoto <morimoto.kuninori@renesas.com> | ||
| 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 __MT9T112_H__ | ||
| 12 | #define __MT9T112_H__ | ||
| 13 | |||
| 14 | #define MT9T112_FLAG_PCLK_RISING_EDGE (1 << 0) | ||
| 15 | #define MT9T112_FLAG_DATAWIDTH_8 (1 << 1) /* default width is 10 */ | ||
| 16 | |||
| 17 | struct mt9t112_pll_divider { | ||
| 18 | u8 m, n; | ||
| 19 | u8 p1, p2, p3, p4, p5, p6, p7; | ||
| 20 | }; | ||
| 21 | |||
| 22 | /* | ||
| 23 | * mt9t112 camera info | ||
| 24 | */ | ||
| 25 | struct mt9t112_camera_info { | ||
| 26 | u32 flags; | ||
| 27 | struct mt9t112_pll_divider divider; | ||
| 28 | }; | ||
| 29 | |||
| 30 | #endif /* __MT9T112_H__ */ | ||
diff --git a/include/media/ov772x.h b/include/media/ov772x.h index 30d9629198ef..548bf1155c83 100644 --- a/include/media/ov772x.h +++ b/include/media/ov772x.h | |||
| @@ -1,4 +1,5 @@ | |||
| 1 | /* ov772x Camera | 1 | /* |
| 2 | * ov772x Camera | ||
| 2 | * | 3 | * |
| 3 | * Copyright (C) 2008 Renesas Solutions Corp. | 4 | * Copyright (C) 2008 Renesas Solutions Corp. |
| 4 | * Kuninori Morimoto <morimoto.kuninori@renesas.com> | 5 | * Kuninori Morimoto <morimoto.kuninori@renesas.com> |
| @@ -14,8 +15,9 @@ | |||
| 14 | #include <media/soc_camera.h> | 15 | #include <media/soc_camera.h> |
| 15 | 16 | ||
| 16 | /* for flags */ | 17 | /* for flags */ |
| 17 | #define OV772X_FLAG_VFLIP 0x00000001 /* Vertical flip image */ | 18 | #define OV772X_FLAG_VFLIP (1 << 0) /* Vertical flip image */ |
| 18 | #define OV772X_FLAG_HFLIP 0x00000002 /* Horizontal flip image */ | 19 | #define OV772X_FLAG_HFLIP (1 << 1) /* Horizontal flip image */ |
| 20 | #define OV772X_FLAG_8BIT (1 << 2) /* default 10 bit */ | ||
| 19 | 21 | ||
| 20 | /* | 22 | /* |
| 21 | * for Edge ctrl | 23 | * for Edge ctrl |
| @@ -52,10 +54,8 @@ struct ov772x_edge_ctrl { | |||
| 52 | * ov772x camera info | 54 | * ov772x camera info |
| 53 | */ | 55 | */ |
| 54 | struct ov772x_camera_info { | 56 | struct ov772x_camera_info { |
| 55 | unsigned long buswidth; | 57 | unsigned long flags; |
| 56 | unsigned long flags; | 58 | struct ov772x_edge_ctrl edgectrl; |
| 57 | struct soc_camera_link link; | ||
| 58 | struct ov772x_edge_ctrl edgectrl; | ||
| 59 | }; | 59 | }; |
| 60 | 60 | ||
| 61 | #endif /* __OV772X_H__ */ | 61 | #endif /* __OV772X_H__ */ |
diff --git a/include/media/rj54n1cb0c.h b/include/media/rj54n1cb0c.h new file mode 100644 index 000000000000..8ae3288ae925 --- /dev/null +++ b/include/media/rj54n1cb0c.h | |||
| @@ -0,0 +1,19 @@ | |||
| 1 | /* | ||
| 2 | * RJ54N1CB0C Private data | ||
| 3 | * | ||
| 4 | * Copyright (C) 2009, Guennadi Liakhovetski <g.liakhovetski@gmx.de> | ||
| 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 __RJ54N1CB0C_H__ | ||
| 12 | #define __RJ54N1CB0C_H__ | ||
| 13 | |||
| 14 | struct rj54n1_pdata { | ||
| 15 | unsigned int mclk_freq; | ||
| 16 | bool ioctl_high; | ||
| 17 | }; | ||
| 18 | |||
| 19 | #endif | ||
diff --git a/include/media/saa7146_vv.h b/include/media/saa7146_vv.h index eed5fccc83f3..4aeff96ff7d8 100644 --- a/include/media/saa7146_vv.h +++ b/include/media/saa7146_vv.h | |||
| @@ -108,8 +108,6 @@ struct saa7146_fh { | |||
| 108 | 108 | ||
| 109 | struct saa7146_vv | 109 | struct saa7146_vv |
| 110 | { | 110 | { |
| 111 | int vbi_minor; | ||
| 112 | |||
| 113 | /* vbi capture */ | 111 | /* vbi capture */ |
| 114 | struct saa7146_dmaqueue vbi_q; | 112 | struct saa7146_dmaqueue vbi_q; |
| 115 | /* vbi workaround interrupt queue */ | 113 | /* vbi workaround interrupt queue */ |
| @@ -117,8 +115,6 @@ struct saa7146_vv | |||
| 117 | int vbi_fieldcount; | 115 | int vbi_fieldcount; |
| 118 | struct saa7146_fh *vbi_streaming; | 116 | struct saa7146_fh *vbi_streaming; |
| 119 | 117 | ||
| 120 | int video_minor; | ||
| 121 | |||
| 122 | int video_status; | 118 | int video_status; |
| 123 | struct saa7146_fh *video_fh; | 119 | struct saa7146_fh *video_fh; |
| 124 | 120 | ||
diff --git a/include/media/sh_mobile_ceu.h b/include/media/sh_mobile_ceu.h index 0f3524cff435..b67747836878 100644 --- a/include/media/sh_mobile_ceu.h +++ b/include/media/sh_mobile_ceu.h | |||
| @@ -3,6 +3,8 @@ | |||
| 3 | 3 | ||
| 4 | #define SH_CEU_FLAG_USE_8BIT_BUS (1 << 0) /* use 8bit bus width */ | 4 | #define SH_CEU_FLAG_USE_8BIT_BUS (1 << 0) /* use 8bit bus width */ |
| 5 | #define SH_CEU_FLAG_USE_16BIT_BUS (1 << 1) /* use 16bit bus width */ | 5 | #define SH_CEU_FLAG_USE_16BIT_BUS (1 << 1) /* use 16bit bus width */ |
| 6 | #define SH_CEU_FLAG_HSYNC_LOW (1 << 2) /* default High if possible */ | ||
| 7 | #define SH_CEU_FLAG_VSYNC_LOW (1 << 3) /* default High if possible */ | ||
| 6 | 8 | ||
| 7 | struct sh_mobile_ceu_info { | 9 | struct sh_mobile_ceu_info { |
| 8 | unsigned long flags; | 10 | unsigned long flags; |
diff --git a/include/media/soc_camera.h b/include/media/soc_camera.h index 3d74e60032dd..9d69f01b6fa2 100644 --- a/include/media/soc_camera.h +++ b/include/media/soc_camera.h | |||
| @@ -24,18 +24,13 @@ struct soc_camera_device { | |||
| 24 | struct device *pdev; /* Platform device */ | 24 | struct device *pdev; /* Platform device */ |
| 25 | s32 user_width; | 25 | s32 user_width; |
| 26 | s32 user_height; | 26 | s32 user_height; |
| 27 | unsigned short width_min; | 27 | enum v4l2_colorspace colorspace; |
| 28 | unsigned short height_min; | ||
| 29 | unsigned short y_skip_top; /* Lines to skip at the top */ | ||
| 30 | unsigned char iface; /* Host number */ | 28 | unsigned char iface; /* Host number */ |
| 31 | unsigned char devnum; /* Device number per host */ | 29 | unsigned char devnum; /* Device number per host */ |
| 32 | unsigned char buswidth; /* See comment in .c */ | ||
| 33 | struct soc_camera_sense *sense; /* See comment in struct definition */ | 30 | struct soc_camera_sense *sense; /* See comment in struct definition */ |
| 34 | struct soc_camera_ops *ops; | 31 | struct soc_camera_ops *ops; |
| 35 | struct video_device *vdev; | 32 | struct video_device *vdev; |
| 36 | const struct soc_camera_data_format *current_fmt; | 33 | const struct soc_camera_format_xlate *current_fmt; |
| 37 | const struct soc_camera_data_format *formats; | ||
| 38 | int num_formats; | ||
| 39 | struct soc_camera_format_xlate *user_formats; | 34 | struct soc_camera_format_xlate *user_formats; |
| 40 | int num_user_formats; | 35 | int num_user_formats; |
| 41 | enum v4l2_field field; /* Preserve field over close() */ | 36 | enum v4l2_field field; /* Preserve field over close() */ |
| @@ -86,6 +81,8 @@ struct soc_camera_host_ops { | |||
| 86 | int (*set_bus_param)(struct soc_camera_device *, __u32); | 81 | int (*set_bus_param)(struct soc_camera_device *, __u32); |
| 87 | int (*get_ctrl)(struct soc_camera_device *, struct v4l2_control *); | 82 | int (*get_ctrl)(struct soc_camera_device *, struct v4l2_control *); |
| 88 | int (*set_ctrl)(struct soc_camera_device *, struct v4l2_control *); | 83 | int (*set_ctrl)(struct soc_camera_device *, struct v4l2_control *); |
| 84 | int (*get_parm)(struct soc_camera_device *, struct v4l2_streamparm *); | ||
| 85 | int (*set_parm)(struct soc_camera_device *, struct v4l2_streamparm *); | ||
| 89 | unsigned int (*poll)(struct file *, poll_table *); | 86 | unsigned int (*poll)(struct file *, poll_table *); |
| 90 | const struct v4l2_queryctrl *controls; | 87 | const struct v4l2_queryctrl *controls; |
| 91 | int num_controls; | 88 | int num_controls; |
| @@ -107,6 +104,8 @@ struct soc_camera_link { | |||
| 107 | int i2c_adapter_id; | 104 | int i2c_adapter_id; |
| 108 | struct i2c_board_info *board_info; | 105 | struct i2c_board_info *board_info; |
| 109 | const char *module_name; | 106 | const char *module_name; |
| 107 | void *priv; | ||
| 108 | |||
| 110 | /* | 109 | /* |
| 111 | * For non-I2C devices platform platform has to provide methods to | 110 | * For non-I2C devices platform platform has to provide methods to |
| 112 | * add a device to the system and to remove | 111 | * add a device to the system and to remove |
| @@ -162,23 +161,13 @@ static inline struct v4l2_subdev *soc_camera_to_subdev( | |||
| 162 | int soc_camera_host_register(struct soc_camera_host *ici); | 161 | int soc_camera_host_register(struct soc_camera_host *ici); |
| 163 | void soc_camera_host_unregister(struct soc_camera_host *ici); | 162 | void soc_camera_host_unregister(struct soc_camera_host *ici); |
| 164 | 163 | ||
| 165 | const struct soc_camera_data_format *soc_camera_format_by_fourcc( | ||
| 166 | struct soc_camera_device *icd, unsigned int fourcc); | ||
| 167 | const struct soc_camera_format_xlate *soc_camera_xlate_by_fourcc( | 164 | const struct soc_camera_format_xlate *soc_camera_xlate_by_fourcc( |
| 168 | struct soc_camera_device *icd, unsigned int fourcc); | 165 | struct soc_camera_device *icd, unsigned int fourcc); |
| 169 | 166 | ||
| 170 | struct soc_camera_data_format { | ||
| 171 | const char *name; | ||
| 172 | unsigned int depth; | ||
| 173 | __u32 fourcc; | ||
| 174 | enum v4l2_colorspace colorspace; | ||
| 175 | }; | ||
| 176 | |||
| 177 | /** | 167 | /** |
| 178 | * struct soc_camera_format_xlate - match between host and sensor formats | 168 | * struct soc_camera_format_xlate - match between host and sensor formats |
| 179 | * @cam_fmt: sensor format provided by the sensor | 169 | * @code: code of a sensor provided format |
| 180 | * @host_fmt: host format after host translation from cam_fmt | 170 | * @host_fmt: host format after host translation from code |
| 181 | * @buswidth: bus width for this format | ||
| 182 | * | 171 | * |
| 183 | * Host and sensor translation structure. Used in table of host and sensor | 172 | * Host and sensor translation structure. Used in table of host and sensor |
| 184 | * formats matchings in soc_camera_device. A host can override the generic list | 173 | * formats matchings in soc_camera_device. A host can override the generic list |
| @@ -186,9 +175,8 @@ struct soc_camera_data_format { | |||
| 186 | * format setup. | 175 | * format setup. |
| 187 | */ | 176 | */ |
| 188 | struct soc_camera_format_xlate { | 177 | struct soc_camera_format_xlate { |
| 189 | const struct soc_camera_data_format *cam_fmt; | 178 | enum v4l2_mbus_pixelcode code; |
| 190 | const struct soc_camera_data_format *host_fmt; | 179 | const struct soc_mbus_pixelfmt *host_fmt; |
| 191 | unsigned char buswidth; | ||
| 192 | }; | 180 | }; |
| 193 | 181 | ||
| 194 | struct soc_camera_ops { | 182 | struct soc_camera_ops { |
diff --git a/include/media/soc_camera_platform.h b/include/media/soc_camera_platform.h index bb70401b8141..0ecefe227b76 100644 --- a/include/media/soc_camera_platform.h +++ b/include/media/soc_camera_platform.h | |||
| @@ -19,11 +19,10 @@ struct device; | |||
| 19 | struct soc_camera_platform_info { | 19 | struct soc_camera_platform_info { |
| 20 | const char *format_name; | 20 | const char *format_name; |
| 21 | unsigned long format_depth; | 21 | unsigned long format_depth; |
| 22 | struct v4l2_pix_format format; | 22 | struct v4l2_mbus_framefmt format; |
| 23 | unsigned long bus_param; | 23 | unsigned long bus_param; |
| 24 | struct device *dev; | 24 | struct device *dev; |
| 25 | int (*set_capture)(struct soc_camera_platform_info *info, int enable); | 25 | int (*set_capture)(struct soc_camera_platform_info *info, int enable); |
| 26 | struct soc_camera_link link; | ||
| 27 | }; | 26 | }; |
| 28 | 27 | ||
| 29 | #endif /* __SOC_CAMERA_H__ */ | 28 | #endif /* __SOC_CAMERA_H__ */ |
diff --git a/include/media/soc_mediabus.h b/include/media/soc_mediabus.h new file mode 100644 index 000000000000..037cd7be001e --- /dev/null +++ b/include/media/soc_mediabus.h | |||
| @@ -0,0 +1,65 @@ | |||
| 1 | /* | ||
| 2 | * SoC-camera Media Bus API extensions | ||
| 3 | * | ||
| 4 | * Copyright (C) 2009, Guennadi Liakhovetski <g.liakhovetski@gmx.de> | ||
| 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 SOC_MEDIABUS_H | ||
| 12 | #define SOC_MEDIABUS_H | ||
| 13 | |||
| 14 | #include <linux/videodev2.h> | ||
| 15 | |||
| 16 | #include <media/v4l2-mediabus.h> | ||
| 17 | |||
| 18 | /** | ||
| 19 | * enum soc_mbus_packing - data packing types on the media-bus | ||
| 20 | * @SOC_MBUS_PACKING_NONE: no packing, bit-for-bit transfer to RAM | ||
| 21 | * @SOC_MBUS_PACKING_2X8_PADHI: 16 bits transferred in 2 8-bit samples, in the | ||
| 22 | * possibly incomplete byte high bits are padding | ||
| 23 | * @SOC_MBUS_PACKING_2X8_PADLO: as above, but low bits are padding | ||
| 24 | * @SOC_MBUS_PACKING_EXTEND16: sample width (e.g., 10 bits) has to be extended | ||
| 25 | * to 16 bits | ||
| 26 | */ | ||
| 27 | enum soc_mbus_packing { | ||
| 28 | SOC_MBUS_PACKING_NONE, | ||
| 29 | SOC_MBUS_PACKING_2X8_PADHI, | ||
| 30 | SOC_MBUS_PACKING_2X8_PADLO, | ||
| 31 | SOC_MBUS_PACKING_EXTEND16, | ||
| 32 | }; | ||
| 33 | |||
| 34 | /** | ||
| 35 | * enum soc_mbus_order - sample order on the media bus | ||
| 36 | * @SOC_MBUS_ORDER_LE: least significant sample first | ||
| 37 | * @SOC_MBUS_ORDER_BE: most significant sample first | ||
| 38 | */ | ||
| 39 | enum soc_mbus_order { | ||
| 40 | SOC_MBUS_ORDER_LE, | ||
| 41 | SOC_MBUS_ORDER_BE, | ||
| 42 | }; | ||
| 43 | |||
| 44 | /** | ||
| 45 | * struct soc_mbus_pixelfmt - Data format on the media bus | ||
| 46 | * @name: Name of the format | ||
| 47 | * @fourcc: Fourcc code, that will be obtained if the data is | ||
| 48 | * stored in memory in the following way: | ||
| 49 | * @packing: Type of sample-packing, that has to be used | ||
| 50 | * @order: Sample order when storing in memory | ||
| 51 | * @bits_per_sample: How many bits the bridge has to sample | ||
| 52 | */ | ||
| 53 | struct soc_mbus_pixelfmt { | ||
| 54 | const char *name; | ||
| 55 | u32 fourcc; | ||
| 56 | enum soc_mbus_packing packing; | ||
| 57 | enum soc_mbus_order order; | ||
| 58 | u8 bits_per_sample; | ||
| 59 | }; | ||
| 60 | |||
| 61 | const struct soc_mbus_pixelfmt *soc_mbus_get_fmtdesc( | ||
| 62 | enum v4l2_mbus_pixelcode code); | ||
| 63 | s32 soc_mbus_bytes_per_line(u32 width, const struct soc_mbus_pixelfmt *mf); | ||
| 64 | |||
| 65 | #endif | ||
diff --git a/include/media/timb_radio.h b/include/media/timb_radio.h new file mode 100644 index 000000000000..fcd32a3696ba --- /dev/null +++ b/include/media/timb_radio.h | |||
| @@ -0,0 +1,36 @@ | |||
| 1 | /* | ||
| 2 | * timb_radio.h Platform struct for the Timberdale radio driver | ||
| 3 | * Copyright (c) 2009 Intel Corporation | ||
| 4 | * | ||
| 5 | * This program is free software; you can redistribute it and/or modify | ||
| 6 | * it under the terms of the GNU General Public License version 2 as | ||
| 7 | * published by the Free Software Foundation. | ||
| 8 | * | ||
| 9 | * This program is distributed in the hope that it will be useful, | ||
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 12 | * GNU General Public License for more details. | ||
| 13 | * | ||
| 14 | * You should have received a copy of the GNU General Public License | ||
| 15 | * along with this program; if not, write to the Free Software | ||
| 16 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
| 17 | */ | ||
| 18 | |||
| 19 | #ifndef _TIMB_RADIO_ | ||
| 20 | #define _TIMB_RADIO_ 1 | ||
| 21 | |||
| 22 | #include <linux/i2c.h> | ||
| 23 | |||
| 24 | struct timb_radio_platform_data { | ||
| 25 | int i2c_adapter; /* I2C adapter where the tuner and dsp are attached */ | ||
| 26 | struct { | ||
| 27 | const char *module_name; | ||
| 28 | struct i2c_board_info *info; | ||
| 29 | } tuner; | ||
| 30 | struct { | ||
| 31 | const char *module_name; | ||
| 32 | struct i2c_board_info *info; | ||
| 33 | } dsp; | ||
| 34 | }; | ||
| 35 | |||
| 36 | #endif | ||
diff --git a/include/media/tuner.h b/include/media/tuner.h index 4d5b53ff17db..5505c5360ca3 100644 --- a/include/media/tuner.h +++ b/include/media/tuner.h | |||
| @@ -129,6 +129,7 @@ | |||
| 129 | #define TUNER_PARTSNIC_PTI_5NF05 81 | 129 | #define TUNER_PARTSNIC_PTI_5NF05 81 |
| 130 | #define TUNER_PHILIPS_CU1216L 82 | 130 | #define TUNER_PHILIPS_CU1216L 82 |
| 131 | #define TUNER_NXP_TDA18271 83 | 131 | #define TUNER_NXP_TDA18271 83 |
| 132 | #define TUNER_SONY_BTF_PXN01Z 84 | ||
| 132 | 133 | ||
| 133 | /* tv card specific */ | 134 | /* tv card specific */ |
| 134 | #define TDA9887_PRESENT (1<<0) | 135 | #define TDA9887_PRESENT (1<<0) |
diff --git a/include/media/tvp7002.h b/include/media/tvp7002.h new file mode 100644 index 000000000000..ee4353459ef5 --- /dev/null +++ b/include/media/tvp7002.h | |||
| @@ -0,0 +1,56 @@ | |||
| 1 | /* Texas Instruments Triple 8-/10-BIT 165-/110-MSPS Video and Graphics | ||
| 2 | * Digitizer with Horizontal PLL registers | ||
| 3 | * | ||
| 4 | * Copyright (C) 2009 Texas Instruments Inc | ||
| 5 | * Author: Santiago Nunez-Corrales <santiago.nunez@ridgerun.com> | ||
| 6 | * | ||
| 7 | * This code is partially based upon the TVP5150 driver | ||
| 8 | * written by Mauro Carvalho Chehab (mchehab@infradead.org), | ||
| 9 | * the TVP514x driver written by Vaibhav Hiremath <hvaibhav@ti.com> | ||
| 10 | * and the TVP7002 driver in the TI LSP 2.10.00.14 | ||
| 11 | * | ||
| 12 | * This program is free software; you can redistribute it and/or modify | ||
| 13 | * it under the terms of the GNU General Public License as published by | ||
| 14 | * the Free Software Foundation; either version 2 of the License, or | ||
| 15 | * (at your option) any later version. | ||
| 16 | * | ||
| 17 | * This program is distributed in the hope that it will be useful, | ||
| 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 20 | * GNU General Public License for more details. | ||
| 21 | * | ||
| 22 | * You should have received a copy of the GNU General Public License | ||
| 23 | * along with this program; if not, write to the Free Software | ||
| 24 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
| 25 | */ | ||
| 26 | #ifndef _TVP7002_H_ | ||
| 27 | #define _TVP7002_H_ | ||
| 28 | |||
| 29 | /* Platform-dependent data | ||
| 30 | * | ||
| 31 | * clk_polarity: | ||
| 32 | * 0 -> data clocked out on rising edge of DATACLK signal | ||
| 33 | * 1 -> data clocked out on falling edge of DATACLK signal | ||
| 34 | * hs_polarity: | ||
| 35 | * 0 -> active low HSYNC output | ||
| 36 | * 1 -> active high HSYNC output | ||
| 37 | * sog_polarity: | ||
| 38 | * 0 -> normal operation | ||
| 39 | * 1 -> operation with polarity inverted | ||
| 40 | * vs_polarity: | ||
| 41 | * 0 -> active low VSYNC output | ||
| 42 | * 1 -> active high VSYNC output | ||
| 43 | * fid_polarity: | ||
| 44 | * 0 -> the field ID output is set to logic 1 for an odd | ||
| 45 | * field (field 1) and set to logic 0 for an even | ||
| 46 | * field (field 0). | ||
| 47 | * 1 -> operation with polarity inverted. | ||
| 48 | */ | ||
| 49 | struct tvp7002_config { | ||
| 50 | u8 clk_polarity; | ||
| 51 | u8 hs_polarity; | ||
| 52 | u8 vs_polarity; | ||
| 53 | u8 fid_polarity; | ||
| 54 | u8 sog_polarity; | ||
| 55 | }; | ||
| 56 | #endif | ||
diff --git a/include/media/tw9910.h b/include/media/tw9910.h index 73231e7880d8..90bcf1fa5421 100644 --- a/include/media/tw9910.h +++ b/include/media/tw9910.h | |||
| @@ -30,9 +30,8 @@ enum tw9910_mpout_pin { | |||
| 30 | }; | 30 | }; |
| 31 | 31 | ||
| 32 | struct tw9910_video_info { | 32 | struct tw9910_video_info { |
| 33 | unsigned long buswidth; | 33 | unsigned long buswidth; |
| 34 | enum tw9910_mpout_pin mpout; | 34 | enum tw9910_mpout_pin mpout; |
| 35 | struct soc_camera_link link; | ||
| 36 | }; | 35 | }; |
| 37 | 36 | ||
| 38 | 37 | ||
diff --git a/include/media/v4l2-chip-ident.h b/include/media/v4l2-chip-ident.h index cf16689adba7..56abf21dd786 100644 --- a/include/media/v4l2-chip-ident.h +++ b/include/media/v4l2-chip-ident.h | |||
| @@ -39,6 +39,7 @@ enum { | |||
| 39 | 39 | ||
| 40 | /* module saa7115: reserved range 101-149 */ | 40 | /* module saa7115: reserved range 101-149 */ |
| 41 | V4L2_IDENT_SAA7111 = 101, | 41 | V4L2_IDENT_SAA7111 = 101, |
| 42 | V4L2_IDENT_SAA7111A = 102, | ||
| 42 | V4L2_IDENT_SAA7113 = 103, | 43 | V4L2_IDENT_SAA7113 = 103, |
| 43 | V4L2_IDENT_SAA7114 = 104, | 44 | V4L2_IDENT_SAA7114 = 104, |
| 44 | V4L2_IDENT_SAA7115 = 105, | 45 | V4L2_IDENT_SAA7115 = 105, |
| @@ -64,6 +65,7 @@ enum { | |||
| 64 | V4L2_IDENT_OV9650 = 254, | 65 | V4L2_IDENT_OV9650 = 254, |
| 65 | V4L2_IDENT_OV9655 = 255, | 66 | V4L2_IDENT_OV9655 = 255, |
| 66 | V4L2_IDENT_SOI968 = 256, | 67 | V4L2_IDENT_SOI968 = 256, |
| 68 | V4L2_IDENT_OV9640 = 257, | ||
| 67 | 69 | ||
| 68 | /* module saa7146: reserved range 300-309 */ | 70 | /* module saa7146: reserved range 300-309 */ |
| 69 | V4L2_IDENT_SAA7146 = 300, | 71 | V4L2_IDENT_SAA7146 = 300, |
| @@ -72,6 +74,7 @@ enum { | |||
| 72 | V4L2_IDENT_CX23418_843 = 403, /* Integrated A/V Decoder on the '418 */ | 74 | V4L2_IDENT_CX23418_843 = 403, /* Integrated A/V Decoder on the '418 */ |
| 73 | V4L2_IDENT_CX23415 = 415, | 75 | V4L2_IDENT_CX23415 = 415, |
| 74 | V4L2_IDENT_CX23416 = 416, | 76 | V4L2_IDENT_CX23416 = 416, |
| 77 | V4L2_IDENT_CX23417 = 417, | ||
| 75 | V4L2_IDENT_CX23418 = 418, | 78 | V4L2_IDENT_CX23418 = 418, |
| 76 | 79 | ||
| 77 | /* module au0828 */ | 80 | /* module au0828 */ |
| @@ -129,6 +132,12 @@ enum { | |||
| 129 | V4L2_IDENT_SAA6752HS = 6752, | 132 | V4L2_IDENT_SAA6752HS = 6752, |
| 130 | V4L2_IDENT_SAA6752HS_AC3 = 6753, | 133 | V4L2_IDENT_SAA6752HS_AC3 = 6753, |
| 131 | 134 | ||
| 135 | /* modules tef6862: just ident 6862 */ | ||
| 136 | V4L2_IDENT_TEF6862 = 6862, | ||
| 137 | |||
| 138 | /* module tvp7002: just ident 7002 */ | ||
| 139 | V4L2_IDENT_TVP7002 = 7002, | ||
| 140 | |||
| 132 | /* module adv7170: just ident 7170 */ | 141 | /* module adv7170: just ident 7170 */ |
| 133 | V4L2_IDENT_ADV7170 = 7170, | 142 | V4L2_IDENT_ADV7170 = 7170, |
| 134 | 143 | ||
| @@ -150,6 +159,9 @@ enum { | |||
| 150 | /* module adv7343: just ident 7343 */ | 159 | /* module adv7343: just ident 7343 */ |
| 151 | V4L2_IDENT_ADV7343 = 7343, | 160 | V4L2_IDENT_ADV7343 = 7343, |
| 152 | 161 | ||
| 162 | /* module saa7706h: just ident 7706 */ | ||
| 163 | V4L2_IDENT_SAA7706H = 7706, | ||
| 164 | |||
| 153 | /* module wm8739: just ident 8739 */ | 165 | /* module wm8739: just ident 8739 */ |
| 154 | V4L2_IDENT_WM8739 = 8739, | 166 | V4L2_IDENT_WM8739 = 8739, |
| 155 | 167 | ||
| @@ -165,12 +177,27 @@ enum { | |||
| 165 | /* module mt9v011, just ident 8243 */ | 177 | /* module mt9v011, just ident 8243 */ |
| 166 | V4L2_IDENT_MT9V011 = 8243, | 178 | V4L2_IDENT_MT9V011 = 8243, |
| 167 | 179 | ||
| 180 | /* module cx23885 and cx25840 */ | ||
| 181 | V4L2_IDENT_CX23885 = 8850, | ||
| 182 | V4L2_IDENT_CX23885_AV = 8851, /* Integrated A/V decoder */ | ||
| 183 | V4L2_IDENT_CX23887 = 8870, | ||
| 184 | V4L2_IDENT_CX23887_AV = 8871, /* Integrated A/V decoder */ | ||
| 185 | V4L2_IDENT_CX23888 = 8880, | ||
| 186 | V4L2_IDENT_CX23888_AV = 8881, /* Integrated A/V decoder */ | ||
| 187 | V4L2_IDENT_CX23888_IR = 8882, /* Integrated infrared controller */ | ||
| 188 | |||
| 168 | /* module tw9910: just ident 9910 */ | 189 | /* module tw9910: just ident 9910 */ |
| 169 | V4L2_IDENT_TW9910 = 9910, | 190 | V4L2_IDENT_TW9910 = 9910, |
| 170 | 191 | ||
| 171 | /* module sn9c20x: just ident 10000 */ | 192 | /* module sn9c20x: just ident 10000 */ |
| 172 | V4L2_IDENT_SN9C20X = 10000, | 193 | V4L2_IDENT_SN9C20X = 10000, |
| 173 | 194 | ||
| 195 | /* module cx231xx and cx25840 */ | ||
| 196 | V4L2_IDENT_CX2310X_AV = 23099, /* Integrated A/V decoder; not in '100 */ | ||
| 197 | V4L2_IDENT_CX23100 = 23100, | ||
| 198 | V4L2_IDENT_CX23101 = 23101, | ||
| 199 | V4L2_IDENT_CX23102 = 23102, | ||
| 200 | |||
| 174 | /* module msp3400: reserved range 34000-34999 and 44000-44999 */ | 201 | /* module msp3400: reserved range 34000-34999 and 44000-44999 */ |
| 175 | V4L2_IDENT_MSPX4XX = 34000, /* generic MSPX4XX identifier, only | 202 | V4L2_IDENT_MSPX4XX = 34000, /* generic MSPX4XX identifier, only |
| 176 | use internally (tveeprom.c). */ | 203 | use internally (tveeprom.c). */ |
| @@ -247,6 +274,8 @@ enum { | |||
| 247 | V4L2_IDENT_MT9V022IX7ATC = 45010, /* No way to detect "normal" I77ATx */ | 274 | V4L2_IDENT_MT9V022IX7ATC = 45010, /* No way to detect "normal" I77ATx */ |
| 248 | V4L2_IDENT_MT9V022IX7ATM = 45015, /* and "lead free" IA7ATx chips */ | 275 | V4L2_IDENT_MT9V022IX7ATM = 45015, /* and "lead free" IA7ATx chips */ |
| 249 | V4L2_IDENT_MT9T031 = 45020, | 276 | V4L2_IDENT_MT9T031 = 45020, |
| 277 | V4L2_IDENT_MT9T111 = 45021, | ||
| 278 | V4L2_IDENT_MT9T112 = 45022, | ||
| 250 | V4L2_IDENT_MT9V111 = 45031, | 279 | V4L2_IDENT_MT9V111 = 45031, |
| 251 | V4L2_IDENT_MT9V112 = 45032, | 280 | V4L2_IDENT_MT9V112 = 45032, |
| 252 | 281 | ||
| @@ -264,6 +293,9 @@ enum { | |||
| 264 | 293 | ||
| 265 | /* module m52790: just ident 52790 */ | 294 | /* module m52790: just ident 52790 */ |
| 266 | V4L2_IDENT_M52790 = 52790, | 295 | V4L2_IDENT_M52790 = 52790, |
| 296 | |||
| 297 | /* Sharp RJ54N1CB0C, 0xCB0C = 51980 */ | ||
| 298 | V4L2_IDENT_RJ54N1CB0C = 51980, | ||
| 267 | }; | 299 | }; |
| 268 | 300 | ||
| 269 | #endif | 301 | #endif |
diff --git a/include/media/v4l2-common.h b/include/media/v4l2-common.h index 1c25b10da34b..1c7b259f341c 100644 --- a/include/media/v4l2-common.h +++ b/include/media/v4l2-common.h | |||
| @@ -212,5 +212,5 @@ void v4l_bound_align_image(unsigned int *w, unsigned int wmin, | |||
| 212 | unsigned int *h, unsigned int hmin, | 212 | unsigned int *h, unsigned int hmin, |
| 213 | unsigned int hmax, unsigned int halign, | 213 | unsigned int hmax, unsigned int halign, |
| 214 | unsigned int salign); | 214 | unsigned int salign); |
| 215 | 215 | int v4l_fill_dv_preset_info(u32 preset, struct v4l2_dv_enum_preset *info); | |
| 216 | #endif /* V4L2_COMMON_H_ */ | 216 | #endif /* V4L2_COMMON_H_ */ |
diff --git a/include/media/v4l2-dev.h b/include/media/v4l2-dev.h index 73c9867d744c..2dee93892ea2 100644 --- a/include/media/v4l2-dev.h +++ b/include/media/v4l2-dev.h | |||
| @@ -28,10 +28,10 @@ struct v4l2_ioctl_callbacks; | |||
| 28 | struct video_device; | 28 | struct video_device; |
| 29 | struct v4l2_device; | 29 | struct v4l2_device; |
| 30 | 30 | ||
| 31 | /* Flag to mark the video_device struct as unregistered. | 31 | /* Flag to mark the video_device struct as registered. |
| 32 | Drivers can set this flag if they want to block all future | 32 | Drivers can clear this flag if they want to block all future |
| 33 | device access. It is set by video_unregister_device. */ | 33 | device access. It is cleared by video_unregister_device. */ |
| 34 | #define V4L2_FL_UNREGISTERED (0) | 34 | #define V4L2_FL_REGISTERED (0) |
| 35 | 35 | ||
| 36 | struct v4l2_file_operations { | 36 | struct v4l2_file_operations { |
| 37 | struct module *owner; | 37 | struct module *owner; |
| @@ -96,9 +96,7 @@ struct video_device | |||
| 96 | /* Register video devices. Note that if video_register_device fails, | 96 | /* Register video devices. Note that if video_register_device fails, |
| 97 | the release() callback of the video_device structure is *not* called, so | 97 | the release() callback of the video_device structure is *not* called, so |
| 98 | the caller is responsible for freeing any data. Usually that means that | 98 | the caller is responsible for freeing any data. Usually that means that |
| 99 | you call video_device_release() on failure. | 99 | you call video_device_release() on failure. */ |
| 100 | |||
| 101 | Also note that vdev->minor is set to -1 if the registration failed. */ | ||
| 102 | int __must_check video_register_device(struct video_device *vdev, int type, int nr); | 100 | int __must_check video_register_device(struct video_device *vdev, int type, int nr); |
| 103 | 101 | ||
| 104 | /* Same as video_register_device, but no warning is issued if the desired | 102 | /* Same as video_register_device, but no warning is issued if the desired |
| @@ -106,7 +104,7 @@ int __must_check video_register_device(struct video_device *vdev, int type, int | |||
| 106 | int __must_check video_register_device_no_warn(struct video_device *vdev, int type, int nr); | 104 | int __must_check video_register_device_no_warn(struct video_device *vdev, int type, int nr); |
| 107 | 105 | ||
| 108 | /* Unregister video devices. Will do nothing if vdev == NULL or | 106 | /* Unregister video devices. Will do nothing if vdev == NULL or |
| 109 | vdev->minor < 0. */ | 107 | video_is_registered() returns false. */ |
| 110 | void video_unregister_device(struct video_device *vdev); | 108 | void video_unregister_device(struct video_device *vdev); |
| 111 | 109 | ||
| 112 | /* helper functions to alloc/release struct video_device, the | 110 | /* helper functions to alloc/release struct video_device, the |
| @@ -141,9 +139,14 @@ static inline void *video_drvdata(struct file *file) | |||
| 141 | return video_get_drvdata(video_devdata(file)); | 139 | return video_get_drvdata(video_devdata(file)); |
| 142 | } | 140 | } |
| 143 | 141 | ||
| 144 | static inline int video_is_unregistered(struct video_device *vdev) | 142 | static inline const char *video_device_node_name(struct video_device *vdev) |
| 143 | { | ||
| 144 | return dev_name(&vdev->dev); | ||
| 145 | } | ||
| 146 | |||
| 147 | static inline int video_is_registered(struct video_device *vdev) | ||
| 145 | { | 148 | { |
| 146 | return test_bit(V4L2_FL_UNREGISTERED, &vdev->flags); | 149 | return test_bit(V4L2_FL_REGISTERED, &vdev->flags); |
| 147 | } | 150 | } |
| 148 | 151 | ||
| 149 | #endif /* _V4L2_DEV_H */ | 152 | #endif /* _V4L2_DEV_H */ |
diff --git a/include/media/v4l2-ioctl.h b/include/media/v4l2-ioctl.h index 7a4529defa88..e8ba0f2efbae 100644 --- a/include/media/v4l2-ioctl.h +++ b/include/media/v4l2-ioctl.h | |||
| @@ -239,6 +239,21 @@ struct v4l2_ioctl_ops { | |||
| 239 | int (*vidioc_enum_frameintervals) (struct file *file, void *fh, | 239 | int (*vidioc_enum_frameintervals) (struct file *file, void *fh, |
| 240 | struct v4l2_frmivalenum *fival); | 240 | struct v4l2_frmivalenum *fival); |
| 241 | 241 | ||
| 242 | /* DV Timings IOCTLs */ | ||
| 243 | int (*vidioc_enum_dv_presets) (struct file *file, void *fh, | ||
| 244 | struct v4l2_dv_enum_preset *preset); | ||
| 245 | |||
| 246 | int (*vidioc_s_dv_preset) (struct file *file, void *fh, | ||
| 247 | struct v4l2_dv_preset *preset); | ||
| 248 | int (*vidioc_g_dv_preset) (struct file *file, void *fh, | ||
| 249 | struct v4l2_dv_preset *preset); | ||
| 250 | int (*vidioc_query_dv_preset) (struct file *file, void *fh, | ||
| 251 | struct v4l2_dv_preset *qpreset); | ||
| 252 | int (*vidioc_s_dv_timings) (struct file *file, void *fh, | ||
| 253 | struct v4l2_dv_timings *timings); | ||
| 254 | int (*vidioc_g_dv_timings) (struct file *file, void *fh, | ||
| 255 | struct v4l2_dv_timings *timings); | ||
| 256 | |||
| 242 | /* For other private ioctls */ | 257 | /* For other private ioctls */ |
| 243 | long (*vidioc_default) (struct file *file, void *fh, | 258 | long (*vidioc_default) (struct file *file, void *fh, |
| 244 | int cmd, void *arg); | 259 | int cmd, void *arg); |
diff --git a/include/media/v4l2-mediabus.h b/include/media/v4l2-mediabus.h new file mode 100644 index 000000000000..0dbe02ada259 --- /dev/null +++ b/include/media/v4l2-mediabus.h | |||
| @@ -0,0 +1,61 @@ | |||
| 1 | /* | ||
| 2 | * Media Bus API header | ||
| 3 | * | ||
| 4 | * Copyright (C) 2009, Guennadi Liakhovetski <g.liakhovetski@gmx.de> | ||
| 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 V4L2_MEDIABUS_H | ||
| 12 | #define V4L2_MEDIABUS_H | ||
| 13 | |||
| 14 | /* | ||
| 15 | * These pixel codes uniquely identify data formats on the media bus. Mostly | ||
| 16 | * they correspond to similarly named V4L2_PIX_FMT_* formats, format 0 is | ||
| 17 | * reserved, V4L2_MBUS_FMT_FIXED shall be used by host-client pairs, where the | ||
| 18 | * data format is fixed. Additionally, "2X8" means that one pixel is transferred | ||
| 19 | * in two 8-bit samples, "BE" or "LE" specify in which order those samples are | ||
| 20 | * transferred over the bus: "LE" means that the least significant bits are | ||
| 21 | * transferred first, "BE" means that the most significant bits are transferred | ||
| 22 | * first, and "PADHI" and "PADLO" define which bits - low or high, in the | ||
| 23 | * incomplete high byte, are filled with padding bits. | ||
| 24 | */ | ||
| 25 | enum v4l2_mbus_pixelcode { | ||
| 26 | V4L2_MBUS_FMT_FIXED = 1, | ||
| 27 | V4L2_MBUS_FMT_YUYV8_2X8_LE, | ||
| 28 | V4L2_MBUS_FMT_YVYU8_2X8_LE, | ||
| 29 | V4L2_MBUS_FMT_YUYV8_2X8_BE, | ||
| 30 | V4L2_MBUS_FMT_YVYU8_2X8_BE, | ||
| 31 | V4L2_MBUS_FMT_RGB555_2X8_PADHI_LE, | ||
| 32 | V4L2_MBUS_FMT_RGB555_2X8_PADHI_BE, | ||
| 33 | V4L2_MBUS_FMT_RGB565_2X8_LE, | ||
| 34 | V4L2_MBUS_FMT_RGB565_2X8_BE, | ||
| 35 | V4L2_MBUS_FMT_SBGGR8_1X8, | ||
| 36 | V4L2_MBUS_FMT_SBGGR10_1X10, | ||
| 37 | V4L2_MBUS_FMT_GREY8_1X8, | ||
| 38 | V4L2_MBUS_FMT_Y10_1X10, | ||
| 39 | V4L2_MBUS_FMT_SBGGR10_2X8_PADHI_LE, | ||
| 40 | V4L2_MBUS_FMT_SBGGR10_2X8_PADLO_LE, | ||
| 41 | V4L2_MBUS_FMT_SBGGR10_2X8_PADHI_BE, | ||
| 42 | V4L2_MBUS_FMT_SBGGR10_2X8_PADLO_BE, | ||
| 43 | }; | ||
| 44 | |||
| 45 | /** | ||
| 46 | * struct v4l2_mbus_framefmt - frame format on the media bus | ||
| 47 | * @width: frame width | ||
| 48 | * @height: frame height | ||
| 49 | * @code: data format code | ||
| 50 | * @field: used interlacing type | ||
| 51 | * @colorspace: colorspace of the data | ||
| 52 | */ | ||
| 53 | struct v4l2_mbus_framefmt { | ||
| 54 | __u32 width; | ||
| 55 | __u32 height; | ||
| 56 | enum v4l2_mbus_pixelcode code; | ||
| 57 | enum v4l2_field field; | ||
| 58 | enum v4l2_colorspace colorspace; | ||
| 59 | }; | ||
| 60 | |||
| 61 | #endif | ||
diff --git a/include/media/v4l2-subdev.h b/include/media/v4l2-subdev.h index d411345f244b..2bcdca0a57fc 100644 --- a/include/media/v4l2-subdev.h +++ b/include/media/v4l2-subdev.h | |||
| @@ -22,6 +22,17 @@ | |||
| 22 | #define _V4L2_SUBDEV_H | 22 | #define _V4L2_SUBDEV_H |
| 23 | 23 | ||
| 24 | #include <media/v4l2-common.h> | 24 | #include <media/v4l2-common.h> |
| 25 | #include <media/v4l2-mediabus.h> | ||
| 26 | |||
| 27 | /* generic v4l2_device notify callback notification values */ | ||
| 28 | #define V4L2_SUBDEV_IR_RX_NOTIFY _IOW('v', 0, u32) | ||
| 29 | #define V4L2_SUBDEV_IR_RX_FIFO_SERVICE_REQ 0x00000001 | ||
| 30 | #define V4L2_SUBDEV_IR_RX_END_OF_RX_DETECTED 0x00000002 | ||
| 31 | #define V4L2_SUBDEV_IR_RX_HW_FIFO_OVERRUN 0x00000004 | ||
| 32 | #define V4L2_SUBDEV_IR_RX_SW_FIFO_OVERRUN 0x00000008 | ||
| 33 | |||
| 34 | #define V4L2_SUBDEV_IR_TX_NOTIFY _IOW('v', 1, u32) | ||
| 35 | #define V4L2_SUBDEV_IR_TX_FIFO_SERVICE_REQ 0x00000001 | ||
| 25 | 36 | ||
| 26 | struct v4l2_device; | 37 | struct v4l2_device; |
| 27 | struct v4l2_subdev; | 38 | struct v4l2_subdev; |
| @@ -96,6 +107,9 @@ struct v4l2_decode_vbi_line { | |||
| 96 | 107 | ||
| 97 | s_gpio: set GPIO pins. Very simple right now, might need to be extended with | 108 | s_gpio: set GPIO pins. Very simple right now, might need to be extended with |
| 98 | a direction argument if needed. | 109 | a direction argument if needed. |
| 110 | |||
| 111 | s_power: puts subdevice in power saving mode (on == 0) or normal operation | ||
| 112 | mode (on == 1). | ||
| 99 | */ | 113 | */ |
| 100 | struct v4l2_subdev_core_ops { | 114 | struct v4l2_subdev_core_ops { |
| 101 | int (*g_chip_ident)(struct v4l2_subdev *sd, struct v4l2_dbg_chip_ident *chip); | 115 | int (*g_chip_ident)(struct v4l2_subdev *sd, struct v4l2_dbg_chip_ident *chip); |
| @@ -118,6 +132,7 @@ struct v4l2_subdev_core_ops { | |||
| 118 | int (*g_register)(struct v4l2_subdev *sd, struct v4l2_dbg_register *reg); | 132 | int (*g_register)(struct v4l2_subdev *sd, struct v4l2_dbg_register *reg); |
| 119 | int (*s_register)(struct v4l2_subdev *sd, struct v4l2_dbg_register *reg); | 133 | int (*s_register)(struct v4l2_subdev *sd, struct v4l2_dbg_register *reg); |
| 120 | #endif | 134 | #endif |
| 135 | int (*s_power)(struct v4l2_subdev *sd, int on); | ||
| 121 | }; | 136 | }; |
| 122 | 137 | ||
| 123 | /* s_mode: switch the tuner to a specific tuner mode. Replacement of s_radio. | 138 | /* s_mode: switch the tuner to a specific tuner mode. Replacement of s_radio. |
| @@ -127,8 +142,6 @@ struct v4l2_subdev_core_ops { | |||
| 127 | s_type_addr: sets tuner type and its I2C addr. | 142 | s_type_addr: sets tuner type and its I2C addr. |
| 128 | 143 | ||
| 129 | s_config: sets tda9887 specific stuff, like port1, port2 and qss | 144 | s_config: sets tda9887 specific stuff, like port1, port2 and qss |
| 130 | |||
| 131 | s_standby: puts tuner on powersaving state, disabling it, except for i2c. | ||
| 132 | */ | 145 | */ |
| 133 | struct v4l2_subdev_tuner_ops { | 146 | struct v4l2_subdev_tuner_ops { |
| 134 | int (*s_mode)(struct v4l2_subdev *sd, enum v4l2_tuner_type); | 147 | int (*s_mode)(struct v4l2_subdev *sd, enum v4l2_tuner_type); |
| @@ -141,7 +154,6 @@ struct v4l2_subdev_tuner_ops { | |||
| 141 | int (*s_modulator)(struct v4l2_subdev *sd, struct v4l2_modulator *vm); | 154 | int (*s_modulator)(struct v4l2_subdev *sd, struct v4l2_modulator *vm); |
| 142 | int (*s_type_addr)(struct v4l2_subdev *sd, struct tuner_setup *type); | 155 | int (*s_type_addr)(struct v4l2_subdev *sd, struct tuner_setup *type); |
| 143 | int (*s_config)(struct v4l2_subdev *sd, const struct v4l2_priv_tun_config *config); | 156 | int (*s_config)(struct v4l2_subdev *sd, const struct v4l2_priv_tun_config *config); |
| 144 | int (*s_standby)(struct v4l2_subdev *sd); | ||
| 145 | }; | 157 | }; |
| 146 | 158 | ||
| 147 | /* s_clock_freq: set the frequency (in Hz) of the audio clock output. | 159 | /* s_clock_freq: set the frequency (in Hz) of the audio clock output. |
| @@ -168,6 +180,7 @@ struct v4l2_subdev_audio_ops { | |||
| 168 | int (*s_clock_freq)(struct v4l2_subdev *sd, u32 freq); | 180 | int (*s_clock_freq)(struct v4l2_subdev *sd, u32 freq); |
| 169 | int (*s_i2s_clock_freq)(struct v4l2_subdev *sd, u32 freq); | 181 | int (*s_i2s_clock_freq)(struct v4l2_subdev *sd, u32 freq); |
| 170 | int (*s_routing)(struct v4l2_subdev *sd, u32 input, u32 output, u32 config); | 182 | int (*s_routing)(struct v4l2_subdev *sd, u32 input, u32 output, u32 config); |
| 183 | int (*s_stream)(struct v4l2_subdev *sd, int enable); | ||
| 171 | }; | 184 | }; |
| 172 | 185 | ||
| 173 | /* | 186 | /* |
| @@ -196,7 +209,7 @@ struct v4l2_subdev_audio_ops { | |||
| 196 | s_std_output: set v4l2_std_id for video OUTPUT devices. This is ignored by | 209 | s_std_output: set v4l2_std_id for video OUTPUT devices. This is ignored by |
| 197 | video input devices. | 210 | video input devices. |
| 198 | 211 | ||
| 199 | s_crystal_freq: sets the frequency of the crystal used to generate the | 212 | s_crystal_freq: sets the frequency of the crystal used to generate the |
| 200 | clocks in Hz. An extra flags field allows device specific configuration | 213 | clocks in Hz. An extra flags field allows device specific configuration |
| 201 | regarding clock frequency dividers, etc. If not used, then set flags | 214 | regarding clock frequency dividers, etc. If not used, then set flags |
| 202 | to 0. If the frequency is not supported, then -EINVAL is returned. | 215 | to 0. If the frequency is not supported, then -EINVAL is returned. |
| @@ -206,6 +219,26 @@ struct v4l2_subdev_audio_ops { | |||
| 206 | 219 | ||
| 207 | s_routing: see s_routing in audio_ops, except this version is for video | 220 | s_routing: see s_routing in audio_ops, except this version is for video |
| 208 | devices. | 221 | devices. |
| 222 | |||
| 223 | s_dv_preset: set dv (Digital Video) preset in the sub device. Similar to | ||
| 224 | s_std() | ||
| 225 | |||
| 226 | query_dv_preset: query dv preset in the sub device. This is similar to | ||
| 227 | querystd() | ||
| 228 | |||
| 229 | s_dv_timings(): Set custom dv timings in the sub device. This is used | ||
| 230 | when sub device is capable of setting detailed timing information | ||
| 231 | in the hardware to generate/detect the video signal. | ||
| 232 | |||
| 233 | g_dv_timings(): Get custom dv timings in the sub device. | ||
| 234 | |||
| 235 | enum_mbus_fmt: enumerate pixel formats, provided by a video data source | ||
| 236 | |||
| 237 | g_mbus_fmt: get the current pixel format, provided by a video data source | ||
| 238 | |||
| 239 | try_mbus_fmt: try to set a pixel format on a video data source | ||
| 240 | |||
| 241 | s_mbus_fmt: set a pixel format on a video data source | ||
| 209 | */ | 242 | */ |
| 210 | struct v4l2_subdev_video_ops { | 243 | struct v4l2_subdev_video_ops { |
| 211 | int (*s_routing)(struct v4l2_subdev *sd, u32 input, u32 output, u32 config); | 244 | int (*s_routing)(struct v4l2_subdev *sd, u32 input, u32 output, u32 config); |
| @@ -229,13 +262,125 @@ struct v4l2_subdev_video_ops { | |||
| 229 | int (*s_parm)(struct v4l2_subdev *sd, struct v4l2_streamparm *param); | 262 | int (*s_parm)(struct v4l2_subdev *sd, struct v4l2_streamparm *param); |
| 230 | int (*enum_framesizes)(struct v4l2_subdev *sd, struct v4l2_frmsizeenum *fsize); | 263 | int (*enum_framesizes)(struct v4l2_subdev *sd, struct v4l2_frmsizeenum *fsize); |
| 231 | int (*enum_frameintervals)(struct v4l2_subdev *sd, struct v4l2_frmivalenum *fival); | 264 | int (*enum_frameintervals)(struct v4l2_subdev *sd, struct v4l2_frmivalenum *fival); |
| 265 | int (*s_dv_preset)(struct v4l2_subdev *sd, | ||
| 266 | struct v4l2_dv_preset *preset); | ||
| 267 | int (*query_dv_preset)(struct v4l2_subdev *sd, | ||
| 268 | struct v4l2_dv_preset *preset); | ||
| 269 | int (*s_dv_timings)(struct v4l2_subdev *sd, | ||
| 270 | struct v4l2_dv_timings *timings); | ||
| 271 | int (*g_dv_timings)(struct v4l2_subdev *sd, | ||
| 272 | struct v4l2_dv_timings *timings); | ||
| 273 | int (*enum_mbus_fmt)(struct v4l2_subdev *sd, int index, | ||
| 274 | enum v4l2_mbus_pixelcode *code); | ||
| 275 | int (*g_mbus_fmt)(struct v4l2_subdev *sd, | ||
| 276 | struct v4l2_mbus_framefmt *fmt); | ||
| 277 | int (*try_mbus_fmt)(struct v4l2_subdev *sd, | ||
| 278 | struct v4l2_mbus_framefmt *fmt); | ||
| 279 | int (*s_mbus_fmt)(struct v4l2_subdev *sd, | ||
| 280 | struct v4l2_mbus_framefmt *fmt); | ||
| 281 | }; | ||
| 282 | |||
| 283 | /** | ||
| 284 | * struct v4l2_subdev_sensor_ops - v4l2-subdev sensor operations | ||
| 285 | * @g_skip_top_lines: number of lines at the top of the image to be skipped. | ||
| 286 | * This is needed for some sensors, which always corrupt | ||
| 287 | * several top lines of the output image, or which send their | ||
| 288 | * metadata in them. | ||
| 289 | */ | ||
| 290 | struct v4l2_subdev_sensor_ops { | ||
| 291 | int (*g_skip_top_lines)(struct v4l2_subdev *sd, u32 *lines); | ||
| 292 | }; | ||
| 293 | |||
| 294 | /* | ||
| 295 | interrupt_service_routine: Called by the bridge chip's interrupt service | ||
| 296 | handler, when an IR interrupt status has be raised due to this subdev, | ||
| 297 | so that this subdev can handle the details. It may schedule work to be | ||
| 298 | performed later. It must not sleep. *Called from an IRQ context*. | ||
| 299 | |||
| 300 | [rt]x_g_parameters: Get the current operating parameters and state of the | ||
| 301 | the IR receiver or transmitter. | ||
| 302 | |||
| 303 | [rt]x_s_parameters: Set the current operating parameters and state of the | ||
| 304 | the IR receiver or transmitter. It is recommended to call | ||
| 305 | [rt]x_g_parameters first to fill out the current state, and only change | ||
| 306 | the fields that need to be changed. Upon return, the actual device | ||
| 307 | operating parameters and state will be returned. Note that hardware | ||
| 308 | limitations may prevent the actual settings from matching the requested | ||
| 309 | settings - e.g. an actual carrier setting of 35,904 Hz when 36,000 Hz | ||
| 310 | was requested. An exception is when the shutdown parameter is true. | ||
| 311 | The last used operational parameters will be returned, but the actual | ||
| 312 | state of the hardware be different to minimize power consumption and | ||
| 313 | processing when shutdown is true. | ||
| 314 | |||
| 315 | rx_read: Reads received codes or pulse width data. | ||
| 316 | The semantics are similar to a non-blocking read() call. | ||
| 317 | |||
| 318 | tx_write: Writes codes or pulse width data for transmission. | ||
| 319 | The semantics are similar to a non-blocking write() call. | ||
| 320 | */ | ||
| 321 | |||
| 322 | enum v4l2_subdev_ir_mode { | ||
| 323 | V4L2_SUBDEV_IR_MODE_PULSE_WIDTH, /* space & mark widths in nanosecs */ | ||
| 324 | }; | ||
| 325 | |||
| 326 | /* Data format of data read or written for V4L2_SUBDEV_IR_MODE_PULSE_WIDTH */ | ||
| 327 | #define V4L2_SUBDEV_IR_PULSE_MAX_WIDTH_NS 0x7fffffff | ||
| 328 | #define V4L2_SUBDEV_IR_PULSE_LEVEL_MASK 0x80000000 | ||
| 329 | #define V4L2_SUBDEV_IR_PULSE_RX_SEQ_END 0xffffffff | ||
| 330 | |||
| 331 | struct v4l2_subdev_ir_parameters { | ||
| 332 | /* Either Rx or Tx */ | ||
| 333 | unsigned int bytes_per_data_element; /* of data in read or write call */ | ||
| 334 | enum v4l2_subdev_ir_mode mode; | ||
| 335 | |||
| 336 | bool enable; | ||
| 337 | bool interrupt_enable; | ||
| 338 | bool shutdown; /* true: set hardware to low/no power, false: normal */ | ||
| 339 | |||
| 340 | bool modulation; /* true: uses carrier, false: baseband */ | ||
| 341 | u32 max_pulse_width; /* ns, valid only for baseband signal */ | ||
| 342 | unsigned int carrier_freq; /* Hz, valid only for modulated signal*/ | ||
| 343 | unsigned int duty_cycle; /* percent, valid only for modulated signal*/ | ||
| 344 | bool invert; /* logically invert sense of mark/space */ | ||
| 345 | |||
| 346 | /* Rx only */ | ||
| 347 | u32 noise_filter_min_width; /* ns, min time of a valid pulse */ | ||
| 348 | unsigned int carrier_range_lower; /* Hz, valid only for modulated sig */ | ||
| 349 | unsigned int carrier_range_upper; /* Hz, valid only for modulated sig */ | ||
| 350 | u32 resolution; /* ns */ | ||
| 351 | }; | ||
| 352 | |||
| 353 | struct v4l2_subdev_ir_ops { | ||
| 354 | /* Common to receiver and transmitter */ | ||
| 355 | int (*interrupt_service_routine)(struct v4l2_subdev *sd, | ||
| 356 | u32 status, bool *handled); | ||
| 357 | |||
| 358 | /* Receiver */ | ||
| 359 | int (*rx_read)(struct v4l2_subdev *sd, u8 *buf, size_t count, | ||
| 360 | ssize_t *num); | ||
| 361 | |||
| 362 | int (*rx_g_parameters)(struct v4l2_subdev *sd, | ||
| 363 | struct v4l2_subdev_ir_parameters *params); | ||
| 364 | int (*rx_s_parameters)(struct v4l2_subdev *sd, | ||
| 365 | struct v4l2_subdev_ir_parameters *params); | ||
| 366 | |||
| 367 | /* Transmitter */ | ||
| 368 | int (*tx_write)(struct v4l2_subdev *sd, u8 *buf, size_t count, | ||
| 369 | ssize_t *num); | ||
| 370 | |||
| 371 | int (*tx_g_parameters)(struct v4l2_subdev *sd, | ||
| 372 | struct v4l2_subdev_ir_parameters *params); | ||
| 373 | int (*tx_s_parameters)(struct v4l2_subdev *sd, | ||
| 374 | struct v4l2_subdev_ir_parameters *params); | ||
| 232 | }; | 375 | }; |
| 233 | 376 | ||
| 234 | struct v4l2_subdev_ops { | 377 | struct v4l2_subdev_ops { |
| 235 | const struct v4l2_subdev_core_ops *core; | 378 | const struct v4l2_subdev_core_ops *core; |
| 236 | const struct v4l2_subdev_tuner_ops *tuner; | 379 | const struct v4l2_subdev_tuner_ops *tuner; |
| 237 | const struct v4l2_subdev_audio_ops *audio; | 380 | const struct v4l2_subdev_audio_ops *audio; |
| 238 | const struct v4l2_subdev_video_ops *video; | 381 | const struct v4l2_subdev_video_ops *video; |
| 382 | const struct v4l2_subdev_ir_ops *ir; | ||
| 383 | const struct v4l2_subdev_sensor_ops *sensor; | ||
| 239 | }; | 384 | }; |
| 240 | 385 | ||
| 241 | #define V4L2_SUBDEV_NAME_SIZE 32 | 386 | #define V4L2_SUBDEV_NAME_SIZE 32 |
| @@ -290,7 +435,7 @@ static inline void v4l2_subdev_init(struct v4l2_subdev *sd, | |||
| 290 | Example: err = v4l2_subdev_call(sd, core, g_chip_ident, &chip); | 435 | Example: err = v4l2_subdev_call(sd, core, g_chip_ident, &chip); |
| 291 | */ | 436 | */ |
| 292 | #define v4l2_subdev_call(sd, o, f, args...) \ | 437 | #define v4l2_subdev_call(sd, o, f, args...) \ |
| 293 | (!(sd) ? -ENODEV : (((sd) && (sd)->ops->o && (sd)->ops->o->f) ? \ | 438 | (!(sd) ? -ENODEV : (((sd)->ops->o && (sd)->ops->o->f) ? \ |
| 294 | (sd)->ops->o->f((sd) , ##args) : -ENOIOCTLCMD)) | 439 | (sd)->ops->o->f((sd) , ##args) : -ENOIOCTLCMD)) |
| 295 | 440 | ||
| 296 | /* Send a notification to v4l2_device. */ | 441 | /* Send a notification to v4l2_device. */ |
diff --git a/include/media/videobuf-core.h b/include/media/videobuf-core.h index 1c5946c44758..316fdccdcaa0 100644 --- a/include/media/videobuf-core.h +++ b/include/media/videobuf-core.h | |||
| @@ -166,7 +166,7 @@ struct videobuf_queue { | |||
| 166 | enum v4l2_field field; | 166 | enum v4l2_field field; |
| 167 | enum v4l2_field last; /* for field=V4L2_FIELD_ALTERNATE */ | 167 | enum v4l2_field last; /* for field=V4L2_FIELD_ALTERNATE */ |
| 168 | struct videobuf_buffer *bufs[VIDEO_MAX_FRAME]; | 168 | struct videobuf_buffer *bufs[VIDEO_MAX_FRAME]; |
| 169 | struct videobuf_queue_ops *ops; | 169 | const struct videobuf_queue_ops *ops; |
| 170 | struct videobuf_qtype_ops *int_ops; | 170 | struct videobuf_qtype_ops *int_ops; |
| 171 | 171 | ||
| 172 | unsigned int streaming:1; | 172 | unsigned int streaming:1; |
| @@ -195,7 +195,7 @@ void *videobuf_queue_to_vmalloc (struct videobuf_queue* q, | |||
| 195 | struct videobuf_buffer *buf); | 195 | struct videobuf_buffer *buf); |
| 196 | 196 | ||
| 197 | void videobuf_queue_core_init(struct videobuf_queue *q, | 197 | void videobuf_queue_core_init(struct videobuf_queue *q, |
| 198 | struct videobuf_queue_ops *ops, | 198 | const struct videobuf_queue_ops *ops, |
| 199 | struct device *dev, | 199 | struct device *dev, |
| 200 | spinlock_t *irqlock, | 200 | spinlock_t *irqlock, |
| 201 | enum v4l2_buf_type type, | 201 | enum v4l2_buf_type type, |
diff --git a/include/media/videobuf-dma-contig.h b/include/media/videobuf-dma-contig.h index 549386681aab..ebaa9bc1ee8d 100644 --- a/include/media/videobuf-dma-contig.h +++ b/include/media/videobuf-dma-contig.h | |||
| @@ -17,7 +17,7 @@ | |||
| 17 | #include <media/videobuf-core.h> | 17 | #include <media/videobuf-core.h> |
| 18 | 18 | ||
| 19 | void videobuf_queue_dma_contig_init(struct videobuf_queue *q, | 19 | void videobuf_queue_dma_contig_init(struct videobuf_queue *q, |
| 20 | struct videobuf_queue_ops *ops, | 20 | const struct videobuf_queue_ops *ops, |
| 21 | struct device *dev, | 21 | struct device *dev, |
| 22 | spinlock_t *irqlock, | 22 | spinlock_t *irqlock, |
| 23 | enum v4l2_buf_type type, | 23 | enum v4l2_buf_type type, |
diff --git a/include/media/videobuf-dma-sg.h b/include/media/videobuf-dma-sg.h index dda47f0082e9..53e72f787175 100644 --- a/include/media/videobuf-dma-sg.h +++ b/include/media/videobuf-dma-sg.h | |||
| @@ -103,7 +103,7 @@ struct videobuf_dmabuf *videobuf_to_dma (struct videobuf_buffer *buf); | |||
| 103 | void *videobuf_sg_alloc(size_t size); | 103 | void *videobuf_sg_alloc(size_t size); |
| 104 | 104 | ||
| 105 | void videobuf_queue_sg_init(struct videobuf_queue* q, | 105 | void videobuf_queue_sg_init(struct videobuf_queue* q, |
| 106 | struct videobuf_queue_ops *ops, | 106 | const struct videobuf_queue_ops *ops, |
| 107 | struct device *dev, | 107 | struct device *dev, |
| 108 | spinlock_t *irqlock, | 108 | spinlock_t *irqlock, |
| 109 | enum v4l2_buf_type type, | 109 | enum v4l2_buf_type type, |
diff --git a/include/media/videobuf-dvb.h b/include/media/videobuf-dvb.h index 6ba4f1271d23..07cf4b9d0a65 100644 --- a/include/media/videobuf-dvb.h +++ b/include/media/videobuf-dvb.h | |||
| @@ -42,7 +42,9 @@ int videobuf_dvb_register_bus(struct videobuf_dvb_frontends *f, | |||
| 42 | void *adapter_priv, | 42 | void *adapter_priv, |
| 43 | struct device *device, | 43 | struct device *device, |
| 44 | short *adapter_nr, | 44 | short *adapter_nr, |
| 45 | int mfe_shared); | 45 | int mfe_shared, |
| 46 | int (*fe_ioctl_override)(struct dvb_frontend *, | ||
| 47 | unsigned int, void *, unsigned int)); | ||
| 46 | 48 | ||
| 47 | void videobuf_dvb_unregister_bus(struct videobuf_dvb_frontends *f); | 49 | void videobuf_dvb_unregister_bus(struct videobuf_dvb_frontends *f); |
| 48 | 50 | ||
diff --git a/include/media/videobuf-vmalloc.h b/include/media/videobuf-vmalloc.h index e87222c6a125..4b419a257a7d 100644 --- a/include/media/videobuf-vmalloc.h +++ b/include/media/videobuf-vmalloc.h | |||
| @@ -30,8 +30,8 @@ struct videobuf_vmalloc_memory | |||
| 30 | }; | 30 | }; |
| 31 | 31 | ||
| 32 | void videobuf_queue_vmalloc_init(struct videobuf_queue* q, | 32 | void videobuf_queue_vmalloc_init(struct videobuf_queue* q, |
| 33 | struct videobuf_queue_ops *ops, | 33 | const struct videobuf_queue_ops *ops, |
| 34 | void *dev, | 34 | struct device *dev, |
| 35 | spinlock_t *irqlock, | 35 | spinlock_t *irqlock, |
| 36 | enum v4l2_buf_type type, | 36 | enum v4l2_buf_type type, |
| 37 | enum v4l2_field field, | 37 | enum v4l2_field field, |
diff --git a/include/net/9p/client.h b/include/net/9p/client.h index fb00b329f0d3..4f3760afc20f 100644 --- a/include/net/9p/client.h +++ b/include/net/9p/client.h | |||
| @@ -29,6 +29,19 @@ | |||
| 29 | /* Number of requests per row */ | 29 | /* Number of requests per row */ |
| 30 | #define P9_ROW_MAXTAG 255 | 30 | #define P9_ROW_MAXTAG 255 |
| 31 | 31 | ||
| 32 | /** enum p9_proto_versions - 9P protocol versions | ||
| 33 | * @p9_proto_legacy: 9P Legacy mode, pre-9P2000.u | ||
| 34 | * @p9_proto_2000u: 9P2000.u extension | ||
| 35 | * @p9_proto_2000L: 9P2000.L extension | ||
| 36 | */ | ||
| 37 | |||
| 38 | enum p9_proto_versions{ | ||
| 39 | p9_proto_legacy = 0, | ||
| 40 | p9_proto_2000u = 1, | ||
| 41 | p9_proto_2000L = 2, | ||
| 42 | }; | ||
| 43 | |||
| 44 | |||
| 32 | /** | 45 | /** |
| 33 | * enum p9_trans_status - different states of underlying transports | 46 | * enum p9_trans_status - different states of underlying transports |
| 34 | * @Connected: transport is connected and healthy | 47 | * @Connected: transport is connected and healthy |
| @@ -41,6 +54,7 @@ | |||
| 41 | 54 | ||
| 42 | enum p9_trans_status { | 55 | enum p9_trans_status { |
| 43 | Connected, | 56 | Connected, |
| 57 | BeginDisconnect, | ||
| 44 | Disconnected, | 58 | Disconnected, |
| 45 | Hung, | 59 | Hung, |
| 46 | }; | 60 | }; |
| @@ -111,6 +125,7 @@ struct p9_req_t { | |||
| 111 | * @lock: protect @fidlist | 125 | * @lock: protect @fidlist |
| 112 | * @msize: maximum data size negotiated by protocol | 126 | * @msize: maximum data size negotiated by protocol |
| 113 | * @dotu: extension flags negotiated by protocol | 127 | * @dotu: extension flags negotiated by protocol |
| 128 | * @proto_version: 9P protocol version to use | ||
| 114 | * @trans_mod: module API instantiated with this client | 129 | * @trans_mod: module API instantiated with this client |
| 115 | * @trans: tranport instance state and API | 130 | * @trans: tranport instance state and API |
| 116 | * @conn: connection state information used by trans_fd | 131 | * @conn: connection state information used by trans_fd |
| @@ -137,7 +152,7 @@ struct p9_req_t { | |||
| 137 | struct p9_client { | 152 | struct p9_client { |
| 138 | spinlock_t lock; /* protect client structure */ | 153 | spinlock_t lock; /* protect client structure */ |
| 139 | int msize; | 154 | int msize; |
| 140 | unsigned char dotu; | 155 | unsigned char proto_version; |
| 141 | struct p9_trans_module *trans_mod; | 156 | struct p9_trans_module *trans_mod; |
| 142 | enum p9_trans_status status; | 157 | enum p9_trans_status status; |
| 143 | void *trans; | 158 | void *trans; |
| @@ -184,6 +199,7 @@ int p9_client_version(struct p9_client *); | |||
| 184 | struct p9_client *p9_client_create(const char *dev_name, char *options); | 199 | struct p9_client *p9_client_create(const char *dev_name, char *options); |
| 185 | void p9_client_destroy(struct p9_client *clnt); | 200 | void p9_client_destroy(struct p9_client *clnt); |
| 186 | void p9_client_disconnect(struct p9_client *clnt); | 201 | void p9_client_disconnect(struct p9_client *clnt); |
| 202 | void p9_client_begin_disconnect(struct p9_client *clnt); | ||
| 187 | struct p9_fid *p9_client_attach(struct p9_client *clnt, struct p9_fid *afid, | 203 | struct p9_fid *p9_client_attach(struct p9_client *clnt, struct p9_fid *afid, |
| 188 | char *uname, u32 n_uname, char *aname); | 204 | char *uname, u32 n_uname, char *aname); |
| 189 | struct p9_fid *p9_client_auth(struct p9_client *clnt, char *uname, | 205 | struct p9_fid *p9_client_auth(struct p9_client *clnt, char *uname, |
| @@ -209,5 +225,7 @@ int p9_parse_header(struct p9_fcall *, int32_t *, int8_t *, int16_t *, int); | |||
| 209 | int p9stat_read(char *, int, struct p9_wstat *, int); | 225 | int p9stat_read(char *, int, struct p9_wstat *, int); |
| 210 | void p9stat_free(struct p9_wstat *); | 226 | void p9stat_free(struct p9_wstat *); |
| 211 | 227 | ||
| 228 | int p9_is_proto_dotu(struct p9_client *clnt); | ||
| 229 | int p9_is_proto_dotl(struct p9_client *clnt); | ||
| 212 | 230 | ||
| 213 | #endif /* NET_9P_CLIENT_H */ | 231 | #endif /* NET_9P_CLIENT_H */ |
diff --git a/include/net/addrconf.h b/include/net/addrconf.h index 0f7c37825fc1..45375b41a2a0 100644 --- a/include/net/addrconf.h +++ b/include/net/addrconf.h | |||
| @@ -177,7 +177,9 @@ extern int unregister_inet6addr_notifier(struct notifier_block *nb); | |||
| 177 | static inline struct inet6_dev * | 177 | static inline struct inet6_dev * |
| 178 | __in6_dev_get(struct net_device *dev) | 178 | __in6_dev_get(struct net_device *dev) |
| 179 | { | 179 | { |
| 180 | return rcu_dereference(dev->ip6_ptr); | 180 | return rcu_dereference_check(dev->ip6_ptr, |
| 181 | rcu_read_lock_held() || | ||
| 182 | lockdep_rtnl_is_held()); | ||
| 181 | } | 183 | } |
| 182 | 184 | ||
| 183 | static inline struct inet6_dev * | 185 | static inline struct inet6_dev * |
diff --git a/include/net/ah.h b/include/net/ah.h index ae1c322f4242..f0129f79a31a 100644 --- a/include/net/ah.h +++ b/include/net/ah.h | |||
| @@ -1,43 +1,20 @@ | |||
| 1 | #ifndef _NET_AH_H | 1 | #ifndef _NET_AH_H |
| 2 | #define _NET_AH_H | 2 | #define _NET_AH_H |
| 3 | 3 | ||
| 4 | #include <linux/crypto.h> | 4 | #include <linux/skbuff.h> |
| 5 | #include <net/xfrm.h> | ||
| 6 | 5 | ||
| 7 | /* This is the maximum truncated ICV length that we know of. */ | 6 | /* This is the maximum truncated ICV length that we know of. */ |
| 8 | #define MAX_AH_AUTH_LEN 12 | 7 | #define MAX_AH_AUTH_LEN 12 |
| 9 | 8 | ||
| 10 | struct ah_data | 9 | struct crypto_ahash; |
| 11 | { | 10 | |
| 12 | u8 *work_icv; | 11 | struct ah_data { |
| 13 | int icv_full_len; | 12 | int icv_full_len; |
| 14 | int icv_trunc_len; | 13 | int icv_trunc_len; |
| 15 | 14 | ||
| 16 | struct crypto_hash *tfm; | 15 | struct crypto_ahash *ahash; |
| 17 | }; | 16 | }; |
| 18 | 17 | ||
| 19 | static inline int ah_mac_digest(struct ah_data *ahp, struct sk_buff *skb, | ||
| 20 | u8 *auth_data) | ||
| 21 | { | ||
| 22 | struct hash_desc desc; | ||
| 23 | int err; | ||
| 24 | |||
| 25 | desc.tfm = ahp->tfm; | ||
| 26 | desc.flags = 0; | ||
| 27 | |||
| 28 | memset(auth_data, 0, ahp->icv_trunc_len); | ||
| 29 | err = crypto_hash_init(&desc); | ||
| 30 | if (unlikely(err)) | ||
| 31 | goto out; | ||
| 32 | err = skb_icv_walk(skb, &desc, 0, skb->len, crypto_hash_update); | ||
| 33 | if (unlikely(err)) | ||
| 34 | goto out; | ||
| 35 | err = crypto_hash_final(&desc, ahp->work_icv); | ||
| 36 | |||
| 37 | out: | ||
| 38 | return err; | ||
| 39 | } | ||
| 40 | |||
| 41 | struct ip_auth_hdr; | 18 | struct ip_auth_hdr; |
| 42 | 19 | ||
| 43 | static inline struct ip_auth_hdr *ip_auth_hdr(const struct sk_buff *skb) | 20 | static inline struct ip_auth_hdr *ip_auth_hdr(const struct sk_buff *skb) |
diff --git a/include/net/ax25.h b/include/net/ax25.h index 717e2192d521..206d22297ac3 100644 --- a/include/net/ax25.h +++ b/include/net/ax25.h | |||
| @@ -10,6 +10,7 @@ | |||
| 10 | #include <linux/spinlock.h> | 10 | #include <linux/spinlock.h> |
| 11 | #include <linux/timer.h> | 11 | #include <linux/timer.h> |
| 12 | #include <linux/list.h> | 12 | #include <linux/list.h> |
| 13 | #include <linux/slab.h> | ||
| 13 | #include <asm/atomic.h> | 14 | #include <asm/atomic.h> |
| 14 | 15 | ||
| 15 | #define AX25_T1CLAMPLO 1 | 16 | #define AX25_T1CLAMPLO 1 |
diff --git a/include/net/bluetooth/bluetooth.h b/include/net/bluetooth/bluetooth.h index 718394e2c01e..ff77e8f882f1 100644 --- a/include/net/bluetooth/bluetooth.h +++ b/include/net/bluetooth/bluetooth.h | |||
| @@ -121,7 +121,7 @@ struct bt_sock_list { | |||
| 121 | rwlock_t lock; | 121 | rwlock_t lock; |
| 122 | }; | 122 | }; |
| 123 | 123 | ||
| 124 | int bt_sock_register(int proto, struct net_proto_family *ops); | 124 | int bt_sock_register(int proto, const struct net_proto_family *ops); |
| 125 | int bt_sock_unregister(int proto); | 125 | int bt_sock_unregister(int proto); |
| 126 | void bt_sock_link(struct bt_sock_list *l, struct sock *s); | 126 | void bt_sock_link(struct bt_sock_list *l, struct sock *s); |
| 127 | void bt_sock_unlink(struct bt_sock_list *l, struct sock *s); | 127 | void bt_sock_unlink(struct bt_sock_list *l, struct sock *s); |
| @@ -176,6 +176,6 @@ extern void hci_sock_cleanup(void); | |||
| 176 | extern int bt_sysfs_init(void); | 176 | extern int bt_sysfs_init(void); |
| 177 | extern void bt_sysfs_cleanup(void); | 177 | extern void bt_sysfs_cleanup(void); |
| 178 | 178 | ||
| 179 | extern struct class *bt_class; | 179 | extern struct dentry *bt_debugfs; |
| 180 | 180 | ||
| 181 | #endif /* __BLUETOOTH_H */ | 181 | #endif /* __BLUETOOTH_H */ |
diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h index ed3aea1605e8..fc0c502d9fd1 100644 --- a/include/net/bluetooth/hci.h +++ b/include/net/bluetooth/hci.h | |||
| @@ -43,7 +43,7 @@ | |||
| 43 | #define HCI_NOTIFY_CONN_DEL 2 | 43 | #define HCI_NOTIFY_CONN_DEL 2 |
| 44 | #define HCI_NOTIFY_VOICE_SETTING 3 | 44 | #define HCI_NOTIFY_VOICE_SETTING 3 |
| 45 | 45 | ||
| 46 | /* HCI device types */ | 46 | /* HCI bus types */ |
| 47 | #define HCI_VIRTUAL 0 | 47 | #define HCI_VIRTUAL 0 |
| 48 | #define HCI_USB 1 | 48 | #define HCI_USB 1 |
| 49 | #define HCI_PCCARD 2 | 49 | #define HCI_PCCARD 2 |
| @@ -52,6 +52,10 @@ | |||
| 52 | #define HCI_PCI 5 | 52 | #define HCI_PCI 5 |
| 53 | #define HCI_SDIO 6 | 53 | #define HCI_SDIO 6 |
| 54 | 54 | ||
| 55 | /* HCI controller types */ | ||
| 56 | #define HCI_BREDR 0x00 | ||
| 57 | #define HCI_80211 0x01 | ||
| 58 | |||
| 55 | /* HCI device quirks */ | 59 | /* HCI device quirks */ |
| 56 | enum { | 60 | enum { |
| 57 | HCI_QUIRK_NO_RESET, | 61 | HCI_QUIRK_NO_RESET, |
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h index 7b640aeddb64..ce3c99e5fa25 100644 --- a/include/net/bluetooth/hci_core.h +++ b/include/net/bluetooth/hci_core.h | |||
| @@ -70,7 +70,8 @@ struct hci_dev { | |||
| 70 | char name[8]; | 70 | char name[8]; |
| 71 | unsigned long flags; | 71 | unsigned long flags; |
| 72 | __u16 id; | 72 | __u16 id; |
| 73 | __u8 type; | 73 | __u8 bus; |
| 74 | __u8 dev_type; | ||
| 74 | bdaddr_t bdaddr; | 75 | bdaddr_t bdaddr; |
| 75 | __u8 dev_name[248]; | 76 | __u8 dev_name[248]; |
| 76 | __u8 dev_class[3]; | 77 | __u8 dev_class[3]; |
| @@ -134,6 +135,8 @@ struct hci_dev { | |||
| 134 | 135 | ||
| 135 | atomic_t promisc; | 136 | atomic_t promisc; |
| 136 | 137 | ||
| 138 | struct dentry *debugfs; | ||
| 139 | |||
| 137 | struct device *parent; | 140 | struct device *parent; |
| 138 | struct device dev; | 141 | struct device dev; |
| 139 | 142 | ||
| @@ -367,22 +370,6 @@ static inline void hci_conn_put(struct hci_conn *conn) | |||
| 367 | } | 370 | } |
| 368 | } | 371 | } |
| 369 | 372 | ||
| 370 | /* ----- HCI tasks ----- */ | ||
| 371 | static inline void hci_sched_cmd(struct hci_dev *hdev) | ||
| 372 | { | ||
| 373 | tasklet_schedule(&hdev->cmd_task); | ||
| 374 | } | ||
| 375 | |||
| 376 | static inline void hci_sched_rx(struct hci_dev *hdev) | ||
| 377 | { | ||
| 378 | tasklet_schedule(&hdev->rx_task); | ||
| 379 | } | ||
| 380 | |||
| 381 | static inline void hci_sched_tx(struct hci_dev *hdev) | ||
| 382 | { | ||
| 383 | tasklet_schedule(&hdev->tx_task); | ||
| 384 | } | ||
| 385 | |||
| 386 | /* ----- HCI Devices ----- */ | 373 | /* ----- HCI Devices ----- */ |
| 387 | static inline void __hci_dev_put(struct hci_dev *d) | 374 | static inline void __hci_dev_put(struct hci_dev *d) |
| 388 | { | 375 | { |
| @@ -437,28 +424,7 @@ int hci_inquiry(void __user *arg); | |||
| 437 | 424 | ||
| 438 | void hci_event_packet(struct hci_dev *hdev, struct sk_buff *skb); | 425 | void hci_event_packet(struct hci_dev *hdev, struct sk_buff *skb); |
| 439 | 426 | ||
| 440 | /* Receive frame from HCI drivers */ | 427 | int hci_recv_frame(struct sk_buff *skb); |
| 441 | static inline int hci_recv_frame(struct sk_buff *skb) | ||
| 442 | { | ||
| 443 | struct hci_dev *hdev = (struct hci_dev *) skb->dev; | ||
| 444 | if (!hdev || (!test_bit(HCI_UP, &hdev->flags) | ||
| 445 | && !test_bit(HCI_INIT, &hdev->flags))) { | ||
| 446 | kfree_skb(skb); | ||
| 447 | return -ENXIO; | ||
| 448 | } | ||
| 449 | |||
| 450 | /* Incomming skb */ | ||
| 451 | bt_cb(skb)->incoming = 1; | ||
| 452 | |||
| 453 | /* Time stamp */ | ||
| 454 | __net_timestamp(skb); | ||
| 455 | |||
| 456 | /* Queue frame for rx task */ | ||
| 457 | skb_queue_tail(&hdev->rx_q, skb); | ||
| 458 | hci_sched_rx(hdev); | ||
| 459 | return 0; | ||
| 460 | } | ||
| 461 | |||
| 462 | int hci_recv_fragment(struct hci_dev *hdev, int type, void *data, int count); | 428 | int hci_recv_fragment(struct hci_dev *hdev, int type, void *data, int count); |
| 463 | 429 | ||
| 464 | int hci_register_sysfs(struct hci_dev *hdev); | 430 | int hci_register_sysfs(struct hci_dev *hdev); |
diff --git a/include/net/bluetooth/l2cap.h b/include/net/bluetooth/l2cap.h index 9516f4b4a3c2..17a689f27a6a 100644 --- a/include/net/bluetooth/l2cap.h +++ b/include/net/bluetooth/l2cap.h | |||
| @@ -324,7 +324,6 @@ struct l2cap_pinfo { | |||
| 324 | 324 | ||
| 325 | __u8 next_tx_seq; | 325 | __u8 next_tx_seq; |
| 326 | __u8 expected_ack_seq; | 326 | __u8 expected_ack_seq; |
| 327 | __u8 req_seq; | ||
| 328 | __u8 expected_tx_seq; | 327 | __u8 expected_tx_seq; |
| 329 | __u8 buffer_seq; | 328 | __u8 buffer_seq; |
| 330 | __u8 buffer_seq_srej; | 329 | __u8 buffer_seq_srej; |
| @@ -375,6 +374,7 @@ struct l2cap_pinfo { | |||
| 375 | #define L2CAP_CONN_SEND_PBIT 0x10 | 374 | #define L2CAP_CONN_SEND_PBIT 0x10 |
| 376 | #define L2CAP_CONN_REMOTE_BUSY 0x20 | 375 | #define L2CAP_CONN_REMOTE_BUSY 0x20 |
| 377 | #define L2CAP_CONN_LOCAL_BUSY 0x40 | 376 | #define L2CAP_CONN_LOCAL_BUSY 0x40 |
| 377 | #define L2CAP_CONN_REJ_ACT 0x80 | ||
| 378 | 378 | ||
| 379 | #define __mod_retrans_timer() mod_timer(&l2cap_pi(sk)->retrans_timer, \ | 379 | #define __mod_retrans_timer() mod_timer(&l2cap_pi(sk)->retrans_timer, \ |
| 380 | jiffies + msecs_to_jiffies(L2CAP_DEFAULT_RETRANS_TO)); | 380 | jiffies + msecs_to_jiffies(L2CAP_DEFAULT_RETRANS_TO)); |
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h index 3d874c620219..3d134a1fb96b 100644 --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h | |||
| @@ -3,7 +3,7 @@ | |||
| 3 | /* | 3 | /* |
| 4 | * 802.11 device and configuration interface | 4 | * 802.11 device and configuration interface |
| 5 | * | 5 | * |
| 6 | * Copyright 2006-2009 Johannes Berg <johannes@sipsolutions.net> | 6 | * Copyright 2006-2010 Johannes Berg <johannes@sipsolutions.net> |
| 7 | * | 7 | * |
| 8 | * 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 |
| 9 | * 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 |
| @@ -39,8 +39,8 @@ | |||
| 39 | * @IEEE80211_BAND_5GHZ: around 5GHz band (4.9-5.7) | 39 | * @IEEE80211_BAND_5GHZ: around 5GHz band (4.9-5.7) |
| 40 | */ | 40 | */ |
| 41 | enum ieee80211_band { | 41 | enum ieee80211_band { |
| 42 | IEEE80211_BAND_2GHZ, | 42 | IEEE80211_BAND_2GHZ = NL80211_BAND_2GHZ, |
| 43 | IEEE80211_BAND_5GHZ, | 43 | IEEE80211_BAND_5GHZ = NL80211_BAND_5GHZ, |
| 44 | 44 | ||
| 45 | /* keep last */ | 45 | /* keep last */ |
| 46 | IEEE80211_NUM_BANDS | 46 | IEEE80211_NUM_BANDS |
| @@ -206,10 +206,12 @@ struct ieee80211_supported_band { | |||
| 206 | * struct vif_params - describes virtual interface parameters | 206 | * struct vif_params - describes virtual interface parameters |
| 207 | * @mesh_id: mesh ID to use | 207 | * @mesh_id: mesh ID to use |
| 208 | * @mesh_id_len: length of the mesh ID | 208 | * @mesh_id_len: length of the mesh ID |
| 209 | * @use_4addr: use 4-address frames | ||
| 209 | */ | 210 | */ |
| 210 | struct vif_params { | 211 | struct vif_params { |
| 211 | u8 *mesh_id; | 212 | u8 *mesh_id; |
| 212 | int mesh_id_len; | 213 | int mesh_id_len; |
| 214 | int use_4addr; | ||
| 213 | }; | 215 | }; |
| 214 | 216 | ||
| 215 | /** | 217 | /** |
| @@ -233,6 +235,35 @@ struct key_params { | |||
| 233 | }; | 235 | }; |
| 234 | 236 | ||
| 235 | /** | 237 | /** |
| 238 | * enum survey_info_flags - survey information flags | ||
| 239 | * | ||
| 240 | * Used by the driver to indicate which info in &struct survey_info | ||
| 241 | * it has filled in during the get_survey(). | ||
| 242 | */ | ||
| 243 | enum survey_info_flags { | ||
| 244 | SURVEY_INFO_NOISE_DBM = 1<<0, | ||
| 245 | }; | ||
| 246 | |||
| 247 | /** | ||
| 248 | * struct survey_info - channel survey response | ||
| 249 | * | ||
| 250 | * Used by dump_survey() to report back per-channel survey information. | ||
| 251 | * | ||
| 252 | * @channel: the channel this survey record reports, mandatory | ||
| 253 | * @filled: bitflag of flags from &enum survey_info_flags | ||
| 254 | * @noise: channel noise in dBm. This and all following fields are | ||
| 255 | * optional | ||
| 256 | * | ||
| 257 | * This structure can later be expanded with things like | ||
| 258 | * channel duty cycle etc. | ||
| 259 | */ | ||
| 260 | struct survey_info { | ||
| 261 | struct ieee80211_channel *channel; | ||
| 262 | u32 filled; | ||
| 263 | s8 noise; | ||
| 264 | }; | ||
| 265 | |||
| 266 | /** | ||
| 236 | * struct beacon_parameters - beacon parameters | 267 | * struct beacon_parameters - beacon parameters |
| 237 | * | 268 | * |
| 238 | * Used to configure the beacon for an interface. | 269 | * Used to configure the beacon for an interface. |
| @@ -418,7 +449,7 @@ enum monitor_flags { | |||
| 418 | * in during get_station() or dump_station(). | 449 | * in during get_station() or dump_station(). |
| 419 | * | 450 | * |
| 420 | * MPATH_INFO_FRAME_QLEN: @frame_qlen filled | 451 | * MPATH_INFO_FRAME_QLEN: @frame_qlen filled |
| 421 | * MPATH_INFO_DSN: @dsn filled | 452 | * MPATH_INFO_SN: @sn filled |
| 422 | * MPATH_INFO_METRIC: @metric filled | 453 | * MPATH_INFO_METRIC: @metric filled |
| 423 | * MPATH_INFO_EXPTIME: @exptime filled | 454 | * MPATH_INFO_EXPTIME: @exptime filled |
| 424 | * MPATH_INFO_DISCOVERY_TIMEOUT: @discovery_timeout filled | 455 | * MPATH_INFO_DISCOVERY_TIMEOUT: @discovery_timeout filled |
| @@ -427,7 +458,7 @@ enum monitor_flags { | |||
| 427 | */ | 458 | */ |
| 428 | enum mpath_info_flags { | 459 | enum mpath_info_flags { |
| 429 | MPATH_INFO_FRAME_QLEN = BIT(0), | 460 | MPATH_INFO_FRAME_QLEN = BIT(0), |
| 430 | MPATH_INFO_DSN = BIT(1), | 461 | MPATH_INFO_SN = BIT(1), |
| 431 | MPATH_INFO_METRIC = BIT(2), | 462 | MPATH_INFO_METRIC = BIT(2), |
| 432 | MPATH_INFO_EXPTIME = BIT(3), | 463 | MPATH_INFO_EXPTIME = BIT(3), |
| 433 | MPATH_INFO_DISCOVERY_TIMEOUT = BIT(4), | 464 | MPATH_INFO_DISCOVERY_TIMEOUT = BIT(4), |
| @@ -442,7 +473,7 @@ enum mpath_info_flags { | |||
| 442 | * | 473 | * |
| 443 | * @filled: bitfield of flags from &enum mpath_info_flags | 474 | * @filled: bitfield of flags from &enum mpath_info_flags |
| 444 | * @frame_qlen: number of queued frames for this destination | 475 | * @frame_qlen: number of queued frames for this destination |
| 445 | * @dsn: destination sequence number | 476 | * @sn: target sequence number |
| 446 | * @metric: metric (cost) of this mesh path | 477 | * @metric: metric (cost) of this mesh path |
| 447 | * @exptime: expiration time for the mesh path from now, in msecs | 478 | * @exptime: expiration time for the mesh path from now, in msecs |
| 448 | * @flags: mesh path flags | 479 | * @flags: mesh path flags |
| @@ -456,7 +487,7 @@ enum mpath_info_flags { | |||
| 456 | struct mpath_info { | 487 | struct mpath_info { |
| 457 | u32 filled; | 488 | u32 filled; |
| 458 | u32 frame_qlen; | 489 | u32 frame_qlen; |
| 459 | u32 dsn; | 490 | u32 sn; |
| 460 | u32 metric; | 491 | u32 metric; |
| 461 | u32 exptime; | 492 | u32 exptime; |
| 462 | u32 discovery_timeout; | 493 | u32 discovery_timeout; |
| @@ -506,6 +537,7 @@ struct mesh_config { | |||
| 506 | u32 dot11MeshHWMPactivePathTimeout; | 537 | u32 dot11MeshHWMPactivePathTimeout; |
| 507 | u16 dot11MeshHWMPpreqMinInterval; | 538 | u16 dot11MeshHWMPpreqMinInterval; |
| 508 | u16 dot11MeshHWMPnetDiameterTraversalTime; | 539 | u16 dot11MeshHWMPnetDiameterTraversalTime; |
| 540 | u8 dot11MeshHWMPRootMode; | ||
| 509 | }; | 541 | }; |
| 510 | 542 | ||
| 511 | /** | 543 | /** |
| @@ -594,8 +626,14 @@ enum cfg80211_signal_type { | |||
| 594 | * @beacon_interval: the beacon interval as from the frame | 626 | * @beacon_interval: the beacon interval as from the frame |
| 595 | * @capability: the capability field in host byte order | 627 | * @capability: the capability field in host byte order |
| 596 | * @information_elements: the information elements (Note that there | 628 | * @information_elements: the information elements (Note that there |
| 597 | * is no guarantee that these are well-formed!) | 629 | * is no guarantee that these are well-formed!); this is a pointer to |
| 630 | * either the beacon_ies or proberesp_ies depending on whether Probe | ||
| 631 | * Response frame has been received | ||
| 598 | * @len_information_elements: total length of the information elements | 632 | * @len_information_elements: total length of the information elements |
| 633 | * @beacon_ies: the information elements from the last Beacon frame | ||
| 634 | * @len_beacon_ies: total length of the beacon_ies | ||
| 635 | * @proberesp_ies: the information elements from the last Probe Response frame | ||
| 636 | * @len_proberesp_ies: total length of the proberesp_ies | ||
| 599 | * @signal: signal strength value (type depends on the wiphy's signal_type) | 637 | * @signal: signal strength value (type depends on the wiphy's signal_type) |
| 600 | * @free_priv: function pointer to free private data | 638 | * @free_priv: function pointer to free private data |
| 601 | * @priv: private area for driver use, has at least wiphy->bss_priv_size bytes | 639 | * @priv: private area for driver use, has at least wiphy->bss_priv_size bytes |
| @@ -609,6 +647,10 @@ struct cfg80211_bss { | |||
| 609 | u16 capability; | 647 | u16 capability; |
| 610 | u8 *information_elements; | 648 | u8 *information_elements; |
| 611 | size_t len_information_elements; | 649 | size_t len_information_elements; |
| 650 | u8 *beacon_ies; | ||
| 651 | size_t len_beacon_ies; | ||
| 652 | u8 *proberesp_ies; | ||
| 653 | size_t len_proberesp_ies; | ||
| 612 | 654 | ||
| 613 | s32 signal; | 655 | s32 signal; |
| 614 | 656 | ||
| @@ -805,6 +847,7 @@ enum wiphy_params_flags { | |||
| 805 | WIPHY_PARAM_RETRY_LONG = 1 << 1, | 847 | WIPHY_PARAM_RETRY_LONG = 1 << 1, |
| 806 | WIPHY_PARAM_FRAG_THRESHOLD = 1 << 2, | 848 | WIPHY_PARAM_FRAG_THRESHOLD = 1 << 2, |
| 807 | WIPHY_PARAM_RTS_THRESHOLD = 1 << 3, | 849 | WIPHY_PARAM_RTS_THRESHOLD = 1 << 3, |
| 850 | WIPHY_PARAM_COVERAGE_CLASS = 1 << 4, | ||
| 808 | }; | 851 | }; |
| 809 | 852 | ||
| 810 | /** | 853 | /** |
| @@ -824,20 +867,24 @@ enum tx_power_setting { | |||
| 824 | * cfg80211_bitrate_mask - masks for bitrate control | 867 | * cfg80211_bitrate_mask - masks for bitrate control |
| 825 | */ | 868 | */ |
| 826 | struct cfg80211_bitrate_mask { | 869 | struct cfg80211_bitrate_mask { |
| 827 | /* | ||
| 828 | * As discussed in Berlin, this struct really | ||
| 829 | * should look like this: | ||
| 830 | |||
| 831 | struct { | 870 | struct { |
| 832 | u32 legacy; | 871 | u32 legacy; |
| 833 | u8 mcs[IEEE80211_HT_MCS_MASK_LEN]; | 872 | /* TODO: add support for masking MCS rates; e.g.: */ |
| 873 | /* u8 mcs[IEEE80211_HT_MCS_MASK_LEN]; */ | ||
| 834 | } control[IEEE80211_NUM_BANDS]; | 874 | } control[IEEE80211_NUM_BANDS]; |
| 835 | 875 | }; | |
| 836 | * Since we can always fix in-kernel users, let's keep | 876 | /** |
| 837 | * it simpler for now: | 877 | * struct cfg80211_pmksa - PMK Security Association |
| 878 | * | ||
| 879 | * This structure is passed to the set/del_pmksa() method for PMKSA | ||
| 880 | * caching. | ||
| 881 | * | ||
| 882 | * @bssid: The AP's BSSID. | ||
| 883 | * @pmkid: The PMK material itself. | ||
| 838 | */ | 884 | */ |
| 839 | u32 fixed; /* fixed bitrate, 0 == not fixed */ | 885 | struct cfg80211_pmksa { |
| 840 | u32 maxrate; /* in kbps, 0 == no limit */ | 886 | u8 *bssid; |
| 887 | u8 *pmkid; | ||
| 841 | }; | 888 | }; |
| 842 | 889 | ||
| 843 | /** | 890 | /** |
| @@ -941,7 +988,26 @@ struct cfg80211_bitrate_mask { | |||
| 941 | * @rfkill_poll: polls the hw rfkill line, use cfg80211 reporting | 988 | * @rfkill_poll: polls the hw rfkill line, use cfg80211 reporting |
| 942 | * functions to adjust rfkill hw state | 989 | * functions to adjust rfkill hw state |
| 943 | * | 990 | * |
| 991 | * @dump_survey: get site survey information. | ||
| 992 | * | ||
| 993 | * @remain_on_channel: Request the driver to remain awake on the specified | ||
| 994 | * channel for the specified duration to complete an off-channel | ||
| 995 | * operation (e.g., public action frame exchange). When the driver is | ||
| 996 | * ready on the requested channel, it must indicate this with an event | ||
| 997 | * notification by calling cfg80211_ready_on_channel(). | ||
| 998 | * @cancel_remain_on_channel: Cancel an on-going remain-on-channel operation. | ||
| 999 | * This allows the operation to be terminated prior to timeout based on | ||
| 1000 | * the duration value. | ||
| 1001 | * @action: Transmit an action frame | ||
| 1002 | * | ||
| 944 | * @testmode_cmd: run a test mode command | 1003 | * @testmode_cmd: run a test mode command |
| 1004 | * | ||
| 1005 | * @set_pmksa: Cache a PMKID for a BSSID. This is mostly useful for fullmac | ||
| 1006 | * devices running firmwares capable of generating the (re) association | ||
| 1007 | * RSN IE. It allows for faster roaming between WPA2 BSSIDs. | ||
| 1008 | * @del_pmksa: Delete a cached PMKID. | ||
| 1009 | * @flush_pmksa: Flush all cached PMKIDs. | ||
| 1010 | * | ||
| 945 | */ | 1011 | */ |
| 946 | struct cfg80211_ops { | 1012 | struct cfg80211_ops { |
| 947 | int (*suspend)(struct wiphy *wiphy); | 1013 | int (*suspend)(struct wiphy *wiphy); |
| @@ -1060,7 +1126,30 @@ struct cfg80211_ops { | |||
| 1060 | const u8 *peer, | 1126 | const u8 *peer, |
| 1061 | const struct cfg80211_bitrate_mask *mask); | 1127 | const struct cfg80211_bitrate_mask *mask); |
| 1062 | 1128 | ||
| 1063 | /* some temporary stuff to finish wext */ | 1129 | int (*dump_survey)(struct wiphy *wiphy, struct net_device *netdev, |
| 1130 | int idx, struct survey_info *info); | ||
| 1131 | |||
| 1132 | int (*set_pmksa)(struct wiphy *wiphy, struct net_device *netdev, | ||
| 1133 | struct cfg80211_pmksa *pmksa); | ||
| 1134 | int (*del_pmksa)(struct wiphy *wiphy, struct net_device *netdev, | ||
| 1135 | struct cfg80211_pmksa *pmksa); | ||
| 1136 | int (*flush_pmksa)(struct wiphy *wiphy, struct net_device *netdev); | ||
| 1137 | |||
| 1138 | int (*remain_on_channel)(struct wiphy *wiphy, | ||
| 1139 | struct net_device *dev, | ||
| 1140 | struct ieee80211_channel *chan, | ||
| 1141 | enum nl80211_channel_type channel_type, | ||
| 1142 | unsigned int duration, | ||
| 1143 | u64 *cookie); | ||
| 1144 | int (*cancel_remain_on_channel)(struct wiphy *wiphy, | ||
| 1145 | struct net_device *dev, | ||
| 1146 | u64 cookie); | ||
| 1147 | |||
| 1148 | int (*action)(struct wiphy *wiphy, struct net_device *dev, | ||
| 1149 | struct ieee80211_channel *chan, | ||
| 1150 | enum nl80211_channel_type channel_type, | ||
| 1151 | const u8 *buf, size_t len, u64 *cookie); | ||
| 1152 | |||
| 1064 | int (*set_power_mgmt)(struct wiphy *wiphy, struct net_device *dev, | 1153 | int (*set_power_mgmt)(struct wiphy *wiphy, struct net_device *dev, |
| 1065 | bool enabled, int timeout); | 1154 | bool enabled, int timeout); |
| 1066 | }; | 1155 | }; |
| @@ -1071,27 +1160,54 @@ struct cfg80211_ops { | |||
| 1071 | */ | 1160 | */ |
| 1072 | 1161 | ||
| 1073 | /** | 1162 | /** |
| 1074 | * struct wiphy - wireless hardware description | 1163 | * enum wiphy_flags - wiphy capability flags |
| 1075 | * @idx: the wiphy index assigned to this item | 1164 | * |
| 1076 | * @class_dev: the class device representing /sys/class/ieee80211/<wiphy-name> | 1165 | * @WIPHY_FLAG_CUSTOM_REGULATORY: tells us the driver for this device |
| 1077 | * @custom_regulatory: tells us the driver for this device | ||
| 1078 | * has its own custom regulatory domain and cannot identify the | 1166 | * has its own custom regulatory domain and cannot identify the |
| 1079 | * ISO / IEC 3166 alpha2 it belongs to. When this is enabled | 1167 | * ISO / IEC 3166 alpha2 it belongs to. When this is enabled |
| 1080 | * we will disregard the first regulatory hint (when the | 1168 | * we will disregard the first regulatory hint (when the |
| 1081 | * initiator is %REGDOM_SET_BY_CORE). | 1169 | * initiator is %REGDOM_SET_BY_CORE). |
| 1082 | * @strict_regulatory: tells us the driver for this device will ignore | 1170 | * @WIPHY_FLAG_STRICT_REGULATORY: tells us the driver for this device will |
| 1083 | * regulatory domain settings until it gets its own regulatory domain | 1171 | * ignore regulatory domain settings until it gets its own regulatory |
| 1084 | * via its regulatory_hint(). After its gets its own regulatory domain | 1172 | * domain via its regulatory_hint(). After its gets its own regulatory |
| 1085 | * it will only allow further regulatory domain settings to further | 1173 | * domain it will only allow further regulatory domain settings to |
| 1086 | * enhance compliance. For example if channel 13 and 14 are disabled | 1174 | * further enhance compliance. For example if channel 13 and 14 are |
| 1087 | * by this regulatory domain no user regulatory domain can enable these | 1175 | * disabled by this regulatory domain no user regulatory domain can |
| 1088 | * channels at a later time. This can be used for devices which do not | 1176 | * enable these channels at a later time. This can be used for devices |
| 1089 | * have calibration information gauranteed for frequencies or settings | 1177 | * which do not have calibration information gauranteed for frequencies |
| 1090 | * outside of its regulatory domain. | 1178 | * or settings outside of its regulatory domain. |
| 1091 | * @disable_beacon_hints: enable this if your driver needs to ensure that | 1179 | * @WIPHY_FLAG_DISABLE_BEACON_HINTS: enable this if your driver needs to ensure |
| 1092 | * passive scan flags and beaconing flags may not be lifted by cfg80211 | 1180 | * that passive scan flags and beaconing flags may not be lifted by |
| 1093 | * due to regulatory beacon hints. For more information on beacon | 1181 | * cfg80211 due to regulatory beacon hints. For more information on beacon |
| 1094 | * hints read the documenation for regulatory_hint_found_beacon() | 1182 | * hints read the documenation for regulatory_hint_found_beacon() |
| 1183 | * @WIPHY_FLAG_NETNS_OK: if not set, do not allow changing the netns of this | ||
| 1184 | * wiphy at all | ||
| 1185 | * @WIPHY_FLAG_PS_ON_BY_DEFAULT: if set to true, powersave will be enabled | ||
| 1186 | * by default -- this flag will be set depending on the kernel's default | ||
| 1187 | * on wiphy_new(), but can be changed by the driver if it has a good | ||
| 1188 | * reason to override the default | ||
| 1189 | * @WIPHY_FLAG_4ADDR_AP: supports 4addr mode even on AP (with a single station | ||
| 1190 | * on a VLAN interface) | ||
| 1191 | * @WIPHY_FLAG_4ADDR_STATION: supports 4addr mode even as a station | ||
| 1192 | */ | ||
| 1193 | enum wiphy_flags { | ||
| 1194 | WIPHY_FLAG_CUSTOM_REGULATORY = BIT(0), | ||
| 1195 | WIPHY_FLAG_STRICT_REGULATORY = BIT(1), | ||
| 1196 | WIPHY_FLAG_DISABLE_BEACON_HINTS = BIT(2), | ||
| 1197 | WIPHY_FLAG_NETNS_OK = BIT(3), | ||
| 1198 | WIPHY_FLAG_PS_ON_BY_DEFAULT = BIT(4), | ||
| 1199 | WIPHY_FLAG_4ADDR_AP = BIT(5), | ||
| 1200 | WIPHY_FLAG_4ADDR_STATION = BIT(6), | ||
| 1201 | }; | ||
| 1202 | |||
| 1203 | struct mac_address { | ||
| 1204 | u8 addr[ETH_ALEN]; | ||
| 1205 | }; | ||
| 1206 | |||
| 1207 | /** | ||
| 1208 | * struct wiphy - wireless hardware description | ||
| 1209 | * @idx: the wiphy index assigned to this item | ||
| 1210 | * @class_dev: the class device representing /sys/class/ieee80211/<wiphy-name> | ||
| 1095 | * @reg_notifier: the driver's regulatory notification callback | 1211 | * @reg_notifier: the driver's regulatory notification callback |
| 1096 | * @regd: the driver's regulatory domain, if one was requested via | 1212 | * @regd: the driver's regulatory domain, if one was requested via |
| 1097 | * the regulatory_hint() API. This can be used by the driver | 1213 | * the regulatory_hint() API. This can be used by the driver |
| @@ -1106,27 +1222,33 @@ struct cfg80211_ops { | |||
| 1106 | * -1 = fragmentation disabled, only odd values >= 256 used | 1222 | * -1 = fragmentation disabled, only odd values >= 256 used |
| 1107 | * @rts_threshold: RTS threshold (dot11RTSThreshold); -1 = RTS/CTS disabled | 1223 | * @rts_threshold: RTS threshold (dot11RTSThreshold); -1 = RTS/CTS disabled |
| 1108 | * @net: the network namespace this wiphy currently lives in | 1224 | * @net: the network namespace this wiphy currently lives in |
| 1109 | * @netnsok: if set to false, do not allow changing the netns of this | 1225 | * @perm_addr: permanent MAC address of this device |
| 1110 | * wiphy at all | 1226 | * @addr_mask: If the device supports multiple MAC addresses by masking, |
| 1111 | * @ps_default: default for powersave, will be set depending on the | 1227 | * set this to a mask with variable bits set to 1, e.g. if the last |
| 1112 | * kernel's default on wiphy_new(), but can be changed by the | 1228 | * four bits are variable then set it to 00:...:00:0f. The actual |
| 1113 | * driver if it has a good reason to override the default | 1229 | * variable bits shall be determined by the interfaces added, with |
| 1230 | * interfaces not matching the mask being rejected to be brought up. | ||
| 1231 | * @n_addresses: number of addresses in @addresses. | ||
| 1232 | * @addresses: If the device has more than one address, set this pointer | ||
| 1233 | * to a list of addresses (6 bytes each). The first one will be used | ||
| 1234 | * by default for perm_addr. In this case, the mask should be set to | ||
| 1235 | * all-zeroes. In this case it is assumed that the device can handle | ||
| 1236 | * the same number of arbitrary MAC addresses. | ||
| 1114 | */ | 1237 | */ |
| 1115 | struct wiphy { | 1238 | struct wiphy { |
| 1116 | /* assign these fields before you register the wiphy */ | 1239 | /* assign these fields before you register the wiphy */ |
| 1117 | 1240 | ||
| 1118 | /* permanent MAC address */ | 1241 | /* permanent MAC address(es) */ |
| 1119 | u8 perm_addr[ETH_ALEN]; | 1242 | u8 perm_addr[ETH_ALEN]; |
| 1243 | u8 addr_mask[ETH_ALEN]; | ||
| 1244 | |||
| 1245 | u16 n_addresses; | ||
| 1246 | struct mac_address *addresses; | ||
| 1120 | 1247 | ||
| 1121 | /* Supported interface modes, OR together BIT(NL80211_IFTYPE_...) */ | 1248 | /* Supported interface modes, OR together BIT(NL80211_IFTYPE_...) */ |
| 1122 | u16 interface_modes; | 1249 | u16 interface_modes; |
| 1123 | 1250 | ||
| 1124 | bool custom_regulatory; | 1251 | u32 flags; |
| 1125 | bool strict_regulatory; | ||
| 1126 | bool disable_beacon_hints; | ||
| 1127 | |||
| 1128 | bool netnsok; | ||
| 1129 | bool ps_default; | ||
| 1130 | 1252 | ||
| 1131 | enum cfg80211_signal_type signal_type; | 1253 | enum cfg80211_signal_type signal_type; |
| 1132 | 1254 | ||
| @@ -1141,6 +1263,12 @@ struct wiphy { | |||
| 1141 | u8 retry_long; | 1263 | u8 retry_long; |
| 1142 | u32 frag_threshold; | 1264 | u32 frag_threshold; |
| 1143 | u32 rts_threshold; | 1265 | u32 rts_threshold; |
| 1266 | u8 coverage_class; | ||
| 1267 | |||
| 1268 | char fw_version[ETHTOOL_BUSINFO_LEN]; | ||
| 1269 | u32 hw_version; | ||
| 1270 | |||
| 1271 | u8 max_num_pmkids; | ||
| 1144 | 1272 | ||
| 1145 | /* If multiple wiphys are registered and you're handed e.g. | 1273 | /* If multiple wiphys are registered and you're handed e.g. |
| 1146 | * a regular netdev with assigned ieee80211_ptr, you won't | 1274 | * a regular netdev with assigned ieee80211_ptr, you won't |
| @@ -1171,6 +1299,10 @@ struct wiphy { | |||
| 1171 | struct net *_net; | 1299 | struct net *_net; |
| 1172 | #endif | 1300 | #endif |
| 1173 | 1301 | ||
| 1302 | #ifdef CONFIG_CFG80211_WEXT | ||
| 1303 | const struct iw_handler_def *wext; | ||
| 1304 | #endif | ||
| 1305 | |||
| 1174 | char priv[0] __attribute__((__aligned__(NETDEV_ALIGN))); | 1306 | char priv[0] __attribute__((__aligned__(NETDEV_ALIGN))); |
| 1175 | }; | 1307 | }; |
| 1176 | 1308 | ||
| @@ -1314,6 +1446,12 @@ struct cfg80211_cached_keys; | |||
| 1314 | * @ssid_len: (private) Used by the internal configuration code | 1446 | * @ssid_len: (private) Used by the internal configuration code |
| 1315 | * @wext: (private) Used by the internal wireless extensions compat code | 1447 | * @wext: (private) Used by the internal wireless extensions compat code |
| 1316 | * @wext_bssid: (private) Used by the internal wireless extensions compat code | 1448 | * @wext_bssid: (private) Used by the internal wireless extensions compat code |
| 1449 | * @use_4addr: indicates 4addr mode is used on this interface, must be | ||
| 1450 | * set by driver (if supported) on add_interface BEFORE registering the | ||
| 1451 | * netdev and may otherwise be used by driver read-only, will be update | ||
| 1452 | * by cfg80211 on change_interface | ||
| 1453 | * @action_registrations: list of registrations for action frames | ||
| 1454 | * @action_registrations_lock: lock for the list | ||
| 1317 | */ | 1455 | */ |
| 1318 | struct wireless_dev { | 1456 | struct wireless_dev { |
| 1319 | struct wiphy *wiphy; | 1457 | struct wiphy *wiphy; |
| @@ -1323,10 +1461,15 @@ struct wireless_dev { | |||
| 1323 | struct list_head list; | 1461 | struct list_head list; |
| 1324 | struct net_device *netdev; | 1462 | struct net_device *netdev; |
| 1325 | 1463 | ||
| 1464 | struct list_head action_registrations; | ||
| 1465 | spinlock_t action_registrations_lock; | ||
| 1466 | |||
| 1326 | struct mutex mtx; | 1467 | struct mutex mtx; |
| 1327 | 1468 | ||
| 1328 | struct work_struct cleanup_work; | 1469 | struct work_struct cleanup_work; |
| 1329 | 1470 | ||
| 1471 | bool use_4addr; | ||
| 1472 | |||
| 1330 | /* currently used for IBSS and SME - might be rearranged later */ | 1473 | /* currently used for IBSS and SME - might be rearranged later */ |
| 1331 | u8 ssid[IEEE80211_MAX_SSID_LEN]; | 1474 | u8 ssid[IEEE80211_MAX_SSID_LEN]; |
| 1332 | u8 ssid_len; | 1475 | u8 ssid_len; |
| @@ -1345,7 +1488,10 @@ struct wireless_dev { | |||
| 1345 | struct cfg80211_internal_bss *auth_bsses[MAX_AUTH_BSSES]; | 1488 | struct cfg80211_internal_bss *auth_bsses[MAX_AUTH_BSSES]; |
| 1346 | struct cfg80211_internal_bss *current_bss; /* associated / joined */ | 1489 | struct cfg80211_internal_bss *current_bss; /* associated / joined */ |
| 1347 | 1490 | ||
| 1348 | #ifdef CONFIG_WIRELESS_EXT | 1491 | bool ps; |
| 1492 | int ps_timeout; | ||
| 1493 | |||
| 1494 | #ifdef CONFIG_CFG80211_WEXT | ||
| 1349 | /* wext data */ | 1495 | /* wext data */ |
| 1350 | struct { | 1496 | struct { |
| 1351 | struct cfg80211_ibss_params ibss; | 1497 | struct cfg80211_ibss_params ibss; |
| @@ -1356,8 +1502,7 @@ struct wireless_dev { | |||
| 1356 | u8 bssid[ETH_ALEN], prev_bssid[ETH_ALEN]; | 1502 | u8 bssid[ETH_ALEN], prev_bssid[ETH_ALEN]; |
| 1357 | u8 ssid[IEEE80211_MAX_SSID_LEN]; | 1503 | u8 ssid[IEEE80211_MAX_SSID_LEN]; |
| 1358 | s8 default_key, default_mgmt_key; | 1504 | s8 default_key, default_mgmt_key; |
| 1359 | bool ps, prev_bssid_valid; | 1505 | bool prev_bssid_valid; |
| 1360 | int ps_timeout; | ||
| 1361 | } wext; | 1506 | } wext; |
| 1362 | #endif | 1507 | #endif |
| 1363 | }; | 1508 | }; |
| @@ -1428,37 +1573,82 @@ ieee80211_get_response_rate(struct ieee80211_supported_band *sband, | |||
| 1428 | * Documentation in Documentation/networking/radiotap-headers.txt | 1573 | * Documentation in Documentation/networking/radiotap-headers.txt |
| 1429 | */ | 1574 | */ |
| 1430 | 1575 | ||
| 1576 | struct radiotap_align_size { | ||
| 1577 | uint8_t align:4, size:4; | ||
| 1578 | }; | ||
| 1579 | |||
| 1580 | struct ieee80211_radiotap_namespace { | ||
| 1581 | const struct radiotap_align_size *align_size; | ||
| 1582 | int n_bits; | ||
| 1583 | uint32_t oui; | ||
| 1584 | uint8_t subns; | ||
| 1585 | }; | ||
| 1586 | |||
| 1587 | struct ieee80211_radiotap_vendor_namespaces { | ||
| 1588 | const struct ieee80211_radiotap_namespace *ns; | ||
| 1589 | int n_ns; | ||
| 1590 | }; | ||
| 1591 | |||
| 1431 | /** | 1592 | /** |
| 1432 | * struct ieee80211_radiotap_iterator - tracks walk thru present radiotap args | 1593 | * struct ieee80211_radiotap_iterator - tracks walk thru present radiotap args |
| 1433 | * @rtheader: pointer to the radiotap header we are walking through | 1594 | * @this_arg_index: index of current arg, valid after each successful call |
| 1434 | * @max_length: length of radiotap header in cpu byte ordering | 1595 | * to ieee80211_radiotap_iterator_next() |
| 1435 | * @this_arg_index: IEEE80211_RADIOTAP_... index of current arg | 1596 | * @this_arg: pointer to current radiotap arg; it is valid after each |
| 1436 | * @this_arg: pointer to current radiotap arg | 1597 | * call to ieee80211_radiotap_iterator_next() but also after |
| 1437 | * @arg_index: internal next argument index | 1598 | * ieee80211_radiotap_iterator_init() where it will point to |
| 1438 | * @arg: internal next argument pointer | 1599 | * the beginning of the actual data portion |
| 1439 | * @next_bitmap: internal pointer to next present u32 | 1600 | * @this_arg_size: length of the current arg, for convenience |
| 1440 | * @bitmap_shifter: internal shifter for curr u32 bitmap, b0 set == arg present | 1601 | * @current_namespace: pointer to the current namespace definition |
| 1602 | * (or internally %NULL if the current namespace is unknown) | ||
| 1603 | * @is_radiotap_ns: indicates whether the current namespace is the default | ||
| 1604 | * radiotap namespace or not | ||
| 1605 | * | ||
| 1606 | * @overrides: override standard radiotap fields | ||
| 1607 | * @n_overrides: number of overrides | ||
| 1608 | * | ||
| 1609 | * @_rtheader: pointer to the radiotap header we are walking through | ||
| 1610 | * @_max_length: length of radiotap header in cpu byte ordering | ||
| 1611 | * @_arg_index: next argument index | ||
| 1612 | * @_arg: next argument pointer | ||
| 1613 | * @_next_bitmap: internal pointer to next present u32 | ||
| 1614 | * @_bitmap_shifter: internal shifter for curr u32 bitmap, b0 set == arg present | ||
| 1615 | * @_vns: vendor namespace definitions | ||
| 1616 | * @_next_ns_data: beginning of the next namespace's data | ||
| 1617 | * @_reset_on_ext: internal; reset the arg index to 0 when going to the | ||
| 1618 | * next bitmap word | ||
| 1619 | * | ||
| 1620 | * Describes the radiotap parser state. Fields prefixed with an underscore | ||
| 1621 | * must not be used by users of the parser, only by the parser internally. | ||
| 1441 | */ | 1622 | */ |
| 1442 | 1623 | ||
| 1443 | struct ieee80211_radiotap_iterator { | 1624 | struct ieee80211_radiotap_iterator { |
| 1444 | struct ieee80211_radiotap_header *rtheader; | 1625 | struct ieee80211_radiotap_header *_rtheader; |
| 1445 | int max_length; | 1626 | const struct ieee80211_radiotap_vendor_namespaces *_vns; |
| 1627 | const struct ieee80211_radiotap_namespace *current_namespace; | ||
| 1628 | |||
| 1629 | unsigned char *_arg, *_next_ns_data; | ||
| 1630 | uint32_t *_next_bitmap; | ||
| 1631 | |||
| 1632 | unsigned char *this_arg; | ||
| 1446 | int this_arg_index; | 1633 | int this_arg_index; |
| 1447 | u8 *this_arg; | 1634 | int this_arg_size; |
| 1448 | 1635 | ||
| 1449 | int arg_index; | 1636 | int is_radiotap_ns; |
| 1450 | u8 *arg; | 1637 | |
| 1451 | __le32 *next_bitmap; | 1638 | int _max_length; |
| 1452 | u32 bitmap_shifter; | 1639 | int _arg_index; |
| 1640 | uint32_t _bitmap_shifter; | ||
| 1641 | int _reset_on_ext; | ||
| 1453 | }; | 1642 | }; |
| 1454 | 1643 | ||
| 1455 | extern int ieee80211_radiotap_iterator_init( | 1644 | extern int ieee80211_radiotap_iterator_init( |
| 1456 | struct ieee80211_radiotap_iterator *iterator, | 1645 | struct ieee80211_radiotap_iterator *iterator, |
| 1457 | struct ieee80211_radiotap_header *radiotap_header, | 1646 | struct ieee80211_radiotap_header *radiotap_header, |
| 1458 | int max_length); | 1647 | int max_length, const struct ieee80211_radiotap_vendor_namespaces *vns); |
| 1459 | 1648 | ||
| 1460 | extern int ieee80211_radiotap_iterator_next( | 1649 | extern int ieee80211_radiotap_iterator_next( |
| 1461 | struct ieee80211_radiotap_iterator *iterator); | 1650 | struct ieee80211_radiotap_iterator *iterator); |
| 1651 | |||
| 1462 | 1652 | ||
| 1463 | extern const unsigned char rfc1042_header[6]; | 1653 | extern const unsigned char rfc1042_header[6]; |
| 1464 | extern const unsigned char bridge_tunnel_header[6]; | 1654 | extern const unsigned char bridge_tunnel_header[6]; |
| @@ -1487,7 +1677,7 @@ unsigned int ieee80211_hdrlen(__le16 fc); | |||
| 1487 | * @addr: the device MAC address | 1677 | * @addr: the device MAC address |
| 1488 | * @iftype: the virtual interface type | 1678 | * @iftype: the virtual interface type |
| 1489 | */ | 1679 | */ |
| 1490 | int ieee80211_data_to_8023(struct sk_buff *skb, u8 *addr, | 1680 | int ieee80211_data_to_8023(struct sk_buff *skb, const u8 *addr, |
| 1491 | enum nl80211_iftype iftype); | 1681 | enum nl80211_iftype iftype); |
| 1492 | 1682 | ||
| 1493 | /** | 1683 | /** |
| @@ -1498,15 +1688,49 @@ int ieee80211_data_to_8023(struct sk_buff *skb, u8 *addr, | |||
| 1498 | * @bssid: the network bssid (used only for iftype STATION and ADHOC) | 1688 | * @bssid: the network bssid (used only for iftype STATION and ADHOC) |
| 1499 | * @qos: build 802.11 QoS data frame | 1689 | * @qos: build 802.11 QoS data frame |
| 1500 | */ | 1690 | */ |
| 1501 | int ieee80211_data_from_8023(struct sk_buff *skb, u8 *addr, | 1691 | int ieee80211_data_from_8023(struct sk_buff *skb, const u8 *addr, |
| 1502 | enum nl80211_iftype iftype, u8 *bssid, bool qos); | 1692 | enum nl80211_iftype iftype, u8 *bssid, bool qos); |
| 1503 | 1693 | ||
| 1504 | /** | 1694 | /** |
| 1695 | * ieee80211_amsdu_to_8023s - decode an IEEE 802.11n A-MSDU frame | ||
| 1696 | * | ||
| 1697 | * Decode an IEEE 802.11n A-MSDU frame and convert it to a list of | ||
| 1698 | * 802.3 frames. The @list will be empty if the decode fails. The | ||
| 1699 | * @skb is consumed after the function returns. | ||
| 1700 | * | ||
| 1701 | * @skb: The input IEEE 802.11n A-MSDU frame. | ||
| 1702 | * @list: The output list of 802.3 frames. It must be allocated and | ||
| 1703 | * initialized by by the caller. | ||
| 1704 | * @addr: The device MAC address. | ||
| 1705 | * @iftype: The device interface type. | ||
| 1706 | * @extra_headroom: The hardware extra headroom for SKBs in the @list. | ||
| 1707 | */ | ||
| 1708 | void ieee80211_amsdu_to_8023s(struct sk_buff *skb, struct sk_buff_head *list, | ||
| 1709 | const u8 *addr, enum nl80211_iftype iftype, | ||
| 1710 | const unsigned int extra_headroom); | ||
| 1711 | |||
| 1712 | /** | ||
| 1505 | * cfg80211_classify8021d - determine the 802.1p/1d tag for a data frame | 1713 | * cfg80211_classify8021d - determine the 802.1p/1d tag for a data frame |
| 1506 | * @skb: the data frame | 1714 | * @skb: the data frame |
| 1507 | */ | 1715 | */ |
| 1508 | unsigned int cfg80211_classify8021d(struct sk_buff *skb); | 1716 | unsigned int cfg80211_classify8021d(struct sk_buff *skb); |
| 1509 | 1717 | ||
| 1718 | /** | ||
| 1719 | * cfg80211_find_ie - find information element in data | ||
| 1720 | * | ||
| 1721 | * @eid: element ID | ||
| 1722 | * @ies: data consisting of IEs | ||
| 1723 | * @len: length of data | ||
| 1724 | * | ||
| 1725 | * This function will return %NULL if the element ID could | ||
| 1726 | * not be found or if the element is invalid (claims to be | ||
| 1727 | * longer than the given data), or a pointer to the first byte | ||
| 1728 | * of the requested element, that is the byte containing the | ||
| 1729 | * element ID. There are no checks on the element length | ||
| 1730 | * other than having to fit into the given data. | ||
| 1731 | */ | ||
| 1732 | const u8 *cfg80211_find_ie(u8 eid, const u8 *ies, int len); | ||
| 1733 | |||
| 1510 | /* | 1734 | /* |
| 1511 | * Regulatory helper functions for wiphys | 1735 | * Regulatory helper functions for wiphys |
| 1512 | */ | 1736 | */ |
| @@ -1776,6 +2000,18 @@ void cfg80211_send_rx_auth(struct net_device *dev, const u8 *buf, size_t len); | |||
| 1776 | void cfg80211_send_auth_timeout(struct net_device *dev, const u8 *addr); | 2000 | void cfg80211_send_auth_timeout(struct net_device *dev, const u8 *addr); |
| 1777 | 2001 | ||
| 1778 | /** | 2002 | /** |
| 2003 | * __cfg80211_auth_canceled - notify cfg80211 that authentication was canceled | ||
| 2004 | * @dev: network device | ||
| 2005 | * @addr: The MAC address of the device with which the authentication timed out | ||
| 2006 | * | ||
| 2007 | * When a pending authentication had no action yet, the driver may decide | ||
| 2008 | * to not send a deauth frame, but in that case must calls this function | ||
| 2009 | * to tell cfg80211 about this decision. It is only valid to call this | ||
| 2010 | * function within the deauth() callback. | ||
| 2011 | */ | ||
| 2012 | void __cfg80211_auth_canceled(struct net_device *dev, const u8 *addr); | ||
| 2013 | |||
| 2014 | /** | ||
| 1779 | * cfg80211_send_rx_assoc - notification of processed association | 2015 | * cfg80211_send_rx_assoc - notification of processed association |
| 1780 | * @dev: network device | 2016 | * @dev: network device |
| 1781 | * @buf: (re)association response frame (header + body) | 2017 | * @buf: (re)association response frame (header + body) |
| @@ -1802,30 +2038,45 @@ void cfg80211_send_assoc_timeout(struct net_device *dev, const u8 *addr); | |||
| 1802 | * @dev: network device | 2038 | * @dev: network device |
| 1803 | * @buf: deauthentication frame (header + body) | 2039 | * @buf: deauthentication frame (header + body) |
| 1804 | * @len: length of the frame data | 2040 | * @len: length of the frame data |
| 1805 | * @cookie: cookie from ->deauth if called within that callback, | ||
| 1806 | * %NULL otherwise | ||
| 1807 | * | 2041 | * |
| 1808 | * This function is called whenever deauthentication has been processed in | 2042 | * This function is called whenever deauthentication has been processed in |
| 1809 | * station mode. This includes both received deauthentication frames and | 2043 | * station mode. This includes both received deauthentication frames and |
| 1810 | * locally generated ones. This function may sleep. | 2044 | * locally generated ones. This function may sleep. |
| 1811 | */ | 2045 | */ |
| 1812 | void cfg80211_send_deauth(struct net_device *dev, const u8 *buf, size_t len, | 2046 | void cfg80211_send_deauth(struct net_device *dev, const u8 *buf, size_t len); |
| 1813 | void *cookie); | 2047 | |
| 2048 | /** | ||
| 2049 | * __cfg80211_send_deauth - notification of processed deauthentication | ||
| 2050 | * @dev: network device | ||
| 2051 | * @buf: deauthentication frame (header + body) | ||
| 2052 | * @len: length of the frame data | ||
| 2053 | * | ||
| 2054 | * Like cfg80211_send_deauth(), but doesn't take the wdev lock. | ||
| 2055 | */ | ||
| 2056 | void __cfg80211_send_deauth(struct net_device *dev, const u8 *buf, size_t len); | ||
| 1814 | 2057 | ||
| 1815 | /** | 2058 | /** |
| 1816 | * cfg80211_send_disassoc - notification of processed disassociation | 2059 | * cfg80211_send_disassoc - notification of processed disassociation |
| 1817 | * @dev: network device | 2060 | * @dev: network device |
| 1818 | * @buf: disassociation response frame (header + body) | 2061 | * @buf: disassociation response frame (header + body) |
| 1819 | * @len: length of the frame data | 2062 | * @len: length of the frame data |
| 1820 | * @cookie: cookie from ->disassoc if called within that callback, | ||
| 1821 | * %NULL otherwise | ||
| 1822 | * | 2063 | * |
| 1823 | * This function is called whenever disassociation has been processed in | 2064 | * This function is called whenever disassociation has been processed in |
| 1824 | * station mode. This includes both received disassociation frames and locally | 2065 | * station mode. This includes both received disassociation frames and locally |
| 1825 | * generated ones. This function may sleep. | 2066 | * generated ones. This function may sleep. |
| 1826 | */ | 2067 | */ |
| 1827 | void cfg80211_send_disassoc(struct net_device *dev, const u8 *buf, size_t len, | 2068 | void cfg80211_send_disassoc(struct net_device *dev, const u8 *buf, size_t len); |
| 1828 | void *cookie); | 2069 | |
| 2070 | /** | ||
| 2071 | * __cfg80211_send_disassoc - notification of processed disassociation | ||
| 2072 | * @dev: network device | ||
| 2073 | * @buf: disassociation response frame (header + body) | ||
| 2074 | * @len: length of the frame data | ||
| 2075 | * | ||
| 2076 | * Like cfg80211_send_disassoc(), but doesn't take the wdev lock. | ||
| 2077 | */ | ||
| 2078 | void __cfg80211_send_disassoc(struct net_device *dev, const u8 *buf, | ||
| 2079 | size_t len); | ||
| 1829 | 2080 | ||
| 1830 | /** | 2081 | /** |
| 1831 | * cfg80211_michael_mic_failure - notification of Michael MIC failure (TKIP) | 2082 | * cfg80211_michael_mic_failure - notification of Michael MIC failure (TKIP) |
| @@ -2011,5 +2262,79 @@ void cfg80211_roamed(struct net_device *dev, const u8 *bssid, | |||
| 2011 | void cfg80211_disconnected(struct net_device *dev, u16 reason, | 2262 | void cfg80211_disconnected(struct net_device *dev, u16 reason, |
| 2012 | u8 *ie, size_t ie_len, gfp_t gfp); | 2263 | u8 *ie, size_t ie_len, gfp_t gfp); |
| 2013 | 2264 | ||
| 2265 | /** | ||
| 2266 | * cfg80211_ready_on_channel - notification of remain_on_channel start | ||
| 2267 | * @dev: network device | ||
| 2268 | * @cookie: the request cookie | ||
| 2269 | * @chan: The current channel (from remain_on_channel request) | ||
| 2270 | * @channel_type: Channel type | ||
| 2271 | * @duration: Duration in milliseconds that the driver intents to remain on the | ||
| 2272 | * channel | ||
| 2273 | * @gfp: allocation flags | ||
| 2274 | */ | ||
| 2275 | void cfg80211_ready_on_channel(struct net_device *dev, u64 cookie, | ||
| 2276 | struct ieee80211_channel *chan, | ||
| 2277 | enum nl80211_channel_type channel_type, | ||
| 2278 | unsigned int duration, gfp_t gfp); | ||
| 2279 | |||
| 2280 | /** | ||
| 2281 | * cfg80211_remain_on_channel_expired - remain_on_channel duration expired | ||
| 2282 | * @dev: network device | ||
| 2283 | * @cookie: the request cookie | ||
| 2284 | * @chan: The current channel (from remain_on_channel request) | ||
| 2285 | * @channel_type: Channel type | ||
| 2286 | * @gfp: allocation flags | ||
| 2287 | */ | ||
| 2288 | void cfg80211_remain_on_channel_expired(struct net_device *dev, | ||
| 2289 | u64 cookie, | ||
| 2290 | struct ieee80211_channel *chan, | ||
| 2291 | enum nl80211_channel_type channel_type, | ||
| 2292 | gfp_t gfp); | ||
| 2293 | |||
| 2294 | |||
| 2295 | /** | ||
| 2296 | * cfg80211_new_sta - notify userspace about station | ||
| 2297 | * | ||
| 2298 | * @dev: the netdev | ||
| 2299 | * @mac_addr: the station's address | ||
| 2300 | * @sinfo: the station information | ||
| 2301 | * @gfp: allocation flags | ||
| 2302 | */ | ||
| 2303 | void cfg80211_new_sta(struct net_device *dev, const u8 *mac_addr, | ||
| 2304 | struct station_info *sinfo, gfp_t gfp); | ||
| 2305 | |||
| 2306 | /** | ||
| 2307 | * cfg80211_rx_action - notification of received, unprocessed Action frame | ||
| 2308 | * @dev: network device | ||
| 2309 | * @freq: Frequency on which the frame was received in MHz | ||
| 2310 | * @buf: Action frame (header + body) | ||
| 2311 | * @len: length of the frame data | ||
| 2312 | * @gfp: context flags | ||
| 2313 | * Returns %true if a user space application is responsible for rejecting the | ||
| 2314 | * unrecognized Action frame; %false if no such application is registered | ||
| 2315 | * (i.e., the driver is responsible for rejecting the unrecognized Action | ||
| 2316 | * frame) | ||
| 2317 | * | ||
| 2318 | * This function is called whenever an Action frame is received for a station | ||
| 2319 | * mode interface, but is not processed in kernel. | ||
| 2320 | */ | ||
| 2321 | bool cfg80211_rx_action(struct net_device *dev, int freq, const u8 *buf, | ||
| 2322 | size_t len, gfp_t gfp); | ||
| 2323 | |||
| 2324 | /** | ||
| 2325 | * cfg80211_action_tx_status - notification of TX status for Action frame | ||
| 2326 | * @dev: network device | ||
| 2327 | * @cookie: Cookie returned by cfg80211_ops::action() | ||
| 2328 | * @buf: Action frame (header + body) | ||
| 2329 | * @len: length of the frame data | ||
| 2330 | * @ack: Whether frame was acknowledged | ||
| 2331 | * @gfp: context flags | ||
| 2332 | * | ||
| 2333 | * This function is called whenever an Action frame was requested to be | ||
| 2334 | * transmitted with cfg80211_ops::action() to report the TX status of the | ||
| 2335 | * transmission attempt. | ||
| 2336 | */ | ||
| 2337 | void cfg80211_action_tx_status(struct net_device *dev, u64 cookie, | ||
| 2338 | const u8 *buf, size_t len, bool ack, gfp_t gfp); | ||
| 2014 | 2339 | ||
| 2015 | #endif /* __NET_CFG80211_H */ | 2340 | #endif /* __NET_CFG80211_H */ |
diff --git a/include/net/compat.h b/include/net/compat.h index 7c3002832d05..28d5428ec6a2 100644 --- a/include/net/compat.h +++ b/include/net/compat.h | |||
| @@ -18,6 +18,11 @@ struct compat_msghdr { | |||
| 18 | compat_uint_t msg_flags; | 18 | compat_uint_t msg_flags; |
| 19 | }; | 19 | }; |
| 20 | 20 | ||
| 21 | struct compat_mmsghdr { | ||
| 22 | struct compat_msghdr msg_hdr; | ||
| 23 | compat_uint_t msg_len; | ||
| 24 | }; | ||
| 25 | |||
| 21 | struct compat_cmsghdr { | 26 | struct compat_cmsghdr { |
| 22 | compat_size_t cmsg_len; | 27 | compat_size_t cmsg_len; |
| 23 | compat_int_t cmsg_level; | 28 | compat_int_t cmsg_level; |
| @@ -28,13 +33,20 @@ extern int compat_sock_get_timestamp(struct sock *, struct timeval __user *); | |||
| 28 | extern int compat_sock_get_timestampns(struct sock *, struct timespec __user *); | 33 | extern int compat_sock_get_timestampns(struct sock *, struct timespec __user *); |
| 29 | 34 | ||
| 30 | #else /* defined(CONFIG_COMPAT) */ | 35 | #else /* defined(CONFIG_COMPAT) */ |
| 31 | #define compat_msghdr msghdr /* to avoid compiler warnings */ | 36 | /* |
| 37 | * To avoid compiler warnings: | ||
| 38 | */ | ||
| 39 | #define compat_msghdr msghdr | ||
| 40 | #define compat_mmsghdr mmsghdr | ||
| 32 | #endif /* defined(CONFIG_COMPAT) */ | 41 | #endif /* defined(CONFIG_COMPAT) */ |
| 33 | 42 | ||
| 34 | extern int get_compat_msghdr(struct msghdr *, struct compat_msghdr __user *); | 43 | extern int get_compat_msghdr(struct msghdr *, struct compat_msghdr __user *); |
| 35 | extern int verify_compat_iovec(struct msghdr *, struct iovec *, struct sockaddr *, int); | 44 | extern int verify_compat_iovec(struct msghdr *, struct iovec *, struct sockaddr *, int); |
| 36 | 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); |
| 37 | extern asmlinkage long compat_sys_recvmsg(int,struct compat_msghdr __user *,unsigned); | 46 | extern asmlinkage long compat_sys_recvmsg(int,struct compat_msghdr __user *,unsigned); |
| 47 | extern asmlinkage long compat_sys_recvmmsg(int, struct compat_mmsghdr __user *, | ||
| 48 | unsigned, unsigned, | ||
| 49 | struct compat_timespec __user *); | ||
| 38 | extern asmlinkage long compat_sys_getsockopt(int, int, int, char __user *, int __user *); | 50 | extern asmlinkage long compat_sys_getsockopt(int, int, int, char __user *, int __user *); |
| 39 | extern int put_cmsg_compat(struct msghdr*, int, int, int, void *); | 51 | extern int put_cmsg_compat(struct msghdr*, int, int, int, void *); |
| 40 | 52 | ||
diff --git a/include/net/dn_dev.h b/include/net/dn_dev.h index cee46821dc53..511a459ec10f 100644 --- a/include/net/dn_dev.h +++ b/include/net/dn_dev.h | |||
| @@ -75,7 +75,6 @@ struct dn_dev_parms { | |||
| 75 | unsigned long t3; /* Default value of t3 */ | 75 | unsigned long t3; /* Default value of t3 */ |
| 76 | int priority; /* Priority to be a router */ | 76 | int priority; /* Priority to be a router */ |
| 77 | char *name; /* Name for sysctl */ | 77 | char *name; /* Name for sysctl */ |
| 78 | int ctl_name; /* Index for sysctl */ | ||
| 79 | int (*up)(struct net_device *); | 78 | int (*up)(struct net_device *); |
| 80 | void (*down)(struct net_device *); | 79 | void (*down)(struct net_device *); |
| 81 | void (*timer3)(struct net_device *, struct dn_ifaddr *ifa); | 80 | void (*timer3)(struct net_device *, struct dn_ifaddr *ifa); |
| @@ -97,16 +96,14 @@ struct dn_dev { | |||
| 97 | unsigned long uptime; /* Time device went up in jiffies */ | 96 | unsigned long uptime; /* Time device went up in jiffies */ |
| 98 | }; | 97 | }; |
| 99 | 98 | ||
| 100 | struct dn_short_packet | 99 | struct dn_short_packet { |
| 101 | { | ||
| 102 | __u8 msgflg; | 100 | __u8 msgflg; |
| 103 | __le16 dstnode; | 101 | __le16 dstnode; |
| 104 | __le16 srcnode; | 102 | __le16 srcnode; |
| 105 | __u8 forward; | 103 | __u8 forward; |
| 106 | } __attribute__((packed)); | 104 | } __attribute__((packed)); |
| 107 | 105 | ||
| 108 | struct dn_long_packet | 106 | struct dn_long_packet { |
| 109 | { | ||
| 110 | __u8 msgflg; | 107 | __u8 msgflg; |
| 111 | __u8 d_area; | 108 | __u8 d_area; |
| 112 | __u8 d_subarea; | 109 | __u8 d_subarea; |
| @@ -122,8 +119,7 @@ struct dn_long_packet | |||
| 122 | 119 | ||
| 123 | /*------------------------- DRP - Routing messages ---------------------*/ | 120 | /*------------------------- DRP - Routing messages ---------------------*/ |
| 124 | 121 | ||
| 125 | struct endnode_hello_message | 122 | struct endnode_hello_message { |
| 126 | { | ||
| 127 | __u8 msgflg; | 123 | __u8 msgflg; |
| 128 | __u8 tiver[3]; | 124 | __u8 tiver[3]; |
| 129 | __u8 id[6]; | 125 | __u8 id[6]; |
| @@ -138,8 +134,7 @@ struct endnode_hello_message | |||
| 138 | __u8 data[2]; | 134 | __u8 data[2]; |
| 139 | } __attribute__((packed)); | 135 | } __attribute__((packed)); |
| 140 | 136 | ||
| 141 | struct rtnode_hello_message | 137 | struct rtnode_hello_message { |
| 142 | { | ||
| 143 | __u8 msgflg; | 138 | __u8 msgflg; |
| 144 | __u8 tiver[3]; | 139 | __u8 tiver[3]; |
| 145 | __u8 id[6]; | 140 | __u8 id[6]; |
diff --git a/include/net/dn_fib.h b/include/net/dn_fib.h index c378be7bf960..52da6c3dd50d 100644 --- a/include/net/dn_fib.h +++ b/include/net/dn_fib.h | |||
| @@ -4,8 +4,7 @@ | |||
| 4 | /* WARNING: The ordering of these elements must match ordering | 4 | /* WARNING: The ordering of these elements must match ordering |
| 5 | * of RTA_* rtnetlink attribute numbers. | 5 | * of RTA_* rtnetlink attribute numbers. |
| 6 | */ | 6 | */ |
| 7 | struct dn_kern_rta | 7 | struct dn_kern_rta { |
| 8 | { | ||
| 9 | void *rta_dst; | 8 | void *rta_dst; |
| 10 | void *rta_src; | 9 | void *rta_src; |
| 11 | int *rta_iif; | 10 | int *rta_iif; |
diff --git a/include/net/dn_nsp.h b/include/net/dn_nsp.h index 96e816b6974d..17d43d2db5ec 100644 --- a/include/net/dn_nsp.h +++ b/include/net/dn_nsp.h | |||
| @@ -70,30 +70,26 @@ extern struct sk_buff *dn_alloc_send_skb(struct sock *sk, size_t *size, int nobl | |||
| 70 | 70 | ||
| 71 | /* Data Messages (data segment/interrupt/link service) */ | 71 | /* Data Messages (data segment/interrupt/link service) */ |
| 72 | 72 | ||
| 73 | struct nsp_data_seg_msg | 73 | struct nsp_data_seg_msg { |
| 74 | { | ||
| 75 | __u8 msgflg; | 74 | __u8 msgflg; |
| 76 | __le16 dstaddr; | 75 | __le16 dstaddr; |
| 77 | __le16 srcaddr; | 76 | __le16 srcaddr; |
| 78 | } __attribute__((packed)); | 77 | } __attribute__((packed)); |
| 79 | 78 | ||
| 80 | struct nsp_data_opt_msg | 79 | struct nsp_data_opt_msg { |
| 81 | { | ||
| 82 | __le16 acknum; | 80 | __le16 acknum; |
| 83 | __le16 segnum; | 81 | __le16 segnum; |
| 84 | __le16 lsflgs; | 82 | __le16 lsflgs; |
| 85 | } __attribute__((packed)); | 83 | } __attribute__((packed)); |
| 86 | 84 | ||
| 87 | struct nsp_data_opt_msg1 | 85 | struct nsp_data_opt_msg1 { |
| 88 | { | ||
| 89 | __le16 acknum; | 86 | __le16 acknum; |
| 90 | __le16 segnum; | 87 | __le16 segnum; |
| 91 | } __attribute__((packed)); | 88 | } __attribute__((packed)); |
| 92 | 89 | ||
| 93 | 90 | ||
| 94 | /* Acknowledgment Message (data/other data) */ | 91 | /* Acknowledgment Message (data/other data) */ |
| 95 | struct nsp_data_ack_msg | 92 | struct nsp_data_ack_msg { |
| 96 | { | ||
| 97 | __u8 msgflg; | 93 | __u8 msgflg; |
| 98 | __le16 dstaddr; | 94 | __le16 dstaddr; |
| 99 | __le16 srcaddr; | 95 | __le16 srcaddr; |
| @@ -101,16 +97,14 @@ struct nsp_data_ack_msg | |||
| 101 | } __attribute__((packed)); | 97 | } __attribute__((packed)); |
| 102 | 98 | ||
| 103 | /* Connect Acknowledgment Message */ | 99 | /* Connect Acknowledgment Message */ |
| 104 | struct nsp_conn_ack_msg | 100 | struct nsp_conn_ack_msg { |
| 105 | { | ||
| 106 | __u8 msgflg; | 101 | __u8 msgflg; |
| 107 | __le16 dstaddr; | 102 | __le16 dstaddr; |
| 108 | } __attribute__((packed)); | 103 | } __attribute__((packed)); |
| 109 | 104 | ||
| 110 | 105 | ||
| 111 | /* Connect Initiate/Retransmit Initiate/Connect Confirm */ | 106 | /* Connect Initiate/Retransmit Initiate/Connect Confirm */ |
| 112 | struct nsp_conn_init_msg | 107 | struct nsp_conn_init_msg { |
| 113 | { | ||
| 114 | __u8 msgflg; | 108 | __u8 msgflg; |
| 115 | #define NSP_CI 0x18 /* Connect Initiate */ | 109 | #define NSP_CI 0x18 /* Connect Initiate */ |
| 116 | #define NSP_RCI 0x68 /* Retrans. Conn Init */ | 110 | #define NSP_RCI 0x68 /* Retrans. Conn Init */ |
| @@ -126,8 +120,7 @@ struct nsp_conn_init_msg | |||
| 126 | } __attribute__((packed)); | 120 | } __attribute__((packed)); |
| 127 | 121 | ||
| 128 | /* Disconnect Initiate/Disconnect Confirm */ | 122 | /* Disconnect Initiate/Disconnect Confirm */ |
| 129 | struct nsp_disconn_init_msg | 123 | struct nsp_disconn_init_msg { |
| 130 | { | ||
| 131 | __u8 msgflg; | 124 | __u8 msgflg; |
| 132 | __le16 dstaddr; | 125 | __le16 dstaddr; |
| 133 | __le16 srcaddr; | 126 | __le16 srcaddr; |
| @@ -136,8 +129,7 @@ struct nsp_disconn_init_msg | |||
| 136 | 129 | ||
| 137 | 130 | ||
| 138 | 131 | ||
| 139 | struct srcobj_fmt | 132 | struct srcobj_fmt { |
| 140 | { | ||
| 141 | __u8 format; | 133 | __u8 format; |
| 142 | __u8 task; | 134 | __u8 task; |
| 143 | __le16 grpcode; | 135 | __le16 grpcode; |
diff --git a/include/net/dst.h b/include/net/dst.h index 5a900ddcf10d..ce078cda6b74 100644 --- a/include/net/dst.h +++ b/include/net/dst.h | |||
| @@ -36,8 +36,7 @@ | |||
| 36 | 36 | ||
| 37 | struct sk_buff; | 37 | struct sk_buff; |
| 38 | 38 | ||
| 39 | struct dst_entry | 39 | struct dst_entry { |
| 40 | { | ||
| 41 | struct rcu_head rcu_head; | 40 | struct rcu_head rcu_head; |
| 42 | struct dst_entry *child; | 41 | struct dst_entry *child; |
| 43 | struct net_device *dev; | 42 | struct net_device *dev; |
| @@ -84,8 +83,6 @@ struct dst_entry | |||
| 84 | * (L1_CACHE_SIZE would be too much) | 83 | * (L1_CACHE_SIZE would be too much) |
| 85 | */ | 84 | */ |
| 86 | #ifdef CONFIG_64BIT | 85 | #ifdef CONFIG_64BIT |
| 87 | long __pad_to_align_refcnt[2]; | ||
| 88 | #else | ||
| 89 | long __pad_to_align_refcnt[1]; | 86 | long __pad_to_align_refcnt[1]; |
| 90 | #endif | 87 | #endif |
| 91 | /* | 88 | /* |
| @@ -111,6 +108,12 @@ dst_metric(const struct dst_entry *dst, int metric) | |||
| 111 | return dst->metrics[metric-1]; | 108 | return dst->metrics[metric-1]; |
| 112 | } | 109 | } |
| 113 | 110 | ||
| 111 | static inline u32 | ||
| 112 | dst_feature(const struct dst_entry *dst, u32 feature) | ||
| 113 | { | ||
| 114 | return dst_metric(dst, RTAX_FEATURES) & feature; | ||
| 115 | } | ||
| 116 | |||
| 114 | static inline u32 dst_mtu(const struct dst_entry *dst) | 117 | static inline u32 dst_mtu(const struct dst_entry *dst) |
| 115 | { | 118 | { |
| 116 | u32 mtu = dst_metric(dst, RTAX_MTU); | 119 | u32 mtu = dst_metric(dst, RTAX_MTU); |
| @@ -136,7 +139,7 @@ static inline void set_dst_metric_rtt(struct dst_entry *dst, int metric, | |||
| 136 | static inline u32 | 139 | static inline u32 |
| 137 | dst_allfrag(const struct dst_entry *dst) | 140 | dst_allfrag(const struct dst_entry *dst) |
| 138 | { | 141 | { |
| 139 | int ret = dst_metric(dst, RTAX_FEATURES) & RTAX_FEATURE_ALLFRAG; | 142 | int ret = dst_feature(dst, RTAX_FEATURE_ALLFRAG); |
| 140 | /* Yes, _exactly_. This is paranoia. */ | 143 | /* Yes, _exactly_. This is paranoia. */ |
| 141 | barrier(); | 144 | barrier(); |
| 142 | return ret; | 145 | return ret; |
| @@ -222,11 +225,19 @@ static inline void dst_confirm(struct dst_entry *dst) | |||
| 222 | neigh_confirm(dst->neighbour); | 225 | neigh_confirm(dst->neighbour); |
| 223 | } | 226 | } |
| 224 | 227 | ||
| 225 | static inline void dst_negative_advice(struct dst_entry **dst_p) | 228 | static inline void dst_negative_advice(struct dst_entry **dst_p, |
| 229 | struct sock *sk) | ||
| 226 | { | 230 | { |
| 227 | struct dst_entry * dst = *dst_p; | 231 | struct dst_entry * dst = *dst_p; |
| 228 | if (dst && dst->ops->negative_advice) | 232 | if (dst && dst->ops->negative_advice) { |
| 229 | *dst_p = dst->ops->negative_advice(dst); | 233 | *dst_p = dst->ops->negative_advice(dst); |
| 234 | |||
| 235 | if (dst != *dst_p) { | ||
| 236 | extern void sk_reset_txq(struct sock *sk); | ||
| 237 | |||
| 238 | sk_reset_txq(sk); | ||
| 239 | } | ||
| 240 | } | ||
| 230 | } | 241 | } |
| 231 | 242 | ||
| 232 | static inline void dst_link_failure(struct sk_buff *skb) | 243 | static inline void dst_link_failure(struct sk_buff *skb) |
diff --git a/include/net/fib_rules.h b/include/net/fib_rules.h index ca4b2e840078..c49086d2bc7d 100644 --- a/include/net/fib_rules.h +++ b/include/net/fib_rules.h | |||
| @@ -2,17 +2,17 @@ | |||
| 2 | #define __NET_FIB_RULES_H | 2 | #define __NET_FIB_RULES_H |
| 3 | 3 | ||
| 4 | #include <linux/types.h> | 4 | #include <linux/types.h> |
| 5 | #include <linux/slab.h> | ||
| 5 | #include <linux/netdevice.h> | 6 | #include <linux/netdevice.h> |
| 6 | #include <linux/fib_rules.h> | 7 | #include <linux/fib_rules.h> |
| 7 | #include <net/flow.h> | 8 | #include <net/flow.h> |
| 8 | #include <net/rtnetlink.h> | 9 | #include <net/rtnetlink.h> |
| 9 | 10 | ||
| 10 | struct fib_rule | 11 | struct fib_rule { |
| 11 | { | ||
| 12 | struct list_head list; | 12 | struct list_head list; |
| 13 | atomic_t refcnt; | 13 | atomic_t refcnt; |
| 14 | int ifindex; | 14 | int iifindex; |
| 15 | char ifname[IFNAMSIZ]; | 15 | int oifindex; |
| 16 | u32 mark; | 16 | u32 mark; |
| 17 | u32 mark_mask; | 17 | u32 mark_mask; |
| 18 | u32 pref; | 18 | u32 pref; |
| @@ -21,19 +21,19 @@ struct fib_rule | |||
| 21 | u8 action; | 21 | u8 action; |
| 22 | u32 target; | 22 | u32 target; |
| 23 | struct fib_rule * ctarget; | 23 | struct fib_rule * ctarget; |
| 24 | char iifname[IFNAMSIZ]; | ||
| 25 | char oifname[IFNAMSIZ]; | ||
| 24 | struct rcu_head rcu; | 26 | struct rcu_head rcu; |
| 25 | struct net * fr_net; | 27 | struct net * fr_net; |
| 26 | }; | 28 | }; |
| 27 | 29 | ||
| 28 | struct fib_lookup_arg | 30 | struct fib_lookup_arg { |
| 29 | { | ||
| 30 | void *lookup_ptr; | 31 | void *lookup_ptr; |
| 31 | void *result; | 32 | void *result; |
| 32 | struct fib_rule *rule; | 33 | struct fib_rule *rule; |
| 33 | }; | 34 | }; |
| 34 | 35 | ||
| 35 | struct fib_rules_ops | 36 | struct fib_rules_ops { |
| 36 | { | ||
| 37 | int family; | 37 | int family; |
| 38 | struct list_head list; | 38 | struct list_head list; |
| 39 | int rule_size; | 39 | int rule_size; |
| @@ -67,10 +67,12 @@ struct fib_rules_ops | |||
| 67 | struct list_head rules_list; | 67 | struct list_head rules_list; |
| 68 | struct module *owner; | 68 | struct module *owner; |
| 69 | struct net *fro_net; | 69 | struct net *fro_net; |
| 70 | struct rcu_head rcu; | ||
| 70 | }; | 71 | }; |
| 71 | 72 | ||
| 72 | #define FRA_GENERIC_POLICY \ | 73 | #define FRA_GENERIC_POLICY \ |
| 73 | [FRA_IFNAME] = { .type = NLA_STRING, .len = IFNAMSIZ - 1 }, \ | 74 | [FRA_IIFNAME] = { .type = NLA_STRING, .len = IFNAMSIZ - 1 }, \ |
| 75 | [FRA_OIFNAME] = { .type = NLA_STRING, .len = IFNAMSIZ - 1 }, \ | ||
| 74 | [FRA_PRIORITY] = { .type = NLA_U32 }, \ | 76 | [FRA_PRIORITY] = { .type = NLA_U32 }, \ |
| 75 | [FRA_FWMARK] = { .type = NLA_U32 }, \ | 77 | [FRA_FWMARK] = { .type = NLA_U32 }, \ |
| 76 | [FRA_FWMASK] = { .type = NLA_U32 }, \ | 78 | [FRA_FWMASK] = { .type = NLA_U32 }, \ |
| @@ -102,7 +104,7 @@ static inline u32 frh_get_table(struct fib_rule_hdr *frh, struct nlattr **nla) | |||
| 102 | return frh->table; | 104 | return frh->table; |
| 103 | } | 105 | } |
| 104 | 106 | ||
| 105 | extern int fib_rules_register(struct fib_rules_ops *); | 107 | extern struct fib_rules_ops *fib_rules_register(struct fib_rules_ops *, struct net *); |
| 106 | extern void fib_rules_unregister(struct fib_rules_ops *); | 108 | extern void fib_rules_unregister(struct fib_rules_ops *); |
| 107 | extern void fib_rules_cleanup_ops(struct fib_rules_ops *); | 109 | extern void fib_rules_cleanup_ops(struct fib_rules_ops *); |
| 108 | 110 | ||
diff --git a/include/net/gen_stats.h b/include/net/gen_stats.h index c1488553e349..fa157712e982 100644 --- a/include/net/gen_stats.h +++ b/include/net/gen_stats.h | |||
| @@ -6,8 +6,7 @@ | |||
| 6 | #include <linux/rtnetlink.h> | 6 | #include <linux/rtnetlink.h> |
| 7 | #include <linux/pkt_sched.h> | 7 | #include <linux/pkt_sched.h> |
| 8 | 8 | ||
| 9 | struct gnet_dump | 9 | struct gnet_dump { |
| 10 | { | ||
| 11 | spinlock_t * lock; | 10 | spinlock_t * lock; |
| 12 | struct sk_buff * skb; | 11 | struct sk_buff * skb; |
| 13 | struct nlattr * tail; | 12 | struct nlattr * tail; |
| @@ -30,6 +29,7 @@ extern int gnet_stats_start_copy_compat(struct sk_buff *skb, int type, | |||
| 30 | extern int gnet_stats_copy_basic(struct gnet_dump *d, | 29 | extern int gnet_stats_copy_basic(struct gnet_dump *d, |
| 31 | struct gnet_stats_basic_packed *b); | 30 | struct gnet_stats_basic_packed *b); |
| 32 | extern int gnet_stats_copy_rate_est(struct gnet_dump *d, | 31 | extern int gnet_stats_copy_rate_est(struct gnet_dump *d, |
| 32 | const struct gnet_stats_basic_packed *b, | ||
| 33 | struct gnet_stats_rate_est *r); | 33 | struct gnet_stats_rate_est *r); |
| 34 | extern int gnet_stats_copy_queue(struct gnet_dump *d, | 34 | extern int gnet_stats_copy_queue(struct gnet_dump *d, |
| 35 | struct gnet_stats_queue *q); | 35 | struct gnet_stats_queue *q); |
diff --git a/include/net/genetlink.h b/include/net/genetlink.h index 2a1c06874c42..eb551baafc04 100644 --- a/include/net/genetlink.h +++ b/include/net/genetlink.h | |||
| @@ -13,8 +13,7 @@ | |||
| 13 | * @list: list entry for linking | 13 | * @list: list entry for linking |
| 14 | * @family: pointer to family, need not be set before registering | 14 | * @family: pointer to family, need not be set before registering |
| 15 | */ | 15 | */ |
| 16 | struct genl_multicast_group | 16 | struct genl_multicast_group { |
| 17 | { | ||
| 18 | struct genl_family *family; /* private */ | 17 | struct genl_family *family; /* private */ |
| 19 | struct list_head list; /* private */ | 18 | struct list_head list; /* private */ |
| 20 | char name[GENL_NAMSIZ]; | 19 | char name[GENL_NAMSIZ]; |
| @@ -35,8 +34,7 @@ struct genl_multicast_group | |||
| 35 | * @family_list: family list | 34 | * @family_list: family list |
| 36 | * @mcast_groups: multicast groups list | 35 | * @mcast_groups: multicast groups list |
| 37 | */ | 36 | */ |
| 38 | struct genl_family | 37 | struct genl_family { |
| 39 | { | ||
| 40 | unsigned int id; | 38 | unsigned int id; |
| 41 | unsigned int hdrsize; | 39 | unsigned int hdrsize; |
| 42 | char name[GENL_NAMSIZ]; | 40 | char name[GENL_NAMSIZ]; |
| @@ -58,8 +56,7 @@ struct genl_family | |||
| 58 | * @userhdr: user specific header | 56 | * @userhdr: user specific header |
| 59 | * @attrs: netlink attributes | 57 | * @attrs: netlink attributes |
| 60 | */ | 58 | */ |
| 61 | struct genl_info | 59 | struct genl_info { |
| 62 | { | ||
| 63 | u32 snd_seq; | 60 | u32 snd_seq; |
| 64 | u32 snd_pid; | 61 | u32 snd_pid; |
| 65 | struct nlmsghdr * nlhdr; | 62 | struct nlmsghdr * nlhdr; |
| @@ -102,8 +99,7 @@ static inline void genl_info_net_set(struct genl_info *info, struct net *net) | |||
| 102 | * @done: completion callback for dumps | 99 | * @done: completion callback for dumps |
| 103 | * @ops_list: operations list | 100 | * @ops_list: operations list |
| 104 | */ | 101 | */ |
| 105 | struct genl_ops | 102 | struct genl_ops { |
| 106 | { | ||
| 107 | u8 cmd; | 103 | u8 cmd; |
| 108 | unsigned int flags; | 104 | unsigned int flags; |
| 109 | const struct nla_policy *policy; | 105 | const struct nla_policy *policy; |
diff --git a/include/net/icmp.h b/include/net/icmp.h index dfa72d4e8907..15b3dfe9fce8 100644 --- a/include/net/icmp.h +++ b/include/net/icmp.h | |||
| @@ -28,7 +28,7 @@ struct icmp_err { | |||
| 28 | unsigned fatal:1; | 28 | unsigned fatal:1; |
| 29 | }; | 29 | }; |
| 30 | 30 | ||
| 31 | extern struct icmp_err icmp_err_convert[]; | 31 | extern const struct icmp_err icmp_err_convert[]; |
| 32 | #define ICMP_INC_STATS(net, field) SNMP_INC_STATS((net)->mib.icmp_statistics, field) | 32 | #define ICMP_INC_STATS(net, field) SNMP_INC_STATS((net)->mib.icmp_statistics, field) |
| 33 | #define ICMP_INC_STATS_BH(net, field) SNMP_INC_STATS_BH((net)->mib.icmp_statistics, field) | 33 | #define ICMP_INC_STATS_BH(net, field) SNMP_INC_STATS_BH((net)->mib.icmp_statistics, field) |
| 34 | #define ICMPMSGOUT_INC_STATS(net, field) SNMP_INC_STATS((net)->mib.icmpmsg_statistics, field+256) | 34 | #define ICMPMSGOUT_INC_STATS(net, field) SNMP_INC_STATS((net)->mib.icmpmsg_statistics, field+256) |
diff --git a/include/net/ieee80211_radiotap.h b/include/net/ieee80211_radiotap.h index 23c3f3d97779..af49f8ab7f81 100644 --- a/include/net/ieee80211_radiotap.h +++ b/include/net/ieee80211_radiotap.h | |||
| @@ -80,7 +80,7 @@ struct ieee80211_radiotap_header { | |||
| 80 | * Additional extensions are made | 80 | * Additional extensions are made |
| 81 | * by setting bit 31. | 81 | * by setting bit 31. |
| 82 | */ | 82 | */ |
| 83 | }; | 83 | } __packed; |
| 84 | 84 | ||
| 85 | /* Name Data type Units | 85 | /* Name Data type Units |
| 86 | * ---- --------- ----- | 86 | * ---- --------- ----- |
| @@ -198,6 +198,10 @@ enum ieee80211_radiotap_type { | |||
| 198 | IEEE80211_RADIOTAP_TX_FLAGS = 15, | 198 | IEEE80211_RADIOTAP_TX_FLAGS = 15, |
| 199 | IEEE80211_RADIOTAP_RTS_RETRIES = 16, | 199 | IEEE80211_RADIOTAP_RTS_RETRIES = 16, |
| 200 | IEEE80211_RADIOTAP_DATA_RETRIES = 17, | 200 | IEEE80211_RADIOTAP_DATA_RETRIES = 17, |
| 201 | |||
| 202 | /* valid in every it_present bitmap, even vendor namespaces */ | ||
| 203 | IEEE80211_RADIOTAP_RADIOTAP_NAMESPACE = 29, | ||
| 204 | IEEE80211_RADIOTAP_VENDOR_NAMESPACE = 30, | ||
| 201 | IEEE80211_RADIOTAP_EXT = 31 | 205 | IEEE80211_RADIOTAP_EXT = 31 |
| 202 | }; | 206 | }; |
| 203 | 207 | ||
diff --git a/include/net/ieee802154_netdev.h b/include/net/ieee802154_netdev.h index 5dc6a61952de..57430555487a 100644 --- a/include/net/ieee802154_netdev.h +++ b/include/net/ieee802154_netdev.h | |||
| @@ -74,8 +74,12 @@ static inline int mac_cb_type(struct sk_buff *skb) | |||
| 74 | #define IEEE802154_MAC_SCAN_PASSIVE 2 | 74 | #define IEEE802154_MAC_SCAN_PASSIVE 2 |
| 75 | #define IEEE802154_MAC_SCAN_ORPHAN 3 | 75 | #define IEEE802154_MAC_SCAN_ORPHAN 3 |
| 76 | 76 | ||
| 77 | struct wpan_phy; | ||
| 77 | /* | 78 | /* |
| 78 | * This should be located at net_device->ml_priv | 79 | * This should be located at net_device->ml_priv |
| 80 | * | ||
| 81 | * get_phy should increment the reference counting on returned phy. | ||
| 82 | * Use wpan_wpy_put to put that reference. | ||
| 79 | */ | 83 | */ |
| 80 | struct ieee802154_mlme_ops { | 84 | struct ieee802154_mlme_ops { |
| 81 | int (*assoc_req)(struct net_device *dev, | 85 | int (*assoc_req)(struct net_device *dev, |
| @@ -94,18 +98,20 @@ struct ieee802154_mlme_ops { | |||
| 94 | int (*scan_req)(struct net_device *dev, | 98 | int (*scan_req)(struct net_device *dev, |
| 95 | u8 type, u32 channels, u8 page, u8 duration); | 99 | u8 type, u32 channels, u8 page, u8 duration); |
| 96 | 100 | ||
| 101 | struct wpan_phy *(*get_phy)(const struct net_device *dev); | ||
| 102 | |||
| 97 | /* | 103 | /* |
| 98 | * FIXME: these should become the part of PIB/MIB interface. | 104 | * FIXME: these should become the part of PIB/MIB interface. |
| 99 | * However we still don't have IB interface of any kind | 105 | * However we still don't have IB interface of any kind |
| 100 | */ | 106 | */ |
| 101 | u16 (*get_pan_id)(struct net_device *dev); | 107 | u16 (*get_pan_id)(const struct net_device *dev); |
| 102 | u16 (*get_short_addr)(struct net_device *dev); | 108 | u16 (*get_short_addr)(const struct net_device *dev); |
| 103 | u8 (*get_dsn)(struct net_device *dev); | 109 | u8 (*get_dsn)(const struct net_device *dev); |
| 104 | u8 (*get_bsn)(struct net_device *dev); | 110 | u8 (*get_bsn)(const struct net_device *dev); |
| 105 | }; | 111 | }; |
| 106 | 112 | ||
| 107 | static inline struct ieee802154_mlme_ops *ieee802154_mlme_ops( | 113 | static inline struct ieee802154_mlme_ops *ieee802154_mlme_ops( |
| 108 | struct net_device *dev) | 114 | const struct net_device *dev) |
| 109 | { | 115 | { |
| 110 | return dev->ml_priv; | 116 | return dev->ml_priv; |
| 111 | } | 117 | } |
diff --git a/include/net/if_inet6.h b/include/net/if_inet6.h index 38b78132019b..545d8b059bef 100644 --- a/include/net/if_inet6.h +++ b/include/net/if_inet6.h | |||
| @@ -32,8 +32,7 @@ | |||
| 32 | 32 | ||
| 33 | #ifdef __KERNEL__ | 33 | #ifdef __KERNEL__ |
| 34 | 34 | ||
| 35 | struct inet6_ifaddr | 35 | struct inet6_ifaddr { |
| 36 | { | ||
| 37 | struct in6_addr addr; | 36 | struct in6_addr addr; |
| 38 | __u32 prefix_len; | 37 | __u32 prefix_len; |
| 39 | 38 | ||
| @@ -67,8 +66,7 @@ struct inet6_ifaddr | |||
| 67 | int dead; | 66 | int dead; |
| 68 | }; | 67 | }; |
| 69 | 68 | ||
| 70 | struct ip6_sf_socklist | 69 | struct ip6_sf_socklist { |
| 71 | { | ||
| 72 | unsigned int sl_max; | 70 | unsigned int sl_max; |
| 73 | unsigned int sl_count; | 71 | unsigned int sl_count; |
| 74 | struct in6_addr sl_addr[0]; | 72 | struct in6_addr sl_addr[0]; |
| @@ -79,8 +77,7 @@ struct ip6_sf_socklist | |||
| 79 | 77 | ||
| 80 | #define IP6_SFBLOCK 10 /* allocate this many at once */ | 78 | #define IP6_SFBLOCK 10 /* allocate this many at once */ |
| 81 | 79 | ||
| 82 | struct ipv6_mc_socklist | 80 | struct ipv6_mc_socklist { |
| 83 | { | ||
| 84 | struct in6_addr addr; | 81 | struct in6_addr addr; |
| 85 | int ifindex; | 82 | int ifindex; |
| 86 | struct ipv6_mc_socklist *next; | 83 | struct ipv6_mc_socklist *next; |
| @@ -89,8 +86,7 @@ struct ipv6_mc_socklist | |||
| 89 | struct ip6_sf_socklist *sflist; | 86 | struct ip6_sf_socklist *sflist; |
| 90 | }; | 87 | }; |
| 91 | 88 | ||
| 92 | struct ip6_sf_list | 89 | struct ip6_sf_list { |
| 93 | { | ||
| 94 | struct ip6_sf_list *sf_next; | 90 | struct ip6_sf_list *sf_next; |
| 95 | struct in6_addr sf_addr; | 91 | struct in6_addr sf_addr; |
| 96 | unsigned long sf_count[2]; /* include/exclude counts */ | 92 | unsigned long sf_count[2]; /* include/exclude counts */ |
| @@ -105,8 +101,7 @@ struct ip6_sf_list | |||
| 105 | #define MAF_NOREPORT 0x08 | 101 | #define MAF_NOREPORT 0x08 |
| 106 | #define MAF_GSQUERY 0x10 | 102 | #define MAF_GSQUERY 0x10 |
| 107 | 103 | ||
| 108 | struct ifmcaddr6 | 104 | struct ifmcaddr6 { |
| 109 | { | ||
| 110 | struct in6_addr mca_addr; | 105 | struct in6_addr mca_addr; |
| 111 | struct inet6_dev *idev; | 106 | struct inet6_dev *idev; |
| 112 | struct ifmcaddr6 *next; | 107 | struct ifmcaddr6 *next; |
| @@ -126,15 +121,13 @@ struct ifmcaddr6 | |||
| 126 | 121 | ||
| 127 | /* Anycast stuff */ | 122 | /* Anycast stuff */ |
| 128 | 123 | ||
| 129 | struct ipv6_ac_socklist | 124 | struct ipv6_ac_socklist { |
| 130 | { | ||
| 131 | struct in6_addr acl_addr; | 125 | struct in6_addr acl_addr; |
| 132 | int acl_ifindex; | 126 | int acl_ifindex; |
| 133 | struct ipv6_ac_socklist *acl_next; | 127 | struct ipv6_ac_socklist *acl_next; |
| 134 | }; | 128 | }; |
| 135 | 129 | ||
| 136 | struct ifacaddr6 | 130 | struct ifacaddr6 { |
| 137 | { | ||
| 138 | struct in6_addr aca_addr; | 131 | struct in6_addr aca_addr; |
| 139 | struct inet6_dev *aca_idev; | 132 | struct inet6_dev *aca_idev; |
| 140 | struct rt6_info *aca_rt; | 133 | struct rt6_info *aca_rt; |
| @@ -157,15 +150,14 @@ struct ipv6_devstat { | |||
| 157 | DEFINE_SNMP_STAT(struct icmpv6msg_mib, icmpv6msg); | 150 | DEFINE_SNMP_STAT(struct icmpv6msg_mib, icmpv6msg); |
| 158 | }; | 151 | }; |
| 159 | 152 | ||
| 160 | struct inet6_dev | 153 | struct inet6_dev { |
| 161 | { | ||
| 162 | struct net_device *dev; | 154 | struct net_device *dev; |
| 163 | 155 | ||
| 164 | struct inet6_ifaddr *addr_list; | 156 | struct inet6_ifaddr *addr_list; |
| 165 | 157 | ||
| 166 | struct ifmcaddr6 *mc_list; | 158 | struct ifmcaddr6 *mc_list; |
| 167 | struct ifmcaddr6 *mc_tomb; | 159 | struct ifmcaddr6 *mc_tomb; |
| 168 | rwlock_t mc_lock; | 160 | spinlock_t mc_lock; |
| 169 | unsigned char mc_qrv; | 161 | unsigned char mc_qrv; |
| 170 | unsigned char mc_gq_running; | 162 | unsigned char mc_gq_running; |
| 171 | unsigned char mc_ifc_count; | 163 | unsigned char mc_ifc_count; |
diff --git a/include/net/inet6_hashtables.h b/include/net/inet6_hashtables.h index 22c73a77cd99..e46674d5daea 100644 --- a/include/net/inet6_hashtables.h +++ b/include/net/inet6_hashtables.h | |||
| @@ -46,14 +46,14 @@ static inline int inet6_sk_ehashfn(const struct sock *sk) | |||
| 46 | const struct ipv6_pinfo *np = inet6_sk(sk); | 46 | const struct ipv6_pinfo *np = inet6_sk(sk); |
| 47 | const struct in6_addr *laddr = &np->rcv_saddr; | 47 | const struct in6_addr *laddr = &np->rcv_saddr; |
| 48 | const struct in6_addr *faddr = &np->daddr; | 48 | const struct in6_addr *faddr = &np->daddr; |
| 49 | const __u16 lport = inet->num; | 49 | const __u16 lport = inet->inet_num; |
| 50 | const __be16 fport = inet->dport; | 50 | const __be16 fport = inet->inet_dport; |
| 51 | struct net *net = sock_net(sk); | 51 | struct net *net = sock_net(sk); |
| 52 | 52 | ||
| 53 | return inet6_ehashfn(net, laddr, lport, faddr, fport); | 53 | return inet6_ehashfn(net, laddr, lport, faddr, fport); |
| 54 | } | 54 | } |
| 55 | 55 | ||
| 56 | extern void __inet6_hash(struct sock *sk); | 56 | extern int __inet6_hash(struct sock *sk, struct inet_timewait_sock *twp); |
| 57 | 57 | ||
| 58 | /* | 58 | /* |
| 59 | * Sockets in TCP_CLOSE state are _always_ taken out of the hash, so | 59 | * Sockets in TCP_CLOSE state are _always_ taken out of the hash, so |
diff --git a/include/net/inet_hashtables.h b/include/net/inet_hashtables.h index d522dcf3031a..74358d1b3f43 100644 --- a/include/net/inet_hashtables.h +++ b/include/net/inet_hashtables.h | |||
| @@ -92,8 +92,8 @@ static inline struct net *ib_net(struct inet_bind_bucket *ib) | |||
| 92 | return read_pnet(&ib->ib_net); | 92 | return read_pnet(&ib->ib_net); |
| 93 | } | 93 | } |
| 94 | 94 | ||
| 95 | #define inet_bind_bucket_for_each(tb, node, head) \ | 95 | #define inet_bind_bucket_for_each(tb, pos, head) \ |
| 96 | hlist_for_each_entry(tb, node, head, node) | 96 | hlist_for_each_entry(tb, pos, head, node) |
| 97 | 97 | ||
| 98 | struct inet_bind_hashbucket { | 98 | struct inet_bind_hashbucket { |
| 99 | spinlock_t lock; | 99 | spinlock_t lock; |
| @@ -125,7 +125,7 @@ struct inet_hashinfo { | |||
| 125 | */ | 125 | */ |
| 126 | struct inet_ehash_bucket *ehash; | 126 | struct inet_ehash_bucket *ehash; |
| 127 | spinlock_t *ehash_locks; | 127 | spinlock_t *ehash_locks; |
| 128 | unsigned int ehash_size; | 128 | unsigned int ehash_mask; |
| 129 | unsigned int ehash_locks_mask; | 129 | unsigned int ehash_locks_mask; |
| 130 | 130 | ||
| 131 | /* Ok, let's try this, I give up, we do need a local binding | 131 | /* Ok, let's try this, I give up, we do need a local binding |
| @@ -158,7 +158,7 @@ static inline struct inet_ehash_bucket *inet_ehash_bucket( | |||
| 158 | struct inet_hashinfo *hashinfo, | 158 | struct inet_hashinfo *hashinfo, |
| 159 | unsigned int hash) | 159 | unsigned int hash) |
| 160 | { | 160 | { |
| 161 | return &hashinfo->ehash[hash & (hashinfo->ehash_size - 1)]; | 161 | return &hashinfo->ehash[hash & hashinfo->ehash_mask]; |
| 162 | } | 162 | } |
| 163 | 163 | ||
| 164 | static inline spinlock_t *inet_ehash_lockp( | 164 | static inline spinlock_t *inet_ehash_lockp( |
| @@ -241,7 +241,7 @@ static inline int inet_lhashfn(struct net *net, const unsigned short num) | |||
| 241 | 241 | ||
| 242 | static inline int inet_sk_listen_hashfn(const struct sock *sk) | 242 | static inline int inet_sk_listen_hashfn(const struct sock *sk) |
| 243 | { | 243 | { |
| 244 | return inet_lhashfn(sock_net(sk), inet_sk(sk)->num); | 244 | return inet_lhashfn(sock_net(sk), inet_sk(sk)->inet_num); |
| 245 | } | 245 | } |
| 246 | 246 | ||
| 247 | /* Caller must disable local BH processing. */ | 247 | /* Caller must disable local BH processing. */ |
| @@ -251,7 +251,7 @@ extern void inet_put_port(struct sock *sk); | |||
| 251 | 251 | ||
| 252 | void inet_hashinfo_init(struct inet_hashinfo *h); | 252 | void inet_hashinfo_init(struct inet_hashinfo *h); |
| 253 | 253 | ||
| 254 | extern void __inet_hash_nolisten(struct sock *sk); | 254 | extern int __inet_hash_nolisten(struct sock *sk, struct inet_timewait_sock *tw); |
| 255 | extern void inet_hash(struct sock *sk); | 255 | extern void inet_hash(struct sock *sk); |
| 256 | extern void inet_unhash(struct sock *sk); | 256 | extern void inet_unhash(struct sock *sk); |
| 257 | 257 | ||
| @@ -301,8 +301,8 @@ typedef __u64 __bitwise __addrpair; | |||
| 301 | #endif /* __BIG_ENDIAN */ | 301 | #endif /* __BIG_ENDIAN */ |
| 302 | #define INET_MATCH(__sk, __net, __hash, __cookie, __saddr, __daddr, __ports, __dif)\ | 302 | #define INET_MATCH(__sk, __net, __hash, __cookie, __saddr, __daddr, __ports, __dif)\ |
| 303 | (((__sk)->sk_hash == (__hash)) && net_eq(sock_net(__sk), (__net)) && \ | 303 | (((__sk)->sk_hash == (__hash)) && net_eq(sock_net(__sk), (__net)) && \ |
| 304 | ((*((__addrpair *)&(inet_sk(__sk)->daddr))) == (__cookie)) && \ | 304 | ((*((__addrpair *)&(inet_sk(__sk)->inet_daddr))) == (__cookie)) && \ |
| 305 | ((*((__portpair *)&(inet_sk(__sk)->dport))) == (__ports)) && \ | 305 | ((*((__portpair *)&(inet_sk(__sk)->inet_dport))) == (__ports)) && \ |
| 306 | (!((__sk)->sk_bound_dev_if) || ((__sk)->sk_bound_dev_if == (__dif)))) | 306 | (!((__sk)->sk_bound_dev_if) || ((__sk)->sk_bound_dev_if == (__dif)))) |
| 307 | #define INET_TW_MATCH(__sk, __net, __hash, __cookie, __saddr, __daddr, __ports, __dif)\ | 307 | #define INET_TW_MATCH(__sk, __net, __hash, __cookie, __saddr, __daddr, __ports, __dif)\ |
| 308 | (((__sk)->sk_hash == (__hash)) && net_eq(sock_net(__sk), (__net)) && \ | 308 | (((__sk)->sk_hash == (__hash)) && net_eq(sock_net(__sk), (__net)) && \ |
| @@ -313,9 +313,9 @@ typedef __u64 __bitwise __addrpair; | |||
| 313 | #define INET_ADDR_COOKIE(__name, __saddr, __daddr) | 313 | #define INET_ADDR_COOKIE(__name, __saddr, __daddr) |
| 314 | #define INET_MATCH(__sk, __net, __hash, __cookie, __saddr, __daddr, __ports, __dif) \ | 314 | #define INET_MATCH(__sk, __net, __hash, __cookie, __saddr, __daddr, __ports, __dif) \ |
| 315 | (((__sk)->sk_hash == (__hash)) && net_eq(sock_net(__sk), (__net)) && \ | 315 | (((__sk)->sk_hash == (__hash)) && net_eq(sock_net(__sk), (__net)) && \ |
| 316 | (inet_sk(__sk)->daddr == (__saddr)) && \ | 316 | (inet_sk(__sk)->inet_daddr == (__saddr)) && \ |
| 317 | (inet_sk(__sk)->rcv_saddr == (__daddr)) && \ | 317 | (inet_sk(__sk)->inet_rcv_saddr == (__daddr)) && \ |
| 318 | ((*((__portpair *)&(inet_sk(__sk)->dport))) == (__ports)) && \ | 318 | ((*((__portpair *)&(inet_sk(__sk)->inet_dport))) == (__ports)) && \ |
| 319 | (!((__sk)->sk_bound_dev_if) || ((__sk)->sk_bound_dev_if == (__dif)))) | 319 | (!((__sk)->sk_bound_dev_if) || ((__sk)->sk_bound_dev_if == (__dif)))) |
| 320 | #define INET_TW_MATCH(__sk, __net, __hash,__cookie, __saddr, __daddr, __ports, __dif) \ | 320 | #define INET_TW_MATCH(__sk, __net, __hash,__cookie, __saddr, __daddr, __ports, __dif) \ |
| 321 | (((__sk)->sk_hash == (__hash)) && net_eq(sock_net(__sk), (__net)) && \ | 321 | (((__sk)->sk_hash == (__hash)) && net_eq(sock_net(__sk), (__net)) && \ |
| @@ -391,10 +391,12 @@ static inline struct sock *__inet_lookup_skb(struct inet_hashinfo *hashinfo, | |||
| 391 | } | 391 | } |
| 392 | 392 | ||
| 393 | extern int __inet_hash_connect(struct inet_timewait_death_row *death_row, | 393 | extern int __inet_hash_connect(struct inet_timewait_death_row *death_row, |
| 394 | struct sock *sk, u32 port_offset, | 394 | struct sock *sk, |
| 395 | u32 port_offset, | ||
| 395 | int (*check_established)(struct inet_timewait_death_row *, | 396 | int (*check_established)(struct inet_timewait_death_row *, |
| 396 | struct sock *, __u16, struct inet_timewait_sock **), | 397 | struct sock *, __u16, struct inet_timewait_sock **), |
| 397 | void (*hash)(struct sock *sk)); | 398 | int (*hash)(struct sock *sk, struct inet_timewait_sock *twp)); |
| 399 | |||
| 398 | extern int inet_hash_connect(struct inet_timewait_death_row *death_row, | 400 | extern int inet_hash_connect(struct inet_timewait_death_row *death_row, |
| 399 | struct sock *sk); | 401 | struct sock *sk); |
| 400 | #endif /* _INET_HASHTABLES_H */ | 402 | #endif /* _INET_HASHTABLES_H */ |
diff --git a/include/net/inet_sock.h b/include/net/inet_sock.h index 47004f35cc7e..83fd34437cf1 100644 --- a/include/net/inet_sock.h +++ b/include/net/inet_sock.h | |||
| @@ -93,14 +93,14 @@ struct rtable; | |||
| 93 | * | 93 | * |
| 94 | * @sk - ancestor class | 94 | * @sk - ancestor class |
| 95 | * @pinet6 - pointer to IPv6 control block | 95 | * @pinet6 - pointer to IPv6 control block |
| 96 | * @daddr - Foreign IPv4 addr | 96 | * @inet_daddr - Foreign IPv4 addr |
| 97 | * @rcv_saddr - Bound local IPv4 addr | 97 | * @inet_rcv_saddr - Bound local IPv4 addr |
| 98 | * @dport - Destination port | 98 | * @inet_dport - Destination port |
| 99 | * @num - Local port | 99 | * @inet_num - Local port |
| 100 | * @saddr - Sending source | 100 | * @inet_saddr - Sending source |
| 101 | * @uc_ttl - Unicast TTL | 101 | * @uc_ttl - Unicast TTL |
| 102 | * @sport - Source port | 102 | * @inet_sport - Source port |
| 103 | * @id - ID counter for DF pkts | 103 | * @inet_id - ID counter for DF pkts |
| 104 | * @tos - TOS | 104 | * @tos - TOS |
| 105 | * @mc_ttl - Multicasting TTL | 105 | * @mc_ttl - Multicasting TTL |
| 106 | * @is_icsk - is this an inet_connection_sock? | 106 | * @is_icsk - is this an inet_connection_sock? |
| @@ -115,17 +115,19 @@ struct inet_sock { | |||
| 115 | struct ipv6_pinfo *pinet6; | 115 | struct ipv6_pinfo *pinet6; |
| 116 | #endif | 116 | #endif |
| 117 | /* Socket demultiplex comparisons on incoming packets. */ | 117 | /* Socket demultiplex comparisons on incoming packets. */ |
| 118 | __be32 daddr; | 118 | __be32 inet_daddr; |
| 119 | __be32 rcv_saddr; | 119 | __be32 inet_rcv_saddr; |
| 120 | __be16 dport; | 120 | __be16 inet_dport; |
| 121 | __u16 num; | 121 | __u16 inet_num; |
| 122 | __be32 saddr; | 122 | __be32 inet_saddr; |
| 123 | __s16 uc_ttl; | 123 | __s16 uc_ttl; |
| 124 | __u16 cmsg_flags; | 124 | __u16 cmsg_flags; |
| 125 | __be16 inet_sport; | ||
| 126 | __u16 inet_id; | ||
| 127 | |||
| 125 | struct ip_options *opt; | 128 | struct ip_options *opt; |
| 126 | __be16 sport; | ||
| 127 | __u16 id; | ||
| 128 | __u8 tos; | 129 | __u8 tos; |
| 130 | __u8 min_ttl; | ||
| 129 | __u8 mc_ttl; | 131 | __u8 mc_ttl; |
| 130 | __u8 pmtudisc; | 132 | __u8 pmtudisc; |
| 131 | __u8 recverr:1, | 133 | __u8 recverr:1, |
| @@ -190,10 +192,10 @@ static inline unsigned int inet_ehashfn(struct net *net, | |||
| 190 | static inline int inet_sk_ehashfn(const struct sock *sk) | 192 | static inline int inet_sk_ehashfn(const struct sock *sk) |
| 191 | { | 193 | { |
| 192 | const struct inet_sock *inet = inet_sk(sk); | 194 | const struct inet_sock *inet = inet_sk(sk); |
| 193 | const __be32 laddr = inet->rcv_saddr; | 195 | const __be32 laddr = inet->inet_rcv_saddr; |
| 194 | const __u16 lport = inet->num; | 196 | const __u16 lport = inet->inet_num; |
| 195 | const __be32 faddr = inet->daddr; | 197 | const __be32 faddr = inet->inet_daddr; |
| 196 | const __be16 fport = inet->dport; | 198 | const __be16 fport = inet->inet_dport; |
| 197 | struct net *net = sock_net(sk); | 199 | struct net *net = sock_net(sk); |
| 198 | 200 | ||
| 199 | return inet_ehashfn(net, laddr, lport, faddr, fport); | 201 | return inet_ehashfn(net, laddr, lport, faddr, fport); |
diff --git a/include/net/inet_timewait_sock.h b/include/net/inet_timewait_sock.h index f93ad90a601b..79f67eae8a7e 100644 --- a/include/net/inet_timewait_sock.h +++ b/include/net/inet_timewait_sock.h | |||
| @@ -194,11 +194,16 @@ static inline struct inet_timewait_sock *inet_twsk(const struct sock *sk) | |||
| 194 | static inline __be32 inet_rcv_saddr(const struct sock *sk) | 194 | static inline __be32 inet_rcv_saddr(const struct sock *sk) |
| 195 | { | 195 | { |
| 196 | return likely(sk->sk_state != TCP_TIME_WAIT) ? | 196 | return likely(sk->sk_state != TCP_TIME_WAIT) ? |
| 197 | inet_sk(sk)->rcv_saddr : inet_twsk(sk)->tw_rcv_saddr; | 197 | inet_sk(sk)->inet_rcv_saddr : inet_twsk(sk)->tw_rcv_saddr; |
| 198 | } | 198 | } |
| 199 | 199 | ||
| 200 | extern void inet_twsk_put(struct inet_timewait_sock *tw); | 200 | extern void inet_twsk_put(struct inet_timewait_sock *tw); |
| 201 | 201 | ||
| 202 | extern int inet_twsk_unhash(struct inet_timewait_sock *tw); | ||
| 203 | |||
| 204 | extern int inet_twsk_bind_unhash(struct inet_timewait_sock *tw, | ||
| 205 | struct inet_hashinfo *hashinfo); | ||
| 206 | |||
| 202 | extern struct inet_timewait_sock *inet_twsk_alloc(const struct sock *sk, | 207 | extern struct inet_timewait_sock *inet_twsk_alloc(const struct sock *sk, |
| 203 | const int state); | 208 | const int state); |
| 204 | 209 | ||
| @@ -212,14 +217,14 @@ extern void inet_twsk_schedule(struct inet_timewait_sock *tw, | |||
| 212 | extern void inet_twsk_deschedule(struct inet_timewait_sock *tw, | 217 | extern void inet_twsk_deschedule(struct inet_timewait_sock *tw, |
| 213 | struct inet_timewait_death_row *twdr); | 218 | struct inet_timewait_death_row *twdr); |
| 214 | 219 | ||
| 215 | extern void inet_twsk_purge(struct net *net, struct inet_hashinfo *hashinfo, | 220 | extern void inet_twsk_purge(struct inet_hashinfo *hashinfo, |
| 216 | struct inet_timewait_death_row *twdr, int family); | 221 | struct inet_timewait_death_row *twdr, int family); |
| 217 | 222 | ||
| 218 | static inline | 223 | static inline |
| 219 | struct net *twsk_net(const struct inet_timewait_sock *twsk) | 224 | struct net *twsk_net(const struct inet_timewait_sock *twsk) |
| 220 | { | 225 | { |
| 221 | #ifdef CONFIG_NET_NS | 226 | #ifdef CONFIG_NET_NS |
| 222 | return twsk->tw_net; | 227 | return rcu_dereference(twsk->tw_net); |
| 223 | #else | 228 | #else |
| 224 | return &init_net; | 229 | return &init_net; |
| 225 | #endif | 230 | #endif |
| @@ -229,7 +234,7 @@ static inline | |||
| 229 | void twsk_net_set(struct inet_timewait_sock *twsk, struct net *net) | 234 | void twsk_net_set(struct inet_timewait_sock *twsk, struct net *net) |
| 230 | { | 235 | { |
| 231 | #ifdef CONFIG_NET_NS | 236 | #ifdef CONFIG_NET_NS |
| 232 | twsk->tw_net = net; | 237 | rcu_assign_pointer(twsk->tw_net, net); |
| 233 | #endif | 238 | #endif |
| 234 | } | 239 | } |
| 235 | #endif /* _INET_TIMEWAIT_SOCK_ */ | 240 | #endif /* _INET_TIMEWAIT_SOCK_ */ |
diff --git a/include/net/inetpeer.h b/include/net/inetpeer.h index 15e1f8fe4c1f..87b1df0d4d8c 100644 --- a/include/net/inetpeer.h +++ b/include/net/inetpeer.h | |||
| @@ -13,20 +13,19 @@ | |||
| 13 | #include <linux/spinlock.h> | 13 | #include <linux/spinlock.h> |
| 14 | #include <asm/atomic.h> | 14 | #include <asm/atomic.h> |
| 15 | 15 | ||
| 16 | struct inet_peer | 16 | struct inet_peer { |
| 17 | { | ||
| 18 | /* group together avl_left,avl_right,v4daddr to speedup lookups */ | 17 | /* group together avl_left,avl_right,v4daddr to speedup lookups */ |
| 19 | struct inet_peer *avl_left, *avl_right; | 18 | struct inet_peer *avl_left, *avl_right; |
| 20 | __be32 v4daddr; /* peer's address */ | 19 | __be32 v4daddr; /* peer's address */ |
| 21 | __u16 avl_height; | 20 | __u32 avl_height; |
| 22 | __u16 ip_id_count; /* IP ID for the next packet */ | ||
| 23 | struct list_head unused; | 21 | struct list_head unused; |
| 24 | __u32 dtime; /* the time of last use of not | 22 | __u32 dtime; /* the time of last use of not |
| 25 | * referenced entries */ | 23 | * referenced entries */ |
| 26 | atomic_t refcnt; | 24 | atomic_t refcnt; |
| 27 | atomic_t rid; /* Frag reception counter */ | 25 | atomic_t rid; /* Frag reception counter */ |
| 26 | atomic_t ip_id_count; /* IP ID for the next packet */ | ||
| 28 | __u32 tcp_ts; | 27 | __u32 tcp_ts; |
| 29 | unsigned long tcp_ts_stamp; | 28 | __u32 tcp_ts_stamp; |
| 30 | }; | 29 | }; |
| 31 | 30 | ||
| 32 | void inet_initpeers(void) __init; | 31 | void inet_initpeers(void) __init; |
| @@ -37,17 +36,11 @@ struct inet_peer *inet_getpeer(__be32 daddr, int create); | |||
| 37 | /* can be called from BH context or outside */ | 36 | /* can be called from BH context or outside */ |
| 38 | extern void inet_putpeer(struct inet_peer *p); | 37 | extern void inet_putpeer(struct inet_peer *p); |
| 39 | 38 | ||
| 40 | extern spinlock_t inet_peer_idlock; | ||
| 41 | /* can be called with or without local BH being disabled */ | 39 | /* can be called with or without local BH being disabled */ |
| 42 | static inline __u16 inet_getid(struct inet_peer *p, int more) | 40 | static inline __u16 inet_getid(struct inet_peer *p, int more) |
| 43 | { | 41 | { |
| 44 | __u16 id; | 42 | more++; |
| 45 | 43 | return atomic_add_return(more, &p->ip_id_count) - more; | |
| 46 | spin_lock_bh(&inet_peer_idlock); | ||
| 47 | id = p->ip_id_count; | ||
| 48 | p->ip_id_count += 1 + more; | ||
| 49 | spin_unlock_bh(&inet_peer_idlock); | ||
| 50 | return id; | ||
| 51 | } | 44 | } |
| 52 | 45 | ||
| 53 | #endif /* _NET_INETPEER_H */ | 46 | #endif /* _NET_INETPEER_H */ |
diff --git a/include/net/ip.h b/include/net/ip.h index 2f47e5482b55..503994a38ed1 100644 --- a/include/net/ip.h +++ b/include/net/ip.h | |||
| @@ -33,8 +33,7 @@ | |||
| 33 | 33 | ||
| 34 | struct sock; | 34 | struct sock; |
| 35 | 35 | ||
| 36 | struct inet_skb_parm | 36 | struct inet_skb_parm { |
| 37 | { | ||
| 38 | struct ip_options opt; /* Compiled IP options */ | 37 | struct ip_options opt; /* Compiled IP options */ |
| 39 | unsigned char flags; | 38 | unsigned char flags; |
| 40 | 39 | ||
| @@ -50,8 +49,7 @@ static inline unsigned int ip_hdrlen(const struct sk_buff *skb) | |||
| 50 | return ip_hdr(skb)->ihl * 4; | 49 | return ip_hdr(skb)->ihl * 4; |
| 51 | } | 50 | } |
| 52 | 51 | ||
| 53 | struct ipcm_cookie | 52 | struct ipcm_cookie { |
| 54 | { | ||
| 55 | __be32 addr; | 53 | __be32 addr; |
| 56 | int oif; | 54 | int oif; |
| 57 | struct ip_options *opt; | 55 | struct ip_options *opt; |
| @@ -60,8 +58,7 @@ struct ipcm_cookie | |||
| 60 | 58 | ||
| 61 | #define IPCB(skb) ((struct inet_skb_parm*)((skb)->cb)) | 59 | #define IPCB(skb) ((struct inet_skb_parm*)((skb)->cb)) |
| 62 | 60 | ||
| 63 | struct ip_ra_chain | 61 | struct ip_ra_chain { |
| 64 | { | ||
| 65 | struct ip_ra_chain *next; | 62 | struct ip_ra_chain *next; |
| 66 | struct sock *sk; | 63 | struct sock *sk; |
| 67 | void (*destructor)(struct sock *); | 64 | void (*destructor)(struct sock *); |
| @@ -159,8 +156,7 @@ static inline __u8 ip_reply_arg_flowi_flags(const struct ip_reply_arg *arg) | |||
| 159 | void ip_send_reply(struct sock *sk, struct sk_buff *skb, struct ip_reply_arg *arg, | 156 | void ip_send_reply(struct sock *sk, struct sk_buff *skb, struct ip_reply_arg *arg, |
| 160 | unsigned int len); | 157 | unsigned int len); |
| 161 | 158 | ||
| 162 | struct ipv4_config | 159 | struct ipv4_config { |
| 163 | { | ||
| 164 | int log_martians; | 160 | int log_martians; |
| 165 | int no_pmtu_disc; | 161 | int no_pmtu_disc; |
| 166 | }; | 162 | }; |
| @@ -178,9 +174,9 @@ extern struct ipv4_config ipv4_config; | |||
| 178 | #define NET_ADD_STATS_BH(net, field, adnd) SNMP_ADD_STATS_BH((net)->mib.net_statistics, field, adnd) | 174 | #define NET_ADD_STATS_BH(net, field, adnd) SNMP_ADD_STATS_BH((net)->mib.net_statistics, field, adnd) |
| 179 | #define NET_ADD_STATS_USER(net, field, adnd) SNMP_ADD_STATS_USER((net)->mib.net_statistics, field, adnd) | 175 | #define NET_ADD_STATS_USER(net, field, adnd) SNMP_ADD_STATS_USER((net)->mib.net_statistics, field, adnd) |
| 180 | 176 | ||
| 181 | extern unsigned long snmp_fold_field(void *mib[], int offt); | 177 | extern unsigned long snmp_fold_field(void __percpu *mib[], int offt); |
| 182 | extern int snmp_mib_init(void *ptr[2], size_t mibsize); | 178 | extern int snmp_mib_init(void __percpu *ptr[2], size_t mibsize); |
| 183 | extern void snmp_mib_free(void *ptr[2]); | 179 | extern void snmp_mib_free(void __percpu *ptr[2]); |
| 184 | 180 | ||
| 185 | extern struct local_ports { | 181 | extern struct local_ports { |
| 186 | seqlock_t lock; | 182 | seqlock_t lock; |
| @@ -240,8 +236,8 @@ static inline void ip_select_ident(struct iphdr *iph, struct dst_entry *dst, str | |||
| 240 | * does not change, they drop every other packet in | 236 | * does not change, they drop every other packet in |
| 241 | * a TCP stream using header compression. | 237 | * a TCP stream using header compression. |
| 242 | */ | 238 | */ |
| 243 | iph->id = (sk && inet_sk(sk)->daddr) ? | 239 | iph->id = (sk && inet_sk(sk)->inet_daddr) ? |
| 244 | htons(inet_sk(sk)->id++) : 0; | 240 | htons(inet_sk(sk)->inet_id++) : 0; |
| 245 | } else | 241 | } else |
| 246 | __ip_select_ident(iph, dst, 0); | 242 | __ip_select_ident(iph, dst, 0); |
| 247 | } | 243 | } |
| @@ -249,9 +245,9 @@ static inline void ip_select_ident(struct iphdr *iph, struct dst_entry *dst, str | |||
| 249 | static inline void ip_select_ident_more(struct iphdr *iph, struct dst_entry *dst, struct sock *sk, int more) | 245 | static inline void ip_select_ident_more(struct iphdr *iph, struct dst_entry *dst, struct sock *sk, int more) |
| 250 | { | 246 | { |
| 251 | if (iph->frag_off & htons(IP_DF)) { | 247 | if (iph->frag_off & htons(IP_DF)) { |
| 252 | if (sk && inet_sk(sk)->daddr) { | 248 | if (sk && inet_sk(sk)->inet_daddr) { |
| 253 | iph->id = htons(inet_sk(sk)->id); | 249 | iph->id = htons(inet_sk(sk)->inet_id); |
| 254 | inet_sk(sk)->id += 1 + more; | 250 | inet_sk(sk)->inet_id += 1 + more; |
| 255 | } else | 251 | } else |
| 256 | iph->id = 0; | 252 | iph->id = 0; |
| 257 | } else | 253 | } else |
| @@ -317,7 +313,7 @@ static inline void ip_ib_mc_map(__be32 naddr, const unsigned char *broadcast, ch | |||
| 317 | 313 | ||
| 318 | static __inline__ void inet_reset_saddr(struct sock *sk) | 314 | static __inline__ void inet_reset_saddr(struct sock *sk) |
| 319 | { | 315 | { |
| 320 | inet_sk(sk)->rcv_saddr = inet_sk(sk)->saddr = 0; | 316 | inet_sk(sk)->inet_rcv_saddr = inet_sk(sk)->inet_saddr = 0; |
| 321 | #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) | 317 | #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) |
| 322 | if (sk->sk_family == PF_INET6) { | 318 | if (sk->sk_family == PF_INET6) { |
| 323 | struct ipv6_pinfo *np = inet6_sk(sk); | 319 | struct ipv6_pinfo *np = inet6_sk(sk); |
| @@ -330,18 +326,37 @@ static __inline__ void inet_reset_saddr(struct sock *sk) | |||
| 330 | 326 | ||
| 331 | #endif | 327 | #endif |
| 332 | 328 | ||
| 329 | static inline int sk_mc_loop(struct sock *sk) | ||
| 330 | { | ||
| 331 | if (!sk) | ||
| 332 | return 1; | ||
| 333 | switch (sk->sk_family) { | ||
| 334 | case AF_INET: | ||
| 335 | return inet_sk(sk)->mc_loop; | ||
| 336 | #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) | ||
| 337 | case AF_INET6: | ||
| 338 | return inet6_sk(sk)->mc_loop; | ||
| 339 | #endif | ||
| 340 | } | ||
| 341 | WARN_ON(1); | ||
| 342 | return 1; | ||
| 343 | } | ||
| 344 | |||
| 333 | extern int ip_call_ra_chain(struct sk_buff *skb); | 345 | extern int ip_call_ra_chain(struct sk_buff *skb); |
| 334 | 346 | ||
| 335 | /* | 347 | /* |
| 336 | * Functions provided by ip_fragment.c | 348 | * Functions provided by ip_fragment.c |
| 337 | */ | 349 | */ |
| 338 | 350 | ||
| 339 | enum ip_defrag_users | 351 | enum ip_defrag_users { |
| 340 | { | ||
| 341 | IP_DEFRAG_LOCAL_DELIVER, | 352 | IP_DEFRAG_LOCAL_DELIVER, |
| 342 | IP_DEFRAG_CALL_RA_CHAIN, | 353 | IP_DEFRAG_CALL_RA_CHAIN, |
| 343 | IP_DEFRAG_CONNTRACK_IN, | 354 | IP_DEFRAG_CONNTRACK_IN, |
| 355 | __IP_DEFRAG_CONNTRACK_IN_END = IP_DEFRAG_CONNTRACK_IN + USHORT_MAX, | ||
| 344 | IP_DEFRAG_CONNTRACK_OUT, | 356 | IP_DEFRAG_CONNTRACK_OUT, |
| 357 | __IP_DEFRAG_CONNTRACK_OUT_END = IP_DEFRAG_CONNTRACK_OUT + USHORT_MAX, | ||
| 358 | IP_DEFRAG_CONNTRACK_BRIDGE_IN, | ||
| 359 | __IP_DEFRAG_CONNTRACK_BRIDGE_IN = IP_DEFRAG_CONNTRACK_BRIDGE_IN + USHORT_MAX, | ||
| 345 | IP_DEFRAG_VS_IN, | 360 | IP_DEFRAG_VS_IN, |
| 346 | IP_DEFRAG_VS_OUT, | 361 | IP_DEFRAG_VS_OUT, |
| 347 | IP_DEFRAG_VS_FWD | 362 | IP_DEFRAG_VS_FWD |
diff --git a/include/net/ip6_fib.h b/include/net/ip6_fib.h index 15b492a9aa79..86f46c49e318 100644 --- a/include/net/ip6_fib.h +++ b/include/net/ip6_fib.h | |||
| @@ -30,8 +30,7 @@ | |||
| 30 | 30 | ||
| 31 | struct rt6_info; | 31 | struct rt6_info; |
| 32 | 32 | ||
| 33 | struct fib6_config | 33 | struct fib6_config { |
| 34 | { | ||
| 35 | u32 fc_table; | 34 | u32 fc_table; |
| 36 | u32 fc_metric; | 35 | u32 fc_metric; |
| 37 | int fc_dst_len; | 36 | int fc_dst_len; |
| @@ -51,8 +50,7 @@ struct fib6_config | |||
| 51 | struct nl_info fc_nlinfo; | 50 | struct nl_info fc_nlinfo; |
| 52 | }; | 51 | }; |
| 53 | 52 | ||
| 54 | struct fib6_node | 53 | struct fib6_node { |
| 55 | { | ||
| 56 | struct fib6_node *parent; | 54 | struct fib6_node *parent; |
| 57 | struct fib6_node *left; | 55 | struct fib6_node *left; |
| 58 | struct fib6_node *right; | 56 | struct fib6_node *right; |
| @@ -78,16 +76,14 @@ struct fib6_node | |||
| 78 | * | 76 | * |
| 79 | */ | 77 | */ |
| 80 | 78 | ||
| 81 | struct rt6key | 79 | struct rt6key { |
| 82 | { | ||
| 83 | struct in6_addr addr; | 80 | struct in6_addr addr; |
| 84 | int plen; | 81 | int plen; |
| 85 | }; | 82 | }; |
| 86 | 83 | ||
| 87 | struct fib6_table; | 84 | struct fib6_table; |
| 88 | 85 | ||
| 89 | struct rt6_info | 86 | struct rt6_info { |
| 90 | { | ||
| 91 | union { | 87 | union { |
| 92 | struct dst_entry dst; | 88 | struct dst_entry dst; |
| 93 | } u; | 89 | } u; |
| @@ -127,13 +123,14 @@ static inline struct inet6_dev *ip6_dst_idev(struct dst_entry *dst) | |||
| 127 | return ((struct rt6_info *)dst)->rt6i_idev; | 123 | return ((struct rt6_info *)dst)->rt6i_idev; |
| 128 | } | 124 | } |
| 129 | 125 | ||
| 130 | struct fib6_walker_t | 126 | struct fib6_walker_t { |
| 131 | { | 127 | struct list_head lh; |
| 132 | struct fib6_walker_t *prev, *next; | ||
| 133 | struct fib6_node *root, *node; | 128 | struct fib6_node *root, *node; |
| 134 | struct rt6_info *leaf; | 129 | struct rt6_info *leaf; |
| 135 | unsigned char state; | 130 | unsigned char state; |
| 136 | unsigned char prune; | 131 | unsigned char prune; |
| 132 | unsigned int skip; | ||
| 133 | unsigned int count; | ||
| 137 | int (*func)(struct fib6_walker_t *); | 134 | int (*func)(struct fib6_walker_t *); |
| 138 | void *args; | 135 | void *args; |
| 139 | }; | 136 | }; |
diff --git a/include/net/ip6_route.h b/include/net/ip6_route.h index 0e1b8aebaff8..68f67836e146 100644 --- a/include/net/ip6_route.h +++ b/include/net/ip6_route.h | |||
| @@ -37,6 +37,24 @@ struct route_info { | |||
| 37 | #define RT6_LOOKUP_F_SRCPREF_PUBLIC 0x00000010 | 37 | #define RT6_LOOKUP_F_SRCPREF_PUBLIC 0x00000010 |
| 38 | #define RT6_LOOKUP_F_SRCPREF_COA 0x00000020 | 38 | #define RT6_LOOKUP_F_SRCPREF_COA 0x00000020 |
| 39 | 39 | ||
| 40 | /* | ||
| 41 | * rt6_srcprefs2flags() and rt6_flags2srcprefs() translate | ||
| 42 | * between IPV6_ADDR_PREFERENCES socket option values | ||
| 43 | * IPV6_PREFER_SRC_TMP = 0x1 | ||
| 44 | * IPV6_PREFER_SRC_PUBLIC = 0x2 | ||
| 45 | * IPV6_PREFER_SRC_COA = 0x4 | ||
| 46 | * and above RT6_LOOKUP_F_SRCPREF_xxx flags. | ||
| 47 | */ | ||
| 48 | static inline int rt6_srcprefs2flags(unsigned int srcprefs) | ||
| 49 | { | ||
| 50 | /* No need to bitmask because srcprefs have only 3 bits. */ | ||
| 51 | return srcprefs << 3; | ||
| 52 | } | ||
| 53 | |||
| 54 | static inline unsigned int rt6_flags2srcprefs(int flags) | ||
| 55 | { | ||
| 56 | return (flags >> 3) & 7; | ||
| 57 | } | ||
| 40 | 58 | ||
| 41 | extern void ip6_route_input(struct sk_buff *skb); | 59 | extern void ip6_route_input(struct sk_buff *skb); |
| 42 | 60 | ||
| @@ -103,8 +121,7 @@ extern void rt6_pmtu_discovery(struct in6_addr *daddr, | |||
| 103 | 121 | ||
| 104 | struct netlink_callback; | 122 | struct netlink_callback; |
| 105 | 123 | ||
| 106 | struct rt6_rtnl_dump_arg | 124 | struct rt6_rtnl_dump_arg { |
| 107 | { | ||
| 108 | struct sk_buff *skb; | 125 | struct sk_buff *skb; |
| 109 | struct netlink_callback *cb; | 126 | struct netlink_callback *cb; |
| 110 | struct net *net; | 127 | struct net *net; |
diff --git a/include/net/ip6_tunnel.h b/include/net/ip6_tunnel.h index 83b4e008b16d..fbf9d1cda27b 100644 --- a/include/net/ip6_tunnel.h +++ b/include/net/ip6_tunnel.h | |||
| @@ -15,7 +15,6 @@ | |||
| 15 | struct ip6_tnl { | 15 | struct ip6_tnl { |
| 16 | struct ip6_tnl *next; /* next tunnel in list */ | 16 | struct ip6_tnl *next; /* next tunnel in list */ |
| 17 | struct net_device *dev; /* virtual device associated with tunnel */ | 17 | struct net_device *dev; /* virtual device associated with tunnel */ |
| 18 | int recursion; /* depth of hard_start_xmit recursion */ | ||
| 19 | struct ip6_tnl_parm parms; /* tunnel configuration parameters */ | 18 | struct ip6_tnl_parm parms; /* tunnel configuration parameters */ |
| 20 | struct flowi fl; /* flowi template for xmit */ | 19 | struct flowi fl; /* flowi template for xmit */ |
| 21 | struct dst_entry *dst_cache; /* cached dst */ | 20 | struct dst_entry *dst_cache; /* cached dst */ |
diff --git a/include/net/ip_fib.h b/include/net/ip_fib.h index 4d22fabc7719..c93f94edc610 100644 --- a/include/net/ip_fib.h +++ b/include/net/ip_fib.h | |||
| @@ -144,18 +144,21 @@ struct fib_table { | |||
| 144 | struct hlist_node tb_hlist; | 144 | struct hlist_node tb_hlist; |
| 145 | u32 tb_id; | 145 | u32 tb_id; |
| 146 | int tb_default; | 146 | int tb_default; |
| 147 | int (*tb_lookup)(struct fib_table *tb, const struct flowi *flp, struct fib_result *res); | ||
| 148 | int (*tb_insert)(struct fib_table *, struct fib_config *); | ||
| 149 | int (*tb_delete)(struct fib_table *, struct fib_config *); | ||
| 150 | int (*tb_dump)(struct fib_table *table, struct sk_buff *skb, | ||
| 151 | struct netlink_callback *cb); | ||
| 152 | int (*tb_flush)(struct fib_table *table); | ||
| 153 | void (*tb_select_default)(struct fib_table *table, | ||
| 154 | const struct flowi *flp, struct fib_result *res); | ||
| 155 | |||
| 156 | unsigned char tb_data[0]; | 147 | unsigned char tb_data[0]; |
| 157 | }; | 148 | }; |
| 158 | 149 | ||
| 150 | extern int fib_table_lookup(struct fib_table *tb, const struct flowi *flp, | ||
| 151 | struct fib_result *res); | ||
| 152 | extern int fib_table_insert(struct fib_table *, struct fib_config *); | ||
| 153 | extern int fib_table_delete(struct fib_table *, struct fib_config *); | ||
| 154 | extern int fib_table_dump(struct fib_table *table, struct sk_buff *skb, | ||
| 155 | struct netlink_callback *cb); | ||
| 156 | extern int fib_table_flush(struct fib_table *table); | ||
| 157 | extern void fib_table_select_default(struct fib_table *table, | ||
| 158 | const struct flowi *flp, | ||
| 159 | struct fib_result *res); | ||
| 160 | |||
| 161 | |||
| 159 | #ifndef CONFIG_IP_MULTIPLE_TABLES | 162 | #ifndef CONFIG_IP_MULTIPLE_TABLES |
| 160 | 163 | ||
| 161 | #define TABLE_LOCAL_INDEX 0 | 164 | #define TABLE_LOCAL_INDEX 0 |
| @@ -182,11 +185,11 @@ static inline int fib_lookup(struct net *net, const struct flowi *flp, | |||
| 182 | struct fib_table *table; | 185 | struct fib_table *table; |
| 183 | 186 | ||
| 184 | table = fib_get_table(net, RT_TABLE_LOCAL); | 187 | table = fib_get_table(net, RT_TABLE_LOCAL); |
| 185 | if (!table->tb_lookup(table, flp, res)) | 188 | if (!fib_table_lookup(table, flp, res)) |
| 186 | return 0; | 189 | return 0; |
| 187 | 190 | ||
| 188 | table = fib_get_table(net, RT_TABLE_MAIN); | 191 | table = fib_get_table(net, RT_TABLE_MAIN); |
| 189 | if (!table->tb_lookup(table, flp, res)) | 192 | if (!fib_table_lookup(table, flp, res)) |
| 190 | return 0; | 193 | return 0; |
| 191 | return -ENETUNREACH; | 194 | return -ENETUNREACH; |
| 192 | } | 195 | } |
diff --git a/include/net/ip_vs.h b/include/net/ip_vs.h index 98978e73f666..fe82b1e10a29 100644 --- a/include/net/ip_vs.h +++ b/include/net/ip_vs.h | |||
| @@ -26,6 +26,11 @@ | |||
| 26 | #include <linux/ipv6.h> /* for struct ipv6hdr */ | 26 | #include <linux/ipv6.h> /* for struct ipv6hdr */ |
| 27 | #include <net/ipv6.h> /* for ipv6_addr_copy */ | 27 | #include <net/ipv6.h> /* for ipv6_addr_copy */ |
| 28 | 28 | ||
| 29 | |||
| 30 | /* Connections' size value needed by ip_vs_ctl.c */ | ||
| 31 | extern int ip_vs_conn_tab_size; | ||
| 32 | |||
| 33 | |||
| 29 | struct ip_vs_iphdr { | 34 | struct ip_vs_iphdr { |
| 30 | int len; | 35 | int len; |
| 31 | __u8 protocol; | 36 | __u8 protocol; |
| @@ -220,6 +225,26 @@ enum { | |||
| 220 | }; | 225 | }; |
| 221 | 226 | ||
| 222 | /* | 227 | /* |
| 228 | * SCTP State Values | ||
| 229 | */ | ||
| 230 | enum ip_vs_sctp_states { | ||
| 231 | IP_VS_SCTP_S_NONE, | ||
| 232 | IP_VS_SCTP_S_INIT_CLI, | ||
| 233 | IP_VS_SCTP_S_INIT_SER, | ||
| 234 | IP_VS_SCTP_S_INIT_ACK_CLI, | ||
| 235 | IP_VS_SCTP_S_INIT_ACK_SER, | ||
| 236 | IP_VS_SCTP_S_ECHO_CLI, | ||
| 237 | IP_VS_SCTP_S_ECHO_SER, | ||
| 238 | IP_VS_SCTP_S_ESTABLISHED, | ||
| 239 | IP_VS_SCTP_S_SHUT_CLI, | ||
| 240 | IP_VS_SCTP_S_SHUT_SER, | ||
| 241 | IP_VS_SCTP_S_SHUT_ACK_CLI, | ||
| 242 | IP_VS_SCTP_S_SHUT_ACK_SER, | ||
| 243 | IP_VS_SCTP_S_CLOSED, | ||
| 244 | IP_VS_SCTP_S_LAST | ||
| 245 | }; | ||
| 246 | |||
| 247 | /* | ||
| 223 | * Delta sequence info structure | 248 | * Delta sequence info structure |
| 224 | * Each ip_vs_conn has 2 (output AND input seq. changes). | 249 | * Each ip_vs_conn has 2 (output AND input seq. changes). |
| 225 | * Only used in the VS/NAT. | 250 | * Only used in the VS/NAT. |
| @@ -251,8 +276,7 @@ struct ip_vs_estimator { | |||
| 251 | u32 outbps; | 276 | u32 outbps; |
| 252 | }; | 277 | }; |
| 253 | 278 | ||
| 254 | struct ip_vs_stats | 279 | struct ip_vs_stats { |
| 255 | { | ||
| 256 | struct ip_vs_stats_user ustats; /* statistics */ | 280 | struct ip_vs_stats_user ustats; /* statistics */ |
| 257 | struct ip_vs_estimator est; /* estimator */ | 281 | struct ip_vs_estimator est; /* estimator */ |
| 258 | 282 | ||
| @@ -518,8 +542,7 @@ struct ip_vs_scheduler { | |||
| 518 | /* | 542 | /* |
| 519 | * The application module object (a.k.a. app incarnation) | 543 | * The application module object (a.k.a. app incarnation) |
| 520 | */ | 544 | */ |
| 521 | struct ip_vs_app | 545 | struct ip_vs_app { |
| 522 | { | ||
| 523 | struct list_head a_list; /* member in app list */ | 546 | struct list_head a_list; /* member in app list */ |
| 524 | int type; /* IP_VS_APP_TYPE_xxx */ | 547 | int type; /* IP_VS_APP_TYPE_xxx */ |
| 525 | char *name; /* application module name */ | 548 | char *name; /* application module name */ |
| @@ -594,17 +617,6 @@ extern void ip_vs_init_hash_table(struct list_head *table, int rows); | |||
| 594 | * (from ip_vs_conn.c) | 617 | * (from ip_vs_conn.c) |
| 595 | */ | 618 | */ |
| 596 | 619 | ||
| 597 | /* | ||
| 598 | * IPVS connection entry hash table | ||
| 599 | */ | ||
| 600 | #ifndef CONFIG_IP_VS_TAB_BITS | ||
| 601 | #define CONFIG_IP_VS_TAB_BITS 12 | ||
| 602 | #endif | ||
| 603 | |||
| 604 | #define IP_VS_CONN_TAB_BITS CONFIG_IP_VS_TAB_BITS | ||
| 605 | #define IP_VS_CONN_TAB_SIZE (1 << IP_VS_CONN_TAB_BITS) | ||
| 606 | #define IP_VS_CONN_TAB_MASK (IP_VS_CONN_TAB_SIZE - 1) | ||
| 607 | |||
| 608 | enum { | 620 | enum { |
| 609 | IP_VS_DIR_INPUT = 0, | 621 | IP_VS_DIR_INPUT = 0, |
| 610 | IP_VS_DIR_OUTPUT, | 622 | IP_VS_DIR_OUTPUT, |
| @@ -749,7 +761,7 @@ extern struct ip_vs_protocol ip_vs_protocol_udp; | |||
| 749 | extern struct ip_vs_protocol ip_vs_protocol_icmp; | 761 | extern struct ip_vs_protocol ip_vs_protocol_icmp; |
| 750 | extern struct ip_vs_protocol ip_vs_protocol_esp; | 762 | extern struct ip_vs_protocol ip_vs_protocol_esp; |
| 751 | extern struct ip_vs_protocol ip_vs_protocol_ah; | 763 | extern struct ip_vs_protocol ip_vs_protocol_ah; |
| 752 | 764 | extern struct ip_vs_protocol ip_vs_protocol_sctp; | |
| 753 | 765 | ||
| 754 | /* | 766 | /* |
| 755 | * Registering/unregistering scheduler functions | 767 | * Registering/unregistering scheduler functions |
diff --git a/include/net/ipcomp.h b/include/net/ipcomp.h index 2a1092abaa07..cc4f30cd7315 100644 --- a/include/net/ipcomp.h +++ b/include/net/ipcomp.h | |||
| @@ -9,7 +9,7 @@ struct crypto_comp; | |||
| 9 | 9 | ||
| 10 | struct ipcomp_data { | 10 | struct ipcomp_data { |
| 11 | u16 threshold; | 11 | u16 threshold; |
| 12 | struct crypto_comp **tfms; | 12 | struct crypto_comp * __percpu *tfms; |
| 13 | }; | 13 | }; |
| 14 | 14 | ||
| 15 | struct ip_comp_hdr; | 15 | struct ip_comp_hdr; |
diff --git a/include/net/ipip.h b/include/net/ipip.h index 87acf8f3a155..11e8513d2d07 100644 --- a/include/net/ipip.h +++ b/include/net/ipip.h | |||
| @@ -7,8 +7,15 @@ | |||
| 7 | /* Keep error state on tunnel for 30 sec */ | 7 | /* Keep error state on tunnel for 30 sec */ |
| 8 | #define IPTUNNEL_ERR_TIMEO (30*HZ) | 8 | #define IPTUNNEL_ERR_TIMEO (30*HZ) |
| 9 | 9 | ||
| 10 | struct ip_tunnel | 10 | /* 6rd prefix/relay information */ |
| 11 | { | 11 | struct ip_tunnel_6rd_parm { |
| 12 | struct in6_addr prefix; | ||
| 13 | __be32 relay_prefix; | ||
| 14 | u16 prefixlen; | ||
| 15 | u16 relay_prefixlen; | ||
| 16 | }; | ||
| 17 | |||
| 18 | struct ip_tunnel { | ||
| 12 | struct ip_tunnel *next; | 19 | struct ip_tunnel *next; |
| 13 | struct net_device *dev; | 20 | struct net_device *dev; |
| 14 | 21 | ||
| @@ -23,15 +30,19 @@ struct ip_tunnel | |||
| 23 | 30 | ||
| 24 | struct ip_tunnel_parm parms; | 31 | struct ip_tunnel_parm parms; |
| 25 | 32 | ||
| 33 | /* for SIT */ | ||
| 34 | #ifdef CONFIG_IPV6_SIT_6RD | ||
| 35 | struct ip_tunnel_6rd_parm ip6rd; | ||
| 36 | #endif | ||
| 26 | struct ip_tunnel_prl_entry *prl; /* potential router list */ | 37 | struct ip_tunnel_prl_entry *prl; /* potential router list */ |
| 27 | unsigned int prl_count; /* # of entries in PRL */ | 38 | unsigned int prl_count; /* # of entries in PRL */ |
| 28 | }; | 39 | }; |
| 29 | 40 | ||
| 30 | struct ip_tunnel_prl_entry | 41 | struct ip_tunnel_prl_entry { |
| 31 | { | ||
| 32 | struct ip_tunnel_prl_entry *next; | 42 | struct ip_tunnel_prl_entry *next; |
| 33 | __be32 addr; | 43 | __be32 addr; |
| 34 | u16 flags; | 44 | u16 flags; |
| 45 | struct rcu_head rcu_head; | ||
| 35 | }; | 46 | }; |
| 36 | 47 | ||
| 37 | #define IPTUNNEL_XMIT() do { \ | 48 | #define IPTUNNEL_XMIT() do { \ |
| @@ -42,9 +53,9 @@ struct ip_tunnel_prl_entry | |||
| 42 | ip_select_ident(iph, &rt->u.dst, NULL); \ | 53 | ip_select_ident(iph, &rt->u.dst, NULL); \ |
| 43 | \ | 54 | \ |
| 44 | err = ip_local_out(skb); \ | 55 | err = ip_local_out(skb); \ |
| 45 | if (net_xmit_eval(err) == 0) { \ | 56 | if (likely(net_xmit_eval(err) == 0)) { \ |
| 46 | stats->tx_bytes += pkt_len; \ | 57 | txq->tx_bytes += pkt_len; \ |
| 47 | stats->tx_packets++; \ | 58 | txq->tx_packets++; \ |
| 48 | } else { \ | 59 | } else { \ |
| 49 | stats->tx_errors++; \ | 60 | stats->tx_errors++; \ |
| 50 | stats->tx_aborted_errors++; \ | 61 | stats->tx_aborted_errors++; \ |
diff --git a/include/net/ipv6.h b/include/net/ipv6.h index 8c31d8a0c1fe..e72fb10ce573 100644 --- a/include/net/ipv6.h +++ b/include/net/ipv6.h | |||
| @@ -73,7 +73,6 @@ | |||
| 73 | #define IPV6_ADDR_SCOPE_MASK 0x00f0U | 73 | #define IPV6_ADDR_SCOPE_MASK 0x00f0U |
| 74 | 74 | ||
| 75 | #define IPV6_ADDR_MAPPED 0x1000U | 75 | #define IPV6_ADDR_MAPPED 0x1000U |
| 76 | #define IPV6_ADDR_RESERVED 0x2000U /* reserved address space */ | ||
| 77 | 76 | ||
| 78 | /* | 77 | /* |
| 79 | * Addr scopes | 78 | * Addr scopes |
| @@ -160,8 +159,7 @@ extern struct ctl_path net_ipv6_ctl_path[]; | |||
| 160 | #define ICMP6MSGIN_INC_STATS_BH(net, idev, field) \ | 159 | #define ICMP6MSGIN_INC_STATS_BH(net, idev, field) \ |
| 161 | _DEVINC(net, icmpv6msg, _BH, idev, field) | 160 | _DEVINC(net, icmpv6msg, _BH, idev, field) |
| 162 | 161 | ||
| 163 | struct ip6_ra_chain | 162 | struct ip6_ra_chain { |
| 164 | { | ||
| 165 | struct ip6_ra_chain *next; | 163 | struct ip6_ra_chain *next; |
| 166 | struct sock *sk; | 164 | struct sock *sk; |
| 167 | int sel; | 165 | int sel; |
| @@ -176,8 +174,7 @@ extern rwlock_t ip6_ra_lock; | |||
| 176 | ancillary data and passed to IPv6. | 174 | ancillary data and passed to IPv6. |
| 177 | */ | 175 | */ |
| 178 | 176 | ||
| 179 | struct ipv6_txoptions | 177 | struct ipv6_txoptions { |
| 180 | { | ||
| 181 | /* Length of this structure */ | 178 | /* Length of this structure */ |
| 182 | int tot_len; | 179 | int tot_len; |
| 183 | 180 | ||
| @@ -194,8 +191,7 @@ struct ipv6_txoptions | |||
| 194 | /* Option buffer, as read by IPV6_PKTOPTIONS, starts here. */ | 191 | /* Option buffer, as read by IPV6_PKTOPTIONS, starts here. */ |
| 195 | }; | 192 | }; |
| 196 | 193 | ||
| 197 | struct ip6_flowlabel | 194 | struct ip6_flowlabel { |
| 198 | { | ||
| 199 | struct ip6_flowlabel *next; | 195 | struct ip6_flowlabel *next; |
| 200 | __be32 label; | 196 | __be32 label; |
| 201 | atomic_t users; | 197 | atomic_t users; |
| @@ -212,8 +208,7 @@ struct ip6_flowlabel | |||
| 212 | #define IPV6_FLOWINFO_MASK cpu_to_be32(0x0FFFFFFF) | 208 | #define IPV6_FLOWINFO_MASK cpu_to_be32(0x0FFFFFFF) |
| 213 | #define IPV6_FLOWLABEL_MASK cpu_to_be32(0x000FFFFF) | 209 | #define IPV6_FLOWLABEL_MASK cpu_to_be32(0x000FFFFF) |
| 214 | 210 | ||
| 215 | struct ipv6_fl_socklist | 211 | struct ipv6_fl_socklist { |
| 216 | { | ||
| 217 | struct ipv6_fl_socklist *next; | 212 | struct ipv6_fl_socklist *next; |
| 218 | struct ip6_flowlabel *fl; | 213 | struct ip6_flowlabel *fl; |
| 219 | }; | 214 | }; |
| @@ -250,7 +245,9 @@ extern int ipv6_opt_accepted(struct sock *sk, struct sk_buff *skb); | |||
| 250 | int ip6_frag_nqueues(struct net *net); | 245 | int ip6_frag_nqueues(struct net *net); |
| 251 | int ip6_frag_mem(struct net *net); | 246 | int ip6_frag_mem(struct net *net); |
| 252 | 247 | ||
| 253 | #define IPV6_FRAG_TIMEOUT (60*HZ) /* 60 seconds */ | 248 | #define IPV6_FRAG_HIGH_THRESH (256 * 1024) /* 262144 */ |
| 249 | #define IPV6_FRAG_LOW_THRESH (192 * 1024) /* 196608 */ | ||
| 250 | #define IPV6_FRAG_TIMEOUT (60 * HZ) /* 60 seconds */ | ||
| 254 | 251 | ||
| 255 | extern int __ipv6_addr_type(const struct in6_addr *addr); | 252 | extern int __ipv6_addr_type(const struct in6_addr *addr); |
| 256 | static inline int ipv6_addr_type(const struct in6_addr *addr) | 253 | static inline int ipv6_addr_type(const struct in6_addr *addr) |
| @@ -354,8 +351,19 @@ static inline int ipv6_prefix_equal(const struct in6_addr *a1, | |||
| 354 | 351 | ||
| 355 | struct inet_frag_queue; | 352 | struct inet_frag_queue; |
| 356 | 353 | ||
| 354 | enum ip6_defrag_users { | ||
| 355 | IP6_DEFRAG_LOCAL_DELIVER, | ||
| 356 | IP6_DEFRAG_CONNTRACK_IN, | ||
| 357 | __IP6_DEFRAG_CONNTRACK_IN = IP6_DEFRAG_CONNTRACK_IN + USHORT_MAX, | ||
| 358 | IP6_DEFRAG_CONNTRACK_OUT, | ||
| 359 | __IP6_DEFRAG_CONNTRACK_OUT = IP6_DEFRAG_CONNTRACK_OUT + USHORT_MAX, | ||
| 360 | IP6_DEFRAG_CONNTRACK_BRIDGE_IN, | ||
| 361 | __IP6_DEFRAG_CONNTRACK_BRIDGE_IN = IP6_DEFRAG_CONNTRACK_BRIDGE_IN + USHORT_MAX, | ||
| 362 | }; | ||
| 363 | |||
| 357 | struct ip6_create_arg { | 364 | struct ip6_create_arg { |
| 358 | __be32 id; | 365 | __be32 id; |
| 366 | u32 user; | ||
| 359 | struct in6_addr *src; | 367 | struct in6_addr *src; |
| 360 | struct in6_addr *dst; | 368 | struct in6_addr *dst; |
| 361 | }; | 369 | }; |
diff --git a/include/net/ipx.h b/include/net/ipx.h index a14121dd1932..ef51a668ba19 100644 --- a/include/net/ipx.h +++ b/include/net/ipx.h | |||
| @@ -13,6 +13,7 @@ | |||
| 13 | #include <net/datalink.h> | 13 | #include <net/datalink.h> |
| 14 | #include <linux/ipx.h> | 14 | #include <linux/ipx.h> |
| 15 | #include <linux/list.h> | 15 | #include <linux/list.h> |
| 16 | #include <linux/slab.h> | ||
| 16 | 17 | ||
| 17 | struct ipx_address { | 18 | struct ipx_address { |
| 18 | __be32 net; | 19 | __be32 net; |
diff --git a/include/net/irda/irttp.h b/include/net/irda/irttp.h index 0788c23d2828..11aee7a2972a 100644 --- a/include/net/irda/irttp.h +++ b/include/net/irda/irttp.h | |||
| @@ -97,7 +97,7 @@ | |||
| 97 | #define TTP_MAX_SDU_SIZE 0x01 | 97 | #define TTP_MAX_SDU_SIZE 0x01 |
| 98 | 98 | ||
| 99 | /* | 99 | /* |
| 100 | * This structure contains all data assosiated with one instance of a TTP | 100 | * This structure contains all data associated with one instance of a TTP |
| 101 | * connection. | 101 | * connection. |
| 102 | */ | 102 | */ |
| 103 | struct tsap_cb { | 103 | struct tsap_cb { |
diff --git a/include/net/iucv/iucv.h b/include/net/iucv/iucv.h index 5e310c8d8e2f..205a3360156e 100644 --- a/include/net/iucv/iucv.h +++ b/include/net/iucv/iucv.h | |||
| @@ -28,6 +28,7 @@ | |||
| 28 | */ | 28 | */ |
| 29 | 29 | ||
| 30 | #include <linux/types.h> | 30 | #include <linux/types.h> |
| 31 | #include <linux/slab.h> | ||
| 31 | #include <asm/debug.h> | 32 | #include <asm/debug.h> |
| 32 | 33 | ||
| 33 | /* | 34 | /* |
diff --git a/include/net/iw_handler.h b/include/net/iw_handler.h index e9054a283fde..b2b98f3fa265 100644 --- a/include/net/iw_handler.h +++ b/include/net/iw_handler.h | |||
| @@ -300,8 +300,7 @@ | |||
| 300 | * This struct is also my long term insurance. I can add new fields here | 300 | * This struct is also my long term insurance. I can add new fields here |
| 301 | * without breaking the prototype of iw_handler... | 301 | * without breaking the prototype of iw_handler... |
| 302 | */ | 302 | */ |
| 303 | struct iw_request_info | 303 | struct iw_request_info { |
| 304 | { | ||
| 305 | __u16 cmd; /* Wireless Extension command */ | 304 | __u16 cmd; /* Wireless Extension command */ |
| 306 | __u16 flags; /* More to come ;-) */ | 305 | __u16 flags; /* More to come ;-) */ |
| 307 | }; | 306 | }; |
| @@ -321,20 +320,20 @@ typedef int (*iw_handler)(struct net_device *dev, struct iw_request_info *info, | |||
| 321 | * shared by all driver instances... Same for the members... | 320 | * shared by all driver instances... Same for the members... |
| 322 | * This will be linked from net_device in <linux/netdevice.h> | 321 | * This will be linked from net_device in <linux/netdevice.h> |
| 323 | */ | 322 | */ |
| 324 | struct iw_handler_def | 323 | struct iw_handler_def { |
| 325 | { | ||
| 326 | /* Number of handlers defined (more precisely, index of the | ||
| 327 | * last defined handler + 1) */ | ||
| 328 | __u16 num_standard; | ||
| 329 | __u16 num_private; | ||
| 330 | /* Number of private arg description */ | ||
| 331 | __u16 num_private_args; | ||
| 332 | 324 | ||
| 333 | /* Array of handlers for standard ioctls | 325 | /* Array of handlers for standard ioctls |
| 334 | * We will call dev->wireless_handlers->standard[ioctl - SIOCSIWCOMMIT] | 326 | * We will call dev->wireless_handlers->standard[ioctl - SIOCSIWCOMMIT] |
| 335 | */ | 327 | */ |
| 336 | const iw_handler * standard; | 328 | const iw_handler * standard; |
| 329 | /* Number of handlers defined (more precisely, index of the | ||
| 330 | * last defined handler + 1) */ | ||
| 331 | __u16 num_standard; | ||
| 337 | 332 | ||
| 333 | #ifdef CONFIG_WEXT_PRIV | ||
| 334 | __u16 num_private; | ||
| 335 | /* Number of private arg description */ | ||
| 336 | __u16 num_private_args; | ||
| 338 | /* Array of handlers for private ioctls | 337 | /* Array of handlers for private ioctls |
| 339 | * Will call dev->wireless_handlers->private[ioctl - SIOCIWFIRSTPRIV] | 338 | * Will call dev->wireless_handlers->private[ioctl - SIOCIWFIRSTPRIV] |
| 340 | */ | 339 | */ |
| @@ -344,6 +343,7 @@ struct iw_handler_def | |||
| 344 | * can put it in any order you want and should not leave holes... | 343 | * can put it in any order you want and should not leave holes... |
| 345 | * We will automatically export that to user space... */ | 344 | * We will automatically export that to user space... */ |
| 346 | const struct iw_priv_args * private_args; | 345 | const struct iw_priv_args * private_args; |
| 346 | #endif | ||
| 347 | 347 | ||
| 348 | /* New location of get_wireless_stats, to de-bloat struct net_device. | 348 | /* New location of get_wireless_stats, to de-bloat struct net_device. |
| 349 | * The old pointer in struct net_device will be gradually phased | 349 | * The old pointer in struct net_device will be gradually phased |
| @@ -370,8 +370,7 @@ struct iw_handler_def | |||
| 370 | /* | 370 | /* |
| 371 | * Describe how a standard IOCTL looks like. | 371 | * Describe how a standard IOCTL looks like. |
| 372 | */ | 372 | */ |
| 373 | struct iw_ioctl_description | 373 | struct iw_ioctl_description { |
| 374 | { | ||
| 375 | __u8 header_type; /* NULL, iw_point or other */ | 374 | __u8 header_type; /* NULL, iw_point or other */ |
| 376 | __u8 token_type; /* Future */ | 375 | __u8 token_type; /* Future */ |
| 377 | __u16 token_size; /* Granularity of payload */ | 376 | __u16 token_size; /* Granularity of payload */ |
| @@ -393,8 +392,7 @@ struct iw_ioctl_description | |||
| 393 | /* | 392 | /* |
| 394 | * Instance specific spy data, i.e. addresses spied and quality for them. | 393 | * Instance specific spy data, i.e. addresses spied and quality for them. |
| 395 | */ | 394 | */ |
| 396 | struct iw_spy_data | 395 | struct iw_spy_data { |
| 397 | { | ||
| 398 | /* --- Standard spy support --- */ | 396 | /* --- Standard spy support --- */ |
| 399 | int spy_number; | 397 | int spy_number; |
| 400 | u_char spy_address[IW_MAX_SPY][ETH_ALEN]; | 398 | u_char spy_address[IW_MAX_SPY][ETH_ALEN]; |
diff --git a/include/net/llc.h b/include/net/llc.h index 7940da1606e7..5503b74ab170 100644 --- a/include/net/llc.h +++ b/include/net/llc.h | |||
| @@ -16,6 +16,9 @@ | |||
| 16 | #include <linux/if_ether.h> | 16 | #include <linux/if_ether.h> |
| 17 | #include <linux/list.h> | 17 | #include <linux/list.h> |
| 18 | #include <linux/spinlock.h> | 18 | #include <linux/spinlock.h> |
| 19 | #include <linux/rculist_nulls.h> | ||
| 20 | #include <linux/hash.h> | ||
| 21 | #include <linux/jhash.h> | ||
| 19 | 22 | ||
| 20 | #include <asm/atomic.h> | 23 | #include <asm/atomic.h> |
| 21 | 24 | ||
| @@ -31,6 +34,12 @@ struct llc_addr { | |||
| 31 | #define LLC_SAP_STATE_INACTIVE 1 | 34 | #define LLC_SAP_STATE_INACTIVE 1 |
| 32 | #define LLC_SAP_STATE_ACTIVE 2 | 35 | #define LLC_SAP_STATE_ACTIVE 2 |
| 33 | 36 | ||
| 37 | #define LLC_SK_DEV_HASH_BITS 6 | ||
| 38 | #define LLC_SK_DEV_HASH_ENTRIES (1<<LLC_SK_DEV_HASH_BITS) | ||
| 39 | |||
| 40 | #define LLC_SK_LADDR_HASH_BITS 6 | ||
| 41 | #define LLC_SK_LADDR_HASH_ENTRIES (1<<LLC_SK_LADDR_HASH_BITS) | ||
| 42 | |||
| 34 | /** | 43 | /** |
| 35 | * struct llc_sap - Defines the SAP component | 44 | * struct llc_sap - Defines the SAP component |
| 36 | * | 45 | * |
| @@ -53,18 +62,38 @@ struct llc_sap { | |||
| 53 | struct net_device *orig_dev); | 62 | struct net_device *orig_dev); |
| 54 | struct llc_addr laddr; | 63 | struct llc_addr laddr; |
| 55 | struct list_head node; | 64 | struct list_head node; |
| 56 | struct { | 65 | spinlock_t sk_lock; |
| 57 | rwlock_t lock; | 66 | int sk_count; |
| 58 | struct hlist_head list; | 67 | struct hlist_nulls_head sk_laddr_hash[LLC_SK_LADDR_HASH_ENTRIES]; |
| 59 | } sk_list; | 68 | struct hlist_head sk_dev_hash[LLC_SK_DEV_HASH_ENTRIES]; |
| 60 | }; | 69 | }; |
| 61 | 70 | ||
| 71 | static inline | ||
| 72 | struct hlist_head *llc_sk_dev_hash(struct llc_sap *sap, int ifindex) | ||
| 73 | { | ||
| 74 | return &sap->sk_dev_hash[ifindex % LLC_SK_DEV_HASH_ENTRIES]; | ||
| 75 | } | ||
| 76 | |||
| 77 | static inline | ||
| 78 | u32 llc_sk_laddr_hashfn(struct llc_sap *sap, const struct llc_addr *laddr) | ||
| 79 | { | ||
| 80 | return hash_32(jhash(laddr->mac, sizeof(laddr->mac), 0), | ||
| 81 | LLC_SK_LADDR_HASH_BITS); | ||
| 82 | } | ||
| 83 | |||
| 84 | static inline | ||
| 85 | struct hlist_nulls_head *llc_sk_laddr_hash(struct llc_sap *sap, | ||
| 86 | const struct llc_addr *laddr) | ||
| 87 | { | ||
| 88 | return &sap->sk_laddr_hash[llc_sk_laddr_hashfn(sap, laddr)]; | ||
| 89 | } | ||
| 90 | |||
| 62 | #define LLC_DEST_INVALID 0 /* Invalid LLC PDU type */ | 91 | #define LLC_DEST_INVALID 0 /* Invalid LLC PDU type */ |
| 63 | #define LLC_DEST_SAP 1 /* Type 1 goes here */ | 92 | #define LLC_DEST_SAP 1 /* Type 1 goes here */ |
| 64 | #define LLC_DEST_CONN 2 /* Type 2 goes here */ | 93 | #define LLC_DEST_CONN 2 /* Type 2 goes here */ |
| 65 | 94 | ||
| 66 | extern struct list_head llc_sap_list; | 95 | extern struct list_head llc_sap_list; |
| 67 | extern rwlock_t llc_sap_list_lock; | 96 | extern spinlock_t llc_sap_list_lock; |
| 68 | 97 | ||
| 69 | extern int llc_rcv(struct sk_buff *skb, struct net_device *dev, | 98 | extern int llc_rcv(struct sk_buff *skb, struct net_device *dev, |
| 70 | struct packet_type *pt, struct net_device *orig_dev); | 99 | struct packet_type *pt, struct net_device *orig_dev); |
diff --git a/include/net/llc_conn.h b/include/net/llc_conn.h index e2374e34989f..2f97d8ddce92 100644 --- a/include/net/llc_conn.h +++ b/include/net/llc_conn.h | |||
| @@ -76,6 +76,8 @@ struct llc_sock { | |||
| 76 | u32 rx_pdu_hdr; /* used for saving header of last pdu | 76 | u32 rx_pdu_hdr; /* used for saving header of last pdu |
| 77 | received and caused sending FRMR. | 77 | received and caused sending FRMR. |
| 78 | Used for resending FRMR */ | 78 | Used for resending FRMR */ |
| 79 | u32 cmsg_flags; | ||
| 80 | struct hlist_node dev_hash_node; | ||
| 79 | }; | 81 | }; |
| 80 | 82 | ||
| 81 | static inline struct llc_sock *llc_sk(const struct sock *sk) | 83 | static inline struct llc_sock *llc_sk(const struct sock *sk) |
diff --git a/include/net/mac80211.h b/include/net/mac80211.h index 998c30fc8981..45d7d44d7cbe 100644 --- a/include/net/mac80211.h +++ b/include/net/mac80211.h | |||
| @@ -3,7 +3,7 @@ | |||
| 3 | * | 3 | * |
| 4 | * Copyright 2002-2005, Devicescape Software, Inc. | 4 | * Copyright 2002-2005, Devicescape Software, Inc. |
| 5 | * Copyright 2006-2007 Jiri Benc <jbenc@suse.cz> | 5 | * Copyright 2006-2007 Jiri Benc <jbenc@suse.cz> |
| 6 | * Copyright 2007-2008 Johannes Berg <johannes@sipsolutions.net> | 6 | * Copyright 2007-2010 Johannes Berg <johannes@sipsolutions.net> |
| 7 | * | 7 | * |
| 8 | * 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 |
| 9 | * 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 |
| @@ -107,25 +107,14 @@ enum ieee80211_max_queues { | |||
| 107 | * 2^n-1 in the range 1..32767] | 107 | * 2^n-1 in the range 1..32767] |
| 108 | * @cw_max: maximum contention window [like @cw_min] | 108 | * @cw_max: maximum contention window [like @cw_min] |
| 109 | * @txop: maximum burst time in units of 32 usecs, 0 meaning disabled | 109 | * @txop: maximum burst time in units of 32 usecs, 0 meaning disabled |
| 110 | * @uapsd: is U-APSD mode enabled for the queue | ||
| 110 | */ | 111 | */ |
| 111 | struct ieee80211_tx_queue_params { | 112 | struct ieee80211_tx_queue_params { |
| 112 | u16 txop; | 113 | u16 txop; |
| 113 | u16 cw_min; | 114 | u16 cw_min; |
| 114 | u16 cw_max; | 115 | u16 cw_max; |
| 115 | u8 aifs; | 116 | u8 aifs; |
| 116 | }; | 117 | bool uapsd; |
| 117 | |||
| 118 | /** | ||
| 119 | * struct ieee80211_tx_queue_stats - transmit queue statistics | ||
| 120 | * | ||
| 121 | * @len: number of packets in queue | ||
| 122 | * @limit: queue length limit | ||
| 123 | * @count: number of frames sent | ||
| 124 | */ | ||
| 125 | struct ieee80211_tx_queue_stats { | ||
| 126 | unsigned int len; | ||
| 127 | unsigned int limit; | ||
| 128 | unsigned int count; | ||
| 129 | }; | 118 | }; |
| 130 | 119 | ||
| 131 | struct ieee80211_low_level_stats { | 120 | struct ieee80211_low_level_stats { |
| @@ -184,7 +173,8 @@ enum ieee80211_bss_change { | |||
| 184 | * @use_short_slot: use short slot time (only relevant for ERP); | 173 | * @use_short_slot: use short slot time (only relevant for ERP); |
| 185 | * if the hardware cannot handle this it must set the | 174 | * if the hardware cannot handle this it must set the |
| 186 | * IEEE80211_HW_2GHZ_SHORT_SLOT_INCAPABLE hardware flag | 175 | * IEEE80211_HW_2GHZ_SHORT_SLOT_INCAPABLE hardware flag |
| 187 | * @dtim_period: num of beacons before the next DTIM, for PSM | 176 | * @dtim_period: num of beacons before the next DTIM, for beaconing, |
| 177 | * not valid in station mode (cf. hw conf ps_dtim_period) | ||
| 188 | * @timestamp: beacon timestamp | 178 | * @timestamp: beacon timestamp |
| 189 | * @beacon_int: beacon interval | 179 | * @beacon_int: beacon interval |
| 190 | * @assoc_capability: capabilities taken from assoc resp | 180 | * @assoc_capability: capabilities taken from assoc resp |
| @@ -219,7 +209,7 @@ struct ieee80211_bss_conf { | |||
| 219 | * | 209 | * |
| 220 | * These flags are used with the @flags member of &ieee80211_tx_info. | 210 | * These flags are used with the @flags member of &ieee80211_tx_info. |
| 221 | * | 211 | * |
| 222 | * @IEEE80211_TX_CTL_REQ_TX_STATUS: request TX status callback for this frame. | 212 | * @IEEE80211_TX_CTL_REQ_TX_STATUS: require TX status callback for this frame. |
| 223 | * @IEEE80211_TX_CTL_ASSIGN_SEQ: The driver has to assign a sequence | 213 | * @IEEE80211_TX_CTL_ASSIGN_SEQ: The driver has to assign a sequence |
| 224 | * number to this frame, taking care of not overwriting the fragment | 214 | * number to this frame, taking care of not overwriting the fragment |
| 225 | * number and increasing the sequence number only when the | 215 | * number and increasing the sequence number only when the |
| @@ -255,9 +245,6 @@ struct ieee80211_bss_conf { | |||
| 255 | * @IEEE80211_TX_CTL_RATE_CTRL_PROBE: internal to mac80211, can be | 245 | * @IEEE80211_TX_CTL_RATE_CTRL_PROBE: internal to mac80211, can be |
| 256 | * set by rate control algorithms to indicate probe rate, will | 246 | * set by rate control algorithms to indicate probe rate, will |
| 257 | * be cleared for fragmented frames (except on the last fragment) | 247 | * be cleared for fragmented frames (except on the last fragment) |
| 258 | * @IEEE80211_TX_INTFL_RCALGO: mac80211 internal flag, do not test or | ||
| 259 | * set this flag in the driver; indicates that the rate control | ||
| 260 | * algorithm was used and should be notified of TX status | ||
| 261 | * @IEEE80211_TX_INTFL_NEED_TXPROCESSING: completely internal to mac80211, | 248 | * @IEEE80211_TX_INTFL_NEED_TXPROCESSING: completely internal to mac80211, |
| 262 | * used to indicate that a pending frame requires TX processing before | 249 | * used to indicate that a pending frame requires TX processing before |
| 263 | * it can be sent out. | 250 | * it can be sent out. |
| @@ -272,6 +259,14 @@ struct ieee80211_bss_conf { | |||
| 272 | * transmit function after the current frame, this can be used | 259 | * transmit function after the current frame, this can be used |
| 273 | * by drivers to kick the DMA queue only if unset or when the | 260 | * by drivers to kick the DMA queue only if unset or when the |
| 274 | * queue gets full. | 261 | * queue gets full. |
| 262 | * @IEEE80211_TX_INTFL_RETRANSMISSION: This frame is being retransmitted | ||
| 263 | * after TX status because the destination was asleep, it must not | ||
| 264 | * be modified again (no seqno assignment, crypto, etc.) | ||
| 265 | * @IEEE80211_TX_INTFL_HAS_RADIOTAP: This frame was injected and still | ||
| 266 | * has a radiotap header at skb->data. | ||
| 267 | * @IEEE80211_TX_INTFL_NL80211_FRAME_TX: Frame was requested through nl80211 | ||
| 268 | * MLME command (internal to mac80211 to figure out whether to send TX | ||
| 269 | * status to user space) | ||
| 275 | */ | 270 | */ |
| 276 | enum mac80211_tx_control_flags { | 271 | enum mac80211_tx_control_flags { |
| 277 | IEEE80211_TX_CTL_REQ_TX_STATUS = BIT(0), | 272 | IEEE80211_TX_CTL_REQ_TX_STATUS = BIT(0), |
| @@ -287,12 +282,14 @@ enum mac80211_tx_control_flags { | |||
| 287 | IEEE80211_TX_STAT_AMPDU = BIT(10), | 282 | IEEE80211_TX_STAT_AMPDU = BIT(10), |
| 288 | IEEE80211_TX_STAT_AMPDU_NO_BACK = BIT(11), | 283 | IEEE80211_TX_STAT_AMPDU_NO_BACK = BIT(11), |
| 289 | IEEE80211_TX_CTL_RATE_CTRL_PROBE = BIT(12), | 284 | IEEE80211_TX_CTL_RATE_CTRL_PROBE = BIT(12), |
| 290 | IEEE80211_TX_INTFL_RCALGO = BIT(13), | ||
| 291 | IEEE80211_TX_INTFL_NEED_TXPROCESSING = BIT(14), | 285 | IEEE80211_TX_INTFL_NEED_TXPROCESSING = BIT(14), |
| 292 | IEEE80211_TX_INTFL_RETRIED = BIT(15), | 286 | IEEE80211_TX_INTFL_RETRIED = BIT(15), |
| 293 | IEEE80211_TX_INTFL_DONT_ENCRYPT = BIT(16), | 287 | IEEE80211_TX_INTFL_DONT_ENCRYPT = BIT(16), |
| 294 | IEEE80211_TX_CTL_PSPOLL_RESPONSE = BIT(17), | 288 | IEEE80211_TX_CTL_PSPOLL_RESPONSE = BIT(17), |
| 295 | IEEE80211_TX_CTL_MORE_FRAMES = BIT(18), | 289 | IEEE80211_TX_CTL_MORE_FRAMES = BIT(18), |
| 290 | IEEE80211_TX_INTFL_RETRANSMISSION = BIT(19), | ||
| 291 | IEEE80211_TX_INTFL_HAS_RADIOTAP = BIT(20), | ||
| 292 | IEEE80211_TX_INTFL_NL80211_FRAME_TX = BIT(21), | ||
| 296 | }; | 293 | }; |
| 297 | 294 | ||
| 298 | /** | 295 | /** |
| @@ -390,10 +387,12 @@ struct ieee80211_tx_rate { | |||
| 390 | * @control: union for control data | 387 | * @control: union for control data |
| 391 | * @status: union for status data | 388 | * @status: union for status data |
| 392 | * @driver_data: array of driver_data pointers | 389 | * @driver_data: array of driver_data pointers |
| 393 | * @ampdu_ack_len: number of aggregated frames. | 390 | * @ampdu_ack_len: number of acked aggregated frames. |
| 394 | * relevant only if IEEE80211_TX_STATUS_AMPDU was set. | 391 | * relevant only if IEEE80211_TX_STATUS_AMPDU was set. |
| 395 | * @ampdu_ack_map: block ack bit map for the aggregation. | 392 | * @ampdu_ack_map: block ack bit map for the aggregation. |
| 396 | * relevant only if IEEE80211_TX_STATUS_AMPDU was set. | 393 | * relevant only if IEEE80211_TX_STATUS_AMPDU was set. |
| 394 | * @ampdu_len: number of aggregated frames. | ||
| 395 | * relevant only if IEEE80211_TX_STATUS_AMPDU was set. | ||
| 397 | * @ack_signal: signal strength of the ACK frame | 396 | * @ack_signal: signal strength of the ACK frame |
| 398 | */ | 397 | */ |
| 399 | struct ieee80211_tx_info { | 398 | struct ieee80211_tx_info { |
| @@ -428,7 +427,8 @@ struct ieee80211_tx_info { | |||
| 428 | u8 ampdu_ack_len; | 427 | u8 ampdu_ack_len; |
| 429 | u64 ampdu_ack_map; | 428 | u64 ampdu_ack_map; |
| 430 | int ack_signal; | 429 | int ack_signal; |
| 431 | /* 8 bytes free */ | 430 | u8 ampdu_len; |
| 431 | /* 7 bytes free */ | ||
| 432 | } status; | 432 | } status; |
| 433 | struct { | 433 | struct { |
| 434 | struct ieee80211_tx_rate driver_rates[ | 434 | struct ieee80211_tx_rate driver_rates[ |
| @@ -494,7 +494,6 @@ ieee80211_tx_info_clear_status(struct ieee80211_tx_info *info) | |||
| 494 | * @RX_FLAG_MMIC_ERROR: Michael MIC error was reported on this frame. | 494 | * @RX_FLAG_MMIC_ERROR: Michael MIC error was reported on this frame. |
| 495 | * Use together with %RX_FLAG_MMIC_STRIPPED. | 495 | * Use together with %RX_FLAG_MMIC_STRIPPED. |
| 496 | * @RX_FLAG_DECRYPTED: This frame was decrypted in hardware. | 496 | * @RX_FLAG_DECRYPTED: This frame was decrypted in hardware. |
| 497 | * @RX_FLAG_RADIOTAP: This frame starts with a radiotap header. | ||
| 498 | * @RX_FLAG_MMIC_STRIPPED: the Michael MIC is stripped off this frame, | 497 | * @RX_FLAG_MMIC_STRIPPED: the Michael MIC is stripped off this frame, |
| 499 | * verification has been done by the hardware. | 498 | * verification has been done by the hardware. |
| 500 | * @RX_FLAG_IV_STRIPPED: The IV/ICV are stripped from this frame. | 499 | * @RX_FLAG_IV_STRIPPED: The IV/ICV are stripped from this frame. |
| @@ -511,11 +510,13 @@ ieee80211_tx_info_clear_status(struct ieee80211_tx_info *info) | |||
| 511 | * @RX_FLAG_HT: HT MCS was used and rate_idx is MCS index | 510 | * @RX_FLAG_HT: HT MCS was used and rate_idx is MCS index |
| 512 | * @RX_FLAG_40MHZ: HT40 (40 MHz) was used | 511 | * @RX_FLAG_40MHZ: HT40 (40 MHz) was used |
| 513 | * @RX_FLAG_SHORT_GI: Short guard interval was used | 512 | * @RX_FLAG_SHORT_GI: Short guard interval was used |
| 513 | * @RX_FLAG_INTERNAL_CMTR: set internally after frame was reported | ||
| 514 | * on cooked monitor to avoid double-reporting it for multiple | ||
| 515 | * virtual interfaces | ||
| 514 | */ | 516 | */ |
| 515 | enum mac80211_rx_flags { | 517 | enum mac80211_rx_flags { |
| 516 | RX_FLAG_MMIC_ERROR = 1<<0, | 518 | RX_FLAG_MMIC_ERROR = 1<<0, |
| 517 | RX_FLAG_DECRYPTED = 1<<1, | 519 | RX_FLAG_DECRYPTED = 1<<1, |
| 518 | RX_FLAG_RADIOTAP = 1<<2, | ||
| 519 | RX_FLAG_MMIC_STRIPPED = 1<<3, | 520 | RX_FLAG_MMIC_STRIPPED = 1<<3, |
| 520 | RX_FLAG_IV_STRIPPED = 1<<4, | 521 | RX_FLAG_IV_STRIPPED = 1<<4, |
| 521 | RX_FLAG_FAILED_FCS_CRC = 1<<5, | 522 | RX_FLAG_FAILED_FCS_CRC = 1<<5, |
| @@ -525,6 +526,7 @@ enum mac80211_rx_flags { | |||
| 525 | RX_FLAG_HT = 1<<9, | 526 | RX_FLAG_HT = 1<<9, |
| 526 | RX_FLAG_40MHZ = 1<<10, | 527 | RX_FLAG_40MHZ = 1<<10, |
| 527 | RX_FLAG_SHORT_GI = 1<<11, | 528 | RX_FLAG_SHORT_GI = 1<<11, |
| 529 | RX_FLAG_INTERNAL_CMTR = 1<<12, | ||
| 528 | }; | 530 | }; |
| 529 | 531 | ||
| 530 | /** | 532 | /** |
| @@ -542,7 +544,6 @@ enum mac80211_rx_flags { | |||
| 542 | * unspecified depending on the hardware capabilities flags | 544 | * unspecified depending on the hardware capabilities flags |
| 543 | * @IEEE80211_HW_SIGNAL_* | 545 | * @IEEE80211_HW_SIGNAL_* |
| 544 | * @noise: noise when receiving this frame, in dBm. | 546 | * @noise: noise when receiving this frame, in dBm. |
| 545 | * @qual: overall signal quality indication, in percent (0-100). | ||
| 546 | * @antenna: antenna used | 547 | * @antenna: antenna used |
| 547 | * @rate_idx: index of data rate into band's supported rates or MCS index if | 548 | * @rate_idx: index of data rate into band's supported rates or MCS index if |
| 548 | * HT rates are use (RX_FLAG_HT) | 549 | * HT rates are use (RX_FLAG_HT) |
| @@ -554,7 +555,6 @@ struct ieee80211_rx_status { | |||
| 554 | int freq; | 555 | int freq; |
| 555 | int signal; | 556 | int signal; |
| 556 | int noise; | 557 | int noise; |
| 557 | int qual; | ||
| 558 | int antenna; | 558 | int antenna; |
| 559 | int rate_idx; | 559 | int rate_idx; |
| 560 | int flag; | 560 | int flag; |
| @@ -565,8 +565,16 @@ struct ieee80211_rx_status { | |||
| 565 | * | 565 | * |
| 566 | * Flags to define PHY configuration options | 566 | * Flags to define PHY configuration options |
| 567 | * | 567 | * |
| 568 | * @IEEE80211_CONF_RADIOTAP: add radiotap header at receive time (if supported) | 568 | * @IEEE80211_CONF_MONITOR: there's a monitor interface present -- use this |
| 569 | * @IEEE80211_CONF_PS: Enable 802.11 power save mode (managed mode only) | 569 | * to determine for example whether to calculate timestamps for packets |
| 570 | * or not, do not use instead of filter flags! | ||
| 571 | * @IEEE80211_CONF_PS: Enable 802.11 power save mode (managed mode only). | ||
| 572 | * This is the power save mode defined by IEEE 802.11-2007 section 11.2, | ||
| 573 | * meaning that the hardware still wakes up for beacons, is able to | ||
| 574 | * transmit frames and receive the possible acknowledgment frames. | ||
| 575 | * Not to be confused with hardware specific wakeup/sleep states, | ||
| 576 | * driver is responsible for that. See the section "Powersave support" | ||
| 577 | * for more. | ||
| 570 | * @IEEE80211_CONF_IDLE: The device is running, but idle; if the flag is set | 578 | * @IEEE80211_CONF_IDLE: The device is running, but idle; if the flag is set |
| 571 | * the driver should be prepared to handle configuration requests but | 579 | * the driver should be prepared to handle configuration requests but |
| 572 | * may turn the device off as much as possible. Typically, this flag will | 580 | * may turn the device off as much as possible. Typically, this flag will |
| @@ -574,7 +582,7 @@ struct ieee80211_rx_status { | |||
| 574 | * it can also be unset in that case when monitor interfaces are active. | 582 | * it can also be unset in that case when monitor interfaces are active. |
| 575 | */ | 583 | */ |
| 576 | enum ieee80211_conf_flags { | 584 | enum ieee80211_conf_flags { |
| 577 | IEEE80211_CONF_RADIOTAP = (1<<0), | 585 | IEEE80211_CONF_MONITOR = (1<<0), |
| 578 | IEEE80211_CONF_PS = (1<<1), | 586 | IEEE80211_CONF_PS = (1<<1), |
| 579 | IEEE80211_CONF_IDLE = (1<<2), | 587 | IEEE80211_CONF_IDLE = (1<<2), |
| 580 | }; | 588 | }; |
| @@ -584,16 +592,18 @@ enum ieee80211_conf_flags { | |||
| 584 | * enum ieee80211_conf_changed - denotes which configuration changed | 592 | * enum ieee80211_conf_changed - denotes which configuration changed |
| 585 | * | 593 | * |
| 586 | * @IEEE80211_CONF_CHANGE_LISTEN_INTERVAL: the listen interval changed | 594 | * @IEEE80211_CONF_CHANGE_LISTEN_INTERVAL: the listen interval changed |
| 587 | * @IEEE80211_CONF_CHANGE_RADIOTAP: the radiotap flag changed | 595 | * @IEEE80211_CONF_CHANGE_MONITOR: the monitor flag changed |
| 588 | * @IEEE80211_CONF_CHANGE_PS: the PS flag or dynamic PS timeout changed | 596 | * @IEEE80211_CONF_CHANGE_PS: the PS flag or dynamic PS timeout changed |
| 589 | * @IEEE80211_CONF_CHANGE_POWER: the TX power changed | 597 | * @IEEE80211_CONF_CHANGE_POWER: the TX power changed |
| 590 | * @IEEE80211_CONF_CHANGE_CHANNEL: the channel/channel_type changed | 598 | * @IEEE80211_CONF_CHANGE_CHANNEL: the channel/channel_type changed |
| 591 | * @IEEE80211_CONF_CHANGE_RETRY_LIMITS: retry limits changed | 599 | * @IEEE80211_CONF_CHANGE_RETRY_LIMITS: retry limits changed |
| 592 | * @IEEE80211_CONF_CHANGE_IDLE: Idle flag changed | 600 | * @IEEE80211_CONF_CHANGE_IDLE: Idle flag changed |
| 601 | * @IEEE80211_CONF_CHANGE_SMPS: Spatial multiplexing powersave mode changed | ||
| 593 | */ | 602 | */ |
| 594 | enum ieee80211_conf_changed { | 603 | enum ieee80211_conf_changed { |
| 604 | IEEE80211_CONF_CHANGE_SMPS = BIT(1), | ||
| 595 | IEEE80211_CONF_CHANGE_LISTEN_INTERVAL = BIT(2), | 605 | IEEE80211_CONF_CHANGE_LISTEN_INTERVAL = BIT(2), |
| 596 | IEEE80211_CONF_CHANGE_RADIOTAP = BIT(3), | 606 | IEEE80211_CONF_CHANGE_MONITOR = BIT(3), |
| 597 | IEEE80211_CONF_CHANGE_PS = BIT(4), | 607 | IEEE80211_CONF_CHANGE_PS = BIT(4), |
| 598 | IEEE80211_CONF_CHANGE_POWER = BIT(5), | 608 | IEEE80211_CONF_CHANGE_POWER = BIT(5), |
| 599 | IEEE80211_CONF_CHANGE_CHANNEL = BIT(6), | 609 | IEEE80211_CONF_CHANGE_CHANNEL = BIT(6), |
| @@ -602,6 +612,25 @@ enum ieee80211_conf_changed { | |||
| 602 | }; | 612 | }; |
| 603 | 613 | ||
| 604 | /** | 614 | /** |
| 615 | * enum ieee80211_smps_mode - spatial multiplexing power save mode | ||
| 616 | * | ||
| 617 | * @IEEE80211_SMPS_AUTOMATIC: automatic | ||
| 618 | * @IEEE80211_SMPS_OFF: off | ||
| 619 | * @IEEE80211_SMPS_STATIC: static | ||
| 620 | * @IEEE80211_SMPS_DYNAMIC: dynamic | ||
| 621 | * @IEEE80211_SMPS_NUM_MODES: internal, don't use | ||
| 622 | */ | ||
| 623 | enum ieee80211_smps_mode { | ||
| 624 | IEEE80211_SMPS_AUTOMATIC, | ||
| 625 | IEEE80211_SMPS_OFF, | ||
| 626 | IEEE80211_SMPS_STATIC, | ||
| 627 | IEEE80211_SMPS_DYNAMIC, | ||
| 628 | |||
| 629 | /* keep last */ | ||
| 630 | IEEE80211_SMPS_NUM_MODES, | ||
| 631 | }; | ||
| 632 | |||
| 633 | /** | ||
| 605 | * struct ieee80211_conf - configuration of the device | 634 | * struct ieee80211_conf - configuration of the device |
| 606 | * | 635 | * |
| 607 | * This struct indicates how the driver shall configure the hardware. | 636 | * This struct indicates how the driver shall configure the hardware. |
| @@ -614,6 +643,9 @@ enum ieee80211_conf_changed { | |||
| 614 | * value will be only achievable between DTIM frames, the hardware | 643 | * value will be only achievable between DTIM frames, the hardware |
| 615 | * needs to check for the multicast traffic bit in DTIM beacons. | 644 | * needs to check for the multicast traffic bit in DTIM beacons. |
| 616 | * This variable is valid only when the CONF_PS flag is set. | 645 | * This variable is valid only when the CONF_PS flag is set. |
| 646 | * @ps_dtim_period: The DTIM period of the AP we're connected to, for use | ||
| 647 | * in power saving. Power saving will not be enabled until a beacon | ||
| 648 | * has been received and the DTIM period is known. | ||
| 617 | * @dynamic_ps_timeout: The dynamic powersave timeout (in ms), see the | 649 | * @dynamic_ps_timeout: The dynamic powersave timeout (in ms), see the |
| 618 | * powersave documentation below. This variable is valid only when | 650 | * powersave documentation below. This variable is valid only when |
| 619 | * the CONF_PS flag is set. | 651 | * the CONF_PS flag is set. |
| @@ -629,6 +661,10 @@ enum ieee80211_conf_changed { | |||
| 629 | * @short_frame_max_tx_count: Maximum number of transmissions for a "short" | 661 | * @short_frame_max_tx_count: Maximum number of transmissions for a "short" |
| 630 | * frame, called "dot11ShortRetryLimit" in 802.11, but actually means the | 662 | * frame, called "dot11ShortRetryLimit" in 802.11, but actually means the |
| 631 | * number of transmissions not the number of retries | 663 | * number of transmissions not the number of retries |
| 664 | * | ||
| 665 | * @smps_mode: spatial multiplexing powersave mode; note that | ||
| 666 | * %IEEE80211_SMPS_STATIC is used when the device is not | ||
| 667 | * configured for an HT channel | ||
| 632 | */ | 668 | */ |
| 633 | struct ieee80211_conf { | 669 | struct ieee80211_conf { |
| 634 | u32 flags; | 670 | u32 flags; |
| @@ -636,11 +672,13 @@ struct ieee80211_conf { | |||
| 636 | int max_sleep_period; | 672 | int max_sleep_period; |
| 637 | 673 | ||
| 638 | u16 listen_interval; | 674 | u16 listen_interval; |
| 675 | u8 ps_dtim_period; | ||
| 639 | 676 | ||
| 640 | u8 long_frame_max_tx_count, short_frame_max_tx_count; | 677 | u8 long_frame_max_tx_count, short_frame_max_tx_count; |
| 641 | 678 | ||
| 642 | struct ieee80211_channel *channel; | 679 | struct ieee80211_channel *channel; |
| 643 | enum nl80211_channel_type channel_type; | 680 | enum nl80211_channel_type channel_type; |
| 681 | enum ieee80211_smps_mode smps_mode; | ||
| 644 | }; | 682 | }; |
| 645 | 683 | ||
| 646 | /** | 684 | /** |
| @@ -652,12 +690,14 @@ struct ieee80211_conf { | |||
| 652 | * @type: type of this virtual interface | 690 | * @type: type of this virtual interface |
| 653 | * @bss_conf: BSS configuration for this interface, either our own | 691 | * @bss_conf: BSS configuration for this interface, either our own |
| 654 | * or the BSS we're associated to | 692 | * or the BSS we're associated to |
| 693 | * @addr: address of this interface | ||
| 655 | * @drv_priv: data area for driver use, will always be aligned to | 694 | * @drv_priv: data area for driver use, will always be aligned to |
| 656 | * sizeof(void *). | 695 | * sizeof(void *). |
| 657 | */ | 696 | */ |
| 658 | struct ieee80211_vif { | 697 | struct ieee80211_vif { |
| 659 | enum nl80211_iftype type; | 698 | enum nl80211_iftype type; |
| 660 | struct ieee80211_bss_conf bss_conf; | 699 | struct ieee80211_bss_conf bss_conf; |
| 700 | u8 addr[ETH_ALEN]; | ||
| 661 | /* must be last */ | 701 | /* must be last */ |
| 662 | u8 drv_priv[0] __attribute__((__aligned__(sizeof(void *)))); | 702 | u8 drv_priv[0] __attribute__((__aligned__(sizeof(void *)))); |
| 663 | }; | 703 | }; |
| @@ -671,33 +711,6 @@ static inline bool ieee80211_vif_is_mesh(struct ieee80211_vif *vif) | |||
| 671 | } | 711 | } |
| 672 | 712 | ||
| 673 | /** | 713 | /** |
| 674 | * struct ieee80211_if_init_conf - initial configuration of an interface | ||
| 675 | * | ||
| 676 | * @vif: pointer to a driver-use per-interface structure. The pointer | ||
| 677 | * itself is also used for various functions including | ||
| 678 | * ieee80211_beacon_get() and ieee80211_get_buffered_bc(). | ||
| 679 | * @type: one of &enum nl80211_iftype constants. Determines the type of | ||
| 680 | * added/removed interface. | ||
| 681 | * @mac_addr: pointer to MAC address of the interface. This pointer is valid | ||
| 682 | * until the interface is removed (i.e. it cannot be used after | ||
| 683 | * remove_interface() callback was called for this interface). | ||
| 684 | * | ||
| 685 | * This structure is used in add_interface() and remove_interface() | ||
| 686 | * callbacks of &struct ieee80211_hw. | ||
| 687 | * | ||
| 688 | * When you allow multiple interfaces to be added to your PHY, take care | ||
| 689 | * that the hardware can actually handle multiple MAC addresses. However, | ||
| 690 | * also take care that when there's no interface left with mac_addr != %NULL | ||
| 691 | * you remove the MAC address from the device to avoid acknowledging packets | ||
| 692 | * in pure monitor mode. | ||
| 693 | */ | ||
| 694 | struct ieee80211_if_init_conf { | ||
| 695 | enum nl80211_iftype type; | ||
| 696 | struct ieee80211_vif *vif; | ||
| 697 | void *mac_addr; | ||
| 698 | }; | ||
| 699 | |||
| 700 | /** | ||
| 701 | * enum ieee80211_key_alg - key algorithm | 714 | * enum ieee80211_key_alg - key algorithm |
| 702 | * @ALG_WEP: WEP40 or WEP104 | 715 | * @ALG_WEP: WEP40 or WEP104 |
| 703 | * @ALG_TKIP: TKIP | 716 | * @ALG_TKIP: TKIP |
| @@ -792,7 +805,7 @@ enum set_key_cmd { | |||
| 792 | * mac80211, any ieee80211_sta pointer you get access to must | 805 | * mac80211, any ieee80211_sta pointer you get access to must |
| 793 | * either be protected by rcu_read_lock() explicitly or implicitly, | 806 | * either be protected by rcu_read_lock() explicitly or implicitly, |
| 794 | * or you must take good care to not use such a pointer after a | 807 | * or you must take good care to not use such a pointer after a |
| 795 | * call to your sta_notify callback that removed it. | 808 | * call to your sta_remove callback that removed it. |
| 796 | * | 809 | * |
| 797 | * @addr: MAC address | 810 | * @addr: MAC address |
| 798 | * @aid: AID we assigned to the station if we're an AP | 811 | * @aid: AID we assigned to the station if we're an AP |
| @@ -818,8 +831,8 @@ struct ieee80211_sta { | |||
| 818 | * indicates addition and removal of a station to station table, | 831 | * indicates addition and removal of a station to station table, |
| 819 | * or if a associated station made a power state transition. | 832 | * or if a associated station made a power state transition. |
| 820 | * | 833 | * |
| 821 | * @STA_NOTIFY_ADD: a station was added to the station table | 834 | * @STA_NOTIFY_ADD: (DEPRECATED) a station was added to the station table |
| 822 | * @STA_NOTIFY_REMOVE: a station being removed from the station table | 835 | * @STA_NOTIFY_REMOVE: (DEPRECATED) a station being removed from the station table |
| 823 | * @STA_NOTIFY_SLEEP: a station is now sleeping | 836 | * @STA_NOTIFY_SLEEP: a station is now sleeping |
| 824 | * @STA_NOTIFY_AWAKE: a sleeping station woke up | 837 | * @STA_NOTIFY_AWAKE: a sleeping station woke up |
| 825 | */ | 838 | */ |
| @@ -852,6 +865,19 @@ enum ieee80211_tkip_key_type { | |||
| 852 | * any particular flags. There are some exceptions to this rule, | 865 | * any particular flags. There are some exceptions to this rule, |
| 853 | * however, so you are advised to review these flags carefully. | 866 | * however, so you are advised to review these flags carefully. |
| 854 | * | 867 | * |
| 868 | * @IEEE80211_HW_HAS_RATE_CONTROL: | ||
| 869 | * The hardware or firmware includes rate control, and cannot be | ||
| 870 | * controlled by the stack. As such, no rate control algorithm | ||
| 871 | * should be instantiated, and the TX rate reported to userspace | ||
| 872 | * will be taken from the TX status instead of the rate control | ||
| 873 | * algorithm. | ||
| 874 | * Note that this requires that the driver implement a number of | ||
| 875 | * callbacks so it has the correct information, it needs to have | ||
| 876 | * the @set_rts_threshold callback and must look at the BSS config | ||
| 877 | * @use_cts_prot for G/N protection, @use_short_slot for slot | ||
| 878 | * timing in 2.4 GHz and @use_short_preamble for preambles for | ||
| 879 | * CCK frames. | ||
| 880 | * | ||
| 855 | * @IEEE80211_HW_RX_INCLUDES_FCS: | 881 | * @IEEE80211_HW_RX_INCLUDES_FCS: |
| 856 | * Indicates that received frames passed to the stack include | 882 | * Indicates that received frames passed to the stack include |
| 857 | * the FCS at the end. | 883 | * the FCS at the end. |
| @@ -908,8 +934,29 @@ enum ieee80211_tkip_key_type { | |||
| 908 | * @IEEE80211_HW_BEACON_FILTER: | 934 | * @IEEE80211_HW_BEACON_FILTER: |
| 909 | * Hardware supports dropping of irrelevant beacon frames to | 935 | * Hardware supports dropping of irrelevant beacon frames to |
| 910 | * avoid waking up cpu. | 936 | * avoid waking up cpu. |
| 937 | * | ||
| 938 | * @IEEE80211_HW_SUPPORTS_STATIC_SMPS: | ||
| 939 | * Hardware supports static spatial multiplexing powersave, | ||
| 940 | * ie. can turn off all but one chain even on HT connections | ||
| 941 | * that should be using more chains. | ||
| 942 | * | ||
| 943 | * @IEEE80211_HW_SUPPORTS_DYNAMIC_SMPS: | ||
| 944 | * Hardware supports dynamic spatial multiplexing powersave, | ||
| 945 | * ie. can turn off all but one chain and then wake the rest | ||
| 946 | * up as required after, for example, rts/cts handshake. | ||
| 947 | * | ||
| 948 | * @IEEE80211_HW_SUPPORTS_UAPSD: | ||
| 949 | * Hardware supports Unscheduled Automatic Power Save Delivery | ||
| 950 | * (U-APSD) in managed mode. The mode is configured with | ||
| 951 | * conf_tx() operation. | ||
| 952 | * | ||
| 953 | * @IEEE80211_HW_REPORTS_TX_ACK_STATUS: | ||
| 954 | * Hardware can provide ack status reports of Tx frames to | ||
| 955 | * the stack. | ||
| 956 | * | ||
| 911 | */ | 957 | */ |
| 912 | enum ieee80211_hw_flags { | 958 | enum ieee80211_hw_flags { |
| 959 | IEEE80211_HW_HAS_RATE_CONTROL = 1<<0, | ||
| 913 | IEEE80211_HW_RX_INCLUDES_FCS = 1<<1, | 960 | IEEE80211_HW_RX_INCLUDES_FCS = 1<<1, |
| 914 | IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING = 1<<2, | 961 | IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING = 1<<2, |
| 915 | IEEE80211_HW_2GHZ_SHORT_SLOT_INCAPABLE = 1<<3, | 962 | IEEE80211_HW_2GHZ_SHORT_SLOT_INCAPABLE = 1<<3, |
| @@ -924,6 +971,10 @@ enum ieee80211_hw_flags { | |||
| 924 | IEEE80211_HW_SUPPORTS_DYNAMIC_PS = 1<<12, | 971 | IEEE80211_HW_SUPPORTS_DYNAMIC_PS = 1<<12, |
| 925 | IEEE80211_HW_MFP_CAPABLE = 1<<13, | 972 | IEEE80211_HW_MFP_CAPABLE = 1<<13, |
| 926 | IEEE80211_HW_BEACON_FILTER = 1<<14, | 973 | IEEE80211_HW_BEACON_FILTER = 1<<14, |
| 974 | IEEE80211_HW_SUPPORTS_STATIC_SMPS = 1<<15, | ||
| 975 | IEEE80211_HW_SUPPORTS_DYNAMIC_SMPS = 1<<16, | ||
| 976 | IEEE80211_HW_SUPPORTS_UAPSD = 1<<17, | ||
| 977 | IEEE80211_HW_REPORTS_TX_ACK_STATUS = 1<<18, | ||
| 927 | }; | 978 | }; |
| 928 | 979 | ||
| 929 | /** | 980 | /** |
| @@ -1102,18 +1153,24 @@ ieee80211_get_alt_retry_rate(const struct ieee80211_hw *hw, | |||
| 1102 | * | 1153 | * |
| 1103 | * mac80211 has support for various powersave implementations. | 1154 | * mac80211 has support for various powersave implementations. |
| 1104 | * | 1155 | * |
| 1105 | * First, it can support hardware that handles all powersaving by | 1156 | * First, it can support hardware that handles all powersaving by itself, |
| 1106 | * itself, such hardware should simply set the %IEEE80211_HW_SUPPORTS_PS | 1157 | * such hardware should simply set the %IEEE80211_HW_SUPPORTS_PS hardware |
| 1107 | * hardware flag. In that case, it will be told about the desired | 1158 | * flag. In that case, it will be told about the desired powersave mode |
| 1108 | * powersave mode depending on the association status, and the driver | 1159 | * with the %IEEE80211_CONF_PS flag depending on the association status. |
| 1109 | * must take care of sending nullfunc frames when necessary, i.e. when | 1160 | * The hardware must take care of sending nullfunc frames when necessary, |
| 1110 | * entering and leaving powersave mode. The driver is required to look at | 1161 | * i.e. when entering and leaving powersave mode. The hardware is required |
| 1111 | * the AID in beacons and signal to the AP that it woke up when it finds | 1162 | * to look at the AID in beacons and signal to the AP that it woke up when |
| 1112 | * traffic directed to it. This mode supports dynamic PS by simply | 1163 | * it finds traffic directed to it. |
| 1113 | * enabling/disabling PS. | 1164 | * |
| 1114 | * | 1165 | * %IEEE80211_CONF_PS flag enabled means that the powersave mode defined in |
| 1115 | * Additionally, such hardware may set the %IEEE80211_HW_SUPPORTS_DYNAMIC_PS | 1166 | * IEEE 802.11-2007 section 11.2 is enabled. This is not to be confused |
| 1116 | * flag to indicate that it can support dynamic PS mode itself (see below). | 1167 | * with hardware wakeup and sleep states. Driver is responsible for waking |
| 1168 | * up the hardware before issueing commands to the hardware and putting it | ||
| 1169 | * back to sleep at approriate times. | ||
| 1170 | * | ||
| 1171 | * When PS is enabled, hardware needs to wakeup for beacons and receive the | ||
| 1172 | * buffered multicast/broadcast frames after the beacon. Also it must be | ||
| 1173 | * possible to send frames and receive the acknowledment frame. | ||
| 1117 | * | 1174 | * |
| 1118 | * Other hardware designs cannot send nullfunc frames by themselves and also | 1175 | * Other hardware designs cannot send nullfunc frames by themselves and also |
| 1119 | * need software support for parsing the TIM bitmap. This is also supported | 1176 | * need software support for parsing the TIM bitmap. This is also supported |
| @@ -1121,14 +1178,35 @@ ieee80211_get_alt_retry_rate(const struct ieee80211_hw *hw, | |||
| 1121 | * %IEEE80211_HW_PS_NULLFUNC_STACK flags. The hardware is of course still | 1178 | * %IEEE80211_HW_PS_NULLFUNC_STACK flags. The hardware is of course still |
| 1122 | * required to pass up beacons. The hardware is still required to handle | 1179 | * required to pass up beacons. The hardware is still required to handle |
| 1123 | * waking up for multicast traffic; if it cannot the driver must handle that | 1180 | * waking up for multicast traffic; if it cannot the driver must handle that |
| 1124 | * as best as it can, mac80211 is too slow. | 1181 | * as best as it can, mac80211 is too slow to do that. |
| 1125 | * | 1182 | * |
| 1126 | * Dynamic powersave mode is an extension to normal powersave mode in which | 1183 | * Dynamic powersave is an extension to normal powersave in which the |
| 1127 | * the hardware stays awake for a user-specified period of time after sending | 1184 | * hardware stays awake for a user-specified period of time after sending a |
| 1128 | * a frame so that reply frames need not be buffered and therefore delayed | 1185 | * frame so that reply frames need not be buffered and therefore delayed to |
| 1129 | * to the next wakeup. This can either be supported by hardware, in which case | 1186 | * the next wakeup. It's compromise of getting good enough latency when |
| 1130 | * the driver needs to look at the @dynamic_ps_timeout hardware configuration | 1187 | * there's data traffic and still saving significantly power in idle |
| 1131 | * value, or by the stack if all nullfunc handling is in the stack. | 1188 | * periods. |
| 1189 | * | ||
| 1190 | * Dynamic powersave is supported by simply mac80211 enabling and disabling | ||
| 1191 | * PS based on traffic. Driver needs to only set %IEEE80211_HW_SUPPORTS_PS | ||
| 1192 | * flag and mac80211 will handle everything automatically. Additionally, | ||
| 1193 | * hardware having support for the dynamic PS feature may set the | ||
| 1194 | * %IEEE80211_HW_SUPPORTS_DYNAMIC_PS flag to indicate that it can support | ||
| 1195 | * dynamic PS mode itself. The driver needs to look at the | ||
| 1196 | * @dynamic_ps_timeout hardware configuration value and use it that value | ||
| 1197 | * whenever %IEEE80211_CONF_PS is set. In this case mac80211 will disable | ||
| 1198 | * dynamic PS feature in stack and will just keep %IEEE80211_CONF_PS | ||
| 1199 | * enabled whenever user has enabled powersave. | ||
| 1200 | * | ||
| 1201 | * Driver informs U-APSD client support by enabling | ||
| 1202 | * %IEEE80211_HW_SUPPORTS_UAPSD flag. The mode is configured through the | ||
| 1203 | * uapsd paramater in conf_tx() operation. Hardware needs to send the QoS | ||
| 1204 | * Nullfunc frames and stay awake until the service period has ended. To | ||
| 1205 | * utilize U-APSD, dynamic powersave is disabled for voip AC and all frames | ||
| 1206 | * from that AC are transmitted with powersave enabled. | ||
| 1207 | * | ||
| 1208 | * Note: U-APSD client mode is not yet supported with | ||
| 1209 | * %IEEE80211_HW_PS_NULLFUNC_STACK. | ||
| 1132 | */ | 1210 | */ |
| 1133 | 1211 | ||
| 1134 | /** | 1212 | /** |
| @@ -1192,6 +1270,31 @@ ieee80211_get_alt_retry_rate(const struct ieee80211_hw *hw, | |||
| 1192 | */ | 1270 | */ |
| 1193 | 1271 | ||
| 1194 | /** | 1272 | /** |
| 1273 | * DOC: Spatial multiplexing power save | ||
| 1274 | * | ||
| 1275 | * SMPS (Spatial multiplexing power save) is a mechanism to conserve | ||
| 1276 | * power in an 802.11n implementation. For details on the mechanism | ||
| 1277 | * and rationale, please refer to 802.11 (as amended by 802.11n-2009) | ||
| 1278 | * "11.2.3 SM power save". | ||
| 1279 | * | ||
| 1280 | * The mac80211 implementation is capable of sending action frames | ||
| 1281 | * to update the AP about the station's SMPS mode, and will instruct | ||
| 1282 | * the driver to enter the specific mode. It will also announce the | ||
| 1283 | * requested SMPS mode during the association handshake. Hardware | ||
| 1284 | * support for this feature is required, and can be indicated by | ||
| 1285 | * hardware flags. | ||
| 1286 | * | ||
| 1287 | * The default mode will be "automatic", which nl80211/cfg80211 | ||
| 1288 | * defines to be dynamic SMPS in (regular) powersave, and SMPS | ||
| 1289 | * turned off otherwise. | ||
| 1290 | * | ||
| 1291 | * To support this feature, the driver must set the appropriate | ||
| 1292 | * hardware support flags, and handle the SMPS flag to the config() | ||
| 1293 | * operation. It will then with this mechanism be instructed to | ||
| 1294 | * enter the requested SMPS mode while associated to an HT AP. | ||
| 1295 | */ | ||
| 1296 | |||
| 1297 | /** | ||
| 1195 | * DOC: Frame filtering | 1298 | * DOC: Frame filtering |
| 1196 | * | 1299 | * |
| 1197 | * mac80211 requires to see many management frames for proper | 1300 | * mac80211 requires to see many management frames for proper |
| @@ -1328,7 +1431,7 @@ enum ieee80211_ampdu_mlme_action { | |||
| 1328 | * When the device is started it should not have a MAC address | 1431 | * When the device is started it should not have a MAC address |
| 1329 | * to avoid acknowledging frames before a non-monitor device | 1432 | * to avoid acknowledging frames before a non-monitor device |
| 1330 | * is added. | 1433 | * is added. |
| 1331 | * Must be implemented. | 1434 | * Must be implemented and can sleep. |
| 1332 | * | 1435 | * |
| 1333 | * @stop: Called after last netdevice attached to the hardware | 1436 | * @stop: Called after last netdevice attached to the hardware |
| 1334 | * is disabled. This should turn off the hardware (at least | 1437 | * is disabled. This should turn off the hardware (at least |
| @@ -1336,7 +1439,7 @@ enum ieee80211_ampdu_mlme_action { | |||
| 1336 | * May be called right after add_interface if that rejects | 1439 | * May be called right after add_interface if that rejects |
| 1337 | * an interface. If you added any work onto the mac80211 workqueue | 1440 | * an interface. If you added any work onto the mac80211 workqueue |
| 1338 | * you should ensure to cancel it on this callback. | 1441 | * you should ensure to cancel it on this callback. |
| 1339 | * Must be implemented. | 1442 | * Must be implemented and can sleep. |
| 1340 | * | 1443 | * |
| 1341 | * @add_interface: Called when a netdevice attached to the hardware is | 1444 | * @add_interface: Called when a netdevice attached to the hardware is |
| 1342 | * enabled. Because it is not called for monitor mode devices, @start | 1445 | * enabled. Because it is not called for monitor mode devices, @start |
| @@ -1346,7 +1449,7 @@ enum ieee80211_ampdu_mlme_action { | |||
| 1346 | * interface is given in the conf parameter. | 1449 | * interface is given in the conf parameter. |
| 1347 | * The callback may refuse to add an interface by returning a | 1450 | * The callback may refuse to add an interface by returning a |
| 1348 | * negative error code (which will be seen in userspace.) | 1451 | * negative error code (which will be seen in userspace.) |
| 1349 | * Must be implemented. | 1452 | * Must be implemented and can sleep. |
| 1350 | * | 1453 | * |
| 1351 | * @remove_interface: Notifies a driver that an interface is going down. | 1454 | * @remove_interface: Notifies a driver that an interface is going down. |
| 1352 | * The @stop callback is called after this if it is the last interface | 1455 | * The @stop callback is called after this if it is the last interface |
| @@ -1355,19 +1458,20 @@ enum ieee80211_ampdu_mlme_action { | |||
| 1355 | * must be cleared so the device no longer acknowledges packets, | 1458 | * must be cleared so the device no longer acknowledges packets, |
| 1356 | * the mac_addr member of the conf structure is, however, set to the | 1459 | * the mac_addr member of the conf structure is, however, set to the |
| 1357 | * MAC address of the device going away. | 1460 | * MAC address of the device going away. |
| 1358 | * Hence, this callback must be implemented. | 1461 | * Hence, this callback must be implemented. It can sleep. |
| 1359 | * | 1462 | * |
| 1360 | * @config: Handler for configuration requests. IEEE 802.11 code calls this | 1463 | * @config: Handler for configuration requests. IEEE 802.11 code calls this |
| 1361 | * function to change hardware configuration, e.g., channel. | 1464 | * function to change hardware configuration, e.g., channel. |
| 1362 | * This function should never fail but returns a negative error code | 1465 | * This function should never fail but returns a negative error code |
| 1363 | * if it does. | 1466 | * if it does. The callback can sleep. |
| 1364 | * | 1467 | * |
| 1365 | * @bss_info_changed: Handler for configuration requests related to BSS | 1468 | * @bss_info_changed: Handler for configuration requests related to BSS |
| 1366 | * parameters that may vary during BSS's lifespan, and may affect low | 1469 | * parameters that may vary during BSS's lifespan, and may affect low |
| 1367 | * level driver (e.g. assoc/disassoc status, erp parameters). | 1470 | * level driver (e.g. assoc/disassoc status, erp parameters). |
| 1368 | * This function should not be used if no BSS has been set, unless | 1471 | * This function should not be used if no BSS has been set, unless |
| 1369 | * for association indication. The @changed parameter indicates which | 1472 | * for association indication. The @changed parameter indicates which |
| 1370 | * of the bss parameters has changed when a call is made. | 1473 | * of the bss parameters has changed when a call is made. The callback |
| 1474 | * can sleep. | ||
| 1371 | * | 1475 | * |
| 1372 | * @prepare_multicast: Prepare for multicast filter configuration. | 1476 | * @prepare_multicast: Prepare for multicast filter configuration. |
| 1373 | * This callback is optional, and its return value is passed | 1477 | * This callback is optional, and its return value is passed |
| @@ -1375,20 +1479,22 @@ enum ieee80211_ampdu_mlme_action { | |||
| 1375 | * | 1479 | * |
| 1376 | * @configure_filter: Configure the device's RX filter. | 1480 | * @configure_filter: Configure the device's RX filter. |
| 1377 | * See the section "Frame filtering" for more information. | 1481 | * See the section "Frame filtering" for more information. |
| 1378 | * This callback must be implemented. | 1482 | * This callback must be implemented and can sleep. |
| 1379 | * | 1483 | * |
| 1380 | * @set_tim: Set TIM bit. mac80211 calls this function when a TIM bit | 1484 | * @set_tim: Set TIM bit. mac80211 calls this function when a TIM bit |
| 1381 | * must be set or cleared for a given STA. Must be atomic. | 1485 | * must be set or cleared for a given STA. Must be atomic. |
| 1382 | * | 1486 | * |
| 1383 | * @set_key: See the section "Hardware crypto acceleration" | 1487 | * @set_key: See the section "Hardware crypto acceleration" |
| 1384 | * This callback can sleep, and is only called between add_interface | 1488 | * This callback is only called between add_interface and |
| 1385 | * and remove_interface calls, i.e. while the given virtual interface | 1489 | * remove_interface calls, i.e. while the given virtual interface |
| 1386 | * is enabled. | 1490 | * is enabled. |
| 1387 | * Returns a negative error code if the key can't be added. | 1491 | * Returns a negative error code if the key can't be added. |
| 1492 | * The callback can sleep. | ||
| 1388 | * | 1493 | * |
| 1389 | * @update_tkip_key: See the section "Hardware crypto acceleration" | 1494 | * @update_tkip_key: See the section "Hardware crypto acceleration" |
| 1390 | * This callback will be called in the context of Rx. Called for drivers | 1495 | * This callback will be called in the context of Rx. Called for drivers |
| 1391 | * which set IEEE80211_KEY_FLAG_TKIP_REQ_RX_P1_KEY. | 1496 | * which set IEEE80211_KEY_FLAG_TKIP_REQ_RX_P1_KEY. |
| 1497 | * The callback must be atomic. | ||
| 1392 | * | 1498 | * |
| 1393 | * @hw_scan: Ask the hardware to service the scan request, no need to start | 1499 | * @hw_scan: Ask the hardware to service the scan request, no need to start |
| 1394 | * the scan state machine in stack. The scan must honour the channel | 1500 | * the scan state machine in stack. The scan must honour the channel |
| @@ -1402,53 +1508,64 @@ enum ieee80211_ampdu_mlme_action { | |||
| 1402 | * When the scan finishes, ieee80211_scan_completed() must be called; | 1508 | * When the scan finishes, ieee80211_scan_completed() must be called; |
| 1403 | * note that it also must be called when the scan cannot finish due to | 1509 | * note that it also must be called when the scan cannot finish due to |
| 1404 | * any error unless this callback returned a negative error code. | 1510 | * any error unless this callback returned a negative error code. |
| 1511 | * The callback can sleep. | ||
| 1405 | * | 1512 | * |
| 1406 | * @sw_scan_start: Notifier function that is called just before a software scan | 1513 | * @sw_scan_start: Notifier function that is called just before a software scan |
| 1407 | * is started. Can be NULL, if the driver doesn't need this notification. | 1514 | * is started. Can be NULL, if the driver doesn't need this notification. |
| 1515 | * The callback can sleep. | ||
| 1408 | * | 1516 | * |
| 1409 | * @sw_scan_complete: Notifier function that is called just after a software scan | 1517 | * @sw_scan_complete: Notifier function that is called just after a |
| 1410 | * finished. Can be NULL, if the driver doesn't need this notification. | 1518 | * software scan finished. Can be NULL, if the driver doesn't need |
| 1519 | * this notification. | ||
| 1520 | * The callback can sleep. | ||
| 1411 | * | 1521 | * |
| 1412 | * @get_stats: Return low-level statistics. | 1522 | * @get_stats: Return low-level statistics. |
| 1413 | * Returns zero if statistics are available. | 1523 | * Returns zero if statistics are available. |
| 1524 | * The callback can sleep. | ||
| 1414 | * | 1525 | * |
| 1415 | * @get_tkip_seq: If your device implements TKIP encryption in hardware this | 1526 | * @get_tkip_seq: If your device implements TKIP encryption in hardware this |
| 1416 | * callback should be provided to read the TKIP transmit IVs (both IV32 | 1527 | * callback should be provided to read the TKIP transmit IVs (both IV32 |
| 1417 | * and IV16) for the given key from hardware. | 1528 | * and IV16) for the given key from hardware. |
| 1529 | * The callback must be atomic. | ||
| 1418 | * | 1530 | * |
| 1419 | * @set_rts_threshold: Configuration of RTS threshold (if device needs it) | 1531 | * @set_rts_threshold: Configuration of RTS threshold (if device needs it) |
| 1532 | * The callback can sleep. | ||
| 1533 | * | ||
| 1534 | * @sta_add: Notifies low level driver about addition of an associated station, | ||
| 1535 | * AP, IBSS/WDS/mesh peer etc. This callback can sleep. | ||
| 1420 | * | 1536 | * |
| 1421 | * @sta_notify: Notifies low level driver about addition, removal or power | 1537 | * @sta_remove: Notifies low level driver about removal of an associated |
| 1422 | * state transition of an associated station, AP, IBSS/WDS/mesh peer etc. | 1538 | * station, AP, IBSS/WDS/mesh peer etc. This callback can sleep. |
| 1423 | * Must be atomic. | 1539 | * |
| 1540 | * @sta_notify: Notifies low level driver about power state transition of an | ||
| 1541 | * associated station, AP, IBSS/WDS/mesh peer etc. Must be atomic. | ||
| 1424 | * | 1542 | * |
| 1425 | * @conf_tx: Configure TX queue parameters (EDCF (aifs, cw_min, cw_max), | 1543 | * @conf_tx: Configure TX queue parameters (EDCF (aifs, cw_min, cw_max), |
| 1426 | * bursting) for a hardware TX queue. | 1544 | * bursting) for a hardware TX queue. |
| 1427 | * Returns a negative error code on failure. | 1545 | * Returns a negative error code on failure. |
| 1428 | * | 1546 | * The callback can sleep. |
| 1429 | * @get_tx_stats: Get statistics of the current TX queue status. This is used | ||
| 1430 | * to get number of currently queued packets (queue length), maximum queue | ||
| 1431 | * size (limit), and total number of packets sent using each TX queue | ||
| 1432 | * (count). The 'stats' pointer points to an array that has hw->queues | ||
| 1433 | * items. | ||
| 1434 | * | 1547 | * |
| 1435 | * @get_tsf: Get the current TSF timer value from firmware/hardware. Currently, | 1548 | * @get_tsf: Get the current TSF timer value from firmware/hardware. Currently, |
| 1436 | * this is only used for IBSS mode BSSID merging and debugging. Is not a | 1549 | * this is only used for IBSS mode BSSID merging and debugging. Is not a |
| 1437 | * required function. | 1550 | * required function. |
| 1551 | * The callback can sleep. | ||
| 1438 | * | 1552 | * |
| 1439 | * @set_tsf: Set the TSF timer to the specified value in the firmware/hardware. | 1553 | * @set_tsf: Set the TSF timer to the specified value in the firmware/hardware. |
| 1440 | * Currently, this is only used for IBSS mode debugging. Is not a | 1554 | * Currently, this is only used for IBSS mode debugging. Is not a |
| 1441 | * required function. | 1555 | * required function. |
| 1556 | * The callback can sleep. | ||
| 1442 | * | 1557 | * |
| 1443 | * @reset_tsf: Reset the TSF timer and allow firmware/hardware to synchronize | 1558 | * @reset_tsf: Reset the TSF timer and allow firmware/hardware to synchronize |
| 1444 | * with other STAs in the IBSS. This is only used in IBSS mode. This | 1559 | * with other STAs in the IBSS. This is only used in IBSS mode. This |
| 1445 | * function is optional if the firmware/hardware takes full care of | 1560 | * function is optional if the firmware/hardware takes full care of |
| 1446 | * TSF synchronization. | 1561 | * TSF synchronization. |
| 1562 | * The callback can sleep. | ||
| 1447 | * | 1563 | * |
| 1448 | * @tx_last_beacon: Determine whether the last IBSS beacon was sent by us. | 1564 | * @tx_last_beacon: Determine whether the last IBSS beacon was sent by us. |
| 1449 | * This is needed only for IBSS mode and the result of this function is | 1565 | * This is needed only for IBSS mode and the result of this function is |
| 1450 | * used to determine whether to reply to Probe Requests. | 1566 | * used to determine whether to reply to Probe Requests. |
| 1451 | * Returns non-zero if this device sent the last beacon. | 1567 | * Returns non-zero if this device sent the last beacon. |
| 1568 | * The callback can sleep. | ||
| 1452 | * | 1569 | * |
| 1453 | * @ampdu_action: Perform a certain A-MPDU action | 1570 | * @ampdu_action: Perform a certain A-MPDU action |
| 1454 | * The RA/TID combination determines the destination and TID we want | 1571 | * The RA/TID combination determines the destination and TID we want |
| @@ -1457,21 +1574,32 @@ enum ieee80211_ampdu_mlme_action { | |||
| 1457 | * is the first frame we expect to perform the action on. Notice | 1574 | * is the first frame we expect to perform the action on. Notice |
| 1458 | * that TX/RX_STOP can pass NULL for this parameter. | 1575 | * that TX/RX_STOP can pass NULL for this parameter. |
| 1459 | * Returns a negative error code on failure. | 1576 | * Returns a negative error code on failure. |
| 1577 | * The callback must be atomic. | ||
| 1460 | * | 1578 | * |
| 1461 | * @rfkill_poll: Poll rfkill hardware state. If you need this, you also | 1579 | * @rfkill_poll: Poll rfkill hardware state. If you need this, you also |
| 1462 | * need to set wiphy->rfkill_poll to %true before registration, | 1580 | * need to set wiphy->rfkill_poll to %true before registration, |
| 1463 | * and need to call wiphy_rfkill_set_hw_state() in the callback. | 1581 | * and need to call wiphy_rfkill_set_hw_state() in the callback. |
| 1582 | * The callback can sleep. | ||
| 1583 | * | ||
| 1584 | * @set_coverage_class: Set slot time for given coverage class as specified | ||
| 1585 | * in IEEE 802.11-2007 section 17.3.8.6 and modify ACK timeout | ||
| 1586 | * accordingly. This callback is not required and may sleep. | ||
| 1464 | * | 1587 | * |
| 1465 | * @testmode_cmd: Implement a cfg80211 test mode command. | 1588 | * @testmode_cmd: Implement a cfg80211 test mode command. |
| 1589 | * The callback can sleep. | ||
| 1590 | * | ||
| 1591 | * @flush: Flush all pending frames from the hardware queue, making sure | ||
| 1592 | * that the hardware queues are empty. If the parameter @drop is set | ||
| 1593 | * to %true, pending frames may be dropped. The callback can sleep. | ||
| 1466 | */ | 1594 | */ |
| 1467 | struct ieee80211_ops { | 1595 | struct ieee80211_ops { |
| 1468 | int (*tx)(struct ieee80211_hw *hw, struct sk_buff *skb); | 1596 | int (*tx)(struct ieee80211_hw *hw, struct sk_buff *skb); |
| 1469 | int (*start)(struct ieee80211_hw *hw); | 1597 | int (*start)(struct ieee80211_hw *hw); |
| 1470 | void (*stop)(struct ieee80211_hw *hw); | 1598 | void (*stop)(struct ieee80211_hw *hw); |
| 1471 | int (*add_interface)(struct ieee80211_hw *hw, | 1599 | int (*add_interface)(struct ieee80211_hw *hw, |
| 1472 | struct ieee80211_if_init_conf *conf); | 1600 | struct ieee80211_vif *vif); |
| 1473 | void (*remove_interface)(struct ieee80211_hw *hw, | 1601 | void (*remove_interface)(struct ieee80211_hw *hw, |
| 1474 | struct ieee80211_if_init_conf *conf); | 1602 | struct ieee80211_vif *vif); |
| 1475 | int (*config)(struct ieee80211_hw *hw, u32 changed); | 1603 | int (*config)(struct ieee80211_hw *hw, u32 changed); |
| 1476 | void (*bss_info_changed)(struct ieee80211_hw *hw, | 1604 | void (*bss_info_changed)(struct ieee80211_hw *hw, |
| 1477 | struct ieee80211_vif *vif, | 1605 | struct ieee80211_vif *vif, |
| @@ -1489,8 +1617,10 @@ struct ieee80211_ops { | |||
| 1489 | struct ieee80211_vif *vif, struct ieee80211_sta *sta, | 1617 | struct ieee80211_vif *vif, struct ieee80211_sta *sta, |
| 1490 | struct ieee80211_key_conf *key); | 1618 | struct ieee80211_key_conf *key); |
| 1491 | void (*update_tkip_key)(struct ieee80211_hw *hw, | 1619 | void (*update_tkip_key)(struct ieee80211_hw *hw, |
| 1492 | struct ieee80211_key_conf *conf, const u8 *address, | 1620 | struct ieee80211_vif *vif, |
| 1493 | u32 iv32, u16 *phase1key); | 1621 | struct ieee80211_key_conf *conf, |
| 1622 | struct ieee80211_sta *sta, | ||
| 1623 | u32 iv32, u16 *phase1key); | ||
| 1494 | int (*hw_scan)(struct ieee80211_hw *hw, | 1624 | int (*hw_scan)(struct ieee80211_hw *hw, |
| 1495 | struct cfg80211_scan_request *req); | 1625 | struct cfg80211_scan_request *req); |
| 1496 | void (*sw_scan_start)(struct ieee80211_hw *hw); | 1626 | void (*sw_scan_start)(struct ieee80211_hw *hw); |
| @@ -1500,24 +1630,29 @@ struct ieee80211_ops { | |||
| 1500 | void (*get_tkip_seq)(struct ieee80211_hw *hw, u8 hw_key_idx, | 1630 | void (*get_tkip_seq)(struct ieee80211_hw *hw, u8 hw_key_idx, |
| 1501 | u32 *iv32, u16 *iv16); | 1631 | u32 *iv32, u16 *iv16); |
| 1502 | int (*set_rts_threshold)(struct ieee80211_hw *hw, u32 value); | 1632 | int (*set_rts_threshold)(struct ieee80211_hw *hw, u32 value); |
| 1633 | int (*sta_add)(struct ieee80211_hw *hw, struct ieee80211_vif *vif, | ||
| 1634 | struct ieee80211_sta *sta); | ||
| 1635 | int (*sta_remove)(struct ieee80211_hw *hw, struct ieee80211_vif *vif, | ||
| 1636 | struct ieee80211_sta *sta); | ||
| 1503 | void (*sta_notify)(struct ieee80211_hw *hw, struct ieee80211_vif *vif, | 1637 | void (*sta_notify)(struct ieee80211_hw *hw, struct ieee80211_vif *vif, |
| 1504 | enum sta_notify_cmd, struct ieee80211_sta *sta); | 1638 | enum sta_notify_cmd, struct ieee80211_sta *sta); |
| 1505 | int (*conf_tx)(struct ieee80211_hw *hw, u16 queue, | 1639 | int (*conf_tx)(struct ieee80211_hw *hw, u16 queue, |
| 1506 | const struct ieee80211_tx_queue_params *params); | 1640 | const struct ieee80211_tx_queue_params *params); |
| 1507 | int (*get_tx_stats)(struct ieee80211_hw *hw, | ||
| 1508 | struct ieee80211_tx_queue_stats *stats); | ||
| 1509 | u64 (*get_tsf)(struct ieee80211_hw *hw); | 1641 | u64 (*get_tsf)(struct ieee80211_hw *hw); |
| 1510 | void (*set_tsf)(struct ieee80211_hw *hw, u64 tsf); | 1642 | void (*set_tsf)(struct ieee80211_hw *hw, u64 tsf); |
| 1511 | void (*reset_tsf)(struct ieee80211_hw *hw); | 1643 | void (*reset_tsf)(struct ieee80211_hw *hw); |
| 1512 | int (*tx_last_beacon)(struct ieee80211_hw *hw); | 1644 | int (*tx_last_beacon)(struct ieee80211_hw *hw); |
| 1513 | int (*ampdu_action)(struct ieee80211_hw *hw, | 1645 | int (*ampdu_action)(struct ieee80211_hw *hw, |
| 1646 | struct ieee80211_vif *vif, | ||
| 1514 | enum ieee80211_ampdu_mlme_action action, | 1647 | enum ieee80211_ampdu_mlme_action action, |
| 1515 | struct ieee80211_sta *sta, u16 tid, u16 *ssn); | 1648 | struct ieee80211_sta *sta, u16 tid, u16 *ssn); |
| 1516 | 1649 | ||
| 1517 | void (*rfkill_poll)(struct ieee80211_hw *hw); | 1650 | void (*rfkill_poll)(struct ieee80211_hw *hw); |
| 1651 | void (*set_coverage_class)(struct ieee80211_hw *hw, u8 coverage_class); | ||
| 1518 | #ifdef CONFIG_NL80211_TESTMODE | 1652 | #ifdef CONFIG_NL80211_TESTMODE |
| 1519 | int (*testmode_cmd)(struct ieee80211_hw *hw, void *data, int len); | 1653 | int (*testmode_cmd)(struct ieee80211_hw *hw, void *data, int len); |
| 1520 | #endif | 1654 | #endif |
| 1655 | void (*flush)(struct ieee80211_hw *hw, bool drop); | ||
| 1521 | }; | 1656 | }; |
| 1522 | 1657 | ||
| 1523 | /** | 1658 | /** |
| @@ -1667,15 +1802,14 @@ void ieee80211_restart_hw(struct ieee80211_hw *hw); | |||
| 1667 | * ieee80211_rx - receive frame | 1802 | * ieee80211_rx - receive frame |
| 1668 | * | 1803 | * |
| 1669 | * Use this function to hand received frames to mac80211. The receive | 1804 | * Use this function to hand received frames to mac80211. The receive |
| 1670 | * buffer in @skb must start with an IEEE 802.11 header or a radiotap | 1805 | * buffer in @skb must start with an IEEE 802.11 header. |
| 1671 | * header if %RX_FLAG_RADIOTAP is set in the @status flags. | ||
| 1672 | * | 1806 | * |
| 1673 | * This function may not be called in IRQ context. Calls to this function | 1807 | * This function may not be called in IRQ context. Calls to this function |
| 1674 | * for a single hardware must be synchronized against each other. Calls | 1808 | * for a single hardware must be synchronized against each other. Calls to |
| 1675 | * to this function and ieee80211_rx_irqsafe() may not be mixed for a | 1809 | * this function, ieee80211_rx_ni() and ieee80211_rx_irqsafe() may not be |
| 1676 | * single hardware. | 1810 | * mixed for a single hardware. |
| 1677 | * | 1811 | * |
| 1678 | * Note that right now, this function must be called with softirqs disabled. | 1812 | * In process context use instead ieee80211_rx_ni(). |
| 1679 | * | 1813 | * |
| 1680 | * @hw: the hardware this frame came in on | 1814 | * @hw: the hardware this frame came in on |
| 1681 | * @skb: the buffer to receive, owned by mac80211 after this call | 1815 | * @skb: the buffer to receive, owned by mac80211 after this call |
| @@ -1688,8 +1822,8 @@ void ieee80211_rx(struct ieee80211_hw *hw, struct sk_buff *skb); | |||
| 1688 | * Like ieee80211_rx() but can be called in IRQ context | 1822 | * Like ieee80211_rx() but can be called in IRQ context |
| 1689 | * (internally defers to a tasklet.) | 1823 | * (internally defers to a tasklet.) |
| 1690 | * | 1824 | * |
| 1691 | * Calls to this function and ieee80211_rx() may not be mixed for a | 1825 | * Calls to this function, ieee80211_rx() or ieee80211_rx_ni() may not |
| 1692 | * single hardware. | 1826 | * be mixed for a single hardware. |
| 1693 | * | 1827 | * |
| 1694 | * @hw: the hardware this frame came in on | 1828 | * @hw: the hardware this frame came in on |
| 1695 | * @skb: the buffer to receive, owned by mac80211 after this call | 1829 | * @skb: the buffer to receive, owned by mac80211 after this call |
| @@ -1697,6 +1831,32 @@ void ieee80211_rx(struct ieee80211_hw *hw, struct sk_buff *skb); | |||
| 1697 | void ieee80211_rx_irqsafe(struct ieee80211_hw *hw, struct sk_buff *skb); | 1831 | void ieee80211_rx_irqsafe(struct ieee80211_hw *hw, struct sk_buff *skb); |
| 1698 | 1832 | ||
| 1699 | /** | 1833 | /** |
| 1834 | * ieee80211_rx_ni - receive frame (in process context) | ||
| 1835 | * | ||
| 1836 | * Like ieee80211_rx() but can be called in process context | ||
| 1837 | * (internally disables bottom halves). | ||
| 1838 | * | ||
| 1839 | * Calls to this function, ieee80211_rx() and ieee80211_rx_irqsafe() may | ||
| 1840 | * not be mixed for a single hardware. | ||
| 1841 | * | ||
| 1842 | * @hw: the hardware this frame came in on | ||
| 1843 | * @skb: the buffer to receive, owned by mac80211 after this call | ||
| 1844 | */ | ||
| 1845 | static inline void ieee80211_rx_ni(struct ieee80211_hw *hw, | ||
| 1846 | struct sk_buff *skb) | ||
| 1847 | { | ||
| 1848 | local_bh_disable(); | ||
| 1849 | ieee80211_rx(hw, skb); | ||
| 1850 | local_bh_enable(); | ||
| 1851 | } | ||
| 1852 | |||
| 1853 | /* | ||
| 1854 | * The TX headroom reserved by mac80211 for its own tx_status functions. | ||
| 1855 | * This is enough for the radiotap header. | ||
| 1856 | */ | ||
| 1857 | #define IEEE80211_TX_STATUS_HEADROOM 13 | ||
| 1858 | |||
| 1859 | /** | ||
| 1700 | * ieee80211_tx_status - transmit status callback | 1860 | * ieee80211_tx_status - transmit status callback |
| 1701 | * | 1861 | * |
| 1702 | * Call this function for all transmitted frames after they have been | 1862 | * Call this function for all transmitted frames after they have been |
| @@ -1730,24 +1890,97 @@ void ieee80211_tx_status_irqsafe(struct ieee80211_hw *hw, | |||
| 1730 | struct sk_buff *skb); | 1890 | struct sk_buff *skb); |
| 1731 | 1891 | ||
| 1732 | /** | 1892 | /** |
| 1733 | * ieee80211_beacon_get - beacon generation function | 1893 | * ieee80211_beacon_get_tim - beacon generation function |
| 1734 | * @hw: pointer obtained from ieee80211_alloc_hw(). | 1894 | * @hw: pointer obtained from ieee80211_alloc_hw(). |
| 1735 | * @vif: &struct ieee80211_vif pointer from &struct ieee80211_if_init_conf. | 1895 | * @vif: &struct ieee80211_vif pointer from the add_interface callback. |
| 1896 | * @tim_offset: pointer to variable that will receive the TIM IE offset. | ||
| 1897 | * Set to 0 if invalid (in non-AP modes). | ||
| 1898 | * @tim_length: pointer to variable that will receive the TIM IE length, | ||
| 1899 | * (including the ID and length bytes!). | ||
| 1900 | * Set to 0 if invalid (in non-AP modes). | ||
| 1901 | * | ||
| 1902 | * If the driver implements beaconing modes, it must use this function to | ||
| 1903 | * obtain the beacon frame/template. | ||
| 1736 | * | 1904 | * |
| 1737 | * If the beacon frames are generated by the host system (i.e., not in | 1905 | * If the beacon frames are generated by the host system (i.e., not in |
| 1738 | * hardware/firmware), the low-level driver uses this function to receive | 1906 | * hardware/firmware), the driver uses this function to get each beacon |
| 1739 | * the next beacon frame from the 802.11 code. The low-level is responsible | 1907 | * frame from mac80211 -- it is responsible for calling this function |
| 1740 | * for calling this function before beacon data is needed (e.g., based on | 1908 | * before the beacon is needed (e.g. based on hardware interrupt). |
| 1741 | * hardware interrupt). Returned skb is used only once and low-level driver | 1909 | * |
| 1742 | * is responsible for freeing it. | 1910 | * If the beacon frames are generated by the device, then the driver |
| 1911 | * must use the returned beacon as the template and change the TIM IE | ||
| 1912 | * according to the current DTIM parameters/TIM bitmap. | ||
| 1913 | * | ||
| 1914 | * The driver is responsible for freeing the returned skb. | ||
| 1915 | */ | ||
| 1916 | struct sk_buff *ieee80211_beacon_get_tim(struct ieee80211_hw *hw, | ||
| 1917 | struct ieee80211_vif *vif, | ||
| 1918 | u16 *tim_offset, u16 *tim_length); | ||
| 1919 | |||
| 1920 | /** | ||
| 1921 | * ieee80211_beacon_get - beacon generation function | ||
| 1922 | * @hw: pointer obtained from ieee80211_alloc_hw(). | ||
| 1923 | * @vif: &struct ieee80211_vif pointer from the add_interface callback. | ||
| 1924 | * | ||
| 1925 | * See ieee80211_beacon_get_tim(). | ||
| 1926 | */ | ||
| 1927 | static inline struct sk_buff *ieee80211_beacon_get(struct ieee80211_hw *hw, | ||
| 1928 | struct ieee80211_vif *vif) | ||
| 1929 | { | ||
| 1930 | return ieee80211_beacon_get_tim(hw, vif, NULL, NULL); | ||
| 1931 | } | ||
| 1932 | |||
| 1933 | /** | ||
| 1934 | * ieee80211_pspoll_get - retrieve a PS Poll template | ||
| 1935 | * @hw: pointer obtained from ieee80211_alloc_hw(). | ||
| 1936 | * @vif: &struct ieee80211_vif pointer from the add_interface callback. | ||
| 1937 | * | ||
| 1938 | * Creates a PS Poll a template which can, for example, uploaded to | ||
| 1939 | * hardware. The template must be updated after association so that correct | ||
| 1940 | * AID, BSSID and MAC address is used. | ||
| 1941 | * | ||
| 1942 | * Note: Caller (or hardware) is responsible for setting the | ||
| 1943 | * &IEEE80211_FCTL_PM bit. | ||
| 1743 | */ | 1944 | */ |
| 1744 | struct sk_buff *ieee80211_beacon_get(struct ieee80211_hw *hw, | 1945 | struct sk_buff *ieee80211_pspoll_get(struct ieee80211_hw *hw, |
| 1745 | struct ieee80211_vif *vif); | 1946 | struct ieee80211_vif *vif); |
| 1746 | 1947 | ||
| 1747 | /** | 1948 | /** |
| 1949 | * ieee80211_nullfunc_get - retrieve a nullfunc template | ||
| 1950 | * @hw: pointer obtained from ieee80211_alloc_hw(). | ||
| 1951 | * @vif: &struct ieee80211_vif pointer from the add_interface callback. | ||
| 1952 | * | ||
| 1953 | * Creates a Nullfunc template which can, for example, uploaded to | ||
| 1954 | * hardware. The template must be updated after association so that correct | ||
| 1955 | * BSSID and address is used. | ||
| 1956 | * | ||
| 1957 | * Note: Caller (or hardware) is responsible for setting the | ||
| 1958 | * &IEEE80211_FCTL_PM bit as well as Duration and Sequence Control fields. | ||
| 1959 | */ | ||
| 1960 | struct sk_buff *ieee80211_nullfunc_get(struct ieee80211_hw *hw, | ||
| 1961 | struct ieee80211_vif *vif); | ||
| 1962 | |||
| 1963 | /** | ||
| 1964 | * ieee80211_probereq_get - retrieve a Probe Request template | ||
| 1965 | * @hw: pointer obtained from ieee80211_alloc_hw(). | ||
| 1966 | * @vif: &struct ieee80211_vif pointer from the add_interface callback. | ||
| 1967 | * @ssid: SSID buffer | ||
| 1968 | * @ssid_len: length of SSID | ||
| 1969 | * @ie: buffer containing all IEs except SSID for the template | ||
| 1970 | * @ie_len: length of the IE buffer | ||
| 1971 | * | ||
| 1972 | * Creates a Probe Request template which can, for example, be uploaded to | ||
| 1973 | * hardware. | ||
| 1974 | */ | ||
| 1975 | struct sk_buff *ieee80211_probereq_get(struct ieee80211_hw *hw, | ||
| 1976 | struct ieee80211_vif *vif, | ||
| 1977 | const u8 *ssid, size_t ssid_len, | ||
| 1978 | const u8 *ie, size_t ie_len); | ||
| 1979 | |||
| 1980 | /** | ||
| 1748 | * ieee80211_rts_get - RTS frame generation function | 1981 | * ieee80211_rts_get - RTS frame generation function |
| 1749 | * @hw: pointer obtained from ieee80211_alloc_hw(). | 1982 | * @hw: pointer obtained from ieee80211_alloc_hw(). |
| 1750 | * @vif: &struct ieee80211_vif pointer from &struct ieee80211_if_init_conf. | 1983 | * @vif: &struct ieee80211_vif pointer from the add_interface callback. |
| 1751 | * @frame: pointer to the frame that is going to be protected by the RTS. | 1984 | * @frame: pointer to the frame that is going to be protected by the RTS. |
| 1752 | * @frame_len: the frame length (in octets). | 1985 | * @frame_len: the frame length (in octets). |
| 1753 | * @frame_txctl: &struct ieee80211_tx_info of the frame. | 1986 | * @frame_txctl: &struct ieee80211_tx_info of the frame. |
| @@ -1766,7 +1999,7 @@ void ieee80211_rts_get(struct ieee80211_hw *hw, struct ieee80211_vif *vif, | |||
| 1766 | /** | 1999 | /** |
| 1767 | * ieee80211_rts_duration - Get the duration field for an RTS frame | 2000 | * ieee80211_rts_duration - Get the duration field for an RTS frame |
| 1768 | * @hw: pointer obtained from ieee80211_alloc_hw(). | 2001 | * @hw: pointer obtained from ieee80211_alloc_hw(). |
| 1769 | * @vif: &struct ieee80211_vif pointer from &struct ieee80211_if_init_conf. | 2002 | * @vif: &struct ieee80211_vif pointer from the add_interface callback. |
| 1770 | * @frame_len: the length of the frame that is going to be protected by the RTS. | 2003 | * @frame_len: the length of the frame that is going to be protected by the RTS. |
| 1771 | * @frame_txctl: &struct ieee80211_tx_info of the frame. | 2004 | * @frame_txctl: &struct ieee80211_tx_info of the frame. |
| 1772 | * | 2005 | * |
| @@ -1781,7 +2014,7 @@ __le16 ieee80211_rts_duration(struct ieee80211_hw *hw, | |||
| 1781 | /** | 2014 | /** |
| 1782 | * ieee80211_ctstoself_get - CTS-to-self frame generation function | 2015 | * ieee80211_ctstoself_get - CTS-to-self frame generation function |
| 1783 | * @hw: pointer obtained from ieee80211_alloc_hw(). | 2016 | * @hw: pointer obtained from ieee80211_alloc_hw(). |
| 1784 | * @vif: &struct ieee80211_vif pointer from &struct ieee80211_if_init_conf. | 2017 | * @vif: &struct ieee80211_vif pointer from the add_interface callback. |
| 1785 | * @frame: pointer to the frame that is going to be protected by the CTS-to-self. | 2018 | * @frame: pointer to the frame that is going to be protected by the CTS-to-self. |
| 1786 | * @frame_len: the frame length (in octets). | 2019 | * @frame_len: the frame length (in octets). |
| 1787 | * @frame_txctl: &struct ieee80211_tx_info of the frame. | 2020 | * @frame_txctl: &struct ieee80211_tx_info of the frame. |
| @@ -1801,7 +2034,7 @@ void ieee80211_ctstoself_get(struct ieee80211_hw *hw, | |||
| 1801 | /** | 2034 | /** |
| 1802 | * ieee80211_ctstoself_duration - Get the duration field for a CTS-to-self frame | 2035 | * ieee80211_ctstoself_duration - Get the duration field for a CTS-to-self frame |
| 1803 | * @hw: pointer obtained from ieee80211_alloc_hw(). | 2036 | * @hw: pointer obtained from ieee80211_alloc_hw(). |
| 1804 | * @vif: &struct ieee80211_vif pointer from &struct ieee80211_if_init_conf. | 2037 | * @vif: &struct ieee80211_vif pointer from the add_interface callback. |
| 1805 | * @frame_len: the length of the frame that is going to be protected by the CTS-to-self. | 2038 | * @frame_len: the length of the frame that is going to be protected by the CTS-to-self. |
| 1806 | * @frame_txctl: &struct ieee80211_tx_info of the frame. | 2039 | * @frame_txctl: &struct ieee80211_tx_info of the frame. |
| 1807 | * | 2040 | * |
| @@ -1817,7 +2050,7 @@ __le16 ieee80211_ctstoself_duration(struct ieee80211_hw *hw, | |||
| 1817 | /** | 2050 | /** |
| 1818 | * ieee80211_generic_frame_duration - Calculate the duration field for a frame | 2051 | * ieee80211_generic_frame_duration - Calculate the duration field for a frame |
| 1819 | * @hw: pointer obtained from ieee80211_alloc_hw(). | 2052 | * @hw: pointer obtained from ieee80211_alloc_hw(). |
| 1820 | * @vif: &struct ieee80211_vif pointer from &struct ieee80211_if_init_conf. | 2053 | * @vif: &struct ieee80211_vif pointer from the add_interface callback. |
| 1821 | * @frame_len: the length of the frame. | 2054 | * @frame_len: the length of the frame. |
| 1822 | * @rate: the rate at which the frame is going to be transmitted. | 2055 | * @rate: the rate at which the frame is going to be transmitted. |
| 1823 | * | 2056 | * |
| @@ -1832,7 +2065,7 @@ __le16 ieee80211_generic_frame_duration(struct ieee80211_hw *hw, | |||
| 1832 | /** | 2065 | /** |
| 1833 | * ieee80211_get_buffered_bc - accessing buffered broadcast and multicast frames | 2066 | * ieee80211_get_buffered_bc - accessing buffered broadcast and multicast frames |
| 1834 | * @hw: pointer as obtained from ieee80211_alloc_hw(). | 2067 | * @hw: pointer as obtained from ieee80211_alloc_hw(). |
| 1835 | * @vif: &struct ieee80211_vif pointer from &struct ieee80211_if_init_conf. | 2068 | * @vif: &struct ieee80211_vif pointer from the add_interface callback. |
| 1836 | * | 2069 | * |
| 1837 | * Function for accessing buffered broadcast and multicast frames. If | 2070 | * Function for accessing buffered broadcast and multicast frames. If |
| 1838 | * hardware/firmware does not implement buffering of broadcast/multicast | 2071 | * hardware/firmware does not implement buffering of broadcast/multicast |
| @@ -1987,8 +2220,7 @@ void ieee80211_queue_delayed_work(struct ieee80211_hw *hw, | |||
| 1987 | 2220 | ||
| 1988 | /** | 2221 | /** |
| 1989 | * ieee80211_start_tx_ba_session - Start a tx Block Ack session. | 2222 | * ieee80211_start_tx_ba_session - Start a tx Block Ack session. |
| 1990 | * @hw: pointer as obtained from ieee80211_alloc_hw(). | 2223 | * @sta: the station for which to start a BA session |
| 1991 | * @ra: receiver address of the BA session recipient | ||
| 1992 | * @tid: the TID to BA on. | 2224 | * @tid: the TID to BA on. |
| 1993 | * | 2225 | * |
| 1994 | * Return: success if addBA request was sent, failure otherwise | 2226 | * Return: success if addBA request was sent, failure otherwise |
| @@ -1997,22 +2229,22 @@ void ieee80211_queue_delayed_work(struct ieee80211_hw *hw, | |||
| 1997 | * the need to start aggregation on a certain RA/TID, the session level | 2229 | * the need to start aggregation on a certain RA/TID, the session level |
| 1998 | * will be managed by the mac80211. | 2230 | * will be managed by the mac80211. |
| 1999 | */ | 2231 | */ |
| 2000 | int ieee80211_start_tx_ba_session(struct ieee80211_hw *hw, u8 *ra, u16 tid); | 2232 | int ieee80211_start_tx_ba_session(struct ieee80211_sta *sta, u16 tid); |
| 2001 | 2233 | ||
| 2002 | /** | 2234 | /** |
| 2003 | * ieee80211_start_tx_ba_cb - low level driver ready to aggregate. | 2235 | * ieee80211_start_tx_ba_cb - low level driver ready to aggregate. |
| 2004 | * @hw: pointer as obtained from ieee80211_alloc_hw(). | 2236 | * @vif: &struct ieee80211_vif pointer from the add_interface callback |
| 2005 | * @ra: receiver address of the BA session recipient. | 2237 | * @ra: receiver address of the BA session recipient. |
| 2006 | * @tid: the TID to BA on. | 2238 | * @tid: the TID to BA on. |
| 2007 | * | 2239 | * |
| 2008 | * This function must be called by low level driver once it has | 2240 | * This function must be called by low level driver once it has |
| 2009 | * finished with preparations for the BA session. | 2241 | * finished with preparations for the BA session. |
| 2010 | */ | 2242 | */ |
| 2011 | void ieee80211_start_tx_ba_cb(struct ieee80211_hw *hw, u8 *ra, u16 tid); | 2243 | void ieee80211_start_tx_ba_cb(struct ieee80211_vif *vif, u8 *ra, u16 tid); |
| 2012 | 2244 | ||
| 2013 | /** | 2245 | /** |
| 2014 | * ieee80211_start_tx_ba_cb_irqsafe - low level driver ready to aggregate. | 2246 | * ieee80211_start_tx_ba_cb_irqsafe - low level driver ready to aggregate. |
| 2015 | * @hw: pointer as obtained from ieee80211_alloc_hw(). | 2247 | * @vif: &struct ieee80211_vif pointer from the add_interface callback |
| 2016 | * @ra: receiver address of the BA session recipient. | 2248 | * @ra: receiver address of the BA session recipient. |
| 2017 | * @tid: the TID to BA on. | 2249 | * @tid: the TID to BA on. |
| 2018 | * | 2250 | * |
| @@ -2020,13 +2252,12 @@ void ieee80211_start_tx_ba_cb(struct ieee80211_hw *hw, u8 *ra, u16 tid); | |||
| 2020 | * finished with preparations for the BA session. | 2252 | * finished with preparations for the BA session. |
| 2021 | * This version of the function is IRQ-safe. | 2253 | * This version of the function is IRQ-safe. |
| 2022 | */ | 2254 | */ |
| 2023 | void ieee80211_start_tx_ba_cb_irqsafe(struct ieee80211_hw *hw, const u8 *ra, | 2255 | void ieee80211_start_tx_ba_cb_irqsafe(struct ieee80211_vif *vif, const u8 *ra, |
| 2024 | u16 tid); | 2256 | u16 tid); |
| 2025 | 2257 | ||
| 2026 | /** | 2258 | /** |
| 2027 | * ieee80211_stop_tx_ba_session - Stop a Block Ack session. | 2259 | * ieee80211_stop_tx_ba_session - Stop a Block Ack session. |
| 2028 | * @hw: pointer as obtained from ieee80211_alloc_hw(). | 2260 | * @sta: the station whose BA session to stop |
| 2029 | * @ra: receiver address of the BA session recipient | ||
| 2030 | * @tid: the TID to stop BA. | 2261 | * @tid: the TID to stop BA. |
| 2031 | * @initiator: if indicates initiator DELBA frame will be sent. | 2262 | * @initiator: if indicates initiator DELBA frame will be sent. |
| 2032 | * | 2263 | * |
| @@ -2036,24 +2267,23 @@ void ieee80211_start_tx_ba_cb_irqsafe(struct ieee80211_hw *hw, const u8 *ra, | |||
| 2036 | * the need to stop aggregation on a certain RA/TID, the session level | 2267 | * the need to stop aggregation on a certain RA/TID, the session level |
| 2037 | * will be managed by the mac80211. | 2268 | * will be managed by the mac80211. |
| 2038 | */ | 2269 | */ |
| 2039 | int ieee80211_stop_tx_ba_session(struct ieee80211_hw *hw, | 2270 | int ieee80211_stop_tx_ba_session(struct ieee80211_sta *sta, u16 tid, |
| 2040 | u8 *ra, u16 tid, | ||
| 2041 | enum ieee80211_back_parties initiator); | 2271 | enum ieee80211_back_parties initiator); |
| 2042 | 2272 | ||
| 2043 | /** | 2273 | /** |
| 2044 | * ieee80211_stop_tx_ba_cb - low level driver ready to stop aggregate. | 2274 | * ieee80211_stop_tx_ba_cb - low level driver ready to stop aggregate. |
| 2045 | * @hw: pointer as obtained from ieee80211_alloc_hw(). | 2275 | * @vif: &struct ieee80211_vif pointer from the add_interface callback |
| 2046 | * @ra: receiver address of the BA session recipient. | 2276 | * @ra: receiver address of the BA session recipient. |
| 2047 | * @tid: the desired TID to BA on. | 2277 | * @tid: the desired TID to BA on. |
| 2048 | * | 2278 | * |
| 2049 | * This function must be called by low level driver once it has | 2279 | * This function must be called by low level driver once it has |
| 2050 | * finished with preparations for the BA session tear down. | 2280 | * finished with preparations for the BA session tear down. |
| 2051 | */ | 2281 | */ |
| 2052 | void ieee80211_stop_tx_ba_cb(struct ieee80211_hw *hw, u8 *ra, u8 tid); | 2282 | void ieee80211_stop_tx_ba_cb(struct ieee80211_vif *vif, u8 *ra, u8 tid); |
| 2053 | 2283 | ||
| 2054 | /** | 2284 | /** |
| 2055 | * ieee80211_stop_tx_ba_cb_irqsafe - low level driver ready to stop aggregate. | 2285 | * ieee80211_stop_tx_ba_cb_irqsafe - low level driver ready to stop aggregate. |
| 2056 | * @hw: pointer as obtained from ieee80211_alloc_hw(). | 2286 | * @vif: &struct ieee80211_vif pointer from the add_interface callback |
| 2057 | * @ra: receiver address of the BA session recipient. | 2287 | * @ra: receiver address of the BA session recipient. |
| 2058 | * @tid: the desired TID to BA on. | 2288 | * @tid: the desired TID to BA on. |
| 2059 | * | 2289 | * |
| @@ -2061,25 +2291,78 @@ void ieee80211_stop_tx_ba_cb(struct ieee80211_hw *hw, u8 *ra, u8 tid); | |||
| 2061 | * finished with preparations for the BA session tear down. | 2291 | * finished with preparations for the BA session tear down. |
| 2062 | * This version of the function is IRQ-safe. | 2292 | * This version of the function is IRQ-safe. |
| 2063 | */ | 2293 | */ |
| 2064 | void ieee80211_stop_tx_ba_cb_irqsafe(struct ieee80211_hw *hw, const u8 *ra, | 2294 | void ieee80211_stop_tx_ba_cb_irqsafe(struct ieee80211_vif *vif, const u8 *ra, |
| 2065 | u16 tid); | 2295 | u16 tid); |
| 2066 | 2296 | ||
| 2067 | /** | 2297 | /** |
| 2068 | * ieee80211_find_sta - find a station | 2298 | * ieee80211_find_sta - find a station |
| 2069 | * | 2299 | * |
| 2070 | * @hw: pointer as obtained from ieee80211_alloc_hw() | 2300 | * @vif: virtual interface to look for station on |
| 2071 | * @addr: station's address | 2301 | * @addr: station's address |
| 2072 | * | 2302 | * |
| 2073 | * This function must be called under RCU lock and the | 2303 | * This function must be called under RCU lock and the |
| 2074 | * resulting pointer is only valid under RCU lock as well. | 2304 | * resulting pointer is only valid under RCU lock as well. |
| 2075 | */ | 2305 | */ |
| 2076 | struct ieee80211_sta *ieee80211_find_sta(struct ieee80211_hw *hw, | 2306 | struct ieee80211_sta *ieee80211_find_sta(struct ieee80211_vif *vif, |
| 2077 | const u8 *addr); | 2307 | const u8 *addr); |
| 2078 | 2308 | ||
| 2079 | /** | 2309 | /** |
| 2310 | * ieee80211_find_sta_by_hw - find a station on hardware | ||
| 2311 | * | ||
| 2312 | * @hw: pointer as obtained from ieee80211_alloc_hw() | ||
| 2313 | * @addr: station's address | ||
| 2314 | * | ||
| 2315 | * This function must be called under RCU lock and the | ||
| 2316 | * resulting pointer is only valid under RCU lock as well. | ||
| 2317 | * | ||
| 2318 | * NOTE: This function should not be used! When mac80211 is converted | ||
| 2319 | * internally to properly keep track of stations on multiple | ||
| 2320 | * virtual interfaces, it will not always know which station to | ||
| 2321 | * return here since a single address might be used by multiple | ||
| 2322 | * logical stations (e.g. consider a station connecting to another | ||
| 2323 | * BSSID on the same AP hardware without disconnecting first). | ||
| 2324 | * | ||
| 2325 | * DO NOT USE THIS FUNCTION. | ||
| 2326 | */ | ||
| 2327 | struct ieee80211_sta *ieee80211_find_sta_by_hw(struct ieee80211_hw *hw, | ||
| 2328 | const u8 *addr); | ||
| 2329 | |||
| 2330 | /** | ||
| 2331 | * ieee80211_sta_block_awake - block station from waking up | ||
| 2332 | * @hw: the hardware | ||
| 2333 | * @pubsta: the station | ||
| 2334 | * @block: whether to block or unblock | ||
| 2335 | * | ||
| 2336 | * Some devices require that all frames that are on the queues | ||
| 2337 | * for a specific station that went to sleep are flushed before | ||
| 2338 | * a poll response or frames after the station woke up can be | ||
| 2339 | * delivered to that it. Note that such frames must be rejected | ||
| 2340 | * by the driver as filtered, with the appropriate status flag. | ||
| 2341 | * | ||
| 2342 | * This function allows implementing this mode in a race-free | ||
| 2343 | * manner. | ||
| 2344 | * | ||
| 2345 | * To do this, a driver must keep track of the number of frames | ||
| 2346 | * still enqueued for a specific station. If this number is not | ||
| 2347 | * zero when the station goes to sleep, the driver must call | ||
| 2348 | * this function to force mac80211 to consider the station to | ||
| 2349 | * be asleep regardless of the station's actual state. Once the | ||
| 2350 | * number of outstanding frames reaches zero, the driver must | ||
| 2351 | * call this function again to unblock the station. That will | ||
| 2352 | * cause mac80211 to be able to send ps-poll responses, and if | ||
| 2353 | * the station queried in the meantime then frames will also | ||
| 2354 | * be sent out as a result of this. Additionally, the driver | ||
| 2355 | * will be notified that the station woke up some time after | ||
| 2356 | * it is unblocked, regardless of whether the station actually | ||
| 2357 | * woke up while blocked or not. | ||
| 2358 | */ | ||
| 2359 | void ieee80211_sta_block_awake(struct ieee80211_hw *hw, | ||
| 2360 | struct ieee80211_sta *pubsta, bool block); | ||
| 2361 | |||
| 2362 | /** | ||
| 2080 | * ieee80211_beacon_loss - inform hardware does not receive beacons | 2363 | * ieee80211_beacon_loss - inform hardware does not receive beacons |
| 2081 | * | 2364 | * |
| 2082 | * @vif: &struct ieee80211_vif pointer from &struct ieee80211_if_init_conf. | 2365 | * @vif: &struct ieee80211_vif pointer from the add_interface callback. |
| 2083 | * | 2366 | * |
| 2084 | * When beacon filtering is enabled with IEEE80211_HW_BEACON_FILTERING and | 2367 | * When beacon filtering is enabled with IEEE80211_HW_BEACON_FILTERING and |
| 2085 | * IEEE80211_CONF_PS is set, the driver needs to inform whenever the | 2368 | * IEEE80211_CONF_PS is set, the driver needs to inform whenever the |
| @@ -2113,8 +2396,12 @@ enum rate_control_changed { | |||
| 2113 | * @short_preamble: whether mac80211 will request short-preamble transmission | 2396 | * @short_preamble: whether mac80211 will request short-preamble transmission |
| 2114 | * if the selected rate supports it | 2397 | * if the selected rate supports it |
| 2115 | * @max_rate_idx: user-requested maximum rate (not MCS for now) | 2398 | * @max_rate_idx: user-requested maximum rate (not MCS for now) |
| 2399 | * (deprecated; this will be removed once drivers get updated to use | ||
| 2400 | * rate_idx_mask) | ||
| 2401 | * @rate_idx_mask: user-requested rate mask (not MCS for now) | ||
| 2116 | * @skb: the skb that will be transmitted, the control information in it needs | 2402 | * @skb: the skb that will be transmitted, the control information in it needs |
| 2117 | * to be filled in | 2403 | * to be filled in |
| 2404 | * @ap: whether this frame is sent out in AP mode | ||
| 2118 | */ | 2405 | */ |
| 2119 | struct ieee80211_tx_rate_control { | 2406 | struct ieee80211_tx_rate_control { |
| 2120 | struct ieee80211_hw *hw; | 2407 | struct ieee80211_hw *hw; |
| @@ -2124,6 +2411,8 @@ struct ieee80211_tx_rate_control { | |||
| 2124 | struct ieee80211_tx_rate reported_rate; | 2411 | struct ieee80211_tx_rate reported_rate; |
| 2125 | bool rts, short_preamble; | 2412 | bool rts, short_preamble; |
| 2126 | u8 max_rate_idx; | 2413 | u8 max_rate_idx; |
| 2414 | u32 rate_idx_mask; | ||
| 2415 | bool ap; | ||
| 2127 | }; | 2416 | }; |
| 2128 | 2417 | ||
| 2129 | struct rate_control_ops { | 2418 | struct rate_control_ops { |
| @@ -2137,7 +2426,8 @@ struct rate_control_ops { | |||
| 2137 | struct ieee80211_sta *sta, void *priv_sta); | 2426 | struct ieee80211_sta *sta, void *priv_sta); |
| 2138 | void (*rate_update)(void *priv, struct ieee80211_supported_band *sband, | 2427 | void (*rate_update)(void *priv, struct ieee80211_supported_band *sband, |
| 2139 | struct ieee80211_sta *sta, | 2428 | struct ieee80211_sta *sta, |
| 2140 | void *priv_sta, u32 changed); | 2429 | void *priv_sta, u32 changed, |
| 2430 | enum nl80211_channel_type oper_chan_type); | ||
| 2141 | void (*free_sta)(void *priv, struct ieee80211_sta *sta, | 2431 | void (*free_sta)(void *priv, struct ieee80211_sta *sta, |
| 2142 | void *priv_sta); | 2432 | void *priv_sta); |
| 2143 | 2433 | ||
diff --git a/include/net/neighbour.h b/include/net/neighbour.h index 3817fda82a80..da1d58be31b7 100644 --- a/include/net/neighbour.h +++ b/include/net/neighbour.h | |||
| @@ -37,8 +37,7 @@ | |||
| 37 | 37 | ||
| 38 | struct neighbour; | 38 | struct neighbour; |
| 39 | 39 | ||
| 40 | struct neigh_parms | 40 | struct neigh_parms { |
| 41 | { | ||
| 42 | #ifdef CONFIG_NET_NS | 41 | #ifdef CONFIG_NET_NS |
| 43 | struct net *net; | 42 | struct net *net; |
| 44 | #endif | 43 | #endif |
| @@ -70,8 +69,7 @@ struct neigh_parms | |||
| 70 | int locktime; | 69 | int locktime; |
| 71 | }; | 70 | }; |
| 72 | 71 | ||
| 73 | struct neigh_statistics | 72 | struct neigh_statistics { |
| 74 | { | ||
| 75 | unsigned long allocs; /* number of allocated neighs */ | 73 | unsigned long allocs; /* number of allocated neighs */ |
| 76 | unsigned long destroys; /* number of destroyed neighs */ | 74 | unsigned long destroys; /* number of destroyed neighs */ |
| 77 | unsigned long hash_grows; /* number of hash resizes */ | 75 | unsigned long hash_grows; /* number of hash resizes */ |
| @@ -90,15 +88,9 @@ struct neigh_statistics | |||
| 90 | unsigned long unres_discards; /* number of unresolved drops */ | 88 | unsigned long unres_discards; /* number of unresolved drops */ |
| 91 | }; | 89 | }; |
| 92 | 90 | ||
| 93 | #define NEIGH_CACHE_STAT_INC(tbl, field) \ | 91 | #define NEIGH_CACHE_STAT_INC(tbl, field) this_cpu_inc((tbl)->stats->field) |
| 94 | do { \ | ||
| 95 | preempt_disable(); \ | ||
| 96 | (per_cpu_ptr((tbl)->stats, smp_processor_id())->field)++; \ | ||
| 97 | preempt_enable(); \ | ||
| 98 | } while (0) | ||
| 99 | 92 | ||
| 100 | struct neighbour | 93 | struct neighbour { |
| 101 | { | ||
| 102 | struct neighbour *next; | 94 | struct neighbour *next; |
| 103 | struct neigh_table *tbl; | 95 | struct neigh_table *tbl; |
| 104 | struct neigh_parms *parms; | 96 | struct neigh_parms *parms; |
| @@ -122,8 +114,7 @@ struct neighbour | |||
| 122 | u8 primary_key[0]; | 114 | u8 primary_key[0]; |
| 123 | }; | 115 | }; |
| 124 | 116 | ||
| 125 | struct neigh_ops | 117 | struct neigh_ops { |
| 126 | { | ||
| 127 | int family; | 118 | int family; |
| 128 | void (*solicit)(struct neighbour *, struct sk_buff*); | 119 | void (*solicit)(struct neighbour *, struct sk_buff*); |
| 129 | void (*error_report)(struct neighbour *, struct sk_buff*); | 120 | void (*error_report)(struct neighbour *, struct sk_buff*); |
| @@ -133,8 +124,7 @@ struct neigh_ops | |||
| 133 | int (*queue_xmit)(struct sk_buff*); | 124 | int (*queue_xmit)(struct sk_buff*); |
| 134 | }; | 125 | }; |
| 135 | 126 | ||
| 136 | struct pneigh_entry | 127 | struct pneigh_entry { |
| 137 | { | ||
| 138 | struct pneigh_entry *next; | 128 | struct pneigh_entry *next; |
| 139 | #ifdef CONFIG_NET_NS | 129 | #ifdef CONFIG_NET_NS |
| 140 | struct net *net; | 130 | struct net *net; |
| @@ -149,8 +139,7 @@ struct pneigh_entry | |||
| 149 | */ | 139 | */ |
| 150 | 140 | ||
| 151 | 141 | ||
| 152 | struct neigh_table | 142 | struct neigh_table { |
| 153 | { | ||
| 154 | struct neigh_table *next; | 143 | struct neigh_table *next; |
| 155 | int family; | 144 | int family; |
| 156 | int entry_size; | 145 | int entry_size; |
| @@ -175,7 +164,7 @@ struct neigh_table | |||
| 175 | rwlock_t lock; | 164 | rwlock_t lock; |
| 176 | unsigned long last_rand; | 165 | unsigned long last_rand; |
| 177 | struct kmem_cache *kmem_cachep; | 166 | struct kmem_cache *kmem_cachep; |
| 178 | struct neigh_statistics *stats; | 167 | struct neigh_statistics __percpu *stats; |
| 179 | struct neighbour **hash_buckets; | 168 | struct neighbour **hash_buckets; |
| 180 | unsigned int hash_mask; | 169 | unsigned int hash_mask; |
| 181 | __u32 hash_rnd; | 170 | __u32 hash_rnd; |
| @@ -262,10 +251,8 @@ extern void neigh_seq_stop(struct seq_file *, void *); | |||
| 262 | 251 | ||
| 263 | extern int neigh_sysctl_register(struct net_device *dev, | 252 | extern int neigh_sysctl_register(struct net_device *dev, |
| 264 | struct neigh_parms *p, | 253 | struct neigh_parms *p, |
| 265 | int p_id, int pdev_id, | ||
| 266 | char *p_name, | 254 | char *p_name, |
| 267 | proc_handler *proc_handler, | 255 | proc_handler *proc_handler); |
| 268 | ctl_handler *strategy); | ||
| 269 | extern void neigh_sysctl_unregister(struct neigh_parms *p); | 256 | extern void neigh_sysctl_unregister(struct neigh_parms *p); |
| 270 | 257 | ||
| 271 | static inline void __neigh_parms_put(struct neigh_parms *parms) | 258 | static inline void __neigh_parms_put(struct neigh_parms *parms) |
diff --git a/include/net/net_namespace.h b/include/net/net_namespace.h index a1202841aadd..bd10a7908993 100644 --- a/include/net/net_namespace.h +++ b/include/net/net_namespace.h | |||
| @@ -28,6 +28,10 @@ struct ctl_table_header; | |||
| 28 | struct net_generic; | 28 | struct net_generic; |
| 29 | struct sock; | 29 | struct sock; |
| 30 | 30 | ||
| 31 | |||
| 32 | #define NETDEV_HASHBITS 8 | ||
| 33 | #define NETDEV_HASHENTRIES (1 << NETDEV_HASHBITS) | ||
| 34 | |||
| 31 | struct net { | 35 | struct net { |
| 32 | atomic_t count; /* To decided when the network | 36 | atomic_t count; /* To decided when the network |
| 33 | * namespace should be freed. | 37 | * namespace should be freed. |
| @@ -38,7 +42,8 @@ struct net { | |||
| 38 | */ | 42 | */ |
| 39 | #endif | 43 | #endif |
| 40 | struct list_head list; /* list of network namespaces */ | 44 | struct list_head list; /* list of network namespaces */ |
| 41 | struct work_struct work; /* work struct for freeing */ | 45 | struct list_head cleanup_list; /* namespaces on death row */ |
| 46 | struct list_head exit_list; /* Use only net_mutex */ | ||
| 42 | 47 | ||
| 43 | struct proc_dir_entry *proc_net; | 48 | struct proc_dir_entry *proc_net; |
| 44 | struct proc_dir_entry *proc_net_stat; | 49 | struct proc_dir_entry *proc_net_stat; |
| @@ -76,11 +81,13 @@ struct net { | |||
| 76 | #if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE) | 81 | #if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE) |
| 77 | struct netns_ct ct; | 82 | struct netns_ct ct; |
| 78 | #endif | 83 | #endif |
| 84 | struct sock *nfnl; | ||
| 85 | struct sock *nfnl_stash; | ||
| 79 | #endif | 86 | #endif |
| 80 | #ifdef CONFIG_XFRM | 87 | #ifdef CONFIG_XFRM |
| 81 | struct netns_xfrm xfrm; | 88 | struct netns_xfrm xfrm; |
| 82 | #endif | 89 | #endif |
| 83 | #ifdef CONFIG_WIRELESS_EXT | 90 | #ifdef CONFIG_WEXT_CORE |
| 84 | struct sk_buff_head wext_nlevents; | 91 | struct sk_buff_head wext_nlevents; |
| 85 | #endif | 92 | #endif |
| 86 | struct net_generic *gen; | 93 | struct net_generic *gen; |
| @@ -93,14 +100,9 @@ struct net { | |||
| 93 | extern struct net init_net; | 100 | extern struct net init_net; |
| 94 | 101 | ||
| 95 | #ifdef CONFIG_NET | 102 | #ifdef CONFIG_NET |
| 96 | #define INIT_NET_NS(net_ns) .net_ns = &init_net, | ||
| 97 | |||
| 98 | extern struct net *copy_net_ns(unsigned long flags, struct net *net_ns); | 103 | extern struct net *copy_net_ns(unsigned long flags, struct net *net_ns); |
| 99 | 104 | ||
| 100 | #else /* CONFIG_NET */ | 105 | #else /* CONFIG_NET */ |
| 101 | |||
| 102 | #define INIT_NET_NS(net_ns) | ||
| 103 | |||
| 104 | static inline struct net *copy_net_ns(unsigned long flags, struct net *net_ns) | 106 | static inline struct net *copy_net_ns(unsigned long flags, struct net *net_ns) |
| 105 | { | 107 | { |
| 106 | /* There is nothing to copy so this is a noop */ | 108 | /* There is nothing to copy so this is a noop */ |
| @@ -232,6 +234,9 @@ struct pernet_operations { | |||
| 232 | struct list_head list; | 234 | struct list_head list; |
| 233 | int (*init)(struct net *net); | 235 | int (*init)(struct net *net); |
| 234 | void (*exit)(struct net *net); | 236 | void (*exit)(struct net *net); |
| 237 | void (*exit_batch)(struct list_head *net_exit_list); | ||
| 238 | int *id; | ||
| 239 | size_t size; | ||
| 235 | }; | 240 | }; |
| 236 | 241 | ||
| 237 | /* | 242 | /* |
| @@ -255,12 +260,8 @@ struct pernet_operations { | |||
| 255 | */ | 260 | */ |
| 256 | extern int register_pernet_subsys(struct pernet_operations *); | 261 | extern int register_pernet_subsys(struct pernet_operations *); |
| 257 | extern void unregister_pernet_subsys(struct pernet_operations *); | 262 | extern void unregister_pernet_subsys(struct pernet_operations *); |
| 258 | extern int register_pernet_gen_subsys(int *id, struct pernet_operations *); | ||
| 259 | extern void unregister_pernet_gen_subsys(int id, struct pernet_operations *); | ||
| 260 | extern int register_pernet_device(struct pernet_operations *); | 263 | extern int register_pernet_device(struct pernet_operations *); |
| 261 | extern void unregister_pernet_device(struct pernet_operations *); | 264 | extern void unregister_pernet_device(struct pernet_operations *); |
| 262 | extern int register_pernet_gen_device(int *id, struct pernet_operations *); | ||
| 263 | extern void unregister_pernet_gen_device(int id, struct pernet_operations *); | ||
| 264 | 265 | ||
| 265 | struct ctl_path; | 266 | struct ctl_path; |
| 266 | struct ctl_table; | 267 | struct ctl_table; |
diff --git a/include/net/netfilter/ipv6/nf_conntrack_ipv6.h b/include/net/netfilter/ipv6/nf_conntrack_ipv6.h index abc55ad75c2b..1ee717eb5b09 100644 --- a/include/net/netfilter/ipv6/nf_conntrack_ipv6.h +++ b/include/net/netfilter/ipv6/nf_conntrack_ipv6.h | |||
| @@ -9,7 +9,7 @@ extern struct nf_conntrack_l4proto nf_conntrack_l4proto_icmpv6; | |||
| 9 | 9 | ||
| 10 | extern int nf_ct_frag6_init(void); | 10 | extern int nf_ct_frag6_init(void); |
| 11 | extern void nf_ct_frag6_cleanup(void); | 11 | extern void nf_ct_frag6_cleanup(void); |
| 12 | extern struct sk_buff *nf_ct_frag6_gather(struct sk_buff *skb); | 12 | extern struct sk_buff *nf_ct_frag6_gather(struct sk_buff *skb, u32 user); |
| 13 | extern void nf_ct_frag6_output(unsigned int hooknum, struct sk_buff *skb, | 13 | extern void nf_ct_frag6_output(unsigned int hooknum, struct sk_buff *skb, |
| 14 | struct net_device *in, | 14 | struct net_device *in, |
| 15 | struct net_device *out, | 15 | struct net_device *out, |
diff --git a/include/net/netfilter/nf_conntrack.h b/include/net/netfilter/nf_conntrack.h index 5cf7270e3ffc..bde095f7e845 100644 --- a/include/net/netfilter/nf_conntrack.h +++ b/include/net/netfilter/nf_conntrack.h | |||
| @@ -70,7 +70,7 @@ union nf_conntrack_help { | |||
| 70 | struct nf_conntrack_helper; | 70 | struct nf_conntrack_helper; |
| 71 | 71 | ||
| 72 | /* Must be kept in sync with the classes defined by helpers */ | 72 | /* Must be kept in sync with the classes defined by helpers */ |
| 73 | #define NF_CT_MAX_EXPECT_CLASSES 3 | 73 | #define NF_CT_MAX_EXPECT_CLASSES 4 |
| 74 | 74 | ||
| 75 | /* nf_conn feature for connections that have a helper */ | 75 | /* nf_conn feature for connections that have a helper */ |
| 76 | struct nf_conn_help { | 76 | struct nf_conn_help { |
| @@ -198,7 +198,8 @@ extern void *nf_ct_alloc_hashtable(unsigned int *sizep, int *vmalloced, int null | |||
| 198 | extern void nf_ct_free_hashtable(void *hash, int vmalloced, unsigned int size); | 198 | extern void nf_ct_free_hashtable(void *hash, int vmalloced, unsigned int size); |
| 199 | 199 | ||
| 200 | extern struct nf_conntrack_tuple_hash * | 200 | extern struct nf_conntrack_tuple_hash * |
| 201 | __nf_conntrack_find(struct net *net, const struct nf_conntrack_tuple *tuple); | 201 | __nf_conntrack_find(struct net *net, u16 zone, |
| 202 | const struct nf_conntrack_tuple *tuple); | ||
| 202 | 203 | ||
| 203 | extern void nf_conntrack_hash_insert(struct nf_conn *ct); | 204 | extern void nf_conntrack_hash_insert(struct nf_conn *ct); |
| 204 | extern void nf_ct_delete_from_lists(struct nf_conn *ct); | 205 | extern void nf_ct_delete_from_lists(struct nf_conn *ct); |
| @@ -267,11 +268,16 @@ extern void | |||
| 267 | nf_ct_iterate_cleanup(struct net *net, int (*iter)(struct nf_conn *i, void *data), void *data); | 268 | nf_ct_iterate_cleanup(struct net *net, int (*iter)(struct nf_conn *i, void *data), void *data); |
| 268 | extern void nf_conntrack_free(struct nf_conn *ct); | 269 | extern void nf_conntrack_free(struct nf_conn *ct); |
| 269 | extern struct nf_conn * | 270 | extern struct nf_conn * |
| 270 | nf_conntrack_alloc(struct net *net, | 271 | nf_conntrack_alloc(struct net *net, u16 zone, |
| 271 | const struct nf_conntrack_tuple *orig, | 272 | const struct nf_conntrack_tuple *orig, |
| 272 | const struct nf_conntrack_tuple *repl, | 273 | const struct nf_conntrack_tuple *repl, |
| 273 | gfp_t gfp); | 274 | gfp_t gfp); |
| 274 | 275 | ||
| 276 | static inline int nf_ct_is_template(const struct nf_conn *ct) | ||
| 277 | { | ||
| 278 | return test_bit(IPS_TEMPLATE_BIT, &ct->status); | ||
| 279 | } | ||
| 280 | |||
| 275 | /* It's confirmed if it is, or has been in the hash table. */ | 281 | /* It's confirmed if it is, or has been in the hash table. */ |
| 276 | static inline int nf_ct_is_confirmed(struct nf_conn *ct) | 282 | static inline int nf_ct_is_confirmed(struct nf_conn *ct) |
| 277 | { | 283 | { |
| @@ -293,11 +299,11 @@ extern unsigned int nf_conntrack_htable_size; | |||
| 293 | extern unsigned int nf_conntrack_max; | 299 | extern unsigned int nf_conntrack_max; |
| 294 | 300 | ||
| 295 | #define NF_CT_STAT_INC(net, count) \ | 301 | #define NF_CT_STAT_INC(net, count) \ |
| 296 | (per_cpu_ptr((net)->ct.stat, raw_smp_processor_id())->count++) | 302 | __this_cpu_inc((net)->ct.stat->count) |
| 297 | #define NF_CT_STAT_INC_ATOMIC(net, count) \ | 303 | #define NF_CT_STAT_INC_ATOMIC(net, count) \ |
| 298 | do { \ | 304 | do { \ |
| 299 | local_bh_disable(); \ | 305 | local_bh_disable(); \ |
| 300 | per_cpu_ptr((net)->ct.stat, raw_smp_processor_id())->count++; \ | 306 | __this_cpu_inc((net)->ct.stat->count); \ |
| 301 | local_bh_enable(); \ | 307 | local_bh_enable(); \ |
| 302 | } while (0) | 308 | } while (0) |
| 303 | 309 | ||
diff --git a/include/net/netfilter/nf_conntrack_core.h b/include/net/netfilter/nf_conntrack_core.h index 5a449b44ba33..dffde8e6920e 100644 --- a/include/net/netfilter/nf_conntrack_core.h +++ b/include/net/netfilter/nf_conntrack_core.h | |||
| @@ -49,7 +49,8 @@ nf_ct_invert_tuple(struct nf_conntrack_tuple *inverse, | |||
| 49 | 49 | ||
| 50 | /* Find a connection corresponding to a tuple. */ | 50 | /* Find a connection corresponding to a tuple. */ |
| 51 | extern struct nf_conntrack_tuple_hash * | 51 | extern struct nf_conntrack_tuple_hash * |
| 52 | nf_conntrack_find_get(struct net *net, const struct nf_conntrack_tuple *tuple); | 52 | nf_conntrack_find_get(struct net *net, u16 zone, |
| 53 | const struct nf_conntrack_tuple *tuple); | ||
| 53 | 54 | ||
| 54 | extern int __nf_conntrack_confirm(struct sk_buff *skb); | 55 | extern int __nf_conntrack_confirm(struct sk_buff *skb); |
| 55 | 56 | ||
diff --git a/include/net/netfilter/nf_conntrack_ecache.h b/include/net/netfilter/nf_conntrack_ecache.h index 4f20d58e2ab7..96ba5f7dcab6 100644 --- a/include/net/netfilter/nf_conntrack_ecache.h +++ b/include/net/netfilter/nf_conntrack_ecache.h | |||
| @@ -12,28 +12,12 @@ | |||
| 12 | #include <linux/netfilter/nf_conntrack_tuple_common.h> | 12 | #include <linux/netfilter/nf_conntrack_tuple_common.h> |
| 13 | #include <net/netfilter/nf_conntrack_extend.h> | 13 | #include <net/netfilter/nf_conntrack_extend.h> |
| 14 | 14 | ||
| 15 | /* Connection tracking event types */ | ||
| 16 | enum ip_conntrack_events | ||
| 17 | { | ||
| 18 | IPCT_NEW = 0, /* new conntrack */ | ||
| 19 | IPCT_RELATED = 1, /* related conntrack */ | ||
| 20 | IPCT_DESTROY = 2, /* destroyed conntrack */ | ||
| 21 | IPCT_STATUS = 3, /* status has changed */ | ||
| 22 | IPCT_PROTOINFO = 4, /* protocol information has changed */ | ||
| 23 | IPCT_HELPER = 5, /* new helper has been set */ | ||
| 24 | IPCT_MARK = 6, /* new mark has been set */ | ||
| 25 | IPCT_NATSEQADJ = 7, /* NAT is doing sequence adjustment */ | ||
| 26 | IPCT_SECMARK = 8, /* new security mark has been set */ | ||
| 27 | }; | ||
| 28 | |||
| 29 | enum ip_conntrack_expect_events { | ||
| 30 | IPEXP_NEW = 0, /* new expectation */ | ||
| 31 | }; | ||
| 32 | |||
| 33 | struct nf_conntrack_ecache { | 15 | struct nf_conntrack_ecache { |
| 34 | unsigned long cache; /* bitops want long */ | 16 | unsigned long cache; /* bitops want long */ |
| 35 | unsigned long missed; /* missed events */ | 17 | unsigned long missed; /* missed events */ |
| 36 | u32 pid; /* netlink pid of destroyer */ | 18 | u16 ctmask; /* bitmask of ct events to be delivered */ |
| 19 | u16 expmask; /* bitmask of expect events to be delivered */ | ||
| 20 | u32 pid; /* netlink pid of destroyer */ | ||
| 37 | }; | 21 | }; |
| 38 | 22 | ||
| 39 | static inline struct nf_conntrack_ecache * | 23 | static inline struct nf_conntrack_ecache * |
| @@ -43,14 +27,24 @@ nf_ct_ecache_find(const struct nf_conn *ct) | |||
| 43 | } | 27 | } |
| 44 | 28 | ||
| 45 | static inline struct nf_conntrack_ecache * | 29 | static inline struct nf_conntrack_ecache * |
| 46 | nf_ct_ecache_ext_add(struct nf_conn *ct, gfp_t gfp) | 30 | nf_ct_ecache_ext_add(struct nf_conn *ct, u16 ctmask, u16 expmask, gfp_t gfp) |
| 47 | { | 31 | { |
| 48 | struct net *net = nf_ct_net(ct); | 32 | struct net *net = nf_ct_net(ct); |
| 33 | struct nf_conntrack_ecache *e; | ||
| 49 | 34 | ||
| 50 | if (!net->ct.sysctl_events) | 35 | if (!ctmask && !expmask && net->ct.sysctl_events) { |
| 36 | ctmask = ~0; | ||
| 37 | expmask = ~0; | ||
| 38 | } | ||
| 39 | if (!ctmask && !expmask) | ||
| 51 | return NULL; | 40 | return NULL; |
| 52 | 41 | ||
| 53 | return nf_ct_ext_add(ct, NF_CT_EXT_ECACHE, gfp); | 42 | e = nf_ct_ext_add(ct, NF_CT_EXT_ECACHE, gfp); |
| 43 | if (e) { | ||
| 44 | e->ctmask = ctmask; | ||
| 45 | e->expmask = expmask; | ||
| 46 | } | ||
| 47 | return e; | ||
| 54 | }; | 48 | }; |
| 55 | 49 | ||
| 56 | #ifdef CONFIG_NF_CONNTRACK_EVENTS | 50 | #ifdef CONFIG_NF_CONNTRACK_EVENTS |
| @@ -83,6 +77,9 @@ nf_conntrack_event_cache(enum ip_conntrack_events event, struct nf_conn *ct) | |||
| 83 | if (e == NULL) | 77 | if (e == NULL) |
| 84 | return; | 78 | return; |
| 85 | 79 | ||
| 80 | if (!(e->ctmask & (1 << event))) | ||
| 81 | return; | ||
| 82 | |||
| 86 | set_bit(event, &e->cache); | 83 | set_bit(event, &e->cache); |
| 87 | } | 84 | } |
| 88 | 85 | ||
| @@ -93,7 +90,6 @@ nf_conntrack_eventmask_report(unsigned int eventmask, | |||
| 93 | int report) | 90 | int report) |
| 94 | { | 91 | { |
| 95 | int ret = 0; | 92 | int ret = 0; |
| 96 | struct net *net = nf_ct_net(ct); | ||
| 97 | struct nf_ct_event_notifier *notify; | 93 | struct nf_ct_event_notifier *notify; |
| 98 | struct nf_conntrack_ecache *e; | 94 | struct nf_conntrack_ecache *e; |
| 99 | 95 | ||
| @@ -102,9 +98,6 @@ nf_conntrack_eventmask_report(unsigned int eventmask, | |||
| 102 | if (notify == NULL) | 98 | if (notify == NULL) |
| 103 | goto out_unlock; | 99 | goto out_unlock; |
| 104 | 100 | ||
| 105 | if (!net->ct.sysctl_events) | ||
| 106 | goto out_unlock; | ||
| 107 | |||
| 108 | e = nf_ct_ecache_find(ct); | 101 | e = nf_ct_ecache_find(ct); |
| 109 | if (e == NULL) | 102 | if (e == NULL) |
| 110 | goto out_unlock; | 103 | goto out_unlock; |
| @@ -118,6 +111,9 @@ nf_conntrack_eventmask_report(unsigned int eventmask, | |||
| 118 | /* This is a resent of a destroy event? If so, skip missed */ | 111 | /* This is a resent of a destroy event? If so, skip missed */ |
| 119 | unsigned long missed = e->pid ? 0 : e->missed; | 112 | unsigned long missed = e->pid ? 0 : e->missed; |
| 120 | 113 | ||
| 114 | if (!((eventmask | missed) & e->ctmask)) | ||
| 115 | goto out_unlock; | ||
| 116 | |||
| 121 | ret = notify->fcn(eventmask | missed, &item); | 117 | ret = notify->fcn(eventmask | missed, &item); |
| 122 | if (unlikely(ret < 0 || missed)) { | 118 | if (unlikely(ret < 0 || missed)) { |
| 123 | spin_lock_bh(&ct->lock); | 119 | spin_lock_bh(&ct->lock); |
| @@ -173,18 +169,19 @@ nf_ct_expect_event_report(enum ip_conntrack_expect_events event, | |||
| 173 | u32 pid, | 169 | u32 pid, |
| 174 | int report) | 170 | int report) |
| 175 | { | 171 | { |
| 176 | struct net *net = nf_ct_exp_net(exp); | ||
| 177 | struct nf_exp_event_notifier *notify; | 172 | struct nf_exp_event_notifier *notify; |
| 173 | struct nf_conntrack_ecache *e; | ||
| 178 | 174 | ||
| 179 | rcu_read_lock(); | 175 | rcu_read_lock(); |
| 180 | notify = rcu_dereference(nf_expect_event_cb); | 176 | notify = rcu_dereference(nf_expect_event_cb); |
| 181 | if (notify == NULL) | 177 | if (notify == NULL) |
| 182 | goto out_unlock; | 178 | goto out_unlock; |
| 183 | 179 | ||
| 184 | if (!net->ct.sysctl_events) | 180 | e = nf_ct_ecache_find(exp->master); |
| 181 | if (e == NULL) | ||
| 185 | goto out_unlock; | 182 | goto out_unlock; |
| 186 | 183 | ||
| 187 | { | 184 | if (e->expmask & (1 << event)) { |
| 188 | struct nf_exp_event item = { | 185 | struct nf_exp_event item = { |
| 189 | .exp = exp, | 186 | .exp = exp, |
| 190 | .pid = pid, | 187 | .pid = pid, |
diff --git a/include/net/netfilter/nf_conntrack_expect.h b/include/net/netfilter/nf_conntrack_expect.h index a9652806d0df..11e815084fcf 100644 --- a/include/net/netfilter/nf_conntrack_expect.h +++ b/include/net/netfilter/nf_conntrack_expect.h | |||
| @@ -9,8 +9,7 @@ | |||
| 9 | extern unsigned int nf_ct_expect_hsize; | 9 | extern unsigned int nf_ct_expect_hsize; |
| 10 | extern unsigned int nf_ct_expect_max; | 10 | extern unsigned int nf_ct_expect_max; |
| 11 | 11 | ||
| 12 | struct nf_conntrack_expect | 12 | struct nf_conntrack_expect { |
| 13 | { | ||
| 14 | /* Conntrack expectation list member */ | 13 | /* Conntrack expectation list member */ |
| 15 | struct hlist_node lnode; | 14 | struct hlist_node lnode; |
| 16 | 15 | ||
| @@ -57,17 +56,13 @@ struct nf_conntrack_expect | |||
| 57 | 56 | ||
| 58 | static inline struct net *nf_ct_exp_net(struct nf_conntrack_expect *exp) | 57 | static inline struct net *nf_ct_exp_net(struct nf_conntrack_expect *exp) |
| 59 | { | 58 | { |
| 60 | #ifdef CONFIG_NET_NS | 59 | return nf_ct_net(exp->master); |
| 61 | return exp->master->ct_net; /* by definition */ | ||
| 62 | #else | ||
| 63 | return &init_net; | ||
| 64 | #endif | ||
| 65 | } | 60 | } |
| 66 | 61 | ||
| 67 | struct nf_conntrack_expect_policy | 62 | struct nf_conntrack_expect_policy { |
| 68 | { | ||
| 69 | unsigned int max_expected; | 63 | unsigned int max_expected; |
| 70 | unsigned int timeout; | 64 | unsigned int timeout; |
| 65 | const char *name; | ||
| 71 | }; | 66 | }; |
| 72 | 67 | ||
| 73 | #define NF_CT_EXPECT_CLASS_DEFAULT 0 | 68 | #define NF_CT_EXPECT_CLASS_DEFAULT 0 |
| @@ -79,13 +74,16 @@ int nf_conntrack_expect_init(struct net *net); | |||
| 79 | void nf_conntrack_expect_fini(struct net *net); | 74 | void nf_conntrack_expect_fini(struct net *net); |
| 80 | 75 | ||
| 81 | struct nf_conntrack_expect * | 76 | struct nf_conntrack_expect * |
| 82 | __nf_ct_expect_find(struct net *net, const struct nf_conntrack_tuple *tuple); | 77 | __nf_ct_expect_find(struct net *net, u16 zone, |
| 78 | const struct nf_conntrack_tuple *tuple); | ||
| 83 | 79 | ||
| 84 | struct nf_conntrack_expect * | 80 | struct nf_conntrack_expect * |
| 85 | nf_ct_expect_find_get(struct net *net, const struct nf_conntrack_tuple *tuple); | 81 | nf_ct_expect_find_get(struct net *net, u16 zone, |
| 82 | const struct nf_conntrack_tuple *tuple); | ||
| 86 | 83 | ||
| 87 | struct nf_conntrack_expect * | 84 | struct nf_conntrack_expect * |
| 88 | nf_ct_find_expectation(struct net *net, const struct nf_conntrack_tuple *tuple); | 85 | nf_ct_find_expectation(struct net *net, u16 zone, |
| 86 | const struct nf_conntrack_tuple *tuple); | ||
| 89 | 87 | ||
| 90 | void nf_ct_unlink_expect(struct nf_conntrack_expect *exp); | 88 | void nf_ct_unlink_expect(struct nf_conntrack_expect *exp); |
| 91 | void nf_ct_remove_expectations(struct nf_conn *ct); | 89 | void nf_ct_remove_expectations(struct nf_conn *ct); |
diff --git a/include/net/netfilter/nf_conntrack_extend.h b/include/net/netfilter/nf_conntrack_extend.h index 7f8fc5d123c5..32d15bd6efa3 100644 --- a/include/net/netfilter/nf_conntrack_extend.h +++ b/include/net/netfilter/nf_conntrack_extend.h | |||
| @@ -1,14 +1,16 @@ | |||
| 1 | #ifndef _NF_CONNTRACK_EXTEND_H | 1 | #ifndef _NF_CONNTRACK_EXTEND_H |
| 2 | #define _NF_CONNTRACK_EXTEND_H | 2 | #define _NF_CONNTRACK_EXTEND_H |
| 3 | 3 | ||
| 4 | #include <linux/slab.h> | ||
| 5 | |||
| 4 | #include <net/netfilter/nf_conntrack.h> | 6 | #include <net/netfilter/nf_conntrack.h> |
| 5 | 7 | ||
| 6 | enum nf_ct_ext_id | 8 | enum nf_ct_ext_id { |
| 7 | { | ||
| 8 | NF_CT_EXT_HELPER, | 9 | NF_CT_EXT_HELPER, |
| 9 | NF_CT_EXT_NAT, | 10 | NF_CT_EXT_NAT, |
| 10 | NF_CT_EXT_ACCT, | 11 | NF_CT_EXT_ACCT, |
| 11 | NF_CT_EXT_ECACHE, | 12 | NF_CT_EXT_ECACHE, |
| 13 | NF_CT_EXT_ZONE, | ||
| 12 | NF_CT_EXT_NUM, | 14 | NF_CT_EXT_NUM, |
| 13 | }; | 15 | }; |
| 14 | 16 | ||
| @@ -16,6 +18,7 @@ enum nf_ct_ext_id | |||
| 16 | #define NF_CT_EXT_NAT_TYPE struct nf_conn_nat | 18 | #define NF_CT_EXT_NAT_TYPE struct nf_conn_nat |
| 17 | #define NF_CT_EXT_ACCT_TYPE struct nf_conn_counter | 19 | #define NF_CT_EXT_ACCT_TYPE struct nf_conn_counter |
| 18 | #define NF_CT_EXT_ECACHE_TYPE struct nf_conntrack_ecache | 20 | #define NF_CT_EXT_ECACHE_TYPE struct nf_conntrack_ecache |
| 21 | #define NF_CT_EXT_ZONE_TYPE struct nf_conntrack_zone | ||
| 19 | 22 | ||
| 20 | /* Extensions: optional stuff which isn't permanently in struct. */ | 23 | /* Extensions: optional stuff which isn't permanently in struct. */ |
| 21 | struct nf_ct_ext { | 24 | struct nf_ct_ext { |
| @@ -65,8 +68,7 @@ __nf_ct_ext_add(struct nf_conn *ct, enum nf_ct_ext_id id, gfp_t gfp); | |||
| 65 | 68 | ||
| 66 | #define NF_CT_EXT_F_PREALLOC 0x0001 | 69 | #define NF_CT_EXT_F_PREALLOC 0x0001 |
| 67 | 70 | ||
| 68 | struct nf_ct_ext_type | 71 | struct nf_ct_ext_type { |
| 69 | { | ||
| 70 | /* Destroys relationships (can be NULL). */ | 72 | /* Destroys relationships (can be NULL). */ |
| 71 | void (*destroy)(struct nf_conn *ct); | 73 | void (*destroy)(struct nf_conn *ct); |
| 72 | /* Called when realloacted (can be NULL). | 74 | /* Called when realloacted (can be NULL). |
diff --git a/include/net/netfilter/nf_conntrack_helper.h b/include/net/netfilter/nf_conntrack_helper.h index 1b7068000927..32c305dbdab6 100644 --- a/include/net/netfilter/nf_conntrack_helper.h +++ b/include/net/netfilter/nf_conntrack_helper.h | |||
| @@ -16,8 +16,7 @@ struct module; | |||
| 16 | 16 | ||
| 17 | #define NF_CT_HELPER_NAME_LEN 16 | 17 | #define NF_CT_HELPER_NAME_LEN 16 |
| 18 | 18 | ||
| 19 | struct nf_conntrack_helper | 19 | struct nf_conntrack_helper { |
| 20 | { | ||
| 21 | struct hlist_node hnode; /* Internal use. */ | 20 | struct hlist_node hnode; /* Internal use. */ |
| 22 | 21 | ||
| 23 | const char *name; /* name of the module */ | 22 | const char *name; /* name of the module */ |
| @@ -41,14 +40,18 @@ struct nf_conntrack_helper | |||
| 41 | }; | 40 | }; |
| 42 | 41 | ||
| 43 | extern struct nf_conntrack_helper * | 42 | extern struct nf_conntrack_helper * |
| 44 | __nf_conntrack_helper_find_byname(const char *name); | 43 | __nf_conntrack_helper_find(const char *name, u16 l3num, u8 protonum); |
| 44 | |||
| 45 | extern struct nf_conntrack_helper * | ||
| 46 | nf_conntrack_helper_try_module_get(const char *name, u16 l3num, u8 protonum); | ||
| 45 | 47 | ||
| 46 | extern int nf_conntrack_helper_register(struct nf_conntrack_helper *); | 48 | extern int nf_conntrack_helper_register(struct nf_conntrack_helper *); |
| 47 | extern void nf_conntrack_helper_unregister(struct nf_conntrack_helper *); | 49 | extern void nf_conntrack_helper_unregister(struct nf_conntrack_helper *); |
| 48 | 50 | ||
| 49 | extern struct nf_conn_help *nf_ct_helper_ext_add(struct nf_conn *ct, gfp_t gfp); | 51 | extern struct nf_conn_help *nf_ct_helper_ext_add(struct nf_conn *ct, gfp_t gfp); |
| 50 | 52 | ||
| 51 | extern int __nf_ct_try_assign_helper(struct nf_conn *ct, gfp_t flags); | 53 | extern int __nf_ct_try_assign_helper(struct nf_conn *ct, struct nf_conn *tmpl, |
| 54 | gfp_t flags); | ||
| 52 | 55 | ||
| 53 | extern void nf_ct_helper_destroy(struct nf_conn *ct); | 56 | extern void nf_ct_helper_destroy(struct nf_conn *ct); |
| 54 | 57 | ||
diff --git a/include/net/netfilter/nf_conntrack_l3proto.h b/include/net/netfilter/nf_conntrack_l3proto.h index 9f99d36d5de9..a7547611e8f1 100644 --- a/include/net/netfilter/nf_conntrack_l3proto.h +++ b/include/net/netfilter/nf_conntrack_l3proto.h | |||
| @@ -16,8 +16,7 @@ | |||
| 16 | #include <linux/seq_file.h> | 16 | #include <linux/seq_file.h> |
| 17 | #include <net/netfilter/nf_conntrack.h> | 17 | #include <net/netfilter/nf_conntrack.h> |
| 18 | 18 | ||
| 19 | struct nf_conntrack_l3proto | 19 | struct nf_conntrack_l3proto { |
| 20 | { | ||
| 21 | /* L3 Protocol Family number. ex) PF_INET */ | 20 | /* L3 Protocol Family number. ex) PF_INET */ |
| 22 | u_int16_t l3proto; | 21 | u_int16_t l3proto; |
| 23 | 22 | ||
diff --git a/include/net/netfilter/nf_conntrack_l4proto.h b/include/net/netfilter/nf_conntrack_l4proto.h index 3767fb41e541..e3d3ee3c06a2 100644 --- a/include/net/netfilter/nf_conntrack_l4proto.h +++ b/include/net/netfilter/nf_conntrack_l4proto.h | |||
| @@ -15,8 +15,7 @@ | |||
| 15 | 15 | ||
| 16 | struct seq_file; | 16 | struct seq_file; |
| 17 | 17 | ||
| 18 | struct nf_conntrack_l4proto | 18 | struct nf_conntrack_l4proto { |
| 19 | { | ||
| 20 | /* L3 Protocol number. */ | 19 | /* L3 Protocol number. */ |
| 21 | u_int16_t l3proto; | 20 | u_int16_t l3proto; |
| 22 | 21 | ||
| @@ -50,8 +49,8 @@ struct nf_conntrack_l4proto | |||
| 50 | /* Called when a conntrack entry is destroyed */ | 49 | /* Called when a conntrack entry is destroyed */ |
| 51 | void (*destroy)(struct nf_conn *ct); | 50 | void (*destroy)(struct nf_conn *ct); |
| 52 | 51 | ||
| 53 | int (*error)(struct net *net, struct sk_buff *skb, unsigned int dataoff, | 52 | int (*error)(struct net *net, struct nf_conn *tmpl, struct sk_buff *skb, |
| 54 | enum ip_conntrack_info *ctinfo, | 53 | unsigned int dataoff, enum ip_conntrack_info *ctinfo, |
| 55 | u_int8_t pf, unsigned int hooknum); | 54 | u_int8_t pf, unsigned int hooknum); |
| 56 | 55 | ||
| 57 | /* Print out the per-protocol part of the tuple. Return like seq_* */ | 56 | /* Print out the per-protocol part of the tuple. Return like seq_* */ |
diff --git a/include/net/netfilter/nf_conntrack_tuple.h b/include/net/netfilter/nf_conntrack_tuple.h index 2628c154d40e..4ee44c84a304 100644 --- a/include/net/netfilter/nf_conntrack_tuple.h +++ b/include/net/netfilter/nf_conntrack_tuple.h | |||
| @@ -26,8 +26,7 @@ | |||
| 26 | 26 | ||
| 27 | /* The protocol-specific manipulable parts of the tuple: always in | 27 | /* The protocol-specific manipulable parts of the tuple: always in |
| 28 | network order! */ | 28 | network order! */ |
| 29 | union nf_conntrack_man_proto | 29 | union nf_conntrack_man_proto { |
| 30 | { | ||
| 31 | /* Add other protocols here. */ | 30 | /* Add other protocols here. */ |
| 32 | __be16 all; | 31 | __be16 all; |
| 33 | 32 | ||
| @@ -52,8 +51,7 @@ union nf_conntrack_man_proto | |||
| 52 | }; | 51 | }; |
| 53 | 52 | ||
| 54 | /* The manipulable part of the tuple. */ | 53 | /* The manipulable part of the tuple. */ |
| 55 | struct nf_conntrack_man | 54 | struct nf_conntrack_man { |
| 56 | { | ||
| 57 | union nf_inet_addr u3; | 55 | union nf_inet_addr u3; |
| 58 | union nf_conntrack_man_proto u; | 56 | union nf_conntrack_man_proto u; |
| 59 | /* Layer 3 protocol */ | 57 | /* Layer 3 protocol */ |
| @@ -61,8 +59,7 @@ struct nf_conntrack_man | |||
| 61 | }; | 59 | }; |
| 62 | 60 | ||
| 63 | /* This contains the information to distinguish a connection. */ | 61 | /* This contains the information to distinguish a connection. */ |
| 64 | struct nf_conntrack_tuple | 62 | struct nf_conntrack_tuple { |
| 65 | { | ||
| 66 | struct nf_conntrack_man src; | 63 | struct nf_conntrack_man src; |
| 67 | 64 | ||
| 68 | /* These are the parts of the tuple which are fixed. */ | 65 | /* These are the parts of the tuple which are fixed. */ |
| @@ -100,8 +97,7 @@ struct nf_conntrack_tuple | |||
| 100 | } dst; | 97 | } dst; |
| 101 | }; | 98 | }; |
| 102 | 99 | ||
| 103 | struct nf_conntrack_tuple_mask | 100 | struct nf_conntrack_tuple_mask { |
| 104 | { | ||
| 105 | struct { | 101 | struct { |
| 106 | union nf_inet_addr u3; | 102 | union nf_inet_addr u3; |
| 107 | union nf_conntrack_man_proto u; | 103 | union nf_conntrack_man_proto u; |
diff --git a/include/net/netfilter/nf_conntrack_zones.h b/include/net/netfilter/nf_conntrack_zones.h new file mode 100644 index 000000000000..034efe8d45a5 --- /dev/null +++ b/include/net/netfilter/nf_conntrack_zones.h | |||
| @@ -0,0 +1,25 @@ | |||
| 1 | #ifndef _NF_CONNTRACK_ZONES_H | ||
| 2 | #define _NF_CONNTRACK_ZONES_H | ||
| 3 | |||
| 4 | #define NF_CT_DEFAULT_ZONE 0 | ||
| 5 | |||
| 6 | #if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE) | ||
| 7 | #include <net/netfilter/nf_conntrack_extend.h> | ||
| 8 | |||
| 9 | struct nf_conntrack_zone { | ||
| 10 | u16 id; | ||
| 11 | }; | ||
| 12 | |||
| 13 | static inline u16 nf_ct_zone(const struct nf_conn *ct) | ||
| 14 | { | ||
| 15 | #ifdef CONFIG_NF_CONNTRACK_ZONES | ||
| 16 | struct nf_conntrack_zone *nf_ct_zone; | ||
| 17 | nf_ct_zone = nf_ct_ext_find(ct, NF_CT_EXT_ZONE); | ||
| 18 | if (nf_ct_zone) | ||
| 19 | return nf_ct_zone->id; | ||
| 20 | #endif | ||
| 21 | return NF_CT_DEFAULT_ZONE; | ||
| 22 | } | ||
| 23 | |||
| 24 | #endif /* CONFIG_NF_CONNTRACK || CONFIG_NF_CONNTRACK_MODULE */ | ||
| 25 | #endif /* _NF_CONNTRACK_ZONES_H */ | ||
diff --git a/include/net/netfilter/nf_nat.h b/include/net/netfilter/nf_nat.h index 8df0b7f7fc6e..f5f09f032a90 100644 --- a/include/net/netfilter/nf_nat.h +++ b/include/net/netfilter/nf_nat.h | |||
| @@ -5,8 +5,7 @@ | |||
| 5 | 5 | ||
| 6 | #define NF_NAT_MAPPING_TYPE_MAX_NAMELEN 16 | 6 | #define NF_NAT_MAPPING_TYPE_MAX_NAMELEN 16 |
| 7 | 7 | ||
| 8 | enum nf_nat_manip_type | 8 | enum nf_nat_manip_type { |
| 9 | { | ||
| 10 | IP_NAT_MANIP_SRC, | 9 | IP_NAT_MANIP_SRC, |
| 11 | IP_NAT_MANIP_DST | 10 | IP_NAT_MANIP_DST |
| 12 | }; | 11 | }; |
| @@ -30,8 +29,7 @@ struct nf_nat_seq { | |||
| 30 | }; | 29 | }; |
| 31 | 30 | ||
| 32 | /* Single range specification. */ | 31 | /* Single range specification. */ |
| 33 | struct nf_nat_range | 32 | struct nf_nat_range { |
| 34 | { | ||
| 35 | /* Set to OR of flags above. */ | 33 | /* Set to OR of flags above. */ |
| 36 | unsigned int flags; | 34 | unsigned int flags; |
| 37 | 35 | ||
| @@ -43,8 +41,7 @@ struct nf_nat_range | |||
| 43 | }; | 41 | }; |
| 44 | 42 | ||
| 45 | /* For backwards compat: don't use in modern code. */ | 43 | /* For backwards compat: don't use in modern code. */ |
| 46 | struct nf_nat_multi_range_compat | 44 | struct nf_nat_multi_range_compat { |
| 47 | { | ||
| 48 | unsigned int rangesize; /* Must be 1. */ | 45 | unsigned int rangesize; /* Must be 1. */ |
| 49 | 46 | ||
| 50 | /* hangs off end. */ | 47 | /* hangs off end. */ |
| @@ -57,8 +54,7 @@ struct nf_nat_multi_range_compat | |||
| 57 | #include <net/netfilter/nf_conntrack_extend.h> | 54 | #include <net/netfilter/nf_conntrack_extend.h> |
| 58 | 55 | ||
| 59 | /* per conntrack: nat application helper private data */ | 56 | /* per conntrack: nat application helper private data */ |
| 60 | union nf_conntrack_nat_help | 57 | union nf_conntrack_nat_help { |
| 61 | { | ||
| 62 | /* insert nat helper private data here */ | 58 | /* insert nat helper private data here */ |
| 63 | struct nf_nat_pptp nat_pptp_info; | 59 | struct nf_nat_pptp nat_pptp_info; |
| 64 | }; | 60 | }; |
| @@ -66,8 +62,7 @@ union nf_conntrack_nat_help | |||
| 66 | struct nf_conn; | 62 | struct nf_conn; |
| 67 | 63 | ||
| 68 | /* The structure embedded in the conntrack structure. */ | 64 | /* The structure embedded in the conntrack structure. */ |
| 69 | struct nf_conn_nat | 65 | struct nf_conn_nat { |
| 70 | { | ||
| 71 | struct hlist_node bysource; | 66 | struct hlist_node bysource; |
| 72 | struct nf_nat_seq seq[IP_CT_DIR_MAX]; | 67 | struct nf_nat_seq seq[IP_CT_DIR_MAX]; |
| 73 | struct nf_conn *ct; | 68 | struct nf_conn *ct; |
diff --git a/include/net/netfilter/nf_nat_helper.h b/include/net/netfilter/nf_nat_helper.h index 4222220920a5..02bb6c29dc3d 100644 --- a/include/net/netfilter/nf_nat_helper.h +++ b/include/net/netfilter/nf_nat_helper.h | |||
| @@ -7,13 +7,27 @@ | |||
| 7 | struct sk_buff; | 7 | struct sk_buff; |
| 8 | 8 | ||
| 9 | /* These return true or false. */ | 9 | /* These return true or false. */ |
| 10 | extern int nf_nat_mangle_tcp_packet(struct sk_buff *skb, | 10 | extern int __nf_nat_mangle_tcp_packet(struct sk_buff *skb, |
| 11 | struct nf_conn *ct, | 11 | struct nf_conn *ct, |
| 12 | enum ip_conntrack_info ctinfo, | 12 | enum ip_conntrack_info ctinfo, |
| 13 | unsigned int match_offset, | 13 | unsigned int match_offset, |
| 14 | unsigned int match_len, | 14 | unsigned int match_len, |
| 15 | const char *rep_buffer, | 15 | const char *rep_buffer, |
| 16 | unsigned int rep_len); | 16 | unsigned int rep_len, bool adjust); |
| 17 | |||
| 18 | static inline int nf_nat_mangle_tcp_packet(struct sk_buff *skb, | ||
| 19 | struct nf_conn *ct, | ||
| 20 | enum ip_conntrack_info ctinfo, | ||
| 21 | unsigned int match_offset, | ||
| 22 | unsigned int match_len, | ||
| 23 | const char *rep_buffer, | ||
| 24 | unsigned int rep_len) | ||
| 25 | { | ||
| 26 | return __nf_nat_mangle_tcp_packet(skb, ct, ctinfo, | ||
| 27 | match_offset, match_len, | ||
| 28 | rep_buffer, rep_len, true); | ||
| 29 | } | ||
| 30 | |||
| 17 | extern int nf_nat_mangle_udp_packet(struct sk_buff *skb, | 31 | extern int nf_nat_mangle_udp_packet(struct sk_buff *skb, |
| 18 | struct nf_conn *ct, | 32 | struct nf_conn *ct, |
| 19 | enum ip_conntrack_info ctinfo, | 33 | enum ip_conntrack_info ctinfo, |
| @@ -21,6 +35,10 @@ extern int nf_nat_mangle_udp_packet(struct sk_buff *skb, | |||
| 21 | unsigned int match_len, | 35 | unsigned int match_len, |
| 22 | const char *rep_buffer, | 36 | const char *rep_buffer, |
| 23 | unsigned int rep_len); | 37 | unsigned int rep_len); |
| 38 | |||
| 39 | extern void nf_nat_set_seq_adjust(struct nf_conn *ct, | ||
| 40 | enum ip_conntrack_info ctinfo, | ||
| 41 | __be32 seq, s16 off); | ||
| 24 | extern int nf_nat_seq_adjust(struct sk_buff *skb, | 42 | extern int nf_nat_seq_adjust(struct sk_buff *skb, |
| 25 | struct nf_conn *ct, | 43 | struct nf_conn *ct, |
| 26 | enum ip_conntrack_info ctinfo); | 44 | enum ip_conntrack_info ctinfo); |
diff --git a/include/net/netfilter/nf_nat_protocol.h b/include/net/netfilter/nf_nat_protocol.h index f3662c4394ef..c398017ccfa3 100644 --- a/include/net/netfilter/nf_nat_protocol.h +++ b/include/net/netfilter/nf_nat_protocol.h | |||
| @@ -6,8 +6,7 @@ | |||
| 6 | 6 | ||
| 7 | struct nf_nat_range; | 7 | struct nf_nat_range; |
| 8 | 8 | ||
| 9 | struct nf_nat_protocol | 9 | struct nf_nat_protocol { |
| 10 | { | ||
| 11 | /* Protocol number. */ | 10 | /* Protocol number. */ |
| 12 | unsigned int protonum; | 11 | unsigned int protonum; |
| 13 | 12 | ||
diff --git a/include/net/netlabel.h b/include/net/netlabel.h index 60ebbc1fef46..9db401a8b4d9 100644 --- a/include/net/netlabel.h +++ b/include/net/netlabel.h | |||
| @@ -31,6 +31,7 @@ | |||
| 31 | #define _NETLABEL_H | 31 | #define _NETLABEL_H |
| 32 | 32 | ||
| 33 | #include <linux/types.h> | 33 | #include <linux/types.h> |
| 34 | #include <linux/slab.h> | ||
| 34 | #include <linux/net.h> | 35 | #include <linux/net.h> |
| 35 | #include <linux/skbuff.h> | 36 | #include <linux/skbuff.h> |
| 36 | #include <linux/in.h> | 37 | #include <linux/in.h> |
diff --git a/include/net/netlink.h b/include/net/netlink.h index a63b2192ac1c..4fc05b58503e 100644 --- a/include/net/netlink.h +++ b/include/net/netlink.h | |||
| @@ -196,7 +196,7 @@ enum { | |||
| 196 | * All other Exact length of attribute payload | 196 | * All other Exact length of attribute payload |
| 197 | * | 197 | * |
| 198 | * Example: | 198 | * Example: |
| 199 | * static struct nla_policy my_policy[ATTR_MAX+1] __read_mostly = { | 199 | * static const struct nla_policy my_policy[ATTR_MAX+1] = { |
| 200 | * [ATTR_FOO] = { .type = NLA_U16 }, | 200 | * [ATTR_FOO] = { .type = NLA_U16 }, |
| 201 | * [ATTR_BAR] = { .type = NLA_STRING, .len = BARSIZ }, | 201 | * [ATTR_BAR] = { .type = NLA_STRING, .len = BARSIZ }, |
| 202 | * [ATTR_BAZ] = { .len = sizeof(struct mystruct) }, | 202 | * [ATTR_BAZ] = { .len = sizeof(struct mystruct) }, |
| @@ -945,7 +945,11 @@ static inline u64 nla_get_u64(const struct nlattr *nla) | |||
| 945 | */ | 945 | */ |
| 946 | static inline __be64 nla_get_be64(const struct nlattr *nla) | 946 | static inline __be64 nla_get_be64(const struct nlattr *nla) |
| 947 | { | 947 | { |
| 948 | return *(__be64 *) nla_data(nla); | 948 | __be64 tmp; |
| 949 | |||
| 950 | nla_memcpy(&tmp, nla, sizeof(tmp)); | ||
| 951 | |||
| 952 | return tmp; | ||
| 949 | } | 953 | } |
| 950 | 954 | ||
| 951 | /** | 955 | /** |
diff --git a/include/net/netns/conntrack.h b/include/net/netns/conntrack.h index ba1ba0c5efd1..d4958d4c6574 100644 --- a/include/net/netns/conntrack.h +++ b/include/net/netns/conntrack.h | |||
| @@ -11,11 +11,13 @@ struct nf_conntrack_ecache; | |||
| 11 | struct netns_ct { | 11 | struct netns_ct { |
| 12 | atomic_t count; | 12 | atomic_t count; |
| 13 | unsigned int expect_count; | 13 | unsigned int expect_count; |
| 14 | unsigned int htable_size; | ||
| 15 | struct kmem_cache *nf_conntrack_cachep; | ||
| 14 | struct hlist_nulls_head *hash; | 16 | struct hlist_nulls_head *hash; |
| 15 | struct hlist_head *expect_hash; | 17 | struct hlist_head *expect_hash; |
| 16 | struct hlist_nulls_head unconfirmed; | 18 | struct hlist_nulls_head unconfirmed; |
| 17 | struct hlist_nulls_head dying; | 19 | struct hlist_nulls_head dying; |
| 18 | struct ip_conntrack_stat *stat; | 20 | struct ip_conntrack_stat __percpu *stat; |
| 19 | int sysctl_events; | 21 | int sysctl_events; |
| 20 | unsigned int sysctl_events_retry_timeout; | 22 | unsigned int sysctl_events_retry_timeout; |
| 21 | int sysctl_acct; | 23 | int sysctl_acct; |
| @@ -28,5 +30,6 @@ struct netns_ct { | |||
| 28 | #endif | 30 | #endif |
| 29 | int hash_vmalloc; | 31 | int hash_vmalloc; |
| 30 | int expect_vmalloc; | 32 | int expect_vmalloc; |
| 33 | char *slabname; | ||
| 31 | }; | 34 | }; |
| 32 | #endif | 35 | #endif |
diff --git a/include/net/netns/core.h b/include/net/netns/core.h index 24d4be76bbd1..78eb1ff75475 100644 --- a/include/net/netns/core.h +++ b/include/net/netns/core.h | |||
| @@ -10,7 +10,7 @@ struct netns_core { | |||
| 10 | 10 | ||
| 11 | int sysctl_somaxconn; | 11 | int sysctl_somaxconn; |
| 12 | 12 | ||
| 13 | struct prot_inuse *inuse; | 13 | struct prot_inuse __percpu *inuse; |
| 14 | }; | 14 | }; |
| 15 | 15 | ||
| 16 | #endif | 16 | #endif |
diff --git a/include/net/netns/generic.h b/include/net/netns/generic.h index 0c04fd2a700b..ff4982ab84b6 100644 --- a/include/net/netns/generic.h +++ b/include/net/netns/generic.h | |||
| @@ -12,9 +12,11 @@ | |||
| 12 | * stuff on the struct net without explicit struct net modification | 12 | * stuff on the struct net without explicit struct net modification |
| 13 | * | 13 | * |
| 14 | * The rules are simple: | 14 | * The rules are simple: |
| 15 | * 1. register the ops with register_pernet_gen_device to get the id | 15 | * 1. set pernet_operations->id. After register_pernet_device you |
| 16 | * of your private pointer; | 16 | * will have the id of your private pointer. |
| 17 | * 2. call net_assign_generic() to put the private data on the struct | 17 | * 2. Either set pernet_operations->size (to have the code allocate and |
| 18 | * free a private structure pointed to from struct net ) or | ||
| 19 | * call net_assign_generic() to put the private data on the struct | ||
| 18 | * net (most preferably this should be done in the ->init callback | 20 | * net (most preferably this should be done in the ->init callback |
| 19 | * of the ops registered); | 21 | * of the ops registered); |
| 20 | * 3. do not change this pointer while the net is alive; | 22 | * 3. do not change this pointer while the net is alive; |
diff --git a/include/net/netns/ipv4.h b/include/net/netns/ipv4.h index 2eb3814d6258..2764994c9136 100644 --- a/include/net/netns/ipv4.h +++ b/include/net/netns/ipv4.h | |||
| @@ -37,9 +37,12 @@ struct netns_ipv4 { | |||
| 37 | struct xt_table *iptable_mangle; | 37 | struct xt_table *iptable_mangle; |
| 38 | struct xt_table *iptable_raw; | 38 | struct xt_table *iptable_raw; |
| 39 | struct xt_table *arptable_filter; | 39 | struct xt_table *arptable_filter; |
| 40 | #ifdef CONFIG_SECURITY | ||
| 40 | struct xt_table *iptable_security; | 41 | struct xt_table *iptable_security; |
| 42 | #endif | ||
| 41 | struct xt_table *nat_table; | 43 | struct xt_table *nat_table; |
| 42 | struct hlist_head *nat_bysource; | 44 | struct hlist_head *nat_bysource; |
| 45 | unsigned int nat_htable_size; | ||
| 43 | int nat_vmalloced; | 46 | int nat_vmalloced; |
| 44 | #endif | 47 | #endif |
| 45 | 48 | ||
diff --git a/include/net/netns/ipv6.h b/include/net/netns/ipv6.h index dfeb2d7c425b..1f11ebc22151 100644 --- a/include/net/netns/ipv6.h +++ b/include/net/netns/ipv6.h | |||
| @@ -36,8 +36,10 @@ struct netns_ipv6 { | |||
| 36 | struct xt_table *ip6table_filter; | 36 | struct xt_table *ip6table_filter; |
| 37 | struct xt_table *ip6table_mangle; | 37 | struct xt_table *ip6table_mangle; |
| 38 | struct xt_table *ip6table_raw; | 38 | struct xt_table *ip6table_raw; |
| 39 | #ifdef CONFIG_SECURITY | ||
| 39 | struct xt_table *ip6table_security; | 40 | struct xt_table *ip6table_security; |
| 40 | #endif | 41 | #endif |
| 42 | #endif | ||
| 41 | struct rt6_info *ip6_null_entry; | 43 | struct rt6_info *ip6_null_entry; |
| 42 | struct rt6_statistics *rt6_stats; | 44 | struct rt6_statistics *rt6_stats; |
| 43 | struct timer_list ip6_fib_timer; | 45 | struct timer_list ip6_fib_timer; |
diff --git a/include/net/netns/packet.h b/include/net/netns/packet.h index 637daf698884..cb4e894c0f8d 100644 --- a/include/net/netns/packet.h +++ b/include/net/netns/packet.h | |||
| @@ -4,11 +4,11 @@ | |||
| 4 | #ifndef __NETNS_PACKET_H__ | 4 | #ifndef __NETNS_PACKET_H__ |
| 5 | #define __NETNS_PACKET_H__ | 5 | #define __NETNS_PACKET_H__ |
| 6 | 6 | ||
| 7 | #include <linux/list.h> | 7 | #include <linux/rculist.h> |
| 8 | #include <linux/spinlock.h> | 8 | #include <linux/spinlock.h> |
| 9 | 9 | ||
| 10 | struct netns_packet { | 10 | struct netns_packet { |
| 11 | rwlock_t sklist_lock; | 11 | spinlock_t sklist_lock; |
| 12 | struct hlist_head sklist; | 12 | struct hlist_head sklist; |
| 13 | }; | 13 | }; |
| 14 | 14 | ||
diff --git a/include/net/netns/xfrm.h b/include/net/netns/xfrm.h index 1ba912749caa..74f119a2829a 100644 --- a/include/net/netns/xfrm.h +++ b/include/net/netns/xfrm.h | |||
| @@ -5,6 +5,7 @@ | |||
| 5 | #include <linux/wait.h> | 5 | #include <linux/wait.h> |
| 6 | #include <linux/workqueue.h> | 6 | #include <linux/workqueue.h> |
| 7 | #include <linux/xfrm.h> | 7 | #include <linux/xfrm.h> |
| 8 | #include <net/dst_ops.h> | ||
| 8 | 9 | ||
| 9 | struct ctl_table_header; | 10 | struct ctl_table_header; |
| 10 | 11 | ||
| @@ -42,7 +43,13 @@ struct netns_xfrm { | |||
| 42 | unsigned int policy_count[XFRM_POLICY_MAX * 2]; | 43 | unsigned int policy_count[XFRM_POLICY_MAX * 2]; |
| 43 | struct work_struct policy_hash_work; | 44 | struct work_struct policy_hash_work; |
| 44 | 45 | ||
| 46 | struct dst_ops xfrm4_dst_ops; | ||
| 47 | #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) | ||
| 48 | struct dst_ops xfrm6_dst_ops; | ||
| 49 | #endif | ||
| 50 | |||
| 45 | struct sock *nlsk; | 51 | struct sock *nlsk; |
| 52 | struct sock *nlsk_stash; | ||
| 46 | 53 | ||
| 47 | u32 sysctl_aevent_etime; | 54 | u32 sysctl_aevent_etime; |
| 48 | u32 sysctl_aevent_rseqth; | 55 | u32 sysctl_aevent_rseqth; |
diff --git a/include/net/netrom.h b/include/net/netrom.h index 15696b1fd30f..f0793c1cb5f8 100644 --- a/include/net/netrom.h +++ b/include/net/netrom.h | |||
| @@ -9,6 +9,7 @@ | |||
| 9 | 9 | ||
| 10 | #include <linux/netrom.h> | 10 | #include <linux/netrom.h> |
| 11 | #include <linux/list.h> | 11 | #include <linux/list.h> |
| 12 | #include <linux/slab.h> | ||
| 12 | #include <net/sock.h> | 13 | #include <net/sock.h> |
| 13 | 14 | ||
| 14 | #define NR_NETWORK_LEN 15 | 15 | #define NR_NETWORK_LEN 15 |
| @@ -132,6 +133,8 @@ static __inline__ void nr_node_put(struct nr_node *nr_node) | |||
| 132 | static __inline__ void nr_neigh_put(struct nr_neigh *nr_neigh) | 133 | static __inline__ void nr_neigh_put(struct nr_neigh *nr_neigh) |
| 133 | { | 134 | { |
| 134 | if (atomic_dec_and_test(&nr_neigh->refcount)) { | 135 | if (atomic_dec_and_test(&nr_neigh->refcount)) { |
| 136 | if (nr_neigh->ax25) | ||
| 137 | ax25_cb_put(nr_neigh->ax25); | ||
| 135 | kfree(nr_neigh->digipeat); | 138 | kfree(nr_neigh->digipeat); |
| 136 | kfree(nr_neigh); | 139 | kfree(nr_neigh); |
| 137 | } | 140 | } |
diff --git a/include/net/phonet/pep.h b/include/net/phonet/pep.h index 4c61cdce4e5f..35672b1cf44a 100644 --- a/include/net/phonet/pep.h +++ b/include/net/phonet/pep.h | |||
| @@ -44,6 +44,7 @@ struct pep_sock { | |||
| 44 | u8 rx_fc; /* RX flow control */ | 44 | u8 rx_fc; /* RX flow control */ |
| 45 | u8 tx_fc; /* TX flow control */ | 45 | u8 tx_fc; /* TX flow control */ |
| 46 | u8 init_enable; /* auto-enable at creation */ | 46 | u8 init_enable; /* auto-enable at creation */ |
| 47 | u8 aligned; | ||
| 47 | }; | 48 | }; |
| 48 | 49 | ||
| 49 | static inline struct pep_sock *pep_sk(struct sock *sk) | 50 | static inline struct pep_sock *pep_sk(struct sock *sk) |
| @@ -77,6 +78,7 @@ static inline struct pnpipehdr *pnp_hdr(struct sk_buff *skb) | |||
| 77 | 78 | ||
| 78 | enum { | 79 | enum { |
| 79 | PNS_PIPE_DATA = 0x20, | 80 | PNS_PIPE_DATA = 0x20, |
| 81 | PNS_PIPE_ALIGNED_DATA, | ||
| 80 | 82 | ||
| 81 | PNS_PEP_CONNECT_REQ = 0x40, | 83 | PNS_PEP_CONNECT_REQ = 0x40, |
| 82 | PNS_PEP_CONNECT_RESP, | 84 | PNS_PEP_CONNECT_RESP, |
| @@ -138,6 +140,7 @@ enum { | |||
| 138 | PN_PIPE_SB_NEGOTIATED_FC, | 140 | PN_PIPE_SB_NEGOTIATED_FC, |
| 139 | PN_PIPE_SB_REQUIRED_FC_TX, | 141 | PN_PIPE_SB_REQUIRED_FC_TX, |
| 140 | PN_PIPE_SB_PREFERRED_FC_RX, | 142 | PN_PIPE_SB_PREFERRED_FC_RX, |
| 143 | PN_PIPE_SB_ALIGNED_DATA, | ||
| 141 | }; | 144 | }; |
| 142 | 145 | ||
| 143 | /* Phonet pipe flow control models */ | 146 | /* Phonet pipe flow control models */ |
diff --git a/include/net/phonet/phonet.h b/include/net/phonet/phonet.h index d43f71b5ec00..7b114079a51b 100644 --- a/include/net/phonet/phonet.h +++ b/include/net/phonet/phonet.h | |||
| @@ -46,7 +46,9 @@ static inline struct pn_sock *pn_sk(struct sock *sk) | |||
| 46 | 46 | ||
| 47 | extern const struct proto_ops phonet_dgram_ops; | 47 | extern const struct proto_ops phonet_dgram_ops; |
| 48 | 48 | ||
| 49 | void pn_sock_init(void); | ||
| 49 | struct sock *pn_find_sock_by_sa(struct net *net, const struct sockaddr_pn *sa); | 50 | struct sock *pn_find_sock_by_sa(struct net *net, const struct sockaddr_pn *sa); |
| 51 | void pn_deliver_sock_broadcast(struct net *net, struct sk_buff *skb); | ||
| 50 | void phonet_get_local_port_range(int *min, int *max); | 52 | void phonet_get_local_port_range(int *min, int *max); |
| 51 | void pn_sock_hash(struct sock *sk); | 53 | void pn_sock_hash(struct sock *sk); |
| 52 | void pn_sock_unhash(struct sock *sk); | 54 | void pn_sock_unhash(struct sock *sk); |
diff --git a/include/net/phonet/pn_dev.h b/include/net/phonet/pn_dev.h index 44c923c9e21d..d7b989ca3d63 100644 --- a/include/net/phonet/pn_dev.h +++ b/include/net/phonet/pn_dev.h | |||
| @@ -25,7 +25,7 @@ | |||
| 25 | 25 | ||
| 26 | struct phonet_device_list { | 26 | struct phonet_device_list { |
| 27 | struct list_head list; | 27 | struct list_head list; |
| 28 | spinlock_t lock; | 28 | struct mutex lock; |
| 29 | }; | 29 | }; |
| 30 | 30 | ||
| 31 | struct phonet_device_list *phonet_device_list(struct net *net); | 31 | struct phonet_device_list *phonet_device_list(struct net *net); |
| @@ -47,6 +47,12 @@ u8 phonet_address_get(struct net_device *dev, u8 addr); | |||
| 47 | int phonet_address_lookup(struct net *net, u8 addr); | 47 | int phonet_address_lookup(struct net *net, u8 addr); |
| 48 | void phonet_address_notify(int event, struct net_device *dev, u8 addr); | 48 | void phonet_address_notify(int event, struct net_device *dev, u8 addr); |
| 49 | 49 | ||
| 50 | int phonet_route_add(struct net_device *dev, u8 daddr); | ||
| 51 | int phonet_route_del(struct net_device *dev, u8 daddr); | ||
| 52 | void rtm_phonet_notify(int event, struct net_device *dev, u8 dst); | ||
| 53 | struct net_device *phonet_route_get(struct net *net, u8 daddr); | ||
| 54 | struct net_device *phonet_route_output(struct net *net, u8 daddr); | ||
| 55 | |||
| 50 | #define PN_NO_ADDR 0xff | 56 | #define PN_NO_ADDR 0xff |
| 51 | 57 | ||
| 52 | extern const struct file_operations pn_sock_seq_fops; | 58 | extern const struct file_operations pn_sock_seq_fops; |
diff --git a/include/net/pkt_cls.h b/include/net/pkt_cls.h index d1ca31444644..dd3031aed9d5 100644 --- a/include/net/pkt_cls.h +++ b/include/net/pkt_cls.h | |||
| @@ -7,8 +7,7 @@ | |||
| 7 | 7 | ||
| 8 | /* Basic packet classifier frontend definitions. */ | 8 | /* Basic packet classifier frontend definitions. */ |
| 9 | 9 | ||
| 10 | struct tcf_walker | 10 | struct tcf_walker { |
| 11 | { | ||
| 12 | int stop; | 11 | int stop; |
| 13 | int skip; | 12 | int skip; |
| 14 | int count; | 13 | int count; |
| @@ -61,8 +60,7 @@ tcf_unbind_filter(struct tcf_proto *tp, struct tcf_result *r) | |||
| 61 | tp->q->ops->cl_ops->unbind_tcf(tp->q, cl); | 60 | tp->q->ops->cl_ops->unbind_tcf(tp->q, cl); |
| 62 | } | 61 | } |
| 63 | 62 | ||
| 64 | struct tcf_exts | 63 | struct tcf_exts { |
| 65 | { | ||
| 66 | #ifdef CONFIG_NET_CLS_ACT | 64 | #ifdef CONFIG_NET_CLS_ACT |
| 67 | struct tc_action *action; | 65 | struct tc_action *action; |
| 68 | #endif | 66 | #endif |
| @@ -71,8 +69,7 @@ struct tcf_exts | |||
| 71 | /* Map to export classifier specific extension TLV types to the | 69 | /* Map to export classifier specific extension TLV types to the |
| 72 | * generic extensions API. Unsupported extensions must be set to 0. | 70 | * generic extensions API. Unsupported extensions must be set to 0. |
| 73 | */ | 71 | */ |
| 74 | struct tcf_ext_map | 72 | struct tcf_ext_map { |
| 75 | { | ||
| 76 | int action; | 73 | int action; |
| 77 | int police; | 74 | int police; |
| 78 | }; | 75 | }; |
| @@ -143,8 +140,7 @@ extern int tcf_exts_dump_stats(struct sk_buff *skb, struct tcf_exts *exts, | |||
| 143 | /** | 140 | /** |
| 144 | * struct tcf_pkt_info - packet information | 141 | * struct tcf_pkt_info - packet information |
| 145 | */ | 142 | */ |
| 146 | struct tcf_pkt_info | 143 | struct tcf_pkt_info { |
| 147 | { | ||
| 148 | unsigned char * ptr; | 144 | unsigned char * ptr; |
| 149 | int nexthdr; | 145 | int nexthdr; |
| 150 | }; | 146 | }; |
| @@ -162,8 +158,7 @@ struct tcf_ematch_ops; | |||
| 162 | * @datalen: length of the ematch specific configuration data | 158 | * @datalen: length of the ematch specific configuration data |
| 163 | * @data: ematch specific data | 159 | * @data: ematch specific data |
| 164 | */ | 160 | */ |
| 165 | struct tcf_ematch | 161 | struct tcf_ematch { |
| 166 | { | ||
| 167 | struct tcf_ematch_ops * ops; | 162 | struct tcf_ematch_ops * ops; |
| 168 | unsigned long data; | 163 | unsigned long data; |
| 169 | unsigned int datalen; | 164 | unsigned int datalen; |
| @@ -211,8 +206,7 @@ static inline int tcf_em_early_end(struct tcf_ematch *em, int result) | |||
| 211 | * @hdr: ematch tree header supplied by userspace | 206 | * @hdr: ematch tree header supplied by userspace |
| 212 | * @matches: array of ematches | 207 | * @matches: array of ematches |
| 213 | */ | 208 | */ |
| 214 | struct tcf_ematch_tree | 209 | struct tcf_ematch_tree { |
| 215 | { | ||
| 216 | struct tcf_ematch_tree_hdr hdr; | 210 | struct tcf_ematch_tree_hdr hdr; |
| 217 | struct tcf_ematch * matches; | 211 | struct tcf_ematch * matches; |
| 218 | 212 | ||
| @@ -230,8 +224,7 @@ struct tcf_ematch_tree | |||
| 230 | * @owner: owner, must be set to THIS_MODULE | 224 | * @owner: owner, must be set to THIS_MODULE |
| 231 | * @link: link to previous/next ematch module (internal use) | 225 | * @link: link to previous/next ematch module (internal use) |
| 232 | */ | 226 | */ |
| 233 | struct tcf_ematch_ops | 227 | struct tcf_ematch_ops { |
| 234 | { | ||
| 235 | int kind; | 228 | int kind; |
| 236 | int datalen; | 229 | int datalen; |
| 237 | int (*change)(struct tcf_proto *, void *, | 230 | int (*change)(struct tcf_proto *, void *, |
| @@ -302,8 +295,7 @@ static inline int tcf_em_tree_match(struct sk_buff *skb, | |||
| 302 | 295 | ||
| 303 | #else /* CONFIG_NET_EMATCH */ | 296 | #else /* CONFIG_NET_EMATCH */ |
| 304 | 297 | ||
| 305 | struct tcf_ematch_tree | 298 | struct tcf_ematch_tree { |
| 306 | { | ||
| 307 | }; | 299 | }; |
| 308 | 300 | ||
| 309 | #define tcf_em_tree_validate(tp, tb, t) ((void)(t), 0) | 301 | #define tcf_em_tree_validate(tp, tb, t) ((void)(t), 0) |
| @@ -351,9 +343,9 @@ tcf_match_indev(struct sk_buff *skb, char *indev) | |||
| 351 | struct net_device *dev; | 343 | struct net_device *dev; |
| 352 | 344 | ||
| 353 | if (indev[0]) { | 345 | if (indev[0]) { |
| 354 | if (!skb->iif) | 346 | if (!skb->skb_iif) |
| 355 | return 0; | 347 | return 0; |
| 356 | dev = __dev_get_by_index(dev_net(skb->dev), skb->iif); | 348 | dev = __dev_get_by_index(dev_net(skb->dev), skb->skb_iif); |
| 357 | if (!dev || strcmp(indev, dev->name)) | 349 | if (!dev || strcmp(indev, dev->name)) |
| 358 | return 0; | 350 | return 0; |
| 359 | } | 351 | } |
diff --git a/include/net/pkt_sched.h b/include/net/pkt_sched.h index f911ec7598ef..b6cdc33b39c1 100644 --- a/include/net/pkt_sched.h +++ b/include/net/pkt_sched.h | |||
| @@ -5,8 +5,7 @@ | |||
| 5 | #include <linux/ktime.h> | 5 | #include <linux/ktime.h> |
| 6 | #include <net/sch_generic.h> | 6 | #include <net/sch_generic.h> |
| 7 | 7 | ||
| 8 | struct qdisc_walker | 8 | struct qdisc_walker { |
| 9 | { | ||
| 10 | int stop; | 9 | int stop; |
| 11 | int skip; | 10 | int skip; |
| 12 | int count; | 11 | int count; |
| @@ -72,6 +71,7 @@ extern void qdisc_watchdog_cancel(struct qdisc_watchdog *wd); | |||
| 72 | 71 | ||
| 73 | extern struct Qdisc_ops pfifo_qdisc_ops; | 72 | extern struct Qdisc_ops pfifo_qdisc_ops; |
| 74 | extern struct Qdisc_ops bfifo_qdisc_ops; | 73 | extern struct Qdisc_ops bfifo_qdisc_ops; |
| 74 | extern struct Qdisc_ops pfifo_head_drop_qdisc_ops; | ||
| 75 | 75 | ||
| 76 | extern int fifo_set_limit(struct Qdisc *q, unsigned int limit); | 76 | extern int fifo_set_limit(struct Qdisc *q, unsigned int limit); |
| 77 | extern struct Qdisc *fifo_create_dflt(struct Qdisc *sch, struct Qdisc_ops *ops, | 77 | extern struct Qdisc *fifo_create_dflt(struct Qdisc *sch, struct Qdisc_ops *ops, |
diff --git a/include/net/protocol.h b/include/net/protocol.h index 60249e51b669..f1effdd3c265 100644 --- a/include/net/protocol.h +++ b/include/net/protocol.h | |||
| @@ -47,8 +47,7 @@ struct net_protocol { | |||
| 47 | }; | 47 | }; |
| 48 | 48 | ||
| 49 | #if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE) | 49 | #if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE) |
| 50 | struct inet6_protocol | 50 | struct inet6_protocol { |
| 51 | { | ||
| 52 | int (*handler)(struct sk_buff *skb); | 51 | int (*handler)(struct sk_buff *skb); |
| 53 | 52 | ||
| 54 | void (*err_handler)(struct sk_buff *skb, | 53 | void (*err_handler)(struct sk_buff *skb, |
| @@ -83,10 +82,6 @@ struct inet_protosw { | |||
| 83 | struct proto *prot; | 82 | struct proto *prot; |
| 84 | const struct proto_ops *ops; | 83 | const struct proto_ops *ops; |
| 85 | 84 | ||
| 86 | int capability; /* Which (if any) capability do | ||
| 87 | * we need to use this socket | ||
| 88 | * interface? | ||
| 89 | */ | ||
| 90 | char no_check; /* checksum on rcv/xmit/none? */ | 85 | char no_check; /* checksum on rcv/xmit/none? */ |
| 91 | unsigned char flags; /* See INET_PROTOSW_* below. */ | 86 | unsigned char flags; /* See INET_PROTOSW_* below. */ |
| 92 | }; | 87 | }; |
diff --git a/include/net/red.h b/include/net/red.h index 3cf31d466a81..995108e54d9f 100644 --- a/include/net/red.h +++ b/include/net/red.h | |||
| @@ -90,8 +90,7 @@ | |||
| 90 | #define RED_STAB_SIZE 256 | 90 | #define RED_STAB_SIZE 256 |
| 91 | #define RED_STAB_MASK (RED_STAB_SIZE - 1) | 91 | #define RED_STAB_MASK (RED_STAB_SIZE - 1) |
| 92 | 92 | ||
| 93 | struct red_stats | 93 | struct red_stats { |
| 94 | { | ||
| 95 | u32 prob_drop; /* Early probability drops */ | 94 | u32 prob_drop; /* Early probability drops */ |
| 96 | u32 prob_mark; /* Early probability marks */ | 95 | u32 prob_mark; /* Early probability marks */ |
| 97 | u32 forced_drop; /* Forced drops, qavg > max_thresh */ | 96 | u32 forced_drop; /* Forced drops, qavg > max_thresh */ |
| @@ -101,8 +100,7 @@ struct red_stats | |||
| 101 | u32 backlog; | 100 | u32 backlog; |
| 102 | }; | 101 | }; |
| 103 | 102 | ||
| 104 | struct red_parms | 103 | struct red_parms { |
| 105 | { | ||
| 106 | /* Parameters */ | 104 | /* Parameters */ |
| 107 | u32 qth_min; /* Min avg length threshold: A scaled */ | 105 | u32 qth_min; /* Min avg length threshold: A scaled */ |
| 108 | u32 qth_max; /* Max avg length threshold: A scaled */ | 106 | u32 qth_max; /* Max avg length threshold: A scaled */ |
diff --git a/include/net/regulatory.h b/include/net/regulatory.h index 47995b81c5d7..f873ee37f7e4 100644 --- a/include/net/regulatory.h +++ b/include/net/regulatory.h | |||
| @@ -39,6 +39,7 @@ enum environment_cap { | |||
| 39 | * 00 - World regulatory domain | 39 | * 00 - World regulatory domain |
| 40 | * 99 - built by driver but a specific alpha2 cannot be determined | 40 | * 99 - built by driver but a specific alpha2 cannot be determined |
| 41 | * 98 - result of an intersection between two regulatory domains | 41 | * 98 - result of an intersection between two regulatory domains |
| 42 | * 97 - regulatory domain has not yet been configured | ||
| 42 | * @intersect: indicates whether the wireless core should intersect | 43 | * @intersect: indicates whether the wireless core should intersect |
| 43 | * the requested regulatory domain with the presently set regulatory | 44 | * the requested regulatory domain with the presently set regulatory |
| 44 | * domain. | 45 | * domain. |
diff --git a/include/net/request_sock.h b/include/net/request_sock.h index c7190846e128..99e6e19b57c2 100644 --- a/include/net/request_sock.h +++ b/include/net/request_sock.h | |||
| @@ -27,18 +27,26 @@ struct sk_buff; | |||
| 27 | struct dst_entry; | 27 | struct dst_entry; |
| 28 | struct proto; | 28 | struct proto; |
| 29 | 29 | ||
| 30 | /* empty to "strongly type" an otherwise void parameter. | ||
| 31 | */ | ||
| 32 | struct request_values { | ||
| 33 | }; | ||
| 34 | |||
| 30 | struct request_sock_ops { | 35 | struct request_sock_ops { |
| 31 | int family; | 36 | int family; |
| 32 | int obj_size; | 37 | int obj_size; |
| 33 | struct kmem_cache *slab; | 38 | struct kmem_cache *slab; |
| 34 | char *slab_name; | 39 | char *slab_name; |
| 35 | int (*rtx_syn_ack)(struct sock *sk, | 40 | int (*rtx_syn_ack)(struct sock *sk, |
| 36 | struct request_sock *req); | 41 | struct request_sock *req, |
| 42 | struct request_values *rvp); | ||
| 37 | void (*send_ack)(struct sock *sk, struct sk_buff *skb, | 43 | void (*send_ack)(struct sock *sk, struct sk_buff *skb, |
| 38 | struct request_sock *req); | 44 | struct request_sock *req); |
| 39 | void (*send_reset)(struct sock *sk, | 45 | void (*send_reset)(struct sock *sk, |
| 40 | struct sk_buff *skb); | 46 | struct sk_buff *skb); |
| 41 | void (*destructor)(struct request_sock *req); | 47 | void (*destructor)(struct request_sock *req); |
| 48 | void (*syn_ack_timeout)(struct sock *sk, | ||
| 49 | struct request_sock *req); | ||
| 42 | }; | 50 | }; |
| 43 | 51 | ||
| 44 | /* struct request_sock - mini sock to represent a connection request | 52 | /* struct request_sock - mini sock to represent a connection request |
diff --git a/include/net/route.h b/include/net/route.h index 40f6346ef496..2c9fba7f7731 100644 --- a/include/net/route.h +++ b/include/net/route.h | |||
| @@ -49,10 +49,8 @@ | |||
| 49 | 49 | ||
| 50 | struct fib_nh; | 50 | struct fib_nh; |
| 51 | struct inet_peer; | 51 | struct inet_peer; |
| 52 | struct rtable | 52 | struct rtable { |
| 53 | { | 53 | union { |
| 54 | union | ||
| 55 | { | ||
| 56 | struct dst_entry dst; | 54 | struct dst_entry dst; |
| 57 | } u; | 55 | } u; |
| 58 | 56 | ||
| @@ -77,16 +75,14 @@ struct rtable | |||
| 77 | struct inet_peer *peer; /* long-living peer info */ | 75 | struct inet_peer *peer; /* long-living peer info */ |
| 78 | }; | 76 | }; |
| 79 | 77 | ||
| 80 | struct ip_rt_acct | 78 | struct ip_rt_acct { |
| 81 | { | ||
| 82 | __u32 o_bytes; | 79 | __u32 o_bytes; |
| 83 | __u32 o_packets; | 80 | __u32 o_packets; |
| 84 | __u32 i_bytes; | 81 | __u32 i_bytes; |
| 85 | __u32 i_packets; | 82 | __u32 i_packets; |
| 86 | }; | 83 | }; |
| 87 | 84 | ||
| 88 | struct rt_cache_stat | 85 | struct rt_cache_stat { |
| 89 | { | ||
| 90 | unsigned int in_hit; | 86 | unsigned int in_hit; |
| 91 | unsigned int in_slow_tot; | 87 | unsigned int in_slow_tot; |
| 92 | unsigned int in_slow_mc; | 88 | unsigned int in_slow_mc; |
| @@ -105,13 +101,14 @@ struct rt_cache_stat | |||
| 105 | unsigned int out_hlist_search; | 101 | unsigned int out_hlist_search; |
| 106 | }; | 102 | }; |
| 107 | 103 | ||
| 108 | extern struct ip_rt_acct *ip_rt_acct; | 104 | extern struct ip_rt_acct __percpu *ip_rt_acct; |
| 109 | 105 | ||
| 110 | struct in_device; | 106 | struct in_device; |
| 111 | extern int ip_rt_init(void); | 107 | extern int ip_rt_init(void); |
| 112 | extern void ip_rt_redirect(__be32 old_gw, __be32 dst, __be32 new_gw, | 108 | extern void ip_rt_redirect(__be32 old_gw, __be32 dst, __be32 new_gw, |
| 113 | __be32 src, struct net_device *dev); | 109 | __be32 src, struct net_device *dev); |
| 114 | extern void rt_cache_flush(struct net *net, int how); | 110 | extern void rt_cache_flush(struct net *net, int how); |
| 111 | extern void rt_cache_flush_batch(void); | ||
| 115 | extern int __ip_route_output_key(struct net *, struct rtable **, const struct flowi *flp); | 112 | extern int __ip_route_output_key(struct net *, struct rtable **, const struct flowi *flp); |
| 116 | extern int ip_route_output_key(struct net *, struct rtable **, struct flowi *flp); | 113 | extern int ip_route_output_key(struct net *, struct rtable **, struct flowi *flp); |
| 117 | extern int ip_route_output_flow(struct net *, struct rtable **rp, struct flowi *flp, struct sock *sk, int flags); | 114 | extern int ip_route_output_flow(struct net *, struct rtable **rp, struct flowi *flp, struct sock *sk, int flags); |
diff --git a/include/net/rtnetlink.h b/include/net/rtnetlink.h index c3aa044d3fc3..af60fd050844 100644 --- a/include/net/rtnetlink.h +++ b/include/net/rtnetlink.h | |||
| @@ -55,13 +55,15 @@ struct rtnl_link_ops { | |||
| 55 | int (*validate)(struct nlattr *tb[], | 55 | int (*validate)(struct nlattr *tb[], |
| 56 | struct nlattr *data[]); | 56 | struct nlattr *data[]); |
| 57 | 57 | ||
| 58 | int (*newlink)(struct net_device *dev, | 58 | int (*newlink)(struct net *src_net, |
| 59 | struct net_device *dev, | ||
| 59 | struct nlattr *tb[], | 60 | struct nlattr *tb[], |
| 60 | struct nlattr *data[]); | 61 | struct nlattr *data[]); |
| 61 | int (*changelink)(struct net_device *dev, | 62 | int (*changelink)(struct net_device *dev, |
| 62 | struct nlattr *tb[], | 63 | struct nlattr *tb[], |
| 63 | struct nlattr *data[]); | 64 | struct nlattr *data[]); |
| 64 | void (*dellink)(struct net_device *dev); | 65 | void (*dellink)(struct net_device *dev, |
| 66 | struct list_head *head); | ||
| 65 | 67 | ||
| 66 | size_t (*get_size)(const struct net_device *dev); | 68 | size_t (*get_size)(const struct net_device *dev); |
| 67 | int (*fill_info)(struct sk_buff *skb, | 69 | int (*fill_info)(struct sk_buff *skb, |
| @@ -82,8 +84,11 @@ extern void rtnl_kill_links(struct net *net, struct rtnl_link_ops *ops); | |||
| 82 | extern int rtnl_link_register(struct rtnl_link_ops *ops); | 84 | extern int rtnl_link_register(struct rtnl_link_ops *ops); |
| 83 | extern void rtnl_link_unregister(struct rtnl_link_ops *ops); | 85 | extern void rtnl_link_unregister(struct rtnl_link_ops *ops); |
| 84 | 86 | ||
| 85 | extern struct net_device *rtnl_create_link(struct net *net, char *ifname, | 87 | extern struct net *rtnl_link_get_net(struct net *src_net, struct nlattr *tb[]); |
| 86 | const struct rtnl_link_ops *ops, struct nlattr *tb[]); | 88 | extern struct net_device *rtnl_create_link(struct net *src_net, struct net *net, |
| 89 | char *ifname, const struct rtnl_link_ops *ops, struct nlattr *tb[]); | ||
| 90 | extern int rtnl_configure_link(struct net_device *dev, | ||
| 91 | const struct ifinfomsg *ifm); | ||
| 87 | extern const struct nla_policy ifla_policy[IFLA_MAX+1]; | 92 | extern const struct nla_policy ifla_policy[IFLA_MAX+1]; |
| 88 | 93 | ||
| 89 | #define MODULE_ALIAS_RTNL_LINK(kind) MODULE_ALIAS("rtnl-link-" kind) | 94 | #define MODULE_ALIAS_RTNL_LINK(kind) MODULE_ALIAS("rtnl-link-" kind) |
diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h index c33180dd42b4..67dc08eaaa45 100644 --- a/include/net/sch_generic.h +++ b/include/net/sch_generic.h | |||
| @@ -15,16 +15,14 @@ struct qdisc_walker; | |||
| 15 | struct tcf_walker; | 15 | struct tcf_walker; |
| 16 | struct module; | 16 | struct module; |
| 17 | 17 | ||
| 18 | struct qdisc_rate_table | 18 | struct qdisc_rate_table { |
| 19 | { | ||
| 20 | struct tc_ratespec rate; | 19 | struct tc_ratespec rate; |
| 21 | u32 data[256]; | 20 | u32 data[256]; |
| 22 | struct qdisc_rate_table *next; | 21 | struct qdisc_rate_table *next; |
| 23 | int refcnt; | 22 | int refcnt; |
| 24 | }; | 23 | }; |
| 25 | 24 | ||
| 26 | enum qdisc_state_t | 25 | enum qdisc_state_t { |
| 27 | { | ||
| 28 | __QDISC_STATE_RUNNING, | 26 | __QDISC_STATE_RUNNING, |
| 29 | __QDISC_STATE_SCHED, | 27 | __QDISC_STATE_SCHED, |
| 30 | __QDISC_STATE_DEACTIVATED, | 28 | __QDISC_STATE_DEACTIVATED, |
| @@ -37,8 +35,7 @@ struct qdisc_size_table { | |||
| 37 | u16 data[]; | 35 | u16 data[]; |
| 38 | }; | 36 | }; |
| 39 | 37 | ||
| 40 | struct Qdisc | 38 | struct Qdisc { |
| 41 | { | ||
| 42 | int (*enqueue)(struct sk_buff *skb, struct Qdisc *dev); | 39 | int (*enqueue)(struct sk_buff *skb, struct Qdisc *dev); |
| 43 | struct sk_buff * (*dequeue)(struct Qdisc *dev); | 40 | struct sk_buff * (*dequeue)(struct Qdisc *dev); |
| 44 | unsigned flags; | 41 | unsigned flags; |
| @@ -78,8 +75,7 @@ struct Qdisc | |||
| 78 | struct gnet_stats_queue qstats; | 75 | struct gnet_stats_queue qstats; |
| 79 | }; | 76 | }; |
| 80 | 77 | ||
| 81 | struct Qdisc_class_ops | 78 | struct Qdisc_class_ops { |
| 82 | { | ||
| 83 | /* Child qdisc manipulation */ | 79 | /* Child qdisc manipulation */ |
| 84 | struct netdev_queue * (*select_queue)(struct Qdisc *, struct tcmsg *); | 80 | struct netdev_queue * (*select_queue)(struct Qdisc *, struct tcmsg *); |
| 85 | int (*graft)(struct Qdisc *, unsigned long cl, | 81 | int (*graft)(struct Qdisc *, unsigned long cl, |
| @@ -108,8 +104,7 @@ struct Qdisc_class_ops | |||
| 108 | struct gnet_dump *); | 104 | struct gnet_dump *); |
| 109 | }; | 105 | }; |
| 110 | 106 | ||
| 111 | struct Qdisc_ops | 107 | struct Qdisc_ops { |
| 112 | { | ||
| 113 | struct Qdisc_ops *next; | 108 | struct Qdisc_ops *next; |
| 114 | const struct Qdisc_class_ops *cl_ops; | 109 | const struct Qdisc_class_ops *cl_ops; |
| 115 | char id[IFNAMSIZ]; | 110 | char id[IFNAMSIZ]; |
| @@ -133,14 +128,12 @@ struct Qdisc_ops | |||
| 133 | }; | 128 | }; |
| 134 | 129 | ||
| 135 | 130 | ||
| 136 | struct tcf_result | 131 | struct tcf_result { |
| 137 | { | ||
| 138 | unsigned long class; | 132 | unsigned long class; |
| 139 | u32 classid; | 133 | u32 classid; |
| 140 | }; | 134 | }; |
| 141 | 135 | ||
| 142 | struct tcf_proto_ops | 136 | struct tcf_proto_ops { |
| 143 | { | ||
| 144 | struct tcf_proto_ops *next; | 137 | struct tcf_proto_ops *next; |
| 145 | char kind[IFNAMSIZ]; | 138 | char kind[IFNAMSIZ]; |
| 146 | 139 | ||
| @@ -164,8 +157,7 @@ struct tcf_proto_ops | |||
| 164 | struct module *owner; | 157 | struct module *owner; |
| 165 | }; | 158 | }; |
| 166 | 159 | ||
| 167 | struct tcf_proto | 160 | struct tcf_proto { |
| 168 | { | ||
| 169 | /* Fast access part */ | 161 | /* Fast access part */ |
| 170 | struct tcf_proto *next; | 162 | struct tcf_proto *next; |
| 171 | void *root; | 163 | void *root; |
| @@ -261,14 +253,12 @@ extern struct Qdisc_ops noop_qdisc_ops; | |||
| 261 | extern struct Qdisc_ops pfifo_fast_ops; | 253 | extern struct Qdisc_ops pfifo_fast_ops; |
| 262 | extern struct Qdisc_ops mq_qdisc_ops; | 254 | extern struct Qdisc_ops mq_qdisc_ops; |
| 263 | 255 | ||
| 264 | struct Qdisc_class_common | 256 | struct Qdisc_class_common { |
| 265 | { | ||
| 266 | u32 classid; | 257 | u32 classid; |
| 267 | struct hlist_node hnode; | 258 | struct hlist_node hnode; |
| 268 | }; | 259 | }; |
| 269 | 260 | ||
| 270 | struct Qdisc_class_hash | 261 | struct Qdisc_class_hash { |
| 271 | { | ||
| 272 | struct hlist_head *hash; | 262 | struct hlist_head *hash; |
| 273 | unsigned int hashsize; | 263 | unsigned int hashsize; |
| 274 | unsigned int hashmask; | 264 | unsigned int hashmask; |
| @@ -437,6 +427,25 @@ static inline struct sk_buff *qdisc_dequeue_head(struct Qdisc *sch) | |||
| 437 | return __qdisc_dequeue_head(sch, &sch->q); | 427 | return __qdisc_dequeue_head(sch, &sch->q); |
| 438 | } | 428 | } |
| 439 | 429 | ||
| 430 | static inline unsigned int __qdisc_queue_drop_head(struct Qdisc *sch, | ||
| 431 | struct sk_buff_head *list) | ||
| 432 | { | ||
| 433 | struct sk_buff *skb = __qdisc_dequeue_head(sch, list); | ||
| 434 | |||
| 435 | if (likely(skb != NULL)) { | ||
| 436 | unsigned int len = qdisc_pkt_len(skb); | ||
| 437 | kfree_skb(skb); | ||
| 438 | return len; | ||
| 439 | } | ||
| 440 | |||
| 441 | return 0; | ||
| 442 | } | ||
| 443 | |||
| 444 | static inline unsigned int qdisc_queue_drop_head(struct Qdisc *sch) | ||
| 445 | { | ||
| 446 | return __qdisc_queue_drop_head(sch, &sch->q); | ||
| 447 | } | ||
| 448 | |||
| 440 | static inline struct sk_buff *__qdisc_dequeue_tail(struct Qdisc *sch, | 449 | static inline struct sk_buff *__qdisc_dequeue_tail(struct Qdisc *sch, |
| 441 | struct sk_buff_head *list) | 450 | struct sk_buff_head *list) |
| 442 | { | 451 | { |
diff --git a/include/net/scm.h b/include/net/scm.h index cf48c800e926..8360e47aa7e3 100644 --- a/include/net/scm.h +++ b/include/net/scm.h | |||
| @@ -12,15 +12,13 @@ | |||
| 12 | */ | 12 | */ |
| 13 | #define SCM_MAX_FD 255 | 13 | #define SCM_MAX_FD 255 |
| 14 | 14 | ||
| 15 | struct scm_fp_list | 15 | struct scm_fp_list { |
| 16 | { | ||
| 17 | struct list_head list; | 16 | struct list_head list; |
| 18 | int count; | 17 | int count; |
| 19 | struct file *fp[SCM_MAX_FD]; | 18 | struct file *fp[SCM_MAX_FD]; |
| 20 | }; | 19 | }; |
| 21 | 20 | ||
| 22 | struct scm_cookie | 21 | struct scm_cookie { |
| 23 | { | ||
| 24 | struct ucred creds; /* Skb credentials */ | 22 | struct ucred creds; /* Skb credentials */ |
| 25 | struct scm_fp_list *fp; /* Passed files */ | 23 | struct scm_fp_list *fp; /* Passed files */ |
| 26 | #ifdef CONFIG_SECURITY_NETWORK | 24 | #ifdef CONFIG_SECURITY_NETWORK |
| @@ -88,8 +86,7 @@ static inline void scm_passec(struct socket *sock, struct msghdr *msg, struct sc | |||
| 88 | static __inline__ void scm_recv(struct socket *sock, struct msghdr *msg, | 86 | static __inline__ void scm_recv(struct socket *sock, struct msghdr *msg, |
| 89 | struct scm_cookie *scm, int flags) | 87 | struct scm_cookie *scm, int flags) |
| 90 | { | 88 | { |
| 91 | if (!msg->msg_control) | 89 | if (!msg->msg_control) { |
| 92 | { | ||
| 93 | if (test_bit(SOCK_PASSCRED, &sock->flags) || scm->fp) | 90 | if (test_bit(SOCK_PASSCRED, &sock->flags) || scm->fp) |
| 94 | msg->msg_flags |= MSG_CTRUNC; | 91 | msg->msg_flags |= MSG_CTRUNC; |
| 95 | scm_destroy(scm); | 92 | scm_destroy(scm); |
diff --git a/include/net/sctp/command.h b/include/net/sctp/command.h index 8be5135ff7aa..2c55a7ea20af 100644 --- a/include/net/sctp/command.h +++ b/include/net/sctp/command.h | |||
| @@ -107,6 +107,7 @@ typedef enum { | |||
| 107 | SCTP_CMD_T1_RETRAN, /* Mark for retransmission after T1 timeout */ | 107 | SCTP_CMD_T1_RETRAN, /* Mark for retransmission after T1 timeout */ |
| 108 | SCTP_CMD_UPDATE_INITTAG, /* Update peer inittag */ | 108 | SCTP_CMD_UPDATE_INITTAG, /* Update peer inittag */ |
| 109 | SCTP_CMD_SEND_MSG, /* Send the whole use message */ | 109 | SCTP_CMD_SEND_MSG, /* Send the whole use message */ |
| 110 | SCTP_CMD_SEND_NEXT_ASCONF, /* Send the next ASCONF after ACK */ | ||
| 110 | SCTP_CMD_LAST | 111 | SCTP_CMD_LAST |
| 111 | } sctp_verb_t; | 112 | } sctp_verb_t; |
| 112 | 113 | ||
diff --git a/include/net/sctp/constants.h b/include/net/sctp/constants.h index 58f714a3b670..63908840eef0 100644 --- a/include/net/sctp/constants.h +++ b/include/net/sctp/constants.h | |||
| @@ -308,6 +308,10 @@ enum { SCTP_MAX_GABS = 16 }; | |||
| 308 | 308 | ||
| 309 | #define SCTP_DEFAULT_MINWINDOW 1500 /* default minimum rwnd size */ | 309 | #define SCTP_DEFAULT_MINWINDOW 1500 /* default minimum rwnd size */ |
| 310 | #define SCTP_DEFAULT_MAXWINDOW 65535 /* default rwnd size */ | 310 | #define SCTP_DEFAULT_MAXWINDOW 65535 /* default rwnd size */ |
| 311 | #define SCTP_DEFAULT_RWND_SHIFT 4 /* by default, update on 1/16 of | ||
| 312 | * rcvbuf, which is 1/8 of initial | ||
| 313 | * window | ||
| 314 | */ | ||
| 311 | #define SCTP_DEFAULT_MAXSEGMENT 1500 /* MTU size, this is the limit | 315 | #define SCTP_DEFAULT_MAXSEGMENT 1500 /* MTU size, this is the limit |
| 312 | * to which we will raise the P-MTU. | 316 | * to which we will raise the P-MTU. |
| 313 | */ | 317 | */ |
diff --git a/include/net/sctp/sctp.h b/include/net/sctp/sctp.h index 8a6d5297de16..fa6cde578a1d 100644 --- a/include/net/sctp/sctp.h +++ b/include/net/sctp/sctp.h | |||
| @@ -128,6 +128,7 @@ extern int sctp_register_pf(struct sctp_pf *, sa_family_t); | |||
| 128 | int sctp_backlog_rcv(struct sock *sk, struct sk_buff *skb); | 128 | int sctp_backlog_rcv(struct sock *sk, struct sk_buff *skb); |
| 129 | int sctp_inet_listen(struct socket *sock, int backlog); | 129 | int sctp_inet_listen(struct socket *sock, int backlog); |
| 130 | void sctp_write_space(struct sock *sk); | 130 | void sctp_write_space(struct sock *sk); |
| 131 | void sctp_data_ready(struct sock *sk, int len); | ||
| 131 | unsigned int sctp_poll(struct file *file, struct socket *sock, | 132 | unsigned int sctp_poll(struct file *file, struct socket *sock, |
| 132 | poll_table *wait); | 133 | poll_table *wait); |
| 133 | void sctp_sock_rfree(struct sk_buff *skb); | 134 | void sctp_sock_rfree(struct sk_buff *skb); |
| @@ -227,8 +228,7 @@ DECLARE_SNMP_STAT(struct sctp_mib, sctp_statistics); | |||
| 227 | #endif /* !TEST_FRAME */ | 228 | #endif /* !TEST_FRAME */ |
| 228 | 229 | ||
| 229 | /* sctp mib definitions */ | 230 | /* sctp mib definitions */ |
| 230 | enum | 231 | enum { |
| 231 | { | ||
| 232 | SCTP_MIB_NUM = 0, | 232 | SCTP_MIB_NUM = 0, |
| 233 | SCTP_MIB_CURRESTAB, /* CurrEstab */ | 233 | SCTP_MIB_CURRESTAB, /* CurrEstab */ |
| 234 | SCTP_MIB_ACTIVEESTABS, /* ActiveEstabs */ | 234 | SCTP_MIB_ACTIVEESTABS, /* ActiveEstabs */ |
diff --git a/include/net/sctp/sm.h b/include/net/sctp/sm.h index c1dd89365833..61d73e37d543 100644 --- a/include/net/sctp/sm.h +++ b/include/net/sctp/sm.h | |||
| @@ -243,7 +243,8 @@ struct sctp_chunk *sctp_make_op_error(const struct sctp_association *, | |||
| 243 | const struct sctp_chunk *chunk, | 243 | const struct sctp_chunk *chunk, |
| 244 | __be16 cause_code, | 244 | __be16 cause_code, |
| 245 | const void *payload, | 245 | const void *payload, |
| 246 | size_t paylen); | 246 | size_t paylen, |
| 247 | size_t reserve_tail); | ||
| 247 | 248 | ||
| 248 | struct sctp_chunk *sctp_make_asconf_update_ip(struct sctp_association *, | 249 | struct sctp_chunk *sctp_make_asconf_update_ip(struct sctp_association *, |
| 249 | union sctp_addr *, | 250 | union sctp_addr *, |
| @@ -278,6 +279,7 @@ int sctp_do_sm(sctp_event_t event_type, sctp_subtype_t subtype, | |||
| 278 | /* 2nd level prototypes */ | 279 | /* 2nd level prototypes */ |
| 279 | void sctp_generate_t3_rtx_event(unsigned long peer); | 280 | void sctp_generate_t3_rtx_event(unsigned long peer); |
| 280 | void sctp_generate_heartbeat_event(unsigned long peer); | 281 | void sctp_generate_heartbeat_event(unsigned long peer); |
| 282 | void sctp_generate_proto_unreach_event(unsigned long peer); | ||
| 281 | 283 | ||
| 282 | void sctp_ootb_pkt_free(struct sctp_packet *); | 284 | void sctp_ootb_pkt_free(struct sctp_packet *); |
| 283 | 285 | ||
diff --git a/include/net/sctp/structs.h b/include/net/sctp/structs.h index 0a474568b003..219043a67bf7 100644 --- a/include/net/sctp/structs.h +++ b/include/net/sctp/structs.h | |||
| @@ -231,6 +231,11 @@ extern struct sctp_globals { | |||
| 231 | /* Flag to indicate whether computing and verifying checksum | 231 | /* Flag to indicate whether computing and verifying checksum |
| 232 | * is disabled. */ | 232 | * is disabled. */ |
| 233 | int checksum_disable; | 233 | int checksum_disable; |
| 234 | |||
| 235 | /* Threshold for rwnd update SACKS. Receive buffer shifted this many | ||
| 236 | * bits is an indicator of when to send and window update SACK. | ||
| 237 | */ | ||
| 238 | int rwnd_update_shift; | ||
| 234 | } sctp_globals; | 239 | } sctp_globals; |
| 235 | 240 | ||
| 236 | #define sctp_rto_initial (sctp_globals.rto_initial) | 241 | #define sctp_rto_initial (sctp_globals.rto_initial) |
| @@ -267,6 +272,7 @@ extern struct sctp_globals { | |||
| 267 | #define sctp_prsctp_enable (sctp_globals.prsctp_enable) | 272 | #define sctp_prsctp_enable (sctp_globals.prsctp_enable) |
| 268 | #define sctp_auth_enable (sctp_globals.auth_enable) | 273 | #define sctp_auth_enable (sctp_globals.auth_enable) |
| 269 | #define sctp_checksum_disable (sctp_globals.checksum_disable) | 274 | #define sctp_checksum_disable (sctp_globals.checksum_disable) |
| 275 | #define sctp_rwnd_upd_shift (sctp_globals.rwnd_update_shift) | ||
| 270 | 276 | ||
| 271 | /* SCTP Socket type: UDP or TCP style. */ | 277 | /* SCTP Socket type: UDP or TCP style. */ |
| 272 | typedef enum { | 278 | typedef enum { |
| @@ -772,6 +778,7 @@ int sctp_user_addto_chunk(struct sctp_chunk *chunk, int off, int len, | |||
| 772 | struct iovec *data); | 778 | struct iovec *data); |
| 773 | void sctp_chunk_free(struct sctp_chunk *); | 779 | void sctp_chunk_free(struct sctp_chunk *); |
| 774 | void *sctp_addto_chunk(struct sctp_chunk *, int len, const void *data); | 780 | void *sctp_addto_chunk(struct sctp_chunk *, int len, const void *data); |
| 781 | void *sctp_addto_chunk_fixed(struct sctp_chunk *, int len, const void *data); | ||
| 775 | struct sctp_chunk *sctp_chunkify(struct sk_buff *, | 782 | struct sctp_chunk *sctp_chunkify(struct sk_buff *, |
| 776 | const struct sctp_association *, | 783 | const struct sctp_association *, |
| 777 | struct sock *); | 784 | struct sock *); |
| @@ -935,6 +942,8 @@ struct sctp_transport { | |||
| 935 | /* Data that has been sent, but not acknowledged. */ | 942 | /* Data that has been sent, but not acknowledged. */ |
| 936 | __u32 flight_size; | 943 | __u32 flight_size; |
| 937 | 944 | ||
| 945 | __u32 burst_limited; /* Holds old cwnd when max.burst is applied */ | ||
| 946 | |||
| 938 | /* TSN marking the fast recovery exit point */ | 947 | /* TSN marking the fast recovery exit point */ |
| 939 | __u32 fast_recovery_exit; | 948 | __u32 fast_recovery_exit; |
| 940 | 949 | ||
| @@ -943,12 +952,6 @@ struct sctp_transport { | |||
| 943 | /* Source address. */ | 952 | /* Source address. */ |
| 944 | union sctp_addr saddr; | 953 | union sctp_addr saddr; |
| 945 | 954 | ||
| 946 | /* When was the last time(in jiffies) that a data packet was sent on | ||
| 947 | * this transport? This is used to adjust the cwnd when the transport | ||
| 948 | * becomes inactive. | ||
| 949 | */ | ||
| 950 | unsigned long last_time_used; | ||
| 951 | |||
| 952 | /* Heartbeat interval: The endpoint sends out a Heartbeat chunk to | 955 | /* Heartbeat interval: The endpoint sends out a Heartbeat chunk to |
| 953 | * the destination address every heartbeat interval. | 956 | * the destination address every heartbeat interval. |
| 954 | */ | 957 | */ |
| @@ -987,7 +990,7 @@ struct sctp_transport { | |||
| 987 | int init_sent_count; | 990 | int init_sent_count; |
| 988 | 991 | ||
| 989 | /* state : The current state of this destination, | 992 | /* state : The current state of this destination, |
| 990 | * : i.e. SCTP_ACTIVE, SCTP_INACTIVE, SCTP_UNKOWN. | 993 | * : i.e. SCTP_ACTIVE, SCTP_INACTIVE, SCTP_UNKNOWN. |
| 991 | */ | 994 | */ |
| 992 | int state; | 995 | int state; |
| 993 | 996 | ||
| @@ -1007,6 +1010,9 @@ struct sctp_transport { | |||
| 1007 | /* Heartbeat timer is per destination. */ | 1010 | /* Heartbeat timer is per destination. */ |
| 1008 | struct timer_list hb_timer; | 1011 | struct timer_list hb_timer; |
| 1009 | 1012 | ||
| 1013 | /* Timer to handle ICMP proto unreachable envets */ | ||
| 1014 | struct timer_list proto_unreach_timer; | ||
| 1015 | |||
| 1010 | /* Since we're using per-destination retransmission timers | 1016 | /* Since we're using per-destination retransmission timers |
| 1011 | * (see above), we're also using per-destination "transmitted" | 1017 | * (see above), we're also using per-destination "transmitted" |
| 1012 | * queues. This probably ought to be a private struct | 1018 | * queues. This probably ought to be a private struct |
| @@ -1069,6 +1075,8 @@ void sctp_transport_put(struct sctp_transport *); | |||
| 1069 | void sctp_transport_update_rto(struct sctp_transport *, __u32); | 1075 | void sctp_transport_update_rto(struct sctp_transport *, __u32); |
| 1070 | void sctp_transport_raise_cwnd(struct sctp_transport *, __u32, __u32); | 1076 | void sctp_transport_raise_cwnd(struct sctp_transport *, __u32, __u32); |
| 1071 | void sctp_transport_lower_cwnd(struct sctp_transport *, sctp_lower_cwnd_t); | 1077 | void sctp_transport_lower_cwnd(struct sctp_transport *, sctp_lower_cwnd_t); |
| 1078 | void sctp_transport_burst_limited(struct sctp_transport *); | ||
| 1079 | void sctp_transport_burst_reset(struct sctp_transport *); | ||
| 1072 | unsigned long sctp_transport_timeout(struct sctp_transport *); | 1080 | unsigned long sctp_transport_timeout(struct sctp_transport *); |
| 1073 | void sctp_transport_reset(struct sctp_transport *); | 1081 | void sctp_transport_reset(struct sctp_transport *); |
| 1074 | void sctp_transport_update_pmtu(struct sctp_transport *, u32); | 1082 | void sctp_transport_update_pmtu(struct sctp_transport *, u32); |
diff --git a/include/net/sctp/user.h b/include/net/sctp/user.h index be2334aaf52e..2b2769c5ca9f 100644 --- a/include/net/sctp/user.h +++ b/include/net/sctp/user.h | |||
| @@ -60,96 +60,49 @@ typedef __s32 sctp_assoc_t; | |||
| 60 | /* The following symbols come from the Sockets API Extensions for | 60 | /* The following symbols come from the Sockets API Extensions for |
| 61 | * SCTP <draft-ietf-tsvwg-sctpsocket-07.txt>. | 61 | * SCTP <draft-ietf-tsvwg-sctpsocket-07.txt>. |
| 62 | */ | 62 | */ |
| 63 | enum sctp_optname { | 63 | #define SCTP_RTOINFO 0 |
| 64 | SCTP_RTOINFO, | 64 | #define SCTP_ASSOCINFO 1 |
| 65 | #define SCTP_RTOINFO SCTP_RTOINFO | 65 | #define SCTP_INITMSG 2 |
| 66 | SCTP_ASSOCINFO, | 66 | #define SCTP_NODELAY 3 /* Get/set nodelay option. */ |
| 67 | #define SCTP_ASSOCINFO SCTP_ASSOCINFO | 67 | #define SCTP_AUTOCLOSE 4 |
| 68 | SCTP_INITMSG, | 68 | #define SCTP_SET_PEER_PRIMARY_ADDR 5 |
| 69 | #define SCTP_INITMSG SCTP_INITMSG | 69 | #define SCTP_PRIMARY_ADDR 6 |
| 70 | SCTP_NODELAY, /* Get/set nodelay option. */ | 70 | #define SCTP_ADAPTATION_LAYER 7 |
| 71 | #define SCTP_NODELAY SCTP_NODELAY | 71 | #define SCTP_DISABLE_FRAGMENTS 8 |
| 72 | SCTP_AUTOCLOSE, | 72 | #define SCTP_PEER_ADDR_PARAMS 9 |
| 73 | #define SCTP_AUTOCLOSE SCTP_AUTOCLOSE | 73 | #define SCTP_DEFAULT_SEND_PARAM 10 |
| 74 | SCTP_SET_PEER_PRIMARY_ADDR, | 74 | #define SCTP_EVENTS 11 |
| 75 | #define SCTP_SET_PEER_PRIMARY_ADDR SCTP_SET_PEER_PRIMARY_ADDR | 75 | #define SCTP_I_WANT_MAPPED_V4_ADDR 12 /* Turn on/off mapped v4 addresses */ |
| 76 | SCTP_PRIMARY_ADDR, | 76 | #define SCTP_MAXSEG 13 /* Get/set maximum fragment. */ |
| 77 | #define SCTP_PRIMARY_ADDR SCTP_PRIMARY_ADDR | 77 | #define SCTP_STATUS 14 |
| 78 | SCTP_ADAPTATION_LAYER, | 78 | #define SCTP_GET_PEER_ADDR_INFO 15 |
| 79 | #define SCTP_ADAPTATION_LAYER SCTP_ADAPTATION_LAYER | 79 | #define SCTP_DELAYED_ACK_TIME 16 |
| 80 | SCTP_DISABLE_FRAGMENTS, | 80 | #define SCTP_DELAYED_ACK SCTP_DELAYED_ACK_TIME |
| 81 | #define SCTP_DISABLE_FRAGMENTS SCTP_DISABLE_FRAGMENTS | 81 | #define SCTP_CONTEXT 17 |
| 82 | SCTP_PEER_ADDR_PARAMS, | 82 | #define SCTP_FRAGMENT_INTERLEAVE 18 |
| 83 | #define SCTP_PEER_ADDR_PARAMS SCTP_PEER_ADDR_PARAMS | 83 | #define SCTP_PARTIAL_DELIVERY_POINT 19 /* Set/Get partial delivery point */ |
| 84 | SCTP_DEFAULT_SEND_PARAM, | 84 | #define SCTP_MAX_BURST 20 /* Set/Get max burst */ |
| 85 | #define SCTP_DEFAULT_SEND_PARAM SCTP_DEFAULT_SEND_PARAM | 85 | #define SCTP_AUTH_CHUNK 21 /* Set only: add a chunk type to authenticate */ |
| 86 | SCTP_EVENTS, | 86 | #define SCTP_HMAC_IDENT 22 |
| 87 | #define SCTP_EVENTS SCTP_EVENTS | 87 | #define SCTP_AUTH_KEY 23 |
| 88 | SCTP_I_WANT_MAPPED_V4_ADDR, /* Turn on/off mapped v4 addresses */ | 88 | #define SCTP_AUTH_ACTIVE_KEY 24 |
| 89 | #define SCTP_I_WANT_MAPPED_V4_ADDR SCTP_I_WANT_MAPPED_V4_ADDR | 89 | #define SCTP_AUTH_DELETE_KEY 25 |
| 90 | SCTP_MAXSEG, /* Get/set maximum fragment. */ | 90 | #define SCTP_PEER_AUTH_CHUNKS 26 /* Read only */ |
| 91 | #define SCTP_MAXSEG SCTP_MAXSEG | 91 | #define SCTP_LOCAL_AUTH_CHUNKS 27 /* Read only */ |
| 92 | SCTP_STATUS, | 92 | #define SCTP_GET_ASSOC_NUMBER 28 /* Read only */ |
| 93 | #define SCTP_STATUS SCTP_STATUS | 93 | |
| 94 | SCTP_GET_PEER_ADDR_INFO, | 94 | /* Internal Socket Options. Some of the sctp library functions are |
| 95 | #define SCTP_GET_PEER_ADDR_INFO SCTP_GET_PEER_ADDR_INFO | 95 | * implemented using these socket options. |
| 96 | SCTP_DELAYED_ACK, | 96 | */ |
| 97 | #define SCTP_DELAYED_ACK_TIME SCTP_DELAYED_ACK | 97 | #define SCTP_SOCKOPT_BINDX_ADD 100 /* BINDX requests for adding addrs */ |
| 98 | #define SCTP_DELAYED_ACK SCTP_DELAYED_ACK | 98 | #define SCTP_SOCKOPT_BINDX_REM 101 /* BINDX requests for removing addrs. */ |
| 99 | SCTP_CONTEXT, /* Receive Context */ | 99 | #define SCTP_SOCKOPT_PEELOFF 102 /* peel off association. */ |
| 100 | #define SCTP_CONTEXT SCTP_CONTEXT | 100 | /* Options 104-106 are deprecated and removed. Do not use this space */ |
| 101 | SCTP_FRAGMENT_INTERLEAVE, | 101 | #define SCTP_SOCKOPT_CONNECTX_OLD 107 /* CONNECTX old requests. */ |
| 102 | #define SCTP_FRAGMENT_INTERLEAVE SCTP_FRAGMENT_INTERLEAVE | 102 | #define SCTP_GET_PEER_ADDRS 108 /* Get all peer addresss. */ |
| 103 | SCTP_PARTIAL_DELIVERY_POINT, /* Set/Get partial delivery point */ | 103 | #define SCTP_GET_LOCAL_ADDRS 109 /* Get all local addresss. */ |
| 104 | #define SCTP_PARTIAL_DELIVERY_POINT SCTP_PARTIAL_DELIVERY_POINT | 104 | #define SCTP_SOCKOPT_CONNECTX 110 /* CONNECTX requests. */ |
| 105 | SCTP_MAX_BURST, /* Set/Get max burst */ | 105 | #define SCTP_SOCKOPT_CONNECTX3 111 /* CONNECTX requests (updated) */ |
| 106 | #define SCTP_MAX_BURST SCTP_MAX_BURST | ||
| 107 | SCTP_AUTH_CHUNK, /* Set only: add a chunk type to authenticat */ | ||
| 108 | #define SCTP_AUTH_CHUNK SCTP_AUTH_CHUNK | ||
| 109 | SCTP_HMAC_IDENT, | ||
| 110 | #define SCTP_HMAC_IDENT SCTP_HMAC_IDENT | ||
| 111 | SCTP_AUTH_KEY, | ||
| 112 | #define SCTP_AUTH_KEY SCTP_AUTH_KEY | ||
| 113 | SCTP_AUTH_ACTIVE_KEY, | ||
| 114 | #define SCTP_AUTH_ACTIVE_KEY SCTP_AUTH_ACTIVE_KEY | ||
| 115 | SCTP_AUTH_DELETE_KEY, | ||
| 116 | #define SCTP_AUTH_DELETE_KEY SCTP_AUTH_DELETE_KEY | ||
| 117 | SCTP_PEER_AUTH_CHUNKS, /* Read only */ | ||
| 118 | #define SCTP_PEER_AUTH_CHUNKS SCTP_PEER_AUTH_CHUNKS | ||
| 119 | SCTP_LOCAL_AUTH_CHUNKS, /* Read only */ | ||
| 120 | #define SCTP_LOCAL_AUTH_CHUNKS SCTP_LOCAL_AUTH_CHUNKS | ||
| 121 | SCTP_GET_ASSOC_NUMBER, /* Read only */ | ||
| 122 | #define SCTP_GET_ASSOC_NUMBER SCTP_GET_ASSOC_NUMBER | ||
| 123 | |||
| 124 | |||
| 125 | /* Internal Socket Options. Some of the sctp library functions are | ||
| 126 | * implemented using these socket options. | ||
| 127 | */ | ||
| 128 | SCTP_SOCKOPT_BINDX_ADD = 100,/* BINDX requests for adding addresses. */ | ||
| 129 | #define SCTP_SOCKOPT_BINDX_ADD SCTP_SOCKOPT_BINDX_ADD | ||
| 130 | SCTP_SOCKOPT_BINDX_REM, /* BINDX requests for removing addresses. */ | ||
| 131 | #define SCTP_SOCKOPT_BINDX_REM SCTP_SOCKOPT_BINDX_REM | ||
| 132 | SCTP_SOCKOPT_PEELOFF, /* peel off association. */ | ||
| 133 | #define SCTP_SOCKOPT_PEELOFF SCTP_SOCKOPT_PEELOFF | ||
| 134 | SCTP_GET_PEER_ADDRS_NUM_OLD, /* Get number of peer addresss. */ | ||
| 135 | #define SCTP_GET_PEER_ADDRS_NUM_OLD SCTP_GET_PEER_ADDRS_NUM_OLD | ||
| 136 | SCTP_GET_PEER_ADDRS_OLD, /* Get all peer addresss. */ | ||
| 137 | #define SCTP_GET_PEER_ADDRS_OLD SCTP_GET_PEER_ADDRS_OLD | ||
| 138 | SCTP_GET_LOCAL_ADDRS_NUM_OLD, /* Get number of local addresss. */ | ||
| 139 | #define SCTP_GET_LOCAL_ADDRS_NUM_OLD SCTP_GET_LOCAL_ADDRS_NUM_OLD | ||
| 140 | SCTP_GET_LOCAL_ADDRS_OLD, /* Get all local addresss. */ | ||
| 141 | #define SCTP_GET_LOCAL_ADDRS_OLD SCTP_GET_LOCAL_ADDRS_OLD | ||
| 142 | SCTP_SOCKOPT_CONNECTX_OLD, /* CONNECTX old requests. */ | ||
| 143 | #define SCTP_SOCKOPT_CONNECTX_OLD SCTP_SOCKOPT_CONNECTX_OLD | ||
| 144 | SCTP_GET_PEER_ADDRS, /* Get all peer addresss. */ | ||
| 145 | #define SCTP_GET_PEER_ADDRS SCTP_GET_PEER_ADDRS | ||
| 146 | SCTP_GET_LOCAL_ADDRS, /* Get all local addresss. */ | ||
| 147 | #define SCTP_GET_LOCAL_ADDRS SCTP_GET_LOCAL_ADDRS | ||
| 148 | SCTP_SOCKOPT_CONNECTX, /* CONNECTX requests. */ | ||
| 149 | #define SCTP_SOCKOPT_CONNECTX SCTP_SOCKOPT_CONNECTX | ||
| 150 | SCTP_SOCKOPT_CONNECTX3, /* CONNECTX requests. (new implementation) */ | ||
| 151 | #define SCTP_SOCKOPT_CONNECTX3 SCTP_SOCKOPT_CONNECTX3 | ||
| 152 | }; | ||
| 153 | 106 | ||
| 154 | /* | 107 | /* |
| 155 | * 5.2.1 SCTP Initiation Structure (SCTP_INIT) | 108 | * 5.2.1 SCTP Initiation Structure (SCTP_INIT) |
| @@ -206,6 +159,7 @@ enum sctp_sinfo_flags { | |||
| 206 | SCTP_UNORDERED = 1, /* Send/receive message unordered. */ | 159 | SCTP_UNORDERED = 1, /* Send/receive message unordered. */ |
| 207 | SCTP_ADDR_OVER = 2, /* Override the primary destination. */ | 160 | SCTP_ADDR_OVER = 2, /* Override the primary destination. */ |
| 208 | SCTP_ABORT=4, /* Send an ABORT message to the peer. */ | 161 | SCTP_ABORT=4, /* Send an ABORT message to the peer. */ |
| 162 | SCTP_SACK_IMMEDIATELY = 8, /* SACK should be sent without delay */ | ||
| 209 | SCTP_EOF=MSG_FIN, /* Initiate graceful shutdown process. */ | 163 | SCTP_EOF=MSG_FIN, /* Initiate graceful shutdown process. */ |
| 210 | }; | 164 | }; |
| 211 | 165 | ||
diff --git a/include/net/snmp.h b/include/net/snmp.h index 8c842e06bec8..692ee0061dc4 100644 --- a/include/net/snmp.h +++ b/include/net/snmp.h | |||
| @@ -32,7 +32,7 @@ | |||
| 32 | * - name of entries. | 32 | * - name of entries. |
| 33 | */ | 33 | */ |
| 34 | struct snmp_mib { | 34 | struct snmp_mib { |
| 35 | char *name; | 35 | const char *name; |
| 36 | int entry; | 36 | int entry; |
| 37 | }; | 37 | }; |
| 38 | 38 | ||
| @@ -129,52 +129,42 @@ struct linux_xfrm_mib { | |||
| 129 | * nonlocked_atomic_inc() primitives -AK | 129 | * nonlocked_atomic_inc() primitives -AK |
| 130 | */ | 130 | */ |
| 131 | #define DEFINE_SNMP_STAT(type, name) \ | 131 | #define DEFINE_SNMP_STAT(type, name) \ |
| 132 | __typeof__(type) *name[2] | 132 | __typeof__(type) __percpu *name[2] |
| 133 | #define DECLARE_SNMP_STAT(type, name) \ | 133 | #define DECLARE_SNMP_STAT(type, name) \ |
| 134 | extern __typeof__(type) *name[2] | 134 | extern __typeof__(type) __percpu *name[2] |
| 135 | 135 | ||
| 136 | #define SNMP_STAT_BHPTR(name) (name[0]) | 136 | #define SNMP_STAT_BHPTR(name) (name[0]) |
| 137 | #define SNMP_STAT_USRPTR(name) (name[1]) | 137 | #define SNMP_STAT_USRPTR(name) (name[1]) |
| 138 | 138 | ||
| 139 | #define SNMP_INC_STATS_BH(mib, field) \ | 139 | #define SNMP_INC_STATS_BH(mib, field) \ |
| 140 | (per_cpu_ptr(mib[0], raw_smp_processor_id())->mibs[field]++) | 140 | __this_cpu_inc(mib[0]->mibs[field]) |
| 141 | #define SNMP_INC_STATS_USER(mib, field) \ | 141 | #define SNMP_INC_STATS_USER(mib, field) \ |
| 142 | do { \ | 142 | this_cpu_inc(mib[1]->mibs[field]) |
| 143 | per_cpu_ptr(mib[1], get_cpu())->mibs[field]++; \ | 143 | #define SNMP_INC_STATS(mib, field) \ |
| 144 | put_cpu(); \ | 144 | this_cpu_inc(mib[!in_softirq()]->mibs[field]) |
| 145 | } while (0) | 145 | #define SNMP_DEC_STATS(mib, field) \ |
| 146 | #define SNMP_INC_STATS(mib, field) \ | 146 | this_cpu_dec(mib[!in_softirq()]->mibs[field]) |
| 147 | do { \ | 147 | #define SNMP_ADD_STATS_BH(mib, field, addend) \ |
| 148 | per_cpu_ptr(mib[!in_softirq()], get_cpu())->mibs[field]++; \ | 148 | __this_cpu_add(mib[0]->mibs[field], addend) |
| 149 | put_cpu(); \ | 149 | #define SNMP_ADD_STATS_USER(mib, field, addend) \ |
| 150 | } while (0) | 150 | this_cpu_add(mib[1]->mibs[field], addend) |
| 151 | #define SNMP_DEC_STATS(mib, field) \ | 151 | /* |
| 152 | do { \ | 152 | * Use "__typeof__(*mib[0]) *ptr" instead of "__typeof__(mib[0]) ptr" |
| 153 | per_cpu_ptr(mib[!in_softirq()], get_cpu())->mibs[field]--; \ | 153 | * to make @ptr a non-percpu pointer. |
| 154 | put_cpu(); \ | 154 | */ |
| 155 | } while (0) | ||
| 156 | #define SNMP_ADD_STATS(mib, field, addend) \ | ||
| 157 | do { \ | ||
| 158 | per_cpu_ptr(mib[!in_softirq()], get_cpu())->mibs[field] += addend; \ | ||
| 159 | put_cpu(); \ | ||
| 160 | } while (0) | ||
| 161 | #define SNMP_ADD_STATS_BH(mib, field, addend) \ | ||
| 162 | (per_cpu_ptr(mib[0], raw_smp_processor_id())->mibs[field] += addend) | ||
| 163 | #define SNMP_ADD_STATS_USER(mib, field, addend) \ | ||
| 164 | do { \ | ||
| 165 | per_cpu_ptr(mib[1], get_cpu())->mibs[field] += addend; \ | ||
| 166 | put_cpu(); \ | ||
| 167 | } while (0) | ||
| 168 | #define SNMP_UPD_PO_STATS(mib, basefield, addend) \ | 155 | #define SNMP_UPD_PO_STATS(mib, basefield, addend) \ |
| 169 | do { \ | 156 | do { \ |
| 170 | __typeof__(mib[0]) ptr = per_cpu_ptr(mib[!in_softirq()], get_cpu());\ | 157 | __typeof__(*mib[0]) *ptr; \ |
| 158 | preempt_disable(); \ | ||
| 159 | ptr = this_cpu_ptr((mib)[!in_softirq()]); \ | ||
| 171 | ptr->mibs[basefield##PKTS]++; \ | 160 | ptr->mibs[basefield##PKTS]++; \ |
| 172 | ptr->mibs[basefield##OCTETS] += addend;\ | 161 | ptr->mibs[basefield##OCTETS] += addend;\ |
| 173 | put_cpu(); \ | 162 | preempt_enable(); \ |
| 174 | } while (0) | 163 | } while (0) |
| 175 | #define SNMP_UPD_PO_STATS_BH(mib, basefield, addend) \ | 164 | #define SNMP_UPD_PO_STATS_BH(mib, basefield, addend) \ |
| 176 | do { \ | 165 | do { \ |
| 177 | __typeof__(mib[0]) ptr = per_cpu_ptr(mib[!in_softirq()], raw_smp_processor_id());\ | 166 | __typeof__(*mib[0]) *ptr = \ |
| 167 | __this_cpu_ptr((mib)[!in_softirq()]); \ | ||
| 178 | ptr->mibs[basefield##PKTS]++; \ | 168 | ptr->mibs[basefield##PKTS]++; \ |
| 179 | ptr->mibs[basefield##OCTETS] += addend;\ | 169 | ptr->mibs[basefield##OCTETS] += addend;\ |
| 180 | } while (0) | 170 | } while (0) |
diff --git a/include/net/sock.h b/include/net/sock.h index 9f96394f694e..1ad6435f252e 100644 --- a/include/net/sock.h +++ b/include/net/sock.h | |||
| @@ -51,6 +51,7 @@ | |||
| 51 | #include <linux/skbuff.h> /* struct sk_buff */ | 51 | #include <linux/skbuff.h> /* struct sk_buff */ |
| 52 | #include <linux/mm.h> | 52 | #include <linux/mm.h> |
| 53 | #include <linux/security.h> | 53 | #include <linux/security.h> |
| 54 | #include <linux/slab.h> | ||
| 54 | 55 | ||
| 55 | #include <linux/filter.h> | 56 | #include <linux/filter.h> |
| 56 | #include <linux/rculist_nulls.h> | 57 | #include <linux/rculist_nulls.h> |
| @@ -73,7 +74,7 @@ | |||
| 73 | printk(KERN_DEBUG msg); } while (0) | 74 | printk(KERN_DEBUG msg); } while (0) |
| 74 | #else | 75 | #else |
| 75 | /* Validate arguments and do nothing */ | 76 | /* Validate arguments and do nothing */ |
| 76 | static void inline int __attribute__ ((format (printf, 2, 3))) | 77 | static inline void __attribute__ ((format (printf, 2, 3))) |
| 77 | SOCK_DEBUG(struct sock *sk, const char *msg, ...) | 78 | SOCK_DEBUG(struct sock *sk, const char *msg, ...) |
| 78 | { | 79 | { |
| 79 | } | 80 | } |
| @@ -105,14 +106,17 @@ struct net; | |||
| 105 | /** | 106 | /** |
| 106 | * struct sock_common - minimal network layer representation of sockets | 107 | * struct sock_common - minimal network layer representation of sockets |
| 107 | * @skc_node: main hash linkage for various protocol lookup tables | 108 | * @skc_node: main hash linkage for various protocol lookup tables |
| 108 | * @skc_nulls_node: main hash linkage for UDP/UDP-Lite protocol | 109 | * @skc_nulls_node: main hash linkage for TCP/UDP/UDP-Lite protocol |
| 109 | * @skc_refcnt: reference count | 110 | * @skc_refcnt: reference count |
| 111 | * @skc_tx_queue_mapping: tx queue number for this connection | ||
| 110 | * @skc_hash: hash value used with various protocol lookup tables | 112 | * @skc_hash: hash value used with various protocol lookup tables |
| 113 | * @skc_u16hashes: two u16 hash values used by UDP lookup tables | ||
| 111 | * @skc_family: network address family | 114 | * @skc_family: network address family |
| 112 | * @skc_state: Connection state | 115 | * @skc_state: Connection state |
| 113 | * @skc_reuse: %SO_REUSEADDR setting | 116 | * @skc_reuse: %SO_REUSEADDR setting |
| 114 | * @skc_bound_dev_if: bound device index if != 0 | 117 | * @skc_bound_dev_if: bound device index if != 0 |
| 115 | * @skc_bind_node: bind hash linkage for various protocol lookup tables | 118 | * @skc_bind_node: bind hash linkage for various protocol lookup tables |
| 119 | * @skc_portaddr_node: second hash linkage for UDP/UDP-Lite protocol | ||
| 116 | * @skc_prot: protocol handlers inside a network family | 120 | * @skc_prot: protocol handlers inside a network family |
| 117 | * @skc_net: reference to the network namespace of this socket | 121 | * @skc_net: reference to the network namespace of this socket |
| 118 | * | 122 | * |
| @@ -128,13 +132,20 @@ struct sock_common { | |||
| 128 | struct hlist_nulls_node skc_nulls_node; | 132 | struct hlist_nulls_node skc_nulls_node; |
| 129 | }; | 133 | }; |
| 130 | atomic_t skc_refcnt; | 134 | atomic_t skc_refcnt; |
| 135 | int skc_tx_queue_mapping; | ||
| 131 | 136 | ||
| 132 | unsigned int skc_hash; | 137 | union { |
| 138 | unsigned int skc_hash; | ||
| 139 | __u16 skc_u16hashes[2]; | ||
| 140 | }; | ||
| 133 | unsigned short skc_family; | 141 | unsigned short skc_family; |
| 134 | volatile unsigned char skc_state; | 142 | volatile unsigned char skc_state; |
| 135 | unsigned char skc_reuse; | 143 | unsigned char skc_reuse; |
| 136 | int skc_bound_dev_if; | 144 | int skc_bound_dev_if; |
| 137 | struct hlist_node skc_bind_node; | 145 | union { |
| 146 | struct hlist_node skc_bind_node; | ||
| 147 | struct hlist_nulls_node skc_portaddr_node; | ||
| 148 | }; | ||
| 138 | struct proto *skc_prot; | 149 | struct proto *skc_prot; |
| 139 | #ifdef CONFIG_NET_NS | 150 | #ifdef CONFIG_NET_NS |
| 140 | struct net *skc_net; | 151 | struct net *skc_net; |
| @@ -215,6 +226,7 @@ struct sock { | |||
| 215 | #define sk_node __sk_common.skc_node | 226 | #define sk_node __sk_common.skc_node |
| 216 | #define sk_nulls_node __sk_common.skc_nulls_node | 227 | #define sk_nulls_node __sk_common.skc_nulls_node |
| 217 | #define sk_refcnt __sk_common.skc_refcnt | 228 | #define sk_refcnt __sk_common.skc_refcnt |
| 229 | #define sk_tx_queue_mapping __sk_common.skc_tx_queue_mapping | ||
| 218 | 230 | ||
| 219 | #define sk_copy_start __sk_common.skc_hash | 231 | #define sk_copy_start __sk_common.skc_hash |
| 220 | #define sk_hash __sk_common.skc_hash | 232 | #define sk_hash __sk_common.skc_hash |
| @@ -242,6 +254,8 @@ struct sock { | |||
| 242 | struct { | 254 | struct { |
| 243 | struct sk_buff *head; | 255 | struct sk_buff *head; |
| 244 | struct sk_buff *tail; | 256 | struct sk_buff *tail; |
| 257 | int len; | ||
| 258 | int limit; | ||
| 245 | } sk_backlog; | 259 | } sk_backlog; |
| 246 | wait_queue_head_t *sk_sleep; | 260 | wait_queue_head_t *sk_sleep; |
| 247 | struct dst_entry *sk_dst_cache; | 261 | struct dst_entry *sk_dst_cache; |
| @@ -306,6 +320,11 @@ struct sock { | |||
| 306 | /* | 320 | /* |
| 307 | * Hashed lists helper routines | 321 | * Hashed lists helper routines |
| 308 | */ | 322 | */ |
| 323 | static inline struct sock *sk_entry(const struct hlist_node *node) | ||
| 324 | { | ||
| 325 | return hlist_entry(node, struct sock, sk_node); | ||
| 326 | } | ||
| 327 | |||
| 309 | static inline struct sock *__sk_head(const struct hlist_head *head) | 328 | static inline struct sock *__sk_head(const struct hlist_head *head) |
| 310 | { | 329 | { |
| 311 | return hlist_entry(head->first, struct sock, sk_node); | 330 | return hlist_entry(head->first, struct sock, sk_node); |
| @@ -365,6 +384,7 @@ static __inline__ void __sk_del_node(struct sock *sk) | |||
| 365 | __hlist_del(&sk->sk_node); | 384 | __hlist_del(&sk->sk_node); |
| 366 | } | 385 | } |
| 367 | 386 | ||
| 387 | /* NB: equivalent to hlist_del_init_rcu */ | ||
| 368 | static __inline__ int __sk_del_node_init(struct sock *sk) | 388 | static __inline__ int __sk_del_node_init(struct sock *sk) |
| 369 | { | 389 | { |
| 370 | if (sk_hashed(sk)) { | 390 | if (sk_hashed(sk)) { |
| @@ -405,6 +425,7 @@ static __inline__ int sk_del_node_init(struct sock *sk) | |||
| 405 | } | 425 | } |
| 406 | return rc; | 426 | return rc; |
| 407 | } | 427 | } |
| 428 | #define sk_del_node_init_rcu(sk) sk_del_node_init(sk) | ||
| 408 | 429 | ||
| 409 | static __inline__ int __sk_nulls_del_node_init_rcu(struct sock *sk) | 430 | static __inline__ int __sk_nulls_del_node_init_rcu(struct sock *sk) |
| 410 | { | 431 | { |
| @@ -438,6 +459,12 @@ static __inline__ void sk_add_node(struct sock *sk, struct hlist_head *list) | |||
| 438 | __sk_add_node(sk, list); | 459 | __sk_add_node(sk, list); |
| 439 | } | 460 | } |
| 440 | 461 | ||
| 462 | static __inline__ void sk_add_node_rcu(struct sock *sk, struct hlist_head *list) | ||
| 463 | { | ||
| 464 | sock_hold(sk); | ||
| 465 | hlist_add_head_rcu(&sk->sk_node, list); | ||
| 466 | } | ||
| 467 | |||
| 441 | static __inline__ void __sk_nulls_add_node_rcu(struct sock *sk, struct hlist_nulls_head *list) | 468 | static __inline__ void __sk_nulls_add_node_rcu(struct sock *sk, struct hlist_nulls_head *list) |
| 442 | { | 469 | { |
| 443 | hlist_nulls_add_head_rcu(&sk->sk_nulls_node, list); | 470 | hlist_nulls_add_head_rcu(&sk->sk_nulls_node, list); |
| @@ -462,6 +489,8 @@ static __inline__ void sk_add_bind_node(struct sock *sk, | |||
| 462 | 489 | ||
| 463 | #define sk_for_each(__sk, node, list) \ | 490 | #define sk_for_each(__sk, node, list) \ |
| 464 | hlist_for_each_entry(__sk, node, list, sk_node) | 491 | hlist_for_each_entry(__sk, node, list, sk_node) |
| 492 | #define sk_for_each_rcu(__sk, node, list) \ | ||
| 493 | hlist_for_each_entry_rcu(__sk, node, list, sk_node) | ||
| 465 | #define sk_nulls_for_each(__sk, node, list) \ | 494 | #define sk_nulls_for_each(__sk, node, list) \ |
| 466 | hlist_nulls_for_each_entry(__sk, node, list, sk_nulls_node) | 495 | hlist_nulls_for_each_entry(__sk, node, list, sk_nulls_node) |
| 467 | #define sk_nulls_for_each_rcu(__sk, node, list) \ | 496 | #define sk_nulls_for_each_rcu(__sk, node, list) \ |
| @@ -504,6 +533,8 @@ enum sock_flags { | |||
| 504 | SOCK_TIMESTAMPING_SOFTWARE, /* %SOF_TIMESTAMPING_SOFTWARE */ | 533 | SOCK_TIMESTAMPING_SOFTWARE, /* %SOF_TIMESTAMPING_SOFTWARE */ |
| 505 | SOCK_TIMESTAMPING_RAW_HARDWARE, /* %SOF_TIMESTAMPING_RAW_HARDWARE */ | 534 | SOCK_TIMESTAMPING_RAW_HARDWARE, /* %SOF_TIMESTAMPING_RAW_HARDWARE */ |
| 506 | SOCK_TIMESTAMPING_SYS_HARDWARE, /* %SOF_TIMESTAMPING_SYS_HARDWARE */ | 535 | SOCK_TIMESTAMPING_SYS_HARDWARE, /* %SOF_TIMESTAMPING_SYS_HARDWARE */ |
| 536 | SOCK_FASYNC, /* fasync() active */ | ||
| 537 | SOCK_RXQ_OVFL, | ||
| 507 | }; | 538 | }; |
| 508 | 539 | ||
| 509 | static inline void sock_copy_flags(struct sock *nsk, struct sock *osk) | 540 | static inline void sock_copy_flags(struct sock *nsk, struct sock *osk) |
| @@ -561,8 +592,8 @@ static inline int sk_stream_memory_free(struct sock *sk) | |||
| 561 | return sk->sk_wmem_queued < sk->sk_sndbuf; | 592 | return sk->sk_wmem_queued < sk->sk_sndbuf; |
| 562 | } | 593 | } |
| 563 | 594 | ||
| 564 | /* The per-socket spinlock must be held here. */ | 595 | /* OOB backlog add */ |
| 565 | static inline void sk_add_backlog(struct sock *sk, struct sk_buff *skb) | 596 | static inline void __sk_add_backlog(struct sock *sk, struct sk_buff *skb) |
| 566 | { | 597 | { |
| 567 | if (!sk->sk_backlog.tail) { | 598 | if (!sk->sk_backlog.tail) { |
| 568 | sk->sk_backlog.head = sk->sk_backlog.tail = skb; | 599 | sk->sk_backlog.head = sk->sk_backlog.tail = skb; |
| @@ -573,6 +604,17 @@ static inline void sk_add_backlog(struct sock *sk, struct sk_buff *skb) | |||
| 573 | skb->next = NULL; | 604 | skb->next = NULL; |
| 574 | } | 605 | } |
| 575 | 606 | ||
| 607 | /* The per-socket spinlock must be held here. */ | ||
| 608 | static inline __must_check int sk_add_backlog(struct sock *sk, struct sk_buff *skb) | ||
| 609 | { | ||
| 610 | if (sk->sk_backlog.len >= max(sk->sk_backlog.limit, sk->sk_rcvbuf << 1)) | ||
| 611 | return -ENOBUFS; | ||
| 612 | |||
| 613 | __sk_add_backlog(sk, skb); | ||
| 614 | sk->sk_backlog.len += skb->truesize; | ||
| 615 | return 0; | ||
| 616 | } | ||
| 617 | |||
| 576 | static inline int sk_backlog_rcv(struct sock *sk, struct sk_buff *skb) | 618 | static inline int sk_backlog_rcv(struct sock *sk, struct sk_buff *skb) |
| 577 | { | 619 | { |
| 578 | return sk->sk_backlog_rcv(sk, skb); | 620 | return sk->sk_backlog_rcv(sk, skb); |
| @@ -1031,7 +1073,7 @@ extern void sk_common_release(struct sock *sk); | |||
| 1031 | extern void sock_init_data(struct socket *sock, struct sock *sk); | 1073 | extern void sock_init_data(struct socket *sock, struct sock *sk); |
| 1032 | 1074 | ||
| 1033 | /** | 1075 | /** |
| 1034 | * sk_filter_release: Release a socket filter | 1076 | * sk_filter_release - release a socket filter |
| 1035 | * @fp: filter to remove | 1077 | * @fp: filter to remove |
| 1036 | * | 1078 | * |
| 1037 | * Remove a filter from a socket and release its resources. | 1079 | * Remove a filter from a socket and release its resources. |
| @@ -1092,8 +1134,29 @@ static inline void sock_put(struct sock *sk) | |||
| 1092 | extern int sk_receive_skb(struct sock *sk, struct sk_buff *skb, | 1134 | extern int sk_receive_skb(struct sock *sk, struct sk_buff *skb, |
| 1093 | const int nested); | 1135 | const int nested); |
| 1094 | 1136 | ||
| 1137 | static inline void sk_tx_queue_set(struct sock *sk, int tx_queue) | ||
| 1138 | { | ||
| 1139 | sk->sk_tx_queue_mapping = tx_queue; | ||
| 1140 | } | ||
| 1141 | |||
| 1142 | static inline void sk_tx_queue_clear(struct sock *sk) | ||
| 1143 | { | ||
| 1144 | sk->sk_tx_queue_mapping = -1; | ||
| 1145 | } | ||
| 1146 | |||
| 1147 | static inline int sk_tx_queue_get(const struct sock *sk) | ||
| 1148 | { | ||
| 1149 | return sk->sk_tx_queue_mapping; | ||
| 1150 | } | ||
| 1151 | |||
| 1152 | static inline bool sk_tx_queue_recorded(const struct sock *sk) | ||
| 1153 | { | ||
| 1154 | return (sk && sk->sk_tx_queue_mapping >= 0); | ||
| 1155 | } | ||
| 1156 | |||
| 1095 | static inline void sk_set_socket(struct sock *sk, struct socket *sock) | 1157 | static inline void sk_set_socket(struct sock *sk, struct socket *sock) |
| 1096 | { | 1158 | { |
| 1159 | sk_tx_queue_clear(sk); | ||
| 1097 | sk->sk_socket = sock; | 1160 | sk->sk_socket = sock; |
| 1098 | } | 1161 | } |
| 1099 | 1162 | ||
| @@ -1150,6 +1213,7 @@ __sk_dst_set(struct sock *sk, struct dst_entry *dst) | |||
| 1150 | { | 1213 | { |
| 1151 | struct dst_entry *old_dst; | 1214 | struct dst_entry *old_dst; |
| 1152 | 1215 | ||
| 1216 | sk_tx_queue_clear(sk); | ||
| 1153 | old_dst = sk->sk_dst_cache; | 1217 | old_dst = sk->sk_dst_cache; |
| 1154 | sk->sk_dst_cache = dst; | 1218 | sk->sk_dst_cache = dst; |
| 1155 | dst_release(old_dst); | 1219 | dst_release(old_dst); |
| @@ -1168,6 +1232,7 @@ __sk_dst_reset(struct sock *sk) | |||
| 1168 | { | 1232 | { |
| 1169 | struct dst_entry *old_dst; | 1233 | struct dst_entry *old_dst; |
| 1170 | 1234 | ||
| 1235 | sk_tx_queue_clear(sk); | ||
| 1171 | old_dst = sk->sk_dst_cache; | 1236 | old_dst = sk->sk_dst_cache; |
| 1172 | sk->sk_dst_cache = NULL; | 1237 | sk->sk_dst_cache = NULL; |
| 1173 | dst_release(old_dst); | 1238 | dst_release(old_dst); |
| @@ -1396,7 +1461,7 @@ static inline unsigned long sock_wspace(struct sock *sk) | |||
| 1396 | 1461 | ||
| 1397 | static inline void sk_wake_async(struct sock *sk, int how, int band) | 1462 | static inline void sk_wake_async(struct sock *sk, int how, int band) |
| 1398 | { | 1463 | { |
| 1399 | if (sk->sk_socket && sk->sk_socket->fasync_list) | 1464 | if (sock_flag(sk, SOCK_FASYNC)) |
| 1400 | sock_wake_async(sk->sk_socket, how, band); | 1465 | sock_wake_async(sk->sk_socket, how, band); |
| 1401 | } | 1466 | } |
| 1402 | 1467 | ||
| @@ -1492,6 +1557,8 @@ sock_recv_timestamp(struct msghdr *msg, struct sock *sk, struct sk_buff *skb) | |||
| 1492 | sk->sk_stamp = kt; | 1557 | sk->sk_stamp = kt; |
| 1493 | } | 1558 | } |
| 1494 | 1559 | ||
| 1560 | extern void sock_recv_ts_and_drops(struct msghdr *msg, struct sock *sk, struct sk_buff *skb); | ||
| 1561 | |||
| 1495 | /** | 1562 | /** |
| 1496 | * sock_tx_timestamp - checks whether the outgoing packet is to be time stamped | 1563 | * sock_tx_timestamp - checks whether the outgoing packet is to be time stamped |
| 1497 | * @msg: outgoing packet | 1564 | * @msg: outgoing packet |
diff --git a/include/net/tc_act/tc_skbedit.h b/include/net/tc_act/tc_skbedit.h index 6abb3ed3ebf7..e103fe02f375 100644 --- a/include/net/tc_act/tc_skbedit.h +++ b/include/net/tc_act/tc_skbedit.h | |||
| @@ -26,7 +26,9 @@ struct tcf_skbedit { | |||
| 26 | struct tcf_common common; | 26 | struct tcf_common common; |
| 27 | u32 flags; | 27 | u32 flags; |
| 28 | u32 priority; | 28 | u32 priority; |
| 29 | u32 mark; | ||
| 29 | u16 queue_mapping; | 30 | u16 queue_mapping; |
| 31 | /* XXX: 16-bit pad here? */ | ||
| 30 | }; | 32 | }; |
| 31 | #define to_skbedit(pc) \ | 33 | #define to_skbedit(pc) \ |
| 32 | container_of(pc, struct tcf_skbedit, common) | 34 | container_of(pc, struct tcf_skbedit, common) |
diff --git a/include/net/tcp.h b/include/net/tcp.h index 03a49c703377..aa04b9a5093b 100644 --- a/include/net/tcp.h +++ b/include/net/tcp.h | |||
| @@ -30,6 +30,7 @@ | |||
| 30 | #include <linux/dmaengine.h> | 30 | #include <linux/dmaengine.h> |
| 31 | #include <linux/crypto.h> | 31 | #include <linux/crypto.h> |
| 32 | #include <linux/cryptohash.h> | 32 | #include <linux/cryptohash.h> |
| 33 | #include <linux/kref.h> | ||
| 33 | 34 | ||
| 34 | #include <net/inet_connection_sock.h> | 35 | #include <net/inet_connection_sock.h> |
| 35 | #include <net/inet_timewait_sock.h> | 36 | #include <net/inet_timewait_sock.h> |
| @@ -62,9 +63,6 @@ extern void tcp_time_wait(struct sock *sk, int state, int timeo); | |||
| 62 | /* Minimal accepted MSS. It is (60+60+8) - (20+20). */ | 63 | /* Minimal accepted MSS. It is (60+60+8) - (20+20). */ |
| 63 | #define TCP_MIN_MSS 88U | 64 | #define TCP_MIN_MSS 88U |
| 64 | 65 | ||
| 65 | /* Minimal RCV_MSS. */ | ||
| 66 | #define TCP_MIN_RCVMSS 536U | ||
| 67 | |||
| 68 | /* The least MTU to use for probing */ | 66 | /* The least MTU to use for probing */ |
| 69 | #define TCP_BASE_MSS 512 | 67 | #define TCP_BASE_MSS 512 |
| 70 | 68 | ||
| @@ -167,6 +165,7 @@ extern void tcp_time_wait(struct sock *sk, int state, int timeo); | |||
| 167 | #define TCPOPT_SACK 5 /* SACK Block */ | 165 | #define TCPOPT_SACK 5 /* SACK Block */ |
| 168 | #define TCPOPT_TIMESTAMP 8 /* Better RTT estimations/PAWS */ | 166 | #define TCPOPT_TIMESTAMP 8 /* Better RTT estimations/PAWS */ |
| 169 | #define TCPOPT_MD5SIG 19 /* MD5 Signature (RFC2385) */ | 167 | #define TCPOPT_MD5SIG 19 /* MD5 Signature (RFC2385) */ |
| 168 | #define TCPOPT_COOKIE 253 /* Cookie extension (experimental) */ | ||
| 170 | 169 | ||
| 171 | /* | 170 | /* |
| 172 | * TCP option lengths | 171 | * TCP option lengths |
| @@ -177,6 +176,10 @@ extern void tcp_time_wait(struct sock *sk, int state, int timeo); | |||
| 177 | #define TCPOLEN_SACK_PERM 2 | 176 | #define TCPOLEN_SACK_PERM 2 |
| 178 | #define TCPOLEN_TIMESTAMP 10 | 177 | #define TCPOLEN_TIMESTAMP 10 |
| 179 | #define TCPOLEN_MD5SIG 18 | 178 | #define TCPOLEN_MD5SIG 18 |
| 179 | #define TCPOLEN_COOKIE_BASE 2 /* Cookie-less header extension */ | ||
| 180 | #define TCPOLEN_COOKIE_PAIR 3 /* Cookie pair header extension */ | ||
| 181 | #define TCPOLEN_COOKIE_MIN (TCPOLEN_COOKIE_BASE+TCP_COOKIE_MIN) | ||
| 182 | #define TCPOLEN_COOKIE_MAX (TCPOLEN_COOKIE_BASE+TCP_COOKIE_MAX) | ||
| 180 | 183 | ||
| 181 | /* But this is what stacks really send out. */ | 184 | /* But this is what stacks really send out. */ |
| 182 | #define TCPOLEN_TSTAMP_ALIGNED 12 | 185 | #define TCPOLEN_TSTAMP_ALIGNED 12 |
| @@ -193,6 +196,9 @@ extern void tcp_time_wait(struct sock *sk, int state, int timeo); | |||
| 193 | #define TCP_NAGLE_CORK 2 /* Socket is corked */ | 196 | #define TCP_NAGLE_CORK 2 /* Socket is corked */ |
| 194 | #define TCP_NAGLE_PUSH 4 /* Cork is overridden for already queued data */ | 197 | #define TCP_NAGLE_PUSH 4 /* Cork is overridden for already queued data */ |
| 195 | 198 | ||
| 199 | /* TCP thin-stream limits */ | ||
| 200 | #define TCP_THIN_LINEAR_RETRIES 6 /* After 6 linear retries, do exp. backoff */ | ||
| 201 | |||
| 196 | extern struct inet_timewait_death_row tcp_death_row; | 202 | extern struct inet_timewait_death_row tcp_death_row; |
| 197 | 203 | ||
| 198 | /* sysctl variables for tcp */ | 204 | /* sysctl variables for tcp */ |
| @@ -237,6 +243,9 @@ extern int sysctl_tcp_base_mss; | |||
| 237 | extern int sysctl_tcp_workaround_signed_windows; | 243 | extern int sysctl_tcp_workaround_signed_windows; |
| 238 | extern int sysctl_tcp_slow_start_after_idle; | 244 | extern int sysctl_tcp_slow_start_after_idle; |
| 239 | extern int sysctl_tcp_max_ssthresh; | 245 | extern int sysctl_tcp_max_ssthresh; |
| 246 | extern int sysctl_tcp_cookie_size; | ||
| 247 | extern int sysctl_tcp_thin_linear_timeouts; | ||
| 248 | extern int sysctl_tcp_thin_dupack; | ||
| 240 | 249 | ||
| 241 | extern atomic_t tcp_memory_allocated; | 250 | extern atomic_t tcp_memory_allocated; |
| 242 | extern struct percpu_counter tcp_sockets_allocated; | 251 | extern struct percpu_counter tcp_sockets_allocated; |
| @@ -343,11 +352,6 @@ static inline void tcp_dec_quickack_mode(struct sock *sk, | |||
| 343 | 352 | ||
| 344 | extern void tcp_enter_quickack_mode(struct sock *sk); | 353 | extern void tcp_enter_quickack_mode(struct sock *sk); |
| 345 | 354 | ||
| 346 | static inline void tcp_clear_options(struct tcp_options_received *rx_opt) | ||
| 347 | { | ||
| 348 | rx_opt->tstamp_ok = rx_opt->sack_ok = rx_opt->wscale_ok = rx_opt->snd_wscale = 0; | ||
| 349 | } | ||
| 350 | |||
| 351 | #define TCP_ECN_OK 1 | 355 | #define TCP_ECN_OK 1 |
| 352 | #define TCP_ECN_QUEUE_CWR 2 | 356 | #define TCP_ECN_QUEUE_CWR 2 |
| 353 | #define TCP_ECN_DEMAND_CWR 4 | 357 | #define TCP_ECN_DEMAND_CWR 4 |
| @@ -359,8 +363,7 @@ TCP_ECN_create_request(struct request_sock *req, struct tcphdr *th) | |||
| 359 | inet_rsk(req)->ecn_ok = 1; | 363 | inet_rsk(req)->ecn_ok = 1; |
| 360 | } | 364 | } |
| 361 | 365 | ||
| 362 | enum tcp_tw_status | 366 | enum tcp_tw_status { |
| 363 | { | ||
| 364 | TCP_TW_SUCCESS = 0, | 367 | TCP_TW_SUCCESS = 0, |
| 365 | TCP_TW_RST = 1, | 368 | TCP_TW_RST = 1, |
| 366 | TCP_TW_ACK = 2, | 369 | TCP_TW_ACK = 2, |
| @@ -402,6 +405,8 @@ extern int compat_tcp_setsockopt(struct sock *sk, | |||
| 402 | int level, int optname, | 405 | int level, int optname, |
| 403 | char __user *optval, unsigned int optlen); | 406 | char __user *optval, unsigned int optlen); |
| 404 | extern void tcp_set_keepalive(struct sock *sk, int val); | 407 | extern void tcp_set_keepalive(struct sock *sk, int val); |
| 408 | extern void tcp_syn_ack_timeout(struct sock *sk, | ||
| 409 | struct request_sock *req); | ||
| 405 | extern int tcp_recvmsg(struct kiocb *iocb, struct sock *sk, | 410 | extern int tcp_recvmsg(struct kiocb *iocb, struct sock *sk, |
| 406 | struct msghdr *msg, | 411 | struct msghdr *msg, |
| 407 | size_t len, int nonblock, | 412 | size_t len, int nonblock, |
| @@ -409,6 +414,7 @@ extern int tcp_recvmsg(struct kiocb *iocb, struct sock *sk, | |||
| 409 | 414 | ||
| 410 | extern void tcp_parse_options(struct sk_buff *skb, | 415 | extern void tcp_parse_options(struct sk_buff *skb, |
| 411 | struct tcp_options_received *opt_rx, | 416 | struct tcp_options_received *opt_rx, |
| 417 | u8 **hvpp, | ||
| 412 | int estab); | 418 | int estab); |
| 413 | 419 | ||
| 414 | extern u8 *tcp_parse_md5sig_option(struct tcphdr *th); | 420 | extern u8 *tcp_parse_md5sig_option(struct tcphdr *th); |
| @@ -443,7 +449,8 @@ extern int tcp_connect(struct sock *sk); | |||
| 443 | 449 | ||
| 444 | extern struct sk_buff * tcp_make_synack(struct sock *sk, | 450 | extern struct sk_buff * tcp_make_synack(struct sock *sk, |
| 445 | struct dst_entry *dst, | 451 | struct dst_entry *dst, |
| 446 | struct request_sock *req); | 452 | struct request_sock *req, |
| 453 | struct request_values *rvp); | ||
| 447 | 454 | ||
| 448 | extern int tcp_disconnect(struct sock *sk, int flags); | 455 | extern int tcp_disconnect(struct sock *sk, int flags); |
| 449 | 456 | ||
| @@ -856,13 +863,6 @@ static inline void tcp_check_probe_timer(struct sock *sk) | |||
| 856 | icsk->icsk_rto, TCP_RTO_MAX); | 863 | icsk->icsk_rto, TCP_RTO_MAX); |
| 857 | } | 864 | } |
| 858 | 865 | ||
| 859 | static inline void tcp_push_pending_frames(struct sock *sk) | ||
| 860 | { | ||
| 861 | struct tcp_sock *tp = tcp_sk(sk); | ||
| 862 | |||
| 863 | __tcp_push_pending_frames(sk, tcp_current_mss(sk), tp->nonagle); | ||
| 864 | } | ||
| 865 | |||
| 866 | static inline void tcp_init_wl(struct tcp_sock *tp, u32 seq) | 866 | static inline void tcp_init_wl(struct tcp_sock *tp, u32 seq) |
| 867 | { | 867 | { |
| 868 | tp->snd_wl1 = seq; | 868 | tp->snd_wl1 = seq; |
| @@ -939,7 +939,7 @@ static inline int tcp_prequeue(struct sock *sk, struct sk_buff *skb) | |||
| 939 | 939 | ||
| 940 | tp->ucopy.memory = 0; | 940 | tp->ucopy.memory = 0; |
| 941 | } else if (skb_queue_len(&tp->ucopy.prequeue) == 1) { | 941 | } else if (skb_queue_len(&tp->ucopy.prequeue) == 1) { |
| 942 | wake_up_interruptible_poll(sk->sk_sleep, | 942 | wake_up_interruptible_sync_poll(sk->sk_sleep, |
| 943 | POLLIN | POLLRDNORM | POLLRDBAND); | 943 | POLLIN | POLLRDNORM | POLLRDBAND); |
| 944 | if (!inet_csk_ack_scheduled(sk)) | 944 | if (!inet_csk_ack_scheduled(sk)) |
| 945 | inet_csk_reset_xmit_timer(sk, ICSK_TIME_DACK, | 945 | inet_csk_reset_xmit_timer(sk, ICSK_TIME_DACK, |
| @@ -972,7 +972,8 @@ static inline void tcp_sack_reset(struct tcp_options_received *rx_opt) | |||
| 972 | /* Determine a window scaling and initial window to offer. */ | 972 | /* Determine a window scaling and initial window to offer. */ |
| 973 | extern void tcp_select_initial_window(int __space, __u32 mss, | 973 | extern void tcp_select_initial_window(int __space, __u32 mss, |
| 974 | __u32 *rcv_wnd, __u32 *window_clamp, | 974 | __u32 *rcv_wnd, __u32 *window_clamp, |
| 975 | int wscale_ok, __u8 *rcv_wscale); | 975 | int wscale_ok, __u8 *rcv_wscale, |
| 976 | __u32 init_rcv_wnd); | ||
| 976 | 977 | ||
| 977 | static inline int tcp_win_from_space(int space) | 978 | static inline int tcp_win_from_space(int space) |
| 978 | { | 979 | { |
| @@ -1193,33 +1194,18 @@ extern int tcp_v4_md5_do_del(struct sock *sk, | |||
| 1193 | #define tcp_twsk_md5_key(twsk) NULL | 1194 | #define tcp_twsk_md5_key(twsk) NULL |
| 1194 | #endif | 1195 | #endif |
| 1195 | 1196 | ||
| 1196 | extern struct tcp_md5sig_pool **tcp_alloc_md5sig_pool(struct sock *); | 1197 | extern struct tcp_md5sig_pool * __percpu *tcp_alloc_md5sig_pool(struct sock *); |
| 1197 | extern void tcp_free_md5sig_pool(void); | 1198 | extern void tcp_free_md5sig_pool(void); |
| 1198 | 1199 | ||
| 1199 | extern struct tcp_md5sig_pool *__tcp_get_md5sig_pool(int cpu); | 1200 | extern struct tcp_md5sig_pool *tcp_get_md5sig_pool(void); |
| 1200 | extern void __tcp_put_md5sig_pool(void); | 1201 | extern void tcp_put_md5sig_pool(void); |
| 1202 | |||
| 1201 | extern int tcp_md5_hash_header(struct tcp_md5sig_pool *, struct tcphdr *); | 1203 | extern int tcp_md5_hash_header(struct tcp_md5sig_pool *, struct tcphdr *); |
| 1202 | extern int tcp_md5_hash_skb_data(struct tcp_md5sig_pool *, struct sk_buff *, | 1204 | extern int tcp_md5_hash_skb_data(struct tcp_md5sig_pool *, struct sk_buff *, |
| 1203 | unsigned header_len); | 1205 | unsigned header_len); |
| 1204 | extern int tcp_md5_hash_key(struct tcp_md5sig_pool *hp, | 1206 | extern int tcp_md5_hash_key(struct tcp_md5sig_pool *hp, |
| 1205 | struct tcp_md5sig_key *key); | 1207 | struct tcp_md5sig_key *key); |
| 1206 | 1208 | ||
| 1207 | static inline | ||
| 1208 | struct tcp_md5sig_pool *tcp_get_md5sig_pool(void) | ||
| 1209 | { | ||
| 1210 | int cpu = get_cpu(); | ||
| 1211 | struct tcp_md5sig_pool *ret = __tcp_get_md5sig_pool(cpu); | ||
| 1212 | if (!ret) | ||
| 1213 | put_cpu(); | ||
| 1214 | return ret; | ||
| 1215 | } | ||
| 1216 | |||
| 1217 | static inline void tcp_put_md5sig_pool(void) | ||
| 1218 | { | ||
| 1219 | __tcp_put_md5sig_pool(); | ||
| 1220 | put_cpu(); | ||
| 1221 | } | ||
| 1222 | |||
| 1223 | /* write queue abstraction */ | 1209 | /* write queue abstraction */ |
| 1224 | static inline void tcp_write_queue_purge(struct sock *sk) | 1210 | static inline void tcp_write_queue_purge(struct sock *sk) |
| 1225 | { | 1211 | { |
| @@ -1228,6 +1214,7 @@ static inline void tcp_write_queue_purge(struct sock *sk) | |||
| 1228 | while ((skb = __skb_dequeue(&sk->sk_write_queue)) != NULL) | 1214 | while ((skb = __skb_dequeue(&sk->sk_write_queue)) != NULL) |
| 1229 | sk_wmem_free_skb(sk, skb); | 1215 | sk_wmem_free_skb(sk, skb); |
| 1230 | sk_mem_reclaim(sk); | 1216 | sk_mem_reclaim(sk); |
| 1217 | tcp_clear_all_retrans_hints(tcp_sk(sk)); | ||
| 1231 | } | 1218 | } |
| 1232 | 1219 | ||
| 1233 | static inline struct sk_buff *tcp_write_queue_head(struct sock *sk) | 1220 | static inline struct sk_buff *tcp_write_queue_head(struct sock *sk) |
| @@ -1259,29 +1246,6 @@ static inline struct sk_buff *tcp_write_queue_prev(struct sock *sk, struct sk_bu | |||
| 1259 | #define tcp_for_write_queue_from_safe(skb, tmp, sk) \ | 1246 | #define tcp_for_write_queue_from_safe(skb, tmp, sk) \ |
| 1260 | skb_queue_walk_from_safe(&(sk)->sk_write_queue, skb, tmp) | 1247 | skb_queue_walk_from_safe(&(sk)->sk_write_queue, skb, tmp) |
| 1261 | 1248 | ||
| 1262 | /* This function calculates a "timeout" which is equivalent to the timeout of a | ||
| 1263 | * TCP connection after "boundary" unsucessful, exponentially backed-off | ||
| 1264 | * retransmissions with an initial RTO of TCP_RTO_MIN. | ||
| 1265 | */ | ||
| 1266 | static inline bool retransmits_timed_out(const struct sock *sk, | ||
| 1267 | unsigned int boundary) | ||
| 1268 | { | ||
| 1269 | unsigned int timeout, linear_backoff_thresh; | ||
| 1270 | |||
| 1271 | if (!inet_csk(sk)->icsk_retransmits) | ||
| 1272 | return false; | ||
| 1273 | |||
| 1274 | linear_backoff_thresh = ilog2(TCP_RTO_MAX/TCP_RTO_MIN); | ||
| 1275 | |||
| 1276 | if (boundary <= linear_backoff_thresh) | ||
| 1277 | timeout = ((2 << boundary) - 1) * TCP_RTO_MIN; | ||
| 1278 | else | ||
| 1279 | timeout = ((2 << linear_backoff_thresh) - 1) * TCP_RTO_MIN + | ||
| 1280 | (boundary - linear_backoff_thresh) * TCP_RTO_MAX; | ||
| 1281 | |||
| 1282 | return (tcp_time_stamp - tcp_sk(sk)->retrans_stamp) >= timeout; | ||
| 1283 | } | ||
| 1284 | |||
| 1285 | static inline struct sk_buff *tcp_send_head(struct sock *sk) | 1249 | static inline struct sk_buff *tcp_send_head(struct sock *sk) |
| 1286 | { | 1250 | { |
| 1287 | return sk->sk_send_head; | 1251 | return sk->sk_send_head; |
| @@ -1364,6 +1328,15 @@ static inline int tcp_write_queue_empty(struct sock *sk) | |||
| 1364 | return skb_queue_empty(&sk->sk_write_queue); | 1328 | return skb_queue_empty(&sk->sk_write_queue); |
| 1365 | } | 1329 | } |
| 1366 | 1330 | ||
| 1331 | static inline void tcp_push_pending_frames(struct sock *sk) | ||
| 1332 | { | ||
| 1333 | if (tcp_send_head(sk)) { | ||
| 1334 | struct tcp_sock *tp = tcp_sk(sk); | ||
| 1335 | |||
| 1336 | __tcp_push_pending_frames(sk, tcp_current_mss(sk), tp->nonagle); | ||
| 1337 | } | ||
| 1338 | } | ||
| 1339 | |||
| 1367 | /* Start sequence of the highest skb with SACKed bit, valid only if | 1340 | /* Start sequence of the highest skb with SACKed bit, valid only if |
| 1368 | * sacked > 0 or when the caller has ensured validity by itself. | 1341 | * sacked > 0 or when the caller has ensured validity by itself. |
| 1369 | */ | 1342 | */ |
| @@ -1403,6 +1376,14 @@ static inline void tcp_highest_sack_combine(struct sock *sk, | |||
| 1403 | tcp_sk(sk)->highest_sack = new; | 1376 | tcp_sk(sk)->highest_sack = new; |
| 1404 | } | 1377 | } |
| 1405 | 1378 | ||
| 1379 | /* Determines whether this is a thin stream (which may suffer from | ||
| 1380 | * increased latency). Used to trigger latency-reducing mechanisms. | ||
| 1381 | */ | ||
| 1382 | static inline unsigned int tcp_stream_is_thin(struct tcp_sock *tp) | ||
| 1383 | { | ||
| 1384 | return tp->packets_out < 4 && !tcp_in_initial_slowstart(tp); | ||
| 1385 | } | ||
| 1386 | |||
| 1406 | /* /proc */ | 1387 | /* /proc */ |
| 1407 | enum tcp_seq_states { | 1388 | enum tcp_seq_states { |
| 1408 | TCP_SEQ_STATE_LISTENING, | 1389 | TCP_SEQ_STATE_LISTENING, |
| @@ -1480,6 +1461,91 @@ struct tcp_request_sock_ops { | |||
| 1480 | #endif | 1461 | #endif |
| 1481 | }; | 1462 | }; |
| 1482 | 1463 | ||
| 1464 | /* Using SHA1 for now, define some constants. | ||
| 1465 | */ | ||
| 1466 | #define COOKIE_DIGEST_WORDS (SHA_DIGEST_WORDS) | ||
| 1467 | #define COOKIE_MESSAGE_WORDS (SHA_MESSAGE_BYTES / 4) | ||
| 1468 | #define COOKIE_WORKSPACE_WORDS (COOKIE_DIGEST_WORDS + COOKIE_MESSAGE_WORDS) | ||
| 1469 | |||
| 1470 | extern int tcp_cookie_generator(u32 *bakery); | ||
| 1471 | |||
| 1472 | /** | ||
| 1473 | * struct tcp_cookie_values - each socket needs extra space for the | ||
| 1474 | * cookies, together with (optional) space for any SYN data. | ||
| 1475 | * | ||
| 1476 | * A tcp_sock contains a pointer to the current value, and this is | ||
| 1477 | * cloned to the tcp_timewait_sock. | ||
| 1478 | * | ||
| 1479 | * @cookie_pair: variable data from the option exchange. | ||
| 1480 | * | ||
| 1481 | * @cookie_desired: user specified tcpct_cookie_desired. Zero | ||
| 1482 | * indicates default (sysctl_tcp_cookie_size). | ||
| 1483 | * After cookie sent, remembers size of cookie. | ||
| 1484 | * Range 0, TCP_COOKIE_MIN to TCP_COOKIE_MAX. | ||
| 1485 | * | ||
| 1486 | * @s_data_desired: user specified tcpct_s_data_desired. When the | ||
| 1487 | * constant payload is specified (@s_data_constant), | ||
| 1488 | * holds its length instead. | ||
| 1489 | * Range 0 to TCP_MSS_DESIRED. | ||
| 1490 | * | ||
| 1491 | * @s_data_payload: constant data that is to be included in the | ||
| 1492 | * payload of SYN or SYNACK segments when the | ||
| 1493 | * cookie option is present. | ||
| 1494 | */ | ||
| 1495 | struct tcp_cookie_values { | ||
| 1496 | struct kref kref; | ||
| 1497 | u8 cookie_pair[TCP_COOKIE_PAIR_SIZE]; | ||
| 1498 | u8 cookie_pair_size; | ||
| 1499 | u8 cookie_desired; | ||
| 1500 | u16 s_data_desired:11, | ||
| 1501 | s_data_constant:1, | ||
| 1502 | s_data_in:1, | ||
| 1503 | s_data_out:1, | ||
| 1504 | s_data_unused:2; | ||
| 1505 | u8 s_data_payload[0]; | ||
| 1506 | }; | ||
| 1507 | |||
| 1508 | static inline void tcp_cookie_values_release(struct kref *kref) | ||
| 1509 | { | ||
| 1510 | kfree(container_of(kref, struct tcp_cookie_values, kref)); | ||
| 1511 | } | ||
| 1512 | |||
| 1513 | /* The length of constant payload data. Note that s_data_desired is | ||
| 1514 | * overloaded, depending on s_data_constant: either the length of constant | ||
| 1515 | * data (returned here) or the limit on variable data. | ||
| 1516 | */ | ||
| 1517 | static inline int tcp_s_data_size(const struct tcp_sock *tp) | ||
| 1518 | { | ||
| 1519 | return (tp->cookie_values != NULL && tp->cookie_values->s_data_constant) | ||
| 1520 | ? tp->cookie_values->s_data_desired | ||
| 1521 | : 0; | ||
| 1522 | } | ||
| 1523 | |||
| 1524 | /** | ||
| 1525 | * struct tcp_extend_values - tcp_ipv?.c to tcp_output.c workspace. | ||
| 1526 | * | ||
| 1527 | * As tcp_request_sock has already been extended in other places, the | ||
| 1528 | * only remaining method is to pass stack values along as function | ||
| 1529 | * parameters. These parameters are not needed after sending SYNACK. | ||
| 1530 | * | ||
| 1531 | * @cookie_bakery: cryptographic secret and message workspace. | ||
| 1532 | * | ||
| 1533 | * @cookie_plus: bytes in authenticator/cookie option, copied from | ||
| 1534 | * struct tcp_options_received (above). | ||
| 1535 | */ | ||
| 1536 | struct tcp_extend_values { | ||
| 1537 | struct request_values rv; | ||
| 1538 | u32 cookie_bakery[COOKIE_WORKSPACE_WORDS]; | ||
| 1539 | u8 cookie_plus:6, | ||
| 1540 | cookie_out_never:1, | ||
| 1541 | cookie_in_always:1; | ||
| 1542 | }; | ||
| 1543 | |||
| 1544 | static inline struct tcp_extend_values *tcp_xv(struct request_values *rvp) | ||
| 1545 | { | ||
| 1546 | return (struct tcp_extend_values *)rvp; | ||
| 1547 | } | ||
| 1548 | |||
| 1483 | extern void tcp_v4_init(void); | 1549 | extern void tcp_v4_init(void); |
| 1484 | extern void tcp_init(void); | 1550 | extern void tcp_init(void); |
| 1485 | 1551 | ||
diff --git a/include/net/udp.h b/include/net/udp.h index f98abd2ce709..5348d80b25bb 100644 --- a/include/net/udp.h +++ b/include/net/udp.h | |||
| @@ -50,16 +50,49 @@ struct udp_skb_cb { | |||
| 50 | }; | 50 | }; |
| 51 | #define UDP_SKB_CB(__skb) ((struct udp_skb_cb *)((__skb)->cb)) | 51 | #define UDP_SKB_CB(__skb) ((struct udp_skb_cb *)((__skb)->cb)) |
| 52 | 52 | ||
| 53 | /** | ||
| 54 | * struct udp_hslot - UDP hash slot | ||
| 55 | * | ||
| 56 | * @head: head of list of sockets | ||
| 57 | * @count: number of sockets in 'head' list | ||
| 58 | * @lock: spinlock protecting changes to head/count | ||
| 59 | */ | ||
| 53 | struct udp_hslot { | 60 | struct udp_hslot { |
| 54 | struct hlist_nulls_head head; | 61 | struct hlist_nulls_head head; |
| 62 | int count; | ||
| 55 | spinlock_t lock; | 63 | spinlock_t lock; |
| 56 | } __attribute__((aligned(2 * sizeof(long)))); | 64 | } __attribute__((aligned(2 * sizeof(long)))); |
| 65 | |||
| 66 | /** | ||
| 67 | * struct udp_table - UDP table | ||
| 68 | * | ||
| 69 | * @hash: hash table, sockets are hashed on (local port) | ||
| 70 | * @hash2: hash table, sockets are hashed on (local port, local address) | ||
| 71 | * @mask: number of slots in hash tables, minus 1 | ||
| 72 | * @log: log2(number of slots in hash table) | ||
| 73 | */ | ||
| 57 | struct udp_table { | 74 | struct udp_table { |
| 58 | struct udp_hslot hash[UDP_HTABLE_SIZE]; | 75 | struct udp_hslot *hash; |
| 76 | struct udp_hslot *hash2; | ||
| 77 | unsigned int mask; | ||
| 78 | unsigned int log; | ||
| 59 | }; | 79 | }; |
| 60 | extern struct udp_table udp_table; | 80 | extern struct udp_table udp_table; |
| 61 | extern void udp_table_init(struct udp_table *); | 81 | extern void udp_table_init(struct udp_table *, const char *); |
| 62 | 82 | static inline struct udp_hslot *udp_hashslot(struct udp_table *table, | |
| 83 | struct net *net, unsigned num) | ||
| 84 | { | ||
| 85 | return &table->hash[udp_hashfn(net, num, table->mask)]; | ||
| 86 | } | ||
| 87 | /* | ||
| 88 | * For secondary hash, net_hash_mix() is performed before calling | ||
| 89 | * udp_hashslot2(), this explains difference with udp_hashslot() | ||
| 90 | */ | ||
| 91 | static inline struct udp_hslot *udp_hashslot2(struct udp_table *table, | ||
| 92 | unsigned int hash) | ||
| 93 | { | ||
| 94 | return &table->hash2[hash & table->mask]; | ||
| 95 | } | ||
| 63 | 96 | ||
| 64 | /* Note: this must match 'valbool' in sock_setsockopt */ | 97 | /* Note: this must match 'valbool' in sock_setsockopt */ |
| 65 | #define UDP_CSUM_NOXMIT 1 | 98 | #define UDP_CSUM_NOXMIT 1 |
| @@ -125,7 +158,8 @@ static inline void udp_lib_close(struct sock *sk, long timeout) | |||
| 125 | } | 158 | } |
| 126 | 159 | ||
| 127 | extern int udp_lib_get_port(struct sock *sk, unsigned short snum, | 160 | extern int udp_lib_get_port(struct sock *sk, unsigned short snum, |
| 128 | int (*)(const struct sock*,const struct sock*)); | 161 | int (*)(const struct sock *,const struct sock *), |
| 162 | unsigned int hash2_nulladdr); | ||
| 129 | 163 | ||
| 130 | /* net/ipv4/udp.c */ | 164 | /* net/ipv4/udp.c */ |
| 131 | extern int udp_get_port(struct sock *sk, unsigned short snum, | 165 | extern int udp_get_port(struct sock *sk, unsigned short snum, |
diff --git a/include/net/wext.h b/include/net/wext.h index 3f2b94de2cfa..4f6e7423174c 100644 --- a/include/net/wext.h +++ b/include/net/wext.h | |||
| @@ -1,29 +1,19 @@ | |||
| 1 | #ifndef __NET_WEXT_H | 1 | #ifndef __NET_WEXT_H |
| 2 | #define __NET_WEXT_H | 2 | #define __NET_WEXT_H |
| 3 | 3 | ||
| 4 | /* | 4 | #include <net/iw_handler.h> |
| 5 | * wireless extensions interface to the core code | ||
| 6 | */ | ||
| 7 | 5 | ||
| 8 | struct net; | 6 | struct net; |
| 9 | 7 | ||
| 10 | #ifdef CONFIG_WIRELESS_EXT | 8 | #ifdef CONFIG_WEXT_CORE |
| 11 | extern int wext_proc_init(struct net *net); | ||
| 12 | extern void wext_proc_exit(struct net *net); | ||
| 13 | extern int wext_handle_ioctl(struct net *net, struct ifreq *ifr, unsigned int cmd, | 9 | extern int wext_handle_ioctl(struct net *net, struct ifreq *ifr, unsigned int cmd, |
| 14 | void __user *arg); | 10 | void __user *arg); |
| 15 | extern int compat_wext_handle_ioctl(struct net *net, unsigned int cmd, | 11 | extern int compat_wext_handle_ioctl(struct net *net, unsigned int cmd, |
| 16 | unsigned long arg); | 12 | unsigned long arg); |
| 13 | |||
| 17 | extern struct iw_statistics *get_wireless_stats(struct net_device *dev); | 14 | extern struct iw_statistics *get_wireless_stats(struct net_device *dev); |
| 15 | extern int call_commit_handler(struct net_device *dev); | ||
| 18 | #else | 16 | #else |
| 19 | static inline int wext_proc_init(struct net *net) | ||
| 20 | { | ||
| 21 | return 0; | ||
| 22 | } | ||
| 23 | static inline void wext_proc_exit(struct net *net) | ||
| 24 | { | ||
| 25 | return; | ||
| 26 | } | ||
| 27 | static inline int wext_handle_ioctl(struct net *net, struct ifreq *ifr, unsigned int cmd, | 17 | static inline int wext_handle_ioctl(struct net *net, struct ifreq *ifr, unsigned int cmd, |
| 28 | void __user *arg) | 18 | void __user *arg) |
| 29 | { | 19 | { |
| @@ -36,4 +26,35 @@ static inline int compat_wext_handle_ioctl(struct net *net, unsigned int cmd, | |||
| 36 | } | 26 | } |
| 37 | #endif | 27 | #endif |
| 38 | 28 | ||
| 29 | #ifdef CONFIG_WEXT_PROC | ||
| 30 | extern int wext_proc_init(struct net *net); | ||
| 31 | extern void wext_proc_exit(struct net *net); | ||
| 32 | #else | ||
| 33 | static inline int wext_proc_init(struct net *net) | ||
| 34 | { | ||
| 35 | return 0; | ||
| 36 | } | ||
| 37 | static inline void wext_proc_exit(struct net *net) | ||
| 38 | { | ||
| 39 | return; | ||
| 40 | } | ||
| 41 | #endif | ||
| 42 | |||
| 43 | #ifdef CONFIG_WEXT_PRIV | ||
| 44 | int ioctl_private_call(struct net_device *dev, struct iwreq *iwr, | ||
| 45 | unsigned int cmd, struct iw_request_info *info, | ||
| 46 | iw_handler handler); | ||
| 47 | int compat_private_call(struct net_device *dev, struct iwreq *iwr, | ||
| 48 | unsigned int cmd, struct iw_request_info *info, | ||
| 49 | iw_handler handler); | ||
| 50 | int iw_handler_get_private(struct net_device * dev, | ||
| 51 | struct iw_request_info * info, | ||
| 52 | union iwreq_data * wrqu, | ||
| 53 | char * extra); | ||
| 54 | #else | ||
| 55 | #define ioctl_private_call NULL | ||
| 56 | #define compat_private_call NULL | ||
| 57 | #endif | ||
| 58 | |||
| 59 | |||
| 39 | #endif /* __NET_WEXT_H */ | 60 | #endif /* __NET_WEXT_H */ |
diff --git a/include/net/wimax.h b/include/net/wimax.h index 2af7bf839f23..3461aa1df1e0 100644 --- a/include/net/wimax.h +++ b/include/net/wimax.h | |||
| @@ -79,7 +79,7 @@ | |||
| 79 | * drivers have to only report state changes due to external | 79 | * drivers have to only report state changes due to external |
| 80 | * conditions. | 80 | * conditions. |
| 81 | * | 81 | * |
| 82 | * All API operations are 'atomic', serialized thorough a mutex in the | 82 | * All API operations are 'atomic', serialized through a mutex in the |
| 83 | * `struct wimax_dev`. | 83 | * `struct wimax_dev`. |
| 84 | * | 84 | * |
| 85 | * EXPORTING TO USER SPACE THROUGH GENERIC NETLINK | 85 | * EXPORTING TO USER SPACE THROUGH GENERIC NETLINK |
| @@ -195,6 +195,12 @@ | |||
| 195 | * defining the `struct nla_policy` for each message, it has to have | 195 | * defining the `struct nla_policy` for each message, it has to have |
| 196 | * an array size of WIMAX_GNL_ATTR_MAX+1. | 196 | * an array size of WIMAX_GNL_ATTR_MAX+1. |
| 197 | * | 197 | * |
| 198 | * The op_*() function pointers will not be called if the wimax_dev is | ||
| 199 | * in a state <= %WIMAX_ST_UNINITIALIZED. The exception is: | ||
| 200 | * | ||
| 201 | * - op_reset: can be called at any time after wimax_dev_add() has | ||
| 202 | * been called. | ||
| 203 | * | ||
| 198 | * THE PIPE INTERFACE: | 204 | * THE PIPE INTERFACE: |
| 199 | * | 205 | * |
| 200 | * This interface is kept intentionally simple. The driver can send | 206 | * This interface is kept intentionally simple. The driver can send |
diff --git a/include/net/wpan-phy.h b/include/net/wpan-phy.h index 547b1e271ac9..85926231c07a 100644 --- a/include/net/wpan-phy.h +++ b/include/net/wpan-phy.h | |||
| @@ -34,20 +34,32 @@ struct wpan_phy { | |||
| 34 | */ | 34 | */ |
| 35 | u8 current_channel; | 35 | u8 current_channel; |
| 36 | u8 current_page; | 36 | u8 current_page; |
| 37 | u32 channels_supported; | 37 | u32 channels_supported[32]; |
| 38 | u8 transmit_power; | 38 | u8 transmit_power; |
| 39 | u8 cca_mode; | 39 | u8 cca_mode; |
| 40 | 40 | ||
| 41 | struct device dev; | 41 | struct device dev; |
| 42 | int idx; | 42 | int idx; |
| 43 | 43 | ||
| 44 | struct net_device *(*add_iface)(struct wpan_phy *phy, | ||
| 45 | const char *name); | ||
| 46 | void (*del_iface)(struct wpan_phy *phy, struct net_device *dev); | ||
| 47 | |||
| 44 | char priv[0] __attribute__((__aligned__(NETDEV_ALIGN))); | 48 | char priv[0] __attribute__((__aligned__(NETDEV_ALIGN))); |
| 45 | }; | 49 | }; |
| 46 | 50 | ||
| 51 | #define to_phy(_dev) container_of(_dev, struct wpan_phy, dev) | ||
| 52 | |||
| 47 | struct wpan_phy *wpan_phy_alloc(size_t priv_size); | 53 | struct wpan_phy *wpan_phy_alloc(size_t priv_size); |
| 48 | int wpan_phy_register(struct device *parent, struct wpan_phy *phy); | 54 | static inline void wpan_phy_set_dev(struct wpan_phy *phy, struct device *dev) |
| 55 | { | ||
| 56 | phy->dev.parent = dev; | ||
| 57 | } | ||
| 58 | int wpan_phy_register(struct wpan_phy *phy); | ||
| 49 | void wpan_phy_unregister(struct wpan_phy *phy); | 59 | void wpan_phy_unregister(struct wpan_phy *phy); |
| 50 | void wpan_phy_free(struct wpan_phy *phy); | 60 | void wpan_phy_free(struct wpan_phy *phy); |
| 61 | /* Same semantics as for class_for_each_device */ | ||
| 62 | int wpan_phy_for_each(int (*fn)(struct wpan_phy *phy, void *data), void *data); | ||
| 51 | 63 | ||
| 52 | static inline void *wpan_phy_priv(struct wpan_phy *phy) | 64 | static inline void *wpan_phy_priv(struct wpan_phy *phy) |
| 53 | { | 65 | { |
| @@ -56,6 +68,12 @@ static inline void *wpan_phy_priv(struct wpan_phy *phy) | |||
| 56 | } | 68 | } |
| 57 | 69 | ||
| 58 | struct wpan_phy *wpan_phy_find(const char *str); | 70 | struct wpan_phy *wpan_phy_find(const char *str); |
| 71 | |||
| 72 | static inline void wpan_phy_put(struct wpan_phy *phy) | ||
| 73 | { | ||
| 74 | put_device(&phy->dev); | ||
| 75 | } | ||
| 76 | |||
| 59 | static inline const char *wpan_phy_name(struct wpan_phy *phy) | 77 | static inline const char *wpan_phy_name(struct wpan_phy *phy) |
| 60 | { | 78 | { |
| 61 | return dev_name(&phy->dev); | 79 | return dev_name(&phy->dev); |
diff --git a/include/net/x25.h b/include/net/x25.h index 2cda04011568..468551ea4f1d 100644 --- a/include/net/x25.h +++ b/include/net/x25.h | |||
| @@ -10,6 +10,7 @@ | |||
| 10 | #ifndef _X25_H | 10 | #ifndef _X25_H |
| 11 | #define _X25_H | 11 | #define _X25_H |
| 12 | #include <linux/x25.h> | 12 | #include <linux/x25.h> |
| 13 | #include <linux/slab.h> | ||
| 13 | #include <net/sock.h> | 14 | #include <net/sock.h> |
| 14 | 15 | ||
| 15 | #define X25_ADDR_LEN 16 | 16 | #define X25_ADDR_LEN 16 |
| @@ -182,6 +183,10 @@ extern int sysctl_x25_clear_request_timeout; | |||
| 182 | extern int sysctl_x25_ack_holdback_timeout; | 183 | extern int sysctl_x25_ack_holdback_timeout; |
| 183 | extern int sysctl_x25_forward; | 184 | extern int sysctl_x25_forward; |
| 184 | 185 | ||
| 186 | extern int x25_parse_address_block(struct sk_buff *skb, | ||
| 187 | struct x25_address *called_addr, | ||
| 188 | struct x25_address *calling_addr); | ||
| 189 | |||
| 185 | extern int x25_addr_ntoa(unsigned char *, struct x25_address *, | 190 | extern int x25_addr_ntoa(unsigned char *, struct x25_address *, |
| 186 | struct x25_address *); | 191 | struct x25_address *); |
| 187 | extern int x25_addr_aton(unsigned char *, struct x25_address *, | 192 | extern int x25_addr_aton(unsigned char *, struct x25_address *, |
| @@ -287,8 +292,14 @@ extern unsigned long x25_display_timer(struct sock *); | |||
| 287 | extern void x25_check_rbuf(struct sock *); | 292 | extern void x25_check_rbuf(struct sock *); |
| 288 | 293 | ||
| 289 | /* sysctl_net_x25.c */ | 294 | /* sysctl_net_x25.c */ |
| 295 | #ifdef CONFIG_SYSCTL | ||
| 290 | extern void x25_register_sysctl(void); | 296 | extern void x25_register_sysctl(void); |
| 291 | extern void x25_unregister_sysctl(void); | 297 | extern void x25_unregister_sysctl(void); |
| 298 | #else | ||
| 299 | static inline void x25_register_sysctl(void) {}; | ||
| 300 | static inline void x25_unregister_sysctl(void) {}; | ||
| 301 | #endif /* CONFIG_SYSCTL */ | ||
| 302 | |||
| 292 | struct x25_skb_cb { | 303 | struct x25_skb_cb { |
| 293 | unsigned flags; | 304 | unsigned flags; |
| 294 | }; | 305 | }; |
diff --git a/include/net/xfrm.h b/include/net/xfrm.h index 223e90a44824..ac52f33f3e4a 100644 --- a/include/net/xfrm.h +++ b/include/net/xfrm.h | |||
| @@ -12,6 +12,7 @@ | |||
| 12 | #include <linux/in6.h> | 12 | #include <linux/in6.h> |
| 13 | #include <linux/mutex.h> | 13 | #include <linux/mutex.h> |
| 14 | #include <linux/audit.h> | 14 | #include <linux/audit.h> |
| 15 | #include <linux/slab.h> | ||
| 15 | 16 | ||
| 16 | #include <net/sock.h> | 17 | #include <net/sock.h> |
| 17 | #include <net/dst.h> | 18 | #include <net/dst.h> |
| @@ -19,6 +20,9 @@ | |||
| 19 | #include <net/route.h> | 20 | #include <net/route.h> |
| 20 | #include <net/ipv6.h> | 21 | #include <net/ipv6.h> |
| 21 | #include <net/ip6_fib.h> | 22 | #include <net/ip6_fib.h> |
| 23 | |||
| 24 | #include <linux/interrupt.h> | ||
| 25 | |||
| 22 | #ifdef CONFIG_XFRM_STATISTICS | 26 | #ifdef CONFIG_XFRM_STATISTICS |
| 23 | #include <net/snmp.h> | 27 | #include <net/snmp.h> |
| 24 | #endif | 28 | #endif |
| @@ -121,8 +125,7 @@ struct xfrm_state_walk { | |||
| 121 | }; | 125 | }; |
| 122 | 126 | ||
| 123 | /* Full description of state of transformer. */ | 127 | /* Full description of state of transformer. */ |
| 124 | struct xfrm_state | 128 | struct xfrm_state { |
| 125 | { | ||
| 126 | #ifdef CONFIG_NET_NS | 129 | #ifdef CONFIG_NET_NS |
| 127 | struct net *xs_net; | 130 | struct net *xs_net; |
| 128 | #endif | 131 | #endif |
| @@ -138,6 +141,7 @@ struct xfrm_state | |||
| 138 | 141 | ||
| 139 | struct xfrm_id id; | 142 | struct xfrm_id id; |
| 140 | struct xfrm_selector sel; | 143 | struct xfrm_selector sel; |
| 144 | struct xfrm_mark mark; | ||
| 141 | 145 | ||
| 142 | u32 genid; | 146 | u32 genid; |
| 143 | 147 | ||
| @@ -160,7 +164,7 @@ struct xfrm_state | |||
| 160 | struct xfrm_lifetime_cfg lft; | 164 | struct xfrm_lifetime_cfg lft; |
| 161 | 165 | ||
| 162 | /* Data for transformer */ | 166 | /* Data for transformer */ |
| 163 | struct xfrm_algo *aalg; | 167 | struct xfrm_algo_auth *aalg; |
| 164 | struct xfrm_algo *ealg; | 168 | struct xfrm_algo *ealg; |
| 165 | struct xfrm_algo *calg; | 169 | struct xfrm_algo *calg; |
| 166 | struct xfrm_algo_aead *aead; | 170 | struct xfrm_algo_aead *aead; |
| @@ -199,7 +203,7 @@ struct xfrm_state | |||
| 199 | struct xfrm_stats stats; | 203 | struct xfrm_stats stats; |
| 200 | 204 | ||
| 201 | struct xfrm_lifetime_cur curlft; | 205 | struct xfrm_lifetime_cur curlft; |
| 202 | struct timer_list timer; | 206 | struct tasklet_hrtimer mtimer; |
| 203 | 207 | ||
| 204 | /* Last used time */ | 208 | /* Last used time */ |
| 205 | unsigned long lastused; | 209 | unsigned long lastused; |
| @@ -237,8 +241,7 @@ enum { | |||
| 237 | }; | 241 | }; |
| 238 | 242 | ||
| 239 | /* callback structure passed from either netlink or pfkey */ | 243 | /* callback structure passed from either netlink or pfkey */ |
| 240 | struct km_event | 244 | struct km_event { |
| 241 | { | ||
| 242 | union { | 245 | union { |
| 243 | u32 hard; | 246 | u32 hard; |
| 244 | u32 proto; | 247 | u32 proto; |
| @@ -273,7 +276,8 @@ struct xfrm_policy_afinfo { | |||
| 273 | struct dst_entry *dst, | 276 | struct dst_entry *dst, |
| 274 | int nfheader_len); | 277 | int nfheader_len); |
| 275 | int (*fill_dst)(struct xfrm_dst *xdst, | 278 | int (*fill_dst)(struct xfrm_dst *xdst, |
| 276 | struct net_device *dev); | 279 | struct net_device *dev, |
| 280 | struct flowi *fl); | ||
| 277 | }; | 281 | }; |
| 278 | 282 | ||
| 279 | extern int xfrm_policy_register_afinfo(struct xfrm_policy_afinfo *afinfo); | 283 | extern int xfrm_policy_register_afinfo(struct xfrm_policy_afinfo *afinfo); |
| @@ -313,12 +317,11 @@ extern int xfrm_state_unregister_afinfo(struct xfrm_state_afinfo *afinfo); | |||
| 313 | 317 | ||
| 314 | extern void xfrm_state_delete_tunnel(struct xfrm_state *x); | 318 | extern void xfrm_state_delete_tunnel(struct xfrm_state *x); |
| 315 | 319 | ||
| 316 | struct xfrm_type | 320 | struct xfrm_type { |
| 317 | { | ||
| 318 | char *description; | 321 | char *description; |
| 319 | struct module *owner; | 322 | struct module *owner; |
| 320 | __u8 proto; | 323 | u8 proto; |
| 321 | __u8 flags; | 324 | u8 flags; |
| 322 | #define XFRM_TYPE_NON_FRAGMENT 1 | 325 | #define XFRM_TYPE_NON_FRAGMENT 1 |
| 323 | #define XFRM_TYPE_REPLAY_PROT 2 | 326 | #define XFRM_TYPE_REPLAY_PROT 2 |
| 324 | #define XFRM_TYPE_LOCAL_COADDR 4 | 327 | #define XFRM_TYPE_LOCAL_COADDR 4 |
| @@ -420,8 +423,7 @@ static inline struct xfrm_mode *xfrm_ip2inner_mode(struct xfrm_state *x, int ipp | |||
| 420 | return x->inner_mode_iaf; | 423 | return x->inner_mode_iaf; |
| 421 | } | 424 | } |
| 422 | 425 | ||
| 423 | struct xfrm_tmpl | 426 | struct xfrm_tmpl { |
| 424 | { | ||
| 425 | /* id in template is interpreted as: | 427 | /* id in template is interpreted as: |
| 426 | * daddr - destination of tunnel, may be zero for transport mode. | 428 | * daddr - destination of tunnel, may be zero for transport mode. |
| 427 | * spi - zero to acquire spi. Not zero if spi is static, then | 429 | * spi - zero to acquire spi. Not zero if spi is static, then |
| @@ -435,24 +437,24 @@ struct xfrm_tmpl | |||
| 435 | 437 | ||
| 436 | unsigned short encap_family; | 438 | unsigned short encap_family; |
| 437 | 439 | ||
| 438 | __u32 reqid; | 440 | u32 reqid; |
| 439 | 441 | ||
| 440 | /* Mode: transport, tunnel etc. */ | 442 | /* Mode: transport, tunnel etc. */ |
| 441 | __u8 mode; | 443 | u8 mode; |
| 442 | 444 | ||
| 443 | /* Sharing mode: unique, this session only, this user only etc. */ | 445 | /* Sharing mode: unique, this session only, this user only etc. */ |
| 444 | __u8 share; | 446 | u8 share; |
| 445 | 447 | ||
| 446 | /* May skip this transfomration if no SA is found */ | 448 | /* May skip this transfomration if no SA is found */ |
| 447 | __u8 optional; | 449 | u8 optional; |
| 448 | 450 | ||
| 449 | /* Skip aalgos/ealgos/calgos checks. */ | 451 | /* Skip aalgos/ealgos/calgos checks. */ |
| 450 | __u8 allalgs; | 452 | u8 allalgs; |
| 451 | 453 | ||
| 452 | /* Bit mask of algos allowed for acquisition */ | 454 | /* Bit mask of algos allowed for acquisition */ |
| 453 | __u32 aalgos; | 455 | u32 aalgos; |
| 454 | __u32 ealgos; | 456 | u32 ealgos; |
| 455 | __u32 calgos; | 457 | u32 calgos; |
| 456 | }; | 458 | }; |
| 457 | 459 | ||
| 458 | #define XFRM_MAX_DEPTH 6 | 460 | #define XFRM_MAX_DEPTH 6 |
| @@ -468,8 +470,7 @@ struct xfrm_policy_walk { | |||
| 468 | u32 seq; | 470 | u32 seq; |
| 469 | }; | 471 | }; |
| 470 | 472 | ||
| 471 | struct xfrm_policy | 473 | struct xfrm_policy { |
| 472 | { | ||
| 473 | #ifdef CONFIG_NET_NS | 474 | #ifdef CONFIG_NET_NS |
| 474 | struct net *xp_net; | 475 | struct net *xp_net; |
| 475 | #endif | 476 | #endif |
| @@ -483,6 +484,7 @@ struct xfrm_policy | |||
| 483 | 484 | ||
| 484 | u32 priority; | 485 | u32 priority; |
| 485 | u32 index; | 486 | u32 index; |
| 487 | struct xfrm_mark mark; | ||
| 486 | struct xfrm_selector selector; | 488 | struct xfrm_selector selector; |
| 487 | struct xfrm_lifetime_cfg lft; | 489 | struct xfrm_lifetime_cfg lft; |
| 488 | struct xfrm_lifetime_cur curlft; | 490 | struct xfrm_lifetime_cur curlft; |
| @@ -538,8 +540,7 @@ struct xfrm_migrate { | |||
| 538 | /* default seq threshold size */ | 540 | /* default seq threshold size */ |
| 539 | #define XFRM_AE_SEQT_SIZE 2 | 541 | #define XFRM_AE_SEQT_SIZE 2 |
| 540 | 542 | ||
| 541 | struct xfrm_mgr | 543 | struct xfrm_mgr { |
| 542 | { | ||
| 543 | struct list_head list; | 544 | struct list_head list; |
| 544 | char *id; | 545 | char *id; |
| 545 | int (*notify)(struct xfrm_state *x, struct km_event *c); | 546 | int (*notify)(struct xfrm_state *x, struct km_event *c); |
| @@ -626,8 +627,7 @@ struct xfrm_spi_skb_cb { | |||
| 626 | #define XFRM_SPI_SKB_CB(__skb) ((struct xfrm_spi_skb_cb *)&((__skb)->cb[0])) | 627 | #define XFRM_SPI_SKB_CB(__skb) ((struct xfrm_spi_skb_cb *)&((__skb)->cb[0])) |
| 627 | 628 | ||
| 628 | /* Audit Information */ | 629 | /* Audit Information */ |
| 629 | struct xfrm_audit | 630 | struct xfrm_audit { |
| 630 | { | ||
| 631 | u32 secid; | 631 | u32 secid; |
| 632 | uid_t loginuid; | 632 | uid_t loginuid; |
| 633 | u32 sessionid; | 633 | u32 sessionid; |
| @@ -774,7 +774,7 @@ static __inline__ int addr_match(void *token1, void *token2, int prefixlen) | |||
| 774 | int pdw; | 774 | int pdw; |
| 775 | int pbi; | 775 | int pbi; |
| 776 | 776 | ||
| 777 | pdw = prefixlen >> 5; /* num of whole __u32 in prefix */ | 777 | pdw = prefixlen >> 5; /* num of whole u32 in prefix */ |
| 778 | pbi = prefixlen & 0x1f; /* num of bits in incomplete u32 in prefix */ | 778 | pbi = prefixlen & 0x1f; /* num of bits in incomplete u32 in prefix */ |
| 779 | 779 | ||
| 780 | if (pdw) | 780 | if (pdw) |
| @@ -871,8 +871,7 @@ static inline int xfrm_sec_ctx_match(struct xfrm_sec_ctx *s1, struct xfrm_sec_ct | |||
| 871 | * bundles differing by session id. All the bundles grow from a parent | 871 | * bundles differing by session id. All the bundles grow from a parent |
| 872 | * policy rule. | 872 | * policy rule. |
| 873 | */ | 873 | */ |
| 874 | struct xfrm_dst | 874 | struct xfrm_dst { |
| 875 | { | ||
| 876 | union { | 875 | union { |
| 877 | struct dst_entry dst; | 876 | struct dst_entry dst; |
| 878 | struct rtable rt; | 877 | struct rtable rt; |
| @@ -907,8 +906,7 @@ static inline void xfrm_dst_destroy(struct xfrm_dst *xdst) | |||
| 907 | 906 | ||
| 908 | extern void xfrm_dst_ifdown(struct dst_entry *dst, struct net_device *dev); | 907 | extern void xfrm_dst_ifdown(struct dst_entry *dst, struct net_device *dev); |
| 909 | 908 | ||
| 910 | struct sec_path | 909 | struct sec_path { |
| 911 | { | ||
| 912 | atomic_t refcnt; | 910 | atomic_t refcnt; |
| 913 | int len; | 911 | int len; |
| 914 | struct xfrm_state *xvec[XFRM_MAX_DEPTH]; | 912 | struct xfrm_state *xvec[XFRM_MAX_DEPTH]; |
| @@ -1265,7 +1263,7 @@ struct xfrm_algo_desc { | |||
| 1265 | /* XFRM tunnel handlers. */ | 1263 | /* XFRM tunnel handlers. */ |
| 1266 | struct xfrm_tunnel { | 1264 | struct xfrm_tunnel { |
| 1267 | int (*handler)(struct sk_buff *skb); | 1265 | int (*handler)(struct sk_buff *skb); |
| 1268 | int (*err_handler)(struct sk_buff *skb, __u32 info); | 1266 | int (*err_handler)(struct sk_buff *skb, u32 info); |
| 1269 | 1267 | ||
| 1270 | struct xfrm_tunnel *next; | 1268 | struct xfrm_tunnel *next; |
| 1271 | int priority; | 1269 | int priority; |
| @@ -1323,7 +1321,7 @@ extern struct xfrm_state *xfrm_state_find(xfrm_address_t *daddr, xfrm_address_t | |||
| 1323 | struct flowi *fl, struct xfrm_tmpl *tmpl, | 1321 | struct flowi *fl, struct xfrm_tmpl *tmpl, |
| 1324 | struct xfrm_policy *pol, int *err, | 1322 | struct xfrm_policy *pol, int *err, |
| 1325 | unsigned short family); | 1323 | unsigned short family); |
| 1326 | extern struct xfrm_state * xfrm_stateonly_find(struct net *net, | 1324 | extern struct xfrm_state *xfrm_stateonly_find(struct net *net, u32 mark, |
| 1327 | xfrm_address_t *daddr, | 1325 | xfrm_address_t *daddr, |
| 1328 | xfrm_address_t *saddr, | 1326 | xfrm_address_t *saddr, |
| 1329 | unsigned short family, | 1327 | unsigned short family, |
| @@ -1332,8 +1330,14 @@ extern int xfrm_state_check_expire(struct xfrm_state *x); | |||
| 1332 | extern void xfrm_state_insert(struct xfrm_state *x); | 1330 | extern void xfrm_state_insert(struct xfrm_state *x); |
| 1333 | extern int xfrm_state_add(struct xfrm_state *x); | 1331 | extern int xfrm_state_add(struct xfrm_state *x); |
| 1334 | extern int xfrm_state_update(struct xfrm_state *x); | 1332 | extern int xfrm_state_update(struct xfrm_state *x); |
| 1335 | extern struct xfrm_state *xfrm_state_lookup(struct net *net, xfrm_address_t *daddr, __be32 spi, u8 proto, unsigned short family); | 1333 | extern struct xfrm_state *xfrm_state_lookup(struct net *net, u32 mark, |
| 1336 | extern struct xfrm_state *xfrm_state_lookup_byaddr(struct net *net, xfrm_address_t *daddr, xfrm_address_t *saddr, u8 proto, unsigned short family); | 1334 | xfrm_address_t *daddr, __be32 spi, |
| 1335 | u8 proto, unsigned short family); | ||
| 1336 | extern struct xfrm_state *xfrm_state_lookup_byaddr(struct net *net, u32 mark, | ||
| 1337 | xfrm_address_t *daddr, | ||
| 1338 | xfrm_address_t *saddr, | ||
| 1339 | u8 proto, | ||
| 1340 | unsigned short family); | ||
| 1337 | #ifdef CONFIG_XFRM_SUB_POLICY | 1341 | #ifdef CONFIG_XFRM_SUB_POLICY |
| 1338 | extern int xfrm_tmpl_sort(struct xfrm_tmpl **dst, struct xfrm_tmpl **src, | 1342 | extern int xfrm_tmpl_sort(struct xfrm_tmpl **dst, struct xfrm_tmpl **src, |
| 1339 | int n, unsigned short family); | 1343 | int n, unsigned short family); |
| @@ -1370,11 +1374,12 @@ struct xfrmk_spdinfo { | |||
| 1370 | u32 spdhmcnt; | 1374 | u32 spdhmcnt; |
| 1371 | }; | 1375 | }; |
| 1372 | 1376 | ||
| 1373 | extern struct xfrm_state *xfrm_find_acq_byseq(struct net *net, u32 seq); | 1377 | extern struct xfrm_state *xfrm_find_acq_byseq(struct net *net, u32 mark, |
| 1378 | u32 seq); | ||
| 1374 | extern int xfrm_state_delete(struct xfrm_state *x); | 1379 | extern int xfrm_state_delete(struct xfrm_state *x); |
| 1375 | extern int xfrm_state_flush(struct net *net, u8 proto, struct xfrm_audit *audit_info); | 1380 | extern int xfrm_state_flush(struct net *net, u8 proto, struct xfrm_audit *audit_info); |
| 1376 | extern void xfrm_sad_getinfo(struct xfrmk_sadinfo *si); | 1381 | extern void xfrm_sad_getinfo(struct net *net, struct xfrmk_sadinfo *si); |
| 1377 | extern void xfrm_spd_getinfo(struct xfrmk_spdinfo *si); | 1382 | extern void xfrm_spd_getinfo(struct net *net, struct xfrmk_spdinfo *si); |
| 1378 | extern int xfrm_replay_check(struct xfrm_state *x, | 1383 | extern int xfrm_replay_check(struct xfrm_state *x, |
| 1379 | struct sk_buff *skb, __be32 seq); | 1384 | struct sk_buff *skb, __be32 seq); |
| 1380 | extern void xfrm_replay_advance(struct xfrm_state *x, __be32 seq); | 1385 | extern void xfrm_replay_advance(struct xfrm_state *x, __be32 seq); |
| @@ -1414,9 +1419,9 @@ extern int xfrm6_input_addr(struct sk_buff *skb, xfrm_address_t *daddr, | |||
| 1414 | xfrm_address_t *saddr, u8 proto); | 1419 | xfrm_address_t *saddr, u8 proto); |
| 1415 | extern int xfrm6_tunnel_register(struct xfrm6_tunnel *handler, unsigned short family); | 1420 | extern int xfrm6_tunnel_register(struct xfrm6_tunnel *handler, unsigned short family); |
| 1416 | extern int xfrm6_tunnel_deregister(struct xfrm6_tunnel *handler, unsigned short family); | 1421 | extern int xfrm6_tunnel_deregister(struct xfrm6_tunnel *handler, unsigned short family); |
| 1417 | extern __be32 xfrm6_tunnel_alloc_spi(xfrm_address_t *saddr); | 1422 | extern __be32 xfrm6_tunnel_alloc_spi(struct net *net, xfrm_address_t *saddr); |
| 1418 | extern void xfrm6_tunnel_free_spi(xfrm_address_t *saddr); | 1423 | extern void xfrm6_tunnel_free_spi(struct net *net, xfrm_address_t *saddr); |
| 1419 | extern __be32 xfrm6_tunnel_spi_lookup(xfrm_address_t *saddr); | 1424 | extern __be32 xfrm6_tunnel_spi_lookup(struct net *net, xfrm_address_t *saddr); |
| 1420 | extern int xfrm6_extract_output(struct xfrm_state *x, struct sk_buff *skb); | 1425 | extern int xfrm6_extract_output(struct xfrm_state *x, struct sk_buff *skb); |
| 1421 | extern int xfrm6_prepare_output(struct xfrm_state *x, struct sk_buff *skb); | 1426 | extern int xfrm6_prepare_output(struct xfrm_state *x, struct sk_buff *skb); |
| 1422 | extern int xfrm6_output(struct sk_buff *skb); | 1427 | extern int xfrm6_output(struct sk_buff *skb); |
| @@ -1447,17 +1452,20 @@ extern int xfrm_policy_walk(struct net *net, struct xfrm_policy_walk *walk, | |||
| 1447 | int (*func)(struct xfrm_policy *, int, int, void*), void *); | 1452 | int (*func)(struct xfrm_policy *, int, int, void*), void *); |
| 1448 | extern void xfrm_policy_walk_done(struct xfrm_policy_walk *walk); | 1453 | extern void xfrm_policy_walk_done(struct xfrm_policy_walk *walk); |
| 1449 | int xfrm_policy_insert(int dir, struct xfrm_policy *policy, int excl); | 1454 | int xfrm_policy_insert(int dir, struct xfrm_policy *policy, int excl); |
| 1450 | struct xfrm_policy *xfrm_policy_bysel_ctx(struct net *net, u8 type, int dir, | 1455 | struct xfrm_policy *xfrm_policy_bysel_ctx(struct net *net, u32 mark, |
| 1456 | u8 type, int dir, | ||
| 1451 | struct xfrm_selector *sel, | 1457 | struct xfrm_selector *sel, |
| 1452 | struct xfrm_sec_ctx *ctx, int delete, | 1458 | struct xfrm_sec_ctx *ctx, int delete, |
| 1453 | int *err); | 1459 | int *err); |
| 1454 | struct xfrm_policy *xfrm_policy_byid(struct net *net, u8, int dir, u32 id, int delete, int *err); | 1460 | struct xfrm_policy *xfrm_policy_byid(struct net *net, u32 mark, u8, int dir, u32 id, int delete, int *err); |
| 1455 | int xfrm_policy_flush(struct net *net, u8 type, struct xfrm_audit *audit_info); | 1461 | int xfrm_policy_flush(struct net *net, u8 type, struct xfrm_audit *audit_info); |
| 1456 | u32 xfrm_get_acqseq(void); | 1462 | u32 xfrm_get_acqseq(void); |
| 1457 | extern int xfrm_alloc_spi(struct xfrm_state *x, u32 minspi, u32 maxspi); | 1463 | extern int xfrm_alloc_spi(struct xfrm_state *x, u32 minspi, u32 maxspi); |
| 1458 | struct xfrm_state * xfrm_find_acq(struct net *net, u8 mode, u32 reqid, u8 proto, | 1464 | struct xfrm_state *xfrm_find_acq(struct net *net, struct xfrm_mark *mark, |
| 1459 | xfrm_address_t *daddr, xfrm_address_t *saddr, | 1465 | u8 mode, u32 reqid, u8 proto, |
| 1460 | int create, unsigned short family); | 1466 | xfrm_address_t *daddr, |
| 1467 | xfrm_address_t *saddr, int create, | ||
| 1468 | unsigned short family); | ||
| 1461 | extern int xfrm_sk_policy_insert(struct sock *sk, int dir, struct xfrm_policy *pol); | 1469 | extern int xfrm_sk_policy_insert(struct sock *sk, int dir, struct xfrm_policy *pol); |
| 1462 | extern int xfrm_bundle_ok(struct xfrm_policy *pol, struct xfrm_dst *xdst, | 1470 | extern int xfrm_bundle_ok(struct xfrm_policy *pol, struct xfrm_dst *xdst, |
| 1463 | struct flowi *fl, int family, int strict); | 1471 | struct flowi *fl, int family, int strict); |
| @@ -1500,16 +1508,13 @@ struct scatterlist; | |||
| 1500 | typedef int (icv_update_fn_t)(struct hash_desc *, struct scatterlist *, | 1508 | typedef int (icv_update_fn_t)(struct hash_desc *, struct scatterlist *, |
| 1501 | unsigned int); | 1509 | unsigned int); |
| 1502 | 1510 | ||
| 1503 | extern int skb_icv_walk(const struct sk_buff *skb, struct hash_desc *tfm, | ||
| 1504 | int offset, int len, icv_update_fn_t icv_update); | ||
| 1505 | |||
| 1506 | static inline int xfrm_addr_cmp(xfrm_address_t *a, xfrm_address_t *b, | 1511 | static inline int xfrm_addr_cmp(xfrm_address_t *a, xfrm_address_t *b, |
| 1507 | int family) | 1512 | int family) |
| 1508 | { | 1513 | { |
| 1509 | switch (family) { | 1514 | switch (family) { |
| 1510 | default: | 1515 | default: |
| 1511 | case AF_INET: | 1516 | case AF_INET: |
| 1512 | return (__force __u32)a->a4 - (__force __u32)b->a4; | 1517 | return (__force u32)a->a4 - (__force u32)b->a4; |
| 1513 | case AF_INET6: | 1518 | case AF_INET6: |
| 1514 | return ipv6_addr_cmp((struct in6_addr *)a, | 1519 | return ipv6_addr_cmp((struct in6_addr *)a, |
| 1515 | (struct in6_addr *)b); | 1520 | (struct in6_addr *)b); |
| @@ -1541,12 +1546,22 @@ static inline int xfrm_alg_len(struct xfrm_algo *alg) | |||
| 1541 | return sizeof(*alg) + ((alg->alg_key_len + 7) / 8); | 1546 | return sizeof(*alg) + ((alg->alg_key_len + 7) / 8); |
| 1542 | } | 1547 | } |
| 1543 | 1548 | ||
| 1549 | static inline int xfrm_alg_auth_len(struct xfrm_algo_auth *alg) | ||
| 1550 | { | ||
| 1551 | return sizeof(*alg) + ((alg->alg_key_len + 7) / 8); | ||
| 1552 | } | ||
| 1553 | |||
| 1544 | #ifdef CONFIG_XFRM_MIGRATE | 1554 | #ifdef CONFIG_XFRM_MIGRATE |
| 1545 | static inline struct xfrm_algo *xfrm_algo_clone(struct xfrm_algo *orig) | 1555 | static inline struct xfrm_algo *xfrm_algo_clone(struct xfrm_algo *orig) |
| 1546 | { | 1556 | { |
| 1547 | return kmemdup(orig, xfrm_alg_len(orig), GFP_KERNEL); | 1557 | return kmemdup(orig, xfrm_alg_len(orig), GFP_KERNEL); |
| 1548 | } | 1558 | } |
| 1549 | 1559 | ||
| 1560 | static inline struct xfrm_algo_auth *xfrm_algo_auth_clone(struct xfrm_algo_auth *orig) | ||
| 1561 | { | ||
| 1562 | return kmemdup(orig, xfrm_alg_auth_len(orig), GFP_KERNEL); | ||
| 1563 | } | ||
| 1564 | |||
| 1550 | static inline void xfrm_states_put(struct xfrm_state **states, int n) | 1565 | static inline void xfrm_states_put(struct xfrm_state **states, int n) |
| 1551 | { | 1566 | { |
| 1552 | int i; | 1567 | int i; |
| @@ -1569,4 +1584,24 @@ static inline struct xfrm_state *xfrm_input_state(struct sk_buff *skb) | |||
| 1569 | } | 1584 | } |
| 1570 | #endif | 1585 | #endif |
| 1571 | 1586 | ||
| 1587 | static inline int xfrm_mark_get(struct nlattr **attrs, struct xfrm_mark *m) | ||
| 1588 | { | ||
| 1589 | if (attrs[XFRMA_MARK]) | ||
| 1590 | memcpy(m, nla_data(attrs[XFRMA_MARK]), sizeof(m)); | ||
| 1591 | else | ||
| 1592 | m->v = m->m = 0; | ||
| 1593 | |||
| 1594 | return m->v & m->m; | ||
| 1595 | } | ||
| 1596 | |||
| 1597 | static inline int xfrm_mark_put(struct sk_buff *skb, struct xfrm_mark *m) | ||
| 1598 | { | ||
| 1599 | if (m->m | m->v) | ||
| 1600 | NLA_PUT(skb, XFRMA_MARK, sizeof(struct xfrm_mark), m); | ||
| 1601 | return 0; | ||
| 1602 | |||
| 1603 | nla_put_failure: | ||
| 1604 | return -1; | ||
| 1605 | } | ||
| 1606 | |||
| 1572 | #endif /* _NET_XFRM_H */ | 1607 | #endif /* _NET_XFRM_H */ |
diff --git a/include/pcmcia/cs.h b/include/pcmcia/cs.h index 904468a191ef..75fa3530345b 100644 --- a/include/pcmcia/cs.h +++ b/include/pcmcia/cs.h | |||
| @@ -15,6 +15,10 @@ | |||
| 15 | #ifndef _LINUX_CS_H | 15 | #ifndef _LINUX_CS_H |
| 16 | #define _LINUX_CS_H | 16 | #define _LINUX_CS_H |
| 17 | 17 | ||
| 18 | #ifdef __KERNEL__ | ||
| 19 | #include <linux/interrupt.h> | ||
| 20 | #endif | ||
| 21 | |||
| 18 | /* For AccessConfigurationRegister */ | 22 | /* For AccessConfigurationRegister */ |
| 19 | typedef struct conf_reg_t { | 23 | typedef struct conf_reg_t { |
| 20 | u_char Function; | 24 | u_char Function; |
| @@ -111,11 +115,9 @@ typedef struct io_req_t { | |||
| 111 | 115 | ||
| 112 | /* For RequestIRQ and ReleaseIRQ */ | 116 | /* For RequestIRQ and ReleaseIRQ */ |
| 113 | typedef struct irq_req_t { | 117 | typedef struct irq_req_t { |
| 114 | u_int Attributes; | 118 | u_int Attributes; |
| 115 | u_int AssignedIRQ; | 119 | u_int AssignedIRQ; |
| 116 | u_int IRQInfo1, IRQInfo2; /* IRQInfo2 is ignored */ | 120 | irq_handler_t Handler; |
| 117 | void *Handler; | ||
| 118 | void *Instance; | ||
| 119 | } irq_req_t; | 121 | } irq_req_t; |
| 120 | 122 | ||
| 121 | /* Attributes for RequestIRQ and ReleaseIRQ */ | 123 | /* Attributes for RequestIRQ and ReleaseIRQ */ |
| @@ -124,8 +126,8 @@ typedef struct irq_req_t { | |||
| 124 | #define IRQ_TYPE_TIME 0x01 | 126 | #define IRQ_TYPE_TIME 0x01 |
| 125 | #define IRQ_TYPE_DYNAMIC_SHARING 0x02 | 127 | #define IRQ_TYPE_DYNAMIC_SHARING 0x02 |
| 126 | #define IRQ_FORCED_PULSE 0x04 | 128 | #define IRQ_FORCED_PULSE 0x04 |
| 127 | #define IRQ_FIRST_SHARED 0x08 | 129 | #define IRQ_FIRST_SHARED 0x08 /* unused */ |
| 128 | #define IRQ_HANDLE_PRESENT 0x10 | 130 | #define IRQ_HANDLE_PRESENT 0x10 /* unused */ |
| 129 | #define IRQ_PULSE_ALLOCATED 0x100 | 131 | #define IRQ_PULSE_ALLOCATED 0x100 |
| 130 | 132 | ||
| 131 | /* Bits in IRQInfo1 field */ | 133 | /* Bits in IRQInfo1 field */ |
diff --git a/include/pcmcia/cs_types.h b/include/pcmcia/cs_types.h index 315965a37930..f5e3b8386c8f 100644 --- a/include/pcmcia/cs_types.h +++ b/include/pcmcia/cs_types.h | |||
| @@ -26,8 +26,7 @@ typedef u_int event_t; | |||
| 26 | typedef u_char cisdata_t; | 26 | typedef u_char cisdata_t; |
| 27 | typedef u_short page_t; | 27 | typedef u_short page_t; |
| 28 | 28 | ||
| 29 | struct window_t; | 29 | typedef unsigned long window_handle_t; |
| 30 | typedef struct window_t *window_handle_t; | ||
| 31 | 30 | ||
| 32 | struct region_t; | 31 | struct region_t; |
| 33 | typedef struct region_t *memory_handle_t; | 32 | typedef struct region_t *memory_handle_t; |
diff --git a/include/pcmcia/device_id.h b/include/pcmcia/device_id.h index c33ea08352b8..63e5b8f6b7dd 100644 --- a/include/pcmcia/device_id.h +++ b/include/pcmcia/device_id.h | |||
| @@ -34,6 +34,11 @@ | |||
| 34 | .prod_id = { NULL, (v2), NULL, NULL }, \ | 34 | .prod_id = { NULL, (v2), NULL, NULL }, \ |
| 35 | .prod_id_hash = { 0, (vh2), 0, 0 }, } | 35 | .prod_id_hash = { 0, (vh2), 0, 0 }, } |
| 36 | 36 | ||
| 37 | #define PCMCIA_DEVICE_PROD_ID3(v3, vh3) { \ | ||
| 38 | .match_flags = PCMCIA_DEV_ID_MATCH_PROD_ID3, \ | ||
| 39 | .prod_id = { NULL, NULL, (v3), NULL }, \ | ||
| 40 | .prod_id_hash = { 0, 0, (vh3), 0 }, } | ||
| 41 | |||
| 37 | #define PCMCIA_DEVICE_PROD_ID12(v1, v2, vh1, vh2) { \ | 42 | #define PCMCIA_DEVICE_PROD_ID12(v1, v2, vh1, vh2) { \ |
| 38 | .match_flags = PCMCIA_DEV_ID_MATCH_PROD_ID1| \ | 43 | .match_flags = PCMCIA_DEV_ID_MATCH_PROD_ID1| \ |
| 39 | PCMCIA_DEV_ID_MATCH_PROD_ID2, \ | 44 | PCMCIA_DEV_ID_MATCH_PROD_ID2, \ |
diff --git a/include/pcmcia/ds.h b/include/pcmcia/ds.h index a2be80b9a095..aab3c13dc310 100644 --- a/include/pcmcia/ds.h +++ b/include/pcmcia/ds.h | |||
| @@ -26,6 +26,7 @@ | |||
| 26 | #ifdef __KERNEL__ | 26 | #ifdef __KERNEL__ |
| 27 | #include <linux/device.h> | 27 | #include <linux/device.h> |
| 28 | #include <pcmcia/ss.h> | 28 | #include <pcmcia/ss.h> |
| 29 | #include <asm/atomic.h> | ||
| 29 | 30 | ||
| 30 | /* | 31 | /* |
| 31 | * PCMCIA device drivers (16-bit cards only; 32-bit cards require CardBus | 32 | * PCMCIA device drivers (16-bit cards only; 32-bit cards require CardBus |
| @@ -34,12 +35,13 @@ | |||
| 34 | struct pcmcia_socket; | 35 | struct pcmcia_socket; |
| 35 | struct pcmcia_device; | 36 | struct pcmcia_device; |
| 36 | struct config_t; | 37 | struct config_t; |
| 38 | struct net_device; | ||
| 37 | 39 | ||
| 38 | /* dynamic device IDs for PCMCIA device drivers. See | 40 | /* dynamic device IDs for PCMCIA device drivers. See |
| 39 | * Documentation/pcmcia/driver.txt for details. | 41 | * Documentation/pcmcia/driver.txt for details. |
| 40 | */ | 42 | */ |
| 41 | struct pcmcia_dynids { | 43 | struct pcmcia_dynids { |
| 42 | spinlock_t lock; | 44 | struct mutex lock; |
| 43 | struct list_head list; | 45 | struct list_head list; |
| 44 | }; | 46 | }; |
| 45 | 47 | ||
| @@ -81,7 +83,7 @@ struct pcmcia_device { | |||
| 81 | /* the hardware "function" device; certain subdevices can | 83 | /* the hardware "function" device; certain subdevices can |
| 82 | * share one hardware "function" device. */ | 84 | * share one hardware "function" device. */ |
| 83 | u8 func; | 85 | u8 func; |
| 84 | struct config_t* function_config; | 86 | struct config_t *function_config; |
| 85 | 87 | ||
| 86 | struct list_head socket_device_list; | 88 | struct list_head socket_device_list; |
| 87 | 89 | ||
| @@ -93,10 +95,8 @@ struct pcmcia_device { | |||
| 93 | config_req_t conf; | 95 | config_req_t conf; |
| 94 | window_handle_t win; | 96 | window_handle_t win; |
| 95 | 97 | ||
| 96 | /* Is the device suspended, or in the process of | 98 | /* Is the device suspended? */ |
| 97 | * being removed? */ | ||
| 98 | u16 suspended:1; | 99 | u16 suspended:1; |
| 99 | u16 _removed:1; | ||
| 100 | 100 | ||
| 101 | /* Flags whether io, irq, win configurations were | 101 | /* Flags whether io, irq, win configurations were |
| 102 | * requested, and whether the configuration is "locked" */ | 102 | * requested, and whether the configuration is "locked" */ |
| @@ -114,20 +114,20 @@ struct pcmcia_device { | |||
| 114 | u16 has_card_id:1; | 114 | u16 has_card_id:1; |
| 115 | u16 has_func_id:1; | 115 | u16 has_func_id:1; |
| 116 | 116 | ||
| 117 | u16 reserved:3; | 117 | u16 reserved:4; |
| 118 | 118 | ||
| 119 | u8 func_id; | 119 | u8 func_id; |
| 120 | u16 manf_id; | 120 | u16 manf_id; |
| 121 | u16 card_id; | 121 | u16 card_id; |
| 122 | 122 | ||
| 123 | char * prod_id[4]; | 123 | char *prod_id[4]; |
| 124 | 124 | ||
| 125 | u64 dma_mask; | 125 | u64 dma_mask; |
| 126 | struct device dev; | 126 | struct device dev; |
| 127 | 127 | ||
| 128 | #ifdef CONFIG_PCMCIA_IOCTL | 128 | #ifdef CONFIG_PCMCIA_IOCTL |
| 129 | /* device driver wanted by cardmgr */ | 129 | /* device driver wanted by cardmgr */ |
| 130 | struct pcmcia_driver * cardmgr; | 130 | struct pcmcia_driver *cardmgr; |
| 131 | #endif | 131 | #endif |
| 132 | 132 | ||
| 133 | /* data private to drivers */ | 133 | /* data private to drivers */ |
| @@ -137,65 +137,39 @@ struct pcmcia_device { | |||
| 137 | #define to_pcmcia_dev(n) container_of(n, struct pcmcia_device, dev) | 137 | #define to_pcmcia_dev(n) container_of(n, struct pcmcia_device, dev) |
| 138 | #define to_pcmcia_drv(n) container_of(n, struct pcmcia_driver, drv) | 138 | #define to_pcmcia_drv(n) container_of(n, struct pcmcia_driver, drv) |
| 139 | 139 | ||
| 140 | /* deprecated -- don't use! */ | ||
| 141 | #define handle_to_dev(handle) (handle->dev) | ||
| 142 | 140 | ||
| 143 | 141 | /* | |
| 144 | /* (deprecated) error reporting by PCMCIA devices. Use dev_printk() | 142 | * CIS access. |
| 145 | * or dev_dbg() directly in the driver, without referring to pcmcia_error_func() | 143 | * |
| 146 | * and/or pcmcia_error_ret() for those functions will go away soon. | 144 | * Please use the following functions to access CIS tuples: |
| 147 | */ | 145 | * - pcmcia_get_tuple() |
| 148 | enum service { | 146 | * - pcmcia_loop_tuple() |
| 149 | AccessConfigurationRegister, AddSocketServices, | 147 | * - pcmcia_get_mac_from_cis() |
| 150 | AdjustResourceInfo, CheckEraseQueue, CloseMemory, CopyMemory, | 148 | * |
| 151 | DeregisterClient, DeregisterEraseQueue, GetCardServicesInfo, | 149 | * To parse a tuple_t, pcmcia_parse_tuple() exists. Its interface |
| 152 | GetClientInfo, GetConfigurationInfo, GetEventMask, | 150 | * might change in future. |
| 153 | GetFirstClient, GetFirstPartion, GetFirstRegion, GetFirstTuple, | ||
| 154 | GetNextClient, GetNextPartition, GetNextRegion, GetNextTuple, | ||
| 155 | GetStatus, GetTupleData, MapLogSocket, MapLogWindow, MapMemPage, | ||
| 156 | MapPhySocket, MapPhyWindow, ModifyConfiguration, ModifyWindow, | ||
| 157 | OpenMemory, ParseTuple, ReadMemory, RegisterClient, | ||
| 158 | RegisterEraseQueue, RegisterMTD, RegisterTimer, | ||
| 159 | ReleaseConfiguration, ReleaseExclusive, ReleaseIO, ReleaseIRQ, | ||
| 160 | ReleaseSocketMask, ReleaseWindow, ReplaceSocketServices, | ||
| 161 | RequestConfiguration, RequestExclusive, RequestIO, RequestIRQ, | ||
| 162 | RequestSocketMask, RequestWindow, ResetCard, ReturnSSEntry, | ||
| 163 | SetEventMask, SetRegion, ValidateCIS, VendorSpecific, | ||
| 164 | WriteMemory, BindDevice, BindMTD, ReportError, | ||
| 165 | SuspendCard, ResumeCard, EjectCard, InsertCard, ReplaceCIS, | ||
| 166 | GetFirstWindow, GetNextWindow, GetMemPage | ||
| 167 | }; | ||
| 168 | const char *pcmcia_error_func(int func); | ||
| 169 | const char *pcmcia_error_ret(int ret); | ||
| 170 | |||
| 171 | #define cs_error(p_dev, func, ret) \ | ||
| 172 | { \ | ||
| 173 | dev_printk(KERN_NOTICE, &p_dev->dev, \ | ||
| 174 | "%s : %s\n", \ | ||
| 175 | pcmcia_error_func(func), \ | ||
| 176 | pcmcia_error_ret(ret)); \ | ||
| 177 | } | ||
| 178 | |||
| 179 | /* CIS access. | ||
| 180 | * Use the pcmcia_* versions in PCMCIA drivers | ||
| 181 | */ | 151 | */ |
| 182 | int pcmcia_parse_tuple(tuple_t *tuple, cisparse_t *parse); | ||
| 183 | 152 | ||
| 184 | int pccard_get_first_tuple(struct pcmcia_socket *s, unsigned int function, | 153 | /* get the very first CIS entry of type @code. Note that buf is pointer |
| 185 | tuple_t *tuple); | 154 | * to u8 *buf; and that you need to kfree(buf) afterwards. */ |
| 186 | #define pcmcia_get_first_tuple(p_dev, tuple) \ | 155 | size_t pcmcia_get_tuple(struct pcmcia_device *p_dev, cisdata_t code, |
| 187 | pccard_get_first_tuple(p_dev->socket, p_dev->func, tuple) | 156 | u8 **buf); |
| 188 | 157 | ||
| 189 | int pccard_get_next_tuple(struct pcmcia_socket *s, unsigned int function, | 158 | /* loop over CIS entries */ |
| 190 | tuple_t *tuple); | 159 | int pcmcia_loop_tuple(struct pcmcia_device *p_dev, cisdata_t code, |
| 191 | #define pcmcia_get_next_tuple(p_dev, tuple) \ | 160 | int (*loop_tuple) (struct pcmcia_device *p_dev, |
| 192 | pccard_get_next_tuple(p_dev->socket, p_dev->func, tuple) | 161 | tuple_t *tuple, |
| 162 | void *priv_data), | ||
| 163 | void *priv_data); | ||
| 193 | 164 | ||
| 194 | int pccard_get_tuple_data(struct pcmcia_socket *s, tuple_t *tuple); | 165 | /* get the MAC address from CISTPL_FUNCE */ |
| 195 | #define pcmcia_get_tuple_data(p_dev, tuple) \ | 166 | int pcmcia_get_mac_from_cis(struct pcmcia_device *p_dev, |
| 196 | pccard_get_tuple_data(p_dev->socket, tuple) | 167 | struct net_device *dev); |
| 197 | 168 | ||
| 198 | 169 | ||
| 170 | /* parse a tuple_t */ | ||
| 171 | int pcmcia_parse_tuple(tuple_t *tuple, cisparse_t *parse); | ||
| 172 | |||
| 199 | /* loop CIS entries for valid configuration */ | 173 | /* loop CIS entries for valid configuration */ |
| 200 | int pcmcia_loop_config(struct pcmcia_device *p_dev, | 174 | int pcmcia_loop_config(struct pcmcia_device *p_dev, |
| 201 | int (*conf_check) (struct pcmcia_device *p_dev, | 175 | int (*conf_check) (struct pcmcia_device *p_dev, |
| @@ -221,12 +195,11 @@ int pcmcia_request_irq(struct pcmcia_device *p_dev, irq_req_t *req); | |||
| 221 | int pcmcia_request_configuration(struct pcmcia_device *p_dev, | 195 | int pcmcia_request_configuration(struct pcmcia_device *p_dev, |
| 222 | config_req_t *req); | 196 | config_req_t *req); |
| 223 | 197 | ||
| 224 | int pcmcia_request_window(struct pcmcia_device **p_dev, win_req_t *req, | 198 | int pcmcia_request_window(struct pcmcia_device *p_dev, win_req_t *req, |
| 225 | window_handle_t *wh); | 199 | window_handle_t *wh); |
| 226 | int pcmcia_release_window(window_handle_t win); | 200 | int pcmcia_release_window(struct pcmcia_device *p_dev, window_handle_t win); |
| 227 | 201 | int pcmcia_map_mem_page(struct pcmcia_device *p_dev, window_handle_t win, | |
| 228 | int pcmcia_get_mem_page(window_handle_t win, memreq_t *req); | 202 | memreq_t *req); |
| 229 | int pcmcia_map_mem_page(window_handle_t win, memreq_t *req); | ||
| 230 | 203 | ||
| 231 | int pcmcia_modify_configuration(struct pcmcia_device *p_dev, modconf_t *mod); | 204 | int pcmcia_modify_configuration(struct pcmcia_device *p_dev, modconf_t *mod); |
| 232 | void pcmcia_disable_device(struct pcmcia_device *p_dev); | 205 | void pcmcia_disable_device(struct pcmcia_device *p_dev); |
diff --git a/include/pcmcia/mem_op.h b/include/pcmcia/mem_op.h index 8d19b9401a5b..0fa06e5d5376 100644 --- a/include/pcmcia/mem_op.h +++ b/include/pcmcia/mem_op.h | |||
| @@ -15,8 +15,8 @@ | |||
| 15 | #ifndef _LINUX_MEM_OP_H | 15 | #ifndef _LINUX_MEM_OP_H |
| 16 | #define _LINUX_MEM_OP_H | 16 | #define _LINUX_MEM_OP_H |
| 17 | 17 | ||
| 18 | #include <linux/io.h> | ||
| 18 | #include <asm/uaccess.h> | 19 | #include <asm/uaccess.h> |
| 19 | #include <asm/io.h> | ||
| 20 | 20 | ||
| 21 | /* | 21 | /* |
| 22 | If UNSAFE_MEMCPY is defined, we use the (optimized) system routines | 22 | If UNSAFE_MEMCPY is defined, we use the (optimized) system routines |
diff --git a/include/pcmcia/ss.h b/include/pcmcia/ss.h index e0f6feb8588c..344705cb42f4 100644 --- a/include/pcmcia/ss.h +++ b/include/pcmcia/ss.h | |||
| @@ -107,15 +107,6 @@ typedef struct io_window_t { | |||
| 107 | struct resource *res; | 107 | struct resource *res; |
| 108 | } io_window_t; | 108 | } io_window_t; |
| 109 | 109 | ||
| 110 | #define WINDOW_MAGIC 0xB35C | ||
| 111 | typedef struct window_t { | ||
| 112 | u_short magic; | ||
| 113 | u_short index; | ||
| 114 | struct pcmcia_device *handle; | ||
| 115 | struct pcmcia_socket *sock; | ||
| 116 | pccard_mem_map ctl; | ||
| 117 | } window_t; | ||
| 118 | |||
| 119 | /* Maximum number of IO windows per socket */ | 110 | /* Maximum number of IO windows per socket */ |
| 120 | #define MAX_IO_WIN 2 | 111 | #define MAX_IO_WIN 2 |
| 121 | 112 | ||
| @@ -143,9 +134,9 @@ struct pccard_operations { | |||
| 143 | 134 | ||
| 144 | struct pcmcia_socket { | 135 | struct pcmcia_socket { |
| 145 | struct module *owner; | 136 | struct module *owner; |
| 146 | spinlock_t lock; | ||
| 147 | socket_state_t socket; | 137 | socket_state_t socket; |
| 148 | u_int state; | 138 | u_int state; |
| 139 | u_int suspended_state; /* state before suspend */ | ||
| 149 | u_short functions; | 140 | u_short functions; |
| 150 | u_short lock_count; | 141 | u_short lock_count; |
| 151 | pccard_mem_map cis_mem; | 142 | pccard_mem_map cis_mem; |
| @@ -155,7 +146,7 @@ struct pcmcia_socket { | |||
| 155 | u_int Config; | 146 | u_int Config; |
| 156 | } irq; | 147 | } irq; |
| 157 | io_window_t io[MAX_IO_WIN]; | 148 | io_window_t io[MAX_IO_WIN]; |
| 158 | window_t win[MAX_WIN]; | 149 | pccard_mem_map win[MAX_WIN]; |
| 159 | struct list_head cis_cache; | 150 | struct list_head cis_cache; |
| 160 | size_t fake_cis_len; | 151 | size_t fake_cis_len; |
| 161 | u8 *fake_cis; | 152 | u8 *fake_cis; |
| @@ -163,7 +154,7 @@ struct pcmcia_socket { | |||
| 163 | struct list_head socket_list; | 154 | struct list_head socket_list; |
| 164 | struct completion socket_released; | 155 | struct completion socket_released; |
| 165 | 156 | ||
| 166 | /* deprecated */ | 157 | /* deprecated */ |
| 167 | unsigned int sock; /* socket number */ | 158 | unsigned int sock; /* socket number */ |
| 168 | 159 | ||
| 169 | 160 | ||
| @@ -172,8 +163,8 @@ struct pcmcia_socket { | |||
| 172 | u_int irq_mask; | 163 | u_int irq_mask; |
| 173 | u_int map_size; | 164 | u_int map_size; |
| 174 | u_int io_offset; | 165 | u_int io_offset; |
| 175 | u_char pci_irq; | 166 | u_int pci_irq; |
| 176 | struct pci_dev * cb_dev; | 167 | struct pci_dev *cb_dev; |
| 177 | 168 | ||
| 178 | 169 | ||
| 179 | /* socket setup is done so resources should be able to be allocated. | 170 | /* socket setup is done so resources should be able to be allocated. |
| @@ -188,9 +179,9 @@ struct pcmcia_socket { | |||
| 188 | u8 reserved:5; | 179 | u8 reserved:5; |
| 189 | 180 | ||
| 190 | /* socket operations */ | 181 | /* socket operations */ |
| 191 | struct pccard_operations * ops; | 182 | struct pccard_operations *ops; |
| 192 | struct pccard_resource_ops * resource_ops; | 183 | struct pccard_resource_ops *resource_ops; |
| 193 | void * resource_data; | 184 | void *resource_data; |
| 194 | 185 | ||
| 195 | /* Zoom video behaviour is so chip specific its not worth adding | 186 | /* Zoom video behaviour is so chip specific its not worth adding |
| 196 | this to _ops */ | 187 | this to _ops */ |
| @@ -209,9 +200,14 @@ struct pcmcia_socket { | |||
| 209 | struct task_struct *thread; | 200 | struct task_struct *thread; |
| 210 | struct completion thread_done; | 201 | struct completion thread_done; |
| 211 | unsigned int thread_events; | 202 | unsigned int thread_events; |
| 212 | /* protects socket h/w state */ | 203 | unsigned int sysfs_events; |
| 204 | |||
| 205 | /* For the non-trivial interaction between these locks, | ||
| 206 | * see Documentation/pcmcia/locking.txt */ | ||
| 213 | struct mutex skt_mutex; | 207 | struct mutex skt_mutex; |
| 214 | /* protects thread_events */ | 208 | struct mutex ops_mutex; |
| 209 | |||
| 210 | /* protects thread_events and sysfs_events */ | ||
| 215 | spinlock_t thread_lock; | 211 | spinlock_t thread_lock; |
| 216 | 212 | ||
| 217 | /* pcmcia (16-bit) */ | 213 | /* pcmcia (16-bit) */ |
| @@ -228,23 +224,16 @@ struct pcmcia_socket { | |||
| 228 | 224 | ||
| 229 | /* 16-bit state: */ | 225 | /* 16-bit state: */ |
| 230 | struct { | 226 | struct { |
| 231 | /* PCMCIA card is present in socket */ | ||
| 232 | u8 present:1; | ||
| 233 | /* "master" ioctl is used */ | 227 | /* "master" ioctl is used */ |
| 234 | u8 busy:1; | 228 | u8 busy:1; |
| 235 | /* pcmcia module is being unloaded */ | 229 | /* the PCMCIA card consists of two pseudo devices */ |
| 236 | u8 dead:1; | 230 | u8 has_pfc:1; |
| 237 | /* a multifunction-device add event is pending */ | ||
| 238 | u8 device_add_pending:1; | ||
| 239 | /* the pending event adds a mfc (1) or pfc (0) */ | ||
| 240 | u8 mfc_pfc:1; | ||
| 241 | |||
| 242 | u8 reserved:3; | ||
| 243 | } pcmcia_state; | ||
| 244 | 231 | ||
| 232 | u8 reserved:6; | ||
| 233 | } pcmcia_state; | ||
| 245 | 234 | ||
| 246 | /* for adding further pseudo-multifunction devices */ | 235 | /* non-zero if PCMCIA card is present */ |
| 247 | struct work_struct device_add; | 236 | atomic_t present; |
| 248 | 237 | ||
| 249 | #ifdef CONFIG_PCMCIA_IOCTL | 238 | #ifdef CONFIG_PCMCIA_IOCTL |
| 250 | struct user_info_t *user; | 239 | struct user_info_t *user; |
| @@ -252,12 +241,6 @@ struct pcmcia_socket { | |||
| 252 | #endif /* CONFIG_PCMCIA_IOCTL */ | 241 | #endif /* CONFIG_PCMCIA_IOCTL */ |
| 253 | #endif /* CONFIG_PCMCIA */ | 242 | #endif /* CONFIG_PCMCIA */ |
| 254 | 243 | ||
| 255 | /* cardbus (32-bit) */ | ||
| 256 | #ifdef CONFIG_CARDBUS | ||
| 257 | struct resource * cb_cis_res; | ||
| 258 | void __iomem *cb_cis_virt; | ||
| 259 | #endif /* CONFIG_CARDBUS */ | ||
| 260 | |||
| 261 | /* socket device */ | 244 | /* socket device */ |
| 262 | struct device dev; | 245 | struct device dev; |
| 263 | /* data internal to the socket driver */ | 246 | /* data internal to the socket driver */ |
| @@ -272,19 +255,25 @@ struct pcmcia_socket { | |||
| 272 | * - pccard_static_ops iomem and ioport areas are assigned statically | 255 | * - pccard_static_ops iomem and ioport areas are assigned statically |
| 273 | * - pccard_iodyn_ops iomem areas is assigned statically, ioport | 256 | * - pccard_iodyn_ops iomem areas is assigned statically, ioport |
| 274 | * areas dynamically | 257 | * areas dynamically |
| 258 | * If this option is selected, use | ||
| 259 | * "select PCCARD_IODYN" in Kconfig. | ||
| 275 | * - pccard_nonstatic_ops iomem and ioport areas are assigned dynamically. | 260 | * - pccard_nonstatic_ops iomem and ioport areas are assigned dynamically. |
| 276 | * If this option is selected, use | 261 | * If this option is selected, use |
| 277 | * "select PCCARD_NONSTATIC" in Kconfig. | 262 | * "select PCCARD_NONSTATIC" in Kconfig. |
| 263 | * | ||
| 278 | */ | 264 | */ |
| 279 | extern struct pccard_resource_ops pccard_static_ops; | 265 | extern struct pccard_resource_ops pccard_static_ops; |
| 266 | #if defined(CONFIG_PCMCIA) || defined(CONFIG_PCMCIA_MODULE) | ||
| 280 | extern struct pccard_resource_ops pccard_iodyn_ops; | 267 | extern struct pccard_resource_ops pccard_iodyn_ops; |
| 281 | extern struct pccard_resource_ops pccard_nonstatic_ops; | 268 | extern struct pccard_resource_ops pccard_nonstatic_ops; |
| 269 | #else | ||
| 270 | /* If PCMCIA is not used, but only CARDBUS, these functions are not used | ||
| 271 | * at all. Therefore, do not use the large (240K!) rsrc_nonstatic module | ||
| 272 | */ | ||
| 273 | #define pccard_iodyn_ops pccard_static_ops | ||
| 274 | #define pccard_nonstatic_ops pccard_static_ops | ||
| 275 | #endif | ||
| 282 | 276 | ||
| 283 | /* socket drivers are expected to use these callbacks in their .drv struct */ | ||
| 284 | extern int pcmcia_socket_dev_suspend(struct device *dev); | ||
| 285 | extern void pcmcia_socket_dev_early_resume(struct device *dev); | ||
| 286 | extern void pcmcia_socket_dev_late_resume(struct device *dev); | ||
| 287 | extern int pcmcia_socket_dev_resume(struct device *dev); | ||
| 288 | 277 | ||
| 289 | /* socket drivers use this callback in their IRQ handler */ | 278 | /* socket drivers use this callback in their IRQ handler */ |
| 290 | extern void pcmcia_parse_events(struct pcmcia_socket *socket, | 279 | extern void pcmcia_parse_events(struct pcmcia_socket *socket, |
diff --git a/include/rdma/ib_addr.h b/include/rdma/ib_addr.h index 483057b2f4b4..fa0d52b8e622 100644 --- a/include/rdma/ib_addr.h +++ b/include/rdma/ib_addr.h | |||
| @@ -36,6 +36,7 @@ | |||
| 36 | 36 | ||
| 37 | #include <linux/in.h> | 37 | #include <linux/in.h> |
| 38 | #include <linux/in6.h> | 38 | #include <linux/in6.h> |
| 39 | #include <linux/if_arp.h> | ||
| 39 | #include <linux/netdevice.h> | 40 | #include <linux/netdevice.h> |
| 40 | #include <linux/socket.h> | 41 | #include <linux/socket.h> |
| 41 | #include <rdma/ib_verbs.h> | 42 | #include <rdma/ib_verbs.h> |
| @@ -60,8 +61,8 @@ struct rdma_dev_addr { | |||
| 60 | unsigned char src_dev_addr[MAX_ADDR_LEN]; | 61 | unsigned char src_dev_addr[MAX_ADDR_LEN]; |
| 61 | unsigned char dst_dev_addr[MAX_ADDR_LEN]; | 62 | unsigned char dst_dev_addr[MAX_ADDR_LEN]; |
| 62 | unsigned char broadcast[MAX_ADDR_LEN]; | 63 | unsigned char broadcast[MAX_ADDR_LEN]; |
| 63 | enum rdma_node_type dev_type; | 64 | unsigned short dev_type; |
| 64 | struct net_device *src_dev; | 65 | int bound_dev_if; |
| 65 | }; | 66 | }; |
| 66 | 67 | ||
| 67 | /** | 68 | /** |
| @@ -121,40 +122,29 @@ static inline void ib_addr_get_mgid(struct rdma_dev_addr *dev_addr, | |||
| 121 | memcpy(gid, dev_addr->broadcast + 4, sizeof *gid); | 122 | memcpy(gid, dev_addr->broadcast + 4, sizeof *gid); |
| 122 | } | 123 | } |
| 123 | 124 | ||
| 124 | static inline void ib_addr_get_sgid(struct rdma_dev_addr *dev_addr, | 125 | static inline int rdma_addr_gid_offset(struct rdma_dev_addr *dev_addr) |
| 125 | union ib_gid *gid) | ||
| 126 | { | 126 | { |
| 127 | memcpy(gid, dev_addr->src_dev_addr + 4, sizeof *gid); | 127 | return dev_addr->dev_type == ARPHRD_INFINIBAND ? 4 : 0; |
| 128 | } | 128 | } |
| 129 | 129 | ||
| 130 | static inline void ib_addr_set_sgid(struct rdma_dev_addr *dev_addr, | 130 | static inline void rdma_addr_get_sgid(struct rdma_dev_addr *dev_addr, union ib_gid *gid) |
| 131 | union ib_gid *gid) | ||
| 132 | { | 131 | { |
| 133 | memcpy(dev_addr->src_dev_addr + 4, gid, sizeof *gid); | 132 | memcpy(gid, dev_addr->src_dev_addr + rdma_addr_gid_offset(dev_addr), sizeof *gid); |
| 134 | } | 133 | } |
| 135 | 134 | ||
| 136 | static inline void ib_addr_get_dgid(struct rdma_dev_addr *dev_addr, | 135 | static inline void rdma_addr_set_sgid(struct rdma_dev_addr *dev_addr, union ib_gid *gid) |
| 137 | union ib_gid *gid) | ||
| 138 | { | 136 | { |
| 139 | memcpy(gid, dev_addr->dst_dev_addr + 4, sizeof *gid); | 137 | memcpy(dev_addr->src_dev_addr + rdma_addr_gid_offset(dev_addr), gid, sizeof *gid); |
| 140 | } | 138 | } |
| 141 | 139 | ||
| 142 | static inline void ib_addr_set_dgid(struct rdma_dev_addr *dev_addr, | 140 | static inline void rdma_addr_get_dgid(struct rdma_dev_addr *dev_addr, union ib_gid *gid) |
| 143 | union ib_gid *gid) | ||
| 144 | { | 141 | { |
| 145 | memcpy(dev_addr->dst_dev_addr + 4, gid, sizeof *gid); | 142 | memcpy(gid, dev_addr->dst_dev_addr + rdma_addr_gid_offset(dev_addr), sizeof *gid); |
| 146 | } | 143 | } |
| 147 | 144 | ||
| 148 | static inline void iw_addr_get_sgid(struct rdma_dev_addr *dev_addr, | 145 | static inline void rdma_addr_set_dgid(struct rdma_dev_addr *dev_addr, union ib_gid *gid) |
| 149 | union ib_gid *gid) | ||
| 150 | { | ||
| 151 | memcpy(gid, dev_addr->src_dev_addr, sizeof *gid); | ||
| 152 | } | ||
| 153 | |||
| 154 | static inline void iw_addr_get_dgid(struct rdma_dev_addr *dev_addr, | ||
| 155 | union ib_gid *gid) | ||
| 156 | { | 146 | { |
| 157 | memcpy(gid, dev_addr->dst_dev_addr, sizeof *gid); | 147 | memcpy(dev_addr->dst_dev_addr + rdma_addr_gid_offset(dev_addr), gid, sizeof *gid); |
| 158 | } | 148 | } |
| 159 | 149 | ||
| 160 | #endif /* IB_ADDR_H */ | 150 | #endif /* IB_ADDR_H */ |
diff --git a/include/rdma/ib_pack.h b/include/rdma/ib_pack.h index d7fc45c4eba9..cbb50f4da3dd 100644 --- a/include/rdma/ib_pack.h +++ b/include/rdma/ib_pack.h | |||
| @@ -232,6 +232,7 @@ void ib_unpack(const struct ib_field *desc, | |||
| 232 | 232 | ||
| 233 | void ib_ud_header_init(int payload_bytes, | 233 | void ib_ud_header_init(int payload_bytes, |
| 234 | int grh_present, | 234 | int grh_present, |
| 235 | int immediate_present, | ||
| 235 | struct ib_ud_header *header); | 236 | struct ib_ud_header *header); |
| 236 | 237 | ||
| 237 | int ib_ud_header_pack(struct ib_ud_header *header, | 238 | int ib_ud_header_pack(struct ib_ud_header *header, |
diff --git a/include/rdma/ib_sa.h b/include/rdma/ib_sa.h index 3841c1aff692..1082afaed158 100644 --- a/include/rdma/ib_sa.h +++ b/include/rdma/ib_sa.h | |||
| @@ -379,4 +379,10 @@ int ib_init_ah_from_path(struct ib_device *device, u8 port_num, | |||
| 379 | struct ib_sa_path_rec *rec, | 379 | struct ib_sa_path_rec *rec, |
| 380 | struct ib_ah_attr *ah_attr); | 380 | struct ib_ah_attr *ah_attr); |
| 381 | 381 | ||
| 382 | /** | ||
| 383 | * ib_sa_unpack_path - Convert a path record from MAD format to struct | ||
| 384 | * ib_sa_path_rec. | ||
| 385 | */ | ||
| 386 | void ib_sa_unpack_path(void *attribute, struct ib_sa_path_rec *rec); | ||
| 387 | |||
| 382 | #endif /* IB_SA_H */ | 388 | #endif /* IB_SA_H */ |
diff --git a/include/rdma/ib_user_sa.h b/include/rdma/ib_user_sa.h index 659120157e14..cfc7c9ba781e 100644 --- a/include/rdma/ib_user_sa.h +++ b/include/rdma/ib_user_sa.h | |||
| @@ -35,6 +35,22 @@ | |||
| 35 | 35 | ||
| 36 | #include <linux/types.h> | 36 | #include <linux/types.h> |
| 37 | 37 | ||
| 38 | enum { | ||
| 39 | IB_PATH_GMP = 1, | ||
| 40 | IB_PATH_PRIMARY = (1<<1), | ||
| 41 | IB_PATH_ALTERNATE = (1<<2), | ||
| 42 | IB_PATH_OUTBOUND = (1<<3), | ||
| 43 | IB_PATH_INBOUND = (1<<4), | ||
| 44 | IB_PATH_INBOUND_REVERSE = (1<<5), | ||
| 45 | IB_PATH_BIDIRECTIONAL = IB_PATH_OUTBOUND | IB_PATH_INBOUND_REVERSE | ||
| 46 | }; | ||
| 47 | |||
| 48 | struct ib_path_rec_data { | ||
| 49 | __u32 flags; | ||
| 50 | __u32 reserved; | ||
| 51 | __u32 path_rec[16]; | ||
| 52 | }; | ||
| 53 | |||
| 38 | struct ib_user_path_rec { | 54 | struct ib_user_path_rec { |
| 39 | __u8 dgid[16]; | 55 | __u8 dgid[16]; |
| 40 | __u8 sgid[16]; | 56 | __u8 sgid[16]; |
diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h index c179318edd92..a585e0f92bc3 100644 --- a/include/rdma/ib_verbs.h +++ b/include/rdma/ib_verbs.h | |||
| @@ -984,9 +984,9 @@ struct ib_device { | |||
| 984 | struct list_head event_handler_list; | 984 | struct list_head event_handler_list; |
| 985 | spinlock_t event_handler_lock; | 985 | spinlock_t event_handler_lock; |
| 986 | 986 | ||
| 987 | spinlock_t client_data_lock; | ||
| 987 | struct list_head core_list; | 988 | struct list_head core_list; |
| 988 | struct list_head client_data_list; | 989 | struct list_head client_data_list; |
| 989 | spinlock_t client_data_lock; | ||
| 990 | 990 | ||
| 991 | struct ib_cache cache; | 991 | struct ib_cache cache; |
| 992 | int *pkey_tbl_len; | 992 | int *pkey_tbl_len; |
| @@ -1144,8 +1144,8 @@ struct ib_device { | |||
| 1144 | IB_DEV_UNREGISTERED | 1144 | IB_DEV_UNREGISTERED |
| 1145 | } reg_state; | 1145 | } reg_state; |
| 1146 | 1146 | ||
| 1147 | u64 uverbs_cmd_mask; | ||
| 1148 | int uverbs_abi_ver; | 1147 | int uverbs_abi_ver; |
| 1148 | u64 uverbs_cmd_mask; | ||
| 1149 | 1149 | ||
| 1150 | char node_desc[64]; | 1150 | char node_desc[64]; |
| 1151 | __be64 node_guid; | 1151 | __be64 node_guid; |
| @@ -1425,6 +1425,11 @@ int ib_destroy_qp(struct ib_qp *qp); | |||
| 1425 | * @send_wr: A list of work requests to post on the send queue. | 1425 | * @send_wr: A list of work requests to post on the send queue. |
| 1426 | * @bad_send_wr: On an immediate failure, this parameter will reference | 1426 | * @bad_send_wr: On an immediate failure, this parameter will reference |
| 1427 | * the work request that failed to be posted on the QP. | 1427 | * the work request that failed to be posted on the QP. |
| 1428 | * | ||
| 1429 | * While IBA Vol. 1 section 11.4.1.1 specifies that if an immediate | ||
| 1430 | * error is returned, the QP state shall not be affected, | ||
| 1431 | * ib_post_send() will return an immediate error after queueing any | ||
| 1432 | * earlier work requests in the list. | ||
| 1428 | */ | 1433 | */ |
| 1429 | static inline int ib_post_send(struct ib_qp *qp, | 1434 | static inline int ib_post_send(struct ib_qp *qp, |
| 1430 | struct ib_send_wr *send_wr, | 1435 | struct ib_send_wr *send_wr, |
diff --git a/include/rdma/rdma_cm.h b/include/rdma/rdma_cm.h index c6b2962315b3..4fae90304648 100644 --- a/include/rdma/rdma_cm.h +++ b/include/rdma/rdma_cm.h | |||
| @@ -67,7 +67,6 @@ enum rdma_port_space { | |||
| 67 | RDMA_PS_IPOIB = 0x0002, | 67 | RDMA_PS_IPOIB = 0x0002, |
| 68 | RDMA_PS_TCP = 0x0106, | 68 | RDMA_PS_TCP = 0x0106, |
| 69 | RDMA_PS_UDP = 0x0111, | 69 | RDMA_PS_UDP = 0x0111, |
| 70 | RDMA_PS_SCTP = 0x0183 | ||
| 71 | }; | 70 | }; |
| 72 | 71 | ||
| 73 | struct rdma_addr { | 72 | struct rdma_addr { |
diff --git a/include/rdma/rdma_user_cm.h b/include/rdma/rdma_user_cm.h index c55705460b87..1d165022c02d 100644 --- a/include/rdma/rdma_user_cm.h +++ b/include/rdma/rdma_user_cm.h | |||
| @@ -215,12 +215,14 @@ struct rdma_ucm_event_resp { | |||
| 215 | 215 | ||
| 216 | /* Option levels */ | 216 | /* Option levels */ |
| 217 | enum { | 217 | enum { |
| 218 | RDMA_OPTION_ID = 0 | 218 | RDMA_OPTION_ID = 0, |
| 219 | RDMA_OPTION_IB = 1 | ||
| 219 | }; | 220 | }; |
| 220 | 221 | ||
| 221 | /* Option details */ | 222 | /* Option details */ |
| 222 | enum { | 223 | enum { |
| 223 | RDMA_OPTION_ID_TOS = 0 | 224 | RDMA_OPTION_ID_TOS = 0, |
| 225 | RDMA_OPTION_IB_PATH = 1 | ||
| 224 | }; | 226 | }; |
| 225 | 227 | ||
| 226 | struct rdma_ucm_set_option { | 228 | struct rdma_ucm_set_option { |
diff --git a/include/scsi/Kbuild b/include/scsi/Kbuild index 33b2750e9283..b3a0ee6b2f1c 100644 --- a/include/scsi/Kbuild +++ b/include/scsi/Kbuild | |||
| @@ -2,3 +2,4 @@ header-y += scsi.h | |||
| 2 | header-y += scsi_netlink.h | 2 | header-y += scsi_netlink.h |
| 3 | header-y += scsi_netlink_fc.h | 3 | header-y += scsi_netlink_fc.h |
| 4 | header-y += scsi_bsg_fc.h | 4 | header-y += scsi_bsg_fc.h |
| 5 | header-y += fc/ | ||
diff --git a/include/scsi/fc/Kbuild b/include/scsi/fc/Kbuild new file mode 100644 index 000000000000..56603813c6cd --- /dev/null +++ b/include/scsi/fc/Kbuild | |||
| @@ -0,0 +1,4 @@ | |||
| 1 | header-y += fc_els.h | ||
| 2 | header-y += fc_fs.h | ||
| 3 | header-y += fc_gs.h | ||
| 4 | header-y += fc_ns.h | ||
diff --git a/include/scsi/fc/fc_els.h b/include/scsi/fc/fc_els.h index 195ca014d3ce..f94328132a26 100644 --- a/include/scsi/fc/fc_els.h +++ b/include/scsi/fc/fc_els.h | |||
| @@ -20,6 +20,8 @@ | |||
| 20 | #ifndef _FC_ELS_H_ | 20 | #ifndef _FC_ELS_H_ |
| 21 | #define _FC_ELS_H_ | 21 | #define _FC_ELS_H_ |
| 22 | 22 | ||
| 23 | #include <linux/types.h> | ||
| 24 | |||
| 23 | /* | 25 | /* |
| 24 | * Fibre Channel Switch - Enhanced Link Services definitions. | 26 | * Fibre Channel Switch - Enhanced Link Services definitions. |
| 25 | * From T11 FC-LS Rev 1.2 June 7, 2005. | 27 | * From T11 FC-LS Rev 1.2 June 7, 2005. |
| @@ -248,10 +250,12 @@ struct fc_els_csp { | |||
| 248 | /* | 250 | /* |
| 249 | * sp_features | 251 | * sp_features |
| 250 | */ | 252 | */ |
| 251 | #define FC_SP_FT_CIRO 0x8000 /* continuously increasing rel. off. */ | 253 | #define FC_SP_FT_NPIV 0x8000 /* multiple N_Port_ID support (FLOGI) */ |
| 254 | #define FC_SP_FT_CIRO 0x8000 /* continuously increasing rel off (PLOGI) */ | ||
| 252 | #define FC_SP_FT_CLAD 0x8000 /* clean address (in FLOGI LS_ACC) */ | 255 | #define FC_SP_FT_CLAD 0x8000 /* clean address (in FLOGI LS_ACC) */ |
| 253 | #define FC_SP_FT_RAND 0x4000 /* random relative offset */ | 256 | #define FC_SP_FT_RAND 0x4000 /* random relative offset */ |
| 254 | #define FC_SP_FT_VAL 0x2000 /* valid vendor version level */ | 257 | #define FC_SP_FT_VAL 0x2000 /* valid vendor version level */ |
| 258 | #define FC_SP_FT_NPIV_ACC 0x2000 /* NPIV assignment (FLOGI LS_ACC) */ | ||
| 255 | #define FC_SP_FT_FPORT 0x1000 /* F port (1) vs. N port (0) */ | 259 | #define FC_SP_FT_FPORT 0x1000 /* F port (1) vs. N port (0) */ |
| 256 | #define FC_SP_FT_ABB 0x0800 /* alternate BB_credit management */ | 260 | #define FC_SP_FT_ABB 0x0800 /* alternate BB_credit management */ |
| 257 | #define FC_SP_FT_EDTR 0x0400 /* E_D_TOV Resolution is nanoseconds */ | 261 | #define FC_SP_FT_EDTR 0x0400 /* E_D_TOV Resolution is nanoseconds */ |
diff --git a/include/scsi/fc/fc_fcoe.h b/include/scsi/fc/fc_fcoe.h index ccb3dbe90463..e6ad3d2ae475 100644 --- a/include/scsi/fc/fc_fcoe.h +++ b/include/scsi/fc/fc_fcoe.h | |||
| @@ -86,6 +86,18 @@ struct fcoe_crc_eof { | |||
| 86 | #define FCOE_MIN_FRAME 46 | 86 | #define FCOE_MIN_FRAME 46 |
| 87 | 87 | ||
| 88 | /* | 88 | /* |
| 89 | * FCoE Link Error Status Block: T11 FC-BB-5 Rev2.0, Clause 7.10. | ||
| 90 | */ | ||
| 91 | struct fcoe_fc_els_lesb { | ||
| 92 | __be32 lesb_link_fail; /* link failure count */ | ||
| 93 | __be32 lesb_vlink_fail; /* virtual link failure count */ | ||
| 94 | __be32 lesb_miss_fka; /* missing FIP keep-alive count */ | ||
| 95 | __be32 lesb_symb_err; /* symbol error during carrier count */ | ||
| 96 | __be32 lesb_err_block; /* errored block count */ | ||
| 97 | __be32 lesb_fcs_error; /* frame check sequence error count */ | ||
| 98 | }; | ||
| 99 | |||
| 100 | /* | ||
| 89 | * fc_fcoe_set_mac - Store OUI + DID into MAC address field. | 101 | * fc_fcoe_set_mac - Store OUI + DID into MAC address field. |
| 90 | * @mac: mac address to be set | 102 | * @mac: mac address to be set |
| 91 | * @did: fc dest id to use | 103 | * @did: fc dest id to use |
diff --git a/include/scsi/fc/fc_fcp.h b/include/scsi/fc/fc_fcp.h index 5d38f1989f37..747e2c7d88d6 100644 --- a/include/scsi/fc/fc_fcp.h +++ b/include/scsi/fc/fc_fcp.h | |||
| @@ -83,6 +83,8 @@ struct fcp_cmnd32 { | |||
| 83 | * fc_tm_flags - task management flags field. | 83 | * fc_tm_flags - task management flags field. |
| 84 | */ | 84 | */ |
| 85 | #define FCP_TMF_CLR_ACA 0x40 /* clear ACA condition */ | 85 | #define FCP_TMF_CLR_ACA 0x40 /* clear ACA condition */ |
| 86 | #define FCP_TMF_TGT_RESET 0x20 /* target reset task management, | ||
| 87 | deprecated as of FCP-3 */ | ||
| 86 | #define FCP_TMF_LUN_RESET 0x10 /* logical unit reset task management */ | 88 | #define FCP_TMF_LUN_RESET 0x10 /* logical unit reset task management */ |
| 87 | #define FCP_TMF_CLR_TASK_SET 0x04 /* clear task set */ | 89 | #define FCP_TMF_CLR_TASK_SET 0x04 /* clear task set */ |
| 88 | #define FCP_TMF_ABT_TASK_SET 0x02 /* abort task set */ | 90 | #define FCP_TMF_ABT_TASK_SET 0x02 /* abort task set */ |
| @@ -196,4 +198,10 @@ struct fcp_srr { | |||
| 196 | __u8 srr_resvd2[3]; /* reserved */ | 198 | __u8 srr_resvd2[3]; /* reserved */ |
| 197 | }; | 199 | }; |
| 198 | 200 | ||
| 201 | /* | ||
| 202 | * Feature bits in name server FC-4 Features object. | ||
| 203 | */ | ||
| 204 | #define FCP_FEAT_TARG (1 << 0) /* target function supported */ | ||
| 205 | #define FCP_FEAT_INIT (1 << 1) /* initiator function supported */ | ||
| 206 | |||
| 199 | #endif /* _FC_FCP_H_ */ | 207 | #endif /* _FC_FCP_H_ */ |
diff --git a/include/scsi/fc/fc_fip.h b/include/scsi/fc/fc_fip.h index 3d138c1fcf8a..17baa19380f0 100644 --- a/include/scsi/fc/fc_fip.h +++ b/include/scsi/fc/fc_fip.h | |||
| @@ -214,11 +214,21 @@ struct fip_vn_desc { | |||
| 214 | */ | 214 | */ |
| 215 | struct fip_fka_desc { | 215 | struct fip_fka_desc { |
| 216 | struct fip_desc fd_desc; | 216 | struct fip_desc fd_desc; |
| 217 | __u8 fd_resvd[2]; | 217 | __u8 fd_resvd; |
| 218 | __u8 fd_flags; /* bit0 is fka disable flag */ | ||
| 218 | __be32 fd_fka_period; /* adv./keep-alive period in mS */ | 219 | __be32 fd_fka_period; /* adv./keep-alive period in mS */ |
| 219 | } __attribute__((packed)); | 220 | } __attribute__((packed)); |
| 220 | 221 | ||
| 221 | /* | 222 | /* |
| 223 | * flags for fip_fka_desc.fd_flags | ||
| 224 | */ | ||
| 225 | enum fip_fka_flags { | ||
| 226 | FIP_FKA_ADV_D = 0x01, /* no need for FKA from ENode */ | ||
| 227 | }; | ||
| 228 | |||
| 229 | /* FIP_DT_FKA flags */ | ||
| 230 | |||
| 231 | /* | ||
| 222 | * FIP_DT_VENDOR descriptor. | 232 | * FIP_DT_VENDOR descriptor. |
| 223 | */ | 233 | */ |
| 224 | struct fip_vendor_desc { | 234 | struct fip_vendor_desc { |
diff --git a/include/scsi/fc/fc_fs.h b/include/scsi/fc/fc_fs.h index ac4cd38c860e..50f28b143451 100644 --- a/include/scsi/fc/fc_fs.h +++ b/include/scsi/fc/fc_fs.h | |||
| @@ -20,6 +20,8 @@ | |||
| 20 | #ifndef _FC_FS_H_ | 20 | #ifndef _FC_FS_H_ |
| 21 | #define _FC_FS_H_ | 21 | #define _FC_FS_H_ |
| 22 | 22 | ||
| 23 | #include <linux/types.h> | ||
| 24 | |||
| 23 | /* | 25 | /* |
| 24 | * Fibre Channel Framing and Signalling definitions. | 26 | * Fibre Channel Framing and Signalling definitions. |
| 25 | * From T11 FC-FS-2 Rev 0.90 - 9 August 2005. | 27 | * From T11 FC-FS-2 Rev 0.90 - 9 August 2005. |
diff --git a/include/scsi/fc/fc_gs.h b/include/scsi/fc/fc_gs.h index 324dd0e3c622..a37346d47eb1 100644 --- a/include/scsi/fc/fc_gs.h +++ b/include/scsi/fc/fc_gs.h | |||
| @@ -20,6 +20,8 @@ | |||
| 20 | #ifndef _FC_GS_H_ | 20 | #ifndef _FC_GS_H_ |
| 21 | #define _FC_GS_H_ | 21 | #define _FC_GS_H_ |
| 22 | 22 | ||
| 23 | #include <linux/types.h> | ||
| 24 | |||
| 23 | /* | 25 | /* |
| 24 | * Fibre Channel Services - Common Transport. | 26 | * Fibre Channel Services - Common Transport. |
| 25 | * From T11.org FC-GS-2 Rev 5.3 November 1998. | 27 | * From T11.org FC-GS-2 Rev 5.3 November 1998. |
diff --git a/include/scsi/fc/fc_ns.h b/include/scsi/fc/fc_ns.h index 790d7b97d4bc..e7d3ac497d7d 100644 --- a/include/scsi/fc/fc_ns.h +++ b/include/scsi/fc/fc_ns.h | |||
| @@ -20,6 +20,8 @@ | |||
| 20 | #ifndef _FC_NS_H_ | 20 | #ifndef _FC_NS_H_ |
| 21 | #define _FC_NS_H_ | 21 | #define _FC_NS_H_ |
| 22 | 22 | ||
| 23 | #include <linux/types.h> | ||
| 24 | |||
| 23 | /* | 25 | /* |
| 24 | * Fibre Channel Services - Name Service (dNS) | 26 | * Fibre Channel Services - Name Service (dNS) |
| 25 | * From T11.org FC-GS-2 Rev 5.3 November 1998. | 27 | * From T11.org FC-GS-2 Rev 5.3 November 1998. |
| @@ -44,9 +46,12 @@ enum fc_ns_req { | |||
| 44 | FC_NS_GID_FT = 0x0171, /* get IDs by FC4 type */ | 46 | FC_NS_GID_FT = 0x0171, /* get IDs by FC4 type */ |
| 45 | FC_NS_GPN_FT = 0x0172, /* get port names by FC4 type */ | 47 | FC_NS_GPN_FT = 0x0172, /* get port names by FC4 type */ |
| 46 | FC_NS_GID_PT = 0x01a1, /* get IDs by port type */ | 48 | FC_NS_GID_PT = 0x01a1, /* get IDs by port type */ |
| 47 | FC_NS_RFT_ID = 0x0217, /* reg FC4 type for ID */ | ||
| 48 | FC_NS_RPN_ID = 0x0212, /* reg port name for ID */ | 49 | FC_NS_RPN_ID = 0x0212, /* reg port name for ID */ |
| 49 | FC_NS_RNN_ID = 0x0213, /* reg node name for ID */ | 50 | FC_NS_RNN_ID = 0x0213, /* reg node name for ID */ |
| 51 | FC_NS_RFT_ID = 0x0217, /* reg FC4 type for ID */ | ||
| 52 | FC_NS_RSPN_ID = 0x0218, /* reg symbolic port name */ | ||
| 53 | FC_NS_RFF_ID = 0x021f, /* reg FC4 Features for ID */ | ||
| 54 | FC_NS_RSNN_NN = 0x0239, /* reg symbolic node name */ | ||
| 50 | }; | 55 | }; |
| 51 | 56 | ||
| 52 | /* | 57 | /* |
| @@ -156,4 +161,32 @@ struct fc_ns_rn_id { | |||
| 156 | __be64 fr_wwn; /* node name or port name */ | 161 | __be64 fr_wwn; /* node name or port name */ |
| 157 | } __attribute__((__packed__)); | 162 | } __attribute__((__packed__)); |
| 158 | 163 | ||
| 164 | /* | ||
| 165 | * RSNN_NN request - register symbolic node name | ||
| 166 | */ | ||
| 167 | struct fc_ns_rsnn { | ||
| 168 | __be64 fr_wwn; /* node name */ | ||
| 169 | __u8 fr_name_len; | ||
| 170 | char fr_name[]; | ||
| 171 | } __attribute__((__packed__)); | ||
| 172 | |||
| 173 | /* | ||
| 174 | * RSPN_ID request - register symbolic port name | ||
| 175 | */ | ||
| 176 | struct fc_ns_rspn { | ||
| 177 | struct fc_ns_fid fr_fid; /* port ID object */ | ||
| 178 | __u8 fr_name_len; | ||
| 179 | char fr_name[]; | ||
| 180 | } __attribute__((__packed__)); | ||
| 181 | |||
| 182 | /* | ||
| 183 | * RFF_ID request - register FC-4 Features for ID. | ||
| 184 | */ | ||
| 185 | struct fc_ns_rff_id { | ||
| 186 | struct fc_ns_fid fr_fid; /* port ID object */ | ||
| 187 | __u8 fr_resvd[2]; | ||
| 188 | __u8 fr_feat; /* FC-4 Feature bits */ | ||
| 189 | __u8 fr_type; /* FC-4 type */ | ||
| 190 | } __attribute__((__packed__)); | ||
| 191 | |||
| 159 | #endif /* _FC_NS_H_ */ | 192 | #endif /* _FC_NS_H_ */ |
diff --git a/include/scsi/fc_encode.h b/include/scsi/fc_encode.h index 27dad703824f..8eb0a0fc0a71 100644 --- a/include/scsi/fc_encode.h +++ b/include/scsi/fc_encode.h | |||
| @@ -32,7 +32,10 @@ struct fc_ct_req { | |||
| 32 | struct fc_ns_gid_ft gid; | 32 | struct fc_ns_gid_ft gid; |
| 33 | struct fc_ns_rn_id rn; | 33 | struct fc_ns_rn_id rn; |
| 34 | struct fc_ns_rft rft; | 34 | struct fc_ns_rft rft; |
| 35 | struct fc_ns_rff_id rff; | ||
| 35 | struct fc_ns_fid fid; | 36 | struct fc_ns_fid fid; |
| 37 | struct fc_ns_rsnn snn; | ||
| 38 | struct fc_ns_rspn spn; | ||
| 36 | } payload; | 39 | } payload; |
| 37 | }; | 40 | }; |
| 38 | 41 | ||
| @@ -109,6 +112,7 @@ static inline int fc_ct_fill(struct fc_lport *lport, | |||
| 109 | enum fc_fh_type *fh_type) | 112 | enum fc_fh_type *fh_type) |
| 110 | { | 113 | { |
| 111 | struct fc_ct_req *ct; | 114 | struct fc_ct_req *ct; |
| 115 | size_t len; | ||
| 112 | 116 | ||
| 113 | switch (op) { | 117 | switch (op) { |
| 114 | case FC_NS_GPN_FT: | 118 | case FC_NS_GPN_FT: |
| @@ -128,12 +132,41 @@ static inline int fc_ct_fill(struct fc_lport *lport, | |||
| 128 | ct->payload.rft.fts = lport->fcts; | 132 | ct->payload.rft.fts = lport->fcts; |
| 129 | break; | 133 | break; |
| 130 | 134 | ||
| 131 | case FC_NS_RPN_ID: | 135 | case FC_NS_RFF_ID: |
| 136 | ct = fc_ct_hdr_fill(fp, op, sizeof(struct fc_ns_rff_id)); | ||
| 137 | hton24(ct->payload.rff.fr_fid.fp_fid, | ||
| 138 | fc_host_port_id(lport->host)); | ||
| 139 | ct->payload.rff.fr_type = FC_TYPE_FCP; | ||
| 140 | if (lport->service_params & FCP_SPPF_INIT_FCN) | ||
| 141 | ct->payload.rff.fr_feat = FCP_FEAT_INIT; | ||
| 142 | if (lport->service_params & FCP_SPPF_TARG_FCN) | ||
| 143 | ct->payload.rff.fr_feat |= FCP_FEAT_TARG; | ||
| 144 | break; | ||
| 145 | |||
| 146 | case FC_NS_RNN_ID: | ||
| 132 | ct = fc_ct_hdr_fill(fp, op, sizeof(struct fc_ns_rn_id)); | 147 | ct = fc_ct_hdr_fill(fp, op, sizeof(struct fc_ns_rn_id)); |
| 133 | hton24(ct->payload.rn.fr_fid.fp_fid, | 148 | hton24(ct->payload.rn.fr_fid.fp_fid, |
| 134 | fc_host_port_id(lport->host)); | 149 | fc_host_port_id(lport->host)); |
| 135 | ct->payload.rft.fts = lport->fcts; | 150 | put_unaligned_be64(lport->wwnn, &ct->payload.rn.fr_wwn); |
| 136 | put_unaligned_be64(lport->wwpn, &ct->payload.rn.fr_wwn); | 151 | break; |
| 152 | |||
| 153 | case FC_NS_RSPN_ID: | ||
| 154 | len = strnlen(fc_host_symbolic_name(lport->host), 255); | ||
| 155 | ct = fc_ct_hdr_fill(fp, op, sizeof(struct fc_ns_rspn) + len); | ||
| 156 | hton24(ct->payload.spn.fr_fid.fp_fid, | ||
| 157 | fc_host_port_id(lport->host)); | ||
| 158 | strncpy(ct->payload.spn.fr_name, | ||
| 159 | fc_host_symbolic_name(lport->host), len); | ||
| 160 | ct->payload.spn.fr_name_len = len; | ||
| 161 | break; | ||
| 162 | |||
| 163 | case FC_NS_RSNN_NN: | ||
| 164 | len = strnlen(fc_host_symbolic_name(lport->host), 255); | ||
| 165 | ct = fc_ct_hdr_fill(fp, op, sizeof(struct fc_ns_rsnn) + len); | ||
| 166 | put_unaligned_be64(lport->wwnn, &ct->payload.snn.fr_wwn); | ||
| 167 | strncpy(ct->payload.snn.fr_name, | ||
| 168 | fc_host_symbolic_name(lport->host), len); | ||
| 169 | ct->payload.snn.fr_name_len = len; | ||
| 137 | break; | 170 | break; |
| 138 | 171 | ||
| 139 | default: | 172 | default: |
| @@ -198,6 +231,31 @@ static inline void fc_flogi_fill(struct fc_lport *lport, struct fc_frame *fp) | |||
| 198 | sp->sp_bb_data = htons((u16) lport->mfs); | 231 | sp->sp_bb_data = htons((u16) lport->mfs); |
| 199 | cp = &flogi->fl_cssp[3 - 1]; /* class 3 parameters */ | 232 | cp = &flogi->fl_cssp[3 - 1]; /* class 3 parameters */ |
| 200 | cp->cp_class = htons(FC_CPC_VALID | FC_CPC_SEQ); | 233 | cp->cp_class = htons(FC_CPC_VALID | FC_CPC_SEQ); |
| 234 | if (lport->does_npiv) | ||
| 235 | sp->sp_features = htons(FC_SP_FT_NPIV); | ||
| 236 | } | ||
| 237 | |||
| 238 | /** | ||
| 239 | * fc_fdisc_fill - Fill in a fdisc request frame. | ||
| 240 | */ | ||
| 241 | static inline void fc_fdisc_fill(struct fc_lport *lport, struct fc_frame *fp) | ||
| 242 | { | ||
| 243 | struct fc_els_csp *sp; | ||
| 244 | struct fc_els_cssp *cp; | ||
| 245 | struct fc_els_flogi *fdisc; | ||
| 246 | |||
| 247 | fdisc = fc_frame_payload_get(fp, sizeof(*fdisc)); | ||
| 248 | memset(fdisc, 0, sizeof(*fdisc)); | ||
| 249 | fdisc->fl_cmd = (u8) ELS_FDISC; | ||
| 250 | put_unaligned_be64(lport->wwpn, &fdisc->fl_wwpn); | ||
| 251 | put_unaligned_be64(lport->wwnn, &fdisc->fl_wwnn); | ||
| 252 | sp = &fdisc->fl_csp; | ||
| 253 | sp->sp_hi_ver = 0x20; | ||
| 254 | sp->sp_lo_ver = 0x20; | ||
| 255 | sp->sp_bb_cred = htons(10); /* this gets set by gateway */ | ||
| 256 | sp->sp_bb_data = htons((u16) lport->mfs); | ||
| 257 | cp = &fdisc->fl_cssp[3 - 1]; /* class 3 parameters */ | ||
| 258 | cp->cp_class = htons(FC_CPC_VALID | FC_CPC_SEQ); | ||
| 201 | } | 259 | } |
| 202 | 260 | ||
| 203 | /** | 261 | /** |
| @@ -296,6 +354,10 @@ static inline int fc_els_fill(struct fc_lport *lport, | |||
| 296 | fc_flogi_fill(lport, fp); | 354 | fc_flogi_fill(lport, fp); |
| 297 | break; | 355 | break; |
| 298 | 356 | ||
| 357 | case ELS_FDISC: | ||
| 358 | fc_fdisc_fill(lport, fp); | ||
| 359 | break; | ||
| 360 | |||
| 299 | case ELS_LOGO: | 361 | case ELS_LOGO: |
| 300 | fc_logo_fill(lport, fp); | 362 | fc_logo_fill(lport, fp); |
| 301 | break; | 363 | break; |
diff --git a/include/scsi/fc_frame.h b/include/scsi/fc_frame.h index c35d2383cc26..4d3e9c7b7c57 100644 --- a/include/scsi/fc_frame.h +++ b/include/scsi/fc_frame.h | |||
| @@ -28,6 +28,8 @@ | |||
| 28 | #include <scsi/fc/fc_fcp.h> | 28 | #include <scsi/fc/fc_fcp.h> |
| 29 | #include <scsi/fc/fc_encaps.h> | 29 | #include <scsi/fc/fc_encaps.h> |
| 30 | 30 | ||
| 31 | #include <linux/if_ether.h> | ||
| 32 | |||
| 31 | /* | 33 | /* |
| 32 | * The fc_frame interface is used to pass frame data between functions. | 34 | * The fc_frame interface is used to pass frame data between functions. |
| 33 | * The frame includes the data buffer, length, and SOF / EOF delimiter types. | 35 | * The frame includes the data buffer, length, and SOF / EOF delimiter types. |
| @@ -37,6 +39,9 @@ | |||
| 37 | #define FC_FRAME_HEADROOM 32 /* headroom for VLAN + FCoE headers */ | 39 | #define FC_FRAME_HEADROOM 32 /* headroom for VLAN + FCoE headers */ |
| 38 | #define FC_FRAME_TAILROOM 8 /* trailer space for FCoE */ | 40 | #define FC_FRAME_TAILROOM 8 /* trailer space for FCoE */ |
| 39 | 41 | ||
| 42 | /* Max number of skb frags allowed, reserving one for fcoe_crc_eof page */ | ||
| 43 | #define FC_FRAME_SG_LEN (MAX_SKB_FRAGS - 1) | ||
| 44 | |||
| 40 | #define fp_skb(fp) (&((fp)->skb)) | 45 | #define fp_skb(fp) (&((fp)->skb)) |
| 41 | #define fr_hdr(fp) ((fp)->skb.data) | 46 | #define fr_hdr(fp) ((fp)->skb.data) |
| 42 | #define fr_len(fp) ((fp)->skb.len) | 47 | #define fr_len(fp) ((fp)->skb.len) |
| @@ -64,6 +69,7 @@ struct fcoe_rcv_info { | |||
| 64 | enum fc_sof fr_sof; /* start of frame delimiter */ | 69 | enum fc_sof fr_sof; /* start of frame delimiter */ |
| 65 | enum fc_eof fr_eof; /* end of frame delimiter */ | 70 | enum fc_eof fr_eof; /* end of frame delimiter */ |
| 66 | u8 fr_flags; /* flags - see below */ | 71 | u8 fr_flags; /* flags - see below */ |
| 72 | u8 granted_mac[ETH_ALEN]; /* FCoE MAC address */ | ||
| 67 | }; | 73 | }; |
| 68 | 74 | ||
| 69 | 75 | ||
| @@ -94,17 +100,7 @@ static inline void fc_frame_init(struct fc_frame *fp) | |||
| 94 | } | 100 | } |
| 95 | 101 | ||
| 96 | struct fc_frame *fc_frame_alloc_fill(struct fc_lport *, size_t payload_len); | 102 | struct fc_frame *fc_frame_alloc_fill(struct fc_lport *, size_t payload_len); |
| 97 | 103 | struct fc_frame *_fc_frame_alloc(size_t payload_len); | |
| 98 | struct fc_frame *__fc_frame_alloc(size_t payload_len); | ||
| 99 | |||
| 100 | /* | ||
| 101 | * Get frame for sending via port. | ||
| 102 | */ | ||
| 103 | static inline struct fc_frame *_fc_frame_alloc(struct fc_lport *dev, | ||
| 104 | size_t payload_len) | ||
| 105 | { | ||
| 106 | return __fc_frame_alloc(payload_len); | ||
| 107 | } | ||
| 108 | 104 | ||
| 109 | /* | 105 | /* |
| 110 | * Allocate fc_frame structure and buffer. Set the initial length to | 106 | * Allocate fc_frame structure and buffer. Set the initial length to |
| @@ -118,10 +114,10 @@ static inline struct fc_frame *fc_frame_alloc(struct fc_lport *dev, size_t len) | |||
| 118 | * Note: Since len will often be a constant multiple of 4, | 114 | * Note: Since len will often be a constant multiple of 4, |
| 119 | * this check will usually be evaluated and eliminated at compile time. | 115 | * this check will usually be evaluated and eliminated at compile time. |
| 120 | */ | 116 | */ |
| 121 | if ((len % 4) != 0) | 117 | if (len && len % 4) |
| 122 | fp = fc_frame_alloc_fill(dev, len); | 118 | fp = fc_frame_alloc_fill(dev, len); |
| 123 | else | 119 | else |
| 124 | fp = _fc_frame_alloc(dev, len); | 120 | fp = _fc_frame_alloc(len); |
| 125 | return fp; | 121 | return fp; |
| 126 | } | 122 | } |
| 127 | 123 | ||
diff --git a/include/scsi/iscsi_if.h b/include/scsi/iscsi_if.h index d67dda2b6aa0..66d377b9c72b 100644 --- a/include/scsi/iscsi_if.h +++ b/include/scsi/iscsi_if.h | |||
| @@ -311,6 +311,8 @@ enum iscsi_param { | |||
| 311 | ISCSI_PARAM_IFACE_NAME, | 311 | ISCSI_PARAM_IFACE_NAME, |
| 312 | ISCSI_PARAM_ISID, | 312 | ISCSI_PARAM_ISID, |
| 313 | ISCSI_PARAM_INITIATOR_NAME, | 313 | ISCSI_PARAM_INITIATOR_NAME, |
| 314 | |||
| 315 | ISCSI_PARAM_TGT_RESET_TMO, | ||
| 314 | /* must always be last */ | 316 | /* must always be last */ |
| 315 | ISCSI_PARAM_MAX, | 317 | ISCSI_PARAM_MAX, |
| 316 | }; | 318 | }; |
| @@ -350,6 +352,7 @@ enum iscsi_param { | |||
| 350 | #define ISCSI_IFACE_NAME (1ULL << ISCSI_PARAM_IFACE_NAME) | 352 | #define ISCSI_IFACE_NAME (1ULL << ISCSI_PARAM_IFACE_NAME) |
| 351 | #define ISCSI_ISID (1ULL << ISCSI_PARAM_ISID) | 353 | #define ISCSI_ISID (1ULL << ISCSI_PARAM_ISID) |
| 352 | #define ISCSI_INITIATOR_NAME (1ULL << ISCSI_PARAM_INITIATOR_NAME) | 354 | #define ISCSI_INITIATOR_NAME (1ULL << ISCSI_PARAM_INITIATOR_NAME) |
| 355 | #define ISCSI_TGT_RESET_TMO (1ULL << ISCSI_PARAM_TGT_RESET_TMO) | ||
| 353 | 356 | ||
| 354 | /* iSCSI HBA params */ | 357 | /* iSCSI HBA params */ |
| 355 | enum iscsi_host_param { | 358 | enum iscsi_host_param { |
diff --git a/include/scsi/iscsi_proto.h b/include/scsi/iscsi_proto.h index f2a2c1169486..dd0a52cea95a 100644 --- a/include/scsi/iscsi_proto.h +++ b/include/scsi/iscsi_proto.h | |||
| @@ -279,6 +279,8 @@ struct iscsi_tm { | |||
| 279 | #define ISCSI_TM_FUNC_TARGET_COLD_RESET 7 | 279 | #define ISCSI_TM_FUNC_TARGET_COLD_RESET 7 |
| 280 | #define ISCSI_TM_FUNC_TASK_REASSIGN 8 | 280 | #define ISCSI_TM_FUNC_TASK_REASSIGN 8 |
| 281 | 281 | ||
| 282 | #define ISCSI_TM_FUNC_VALUE(hdr) ((hdr)->flags & ISCSI_FLAG_TM_FUNC_MASK) | ||
| 283 | |||
| 282 | /* SCSI Task Management Response Header */ | 284 | /* SCSI Task Management Response Header */ |
| 283 | struct iscsi_tm_rsp { | 285 | struct iscsi_tm_rsp { |
| 284 | uint8_t opcode; | 286 | uint8_t opcode; |
diff --git a/include/scsi/libfc.h b/include/scsi/libfc.h index 65dc9aacbf70..4b912eee33e5 100644 --- a/include/scsi/libfc.h +++ b/include/scsi/libfc.h | |||
| @@ -26,6 +26,7 @@ | |||
| 26 | 26 | ||
| 27 | #include <scsi/scsi_transport.h> | 27 | #include <scsi/scsi_transport.h> |
| 28 | #include <scsi/scsi_transport_fc.h> | 28 | #include <scsi/scsi_transport_fc.h> |
| 29 | #include <scsi/scsi_bsg_fc.h> | ||
| 29 | 30 | ||
| 30 | #include <scsi/fc/fc_fcp.h> | 31 | #include <scsi/fc/fc_fcp.h> |
| 31 | #include <scsi/fc/fc_ns.h> | 32 | #include <scsi/fc/fc_ns.h> |
| @@ -34,67 +35,6 @@ | |||
| 34 | 35 | ||
| 35 | #include <scsi/fc_frame.h> | 36 | #include <scsi/fc_frame.h> |
| 36 | 37 | ||
| 37 | #define FC_LIBFC_LOGGING 0x01 /* General logging, not categorized */ | ||
| 38 | #define FC_LPORT_LOGGING 0x02 /* lport layer logging */ | ||
| 39 | #define FC_DISC_LOGGING 0x04 /* discovery layer logging */ | ||
| 40 | #define FC_RPORT_LOGGING 0x08 /* rport layer logging */ | ||
| 41 | #define FC_FCP_LOGGING 0x10 /* I/O path logging */ | ||
| 42 | #define FC_EM_LOGGING 0x20 /* Exchange Manager logging */ | ||
| 43 | #define FC_EXCH_LOGGING 0x40 /* Exchange/Sequence logging */ | ||
| 44 | #define FC_SCSI_LOGGING 0x80 /* SCSI logging (mostly error handling) */ | ||
| 45 | |||
| 46 | extern unsigned int fc_debug_logging; | ||
| 47 | |||
| 48 | #define FC_CHECK_LOGGING(LEVEL, CMD) \ | ||
| 49 | do { \ | ||
| 50 | if (unlikely(fc_debug_logging & LEVEL)) \ | ||
| 51 | do { \ | ||
| 52 | CMD; \ | ||
| 53 | } while (0); \ | ||
| 54 | } while (0) | ||
| 55 | |||
| 56 | #define FC_LIBFC_DBG(fmt, args...) \ | ||
| 57 | FC_CHECK_LOGGING(FC_LIBFC_LOGGING, \ | ||
| 58 | printk(KERN_INFO "libfc: " fmt, ##args)) | ||
| 59 | |||
| 60 | #define FC_LPORT_DBG(lport, fmt, args...) \ | ||
| 61 | FC_CHECK_LOGGING(FC_LPORT_LOGGING, \ | ||
| 62 | printk(KERN_INFO "host%u: lport %6x: " fmt, \ | ||
| 63 | (lport)->host->host_no, \ | ||
| 64 | fc_host_port_id((lport)->host), ##args)) | ||
| 65 | |||
| 66 | #define FC_DISC_DBG(disc, fmt, args...) \ | ||
| 67 | FC_CHECK_LOGGING(FC_DISC_LOGGING, \ | ||
| 68 | printk(KERN_INFO "host%u: disc: " fmt, \ | ||
| 69 | (disc)->lport->host->host_no, \ | ||
| 70 | ##args)) | ||
| 71 | |||
| 72 | #define FC_RPORT_ID_DBG(lport, port_id, fmt, args...) \ | ||
| 73 | FC_CHECK_LOGGING(FC_RPORT_LOGGING, \ | ||
| 74 | printk(KERN_INFO "host%u: rport %6x: " fmt, \ | ||
| 75 | (lport)->host->host_no, \ | ||
| 76 | (port_id), ##args)) | ||
| 77 | |||
| 78 | #define FC_RPORT_DBG(rdata, fmt, args...) \ | ||
| 79 | FC_RPORT_ID_DBG((rdata)->local_port, (rdata)->ids.port_id, fmt, ##args) | ||
| 80 | |||
| 81 | #define FC_FCP_DBG(pkt, fmt, args...) \ | ||
| 82 | FC_CHECK_LOGGING(FC_FCP_LOGGING, \ | ||
| 83 | printk(KERN_INFO "host%u: fcp: %6x: " fmt, \ | ||
| 84 | (pkt)->lp->host->host_no, \ | ||
| 85 | pkt->rport->port_id, ##args)) | ||
| 86 | |||
| 87 | #define FC_EXCH_DBG(exch, fmt, args...) \ | ||
| 88 | FC_CHECK_LOGGING(FC_EXCH_LOGGING, \ | ||
| 89 | printk(KERN_INFO "host%u: xid %4x: " fmt, \ | ||
| 90 | (exch)->lp->host->host_no, \ | ||
| 91 | exch->xid, ##args)) | ||
| 92 | |||
| 93 | #define FC_SCSI_DBG(lport, fmt, args...) \ | ||
| 94 | FC_CHECK_LOGGING(FC_SCSI_LOGGING, \ | ||
| 95 | printk(KERN_INFO "host%u: scsi: " fmt, \ | ||
| 96 | (lport)->host->host_no, ##args)) | ||
| 97 | |||
| 98 | /* | 38 | /* |
| 99 | * libfc error codes | 39 | * libfc error codes |
| 100 | */ | 40 | */ |
| @@ -115,15 +55,28 @@ do { \ | |||
| 115 | p[2] = ((v) & 0xFF); \ | 55 | p[2] = ((v) & 0xFF); \ |
| 116 | } while (0) | 56 | } while (0) |
| 117 | 57 | ||
| 118 | /* | 58 | /** |
| 119 | * FC HBA status | 59 | * enum fc_lport_state - Local port states |
| 60 | * @LPORT_ST_DISABLED: Disabled | ||
| 61 | * @LPORT_ST_FLOGI: Fabric login (FLOGI) sent | ||
| 62 | * @LPORT_ST_DNS: Waiting for name server remote port to become ready | ||
| 63 | * @LPORT_ST_RPN_ID: Register port name by ID (RPN_ID) sent | ||
| 64 | * @LPORT_ST_RFT_ID: Register Fibre Channel types by ID (RFT_ID) sent | ||
| 65 | * @LPORT_ST_RFF_ID: Register FC-4 Features by ID (RFF_ID) sent | ||
| 66 | * @LPORT_ST_SCR: State Change Register (SCR) sent | ||
| 67 | * @LPORT_ST_READY: Ready for use | ||
| 68 | * @LPORT_ST_LOGO: Local port logout (LOGO) sent | ||
| 69 | * @LPORT_ST_RESET: Local port reset | ||
| 120 | */ | 70 | */ |
| 121 | enum fc_lport_state { | 71 | enum fc_lport_state { |
| 122 | LPORT_ST_DISABLED = 0, | 72 | LPORT_ST_DISABLED = 0, |
| 123 | LPORT_ST_FLOGI, | 73 | LPORT_ST_FLOGI, |
| 124 | LPORT_ST_DNS, | 74 | LPORT_ST_DNS, |
| 125 | LPORT_ST_RPN_ID, | 75 | LPORT_ST_RNN_ID, |
| 76 | LPORT_ST_RSNN_NN, | ||
| 77 | LPORT_ST_RSPN_ID, | ||
| 126 | LPORT_ST_RFT_ID, | 78 | LPORT_ST_RFT_ID, |
| 79 | LPORT_ST_RFF_ID, | ||
| 127 | LPORT_ST_SCR, | 80 | LPORT_ST_SCR, |
| 128 | LPORT_ST_READY, | 81 | LPORT_ST_READY, |
| 129 | LPORT_ST_LOGO, | 82 | LPORT_ST_LOGO, |
| @@ -136,15 +89,28 @@ enum fc_disc_event { | |||
| 136 | DISC_EV_FAILED | 89 | DISC_EV_FAILED |
| 137 | }; | 90 | }; |
| 138 | 91 | ||
| 92 | /** | ||
| 93 | * enum fc_rport_state - Remote port states | ||
| 94 | * @RPORT_ST_INIT: Initialized | ||
| 95 | * @RPORT_ST_PLOGI: Waiting for PLOGI completion | ||
| 96 | * @RPORT_ST_PRLI: Waiting for PRLI completion | ||
| 97 | * @RPORT_ST_RTV: Waiting for RTV completion | ||
| 98 | * @RPORT_ST_READY: Ready for use | ||
| 99 | * @RPORT_ST_LOGO: Remote port logout (LOGO) sent | ||
| 100 | * @RPORT_ST_ADISC: Discover Address sent | ||
| 101 | * @RPORT_ST_DELETE: Remote port being deleted | ||
| 102 | * @RPORT_ST_RESTART: Remote port being deleted and will restart | ||
| 103 | */ | ||
| 139 | enum fc_rport_state { | 104 | enum fc_rport_state { |
| 140 | RPORT_ST_INIT, /* initialized */ | 105 | RPORT_ST_INIT, |
| 141 | RPORT_ST_PLOGI, /* waiting for PLOGI completion */ | 106 | RPORT_ST_PLOGI, |
| 142 | RPORT_ST_PRLI, /* waiting for PRLI completion */ | 107 | RPORT_ST_PRLI, |
| 143 | RPORT_ST_RTV, /* waiting for RTV completion */ | 108 | RPORT_ST_RTV, |
| 144 | RPORT_ST_READY, /* ready for use */ | 109 | RPORT_ST_READY, |
| 145 | RPORT_ST_LOGO, /* port logout sent */ | 110 | RPORT_ST_LOGO, |
| 146 | RPORT_ST_ADISC, /* Discover Address sent */ | 111 | RPORT_ST_ADISC, |
| 147 | RPORT_ST_DELETE, /* port being deleted */ | 112 | RPORT_ST_DELETE, |
| 113 | RPORT_ST_RESTART, | ||
| 148 | }; | 114 | }; |
| 149 | 115 | ||
| 150 | /** | 116 | /** |
| @@ -155,12 +121,20 @@ enum fc_rport_state { | |||
| 155 | * @port_id: Port ID of the discovered port | 121 | * @port_id: Port ID of the discovered port |
| 156 | */ | 122 | */ |
| 157 | struct fc_disc_port { | 123 | struct fc_disc_port { |
| 158 | struct fc_lport *lp; | 124 | struct fc_lport *lp; |
| 159 | struct list_head peers; | 125 | struct list_head peers; |
| 160 | struct work_struct rport_work; | 126 | struct work_struct rport_work; |
| 161 | u32 port_id; | 127 | u32 port_id; |
| 162 | }; | 128 | }; |
| 163 | 129 | ||
| 130 | /** | ||
| 131 | * enum fc_rport_event - Remote port events | ||
| 132 | * @RPORT_EV_NONE: No event | ||
| 133 | * @RPORT_EV_READY: Remote port is ready for use | ||
| 134 | * @RPORT_EV_FAILED: State machine failed, remote port is not ready | ||
| 135 | * @RPORT_EV_STOP: Remote port has been stopped | ||
| 136 | * @RPORT_EV_LOGO: Remote port logout (LOGO) sent | ||
| 137 | */ | ||
| 164 | enum fc_rport_event { | 138 | enum fc_rport_event { |
| 165 | RPORT_EV_NONE = 0, | 139 | RPORT_EV_NONE = 0, |
| 166 | RPORT_EV_READY, | 140 | RPORT_EV_READY, |
| @@ -171,6 +145,10 @@ enum fc_rport_event { | |||
| 171 | 145 | ||
| 172 | struct fc_rport_priv; | 146 | struct fc_rport_priv; |
| 173 | 147 | ||
| 148 | /** | ||
| 149 | * struct fc_rport_operations - Operations for a remote port | ||
| 150 | * @event_callback: Function to be called for remote port events | ||
| 151 | */ | ||
| 174 | struct fc_rport_operations { | 152 | struct fc_rport_operations { |
| 175 | void (*event_callback)(struct fc_lport *, struct fc_rport_priv *, | 153 | void (*event_callback)(struct fc_lport *, struct fc_rport_priv *, |
| 176 | enum fc_rport_event); | 154 | enum fc_rport_event); |
| @@ -178,11 +156,11 @@ struct fc_rport_operations { | |||
| 178 | 156 | ||
| 179 | /** | 157 | /** |
| 180 | * struct fc_rport_libfc_priv - libfc internal information about a remote port | 158 | * struct fc_rport_libfc_priv - libfc internal information about a remote port |
| 181 | * @local_port: Fibre Channel host port instance | 159 | * @local_port: The associated local port |
| 182 | * @rp_state: indicates READY for I/O or DELETE when blocked. | 160 | * @rp_state: Indicates READY for I/O or DELETE when blocked |
| 183 | * @flags: REC and RETRY supported flags | 161 | * @flags: REC and RETRY supported flags |
| 184 | * @e_d_tov: error detect timeout value (in msec) | 162 | * @e_d_tov: Error detect timeout value (in msec) |
| 185 | * @r_a_tov: resource allocation timeout value (in msec) | 163 | * @r_a_tov: Resource allocation timeout value (in msec) |
| 186 | */ | 164 | */ |
| 187 | struct fc_rport_libfc_priv { | 165 | struct fc_rport_libfc_priv { |
| 188 | struct fc_lport *local_port; | 166 | struct fc_lport *local_port; |
| @@ -195,47 +173,66 @@ struct fc_rport_libfc_priv { | |||
| 195 | }; | 173 | }; |
| 196 | 174 | ||
| 197 | /** | 175 | /** |
| 198 | * struct fc_rport_priv - libfc rport and discovery info about a remote port | 176 | * struct fc_rport_priv - libfc remote port and discovery info |
| 199 | * @local_port: Fibre Channel host port instance | 177 | * @local_port: The associated local port |
| 200 | * @rport: transport remote port | 178 | * @rport: The FC transport remote port |
| 201 | * @kref: reference counter | 179 | * @kref: Reference counter |
| 202 | * @rp_state: state tracks progress of PLOGI, PRLI, and RTV exchanges | 180 | * @rp_state: Enumeration that tracks progress of PLOGI, PRLI, |
| 203 | * @ids: remote port identifiers and roles | 181 | * and RTV exchanges |
| 204 | * @flags: REC and RETRY supported flags | 182 | * @ids: The remote port identifiers and roles |
| 205 | * @max_seq: maximum number of concurrent sequences | 183 | * @flags: REC and RETRY supported flags |
| 206 | * @disc_id: discovery identifier | 184 | * @max_seq: Maximum number of concurrent sequences |
| 207 | * @maxframe_size: maximum frame size | 185 | * @disc_id: The discovery identifier |
| 208 | * @retries: retry count in current state | 186 | * @maxframe_size: The maximum frame size |
| 209 | * @e_d_tov: error detect timeout value (in msec) | 187 | * @retries: The retry count for the current state |
| 210 | * @r_a_tov: resource allocation timeout value (in msec) | 188 | * @e_d_tov: Error detect timeout value (in msec) |
| 211 | * @rp_mutex: mutex protects rport | 189 | * @r_a_tov: Resource allocation timeout value (in msec) |
| 212 | * @retry_work: | 190 | * @rp_mutex: The mutex that protects the remote port |
| 213 | * @event_callback: Callback for rport READY, FAILED or LOGO | 191 | * @retry_work: Handle for retries |
| 192 | * @event_callback: Callback when READY, FAILED or LOGO states complete | ||
| 214 | */ | 193 | */ |
| 215 | struct fc_rport_priv { | 194 | struct fc_rport_priv { |
| 216 | struct fc_lport *local_port; | 195 | struct fc_lport *local_port; |
| 217 | struct fc_rport *rport; | 196 | struct fc_rport *rport; |
| 218 | struct kref kref; | 197 | struct kref kref; |
| 219 | enum fc_rport_state rp_state; | 198 | enum fc_rport_state rp_state; |
| 220 | struct fc_rport_identifiers ids; | 199 | struct fc_rport_identifiers ids; |
| 221 | u16 flags; | 200 | u16 flags; |
| 222 | u16 max_seq; | 201 | u16 max_seq; |
| 223 | u16 disc_id; | 202 | u16 disc_id; |
| 224 | u16 maxframe_size; | 203 | u16 maxframe_size; |
| 225 | unsigned int retries; | 204 | unsigned int retries; |
| 226 | unsigned int e_d_tov; | 205 | unsigned int e_d_tov; |
| 227 | unsigned int r_a_tov; | 206 | unsigned int r_a_tov; |
| 228 | struct mutex rp_mutex; | 207 | struct mutex rp_mutex; |
| 229 | struct delayed_work retry_work; | 208 | struct delayed_work retry_work; |
| 230 | enum fc_rport_event event; | 209 | enum fc_rport_event event; |
| 231 | struct fc_rport_operations *ops; | 210 | struct fc_rport_operations *ops; |
| 232 | struct list_head peers; | 211 | struct list_head peers; |
| 233 | struct work_struct event_work; | 212 | struct work_struct event_work; |
| 234 | u32 supported_classes; | 213 | u32 supported_classes; |
| 235 | }; | 214 | }; |
| 236 | 215 | ||
| 237 | /* | 216 | /** |
| 238 | * fcoe stats structure | 217 | * struct fcoe_dev_stats - fcoe stats structure |
| 218 | * @SecondsSinceLastReset: Seconds since the last reset | ||
| 219 | * @TxFrames: Number of transmitted frames | ||
| 220 | * @TxWords: Number of transmitted words | ||
| 221 | * @RxFrames: Number of received frames | ||
| 222 | * @RxWords: Number of received words | ||
| 223 | * @ErrorFrames: Number of received error frames | ||
| 224 | * @DumpedFrames: Number of dumped frames | ||
| 225 | * @LinkFailureCount: Number of link failures | ||
| 226 | * @LossOfSignalCount: Number for signal losses | ||
| 227 | * @InvalidTxWordCount: Number of invalid transmitted words | ||
| 228 | * @InvalidCRCCount: Number of invalid CRCs | ||
| 229 | * @InputRequests: Number of input requests | ||
| 230 | * @OutputRequests: Number of output requests | ||
| 231 | * @ControlRequests: Number of control requests | ||
| 232 | * @InputMegabytes: Number of received megabytes | ||
| 233 | * @OutputMegabytes: Number of transmitted megabytes | ||
| 234 | * @VLinkFailureCount: Number of virtual link failures | ||
| 235 | * @MissDiscAdvCount: Number of missing FIP discovery advertisement | ||
| 239 | */ | 236 | */ |
| 240 | struct fcoe_dev_stats { | 237 | struct fcoe_dev_stats { |
| 241 | u64 SecondsSinceLastReset; | 238 | u64 SecondsSinceLastReset; |
| @@ -254,12 +251,17 @@ struct fcoe_dev_stats { | |||
| 254 | u64 ControlRequests; | 251 | u64 ControlRequests; |
| 255 | u64 InputMegabytes; | 252 | u64 InputMegabytes; |
| 256 | u64 OutputMegabytes; | 253 | u64 OutputMegabytes; |
| 254 | u64 VLinkFailureCount; | ||
| 255 | u64 MissDiscAdvCount; | ||
| 257 | }; | 256 | }; |
| 258 | 257 | ||
| 259 | /* | 258 | /** |
| 260 | * els data is used for passing ELS respone specific | 259 | * struct fc_seq_els_data - ELS data used for passing ELS specific responses |
| 261 | * data to send ELS response mainly using infomation | 260 | * @fp: The ELS frame |
| 262 | * in exchange and sequence in EM layer. | 261 | * @reason: The reason for rejection |
| 262 | * @explan: The explaination of the rejection | ||
| 263 | * | ||
| 264 | * Mainly used by the exchange manager layer. | ||
| 263 | */ | 265 | */ |
| 264 | struct fc_seq_els_data { | 266 | struct fc_seq_els_data { |
| 265 | struct fc_frame *fp; | 267 | struct fc_frame *fp; |
| @@ -267,77 +269,87 @@ struct fc_seq_els_data { | |||
| 267 | enum fc_els_rjt_explan explan; | 269 | enum fc_els_rjt_explan explan; |
| 268 | }; | 270 | }; |
| 269 | 271 | ||
| 270 | /* | 272 | /** |
| 271 | * FCP request structure, one for each scsi cmd request | 273 | * struct fc_fcp_pkt - FCP request structure (one for each scsi_cmnd request) |
| 274 | * @lp: The associated local port | ||
| 275 | * @state: The state of the I/O | ||
| 276 | * @tgt_flags: Target's flags | ||
| 277 | * @ref_cnt: Reference count | ||
| 278 | * @scsi_pkt_lock: Lock to protect the SCSI packet (must be taken before the | ||
| 279 | * host_lock if both are to be held at the same time) | ||
| 280 | * @cmd: The SCSI command (set and clear with the host_lock held) | ||
| 281 | * @list: Tracks queued commands (accessed with the host_lock held) | ||
| 282 | * @timer: The command timer | ||
| 283 | * @tm_done: Completion indicator | ||
| 284 | * @wait_for_comp: Indicator to wait for completion of the I/O (in jiffies) | ||
| 285 | * @start_time: Timestamp indicating the start of the I/O (in jiffies) | ||
| 286 | * @end_time: Timestamp indicating the end of the I/O (in jiffies) | ||
| 287 | * @last_pkt_time: Timestamp of the last frame received (in jiffies) | ||
| 288 | * @data_len: The length of the data | ||
| 289 | * @cdb_cmd: The CDB command | ||
| 290 | * @xfer_len: The transfer length | ||
| 291 | * @xfer_ddp: Indicates if this transfer used DDP (XID of the exchange | ||
| 292 | * will be set here if DDP was setup) | ||
| 293 | * @xfer_contig_end: The offset into the buffer if the buffer is contiguous | ||
| 294 | * (Tx and Rx) | ||
| 295 | * @max_payload: The maximum payload size (in bytes) | ||
| 296 | * @io_status: SCSI result (upper 24 bits) | ||
| 297 | * @cdb_status: CDB status | ||
| 298 | * @status_code: FCP I/O status | ||
| 299 | * @scsi_comp_flags: Completion flags (bit 3 Underrun bit 2: overrun) | ||
| 300 | * @req_flags: Request flags (bit 0: read bit:1 write) | ||
| 301 | * @scsi_resid: SCSI residule length | ||
| 302 | * @rport: The remote port that the SCSI command is targeted at | ||
| 303 | * @seq_ptr: The sequence that will carry the SCSI command | ||
| 304 | * @recov_retry: Number of recovery retries | ||
| 305 | * @recov_seq: The sequence for REC or SRR | ||
| 272 | */ | 306 | */ |
| 273 | struct fc_fcp_pkt { | 307 | struct fc_fcp_pkt { |
| 274 | /* | 308 | /* Housekeeping information */ |
| 275 | * housekeeping stuff | 309 | struct fc_lport *lp; |
| 276 | */ | 310 | u16 state; |
| 277 | struct fc_lport *lp; /* handle to hba struct */ | 311 | u16 tgt_flags; |
| 278 | u16 state; /* scsi_pkt state state */ | 312 | atomic_t ref_cnt; |
| 279 | u16 tgt_flags; /* target flags */ | 313 | spinlock_t scsi_pkt_lock; |
| 280 | atomic_t ref_cnt; /* fcp pkt ref count */ | 314 | |
| 281 | spinlock_t scsi_pkt_lock; /* Must be taken before the host lock | 315 | /* SCSI I/O related information */ |
| 282 | * if both are held at the same time */ | 316 | struct scsi_cmnd *cmd; |
| 283 | /* | 317 | struct list_head list; |
| 284 | * SCSI I/O related stuff | 318 | |
| 285 | */ | 319 | /* Timeout related information */ |
| 286 | struct scsi_cmnd *cmd; /* scsi command pointer. set/clear | 320 | struct timer_list timer; |
| 287 | * under host lock */ | ||
| 288 | struct list_head list; /* tracks queued commands. access under | ||
| 289 | * host lock */ | ||
| 290 | /* | ||
| 291 | * timeout related stuff | ||
| 292 | */ | ||
| 293 | struct timer_list timer; /* command timer */ | ||
| 294 | struct completion tm_done; | 321 | struct completion tm_done; |
| 295 | int wait_for_comp; | 322 | int wait_for_comp; |
| 296 | unsigned long start_time; /* start jiffie */ | 323 | unsigned long start_time; |
| 297 | unsigned long end_time; /* end jiffie */ | 324 | unsigned long end_time; |
| 298 | unsigned long last_pkt_time; /* jiffies of last frame received */ | 325 | unsigned long last_pkt_time; |
| 299 | 326 | ||
| 300 | /* | 327 | /* SCSI command and data transfer information */ |
| 301 | * scsi cmd and data transfer information | 328 | u32 data_len; |
| 302 | */ | 329 | |
| 303 | u32 data_len; | 330 | /* Transport related veriables */ |
| 304 | /* | 331 | struct fcp_cmnd cdb_cmd; |
| 305 | * transport related veriables | 332 | size_t xfer_len; |
| 306 | */ | 333 | u16 xfer_ddp; |
| 307 | struct fcp_cmnd cdb_cmd; | 334 | u32 xfer_contig_end; |
| 308 | size_t xfer_len; | 335 | u16 max_payload; |
| 309 | u16 xfer_ddp; /* this xfer is ddped */ | 336 | |
| 310 | u32 xfer_contig_end; /* offset of end of contiguous xfer */ | 337 | /* SCSI/FCP return status */ |
| 311 | u16 max_payload; /* max payload size in bytes */ | 338 | u32 io_status; |
| 312 | 339 | u8 cdb_status; | |
| 313 | /* | 340 | u8 status_code; |
| 314 | * scsi/fcp return status | 341 | u8 scsi_comp_flags; |
| 315 | */ | 342 | u32 req_flags; |
| 316 | u32 io_status; /* SCSI result upper 24 bits */ | 343 | u32 scsi_resid; |
| 317 | u8 cdb_status; | 344 | |
| 318 | u8 status_code; /* FCP I/O status */ | 345 | /* Associated structures */ |
| 319 | /* bit 3 Underrun bit 2: overrun */ | 346 | struct fc_rport *rport; |
| 320 | u8 scsi_comp_flags; | 347 | struct fc_seq *seq_ptr; |
| 321 | u32 req_flags; /* bit 0: read bit:1 write */ | 348 | |
| 322 | u32 scsi_resid; /* residule length */ | 349 | /* Error Processing information */ |
| 323 | 350 | u8 recov_retry; | |
| 324 | struct fc_rport *rport; /* remote port pointer */ | 351 | struct fc_seq *recov_seq; |
| 325 | struct fc_seq *seq_ptr; /* current sequence pointer */ | ||
| 326 | /* | ||
| 327 | * Error Processing | ||
| 328 | */ | ||
| 329 | u8 recov_retry; /* count of recovery retries */ | ||
| 330 | struct fc_seq *recov_seq; /* sequence for REC or SRR */ | ||
| 331 | }; | 352 | }; |
| 332 | /* | ||
| 333 | * FC_FCP HELPER FUNCTIONS | ||
| 334 | *****************************/ | ||
| 335 | static inline bool fc_fcp_is_read(const struct fc_fcp_pkt *fsp) | ||
| 336 | { | ||
| 337 | if (fsp && fsp->cmd) | ||
| 338 | return fsp->cmd->sc_data_direction == DMA_FROM_DEVICE; | ||
| 339 | return false; | ||
| 340 | } | ||
| 341 | 353 | ||
| 342 | /* | 354 | /* |
| 343 | * Structure and function definitions for managing Fibre Channel Exchanges | 355 | * Structure and function definitions for managing Fibre Channel Exchanges |
| @@ -350,23 +362,51 @@ static inline bool fc_fcp_is_read(const struct fc_fcp_pkt *fsp) | |||
| 350 | 362 | ||
| 351 | struct fc_exch_mgr; | 363 | struct fc_exch_mgr; |
| 352 | struct fc_exch_mgr_anchor; | 364 | struct fc_exch_mgr_anchor; |
| 353 | extern u16 fc_cpu_mask; /* cpu mask for possible cpus */ | 365 | extern u16 fc_cpu_mask; /* cpu mask for possible cpus */ |
| 354 | 366 | ||
| 355 | /* | 367 | /** |
| 356 | * Sequence. | 368 | * struct fc_seq - FC sequence |
| 369 | * @id: The sequence ID | ||
| 370 | * @ssb_stat: Status flags for the sequence status block (SSB) | ||
| 371 | * @cnt: Number of frames sent so far | ||
| 372 | * @rec_data: FC-4 value for REC | ||
| 357 | */ | 373 | */ |
| 358 | struct fc_seq { | 374 | struct fc_seq { |
| 359 | u8 id; /* seq ID */ | 375 | u8 id; |
| 360 | u16 ssb_stat; /* status flags for sequence status block */ | 376 | u16 ssb_stat; |
| 361 | u16 cnt; /* frames sent so far on sequence */ | 377 | u16 cnt; |
| 362 | u32 rec_data; /* FC-4 value for REC */ | 378 | u32 rec_data; |
| 363 | }; | 379 | }; |
| 364 | 380 | ||
| 365 | #define FC_EX_DONE (1 << 0) /* ep is completed */ | 381 | #define FC_EX_DONE (1 << 0) /* ep is completed */ |
| 366 | #define FC_EX_RST_CLEANUP (1 << 1) /* reset is forcing completion */ | 382 | #define FC_EX_RST_CLEANUP (1 << 1) /* reset is forcing completion */ |
| 367 | 383 | ||
| 368 | /* | 384 | /** |
| 369 | * Exchange. | 385 | * struct fc_exch - Fibre Channel Exchange |
| 386 | * @em: Exchange manager | ||
| 387 | * @pool: Exchange pool | ||
| 388 | * @state: The exchange's state | ||
| 389 | * @xid: The exchange ID | ||
| 390 | * @ex_list: Handle used by the EM to track free exchanges | ||
| 391 | * @ex_lock: Lock that protects the exchange | ||
| 392 | * @ex_refcnt: Reference count | ||
| 393 | * @timeout_work: Handle for timeout handler | ||
| 394 | * @lp: The local port that this exchange is on | ||
| 395 | * @oxid: Originator's exchange ID | ||
| 396 | * @rxid: Responder's exchange ID | ||
| 397 | * @oid: Originator's FCID | ||
| 398 | * @sid: Source FCID | ||
| 399 | * @did: Destination FCID | ||
| 400 | * @esb_stat: ESB exchange status | ||
| 401 | * @r_a_tov: Resouce allocation time out value (in msecs) | ||
| 402 | * @seq_id: The next sequence ID to use | ||
| 403 | * @f_ctl: F_CTL flags for the sequence | ||
| 404 | * @fh_type: The frame type | ||
| 405 | * @class: The class of service | ||
| 406 | * @seq: The sequence in use on this exchange | ||
| 407 | * @resp: Callback for responses on this exchange | ||
| 408 | * @destructor: Called when destroying the exchange | ||
| 409 | * @arg: Passed as a void pointer to the resp() callback | ||
| 370 | * | 410 | * |
| 371 | * Locking notes: The ex_lock protects following items: | 411 | * Locking notes: The ex_lock protects following items: |
| 372 | * state, esb_stat, f_ctl, seq.ssb_stat | 412 | * state, esb_stat, f_ctl, seq.ssb_stat |
| @@ -374,76 +414,59 @@ struct fc_seq { | |||
| 374 | * sequence allocation | 414 | * sequence allocation |
| 375 | */ | 415 | */ |
| 376 | struct fc_exch { | 416 | struct fc_exch { |
| 377 | struct fc_exch_mgr *em; /* exchange manager */ | 417 | struct fc_exch_mgr *em; |
| 378 | struct fc_exch_pool *pool; /* per cpu exches pool */ | 418 | struct fc_exch_pool *pool; |
| 379 | u32 state; /* internal driver state */ | 419 | u32 state; |
| 380 | u16 xid; /* our exchange ID */ | 420 | u16 xid; |
| 381 | struct list_head ex_list; /* free or busy list linkage */ | 421 | struct list_head ex_list; |
| 382 | spinlock_t ex_lock; /* lock covering exchange state */ | 422 | spinlock_t ex_lock; |
| 383 | atomic_t ex_refcnt; /* reference counter */ | 423 | atomic_t ex_refcnt; |
| 384 | struct delayed_work timeout_work; /* timer for upper level protocols */ | 424 | struct delayed_work timeout_work; |
| 385 | struct fc_lport *lp; /* fc device instance */ | 425 | struct fc_lport *lp; |
| 386 | u16 oxid; /* originator's exchange ID */ | 426 | u16 oxid; |
| 387 | u16 rxid; /* responder's exchange ID */ | 427 | u16 rxid; |
| 388 | u32 oid; /* originator's FCID */ | 428 | u32 oid; |
| 389 | u32 sid; /* source FCID */ | 429 | u32 sid; |
| 390 | u32 did; /* destination FCID */ | 430 | u32 did; |
| 391 | u32 esb_stat; /* exchange status for ESB */ | 431 | u32 esb_stat; |
| 392 | u32 r_a_tov; /* r_a_tov from rport (msec) */ | 432 | u32 r_a_tov; |
| 393 | u8 seq_id; /* next sequence ID to use */ | 433 | u8 seq_id; |
| 394 | u32 f_ctl; /* F_CTL flags for sequences */ | 434 | u32 f_ctl; |
| 395 | u8 fh_type; /* frame type */ | 435 | u8 fh_type; |
| 396 | enum fc_class class; /* class of service */ | 436 | enum fc_class class; |
| 397 | struct fc_seq seq; /* single sequence */ | 437 | struct fc_seq seq; |
| 398 | /* | 438 | |
| 399 | * Handler for responses to this current exchange. | 439 | void (*resp)(struct fc_seq *, struct fc_frame *, void *); |
| 400 | */ | 440 | void *arg; |
| 401 | void (*resp)(struct fc_seq *, struct fc_frame *, void *); | 441 | |
| 402 | void (*destructor)(struct fc_seq *, void *); | 442 | void (*destructor)(struct fc_seq *, void *); |
| 403 | /* | 443 | |
| 404 | * arg is passed as void pointer to exchange | ||
| 405 | * resp and destructor handlers | ||
| 406 | */ | ||
| 407 | void *arg; | ||
| 408 | }; | 444 | }; |
| 409 | #define fc_seq_exch(sp) container_of(sp, struct fc_exch, seq) | 445 | #define fc_seq_exch(sp) container_of(sp, struct fc_exch, seq) |
| 410 | 446 | ||
| 411 | struct libfc_function_template { | ||
| 412 | 447 | ||
| 448 | struct libfc_function_template { | ||
| 413 | /* | 449 | /* |
| 414 | * Interface to send a FC frame | 450 | * Interface to send a FC frame |
| 415 | * | 451 | * |
| 416 | * STATUS: REQUIRED | 452 | * STATUS: REQUIRED |
| 417 | */ | 453 | */ |
| 418 | int (*frame_send)(struct fc_lport *lp, struct fc_frame *fp); | 454 | int (*frame_send)(struct fc_lport *, struct fc_frame *); |
| 419 | 455 | ||
| 420 | /* | 456 | /* |
| 421 | * Interface to send ELS/CT frames | 457 | * Interface to send ELS/CT frames |
| 422 | * | 458 | * |
| 423 | * STATUS: OPTIONAL | 459 | * STATUS: OPTIONAL |
| 424 | */ | 460 | */ |
| 425 | struct fc_seq *(*elsct_send)(struct fc_lport *lport, | 461 | struct fc_seq *(*elsct_send)(struct fc_lport *, u32 did, |
| 426 | u32 did, | 462 | struct fc_frame *, unsigned int op, |
| 427 | struct fc_frame *fp, | ||
| 428 | unsigned int op, | ||
| 429 | void (*resp)(struct fc_seq *, | 463 | void (*resp)(struct fc_seq *, |
| 430 | struct fc_frame *fp, | 464 | struct fc_frame *, void *arg), |
| 431 | void *arg), | ||
| 432 | void *arg, u32 timer_msec); | 465 | void *arg, u32 timer_msec); |
| 433 | 466 | ||
| 434 | /* | 467 | /* |
| 435 | * Send the FC frame payload using a new exchange and sequence. | 468 | * Send the FC frame payload using a new exchange and sequence. |
| 436 | * | 469 | * |
| 437 | * The frame pointer with some of the header's fields must be | ||
| 438 | * filled before calling exch_seq_send(), those fields are, | ||
| 439 | * | ||
| 440 | * - routing control | ||
| 441 | * - FC port did | ||
| 442 | * - FC port sid | ||
| 443 | * - FC header type | ||
| 444 | * - frame control | ||
| 445 | * - parameter or relative offset | ||
| 446 | * | ||
| 447 | * The exchange response handler is set in this routine to resp() | 470 | * The exchange response handler is set in this routine to resp() |
| 448 | * function pointer. It can be called in two scenarios: if a timeout | 471 | * function pointer. It can be called in two scenarios: if a timeout |
| 449 | * occurs or if a response frame is received for the exchange. The | 472 | * occurs or if a response frame is received for the exchange. The |
| @@ -464,14 +487,13 @@ struct libfc_function_template { | |||
| 464 | * | 487 | * |
| 465 | * STATUS: OPTIONAL | 488 | * STATUS: OPTIONAL |
| 466 | */ | 489 | */ |
| 467 | struct fc_seq *(*exch_seq_send)(struct fc_lport *lp, | 490 | struct fc_seq *(*exch_seq_send)(struct fc_lport *, struct fc_frame *, |
| 468 | struct fc_frame *fp, | 491 | void (*resp)(struct fc_seq *, |
| 469 | void (*resp)(struct fc_seq *sp, | 492 | struct fc_frame *, |
| 470 | struct fc_frame *fp, | 493 | void *), |
| 471 | void *arg), | 494 | void (*destructor)(struct fc_seq *, |
| 472 | void (*destructor)(struct fc_seq *sp, | 495 | void *), |
| 473 | void *arg), | 496 | void *, unsigned int timer_msec); |
| 474 | void *arg, unsigned int timer_msec); | ||
| 475 | 497 | ||
| 476 | /* | 498 | /* |
| 477 | * Sets up the DDP context for a given exchange id on the given | 499 | * Sets up the DDP context for a given exchange id on the given |
| @@ -479,22 +501,28 @@ struct libfc_function_template { | |||
| 479 | * | 501 | * |
| 480 | * STATUS: OPTIONAL | 502 | * STATUS: OPTIONAL |
| 481 | */ | 503 | */ |
| 482 | int (*ddp_setup)(struct fc_lport *lp, u16 xid, | 504 | int (*ddp_setup)(struct fc_lport *, u16, struct scatterlist *, |
| 483 | struct scatterlist *sgl, unsigned int sgc); | 505 | unsigned int); |
| 484 | /* | 506 | /* |
| 485 | * Completes the DDP transfer and returns the length of data DDPed | 507 | * Completes the DDP transfer and returns the length of data DDPed |
| 486 | * for the given exchange id. | 508 | * for the given exchange id. |
| 487 | * | 509 | * |
| 488 | * STATUS: OPTIONAL | 510 | * STATUS: OPTIONAL |
| 489 | */ | 511 | */ |
| 490 | int (*ddp_done)(struct fc_lport *lp, u16 xid); | 512 | int (*ddp_done)(struct fc_lport *, u16); |
| 513 | /* | ||
| 514 | * Allow LLD to fill its own Link Error Status Block | ||
| 515 | * | ||
| 516 | * STATUS: OPTIONAL | ||
| 517 | */ | ||
| 518 | void (*get_lesb)(struct fc_lport *, struct fc_els_lesb *lesb); | ||
| 491 | /* | 519 | /* |
| 492 | * Send a frame using an existing sequence and exchange. | 520 | * Send a frame using an existing sequence and exchange. |
| 493 | * | 521 | * |
| 494 | * STATUS: OPTIONAL | 522 | * STATUS: OPTIONAL |
| 495 | */ | 523 | */ |
| 496 | int (*seq_send)(struct fc_lport *lp, struct fc_seq *sp, | 524 | int (*seq_send)(struct fc_lport *, struct fc_seq *, |
| 497 | struct fc_frame *fp); | 525 | struct fc_frame *); |
| 498 | 526 | ||
| 499 | /* | 527 | /* |
| 500 | * Send an ELS response using infomation from a previous | 528 | * Send an ELS response using infomation from a previous |
| @@ -502,8 +530,8 @@ struct libfc_function_template { | |||
| 502 | * | 530 | * |
| 503 | * STATUS: OPTIONAL | 531 | * STATUS: OPTIONAL |
| 504 | */ | 532 | */ |
| 505 | void (*seq_els_rsp_send)(struct fc_seq *sp, enum fc_els_cmd els_cmd, | 533 | void (*seq_els_rsp_send)(struct fc_seq *, enum fc_els_cmd, |
| 506 | struct fc_seq_els_data *els_data); | 534 | struct fc_seq_els_data *); |
| 507 | 535 | ||
| 508 | /* | 536 | /* |
| 509 | * Abort an exchange and sequence. Generally called because of a | 537 | * Abort an exchange and sequence. Generally called because of a |
| @@ -515,7 +543,7 @@ struct libfc_function_template { | |||
| 515 | * | 543 | * |
| 516 | * STATUS: OPTIONAL | 544 | * STATUS: OPTIONAL |
| 517 | */ | 545 | */ |
| 518 | int (*seq_exch_abort)(const struct fc_seq *req_sp, | 546 | int (*seq_exch_abort)(const struct fc_seq *, |
| 519 | unsigned int timer_msec); | 547 | unsigned int timer_msec); |
| 520 | 548 | ||
| 521 | /* | 549 | /* |
| @@ -524,14 +552,14 @@ struct libfc_function_template { | |||
| 524 | * | 552 | * |
| 525 | * STATUS: OPTIONAL | 553 | * STATUS: OPTIONAL |
| 526 | */ | 554 | */ |
| 527 | void (*exch_done)(struct fc_seq *sp); | 555 | void (*exch_done)(struct fc_seq *); |
| 528 | 556 | ||
| 529 | /* | 557 | /* |
| 530 | * Start a new sequence on the same exchange/sequence tuple. | 558 | * Start a new sequence on the same exchange/sequence tuple. |
| 531 | * | 559 | * |
| 532 | * STATUS: OPTIONAL | 560 | * STATUS: OPTIONAL |
| 533 | */ | 561 | */ |
| 534 | struct fc_seq *(*seq_start_next)(struct fc_seq *sp); | 562 | struct fc_seq *(*seq_start_next)(struct fc_seq *); |
| 535 | 563 | ||
| 536 | /* | 564 | /* |
| 537 | * Reset an exchange manager, completing all sequences and exchanges. | 565 | * Reset an exchange manager, completing all sequences and exchanges. |
| @@ -540,8 +568,7 @@ struct libfc_function_template { | |||
| 540 | * | 568 | * |
| 541 | * STATUS: OPTIONAL | 569 | * STATUS: OPTIONAL |
| 542 | */ | 570 | */ |
| 543 | void (*exch_mgr_reset)(struct fc_lport *, | 571 | void (*exch_mgr_reset)(struct fc_lport *, u32 s_id, u32 d_id); |
| 544 | u32 s_id, u32 d_id); | ||
| 545 | 572 | ||
| 546 | /* | 573 | /* |
| 547 | * Flush the rport work queue. Generally used before shutdown. | 574 | * Flush the rport work queue. Generally used before shutdown. |
| @@ -555,8 +582,8 @@ struct libfc_function_template { | |||
| 555 | * | 582 | * |
| 556 | * STATUS: OPTIONAL | 583 | * STATUS: OPTIONAL |
| 557 | */ | 584 | */ |
| 558 | void (*lport_recv)(struct fc_lport *lp, struct fc_seq *sp, | 585 | void (*lport_recv)(struct fc_lport *, struct fc_seq *, |
| 559 | struct fc_frame *fp); | 586 | struct fc_frame *); |
| 560 | 587 | ||
| 561 | /* | 588 | /* |
| 562 | * Reset the local port. | 589 | * Reset the local port. |
| @@ -566,6 +593,26 @@ struct libfc_function_template { | |||
| 566 | int (*lport_reset)(struct fc_lport *); | 593 | int (*lport_reset)(struct fc_lport *); |
| 567 | 594 | ||
| 568 | /* | 595 | /* |
| 596 | * Set the local port FC_ID. | ||
| 597 | * | ||
| 598 | * This may be provided by the LLD to allow it to be | ||
| 599 | * notified when the local port is assigned a FC-ID. | ||
| 600 | * | ||
| 601 | * The frame, if non-NULL, is the incoming frame with the | ||
| 602 | * FLOGI LS_ACC or FLOGI, and may contain the granted MAC | ||
| 603 | * address for the LLD. The frame pointer may be NULL if | ||
| 604 | * no MAC is associated with this assignment (LOGO or PLOGI). | ||
| 605 | * | ||
| 606 | * If FC_ID is non-zero, r_a_tov and e_d_tov must be valid. | ||
| 607 | * | ||
| 608 | * Note: this is called with the local port mutex held. | ||
| 609 | * | ||
| 610 | * STATUS: OPTIONAL | ||
| 611 | */ | ||
| 612 | void (*lport_set_port_id)(struct fc_lport *, u32 port_id, | ||
| 613 | struct fc_frame *); | ||
| 614 | |||
| 615 | /* | ||
| 569 | * Create a remote port with a given port ID | 616 | * Create a remote port with a given port ID |
| 570 | * | 617 | * |
| 571 | * STATUS: OPTIONAL | 618 | * STATUS: OPTIONAL |
| @@ -622,31 +669,31 @@ struct libfc_function_template { | |||
| 622 | * | 669 | * |
| 623 | * STATUS: OPTIONAL | 670 | * STATUS: OPTIONAL |
| 624 | */ | 671 | */ |
| 625 | int (*fcp_cmd_send)(struct fc_lport *lp, struct fc_fcp_pkt *fsp, | 672 | int (*fcp_cmd_send)(struct fc_lport *, struct fc_fcp_pkt *, |
| 626 | void (*resp)(struct fc_seq *, struct fc_frame *fp, | 673 | void (*resp)(struct fc_seq *, struct fc_frame *, |
| 627 | void *arg)); | 674 | void *)); |
| 628 | 675 | ||
| 629 | /* | 676 | /* |
| 630 | * Cleanup the FCP layer, used durring link down and reset | 677 | * Cleanup the FCP layer, used durring link down and reset |
| 631 | * | 678 | * |
| 632 | * STATUS: OPTIONAL | 679 | * STATUS: OPTIONAL |
| 633 | */ | 680 | */ |
| 634 | void (*fcp_cleanup)(struct fc_lport *lp); | 681 | void (*fcp_cleanup)(struct fc_lport *); |
| 635 | 682 | ||
| 636 | /* | 683 | /* |
| 637 | * Abort all I/O on a local port | 684 | * Abort all I/O on a local port |
| 638 | * | 685 | * |
| 639 | * STATUS: OPTIONAL | 686 | * STATUS: OPTIONAL |
| 640 | */ | 687 | */ |
| 641 | void (*fcp_abort_io)(struct fc_lport *lp); | 688 | void (*fcp_abort_io)(struct fc_lport *); |
| 642 | 689 | ||
| 643 | /* | 690 | /* |
| 644 | * Receive a request for the discovery layer. | 691 | * Receive a request for the discovery layer. |
| 645 | * | 692 | * |
| 646 | * STATUS: OPTIONAL | 693 | * STATUS: OPTIONAL |
| 647 | */ | 694 | */ |
| 648 | void (*disc_recv_req)(struct fc_seq *, | 695 | void (*disc_recv_req)(struct fc_seq *, struct fc_frame *, |
| 649 | struct fc_frame *, struct fc_lport *); | 696 | struct fc_lport *); |
| 650 | 697 | ||
| 651 | /* | 698 | /* |
| 652 | * Start discovery for a local port. | 699 | * Start discovery for a local port. |
| @@ -675,419 +722,340 @@ struct libfc_function_template { | |||
| 675 | void (*disc_stop_final) (struct fc_lport *); | 722 | void (*disc_stop_final) (struct fc_lport *); |
| 676 | }; | 723 | }; |
| 677 | 724 | ||
| 678 | /* information used by the discovery layer */ | 725 | /** |
| 726 | * struct fc_disc - Discovery context | ||
| 727 | * @retry_count: Number of retries | ||
| 728 | * @pending: 1 if discovery is pending, 0 if not | ||
| 729 | * @requesting: 1 if discovery has been requested, 0 if not | ||
| 730 | * @seq_count: Number of sequences used for discovery | ||
| 731 | * @buf_len: Length of the discovery buffer | ||
| 732 | * @disc_id: Discovery ID | ||
| 733 | * @rports: List of discovered remote ports | ||
| 734 | * @lport: The local port that discovery is for | ||
| 735 | * @disc_mutex: Mutex that protects the discovery context | ||
| 736 | * @partial_buf: Partial name buffer (if names are returned | ||
| 737 | * in multiple frames) | ||
| 738 | * @disc_work: handle for delayed work context | ||
| 739 | * @disc_callback: Callback routine called when discovery completes | ||
| 740 | */ | ||
| 679 | struct fc_disc { | 741 | struct fc_disc { |
| 680 | unsigned char retry_count; | 742 | unsigned char retry_count; |
| 681 | unsigned char pending; | 743 | unsigned char pending; |
| 682 | unsigned char requested; | 744 | unsigned char requested; |
| 683 | unsigned short seq_count; | 745 | unsigned short seq_count; |
| 684 | unsigned char buf_len; | 746 | unsigned char buf_len; |
| 685 | u16 disc_id; | 747 | u16 disc_id; |
| 748 | |||
| 749 | struct list_head rports; | ||
| 750 | struct fc_lport *lport; | ||
| 751 | struct mutex disc_mutex; | ||
| 752 | struct fc_gpn_ft_resp partial_buf; | ||
| 753 | struct delayed_work disc_work; | ||
| 686 | 754 | ||
| 687 | void (*disc_callback)(struct fc_lport *, | 755 | void (*disc_callback)(struct fc_lport *, |
| 688 | enum fc_disc_event); | 756 | enum fc_disc_event); |
| 689 | |||
| 690 | struct list_head rports; | ||
| 691 | struct fc_lport *lport; | ||
| 692 | struct mutex disc_mutex; | ||
| 693 | struct fc_gpn_ft_resp partial_buf; /* partial name buffer */ | ||
| 694 | struct delayed_work disc_work; | ||
| 695 | }; | 757 | }; |
| 696 | 758 | ||
| 759 | /** | ||
| 760 | * struct fc_lport - Local port | ||
| 761 | * @host: The SCSI host associated with a local port | ||
| 762 | * @ema_list: Exchange manager anchor list | ||
| 763 | * @dns_rdata: The directory server remote port | ||
| 764 | * @ptp_rdata: Point to point remote port | ||
| 765 | * @scsi_priv: FCP layer internal data | ||
| 766 | * @disc: Discovery context | ||
| 767 | * @vports: Child vports if N_Port | ||
| 768 | * @vport: Parent vport if VN_Port | ||
| 769 | * @tt: Libfc function template | ||
| 770 | * @link_up: Link state (1 = link up, 0 = link down) | ||
| 771 | * @qfull: Queue state (1 queue is full, 0 queue is not full) | ||
| 772 | * @state: Identifies the state | ||
| 773 | * @boot_time: Timestamp indicating when the local port came online | ||
| 774 | * @host_stats: SCSI host statistics | ||
| 775 | * @dev_stats: FCoE device stats (TODO: libfc should not be | ||
| 776 | * FCoE aware) | ||
| 777 | * @retry_count: Number of retries in the current state | ||
| 778 | * @wwpn: World Wide Port Name | ||
| 779 | * @wwnn: World Wide Node Name | ||
| 780 | * @service_params: Common service parameters | ||
| 781 | * @e_d_tov: Error detection timeout value | ||
| 782 | * @r_a_tov: Resouce allocation timeout value | ||
| 783 | * @rnid_gen: RNID information | ||
| 784 | * @sg_supp: Indicates if scatter gather is supported | ||
| 785 | * @seq_offload: Indicates if sequence offload is supported | ||
| 786 | * @crc_offload: Indicates if CRC offload is supported | ||
| 787 | * @lro_enabled: Indicates if large receive offload is supported | ||
| 788 | * @does_npiv: Supports multiple vports | ||
| 789 | * @npiv_enabled: Switch/fabric allows NPIV | ||
| 790 | * @mfs: The maximum Fibre Channel payload size | ||
| 791 | * @max_retry_count: The maximum retry attempts | ||
| 792 | * @max_rport_retry_count: The maximum remote port retry attempts | ||
| 793 | * @lro_xid: The maximum XID for LRO | ||
| 794 | * @lso_max: The maximum large offload send size | ||
| 795 | * @fcts: FC-4 type mask | ||
| 796 | * @lp_mutex: Mutex to protect the local port | ||
| 797 | * @list: Handle for list of local ports | ||
| 798 | * @retry_work: Handle to local port for delayed retry context | ||
| 799 | */ | ||
| 697 | struct fc_lport { | 800 | struct fc_lport { |
| 698 | struct list_head list; | ||
| 699 | |||
| 700 | /* Associations */ | 801 | /* Associations */ |
| 701 | struct Scsi_Host *host; | 802 | struct Scsi_Host *host; |
| 702 | struct list_head ema_list; | 803 | struct list_head ema_list; |
| 703 | struct fc_rport_priv *dns_rp; | 804 | struct fc_rport_priv *dns_rdata; |
| 704 | struct fc_rport_priv *ptp_rp; | 805 | struct fc_rport_priv *ptp_rdata; |
| 705 | void *scsi_priv; | 806 | void *scsi_priv; |
| 706 | struct fc_disc disc; | 807 | struct fc_disc disc; |
| 808 | |||
| 809 | /* Virtual port information */ | ||
| 810 | struct list_head vports; | ||
| 811 | struct fc_vport *vport; | ||
| 707 | 812 | ||
| 708 | /* Operational Information */ | 813 | /* Operational Information */ |
| 709 | struct libfc_function_template tt; | 814 | struct libfc_function_template tt; |
| 710 | u8 link_up; | 815 | u8 link_up; |
| 711 | u8 qfull; | 816 | u8 qfull; |
| 712 | enum fc_lport_state state; | 817 | enum fc_lport_state state; |
| 713 | unsigned long boot_time; | 818 | unsigned long boot_time; |
| 714 | 819 | struct fc_host_statistics host_stats; | |
| 715 | struct fc_host_statistics host_stats; | 820 | struct fcoe_dev_stats *dev_stats; |
| 716 | struct fcoe_dev_stats *dev_stats; | 821 | u8 retry_count; |
| 717 | 822 | ||
| 718 | u64 wwpn; | 823 | /* Fabric information */ |
| 719 | u64 wwnn; | 824 | u64 wwpn; |
| 720 | u8 retry_count; | 825 | u64 wwnn; |
| 826 | unsigned int service_params; | ||
| 827 | unsigned int e_d_tov; | ||
| 828 | unsigned int r_a_tov; | ||
| 829 | struct fc_els_rnid_gen rnid_gen; | ||
| 721 | 830 | ||
| 722 | /* Capabilities */ | 831 | /* Capabilities */ |
| 723 | u32 sg_supp:1; /* scatter gather supported */ | 832 | u32 sg_supp:1; |
| 724 | u32 seq_offload:1; /* seq offload supported */ | 833 | u32 seq_offload:1; |
| 725 | u32 crc_offload:1; /* crc offload supported */ | 834 | u32 crc_offload:1; |
| 726 | u32 lro_enabled:1; /* large receive offload */ | 835 | u32 lro_enabled:1; |
| 727 | u32 mfs; /* max FC payload size */ | 836 | u32 does_npiv:1; |
| 728 | unsigned int service_params; | 837 | u32 npiv_enabled:1; |
| 729 | unsigned int e_d_tov; | 838 | u32 mfs; |
| 730 | unsigned int r_a_tov; | 839 | u8 max_retry_count; |
| 731 | u8 max_retry_count; | 840 | u8 max_rport_retry_count; |
| 732 | u8 max_rport_retry_count; | 841 | u16 link_speed; |
| 733 | u16 link_speed; | 842 | u16 link_supported_speeds; |
| 734 | u16 link_supported_speeds; | 843 | u16 lro_xid; |
| 735 | u16 lro_xid; /* max xid for fcoe lro */ | 844 | unsigned int lso_max; |
| 736 | unsigned int lso_max; /* max large send size */ | 845 | struct fc_ns_fts fcts; |
| 737 | struct fc_ns_fts fcts; /* FC-4 type masks */ | ||
| 738 | struct fc_els_rnid_gen rnid_gen; /* RNID information */ | ||
| 739 | |||
| 740 | /* Semaphores */ | ||
| 741 | struct mutex lp_mutex; | ||
| 742 | 846 | ||
| 743 | /* Miscellaneous */ | 847 | /* Miscellaneous */ |
| 744 | struct delayed_work retry_work; | 848 | struct mutex lp_mutex; |
| 745 | struct delayed_work disc_work; | 849 | struct list_head list; |
| 850 | struct delayed_work retry_work; | ||
| 746 | }; | 851 | }; |
| 747 | 852 | ||
| 748 | /* | 853 | /* |
| 749 | * FC_LPORT HELPER FUNCTIONS | 854 | * FC_LPORT HELPER FUNCTIONS |
| 750 | *****************************/ | 855 | *****************************/ |
| 751 | static inline int fc_lport_test_ready(struct fc_lport *lp) | 856 | |
| 857 | /** | ||
| 858 | * fc_lport_test_ready() - Determine if a local port is in the READY state | ||
| 859 | * @lport: The local port to test | ||
| 860 | */ | ||
| 861 | static inline int fc_lport_test_ready(struct fc_lport *lport) | ||
| 752 | { | 862 | { |
| 753 | return lp->state == LPORT_ST_READY; | 863 | return lport->state == LPORT_ST_READY; |
| 754 | } | 864 | } |
| 755 | 865 | ||
| 756 | static inline void fc_set_wwnn(struct fc_lport *lp, u64 wwnn) | 866 | /** |
| 867 | * fc_set_wwnn() - Set the World Wide Node Name of a local port | ||
| 868 | * @lport: The local port whose WWNN is to be set | ||
| 869 | * @wwnn: The new WWNN | ||
| 870 | */ | ||
| 871 | static inline void fc_set_wwnn(struct fc_lport *lport, u64 wwnn) | ||
| 757 | { | 872 | { |
| 758 | lp->wwnn = wwnn; | 873 | lport->wwnn = wwnn; |
| 759 | } | 874 | } |
| 760 | 875 | ||
| 761 | static inline void fc_set_wwpn(struct fc_lport *lp, u64 wwnn) | 876 | /** |
| 877 | * fc_set_wwpn() - Set the World Wide Port Name of a local port | ||
| 878 | * @lport: The local port whose WWPN is to be set | ||
| 879 | * @wwnn: The new WWPN | ||
| 880 | */ | ||
| 881 | static inline void fc_set_wwpn(struct fc_lport *lport, u64 wwnn) | ||
| 762 | { | 882 | { |
| 763 | lp->wwpn = wwnn; | 883 | lport->wwpn = wwnn; |
| 764 | } | 884 | } |
| 765 | 885 | ||
| 766 | static inline void fc_lport_state_enter(struct fc_lport *lp, | 886 | /** |
| 887 | * fc_lport_state_enter() - Change a local port's state | ||
| 888 | * @lport: The local port whose state is to change | ||
| 889 | * @state: The new state | ||
| 890 | */ | ||
| 891 | static inline void fc_lport_state_enter(struct fc_lport *lport, | ||
| 767 | enum fc_lport_state state) | 892 | enum fc_lport_state state) |
| 768 | { | 893 | { |
| 769 | if (state != lp->state) | 894 | if (state != lport->state) |
| 770 | lp->retry_count = 0; | 895 | lport->retry_count = 0; |
| 771 | lp->state = state; | 896 | lport->state = state; |
| 772 | } | 897 | } |
| 773 | 898 | ||
| 774 | static inline int fc_lport_init_stats(struct fc_lport *lp) | 899 | /** |
| 900 | * fc_lport_init_stats() - Allocate per-CPU statistics for a local port | ||
| 901 | * @lport: The local port whose statistics are to be initialized | ||
| 902 | */ | ||
| 903 | static inline int fc_lport_init_stats(struct fc_lport *lport) | ||
| 775 | { | 904 | { |
| 776 | /* allocate per cpu stats block */ | 905 | lport->dev_stats = alloc_percpu(struct fcoe_dev_stats); |
| 777 | lp->dev_stats = alloc_percpu(struct fcoe_dev_stats); | 906 | if (!lport->dev_stats) |
| 778 | if (!lp->dev_stats) | ||
| 779 | return -ENOMEM; | 907 | return -ENOMEM; |
| 780 | return 0; | 908 | return 0; |
| 781 | } | 909 | } |
| 782 | 910 | ||
| 783 | static inline void fc_lport_free_stats(struct fc_lport *lp) | 911 | /** |
| 912 | * fc_lport_free_stats() - Free memory for a local port's statistics | ||
| 913 | * @lport: The local port whose statistics are to be freed | ||
| 914 | */ | ||
| 915 | static inline void fc_lport_free_stats(struct fc_lport *lport) | ||
| 784 | { | 916 | { |
| 785 | free_percpu(lp->dev_stats); | 917 | free_percpu(lport->dev_stats); |
| 786 | } | 918 | } |
| 787 | 919 | ||
| 788 | static inline struct fcoe_dev_stats *fc_lport_get_stats(struct fc_lport *lp) | 920 | /** |
| 921 | * fc_lport_get_stats() - Get a local port's statistics | ||
| 922 | * @lport: The local port whose statistics are to be retreived | ||
| 923 | */ | ||
| 924 | static inline struct fcoe_dev_stats *fc_lport_get_stats(struct fc_lport *lport) | ||
| 789 | { | 925 | { |
| 790 | return per_cpu_ptr(lp->dev_stats, smp_processor_id()); | 926 | return per_cpu_ptr(lport->dev_stats, smp_processor_id()); |
| 791 | } | 927 | } |
| 792 | 928 | ||
| 793 | static inline void *lport_priv(const struct fc_lport *lp) | 929 | /** |
| 930 | * lport_priv() - Return the private data from a local port | ||
| 931 | * @lport: The local port whose private data is to be retreived | ||
| 932 | */ | ||
| 933 | static inline void *lport_priv(const struct fc_lport *lport) | ||
| 794 | { | 934 | { |
| 795 | return (void *)(lp + 1); | 935 | return (void *)(lport + 1); |
| 796 | } | 936 | } |
| 797 | 937 | ||
| 798 | /** | 938 | /** |
| 799 | * libfc_host_alloc() - Allocate a Scsi_Host with room for the fc_lport | 939 | * libfc_host_alloc() - Allocate a Scsi_Host with room for a local port and |
| 800 | * @sht: ptr to the scsi host templ | 940 | * LLD private data |
| 801 | * @priv_size: size of private data after fc_lport | 941 | * @sht: The SCSI host template |
| 942 | * @priv_size: Size of private data | ||
| 802 | * | 943 | * |
| 803 | * Returns: ptr to Scsi_Host | 944 | * Returns: libfc lport |
| 804 | */ | 945 | */ |
| 805 | static inline struct Scsi_Host * | 946 | static inline struct fc_lport * |
| 806 | libfc_host_alloc(struct scsi_host_template *sht, int priv_size) | 947 | libfc_host_alloc(struct scsi_host_template *sht, int priv_size) |
| 807 | { | 948 | { |
| 808 | return scsi_host_alloc(sht, sizeof(struct fc_lport) + priv_size); | 949 | struct fc_lport *lport; |
| 950 | struct Scsi_Host *shost; | ||
| 951 | |||
| 952 | shost = scsi_host_alloc(sht, sizeof(*lport) + priv_size); | ||
| 953 | if (!shost) | ||
| 954 | return NULL; | ||
| 955 | lport = shost_priv(shost); | ||
| 956 | lport->host = shost; | ||
| 957 | INIT_LIST_HEAD(&lport->ema_list); | ||
| 958 | INIT_LIST_HEAD(&lport->vports); | ||
| 959 | return lport; | ||
| 809 | } | 960 | } |
| 810 | 961 | ||
| 811 | /* | 962 | /* |
| 812 | * LOCAL PORT LAYER | 963 | * FC_FCP HELPER FUNCTIONS |
| 813 | *****************************/ | 964 | *****************************/ |
| 814 | int fc_lport_init(struct fc_lport *lp); | 965 | static inline bool fc_fcp_is_read(const struct fc_fcp_pkt *fsp) |
| 815 | 966 | { | |
| 816 | /* | 967 | if (fsp && fsp->cmd) |
| 817 | * Destroy the specified local port by finding and freeing all | 968 | return fsp->cmd->sc_data_direction == DMA_FROM_DEVICE; |
| 818 | * fc_rports associated with it and then by freeing the fc_lport | 969 | return false; |
| 819 | * itself. | 970 | } |
| 820 | */ | ||
| 821 | int fc_lport_destroy(struct fc_lport *lp); | ||
| 822 | |||
| 823 | /* | ||
| 824 | * Logout the specified local port from the fabric | ||
| 825 | */ | ||
| 826 | int fc_fabric_logoff(struct fc_lport *lp); | ||
| 827 | |||
| 828 | /* | ||
| 829 | * Initiate the LP state machine. This handler will use fc_host_attr | ||
| 830 | * to store the FLOGI service parameters, so fc_host_attr must be | ||
| 831 | * initialized before calling this handler. | ||
| 832 | */ | ||
| 833 | int fc_fabric_login(struct fc_lport *lp); | ||
| 834 | 971 | ||
| 835 | /* | 972 | /* |
| 836 | * The link is up for the given local port. | 973 | * LOCAL PORT LAYER |
| 837 | */ | 974 | *****************************/ |
| 975 | int fc_lport_init(struct fc_lport *); | ||
| 976 | int fc_lport_destroy(struct fc_lport *); | ||
| 977 | int fc_fabric_logoff(struct fc_lport *); | ||
| 978 | int fc_fabric_login(struct fc_lport *); | ||
| 979 | void __fc_linkup(struct fc_lport *); | ||
| 838 | void fc_linkup(struct fc_lport *); | 980 | void fc_linkup(struct fc_lport *); |
| 839 | 981 | void __fc_linkdown(struct fc_lport *); | |
| 840 | /* | ||
| 841 | * Link is down for the given local port. | ||
| 842 | */ | ||
| 843 | void fc_linkdown(struct fc_lport *); | 982 | void fc_linkdown(struct fc_lport *); |
| 844 | 983 | void fc_vport_setlink(struct fc_lport *); | |
| 845 | /* | 984 | void fc_vports_linkchange(struct fc_lport *); |
| 846 | * Configure the local port. | ||
| 847 | */ | ||
| 848 | int fc_lport_config(struct fc_lport *); | 985 | int fc_lport_config(struct fc_lport *); |
| 849 | |||
| 850 | /* | ||
| 851 | * Reset the local port. | ||
| 852 | */ | ||
| 853 | int fc_lport_reset(struct fc_lport *); | 986 | int fc_lport_reset(struct fc_lport *); |
| 854 | 987 | int fc_set_mfs(struct fc_lport *, u32 mfs); | |
| 855 | /* | 988 | struct fc_lport *libfc_vport_create(struct fc_vport *, int privsize); |
| 856 | * Set the mfs or reset | 989 | struct fc_lport *fc_vport_id_lookup(struct fc_lport *, u32 port_id); |
| 857 | */ | 990 | int fc_lport_bsg_request(struct fc_bsg_job *); |
| 858 | int fc_set_mfs(struct fc_lport *lp, u32 mfs); | ||
| 859 | |||
| 860 | 991 | ||
| 861 | /* | 992 | /* |
| 862 | * REMOTE PORT LAYER | 993 | * REMOTE PORT LAYER |
| 863 | *****************************/ | 994 | *****************************/ |
| 864 | int fc_rport_init(struct fc_lport *lp); | 995 | int fc_rport_init(struct fc_lport *); |
| 865 | void fc_rport_terminate_io(struct fc_rport *rp); | 996 | void fc_rport_terminate_io(struct fc_rport *); |
| 866 | 997 | ||
| 867 | /* | 998 | /* |
| 868 | * DISCOVERY LAYER | 999 | * DISCOVERY LAYER |
| 869 | *****************************/ | 1000 | *****************************/ |
| 870 | int fc_disc_init(struct fc_lport *lp); | 1001 | int fc_disc_init(struct fc_lport *); |
| 871 | |||
| 872 | 1002 | ||
| 873 | /* | 1003 | /* |
| 874 | * SCSI LAYER | 1004 | * FCP LAYER |
| 875 | *****************************/ | 1005 | *****************************/ |
| 876 | /* | ||
| 877 | * Initialize the SCSI block of libfc | ||
| 878 | */ | ||
| 879 | int fc_fcp_init(struct fc_lport *); | 1006 | int fc_fcp_init(struct fc_lport *); |
| 880 | |||
| 881 | /* | ||
| 882 | * This section provides an API which allows direct interaction | ||
| 883 | * with the SCSI-ml. Each of these functions satisfies a function | ||
| 884 | * pointer defined in Scsi_Host and therefore is always called | ||
| 885 | * directly from the SCSI-ml. | ||
| 886 | */ | ||
| 887 | int fc_queuecommand(struct scsi_cmnd *sc_cmd, | ||
| 888 | void (*done)(struct scsi_cmnd *)); | ||
| 889 | |||
| 890 | /* | ||
| 891 | * complete processing of a fcp packet | ||
| 892 | * | ||
| 893 | * This function may sleep if a fsp timer is pending. | ||
| 894 | * The host lock must not be held by caller. | ||
| 895 | */ | ||
| 896 | void fc_fcp_complete(struct fc_fcp_pkt *fsp); | ||
| 897 | |||
| 898 | /* | ||
| 899 | * Send an ABTS frame to the target device. The sc_cmd argument | ||
| 900 | * is a pointer to the SCSI command to be aborted. | ||
| 901 | */ | ||
| 902 | int fc_eh_abort(struct scsi_cmnd *sc_cmd); | ||
| 903 | |||
| 904 | /* | ||
| 905 | * Reset a LUN by sending send the tm cmd to the target. | ||
| 906 | */ | ||
| 907 | int fc_eh_device_reset(struct scsi_cmnd *sc_cmd); | ||
| 908 | |||
| 909 | /* | ||
| 910 | * Reset the host adapter. | ||
| 911 | */ | ||
| 912 | int fc_eh_host_reset(struct scsi_cmnd *sc_cmd); | ||
| 913 | |||
| 914 | /* | ||
| 915 | * Check rport status. | ||
| 916 | */ | ||
| 917 | int fc_slave_alloc(struct scsi_device *sdev); | ||
| 918 | |||
| 919 | /* | ||
| 920 | * Adjust the queue depth. | ||
| 921 | */ | ||
| 922 | int fc_change_queue_depth(struct scsi_device *sdev, int qdepth); | ||
| 923 | |||
| 924 | /* | ||
| 925 | * Change the tag type. | ||
| 926 | */ | ||
| 927 | int fc_change_queue_type(struct scsi_device *sdev, int tag_type); | ||
| 928 | |||
| 929 | /* | ||
| 930 | * Free memory pools used by the FCP layer. | ||
| 931 | */ | ||
| 932 | void fc_fcp_destroy(struct fc_lport *); | 1007 | void fc_fcp_destroy(struct fc_lport *); |
| 933 | 1008 | ||
| 934 | /* | 1009 | /* |
| 935 | * Set up direct-data placement for this I/O request | 1010 | * SCSI INTERACTION LAYER |
| 936 | */ | 1011 | *****************************/ |
| 937 | void fc_fcp_ddp_setup(struct fc_fcp_pkt *fsp, u16 xid); | 1012 | int fc_queuecommand(struct scsi_cmnd *, |
| 1013 | void (*done)(struct scsi_cmnd *)); | ||
| 1014 | int fc_eh_abort(struct scsi_cmnd *); | ||
| 1015 | int fc_eh_device_reset(struct scsi_cmnd *); | ||
| 1016 | int fc_eh_host_reset(struct scsi_cmnd *); | ||
| 1017 | int fc_slave_alloc(struct scsi_device *); | ||
| 1018 | int fc_change_queue_depth(struct scsi_device *, int qdepth, int reason); | ||
| 1019 | int fc_change_queue_type(struct scsi_device *, int tag_type); | ||
| 938 | 1020 | ||
| 939 | /* | 1021 | /* |
| 940 | * ELS/CT interface | 1022 | * ELS/CT interface |
| 941 | *****************************/ | 1023 | *****************************/ |
| 942 | /* | 1024 | int fc_elsct_init(struct fc_lport *); |
| 943 | * Initializes ELS/CT interface | 1025 | struct fc_seq *fc_elsct_send(struct fc_lport *, u32 did, |
| 944 | */ | 1026 | struct fc_frame *, |
| 945 | int fc_elsct_init(struct fc_lport *lp); | 1027 | unsigned int op, |
| 1028 | void (*resp)(struct fc_seq *, | ||
| 1029 | struct fc_frame *, | ||
| 1030 | void *arg), | ||
| 1031 | void *arg, u32 timer_msec); | ||
| 1032 | void fc_lport_flogi_resp(struct fc_seq *, struct fc_frame *, void *); | ||
| 1033 | void fc_lport_logo_resp(struct fc_seq *, struct fc_frame *, void *); | ||
| 946 | 1034 | ||
| 947 | 1035 | ||
| 948 | /* | 1036 | /* |
| 949 | * EXCHANGE MANAGER LAYER | 1037 | * EXCHANGE MANAGER LAYER |
| 950 | *****************************/ | 1038 | *****************************/ |
| 951 | /* | 1039 | int fc_exch_init(struct fc_lport *); |
| 952 | * Initializes Exchange Manager related | 1040 | struct fc_exch_mgr_anchor *fc_exch_mgr_add(struct fc_lport *, |
| 953 | * function pointers in struct libfc_function_template. | 1041 | struct fc_exch_mgr *, |
| 954 | */ | ||
| 955 | int fc_exch_init(struct fc_lport *lp); | ||
| 956 | |||
| 957 | /* | ||
| 958 | * Adds Exchange Manager (EM) mp to lport. | ||
| 959 | * | ||
| 960 | * Adds specified mp to lport using struct fc_exch_mgr_anchor, | ||
| 961 | * the struct fc_exch_mgr_anchor allows same EM sharing by | ||
| 962 | * more than one lport with their specified match function, | ||
| 963 | * the match function is used in allocating exchange from | ||
| 964 | * added mp. | ||
| 965 | */ | ||
| 966 | struct fc_exch_mgr_anchor *fc_exch_mgr_add(struct fc_lport *lport, | ||
| 967 | struct fc_exch_mgr *mp, | ||
| 968 | bool (*match)(struct fc_frame *)); | 1042 | bool (*match)(struct fc_frame *)); |
| 969 | 1043 | void fc_exch_mgr_del(struct fc_exch_mgr_anchor *); | |
| 970 | /* | 1044 | int fc_exch_mgr_list_clone(struct fc_lport *src, struct fc_lport *dst); |
| 971 | * Deletes Exchange Manager (EM) from lport by removing | 1045 | struct fc_exch_mgr *fc_exch_mgr_alloc(struct fc_lport *, enum fc_class class, |
| 972 | * its anchor ema from lport. | 1046 | u16 min_xid, u16 max_xid, |
| 973 | * | ||
| 974 | * If removed anchor ema was the last user of its associated EM | ||
| 975 | * then also destroys associated EM. | ||
| 976 | */ | ||
| 977 | void fc_exch_mgr_del(struct fc_exch_mgr_anchor *ema); | ||
| 978 | |||
| 979 | /* | ||
| 980 | * Allocates an Exchange Manager (EM). | ||
| 981 | * | ||
| 982 | * The EM manages exchanges for their allocation and | ||
| 983 | * free, also allows exchange lookup for received | ||
| 984 | * frame. | ||
| 985 | * | ||
| 986 | * The class is used for initializing FC class of | ||
| 987 | * allocated exchange from EM. | ||
| 988 | * | ||
| 989 | * The min_xid and max_xid will limit new | ||
| 990 | * exchange ID (XID) within this range for | ||
| 991 | * a new exchange. | ||
| 992 | * The LLD may choose to have multiple EMs, | ||
| 993 | * e.g. one EM instance per CPU receive thread in LLD. | ||
| 994 | * | ||
| 995 | * Specified match function is used in allocating exchanges | ||
| 996 | * from newly allocated EM. | ||
| 997 | */ | ||
| 998 | struct fc_exch_mgr *fc_exch_mgr_alloc(struct fc_lport *lp, | ||
| 999 | enum fc_class class, | ||
| 1000 | u16 min_xid, | ||
| 1001 | u16 max_xid, | ||
| 1002 | bool (*match)(struct fc_frame *)); | 1047 | bool (*match)(struct fc_frame *)); |
| 1003 | 1048 | void fc_exch_mgr_free(struct fc_lport *); | |
| 1004 | /* | 1049 | void fc_exch_recv(struct fc_lport *, struct fc_frame *); |
| 1005 | * Free all exchange managers of a lport. | ||
| 1006 | */ | ||
| 1007 | void fc_exch_mgr_free(struct fc_lport *lport); | ||
| 1008 | |||
| 1009 | /* | ||
| 1010 | * Receive a frame on specified local port and exchange manager. | ||
| 1011 | */ | ||
| 1012 | void fc_exch_recv(struct fc_lport *lp, struct fc_frame *fp); | ||
| 1013 | |||
| 1014 | /* | ||
| 1015 | * This function is for exch_seq_send function pointer in | ||
| 1016 | * struct libfc_function_template, see comment block on | ||
| 1017 | * exch_seq_send for description of this function. | ||
| 1018 | */ | ||
| 1019 | struct fc_seq *fc_exch_seq_send(struct fc_lport *lp, | ||
| 1020 | struct fc_frame *fp, | ||
| 1021 | void (*resp)(struct fc_seq *sp, | ||
| 1022 | struct fc_frame *fp, | ||
| 1023 | void *arg), | ||
| 1024 | void (*destructor)(struct fc_seq *sp, | ||
| 1025 | void *arg), | ||
| 1026 | void *arg, u32 timer_msec); | ||
| 1027 | |||
| 1028 | /* | ||
| 1029 | * send a frame using existing sequence and exchange. | ||
| 1030 | */ | ||
| 1031 | int fc_seq_send(struct fc_lport *lp, struct fc_seq *sp, struct fc_frame *fp); | ||
| 1032 | |||
| 1033 | /* | ||
| 1034 | * Send ELS response using mainly infomation | ||
| 1035 | * in exchange and sequence in EM layer. | ||
| 1036 | */ | ||
| 1037 | void fc_seq_els_rsp_send(struct fc_seq *sp, enum fc_els_cmd els_cmd, | ||
| 1038 | struct fc_seq_els_data *els_data); | ||
| 1039 | |||
| 1040 | /* | ||
| 1041 | * This function is for seq_exch_abort function pointer in | ||
| 1042 | * struct libfc_function_template, see comment block on | ||
| 1043 | * seq_exch_abort for description of this function. | ||
| 1044 | */ | ||
| 1045 | int fc_seq_exch_abort(const struct fc_seq *req_sp, unsigned int timer_msec); | ||
| 1046 | |||
| 1047 | /* | ||
| 1048 | * Indicate that an exchange/sequence tuple is complete and the memory | ||
| 1049 | * allocated for the related objects may be freed. | ||
| 1050 | */ | ||
| 1051 | void fc_exch_done(struct fc_seq *sp); | ||
| 1052 | |||
| 1053 | /* | ||
| 1054 | * Allocate a new exchange and sequence pair. | ||
| 1055 | */ | ||
| 1056 | struct fc_exch *fc_exch_alloc(struct fc_lport *lport, struct fc_frame *fp); | ||
| 1057 | /* | ||
| 1058 | * Start a new sequence on the same exchange as the supplied sequence. | ||
| 1059 | */ | ||
| 1060 | struct fc_seq *fc_seq_start_next(struct fc_seq *sp); | ||
| 1061 | |||
| 1062 | |||
| 1063 | /* | ||
| 1064 | * Reset all EMs of a lport, releasing its all sequences and | ||
| 1065 | * exchanges. If sid is non-zero, then reset only exchanges | ||
| 1066 | * we sourced from that FID. If did is non-zero, reset only | ||
| 1067 | * exchanges destined to that FID. | ||
| 1068 | */ | ||
| 1069 | void fc_exch_mgr_reset(struct fc_lport *, u32 s_id, u32 d_id); | 1050 | void fc_exch_mgr_reset(struct fc_lport *, u32 s_id, u32 d_id); |
| 1070 | 1051 | ||
| 1071 | /* | 1052 | /* |
| 1072 | * Functions for fc_functions_template | 1053 | * Functions for fc_functions_template |
| 1073 | */ | 1054 | */ |
| 1074 | void fc_get_host_speed(struct Scsi_Host *shost); | 1055 | void fc_get_host_speed(struct Scsi_Host *); |
| 1075 | void fc_get_host_port_type(struct Scsi_Host *shost); | 1056 | void fc_get_host_port_type(struct Scsi_Host *); |
| 1076 | void fc_get_host_port_state(struct Scsi_Host *shost); | 1057 | void fc_get_host_port_state(struct Scsi_Host *); |
| 1077 | void fc_set_rport_loss_tmo(struct fc_rport *rport, u32 timeout); | 1058 | void fc_set_rport_loss_tmo(struct fc_rport *, u32 timeout); |
| 1078 | struct fc_host_statistics *fc_get_host_stats(struct Scsi_Host *); | 1059 | struct fc_host_statistics *fc_get_host_stats(struct Scsi_Host *); |
| 1079 | 1060 | ||
| 1080 | /* | ||
| 1081 | * module setup functions. | ||
| 1082 | */ | ||
| 1083 | int fc_setup_exch_mgr(void); | ||
| 1084 | void fc_destroy_exch_mgr(void); | ||
| 1085 | int fc_setup_rport(void); | ||
| 1086 | void fc_destroy_rport(void); | ||
| 1087 | |||
| 1088 | /* | ||
| 1089 | * Internal libfc functions. | ||
| 1090 | */ | ||
| 1091 | const char *fc_els_resp_type(struct fc_frame *); | ||
| 1092 | |||
| 1093 | #endif /* _LIBFC_H_ */ | 1061 | #endif /* _LIBFC_H_ */ |
diff --git a/include/scsi/libfcoe.h b/include/scsi/libfcoe.h index b2410605b740..c603f4a7e7fc 100644 --- a/include/scsi/libfcoe.h +++ b/include/scsi/libfcoe.h | |||
| @@ -53,33 +53,36 @@ enum fip_state { | |||
| 53 | }; | 53 | }; |
| 54 | 54 | ||
| 55 | /** | 55 | /** |
| 56 | * struct fcoe_ctlr - FCoE Controller and FIP state. | 56 | * struct fcoe_ctlr - FCoE Controller and FIP state |
| 57 | * @state: internal FIP state for network link and FIP or non-FIP mode. | 57 | * @state: internal FIP state for network link and FIP or non-FIP mode. |
| 58 | * @lp: &fc_lport: libfc local port. | 58 | * @mode: LLD-selected mode. |
| 59 | * @sel_fcf: currently selected FCF, or NULL. | 59 | * @lp: &fc_lport: libfc local port. |
| 60 | * @fcfs: list of discovered FCFs. | 60 | * @sel_fcf: currently selected FCF, or NULL. |
| 61 | * @fcf_count: number of discovered FCF entries. | 61 | * @fcfs: list of discovered FCFs. |
| 62 | * @sol_time: time when a multicast solicitation was last sent. | 62 | * @fcf_count: number of discovered FCF entries. |
| 63 | * @sel_time: time after which to select an FCF. | 63 | * @sol_time: time when a multicast solicitation was last sent. |
| 64 | * @port_ka_time: time of next port keep-alive. | 64 | * @sel_time: time after which to select an FCF. |
| 65 | * @ctlr_ka_time: time of next controller keep-alive. | 65 | * @port_ka_time: time of next port keep-alive. |
| 66 | * @timer: timer struct used for all delayed events. | 66 | * @ctlr_ka_time: time of next controller keep-alive. |
| 67 | * @link_work: &work_struct for doing FCF selection. | 67 | * @timer: timer struct used for all delayed events. |
| 68 | * @recv_work: &work_struct for receiving FIP frames. | 68 | * @link_work: &work_struct for doing FCF selection. |
| 69 | * @recv_work: &work_struct for receiving FIP frames. | ||
| 69 | * @fip_recv_list: list of received FIP frames. | 70 | * @fip_recv_list: list of received FIP frames. |
| 70 | * @user_mfs: configured maximum FC frame size, including FC header. | 71 | * @user_mfs: configured maximum FC frame size, including FC header. |
| 71 | * @flogi_oxid: exchange ID of most recent fabric login. | 72 | * @flogi_oxid: exchange ID of most recent fabric login. |
| 72 | * @flogi_count: number of FLOGI attempts in AUTO mode. | 73 | * @flogi_count: number of FLOGI attempts in AUTO mode. |
| 73 | * @link: current link status for libfc. | 74 | * @link: current link status for libfc. |
| 74 | * @last_link: last link state reported to libfc. | 75 | * @last_link: last link state reported to libfc. |
| 75 | * @map_dest: use the FC_MAP mode for destination MAC addresses. | 76 | * @map_dest: use the FC_MAP mode for destination MAC addresses. |
| 76 | * @spma: supports SPMA server-provided MACs mode | 77 | * @spma: supports SPMA server-provided MACs mode |
| 77 | * @dest_addr: MAC address of the selected FC forwarder. | 78 | * @send_ctlr_ka: need to send controller keep alive |
| 78 | * @ctl_src_addr: the native MAC address of our local port. | 79 | * @send_port_ka: need to send port keep alives |
| 79 | * @data_src_addr: the assigned MAC address for the local port after FLOGI. | 80 | * @dest_addr: MAC address of the selected FC forwarder. |
| 80 | * @send: LLD-supplied function to handle sending of FIP Ethernet frames. | 81 | * @ctl_src_addr: the native MAC address of our local port. |
| 81 | * @update_mac: LLD-supplied function to handle changes to MAC addresses. | 82 | * @send: LLD-supplied function to handle sending FIP Ethernet frames |
| 82 | * @lock: lock protecting this structure. | 83 | * @update_mac: LLD-supplied function to handle changes to MAC addresses. |
| 84 | * @get_src_addr: LLD-supplied function to supply a source MAC address. | ||
| 85 | * @lock: lock protecting this structure. | ||
| 83 | * | 86 | * |
| 84 | * This structure is used by all FCoE drivers. It contains information | 87 | * This structure is used by all FCoE drivers. It contains information |
| 85 | * needed by all FCoE low-level drivers (LLDs) as well as internal state | 88 | * needed by all FCoE low-level drivers (LLDs) as well as internal state |
| @@ -87,6 +90,7 @@ enum fip_state { | |||
| 87 | */ | 90 | */ |
| 88 | struct fcoe_ctlr { | 91 | struct fcoe_ctlr { |
| 89 | enum fip_state state; | 92 | enum fip_state state; |
| 93 | enum fip_state mode; | ||
| 90 | struct fc_lport *lp; | 94 | struct fc_lport *lp; |
| 91 | struct fcoe_fcf *sel_fcf; | 95 | struct fcoe_fcf *sel_fcf; |
| 92 | struct list_head fcfs; | 96 | struct list_head fcfs; |
| @@ -104,29 +108,32 @@ struct fcoe_ctlr { | |||
| 104 | u8 flogi_count; | 108 | u8 flogi_count; |
| 105 | u8 link; | 109 | u8 link; |
| 106 | u8 last_link; | 110 | u8 last_link; |
| 111 | u8 reset_req; | ||
| 107 | u8 map_dest; | 112 | u8 map_dest; |
| 108 | u8 spma; | 113 | u8 spma; |
| 114 | u8 send_ctlr_ka; | ||
| 115 | u8 send_port_ka; | ||
| 109 | u8 dest_addr[ETH_ALEN]; | 116 | u8 dest_addr[ETH_ALEN]; |
| 110 | u8 ctl_src_addr[ETH_ALEN]; | 117 | u8 ctl_src_addr[ETH_ALEN]; |
| 111 | u8 data_src_addr[ETH_ALEN]; | ||
| 112 | 118 | ||
| 113 | void (*send)(struct fcoe_ctlr *, struct sk_buff *); | 119 | void (*send)(struct fcoe_ctlr *, struct sk_buff *); |
| 114 | void (*update_mac)(struct fcoe_ctlr *, u8 *old, u8 *new); | 120 | void (*update_mac)(struct fc_lport *, u8 *addr); |
| 121 | u8 * (*get_src_addr)(struct fc_lport *); | ||
| 115 | spinlock_t lock; | 122 | spinlock_t lock; |
| 116 | }; | 123 | }; |
| 117 | 124 | ||
| 118 | /* | 125 | /** |
| 119 | * struct fcoe_fcf - Fibre-Channel Forwarder. | 126 | * struct fcoe_fcf - Fibre-Channel Forwarder |
| 120 | * @list: list linkage. | 127 | * @list: list linkage |
| 121 | * @time: system time (jiffies) when an advertisement was last received. | 128 | * @time: system time (jiffies) when an advertisement was last received |
| 122 | * @switch_name: WWN of switch from advertisement. | 129 | * @switch_name: WWN of switch from advertisement |
| 123 | * @fabric_name: WWN of fabric from advertisement. | 130 | * @fabric_name: WWN of fabric from advertisement |
| 124 | * @fc_map: FC_MAP value from advertisement. | 131 | * @fc_map: FC_MAP value from advertisement |
| 125 | * @fcf_mac: Ethernet address of the FCF. | 132 | * @fcf_mac: Ethernet address of the FCF |
| 126 | * @vfid: virtual fabric ID. | 133 | * @vfid: virtual fabric ID |
| 127 | * @pri: seletion priority, smaller values are better. | 134 | * @pri: selection priority, smaller values are better |
| 128 | * @flags: flags received from advertisement. | 135 | * @flags: flags received from advertisement |
| 129 | * @fka_period: keep-alive period, in jiffies. | 136 | * @fka_period: keep-alive period, in jiffies |
| 130 | * | 137 | * |
| 131 | * A Fibre-Channel Forwarder (FCF) is the entity on the Ethernet that | 138 | * A Fibre-Channel Forwarder (FCF) is the entity on the Ethernet that |
| 132 | * passes FCoE frames on to an FC fabric. This structure represents | 139 | * passes FCoE frames on to an FC fabric. This structure represents |
| @@ -148,6 +155,7 @@ struct fcoe_fcf { | |||
| 148 | u8 pri; | 155 | u8 pri; |
| 149 | u16 flags; | 156 | u16 flags; |
| 150 | u32 fka_period; | 157 | u32 fka_period; |
| 158 | u8 fd_flags:1; | ||
| 151 | }; | 159 | }; |
| 152 | 160 | ||
| 153 | /* FIP API functions */ | 161 | /* FIP API functions */ |
| @@ -155,9 +163,10 @@ void fcoe_ctlr_init(struct fcoe_ctlr *); | |||
| 155 | void fcoe_ctlr_destroy(struct fcoe_ctlr *); | 163 | void fcoe_ctlr_destroy(struct fcoe_ctlr *); |
| 156 | void fcoe_ctlr_link_up(struct fcoe_ctlr *); | 164 | void fcoe_ctlr_link_up(struct fcoe_ctlr *); |
| 157 | int fcoe_ctlr_link_down(struct fcoe_ctlr *); | 165 | int fcoe_ctlr_link_down(struct fcoe_ctlr *); |
| 158 | int fcoe_ctlr_els_send(struct fcoe_ctlr *, struct sk_buff *); | 166 | int fcoe_ctlr_els_send(struct fcoe_ctlr *, struct fc_lport *, struct sk_buff *); |
| 159 | void fcoe_ctlr_recv(struct fcoe_ctlr *, struct sk_buff *); | 167 | void fcoe_ctlr_recv(struct fcoe_ctlr *, struct sk_buff *); |
| 160 | int fcoe_ctlr_recv_flogi(struct fcoe_ctlr *, struct fc_frame *fp, u8 *sa); | 168 | int fcoe_ctlr_recv_flogi(struct fcoe_ctlr *, struct fc_lport *, |
| 169 | struct fc_frame *); | ||
| 161 | 170 | ||
| 162 | /* libfcoe funcs */ | 171 | /* libfcoe funcs */ |
| 163 | u64 fcoe_wwn_from_mac(unsigned char mac[], unsigned int, unsigned int); | 172 | u64 fcoe_wwn_from_mac(unsigned char mac[], unsigned int, unsigned int); |
diff --git a/include/scsi/libiscsi.h b/include/scsi/libiscsi.h index a72edd4eceec..ae5196aae1a5 100644 --- a/include/scsi/libiscsi.h +++ b/include/scsi/libiscsi.h | |||
| @@ -28,6 +28,7 @@ | |||
| 28 | #include <linux/mutex.h> | 28 | #include <linux/mutex.h> |
| 29 | #include <linux/timer.h> | 29 | #include <linux/timer.h> |
| 30 | #include <linux/workqueue.h> | 30 | #include <linux/workqueue.h> |
| 31 | #include <linux/kfifo.h> | ||
| 31 | #include <scsi/iscsi_proto.h> | 32 | #include <scsi/iscsi_proto.h> |
| 32 | #include <scsi/iscsi_if.h> | 33 | #include <scsi/iscsi_if.h> |
| 33 | #include <scsi/scsi_transport_iscsi.h> | 34 | #include <scsi/scsi_transport_iscsi.h> |
| @@ -231,7 +232,7 @@ struct iscsi_conn { | |||
| 231 | }; | 232 | }; |
| 232 | 233 | ||
| 233 | struct iscsi_pool { | 234 | struct iscsi_pool { |
| 234 | struct kfifo *queue; /* FIFO Queue */ | 235 | struct kfifo queue; /* FIFO Queue */ |
| 235 | void **pool; /* Pool of elements */ | 236 | void **pool; /* Pool of elements */ |
| 236 | int max; /* Max number of elements */ | 237 | int max; /* Max number of elements */ |
| 237 | }; | 238 | }; |
| @@ -267,6 +268,7 @@ struct iscsi_session { | |||
| 267 | /* configuration */ | 268 | /* configuration */ |
| 268 | int abort_timeout; | 269 | int abort_timeout; |
| 269 | int lu_reset_timeout; | 270 | int lu_reset_timeout; |
| 271 | int tgt_reset_timeout; | ||
| 270 | int initial_r2t_en; | 272 | int initial_r2t_en; |
| 271 | unsigned max_r2t; | 273 | unsigned max_r2t; |
| 272 | int imm_data_en; | 274 | int imm_data_en; |
| @@ -333,9 +335,11 @@ struct iscsi_host { | |||
| 333 | /* | 335 | /* |
| 334 | * scsi host template | 336 | * scsi host template |
| 335 | */ | 337 | */ |
| 336 | extern int iscsi_change_queue_depth(struct scsi_device *sdev, int depth); | 338 | extern int iscsi_change_queue_depth(struct scsi_device *sdev, int depth, |
| 339 | int reason); | ||
| 337 | extern int iscsi_eh_abort(struct scsi_cmnd *sc); | 340 | extern int iscsi_eh_abort(struct scsi_cmnd *sc); |
| 338 | extern int iscsi_eh_target_reset(struct scsi_cmnd *sc); | 341 | extern int iscsi_eh_recover_target(struct scsi_cmnd *sc); |
| 342 | extern int iscsi_eh_session_reset(struct scsi_cmnd *sc); | ||
| 339 | extern int iscsi_eh_device_reset(struct scsi_cmnd *sc); | 343 | extern int iscsi_eh_device_reset(struct scsi_cmnd *sc); |
| 340 | extern int iscsi_queuecommand(struct scsi_cmnd *sc, | 344 | extern int iscsi_queuecommand(struct scsi_cmnd *sc, |
| 341 | void (*done)(struct scsi_cmnd *)); | 345 | void (*done)(struct scsi_cmnd *)); |
diff --git a/include/scsi/libiscsi_tcp.h b/include/scsi/libiscsi_tcp.h index 9e3182e659db..741ae7ed4394 100644 --- a/include/scsi/libiscsi_tcp.h +++ b/include/scsi/libiscsi_tcp.h | |||
| @@ -80,7 +80,7 @@ struct iscsi_tcp_task { | |||
| 80 | int data_offset; | 80 | int data_offset; |
| 81 | struct iscsi_r2t_info *r2t; /* in progress solict R2T */ | 81 | struct iscsi_r2t_info *r2t; /* in progress solict R2T */ |
| 82 | struct iscsi_pool r2tpool; | 82 | struct iscsi_pool r2tpool; |
| 83 | struct kfifo *r2tqueue; | 83 | struct kfifo r2tqueue; |
| 84 | void *dd_data; | 84 | void *dd_data; |
| 85 | }; | 85 | }; |
| 86 | 86 | ||
diff --git a/include/scsi/libsas.h b/include/scsi/libsas.h index e78d3b62d8ec..3b586859669c 100644 --- a/include/scsi/libsas.h +++ b/include/scsi/libsas.h | |||
| @@ -36,6 +36,7 @@ | |||
| 36 | #include <scsi/scsi_cmnd.h> | 36 | #include <scsi/scsi_cmnd.h> |
| 37 | #include <scsi/scsi_transport_sas.h> | 37 | #include <scsi/scsi_transport_sas.h> |
| 38 | #include <linux/scatterlist.h> | 38 | #include <linux/scatterlist.h> |
| 39 | #include <linux/slab.h> | ||
| 39 | 40 | ||
| 40 | struct block_device; | 41 | struct block_device; |
| 41 | 42 | ||
| @@ -634,7 +635,8 @@ extern int sas_target_alloc(struct scsi_target *); | |||
| 634 | extern int sas_slave_alloc(struct scsi_device *); | 635 | extern int sas_slave_alloc(struct scsi_device *); |
| 635 | extern int sas_slave_configure(struct scsi_device *); | 636 | extern int sas_slave_configure(struct scsi_device *); |
| 636 | extern void sas_slave_destroy(struct scsi_device *); | 637 | extern void sas_slave_destroy(struct scsi_device *); |
| 637 | extern int sas_change_queue_depth(struct scsi_device *, int new_depth); | 638 | extern int sas_change_queue_depth(struct scsi_device *, int new_depth, |
| 639 | int reason); | ||
| 638 | extern int sas_change_queue_type(struct scsi_device *, int qt); | 640 | extern int sas_change_queue_type(struct scsi_device *, int qt); |
| 639 | extern int sas_bios_param(struct scsi_device *, | 641 | extern int sas_bios_param(struct scsi_device *, |
| 640 | struct block_device *, | 642 | struct block_device *, |
diff --git a/include/scsi/libsrp.h b/include/scsi/libsrp.h index ba615e4c1d7c..f4105c91af53 100644 --- a/include/scsi/libsrp.h +++ b/include/scsi/libsrp.h | |||
| @@ -2,6 +2,7 @@ | |||
| 2 | #define __LIBSRP_H__ | 2 | #define __LIBSRP_H__ |
| 3 | 3 | ||
| 4 | #include <linux/list.h> | 4 | #include <linux/list.h> |
| 5 | #include <linux/kfifo.h> | ||
| 5 | #include <scsi/scsi_cmnd.h> | 6 | #include <scsi/scsi_cmnd.h> |
| 6 | #include <scsi/scsi_host.h> | 7 | #include <scsi/scsi_host.h> |
| 7 | #include <scsi/srp.h> | 8 | #include <scsi/srp.h> |
| @@ -21,7 +22,7 @@ struct srp_buf { | |||
| 21 | struct srp_queue { | 22 | struct srp_queue { |
| 22 | void *pool; | 23 | void *pool; |
| 23 | void *items; | 24 | void *items; |
| 24 | struct kfifo *queue; | 25 | struct kfifo queue; |
| 25 | spinlock_t lock; | 26 | spinlock_t lock; |
| 26 | }; | 27 | }; |
| 27 | 28 | ||
diff --git a/include/scsi/osd_initiator.h b/include/scsi/osd_initiator.h index 02bd9f716357..a8f370126632 100644 --- a/include/scsi/osd_initiator.h +++ b/include/scsi/osd_initiator.h | |||
| @@ -48,7 +48,6 @@ enum osd_std_version { | |||
| 48 | */ | 48 | */ |
| 49 | struct osd_dev { | 49 | struct osd_dev { |
| 50 | struct scsi_device *scsi_device; | 50 | struct scsi_device *scsi_device; |
| 51 | struct file *file; | ||
| 52 | unsigned def_timeout; | 51 | unsigned def_timeout; |
| 53 | 52 | ||
| 54 | #ifdef OSD_VER1_SUPPORT | 53 | #ifdef OSD_VER1_SUPPORT |
| @@ -56,10 +55,24 @@ struct osd_dev { | |||
| 56 | #endif | 55 | #endif |
| 57 | }; | 56 | }; |
| 58 | 57 | ||
| 59 | /* Retrieve/return osd_dev(s) for use by Kernel clients */ | 58 | /* Unique Identification of an OSD device */ |
| 60 | struct osd_dev *osduld_path_lookup(const char *dev_name); /*Use IS_ERR/ERR_PTR*/ | 59 | struct osd_dev_info { |
| 60 | unsigned systemid_len; | ||
| 61 | u8 systemid[OSD_SYSTEMID_LEN]; | ||
| 62 | unsigned osdname_len; | ||
| 63 | u8 *osdname; | ||
| 64 | }; | ||
| 65 | |||
| 66 | /* Retrieve/return osd_dev(s) for use by Kernel clients | ||
| 67 | * Use IS_ERR/ERR_PTR on returned "osd_dev *". | ||
| 68 | */ | ||
| 69 | struct osd_dev *osduld_path_lookup(const char *dev_name); | ||
| 70 | struct osd_dev *osduld_info_lookup(const struct osd_dev_info *odi); | ||
| 61 | void osduld_put_device(struct osd_dev *od); | 71 | void osduld_put_device(struct osd_dev *od); |
| 62 | 72 | ||
| 73 | const struct osd_dev_info *osduld_device_info(struct osd_dev *od); | ||
| 74 | bool osduld_device_same(struct osd_dev *od, const struct osd_dev_info *odi); | ||
| 75 | |||
| 63 | /* Add/remove test ioctls from external modules */ | 76 | /* Add/remove test ioctls from external modules */ |
| 64 | typedef int (do_test_fn)(struct osd_dev *od, unsigned cmd, unsigned long arg); | 77 | typedef int (do_test_fn)(struct osd_dev *od, unsigned cmd, unsigned long arg); |
| 65 | int osduld_register_test(unsigned ioctl, do_test_fn *do_test); | 78 | int osduld_register_test(unsigned ioctl, do_test_fn *do_test); |
| @@ -69,8 +82,24 @@ void osduld_unregister_test(unsigned ioctl); | |||
| 69 | void osd_dev_init(struct osd_dev *od, struct scsi_device *scsi_device); | 82 | void osd_dev_init(struct osd_dev *od, struct scsi_device *scsi_device); |
| 70 | void osd_dev_fini(struct osd_dev *od); | 83 | void osd_dev_fini(struct osd_dev *od); |
| 71 | 84 | ||
| 72 | /* some hi level device operations */ | 85 | /** |
| 73 | int osd_auto_detect_ver(struct osd_dev *od, void *caps); /* GFP_KERNEL */ | 86 | * osd_auto_detect_ver - Detect the OSD version, return Unique Identification |
| 87 | * | ||
| 88 | * @od: OSD target lun handle | ||
| 89 | * @caps: Capabilities authorizing OSD root read attributes access | ||
| 90 | * @odi: Retrieved information uniquely identifying the osd target lun | ||
| 91 | * Note: odi->osdname must be kfreed by caller. | ||
| 92 | * | ||
| 93 | * Auto detects the OSD version of the OSD target and sets the @od | ||
| 94 | * accordingly. Meanwhile also returns the "system id" and "osd name" root | ||
| 95 | * attributes which uniquely identify the OSD target. This member is usually | ||
| 96 | * called by the ULD. ULD users should call osduld_device_info(). | ||
| 97 | * This rutine allocates osd requests and memory at GFP_KERNEL level and might | ||
| 98 | * sleep. | ||
| 99 | */ | ||
| 100 | int osd_auto_detect_ver(struct osd_dev *od, | ||
| 101 | void *caps, struct osd_dev_info *odi); | ||
| 102 | |||
| 74 | static inline struct request_queue *osd_request_queue(struct osd_dev *od) | 103 | static inline struct request_queue *osd_request_queue(struct osd_dev *od) |
| 75 | { | 104 | { |
| 76 | return od->scsi_device->request_queue; | 105 | return od->scsi_device->request_queue; |
| @@ -84,6 +113,15 @@ static inline void osd_dev_set_ver(struct osd_dev *od, enum osd_std_version v) | |||
| 84 | #endif | 113 | #endif |
| 85 | } | 114 | } |
| 86 | 115 | ||
| 116 | static inline bool osd_dev_is_ver1(struct osd_dev *od) | ||
| 117 | { | ||
| 118 | #ifdef OSD_VER1_SUPPORT | ||
| 119 | return od->version == OSD_VER1; | ||
| 120 | #else | ||
| 121 | return false; | ||
| 122 | #endif | ||
| 123 | } | ||
| 124 | |||
| 87 | struct osd_request; | 125 | struct osd_request; |
| 88 | typedef void (osd_req_done_fn)(struct osd_request *or, void *private); | 126 | typedef void (osd_req_done_fn)(struct osd_request *or, void *private); |
| 89 | 127 | ||
| @@ -104,6 +142,7 @@ struct osd_request { | |||
| 104 | struct _osd_io_info { | 142 | struct _osd_io_info { |
| 105 | struct bio *bio; | 143 | struct bio *bio; |
| 106 | u64 total_bytes; | 144 | u64 total_bytes; |
| 145 | u64 residual; | ||
| 107 | struct request *req; | 146 | struct request *req; |
| 108 | struct _osd_req_data_segment *last_seg; | 147 | struct _osd_req_data_segment *last_seg; |
| 109 | u8 *pad_buff; | 148 | u8 *pad_buff; |
| @@ -112,22 +151,19 @@ struct osd_request { | |||
| 112 | gfp_t alloc_flags; | 151 | gfp_t alloc_flags; |
| 113 | unsigned timeout; | 152 | unsigned timeout; |
| 114 | unsigned retries; | 153 | unsigned retries; |
| 154 | unsigned sense_len; | ||
| 115 | u8 sense[OSD_MAX_SENSE_LEN]; | 155 | u8 sense[OSD_MAX_SENSE_LEN]; |
| 116 | enum osd_attributes_mode attributes_mode; | 156 | enum osd_attributes_mode attributes_mode; |
| 117 | 157 | ||
| 118 | osd_req_done_fn *async_done; | 158 | osd_req_done_fn *async_done; |
| 119 | void *async_private; | 159 | void *async_private; |
| 120 | int async_error; | 160 | int async_error; |
| 161 | int req_errors; | ||
| 121 | }; | 162 | }; |
| 122 | 163 | ||
| 123 | /* OSD Version control */ | ||
| 124 | static inline bool osd_req_is_ver1(struct osd_request *or) | 164 | static inline bool osd_req_is_ver1(struct osd_request *or) |
| 125 | { | 165 | { |
| 126 | #ifdef OSD_VER1_SUPPORT | 166 | return osd_dev_is_ver1(or->osd_dev); |
| 127 | return or->osd_dev->version == OSD_VER1; | ||
| 128 | #else | ||
| 129 | return false; | ||
| 130 | #endif | ||
| 131 | } | 167 | } |
| 132 | 168 | ||
| 133 | /* | 169 | /* |
| @@ -234,7 +270,7 @@ int osd_execute_request_async(struct osd_request *or, | |||
| 234 | * @bad_attr_list - List of failing attributes (optional) | 270 | * @bad_attr_list - List of failing attributes (optional) |
| 235 | * @max_attr - Size of @bad_attr_list. | 271 | * @max_attr - Size of @bad_attr_list. |
| 236 | * | 272 | * |
| 237 | * After execution, sense + return code can be analyzed using this function. The | 273 | * After execution, osd_request results are analyzed using this function. The |
| 238 | * return code is the final disposition on the error. So it is possible that a | 274 | * return code is the final disposition on the error. So it is possible that a |
| 239 | * CHECK_CONDITION was returned from target but this will return NO_ERROR, for | 275 | * CHECK_CONDITION was returned from target but this will return NO_ERROR, for |
| 240 | * example on recovered errors. All parameters are optional if caller does | 276 | * example on recovered errors. All parameters are optional if caller does |
| @@ -243,7 +279,29 @@ int osd_execute_request_async(struct osd_request *or, | |||
| 243 | * of the SCSI_OSD_DPRINT_SENSE Kconfig value. Set @silent if you know the | 279 | * of the SCSI_OSD_DPRINT_SENSE Kconfig value. Set @silent if you know the |
| 244 | * command would routinely fail, to not spam the dmsg file. | 280 | * command would routinely fail, to not spam the dmsg file. |
| 245 | */ | 281 | */ |
| 282 | |||
| 283 | /** | ||
| 284 | * osd_err_priority - osd categorized return codes in ascending severity. | ||
| 285 | * | ||
| 286 | * The categories are borrowed from the pnfs_osd_errno enum. | ||
| 287 | * See comments for translated Linux codes returned by osd_req_decode_sense. | ||
| 288 | */ | ||
| 289 | enum osd_err_priority { | ||
| 290 | OSD_ERR_PRI_NO_ERROR = 0, | ||
| 291 | /* Recoverable, caller should clear_highpage() all pages */ | ||
| 292 | OSD_ERR_PRI_CLEAR_PAGES = 1, /* -EFAULT */ | ||
| 293 | OSD_ERR_PRI_RESOURCE = 2, /* -ENOMEM */ | ||
| 294 | OSD_ERR_PRI_BAD_CRED = 3, /* -EINVAL */ | ||
| 295 | OSD_ERR_PRI_NO_ACCESS = 4, /* -EACCES */ | ||
| 296 | OSD_ERR_PRI_UNREACHABLE = 5, /* any other */ | ||
| 297 | OSD_ERR_PRI_NOT_FOUND = 6, /* -ENOENT */ | ||
| 298 | OSD_ERR_PRI_NO_SPACE = 7, /* -ENOSPC */ | ||
| 299 | OSD_ERR_PRI_EIO = 8, /* -EIO */ | ||
| 300 | }; | ||
| 301 | |||
| 246 | struct osd_sense_info { | 302 | struct osd_sense_info { |
| 303 | enum osd_err_priority osd_err_pri; | ||
| 304 | |||
| 247 | int key; /* one of enum scsi_sense_keys */ | 305 | int key; /* one of enum scsi_sense_keys */ |
| 248 | int additional_code ; /* enum osd_additional_sense_codes */ | 306 | int additional_code ; /* enum osd_additional_sense_codes */ |
| 249 | union { /* Sense specific information */ | 307 | union { /* Sense specific information */ |
diff --git a/include/scsi/osd_protocol.h b/include/scsi/osd_protocol.h index 2cc8e8b1cc19..685661283540 100644 --- a/include/scsi/osd_protocol.h +++ b/include/scsi/osd_protocol.h | |||
| @@ -17,6 +17,7 @@ | |||
| 17 | #define __OSD_PROTOCOL_H__ | 17 | #define __OSD_PROTOCOL_H__ |
| 18 | 18 | ||
| 19 | #include <linux/types.h> | 19 | #include <linux/types.h> |
| 20 | #include <linux/kernel.h> | ||
| 20 | #include <asm/unaligned.h> | 21 | #include <asm/unaligned.h> |
| 21 | #include <scsi/scsi.h> | 22 | #include <scsi/scsi.h> |
| 22 | 23 | ||
diff --git a/include/scsi/osd_sense.h b/include/scsi/osd_sense.h index ff9b33c773c7..91db543a5502 100644 --- a/include/scsi/osd_sense.h +++ b/include/scsi/osd_sense.h | |||
| @@ -255,6 +255,9 @@ enum osdv2_cdb_field_offset { | |||
| 255 | OSD_CFO_STARTING_BYTE = OSD_CDB_OFFSET(v2.start_address), | 255 | OSD_CFO_STARTING_BYTE = OSD_CDB_OFFSET(v2.start_address), |
| 256 | OSD_CFO_PARTITION_ID = OSD_CDB_OFFSET(partition), | 256 | OSD_CFO_PARTITION_ID = OSD_CDB_OFFSET(partition), |
| 257 | OSD_CFO_OBJECT_ID = OSD_CDB_OFFSET(object), | 257 | OSD_CFO_OBJECT_ID = OSD_CDB_OFFSET(object), |
| 258 | OSD_CFO_PERMISSIONS = sizeof(struct osd_cdb_head) + | ||
| 259 | offsetof(struct osd_capability_head, | ||
| 260 | permissions_bit_mask), | ||
| 258 | }; | 261 | }; |
| 259 | 262 | ||
| 260 | #endif /* ndef __OSD_SENSE_H__ */ | 263 | #endif /* ndef __OSD_SENSE_H__ */ |
diff --git a/include/scsi/scsi.h b/include/scsi/scsi.h index 34c46ab5c31b..8b4deca996ad 100644 --- a/include/scsi/scsi.h +++ b/include/scsi/scsi.h | |||
| @@ -94,6 +94,7 @@ struct scsi_cmnd; | |||
| 94 | #define WRITE_LONG 0x3f | 94 | #define WRITE_LONG 0x3f |
| 95 | #define CHANGE_DEFINITION 0x40 | 95 | #define CHANGE_DEFINITION 0x40 |
| 96 | #define WRITE_SAME 0x41 | 96 | #define WRITE_SAME 0x41 |
| 97 | #define UNMAP 0x42 | ||
| 97 | #define READ_TOC 0x43 | 98 | #define READ_TOC 0x43 |
| 98 | #define LOG_SELECT 0x4c | 99 | #define LOG_SELECT 0x4c |
| 99 | #define LOG_SENSE 0x4d | 100 | #define LOG_SENSE 0x4d |
| @@ -122,9 +123,11 @@ struct scsi_cmnd; | |||
| 122 | #define READ_16 0x88 | 123 | #define READ_16 0x88 |
| 123 | #define WRITE_16 0x8a | 124 | #define WRITE_16 0x8a |
| 124 | #define VERIFY_16 0x8f | 125 | #define VERIFY_16 0x8f |
| 126 | #define WRITE_SAME_16 0x93 | ||
| 125 | #define SERVICE_ACTION_IN 0x9e | 127 | #define SERVICE_ACTION_IN 0x9e |
| 126 | /* values for service action in */ | 128 | /* values for service action in */ |
| 127 | #define SAI_READ_CAPACITY_16 0x10 | 129 | #define SAI_READ_CAPACITY_16 0x10 |
| 130 | #define SAI_GET_LBA_STATUS 0x12 | ||
| 128 | /* values for maintenance in */ | 131 | /* values for maintenance in */ |
| 129 | #define MI_REPORT_TARGET_PGS 0x0a | 132 | #define MI_REPORT_TARGET_PGS 0x0a |
| 130 | /* values for maintenance out */ | 133 | /* values for maintenance out */ |
| @@ -132,6 +135,7 @@ struct scsi_cmnd; | |||
| 132 | /* values for variable length command */ | 135 | /* values for variable length command */ |
| 133 | #define READ_32 0x09 | 136 | #define READ_32 0x09 |
| 134 | #define WRITE_32 0x0b | 137 | #define WRITE_32 0x0b |
| 138 | #define WRITE_SAME_32 0x0d | ||
| 135 | 139 | ||
| 136 | /* Values for T10/04-262r7 */ | 140 | /* Values for T10/04-262r7 */ |
| 137 | #define ATA_16 0x85 /* 16-byte pass-thru */ | 141 | #define ATA_16 0x85 /* 16-byte pass-thru */ |
diff --git a/include/scsi/scsi_bsg_fc.h b/include/scsi/scsi_bsg_fc.h index a4b233318179..91a4e4ff9a9b 100644 --- a/include/scsi/scsi_bsg_fc.h +++ b/include/scsi/scsi_bsg_fc.h | |||
| @@ -292,7 +292,7 @@ struct fc_bsg_request { | |||
| 292 | struct fc_bsg_rport_els r_els; | 292 | struct fc_bsg_rport_els r_els; |
| 293 | struct fc_bsg_rport_ct r_ct; | 293 | struct fc_bsg_rport_ct r_ct; |
| 294 | } rqst_data; | 294 | } rqst_data; |
| 295 | }; | 295 | } __attribute__((packed)); |
| 296 | 296 | ||
| 297 | 297 | ||
| 298 | /* response (request sense data) structure of the sg_io_v4 */ | 298 | /* response (request sense data) structure of the sg_io_v4 */ |
diff --git a/include/scsi/scsi_device.h b/include/scsi/scsi_device.h index f097ae340bc1..d80b6dbed1ca 100644 --- a/include/scsi/scsi_device.h +++ b/include/scsi/scsi_device.h | |||
| @@ -81,11 +81,14 @@ struct scsi_device { | |||
| 81 | struct list_head starved_entry; | 81 | struct list_head starved_entry; |
| 82 | struct scsi_cmnd *current_cmnd; /* currently active command */ | 82 | struct scsi_cmnd *current_cmnd; /* currently active command */ |
| 83 | unsigned short queue_depth; /* How deep of a queue we want */ | 83 | unsigned short queue_depth; /* How deep of a queue we want */ |
| 84 | unsigned short max_queue_depth; /* max queue depth */ | ||
| 84 | unsigned short last_queue_full_depth; /* These two are used by */ | 85 | unsigned short last_queue_full_depth; /* These two are used by */ |
| 85 | unsigned short last_queue_full_count; /* scsi_track_queue_full() */ | 86 | unsigned short last_queue_full_count; /* scsi_track_queue_full() */ |
| 86 | unsigned long last_queue_full_time;/* don't let QUEUE_FULLs on the same | 87 | unsigned long last_queue_full_time; /* last queue full time */ |
| 87 | jiffie count on our counter, they | 88 | unsigned long queue_ramp_up_period; /* ramp up period in jiffies */ |
| 88 | could all be from the same event. */ | 89 | #define SCSI_DEFAULT_RAMP_UP_PERIOD (120 * HZ) |
| 90 | |||
| 91 | unsigned long last_queue_ramp_up; /* last queue ramp up time */ | ||
| 89 | 92 | ||
| 90 | unsigned int id, lun, channel; | 93 | unsigned int id, lun, channel; |
| 91 | 94 | ||
| @@ -175,6 +178,7 @@ struct scsi_dh_devlist { | |||
| 175 | char *model; | 178 | char *model; |
| 176 | }; | 179 | }; |
| 177 | 180 | ||
| 181 | typedef void (*activate_complete)(void *, int); | ||
| 178 | struct scsi_device_handler { | 182 | struct scsi_device_handler { |
| 179 | /* Used by the infrastructure */ | 183 | /* Used by the infrastructure */ |
| 180 | struct list_head list; /* list of scsi_device_handlers */ | 184 | struct list_head list; /* list of scsi_device_handlers */ |
| @@ -186,7 +190,7 @@ struct scsi_device_handler { | |||
| 186 | int (*check_sense)(struct scsi_device *, struct scsi_sense_hdr *); | 190 | int (*check_sense)(struct scsi_device *, struct scsi_sense_hdr *); |
| 187 | int (*attach)(struct scsi_device *); | 191 | int (*attach)(struct scsi_device *); |
| 188 | void (*detach)(struct scsi_device *); | 192 | void (*detach)(struct scsi_device *); |
| 189 | int (*activate)(struct scsi_device *); | 193 | int (*activate)(struct scsi_device *, activate_complete, void *); |
| 190 | int (*prep_fn)(struct scsi_device *, struct request *); | 194 | int (*prep_fn)(struct scsi_device *, struct request *); |
| 191 | int (*set_params)(struct scsi_device *, const char *); | 195 | int (*set_params)(struct scsi_device *, const char *); |
| 192 | }; | 196 | }; |
| @@ -344,7 +348,8 @@ extern int scsi_mode_select(struct scsi_device *sdev, int pf, int sp, | |||
| 344 | struct scsi_sense_hdr *); | 348 | struct scsi_sense_hdr *); |
| 345 | extern int scsi_test_unit_ready(struct scsi_device *sdev, int timeout, | 349 | extern int scsi_test_unit_ready(struct scsi_device *sdev, int timeout, |
| 346 | int retries, struct scsi_sense_hdr *sshdr); | 350 | int retries, struct scsi_sense_hdr *sshdr); |
| 347 | extern unsigned char *scsi_get_vpd_page(struct scsi_device *, u8 page); | 351 | extern int scsi_get_vpd_page(struct scsi_device *, u8 page, unsigned char *buf, |
| 352 | int buf_len); | ||
| 348 | extern int scsi_device_set_state(struct scsi_device *sdev, | 353 | extern int scsi_device_set_state(struct scsi_device *sdev, |
| 349 | enum scsi_device_state state); | 354 | enum scsi_device_state state); |
| 350 | extern struct scsi_event *sdev_evt_alloc(enum scsi_device_event evt_type, | 355 | extern struct scsi_event *sdev_evt_alloc(enum scsi_device_event evt_type, |
diff --git a/include/scsi/scsi_dh.h b/include/scsi/scsi_dh.h index ff2407405b42..e3f2db212ddc 100644 --- a/include/scsi/scsi_dh.h +++ b/include/scsi/scsi_dh.h | |||
| @@ -56,14 +56,16 @@ enum { | |||
| 56 | SCSI_DH_DRIVER_MAX, | 56 | SCSI_DH_DRIVER_MAX, |
| 57 | }; | 57 | }; |
| 58 | #if defined(CONFIG_SCSI_DH) || defined(CONFIG_SCSI_DH_MODULE) | 58 | #if defined(CONFIG_SCSI_DH) || defined(CONFIG_SCSI_DH_MODULE) |
| 59 | extern int scsi_dh_activate(struct request_queue *); | 59 | extern int scsi_dh_activate(struct request_queue *, activate_complete, void *); |
| 60 | extern int scsi_dh_handler_exist(const char *); | 60 | extern int scsi_dh_handler_exist(const char *); |
| 61 | extern int scsi_dh_attach(struct request_queue *, const char *); | 61 | extern int scsi_dh_attach(struct request_queue *, const char *); |
| 62 | extern void scsi_dh_detach(struct request_queue *); | 62 | extern void scsi_dh_detach(struct request_queue *); |
| 63 | extern int scsi_dh_set_params(struct request_queue *, const char *); | 63 | extern int scsi_dh_set_params(struct request_queue *, const char *); |
| 64 | #else | 64 | #else |
| 65 | static inline int scsi_dh_activate(struct request_queue *req) | 65 | static inline int scsi_dh_activate(struct request_queue *req, |
| 66 | activate_complete fn, void *data) | ||
| 66 | { | 67 | { |
| 68 | fn(data, 0); | ||
| 67 | return 0; | 69 | return 0; |
| 68 | } | 70 | } |
| 69 | static inline int scsi_dh_handler_exist(const char *name) | 71 | static inline int scsi_dh_handler_exist(const char *name) |
diff --git a/include/scsi/scsi_host.h b/include/scsi/scsi_host.h index 47941fc5aba7..c50a97fc76f9 100644 --- a/include/scsi/scsi_host.h +++ b/include/scsi/scsi_host.h | |||
| @@ -43,6 +43,12 @@ struct blk_queue_tags; | |||
| 43 | #define DISABLE_CLUSTERING 0 | 43 | #define DISABLE_CLUSTERING 0 |
| 44 | #define ENABLE_CLUSTERING 1 | 44 | #define ENABLE_CLUSTERING 1 |
| 45 | 45 | ||
| 46 | enum { | ||
| 47 | SCSI_QDEPTH_DEFAULT, /* default requested change, e.g. from sysfs */ | ||
| 48 | SCSI_QDEPTH_QFULL, /* scsi-ml requested due to queue full */ | ||
| 49 | SCSI_QDEPTH_RAMP_UP, /* scsi-ml requested due to threshhold event */ | ||
| 50 | }; | ||
| 51 | |||
| 46 | struct scsi_host_template { | 52 | struct scsi_host_template { |
| 47 | struct module *module; | 53 | struct module *module; |
| 48 | const char *name; | 54 | const char *name; |
| @@ -294,7 +300,7 @@ struct scsi_host_template { | |||
| 294 | * | 300 | * |
| 295 | * Status: OPTIONAL | 301 | * Status: OPTIONAL |
| 296 | */ | 302 | */ |
| 297 | int (* change_queue_depth)(struct scsi_device *, int); | 303 | int (* change_queue_depth)(struct scsi_device *, int, int); |
| 298 | 304 | ||
| 299 | /* | 305 | /* |
| 300 | * Fill in this function to allow the changing of tag types | 306 | * Fill in this function to allow the changing of tag types |
| @@ -677,6 +683,12 @@ struct Scsi_Host { | |||
| 677 | void *shost_data; | 683 | void *shost_data; |
| 678 | 684 | ||
| 679 | /* | 685 | /* |
| 686 | * Points to the physical bus device we'd use to do DMA | ||
| 687 | * Needed just in case we have virtual hosts. | ||
| 688 | */ | ||
| 689 | struct device *dma_dev; | ||
| 690 | |||
| 691 | /* | ||
| 680 | * We should ensure that this is aligned, both for better performance | 692 | * We should ensure that this is aligned, both for better performance |
| 681 | * and also because some compilers (m68k) don't automatically force | 693 | * and also because some compilers (m68k) don't automatically force |
| 682 | * alignment to a long boundary. | 694 | * alignment to a long boundary. |
| @@ -720,7 +732,9 @@ extern int scsi_queue_work(struct Scsi_Host *, struct work_struct *); | |||
| 720 | extern void scsi_flush_work(struct Scsi_Host *); | 732 | extern void scsi_flush_work(struct Scsi_Host *); |
| 721 | 733 | ||
| 722 | extern struct Scsi_Host *scsi_host_alloc(struct scsi_host_template *, int); | 734 | extern struct Scsi_Host *scsi_host_alloc(struct scsi_host_template *, int); |
| 723 | extern int __must_check scsi_add_host(struct Scsi_Host *, struct device *); | 735 | extern int __must_check scsi_add_host_with_dma(struct Scsi_Host *, |
| 736 | struct device *, | ||
| 737 | struct device *); | ||
| 724 | extern void scsi_scan_host(struct Scsi_Host *); | 738 | extern void scsi_scan_host(struct Scsi_Host *); |
| 725 | extern void scsi_rescan_device(struct device *); | 739 | extern void scsi_rescan_device(struct device *); |
| 726 | extern void scsi_remove_host(struct Scsi_Host *); | 740 | extern void scsi_remove_host(struct Scsi_Host *); |
| @@ -731,6 +745,12 @@ extern const char *scsi_host_state_name(enum scsi_host_state); | |||
| 731 | 745 | ||
| 732 | extern u64 scsi_calculate_bounce_limit(struct Scsi_Host *); | 746 | extern u64 scsi_calculate_bounce_limit(struct Scsi_Host *); |
| 733 | 747 | ||
| 748 | static inline int __must_check scsi_add_host(struct Scsi_Host *host, | ||
| 749 | struct device *dev) | ||
| 750 | { | ||
| 751 | return scsi_add_host_with_dma(host, dev, dev); | ||
| 752 | } | ||
| 753 | |||
| 734 | static inline struct device *scsi_get_device(struct Scsi_Host *shost) | 754 | static inline struct device *scsi_get_device(struct Scsi_Host *shost) |
| 735 | { | 755 | { |
| 736 | return shost->shost_gendev.parent; | 756 | return shost->shost_gendev.parent; |
diff --git a/include/scsi/scsi_transport_fc.h b/include/scsi/scsi_transport_fc.h index fc50bd64aa4e..8e86a94faf06 100644 --- a/include/scsi/scsi_transport_fc.h +++ b/include/scsi/scsi_transport_fc.h | |||
| @@ -807,5 +807,6 @@ void fc_host_post_vendor_event(struct Scsi_Host *shost, u32 event_number, | |||
| 807 | struct fc_vport *fc_vport_create(struct Scsi_Host *shost, int channel, | 807 | struct fc_vport *fc_vport_create(struct Scsi_Host *shost, int channel, |
| 808 | struct fc_vport_identifiers *); | 808 | struct fc_vport_identifiers *); |
| 809 | int fc_vport_terminate(struct fc_vport *vport); | 809 | int fc_vport_terminate(struct fc_vport *vport); |
| 810 | void fc_block_scsi_eh(struct scsi_cmnd *cmnd); | ||
| 810 | 811 | ||
| 811 | #endif /* SCSI_TRANSPORT_FC_H */ | 812 | #endif /* SCSI_TRANSPORT_FC_H */ |
diff --git a/include/scsi/scsi_transport_sas.h b/include/scsi/scsi_transport_sas.h index 61ad3594aad6..ffeebc34a4f7 100644 --- a/include/scsi/scsi_transport_sas.h +++ b/include/scsi/scsi_transport_sas.h | |||
| @@ -107,6 +107,8 @@ struct sas_end_device { | |||
| 107 | struct sas_rphy rphy; | 107 | struct sas_rphy rphy; |
| 108 | /* flags */ | 108 | /* flags */ |
| 109 | unsigned ready_led_meaning:1; | 109 | unsigned ready_led_meaning:1; |
| 110 | unsigned tlr_supported:1; | ||
| 111 | unsigned tlr_enabled:1; | ||
| 110 | /* parameters */ | 112 | /* parameters */ |
| 111 | u16 I_T_nexus_loss_timeout; | 113 | u16 I_T_nexus_loss_timeout; |
| 112 | u16 initiator_response_timeout; | 114 | u16 initiator_response_timeout; |
| @@ -181,6 +183,11 @@ extern int sas_phy_add(struct sas_phy *); | |||
| 181 | extern void sas_phy_delete(struct sas_phy *); | 183 | extern void sas_phy_delete(struct sas_phy *); |
| 182 | extern int scsi_is_sas_phy(const struct device *); | 184 | extern int scsi_is_sas_phy(const struct device *); |
| 183 | 185 | ||
| 186 | unsigned int sas_tlr_supported(struct scsi_device *); | ||
| 187 | unsigned int sas_is_tlr_enabled(struct scsi_device *); | ||
| 188 | void sas_disable_tlr(struct scsi_device *); | ||
| 189 | void sas_enable_tlr(struct scsi_device *); | ||
| 190 | |||
| 184 | extern struct sas_rphy *sas_end_device_alloc(struct sas_port *); | 191 | extern struct sas_rphy *sas_end_device_alloc(struct sas_port *); |
| 185 | extern struct sas_rphy *sas_expander_alloc(struct sas_port *, enum sas_device_type); | 192 | extern struct sas_rphy *sas_expander_alloc(struct sas_port *, enum sas_device_type); |
| 186 | void sas_rphy_free(struct sas_rphy *); | 193 | void sas_rphy_free(struct sas_rphy *); |
diff --git a/include/scsi/sg.h b/include/scsi/sg.h index 934ae389671d..a9f3c6fc3f57 100644 --- a/include/scsi/sg.h +++ b/include/scsi/sg.h | |||
| @@ -70,6 +70,9 @@ Major new features in SG 3.x driver (cf SG 2.x drivers) | |||
| 70 | (for the lk 2.2 series). | 70 | (for the lk 2.2 series). |
| 71 | */ | 71 | */ |
| 72 | 72 | ||
| 73 | #ifdef __KERNEL__ | ||
| 74 | extern int sg_big_buff; /* for sysctl */ | ||
| 75 | #endif | ||
| 73 | 76 | ||
| 74 | /* New interface introduced in the 3.x SG drivers follows */ | 77 | /* New interface introduced in the 3.x SG drivers follows */ |
| 75 | 78 | ||
diff --git a/include/sound/Kbuild b/include/sound/Kbuild index fd054a344324..e9dd9369ecb9 100644 --- a/include/sound/Kbuild +++ b/include/sound/Kbuild | |||
| @@ -2,7 +2,6 @@ header-y += asound_fm.h | |||
| 2 | header-y += hdsp.h | 2 | header-y += hdsp.h |
| 3 | header-y += hdspm.h | 3 | header-y += hdspm.h |
| 4 | header-y += sfnt_info.h | 4 | header-y += sfnt_info.h |
| 5 | header-y += sscape_ioctl.h | ||
| 6 | 5 | ||
| 7 | unifdef-y += asequencer.h | 6 | unifdef-y += asequencer.h |
| 8 | unifdef-y += asound.h | 7 | unifdef-y += asound.h |
diff --git a/include/sound/ac97_codec.h b/include/sound/ac97_codec.h index 3dae3f799b9b..49400459b477 100644 --- a/include/sound/ac97_codec.h +++ b/include/sound/ac97_codec.h | |||
| @@ -593,7 +593,7 @@ enum { | |||
| 593 | 593 | ||
| 594 | struct ac97_quirk { | 594 | struct ac97_quirk { |
| 595 | unsigned short subvendor; /* PCI subsystem vendor id */ | 595 | unsigned short subvendor; /* PCI subsystem vendor id */ |
| 596 | unsigned short subdevice; /* PCI sybsystem device id */ | 596 | unsigned short subdevice; /* PCI subsystem device id */ |
| 597 | unsigned short mask; /* device id bit mask, 0 = accept all */ | 597 | unsigned short mask; /* device id bit mask, 0 = accept all */ |
| 598 | unsigned int codec_id; /* codec id (if any), 0 = accept all */ | 598 | unsigned int codec_id; /* codec id (if any), 0 = accept all */ |
| 599 | const char *name; /* name shown as info */ | 599 | const char *name; /* name shown as info */ |
diff --git a/include/sound/aci.h b/include/sound/aci.h new file mode 100644 index 000000000000..ee639d355ef0 --- /dev/null +++ b/include/sound/aci.h | |||
| @@ -0,0 +1,90 @@ | |||
| 1 | #ifndef _ACI_H_ | ||
| 2 | #define _ACI_H_ | ||
| 3 | |||
| 4 | #define ACI_REG_COMMAND 0 /* write register offset */ | ||
| 5 | #define ACI_REG_STATUS 1 /* read register offset */ | ||
| 6 | #define ACI_REG_BUSY 2 /* busy register offset */ | ||
| 7 | #define ACI_REG_RDS 2 /* PCM20: RDS register offset */ | ||
| 8 | #define ACI_MINTIME 500 /* ACI time out limit */ | ||
| 9 | |||
| 10 | #define ACI_SET_MUTE 0x0d | ||
| 11 | #define ACI_SET_POWERAMP 0x0f | ||
| 12 | #define ACI_SET_TUNERMUTE 0xa3 | ||
| 13 | #define ACI_SET_TUNERMONO 0xa4 | ||
| 14 | #define ACI_SET_IDE 0xd0 | ||
| 15 | #define ACI_SET_WSS 0xd1 | ||
| 16 | #define ACI_SET_SOLOMODE 0xd2 | ||
| 17 | #define ACI_SET_PREAMP 0x03 | ||
| 18 | #define ACI_GET_PREAMP 0x21 | ||
| 19 | #define ACI_WRITE_TUNE 0xa7 | ||
| 20 | #define ACI_READ_TUNERSTEREO 0xa8 | ||
| 21 | #define ACI_READ_TUNERSTATION 0xa9 | ||
| 22 | #define ACI_READ_VERSION 0xf1 | ||
| 23 | #define ACI_READ_IDCODE 0xf2 | ||
| 24 | #define ACI_INIT 0xff | ||
| 25 | #define ACI_STATUS 0xf0 | ||
| 26 | #define ACI_S_GENERAL 0x00 | ||
| 27 | #define ACI_ERROR_OP 0xdf | ||
| 28 | |||
| 29 | /* ACI Mixer */ | ||
| 30 | |||
| 31 | /* These are the values for the right channel GET registers. | ||
| 32 | Add an offset of 0x01 for the left channel register. | ||
| 33 | (left=right+0x01) */ | ||
| 34 | |||
| 35 | #define ACI_GET_MASTER 0x03 | ||
| 36 | #define ACI_GET_MIC 0x05 | ||
| 37 | #define ACI_GET_LINE 0x07 | ||
| 38 | #define ACI_GET_CD 0x09 | ||
| 39 | #define ACI_GET_SYNTH 0x0b | ||
| 40 | #define ACI_GET_PCM 0x0d | ||
| 41 | #define ACI_GET_LINE1 0x10 /* Radio on PCM20 */ | ||
| 42 | #define ACI_GET_LINE2 0x12 | ||
| 43 | |||
| 44 | #define ACI_GET_EQ1 0x22 /* from Bass ... */ | ||
| 45 | #define ACI_GET_EQ2 0x24 | ||
| 46 | #define ACI_GET_EQ3 0x26 | ||
| 47 | #define ACI_GET_EQ4 0x28 | ||
| 48 | #define ACI_GET_EQ5 0x2a | ||
| 49 | #define ACI_GET_EQ6 0x2c | ||
| 50 | #define ACI_GET_EQ7 0x2e /* ... to Treble */ | ||
| 51 | |||
| 52 | /* And these are the values for the right channel SET registers. | ||
| 53 | For left channel access you have to add an offset of 0x08. | ||
| 54 | MASTER is an exception, which needs an offset of 0x01 */ | ||
| 55 | |||
| 56 | #define ACI_SET_MASTER 0x00 | ||
| 57 | #define ACI_SET_MIC 0x30 | ||
| 58 | #define ACI_SET_LINE 0x31 | ||
| 59 | #define ACI_SET_CD 0x34 | ||
| 60 | #define ACI_SET_SYNTH 0x33 | ||
| 61 | #define ACI_SET_PCM 0x32 | ||
| 62 | #define ACI_SET_LINE1 0x35 /* Radio on PCM20 */ | ||
| 63 | #define ACI_SET_LINE2 0x36 | ||
| 64 | |||
| 65 | #define ACI_SET_EQ1 0x40 /* from Bass ... */ | ||
| 66 | #define ACI_SET_EQ2 0x41 | ||
| 67 | #define ACI_SET_EQ3 0x42 | ||
| 68 | #define ACI_SET_EQ4 0x43 | ||
| 69 | #define ACI_SET_EQ5 0x44 | ||
| 70 | #define ACI_SET_EQ6 0x45 | ||
| 71 | #define ACI_SET_EQ7 0x46 /* ... to Treble */ | ||
| 72 | |||
| 73 | struct snd_miro_aci { | ||
| 74 | unsigned long aci_port; | ||
| 75 | int aci_vendor; | ||
| 76 | int aci_product; | ||
| 77 | int aci_version; | ||
| 78 | int aci_amp; | ||
| 79 | int aci_preamp; | ||
| 80 | int aci_solomode; | ||
| 81 | |||
| 82 | struct mutex aci_mutex; | ||
| 83 | }; | ||
| 84 | |||
| 85 | int snd_aci_cmd(struct snd_miro_aci *aci, int write1, int write2, int write3); | ||
| 86 | |||
| 87 | struct snd_miro_aci *snd_aci_get_aci(void); | ||
| 88 | |||
| 89 | #endif /* _ACI_H_ */ | ||
| 90 | |||
diff --git a/include/sound/ak4113.h b/include/sound/ak4113.h new file mode 100644 index 000000000000..2609048c1d44 --- /dev/null +++ b/include/sound/ak4113.h | |||
| @@ -0,0 +1,321 @@ | |||
| 1 | #ifndef __SOUND_AK4113_H | ||
| 2 | #define __SOUND_AK4113_H | ||
| 3 | |||
| 4 | /* | ||
| 5 | * Routines for Asahi Kasei AK4113 | ||
| 6 | * Copyright (c) by Jaroslav Kysela <perex@perex.cz>, | ||
| 7 | * Copyright (c) by Pavel Hofman <pavel.hofman@ivitera.com>, | ||
| 8 | * | ||
| 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, | ||
| 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 18 | * GNU General Public License for more details. | ||
| 19 | * | ||
| 20 | * You should have received a copy of the GNU General Public License | ||
| 21 | * along with this program; if not, write to the Free Software | ||
| 22 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
| 23 | * | ||
| 24 | */ | ||
| 25 | |||
| 26 | /* AK4113 registers */ | ||
| 27 | /* power down */ | ||
| 28 | #define AK4113_REG_PWRDN 0x00 | ||
| 29 | /* format control */ | ||
| 30 | #define AK4113_REG_FORMAT 0x01 | ||
| 31 | /* input/output control */ | ||
| 32 | #define AK4113_REG_IO0 0x02 | ||
| 33 | /* input/output control */ | ||
| 34 | #define AK4113_REG_IO1 0x03 | ||
| 35 | /* interrupt0 mask */ | ||
| 36 | #define AK4113_REG_INT0_MASK 0x04 | ||
| 37 | /* interrupt1 mask */ | ||
| 38 | #define AK4113_REG_INT1_MASK 0x05 | ||
| 39 | /* DAT mask & DTS select */ | ||
| 40 | #define AK4113_REG_DATDTS 0x06 | ||
| 41 | /* receiver status 0 */ | ||
| 42 | #define AK4113_REG_RCS0 0x07 | ||
| 43 | /* receiver status 1 */ | ||
| 44 | #define AK4113_REG_RCS1 0x08 | ||
| 45 | /* receiver status 2 */ | ||
| 46 | #define AK4113_REG_RCS2 0x09 | ||
| 47 | /* RX channel status byte 0 */ | ||
| 48 | #define AK4113_REG_RXCSB0 0x0a | ||
| 49 | /* RX channel status byte 1 */ | ||
| 50 | #define AK4113_REG_RXCSB1 0x0b | ||
| 51 | /* RX channel status byte 2 */ | ||
| 52 | #define AK4113_REG_RXCSB2 0x0c | ||
| 53 | /* RX channel status byte 3 */ | ||
| 54 | #define AK4113_REG_RXCSB3 0x0d | ||
| 55 | /* RX channel status byte 4 */ | ||
| 56 | #define AK4113_REG_RXCSB4 0x0e | ||
| 57 | /* burst preamble Pc byte 0 */ | ||
| 58 | #define AK4113_REG_Pc0 0x0f | ||
| 59 | /* burst preamble Pc byte 1 */ | ||
| 60 | #define AK4113_REG_Pc1 0x10 | ||
| 61 | /* burst preamble Pd byte 0 */ | ||
| 62 | #define AK4113_REG_Pd0 0x11 | ||
| 63 | /* burst preamble Pd byte 1 */ | ||
| 64 | #define AK4113_REG_Pd1 0x12 | ||
| 65 | /* Q-subcode address + control */ | ||
| 66 | #define AK4113_REG_QSUB_ADDR 0x13 | ||
| 67 | /* Q-subcode track */ | ||
| 68 | #define AK4113_REG_QSUB_TRACK 0x14 | ||
| 69 | /* Q-subcode index */ | ||
| 70 | #define AK4113_REG_QSUB_INDEX 0x15 | ||
| 71 | /* Q-subcode minute */ | ||
| 72 | #define AK4113_REG_QSUB_MINUTE 0x16 | ||
| 73 | /* Q-subcode second */ | ||
| 74 | #define AK4113_REG_QSUB_SECOND 0x17 | ||
| 75 | /* Q-subcode frame */ | ||
| 76 | #define AK4113_REG_QSUB_FRAME 0x18 | ||
| 77 | /* Q-subcode zero */ | ||
| 78 | #define AK4113_REG_QSUB_ZERO 0x19 | ||
| 79 | /* Q-subcode absolute minute */ | ||
| 80 | #define AK4113_REG_QSUB_ABSMIN 0x1a | ||
| 81 | /* Q-subcode absolute second */ | ||
| 82 | #define AK4113_REG_QSUB_ABSSEC 0x1b | ||
| 83 | /* Q-subcode absolute frame */ | ||
| 84 | #define AK4113_REG_QSUB_ABSFRM 0x1c | ||
| 85 | |||
| 86 | /* sizes */ | ||
| 87 | #define AK4113_REG_RXCSB_SIZE ((AK4113_REG_RXCSB4-AK4113_REG_RXCSB0)+1) | ||
| 88 | #define AK4113_REG_QSUB_SIZE ((AK4113_REG_QSUB_ABSFRM-AK4113_REG_QSUB_ADDR)\ | ||
| 89 | +1) | ||
| 90 | |||
| 91 | #define AK4113_WRITABLE_REGS (AK4113_REG_DATDTS + 1) | ||
| 92 | |||
| 93 | /* AK4113_REG_PWRDN bits */ | ||
| 94 | /* Channel Status Select */ | ||
| 95 | #define AK4113_CS12 (1<<7) | ||
| 96 | /* Block Start & C/U Output Mode */ | ||
| 97 | #define AK4113_BCU (1<<6) | ||
| 98 | /* Master Clock Operation Select */ | ||
| 99 | #define AK4113_CM1 (1<<5) | ||
| 100 | /* Master Clock Operation Select */ | ||
| 101 | #define AK4113_CM0 (1<<4) | ||
| 102 | /* Master Clock Frequency Select */ | ||
| 103 | #define AK4113_OCKS1 (1<<3) | ||
| 104 | /* Master Clock Frequency Select */ | ||
| 105 | #define AK4113_OCKS0 (1<<2) | ||
| 106 | /* 0 = power down, 1 = normal operation */ | ||
| 107 | #define AK4113_PWN (1<<1) | ||
| 108 | /* 0 = reset & initialize (except thisregister), 1 = normal operation */ | ||
| 109 | #define AK4113_RST (1<<0) | ||
| 110 | |||
| 111 | /* AK4113_REQ_FORMAT bits */ | ||
| 112 | /* V/TX Output select: 0 = Validity Flag Output, 1 = TX */ | ||
| 113 | #define AK4113_VTX (1<<7) | ||
| 114 | /* Audio Data Control */ | ||
| 115 | #define AK4113_DIF2 (1<<6) | ||
| 116 | /* Audio Data Control */ | ||
| 117 | #define AK4113_DIF1 (1<<5) | ||
| 118 | /* Audio Data Control */ | ||
| 119 | #define AK4113_DIF0 (1<<4) | ||
| 120 | /* Deemphasis Autodetect Enable (1 = enable) */ | ||
| 121 | #define AK4113_DEAU (1<<3) | ||
| 122 | /* 32kHz-48kHz Deemphasis Control */ | ||
| 123 | #define AK4113_DEM1 (1<<2) | ||
| 124 | /* 32kHz-48kHz Deemphasis Control */ | ||
| 125 | #define AK4113_DEM0 (1<<1) | ||
| 126 | #define AK4113_DEM_OFF (AK4113_DEM0) | ||
| 127 | #define AK4113_DEM_44KHZ (0) | ||
| 128 | #define AK4113_DEM_48KHZ (AK4113_DEM1) | ||
| 129 | #define AK4113_DEM_32KHZ (AK4113_DEM0|AK4113_DEM1) | ||
| 130 | /* STDO: 16-bit, right justified */ | ||
| 131 | #define AK4113_DIF_16R (0) | ||
| 132 | /* STDO: 18-bit, right justified */ | ||
| 133 | #define AK4113_DIF_18R (AK4113_DIF0) | ||
| 134 | /* STDO: 20-bit, right justified */ | ||
| 135 | #define AK4113_DIF_20R (AK4113_DIF1) | ||
| 136 | /* STDO: 24-bit, right justified */ | ||
| 137 | #define AK4113_DIF_24R (AK4113_DIF1|AK4113_DIF0) | ||
| 138 | /* STDO: 24-bit, left justified */ | ||
| 139 | #define AK4113_DIF_24L (AK4113_DIF2) | ||
| 140 | /* STDO: I2S */ | ||
| 141 | #define AK4113_DIF_24I2S (AK4113_DIF2|AK4113_DIF0) | ||
| 142 | /* STDO: 24-bit, left justified; LRCLK, BICK = Input */ | ||
| 143 | #define AK4113_DIF_I24L (AK4113_DIF2|AK4113_DIF1) | ||
| 144 | /* STDO: I2S; LRCLK, BICK = Input */ | ||
| 145 | #define AK4113_DIF_I24I2S (AK4113_DIF2|AK4113_DIF1|AK4113_DIF0) | ||
| 146 | |||
| 147 | /* AK4113_REG_IO0 */ | ||
| 148 | /* XTL1=0,XTL0=0 -> 11.2896Mhz; XTL1=0,XTL0=1 -> 12.288Mhz */ | ||
| 149 | #define AK4113_XTL1 (1<<6) | ||
| 150 | /* XTL1=1,XTL0=0 -> 24.576Mhz; XTL1=1,XTL0=1 -> use channel status */ | ||
| 151 | #define AK4113_XTL0 (1<<5) | ||
| 152 | /* Block Start Signal Output: 0 = U-bit, 1 = C-bit (req. BCU = 1) */ | ||
| 153 | #define AK4113_UCE (1<<4) | ||
| 154 | /* TX Output Enable (1 = enable) */ | ||
| 155 | #define AK4113_TXE (1<<3) | ||
| 156 | /* Output Through Data Selector for TX pin */ | ||
| 157 | #define AK4113_OPS2 (1<<2) | ||
| 158 | /* Output Through Data Selector for TX pin */ | ||
| 159 | #define AK4113_OPS1 (1<<1) | ||
| 160 | /* Output Through Data Selector for TX pin */ | ||
| 161 | #define AK4113_OPS0 (1<<0) | ||
| 162 | /* 11.2896 MHz ref. Xtal freq. */ | ||
| 163 | #define AK4113_XTL_11_2896M (0) | ||
| 164 | /* 12.288 MHz ref. Xtal freq. */ | ||
| 165 | #define AK4113_XTL_12_288M (AK4113_XTL0) | ||
| 166 | /* 24.576 MHz ref. Xtal freq. */ | ||
| 167 | #define AK4113_XTL_24_576M (AK4113_XTL1) | ||
| 168 | |||
| 169 | /* AK4113_REG_IO1 */ | ||
| 170 | /* Interrupt 0 pin Hold */ | ||
| 171 | #define AK4113_EFH1 (1<<7) | ||
| 172 | /* Interrupt 0 pin Hold */ | ||
| 173 | #define AK4113_EFH0 (1<<6) | ||
| 174 | #define AK4113_EFH_512LRCLK (0) | ||
| 175 | #define AK4113_EFH_1024LRCLK (AK4113_EFH0) | ||
| 176 | #define AK4113_EFH_2048LRCLK (AK4113_EFH1) | ||
| 177 | #define AK4113_EFH_4096LRCLK (AK4113_EFH1|AK4113_EFH0) | ||
| 178 | /* PLL Lock Time: 0 = 384/fs, 1 = 1/fs */ | ||
| 179 | #define AK4113_FAST (1<<5) | ||
| 180 | /* MCKO2 Output Select: 0 = CMx/OCKSx, 1 = Xtal */ | ||
| 181 | #define AK4113_XMCK (1<<4) | ||
| 182 | /* MCKO2 Output Freq. Select: 0 = x1, 1 = x0.5 (req. XMCK = 1) */ | ||
| 183 | #define AK4113_DIV (1<<3) | ||
| 184 | /* Input Recovery Data Select */ | ||
| 185 | #define AK4113_IPS2 (1<<2) | ||
| 186 | /* Input Recovery Data Select */ | ||
| 187 | #define AK4113_IPS1 (1<<1) | ||
| 188 | /* Input Recovery Data Select */ | ||
| 189 | #define AK4113_IPS0 (1<<0) | ||
| 190 | #define AK4113_IPS(x) ((x)&7) | ||
| 191 | |||
| 192 | /* AK4113_REG_INT0_MASK && AK4113_REG_INT1_MASK*/ | ||
| 193 | /* mask enable for QINT bit */ | ||
| 194 | #define AK4113_MQI (1<<7) | ||
| 195 | /* mask enable for AUTO bit */ | ||
| 196 | #define AK4113_MAUT (1<<6) | ||
| 197 | /* mask enable for CINT bit */ | ||
| 198 | #define AK4113_MCIT (1<<5) | ||
| 199 | /* mask enable for UNLOCK bit */ | ||
| 200 | #define AK4113_MULK (1<<4) | ||
| 201 | /* mask enable for V bit */ | ||
| 202 | #define AK4113_V (1<<3) | ||
| 203 | /* mask enable for STC bit */ | ||
| 204 | #define AK4113_STC (1<<2) | ||
| 205 | /* mask enable for AUDN bit */ | ||
| 206 | #define AK4113_MAN (1<<1) | ||
| 207 | /* mask enable for PAR bit */ | ||
| 208 | #define AK4113_MPR (1<<0) | ||
| 209 | |||
| 210 | /* AK4113_REG_DATDTS */ | ||
| 211 | /* DAT Start ID Counter */ | ||
| 212 | #define AK4113_DCNT (1<<4) | ||
| 213 | /* DTS-CD 16-bit Sync Word Detect */ | ||
| 214 | #define AK4113_DTS16 (1<<3) | ||
| 215 | /* DTS-CD 14-bit Sync Word Detect */ | ||
| 216 | #define AK4113_DTS14 (1<<2) | ||
| 217 | /* mask enable for DAT bit (if 1, no INT1 effect */ | ||
| 218 | #define AK4113_MDAT1 (1<<1) | ||
| 219 | /* mask enable for DAT bit (if 1, no INT0 effect */ | ||
| 220 | #define AK4113_MDAT0 (1<<0) | ||
| 221 | |||
| 222 | /* AK4113_REG_RCS0 */ | ||
| 223 | /* Q-subcode buffer interrupt, 0 = no change, 1 = changed */ | ||
| 224 | #define AK4113_QINT (1<<7) | ||
| 225 | /* Non-PCM or DTS stream auto detection, 0 = no detect, 1 = detect */ | ||
| 226 | #define AK4113_AUTO (1<<6) | ||
| 227 | /* channel status buffer interrupt, 0 = no change, 1 = change */ | ||
| 228 | #define AK4113_CINT (1<<5) | ||
| 229 | /* PLL lock status, 0 = lock, 1 = unlock */ | ||
| 230 | #define AK4113_UNLCK (1<<4) | ||
| 231 | /* Validity bit, 0 = valid, 1 = invalid */ | ||
| 232 | #define AK4113_V (1<<3) | ||
| 233 | /* sampling frequency or Pre-emphasis change, 0 = no detect, 1 = detect */ | ||
| 234 | #define AK4113_STC (1<<2) | ||
| 235 | /* audio bit output, 0 = audio, 1 = non-audio */ | ||
| 236 | #define AK4113_AUDION (1<<1) | ||
| 237 | /* parity error or biphase error status, 0 = no error, 1 = error */ | ||
| 238 | #define AK4113_PAR (1<<0) | ||
| 239 | |||
| 240 | /* AK4113_REG_RCS1 */ | ||
| 241 | /* sampling frequency detection */ | ||
| 242 | #define AK4113_FS3 (1<<7) | ||
| 243 | #define AK4113_FS2 (1<<6) | ||
| 244 | #define AK4113_FS1 (1<<5) | ||
| 245 | #define AK4113_FS0 (1<<4) | ||
| 246 | /* Pre-emphasis detect, 0 = OFF, 1 = ON */ | ||
| 247 | #define AK4113_PEM (1<<3) | ||
| 248 | /* DAT Start ID Detect, 0 = no detect, 1 = detect */ | ||
| 249 | #define AK4113_DAT (1<<2) | ||
| 250 | /* DTS-CD bit audio stream detect, 0 = no detect, 1 = detect */ | ||
| 251 | #define AK4113_DTSCD (1<<1) | ||
| 252 | /* Non-PCM bit stream detection, 0 = no detect, 1 = detect */ | ||
| 253 | #define AK4113_NPCM (1<<0) | ||
| 254 | #define AK4113_FS_8000HZ (AK4113_FS3|AK4113_FS0) | ||
| 255 | #define AK4113_FS_11025HZ (AK4113_FS2|AK4113_FS0) | ||
| 256 | #define AK4113_FS_16000HZ (AK4113_FS2|AK4113_FS1|AK4113_FS0) | ||
| 257 | #define AK4113_FS_22050HZ (AK4113_FS2) | ||
| 258 | #define AK4113_FS_24000HZ (AK4113_FS2|AK4113_FS1) | ||
| 259 | #define AK4113_FS_32000HZ (AK4113_FS1|AK4113_FS0) | ||
| 260 | #define AK4113_FS_44100HZ (0) | ||
| 261 | #define AK4113_FS_48000HZ (AK4113_FS1) | ||
| 262 | #define AK4113_FS_64000HZ (AK4113_FS3|AK4113_FS1|AK4113_FS0) | ||
| 263 | #define AK4113_FS_88200HZ (AK4113_FS3) | ||
| 264 | #define AK4113_FS_96000HZ (AK4113_FS3|AK4113_FS1) | ||
| 265 | #define AK4113_FS_176400HZ (AK4113_FS3|AK4113_FS2) | ||
| 266 | #define AK4113_FS_192000HZ (AK4113_FS3|AK4113_FS2|AK4113_FS1) | ||
| 267 | |||
| 268 | /* AK4113_REG_RCS2 */ | ||
| 269 | /* CRC for Q-subcode, 0 = no error, 1 = error */ | ||
| 270 | #define AK4113_QCRC (1<<1) | ||
| 271 | /* CRC for channel status, 0 = no error, 1 = error */ | ||
| 272 | #define AK4113_CCRC (1<<0) | ||
| 273 | |||
| 274 | /* flags for snd_ak4113_check_rate_and_errors() */ | ||
| 275 | #define AK4113_CHECK_NO_STAT (1<<0) /* no statistics */ | ||
| 276 | #define AK4113_CHECK_NO_RATE (1<<1) /* no rate check */ | ||
| 277 | |||
| 278 | #define AK4113_CONTROLS 13 | ||
| 279 | |||
| 280 | typedef void (ak4113_write_t)(void *private_data, unsigned char addr, | ||
| 281 | unsigned char data); | ||
| 282 | typedef unsigned char (ak4113_read_t)(void *private_data, unsigned char addr); | ||
| 283 | |||
| 284 | struct ak4113 { | ||
| 285 | struct snd_card *card; | ||
| 286 | ak4113_write_t *write; | ||
| 287 | ak4113_read_t *read; | ||
| 288 | void *private_data; | ||
| 289 | unsigned int init:1; | ||
| 290 | spinlock_t lock; | ||
| 291 | unsigned char regmap[AK4113_WRITABLE_REGS]; | ||
| 292 | struct snd_kcontrol *kctls[AK4113_CONTROLS]; | ||
| 293 | struct snd_pcm_substream *substream; | ||
| 294 | unsigned long parity_errors; | ||
| 295 | unsigned long v_bit_errors; | ||
| 296 | unsigned long qcrc_errors; | ||
| 297 | unsigned long ccrc_errors; | ||
| 298 | unsigned char rcs0; | ||
| 299 | unsigned char rcs1; | ||
| 300 | unsigned char rcs2; | ||
| 301 | struct delayed_work work; | ||
| 302 | unsigned int check_flags; | ||
| 303 | void *change_callback_private; | ||
| 304 | void (*change_callback)(struct ak4113 *ak4113, unsigned char c0, | ||
| 305 | unsigned char c1); | ||
| 306 | }; | ||
| 307 | |||
| 308 | int snd_ak4113_create(struct snd_card *card, ak4113_read_t *read, | ||
| 309 | ak4113_write_t *write, | ||
| 310 | const unsigned char *pgm, | ||
| 311 | void *private_data, struct ak4113 **r_ak4113); | ||
| 312 | void snd_ak4113_reg_write(struct ak4113 *ak4113, unsigned char reg, | ||
| 313 | unsigned char mask, unsigned char val); | ||
| 314 | void snd_ak4113_reinit(struct ak4113 *ak4113); | ||
| 315 | int snd_ak4113_build(struct ak4113 *ak4113, | ||
| 316 | struct snd_pcm_substream *capture_substream); | ||
| 317 | int snd_ak4113_external_rate(struct ak4113 *ak4113); | ||
| 318 | int snd_ak4113_check_rate_and_errors(struct ak4113 *ak4113, unsigned int flags); | ||
| 319 | |||
| 320 | #endif /* __SOUND_AK4113_H */ | ||
| 321 | |||
diff --git a/include/sound/ak4114.h b/include/sound/ak4114.h index d293d36a66b8..3ce69fd92523 100644 --- a/include/sound/ak4114.h +++ b/include/sound/ak4114.h | |||
| @@ -95,13 +95,13 @@ | |||
| 95 | 95 | ||
| 96 | /* AK4114_REG_IO0 */ | 96 | /* AK4114_REG_IO0 */ |
| 97 | #define AK4114_TX1E (1<<7) /* TX1 Output Enable (1 = enable) */ | 97 | #define AK4114_TX1E (1<<7) /* TX1 Output Enable (1 = enable) */ |
| 98 | #define AK4114_OPS12 (1<<2) /* Output Though Data Selector for TX1 pin */ | 98 | #define AK4114_OPS12 (1<<6) /* Output Data Selector for TX1 pin */ |
| 99 | #define AK4114_OPS11 (1<<1) /* Output Though Data Selector for TX1 pin */ | 99 | #define AK4114_OPS11 (1<<5) /* Output Data Selector for TX1 pin */ |
| 100 | #define AK4114_OPS10 (1<<0) /* Output Though Data Selector for TX1 pin */ | 100 | #define AK4114_OPS10 (1<<4) /* Output Data Selector for TX1 pin */ |
| 101 | #define AK4114_TX0E (1<<3) /* TX0 Output Enable (1 = enable) */ | 101 | #define AK4114_TX0E (1<<3) /* TX0 Output Enable (1 = enable) */ |
| 102 | #define AK4114_OPS02 (1<<2) /* Output Though Data Selector for TX0 pin */ | 102 | #define AK4114_OPS02 (1<<2) /* Output Data Selector for TX0 pin */ |
| 103 | #define AK4114_OPS01 (1<<1) /* Output Though Data Selector for TX0 pin */ | 103 | #define AK4114_OPS01 (1<<1) /* Output Data Selector for TX0 pin */ |
| 104 | #define AK4114_OPS00 (1<<0) /* Output Though Data Selector for TX0 pin */ | 104 | #define AK4114_OPS00 (1<<0) /* Output Data Selector for TX0 pin */ |
| 105 | 105 | ||
| 106 | /* AK4114_REG_IO1 */ | 106 | /* AK4114_REG_IO1 */ |
| 107 | #define AK4114_EFH1 (1<<7) /* Interrupt 0 pin Hold */ | 107 | #define AK4114_EFH1 (1<<7) /* Interrupt 0 pin Hold */ |
diff --git a/include/sound/ak4xxx-adda.h b/include/sound/ak4xxx-adda.h index 891cf1aea8b1..030b87c2f6d4 100644 --- a/include/sound/ak4xxx-adda.h +++ b/include/sound/ak4xxx-adda.h | |||
| @@ -68,7 +68,7 @@ struct snd_akm4xxx { | |||
| 68 | enum { | 68 | enum { |
| 69 | SND_AK4524, SND_AK4528, SND_AK4529, | 69 | SND_AK4524, SND_AK4528, SND_AK4529, |
| 70 | SND_AK4355, SND_AK4358, SND_AK4381, | 70 | SND_AK4355, SND_AK4358, SND_AK4381, |
| 71 | SND_AK5365 | 71 | SND_AK5365, SND_AK4620, |
| 72 | } type; | 72 | } type; |
| 73 | 73 | ||
| 74 | /* (array) information of combined codecs */ | 74 | /* (array) information of combined codecs */ |
| @@ -76,6 +76,9 @@ struct snd_akm4xxx { | |||
| 76 | const struct snd_akm4xxx_adc_channel *adc_info; | 76 | const struct snd_akm4xxx_adc_channel *adc_info; |
| 77 | 77 | ||
| 78 | struct snd_ak4xxx_ops ops; | 78 | struct snd_ak4xxx_ops ops; |
| 79 | unsigned int num_chips; | ||
| 80 | unsigned int total_regs; | ||
| 81 | const char *name; | ||
| 79 | }; | 82 | }; |
| 80 | 83 | ||
| 81 | void snd_akm4xxx_write(struct snd_akm4xxx *ak, int chip, unsigned char reg, | 84 | void snd_akm4xxx_write(struct snd_akm4xxx *ak, int chip, unsigned char reg, |
diff --git a/include/sound/asound.h b/include/sound/asound.h index 1f57bb92eb5a..098595500632 100644 --- a/include/sound/asound.h +++ b/include/sound/asound.h | |||
| @@ -544,7 +544,7 @@ struct snd_rawmidi_status { | |||
| 544 | * Timer section - /dev/snd/timer | 544 | * Timer section - /dev/snd/timer |
| 545 | */ | 545 | */ |
| 546 | 546 | ||
| 547 | #define SNDRV_TIMER_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 5) | 547 | #define SNDRV_TIMER_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 6) |
| 548 | 548 | ||
| 549 | enum { | 549 | enum { |
| 550 | SNDRV_TIMER_CLASS_NONE = -1, | 550 | SNDRV_TIMER_CLASS_NONE = -1, |
diff --git a/include/sound/control.h b/include/sound/control.h index ef96f07aa03b..112374dc0c58 100644 --- a/include/sound/control.h +++ b/include/sound/control.h | |||
| @@ -56,7 +56,6 @@ struct snd_kcontrol_new { | |||
| 56 | 56 | ||
| 57 | struct snd_kcontrol_volatile { | 57 | struct snd_kcontrol_volatile { |
| 58 | struct snd_ctl_file *owner; /* locked */ | 58 | struct snd_ctl_file *owner; /* locked */ |
| 59 | pid_t owner_pid; | ||
| 60 | unsigned int access; /* access rights */ | 59 | unsigned int access; /* access rights */ |
| 61 | }; | 60 | }; |
| 62 | 61 | ||
| @@ -87,10 +86,12 @@ struct snd_kctl_event { | |||
| 87 | 86 | ||
| 88 | #define snd_kctl_event(n) list_entry(n, struct snd_kctl_event, list) | 87 | #define snd_kctl_event(n) list_entry(n, struct snd_kctl_event, list) |
| 89 | 88 | ||
| 89 | struct pid; | ||
| 90 | |||
| 90 | struct snd_ctl_file { | 91 | struct snd_ctl_file { |
| 91 | struct list_head list; /* list of all control files */ | 92 | struct list_head list; /* list of all control files */ |
| 92 | struct snd_card *card; | 93 | struct snd_card *card; |
| 93 | pid_t pid; | 94 | struct pid *pid; |
| 94 | int prefer_pcm_subdevice; | 95 | int prefer_pcm_subdevice; |
| 95 | int prefer_rawmidi_subdevice; | 96 | int prefer_rawmidi_subdevice; |
| 96 | wait_queue_head_t change_sleep; | 97 | wait_queue_head_t change_sleep; |
diff --git a/include/sound/core.h b/include/sound/core.h index a61499c22b0b..89e0ac17f44a 100644 --- a/include/sound/core.h +++ b/include/sound/core.h | |||
| @@ -458,5 +458,8 @@ struct snd_pci_quirk { | |||
| 458 | const struct snd_pci_quirk * | 458 | const struct snd_pci_quirk * |
| 459 | snd_pci_quirk_lookup(struct pci_dev *pci, const struct snd_pci_quirk *list); | 459 | snd_pci_quirk_lookup(struct pci_dev *pci, const struct snd_pci_quirk *list); |
| 460 | 460 | ||
| 461 | const struct snd_pci_quirk * | ||
| 462 | snd_pci_quirk_lookup_id(u16 vendor, u16 device, | ||
| 463 | const struct snd_pci_quirk *list); | ||
| 461 | 464 | ||
| 462 | #endif /* __SOUND_CORE_H */ | 465 | #endif /* __SOUND_CORE_H */ |
diff --git a/include/sound/cs4231-regs.h b/include/sound/cs4231-regs.h index 92647532c454..66d28c2cb53d 100644 --- a/include/sound/cs4231-regs.h +++ b/include/sound/cs4231-regs.h | |||
| @@ -70,7 +70,6 @@ | |||
| 70 | #define AD1845_PWR_DOWN 0x1b /* power down control */ | 70 | #define AD1845_PWR_DOWN 0x1b /* power down control */ |
| 71 | #define CS4235_LEFT_MASTER 0x1b /* left master output control */ | 71 | #define CS4235_LEFT_MASTER 0x1b /* left master output control */ |
| 72 | #define CS4231_REC_FORMAT 0x1c /* clock and data format - record - bits 7-0 MCE */ | 72 | #define CS4231_REC_FORMAT 0x1c /* clock and data format - record - bits 7-0 MCE */ |
| 73 | #define CS4231_PLY_VAR_FREQ 0x1d /* playback variable frequency */ | ||
| 74 | #define AD1845_CLOCK 0x1d /* crystal clock select and total power down */ | 73 | #define AD1845_CLOCK 0x1d /* crystal clock select and total power down */ |
| 75 | #define CS4235_RIGHT_MASTER 0x1d /* right master output control */ | 74 | #define CS4235_RIGHT_MASTER 0x1d /* right master output control */ |
| 76 | #define CS4231_REC_UPR_CNT 0x1e /* record upper count */ | 75 | #define CS4231_REC_UPR_CNT 0x1e /* record upper count */ |
diff --git a/include/sound/cs46xx_dsp_spos.h b/include/sound/cs46xx_dsp_spos.h index 7c44667e79a6..49b03c9e5e55 100644 --- a/include/sound/cs46xx_dsp_spos.h +++ b/include/sound/cs46xx_dsp_spos.h | |||
| @@ -118,9 +118,11 @@ struct dsp_scb_descriptor { | |||
| 118 | 118 | ||
| 119 | struct snd_info_entry *proc_info; | 119 | struct snd_info_entry *proc_info; |
| 120 | int ref_count; | 120 | int ref_count; |
| 121 | spinlock_t lock; | ||
| 122 | 121 | ||
| 123 | int deleted; | 122 | u16 volume[2]; |
| 123 | unsigned int deleted :1; | ||
| 124 | unsigned int updated :1; | ||
| 125 | unsigned int volume_set :1; | ||
| 124 | }; | 126 | }; |
| 125 | 127 | ||
| 126 | struct dsp_task_descriptor { | 128 | struct dsp_task_descriptor { |
diff --git a/include/sound/pcm.h b/include/sound/pcm.h index de6d981de5d6..8b611a561985 100644 --- a/include/sound/pcm.h +++ b/include/sound/pcm.h | |||
| @@ -262,6 +262,8 @@ struct snd_pcm_hw_constraint_list { | |||
| 262 | unsigned int mask; | 262 | unsigned int mask; |
| 263 | }; | 263 | }; |
| 264 | 264 | ||
| 265 | struct snd_pcm_hwptr_log; | ||
| 266 | |||
| 265 | struct snd_pcm_runtime { | 267 | struct snd_pcm_runtime { |
| 266 | /* -- Status -- */ | 268 | /* -- Status -- */ |
| 267 | struct snd_pcm_substream *trigger_master; | 269 | struct snd_pcm_substream *trigger_master; |
| @@ -310,7 +312,9 @@ struct snd_pcm_runtime { | |||
| 310 | struct snd_pcm_mmap_control *control; | 312 | struct snd_pcm_mmap_control *control; |
| 311 | 313 | ||
| 312 | /* -- locking / scheduling -- */ | 314 | /* -- locking / scheduling -- */ |
| 313 | wait_queue_head_t sleep; | 315 | unsigned int twake: 1; /* do transfer (!poll) wakeup */ |
| 316 | wait_queue_head_t sleep; /* poll sleep */ | ||
| 317 | wait_queue_head_t tsleep; /* transfer sleep */ | ||
| 314 | struct fasync_struct *fasync; | 318 | struct fasync_struct *fasync; |
| 315 | 319 | ||
| 316 | /* -- private section -- */ | 320 | /* -- private section -- */ |
| @@ -340,6 +344,10 @@ struct snd_pcm_runtime { | |||
| 340 | /* -- OSS things -- */ | 344 | /* -- OSS things -- */ |
| 341 | struct snd_pcm_oss_runtime oss; | 345 | struct snd_pcm_oss_runtime oss; |
| 342 | #endif | 346 | #endif |
| 347 | |||
| 348 | #ifdef CONFIG_SND_PCM_XRUN_DEBUG | ||
| 349 | struct snd_pcm_hwptr_log *hwptr_log; | ||
| 350 | #endif | ||
| 343 | }; | 351 | }; |
| 344 | 352 | ||
| 345 | struct snd_pcm_group { /* keep linked substreams */ | 353 | struct snd_pcm_group { /* keep linked substreams */ |
| @@ -348,6 +356,8 @@ struct snd_pcm_group { /* keep linked substreams */ | |||
| 348 | int count; | 356 | int count; |
| 349 | }; | 357 | }; |
| 350 | 358 | ||
| 359 | struct pid; | ||
| 360 | |||
| 351 | struct snd_pcm_substream { | 361 | struct snd_pcm_substream { |
| 352 | struct snd_pcm *pcm; | 362 | struct snd_pcm *pcm; |
| 353 | struct snd_pcm_str *pstr; | 363 | struct snd_pcm_str *pstr; |
| @@ -379,6 +389,7 @@ struct snd_pcm_substream { | |||
| 379 | atomic_t mmap_count; | 389 | atomic_t mmap_count; |
| 380 | unsigned int f_flags; | 390 | unsigned int f_flags; |
| 381 | void (*pcm_release)(struct snd_pcm_substream *); | 391 | void (*pcm_release)(struct snd_pcm_substream *); |
| 392 | struct pid *pid; | ||
| 382 | #if defined(CONFIG_SND_PCM_OSS) || defined(CONFIG_SND_PCM_OSS_MODULE) | 393 | #if defined(CONFIG_SND_PCM_OSS) || defined(CONFIG_SND_PCM_OSS_MODULE) |
| 383 | /* -- OSS things -- */ | 394 | /* -- OSS things -- */ |
| 384 | struct snd_pcm_oss_substream oss; | 395 | struct snd_pcm_oss_substream oss; |
| @@ -831,6 +842,8 @@ void snd_pcm_set_sync(struct snd_pcm_substream *substream); | |||
| 831 | int snd_pcm_lib_interleave_len(struct snd_pcm_substream *substream); | 842 | int snd_pcm_lib_interleave_len(struct snd_pcm_substream *substream); |
| 832 | int snd_pcm_lib_ioctl(struct snd_pcm_substream *substream, | 843 | int snd_pcm_lib_ioctl(struct snd_pcm_substream *substream, |
| 833 | unsigned int cmd, void *arg); | 844 | unsigned int cmd, void *arg); |
| 845 | int snd_pcm_update_state(struct snd_pcm_substream *substream, | ||
| 846 | struct snd_pcm_runtime *runtime); | ||
| 834 | int snd_pcm_update_hw_ptr(struct snd_pcm_substream *substream); | 847 | int snd_pcm_update_hw_ptr(struct snd_pcm_substream *substream); |
| 835 | int snd_pcm_playback_xrun_check(struct snd_pcm_substream *substream); | 848 | int snd_pcm_playback_xrun_check(struct snd_pcm_substream *substream); |
| 836 | int snd_pcm_capture_xrun_check(struct snd_pcm_substream *substream); | 849 | int snd_pcm_capture_xrun_check(struct snd_pcm_substream *substream); |
| @@ -902,6 +915,44 @@ int snd_pcm_lib_preallocate_pages_for_all(struct snd_pcm *pcm, | |||
| 902 | int snd_pcm_lib_malloc_pages(struct snd_pcm_substream *substream, size_t size); | 915 | int snd_pcm_lib_malloc_pages(struct snd_pcm_substream *substream, size_t size); |
| 903 | int snd_pcm_lib_free_pages(struct snd_pcm_substream *substream); | 916 | int snd_pcm_lib_free_pages(struct snd_pcm_substream *substream); |
| 904 | 917 | ||
| 918 | int _snd_pcm_lib_alloc_vmalloc_buffer(struct snd_pcm_substream *substream, | ||
| 919 | size_t size, gfp_t gfp_flags); | ||
| 920 | int snd_pcm_lib_free_vmalloc_buffer(struct snd_pcm_substream *substream); | ||
| 921 | struct page *snd_pcm_lib_get_vmalloc_page(struct snd_pcm_substream *substream, | ||
| 922 | unsigned long offset); | ||
| 923 | #if 0 /* for kernel-doc */ | ||
| 924 | /** | ||
| 925 | * snd_pcm_lib_alloc_vmalloc_buffer - allocate virtual DMA buffer | ||
| 926 | * @substream: the substream to allocate the buffer to | ||
| 927 | * @size: the requested buffer size, in bytes | ||
| 928 | * | ||
| 929 | * Allocates the PCM substream buffer using vmalloc(), i.e., the memory is | ||
| 930 | * contiguous in kernel virtual space, but not in physical memory. Use this | ||
| 931 | * if the buffer is accessed by kernel code but not by device DMA. | ||
| 932 | * | ||
| 933 | * Returns 1 if the buffer was changed, 0 if not changed, or a negative error | ||
| 934 | * code. | ||
| 935 | */ | ||
| 936 | static int snd_pcm_lib_alloc_vmalloc_buffer | ||
| 937 | (struct snd_pcm_substream *substream, size_t size); | ||
| 938 | /** | ||
| 939 | * snd_pcm_lib_alloc_vmalloc_32_buffer - allocate 32-bit-addressable buffer | ||
| 940 | * @substream: the substream to allocate the buffer to | ||
| 941 | * @size: the requested buffer size, in bytes | ||
| 942 | * | ||
| 943 | * This function works like snd_pcm_lib_alloc_vmalloc_buffer(), but uses | ||
| 944 | * vmalloc_32(), i.e., the pages are allocated from 32-bit-addressable memory. | ||
| 945 | */ | ||
| 946 | static int snd_pcm_lib_alloc_vmalloc_32_buffer | ||
| 947 | (struct snd_pcm_substream *substream, size_t size); | ||
| 948 | #endif | ||
| 949 | #define snd_pcm_lib_alloc_vmalloc_buffer(subs, size) \ | ||
| 950 | _snd_pcm_lib_alloc_vmalloc_buffer \ | ||
| 951 | (subs, size, GFP_KERNEL | __GFP_HIGHMEM | __GFP_ZERO) | ||
| 952 | #define snd_pcm_lib_alloc_vmalloc_32_buffer(subs, size) \ | ||
| 953 | _snd_pcm_lib_alloc_vmalloc_buffer \ | ||
| 954 | (subs, size, GFP_KERNEL | GFP_DMA32 | __GFP_ZERO) | ||
| 955 | |||
| 905 | #ifdef CONFIG_SND_DMA_SGBUF | 956 | #ifdef CONFIG_SND_DMA_SGBUF |
| 906 | /* | 957 | /* |
| 907 | * SG-buffer handling | 958 | * SG-buffer handling |
| @@ -972,6 +1023,10 @@ int snd_pcm_lib_mmap_iomem(struct snd_pcm_substream *substream, struct vm_area_s | |||
| 972 | #define snd_pcm_lib_mmap_iomem NULL | 1023 | #define snd_pcm_lib_mmap_iomem NULL |
| 973 | #endif | 1024 | #endif |
| 974 | 1025 | ||
| 1026 | int snd_pcm_lib_mmap_noncached(struct snd_pcm_substream *substream, | ||
| 1027 | struct vm_area_struct *area); | ||
| 1028 | #define snd_pcm_lib_mmap_vmalloc snd_pcm_lib_mmap_noncached | ||
| 1029 | |||
| 975 | static inline void snd_pcm_limit_isa_dma_size(int dma, size_t *max) | 1030 | static inline void snd_pcm_limit_isa_dma_size(int dma, size_t *max) |
| 976 | { | 1031 | { |
| 977 | *max = dma < 4 ? 64 * 1024 : 128 * 1024; | 1032 | *max = dma < 4 ? 64 * 1024 : 128 * 1024; |
diff --git a/include/sound/pcm_oss.h b/include/sound/pcm_oss.h index cc4e226f35fd..760c969d885d 100644 --- a/include/sound/pcm_oss.h +++ b/include/sound/pcm_oss.h | |||
| @@ -61,7 +61,7 @@ struct snd_pcm_oss_runtime { | |||
| 61 | struct snd_pcm_plugin *plugin_first; | 61 | struct snd_pcm_plugin *plugin_first; |
| 62 | struct snd_pcm_plugin *plugin_last; | 62 | struct snd_pcm_plugin *plugin_last; |
| 63 | #endif | 63 | #endif |
| 64 | unsigned int prev_hw_ptr_interrupt; | 64 | unsigned int prev_hw_ptr_period; |
| 65 | }; | 65 | }; |
| 66 | 66 | ||
| 67 | struct snd_pcm_oss_file { | 67 | struct snd_pcm_oss_file { |
diff --git a/include/sound/rawmidi.h b/include/sound/rawmidi.h index c23c26585700..2480e7d10dcf 100644 --- a/include/sound/rawmidi.h +++ b/include/sound/rawmidi.h | |||
| @@ -46,6 +46,7 @@ | |||
| 46 | struct snd_rawmidi; | 46 | struct snd_rawmidi; |
| 47 | struct snd_rawmidi_substream; | 47 | struct snd_rawmidi_substream; |
| 48 | struct snd_seq_port_info; | 48 | struct snd_seq_port_info; |
| 49 | struct pid; | ||
| 49 | 50 | ||
| 50 | struct snd_rawmidi_ops { | 51 | struct snd_rawmidi_ops { |
| 51 | int (*open) (struct snd_rawmidi_substream * substream); | 52 | int (*open) (struct snd_rawmidi_substream * substream); |
| @@ -97,6 +98,7 @@ struct snd_rawmidi_substream { | |||
| 97 | struct snd_rawmidi_str *pstr; | 98 | struct snd_rawmidi_str *pstr; |
| 98 | char name[32]; | 99 | char name[32]; |
| 99 | struct snd_rawmidi_runtime *runtime; | 100 | struct snd_rawmidi_runtime *runtime; |
| 101 | struct pid *pid; | ||
| 100 | /* hardware layer */ | 102 | /* hardware layer */ |
| 101 | struct snd_rawmidi_ops *ops; | 103 | struct snd_rawmidi_ops *ops; |
| 102 | }; | 104 | }; |
diff --git a/include/sound/sb.h b/include/sound/sb.h index 4e62ee1e4115..95353542256a 100644 --- a/include/sound/sb.h +++ b/include/sound/sb.h | |||
| @@ -33,6 +33,7 @@ enum sb_hw_type { | |||
| 33 | SB_HW_20, | 33 | SB_HW_20, |
| 34 | SB_HW_201, | 34 | SB_HW_201, |
| 35 | SB_HW_PRO, | 35 | SB_HW_PRO, |
| 36 | SB_HW_JAZZ16, /* Media Vision Jazz16 */ | ||
| 36 | SB_HW_16, | 37 | SB_HW_16, |
| 37 | SB_HW_16CSP, /* SB16 with CSP chip */ | 38 | SB_HW_16CSP, /* SB16 with CSP chip */ |
| 38 | SB_HW_ALS100, /* Avance Logic ALS100 chip */ | 39 | SB_HW_ALS100, /* Avance Logic ALS100 chip */ |
diff --git a/include/sound/sh_dac_audio.h b/include/sound/sh_dac_audio.h new file mode 100644 index 000000000000..f5deaf1ddb9f --- /dev/null +++ b/include/sound/sh_dac_audio.h | |||
| @@ -0,0 +1,21 @@ | |||
| 1 | /* | ||
| 2 | * SH_DAC specific configuration, for the dac_audio platform_device | ||
| 3 | * | ||
| 4 | * Copyright (C) 2009 Rafael Ignacio Zurita <rizurita@yahoo.com> | ||
| 5 | * | ||
| 6 | * This program is free software; you can redistribute it and/or modify it | ||
| 7 | * under the terms of the GNU General Public License version 2 as published | ||
| 8 | * by the Free Software Foundation. | ||
| 9 | */ | ||
| 10 | |||
| 11 | #ifndef __INCLUDE_SH_DAC_AUDIO_H | ||
| 12 | #define __INCLUDE_SH_DAC_AUDIO_H | ||
| 13 | |||
| 14 | struct dac_audio_pdata { | ||
| 15 | int buffer_size; | ||
| 16 | int channel; | ||
| 17 | void (*start)(struct dac_audio_pdata *pd); | ||
| 18 | void (*stop)(struct dac_audio_pdata *pd); | ||
| 19 | }; | ||
| 20 | |||
| 21 | #endif /* __INCLUDE_SH_DAC_AUDIO_H */ | ||
diff --git a/include/sound/soc-dai.h b/include/sound/soc-dai.h index 97ca9af414dc..0a0b019d41ad 100644 --- a/include/sound/soc-dai.h +++ b/include/sound/soc-dai.h | |||
| @@ -16,6 +16,8 @@ | |||
| 16 | 16 | ||
| 17 | #include <linux/list.h> | 17 | #include <linux/list.h> |
| 18 | 18 | ||
| 19 | #include <sound/soc.h> | ||
| 20 | |||
| 19 | struct snd_pcm_substream; | 21 | struct snd_pcm_substream; |
| 20 | 22 | ||
| 21 | /* | 23 | /* |
| @@ -30,6 +32,7 @@ struct snd_pcm_substream; | |||
| 30 | #define SND_SOC_DAIFMT_DSP_A 3 /* L data MSB after FRM LRC */ | 32 | #define SND_SOC_DAIFMT_DSP_A 3 /* L data MSB after FRM LRC */ |
| 31 | #define SND_SOC_DAIFMT_DSP_B 4 /* L data MSB during FRM LRC */ | 33 | #define SND_SOC_DAIFMT_DSP_B 4 /* L data MSB during FRM LRC */ |
| 32 | #define SND_SOC_DAIFMT_AC97 5 /* AC97 */ | 34 | #define SND_SOC_DAIFMT_AC97 5 /* AC97 */ |
| 35 | #define SND_SOC_DAIFMT_PDM 6 /* Pulse density modulation */ | ||
| 33 | 36 | ||
| 34 | /* left and right justified also known as MSB and LSB respectively */ | 37 | /* left and right justified also known as MSB and LSB respectively */ |
| 35 | #define SND_SOC_DAIFMT_MSB SND_SOC_DAIFMT_LEFT_J | 38 | #define SND_SOC_DAIFMT_MSB SND_SOC_DAIFMT_LEFT_J |
| @@ -106,7 +109,7 @@ int snd_soc_dai_set_clkdiv(struct snd_soc_dai *dai, | |||
| 106 | int div_id, int div); | 109 | int div_id, int div); |
| 107 | 110 | ||
| 108 | int snd_soc_dai_set_pll(struct snd_soc_dai *dai, | 111 | int snd_soc_dai_set_pll(struct snd_soc_dai *dai, |
| 109 | int pll_id, unsigned int freq_in, unsigned int freq_out); | 112 | int pll_id, int source, unsigned int freq_in, unsigned int freq_out); |
| 110 | 113 | ||
| 111 | /* Digital Audio interface formatting */ | 114 | /* Digital Audio interface formatting */ |
| 112 | int snd_soc_dai_set_fmt(struct snd_soc_dai *dai, unsigned int fmt); | 115 | int snd_soc_dai_set_fmt(struct snd_soc_dai *dai, unsigned int fmt); |
| @@ -114,6 +117,10 @@ int snd_soc_dai_set_fmt(struct snd_soc_dai *dai, unsigned int fmt); | |||
| 114 | int snd_soc_dai_set_tdm_slot(struct snd_soc_dai *dai, | 117 | int snd_soc_dai_set_tdm_slot(struct snd_soc_dai *dai, |
| 115 | unsigned int tx_mask, unsigned int rx_mask, int slots, int slot_width); | 118 | unsigned int tx_mask, unsigned int rx_mask, int slots, int slot_width); |
| 116 | 119 | ||
| 120 | int snd_soc_dai_set_channel_map(struct snd_soc_dai *dai, | ||
| 121 | unsigned int tx_num, unsigned int *tx_slot, | ||
| 122 | unsigned int rx_num, unsigned int *rx_slot); | ||
| 123 | |||
| 117 | int snd_soc_dai_set_tristate(struct snd_soc_dai *dai, int tristate); | 124 | int snd_soc_dai_set_tristate(struct snd_soc_dai *dai, int tristate); |
| 118 | 125 | ||
| 119 | /* Digital Audio Interface mute */ | 126 | /* Digital Audio Interface mute */ |
| @@ -136,8 +143,8 @@ struct snd_soc_dai_ops { | |||
| 136 | */ | 143 | */ |
| 137 | int (*set_sysclk)(struct snd_soc_dai *dai, | 144 | int (*set_sysclk)(struct snd_soc_dai *dai, |
| 138 | int clk_id, unsigned int freq, int dir); | 145 | int clk_id, unsigned int freq, int dir); |
| 139 | int (*set_pll)(struct snd_soc_dai *dai, | 146 | int (*set_pll)(struct snd_soc_dai *dai, int pll_id, int source, |
| 140 | int pll_id, unsigned int freq_in, unsigned int freq_out); | 147 | unsigned int freq_in, unsigned int freq_out); |
| 141 | int (*set_clkdiv)(struct snd_soc_dai *dai, int div_id, int div); | 148 | int (*set_clkdiv)(struct snd_soc_dai *dai, int div_id, int div); |
| 142 | 149 | ||
| 143 | /* | 150 | /* |
| @@ -148,6 +155,9 @@ struct snd_soc_dai_ops { | |||
| 148 | int (*set_tdm_slot)(struct snd_soc_dai *dai, | 155 | int (*set_tdm_slot)(struct snd_soc_dai *dai, |
| 149 | unsigned int tx_mask, unsigned int rx_mask, | 156 | unsigned int tx_mask, unsigned int rx_mask, |
| 150 | int slots, int slot_width); | 157 | int slots, int slot_width); |
| 158 | int (*set_channel_map)(struct snd_soc_dai *dai, | ||
| 159 | unsigned int tx_num, unsigned int *tx_slot, | ||
| 160 | unsigned int rx_num, unsigned int *rx_slot); | ||
| 151 | int (*set_tristate)(struct snd_soc_dai *dai, int tristate); | 161 | int (*set_tristate)(struct snd_soc_dai *dai, int tristate); |
| 152 | 162 | ||
| 153 | /* | 163 | /* |
| @@ -209,7 +219,6 @@ struct snd_soc_dai { | |||
| 209 | struct snd_soc_codec *codec; | 219 | struct snd_soc_codec *codec; |
| 210 | unsigned int active; | 220 | unsigned int active; |
| 211 | unsigned char pop_wait:1; | 221 | unsigned char pop_wait:1; |
| 212 | void *dma_data; | ||
| 213 | 222 | ||
| 214 | /* DAI private data */ | 223 | /* DAI private data */ |
| 215 | void *private_data; | 224 | void *private_data; |
| @@ -220,4 +229,21 @@ struct snd_soc_dai { | |||
| 220 | struct list_head list; | 229 | struct list_head list; |
| 221 | }; | 230 | }; |
| 222 | 231 | ||
| 232 | static inline void *snd_soc_dai_get_dma_data(const struct snd_soc_dai *dai, | ||
| 233 | const struct snd_pcm_substream *ss) | ||
| 234 | { | ||
| 235 | return (ss->stream == SNDRV_PCM_STREAM_PLAYBACK) ? | ||
| 236 | dai->playback.dma_data : dai->capture.dma_data; | ||
| 237 | } | ||
| 238 | |||
| 239 | static inline void snd_soc_dai_set_dma_data(struct snd_soc_dai *dai, | ||
| 240 | const struct snd_pcm_substream *ss, | ||
| 241 | void *data) | ||
| 242 | { | ||
| 243 | if (ss->stream == SNDRV_PCM_STREAM_PLAYBACK) | ||
| 244 | dai->playback.dma_data = data; | ||
| 245 | else | ||
| 246 | dai->capture.dma_data = data; | ||
| 247 | } | ||
| 248 | |||
| 223 | #endif | 249 | #endif |
diff --git a/include/sound/soc-dapm.h b/include/sound/soc-dapm.h index c1410e3191e3..c0922a034223 100644 --- a/include/sound/soc-dapm.h +++ b/include/sound/soc-dapm.h | |||
| @@ -95,6 +95,21 @@ | |||
| 95 | .shift = wshift, .invert = winvert, .kcontrols = wcontrols, \ | 95 | .shift = wshift, .invert = winvert, .kcontrols = wcontrols, \ |
| 96 | .num_kcontrols = 1} | 96 | .num_kcontrols = 1} |
| 97 | 97 | ||
| 98 | /* Simplified versions of above macros, assuming wncontrols = ARRAY_SIZE(wcontrols) */ | ||
| 99 | #define SOC_PGA_ARRAY(wname, wreg, wshift, winvert,\ | ||
| 100 | wcontrols) \ | ||
| 101 | { .id = snd_soc_dapm_pga, .name = wname, .reg = wreg, .shift = wshift, \ | ||
| 102 | .invert = winvert, .kcontrols = wcontrols, .num_kcontrols = ARRAY_SIZE(wcontrols)} | ||
| 103 | #define SOC_MIXER_ARRAY(wname, wreg, wshift, winvert, \ | ||
| 104 | wcontrols)\ | ||
| 105 | { .id = snd_soc_dapm_mixer, .name = wname, .reg = wreg, .shift = wshift, \ | ||
| 106 | .invert = winvert, .kcontrols = wcontrols, .num_kcontrols = ARRAY_SIZE(wcontrols)} | ||
| 107 | #define SOC_MIXER_NAMED_CTL_ARRAY(wname, wreg, wshift, winvert, \ | ||
| 108 | wcontrols)\ | ||
| 109 | { .id = snd_soc_dapm_mixer_named_ctl, .name = wname, .reg = wreg, \ | ||
| 110 | .shift = wshift, .invert = winvert, .kcontrols = wcontrols, \ | ||
| 111 | .num_kcontrols = ARRAY_SIZE(wcontrols)} | ||
| 112 | |||
| 98 | /* path domain with event - event handler must return 0 for success */ | 113 | /* path domain with event - event handler must return 0 for success */ |
| 99 | #define SND_SOC_DAPM_PGA_E(wname, wreg, wshift, winvert, wcontrols, \ | 114 | #define SND_SOC_DAPM_PGA_E(wname, wreg, wshift, winvert, wcontrols, \ |
| 100 | wncontrols, wevent, wflags) \ | 115 | wncontrols, wevent, wflags) \ |
| @@ -126,6 +141,23 @@ | |||
| 126 | .invert = winvert, .kcontrols = wcontrols, .num_kcontrols = 1, \ | 141 | .invert = winvert, .kcontrols = wcontrols, .num_kcontrols = 1, \ |
| 127 | .event = wevent, .event_flags = wflags} | 142 | .event = wevent, .event_flags = wflags} |
| 128 | 143 | ||
| 144 | /* Simplified versions of above macros, assuming wncontrols = ARRAY_SIZE(wcontrols) */ | ||
| 145 | #define SOC_PGA_E_ARRAY(wname, wreg, wshift, winvert, wcontrols, \ | ||
| 146 | wevent, wflags) \ | ||
| 147 | { .id = snd_soc_dapm_pga, .name = wname, .reg = wreg, .shift = wshift, \ | ||
| 148 | .invert = winvert, .kcontrols = wcontrols, .num_kcontrols = ARRAY_SIZE(wcontrols), \ | ||
| 149 | .event = wevent, .event_flags = wflags} | ||
| 150 | #define SOC_MIXER_E_ARRAY(wname, wreg, wshift, winvert, wcontrols, \ | ||
| 151 | wevent, wflags) \ | ||
| 152 | { .id = snd_soc_dapm_mixer, .name = wname, .reg = wreg, .shift = wshift, \ | ||
| 153 | .invert = winvert, .kcontrols = wcontrols, .num_kcontrols = ARRAY_SIZE(wcontrols), \ | ||
| 154 | .event = wevent, .event_flags = wflags} | ||
| 155 | #define SOC_MIXER_NAMED_CTL_E_ARRAY(wname, wreg, wshift, winvert, \ | ||
| 156 | wcontrols, wevent, wflags) \ | ||
| 157 | { .id = snd_soc_dapm_mixer, .name = wname, .reg = wreg, .shift = wshift, \ | ||
| 158 | .invert = winvert, .kcontrols = wcontrols, \ | ||
| 159 | .num_kcontrols = ARRAY_SIZE(wcontrols), .event = wevent, .event_flags = wflags} | ||
| 160 | |||
| 129 | /* events that are pre and post DAPM */ | 161 | /* events that are pre and post DAPM */ |
| 130 | #define SND_SOC_DAPM_PRE(wname, wevent) \ | 162 | #define SND_SOC_DAPM_PRE(wname, wevent) \ |
| 131 | { .id = snd_soc_dapm_pre, .name = wname, .kcontrols = NULL, \ | 163 | { .id = snd_soc_dapm_pre, .name = wname, .kcontrols = NULL, \ |
| @@ -206,6 +238,12 @@ | |||
| 206 | .get = snd_soc_dapm_get_enum_double, \ | 238 | .get = snd_soc_dapm_get_enum_double, \ |
| 207 | .put = snd_soc_dapm_put_enum_double, \ | 239 | .put = snd_soc_dapm_put_enum_double, \ |
| 208 | .private_value = (unsigned long)&xenum } | 240 | .private_value = (unsigned long)&xenum } |
| 241 | #define SOC_DAPM_ENUM_VIRT(xname, xenum) \ | ||
| 242 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \ | ||
| 243 | .info = snd_soc_info_enum_double, \ | ||
| 244 | .get = snd_soc_dapm_get_enum_virt, \ | ||
| 245 | .put = snd_soc_dapm_put_enum_virt, \ | ||
| 246 | .private_value = (unsigned long)&xenum } | ||
| 209 | #define SOC_DAPM_VALUE_ENUM(xname, xenum) \ | 247 | #define SOC_DAPM_VALUE_ENUM(xname, xenum) \ |
| 210 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \ | 248 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \ |
| 211 | .info = snd_soc_info_enum_double, \ | 249 | .info = snd_soc_info_enum_double, \ |
| @@ -260,6 +298,10 @@ int snd_soc_dapm_get_enum_double(struct snd_kcontrol *kcontrol, | |||
| 260 | struct snd_ctl_elem_value *ucontrol); | 298 | struct snd_ctl_elem_value *ucontrol); |
| 261 | int snd_soc_dapm_put_enum_double(struct snd_kcontrol *kcontrol, | 299 | int snd_soc_dapm_put_enum_double(struct snd_kcontrol *kcontrol, |
| 262 | struct snd_ctl_elem_value *ucontrol); | 300 | struct snd_ctl_elem_value *ucontrol); |
| 301 | int snd_soc_dapm_get_enum_virt(struct snd_kcontrol *kcontrol, | ||
| 302 | struct snd_ctl_elem_value *ucontrol); | ||
| 303 | int snd_soc_dapm_put_enum_virt(struct snd_kcontrol *kcontrol, | ||
| 304 | struct snd_ctl_elem_value *ucontrol); | ||
| 263 | int snd_soc_dapm_get_value_enum_double(struct snd_kcontrol *kcontrol, | 305 | int snd_soc_dapm_get_value_enum_double(struct snd_kcontrol *kcontrol, |
| 264 | struct snd_ctl_elem_value *ucontrol); | 306 | struct snd_ctl_elem_value *ucontrol); |
| 265 | int snd_soc_dapm_put_value_enum_double(struct snd_kcontrol *kcontrol, | 307 | int snd_soc_dapm_put_value_enum_double(struct snd_kcontrol *kcontrol, |
| @@ -333,6 +375,10 @@ struct snd_soc_dapm_route { | |||
| 333 | const char *sink; | 375 | const char *sink; |
| 334 | const char *control; | 376 | const char *control; |
| 335 | const char *source; | 377 | const char *source; |
| 378 | |||
| 379 | /* Note: currently only supported for links where source is a supply */ | ||
| 380 | int (*connected)(struct snd_soc_dapm_widget *source, | ||
| 381 | struct snd_soc_dapm_widget *sink); | ||
| 336 | }; | 382 | }; |
| 337 | 383 | ||
| 338 | /* dapm audio path between two widgets */ | 384 | /* dapm audio path between two widgets */ |
| @@ -349,6 +395,9 @@ struct snd_soc_dapm_path { | |||
| 349 | u32 connect:1; /* source and sink widgets are connected */ | 395 | u32 connect:1; /* source and sink widgets are connected */ |
| 350 | u32 walked:1; /* path has been walked */ | 396 | u32 walked:1; /* path has been walked */ |
| 351 | 397 | ||
| 398 | int (*connected)(struct snd_soc_dapm_widget *source, | ||
| 399 | struct snd_soc_dapm_widget *sink); | ||
| 400 | |||
| 352 | struct list_head list_source; | 401 | struct list_head list_source; |
| 353 | struct list_head list_sink; | 402 | struct list_head list_sink; |
| 354 | struct list_head list; | 403 | struct list_head list; |
diff --git a/include/sound/soc.h b/include/sound/soc.h index 475cb7ed6bec..a57fbfcd4c8f 100644 --- a/include/sound/soc.h +++ b/include/sound/soc.h | |||
| @@ -169,6 +169,23 @@ | |||
| 169 | .private_value = (unsigned long)&xenum } | 169 | .private_value = (unsigned long)&xenum } |
| 170 | 170 | ||
| 171 | /* | 171 | /* |
| 172 | * Simplified versions of above macros, declaring a struct and calculating | ||
| 173 | * ARRAY_SIZE internally | ||
| 174 | */ | ||
| 175 | #define SOC_ENUM_DOUBLE_DECL(name, xreg, xshift_l, xshift_r, xtexts) \ | ||
| 176 | struct soc_enum name = SOC_ENUM_DOUBLE(xreg, xshift_l, xshift_r, \ | ||
| 177 | ARRAY_SIZE(xtexts), xtexts) | ||
| 178 | #define SOC_ENUM_SINGLE_DECL(name, xreg, xshift, xtexts) \ | ||
| 179 | SOC_ENUM_DOUBLE_DECL(name, xreg, xshift, xshift, xtexts) | ||
| 180 | #define SOC_ENUM_SINGLE_EXT_DECL(name, xtexts) \ | ||
| 181 | struct soc_enum name = SOC_ENUM_SINGLE_EXT(ARRAY_SIZE(xtexts), xtexts) | ||
| 182 | #define SOC_VALUE_ENUM_DOUBLE_DECL(name, xreg, xshift_l, xshift_r, xmask, xtexts, xvalues) \ | ||
| 183 | struct soc_enum name = SOC_VALUE_ENUM_DOUBLE(xreg, xshift_l, xshift_r, xmask, \ | ||
| 184 | ARRAY_SIZE(xtexts), xtexts, xvalues) | ||
| 185 | #define SOC_VALUE_ENUM_SINGLE_DECL(name, xreg, xshift, xmask, xtexts, xvalues) \ | ||
| 186 | SOC_VALUE_ENUM_DOUBLE_DECL(name, xreg, xshift, xshift, xmask, xtexts, xvalues) | ||
| 187 | |||
| 188 | /* | ||
| 172 | * Bias levels | 189 | * Bias levels |
| 173 | * | 190 | * |
| 174 | * @ON: Bias is fully on for audio playback and capture operations. | 191 | * @ON: Bias is fully on for audio playback and capture operations. |
| @@ -223,15 +240,15 @@ int snd_soc_codec_set_cache_io(struct snd_soc_codec *codec, | |||
| 223 | int addr_bits, int data_bits, | 240 | int addr_bits, int data_bits, |
| 224 | enum snd_soc_control_type control); | 241 | enum snd_soc_control_type control); |
| 225 | 242 | ||
| 226 | #ifdef CONFIG_PM | ||
| 227 | int snd_soc_suspend_device(struct device *dev); | ||
| 228 | int snd_soc_resume_device(struct device *dev); | ||
| 229 | #endif | ||
| 230 | |||
| 231 | /* pcm <-> DAI connect */ | 243 | /* pcm <-> DAI connect */ |
| 232 | void snd_soc_free_pcms(struct snd_soc_device *socdev); | 244 | void snd_soc_free_pcms(struct snd_soc_device *socdev); |
| 233 | int snd_soc_new_pcms(struct snd_soc_device *socdev, int idx, const char *xid); | 245 | int snd_soc_new_pcms(struct snd_soc_device *socdev, int idx, const char *xid); |
| 234 | int snd_soc_init_card(struct snd_soc_device *socdev); | 246 | |
| 247 | /* Utility functions to get clock rates from various things */ | ||
| 248 | int snd_soc_calc_frame_size(int sample_size, int channels, int tdm_slots); | ||
| 249 | int snd_soc_params_to_frame_size(struct snd_pcm_hw_params *params); | ||
| 250 | int snd_soc_calc_bclk(int fs, int sample_size, int channels, int tdm_slots); | ||
| 251 | int snd_soc_params_to_bclk(struct snd_pcm_hw_params *parms); | ||
| 235 | 252 | ||
| 236 | /* set runtime hw params */ | 253 | /* set runtime hw params */ |
| 237 | int snd_soc_set_runtime_hwparams(struct snd_pcm_substream *substream, | 254 | int snd_soc_set_runtime_hwparams(struct snd_pcm_substream *substream, |
| @@ -253,6 +270,9 @@ void snd_soc_jack_free_gpios(struct snd_soc_jack *jack, int count, | |||
| 253 | /* codec register bit access */ | 270 | /* codec register bit access */ |
| 254 | int snd_soc_update_bits(struct snd_soc_codec *codec, unsigned short reg, | 271 | int snd_soc_update_bits(struct snd_soc_codec *codec, unsigned short reg, |
| 255 | unsigned int mask, unsigned int value); | 272 | unsigned int mask, unsigned int value); |
| 273 | int snd_soc_update_bits_locked(struct snd_soc_codec *codec, | ||
| 274 | unsigned short reg, unsigned int mask, | ||
| 275 | unsigned int value); | ||
| 256 | int snd_soc_test_bits(struct snd_soc_codec *codec, unsigned short reg, | 276 | int snd_soc_test_bits(struct snd_soc_codec *codec, unsigned short reg, |
| 257 | unsigned int mask, unsigned int value); | 277 | unsigned int mask, unsigned int value); |
| 258 | 278 | ||
| @@ -333,6 +353,8 @@ struct snd_soc_jack_gpio { | |||
| 333 | int debounce_time; | 353 | int debounce_time; |
| 334 | struct snd_soc_jack *jack; | 354 | struct snd_soc_jack *jack; |
| 335 | struct work_struct work; | 355 | struct work_struct work; |
| 356 | |||
| 357 | int (*jack_status_check)(void); | ||
| 336 | }; | 358 | }; |
| 337 | #endif | 359 | #endif |
| 338 | 360 | ||
| @@ -353,6 +375,7 @@ struct snd_soc_pcm_stream { | |||
| 353 | unsigned int channels_min; /* min channels */ | 375 | unsigned int channels_min; /* min channels */ |
| 354 | unsigned int channels_max; /* max channels */ | 376 | unsigned int channels_max; /* max channels */ |
| 355 | unsigned int active:1; /* stream is in use */ | 377 | unsigned int active:1; /* stream is in use */ |
| 378 | void *dma_data; /* used by platform code */ | ||
| 356 | }; | 379 | }; |
| 357 | 380 | ||
| 358 | /* SoC audio ops */ | 381 | /* SoC audio ops */ |
| @@ -400,6 +423,10 @@ struct snd_soc_codec { | |||
| 400 | short reg_cache_size; | 423 | short reg_cache_size; |
| 401 | short reg_cache_step; | 424 | short reg_cache_step; |
| 402 | 425 | ||
| 426 | unsigned int idle_bias_off:1; /* Use BIAS_OFF instead of STANDBY */ | ||
| 427 | unsigned int cache_only:1; /* Suppress writes to hardware */ | ||
| 428 | unsigned int cache_sync:1; /* Cache needs to be synced to hardware */ | ||
| 429 | |||
| 403 | /* dapm */ | 430 | /* dapm */ |
| 404 | u32 pop_time; | 431 | u32 pop_time; |
| 405 | struct list_head dapm_widgets; | 432 | struct list_head dapm_widgets; |
| @@ -413,6 +440,7 @@ struct snd_soc_codec { | |||
| 413 | unsigned int num_dai; | 440 | unsigned int num_dai; |
| 414 | 441 | ||
| 415 | #ifdef CONFIG_DEBUG_FS | 442 | #ifdef CONFIG_DEBUG_FS |
| 443 | struct dentry *debugfs_codec_root; | ||
| 416 | struct dentry *debugfs_reg; | 444 | struct dentry *debugfs_reg; |
| 417 | struct dentry *debugfs_pop_time; | 445 | struct dentry *debugfs_pop_time; |
| 418 | struct dentry *debugfs_dapm; | 446 | struct dentry *debugfs_dapm; |
| @@ -494,6 +522,8 @@ struct snd_soc_card { | |||
| 494 | int (*set_bias_level)(struct snd_soc_card *, | 522 | int (*set_bias_level)(struct snd_soc_card *, |
| 495 | enum snd_soc_bias_level level); | 523 | enum snd_soc_bias_level level); |
| 496 | 524 | ||
| 525 | long pmdown_time; | ||
| 526 | |||
| 497 | /* CPU <--> Codec DAI links */ | 527 | /* CPU <--> Codec DAI links */ |
| 498 | struct snd_soc_dai_link *dai_link; | 528 | struct snd_soc_dai_link *dai_link; |
| 499 | int num_links; | 529 | int num_links; |
diff --git a/include/sound/sscape_ioctl.h b/include/sound/sscape_ioctl.h deleted file mode 100644 index 0d8885969c64..000000000000 --- a/include/sound/sscape_ioctl.h +++ /dev/null | |||
| @@ -1,21 +0,0 @@ | |||
| 1 | #ifndef SSCAPE_IOCTL_H | ||
| 2 | #define SSCAPE_IOCTL_H | ||
| 3 | |||
| 4 | |||
| 5 | struct sscape_bootblock | ||
| 6 | { | ||
| 7 | unsigned char code[256]; | ||
| 8 | unsigned version; | ||
| 9 | }; | ||
| 10 | |||
| 11 | #define SSCAPE_MICROCODE_SIZE 65536 | ||
| 12 | |||
| 13 | struct sscape_microcode | ||
| 14 | { | ||
| 15 | unsigned char __user *code; | ||
| 16 | }; | ||
| 17 | |||
| 18 | #define SND_SSCAPE_LOAD_BOOTB _IOWR('P', 100, struct sscape_bootblock) | ||
| 19 | #define SND_SSCAPE_LOAD_MCODE _IOW ('P', 101, struct sscape_microcode) | ||
| 20 | |||
| 21 | #endif | ||
diff --git a/include/sound/tlv320dac33-plat.h b/include/sound/tlv320dac33-plat.h new file mode 100644 index 000000000000..ac0665264bdf --- /dev/null +++ b/include/sound/tlv320dac33-plat.h | |||
| @@ -0,0 +1,21 @@ | |||
| 1 | /* | ||
| 2 | * Platform header for Texas Instruments TLV320DAC33 codec driver | ||
| 3 | * | ||
| 4 | * Author: Peter Ujfalusi <peter.ujfalusi@nokia.com> | ||
| 5 | * | ||
| 6 | * Copyright: (C) 2009 Nokia Corporation | ||
| 7 | * | ||
| 8 | * This program is free software; you can redistribute it and/or modify | ||
| 9 | * it under the terms of the GNU General Public License version 2 as | ||
| 10 | * published by the Free Software Foundation. | ||
| 11 | */ | ||
| 12 | |||
| 13 | #ifndef __TLV320DAC33_PLAT_H | ||
| 14 | #define __TLV320DAC33_PLAT_H | ||
| 15 | |||
| 16 | struct tlv320dac33_platform_data { | ||
| 17 | int power_gpio; | ||
| 18 | u8 burst_bclkdiv; | ||
| 19 | }; | ||
| 20 | |||
| 21 | #endif /* __TLV320DAC33_PLAT_H */ | ||
diff --git a/include/sound/tpa6130a2-plat.h b/include/sound/tpa6130a2-plat.h new file mode 100644 index 000000000000..e29fde6b5cbe --- /dev/null +++ b/include/sound/tpa6130a2-plat.h | |||
| @@ -0,0 +1,36 @@ | |||
| 1 | /* | ||
| 2 | * TPA6130A2 driver platform header | ||
| 3 | * | ||
| 4 | * Copyright (C) Nokia Corporation | ||
| 5 | * | ||
| 6 | * Written by Peter Ujfalusi <peter.ujfalusi@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 TPA6130A2_PLAT_H | ||
| 24 | #define TPA6130A2_PLAT_H | ||
| 25 | |||
| 26 | enum tpa_model { | ||
| 27 | TPA6130A2, | ||
| 28 | TPA6140A2, | ||
| 29 | }; | ||
| 30 | |||
| 31 | struct tpa6130a2_platform_data { | ||
| 32 | enum tpa_model id; | ||
| 33 | int power_gpio; | ||
| 34 | }; | ||
| 35 | |||
| 36 | #endif | ||
diff --git a/include/sound/version.h b/include/sound/version.h index 22939142dd23..7fed23442db8 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.21" | 2 | #define CONFIG_SND_VERSION "1.0.22.1" |
| 3 | #define CONFIG_SND_DATE "" | 3 | #define CONFIG_SND_DATE "" |
diff --git a/include/sound/wm2000.h b/include/sound/wm2000.h new file mode 100644 index 000000000000..aa388ca9ec64 --- /dev/null +++ b/include/sound/wm2000.h | |||
| @@ -0,0 +1,26 @@ | |||
| 1 | /* | ||
| 2 | * linux/sound/wm2000.h -- Platform data for WM2000 | ||
| 3 | * | ||
| 4 | * Copyright 2010 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_WM2000_H | ||
| 12 | #define __LINUX_SND_WM2000_H | ||
| 13 | |||
| 14 | struct wm2000_platform_data { | ||
| 15 | /** Filename for system-specific image to download to device. */ | ||
| 16 | const char *download_file; | ||
| 17 | |||
| 18 | /** Divide MCLK by 2 for system clock? */ | ||
| 19 | unsigned int mclkdiv2:1; | ||
| 20 | |||
| 21 | /** Disable speech clarity enhancement, for use when an | ||
| 22 | * external algorithm is used. */ | ||
| 23 | unsigned int speech_enh_disable:1; | ||
| 24 | }; | ||
| 25 | |||
| 26 | #endif | ||
diff --git a/include/sound/wm8904.h b/include/sound/wm8904.h new file mode 100644 index 000000000000..d66575a601be --- /dev/null +++ b/include/sound/wm8904.h | |||
| @@ -0,0 +1,57 @@ | |||
| 1 | /* | ||
| 2 | * Platform data for WM8904 | ||
| 3 | * | ||
| 4 | * Copyright 2009 Wolfson Microelectronics PLC. | ||
| 5 | * | ||
| 6 | * Author: Mark Brown <broonie@opensource.wolfsonmicro.com> | ||
| 7 | * | ||
| 8 | * This program is free software; you can redistribute it and/or modify it | ||
| 9 | * under the terms of the GNU General Public License as published by the | ||
| 10 | * Free Software Foundation; either version 2 of the License, or (at your | ||
| 11 | * option) any later version. | ||
| 12 | * | ||
| 13 | */ | ||
| 14 | |||
| 15 | #ifndef __MFD_WM8994_PDATA_H__ | ||
| 16 | #define __MFD_WM8994_PDATA_H__ | ||
| 17 | |||
| 18 | #define WM8904_DRC_REGS 4 | ||
| 19 | #define WM8904_EQ_REGS 25 | ||
| 20 | |||
| 21 | /** | ||
| 22 | * DRC configurations are specified with a label and a set of register | ||
| 23 | * values to write (the enable bits will be ignored). At runtime an | ||
| 24 | * enumerated control will be presented for each DRC block allowing | ||
| 25 | * the user to choose the configration to use. | ||
| 26 | * | ||
| 27 | * Configurations may be generated by hand or by using the DRC control | ||
| 28 | * panel provided by the WISCE - see http://www.wolfsonmicro.com/wisce/ | ||
| 29 | * for details. | ||
| 30 | */ | ||
| 31 | struct wm8904_drc_cfg { | ||
| 32 | const char *name; | ||
| 33 | u16 regs[WM8904_DRC_REGS]; | ||
| 34 | }; | ||
| 35 | |||
| 36 | /** | ||
| 37 | * ReTune Mobile configurations are specified with a label, sample | ||
| 38 | * rate and set of values to write (the enable bits will be ignored). | ||
| 39 | * | ||
| 40 | * Configurations are expected to be generated using the ReTune Mobile | ||
| 41 | * control panel in WISCE - see http://www.wolfsonmicro.com/wisce/ | ||
| 42 | */ | ||
| 43 | struct wm8904_retune_mobile_cfg { | ||
| 44 | const char *name; | ||
| 45 | unsigned int rate; | ||
| 46 | u16 regs[WM8904_EQ_REGS]; | ||
| 47 | }; | ||
| 48 | |||
| 49 | struct wm8904_pdata { | ||
| 50 | int num_drc_cfgs; | ||
| 51 | struct wm8904_drc_cfg *drc_cfgs; | ||
| 52 | |||
| 53 | int num_retune_mobile_cfgs; | ||
| 54 | struct wm8904_retune_mobile_cfg *retune_mobile_cfgs; | ||
| 55 | }; | ||
| 56 | |||
| 57 | #endif | ||
diff --git a/include/sound/wm8955.h b/include/sound/wm8955.h new file mode 100644 index 000000000000..5074ef499f40 --- /dev/null +++ b/include/sound/wm8955.h | |||
| @@ -0,0 +1,26 @@ | |||
| 1 | /* | ||
| 2 | * Platform data for WM8955 | ||
| 3 | * | ||
| 4 | * Copyright 2009 Wolfson Microelectronics PLC. | ||
| 5 | * | ||
| 6 | * Author: Mark Brown <broonie@opensource.wolfsonmicro.com> | ||
| 7 | * | ||
| 8 | * This program is free software; you can redistribute it and/or modify it | ||
| 9 | * under the terms of the GNU General Public License as published by the | ||
| 10 | * Free Software Foundation; either version 2 of the License, or (at your | ||
| 11 | * option) any later version. | ||
| 12 | * | ||
| 13 | */ | ||
| 14 | |||
| 15 | #ifndef __WM8955_PDATA_H__ | ||
| 16 | #define __WM8955_PDATA_H__ | ||
| 17 | |||
| 18 | struct wm8955_pdata { | ||
| 19 | /* Configure LOUT2/ROUT2 to drive a speaker */ | ||
| 20 | unsigned int out2_speaker:1; | ||
| 21 | |||
| 22 | /* Configure MONOIN+/- in differential mode */ | ||
| 23 | unsigned int monoin_diff:1; | ||
| 24 | }; | ||
| 25 | |||
| 26 | #endif | ||
diff --git a/include/sound/wm8993.h b/include/sound/wm8993.h index 9c661f2f8cda..eee19f63c0d8 100644 --- a/include/sound/wm8993.h +++ b/include/sound/wm8993.h | |||
| @@ -36,7 +36,7 @@ struct wm8993_platform_data { | |||
| 36 | unsigned int micbias1_lvl:1; | 36 | unsigned int micbias1_lvl:1; |
| 37 | unsigned int micbias2_lvl:1; | 37 | unsigned int micbias2_lvl:1; |
| 38 | 38 | ||
| 39 | /* Jack detect threashold levels, see datasheet for values */ | 39 | /* Jack detect threshold levels, see datasheet for values */ |
| 40 | unsigned int jd_scthr:2; | 40 | unsigned int jd_scthr:2; |
| 41 | unsigned int jd_thr:2; | 41 | unsigned int jd_thr:2; |
| 42 | }; | 42 | }; |
diff --git a/include/sound/wss.h b/include/sound/wss.h index 6d65f322f1d5..fd01f22825cd 100644 --- a/include/sound/wss.h +++ b/include/sound/wss.h | |||
| @@ -154,7 +154,6 @@ int snd_wss_create(struct snd_card *card, | |||
| 154 | unsigned short hardware, | 154 | unsigned short hardware, |
| 155 | unsigned short hwshare, | 155 | unsigned short hwshare, |
| 156 | struct snd_wss **rchip); | 156 | struct snd_wss **rchip); |
| 157 | int snd_wss_free(struct snd_wss *chip); | ||
| 158 | int snd_wss_pcm(struct snd_wss *chip, int device, struct snd_pcm **rpcm); | 157 | int snd_wss_pcm(struct snd_wss *chip, int device, struct snd_pcm **rpcm); |
| 159 | int snd_wss_timer(struct snd_wss *chip, int device, struct snd_timer **rtimer); | 158 | int snd_wss_timer(struct snd_wss *chip, int device, struct snd_timer **rtimer); |
| 160 | int snd_wss_mixer(struct snd_wss *chip); | 159 | int snd_wss_mixer(struct snd_wss *chip); |
diff --git a/include/trace/define_trace.h b/include/trace/define_trace.h index 2a4b3bf74033..5acfb1eb4df9 100644 --- a/include/trace/define_trace.h +++ b/include/trace/define_trace.h | |||
| @@ -31,6 +31,14 @@ | |||
| 31 | assign, print, reg, unreg) \ | 31 | assign, print, reg, unreg) \ |
| 32 | DEFINE_TRACE_FN(name, reg, unreg) | 32 | DEFINE_TRACE_FN(name, reg, unreg) |
| 33 | 33 | ||
| 34 | #undef DEFINE_EVENT | ||
| 35 | #define DEFINE_EVENT(template, name, proto, args) \ | ||
| 36 | DEFINE_TRACE(name) | ||
| 37 | |||
| 38 | #undef DEFINE_EVENT_PRINT | ||
| 39 | #define DEFINE_EVENT_PRINT(template, name, proto, args, print) \ | ||
| 40 | DEFINE_TRACE(name) | ||
| 41 | |||
| 34 | #undef DECLARE_TRACE | 42 | #undef DECLARE_TRACE |
| 35 | #define DECLARE_TRACE(name, proto, args) \ | 43 | #define DECLARE_TRACE(name, proto, args) \ |
| 36 | DEFINE_TRACE(name) | 44 | DEFINE_TRACE(name) |
| @@ -63,6 +71,9 @@ | |||
| 63 | 71 | ||
| 64 | #undef TRACE_EVENT | 72 | #undef TRACE_EVENT |
| 65 | #undef TRACE_EVENT_FN | 73 | #undef TRACE_EVENT_FN |
| 74 | #undef DECLARE_EVENT_CLASS | ||
| 75 | #undef DEFINE_EVENT | ||
| 76 | #undef DEFINE_EVENT_PRINT | ||
| 66 | #undef TRACE_HEADER_MULTI_READ | 77 | #undef TRACE_HEADER_MULTI_READ |
| 67 | 78 | ||
| 68 | /* Only undef what we defined in this file */ | 79 | /* Only undef what we defined in this file */ |
diff --git a/include/trace/events/bkl.h b/include/trace/events/bkl.h new file mode 100644 index 000000000000..1af72dc24278 --- /dev/null +++ b/include/trace/events/bkl.h | |||
| @@ -0,0 +1,61 @@ | |||
| 1 | #undef TRACE_SYSTEM | ||
| 2 | #define TRACE_SYSTEM bkl | ||
| 3 | |||
| 4 | #if !defined(_TRACE_BKL_H) || defined(TRACE_HEADER_MULTI_READ) | ||
| 5 | #define _TRACE_BKL_H | ||
| 6 | |||
| 7 | #include <linux/tracepoint.h> | ||
| 8 | |||
| 9 | TRACE_EVENT(lock_kernel, | ||
| 10 | |||
| 11 | TP_PROTO(const char *func, const char *file, int line), | ||
| 12 | |||
| 13 | TP_ARGS(func, file, line), | ||
| 14 | |||
| 15 | TP_STRUCT__entry( | ||
| 16 | __field( int, depth ) | ||
| 17 | __field_ext( const char *, func, FILTER_PTR_STRING ) | ||
| 18 | __field_ext( const char *, file, FILTER_PTR_STRING ) | ||
| 19 | __field( int, line ) | ||
| 20 | ), | ||
| 21 | |||
| 22 | TP_fast_assign( | ||
| 23 | /* We want to record the lock_depth after lock is acquired */ | ||
| 24 | __entry->depth = current->lock_depth + 1; | ||
| 25 | __entry->func = func; | ||
| 26 | __entry->file = file; | ||
| 27 | __entry->line = line; | ||
| 28 | ), | ||
| 29 | |||
| 30 | TP_printk("depth=%d file:line=%s:%d func=%s()", __entry->depth, | ||
| 31 | __entry->file, __entry->line, __entry->func) | ||
| 32 | ); | ||
| 33 | |||
| 34 | TRACE_EVENT(unlock_kernel, | ||
| 35 | |||
| 36 | TP_PROTO(const char *func, const char *file, int line), | ||
| 37 | |||
| 38 | TP_ARGS(func, file, line), | ||
| 39 | |||
| 40 | TP_STRUCT__entry( | ||
| 41 | __field(int, depth ) | ||
| 42 | __field(const char *, func ) | ||
| 43 | __field(const char *, file ) | ||
| 44 | __field(int, line ) | ||
| 45 | ), | ||
| 46 | |||
| 47 | TP_fast_assign( | ||
| 48 | __entry->depth = current->lock_depth; | ||
| 49 | __entry->func = func; | ||
| 50 | __entry->file = file; | ||
| 51 | __entry->line = line; | ||
| 52 | ), | ||
| 53 | |||
| 54 | TP_printk("depth=%d file:line=%s:%d func=%s()", __entry->depth, | ||
| 55 | __entry->file, __entry->line, __entry->func) | ||
| 56 | ); | ||
| 57 | |||
| 58 | #endif /* _TRACE_BKL_H */ | ||
| 59 | |||
| 60 | /* This part must be outside protection */ | ||
| 61 | #include <trace/define_trace.h> | ||
diff --git a/include/trace/events/block.h b/include/trace/events/block.h index 00405b5f624a..d870a918559c 100644 --- a/include/trace/events/block.h +++ b/include/trace/events/block.h | |||
| @@ -8,7 +8,7 @@ | |||
| 8 | #include <linux/blkdev.h> | 8 | #include <linux/blkdev.h> |
| 9 | #include <linux/tracepoint.h> | 9 | #include <linux/tracepoint.h> |
| 10 | 10 | ||
| 11 | TRACE_EVENT(block_rq_abort, | 11 | DECLARE_EVENT_CLASS(block_rq_with_error, |
| 12 | 12 | ||
| 13 | TP_PROTO(struct request_queue *q, struct request *rq), | 13 | TP_PROTO(struct request_queue *q, struct request *rq), |
| 14 | 14 | ||
| @@ -40,41 +40,58 @@ TRACE_EVENT(block_rq_abort, | |||
| 40 | __entry->nr_sector, __entry->errors) | 40 | __entry->nr_sector, __entry->errors) |
| 41 | ); | 41 | ); |
| 42 | 42 | ||
| 43 | TRACE_EVENT(block_rq_insert, | 43 | /** |
| 44 | * block_rq_abort - abort block operation request | ||
| 45 | * @q: queue containing the block operation request | ||
| 46 | * @rq: block IO operation request | ||
| 47 | * | ||
| 48 | * Called immediately after pending block IO operation request @rq in | ||
| 49 | * queue @q is aborted. The fields in the operation request @rq | ||
| 50 | * can be examined to determine which device and sectors the pending | ||
| 51 | * operation would access. | ||
| 52 | */ | ||
| 53 | DEFINE_EVENT(block_rq_with_error, block_rq_abort, | ||
| 44 | 54 | ||
| 45 | TP_PROTO(struct request_queue *q, struct request *rq), | 55 | TP_PROTO(struct request_queue *q, struct request *rq), |
| 46 | 56 | ||
| 47 | TP_ARGS(q, rq), | 57 | TP_ARGS(q, rq) |
| 58 | ); | ||
| 48 | 59 | ||
| 49 | TP_STRUCT__entry( | 60 | /** |
| 50 | __field( dev_t, dev ) | 61 | * block_rq_requeue - place block IO request back on a queue |
| 51 | __field( sector_t, sector ) | 62 | * @q: queue holding operation |
| 52 | __field( unsigned int, nr_sector ) | 63 | * @rq: block IO operation request |
| 53 | __field( unsigned int, bytes ) | 64 | * |
| 54 | __array( char, rwbs, 6 ) | 65 | * The block operation request @rq is being placed back into queue |
| 55 | __array( char, comm, TASK_COMM_LEN ) | 66 | * @q. For some reason the request was not completed and needs to be |
| 56 | __dynamic_array( char, cmd, blk_cmd_buf_len(rq) ) | 67 | * put back in the queue. |
| 57 | ), | 68 | */ |
| 69 | DEFINE_EVENT(block_rq_with_error, block_rq_requeue, | ||
| 58 | 70 | ||
| 59 | TP_fast_assign( | 71 | TP_PROTO(struct request_queue *q, struct request *rq), |
| 60 | __entry->dev = rq->rq_disk ? disk_devt(rq->rq_disk) : 0; | ||
| 61 | __entry->sector = blk_pc_request(rq) ? 0 : blk_rq_pos(rq); | ||
| 62 | __entry->nr_sector = blk_pc_request(rq) ? 0 : blk_rq_sectors(rq); | ||
| 63 | __entry->bytes = blk_pc_request(rq) ? blk_rq_bytes(rq) : 0; | ||
| 64 | 72 | ||
| 65 | blk_fill_rwbs_rq(__entry->rwbs, rq); | 73 | TP_ARGS(q, rq) |
| 66 | blk_dump_cmd(__get_str(cmd), rq); | 74 | ); |
| 67 | memcpy(__entry->comm, current->comm, TASK_COMM_LEN); | ||
| 68 | ), | ||
| 69 | 75 | ||
| 70 | TP_printk("%d,%d %s %u (%s) %llu + %u [%s]", | 76 | /** |
| 71 | MAJOR(__entry->dev), MINOR(__entry->dev), | 77 | * block_rq_complete - block IO operation completed by device driver |
| 72 | __entry->rwbs, __entry->bytes, __get_str(cmd), | 78 | * @q: queue containing the block operation request |
| 73 | (unsigned long long)__entry->sector, | 79 | * @rq: block operations request |
| 74 | __entry->nr_sector, __entry->comm) | 80 | * |
| 81 | * The block_rq_complete tracepoint event indicates that some portion | ||
| 82 | * of operation request has been completed by the device driver. If | ||
| 83 | * the @rq->bio is %NULL, then there is absolutely no additional work to | ||
| 84 | * do for the request. If @rq->bio is non-NULL then there is | ||
| 85 | * additional work required to complete the request. | ||
| 86 | */ | ||
| 87 | DEFINE_EVENT(block_rq_with_error, block_rq_complete, | ||
| 88 | |||
| 89 | TP_PROTO(struct request_queue *q, struct request *rq), | ||
| 90 | |||
| 91 | TP_ARGS(q, rq) | ||
| 75 | ); | 92 | ); |
| 76 | 93 | ||
| 77 | TRACE_EVENT(block_rq_issue, | 94 | DECLARE_EVENT_CLASS(block_rq, |
| 78 | 95 | ||
| 79 | TP_PROTO(struct request_queue *q, struct request *rq), | 96 | TP_PROTO(struct request_queue *q, struct request *rq), |
| 80 | 97 | ||
| @@ -86,7 +103,7 @@ TRACE_EVENT(block_rq_issue, | |||
| 86 | __field( unsigned int, nr_sector ) | 103 | __field( unsigned int, nr_sector ) |
| 87 | __field( unsigned int, bytes ) | 104 | __field( unsigned int, bytes ) |
| 88 | __array( char, rwbs, 6 ) | 105 | __array( char, rwbs, 6 ) |
| 89 | __array( char, comm, TASK_COMM_LEN ) | 106 | __array( char, comm, TASK_COMM_LEN ) |
| 90 | __dynamic_array( char, cmd, blk_cmd_buf_len(rq) ) | 107 | __dynamic_array( char, cmd, blk_cmd_buf_len(rq) ) |
| 91 | ), | 108 | ), |
| 92 | 109 | ||
| @@ -108,70 +125,49 @@ TRACE_EVENT(block_rq_issue, | |||
| 108 | __entry->nr_sector, __entry->comm) | 125 | __entry->nr_sector, __entry->comm) |
| 109 | ); | 126 | ); |
| 110 | 127 | ||
| 111 | TRACE_EVENT(block_rq_requeue, | 128 | /** |
| 129 | * block_rq_insert - insert block operation request into queue | ||
| 130 | * @q: target queue | ||
| 131 | * @rq: block IO operation request | ||
| 132 | * | ||
| 133 | * Called immediately before block operation request @rq is inserted | ||
| 134 | * into queue @q. The fields in the operation request @rq struct can | ||
| 135 | * be examined to determine which device and sectors the pending | ||
| 136 | * operation would access. | ||
| 137 | */ | ||
| 138 | DEFINE_EVENT(block_rq, block_rq_insert, | ||
| 112 | 139 | ||
| 113 | TP_PROTO(struct request_queue *q, struct request *rq), | 140 | TP_PROTO(struct request_queue *q, struct request *rq), |
| 114 | 141 | ||
| 115 | TP_ARGS(q, rq), | 142 | TP_ARGS(q, rq) |
| 116 | |||
| 117 | TP_STRUCT__entry( | ||
| 118 | __field( dev_t, dev ) | ||
| 119 | __field( sector_t, sector ) | ||
| 120 | __field( unsigned int, nr_sector ) | ||
| 121 | __field( int, errors ) | ||
| 122 | __array( char, rwbs, 6 ) | ||
| 123 | __dynamic_array( char, cmd, blk_cmd_buf_len(rq) ) | ||
| 124 | ), | ||
| 125 | |||
| 126 | TP_fast_assign( | ||
| 127 | __entry->dev = rq->rq_disk ? disk_devt(rq->rq_disk) : 0; | ||
| 128 | __entry->sector = blk_pc_request(rq) ? 0 : blk_rq_pos(rq); | ||
| 129 | __entry->nr_sector = blk_pc_request(rq) ? 0 : blk_rq_sectors(rq); | ||
| 130 | __entry->errors = rq->errors; | ||
| 131 | |||
| 132 | blk_fill_rwbs_rq(__entry->rwbs, rq); | ||
| 133 | blk_dump_cmd(__get_str(cmd), rq); | ||
| 134 | ), | ||
| 135 | |||
| 136 | TP_printk("%d,%d %s (%s) %llu + %u [%d]", | ||
| 137 | MAJOR(__entry->dev), MINOR(__entry->dev), | ||
| 138 | __entry->rwbs, __get_str(cmd), | ||
| 139 | (unsigned long long)__entry->sector, | ||
| 140 | __entry->nr_sector, __entry->errors) | ||
| 141 | ); | 143 | ); |
| 142 | 144 | ||
| 143 | TRACE_EVENT(block_rq_complete, | 145 | /** |
| 146 | * block_rq_issue - issue pending block IO request operation to device driver | ||
| 147 | * @q: queue holding operation | ||
| 148 | * @rq: block IO operation operation request | ||
| 149 | * | ||
| 150 | * Called when block operation request @rq from queue @q is sent to a | ||
| 151 | * device driver for processing. | ||
| 152 | */ | ||
| 153 | DEFINE_EVENT(block_rq, block_rq_issue, | ||
| 144 | 154 | ||
| 145 | TP_PROTO(struct request_queue *q, struct request *rq), | 155 | TP_PROTO(struct request_queue *q, struct request *rq), |
| 146 | 156 | ||
| 147 | TP_ARGS(q, rq), | 157 | TP_ARGS(q, rq) |
| 148 | |||
| 149 | TP_STRUCT__entry( | ||
| 150 | __field( dev_t, dev ) | ||
| 151 | __field( sector_t, sector ) | ||
| 152 | __field( unsigned int, nr_sector ) | ||
| 153 | __field( int, errors ) | ||
| 154 | __array( char, rwbs, 6 ) | ||
| 155 | __dynamic_array( char, cmd, blk_cmd_buf_len(rq) ) | ||
| 156 | ), | ||
| 157 | |||
| 158 | TP_fast_assign( | ||
| 159 | __entry->dev = rq->rq_disk ? disk_devt(rq->rq_disk) : 0; | ||
| 160 | __entry->sector = blk_pc_request(rq) ? 0 : blk_rq_pos(rq); | ||
| 161 | __entry->nr_sector = blk_pc_request(rq) ? 0 : blk_rq_sectors(rq); | ||
| 162 | __entry->errors = rq->errors; | ||
| 163 | |||
| 164 | blk_fill_rwbs_rq(__entry->rwbs, rq); | ||
| 165 | blk_dump_cmd(__get_str(cmd), rq); | ||
| 166 | ), | ||
| 167 | |||
| 168 | TP_printk("%d,%d %s (%s) %llu + %u [%d]", | ||
| 169 | MAJOR(__entry->dev), MINOR(__entry->dev), | ||
| 170 | __entry->rwbs, __get_str(cmd), | ||
| 171 | (unsigned long long)__entry->sector, | ||
| 172 | __entry->nr_sector, __entry->errors) | ||
| 173 | ); | 158 | ); |
| 174 | 159 | ||
| 160 | /** | ||
| 161 | * block_bio_bounce - used bounce buffer when processing block operation | ||
| 162 | * @q: queue holding the block operation | ||
| 163 | * @bio: block operation | ||
| 164 | * | ||
| 165 | * A bounce buffer was used to handle the block operation @bio in @q. | ||
| 166 | * This occurs when hardware limitations prevent a direct transfer of | ||
| 167 | * data between the @bio data memory area and the IO device. Use of a | ||
| 168 | * bounce buffer requires extra copying of data and decreases | ||
| 169 | * performance. | ||
| 170 | */ | ||
| 175 | TRACE_EVENT(block_bio_bounce, | 171 | TRACE_EVENT(block_bio_bounce, |
| 176 | 172 | ||
| 177 | TP_PROTO(struct request_queue *q, struct bio *bio), | 173 | TP_PROTO(struct request_queue *q, struct bio *bio), |
| @@ -201,6 +197,14 @@ TRACE_EVENT(block_bio_bounce, | |||
| 201 | __entry->nr_sector, __entry->comm) | 197 | __entry->nr_sector, __entry->comm) |
| 202 | ); | 198 | ); |
| 203 | 199 | ||
| 200 | /** | ||
| 201 | * block_bio_complete - completed all work on the block operation | ||
| 202 | * @q: queue holding the block operation | ||
| 203 | * @bio: block operation completed | ||
| 204 | * | ||
| 205 | * This tracepoint indicates there is no further work to do on this | ||
| 206 | * block IO operation @bio. | ||
| 207 | */ | ||
| 204 | TRACE_EVENT(block_bio_complete, | 208 | TRACE_EVENT(block_bio_complete, |
| 205 | 209 | ||
| 206 | TP_PROTO(struct request_queue *q, struct bio *bio), | 210 | TP_PROTO(struct request_queue *q, struct bio *bio), |
| @@ -228,7 +232,7 @@ TRACE_EVENT(block_bio_complete, | |||
| 228 | __entry->nr_sector, __entry->error) | 232 | __entry->nr_sector, __entry->error) |
| 229 | ); | 233 | ); |
| 230 | 234 | ||
| 231 | TRACE_EVENT(block_bio_backmerge, | 235 | DECLARE_EVENT_CLASS(block_bio, |
| 232 | 236 | ||
| 233 | TP_PROTO(struct request_queue *q, struct bio *bio), | 237 | TP_PROTO(struct request_queue *q, struct bio *bio), |
| 234 | 238 | ||
| @@ -256,63 +260,51 @@ TRACE_EVENT(block_bio_backmerge, | |||
| 256 | __entry->nr_sector, __entry->comm) | 260 | __entry->nr_sector, __entry->comm) |
| 257 | ); | 261 | ); |
| 258 | 262 | ||
| 259 | TRACE_EVENT(block_bio_frontmerge, | 263 | /** |
| 264 | * block_bio_backmerge - merging block operation to the end of an existing operation | ||
| 265 | * @q: queue holding operation | ||
| 266 | * @bio: new block operation to merge | ||
| 267 | * | ||
| 268 | * Merging block request @bio to the end of an existing block request | ||
| 269 | * in queue @q. | ||
| 270 | */ | ||
| 271 | DEFINE_EVENT(block_bio, block_bio_backmerge, | ||
| 260 | 272 | ||
| 261 | TP_PROTO(struct request_queue *q, struct bio *bio), | 273 | TP_PROTO(struct request_queue *q, struct bio *bio), |
| 262 | 274 | ||
| 263 | TP_ARGS(q, bio), | 275 | TP_ARGS(q, bio) |
| 264 | |||
| 265 | TP_STRUCT__entry( | ||
| 266 | __field( dev_t, dev ) | ||
| 267 | __field( sector_t, sector ) | ||
| 268 | __field( unsigned, nr_sector ) | ||
| 269 | __array( char, rwbs, 6 ) | ||
| 270 | __array( char, comm, TASK_COMM_LEN ) | ||
| 271 | ), | ||
| 272 | |||
| 273 | TP_fast_assign( | ||
| 274 | __entry->dev = bio->bi_bdev->bd_dev; | ||
| 275 | __entry->sector = bio->bi_sector; | ||
| 276 | __entry->nr_sector = bio->bi_size >> 9; | ||
| 277 | blk_fill_rwbs(__entry->rwbs, bio->bi_rw, bio->bi_size); | ||
| 278 | memcpy(__entry->comm, current->comm, TASK_COMM_LEN); | ||
| 279 | ), | ||
| 280 | |||
| 281 | TP_printk("%d,%d %s %llu + %u [%s]", | ||
| 282 | MAJOR(__entry->dev), MINOR(__entry->dev), __entry->rwbs, | ||
| 283 | (unsigned long long)__entry->sector, | ||
| 284 | __entry->nr_sector, __entry->comm) | ||
| 285 | ); | 276 | ); |
| 286 | 277 | ||
| 287 | TRACE_EVENT(block_bio_queue, | 278 | /** |
| 279 | * block_bio_frontmerge - merging block operation to the beginning of an existing operation | ||
| 280 | * @q: queue holding operation | ||
| 281 | * @bio: new block operation to merge | ||
| 282 | * | ||
| 283 | * Merging block IO operation @bio to the beginning of an existing block | ||
| 284 | * operation in queue @q. | ||
| 285 | */ | ||
| 286 | DEFINE_EVENT(block_bio, block_bio_frontmerge, | ||
| 288 | 287 | ||
| 289 | TP_PROTO(struct request_queue *q, struct bio *bio), | 288 | TP_PROTO(struct request_queue *q, struct bio *bio), |
| 290 | 289 | ||
| 291 | TP_ARGS(q, bio), | 290 | TP_ARGS(q, bio) |
| 291 | ); | ||
| 292 | 292 | ||
| 293 | TP_STRUCT__entry( | 293 | /** |
| 294 | __field( dev_t, dev ) | 294 | * block_bio_queue - putting new block IO operation in queue |
| 295 | __field( sector_t, sector ) | 295 | * @q: queue holding operation |
| 296 | __field( unsigned int, nr_sector ) | 296 | * @bio: new block operation |
| 297 | __array( char, rwbs, 6 ) | 297 | * |
| 298 | __array( char, comm, TASK_COMM_LEN ) | 298 | * About to place the block IO operation @bio into queue @q. |
| 299 | ), | 299 | */ |
| 300 | DEFINE_EVENT(block_bio, block_bio_queue, | ||
| 300 | 301 | ||
| 301 | TP_fast_assign( | 302 | TP_PROTO(struct request_queue *q, struct bio *bio), |
| 302 | __entry->dev = bio->bi_bdev->bd_dev; | ||
| 303 | __entry->sector = bio->bi_sector; | ||
| 304 | __entry->nr_sector = bio->bi_size >> 9; | ||
| 305 | blk_fill_rwbs(__entry->rwbs, bio->bi_rw, bio->bi_size); | ||
| 306 | memcpy(__entry->comm, current->comm, TASK_COMM_LEN); | ||
| 307 | ), | ||
| 308 | 303 | ||
| 309 | TP_printk("%d,%d %s %llu + %u [%s]", | 304 | TP_ARGS(q, bio) |
| 310 | MAJOR(__entry->dev), MINOR(__entry->dev), __entry->rwbs, | ||
| 311 | (unsigned long long)__entry->sector, | ||
| 312 | __entry->nr_sector, __entry->comm) | ||
| 313 | ); | 305 | ); |
| 314 | 306 | ||
| 315 | TRACE_EVENT(block_getrq, | 307 | DECLARE_EVENT_CLASS(block_get_rq, |
| 316 | 308 | ||
| 317 | TP_PROTO(struct request_queue *q, struct bio *bio, int rw), | 309 | TP_PROTO(struct request_queue *q, struct bio *bio, int rw), |
| 318 | 310 | ||
| @@ -341,35 +333,48 @@ TRACE_EVENT(block_getrq, | |||
| 341 | __entry->nr_sector, __entry->comm) | 333 | __entry->nr_sector, __entry->comm) |
| 342 | ); | 334 | ); |
| 343 | 335 | ||
| 344 | TRACE_EVENT(block_sleeprq, | 336 | /** |
| 337 | * block_getrq - get a free request entry in queue for block IO operations | ||
| 338 | * @q: queue for operations | ||
| 339 | * @bio: pending block IO operation | ||
| 340 | * @rw: low bit indicates a read (%0) or a write (%1) | ||
| 341 | * | ||
| 342 | * A request struct for queue @q has been allocated to handle the | ||
| 343 | * block IO operation @bio. | ||
| 344 | */ | ||
| 345 | DEFINE_EVENT(block_get_rq, block_getrq, | ||
| 345 | 346 | ||
| 346 | TP_PROTO(struct request_queue *q, struct bio *bio, int rw), | 347 | TP_PROTO(struct request_queue *q, struct bio *bio, int rw), |
| 347 | 348 | ||
| 348 | TP_ARGS(q, bio, rw), | 349 | TP_ARGS(q, bio, rw) |
| 350 | ); | ||
| 349 | 351 | ||
| 350 | TP_STRUCT__entry( | 352 | /** |
| 351 | __field( dev_t, dev ) | 353 | * block_sleeprq - waiting to get a free request entry in queue for block IO operation |
| 352 | __field( sector_t, sector ) | 354 | * @q: queue for operation |
| 353 | __field( unsigned int, nr_sector ) | 355 | * @bio: pending block IO operation |
| 354 | __array( char, rwbs, 6 ) | 356 | * @rw: low bit indicates a read (%0) or a write (%1) |
| 355 | __array( char, comm, TASK_COMM_LEN ) | 357 | * |
| 356 | ), | 358 | * In the case where a request struct cannot be provided for queue @q |
| 359 | * the process needs to wait for an request struct to become | ||
| 360 | * available. This tracepoint event is generated each time the | ||
| 361 | * process goes to sleep waiting for request struct become available. | ||
| 362 | */ | ||
| 363 | DEFINE_EVENT(block_get_rq, block_sleeprq, | ||
| 357 | 364 | ||
| 358 | TP_fast_assign( | 365 | TP_PROTO(struct request_queue *q, struct bio *bio, int rw), |
| 359 | __entry->dev = bio ? bio->bi_bdev->bd_dev : 0; | ||
| 360 | __entry->sector = bio ? bio->bi_sector : 0; | ||
| 361 | __entry->nr_sector = bio ? bio->bi_size >> 9 : 0; | ||
| 362 | blk_fill_rwbs(__entry->rwbs, | ||
| 363 | bio ? bio->bi_rw : 0, __entry->nr_sector); | ||
| 364 | memcpy(__entry->comm, current->comm, TASK_COMM_LEN); | ||
| 365 | ), | ||
| 366 | 366 | ||
| 367 | TP_printk("%d,%d %s %llu + %u [%s]", | 367 | TP_ARGS(q, bio, rw) |
| 368 | MAJOR(__entry->dev), MINOR(__entry->dev), __entry->rwbs, | ||
| 369 | (unsigned long long)__entry->sector, | ||
| 370 | __entry->nr_sector, __entry->comm) | ||
| 371 | ); | 368 | ); |
| 372 | 369 | ||
| 370 | /** | ||
| 371 | * block_plug - keep operations requests in request queue | ||
| 372 | * @q: request queue to plug | ||
| 373 | * | ||
| 374 | * Plug the request queue @q. Do not allow block operation requests | ||
| 375 | * to be sent to the device driver. Instead, accumulate requests in | ||
| 376 | * the queue to improve throughput performance of the block device. | ||
| 377 | */ | ||
| 373 | TRACE_EVENT(block_plug, | 378 | TRACE_EVENT(block_plug, |
| 374 | 379 | ||
| 375 | TP_PROTO(struct request_queue *q), | 380 | TP_PROTO(struct request_queue *q), |
| @@ -387,7 +392,7 @@ TRACE_EVENT(block_plug, | |||
| 387 | TP_printk("[%s]", __entry->comm) | 392 | TP_printk("[%s]", __entry->comm) |
| 388 | ); | 393 | ); |
| 389 | 394 | ||
| 390 | TRACE_EVENT(block_unplug_timer, | 395 | DECLARE_EVENT_CLASS(block_unplug, |
| 391 | 396 | ||
| 392 | TP_PROTO(struct request_queue *q), | 397 | TP_PROTO(struct request_queue *q), |
| 393 | 398 | ||
| @@ -406,25 +411,45 @@ TRACE_EVENT(block_unplug_timer, | |||
| 406 | TP_printk("[%s] %d", __entry->comm, __entry->nr_rq) | 411 | TP_printk("[%s] %d", __entry->comm, __entry->nr_rq) |
| 407 | ); | 412 | ); |
| 408 | 413 | ||
| 409 | TRACE_EVENT(block_unplug_io, | 414 | /** |
| 415 | * block_unplug_timer - timed release of operations requests in queue to device driver | ||
| 416 | * @q: request queue to unplug | ||
| 417 | * | ||
| 418 | * Unplug the request queue @q because a timer expired and allow block | ||
| 419 | * operation requests to be sent to the device driver. | ||
| 420 | */ | ||
| 421 | DEFINE_EVENT(block_unplug, block_unplug_timer, | ||
| 410 | 422 | ||
| 411 | TP_PROTO(struct request_queue *q), | 423 | TP_PROTO(struct request_queue *q), |
| 412 | 424 | ||
| 413 | TP_ARGS(q), | 425 | TP_ARGS(q) |
| 426 | ); | ||
| 414 | 427 | ||
| 415 | TP_STRUCT__entry( | 428 | /** |
| 416 | __field( int, nr_rq ) | 429 | * block_unplug_io - release of operations requests in request queue |
| 417 | __array( char, comm, TASK_COMM_LEN ) | 430 | * @q: request queue to unplug |
| 418 | ), | 431 | * |
| 432 | * Unplug request queue @q because device driver is scheduled to work | ||
| 433 | * on elements in the request queue. | ||
| 434 | */ | ||
| 435 | DEFINE_EVENT(block_unplug, block_unplug_io, | ||
| 419 | 436 | ||
| 420 | TP_fast_assign( | 437 | TP_PROTO(struct request_queue *q), |
| 421 | __entry->nr_rq = q->rq.count[READ] + q->rq.count[WRITE]; | ||
| 422 | memcpy(__entry->comm, current->comm, TASK_COMM_LEN); | ||
| 423 | ), | ||
| 424 | 438 | ||
| 425 | TP_printk("[%s] %d", __entry->comm, __entry->nr_rq) | 439 | TP_ARGS(q) |
| 426 | ); | 440 | ); |
| 427 | 441 | ||
| 442 | /** | ||
| 443 | * block_split - split a single bio struct into two bio structs | ||
| 444 | * @q: queue containing the bio | ||
| 445 | * @bio: block operation being split | ||
| 446 | * @new_sector: The starting sector for the new bio | ||
| 447 | * | ||
| 448 | * The bio request @bio in request queue @q needs to be split into two | ||
| 449 | * bio requests. The newly created @bio request starts at | ||
| 450 | * @new_sector. This split may be required due to hardware limitation | ||
| 451 | * such as operation crossing device boundaries in a RAID system. | ||
| 452 | */ | ||
| 428 | TRACE_EVENT(block_split, | 453 | TRACE_EVENT(block_split, |
| 429 | 454 | ||
| 430 | TP_PROTO(struct request_queue *q, struct bio *bio, | 455 | TP_PROTO(struct request_queue *q, struct bio *bio, |
| @@ -455,6 +480,16 @@ TRACE_EVENT(block_split, | |||
| 455 | __entry->comm) | 480 | __entry->comm) |
| 456 | ); | 481 | ); |
| 457 | 482 | ||
| 483 | /** | ||
| 484 | * block_remap - map request for a partition to the raw device | ||
| 485 | * @q: queue holding the operation | ||
| 486 | * @bio: revised operation | ||
| 487 | * @dev: device for the operation | ||
| 488 | * @from: original sector for the operation | ||
| 489 | * | ||
| 490 | * An operation for a partition on a block device has been mapped to the | ||
| 491 | * raw block device. | ||
| 492 | */ | ||
| 458 | TRACE_EVENT(block_remap, | 493 | TRACE_EVENT(block_remap, |
| 459 | 494 | ||
| 460 | TP_PROTO(struct request_queue *q, struct bio *bio, dev_t dev, | 495 | TP_PROTO(struct request_queue *q, struct bio *bio, dev_t dev, |
| @@ -488,6 +523,17 @@ TRACE_EVENT(block_remap, | |||
| 488 | (unsigned long long)__entry->old_sector) | 523 | (unsigned long long)__entry->old_sector) |
| 489 | ); | 524 | ); |
| 490 | 525 | ||
| 526 | /** | ||
| 527 | * block_rq_remap - map request for a block operation request | ||
| 528 | * @q: queue holding the operation | ||
| 529 | * @rq: block IO operation request | ||
| 530 | * @dev: device for the operation | ||
| 531 | * @from: original sector for the operation | ||
| 532 | * | ||
| 533 | * The block operation request @rq in @q has been remapped. The block | ||
| 534 | * operation request @rq holds the current information and @from hold | ||
| 535 | * the original sector. | ||
| 536 | */ | ||
| 491 | TRACE_EVENT(block_rq_remap, | 537 | TRACE_EVENT(block_rq_remap, |
| 492 | 538 | ||
| 493 | TP_PROTO(struct request_queue *q, struct request *rq, dev_t dev, | 539 | TP_PROTO(struct request_queue *q, struct request *rq, dev_t dev, |
diff --git a/include/trace/events/ext4.h b/include/trace/events/ext4.h index d09550bf3f95..2aa6aa3e8f61 100644 --- a/include/trace/events/ext4.h +++ b/include/trace/events/ext4.h | |||
| @@ -38,7 +38,7 @@ TRACE_EVENT(ext4_free_inode, | |||
| 38 | __entry->blocks = inode->i_blocks; | 38 | __entry->blocks = inode->i_blocks; |
| 39 | ), | 39 | ), |
| 40 | 40 | ||
| 41 | TP_printk("dev %s ino %lu mode %d uid %u gid %u blocks %llu", | 41 | TP_printk("dev %s ino %lu mode 0%o uid %u gid %u blocks %llu", |
| 42 | jbd2_dev_to_name(__entry->dev), (unsigned long) __entry->ino, | 42 | jbd2_dev_to_name(__entry->dev), (unsigned long) __entry->ino, |
| 43 | __entry->mode, __entry->uid, __entry->gid, | 43 | __entry->mode, __entry->uid, __entry->gid, |
| 44 | (unsigned long long) __entry->blocks) | 44 | (unsigned long long) __entry->blocks) |
| @@ -61,7 +61,7 @@ TRACE_EVENT(ext4_request_inode, | |||
| 61 | __entry->mode = mode; | 61 | __entry->mode = mode; |
| 62 | ), | 62 | ), |
| 63 | 63 | ||
| 64 | TP_printk("dev %s dir %lu mode %d", | 64 | TP_printk("dev %s dir %lu mode 0%o", |
| 65 | jbd2_dev_to_name(__entry->dev), (unsigned long) __entry->dir, | 65 | jbd2_dev_to_name(__entry->dev), (unsigned long) __entry->dir, |
| 66 | __entry->mode) | 66 | __entry->mode) |
| 67 | ); | 67 | ); |
| @@ -85,12 +85,12 @@ TRACE_EVENT(ext4_allocate_inode, | |||
| 85 | __entry->mode = mode; | 85 | __entry->mode = mode; |
| 86 | ), | 86 | ), |
| 87 | 87 | ||
| 88 | TP_printk("dev %s ino %lu dir %lu mode %d", | 88 | TP_printk("dev %s ino %lu dir %lu mode 0%o", |
| 89 | jbd2_dev_to_name(__entry->dev), (unsigned long) __entry->ino, | 89 | jbd2_dev_to_name(__entry->dev), (unsigned long) __entry->ino, |
| 90 | (unsigned long) __entry->dir, __entry->mode) | 90 | (unsigned long) __entry->dir, __entry->mode) |
| 91 | ); | 91 | ); |
| 92 | 92 | ||
| 93 | TRACE_EVENT(ext4_write_begin, | 93 | DECLARE_EVENT_CLASS(ext4__write_begin, |
| 94 | 94 | ||
| 95 | TP_PROTO(struct inode *inode, loff_t pos, unsigned int len, | 95 | TP_PROTO(struct inode *inode, loff_t pos, unsigned int len, |
| 96 | unsigned int flags), | 96 | unsigned int flags), |
| @@ -118,7 +118,23 @@ TRACE_EVENT(ext4_write_begin, | |||
| 118 | __entry->pos, __entry->len, __entry->flags) | 118 | __entry->pos, __entry->len, __entry->flags) |
| 119 | ); | 119 | ); |
| 120 | 120 | ||
| 121 | TRACE_EVENT(ext4_ordered_write_end, | 121 | DEFINE_EVENT(ext4__write_begin, ext4_write_begin, |
| 122 | |||
| 123 | TP_PROTO(struct inode *inode, loff_t pos, unsigned int len, | ||
| 124 | unsigned int flags), | ||
| 125 | |||
| 126 | TP_ARGS(inode, pos, len, flags) | ||
| 127 | ); | ||
| 128 | |||
| 129 | DEFINE_EVENT(ext4__write_begin, ext4_da_write_begin, | ||
| 130 | |||
| 131 | TP_PROTO(struct inode *inode, loff_t pos, unsigned int len, | ||
| 132 | unsigned int flags), | ||
| 133 | |||
| 134 | TP_ARGS(inode, pos, len, flags) | ||
| 135 | ); | ||
| 136 | |||
| 137 | DECLARE_EVENT_CLASS(ext4__write_end, | ||
| 122 | TP_PROTO(struct inode *inode, loff_t pos, unsigned int len, | 138 | TP_PROTO(struct inode *inode, loff_t pos, unsigned int len, |
| 123 | unsigned int copied), | 139 | unsigned int copied), |
| 124 | 140 | ||
| @@ -145,57 +161,36 @@ TRACE_EVENT(ext4_ordered_write_end, | |||
| 145 | __entry->pos, __entry->len, __entry->copied) | 161 | __entry->pos, __entry->len, __entry->copied) |
| 146 | ); | 162 | ); |
| 147 | 163 | ||
| 148 | TRACE_EVENT(ext4_writeback_write_end, | 164 | DEFINE_EVENT(ext4__write_end, ext4_ordered_write_end, |
| 165 | |||
| 149 | TP_PROTO(struct inode *inode, loff_t pos, unsigned int len, | 166 | TP_PROTO(struct inode *inode, loff_t pos, unsigned int len, |
| 150 | unsigned int copied), | 167 | unsigned int copied), |
| 151 | 168 | ||
| 152 | TP_ARGS(inode, pos, len, copied), | 169 | TP_ARGS(inode, pos, len, copied) |
| 170 | ); | ||
| 153 | 171 | ||
| 154 | TP_STRUCT__entry( | 172 | DEFINE_EVENT(ext4__write_end, ext4_writeback_write_end, |
| 155 | __field( dev_t, dev ) | ||
| 156 | __field( ino_t, ino ) | ||
| 157 | __field( loff_t, pos ) | ||
| 158 | __field( unsigned int, len ) | ||
| 159 | __field( unsigned int, copied ) | ||
| 160 | ), | ||
| 161 | 173 | ||
| 162 | TP_fast_assign( | 174 | TP_PROTO(struct inode *inode, loff_t pos, unsigned int len, |
| 163 | __entry->dev = inode->i_sb->s_dev; | 175 | unsigned int copied), |
| 164 | __entry->ino = inode->i_ino; | ||
| 165 | __entry->pos = pos; | ||
| 166 | __entry->len = len; | ||
| 167 | __entry->copied = copied; | ||
| 168 | ), | ||
| 169 | 176 | ||
| 170 | TP_printk("dev %s ino %lu pos %llu len %u copied %u", | 177 | TP_ARGS(inode, pos, len, copied) |
| 171 | jbd2_dev_to_name(__entry->dev), (unsigned long) __entry->ino, | ||
| 172 | __entry->pos, __entry->len, __entry->copied) | ||
| 173 | ); | 178 | ); |
| 174 | 179 | ||
| 175 | TRACE_EVENT(ext4_journalled_write_end, | 180 | DEFINE_EVENT(ext4__write_end, ext4_journalled_write_end, |
| 181 | |||
| 176 | TP_PROTO(struct inode *inode, loff_t pos, unsigned int len, | 182 | TP_PROTO(struct inode *inode, loff_t pos, unsigned int len, |
| 177 | unsigned int copied), | 183 | unsigned int copied), |
| 178 | TP_ARGS(inode, pos, len, copied), | ||
| 179 | 184 | ||
| 180 | TP_STRUCT__entry( | 185 | TP_ARGS(inode, pos, len, copied) |
| 181 | __field( dev_t, dev ) | 186 | ); |
| 182 | __field( ino_t, ino ) | ||
| 183 | __field( loff_t, pos ) | ||
| 184 | __field( unsigned int, len ) | ||
| 185 | __field( unsigned int, copied ) | ||
| 186 | ), | ||
| 187 | 187 | ||
| 188 | TP_fast_assign( | 188 | DEFINE_EVENT(ext4__write_end, ext4_da_write_end, |
| 189 | __entry->dev = inode->i_sb->s_dev; | ||
| 190 | __entry->ino = inode->i_ino; | ||
| 191 | __entry->pos = pos; | ||
| 192 | __entry->len = len; | ||
| 193 | __entry->copied = copied; | ||
| 194 | ), | ||
| 195 | 189 | ||
| 196 | TP_printk("dev %s ino %lu pos %llu len %u copied %u", | 190 | TP_PROTO(struct inode *inode, loff_t pos, unsigned int len, |
| 197 | jbd2_dev_to_name(__entry->dev), (unsigned long) __entry->ino, | 191 | unsigned int copied), |
| 198 | __entry->pos, __entry->len, __entry->copied) | 192 | |
| 193 | TP_ARGS(inode, pos, len, copied) | ||
| 199 | ); | 194 | ); |
| 200 | 195 | ||
| 201 | TRACE_EVENT(ext4_writepage, | 196 | TRACE_EVENT(ext4_writepage, |
| @@ -310,7 +305,6 @@ TRACE_EVENT(ext4_da_writepages_result, | |||
| 310 | __field( int, ret ) | 305 | __field( int, ret ) |
| 311 | __field( int, pages_written ) | 306 | __field( int, pages_written ) |
| 312 | __field( long, pages_skipped ) | 307 | __field( long, pages_skipped ) |
| 313 | __field( char, encountered_congestion ) | ||
| 314 | __field( char, more_io ) | 308 | __field( char, more_io ) |
| 315 | __field( char, no_nrwrite_index_update ) | 309 | __field( char, no_nrwrite_index_update ) |
| 316 | __field( pgoff_t, writeback_index ) | 310 | __field( pgoff_t, writeback_index ) |
| @@ -322,75 +316,20 @@ TRACE_EVENT(ext4_da_writepages_result, | |||
| 322 | __entry->ret = ret; | 316 | __entry->ret = ret; |
| 323 | __entry->pages_written = pages_written; | 317 | __entry->pages_written = pages_written; |
| 324 | __entry->pages_skipped = wbc->pages_skipped; | 318 | __entry->pages_skipped = wbc->pages_skipped; |
| 325 | __entry->encountered_congestion = wbc->encountered_congestion; | ||
| 326 | __entry->more_io = wbc->more_io; | 319 | __entry->more_io = wbc->more_io; |
| 327 | __entry->no_nrwrite_index_update = wbc->no_nrwrite_index_update; | 320 | __entry->no_nrwrite_index_update = wbc->no_nrwrite_index_update; |
| 328 | __entry->writeback_index = inode->i_mapping->writeback_index; | 321 | __entry->writeback_index = inode->i_mapping->writeback_index; |
| 329 | ), | 322 | ), |
| 330 | 323 | ||
| 331 | TP_printk("dev %s ino %lu ret %d pages_written %d pages_skipped %ld congestion %d more_io %d no_nrwrite_index_update %d writeback_index %lu", | 324 | TP_printk("dev %s ino %lu ret %d pages_written %d pages_skipped %ld more_io %d no_nrwrite_index_update %d writeback_index %lu", |
| 332 | jbd2_dev_to_name(__entry->dev), | 325 | jbd2_dev_to_name(__entry->dev), |
| 333 | (unsigned long) __entry->ino, __entry->ret, | 326 | (unsigned long) __entry->ino, __entry->ret, |
| 334 | __entry->pages_written, __entry->pages_skipped, | 327 | __entry->pages_written, __entry->pages_skipped, |
| 335 | __entry->encountered_congestion, __entry->more_io, | 328 | __entry->more_io, |
| 336 | __entry->no_nrwrite_index_update, | 329 | __entry->no_nrwrite_index_update, |
| 337 | (unsigned long) __entry->writeback_index) | 330 | (unsigned long) __entry->writeback_index) |
| 338 | ); | 331 | ); |
| 339 | 332 | ||
| 340 | TRACE_EVENT(ext4_da_write_begin, | ||
| 341 | TP_PROTO(struct inode *inode, loff_t pos, unsigned int len, | ||
| 342 | unsigned int flags), | ||
| 343 | |||
| 344 | TP_ARGS(inode, pos, len, flags), | ||
| 345 | |||
| 346 | TP_STRUCT__entry( | ||
| 347 | __field( dev_t, dev ) | ||
| 348 | __field( ino_t, ino ) | ||
| 349 | __field( loff_t, pos ) | ||
| 350 | __field( unsigned int, len ) | ||
| 351 | __field( unsigned int, flags ) | ||
| 352 | ), | ||
| 353 | |||
| 354 | TP_fast_assign( | ||
| 355 | __entry->dev = inode->i_sb->s_dev; | ||
| 356 | __entry->ino = inode->i_ino; | ||
| 357 | __entry->pos = pos; | ||
| 358 | __entry->len = len; | ||
| 359 | __entry->flags = flags; | ||
| 360 | ), | ||
| 361 | |||
| 362 | TP_printk("dev %s ino %lu pos %llu len %u flags %u", | ||
| 363 | jbd2_dev_to_name(__entry->dev), (unsigned long) __entry->ino, | ||
| 364 | __entry->pos, __entry->len, __entry->flags) | ||
| 365 | ); | ||
| 366 | |||
| 367 | TRACE_EVENT(ext4_da_write_end, | ||
| 368 | TP_PROTO(struct inode *inode, loff_t pos, unsigned int len, | ||
| 369 | unsigned int copied), | ||
| 370 | |||
| 371 | TP_ARGS(inode, pos, len, copied), | ||
| 372 | |||
| 373 | TP_STRUCT__entry( | ||
| 374 | __field( dev_t, dev ) | ||
| 375 | __field( ino_t, ino ) | ||
| 376 | __field( loff_t, pos ) | ||
| 377 | __field( unsigned int, len ) | ||
| 378 | __field( unsigned int, copied ) | ||
| 379 | ), | ||
| 380 | |||
| 381 | TP_fast_assign( | ||
| 382 | __entry->dev = inode->i_sb->s_dev; | ||
| 383 | __entry->ino = inode->i_ino; | ||
| 384 | __entry->pos = pos; | ||
| 385 | __entry->len = len; | ||
| 386 | __entry->copied = copied; | ||
| 387 | ), | ||
| 388 | |||
| 389 | TP_printk("dev %s ino %lu pos %llu len %u copied %u", | ||
| 390 | jbd2_dev_to_name(__entry->dev), (unsigned long) __entry->ino, | ||
| 391 | __entry->pos, __entry->len, __entry->copied) | ||
| 392 | ); | ||
| 393 | |||
| 394 | TRACE_EVENT(ext4_discard_blocks, | 333 | TRACE_EVENT(ext4_discard_blocks, |
| 395 | TP_PROTO(struct super_block *sb, unsigned long long blk, | 334 | TP_PROTO(struct super_block *sb, unsigned long long blk, |
| 396 | unsigned long long count), | 335 | unsigned long long count), |
| @@ -650,30 +589,32 @@ TRACE_EVENT(ext4_allocate_blocks, | |||
| 650 | 589 | ||
| 651 | TRACE_EVENT(ext4_free_blocks, | 590 | TRACE_EVENT(ext4_free_blocks, |
| 652 | TP_PROTO(struct inode *inode, __u64 block, unsigned long count, | 591 | TP_PROTO(struct inode *inode, __u64 block, unsigned long count, |
| 653 | int metadata), | 592 | int flags), |
| 654 | 593 | ||
| 655 | TP_ARGS(inode, block, count, metadata), | 594 | TP_ARGS(inode, block, count, flags), |
| 656 | 595 | ||
| 657 | TP_STRUCT__entry( | 596 | TP_STRUCT__entry( |
| 658 | __field( dev_t, dev ) | 597 | __field( dev_t, dev ) |
| 659 | __field( ino_t, ino ) | 598 | __field( ino_t, ino ) |
| 599 | __field( umode_t, mode ) | ||
| 660 | __field( __u64, block ) | 600 | __field( __u64, block ) |
| 661 | __field( unsigned long, count ) | 601 | __field( unsigned long, count ) |
| 662 | __field( int, metadata ) | 602 | __field( int, flags ) |
| 663 | |||
| 664 | ), | 603 | ), |
| 665 | 604 | ||
| 666 | TP_fast_assign( | 605 | TP_fast_assign( |
| 667 | __entry->dev = inode->i_sb->s_dev; | 606 | __entry->dev = inode->i_sb->s_dev; |
| 668 | __entry->ino = inode->i_ino; | 607 | __entry->ino = inode->i_ino; |
| 608 | __entry->mode = inode->i_mode; | ||
| 669 | __entry->block = block; | 609 | __entry->block = block; |
| 670 | __entry->count = count; | 610 | __entry->count = count; |
| 671 | __entry->metadata = metadata; | 611 | __entry->flags = flags; |
| 672 | ), | 612 | ), |
| 673 | 613 | ||
| 674 | TP_printk("dev %s ino %lu block %llu count %lu metadata %d", | 614 | TP_printk("dev %s ino %lu mode 0%o block %llu count %lu flags %d", |
| 675 | jbd2_dev_to_name(__entry->dev), (unsigned long) __entry->ino, | 615 | jbd2_dev_to_name(__entry->dev), (unsigned long) __entry->ino, |
| 676 | __entry->block, __entry->count, __entry->metadata) | 616 | __entry->mode, __entry->block, __entry->count, |
| 617 | __entry->flags) | ||
| 677 | ); | 618 | ); |
| 678 | 619 | ||
| 679 | TRACE_EVENT(ext4_sync_file, | 620 | TRACE_EVENT(ext4_sync_file, |
| @@ -907,6 +848,133 @@ TRACE_EVENT(ext4_mballoc_free, | |||
| 907 | __entry->result_len, __entry->result_logical) | 848 | __entry->result_len, __entry->result_logical) |
| 908 | ); | 849 | ); |
| 909 | 850 | ||
| 851 | TRACE_EVENT(ext4_forget, | ||
| 852 | TP_PROTO(struct inode *inode, int is_metadata, __u64 block), | ||
| 853 | |||
| 854 | TP_ARGS(inode, is_metadata, block), | ||
| 855 | |||
| 856 | TP_STRUCT__entry( | ||
| 857 | __field( dev_t, dev ) | ||
| 858 | __field( ino_t, ino ) | ||
| 859 | __field( umode_t, mode ) | ||
| 860 | __field( int, is_metadata ) | ||
| 861 | __field( __u64, block ) | ||
| 862 | ), | ||
| 863 | |||
| 864 | TP_fast_assign( | ||
| 865 | __entry->dev = inode->i_sb->s_dev; | ||
| 866 | __entry->ino = inode->i_ino; | ||
| 867 | __entry->mode = inode->i_mode; | ||
| 868 | __entry->is_metadata = is_metadata; | ||
| 869 | __entry->block = block; | ||
| 870 | ), | ||
| 871 | |||
| 872 | TP_printk("dev %s ino %lu mode 0%o is_metadata %d block %llu", | ||
| 873 | jbd2_dev_to_name(__entry->dev), (unsigned long) __entry->ino, | ||
| 874 | __entry->mode, __entry->is_metadata, __entry->block) | ||
| 875 | ); | ||
| 876 | |||
| 877 | TRACE_EVENT(ext4_da_update_reserve_space, | ||
| 878 | TP_PROTO(struct inode *inode, int used_blocks), | ||
| 879 | |||
| 880 | TP_ARGS(inode, used_blocks), | ||
| 881 | |||
| 882 | TP_STRUCT__entry( | ||
| 883 | __field( dev_t, dev ) | ||
| 884 | __field( ino_t, ino ) | ||
| 885 | __field( umode_t, mode ) | ||
| 886 | __field( __u64, i_blocks ) | ||
| 887 | __field( int, used_blocks ) | ||
| 888 | __field( int, reserved_data_blocks ) | ||
| 889 | __field( int, reserved_meta_blocks ) | ||
| 890 | __field( int, allocated_meta_blocks ) | ||
| 891 | ), | ||
| 892 | |||
| 893 | TP_fast_assign( | ||
| 894 | __entry->dev = inode->i_sb->s_dev; | ||
| 895 | __entry->ino = inode->i_ino; | ||
| 896 | __entry->mode = inode->i_mode; | ||
| 897 | __entry->i_blocks = inode->i_blocks; | ||
| 898 | __entry->used_blocks = used_blocks; | ||
| 899 | __entry->reserved_data_blocks = EXT4_I(inode)->i_reserved_data_blocks; | ||
| 900 | __entry->reserved_meta_blocks = EXT4_I(inode)->i_reserved_meta_blocks; | ||
| 901 | __entry->allocated_meta_blocks = EXT4_I(inode)->i_allocated_meta_blocks; | ||
| 902 | ), | ||
| 903 | |||
| 904 | TP_printk("dev %s ino %lu mode 0%o i_blocks %llu used_blocks %d reserved_data_blocks %d reserved_meta_blocks %d allocated_meta_blocks %d", | ||
| 905 | jbd2_dev_to_name(__entry->dev), (unsigned long) __entry->ino, | ||
| 906 | __entry->mode, (unsigned long long) __entry->i_blocks, | ||
| 907 | __entry->used_blocks, __entry->reserved_data_blocks, | ||
| 908 | __entry->reserved_meta_blocks, __entry->allocated_meta_blocks) | ||
| 909 | ); | ||
| 910 | |||
| 911 | TRACE_EVENT(ext4_da_reserve_space, | ||
| 912 | TP_PROTO(struct inode *inode, int md_needed), | ||
| 913 | |||
| 914 | TP_ARGS(inode, md_needed), | ||
| 915 | |||
| 916 | TP_STRUCT__entry( | ||
| 917 | __field( dev_t, dev ) | ||
| 918 | __field( ino_t, ino ) | ||
| 919 | __field( umode_t, mode ) | ||
| 920 | __field( __u64, i_blocks ) | ||
| 921 | __field( int, md_needed ) | ||
| 922 | __field( int, reserved_data_blocks ) | ||
| 923 | __field( int, reserved_meta_blocks ) | ||
| 924 | ), | ||
| 925 | |||
| 926 | TP_fast_assign( | ||
| 927 | __entry->dev = inode->i_sb->s_dev; | ||
| 928 | __entry->ino = inode->i_ino; | ||
| 929 | __entry->mode = inode->i_mode; | ||
| 930 | __entry->i_blocks = inode->i_blocks; | ||
| 931 | __entry->md_needed = md_needed; | ||
| 932 | __entry->reserved_data_blocks = EXT4_I(inode)->i_reserved_data_blocks; | ||
| 933 | __entry->reserved_meta_blocks = EXT4_I(inode)->i_reserved_meta_blocks; | ||
| 934 | ), | ||
| 935 | |||
| 936 | TP_printk("dev %s ino %lu mode 0%o i_blocks %llu md_needed %d reserved_data_blocks %d reserved_meta_blocks %d", | ||
| 937 | jbd2_dev_to_name(__entry->dev), (unsigned long) __entry->ino, | ||
| 938 | __entry->mode, (unsigned long long) __entry->i_blocks, | ||
| 939 | __entry->md_needed, __entry->reserved_data_blocks, | ||
| 940 | __entry->reserved_meta_blocks) | ||
| 941 | ); | ||
| 942 | |||
| 943 | TRACE_EVENT(ext4_da_release_space, | ||
| 944 | TP_PROTO(struct inode *inode, int freed_blocks), | ||
| 945 | |||
| 946 | TP_ARGS(inode, freed_blocks), | ||
| 947 | |||
| 948 | TP_STRUCT__entry( | ||
| 949 | __field( dev_t, dev ) | ||
| 950 | __field( ino_t, ino ) | ||
| 951 | __field( umode_t, mode ) | ||
| 952 | __field( __u64, i_blocks ) | ||
| 953 | __field( int, freed_blocks ) | ||
| 954 | __field( int, reserved_data_blocks ) | ||
| 955 | __field( int, reserved_meta_blocks ) | ||
| 956 | __field( int, allocated_meta_blocks ) | ||
| 957 | ), | ||
| 958 | |||
| 959 | TP_fast_assign( | ||
| 960 | __entry->dev = inode->i_sb->s_dev; | ||
| 961 | __entry->ino = inode->i_ino; | ||
| 962 | __entry->mode = inode->i_mode; | ||
| 963 | __entry->i_blocks = inode->i_blocks; | ||
| 964 | __entry->freed_blocks = freed_blocks; | ||
| 965 | __entry->reserved_data_blocks = EXT4_I(inode)->i_reserved_data_blocks; | ||
| 966 | __entry->reserved_meta_blocks = EXT4_I(inode)->i_reserved_meta_blocks; | ||
| 967 | __entry->allocated_meta_blocks = EXT4_I(inode)->i_allocated_meta_blocks; | ||
| 968 | ), | ||
| 969 | |||
| 970 | TP_printk("dev %s ino %lu mode 0%o i_blocks %llu freed_blocks %d reserved_data_blocks %d reserved_meta_blocks %d allocated_meta_blocks %d", | ||
| 971 | jbd2_dev_to_name(__entry->dev), (unsigned long) __entry->ino, | ||
| 972 | __entry->mode, (unsigned long long) __entry->i_blocks, | ||
| 973 | __entry->freed_blocks, __entry->reserved_data_blocks, | ||
| 974 | __entry->reserved_meta_blocks, __entry->allocated_meta_blocks) | ||
| 975 | ); | ||
| 976 | |||
| 977 | |||
| 910 | #endif /* _TRACE_EXT4_H */ | 978 | #endif /* _TRACE_EXT4_H */ |
| 911 | 979 | ||
| 912 | /* This part must be outside protection */ | 980 | /* This part must be outside protection */ |
diff --git a/include/trace/events/irq.h b/include/trace/events/irq.h index b89f9db4a404..0e4cfb694fe7 100644 --- a/include/trace/events/irq.h +++ b/include/trace/events/irq.h | |||
| @@ -48,7 +48,7 @@ TRACE_EVENT(irq_handler_entry, | |||
| 48 | __assign_str(name, action->name); | 48 | __assign_str(name, action->name); |
| 49 | ), | 49 | ), |
| 50 | 50 | ||
| 51 | TP_printk("irq=%d handler=%s", __entry->irq, __get_str(name)) | 51 | TP_printk("irq=%d name=%s", __entry->irq, __get_str(name)) |
| 52 | ); | 52 | ); |
| 53 | 53 | ||
| 54 | /** | 54 | /** |
| @@ -78,22 +78,11 @@ TRACE_EVENT(irq_handler_exit, | |||
| 78 | __entry->ret = ret; | 78 | __entry->ret = ret; |
| 79 | ), | 79 | ), |
| 80 | 80 | ||
| 81 | TP_printk("irq=%d return=%s", | 81 | TP_printk("irq=%d ret=%s", |
| 82 | __entry->irq, __entry->ret ? "handled" : "unhandled") | 82 | __entry->irq, __entry->ret ? "handled" : "unhandled") |
| 83 | ); | 83 | ); |
| 84 | 84 | ||
| 85 | /** | 85 | DECLARE_EVENT_CLASS(softirq, |
| 86 | * softirq_entry - called immediately before the softirq handler | ||
| 87 | * @h: pointer to struct softirq_action | ||
| 88 | * @vec: pointer to first struct softirq_action in softirq_vec array | ||
| 89 | * | ||
| 90 | * The @h parameter, contains a pointer to the struct softirq_action | ||
| 91 | * which has a pointer to the action handler that is called. By subtracting | ||
| 92 | * the @vec pointer from the @h pointer, we can determine the softirq | ||
| 93 | * number. Also, when used in combination with the softirq_exit tracepoint | ||
| 94 | * we can determine the softirq latency. | ||
| 95 | */ | ||
| 96 | TRACE_EVENT(softirq_entry, | ||
| 97 | 86 | ||
| 98 | TP_PROTO(struct softirq_action *h, struct softirq_action *vec), | 87 | TP_PROTO(struct softirq_action *h, struct softirq_action *vec), |
| 99 | 88 | ||
| @@ -107,11 +96,29 @@ TRACE_EVENT(softirq_entry, | |||
| 107 | __entry->vec = (int)(h - vec); | 96 | __entry->vec = (int)(h - vec); |
| 108 | ), | 97 | ), |
| 109 | 98 | ||
| 110 | TP_printk("softirq=%d action=%s", __entry->vec, | 99 | TP_printk("vec=%d [action=%s]", __entry->vec, |
| 111 | show_softirq_name(__entry->vec)) | 100 | show_softirq_name(__entry->vec)) |
| 112 | ); | 101 | ); |
| 113 | 102 | ||
| 114 | /** | 103 | /** |
| 104 | * softirq_entry - called immediately before the softirq handler | ||
| 105 | * @h: pointer to struct softirq_action | ||
| 106 | * @vec: pointer to first struct softirq_action in softirq_vec array | ||
| 107 | * | ||
| 108 | * The @h parameter, contains a pointer to the struct softirq_action | ||
| 109 | * which has a pointer to the action handler that is called. By subtracting | ||
| 110 | * the @vec pointer from the @h pointer, we can determine the softirq | ||
| 111 | * number. Also, when used in combination with the softirq_exit tracepoint | ||
| 112 | * we can determine the softirq latency. | ||
| 113 | */ | ||
| 114 | DEFINE_EVENT(softirq, softirq_entry, | ||
| 115 | |||
| 116 | TP_PROTO(struct softirq_action *h, struct softirq_action *vec), | ||
| 117 | |||
| 118 | TP_ARGS(h, vec) | ||
| 119 | ); | ||
| 120 | |||
| 121 | /** | ||
| 115 | * softirq_exit - called immediately after the softirq handler returns | 122 | * softirq_exit - called immediately after the softirq handler returns |
| 116 | * @h: pointer to struct softirq_action | 123 | * @h: pointer to struct softirq_action |
| 117 | * @vec: pointer to first struct softirq_action in softirq_vec array | 124 | * @vec: pointer to first struct softirq_action in softirq_vec array |
| @@ -122,22 +129,11 @@ TRACE_EVENT(softirq_entry, | |||
| 122 | * combination with the softirq_entry tracepoint we can determine the softirq | 129 | * combination with the softirq_entry tracepoint we can determine the softirq |
| 123 | * latency. | 130 | * latency. |
| 124 | */ | 131 | */ |
| 125 | TRACE_EVENT(softirq_exit, | 132 | DEFINE_EVENT(softirq, softirq_exit, |
| 126 | 133 | ||
| 127 | TP_PROTO(struct softirq_action *h, struct softirq_action *vec), | 134 | TP_PROTO(struct softirq_action *h, struct softirq_action *vec), |
| 128 | 135 | ||
| 129 | TP_ARGS(h, vec), | 136 | TP_ARGS(h, vec) |
| 130 | |||
| 131 | TP_STRUCT__entry( | ||
| 132 | __field( int, vec ) | ||
| 133 | ), | ||
| 134 | |||
| 135 | TP_fast_assign( | ||
| 136 | __entry->vec = (int)(h - vec); | ||
| 137 | ), | ||
| 138 | |||
| 139 | TP_printk("softirq=%d action=%s", __entry->vec, | ||
| 140 | show_softirq_name(__entry->vec)) | ||
| 141 | ); | 137 | ); |
| 142 | 138 | ||
| 143 | #endif /* _TRACE_IRQ_H */ | 139 | #endif /* _TRACE_IRQ_H */ |
diff --git a/include/trace/events/jbd2.h b/include/trace/events/jbd2.h index 3c60b75adb9e..bf16545cc977 100644 --- a/include/trace/events/jbd2.h +++ b/include/trace/events/jbd2.h | |||
| @@ -30,7 +30,7 @@ TRACE_EVENT(jbd2_checkpoint, | |||
| 30 | jbd2_dev_to_name(__entry->dev), __entry->result) | 30 | jbd2_dev_to_name(__entry->dev), __entry->result) |
| 31 | ); | 31 | ); |
| 32 | 32 | ||
| 33 | TRACE_EVENT(jbd2_start_commit, | 33 | DECLARE_EVENT_CLASS(jbd2_commit, |
| 34 | 34 | ||
| 35 | TP_PROTO(journal_t *journal, transaction_t *commit_transaction), | 35 | TP_PROTO(journal_t *journal, transaction_t *commit_transaction), |
| 36 | 36 | ||
| @@ -53,73 +53,32 @@ TRACE_EVENT(jbd2_start_commit, | |||
| 53 | __entry->sync_commit) | 53 | __entry->sync_commit) |
| 54 | ); | 54 | ); |
| 55 | 55 | ||
| 56 | TRACE_EVENT(jbd2_commit_locking, | 56 | DEFINE_EVENT(jbd2_commit, jbd2_start_commit, |
| 57 | 57 | ||
| 58 | TP_PROTO(journal_t *journal, transaction_t *commit_transaction), | 58 | TP_PROTO(journal_t *journal, transaction_t *commit_transaction), |
| 59 | 59 | ||
| 60 | TP_ARGS(journal, commit_transaction), | 60 | TP_ARGS(journal, commit_transaction) |
| 61 | |||
| 62 | TP_STRUCT__entry( | ||
| 63 | __field( dev_t, dev ) | ||
| 64 | __field( char, sync_commit ) | ||
| 65 | __field( int, transaction ) | ||
| 66 | ), | ||
| 67 | |||
| 68 | TP_fast_assign( | ||
| 69 | __entry->dev = journal->j_fs_dev->bd_dev; | ||
| 70 | __entry->sync_commit = commit_transaction->t_synchronous_commit; | ||
| 71 | __entry->transaction = commit_transaction->t_tid; | ||
| 72 | ), | ||
| 73 | |||
| 74 | TP_printk("dev %s transaction %d sync %d", | ||
| 75 | jbd2_dev_to_name(__entry->dev), __entry->transaction, | ||
| 76 | __entry->sync_commit) | ||
| 77 | ); | 61 | ); |
| 78 | 62 | ||
| 79 | TRACE_EVENT(jbd2_commit_flushing, | 63 | DEFINE_EVENT(jbd2_commit, jbd2_commit_locking, |
| 80 | 64 | ||
| 81 | TP_PROTO(journal_t *journal, transaction_t *commit_transaction), | 65 | TP_PROTO(journal_t *journal, transaction_t *commit_transaction), |
| 82 | 66 | ||
| 83 | TP_ARGS(journal, commit_transaction), | 67 | TP_ARGS(journal, commit_transaction) |
| 84 | |||
| 85 | TP_STRUCT__entry( | ||
| 86 | __field( dev_t, dev ) | ||
| 87 | __field( char, sync_commit ) | ||
| 88 | __field( int, transaction ) | ||
| 89 | ), | ||
| 90 | |||
| 91 | TP_fast_assign( | ||
| 92 | __entry->dev = journal->j_fs_dev->bd_dev; | ||
| 93 | __entry->sync_commit = commit_transaction->t_synchronous_commit; | ||
| 94 | __entry->transaction = commit_transaction->t_tid; | ||
| 95 | ), | ||
| 96 | |||
| 97 | TP_printk("dev %s transaction %d sync %d", | ||
| 98 | jbd2_dev_to_name(__entry->dev), __entry->transaction, | ||
| 99 | __entry->sync_commit) | ||
| 100 | ); | 68 | ); |
| 101 | 69 | ||
| 102 | TRACE_EVENT(jbd2_commit_logging, | 70 | DEFINE_EVENT(jbd2_commit, jbd2_commit_flushing, |
| 103 | 71 | ||
| 104 | TP_PROTO(journal_t *journal, transaction_t *commit_transaction), | 72 | TP_PROTO(journal_t *journal, transaction_t *commit_transaction), |
| 105 | 73 | ||
| 106 | TP_ARGS(journal, commit_transaction), | 74 | TP_ARGS(journal, commit_transaction) |
| 75 | ); | ||
| 107 | 76 | ||
| 108 | TP_STRUCT__entry( | 77 | DEFINE_EVENT(jbd2_commit, jbd2_commit_logging, |
| 109 | __field( dev_t, dev ) | ||
| 110 | __field( char, sync_commit ) | ||
| 111 | __field( int, transaction ) | ||
| 112 | ), | ||
| 113 | 78 | ||
| 114 | TP_fast_assign( | 79 | TP_PROTO(journal_t *journal, transaction_t *commit_transaction), |
| 115 | __entry->dev = journal->j_fs_dev->bd_dev; | ||
| 116 | __entry->sync_commit = commit_transaction->t_synchronous_commit; | ||
| 117 | __entry->transaction = commit_transaction->t_tid; | ||
| 118 | ), | ||
| 119 | 80 | ||
| 120 | TP_printk("dev %s transaction %d sync %d", | 81 | TP_ARGS(journal, commit_transaction) |
| 121 | jbd2_dev_to_name(__entry->dev), __entry->transaction, | ||
| 122 | __entry->sync_commit) | ||
| 123 | ); | 82 | ); |
| 124 | 83 | ||
| 125 | TRACE_EVENT(jbd2_end_commit, | 84 | TRACE_EVENT(jbd2_end_commit, |
| @@ -240,6 +199,34 @@ TRACE_EVENT(jbd2_checkpoint_stats, | |||
| 240 | __entry->forced_to_close, __entry->written, __entry->dropped) | 199 | __entry->forced_to_close, __entry->written, __entry->dropped) |
| 241 | ); | 200 | ); |
| 242 | 201 | ||
| 202 | TRACE_EVENT(jbd2_cleanup_journal_tail, | ||
| 203 | |||
| 204 | TP_PROTO(journal_t *journal, tid_t first_tid, | ||
| 205 | unsigned long block_nr, unsigned long freed), | ||
| 206 | |||
| 207 | TP_ARGS(journal, first_tid, block_nr, freed), | ||
| 208 | |||
| 209 | TP_STRUCT__entry( | ||
| 210 | __field( dev_t, dev ) | ||
| 211 | __field( tid_t, tail_sequence ) | ||
| 212 | __field( tid_t, first_tid ) | ||
| 213 | __field(unsigned long, block_nr ) | ||
| 214 | __field(unsigned long, freed ) | ||
| 215 | ), | ||
| 216 | |||
| 217 | TP_fast_assign( | ||
| 218 | __entry->dev = journal->j_fs_dev->bd_dev; | ||
| 219 | __entry->tail_sequence = journal->j_tail_sequence; | ||
| 220 | __entry->first_tid = first_tid; | ||
| 221 | __entry->block_nr = block_nr; | ||
| 222 | __entry->freed = freed; | ||
| 223 | ), | ||
| 224 | |||
| 225 | TP_printk("dev %s from %u to %u offset %lu freed %lu", | ||
| 226 | jbd2_dev_to_name(__entry->dev), __entry->tail_sequence, | ||
| 227 | __entry->first_tid, __entry->block_nr, __entry->freed) | ||
| 228 | ); | ||
| 229 | |||
| 243 | #endif /* _TRACE_JBD2_H */ | 230 | #endif /* _TRACE_JBD2_H */ |
| 244 | 231 | ||
| 245 | /* This part must be outside protection */ | 232 | /* This part must be outside protection */ |
diff --git a/include/trace/events/kmem.h b/include/trace/events/kmem.h index eaf46bdd18a5..3adca0ca9dbe 100644 --- a/include/trace/events/kmem.h +++ b/include/trace/events/kmem.h | |||
| @@ -44,7 +44,7 @@ | |||
| 44 | {(unsigned long)__GFP_MOVABLE, "GFP_MOVABLE"} \ | 44 | {(unsigned long)__GFP_MOVABLE, "GFP_MOVABLE"} \ |
| 45 | ) : "GFP_NOWAIT" | 45 | ) : "GFP_NOWAIT" |
| 46 | 46 | ||
| 47 | TRACE_EVENT(kmalloc, | 47 | DECLARE_EVENT_CLASS(kmem_alloc, |
| 48 | 48 | ||
| 49 | TP_PROTO(unsigned long call_site, | 49 | TP_PROTO(unsigned long call_site, |
| 50 | const void *ptr, | 50 | const void *ptr, |
| @@ -78,41 +78,23 @@ TRACE_EVENT(kmalloc, | |||
| 78 | show_gfp_flags(__entry->gfp_flags)) | 78 | show_gfp_flags(__entry->gfp_flags)) |
| 79 | ); | 79 | ); |
| 80 | 80 | ||
| 81 | TRACE_EVENT(kmem_cache_alloc, | 81 | DEFINE_EVENT(kmem_alloc, kmalloc, |
| 82 | 82 | ||
| 83 | TP_PROTO(unsigned long call_site, | 83 | TP_PROTO(unsigned long call_site, const void *ptr, |
| 84 | const void *ptr, | 84 | size_t bytes_req, size_t bytes_alloc, gfp_t gfp_flags), |
| 85 | size_t bytes_req, | ||
| 86 | size_t bytes_alloc, | ||
| 87 | gfp_t gfp_flags), | ||
| 88 | 85 | ||
| 89 | TP_ARGS(call_site, ptr, bytes_req, bytes_alloc, gfp_flags), | 86 | TP_ARGS(call_site, ptr, bytes_req, bytes_alloc, gfp_flags) |
| 87 | ); | ||
| 90 | 88 | ||
| 91 | TP_STRUCT__entry( | 89 | DEFINE_EVENT(kmem_alloc, kmem_cache_alloc, |
| 92 | __field( unsigned long, call_site ) | ||
| 93 | __field( const void *, ptr ) | ||
| 94 | __field( size_t, bytes_req ) | ||
| 95 | __field( size_t, bytes_alloc ) | ||
| 96 | __field( gfp_t, gfp_flags ) | ||
| 97 | ), | ||
| 98 | 90 | ||
| 99 | TP_fast_assign( | 91 | TP_PROTO(unsigned long call_site, const void *ptr, |
| 100 | __entry->call_site = call_site; | 92 | size_t bytes_req, size_t bytes_alloc, gfp_t gfp_flags), |
| 101 | __entry->ptr = ptr; | ||
| 102 | __entry->bytes_req = bytes_req; | ||
| 103 | __entry->bytes_alloc = bytes_alloc; | ||
| 104 | __entry->gfp_flags = gfp_flags; | ||
| 105 | ), | ||
| 106 | 93 | ||
| 107 | TP_printk("call_site=%lx ptr=%p bytes_req=%zu bytes_alloc=%zu gfp_flags=%s", | 94 | TP_ARGS(call_site, ptr, bytes_req, bytes_alloc, gfp_flags) |
| 108 | __entry->call_site, | ||
| 109 | __entry->ptr, | ||
| 110 | __entry->bytes_req, | ||
| 111 | __entry->bytes_alloc, | ||
| 112 | show_gfp_flags(__entry->gfp_flags)) | ||
| 113 | ); | 95 | ); |
| 114 | 96 | ||
| 115 | TRACE_EVENT(kmalloc_node, | 97 | DECLARE_EVENT_CLASS(kmem_alloc_node, |
| 116 | 98 | ||
| 117 | TP_PROTO(unsigned long call_site, | 99 | TP_PROTO(unsigned long call_site, |
| 118 | const void *ptr, | 100 | const void *ptr, |
| @@ -150,45 +132,25 @@ TRACE_EVENT(kmalloc_node, | |||
| 150 | __entry->node) | 132 | __entry->node) |
| 151 | ); | 133 | ); |
| 152 | 134 | ||
| 153 | TRACE_EVENT(kmem_cache_alloc_node, | 135 | DEFINE_EVENT(kmem_alloc_node, kmalloc_node, |
| 154 | 136 | ||
| 155 | TP_PROTO(unsigned long call_site, | 137 | TP_PROTO(unsigned long call_site, const void *ptr, |
| 156 | const void *ptr, | 138 | size_t bytes_req, size_t bytes_alloc, |
| 157 | size_t bytes_req, | 139 | gfp_t gfp_flags, int node), |
| 158 | size_t bytes_alloc, | ||
| 159 | gfp_t gfp_flags, | ||
| 160 | int node), | ||
| 161 | 140 | ||
| 162 | TP_ARGS(call_site, ptr, bytes_req, bytes_alloc, gfp_flags, node), | 141 | TP_ARGS(call_site, ptr, bytes_req, bytes_alloc, gfp_flags, node) |
| 142 | ); | ||
| 163 | 143 | ||
| 164 | TP_STRUCT__entry( | 144 | DEFINE_EVENT(kmem_alloc_node, kmem_cache_alloc_node, |
| 165 | __field( unsigned long, call_site ) | ||
| 166 | __field( const void *, ptr ) | ||
| 167 | __field( size_t, bytes_req ) | ||
| 168 | __field( size_t, bytes_alloc ) | ||
| 169 | __field( gfp_t, gfp_flags ) | ||
| 170 | __field( int, node ) | ||
| 171 | ), | ||
| 172 | 145 | ||
| 173 | TP_fast_assign( | 146 | TP_PROTO(unsigned long call_site, const void *ptr, |
| 174 | __entry->call_site = call_site; | 147 | size_t bytes_req, size_t bytes_alloc, |
| 175 | __entry->ptr = ptr; | 148 | gfp_t gfp_flags, int node), |
| 176 | __entry->bytes_req = bytes_req; | ||
| 177 | __entry->bytes_alloc = bytes_alloc; | ||
| 178 | __entry->gfp_flags = gfp_flags; | ||
| 179 | __entry->node = node; | ||
| 180 | ), | ||
| 181 | 149 | ||
| 182 | TP_printk("call_site=%lx ptr=%p bytes_req=%zu bytes_alloc=%zu gfp_flags=%s node=%d", | 150 | TP_ARGS(call_site, ptr, bytes_req, bytes_alloc, gfp_flags, node) |
| 183 | __entry->call_site, | ||
| 184 | __entry->ptr, | ||
| 185 | __entry->bytes_req, | ||
| 186 | __entry->bytes_alloc, | ||
| 187 | show_gfp_flags(__entry->gfp_flags), | ||
| 188 | __entry->node) | ||
| 189 | ); | 151 | ); |
| 190 | 152 | ||
| 191 | TRACE_EVENT(kfree, | 153 | DECLARE_EVENT_CLASS(kmem_free, |
| 192 | 154 | ||
| 193 | TP_PROTO(unsigned long call_site, const void *ptr), | 155 | TP_PROTO(unsigned long call_site, const void *ptr), |
| 194 | 156 | ||
| @@ -207,23 +169,18 @@ TRACE_EVENT(kfree, | |||
| 207 | TP_printk("call_site=%lx ptr=%p", __entry->call_site, __entry->ptr) | 169 | TP_printk("call_site=%lx ptr=%p", __entry->call_site, __entry->ptr) |
| 208 | ); | 170 | ); |
| 209 | 171 | ||
| 210 | TRACE_EVENT(kmem_cache_free, | 172 | DEFINE_EVENT(kmem_free, kfree, |
| 211 | 173 | ||
| 212 | TP_PROTO(unsigned long call_site, const void *ptr), | 174 | TP_PROTO(unsigned long call_site, const void *ptr), |
| 213 | 175 | ||
| 214 | TP_ARGS(call_site, ptr), | 176 | TP_ARGS(call_site, ptr) |
| 177 | ); | ||
| 215 | 178 | ||
| 216 | TP_STRUCT__entry( | 179 | DEFINE_EVENT(kmem_free, kmem_cache_free, |
| 217 | __field( unsigned long, call_site ) | ||
| 218 | __field( const void *, ptr ) | ||
| 219 | ), | ||
| 220 | 180 | ||
| 221 | TP_fast_assign( | 181 | TP_PROTO(unsigned long call_site, const void *ptr), |
| 222 | __entry->call_site = call_site; | ||
| 223 | __entry->ptr = ptr; | ||
| 224 | ), | ||
| 225 | 182 | ||
| 226 | TP_printk("call_site=%lx ptr=%p", __entry->call_site, __entry->ptr) | 183 | TP_ARGS(call_site, ptr) |
| 227 | ); | 184 | ); |
| 228 | 185 | ||
| 229 | TRACE_EVENT(mm_page_free_direct, | 186 | TRACE_EVENT(mm_page_free_direct, |
| @@ -299,7 +256,7 @@ TRACE_EVENT(mm_page_alloc, | |||
| 299 | show_gfp_flags(__entry->gfp_flags)) | 256 | show_gfp_flags(__entry->gfp_flags)) |
| 300 | ); | 257 | ); |
| 301 | 258 | ||
| 302 | TRACE_EVENT(mm_page_alloc_zone_locked, | 259 | DECLARE_EVENT_CLASS(mm_page, |
| 303 | 260 | ||
| 304 | TP_PROTO(struct page *page, unsigned int order, int migratetype), | 261 | TP_PROTO(struct page *page, unsigned int order, int migratetype), |
| 305 | 262 | ||
| @@ -325,29 +282,22 @@ TRACE_EVENT(mm_page_alloc_zone_locked, | |||
| 325 | __entry->order == 0) | 282 | __entry->order == 0) |
| 326 | ); | 283 | ); |
| 327 | 284 | ||
| 328 | TRACE_EVENT(mm_page_pcpu_drain, | 285 | DEFINE_EVENT(mm_page, mm_page_alloc_zone_locked, |
| 329 | 286 | ||
| 330 | TP_PROTO(struct page *page, int order, int migratetype), | 287 | TP_PROTO(struct page *page, unsigned int order, int migratetype), |
| 331 | 288 | ||
| 332 | TP_ARGS(page, order, migratetype), | 289 | TP_ARGS(page, order, migratetype) |
| 290 | ); | ||
| 333 | 291 | ||
| 334 | TP_STRUCT__entry( | 292 | DEFINE_EVENT_PRINT(mm_page, mm_page_pcpu_drain, |
| 335 | __field( struct page *, page ) | ||
| 336 | __field( int, order ) | ||
| 337 | __field( int, migratetype ) | ||
| 338 | ), | ||
| 339 | 293 | ||
| 340 | TP_fast_assign( | 294 | TP_PROTO(struct page *page, unsigned int order, int migratetype), |
| 341 | __entry->page = page; | 295 | |
| 342 | __entry->order = order; | 296 | TP_ARGS(page, order, migratetype), |
| 343 | __entry->migratetype = migratetype; | ||
| 344 | ), | ||
| 345 | 297 | ||
| 346 | TP_printk("page=%p pfn=%lu order=%d migratetype=%d", | 298 | TP_printk("page=%p pfn=%lu order=%d migratetype=%d", |
| 347 | __entry->page, | 299 | __entry->page, page_to_pfn(__entry->page), |
| 348 | page_to_pfn(__entry->page), | 300 | __entry->order, __entry->migratetype) |
| 349 | __entry->order, | ||
| 350 | __entry->migratetype) | ||
| 351 | ); | 301 | ); |
| 352 | 302 | ||
| 353 | TRACE_EVENT(mm_page_alloc_extfrag, | 303 | TRACE_EVENT(mm_page_alloc_extfrag, |
diff --git a/include/trace/events/kvm.h b/include/trace/events/kvm.h index dbe108455275..b17d49dfc3ef 100644 --- a/include/trace/events/kvm.h +++ b/include/trace/events/kvm.h | |||
| @@ -145,6 +145,47 @@ TRACE_EVENT(kvm_mmio, | |||
| 145 | __entry->len, __entry->gpa, __entry->val) | 145 | __entry->len, __entry->gpa, __entry->val) |
| 146 | ); | 146 | ); |
| 147 | 147 | ||
| 148 | #define kvm_fpu_load_symbol \ | ||
| 149 | {0, "unload"}, \ | ||
| 150 | {1, "load"} | ||
| 151 | |||
| 152 | TRACE_EVENT(kvm_fpu, | ||
| 153 | TP_PROTO(int load), | ||
| 154 | TP_ARGS(load), | ||
| 155 | |||
| 156 | TP_STRUCT__entry( | ||
| 157 | __field( u32, load ) | ||
| 158 | ), | ||
| 159 | |||
| 160 | TP_fast_assign( | ||
| 161 | __entry->load = load; | ||
| 162 | ), | ||
| 163 | |||
| 164 | TP_printk("%s", __print_symbolic(__entry->load, kvm_fpu_load_symbol)) | ||
| 165 | ); | ||
| 166 | |||
| 167 | TRACE_EVENT(kvm_age_page, | ||
| 168 | TP_PROTO(ulong hva, struct kvm_memory_slot *slot, int ref), | ||
| 169 | TP_ARGS(hva, slot, ref), | ||
| 170 | |||
| 171 | TP_STRUCT__entry( | ||
| 172 | __field( u64, hva ) | ||
| 173 | __field( u64, gfn ) | ||
| 174 | __field( u8, referenced ) | ||
| 175 | ), | ||
| 176 | |||
| 177 | TP_fast_assign( | ||
| 178 | __entry->hva = hva; | ||
| 179 | __entry->gfn = | ||
| 180 | slot->base_gfn + ((hva - slot->userspace_addr) >> PAGE_SHIFT); | ||
| 181 | __entry->referenced = ref; | ||
| 182 | ), | ||
| 183 | |||
| 184 | TP_printk("hva %llx gfn %llx %s", | ||
| 185 | __entry->hva, __entry->gfn, | ||
| 186 | __entry->referenced ? "YOUNG" : "OLD") | ||
| 187 | ); | ||
| 188 | |||
| 148 | #endif /* _TRACE_KVM_MAIN_H */ | 189 | #endif /* _TRACE_KVM_MAIN_H */ |
| 149 | 190 | ||
| 150 | /* This part must be outside protection */ | 191 | /* This part must be outside protection */ |
diff --git a/include/trace/events/lockdep.h b/include/trace/events/lock.h index bcf1d209a00d..5c1dcfc16c60 100644 --- a/include/trace/events/lockdep.h +++ b/include/trace/events/lock.h | |||
| @@ -1,8 +1,8 @@ | |||
| 1 | #undef TRACE_SYSTEM | 1 | #undef TRACE_SYSTEM |
| 2 | #define TRACE_SYSTEM lockdep | 2 | #define TRACE_SYSTEM lock |
| 3 | 3 | ||
| 4 | #if !defined(_TRACE_LOCKDEP_H) || defined(TRACE_HEADER_MULTI_READ) | 4 | #if !defined(_TRACE_LOCK_H) || defined(TRACE_HEADER_MULTI_READ) |
| 5 | #define _TRACE_LOCKDEP_H | 5 | #define _TRACE_LOCK_H |
| 6 | 6 | ||
| 7 | #include <linux/lockdep.h> | 7 | #include <linux/lockdep.h> |
| 8 | #include <linux/tracepoint.h> | 8 | #include <linux/tracepoint.h> |
| @@ -20,14 +20,17 @@ TRACE_EVENT(lock_acquire, | |||
| 20 | TP_STRUCT__entry( | 20 | TP_STRUCT__entry( |
| 21 | __field(unsigned int, flags) | 21 | __field(unsigned int, flags) |
| 22 | __string(name, lock->name) | 22 | __string(name, lock->name) |
| 23 | __field(void *, lockdep_addr) | ||
| 23 | ), | 24 | ), |
| 24 | 25 | ||
| 25 | TP_fast_assign( | 26 | TP_fast_assign( |
| 26 | __entry->flags = (trylock ? 1 : 0) | (read ? 2 : 0); | 27 | __entry->flags = (trylock ? 1 : 0) | (read ? 2 : 0); |
| 27 | __assign_str(name, lock->name); | 28 | __assign_str(name, lock->name); |
| 29 | __entry->lockdep_addr = lock; | ||
| 28 | ), | 30 | ), |
| 29 | 31 | ||
| 30 | TP_printk("%s%s%s", (__entry->flags & 1) ? "try " : "", | 32 | TP_printk("%p %s%s%s", __entry->lockdep_addr, |
| 33 | (__entry->flags & 1) ? "try " : "", | ||
| 31 | (__entry->flags & 2) ? "read " : "", | 34 | (__entry->flags & 2) ? "read " : "", |
| 32 | __get_str(name)) | 35 | __get_str(name)) |
| 33 | ); | 36 | ); |
| @@ -40,13 +43,16 @@ TRACE_EVENT(lock_release, | |||
| 40 | 43 | ||
| 41 | TP_STRUCT__entry( | 44 | TP_STRUCT__entry( |
| 42 | __string(name, lock->name) | 45 | __string(name, lock->name) |
| 46 | __field(void *, lockdep_addr) | ||
| 43 | ), | 47 | ), |
| 44 | 48 | ||
| 45 | TP_fast_assign( | 49 | TP_fast_assign( |
| 46 | __assign_str(name, lock->name); | 50 | __assign_str(name, lock->name); |
| 51 | __entry->lockdep_addr = lock; | ||
| 47 | ), | 52 | ), |
| 48 | 53 | ||
| 49 | TP_printk("%s", __get_str(name)) | 54 | TP_printk("%p %s", |
| 55 | __entry->lockdep_addr, __get_str(name)) | ||
| 50 | ); | 56 | ); |
| 51 | 57 | ||
| 52 | #ifdef CONFIG_LOCK_STAT | 58 | #ifdef CONFIG_LOCK_STAT |
| @@ -59,13 +65,16 @@ TRACE_EVENT(lock_contended, | |||
| 59 | 65 | ||
| 60 | TP_STRUCT__entry( | 66 | TP_STRUCT__entry( |
| 61 | __string(name, lock->name) | 67 | __string(name, lock->name) |
| 68 | __field(void *, lockdep_addr) | ||
| 62 | ), | 69 | ), |
| 63 | 70 | ||
| 64 | TP_fast_assign( | 71 | TP_fast_assign( |
| 65 | __assign_str(name, lock->name); | 72 | __assign_str(name, lock->name); |
| 73 | __entry->lockdep_addr = lock; | ||
| 66 | ), | 74 | ), |
| 67 | 75 | ||
| 68 | TP_printk("%s", __get_str(name)) | 76 | TP_printk("%p %s", |
| 77 | __entry->lockdep_addr, __get_str(name)) | ||
| 69 | ); | 78 | ); |
| 70 | 79 | ||
| 71 | TRACE_EVENT(lock_acquired, | 80 | TRACE_EVENT(lock_acquired, |
| @@ -75,22 +84,24 @@ TRACE_EVENT(lock_acquired, | |||
| 75 | 84 | ||
| 76 | TP_STRUCT__entry( | 85 | TP_STRUCT__entry( |
| 77 | __string(name, lock->name) | 86 | __string(name, lock->name) |
| 78 | __field(unsigned long, wait_usec) | 87 | __field(s64, wait_nsec) |
| 79 | __field(unsigned long, wait_nsec_rem) | 88 | __field(void *, lockdep_addr) |
| 80 | ), | 89 | ), |
| 90 | |||
| 81 | TP_fast_assign( | 91 | TP_fast_assign( |
| 82 | __assign_str(name, lock->name); | 92 | __assign_str(name, lock->name); |
| 83 | __entry->wait_nsec_rem = do_div(waittime, NSEC_PER_USEC); | 93 | __entry->wait_nsec = waittime; |
| 84 | __entry->wait_usec = (unsigned long) waittime; | 94 | __entry->lockdep_addr = lock; |
| 85 | ), | 95 | ), |
| 86 | TP_printk("%s (%lu.%03lu us)", __get_str(name), __entry->wait_usec, | 96 | TP_printk("%p %s (%llu ns)", __entry->lockdep_addr, |
| 87 | __entry->wait_nsec_rem) | 97 | __get_str(name), |
| 98 | __entry->wait_nsec) | ||
| 88 | ); | 99 | ); |
| 89 | 100 | ||
| 90 | #endif | 101 | #endif |
| 91 | #endif | 102 | #endif |
| 92 | 103 | ||
| 93 | #endif /* _TRACE_LOCKDEP_H */ | 104 | #endif /* _TRACE_LOCK_H */ |
| 94 | 105 | ||
| 95 | /* This part must be outside protection */ | 106 | /* This part must be outside protection */ |
| 96 | #include <trace/define_trace.h> | 107 | #include <trace/define_trace.h> |
diff --git a/include/trace/events/mce.h b/include/trace/events/mce.h new file mode 100644 index 000000000000..7eee77895cb3 --- /dev/null +++ b/include/trace/events/mce.h | |||
| @@ -0,0 +1,69 @@ | |||
| 1 | #undef TRACE_SYSTEM | ||
| 2 | #define TRACE_SYSTEM mce | ||
| 3 | |||
| 4 | #if !defined(_TRACE_MCE_H) || defined(TRACE_HEADER_MULTI_READ) | ||
| 5 | #define _TRACE_MCE_H | ||
| 6 | |||
| 7 | #include <linux/ktime.h> | ||
| 8 | #include <linux/tracepoint.h> | ||
| 9 | #include <asm/mce.h> | ||
| 10 | |||
| 11 | TRACE_EVENT(mce_record, | ||
| 12 | |||
| 13 | TP_PROTO(struct mce *m), | ||
| 14 | |||
| 15 | TP_ARGS(m), | ||
| 16 | |||
| 17 | TP_STRUCT__entry( | ||
| 18 | __field( u64, mcgcap ) | ||
| 19 | __field( u64, mcgstatus ) | ||
| 20 | __field( u8, bank ) | ||
| 21 | __field( u64, status ) | ||
| 22 | __field( u64, addr ) | ||
| 23 | __field( u64, misc ) | ||
| 24 | __field( u64, ip ) | ||
| 25 | __field( u8, cs ) | ||
| 26 | __field( u64, tsc ) | ||
| 27 | __field( u64, walltime ) | ||
| 28 | __field( u32, cpu ) | ||
| 29 | __field( u32, cpuid ) | ||
| 30 | __field( u32, apicid ) | ||
| 31 | __field( u32, socketid ) | ||
| 32 | __field( u8, cpuvendor ) | ||
| 33 | ), | ||
| 34 | |||
| 35 | TP_fast_assign( | ||
| 36 | __entry->mcgcap = m->mcgcap; | ||
| 37 | __entry->mcgstatus = m->mcgstatus; | ||
| 38 | __entry->bank = m->bank; | ||
| 39 | __entry->status = m->status; | ||
| 40 | __entry->addr = m->addr; | ||
| 41 | __entry->misc = m->misc; | ||
| 42 | __entry->ip = m->ip; | ||
| 43 | __entry->cs = m->cs; | ||
| 44 | __entry->tsc = m->tsc; | ||
| 45 | __entry->walltime = m->time; | ||
| 46 | __entry->cpu = m->extcpu; | ||
| 47 | __entry->cpuid = m->cpuid; | ||
| 48 | __entry->apicid = m->apicid; | ||
| 49 | __entry->socketid = m->socketid; | ||
| 50 | __entry->cpuvendor = m->cpuvendor; | ||
| 51 | ), | ||
| 52 | |||
| 53 | TP_printk("CPU: %d, MCGc/s: %llx/%llx, MC%d: %016Lx, ADDR/MISC: %016Lx/%016Lx, RIP: %02x:<%016Lx>, TSC: %llx, PROCESSOR: %u:%x, TIME: %llu, SOCKET: %u, APIC: %x", | ||
| 54 | __entry->cpu, | ||
| 55 | __entry->mcgcap, __entry->mcgstatus, | ||
| 56 | __entry->bank, __entry->status, | ||
| 57 | __entry->addr, __entry->misc, | ||
| 58 | __entry->cs, __entry->ip, | ||
| 59 | __entry->tsc, | ||
| 60 | __entry->cpuvendor, __entry->cpuid, | ||
| 61 | __entry->walltime, | ||
| 62 | __entry->socketid, | ||
| 63 | __entry->apicid) | ||
| 64 | ); | ||
| 65 | |||
| 66 | #endif /* _TRACE_MCE_H */ | ||
| 67 | |||
| 68 | /* This part must be outside protection */ | ||
| 69 | #include <trace/define_trace.h> | ||
diff --git a/include/trace/events/module.h b/include/trace/events/module.h index 84160fb18478..4b0f48ba16a6 100644 --- a/include/trace/events/module.h +++ b/include/trace/events/module.h | |||
| @@ -51,7 +51,7 @@ TRACE_EVENT(module_free, | |||
| 51 | TP_printk("%s", __get_str(name)) | 51 | TP_printk("%s", __get_str(name)) |
| 52 | ); | 52 | ); |
| 53 | 53 | ||
| 54 | TRACE_EVENT(module_get, | 54 | DECLARE_EVENT_CLASS(module_refcnt, |
| 55 | 55 | ||
| 56 | TP_PROTO(struct module *mod, unsigned long ip, int refcnt), | 56 | TP_PROTO(struct module *mod, unsigned long ip, int refcnt), |
| 57 | 57 | ||
| @@ -73,26 +73,18 @@ TRACE_EVENT(module_get, | |||
| 73 | __get_str(name), (void *)__entry->ip, __entry->refcnt) | 73 | __get_str(name), (void *)__entry->ip, __entry->refcnt) |
| 74 | ); | 74 | ); |
| 75 | 75 | ||
| 76 | TRACE_EVENT(module_put, | 76 | DEFINE_EVENT(module_refcnt, module_get, |
| 77 | 77 | ||
| 78 | TP_PROTO(struct module *mod, unsigned long ip, int refcnt), | 78 | TP_PROTO(struct module *mod, unsigned long ip, int refcnt), |
| 79 | 79 | ||
| 80 | TP_ARGS(mod, ip, refcnt), | 80 | TP_ARGS(mod, ip, refcnt) |
| 81 | ); | ||
| 81 | 82 | ||
| 82 | TP_STRUCT__entry( | 83 | DEFINE_EVENT(module_refcnt, module_put, |
| 83 | __field( unsigned long, ip ) | ||
| 84 | __field( int, refcnt ) | ||
| 85 | __string( name, mod->name ) | ||
| 86 | ), | ||
| 87 | 84 | ||
| 88 | TP_fast_assign( | 85 | TP_PROTO(struct module *mod, unsigned long ip, int refcnt), |
| 89 | __entry->ip = ip; | ||
| 90 | __entry->refcnt = refcnt; | ||
| 91 | __assign_str(name, mod->name); | ||
| 92 | ), | ||
| 93 | 86 | ||
| 94 | TP_printk("%s call_site=%pf refcnt=%d", | 87 | TP_ARGS(mod, ip, refcnt) |
| 95 | __get_str(name), (void *)__entry->ip, __entry->refcnt) | ||
| 96 | ); | 88 | ); |
| 97 | 89 | ||
| 98 | TRACE_EVENT(module_request, | 90 | TRACE_EVENT(module_request, |
diff --git a/include/trace/events/power.h b/include/trace/events/power.h index ea6d579261ad..c4efe9b8280d 100644 --- a/include/trace/events/power.h +++ b/include/trace/events/power.h | |||
| @@ -16,9 +16,7 @@ enum { | |||
| 16 | }; | 16 | }; |
| 17 | #endif | 17 | #endif |
| 18 | 18 | ||
| 19 | 19 | DECLARE_EVENT_CLASS(power, | |
| 20 | |||
| 21 | TRACE_EVENT(power_start, | ||
| 22 | 20 | ||
| 23 | TP_PROTO(unsigned int type, unsigned int state), | 21 | TP_PROTO(unsigned int type, unsigned int state), |
| 24 | 22 | ||
| @@ -37,42 +35,36 @@ TRACE_EVENT(power_start, | |||
| 37 | TP_printk("type=%lu state=%lu", (unsigned long)__entry->type, (unsigned long)__entry->state) | 35 | TP_printk("type=%lu state=%lu", (unsigned long)__entry->type, (unsigned long)__entry->state) |
| 38 | ); | 36 | ); |
| 39 | 37 | ||
| 40 | TRACE_EVENT(power_end, | 38 | DEFINE_EVENT(power, power_start, |
| 41 | |||
| 42 | TP_PROTO(int dummy), | ||
| 43 | 39 | ||
| 44 | TP_ARGS(dummy), | 40 | TP_PROTO(unsigned int type, unsigned int state), |
| 45 | 41 | ||
| 46 | TP_STRUCT__entry( | 42 | TP_ARGS(type, state) |
| 47 | __field( u64, dummy ) | 43 | ); |
| 48 | ), | ||
| 49 | 44 | ||
| 50 | TP_fast_assign( | 45 | DEFINE_EVENT(power, power_frequency, |
| 51 | __entry->dummy = 0xffff; | ||
| 52 | ), | ||
| 53 | 46 | ||
| 54 | TP_printk("dummy=%lu", (unsigned long)__entry->dummy) | 47 | TP_PROTO(unsigned int type, unsigned int state), |
| 55 | 48 | ||
| 49 | TP_ARGS(type, state) | ||
| 56 | ); | 50 | ); |
| 57 | 51 | ||
| 52 | TRACE_EVENT(power_end, | ||
| 58 | 53 | ||
| 59 | TRACE_EVENT(power_frequency, | 54 | TP_PROTO(int dummy), |
| 60 | |||
| 61 | TP_PROTO(unsigned int type, unsigned int state), | ||
| 62 | 55 | ||
| 63 | TP_ARGS(type, state), | 56 | TP_ARGS(dummy), |
| 64 | 57 | ||
| 65 | TP_STRUCT__entry( | 58 | TP_STRUCT__entry( |
| 66 | __field( u64, type ) | 59 | __field( u64, dummy ) |
| 67 | __field( u64, state ) | ||
| 68 | ), | 60 | ), |
| 69 | 61 | ||
| 70 | TP_fast_assign( | 62 | TP_fast_assign( |
| 71 | __entry->type = type; | 63 | __entry->dummy = 0xffff; |
| 72 | __entry->state = state; | ||
| 73 | ), | 64 | ), |
| 74 | 65 | ||
| 75 | TP_printk("type=%lu state=%lu", (unsigned long)__entry->type, (unsigned long) __entry->state) | 66 | TP_printk("dummy=%lu", (unsigned long)__entry->dummy) |
| 67 | |||
| 76 | ); | 68 | ); |
| 77 | 69 | ||
| 78 | #endif /* _TRACE_POWER_H */ | 70 | #endif /* _TRACE_POWER_H */ |
diff --git a/include/trace/events/sched.h b/include/trace/events/sched.h index 4069c43f4187..cfceb0b73e20 100644 --- a/include/trace/events/sched.h +++ b/include/trace/events/sched.h | |||
| @@ -26,7 +26,7 @@ TRACE_EVENT(sched_kthread_stop, | |||
| 26 | __entry->pid = t->pid; | 26 | __entry->pid = t->pid; |
| 27 | ), | 27 | ), |
| 28 | 28 | ||
| 29 | TP_printk("task %s:%d", __entry->comm, __entry->pid) | 29 | TP_printk("comm=%s pid=%d", __entry->comm, __entry->pid) |
| 30 | ); | 30 | ); |
| 31 | 31 | ||
| 32 | /* | 32 | /* |
| @@ -46,7 +46,7 @@ TRACE_EVENT(sched_kthread_stop_ret, | |||
| 46 | __entry->ret = ret; | 46 | __entry->ret = ret; |
| 47 | ), | 47 | ), |
| 48 | 48 | ||
| 49 | TP_printk("ret %d", __entry->ret) | 49 | TP_printk("ret=%d", __entry->ret) |
| 50 | ); | 50 | ); |
| 51 | 51 | ||
| 52 | /* | 52 | /* |
| @@ -73,7 +73,7 @@ TRACE_EVENT(sched_wait_task, | |||
| 73 | __entry->prio = p->prio; | 73 | __entry->prio = p->prio; |
| 74 | ), | 74 | ), |
| 75 | 75 | ||
| 76 | TP_printk("task %s:%d [%d]", | 76 | TP_printk("comm=%s pid=%d prio=%d", |
| 77 | __entry->comm, __entry->pid, __entry->prio) | 77 | __entry->comm, __entry->pid, __entry->prio) |
| 78 | ); | 78 | ); |
| 79 | 79 | ||
| @@ -83,7 +83,7 @@ TRACE_EVENT(sched_wait_task, | |||
| 83 | * (NOTE: the 'rq' argument is not used by generic trace events, | 83 | * (NOTE: the 'rq' argument is not used by generic trace events, |
| 84 | * but used by the latency tracer plugin. ) | 84 | * but used by the latency tracer plugin. ) |
| 85 | */ | 85 | */ |
| 86 | TRACE_EVENT(sched_wakeup, | 86 | DECLARE_EVENT_CLASS(sched_wakeup_template, |
| 87 | 87 | ||
| 88 | TP_PROTO(struct rq *rq, struct task_struct *p, int success), | 88 | TP_PROTO(struct rq *rq, struct task_struct *p, int success), |
| 89 | 89 | ||
| @@ -94,7 +94,7 @@ TRACE_EVENT(sched_wakeup, | |||
| 94 | __field( pid_t, pid ) | 94 | __field( pid_t, pid ) |
| 95 | __field( int, prio ) | 95 | __field( int, prio ) |
| 96 | __field( int, success ) | 96 | __field( int, success ) |
| 97 | __field( int, cpu ) | 97 | __field( int, target_cpu ) |
| 98 | ), | 98 | ), |
| 99 | 99 | ||
| 100 | TP_fast_assign( | 100 | TP_fast_assign( |
| @@ -102,46 +102,27 @@ TRACE_EVENT(sched_wakeup, | |||
| 102 | __entry->pid = p->pid; | 102 | __entry->pid = p->pid; |
| 103 | __entry->prio = p->prio; | 103 | __entry->prio = p->prio; |
| 104 | __entry->success = success; | 104 | __entry->success = success; |
| 105 | __entry->cpu = task_cpu(p); | 105 | __entry->target_cpu = task_cpu(p); |
| 106 | ), | 106 | ), |
| 107 | 107 | ||
| 108 | TP_printk("task %s:%d [%d] success=%d [%03d]", | 108 | TP_printk("comm=%s pid=%d prio=%d success=%d target_cpu=%03d", |
| 109 | __entry->comm, __entry->pid, __entry->prio, | 109 | __entry->comm, __entry->pid, __entry->prio, |
| 110 | __entry->success, __entry->cpu) | 110 | __entry->success, __entry->target_cpu) |
| 111 | ); | 111 | ); |
| 112 | 112 | ||
| 113 | DEFINE_EVENT(sched_wakeup_template, sched_wakeup, | ||
| 114 | TP_PROTO(struct rq *rq, struct task_struct *p, int success), | ||
| 115 | TP_ARGS(rq, p, success)); | ||
| 116 | |||
| 113 | /* | 117 | /* |
| 114 | * Tracepoint for waking up a new task: | 118 | * Tracepoint for waking up a new task: |
| 115 | * | 119 | * |
| 116 | * (NOTE: the 'rq' argument is not used by generic trace events, | 120 | * (NOTE: the 'rq' argument is not used by generic trace events, |
| 117 | * but used by the latency tracer plugin. ) | 121 | * but used by the latency tracer plugin. ) |
| 118 | */ | 122 | */ |
| 119 | TRACE_EVENT(sched_wakeup_new, | 123 | DEFINE_EVENT(sched_wakeup_template, sched_wakeup_new, |
| 120 | 124 | TP_PROTO(struct rq *rq, struct task_struct *p, int success), | |
| 121 | TP_PROTO(struct rq *rq, struct task_struct *p, int success), | 125 | TP_ARGS(rq, p, success)); |
| 122 | |||
| 123 | TP_ARGS(rq, p, success), | ||
| 124 | |||
| 125 | TP_STRUCT__entry( | ||
| 126 | __array( char, comm, TASK_COMM_LEN ) | ||
| 127 | __field( pid_t, pid ) | ||
| 128 | __field( int, prio ) | ||
| 129 | __field( int, success ) | ||
| 130 | __field( int, cpu ) | ||
| 131 | ), | ||
| 132 | |||
| 133 | TP_fast_assign( | ||
| 134 | memcpy(__entry->comm, p->comm, TASK_COMM_LEN); | ||
| 135 | __entry->pid = p->pid; | ||
| 136 | __entry->prio = p->prio; | ||
| 137 | __entry->success = success; | ||
| 138 | __entry->cpu = task_cpu(p); | ||
| 139 | ), | ||
| 140 | |||
| 141 | TP_printk("task %s:%d [%d] success=%d [%03d]", | ||
| 142 | __entry->comm, __entry->pid, __entry->prio, | ||
| 143 | __entry->success, __entry->cpu) | ||
| 144 | ); | ||
| 145 | 126 | ||
| 146 | /* | 127 | /* |
| 147 | * Tracepoint for task switches, performed by the scheduler: | 128 | * Tracepoint for task switches, performed by the scheduler: |
| @@ -176,7 +157,7 @@ TRACE_EVENT(sched_switch, | |||
| 176 | __entry->next_prio = next->prio; | 157 | __entry->next_prio = next->prio; |
| 177 | ), | 158 | ), |
| 178 | 159 | ||
| 179 | TP_printk("task %s:%d [%d] (%s) ==> %s:%d [%d]", | 160 | TP_printk("prev_comm=%s prev_pid=%d prev_prio=%d prev_state=%s ==> next_comm=%s next_pid=%d next_prio=%d", |
| 180 | __entry->prev_comm, __entry->prev_pid, __entry->prev_prio, | 161 | __entry->prev_comm, __entry->prev_pid, __entry->prev_prio, |
| 181 | __entry->prev_state ? | 162 | __entry->prev_state ? |
| 182 | __print_flags(__entry->prev_state, "|", | 163 | __print_flags(__entry->prev_state, "|", |
| @@ -211,15 +192,12 @@ TRACE_EVENT(sched_migrate_task, | |||
| 211 | __entry->dest_cpu = dest_cpu; | 192 | __entry->dest_cpu = dest_cpu; |
| 212 | ), | 193 | ), |
| 213 | 194 | ||
| 214 | TP_printk("task %s:%d [%d] from: %d to: %d", | 195 | TP_printk("comm=%s pid=%d prio=%d orig_cpu=%d dest_cpu=%d", |
| 215 | __entry->comm, __entry->pid, __entry->prio, | 196 | __entry->comm, __entry->pid, __entry->prio, |
| 216 | __entry->orig_cpu, __entry->dest_cpu) | 197 | __entry->orig_cpu, __entry->dest_cpu) |
| 217 | ); | 198 | ); |
| 218 | 199 | ||
| 219 | /* | 200 | DECLARE_EVENT_CLASS(sched_process_template, |
| 220 | * Tracepoint for freeing a task: | ||
| 221 | */ | ||
| 222 | TRACE_EVENT(sched_process_free, | ||
| 223 | 201 | ||
| 224 | TP_PROTO(struct task_struct *p), | 202 | TP_PROTO(struct task_struct *p), |
| 225 | 203 | ||
| @@ -237,34 +215,24 @@ TRACE_EVENT(sched_process_free, | |||
| 237 | __entry->prio = p->prio; | 215 | __entry->prio = p->prio; |
| 238 | ), | 216 | ), |
| 239 | 217 | ||
| 240 | TP_printk("task %s:%d [%d]", | 218 | TP_printk("comm=%s pid=%d prio=%d", |
| 241 | __entry->comm, __entry->pid, __entry->prio) | 219 | __entry->comm, __entry->pid, __entry->prio) |
| 242 | ); | 220 | ); |
| 243 | 221 | ||
| 244 | /* | 222 | /* |
| 245 | * Tracepoint for a task exiting: | 223 | * Tracepoint for freeing a task: |
| 246 | */ | 224 | */ |
| 247 | TRACE_EVENT(sched_process_exit, | 225 | DEFINE_EVENT(sched_process_template, sched_process_free, |
| 226 | TP_PROTO(struct task_struct *p), | ||
| 227 | TP_ARGS(p)); | ||
| 228 | |||
| 248 | 229 | ||
| 249 | TP_PROTO(struct task_struct *p), | 230 | /* |
| 250 | 231 | * Tracepoint for a task exiting: | |
| 251 | TP_ARGS(p), | 232 | */ |
| 252 | 233 | DEFINE_EVENT(sched_process_template, sched_process_exit, | |
| 253 | TP_STRUCT__entry( | 234 | TP_PROTO(struct task_struct *p), |
| 254 | __array( char, comm, TASK_COMM_LEN ) | 235 | TP_ARGS(p)); |
| 255 | __field( pid_t, pid ) | ||
| 256 | __field( int, prio ) | ||
| 257 | ), | ||
| 258 | |||
| 259 | TP_fast_assign( | ||
| 260 | memcpy(__entry->comm, p->comm, TASK_COMM_LEN); | ||
| 261 | __entry->pid = p->pid; | ||
| 262 | __entry->prio = p->prio; | ||
| 263 | ), | ||
| 264 | |||
| 265 | TP_printk("task %s:%d [%d]", | ||
| 266 | __entry->comm, __entry->pid, __entry->prio) | ||
| 267 | ); | ||
| 268 | 236 | ||
| 269 | /* | 237 | /* |
| 270 | * Tracepoint for a waiting task: | 238 | * Tracepoint for a waiting task: |
| @@ -287,7 +255,7 @@ TRACE_EVENT(sched_process_wait, | |||
| 287 | __entry->prio = current->prio; | 255 | __entry->prio = current->prio; |
| 288 | ), | 256 | ), |
| 289 | 257 | ||
| 290 | TP_printk("task %s:%d [%d]", | 258 | TP_printk("comm=%s pid=%d prio=%d", |
| 291 | __entry->comm, __entry->pid, __entry->prio) | 259 | __entry->comm, __entry->pid, __entry->prio) |
| 292 | ); | 260 | ); |
| 293 | 261 | ||
| @@ -314,46 +282,16 @@ TRACE_EVENT(sched_process_fork, | |||
| 314 | __entry->child_pid = child->pid; | 282 | __entry->child_pid = child->pid; |
| 315 | ), | 283 | ), |
| 316 | 284 | ||
| 317 | TP_printk("parent %s:%d child %s:%d", | 285 | TP_printk("comm=%s pid=%d child_comm=%s child_pid=%d", |
| 318 | __entry->parent_comm, __entry->parent_pid, | 286 | __entry->parent_comm, __entry->parent_pid, |
| 319 | __entry->child_comm, __entry->child_pid) | 287 | __entry->child_comm, __entry->child_pid) |
| 320 | ); | 288 | ); |
| 321 | 289 | ||
| 322 | /* | 290 | /* |
| 323 | * Tracepoint for sending a signal: | ||
| 324 | */ | ||
| 325 | TRACE_EVENT(sched_signal_send, | ||
| 326 | |||
| 327 | TP_PROTO(int sig, struct task_struct *p), | ||
| 328 | |||
| 329 | TP_ARGS(sig, p), | ||
| 330 | |||
| 331 | TP_STRUCT__entry( | ||
| 332 | __field( int, sig ) | ||
| 333 | __array( char, comm, TASK_COMM_LEN ) | ||
| 334 | __field( pid_t, pid ) | ||
| 335 | ), | ||
| 336 | |||
| 337 | TP_fast_assign( | ||
| 338 | memcpy(__entry->comm, p->comm, TASK_COMM_LEN); | ||
| 339 | __entry->pid = p->pid; | ||
| 340 | __entry->sig = sig; | ||
| 341 | ), | ||
| 342 | |||
| 343 | TP_printk("sig: %d task %s:%d", | ||
| 344 | __entry->sig, __entry->comm, __entry->pid) | ||
| 345 | ); | ||
| 346 | |||
| 347 | /* | ||
| 348 | * XXX the below sched_stat tracepoints only apply to SCHED_OTHER/BATCH/IDLE | 291 | * XXX the below sched_stat tracepoints only apply to SCHED_OTHER/BATCH/IDLE |
| 349 | * adding sched_stat support to SCHED_FIFO/RR would be welcome. | 292 | * adding sched_stat support to SCHED_FIFO/RR would be welcome. |
| 350 | */ | 293 | */ |
| 351 | 294 | DECLARE_EVENT_CLASS(sched_stat_template, | |
| 352 | /* | ||
| 353 | * Tracepoint for accounting wait time (time the task is runnable | ||
| 354 | * but not actually running due to scheduler contention). | ||
| 355 | */ | ||
| 356 | TRACE_EVENT(sched_stat_wait, | ||
| 357 | 295 | ||
| 358 | TP_PROTO(struct task_struct *tsk, u64 delay), | 296 | TP_PROTO(struct task_struct *tsk, u64 delay), |
| 359 | 297 | ||
| @@ -374,11 +312,36 @@ TRACE_EVENT(sched_stat_wait, | |||
| 374 | __perf_count(delay); | 312 | __perf_count(delay); |
| 375 | ), | 313 | ), |
| 376 | 314 | ||
| 377 | TP_printk("task: %s:%d wait: %Lu [ns]", | 315 | TP_printk("comm=%s pid=%d delay=%Lu [ns]", |
| 378 | __entry->comm, __entry->pid, | 316 | __entry->comm, __entry->pid, |
| 379 | (unsigned long long)__entry->delay) | 317 | (unsigned long long)__entry->delay) |
| 380 | ); | 318 | ); |
| 381 | 319 | ||
| 320 | |||
| 321 | /* | ||
| 322 | * Tracepoint for accounting wait time (time the task is runnable | ||
| 323 | * but not actually running due to scheduler contention). | ||
| 324 | */ | ||
| 325 | DEFINE_EVENT(sched_stat_template, sched_stat_wait, | ||
| 326 | TP_PROTO(struct task_struct *tsk, u64 delay), | ||
| 327 | TP_ARGS(tsk, delay)); | ||
| 328 | |||
| 329 | /* | ||
| 330 | * Tracepoint for accounting sleep time (time the task is not runnable, | ||
| 331 | * including iowait, see below). | ||
| 332 | */ | ||
| 333 | DEFINE_EVENT(sched_stat_template, sched_stat_sleep, | ||
| 334 | TP_PROTO(struct task_struct *tsk, u64 delay), | ||
| 335 | TP_ARGS(tsk, delay)); | ||
| 336 | |||
| 337 | /* | ||
| 338 | * Tracepoint for accounting iowait time (time the task is not runnable | ||
| 339 | * due to waiting on IO to complete). | ||
| 340 | */ | ||
| 341 | DEFINE_EVENT(sched_stat_template, sched_stat_iowait, | ||
| 342 | TP_PROTO(struct task_struct *tsk, u64 delay), | ||
| 343 | TP_ARGS(tsk, delay)); | ||
| 344 | |||
| 382 | /* | 345 | /* |
| 383 | * Tracepoint for accounting runtime (time the task is executing | 346 | * Tracepoint for accounting runtime (time the task is executing |
| 384 | * on a CPU). | 347 | * on a CPU). |
| @@ -406,72 +369,12 @@ TRACE_EVENT(sched_stat_runtime, | |||
| 406 | __perf_count(runtime); | 369 | __perf_count(runtime); |
| 407 | ), | 370 | ), |
| 408 | 371 | ||
| 409 | TP_printk("task: %s:%d runtime: %Lu [ns], vruntime: %Lu [ns]", | 372 | TP_printk("comm=%s pid=%d runtime=%Lu [ns] vruntime=%Lu [ns]", |
| 410 | __entry->comm, __entry->pid, | 373 | __entry->comm, __entry->pid, |
| 411 | (unsigned long long)__entry->runtime, | 374 | (unsigned long long)__entry->runtime, |
| 412 | (unsigned long long)__entry->vruntime) | 375 | (unsigned long long)__entry->vruntime) |
| 413 | ); | 376 | ); |
| 414 | 377 | ||
| 415 | /* | ||
| 416 | * Tracepoint for accounting sleep time (time the task is not runnable, | ||
| 417 | * including iowait, see below). | ||
| 418 | */ | ||
| 419 | TRACE_EVENT(sched_stat_sleep, | ||
| 420 | |||
| 421 | TP_PROTO(struct task_struct *tsk, u64 delay), | ||
| 422 | |||
| 423 | TP_ARGS(tsk, delay), | ||
| 424 | |||
| 425 | TP_STRUCT__entry( | ||
| 426 | __array( char, comm, TASK_COMM_LEN ) | ||
| 427 | __field( pid_t, pid ) | ||
| 428 | __field( u64, delay ) | ||
| 429 | ), | ||
| 430 | |||
| 431 | TP_fast_assign( | ||
| 432 | memcpy(__entry->comm, tsk->comm, TASK_COMM_LEN); | ||
| 433 | __entry->pid = tsk->pid; | ||
| 434 | __entry->delay = delay; | ||
| 435 | ) | ||
| 436 | TP_perf_assign( | ||
| 437 | __perf_count(delay); | ||
| 438 | ), | ||
| 439 | |||
| 440 | TP_printk("task: %s:%d sleep: %Lu [ns]", | ||
| 441 | __entry->comm, __entry->pid, | ||
| 442 | (unsigned long long)__entry->delay) | ||
| 443 | ); | ||
| 444 | |||
| 445 | /* | ||
| 446 | * Tracepoint for accounting iowait time (time the task is not runnable | ||
| 447 | * due to waiting on IO to complete). | ||
| 448 | */ | ||
| 449 | TRACE_EVENT(sched_stat_iowait, | ||
| 450 | |||
| 451 | TP_PROTO(struct task_struct *tsk, u64 delay), | ||
| 452 | |||
| 453 | TP_ARGS(tsk, delay), | ||
| 454 | |||
| 455 | TP_STRUCT__entry( | ||
| 456 | __array( char, comm, TASK_COMM_LEN ) | ||
| 457 | __field( pid_t, pid ) | ||
| 458 | __field( u64, delay ) | ||
| 459 | ), | ||
| 460 | |||
| 461 | TP_fast_assign( | ||
| 462 | memcpy(__entry->comm, tsk->comm, TASK_COMM_LEN); | ||
| 463 | __entry->pid = tsk->pid; | ||
| 464 | __entry->delay = delay; | ||
| 465 | ) | ||
| 466 | TP_perf_assign( | ||
| 467 | __perf_count(delay); | ||
| 468 | ), | ||
| 469 | |||
| 470 | TP_printk("task: %s:%d iowait: %Lu [ns]", | ||
| 471 | __entry->comm, __entry->pid, | ||
| 472 | (unsigned long long)__entry->delay) | ||
| 473 | ); | ||
| 474 | |||
| 475 | #endif /* _TRACE_SCHED_H */ | 378 | #endif /* _TRACE_SCHED_H */ |
| 476 | 379 | ||
| 477 | /* This part must be outside protection */ | 380 | /* This part must be outside protection */ |
diff --git a/include/trace/events/signal.h b/include/trace/events/signal.h new file mode 100644 index 000000000000..a510b75ac304 --- /dev/null +++ b/include/trace/events/signal.h | |||
| @@ -0,0 +1,173 @@ | |||
| 1 | #undef TRACE_SYSTEM | ||
| 2 | #define TRACE_SYSTEM signal | ||
| 3 | |||
| 4 | #if !defined(_TRACE_SIGNAL_H) || defined(TRACE_HEADER_MULTI_READ) | ||
| 5 | #define _TRACE_SIGNAL_H | ||
| 6 | |||
| 7 | #include <linux/signal.h> | ||
| 8 | #include <linux/sched.h> | ||
| 9 | #include <linux/tracepoint.h> | ||
| 10 | |||
| 11 | #define TP_STORE_SIGINFO(__entry, info) \ | ||
| 12 | do { \ | ||
| 13 | if (info == SEND_SIG_NOINFO) { \ | ||
| 14 | __entry->errno = 0; \ | ||
| 15 | __entry->code = SI_USER; \ | ||
| 16 | } else if (info == SEND_SIG_PRIV) { \ | ||
| 17 | __entry->errno = 0; \ | ||
| 18 | __entry->code = SI_KERNEL; \ | ||
| 19 | } else { \ | ||
| 20 | __entry->errno = info->si_errno; \ | ||
| 21 | __entry->code = info->si_code; \ | ||
| 22 | } \ | ||
| 23 | } while (0) | ||
| 24 | |||
| 25 | /** | ||
| 26 | * signal_generate - called when a signal is generated | ||
| 27 | * @sig: signal number | ||
| 28 | * @info: pointer to struct siginfo | ||
| 29 | * @task: pointer to struct task_struct | ||
| 30 | * | ||
| 31 | * Current process sends a 'sig' signal to 'task' process with | ||
| 32 | * 'info' siginfo. If 'info' is SEND_SIG_NOINFO or SEND_SIG_PRIV, | ||
| 33 | * 'info' is not a pointer and you can't access its field. Instead, | ||
| 34 | * SEND_SIG_NOINFO means that si_code is SI_USER, and SEND_SIG_PRIV | ||
| 35 | * means that si_code is SI_KERNEL. | ||
| 36 | */ | ||
| 37 | TRACE_EVENT(signal_generate, | ||
| 38 | |||
| 39 | TP_PROTO(int sig, struct siginfo *info, struct task_struct *task), | ||
| 40 | |||
| 41 | TP_ARGS(sig, info, task), | ||
| 42 | |||
| 43 | TP_STRUCT__entry( | ||
| 44 | __field( int, sig ) | ||
| 45 | __field( int, errno ) | ||
| 46 | __field( int, code ) | ||
| 47 | __array( char, comm, TASK_COMM_LEN ) | ||
| 48 | __field( pid_t, pid ) | ||
| 49 | ), | ||
| 50 | |||
| 51 | TP_fast_assign( | ||
| 52 | __entry->sig = sig; | ||
| 53 | TP_STORE_SIGINFO(__entry, info); | ||
| 54 | memcpy(__entry->comm, task->comm, TASK_COMM_LEN); | ||
| 55 | __entry->pid = task->pid; | ||
| 56 | ), | ||
| 57 | |||
| 58 | TP_printk("sig=%d errno=%d code=%d comm=%s pid=%d", | ||
| 59 | __entry->sig, __entry->errno, __entry->code, | ||
| 60 | __entry->comm, __entry->pid) | ||
| 61 | ); | ||
| 62 | |||
| 63 | /** | ||
| 64 | * signal_deliver - called when a signal is delivered | ||
| 65 | * @sig: signal number | ||
| 66 | * @info: pointer to struct siginfo | ||
| 67 | * @ka: pointer to struct k_sigaction | ||
| 68 | * | ||
| 69 | * A 'sig' signal is delivered to current process with 'info' siginfo, | ||
| 70 | * and it will be handled by 'ka'. ka->sa.sa_handler can be SIG_IGN or | ||
| 71 | * SIG_DFL. | ||
| 72 | * Note that some signals reported by signal_generate tracepoint can be | ||
| 73 | * lost, ignored or modified (by debugger) before hitting this tracepoint. | ||
| 74 | * This means, this can show which signals are actually delivered, but | ||
| 75 | * matching generated signals and delivered signals may not be correct. | ||
| 76 | */ | ||
| 77 | TRACE_EVENT(signal_deliver, | ||
| 78 | |||
| 79 | TP_PROTO(int sig, struct siginfo *info, struct k_sigaction *ka), | ||
| 80 | |||
| 81 | TP_ARGS(sig, info, ka), | ||
| 82 | |||
| 83 | TP_STRUCT__entry( | ||
| 84 | __field( int, sig ) | ||
| 85 | __field( int, errno ) | ||
| 86 | __field( int, code ) | ||
| 87 | __field( unsigned long, sa_handler ) | ||
| 88 | __field( unsigned long, sa_flags ) | ||
| 89 | ), | ||
| 90 | |||
| 91 | TP_fast_assign( | ||
| 92 | __entry->sig = sig; | ||
| 93 | TP_STORE_SIGINFO(__entry, info); | ||
| 94 | __entry->sa_handler = (unsigned long)ka->sa.sa_handler; | ||
| 95 | __entry->sa_flags = ka->sa.sa_flags; | ||
| 96 | ), | ||
| 97 | |||
| 98 | TP_printk("sig=%d errno=%d code=%d sa_handler=%lx sa_flags=%lx", | ||
| 99 | __entry->sig, __entry->errno, __entry->code, | ||
| 100 | __entry->sa_handler, __entry->sa_flags) | ||
| 101 | ); | ||
| 102 | |||
| 103 | /** | ||
| 104 | * signal_overflow_fail - called when signal queue is overflow | ||
| 105 | * @sig: signal number | ||
| 106 | * @group: signal to process group or not (bool) | ||
| 107 | * @info: pointer to struct siginfo | ||
| 108 | * | ||
| 109 | * Kernel fails to generate 'sig' signal with 'info' siginfo, because | ||
| 110 | * siginfo queue is overflow, and the signal is dropped. | ||
| 111 | * 'group' is not 0 if the signal will be sent to a process group. | ||
| 112 | * 'sig' is always one of RT signals. | ||
| 113 | */ | ||
| 114 | TRACE_EVENT(signal_overflow_fail, | ||
| 115 | |||
| 116 | TP_PROTO(int sig, int group, struct siginfo *info), | ||
| 117 | |||
| 118 | TP_ARGS(sig, group, info), | ||
| 119 | |||
| 120 | TP_STRUCT__entry( | ||
| 121 | __field( int, sig ) | ||
| 122 | __field( int, group ) | ||
| 123 | __field( int, errno ) | ||
| 124 | __field( int, code ) | ||
| 125 | ), | ||
| 126 | |||
| 127 | TP_fast_assign( | ||
| 128 | __entry->sig = sig; | ||
| 129 | __entry->group = group; | ||
| 130 | TP_STORE_SIGINFO(__entry, info); | ||
| 131 | ), | ||
| 132 | |||
| 133 | TP_printk("sig=%d group=%d errno=%d code=%d", | ||
| 134 | __entry->sig, __entry->group, __entry->errno, __entry->code) | ||
| 135 | ); | ||
| 136 | |||
| 137 | /** | ||
| 138 | * signal_lose_info - called when siginfo is lost | ||
| 139 | * @sig: signal number | ||
| 140 | * @group: signal to process group or not (bool) | ||
| 141 | * @info: pointer to struct siginfo | ||
| 142 | * | ||
| 143 | * Kernel generates 'sig' signal but loses 'info' siginfo, because siginfo | ||
| 144 | * queue is overflow. | ||
| 145 | * 'group' is not 0 if the signal will be sent to a process group. | ||
| 146 | * 'sig' is always one of non-RT signals. | ||
| 147 | */ | ||
| 148 | TRACE_EVENT(signal_lose_info, | ||
| 149 | |||
| 150 | TP_PROTO(int sig, int group, struct siginfo *info), | ||
| 151 | |||
| 152 | TP_ARGS(sig, group, info), | ||
| 153 | |||
| 154 | TP_STRUCT__entry( | ||
| 155 | __field( int, sig ) | ||
| 156 | __field( int, group ) | ||
| 157 | __field( int, errno ) | ||
| 158 | __field( int, code ) | ||
| 159 | ), | ||
| 160 | |||
| 161 | TP_fast_assign( | ||
| 162 | __entry->sig = sig; | ||
| 163 | __entry->group = group; | ||
| 164 | TP_STORE_SIGINFO(__entry, info); | ||
| 165 | ), | ||
| 166 | |||
| 167 | TP_printk("sig=%d group=%d errno=%d code=%d", | ||
| 168 | __entry->sig, __entry->group, __entry->errno, __entry->code) | ||
| 169 | ); | ||
| 170 | #endif /* _TRACE_SIGNAL_H */ | ||
| 171 | |||
| 172 | /* This part must be outside protection */ | ||
| 173 | #include <trace/define_trace.h> | ||
diff --git a/include/trace/events/syscalls.h b/include/trace/events/syscalls.h index 397dff2dbd5a..fb726ac7caee 100644 --- a/include/trace/events/syscalls.h +++ b/include/trace/events/syscalls.h | |||
| @@ -1,5 +1,6 @@ | |||
| 1 | #undef TRACE_SYSTEM | 1 | #undef TRACE_SYSTEM |
| 2 | #define TRACE_SYSTEM syscalls | 2 | #define TRACE_SYSTEM raw_syscalls |
| 3 | #define TRACE_INCLUDE_FILE syscalls | ||
| 3 | 4 | ||
| 4 | #if !defined(_TRACE_EVENTS_SYSCALLS_H) || defined(TRACE_HEADER_MULTI_READ) | 5 | #if !defined(_TRACE_EVENTS_SYSCALLS_H) || defined(TRACE_HEADER_MULTI_READ) |
| 5 | #define _TRACE_EVENTS_SYSCALLS_H | 6 | #define _TRACE_EVENTS_SYSCALLS_H |
diff --git a/include/trace/events/timer.h b/include/trace/events/timer.h index 1844c48d640e..9496b965d62a 100644 --- a/include/trace/events/timer.h +++ b/include/trace/events/timer.h | |||
| @@ -26,7 +26,7 @@ TRACE_EVENT(timer_init, | |||
| 26 | __entry->timer = timer; | 26 | __entry->timer = timer; |
| 27 | ), | 27 | ), |
| 28 | 28 | ||
| 29 | TP_printk("timer %p", __entry->timer) | 29 | TP_printk("timer=%p", __entry->timer) |
| 30 | ); | 30 | ); |
| 31 | 31 | ||
| 32 | /** | 32 | /** |
| @@ -54,7 +54,7 @@ TRACE_EVENT(timer_start, | |||
| 54 | __entry->now = jiffies; | 54 | __entry->now = jiffies; |
| 55 | ), | 55 | ), |
| 56 | 56 | ||
| 57 | TP_printk("timer %p: func %pf, expires %lu, timeout %ld", | 57 | TP_printk("timer=%p function=%pf expires=%lu [timeout=%ld]", |
| 58 | __entry->timer, __entry->function, __entry->expires, | 58 | __entry->timer, __entry->function, __entry->expires, |
| 59 | (long)__entry->expires - __entry->now) | 59 | (long)__entry->expires - __entry->now) |
| 60 | ); | 60 | ); |
| @@ -81,7 +81,7 @@ TRACE_EVENT(timer_expire_entry, | |||
| 81 | __entry->now = jiffies; | 81 | __entry->now = jiffies; |
| 82 | ), | 82 | ), |
| 83 | 83 | ||
| 84 | TP_printk("timer %p: now %lu", __entry->timer, __entry->now) | 84 | TP_printk("timer=%p now=%lu", __entry->timer, __entry->now) |
| 85 | ); | 85 | ); |
| 86 | 86 | ||
| 87 | /** | 87 | /** |
| @@ -108,7 +108,7 @@ TRACE_EVENT(timer_expire_exit, | |||
| 108 | __entry->timer = timer; | 108 | __entry->timer = timer; |
| 109 | ), | 109 | ), |
| 110 | 110 | ||
| 111 | TP_printk("timer %p", __entry->timer) | 111 | TP_printk("timer=%p", __entry->timer) |
| 112 | ); | 112 | ); |
| 113 | 113 | ||
| 114 | /** | 114 | /** |
| @@ -129,7 +129,7 @@ TRACE_EVENT(timer_cancel, | |||
| 129 | __entry->timer = timer; | 129 | __entry->timer = timer; |
| 130 | ), | 130 | ), |
| 131 | 131 | ||
| 132 | TP_printk("timer %p", __entry->timer) | 132 | TP_printk("timer=%p", __entry->timer) |
| 133 | ); | 133 | ); |
| 134 | 134 | ||
| 135 | /** | 135 | /** |
| @@ -140,24 +140,24 @@ TRACE_EVENT(timer_cancel, | |||
| 140 | */ | 140 | */ |
| 141 | TRACE_EVENT(hrtimer_init, | 141 | TRACE_EVENT(hrtimer_init, |
| 142 | 142 | ||
| 143 | TP_PROTO(struct hrtimer *timer, clockid_t clockid, | 143 | TP_PROTO(struct hrtimer *hrtimer, clockid_t clockid, |
| 144 | enum hrtimer_mode mode), | 144 | enum hrtimer_mode mode), |
| 145 | 145 | ||
| 146 | TP_ARGS(timer, clockid, mode), | 146 | TP_ARGS(hrtimer, clockid, mode), |
| 147 | 147 | ||
| 148 | TP_STRUCT__entry( | 148 | TP_STRUCT__entry( |
| 149 | __field( void *, timer ) | 149 | __field( void *, hrtimer ) |
| 150 | __field( clockid_t, clockid ) | 150 | __field( clockid_t, clockid ) |
| 151 | __field( enum hrtimer_mode, mode ) | 151 | __field( enum hrtimer_mode, mode ) |
| 152 | ), | 152 | ), |
| 153 | 153 | ||
| 154 | TP_fast_assign( | 154 | TP_fast_assign( |
| 155 | __entry->timer = timer; | 155 | __entry->hrtimer = hrtimer; |
| 156 | __entry->clockid = clockid; | 156 | __entry->clockid = clockid; |
| 157 | __entry->mode = mode; | 157 | __entry->mode = mode; |
| 158 | ), | 158 | ), |
| 159 | 159 | ||
| 160 | TP_printk("hrtimer %p, clockid %s, mode %s", __entry->timer, | 160 | TP_printk("hrtimer=%p clockid=%s mode=%s", __entry->hrtimer, |
| 161 | __entry->clockid == CLOCK_REALTIME ? | 161 | __entry->clockid == CLOCK_REALTIME ? |
| 162 | "CLOCK_REALTIME" : "CLOCK_MONOTONIC", | 162 | "CLOCK_REALTIME" : "CLOCK_MONOTONIC", |
| 163 | __entry->mode == HRTIMER_MODE_ABS ? | 163 | __entry->mode == HRTIMER_MODE_ABS ? |
| @@ -170,26 +170,26 @@ TRACE_EVENT(hrtimer_init, | |||
| 170 | */ | 170 | */ |
| 171 | TRACE_EVENT(hrtimer_start, | 171 | TRACE_EVENT(hrtimer_start, |
| 172 | 172 | ||
| 173 | TP_PROTO(struct hrtimer *timer), | 173 | TP_PROTO(struct hrtimer *hrtimer), |
| 174 | 174 | ||
| 175 | TP_ARGS(timer), | 175 | TP_ARGS(hrtimer), |
| 176 | 176 | ||
| 177 | TP_STRUCT__entry( | 177 | TP_STRUCT__entry( |
| 178 | __field( void *, timer ) | 178 | __field( void *, hrtimer ) |
| 179 | __field( void *, function ) | 179 | __field( void *, function ) |
| 180 | __field( s64, expires ) | 180 | __field( s64, expires ) |
| 181 | __field( s64, softexpires ) | 181 | __field( s64, softexpires ) |
| 182 | ), | 182 | ), |
| 183 | 183 | ||
| 184 | TP_fast_assign( | 184 | TP_fast_assign( |
| 185 | __entry->timer = timer; | 185 | __entry->hrtimer = hrtimer; |
| 186 | __entry->function = timer->function; | 186 | __entry->function = hrtimer->function; |
| 187 | __entry->expires = hrtimer_get_expires(timer).tv64; | 187 | __entry->expires = hrtimer_get_expires(hrtimer).tv64; |
| 188 | __entry->softexpires = hrtimer_get_softexpires(timer).tv64; | 188 | __entry->softexpires = hrtimer_get_softexpires(hrtimer).tv64; |
| 189 | ), | 189 | ), |
| 190 | 190 | ||
| 191 | TP_printk("hrtimer %p, func %pf, expires %llu, softexpires %llu", | 191 | TP_printk("hrtimer=%p function=%pf expires=%llu softexpires=%llu", |
| 192 | __entry->timer, __entry->function, | 192 | __entry->hrtimer, __entry->function, |
| 193 | (unsigned long long)ktime_to_ns((ktime_t) { | 193 | (unsigned long long)ktime_to_ns((ktime_t) { |
| 194 | .tv64 = __entry->expires }), | 194 | .tv64 = __entry->expires }), |
| 195 | (unsigned long long)ktime_to_ns((ktime_t) { | 195 | (unsigned long long)ktime_to_ns((ktime_t) { |
| @@ -206,23 +206,22 @@ TRACE_EVENT(hrtimer_start, | |||
| 206 | */ | 206 | */ |
| 207 | TRACE_EVENT(hrtimer_expire_entry, | 207 | TRACE_EVENT(hrtimer_expire_entry, |
| 208 | 208 | ||
| 209 | TP_PROTO(struct hrtimer *timer, ktime_t *now), | 209 | TP_PROTO(struct hrtimer *hrtimer, ktime_t *now), |
| 210 | 210 | ||
| 211 | TP_ARGS(timer, now), | 211 | TP_ARGS(hrtimer, now), |
| 212 | 212 | ||
| 213 | TP_STRUCT__entry( | 213 | TP_STRUCT__entry( |
| 214 | __field( void *, timer ) | 214 | __field( void *, hrtimer ) |
| 215 | __field( s64, now ) | 215 | __field( s64, now ) |
| 216 | ), | 216 | ), |
| 217 | 217 | ||
| 218 | TP_fast_assign( | 218 | TP_fast_assign( |
| 219 | __entry->timer = timer; | 219 | __entry->hrtimer = hrtimer; |
| 220 | __entry->now = now->tv64; | 220 | __entry->now = now->tv64; |
| 221 | ), | 221 | ), |
| 222 | 222 | ||
| 223 | TP_printk("hrtimer %p, now %llu", __entry->timer, | 223 | TP_printk("hrtimer=%p now=%llu", __entry->hrtimer, |
| 224 | (unsigned long long)ktime_to_ns((ktime_t) { | 224 | (unsigned long long)ktime_to_ns((ktime_t) { .tv64 = __entry->now })) |
| 225 | .tv64 = __entry->now })) | ||
| 226 | ); | 225 | ); |
| 227 | 226 | ||
| 228 | /** | 227 | /** |
| @@ -234,40 +233,40 @@ TRACE_EVENT(hrtimer_expire_entry, | |||
| 234 | */ | 233 | */ |
| 235 | TRACE_EVENT(hrtimer_expire_exit, | 234 | TRACE_EVENT(hrtimer_expire_exit, |
| 236 | 235 | ||
| 237 | TP_PROTO(struct hrtimer *timer), | 236 | TP_PROTO(struct hrtimer *hrtimer), |
| 238 | 237 | ||
| 239 | TP_ARGS(timer), | 238 | TP_ARGS(hrtimer), |
| 240 | 239 | ||
| 241 | TP_STRUCT__entry( | 240 | TP_STRUCT__entry( |
| 242 | __field( void *, timer ) | 241 | __field( void *, hrtimer ) |
| 243 | ), | 242 | ), |
| 244 | 243 | ||
| 245 | TP_fast_assign( | 244 | TP_fast_assign( |
| 246 | __entry->timer = timer; | 245 | __entry->hrtimer = hrtimer; |
| 247 | ), | 246 | ), |
| 248 | 247 | ||
| 249 | TP_printk("hrtimer %p", __entry->timer) | 248 | TP_printk("hrtimer=%p", __entry->hrtimer) |
| 250 | ); | 249 | ); |
| 251 | 250 | ||
| 252 | /** | 251 | /** |
| 253 | * hrtimer_cancel - called when the hrtimer is canceled | 252 | * hrtimer_cancel - called when the hrtimer is canceled |
| 254 | * @timer: pointer to struct hrtimer | 253 | * @hrtimer: pointer to struct hrtimer |
| 255 | */ | 254 | */ |
| 256 | TRACE_EVENT(hrtimer_cancel, | 255 | TRACE_EVENT(hrtimer_cancel, |
| 257 | 256 | ||
| 258 | TP_PROTO(struct hrtimer *timer), | 257 | TP_PROTO(struct hrtimer *hrtimer), |
| 259 | 258 | ||
| 260 | TP_ARGS(timer), | 259 | TP_ARGS(hrtimer), |
| 261 | 260 | ||
| 262 | TP_STRUCT__entry( | 261 | TP_STRUCT__entry( |
| 263 | __field( void *, timer ) | 262 | __field( void *, hrtimer ) |
| 264 | ), | 263 | ), |
| 265 | 264 | ||
| 266 | TP_fast_assign( | 265 | TP_fast_assign( |
| 267 | __entry->timer = timer; | 266 | __entry->hrtimer = hrtimer; |
| 268 | ), | 267 | ), |
| 269 | 268 | ||
| 270 | TP_printk("hrtimer %p", __entry->timer) | 269 | TP_printk("hrtimer=%p", __entry->hrtimer) |
| 271 | ); | 270 | ); |
| 272 | 271 | ||
| 273 | /** | 272 | /** |
| @@ -302,8 +301,8 @@ TRACE_EVENT(itimer_state, | |||
| 302 | __entry->interval_usec = value->it_interval.tv_usec; | 301 | __entry->interval_usec = value->it_interval.tv_usec; |
| 303 | ), | 302 | ), |
| 304 | 303 | ||
| 305 | TP_printk("which %d, expires %lu, it_value %lu.%lu, it_interval %lu.%lu", | 304 | TP_printk("which=%d expires=%llu it_value=%ld.%ld it_interval=%ld.%ld", |
| 306 | __entry->which, __entry->expires, | 305 | __entry->which, (unsigned long long)__entry->expires, |
| 307 | __entry->value_sec, __entry->value_usec, | 306 | __entry->value_sec, __entry->value_usec, |
| 308 | __entry->interval_sec, __entry->interval_usec) | 307 | __entry->interval_sec, __entry->interval_usec) |
| 309 | ); | 308 | ); |
| @@ -332,8 +331,8 @@ TRACE_EVENT(itimer_expire, | |||
| 332 | __entry->pid = pid_nr(pid); | 331 | __entry->pid = pid_nr(pid); |
| 333 | ), | 332 | ), |
| 334 | 333 | ||
| 335 | TP_printk("which %d, pid %d, now %lu", __entry->which, | 334 | TP_printk("which=%d pid=%d now=%llu", __entry->which, |
| 336 | (int) __entry->pid, __entry->now) | 335 | (int) __entry->pid, (unsigned long long)__entry->now) |
| 337 | ); | 336 | ); |
| 338 | 337 | ||
| 339 | #endif /* _TRACE_TIMER_H */ | 338 | #endif /* _TRACE_TIMER_H */ |
diff --git a/include/trace/events/workqueue.h b/include/trace/events/workqueue.h index e4612dbd7ba6..d6c974474e70 100644 --- a/include/trace/events/workqueue.h +++ b/include/trace/events/workqueue.h | |||
| @@ -8,7 +8,7 @@ | |||
| 8 | #include <linux/sched.h> | 8 | #include <linux/sched.h> |
| 9 | #include <linux/tracepoint.h> | 9 | #include <linux/tracepoint.h> |
| 10 | 10 | ||
| 11 | TRACE_EVENT(workqueue_insertion, | 11 | DECLARE_EVENT_CLASS(workqueue, |
| 12 | 12 | ||
| 13 | TP_PROTO(struct task_struct *wq_thread, struct work_struct *work), | 13 | TP_PROTO(struct task_struct *wq_thread, struct work_struct *work), |
| 14 | 14 | ||
| @@ -30,26 +30,18 @@ TRACE_EVENT(workqueue_insertion, | |||
| 30 | __entry->thread_pid, __entry->func) | 30 | __entry->thread_pid, __entry->func) |
| 31 | ); | 31 | ); |
| 32 | 32 | ||
| 33 | TRACE_EVENT(workqueue_execution, | 33 | DEFINE_EVENT(workqueue, workqueue_insertion, |
| 34 | 34 | ||
| 35 | TP_PROTO(struct task_struct *wq_thread, struct work_struct *work), | 35 | TP_PROTO(struct task_struct *wq_thread, struct work_struct *work), |
| 36 | 36 | ||
| 37 | TP_ARGS(wq_thread, work), | 37 | TP_ARGS(wq_thread, work) |
| 38 | ); | ||
| 38 | 39 | ||
| 39 | TP_STRUCT__entry( | 40 | DEFINE_EVENT(workqueue, workqueue_execution, |
| 40 | __array(char, thread_comm, TASK_COMM_LEN) | ||
| 41 | __field(pid_t, thread_pid) | ||
| 42 | __field(work_func_t, func) | ||
| 43 | ), | ||
| 44 | 41 | ||
| 45 | TP_fast_assign( | 42 | TP_PROTO(struct task_struct *wq_thread, struct work_struct *work), |
| 46 | memcpy(__entry->thread_comm, wq_thread->comm, TASK_COMM_LEN); | ||
| 47 | __entry->thread_pid = wq_thread->pid; | ||
| 48 | __entry->func = work->func; | ||
| 49 | ), | ||
| 50 | 43 | ||
| 51 | TP_printk("thread=%s:%d func=%pf", __entry->thread_comm, | 44 | TP_ARGS(wq_thread, work) |
| 52 | __entry->thread_pid, __entry->func) | ||
| 53 | ); | 45 | ); |
| 54 | 46 | ||
| 55 | /* Trace the creation of one workqueue thread on a cpu */ | 47 | /* Trace the creation of one workqueue thread on a cpu */ |
diff --git a/include/trace/ftrace.h b/include/trace/ftrace.h index cc0d9667e182..ea6f9d4a20e9 100644 --- a/include/trace/ftrace.h +++ b/include/trace/ftrace.h | |||
| @@ -18,6 +18,26 @@ | |||
| 18 | 18 | ||
| 19 | #include <linux/ftrace_event.h> | 19 | #include <linux/ftrace_event.h> |
| 20 | 20 | ||
| 21 | /* | ||
| 22 | * DECLARE_EVENT_CLASS can be used to add a generic function | ||
| 23 | * handlers for events. That is, if all events have the same | ||
| 24 | * parameters and just have distinct trace points. | ||
| 25 | * Each tracepoint can be defined with DEFINE_EVENT and that | ||
| 26 | * will map the DECLARE_EVENT_CLASS to the tracepoint. | ||
| 27 | * | ||
| 28 | * TRACE_EVENT is a one to one mapping between tracepoint and template. | ||
| 29 | */ | ||
| 30 | #undef TRACE_EVENT | ||
| 31 | #define TRACE_EVENT(name, proto, args, tstruct, assign, print) \ | ||
| 32 | DECLARE_EVENT_CLASS(name, \ | ||
| 33 | PARAMS(proto), \ | ||
| 34 | PARAMS(args), \ | ||
| 35 | PARAMS(tstruct), \ | ||
| 36 | PARAMS(assign), \ | ||
| 37 | PARAMS(print)); \ | ||
| 38 | DEFINE_EVENT(name, name, PARAMS(proto), PARAMS(args)); | ||
| 39 | |||
| 40 | |||
| 21 | #undef __field | 41 | #undef __field |
| 22 | #define __field(type, item) type item; | 42 | #define __field(type, item) type item; |
| 23 | 43 | ||
| @@ -36,14 +56,21 @@ | |||
| 36 | #undef TP_STRUCT__entry | 56 | #undef TP_STRUCT__entry |
| 37 | #define TP_STRUCT__entry(args...) args | 57 | #define TP_STRUCT__entry(args...) args |
| 38 | 58 | ||
| 39 | #undef TRACE_EVENT | 59 | #undef DECLARE_EVENT_CLASS |
| 40 | #define TRACE_EVENT(name, proto, args, tstruct, assign, print) \ | 60 | #define DECLARE_EVENT_CLASS(name, proto, args, tstruct, assign, print) \ |
| 41 | struct ftrace_raw_##name { \ | 61 | struct ftrace_raw_##name { \ |
| 42 | struct trace_entry ent; \ | 62 | struct trace_entry ent; \ |
| 43 | tstruct \ | 63 | tstruct \ |
| 44 | char __data[0]; \ | 64 | char __data[0]; \ |
| 45 | }; \ | 65 | }; |
| 46 | static struct ftrace_event_call event_##name | 66 | #undef DEFINE_EVENT |
| 67 | #define DEFINE_EVENT(template, name, proto, args) \ | ||
| 68 | static struct ftrace_event_call \ | ||
| 69 | __attribute__((__aligned__(4))) event_##name | ||
| 70 | |||
| 71 | #undef DEFINE_EVENT_PRINT | ||
| 72 | #define DEFINE_EVENT_PRINT(template, name, proto, args, print) \ | ||
| 73 | DEFINE_EVENT(template, name, PARAMS(proto), PARAMS(args)) | ||
| 47 | 74 | ||
| 48 | #undef __cpparg | 75 | #undef __cpparg |
| 49 | #define __cpparg(arg...) arg | 76 | #define __cpparg(arg...) arg |
| @@ -89,99 +116,18 @@ | |||
| 89 | #undef __string | 116 | #undef __string |
| 90 | #define __string(item, src) __dynamic_array(char, item, -1) | 117 | #define __string(item, src) __dynamic_array(char, item, -1) |
| 91 | 118 | ||
| 92 | #undef TRACE_EVENT | 119 | #undef DECLARE_EVENT_CLASS |
| 93 | #define TRACE_EVENT(call, proto, args, tstruct, assign, print) \ | 120 | #define DECLARE_EVENT_CLASS(call, proto, args, tstruct, assign, print) \ |
| 94 | struct ftrace_data_offsets_##call { \ | 121 | struct ftrace_data_offsets_##call { \ |
| 95 | tstruct; \ | 122 | tstruct; \ |
| 96 | }; | 123 | }; |
| 97 | 124 | ||
| 98 | #include TRACE_INCLUDE(TRACE_INCLUDE_FILE) | 125 | #undef DEFINE_EVENT |
| 99 | 126 | #define DEFINE_EVENT(template, name, proto, args) | |
| 100 | /* | ||
| 101 | * Setup the showing format of trace point. | ||
| 102 | * | ||
| 103 | * int | ||
| 104 | * ftrace_format_##call(struct trace_seq *s) | ||
| 105 | * { | ||
| 106 | * struct ftrace_raw_##call field; | ||
| 107 | * int ret; | ||
| 108 | * | ||
| 109 | * ret = trace_seq_printf(s, #type " " #item ";" | ||
| 110 | * " offset:%u; size:%u;\n", | ||
| 111 | * offsetof(struct ftrace_raw_##call, item), | ||
| 112 | * sizeof(field.type)); | ||
| 113 | * | ||
| 114 | * } | ||
| 115 | */ | ||
| 116 | |||
| 117 | #undef TP_STRUCT__entry | ||
| 118 | #define TP_STRUCT__entry(args...) args | ||
| 119 | |||
| 120 | #undef __field | ||
| 121 | #define __field(type, item) \ | ||
| 122 | ret = trace_seq_printf(s, "\tfield:" #type " " #item ";\t" \ | ||
| 123 | "offset:%u;\tsize:%u;\n", \ | ||
| 124 | (unsigned int)offsetof(typeof(field), item), \ | ||
| 125 | (unsigned int)sizeof(field.item)); \ | ||
| 126 | if (!ret) \ | ||
| 127 | return 0; | ||
| 128 | |||
| 129 | #undef __field_ext | ||
| 130 | #define __field_ext(type, item, filter_type) __field(type, item) | ||
| 131 | |||
| 132 | #undef __array | ||
| 133 | #define __array(type, item, len) \ | ||
| 134 | ret = trace_seq_printf(s, "\tfield:" #type " " #item "[" #len "];\t" \ | ||
| 135 | "offset:%u;\tsize:%u;\n", \ | ||
| 136 | (unsigned int)offsetof(typeof(field), item), \ | ||
| 137 | (unsigned int)sizeof(field.item)); \ | ||
| 138 | if (!ret) \ | ||
| 139 | return 0; | ||
| 140 | |||
| 141 | #undef __dynamic_array | ||
| 142 | #define __dynamic_array(type, item, len) \ | ||
| 143 | ret = trace_seq_printf(s, "\tfield:__data_loc " #type "[] " #item ";\t"\ | ||
| 144 | "offset:%u;\tsize:%u;\n", \ | ||
| 145 | (unsigned int)offsetof(typeof(field), \ | ||
| 146 | __data_loc_##item), \ | ||
| 147 | (unsigned int)sizeof(field.__data_loc_##item)); \ | ||
| 148 | if (!ret) \ | ||
| 149 | return 0; | ||
| 150 | |||
| 151 | #undef __string | ||
| 152 | #define __string(item, src) __dynamic_array(char, item, -1) | ||
| 153 | |||
| 154 | #undef __entry | ||
| 155 | #define __entry REC | ||
| 156 | |||
| 157 | #undef __print_symbolic | ||
| 158 | #undef __get_dynamic_array | ||
| 159 | #undef __get_str | ||
| 160 | |||
| 161 | #undef TP_printk | ||
| 162 | #define TP_printk(fmt, args...) "%s, %s\n", #fmt, __stringify(args) | ||
| 163 | |||
| 164 | #undef TP_fast_assign | ||
| 165 | #define TP_fast_assign(args...) args | ||
| 166 | |||
| 167 | #undef TP_perf_assign | ||
| 168 | #define TP_perf_assign(args...) | ||
| 169 | 127 | ||
| 170 | #undef TRACE_EVENT | 128 | #undef DEFINE_EVENT_PRINT |
| 171 | #define TRACE_EVENT(call, proto, args, tstruct, func, print) \ | 129 | #define DEFINE_EVENT_PRINT(template, name, proto, args, print) \ |
| 172 | static int \ | 130 | DEFINE_EVENT(template, name, PARAMS(proto), PARAMS(args)) |
| 173 | ftrace_format_##call(struct ftrace_event_call *unused, \ | ||
| 174 | struct trace_seq *s) \ | ||
| 175 | { \ | ||
| 176 | struct ftrace_raw_##call field __attribute__((unused)); \ | ||
| 177 | int ret = 0; \ | ||
| 178 | \ | ||
| 179 | tstruct; \ | ||
| 180 | \ | ||
| 181 | trace_seq_printf(s, "\nprint fmt: " print); \ | ||
| 182 | \ | ||
| 183 | return ret; \ | ||
| 184 | } | ||
| 185 | 131 | ||
| 186 | #include TRACE_INCLUDE(TRACE_INCLUDE_FILE) | 132 | #include TRACE_INCLUDE(TRACE_INCLUDE_FILE) |
| 187 | 133 | ||
| @@ -252,10 +198,11 @@ ftrace_format_##call(struct ftrace_event_call *unused, \ | |||
| 252 | ftrace_print_symbols_seq(p, value, symbols); \ | 198 | ftrace_print_symbols_seq(p, value, symbols); \ |
| 253 | }) | 199 | }) |
| 254 | 200 | ||
| 255 | #undef TRACE_EVENT | 201 | #undef DECLARE_EVENT_CLASS |
| 256 | #define TRACE_EVENT(call, proto, args, tstruct, assign, print) \ | 202 | #define DECLARE_EVENT_CLASS(call, proto, args, tstruct, assign, print) \ |
| 257 | static enum print_line_t \ | 203 | static notrace enum print_line_t \ |
| 258 | ftrace_raw_output_##call(struct trace_iterator *iter, int flags) \ | 204 | ftrace_raw_output_id_##call(int event_id, const char *name, \ |
| 205 | struct trace_iterator *iter, int flags) \ | ||
| 259 | { \ | 206 | { \ |
| 260 | struct trace_seq *s = &iter->seq; \ | 207 | struct trace_seq *s = &iter->seq; \ |
| 261 | struct ftrace_raw_##call *field; \ | 208 | struct ftrace_raw_##call *field; \ |
| @@ -265,6 +212,47 @@ ftrace_raw_output_##call(struct trace_iterator *iter, int flags) \ | |||
| 265 | \ | 212 | \ |
| 266 | entry = iter->ent; \ | 213 | entry = iter->ent; \ |
| 267 | \ | 214 | \ |
| 215 | if (entry->type != event_id) { \ | ||
| 216 | WARN_ON_ONCE(1); \ | ||
| 217 | return TRACE_TYPE_UNHANDLED; \ | ||
| 218 | } \ | ||
| 219 | \ | ||
| 220 | field = (typeof(field))entry; \ | ||
| 221 | \ | ||
| 222 | p = &get_cpu_var(ftrace_event_seq); \ | ||
| 223 | trace_seq_init(p); \ | ||
| 224 | ret = trace_seq_printf(s, "%s: ", name); \ | ||
| 225 | if (ret) \ | ||
| 226 | ret = trace_seq_printf(s, print); \ | ||
| 227 | put_cpu(); \ | ||
| 228 | if (!ret) \ | ||
| 229 | return TRACE_TYPE_PARTIAL_LINE; \ | ||
| 230 | \ | ||
| 231 | return TRACE_TYPE_HANDLED; \ | ||
| 232 | } | ||
| 233 | |||
| 234 | #undef DEFINE_EVENT | ||
| 235 | #define DEFINE_EVENT(template, name, proto, args) \ | ||
| 236 | static notrace enum print_line_t \ | ||
| 237 | ftrace_raw_output_##name(struct trace_iterator *iter, int flags) \ | ||
| 238 | { \ | ||
| 239 | return ftrace_raw_output_id_##template(event_##name.id, \ | ||
| 240 | #name, iter, flags); \ | ||
| 241 | } | ||
| 242 | |||
| 243 | #undef DEFINE_EVENT_PRINT | ||
| 244 | #define DEFINE_EVENT_PRINT(template, call, proto, args, print) \ | ||
| 245 | static notrace enum print_line_t \ | ||
| 246 | ftrace_raw_output_##call(struct trace_iterator *iter, int flags) \ | ||
| 247 | { \ | ||
| 248 | struct trace_seq *s = &iter->seq; \ | ||
| 249 | struct ftrace_raw_##template *field; \ | ||
| 250 | struct trace_entry *entry; \ | ||
| 251 | struct trace_seq *p; \ | ||
| 252 | int ret; \ | ||
| 253 | \ | ||
| 254 | entry = iter->ent; \ | ||
| 255 | \ | ||
| 268 | if (entry->type != event_##call.id) { \ | 256 | if (entry->type != event_##call.id) { \ |
| 269 | WARN_ON_ONCE(1); \ | 257 | WARN_ON_ONCE(1); \ |
| 270 | return TRACE_TYPE_UNHANDLED; \ | 258 | return TRACE_TYPE_UNHANDLED; \ |
| @@ -274,14 +262,16 @@ ftrace_raw_output_##call(struct trace_iterator *iter, int flags) \ | |||
| 274 | \ | 262 | \ |
| 275 | p = &get_cpu_var(ftrace_event_seq); \ | 263 | p = &get_cpu_var(ftrace_event_seq); \ |
| 276 | trace_seq_init(p); \ | 264 | trace_seq_init(p); \ |
| 277 | ret = trace_seq_printf(s, #call ": " print); \ | 265 | ret = trace_seq_printf(s, "%s: ", #call); \ |
| 266 | if (ret) \ | ||
| 267 | ret = trace_seq_printf(s, print); \ | ||
| 278 | put_cpu(); \ | 268 | put_cpu(); \ |
| 279 | if (!ret) \ | 269 | if (!ret) \ |
| 280 | return TRACE_TYPE_PARTIAL_LINE; \ | 270 | return TRACE_TYPE_PARTIAL_LINE; \ |
| 281 | \ | 271 | \ |
| 282 | return TRACE_TYPE_HANDLED; \ | 272 | return TRACE_TYPE_HANDLED; \ |
| 283 | } | 273 | } |
| 284 | 274 | ||
| 285 | #include TRACE_INCLUDE(TRACE_INCLUDE_FILE) | 275 | #include TRACE_INCLUDE(TRACE_INCLUDE_FILE) |
| 286 | 276 | ||
| 287 | #undef __field_ext | 277 | #undef __field_ext |
| @@ -301,7 +291,8 @@ ftrace_raw_output_##call(struct trace_iterator *iter, int flags) \ | |||
| 301 | BUILD_BUG_ON(len > MAX_FILTER_STR_VAL); \ | 291 | BUILD_BUG_ON(len > MAX_FILTER_STR_VAL); \ |
| 302 | ret = trace_define_field(event_call, #type "[" #len "]", #item, \ | 292 | ret = trace_define_field(event_call, #type "[" #len "]", #item, \ |
| 303 | offsetof(typeof(field), item), \ | 293 | offsetof(typeof(field), item), \ |
| 304 | sizeof(field.item), 0, FILTER_OTHER); \ | 294 | sizeof(field.item), \ |
| 295 | is_signed_type(type), FILTER_OTHER); \ | ||
| 305 | if (ret) \ | 296 | if (ret) \ |
| 306 | return ret; | 297 | return ret; |
| 307 | 298 | ||
| @@ -309,29 +300,32 @@ ftrace_raw_output_##call(struct trace_iterator *iter, int flags) \ | |||
| 309 | #define __dynamic_array(type, item, len) \ | 300 | #define __dynamic_array(type, item, len) \ |
| 310 | ret = trace_define_field(event_call, "__data_loc " #type "[]", #item, \ | 301 | ret = trace_define_field(event_call, "__data_loc " #type "[]", #item, \ |
| 311 | offsetof(typeof(field), __data_loc_##item), \ | 302 | offsetof(typeof(field), __data_loc_##item), \ |
| 312 | sizeof(field.__data_loc_##item), 0, \ | 303 | sizeof(field.__data_loc_##item), \ |
| 313 | FILTER_OTHER); | 304 | is_signed_type(type), FILTER_OTHER); |
| 314 | 305 | ||
| 315 | #undef __string | 306 | #undef __string |
| 316 | #define __string(item, src) __dynamic_array(char, item, -1) | 307 | #define __string(item, src) __dynamic_array(char, item, -1) |
| 317 | 308 | ||
| 318 | #undef TRACE_EVENT | 309 | #undef DECLARE_EVENT_CLASS |
| 319 | #define TRACE_EVENT(call, proto, args, tstruct, func, print) \ | 310 | #define DECLARE_EVENT_CLASS(call, proto, args, tstruct, func, print) \ |
| 320 | static int \ | 311 | static int notrace \ |
| 321 | ftrace_define_fields_##call(struct ftrace_event_call *event_call) \ | 312 | ftrace_define_fields_##call(struct ftrace_event_call *event_call) \ |
| 322 | { \ | 313 | { \ |
| 323 | struct ftrace_raw_##call field; \ | 314 | struct ftrace_raw_##call field; \ |
| 324 | int ret; \ | 315 | int ret; \ |
| 325 | \ | 316 | \ |
| 326 | ret = trace_define_common_fields(event_call); \ | ||
| 327 | if (ret) \ | ||
| 328 | return ret; \ | ||
| 329 | \ | ||
| 330 | tstruct; \ | 317 | tstruct; \ |
| 331 | \ | 318 | \ |
| 332 | return ret; \ | 319 | return ret; \ |
| 333 | } | 320 | } |
| 334 | 321 | ||
| 322 | #undef DEFINE_EVENT | ||
| 323 | #define DEFINE_EVENT(template, name, proto, args) | ||
| 324 | |||
| 325 | #undef DEFINE_EVENT_PRINT | ||
| 326 | #define DEFINE_EVENT_PRINT(template, name, proto, args, print) \ | ||
| 327 | DEFINE_EVENT(template, name, PARAMS(proto), PARAMS(args)) | ||
| 328 | |||
| 335 | #include TRACE_INCLUDE(TRACE_INCLUDE_FILE) | 329 | #include TRACE_INCLUDE(TRACE_INCLUDE_FILE) |
| 336 | 330 | ||
| 337 | /* | 331 | /* |
| @@ -358,11 +352,11 @@ ftrace_define_fields_##call(struct ftrace_event_call *event_call) \ | |||
| 358 | __data_size += (len) * sizeof(type); | 352 | __data_size += (len) * sizeof(type); |
| 359 | 353 | ||
| 360 | #undef __string | 354 | #undef __string |
| 361 | #define __string(item, src) __dynamic_array(char, item, strlen(src) + 1) \ | 355 | #define __string(item, src) __dynamic_array(char, item, strlen(src) + 1) |
| 362 | 356 | ||
| 363 | #undef TRACE_EVENT | 357 | #undef DECLARE_EVENT_CLASS |
| 364 | #define TRACE_EVENT(call, proto, args, tstruct, assign, print) \ | 358 | #define DECLARE_EVENT_CLASS(call, proto, args, tstruct, assign, print) \ |
| 365 | static inline int ftrace_get_offsets_##call( \ | 359 | static inline notrace int ftrace_get_offsets_##call( \ |
| 366 | struct ftrace_data_offsets_##call *__data_offsets, proto) \ | 360 | struct ftrace_data_offsets_##call *__data_offsets, proto) \ |
| 367 | { \ | 361 | { \ |
| 368 | int __data_size = 0; \ | 362 | int __data_size = 0; \ |
| @@ -373,9 +367,16 @@ static inline int ftrace_get_offsets_##call( \ | |||
| 373 | return __data_size; \ | 367 | return __data_size; \ |
| 374 | } | 368 | } |
| 375 | 369 | ||
| 370 | #undef DEFINE_EVENT | ||
| 371 | #define DEFINE_EVENT(template, name, proto, args) | ||
| 372 | |||
| 373 | #undef DEFINE_EVENT_PRINT | ||
| 374 | #define DEFINE_EVENT_PRINT(template, name, proto, args, print) \ | ||
| 375 | DEFINE_EVENT(template, name, PARAMS(proto), PARAMS(args)) | ||
| 376 | |||
| 376 | #include TRACE_INCLUDE(TRACE_INCLUDE_FILE) | 377 | #include TRACE_INCLUDE(TRACE_INCLUDE_FILE) |
| 377 | 378 | ||
| 378 | #ifdef CONFIG_EVENT_PROFILE | 379 | #ifdef CONFIG_PERF_EVENTS |
| 379 | 380 | ||
| 380 | /* | 381 | /* |
| 381 | * Generate the functions needed for tracepoint perf_event support. | 382 | * Generate the functions needed for tracepoint perf_event support. |
| @@ -394,24 +395,33 @@ static inline int ftrace_get_offsets_##call( \ | |||
| 394 | * | 395 | * |
| 395 | */ | 396 | */ |
| 396 | 397 | ||
| 397 | #undef TRACE_EVENT | 398 | #undef DECLARE_EVENT_CLASS |
| 398 | #define TRACE_EVENT(call, proto, args, tstruct, assign, print) \ | 399 | #define DECLARE_EVENT_CLASS(call, proto, args, tstruct, assign, print) |
| 400 | |||
| 401 | #undef DEFINE_EVENT | ||
| 402 | #define DEFINE_EVENT(template, name, proto, args) \ | ||
| 399 | \ | 403 | \ |
| 400 | static void ftrace_profile_##call(proto); \ | 404 | static void perf_trace_##name(proto); \ |
| 401 | \ | 405 | \ |
| 402 | static int ftrace_profile_enable_##call(void) \ | 406 | static notrace int \ |
| 407 | perf_trace_enable_##name(struct ftrace_event_call *unused) \ | ||
| 403 | { \ | 408 | { \ |
| 404 | return register_trace_##call(ftrace_profile_##call); \ | 409 | return register_trace_##name(perf_trace_##name); \ |
| 405 | } \ | 410 | } \ |
| 406 | \ | 411 | \ |
| 407 | static void ftrace_profile_disable_##call(void) \ | 412 | static notrace void \ |
| 413 | perf_trace_disable_##name(struct ftrace_event_call *unused) \ | ||
| 408 | { \ | 414 | { \ |
| 409 | unregister_trace_##call(ftrace_profile_##call); \ | 415 | unregister_trace_##name(perf_trace_##name); \ |
| 410 | } | 416 | } |
| 411 | 417 | ||
| 418 | #undef DEFINE_EVENT_PRINT | ||
| 419 | #define DEFINE_EVENT_PRINT(template, name, proto, args, print) \ | ||
| 420 | DEFINE_EVENT(template, name, PARAMS(proto), PARAMS(args)) | ||
| 421 | |||
| 412 | #include TRACE_INCLUDE(TRACE_INCLUDE_FILE) | 422 | #include TRACE_INCLUDE(TRACE_INCLUDE_FILE) |
| 413 | 423 | ||
| 414 | #endif | 424 | #endif /* CONFIG_PERF_EVENTS */ |
| 415 | 425 | ||
| 416 | /* | 426 | /* |
| 417 | * Stage 4 of the trace events. | 427 | * Stage 4 of the trace events. |
| @@ -423,18 +433,12 @@ static void ftrace_profile_disable_##call(void) \ | |||
| 423 | * event_trace_printk(_RET_IP_, "<call>: " <fmt>); | 433 | * event_trace_printk(_RET_IP_, "<call>: " <fmt>); |
| 424 | * } | 434 | * } |
| 425 | * | 435 | * |
| 426 | * static int ftrace_reg_event_<call>(void) | 436 | * static int ftrace_reg_event_<call>(struct ftrace_event_call *unused) |
| 427 | * { | 437 | * { |
| 428 | * int ret; | 438 | * return register_trace_<call>(ftrace_event_<call>); |
| 429 | * | ||
| 430 | * ret = register_trace_<call>(ftrace_event_<call>); | ||
| 431 | * if (!ret) | ||
| 432 | * pr_info("event trace: Could not activate trace point " | ||
| 433 | * "probe to <call>"); | ||
| 434 | * return ret; | ||
| 435 | * } | 439 | * } |
| 436 | * | 440 | * |
| 437 | * static void ftrace_unreg_event_<call>(void) | 441 | * static void ftrace_unreg_event_<call>(struct ftrace_event_call *unused) |
| 438 | * { | 442 | * { |
| 439 | * unregister_trace_<call>(ftrace_event_<call>); | 443 | * unregister_trace_<call>(ftrace_event_<call>); |
| 440 | * } | 444 | * } |
| @@ -469,7 +473,7 @@ static void ftrace_profile_disable_##call(void) \ | |||
| 469 | * trace_current_buffer_unlock_commit(buffer, event, irq_flags, pc); | 473 | * trace_current_buffer_unlock_commit(buffer, event, irq_flags, pc); |
| 470 | * } | 474 | * } |
| 471 | * | 475 | * |
| 472 | * static int ftrace_raw_reg_event_<call>(void) | 476 | * static int ftrace_raw_reg_event_<call>(struct ftrace_event_call *unused) |
| 473 | * { | 477 | * { |
| 474 | * int ret; | 478 | * int ret; |
| 475 | * | 479 | * |
| @@ -480,7 +484,7 @@ static void ftrace_profile_disable_##call(void) \ | |||
| 480 | * return ret; | 484 | * return ret; |
| 481 | * } | 485 | * } |
| 482 | * | 486 | * |
| 483 | * static void ftrace_unreg_event_<call>(void) | 487 | * static void ftrace_unreg_event_<call>(struct ftrace_event_call *unused) |
| 484 | * { | 488 | * { |
| 485 | * unregister_trace_<call>(ftrace_raw_event_<call>); | 489 | * unregister_trace_<call>(ftrace_raw_event_<call>); |
| 486 | * } | 490 | * } |
| @@ -489,43 +493,27 @@ static void ftrace_profile_disable_##call(void) \ | |||
| 489 | * .trace = ftrace_raw_output_<call>, <-- stage 2 | 493 | * .trace = ftrace_raw_output_<call>, <-- stage 2 |
| 490 | * }; | 494 | * }; |
| 491 | * | 495 | * |
| 492 | * static int ftrace_raw_init_event_<call>(void) | ||
| 493 | * { | ||
| 494 | * int id; | ||
| 495 | * | ||
| 496 | * id = register_ftrace_event(&ftrace_event_type_<call>); | ||
| 497 | * if (!id) | ||
| 498 | * return -ENODEV; | ||
| 499 | * event_<call>.id = id; | ||
| 500 | * return 0; | ||
| 501 | * } | ||
| 502 | * | ||
| 503 | * static struct ftrace_event_call __used | 496 | * static struct ftrace_event_call __used |
| 504 | * __attribute__((__aligned__(4))) | 497 | * __attribute__((__aligned__(4))) |
| 505 | * __attribute__((section("_ftrace_events"))) event_<call> = { | 498 | * __attribute__((section("_ftrace_events"))) event_<call> = { |
| 506 | * .name = "<call>", | 499 | * .name = "<call>", |
| 507 | * .system = "<system>", | 500 | * .system = "<system>", |
| 508 | * .raw_init = ftrace_raw_init_event_<call>, | 501 | * .raw_init = trace_event_raw_init, |
| 509 | * .regfunc = ftrace_reg_event_<call>, | 502 | * .regfunc = ftrace_reg_event_<call>, |
| 510 | * .unregfunc = ftrace_unreg_event_<call>, | 503 | * .unregfunc = ftrace_unreg_event_<call>, |
| 511 | * .show_format = ftrace_format_<call>, | ||
| 512 | * } | 504 | * } |
| 513 | * | 505 | * |
| 514 | */ | 506 | */ |
| 515 | 507 | ||
| 516 | #undef TP_FMT | 508 | #ifdef CONFIG_PERF_EVENTS |
| 517 | #define TP_FMT(fmt, args...) fmt "\n", ##args | ||
| 518 | |||
| 519 | #ifdef CONFIG_EVENT_PROFILE | ||
| 520 | 509 | ||
| 521 | #define _TRACE_PROFILE_INIT(call) \ | 510 | #define _TRACE_PERF_INIT(call) \ |
| 522 | .profile_count = ATOMIC_INIT(-1), \ | 511 | .perf_event_enable = perf_trace_enable_##call, \ |
| 523 | .profile_enable = ftrace_profile_enable_##call, \ | 512 | .perf_event_disable = perf_trace_disable_##call, |
| 524 | .profile_disable = ftrace_profile_disable_##call, | ||
| 525 | 513 | ||
| 526 | #else | 514 | #else |
| 527 | #define _TRACE_PROFILE_INIT(call) | 515 | #define _TRACE_PERF_INIT(call) |
| 528 | #endif | 516 | #endif /* CONFIG_PERF_EVENTS */ |
| 529 | 517 | ||
| 530 | #undef __entry | 518 | #undef __entry |
| 531 | #define __entry entry | 519 | #define __entry entry |
| @@ -547,15 +535,20 @@ static void ftrace_profile_disable_##call(void) \ | |||
| 547 | #define __assign_str(dst, src) \ | 535 | #define __assign_str(dst, src) \ |
| 548 | strcpy(__get_str(dst), src); | 536 | strcpy(__get_str(dst), src); |
| 549 | 537 | ||
| 550 | #undef TRACE_EVENT | 538 | #undef TP_fast_assign |
| 551 | #define TRACE_EVENT(call, proto, args, tstruct, assign, print) \ | 539 | #define TP_fast_assign(args...) args |
| 552 | \ | 540 | |
| 553 | static struct ftrace_event_call event_##call; \ | 541 | #undef TP_perf_assign |
| 542 | #define TP_perf_assign(args...) | ||
| 543 | |||
| 544 | #undef DECLARE_EVENT_CLASS | ||
| 545 | #define DECLARE_EVENT_CLASS(call, proto, args, tstruct, assign, print) \ | ||
| 554 | \ | 546 | \ |
| 555 | static void ftrace_raw_event_##call(proto) \ | 547 | static notrace void \ |
| 548 | ftrace_raw_event_id_##call(struct ftrace_event_call *event_call, \ | ||
| 549 | proto) \ | ||
| 556 | { \ | 550 | { \ |
| 557 | struct ftrace_data_offsets_##call __maybe_unused __data_offsets;\ | 551 | struct ftrace_data_offsets_##call __maybe_unused __data_offsets;\ |
| 558 | struct ftrace_event_call *event_call = &event_##call; \ | ||
| 559 | struct ring_buffer_event *event; \ | 552 | struct ring_buffer_event *event; \ |
| 560 | struct ftrace_raw_##call *entry; \ | 553 | struct ftrace_raw_##call *entry; \ |
| 561 | struct ring_buffer *buffer; \ | 554 | struct ring_buffer *buffer; \ |
| @@ -569,7 +562,7 @@ static void ftrace_raw_event_##call(proto) \ | |||
| 569 | __data_size = ftrace_get_offsets_##call(&__data_offsets, args); \ | 562 | __data_size = ftrace_get_offsets_##call(&__data_offsets, args); \ |
| 570 | \ | 563 | \ |
| 571 | event = trace_current_buffer_lock_reserve(&buffer, \ | 564 | event = trace_current_buffer_lock_reserve(&buffer, \ |
| 572 | event_##call.id, \ | 565 | event_call->id, \ |
| 573 | sizeof(*entry) + __data_size, \ | 566 | sizeof(*entry) + __data_size, \ |
| 574 | irq_flags, pc); \ | 567 | irq_flags, pc); \ |
| 575 | if (!event) \ | 568 | if (!event) \ |
| @@ -584,39 +577,74 @@ static void ftrace_raw_event_##call(proto) \ | |||
| 584 | if (!filter_current_check_discard(buffer, event_call, entry, event)) \ | 577 | if (!filter_current_check_discard(buffer, event_call, entry, event)) \ |
| 585 | trace_nowake_buffer_unlock_commit(buffer, \ | 578 | trace_nowake_buffer_unlock_commit(buffer, \ |
| 586 | event, irq_flags, pc); \ | 579 | event, irq_flags, pc); \ |
| 587 | } \ | 580 | } |
| 581 | |||
| 582 | #undef DEFINE_EVENT | ||
| 583 | #define DEFINE_EVENT(template, call, proto, args) \ | ||
| 588 | \ | 584 | \ |
| 589 | static int ftrace_raw_reg_event_##call(void *ptr) \ | 585 | static notrace void ftrace_raw_event_##call(proto) \ |
| 590 | { \ | 586 | { \ |
| 591 | int ret; \ | 587 | ftrace_raw_event_id_##template(&event_##call, args); \ |
| 588 | } \ | ||
| 592 | \ | 589 | \ |
| 593 | ret = register_trace_##call(ftrace_raw_event_##call); \ | 590 | static notrace int \ |
| 594 | if (ret) \ | 591 | ftrace_raw_reg_event_##call(struct ftrace_event_call *unused) \ |
| 595 | pr_info("event trace: Could not activate trace point " \ | 592 | { \ |
| 596 | "probe to " #call "\n"); \ | 593 | return register_trace_##call(ftrace_raw_event_##call); \ |
| 597 | return ret; \ | ||
| 598 | } \ | 594 | } \ |
| 599 | \ | 595 | \ |
| 600 | static void ftrace_raw_unreg_event_##call(void *ptr) \ | 596 | static notrace void \ |
| 597 | ftrace_raw_unreg_event_##call(struct ftrace_event_call *unused) \ | ||
| 601 | { \ | 598 | { \ |
| 602 | unregister_trace_##call(ftrace_raw_event_##call); \ | 599 | unregister_trace_##call(ftrace_raw_event_##call); \ |
| 603 | } \ | 600 | } \ |
| 604 | \ | 601 | \ |
| 605 | static struct trace_event ftrace_event_type_##call = { \ | 602 | static struct trace_event ftrace_event_type_##call = { \ |
| 606 | .trace = ftrace_raw_output_##call, \ | 603 | .trace = ftrace_raw_output_##call, \ |
| 607 | }; \ | 604 | }; |
| 605 | |||
| 606 | #undef DEFINE_EVENT_PRINT | ||
| 607 | #define DEFINE_EVENT_PRINT(template, name, proto, args, print) \ | ||
| 608 | DEFINE_EVENT(template, name, PARAMS(proto), PARAMS(args)) | ||
| 609 | |||
| 610 | #include TRACE_INCLUDE(TRACE_INCLUDE_FILE) | ||
| 611 | |||
| 612 | #undef __entry | ||
| 613 | #define __entry REC | ||
| 614 | |||
| 615 | #undef __print_flags | ||
| 616 | #undef __print_symbolic | ||
| 617 | #undef __get_dynamic_array | ||
| 618 | #undef __get_str | ||
| 619 | |||
| 620 | #undef TP_printk | ||
| 621 | #define TP_printk(fmt, args...) "\"" fmt "\", " __stringify(args) | ||
| 622 | |||
| 623 | #undef DECLARE_EVENT_CLASS | ||
| 624 | #define DECLARE_EVENT_CLASS(call, proto, args, tstruct, assign, print) \ | ||
| 625 | static const char print_fmt_##call[] = print; | ||
| 626 | |||
| 627 | #undef DEFINE_EVENT | ||
| 628 | #define DEFINE_EVENT(template, call, proto, args) \ | ||
| 608 | \ | 629 | \ |
| 609 | static int ftrace_raw_init_event_##call(void) \ | 630 | static struct ftrace_event_call __used \ |
| 610 | { \ | 631 | __attribute__((__aligned__(4))) \ |
| 611 | int id; \ | 632 | __attribute__((section("_ftrace_events"))) event_##call = { \ |
| 612 | \ | 633 | .name = #call, \ |
| 613 | id = register_ftrace_event(&ftrace_event_type_##call); \ | 634 | .system = __stringify(TRACE_SYSTEM), \ |
| 614 | if (!id) \ | 635 | .event = &ftrace_event_type_##call, \ |
| 615 | return -ENODEV; \ | 636 | .raw_init = trace_event_raw_init, \ |
| 616 | event_##call.id = id; \ | 637 | .regfunc = ftrace_raw_reg_event_##call, \ |
| 617 | INIT_LIST_HEAD(&event_##call.fields); \ | 638 | .unregfunc = ftrace_raw_unreg_event_##call, \ |
| 618 | return 0; \ | 639 | .print_fmt = print_fmt_##template, \ |
| 619 | } \ | 640 | .define_fields = ftrace_define_fields_##template, \ |
| 641 | _TRACE_PERF_INIT(call) \ | ||
| 642 | } | ||
| 643 | |||
| 644 | #undef DEFINE_EVENT_PRINT | ||
| 645 | #define DEFINE_EVENT_PRINT(template, call, proto, args, print) \ | ||
| 646 | \ | ||
| 647 | static const char print_fmt_##call[] = print; \ | ||
| 620 | \ | 648 | \ |
| 621 | static struct ftrace_event_call __used \ | 649 | static struct ftrace_event_call __used \ |
| 622 | __attribute__((__aligned__(4))) \ | 650 | __attribute__((__aligned__(4))) \ |
| @@ -624,28 +652,29 @@ __attribute__((section("_ftrace_events"))) event_##call = { \ | |||
| 624 | .name = #call, \ | 652 | .name = #call, \ |
| 625 | .system = __stringify(TRACE_SYSTEM), \ | 653 | .system = __stringify(TRACE_SYSTEM), \ |
| 626 | .event = &ftrace_event_type_##call, \ | 654 | .event = &ftrace_event_type_##call, \ |
| 627 | .raw_init = ftrace_raw_init_event_##call, \ | 655 | .raw_init = trace_event_raw_init, \ |
| 628 | .regfunc = ftrace_raw_reg_event_##call, \ | 656 | .regfunc = ftrace_raw_reg_event_##call, \ |
| 629 | .unregfunc = ftrace_raw_unreg_event_##call, \ | 657 | .unregfunc = ftrace_raw_unreg_event_##call, \ |
| 630 | .show_format = ftrace_format_##call, \ | 658 | .print_fmt = print_fmt_##call, \ |
| 631 | .define_fields = ftrace_define_fields_##call, \ | 659 | .define_fields = ftrace_define_fields_##template, \ |
| 632 | _TRACE_PROFILE_INIT(call) \ | 660 | _TRACE_PERF_INIT(call) \ |
| 633 | } | 661 | } |
| 634 | 662 | ||
| 635 | #include TRACE_INCLUDE(TRACE_INCLUDE_FILE) | 663 | #include TRACE_INCLUDE(TRACE_INCLUDE_FILE) |
| 636 | 664 | ||
| 637 | /* | 665 | /* |
| 638 | * Define the insertion callback to profile events | 666 | * Define the insertion callback to perf events |
| 639 | * | 667 | * |
| 640 | * The job is very similar to ftrace_raw_event_<call> except that we don't | 668 | * The job is very similar to ftrace_raw_event_<call> except that we don't |
| 641 | * insert in the ring buffer but in a perf counter. | 669 | * insert in the ring buffer but in a perf counter. |
| 642 | * | 670 | * |
| 643 | * static void ftrace_profile_<call>(proto) | 671 | * static void ftrace_perf_<call>(proto) |
| 644 | * { | 672 | * { |
| 645 | * struct ftrace_data_offsets_<call> __maybe_unused __data_offsets; | 673 | * struct ftrace_data_offsets_<call> __maybe_unused __data_offsets; |
| 646 | * struct ftrace_event_call *event_call = &event_<call>; | 674 | * struct ftrace_event_call *event_call = &event_<call>; |
| 647 | * extern void perf_tp_event(int, u64, u64, void *, int); | 675 | * extern void perf_tp_event(int, u64, u64, void *, int); |
| 648 | * struct ftrace_raw_##call *entry; | 676 | * struct ftrace_raw_##call *entry; |
| 677 | * struct perf_trace_buf *trace_buf; | ||
| 649 | * u64 __addr = 0, __count = 1; | 678 | * u64 __addr = 0, __count = 1; |
| 650 | * unsigned long irq_flags; | 679 | * unsigned long irq_flags; |
| 651 | * struct trace_entry *ent; | 680 | * struct trace_entry *ent; |
| @@ -670,14 +699,25 @@ __attribute__((section("_ftrace_events"))) event_##call = { \ | |||
| 670 | * __cpu = smp_processor_id(); | 699 | * __cpu = smp_processor_id(); |
| 671 | * | 700 | * |
| 672 | * if (in_nmi()) | 701 | * if (in_nmi()) |
| 673 | * raw_data = rcu_dereference(trace_profile_buf_nmi); | 702 | * trace_buf = rcu_dereference_sched(perf_trace_buf_nmi); |
| 674 | * else | 703 | * else |
| 675 | * raw_data = rcu_dereference(trace_profile_buf); | 704 | * trace_buf = rcu_dereference_sched(perf_trace_buf); |
| 676 | * | 705 | * |
| 677 | * if (!raw_data) | 706 | * if (!trace_buf) |
| 678 | * goto end; | 707 | * goto end; |
| 679 | * | 708 | * |
| 680 | * raw_data = per_cpu_ptr(raw_data, __cpu); | 709 | * trace_buf = per_cpu_ptr(trace_buf, __cpu); |
| 710 | * | ||
| 711 | * // Avoid recursion from perf that could mess up the buffer | ||
| 712 | * if (trace_buf->recursion++) | ||
| 713 | * goto end_recursion; | ||
| 714 | * | ||
| 715 | * raw_data = trace_buf->buf; | ||
| 716 | * | ||
| 717 | * // Make recursion update visible before entering perf_tp_event | ||
| 718 | * // so that we protect from perf recursions. | ||
| 719 | * | ||
| 720 | * barrier(); | ||
| 681 | * | 721 | * |
| 682 | * //zero dead bytes from alignment to avoid stack leak to userspace: | 722 | * //zero dead bytes from alignment to avoid stack leak to userspace: |
| 683 | * *(u64 *)(&raw_data[__entry_size - sizeof(u64)]) = 0ULL; | 723 | * *(u64 *)(&raw_data[__entry_size - sizeof(u64)]) = 0ULL; |
| @@ -696,7 +736,17 @@ __attribute__((section("_ftrace_events"))) event_##call = { \ | |||
| 696 | * } | 736 | * } |
| 697 | */ | 737 | */ |
| 698 | 738 | ||
| 699 | #ifdef CONFIG_EVENT_PROFILE | 739 | #ifdef CONFIG_PERF_EVENTS |
| 740 | |||
| 741 | #undef __entry | ||
| 742 | #define __entry entry | ||
| 743 | |||
| 744 | #undef __get_dynamic_array | ||
| 745 | #define __get_dynamic_array(field) \ | ||
| 746 | ((void *)__entry + (__entry->__data_loc_##field & 0xffff)) | ||
| 747 | |||
| 748 | #undef __get_str | ||
| 749 | #define __get_str(field) (char *)__get_dynamic_array(field) | ||
| 700 | 750 | ||
| 701 | #undef __perf_addr | 751 | #undef __perf_addr |
| 702 | #define __perf_addr(a) __addr = (a) | 752 | #define __perf_addr(a) __addr = (a) |
| @@ -704,67 +754,59 @@ __attribute__((section("_ftrace_events"))) event_##call = { \ | |||
| 704 | #undef __perf_count | 754 | #undef __perf_count |
| 705 | #define __perf_count(c) __count = (c) | 755 | #define __perf_count(c) __count = (c) |
| 706 | 756 | ||
| 707 | #undef TRACE_EVENT | 757 | #undef DECLARE_EVENT_CLASS |
| 708 | #define TRACE_EVENT(call, proto, args, tstruct, assign, print) \ | 758 | #define DECLARE_EVENT_CLASS(call, proto, args, tstruct, assign, print) \ |
| 709 | static void ftrace_profile_##call(proto) \ | 759 | static notrace void \ |
| 760 | perf_trace_templ_##call(struct ftrace_event_call *event_call, \ | ||
| 761 | proto) \ | ||
| 710 | { \ | 762 | { \ |
| 711 | struct ftrace_data_offsets_##call __maybe_unused __data_offsets;\ | 763 | struct ftrace_data_offsets_##call __maybe_unused __data_offsets;\ |
| 712 | struct ftrace_event_call *event_call = &event_##call; \ | ||
| 713 | extern void perf_tp_event(int, u64, u64, void *, int); \ | ||
| 714 | struct ftrace_raw_##call *entry; \ | 764 | struct ftrace_raw_##call *entry; \ |
| 715 | u64 __addr = 0, __count = 1; \ | 765 | u64 __addr = 0, __count = 1; \ |
| 716 | unsigned long irq_flags; \ | 766 | unsigned long irq_flags; \ |
| 717 | struct trace_entry *ent; \ | 767 | struct pt_regs *__regs; \ |
| 718 | int __entry_size; \ | 768 | int __entry_size; \ |
| 719 | int __data_size; \ | 769 | int __data_size; \ |
| 720 | char *raw_data; \ | 770 | int rctx; \ |
| 721 | int __cpu; \ | ||
| 722 | int pc; \ | ||
| 723 | \ | ||
| 724 | pc = preempt_count(); \ | ||
| 725 | \ | 771 | \ |
| 726 | __data_size = ftrace_get_offsets_##call(&__data_offsets, args); \ | 772 | __data_size = ftrace_get_offsets_##call(&__data_offsets, args); \ |
| 727 | __entry_size = ALIGN(__data_size + sizeof(*entry) + sizeof(u32),\ | 773 | __entry_size = ALIGN(__data_size + sizeof(*entry) + sizeof(u32),\ |
| 728 | sizeof(u64)); \ | 774 | sizeof(u64)); \ |
| 729 | __entry_size -= sizeof(u32); \ | 775 | __entry_size -= sizeof(u32); \ |
| 730 | \ | 776 | \ |
| 731 | if (WARN_ONCE(__entry_size > FTRACE_MAX_PROFILE_SIZE, \ | 777 | if (WARN_ONCE(__entry_size > PERF_MAX_TRACE_SIZE, \ |
| 732 | "profile buffer not large enough")) \ | 778 | "profile buffer not large enough")) \ |
| 733 | return; \ | 779 | return; \ |
| 734 | \ | 780 | entry = (struct ftrace_raw_##call *)perf_trace_buf_prepare( \ |
| 735 | local_irq_save(irq_flags); \ | 781 | __entry_size, event_call->id, &rctx, &irq_flags); \ |
| 736 | __cpu = smp_processor_id(); \ | 782 | if (!entry) \ |
| 737 | \ | 783 | return; \ |
| 738 | if (in_nmi()) \ | ||
| 739 | raw_data = rcu_dereference(trace_profile_buf_nmi); \ | ||
| 740 | else \ | ||
| 741 | raw_data = rcu_dereference(trace_profile_buf); \ | ||
| 742 | \ | ||
| 743 | if (!raw_data) \ | ||
| 744 | goto end; \ | ||
| 745 | \ | ||
| 746 | raw_data = per_cpu_ptr(raw_data, __cpu); \ | ||
| 747 | \ | ||
| 748 | *(u64 *)(&raw_data[__entry_size - sizeof(u64)]) = 0ULL; \ | ||
| 749 | entry = (struct ftrace_raw_##call *)raw_data; \ | ||
| 750 | ent = &entry->ent; \ | ||
| 751 | tracing_generic_entry_update(ent, irq_flags, pc); \ | ||
| 752 | ent->type = event_call->id; \ | ||
| 753 | \ | ||
| 754 | tstruct \ | 784 | tstruct \ |
| 755 | \ | 785 | \ |
| 756 | { assign; } \ | 786 | { assign; } \ |
| 757 | \ | 787 | \ |
| 758 | perf_tp_event(event_call->id, __addr, __count, entry, \ | 788 | __regs = &__get_cpu_var(perf_trace_regs); \ |
| 759 | __entry_size); \ | 789 | perf_fetch_caller_regs(__regs, 2); \ |
| 760 | \ | ||
| 761 | end: \ | ||
| 762 | local_irq_restore(irq_flags); \ | ||
| 763 | \ | 790 | \ |
| 791 | perf_trace_buf_submit(entry, __entry_size, rctx, __addr, \ | ||
| 792 | __count, irq_flags, __regs); \ | ||
| 764 | } | 793 | } |
| 765 | 794 | ||
| 795 | #undef DEFINE_EVENT | ||
| 796 | #define DEFINE_EVENT(template, call, proto, args) \ | ||
| 797 | static notrace void perf_trace_##call(proto) \ | ||
| 798 | { \ | ||
| 799 | struct ftrace_event_call *event_call = &event_##call; \ | ||
| 800 | \ | ||
| 801 | perf_trace_templ_##template(event_call, args); \ | ||
| 802 | } | ||
| 803 | |||
| 804 | #undef DEFINE_EVENT_PRINT | ||
| 805 | #define DEFINE_EVENT_PRINT(template, name, proto, args, print) \ | ||
| 806 | DEFINE_EVENT(template, name, PARAMS(proto), PARAMS(args)) | ||
| 807 | |||
| 766 | #include TRACE_INCLUDE(TRACE_INCLUDE_FILE) | 808 | #include TRACE_INCLUDE(TRACE_INCLUDE_FILE) |
| 767 | #endif /* CONFIG_EVENT_PROFILE */ | 809 | #endif /* CONFIG_PERF_EVENTS */ |
| 768 | 810 | ||
| 769 | #undef _TRACE_PROFILE_INIT | 811 | #undef _TRACE_PROFILE_INIT |
| 770 | 812 | ||
diff --git a/include/trace/power.h b/include/trace/power.h deleted file mode 100644 index ef204666e983..000000000000 --- a/include/trace/power.h +++ /dev/null | |||
| @@ -1,32 +0,0 @@ | |||
| 1 | #ifndef _TRACE_POWER_H | ||
| 2 | #define _TRACE_POWER_H | ||
| 3 | |||
| 4 | #include <linux/ktime.h> | ||
| 5 | #include <linux/tracepoint.h> | ||
| 6 | |||
| 7 | enum { | ||
| 8 | POWER_NONE = 0, | ||
| 9 | POWER_CSTATE = 1, | ||
| 10 | POWER_PSTATE = 2, | ||
| 11 | }; | ||
| 12 | |||
| 13 | struct power_trace { | ||
| 14 | ktime_t stamp; | ||
| 15 | ktime_t end; | ||
| 16 | int type; | ||
| 17 | int state; | ||
| 18 | }; | ||
| 19 | |||
| 20 | DECLARE_TRACE(power_start, | ||
| 21 | TP_PROTO(struct power_trace *it, unsigned int type, unsigned int state), | ||
| 22 | TP_ARGS(it, type, state)); | ||
| 23 | |||
| 24 | DECLARE_TRACE(power_mark, | ||
| 25 | TP_PROTO(struct power_trace *it, unsigned int type, unsigned int state), | ||
| 26 | TP_ARGS(it, type, state)); | ||
| 27 | |||
| 28 | DECLARE_TRACE(power_end, | ||
| 29 | TP_PROTO(struct power_trace *it), | ||
| 30 | TP_ARGS(it)); | ||
| 31 | |||
| 32 | #endif /* _TRACE_POWER_H */ | ||
diff --git a/include/trace/syscall.h b/include/trace/syscall.h index 5dc283ba5ae0..e5e5f48dbfb3 100644 --- a/include/trace/syscall.h +++ b/include/trace/syscall.h | |||
| @@ -12,52 +12,45 @@ | |||
| 12 | * A syscall entry in the ftrace syscalls array. | 12 | * A syscall entry in the ftrace syscalls array. |
| 13 | * | 13 | * |
| 14 | * @name: name of the syscall | 14 | * @name: name of the syscall |
| 15 | * @syscall_nr: number of the syscall | ||
| 15 | * @nb_args: number of parameters it takes | 16 | * @nb_args: number of parameters it takes |
| 16 | * @types: list of types as strings | 17 | * @types: list of types as strings |
| 17 | * @args: list of args as strings (args[i] matches types[i]) | 18 | * @args: list of args as strings (args[i] matches types[i]) |
| 18 | * @enter_id: associated ftrace enter event id | ||
| 19 | * @exit_id: associated ftrace exit event id | ||
| 20 | * @enter_event: associated syscall_enter trace event | 19 | * @enter_event: associated syscall_enter trace event |
| 21 | * @exit_event: associated syscall_exit trace event | 20 | * @exit_event: associated syscall_exit trace event |
| 22 | */ | 21 | */ |
| 23 | struct syscall_metadata { | 22 | struct syscall_metadata { |
| 24 | const char *name; | 23 | const char *name; |
| 24 | int syscall_nr; | ||
| 25 | int nb_args; | 25 | int nb_args; |
| 26 | const char **types; | 26 | const char **types; |
| 27 | const char **args; | 27 | const char **args; |
| 28 | int enter_id; | ||
| 29 | int exit_id; | ||
| 30 | 28 | ||
| 31 | struct ftrace_event_call *enter_event; | 29 | struct ftrace_event_call *enter_event; |
| 32 | struct ftrace_event_call *exit_event; | 30 | struct ftrace_event_call *exit_event; |
| 33 | }; | 31 | }; |
| 34 | 32 | ||
| 35 | #ifdef CONFIG_FTRACE_SYSCALLS | 33 | #ifdef CONFIG_FTRACE_SYSCALLS |
| 36 | extern struct syscall_metadata *syscall_nr_to_meta(int nr); | 34 | extern unsigned long arch_syscall_addr(int nr); |
| 37 | extern int syscall_name_to_nr(char *name); | 35 | extern int init_syscall_trace(struct ftrace_event_call *call); |
| 38 | void set_syscall_enter_id(int num, int id); | 36 | |
| 39 | void set_syscall_exit_id(int num, int id); | ||
| 40 | extern struct trace_event event_syscall_enter; | ||
| 41 | extern struct trace_event event_syscall_exit; | ||
| 42 | extern int reg_event_syscall_enter(void *ptr); | ||
| 43 | extern void unreg_event_syscall_enter(void *ptr); | ||
| 44 | extern int reg_event_syscall_exit(void *ptr); | ||
| 45 | extern void unreg_event_syscall_exit(void *ptr); | ||
| 46 | extern int syscall_enter_format(struct ftrace_event_call *call, | ||
| 47 | struct trace_seq *s); | ||
| 48 | extern int syscall_exit_format(struct ftrace_event_call *call, | ||
| 49 | struct trace_seq *s); | ||
| 50 | extern int syscall_enter_define_fields(struct ftrace_event_call *call); | 37 | extern int syscall_enter_define_fields(struct ftrace_event_call *call); |
| 51 | extern int syscall_exit_define_fields(struct ftrace_event_call *call); | 38 | extern int syscall_exit_define_fields(struct ftrace_event_call *call); |
| 39 | extern int reg_event_syscall_enter(struct ftrace_event_call *call); | ||
| 40 | extern void unreg_event_syscall_enter(struct ftrace_event_call *call); | ||
| 41 | extern int reg_event_syscall_exit(struct ftrace_event_call *call); | ||
| 42 | extern void unreg_event_syscall_exit(struct ftrace_event_call *call); | ||
| 43 | extern int | ||
| 44 | ftrace_format_syscall(struct ftrace_event_call *call, struct trace_seq *s); | ||
| 52 | enum print_line_t print_syscall_enter(struct trace_iterator *iter, int flags); | 45 | enum print_line_t print_syscall_enter(struct trace_iterator *iter, int flags); |
| 53 | enum print_line_t print_syscall_exit(struct trace_iterator *iter, int flags); | 46 | enum print_line_t print_syscall_exit(struct trace_iterator *iter, int flags); |
| 54 | #endif | 47 | #endif |
| 55 | #ifdef CONFIG_EVENT_PROFILE | ||
| 56 | int reg_prof_syscall_enter(char *name); | ||
| 57 | void unreg_prof_syscall_enter(char *name); | ||
| 58 | int reg_prof_syscall_exit(char *name); | ||
| 59 | void unreg_prof_syscall_exit(char *name); | ||
| 60 | 48 | ||
| 49 | #ifdef CONFIG_PERF_EVENTS | ||
| 50 | int perf_sysenter_enable(struct ftrace_event_call *call); | ||
| 51 | void perf_sysenter_disable(struct ftrace_event_call *call); | ||
| 52 | int perf_sysexit_enable(struct ftrace_event_call *call); | ||
| 53 | void perf_sysexit_disable(struct ftrace_event_call *call); | ||
| 61 | #endif | 54 | #endif |
| 62 | 55 | ||
| 63 | #endif /* _TRACE_SYSCALL_H */ | 56 | #endif /* _TRACE_SYSCALL_H */ |
diff --git a/include/video/broadsheetfb.h b/include/video/broadsheetfb.h index a758534c0272..548d28f4ec67 100644 --- a/include/video/broadsheetfb.h +++ b/include/video/broadsheetfb.h | |||
| @@ -29,11 +29,19 @@ | |||
| 29 | #define BS_CMD_UPD_FULL 0x33 | 29 | #define BS_CMD_UPD_FULL 0x33 |
| 30 | #define BS_CMD_UPD_GDRV_CLR 0x37 | 30 | #define BS_CMD_UPD_GDRV_CLR 0x37 |
| 31 | 31 | ||
| 32 | /* Broadsheet register interface defines */ | ||
| 33 | #define BS_REG_REV 0x00 | ||
| 34 | #define BS_REG_PRC 0x02 | ||
| 35 | |||
| 32 | /* Broadsheet pin interface specific defines */ | 36 | /* Broadsheet pin interface specific defines */ |
| 33 | #define BS_CS 0x01 | 37 | #define BS_CS 0x01 |
| 34 | #define BS_DC 0x02 | 38 | #define BS_DC 0x02 |
| 35 | #define BS_WR 0x03 | 39 | #define BS_WR 0x03 |
| 36 | 40 | ||
| 41 | /* Broadsheet IO interface specific defines */ | ||
| 42 | #define BS_MMIO_CMD 0x01 | ||
| 43 | #define BS_MMIO_DATA 0x02 | ||
| 44 | |||
| 37 | /* struct used by broadsheet. board specific stuff comes from *board */ | 45 | /* struct used by broadsheet. board specific stuff comes from *board */ |
| 38 | struct broadsheetfb_par { | 46 | struct broadsheetfb_par { |
| 39 | struct fb_info *info; | 47 | struct fb_info *info; |
| @@ -41,6 +49,8 @@ struct broadsheetfb_par { | |||
| 41 | void (*write_reg)(struct broadsheetfb_par *, u16 reg, u16 val); | 49 | void (*write_reg)(struct broadsheetfb_par *, u16 reg, u16 val); |
| 42 | u16 (*read_reg)(struct broadsheetfb_par *, u16 reg); | 50 | u16 (*read_reg)(struct broadsheetfb_par *, u16 reg); |
| 43 | wait_queue_head_t waitq; | 51 | wait_queue_head_t waitq; |
| 52 | int panel_index; | ||
| 53 | struct mutex io_lock; | ||
| 44 | }; | 54 | }; |
| 45 | 55 | ||
| 46 | /* board specific routines */ | 56 | /* board specific routines */ |
| @@ -48,12 +58,17 @@ struct broadsheet_board { | |||
| 48 | struct module *owner; | 58 | struct module *owner; |
| 49 | int (*init)(struct broadsheetfb_par *); | 59 | int (*init)(struct broadsheetfb_par *); |
| 50 | int (*wait_for_rdy)(struct broadsheetfb_par *); | 60 | int (*wait_for_rdy)(struct broadsheetfb_par *); |
| 51 | void (*set_ctl)(struct broadsheetfb_par *, unsigned char, u8); | ||
| 52 | void (*set_hdb)(struct broadsheetfb_par *, u16); | ||
| 53 | u16 (*get_hdb)(struct broadsheetfb_par *); | ||
| 54 | void (*cleanup)(struct broadsheetfb_par *); | 61 | void (*cleanup)(struct broadsheetfb_par *); |
| 55 | int (*get_panel_type)(void); | 62 | int (*get_panel_type)(void); |
| 56 | int (*setup_irq)(struct fb_info *); | 63 | int (*setup_irq)(struct fb_info *); |
| 57 | }; | ||
| 58 | 64 | ||
| 65 | /* Functions for boards that use GPIO */ | ||
| 66 | void (*set_ctl)(struct broadsheetfb_par *, unsigned char, u8); | ||
| 67 | void (*set_hdb)(struct broadsheetfb_par *, u16); | ||
| 68 | u16 (*get_hdb)(struct broadsheetfb_par *); | ||
| 69 | |||
| 70 | /* Functions for boards that have specialized MMIO */ | ||
| 71 | void (*mmio_write)(struct broadsheetfb_par *, int type, u16); | ||
| 72 | u16 (*mmio_read)(struct broadsheetfb_par *); | ||
| 73 | }; | ||
| 59 | #endif | 74 | #endif |
diff --git a/include/video/da8xx-fb.h b/include/video/da8xx-fb.h index c051a50ed528..89d43b3d4cb9 100644 --- a/include/video/da8xx-fb.h +++ b/include/video/da8xx-fb.h | |||
| @@ -38,6 +38,7 @@ struct da8xx_lcdc_platform_data { | |||
| 38 | const char manu_name[10]; | 38 | const char manu_name[10]; |
| 39 | void *controller_data; | 39 | void *controller_data; |
| 40 | const char type[25]; | 40 | const char type[25]; |
| 41 | void (*panel_power_ctrl)(int); | ||
| 41 | }; | 42 | }; |
| 42 | 43 | ||
| 43 | struct lcd_ctrl_config { | 44 | struct lcd_ctrl_config { |
diff --git a/include/video/pxa168fb.h b/include/video/pxa168fb.h index b5cc72fe0461..8c2f385a90ea 100644 --- a/include/video/pxa168fb.h +++ b/include/video/pxa168fb.h | |||
| @@ -117,8 +117,6 @@ struct pxa168fb_mach_info { | |||
| 117 | unsigned invert_composite_blank:1; | 117 | unsigned invert_composite_blank:1; |
| 118 | unsigned invert_pix_val_ena:1; | 118 | unsigned invert_pix_val_ena:1; |
| 119 | unsigned invert_pixclock:1; | 119 | unsigned invert_pixclock:1; |
| 120 | unsigned invert_vsync:1; | ||
| 121 | unsigned invert_hsync:1; | ||
| 122 | unsigned panel_rbswap:1; | 120 | unsigned panel_rbswap:1; |
| 123 | unsigned active:1; | 121 | unsigned active:1; |
| 124 | unsigned enable_lcd:1; | 122 | unsigned enable_lcd:1; |
diff --git a/include/video/sgivw.h b/include/video/sgivw.h index 55f2a7c024af..f6aa5692e74b 100644 --- a/include/video/sgivw.h +++ b/include/video/sgivw.h | |||
| @@ -351,7 +351,7 @@ typedef enum { | |||
| 351 | struct dbe_timing_info | 351 | struct dbe_timing_info |
| 352 | { | 352 | { |
| 353 | dbe_timing_t type; | 353 | dbe_timing_t type; |
| 354 | int flags; | 354 | int flags; |
| 355 | short width; /* Monitor resolution */ | 355 | short width; /* Monitor resolution */ |
| 356 | short height; | 356 | short height; |
| 357 | int fields_sec; /* fields/sec (Hz -3 dec. places */ | 357 | int fields_sec; /* fields/sec (Hz -3 dec. places */ |
| @@ -389,11 +389,11 @@ struct dbe_timing_info dbeVTimings[] = { | |||
| 389 | { | 389 | { |
| 390 | DBE_VT_640_480_60, | 390 | DBE_VT_640_480_60, |
| 391 | /* flags, width, height, fields_sec, cfreq */ | 391 | /* flags, width, height, fields_sec, cfreq */ |
| 392 | 0, 640, 480, 59940, 25175, | 392 | 0, 640, 480, 59940, 25175, |
| 393 | /* htotal, hblank_start, hblank_end, hsync_start, hsync_end */ | 393 | /* htotal, hblank_start, hblank_end, hsync_start, hsync_end */ |
| 394 | 800, 640, 800, 656, 752, | 394 | 800, 640, 800, 656, 752, |
| 395 | /* vtotal, vblank_start, vblank_end, vsync_start, vsync_end */ | 395 | /* vtotal, vblank_start, vblank_end, vsync_start, vsync_end */ |
| 396 | 525, 480, 525, 490, 492, | 396 | 525, 480, 525, 490, 492, |
| 397 | /* pll_m, pll_n, pll_p */ | 397 | /* pll_m, pll_n, pll_p */ |
| 398 | 15, 2, 3 | 398 | 15, 2, 3 |
| 399 | }, | 399 | }, |
| @@ -650,7 +650,7 @@ struct dbe_timing_info dbeVTimings[] = { | |||
| 650 | /* pll_m, pll_n, pll_p */ | 650 | /* pll_m, pll_n, pll_p */ |
| 651 | 6, 1, 0 | 651 | 6, 1, 0 |
| 652 | }, | 652 | }, |
| 653 | 653 | ||
| 654 | { | 654 | { |
| 655 | DBE_VT_1920_1200_60, | 655 | DBE_VT_1920_1200_60, |
| 656 | /* flags, width, height, fields_sec, cfreq */ | 656 | /* flags, width, height, fields_sec, cfreq */ |
| @@ -676,7 +676,6 @@ struct dbe_timing_info dbeVTimings[] = { | |||
| 676 | } | 676 | } |
| 677 | }; | 677 | }; |
| 678 | 678 | ||
| 679 | #define DBE_VT_SIZE (sizeof(dbeVTimings)/sizeof(dbeVTimings[0])) | ||
| 680 | #endif // INCLUDE_TIMING_TABLE_DATA | 679 | #endif // INCLUDE_TIMING_TABLE_DATA |
| 681 | 680 | ||
| 682 | #endif // ! __SGIVWFB_H__ | 681 | #endif // ! __SGIVWFB_H__ |
diff --git a/include/video/sh_mobile_lcdc.h b/include/video/sh_mobile_lcdc.h index 25144ab22b95..2cc893fc1f85 100644 --- a/include/video/sh_mobile_lcdc.h +++ b/include/video/sh_mobile_lcdc.h | |||
| @@ -34,6 +34,8 @@ enum { LCDC_CLK_BUS, LCDC_CLK_PERIPHERAL, LCDC_CLK_EXTERNAL }; | |||
| 34 | #define LCDC_FLAGS_HSCNT (1 << 3) /* Disable HSYNC during VBLANK */ | 34 | #define LCDC_FLAGS_HSCNT (1 << 3) /* Disable HSYNC during VBLANK */ |
| 35 | #define LCDC_FLAGS_DWCNT (1 << 4) /* Disable dotclock during blanking */ | 35 | #define LCDC_FLAGS_DWCNT (1 << 4) /* Disable dotclock during blanking */ |
| 36 | 36 | ||
| 37 | #define FBIO_WAITFORVSYNC _IOW('F', 0x20, __u32) | ||
| 38 | |||
| 37 | struct sh_mobile_lcdc_sys_bus_cfg { | 39 | struct sh_mobile_lcdc_sys_bus_cfg { |
| 38 | unsigned long ldmt2r; | 40 | unsigned long ldmt2r; |
| 39 | unsigned long ldmt3r; | 41 | unsigned long ldmt3r; |
| @@ -50,6 +52,8 @@ struct sh_mobile_lcdc_board_cfg { | |||
| 50 | void *board_data; | 52 | void *board_data; |
| 51 | int (*setup_sys)(void *board_data, void *sys_ops_handle, | 53 | int (*setup_sys)(void *board_data, void *sys_ops_handle, |
| 52 | struct sh_mobile_lcdc_sys_bus_ops *sys_ops); | 54 | struct sh_mobile_lcdc_sys_bus_ops *sys_ops); |
| 55 | void (*start_transfer)(void *board_data, void *sys_ops_handle, | ||
| 56 | struct sh_mobile_lcdc_sys_bus_ops *sys_ops); | ||
| 53 | void (*display_on)(void *board_data); | 57 | void (*display_on)(void *board_data); |
| 54 | void (*display_off)(void *board_data); | 58 | void (*display_off)(void *board_data); |
| 55 | }; | 59 | }; |
diff --git a/include/xen/xen.h b/include/xen/xen.h new file mode 100644 index 000000000000..a16402418d31 --- /dev/null +++ b/include/xen/xen.h | |||
| @@ -0,0 +1,32 @@ | |||
| 1 | #ifndef _XEN_XEN_H | ||
| 2 | #define _XEN_XEN_H | ||
| 3 | |||
| 4 | enum xen_domain_type { | ||
| 5 | XEN_NATIVE, /* running on bare hardware */ | ||
| 6 | XEN_PV_DOMAIN, /* running in a PV domain */ | ||
| 7 | XEN_HVM_DOMAIN, /* running in a Xen hvm domain */ | ||
| 8 | }; | ||
| 9 | |||
| 10 | #ifdef CONFIG_XEN | ||
| 11 | extern enum xen_domain_type xen_domain_type; | ||
| 12 | #else | ||
| 13 | #define xen_domain_type XEN_NATIVE | ||
| 14 | #endif | ||
| 15 | |||
| 16 | #define xen_domain() (xen_domain_type != XEN_NATIVE) | ||
| 17 | #define xen_pv_domain() (xen_domain() && \ | ||
| 18 | xen_domain_type == XEN_PV_DOMAIN) | ||
| 19 | #define xen_hvm_domain() (xen_domain() && \ | ||
| 20 | xen_domain_type == XEN_HVM_DOMAIN) | ||
| 21 | |||
| 22 | #ifdef CONFIG_XEN_DOM0 | ||
| 23 | #include <xen/interface/xen.h> | ||
| 24 | #include <asm/xen/hypervisor.h> | ||
| 25 | |||
| 26 | #define xen_initial_domain() (xen_pv_domain() && \ | ||
| 27 | xen_start_info->flags & SIF_INITDOMAIN) | ||
| 28 | #else /* !CONFIG_XEN_DOM0 */ | ||
| 29 | #define xen_initial_domain() (0) | ||
| 30 | #endif /* CONFIG_XEN_DOM0 */ | ||
| 31 | |||
| 32 | #endif /* _XEN_XEN_H */ | ||
diff --git a/include/xen/xenbus.h b/include/xen/xenbus.h index b9763badbd77..43e2d7d33976 100644 --- a/include/xen/xenbus.h +++ b/include/xen/xenbus.h | |||
| @@ -39,6 +39,7 @@ | |||
| 39 | #include <linux/mutex.h> | 39 | #include <linux/mutex.h> |
| 40 | #include <linux/completion.h> | 40 | #include <linux/completion.h> |
| 41 | #include <linux/init.h> | 41 | #include <linux/init.h> |
| 42 | #include <linux/slab.h> | ||
| 42 | #include <xen/interface/xen.h> | 43 | #include <xen/interface/xen.h> |
| 43 | #include <xen/interface/grant_table.h> | 44 | #include <xen/interface/grant_table.h> |
| 44 | #include <xen/interface/io/xenbus.h> | 45 | #include <xen/interface/io/xenbus.h> |
