diff options
author | Ingo Molnar <mingo@elte.hu> | 2008-10-15 07:46:29 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-10-15 07:46:29 -0400 |
commit | b2aaf8f74cdc84a9182f6cabf198b7763bcb9d40 (patch) | |
tree | 53ccb1c2c14751fe69cf93102e76e97021f6df07 /include/linux | |
parent | 4f962d4d65923d7b722192e729840cfb79af0a5a (diff) | |
parent | 278429cff8809958d25415ba0ed32b59866ab1a8 (diff) |
Merge branch 'linus' into stackprotector
Conflicts:
arch/x86/kernel/Makefile
include/asm-x86/pda.h
Diffstat (limited to 'include/linux')
473 files changed, 21109 insertions, 4820 deletions
diff --git a/include/linux/Kbuild b/include/linux/Kbuild index b6fbb2573e88..282a504bd1db 100644 --- a/include/linux/Kbuild +++ b/include/linux/Kbuild | |||
@@ -97,6 +97,7 @@ header-y += ioctl.h | |||
97 | header-y += ip6_tunnel.h | 97 | header-y += ip6_tunnel.h |
98 | header-y += ipmi_msgdefs.h | 98 | header-y += ipmi_msgdefs.h |
99 | header-y += ipsec.h | 99 | header-y += ipsec.h |
100 | header-y += ip_vs.h | ||
100 | header-y += ipx.h | 101 | header-y += ipx.h |
101 | header-y += irda.h | 102 | header-y += irda.h |
102 | header-y += iso_fs.h | 103 | header-y += iso_fs.h |
@@ -125,6 +126,7 @@ header-y += pci_regs.h | |||
125 | header-y += pfkeyv2.h | 126 | header-y += pfkeyv2.h |
126 | header-y += pg.h | 127 | header-y += pg.h |
127 | header-y += phantom.h | 128 | header-y += phantom.h |
129 | header-y += phonet.h | ||
128 | header-y += pkt_cls.h | 130 | header-y += pkt_cls.h |
129 | header-y += pkt_sched.h | 131 | header-y += pkt_sched.h |
130 | header-y += posix_types.h | 132 | header-y += posix_types.h |
@@ -166,7 +168,8 @@ unifdef-y += acct.h | |||
166 | unifdef-y += adb.h | 168 | unifdef-y += adb.h |
167 | unifdef-y += adfs_fs.h | 169 | unifdef-y += adfs_fs.h |
168 | unifdef-y += agpgart.h | 170 | unifdef-y += agpgart.h |
169 | ifeq ($(wildcard include/asm-$(SRCARCH)/a.out.h),include/asm-$(SRCARCH)/a.out.h) | 171 | ifneq ($(wildcard $(srctree)/arch/$(SRCARCH)/include/asm/a.out.h \ |
172 | $(srctree)/include/asm-$(SRCARCH)/a.out.h),) | ||
170 | unifdef-y += a.out.h | 173 | unifdef-y += a.out.h |
171 | endif | 174 | endif |
172 | unifdef-y += apm_bios.h | 175 | unifdef-y += apm_bios.h |
@@ -178,6 +181,7 @@ unifdef-y += audit.h | |||
178 | unifdef-y += auto_fs.h | 181 | unifdef-y += auto_fs.h |
179 | unifdef-y += auxvec.h | 182 | unifdef-y += auxvec.h |
180 | unifdef-y += binfmts.h | 183 | unifdef-y += binfmts.h |
184 | unifdef-y += blktrace_api.h | ||
181 | unifdef-y += capability.h | 185 | unifdef-y += capability.h |
182 | unifdef-y += capi.h | 186 | unifdef-y += capi.h |
183 | unifdef-y += cciss_ioctl.h | 187 | unifdef-y += cciss_ioctl.h |
@@ -189,7 +193,6 @@ unifdef-y += connector.h | |||
189 | unifdef-y += cuda.h | 193 | unifdef-y += cuda.h |
190 | unifdef-y += cyclades.h | 194 | unifdef-y += cyclades.h |
191 | unifdef-y += dccp.h | 195 | unifdef-y += dccp.h |
192 | unifdef-y += dirent.h | ||
193 | unifdef-y += dlm.h | 196 | unifdef-y += dlm.h |
194 | unifdef-y += dlm_plock.h | 197 | unifdef-y += dlm_plock.h |
195 | unifdef-y += edd.h | 198 | unifdef-y += edd.h |
@@ -231,6 +234,7 @@ unifdef-y += if_fddi.h | |||
231 | unifdef-y += if_frad.h | 234 | unifdef-y += if_frad.h |
232 | unifdef-y += if_ltalk.h | 235 | unifdef-y += if_ltalk.h |
233 | unifdef-y += if_link.h | 236 | unifdef-y += if_link.h |
237 | unifdef-y += if_phonet.h | ||
234 | unifdef-y += if_pppol2tp.h | 238 | unifdef-y += if_pppol2tp.h |
235 | unifdef-y += if_pppox.h | 239 | unifdef-y += if_pppox.h |
236 | unifdef-y += if_tr.h | 240 | unifdef-y += if_tr.h |
@@ -250,13 +254,18 @@ unifdef-y += isdn.h | |||
250 | unifdef-y += isdnif.h | 254 | unifdef-y += isdnif.h |
251 | unifdef-y += isdn_divertif.h | 255 | unifdef-y += isdn_divertif.h |
252 | unifdef-y += isdn_ppp.h | 256 | unifdef-y += isdn_ppp.h |
257 | unifdef-y += ivtv.h | ||
258 | unifdef-y += ivtvfb.h | ||
253 | unifdef-y += joystick.h | 259 | unifdef-y += joystick.h |
254 | unifdef-y += kdev_t.h | 260 | unifdef-y += kdev_t.h |
255 | unifdef-y += kd.h | 261 | unifdef-y += kd.h |
256 | unifdef-y += kernelcapi.h | 262 | unifdef-y += kernelcapi.h |
257 | unifdef-y += kernel.h | 263 | unifdef-y += kernel.h |
258 | unifdef-y += keyboard.h | 264 | unifdef-y += keyboard.h |
265 | ifneq ($(wildcard $(srctree)/arch/$(SRCARCH)/include/asm/kvm.h \ | ||
266 | $(srctree)/include/asm-$(SRCARCH)/kvm.h),) | ||
259 | unifdef-y += kvm.h | 267 | unifdef-y += kvm.h |
268 | endif | ||
260 | unifdef-y += llc.h | 269 | unifdef-y += llc.h |
261 | unifdef-y += loop.h | 270 | unifdef-y += loop.h |
262 | unifdef-y += lp.h | 271 | unifdef-y += lp.h |
@@ -293,7 +302,6 @@ unifdef-y += parport.h | |||
293 | unifdef-y += patchkey.h | 302 | unifdef-y += patchkey.h |
294 | unifdef-y += pci.h | 303 | unifdef-y += pci.h |
295 | unifdef-y += personality.h | 304 | unifdef-y += personality.h |
296 | unifdef-y += pim.h | ||
297 | unifdef-y += pktcdvd.h | 305 | unifdef-y += pktcdvd.h |
298 | unifdef-y += pmu.h | 306 | unifdef-y += pmu.h |
299 | unifdef-y += poll.h | 307 | unifdef-y += poll.h |
@@ -354,6 +362,7 @@ unifdef-y += virtio_balloon.h | |||
354 | unifdef-y += virtio_console.h | 362 | unifdef-y += virtio_console.h |
355 | unifdef-y += virtio_pci.h | 363 | unifdef-y += virtio_pci.h |
356 | unifdef-y += virtio_ring.h | 364 | unifdef-y += virtio_ring.h |
365 | unifdef-y += virtio_rng.h | ||
357 | unifdef-y += vt.h | 366 | unifdef-y += vt.h |
358 | unifdef-y += wait.h | 367 | unifdef-y += wait.h |
359 | unifdef-y += wanrouter.h | 368 | unifdef-y += wanrouter.h |
diff --git a/include/linux/acct.h b/include/linux/acct.h index e8cae54e8d88..882dc7248766 100644 --- a/include/linux/acct.h +++ b/include/linux/acct.h | |||
@@ -120,17 +120,20 @@ struct acct_v3 | |||
120 | struct vfsmount; | 120 | struct vfsmount; |
121 | struct super_block; | 121 | struct super_block; |
122 | struct pacct_struct; | 122 | struct pacct_struct; |
123 | struct pid_namespace; | ||
123 | extern void acct_auto_close_mnt(struct vfsmount *m); | 124 | extern void acct_auto_close_mnt(struct vfsmount *m); |
124 | extern void acct_auto_close(struct super_block *sb); | 125 | extern void acct_auto_close(struct super_block *sb); |
125 | extern void acct_init_pacct(struct pacct_struct *pacct); | 126 | extern void acct_init_pacct(struct pacct_struct *pacct); |
126 | extern void acct_collect(long exitcode, int group_dead); | 127 | extern void acct_collect(long exitcode, int group_dead); |
127 | extern void acct_process(void); | 128 | extern void acct_process(void); |
129 | extern void acct_exit_ns(struct pid_namespace *); | ||
128 | #else | 130 | #else |
129 | #define acct_auto_close_mnt(x) do { } while (0) | 131 | #define acct_auto_close_mnt(x) do { } while (0) |
130 | #define acct_auto_close(x) do { } while (0) | 132 | #define acct_auto_close(x) do { } while (0) |
131 | #define acct_init_pacct(x) do { } while (0) | 133 | #define acct_init_pacct(x) do { } while (0) |
132 | #define acct_collect(x,y) do { } while (0) | 134 | #define acct_collect(x,y) do { } while (0) |
133 | #define acct_process() do { } while (0) | 135 | #define acct_process() do { } while (0) |
136 | #define acct_exit_ns(ns) do { } while (0) | ||
134 | #endif | 137 | #endif |
135 | 138 | ||
136 | /* | 139 | /* |
diff --git a/include/linux/acpi.h b/include/linux/acpi.h index 41f7ce7edd7a..702f79dad16a 100644 --- a/include/linux/acpi.h +++ b/include/linux/acpi.h | |||
@@ -82,6 +82,7 @@ char * __acpi_map_table (unsigned long phys_addr, unsigned long size); | |||
82 | int early_acpi_boot_init(void); | 82 | int early_acpi_boot_init(void); |
83 | int acpi_boot_init (void); | 83 | int acpi_boot_init (void); |
84 | int acpi_boot_table_init (void); | 84 | int acpi_boot_table_init (void); |
85 | int acpi_mps_check (void); | ||
85 | int acpi_numa_init (void); | 86 | int acpi_numa_init (void); |
86 | 87 | ||
87 | int acpi_table_init (void); | 88 | int acpi_table_init (void); |
@@ -234,6 +235,10 @@ int acpi_check_region(resource_size_t start, resource_size_t n, | |||
234 | int acpi_check_mem_region(resource_size_t start, resource_size_t n, | 235 | int acpi_check_mem_region(resource_size_t start, resource_size_t n, |
235 | const char *name); | 236 | const char *name); |
236 | 237 | ||
238 | #ifdef CONFIG_PM_SLEEP | ||
239 | void __init acpi_no_s4_hw_signature(void); | ||
240 | void __init acpi_old_suspend_ordering(void); | ||
241 | #endif /* CONFIG_PM_SLEEP */ | ||
237 | #else /* CONFIG_ACPI */ | 242 | #else /* CONFIG_ACPI */ |
238 | 243 | ||
239 | static inline int early_acpi_boot_init(void) | 244 | static inline int early_acpi_boot_init(void) |
@@ -250,6 +255,11 @@ static inline int acpi_boot_table_init(void) | |||
250 | return 0; | 255 | return 0; |
251 | } | 256 | } |
252 | 257 | ||
258 | static inline int acpi_mps_check(void) | ||
259 | { | ||
260 | return 0; | ||
261 | } | ||
262 | |||
253 | static inline int acpi_check_resource_conflict(struct resource *res) | 263 | static inline int acpi_check_resource_conflict(struct resource *res) |
254 | { | 264 | { |
255 | return 0; | 265 | return 0; |
diff --git a/include/linux/adb.h b/include/linux/adb.h index 64d8878e1444..63bca502fa55 100644 --- a/include/linux/adb.h +++ b/include/linux/adb.h | |||
@@ -84,7 +84,6 @@ enum adb_message { | |||
84 | ADB_MSG_PRE_RESET, /* Called before resetting the bus */ | 84 | ADB_MSG_PRE_RESET, /* Called before resetting the bus */ |
85 | ADB_MSG_POST_RESET /* Called after resetting the bus (re-do init & register) */ | 85 | ADB_MSG_POST_RESET /* Called after resetting the bus (re-do init & register) */ |
86 | }; | 86 | }; |
87 | extern struct adb_driver *adb_controller; | ||
88 | extern struct blocking_notifier_head adb_client_list; | 87 | extern struct blocking_notifier_head adb_client_list; |
89 | 88 | ||
90 | int adb_request(struct adb_request *req, void (*done)(struct adb_request *), | 89 | int adb_request(struct adb_request *req, void (*done)(struct adb_request *), |
diff --git a/include/linux/agp_backend.h b/include/linux/agp_backend.h index 972b12bcfb36..2b8df8b420fd 100644 --- a/include/linux/agp_backend.h +++ b/include/linux/agp_backend.h | |||
@@ -30,6 +30,8 @@ | |||
30 | #ifndef _AGP_BACKEND_H | 30 | #ifndef _AGP_BACKEND_H |
31 | #define _AGP_BACKEND_H 1 | 31 | #define _AGP_BACKEND_H 1 |
32 | 32 | ||
33 | #include <linux/list.h> | ||
34 | |||
33 | enum chipset_type { | 35 | enum chipset_type { |
34 | NOT_SUPPORTED, | 36 | NOT_SUPPORTED, |
35 | SUPPORTED, | 37 | SUPPORTED, |
@@ -78,6 +80,8 @@ struct agp_memory { | |||
78 | bool is_bound; | 80 | bool is_bound; |
79 | bool is_flushed; | 81 | bool is_flushed; |
80 | bool vmalloc_flag; | 82 | bool vmalloc_flag; |
83 | /* list of agp_memory mapped to the aperture */ | ||
84 | struct list_head mapped_list; | ||
81 | }; | 85 | }; |
82 | 86 | ||
83 | #define AGP_NORMAL_MEMORY 0 | 87 | #define AGP_NORMAL_MEMORY 0 |
@@ -96,6 +100,7 @@ extern struct agp_memory *agp_allocate_memory(struct agp_bridge_data *, size_t, | |||
96 | extern int agp_copy_info(struct agp_bridge_data *, struct agp_kern_info *); | 100 | extern int agp_copy_info(struct agp_bridge_data *, struct agp_kern_info *); |
97 | extern int agp_bind_memory(struct agp_memory *, off_t); | 101 | extern int agp_bind_memory(struct agp_memory *, off_t); |
98 | extern int agp_unbind_memory(struct agp_memory *); | 102 | extern int agp_unbind_memory(struct agp_memory *); |
103 | extern int agp_rebind_memory(void); | ||
99 | extern void agp_enable(struct agp_bridge_data *, u32); | 104 | extern void agp_enable(struct agp_bridge_data *, u32); |
100 | extern struct agp_bridge_data *agp_backend_acquire(struct pci_dev *); | 105 | extern struct agp_bridge_data *agp_backend_acquire(struct pci_dev *); |
101 | extern void agp_backend_release(struct agp_bridge_data *); | 106 | extern void agp_backend_release(struct agp_bridge_data *); |
diff --git a/include/linux/aio.h b/include/linux/aio.h index b51ddd28444e..09b276c35227 100644 --- a/include/linux/aio.h +++ b/include/linux/aio.h | |||
@@ -7,7 +7,6 @@ | |||
7 | #include <linux/uio.h> | 7 | #include <linux/uio.h> |
8 | 8 | ||
9 | #include <asm/atomic.h> | 9 | #include <asm/atomic.h> |
10 | #include <linux/uio.h> | ||
11 | 10 | ||
12 | #define AIO_MAXSEGS 4 | 11 | #define AIO_MAXSEGS 4 |
13 | #define AIO_KIOGRP_NR_ATOMIC 8 | 12 | #define AIO_KIOGRP_NR_ATOMIC 8 |
diff --git a/include/linux/anon_inodes.h b/include/linux/anon_inodes.h index 6129e58ca7c9..e0a0cdc2da43 100644 --- a/include/linux/anon_inodes.h +++ b/include/linux/anon_inodes.h | |||
@@ -9,7 +9,7 @@ | |||
9 | #define _LINUX_ANON_INODES_H | 9 | #define _LINUX_ANON_INODES_H |
10 | 10 | ||
11 | int anon_inode_getfd(const char *name, const struct file_operations *fops, | 11 | int anon_inode_getfd(const char *name, const struct file_operations *fops, |
12 | void *priv); | 12 | void *priv, int flags); |
13 | 13 | ||
14 | #endif /* _LINUX_ANON_INODES_H */ | 14 | #endif /* _LINUX_ANON_INODES_H */ |
15 | 15 | ||
diff --git a/include/linux/async_tx.h b/include/linux/async_tx.h index eb640f0acfac..0f50d4cc4360 100644 --- a/include/linux/async_tx.h +++ b/include/linux/async_tx.h | |||
@@ -101,21 +101,14 @@ async_tx_find_channel(struct dma_async_tx_descriptor *depend_tx, | |||
101 | 101 | ||
102 | /** | 102 | /** |
103 | * async_tx_sync_epilog - actions to take if an operation is run synchronously | 103 | * async_tx_sync_epilog - actions to take if an operation is run synchronously |
104 | * @flags: async_tx flags | ||
105 | * @depend_tx: transaction depends on depend_tx | ||
106 | * @cb_fn: function to call when the transaction completes | 104 | * @cb_fn: function to call when the transaction completes |
107 | * @cb_fn_param: parameter to pass to the callback routine | 105 | * @cb_fn_param: parameter to pass to the callback routine |
108 | */ | 106 | */ |
109 | static inline void | 107 | static inline void |
110 | async_tx_sync_epilog(unsigned long flags, | 108 | async_tx_sync_epilog(dma_async_tx_callback cb_fn, void *cb_fn_param) |
111 | struct dma_async_tx_descriptor *depend_tx, | ||
112 | dma_async_tx_callback cb_fn, void *cb_fn_param) | ||
113 | { | 109 | { |
114 | if (cb_fn) | 110 | if (cb_fn) |
115 | cb_fn(cb_fn_param); | 111 | cb_fn(cb_fn_param); |
116 | |||
117 | if (depend_tx && (flags & ASYNC_TX_DEP_ACK)) | ||
118 | async_tx_ack(depend_tx); | ||
119 | } | 112 | } |
120 | 113 | ||
121 | void | 114 | void |
@@ -152,4 +145,6 @@ struct dma_async_tx_descriptor * | |||
152 | async_trigger_callback(enum async_tx_flags flags, | 145 | async_trigger_callback(enum async_tx_flags flags, |
153 | struct dma_async_tx_descriptor *depend_tx, | 146 | struct dma_async_tx_descriptor *depend_tx, |
154 | dma_async_tx_callback cb_fn, void *cb_fn_param); | 147 | dma_async_tx_callback cb_fn, void *cb_fn_param); |
148 | |||
149 | void async_tx_quiesce(struct dma_async_tx_descriptor **tx); | ||
155 | #endif /* _ASYNC_TX_H_ */ | 150 | #endif /* _ASYNC_TX_H_ */ |
diff --git a/include/linux/ata.h b/include/linux/ata.h index 1c622e2b0504..a53318b8cbd0 100644 --- a/include/linux/ata.h +++ b/include/linux/ata.h | |||
@@ -30,6 +30,7 @@ | |||
30 | #define __LINUX_ATA_H__ | 30 | #define __LINUX_ATA_H__ |
31 | 31 | ||
32 | #include <linux/types.h> | 32 | #include <linux/types.h> |
33 | #include <asm/byteorder.h> | ||
33 | 34 | ||
34 | /* defines only for the constants which don't work well as enums */ | 35 | /* defines only for the constants which don't work well as enums */ |
35 | #define ATA_DMA_BOUNDARY 0xffffUL | 36 | #define ATA_DMA_BOUNDARY 0xffffUL |
@@ -46,18 +47,49 @@ enum { | |||
46 | ATA_MAX_SECTORS_TAPE = 65535, | 47 | ATA_MAX_SECTORS_TAPE = 65535, |
47 | 48 | ||
48 | ATA_ID_WORDS = 256, | 49 | ATA_ID_WORDS = 256, |
50 | ATA_ID_CONFIG = 0, | ||
51 | ATA_ID_CYLS = 1, | ||
52 | ATA_ID_HEADS = 3, | ||
53 | ATA_ID_SECTORS = 6, | ||
49 | ATA_ID_SERNO = 10, | 54 | ATA_ID_SERNO = 10, |
55 | ATA_ID_BUF_SIZE = 21, | ||
50 | ATA_ID_FW_REV = 23, | 56 | ATA_ID_FW_REV = 23, |
51 | ATA_ID_PROD = 27, | 57 | ATA_ID_PROD = 27, |
58 | ATA_ID_MAX_MULTSECT = 47, | ||
59 | ATA_ID_DWORD_IO = 48, | ||
60 | ATA_ID_CAPABILITY = 49, | ||
52 | ATA_ID_OLD_PIO_MODES = 51, | 61 | ATA_ID_OLD_PIO_MODES = 51, |
62 | ATA_ID_OLD_DMA_MODES = 52, | ||
53 | ATA_ID_FIELD_VALID = 53, | 63 | ATA_ID_FIELD_VALID = 53, |
64 | ATA_ID_CUR_CYLS = 54, | ||
65 | ATA_ID_CUR_HEADS = 55, | ||
66 | ATA_ID_CUR_SECTORS = 56, | ||
67 | ATA_ID_MULTSECT = 59, | ||
68 | ATA_ID_LBA_CAPACITY = 60, | ||
69 | ATA_ID_SWDMA_MODES = 62, | ||
54 | ATA_ID_MWDMA_MODES = 63, | 70 | ATA_ID_MWDMA_MODES = 63, |
55 | ATA_ID_PIO_MODES = 64, | 71 | ATA_ID_PIO_MODES = 64, |
56 | ATA_ID_EIDE_DMA_MIN = 65, | 72 | ATA_ID_EIDE_DMA_MIN = 65, |
73 | ATA_ID_EIDE_DMA_TIME = 66, | ||
57 | ATA_ID_EIDE_PIO = 67, | 74 | ATA_ID_EIDE_PIO = 67, |
58 | ATA_ID_EIDE_PIO_IORDY = 68, | 75 | ATA_ID_EIDE_PIO_IORDY = 68, |
59 | ATA_ID_UDMA_MODES = 88, | 76 | ATA_ID_QUEUE_DEPTH = 75, |
60 | ATA_ID_MAJOR_VER = 80, | 77 | ATA_ID_MAJOR_VER = 80, |
78 | ATA_ID_COMMAND_SET_1 = 82, | ||
79 | ATA_ID_COMMAND_SET_2 = 83, | ||
80 | ATA_ID_CFSSE = 84, | ||
81 | ATA_ID_CFS_ENABLE_1 = 85, | ||
82 | ATA_ID_CFS_ENABLE_2 = 86, | ||
83 | ATA_ID_CSF_DEFAULT = 87, | ||
84 | ATA_ID_UDMA_MODES = 88, | ||
85 | ATA_ID_HW_CONFIG = 93, | ||
86 | ATA_ID_SPG = 98, | ||
87 | ATA_ID_LBA_CAPACITY_2 = 100, | ||
88 | ATA_ID_LAST_LUN = 126, | ||
89 | ATA_ID_DLF = 128, | ||
90 | ATA_ID_CSFO = 129, | ||
91 | ATA_ID_CFA_POWER = 160, | ||
92 | ATA_ID_ROT_SPEED = 217, | ||
61 | ATA_ID_PIO4 = (1 << 1), | 93 | ATA_ID_PIO4 = (1 << 1), |
62 | 94 | ||
63 | ATA_ID_SERNO_LEN = 20, | 95 | ATA_ID_SERNO_LEN = 20, |
@@ -123,13 +155,26 @@ enum { | |||
123 | ATA_BUSY = (1 << 7), /* BSY status bit */ | 155 | ATA_BUSY = (1 << 7), /* BSY status bit */ |
124 | ATA_DRDY = (1 << 6), /* device ready */ | 156 | ATA_DRDY = (1 << 6), /* device ready */ |
125 | ATA_DF = (1 << 5), /* device fault */ | 157 | ATA_DF = (1 << 5), /* device fault */ |
158 | ATA_DSC = (1 << 4), /* drive seek complete */ | ||
126 | ATA_DRQ = (1 << 3), /* data request i/o */ | 159 | ATA_DRQ = (1 << 3), /* data request i/o */ |
160 | ATA_CORR = (1 << 2), /* corrected data error */ | ||
161 | ATA_IDX = (1 << 1), /* index */ | ||
127 | ATA_ERR = (1 << 0), /* have an error */ | 162 | ATA_ERR = (1 << 0), /* have an error */ |
128 | ATA_SRST = (1 << 2), /* software reset */ | 163 | ATA_SRST = (1 << 2), /* software reset */ |
129 | ATA_ICRC = (1 << 7), /* interface CRC error */ | 164 | ATA_ICRC = (1 << 7), /* interface CRC error */ |
165 | ATA_BBK = ATA_ICRC, /* pre-EIDE: block marked bad */ | ||
130 | ATA_UNC = (1 << 6), /* uncorrectable media error */ | 166 | ATA_UNC = (1 << 6), /* uncorrectable media error */ |
167 | ATA_MC = (1 << 5), /* media changed */ | ||
131 | ATA_IDNF = (1 << 4), /* ID not found */ | 168 | ATA_IDNF = (1 << 4), /* ID not found */ |
169 | ATA_MCR = (1 << 3), /* media change requested */ | ||
132 | ATA_ABORTED = (1 << 2), /* command aborted */ | 170 | ATA_ABORTED = (1 << 2), /* command aborted */ |
171 | ATA_TRK0NF = (1 << 1), /* track 0 not found */ | ||
172 | ATA_AMNF = (1 << 0), /* address mark not found */ | ||
173 | ATAPI_LFS = 0xF0, /* last failed sense */ | ||
174 | ATAPI_EOM = ATA_TRK0NF, /* end of media */ | ||
175 | ATAPI_ILI = ATA_AMNF, /* illegal length indication */ | ||
176 | ATAPI_IO = (1 << 1), | ||
177 | ATAPI_COD = (1 << 0), | ||
133 | 178 | ||
134 | /* ATA command block registers */ | 179 | /* ATA command block registers */ |
135 | ATA_REG_DATA = 0x00, | 180 | ATA_REG_DATA = 0x00, |
@@ -192,6 +237,13 @@ enum { | |||
192 | ATA_CMD_PMP_WRITE = 0xE8, | 237 | ATA_CMD_PMP_WRITE = 0xE8, |
193 | ATA_CMD_CONF_OVERLAY = 0xB1, | 238 | ATA_CMD_CONF_OVERLAY = 0xB1, |
194 | ATA_CMD_SEC_FREEZE_LOCK = 0xF5, | 239 | ATA_CMD_SEC_FREEZE_LOCK = 0xF5, |
240 | ATA_CMD_SMART = 0xB0, | ||
241 | ATA_CMD_MEDIA_LOCK = 0xDE, | ||
242 | ATA_CMD_MEDIA_UNLOCK = 0xDF, | ||
243 | /* marked obsolete in the ATA/ATAPI-7 spec */ | ||
244 | ATA_CMD_RESTORE = 0x10, | ||
245 | /* EXABYTE specific */ | ||
246 | ATA_EXABYTE_ENABLE_NEST = 0xF0, | ||
195 | 247 | ||
196 | /* READ_LOG_EXT pages */ | 248 | /* READ_LOG_EXT pages */ |
197 | ATA_LOG_SATA_NCQ = 0x10, | 249 | ATA_LOG_SATA_NCQ = 0x10, |
@@ -232,6 +284,10 @@ enum { | |||
232 | SETFEATURES_WC_ON = 0x02, /* Enable write cache */ | 284 | SETFEATURES_WC_ON = 0x02, /* Enable write cache */ |
233 | SETFEATURES_WC_OFF = 0x82, /* Disable write cache */ | 285 | SETFEATURES_WC_OFF = 0x82, /* Disable write cache */ |
234 | 286 | ||
287 | /* Enable/Disable Automatic Acoustic Management */ | ||
288 | SETFEATURES_AAM_ON = 0x42, | ||
289 | SETFEATURES_AAM_OFF = 0xC2, | ||
290 | |||
235 | SETFEATURES_SPINUP = 0x07, /* Spin-up drive */ | 291 | SETFEATURES_SPINUP = 0x07, /* Spin-up drive */ |
236 | 292 | ||
237 | SETFEATURES_SATA_ENABLE = 0x10, /* Enable use of SATA feature */ | 293 | SETFEATURES_SATA_ENABLE = 0x10, /* Enable use of SATA feature */ |
@@ -254,6 +310,15 @@ enum { | |||
254 | ATA_DCO_IDENTIFY = 0xC2, | 310 | ATA_DCO_IDENTIFY = 0xC2, |
255 | ATA_DCO_SET = 0xC3, | 311 | ATA_DCO_SET = 0xC3, |
256 | 312 | ||
313 | /* feature values for SMART */ | ||
314 | ATA_SMART_ENABLE = 0xD8, | ||
315 | ATA_SMART_READ_VALUES = 0xD0, | ||
316 | ATA_SMART_READ_THRESHOLDS = 0xD1, | ||
317 | |||
318 | /* password used in LBA Mid / LBA High for executing SMART commands */ | ||
319 | ATA_SMART_LBAM_PASS = 0x4F, | ||
320 | ATA_SMART_LBAH_PASS = 0xC2, | ||
321 | |||
257 | /* ATAPI stuff */ | 322 | /* ATAPI stuff */ |
258 | ATAPI_PKT_DMA = (1 << 0), | 323 | ATAPI_PKT_DMA = (1 << 0), |
259 | ATAPI_DMADIR = (1 << 2), /* ATAPI data dir: | 324 | ATAPI_DMADIR = (1 << 2), /* ATAPI data dir: |
@@ -438,17 +503,17 @@ static inline int ata_is_data(u8 prot) | |||
438 | /* | 503 | /* |
439 | * id tests | 504 | * id tests |
440 | */ | 505 | */ |
441 | #define ata_id_is_ata(id) (((id)[0] & (1 << 15)) == 0) | 506 | #define ata_id_is_ata(id) (((id)[ATA_ID_CONFIG] & (1 << 15)) == 0) |
442 | #define ata_id_has_lba(id) ((id)[49] & (1 << 9)) | 507 | #define ata_id_has_lba(id) ((id)[ATA_ID_CAPABILITY] & (1 << 9)) |
443 | #define ata_id_has_dma(id) ((id)[49] & (1 << 8)) | 508 | #define ata_id_has_dma(id) ((id)[ATA_ID_CAPABILITY] & (1 << 8)) |
444 | #define ata_id_has_ncq(id) ((id)[76] & (1 << 8)) | 509 | #define ata_id_has_ncq(id) ((id)[76] & (1 << 8)) |
445 | #define ata_id_queue_depth(id) (((id)[75] & 0x1f) + 1) | 510 | #define ata_id_queue_depth(id) (((id)[ATA_ID_QUEUE_DEPTH] & 0x1f) + 1) |
446 | #define ata_id_removeable(id) ((id)[0] & (1 << 7)) | 511 | #define ata_id_removeable(id) ((id)[ATA_ID_CONFIG] & (1 << 7)) |
447 | #define ata_id_has_atapi_AN(id) \ | 512 | #define ata_id_has_atapi_AN(id) \ |
448 | ( (((id)[76] != 0x0000) && ((id)[76] != 0xffff)) && \ | 513 | ( (((id)[76] != 0x0000) && ((id)[76] != 0xffff)) && \ |
449 | ((id)[78] & (1 << 5)) ) | 514 | ((id)[78] & (1 << 5)) ) |
450 | #define ata_id_iordy_disable(id) ((id)[49] & (1 << 10)) | 515 | #define ata_id_iordy_disable(id) ((id)[ATA_ID_CAPABILITY] & (1 << 10)) |
451 | #define ata_id_has_iordy(id) ((id)[49] & (1 << 11)) | 516 | #define ata_id_has_iordy(id) ((id)[ATA_ID_CAPABILITY] & (1 << 11)) |
452 | #define ata_id_u32(id,n) \ | 517 | #define ata_id_u32(id,n) \ |
453 | (((u32) (id)[(n) + 1] << 16) | ((u32) (id)[(n)])) | 518 | (((u32) (id)[(n) + 1] << 16) | ((u32) (id)[(n)])) |
454 | #define ata_id_u64(id,n) \ | 519 | #define ata_id_u64(id,n) \ |
@@ -457,7 +522,7 @@ static inline int ata_is_data(u8 prot) | |||
457 | ((u64) (id)[(n) + 1] << 16) | \ | 522 | ((u64) (id)[(n) + 1] << 16) | \ |
458 | ((u64) (id)[(n) + 0]) ) | 523 | ((u64) (id)[(n) + 0]) ) |
459 | 524 | ||
460 | #define ata_id_cdb_intr(id) (((id)[0] & 0x60) == 0x20) | 525 | #define ata_id_cdb_intr(id) (((id)[ATA_ID_CONFIG] & 0x60) == 0x20) |
461 | 526 | ||
462 | static inline bool ata_id_has_hipm(const u16 *id) | 527 | static inline bool ata_id_has_hipm(const u16 *id) |
463 | { | 528 | { |
@@ -482,75 +547,106 @@ static inline bool ata_id_has_dipm(const u16 *id) | |||
482 | 547 | ||
483 | static inline int ata_id_has_fua(const u16 *id) | 548 | static inline int ata_id_has_fua(const u16 *id) |
484 | { | 549 | { |
485 | if ((id[84] & 0xC000) != 0x4000) | 550 | if ((id[ATA_ID_CFSSE] & 0xC000) != 0x4000) |
486 | return 0; | 551 | return 0; |
487 | return id[84] & (1 << 6); | 552 | return id[ATA_ID_CFSSE] & (1 << 6); |
488 | } | 553 | } |
489 | 554 | ||
490 | static inline int ata_id_has_flush(const u16 *id) | 555 | static inline int ata_id_has_flush(const u16 *id) |
491 | { | 556 | { |
492 | if ((id[83] & 0xC000) != 0x4000) | 557 | if ((id[ATA_ID_COMMAND_SET_2] & 0xC000) != 0x4000) |
558 | return 0; | ||
559 | return id[ATA_ID_COMMAND_SET_2] & (1 << 12); | ||
560 | } | ||
561 | |||
562 | static inline int ata_id_flush_enabled(const u16 *id) | ||
563 | { | ||
564 | if (ata_id_has_flush(id) == 0) | ||
493 | return 0; | 565 | return 0; |
494 | return id[83] & (1 << 12); | 566 | if ((id[ATA_ID_CSF_DEFAULT] & 0xC000) != 0x4000) |
567 | return 0; | ||
568 | return id[ATA_ID_CFS_ENABLE_2] & (1 << 12); | ||
495 | } | 569 | } |
496 | 570 | ||
497 | static inline int ata_id_has_flush_ext(const u16 *id) | 571 | static inline int ata_id_has_flush_ext(const u16 *id) |
498 | { | 572 | { |
499 | if ((id[83] & 0xC000) != 0x4000) | 573 | if ((id[ATA_ID_COMMAND_SET_2] & 0xC000) != 0x4000) |
500 | return 0; | 574 | return 0; |
501 | return id[83] & (1 << 13); | 575 | return id[ATA_ID_COMMAND_SET_2] & (1 << 13); |
576 | } | ||
577 | |||
578 | static inline int ata_id_flush_ext_enabled(const u16 *id) | ||
579 | { | ||
580 | if (ata_id_has_flush_ext(id) == 0) | ||
581 | return 0; | ||
582 | if ((id[ATA_ID_CSF_DEFAULT] & 0xC000) != 0x4000) | ||
583 | return 0; | ||
584 | /* | ||
585 | * some Maxtor disks have bit 13 defined incorrectly | ||
586 | * so check bit 10 too | ||
587 | */ | ||
588 | return (id[ATA_ID_CFS_ENABLE_2] & 0x2400) == 0x2400; | ||
502 | } | 589 | } |
503 | 590 | ||
504 | static inline int ata_id_has_lba48(const u16 *id) | 591 | static inline int ata_id_has_lba48(const u16 *id) |
505 | { | 592 | { |
506 | if ((id[83] & 0xC000) != 0x4000) | 593 | if ((id[ATA_ID_COMMAND_SET_2] & 0xC000) != 0x4000) |
507 | return 0; | 594 | return 0; |
508 | if (!ata_id_u64(id, 100)) | 595 | if (!ata_id_u64(id, ATA_ID_LBA_CAPACITY_2)) |
509 | return 0; | 596 | return 0; |
510 | return id[83] & (1 << 10); | 597 | return id[ATA_ID_COMMAND_SET_2] & (1 << 10); |
598 | } | ||
599 | |||
600 | static inline int ata_id_lba48_enabled(const u16 *id) | ||
601 | { | ||
602 | if (ata_id_has_lba48(id) == 0) | ||
603 | return 0; | ||
604 | if ((id[ATA_ID_CSF_DEFAULT] & 0xC000) != 0x4000) | ||
605 | return 0; | ||
606 | return id[ATA_ID_CFS_ENABLE_2] & (1 << 10); | ||
511 | } | 607 | } |
512 | 608 | ||
513 | static inline int ata_id_hpa_enabled(const u16 *id) | 609 | static inline int ata_id_hpa_enabled(const u16 *id) |
514 | { | 610 | { |
515 | /* Yes children, word 83 valid bits cover word 82 data */ | 611 | /* Yes children, word 83 valid bits cover word 82 data */ |
516 | if ((id[83] & 0xC000) != 0x4000) | 612 | if ((id[ATA_ID_COMMAND_SET_2] & 0xC000) != 0x4000) |
517 | return 0; | 613 | return 0; |
518 | /* And 87 covers 85-87 */ | 614 | /* And 87 covers 85-87 */ |
519 | if ((id[87] & 0xC000) != 0x4000) | 615 | if ((id[ATA_ID_CSF_DEFAULT] & 0xC000) != 0x4000) |
520 | return 0; | 616 | return 0; |
521 | /* Check command sets enabled as well as supported */ | 617 | /* Check command sets enabled as well as supported */ |
522 | if ((id[85] & ( 1 << 10)) == 0) | 618 | if ((id[ATA_ID_CFS_ENABLE_1] & (1 << 10)) == 0) |
523 | return 0; | 619 | return 0; |
524 | return id[82] & (1 << 10); | 620 | return id[ATA_ID_COMMAND_SET_1] & (1 << 10); |
525 | } | 621 | } |
526 | 622 | ||
527 | static inline int ata_id_has_wcache(const u16 *id) | 623 | static inline int ata_id_has_wcache(const u16 *id) |
528 | { | 624 | { |
529 | /* Yes children, word 83 valid bits cover word 82 data */ | 625 | /* Yes children, word 83 valid bits cover word 82 data */ |
530 | if ((id[83] & 0xC000) != 0x4000) | 626 | if ((id[ATA_ID_COMMAND_SET_2] & 0xC000) != 0x4000) |
531 | return 0; | 627 | return 0; |
532 | return id[82] & (1 << 5); | 628 | return id[ATA_ID_COMMAND_SET_1] & (1 << 5); |
533 | } | 629 | } |
534 | 630 | ||
535 | static inline int ata_id_has_pm(const u16 *id) | 631 | static inline int ata_id_has_pm(const u16 *id) |
536 | { | 632 | { |
537 | if ((id[83] & 0xC000) != 0x4000) | 633 | if ((id[ATA_ID_COMMAND_SET_2] & 0xC000) != 0x4000) |
538 | return 0; | 634 | return 0; |
539 | return id[82] & (1 << 3); | 635 | return id[ATA_ID_COMMAND_SET_1] & (1 << 3); |
540 | } | 636 | } |
541 | 637 | ||
542 | static inline int ata_id_rahead_enabled(const u16 *id) | 638 | static inline int ata_id_rahead_enabled(const u16 *id) |
543 | { | 639 | { |
544 | if ((id[87] & 0xC000) != 0x4000) | 640 | if ((id[ATA_ID_CSF_DEFAULT] & 0xC000) != 0x4000) |
545 | return 0; | 641 | return 0; |
546 | return id[85] & (1 << 6); | 642 | return id[ATA_ID_CFS_ENABLE_1] & (1 << 6); |
547 | } | 643 | } |
548 | 644 | ||
549 | static inline int ata_id_wcache_enabled(const u16 *id) | 645 | static inline int ata_id_wcache_enabled(const u16 *id) |
550 | { | 646 | { |
551 | if ((id[87] & 0xC000) != 0x4000) | 647 | if ((id[ATA_ID_CSF_DEFAULT] & 0xC000) != 0x4000) |
552 | return 0; | 648 | return 0; |
553 | return id[85] & (1 << 5); | 649 | return id[ATA_ID_CFS_ENABLE_1] & (1 << 5); |
554 | } | 650 | } |
555 | 651 | ||
556 | /** | 652 | /** |
@@ -581,7 +677,15 @@ static inline unsigned int ata_id_major_version(const u16 *id) | |||
581 | 677 | ||
582 | static inline int ata_id_is_sata(const u16 *id) | 678 | static inline int ata_id_is_sata(const u16 *id) |
583 | { | 679 | { |
584 | return ata_id_major_version(id) >= 5 && id[93] == 0; | 680 | /* |
681 | * See if word 93 is 0 AND drive is at least ATA-5 compatible | ||
682 | * verifying that word 80 by casting it to a signed type -- | ||
683 | * this trick allows us to filter out the reserved values of | ||
684 | * 0x0000 and 0xffff along with the earlier ATA revisions... | ||
685 | */ | ||
686 | if (id[ATA_ID_HW_CONFIG] == 0 && (short)id[ATA_ID_MAJOR_VER] >= 0x0020) | ||
687 | return 1; | ||
688 | return 0; | ||
585 | } | 689 | } |
586 | 690 | ||
587 | static inline int ata_id_has_tpm(const u16 *id) | 691 | static inline int ata_id_has_tpm(const u16 *id) |
@@ -599,7 +703,16 @@ static inline int ata_id_has_dword_io(const u16 *id) | |||
599 | /* ATA 8 reuses this flag for "trusted" computing */ | 703 | /* ATA 8 reuses this flag for "trusted" computing */ |
600 | if (ata_id_major_version(id) > 7) | 704 | if (ata_id_major_version(id) > 7) |
601 | return 0; | 705 | return 0; |
602 | if (id[48] & (1 << 0)) | 706 | if (id[ATA_ID_DWORD_IO] & (1 << 0)) |
707 | return 1; | ||
708 | return 0; | ||
709 | } | ||
710 | |||
711 | static inline int ata_id_has_unload(const u16 *id) | ||
712 | { | ||
713 | if (ata_id_major_version(id) >= 7 && | ||
714 | (id[ATA_ID_CFSSE] & 0xC000) == 0x4000 && | ||
715 | id[ATA_ID_CFSSE] & (1 << 13)) | ||
603 | return 1; | 716 | return 1; |
604 | return 0; | 717 | return 0; |
605 | } | 718 | } |
@@ -608,45 +721,50 @@ static inline int ata_id_current_chs_valid(const u16 *id) | |||
608 | { | 721 | { |
609 | /* For ATA-1 devices, if the INITIALIZE DEVICE PARAMETERS command | 722 | /* For ATA-1 devices, if the INITIALIZE DEVICE PARAMETERS command |
610 | has not been issued to the device then the values of | 723 | has not been issued to the device then the values of |
611 | id[54] to id[56] are vendor specific. */ | 724 | id[ATA_ID_CUR_CYLS] to id[ATA_ID_CUR_SECTORS] are vendor specific. */ |
612 | return (id[53] & 0x01) && /* Current translation valid */ | 725 | return (id[ATA_ID_FIELD_VALID] & 1) && /* Current translation valid */ |
613 | id[54] && /* cylinders in current translation */ | 726 | id[ATA_ID_CUR_CYLS] && /* cylinders in current translation */ |
614 | id[55] && /* heads in current translation */ | 727 | id[ATA_ID_CUR_HEADS] && /* heads in current translation */ |
615 | id[55] <= 16 && | 728 | id[ATA_ID_CUR_HEADS] <= 16 && |
616 | id[56]; /* sectors in current translation */ | 729 | id[ATA_ID_CUR_SECTORS]; /* sectors in current translation */ |
617 | } | 730 | } |
618 | 731 | ||
619 | static inline int ata_id_is_cfa(const u16 *id) | 732 | static inline int ata_id_is_cfa(const u16 *id) |
620 | { | 733 | { |
621 | u16 v = id[0]; | 734 | if (id[ATA_ID_CONFIG] == 0x848A) /* Standard CF */ |
622 | if (v == 0x848A) /* Standard CF */ | ||
623 | return 1; | 735 | return 1; |
624 | /* Could be CF hiding as standard ATA */ | 736 | /* Could be CF hiding as standard ATA */ |
625 | if (ata_id_major_version(id) >= 3 && id[82] != 0xFFFF && | 737 | if (ata_id_major_version(id) >= 3 && |
626 | (id[82] & ( 1 << 2))) | 738 | id[ATA_ID_COMMAND_SET_1] != 0xFFFF && |
739 | (id[ATA_ID_COMMAND_SET_1] & (1 << 2))) | ||
627 | return 1; | 740 | return 1; |
628 | return 0; | 741 | return 0; |
629 | } | 742 | } |
630 | 743 | ||
744 | static inline int ata_id_is_ssd(const u16 *id) | ||
745 | { | ||
746 | return id[ATA_ID_ROT_SPEED] == 0x01; | ||
747 | } | ||
748 | |||
631 | static inline int ata_drive_40wire(const u16 *dev_id) | 749 | static inline int ata_drive_40wire(const u16 *dev_id) |
632 | { | 750 | { |
633 | if (ata_id_is_sata(dev_id)) | 751 | if (ata_id_is_sata(dev_id)) |
634 | return 0; /* SATA */ | 752 | return 0; /* SATA */ |
635 | if ((dev_id[93] & 0xE000) == 0x6000) | 753 | if ((dev_id[ATA_ID_HW_CONFIG] & 0xE000) == 0x6000) |
636 | return 0; /* 80 wire */ | 754 | return 0; /* 80 wire */ |
637 | return 1; | 755 | return 1; |
638 | } | 756 | } |
639 | 757 | ||
640 | static inline int ata_drive_40wire_relaxed(const u16 *dev_id) | 758 | static inline int ata_drive_40wire_relaxed(const u16 *dev_id) |
641 | { | 759 | { |
642 | if ((dev_id[93] & 0x2000) == 0x2000) | 760 | if ((dev_id[ATA_ID_HW_CONFIG] & 0x2000) == 0x2000) |
643 | return 0; /* 80 wire */ | 761 | return 0; /* 80 wire */ |
644 | return 1; | 762 | return 1; |
645 | } | 763 | } |
646 | 764 | ||
647 | static inline int atapi_cdb_len(const u16 *dev_id) | 765 | static inline int atapi_cdb_len(const u16 *dev_id) |
648 | { | 766 | { |
649 | u16 tmp = dev_id[0] & 0x3; | 767 | u16 tmp = dev_id[ATA_ID_CONFIG] & 0x3; |
650 | switch (tmp) { | 768 | switch (tmp) { |
651 | case 0: return 12; | 769 | case 0: return 12; |
652 | case 1: return 16; | 770 | case 1: return 16; |
@@ -656,7 +774,7 @@ static inline int atapi_cdb_len(const u16 *dev_id) | |||
656 | 774 | ||
657 | static inline int atapi_command_packet_set(const u16 *dev_id) | 775 | static inline int atapi_command_packet_set(const u16 *dev_id) |
658 | { | 776 | { |
659 | return (dev_id[0] >> 8) & 0x1f; | 777 | return (dev_id[ATA_ID_CONFIG] >> 8) & 0x1f; |
660 | } | 778 | } |
661 | 779 | ||
662 | static inline int atapi_id_dmadir(const u16 *dev_id) | 780 | static inline int atapi_id_dmadir(const u16 *dev_id) |
@@ -664,6 +782,76 @@ static inline int atapi_id_dmadir(const u16 *dev_id) | |||
664 | return ata_id_major_version(dev_id) >= 7 && (dev_id[62] & 0x8000); | 782 | return ata_id_major_version(dev_id) >= 7 && (dev_id[62] & 0x8000); |
665 | } | 783 | } |
666 | 784 | ||
785 | /* | ||
786 | * ata_id_is_lba_capacity_ok() performs a sanity check on | ||
787 | * the claimed LBA capacity value for the device. | ||
788 | * | ||
789 | * Returns 1 if LBA capacity looks sensible, 0 otherwise. | ||
790 | * | ||
791 | * It is called only once for each device. | ||
792 | */ | ||
793 | static inline int ata_id_is_lba_capacity_ok(u16 *id) | ||
794 | { | ||
795 | unsigned long lba_sects, chs_sects, head, tail; | ||
796 | |||
797 | /* No non-LBA info .. so valid! */ | ||
798 | if (id[ATA_ID_CYLS] == 0) | ||
799 | return 1; | ||
800 | |||
801 | lba_sects = ata_id_u32(id, ATA_ID_LBA_CAPACITY); | ||
802 | |||
803 | /* | ||
804 | * The ATA spec tells large drives to return | ||
805 | * C/H/S = 16383/16/63 independent of their size. | ||
806 | * Some drives can be jumpered to use 15 heads instead of 16. | ||
807 | * Some drives can be jumpered to use 4092 cyls instead of 16383. | ||
808 | */ | ||
809 | if ((id[ATA_ID_CYLS] == 16383 || | ||
810 | (id[ATA_ID_CYLS] == 4092 && id[ATA_ID_CUR_CYLS] == 16383)) && | ||
811 | id[ATA_ID_SECTORS] == 63 && | ||
812 | (id[ATA_ID_HEADS] == 15 || id[ATA_ID_HEADS] == 16) && | ||
813 | (lba_sects >= 16383 * 63 * id[ATA_ID_HEADS])) | ||
814 | return 1; | ||
815 | |||
816 | chs_sects = id[ATA_ID_CYLS] * id[ATA_ID_HEADS] * id[ATA_ID_SECTORS]; | ||
817 | |||
818 | /* perform a rough sanity check on lba_sects: within 10% is OK */ | ||
819 | if (lba_sects - chs_sects < chs_sects/10) | ||
820 | return 1; | ||
821 | |||
822 | /* some drives have the word order reversed */ | ||
823 | head = (lba_sects >> 16) & 0xffff; | ||
824 | tail = lba_sects & 0xffff; | ||
825 | lba_sects = head | (tail << 16); | ||
826 | |||
827 | if (lba_sects - chs_sects < chs_sects/10) { | ||
828 | *(__le32 *)&id[ATA_ID_LBA_CAPACITY] = __cpu_to_le32(lba_sects); | ||
829 | return 1; /* LBA capacity is (now) good */ | ||
830 | } | ||
831 | |||
832 | return 0; /* LBA capacity value may be bad */ | ||
833 | } | ||
834 | |||
835 | static inline void ata_id_to_hd_driveid(u16 *id) | ||
836 | { | ||
837 | #ifdef __BIG_ENDIAN | ||
838 | /* accessed in struct hd_driveid as 8-bit values */ | ||
839 | id[ATA_ID_MAX_MULTSECT] = __cpu_to_le16(id[ATA_ID_MAX_MULTSECT]); | ||
840 | id[ATA_ID_CAPABILITY] = __cpu_to_le16(id[ATA_ID_CAPABILITY]); | ||
841 | id[ATA_ID_OLD_PIO_MODES] = __cpu_to_le16(id[ATA_ID_OLD_PIO_MODES]); | ||
842 | id[ATA_ID_OLD_DMA_MODES] = __cpu_to_le16(id[ATA_ID_OLD_DMA_MODES]); | ||
843 | id[ATA_ID_MULTSECT] = __cpu_to_le16(id[ATA_ID_MULTSECT]); | ||
844 | |||
845 | /* as 32-bit values */ | ||
846 | *(u32 *)&id[ATA_ID_LBA_CAPACITY] = ata_id_u32(id, ATA_ID_LBA_CAPACITY); | ||
847 | *(u32 *)&id[ATA_ID_SPG] = ata_id_u32(id, ATA_ID_SPG); | ||
848 | |||
849 | /* as 64-bit value */ | ||
850 | *(u64 *)&id[ATA_ID_LBA_CAPACITY_2] = | ||
851 | ata_id_u64(id, ATA_ID_LBA_CAPACITY_2); | ||
852 | #endif | ||
853 | } | ||
854 | |||
667 | static inline int is_multi_taskfile(struct ata_taskfile *tf) | 855 | static inline int is_multi_taskfile(struct ata_taskfile *tf) |
668 | { | 856 | { |
669 | return (tf->command == ATA_CMD_READ_MULTI) || | 857 | return (tf->command == ATA_CMD_READ_MULTI) || |
@@ -682,7 +870,7 @@ static inline int ata_ok(u8 status) | |||
682 | static inline int lba_28_ok(u64 block, u32 n_block) | 870 | static inline int lba_28_ok(u64 block, u32 n_block) |
683 | { | 871 | { |
684 | /* check the ending block number */ | 872 | /* check the ending block number */ |
685 | return ((block + n_block - 1) < ((u64)1 << 28)) && (n_block <= 256); | 873 | return ((block + n_block) < ((u64)1 << 28)) && (n_block <= 256); |
686 | } | 874 | } |
687 | 875 | ||
688 | static inline int lba_48_ok(u64 block, u32 n_block) | 876 | static inline int lba_48_ok(u64 block, u32 n_block) |
diff --git a/include/linux/atmel-pwm-bl.h b/include/linux/atmel-pwm-bl.h new file mode 100644 index 000000000000..0153a47806c2 --- /dev/null +++ b/include/linux/atmel-pwm-bl.h | |||
@@ -0,0 +1,43 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2007 Atmel Corporation | ||
3 | * | ||
4 | * Driver for the AT32AP700X PS/2 controller (PSIF). | ||
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_ATMEL_PWM_BL_H | ||
12 | #define __INCLUDE_ATMEL_PWM_BL_H | ||
13 | |||
14 | /** | ||
15 | * struct atmel_pwm_bl_platform_data | ||
16 | * @pwm_channel: which PWM channel in the PWM module to use. | ||
17 | * @pwm_frequency: PWM frequency to generate, the driver will try to be as | ||
18 | * close as the prescaler allows. | ||
19 | * @pwm_compare_max: value to use in the PWM channel compare register. | ||
20 | * @pwm_duty_max: maximum duty cycle value, must be less than or equal to | ||
21 | * pwm_compare_max. | ||
22 | * @pwm_duty_min: minimum duty cycle value, must be less than pwm_duty_max. | ||
23 | * @pwm_active_low: set to one if the low part of the PWM signal increases the | ||
24 | * brightness of the backlight. | ||
25 | * @gpio_on: GPIO line to control the backlight on/off, set to -1 if not used. | ||
26 | * @on_active_low: set to one if the on/off signal is on when GPIO is low. | ||
27 | * | ||
28 | * This struct must be added to the platform device in the board code. It is | ||
29 | * used by the atmel-pwm-bl driver to setup the GPIO to control on/off and the | ||
30 | * PWM device. | ||
31 | */ | ||
32 | struct atmel_pwm_bl_platform_data { | ||
33 | unsigned int pwm_channel; | ||
34 | unsigned int pwm_frequency; | ||
35 | unsigned int pwm_compare_max; | ||
36 | unsigned int pwm_duty_max; | ||
37 | unsigned int pwm_duty_min; | ||
38 | unsigned int pwm_active_low; | ||
39 | int gpio_on; | ||
40 | unsigned int on_active_low; | ||
41 | }; | ||
42 | |||
43 | #endif /* __INCLUDE_ATMEL_PWM_BL_H */ | ||
diff --git a/include/linux/audit.h b/include/linux/audit.h index 63c3bb98558f..6272a395d43c 100644 --- a/include/linux/audit.h +++ b/include/linux/audit.h | |||
@@ -286,7 +286,6 @@ | |||
286 | #define AUDIT_ARCH_SHEL64 (EM_SH|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE) | 286 | #define AUDIT_ARCH_SHEL64 (EM_SH|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE) |
287 | #define AUDIT_ARCH_SPARC (EM_SPARC) | 287 | #define AUDIT_ARCH_SPARC (EM_SPARC) |
288 | #define AUDIT_ARCH_SPARC64 (EM_SPARCV9|__AUDIT_ARCH_64BIT) | 288 | #define AUDIT_ARCH_SPARC64 (EM_SPARCV9|__AUDIT_ARCH_64BIT) |
289 | #define AUDIT_ARCH_V850 (EM_V850|__AUDIT_ARCH_LE) | ||
290 | #define AUDIT_ARCH_X86_64 (EM_X86_64|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE) | 289 | #define AUDIT_ARCH_X86_64 (EM_X86_64|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE) |
291 | 290 | ||
292 | #define AUDIT_PERM_EXEC 1 | 291 | #define AUDIT_PERM_EXEC 1 |
@@ -571,7 +570,7 @@ extern void audit_log_lost(const char *message); | |||
571 | extern int audit_update_lsm_rules(void); | 570 | extern int audit_update_lsm_rules(void); |
572 | 571 | ||
573 | /* Private API (for audit.c only) */ | 572 | /* Private API (for audit.c only) */ |
574 | extern int audit_filter_user(struct netlink_skb_parms *cb, int type); | 573 | extern int audit_filter_user(struct netlink_skb_parms *cb); |
575 | extern int audit_filter_type(int type); | 574 | extern int audit_filter_type(int type); |
576 | extern int audit_receive_filter(int type, int pid, int uid, int seq, | 575 | extern int audit_receive_filter(int type, int pid, int uid, int seq, |
577 | void *data, size_t datasz, uid_t loginuid, | 576 | void *data, size_t datasz, uid_t loginuid, |
diff --git a/include/linux/auto_fs4.h b/include/linux/auto_fs4.h index 31a29541b504..b785c6f8644d 100644 --- a/include/linux/auto_fs4.h +++ b/include/linux/auto_fs4.h | |||
@@ -98,8 +98,6 @@ union autofs_v5_packet_union { | |||
98 | #define AUTOFS_IOC_EXPIRE_INDIRECT AUTOFS_IOC_EXPIRE_MULTI | 98 | #define AUTOFS_IOC_EXPIRE_INDIRECT AUTOFS_IOC_EXPIRE_MULTI |
99 | #define AUTOFS_IOC_EXPIRE_DIRECT AUTOFS_IOC_EXPIRE_MULTI | 99 | #define AUTOFS_IOC_EXPIRE_DIRECT AUTOFS_IOC_EXPIRE_MULTI |
100 | #define AUTOFS_IOC_PROTOSUBVER _IOR(0x93,0x67,int) | 100 | #define AUTOFS_IOC_PROTOSUBVER _IOR(0x93,0x67,int) |
101 | #define AUTOFS_IOC_ASKREGHOST _IOR(0x93,0x68,int) | ||
102 | #define AUTOFS_IOC_TOGGLEREGHOST _IOR(0x93,0x69,int) | ||
103 | #define AUTOFS_IOC_ASKUMOUNT _IOR(0x93,0x70,int) | 101 | #define AUTOFS_IOC_ASKUMOUNT _IOR(0x93,0x70,int) |
104 | 102 | ||
105 | 103 | ||
diff --git a/include/linux/auxvec.h b/include/linux/auxvec.h index ad895455ab72..d7afa9dd6635 100644 --- a/include/linux/auxvec.h +++ b/include/linux/auxvec.h | |||
@@ -26,8 +26,14 @@ | |||
26 | 26 | ||
27 | #define AT_SECURE 23 /* secure mode boolean */ | 27 | #define AT_SECURE 23 /* secure mode boolean */ |
28 | 28 | ||
29 | #define AT_BASE_PLATFORM 24 /* string identifying real platform, may | ||
30 | * differ from AT_PLATFORM. */ | ||
31 | |||
32 | #define AT_EXECFN 31 /* filename of program */ | ||
33 | |||
29 | #ifdef __KERNEL__ | 34 | #ifdef __KERNEL__ |
30 | #define AT_VECTOR_SIZE_BASE (14 + 2) /* NEW_AUX_ENT entries in auxiliary table */ | 35 | #define AT_VECTOR_SIZE_BASE 18 /* NEW_AUX_ENT entries in auxiliary table */ |
36 | /* number of "#define AT_.*" above, minus {AT_NULL, AT_IGNORE, AT_NOTELF} */ | ||
31 | #endif | 37 | #endif |
32 | 38 | ||
33 | #endif /* _LINUX_AUXVEC_H */ | 39 | #endif /* _LINUX_AUXVEC_H */ |
diff --git a/include/linux/bcd.h b/include/linux/bcd.h index c545308125b0..7ac518e3c152 100644 --- a/include/linux/bcd.h +++ b/include/linux/bcd.h | |||
@@ -10,8 +10,13 @@ | |||
10 | #ifndef _BCD_H | 10 | #ifndef _BCD_H |
11 | #define _BCD_H | 11 | #define _BCD_H |
12 | 12 | ||
13 | #define BCD2BIN(val) (((val) & 0x0f) + ((val)>>4)*10) | 13 | #include <linux/compiler.h> |
14 | #define BIN2BCD(val) ((((val)/10)<<4) + (val)%10) | 14 | |
15 | unsigned bcd2bin(unsigned char val) __attribute_const__; | ||
16 | unsigned char bin2bcd(unsigned val) __attribute_const__; | ||
17 | |||
18 | #define BCD2BIN(val) bcd2bin(val) | ||
19 | #define BIN2BCD(val) bin2bcd(val) | ||
15 | 20 | ||
16 | /* backwards compat */ | 21 | /* backwards compat */ |
17 | #define BCD_TO_BIN(val) ((val)=BCD2BIN(val)) | 22 | #define BCD_TO_BIN(val) ((val)=BCD2BIN(val)) |
diff --git a/include/linux/binfmts.h b/include/linux/binfmts.h index ee0ed48e8348..826f62350805 100644 --- a/include/linux/binfmts.h +++ b/include/linux/binfmts.h | |||
@@ -38,7 +38,7 @@ struct linux_binprm{ | |||
38 | misc_bang:1; | 38 | misc_bang:1; |
39 | struct file * file; | 39 | struct file * file; |
40 | int e_uid, e_gid; | 40 | int e_uid, e_gid; |
41 | kernel_cap_t cap_inheritable, cap_permitted; | 41 | kernel_cap_t cap_post_exec_permitted; |
42 | bool cap_effective; | 42 | bool cap_effective; |
43 | void *security; | 43 | void *security; |
44 | int argc, envc; | 44 | int argc, envc; |
diff --git a/include/linux/bio.h b/include/linux/bio.h index 61c15eaf3fb3..ff5b4cf9e2da 100644 --- a/include/linux/bio.h +++ b/include/linux/bio.h | |||
@@ -26,21 +26,8 @@ | |||
26 | 26 | ||
27 | #ifdef CONFIG_BLOCK | 27 | #ifdef CONFIG_BLOCK |
28 | 28 | ||
29 | /* Platforms may set this to teach the BIO layer about IOMMU hardware. */ | ||
30 | #include <asm/io.h> | 29 | #include <asm/io.h> |
31 | 30 | ||
32 | #if defined(BIO_VMERGE_MAX_SIZE) && defined(BIO_VMERGE_BOUNDARY) | ||
33 | #define BIOVEC_VIRT_START_SIZE(x) (bvec_to_phys(x) & (BIO_VMERGE_BOUNDARY - 1)) | ||
34 | #define BIOVEC_VIRT_OVERSIZE(x) ((x) > BIO_VMERGE_MAX_SIZE) | ||
35 | #else | ||
36 | #define BIOVEC_VIRT_START_SIZE(x) 0 | ||
37 | #define BIOVEC_VIRT_OVERSIZE(x) 0 | ||
38 | #endif | ||
39 | |||
40 | #ifndef BIO_VMERGE_BOUNDARY | ||
41 | #define BIO_VMERGE_BOUNDARY 0 | ||
42 | #endif | ||
43 | |||
44 | #define BIO_DEBUG | 31 | #define BIO_DEBUG |
45 | 32 | ||
46 | #ifdef BIO_DEBUG | 33 | #ifdef BIO_DEBUG |
@@ -64,6 +51,7 @@ struct bio_vec { | |||
64 | 51 | ||
65 | struct bio_set; | 52 | struct bio_set; |
66 | struct bio; | 53 | struct bio; |
54 | struct bio_integrity_payload; | ||
67 | typedef void (bio_end_io_t) (struct bio *, int); | 55 | typedef void (bio_end_io_t) (struct bio *, int); |
68 | typedef void (bio_destructor_t) (struct bio *); | 56 | typedef void (bio_destructor_t) (struct bio *); |
69 | 57 | ||
@@ -87,31 +75,23 @@ struct bio { | |||
87 | /* Number of segments in this BIO after | 75 | /* Number of segments in this BIO after |
88 | * physical address coalescing is performed. | 76 | * physical address coalescing is performed. |
89 | */ | 77 | */ |
90 | unsigned short bi_phys_segments; | 78 | unsigned int bi_phys_segments; |
91 | |||
92 | /* Number of segments after physical and DMA remapping | ||
93 | * hardware coalescing is performed. | ||
94 | */ | ||
95 | unsigned short bi_hw_segments; | ||
96 | 79 | ||
97 | unsigned int bi_size; /* residual I/O count */ | 80 | unsigned int bi_size; /* residual I/O count */ |
98 | 81 | ||
99 | /* | ||
100 | * To keep track of the max hw size, we account for the | ||
101 | * sizes of the first and last virtually mergeable segments | ||
102 | * in this bio | ||
103 | */ | ||
104 | unsigned int bi_hw_front_size; | ||
105 | unsigned int bi_hw_back_size; | ||
106 | |||
107 | unsigned int bi_max_vecs; /* max bvl_vecs we can hold */ | 82 | unsigned int bi_max_vecs; /* max bvl_vecs we can hold */ |
108 | 83 | ||
84 | unsigned int bi_comp_cpu; /* completion CPU */ | ||
85 | |||
109 | struct bio_vec *bi_io_vec; /* the actual vec list */ | 86 | struct bio_vec *bi_io_vec; /* the actual vec list */ |
110 | 87 | ||
111 | bio_end_io_t *bi_end_io; | 88 | bio_end_io_t *bi_end_io; |
112 | atomic_t bi_cnt; /* pin count */ | 89 | atomic_t bi_cnt; /* pin count */ |
113 | 90 | ||
114 | void *bi_private; | 91 | void *bi_private; |
92 | #if defined(CONFIG_BLK_DEV_INTEGRITY) | ||
93 | struct bio_integrity_payload *bi_integrity; /* data integrity */ | ||
94 | #endif | ||
115 | 95 | ||
116 | bio_destructor_t *bi_destructor; /* destructor */ | 96 | bio_destructor_t *bi_destructor; /* destructor */ |
117 | }; | 97 | }; |
@@ -122,11 +102,14 @@ struct bio { | |||
122 | #define BIO_UPTODATE 0 /* ok after I/O completion */ | 102 | #define BIO_UPTODATE 0 /* ok after I/O completion */ |
123 | #define BIO_RW_BLOCK 1 /* RW_AHEAD set, and read/write would block */ | 103 | #define BIO_RW_BLOCK 1 /* RW_AHEAD set, and read/write would block */ |
124 | #define BIO_EOF 2 /* out-out-bounds error */ | 104 | #define BIO_EOF 2 /* out-out-bounds error */ |
125 | #define BIO_SEG_VALID 3 /* nr_hw_seg valid */ | 105 | #define BIO_SEG_VALID 3 /* bi_phys_segments valid */ |
126 | #define BIO_CLONED 4 /* doesn't own data */ | 106 | #define BIO_CLONED 4 /* doesn't own data */ |
127 | #define BIO_BOUNCED 5 /* bio is a bounce bio */ | 107 | #define BIO_BOUNCED 5 /* bio is a bounce bio */ |
128 | #define BIO_USER_MAPPED 6 /* contains user pages */ | 108 | #define BIO_USER_MAPPED 6 /* contains user pages */ |
129 | #define BIO_EOPNOTSUPP 7 /* not supported */ | 109 | #define BIO_EOPNOTSUPP 7 /* not supported */ |
110 | #define BIO_CPU_AFFINE 8 /* complete bio on same CPU as submitted */ | ||
111 | #define BIO_NULL_MAPPED 9 /* contains invalid user pages */ | ||
112 | #define BIO_FS_INTEGRITY 10 /* fs owns integrity data, not block layer */ | ||
130 | #define bio_flagged(bio, flag) ((bio)->bi_flags & (1 << (flag))) | 113 | #define bio_flagged(bio, flag) ((bio)->bi_flags & (1 << (flag))) |
131 | 114 | ||
132 | /* | 115 | /* |
@@ -140,18 +123,31 @@ struct bio { | |||
140 | /* | 123 | /* |
141 | * bio bi_rw flags | 124 | * bio bi_rw flags |
142 | * | 125 | * |
143 | * bit 0 -- read (not set) or write (set) | 126 | * bit 0 -- data direction |
127 | * If not set, bio is a read from device. If set, it's a write to device. | ||
144 | * bit 1 -- rw-ahead when set | 128 | * bit 1 -- rw-ahead when set |
145 | * bit 2 -- barrier | 129 | * bit 2 -- barrier |
130 | * Insert a serialization point in the IO queue, forcing previously | ||
131 | * submitted IO to be completed before this oen is issued. | ||
146 | * bit 3 -- fail fast, don't want low level driver retries | 132 | * bit 3 -- fail fast, don't want low level driver retries |
147 | * bit 4 -- synchronous I/O hint: the block layer will unplug immediately | 133 | * bit 4 -- synchronous I/O hint: the block layer will unplug immediately |
134 | * Note that this does NOT indicate that the IO itself is sync, just | ||
135 | * that the block layer will not postpone issue of this IO by plugging. | ||
136 | * bit 5 -- metadata request | ||
137 | * Used for tracing to differentiate metadata and data IO. May also | ||
138 | * get some preferential treatment in the IO scheduler | ||
139 | * bit 6 -- discard sectors | ||
140 | * Informs the lower level device that this range of sectors is no longer | ||
141 | * used by the file system and may thus be freed by the device. Used | ||
142 | * for flash based storage. | ||
148 | */ | 143 | */ |
149 | #define BIO_RW 0 | 144 | #define BIO_RW 0 /* Must match RW in req flags (blkdev.h) */ |
150 | #define BIO_RW_AHEAD 1 | 145 | #define BIO_RW_AHEAD 1 /* Must match FAILFAST in req flags */ |
151 | #define BIO_RW_BARRIER 2 | 146 | #define BIO_RW_BARRIER 2 |
152 | #define BIO_RW_FAILFAST 3 | 147 | #define BIO_RW_FAILFAST 3 |
153 | #define BIO_RW_SYNC 4 | 148 | #define BIO_RW_SYNC 4 |
154 | #define BIO_RW_META 5 | 149 | #define BIO_RW_META 5 |
150 | #define BIO_RW_DISCARD 6 | ||
155 | 151 | ||
156 | /* | 152 | /* |
157 | * upper 16 bits of bi_rw define the io priority of this bio | 153 | * upper 16 bits of bi_rw define the io priority of this bio |
@@ -181,14 +177,15 @@ struct bio { | |||
181 | #define bio_failfast(bio) ((bio)->bi_rw & (1 << BIO_RW_FAILFAST)) | 177 | #define bio_failfast(bio) ((bio)->bi_rw & (1 << BIO_RW_FAILFAST)) |
182 | #define bio_rw_ahead(bio) ((bio)->bi_rw & (1 << BIO_RW_AHEAD)) | 178 | #define bio_rw_ahead(bio) ((bio)->bi_rw & (1 << BIO_RW_AHEAD)) |
183 | #define bio_rw_meta(bio) ((bio)->bi_rw & (1 << BIO_RW_META)) | 179 | #define bio_rw_meta(bio) ((bio)->bi_rw & (1 << BIO_RW_META)) |
184 | #define bio_empty_barrier(bio) (bio_barrier(bio) && !(bio)->bi_size) | 180 | #define bio_discard(bio) ((bio)->bi_rw & (1 << BIO_RW_DISCARD)) |
181 | #define bio_empty_barrier(bio) (bio_barrier(bio) && !bio_has_data(bio) && !bio_discard(bio)) | ||
185 | 182 | ||
186 | static inline unsigned int bio_cur_sectors(struct bio *bio) | 183 | static inline unsigned int bio_cur_sectors(struct bio *bio) |
187 | { | 184 | { |
188 | if (bio->bi_vcnt) | 185 | if (bio->bi_vcnt) |
189 | return bio_iovec(bio)->bv_len >> 9; | 186 | return bio_iovec(bio)->bv_len >> 9; |
190 | 187 | else /* dataless requests such as discard */ | |
191 | return 0; | 188 | return bio->bi_size >> 9; |
192 | } | 189 | } |
193 | 190 | ||
194 | static inline void *bio_data(struct bio *bio) | 191 | static inline void *bio_data(struct bio *bio) |
@@ -232,8 +229,6 @@ static inline void *bio_data(struct bio *bio) | |||
232 | ((bvec_to_phys((vec1)) + (vec1)->bv_len) == bvec_to_phys((vec2))) | 229 | ((bvec_to_phys((vec1)) + (vec1)->bv_len) == bvec_to_phys((vec2))) |
233 | #endif | 230 | #endif |
234 | 231 | ||
235 | #define BIOVEC_VIRT_MERGEABLE(vec1, vec2) \ | ||
236 | ((((bvec_to_phys((vec1)) + (vec1)->bv_len) | bvec_to_phys((vec2))) & (BIO_VMERGE_BOUNDARY - 1)) == 0) | ||
237 | #define __BIO_SEG_BOUNDARY(addr1, addr2, mask) \ | 232 | #define __BIO_SEG_BOUNDARY(addr1, addr2, mask) \ |
238 | (((addr1) | (mask)) == (((addr2) - 1) | (mask))) | 233 | (((addr1) | (mask)) == (((addr2) - 1) | (mask))) |
239 | #define BIOVEC_SEG_BOUNDARY(q, b1, b2) \ | 234 | #define BIOVEC_SEG_BOUNDARY(q, b1, b2) \ |
@@ -271,6 +266,29 @@ static inline void *bio_data(struct bio *bio) | |||
271 | */ | 266 | */ |
272 | #define bio_get(bio) atomic_inc(&(bio)->bi_cnt) | 267 | #define bio_get(bio) atomic_inc(&(bio)->bi_cnt) |
273 | 268 | ||
269 | #if defined(CONFIG_BLK_DEV_INTEGRITY) | ||
270 | /* | ||
271 | * bio integrity payload | ||
272 | */ | ||
273 | struct bio_integrity_payload { | ||
274 | struct bio *bip_bio; /* parent bio */ | ||
275 | struct bio_vec *bip_vec; /* integrity data vector */ | ||
276 | |||
277 | sector_t bip_sector; /* virtual start sector */ | ||
278 | |||
279 | void *bip_buf; /* generated integrity data */ | ||
280 | bio_end_io_t *bip_end_io; /* saved I/O completion fn */ | ||
281 | |||
282 | int bip_error; /* saved I/O error */ | ||
283 | unsigned int bip_size; | ||
284 | |||
285 | unsigned short bip_pool; /* pool the ivec came from */ | ||
286 | unsigned short bip_vcnt; /* # of integrity bio_vecs */ | ||
287 | unsigned short bip_idx; /* current bip_vec index */ | ||
288 | |||
289 | struct work_struct bip_work; /* I/O completion */ | ||
290 | }; | ||
291 | #endif /* CONFIG_BLK_DEV_INTEGRITY */ | ||
274 | 292 | ||
275 | /* | 293 | /* |
276 | * A bio_pair is used when we need to split a bio. | 294 | * A bio_pair is used when we need to split a bio. |
@@ -283,20 +301,23 @@ static inline void *bio_data(struct bio *bio) | |||
283 | * in bio2.bi_private | 301 | * in bio2.bi_private |
284 | */ | 302 | */ |
285 | struct bio_pair { | 303 | struct bio_pair { |
286 | struct bio bio1, bio2; | 304 | struct bio bio1, bio2; |
287 | struct bio_vec bv1, bv2; | 305 | struct bio_vec bv1, bv2; |
288 | atomic_t cnt; | 306 | #if defined(CONFIG_BLK_DEV_INTEGRITY) |
289 | int error; | 307 | struct bio_integrity_payload bip1, bip2; |
308 | struct bio_vec iv1, iv2; | ||
309 | #endif | ||
310 | atomic_t cnt; | ||
311 | int error; | ||
290 | }; | 312 | }; |
291 | extern struct bio_pair *bio_split(struct bio *bi, mempool_t *pool, | 313 | extern struct bio_pair *bio_split(struct bio *bi, int first_sectors); |
292 | int first_sectors); | ||
293 | extern mempool_t *bio_split_pool; | ||
294 | extern void bio_pair_release(struct bio_pair *dbio); | 314 | extern void bio_pair_release(struct bio_pair *dbio); |
295 | 315 | ||
296 | extern struct bio_set *bioset_create(int, int); | 316 | extern struct bio_set *bioset_create(int, int); |
297 | extern void bioset_free(struct bio_set *); | 317 | extern void bioset_free(struct bio_set *); |
298 | 318 | ||
299 | extern struct bio *bio_alloc(gfp_t, int); | 319 | extern struct bio *bio_alloc(gfp_t, int); |
320 | extern struct bio *bio_kmalloc(gfp_t, int); | ||
300 | extern struct bio *bio_alloc_bioset(gfp_t, int, struct bio_set *); | 321 | extern struct bio *bio_alloc_bioset(gfp_t, int, struct bio_set *); |
301 | extern void bio_put(struct bio *); | 322 | extern void bio_put(struct bio *); |
302 | extern void bio_free(struct bio *, struct bio_set *); | 323 | extern void bio_free(struct bio *, struct bio_set *); |
@@ -304,7 +325,6 @@ extern void bio_free(struct bio *, struct bio_set *); | |||
304 | extern void bio_endio(struct bio *, int); | 325 | extern void bio_endio(struct bio *, int); |
305 | struct request_queue; | 326 | struct request_queue; |
306 | extern int bio_phys_segments(struct request_queue *, struct bio *); | 327 | extern int bio_phys_segments(struct request_queue *, struct bio *); |
307 | extern int bio_hw_segments(struct request_queue *, struct bio *); | ||
308 | 328 | ||
309 | extern void __bio_clone(struct bio *, struct bio *); | 329 | extern void __bio_clone(struct bio *, struct bio *); |
310 | extern struct bio *bio_clone(struct bio *, gfp_t); | 330 | extern struct bio *bio_clone(struct bio *, gfp_t); |
@@ -315,12 +335,14 @@ extern int bio_add_page(struct bio *, struct page *, unsigned int,unsigned int); | |||
315 | extern int bio_add_pc_page(struct request_queue *, struct bio *, struct page *, | 335 | extern int bio_add_pc_page(struct request_queue *, struct bio *, struct page *, |
316 | unsigned int, unsigned int); | 336 | unsigned int, unsigned int); |
317 | extern int bio_get_nr_vecs(struct block_device *); | 337 | extern int bio_get_nr_vecs(struct block_device *); |
338 | extern sector_t bio_sector_offset(struct bio *, unsigned short, unsigned int); | ||
318 | extern struct bio *bio_map_user(struct request_queue *, struct block_device *, | 339 | extern struct bio *bio_map_user(struct request_queue *, struct block_device *, |
319 | unsigned long, unsigned int, int); | 340 | unsigned long, unsigned int, int, gfp_t); |
320 | struct sg_iovec; | 341 | struct sg_iovec; |
342 | struct rq_map_data; | ||
321 | extern struct bio *bio_map_user_iov(struct request_queue *, | 343 | extern struct bio *bio_map_user_iov(struct request_queue *, |
322 | struct block_device *, | 344 | struct block_device *, |
323 | struct sg_iovec *, int, int); | 345 | struct sg_iovec *, int, int, gfp_t); |
324 | extern void bio_unmap_user(struct bio *); | 346 | extern void bio_unmap_user(struct bio *); |
325 | extern struct bio *bio_map_kern(struct request_queue *, void *, unsigned int, | 347 | extern struct bio *bio_map_kern(struct request_queue *, void *, unsigned int, |
326 | gfp_t); | 348 | gfp_t); |
@@ -328,11 +350,54 @@ extern struct bio *bio_copy_kern(struct request_queue *, void *, unsigned int, | |||
328 | gfp_t, int); | 350 | gfp_t, int); |
329 | extern void bio_set_pages_dirty(struct bio *bio); | 351 | extern void bio_set_pages_dirty(struct bio *bio); |
330 | extern void bio_check_pages_dirty(struct bio *bio); | 352 | extern void bio_check_pages_dirty(struct bio *bio); |
331 | extern struct bio *bio_copy_user(struct request_queue *, unsigned long, unsigned int, int); | 353 | extern struct bio *bio_copy_user(struct request_queue *, struct rq_map_data *, |
332 | extern struct bio *bio_copy_user_iov(struct request_queue *, struct sg_iovec *, | 354 | unsigned long, unsigned int, int, gfp_t); |
333 | int, int); | 355 | extern struct bio *bio_copy_user_iov(struct request_queue *, |
356 | struct rq_map_data *, struct sg_iovec *, | ||
357 | int, int, gfp_t); | ||
334 | extern int bio_uncopy_user(struct bio *); | 358 | extern int bio_uncopy_user(struct bio *); |
335 | void zero_fill_bio(struct bio *bio); | 359 | void zero_fill_bio(struct bio *bio); |
360 | extern struct bio_vec *bvec_alloc_bs(gfp_t, int, unsigned long *, struct bio_set *); | ||
361 | extern unsigned int bvec_nr_vecs(unsigned short idx); | ||
362 | |||
363 | /* | ||
364 | * Allow queuer to specify a completion CPU for this bio | ||
365 | */ | ||
366 | static inline void bio_set_completion_cpu(struct bio *bio, unsigned int cpu) | ||
367 | { | ||
368 | bio->bi_comp_cpu = cpu; | ||
369 | } | ||
370 | |||
371 | /* | ||
372 | * bio_set is used to allow other portions of the IO system to | ||
373 | * allocate their own private memory pools for bio and iovec structures. | ||
374 | * These memory pools in turn all allocate from the bio_slab | ||
375 | * and the bvec_slabs[]. | ||
376 | */ | ||
377 | #define BIO_POOL_SIZE 2 | ||
378 | #define BIOVEC_NR_POOLS 6 | ||
379 | |||
380 | struct bio_set { | ||
381 | mempool_t *bio_pool; | ||
382 | #if defined(CONFIG_BLK_DEV_INTEGRITY) | ||
383 | mempool_t *bio_integrity_pool; | ||
384 | #endif | ||
385 | mempool_t *bvec_pools[BIOVEC_NR_POOLS]; | ||
386 | }; | ||
387 | |||
388 | struct biovec_slab { | ||
389 | int nr_vecs; | ||
390 | char *name; | ||
391 | struct kmem_cache *slab; | ||
392 | }; | ||
393 | |||
394 | extern struct bio_set *fs_bio_set; | ||
395 | |||
396 | /* | ||
397 | * a small number of entries is fine, not going to be performance critical. | ||
398 | * basically we just need to survive | ||
399 | */ | ||
400 | #define BIO_SPLIT_ENTRIES 2 | ||
336 | 401 | ||
337 | #ifdef CONFIG_HIGHMEM | 402 | #ifdef CONFIG_HIGHMEM |
338 | /* | 403 | /* |
@@ -381,5 +446,64 @@ static inline char *__bio_kmap_irq(struct bio *bio, unsigned short idx, | |||
381 | __bio_kmap_irq((bio), (bio)->bi_idx, (flags)) | 446 | __bio_kmap_irq((bio), (bio)->bi_idx, (flags)) |
382 | #define bio_kunmap_irq(buf,flags) __bio_kunmap_irq(buf, flags) | 447 | #define bio_kunmap_irq(buf,flags) __bio_kunmap_irq(buf, flags) |
383 | 448 | ||
449 | /* | ||
450 | * Check whether this bio carries any data or not. A NULL bio is allowed. | ||
451 | */ | ||
452 | static inline int bio_has_data(struct bio *bio) | ||
453 | { | ||
454 | return bio && bio->bi_io_vec != NULL; | ||
455 | } | ||
456 | |||
457 | #if defined(CONFIG_BLK_DEV_INTEGRITY) | ||
458 | |||
459 | #define bip_vec_idx(bip, idx) (&(bip->bip_vec[(idx)])) | ||
460 | #define bip_vec(bip) bip_vec_idx(bip, 0) | ||
461 | |||
462 | #define __bip_for_each_vec(bvl, bip, i, start_idx) \ | ||
463 | for (bvl = bip_vec_idx((bip), (start_idx)), i = (start_idx); \ | ||
464 | i < (bip)->bip_vcnt; \ | ||
465 | bvl++, i++) | ||
466 | |||
467 | #define bip_for_each_vec(bvl, bip, i) \ | ||
468 | __bip_for_each_vec(bvl, bip, i, (bip)->bip_idx) | ||
469 | |||
470 | #define bio_integrity(bio) (bio->bi_integrity != NULL) | ||
471 | |||
472 | extern struct bio_integrity_payload *bio_integrity_alloc_bioset(struct bio *, gfp_t, unsigned int, struct bio_set *); | ||
473 | extern struct bio_integrity_payload *bio_integrity_alloc(struct bio *, gfp_t, unsigned int); | ||
474 | extern void bio_integrity_free(struct bio *, struct bio_set *); | ||
475 | extern int bio_integrity_add_page(struct bio *, struct page *, unsigned int, unsigned int); | ||
476 | extern int bio_integrity_enabled(struct bio *bio); | ||
477 | extern int bio_integrity_set_tag(struct bio *, void *, unsigned int); | ||
478 | extern int bio_integrity_get_tag(struct bio *, void *, unsigned int); | ||
479 | extern int bio_integrity_prep(struct bio *); | ||
480 | extern void bio_integrity_endio(struct bio *, int); | ||
481 | extern void bio_integrity_advance(struct bio *, unsigned int); | ||
482 | extern void bio_integrity_trim(struct bio *, unsigned int, unsigned int); | ||
483 | extern void bio_integrity_split(struct bio *, struct bio_pair *, int); | ||
484 | extern int bio_integrity_clone(struct bio *, struct bio *, struct bio_set *); | ||
485 | extern int bioset_integrity_create(struct bio_set *, int); | ||
486 | extern void bioset_integrity_free(struct bio_set *); | ||
487 | extern void bio_integrity_init_slab(void); | ||
488 | |||
489 | #else /* CONFIG_BLK_DEV_INTEGRITY */ | ||
490 | |||
491 | #define bio_integrity(a) (0) | ||
492 | #define bioset_integrity_create(a, b) (0) | ||
493 | #define bio_integrity_prep(a) (0) | ||
494 | #define bio_integrity_enabled(a) (0) | ||
495 | #define bio_integrity_clone(a, b, c) (0) | ||
496 | #define bioset_integrity_free(a) do { } while (0) | ||
497 | #define bio_integrity_free(a, b) do { } while (0) | ||
498 | #define bio_integrity_endio(a, b) do { } while (0) | ||
499 | #define bio_integrity_advance(a, b) do { } while (0) | ||
500 | #define bio_integrity_trim(a, b, c) do { } while (0) | ||
501 | #define bio_integrity_split(a, b, c) do { } while (0) | ||
502 | #define bio_integrity_set_tag(a, b, c) do { } while (0) | ||
503 | #define bio_integrity_get_tag(a, b, c) do { } while (0) | ||
504 | #define bio_integrity_init_slab(a) do { } while (0) | ||
505 | |||
506 | #endif /* CONFIG_BLK_DEV_INTEGRITY */ | ||
507 | |||
384 | #endif /* CONFIG_BLOCK */ | 508 | #endif /* CONFIG_BLOCK */ |
385 | #endif /* __LINUX_BIO_H */ | 509 | #endif /* __LINUX_BIO_H */ |
diff --git a/include/linux/bitmap.h b/include/linux/bitmap.h index 1abfe664c444..89781fd48859 100644 --- a/include/linux/bitmap.h +++ b/include/linux/bitmap.h | |||
@@ -110,6 +110,7 @@ extern int __bitmap_weight(const unsigned long *bitmap, int bits); | |||
110 | 110 | ||
111 | extern int bitmap_scnprintf(char *buf, unsigned int len, | 111 | extern int bitmap_scnprintf(char *buf, unsigned int len, |
112 | const unsigned long *src, int nbits); | 112 | const unsigned long *src, int nbits); |
113 | extern int bitmap_scnprintf_len(unsigned int nr_bits); | ||
113 | extern int __bitmap_parse(const char *buf, unsigned int buflen, int is_user, | 114 | extern int __bitmap_parse(const char *buf, unsigned int buflen, int is_user, |
114 | unsigned long *dst, int nbits); | 115 | unsigned long *dst, int nbits); |
115 | extern int bitmap_parse_user(const char __user *ubuf, unsigned int ulen, | 116 | extern int bitmap_parse_user(const char __user *ubuf, unsigned int ulen, |
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index d2a1b71e93c3..a92d9e4ea96e 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h | |||
@@ -16,14 +16,15 @@ | |||
16 | #include <linux/bio.h> | 16 | #include <linux/bio.h> |
17 | #include <linux/module.h> | 17 | #include <linux/module.h> |
18 | #include <linux/stringify.h> | 18 | #include <linux/stringify.h> |
19 | #include <linux/gfp.h> | ||
19 | #include <linux/bsg.h> | 20 | #include <linux/bsg.h> |
21 | #include <linux/smp.h> | ||
20 | 22 | ||
21 | #include <asm/scatterlist.h> | 23 | #include <asm/scatterlist.h> |
22 | 24 | ||
23 | struct scsi_ioctl_command; | 25 | struct scsi_ioctl_command; |
24 | 26 | ||
25 | struct request_queue; | 27 | struct request_queue; |
26 | typedef struct request_queue request_queue_t __deprecated; | ||
27 | struct elevator_queue; | 28 | struct elevator_queue; |
28 | typedef struct elevator_queue elevator_t; | 29 | typedef struct elevator_queue elevator_t; |
29 | struct request_pm_state; | 30 | struct request_pm_state; |
@@ -34,12 +35,6 @@ struct sg_io_hdr; | |||
34 | #define BLKDEV_MIN_RQ 4 | 35 | #define BLKDEV_MIN_RQ 4 |
35 | #define BLKDEV_MAX_RQ 128 /* Default maximum */ | 36 | #define BLKDEV_MAX_RQ 128 /* Default maximum */ |
36 | 37 | ||
37 | int put_io_context(struct io_context *ioc); | ||
38 | void exit_io_context(void); | ||
39 | struct io_context *get_io_context(gfp_t gfp_flags, int node); | ||
40 | struct io_context *alloc_io_context(gfp_t gfp_flags, int node); | ||
41 | void copy_io_context(struct io_context **pdst, struct io_context **psrc); | ||
42 | |||
43 | struct request; | 38 | struct request; |
44 | typedef void (rq_end_io_fn)(struct request *, int); | 39 | typedef void (rq_end_io_fn)(struct request *, int); |
45 | 40 | ||
@@ -61,7 +56,6 @@ enum rq_cmd_type_bits { | |||
61 | REQ_TYPE_PM_SUSPEND, /* suspend request */ | 56 | REQ_TYPE_PM_SUSPEND, /* suspend request */ |
62 | REQ_TYPE_PM_RESUME, /* resume request */ | 57 | REQ_TYPE_PM_RESUME, /* resume request */ |
63 | REQ_TYPE_PM_SHUTDOWN, /* shutdown request */ | 58 | REQ_TYPE_PM_SHUTDOWN, /* shutdown request */ |
64 | REQ_TYPE_FLUSH, /* flush request */ | ||
65 | REQ_TYPE_SPECIAL, /* driver defined type */ | 59 | REQ_TYPE_SPECIAL, /* driver defined type */ |
66 | REQ_TYPE_LINUX_BLOCK, /* generic block layer message */ | 60 | REQ_TYPE_LINUX_BLOCK, /* generic block layer message */ |
67 | /* | 61 | /* |
@@ -83,19 +77,18 @@ enum rq_cmd_type_bits { | |||
83 | * | 77 | * |
84 | */ | 78 | */ |
85 | enum { | 79 | enum { |
86 | /* | ||
87 | * just examples for now | ||
88 | */ | ||
89 | REQ_LB_OP_EJECT = 0x40, /* eject request */ | 80 | REQ_LB_OP_EJECT = 0x40, /* eject request */ |
90 | REQ_LB_OP_FLUSH = 0x41, /* flush device */ | 81 | REQ_LB_OP_FLUSH = 0x41, /* flush request */ |
82 | REQ_LB_OP_DISCARD = 0x42, /* discard sectors */ | ||
91 | }; | 83 | }; |
92 | 84 | ||
93 | /* | 85 | /* |
94 | * request type modified bits. first three bits match BIO_RW* bits, important | 86 | * request type modified bits. first two bits match BIO_RW* bits, important |
95 | */ | 87 | */ |
96 | enum rq_flag_bits { | 88 | enum rq_flag_bits { |
97 | __REQ_RW, /* not set, read. set, write */ | 89 | __REQ_RW, /* not set, read. set, write */ |
98 | __REQ_FAILFAST, /* no low level driver retries */ | 90 | __REQ_FAILFAST, /* no low level driver retries */ |
91 | __REQ_DISCARD, /* request to discard sectors */ | ||
99 | __REQ_SORTED, /* elevator knows about this request */ | 92 | __REQ_SORTED, /* elevator knows about this request */ |
100 | __REQ_SOFTBARRIER, /* may not be passed by ioscheduler */ | 93 | __REQ_SOFTBARRIER, /* may not be passed by ioscheduler */ |
101 | __REQ_HARDBARRIER, /* may not be passed by drive either */ | 94 | __REQ_HARDBARRIER, /* may not be passed by drive either */ |
@@ -113,10 +106,12 @@ enum rq_flag_bits { | |||
113 | __REQ_ALLOCED, /* request came from our alloc pool */ | 106 | __REQ_ALLOCED, /* request came from our alloc pool */ |
114 | __REQ_RW_META, /* metadata io request */ | 107 | __REQ_RW_META, /* metadata io request */ |
115 | __REQ_COPY_USER, /* contains copies of user pages */ | 108 | __REQ_COPY_USER, /* contains copies of user pages */ |
109 | __REQ_INTEGRITY, /* integrity metadata has been remapped */ | ||
116 | __REQ_NR_BITS, /* stops here */ | 110 | __REQ_NR_BITS, /* stops here */ |
117 | }; | 111 | }; |
118 | 112 | ||
119 | #define REQ_RW (1 << __REQ_RW) | 113 | #define REQ_RW (1 << __REQ_RW) |
114 | #define REQ_DISCARD (1 << __REQ_DISCARD) | ||
120 | #define REQ_FAILFAST (1 << __REQ_FAILFAST) | 115 | #define REQ_FAILFAST (1 << __REQ_FAILFAST) |
121 | #define REQ_SORTED (1 << __REQ_SORTED) | 116 | #define REQ_SORTED (1 << __REQ_SORTED) |
122 | #define REQ_SOFTBARRIER (1 << __REQ_SOFTBARRIER) | 117 | #define REQ_SOFTBARRIER (1 << __REQ_SOFTBARRIER) |
@@ -135,6 +130,7 @@ enum rq_flag_bits { | |||
135 | #define REQ_ALLOCED (1 << __REQ_ALLOCED) | 130 | #define REQ_ALLOCED (1 << __REQ_ALLOCED) |
136 | #define REQ_RW_META (1 << __REQ_RW_META) | 131 | #define REQ_RW_META (1 << __REQ_RW_META) |
137 | #define REQ_COPY_USER (1 << __REQ_COPY_USER) | 132 | #define REQ_COPY_USER (1 << __REQ_COPY_USER) |
133 | #define REQ_INTEGRITY (1 << __REQ_INTEGRITY) | ||
138 | 134 | ||
139 | #define BLK_MAX_CDB 16 | 135 | #define BLK_MAX_CDB 16 |
140 | 136 | ||
@@ -145,12 +141,14 @@ enum rq_flag_bits { | |||
145 | */ | 141 | */ |
146 | struct request { | 142 | struct request { |
147 | struct list_head queuelist; | 143 | struct list_head queuelist; |
148 | struct list_head donelist; | 144 | struct call_single_data csd; |
145 | int cpu; | ||
149 | 146 | ||
150 | struct request_queue *q; | 147 | struct request_queue *q; |
151 | 148 | ||
152 | unsigned int cmd_flags; | 149 | unsigned int cmd_flags; |
153 | enum rq_cmd_type_bits cmd_type; | 150 | enum rq_cmd_type_bits cmd_type; |
151 | unsigned long atomic_flags; | ||
154 | 152 | ||
155 | /* Maintain bio traversal state for part by part I/O submission. | 153 | /* Maintain bio traversal state for part by part I/O submission. |
156 | * hard_* are block layer internals, no driver should touch them! | 154 | * hard_* are block layer internals, no driver should touch them! |
@@ -195,13 +193,6 @@ struct request { | |||
195 | */ | 193 | */ |
196 | unsigned short nr_phys_segments; | 194 | unsigned short nr_phys_segments; |
197 | 195 | ||
198 | /* Number of scatter-gather addr+len pairs after | ||
199 | * physical and DMA remapping hardware coalescing is performed. | ||
200 | * This is the number of scatter-gather entries the driver | ||
201 | * will actually have to deal with after DMA mapping is done. | ||
202 | */ | ||
203 | unsigned short nr_hw_segments; | ||
204 | |||
205 | unsigned short ioprio; | 196 | unsigned short ioprio; |
206 | 197 | ||
207 | void *special; | 198 | void *special; |
@@ -225,6 +216,8 @@ struct request { | |||
225 | void *data; | 216 | void *data; |
226 | void *sense; | 217 | void *sense; |
227 | 218 | ||
219 | unsigned long deadline; | ||
220 | struct list_head timeout_list; | ||
228 | unsigned int timeout; | 221 | unsigned int timeout; |
229 | int retries; | 222 | int retries; |
230 | 223 | ||
@@ -238,6 +231,11 @@ struct request { | |||
238 | struct request *next_rq; | 231 | struct request *next_rq; |
239 | }; | 232 | }; |
240 | 233 | ||
234 | static inline unsigned short req_get_ioprio(struct request *req) | ||
235 | { | ||
236 | return req->ioprio; | ||
237 | } | ||
238 | |||
241 | /* | 239 | /* |
242 | * State information carried for REQ_TYPE_PM_SUSPEND and REQ_TYPE_PM_RESUME | 240 | * State information carried for REQ_TYPE_PM_SUSPEND and REQ_TYPE_PM_RESUME |
243 | * requests. Some step values could eventually be made generic. | 241 | * requests. Some step values could eventually be made generic. |
@@ -257,12 +255,29 @@ typedef void (request_fn_proc) (struct request_queue *q); | |||
257 | typedef int (make_request_fn) (struct request_queue *q, struct bio *bio); | 255 | typedef int (make_request_fn) (struct request_queue *q, struct bio *bio); |
258 | typedef int (prep_rq_fn) (struct request_queue *, struct request *); | 256 | typedef int (prep_rq_fn) (struct request_queue *, struct request *); |
259 | typedef void (unplug_fn) (struct request_queue *); | 257 | typedef void (unplug_fn) (struct request_queue *); |
258 | typedef int (prepare_discard_fn) (struct request_queue *, struct request *); | ||
260 | 259 | ||
261 | struct bio_vec; | 260 | struct bio_vec; |
262 | typedef int (merge_bvec_fn) (struct request_queue *, struct bio *, struct bio_vec *); | 261 | struct bvec_merge_data { |
262 | struct block_device *bi_bdev; | ||
263 | sector_t bi_sector; | ||
264 | unsigned bi_size; | ||
265 | unsigned long bi_rw; | ||
266 | }; | ||
267 | typedef int (merge_bvec_fn) (struct request_queue *, struct bvec_merge_data *, | ||
268 | struct bio_vec *); | ||
263 | typedef void (prepare_flush_fn) (struct request_queue *, struct request *); | 269 | typedef void (prepare_flush_fn) (struct request_queue *, struct request *); |
264 | typedef void (softirq_done_fn)(struct request *); | 270 | typedef void (softirq_done_fn)(struct request *); |
265 | typedef int (dma_drain_needed_fn)(struct request *); | 271 | typedef int (dma_drain_needed_fn)(struct request *); |
272 | typedef int (lld_busy_fn) (struct request_queue *q); | ||
273 | |||
274 | enum blk_eh_timer_return { | ||
275 | BLK_EH_NOT_HANDLED, | ||
276 | BLK_EH_HANDLED, | ||
277 | BLK_EH_RESET_TIMER, | ||
278 | }; | ||
279 | |||
280 | typedef enum blk_eh_timer_return (rq_timed_out_fn)(struct request *); | ||
266 | 281 | ||
267 | enum blk_queue_state { | 282 | enum blk_queue_state { |
268 | Queue_down, | 283 | Queue_down, |
@@ -278,6 +293,15 @@ struct blk_queue_tag { | |||
278 | atomic_t refcnt; /* map can be shared */ | 293 | atomic_t refcnt; /* map can be shared */ |
279 | }; | 294 | }; |
280 | 295 | ||
296 | #define BLK_SCSI_MAX_CMDS (256) | ||
297 | #define BLK_SCSI_CMD_PER_LONG (BLK_SCSI_MAX_CMDS / (sizeof(long) * 8)) | ||
298 | |||
299 | struct blk_cmd_filter { | ||
300 | unsigned long read_ok[BLK_SCSI_CMD_PER_LONG]; | ||
301 | unsigned long write_ok[BLK_SCSI_CMD_PER_LONG]; | ||
302 | struct kobject kobj; | ||
303 | }; | ||
304 | |||
281 | struct request_queue | 305 | struct request_queue |
282 | { | 306 | { |
283 | /* | 307 | /* |
@@ -296,10 +320,13 @@ struct request_queue | |||
296 | make_request_fn *make_request_fn; | 320 | make_request_fn *make_request_fn; |
297 | prep_rq_fn *prep_rq_fn; | 321 | prep_rq_fn *prep_rq_fn; |
298 | unplug_fn *unplug_fn; | 322 | unplug_fn *unplug_fn; |
323 | prepare_discard_fn *prepare_discard_fn; | ||
299 | merge_bvec_fn *merge_bvec_fn; | 324 | merge_bvec_fn *merge_bvec_fn; |
300 | prepare_flush_fn *prepare_flush_fn; | 325 | prepare_flush_fn *prepare_flush_fn; |
301 | softirq_done_fn *softirq_done_fn; | 326 | softirq_done_fn *softirq_done_fn; |
327 | rq_timed_out_fn *rq_timed_out_fn; | ||
302 | dma_drain_needed_fn *dma_drain_needed; | 328 | dma_drain_needed_fn *dma_drain_needed; |
329 | lld_busy_fn *lld_busy_fn; | ||
303 | 330 | ||
304 | /* | 331 | /* |
305 | * Dispatch queue sorting | 332 | * Dispatch queue sorting |
@@ -374,6 +401,10 @@ struct request_queue | |||
374 | unsigned int nr_sorted; | 401 | unsigned int nr_sorted; |
375 | unsigned int in_flight; | 402 | unsigned int in_flight; |
376 | 403 | ||
404 | unsigned int rq_timeout; | ||
405 | struct timer_list timeout; | ||
406 | struct list_head timeout_list; | ||
407 | |||
377 | /* | 408 | /* |
378 | * sg stuff | 409 | * sg stuff |
379 | */ | 410 | */ |
@@ -396,6 +427,7 @@ struct request_queue | |||
396 | #if defined(CONFIG_BLK_DEV_BSG) | 427 | #if defined(CONFIG_BLK_DEV_BSG) |
397 | struct bsg_class_device bsg_dev; | 428 | struct bsg_class_device bsg_dev; |
398 | #endif | 429 | #endif |
430 | struct blk_cmd_filter cmd_filter; | ||
399 | }; | 431 | }; |
400 | 432 | ||
401 | #define QUEUE_FLAG_CLUSTER 0 /* cluster several segments into 1 */ | 433 | #define QUEUE_FLAG_CLUSTER 0 /* cluster several segments into 1 */ |
@@ -409,6 +441,10 @@ struct request_queue | |||
409 | #define QUEUE_FLAG_ELVSWITCH 8 /* don't use elevator, just do FIFO */ | 441 | #define QUEUE_FLAG_ELVSWITCH 8 /* don't use elevator, just do FIFO */ |
410 | #define QUEUE_FLAG_BIDI 9 /* queue supports bidi requests */ | 442 | #define QUEUE_FLAG_BIDI 9 /* queue supports bidi requests */ |
411 | #define QUEUE_FLAG_NOMERGES 10 /* disable merge attempts */ | 443 | #define QUEUE_FLAG_NOMERGES 10 /* disable merge attempts */ |
444 | #define QUEUE_FLAG_SAME_COMP 11 /* force complete on same CPU */ | ||
445 | #define QUEUE_FLAG_FAIL_IO 12 /* fake timeout */ | ||
446 | #define QUEUE_FLAG_STACKABLE 13 /* supports request stacking */ | ||
447 | #define QUEUE_FLAG_NONROT 14 /* non-rotational device (SSD) */ | ||
412 | 448 | ||
413 | static inline int queue_is_locked(struct request_queue *q) | 449 | static inline int queue_is_locked(struct request_queue *q) |
414 | { | 450 | { |
@@ -426,6 +462,32 @@ static inline void queue_flag_set_unlocked(unsigned int flag, | |||
426 | __set_bit(flag, &q->queue_flags); | 462 | __set_bit(flag, &q->queue_flags); |
427 | } | 463 | } |
428 | 464 | ||
465 | static inline int queue_flag_test_and_clear(unsigned int flag, | ||
466 | struct request_queue *q) | ||
467 | { | ||
468 | WARN_ON_ONCE(!queue_is_locked(q)); | ||
469 | |||
470 | if (test_bit(flag, &q->queue_flags)) { | ||
471 | __clear_bit(flag, &q->queue_flags); | ||
472 | return 1; | ||
473 | } | ||
474 | |||
475 | return 0; | ||
476 | } | ||
477 | |||
478 | static inline int queue_flag_test_and_set(unsigned int flag, | ||
479 | struct request_queue *q) | ||
480 | { | ||
481 | WARN_ON_ONCE(!queue_is_locked(q)); | ||
482 | |||
483 | if (!test_bit(flag, &q->queue_flags)) { | ||
484 | __set_bit(flag, &q->queue_flags); | ||
485 | return 0; | ||
486 | } | ||
487 | |||
488 | return 1; | ||
489 | } | ||
490 | |||
429 | static inline void queue_flag_set(unsigned int flag, struct request_queue *q) | 491 | static inline void queue_flag_set(unsigned int flag, struct request_queue *q) |
430 | { | 492 | { |
431 | WARN_ON_ONCE(!queue_is_locked(q)); | 493 | WARN_ON_ONCE(!queue_is_locked(q)); |
@@ -488,7 +550,10 @@ enum { | |||
488 | #define blk_queue_tagged(q) test_bit(QUEUE_FLAG_QUEUED, &(q)->queue_flags) | 550 | #define blk_queue_tagged(q) test_bit(QUEUE_FLAG_QUEUED, &(q)->queue_flags) |
489 | #define blk_queue_stopped(q) test_bit(QUEUE_FLAG_STOPPED, &(q)->queue_flags) | 551 | #define blk_queue_stopped(q) test_bit(QUEUE_FLAG_STOPPED, &(q)->queue_flags) |
490 | #define blk_queue_nomerges(q) test_bit(QUEUE_FLAG_NOMERGES, &(q)->queue_flags) | 552 | #define blk_queue_nomerges(q) test_bit(QUEUE_FLAG_NOMERGES, &(q)->queue_flags) |
553 | #define blk_queue_nonrot(q) test_bit(QUEUE_FLAG_NONROT, &(q)->queue_flags) | ||
491 | #define blk_queue_flushing(q) ((q)->ordseq) | 554 | #define blk_queue_flushing(q) ((q)->ordseq) |
555 | #define blk_queue_stackable(q) \ | ||
556 | test_bit(QUEUE_FLAG_STACKABLE, &(q)->queue_flags) | ||
492 | 557 | ||
493 | #define blk_fs_request(rq) ((rq)->cmd_type == REQ_TYPE_FS) | 558 | #define blk_fs_request(rq) ((rq)->cmd_type == REQ_TYPE_FS) |
494 | #define blk_pc_request(rq) ((rq)->cmd_type == REQ_TYPE_BLOCK_PC) | 559 | #define blk_pc_request(rq) ((rq)->cmd_type == REQ_TYPE_BLOCK_PC) |
@@ -498,16 +563,18 @@ enum { | |||
498 | #define blk_noretry_request(rq) ((rq)->cmd_flags & REQ_FAILFAST) | 563 | #define blk_noretry_request(rq) ((rq)->cmd_flags & REQ_FAILFAST) |
499 | #define blk_rq_started(rq) ((rq)->cmd_flags & REQ_STARTED) | 564 | #define blk_rq_started(rq) ((rq)->cmd_flags & REQ_STARTED) |
500 | 565 | ||
501 | #define blk_account_rq(rq) (blk_rq_started(rq) && blk_fs_request(rq)) | 566 | #define blk_account_rq(rq) (blk_rq_started(rq) && (blk_fs_request(rq) || blk_discard_rq(rq))) |
502 | 567 | ||
503 | #define blk_pm_suspend_request(rq) ((rq)->cmd_type == REQ_TYPE_PM_SUSPEND) | 568 | #define blk_pm_suspend_request(rq) ((rq)->cmd_type == REQ_TYPE_PM_SUSPEND) |
504 | #define blk_pm_resume_request(rq) ((rq)->cmd_type == REQ_TYPE_PM_RESUME) | 569 | #define blk_pm_resume_request(rq) ((rq)->cmd_type == REQ_TYPE_PM_RESUME) |
505 | #define blk_pm_request(rq) \ | 570 | #define blk_pm_request(rq) \ |
506 | (blk_pm_suspend_request(rq) || blk_pm_resume_request(rq)) | 571 | (blk_pm_suspend_request(rq) || blk_pm_resume_request(rq)) |
507 | 572 | ||
573 | #define blk_rq_cpu_valid(rq) ((rq)->cpu != -1) | ||
508 | #define blk_sorted_rq(rq) ((rq)->cmd_flags & REQ_SORTED) | 574 | #define blk_sorted_rq(rq) ((rq)->cmd_flags & REQ_SORTED) |
509 | #define blk_barrier_rq(rq) ((rq)->cmd_flags & REQ_HARDBARRIER) | 575 | #define blk_barrier_rq(rq) ((rq)->cmd_flags & REQ_HARDBARRIER) |
510 | #define blk_fua_rq(rq) ((rq)->cmd_flags & REQ_FUA) | 576 | #define blk_fua_rq(rq) ((rq)->cmd_flags & REQ_FUA) |
577 | #define blk_discard_rq(rq) ((rq)->cmd_flags & REQ_DISCARD) | ||
511 | #define blk_bidi_rq(rq) ((rq)->next_rq != NULL) | 578 | #define blk_bidi_rq(rq) ((rq)->next_rq != NULL) |
512 | #define blk_empty_barrier(rq) (blk_barrier_rq(rq) && blk_fs_request(rq) && !(rq)->hard_nr_sectors) | 579 | #define blk_empty_barrier(rq) (blk_barrier_rq(rq) && blk_fs_request(rq) && !(rq)->hard_nr_sectors) |
513 | /* rq->queuelist of dequeued request must be list_empty() */ | 580 | /* rq->queuelist of dequeued request must be list_empty() */ |
@@ -554,7 +621,8 @@ static inline void blk_clear_queue_full(struct request_queue *q, int rw) | |||
554 | #define RQ_NOMERGE_FLAGS \ | 621 | #define RQ_NOMERGE_FLAGS \ |
555 | (REQ_NOMERGE | REQ_STARTED | REQ_HARDBARRIER | REQ_SOFTBARRIER) | 622 | (REQ_NOMERGE | REQ_STARTED | REQ_HARDBARRIER | REQ_SOFTBARRIER) |
556 | #define rq_mergeable(rq) \ | 623 | #define rq_mergeable(rq) \ |
557 | (!((rq)->cmd_flags & RQ_NOMERGE_FLAGS) && blk_fs_request((rq))) | 624 | (!((rq)->cmd_flags & RQ_NOMERGE_FLAGS) && \ |
625 | (blk_discard_rq(rq) || blk_fs_request((rq)))) | ||
558 | 626 | ||
559 | /* | 627 | /* |
560 | * q->prep_rq_fn return values | 628 | * q->prep_rq_fn return values |
@@ -599,6 +667,12 @@ static inline void blk_queue_bounce(struct request_queue *q, struct bio **bio) | |||
599 | } | 667 | } |
600 | #endif /* CONFIG_MMU */ | 668 | #endif /* CONFIG_MMU */ |
601 | 669 | ||
670 | struct rq_map_data { | ||
671 | struct page **pages; | ||
672 | int page_order; | ||
673 | int nr_entries; | ||
674 | }; | ||
675 | |||
602 | struct req_iterator { | 676 | struct req_iterator { |
603 | int i; | 677 | int i; |
604 | struct bio *bio; | 678 | struct bio *bio; |
@@ -623,11 +697,15 @@ extern void generic_make_request(struct bio *bio); | |||
623 | extern void blk_rq_init(struct request_queue *q, struct request *rq); | 697 | extern void blk_rq_init(struct request_queue *q, struct request *rq); |
624 | extern void blk_put_request(struct request *); | 698 | extern void blk_put_request(struct request *); |
625 | extern void __blk_put_request(struct request_queue *, struct request *); | 699 | extern void __blk_put_request(struct request_queue *, struct request *); |
626 | extern void blk_end_sync_rq(struct request *rq, int error); | ||
627 | extern struct request *blk_get_request(struct request_queue *, int, gfp_t); | 700 | extern struct request *blk_get_request(struct request_queue *, int, gfp_t); |
628 | extern void blk_insert_request(struct request_queue *, struct request *, int, void *); | 701 | extern void blk_insert_request(struct request_queue *, struct request *, int, void *); |
629 | extern void blk_requeue_request(struct request_queue *, struct request *); | 702 | extern void blk_requeue_request(struct request_queue *, struct request *); |
703 | extern int blk_rq_check_limits(struct request_queue *q, struct request *rq); | ||
704 | extern int blk_lld_busy(struct request_queue *q); | ||
705 | extern int blk_insert_cloned_request(struct request_queue *q, | ||
706 | struct request *rq); | ||
630 | extern void blk_plug_device(struct request_queue *); | 707 | extern void blk_plug_device(struct request_queue *); |
708 | extern void blk_plug_device_unlocked(struct request_queue *); | ||
631 | extern int blk_remove_plug(struct request_queue *); | 709 | extern int blk_remove_plug(struct request_queue *); |
632 | extern void blk_recount_segments(struct request_queue *, struct bio *); | 710 | extern void blk_recount_segments(struct request_queue *, struct bio *); |
633 | extern int scsi_cmd_ioctl(struct file *, struct request_queue *, | 711 | extern int scsi_cmd_ioctl(struct file *, struct request_queue *, |
@@ -667,16 +745,18 @@ extern void __blk_stop_queue(struct request_queue *q); | |||
667 | extern void __blk_run_queue(struct request_queue *); | 745 | extern void __blk_run_queue(struct request_queue *); |
668 | extern void blk_run_queue(struct request_queue *); | 746 | extern void blk_run_queue(struct request_queue *); |
669 | extern void blk_start_queueing(struct request_queue *); | 747 | extern void blk_start_queueing(struct request_queue *); |
670 | extern int blk_rq_map_user(struct request_queue *, struct request *, void __user *, unsigned long); | 748 | extern int blk_rq_map_user(struct request_queue *, struct request *, |
749 | struct rq_map_data *, void __user *, unsigned long, | ||
750 | gfp_t); | ||
671 | extern int blk_rq_unmap_user(struct bio *); | 751 | extern int blk_rq_unmap_user(struct bio *); |
672 | extern int blk_rq_map_kern(struct request_queue *, struct request *, void *, unsigned int, gfp_t); | 752 | extern int blk_rq_map_kern(struct request_queue *, struct request *, void *, unsigned int, gfp_t); |
673 | extern int blk_rq_map_user_iov(struct request_queue *, struct request *, | 753 | extern int blk_rq_map_user_iov(struct request_queue *, struct request *, |
674 | struct sg_iovec *, int, unsigned int); | 754 | struct rq_map_data *, struct sg_iovec *, int, |
755 | unsigned int, gfp_t); | ||
675 | extern int blk_execute_rq(struct request_queue *, struct gendisk *, | 756 | extern int blk_execute_rq(struct request_queue *, struct gendisk *, |
676 | struct request *, int); | 757 | struct request *, int); |
677 | extern void blk_execute_rq_nowait(struct request_queue *, struct gendisk *, | 758 | extern void blk_execute_rq_nowait(struct request_queue *, struct gendisk *, |
678 | struct request *, int, rq_end_io_fn *); | 759 | struct request *, int, rq_end_io_fn *); |
679 | extern int blk_verify_command(unsigned char *, int); | ||
680 | extern void blk_unplug(struct request_queue *q); | 760 | extern void blk_unplug(struct request_queue *q); |
681 | 761 | ||
682 | static inline struct request_queue *bdev_get_queue(struct block_device *bdev) | 762 | static inline struct request_queue *bdev_get_queue(struct block_device *bdev) |
@@ -713,12 +793,15 @@ extern int __blk_end_request(struct request *rq, int error, | |||
713 | extern int blk_end_bidi_request(struct request *rq, int error, | 793 | extern int blk_end_bidi_request(struct request *rq, int error, |
714 | unsigned int nr_bytes, unsigned int bidi_bytes); | 794 | unsigned int nr_bytes, unsigned int bidi_bytes); |
715 | extern void end_request(struct request *, int); | 795 | extern void end_request(struct request *, int); |
716 | extern void end_queued_request(struct request *, int); | ||
717 | extern void end_dequeued_request(struct request *, int); | ||
718 | extern int blk_end_request_callback(struct request *rq, int error, | 796 | extern int blk_end_request_callback(struct request *rq, int error, |
719 | unsigned int nr_bytes, | 797 | unsigned int nr_bytes, |
720 | int (drv_callback)(struct request *)); | 798 | int (drv_callback)(struct request *)); |
721 | extern void blk_complete_request(struct request *); | 799 | extern void blk_complete_request(struct request *); |
800 | extern void __blk_complete_request(struct request *); | ||
801 | extern void blk_abort_request(struct request *); | ||
802 | extern void blk_abort_queue(struct request_queue *); | ||
803 | extern void blk_update_request(struct request *rq, int error, | ||
804 | unsigned int nr_bytes); | ||
722 | 805 | ||
723 | /* | 806 | /* |
724 | * blk_end_request() takes bytes instead of sectors as a complete size. | 807 | * blk_end_request() takes bytes instead of sectors as a complete size. |
@@ -749,15 +832,20 @@ extern void blk_queue_max_segment_size(struct request_queue *, unsigned int); | |||
749 | extern void blk_queue_hardsect_size(struct request_queue *, unsigned short); | 832 | extern void blk_queue_hardsect_size(struct request_queue *, unsigned short); |
750 | extern void blk_queue_stack_limits(struct request_queue *t, struct request_queue *b); | 833 | extern void blk_queue_stack_limits(struct request_queue *t, struct request_queue *b); |
751 | extern void blk_queue_dma_pad(struct request_queue *, unsigned int); | 834 | extern void blk_queue_dma_pad(struct request_queue *, unsigned int); |
835 | extern void blk_queue_update_dma_pad(struct request_queue *, unsigned int); | ||
752 | extern int blk_queue_dma_drain(struct request_queue *q, | 836 | extern int blk_queue_dma_drain(struct request_queue *q, |
753 | dma_drain_needed_fn *dma_drain_needed, | 837 | dma_drain_needed_fn *dma_drain_needed, |
754 | void *buf, unsigned int size); | 838 | void *buf, unsigned int size); |
839 | extern void blk_queue_lld_busy(struct request_queue *q, lld_busy_fn *fn); | ||
755 | extern void blk_queue_segment_boundary(struct request_queue *, unsigned long); | 840 | extern void blk_queue_segment_boundary(struct request_queue *, unsigned long); |
756 | extern void blk_queue_prep_rq(struct request_queue *, prep_rq_fn *pfn); | 841 | extern void blk_queue_prep_rq(struct request_queue *, prep_rq_fn *pfn); |
757 | extern void blk_queue_merge_bvec(struct request_queue *, merge_bvec_fn *); | 842 | extern void blk_queue_merge_bvec(struct request_queue *, merge_bvec_fn *); |
758 | extern void blk_queue_dma_alignment(struct request_queue *, int); | 843 | extern void blk_queue_dma_alignment(struct request_queue *, int); |
759 | extern void blk_queue_update_dma_alignment(struct request_queue *, int); | 844 | extern void blk_queue_update_dma_alignment(struct request_queue *, int); |
760 | extern void blk_queue_softirq_done(struct request_queue *, softirq_done_fn *); | 845 | extern void blk_queue_softirq_done(struct request_queue *, softirq_done_fn *); |
846 | extern void blk_queue_set_discard(struct request_queue *, prepare_discard_fn *); | ||
847 | extern void blk_queue_rq_timed_out(struct request_queue *, rq_timed_out_fn *); | ||
848 | extern void blk_queue_rq_timeout(struct request_queue *, unsigned int); | ||
761 | extern struct backing_dev_info *blk_get_backing_dev_info(struct block_device *bdev); | 849 | extern struct backing_dev_info *blk_get_backing_dev_info(struct block_device *bdev); |
762 | extern int blk_queue_ordered(struct request_queue *, unsigned, prepare_flush_fn *); | 850 | extern int blk_queue_ordered(struct request_queue *, unsigned, prepare_flush_fn *); |
763 | extern int blk_do_ordered(struct request_queue *, struct request **); | 851 | extern int blk_do_ordered(struct request_queue *, struct request **); |
@@ -779,8 +867,6 @@ extern void blk_put_queue(struct request_queue *); | |||
779 | /* | 867 | /* |
780 | * tag stuff | 868 | * tag stuff |
781 | */ | 869 | */ |
782 | #define blk_queue_tag_depth(q) ((q)->queue_tags->busy) | ||
783 | #define blk_queue_tag_queue(q) ((q)->queue_tags->busy < (q)->queue_tags->max_depth) | ||
784 | #define blk_rq_tagged(rq) ((rq)->cmd_flags & REQ_QUEUED) | 870 | #define blk_rq_tagged(rq) ((rq)->cmd_flags & REQ_QUEUED) |
785 | extern int blk_queue_start_tag(struct request_queue *, struct request *); | 871 | extern int blk_queue_start_tag(struct request_queue *, struct request *); |
786 | extern struct request *blk_queue_find_tag(struct request_queue *, int); | 872 | extern struct request *blk_queue_find_tag(struct request_queue *, int); |
@@ -801,6 +887,23 @@ static inline struct request *blk_map_queue_find_tag(struct blk_queue_tag *bqt, | |||
801 | } | 887 | } |
802 | 888 | ||
803 | extern int blkdev_issue_flush(struct block_device *, sector_t *); | 889 | extern int blkdev_issue_flush(struct block_device *, sector_t *); |
890 | extern int blkdev_issue_discard(struct block_device *, | ||
891 | sector_t sector, sector_t nr_sects, gfp_t); | ||
892 | |||
893 | static inline int sb_issue_discard(struct super_block *sb, | ||
894 | sector_t block, sector_t nr_blocks) | ||
895 | { | ||
896 | block <<= (sb->s_blocksize_bits - 9); | ||
897 | nr_blocks <<= (sb->s_blocksize_bits - 9); | ||
898 | return blkdev_issue_discard(sb->s_bdev, block, nr_blocks, GFP_KERNEL); | ||
899 | } | ||
900 | |||
901 | /* | ||
902 | * command filter functions | ||
903 | */ | ||
904 | extern int blk_verify_command(struct blk_cmd_filter *filter, | ||
905 | unsigned char *cmd, int has_write_perm); | ||
906 | extern void blk_set_cmd_filter_defaults(struct blk_cmd_filter *filter); | ||
804 | 907 | ||
805 | #define MAX_PHYS_SEGMENTS 128 | 908 | #define MAX_PHYS_SEGMENTS 128 |
806 | #define MAX_HW_SEGMENTS 128 | 909 | #define MAX_HW_SEGMENTS 128 |
@@ -831,6 +934,13 @@ static inline int queue_dma_alignment(struct request_queue *q) | |||
831 | return q ? q->dma_alignment : 511; | 934 | return q ? q->dma_alignment : 511; |
832 | } | 935 | } |
833 | 936 | ||
937 | static inline int blk_rq_aligned(struct request_queue *q, void *addr, | ||
938 | unsigned int len) | ||
939 | { | ||
940 | unsigned int alignment = queue_dma_alignment(q) | q->dma_pad_mask; | ||
941 | return !((unsigned long)addr & alignment) && !(len & alignment); | ||
942 | } | ||
943 | |||
834 | /* assumes size > 256 */ | 944 | /* assumes size > 256 */ |
835 | static inline unsigned int blksize_bits(unsigned int size) | 945 | static inline unsigned int blksize_bits(unsigned int size) |
836 | { | 946 | { |
@@ -857,7 +967,7 @@ static inline void put_dev_sector(Sector p) | |||
857 | } | 967 | } |
858 | 968 | ||
859 | struct work_struct; | 969 | struct work_struct; |
860 | int kblockd_schedule_work(struct work_struct *work); | 970 | int kblockd_schedule_work(struct request_queue *q, struct work_struct *work); |
861 | void kblockd_flush_work(struct work_struct *work); | 971 | void kblockd_flush_work(struct work_struct *work); |
862 | 972 | ||
863 | #define MODULE_ALIAS_BLOCKDEV(major,minor) \ | 973 | #define MODULE_ALIAS_BLOCKDEV(major,minor) \ |
@@ -865,28 +975,89 @@ void kblockd_flush_work(struct work_struct *work); | |||
865 | #define MODULE_ALIAS_BLOCKDEV_MAJOR(major) \ | 975 | #define MODULE_ALIAS_BLOCKDEV_MAJOR(major) \ |
866 | MODULE_ALIAS("block-major-" __stringify(major) "-*") | 976 | MODULE_ALIAS("block-major-" __stringify(major) "-*") |
867 | 977 | ||
978 | #if defined(CONFIG_BLK_DEV_INTEGRITY) | ||
868 | 979 | ||
869 | #else /* CONFIG_BLOCK */ | 980 | #define INTEGRITY_FLAG_READ 2 /* verify data integrity on read */ |
870 | /* | 981 | #define INTEGRITY_FLAG_WRITE 4 /* generate data integrity on write */ |
871 | * stubs for when the block layer is configured out | ||
872 | */ | ||
873 | #define buffer_heads_over_limit 0 | ||
874 | 982 | ||
875 | static inline long nr_blockdev_pages(void) | 983 | struct blk_integrity_exchg { |
984 | void *prot_buf; | ||
985 | void *data_buf; | ||
986 | sector_t sector; | ||
987 | unsigned int data_size; | ||
988 | unsigned short sector_size; | ||
989 | const char *disk_name; | ||
990 | }; | ||
991 | |||
992 | typedef void (integrity_gen_fn) (struct blk_integrity_exchg *); | ||
993 | typedef int (integrity_vrfy_fn) (struct blk_integrity_exchg *); | ||
994 | typedef void (integrity_set_tag_fn) (void *, void *, unsigned int); | ||
995 | typedef void (integrity_get_tag_fn) (void *, void *, unsigned int); | ||
996 | |||
997 | struct blk_integrity { | ||
998 | integrity_gen_fn *generate_fn; | ||
999 | integrity_vrfy_fn *verify_fn; | ||
1000 | integrity_set_tag_fn *set_tag_fn; | ||
1001 | integrity_get_tag_fn *get_tag_fn; | ||
1002 | |||
1003 | unsigned short flags; | ||
1004 | unsigned short tuple_size; | ||
1005 | unsigned short sector_size; | ||
1006 | unsigned short tag_size; | ||
1007 | |||
1008 | const char *name; | ||
1009 | |||
1010 | struct kobject kobj; | ||
1011 | }; | ||
1012 | |||
1013 | extern int blk_integrity_register(struct gendisk *, struct blk_integrity *); | ||
1014 | extern void blk_integrity_unregister(struct gendisk *); | ||
1015 | extern int blk_integrity_compare(struct gendisk *, struct gendisk *); | ||
1016 | extern int blk_rq_map_integrity_sg(struct request *, struct scatterlist *); | ||
1017 | extern int blk_rq_count_integrity_sg(struct request *); | ||
1018 | |||
1019 | static inline | ||
1020 | struct blk_integrity *bdev_get_integrity(struct block_device *bdev) | ||
876 | { | 1021 | { |
877 | return 0; | 1022 | return bdev->bd_disk->integrity; |
878 | } | 1023 | } |
879 | 1024 | ||
880 | static inline void exit_io_context(void) | 1025 | static inline struct blk_integrity *blk_get_integrity(struct gendisk *disk) |
881 | { | 1026 | { |
1027 | return disk->integrity; | ||
882 | } | 1028 | } |
883 | 1029 | ||
884 | struct io_context; | 1030 | static inline int blk_integrity_rq(struct request *rq) |
885 | static inline int put_io_context(struct io_context *ioc) | ||
886 | { | 1031 | { |
887 | return 1; | 1032 | if (rq->bio == NULL) |
1033 | return 0; | ||
1034 | |||
1035 | return bio_integrity(rq->bio); | ||
888 | } | 1036 | } |
889 | 1037 | ||
1038 | #else /* CONFIG_BLK_DEV_INTEGRITY */ | ||
1039 | |||
1040 | #define blk_integrity_rq(rq) (0) | ||
1041 | #define blk_rq_count_integrity_sg(a) (0) | ||
1042 | #define blk_rq_map_integrity_sg(a, b) (0) | ||
1043 | #define bdev_get_integrity(a) (0) | ||
1044 | #define blk_get_integrity(a) (0) | ||
1045 | #define blk_integrity_compare(a, b) (0) | ||
1046 | #define blk_integrity_register(a, b) (0) | ||
1047 | #define blk_integrity_unregister(a) do { } while (0); | ||
1048 | |||
1049 | #endif /* CONFIG_BLK_DEV_INTEGRITY */ | ||
1050 | |||
1051 | #else /* CONFIG_BLOCK */ | ||
1052 | /* | ||
1053 | * stubs for when the block layer is configured out | ||
1054 | */ | ||
1055 | #define buffer_heads_over_limit 0 | ||
1056 | |||
1057 | static inline long nr_blockdev_pages(void) | ||
1058 | { | ||
1059 | return 0; | ||
1060 | } | ||
890 | 1061 | ||
891 | #endif /* CONFIG_BLOCK */ | 1062 | #endif /* CONFIG_BLOCK */ |
892 | 1063 | ||
diff --git a/include/linux/blktrace_api.h b/include/linux/blktrace_api.h index e3ef903aae88..3a31eb506164 100644 --- a/include/linux/blktrace_api.h +++ b/include/linux/blktrace_api.h | |||
@@ -1,8 +1,10 @@ | |||
1 | #ifndef BLKTRACE_H | 1 | #ifndef BLKTRACE_H |
2 | #define BLKTRACE_H | 2 | #define BLKTRACE_H |
3 | 3 | ||
4 | #ifdef __KERNEL__ | ||
4 | #include <linux/blkdev.h> | 5 | #include <linux/blkdev.h> |
5 | #include <linux/relay.h> | 6 | #include <linux/relay.h> |
7 | #endif | ||
6 | 8 | ||
7 | /* | 9 | /* |
8 | * Trace categories | 10 | * Trace categories |
@@ -21,6 +23,7 @@ enum blktrace_cat { | |||
21 | BLK_TC_NOTIFY = 1 << 10, /* special message */ | 23 | BLK_TC_NOTIFY = 1 << 10, /* special message */ |
22 | BLK_TC_AHEAD = 1 << 11, /* readahead */ | 24 | BLK_TC_AHEAD = 1 << 11, /* readahead */ |
23 | BLK_TC_META = 1 << 12, /* metadata */ | 25 | BLK_TC_META = 1 << 12, /* metadata */ |
26 | BLK_TC_DISCARD = 1 << 13, /* discard requests */ | ||
24 | 27 | ||
25 | BLK_TC_END = 1 << 15, /* only 16-bits, reminder */ | 28 | BLK_TC_END = 1 << 15, /* only 16-bits, reminder */ |
26 | }; | 29 | }; |
@@ -47,6 +50,7 @@ enum blktrace_act { | |||
47 | __BLK_TA_SPLIT, /* bio was split */ | 50 | __BLK_TA_SPLIT, /* bio was split */ |
48 | __BLK_TA_BOUNCE, /* bio was bounced */ | 51 | __BLK_TA_BOUNCE, /* bio was bounced */ |
49 | __BLK_TA_REMAP, /* bio was remapped */ | 52 | __BLK_TA_REMAP, /* bio was remapped */ |
53 | __BLK_TA_ABORT, /* request aborted */ | ||
50 | }; | 54 | }; |
51 | 55 | ||
52 | /* | 56 | /* |
@@ -77,6 +81,7 @@ enum blktrace_notify { | |||
77 | #define BLK_TA_SPLIT (__BLK_TA_SPLIT) | 81 | #define BLK_TA_SPLIT (__BLK_TA_SPLIT) |
78 | #define BLK_TA_BOUNCE (__BLK_TA_BOUNCE) | 82 | #define BLK_TA_BOUNCE (__BLK_TA_BOUNCE) |
79 | #define BLK_TA_REMAP (__BLK_TA_REMAP | BLK_TC_ACT(BLK_TC_QUEUE)) | 83 | #define BLK_TA_REMAP (__BLK_TA_REMAP | BLK_TC_ACT(BLK_TC_QUEUE)) |
84 | #define BLK_TA_ABORT (__BLK_TA_ABORT | BLK_TC_ACT(BLK_TC_QUEUE)) | ||
80 | 85 | ||
81 | #define BLK_TN_PROCESS (__BLK_TN_PROCESS | BLK_TC_ACT(BLK_TC_NOTIFY)) | 86 | #define BLK_TN_PROCESS (__BLK_TN_PROCESS | BLK_TC_ACT(BLK_TC_NOTIFY)) |
82 | #define BLK_TN_TIMESTAMP (__BLK_TN_TIMESTAMP | BLK_TC_ACT(BLK_TC_NOTIFY)) | 87 | #define BLK_TN_TIMESTAMP (__BLK_TN_TIMESTAMP | BLK_TC_ACT(BLK_TC_NOTIFY)) |
@@ -89,17 +94,17 @@ enum blktrace_notify { | |||
89 | * The trace itself | 94 | * The trace itself |
90 | */ | 95 | */ |
91 | struct blk_io_trace { | 96 | struct blk_io_trace { |
92 | u32 magic; /* MAGIC << 8 | version */ | 97 | __u32 magic; /* MAGIC << 8 | version */ |
93 | u32 sequence; /* event number */ | 98 | __u32 sequence; /* event number */ |
94 | u64 time; /* in microseconds */ | 99 | __u64 time; /* in microseconds */ |
95 | u64 sector; /* disk offset */ | 100 | __u64 sector; /* disk offset */ |
96 | u32 bytes; /* transfer length */ | 101 | __u32 bytes; /* transfer length */ |
97 | u32 action; /* what happened */ | 102 | __u32 action; /* what happened */ |
98 | u32 pid; /* who did it */ | 103 | __u32 pid; /* who did it */ |
99 | u32 device; /* device number */ | 104 | __u32 device; /* device number */ |
100 | u32 cpu; /* on what cpu did it happen */ | 105 | __u32 cpu; /* on what cpu did it happen */ |
101 | u16 error; /* completion error */ | 106 | __u16 error; /* completion error */ |
102 | u16 pdu_len; /* length of data after this trace */ | 107 | __u16 pdu_len; /* length of data after this trace */ |
103 | }; | 108 | }; |
104 | 109 | ||
105 | /* | 110 | /* |
@@ -117,6 +122,23 @@ enum { | |||
117 | Blktrace_stopped, | 122 | Blktrace_stopped, |
118 | }; | 123 | }; |
119 | 124 | ||
125 | #define BLKTRACE_BDEV_SIZE 32 | ||
126 | |||
127 | /* | ||
128 | * User setup structure passed with BLKTRACESTART | ||
129 | */ | ||
130 | struct blk_user_trace_setup { | ||
131 | char name[BLKTRACE_BDEV_SIZE]; /* output */ | ||
132 | __u16 act_mask; /* input */ | ||
133 | __u32 buf_size; /* input */ | ||
134 | __u32 buf_nr; /* input */ | ||
135 | __u64 start_lba; | ||
136 | __u64 end_lba; | ||
137 | __u32 pid; | ||
138 | }; | ||
139 | |||
140 | #ifdef __KERNEL__ | ||
141 | #if defined(CONFIG_BLK_DEV_IO_TRACE) | ||
120 | struct blk_trace { | 142 | struct blk_trace { |
121 | int trace_state; | 143 | int trace_state; |
122 | struct rchan *rchan; | 144 | struct rchan *rchan; |
@@ -129,24 +151,10 @@ struct blk_trace { | |||
129 | u32 dev; | 151 | u32 dev; |
130 | struct dentry *dir; | 152 | struct dentry *dir; |
131 | struct dentry *dropped_file; | 153 | struct dentry *dropped_file; |
154 | struct dentry *msg_file; | ||
132 | atomic_t dropped; | 155 | atomic_t dropped; |
133 | }; | 156 | }; |
134 | 157 | ||
135 | /* | ||
136 | * User setup structure passed with BLKTRACESTART | ||
137 | */ | ||
138 | struct blk_user_trace_setup { | ||
139 | char name[BDEVNAME_SIZE]; /* output */ | ||
140 | u16 act_mask; /* input */ | ||
141 | u32 buf_size; /* input */ | ||
142 | u32 buf_nr; /* input */ | ||
143 | u64 start_lba; | ||
144 | u64 end_lba; | ||
145 | u32 pid; | ||
146 | }; | ||
147 | |||
148 | #ifdef __KERNEL__ | ||
149 | #if defined(CONFIG_BLK_DEV_IO_TRACE) | ||
150 | extern int blk_trace_ioctl(struct block_device *, unsigned, char __user *); | 158 | extern int blk_trace_ioctl(struct block_device *, unsigned, char __user *); |
151 | extern void blk_trace_shutdown(struct request_queue *); | 159 | extern void blk_trace_shutdown(struct request_queue *); |
152 | extern void __blk_add_trace(struct blk_trace *, sector_t, int, int, u32, int, int, void *); | 160 | extern void __blk_add_trace(struct blk_trace *, sector_t, int, int, u32, int, int, void *); |
@@ -194,6 +202,9 @@ static inline void blk_add_trace_rq(struct request_queue *q, struct request *rq, | |||
194 | if (likely(!bt)) | 202 | if (likely(!bt)) |
195 | return; | 203 | return; |
196 | 204 | ||
205 | if (blk_discard_rq(rq)) | ||
206 | rw |= (1 << BIO_RW_DISCARD); | ||
207 | |||
197 | if (blk_pc_request(rq)) { | 208 | if (blk_pc_request(rq)) { |
198 | what |= BLK_TC_ACT(BLK_TC_PC); | 209 | what |= BLK_TC_ACT(BLK_TC_PC); |
199 | __blk_add_trace(bt, 0, rq->data_len, rw, what, rq->errors, sizeof(rq->cmd), rq->cmd); | 210 | __blk_add_trace(bt, 0, rq->data_len, rw, what, rq->errors, sizeof(rq->cmd), rq->cmd); |
diff --git a/include/linux/bootmem.h b/include/linux/bootmem.h index 686895bacd9d..95837bfb5256 100644 --- a/include/linux/bootmem.h +++ b/include/linux/bootmem.h | |||
@@ -28,83 +28,85 @@ extern unsigned long saved_max_pfn; | |||
28 | * memory pages (including holes) on the node. | 28 | * memory pages (including holes) on the node. |
29 | */ | 29 | */ |
30 | typedef struct bootmem_data { | 30 | typedef struct bootmem_data { |
31 | unsigned long node_boot_start; | 31 | unsigned long node_min_pfn; |
32 | unsigned long node_low_pfn; | 32 | unsigned long node_low_pfn; |
33 | void *node_bootmem_map; | 33 | void *node_bootmem_map; |
34 | unsigned long last_offset; | 34 | unsigned long last_end_off; |
35 | unsigned long last_pos; | 35 | unsigned long hint_idx; |
36 | unsigned long last_success; /* Previous allocation point. To speed | ||
37 | * up searching */ | ||
38 | struct list_head list; | 36 | struct list_head list; |
39 | } bootmem_data_t; | 37 | } bootmem_data_t; |
40 | 38 | ||
39 | extern bootmem_data_t bootmem_node_data[]; | ||
40 | |||
41 | extern unsigned long bootmem_bootmap_pages(unsigned long); | 41 | extern unsigned long bootmem_bootmap_pages(unsigned long); |
42 | |||
43 | extern unsigned long init_bootmem_node(pg_data_t *pgdat, | ||
44 | unsigned long freepfn, | ||
45 | unsigned long startpfn, | ||
46 | unsigned long endpfn); | ||
42 | extern unsigned long init_bootmem(unsigned long addr, unsigned long memend); | 47 | extern unsigned long init_bootmem(unsigned long addr, unsigned long memend); |
48 | |||
49 | extern unsigned long free_all_bootmem_node(pg_data_t *pgdat); | ||
50 | extern unsigned long free_all_bootmem(void); | ||
51 | |||
52 | extern void free_bootmem_node(pg_data_t *pgdat, | ||
53 | unsigned long addr, | ||
54 | unsigned long size); | ||
43 | extern void free_bootmem(unsigned long addr, unsigned long size); | 55 | extern void free_bootmem(unsigned long addr, unsigned long size); |
44 | extern void *__alloc_bootmem(unsigned long size, | 56 | |
57 | /* | ||
58 | * Flags for reserve_bootmem (also if CONFIG_HAVE_ARCH_BOOTMEM_NODE, | ||
59 | * the architecture-specific code should honor this). | ||
60 | * | ||
61 | * If flags is 0, then the return value is always 0 (success). If | ||
62 | * flags contains BOOTMEM_EXCLUSIVE, then -EBUSY is returned if the | ||
63 | * memory already was reserved. | ||
64 | */ | ||
65 | #define BOOTMEM_DEFAULT 0 | ||
66 | #define BOOTMEM_EXCLUSIVE (1<<0) | ||
67 | |||
68 | extern int reserve_bootmem_node(pg_data_t *pgdat, | ||
69 | unsigned long physaddr, | ||
70 | unsigned long size, | ||
71 | int flags); | ||
72 | #ifndef CONFIG_HAVE_ARCH_BOOTMEM_NODE | ||
73 | extern int reserve_bootmem(unsigned long addr, unsigned long size, int flags); | ||
74 | #endif | ||
75 | |||
76 | extern void *__alloc_bootmem_nopanic(unsigned long size, | ||
45 | unsigned long align, | 77 | unsigned long align, |
46 | unsigned long goal); | 78 | unsigned long goal); |
47 | extern void *__alloc_bootmem_nopanic(unsigned long size, | 79 | extern void *__alloc_bootmem(unsigned long size, |
48 | unsigned long align, | 80 | unsigned long align, |
49 | unsigned long goal); | 81 | unsigned long goal); |
50 | extern void *__alloc_bootmem_low(unsigned long size, | 82 | extern void *__alloc_bootmem_low(unsigned long size, |
51 | unsigned long align, | 83 | unsigned long align, |
52 | unsigned long goal); | 84 | unsigned long goal); |
85 | extern void *__alloc_bootmem_node(pg_data_t *pgdat, | ||
86 | unsigned long size, | ||
87 | unsigned long align, | ||
88 | unsigned long goal); | ||
89 | extern void *__alloc_bootmem_node_nopanic(pg_data_t *pgdat, | ||
90 | unsigned long size, | ||
91 | unsigned long align, | ||
92 | unsigned long goal); | ||
53 | extern void *__alloc_bootmem_low_node(pg_data_t *pgdat, | 93 | extern void *__alloc_bootmem_low_node(pg_data_t *pgdat, |
54 | unsigned long size, | 94 | unsigned long size, |
55 | unsigned long align, | 95 | unsigned long align, |
56 | unsigned long goal); | 96 | unsigned long goal); |
57 | extern void *__alloc_bootmem_core(struct bootmem_data *bdata, | ||
58 | unsigned long size, | ||
59 | unsigned long align, | ||
60 | unsigned long goal, | ||
61 | unsigned long limit); | ||
62 | |||
63 | /* | ||
64 | * flags for reserve_bootmem (also if CONFIG_HAVE_ARCH_BOOTMEM_NODE, | ||
65 | * the architecture-specific code should honor this) | ||
66 | */ | ||
67 | #define BOOTMEM_DEFAULT 0 | ||
68 | #define BOOTMEM_EXCLUSIVE (1<<0) | ||
69 | |||
70 | #ifndef CONFIG_HAVE_ARCH_BOOTMEM_NODE | 97 | #ifndef CONFIG_HAVE_ARCH_BOOTMEM_NODE |
71 | /* | ||
72 | * If flags is 0, then the return value is always 0 (success). If | ||
73 | * flags contains BOOTMEM_EXCLUSIVE, then -EBUSY is returned if the | ||
74 | * memory already was reserved. | ||
75 | */ | ||
76 | extern int reserve_bootmem(unsigned long addr, unsigned long size, int flags); | ||
77 | #define alloc_bootmem(x) \ | 98 | #define alloc_bootmem(x) \ |
78 | __alloc_bootmem(x, SMP_CACHE_BYTES, __pa(MAX_DMA_ADDRESS)) | 99 | __alloc_bootmem(x, SMP_CACHE_BYTES, __pa(MAX_DMA_ADDRESS)) |
100 | #define alloc_bootmem_nopanic(x) \ | ||
101 | __alloc_bootmem_nopanic(x, SMP_CACHE_BYTES, __pa(MAX_DMA_ADDRESS)) | ||
79 | #define alloc_bootmem_low(x) \ | 102 | #define alloc_bootmem_low(x) \ |
80 | __alloc_bootmem_low(x, SMP_CACHE_BYTES, 0) | 103 | __alloc_bootmem_low(x, SMP_CACHE_BYTES, 0) |
81 | #define alloc_bootmem_pages(x) \ | 104 | #define alloc_bootmem_pages(x) \ |
82 | __alloc_bootmem(x, PAGE_SIZE, __pa(MAX_DMA_ADDRESS)) | 105 | __alloc_bootmem(x, PAGE_SIZE, __pa(MAX_DMA_ADDRESS)) |
106 | #define alloc_bootmem_pages_nopanic(x) \ | ||
107 | __alloc_bootmem_nopanic(x, PAGE_SIZE, __pa(MAX_DMA_ADDRESS)) | ||
83 | #define alloc_bootmem_low_pages(x) \ | 108 | #define alloc_bootmem_low_pages(x) \ |
84 | __alloc_bootmem_low(x, PAGE_SIZE, 0) | 109 | __alloc_bootmem_low(x, PAGE_SIZE, 0) |
85 | #endif /* !CONFIG_HAVE_ARCH_BOOTMEM_NODE */ | ||
86 | |||
87 | extern unsigned long free_all_bootmem(void); | ||
88 | extern unsigned long free_all_bootmem_node(pg_data_t *pgdat); | ||
89 | extern void *__alloc_bootmem_node(pg_data_t *pgdat, | ||
90 | unsigned long size, | ||
91 | unsigned long align, | ||
92 | unsigned long goal); | ||
93 | extern unsigned long init_bootmem_node(pg_data_t *pgdat, | ||
94 | unsigned long freepfn, | ||
95 | unsigned long startpfn, | ||
96 | unsigned long endpfn); | ||
97 | extern int reserve_bootmem_node(pg_data_t *pgdat, | ||
98 | unsigned long physaddr, | ||
99 | unsigned long size, | ||
100 | int flags); | ||
101 | extern void free_bootmem_node(pg_data_t *pgdat, | ||
102 | unsigned long addr, | ||
103 | unsigned long size); | ||
104 | extern void *alloc_bootmem_section(unsigned long size, | ||
105 | unsigned long section_nr); | ||
106 | |||
107 | #ifndef CONFIG_HAVE_ARCH_BOOTMEM_NODE | ||
108 | #define alloc_bootmem_node(pgdat, x) \ | 110 | #define alloc_bootmem_node(pgdat, x) \ |
109 | __alloc_bootmem_node(pgdat, x, SMP_CACHE_BYTES, __pa(MAX_DMA_ADDRESS)) | 111 | __alloc_bootmem_node(pgdat, x, SMP_CACHE_BYTES, __pa(MAX_DMA_ADDRESS)) |
110 | #define alloc_bootmem_pages_node(pgdat, x) \ | 112 | #define alloc_bootmem_pages_node(pgdat, x) \ |
@@ -113,6 +115,12 @@ extern void *alloc_bootmem_section(unsigned long size, | |||
113 | __alloc_bootmem_low_node(pgdat, x, PAGE_SIZE, 0) | 115 | __alloc_bootmem_low_node(pgdat, x, PAGE_SIZE, 0) |
114 | #endif /* !CONFIG_HAVE_ARCH_BOOTMEM_NODE */ | 116 | #endif /* !CONFIG_HAVE_ARCH_BOOTMEM_NODE */ |
115 | 117 | ||
118 | extern int reserve_bootmem_generic(unsigned long addr, unsigned long size, | ||
119 | int flags); | ||
120 | |||
121 | extern void *alloc_bootmem_section(unsigned long size, | ||
122 | unsigned long section_nr); | ||
123 | |||
116 | #ifdef CONFIG_HAVE_ARCH_ALLOC_REMAP | 124 | #ifdef CONFIG_HAVE_ARCH_ALLOC_REMAP |
117 | extern void *alloc_remap(int nid, unsigned long size); | 125 | extern void *alloc_remap(int nid, unsigned long size); |
118 | #else | 126 | #else |
diff --git a/include/linux/brcmphy.h b/include/linux/brcmphy.h new file mode 100644 index 000000000000..9b64b6d67873 --- /dev/null +++ b/include/linux/brcmphy.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #define PHY_BRCM_WIRESPEED_ENABLE 0x00000001 | ||
2 | #define PHY_BRCM_AUTO_PWRDWN_ENABLE 0x00000002 | ||
3 | #define PHY_BRCM_APD_CLK125_ENABLE 0x00000004 | ||
4 | #define PHY_BRCM_STD_IBND_DISABLE 0x00000008 | ||
5 | #define PHY_BRCM_EXT_IBND_RX_ENABLE 0x00000010 | ||
6 | #define PHY_BRCM_EXT_IBND_TX_ENABLE 0x00000020 | ||
diff --git a/include/linux/buffer_head.h b/include/linux/buffer_head.h index 82aa36c53ea7..eadaab44015f 100644 --- a/include/linux/buffer_head.h +++ b/include/linux/buffer_head.h | |||
@@ -115,7 +115,6 @@ BUFFER_FNS(Uptodate, uptodate) | |||
115 | BUFFER_FNS(Dirty, dirty) | 115 | BUFFER_FNS(Dirty, dirty) |
116 | TAS_BUFFER_FNS(Dirty, dirty) | 116 | TAS_BUFFER_FNS(Dirty, dirty) |
117 | BUFFER_FNS(Lock, locked) | 117 | BUFFER_FNS(Lock, locked) |
118 | TAS_BUFFER_FNS(Lock, locked) | ||
119 | BUFFER_FNS(Req, req) | 118 | BUFFER_FNS(Req, req) |
120 | TAS_BUFFER_FNS(Req, req) | 119 | TAS_BUFFER_FNS(Req, req) |
121 | BUFFER_FNS(Mapped, mapped) | 120 | BUFFER_FNS(Mapped, mapped) |
@@ -205,6 +204,8 @@ void block_invalidatepage(struct page *page, unsigned long offset); | |||
205 | int block_write_full_page(struct page *page, get_block_t *get_block, | 204 | int block_write_full_page(struct page *page, get_block_t *get_block, |
206 | struct writeback_control *wbc); | 205 | struct writeback_control *wbc); |
207 | int block_read_full_page(struct page*, get_block_t*); | 206 | int block_read_full_page(struct page*, get_block_t*); |
207 | int block_is_partially_uptodate(struct page *page, read_descriptor_t *desc, | ||
208 | unsigned long from); | ||
208 | int block_write_begin(struct file *, struct address_space *, | 209 | int block_write_begin(struct file *, struct address_space *, |
209 | loff_t, unsigned, unsigned, | 210 | loff_t, unsigned, unsigned, |
210 | struct page **, void **, get_block_t*); | 211 | struct page **, void **, get_block_t*); |
@@ -319,10 +320,15 @@ static inline void wait_on_buffer(struct buffer_head *bh) | |||
319 | __wait_on_buffer(bh); | 320 | __wait_on_buffer(bh); |
320 | } | 321 | } |
321 | 322 | ||
323 | static inline int trylock_buffer(struct buffer_head *bh) | ||
324 | { | ||
325 | return likely(!test_and_set_bit(BH_Lock, &bh->b_state)); | ||
326 | } | ||
327 | |||
322 | static inline void lock_buffer(struct buffer_head *bh) | 328 | static inline void lock_buffer(struct buffer_head *bh) |
323 | { | 329 | { |
324 | might_sleep(); | 330 | might_sleep(); |
325 | if (test_set_buffer_locked(bh)) | 331 | if (!trylock_buffer(bh)) |
326 | __lock_buffer(bh); | 332 | __lock_buffer(bh); |
327 | } | 333 | } |
328 | 334 | ||
diff --git a/include/linux/byteorder.h b/include/linux/byteorder.h new file mode 100644 index 000000000000..29f002d73d98 --- /dev/null +++ b/include/linux/byteorder.h | |||
@@ -0,0 +1,372 @@ | |||
1 | #ifndef _LINUX_BYTEORDER_H | ||
2 | #define _LINUX_BYTEORDER_H | ||
3 | |||
4 | #include <linux/types.h> | ||
5 | #include <linux/swab.h> | ||
6 | |||
7 | #if defined(__LITTLE_ENDIAN) && defined(__BIG_ENDIAN) | ||
8 | # error Fix asm/byteorder.h to define one endianness | ||
9 | #endif | ||
10 | |||
11 | #if !defined(__LITTLE_ENDIAN) && !defined(__BIG_ENDIAN) | ||
12 | # error Fix asm/byteorder.h to define arch endianness | ||
13 | #endif | ||
14 | |||
15 | #ifdef __LITTLE_ENDIAN | ||
16 | # undef __LITTLE_ENDIAN | ||
17 | # define __LITTLE_ENDIAN 1234 | ||
18 | #endif | ||
19 | |||
20 | #ifdef __BIG_ENDIAN | ||
21 | # undef __BIG_ENDIAN | ||
22 | # define __BIG_ENDIAN 4321 | ||
23 | #endif | ||
24 | |||
25 | #if defined(__LITTLE_ENDIAN) && !defined(__LITTLE_ENDIAN_BITFIELD) | ||
26 | # define __LITTLE_ENDIAN_BITFIELD | ||
27 | #endif | ||
28 | |||
29 | #if defined(__BIG_ENDIAN) && !defined(__BIG_ENDIAN_BITFIELD) | ||
30 | # define __BIG_ENDIAN_BITFIELD | ||
31 | #endif | ||
32 | |||
33 | #ifdef __LITTLE_ENDIAN | ||
34 | # define __le16_to_cpu(x) ((__force __u16)(__le16)(x)) | ||
35 | # define __le32_to_cpu(x) ((__force __u32)(__le32)(x)) | ||
36 | # define __le64_to_cpu(x) ((__force __u64)(__le64)(x)) | ||
37 | # define __cpu_to_le16(x) ((__force __le16)(__u16)(x)) | ||
38 | # define __cpu_to_le32(x) ((__force __le32)(__u32)(x)) | ||
39 | # define __cpu_to_le64(x) ((__force __le64)(__u64)(x)) | ||
40 | |||
41 | # define __be16_to_cpu(x) __swab16((__force __u16)(__be16)(x)) | ||
42 | # define __be32_to_cpu(x) __swab32((__force __u32)(__be32)(x)) | ||
43 | # define __be64_to_cpu(x) __swab64((__force __u64)(__be64)(x)) | ||
44 | # define __cpu_to_be16(x) ((__force __be16)__swab16(x)) | ||
45 | # define __cpu_to_be32(x) ((__force __be32)__swab32(x)) | ||
46 | # define __cpu_to_be64(x) ((__force __be64)__swab64(x)) | ||
47 | #endif | ||
48 | |||
49 | #ifdef __BIG_ENDIAN | ||
50 | # define __be16_to_cpu(x) ((__force __u16)(__be16)(x)) | ||
51 | # define __be32_to_cpu(x) ((__force __u32)(__be32)(x)) | ||
52 | # define __be64_to_cpu(x) ((__force __u64)(__be64)(x)) | ||
53 | # define __cpu_to_be16(x) ((__force __be16)(__u16)(x)) | ||
54 | # define __cpu_to_be32(x) ((__force __be32)(__u32)(x)) | ||
55 | # define __cpu_to_be64(x) ((__force __be64)(__u64)(x)) | ||
56 | |||
57 | # define __le16_to_cpu(x) __swab16((__force __u16)(__le16)(x)) | ||
58 | # define __le32_to_cpu(x) __swab32((__force __u32)(__le32)(x)) | ||
59 | # define __le64_to_cpu(x) __swab64((__force __u64)(__le64)(x)) | ||
60 | # define __cpu_to_le16(x) ((__force __le16)__swab16(x)) | ||
61 | # define __cpu_to_le32(x) ((__force __le32)__swab32(x)) | ||
62 | # define __cpu_to_le64(x) ((__force __le64)__swab64(x)) | ||
63 | #endif | ||
64 | |||
65 | /* | ||
66 | * These helpers could be phased out over time as the base version | ||
67 | * handles constant folding. | ||
68 | */ | ||
69 | #define __constant_htonl(x) __cpu_to_be32(x) | ||
70 | #define __constant_ntohl(x) __be32_to_cpu(x) | ||
71 | #define __constant_htons(x) __cpu_to_be16(x) | ||
72 | #define __constant_ntohs(x) __be16_to_cpu(x) | ||
73 | |||
74 | #define __constant_le16_to_cpu(x) __le16_to_cpu(x) | ||
75 | #define __constant_le32_to_cpu(x) __le32_to_cpu(x) | ||
76 | #define __constant_le64_to_cpu(x) __le64_to_cpu(x) | ||
77 | #define __constant_be16_to_cpu(x) __be16_to_cpu(x) | ||
78 | #define __constant_be32_to_cpu(x) __be32_to_cpu(x) | ||
79 | #define __constant_be64_to_cpu(x) __be64_to_cpu(x) | ||
80 | |||
81 | #define __constant_cpu_to_le16(x) __cpu_to_le16(x) | ||
82 | #define __constant_cpu_to_le32(x) __cpu_to_le32(x) | ||
83 | #define __constant_cpu_to_le64(x) __cpu_to_le64(x) | ||
84 | #define __constant_cpu_to_be16(x) __cpu_to_be16(x) | ||
85 | #define __constant_cpu_to_be32(x) __cpu_to_be32(x) | ||
86 | #define __constant_cpu_to_be64(x) __cpu_to_be64(x) | ||
87 | |||
88 | static inline void __le16_to_cpus(__u16 *p) | ||
89 | { | ||
90 | #ifdef __BIG_ENDIAN | ||
91 | __swab16s(p); | ||
92 | #endif | ||
93 | } | ||
94 | |||
95 | static inline void __cpu_to_le16s(__u16 *p) | ||
96 | { | ||
97 | #ifdef __BIG_ENDIAN | ||
98 | __swab16s(p); | ||
99 | #endif | ||
100 | } | ||
101 | |||
102 | static inline void __le32_to_cpus(__u32 *p) | ||
103 | { | ||
104 | #ifdef __BIG_ENDIAN | ||
105 | __swab32s(p); | ||
106 | #endif | ||
107 | } | ||
108 | |||
109 | static inline void __cpu_to_le32s(__u32 *p) | ||
110 | { | ||
111 | #ifdef __BIG_ENDIAN | ||
112 | __swab32s(p); | ||
113 | #endif | ||
114 | } | ||
115 | |||
116 | static inline void __le64_to_cpus(__u64 *p) | ||
117 | { | ||
118 | #ifdef __BIG_ENDIAN | ||
119 | __swab64s(p); | ||
120 | #endif | ||
121 | } | ||
122 | |||
123 | static inline void __cpu_to_le64s(__u64 *p) | ||
124 | { | ||
125 | #ifdef __BIG_ENDIAN | ||
126 | __swab64s(p); | ||
127 | #endif | ||
128 | } | ||
129 | |||
130 | static inline void __be16_to_cpus(__u16 *p) | ||
131 | { | ||
132 | #ifdef __LITTLE_ENDIAN | ||
133 | __swab16s(p); | ||
134 | #endif | ||
135 | } | ||
136 | |||
137 | static inline void __cpu_to_be16s(__u16 *p) | ||
138 | { | ||
139 | #ifdef __LITTLE_ENDIAN | ||
140 | __swab16s(p); | ||
141 | #endif | ||
142 | } | ||
143 | |||
144 | static inline void __be32_to_cpus(__u32 *p) | ||
145 | { | ||
146 | #ifdef __LITTLE_ENDIAN | ||
147 | __swab32s(p); | ||
148 | #endif | ||
149 | } | ||
150 | |||
151 | static inline void __cpu_to_be32s(__u32 *p) | ||
152 | { | ||
153 | #ifdef __LITTLE_ENDIAN | ||
154 | __swab32s(p); | ||
155 | #endif | ||
156 | } | ||
157 | |||
158 | static inline void __be64_to_cpus(__u64 *p) | ||
159 | { | ||
160 | #ifdef __LITTLE_ENDIAN | ||
161 | __swab64s(p); | ||
162 | #endif | ||
163 | } | ||
164 | |||
165 | static inline void __cpu_to_be64s(__u64 *p) | ||
166 | { | ||
167 | #ifdef __LITTLE_ENDIAN | ||
168 | __swab64s(p); | ||
169 | #endif | ||
170 | } | ||
171 | |||
172 | static inline __u16 __le16_to_cpup(const __le16 *p) | ||
173 | { | ||
174 | #ifdef __LITTLE_ENDIAN | ||
175 | return (__force __u16)*p; | ||
176 | #else | ||
177 | return __swab16p((__force __u16 *)p); | ||
178 | #endif | ||
179 | } | ||
180 | |||
181 | static inline __u32 __le32_to_cpup(const __le32 *p) | ||
182 | { | ||
183 | #ifdef __LITTLE_ENDIAN | ||
184 | return (__force __u32)*p; | ||
185 | #else | ||
186 | return __swab32p((__force __u32 *)p); | ||
187 | #endif | ||
188 | } | ||
189 | |||
190 | static inline __u64 __le64_to_cpup(const __le64 *p) | ||
191 | { | ||
192 | #ifdef __LITTLE_ENDIAN | ||
193 | return (__force __u64)*p; | ||
194 | #else | ||
195 | return __swab64p((__force __u64 *)p); | ||
196 | #endif | ||
197 | } | ||
198 | |||
199 | static inline __le16 __cpu_to_le16p(const __u16 *p) | ||
200 | { | ||
201 | #ifdef __LITTLE_ENDIAN | ||
202 | return (__force __le16)*p; | ||
203 | #else | ||
204 | return (__force __le16)__swab16p(p); | ||
205 | #endif | ||
206 | } | ||
207 | |||
208 | static inline __le32 __cpu_to_le32p(const __u32 *p) | ||
209 | { | ||
210 | #ifdef __LITTLE_ENDIAN | ||
211 | return (__force __le32)*p; | ||
212 | #else | ||
213 | return (__force __le32)__swab32p(p); | ||
214 | #endif | ||
215 | } | ||
216 | |||
217 | static inline __le64 __cpu_to_le64p(const __u64 *p) | ||
218 | { | ||
219 | #ifdef __LITTLE_ENDIAN | ||
220 | return (__force __le64)*p; | ||
221 | #else | ||
222 | return (__force __le64)__swab64p(p); | ||
223 | #endif | ||
224 | } | ||
225 | |||
226 | static inline __u16 __be16_to_cpup(const __be16 *p) | ||
227 | { | ||
228 | #ifdef __BIG_ENDIAN | ||
229 | return (__force __u16)*p; | ||
230 | #else | ||
231 | return __swab16p((__force __u16 *)p); | ||
232 | #endif | ||
233 | } | ||
234 | |||
235 | static inline __u32 __be32_to_cpup(const __be32 *p) | ||
236 | { | ||
237 | #ifdef __BIG_ENDIAN | ||
238 | return (__force __u32)*p; | ||
239 | #else | ||
240 | return __swab32p((__force __u32 *)p); | ||
241 | #endif | ||
242 | } | ||
243 | |||
244 | static inline __u64 __be64_to_cpup(const __be64 *p) | ||
245 | { | ||
246 | #ifdef __BIG_ENDIAN | ||
247 | return (__force __u64)*p; | ||
248 | #else | ||
249 | return __swab64p((__force __u64 *)p); | ||
250 | #endif | ||
251 | } | ||
252 | |||
253 | static inline __be16 __cpu_to_be16p(const __u16 *p) | ||
254 | { | ||
255 | #ifdef __BIG_ENDIAN | ||
256 | return (__force __be16)*p; | ||
257 | #else | ||
258 | return (__force __be16)__swab16p(p); | ||
259 | #endif | ||
260 | } | ||
261 | |||
262 | static inline __be32 __cpu_to_be32p(const __u32 *p) | ||
263 | { | ||
264 | #ifdef __BIG_ENDIAN | ||
265 | return (__force __be32)*p; | ||
266 | #else | ||
267 | return (__force __be32)__swab32p(p); | ||
268 | #endif | ||
269 | } | ||
270 | |||
271 | static inline __be64 __cpu_to_be64p(const __u64 *p) | ||
272 | { | ||
273 | #ifdef __BIG_ENDIAN | ||
274 | return (__force __be64)*p; | ||
275 | #else | ||
276 | return (__force __be64)__swab64p(p); | ||
277 | #endif | ||
278 | } | ||
279 | |||
280 | #ifdef __KERNEL__ | ||
281 | |||
282 | # define le16_to_cpu __le16_to_cpu | ||
283 | # define le32_to_cpu __le32_to_cpu | ||
284 | # define le64_to_cpu __le64_to_cpu | ||
285 | # define be16_to_cpu __be16_to_cpu | ||
286 | # define be32_to_cpu __be32_to_cpu | ||
287 | # define be64_to_cpu __be64_to_cpu | ||
288 | # define cpu_to_le16 __cpu_to_le16 | ||
289 | # define cpu_to_le32 __cpu_to_le32 | ||
290 | # define cpu_to_le64 __cpu_to_le64 | ||
291 | # define cpu_to_be16 __cpu_to_be16 | ||
292 | # define cpu_to_be32 __cpu_to_be32 | ||
293 | # define cpu_to_be64 __cpu_to_be64 | ||
294 | |||
295 | # define le16_to_cpup __le16_to_cpup | ||
296 | # define le32_to_cpup __le32_to_cpup | ||
297 | # define le64_to_cpup __le64_to_cpup | ||
298 | # define be16_to_cpup __be16_to_cpup | ||
299 | # define be32_to_cpup __be32_to_cpup | ||
300 | # define be64_to_cpup __be64_to_cpup | ||
301 | # define cpu_to_le16p __cpu_to_le16p | ||
302 | # define cpu_to_le32p __cpu_to_le32p | ||
303 | # define cpu_to_le64p __cpu_to_le64p | ||
304 | # define cpu_to_be16p __cpu_to_be16p | ||
305 | # define cpu_to_be32p __cpu_to_be32p | ||
306 | # define cpu_to_be64p __cpu_to_be64p | ||
307 | |||
308 | # define le16_to_cpus __le16_to_cpus | ||
309 | # define le32_to_cpus __le32_to_cpus | ||
310 | # define le64_to_cpus __le64_to_cpus | ||
311 | # define be16_to_cpus __be16_to_cpus | ||
312 | # define be32_to_cpus __be32_to_cpus | ||
313 | # define be64_to_cpus __be64_to_cpus | ||
314 | # define cpu_to_le16s __cpu_to_le16s | ||
315 | # define cpu_to_le32s __cpu_to_le32s | ||
316 | # define cpu_to_le64s __cpu_to_le64s | ||
317 | # define cpu_to_be16s __cpu_to_be16s | ||
318 | # define cpu_to_be32s __cpu_to_be32s | ||
319 | # define cpu_to_be64s __cpu_to_be64s | ||
320 | |||
321 | /* | ||
322 | * They have to be macros in order to do the constant folding | ||
323 | * correctly - if the argument passed into a inline function | ||
324 | * it is no longer constant according to gcc.. | ||
325 | */ | ||
326 | # undef ntohl | ||
327 | # undef ntohs | ||
328 | # undef htonl | ||
329 | # undef htons | ||
330 | |||
331 | # define ___htonl(x) __cpu_to_be32(x) | ||
332 | # define ___htons(x) __cpu_to_be16(x) | ||
333 | # define ___ntohl(x) __be32_to_cpu(x) | ||
334 | # define ___ntohs(x) __be16_to_cpu(x) | ||
335 | |||
336 | # define htonl(x) ___htonl(x) | ||
337 | # define ntohl(x) ___ntohl(x) | ||
338 | # define htons(x) ___htons(x) | ||
339 | # define ntohs(x) ___ntohs(x) | ||
340 | |||
341 | static inline void le16_add_cpu(__le16 *var, u16 val) | ||
342 | { | ||
343 | *var = cpu_to_le16(le16_to_cpup(var) + val); | ||
344 | } | ||
345 | |||
346 | static inline void le32_add_cpu(__le32 *var, u32 val) | ||
347 | { | ||
348 | *var = cpu_to_le32(le32_to_cpup(var) + val); | ||
349 | } | ||
350 | |||
351 | static inline void le64_add_cpu(__le64 *var, u64 val) | ||
352 | { | ||
353 | *var = cpu_to_le64(le64_to_cpup(var) + val); | ||
354 | } | ||
355 | |||
356 | static inline void be16_add_cpu(__be16 *var, u16 val) | ||
357 | { | ||
358 | *var = cpu_to_be16(be16_to_cpup(var) + val); | ||
359 | } | ||
360 | |||
361 | static inline void be32_add_cpu(__be32 *var, u32 val) | ||
362 | { | ||
363 | *var = cpu_to_be32(be32_to_cpup(var) + val); | ||
364 | } | ||
365 | |||
366 | static inline void be64_add_cpu(__be64 *var, u64 val) | ||
367 | { | ||
368 | *var = cpu_to_be64(be64_to_cpup(var) + val); | ||
369 | } | ||
370 | |||
371 | #endif /* __KERNEL__ */ | ||
372 | #endif /* _LINUX_BYTEORDER_H */ | ||
diff --git a/include/linux/byteorder/big_endian.h b/include/linux/byteorder/big_endian.h index 961ed4b48d8e..44f95b92393b 100644 --- a/include/linux/byteorder/big_endian.h +++ b/include/linux/byteorder/big_endian.h | |||
@@ -94,12 +94,12 @@ static inline __u16 __be16_to_cpup(const __be16 *p) | |||
94 | #define __le32_to_cpus(x) __swab32s((x)) | 94 | #define __le32_to_cpus(x) __swab32s((x)) |
95 | #define __cpu_to_le16s(x) __swab16s((x)) | 95 | #define __cpu_to_le16s(x) __swab16s((x)) |
96 | #define __le16_to_cpus(x) __swab16s((x)) | 96 | #define __le16_to_cpus(x) __swab16s((x)) |
97 | #define __cpu_to_be64s(x) do {} while (0) | 97 | #define __cpu_to_be64s(x) do { (void)(x); } while (0) |
98 | #define __be64_to_cpus(x) do {} while (0) | 98 | #define __be64_to_cpus(x) do { (void)(x); } while (0) |
99 | #define __cpu_to_be32s(x) do {} while (0) | 99 | #define __cpu_to_be32s(x) do { (void)(x); } while (0) |
100 | #define __be32_to_cpus(x) do {} while (0) | 100 | #define __be32_to_cpus(x) do { (void)(x); } while (0) |
101 | #define __cpu_to_be16s(x) do {} while (0) | 101 | #define __cpu_to_be16s(x) do { (void)(x); } while (0) |
102 | #define __be16_to_cpus(x) do {} while (0) | 102 | #define __be16_to_cpus(x) do { (void)(x); } while (0) |
103 | 103 | ||
104 | #ifdef __KERNEL__ | 104 | #ifdef __KERNEL__ |
105 | #include <linux/byteorder/generic.h> | 105 | #include <linux/byteorder/generic.h> |
diff --git a/include/linux/byteorder/little_endian.h b/include/linux/byteorder/little_endian.h index 05dc7c35b3b2..4cc170a31762 100644 --- a/include/linux/byteorder/little_endian.h +++ b/include/linux/byteorder/little_endian.h | |||
@@ -88,12 +88,12 @@ static inline __u16 __be16_to_cpup(const __be16 *p) | |||
88 | { | 88 | { |
89 | return __swab16p((__u16 *)p); | 89 | return __swab16p((__u16 *)p); |
90 | } | 90 | } |
91 | #define __cpu_to_le64s(x) do {} while (0) | 91 | #define __cpu_to_le64s(x) do { (void)(x); } while (0) |
92 | #define __le64_to_cpus(x) do {} while (0) | 92 | #define __le64_to_cpus(x) do { (void)(x); } while (0) |
93 | #define __cpu_to_le32s(x) do {} while (0) | 93 | #define __cpu_to_le32s(x) do { (void)(x); } while (0) |
94 | #define __le32_to_cpus(x) do {} while (0) | 94 | #define __le32_to_cpus(x) do { (void)(x); } while (0) |
95 | #define __cpu_to_le16s(x) do {} while (0) | 95 | #define __cpu_to_le16s(x) do { (void)(x); } while (0) |
96 | #define __le16_to_cpus(x) do {} while (0) | 96 | #define __le16_to_cpus(x) do { (void)(x); } while (0) |
97 | #define __cpu_to_be64s(x) __swab64s((x)) | 97 | #define __cpu_to_be64s(x) __swab64s((x)) |
98 | #define __be64_to_cpus(x) __swab64s((x)) | 98 | #define __be64_to_cpus(x) __swab64s((x)) |
99 | #define __cpu_to_be32s(x) __swab32s((x)) | 99 | #define __cpu_to_be32s(x) __swab32s((x)) |
diff --git a/include/linux/capability.h b/include/linux/capability.h index fa830f8de032..9d1fe30b6f6c 100644 --- a/include/linux/capability.h +++ b/include/linux/capability.h | |||
@@ -501,8 +501,21 @@ extern const kernel_cap_t __cap_empty_set; | |||
501 | extern const kernel_cap_t __cap_full_set; | 501 | extern const kernel_cap_t __cap_full_set; |
502 | extern const kernel_cap_t __cap_init_eff_set; | 502 | extern const kernel_cap_t __cap_init_eff_set; |
503 | 503 | ||
504 | int capable(int cap); | 504 | kernel_cap_t cap_set_effective(const kernel_cap_t pE_new); |
505 | int __capable(struct task_struct *t, int cap); | 505 | |
506 | /** | ||
507 | * has_capability - Determine if a task has a superior capability available | ||
508 | * @t: The task in question | ||
509 | * @cap: The capability to be tested for | ||
510 | * | ||
511 | * Return true if the specified task has the given superior capability | ||
512 | * currently in effect, false if not. | ||
513 | * | ||
514 | * Note that this does not set PF_SUPERPRIV on the task. | ||
515 | */ | ||
516 | #define has_capability(t, cap) (security_capable((t), (cap)) == 0) | ||
517 | |||
518 | extern int capable(int cap); | ||
506 | 519 | ||
507 | #endif /* __KERNEL__ */ | 520 | #endif /* __KERNEL__ */ |
508 | 521 | ||
diff --git a/include/linux/cfag12864b.h b/include/linux/cfag12864b.h index 1605dd8aa646..6f9f19d66591 100644 --- a/include/linux/cfag12864b.h +++ b/include/linux/cfag12864b.h | |||
@@ -4,7 +4,7 @@ | |||
4 | * Description: cfag12864b LCD driver header | 4 | * Description: cfag12864b LCD driver header |
5 | * License: GPLv2 | 5 | * License: GPLv2 |
6 | * | 6 | * |
7 | * Author: Copyright (C) Miguel Ojeda Sandonis <maxextreme@gmail.com> | 7 | * Author: Copyright (C) Miguel Ojeda Sandonis |
8 | * Date: 2006-10-12 | 8 | * Date: 2006-10-12 |
9 | * | 9 | * |
10 | * This program is free software; you can redistribute it and/or modify | 10 | * This program is free software; you can redistribute it and/or modify |
diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h index e155aa78d859..c98dd7cb7076 100644 --- a/include/linux/cgroup.h +++ b/include/linux/cgroup.h | |||
@@ -21,11 +21,13 @@ | |||
21 | struct cgroupfs_root; | 21 | struct cgroupfs_root; |
22 | struct cgroup_subsys; | 22 | struct cgroup_subsys; |
23 | struct inode; | 23 | struct inode; |
24 | struct cgroup; | ||
24 | 25 | ||
25 | extern int cgroup_init_early(void); | 26 | extern int cgroup_init_early(void); |
26 | extern int cgroup_init(void); | 27 | extern int cgroup_init(void); |
27 | extern void cgroup_init_smp(void); | 28 | extern void cgroup_init_smp(void); |
28 | extern void cgroup_lock(void); | 29 | extern void cgroup_lock(void); |
30 | extern bool cgroup_lock_live_group(struct cgroup *cgrp); | ||
29 | extern void cgroup_unlock(void); | 31 | extern void cgroup_unlock(void); |
30 | extern void cgroup_fork(struct task_struct *p); | 32 | extern void cgroup_fork(struct task_struct *p); |
31 | extern void cgroup_fork_callbacks(struct task_struct *p); | 33 | extern void cgroup_fork_callbacks(struct task_struct *p); |
@@ -205,50 +207,64 @@ struct cftype { | |||
205 | * subsystem, followed by a period */ | 207 | * subsystem, followed by a period */ |
206 | char name[MAX_CFTYPE_NAME]; | 208 | char name[MAX_CFTYPE_NAME]; |
207 | int private; | 209 | int private; |
208 | int (*open) (struct inode *inode, struct file *file); | 210 | |
209 | ssize_t (*read) (struct cgroup *cgrp, struct cftype *cft, | 211 | /* |
210 | struct file *file, | 212 | * If non-zero, defines the maximum length of string that can |
211 | char __user *buf, size_t nbytes, loff_t *ppos); | 213 | * be passed to write_string; defaults to 64 |
214 | */ | ||
215 | size_t max_write_len; | ||
216 | |||
217 | int (*open)(struct inode *inode, struct file *file); | ||
218 | ssize_t (*read)(struct cgroup *cgrp, struct cftype *cft, | ||
219 | struct file *file, | ||
220 | char __user *buf, size_t nbytes, loff_t *ppos); | ||
212 | /* | 221 | /* |
213 | * read_u64() is a shortcut for the common case of returning a | 222 | * read_u64() is a shortcut for the common case of returning a |
214 | * single integer. Use it in place of read() | 223 | * single integer. Use it in place of read() |
215 | */ | 224 | */ |
216 | u64 (*read_u64) (struct cgroup *cgrp, struct cftype *cft); | 225 | u64 (*read_u64)(struct cgroup *cgrp, struct cftype *cft); |
217 | /* | 226 | /* |
218 | * read_s64() is a signed version of read_u64() | 227 | * read_s64() is a signed version of read_u64() |
219 | */ | 228 | */ |
220 | s64 (*read_s64) (struct cgroup *cgrp, struct cftype *cft); | 229 | s64 (*read_s64)(struct cgroup *cgrp, struct cftype *cft); |
221 | /* | 230 | /* |
222 | * read_map() is used for defining a map of key/value | 231 | * read_map() is used for defining a map of key/value |
223 | * pairs. It should call cb->fill(cb, key, value) for each | 232 | * pairs. It should call cb->fill(cb, key, value) for each |
224 | * entry. The key/value pairs (and their ordering) should not | 233 | * entry. The key/value pairs (and their ordering) should not |
225 | * change between reboots. | 234 | * change between reboots. |
226 | */ | 235 | */ |
227 | int (*read_map) (struct cgroup *cont, struct cftype *cft, | 236 | int (*read_map)(struct cgroup *cont, struct cftype *cft, |
228 | struct cgroup_map_cb *cb); | 237 | struct cgroup_map_cb *cb); |
229 | /* | 238 | /* |
230 | * read_seq_string() is used for outputting a simple sequence | 239 | * read_seq_string() is used for outputting a simple sequence |
231 | * using seqfile. | 240 | * using seqfile. |
232 | */ | 241 | */ |
233 | int (*read_seq_string) (struct cgroup *cont, struct cftype *cft, | 242 | int (*read_seq_string)(struct cgroup *cont, struct cftype *cft, |
234 | struct seq_file *m); | 243 | struct seq_file *m); |
235 | 244 | ||
236 | ssize_t (*write) (struct cgroup *cgrp, struct cftype *cft, | 245 | ssize_t (*write)(struct cgroup *cgrp, struct cftype *cft, |
237 | struct file *file, | 246 | struct file *file, |
238 | const char __user *buf, size_t nbytes, loff_t *ppos); | 247 | const char __user *buf, size_t nbytes, loff_t *ppos); |
239 | 248 | ||
240 | /* | 249 | /* |
241 | * write_u64() is a shortcut for the common case of accepting | 250 | * write_u64() is a shortcut for the common case of accepting |
242 | * a single integer (as parsed by simple_strtoull) from | 251 | * a single integer (as parsed by simple_strtoull) from |
243 | * userspace. Use in place of write(); return 0 or error. | 252 | * userspace. Use in place of write(); return 0 or error. |
244 | */ | 253 | */ |
245 | int (*write_u64) (struct cgroup *cgrp, struct cftype *cft, u64 val); | 254 | int (*write_u64)(struct cgroup *cgrp, struct cftype *cft, u64 val); |
246 | /* | 255 | /* |
247 | * write_s64() is a signed version of write_u64() | 256 | * write_s64() is a signed version of write_u64() |
248 | */ | 257 | */ |
249 | int (*write_s64) (struct cgroup *cgrp, struct cftype *cft, s64 val); | 258 | int (*write_s64)(struct cgroup *cgrp, struct cftype *cft, s64 val); |
250 | 259 | ||
251 | /* | 260 | /* |
261 | * write_string() is passed a nul-terminated kernelspace | ||
262 | * buffer of maximum length determined by max_write_len. | ||
263 | * Returns 0 or -ve error code. | ||
264 | */ | ||
265 | int (*write_string)(struct cgroup *cgrp, struct cftype *cft, | ||
266 | const char *buffer); | ||
267 | /* | ||
252 | * trigger() callback can be used to get some kick from the | 268 | * trigger() callback can be used to get some kick from the |
253 | * userspace, when the actual string written is not important | 269 | * userspace, when the actual string written is not important |
254 | * at all. The private field can be used to determine the | 270 | * at all. The private field can be used to determine the |
@@ -256,7 +272,7 @@ struct cftype { | |||
256 | */ | 272 | */ |
257 | int (*trigger)(struct cgroup *cgrp, unsigned int event); | 273 | int (*trigger)(struct cgroup *cgrp, unsigned int event); |
258 | 274 | ||
259 | int (*release) (struct inode *inode, struct file *file); | 275 | int (*release)(struct inode *inode, struct file *file); |
260 | }; | 276 | }; |
261 | 277 | ||
262 | struct cgroup_scanner { | 278 | struct cgroup_scanner { |
@@ -348,7 +364,8 @@ static inline struct cgroup* task_cgroup(struct task_struct *task, | |||
348 | return task_subsys_state(task, subsys_id)->cgroup; | 364 | return task_subsys_state(task, subsys_id)->cgroup; |
349 | } | 365 | } |
350 | 366 | ||
351 | int cgroup_clone(struct task_struct *tsk, struct cgroup_subsys *ss); | 367 | int cgroup_clone(struct task_struct *tsk, struct cgroup_subsys *ss, |
368 | char *nodename); | ||
352 | 369 | ||
353 | /* A cgroup_iter should be treated as an opaque object */ | 370 | /* A cgroup_iter should be treated as an opaque object */ |
354 | struct cgroup_iter { | 371 | struct cgroup_iter { |
diff --git a/include/linux/clockchips.h b/include/linux/clockchips.h index c33b0dc28e4d..ed3a5d473e52 100644 --- a/include/linux/clockchips.h +++ b/include/linux/clockchips.h | |||
@@ -127,6 +127,8 @@ extern int clockevents_register_notifier(struct notifier_block *nb); | |||
127 | extern int clockevents_program_event(struct clock_event_device *dev, | 127 | extern int clockevents_program_event(struct clock_event_device *dev, |
128 | ktime_t expires, ktime_t now); | 128 | ktime_t expires, ktime_t now); |
129 | 129 | ||
130 | extern void clockevents_handle_noop(struct clock_event_device *dev); | ||
131 | |||
130 | #ifdef CONFIG_GENERIC_CLOCKEVENTS | 132 | #ifdef CONFIG_GENERIC_CLOCKEVENTS |
131 | extern void clockevents_notify(unsigned long reason, void *arg); | 133 | extern void clockevents_notify(unsigned long reason, void *arg); |
132 | #else | 134 | #else |
diff --git a/include/linux/cnt32_to_63.h b/include/linux/cnt32_to_63.h new file mode 100644 index 000000000000..8c0f9505b48c --- /dev/null +++ b/include/linux/cnt32_to_63.h | |||
@@ -0,0 +1,80 @@ | |||
1 | /* | ||
2 | * Extend a 32-bit counter to 63 bits | ||
3 | * | ||
4 | * Author: Nicolas Pitre | ||
5 | * Created: December 3, 2006 | ||
6 | * Copyright: MontaVista Software, Inc. | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License version 2 | ||
10 | * as published by the Free Software Foundation. | ||
11 | */ | ||
12 | |||
13 | #ifndef __LINUX_CNT32_TO_63_H__ | ||
14 | #define __LINUX_CNT32_TO_63_H__ | ||
15 | |||
16 | #include <linux/compiler.h> | ||
17 | #include <linux/types.h> | ||
18 | #include <asm/byteorder.h> | ||
19 | |||
20 | /* this is used only to give gcc a clue about good code generation */ | ||
21 | union cnt32_to_63 { | ||
22 | struct { | ||
23 | #if defined(__LITTLE_ENDIAN) | ||
24 | u32 lo, hi; | ||
25 | #elif defined(__BIG_ENDIAN) | ||
26 | u32 hi, lo; | ||
27 | #endif | ||
28 | }; | ||
29 | u64 val; | ||
30 | }; | ||
31 | |||
32 | |||
33 | /** | ||
34 | * cnt32_to_63 - Expand a 32-bit counter to a 63-bit counter | ||
35 | * @cnt_lo: The low part of the counter | ||
36 | * | ||
37 | * Many hardware clock counters are only 32 bits wide and therefore have | ||
38 | * a relatively short period making wrap-arounds rather frequent. This | ||
39 | * is a problem when implementing sched_clock() for example, where a 64-bit | ||
40 | * non-wrapping monotonic value is expected to be returned. | ||
41 | * | ||
42 | * To overcome that limitation, let's extend a 32-bit counter to 63 bits | ||
43 | * in a completely lock free fashion. Bits 0 to 31 of the clock are provided | ||
44 | * by the hardware while bits 32 to 62 are stored in memory. The top bit in | ||
45 | * memory is used to synchronize with the hardware clock half-period. When | ||
46 | * the top bit of both counters (hardware and in memory) differ then the | ||
47 | * memory is updated with a new value, incrementing it when the hardware | ||
48 | * counter wraps around. | ||
49 | * | ||
50 | * Because a word store in memory is atomic then the incremented value will | ||
51 | * always be in synch with the top bit indicating to any potential concurrent | ||
52 | * reader if the value in memory is up to date or not with regards to the | ||
53 | * needed increment. And any race in updating the value in memory is harmless | ||
54 | * as the same value would simply be stored more than once. | ||
55 | * | ||
56 | * The only restriction for the algorithm to work properly is that this | ||
57 | * code must be executed at least once per each half period of the 32-bit | ||
58 | * counter to properly update the state bit in memory. This is usually not a | ||
59 | * problem in practice, but if it is then a kernel timer could be scheduled | ||
60 | * to manage for this code to be executed often enough. | ||
61 | * | ||
62 | * Note that the top bit (bit 63) in the returned value should be considered | ||
63 | * as garbage. It is not cleared here because callers are likely to use a | ||
64 | * multiplier on the returned value which can get rid of the top bit | ||
65 | * implicitly by making the multiplier even, therefore saving on a runtime | ||
66 | * clear-bit instruction. Otherwise caller must remember to clear the top | ||
67 | * bit explicitly. | ||
68 | */ | ||
69 | #define cnt32_to_63(cnt_lo) \ | ||
70 | ({ \ | ||
71 | static volatile u32 __m_cnt_hi; \ | ||
72 | union cnt32_to_63 __x; \ | ||
73 | __x.hi = __m_cnt_hi; \ | ||
74 | __x.lo = (cnt_lo); \ | ||
75 | if (unlikely((s32)(__x.hi ^ __x.lo) < 0)) \ | ||
76 | __m_cnt_hi = __x.hi = (__x.hi ^ 0x80000000) + (__x.hi >> 31); \ | ||
77 | __x.val; \ | ||
78 | }) | ||
79 | |||
80 | #endif | ||
diff --git a/include/linux/coda.h b/include/linux/coda.h index b5cf0780c51a..96c87693800b 100644 --- a/include/linux/coda.h +++ b/include/linux/coda.h | |||
@@ -199,28 +199,6 @@ typedef u_int32_t vuid_t; | |||
199 | typedef u_int32_t vgid_t; | 199 | typedef u_int32_t vgid_t; |
200 | #endif /*_VUID_T_ */ | 200 | #endif /*_VUID_T_ */ |
201 | 201 | ||
202 | #ifdef CONFIG_CODA_FS_OLD_API | ||
203 | struct CodaFid { | ||
204 | u_int32_t opaque[3]; | ||
205 | }; | ||
206 | |||
207 | static __inline__ ino_t coda_f2i(struct CodaFid *fid) | ||
208 | { | ||
209 | if ( ! fid ) | ||
210 | return 0; | ||
211 | if (fid->opaque[1] == 0xfffffffe || fid->opaque[1] == 0xffffffff) | ||
212 | return ((fid->opaque[0] << 20) | (fid->opaque[2] & 0xfffff)); | ||
213 | else | ||
214 | return (fid->opaque[2] + (fid->opaque[1]<<10) + (fid->opaque[0]<<20)); | ||
215 | } | ||
216 | |||
217 | struct coda_cred { | ||
218 | vuid_t cr_uid, cr_euid, cr_suid, cr_fsuid; /* Real, efftve, set, fs uid*/ | ||
219 | vgid_t cr_groupid, cr_egid, cr_sgid, cr_fsgid; /* same for groups */ | ||
220 | }; | ||
221 | |||
222 | #else /* not defined(CONFIG_CODA_FS_OLD_API) */ | ||
223 | |||
224 | struct CodaFid { | 202 | struct CodaFid { |
225 | u_int32_t opaque[4]; | 203 | u_int32_t opaque[4]; |
226 | }; | 204 | }; |
@@ -228,8 +206,6 @@ struct CodaFid { | |||
228 | #define coda_f2i(fid)\ | 206 | #define coda_f2i(fid)\ |
229 | (fid ? (fid->opaque[3] ^ (fid->opaque[2]<<10) ^ (fid->opaque[1]<<20) ^ fid->opaque[0]) : 0) | 207 | (fid ? (fid->opaque[3] ^ (fid->opaque[2]<<10) ^ (fid->opaque[1]<<20) ^ fid->opaque[0]) : 0) |
230 | 208 | ||
231 | #endif | ||
232 | |||
233 | #ifndef _VENUS_VATTR_T_ | 209 | #ifndef _VENUS_VATTR_T_ |
234 | #define _VENUS_VATTR_T_ | 210 | #define _VENUS_VATTR_T_ |
235 | /* | 211 | /* |
@@ -313,15 +289,7 @@ struct coda_statfs { | |||
313 | 289 | ||
314 | #define CIOC_KERNEL_VERSION _IOWR('c', 10, size_t) | 290 | #define CIOC_KERNEL_VERSION _IOWR('c', 10, size_t) |
315 | 291 | ||
316 | #if 0 | ||
317 | #define CODA_KERNEL_VERSION 0 /* don't care about kernel version number */ | ||
318 | #define CODA_KERNEL_VERSION 1 /* The old venus 4.6 compatible interface */ | ||
319 | #endif | ||
320 | #ifdef CONFIG_CODA_FS_OLD_API | ||
321 | #define CODA_KERNEL_VERSION 2 /* venus_lookup got an extra parameter */ | ||
322 | #else | ||
323 | #define CODA_KERNEL_VERSION 3 /* 128-bit file identifiers */ | 292 | #define CODA_KERNEL_VERSION 3 /* 128-bit file identifiers */ |
324 | #endif | ||
325 | 293 | ||
326 | /* | 294 | /* |
327 | * Venus <-> Coda RPC arguments | 295 | * Venus <-> Coda RPC arguments |
@@ -329,16 +297,9 @@ struct coda_statfs { | |||
329 | struct coda_in_hdr { | 297 | struct coda_in_hdr { |
330 | u_int32_t opcode; | 298 | u_int32_t opcode; |
331 | u_int32_t unique; /* Keep multiple outstanding msgs distinct */ | 299 | u_int32_t unique; /* Keep multiple outstanding msgs distinct */ |
332 | #ifdef CONFIG_CODA_FS_OLD_API | ||
333 | u_int16_t pid; /* Common to all */ | ||
334 | u_int16_t pgid; /* Common to all */ | ||
335 | u_int16_t sid; /* Common to all */ | ||
336 | struct coda_cred cred; /* Common to all */ | ||
337 | #else | ||
338 | pid_t pid; | 300 | pid_t pid; |
339 | pid_t pgid; | 301 | pid_t pgid; |
340 | vuid_t uid; | 302 | vuid_t uid; |
341 | #endif | ||
342 | }; | 303 | }; |
343 | 304 | ||
344 | /* Really important that opcode and unique are 1st two fields! */ | 305 | /* Really important that opcode and unique are 1st two fields! */ |
@@ -613,11 +574,7 @@ struct coda_vget_out { | |||
613 | /* CODA_PURGEUSER is a venus->kernel call */ | 574 | /* CODA_PURGEUSER is a venus->kernel call */ |
614 | struct coda_purgeuser_out { | 575 | struct coda_purgeuser_out { |
615 | struct coda_out_hdr oh; | 576 | struct coda_out_hdr oh; |
616 | #ifdef CONFIG_CODA_FS_OLD_API | ||
617 | struct coda_cred cred; | ||
618 | #else | ||
619 | vuid_t uid; | 577 | vuid_t uid; |
620 | #endif | ||
621 | }; | 578 | }; |
622 | 579 | ||
623 | /* coda_zapfile: */ | 580 | /* coda_zapfile: */ |
diff --git a/include/linux/coda_linux.h b/include/linux/coda_linux.h index 31b75311e2ca..dcc228aa335a 100644 --- a/include/linux/coda_linux.h +++ b/include/linux/coda_linux.h | |||
@@ -37,7 +37,7 @@ extern const struct file_operations coda_ioctl_operations; | |||
37 | /* operations shared over more than one file */ | 37 | /* operations shared over more than one file */ |
38 | int coda_open(struct inode *i, struct file *f); | 38 | int coda_open(struct inode *i, struct file *f); |
39 | int coda_release(struct inode *i, struct file *f); | 39 | int coda_release(struct inode *i, struct file *f); |
40 | int coda_permission(struct inode *inode, int mask, struct nameidata *nd); | 40 | int coda_permission(struct inode *inode, int mask); |
41 | int coda_revalidate_inode(struct dentry *); | 41 | int coda_revalidate_inode(struct dentry *); |
42 | int coda_getattr(struct vfsmount *, struct dentry *, struct kstat *); | 42 | int coda_getattr(struct vfsmount *, struct dentry *, struct kstat *); |
43 | int coda_setattr(struct dentry *, struct iattr *); | 43 | int coda_setattr(struct dentry *, struct iattr *); |
diff --git a/include/linux/compiler.h b/include/linux/compiler.h index c8bd2daf95ec..8322141ee480 100644 --- a/include/linux/compiler.h +++ b/include/linux/compiler.h | |||
@@ -190,7 +190,9 @@ extern void __chk_io_ptr(const volatile void __iomem *); | |||
190 | * ACCESS_ONCE() in different C statements. | 190 | * ACCESS_ONCE() in different C statements. |
191 | * | 191 | * |
192 | * This macro does absolutely -nothing- to prevent the CPU from reordering, | 192 | * This macro does absolutely -nothing- to prevent the CPU from reordering, |
193 | * merging, or refetching absolutely anything at any time. | 193 | * merging, or refetching absolutely anything at any time. Its main intended |
194 | * use is to mediate communication between process-level code and irq/NMI | ||
195 | * handlers, all running on the same CPU. | ||
194 | */ | 196 | */ |
195 | #define ACCESS_ONCE(x) (*(volatile typeof(x) *)&(x)) | 197 | #define ACCESS_ONCE(x) (*(volatile typeof(x) *)&(x)) |
196 | 198 | ||
diff --git a/include/linux/completion.h b/include/linux/completion.h index d2961b66d53d..4a6b604ef7e4 100644 --- a/include/linux/completion.h +++ b/include/linux/completion.h | |||
@@ -10,6 +10,18 @@ | |||
10 | 10 | ||
11 | #include <linux/wait.h> | 11 | #include <linux/wait.h> |
12 | 12 | ||
13 | /** | ||
14 | * struct completion - structure used to maintain state for a "completion" | ||
15 | * | ||
16 | * This is the opaque structure used to maintain the state for a "completion". | ||
17 | * Completions currently use a FIFO to queue threads that have to wait for | ||
18 | * the "completion" event. | ||
19 | * | ||
20 | * See also: complete(), wait_for_completion() (and friends _timeout, | ||
21 | * _interruptible, _interruptible_timeout, and _killable), init_completion(), | ||
22 | * and macros DECLARE_COMPLETION(), DECLARE_COMPLETION_ONSTACK(), and | ||
23 | * INIT_COMPLETION(). | ||
24 | */ | ||
13 | struct completion { | 25 | struct completion { |
14 | unsigned int done; | 26 | unsigned int done; |
15 | wait_queue_head_t wait; | 27 | wait_queue_head_t wait; |
@@ -21,6 +33,14 @@ struct completion { | |||
21 | #define COMPLETION_INITIALIZER_ONSTACK(work) \ | 33 | #define COMPLETION_INITIALIZER_ONSTACK(work) \ |
22 | ({ init_completion(&work); work; }) | 34 | ({ init_completion(&work); work; }) |
23 | 35 | ||
36 | /** | ||
37 | * DECLARE_COMPLETION: - declare and initialize a completion structure | ||
38 | * @work: identifier for the completion structure | ||
39 | * | ||
40 | * This macro declares and initializes a completion structure. Generally used | ||
41 | * for static declarations. You should use the _ONSTACK variant for automatic | ||
42 | * variables. | ||
43 | */ | ||
24 | #define DECLARE_COMPLETION(work) \ | 44 | #define DECLARE_COMPLETION(work) \ |
25 | struct completion work = COMPLETION_INITIALIZER(work) | 45 | struct completion work = COMPLETION_INITIALIZER(work) |
26 | 46 | ||
@@ -29,6 +49,13 @@ struct completion { | |||
29 | * completions - so we use the _ONSTACK() variant for those that | 49 | * completions - so we use the _ONSTACK() variant for those that |
30 | * are on the kernel stack: | 50 | * are on the kernel stack: |
31 | */ | 51 | */ |
52 | /** | ||
53 | * DECLARE_COMPLETION_ONSTACK: - declare and initialize a completion structure | ||
54 | * @work: identifier for the completion structure | ||
55 | * | ||
56 | * This macro declares and initializes a completion structure on the kernel | ||
57 | * stack. | ||
58 | */ | ||
32 | #ifdef CONFIG_LOCKDEP | 59 | #ifdef CONFIG_LOCKDEP |
33 | # define DECLARE_COMPLETION_ONSTACK(work) \ | 60 | # define DECLARE_COMPLETION_ONSTACK(work) \ |
34 | struct completion work = COMPLETION_INITIALIZER_ONSTACK(work) | 61 | struct completion work = COMPLETION_INITIALIZER_ONSTACK(work) |
@@ -36,6 +63,13 @@ struct completion { | |||
36 | # define DECLARE_COMPLETION_ONSTACK(work) DECLARE_COMPLETION(work) | 63 | # define DECLARE_COMPLETION_ONSTACK(work) DECLARE_COMPLETION(work) |
37 | #endif | 64 | #endif |
38 | 65 | ||
66 | /** | ||
67 | * init_completion: - Initialize a dynamically allocated completion | ||
68 | * @x: completion structure that is to be initialized | ||
69 | * | ||
70 | * This inline function will initialize a dynamically created completion | ||
71 | * structure. | ||
72 | */ | ||
39 | static inline void init_completion(struct completion *x) | 73 | static inline void init_completion(struct completion *x) |
40 | { | 74 | { |
41 | x->done = 0; | 75 | x->done = 0; |
@@ -49,10 +83,20 @@ extern unsigned long wait_for_completion_timeout(struct completion *x, | |||
49 | unsigned long timeout); | 83 | unsigned long timeout); |
50 | extern unsigned long wait_for_completion_interruptible_timeout( | 84 | extern unsigned long wait_for_completion_interruptible_timeout( |
51 | struct completion *x, unsigned long timeout); | 85 | struct completion *x, unsigned long timeout); |
86 | extern bool try_wait_for_completion(struct completion *x); | ||
87 | extern bool completion_done(struct completion *x); | ||
52 | 88 | ||
53 | extern void complete(struct completion *); | 89 | extern void complete(struct completion *); |
54 | extern void complete_all(struct completion *); | 90 | extern void complete_all(struct completion *); |
55 | 91 | ||
92 | /** | ||
93 | * INIT_COMPLETION: - reinitialize a completion structure | ||
94 | * @x: completion structure to be reinitialized | ||
95 | * | ||
96 | * This macro should be used to reinitialize a completion structure so it can | ||
97 | * be reused. This is especially important after complete_all() is used. | ||
98 | */ | ||
56 | #define INIT_COMPLETION(x) ((x).done = 0) | 99 | #define INIT_COMPLETION(x) ((x).done = 0) |
57 | 100 | ||
101 | |||
58 | #endif | 102 | #endif |
diff --git a/include/linux/configfs.h b/include/linux/configfs.h index 3ae65b1bf90f..7f627775c947 100644 --- a/include/linux/configfs.h +++ b/include/linux/configfs.h | |||
@@ -40,6 +40,7 @@ | |||
40 | #include <linux/list.h> | 40 | #include <linux/list.h> |
41 | #include <linux/kref.h> | 41 | #include <linux/kref.h> |
42 | #include <linux/mutex.h> | 42 | #include <linux/mutex.h> |
43 | #include <linux/err.h> | ||
43 | 44 | ||
44 | #include <asm/atomic.h> | 45 | #include <asm/atomic.h> |
45 | 46 | ||
@@ -129,8 +130,25 @@ struct configfs_attribute { | |||
129 | /* | 130 | /* |
130 | * Users often need to create attribute structures for their configurable | 131 | * Users often need to create attribute structures for their configurable |
131 | * attributes, containing a configfs_attribute member and function pointers | 132 | * attributes, containing a configfs_attribute member and function pointers |
132 | * for the show() and store() operations on that attribute. They can use | 133 | * for the show() and store() operations on that attribute. If they don't |
133 | * this macro (similar to sysfs' __ATTR) to make defining attributes easier. | 134 | * need anything else on the extended attribute structure, they can use |
135 | * this macro to define it The argument _item is the name of the | ||
136 | * config_item structure. | ||
137 | */ | ||
138 | #define CONFIGFS_ATTR_STRUCT(_item) \ | ||
139 | struct _item##_attribute { \ | ||
140 | struct configfs_attribute attr; \ | ||
141 | ssize_t (*show)(struct _item *, char *); \ | ||
142 | ssize_t (*store)(struct _item *, const char *, size_t); \ | ||
143 | } | ||
144 | |||
145 | /* | ||
146 | * With the extended attribute structure, users can use this macro | ||
147 | * (similar to sysfs' __ATTR) to make defining attributes easier. | ||
148 | * An example: | ||
149 | * #define MYITEM_ATTR(_name, _mode, _show, _store) \ | ||
150 | * struct myitem_attribute childless_attr_##_name = \ | ||
151 | * __CONFIGFS_ATTR(_name, _mode, _show, _store) | ||
134 | */ | 152 | */ |
135 | #define __CONFIGFS_ATTR(_name, _mode, _show, _store) \ | 153 | #define __CONFIGFS_ATTR(_name, _mode, _show, _store) \ |
136 | { \ | 154 | { \ |
@@ -142,13 +160,60 @@ struct configfs_attribute { | |||
142 | .show = _show, \ | 160 | .show = _show, \ |
143 | .store = _store, \ | 161 | .store = _store, \ |
144 | } | 162 | } |
163 | /* Here is a readonly version, only requiring a show() operation */ | ||
164 | #define __CONFIGFS_ATTR_RO(_name, _show) \ | ||
165 | { \ | ||
166 | .attr = { \ | ||
167 | .ca_name = __stringify(_name), \ | ||
168 | .ca_mode = 0444, \ | ||
169 | .ca_owner = THIS_MODULE, \ | ||
170 | }, \ | ||
171 | .show = _show, \ | ||
172 | } | ||
173 | |||
174 | /* | ||
175 | * With these extended attributes, the simple show_attribute() and | ||
176 | * store_attribute() operations need to call the show() and store() of the | ||
177 | * attributes. This is a common pattern, so we provide a macro to define | ||
178 | * them. The argument _item is the name of the config_item structure. | ||
179 | * This macro expects the attributes to be named "struct <name>_attribute" | ||
180 | * and the function to_<name>() to exist; | ||
181 | */ | ||
182 | #define CONFIGFS_ATTR_OPS(_item) \ | ||
183 | static ssize_t _item##_attr_show(struct config_item *item, \ | ||
184 | struct configfs_attribute *attr, \ | ||
185 | char *page) \ | ||
186 | { \ | ||
187 | struct _item *_item = to_##_item(item); \ | ||
188 | struct _item##_attribute *_item##_attr = \ | ||
189 | container_of(attr, struct _item##_attribute, attr); \ | ||
190 | ssize_t ret = 0; \ | ||
191 | \ | ||
192 | if (_item##_attr->show) \ | ||
193 | ret = _item##_attr->show(_item, page); \ | ||
194 | return ret; \ | ||
195 | } \ | ||
196 | static ssize_t _item##_attr_store(struct config_item *item, \ | ||
197 | struct configfs_attribute *attr, \ | ||
198 | const char *page, size_t count) \ | ||
199 | { \ | ||
200 | struct _item *_item = to_##_item(item); \ | ||
201 | struct _item##_attribute *_item##_attr = \ | ||
202 | container_of(attr, struct _item##_attribute, attr); \ | ||
203 | ssize_t ret = -EINVAL; \ | ||
204 | \ | ||
205 | if (_item##_attr->store) \ | ||
206 | ret = _item##_attr->store(_item, page, count); \ | ||
207 | return ret; \ | ||
208 | } | ||
145 | 209 | ||
146 | /* | 210 | /* |
147 | * If allow_link() exists, the item can symlink(2) out to other | 211 | * If allow_link() exists, the item can symlink(2) out to other |
148 | * items. If the item is a group, it may support mkdir(2). | 212 | * items. If the item is a group, it may support mkdir(2). |
149 | * Groups supply one of make_group() and make_item(). If the | 213 | * Groups supply one of make_group() and make_item(). If the |
150 | * group supports make_group(), one can create group children. If it | 214 | * group supports make_group(), one can create group children. If it |
151 | * supports make_item(), one can create config_item children. If it has | 215 | * supports make_item(), one can create config_item children. make_group() |
216 | * and make_item() return ERR_PTR() on errors. If it has | ||
152 | * default_groups on group->default_groups, it has automatically created | 217 | * default_groups on group->default_groups, it has automatically created |
153 | * group children. default_groups may coexist alongsize make_group() or | 218 | * group children. default_groups may coexist alongsize make_group() or |
154 | * make_item(), but if the group wishes to have only default_groups | 219 | * make_item(), but if the group wishes to have only default_groups |
diff --git a/include/linux/connector.h b/include/linux/connector.h index 96a89d3d6727..5c7f9468f753 100644 --- a/include/linux/connector.h +++ b/include/linux/connector.h | |||
@@ -38,8 +38,9 @@ | |||
38 | #define CN_W1_VAL 0x1 | 38 | #define CN_W1_VAL 0x1 |
39 | #define CN_IDX_V86D 0x4 | 39 | #define CN_IDX_V86D 0x4 |
40 | #define CN_VAL_V86D_UVESAFB 0x1 | 40 | #define CN_VAL_V86D_UVESAFB 0x1 |
41 | #define CN_IDX_BB 0x5 /* BlackBoard, from the TSP GPL sampling framework */ | ||
41 | 42 | ||
42 | #define CN_NETLINK_USERS 5 | 43 | #define CN_NETLINK_USERS 6 |
43 | 44 | ||
44 | /* | 45 | /* |
45 | * Maximum connector's message size. | 46 | * Maximum connector's message size. |
diff --git a/include/linux/console.h b/include/linux/console.h index a4f27fbdf549..248e6e3b9b73 100644 --- a/include/linux/console.h +++ b/include/linux/console.h | |||
@@ -108,6 +108,8 @@ struct console { | |||
108 | struct console *next; | 108 | struct console *next; |
109 | }; | 109 | }; |
110 | 110 | ||
111 | extern int console_set_on_cmdline; | ||
112 | |||
111 | extern int add_preferred_console(char *name, int idx, char *options); | 113 | extern int add_preferred_console(char *name, int idx, char *options); |
112 | extern int update_console_cmdline(char *name, int idx, char *name_new, int idx_new, char *options); | 114 | extern int update_console_cmdline(char *name, int idx, char *name_new, int idx_new, char *options); |
113 | extern void register_console(struct console *); | 115 | extern void register_console(struct console *); |
diff --git a/include/linux/console_struct.h b/include/linux/console_struct.h index b03f80a078be..d71f7c0f931b 100644 --- a/include/linux/console_struct.h +++ b/include/linux/console_struct.h | |||
@@ -53,7 +53,6 @@ struct vc_data { | |||
53 | unsigned short vc_hi_font_mask; /* [#] Attribute set for upper 256 chars of font or 0 if not supported */ | 53 | unsigned short vc_hi_font_mask; /* [#] Attribute set for upper 256 chars of font or 0 if not supported */ |
54 | struct console_font vc_font; /* Current VC font set */ | 54 | struct console_font vc_font; /* Current VC font set */ |
55 | unsigned short vc_video_erase_char; /* Background erase character */ | 55 | unsigned short vc_video_erase_char; /* Background erase character */ |
56 | unsigned short vc_scrl_erase_char; /* Erase character for scroll */ | ||
57 | /* VT terminal data */ | 56 | /* VT terminal data */ |
58 | unsigned int vc_state; /* Escape sequence parser state */ | 57 | unsigned int vc_state; /* Escape sequence parser state */ |
59 | unsigned int vc_npar,vc_par[NPAR]; /* Parameters of current escape sequence */ | 58 | unsigned int vc_npar,vc_par[NPAR]; /* Parameters of current escape sequence */ |
diff --git a/include/linux/consolemap.h b/include/linux/consolemap.h index e2bf7e5db39a..c4811da1338b 100644 --- a/include/linux/consolemap.h +++ b/include/linux/consolemap.h | |||
@@ -3,6 +3,9 @@ | |||
3 | * | 3 | * |
4 | * Interface between console.c, selection.c and consolemap.c | 4 | * Interface between console.c, selection.c and consolemap.c |
5 | */ | 5 | */ |
6 | #ifndef __LINUX_CONSOLEMAP_H__ | ||
7 | #define __LINUX_CONSOLEMAP_H__ | ||
8 | |||
6 | #define LAT1_MAP 0 | 9 | #define LAT1_MAP 0 |
7 | #define GRAF_MAP 1 | 10 | #define GRAF_MAP 1 |
8 | #define IBMPC_MAP 2 | 11 | #define IBMPC_MAP 2 |
@@ -10,6 +13,7 @@ | |||
10 | 13 | ||
11 | #include <linux/types.h> | 14 | #include <linux/types.h> |
12 | 15 | ||
16 | #ifdef CONFIG_CONSOLE_TRANSLATIONS | ||
13 | struct vc_data; | 17 | struct vc_data; |
14 | 18 | ||
15 | extern u16 inverse_translate(struct vc_data *conp, int glyph, int use_unicode); | 19 | extern u16 inverse_translate(struct vc_data *conp, int glyph, int use_unicode); |
@@ -18,3 +22,13 @@ extern int conv_uni_to_pc(struct vc_data *conp, long ucs); | |||
18 | extern u32 conv_8bit_to_uni(unsigned char c); | 22 | extern u32 conv_8bit_to_uni(unsigned char c); |
19 | extern int conv_uni_to_8bit(u32 uni); | 23 | extern int conv_uni_to_8bit(u32 uni); |
20 | void console_map_init(void); | 24 | void console_map_init(void); |
25 | #else | ||
26 | #define inverse_translate(conp, glyph, uni) ((uint16_t)glyph) | ||
27 | #define set_translate(m, vc) ((unsigned short *)NULL) | ||
28 | #define conv_uni_to_pc(conp, ucs) ((int) (ucs > 0xff ? -1: ucs)) | ||
29 | #define conv_8bit_to_uni(c) ((uint32_t)(c)) | ||
30 | #define conv_uni_to_8bit(c) ((int) ((c) & 0xff)) | ||
31 | #define console_map_init(c) do { ; } while (0) | ||
32 | #endif /* CONFIG_CONSOLE_TRANSLATIONS */ | ||
33 | |||
34 | #endif /* __LINUX_CONSOLEMAP_H__ */ | ||
diff --git a/include/linux/cpu.h b/include/linux/cpu.h index 7464ba3b4333..c2747ac2ae43 100644 --- a/include/linux/cpu.h +++ b/include/linux/cpu.h | |||
@@ -69,10 +69,12 @@ static inline void unregister_cpu_notifier(struct notifier_block *nb) | |||
69 | #endif | 69 | #endif |
70 | 70 | ||
71 | int cpu_up(unsigned int cpu); | 71 | int cpu_up(unsigned int cpu); |
72 | 72 | void notify_cpu_starting(unsigned int cpu); | |
73 | extern void cpu_hotplug_init(void); | 73 | extern void cpu_hotplug_init(void); |
74 | extern void cpu_maps_update_begin(void); | ||
75 | extern void cpu_maps_update_done(void); | ||
74 | 76 | ||
75 | #else | 77 | #else /* CONFIG_SMP */ |
76 | 78 | ||
77 | static inline int register_cpu_notifier(struct notifier_block *nb) | 79 | static inline int register_cpu_notifier(struct notifier_block *nb) |
78 | { | 80 | { |
@@ -87,10 +89,16 @@ static inline void cpu_hotplug_init(void) | |||
87 | { | 89 | { |
88 | } | 90 | } |
89 | 91 | ||
92 | static inline void cpu_maps_update_begin(void) | ||
93 | { | ||
94 | } | ||
95 | |||
96 | static inline void cpu_maps_update_done(void) | ||
97 | { | ||
98 | } | ||
99 | |||
90 | #endif /* CONFIG_SMP */ | 100 | #endif /* CONFIG_SMP */ |
91 | extern struct sysdev_class cpu_sysdev_class; | 101 | extern struct sysdev_class cpu_sysdev_class; |
92 | extern void cpu_maps_update_begin(void); | ||
93 | extern void cpu_maps_update_done(void); | ||
94 | 102 | ||
95 | #ifdef CONFIG_HOTPLUG_CPU | 103 | #ifdef CONFIG_HOTPLUG_CPU |
96 | /* Stop CPUs going up and down. */ | 104 | /* Stop CPUs going up and down. */ |
diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h index e7e91dbfde0f..1ee608fd7b77 100644 --- a/include/linux/cpufreq.h +++ b/include/linux/cpufreq.h | |||
@@ -4,9 +4,6 @@ | |||
4 | * Copyright (C) 2001 Russell King | 4 | * Copyright (C) 2001 Russell King |
5 | * (C) 2002 - 2003 Dominik Brodowski <linux@brodo.de> | 5 | * (C) 2002 - 2003 Dominik Brodowski <linux@brodo.de> |
6 | * | 6 | * |
7 | * | ||
8 | * $Id: cpufreq.h,v 1.36 2003/01/20 17:31:48 db Exp $ | ||
9 | * | ||
10 | * 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 |
11 | * it under the terms of the GNU General Public License version 2 as | 8 | * it under the terms of the GNU General Public License version 2 as |
12 | * published by the Free Software Foundation. | 9 | * published by the Free Software Foundation. |
@@ -109,6 +106,7 @@ struct cpufreq_policy { | |||
109 | #define CPUFREQ_ADJUST (0) | 106 | #define CPUFREQ_ADJUST (0) |
110 | #define CPUFREQ_INCOMPATIBLE (1) | 107 | #define CPUFREQ_INCOMPATIBLE (1) |
111 | #define CPUFREQ_NOTIFY (2) | 108 | #define CPUFREQ_NOTIFY (2) |
109 | #define CPUFREQ_START (3) | ||
112 | 110 | ||
113 | #define CPUFREQ_SHARED_TYPE_NONE (0) /* None */ | 111 | #define CPUFREQ_SHARED_TYPE_NONE (0) /* None */ |
114 | #define CPUFREQ_SHARED_TYPE_HW (1) /* HW does needed coordination */ | 112 | #define CPUFREQ_SHARED_TYPE_HW (1) /* HW does needed coordination */ |
@@ -189,7 +187,8 @@ extern int __cpufreq_driver_target(struct cpufreq_policy *policy, | |||
189 | unsigned int relation); | 187 | unsigned int relation); |
190 | 188 | ||
191 | 189 | ||
192 | extern int __cpufreq_driver_getavg(struct cpufreq_policy *policy); | 190 | extern int __cpufreq_driver_getavg(struct cpufreq_policy *policy, |
191 | unsigned int cpu); | ||
193 | 192 | ||
194 | int cpufreq_register_governor(struct cpufreq_governor *governor); | 193 | int cpufreq_register_governor(struct cpufreq_governor *governor); |
195 | void cpufreq_unregister_governor(struct cpufreq_governor *governor); | 194 | void cpufreq_unregister_governor(struct cpufreq_governor *governor); |
@@ -228,7 +227,9 @@ struct cpufreq_driver { | |||
228 | unsigned int (*get) (unsigned int cpu); | 227 | unsigned int (*get) (unsigned int cpu); |
229 | 228 | ||
230 | /* optional */ | 229 | /* optional */ |
231 | unsigned int (*getavg) (unsigned int cpu); | 230 | unsigned int (*getavg) (struct cpufreq_policy *policy, |
231 | unsigned int cpu); | ||
232 | |||
232 | int (*exit) (struct cpufreq_policy *policy); | 233 | int (*exit) (struct cpufreq_policy *policy); |
233 | int (*suspend) (struct cpufreq_policy *policy, pm_message_t pmsg); | 234 | int (*suspend) (struct cpufreq_policy *policy, pm_message_t pmsg); |
234 | int (*resume) (struct cpufreq_policy *policy); | 235 | int (*resume) (struct cpufreq_policy *policy); |
diff --git a/include/linux/cpumask.h b/include/linux/cpumask.h index 5df3db58fcc6..d3219d73f8e6 100644 --- a/include/linux/cpumask.h +++ b/include/linux/cpumask.h | |||
@@ -17,6 +17,20 @@ | |||
17 | * For details of cpus_onto(), see bitmap_onto in lib/bitmap.c. | 17 | * For details of cpus_onto(), see bitmap_onto in lib/bitmap.c. |
18 | * For details of cpus_fold(), see bitmap_fold in lib/bitmap.c. | 18 | * For details of cpus_fold(), see bitmap_fold in lib/bitmap.c. |
19 | * | 19 | * |
20 | * . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . | ||
21 | * Note: The alternate operations with the suffix "_nr" are used | ||
22 | * to limit the range of the loop to nr_cpu_ids instead of | ||
23 | * NR_CPUS when NR_CPUS > 64 for performance reasons. | ||
24 | * If NR_CPUS is <= 64 then most assembler bitmask | ||
25 | * operators execute faster with a constant range, so | ||
26 | * the operator will continue to use NR_CPUS. | ||
27 | * | ||
28 | * Another consideration is that nr_cpu_ids is initialized | ||
29 | * to NR_CPUS and isn't lowered until the possible cpus are | ||
30 | * discovered (including any disabled cpus). So early uses | ||
31 | * will span the entire range of NR_CPUS. | ||
32 | * . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . | ||
33 | * | ||
20 | * The available cpumask operations are: | 34 | * The available cpumask operations are: |
21 | * | 35 | * |
22 | * void cpu_set(cpu, mask) turn on bit 'cpu' in mask | 36 | * void cpu_set(cpu, mask) turn on bit 'cpu' in mask |
@@ -38,18 +52,52 @@ | |||
38 | * int cpus_empty(mask) Is mask empty (no bits sets)? | 52 | * int cpus_empty(mask) Is mask empty (no bits sets)? |
39 | * int cpus_full(mask) Is mask full (all bits sets)? | 53 | * int cpus_full(mask) Is mask full (all bits sets)? |
40 | * int cpus_weight(mask) Hamming weigh - number of set bits | 54 | * int cpus_weight(mask) Hamming weigh - number of set bits |
55 | * int cpus_weight_nr(mask) Same using nr_cpu_ids instead of NR_CPUS | ||
41 | * | 56 | * |
42 | * void cpus_shift_right(dst, src, n) Shift right | 57 | * void cpus_shift_right(dst, src, n) Shift right |
43 | * void cpus_shift_left(dst, src, n) Shift left | 58 | * void cpus_shift_left(dst, src, n) Shift left |
44 | * | 59 | * |
45 | * int first_cpu(mask) Number lowest set bit, or NR_CPUS | 60 | * int first_cpu(mask) Number lowest set bit, or NR_CPUS |
46 | * int next_cpu(cpu, mask) Next cpu past 'cpu', or NR_CPUS | 61 | * int next_cpu(cpu, mask) Next cpu past 'cpu', or NR_CPUS |
62 | * int next_cpu_nr(cpu, mask) Next cpu past 'cpu', or nr_cpu_ids | ||
47 | * | 63 | * |
48 | * cpumask_t cpumask_of_cpu(cpu) Return cpumask with bit 'cpu' set | 64 | * cpumask_t cpumask_of_cpu(cpu) Return cpumask with bit 'cpu' set |
65 | * (can be used as an lvalue) | ||
49 | * CPU_MASK_ALL Initializer - all bits set | 66 | * CPU_MASK_ALL Initializer - all bits set |
50 | * CPU_MASK_NONE Initializer - no bits set | 67 | * CPU_MASK_NONE Initializer - no bits set |
51 | * unsigned long *cpus_addr(mask) Array of unsigned long's in mask | 68 | * unsigned long *cpus_addr(mask) Array of unsigned long's in mask |
52 | * | 69 | * |
70 | * CPUMASK_ALLOC kmalloc's a structure that is a composite of many cpumask_t | ||
71 | * variables, and CPUMASK_PTR provides pointers to each field. | ||
72 | * | ||
73 | * The structure should be defined something like this: | ||
74 | * struct my_cpumasks { | ||
75 | * cpumask_t mask1; | ||
76 | * cpumask_t mask2; | ||
77 | * }; | ||
78 | * | ||
79 | * Usage is then: | ||
80 | * CPUMASK_ALLOC(my_cpumasks); | ||
81 | * CPUMASK_PTR(mask1, my_cpumasks); | ||
82 | * CPUMASK_PTR(mask2, my_cpumasks); | ||
83 | * | ||
84 | * --- DO NOT reference cpumask_t pointers until this check --- | ||
85 | * if (my_cpumasks == NULL) | ||
86 | * "kmalloc failed"... | ||
87 | * | ||
88 | * References are now pointers to the cpumask_t variables (*mask1, ...) | ||
89 | * | ||
90 | *if NR_CPUS > BITS_PER_LONG | ||
91 | * CPUMASK_ALLOC(m) Declares and allocates struct m *m = | ||
92 | * kmalloc(sizeof(*m), GFP_KERNEL) | ||
93 | * CPUMASK_FREE(m) Macro for kfree(m) | ||
94 | *else | ||
95 | * CPUMASK_ALLOC(m) Declares struct m _m, *m = &_m | ||
96 | * CPUMASK_FREE(m) Nop | ||
97 | *endif | ||
98 | * CPUMASK_PTR(v, m) Declares cpumask_t *v = &(m->v) | ||
99 | * ------------------------------------------------------------------------ | ||
100 | * | ||
53 | * int cpumask_scnprintf(buf, len, mask) Format cpumask for printing | 101 | * int cpumask_scnprintf(buf, len, mask) Format cpumask for printing |
54 | * int cpumask_parse_user(ubuf, ulen, mask) Parse ascii string as cpumask | 102 | * int cpumask_parse_user(ubuf, ulen, mask) Parse ascii string as cpumask |
55 | * int cpulist_scnprintf(buf, len, mask) Format cpumask as list for printing | 103 | * int cpulist_scnprintf(buf, len, mask) Format cpumask as list for printing |
@@ -59,7 +107,8 @@ | |||
59 | * void cpus_onto(dst, orig, relmap) *dst = orig relative to relmap | 107 | * void cpus_onto(dst, orig, relmap) *dst = orig relative to relmap |
60 | * void cpus_fold(dst, orig, sz) dst bits = orig bits mod sz | 108 | * void cpus_fold(dst, orig, sz) dst bits = orig bits mod sz |
61 | * | 109 | * |
62 | * for_each_cpu_mask(cpu, mask) for-loop cpu over mask | 110 | * for_each_cpu_mask(cpu, mask) for-loop cpu over mask using NR_CPUS |
111 | * for_each_cpu_mask_nr(cpu, mask) for-loop cpu over mask using nr_cpu_ids | ||
63 | * | 112 | * |
64 | * int num_online_cpus() Number of online CPUs | 113 | * int num_online_cpus() Number of online CPUs |
65 | * int num_possible_cpus() Number of all possible CPUs | 114 | * int num_possible_cpus() Number of all possible CPUs |
@@ -216,33 +265,30 @@ static inline void __cpus_shift_left(cpumask_t *dstp, | |||
216 | bitmap_shift_left(dstp->bits, srcp->bits, n, nbits); | 265 | bitmap_shift_left(dstp->bits, srcp->bits, n, nbits); |
217 | } | 266 | } |
218 | 267 | ||
219 | #ifdef CONFIG_SMP | 268 | /* |
220 | int __first_cpu(const cpumask_t *srcp); | 269 | * Special-case data structure for "single bit set only" constant CPU masks. |
221 | #define first_cpu(src) __first_cpu(&(src)) | 270 | * |
222 | int __next_cpu(int n, const cpumask_t *srcp); | 271 | * We pre-generate all the 64 (or 32) possible bit positions, with enough |
223 | #define next_cpu(n, src) __next_cpu((n), &(src)) | 272 | * padding to the left and the right, and return the constant pointer |
224 | #else | 273 | * appropriately offset. |
225 | #define first_cpu(src) ({ (void)(src); 0; }) | 274 | */ |
226 | #define next_cpu(n, src) ({ (void)(src); 1; }) | 275 | extern const unsigned long |
227 | #endif | 276 | cpu_bit_bitmap[BITS_PER_LONG+1][BITS_TO_LONGS(NR_CPUS)]; |
228 | 277 | ||
229 | #ifdef CONFIG_HAVE_CPUMASK_OF_CPU_MAP | 278 | static inline const cpumask_t *get_cpu_mask(unsigned int cpu) |
230 | extern cpumask_t *cpumask_of_cpu_map; | 279 | { |
231 | #define cpumask_of_cpu(cpu) (cpumask_of_cpu_map[cpu]) | 280 | const unsigned long *p = cpu_bit_bitmap[1 + cpu % BITS_PER_LONG]; |
281 | p -= cpu / BITS_PER_LONG; | ||
282 | return (const cpumask_t *)p; | ||
283 | } | ||
284 | |||
285 | /* | ||
286 | * In cases where we take the address of the cpumask immediately, | ||
287 | * gcc optimizes it out (it's a constant) and there's no huge stack | ||
288 | * variable created: | ||
289 | */ | ||
290 | #define cpumask_of_cpu(cpu) (*get_cpu_mask(cpu)) | ||
232 | 291 | ||
233 | #else | ||
234 | #define cpumask_of_cpu(cpu) \ | ||
235 | (*({ \ | ||
236 | typeof(_unused_cpumask_arg_) m; \ | ||
237 | if (sizeof(m) == sizeof(unsigned long)) { \ | ||
238 | m.bits[0] = 1UL<<(cpu); \ | ||
239 | } else { \ | ||
240 | cpus_clear(m); \ | ||
241 | cpu_set((cpu), m); \ | ||
242 | } \ | ||
243 | &m; \ | ||
244 | })) | ||
245 | #endif | ||
246 | 292 | ||
247 | #define CPU_MASK_LAST_WORD BITMAP_LAST_WORD_MASK(NR_CPUS) | 293 | #define CPU_MASK_LAST_WORD BITMAP_LAST_WORD_MASK(NR_CPUS) |
248 | 294 | ||
@@ -281,6 +327,15 @@ extern cpumask_t cpu_mask_all; | |||
281 | 327 | ||
282 | #define cpus_addr(src) ((src).bits) | 328 | #define cpus_addr(src) ((src).bits) |
283 | 329 | ||
330 | #if NR_CPUS > BITS_PER_LONG | ||
331 | #define CPUMASK_ALLOC(m) struct m *m = kmalloc(sizeof(*m), GFP_KERNEL) | ||
332 | #define CPUMASK_FREE(m) kfree(m) | ||
333 | #else | ||
334 | #define CPUMASK_ALLOC(m) struct m _m, *m = &_m | ||
335 | #define CPUMASK_FREE(m) | ||
336 | #endif | ||
337 | #define CPUMASK_PTR(v, m) cpumask_t *v = &(m->v) | ||
338 | |||
284 | #define cpumask_scnprintf(buf, len, src) \ | 339 | #define cpumask_scnprintf(buf, len, src) \ |
285 | __cpumask_scnprintf((buf), (len), &(src), NR_CPUS) | 340 | __cpumask_scnprintf((buf), (len), &(src), NR_CPUS) |
286 | static inline int __cpumask_scnprintf(char *buf, int len, | 341 | static inline int __cpumask_scnprintf(char *buf, int len, |
@@ -343,25 +398,59 @@ static inline void __cpus_fold(cpumask_t *dstp, const cpumask_t *origp, | |||
343 | bitmap_fold(dstp->bits, origp->bits, sz, nbits); | 398 | bitmap_fold(dstp->bits, origp->bits, sz, nbits); |
344 | } | 399 | } |
345 | 400 | ||
346 | #if NR_CPUS > 1 | 401 | #if NR_CPUS == 1 |
347 | #define for_each_cpu_mask(cpu, mask) \ | 402 | |
348 | for ((cpu) = first_cpu(mask); \ | 403 | #define nr_cpu_ids 1 |
349 | (cpu) < NR_CPUS; \ | 404 | #define first_cpu(src) ({ (void)(src); 0; }) |
350 | (cpu) = next_cpu((cpu), (mask))) | 405 | #define next_cpu(n, src) ({ (void)(src); 1; }) |
351 | #else /* NR_CPUS == 1 */ | 406 | #define any_online_cpu(mask) 0 |
352 | #define for_each_cpu_mask(cpu, mask) \ | 407 | #define for_each_cpu_mask(cpu, mask) \ |
353 | for ((cpu) = 0; (cpu) < 1; (cpu)++, (void)mask) | 408 | for ((cpu) = 0; (cpu) < 1; (cpu)++, (void)mask) |
354 | #endif /* NR_CPUS */ | 409 | |
410 | #else /* NR_CPUS > 1 */ | ||
411 | |||
412 | extern int nr_cpu_ids; | ||
413 | int __first_cpu(const cpumask_t *srcp); | ||
414 | int __next_cpu(int n, const cpumask_t *srcp); | ||
415 | int __any_online_cpu(const cpumask_t *mask); | ||
416 | |||
417 | #define first_cpu(src) __first_cpu(&(src)) | ||
418 | #define next_cpu(n, src) __next_cpu((n), &(src)) | ||
419 | #define any_online_cpu(mask) __any_online_cpu(&(mask)) | ||
420 | #define for_each_cpu_mask(cpu, mask) \ | ||
421 | for ((cpu) = -1; \ | ||
422 | (cpu) = next_cpu((cpu), (mask)), \ | ||
423 | (cpu) < NR_CPUS; ) | ||
424 | #endif | ||
425 | |||
426 | #if NR_CPUS <= 64 | ||
427 | |||
428 | #define next_cpu_nr(n, src) next_cpu(n, src) | ||
429 | #define cpus_weight_nr(cpumask) cpus_weight(cpumask) | ||
430 | #define for_each_cpu_mask_nr(cpu, mask) for_each_cpu_mask(cpu, mask) | ||
431 | |||
432 | #else /* NR_CPUS > 64 */ | ||
433 | |||
434 | int __next_cpu_nr(int n, const cpumask_t *srcp); | ||
435 | #define next_cpu_nr(n, src) __next_cpu_nr((n), &(src)) | ||
436 | #define cpus_weight_nr(cpumask) __cpus_weight(&(cpumask), nr_cpu_ids) | ||
437 | #define for_each_cpu_mask_nr(cpu, mask) \ | ||
438 | for ((cpu) = -1; \ | ||
439 | (cpu) = next_cpu_nr((cpu), (mask)), \ | ||
440 | (cpu) < nr_cpu_ids; ) | ||
441 | |||
442 | #endif /* NR_CPUS > 64 */ | ||
355 | 443 | ||
356 | /* | 444 | /* |
357 | * The following particular system cpumasks and operations manage | 445 | * The following particular system cpumasks and operations manage |
358 | * possible, present and online cpus. Each of them is a fixed size | 446 | * possible, present, active and online cpus. Each of them is a fixed size |
359 | * bitmap of size NR_CPUS. | 447 | * bitmap of size NR_CPUS. |
360 | * | 448 | * |
361 | * #ifdef CONFIG_HOTPLUG_CPU | 449 | * #ifdef CONFIG_HOTPLUG_CPU |
362 | * cpu_possible_map - has bit 'cpu' set iff cpu is populatable | 450 | * cpu_possible_map - has bit 'cpu' set iff cpu is populatable |
363 | * cpu_present_map - has bit 'cpu' set iff cpu is populated | 451 | * cpu_present_map - has bit 'cpu' set iff cpu is populated |
364 | * cpu_online_map - has bit 'cpu' set iff cpu available to scheduler | 452 | * cpu_online_map - has bit 'cpu' set iff cpu available to scheduler |
453 | * cpu_active_map - has bit 'cpu' set iff cpu available to migration | ||
365 | * #else | 454 | * #else |
366 | * cpu_possible_map - has bit 'cpu' set iff cpu is populated | 455 | * cpu_possible_map - has bit 'cpu' set iff cpu is populated |
367 | * cpu_present_map - copy of cpu_possible_map | 456 | * cpu_present_map - copy of cpu_possible_map |
@@ -412,14 +501,16 @@ static inline void __cpus_fold(cpumask_t *dstp, const cpumask_t *origp, | |||
412 | extern cpumask_t cpu_possible_map; | 501 | extern cpumask_t cpu_possible_map; |
413 | extern cpumask_t cpu_online_map; | 502 | extern cpumask_t cpu_online_map; |
414 | extern cpumask_t cpu_present_map; | 503 | extern cpumask_t cpu_present_map; |
504 | extern cpumask_t cpu_active_map; | ||
415 | 505 | ||
416 | #if NR_CPUS > 1 | 506 | #if NR_CPUS > 1 |
417 | #define num_online_cpus() cpus_weight(cpu_online_map) | 507 | #define num_online_cpus() cpus_weight_nr(cpu_online_map) |
418 | #define num_possible_cpus() cpus_weight(cpu_possible_map) | 508 | #define num_possible_cpus() cpus_weight_nr(cpu_possible_map) |
419 | #define num_present_cpus() cpus_weight(cpu_present_map) | 509 | #define num_present_cpus() cpus_weight_nr(cpu_present_map) |
420 | #define cpu_online(cpu) cpu_isset((cpu), cpu_online_map) | 510 | #define cpu_online(cpu) cpu_isset((cpu), cpu_online_map) |
421 | #define cpu_possible(cpu) cpu_isset((cpu), cpu_possible_map) | 511 | #define cpu_possible(cpu) cpu_isset((cpu), cpu_possible_map) |
422 | #define cpu_present(cpu) cpu_isset((cpu), cpu_present_map) | 512 | #define cpu_present(cpu) cpu_isset((cpu), cpu_present_map) |
513 | #define cpu_active(cpu) cpu_isset((cpu), cpu_active_map) | ||
423 | #else | 514 | #else |
424 | #define num_online_cpus() 1 | 515 | #define num_online_cpus() 1 |
425 | #define num_possible_cpus() 1 | 516 | #define num_possible_cpus() 1 |
@@ -427,21 +518,13 @@ extern cpumask_t cpu_present_map; | |||
427 | #define cpu_online(cpu) ((cpu) == 0) | 518 | #define cpu_online(cpu) ((cpu) == 0) |
428 | #define cpu_possible(cpu) ((cpu) == 0) | 519 | #define cpu_possible(cpu) ((cpu) == 0) |
429 | #define cpu_present(cpu) ((cpu) == 0) | 520 | #define cpu_present(cpu) ((cpu) == 0) |
521 | #define cpu_active(cpu) ((cpu) == 0) | ||
430 | #endif | 522 | #endif |
431 | 523 | ||
432 | #define cpu_is_offline(cpu) unlikely(!cpu_online(cpu)) | 524 | #define cpu_is_offline(cpu) unlikely(!cpu_online(cpu)) |
433 | 525 | ||
434 | #ifdef CONFIG_SMP | 526 | #define for_each_possible_cpu(cpu) for_each_cpu_mask_nr((cpu), cpu_possible_map) |
435 | extern int nr_cpu_ids; | 527 | #define for_each_online_cpu(cpu) for_each_cpu_mask_nr((cpu), cpu_online_map) |
436 | #define any_online_cpu(mask) __any_online_cpu(&(mask)) | 528 | #define for_each_present_cpu(cpu) for_each_cpu_mask_nr((cpu), cpu_present_map) |
437 | int __any_online_cpu(const cpumask_t *mask); | ||
438 | #else | ||
439 | #define nr_cpu_ids 1 | ||
440 | #define any_online_cpu(mask) 0 | ||
441 | #endif | ||
442 | |||
443 | #define for_each_possible_cpu(cpu) for_each_cpu_mask((cpu), cpu_possible_map) | ||
444 | #define for_each_online_cpu(cpu) for_each_cpu_mask((cpu), cpu_online_map) | ||
445 | #define for_each_present_cpu(cpu) for_each_cpu_mask((cpu), cpu_present_map) | ||
446 | 529 | ||
447 | #endif /* __LINUX_CPUMASK_H */ | 530 | #endif /* __LINUX_CPUMASK_H */ |
diff --git a/include/linux/cpuset.h b/include/linux/cpuset.h index 038578362b47..2691926fb506 100644 --- a/include/linux/cpuset.h +++ b/include/linux/cpuset.h | |||
@@ -78,6 +78,8 @@ extern void cpuset_track_online_nodes(void); | |||
78 | 78 | ||
79 | extern int current_cpuset_is_being_rebound(void); | 79 | extern int current_cpuset_is_being_rebound(void); |
80 | 80 | ||
81 | extern void rebuild_sched_domains(void); | ||
82 | |||
81 | #else /* !CONFIG_CPUSETS */ | 83 | #else /* !CONFIG_CPUSETS */ |
82 | 84 | ||
83 | static inline int cpuset_init_early(void) { return 0; } | 85 | static inline int cpuset_init_early(void) { return 0; } |
@@ -156,6 +158,11 @@ static inline int current_cpuset_is_being_rebound(void) | |||
156 | return 0; | 158 | return 0; |
157 | } | 159 | } |
158 | 160 | ||
161 | static inline void rebuild_sched_domains(void) | ||
162 | { | ||
163 | partition_sched_domains(1, NULL, NULL); | ||
164 | } | ||
165 | |||
159 | #endif /* !CONFIG_CPUSETS */ | 166 | #endif /* !CONFIG_CPUSETS */ |
160 | 167 | ||
161 | #endif /* _LINUX_CPUSET_H */ | 168 | #endif /* _LINUX_CPUSET_H */ |
diff --git a/include/linux/crash_dump.h b/include/linux/crash_dump.h index 22c7ac5cd80c..025e4f575103 100644 --- a/include/linux/crash_dump.h +++ b/include/linux/crash_dump.h | |||
@@ -8,7 +8,13 @@ | |||
8 | #include <linux/proc_fs.h> | 8 | #include <linux/proc_fs.h> |
9 | 9 | ||
10 | #define ELFCORE_ADDR_MAX (-1ULL) | 10 | #define ELFCORE_ADDR_MAX (-1ULL) |
11 | |||
12 | #ifdef CONFIG_PROC_VMCORE | ||
11 | extern unsigned long long elfcorehdr_addr; | 13 | extern unsigned long long elfcorehdr_addr; |
14 | #else | ||
15 | static const unsigned long long elfcorehdr_addr = ELFCORE_ADDR_MAX; | ||
16 | #endif | ||
17 | |||
12 | extern ssize_t copy_oldmem_page(unsigned long, char *, size_t, | 18 | extern ssize_t copy_oldmem_page(unsigned long, char *, size_t, |
13 | unsigned long, int); | 19 | unsigned long, int); |
14 | extern const struct file_operations proc_vmcore_operations; | 20 | extern const struct file_operations proc_vmcore_operations; |
@@ -22,5 +28,13 @@ extern struct proc_dir_entry *proc_vmcore; | |||
22 | 28 | ||
23 | #define vmcore_elf_check_arch(x) (elf_check_arch(x) || vmcore_elf_check_arch_cross(x)) | 29 | #define vmcore_elf_check_arch(x) (elf_check_arch(x) || vmcore_elf_check_arch_cross(x)) |
24 | 30 | ||
31 | static inline int is_kdump_kernel(void) | ||
32 | { | ||
33 | return (elfcorehdr_addr != ELFCORE_ADDR_MAX) ? 1 : 0; | ||
34 | } | ||
35 | #else /* !CONFIG_CRASH_DUMP */ | ||
36 | static inline int is_kdump_kernel(void) { return 0; } | ||
25 | #endif /* CONFIG_CRASH_DUMP */ | 37 | #endif /* CONFIG_CRASH_DUMP */ |
38 | |||
39 | extern unsigned long saved_max_pfn; | ||
26 | #endif /* LINUX_CRASHDUMP_H */ | 40 | #endif /* LINUX_CRASHDUMP_H */ |
diff --git a/include/linux/crc-t10dif.h b/include/linux/crc-t10dif.h new file mode 100644 index 000000000000..a9c96d865ee7 --- /dev/null +++ b/include/linux/crc-t10dif.h | |||
@@ -0,0 +1,8 @@ | |||
1 | #ifndef _LINUX_CRC_T10DIF_H | ||
2 | #define _LINUX_CRC_T10DIF_H | ||
3 | |||
4 | #include <linux/types.h> | ||
5 | |||
6 | __u16 crc_t10dif(unsigned char const *, size_t); | ||
7 | |||
8 | #endif | ||
diff --git a/include/linux/cred.h b/include/linux/cred.h new file mode 100644 index 000000000000..b69222cc1fd2 --- /dev/null +++ b/include/linux/cred.h | |||
@@ -0,0 +1,50 @@ | |||
1 | /* Credentials management | ||
2 | * | ||
3 | * Copyright (C) 2008 Red Hat, Inc. All Rights Reserved. | ||
4 | * Written by David Howells (dhowells@redhat.com) | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or | ||
7 | * modify it under the terms of the GNU General Public Licence | ||
8 | * as published by the Free Software Foundation; either version | ||
9 | * 2 of the Licence, or (at your option) any later version. | ||
10 | */ | ||
11 | |||
12 | #ifndef _LINUX_CRED_H | ||
13 | #define _LINUX_CRED_H | ||
14 | |||
15 | #define get_current_user() (get_uid(current->user)) | ||
16 | |||
17 | #define task_uid(task) ((task)->uid) | ||
18 | #define task_gid(task) ((task)->gid) | ||
19 | #define task_euid(task) ((task)->euid) | ||
20 | #define task_egid(task) ((task)->egid) | ||
21 | |||
22 | #define current_uid() (current->uid) | ||
23 | #define current_gid() (current->gid) | ||
24 | #define current_euid() (current->euid) | ||
25 | #define current_egid() (current->egid) | ||
26 | #define current_suid() (current->suid) | ||
27 | #define current_sgid() (current->sgid) | ||
28 | #define current_fsuid() (current->fsuid) | ||
29 | #define current_fsgid() (current->fsgid) | ||
30 | #define current_cap() (current->cap_effective) | ||
31 | |||
32 | #define current_uid_gid(_uid, _gid) \ | ||
33 | do { \ | ||
34 | *(_uid) = current->uid; \ | ||
35 | *(_gid) = current->gid; \ | ||
36 | } while(0) | ||
37 | |||
38 | #define current_euid_egid(_uid, _gid) \ | ||
39 | do { \ | ||
40 | *(_uid) = current->euid; \ | ||
41 | *(_gid) = current->egid; \ | ||
42 | } while(0) | ||
43 | |||
44 | #define current_fsuid_fsgid(_uid, _gid) \ | ||
45 | do { \ | ||
46 | *(_uid) = current->fsuid; \ | ||
47 | *(_gid) = current->fsgid; \ | ||
48 | } while(0) | ||
49 | |||
50 | #endif /* _LINUX_CRED_H */ | ||
diff --git a/include/linux/crypto.h b/include/linux/crypto.h index 425824bd49f3..3d2317e4af2e 100644 --- a/include/linux/crypto.h +++ b/include/linux/crypto.h | |||
@@ -30,15 +30,18 @@ | |||
30 | */ | 30 | */ |
31 | #define CRYPTO_ALG_TYPE_MASK 0x0000000f | 31 | #define CRYPTO_ALG_TYPE_MASK 0x0000000f |
32 | #define CRYPTO_ALG_TYPE_CIPHER 0x00000001 | 32 | #define CRYPTO_ALG_TYPE_CIPHER 0x00000001 |
33 | #define CRYPTO_ALG_TYPE_DIGEST 0x00000002 | 33 | #define CRYPTO_ALG_TYPE_COMPRESS 0x00000002 |
34 | #define CRYPTO_ALG_TYPE_HASH 0x00000003 | 34 | #define CRYPTO_ALG_TYPE_AEAD 0x00000003 |
35 | #define CRYPTO_ALG_TYPE_BLKCIPHER 0x00000004 | 35 | #define CRYPTO_ALG_TYPE_BLKCIPHER 0x00000004 |
36 | #define CRYPTO_ALG_TYPE_ABLKCIPHER 0x00000005 | 36 | #define CRYPTO_ALG_TYPE_ABLKCIPHER 0x00000005 |
37 | #define CRYPTO_ALG_TYPE_GIVCIPHER 0x00000006 | 37 | #define CRYPTO_ALG_TYPE_GIVCIPHER 0x00000006 |
38 | #define CRYPTO_ALG_TYPE_COMPRESS 0x00000008 | 38 | #define CRYPTO_ALG_TYPE_DIGEST 0x00000008 |
39 | #define CRYPTO_ALG_TYPE_AEAD 0x00000009 | 39 | #define CRYPTO_ALG_TYPE_HASH 0x00000009 |
40 | #define CRYPTO_ALG_TYPE_AHASH 0x0000000a | ||
41 | #define CRYPTO_ALG_TYPE_RNG 0x0000000c | ||
40 | 42 | ||
41 | #define CRYPTO_ALG_TYPE_HASH_MASK 0x0000000e | 43 | #define CRYPTO_ALG_TYPE_HASH_MASK 0x0000000e |
44 | #define CRYPTO_ALG_TYPE_AHASH_MASK 0x0000000c | ||
42 | #define CRYPTO_ALG_TYPE_BLKCIPHER_MASK 0x0000000c | 45 | #define CRYPTO_ALG_TYPE_BLKCIPHER_MASK 0x0000000c |
43 | 46 | ||
44 | #define CRYPTO_ALG_LARVAL 0x00000010 | 47 | #define CRYPTO_ALG_LARVAL 0x00000010 |
@@ -59,6 +62,14 @@ | |||
59 | #define CRYPTO_ALG_GENIV 0x00000200 | 62 | #define CRYPTO_ALG_GENIV 0x00000200 |
60 | 63 | ||
61 | /* | 64 | /* |
65 | * Set if the algorithm has passed automated run-time testing. Note that | ||
66 | * if there is no run-time testing for a given algorithm it is considered | ||
67 | * to have passed. | ||
68 | */ | ||
69 | |||
70 | #define CRYPTO_ALG_TESTED 0x00000400 | ||
71 | |||
72 | /* | ||
62 | * Transform masks and values (for crt_flags). | 73 | * Transform masks and values (for crt_flags). |
63 | */ | 74 | */ |
64 | #define CRYPTO_TFM_REQ_MASK 0x000fff00 | 75 | #define CRYPTO_TFM_REQ_MASK 0x000fff00 |
@@ -102,6 +113,8 @@ struct crypto_async_request; | |||
102 | struct crypto_aead; | 113 | struct crypto_aead; |
103 | struct crypto_blkcipher; | 114 | struct crypto_blkcipher; |
104 | struct crypto_hash; | 115 | struct crypto_hash; |
116 | struct crypto_ahash; | ||
117 | struct crypto_rng; | ||
105 | struct crypto_tfm; | 118 | struct crypto_tfm; |
106 | struct crypto_type; | 119 | struct crypto_type; |
107 | struct aead_givcrypt_request; | 120 | struct aead_givcrypt_request; |
@@ -131,6 +144,16 @@ struct ablkcipher_request { | |||
131 | void *__ctx[] CRYPTO_MINALIGN_ATTR; | 144 | void *__ctx[] CRYPTO_MINALIGN_ATTR; |
132 | }; | 145 | }; |
133 | 146 | ||
147 | struct ahash_request { | ||
148 | struct crypto_async_request base; | ||
149 | |||
150 | unsigned int nbytes; | ||
151 | struct scatterlist *src; | ||
152 | u8 *result; | ||
153 | |||
154 | void *__ctx[] CRYPTO_MINALIGN_ATTR; | ||
155 | }; | ||
156 | |||
134 | /** | 157 | /** |
135 | * struct aead_request - AEAD request | 158 | * struct aead_request - AEAD request |
136 | * @base: Common attributes for async crypto requests | 159 | * @base: Common attributes for async crypto requests |
@@ -195,6 +218,17 @@ struct ablkcipher_alg { | |||
195 | unsigned int ivsize; | 218 | unsigned int ivsize; |
196 | }; | 219 | }; |
197 | 220 | ||
221 | struct ahash_alg { | ||
222 | int (*init)(struct ahash_request *req); | ||
223 | int (*update)(struct ahash_request *req); | ||
224 | int (*final)(struct ahash_request *req); | ||
225 | int (*digest)(struct ahash_request *req); | ||
226 | int (*setkey)(struct crypto_ahash *tfm, const u8 *key, | ||
227 | unsigned int keylen); | ||
228 | |||
229 | unsigned int digestsize; | ||
230 | }; | ||
231 | |||
198 | struct aead_alg { | 232 | struct aead_alg { |
199 | int (*setkey)(struct crypto_aead *tfm, const u8 *key, | 233 | int (*setkey)(struct crypto_aead *tfm, const u8 *key, |
200 | unsigned int keylen); | 234 | unsigned int keylen); |
@@ -266,13 +300,24 @@ struct compress_alg { | |||
266 | unsigned int slen, u8 *dst, unsigned int *dlen); | 300 | unsigned int slen, u8 *dst, unsigned int *dlen); |
267 | }; | 301 | }; |
268 | 302 | ||
303 | struct rng_alg { | ||
304 | int (*rng_make_random)(struct crypto_rng *tfm, u8 *rdata, | ||
305 | unsigned int dlen); | ||
306 | int (*rng_reset)(struct crypto_rng *tfm, u8 *seed, unsigned int slen); | ||
307 | |||
308 | unsigned int seedsize; | ||
309 | }; | ||
310 | |||
311 | |||
269 | #define cra_ablkcipher cra_u.ablkcipher | 312 | #define cra_ablkcipher cra_u.ablkcipher |
270 | #define cra_aead cra_u.aead | 313 | #define cra_aead cra_u.aead |
271 | #define cra_blkcipher cra_u.blkcipher | 314 | #define cra_blkcipher cra_u.blkcipher |
272 | #define cra_cipher cra_u.cipher | 315 | #define cra_cipher cra_u.cipher |
273 | #define cra_digest cra_u.digest | 316 | #define cra_digest cra_u.digest |
274 | #define cra_hash cra_u.hash | 317 | #define cra_hash cra_u.hash |
318 | #define cra_ahash cra_u.ahash | ||
275 | #define cra_compress cra_u.compress | 319 | #define cra_compress cra_u.compress |
320 | #define cra_rng cra_u.rng | ||
276 | 321 | ||
277 | struct crypto_alg { | 322 | struct crypto_alg { |
278 | struct list_head cra_list; | 323 | struct list_head cra_list; |
@@ -298,7 +343,9 @@ struct crypto_alg { | |||
298 | struct cipher_alg cipher; | 343 | struct cipher_alg cipher; |
299 | struct digest_alg digest; | 344 | struct digest_alg digest; |
300 | struct hash_alg hash; | 345 | struct hash_alg hash; |
346 | struct ahash_alg ahash; | ||
301 | struct compress_alg compress; | 347 | struct compress_alg compress; |
348 | struct rng_alg rng; | ||
302 | } cra_u; | 349 | } cra_u; |
303 | 350 | ||
304 | int (*cra_init)(struct crypto_tfm *tfm); | 351 | int (*cra_init)(struct crypto_tfm *tfm); |
@@ -383,6 +430,18 @@ struct hash_tfm { | |||
383 | unsigned int digestsize; | 430 | unsigned int digestsize; |
384 | }; | 431 | }; |
385 | 432 | ||
433 | struct ahash_tfm { | ||
434 | int (*init)(struct ahash_request *req); | ||
435 | int (*update)(struct ahash_request *req); | ||
436 | int (*final)(struct ahash_request *req); | ||
437 | int (*digest)(struct ahash_request *req); | ||
438 | int (*setkey)(struct crypto_ahash *tfm, const u8 *key, | ||
439 | unsigned int keylen); | ||
440 | |||
441 | unsigned int digestsize; | ||
442 | unsigned int reqsize; | ||
443 | }; | ||
444 | |||
386 | struct compress_tfm { | 445 | struct compress_tfm { |
387 | int (*cot_compress)(struct crypto_tfm *tfm, | 446 | int (*cot_compress)(struct crypto_tfm *tfm, |
388 | const u8 *src, unsigned int slen, | 447 | const u8 *src, unsigned int slen, |
@@ -392,12 +451,20 @@ struct compress_tfm { | |||
392 | u8 *dst, unsigned int *dlen); | 451 | u8 *dst, unsigned int *dlen); |
393 | }; | 452 | }; |
394 | 453 | ||
454 | struct rng_tfm { | ||
455 | int (*rng_gen_random)(struct crypto_rng *tfm, u8 *rdata, | ||
456 | unsigned int dlen); | ||
457 | int (*rng_reset)(struct crypto_rng *tfm, u8 *seed, unsigned int slen); | ||
458 | }; | ||
459 | |||
395 | #define crt_ablkcipher crt_u.ablkcipher | 460 | #define crt_ablkcipher crt_u.ablkcipher |
396 | #define crt_aead crt_u.aead | 461 | #define crt_aead crt_u.aead |
397 | #define crt_blkcipher crt_u.blkcipher | 462 | #define crt_blkcipher crt_u.blkcipher |
398 | #define crt_cipher crt_u.cipher | 463 | #define crt_cipher crt_u.cipher |
399 | #define crt_hash crt_u.hash | 464 | #define crt_hash crt_u.hash |
465 | #define crt_ahash crt_u.ahash | ||
400 | #define crt_compress crt_u.compress | 466 | #define crt_compress crt_u.compress |
467 | #define crt_rng crt_u.rng | ||
401 | 468 | ||
402 | struct crypto_tfm { | 469 | struct crypto_tfm { |
403 | 470 | ||
@@ -409,7 +476,9 @@ struct crypto_tfm { | |||
409 | struct blkcipher_tfm blkcipher; | 476 | struct blkcipher_tfm blkcipher; |
410 | struct cipher_tfm cipher; | 477 | struct cipher_tfm cipher; |
411 | struct hash_tfm hash; | 478 | struct hash_tfm hash; |
479 | struct ahash_tfm ahash; | ||
412 | struct compress_tfm compress; | 480 | struct compress_tfm compress; |
481 | struct rng_tfm rng; | ||
413 | } crt_u; | 482 | } crt_u; |
414 | 483 | ||
415 | struct crypto_alg *__crt_alg; | 484 | struct crypto_alg *__crt_alg; |
@@ -441,6 +510,10 @@ struct crypto_hash { | |||
441 | struct crypto_tfm base; | 510 | struct crypto_tfm base; |
442 | }; | 511 | }; |
443 | 512 | ||
513 | struct crypto_rng { | ||
514 | struct crypto_tfm base; | ||
515 | }; | ||
516 | |||
444 | enum { | 517 | enum { |
445 | CRYPTOA_UNSPEC, | 518 | CRYPTOA_UNSPEC, |
446 | CRYPTOA_ALG, | 519 | CRYPTOA_ALG, |
@@ -475,6 +548,8 @@ struct crypto_tfm *crypto_alloc_tfm(const char *alg_name, u32 tfm_flags); | |||
475 | struct crypto_tfm *crypto_alloc_base(const char *alg_name, u32 type, u32 mask); | 548 | struct crypto_tfm *crypto_alloc_base(const char *alg_name, u32 type, u32 mask); |
476 | void crypto_free_tfm(struct crypto_tfm *tfm); | 549 | void crypto_free_tfm(struct crypto_tfm *tfm); |
477 | 550 | ||
551 | int alg_test(const char *driver, const char *alg, u32 type, u32 mask); | ||
552 | |||
478 | /* | 553 | /* |
479 | * Transform helpers which query the underlying algorithm. | 554 | * Transform helpers which query the underlying algorithm. |
480 | */ | 555 | */ |
diff --git a/include/linux/cyclades.h b/include/linux/cyclades.h index 504cb2c3fa9a..2d3d1e04ba92 100644 --- a/include/linux/cyclades.h +++ b/include/linux/cyclades.h | |||
@@ -550,11 +550,11 @@ struct cyclades_icount { | |||
550 | 550 | ||
551 | struct cyclades_port { | 551 | struct cyclades_port { |
552 | int magic; | 552 | int magic; |
553 | struct tty_port port; | ||
553 | struct cyclades_card *card; | 554 | struct cyclades_card *card; |
554 | int line; | 555 | int line; |
555 | int flags; /* defined in tty.h */ | 556 | int flags; /* defined in tty.h */ |
556 | int type; /* UART type */ | 557 | int type; /* UART type */ |
557 | struct tty_struct *tty; | ||
558 | int read_status_mask; | 558 | int read_status_mask; |
559 | int ignore_status_mask; | 559 | int ignore_status_mask; |
560 | int timeout; | 560 | int timeout; |
@@ -567,13 +567,8 @@ struct cyclades_port { | |||
567 | int chip_rev; | 567 | int chip_rev; |
568 | int custom_divisor; | 568 | int custom_divisor; |
569 | u8 x_char; /* to be pushed out ASAP */ | 569 | u8 x_char; /* to be pushed out ASAP */ |
570 | int close_delay; | ||
571 | unsigned short closing_wait; | ||
572 | int count; /* # of fd on device */ | ||
573 | int breakon; | 570 | int breakon; |
574 | int breakoff; | 571 | int breakoff; |
575 | int blocked_open; /* # of blocked opens */ | ||
576 | unsigned char *xmit_buf; | ||
577 | int xmit_head; | 572 | int xmit_head; |
578 | int xmit_tail; | 573 | int xmit_tail; |
579 | int xmit_cnt; | 574 | int xmit_cnt; |
@@ -583,16 +578,14 @@ struct cyclades_port { | |||
583 | struct cyclades_monitor mon; | 578 | struct cyclades_monitor mon; |
584 | struct cyclades_idle_stats idle_stats; | 579 | struct cyclades_idle_stats idle_stats; |
585 | struct cyclades_icount icount; | 580 | struct cyclades_icount icount; |
586 | wait_queue_head_t open_wait; | ||
587 | wait_queue_head_t close_wait; | ||
588 | struct completion shutdown_wait; | 581 | struct completion shutdown_wait; |
589 | wait_queue_head_t delta_msr_wait; | 582 | wait_queue_head_t delta_msr_wait; |
590 | int throttle; | 583 | int throttle; |
591 | }; | 584 | }; |
592 | 585 | ||
593 | #define CLOSING_WAIT_DELAY 30*HZ | 586 | #define CLOSING_WAIT_DELAY 30*HZ |
594 | #define CY_CLOSING_WAIT_NONE 65535 | 587 | #define CY_CLOSING_WAIT_NONE ASYNC_CLOSING_WAIT_NONE |
595 | #define CY_CLOSING_WAIT_INF 0 | 588 | #define CY_CLOSING_WAIT_INF ASYNC_CLOSING_WAIT_INF |
596 | 589 | ||
597 | 590 | ||
598 | #define CyMAX_CHIPS_PER_CARD 8 | 591 | #define CyMAX_CHIPS_PER_CARD 8 |
diff --git a/include/linux/dca.h b/include/linux/dca.h index af61cd1f37e9..b00a753eda53 100644 --- a/include/linux/dca.h +++ b/include/linux/dca.h | |||
@@ -10,6 +10,7 @@ void dca_unregister_notify(struct notifier_block *nb); | |||
10 | #define DCA_PROVIDER_REMOVE 0x0002 | 10 | #define DCA_PROVIDER_REMOVE 0x0002 |
11 | 11 | ||
12 | struct dca_provider { | 12 | struct dca_provider { |
13 | struct list_head node; | ||
13 | struct dca_ops *ops; | 14 | struct dca_ops *ops; |
14 | struct device *cd; | 15 | struct device *cd; |
15 | int id; | 16 | int id; |
@@ -18,7 +19,9 @@ struct dca_provider { | |||
18 | struct dca_ops { | 19 | struct dca_ops { |
19 | int (*add_requester) (struct dca_provider *, struct device *); | 20 | int (*add_requester) (struct dca_provider *, struct device *); |
20 | int (*remove_requester) (struct dca_provider *, struct device *); | 21 | int (*remove_requester) (struct dca_provider *, struct device *); |
21 | u8 (*get_tag) (struct dca_provider *, int cpu); | 22 | u8 (*get_tag) (struct dca_provider *, struct device *, |
23 | int cpu); | ||
24 | int (*dev_managed) (struct dca_provider *, struct device *); | ||
22 | }; | 25 | }; |
23 | 26 | ||
24 | struct dca_provider *alloc_dca_provider(struct dca_ops *ops, int priv_size); | 27 | struct dca_provider *alloc_dca_provider(struct dca_ops *ops, int priv_size); |
@@ -32,9 +35,11 @@ static inline void *dca_priv(struct dca_provider *dca) | |||
32 | } | 35 | } |
33 | 36 | ||
34 | /* Requester API */ | 37 | /* Requester API */ |
38 | #define DCA_GET_TAG_TWO_ARGS | ||
35 | int dca_add_requester(struct device *dev); | 39 | int dca_add_requester(struct device *dev); |
36 | int dca_remove_requester(struct device *dev); | 40 | int dca_remove_requester(struct device *dev); |
37 | u8 dca_get_tag(int cpu); | 41 | u8 dca_get_tag(int cpu); |
42 | u8 dca3_get_tag(struct device *dev, int cpu); | ||
38 | 43 | ||
39 | /* internal stuff */ | 44 | /* internal stuff */ |
40 | int __init dca_sysfs_init(void); | 45 | int __init dca_sysfs_init(void); |
diff --git a/include/linux/dcache.h b/include/linux/dcache.h index 2a6639407c80..efba1de629ac 100644 --- a/include/linux/dcache.h +++ b/include/linux/dcache.h | |||
@@ -3,6 +3,7 @@ | |||
3 | 3 | ||
4 | #include <asm/atomic.h> | 4 | #include <asm/atomic.h> |
5 | #include <linux/list.h> | 5 | #include <linux/list.h> |
6 | #include <linux/rculist.h> | ||
6 | #include <linux/spinlock.h> | 7 | #include <linux/spinlock.h> |
7 | #include <linux/cache.h> | 8 | #include <linux/cache.h> |
8 | #include <linux/rcupdate.h> | 9 | #include <linux/rcupdate.h> |
@@ -229,6 +230,7 @@ extern void d_delete(struct dentry *); | |||
229 | extern struct dentry * d_alloc(struct dentry *, const struct qstr *); | 230 | extern struct dentry * d_alloc(struct dentry *, const struct qstr *); |
230 | extern struct dentry * d_alloc_anon(struct inode *); | 231 | extern struct dentry * d_alloc_anon(struct inode *); |
231 | extern struct dentry * d_splice_alias(struct inode *, struct dentry *); | 232 | extern struct dentry * d_splice_alias(struct inode *, struct dentry *); |
233 | extern struct dentry * d_add_ci(struct dentry *, struct inode *, struct qstr *); | ||
232 | extern void shrink_dcache_sb(struct super_block *); | 234 | extern void shrink_dcache_sb(struct super_block *); |
233 | extern void shrink_dcache_parent(struct dentry *); | 235 | extern void shrink_dcache_parent(struct dentry *); |
234 | extern void shrink_dcache_for_umount(struct super_block *); | 236 | extern void shrink_dcache_for_umount(struct super_block *); |
@@ -300,7 +302,7 @@ extern int d_validate(struct dentry *, struct dentry *); | |||
300 | extern char *dynamic_dname(struct dentry *, char *, int, const char *, ...); | 302 | extern char *dynamic_dname(struct dentry *, char *, int, const char *, ...); |
301 | 303 | ||
302 | extern char *__d_path(const struct path *path, struct path *root, char *, int); | 304 | extern char *__d_path(const struct path *path, struct path *root, char *, int); |
303 | extern char *d_path(struct path *, char *, int); | 305 | extern char *d_path(const struct path *, char *, int); |
304 | extern char *dentry_path(struct dentry *, char *, int); | 306 | extern char *dentry_path(struct dentry *, char *, int); |
305 | 307 | ||
306 | /* Allocation counts.. */ | 308 | /* Allocation counts.. */ |
diff --git a/include/linux/dccp.h b/include/linux/dccp.h index aa0737019e37..6080449fbec9 100644 --- a/include/linux/dccp.h +++ b/include/linux/dccp.h | |||
@@ -364,8 +364,6 @@ static inline unsigned int dccp_hdr_len(const struct sk_buff *skb) | |||
364 | /* FIXME: for now we're default to 1 but it should really be 0 */ | 364 | /* FIXME: for now we're default to 1 but it should really be 0 */ |
365 | #define DCCPF_INITIAL_SEND_NDP_COUNT 1 | 365 | #define DCCPF_INITIAL_SEND_NDP_COUNT 1 |
366 | 366 | ||
367 | #define DCCP_NDP_LIMIT 0xFFFFFF | ||
368 | |||
369 | /** | 367 | /** |
370 | * struct dccp_minisock - Minimal DCCP connection representation | 368 | * struct dccp_minisock - Minimal DCCP connection representation |
371 | * | 369 | * |
@@ -437,7 +435,7 @@ extern int dccp_parse_options(struct sock *sk, struct dccp_request_sock *dreq, | |||
437 | struct sk_buff *skb); | 435 | struct sk_buff *skb); |
438 | 436 | ||
439 | struct dccp_options_received { | 437 | struct dccp_options_received { |
440 | u32 dccpor_ndp; /* only 24 bits */ | 438 | u64 dccpor_ndp:48; |
441 | u32 dccpor_timestamp; | 439 | u32 dccpor_timestamp; |
442 | u32 dccpor_timestamp_echo; | 440 | u32 dccpor_timestamp_echo; |
443 | u32 dccpor_elapsed_time; | 441 | u32 dccpor_elapsed_time; |
@@ -533,7 +531,7 @@ struct dccp_sock { | |||
533 | __u16 dccps_r_ack_ratio; | 531 | __u16 dccps_r_ack_ratio; |
534 | __u16 dccps_pcslen; | 532 | __u16 dccps_pcslen; |
535 | __u16 dccps_pcrlen; | 533 | __u16 dccps_pcrlen; |
536 | unsigned long dccps_ndp_count; | 534 | __u64 dccps_ndp_count:48; |
537 | unsigned long dccps_rate_last; | 535 | unsigned long dccps_rate_last; |
538 | struct dccp_minisock dccps_minisock; | 536 | struct dccp_minisock dccps_minisock; |
539 | struct dccp_ackvec *dccps_hc_rx_ackvec; | 537 | struct dccp_ackvec *dccps_hc_rx_ackvec; |
diff --git a/include/linux/debug_locks.h b/include/linux/debug_locks.h index f4a5871767f5..4aaa4afb1cb9 100644 --- a/include/linux/debug_locks.h +++ b/include/linux/debug_locks.h | |||
@@ -1,6 +1,8 @@ | |||
1 | #ifndef __LINUX_DEBUG_LOCKING_H | 1 | #ifndef __LINUX_DEBUG_LOCKING_H |
2 | #define __LINUX_DEBUG_LOCKING_H | 2 | #define __LINUX_DEBUG_LOCKING_H |
3 | 3 | ||
4 | #include <linux/kernel.h> | ||
5 | |||
4 | struct task_struct; | 6 | struct task_struct; |
5 | 7 | ||
6 | extern int debug_locks; | 8 | extern int debug_locks; |
@@ -11,14 +13,6 @@ extern int debug_locks_silent; | |||
11 | */ | 13 | */ |
12 | extern int debug_locks_off(void); | 14 | extern int debug_locks_off(void); |
13 | 15 | ||
14 | /* | ||
15 | * In the debug case we carry the caller's instruction pointer into | ||
16 | * other functions, but we dont want the function argument overhead | ||
17 | * in the nondebug case - hence these macros: | ||
18 | */ | ||
19 | #define _RET_IP_ (unsigned long)__builtin_return_address(0) | ||
20 | #define _THIS_IP_ ({ __label__ __here; __here: (unsigned long)&&__here; }) | ||
21 | |||
22 | #define DEBUG_LOCKS_WARN_ON(c) \ | 16 | #define DEBUG_LOCKS_WARN_ON(c) \ |
23 | ({ \ | 17 | ({ \ |
24 | int __ret = 0; \ | 18 | int __ret = 0; \ |
diff --git a/include/linux/debugfs.h b/include/linux/debugfs.h index 7266124361b4..e1a6c046cea3 100644 --- a/include/linux/debugfs.h +++ b/include/linux/debugfs.h | |||
@@ -26,6 +26,8 @@ struct debugfs_blob_wrapper { | |||
26 | unsigned long size; | 26 | unsigned long size; |
27 | }; | 27 | }; |
28 | 28 | ||
29 | extern struct dentry *arch_debugfs_dir; | ||
30 | |||
29 | #if defined(CONFIG_DEBUG_FS) | 31 | #if defined(CONFIG_DEBUG_FS) |
30 | 32 | ||
31 | /* declared over in file.c */ | 33 | /* declared over in file.c */ |
@@ -42,6 +44,7 @@ struct dentry *debugfs_create_symlink(const char *name, struct dentry *parent, | |||
42 | const char *dest); | 44 | const char *dest); |
43 | 45 | ||
44 | void debugfs_remove(struct dentry *dentry); | 46 | void debugfs_remove(struct dentry *dentry); |
47 | void debugfs_remove_recursive(struct dentry *dentry); | ||
45 | 48 | ||
46 | struct dentry *debugfs_rename(struct dentry *old_dir, struct dentry *old_dentry, | 49 | struct dentry *debugfs_rename(struct dentry *old_dir, struct dentry *old_dentry, |
47 | struct dentry *new_dir, const char *new_name); | 50 | struct dentry *new_dir, const char *new_name); |
@@ -99,6 +102,9 @@ static inline struct dentry *debugfs_create_symlink(const char *name, | |||
99 | static inline void debugfs_remove(struct dentry *dentry) | 102 | static inline void debugfs_remove(struct dentry *dentry) |
100 | { } | 103 | { } |
101 | 104 | ||
105 | static inline void debugfs_remove_recursive(struct dentry *dentry) | ||
106 | { } | ||
107 | |||
102 | static inline struct dentry *debugfs_rename(struct dentry *old_dir, struct dentry *old_dentry, | 108 | static inline struct dentry *debugfs_rename(struct dentry *old_dir, struct dentry *old_dentry, |
103 | struct dentry *new_dir, char *new_name) | 109 | struct dentry *new_dir, char *new_name) |
104 | { | 110 | { |
diff --git a/include/linux/delay.h b/include/linux/delay.h index 54552d21296e..fd832c6d419e 100644 --- a/include/linux/delay.h +++ b/include/linux/delay.h | |||
@@ -41,6 +41,7 @@ static inline void ndelay(unsigned long x) | |||
41 | #define ndelay(x) ndelay(x) | 41 | #define ndelay(x) ndelay(x) |
42 | #endif | 42 | #endif |
43 | 43 | ||
44 | extern unsigned long lpj_fine; | ||
44 | void calibrate_delay(void); | 45 | void calibrate_delay(void); |
45 | void msleep(unsigned int msecs); | 46 | void msleep(unsigned int msecs); |
46 | unsigned long msleep_interruptible(unsigned int msecs); | 47 | unsigned long msleep_interruptible(unsigned int msecs); |
diff --git a/include/linux/delayacct.h b/include/linux/delayacct.h index ab94bc083558..f352f06fa063 100644 --- a/include/linux/delayacct.h +++ b/include/linux/delayacct.h | |||
@@ -39,6 +39,8 @@ extern void __delayacct_blkio_start(void); | |||
39 | extern void __delayacct_blkio_end(void); | 39 | extern void __delayacct_blkio_end(void); |
40 | extern int __delayacct_add_tsk(struct taskstats *, struct task_struct *); | 40 | extern int __delayacct_add_tsk(struct taskstats *, struct task_struct *); |
41 | extern __u64 __delayacct_blkio_ticks(struct task_struct *); | 41 | extern __u64 __delayacct_blkio_ticks(struct task_struct *); |
42 | extern void __delayacct_freepages_start(void); | ||
43 | extern void __delayacct_freepages_end(void); | ||
42 | 44 | ||
43 | static inline int delayacct_is_task_waiting_on_io(struct task_struct *p) | 45 | static inline int delayacct_is_task_waiting_on_io(struct task_struct *p) |
44 | { | 46 | { |
@@ -107,6 +109,18 @@ static inline __u64 delayacct_blkio_ticks(struct task_struct *tsk) | |||
107 | return 0; | 109 | return 0; |
108 | } | 110 | } |
109 | 111 | ||
112 | static inline void delayacct_freepages_start(void) | ||
113 | { | ||
114 | if (current->delays) | ||
115 | __delayacct_freepages_start(); | ||
116 | } | ||
117 | |||
118 | static inline void delayacct_freepages_end(void) | ||
119 | { | ||
120 | if (current->delays) | ||
121 | __delayacct_freepages_end(); | ||
122 | } | ||
123 | |||
110 | #else | 124 | #else |
111 | static inline void delayacct_set_flag(int flag) | 125 | static inline void delayacct_set_flag(int flag) |
112 | {} | 126 | {} |
@@ -129,6 +143,11 @@ static inline __u64 delayacct_blkio_ticks(struct task_struct *tsk) | |||
129 | { return 0; } | 143 | { return 0; } |
130 | static inline int delayacct_is_task_waiting_on_io(struct task_struct *p) | 144 | static inline int delayacct_is_task_waiting_on_io(struct task_struct *p) |
131 | { return 0; } | 145 | { return 0; } |
146 | static inline void delayacct_freepages_start(void) | ||
147 | {} | ||
148 | static inline void delayacct_freepages_end(void) | ||
149 | {} | ||
150 | |||
132 | #endif /* CONFIG_TASK_DELAY_ACCT */ | 151 | #endif /* CONFIG_TASK_DELAY_ACCT */ |
133 | 152 | ||
134 | #endif | 153 | #endif |
diff --git a/include/linux/device-mapper.h b/include/linux/device-mapper.h index 0d8d419d191a..08d783592b73 100644 --- a/include/linux/device-mapper.h +++ b/include/linux/device-mapper.h | |||
@@ -9,11 +9,12 @@ | |||
9 | #define _LINUX_DEVICE_MAPPER_H | 9 | #define _LINUX_DEVICE_MAPPER_H |
10 | 10 | ||
11 | #include <linux/bio.h> | 11 | #include <linux/bio.h> |
12 | #include <linux/blkdev.h> | ||
12 | 13 | ||
13 | struct dm_target; | 14 | struct dm_target; |
14 | struct dm_table; | 15 | struct dm_table; |
15 | struct dm_dev; | ||
16 | struct mapped_device; | 16 | struct mapped_device; |
17 | struct bio_vec; | ||
17 | 18 | ||
18 | typedef enum { STATUSTYPE_INFO, STATUSTYPE_TABLE } status_type_t; | 19 | typedef enum { STATUSTYPE_INFO, STATUSTYPE_TABLE } status_type_t; |
19 | 20 | ||
@@ -72,6 +73,9 @@ typedef int (*dm_ioctl_fn) (struct dm_target *ti, struct inode *inode, | |||
72 | struct file *filp, unsigned int cmd, | 73 | struct file *filp, unsigned int cmd, |
73 | unsigned long arg); | 74 | unsigned long arg); |
74 | 75 | ||
76 | typedef int (*dm_merge_fn) (struct dm_target *ti, struct bvec_merge_data *bvm, | ||
77 | struct bio_vec *biovec, int max_size); | ||
78 | |||
75 | void dm_error(const char *message); | 79 | void dm_error(const char *message); |
76 | 80 | ||
77 | /* | 81 | /* |
@@ -79,6 +83,12 @@ void dm_error(const char *message); | |||
79 | */ | 83 | */ |
80 | void dm_set_device_limits(struct dm_target *ti, struct block_device *bdev); | 84 | void dm_set_device_limits(struct dm_target *ti, struct block_device *bdev); |
81 | 85 | ||
86 | struct dm_dev { | ||
87 | struct block_device *bdev; | ||
88 | int mode; | ||
89 | char name[16]; | ||
90 | }; | ||
91 | |||
82 | /* | 92 | /* |
83 | * Constructors should call these functions to ensure destination devices | 93 | * Constructors should call these functions to ensure destination devices |
84 | * are opened/closed correctly. | 94 | * are opened/closed correctly. |
@@ -107,6 +117,7 @@ struct target_type { | |||
107 | dm_status_fn status; | 117 | dm_status_fn status; |
108 | dm_message_fn message; | 118 | dm_message_fn message; |
109 | dm_ioctl_fn ioctl; | 119 | dm_ioctl_fn ioctl; |
120 | dm_merge_fn merge; | ||
110 | }; | 121 | }; |
111 | 122 | ||
112 | struct io_restrictions { | 123 | struct io_restrictions { |
@@ -196,6 +207,7 @@ int dm_copy_name_and_uuid(struct mapped_device *md, char *name, char *uuid); | |||
196 | struct gendisk *dm_disk(struct mapped_device *md); | 207 | struct gendisk *dm_disk(struct mapped_device *md); |
197 | int dm_suspended(struct mapped_device *md); | 208 | int dm_suspended(struct mapped_device *md); |
198 | int dm_noflush_suspending(struct dm_target *ti); | 209 | int dm_noflush_suspending(struct dm_target *ti); |
210 | union map_info *dm_get_mapinfo(struct bio *bio); | ||
199 | 211 | ||
200 | /* | 212 | /* |
201 | * Geometry functions. | 213 | * Geometry functions. |
@@ -226,6 +238,11 @@ int dm_table_add_target(struct dm_table *t, const char *type, | |||
226 | int dm_table_complete(struct dm_table *t); | 238 | int dm_table_complete(struct dm_table *t); |
227 | 239 | ||
228 | /* | 240 | /* |
241 | * Unplug all devices in a table. | ||
242 | */ | ||
243 | void dm_table_unplug_all(struct dm_table *t); | ||
244 | |||
245 | /* | ||
229 | * Table reference counting. | 246 | * Table reference counting. |
230 | */ | 247 | */ |
231 | struct dm_table *dm_get_table(struct mapped_device *md); | 248 | struct dm_table *dm_get_table(struct mapped_device *md); |
@@ -250,6 +267,11 @@ void dm_table_event(struct dm_table *t); | |||
250 | */ | 267 | */ |
251 | int dm_swap_table(struct mapped_device *md, struct dm_table *t); | 268 | int dm_swap_table(struct mapped_device *md, struct dm_table *t); |
252 | 269 | ||
270 | /* | ||
271 | * A wrapper around vmalloc. | ||
272 | */ | ||
273 | void *dm_vcalloc(unsigned long nmemb, unsigned long elem_size); | ||
274 | |||
253 | /*----------------------------------------------------------------- | 275 | /*----------------------------------------------------------------- |
254 | * Macros. | 276 | * Macros. |
255 | *---------------------------------------------------------------*/ | 277 | *---------------------------------------------------------------*/ |
diff --git a/include/linux/device.h b/include/linux/device.h index 6a2d04c011bc..246937c9cbc7 100644 --- a/include/linux/device.h +++ b/include/linux/device.h | |||
@@ -16,6 +16,7 @@ | |||
16 | #include <linux/kobject.h> | 16 | #include <linux/kobject.h> |
17 | #include <linux/klist.h> | 17 | #include <linux/klist.h> |
18 | #include <linux/list.h> | 18 | #include <linux/list.h> |
19 | #include <linux/lockdep.h> | ||
19 | #include <linux/compiler.h> | 20 | #include <linux/compiler.h> |
20 | #include <linux/types.h> | 21 | #include <linux/types.h> |
21 | #include <linux/module.h> | 22 | #include <linux/module.h> |
@@ -24,17 +25,13 @@ | |||
24 | #include <asm/atomic.h> | 25 | #include <asm/atomic.h> |
25 | #include <asm/device.h> | 26 | #include <asm/device.h> |
26 | 27 | ||
27 | #define DEVICE_NAME_SIZE 50 | 28 | #define BUS_ID_SIZE 20 |
28 | /* DEVICE_NAME_HALF is really less than half to accommodate slop */ | ||
29 | #define DEVICE_NAME_HALF __stringify(20) | ||
30 | #define DEVICE_ID_SIZE 32 | ||
31 | #define BUS_ID_SIZE KOBJ_NAME_LEN | ||
32 | |||
33 | 29 | ||
34 | struct device; | 30 | struct device; |
35 | struct device_driver; | 31 | struct device_driver; |
36 | struct driver_private; | 32 | struct driver_private; |
37 | struct class; | 33 | struct class; |
34 | struct class_private; | ||
38 | struct bus_type; | 35 | struct bus_type; |
39 | struct bus_type_private; | 36 | struct bus_type_private; |
40 | 37 | ||
@@ -68,6 +65,8 @@ struct bus_type { | |||
68 | int (*resume_early)(struct device *dev); | 65 | int (*resume_early)(struct device *dev); |
69 | int (*resume)(struct device *dev); | 66 | int (*resume)(struct device *dev); |
70 | 67 | ||
68 | struct pm_ext_ops *pm; | ||
69 | |||
71 | struct bus_type_private *p; | 70 | struct bus_type_private *p; |
72 | }; | 71 | }; |
73 | 72 | ||
@@ -131,6 +130,8 @@ struct device_driver { | |||
131 | int (*resume) (struct device *dev); | 130 | int (*resume) (struct device *dev); |
132 | struct attribute_group **groups; | 131 | struct attribute_group **groups; |
133 | 132 | ||
133 | struct pm_ops *pm; | ||
134 | |||
134 | struct driver_private *p; | 135 | struct driver_private *p; |
135 | }; | 136 | }; |
136 | 137 | ||
@@ -182,13 +183,9 @@ struct class { | |||
182 | const char *name; | 183 | const char *name; |
183 | struct module *owner; | 184 | struct module *owner; |
184 | 185 | ||
185 | struct kset subsys; | ||
186 | struct list_head devices; | ||
187 | struct list_head interfaces; | ||
188 | struct kset class_dirs; | ||
189 | struct semaphore sem; /* locks children, devices, interfaces */ | ||
190 | struct class_attribute *class_attrs; | 186 | struct class_attribute *class_attrs; |
191 | struct device_attribute *dev_attrs; | 187 | struct device_attribute *dev_attrs; |
188 | struct kobject *dev_kobj; | ||
192 | 189 | ||
193 | int (*dev_uevent)(struct device *dev, struct kobj_uevent_env *env); | 190 | int (*dev_uevent)(struct device *dev, struct kobj_uevent_env *env); |
194 | 191 | ||
@@ -197,13 +194,42 @@ struct class { | |||
197 | 194 | ||
198 | int (*suspend)(struct device *dev, pm_message_t state); | 195 | int (*suspend)(struct device *dev, pm_message_t state); |
199 | int (*resume)(struct device *dev); | 196 | int (*resume)(struct device *dev); |
197 | |||
198 | struct pm_ops *pm; | ||
199 | struct class_private *p; | ||
200 | }; | ||
201 | |||
202 | struct class_dev_iter { | ||
203 | struct klist_iter ki; | ||
204 | const struct device_type *type; | ||
200 | }; | 205 | }; |
201 | 206 | ||
202 | extern int __must_check class_register(struct class *class); | 207 | extern struct kobject *sysfs_dev_block_kobj; |
208 | extern struct kobject *sysfs_dev_char_kobj; | ||
209 | extern int __must_check __class_register(struct class *class, | ||
210 | struct lock_class_key *key); | ||
203 | extern void class_unregister(struct class *class); | 211 | extern void class_unregister(struct class *class); |
204 | extern int class_for_each_device(struct class *class, void *data, | 212 | |
213 | /* This is a #define to keep the compiler from merging different | ||
214 | * instances of the __key variable */ | ||
215 | #define class_register(class) \ | ||
216 | ({ \ | ||
217 | static struct lock_class_key __key; \ | ||
218 | __class_register(class, &__key); \ | ||
219 | }) | ||
220 | |||
221 | extern void class_dev_iter_init(struct class_dev_iter *iter, | ||
222 | struct class *class, | ||
223 | struct device *start, | ||
224 | const struct device_type *type); | ||
225 | extern struct device *class_dev_iter_next(struct class_dev_iter *iter); | ||
226 | extern void class_dev_iter_exit(struct class_dev_iter *iter); | ||
227 | |||
228 | extern int class_for_each_device(struct class *class, struct device *start, | ||
229 | void *data, | ||
205 | int (*fn)(struct device *dev, void *data)); | 230 | int (*fn)(struct device *dev, void *data)); |
206 | extern struct device *class_find_device(struct class *class, void *data, | 231 | extern struct device *class_find_device(struct class *class, |
232 | struct device *start, void *data, | ||
207 | int (*match)(struct device *, void *)); | 233 | int (*match)(struct device *, void *)); |
208 | 234 | ||
209 | struct class_attribute { | 235 | struct class_attribute { |
@@ -231,9 +257,19 @@ struct class_interface { | |||
231 | extern int __must_check class_interface_register(struct class_interface *); | 257 | extern int __must_check class_interface_register(struct class_interface *); |
232 | extern void class_interface_unregister(struct class_interface *); | 258 | extern void class_interface_unregister(struct class_interface *); |
233 | 259 | ||
234 | extern struct class *class_create(struct module *owner, const char *name); | 260 | extern struct class * __must_check __class_create(struct module *owner, |
261 | const char *name, | ||
262 | struct lock_class_key *key); | ||
235 | extern void class_destroy(struct class *cls); | 263 | extern void class_destroy(struct class *cls); |
236 | 264 | ||
265 | /* This is a #define to keep the compiler from merging different | ||
266 | * instances of the __key variable */ | ||
267 | #define class_create(owner, name) \ | ||
268 | ({ \ | ||
269 | static struct lock_class_key __key; \ | ||
270 | __class_create(owner, name, &__key); \ | ||
271 | }) | ||
272 | |||
237 | /* | 273 | /* |
238 | * The type of device, "struct device" is embedded in. A class | 274 | * The type of device, "struct device" is embedded in. A class |
239 | * or bus can contain devices of different types | 275 | * or bus can contain devices of different types |
@@ -248,8 +284,11 @@ struct device_type { | |||
248 | struct attribute_group **groups; | 284 | struct attribute_group **groups; |
249 | int (*uevent)(struct device *dev, struct kobj_uevent_env *env); | 285 | int (*uevent)(struct device *dev, struct kobj_uevent_env *env); |
250 | void (*release)(struct device *dev); | 286 | void (*release)(struct device *dev); |
287 | |||
251 | int (*suspend)(struct device *dev, pm_message_t state); | 288 | int (*suspend)(struct device *dev, pm_message_t state); |
252 | int (*resume)(struct device *dev); | 289 | int (*resume)(struct device *dev); |
290 | |||
291 | struct pm_ops *pm; | ||
253 | }; | 292 | }; |
254 | 293 | ||
255 | /* interface for exporting device attributes */ | 294 | /* interface for exporting device attributes */ |
@@ -331,6 +370,7 @@ struct device { | |||
331 | 370 | ||
332 | struct kobject kobj; | 371 | struct kobject kobj; |
333 | char bus_id[BUS_ID_SIZE]; /* position on parent bus */ | 372 | char bus_id[BUS_ID_SIZE]; /* position on parent bus */ |
373 | const char *init_name; /* initial name of the device */ | ||
334 | struct device_type *type; | 374 | struct device_type *type; |
335 | unsigned uevent_suppress:1; | 375 | unsigned uevent_suppress:1; |
336 | 376 | ||
@@ -368,7 +408,7 @@ struct device { | |||
368 | spinlock_t devres_lock; | 408 | spinlock_t devres_lock; |
369 | struct list_head devres_head; | 409 | struct list_head devres_head; |
370 | 410 | ||
371 | struct list_head node; | 411 | struct klist_node knode_class; |
372 | struct class *class; | 412 | struct class *class; |
373 | dev_t devt; /* dev_t, creates the sysfs "dev" */ | 413 | dev_t devt; /* dev_t, creates the sysfs "dev" */ |
374 | struct attribute_group **groups; /* optional groups */ | 414 | struct attribute_group **groups; /* optional groups */ |
@@ -379,7 +419,7 @@ struct device { | |||
379 | /* Get the wakeup routines, which depend on struct device */ | 419 | /* Get the wakeup routines, which depend on struct device */ |
380 | #include <linux/pm_wakeup.h> | 420 | #include <linux/pm_wakeup.h> |
381 | 421 | ||
382 | static inline const char *dev_name(struct device *dev) | 422 | static inline const char *dev_name(const struct device *dev) |
383 | { | 423 | { |
384 | /* will be changed into kobject_name(&dev->kobj) in the near future */ | 424 | /* will be changed into kobject_name(&dev->kobj) in the near future */ |
385 | return dev->bus_id; | 425 | return dev->bus_id; |
@@ -459,14 +499,10 @@ extern struct device *device_create_vargs(struct class *cls, | |||
459 | const char *fmt, | 499 | const char *fmt, |
460 | va_list vargs); | 500 | va_list vargs); |
461 | extern struct device *device_create(struct class *cls, struct device *parent, | 501 | extern struct device *device_create(struct class *cls, struct device *parent, |
462 | dev_t devt, const char *fmt, ...) | 502 | dev_t devt, void *drvdata, |
463 | __attribute__((format(printf, 4, 5))); | 503 | const char *fmt, ...) |
464 | extern struct device *device_create_drvdata(struct class *cls, | ||
465 | struct device *parent, | ||
466 | dev_t devt, | ||
467 | void *drvdata, | ||
468 | const char *fmt, ...) | ||
469 | __attribute__((format(printf, 5, 6))); | 504 | __attribute__((format(printf, 5, 6))); |
505 | #define device_create_drvdata device_create | ||
470 | extern void device_destroy(struct class *cls, dev_t devt); | 506 | extern void device_destroy(struct class *cls, dev_t devt); |
471 | 507 | ||
472 | /* | 508 | /* |
@@ -495,7 +531,7 @@ extern void device_shutdown(void); | |||
495 | extern void sysdev_shutdown(void); | 531 | extern void sysdev_shutdown(void); |
496 | 532 | ||
497 | /* debugging and troubleshooting/diagnostic helpers. */ | 533 | /* debugging and troubleshooting/diagnostic helpers. */ |
498 | extern const char *dev_driver_string(struct device *dev); | 534 | extern const char *dev_driver_string(const struct device *dev); |
499 | #define dev_printk(level, dev, format, arg...) \ | 535 | #define dev_printk(level, dev, format, arg...) \ |
500 | printk(level "%s %s: " format , dev_driver_string(dev) , \ | 536 | printk(level "%s %s: " format , dev_driver_string(dev) , \ |
501 | dev_name(dev) , ## arg) | 537 | dev_name(dev) , ## arg) |
diff --git a/include/linux/devpts_fs.h b/include/linux/devpts_fs.h index 154769cad3f3..5ce0e5fd712e 100644 --- a/include/linux/devpts_fs.h +++ b/include/linux/devpts_fs.h | |||
@@ -17,20 +17,31 @@ | |||
17 | 17 | ||
18 | #ifdef CONFIG_UNIX98_PTYS | 18 | #ifdef CONFIG_UNIX98_PTYS |
19 | 19 | ||
20 | int devpts_new_index(void); | 20 | int devpts_new_index(struct inode *ptmx_inode); |
21 | void devpts_kill_index(int idx); | 21 | void devpts_kill_index(struct inode *ptmx_inode, int idx); |
22 | int devpts_pty_new(struct tty_struct *tty); /* mknod in devpts */ | 22 | /* mknod in devpts */ |
23 | struct tty_struct *devpts_get_tty(int number); /* get tty structure */ | 23 | int devpts_pty_new(struct inode *ptmx_inode, struct tty_struct *tty); |
24 | void devpts_pty_kill(int number); /* unlink */ | 24 | /* get tty structure */ |
25 | struct tty_struct *devpts_get_tty(struct inode *pts_inode, int number); | ||
26 | /* unlink */ | ||
27 | void devpts_pty_kill(struct tty_struct *tty); | ||
25 | 28 | ||
26 | #else | 29 | #else |
27 | 30 | ||
28 | /* Dummy stubs in the no-pty case */ | 31 | /* Dummy stubs in the no-pty case */ |
29 | static inline int devpts_new_index(void) { return -EINVAL; } | 32 | static inline int devpts_new_index(struct inode *ptmx_inode) { return -EINVAL; } |
30 | static inline void devpts_kill_index(int idx) { } | 33 | static inline void devpts_kill_index(struct inode *ptmx_inode, int idx) { } |
31 | static inline int devpts_pty_new(struct tty_struct *tty) { return -EINVAL; } | 34 | static inline int devpts_pty_new(struct inode *ptmx_inode, |
32 | static inline struct tty_struct *devpts_get_tty(int number) { return NULL; } | 35 | struct tty_struct *tty) |
33 | static inline void devpts_pty_kill(int number) { } | 36 | { |
37 | return -EINVAL; | ||
38 | } | ||
39 | static inline struct tty_struct *devpts_get_tty(struct inode *pts_inode, | ||
40 | int number) | ||
41 | { | ||
42 | return NULL; | ||
43 | } | ||
44 | static inline void devpts_pty_kill(struct tty_struct *tty) { } | ||
34 | 45 | ||
35 | #endif | 46 | #endif |
36 | 47 | ||
diff --git a/include/linux/dirent.h b/include/linux/dirent.h index 5d6023b87800..f072fb8d10a3 100644 --- a/include/linux/dirent.h +++ b/include/linux/dirent.h | |||
@@ -1,23 +1,6 @@ | |||
1 | #ifndef _LINUX_DIRENT_H | 1 | #ifndef _LINUX_DIRENT_H |
2 | #define _LINUX_DIRENT_H | 2 | #define _LINUX_DIRENT_H |
3 | 3 | ||
4 | struct dirent { | ||
5 | long d_ino; | ||
6 | __kernel_off_t d_off; | ||
7 | unsigned short d_reclen; | ||
8 | char d_name[256]; /* We must not include limits.h! */ | ||
9 | }; | ||
10 | |||
11 | struct dirent64 { | ||
12 | __u64 d_ino; | ||
13 | __s64 d_off; | ||
14 | unsigned short d_reclen; | ||
15 | unsigned char d_type; | ||
16 | char d_name[256]; | ||
17 | }; | ||
18 | |||
19 | #ifdef __KERNEL__ | ||
20 | |||
21 | struct linux_dirent64 { | 4 | struct linux_dirent64 { |
22 | u64 d_ino; | 5 | u64 d_ino; |
23 | s64 d_off; | 6 | s64 d_off; |
@@ -26,7 +9,4 @@ struct linux_dirent64 { | |||
26 | char d_name[0]; | 9 | char d_name[0]; |
27 | }; | 10 | }; |
28 | 11 | ||
29 | #endif /* __KERNEL__ */ | ||
30 | |||
31 | |||
32 | #endif | 12 | #endif |
diff --git a/include/linux/dlm.h b/include/linux/dlm.h index 203a025e30e5..b9cd38603fd8 100644 --- a/include/linux/dlm.h +++ b/include/linux/dlm.h | |||
@@ -2,7 +2,7 @@ | |||
2 | ******************************************************************************* | 2 | ******************************************************************************* |
3 | ** | 3 | ** |
4 | ** Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. | 4 | ** Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. |
5 | ** Copyright (C) 2004-2007 Red Hat, Inc. All rights reserved. | 5 | ** Copyright (C) 2004-2008 Red Hat, Inc. All rights reserved. |
6 | ** | 6 | ** |
7 | ** This copyrighted material is made available to anyone wishing to use, | 7 | ** This copyrighted material is made available to anyone wishing to use, |
8 | ** modify, copy, or redistribute it subject to the terms and conditions | 8 | ** modify, copy, or redistribute it subject to the terms and conditions |
@@ -65,9 +65,12 @@ struct dlm_lksb { | |||
65 | char * sb_lvbptr; | 65 | char * sb_lvbptr; |
66 | }; | 66 | }; |
67 | 67 | ||
68 | /* dlm_new_lockspace() flags */ | ||
69 | |||
68 | #define DLM_LSFL_NODIR 0x00000001 | 70 | #define DLM_LSFL_NODIR 0x00000001 |
69 | #define DLM_LSFL_TIMEWARN 0x00000002 | 71 | #define DLM_LSFL_TIMEWARN 0x00000002 |
70 | #define DLM_LSFL_FS 0x00000004 | 72 | #define DLM_LSFL_FS 0x00000004 |
73 | #define DLM_LSFL_NEWEXCL 0x00000008 | ||
71 | 74 | ||
72 | #ifdef __KERNEL__ | 75 | #ifdef __KERNEL__ |
73 | 76 | ||
diff --git a/include/linux/dlm_device.h b/include/linux/dlm_device.h index c6034508fed9..3060783c4191 100644 --- a/include/linux/dlm_device.h +++ b/include/linux/dlm_device.h | |||
@@ -26,7 +26,7 @@ | |||
26 | /* Version of the device interface */ | 26 | /* Version of the device interface */ |
27 | #define DLM_DEVICE_VERSION_MAJOR 6 | 27 | #define DLM_DEVICE_VERSION_MAJOR 6 |
28 | #define DLM_DEVICE_VERSION_MINOR 0 | 28 | #define DLM_DEVICE_VERSION_MINOR 0 |
29 | #define DLM_DEVICE_VERSION_PATCH 0 | 29 | #define DLM_DEVICE_VERSION_PATCH 1 |
30 | 30 | ||
31 | /* struct passed to the lock write */ | 31 | /* struct passed to the lock write */ |
32 | struct dlm_lock_params { | 32 | struct dlm_lock_params { |
diff --git a/include/linux/dm-ioctl.h b/include/linux/dm-ioctl.h index b03c41bbfa14..28c2940eb30d 100644 --- a/include/linux/dm-ioctl.h +++ b/include/linux/dm-ioctl.h | |||
@@ -256,9 +256,9 @@ enum { | |||
256 | #define DM_DEV_SET_GEOMETRY _IOWR(DM_IOCTL, DM_DEV_SET_GEOMETRY_CMD, struct dm_ioctl) | 256 | #define DM_DEV_SET_GEOMETRY _IOWR(DM_IOCTL, DM_DEV_SET_GEOMETRY_CMD, struct dm_ioctl) |
257 | 257 | ||
258 | #define DM_VERSION_MAJOR 4 | 258 | #define DM_VERSION_MAJOR 4 |
259 | #define DM_VERSION_MINOR 13 | 259 | #define DM_VERSION_MINOR 14 |
260 | #define DM_VERSION_PATCHLEVEL 0 | 260 | #define DM_VERSION_PATCHLEVEL 0 |
261 | #define DM_VERSION_EXTRA "-ioctl (2007-10-18)" | 261 | #define DM_VERSION_EXTRA "-ioctl (2008-04-23)" |
262 | 262 | ||
263 | /* Status bits */ | 263 | /* Status bits */ |
264 | #define DM_READONLY_FLAG (1 << 0) /* In/Out */ | 264 | #define DM_READONLY_FLAG (1 << 0) /* In/Out */ |
diff --git a/include/linux/dm9000.h b/include/linux/dm9000.h index a3750462f9e3..c30879cf93bc 100644 --- a/include/linux/dm9000.h +++ b/include/linux/dm9000.h | |||
@@ -21,11 +21,13 @@ | |||
21 | #define DM9000_PLATF_32BITONLY (0x0004) | 21 | #define DM9000_PLATF_32BITONLY (0x0004) |
22 | #define DM9000_PLATF_EXT_PHY (0x0008) | 22 | #define DM9000_PLATF_EXT_PHY (0x0008) |
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 | 25 | ||
25 | /* platfrom data for platfrom device structure's platfrom_data field */ | 26 | /* platfrom data for platfrom device structure's platfrom_data field */ |
26 | 27 | ||
27 | struct dm9000_plat_data { | 28 | struct dm9000_plat_data { |
28 | unsigned int flags; | 29 | unsigned int flags; |
30 | unsigned char dev_addr[6]; | ||
29 | 31 | ||
30 | /* allow replacement IO routines */ | 32 | /* allow replacement IO routines */ |
31 | 33 | ||
diff --git a/include/linux/dma-attrs.h b/include/linux/dma-attrs.h index 1677e2bfa00c..71ad34eca6e3 100644 --- a/include/linux/dma-attrs.h +++ b/include/linux/dma-attrs.h | |||
@@ -12,6 +12,7 @@ | |||
12 | */ | 12 | */ |
13 | enum dma_attr { | 13 | enum dma_attr { |
14 | DMA_ATTR_WRITE_BARRIER, | 14 | DMA_ATTR_WRITE_BARRIER, |
15 | DMA_ATTR_WEAK_ORDERING, | ||
15 | DMA_ATTR_MAX, | 16 | DMA_ATTR_MAX, |
16 | }; | 17 | }; |
17 | 18 | ||
diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h index 952e0f857ac9..ba9114ec5d3a 100644 --- a/include/linux/dma-mapping.h +++ b/include/linux/dma-mapping.h | |||
@@ -48,6 +48,11 @@ static inline int is_device_dma_capable(struct device *dev) | |||
48 | return dev->dma_mask != NULL && *dev->dma_mask != DMA_MASK_NONE; | 48 | return dev->dma_mask != NULL && *dev->dma_mask != DMA_MASK_NONE; |
49 | } | 49 | } |
50 | 50 | ||
51 | static inline int is_buffer_dma_capable(u64 mask, dma_addr_t addr, size_t size) | ||
52 | { | ||
53 | return addr + size <= mask; | ||
54 | } | ||
55 | |||
51 | #ifdef CONFIG_HAS_DMA | 56 | #ifdef CONFIG_HAS_DMA |
52 | #include <asm/dma-mapping.h> | 57 | #include <asm/dma-mapping.h> |
53 | #else | 58 | #else |
@@ -58,6 +63,13 @@ static inline int is_device_dma_capable(struct device *dev) | |||
58 | #define dma_sync_single dma_sync_single_for_cpu | 63 | #define dma_sync_single dma_sync_single_for_cpu |
59 | #define dma_sync_sg dma_sync_sg_for_cpu | 64 | #define dma_sync_sg dma_sync_sg_for_cpu |
60 | 65 | ||
66 | static inline u64 dma_get_mask(struct device *dev) | ||
67 | { | ||
68 | if (dev && dev->dma_mask && *dev->dma_mask) | ||
69 | return *dev->dma_mask; | ||
70 | return DMA_32BIT_MASK; | ||
71 | } | ||
72 | |||
61 | extern u64 dma_get_required_mask(struct device *dev); | 73 | extern u64 dma_get_required_mask(struct device *dev); |
62 | 74 | ||
63 | static inline unsigned int dma_get_max_seg_size(struct device *dev) | 75 | static inline unsigned int dma_get_max_seg_size(struct device *dev) |
diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h index d08a5c5eb928..adb0b084eb5a 100644 --- a/include/linux/dmaengine.h +++ b/include/linux/dmaengine.h | |||
@@ -89,10 +89,23 @@ enum dma_transaction_type { | |||
89 | DMA_MEMSET, | 89 | DMA_MEMSET, |
90 | DMA_MEMCPY_CRC32C, | 90 | DMA_MEMCPY_CRC32C, |
91 | DMA_INTERRUPT, | 91 | DMA_INTERRUPT, |
92 | DMA_SLAVE, | ||
92 | }; | 93 | }; |
93 | 94 | ||
94 | /* last transaction type for creation of the capabilities mask */ | 95 | /* last transaction type for creation of the capabilities mask */ |
95 | #define DMA_TX_TYPE_END (DMA_INTERRUPT + 1) | 96 | #define DMA_TX_TYPE_END (DMA_SLAVE + 1) |
97 | |||
98 | /** | ||
99 | * enum dma_slave_width - DMA slave register access width. | ||
100 | * @DMA_SLAVE_WIDTH_8BIT: Do 8-bit slave register accesses | ||
101 | * @DMA_SLAVE_WIDTH_16BIT: Do 16-bit slave register accesses | ||
102 | * @DMA_SLAVE_WIDTH_32BIT: Do 32-bit slave register accesses | ||
103 | */ | ||
104 | enum dma_slave_width { | ||
105 | DMA_SLAVE_WIDTH_8BIT, | ||
106 | DMA_SLAVE_WIDTH_16BIT, | ||
107 | DMA_SLAVE_WIDTH_32BIT, | ||
108 | }; | ||
96 | 109 | ||
97 | /** | 110 | /** |
98 | * enum dma_ctrl_flags - DMA flags to augment operation preparation, | 111 | * enum dma_ctrl_flags - DMA flags to augment operation preparation, |
@@ -102,10 +115,14 @@ enum dma_transaction_type { | |||
102 | * @DMA_CTRL_ACK - the descriptor cannot be reused until the client | 115 | * @DMA_CTRL_ACK - the descriptor cannot be reused until the client |
103 | * acknowledges receipt, i.e. has has a chance to establish any | 116 | * acknowledges receipt, i.e. has has a chance to establish any |
104 | * dependency chains | 117 | * dependency chains |
118 | * @DMA_COMPL_SKIP_SRC_UNMAP - set to disable dma-unmapping the source buffer(s) | ||
119 | * @DMA_COMPL_SKIP_DEST_UNMAP - set to disable dma-unmapping the destination(s) | ||
105 | */ | 120 | */ |
106 | enum dma_ctrl_flags { | 121 | enum dma_ctrl_flags { |
107 | DMA_PREP_INTERRUPT = (1 << 0), | 122 | DMA_PREP_INTERRUPT = (1 << 0), |
108 | DMA_CTRL_ACK = (1 << 1), | 123 | DMA_CTRL_ACK = (1 << 1), |
124 | DMA_COMPL_SKIP_SRC_UNMAP = (1 << 2), | ||
125 | DMA_COMPL_SKIP_DEST_UNMAP = (1 << 3), | ||
109 | }; | 126 | }; |
110 | 127 | ||
111 | /** | 128 | /** |
@@ -115,6 +132,32 @@ enum dma_ctrl_flags { | |||
115 | typedef struct { DECLARE_BITMAP(bits, DMA_TX_TYPE_END); } dma_cap_mask_t; | 132 | typedef struct { DECLARE_BITMAP(bits, DMA_TX_TYPE_END); } dma_cap_mask_t; |
116 | 133 | ||
117 | /** | 134 | /** |
135 | * struct dma_slave - Information about a DMA slave | ||
136 | * @dev: device acting as DMA slave | ||
137 | * @dma_dev: required DMA master device. If non-NULL, the client can not be | ||
138 | * bound to other masters than this. | ||
139 | * @tx_reg: physical address of data register used for | ||
140 | * memory-to-peripheral transfers | ||
141 | * @rx_reg: physical address of data register used for | ||
142 | * peripheral-to-memory transfers | ||
143 | * @reg_width: peripheral register width | ||
144 | * | ||
145 | * If dma_dev is non-NULL, the client can not be bound to other DMA | ||
146 | * masters than the one corresponding to this device. The DMA master | ||
147 | * driver may use this to determine if there is controller-specific | ||
148 | * data wrapped around this struct. Drivers of platform code that sets | ||
149 | * the dma_dev field must therefore make sure to use an appropriate | ||
150 | * controller-specific dma slave structure wrapping this struct. | ||
151 | */ | ||
152 | struct dma_slave { | ||
153 | struct device *dev; | ||
154 | struct device *dma_dev; | ||
155 | dma_addr_t tx_reg; | ||
156 | dma_addr_t rx_reg; | ||
157 | enum dma_slave_width reg_width; | ||
158 | }; | ||
159 | |||
160 | /** | ||
118 | * struct dma_chan_percpu - the per-CPU part of struct dma_chan | 161 | * struct dma_chan_percpu - the per-CPU part of struct dma_chan |
119 | * @refcount: local_t used for open-coded "bigref" counting | 162 | * @refcount: local_t used for open-coded "bigref" counting |
120 | * @memcpy_count: transaction counter | 163 | * @memcpy_count: transaction counter |
@@ -139,6 +182,7 @@ struct dma_chan_percpu { | |||
139 | * @rcu: the DMA channel's RCU head | 182 | * @rcu: the DMA channel's RCU head |
140 | * @device_node: used to add this to the device chan list | 183 | * @device_node: used to add this to the device chan list |
141 | * @local: per-cpu pointer to a struct dma_chan_percpu | 184 | * @local: per-cpu pointer to a struct dma_chan_percpu |
185 | * @client-count: how many clients are using this channel | ||
142 | */ | 186 | */ |
143 | struct dma_chan { | 187 | struct dma_chan { |
144 | struct dma_device *device; | 188 | struct dma_device *device; |
@@ -154,6 +198,7 @@ struct dma_chan { | |||
154 | 198 | ||
155 | struct list_head device_node; | 199 | struct list_head device_node; |
156 | struct dma_chan_percpu *local; | 200 | struct dma_chan_percpu *local; |
201 | int client_count; | ||
157 | }; | 202 | }; |
158 | 203 | ||
159 | #define to_dma_chan(p) container_of(p, struct dma_chan, dev) | 204 | #define to_dma_chan(p) container_of(p, struct dma_chan, dev) |
@@ -202,11 +247,14 @@ typedef enum dma_state_client (*dma_event_callback) (struct dma_client *client, | |||
202 | * @event_callback: func ptr to call when something happens | 247 | * @event_callback: func ptr to call when something happens |
203 | * @cap_mask: only return channels that satisfy the requested capabilities | 248 | * @cap_mask: only return channels that satisfy the requested capabilities |
204 | * a value of zero corresponds to any capability | 249 | * a value of zero corresponds to any capability |
250 | * @slave: data for preparing slave transfer. Must be non-NULL iff the | ||
251 | * DMA_SLAVE capability is requested. | ||
205 | * @global_node: list_head for global dma_client_list | 252 | * @global_node: list_head for global dma_client_list |
206 | */ | 253 | */ |
207 | struct dma_client { | 254 | struct dma_client { |
208 | dma_event_callback event_callback; | 255 | dma_event_callback event_callback; |
209 | dma_cap_mask_t cap_mask; | 256 | dma_cap_mask_t cap_mask; |
257 | struct dma_slave *slave; | ||
210 | struct list_head global_node; | 258 | struct list_head global_node; |
211 | }; | 259 | }; |
212 | 260 | ||
@@ -263,6 +311,8 @@ struct dma_async_tx_descriptor { | |||
263 | * @device_prep_dma_zero_sum: prepares a zero_sum operation | 311 | * @device_prep_dma_zero_sum: prepares a zero_sum operation |
264 | * @device_prep_dma_memset: prepares a memset operation | 312 | * @device_prep_dma_memset: prepares a memset operation |
265 | * @device_prep_dma_interrupt: prepares an end of chain interrupt operation | 313 | * @device_prep_dma_interrupt: prepares an end of chain interrupt operation |
314 | * @device_prep_slave_sg: prepares a slave dma operation | ||
315 | * @device_terminate_all: terminate all pending operations | ||
266 | * @device_issue_pending: push pending transactions to hardware | 316 | * @device_issue_pending: push pending transactions to hardware |
267 | */ | 317 | */ |
268 | struct dma_device { | 318 | struct dma_device { |
@@ -279,7 +329,8 @@ struct dma_device { | |||
279 | int dev_id; | 329 | int dev_id; |
280 | struct device *dev; | 330 | struct device *dev; |
281 | 331 | ||
282 | int (*device_alloc_chan_resources)(struct dma_chan *chan); | 332 | int (*device_alloc_chan_resources)(struct dma_chan *chan, |
333 | struct dma_client *client); | ||
283 | void (*device_free_chan_resources)(struct dma_chan *chan); | 334 | void (*device_free_chan_resources)(struct dma_chan *chan); |
284 | 335 | ||
285 | struct dma_async_tx_descriptor *(*device_prep_dma_memcpy)( | 336 | struct dma_async_tx_descriptor *(*device_prep_dma_memcpy)( |
@@ -297,6 +348,12 @@ struct dma_device { | |||
297 | struct dma_async_tx_descriptor *(*device_prep_dma_interrupt)( | 348 | struct dma_async_tx_descriptor *(*device_prep_dma_interrupt)( |
298 | struct dma_chan *chan, unsigned long flags); | 349 | struct dma_chan *chan, unsigned long flags); |
299 | 350 | ||
351 | struct dma_async_tx_descriptor *(*device_prep_slave_sg)( | ||
352 | struct dma_chan *chan, struct scatterlist *sgl, | ||
353 | unsigned int sg_len, enum dma_data_direction direction, | ||
354 | unsigned long flags); | ||
355 | void (*device_terminate_all)(struct dma_chan *chan); | ||
356 | |||
300 | enum dma_status (*device_is_tx_complete)(struct dma_chan *chan, | 357 | enum dma_status (*device_is_tx_complete)(struct dma_chan *chan, |
301 | dma_cookie_t cookie, dma_cookie_t *last, | 358 | dma_cookie_t cookie, dma_cookie_t *last, |
302 | dma_cookie_t *used); | 359 | dma_cookie_t *used); |
@@ -318,16 +375,14 @@ dma_cookie_t dma_async_memcpy_pg_to_pg(struct dma_chan *chan, | |||
318 | void dma_async_tx_descriptor_init(struct dma_async_tx_descriptor *tx, | 375 | void dma_async_tx_descriptor_init(struct dma_async_tx_descriptor *tx, |
319 | struct dma_chan *chan); | 376 | struct dma_chan *chan); |
320 | 377 | ||
321 | static inline void | 378 | static inline void async_tx_ack(struct dma_async_tx_descriptor *tx) |
322 | async_tx_ack(struct dma_async_tx_descriptor *tx) | ||
323 | { | 379 | { |
324 | tx->flags |= DMA_CTRL_ACK; | 380 | tx->flags |= DMA_CTRL_ACK; |
325 | } | 381 | } |
326 | 382 | ||
327 | static inline int | 383 | static inline bool async_tx_test_ack(struct dma_async_tx_descriptor *tx) |
328 | async_tx_test_ack(struct dma_async_tx_descriptor *tx) | ||
329 | { | 384 | { |
330 | return tx->flags & DMA_CTRL_ACK; | 385 | return (tx->flags & DMA_CTRL_ACK) == DMA_CTRL_ACK; |
331 | } | 386 | } |
332 | 387 | ||
333 | #define first_dma_cap(mask) __first_dma_cap(&(mask)) | 388 | #define first_dma_cap(mask) __first_dma_cap(&(mask)) |
diff --git a/include/linux/dmar.h b/include/linux/dmar.h index 56c73b847551..c360c558e59e 100644 --- a/include/linux/dmar.h +++ b/include/linux/dmar.h | |||
@@ -25,9 +25,99 @@ | |||
25 | #include <linux/types.h> | 25 | #include <linux/types.h> |
26 | #include <linux/msi.h> | 26 | #include <linux/msi.h> |
27 | 27 | ||
28 | #ifdef CONFIG_DMAR | 28 | #if defined(CONFIG_DMAR) || defined(CONFIG_INTR_REMAP) |
29 | struct intel_iommu; | 29 | struct intel_iommu; |
30 | 30 | ||
31 | struct dmar_drhd_unit { | ||
32 | struct list_head list; /* list of drhd units */ | ||
33 | struct acpi_dmar_header *hdr; /* ACPI header */ | ||
34 | u64 reg_base_addr; /* register base address*/ | ||
35 | struct pci_dev **devices; /* target device array */ | ||
36 | int devices_cnt; /* target device count */ | ||
37 | u8 ignored:1; /* ignore drhd */ | ||
38 | u8 include_all:1; | ||
39 | struct intel_iommu *iommu; | ||
40 | }; | ||
41 | |||
42 | extern struct list_head dmar_drhd_units; | ||
43 | |||
44 | #define for_each_drhd_unit(drhd) \ | ||
45 | list_for_each_entry(drhd, &dmar_drhd_units, list) | ||
46 | |||
47 | extern int dmar_table_init(void); | ||
48 | extern int early_dmar_detect(void); | ||
49 | extern int dmar_dev_scope_init(void); | ||
50 | |||
51 | /* Intel IOMMU detection */ | ||
52 | extern void detect_intel_iommu(void); | ||
53 | |||
54 | |||
55 | extern int parse_ioapics_under_ir(void); | ||
56 | extern int alloc_iommu(struct dmar_drhd_unit *); | ||
57 | #else | ||
58 | static inline void detect_intel_iommu(void) | ||
59 | { | ||
60 | return; | ||
61 | } | ||
62 | |||
63 | static inline int dmar_table_init(void) | ||
64 | { | ||
65 | return -ENODEV; | ||
66 | } | ||
67 | #endif /* !CONFIG_DMAR && !CONFIG_INTR_REMAP */ | ||
68 | |||
69 | #ifdef CONFIG_INTR_REMAP | ||
70 | extern int intr_remapping_enabled; | ||
71 | extern int enable_intr_remapping(int); | ||
72 | |||
73 | struct irte { | ||
74 | union { | ||
75 | struct { | ||
76 | __u64 present : 1, | ||
77 | fpd : 1, | ||
78 | dst_mode : 1, | ||
79 | redir_hint : 1, | ||
80 | trigger_mode : 1, | ||
81 | dlvry_mode : 3, | ||
82 | avail : 4, | ||
83 | __reserved_1 : 4, | ||
84 | vector : 8, | ||
85 | __reserved_2 : 8, | ||
86 | dest_id : 32; | ||
87 | }; | ||
88 | __u64 low; | ||
89 | }; | ||
90 | |||
91 | union { | ||
92 | struct { | ||
93 | __u64 sid : 16, | ||
94 | sq : 2, | ||
95 | svt : 2, | ||
96 | __reserved_3 : 44; | ||
97 | }; | ||
98 | __u64 high; | ||
99 | }; | ||
100 | }; | ||
101 | extern int get_irte(int irq, struct irte *entry); | ||
102 | extern int modify_irte(int irq, struct irte *irte_modified); | ||
103 | extern int alloc_irte(struct intel_iommu *iommu, int irq, u16 count); | ||
104 | extern int set_irte_irq(int irq, struct intel_iommu *iommu, u16 index, | ||
105 | u16 sub_handle); | ||
106 | extern int map_irq_to_irte_handle(int irq, u16 *sub_handle); | ||
107 | extern int clear_irte_irq(int irq, struct intel_iommu *iommu, u16 index); | ||
108 | extern int flush_irte(int irq); | ||
109 | extern int free_irte(int irq); | ||
110 | |||
111 | extern int irq_remapped(int irq); | ||
112 | extern struct intel_iommu *map_dev_to_ir(struct pci_dev *dev); | ||
113 | extern struct intel_iommu *map_ioapic_to_ir(int apic); | ||
114 | #else | ||
115 | #define irq_remapped(irq) (0) | ||
116 | #define enable_intr_remapping(mode) (-1) | ||
117 | #define intr_remapping_enabled (0) | ||
118 | #endif | ||
119 | |||
120 | #ifdef CONFIG_DMAR | ||
31 | extern const char *dmar_get_fault_reason(u8 fault_reason); | 121 | extern const char *dmar_get_fault_reason(u8 fault_reason); |
32 | 122 | ||
33 | /* Can't use the common MSI interrupt functions | 123 | /* Can't use the common MSI interrupt functions |
@@ -40,47 +130,30 @@ extern void dmar_msi_write(int irq, struct msi_msg *msg); | |||
40 | extern int dmar_set_interrupt(struct intel_iommu *iommu); | 130 | extern int dmar_set_interrupt(struct intel_iommu *iommu); |
41 | extern int arch_setup_dmar_msi(unsigned int irq); | 131 | extern int arch_setup_dmar_msi(unsigned int irq); |
42 | 132 | ||
43 | /* Intel IOMMU detection and initialization functions */ | 133 | extern int iommu_detected, no_iommu; |
44 | extern void detect_intel_iommu(void); | ||
45 | extern int intel_iommu_init(void); | ||
46 | |||
47 | extern int dmar_table_init(void); | ||
48 | extern int early_dmar_detect(void); | ||
49 | |||
50 | extern struct list_head dmar_drhd_units; | ||
51 | extern struct list_head dmar_rmrr_units; | 134 | extern struct list_head dmar_rmrr_units; |
52 | |||
53 | struct dmar_drhd_unit { | ||
54 | struct list_head list; /* list of drhd units */ | ||
55 | u64 reg_base_addr; /* register base address*/ | ||
56 | struct pci_dev **devices; /* target device array */ | ||
57 | int devices_cnt; /* target device count */ | ||
58 | u8 ignored:1; /* ignore drhd */ | ||
59 | u8 include_all:1; | ||
60 | struct intel_iommu *iommu; | ||
61 | }; | ||
62 | |||
63 | struct dmar_rmrr_unit { | 135 | struct dmar_rmrr_unit { |
64 | struct list_head list; /* list of rmrr units */ | 136 | struct list_head list; /* list of rmrr units */ |
137 | struct acpi_dmar_header *hdr; /* ACPI header */ | ||
65 | u64 base_address; /* reserved base address*/ | 138 | u64 base_address; /* reserved base address*/ |
66 | u64 end_address; /* reserved end address */ | 139 | u64 end_address; /* reserved end address */ |
67 | struct pci_dev **devices; /* target devices */ | 140 | struct pci_dev **devices; /* target devices */ |
68 | int devices_cnt; /* target device count */ | 141 | int devices_cnt; /* target device count */ |
69 | }; | 142 | }; |
70 | 143 | ||
71 | #define for_each_drhd_unit(drhd) \ | ||
72 | list_for_each_entry(drhd, &dmar_drhd_units, list) | ||
73 | #define for_each_rmrr_units(rmrr) \ | 144 | #define for_each_rmrr_units(rmrr) \ |
74 | list_for_each_entry(rmrr, &dmar_rmrr_units, list) | 145 | list_for_each_entry(rmrr, &dmar_rmrr_units, list) |
146 | /* Intel DMAR initialization functions */ | ||
147 | extern int intel_iommu_init(void); | ||
148 | extern int dmar_disabled; | ||
75 | #else | 149 | #else |
76 | static inline void detect_intel_iommu(void) | ||
77 | { | ||
78 | return; | ||
79 | } | ||
80 | static inline int intel_iommu_init(void) | 150 | static inline int intel_iommu_init(void) |
81 | { | 151 | { |
152 | #ifdef CONFIG_INTR_REMAP | ||
153 | return dmar_dev_scope_init(); | ||
154 | #else | ||
82 | return -ENODEV; | 155 | return -ENODEV; |
156 | #endif | ||
83 | } | 157 | } |
84 | |||
85 | #endif /* !CONFIG_DMAR */ | 158 | #endif /* !CONFIG_DMAR */ |
86 | #endif /* __DMAR_H__ */ | 159 | #endif /* __DMAR_H__ */ |
diff --git a/include/linux/dmi.h b/include/linux/dmi.h index 2a063b64133f..e5084eb5943a 100644 --- a/include/linux/dmi.h +++ b/include/linux/dmi.h | |||
@@ -2,29 +2,9 @@ | |||
2 | #define __DMI_H__ | 2 | #define __DMI_H__ |
3 | 3 | ||
4 | #include <linux/list.h> | 4 | #include <linux/list.h> |
5 | #include <linux/mod_devicetable.h> | ||
5 | 6 | ||
6 | enum dmi_field { | 7 | /* enum dmi_field is in mod_devicetable.h */ |
7 | DMI_NONE, | ||
8 | DMI_BIOS_VENDOR, | ||
9 | DMI_BIOS_VERSION, | ||
10 | DMI_BIOS_DATE, | ||
11 | DMI_SYS_VENDOR, | ||
12 | DMI_PRODUCT_NAME, | ||
13 | DMI_PRODUCT_VERSION, | ||
14 | DMI_PRODUCT_SERIAL, | ||
15 | DMI_PRODUCT_UUID, | ||
16 | DMI_BOARD_VENDOR, | ||
17 | DMI_BOARD_NAME, | ||
18 | DMI_BOARD_VERSION, | ||
19 | DMI_BOARD_SERIAL, | ||
20 | DMI_BOARD_ASSET_TAG, | ||
21 | DMI_CHASSIS_VENDOR, | ||
22 | DMI_CHASSIS_TYPE, | ||
23 | DMI_CHASSIS_VERSION, | ||
24 | DMI_CHASSIS_SERIAL, | ||
25 | DMI_CHASSIS_ASSET_TAG, | ||
26 | DMI_STRING_MAX, | ||
27 | }; | ||
28 | 8 | ||
29 | enum dmi_device_type { | 9 | enum dmi_device_type { |
30 | DMI_DEV_TYPE_ANY = 0, | 10 | DMI_DEV_TYPE_ANY = 0, |
@@ -48,23 +28,6 @@ struct dmi_header { | |||
48 | u16 handle; | 28 | u16 handle; |
49 | }; | 29 | }; |
50 | 30 | ||
51 | /* | ||
52 | * DMI callbacks for problem boards | ||
53 | */ | ||
54 | struct dmi_strmatch { | ||
55 | u8 slot; | ||
56 | char *substr; | ||
57 | }; | ||
58 | |||
59 | struct dmi_system_id { | ||
60 | int (*callback)(const struct dmi_system_id *); | ||
61 | const char *ident; | ||
62 | struct dmi_strmatch matches[4]; | ||
63 | void *driver_data; | ||
64 | }; | ||
65 | |||
66 | #define DMI_MATCH(a, b) { a, b } | ||
67 | |||
68 | struct dmi_device { | 31 | struct dmi_device { |
69 | struct list_head list; | 32 | struct list_head list; |
70 | int type; | 33 | int type; |
diff --git a/include/linux/dvb/frontend.h b/include/linux/dvb/frontend.h index c8cbd90ba375..6e4ace270276 100644 --- a/include/linux/dvb/frontend.h +++ b/include/linux/dvb/frontend.h | |||
@@ -62,6 +62,7 @@ typedef enum fe_caps { | |||
62 | FE_CAN_HIERARCHY_AUTO = 0x100000, | 62 | FE_CAN_HIERARCHY_AUTO = 0x100000, |
63 | FE_CAN_8VSB = 0x200000, | 63 | FE_CAN_8VSB = 0x200000, |
64 | FE_CAN_16VSB = 0x400000, | 64 | FE_CAN_16VSB = 0x400000, |
65 | FE_HAS_EXTENDED_CAPS = 0x800000, // We need more bitspace for newer APIs, indicate this. | ||
65 | FE_NEEDS_BENDING = 0x20000000, // not supported anymore, don't use (frontend requires frequency bending) | 66 | FE_NEEDS_BENDING = 0x20000000, // not supported anymore, don't use (frontend requires frequency bending) |
66 | FE_CAN_RECOVER = 0x40000000, // frontend can recover from a cable unplug automatically | 67 | FE_CAN_RECOVER = 0x40000000, // frontend can recover from a cable unplug automatically |
67 | FE_CAN_MUTE_TS = 0x80000000 // frontend can stop spurious TS data output | 68 | FE_CAN_MUTE_TS = 0x80000000 // frontend can stop spurious TS data output |
@@ -147,7 +148,9 @@ typedef enum fe_code_rate { | |||
147 | FEC_6_7, | 148 | FEC_6_7, |
148 | FEC_7_8, | 149 | FEC_7_8, |
149 | FEC_8_9, | 150 | FEC_8_9, |
150 | FEC_AUTO | 151 | FEC_AUTO, |
152 | FEC_3_5, | ||
153 | FEC_9_10, | ||
151 | } fe_code_rate_t; | 154 | } fe_code_rate_t; |
152 | 155 | ||
153 | 156 | ||
@@ -160,7 +163,10 @@ typedef enum fe_modulation { | |||
160 | QAM_256, | 163 | QAM_256, |
161 | QAM_AUTO, | 164 | QAM_AUTO, |
162 | VSB_8, | 165 | VSB_8, |
163 | VSB_16 | 166 | VSB_16, |
167 | PSK_8, | ||
168 | APSK_16, | ||
169 | DQPSK, | ||
164 | } fe_modulation_t; | 170 | } fe_modulation_t; |
165 | 171 | ||
166 | typedef enum fe_transmit_mode { | 172 | typedef enum fe_transmit_mode { |
@@ -239,6 +245,106 @@ struct dvb_frontend_event { | |||
239 | struct dvb_frontend_parameters parameters; | 245 | struct dvb_frontend_parameters parameters; |
240 | }; | 246 | }; |
241 | 247 | ||
248 | /* S2API Commands */ | ||
249 | #define DTV_UNDEFINED 0 | ||
250 | #define DTV_TUNE 1 | ||
251 | #define DTV_CLEAR 2 | ||
252 | #define DTV_FREQUENCY 3 | ||
253 | #define DTV_MODULATION 4 | ||
254 | #define DTV_BANDWIDTH_HZ 5 | ||
255 | #define DTV_INVERSION 6 | ||
256 | #define DTV_DISEQC_MASTER 7 | ||
257 | #define DTV_SYMBOL_RATE 8 | ||
258 | #define DTV_INNER_FEC 9 | ||
259 | #define DTV_VOLTAGE 10 | ||
260 | #define DTV_TONE 11 | ||
261 | #define DTV_PILOT 12 | ||
262 | #define DTV_ROLLOFF 13 | ||
263 | #define DTV_DISEQC_SLAVE_REPLY 14 | ||
264 | |||
265 | /* Basic enumeration set for querying unlimited capabilities */ | ||
266 | #define DTV_FE_CAPABILITY_COUNT 15 | ||
267 | #define DTV_FE_CAPABILITY 16 | ||
268 | #define DTV_DELIVERY_SYSTEM 17 | ||
269 | |||
270 | #define DTV_API_VERSION 35 | ||
271 | #define DTV_API_VERSION 35 | ||
272 | #define DTV_CODE_RATE_HP 36 | ||
273 | #define DTV_CODE_RATE_LP 37 | ||
274 | #define DTV_GUARD_INTERVAL 38 | ||
275 | #define DTV_TRANSMISSION_MODE 39 | ||
276 | #define DTV_HIERARCHY 40 | ||
277 | |||
278 | #define DTV_MAX_COMMAND DTV_HIERARCHY | ||
279 | |||
280 | typedef enum fe_pilot { | ||
281 | PILOT_ON, | ||
282 | PILOT_OFF, | ||
283 | PILOT_AUTO, | ||
284 | } fe_pilot_t; | ||
285 | |||
286 | typedef enum fe_rolloff { | ||
287 | ROLLOFF_35, /* Implied value in DVB-S, default for DVB-S2 */ | ||
288 | ROLLOFF_20, | ||
289 | ROLLOFF_25, | ||
290 | ROLLOFF_AUTO, | ||
291 | } fe_rolloff_t; | ||
292 | |||
293 | typedef enum fe_delivery_system { | ||
294 | SYS_UNDEFINED, | ||
295 | SYS_DVBC_ANNEX_AC, | ||
296 | SYS_DVBC_ANNEX_B, | ||
297 | SYS_DVBT, | ||
298 | SYS_DVBS, | ||
299 | SYS_DVBS2, | ||
300 | SYS_DVBH, | ||
301 | SYS_ISDBT, | ||
302 | SYS_ISDBS, | ||
303 | SYS_ISDBC, | ||
304 | SYS_ATSC, | ||
305 | SYS_ATSCMH, | ||
306 | SYS_DMBTH, | ||
307 | SYS_CMMB, | ||
308 | SYS_DAB, | ||
309 | } fe_delivery_system_t; | ||
310 | |||
311 | struct dtv_cmds_h { | ||
312 | char *name; /* A display name for debugging purposes */ | ||
313 | |||
314 | __u32 cmd; /* A unique ID */ | ||
315 | |||
316 | /* Flags */ | ||
317 | __u32 set:1; /* Either a set or get property */ | ||
318 | __u32 buffer:1; /* Does this property use the buffer? */ | ||
319 | __u32 reserved:30; /* Align */ | ||
320 | }; | ||
321 | |||
322 | struct dtv_property { | ||
323 | __u32 cmd; | ||
324 | __u32 reserved[3]; | ||
325 | union { | ||
326 | __u32 data; | ||
327 | struct { | ||
328 | __u8 data[32]; | ||
329 | __u32 len; | ||
330 | __u32 reserved1[3]; | ||
331 | void *reserved2; | ||
332 | } buffer; | ||
333 | } u; | ||
334 | int result; | ||
335 | } __attribute__ ((packed)); | ||
336 | |||
337 | /* num of properties cannot exceed DTV_IOCTL_MAX_MSGS per ioctl */ | ||
338 | #define DTV_IOCTL_MAX_MSGS 64 | ||
339 | |||
340 | struct dtv_properties { | ||
341 | __u32 num; | ||
342 | struct dtv_property *props; | ||
343 | }; | ||
344 | |||
345 | #define FE_SET_PROPERTY _IOW('o', 82, struct dtv_properties) | ||
346 | #define FE_GET_PROPERTY _IOR('o', 83, struct dtv_properties) | ||
347 | |||
242 | 348 | ||
243 | /** | 349 | /** |
244 | * When set, this flag will disable any zigzagging or other "normal" tuning | 350 | * When set, this flag will disable any zigzagging or other "normal" tuning |
diff --git a/include/linux/dvb/version.h b/include/linux/dvb/version.h index 126e0c26cb09..25b823b81734 100644 --- a/include/linux/dvb/version.h +++ b/include/linux/dvb/version.h | |||
@@ -23,7 +23,7 @@ | |||
23 | #ifndef _DVBVERSION_H_ | 23 | #ifndef _DVBVERSION_H_ |
24 | #define _DVBVERSION_H_ | 24 | #define _DVBVERSION_H_ |
25 | 25 | ||
26 | #define DVB_API_VERSION 3 | 26 | #define DVB_API_VERSION 5 |
27 | #define DVB_API_VERSION_MINOR 2 | 27 | #define DVB_API_VERSION_MINOR 0 |
28 | 28 | ||
29 | #endif /*_DVBVERSION_H_*/ | 29 | #endif /*_DVBVERSION_H_*/ |
diff --git a/include/linux/dw_dmac.h b/include/linux/dw_dmac.h new file mode 100644 index 000000000000..04d217b442bf --- /dev/null +++ b/include/linux/dw_dmac.h | |||
@@ -0,0 +1,62 @@ | |||
1 | /* | ||
2 | * Driver for the Synopsys DesignWare DMA Controller (aka DMACA on | ||
3 | * AVR32 systems.) | ||
4 | * | ||
5 | * Copyright (C) 2007 Atmel Corporation | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License version 2 as | ||
9 | * published by the Free Software Foundation. | ||
10 | */ | ||
11 | #ifndef DW_DMAC_H | ||
12 | #define DW_DMAC_H | ||
13 | |||
14 | #include <linux/dmaengine.h> | ||
15 | |||
16 | /** | ||
17 | * struct dw_dma_platform_data - Controller configuration parameters | ||
18 | * @nr_channels: Number of channels supported by hardware (max 8) | ||
19 | */ | ||
20 | struct dw_dma_platform_data { | ||
21 | unsigned int nr_channels; | ||
22 | }; | ||
23 | |||
24 | /** | ||
25 | * struct dw_dma_slave - Controller-specific information about a slave | ||
26 | * @slave: Generic information about the slave | ||
27 | * @ctl_lo: Platform-specific initializer for the CTL_LO register | ||
28 | * @cfg_hi: Platform-specific initializer for the CFG_HI register | ||
29 | * @cfg_lo: Platform-specific initializer for the CFG_LO register | ||
30 | */ | ||
31 | struct dw_dma_slave { | ||
32 | struct dma_slave slave; | ||
33 | u32 cfg_hi; | ||
34 | u32 cfg_lo; | ||
35 | }; | ||
36 | |||
37 | /* Platform-configurable bits in CFG_HI */ | ||
38 | #define DWC_CFGH_FCMODE (1 << 0) | ||
39 | #define DWC_CFGH_FIFO_MODE (1 << 1) | ||
40 | #define DWC_CFGH_PROTCTL(x) ((x) << 2) | ||
41 | #define DWC_CFGH_SRC_PER(x) ((x) << 7) | ||
42 | #define DWC_CFGH_DST_PER(x) ((x) << 11) | ||
43 | |||
44 | /* Platform-configurable bits in CFG_LO */ | ||
45 | #define DWC_CFGL_PRIO(x) ((x) << 5) /* priority */ | ||
46 | #define DWC_CFGL_LOCK_CH_XFER (0 << 12) /* scope of LOCK_CH */ | ||
47 | #define DWC_CFGL_LOCK_CH_BLOCK (1 << 12) | ||
48 | #define DWC_CFGL_LOCK_CH_XACT (2 << 12) | ||
49 | #define DWC_CFGL_LOCK_BUS_XFER (0 << 14) /* scope of LOCK_BUS */ | ||
50 | #define DWC_CFGL_LOCK_BUS_BLOCK (1 << 14) | ||
51 | #define DWC_CFGL_LOCK_BUS_XACT (2 << 14) | ||
52 | #define DWC_CFGL_LOCK_CH (1 << 15) /* channel lockout */ | ||
53 | #define DWC_CFGL_LOCK_BUS (1 << 16) /* busmaster lockout */ | ||
54 | #define DWC_CFGL_HS_DST_POL (1 << 18) /* dst handshake active low */ | ||
55 | #define DWC_CFGL_HS_SRC_POL (1 << 19) /* src handshake active low */ | ||
56 | |||
57 | static inline struct dw_dma_slave *to_dw_dma_slave(struct dma_slave *slave) | ||
58 | { | ||
59 | return container_of(slave, struct dw_dma_slave, slave); | ||
60 | } | ||
61 | |||
62 | #endif /* DW_DMAC_H */ | ||
diff --git a/include/linux/efi.h b/include/linux/efi.h index a5f359a7ad0e..807373d467f7 100644 --- a/include/linux/efi.h +++ b/include/linux/efi.h | |||
@@ -287,7 +287,6 @@ efi_guid_unparse(efi_guid_t *guid, char *out) | |||
287 | extern void efi_init (void); | 287 | extern void efi_init (void); |
288 | extern void *efi_get_pal_addr (void); | 288 | extern void *efi_get_pal_addr (void); |
289 | extern void efi_map_pal_code (void); | 289 | extern void efi_map_pal_code (void); |
290 | extern void efi_map_memmap(void); | ||
291 | extern void efi_memmap_walk (efi_freemem_callback_t callback, void *arg); | 290 | extern void efi_memmap_walk (efi_freemem_callback_t callback, void *arg); |
292 | extern void efi_gettimeofday (struct timespec *ts); | 291 | extern void efi_gettimeofday (struct timespec *ts); |
293 | extern void efi_enter_virtual_mode (void); /* switch EFI to virtual mode, if possible */ | 292 | extern void efi_enter_virtual_mode (void); /* switch EFI to virtual mode, if possible */ |
@@ -295,14 +294,11 @@ extern u64 efi_get_iobase (void); | |||
295 | extern u32 efi_mem_type (unsigned long phys_addr); | 294 | extern u32 efi_mem_type (unsigned long phys_addr); |
296 | extern u64 efi_mem_attributes (unsigned long phys_addr); | 295 | extern u64 efi_mem_attributes (unsigned long phys_addr); |
297 | extern u64 efi_mem_attribute (unsigned long phys_addr, unsigned long size); | 296 | extern u64 efi_mem_attribute (unsigned long phys_addr, unsigned long size); |
298 | extern int efi_mem_attribute_range (unsigned long phys_addr, unsigned long size, | ||
299 | u64 attr); | ||
300 | extern int __init efi_uart_console_only (void); | 297 | extern int __init efi_uart_console_only (void); |
301 | extern void efi_initialize_iomem_resources(struct resource *code_resource, | 298 | extern void efi_initialize_iomem_resources(struct resource *code_resource, |
302 | struct resource *data_resource, struct resource *bss_resource); | 299 | struct resource *data_resource, struct resource *bss_resource); |
303 | extern unsigned long efi_get_time(void); | 300 | extern unsigned long efi_get_time(void); |
304 | extern int efi_set_rtc_mmss(unsigned long nowtime); | 301 | extern int efi_set_rtc_mmss(unsigned long nowtime); |
305 | extern int is_available_memory(efi_memory_desc_t * md); | ||
306 | extern struct efi_memory_map memmap; | 302 | extern struct efi_memory_map memmap; |
307 | 303 | ||
308 | /** | 304 | /** |
diff --git a/include/linux/eisa.h b/include/linux/eisa.h index fe806b6f030d..e61c0be2a459 100644 --- a/include/linux/eisa.h +++ b/include/linux/eisa.h | |||
@@ -40,7 +40,7 @@ struct eisa_device { | |||
40 | u64 dma_mask; | 40 | u64 dma_mask; |
41 | struct device dev; /* generic device */ | 41 | struct device dev; /* generic device */ |
42 | #ifdef CONFIG_EISA_NAMES | 42 | #ifdef CONFIG_EISA_NAMES |
43 | char pretty_name[DEVICE_NAME_SIZE]; | 43 | char pretty_name[50]; |
44 | #endif | 44 | #endif |
45 | }; | 45 | }; |
46 | 46 | ||
diff --git a/include/linux/elevator.h b/include/linux/elevator.h index 639624b55fbe..92f6f634e3e6 100644 --- a/include/linux/elevator.h +++ b/include/linux/elevator.h | |||
@@ -112,6 +112,7 @@ extern struct request *elv_latter_request(struct request_queue *, struct request | |||
112 | extern int elv_register_queue(struct request_queue *q); | 112 | extern int elv_register_queue(struct request_queue *q); |
113 | extern void elv_unregister_queue(struct request_queue *q); | 113 | extern void elv_unregister_queue(struct request_queue *q); |
114 | extern int elv_may_queue(struct request_queue *, int); | 114 | extern int elv_may_queue(struct request_queue *, int); |
115 | extern void elv_abort_queue(struct request_queue *); | ||
115 | extern void elv_completed_request(struct request_queue *, struct request *); | 116 | extern void elv_completed_request(struct request_queue *, struct request *); |
116 | extern int elv_set_request(struct request_queue *, struct request *, gfp_t); | 117 | extern int elv_set_request(struct request_queue *, struct request *, gfp_t); |
117 | extern void elv_put_request(struct request_queue *, struct request *); | 118 | extern void elv_put_request(struct request_queue *, struct request *); |
@@ -173,15 +174,15 @@ enum { | |||
173 | #define rb_entry_rq(node) rb_entry((node), struct request, rb_node) | 174 | #define rb_entry_rq(node) rb_entry((node), struct request, rb_node) |
174 | 175 | ||
175 | /* | 176 | /* |
176 | * Hack to reuse the donelist list_head as the fifo time holder while | 177 | * Hack to reuse the csd.list list_head as the fifo time holder while |
177 | * the request is in the io scheduler. Saves an unsigned long in rq. | 178 | * the request is in the io scheduler. Saves an unsigned long in rq. |
178 | */ | 179 | */ |
179 | #define rq_fifo_time(rq) ((unsigned long) (rq)->donelist.next) | 180 | #define rq_fifo_time(rq) ((unsigned long) (rq)->csd.list.next) |
180 | #define rq_set_fifo_time(rq,exp) ((rq)->donelist.next = (void *) (exp)) | 181 | #define rq_set_fifo_time(rq,exp) ((rq)->csd.list.next = (void *) (exp)) |
181 | #define rq_entry_fifo(ptr) list_entry((ptr), struct request, queuelist) | 182 | #define rq_entry_fifo(ptr) list_entry((ptr), struct request, queuelist) |
182 | #define rq_fifo_clear(rq) do { \ | 183 | #define rq_fifo_clear(rq) do { \ |
183 | list_del_init(&(rq)->queuelist); \ | 184 | list_del_init(&(rq)->queuelist); \ |
184 | INIT_LIST_HEAD(&(rq)->donelist); \ | 185 | INIT_LIST_HEAD(&(rq)->csd.list); \ |
185 | } while (0) | 186 | } while (0) |
186 | 187 | ||
187 | /* | 188 | /* |
diff --git a/include/linux/elf.h b/include/linux/elf.h index ff9fbed90123..0b61ca41a044 100644 --- a/include/linux/elf.h +++ b/include/linux/elf.h | |||
@@ -358,7 +358,9 @@ typedef struct elf64_shdr { | |||
358 | #define NT_PRXFPREG 0x46e62b7f /* copied from gdb5.1/include/elf/common.h */ | 358 | #define NT_PRXFPREG 0x46e62b7f /* copied from gdb5.1/include/elf/common.h */ |
359 | #define NT_PPC_VMX 0x100 /* PowerPC Altivec/VMX registers */ | 359 | #define NT_PPC_VMX 0x100 /* PowerPC Altivec/VMX registers */ |
360 | #define NT_PPC_SPE 0x101 /* PowerPC SPE/EVR registers */ | 360 | #define NT_PPC_SPE 0x101 /* PowerPC SPE/EVR registers */ |
361 | #define NT_PPC_VSX 0x102 /* PowerPC VSX registers */ | ||
361 | #define NT_386_TLS 0x200 /* i386 TLS slots (struct user_desc) */ | 362 | #define NT_386_TLS 0x200 /* i386 TLS slots (struct user_desc) */ |
363 | #define NT_386_IOPERM 0x201 /* x86 io permission bitmap (1=deny) */ | ||
362 | 364 | ||
363 | 365 | ||
364 | /* Note header in a PT_NOTE section */ | 366 | /* Note header in a PT_NOTE section */ |
diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h index c8d216357865..b4b038b89ee6 100644 --- a/include/linux/ethtool.h +++ b/include/linux/ethtool.h | |||
@@ -27,9 +27,24 @@ struct ethtool_cmd { | |||
27 | __u8 autoneg; /* Enable or disable autonegotiation */ | 27 | __u8 autoneg; /* Enable or disable autonegotiation */ |
28 | __u32 maxtxpkt; /* Tx pkts before generating tx int */ | 28 | __u32 maxtxpkt; /* Tx pkts before generating tx int */ |
29 | __u32 maxrxpkt; /* Rx pkts before generating rx int */ | 29 | __u32 maxrxpkt; /* Rx pkts before generating rx int */ |
30 | __u32 reserved[4]; | 30 | __u16 speed_hi; |
31 | __u16 reserved2; | ||
32 | __u32 reserved[3]; | ||
31 | }; | 33 | }; |
32 | 34 | ||
35 | static inline void ethtool_cmd_speed_set(struct ethtool_cmd *ep, | ||
36 | __u32 speed) | ||
37 | { | ||
38 | |||
39 | ep->speed = (__u16)speed; | ||
40 | ep->speed_hi = (__u16)(speed >> 16); | ||
41 | } | ||
42 | |||
43 | static inline __u32 ethtool_cmd_speed(struct ethtool_cmd *ep) | ||
44 | { | ||
45 | return (ep->speed_hi << 16) | ep->speed; | ||
46 | } | ||
47 | |||
33 | #define ETHTOOL_BUSINFO_LEN 32 | 48 | #define ETHTOOL_BUSINFO_LEN 32 |
34 | /* these strings are set to whatever the driver author decides... */ | 49 | /* these strings are set to whatever the driver author decides... */ |
35 | struct ethtool_drvinfo { | 50 | struct ethtool_drvinfo { |
@@ -272,6 +287,12 @@ enum ethtool_flags { | |||
272 | ETH_FLAG_LRO = (1 << 15), /* LRO is enabled */ | 287 | ETH_FLAG_LRO = (1 << 15), /* LRO is enabled */ |
273 | }; | 288 | }; |
274 | 289 | ||
290 | struct ethtool_rxnfc { | ||
291 | __u32 cmd; | ||
292 | __u32 flow_type; | ||
293 | __u64 data; | ||
294 | }; | ||
295 | |||
275 | #ifdef __KERNEL__ | 296 | #ifdef __KERNEL__ |
276 | 297 | ||
277 | struct net_device; | 298 | struct net_device; |
@@ -396,6 +417,8 @@ struct ethtool_ops { | |||
396 | /* the following hooks are obsolete */ | 417 | /* the following hooks are obsolete */ |
397 | int (*self_test_count)(struct net_device *);/* use get_sset_count */ | 418 | int (*self_test_count)(struct net_device *);/* use get_sset_count */ |
398 | int (*get_stats_count)(struct net_device *);/* use get_sset_count */ | 419 | int (*get_stats_count)(struct net_device *);/* use get_sset_count */ |
420 | int (*get_rxhash)(struct net_device *, struct ethtool_rxnfc *); | ||
421 | int (*set_rxhash)(struct net_device *, struct ethtool_rxnfc *); | ||
399 | }; | 422 | }; |
400 | #endif /* __KERNEL__ */ | 423 | #endif /* __KERNEL__ */ |
401 | 424 | ||
@@ -442,6 +465,9 @@ struct ethtool_ops { | |||
442 | #define ETHTOOL_GPFLAGS 0x00000027 /* Get driver-private flags bitmap */ | 465 | #define ETHTOOL_GPFLAGS 0x00000027 /* Get driver-private flags bitmap */ |
443 | #define ETHTOOL_SPFLAGS 0x00000028 /* Set driver-private flags bitmap */ | 466 | #define ETHTOOL_SPFLAGS 0x00000028 /* Set driver-private flags bitmap */ |
444 | 467 | ||
468 | #define ETHTOOL_GRXFH 0x00000029 /* Get RX flow hash configuration */ | ||
469 | #define ETHTOOL_SRXFH 0x0000002a /* Set RX flow hash configuration */ | ||
470 | |||
445 | /* compatibility with older code */ | 471 | /* compatibility with older code */ |
446 | #define SPARC_ETH_GSET ETHTOOL_GSET | 472 | #define SPARC_ETH_GSET ETHTOOL_GSET |
447 | #define SPARC_ETH_SSET ETHTOOL_SSET | 473 | #define SPARC_ETH_SSET ETHTOOL_SSET |
@@ -528,4 +554,26 @@ struct ethtool_ops { | |||
528 | #define WAKE_MAGIC (1 << 5) | 554 | #define WAKE_MAGIC (1 << 5) |
529 | #define WAKE_MAGICSECURE (1 << 6) /* only meaningful if WAKE_MAGIC */ | 555 | #define WAKE_MAGICSECURE (1 << 6) /* only meaningful if WAKE_MAGIC */ |
530 | 556 | ||
557 | /* L3-L4 network traffic flow types */ | ||
558 | #define TCP_V4_FLOW 0x01 | ||
559 | #define UDP_V4_FLOW 0x02 | ||
560 | #define SCTP_V4_FLOW 0x03 | ||
561 | #define AH_ESP_V4_FLOW 0x04 | ||
562 | #define TCP_V6_FLOW 0x05 | ||
563 | #define UDP_V6_FLOW 0x06 | ||
564 | #define SCTP_V6_FLOW 0x07 | ||
565 | #define AH_ESP_V6_FLOW 0x08 | ||
566 | |||
567 | /* L3-L4 network traffic flow hash options */ | ||
568 | #define RXH_DEV_PORT (1 << 0) | ||
569 | #define RXH_L2DA (1 << 1) | ||
570 | #define RXH_VLAN (1 << 2) | ||
571 | #define RXH_L3_PROTO (1 << 3) | ||
572 | #define RXH_IP_SRC (1 << 4) | ||
573 | #define RXH_IP_DST (1 << 5) | ||
574 | #define RXH_L4_B_0_1 (1 << 6) /* src port in case of TCP/UDP/SCTP */ | ||
575 | #define RXH_L4_B_2_3 (1 << 7) /* dst port in case of TCP/UDP/SCTP */ | ||
576 | #define RXH_DISCARD (1 << 31) | ||
577 | |||
578 | |||
531 | #endif /* _LINUX_ETHTOOL_H */ | 579 | #endif /* _LINUX_ETHTOOL_H */ |
diff --git a/include/linux/eventfd.h b/include/linux/eventfd.h index a701399b7fed..a667637b54e3 100644 --- a/include/linux/eventfd.h +++ b/include/linux/eventfd.h | |||
@@ -10,6 +10,13 @@ | |||
10 | 10 | ||
11 | #ifdef CONFIG_EVENTFD | 11 | #ifdef CONFIG_EVENTFD |
12 | 12 | ||
13 | /* For O_CLOEXEC and O_NONBLOCK */ | ||
14 | #include <linux/fcntl.h> | ||
15 | |||
16 | /* Flags for eventfd2. */ | ||
17 | #define EFD_CLOEXEC O_CLOEXEC | ||
18 | #define EFD_NONBLOCK O_NONBLOCK | ||
19 | |||
13 | struct file *eventfd_fget(int fd); | 20 | struct file *eventfd_fget(int fd); |
14 | int eventfd_signal(struct file *file, int n); | 21 | int eventfd_signal(struct file *file, int n); |
15 | 22 | ||
diff --git a/include/linux/eventpoll.h b/include/linux/eventpoll.h index cf79853967ff..f1e1d3c47125 100644 --- a/include/linux/eventpoll.h +++ b/include/linux/eventpoll.h | |||
@@ -14,8 +14,12 @@ | |||
14 | #ifndef _LINUX_EVENTPOLL_H | 14 | #ifndef _LINUX_EVENTPOLL_H |
15 | #define _LINUX_EVENTPOLL_H | 15 | #define _LINUX_EVENTPOLL_H |
16 | 16 | ||
17 | /* For O_CLOEXEC */ | ||
18 | #include <linux/fcntl.h> | ||
17 | #include <linux/types.h> | 19 | #include <linux/types.h> |
18 | 20 | ||
21 | /* Flags for epoll_create1. */ | ||
22 | #define EPOLL_CLOEXEC O_CLOEXEC | ||
19 | 23 | ||
20 | /* Valid opcodes to issue to sys_epoll_ctl() */ | 24 | /* Valid opcodes to issue to sys_epoll_ctl() */ |
21 | #define EPOLL_CTL_ADD 1 | 25 | #define EPOLL_CTL_ADD 1 |
diff --git a/include/linux/exportfs.h b/include/linux/exportfs.h index f5abd1306638..27e772cefb6a 100644 --- a/include/linux/exportfs.h +++ b/include/linux/exportfs.h | |||
@@ -35,6 +35,27 @@ enum fid_type { | |||
35 | FILEID_INO32_GEN_PARENT = 2, | 35 | FILEID_INO32_GEN_PARENT = 2, |
36 | 36 | ||
37 | /* | 37 | /* |
38 | * 64 bit object ID, 64 bit root object ID, | ||
39 | * 32 bit generation number. | ||
40 | */ | ||
41 | FILEID_BTRFS_WITHOUT_PARENT = 0x4d, | ||
42 | |||
43 | /* | ||
44 | * 64 bit object ID, 64 bit root object ID, | ||
45 | * 32 bit generation number, | ||
46 | * 64 bit parent object ID, 32 bit parent generation. | ||
47 | */ | ||
48 | FILEID_BTRFS_WITH_PARENT = 0x4e, | ||
49 | |||
50 | /* | ||
51 | * 64 bit object ID, 64 bit root object ID, | ||
52 | * 32 bit generation number, | ||
53 | * 64 bit parent object ID, 32 bit parent generation, | ||
54 | * 64 bit parent root object ID. | ||
55 | */ | ||
56 | FILEID_BTRFS_WITH_PARENT_ROOT = 0x4f, | ||
57 | |||
58 | /* | ||
38 | * 32 bit block number, 16 bit partition reference, | 59 | * 32 bit block number, 16 bit partition reference, |
39 | * 16 bit unused, 32 bit generation number. | 60 | * 16 bit unused, 32 bit generation number. |
40 | */ | 61 | */ |
diff --git a/include/linux/ext2_fs.h b/include/linux/ext2_fs.h index 84cec2aa9f1e..2efe7b863cff 100644 --- a/include/linux/ext2_fs.h +++ b/include/linux/ext2_fs.h | |||
@@ -284,8 +284,8 @@ struct ext2_inode { | |||
284 | 284 | ||
285 | #ifdef __hurd__ | 285 | #ifdef __hurd__ |
286 | #define i_translator osd1.hurd1.h_i_translator | 286 | #define i_translator osd1.hurd1.h_i_translator |
287 | #define i_frag osd2.hurd2.h_i_frag; | 287 | #define i_frag osd2.hurd2.h_i_frag |
288 | #define i_fsize osd2.hurd2.h_i_fsize; | 288 | #define i_fsize osd2.hurd2.h_i_fsize |
289 | #define i_uid_high osd2.hurd2.h_i_uid_high | 289 | #define i_uid_high osd2.hurd2.h_i_uid_high |
290 | #define i_gid_high osd2.hurd2.h_i_gid_high | 290 | #define i_gid_high osd2.hurd2.h_i_gid_high |
291 | #define i_author osd2.hurd2.h_i_author | 291 | #define i_author osd2.hurd2.h_i_author |
diff --git a/include/linux/ext3_fs.h b/include/linux/ext3_fs.h index 36c540396377..8120fa1bc235 100644 --- a/include/linux/ext3_fs.h +++ b/include/linux/ext3_fs.h | |||
@@ -832,10 +832,13 @@ extern void ext3_discard_reservation (struct inode *); | |||
832 | extern void ext3_dirty_inode(struct inode *); | 832 | extern void ext3_dirty_inode(struct inode *); |
833 | extern int ext3_change_inode_journal_flag(struct inode *, int); | 833 | extern int ext3_change_inode_journal_flag(struct inode *, int); |
834 | extern int ext3_get_inode_loc(struct inode *, struct ext3_iloc *); | 834 | extern int ext3_get_inode_loc(struct inode *, struct ext3_iloc *); |
835 | extern int ext3_can_truncate(struct inode *inode); | ||
835 | extern void ext3_truncate (struct inode *); | 836 | extern void ext3_truncate (struct inode *); |
836 | extern void ext3_set_inode_flags(struct inode *); | 837 | extern void ext3_set_inode_flags(struct inode *); |
837 | extern void ext3_get_inode_flags(struct ext3_inode_info *); | 838 | extern void ext3_get_inode_flags(struct ext3_inode_info *); |
838 | extern void ext3_set_aops(struct inode *inode); | 839 | extern void ext3_set_aops(struct inode *inode); |
840 | extern int ext3_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo, | ||
841 | u64 start, u64 len); | ||
839 | 842 | ||
840 | /* ioctl.c */ | 843 | /* ioctl.c */ |
841 | extern int ext3_ioctl (struct inode *, struct file *, unsigned int, | 844 | extern int ext3_ioctl (struct inode *, struct file *, unsigned int, |
diff --git a/include/linux/fb.h b/include/linux/fb.h index 72295b099228..531ccd5f5960 100644 --- a/include/linux/fb.h +++ b/include/linux/fb.h | |||
@@ -8,7 +8,6 @@ struct dentry; | |||
8 | 8 | ||
9 | /* Definitions of frame buffers */ | 9 | /* Definitions of frame buffers */ |
10 | 10 | ||
11 | #define FB_MAJOR 29 | ||
12 | #define FB_MAX 32 /* sufficient for now */ | 11 | #define FB_MAX 32 /* sufficient for now */ |
13 | 12 | ||
14 | /* ioctls | 13 | /* ioctls |
@@ -120,6 +119,10 @@ struct dentry; | |||
120 | #define FB_ACCEL_XGI_VOLARI_V 47 /* XGI Volari V3XT, V5, V8 */ | 119 | #define FB_ACCEL_XGI_VOLARI_V 47 /* XGI Volari V3XT, V5, V8 */ |
121 | #define FB_ACCEL_XGI_VOLARI_Z 48 /* XGI Volari Z7 */ | 120 | #define FB_ACCEL_XGI_VOLARI_Z 48 /* XGI Volari Z7 */ |
122 | #define FB_ACCEL_OMAP1610 49 /* TI OMAP16xx */ | 121 | #define FB_ACCEL_OMAP1610 49 /* TI OMAP16xx */ |
122 | #define FB_ACCEL_TRIDENT_TGUI 50 /* Trident TGUI */ | ||
123 | #define FB_ACCEL_TRIDENT_3DIMAGE 51 /* Trident 3DImage */ | ||
124 | #define FB_ACCEL_TRIDENT_BLADE3D 52 /* Trident Blade3D */ | ||
125 | #define FB_ACCEL_TRIDENT_BLADEXP 53 /* Trident BladeXP */ | ||
123 | #define FB_ACCEL_NEOMAGIC_NM2070 90 /* NeoMagic NM2070 */ | 126 | #define FB_ACCEL_NEOMAGIC_NM2070 90 /* NeoMagic NM2070 */ |
124 | #define FB_ACCEL_NEOMAGIC_NM2090 91 /* NeoMagic NM2090 */ | 127 | #define FB_ACCEL_NEOMAGIC_NM2090 91 /* NeoMagic NM2090 */ |
125 | #define FB_ACCEL_NEOMAGIC_NM2093 92 /* NeoMagic NM2093 */ | 128 | #define FB_ACCEL_NEOMAGIC_NM2093 92 /* NeoMagic NM2093 */ |
@@ -973,6 +976,9 @@ static inline void __fb_pad_aligned_buffer(u8 *dst, u32 d_pitch, | |||
973 | 976 | ||
974 | /* drivers/video/fb_defio.c */ | 977 | /* drivers/video/fb_defio.c */ |
975 | extern void fb_deferred_io_init(struct fb_info *info); | 978 | extern void fb_deferred_io_init(struct fb_info *info); |
979 | extern void fb_deferred_io_open(struct fb_info *info, | ||
980 | struct inode *inode, | ||
981 | struct file *file); | ||
976 | extern void fb_deferred_io_cleanup(struct fb_info *info); | 982 | extern void fb_deferred_io_cleanup(struct fb_info *info); |
977 | extern int fb_deferred_io_fsync(struct file *file, struct dentry *dentry, | 983 | extern int fb_deferred_io_fsync(struct file *file, struct dentry *dentry, |
978 | int datasync); | 984 | int datasync); |
diff --git a/include/linux/fd.h b/include/linux/fd.h index b6bd41d2b460..f5d194af07a8 100644 --- a/include/linux/fd.h +++ b/include/linux/fd.h | |||
@@ -15,10 +15,16 @@ struct floppy_struct { | |||
15 | sect, /* sectors per track */ | 15 | sect, /* sectors per track */ |
16 | head, /* nr of heads */ | 16 | head, /* nr of heads */ |
17 | track, /* nr of tracks */ | 17 | track, /* nr of tracks */ |
18 | stretch; /* !=0 means double track steps */ | 18 | stretch; /* bit 0 !=0 means double track steps */ |
19 | /* bit 1 != 0 means swap sides */ | ||
20 | /* bits 2..9 give the first sector */ | ||
21 | /* number (the LSB is flipped) */ | ||
19 | #define FD_STRETCH 1 | 22 | #define FD_STRETCH 1 |
20 | #define FD_SWAPSIDES 2 | 23 | #define FD_SWAPSIDES 2 |
21 | #define FD_ZEROBASED 4 | 24 | #define FD_ZEROBASED 4 |
25 | #define FD_SECTBASEMASK 0x3FC | ||
26 | #define FD_MKSECTBASE(s) (((s) ^ 1) << 2) | ||
27 | #define FD_SECTBASE(floppy) ((((floppy)->stretch & FD_SECTBASEMASK) >> 2) ^ 1) | ||
22 | 28 | ||
23 | unsigned char gap, /* gap1 size */ | 29 | unsigned char gap, /* gap1 size */ |
24 | 30 | ||
diff --git a/include/linux/fd1772.h b/include/linux/fd1772.h deleted file mode 100644 index 871d6e4c677e..000000000000 --- a/include/linux/fd1772.h +++ /dev/null | |||
@@ -1,80 +0,0 @@ | |||
1 | #ifndef _LINUX_FD1772REG_H | ||
2 | #define _LINUX_FD1772REG_H | ||
3 | |||
4 | /* | ||
5 | ** WD1772 stuff - originally from the M68K Linux | ||
6 | * Modified for Archimedes by Dave Gilbert (gilbertd@cs.man.ac.uk) | ||
7 | */ | ||
8 | |||
9 | /* register codes */ | ||
10 | |||
11 | #define FDC1772SELREG_STP (0x80) /* command/status register */ | ||
12 | #define FDC1772SELREG_TRA (0x82) /* track register */ | ||
13 | #define FDC1772SELREG_SEC (0x84) /* sector register */ | ||
14 | #define FDC1772SELREG_DTA (0x86) /* data register */ | ||
15 | |||
16 | /* register names for FDC1772_READ/WRITE macros */ | ||
17 | |||
18 | #define FDC1772REG_CMD 0 | ||
19 | #define FDC1772REG_STATUS 0 | ||
20 | #define FDC1772REG_TRACK 2 | ||
21 | #define FDC1772REG_SECTOR 4 | ||
22 | #define FDC1772REG_DATA 6 | ||
23 | |||
24 | /* command opcodes */ | ||
25 | |||
26 | #define FDC1772CMD_RESTORE (0x00) /* - */ | ||
27 | #define FDC1772CMD_SEEK (0x10) /* | */ | ||
28 | #define FDC1772CMD_STEP (0x20) /* | TYP 1 Commands */ | ||
29 | #define FDC1772CMD_STIN (0x40) /* | */ | ||
30 | #define FDC1772CMD_STOT (0x60) /* - */ | ||
31 | #define FDC1772CMD_RDSEC (0x80) /* - TYP 2 Commands */ | ||
32 | #define FDC1772CMD_WRSEC (0xa0) /* - " */ | ||
33 | #define FDC1772CMD_RDADR (0xc0) /* - */ | ||
34 | #define FDC1772CMD_RDTRA (0xe0) /* | TYP 3 Commands */ | ||
35 | #define FDC1772CMD_WRTRA (0xf0) /* - */ | ||
36 | #define FDC1772CMD_FORCI (0xd0) /* - TYP 4 Command */ | ||
37 | |||
38 | /* command modifier bits */ | ||
39 | |||
40 | #define FDC1772CMDADD_SR6 (0x00) /* step rate settings */ | ||
41 | #define FDC1772CMDADD_SR12 (0x01) | ||
42 | #define FDC1772CMDADD_SR2 (0x02) | ||
43 | #define FDC1772CMDADD_SR3 (0x03) | ||
44 | #define FDC1772CMDADD_V (0x04) /* verify */ | ||
45 | #define FDC1772CMDADD_H (0x08) /* wait for spin-up */ | ||
46 | #define FDC1772CMDADD_U (0x10) /* update track register */ | ||
47 | #define FDC1772CMDADD_M (0x10) /* multiple sector access */ | ||
48 | #define FDC1772CMDADD_E (0x04) /* head settling flag */ | ||
49 | #define FDC1772CMDADD_P (0x02) /* precompensation */ | ||
50 | #define FDC1772CMDADD_A0 (0x01) /* DAM flag */ | ||
51 | |||
52 | /* status register bits */ | ||
53 | |||
54 | #define FDC1772STAT_MOTORON (0x80) /* motor on */ | ||
55 | #define FDC1772STAT_WPROT (0x40) /* write protected (FDC1772CMD_WR*) */ | ||
56 | #define FDC1772STAT_SPINUP (0x20) /* motor speed stable (Type I) */ | ||
57 | #define FDC1772STAT_DELDAM (0x20) /* sector has deleted DAM (Type II+III) */ | ||
58 | #define FDC1772STAT_RECNF (0x10) /* record not found */ | ||
59 | #define FDC1772STAT_CRC (0x08) /* CRC error */ | ||
60 | #define FDC1772STAT_TR00 (0x04) /* Track 00 flag (Type I) */ | ||
61 | #define FDC1772STAT_LOST (0x04) /* Lost Data (Type II+III) */ | ||
62 | #define FDC1772STAT_IDX (0x02) /* Index status (Type I) */ | ||
63 | #define FDC1772STAT_DRQ (0x02) /* DRQ status (Type II+III) */ | ||
64 | #define FDC1772STAT_BUSY (0x01) /* FDC1772 is busy */ | ||
65 | |||
66 | |||
67 | /* PSG Port A Bit Nr 0 .. Side Sel .. 0 -> Side 1 1 -> Side 2 */ | ||
68 | #define DSKSIDE (0x01) | ||
69 | |||
70 | #define DSKDRVNONE (0x06) | ||
71 | #define DSKDRV0 (0x02) | ||
72 | #define DSKDRV1 (0x04) | ||
73 | |||
74 | /* step rates */ | ||
75 | #define FDC1772STEP_6 0x00 | ||
76 | #define FDC1772STEP_12 0x01 | ||
77 | #define FDC1772STEP_2 0x02 | ||
78 | #define FDC1772STEP_3 0x03 | ||
79 | |||
80 | #endif | ||
diff --git a/include/linux/fiemap.h b/include/linux/fiemap.h new file mode 100644 index 000000000000..671decbd2aeb --- /dev/null +++ b/include/linux/fiemap.h | |||
@@ -0,0 +1,64 @@ | |||
1 | /* | ||
2 | * FS_IOC_FIEMAP ioctl infrastructure. | ||
3 | * | ||
4 | * Some portions copyright (C) 2007 Cluster File Systems, Inc | ||
5 | * | ||
6 | * Authors: Mark Fasheh <mfasheh@suse.com> | ||
7 | * Kalpak Shah <kalpak.shah@sun.com> | ||
8 | * Andreas Dilger <adilger@sun.com> | ||
9 | */ | ||
10 | |||
11 | #ifndef _LINUX_FIEMAP_H | ||
12 | #define _LINUX_FIEMAP_H | ||
13 | |||
14 | struct fiemap_extent { | ||
15 | __u64 fe_logical; /* logical offset in bytes for the start of | ||
16 | * the extent from the beginning of the file */ | ||
17 | __u64 fe_physical; /* physical offset in bytes for the start | ||
18 | * of the extent from the beginning of the disk */ | ||
19 | __u64 fe_length; /* length in bytes for this extent */ | ||
20 | __u64 fe_reserved64[2]; | ||
21 | __u32 fe_flags; /* FIEMAP_EXTENT_* flags for this extent */ | ||
22 | __u32 fe_reserved[3]; | ||
23 | }; | ||
24 | |||
25 | struct fiemap { | ||
26 | __u64 fm_start; /* logical offset (inclusive) at | ||
27 | * which to start mapping (in) */ | ||
28 | __u64 fm_length; /* logical length of mapping which | ||
29 | * userspace wants (in) */ | ||
30 | __u32 fm_flags; /* FIEMAP_FLAG_* flags for request (in/out) */ | ||
31 | __u32 fm_mapped_extents;/* number of extents that were mapped (out) */ | ||
32 | __u32 fm_extent_count; /* size of fm_extents array (in) */ | ||
33 | __u32 fm_reserved; | ||
34 | struct fiemap_extent fm_extents[0]; /* array of mapped extents (out) */ | ||
35 | }; | ||
36 | |||
37 | #define FIEMAP_MAX_OFFSET (~0ULL) | ||
38 | |||
39 | #define FIEMAP_FLAG_SYNC 0x00000001 /* sync file data before map */ | ||
40 | #define FIEMAP_FLAG_XATTR 0x00000002 /* map extended attribute tree */ | ||
41 | |||
42 | #define FIEMAP_FLAGS_COMPAT (FIEMAP_FLAG_SYNC | FIEMAP_FLAG_XATTR) | ||
43 | |||
44 | #define FIEMAP_EXTENT_LAST 0x00000001 /* Last extent in file. */ | ||
45 | #define FIEMAP_EXTENT_UNKNOWN 0x00000002 /* Data location unknown. */ | ||
46 | #define FIEMAP_EXTENT_DELALLOC 0x00000004 /* Location still pending. | ||
47 | * Sets EXTENT_UNKNOWN. */ | ||
48 | #define FIEMAP_EXTENT_ENCODED 0x00000008 /* Data can not be read | ||
49 | * while fs is unmounted */ | ||
50 | #define FIEMAP_EXTENT_DATA_ENCRYPTED 0x00000080 /* Data is encrypted by fs. | ||
51 | * Sets EXTENT_NO_BYPASS. */ | ||
52 | #define FIEMAP_EXTENT_NOT_ALIGNED 0x00000100 /* Extent offsets may not be | ||
53 | * block aligned. */ | ||
54 | #define FIEMAP_EXTENT_DATA_INLINE 0x00000200 /* Data mixed with metadata. | ||
55 | * Sets EXTENT_NOT_ALIGNED.*/ | ||
56 | #define FIEMAP_EXTENT_DATA_TAIL 0x00000400 /* Multiple files in block. | ||
57 | * Sets EXTENT_NOT_ALIGNED.*/ | ||
58 | #define FIEMAP_EXTENT_UNWRITTEN 0x00000800 /* Space allocated, but | ||
59 | * no data (i.e. zero). */ | ||
60 | #define FIEMAP_EXTENT_MERGED 0x00001000 /* File does not natively | ||
61 | * support extents. Result | ||
62 | * merged for efficiency. */ | ||
63 | |||
64 | #endif /* _LINUX_FIEMAP_H */ | ||
diff --git a/include/linux/file.h b/include/linux/file.h index 27c64bdc68c9..a20259e248a5 100644 --- a/include/linux/file.h +++ b/include/linux/file.h | |||
@@ -34,8 +34,9 @@ extern struct file *fget(unsigned int fd); | |||
34 | extern struct file *fget_light(unsigned int fd, int *fput_needed); | 34 | extern struct file *fget_light(unsigned int fd, int *fput_needed); |
35 | extern void set_close_on_exec(unsigned int fd, int flag); | 35 | extern void set_close_on_exec(unsigned int fd, int flag); |
36 | extern void put_filp(struct file *); | 36 | extern void put_filp(struct file *); |
37 | extern int alloc_fd(unsigned start, unsigned flags); | ||
37 | extern int get_unused_fd(void); | 38 | extern int get_unused_fd(void); |
38 | extern int get_unused_fd_flags(int flags); | 39 | #define get_unused_fd_flags(flags) alloc_fd(0, (flags)) |
39 | extern void put_unused_fd(unsigned int fd); | 40 | extern void put_unused_fd(unsigned int fd); |
40 | 41 | ||
41 | extern void fd_install(unsigned int fd, struct file *file); | 42 | extern void fd_install(unsigned int fd, struct file *file); |
diff --git a/include/linux/firmware-map.h b/include/linux/firmware-map.h new file mode 100644 index 000000000000..6e199c8dfacc --- /dev/null +++ b/include/linux/firmware-map.h | |||
@@ -0,0 +1,48 @@ | |||
1 | /* | ||
2 | * include/linux/firmware-map.h: | ||
3 | * Copyright (C) 2008 SUSE LINUX Products GmbH | ||
4 | * by Bernhard Walle <bwalle@suse.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 v2.0 as published by | ||
8 | * the Free Software Foundation | ||
9 | * | ||
10 | * This program is distributed in the hope that it will be useful, | ||
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | * GNU General Public License for more details. | ||
14 | * | ||
15 | */ | ||
16 | #ifndef _LINUX_FIRMWARE_MAP_H | ||
17 | #define _LINUX_FIRMWARE_MAP_H | ||
18 | |||
19 | #include <linux/list.h> | ||
20 | #include <linux/kobject.h> | ||
21 | |||
22 | /* | ||
23 | * provide a dummy interface if CONFIG_FIRMWARE_MEMMAP is disabled | ||
24 | */ | ||
25 | #ifdef CONFIG_FIRMWARE_MEMMAP | ||
26 | |||
27 | int firmware_map_add(resource_size_t start, resource_size_t end, | ||
28 | const char *type); | ||
29 | int firmware_map_add_early(resource_size_t start, resource_size_t end, | ||
30 | const char *type); | ||
31 | |||
32 | #else /* CONFIG_FIRMWARE_MEMMAP */ | ||
33 | |||
34 | static inline int firmware_map_add(resource_size_t start, resource_size_t end, | ||
35 | const char *type) | ||
36 | { | ||
37 | return 0; | ||
38 | } | ||
39 | |||
40 | static inline int firmware_map_add_early(resource_size_t start, | ||
41 | resource_size_t end, const char *type) | ||
42 | { | ||
43 | return 0; | ||
44 | } | ||
45 | |||
46 | #endif /* CONFIG_FIRMWARE_MEMMAP */ | ||
47 | |||
48 | #endif /* _LINUX_FIRMWARE_MAP_H */ | ||
diff --git a/include/linux/firmware.h b/include/linux/firmware.h index 4d10c7328d2d..c8ecf5b2a207 100644 --- a/include/linux/firmware.h +++ b/include/linux/firmware.h | |||
@@ -1,19 +1,40 @@ | |||
1 | #ifndef _LINUX_FIRMWARE_H | 1 | #ifndef _LINUX_FIRMWARE_H |
2 | #define _LINUX_FIRMWARE_H | 2 | #define _LINUX_FIRMWARE_H |
3 | |||
3 | #include <linux/module.h> | 4 | #include <linux/module.h> |
4 | #include <linux/types.h> | 5 | #include <linux/types.h> |
6 | #include <linux/compiler.h> | ||
7 | |||
5 | #define FIRMWARE_NAME_MAX 30 | 8 | #define FIRMWARE_NAME_MAX 30 |
6 | #define FW_ACTION_NOHOTPLUG 0 | 9 | #define FW_ACTION_NOHOTPLUG 0 |
7 | #define FW_ACTION_HOTPLUG 1 | 10 | #define FW_ACTION_HOTPLUG 1 |
8 | 11 | ||
9 | struct firmware { | 12 | struct firmware { |
10 | size_t size; | 13 | size_t size; |
11 | u8 *data; | 14 | const u8 *data; |
12 | }; | 15 | }; |
13 | 16 | ||
14 | struct device; | 17 | struct device; |
15 | 18 | ||
16 | #if defined(CONFIG_FW_LOADER) || defined(CONFIG_FW_LOADER_MODULE) | 19 | struct builtin_fw { |
20 | char *name; | ||
21 | void *data; | ||
22 | unsigned long size; | ||
23 | }; | ||
24 | |||
25 | /* We have to play tricks here much like stringify() to get the | ||
26 | __COUNTER__ macro to be expanded as we want it */ | ||
27 | #define __fw_concat1(x, y) x##y | ||
28 | #define __fw_concat(x, y) __fw_concat1(x, y) | ||
29 | |||
30 | #define DECLARE_BUILTIN_FIRMWARE(name, blob) \ | ||
31 | DECLARE_BUILTIN_FIRMWARE_SIZE(name, &(blob), sizeof(blob)) | ||
32 | |||
33 | #define DECLARE_BUILTIN_FIRMWARE_SIZE(name, blob, size) \ | ||
34 | static const struct builtin_fw __fw_concat(__builtin_fw,__COUNTER__) \ | ||
35 | __used __section(.builtin_fw) = { name, blob, size } | ||
36 | |||
37 | #if defined(CONFIG_FW_LOADER) || (defined(CONFIG_FW_LOADER_MODULE) && defined(MODULE)) | ||
17 | int request_firmware(const struct firmware **fw, const char *name, | 38 | int request_firmware(const struct firmware **fw, const char *name, |
18 | struct device *device); | 39 | struct device *device); |
19 | int request_firmware_nowait( | 40 | int request_firmware_nowait( |
diff --git a/include/linux/freezer.h b/include/linux/freezer.h index 08934995c7ab..deddeedf3257 100644 --- a/include/linux/freezer.h +++ b/include/linux/freezer.h | |||
@@ -128,6 +128,15 @@ static inline void set_freezable(void) | |||
128 | } | 128 | } |
129 | 129 | ||
130 | /* | 130 | /* |
131 | * Tell the freezer that the current task should be frozen by it and that it | ||
132 | * should send a fake signal to the task to freeze it. | ||
133 | */ | ||
134 | static inline void set_freezable_with_signal(void) | ||
135 | { | ||
136 | current->flags &= ~(PF_NOFREEZE | PF_FREEZER_NOSIG); | ||
137 | } | ||
138 | |||
139 | /* | ||
131 | * Freezer-friendly wrappers around wait_event_interruptible() and | 140 | * Freezer-friendly wrappers around wait_event_interruptible() and |
132 | * wait_event_interruptible_timeout(), originally defined in <linux/wait.h> | 141 | * wait_event_interruptible_timeout(), originally defined in <linux/wait.h> |
133 | */ | 142 | */ |
@@ -174,6 +183,7 @@ static inline void freezer_do_not_count(void) {} | |||
174 | static inline void freezer_count(void) {} | 183 | static inline void freezer_count(void) {} |
175 | static inline int freezer_should_skip(struct task_struct *p) { return 0; } | 184 | static inline int freezer_should_skip(struct task_struct *p) { return 0; } |
176 | static inline void set_freezable(void) {} | 185 | static inline void set_freezable(void) {} |
186 | static inline void set_freezable_with_signal(void) {} | ||
177 | 187 | ||
178 | #define wait_event_freezable(wq, condition) \ | 188 | #define wait_event_freezable(wq, condition) \ |
179 | wait_event_interruptible(wq, condition) | 189 | wait_event_interruptible(wq, condition) |
diff --git a/include/linux/fs.h b/include/linux/fs.h index d490779f18d9..a6a625be13fc 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h | |||
@@ -60,6 +60,8 @@ extern int dir_notify_enable; | |||
60 | #define MAY_WRITE 2 | 60 | #define MAY_WRITE 2 |
61 | #define MAY_READ 4 | 61 | #define MAY_READ 4 |
62 | #define MAY_APPEND 8 | 62 | #define MAY_APPEND 8 |
63 | #define MAY_ACCESS 16 | ||
64 | #define MAY_OPEN 32 | ||
63 | 65 | ||
64 | #define FMODE_READ 1 | 66 | #define FMODE_READ 1 |
65 | #define FMODE_WRITE 2 | 67 | #define FMODE_WRITE 2 |
@@ -83,7 +85,10 @@ extern int dir_notify_enable; | |||
83 | #define READ_SYNC (READ | (1 << BIO_RW_SYNC)) | 85 | #define READ_SYNC (READ | (1 << BIO_RW_SYNC)) |
84 | #define READ_META (READ | (1 << BIO_RW_META)) | 86 | #define READ_META (READ | (1 << BIO_RW_META)) |
85 | #define WRITE_SYNC (WRITE | (1 << BIO_RW_SYNC)) | 87 | #define WRITE_SYNC (WRITE | (1 << BIO_RW_SYNC)) |
86 | #define WRITE_BARRIER ((1 << BIO_RW) | (1 << BIO_RW_BARRIER)) | 88 | #define SWRITE_SYNC (SWRITE | (1 << BIO_RW_SYNC)) |
89 | #define WRITE_BARRIER (WRITE | (1 << BIO_RW_BARRIER)) | ||
90 | #define DISCARD_NOBARRIER (1 << BIO_RW_DISCARD) | ||
91 | #define DISCARD_BARRIER ((1 << BIO_RW_DISCARD) | (1 << BIO_RW_BARRIER)) | ||
87 | 92 | ||
88 | #define SEL_IN 1 | 93 | #define SEL_IN 1 |
89 | #define SEL_OUT 2 | 94 | #define SEL_OUT 2 |
@@ -219,6 +224,7 @@ extern int dir_notify_enable; | |||
219 | #define BLKTRACESTART _IO(0x12,116) | 224 | #define BLKTRACESTART _IO(0x12,116) |
220 | #define BLKTRACESTOP _IO(0x12,117) | 225 | #define BLKTRACESTOP _IO(0x12,117) |
221 | #define BLKTRACETEARDOWN _IO(0x12,118) | 226 | #define BLKTRACETEARDOWN _IO(0x12,118) |
227 | #define BLKDISCARD _IO(0x12,119) | ||
222 | 228 | ||
223 | #define BMAP_IOCTL 1 /* obsolete - kept for compatibility */ | 229 | #define BMAP_IOCTL 1 /* obsolete - kept for compatibility */ |
224 | #define FIBMAP _IO(0x00,1) /* bmap access */ | 230 | #define FIBMAP _IO(0x00,1) /* bmap access */ |
@@ -228,6 +234,7 @@ extern int dir_notify_enable; | |||
228 | #define FS_IOC_SETFLAGS _IOW('f', 2, long) | 234 | #define FS_IOC_SETFLAGS _IOW('f', 2, long) |
229 | #define FS_IOC_GETVERSION _IOR('v', 1, long) | 235 | #define FS_IOC_GETVERSION _IOR('v', 1, long) |
230 | #define FS_IOC_SETVERSION _IOW('v', 2, long) | 236 | #define FS_IOC_SETVERSION _IOW('v', 2, long) |
237 | #define FS_IOC_FIEMAP _IOWR('f', 11, struct fiemap) | ||
231 | #define FS_IOC32_GETFLAGS _IOR('f', 1, int) | 238 | #define FS_IOC32_GETFLAGS _IOR('f', 1, int) |
232 | #define FS_IOC32_SETFLAGS _IOW('f', 2, int) | 239 | #define FS_IOC32_SETFLAGS _IOW('f', 2, int) |
233 | #define FS_IOC32_GETVERSION _IOR('v', 1, int) | 240 | #define FS_IOC32_GETVERSION _IOR('v', 1, int) |
@@ -276,7 +283,7 @@ extern int dir_notify_enable; | |||
276 | #include <linux/types.h> | 283 | #include <linux/types.h> |
277 | #include <linux/kdev_t.h> | 284 | #include <linux/kdev_t.h> |
278 | #include <linux/dcache.h> | 285 | #include <linux/dcache.h> |
279 | #include <linux/namei.h> | 286 | #include <linux/path.h> |
280 | #include <linux/stat.h> | 287 | #include <linux/stat.h> |
281 | #include <linux/cache.h> | 288 | #include <linux/cache.h> |
282 | #include <linux/kobject.h> | 289 | #include <linux/kobject.h> |
@@ -288,6 +295,7 @@ extern int dir_notify_enable; | |||
288 | #include <linux/mutex.h> | 295 | #include <linux/mutex.h> |
289 | #include <linux/capability.h> | 296 | #include <linux/capability.h> |
290 | #include <linux/semaphore.h> | 297 | #include <linux/semaphore.h> |
298 | #include <linux/fiemap.h> | ||
291 | 299 | ||
292 | #include <asm/atomic.h> | 300 | #include <asm/atomic.h> |
293 | #include <asm/byteorder.h> | 301 | #include <asm/byteorder.h> |
@@ -317,22 +325,23 @@ typedef void (dio_iodone_t)(struct kiocb *iocb, loff_t offset, | |||
317 | * Attribute flags. These should be or-ed together to figure out what | 325 | * Attribute flags. These should be or-ed together to figure out what |
318 | * has been changed! | 326 | * has been changed! |
319 | */ | 327 | */ |
320 | #define ATTR_MODE 1 | 328 | #define ATTR_MODE (1 << 0) |
321 | #define ATTR_UID 2 | 329 | #define ATTR_UID (1 << 1) |
322 | #define ATTR_GID 4 | 330 | #define ATTR_GID (1 << 2) |
323 | #define ATTR_SIZE 8 | 331 | #define ATTR_SIZE (1 << 3) |
324 | #define ATTR_ATIME 16 | 332 | #define ATTR_ATIME (1 << 4) |
325 | #define ATTR_MTIME 32 | 333 | #define ATTR_MTIME (1 << 5) |
326 | #define ATTR_CTIME 64 | 334 | #define ATTR_CTIME (1 << 6) |
327 | #define ATTR_ATIME_SET 128 | 335 | #define ATTR_ATIME_SET (1 << 7) |
328 | #define ATTR_MTIME_SET 256 | 336 | #define ATTR_MTIME_SET (1 << 8) |
329 | #define ATTR_FORCE 512 /* Not a change, but a change it */ | 337 | #define ATTR_FORCE (1 << 9) /* Not a change, but a change it */ |
330 | #define ATTR_ATTR_FLAG 1024 | 338 | #define ATTR_ATTR_FLAG (1 << 10) |
331 | #define ATTR_KILL_SUID 2048 | 339 | #define ATTR_KILL_SUID (1 << 11) |
332 | #define ATTR_KILL_SGID 4096 | 340 | #define ATTR_KILL_SGID (1 << 12) |
333 | #define ATTR_FILE 8192 | 341 | #define ATTR_FILE (1 << 13) |
334 | #define ATTR_KILL_PRIV 16384 | 342 | #define ATTR_KILL_PRIV (1 << 14) |
335 | #define ATTR_OPEN 32768 /* Truncating from open(O_TRUNC) */ | 343 | #define ATTR_OPEN (1 << 15) /* Truncating from open(O_TRUNC) */ |
344 | #define ATTR_TIMES_SET (1 << 16) | ||
336 | 345 | ||
337 | /* | 346 | /* |
338 | * This is the Inode Attributes structure, used for notify_change(). It | 347 | * This is the Inode Attributes structure, used for notify_change(). It |
@@ -439,6 +448,27 @@ static inline size_t iov_iter_count(struct iov_iter *i) | |||
439 | return i->count; | 448 | return i->count; |
440 | } | 449 | } |
441 | 450 | ||
451 | /* | ||
452 | * "descriptor" for what we're up to with a read. | ||
453 | * This allows us to use the same read code yet | ||
454 | * have multiple different users of the data that | ||
455 | * we read from a file. | ||
456 | * | ||
457 | * The simplest case just copies the data to user | ||
458 | * mode. | ||
459 | */ | ||
460 | typedef struct { | ||
461 | size_t written; | ||
462 | size_t count; | ||
463 | union { | ||
464 | char __user *buf; | ||
465 | void *data; | ||
466 | } arg; | ||
467 | int error; | ||
468 | } read_descriptor_t; | ||
469 | |||
470 | typedef int (*read_actor_t)(read_descriptor_t *, struct page *, | ||
471 | unsigned long, unsigned long); | ||
442 | 472 | ||
443 | struct address_space_operations { | 473 | struct address_space_operations { |
444 | int (*writepage)(struct page *page, struct writeback_control *wbc); | 474 | int (*writepage)(struct page *page, struct writeback_control *wbc); |
@@ -480,6 +510,8 @@ struct address_space_operations { | |||
480 | int (*migratepage) (struct address_space *, | 510 | int (*migratepage) (struct address_space *, |
481 | struct page *, struct page *); | 511 | struct page *, struct page *); |
482 | int (*launder_page) (struct page *); | 512 | int (*launder_page) (struct page *); |
513 | int (*is_partially_uptodate) (struct page *, read_descriptor_t *, | ||
514 | unsigned long); | ||
483 | }; | 515 | }; |
484 | 516 | ||
485 | /* | 517 | /* |
@@ -498,7 +530,7 @@ struct backing_dev_info; | |||
498 | struct address_space { | 530 | struct address_space { |
499 | struct inode *host; /* owner: inode, block_device */ | 531 | struct inode *host; /* owner: inode, block_device */ |
500 | struct radix_tree_root page_tree; /* radix tree of all pages */ | 532 | struct radix_tree_root page_tree; /* radix tree of all pages */ |
501 | rwlock_t tree_lock; /* and rwlock protecting it */ | 533 | spinlock_t tree_lock; /* and lock protecting it */ |
502 | unsigned int i_mmap_writable;/* count VM_SHARED mappings */ | 534 | unsigned int i_mmap_writable;/* count VM_SHARED mappings */ |
503 | struct prio_tree_root i_mmap; /* tree of private and shared mappings */ | 535 | struct prio_tree_root i_mmap; /* tree of private and shared mappings */ |
504 | struct list_head i_mmap_nonlinear;/*list VM_NONLINEAR mappings */ | 536 | struct list_head i_mmap_nonlinear;/*list VM_NONLINEAR mappings */ |
@@ -791,7 +823,7 @@ struct file { | |||
791 | #define f_dentry f_path.dentry | 823 | #define f_dentry f_path.dentry |
792 | #define f_vfsmnt f_path.mnt | 824 | #define f_vfsmnt f_path.mnt |
793 | const struct file_operations *f_op; | 825 | const struct file_operations *f_op; |
794 | atomic_t f_count; | 826 | atomic_long_t f_count; |
795 | unsigned int f_flags; | 827 | unsigned int f_flags; |
796 | mode_t f_mode; | 828 | mode_t f_mode; |
797 | loff_t f_pos; | 829 | loff_t f_pos; |
@@ -820,8 +852,8 @@ extern spinlock_t files_lock; | |||
820 | #define file_list_lock() spin_lock(&files_lock); | 852 | #define file_list_lock() spin_lock(&files_lock); |
821 | #define file_list_unlock() spin_unlock(&files_lock); | 853 | #define file_list_unlock() spin_unlock(&files_lock); |
822 | 854 | ||
823 | #define get_file(x) atomic_inc(&(x)->f_count) | 855 | #define get_file(x) atomic_long_inc(&(x)->f_count) |
824 | #define file_count(x) atomic_read(&(x)->f_count) | 856 | #define file_count(x) atomic_long_read(&(x)->f_count) |
825 | 857 | ||
826 | #ifdef CONFIG_DEBUG_WRITECOUNT | 858 | #ifdef CONFIG_DEBUG_WRITECOUNT |
827 | static inline void file_take_write(struct file *f) | 859 | static inline void file_take_write(struct file *f) |
@@ -885,6 +917,12 @@ static inline int file_check_writeable(struct file *filp) | |||
885 | #define FL_SLEEP 128 /* A blocking lock */ | 917 | #define FL_SLEEP 128 /* A blocking lock */ |
886 | 918 | ||
887 | /* | 919 | /* |
920 | * Special return value from posix_lock_file() and vfs_lock_file() for | ||
921 | * asynchronous locking. | ||
922 | */ | ||
923 | #define FILE_LOCK_DEFERRED 1 | ||
924 | |||
925 | /* | ||
888 | * The POSIX file lock owner is determined by | 926 | * The POSIX file lock owner is determined by |
889 | * the "struct files_struct" in the thread group | 927 | * the "struct files_struct" in the thread group |
890 | * (or NULL for no owner - BSD locks). | 928 | * (or NULL for no owner - BSD locks). |
@@ -894,8 +932,6 @@ static inline int file_check_writeable(struct file *filp) | |||
894 | typedef struct files_struct *fl_owner_t; | 932 | typedef struct files_struct *fl_owner_t; |
895 | 933 | ||
896 | struct file_lock_operations { | 934 | struct file_lock_operations { |
897 | void (*fl_insert)(struct file_lock *); /* lock insertion callback */ | ||
898 | void (*fl_remove)(struct file_lock *); /* lock removal callback */ | ||
899 | void (*fl_copy_lock)(struct file_lock *, struct file_lock *); | 935 | void (*fl_copy_lock)(struct file_lock *, struct file_lock *); |
900 | void (*fl_release_private)(struct file_lock *); | 936 | void (*fl_release_private)(struct file_lock *); |
901 | }; | 937 | }; |
@@ -911,6 +947,14 @@ struct lock_manager_operations { | |||
911 | int (*fl_change)(struct file_lock **, int); | 947 | int (*fl_change)(struct file_lock **, int); |
912 | }; | 948 | }; |
913 | 949 | ||
950 | struct lock_manager { | ||
951 | struct list_head list; | ||
952 | }; | ||
953 | |||
954 | void locks_start_grace(struct lock_manager *); | ||
955 | void locks_end_grace(struct lock_manager *); | ||
956 | int locks_in_grace(void); | ||
957 | |||
914 | /* that will die - we need it for nfs_lock_info */ | 958 | /* that will die - we need it for nfs_lock_info */ |
915 | #include <linux/nfs_fs_i.h> | 959 | #include <linux/nfs_fs_i.h> |
916 | 960 | ||
@@ -919,12 +963,12 @@ struct file_lock { | |||
919 | struct list_head fl_link; /* doubly linked list of all locks */ | 963 | struct list_head fl_link; /* doubly linked list of all locks */ |
920 | struct list_head fl_block; /* circular list of blocked processes */ | 964 | struct list_head fl_block; /* circular list of blocked processes */ |
921 | fl_owner_t fl_owner; | 965 | fl_owner_t fl_owner; |
966 | unsigned char fl_flags; | ||
967 | unsigned char fl_type; | ||
922 | unsigned int fl_pid; | 968 | unsigned int fl_pid; |
923 | struct pid *fl_nspid; | 969 | struct pid *fl_nspid; |
924 | wait_queue_head_t fl_wait; | 970 | wait_queue_head_t fl_wait; |
925 | struct file *fl_file; | 971 | struct file *fl_file; |
926 | unsigned char fl_flags; | ||
927 | unsigned char fl_type; | ||
928 | loff_t fl_start; | 972 | loff_t fl_start; |
929 | loff_t fl_end; | 973 | loff_t fl_end; |
930 | 974 | ||
@@ -952,6 +996,13 @@ struct file_lock { | |||
952 | 996 | ||
953 | #include <linux/fcntl.h> | 997 | #include <linux/fcntl.h> |
954 | 998 | ||
999 | extern void send_sigio(struct fown_struct *fown, int fd, int band); | ||
1000 | |||
1001 | /* fs/sync.c */ | ||
1002 | extern int do_sync_mapping_range(struct address_space *mapping, loff_t offset, | ||
1003 | loff_t endbyte, unsigned int flags); | ||
1004 | |||
1005 | #ifdef CONFIG_FILE_LOCKING | ||
955 | extern int fcntl_getlk(struct file *, struct flock __user *); | 1006 | extern int fcntl_getlk(struct file *, struct flock __user *); |
956 | extern int fcntl_setlk(unsigned int, struct file *, unsigned int, | 1007 | extern int fcntl_setlk(unsigned int, struct file *, unsigned int, |
957 | struct flock __user *); | 1008 | struct flock __user *); |
@@ -962,14 +1013,9 @@ extern int fcntl_setlk64(unsigned int, struct file *, unsigned int, | |||
962 | struct flock64 __user *); | 1013 | struct flock64 __user *); |
963 | #endif | 1014 | #endif |
964 | 1015 | ||
965 | extern void send_sigio(struct fown_struct *fown, int fd, int band); | ||
966 | extern int fcntl_setlease(unsigned int fd, struct file *filp, long arg); | 1016 | extern int fcntl_setlease(unsigned int fd, struct file *filp, long arg); |
967 | extern int fcntl_getlease(struct file *filp); | 1017 | extern int fcntl_getlease(struct file *filp); |
968 | 1018 | ||
969 | /* fs/sync.c */ | ||
970 | extern int do_sync_mapping_range(struct address_space *mapping, loff_t offset, | ||
971 | loff_t endbyte, unsigned int flags); | ||
972 | |||
973 | /* fs/locks.c */ | 1019 | /* fs/locks.c */ |
974 | extern void locks_init_lock(struct file_lock *); | 1020 | extern void locks_init_lock(struct file_lock *); |
975 | extern void locks_copy_lock(struct file_lock *, struct file_lock *); | 1021 | extern void locks_copy_lock(struct file_lock *, struct file_lock *); |
@@ -992,6 +1038,37 @@ extern int lease_modify(struct file_lock **, int); | |||
992 | extern int lock_may_read(struct inode *, loff_t start, unsigned long count); | 1038 | extern int lock_may_read(struct inode *, loff_t start, unsigned long count); |
993 | extern int lock_may_write(struct inode *, loff_t start, unsigned long count); | 1039 | extern int lock_may_write(struct inode *, loff_t start, unsigned long count); |
994 | extern struct seq_operations locks_seq_operations; | 1040 | extern struct seq_operations locks_seq_operations; |
1041 | #else /* !CONFIG_FILE_LOCKING */ | ||
1042 | #define fcntl_getlk(a, b) ({ -EINVAL; }) | ||
1043 | #define fcntl_setlk(a, b, c, d) ({ -EACCES; }) | ||
1044 | #if BITS_PER_LONG == 32 | ||
1045 | #define fcntl_getlk64(a, b) ({ -EINVAL; }) | ||
1046 | #define fcntl_setlk64(a, b, c, d) ({ -EACCES; }) | ||
1047 | #endif | ||
1048 | #define fcntl_setlease(a, b, c) ({ 0; }) | ||
1049 | #define fcntl_getlease(a) ({ 0; }) | ||
1050 | #define locks_init_lock(a) ({ }) | ||
1051 | #define __locks_copy_lock(a, b) ({ }) | ||
1052 | #define locks_copy_lock(a, b) ({ }) | ||
1053 | #define locks_remove_posix(a, b) ({ }) | ||
1054 | #define locks_remove_flock(a) ({ }) | ||
1055 | #define posix_test_lock(a, b) ({ 0; }) | ||
1056 | #define posix_lock_file(a, b, c) ({ -ENOLCK; }) | ||
1057 | #define posix_lock_file_wait(a, b) ({ -ENOLCK; }) | ||
1058 | #define posix_unblock_lock(a, b) (-ENOENT) | ||
1059 | #define vfs_test_lock(a, b) ({ 0; }) | ||
1060 | #define vfs_lock_file(a, b, c, d) (-ENOLCK) | ||
1061 | #define vfs_cancel_lock(a, b) ({ 0; }) | ||
1062 | #define flock_lock_file_wait(a, b) ({ -ENOLCK; }) | ||
1063 | #define __break_lease(a, b) ({ 0; }) | ||
1064 | #define lease_get_mtime(a, b) ({ }) | ||
1065 | #define generic_setlease(a, b, c) ({ -EINVAL; }) | ||
1066 | #define vfs_setlease(a, b, c) ({ -EINVAL; }) | ||
1067 | #define lease_modify(a, b) ({ -EINVAL; }) | ||
1068 | #define lock_may_read(a, b, c) ({ 1; }) | ||
1069 | #define lock_may_write(a, b, c) ({ 1; }) | ||
1070 | #endif /* !CONFIG_FILE_LOCKING */ | ||
1071 | |||
995 | 1072 | ||
996 | struct fasync_struct { | 1073 | struct fasync_struct { |
997 | int magic; | 1074 | int magic; |
@@ -1026,6 +1103,7 @@ extern int send_sigurg(struct fown_struct *fown); | |||
1026 | extern struct list_head super_blocks; | 1103 | extern struct list_head super_blocks; |
1027 | extern spinlock_t sb_lock; | 1104 | extern spinlock_t sb_lock; |
1028 | 1105 | ||
1106 | #define sb_entry(list) list_entry((list), struct super_block, s_list) | ||
1029 | #define S_BIAS (1<<30) | 1107 | #define S_BIAS (1<<30) |
1030 | struct super_block { | 1108 | struct super_block { |
1031 | struct list_head s_list; /* Keep this first */ | 1109 | struct list_head s_list; /* Keep this first */ |
@@ -1059,6 +1137,9 @@ struct super_block { | |||
1059 | struct list_head s_more_io; /* parked for more writeback */ | 1137 | struct list_head s_more_io; /* parked for more writeback */ |
1060 | struct hlist_head s_anon; /* anonymous dentries for (nfs) exporting */ | 1138 | struct hlist_head s_anon; /* anonymous dentries for (nfs) exporting */ |
1061 | struct list_head s_files; | 1139 | struct list_head s_files; |
1140 | /* s_dentry_lru and s_nr_dentry_unused are protected by dcache_lock */ | ||
1141 | struct list_head s_dentry_lru; /* unused dentry lru */ | ||
1142 | int s_nr_dentry_unused; /* # of dentry on lru */ | ||
1062 | 1143 | ||
1063 | struct block_device *s_bdev; | 1144 | struct block_device *s_bdev; |
1064 | struct mtd_info *s_mtd; | 1145 | struct mtd_info *s_mtd; |
@@ -1127,7 +1208,7 @@ extern int vfs_permission(struct nameidata *, int); | |||
1127 | extern int vfs_create(struct inode *, struct dentry *, int, struct nameidata *); | 1208 | extern int vfs_create(struct inode *, struct dentry *, int, struct nameidata *); |
1128 | extern int vfs_mkdir(struct inode *, struct dentry *, int); | 1209 | extern int vfs_mkdir(struct inode *, struct dentry *, int); |
1129 | extern int vfs_mknod(struct inode *, struct dentry *, int, dev_t); | 1210 | extern int vfs_mknod(struct inode *, struct dentry *, int, dev_t); |
1130 | extern int vfs_symlink(struct inode *, struct dentry *, const char *, int); | 1211 | extern int vfs_symlink(struct inode *, struct dentry *, const char *); |
1131 | extern int vfs_link(struct dentry *, struct inode *, struct dentry *); | 1212 | extern int vfs_link(struct dentry *, struct inode *, struct dentry *); |
1132 | extern int vfs_rmdir(struct inode *, struct dentry *); | 1213 | extern int vfs_rmdir(struct inode *, struct dentry *); |
1133 | extern int vfs_unlink(struct inode *, struct dentry *); | 1214 | extern int vfs_unlink(struct inode *, struct dentry *); |
@@ -1144,6 +1225,20 @@ extern void dentry_unhash(struct dentry *dentry); | |||
1144 | extern int file_permission(struct file *, int); | 1225 | extern int file_permission(struct file *, int); |
1145 | 1226 | ||
1146 | /* | 1227 | /* |
1228 | * VFS FS_IOC_FIEMAP helper definitions. | ||
1229 | */ | ||
1230 | struct fiemap_extent_info { | ||
1231 | unsigned int fi_flags; /* Flags as passed from user */ | ||
1232 | unsigned int fi_extents_mapped; /* Number of mapped extents */ | ||
1233 | unsigned int fi_extents_max; /* Size of fiemap_extent array */ | ||
1234 | struct fiemap_extent *fi_extents_start; /* Start of fiemap_extent | ||
1235 | * array */ | ||
1236 | }; | ||
1237 | int fiemap_fill_next_extent(struct fiemap_extent_info *info, u64 logical, | ||
1238 | u64 phys, u64 len, u32 flags); | ||
1239 | int fiemap_check_flags(struct fiemap_extent_info *fieinfo, u32 fs_flags); | ||
1240 | |||
1241 | /* | ||
1147 | * File types | 1242 | * File types |
1148 | * | 1243 | * |
1149 | * NOTE! These match bits 12..15 of stat.st_mode | 1244 | * NOTE! These match bits 12..15 of stat.st_mode |
@@ -1186,27 +1281,6 @@ struct block_device_operations { | |||
1186 | struct module *owner; | 1281 | struct module *owner; |
1187 | }; | 1282 | }; |
1188 | 1283 | ||
1189 | /* | ||
1190 | * "descriptor" for what we're up to with a read. | ||
1191 | * This allows us to use the same read code yet | ||
1192 | * have multiple different users of the data that | ||
1193 | * we read from a file. | ||
1194 | * | ||
1195 | * The simplest case just copies the data to user | ||
1196 | * mode. | ||
1197 | */ | ||
1198 | typedef struct { | ||
1199 | size_t written; | ||
1200 | size_t count; | ||
1201 | union { | ||
1202 | char __user * buf; | ||
1203 | void *data; | ||
1204 | } arg; | ||
1205 | int error; | ||
1206 | } read_descriptor_t; | ||
1207 | |||
1208 | typedef int (*read_actor_t)(read_descriptor_t *, struct page *, unsigned long, unsigned long); | ||
1209 | |||
1210 | /* These macros are for out of kernel modules to test that | 1284 | /* These macros are for out of kernel modules to test that |
1211 | * the kernel supports the unlocked_ioctl and compat_ioctl | 1285 | * the kernel supports the unlocked_ioctl and compat_ioctl |
1212 | * fields in struct file_operations. */ | 1286 | * fields in struct file_operations. */ |
@@ -1263,7 +1337,7 @@ struct inode_operations { | |||
1263 | void * (*follow_link) (struct dentry *, struct nameidata *); | 1337 | void * (*follow_link) (struct dentry *, struct nameidata *); |
1264 | void (*put_link) (struct dentry *, struct nameidata *, void *); | 1338 | void (*put_link) (struct dentry *, struct nameidata *, void *); |
1265 | void (*truncate) (struct inode *); | 1339 | void (*truncate) (struct inode *); |
1266 | int (*permission) (struct inode *, int, struct nameidata *); | 1340 | int (*permission) (struct inode *, int); |
1267 | int (*setattr) (struct dentry *, struct iattr *); | 1341 | int (*setattr) (struct dentry *, struct iattr *); |
1268 | int (*getattr) (struct vfsmount *mnt, struct dentry *, struct kstat *); | 1342 | int (*getattr) (struct vfsmount *mnt, struct dentry *, struct kstat *); |
1269 | int (*setxattr) (struct dentry *, const char *,const void *,size_t,int); | 1343 | int (*setxattr) (struct dentry *, const char *,const void *,size_t,int); |
@@ -1273,6 +1347,8 @@ struct inode_operations { | |||
1273 | void (*truncate_range)(struct inode *, loff_t, loff_t); | 1347 | void (*truncate_range)(struct inode *, loff_t, loff_t); |
1274 | long (*fallocate)(struct inode *inode, int mode, loff_t offset, | 1348 | long (*fallocate)(struct inode *inode, int mode, loff_t offset, |
1275 | loff_t len); | 1349 | loff_t len); |
1350 | int (*fiemap)(struct inode *, struct fiemap_extent_info *, u64 start, | ||
1351 | u64 len); | ||
1276 | }; | 1352 | }; |
1277 | 1353 | ||
1278 | struct seq_file; | 1354 | struct seq_file; |
@@ -1540,9 +1616,12 @@ extern int vfs_statfs(struct dentry *, struct kstatfs *); | |||
1540 | /* /sys/fs */ | 1616 | /* /sys/fs */ |
1541 | extern struct kobject *fs_kobj; | 1617 | extern struct kobject *fs_kobj; |
1542 | 1618 | ||
1619 | extern int rw_verify_area(int, struct file *, loff_t *, size_t); | ||
1620 | |||
1543 | #define FLOCK_VERIFY_READ 1 | 1621 | #define FLOCK_VERIFY_READ 1 |
1544 | #define FLOCK_VERIFY_WRITE 2 | 1622 | #define FLOCK_VERIFY_WRITE 2 |
1545 | 1623 | ||
1624 | #ifdef CONFIG_FILE_LOCKING | ||
1546 | extern int locks_mandatory_locked(struct inode *); | 1625 | extern int locks_mandatory_locked(struct inode *); |
1547 | extern int locks_mandatory_area(int, struct inode *, struct file *, loff_t, size_t); | 1626 | extern int locks_mandatory_area(int, struct inode *, struct file *, loff_t, size_t); |
1548 | 1627 | ||
@@ -1573,8 +1652,6 @@ static inline int locks_verify_locked(struct inode *inode) | |||
1573 | return 0; | 1652 | return 0; |
1574 | } | 1653 | } |
1575 | 1654 | ||
1576 | extern int rw_verify_area(int, struct file *, loff_t *, size_t); | ||
1577 | |||
1578 | static inline int locks_verify_truncate(struct inode *inode, | 1655 | static inline int locks_verify_truncate(struct inode *inode, |
1579 | struct file *filp, | 1656 | struct file *filp, |
1580 | loff_t size) | 1657 | loff_t size) |
@@ -1595,6 +1672,15 @@ static inline int break_lease(struct inode *inode, unsigned int mode) | |||
1595 | return __break_lease(inode, mode); | 1672 | return __break_lease(inode, mode); |
1596 | return 0; | 1673 | return 0; |
1597 | } | 1674 | } |
1675 | #else /* !CONFIG_FILE_LOCKING */ | ||
1676 | #define locks_mandatory_locked(a) ({ 0; }) | ||
1677 | #define locks_mandatory_area(a, b, c, d, e) ({ 0; }) | ||
1678 | #define __mandatory_lock(a) ({ 0; }) | ||
1679 | #define mandatory_lock(a) ({ 0; }) | ||
1680 | #define locks_verify_locked(a) ({ 0; }) | ||
1681 | #define locks_verify_truncate(a, b, c) ({ 0; }) | ||
1682 | #define break_lease(a, b) ({ 0; }) | ||
1683 | #endif /* CONFIG_FILE_LOCKING */ | ||
1598 | 1684 | ||
1599 | /* fs/open.c */ | 1685 | /* fs/open.c */ |
1600 | 1686 | ||
@@ -1668,6 +1754,7 @@ extern void chrdev_show(struct seq_file *,off_t); | |||
1668 | 1754 | ||
1669 | /* fs/block_dev.c */ | 1755 | /* fs/block_dev.c */ |
1670 | #define BDEVNAME_SIZE 32 /* Largest string for a blockdev identifier */ | 1756 | #define BDEVNAME_SIZE 32 /* Largest string for a blockdev identifier */ |
1757 | #define BDEVT_SIZE 10 /* Largest string for MAJ:MIN for blkdev */ | ||
1671 | 1758 | ||
1672 | #ifdef CONFIG_BLOCK | 1759 | #ifdef CONFIG_BLOCK |
1673 | #define BLKDEV_MAJOR_HASH_SIZE 255 | 1760 | #define BLKDEV_MAJOR_HASH_SIZE 255 |
@@ -1687,9 +1774,9 @@ extern void init_special_inode(struct inode *, umode_t, dev_t); | |||
1687 | extern void make_bad_inode(struct inode *); | 1774 | extern void make_bad_inode(struct inode *); |
1688 | extern int is_bad_inode(struct inode *); | 1775 | extern int is_bad_inode(struct inode *); |
1689 | 1776 | ||
1690 | extern const struct file_operations read_fifo_fops; | 1777 | extern const struct file_operations read_pipefifo_fops; |
1691 | extern const struct file_operations write_fifo_fops; | 1778 | extern const struct file_operations write_pipefifo_fops; |
1692 | extern const struct file_operations rdwr_fifo_fops; | 1779 | extern const struct file_operations rdwr_pipefifo_fops; |
1693 | 1780 | ||
1694 | extern int fs_may_remount_ro(struct super_block *); | 1781 | extern int fs_may_remount_ro(struct super_block *); |
1695 | 1782 | ||
@@ -1704,6 +1791,9 @@ extern int fs_may_remount_ro(struct super_block *); | |||
1704 | */ | 1791 | */ |
1705 | #define bio_data_dir(bio) ((bio)->bi_rw & 1) | 1792 | #define bio_data_dir(bio) ((bio)->bi_rw & 1) |
1706 | 1793 | ||
1794 | extern void check_disk_size_change(struct gendisk *disk, | ||
1795 | struct block_device *bdev); | ||
1796 | extern int revalidate_disk(struct gendisk *); | ||
1707 | extern int check_disk_change(struct block_device *); | 1797 | extern int check_disk_change(struct block_device *); |
1708 | extern int __invalidate_device(struct block_device *); | 1798 | extern int __invalidate_device(struct block_device *); |
1709 | extern int invalidate_partition(struct gendisk *, int); | 1799 | extern int invalidate_partition(struct gendisk *, int); |
@@ -1730,6 +1820,8 @@ static inline void invalidate_remote_inode(struct inode *inode) | |||
1730 | extern int invalidate_inode_pages2(struct address_space *mapping); | 1820 | extern int invalidate_inode_pages2(struct address_space *mapping); |
1731 | extern int invalidate_inode_pages2_range(struct address_space *mapping, | 1821 | extern int invalidate_inode_pages2_range(struct address_space *mapping, |
1732 | pgoff_t start, pgoff_t end); | 1822 | pgoff_t start, pgoff_t end); |
1823 | extern void generic_sync_sb_inodes(struct super_block *sb, | ||
1824 | struct writeback_control *wbc); | ||
1733 | extern int write_inode_now(struct inode *, int); | 1825 | extern int write_inode_now(struct inode *, int); |
1734 | extern int filemap_fdatawrite(struct address_space *); | 1826 | extern int filemap_fdatawrite(struct address_space *); |
1735 | extern int filemap_flush(struct address_space *); | 1827 | extern int filemap_flush(struct address_space *); |
@@ -1741,6 +1833,8 @@ extern int wait_on_page_writeback_range(struct address_space *mapping, | |||
1741 | pgoff_t start, pgoff_t end); | 1833 | pgoff_t start, pgoff_t end); |
1742 | extern int __filemap_fdatawrite_range(struct address_space *mapping, | 1834 | extern int __filemap_fdatawrite_range(struct address_space *mapping, |
1743 | loff_t start, loff_t end, int sync_mode); | 1835 | loff_t start, loff_t end, int sync_mode); |
1836 | extern int filemap_fdatawrite_range(struct address_space *mapping, | ||
1837 | loff_t start, loff_t end); | ||
1744 | 1838 | ||
1745 | extern long do_fsync(struct file *file, int datasync); | 1839 | extern long do_fsync(struct file *file, int datasync); |
1746 | extern void sync_supers(void); | 1840 | extern void sync_supers(void); |
@@ -1754,7 +1848,7 @@ extern int do_remount_sb(struct super_block *sb, int flags, | |||
1754 | extern sector_t bmap(struct inode *, sector_t); | 1848 | extern sector_t bmap(struct inode *, sector_t); |
1755 | #endif | 1849 | #endif |
1756 | extern int notify_change(struct dentry *, struct iattr *); | 1850 | extern int notify_change(struct dentry *, struct iattr *); |
1757 | extern int permission(struct inode *, int, struct nameidata *); | 1851 | extern int inode_permission(struct inode *, int); |
1758 | extern int generic_permission(struct inode *, int, | 1852 | extern int generic_permission(struct inode *, int, |
1759 | int (*check_acl)(struct inode *, int)); | 1853 | int (*check_acl)(struct inode *, int)); |
1760 | 1854 | ||
@@ -1770,8 +1864,9 @@ static inline void allow_write_access(struct file *file) | |||
1770 | atomic_inc(&file->f_path.dentry->d_inode->i_writecount); | 1864 | atomic_inc(&file->f_path.dentry->d_inode->i_writecount); |
1771 | } | 1865 | } |
1772 | extern int do_pipe(int *); | 1866 | extern int do_pipe(int *); |
1773 | extern struct file *create_read_pipe(struct file *f); | 1867 | extern int do_pipe_flags(int *, int); |
1774 | extern struct file *create_write_pipe(void); | 1868 | extern struct file *create_read_pipe(struct file *f, int flags); |
1869 | extern struct file *create_write_pipe(int flags); | ||
1775 | extern void free_write_pipe(struct file *); | 1870 | extern void free_write_pipe(struct file *); |
1776 | 1871 | ||
1777 | extern struct file *do_filp_open(int dfd, const char *pathname, | 1872 | extern struct file *do_filp_open(int dfd, const char *pathname, |
@@ -1817,7 +1912,7 @@ extern void clear_inode(struct inode *); | |||
1817 | extern void destroy_inode(struct inode *); | 1912 | extern void destroy_inode(struct inode *); |
1818 | extern struct inode *new_inode(struct super_block *); | 1913 | extern struct inode *new_inode(struct super_block *); |
1819 | extern int should_remove_suid(struct dentry *); | 1914 | extern int should_remove_suid(struct dentry *); |
1820 | extern int remove_suid(struct dentry *); | 1915 | extern int file_remove_suid(struct file *); |
1821 | 1916 | ||
1822 | extern void __insert_inode_hash(struct inode *, unsigned long hashval); | 1917 | extern void __insert_inode_hash(struct inode *, unsigned long hashval); |
1823 | extern void remove_inode_hash(struct inode *); | 1918 | extern void remove_inode_hash(struct inode *); |
@@ -1871,7 +1966,8 @@ extern void | |||
1871 | file_ra_state_init(struct file_ra_state *ra, struct address_space *mapping); | 1966 | file_ra_state_init(struct file_ra_state *ra, struct address_space *mapping); |
1872 | extern loff_t no_llseek(struct file *file, loff_t offset, int origin); | 1967 | extern loff_t no_llseek(struct file *file, loff_t offset, int origin); |
1873 | extern loff_t generic_file_llseek(struct file *file, loff_t offset, int origin); | 1968 | extern loff_t generic_file_llseek(struct file *file, loff_t offset, int origin); |
1874 | extern loff_t remote_llseek(struct file *file, loff_t offset, int origin); | 1969 | extern loff_t generic_file_llseek_unlocked(struct file *file, loff_t offset, |
1970 | int origin); | ||
1875 | extern int generic_file_open(struct inode * inode, struct file * filp); | 1971 | extern int generic_file_open(struct inode * inode, struct file * filp); |
1876 | extern int nonseekable_open(struct inode * inode, struct file * filp); | 1972 | extern int nonseekable_open(struct inode * inode, struct file * filp); |
1877 | 1973 | ||
@@ -1960,6 +2056,9 @@ extern int vfs_fstat(unsigned int, struct kstat *); | |||
1960 | 2056 | ||
1961 | extern int do_vfs_ioctl(struct file *filp, unsigned int fd, unsigned int cmd, | 2057 | extern int do_vfs_ioctl(struct file *filp, unsigned int fd, unsigned int cmd, |
1962 | unsigned long arg); | 2058 | unsigned long arg); |
2059 | extern int generic_block_fiemap(struct inode *inode, | ||
2060 | struct fiemap_extent_info *fieinfo, u64 start, | ||
2061 | u64 len, get_block_t *get_block); | ||
1963 | 2062 | ||
1964 | extern void get_filesystem(struct file_system_type *fs); | 2063 | extern void get_filesystem(struct file_system_type *fs); |
1965 | extern void put_filesystem(struct file_system_type *fs); | 2064 | extern void put_filesystem(struct file_system_type *fs); |
@@ -2002,8 +2101,6 @@ extern void simple_release_fs(struct vfsmount **mount, int *count); | |||
2002 | 2101 | ||
2003 | extern ssize_t simple_read_from_buffer(void __user *to, size_t count, | 2102 | extern ssize_t simple_read_from_buffer(void __user *to, size_t count, |
2004 | loff_t *ppos, const void *from, size_t available); | 2103 | loff_t *ppos, const void *from, size_t available); |
2005 | extern ssize_t memory_read_from_buffer(void *to, size_t count, loff_t *ppos, | ||
2006 | const void *from, size_t available); | ||
2007 | 2104 | ||
2008 | #ifdef CONFIG_MIGRATION | 2105 | #ifdef CONFIG_MIGRATION |
2009 | extern int buffer_migrate_page(struct address_space *, | 2106 | extern int buffer_migrate_page(struct address_space *, |
diff --git a/include/linux/fs_enet_pd.h b/include/linux/fs_enet_pd.h index 9bc045b8c478..8300cab30f9a 100644 --- a/include/linux/fs_enet_pd.h +++ b/include/linux/fs_enet_pd.h | |||
@@ -103,10 +103,6 @@ struct fs_mii_bb_platform_info { | |||
103 | struct fs_mii_bit mdio_dir; | 103 | struct fs_mii_bit mdio_dir; |
104 | struct fs_mii_bit mdio_dat; | 104 | struct fs_mii_bit mdio_dat; |
105 | struct fs_mii_bit mdc_dat; | 105 | struct fs_mii_bit mdc_dat; |
106 | int mdio_port; /* port & bit for MDIO */ | ||
107 | int mdio_bit; | ||
108 | int mdc_port; /* port & bit for MDC */ | ||
109 | int mdc_bit; | ||
110 | int delay; /* delay in us */ | 106 | int delay; /* delay in us */ |
111 | int irq[32]; /* irqs per phy's */ | 107 | int irq[32]; /* irqs per phy's */ |
112 | }; | 108 | }; |
@@ -135,11 +131,7 @@ struct fs_platform_info { | |||
135 | u32 device_flags; | 131 | u32 device_flags; |
136 | 132 | ||
137 | int phy_addr; /* the phy address (-1 no phy) */ | 133 | int phy_addr; /* the phy address (-1 no phy) */ |
138 | #ifdef CONFIG_PPC_CPM_NEW_BINDING | ||
139 | char bus_id[16]; | 134 | char bus_id[16]; |
140 | #else | ||
141 | const char* bus_id; | ||
142 | #endif | ||
143 | int phy_irq; /* the phy irq (if it exists) */ | 135 | int phy_irq; /* the phy irq (if it exists) */ |
144 | 136 | ||
145 | const struct fs_mii_bus_info *bus_info; | 137 | const struct fs_mii_bus_info *bus_info; |
diff --git a/include/linux/fs_struct.h b/include/linux/fs_struct.h index 282f54219129..9e5a06e78d02 100644 --- a/include/linux/fs_struct.h +++ b/include/linux/fs_struct.h | |||
@@ -7,7 +7,7 @@ struct fs_struct { | |||
7 | atomic_t count; | 7 | atomic_t count; |
8 | rwlock_t lock; | 8 | rwlock_t lock; |
9 | int umask; | 9 | int umask; |
10 | struct path root, pwd, altroot; | 10 | struct path root, pwd; |
11 | }; | 11 | }; |
12 | 12 | ||
13 | #define INIT_FS { \ | 13 | #define INIT_FS { \ |
@@ -19,7 +19,6 @@ struct fs_struct { | |||
19 | extern struct kmem_cache *fs_cachep; | 19 | extern struct kmem_cache *fs_cachep; |
20 | 20 | ||
21 | extern void exit_fs(struct task_struct *); | 21 | extern void exit_fs(struct task_struct *); |
22 | extern void set_fs_altroot(void); | ||
23 | extern void set_fs_root(struct fs_struct *, struct path *); | 22 | extern void set_fs_root(struct fs_struct *, struct path *); |
24 | extern void set_fs_pwd(struct fs_struct *, struct path *); | 23 | extern void set_fs_pwd(struct fs_struct *, struct path *); |
25 | extern struct fs_struct *copy_fs_struct(struct fs_struct *); | 24 | extern struct fs_struct *copy_fs_struct(struct fs_struct *); |
diff --git a/include/linux/fs_uart_pd.h b/include/linux/fs_uart_pd.h index 809bb9ffc788..36b61ff39277 100644 --- a/include/linux/fs_uart_pd.h +++ b/include/linux/fs_uart_pd.h | |||
@@ -12,7 +12,6 @@ | |||
12 | #ifndef FS_UART_PD_H | 12 | #ifndef FS_UART_PD_H |
13 | #define FS_UART_PD_H | 13 | #define FS_UART_PD_H |
14 | 14 | ||
15 | #include <linux/version.h> | ||
16 | #include <asm/types.h> | 15 | #include <asm/types.h> |
17 | 16 | ||
18 | enum fs_uart_id { | 17 | enum fs_uart_id { |
diff --git a/include/linux/fsl_devices.h b/include/linux/fsl_devices.h index c415a496de3a..4e625e0094c8 100644 --- a/include/linux/fsl_devices.h +++ b/include/linux/fsl_devices.h | |||
@@ -69,6 +69,7 @@ struct gianfar_mdio_data { | |||
69 | #define FSL_GIANFAR_DEV_HAS_VLAN 0x00000020 | 69 | #define FSL_GIANFAR_DEV_HAS_VLAN 0x00000020 |
70 | #define FSL_GIANFAR_DEV_HAS_EXTENDED_HASH 0x00000040 | 70 | #define FSL_GIANFAR_DEV_HAS_EXTENDED_HASH 0x00000040 |
71 | #define FSL_GIANFAR_DEV_HAS_PADDING 0x00000080 | 71 | #define FSL_GIANFAR_DEV_HAS_PADDING 0x00000080 |
72 | #define FSL_GIANFAR_DEV_HAS_MAGIC_PACKET 0x00000100 | ||
72 | 73 | ||
73 | /* Flags in gianfar_platform_data */ | 74 | /* Flags in gianfar_platform_data */ |
74 | #define FSL_GIANFAR_BRD_HAS_PHY_INTR 0x00000001 /* set or use a timer */ | 75 | #define FSL_GIANFAR_BRD_HAS_PHY_INTR 0x00000001 /* set or use a timer */ |
@@ -125,4 +126,10 @@ struct mpc8xx_pcmcia_ops { | |||
125 | int(*voltage_set)(int slot, int vcc, int vpp); | 126 | int(*voltage_set)(int slot, int vcc, int vpp); |
126 | }; | 127 | }; |
127 | 128 | ||
129 | /* Returns non-zero if the current suspend operation would | ||
130 | * lead to a deep sleep (i.e. power removed from the core, | ||
131 | * instead of just the clock). | ||
132 | */ | ||
133 | int fsl_deep_sleep(void); | ||
134 | |||
128 | #endif /* _FSL_DEVICE_H_ */ | 135 | #endif /* _FSL_DEVICE_H_ */ |
diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h new file mode 100644 index 000000000000..bb384068272e --- /dev/null +++ b/include/linux/ftrace.h | |||
@@ -0,0 +1,165 @@ | |||
1 | #ifndef _LINUX_FTRACE_H | ||
2 | #define _LINUX_FTRACE_H | ||
3 | |||
4 | #ifdef CONFIG_FTRACE | ||
5 | |||
6 | #include <linux/linkage.h> | ||
7 | #include <linux/fs.h> | ||
8 | |||
9 | extern int ftrace_enabled; | ||
10 | extern int | ||
11 | ftrace_enable_sysctl(struct ctl_table *table, int write, | ||
12 | struct file *filp, void __user *buffer, size_t *lenp, | ||
13 | loff_t *ppos); | ||
14 | |||
15 | typedef void (*ftrace_func_t)(unsigned long ip, unsigned long parent_ip); | ||
16 | |||
17 | struct ftrace_ops { | ||
18 | ftrace_func_t func; | ||
19 | struct ftrace_ops *next; | ||
20 | }; | ||
21 | |||
22 | /* | ||
23 | * The ftrace_ops must be a static and should also | ||
24 | * be read_mostly. These functions do modify read_mostly variables | ||
25 | * so use them sparely. Never free an ftrace_op or modify the | ||
26 | * next pointer after it has been registered. Even after unregistering | ||
27 | * it, the next pointer may still be used internally. | ||
28 | */ | ||
29 | int register_ftrace_function(struct ftrace_ops *ops); | ||
30 | int unregister_ftrace_function(struct ftrace_ops *ops); | ||
31 | void clear_ftrace_function(void); | ||
32 | |||
33 | extern void ftrace_stub(unsigned long a0, unsigned long a1); | ||
34 | |||
35 | #else /* !CONFIG_FTRACE */ | ||
36 | # define register_ftrace_function(ops) do { } while (0) | ||
37 | # define unregister_ftrace_function(ops) do { } while (0) | ||
38 | # define clear_ftrace_function(ops) do { } while (0) | ||
39 | #endif /* CONFIG_FTRACE */ | ||
40 | |||
41 | #ifdef CONFIG_DYNAMIC_FTRACE | ||
42 | # define FTRACE_HASHBITS 10 | ||
43 | # define FTRACE_HASHSIZE (1<<FTRACE_HASHBITS) | ||
44 | |||
45 | enum { | ||
46 | FTRACE_FL_FREE = (1 << 0), | ||
47 | FTRACE_FL_FAILED = (1 << 1), | ||
48 | FTRACE_FL_FILTER = (1 << 2), | ||
49 | FTRACE_FL_ENABLED = (1 << 3), | ||
50 | FTRACE_FL_NOTRACE = (1 << 4), | ||
51 | FTRACE_FL_CONVERTED = (1 << 5), | ||
52 | FTRACE_FL_FROZEN = (1 << 6), | ||
53 | }; | ||
54 | |||
55 | struct dyn_ftrace { | ||
56 | struct hlist_node node; | ||
57 | unsigned long ip; /* address of mcount call-site */ | ||
58 | unsigned long flags; | ||
59 | }; | ||
60 | |||
61 | int ftrace_force_update(void); | ||
62 | void ftrace_set_filter(unsigned char *buf, int len, int reset); | ||
63 | |||
64 | /* defined in arch */ | ||
65 | extern int ftrace_ip_converted(unsigned long ip); | ||
66 | extern unsigned char *ftrace_nop_replace(void); | ||
67 | extern unsigned char *ftrace_call_replace(unsigned long ip, unsigned long addr); | ||
68 | extern int ftrace_dyn_arch_init(void *data); | ||
69 | extern int ftrace_mcount_set(unsigned long *data); | ||
70 | extern int ftrace_modify_code(unsigned long ip, unsigned char *old_code, | ||
71 | unsigned char *new_code); | ||
72 | extern int ftrace_update_ftrace_func(ftrace_func_t func); | ||
73 | extern void ftrace_caller(void); | ||
74 | extern void ftrace_call(void); | ||
75 | extern void mcount_call(void); | ||
76 | |||
77 | extern int skip_trace(unsigned long ip); | ||
78 | |||
79 | void ftrace_disable_daemon(void); | ||
80 | void ftrace_enable_daemon(void); | ||
81 | |||
82 | #else | ||
83 | # define skip_trace(ip) ({ 0; }) | ||
84 | # define ftrace_force_update() ({ 0; }) | ||
85 | # define ftrace_set_filter(buf, len, reset) do { } while (0) | ||
86 | # define ftrace_disable_daemon() do { } while (0) | ||
87 | # define ftrace_enable_daemon() do { } while (0) | ||
88 | #endif /* CONFIG_DYNAMIC_FTRACE */ | ||
89 | |||
90 | /* totally disable ftrace - can not re-enable after this */ | ||
91 | void ftrace_kill(void); | ||
92 | void ftrace_kill_atomic(void); | ||
93 | |||
94 | static inline void tracer_disable(void) | ||
95 | { | ||
96 | #ifdef CONFIG_FTRACE | ||
97 | ftrace_enabled = 0; | ||
98 | #endif | ||
99 | } | ||
100 | |||
101 | /* Ftrace disable/restore without lock. Some synchronization mechanism | ||
102 | * must be used to prevent ftrace_enabled to be changed between | ||
103 | * disable/restore. */ | ||
104 | static inline int __ftrace_enabled_save(void) | ||
105 | { | ||
106 | #ifdef CONFIG_FTRACE | ||
107 | int saved_ftrace_enabled = ftrace_enabled; | ||
108 | ftrace_enabled = 0; | ||
109 | return saved_ftrace_enabled; | ||
110 | #else | ||
111 | return 0; | ||
112 | #endif | ||
113 | } | ||
114 | |||
115 | static inline void __ftrace_enabled_restore(int enabled) | ||
116 | { | ||
117 | #ifdef CONFIG_FTRACE | ||
118 | ftrace_enabled = enabled; | ||
119 | #endif | ||
120 | } | ||
121 | |||
122 | #ifdef CONFIG_FRAME_POINTER | ||
123 | /* TODO: need to fix this for ARM */ | ||
124 | # define CALLER_ADDR0 ((unsigned long)__builtin_return_address(0)) | ||
125 | # define CALLER_ADDR1 ((unsigned long)__builtin_return_address(1)) | ||
126 | # define CALLER_ADDR2 ((unsigned long)__builtin_return_address(2)) | ||
127 | # define CALLER_ADDR3 ((unsigned long)__builtin_return_address(3)) | ||
128 | # define CALLER_ADDR4 ((unsigned long)__builtin_return_address(4)) | ||
129 | # define CALLER_ADDR5 ((unsigned long)__builtin_return_address(5)) | ||
130 | # define CALLER_ADDR6 ((unsigned long)__builtin_return_address(6)) | ||
131 | #else | ||
132 | # define CALLER_ADDR0 ((unsigned long)__builtin_return_address(0)) | ||
133 | # define CALLER_ADDR1 0UL | ||
134 | # define CALLER_ADDR2 0UL | ||
135 | # define CALLER_ADDR3 0UL | ||
136 | # define CALLER_ADDR4 0UL | ||
137 | # define CALLER_ADDR5 0UL | ||
138 | # define CALLER_ADDR6 0UL | ||
139 | #endif | ||
140 | |||
141 | #ifdef CONFIG_IRQSOFF_TRACER | ||
142 | extern void time_hardirqs_on(unsigned long a0, unsigned long a1); | ||
143 | extern void time_hardirqs_off(unsigned long a0, unsigned long a1); | ||
144 | #else | ||
145 | # define time_hardirqs_on(a0, a1) do { } while (0) | ||
146 | # define time_hardirqs_off(a0, a1) do { } while (0) | ||
147 | #endif | ||
148 | |||
149 | #ifdef CONFIG_PREEMPT_TRACER | ||
150 | extern void trace_preempt_on(unsigned long a0, unsigned long a1); | ||
151 | extern void trace_preempt_off(unsigned long a0, unsigned long a1); | ||
152 | #else | ||
153 | # define trace_preempt_on(a0, a1) do { } while (0) | ||
154 | # define trace_preempt_off(a0, a1) do { } while (0) | ||
155 | #endif | ||
156 | |||
157 | #ifdef CONFIG_TRACING | ||
158 | extern void | ||
159 | ftrace_special(unsigned long arg1, unsigned long arg2, unsigned long arg3); | ||
160 | #else | ||
161 | static inline void | ||
162 | ftrace_special(unsigned long arg1, unsigned long arg2, unsigned long arg3) { } | ||
163 | #endif | ||
164 | |||
165 | #endif /* _LINUX_FTRACE_H */ | ||
diff --git a/include/linux/fuse.h b/include/linux/fuse.h index d48282197696..265635dc9908 100644 --- a/include/linux/fuse.h +++ b/include/linux/fuse.h | |||
@@ -104,11 +104,14 @@ struct fuse_file_lock { | |||
104 | 104 | ||
105 | /** | 105 | /** |
106 | * INIT request/reply flags | 106 | * INIT request/reply flags |
107 | * | ||
108 | * FUSE_EXPORT_SUPPORT: filesystem handles lookups of "." and ".." | ||
107 | */ | 109 | */ |
108 | #define FUSE_ASYNC_READ (1 << 0) | 110 | #define FUSE_ASYNC_READ (1 << 0) |
109 | #define FUSE_POSIX_LOCKS (1 << 1) | 111 | #define FUSE_POSIX_LOCKS (1 << 1) |
110 | #define FUSE_FILE_OPS (1 << 2) | 112 | #define FUSE_FILE_OPS (1 << 2) |
111 | #define FUSE_ATOMIC_O_TRUNC (1 << 3) | 113 | #define FUSE_ATOMIC_O_TRUNC (1 << 3) |
114 | #define FUSE_EXPORT_SUPPORT (1 << 4) | ||
112 | #define FUSE_BIG_WRITES (1 << 5) | 115 | #define FUSE_BIG_WRITES (1 << 5) |
113 | 116 | ||
114 | /** | 117 | /** |
diff --git a/include/linux/gameport.h b/include/linux/gameport.h index afad95272841..f64e29c0ef3f 100644 --- a/include/linux/gameport.h +++ b/include/linux/gameport.h | |||
@@ -68,7 +68,6 @@ struct gameport_driver { | |||
68 | 68 | ||
69 | int gameport_open(struct gameport *gameport, struct gameport_driver *drv, int mode); | 69 | int gameport_open(struct gameport *gameport, struct gameport_driver *drv, int mode); |
70 | void gameport_close(struct gameport *gameport); | 70 | void gameport_close(struct gameport *gameport); |
71 | void gameport_rescan(struct gameport *gameport); | ||
72 | 71 | ||
73 | #if defined(CONFIG_GAMEPORT) || (defined(MODULE) && defined(CONFIG_GAMEPORT_MODULE)) | 72 | #if defined(CONFIG_GAMEPORT) || (defined(MODULE) && defined(CONFIG_GAMEPORT_MODULE)) |
74 | 73 | ||
diff --git a/include/linux/generic_serial.h b/include/linux/generic_serial.h index 110833666e37..4cc913939817 100644 --- a/include/linux/generic_serial.h +++ b/include/linux/generic_serial.h | |||
@@ -14,6 +14,7 @@ | |||
14 | 14 | ||
15 | #ifdef __KERNEL__ | 15 | #ifdef __KERNEL__ |
16 | #include <linux/mutex.h> | 16 | #include <linux/mutex.h> |
17 | #include <linux/tty.h> | ||
17 | 18 | ||
18 | struct real_driver { | 19 | struct real_driver { |
19 | void (*disable_tx_interrupts) (void *); | 20 | void (*disable_tx_interrupts) (void *); |
@@ -33,17 +34,12 @@ struct real_driver { | |||
33 | 34 | ||
34 | struct gs_port { | 35 | struct gs_port { |
35 | int magic; | 36 | int magic; |
37 | struct tty_port port; | ||
36 | unsigned char *xmit_buf; | 38 | unsigned char *xmit_buf; |
37 | int xmit_head; | 39 | int xmit_head; |
38 | int xmit_tail; | 40 | int xmit_tail; |
39 | int xmit_cnt; | 41 | int xmit_cnt; |
40 | struct mutex port_write_mutex; | 42 | struct mutex port_write_mutex; |
41 | int flags; | ||
42 | wait_queue_head_t open_wait; | ||
43 | wait_queue_head_t close_wait; | ||
44 | int count; | ||
45 | int blocked_open; | ||
46 | struct tty_struct *tty; | ||
47 | unsigned long event; | 43 | unsigned long event; |
48 | unsigned short closing_wait; | 44 | unsigned short closing_wait; |
49 | int close_delay; | 45 | int close_delay; |
diff --git a/include/linux/genhd.h b/include/linux/genhd.h index ae7aec3cabee..206cdf96c3a7 100644 --- a/include/linux/genhd.h +++ b/include/linux/genhd.h | |||
@@ -11,12 +11,15 @@ | |||
11 | 11 | ||
12 | #include <linux/types.h> | 12 | #include <linux/types.h> |
13 | #include <linux/kdev_t.h> | 13 | #include <linux/kdev_t.h> |
14 | #include <linux/rcupdate.h> | ||
14 | 15 | ||
15 | #ifdef CONFIG_BLOCK | 16 | #ifdef CONFIG_BLOCK |
16 | 17 | ||
17 | #define kobj_to_dev(k) container_of(k, struct device, kobj) | 18 | #define kobj_to_dev(k) container_of((k), struct device, kobj) |
18 | #define dev_to_disk(device) container_of(device, struct gendisk, dev) | 19 | #define dev_to_disk(device) container_of((device), struct gendisk, part0.__dev) |
19 | #define dev_to_part(device) container_of(device, struct hd_struct, dev) | 20 | #define dev_to_part(device) container_of((device), struct hd_struct, __dev) |
21 | #define disk_to_dev(disk) (&(disk)->part0.__dev) | ||
22 | #define part_to_dev(part) (&((part)->__dev)) | ||
20 | 23 | ||
21 | extern struct device_type part_type; | 24 | extern struct device_type part_type; |
22 | extern struct kobject *block_depr; | 25 | extern struct kobject *block_depr; |
@@ -55,6 +58,9 @@ enum { | |||
55 | UNIXWARE_PARTITION = 0x63, /* Same as GNU_HURD and SCO Unix */ | 58 | UNIXWARE_PARTITION = 0x63, /* Same as GNU_HURD and SCO Unix */ |
56 | }; | 59 | }; |
57 | 60 | ||
61 | #define DISK_MAX_PARTS 256 | ||
62 | #define DISK_NAME_LEN 32 | ||
63 | |||
58 | #include <linux/major.h> | 64 | #include <linux/major.h> |
59 | #include <linux/device.h> | 65 | #include <linux/device.h> |
60 | #include <linux/smp.h> | 66 | #include <linux/smp.h> |
@@ -87,7 +93,7 @@ struct disk_stats { | |||
87 | struct hd_struct { | 93 | struct hd_struct { |
88 | sector_t start_sect; | 94 | sector_t start_sect; |
89 | sector_t nr_sects; | 95 | sector_t nr_sects; |
90 | struct device dev; | 96 | struct device __dev; |
91 | struct kobject *holder_dir; | 97 | struct kobject *holder_dir; |
92 | int policy, partno; | 98 | int policy, partno; |
93 | #ifdef CONFIG_FAIL_MAKE_REQUEST | 99 | #ifdef CONFIG_FAIL_MAKE_REQUEST |
@@ -100,6 +106,7 @@ struct hd_struct { | |||
100 | #else | 106 | #else |
101 | struct disk_stats dkstats; | 107 | struct disk_stats dkstats; |
102 | #endif | 108 | #endif |
109 | struct rcu_head rcu_head; | ||
103 | }; | 110 | }; |
104 | 111 | ||
105 | #define GENHD_FL_REMOVABLE 1 | 112 | #define GENHD_FL_REMOVABLE 1 |
@@ -108,98 +115,148 @@ struct hd_struct { | |||
108 | #define GENHD_FL_CD 8 | 115 | #define GENHD_FL_CD 8 |
109 | #define GENHD_FL_UP 16 | 116 | #define GENHD_FL_UP 16 |
110 | #define GENHD_FL_SUPPRESS_PARTITION_INFO 32 | 117 | #define GENHD_FL_SUPPRESS_PARTITION_INFO 32 |
111 | #define GENHD_FL_FAIL 64 | 118 | #define GENHD_FL_EXT_DEVT 64 /* allow extended devt */ |
119 | |||
120 | #define BLK_SCSI_MAX_CMDS (256) | ||
121 | #define BLK_SCSI_CMD_PER_LONG (BLK_SCSI_MAX_CMDS / (sizeof(long) * 8)) | ||
112 | 122 | ||
123 | struct blk_scsi_cmd_filter { | ||
124 | unsigned long read_ok[BLK_SCSI_CMD_PER_LONG]; | ||
125 | unsigned long write_ok[BLK_SCSI_CMD_PER_LONG]; | ||
126 | struct kobject kobj; | ||
127 | }; | ||
128 | |||
129 | struct disk_part_tbl { | ||
130 | struct rcu_head rcu_head; | ||
131 | int len; | ||
132 | struct hd_struct *part[]; | ||
133 | }; | ||
113 | 134 | ||
114 | struct gendisk { | 135 | struct gendisk { |
136 | /* major, first_minor and minors are input parameters only, | ||
137 | * don't use directly. Use disk_devt() and disk_max_parts(). | ||
138 | */ | ||
115 | int major; /* major number of driver */ | 139 | int major; /* major number of driver */ |
116 | int first_minor; | 140 | int first_minor; |
117 | int minors; /* maximum number of minors, =1 for | 141 | int minors; /* maximum number of minors, =1 for |
118 | * disks that can't be partitioned. */ | 142 | * disks that can't be partitioned. */ |
119 | char disk_name[32]; /* name of major driver */ | 143 | |
120 | struct hd_struct **part; /* [indexed by minor] */ | 144 | char disk_name[DISK_NAME_LEN]; /* name of major driver */ |
145 | |||
146 | /* Array of pointers to partitions indexed by partno. | ||
147 | * Protected with matching bdev lock but stat and other | ||
148 | * non-critical accesses use RCU. Always access through | ||
149 | * helpers. | ||
150 | */ | ||
151 | struct disk_part_tbl *part_tbl; | ||
152 | struct hd_struct part0; | ||
153 | |||
121 | struct block_device_operations *fops; | 154 | struct block_device_operations *fops; |
122 | struct request_queue *queue; | 155 | struct request_queue *queue; |
123 | void *private_data; | 156 | void *private_data; |
124 | sector_t capacity; | ||
125 | 157 | ||
126 | int flags; | 158 | int flags; |
127 | struct device *driverfs_dev; // FIXME: remove | 159 | struct device *driverfs_dev; // FIXME: remove |
128 | struct device dev; | ||
129 | struct kobject *holder_dir; | ||
130 | struct kobject *slave_dir; | 160 | struct kobject *slave_dir; |
131 | 161 | ||
132 | struct timer_rand_state *random; | 162 | struct timer_rand_state *random; |
133 | int policy; | ||
134 | 163 | ||
135 | atomic_t sync_io; /* RAID */ | 164 | atomic_t sync_io; /* RAID */ |
136 | unsigned long stamp; | ||
137 | int in_flight; | ||
138 | #ifdef CONFIG_SMP | ||
139 | struct disk_stats *dkstats; | ||
140 | #else | ||
141 | struct disk_stats dkstats; | ||
142 | #endif | ||
143 | struct work_struct async_notify; | 165 | struct work_struct async_notify; |
166 | #ifdef CONFIG_BLK_DEV_INTEGRITY | ||
167 | struct blk_integrity *integrity; | ||
168 | #endif | ||
169 | int node_id; | ||
144 | }; | 170 | }; |
145 | 171 | ||
146 | /* | 172 | static inline struct gendisk *part_to_disk(struct hd_struct *part) |
147 | * Macros to operate on percpu disk statistics: | ||
148 | * | ||
149 | * The __ variants should only be called in critical sections. The full | ||
150 | * variants disable/enable preemption. | ||
151 | */ | ||
152 | static inline struct hd_struct *get_part(struct gendisk *gendiskp, | ||
153 | sector_t sector) | ||
154 | { | 173 | { |
155 | struct hd_struct *part; | 174 | if (likely(part)) { |
156 | int i; | 175 | if (part->partno) |
157 | for (i = 0; i < gendiskp->minors - 1; i++) { | 176 | return dev_to_disk(part_to_dev(part)->parent); |
158 | part = gendiskp->part[i]; | 177 | else |
159 | if (part && part->start_sect <= sector | 178 | return dev_to_disk(part_to_dev(part)); |
160 | && sector < part->start_sect + part->nr_sects) | ||
161 | return part; | ||
162 | } | 179 | } |
163 | return NULL; | 180 | return NULL; |
164 | } | 181 | } |
165 | 182 | ||
166 | #ifdef CONFIG_SMP | 183 | static inline int disk_max_parts(struct gendisk *disk) |
167 | #define __disk_stat_add(gendiskp, field, addnd) \ | 184 | { |
168 | (per_cpu_ptr(gendiskp->dkstats, smp_processor_id())->field += addnd) | 185 | if (disk->flags & GENHD_FL_EXT_DEVT) |
186 | return DISK_MAX_PARTS; | ||
187 | return disk->minors; | ||
188 | } | ||
169 | 189 | ||
170 | #define disk_stat_read(gendiskp, field) \ | 190 | static inline bool disk_partitionable(struct gendisk *disk) |
171 | ({ \ | 191 | { |
172 | typeof(gendiskp->dkstats->field) res = 0; \ | 192 | return disk_max_parts(disk) > 1; |
173 | int i; \ | 193 | } |
174 | for_each_possible_cpu(i) \ | ||
175 | res += per_cpu_ptr(gendiskp->dkstats, i)->field; \ | ||
176 | res; \ | ||
177 | }) | ||
178 | 194 | ||
179 | static inline void disk_stat_set_all(struct gendisk *gendiskp, int value) { | 195 | static inline dev_t disk_devt(struct gendisk *disk) |
180 | int i; | 196 | { |
197 | return disk_to_dev(disk)->devt; | ||
198 | } | ||
181 | 199 | ||
182 | for_each_possible_cpu(i) | 200 | static inline dev_t part_devt(struct hd_struct *part) |
183 | memset(per_cpu_ptr(gendiskp->dkstats, i), value, | 201 | { |
184 | sizeof(struct disk_stats)); | 202 | return part_to_dev(part)->devt; |
185 | } | 203 | } |
186 | 204 | ||
187 | #define __part_stat_add(part, field, addnd) \ | 205 | extern struct hd_struct *disk_get_part(struct gendisk *disk, int partno); |
188 | (per_cpu_ptr(part->dkstats, smp_processor_id())->field += addnd) | ||
189 | 206 | ||
190 | #define __all_stat_add(gendiskp, part, field, addnd, sector) \ | 207 | static inline void disk_put_part(struct hd_struct *part) |
191 | ({ \ | 208 | { |
192 | if (part) \ | 209 | if (likely(part)) |
193 | __part_stat_add(part, field, addnd); \ | 210 | put_device(part_to_dev(part)); |
194 | __disk_stat_add(gendiskp, field, addnd); \ | 211 | } |
195 | }) | 212 | |
213 | /* | ||
214 | * Smarter partition iterator without context limits. | ||
215 | */ | ||
216 | #define DISK_PITER_REVERSE (1 << 0) /* iterate in the reverse direction */ | ||
217 | #define DISK_PITER_INCL_EMPTY (1 << 1) /* include 0-sized parts */ | ||
218 | #define DISK_PITER_INCL_PART0 (1 << 2) /* include partition 0 */ | ||
219 | |||
220 | struct disk_part_iter { | ||
221 | struct gendisk *disk; | ||
222 | struct hd_struct *part; | ||
223 | int idx; | ||
224 | unsigned int flags; | ||
225 | }; | ||
226 | |||
227 | extern void disk_part_iter_init(struct disk_part_iter *piter, | ||
228 | struct gendisk *disk, unsigned int flags); | ||
229 | extern struct hd_struct *disk_part_iter_next(struct disk_part_iter *piter); | ||
230 | extern void disk_part_iter_exit(struct disk_part_iter *piter); | ||
231 | |||
232 | extern struct hd_struct *disk_map_sector_rcu(struct gendisk *disk, | ||
233 | sector_t sector); | ||
234 | |||
235 | /* | ||
236 | * Macros to operate on percpu disk statistics: | ||
237 | * | ||
238 | * {disk|part|all}_stat_{add|sub|inc|dec}() modify the stat counters | ||
239 | * and should be called between disk_stat_lock() and | ||
240 | * disk_stat_unlock(). | ||
241 | * | ||
242 | * part_stat_read() can be called at any time. | ||
243 | * | ||
244 | * part_stat_{add|set_all}() and {init|free}_part_stats are for | ||
245 | * internal use only. | ||
246 | */ | ||
247 | #ifdef CONFIG_SMP | ||
248 | #define part_stat_lock() ({ rcu_read_lock(); get_cpu(); }) | ||
249 | #define part_stat_unlock() do { put_cpu(); rcu_read_unlock(); } while (0) | ||
250 | |||
251 | #define __part_stat_add(cpu, part, field, addnd) \ | ||
252 | (per_cpu_ptr((part)->dkstats, (cpu))->field += (addnd)) | ||
196 | 253 | ||
197 | #define part_stat_read(part, field) \ | 254 | #define part_stat_read(part, field) \ |
198 | ({ \ | 255 | ({ \ |
199 | typeof(part->dkstats->field) res = 0; \ | 256 | typeof((part)->dkstats->field) res = 0; \ |
200 | int i; \ | 257 | int i; \ |
201 | for_each_possible_cpu(i) \ | 258 | for_each_possible_cpu(i) \ |
202 | res += per_cpu_ptr(part->dkstats, i)->field; \ | 259 | res += per_cpu_ptr((part)->dkstats, i)->field; \ |
203 | res; \ | 260 | res; \ |
204 | }) | 261 | }) |
205 | 262 | ||
@@ -211,171 +268,107 @@ static inline void part_stat_set_all(struct hd_struct *part, int value) | |||
211 | memset(per_cpu_ptr(part->dkstats, i), value, | 268 | memset(per_cpu_ptr(part->dkstats, i), value, |
212 | sizeof(struct disk_stats)); | 269 | sizeof(struct disk_stats)); |
213 | } | 270 | } |
214 | |||
215 | #else /* !CONFIG_SMP */ | ||
216 | #define __disk_stat_add(gendiskp, field, addnd) \ | ||
217 | (gendiskp->dkstats.field += addnd) | ||
218 | #define disk_stat_read(gendiskp, field) (gendiskp->dkstats.field) | ||
219 | 271 | ||
220 | static inline void disk_stat_set_all(struct gendisk *gendiskp, int value) | 272 | static inline int init_part_stats(struct hd_struct *part) |
221 | { | 273 | { |
222 | memset(&gendiskp->dkstats, value, sizeof (struct disk_stats)); | 274 | part->dkstats = alloc_percpu(struct disk_stats); |
275 | if (!part->dkstats) | ||
276 | return 0; | ||
277 | return 1; | ||
223 | } | 278 | } |
224 | 279 | ||
225 | #define __part_stat_add(part, field, addnd) \ | 280 | static inline void free_part_stats(struct hd_struct *part) |
226 | (part->dkstats.field += addnd) | ||
227 | |||
228 | #define __all_stat_add(gendiskp, part, field, addnd, sector) \ | ||
229 | ({ \ | ||
230 | if (part) \ | ||
231 | part->dkstats.field += addnd; \ | ||
232 | __disk_stat_add(gendiskp, field, addnd); \ | ||
233 | }) | ||
234 | |||
235 | #define part_stat_read(part, field) (part->dkstats.field) | ||
236 | |||
237 | static inline void part_stat_set_all(struct hd_struct *part, int value) | ||
238 | { | 281 | { |
239 | memset(&part->dkstats, value, sizeof(struct disk_stats)); | 282 | free_percpu(part->dkstats); |
240 | } | 283 | } |
241 | 284 | ||
242 | #endif /* CONFIG_SMP */ | 285 | #else /* !CONFIG_SMP */ |
286 | #define part_stat_lock() ({ rcu_read_lock(); 0; }) | ||
287 | #define part_stat_unlock() rcu_read_unlock() | ||
243 | 288 | ||
244 | #define disk_stat_add(gendiskp, field, addnd) \ | 289 | #define __part_stat_add(cpu, part, field, addnd) \ |
245 | do { \ | 290 | ((part)->dkstats.field += addnd) |
246 | preempt_disable(); \ | 291 | |
247 | __disk_stat_add(gendiskp, field, addnd); \ | 292 | #define part_stat_read(part, field) ((part)->dkstats.field) |
248 | preempt_enable(); \ | ||
249 | } while (0) | ||
250 | |||
251 | #define __disk_stat_dec(gendiskp, field) __disk_stat_add(gendiskp, field, -1) | ||
252 | #define disk_stat_dec(gendiskp, field) disk_stat_add(gendiskp, field, -1) | ||
253 | |||
254 | #define __disk_stat_inc(gendiskp, field) __disk_stat_add(gendiskp, field, 1) | ||
255 | #define disk_stat_inc(gendiskp, field) disk_stat_add(gendiskp, field, 1) | ||
256 | |||
257 | #define __disk_stat_sub(gendiskp, field, subnd) \ | ||
258 | __disk_stat_add(gendiskp, field, -subnd) | ||
259 | #define disk_stat_sub(gendiskp, field, subnd) \ | ||
260 | disk_stat_add(gendiskp, field, -subnd) | ||
261 | |||
262 | #define part_stat_add(gendiskp, field, addnd) \ | ||
263 | do { \ | ||
264 | preempt_disable(); \ | ||
265 | __part_stat_add(gendiskp, field, addnd);\ | ||
266 | preempt_enable(); \ | ||
267 | } while (0) | ||
268 | |||
269 | #define __part_stat_dec(gendiskp, field) __part_stat_add(gendiskp, field, -1) | ||
270 | #define part_stat_dec(gendiskp, field) part_stat_add(gendiskp, field, -1) | ||
271 | |||
272 | #define __part_stat_inc(gendiskp, field) __part_stat_add(gendiskp, field, 1) | ||
273 | #define part_stat_inc(gendiskp, field) part_stat_add(gendiskp, field, 1) | ||
274 | |||
275 | #define __part_stat_sub(gendiskp, field, subnd) \ | ||
276 | __part_stat_add(gendiskp, field, -subnd) | ||
277 | #define part_stat_sub(gendiskp, field, subnd) \ | ||
278 | part_stat_add(gendiskp, field, -subnd) | ||
279 | |||
280 | #define all_stat_add(gendiskp, part, field, addnd, sector) \ | ||
281 | do { \ | ||
282 | preempt_disable(); \ | ||
283 | __all_stat_add(gendiskp, part, field, addnd, sector); \ | ||
284 | preempt_enable(); \ | ||
285 | } while (0) | ||
286 | |||
287 | #define __all_stat_dec(gendiskp, field, sector) \ | ||
288 | __all_stat_add(gendiskp, field, -1, sector) | ||
289 | #define all_stat_dec(gendiskp, field, sector) \ | ||
290 | all_stat_add(gendiskp, field, -1, sector) | ||
291 | |||
292 | #define __all_stat_inc(gendiskp, part, field, sector) \ | ||
293 | __all_stat_add(gendiskp, part, field, 1, sector) | ||
294 | #define all_stat_inc(gendiskp, part, field, sector) \ | ||
295 | all_stat_add(gendiskp, part, field, 1, sector) | ||
296 | |||
297 | #define __all_stat_sub(gendiskp, part, field, subnd, sector) \ | ||
298 | __all_stat_add(gendiskp, part, field, -subnd, sector) | ||
299 | #define all_stat_sub(gendiskp, part, field, subnd, sector) \ | ||
300 | all_stat_add(gendiskp, part, field, -subnd, sector) | ||
301 | |||
302 | /* Inlines to alloc and free disk stats in struct gendisk */ | ||
303 | #ifdef CONFIG_SMP | ||
304 | static inline int init_disk_stats(struct gendisk *disk) | ||
305 | { | ||
306 | disk->dkstats = alloc_percpu(struct disk_stats); | ||
307 | if (!disk->dkstats) | ||
308 | return 0; | ||
309 | return 1; | ||
310 | } | ||
311 | 293 | ||
312 | static inline void free_disk_stats(struct gendisk *disk) | 294 | static inline void part_stat_set_all(struct hd_struct *part, int value) |
313 | { | 295 | { |
314 | free_percpu(disk->dkstats); | 296 | memset(&part->dkstats, value, sizeof(struct disk_stats)); |
315 | } | 297 | } |
316 | 298 | ||
317 | static inline int init_part_stats(struct hd_struct *part) | 299 | static inline int init_part_stats(struct hd_struct *part) |
318 | { | 300 | { |
319 | part->dkstats = alloc_percpu(struct disk_stats); | ||
320 | if (!part->dkstats) | ||
321 | return 0; | ||
322 | return 1; | 301 | return 1; |
323 | } | 302 | } |
324 | 303 | ||
325 | static inline void free_part_stats(struct hd_struct *part) | 304 | static inline void free_part_stats(struct hd_struct *part) |
326 | { | 305 | { |
327 | free_percpu(part->dkstats); | ||
328 | } | ||
329 | |||
330 | #else /* CONFIG_SMP */ | ||
331 | static inline int init_disk_stats(struct gendisk *disk) | ||
332 | { | ||
333 | return 1; | ||
334 | } | 306 | } |
335 | 307 | ||
336 | static inline void free_disk_stats(struct gendisk *disk) | 308 | #endif /* CONFIG_SMP */ |
337 | { | ||
338 | } | ||
339 | 309 | ||
340 | static inline int init_part_stats(struct hd_struct *part) | 310 | #define part_stat_add(cpu, part, field, addnd) do { \ |
311 | __part_stat_add((cpu), (part), field, addnd); \ | ||
312 | if ((part)->partno) \ | ||
313 | __part_stat_add((cpu), &part_to_disk((part))->part0, \ | ||
314 | field, addnd); \ | ||
315 | } while (0) | ||
316 | |||
317 | #define part_stat_dec(cpu, gendiskp, field) \ | ||
318 | part_stat_add(cpu, gendiskp, field, -1) | ||
319 | #define part_stat_inc(cpu, gendiskp, field) \ | ||
320 | part_stat_add(cpu, gendiskp, field, 1) | ||
321 | #define part_stat_sub(cpu, gendiskp, field, subnd) \ | ||
322 | part_stat_add(cpu, gendiskp, field, -subnd) | ||
323 | |||
324 | static inline void part_inc_in_flight(struct hd_struct *part) | ||
341 | { | 325 | { |
342 | return 1; | 326 | part->in_flight++; |
327 | if (part->partno) | ||
328 | part_to_disk(part)->part0.in_flight++; | ||
343 | } | 329 | } |
344 | 330 | ||
345 | static inline void free_part_stats(struct hd_struct *part) | 331 | static inline void part_dec_in_flight(struct hd_struct *part) |
346 | { | 332 | { |
333 | part->in_flight--; | ||
334 | if (part->partno) | ||
335 | part_to_disk(part)->part0.in_flight--; | ||
347 | } | 336 | } |
348 | #endif /* CONFIG_SMP */ | ||
349 | 337 | ||
350 | /* drivers/block/ll_rw_blk.c */ | 338 | /* drivers/block/ll_rw_blk.c */ |
351 | extern void disk_round_stats(struct gendisk *disk); | 339 | extern void part_round_stats(int cpu, struct hd_struct *part); |
352 | extern void part_round_stats(struct hd_struct *part); | ||
353 | 340 | ||
354 | /* drivers/block/genhd.c */ | 341 | /* drivers/block/genhd.c */ |
355 | extern int get_blkdev_list(char *, int); | 342 | extern int get_blkdev_list(char *, int); |
356 | extern void add_disk(struct gendisk *disk); | 343 | extern void add_disk(struct gendisk *disk); |
357 | extern void del_gendisk(struct gendisk *gp); | 344 | extern void del_gendisk(struct gendisk *gp); |
358 | extern void unlink_gendisk(struct gendisk *gp); | 345 | extern void unlink_gendisk(struct gendisk *gp); |
359 | extern struct gendisk *get_gendisk(dev_t dev, int *part); | 346 | extern struct gendisk *get_gendisk(dev_t dev, int *partno); |
347 | extern struct block_device *bdget_disk(struct gendisk *disk, int partno); | ||
360 | 348 | ||
361 | extern void set_device_ro(struct block_device *bdev, int flag); | 349 | extern void set_device_ro(struct block_device *bdev, int flag); |
362 | extern void set_disk_ro(struct gendisk *disk, int flag); | 350 | extern void set_disk_ro(struct gendisk *disk, int flag); |
363 | 351 | ||
352 | static inline int get_disk_ro(struct gendisk *disk) | ||
353 | { | ||
354 | return disk->part0.policy; | ||
355 | } | ||
356 | |||
364 | /* drivers/char/random.c */ | 357 | /* drivers/char/random.c */ |
365 | extern void add_disk_randomness(struct gendisk *disk); | 358 | extern void add_disk_randomness(struct gendisk *disk); |
366 | extern void rand_initialize_disk(struct gendisk *disk); | 359 | extern void rand_initialize_disk(struct gendisk *disk); |
367 | 360 | ||
368 | static inline sector_t get_start_sect(struct block_device *bdev) | 361 | static inline sector_t get_start_sect(struct block_device *bdev) |
369 | { | 362 | { |
370 | return bdev->bd_contains == bdev ? 0 : bdev->bd_part->start_sect; | 363 | return bdev->bd_part->start_sect; |
371 | } | 364 | } |
372 | static inline sector_t get_capacity(struct gendisk *disk) | 365 | static inline sector_t get_capacity(struct gendisk *disk) |
373 | { | 366 | { |
374 | return disk->capacity; | 367 | return disk->part0.nr_sects; |
375 | } | 368 | } |
376 | static inline void set_capacity(struct gendisk *disk, sector_t size) | 369 | static inline void set_capacity(struct gendisk *disk, sector_t size) |
377 | { | 370 | { |
378 | disk->capacity = size; | 371 | disk->part0.nr_sects = size; |
379 | } | 372 | } |
380 | 373 | ||
381 | #ifdef CONFIG_SOLARIS_X86_PARTITION | 374 | #ifdef CONFIG_SOLARIS_X86_PARTITION |
@@ -525,11 +518,14 @@ struct unixware_disklabel { | |||
525 | #define ADDPART_FLAG_RAID 1 | 518 | #define ADDPART_FLAG_RAID 1 |
526 | #define ADDPART_FLAG_WHOLEDISK 2 | 519 | #define ADDPART_FLAG_WHOLEDISK 2 |
527 | 520 | ||
528 | extern dev_t blk_lookup_devt(const char *name, int part); | 521 | extern int blk_alloc_devt(struct hd_struct *part, dev_t *devt); |
529 | extern char *disk_name (struct gendisk *hd, int part, char *buf); | 522 | extern void blk_free_devt(dev_t devt); |
523 | extern dev_t blk_lookup_devt(const char *name, int partno); | ||
524 | extern char *disk_name (struct gendisk *hd, int partno, char *buf); | ||
530 | 525 | ||
526 | extern int disk_expand_part_tbl(struct gendisk *disk, int target); | ||
531 | extern int rescan_partitions(struct gendisk *disk, struct block_device *bdev); | 527 | extern int rescan_partitions(struct gendisk *disk, struct block_device *bdev); |
532 | extern void add_partition(struct gendisk *, int, sector_t, sector_t, int); | 528 | extern int __must_check add_partition(struct gendisk *, int, sector_t, sector_t, int); |
533 | extern void delete_partition(struct gendisk *, int); | 529 | extern void delete_partition(struct gendisk *, int); |
534 | extern void printk_all_partitions(void); | 530 | extern void printk_all_partitions(void); |
535 | 531 | ||
@@ -544,16 +540,23 @@ extern void blk_register_region(dev_t devt, unsigned long range, | |||
544 | void *data); | 540 | void *data); |
545 | extern void blk_unregister_region(dev_t devt, unsigned long range); | 541 | extern void blk_unregister_region(dev_t devt, unsigned long range); |
546 | 542 | ||
547 | static inline struct block_device *bdget_disk(struct gendisk *disk, int index) | 543 | extern ssize_t part_size_show(struct device *dev, |
548 | { | 544 | struct device_attribute *attr, char *buf); |
549 | return bdget(MKDEV(disk->major, disk->first_minor) + index); | 545 | extern ssize_t part_stat_show(struct device *dev, |
550 | } | 546 | struct device_attribute *attr, char *buf); |
547 | #ifdef CONFIG_FAIL_MAKE_REQUEST | ||
548 | extern ssize_t part_fail_show(struct device *dev, | ||
549 | struct device_attribute *attr, char *buf); | ||
550 | extern ssize_t part_fail_store(struct device *dev, | ||
551 | struct device_attribute *attr, | ||
552 | const char *buf, size_t count); | ||
553 | #endif /* CONFIG_FAIL_MAKE_REQUEST */ | ||
551 | 554 | ||
552 | #else /* CONFIG_BLOCK */ | 555 | #else /* CONFIG_BLOCK */ |
553 | 556 | ||
554 | static inline void printk_all_partitions(void) { } | 557 | static inline void printk_all_partitions(void) { } |
555 | 558 | ||
556 | static inline dev_t blk_lookup_devt(const char *name, int part) | 559 | static inline dev_t blk_lookup_devt(const char *name, int partno) |
557 | { | 560 | { |
558 | dev_t devt = MKDEV(0, 0); | 561 | dev_t devt = MKDEV(0, 0); |
559 | return devt; | 562 | return devt; |
diff --git a/include/linux/gfp.h b/include/linux/gfp.h index b414be387180..e8003afeffba 100644 --- a/include/linux/gfp.h +++ b/include/linux/gfp.h | |||
@@ -173,11 +173,24 @@ static inline void arch_free_page(struct page *page, int order) { } | |||
173 | static inline void arch_alloc_page(struct page *page, int order) { } | 173 | static inline void arch_alloc_page(struct page *page, int order) { } |
174 | #endif | 174 | #endif |
175 | 175 | ||
176 | extern struct page *__alloc_pages(gfp_t, unsigned int, struct zonelist *); | 176 | struct page * |
177 | __alloc_pages_internal(gfp_t gfp_mask, unsigned int order, | ||
178 | struct zonelist *zonelist, nodemask_t *nodemask); | ||
179 | |||
180 | static inline struct page * | ||
181 | __alloc_pages(gfp_t gfp_mask, unsigned int order, | ||
182 | struct zonelist *zonelist) | ||
183 | { | ||
184 | return __alloc_pages_internal(gfp_mask, order, zonelist, NULL); | ||
185 | } | ||
186 | |||
187 | static inline struct page * | ||
188 | __alloc_pages_nodemask(gfp_t gfp_mask, unsigned int order, | ||
189 | struct zonelist *zonelist, nodemask_t *nodemask) | ||
190 | { | ||
191 | return __alloc_pages_internal(gfp_mask, order, zonelist, nodemask); | ||
192 | } | ||
177 | 193 | ||
178 | extern struct page * | ||
179 | __alloc_pages_nodemask(gfp_t, unsigned int, | ||
180 | struct zonelist *, nodemask_t *nodemask); | ||
181 | 194 | ||
182 | static inline struct page *alloc_pages_node(int nid, gfp_t gfp_mask, | 195 | static inline struct page *alloc_pages_node(int nid, gfp_t gfp_mask, |
183 | unsigned int order) | 196 | unsigned int order) |
@@ -215,6 +228,9 @@ extern struct page *alloc_page_vma(gfp_t gfp_mask, | |||
215 | extern unsigned long __get_free_pages(gfp_t gfp_mask, unsigned int order); | 228 | extern unsigned long __get_free_pages(gfp_t gfp_mask, unsigned int order); |
216 | extern unsigned long get_zeroed_page(gfp_t gfp_mask); | 229 | extern unsigned long get_zeroed_page(gfp_t gfp_mask); |
217 | 230 | ||
231 | void *alloc_pages_exact(size_t size, gfp_t gfp_mask); | ||
232 | void free_pages_exact(void *virt, size_t size); | ||
233 | |||
218 | #define __get_free_page(gfp_mask) \ | 234 | #define __get_free_page(gfp_mask) \ |
219 | __get_free_pages((gfp_mask),0) | 235 | __get_free_pages((gfp_mask),0) |
220 | 236 | ||
diff --git a/include/linux/gfs2_ondisk.h b/include/linux/gfs2_ondisk.h index c3c19f926e6f..14d0df0b5749 100644 --- a/include/linux/gfs2_ondisk.h +++ b/include/linux/gfs2_ondisk.h | |||
@@ -118,7 +118,11 @@ struct gfs2_sb { | |||
118 | 118 | ||
119 | char sb_lockproto[GFS2_LOCKNAME_LEN]; | 119 | char sb_lockproto[GFS2_LOCKNAME_LEN]; |
120 | char sb_locktable[GFS2_LOCKNAME_LEN]; | 120 | char sb_locktable[GFS2_LOCKNAME_LEN]; |
121 | /* In gfs1, quota and license dinodes followed */ | 121 | |
122 | struct gfs2_inum __pad3; /* Was quota inode in gfs1 */ | ||
123 | struct gfs2_inum __pad4; /* Was licence inode in gfs1 */ | ||
124 | #define GFS2_HAS_UUID 1 | ||
125 | __u8 sb_uuid[16]; /* The UUID, maybe 0 for backwards compat */ | ||
122 | }; | 126 | }; |
123 | 127 | ||
124 | /* | 128 | /* |
diff --git a/include/linux/gpio.h b/include/linux/gpio.h index 98be6c5762b9..730a20b83576 100644 --- a/include/linux/gpio.h +++ b/include/linux/gpio.h | |||
@@ -79,6 +79,19 @@ static inline void gpio_set_value_cansleep(unsigned gpio, int value) | |||
79 | WARN_ON(1); | 79 | WARN_ON(1); |
80 | } | 80 | } |
81 | 81 | ||
82 | static inline int gpio_export(unsigned gpio, bool direction_may_change) | ||
83 | { | ||
84 | /* GPIO can never have been requested or set as {in,out}put */ | ||
85 | WARN_ON(1); | ||
86 | return -EINVAL; | ||
87 | } | ||
88 | |||
89 | static inline void gpio_unexport(unsigned gpio) | ||
90 | { | ||
91 | /* GPIO can never have been exported */ | ||
92 | WARN_ON(1); | ||
93 | } | ||
94 | |||
82 | static inline int gpio_to_irq(unsigned gpio) | 95 | static inline int gpio_to_irq(unsigned gpio) |
83 | { | 96 | { |
84 | /* GPIO can never have been requested or set as input */ | 97 | /* GPIO can never have been requested or set as input */ |
diff --git a/include/linux/gpio_keys.h b/include/linux/gpio_keys.h index c6d3a9de5634..ec6ecd74781d 100644 --- a/include/linux/gpio_keys.h +++ b/include/linux/gpio_keys.h | |||
@@ -9,6 +9,7 @@ struct gpio_keys_button { | |||
9 | char *desc; | 9 | char *desc; |
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 | }; | 13 | }; |
13 | 14 | ||
14 | struct gpio_keys_platform_data { | 15 | struct gpio_keys_platform_data { |
diff --git a/include/linux/harrier_defs.h b/include/linux/harrier_defs.h deleted file mode 100644 index efef11db790f..000000000000 --- a/include/linux/harrier_defs.h +++ /dev/null | |||
@@ -1,212 +0,0 @@ | |||
1 | /* | ||
2 | * include/linux/harrier_defs.h | ||
3 | * | ||
4 | * Definitions for Motorola MCG Harrier North Bridge & Memory controller | ||
5 | * | ||
6 | * Author: Dale Farnsworth | ||
7 | * dale.farnsworth@mvista.com | ||
8 | * | ||
9 | * Extracted from asm-ppc/harrier.h by: | ||
10 | * Randy Vinson | ||
11 | * rvinson@mvista.com | ||
12 | * | ||
13 | * Copyright 2001-2002 MontaVista Software Inc. | ||
14 | * | ||
15 | * This program is free software; you can redistribute it and/or modify it | ||
16 | * under the terms of the GNU General Public License as published by the | ||
17 | * Free Software Foundation; either version 2 of the License, or (at your | ||
18 | * option) any later version. | ||
19 | */ | ||
20 | |||
21 | #ifndef __ASMPPC_HARRIER_DEFS_H | ||
22 | #define __ASMPPC_HARRIER_DEFS_H | ||
23 | |||
24 | #define HARRIER_DEFAULT_XCSR_BASE 0xfeff0000 | ||
25 | |||
26 | #define HARRIER_VEND_DEV_ID 0x1057480b | ||
27 | |||
28 | #define HARRIER_VENI_OFF 0x00 | ||
29 | |||
30 | #define HARRIER_REVI_OFF 0x05 | ||
31 | #define HARRIER_UCTL_OFF 0xd0 | ||
32 | #define HARRIER_XTAL64_MASK 0x02 | ||
33 | |||
34 | #define HARRIER_MISC_CSR_OFF 0x1c | ||
35 | #define HARRIER_RSTOUT 0x01000000 | ||
36 | #define HARRIER_SYSCON 0x08000000 | ||
37 | #define HARRIER_EREADY 0x10000000 | ||
38 | #define HARRIER_ERDYS 0x20000000 | ||
39 | |||
40 | /* Function exception registers */ | ||
41 | #define HARRIER_FEEN_OFF 0x40 /* enable */ | ||
42 | #define HARRIER_FEST_OFF 0x44 /* status */ | ||
43 | #define HARRIER_FEMA_OFF 0x48 /* mask */ | ||
44 | #define HARRIER_FECL_OFF 0x4c /* clear */ | ||
45 | |||
46 | #define HARRIER_FE_DMA 0x80 | ||
47 | #define HARRIER_FE_MIDB 0x40 | ||
48 | #define HARRIER_FE_MIM0 0x20 | ||
49 | #define HARRIER_FE_MIM1 0x10 | ||
50 | #define HARRIER_FE_MIP 0x08 | ||
51 | #define HARRIER_FE_UA0 0x04 | ||
52 | #define HARRIER_FE_UA1 0x02 | ||
53 | #define HARRIER_FE_ABT 0x01 | ||
54 | |||
55 | #define HARRIER_SERIAL_0_OFF 0xc0 | ||
56 | |||
57 | #define HARRIER_MBAR_OFF 0xe0 | ||
58 | #define HARRIER_MBAR_MSK 0xfffc0000 | ||
59 | #define HARRIER_MPIC_CSR_OFF 0xe4 | ||
60 | #define HARRIER_MPIC_OPI_ENABLE 0x40 | ||
61 | #define HARRIER_MPIC_IFEVP_OFF 0x10200 | ||
62 | #define HARRIER_MPIC_IFEVP_VECT_MSK 0xff | ||
63 | #define HARRIER_MPIC_IFEDE_OFF 0x10210 | ||
64 | |||
65 | /* | ||
66 | * Define the Memory Controller register offsets. | ||
67 | */ | ||
68 | #define HARRIER_SDBA_OFF 0x110 | ||
69 | #define HARRIER_SDBB_OFF 0x114 | ||
70 | #define HARRIER_SDBC_OFF 0x118 | ||
71 | #define HARRIER_SDBD_OFF 0x11c | ||
72 | #define HARRIER_SDBE_OFF 0x120 | ||
73 | #define HARRIER_SDBF_OFF 0x124 | ||
74 | #define HARRIER_SDBG_OFF 0x128 | ||
75 | #define HARRIER_SDBH_OFF 0x12c | ||
76 | |||
77 | #define HARRIER_SDB_ENABLE 0x00000100 | ||
78 | #define HARRIER_SDB_SIZE_MASK 0xf | ||
79 | #define HARRIER_SDB_SIZE_SHIFT 16 | ||
80 | #define HARRIER_SDB_BASE_MASK 0xff | ||
81 | #define HARRIER_SDB_BASE_SHIFT 24 | ||
82 | |||
83 | /* | ||
84 | * Define outbound register offsets. | ||
85 | */ | ||
86 | #define HARRIER_OTAD0_OFF 0x220 | ||
87 | #define HARRIER_OTOF0_OFF 0x224 | ||
88 | #define HARRIER_OTAD1_OFF 0x228 | ||
89 | #define HARRIER_OTOF1_OFF 0x22c | ||
90 | #define HARRIER_OTAD2_OFF 0x230 | ||
91 | #define HARRIER_OTOF2_OFF 0x234 | ||
92 | #define HARRIER_OTAD3_OFF 0x238 | ||
93 | #define HARRIER_OTOF3_OFF 0x23c | ||
94 | |||
95 | #define HARRIER_OTADX_START_MSK 0xffff0000UL | ||
96 | #define HARRIER_OTADX_END_MSK 0x0000ffffUL | ||
97 | |||
98 | #define HARRIER_OTOFX_OFF_MSK 0xffff0000UL | ||
99 | #define HARRIER_OTOFX_ENA 0x80UL | ||
100 | #define HARRIER_OTOFX_WPE 0x10UL | ||
101 | #define HARRIER_OTOFX_SGE 0x08UL | ||
102 | #define HARRIER_OTOFX_RAE 0x04UL | ||
103 | #define HARRIER_OTOFX_MEM 0x02UL | ||
104 | #define HARRIER_OTOFX_IOM 0x01UL | ||
105 | |||
106 | /* | ||
107 | * Define generic message passing register offsets | ||
108 | */ | ||
109 | /* Mirrored registers (visible from both PowerPC and PCI space) */ | ||
110 | #define HARRIER_XCSR_MP_BASE_OFF 0x290 /* base offset in XCSR space */ | ||
111 | #define HARRIER_PMEP_MP_BASE_OFF 0x100 /* base offset in PMEM space */ | ||
112 | #define HARRIER_MGOM0_OFF 0x00 /* outbound msg 0 */ | ||
113 | #define HARRIER_MGOM1_OFF 0x04 /* outbound msg 1 */ | ||
114 | #define HARRIER_MGOD_OFF 0x08 /* outbound doorbells */ | ||
115 | |||
116 | #define HARRIER_MGIM0_OFF 0x10 /* inbound msg 0 */ | ||
117 | #define HARRIER_MGIM1_OFF 0x14 /* inbound msg 1 */ | ||
118 | #define HARRIER_MGID_OFF 0x18 /* inbound doorbells */ | ||
119 | |||
120 | /* PowerPC-only registers */ | ||
121 | #define HARRIER_MGIDM_OFF 0x20 /* inbound doorbell mask */ | ||
122 | |||
123 | /* PCI-only registers */ | ||
124 | #define HARRIER_PMEP_MGST_OFF 0x20 /* (outbound) interrupt status */ | ||
125 | #define HARRIER_PMEP_MGMS_OFF 0x24 /* (outbound) interrupt mask */ | ||
126 | #define HARRIER_MG_OMI0 (1<<4) | ||
127 | #define HARRIER_MG_OMI1 (1<<5) | ||
128 | |||
129 | #define HARRIER_PMEP_MGODM_OFF 0x28 /* outbound doorbell mask */ | ||
130 | |||
131 | /* | ||
132 | * Define PCI configuration space register offsets | ||
133 | */ | ||
134 | #define HARRIER_XCSR_TO_PCFS_OFF 0x300 | ||
135 | |||
136 | /* | ||
137 | * Define message passing attribute register offset | ||
138 | */ | ||
139 | #define HARRIER_MPAT_OFF 0x44 | ||
140 | |||
141 | /* | ||
142 | * Define inbound attribute register offsets. | ||
143 | */ | ||
144 | #define HARRIER_ITSZ0_OFF 0x48 | ||
145 | #define HARRIER_ITAT0_OFF 0x4c | ||
146 | |||
147 | #define HARRIER_ITSZ1_OFF 0x50 | ||
148 | #define HARRIER_ITAT1_OFF 0x54 | ||
149 | |||
150 | #define HARRIER_ITSZ2_OFF 0x58 | ||
151 | #define HARRIER_ITAT2_OFF 0x5c | ||
152 | |||
153 | #define HARRIER_ITSZ3_OFF 0x60 | ||
154 | #define HARRIER_ITAT3_OFF 0x64 | ||
155 | |||
156 | /* inbound translation size constants */ | ||
157 | #define HARRIER_ITSZ_MSK 0xff | ||
158 | #define HARRIER_ITSZ_4KB 0x00 | ||
159 | #define HARRIER_ITSZ_8KB 0x01 | ||
160 | #define HARRIER_ITSZ_16KB 0x02 | ||
161 | #define HARRIER_ITSZ_32KB 0x03 | ||
162 | #define HARRIER_ITSZ_64KB 0x04 | ||
163 | #define HARRIER_ITSZ_128KB 0x05 | ||
164 | #define HARRIER_ITSZ_256KB 0x06 | ||
165 | #define HARRIER_ITSZ_512KB 0x07 | ||
166 | #define HARRIER_ITSZ_1MB 0x08 | ||
167 | #define HARRIER_ITSZ_2MB 0x09 | ||
168 | #define HARRIER_ITSZ_4MB 0x0A | ||
169 | #define HARRIER_ITSZ_8MB 0x0B | ||
170 | #define HARRIER_ITSZ_16MB 0x0C | ||
171 | #define HARRIER_ITSZ_32MB 0x0D | ||
172 | #define HARRIER_ITSZ_64MB 0x0E | ||
173 | #define HARRIER_ITSZ_128MB 0x0F | ||
174 | #define HARRIER_ITSZ_256MB 0x10 | ||
175 | #define HARRIER_ITSZ_512MB 0x11 | ||
176 | #define HARRIER_ITSZ_1GB 0x12 | ||
177 | #define HARRIER_ITSZ_2GB 0x13 | ||
178 | |||
179 | /* inbound translation offset */ | ||
180 | #define HARRIER_ITOF_SHIFT 0x10 | ||
181 | #define HARRIER_ITOF_MSK 0xffff | ||
182 | |||
183 | /* inbound translation atttributes */ | ||
184 | #define HARRIER_ITAT_PRE (1<<3) | ||
185 | #define HARRIER_ITAT_RAE (1<<4) | ||
186 | #define HARRIER_ITAT_WPE (1<<5) | ||
187 | #define HARRIER_ITAT_MEM (1<<6) | ||
188 | #define HARRIER_ITAT_ENA (1<<7) | ||
189 | #define HARRIER_ITAT_GBL (1<<16) | ||
190 | |||
191 | #define HARRIER_LBA_OFF 0x80 | ||
192 | #define HARRIER_LBA_MSK (1<<31) | ||
193 | |||
194 | #define HARRIER_XCSR_SIZE 1024 | ||
195 | |||
196 | /* macros to calculate message passing register offsets */ | ||
197 | #define HARRIER_MP_XCSR(x) ((u32)HARRIER_XCSR_MP_BASE_OFF + (u32)x) | ||
198 | |||
199 | #define HARRIER_MP_PMEP(x) ((u32)HARRIER_PMEP_MP_BASE_OFF + (u32)x) | ||
200 | |||
201 | /* | ||
202 | * Define PCI configuration space register offsets | ||
203 | */ | ||
204 | #define HARRIER_MPBAR_OFF PCI_BASE_ADDRESS_0 | ||
205 | #define HARRIER_ITBAR0_OFF PCI_BASE_ADDRESS_1 | ||
206 | #define HARRIER_ITBAR1_OFF PCI_BASE_ADDRESS_2 | ||
207 | #define HARRIER_ITBAR2_OFF PCI_BASE_ADDRESS_3 | ||
208 | #define HARRIER_ITBAR3_OFF PCI_BASE_ADDRESS_4 | ||
209 | |||
210 | #define HARRIER_XCSR_CONFIG(x) ((u32)HARRIER_XCSR_TO_PCFS_OFF + (u32)x) | ||
211 | |||
212 | #endif /* __ASMPPC_HARRIER_DEFS_H */ | ||
diff --git a/include/linux/hayesesp.h b/include/linux/hayesesp.h index 2177ee5b2fe2..940aeb51d53f 100644 --- a/include/linux/hayesesp.h +++ b/include/linux/hayesesp.h | |||
@@ -76,11 +76,10 @@ struct hayes_esp_config { | |||
76 | 76 | ||
77 | struct esp_struct { | 77 | struct esp_struct { |
78 | int magic; | 78 | int magic; |
79 | struct tty_port port; | ||
79 | spinlock_t lock; | 80 | spinlock_t lock; |
80 | int port; | 81 | int io_port; |
81 | int irq; | 82 | int irq; |
82 | int flags; /* defined in tty.h */ | ||
83 | struct tty_struct *tty; | ||
84 | int read_status_mask; | 83 | int read_status_mask; |
85 | int ignore_status_mask; | 84 | int ignore_status_mask; |
86 | int timeout; | 85 | int timeout; |
@@ -93,14 +92,10 @@ struct esp_struct { | |||
93 | int MCR; /* Modem control register */ | 92 | int MCR; /* Modem control register */ |
94 | unsigned long last_active; | 93 | unsigned long last_active; |
95 | int line; | 94 | int line; |
96 | int count; /* # of fd on device */ | ||
97 | int blocked_open; /* # of blocked opens */ | ||
98 | unsigned char *xmit_buf; | 95 | unsigned char *xmit_buf; |
99 | int xmit_head; | 96 | int xmit_head; |
100 | int xmit_tail; | 97 | int xmit_tail; |
101 | int xmit_cnt; | 98 | int xmit_cnt; |
102 | wait_queue_head_t open_wait; | ||
103 | wait_queue_head_t close_wait; | ||
104 | wait_queue_head_t delta_msr_wait; | 99 | wait_queue_head_t delta_msr_wait; |
105 | wait_queue_head_t break_wait; | 100 | wait_queue_head_t break_wait; |
106 | struct async_icount icount; /* kernel counters for the 4 input interrupts */ | 101 | struct async_icount icount; /* kernel counters for the 4 input interrupts */ |
diff --git a/include/linux/hdlc.h b/include/linux/hdlc.h index 6115545a5b9c..c59769693bee 100644 --- a/include/linux/hdlc.h +++ b/include/linux/hdlc.h | |||
@@ -45,7 +45,6 @@ struct hdlc_proto { | |||
45 | 45 | ||
46 | /* Pointed to by dev->priv */ | 46 | /* Pointed to by dev->priv */ |
47 | typedef struct hdlc_device { | 47 | typedef struct hdlc_device { |
48 | struct net_device_stats stats; | ||
49 | /* used by HDLC layer to take control over HDLC device from hw driver*/ | 48 | /* used by HDLC layer to take control over HDLC device from hw driver*/ |
50 | int (*attach)(struct net_device *dev, | 49 | int (*attach)(struct net_device *dev, |
51 | unsigned short encoding, unsigned short parity); | 50 | unsigned short encoding, unsigned short parity); |
@@ -109,12 +108,6 @@ int attach_hdlc_protocol(struct net_device *dev, struct hdlc_proto *proto, | |||
109 | /* May be used by hardware driver to gain control over HDLC device */ | 108 | /* May be used by hardware driver to gain control over HDLC device */ |
110 | void detach_hdlc_protocol(struct net_device *dev); | 109 | void detach_hdlc_protocol(struct net_device *dev); |
111 | 110 | ||
112 | static __inline__ struct net_device_stats *hdlc_stats(struct net_device *dev) | ||
113 | { | ||
114 | return &dev_to_hdlc(dev)->stats; | ||
115 | } | ||
116 | |||
117 | |||
118 | static __inline__ __be16 hdlc_type_trans(struct sk_buff *skb, | 111 | static __inline__ __be16 hdlc_type_trans(struct sk_buff *skb, |
119 | struct net_device *dev) | 112 | struct net_device *dev) |
120 | { | 113 | { |
diff --git a/include/linux/hid.h b/include/linux/hid.h index fe56b86f2c67..f13bca2dd53b 100644 --- a/include/linux/hid.h +++ b/include/linux/hid.h | |||
@@ -67,6 +67,7 @@ | |||
67 | #include <linux/types.h> | 67 | #include <linux/types.h> |
68 | #include <linux/slab.h> | 68 | #include <linux/slab.h> |
69 | #include <linux/list.h> | 69 | #include <linux/list.h> |
70 | #include <linux/mod_devicetable.h> /* hid_device_id */ | ||
70 | #include <linux/timer.h> | 71 | #include <linux/timer.h> |
71 | #include <linux/workqueue.h> | 72 | #include <linux/workqueue.h> |
72 | #include <linux/input.h> | 73 | #include <linux/input.h> |
@@ -246,6 +247,19 @@ struct hid_item { | |||
246 | #define HID_FEATURE_REPORT 2 | 247 | #define HID_FEATURE_REPORT 2 |
247 | 248 | ||
248 | /* | 249 | /* |
250 | * HID connect requests | ||
251 | */ | ||
252 | |||
253 | #define HID_CONNECT_HIDINPUT 0x01 | ||
254 | #define HID_CONNECT_HIDINPUT_FORCE 0x02 | ||
255 | #define HID_CONNECT_HIDRAW 0x04 | ||
256 | #define HID_CONNECT_HIDDEV 0x08 | ||
257 | #define HID_CONNECT_HIDDEV_FORCE 0x10 | ||
258 | #define HID_CONNECT_FF 0x20 | ||
259 | #define HID_CONNECT_DEFAULT (HID_CONNECT_HIDINPUT|HID_CONNECT_HIDRAW| \ | ||
260 | HID_CONNECT_HIDDEV|HID_CONNECT_FF) | ||
261 | |||
262 | /* | ||
249 | * HID device quirks. | 263 | * HID device quirks. |
250 | */ | 264 | */ |
251 | 265 | ||
@@ -256,48 +270,11 @@ struct hid_item { | |||
256 | 270 | ||
257 | #define HID_QUIRK_INVERT 0x00000001 | 271 | #define HID_QUIRK_INVERT 0x00000001 |
258 | #define HID_QUIRK_NOTOUCH 0x00000002 | 272 | #define HID_QUIRK_NOTOUCH 0x00000002 |
259 | #define HID_QUIRK_IGNORE 0x00000004 | ||
260 | #define HID_QUIRK_NOGET 0x00000008 | 273 | #define HID_QUIRK_NOGET 0x00000008 |
261 | #define HID_QUIRK_HIDDEV 0x00000010 | ||
262 | #define HID_QUIRK_BADPAD 0x00000020 | 274 | #define HID_QUIRK_BADPAD 0x00000020 |
263 | #define HID_QUIRK_MULTI_INPUT 0x00000040 | 275 | #define HID_QUIRK_MULTI_INPUT 0x00000040 |
264 | #define HID_QUIRK_2WHEEL_MOUSE_HACK_7 0x00000080 | ||
265 | #define HID_QUIRK_2WHEEL_MOUSE_HACK_5 0x00000100 | ||
266 | #define HID_QUIRK_2WHEEL_MOUSE_HACK_ON 0x00000200 | ||
267 | #define HID_QUIRK_MIGHTYMOUSE 0x00000400 | ||
268 | #define HID_QUIRK_APPLE_HAS_FN 0x00000800 | ||
269 | #define HID_QUIRK_APPLE_FN_ON 0x00001000 | ||
270 | #define HID_QUIRK_INVERT_HWHEEL 0x00002000 | ||
271 | #define HID_QUIRK_APPLE_ISO_KEYBOARD 0x00004000 | ||
272 | #define HID_QUIRK_BAD_RELATIVE_KEYS 0x00008000 | ||
273 | #define HID_QUIRK_SKIP_OUTPUT_REPORTS 0x00010000 | 276 | #define HID_QUIRK_SKIP_OUTPUT_REPORTS 0x00010000 |
274 | #define HID_QUIRK_IGNORE_MOUSE 0x00020000 | ||
275 | #define HID_QUIRK_SONY_PS3_CONTROLLER 0x00040000 | ||
276 | #define HID_QUIRK_DUPLICATE_USAGES 0x00080000 | ||
277 | #define HID_QUIRK_RESET_LEDS 0x00100000 | ||
278 | #define HID_QUIRK_HIDINPUT 0x00200000 | ||
279 | #define HID_QUIRK_LOGITECH_IGNORE_DOUBLED_WHEEL 0x00400000 | ||
280 | #define HID_QUIRK_LOGITECH_EXPANDED_KEYMAP 0x00800000 | ||
281 | #define HID_QUIRK_IGNORE_HIDINPUT 0x01000000 | ||
282 | #define HID_QUIRK_2WHEEL_MOUSE_HACK_B8 0x02000000 | ||
283 | #define HID_QUIRK_HWHEEL_WHEEL_INVERT 0x04000000 | ||
284 | #define HID_QUIRK_MICROSOFT_KEYS 0x08000000 | ||
285 | #define HID_QUIRK_FULLSPEED_INTERVAL 0x10000000 | 277 | #define HID_QUIRK_FULLSPEED_INTERVAL 0x10000000 |
286 | #define HID_QUIRK_APPLE_NUMLOCK_EMULATION 0x20000000 | ||
287 | |||
288 | /* | ||
289 | * Separate quirks for runtime report descriptor fixup | ||
290 | */ | ||
291 | |||
292 | #define HID_QUIRK_RDESC_CYMOTION 0x00000001 | ||
293 | #define HID_QUIRK_RDESC_LOGITECH 0x00000002 | ||
294 | #define HID_QUIRK_RDESC_SWAPPED_MIN_MAX 0x00000004 | ||
295 | #define HID_QUIRK_RDESC_PETALYNX 0x00000008 | ||
296 | #define HID_QUIRK_RDESC_MACBOOK_JIS 0x00000010 | ||
297 | #define HID_QUIRK_RDESC_BUTTON_CONSUMER 0x00000020 | ||
298 | #define HID_QUIRK_RDESC_SAMSUNG_REMOTE 0x00000040 | ||
299 | #define HID_QUIRK_RDESC_MICROSOFT_RECV_1028 0x00000080 | ||
300 | #define HID_QUIRK_RDESC_SUNPLUS_WDESKTOP 0x00000100 | ||
301 | 278 | ||
302 | /* | 279 | /* |
303 | * This is the global environment of the parser. This information is | 280 | * This is the global environment of the parser. This information is |
@@ -411,12 +388,21 @@ struct hid_report_enum { | |||
411 | struct hid_control_fifo { | 388 | struct hid_control_fifo { |
412 | unsigned char dir; | 389 | unsigned char dir; |
413 | struct hid_report *report; | 390 | struct hid_report *report; |
391 | char *raw_report; | ||
392 | }; | ||
393 | |||
394 | struct hid_output_fifo { | ||
395 | struct hid_report *report; | ||
396 | char *raw_report; | ||
414 | }; | 397 | }; |
415 | 398 | ||
416 | #define HID_CLAIMED_INPUT 1 | 399 | #define HID_CLAIMED_INPUT 1 |
417 | #define HID_CLAIMED_HIDDEV 2 | 400 | #define HID_CLAIMED_HIDDEV 2 |
418 | #define HID_CLAIMED_HIDRAW 4 | 401 | #define HID_CLAIMED_HIDRAW 4 |
419 | 402 | ||
403 | #define HID_STAT_ADDED 1 | ||
404 | #define HID_STAT_PARSED 2 | ||
405 | |||
420 | #define HID_CTRL_RUNNING 1 | 406 | #define HID_CTRL_RUNNING 1 |
421 | #define HID_OUT_RUNNING 2 | 407 | #define HID_OUT_RUNNING 2 |
422 | #define HID_IN_RUNNING 3 | 408 | #define HID_IN_RUNNING 3 |
@@ -431,22 +417,28 @@ struct hid_input { | |||
431 | struct input_dev *input; | 417 | struct input_dev *input; |
432 | }; | 418 | }; |
433 | 419 | ||
420 | struct hid_driver; | ||
421 | struct hid_ll_driver; | ||
422 | |||
434 | struct hid_device { /* device report descriptor */ | 423 | struct hid_device { /* device report descriptor */ |
435 | __u8 *rdesc; | 424 | __u8 *rdesc; |
436 | unsigned rsize; | 425 | unsigned rsize; |
437 | struct hid_collection *collection; /* List of HID collections */ | 426 | struct hid_collection *collection; /* List of HID collections */ |
438 | unsigned collection_size; /* Number of allocated hid_collections */ | 427 | unsigned collection_size; /* Number of allocated hid_collections */ |
439 | unsigned maxcollection; /* Number of parsed collections */ | 428 | unsigned maxcollection; /* Number of parsed collections */ |
440 | unsigned maxapplication; /* Number of applications */ | 429 | unsigned maxapplication; /* Number of applications */ |
441 | unsigned short bus; /* BUS ID */ | 430 | __u16 bus; /* BUS ID */ |
442 | unsigned short vendor; /* Vendor ID */ | 431 | __u32 vendor; /* Vendor ID */ |
443 | unsigned short product; /* Product ID */ | 432 | __u32 product; /* Product ID */ |
444 | unsigned version; /* HID version */ | 433 | __u32 version; /* HID version */ |
445 | unsigned country; /* HID country */ | 434 | unsigned country; /* HID country */ |
446 | struct hid_report_enum report_enum[HID_REPORT_TYPES]; | 435 | struct hid_report_enum report_enum[HID_REPORT_TYPES]; |
447 | 436 | ||
448 | struct device *dev; /* device */ | 437 | struct device dev; /* device */ |
438 | struct hid_driver *driver; | ||
439 | struct hid_ll_driver *ll_driver; | ||
449 | 440 | ||
441 | unsigned int status; /* see STAT flags above */ | ||
450 | unsigned claimed; /* Claimed by hidinput, hiddev? */ | 442 | unsigned claimed; /* Claimed by hidinput, hiddev? */ |
451 | unsigned quirks; /* Various quirks the device can pull on us */ | 443 | unsigned quirks; /* Various quirks the device can pull on us */ |
452 | 444 | ||
@@ -462,26 +454,29 @@ struct hid_device { /* device report descriptor */ | |||
462 | 454 | ||
463 | void *driver_data; | 455 | void *driver_data; |
464 | 456 | ||
465 | __s32 delayed_value; /* For A4 Tech mice hwheel quirk */ | 457 | /* temporary hid_ff handling (until moved to the drivers) */ |
466 | 458 | int (*ff_init)(struct hid_device *); | |
467 | /* device-specific function pointers */ | ||
468 | int (*hidinput_input_event) (struct input_dev *, unsigned int, unsigned int, int); | ||
469 | int (*hid_open) (struct hid_device *); | ||
470 | void (*hid_close) (struct hid_device *); | ||
471 | 459 | ||
472 | /* hiddev event handler */ | 460 | /* hiddev event handler */ |
461 | int (*hiddev_connect)(struct hid_device *, unsigned int); | ||
473 | void (*hiddev_hid_event) (struct hid_device *, struct hid_field *field, | 462 | void (*hiddev_hid_event) (struct hid_device *, struct hid_field *field, |
474 | struct hid_usage *, __s32); | 463 | struct hid_usage *, __s32); |
475 | void (*hiddev_report_event) (struct hid_device *, struct hid_report *); | 464 | void (*hiddev_report_event) (struct hid_device *, struct hid_report *); |
476 | 465 | ||
477 | /* handler for raw output data, used by hidraw */ | 466 | /* handler for raw output data, used by hidraw */ |
478 | int (*hid_output_raw_report) (struct hid_device *, __u8 *, size_t); | 467 | int (*hid_output_raw_report) (struct hid_device *, __u8 *, size_t); |
479 | #ifdef CONFIG_USB_HIDINPUT_POWERBOOK | ||
480 | unsigned long apple_pressed_fn[BITS_TO_LONGS(KEY_CNT)]; | ||
481 | unsigned long pb_pressed_numlock[BITS_TO_LONGS(KEY_CNT)]; | ||
482 | #endif | ||
483 | }; | 468 | }; |
484 | 469 | ||
470 | static inline void *hid_get_drvdata(struct hid_device *hdev) | ||
471 | { | ||
472 | return dev_get_drvdata(&hdev->dev); | ||
473 | } | ||
474 | |||
475 | static inline void hid_set_drvdata(struct hid_device *hdev, void *data) | ||
476 | { | ||
477 | dev_set_drvdata(&hdev->dev, data); | ||
478 | } | ||
479 | |||
485 | #define HID_GLOBAL_STACK_SIZE 4 | 480 | #define HID_GLOBAL_STACK_SIZE 4 |
486 | #define HID_COLLECTION_STACK_SIZE 4 | 481 | #define HID_COLLECTION_STACK_SIZE 4 |
487 | 482 | ||
@@ -510,9 +505,110 @@ struct hid_descriptor { | |||
510 | struct hid_class_descriptor desc[1]; | 505 | struct hid_class_descriptor desc[1]; |
511 | } __attribute__ ((packed)); | 506 | } __attribute__ ((packed)); |
512 | 507 | ||
508 | #define HID_DEVICE(b, ven, prod) \ | ||
509 | .bus = (b), \ | ||
510 | .vendor = (ven), .product = (prod) | ||
511 | |||
512 | #define HID_USB_DEVICE(ven, prod) HID_DEVICE(BUS_USB, ven, prod) | ||
513 | #define HID_BLUETOOTH_DEVICE(ven, prod) HID_DEVICE(BUS_BLUETOOTH, ven, prod) | ||
514 | |||
515 | #define HID_REPORT_ID(rep) \ | ||
516 | .report_type = (rep) | ||
517 | #define HID_USAGE_ID(uhid, utype, ucode) \ | ||
518 | .usage_hid = (uhid), .usage_type = (utype), .usage_code = (ucode) | ||
519 | /* we don't want to catch types and codes equal to 0 */ | ||
520 | #define HID_TERMINATOR (HID_ANY_ID - 1) | ||
521 | |||
522 | struct hid_report_id { | ||
523 | __u32 report_type; | ||
524 | }; | ||
525 | struct hid_usage_id { | ||
526 | __u32 usage_hid; | ||
527 | __u32 usage_type; | ||
528 | __u32 usage_code; | ||
529 | }; | ||
530 | |||
531 | /** | ||
532 | * struct hid_driver | ||
533 | * @name: driver name (e.g. "Footech_bar-wheel") | ||
534 | * @id_table: which devices is this driver for (must be non-NULL for probe | ||
535 | * to be called) | ||
536 | * @probe: new device inserted | ||
537 | * @remove: device removed (NULL if not a hot-plug capable driver) | ||
538 | * @report_table: on which reports to call raw_event (NULL means all) | ||
539 | * @raw_event: if report in report_table, this hook is called (NULL means nop) | ||
540 | * @usage_table: on which events to call event (NULL means all) | ||
541 | * @event: if usage in usage_table, this hook is called (NULL means nop) | ||
542 | * @report_fixup: called before report descriptor parsing (NULL means nop) | ||
543 | * @input_mapping: invoked on input registering before mapping an usage | ||
544 | * @input_mapped: invoked on input registering after mapping an usage | ||
545 | * | ||
546 | * raw_event and event should return 0 on no action performed, 1 when no | ||
547 | * further processing should be done and negative on error | ||
548 | * | ||
549 | * input_mapping shall return a negative value to completely ignore this usage | ||
550 | * (e.g. doubled or invalid usage), zero to continue with parsing of this | ||
551 | * usage by generic code (no special handling needed) or positive to skip | ||
552 | * generic parsing (needed special handling which was done in the hook already) | ||
553 | * input_mapped shall return negative to inform the layer that this usage | ||
554 | * should not be considered for further processing or zero to notify that | ||
555 | * no processing was performed and should be done in a generic manner | ||
556 | * Both these functions may be NULL which means the same behavior as returning | ||
557 | * zero from them. | ||
558 | */ | ||
559 | struct hid_driver { | ||
560 | char *name; | ||
561 | const struct hid_device_id *id_table; | ||
562 | |||
563 | int (*probe)(struct hid_device *dev, const struct hid_device_id *id); | ||
564 | void (*remove)(struct hid_device *dev); | ||
565 | |||
566 | const struct hid_report_id *report_table; | ||
567 | int (*raw_event)(struct hid_device *hdev, struct hid_report *report, | ||
568 | u8 *data, int size); | ||
569 | const struct hid_usage_id *usage_table; | ||
570 | int (*event)(struct hid_device *hdev, struct hid_field *field, | ||
571 | struct hid_usage *usage, __s32 value); | ||
572 | |||
573 | void (*report_fixup)(struct hid_device *hdev, __u8 *buf, | ||
574 | unsigned int size); | ||
575 | |||
576 | int (*input_mapping)(struct hid_device *hdev, | ||
577 | struct hid_input *hidinput, struct hid_field *field, | ||
578 | struct hid_usage *usage, unsigned long **bit, int *max); | ||
579 | int (*input_mapped)(struct hid_device *hdev, | ||
580 | struct hid_input *hidinput, struct hid_field *field, | ||
581 | struct hid_usage *usage, unsigned long **bit, int *max); | ||
582 | /* private: */ | ||
583 | struct device_driver driver; | ||
584 | }; | ||
585 | |||
586 | /** | ||
587 | * hid_ll_driver - low level driver callbacks | ||
588 | * @start: called on probe to start the device | ||
589 | * @stop: called on remove | ||
590 | * @open: called by input layer on open | ||
591 | * @close: called by input layer on close | ||
592 | * @hidinput_input_event: event input event (e.g. ff or leds) | ||
593 | * @parse: this method is called only once to parse the device data, | ||
594 | * shouldn't allocate anything to not leak memory | ||
595 | */ | ||
596 | struct hid_ll_driver { | ||
597 | int (*start)(struct hid_device *hdev); | ||
598 | void (*stop)(struct hid_device *hdev); | ||
599 | |||
600 | int (*open)(struct hid_device *hdev); | ||
601 | void (*close)(struct hid_device *hdev); | ||
602 | |||
603 | int (*hidinput_input_event) (struct input_dev *idev, unsigned int type, | ||
604 | unsigned int code, int value); | ||
605 | |||
606 | int (*parse)(struct hid_device *hdev); | ||
607 | }; | ||
608 | |||
513 | /* Applications from HID Usage Tables 4/8/99 Version 1.1 */ | 609 | /* Applications from HID Usage Tables 4/8/99 Version 1.1 */ |
514 | /* We ignore a few input applications that are not widely used */ | 610 | /* We ignore a few input applications that are not widely used */ |
515 | #define IS_INPUT_APPLICATION(a) (((a >= 0x00010000) && (a <= 0x00010008)) || (a == 0x00010080) || (a == 0x000c0001)) | 611 | #define IS_INPUT_APPLICATION(a) (((a >= 0x00010000) && (a <= 0x00010008)) || (a == 0x00010080) || (a == 0x000c0001) || (a == 0x000d0002)) |
516 | 612 | ||
517 | /* HID core API */ | 613 | /* HID core API */ |
518 | 614 | ||
@@ -520,43 +616,157 @@ struct hid_descriptor { | |||
520 | extern int hid_debug; | 616 | extern int hid_debug; |
521 | #endif | 617 | #endif |
522 | 618 | ||
619 | extern int hid_add_device(struct hid_device *); | ||
620 | extern void hid_destroy_device(struct hid_device *); | ||
621 | |||
622 | extern int __must_check __hid_register_driver(struct hid_driver *, | ||
623 | struct module *, const char *mod_name); | ||
624 | static inline int __must_check hid_register_driver(struct hid_driver *driver) | ||
625 | { | ||
626 | return __hid_register_driver(driver, THIS_MODULE, KBUILD_MODNAME); | ||
627 | } | ||
628 | extern void hid_unregister_driver(struct hid_driver *); | ||
629 | |||
523 | extern void hidinput_hid_event(struct hid_device *, struct hid_field *, struct hid_usage *, __s32); | 630 | extern void hidinput_hid_event(struct hid_device *, struct hid_field *, struct hid_usage *, __s32); |
524 | extern void hidinput_report_event(struct hid_device *hid, struct hid_report *report); | 631 | extern void hidinput_report_event(struct hid_device *hid, struct hid_report *report); |
525 | extern int hidinput_connect(struct hid_device *); | 632 | extern int hidinput_connect(struct hid_device *hid, unsigned int force); |
526 | extern void hidinput_disconnect(struct hid_device *); | 633 | extern void hidinput_disconnect(struct hid_device *); |
527 | 634 | ||
528 | int hid_set_field(struct hid_field *, unsigned, __s32); | 635 | int hid_set_field(struct hid_field *, unsigned, __s32); |
529 | int hid_input_report(struct hid_device *, int type, u8 *, int, int); | 636 | int hid_input_report(struct hid_device *, int type, u8 *, int, int); |
530 | int hidinput_find_field(struct hid_device *hid, unsigned int type, unsigned int code, struct hid_field **field); | 637 | int hidinput_find_field(struct hid_device *hid, unsigned int type, unsigned int code, struct hid_field **field); |
531 | int hidinput_mapping_quirks(struct hid_usage *, struct input_dev *, unsigned long **, int *); | ||
532 | int hidinput_event_quirks(struct hid_device *, struct hid_field *, struct hid_usage *, __s32); | ||
533 | int hidinput_apple_event(struct hid_device *, struct input_dev *, struct hid_usage *, __s32); | ||
534 | void hid_output_report(struct hid_report *report, __u8 *data); | 638 | void hid_output_report(struct hid_report *report, __u8 *data); |
535 | void hid_free_device(struct hid_device *device); | 639 | struct hid_device *hid_allocate_device(void); |
536 | struct hid_device *hid_parse_report(__u8 *start, unsigned size); | 640 | int hid_parse_report(struct hid_device *hid, __u8 *start, unsigned size); |
641 | int hid_connect(struct hid_device *hid, unsigned int connect_mask); | ||
642 | |||
643 | /** | ||
644 | * hid_map_usage - map usage input bits | ||
645 | * | ||
646 | * @hidinput: hidinput which we are interested in | ||
647 | * @usage: usage to fill in | ||
648 | * @bit: pointer to input->{}bit (out parameter) | ||
649 | * @max: maximal valid usage->code to consider later (out parameter) | ||
650 | * @type: input event type (EV_KEY, EV_REL, ...) | ||
651 | * @c: code which corresponds to this usage and type | ||
652 | */ | ||
653 | static inline void hid_map_usage(struct hid_input *hidinput, | ||
654 | struct hid_usage *usage, unsigned long **bit, int *max, | ||
655 | __u8 type, __u16 c) | ||
656 | { | ||
657 | struct input_dev *input = hidinput->input; | ||
658 | |||
659 | usage->type = type; | ||
660 | usage->code = c; | ||
661 | |||
662 | switch (type) { | ||
663 | case EV_ABS: | ||
664 | *bit = input->absbit; | ||
665 | *max = ABS_MAX; | ||
666 | break; | ||
667 | case EV_REL: | ||
668 | *bit = input->relbit; | ||
669 | *max = REL_MAX; | ||
670 | break; | ||
671 | case EV_KEY: | ||
672 | *bit = input->keybit; | ||
673 | *max = KEY_MAX; | ||
674 | break; | ||
675 | case EV_LED: | ||
676 | *bit = input->ledbit; | ||
677 | *max = LED_MAX; | ||
678 | break; | ||
679 | } | ||
680 | } | ||
681 | |||
682 | /** | ||
683 | * hid_map_usage_clear - map usage input bits and clear the input bit | ||
684 | * | ||
685 | * The same as hid_map_usage, except the @c bit is also cleared in supported | ||
686 | * bits (@bit). | ||
687 | */ | ||
688 | static inline void hid_map_usage_clear(struct hid_input *hidinput, | ||
689 | struct hid_usage *usage, unsigned long **bit, int *max, | ||
690 | __u8 type, __u16 c) | ||
691 | { | ||
692 | hid_map_usage(hidinput, usage, bit, max, type, c); | ||
693 | clear_bit(c, *bit); | ||
694 | } | ||
695 | |||
696 | /** | ||
697 | * hid_parse - parse HW reports | ||
698 | * | ||
699 | * @hdev: hid device | ||
700 | * | ||
701 | * Call this from probe after you set up the device (if needed). Your | ||
702 | * report_fixup will be called (if non-NULL) after reading raw report from | ||
703 | * device before passing it to hid layer for real parsing. | ||
704 | */ | ||
705 | static inline int __must_check hid_parse(struct hid_device *hdev) | ||
706 | { | ||
707 | int ret; | ||
708 | |||
709 | if (hdev->status & HID_STAT_PARSED) | ||
710 | return 0; | ||
711 | |||
712 | ret = hdev->ll_driver->parse(hdev); | ||
713 | if (!ret) | ||
714 | hdev->status |= HID_STAT_PARSED; | ||
715 | |||
716 | return ret; | ||
717 | } | ||
718 | |||
719 | /** | ||
720 | * hid_hw_start - start underlaying HW | ||
721 | * | ||
722 | * @hdev: hid device | ||
723 | * @connect_mask: which outputs to connect, see HID_CONNECT_* | ||
724 | * | ||
725 | * Call this in probe function *after* hid_parse. This will setup HW buffers | ||
726 | * and start the device (if not deffered to device open). hid_hw_stop must be | ||
727 | * called if this was successfull. | ||
728 | */ | ||
729 | static inline int __must_check hid_hw_start(struct hid_device *hdev, | ||
730 | unsigned int connect_mask) | ||
731 | { | ||
732 | int ret = hdev->ll_driver->start(hdev); | ||
733 | if (ret || !connect_mask) | ||
734 | return ret; | ||
735 | ret = hid_connect(hdev, connect_mask); | ||
736 | if (ret) | ||
737 | hdev->ll_driver->stop(hdev); | ||
738 | return ret; | ||
739 | } | ||
740 | |||
741 | /** | ||
742 | * hid_hw_stop - stop underlaying HW | ||
743 | * | ||
744 | * @hdev: hid device | ||
745 | * | ||
746 | * This is usually called from remove function or from probe when something | ||
747 | * failed and hid_hw_start was called already. | ||
748 | */ | ||
749 | static inline void hid_hw_stop(struct hid_device *hdev) | ||
750 | { | ||
751 | hdev->ll_driver->stop(hdev); | ||
752 | } | ||
753 | |||
754 | void hid_report_raw_event(struct hid_device *hid, int type, u8 *data, int size, | ||
755 | int interrupt); | ||
756 | |||
757 | extern int hid_generic_init(void); | ||
758 | extern void hid_generic_exit(void); | ||
537 | 759 | ||
538 | /* HID quirks API */ | 760 | /* HID quirks API */ |
539 | u32 usbhid_lookup_quirk(const u16 idVendor, const u16 idProduct); | 761 | u32 usbhid_lookup_quirk(const u16 idVendor, const u16 idProduct); |
540 | int usbhid_quirks_init(char **quirks_param); | 762 | int usbhid_quirks_init(char **quirks_param); |
541 | void usbhid_quirks_exit(void); | 763 | void usbhid_quirks_exit(void); |
542 | void usbhid_fixup_report_descriptor(const u16, const u16, char *, unsigned, char **); | 764 | void usbhid_set_leds(struct hid_device *hid); |
543 | |||
544 | #ifdef CONFIG_HID_FF | ||
545 | int hid_ff_init(struct hid_device *hid); | ||
546 | 765 | ||
547 | int hid_lgff_init(struct hid_device *hid); | ||
548 | int hid_lg2ff_init(struct hid_device *hid); | ||
549 | int hid_plff_init(struct hid_device *hid); | ||
550 | int hid_tmff_init(struct hid_device *hid); | ||
551 | int hid_zpff_init(struct hid_device *hid); | ||
552 | #ifdef CONFIG_HID_PID | 766 | #ifdef CONFIG_HID_PID |
553 | int hid_pidff_init(struct hid_device *hid); | 767 | int hid_pidff_init(struct hid_device *hid); |
554 | #else | 768 | #else |
555 | static inline int hid_pidff_init(struct hid_device *hid) { return -ENODEV; } | 769 | #define hid_pidff_init NULL |
556 | #endif | ||
557 | |||
558 | #else | ||
559 | static inline int hid_ff_init(struct hid_device *hid) { return -1; } | ||
560 | #endif | 770 | #endif |
561 | 771 | ||
562 | #ifdef CONFIG_HID_DEBUG | 772 | #ifdef CONFIG_HID_DEBUG |
@@ -572,10 +782,23 @@ dbg_hid(const char *fmt, ...) | |||
572 | return 0; | 782 | return 0; |
573 | } | 783 | } |
574 | #define dbg_hid_line dbg_hid | 784 | #define dbg_hid_line dbg_hid |
575 | #endif | 785 | #endif /* HID_DEBUG */ |
576 | 786 | ||
577 | #define err_hid(format, arg...) printk(KERN_ERR "%s: " format "\n" , \ | 787 | #define err_hid(format, arg...) printk(KERN_ERR "%s: " format "\n" , \ |
578 | __FILE__ , ## arg) | 788 | __FILE__ , ## arg) |
579 | #endif | 789 | #endif /* HID_FF */ |
790 | |||
791 | #ifdef CONFIG_HID_COMPAT | ||
792 | #define HID_COMPAT_LOAD_DRIVER(name) \ | ||
793 | void hid_compat_##name(void) { } \ | ||
794 | EXPORT_SYMBOL(hid_compat_##name) | ||
795 | #else | ||
796 | #define HID_COMPAT_LOAD_DRIVER(name) | ||
797 | #endif /* HID_COMPAT */ | ||
798 | #define HID_COMPAT_CALL_DRIVER(name) do { \ | ||
799 | extern void hid_compat_##name(void); \ | ||
800 | hid_compat_##name(); \ | ||
801 | } while (0) | ||
802 | |||
580 | #endif | 803 | #endif |
581 | 804 | ||
diff --git a/include/linux/hiddev.h b/include/linux/hiddev.h index a416b904ba90..c760ae0eb6a1 100644 --- a/include/linux/hiddev.h +++ b/include/linux/hiddev.h | |||
@@ -182,26 +182,28 @@ struct hiddev_usage_ref_multi { | |||
182 | /* To traverse the input report descriptor info for a HID device, perform the | 182 | /* To traverse the input report descriptor info for a HID device, perform the |
183 | * following: | 183 | * following: |
184 | * | 184 | * |
185 | * rinfo.report_type = HID_REPORT_TYPE_INPUT; | 185 | * rinfo.report_type = HID_REPORT_TYPE_INPUT; |
186 | * rinfo.report_id = HID_REPORT_ID_FIRST; | 186 | * rinfo.report_id = HID_REPORT_ID_FIRST; |
187 | * ret = ioctl(fd, HIDIOCGREPORTINFO, &rinfo); | 187 | * ret = ioctl(fd, HIDIOCGREPORTINFO, &rinfo); |
188 | * | 188 | * |
189 | * while (ret >= 0) { | 189 | * while (ret >= 0) { |
190 | * for (i = 0; i < rinfo.num_fields; i++) { | 190 | * for (i = 0; i < rinfo.num_fields; i++) { |
191 | * finfo.report_type = rinfo.report_type; | 191 | * finfo.report_type = rinfo.report_type; |
192 | * finfo.report_id = rinfo.report_id; | 192 | * finfo.report_id = rinfo.report_id; |
193 | * finfo.field_index = i; | 193 | * finfo.field_index = i; |
194 | * ioctl(fd, HIDIOCGFIELDINFO, &finfo); | 194 | * ioctl(fd, HIDIOCGFIELDINFO, &finfo); |
195 | * for (j = 0; j < finfo.maxusage; j++) { | 195 | * for (j = 0; j < finfo.maxusage; j++) { |
196 | * uref.field_index = i; | 196 | * uref.report_type = rinfo.report_type; |
197 | * uref.usage_index = j; | 197 | * uref.report_id = rinfo.report_id; |
198 | * ioctl(fd, HIDIOCGUCODE, &uref); | 198 | * uref.field_index = i; |
199 | * ioctl(fd, HIDIOCGUSAGE, &uref); | 199 | * uref.usage_index = j; |
200 | * } | 200 | * ioctl(fd, HIDIOCGUCODE, &uref); |
201 | * } | 201 | * ioctl(fd, HIDIOCGUSAGE, &uref); |
202 | * rinfo.report_id |= HID_REPORT_ID_NEXT; | 202 | * } |
203 | * ret = ioctl(fd, HIDIOCGREPORTINFO, &rinfo); | 203 | * } |
204 | * } | 204 | * rinfo.report_id |= HID_REPORT_ID_NEXT; |
205 | * ret = ioctl(fd, HIDIOCGREPORTINFO, &rinfo); | ||
206 | * } | ||
205 | */ | 207 | */ |
206 | 208 | ||
207 | 209 | ||
@@ -217,7 +219,7 @@ struct hid_field; | |||
217 | struct hid_report; | 219 | struct hid_report; |
218 | 220 | ||
219 | #ifdef CONFIG_USB_HIDDEV | 221 | #ifdef CONFIG_USB_HIDDEV |
220 | int hiddev_connect(struct hid_device *); | 222 | int hiddev_connect(struct hid_device *hid, unsigned int force); |
221 | void hiddev_disconnect(struct hid_device *); | 223 | void hiddev_disconnect(struct hid_device *); |
222 | void hiddev_hid_event(struct hid_device *hid, struct hid_field *field, | 224 | void hiddev_hid_event(struct hid_device *hid, struct hid_field *field, |
223 | struct hid_usage *usage, __s32 value); | 225 | struct hid_usage *usage, __s32 value); |
@@ -225,7 +227,9 @@ void hiddev_report_event(struct hid_device *hid, struct hid_report *report); | |||
225 | int __init hiddev_init(void); | 227 | int __init hiddev_init(void); |
226 | void hiddev_exit(void); | 228 | void hiddev_exit(void); |
227 | #else | 229 | #else |
228 | static inline int hiddev_connect(struct hid_device *hid) { return -1; } | 230 | static inline int hiddev_connect(struct hid_device *hid, |
231 | unsigned int force) | ||
232 | { return -1; } | ||
229 | static inline void hiddev_disconnect(struct hid_device *hid) { } | 233 | static inline void hiddev_disconnect(struct hid_device *hid) { } |
230 | static inline void hiddev_hid_event(struct hid_device *hid, struct hid_field *field, | 234 | static inline void hiddev_hid_event(struct hid_device *hid, struct hid_field *field, |
231 | struct hid_usage *usage, __s32 value) { } | 235 | struct hid_usage *usage, __s32 value) { } |
diff --git a/include/linux/hpet.h b/include/linux/hpet.h index 2dc29ce6c8e4..79f63a27bcef 100644 --- a/include/linux/hpet.h +++ b/include/linux/hpet.h | |||
@@ -37,6 +37,7 @@ struct hpet { | |||
37 | #define hpet_compare _u1._hpet_compare | 37 | #define hpet_compare _u1._hpet_compare |
38 | 38 | ||
39 | #define HPET_MAX_TIMERS (32) | 39 | #define HPET_MAX_TIMERS (32) |
40 | #define HPET_MAX_IRQ (32) | ||
40 | 41 | ||
41 | /* | 42 | /* |
42 | * HPET general capabilities register | 43 | * HPET general capabilities register |
@@ -64,7 +65,7 @@ struct hpet { | |||
64 | */ | 65 | */ |
65 | 66 | ||
66 | #define Tn_INT_ROUTE_CAP_MASK (0xffffffff00000000ULL) | 67 | #define Tn_INT_ROUTE_CAP_MASK (0xffffffff00000000ULL) |
67 | #define Tn_INI_ROUTE_CAP_SHIFT (32UL) | 68 | #define Tn_INT_ROUTE_CAP_SHIFT (32UL) |
68 | #define Tn_FSB_INT_DELCAP_MASK (0x8000UL) | 69 | #define Tn_FSB_INT_DELCAP_MASK (0x8000UL) |
69 | #define Tn_FSB_INT_DELCAP_SHIFT (15) | 70 | #define Tn_FSB_INT_DELCAP_SHIFT (15) |
70 | #define Tn_FSB_EN_CNF_MASK (0x4000UL) | 71 | #define Tn_FSB_EN_CNF_MASK (0x4000UL) |
@@ -91,23 +92,14 @@ struct hpet { | |||
91 | * exported interfaces | 92 | * exported interfaces |
92 | */ | 93 | */ |
93 | 94 | ||
94 | struct hpet_task { | ||
95 | void (*ht_func) (void *); | ||
96 | void *ht_data; | ||
97 | void *ht_opaque; | ||
98 | }; | ||
99 | |||
100 | struct hpet_data { | 95 | struct hpet_data { |
101 | unsigned long hd_phys_address; | 96 | unsigned long hd_phys_address; |
102 | void __iomem *hd_address; | 97 | void __iomem *hd_address; |
103 | unsigned short hd_nirqs; | 98 | unsigned short hd_nirqs; |
104 | unsigned short hd_flags; | ||
105 | unsigned int hd_state; /* timer allocated */ | 99 | unsigned int hd_state; /* timer allocated */ |
106 | unsigned int hd_irq[HPET_MAX_TIMERS]; | 100 | unsigned int hd_irq[HPET_MAX_TIMERS]; |
107 | }; | 101 | }; |
108 | 102 | ||
109 | #define HPET_DATA_PLATFORM 0x0001 /* platform call to hpet_alloc */ | ||
110 | |||
111 | static inline void hpet_reserve_timer(struct hpet_data *hd, int timer) | 103 | static inline void hpet_reserve_timer(struct hpet_data *hd, int timer) |
112 | { | 104 | { |
113 | hd->hd_state |= (1 << timer); | 105 | hd->hd_state |= (1 << timer); |
@@ -125,7 +117,7 @@ struct hpet_info { | |||
125 | unsigned short hi_timer; | 117 | unsigned short hi_timer; |
126 | }; | 118 | }; |
127 | 119 | ||
128 | #define HPET_INFO_PERIODIC 0x0001 /* timer is periodic */ | 120 | #define HPET_INFO_PERIODIC 0x0010 /* periodic-capable comparator */ |
129 | 121 | ||
130 | #define HPET_IE_ON _IO('h', 0x01) /* interrupt on */ | 122 | #define HPET_IE_ON _IO('h', 0x01) /* interrupt on */ |
131 | #define HPET_IE_OFF _IO('h', 0x02) /* interrupt off */ | 123 | #define HPET_IE_OFF _IO('h', 0x02) /* interrupt off */ |
diff --git a/include/linux/hrtimer.h b/include/linux/hrtimer.h index 6d93dce61cbb..2f245fe63bda 100644 --- a/include/linux/hrtimer.h +++ b/include/linux/hrtimer.h | |||
@@ -47,14 +47,22 @@ enum hrtimer_restart { | |||
47 | * HRTIMER_CB_IRQSAFE: Callback may run in hardirq context | 47 | * HRTIMER_CB_IRQSAFE: Callback may run in hardirq context |
48 | * HRTIMER_CB_IRQSAFE_NO_RESTART: Callback may run in hardirq context and | 48 | * HRTIMER_CB_IRQSAFE_NO_RESTART: Callback may run in hardirq context and |
49 | * does not restart the timer | 49 | * does not restart the timer |
50 | * HRTIMER_CB_IRQSAFE_NO_SOFTIRQ: Callback must run in hardirq context | 50 | * HRTIMER_CB_IRQSAFE_PERCPU: Callback must run in hardirq context |
51 | * Special mode for tick emultation | 51 | * Special mode for tick emulation and |
52 | * scheduler timer. Such timers are per | ||
53 | * cpu and not allowed to be migrated on | ||
54 | * cpu unplug. | ||
55 | * HRTIMER_CB_IRQSAFE_UNLOCKED: Callback should run in hardirq context | ||
56 | * with timer->base lock unlocked | ||
57 | * used for timers which call wakeup to | ||
58 | * avoid lock order problems with rq->lock | ||
52 | */ | 59 | */ |
53 | enum hrtimer_cb_mode { | 60 | enum hrtimer_cb_mode { |
54 | HRTIMER_CB_SOFTIRQ, | 61 | HRTIMER_CB_SOFTIRQ, |
55 | HRTIMER_CB_IRQSAFE, | 62 | HRTIMER_CB_IRQSAFE, |
56 | HRTIMER_CB_IRQSAFE_NO_RESTART, | 63 | HRTIMER_CB_IRQSAFE_NO_RESTART, |
57 | HRTIMER_CB_IRQSAFE_NO_SOFTIRQ, | 64 | HRTIMER_CB_IRQSAFE_PERCPU, |
65 | HRTIMER_CB_IRQSAFE_UNLOCKED, | ||
58 | }; | 66 | }; |
59 | 67 | ||
60 | /* | 68 | /* |
@@ -67,9 +75,10 @@ enum hrtimer_cb_mode { | |||
67 | * 0x02 callback function running | 75 | * 0x02 callback function running |
68 | * 0x04 callback pending (high resolution mode) | 76 | * 0x04 callback pending (high resolution mode) |
69 | * | 77 | * |
70 | * Special case: | 78 | * Special cases: |
71 | * 0x03 callback function running and enqueued | 79 | * 0x03 callback function running and enqueued |
72 | * (was requeued on another CPU) | 80 | * (was requeued on another CPU) |
81 | * 0x09 timer was migrated on CPU hotunplug | ||
73 | * The "callback function running and enqueued" status is only possible on | 82 | * The "callback function running and enqueued" status is only possible on |
74 | * SMP. It happens for example when a posix timer expired and the callback | 83 | * SMP. It happens for example when a posix timer expired and the callback |
75 | * queued a signal. Between dropping the lock which protects the posix timer | 84 | * queued a signal. Between dropping the lock which protects the posix timer |
@@ -87,6 +96,7 @@ enum hrtimer_cb_mode { | |||
87 | #define HRTIMER_STATE_ENQUEUED 0x01 | 96 | #define HRTIMER_STATE_ENQUEUED 0x01 |
88 | #define HRTIMER_STATE_CALLBACK 0x02 | 97 | #define HRTIMER_STATE_CALLBACK 0x02 |
89 | #define HRTIMER_STATE_PENDING 0x04 | 98 | #define HRTIMER_STATE_PENDING 0x04 |
99 | #define HRTIMER_STATE_MIGRATE 0x08 | ||
90 | 100 | ||
91 | /** | 101 | /** |
92 | * struct hrtimer - the basic hrtimer structure | 102 | * struct hrtimer - the basic hrtimer structure |
diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h index a79e80b689d8..32e0ef0f6e1f 100644 --- a/include/linux/hugetlb.h +++ b/include/linux/hugetlb.h | |||
@@ -8,7 +8,6 @@ | |||
8 | #include <linux/mempolicy.h> | 8 | #include <linux/mempolicy.h> |
9 | #include <linux/shm.h> | 9 | #include <linux/shm.h> |
10 | #include <asm/tlbflush.h> | 10 | #include <asm/tlbflush.h> |
11 | #include <asm/hugetlb.h> | ||
12 | 11 | ||
13 | struct ctl_table; | 12 | struct ctl_table; |
14 | 13 | ||
@@ -17,38 +16,45 @@ static inline int is_vm_hugetlb_page(struct vm_area_struct *vma) | |||
17 | return vma->vm_flags & VM_HUGETLB; | 16 | return vma->vm_flags & VM_HUGETLB; |
18 | } | 17 | } |
19 | 18 | ||
19 | void reset_vma_resv_huge_pages(struct vm_area_struct *vma); | ||
20 | int hugetlb_sysctl_handler(struct ctl_table *, int, struct file *, void __user *, size_t *, loff_t *); | 20 | int hugetlb_sysctl_handler(struct ctl_table *, int, struct file *, void __user *, size_t *, loff_t *); |
21 | int hugetlb_overcommit_handler(struct ctl_table *, int, struct file *, void __user *, size_t *, loff_t *); | 21 | int hugetlb_overcommit_handler(struct ctl_table *, int, struct file *, void __user *, size_t *, loff_t *); |
22 | int hugetlb_treat_movable_handler(struct ctl_table *, int, struct file *, void __user *, size_t *, loff_t *); | 22 | int hugetlb_treat_movable_handler(struct ctl_table *, int, struct file *, void __user *, size_t *, loff_t *); |
23 | int copy_hugetlb_page_range(struct mm_struct *, struct mm_struct *, struct vm_area_struct *); | 23 | int copy_hugetlb_page_range(struct mm_struct *, struct mm_struct *, struct vm_area_struct *); |
24 | int follow_hugetlb_page(struct mm_struct *, struct vm_area_struct *, struct page **, struct vm_area_struct **, unsigned long *, int *, int, int); | 24 | int follow_hugetlb_page(struct mm_struct *, struct vm_area_struct *, struct page **, struct vm_area_struct **, unsigned long *, int *, int, int); |
25 | void unmap_hugepage_range(struct vm_area_struct *, unsigned long, unsigned long); | 25 | void unmap_hugepage_range(struct vm_area_struct *, |
26 | void __unmap_hugepage_range(struct vm_area_struct *, unsigned long, unsigned long); | 26 | unsigned long, unsigned long, struct page *); |
27 | void __unmap_hugepage_range(struct vm_area_struct *, | ||
28 | unsigned long, unsigned long, struct page *); | ||
27 | int hugetlb_prefault(struct address_space *, struct vm_area_struct *); | 29 | int hugetlb_prefault(struct address_space *, struct vm_area_struct *); |
28 | int hugetlb_report_meminfo(char *); | 30 | int hugetlb_report_meminfo(char *); |
29 | int hugetlb_report_node_meminfo(int, char *); | 31 | int hugetlb_report_node_meminfo(int, char *); |
30 | unsigned long hugetlb_total_pages(void); | 32 | unsigned long hugetlb_total_pages(void); |
31 | int hugetlb_fault(struct mm_struct *mm, struct vm_area_struct *vma, | 33 | int hugetlb_fault(struct mm_struct *mm, struct vm_area_struct *vma, |
32 | unsigned long address, int write_access); | 34 | unsigned long address, int write_access); |
33 | int hugetlb_reserve_pages(struct inode *inode, long from, long to); | 35 | int hugetlb_reserve_pages(struct inode *inode, long from, long to, |
36 | struct vm_area_struct *vma); | ||
34 | void hugetlb_unreserve_pages(struct inode *inode, long offset, long freed); | 37 | void hugetlb_unreserve_pages(struct inode *inode, long offset, long freed); |
35 | 38 | ||
36 | extern unsigned long max_huge_pages; | ||
37 | extern unsigned long sysctl_overcommit_huge_pages; | ||
38 | extern unsigned long hugepages_treat_as_movable; | 39 | extern unsigned long hugepages_treat_as_movable; |
39 | extern const unsigned long hugetlb_zero, hugetlb_infinity; | 40 | extern const unsigned long hugetlb_zero, hugetlb_infinity; |
40 | extern int sysctl_hugetlb_shm_group; | 41 | extern int sysctl_hugetlb_shm_group; |
42 | extern struct list_head huge_boot_pages; | ||
41 | 43 | ||
42 | /* arch callbacks */ | 44 | /* arch callbacks */ |
43 | 45 | ||
44 | pte_t *huge_pte_alloc(struct mm_struct *mm, unsigned long addr); | 46 | pte_t *huge_pte_alloc(struct mm_struct *mm, |
47 | unsigned long addr, unsigned long sz); | ||
45 | pte_t *huge_pte_offset(struct mm_struct *mm, unsigned long addr); | 48 | pte_t *huge_pte_offset(struct mm_struct *mm, unsigned long addr); |
46 | int huge_pmd_unshare(struct mm_struct *mm, unsigned long *addr, pte_t *ptep); | 49 | int huge_pmd_unshare(struct mm_struct *mm, unsigned long *addr, pte_t *ptep); |
47 | struct page *follow_huge_addr(struct mm_struct *mm, unsigned long address, | 50 | struct page *follow_huge_addr(struct mm_struct *mm, unsigned long address, |
48 | int write); | 51 | int write); |
49 | struct page *follow_huge_pmd(struct mm_struct *mm, unsigned long address, | 52 | struct page *follow_huge_pmd(struct mm_struct *mm, unsigned long address, |
50 | pmd_t *pmd, int write); | 53 | pmd_t *pmd, int write); |
54 | struct page *follow_huge_pud(struct mm_struct *mm, unsigned long address, | ||
55 | pud_t *pud, int write); | ||
51 | int pmd_huge(pmd_t pmd); | 56 | int pmd_huge(pmd_t pmd); |
57 | int pud_huge(pud_t pmd); | ||
52 | void hugetlb_change_protection(struct vm_area_struct *vma, | 58 | void hugetlb_change_protection(struct vm_area_struct *vma, |
53 | unsigned long address, unsigned long end, pgprot_t newprot); | 59 | unsigned long address, unsigned long end, pgprot_t newprot); |
54 | 60 | ||
@@ -58,6 +64,11 @@ static inline int is_vm_hugetlb_page(struct vm_area_struct *vma) | |||
58 | { | 64 | { |
59 | return 0; | 65 | return 0; |
60 | } | 66 | } |
67 | |||
68 | static inline void reset_vma_resv_huge_pages(struct vm_area_struct *vma) | ||
69 | { | ||
70 | } | ||
71 | |||
61 | static inline unsigned long hugetlb_total_pages(void) | 72 | static inline unsigned long hugetlb_total_pages(void) |
62 | { | 73 | { |
63 | return 0; | 74 | return 0; |
@@ -67,12 +78,14 @@ static inline unsigned long hugetlb_total_pages(void) | |||
67 | #define follow_huge_addr(mm, addr, write) ERR_PTR(-EINVAL) | 78 | #define follow_huge_addr(mm, addr, write) ERR_PTR(-EINVAL) |
68 | #define copy_hugetlb_page_range(src, dst, vma) ({ BUG(); 0; }) | 79 | #define copy_hugetlb_page_range(src, dst, vma) ({ BUG(); 0; }) |
69 | #define hugetlb_prefault(mapping, vma) ({ BUG(); 0; }) | 80 | #define hugetlb_prefault(mapping, vma) ({ BUG(); 0; }) |
70 | #define unmap_hugepage_range(vma, start, end) BUG() | 81 | #define unmap_hugepage_range(vma, start, end, page) BUG() |
71 | #define hugetlb_report_meminfo(buf) 0 | 82 | #define hugetlb_report_meminfo(buf) 0 |
72 | #define hugetlb_report_node_meminfo(n, buf) 0 | 83 | #define hugetlb_report_node_meminfo(n, buf) 0 |
73 | #define follow_huge_pmd(mm, addr, pmd, write) NULL | 84 | #define follow_huge_pmd(mm, addr, pmd, write) NULL |
74 | #define prepare_hugepage_range(addr,len) (-EINVAL) | 85 | #define follow_huge_pud(mm, addr, pud, write) NULL |
86 | #define prepare_hugepage_range(file, addr, len) (-EINVAL) | ||
75 | #define pmd_huge(x) 0 | 87 | #define pmd_huge(x) 0 |
88 | #define pud_huge(x) 0 | ||
76 | #define is_hugepage_only_range(mm, addr, len) 0 | 89 | #define is_hugepage_only_range(mm, addr, len) 0 |
77 | #define hugetlb_free_pgd_range(tlb, addr, end, floor, ceiling) ({BUG(); 0; }) | 90 | #define hugetlb_free_pgd_range(tlb, addr, end, floor, ceiling) ({BUG(); 0; }) |
78 | #define hugetlb_fault(mm, vma, addr, write) ({ BUG(); 0; }) | 91 | #define hugetlb_fault(mm, vma, addr, write) ({ BUG(); 0; }) |
@@ -93,6 +106,7 @@ struct hugetlbfs_config { | |||
93 | umode_t mode; | 106 | umode_t mode; |
94 | long nr_blocks; | 107 | long nr_blocks; |
95 | long nr_inodes; | 108 | long nr_inodes; |
109 | struct hstate *hstate; | ||
96 | }; | 110 | }; |
97 | 111 | ||
98 | struct hugetlbfs_sb_info { | 112 | struct hugetlbfs_sb_info { |
@@ -101,6 +115,7 @@ struct hugetlbfs_sb_info { | |||
101 | long max_inodes; /* inodes allowed */ | 115 | long max_inodes; /* inodes allowed */ |
102 | long free_inodes; /* inodes free */ | 116 | long free_inodes; /* inodes free */ |
103 | spinlock_t stat_lock; | 117 | spinlock_t stat_lock; |
118 | struct hstate *hstate; | ||
104 | }; | 119 | }; |
105 | 120 | ||
106 | 121 | ||
@@ -125,8 +140,6 @@ struct file *hugetlb_file_setup(const char *name, size_t); | |||
125 | int hugetlb_get_quota(struct address_space *mapping, long delta); | 140 | int hugetlb_get_quota(struct address_space *mapping, long delta); |
126 | void hugetlb_put_quota(struct address_space *mapping, long delta); | 141 | void hugetlb_put_quota(struct address_space *mapping, long delta); |
127 | 142 | ||
128 | #define BLOCKS_PER_HUGEPAGE (HPAGE_SIZE / 512) | ||
129 | |||
130 | static inline int is_file_hugepages(struct file *file) | 143 | static inline int is_file_hugepages(struct file *file) |
131 | { | 144 | { |
132 | if (file->f_op == &hugetlbfs_file_operations) | 145 | if (file->f_op == &hugetlbfs_file_operations) |
@@ -155,4 +168,115 @@ unsigned long hugetlb_get_unmapped_area(struct file *file, unsigned long addr, | |||
155 | unsigned long flags); | 168 | unsigned long flags); |
156 | #endif /* HAVE_ARCH_HUGETLB_UNMAPPED_AREA */ | 169 | #endif /* HAVE_ARCH_HUGETLB_UNMAPPED_AREA */ |
157 | 170 | ||
171 | #ifdef CONFIG_HUGETLB_PAGE | ||
172 | |||
173 | #define HSTATE_NAME_LEN 32 | ||
174 | /* Defines one hugetlb page size */ | ||
175 | struct hstate { | ||
176 | int hugetlb_next_nid; | ||
177 | unsigned int order; | ||
178 | unsigned long mask; | ||
179 | unsigned long max_huge_pages; | ||
180 | unsigned long nr_huge_pages; | ||
181 | unsigned long free_huge_pages; | ||
182 | unsigned long resv_huge_pages; | ||
183 | unsigned long surplus_huge_pages; | ||
184 | unsigned long nr_overcommit_huge_pages; | ||
185 | struct list_head hugepage_freelists[MAX_NUMNODES]; | ||
186 | unsigned int nr_huge_pages_node[MAX_NUMNODES]; | ||
187 | unsigned int free_huge_pages_node[MAX_NUMNODES]; | ||
188 | unsigned int surplus_huge_pages_node[MAX_NUMNODES]; | ||
189 | char name[HSTATE_NAME_LEN]; | ||
190 | }; | ||
191 | |||
192 | struct huge_bootmem_page { | ||
193 | struct list_head list; | ||
194 | struct hstate *hstate; | ||
195 | }; | ||
196 | |||
197 | /* arch callback */ | ||
198 | int __init alloc_bootmem_huge_page(struct hstate *h); | ||
199 | |||
200 | void __init hugetlb_add_hstate(unsigned order); | ||
201 | struct hstate *size_to_hstate(unsigned long size); | ||
202 | |||
203 | #ifndef HUGE_MAX_HSTATE | ||
204 | #define HUGE_MAX_HSTATE 1 | ||
205 | #endif | ||
206 | |||
207 | extern struct hstate hstates[HUGE_MAX_HSTATE]; | ||
208 | extern unsigned int default_hstate_idx; | ||
209 | |||
210 | #define default_hstate (hstates[default_hstate_idx]) | ||
211 | |||
212 | static inline struct hstate *hstate_inode(struct inode *i) | ||
213 | { | ||
214 | struct hugetlbfs_sb_info *hsb; | ||
215 | hsb = HUGETLBFS_SB(i->i_sb); | ||
216 | return hsb->hstate; | ||
217 | } | ||
218 | |||
219 | static inline struct hstate *hstate_file(struct file *f) | ||
220 | { | ||
221 | return hstate_inode(f->f_dentry->d_inode); | ||
222 | } | ||
223 | |||
224 | static inline struct hstate *hstate_vma(struct vm_area_struct *vma) | ||
225 | { | ||
226 | return hstate_file(vma->vm_file); | ||
227 | } | ||
228 | |||
229 | static inline unsigned long huge_page_size(struct hstate *h) | ||
230 | { | ||
231 | return (unsigned long)PAGE_SIZE << h->order; | ||
232 | } | ||
233 | |||
234 | static inline unsigned long huge_page_mask(struct hstate *h) | ||
235 | { | ||
236 | return h->mask; | ||
237 | } | ||
238 | |||
239 | static inline unsigned int huge_page_order(struct hstate *h) | ||
240 | { | ||
241 | return h->order; | ||
242 | } | ||
243 | |||
244 | static inline unsigned huge_page_shift(struct hstate *h) | ||
245 | { | ||
246 | return h->order + PAGE_SHIFT; | ||
247 | } | ||
248 | |||
249 | static inline unsigned int pages_per_huge_page(struct hstate *h) | ||
250 | { | ||
251 | return 1 << h->order; | ||
252 | } | ||
253 | |||
254 | static inline unsigned int blocks_per_huge_page(struct hstate *h) | ||
255 | { | ||
256 | return huge_page_size(h) / 512; | ||
257 | } | ||
258 | |||
259 | #include <asm/hugetlb.h> | ||
260 | |||
261 | static inline struct hstate *page_hstate(struct page *page) | ||
262 | { | ||
263 | return size_to_hstate(PAGE_SIZE << compound_order(page)); | ||
264 | } | ||
265 | |||
266 | #else | ||
267 | struct hstate {}; | ||
268 | #define alloc_bootmem_huge_page(h) NULL | ||
269 | #define hstate_file(f) NULL | ||
270 | #define hstate_vma(v) NULL | ||
271 | #define hstate_inode(i) NULL | ||
272 | #define huge_page_size(h) PAGE_SIZE | ||
273 | #define huge_page_mask(h) PAGE_MASK | ||
274 | #define huge_page_order(h) 0 | ||
275 | #define huge_page_shift(h) PAGE_SHIFT | ||
276 | static inline unsigned int pages_per_huge_page(struct hstate *h) | ||
277 | { | ||
278 | return 1; | ||
279 | } | ||
280 | #endif | ||
281 | |||
158 | #endif /* _LINUX_HUGETLB_H */ | 282 | #endif /* _LINUX_HUGETLB_H */ |
diff --git a/include/linux/i2c-algo-pcf.h b/include/linux/i2c-algo-pcf.h index 77afbb60fd11..0177d280f733 100644 --- a/include/linux/i2c-algo-pcf.h +++ b/include/linux/i2c-algo-pcf.h | |||
@@ -33,9 +33,11 @@ struct i2c_algo_pcf_data { | |||
33 | int (*getclock) (void *data); | 33 | int (*getclock) (void *data); |
34 | void (*waitforpin) (void); | 34 | void (*waitforpin) (void); |
35 | 35 | ||
36 | /* local settings */ | 36 | /* Multi-master lost arbitration back-off delay (msecs) |
37 | int udelay; | 37 | * This should be set by the bus adapter or knowledgable client |
38 | int timeout; | 38 | * if bus is multi-mastered, else zero |
39 | */ | ||
40 | unsigned long lab_mdelay; | ||
39 | }; | 41 | }; |
40 | 42 | ||
41 | int i2c_pcf_add_bus(struct i2c_adapter *); | 43 | int i2c_pcf_add_bus(struct i2c_adapter *); |
diff --git a/include/linux/i2c-id.h b/include/linux/i2c-id.h index 580acc93903e..493435bcdbe5 100644 --- a/include/linux/i2c-id.h +++ b/include/linux/i2c-id.h | |||
@@ -33,26 +33,18 @@ | |||
33 | 33 | ||
34 | #define I2C_DRIVERID_MSP3400 1 | 34 | #define I2C_DRIVERID_MSP3400 1 |
35 | #define I2C_DRIVERID_TUNER 2 | 35 | #define I2C_DRIVERID_TUNER 2 |
36 | #define I2C_DRIVERID_TDA8425 4 /* stereo sound processor */ | ||
37 | #define I2C_DRIVERID_TEA6420 5 /* audio matrix switch */ | 36 | #define I2C_DRIVERID_TEA6420 5 /* audio matrix switch */ |
38 | #define I2C_DRIVERID_TEA6415C 6 /* video matrix switch */ | 37 | #define I2C_DRIVERID_TEA6415C 6 /* video matrix switch */ |
39 | #define I2C_DRIVERID_TDA9840 7 /* stereo sound processor */ | 38 | #define I2C_DRIVERID_TDA9840 7 /* stereo sound processor */ |
40 | #define I2C_DRIVERID_SAA7111A 8 /* video input processor */ | 39 | #define I2C_DRIVERID_SAA7111A 8 /* video input processor */ |
41 | #define I2C_DRIVERID_SAA7185B 13 /* video encoder */ | 40 | #define I2C_DRIVERID_SAA7185B 13 /* video encoder */ |
42 | #define I2C_DRIVERID_TEA6300 18 /* audio mixer */ | ||
43 | #define I2C_DRIVERID_TDA9850 20 /* audio mixer */ | ||
44 | #define I2C_DRIVERID_TDA9855 21 /* audio mixer */ | ||
45 | #define I2C_DRIVERID_SAA7110 22 /* video decoder */ | 41 | #define I2C_DRIVERID_SAA7110 22 /* video decoder */ |
46 | #define I2C_DRIVERID_MGATVO 23 /* Matrox TVOut */ | ||
47 | #define I2C_DRIVERID_SAA5249 24 /* SAA5249 and compatibles */ | 42 | #define I2C_DRIVERID_SAA5249 24 /* SAA5249 and compatibles */ |
48 | #define I2C_DRIVERID_PCF8583 25 /* real time clock */ | 43 | #define I2C_DRIVERID_PCF8583 25 /* real time clock */ |
49 | #define I2C_DRIVERID_SAB3036 26 /* SAB3036 tuner */ | ||
50 | #define I2C_DRIVERID_TDA7432 27 /* Stereo sound processor */ | 44 | #define I2C_DRIVERID_TDA7432 27 /* Stereo sound processor */ |
51 | #define I2C_DRIVERID_TVMIXER 28 /* Mixer driver for tv cards */ | 45 | #define I2C_DRIVERID_TVMIXER 28 /* Mixer driver for tv cards */ |
52 | #define I2C_DRIVERID_TVAUDIO 29 /* Generic TV sound driver */ | 46 | #define I2C_DRIVERID_TVAUDIO 29 /* Generic TV sound driver */ |
53 | #define I2C_DRIVERID_TDA9873 31 /* TV sound decoder chip */ | ||
54 | #define I2C_DRIVERID_TDA9875 32 /* TV sound decoder chip */ | 47 | #define I2C_DRIVERID_TDA9875 32 /* TV sound decoder chip */ |
55 | #define I2C_DRIVERID_PIC16C54_PV9 33 /* Audio mux/ir receiver */ | ||
56 | #define I2C_DRIVERID_BT819 40 /* video decoder */ | 48 | #define I2C_DRIVERID_BT819 40 /* video decoder */ |
57 | #define I2C_DRIVERID_BT856 41 /* video encoder */ | 49 | #define I2C_DRIVERID_BT856 41 /* video encoder */ |
58 | #define I2C_DRIVERID_VPX3220 42 /* video decoder+vbi/vtxt */ | 50 | #define I2C_DRIVERID_VPX3220 42 /* video decoder+vbi/vtxt */ |
@@ -63,7 +55,6 @@ | |||
63 | #define I2C_DRIVERID_INDYCAM 58 /* SGI IndyCam */ | 55 | #define I2C_DRIVERID_INDYCAM 58 /* SGI IndyCam */ |
64 | #define I2C_DRIVERID_OVCAMCHIP 61 /* OmniVision CMOS image sens. */ | 56 | #define I2C_DRIVERID_OVCAMCHIP 61 /* OmniVision CMOS image sens. */ |
65 | #define I2C_DRIVERID_MAX6900 63 /* MAX6900 real-time clock */ | 57 | #define I2C_DRIVERID_MAX6900 63 /* MAX6900 real-time clock */ |
66 | #define I2C_DRIVERID_TDA9874 66 /* TV sound decoder */ | ||
67 | #define I2C_DRIVERID_SAA6752HS 67 /* MPEG2 encoder */ | 58 | #define I2C_DRIVERID_SAA6752HS 67 /* MPEG2 encoder */ |
68 | #define I2C_DRIVERID_TVEEPROM 68 /* TV EEPROM */ | 59 | #define I2C_DRIVERID_TVEEPROM 68 /* TV EEPROM */ |
69 | #define I2C_DRIVERID_WM8775 69 /* wm8775 audio processor */ | 60 | #define I2C_DRIVERID_WM8775 69 /* wm8775 audio processor */ |
@@ -91,8 +82,6 @@ | |||
91 | #define I2C_DRIVERID_M52790 95 /* Mitsubishi M52790SP/FP AV switch */ | 82 | #define I2C_DRIVERID_M52790 95 /* Mitsubishi M52790SP/FP AV switch */ |
92 | #define I2C_DRIVERID_CS5345 96 /* cs5345 audio processor */ | 83 | #define I2C_DRIVERID_CS5345 96 /* cs5345 audio processor */ |
93 | 84 | ||
94 | #define I2C_DRIVERID_I2CDEV 900 | ||
95 | |||
96 | #define I2C_DRIVERID_OV7670 1048 /* Omnivision 7670 camera */ | 85 | #define I2C_DRIVERID_OV7670 1048 /* Omnivision 7670 camera */ |
97 | 86 | ||
98 | /* | 87 | /* |
@@ -104,14 +93,12 @@ | |||
104 | #define I2C_HW_B_BT848 0x010005 /* BT848 video boards */ | 93 | #define I2C_HW_B_BT848 0x010005 /* BT848 video boards */ |
105 | #define I2C_HW_B_VIA 0x010007 /* Via vt82c586b */ | 94 | #define I2C_HW_B_VIA 0x010007 /* Via vt82c586b */ |
106 | #define I2C_HW_B_HYDRA 0x010008 /* Apple Hydra Mac I/O */ | 95 | #define I2C_HW_B_HYDRA 0x010008 /* Apple Hydra Mac I/O */ |
107 | #define I2C_HW_B_G400 0x010009 /* Matrox G400 */ | ||
108 | #define I2C_HW_B_I810 0x01000a /* Intel I810 */ | 96 | #define I2C_HW_B_I810 0x01000a /* Intel I810 */ |
109 | #define I2C_HW_B_VOO 0x01000b /* 3dfx Voodoo 3 / Banshee */ | 97 | #define I2C_HW_B_VOO 0x01000b /* 3dfx Voodoo 3 / Banshee */ |
110 | #define I2C_HW_B_SCX200 0x01000e /* Nat'l Semi SCx200 I2C */ | 98 | #define I2C_HW_B_SCX200 0x01000e /* Nat'l Semi SCx200 I2C */ |
111 | #define I2C_HW_B_RIVA 0x010010 /* Riva based graphics cards */ | 99 | #define I2C_HW_B_RIVA 0x010010 /* Riva based graphics cards */ |
112 | #define I2C_HW_B_IOC 0x010011 /* IOC bit-wiggling */ | 100 | #define I2C_HW_B_IOC 0x010011 /* IOC bit-wiggling */ |
113 | #define I2C_HW_B_IXP2000 0x010016 /* GPIO on IXP2000 systems */ | 101 | #define I2C_HW_B_IXP2000 0x010016 /* GPIO on IXP2000 systems */ |
114 | #define I2C_HW_B_S3VIA 0x010018 /* S3Via ProSavage adapter */ | ||
115 | #define I2C_HW_B_ZR36067 0x010019 /* Zoran-36057/36067 based boards */ | 102 | #define I2C_HW_B_ZR36067 0x010019 /* Zoran-36057/36067 based boards */ |
116 | #define I2C_HW_B_PCILYNX 0x01001a /* TI PCILynx I2C adapter */ | 103 | #define I2C_HW_B_PCILYNX 0x01001a /* TI PCILynx I2C adapter */ |
117 | #define I2C_HW_B_CX2388x 0x01001b /* connexant 2388x based tv cards */ | 104 | #define I2C_HW_B_CX2388x 0x01001b /* connexant 2388x based tv cards */ |
@@ -161,7 +148,6 @@ | |||
161 | #define I2C_HW_SMBUS_W9968CF 0x04000d | 148 | #define I2C_HW_SMBUS_W9968CF 0x04000d |
162 | #define I2C_HW_SMBUS_OV511 0x04000e /* OV511(+) USB 1.1 webcam ICs */ | 149 | #define I2C_HW_SMBUS_OV511 0x04000e /* OV511(+) USB 1.1 webcam ICs */ |
163 | #define I2C_HW_SMBUS_OV518 0x04000f /* OV518(+) USB 1.1 webcam ICs */ | 150 | #define I2C_HW_SMBUS_OV518 0x04000f /* OV518(+) USB 1.1 webcam ICs */ |
164 | #define I2C_HW_SMBUS_OVFX2 0x040011 /* Cypress/OmniVision FX2 webcam */ | ||
165 | #define I2C_HW_SMBUS_CAFE 0x040012 /* Marvell 88ALP01 "CAFE" cam */ | 151 | #define I2C_HW_SMBUS_CAFE 0x040012 /* Marvell 88ALP01 "CAFE" cam */ |
166 | #define I2C_HW_SMBUS_ALI1563 0x040013 | 152 | #define I2C_HW_SMBUS_ALI1563 0x040013 |
167 | 153 | ||
diff --git a/include/linux/i2c-pnx.h b/include/linux/i2c-pnx.h index e6e9c814da61..f13255e06406 100644 --- a/include/linux/i2c-pnx.h +++ b/include/linux/i2c-pnx.h | |||
@@ -12,7 +12,9 @@ | |||
12 | #ifndef __I2C_PNX_H__ | 12 | #ifndef __I2C_PNX_H__ |
13 | #define __I2C_PNX_H__ | 13 | #define __I2C_PNX_H__ |
14 | 14 | ||
15 | #include <asm/arch/i2c.h> | 15 | #include <linux/pm.h> |
16 | |||
17 | struct platform_device; | ||
16 | 18 | ||
17 | struct i2c_pnx_mif { | 19 | struct i2c_pnx_mif { |
18 | int ret; /* Return value */ | 20 | int ret; /* Return value */ |
diff --git a/include/linux/i2c.h b/include/linux/i2c.h index fb9af6a0fe9c..06115128047f 100644 --- a/include/linux/i2c.h +++ b/include/linux/i2c.h | |||
@@ -35,6 +35,8 @@ | |||
35 | #include <linux/sched.h> /* for completion */ | 35 | #include <linux/sched.h> /* for completion */ |
36 | #include <linux/mutex.h> | 36 | #include <linux/mutex.h> |
37 | 37 | ||
38 | extern struct bus_type i2c_bus_type; | ||
39 | |||
38 | /* --- General options ------------------------------------------------ */ | 40 | /* --- General options ------------------------------------------------ */ |
39 | 41 | ||
40 | struct i2c_msg; | 42 | struct i2c_msg; |
@@ -43,6 +45,7 @@ struct i2c_adapter; | |||
43 | struct i2c_client; | 45 | struct i2c_client; |
44 | struct i2c_driver; | 46 | struct i2c_driver; |
45 | union i2c_smbus_data; | 47 | union i2c_smbus_data; |
48 | struct i2c_board_info; | ||
46 | 49 | ||
47 | /* | 50 | /* |
48 | * The master routines are the ones normally used to transmit data to devices | 51 | * The master routines are the ones normally used to transmit data to devices |
@@ -69,9 +72,8 @@ extern s32 i2c_smbus_xfer (struct i2c_adapter * adapter, u16 addr, | |||
69 | union i2c_smbus_data * data); | 72 | union i2c_smbus_data * data); |
70 | 73 | ||
71 | /* Now follow the 'nice' access routines. These also document the calling | 74 | /* Now follow the 'nice' access routines. These also document the calling |
72 | conventions of smbus_access. */ | 75 | conventions of i2c_smbus_xfer. */ |
73 | 76 | ||
74 | extern s32 i2c_smbus_write_quick(struct i2c_client * client, u8 value); | ||
75 | extern s32 i2c_smbus_read_byte(struct i2c_client * client); | 77 | extern s32 i2c_smbus_read_byte(struct i2c_client * client); |
76 | extern s32 i2c_smbus_write_byte(struct i2c_client * client, u8 value); | 78 | extern s32 i2c_smbus_write_byte(struct i2c_client * client, u8 value); |
77 | extern s32 i2c_smbus_read_byte_data(struct i2c_client * client, u8 command); | 79 | extern s32 i2c_smbus_read_byte_data(struct i2c_client * client, u8 command); |
@@ -93,15 +95,45 @@ extern s32 i2c_smbus_write_i2c_block_data(struct i2c_client * client, | |||
93 | u8 command, u8 length, | 95 | u8 command, u8 length, |
94 | const u8 *values); | 96 | const u8 *values); |
95 | 97 | ||
96 | /* | 98 | /** |
97 | * A driver is capable of handling one or more physical devices present on | 99 | * struct i2c_driver - represent an I2C device driver |
98 | * I2C adapters. This information is used to inform the driver of adapter | 100 | * @id: Unique driver ID (optional) |
99 | * events. | 101 | * @class: What kind of i2c device we instantiate (for detect) |
102 | * @attach_adapter: Callback for bus addition (for legacy drivers) | ||
103 | * @detach_adapter: Callback for bus removal (for legacy drivers) | ||
104 | * @detach_client: Callback for device removal (for legacy drivers) | ||
105 | * @probe: Callback for device binding (new-style drivers) | ||
106 | * @remove: Callback for device unbinding (new-style drivers) | ||
107 | * @shutdown: Callback for device shutdown | ||
108 | * @suspend: Callback for device suspend | ||
109 | * @resume: Callback for device resume | ||
110 | * @command: Callback for bus-wide signaling (optional) | ||
111 | * @driver: Device driver model driver | ||
112 | * @id_table: List of I2C devices supported by this driver | ||
113 | * @detect: Callback for device detection | ||
114 | * @address_data: The I2C addresses to probe, ignore or force (for detect) | ||
115 | * @clients: List of detected clients we created (for i2c-core use only) | ||
100 | * | 116 | * |
101 | * 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. |
102 | * The driver.name field should be set to the name of this driver. | 118 | * The driver.name field should be set to the name of this driver. |
119 | * | ||
120 | * For automatic device detection, both @detect and @address_data must | ||
121 | * be defined. @class should also be set, otherwise only devices forced | ||
122 | * with module parameters will be created. The detect function must | ||
123 | * fill at least the name field of the i2c_board_info structure it is | ||
124 | * handed upon successful detection, and possibly also the flags field. | ||
125 | * | ||
126 | * If @detect is missing, the driver will still work fine for enumerated | ||
127 | * devices. Detected devices simply won't be supported. This is expected | ||
128 | * for the many I2C/SMBus devices which can't be detected reliably, and | ||
129 | * the ones which can always be enumerated in practice. | ||
130 | * | ||
131 | * The i2c_client structure which is handed to the @detect callback is | ||
132 | * not a real i2c_client. It is initialized just enough so that you can | ||
133 | * call i2c_smbus_read_byte_data and friends on it. Don't do anything | ||
134 | * else with it. In particular, calling dev_dbg and friends on it is | ||
135 | * not allowed. | ||
103 | */ | 136 | */ |
104 | |||
105 | struct i2c_driver { | 137 | struct i2c_driver { |
106 | int id; | 138 | int id; |
107 | unsigned int class; | 139 | unsigned int class; |
@@ -141,6 +173,11 @@ struct i2c_driver { | |||
141 | 173 | ||
142 | struct device_driver driver; | 174 | struct device_driver driver; |
143 | const struct i2c_device_id *id_table; | 175 | const struct i2c_device_id *id_table; |
176 | |||
177 | /* Device detection callback for automatic device creation */ | ||
178 | int (*detect)(struct i2c_client *, int kind, struct i2c_board_info *); | ||
179 | const struct i2c_client_address_data *address_data; | ||
180 | struct list_head clients; | ||
144 | }; | 181 | }; |
145 | #define to_i2c_driver(d) container_of(d, struct i2c_driver, driver) | 182 | #define to_i2c_driver(d) container_of(d, struct i2c_driver, driver) |
146 | 183 | ||
@@ -156,6 +193,7 @@ struct i2c_driver { | |||
156 | * @dev: Driver model device node for the slave. | 193 | * @dev: Driver model device node for the slave. |
157 | * @irq: indicates the IRQ generated by this device (if any) | 194 | * @irq: indicates the IRQ generated by this device (if any) |
158 | * @list: list of active/busy clients (DEPRECATED) | 195 | * @list: list of active/busy clients (DEPRECATED) |
196 | * @detected: member of an i2c_driver.clients list | ||
159 | * @released: used to synchronize client releases & detaches and references | 197 | * @released: used to synchronize client releases & detaches and references |
160 | * | 198 | * |
161 | * An i2c_client identifies a single device (i.e. chip) connected to an | 199 | * An i2c_client identifies a single device (i.e. chip) connected to an |
@@ -171,8 +209,9 @@ struct i2c_client { | |||
171 | struct i2c_adapter *adapter; /* the adapter we sit on */ | 209 | struct i2c_adapter *adapter; /* the adapter we sit on */ |
172 | struct i2c_driver *driver; /* and our access routines */ | 210 | struct i2c_driver *driver; /* and our access routines */ |
173 | struct device dev; /* the device structure */ | 211 | struct device dev; /* the device structure */ |
174 | int irq; /* irq issued by device (or -1) */ | 212 | int irq; /* irq issued by device */ |
175 | struct list_head list; /* DEPRECATED */ | 213 | struct list_head list; /* DEPRECATED */ |
214 | struct list_head detected; | ||
176 | struct completion released; | 215 | struct completion released; |
177 | }; | 216 | }; |
178 | #define to_i2c_client(d) container_of(d, struct i2c_client, dev) | 217 | #define to_i2c_client(d) container_of(d, struct i2c_client, dev) |
@@ -350,10 +389,11 @@ static inline void i2c_set_adapdata (struct i2c_adapter *dev, void *data) | |||
350 | #define I2C_CLASS_HWMON (1<<0) /* lm_sensors, ... */ | 389 | #define I2C_CLASS_HWMON (1<<0) /* lm_sensors, ... */ |
351 | #define I2C_CLASS_TV_ANALOG (1<<1) /* bttv + friends */ | 390 | #define I2C_CLASS_TV_ANALOG (1<<1) /* bttv + friends */ |
352 | #define I2C_CLASS_TV_DIGITAL (1<<2) /* dvb cards */ | 391 | #define I2C_CLASS_TV_DIGITAL (1<<2) /* dvb cards */ |
353 | #define I2C_CLASS_DDC (1<<3) /* i2c-matroxfb ? */ | 392 | #define I2C_CLASS_DDC (1<<3) /* DDC bus on graphics adapters */ |
354 | #define I2C_CLASS_CAM_ANALOG (1<<4) /* camera with analog CCD */ | 393 | #define I2C_CLASS_CAM_ANALOG (1<<4) /* camera with analog CCD */ |
355 | #define I2C_CLASS_CAM_DIGITAL (1<<5) /* most webcams */ | 394 | #define I2C_CLASS_CAM_DIGITAL (1<<5) /* most webcams */ |
356 | #define I2C_CLASS_SOUND (1<<6) /* sound devices */ | 395 | #define I2C_CLASS_SOUND (1<<6) /* sound devices */ |
396 | #define I2C_CLASS_SPD (1<<7) /* SPD EEPROMs and similar */ | ||
357 | #define I2C_CLASS_ALL (UINT_MAX) /* all of the above */ | 397 | #define I2C_CLASS_ALL (UINT_MAX) /* all of the above */ |
358 | 398 | ||
359 | /* i2c_client_address_data is the struct for holding default client | 399 | /* i2c_client_address_data is the struct for holding default client |
@@ -537,7 +577,7 @@ union i2c_smbus_data { | |||
537 | /* and one more for user-space compatibility */ | 577 | /* and one more for user-space compatibility */ |
538 | }; | 578 | }; |
539 | 579 | ||
540 | /* smbus_access read or write markers */ | 580 | /* i2c_smbus_xfer read or write markers */ |
541 | #define I2C_SMBUS_READ 1 | 581 | #define I2C_SMBUS_READ 1 |
542 | #define I2C_SMBUS_WRITE 0 | 582 | #define I2C_SMBUS_WRITE 0 |
543 | 583 | ||
diff --git a/include/linux/i2c/at24.h b/include/linux/i2c/at24.h new file mode 100644 index 000000000000..f6edd522a929 --- /dev/null +++ b/include/linux/i2c/at24.h | |||
@@ -0,0 +1,28 @@ | |||
1 | #ifndef _LINUX_AT24_H | ||
2 | #define _LINUX_AT24_H | ||
3 | |||
4 | #include <linux/types.h> | ||
5 | |||
6 | /* | ||
7 | * As seen through Linux I2C, differences between the most common types of I2C | ||
8 | * memory include: | ||
9 | * - How much memory is available (usually specified in bit)? | ||
10 | * - What write page size does it support? | ||
11 | * - Special flags (16 bit addresses, read_only, world readable...)? | ||
12 | * | ||
13 | * If you set up a custom eeprom type, please double-check the parameters. | ||
14 | * Especially page_size needs extra care, as you risk data loss if your value | ||
15 | * is bigger than what the chip actually supports! | ||
16 | */ | ||
17 | |||
18 | struct at24_platform_data { | ||
19 | u32 byte_len; /* size (sum of all addr) */ | ||
20 | u16 page_size; /* for writes */ | ||
21 | u8 flags; | ||
22 | #define AT24_FLAG_ADDR16 0x80 /* address pointer is 16 bit */ | ||
23 | #define AT24_FLAG_READONLY 0x40 /* sysfs-entry will be read-only */ | ||
24 | #define AT24_FLAG_IRUGO 0x20 /* sysfs-entry will be world-readable */ | ||
25 | #define AT24_FLAG_TAKE8ADDR 0x10 /* take always 8 addresses (24c00) */ | ||
26 | }; | ||
27 | |||
28 | #endif /* _LINUX_AT24_H */ | ||
diff --git a/include/linux/i2c/max732x.h b/include/linux/i2c/max732x.h new file mode 100644 index 000000000000..e10336631c62 --- /dev/null +++ b/include/linux/i2c/max732x.h | |||
@@ -0,0 +1,19 @@ | |||
1 | #ifndef __LINUX_I2C_MAX732X_H | ||
2 | #define __LINUX_I2C_MAX732X_H | ||
3 | |||
4 | /* platform data for the MAX732x 8/16-bit I/O expander driver */ | ||
5 | |||
6 | struct max732x_platform_data { | ||
7 | /* number of the first GPIO */ | ||
8 | unsigned gpio_base; | ||
9 | |||
10 | void *context; /* param to setup/teardown */ | ||
11 | |||
12 | int (*setup)(struct i2c_client *client, | ||
13 | unsigned gpio, unsigned ngpio, | ||
14 | void *context); | ||
15 | int (*teardown)(struct i2c_client *client, | ||
16 | unsigned gpio, unsigned ngpio, | ||
17 | void *context); | ||
18 | }; | ||
19 | #endif /* __LINUX_I2C_MAX732X_H */ | ||
diff --git a/include/linux/i2o.h b/include/linux/i2o.h index 7d51cbca49ab..75ae6d8aba4f 100644 --- a/include/linux/i2o.h +++ b/include/linux/i2o.h | |||
@@ -758,7 +758,7 @@ static inline dma_addr_t i2o_dma_map_single(struct i2o_controller *c, void *ptr, | |||
758 | } | 758 | } |
759 | 759 | ||
760 | dma_addr = dma_map_single(&c->pdev->dev, ptr, size, direction); | 760 | dma_addr = dma_map_single(&c->pdev->dev, ptr, size, direction); |
761 | if (!dma_mapping_error(dma_addr)) { | 761 | if (!dma_mapping_error(&c->pdev->dev, dma_addr)) { |
762 | #ifdef CONFIG_I2O_EXT_ADAPTEC_DMA64 | 762 | #ifdef CONFIG_I2O_EXT_ADAPTEC_DMA64 |
763 | if ((sizeof(dma_addr_t) > 4) && c->pae_support) { | 763 | if ((sizeof(dma_addr_t) > 4) && c->pae_support) { |
764 | *mptr++ = cpu_to_le32(0x7C020002); | 764 | *mptr++ = cpu_to_le32(0x7C020002); |
diff --git a/include/linux/ide.h b/include/linux/ide.h index 9918772bf274..c47e371554c1 100644 --- a/include/linux/ide.h +++ b/include/linux/ide.h | |||
@@ -8,7 +8,7 @@ | |||
8 | 8 | ||
9 | #include <linux/init.h> | 9 | #include <linux/init.h> |
10 | #include <linux/ioport.h> | 10 | #include <linux/ioport.h> |
11 | #include <linux/hdreg.h> | 11 | #include <linux/ata.h> |
12 | #include <linux/blkdev.h> | 12 | #include <linux/blkdev.h> |
13 | #include <linux/proc_fs.h> | 13 | #include <linux/proc_fs.h> |
14 | #include <linux/interrupt.h> | 14 | #include <linux/interrupt.h> |
@@ -17,6 +17,7 @@ | |||
17 | #include <linux/device.h> | 17 | #include <linux/device.h> |
18 | #include <linux/pci.h> | 18 | #include <linux/pci.h> |
19 | #include <linux/completion.h> | 19 | #include <linux/completion.h> |
20 | #include <linux/pm.h> | ||
20 | #ifdef CONFIG_BLK_DEV_IDEACPI | 21 | #ifdef CONFIG_BLK_DEV_IDEACPI |
21 | #include <acpi/acpi.h> | 22 | #include <acpi/acpi.h> |
22 | #endif | 23 | #endif |
@@ -47,12 +48,6 @@ typedef unsigned char byte; /* used everywhere */ | |||
47 | #define ERROR_RESET 3 /* Reset controller every 4th retry */ | 48 | #define ERROR_RESET 3 /* Reset controller every 4th retry */ |
48 | #define ERROR_RECAL 1 /* Recalibrate every 2nd retry */ | 49 | #define ERROR_RECAL 1 /* Recalibrate every 2nd retry */ |
49 | 50 | ||
50 | /* | ||
51 | * state flags | ||
52 | */ | ||
53 | |||
54 | #define DMA_PIO_RETRY 1 /* retrying in PIO */ | ||
55 | |||
56 | #define HWIF(drive) ((ide_hwif_t *)((drive)->hwif)) | 51 | #define HWIF(drive) ((ide_hwif_t *)((drive)->hwif)) |
57 | #define HWGROUP(drive) ((ide_hwgroup_t *)(HWIF(drive)->hwgroup)) | 52 | #define HWGROUP(drive) ((ide_hwgroup_t *)(HWIF(drive)->hwgroup)) |
58 | 53 | ||
@@ -87,12 +82,13 @@ struct ide_io_ports { | |||
87 | }; | 82 | }; |
88 | 83 | ||
89 | #define OK_STAT(stat,good,bad) (((stat)&((good)|(bad)))==(good)) | 84 | #define OK_STAT(stat,good,bad) (((stat)&((good)|(bad)))==(good)) |
90 | #define BAD_R_STAT (BUSY_STAT | ERR_STAT) | ||
91 | #define BAD_W_STAT (BAD_R_STAT | WRERR_STAT) | ||
92 | #define BAD_STAT (BAD_R_STAT | DRQ_STAT) | ||
93 | #define DRIVE_READY (READY_STAT | SEEK_STAT) | ||
94 | 85 | ||
95 | #define BAD_CRC (ABRT_ERR | ICRC_ERR) | 86 | #define BAD_R_STAT (ATA_BUSY | ATA_ERR) |
87 | #define BAD_W_STAT (BAD_R_STAT | ATA_DF) | ||
88 | #define BAD_STAT (BAD_R_STAT | ATA_DRQ) | ||
89 | #define DRIVE_READY (ATA_DRDY | ATA_DSC) | ||
90 | |||
91 | #define BAD_CRC (ATA_ABORTED | ATA_ICRC) | ||
96 | 92 | ||
97 | #define SATA_NR_PORTS (3) /* 16 possible ?? */ | 93 | #define SATA_NR_PORTS (3) /* 16 possible ?? */ |
98 | 94 | ||
@@ -125,18 +121,43 @@ struct ide_io_ports { | |||
125 | #define PARTN_BITS 6 /* number of minor dev bits for partitions */ | 121 | #define PARTN_BITS 6 /* number of minor dev bits for partitions */ |
126 | #define MAX_DRIVES 2 /* per interface; 2 assumed by lots of code */ | 122 | #define MAX_DRIVES 2 /* per interface; 2 assumed by lots of code */ |
127 | #define SECTOR_SIZE 512 | 123 | #define SECTOR_SIZE 512 |
128 | #define SECTOR_WORDS (SECTOR_SIZE / 4) /* number of 32bit words per sector */ | 124 | |
129 | #define IDE_LARGE_SEEK(b1,b2,t) (((b1) > (b2) + (t)) || ((b2) > (b1) + (t))) | 125 | #define IDE_LARGE_SEEK(b1,b2,t) (((b1) > (b2) + (t)) || ((b2) > (b1) + (t))) |
130 | 126 | ||
131 | /* | 127 | /* |
132 | * Timeouts for various operations: | 128 | * Timeouts for various operations: |
133 | */ | 129 | */ |
134 | #define WAIT_DRQ (HZ/10) /* 100msec - spec allows up to 20ms */ | 130 | enum { |
135 | #define WAIT_READY (5*HZ) /* 5sec - some laptops are very slow */ | 131 | /* spec allows up to 20ms */ |
136 | #define WAIT_PIDENTIFY (10*HZ) /* 10sec - should be less than 3ms (?), if all ATAPI CD is closed at boot */ | 132 | WAIT_DRQ = HZ / 10, /* 100ms */ |
137 | #define WAIT_WORSTCASE (30*HZ) /* 30sec - worst case when spinning up */ | 133 | /* some laptops are very slow */ |
138 | #define WAIT_CMD (10*HZ) /* 10sec - maximum wait for an IRQ to happen */ | 134 | WAIT_READY = 5 * HZ, /* 5s */ |
139 | #define WAIT_MIN_SLEEP (2*HZ/100) /* 20msec - minimum sleep time */ | 135 | /* should be less than 3ms (?), if all ATAPI CD is closed at boot */ |
136 | WAIT_PIDENTIFY = 10 * HZ, /* 10s */ | ||
137 | /* worst case when spinning up */ | ||
138 | WAIT_WORSTCASE = 30 * HZ, /* 30s */ | ||
139 | /* maximum wait for an IRQ to happen */ | ||
140 | WAIT_CMD = 10 * HZ, /* 10s */ | ||
141 | /* Some drives require a longer IRQ timeout. */ | ||
142 | WAIT_FLOPPY_CMD = 50 * HZ, /* 50s */ | ||
143 | /* | ||
144 | * Some drives (for example, Seagate STT3401A Travan) require a very | ||
145 | * long timeout, because they don't return an interrupt or clear their | ||
146 | * BSY bit until after the command completes (even retension commands). | ||
147 | */ | ||
148 | WAIT_TAPE_CMD = 900 * HZ, /* 900s */ | ||
149 | /* minimum sleep time */ | ||
150 | WAIT_MIN_SLEEP = HZ / 50, /* 20ms */ | ||
151 | }; | ||
152 | |||
153 | /* | ||
154 | * Op codes for special requests to be handled by ide_special_rq(). | ||
155 | * Values should be in the range of 0x20 to 0x3f. | ||
156 | */ | ||
157 | #define REQ_DRIVE_RESET 0x20 | ||
158 | #define REQ_DEVSET_EXEC 0x21 | ||
159 | #define REQ_PARK_HEADS 0x22 | ||
160 | #define REQ_UNPARK_HEADS 0x23 | ||
140 | 161 | ||
141 | /* | 162 | /* |
142 | * Check for an interrupt and acknowledge the interrupt status | 163 | * Check for an interrupt and acknowledge the interrupt status |
@@ -171,7 +192,8 @@ typedef struct hw_regs_s { | |||
171 | int irq; /* our irq number */ | 192 | int irq; /* our irq number */ |
172 | ide_ack_intr_t *ack_intr; /* acknowledge interrupt */ | 193 | ide_ack_intr_t *ack_intr; /* acknowledge interrupt */ |
173 | hwif_chipset_t chipset; | 194 | hwif_chipset_t chipset; |
174 | struct device *dev; | 195 | struct device *dev, *parent; |
196 | unsigned long config; | ||
175 | } hw_regs_t; | 197 | } hw_regs_t; |
176 | 198 | ||
177 | void ide_init_port_data(struct hwif_s *, unsigned int); | 199 | void ide_init_port_data(struct hwif_s *, unsigned int); |
@@ -189,13 +211,31 @@ static inline void ide_std_init_ports(hw_regs_t *hw, | |||
189 | hw->io_ports.ctl_addr = ctl_addr; | 211 | hw->io_ports.ctl_addr = ctl_addr; |
190 | } | 212 | } |
191 | 213 | ||
192 | #include <asm/ide.h> | 214 | /* for IDE PCI controllers in legacy mode, temporary */ |
215 | static inline int __ide_default_irq(unsigned long base) | ||
216 | { | ||
217 | switch (base) { | ||
218 | #ifdef CONFIG_IA64 | ||
219 | case 0x1f0: return isa_irq_to_vector(14); | ||
220 | case 0x170: return isa_irq_to_vector(15); | ||
221 | #else | ||
222 | case 0x1f0: return 14; | ||
223 | case 0x170: return 15; | ||
224 | #endif | ||
225 | } | ||
226 | return 0; | ||
227 | } | ||
193 | 228 | ||
194 | #if !defined(MAX_HWIFS) || defined(CONFIG_EMBEDDED) | 229 | #if defined(CONFIG_ARM) || defined(CONFIG_FRV) || defined(CONFIG_M68K) || \ |
195 | #undef MAX_HWIFS | 230 | defined(CONFIG_MIPS) || defined(CONFIG_MN10300) || defined(CONFIG_PARISC) \ |
196 | #define MAX_HWIFS CONFIG_IDE_MAX_HWIFS | 231 | || defined(CONFIG_PPC) || defined(CONFIG_SPARC) || defined(CONFIG_SPARC64) |
232 | #include <asm/ide.h> | ||
233 | #else | ||
234 | #include <asm-generic/ide_iops.h> | ||
197 | #endif | 235 | #endif |
198 | 236 | ||
237 | #define MAX_HWIFS 10 | ||
238 | |||
199 | /* Currently only m68k, apus and m8xx need it */ | 239 | /* Currently only m68k, apus and m8xx need it */ |
200 | #ifndef IDE_ARCH_ACK_INTR | 240 | #ifndef IDE_ARCH_ACK_INTR |
201 | # define ide_ack_intr(hwif) (1) | 241 | # define ide_ack_intr(hwif) (1) |
@@ -224,8 +264,6 @@ static inline void ide_std_init_ports(hw_regs_t *hw, | |||
224 | * set_geometry : respecify drive geometry | 264 | * set_geometry : respecify drive geometry |
225 | * recalibrate : seek to cyl 0 | 265 | * recalibrate : seek to cyl 0 |
226 | * set_multmode : set multmode count | 266 | * set_multmode : set multmode count |
227 | * set_tune : tune interface for drive | ||
228 | * serviced : service command | ||
229 | * reserved : unused | 267 | * reserved : unused |
230 | */ | 268 | */ |
231 | typedef union { | 269 | typedef union { |
@@ -234,43 +272,11 @@ typedef union { | |||
234 | unsigned set_geometry : 1; | 272 | unsigned set_geometry : 1; |
235 | unsigned recalibrate : 1; | 273 | unsigned recalibrate : 1; |
236 | unsigned set_multmode : 1; | 274 | unsigned set_multmode : 1; |
237 | unsigned set_tune : 1; | 275 | unsigned reserved : 5; |
238 | unsigned serviced : 1; | ||
239 | unsigned reserved : 3; | ||
240 | } b; | 276 | } b; |
241 | } special_t; | 277 | } special_t; |
242 | 278 | ||
243 | /* | 279 | /* |
244 | * ATA-IDE Select Register, aka Device-Head | ||
245 | * | ||
246 | * head : always zeros here | ||
247 | * unit : drive select number: 0/1 | ||
248 | * bit5 : always 1 | ||
249 | * lba : using LBA instead of CHS | ||
250 | * bit7 : always 1 | ||
251 | */ | ||
252 | typedef union { | ||
253 | unsigned all : 8; | ||
254 | struct { | ||
255 | #if defined(__LITTLE_ENDIAN_BITFIELD) | ||
256 | unsigned head : 4; | ||
257 | unsigned unit : 1; | ||
258 | unsigned bit5 : 1; | ||
259 | unsigned lba : 1; | ||
260 | unsigned bit7 : 1; | ||
261 | #elif defined(__BIG_ENDIAN_BITFIELD) | ||
262 | unsigned bit7 : 1; | ||
263 | unsigned lba : 1; | ||
264 | unsigned bit5 : 1; | ||
265 | unsigned unit : 1; | ||
266 | unsigned head : 4; | ||
267 | #else | ||
268 | #error "Please fix <asm/byteorder.h>" | ||
269 | #endif | ||
270 | } b; | ||
271 | } select_t, ata_select_t; | ||
272 | |||
273 | /* | ||
274 | * Status returned from various ide_ functions | 280 | * Status returned from various ide_ functions |
275 | */ | 281 | */ |
276 | typedef enum { | 282 | typedef enum { |
@@ -278,15 +284,304 @@ typedef enum { | |||
278 | ide_started, /* a drive operation was started, handler was set */ | 284 | ide_started, /* a drive operation was started, handler was set */ |
279 | } ide_startstop_t; | 285 | } ide_startstop_t; |
280 | 286 | ||
287 | enum { | ||
288 | IDE_TFLAG_LBA48 = (1 << 0), | ||
289 | IDE_TFLAG_FLAGGED = (1 << 2), | ||
290 | IDE_TFLAG_OUT_DATA = (1 << 3), | ||
291 | IDE_TFLAG_OUT_HOB_FEATURE = (1 << 4), | ||
292 | IDE_TFLAG_OUT_HOB_NSECT = (1 << 5), | ||
293 | IDE_TFLAG_OUT_HOB_LBAL = (1 << 6), | ||
294 | IDE_TFLAG_OUT_HOB_LBAM = (1 << 7), | ||
295 | IDE_TFLAG_OUT_HOB_LBAH = (1 << 8), | ||
296 | IDE_TFLAG_OUT_HOB = IDE_TFLAG_OUT_HOB_FEATURE | | ||
297 | IDE_TFLAG_OUT_HOB_NSECT | | ||
298 | IDE_TFLAG_OUT_HOB_LBAL | | ||
299 | IDE_TFLAG_OUT_HOB_LBAM | | ||
300 | IDE_TFLAG_OUT_HOB_LBAH, | ||
301 | IDE_TFLAG_OUT_FEATURE = (1 << 9), | ||
302 | IDE_TFLAG_OUT_NSECT = (1 << 10), | ||
303 | IDE_TFLAG_OUT_LBAL = (1 << 11), | ||
304 | IDE_TFLAG_OUT_LBAM = (1 << 12), | ||
305 | IDE_TFLAG_OUT_LBAH = (1 << 13), | ||
306 | IDE_TFLAG_OUT_TF = IDE_TFLAG_OUT_FEATURE | | ||
307 | IDE_TFLAG_OUT_NSECT | | ||
308 | IDE_TFLAG_OUT_LBAL | | ||
309 | IDE_TFLAG_OUT_LBAM | | ||
310 | IDE_TFLAG_OUT_LBAH, | ||
311 | IDE_TFLAG_OUT_DEVICE = (1 << 14), | ||
312 | IDE_TFLAG_WRITE = (1 << 15), | ||
313 | IDE_TFLAG_FLAGGED_SET_IN_FLAGS = (1 << 16), | ||
314 | IDE_TFLAG_IN_DATA = (1 << 17), | ||
315 | IDE_TFLAG_CUSTOM_HANDLER = (1 << 18), | ||
316 | IDE_TFLAG_DMA_PIO_FALLBACK = (1 << 19), | ||
317 | IDE_TFLAG_IN_HOB_FEATURE = (1 << 20), | ||
318 | IDE_TFLAG_IN_HOB_NSECT = (1 << 21), | ||
319 | IDE_TFLAG_IN_HOB_LBAL = (1 << 22), | ||
320 | IDE_TFLAG_IN_HOB_LBAM = (1 << 23), | ||
321 | IDE_TFLAG_IN_HOB_LBAH = (1 << 24), | ||
322 | IDE_TFLAG_IN_HOB_LBA = IDE_TFLAG_IN_HOB_LBAL | | ||
323 | IDE_TFLAG_IN_HOB_LBAM | | ||
324 | IDE_TFLAG_IN_HOB_LBAH, | ||
325 | IDE_TFLAG_IN_HOB = IDE_TFLAG_IN_HOB_FEATURE | | ||
326 | IDE_TFLAG_IN_HOB_NSECT | | ||
327 | IDE_TFLAG_IN_HOB_LBA, | ||
328 | IDE_TFLAG_IN_FEATURE = (1 << 1), | ||
329 | IDE_TFLAG_IN_NSECT = (1 << 25), | ||
330 | IDE_TFLAG_IN_LBAL = (1 << 26), | ||
331 | IDE_TFLAG_IN_LBAM = (1 << 27), | ||
332 | IDE_TFLAG_IN_LBAH = (1 << 28), | ||
333 | IDE_TFLAG_IN_LBA = IDE_TFLAG_IN_LBAL | | ||
334 | IDE_TFLAG_IN_LBAM | | ||
335 | IDE_TFLAG_IN_LBAH, | ||
336 | IDE_TFLAG_IN_TF = IDE_TFLAG_IN_NSECT | | ||
337 | IDE_TFLAG_IN_LBA, | ||
338 | IDE_TFLAG_IN_DEVICE = (1 << 29), | ||
339 | IDE_TFLAG_HOB = IDE_TFLAG_OUT_HOB | | ||
340 | IDE_TFLAG_IN_HOB, | ||
341 | IDE_TFLAG_TF = IDE_TFLAG_OUT_TF | | ||
342 | IDE_TFLAG_IN_TF, | ||
343 | IDE_TFLAG_DEVICE = IDE_TFLAG_OUT_DEVICE | | ||
344 | IDE_TFLAG_IN_DEVICE, | ||
345 | /* force 16-bit I/O operations */ | ||
346 | IDE_TFLAG_IO_16BIT = (1 << 30), | ||
347 | /* ide_task_t was allocated using kmalloc() */ | ||
348 | IDE_TFLAG_DYN = (1 << 31), | ||
349 | }; | ||
350 | |||
351 | struct ide_taskfile { | ||
352 | u8 hob_data; /* 0: high data byte (for TASKFILE IOCTL) */ | ||
353 | |||
354 | u8 hob_feature; /* 1-5: additional data to support LBA48 */ | ||
355 | u8 hob_nsect; | ||
356 | u8 hob_lbal; | ||
357 | u8 hob_lbam; | ||
358 | u8 hob_lbah; | ||
359 | |||
360 | u8 data; /* 6: low data byte (for TASKFILE IOCTL) */ | ||
361 | |||
362 | union { /* Â 7: */ | ||
363 | u8 error; /* read: error */ | ||
364 | u8 feature; /* write: feature */ | ||
365 | }; | ||
366 | |||
367 | u8 nsect; /* 8: number of sectors */ | ||
368 | u8 lbal; /* 9: LBA low */ | ||
369 | u8 lbam; /* 10: LBA mid */ | ||
370 | u8 lbah; /* 11: LBA high */ | ||
371 | |||
372 | u8 device; /* 12: device select */ | ||
373 | |||
374 | union { /* 13: */ | ||
375 | u8 status; /*  read: status  */ | ||
376 | u8 command; /* write: command */ | ||
377 | }; | ||
378 | }; | ||
379 | |||
380 | typedef struct ide_task_s { | ||
381 | union { | ||
382 | struct ide_taskfile tf; | ||
383 | u8 tf_array[14]; | ||
384 | }; | ||
385 | u32 tf_flags; | ||
386 | int data_phase; | ||
387 | struct request *rq; /* copy of request */ | ||
388 | void *special; /* valid_t generally */ | ||
389 | } ide_task_t; | ||
390 | |||
391 | /* ATAPI packet command flags */ | ||
392 | enum { | ||
393 | /* set when an error is considered normal - no retry (ide-tape) */ | ||
394 | PC_FLAG_ABORT = (1 << 0), | ||
395 | PC_FLAG_SUPPRESS_ERROR = (1 << 1), | ||
396 | PC_FLAG_WAIT_FOR_DSC = (1 << 2), | ||
397 | PC_FLAG_DMA_OK = (1 << 3), | ||
398 | PC_FLAG_DMA_IN_PROGRESS = (1 << 4), | ||
399 | PC_FLAG_DMA_ERROR = (1 << 5), | ||
400 | PC_FLAG_WRITING = (1 << 6), | ||
401 | /* command timed out */ | ||
402 | PC_FLAG_TIMEDOUT = (1 << 7), | ||
403 | }; | ||
404 | |||
405 | /* | ||
406 | * With each packet command, we allocate a buffer of IDE_PC_BUFFER_SIZE bytes. | ||
407 | * This is used for several packet commands (not for READ/WRITE commands). | ||
408 | */ | ||
409 | #define IDE_PC_BUFFER_SIZE 256 | ||
410 | |||
411 | struct ide_atapi_pc { | ||
412 | /* actual packet bytes */ | ||
413 | u8 c[12]; | ||
414 | /* incremented on each retry */ | ||
415 | int retries; | ||
416 | int error; | ||
417 | |||
418 | /* bytes to transfer */ | ||
419 | int req_xfer; | ||
420 | /* bytes actually transferred */ | ||
421 | int xferred; | ||
422 | |||
423 | /* data buffer */ | ||
424 | u8 *buf; | ||
425 | /* current buffer position */ | ||
426 | u8 *cur_pos; | ||
427 | int buf_size; | ||
428 | /* missing/available data on the current buffer */ | ||
429 | int b_count; | ||
430 | |||
431 | /* the corresponding request */ | ||
432 | struct request *rq; | ||
433 | |||
434 | unsigned long flags; | ||
435 | |||
436 | /* | ||
437 | * those are more or less driver-specific and some of them are subject | ||
438 | * to change/removal later. | ||
439 | */ | ||
440 | u8 pc_buf[IDE_PC_BUFFER_SIZE]; | ||
441 | |||
442 | /* idetape only */ | ||
443 | struct idetape_bh *bh; | ||
444 | char *b_data; | ||
445 | |||
446 | /* idescsi only for now */ | ||
447 | struct scatterlist *sg; | ||
448 | unsigned int sg_cnt; | ||
449 | |||
450 | struct scsi_cmnd *scsi_cmd; | ||
451 | void (*done) (struct scsi_cmnd *); | ||
452 | |||
453 | unsigned long timeout; | ||
454 | }; | ||
455 | |||
456 | struct ide_devset; | ||
281 | struct ide_driver_s; | 457 | struct ide_driver_s; |
282 | struct ide_settings_s; | ||
283 | 458 | ||
284 | #ifdef CONFIG_BLK_DEV_IDEACPI | 459 | #ifdef CONFIG_BLK_DEV_IDEACPI |
285 | struct ide_acpi_drive_link; | 460 | struct ide_acpi_drive_link; |
286 | struct ide_acpi_hwif_link; | 461 | struct ide_acpi_hwif_link; |
287 | #endif | 462 | #endif |
288 | 463 | ||
289 | typedef struct ide_drive_s { | 464 | /* ATAPI device flags */ |
465 | enum { | ||
466 | IDE_AFLAG_DRQ_INTERRUPT = (1 << 0), | ||
467 | IDE_AFLAG_MEDIA_CHANGED = (1 << 1), | ||
468 | /* Drive cannot lock the door. */ | ||
469 | IDE_AFLAG_NO_DOORLOCK = (1 << 2), | ||
470 | |||
471 | /* ide-cd */ | ||
472 | /* Drive cannot eject the disc. */ | ||
473 | IDE_AFLAG_NO_EJECT = (1 << 3), | ||
474 | /* Drive is a pre ATAPI 1.2 drive. */ | ||
475 | IDE_AFLAG_PRE_ATAPI12 = (1 << 4), | ||
476 | /* TOC addresses are in BCD. */ | ||
477 | IDE_AFLAG_TOCADDR_AS_BCD = (1 << 5), | ||
478 | /* TOC track numbers are in BCD. */ | ||
479 | IDE_AFLAG_TOCTRACKS_AS_BCD = (1 << 6), | ||
480 | /* | ||
481 | * Drive does not provide data in multiples of SECTOR_SIZE | ||
482 | * when more than one interrupt is needed. | ||
483 | */ | ||
484 | IDE_AFLAG_LIMIT_NFRAMES = (1 << 7), | ||
485 | /* Seeking in progress. */ | ||
486 | IDE_AFLAG_SEEKING = (1 << 8), | ||
487 | /* Saved TOC information is current. */ | ||
488 | IDE_AFLAG_TOC_VALID = (1 << 9), | ||
489 | /* We think that the drive door is locked. */ | ||
490 | IDE_AFLAG_DOOR_LOCKED = (1 << 10), | ||
491 | /* SET_CD_SPEED command is unsupported. */ | ||
492 | IDE_AFLAG_NO_SPEED_SELECT = (1 << 11), | ||
493 | IDE_AFLAG_VERTOS_300_SSD = (1 << 12), | ||
494 | IDE_AFLAG_VERTOS_600_ESD = (1 << 13), | ||
495 | IDE_AFLAG_SANYO_3CD = (1 << 14), | ||
496 | IDE_AFLAG_FULL_CAPS_PAGE = (1 << 15), | ||
497 | IDE_AFLAG_PLAY_AUDIO_OK = (1 << 16), | ||
498 | IDE_AFLAG_LE_SPEED_FIELDS = (1 << 17), | ||
499 | |||
500 | /* ide-floppy */ | ||
501 | /* Format in progress */ | ||
502 | IDE_AFLAG_FORMAT_IN_PROGRESS = (1 << 18), | ||
503 | /* Avoid commands not supported in Clik drive */ | ||
504 | IDE_AFLAG_CLIK_DRIVE = (1 << 19), | ||
505 | /* Requires BH algorithm for packets */ | ||
506 | IDE_AFLAG_ZIP_DRIVE = (1 << 20), | ||
507 | /* Write protect */ | ||
508 | IDE_AFLAG_WP = (1 << 21), | ||
509 | /* Supports format progress report */ | ||
510 | IDE_AFLAG_SRFP = (1 << 22), | ||
511 | |||
512 | /* ide-tape */ | ||
513 | IDE_AFLAG_IGNORE_DSC = (1 << 23), | ||
514 | /* 0 When the tape position is unknown */ | ||
515 | IDE_AFLAG_ADDRESS_VALID = (1 << 24), | ||
516 | /* Device already opened */ | ||
517 | IDE_AFLAG_BUSY = (1 << 25), | ||
518 | /* Attempt to auto-detect the current user block size */ | ||
519 | IDE_AFLAG_DETECT_BS = (1 << 26), | ||
520 | /* Currently on a filemark */ | ||
521 | IDE_AFLAG_FILEMARK = (1 << 27), | ||
522 | /* 0 = no tape is loaded, so we don't rewind after ejecting */ | ||
523 | IDE_AFLAG_MEDIUM_PRESENT = (1 << 28), | ||
524 | |||
525 | IDE_AFLAG_NO_AUTOCLOSE = (1 << 29), | ||
526 | }; | ||
527 | |||
528 | /* device flags */ | ||
529 | enum { | ||
530 | /* restore settings after device reset */ | ||
531 | IDE_DFLAG_KEEP_SETTINGS = (1 << 0), | ||
532 | /* device is using DMA for read/write */ | ||
533 | IDE_DFLAG_USING_DMA = (1 << 1), | ||
534 | /* okay to unmask other IRQs */ | ||
535 | IDE_DFLAG_UNMASK = (1 << 2), | ||
536 | /* don't attempt flushes */ | ||
537 | IDE_DFLAG_NOFLUSH = (1 << 3), | ||
538 | /* DSC overlap */ | ||
539 | IDE_DFLAG_DSC_OVERLAP = (1 << 4), | ||
540 | /* give potential excess bandwidth */ | ||
541 | IDE_DFLAG_NICE1 = (1 << 5), | ||
542 | /* device is physically present */ | ||
543 | IDE_DFLAG_PRESENT = (1 << 6), | ||
544 | /* device ejected hint */ | ||
545 | IDE_DFLAG_DEAD = (1 << 7), | ||
546 | /* id read from device (synthetic if not set) */ | ||
547 | IDE_DFLAG_ID_READ = (1 << 8), | ||
548 | IDE_DFLAG_NOPROBE = (1 << 9), | ||
549 | /* need to do check_media_change() */ | ||
550 | IDE_DFLAG_REMOVABLE = (1 << 10), | ||
551 | /* needed for removable devices */ | ||
552 | IDE_DFLAG_ATTACH = (1 << 11), | ||
553 | IDE_DFLAG_FORCED_GEOM = (1 << 12), | ||
554 | /* disallow setting unmask bit */ | ||
555 | IDE_DFLAG_NO_UNMASK = (1 << 13), | ||
556 | /* disallow enabling 32-bit I/O */ | ||
557 | IDE_DFLAG_NO_IO_32BIT = (1 << 14), | ||
558 | /* for removable only: door lock/unlock works */ | ||
559 | IDE_DFLAG_DOORLOCKING = (1 << 15), | ||
560 | /* disallow DMA */ | ||
561 | IDE_DFLAG_NODMA = (1 << 16), | ||
562 | /* powermanagment told us not to do anything, so sleep nicely */ | ||
563 | IDE_DFLAG_BLOCKED = (1 << 17), | ||
564 | /* ide-scsi emulation */ | ||
565 | IDE_DFLAG_SCSI = (1 << 18), | ||
566 | /* sleeping & sleep field valid */ | ||
567 | IDE_DFLAG_SLEEPING = (1 << 19), | ||
568 | IDE_DFLAG_POST_RESET = (1 << 20), | ||
569 | IDE_DFLAG_UDMA33_WARNED = (1 << 21), | ||
570 | IDE_DFLAG_LBA48 = (1 << 22), | ||
571 | /* status of write cache */ | ||
572 | IDE_DFLAG_WCACHE = (1 << 23), | ||
573 | /* used for ignoring ATA_DF */ | ||
574 | IDE_DFLAG_NOWERR = (1 << 24), | ||
575 | /* retrying in PIO */ | ||
576 | IDE_DFLAG_DMA_PIO_RETRY = (1 << 25), | ||
577 | IDE_DFLAG_LBA = (1 << 26), | ||
578 | /* don't unload heads */ | ||
579 | IDE_DFLAG_NO_UNLOAD = (1 << 27), | ||
580 | /* heads unloaded, please don't reset port */ | ||
581 | IDE_DFLAG_PARKED = (1 << 28) | ||
582 | }; | ||
583 | |||
584 | struct ide_drive_s { | ||
290 | char name[4]; /* drive name, such as "hda" */ | 585 | char name[4]; /* drive name, such as "hda" */ |
291 | char driver_req[10]; /* requests specific driver */ | 586 | char driver_req[10]; /* requests specific driver */ |
292 | 587 | ||
@@ -295,74 +590,47 @@ typedef struct ide_drive_s { | |||
295 | struct request *rq; /* current request */ | 590 | struct request *rq; /* current request */ |
296 | struct ide_drive_s *next; /* circular list of hwgroup drives */ | 591 | struct ide_drive_s *next; /* circular list of hwgroup drives */ |
297 | void *driver_data; /* extra driver data */ | 592 | void *driver_data; /* extra driver data */ |
298 | struct hd_driveid *id; /* drive model identification info */ | 593 | u16 *id; /* identification info */ |
299 | #ifdef CONFIG_IDE_PROC_FS | 594 | #ifdef CONFIG_IDE_PROC_FS |
300 | struct proc_dir_entry *proc; /* /proc/ide/ directory entry */ | 595 | struct proc_dir_entry *proc; /* /proc/ide/ directory entry */ |
301 | struct ide_settings_s *settings;/* /proc/ide/ drive settings */ | 596 | const struct ide_proc_devset *settings; /* /proc/ide/ drive settings */ |
302 | #endif | 597 | #endif |
303 | struct hwif_s *hwif; /* actually (ide_hwif_t *) */ | 598 | struct hwif_s *hwif; /* actually (ide_hwif_t *) */ |
304 | 599 | ||
600 | unsigned long dev_flags; | ||
601 | |||
305 | unsigned long sleep; /* sleep until this time */ | 602 | unsigned long sleep; /* sleep until this time */ |
306 | unsigned long service_start; /* time we started last request */ | 603 | unsigned long service_start; /* time we started last request */ |
307 | unsigned long service_time; /* service time of last request */ | 604 | unsigned long service_time; /* service time of last request */ |
308 | unsigned long timeout; /* max time to wait for irq */ | 605 | unsigned long timeout; /* max time to wait for irq */ |
309 | 606 | ||
310 | special_t special; /* special action flags */ | 607 | special_t special; /* special action flags */ |
311 | select_t select; /* basic drive/head select reg value */ | ||
312 | 608 | ||
313 | u8 keep_settings; /* restore settings after drive reset */ | 609 | u8 select; /* basic drive/head select reg value */ |
314 | u8 using_dma; /* disk is using dma for read/write */ | ||
315 | u8 retry_pio; /* retrying dma capable host in pio */ | 610 | u8 retry_pio; /* retrying dma capable host in pio */ |
316 | u8 state; /* retry state */ | ||
317 | u8 waiting_for_dma; /* dma currently in progress */ | 611 | u8 waiting_for_dma; /* dma currently in progress */ |
318 | u8 unmask; /* okay to unmask other irqs */ | 612 | u8 dma; /* atapi dma flag */ |
319 | u8 noflush; /* don't attempt flushes */ | 613 | |
320 | u8 dsc_overlap; /* DSC overlap */ | ||
321 | u8 nice1; /* give potential excess bandwidth */ | ||
322 | |||
323 | unsigned present : 1; /* drive is physically present */ | ||
324 | unsigned dead : 1; /* device ejected hint */ | ||
325 | unsigned id_read : 1; /* 1=id read from disk 0 = synthetic */ | ||
326 | unsigned noprobe : 1; /* from: hdx=noprobe */ | ||
327 | unsigned removable : 1; /* 1 if need to do check_media_change */ | ||
328 | unsigned attach : 1; /* needed for removable devices */ | ||
329 | unsigned forced_geom : 1; /* 1 if hdx=c,h,s was given at boot */ | ||
330 | unsigned no_unmask : 1; /* disallow setting unmask bit */ | ||
331 | unsigned no_io_32bit : 1; /* disallow enabling 32bit I/O */ | ||
332 | unsigned atapi_overlap : 1; /* ATAPI overlap (not supported) */ | ||
333 | unsigned doorlocking : 1; /* for removable only: door lock/unlock works */ | ||
334 | unsigned nodma : 1; /* disallow DMA */ | ||
335 | unsigned remap_0_to_1 : 1; /* 0=noremap, 1=remap 0->1 (for EZDrive) */ | ||
336 | unsigned blocked : 1; /* 1=powermanagment told us not to do anything, so sleep nicely */ | ||
337 | unsigned vdma : 1; /* 1=doing PIO over DMA 0=doing normal DMA */ | ||
338 | unsigned scsi : 1; /* 0=default, 1=ide-scsi emulation */ | ||
339 | unsigned sleeping : 1; /* 1=sleeping & sleep field valid */ | ||
340 | unsigned post_reset : 1; | ||
341 | unsigned udma33_warned : 1; | ||
342 | |||
343 | u8 addressing; /* 0=28-bit, 1=48-bit, 2=48-bit doing 28-bit */ | ||
344 | u8 quirk_list; /* considered quirky, set for a specific host */ | 614 | u8 quirk_list; /* considered quirky, set for a specific host */ |
345 | u8 init_speed; /* transfer rate set at boot */ | 615 | u8 init_speed; /* transfer rate set at boot */ |
346 | u8 current_speed; /* current transfer rate set */ | 616 | u8 current_speed; /* current transfer rate set */ |
347 | u8 desired_speed; /* desired transfer rate set */ | 617 | u8 desired_speed; /* desired transfer rate set */ |
348 | u8 dn; /* now wide spread use */ | 618 | u8 dn; /* now wide spread use */ |
349 | u8 wcache; /* status of write cache */ | ||
350 | u8 acoustic; /* acoustic management */ | 619 | u8 acoustic; /* acoustic management */ |
351 | u8 media; /* disk, cdrom, tape, floppy, ... */ | 620 | u8 media; /* disk, cdrom, tape, floppy, ... */ |
352 | u8 ctl; /* "normal" value for Control register */ | ||
353 | u8 ready_stat; /* min status value for drive ready */ | 621 | u8 ready_stat; /* min status value for drive ready */ |
354 | u8 mult_count; /* current multiple sector setting */ | 622 | u8 mult_count; /* current multiple sector setting */ |
355 | u8 mult_req; /* requested multiple sector setting */ | 623 | u8 mult_req; /* requested multiple sector setting */ |
356 | u8 tune_req; /* requested drive tuning setting */ | ||
357 | u8 io_32bit; /* 0=16-bit, 1=32-bit, 2/3=32bit+sync */ | 624 | u8 io_32bit; /* 0=16-bit, 1=32-bit, 2/3=32bit+sync */ |
358 | u8 bad_wstat; /* used for ignoring WRERR_STAT */ | 625 | u8 bad_wstat; /* used for ignoring ATA_DF */ |
359 | u8 nowerr; /* used for ignoring WRERR_STAT */ | ||
360 | u8 sect0; /* offset of first sector for DM6:DDO */ | ||
361 | u8 head; /* "real" number of heads */ | 626 | u8 head; /* "real" number of heads */ |
362 | u8 sect; /* "real" sectors per track */ | 627 | u8 sect; /* "real" sectors per track */ |
363 | u8 bios_head; /* BIOS/fdisk/LILO number of heads */ | 628 | u8 bios_head; /* BIOS/fdisk/LILO number of heads */ |
364 | u8 bios_sect; /* BIOS/fdisk/LILO sectors per track */ | 629 | u8 bios_sect; /* BIOS/fdisk/LILO sectors per track */ |
365 | 630 | ||
631 | /* delay this long before sending packet command */ | ||
632 | u8 pc_delay; | ||
633 | |||
366 | unsigned int bios_cyl; /* BIOS/fdisk/LILO number of cyls */ | 634 | unsigned int bios_cyl; /* BIOS/fdisk/LILO number of cyls */ |
367 | unsigned int cyl; /* "real" number of cyls */ | 635 | unsigned int cyl; /* "real" number of cyls */ |
368 | unsigned int drive_data; /* used by set_pio_mode/selectproc */ | 636 | unsigned int drive_data; /* used by set_pio_mode/selectproc */ |
@@ -374,41 +642,93 @@ typedef struct ide_drive_s { | |||
374 | 642 | ||
375 | int lun; /* logical unit */ | 643 | int lun; /* logical unit */ |
376 | int crc_count; /* crc counter to reduce drive speed */ | 644 | int crc_count; /* crc counter to reduce drive speed */ |
645 | |||
646 | unsigned long debug_mask; /* debugging levels switch */ | ||
647 | |||
377 | #ifdef CONFIG_BLK_DEV_IDEACPI | 648 | #ifdef CONFIG_BLK_DEV_IDEACPI |
378 | struct ide_acpi_drive_link *acpidata; | 649 | struct ide_acpi_drive_link *acpidata; |
379 | #endif | 650 | #endif |
380 | struct list_head list; | 651 | struct list_head list; |
381 | struct device gendev; | 652 | struct device gendev; |
382 | struct completion gendev_rel_comp; /* to deal with device release() */ | 653 | struct completion gendev_rel_comp; /* to deal with device release() */ |
383 | } ide_drive_t; | ||
384 | 654 | ||
385 | #define to_ide_device(dev)container_of(dev, ide_drive_t, gendev) | 655 | /* current packet command */ |
656 | struct ide_atapi_pc *pc; | ||
657 | |||
658 | /* callback for packet commands */ | ||
659 | void (*pc_callback)(struct ide_drive_s *, int); | ||
386 | 660 | ||
387 | #define IDE_CHIPSET_PCI_MASK \ | 661 | void (*pc_update_buffers)(struct ide_drive_s *, struct ide_atapi_pc *); |
388 | ((1<<ide_pci)|(1<<ide_cmd646)|(1<<ide_ali14xx)) | 662 | int (*pc_io_buffers)(struct ide_drive_s *, struct ide_atapi_pc *, |
389 | #define IDE_CHIPSET_IS_PCI(c) ((IDE_CHIPSET_PCI_MASK >> (c)) & 1) | 663 | unsigned int, int); |
664 | |||
665 | unsigned long atapi_flags; | ||
666 | |||
667 | struct ide_atapi_pc request_sense_pc; | ||
668 | struct request request_sense_rq; | ||
669 | }; | ||
670 | |||
671 | typedef struct ide_drive_s ide_drive_t; | ||
672 | |||
673 | #define to_ide_device(dev) container_of(dev, ide_drive_t, gendev) | ||
674 | |||
675 | #define to_ide_drv(obj, cont_type) \ | ||
676 | container_of(obj, struct cont_type, kref) | ||
677 | |||
678 | #define ide_drv_g(disk, cont_type) \ | ||
679 | container_of((disk)->private_data, struct cont_type, driver) | ||
390 | 680 | ||
391 | struct ide_port_info; | 681 | struct ide_port_info; |
392 | 682 | ||
683 | struct ide_tp_ops { | ||
684 | void (*exec_command)(struct hwif_s *, u8); | ||
685 | u8 (*read_status)(struct hwif_s *); | ||
686 | u8 (*read_altstatus)(struct hwif_s *); | ||
687 | u8 (*read_sff_dma_status)(struct hwif_s *); | ||
688 | |||
689 | void (*set_irq)(struct hwif_s *, int); | ||
690 | |||
691 | void (*tf_load)(ide_drive_t *, struct ide_task_s *); | ||
692 | void (*tf_read)(ide_drive_t *, struct ide_task_s *); | ||
693 | |||
694 | void (*input_data)(ide_drive_t *, struct request *, void *, | ||
695 | unsigned int); | ||
696 | void (*output_data)(ide_drive_t *, struct request *, void *, | ||
697 | unsigned int); | ||
698 | }; | ||
699 | |||
700 | extern const struct ide_tp_ops default_tp_ops; | ||
701 | |||
702 | /** | ||
703 | * struct ide_port_ops - IDE port operations | ||
704 | * | ||
705 | * @init_dev: host specific initialization of a device | ||
706 | * @set_pio_mode: routine to program host for PIO mode | ||
707 | * @set_dma_mode: routine to program host for DMA mode | ||
708 | * @selectproc: tweaks hardware to select drive | ||
709 | * @reset_poll: chipset polling based on hba specifics | ||
710 | * @pre_reset: chipset specific changes to default for device-hba resets | ||
711 | * @resetproc: routine to reset controller after a disk reset | ||
712 | * @maskproc: special host masking for drive selection | ||
713 | * @quirkproc: check host's drive quirk list | ||
714 | * @clear_irq: clear IRQ | ||
715 | * | ||
716 | * @mdma_filter: filter MDMA modes | ||
717 | * @udma_filter: filter UDMA modes | ||
718 | * | ||
719 | * @cable_detect: detect cable type | ||
720 | */ | ||
393 | struct ide_port_ops { | 721 | struct ide_port_ops { |
394 | /* host specific initialization of devices on a port */ | 722 | void (*init_dev)(ide_drive_t *); |
395 | void (*port_init_devs)(struct hwif_s *); | ||
396 | /* routine to program host for PIO mode */ | ||
397 | void (*set_pio_mode)(ide_drive_t *, const u8); | 723 | void (*set_pio_mode)(ide_drive_t *, const u8); |
398 | /* routine to program host for DMA mode */ | ||
399 | void (*set_dma_mode)(ide_drive_t *, const u8); | 724 | void (*set_dma_mode)(ide_drive_t *, const u8); |
400 | /* tweaks hardware to select drive */ | ||
401 | void (*selectproc)(ide_drive_t *); | 725 | void (*selectproc)(ide_drive_t *); |
402 | /* chipset polling based on hba specifics */ | ||
403 | int (*reset_poll)(ide_drive_t *); | 726 | int (*reset_poll)(ide_drive_t *); |
404 | /* chipset specific changes to default for device-hba resets */ | ||
405 | void (*pre_reset)(ide_drive_t *); | 727 | void (*pre_reset)(ide_drive_t *); |
406 | /* routine to reset controller after a disk reset */ | ||
407 | void (*resetproc)(ide_drive_t *); | 728 | void (*resetproc)(ide_drive_t *); |
408 | /* special host masking for drive selection */ | ||
409 | void (*maskproc)(ide_drive_t *, int); | 729 | void (*maskproc)(ide_drive_t *, int); |
410 | /* check host's drive quirk list */ | ||
411 | void (*quirkproc)(ide_drive_t *); | 730 | void (*quirkproc)(ide_drive_t *); |
731 | void (*clear_irq)(ide_drive_t *); | ||
412 | 732 | ||
413 | u8 (*mdma_filter)(ide_drive_t *); | 733 | u8 (*mdma_filter)(ide_drive_t *); |
414 | u8 (*udma_filter)(ide_drive_t *); | 734 | u8 (*udma_filter)(ide_drive_t *); |
@@ -427,7 +747,7 @@ struct ide_dma_ops { | |||
427 | void (*dma_timeout)(struct ide_drive_s *); | 747 | void (*dma_timeout)(struct ide_drive_s *); |
428 | }; | 748 | }; |
429 | 749 | ||
430 | struct ide_task_s; | 750 | struct ide_host; |
431 | 751 | ||
432 | typedef struct hwif_s { | 752 | typedef struct hwif_s { |
433 | struct hwif_s *next; /* for linked-list in ide_hwgroup_t */ | 753 | struct hwif_s *next; /* for linked-list in ide_hwgroup_t */ |
@@ -435,6 +755,8 @@ typedef struct hwif_s { | |||
435 | struct hwgroup_s *hwgroup; /* actually (ide_hwgroup_t *) */ | 755 | struct hwgroup_s *hwgroup; /* actually (ide_hwgroup_t *) */ |
436 | struct proc_dir_entry *proc; /* /proc/ide/ directory entry */ | 756 | struct proc_dir_entry *proc; /* /proc/ide/ directory entry */ |
437 | 757 | ||
758 | struct ide_host *host; | ||
759 | |||
438 | char name[6]; /* name of interface, eg. "ide0" */ | 760 | char name[6]; /* name of interface, eg. "ide0" */ |
439 | 761 | ||
440 | struct ide_io_ports io_ports; | 762 | struct ide_io_ports io_ports; |
@@ -446,7 +768,6 @@ typedef struct hwif_s { | |||
446 | u8 major; /* our major number */ | 768 | u8 major; /* our major number */ |
447 | u8 index; /* 0 for ide0; 1 for ide1; ... */ | 769 | u8 index; /* 0 for ide0; 1 for ide1; ... */ |
448 | u8 channel; /* for dual-port chips: 0=primary, 1=secondary */ | 770 | u8 channel; /* for dual-port chips: 0=primary, 1=secondary */ |
449 | u8 bus_state; /* power state of the IDE bus */ | ||
450 | 771 | ||
451 | u32 host_flags; | 772 | u32 host_flags; |
452 | 773 | ||
@@ -466,26 +787,20 @@ typedef struct hwif_s { | |||
466 | 787 | ||
467 | void (*rw_disk)(ide_drive_t *, struct request *); | 788 | void (*rw_disk)(ide_drive_t *, struct request *); |
468 | 789 | ||
790 | const struct ide_tp_ops *tp_ops; | ||
469 | const struct ide_port_ops *port_ops; | 791 | const struct ide_port_ops *port_ops; |
470 | const struct ide_dma_ops *dma_ops; | 792 | const struct ide_dma_ops *dma_ops; |
471 | 793 | ||
472 | void (*tf_load)(ide_drive_t *, struct ide_task_s *); | ||
473 | void (*tf_read)(ide_drive_t *, struct ide_task_s *); | ||
474 | |||
475 | void (*input_data)(ide_drive_t *, struct request *, void *, unsigned); | ||
476 | void (*output_data)(ide_drive_t *, struct request *, void *, unsigned); | ||
477 | |||
478 | void (*ide_dma_clear_irq)(ide_drive_t *drive); | ||
479 | |||
480 | void (*OUTB)(u8 addr, unsigned long port); | ||
481 | void (*OUTBSYNC)(ide_drive_t *drive, u8 addr, unsigned long port); | ||
482 | |||
483 | u8 (*INB)(unsigned long port); | ||
484 | |||
485 | /* dma physical region descriptor table (cpu view) */ | 794 | /* dma physical region descriptor table (cpu view) */ |
486 | unsigned int *dmatable_cpu; | 795 | unsigned int *dmatable_cpu; |
487 | /* dma physical region descriptor table (dma view) */ | 796 | /* dma physical region descriptor table (dma view) */ |
488 | dma_addr_t dmatable_dma; | 797 | dma_addr_t dmatable_dma; |
798 | |||
799 | /* maximum number of PRD table entries */ | ||
800 | int prd_max_nents; | ||
801 | /* PRD entry size in bytes */ | ||
802 | int prd_ent_size; | ||
803 | |||
489 | /* Scatter-gather list used to build the above */ | 804 | /* Scatter-gather list used to build the above */ |
490 | struct scatterlist *sg_table; | 805 | struct scatterlist *sg_table; |
491 | int sg_max_nents; /* Maximum number of entries in it */ | 806 | int sg_max_nents; /* Maximum number of entries in it */ |
@@ -495,6 +810,8 @@ typedef struct hwif_s { | |||
495 | /* data phase of the active command (currently only valid for PIO/DMA) */ | 810 | /* data phase of the active command (currently only valid for PIO/DMA) */ |
496 | int data_phase; | 811 | int data_phase; |
497 | 812 | ||
813 | struct ide_task_s task; /* current command */ | ||
814 | |||
498 | unsigned int nsect; | 815 | unsigned int nsect; |
499 | unsigned int nleft; | 816 | unsigned int nleft; |
500 | struct scatterlist *cursg; | 817 | struct scatterlist *cursg; |
@@ -504,8 +821,6 @@ typedef struct hwif_s { | |||
504 | int irq; /* our irq number */ | 821 | int irq; /* our irq number */ |
505 | 822 | ||
506 | unsigned long dma_base; /* base addr for dma ports */ | 823 | unsigned long dma_base; /* base addr for dma ports */ |
507 | unsigned long dma_command; /* dma command register */ | ||
508 | unsigned long dma_status; /* dma status register */ | ||
509 | 824 | ||
510 | unsigned long config_data; /* for use by chipset-specific code */ | 825 | unsigned long config_data; /* for use by chipset-specific code */ |
511 | unsigned long select_data; /* for use by chipset-specific code */ | 826 | unsigned long select_data; /* for use by chipset-specific code */ |
@@ -517,7 +832,6 @@ typedef struct hwif_s { | |||
517 | unsigned serialized : 1; /* serialized all channel operation */ | 832 | unsigned serialized : 1; /* serialized all channel operation */ |
518 | unsigned sharing_irq: 1; /* 1 = sharing irq with another hwif */ | 833 | unsigned sharing_irq: 1; /* 1 = sharing irq with another hwif */ |
519 | unsigned sg_mapped : 1; /* sg_table and sg_nents are ready */ | 834 | unsigned sg_mapped : 1; /* sg_table and sg_nents are ready */ |
520 | unsigned mmio : 1; /* host uses MMIO */ | ||
521 | 835 | ||
522 | struct device gendev; | 836 | struct device gendev; |
523 | struct device *portdev; | 837 | struct device *portdev; |
@@ -526,13 +840,22 @@ typedef struct hwif_s { | |||
526 | 840 | ||
527 | void *hwif_data; /* extra hwif data */ | 841 | void *hwif_data; /* extra hwif data */ |
528 | 842 | ||
529 | unsigned dma; | ||
530 | |||
531 | #ifdef CONFIG_BLK_DEV_IDEACPI | 843 | #ifdef CONFIG_BLK_DEV_IDEACPI |
532 | struct ide_acpi_hwif_link *acpidata; | 844 | struct ide_acpi_hwif_link *acpidata; |
533 | #endif | 845 | #endif |
534 | } ____cacheline_internodealigned_in_smp ide_hwif_t; | 846 | } ____cacheline_internodealigned_in_smp ide_hwif_t; |
535 | 847 | ||
848 | #define MAX_HOST_PORTS 4 | ||
849 | |||
850 | struct ide_host { | ||
851 | ide_hwif_t *ports[MAX_HOST_PORTS]; | ||
852 | unsigned int n_ports; | ||
853 | struct device *dev[2]; | ||
854 | unsigned int (*init_chipset)(struct pci_dev *); | ||
855 | unsigned long host_flags; | ||
856 | void *host_priv; | ||
857 | }; | ||
858 | |||
536 | /* | 859 | /* |
537 | * internal ide interrupt handler type | 860 | * internal ide interrupt handler type |
538 | */ | 861 | */ |
@@ -552,8 +875,6 @@ typedef struct hwgroup_s { | |||
552 | unsigned int sleeping : 1; | 875 | unsigned int sleeping : 1; |
553 | /* BOOL: polling active & poll_timeout field valid */ | 876 | /* BOOL: polling active & poll_timeout field valid */ |
554 | unsigned int polling : 1; | 877 | unsigned int polling : 1; |
555 | /* BOOL: in a polling reset situation. Must not trigger another reset yet */ | ||
556 | unsigned int resetting : 1; | ||
557 | 878 | ||
558 | /* current drive */ | 879 | /* current drive */ |
559 | ide_drive_t *drive; | 880 | ide_drive_t *drive; |
@@ -578,105 +899,116 @@ typedef struct ide_driver_s ide_driver_t; | |||
578 | 899 | ||
579 | extern struct mutex ide_setting_mtx; | 900 | extern struct mutex ide_setting_mtx; |
580 | 901 | ||
581 | int set_io_32bit(ide_drive_t *, int); | 902 | /* |
582 | int set_pio_mode(ide_drive_t *, int); | 903 | * configurable drive settings |
583 | int set_using_dma(ide_drive_t *, int); | 904 | */ |
584 | 905 | ||
585 | /* ATAPI packet command flags */ | 906 | #define DS_SYNC (1 << 0) |
586 | enum { | 907 | |
587 | /* set when an error is considered normal - no retry (ide-tape) */ | 908 | struct ide_devset { |
588 | PC_FLAG_ABORT = (1 << 0), | 909 | int (*get)(ide_drive_t *); |
589 | PC_FLAG_SUPPRESS_ERROR = (1 << 1), | 910 | int (*set)(ide_drive_t *, int); |
590 | PC_FLAG_WAIT_FOR_DSC = (1 << 2), | 911 | unsigned int flags; |
591 | PC_FLAG_DMA_OK = (1 << 3), | ||
592 | PC_FLAG_DMA_RECOMMENDED = (1 << 4), | ||
593 | PC_FLAG_DMA_IN_PROGRESS = (1 << 5), | ||
594 | PC_FLAG_DMA_ERROR = (1 << 6), | ||
595 | PC_FLAG_WRITING = (1 << 7), | ||
596 | /* command timed out */ | ||
597 | PC_FLAG_TIMEDOUT = (1 << 8), | ||
598 | }; | 912 | }; |
599 | 913 | ||
600 | struct ide_atapi_pc { | 914 | #define __DEVSET(_flags, _get, _set) { \ |
601 | /* actual packet bytes */ | 915 | .flags = _flags, \ |
602 | u8 c[12]; | 916 | .get = _get, \ |
603 | /* incremented on each retry */ | 917 | .set = _set, \ |
604 | int retries; | 918 | } |
605 | int error; | ||
606 | 919 | ||
607 | /* bytes to transfer */ | 920 | #define ide_devset_get(name, field) \ |
608 | int req_xfer; | 921 | static int get_##name(ide_drive_t *drive) \ |
609 | /* bytes actually transferred */ | 922 | { \ |
610 | int xferred; | 923 | return drive->field; \ |
924 | } | ||
611 | 925 | ||
612 | /* data buffer */ | 926 | #define ide_devset_set(name, field) \ |
613 | u8 *buf; | 927 | static int set_##name(ide_drive_t *drive, int arg) \ |
614 | /* current buffer position */ | 928 | { \ |
615 | u8 *cur_pos; | 929 | drive->field = arg; \ |
616 | int buf_size; | 930 | return 0; \ |
617 | /* missing/available data on the current buffer */ | 931 | } |
618 | int b_count; | ||
619 | 932 | ||
620 | /* the corresponding request */ | 933 | #define ide_devset_get_flag(name, flag) \ |
621 | struct request *rq; | 934 | static int get_##name(ide_drive_t *drive) \ |
935 | { \ | ||
936 | return !!(drive->dev_flags & flag); \ | ||
937 | } | ||
622 | 938 | ||
623 | unsigned long flags; | 939 | #define ide_devset_set_flag(name, flag) \ |
940 | static int set_##name(ide_drive_t *drive, int arg) \ | ||
941 | { \ | ||
942 | if (arg) \ | ||
943 | drive->dev_flags |= flag; \ | ||
944 | else \ | ||
945 | drive->dev_flags &= ~flag; \ | ||
946 | return 0; \ | ||
947 | } | ||
624 | 948 | ||
625 | /* | 949 | #define __IDE_DEVSET(_name, _flags, _get, _set) \ |
626 | * those are more or less driver-specific and some of them are subject | 950 | const struct ide_devset ide_devset_##_name = \ |
627 | * to change/removal later. | 951 | __DEVSET(_flags, _get, _set) |
628 | */ | ||
629 | u8 pc_buf[256]; | ||
630 | void (*idefloppy_callback) (ide_drive_t *); | ||
631 | ide_startstop_t (*idetape_callback) (ide_drive_t *); | ||
632 | 952 | ||
633 | /* idetape only */ | 953 | #define IDE_DEVSET(_name, _flags, _get, _set) \ |
634 | struct idetape_bh *bh; | 954 | static __IDE_DEVSET(_name, _flags, _get, _set) |
635 | char *b_data; | ||
636 | 955 | ||
637 | /* idescsi only for now */ | 956 | #define ide_devset_rw(_name, _func) \ |
638 | struct scatterlist *sg; | 957 | IDE_DEVSET(_name, 0, get_##_func, set_##_func) |
639 | unsigned int sg_cnt; | ||
640 | 958 | ||
641 | struct scsi_cmnd *scsi_cmd; | 959 | #define ide_devset_w(_name, _func) \ |
642 | void (*done) (struct scsi_cmnd *); | 960 | IDE_DEVSET(_name, 0, NULL, set_##_func) |
643 | 961 | ||
644 | unsigned long timeout; | 962 | #define ide_ext_devset_rw(_name, _func) \ |
645 | }; | 963 | __IDE_DEVSET(_name, 0, get_##_func, set_##_func) |
964 | |||
965 | #define ide_ext_devset_rw_sync(_name, _func) \ | ||
966 | __IDE_DEVSET(_name, DS_SYNC, get_##_func, set_##_func) | ||
967 | |||
968 | #define ide_decl_devset(_name) \ | ||
969 | extern const struct ide_devset ide_devset_##_name | ||
970 | |||
971 | ide_decl_devset(io_32bit); | ||
972 | ide_decl_devset(keepsettings); | ||
973 | ide_decl_devset(pio_mode); | ||
974 | ide_decl_devset(unmaskirq); | ||
975 | ide_decl_devset(using_dma); | ||
646 | 976 | ||
647 | #ifdef CONFIG_IDE_PROC_FS | 977 | #ifdef CONFIG_IDE_PROC_FS |
648 | /* | 978 | /* |
649 | * configurable drive settings | 979 | * /proc/ide interface |
650 | */ | 980 | */ |
651 | 981 | ||
652 | #define TYPE_INT 0 | 982 | #define ide_devset_rw_field(_name, _field) \ |
653 | #define TYPE_BYTE 1 | 983 | ide_devset_get(_name, _field); \ |
654 | #define TYPE_SHORT 2 | 984 | ide_devset_set(_name, _field); \ |
985 | IDE_DEVSET(_name, DS_SYNC, get_##_name, set_##_name) | ||
986 | |||
987 | #define ide_devset_rw_flag(_name, _field) \ | ||
988 | ide_devset_get_flag(_name, _field); \ | ||
989 | ide_devset_set_flag(_name, _field); \ | ||
990 | IDE_DEVSET(_name, DS_SYNC, get_##_name, set_##_name) | ||
991 | |||
992 | struct ide_proc_devset { | ||
993 | const char *name; | ||
994 | const struct ide_devset *setting; | ||
995 | int min, max; | ||
996 | int (*mulf)(ide_drive_t *); | ||
997 | int (*divf)(ide_drive_t *); | ||
998 | }; | ||
655 | 999 | ||
656 | #define SETTING_READ (1 << 0) | 1000 | #define __IDE_PROC_DEVSET(_name, _min, _max, _mulf, _divf) { \ |
657 | #define SETTING_WRITE (1 << 1) | 1001 | .name = __stringify(_name), \ |
658 | #define SETTING_RW (SETTING_READ | SETTING_WRITE) | 1002 | .setting = &ide_devset_##_name, \ |
1003 | .min = _min, \ | ||
1004 | .max = _max, \ | ||
1005 | .mulf = _mulf, \ | ||
1006 | .divf = _divf, \ | ||
1007 | } | ||
659 | 1008 | ||
660 | typedef int (ide_procset_t)(ide_drive_t *, int); | 1009 | #define IDE_PROC_DEVSET(_name, _min, _max) \ |
661 | typedef struct ide_settings_s { | 1010 | __IDE_PROC_DEVSET(_name, _min, _max, NULL, NULL) |
662 | char *name; | ||
663 | int rw; | ||
664 | int data_type; | ||
665 | int min; | ||
666 | int max; | ||
667 | int mul_factor; | ||
668 | int div_factor; | ||
669 | void *data; | ||
670 | ide_procset_t *set; | ||
671 | int auto_remove; | ||
672 | struct ide_settings_s *next; | ||
673 | } ide_settings_t; | ||
674 | |||
675 | int ide_add_setting(ide_drive_t *, const char *, int, int, int, int, int, int, void *, ide_procset_t *set); | ||
676 | 1011 | ||
677 | /* | ||
678 | * /proc/ide interface | ||
679 | */ | ||
680 | typedef struct { | 1012 | typedef struct { |
681 | const char *name; | 1013 | const char *name; |
682 | mode_t mode; | 1014 | mode_t mode; |
@@ -693,8 +1025,6 @@ void ide_proc_unregister_port(ide_hwif_t *); | |||
693 | void ide_proc_register_driver(ide_drive_t *, ide_driver_t *); | 1025 | void ide_proc_register_driver(ide_drive_t *, ide_driver_t *); |
694 | void ide_proc_unregister_driver(ide_drive_t *, ide_driver_t *); | 1026 | void ide_proc_unregister_driver(ide_drive_t *, ide_driver_t *); |
695 | 1027 | ||
696 | void ide_add_generic_settings(ide_drive_t *); | ||
697 | |||
698 | read_proc_t proc_ide_read_capacity; | 1028 | read_proc_t proc_ide_read_capacity; |
699 | read_proc_t proc_ide_read_geometry; | 1029 | read_proc_t proc_ide_read_geometry; |
700 | 1030 | ||
@@ -722,41 +1052,58 @@ static inline void ide_proc_unregister_device(ide_drive_t *drive) { ; } | |||
722 | static inline void ide_proc_unregister_port(ide_hwif_t *hwif) { ; } | 1052 | static inline void ide_proc_unregister_port(ide_hwif_t *hwif) { ; } |
723 | static inline void ide_proc_register_driver(ide_drive_t *drive, ide_driver_t *driver) { ; } | 1053 | static inline void ide_proc_register_driver(ide_drive_t *drive, ide_driver_t *driver) { ; } |
724 | static inline void ide_proc_unregister_driver(ide_drive_t *drive, ide_driver_t *driver) { ; } | 1054 | static inline void ide_proc_unregister_driver(ide_drive_t *drive, ide_driver_t *driver) { ; } |
725 | static inline void ide_add_generic_settings(ide_drive_t *drive) { ; } | ||
726 | #define PROC_IDE_READ_RETURN(page,start,off,count,eof,len) return 0; | 1055 | #define PROC_IDE_READ_RETURN(page,start,off,count,eof,len) return 0; |
727 | #endif | 1056 | #endif |
728 | 1057 | ||
1058 | enum { | ||
1059 | /* enter/exit functions */ | ||
1060 | IDE_DBG_FUNC = (1 << 0), | ||
1061 | /* sense key/asc handling */ | ||
1062 | IDE_DBG_SENSE = (1 << 1), | ||
1063 | /* packet commands handling */ | ||
1064 | IDE_DBG_PC = (1 << 2), | ||
1065 | /* request handling */ | ||
1066 | IDE_DBG_RQ = (1 << 3), | ||
1067 | /* driver probing/setup */ | ||
1068 | IDE_DBG_PROBE = (1 << 4), | ||
1069 | }; | ||
1070 | |||
1071 | /* DRV_NAME has to be defined in the driver before using the macro below */ | ||
1072 | #define __ide_debug_log(lvl, fmt, args...) \ | ||
1073 | { \ | ||
1074 | if (unlikely(drive->debug_mask & lvl)) \ | ||
1075 | printk(KERN_INFO DRV_NAME ": " fmt, ## args); \ | ||
1076 | } | ||
1077 | |||
729 | /* | 1078 | /* |
730 | * Power Management step value (rq->pm->pm_step). | 1079 | * Power Management state machine (rq->pm->pm_step). |
731 | * | 1080 | * |
732 | * The step value starts at 0 (ide_pm_state_start_suspend) for a | 1081 | * For each step, the core calls ide_start_power_step() first. |
733 | * suspend operation or 1000 (ide_pm_state_start_resume) for a | ||
734 | * resume operation. | ||
735 | * | ||
736 | * For each step, the core calls the subdriver start_power_step() first. | ||
737 | * This can return: | 1082 | * This can return: |
738 | * - ide_stopped : In this case, the core calls us back again unless | 1083 | * - ide_stopped : In this case, the core calls us back again unless |
739 | * step have been set to ide_power_state_completed. | 1084 | * step have been set to ide_power_state_completed. |
740 | * - ide_started : In this case, the channel is left busy until an | 1085 | * - ide_started : In this case, the channel is left busy until an |
741 | * async event (interrupt) occurs. | 1086 | * async event (interrupt) occurs. |
742 | * Typically, start_power_step() will issue a taskfile request with | 1087 | * Typically, ide_start_power_step() will issue a taskfile request with |
743 | * do_rw_taskfile(). | 1088 | * do_rw_taskfile(). |
744 | * | 1089 | * |
745 | * Upon reception of the interrupt, the core will call complete_power_step() | 1090 | * Upon reception of the interrupt, the core will call ide_complete_power_step() |
746 | * with the error code if any. This routine should update the step value | 1091 | * with the error code if any. This routine should update the step value |
747 | * and return. It should not start a new request. The core will call | 1092 | * and return. It should not start a new request. The core will call |
748 | * start_power_step for the new step value, unless step have been set to | 1093 | * ide_start_power_step() for the new step value, unless step have been |
749 | * ide_power_state_completed. | 1094 | * set to IDE_PM_COMPLETED. |
750 | * | ||
751 | * Subdrivers are expected to define their own additional power | ||
752 | * steps from 1..999 for suspend and from 1001..1999 for resume, | ||
753 | * other values are reserved for future use. | ||
754 | */ | 1095 | */ |
755 | |||
756 | enum { | 1096 | enum { |
757 | ide_pm_state_completed = -1, | 1097 | IDE_PM_START_SUSPEND, |
758 | ide_pm_state_start_suspend = 0, | 1098 | IDE_PM_FLUSH_CACHE = IDE_PM_START_SUSPEND, |
759 | ide_pm_state_start_resume = 1000, | 1099 | IDE_PM_STANDBY, |
1100 | |||
1101 | IDE_PM_START_RESUME, | ||
1102 | IDE_PM_RESTORE_PIO = IDE_PM_START_RESUME, | ||
1103 | IDE_PM_IDLE, | ||
1104 | IDE_PM_RESTORE_DMA, | ||
1105 | |||
1106 | IDE_PM_COMPLETED, | ||
760 | }; | 1107 | }; |
761 | 1108 | ||
762 | /* | 1109 | /* |
@@ -767,51 +1114,39 @@ enum { | |||
767 | */ | 1114 | */ |
768 | struct ide_driver_s { | 1115 | struct ide_driver_s { |
769 | const char *version; | 1116 | const char *version; |
770 | u8 media; | ||
771 | unsigned supports_dsc_overlap : 1; | ||
772 | ide_startstop_t (*do_request)(ide_drive_t *, struct request *, sector_t); | 1117 | ide_startstop_t (*do_request)(ide_drive_t *, struct request *, sector_t); |
773 | int (*end_request)(ide_drive_t *, int, int); | 1118 | int (*end_request)(ide_drive_t *, int, int); |
774 | ide_startstop_t (*error)(ide_drive_t *, struct request *rq, u8, u8); | 1119 | ide_startstop_t (*error)(ide_drive_t *, struct request *rq, u8, u8); |
775 | ide_startstop_t (*abort)(ide_drive_t *, struct request *rq); | ||
776 | struct device_driver gen_driver; | 1120 | struct device_driver gen_driver; |
777 | int (*probe)(ide_drive_t *); | 1121 | int (*probe)(ide_drive_t *); |
778 | void (*remove)(ide_drive_t *); | 1122 | void (*remove)(ide_drive_t *); |
779 | void (*resume)(ide_drive_t *); | 1123 | void (*resume)(ide_drive_t *); |
780 | void (*shutdown)(ide_drive_t *); | 1124 | void (*shutdown)(ide_drive_t *); |
781 | #ifdef CONFIG_IDE_PROC_FS | 1125 | #ifdef CONFIG_IDE_PROC_FS |
782 | ide_proc_entry_t *proc; | 1126 | ide_proc_entry_t *proc; |
1127 | const struct ide_proc_devset *settings; | ||
783 | #endif | 1128 | #endif |
784 | }; | 1129 | }; |
785 | 1130 | ||
786 | #define to_ide_driver(drv) container_of(drv, ide_driver_t, gen_driver) | 1131 | #define to_ide_driver(drv) container_of(drv, ide_driver_t, gen_driver) |
787 | 1132 | ||
788 | int generic_ide_ioctl(ide_drive_t *, struct file *, struct block_device *, unsigned, unsigned long); | 1133 | int ide_device_get(ide_drive_t *); |
1134 | void ide_device_put(ide_drive_t *); | ||
789 | 1135 | ||
790 | /* | 1136 | struct ide_ioctl_devset { |
791 | * ide_hwifs[] is the master data structure used to keep track | 1137 | unsigned int get_ioctl; |
792 | * of just about everything in ide.c. Whenever possible, routines | 1138 | unsigned int set_ioctl; |
793 | * should be using pointers to a drive (ide_drive_t *) or | 1139 | const struct ide_devset *setting; |
794 | * pointers to a hwif (ide_hwif_t *), rather than indexing this | 1140 | }; |
795 | * structure directly (the allocation/layout may change!). | ||
796 | * | ||
797 | */ | ||
798 | #ifndef _IDE_C | ||
799 | extern ide_hwif_t ide_hwifs[]; /* master data repository */ | ||
800 | #endif | ||
801 | extern int ide_noacpi; | ||
802 | extern int ide_acpigtf; | ||
803 | extern int ide_acpionboot; | ||
804 | extern int noautodma; | ||
805 | 1141 | ||
806 | extern int ide_vlb_clk; | 1142 | int ide_setting_ioctl(ide_drive_t *, struct block_device *, unsigned int, |
807 | extern int ide_pci_clk; | 1143 | unsigned long, const struct ide_ioctl_devset *); |
808 | 1144 | ||
809 | ide_hwif_t *ide_find_port_slot(const struct ide_port_info *); | 1145 | int generic_ide_ioctl(ide_drive_t *, struct file *, struct block_device *, |
1146 | unsigned, unsigned long); | ||
810 | 1147 | ||
811 | static inline ide_hwif_t *ide_find_port(void) | 1148 | extern int ide_vlb_clk; |
812 | { | 1149 | extern int ide_pci_clk; |
813 | return ide_find_port_slot(NULL); | ||
814 | } | ||
815 | 1150 | ||
816 | extern int ide_end_request (ide_drive_t *drive, int uptodate, int nrsecs); | 1151 | extern int ide_end_request (ide_drive_t *drive, int uptodate, int nrsecs); |
817 | int ide_end_dequeued_request(ide_drive_t *drive, struct request *rq, | 1152 | int ide_end_dequeued_request(ide_drive_t *drive, struct request *rq, |
@@ -830,145 +1165,90 @@ ide_startstop_t __ide_error(ide_drive_t *, struct request *, u8, u8); | |||
830 | 1165 | ||
831 | ide_startstop_t ide_error (ide_drive_t *drive, const char *msg, byte stat); | 1166 | ide_startstop_t ide_error (ide_drive_t *drive, const char *msg, byte stat); |
832 | 1167 | ||
833 | ide_startstop_t __ide_abort(ide_drive_t *, struct request *); | 1168 | void ide_fix_driveid(u16 *); |
834 | |||
835 | extern ide_startstop_t ide_abort(ide_drive_t *, const char *); | ||
836 | |||
837 | extern void ide_fix_driveid(struct hd_driveid *); | ||
838 | 1169 | ||
839 | extern void ide_fixstring(u8 *, const int, const int); | 1170 | extern void ide_fixstring(u8 *, const int, const int); |
840 | 1171 | ||
1172 | int ide_busy_sleep(ide_hwif_t *, unsigned long, int); | ||
1173 | |||
841 | int ide_wait_stat(ide_startstop_t *, ide_drive_t *, u8, u8, unsigned long); | 1174 | int ide_wait_stat(ide_startstop_t *, ide_drive_t *, u8, u8, unsigned long); |
842 | 1175 | ||
843 | extern ide_startstop_t ide_do_reset (ide_drive_t *); | 1176 | extern ide_startstop_t ide_do_reset (ide_drive_t *); |
844 | 1177 | ||
845 | extern void ide_init_drive_cmd (struct request *rq); | 1178 | extern int ide_devset_execute(ide_drive_t *drive, |
1179 | const struct ide_devset *setting, int arg); | ||
846 | 1180 | ||
847 | /* | 1181 | extern void ide_do_drive_cmd(ide_drive_t *, struct request *); |
848 | * "action" parameter type for ide_do_drive_cmd() below. | ||
849 | */ | ||
850 | typedef enum { | ||
851 | ide_wait, /* insert rq at end of list, and wait for it */ | ||
852 | ide_preempt, /* insert rq in front of current request */ | ||
853 | ide_head_wait, /* insert rq in front of current request and wait for it */ | ||
854 | ide_end /* insert rq at end of list, but don't wait for it */ | ||
855 | } ide_action_t; | ||
856 | |||
857 | extern int ide_do_drive_cmd(ide_drive_t *, struct request *, ide_action_t); | ||
858 | 1182 | ||
859 | extern void ide_end_drive_cmd(ide_drive_t *, u8, u8); | 1183 | extern void ide_end_drive_cmd(ide_drive_t *, u8, u8); |
860 | 1184 | ||
861 | enum { | 1185 | void ide_tf_dump(const char *, struct ide_taskfile *); |
862 | IDE_TFLAG_LBA48 = (1 << 0), | ||
863 | IDE_TFLAG_NO_SELECT_MASK = (1 << 1), | ||
864 | IDE_TFLAG_FLAGGED = (1 << 2), | ||
865 | IDE_TFLAG_OUT_DATA = (1 << 3), | ||
866 | IDE_TFLAG_OUT_HOB_FEATURE = (1 << 4), | ||
867 | IDE_TFLAG_OUT_HOB_NSECT = (1 << 5), | ||
868 | IDE_TFLAG_OUT_HOB_LBAL = (1 << 6), | ||
869 | IDE_TFLAG_OUT_HOB_LBAM = (1 << 7), | ||
870 | IDE_TFLAG_OUT_HOB_LBAH = (1 << 8), | ||
871 | IDE_TFLAG_OUT_HOB = IDE_TFLAG_OUT_HOB_FEATURE | | ||
872 | IDE_TFLAG_OUT_HOB_NSECT | | ||
873 | IDE_TFLAG_OUT_HOB_LBAL | | ||
874 | IDE_TFLAG_OUT_HOB_LBAM | | ||
875 | IDE_TFLAG_OUT_HOB_LBAH, | ||
876 | IDE_TFLAG_OUT_FEATURE = (1 << 9), | ||
877 | IDE_TFLAG_OUT_NSECT = (1 << 10), | ||
878 | IDE_TFLAG_OUT_LBAL = (1 << 11), | ||
879 | IDE_TFLAG_OUT_LBAM = (1 << 12), | ||
880 | IDE_TFLAG_OUT_LBAH = (1 << 13), | ||
881 | IDE_TFLAG_OUT_TF = IDE_TFLAG_OUT_FEATURE | | ||
882 | IDE_TFLAG_OUT_NSECT | | ||
883 | IDE_TFLAG_OUT_LBAL | | ||
884 | IDE_TFLAG_OUT_LBAM | | ||
885 | IDE_TFLAG_OUT_LBAH, | ||
886 | IDE_TFLAG_OUT_DEVICE = (1 << 14), | ||
887 | IDE_TFLAG_WRITE = (1 << 15), | ||
888 | IDE_TFLAG_FLAGGED_SET_IN_FLAGS = (1 << 16), | ||
889 | IDE_TFLAG_IN_DATA = (1 << 17), | ||
890 | IDE_TFLAG_CUSTOM_HANDLER = (1 << 18), | ||
891 | IDE_TFLAG_DMA_PIO_FALLBACK = (1 << 19), | ||
892 | IDE_TFLAG_IN_HOB_FEATURE = (1 << 20), | ||
893 | IDE_TFLAG_IN_HOB_NSECT = (1 << 21), | ||
894 | IDE_TFLAG_IN_HOB_LBAL = (1 << 22), | ||
895 | IDE_TFLAG_IN_HOB_LBAM = (1 << 23), | ||
896 | IDE_TFLAG_IN_HOB_LBAH = (1 << 24), | ||
897 | IDE_TFLAG_IN_HOB_LBA = IDE_TFLAG_IN_HOB_LBAL | | ||
898 | IDE_TFLAG_IN_HOB_LBAM | | ||
899 | IDE_TFLAG_IN_HOB_LBAH, | ||
900 | IDE_TFLAG_IN_HOB = IDE_TFLAG_IN_HOB_FEATURE | | ||
901 | IDE_TFLAG_IN_HOB_NSECT | | ||
902 | IDE_TFLAG_IN_HOB_LBA, | ||
903 | IDE_TFLAG_IN_NSECT = (1 << 25), | ||
904 | IDE_TFLAG_IN_LBAL = (1 << 26), | ||
905 | IDE_TFLAG_IN_LBAM = (1 << 27), | ||
906 | IDE_TFLAG_IN_LBAH = (1 << 28), | ||
907 | IDE_TFLAG_IN_LBA = IDE_TFLAG_IN_LBAL | | ||
908 | IDE_TFLAG_IN_LBAM | | ||
909 | IDE_TFLAG_IN_LBAH, | ||
910 | IDE_TFLAG_IN_TF = IDE_TFLAG_IN_NSECT | | ||
911 | IDE_TFLAG_IN_LBA, | ||
912 | IDE_TFLAG_IN_DEVICE = (1 << 29), | ||
913 | IDE_TFLAG_HOB = IDE_TFLAG_OUT_HOB | | ||
914 | IDE_TFLAG_IN_HOB, | ||
915 | IDE_TFLAG_TF = IDE_TFLAG_OUT_TF | | ||
916 | IDE_TFLAG_IN_TF, | ||
917 | IDE_TFLAG_DEVICE = IDE_TFLAG_OUT_DEVICE | | ||
918 | IDE_TFLAG_IN_DEVICE, | ||
919 | /* force 16-bit I/O operations */ | ||
920 | IDE_TFLAG_IO_16BIT = (1 << 30), | ||
921 | /* ide_task_t was allocated using kmalloc() */ | ||
922 | IDE_TFLAG_DYN = (1 << 31), | ||
923 | }; | ||
924 | 1186 | ||
925 | struct ide_taskfile { | 1187 | void ide_exec_command(ide_hwif_t *, u8); |
926 | u8 hob_data; /* 0: high data byte (for TASKFILE IOCTL) */ | 1188 | u8 ide_read_status(ide_hwif_t *); |
1189 | u8 ide_read_altstatus(ide_hwif_t *); | ||
1190 | u8 ide_read_sff_dma_status(ide_hwif_t *); | ||
927 | 1191 | ||
928 | u8 hob_feature; /* 1-5: additional data to support LBA48 */ | 1192 | void ide_set_irq(ide_hwif_t *, int); |
929 | u8 hob_nsect; | ||
930 | u8 hob_lbal; | ||
931 | u8 hob_lbam; | ||
932 | u8 hob_lbah; | ||
933 | 1193 | ||
934 | u8 data; /* 6: low data byte (for TASKFILE IOCTL) */ | 1194 | void ide_tf_load(ide_drive_t *, ide_task_t *); |
1195 | void ide_tf_read(ide_drive_t *, ide_task_t *); | ||
935 | 1196 | ||
936 | union { /* Â 7: */ | 1197 | void ide_input_data(ide_drive_t *, struct request *, void *, unsigned int); |
937 | u8 error; /* read: error */ | 1198 | void ide_output_data(ide_drive_t *, struct request *, void *, unsigned int); |
938 | u8 feature; /* write: feature */ | ||
939 | }; | ||
940 | 1199 | ||
941 | u8 nsect; /* 8: number of sectors */ | 1200 | int ide_io_buffers(ide_drive_t *, struct ide_atapi_pc *, unsigned int, int); |
942 | u8 lbal; /* 9: LBA low */ | ||
943 | u8 lbam; /* 10: LBA mid */ | ||
944 | u8 lbah; /* 11: LBA high */ | ||
945 | 1201 | ||
946 | u8 device; /* 12: device select */ | 1202 | extern void SELECT_DRIVE(ide_drive_t *); |
1203 | void SELECT_MASK(ide_drive_t *, int); | ||
947 | 1204 | ||
948 | union { /* 13: */ | 1205 | u8 ide_read_error(ide_drive_t *); |
949 | u8 status; /*  read: status  */ | 1206 | void ide_read_bcount_and_ireason(ide_drive_t *, u16 *, u8 *); |
950 | u8 command; /* write: command */ | 1207 | |
951 | }; | 1208 | extern int drive_is_ready(ide_drive_t *); |
1209 | |||
1210 | void ide_pktcmd_tf_load(ide_drive_t *, u32, u16, u8); | ||
1211 | |||
1212 | int ide_check_atapi_device(ide_drive_t *, const char *); | ||
1213 | |||
1214 | void ide_init_pc(struct ide_atapi_pc *); | ||
1215 | |||
1216 | /* Disk head parking */ | ||
1217 | extern wait_queue_head_t ide_park_wq; | ||
1218 | ssize_t ide_park_show(struct device *dev, struct device_attribute *attr, | ||
1219 | char *buf); | ||
1220 | ssize_t ide_park_store(struct device *dev, struct device_attribute *attr, | ||
1221 | const char *buf, size_t len); | ||
1222 | |||
1223 | /* | ||
1224 | * Special requests for ide-tape block device strategy routine. | ||
1225 | * | ||
1226 | * In order to service a character device command, we add special requests to | ||
1227 | * the tail of our block device request queue and wait for their completion. | ||
1228 | */ | ||
1229 | enum { | ||
1230 | REQ_IDETAPE_PC1 = (1 << 0), /* packet command (first stage) */ | ||
1231 | REQ_IDETAPE_PC2 = (1 << 1), /* packet command (second stage) */ | ||
1232 | REQ_IDETAPE_READ = (1 << 2), | ||
1233 | REQ_IDETAPE_WRITE = (1 << 3), | ||
952 | }; | 1234 | }; |
953 | 1235 | ||
954 | typedef struct ide_task_s { | 1236 | int ide_queue_pc_tail(ide_drive_t *, struct gendisk *, struct ide_atapi_pc *); |
955 | union { | ||
956 | struct ide_taskfile tf; | ||
957 | u8 tf_array[14]; | ||
958 | }; | ||
959 | u32 tf_flags; | ||
960 | int data_phase; | ||
961 | struct request *rq; /* copy of request */ | ||
962 | void *special; /* valid_t generally */ | ||
963 | } ide_task_t; | ||
964 | 1237 | ||
965 | void ide_tf_dump(const char *, struct ide_taskfile *); | 1238 | int ide_do_test_unit_ready(ide_drive_t *, struct gendisk *); |
1239 | int ide_do_start_stop(ide_drive_t *, struct gendisk *, int); | ||
1240 | int ide_set_media_lock(ide_drive_t *, struct gendisk *, int); | ||
1241 | void ide_create_request_sense_cmd(ide_drive_t *, struct ide_atapi_pc *); | ||
1242 | void ide_retry_pc(ide_drive_t *, struct gendisk *); | ||
966 | 1243 | ||
967 | extern void SELECT_DRIVE(ide_drive_t *); | 1244 | static inline unsigned long ide_scsi_get_timeout(struct ide_atapi_pc *pc) |
1245 | { | ||
1246 | return max_t(unsigned long, WAIT_CMD, pc->timeout - jiffies); | ||
1247 | } | ||
968 | 1248 | ||
969 | extern int drive_is_ready(ide_drive_t *); | 1249 | int ide_scsi_expiry(ide_drive_t *); |
970 | 1250 | ||
971 | void ide_pktcmd_tf_load(ide_drive_t *, u32, u16, u8); | 1251 | ide_startstop_t ide_issue_pc(ide_drive_t *, unsigned int, ide_expiry_t *); |
972 | 1252 | ||
973 | ide_startstop_t do_rw_taskfile(ide_drive_t *, ide_task_t *); | 1253 | ide_startstop_t do_rw_taskfile(ide_drive_t *, ide_task_t *); |
974 | 1254 | ||
@@ -978,10 +1258,6 @@ int ide_raw_taskfile(ide_drive_t *, ide_task_t *, u8 *, u16); | |||
978 | int ide_no_data_taskfile(ide_drive_t *, ide_task_t *); | 1258 | int ide_no_data_taskfile(ide_drive_t *, ide_task_t *); |
979 | 1259 | ||
980 | int ide_taskfile_ioctl(ide_drive_t *, unsigned int, unsigned long); | 1260 | int ide_taskfile_ioctl(ide_drive_t *, unsigned int, unsigned long); |
981 | int ide_cmd_ioctl(ide_drive_t *, unsigned int, unsigned long); | ||
982 | int ide_task_ioctl(ide_drive_t *, unsigned int, unsigned long); | ||
983 | |||
984 | extern int system_bus_clock(void); | ||
985 | 1261 | ||
986 | extern int ide_driveid_update(ide_drive_t *); | 1262 | extern int ide_driveid_update(ide_drive_t *); |
987 | extern int ide_config_drive_speed(ide_drive_t *, u8); | 1263 | extern int ide_config_drive_speed(ide_drive_t *, u8); |
@@ -992,7 +1268,6 @@ extern int ide_wait_not_busy(ide_hwif_t *hwif, unsigned long timeout); | |||
992 | 1268 | ||
993 | extern void ide_stall_queue(ide_drive_t *drive, unsigned long timeout); | 1269 | extern void ide_stall_queue(ide_drive_t *drive, unsigned long timeout); |
994 | 1270 | ||
995 | extern int ide_spin_wait_hwgroup(ide_drive_t *); | ||
996 | extern void ide_timer_expiry(unsigned long); | 1271 | extern void ide_timer_expiry(unsigned long); |
997 | extern irqreturn_t ide_intr(int irq, void *dev_id); | 1272 | extern irqreturn_t ide_intr(int irq, void *dev_id); |
998 | extern void do_ide_request(struct request_queue *); | 1273 | extern void do_ide_request(struct request_queue *); |
@@ -1006,12 +1281,14 @@ extern int __ide_pci_register_driver(struct pci_driver *driver, struct module *o | |||
1006 | #define ide_pci_register_driver(d) pci_register_driver(d) | 1281 | #define ide_pci_register_driver(d) pci_register_driver(d) |
1007 | #endif | 1282 | #endif |
1008 | 1283 | ||
1009 | void ide_pci_setup_ports(struct pci_dev *, const struct ide_port_info *, int, u8 *); | 1284 | void ide_pci_setup_ports(struct pci_dev *, const struct ide_port_info *, int, |
1285 | hw_regs_t *, hw_regs_t **); | ||
1010 | void ide_setup_pci_noise(struct pci_dev *, const struct ide_port_info *); | 1286 | void ide_setup_pci_noise(struct pci_dev *, const struct ide_port_info *); |
1011 | 1287 | ||
1012 | #ifdef CONFIG_BLK_DEV_IDEDMA_PCI | 1288 | #ifdef CONFIG_BLK_DEV_IDEDMA_PCI |
1013 | int ide_pci_set_master(struct pci_dev *, const char *); | 1289 | int ide_pci_set_master(struct pci_dev *, const char *); |
1014 | unsigned long ide_pci_dma_base(ide_hwif_t *, const struct ide_port_info *); | 1290 | unsigned long ide_pci_dma_base(ide_hwif_t *, const struct ide_port_info *); |
1291 | int ide_pci_check_simplex(ide_hwif_t *, const struct ide_port_info *); | ||
1015 | int ide_hwif_setup_dma(ide_hwif_t *, const struct ide_port_info *); | 1292 | int ide_hwif_setup_dma(ide_hwif_t *, const struct ide_port_info *); |
1016 | #else | 1293 | #else |
1017 | static inline int ide_hwif_setup_dma(ide_hwif_t *hwif, | 1294 | static inline int ide_hwif_setup_dma(ide_hwif_t *hwif, |
@@ -1021,10 +1298,6 @@ static inline int ide_hwif_setup_dma(ide_hwif_t *hwif, | |||
1021 | } | 1298 | } |
1022 | #endif | 1299 | #endif |
1023 | 1300 | ||
1024 | extern void default_hwif_iops(ide_hwif_t *); | ||
1025 | extern void default_hwif_mmiops(ide_hwif_t *); | ||
1026 | extern void default_hwif_transport(ide_hwif_t *); | ||
1027 | |||
1028 | typedef struct ide_pci_enablebit_s { | 1301 | typedef struct ide_pci_enablebit_s { |
1029 | u8 reg; /* byte pci reg holding the enable-bit */ | 1302 | u8 reg; /* byte pci reg holding the enable-bit */ |
1030 | u8 mask; /* mask to isolate the enable-bit */ | 1303 | u8 mask; /* mask to isolate the enable-bit */ |
@@ -1087,7 +1360,6 @@ enum { | |||
1087 | IDE_HFLAG_IO_32BIT = (1 << 24), | 1360 | IDE_HFLAG_IO_32BIT = (1 << 24), |
1088 | /* unmask IRQs */ | 1361 | /* unmask IRQs */ |
1089 | IDE_HFLAG_UNMASK_IRQS = (1 << 25), | 1362 | IDE_HFLAG_UNMASK_IRQS = (1 << 25), |
1090 | IDE_HFLAG_ABUSE_SET_DMA_MODE = (1 << 26), | ||
1091 | /* serialize ports if DMA is possible (for sl82c105) */ | 1363 | /* serialize ports if DMA is possible (for sl82c105) */ |
1092 | IDE_HFLAG_SERIALIZE_DMA = (1 << 27), | 1364 | IDE_HFLAG_SERIALIZE_DMA = (1 << 27), |
1093 | /* force host out of "simplex" mode */ | 1365 | /* force host out of "simplex" mode */ |
@@ -1098,8 +1370,6 @@ enum { | |||
1098 | IDE_HFLAG_NO_IO_32BIT = (1 << 30), | 1370 | IDE_HFLAG_NO_IO_32BIT = (1 << 30), |
1099 | /* never unmask IRQs */ | 1371 | /* never unmask IRQs */ |
1100 | IDE_HFLAG_NO_UNMASK_IRQS = (1 << 31), | 1372 | IDE_HFLAG_NO_UNMASK_IRQS = (1 << 31), |
1101 | /* host uses VDMA (disabled for now) */ | ||
1102 | IDE_HFLAG_VDMA = 0, | ||
1103 | }; | 1373 | }; |
1104 | 1374 | ||
1105 | #ifdef CONFIG_BLK_DEV_OFFBOARD | 1375 | #ifdef CONFIG_BLK_DEV_OFFBOARD |
@@ -1110,12 +1380,13 @@ enum { | |||
1110 | 1380 | ||
1111 | struct ide_port_info { | 1381 | struct ide_port_info { |
1112 | char *name; | 1382 | char *name; |
1113 | unsigned int (*init_chipset)(struct pci_dev *, const char *); | 1383 | unsigned int (*init_chipset)(struct pci_dev *); |
1114 | void (*init_iops)(ide_hwif_t *); | 1384 | void (*init_iops)(ide_hwif_t *); |
1115 | void (*init_hwif)(ide_hwif_t *); | 1385 | void (*init_hwif)(ide_hwif_t *); |
1116 | int (*init_dma)(ide_hwif_t *, | 1386 | int (*init_dma)(ide_hwif_t *, |
1117 | const struct ide_port_info *); | 1387 | const struct ide_port_info *); |
1118 | 1388 | ||
1389 | const struct ide_tp_ops *tp_ops; | ||
1119 | const struct ide_port_ops *port_ops; | 1390 | const struct ide_port_ops *port_ops; |
1120 | const struct ide_dma_ops *dma_ops; | 1391 | const struct ide_dma_ops *dma_ops; |
1121 | 1392 | ||
@@ -1128,8 +1399,18 @@ struct ide_port_info { | |||
1128 | u8 udma_mask; | 1399 | u8 udma_mask; |
1129 | }; | 1400 | }; |
1130 | 1401 | ||
1131 | int ide_setup_pci_device(struct pci_dev *, const struct ide_port_info *); | 1402 | int ide_pci_init_one(struct pci_dev *, const struct ide_port_info *, void *); |
1132 | int ide_setup_pci_devices(struct pci_dev *, struct pci_dev *, const struct ide_port_info *); | 1403 | int ide_pci_init_two(struct pci_dev *, struct pci_dev *, |
1404 | const struct ide_port_info *, void *); | ||
1405 | void ide_pci_remove(struct pci_dev *); | ||
1406 | |||
1407 | #ifdef CONFIG_PM | ||
1408 | int ide_pci_suspend(struct pci_dev *, pm_message_t); | ||
1409 | int ide_pci_resume(struct pci_dev *); | ||
1410 | #else | ||
1411 | #define ide_pci_suspend NULL | ||
1412 | #define ide_pci_resume NULL | ||
1413 | #endif | ||
1133 | 1414 | ||
1134 | void ide_map_sg(ide_drive_t *, struct request *); | 1415 | void ide_map_sg(ide_drive_t *, struct request *); |
1135 | void ide_init_sg_cmd(ide_drive_t *, struct request *); | 1416 | void ide_init_sg_cmd(ide_drive_t *, struct request *); |
@@ -1142,9 +1423,10 @@ struct drive_list_entry { | |||
1142 | const char *id_firmware; | 1423 | const char *id_firmware; |
1143 | }; | 1424 | }; |
1144 | 1425 | ||
1145 | int ide_in_drive_list(struct hd_driveid *, const struct drive_list_entry *); | 1426 | int ide_in_drive_list(u16 *, const struct drive_list_entry *); |
1146 | 1427 | ||
1147 | #ifdef CONFIG_BLK_DEV_IDEDMA | 1428 | #ifdef CONFIG_BLK_DEV_IDEDMA |
1429 | int ide_dma_good_drive(ide_drive_t *); | ||
1148 | int __ide_dma_bad_drive(ide_drive_t *); | 1430 | int __ide_dma_bad_drive(ide_drive_t *); |
1149 | int ide_id_dma_bug(ide_drive_t *); | 1431 | int ide_id_dma_bug(ide_drive_t *); |
1150 | 1432 | ||
@@ -1162,25 +1444,29 @@ int ide_set_dma(ide_drive_t *); | |||
1162 | void ide_check_dma_crc(ide_drive_t *); | 1444 | void ide_check_dma_crc(ide_drive_t *); |
1163 | ide_startstop_t ide_dma_intr(ide_drive_t *); | 1445 | ide_startstop_t ide_dma_intr(ide_drive_t *); |
1164 | 1446 | ||
1447 | int ide_allocate_dma_engine(ide_hwif_t *); | ||
1448 | void ide_release_dma_engine(ide_hwif_t *); | ||
1449 | |||
1165 | int ide_build_sglist(ide_drive_t *, struct request *); | 1450 | int ide_build_sglist(ide_drive_t *, struct request *); |
1166 | void ide_destroy_dmatable(ide_drive_t *); | 1451 | void ide_destroy_dmatable(ide_drive_t *); |
1167 | 1452 | ||
1168 | #ifdef CONFIG_BLK_DEV_IDEDMA_SFF | 1453 | #ifdef CONFIG_BLK_DEV_IDEDMA_SFF |
1454 | int config_drive_for_dma(ide_drive_t *); | ||
1169 | extern int ide_build_dmatable(ide_drive_t *, struct request *); | 1455 | extern int ide_build_dmatable(ide_drive_t *, struct request *); |
1170 | int ide_allocate_dma_engine(ide_hwif_t *); | ||
1171 | void ide_release_dma_engine(ide_hwif_t *); | ||
1172 | void ide_setup_dma(ide_hwif_t *, unsigned long); | ||
1173 | |||
1174 | void ide_dma_host_set(ide_drive_t *, int); | 1456 | void ide_dma_host_set(ide_drive_t *, int); |
1175 | extern int ide_dma_setup(ide_drive_t *); | 1457 | extern int ide_dma_setup(ide_drive_t *); |
1176 | void ide_dma_exec_cmd(ide_drive_t *, u8); | 1458 | void ide_dma_exec_cmd(ide_drive_t *, u8); |
1177 | extern void ide_dma_start(ide_drive_t *); | 1459 | extern void ide_dma_start(ide_drive_t *); |
1178 | extern int __ide_dma_end(ide_drive_t *); | 1460 | int ide_dma_end(ide_drive_t *); |
1179 | int ide_dma_test_irq(ide_drive_t *); | 1461 | int ide_dma_test_irq(ide_drive_t *); |
1180 | extern void ide_dma_lost_irq(ide_drive_t *); | 1462 | extern const struct ide_dma_ops sff_dma_ops; |
1181 | extern void ide_dma_timeout(ide_drive_t *); | 1463 | #else |
1464 | static inline int config_drive_for_dma(ide_drive_t *drive) { return 0; } | ||
1182 | #endif /* CONFIG_BLK_DEV_IDEDMA_SFF */ | 1465 | #endif /* CONFIG_BLK_DEV_IDEDMA_SFF */ |
1183 | 1466 | ||
1467 | void ide_dma_lost_irq(ide_drive_t *); | ||
1468 | void ide_dma_timeout(ide_drive_t *); | ||
1469 | |||
1184 | #else | 1470 | #else |
1185 | static inline int ide_id_dma_bug(ide_drive_t *drive) { return 0; } | 1471 | static inline int ide_id_dma_bug(ide_drive_t *drive) { return 0; } |
1186 | static inline u8 ide_find_dma_mode(ide_drive_t *drive, u8 speed) { return 0; } | 1472 | static inline u8 ide_find_dma_mode(ide_drive_t *drive, u8 speed) { return 0; } |
@@ -1191,11 +1477,8 @@ static inline void ide_dma_on(ide_drive_t *drive) { ; } | |||
1191 | static inline void ide_dma_verbose(ide_drive_t *drive) { ; } | 1477 | static inline void ide_dma_verbose(ide_drive_t *drive) { ; } |
1192 | static inline int ide_set_dma(ide_drive_t *drive) { return 1; } | 1478 | static inline int ide_set_dma(ide_drive_t *drive) { return 1; } |
1193 | static inline void ide_check_dma_crc(ide_drive_t *drive) { ; } | 1479 | static inline void ide_check_dma_crc(ide_drive_t *drive) { ; } |
1194 | #endif /* CONFIG_BLK_DEV_IDEDMA */ | ||
1195 | |||
1196 | #ifndef CONFIG_BLK_DEV_IDEDMA_SFF | ||
1197 | static inline void ide_release_dma_engine(ide_hwif_t *hwif) { ; } | 1480 | static inline void ide_release_dma_engine(ide_hwif_t *hwif) { ; } |
1198 | #endif | 1481 | #endif /* CONFIG_BLK_DEV_IDEDMA */ |
1199 | 1482 | ||
1200 | #ifdef CONFIG_BLK_DEV_IDEACPI | 1483 | #ifdef CONFIG_BLK_DEV_IDEACPI |
1201 | extern int ide_acpi_exec_tfs(ide_drive_t *drive); | 1484 | extern int ide_acpi_exec_tfs(ide_drive_t *drive); |
@@ -1223,8 +1506,13 @@ void ide_undecoded_slave(ide_drive_t *); | |||
1223 | 1506 | ||
1224 | void ide_port_apply_params(ide_hwif_t *); | 1507 | void ide_port_apply_params(ide_hwif_t *); |
1225 | 1508 | ||
1226 | int ide_device_add_all(u8 *idx, const struct ide_port_info *); | 1509 | struct ide_host *ide_host_alloc(const struct ide_port_info *, hw_regs_t **); |
1227 | int ide_device_add(u8 idx[4], const struct ide_port_info *); | 1510 | void ide_host_free(struct ide_host *); |
1511 | int ide_host_register(struct ide_host *, const struct ide_port_info *, | ||
1512 | hw_regs_t **); | ||
1513 | int ide_host_add(const struct ide_port_info *, hw_regs_t **, | ||
1514 | struct ide_host **); | ||
1515 | void ide_host_remove(struct ide_host *); | ||
1228 | int ide_legacy_device_add(const struct ide_port_info *, unsigned long); | 1516 | int ide_legacy_device_add(const struct ide_port_info *, unsigned long); |
1229 | void ide_port_unregister_devices(ide_hwif_t *); | 1517 | void ide_port_unregister_devices(ide_hwif_t *); |
1230 | void ide_port_scan(ide_hwif_t *); | 1518 | void ide_port_scan(ide_hwif_t *); |
@@ -1243,37 +1531,46 @@ const char *ide_xfer_verbose(u8 mode); | |||
1243 | extern void ide_toggle_bounce(ide_drive_t *drive, int on); | 1531 | extern void ide_toggle_bounce(ide_drive_t *drive, int on); |
1244 | extern int ide_set_xfer_rate(ide_drive_t *drive, u8 rate); | 1532 | extern int ide_set_xfer_rate(ide_drive_t *drive, u8 rate); |
1245 | 1533 | ||
1246 | static inline int ide_dev_has_iordy(struct hd_driveid *id) | ||
1247 | { | ||
1248 | return ((id->field_valid & 2) && (id->capability & 8)) ? 1 : 0; | ||
1249 | } | ||
1250 | |||
1251 | static inline int ide_dev_is_sata(struct hd_driveid *id) | ||
1252 | { | ||
1253 | /* | ||
1254 | * See if word 93 is 0 AND drive is at least ATA-5 compatible | ||
1255 | * verifying that word 80 by casting it to a signed type -- | ||
1256 | * this trick allows us to filter out the reserved values of | ||
1257 | * 0x0000 and 0xffff along with the earlier ATA revisions... | ||
1258 | */ | ||
1259 | if (id->hw_config == 0 && (short)id->major_rev_num >= 0x0020) | ||
1260 | return 1; | ||
1261 | return 0; | ||
1262 | } | ||
1263 | |||
1264 | u64 ide_get_lba_addr(struct ide_taskfile *, int); | 1534 | u64 ide_get_lba_addr(struct ide_taskfile *, int); |
1265 | u8 ide_dump_status(ide_drive_t *, const char *, u8); | 1535 | u8 ide_dump_status(ide_drive_t *, const char *, u8); |
1266 | 1536 | ||
1267 | typedef struct ide_pio_timings_s { | 1537 | struct ide_timing { |
1268 | int setup_time; /* Address setup (ns) minimum */ | 1538 | u8 mode; |
1269 | int active_time; /* Active pulse (ns) minimum */ | 1539 | u8 setup; /* t1 */ |
1270 | int cycle_time; /* Cycle time (ns) minimum = */ | 1540 | u16 act8b; /* t2 for 8-bit io */ |
1271 | /* active + recovery (+ setup for some chips) */ | 1541 | u16 rec8b; /* t2i for 8-bit io */ |
1272 | } ide_pio_timings_t; | 1542 | u16 cyc8b; /* t0 for 8-bit io */ |
1543 | u16 active; /* t2 or tD */ | ||
1544 | u16 recover; /* t2i or tK */ | ||
1545 | u16 cycle; /* t0 */ | ||
1546 | u16 udma; /* t2CYCTYP/2 */ | ||
1547 | }; | ||
1548 | |||
1549 | enum { | ||
1550 | IDE_TIMING_SETUP = (1 << 0), | ||
1551 | IDE_TIMING_ACT8B = (1 << 1), | ||
1552 | IDE_TIMING_REC8B = (1 << 2), | ||
1553 | IDE_TIMING_CYC8B = (1 << 3), | ||
1554 | IDE_TIMING_8BIT = IDE_TIMING_ACT8B | IDE_TIMING_REC8B | | ||
1555 | IDE_TIMING_CYC8B, | ||
1556 | IDE_TIMING_ACTIVE = (1 << 4), | ||
1557 | IDE_TIMING_RECOVER = (1 << 5), | ||
1558 | IDE_TIMING_CYCLE = (1 << 6), | ||
1559 | IDE_TIMING_UDMA = (1 << 7), | ||
1560 | IDE_TIMING_ALL = IDE_TIMING_SETUP | IDE_TIMING_8BIT | | ||
1561 | IDE_TIMING_ACTIVE | IDE_TIMING_RECOVER | | ||
1562 | IDE_TIMING_CYCLE | IDE_TIMING_UDMA, | ||
1563 | }; | ||
1564 | |||
1565 | struct ide_timing *ide_timing_find_mode(u8); | ||
1566 | u16 ide_pio_cycle_time(ide_drive_t *, u8); | ||
1567 | void ide_timing_merge(struct ide_timing *, struct ide_timing *, | ||
1568 | struct ide_timing *, unsigned int); | ||
1569 | int ide_timing_compute(ide_drive_t *, u8, struct ide_timing *, int, int); | ||
1570 | |||
1571 | int ide_scan_pio_blacklist(char *); | ||
1273 | 1572 | ||
1274 | unsigned int ide_pio_cycle_time(ide_drive_t *, u8); | ||
1275 | u8 ide_get_best_pio_mode(ide_drive_t *, u8, u8); | 1573 | u8 ide_get_best_pio_mode(ide_drive_t *, u8, u8); |
1276 | extern const ide_pio_timings_t ide_pio_timings[6]; | ||
1277 | 1574 | ||
1278 | int ide_set_pio_mode(ide_drive_t *, u8); | 1575 | int ide_set_pio_mode(ide_drive_t *, u8); |
1279 | int ide_set_dma_mode(ide_drive_t *, u8); | 1576 | int ide_set_dma_mode(ide_drive_t *, u8); |
@@ -1305,13 +1602,6 @@ extern struct mutex ide_cfg_mtx; | |||
1305 | extern struct bus_type ide_bus_type; | 1602 | extern struct bus_type ide_bus_type; |
1306 | extern struct class *ide_port_class; | 1603 | extern struct class *ide_port_class; |
1307 | 1604 | ||
1308 | /* check if CACHE FLUSH (EXT) command is supported (bits defined in ATA-6) */ | ||
1309 | #define ide_id_has_flush_cache(id) ((id)->cfs_enable_2 & 0x3000) | ||
1310 | |||
1311 | /* some Maxtor disks have bit 13 defined incorrectly so check bit 10 too */ | ||
1312 | #define ide_id_has_flush_cache_ext(id) \ | ||
1313 | (((id)->cfs_enable_2 & 0x2400) == 0x2400) | ||
1314 | |||
1315 | static inline void ide_dump_identify(u8 *id) | 1605 | static inline void ide_dump_identify(u8 *id) |
1316 | { | 1606 | { |
1317 | print_hex_dump(KERN_INFO, "", DUMP_PREFIX_NONE, 16, 2, id, 512, 0); | 1607 | print_hex_dump(KERN_INFO, "", DUMP_PREFIX_NONE, 16, 2, id, 512, 0); |
@@ -1319,42 +1609,13 @@ static inline void ide_dump_identify(u8 *id) | |||
1319 | 1609 | ||
1320 | static inline int hwif_to_node(ide_hwif_t *hwif) | 1610 | static inline int hwif_to_node(ide_hwif_t *hwif) |
1321 | { | 1611 | { |
1322 | struct pci_dev *dev = to_pci_dev(hwif->dev); | 1612 | return hwif->dev ? dev_to_node(hwif->dev) : -1; |
1323 | return hwif->dev ? pcibus_to_node(dev->bus) : -1; | ||
1324 | } | ||
1325 | |||
1326 | static inline ide_drive_t *ide_get_paired_drive(ide_drive_t *drive) | ||
1327 | { | ||
1328 | ide_hwif_t *hwif = HWIF(drive); | ||
1329 | |||
1330 | return &hwif->drives[(drive->dn ^ 1) & 1]; | ||
1331 | } | ||
1332 | |||
1333 | static inline void ide_set_irq(ide_drive_t *drive, int on) | ||
1334 | { | ||
1335 | ide_hwif_t *hwif = drive->hwif; | ||
1336 | |||
1337 | hwif->OUTB(drive->ctl | (on ? 0 : 2), hwif->io_ports.ctl_addr); | ||
1338 | } | ||
1339 | |||
1340 | static inline u8 ide_read_status(ide_drive_t *drive) | ||
1341 | { | ||
1342 | ide_hwif_t *hwif = drive->hwif; | ||
1343 | |||
1344 | return hwif->INB(hwif->io_ports.status_addr); | ||
1345 | } | ||
1346 | |||
1347 | static inline u8 ide_read_altstatus(ide_drive_t *drive) | ||
1348 | { | ||
1349 | ide_hwif_t *hwif = drive->hwif; | ||
1350 | |||
1351 | return hwif->INB(hwif->io_ports.ctl_addr); | ||
1352 | } | 1613 | } |
1353 | 1614 | ||
1354 | static inline u8 ide_read_error(ide_drive_t *drive) | 1615 | static inline ide_drive_t *ide_get_pair_dev(ide_drive_t *drive) |
1355 | { | 1616 | { |
1356 | ide_hwif_t *hwif = drive->hwif; | 1617 | ide_drive_t *peer = &drive->hwif->drives[(drive->dn ^ 1) & 1]; |
1357 | 1618 | ||
1358 | return hwif->INB(hwif->io_ports.error_addr); | 1619 | return (peer->dev_flags & IDE_DFLAG_PRESENT) ? peer : NULL; |
1359 | } | 1620 | } |
1360 | #endif /* _IDE_H */ | 1621 | #endif /* _IDE_H */ |
diff --git a/include/linux/idr.h b/include/linux/idr.h index 9a2d762124de..fa035f96f2a3 100644 --- a/include/linux/idr.h +++ b/include/linux/idr.h | |||
@@ -15,6 +15,7 @@ | |||
15 | #include <linux/types.h> | 15 | #include <linux/types.h> |
16 | #include <linux/bitops.h> | 16 | #include <linux/bitops.h> |
17 | #include <linux/init.h> | 17 | #include <linux/init.h> |
18 | #include <linux/rcupdate.h> | ||
18 | 19 | ||
19 | #if BITS_PER_LONG == 32 | 20 | #if BITS_PER_LONG == 32 |
20 | # define IDR_BITS 5 | 21 | # define IDR_BITS 5 |
@@ -51,6 +52,7 @@ struct idr_layer { | |||
51 | unsigned long bitmap; /* A zero bit means "space here" */ | 52 | unsigned long bitmap; /* A zero bit means "space here" */ |
52 | struct idr_layer *ary[1<<IDR_BITS]; | 53 | struct idr_layer *ary[1<<IDR_BITS]; |
53 | int count; /* When zero, we can release it */ | 54 | int count; /* When zero, we can release it */ |
55 | struct rcu_head rcu_head; | ||
54 | }; | 56 | }; |
55 | 57 | ||
56 | struct idr { | 58 | struct idr { |
@@ -71,6 +73,28 @@ struct idr { | |||
71 | } | 73 | } |
72 | #define DEFINE_IDR(name) struct idr name = IDR_INIT(name) | 74 | #define DEFINE_IDR(name) struct idr name = IDR_INIT(name) |
73 | 75 | ||
76 | /* Actions to be taken after a call to _idr_sub_alloc */ | ||
77 | #define IDR_NEED_TO_GROW -2 | ||
78 | #define IDR_NOMORE_SPACE -3 | ||
79 | |||
80 | #define _idr_rc_to_errno(rc) ((rc) == -1 ? -EAGAIN : -ENOSPC) | ||
81 | |||
82 | /** | ||
83 | * idr synchronization (stolen from radix-tree.h) | ||
84 | * | ||
85 | * idr_find() is able to be called locklessly, using RCU. The caller must | ||
86 | * ensure calls to this function are made within rcu_read_lock() regions. | ||
87 | * Other readers (lock-free or otherwise) and modifications may be running | ||
88 | * concurrently. | ||
89 | * | ||
90 | * It is still required that the caller manage the synchronization and | ||
91 | * lifetimes of the items. So if RCU lock-free lookups are used, typically | ||
92 | * this would mean that the items have their own locks, or are amenable to | ||
93 | * lock-free access; and that the items are freed by RCU (or only freed after | ||
94 | * having been deleted from the idr tree *and* a synchronize_rcu() grace | ||
95 | * period). | ||
96 | */ | ||
97 | |||
74 | /* | 98 | /* |
75 | * This is what we export. | 99 | * This is what we export. |
76 | */ | 100 | */ |
diff --git a/include/linux/ieee80211.h b/include/linux/ieee80211.h index 0b5e03eae6d2..14126bc36641 100644 --- a/include/linux/ieee80211.h +++ b/include/linux/ieee80211.h | |||
@@ -98,6 +98,9 @@ | |||
98 | 98 | ||
99 | #define IEEE80211_MAX_SSID_LEN 32 | 99 | #define IEEE80211_MAX_SSID_LEN 32 |
100 | #define IEEE80211_MAX_MESH_ID_LEN 32 | 100 | #define IEEE80211_MAX_MESH_ID_LEN 32 |
101 | #define IEEE80211_QOS_CTL_LEN 2 | ||
102 | #define IEEE80211_QOS_CTL_TID_MASK 0x000F | ||
103 | #define IEEE80211_QOS_CTL_TAG1D_MASK 0x0007 | ||
101 | 104 | ||
102 | struct ieee80211_hdr { | 105 | struct ieee80211_hdr { |
103 | __le16 frame_control; | 106 | __le16 frame_control; |
@@ -109,6 +112,355 @@ struct ieee80211_hdr { | |||
109 | u8 addr4[6]; | 112 | u8 addr4[6]; |
110 | } __attribute__ ((packed)); | 113 | } __attribute__ ((packed)); |
111 | 114 | ||
115 | /** | ||
116 | * ieee80211_has_tods - check if IEEE80211_FCTL_TODS is set | ||
117 | * @fc: frame control bytes in little-endian byteorder | ||
118 | */ | ||
119 | static inline int ieee80211_has_tods(__le16 fc) | ||
120 | { | ||
121 | return (fc & cpu_to_le16(IEEE80211_FCTL_TODS)) != 0; | ||
122 | } | ||
123 | |||
124 | /** | ||
125 | * ieee80211_has_fromds - check if IEEE80211_FCTL_FROMDS is set | ||
126 | * @fc: frame control bytes in little-endian byteorder | ||
127 | */ | ||
128 | static inline int ieee80211_has_fromds(__le16 fc) | ||
129 | { | ||
130 | return (fc & cpu_to_le16(IEEE80211_FCTL_FROMDS)) != 0; | ||
131 | } | ||
132 | |||
133 | /** | ||
134 | * ieee80211_has_a4 - check if IEEE80211_FCTL_TODS and IEEE80211_FCTL_FROMDS are set | ||
135 | * @fc: frame control bytes in little-endian byteorder | ||
136 | */ | ||
137 | static inline int ieee80211_has_a4(__le16 fc) | ||
138 | { | ||
139 | __le16 tmp = cpu_to_le16(IEEE80211_FCTL_TODS | IEEE80211_FCTL_FROMDS); | ||
140 | return (fc & tmp) == tmp; | ||
141 | } | ||
142 | |||
143 | /** | ||
144 | * ieee80211_has_morefrags - check if IEEE80211_FCTL_MOREFRAGS is set | ||
145 | * @fc: frame control bytes in little-endian byteorder | ||
146 | */ | ||
147 | static inline int ieee80211_has_morefrags(__le16 fc) | ||
148 | { | ||
149 | return (fc & cpu_to_le16(IEEE80211_FCTL_MOREFRAGS)) != 0; | ||
150 | } | ||
151 | |||
152 | /** | ||
153 | * ieee80211_has_retry - check if IEEE80211_FCTL_RETRY is set | ||
154 | * @fc: frame control bytes in little-endian byteorder | ||
155 | */ | ||
156 | static inline int ieee80211_has_retry(__le16 fc) | ||
157 | { | ||
158 | return (fc & cpu_to_le16(IEEE80211_FCTL_RETRY)) != 0; | ||
159 | } | ||
160 | |||
161 | /** | ||
162 | * ieee80211_has_pm - check if IEEE80211_FCTL_PM is set | ||
163 | * @fc: frame control bytes in little-endian byteorder | ||
164 | */ | ||
165 | static inline int ieee80211_has_pm(__le16 fc) | ||
166 | { | ||
167 | return (fc & cpu_to_le16(IEEE80211_FCTL_PM)) != 0; | ||
168 | } | ||
169 | |||
170 | /** | ||
171 | * ieee80211_has_moredata - check if IEEE80211_FCTL_MOREDATA is set | ||
172 | * @fc: frame control bytes in little-endian byteorder | ||
173 | */ | ||
174 | static inline int ieee80211_has_moredata(__le16 fc) | ||
175 | { | ||
176 | return (fc & cpu_to_le16(IEEE80211_FCTL_MOREDATA)) != 0; | ||
177 | } | ||
178 | |||
179 | /** | ||
180 | * ieee80211_has_protected - check if IEEE80211_FCTL_PROTECTED is set | ||
181 | * @fc: frame control bytes in little-endian byteorder | ||
182 | */ | ||
183 | static inline int ieee80211_has_protected(__le16 fc) | ||
184 | { | ||
185 | return (fc & cpu_to_le16(IEEE80211_FCTL_PROTECTED)) != 0; | ||
186 | } | ||
187 | |||
188 | /** | ||
189 | * ieee80211_has_order - check if IEEE80211_FCTL_ORDER is set | ||
190 | * @fc: frame control bytes in little-endian byteorder | ||
191 | */ | ||
192 | static inline int ieee80211_has_order(__le16 fc) | ||
193 | { | ||
194 | return (fc & cpu_to_le16(IEEE80211_FCTL_ORDER)) != 0; | ||
195 | } | ||
196 | |||
197 | /** | ||
198 | * ieee80211_is_mgmt - check if type is IEEE80211_FTYPE_MGMT | ||
199 | * @fc: frame control bytes in little-endian byteorder | ||
200 | */ | ||
201 | static inline int ieee80211_is_mgmt(__le16 fc) | ||
202 | { | ||
203 | return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE)) == | ||
204 | cpu_to_le16(IEEE80211_FTYPE_MGMT); | ||
205 | } | ||
206 | |||
207 | /** | ||
208 | * ieee80211_is_ctl - check if type is IEEE80211_FTYPE_CTL | ||
209 | * @fc: frame control bytes in little-endian byteorder | ||
210 | */ | ||
211 | static inline int ieee80211_is_ctl(__le16 fc) | ||
212 | { | ||
213 | return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE)) == | ||
214 | cpu_to_le16(IEEE80211_FTYPE_CTL); | ||
215 | } | ||
216 | |||
217 | /** | ||
218 | * ieee80211_is_data - check if type is IEEE80211_FTYPE_DATA | ||
219 | * @fc: frame control bytes in little-endian byteorder | ||
220 | */ | ||
221 | static inline int ieee80211_is_data(__le16 fc) | ||
222 | { | ||
223 | return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE)) == | ||
224 | cpu_to_le16(IEEE80211_FTYPE_DATA); | ||
225 | } | ||
226 | |||
227 | /** | ||
228 | * ieee80211_is_data_qos - check if type is IEEE80211_FTYPE_DATA and IEEE80211_STYPE_QOS_DATA is set | ||
229 | * @fc: frame control bytes in little-endian byteorder | ||
230 | */ | ||
231 | static inline int ieee80211_is_data_qos(__le16 fc) | ||
232 | { | ||
233 | /* | ||
234 | * mask with QOS_DATA rather than IEEE80211_FCTL_STYPE as we just need | ||
235 | * to check the one bit | ||
236 | */ | ||
237 | return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_STYPE_QOS_DATA)) == | ||
238 | cpu_to_le16(IEEE80211_FTYPE_DATA | IEEE80211_STYPE_QOS_DATA); | ||
239 | } | ||
240 | |||
241 | /** | ||
242 | * ieee80211_is_data_present - check if type is IEEE80211_FTYPE_DATA and has data | ||
243 | * @fc: frame control bytes in little-endian byteorder | ||
244 | */ | ||
245 | static inline int ieee80211_is_data_present(__le16 fc) | ||
246 | { | ||
247 | /* | ||
248 | * mask with 0x40 and test that that bit is clear to only return true | ||
249 | * for the data-containing substypes. | ||
250 | */ | ||
251 | return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | 0x40)) == | ||
252 | cpu_to_le16(IEEE80211_FTYPE_DATA); | ||
253 | } | ||
254 | |||
255 | /** | ||
256 | * ieee80211_is_assoc_req - check if IEEE80211_FTYPE_MGMT && IEEE80211_STYPE_ASSOC_REQ | ||
257 | * @fc: frame control bytes in little-endian byteorder | ||
258 | */ | ||
259 | static inline int ieee80211_is_assoc_req(__le16 fc) | ||
260 | { | ||
261 | return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) == | ||
262 | cpu_to_le16(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_ASSOC_REQ); | ||
263 | } | ||
264 | |||
265 | /** | ||
266 | * ieee80211_is_assoc_resp - check if IEEE80211_FTYPE_MGMT && IEEE80211_STYPE_ASSOC_RESP | ||
267 | * @fc: frame control bytes in little-endian byteorder | ||
268 | */ | ||
269 | static inline int ieee80211_is_assoc_resp(__le16 fc) | ||
270 | { | ||
271 | return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) == | ||
272 | cpu_to_le16(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_ASSOC_RESP); | ||
273 | } | ||
274 | |||
275 | /** | ||
276 | * ieee80211_is_reassoc_req - check if IEEE80211_FTYPE_MGMT && IEEE80211_STYPE_REASSOC_REQ | ||
277 | * @fc: frame control bytes in little-endian byteorder | ||
278 | */ | ||
279 | static inline int ieee80211_is_reassoc_req(__le16 fc) | ||
280 | { | ||
281 | return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) == | ||
282 | cpu_to_le16(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_REASSOC_REQ); | ||
283 | } | ||
284 | |||
285 | /** | ||
286 | * ieee80211_is_reassoc_resp - check if IEEE80211_FTYPE_MGMT && IEEE80211_STYPE_REASSOC_RESP | ||
287 | * @fc: frame control bytes in little-endian byteorder | ||
288 | */ | ||
289 | static inline int ieee80211_is_reassoc_resp(__le16 fc) | ||
290 | { | ||
291 | return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) == | ||
292 | cpu_to_le16(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_REASSOC_RESP); | ||
293 | } | ||
294 | |||
295 | /** | ||
296 | * ieee80211_is_probe_req - check if IEEE80211_FTYPE_MGMT && IEEE80211_STYPE_PROBE_REQ | ||
297 | * @fc: frame control bytes in little-endian byteorder | ||
298 | */ | ||
299 | static inline int ieee80211_is_probe_req(__le16 fc) | ||
300 | { | ||
301 | return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) == | ||
302 | cpu_to_le16(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_PROBE_REQ); | ||
303 | } | ||
304 | |||
305 | /** | ||
306 | * ieee80211_is_probe_resp - check if IEEE80211_FTYPE_MGMT && IEEE80211_STYPE_PROBE_RESP | ||
307 | * @fc: frame control bytes in little-endian byteorder | ||
308 | */ | ||
309 | static inline int ieee80211_is_probe_resp(__le16 fc) | ||
310 | { | ||
311 | return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) == | ||
312 | cpu_to_le16(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_PROBE_RESP); | ||
313 | } | ||
314 | |||
315 | /** | ||
316 | * ieee80211_is_beacon - check if IEEE80211_FTYPE_MGMT && IEEE80211_STYPE_BEACON | ||
317 | * @fc: frame control bytes in little-endian byteorder | ||
318 | */ | ||
319 | static inline int ieee80211_is_beacon(__le16 fc) | ||
320 | { | ||
321 | return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) == | ||
322 | cpu_to_le16(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_BEACON); | ||
323 | } | ||
324 | |||
325 | /** | ||
326 | * ieee80211_is_atim - check if IEEE80211_FTYPE_MGMT && IEEE80211_STYPE_ATIM | ||
327 | * @fc: frame control bytes in little-endian byteorder | ||
328 | */ | ||
329 | static inline int ieee80211_is_atim(__le16 fc) | ||
330 | { | ||
331 | return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) == | ||
332 | cpu_to_le16(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_ATIM); | ||
333 | } | ||
334 | |||
335 | /** | ||
336 | * ieee80211_is_disassoc - check if IEEE80211_FTYPE_MGMT && IEEE80211_STYPE_DISASSOC | ||
337 | * @fc: frame control bytes in little-endian byteorder | ||
338 | */ | ||
339 | static inline int ieee80211_is_disassoc(__le16 fc) | ||
340 | { | ||
341 | return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) == | ||
342 | cpu_to_le16(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_DISASSOC); | ||
343 | } | ||
344 | |||
345 | /** | ||
346 | * ieee80211_is_auth - check if IEEE80211_FTYPE_MGMT && IEEE80211_STYPE_AUTH | ||
347 | * @fc: frame control bytes in little-endian byteorder | ||
348 | */ | ||
349 | static inline int ieee80211_is_auth(__le16 fc) | ||
350 | { | ||
351 | return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) == | ||
352 | cpu_to_le16(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_AUTH); | ||
353 | } | ||
354 | |||
355 | /** | ||
356 | * ieee80211_is_deauth - check if IEEE80211_FTYPE_MGMT && IEEE80211_STYPE_DEAUTH | ||
357 | * @fc: frame control bytes in little-endian byteorder | ||
358 | */ | ||
359 | static inline int ieee80211_is_deauth(__le16 fc) | ||
360 | { | ||
361 | return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) == | ||
362 | cpu_to_le16(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_DEAUTH); | ||
363 | } | ||
364 | |||
365 | /** | ||
366 | * ieee80211_is_action - check if IEEE80211_FTYPE_MGMT && IEEE80211_STYPE_ACTION | ||
367 | * @fc: frame control bytes in little-endian byteorder | ||
368 | */ | ||
369 | static inline int ieee80211_is_action(__le16 fc) | ||
370 | { | ||
371 | return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) == | ||
372 | cpu_to_le16(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_ACTION); | ||
373 | } | ||
374 | |||
375 | /** | ||
376 | * ieee80211_is_back_req - check if IEEE80211_FTYPE_CTL && IEEE80211_STYPE_BACK_REQ | ||
377 | * @fc: frame control bytes in little-endian byteorder | ||
378 | */ | ||
379 | static inline int ieee80211_is_back_req(__le16 fc) | ||
380 | { | ||
381 | return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) == | ||
382 | cpu_to_le16(IEEE80211_FTYPE_CTL | IEEE80211_STYPE_BACK_REQ); | ||
383 | } | ||
384 | |||
385 | /** | ||
386 | * ieee80211_is_back - check if IEEE80211_FTYPE_CTL && IEEE80211_STYPE_BACK | ||
387 | * @fc: frame control bytes in little-endian byteorder | ||
388 | */ | ||
389 | static inline int ieee80211_is_back(__le16 fc) | ||
390 | { | ||
391 | return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) == | ||
392 | cpu_to_le16(IEEE80211_FTYPE_CTL | IEEE80211_STYPE_BACK); | ||
393 | } | ||
394 | |||
395 | /** | ||
396 | * ieee80211_is_pspoll - check if IEEE80211_FTYPE_CTL && IEEE80211_STYPE_PSPOLL | ||
397 | * @fc: frame control bytes in little-endian byteorder | ||
398 | */ | ||
399 | static inline int ieee80211_is_pspoll(__le16 fc) | ||
400 | { | ||
401 | return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) == | ||
402 | cpu_to_le16(IEEE80211_FTYPE_CTL | IEEE80211_STYPE_PSPOLL); | ||
403 | } | ||
404 | |||
405 | /** | ||
406 | * ieee80211_is_rts - check if IEEE80211_FTYPE_CTL && IEEE80211_STYPE_RTS | ||
407 | * @fc: frame control bytes in little-endian byteorder | ||
408 | */ | ||
409 | static inline int ieee80211_is_rts(__le16 fc) | ||
410 | { | ||
411 | return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) == | ||
412 | cpu_to_le16(IEEE80211_FTYPE_CTL | IEEE80211_STYPE_RTS); | ||
413 | } | ||
414 | |||
415 | /** | ||
416 | * ieee80211_is_cts - check if IEEE80211_FTYPE_CTL && IEEE80211_STYPE_CTS | ||
417 | * @fc: frame control bytes in little-endian byteorder | ||
418 | */ | ||
419 | static inline int ieee80211_is_cts(__le16 fc) | ||
420 | { | ||
421 | return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) == | ||
422 | cpu_to_le16(IEEE80211_FTYPE_CTL | IEEE80211_STYPE_CTS); | ||
423 | } | ||
424 | |||
425 | /** | ||
426 | * ieee80211_is_ack - check if IEEE80211_FTYPE_CTL && IEEE80211_STYPE_ACK | ||
427 | * @fc: frame control bytes in little-endian byteorder | ||
428 | */ | ||
429 | static inline int ieee80211_is_ack(__le16 fc) | ||
430 | { | ||
431 | return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) == | ||
432 | cpu_to_le16(IEEE80211_FTYPE_CTL | IEEE80211_STYPE_ACK); | ||
433 | } | ||
434 | |||
435 | /** | ||
436 | * ieee80211_is_cfend - check if IEEE80211_FTYPE_CTL && IEEE80211_STYPE_CFEND | ||
437 | * @fc: frame control bytes in little-endian byteorder | ||
438 | */ | ||
439 | static inline int ieee80211_is_cfend(__le16 fc) | ||
440 | { | ||
441 | return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) == | ||
442 | cpu_to_le16(IEEE80211_FTYPE_CTL | IEEE80211_STYPE_CFEND); | ||
443 | } | ||
444 | |||
445 | /** | ||
446 | * ieee80211_is_cfendack - check if IEEE80211_FTYPE_CTL && IEEE80211_STYPE_CFENDACK | ||
447 | * @fc: frame control bytes in little-endian byteorder | ||
448 | */ | ||
449 | static inline int ieee80211_is_cfendack(__le16 fc) | ||
450 | { | ||
451 | return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) == | ||
452 | cpu_to_le16(IEEE80211_FTYPE_CTL | IEEE80211_STYPE_CFENDACK); | ||
453 | } | ||
454 | |||
455 | /** | ||
456 | * ieee80211_is_nullfunc - check if FTYPE=IEEE80211_FTYPE_DATA and STYPE=IEEE80211_STYPE_NULLFUNC | ||
457 | * @fc: frame control bytes in little-endian byteorder | ||
458 | */ | ||
459 | static inline int ieee80211_is_nullfunc(__le16 fc) | ||
460 | { | ||
461 | return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) == | ||
462 | cpu_to_le16(IEEE80211_FTYPE_DATA | IEEE80211_STYPE_NULLFUNC); | ||
463 | } | ||
112 | 464 | ||
113 | struct ieee80211s_hdr { | 465 | struct ieee80211s_hdr { |
114 | u8 flags; | 466 | u8 flags; |
@@ -119,6 +471,58 @@ struct ieee80211s_hdr { | |||
119 | u8 eaddr3[6]; | 471 | u8 eaddr3[6]; |
120 | } __attribute__ ((packed)); | 472 | } __attribute__ ((packed)); |
121 | 473 | ||
474 | /* Mesh flags */ | ||
475 | #define MESH_FLAGS_AE_A4 0x1 | ||
476 | #define MESH_FLAGS_AE_A5_A6 0x2 | ||
477 | #define MESH_FLAGS_PS_DEEP 0x4 | ||
478 | |||
479 | /** | ||
480 | * struct ieee80211_quiet_ie | ||
481 | * | ||
482 | * This structure refers to "Quiet information element" | ||
483 | */ | ||
484 | struct ieee80211_quiet_ie { | ||
485 | u8 count; | ||
486 | u8 period; | ||
487 | __le16 duration; | ||
488 | __le16 offset; | ||
489 | } __attribute__ ((packed)); | ||
490 | |||
491 | /** | ||
492 | * struct ieee80211_msrment_ie | ||
493 | * | ||
494 | * This structure refers to "Measurement Request/Report information element" | ||
495 | */ | ||
496 | struct ieee80211_msrment_ie { | ||
497 | u8 token; | ||
498 | u8 mode; | ||
499 | u8 type; | ||
500 | u8 request[0]; | ||
501 | } __attribute__ ((packed)); | ||
502 | |||
503 | /** | ||
504 | * struct ieee80211_channel_sw_ie | ||
505 | * | ||
506 | * This structure refers to "Channel Switch Announcement information element" | ||
507 | */ | ||
508 | struct ieee80211_channel_sw_ie { | ||
509 | u8 mode; | ||
510 | u8 new_ch_num; | ||
511 | u8 count; | ||
512 | } __attribute__ ((packed)); | ||
513 | |||
514 | /** | ||
515 | * struct ieee80211_tim | ||
516 | * | ||
517 | * This structure refers to "Traffic Indication Map information element" | ||
518 | */ | ||
519 | struct ieee80211_tim_ie { | ||
520 | u8 dtim_count; | ||
521 | u8 dtim_period; | ||
522 | u8 bitmap_ctrl; | ||
523 | /* variable size: 1 - 251 bytes */ | ||
524 | u8 virtual_map[0]; | ||
525 | } __attribute__ ((packed)); | ||
122 | 526 | ||
123 | struct ieee80211_mgmt { | 527 | struct ieee80211_mgmt { |
124 | __le16 frame_control; | 528 | __le16 frame_control; |
@@ -194,13 +598,18 @@ struct ieee80211_mgmt { | |||
194 | u8 action_code; | 598 | u8 action_code; |
195 | u8 element_id; | 599 | u8 element_id; |
196 | u8 length; | 600 | u8 length; |
197 | u8 switch_mode; | 601 | struct ieee80211_channel_sw_ie sw_elem; |
198 | u8 new_chan; | ||
199 | u8 switch_count; | ||
200 | } __attribute__((packed)) chan_switch; | 602 | } __attribute__((packed)) chan_switch; |
201 | struct{ | 603 | struct{ |
202 | u8 action_code; | 604 | u8 action_code; |
203 | u8 dialog_token; | 605 | u8 dialog_token; |
606 | u8 element_id; | ||
607 | u8 length; | ||
608 | struct ieee80211_msrment_ie msr_elem; | ||
609 | } __attribute__((packed)) measurement; | ||
610 | struct{ | ||
611 | u8 action_code; | ||
612 | u8 dialog_token; | ||
204 | __le16 capab; | 613 | __le16 capab; |
205 | __le16 timeout; | 614 | __le16 timeout; |
206 | __le16 start_seq_num; | 615 | __le16 start_seq_num; |
@@ -239,6 +648,9 @@ struct ieee80211_mgmt { | |||
239 | } u; | 648 | } u; |
240 | } __attribute__ ((packed)); | 649 | } __attribute__ ((packed)); |
241 | 650 | ||
651 | /* mgmt header + 1 byte category code */ | ||
652 | #define IEEE80211_MIN_ACTION_SIZE offsetof(struct ieee80211_mgmt, u.action.u) | ||
653 | |||
242 | 654 | ||
243 | /* Control frames */ | 655 | /* Control frames */ |
244 | struct ieee80211_rts { | 656 | struct ieee80211_rts { |
@@ -269,6 +681,10 @@ struct ieee80211_bar { | |||
269 | __le16 start_seq_num; | 681 | __le16 start_seq_num; |
270 | } __attribute__((packed)); | 682 | } __attribute__((packed)); |
271 | 683 | ||
684 | /* 802.11 BAR control masks */ | ||
685 | #define IEEE80211_BAR_CTRL_ACK_POLICY_NORMAL 0x0000 | ||
686 | #define IEEE80211_BAR_CTRL_CBMTID_COMPRESSED_BA 0x0004 | ||
687 | |||
272 | /** | 688 | /** |
273 | * struct ieee80211_ht_cap - HT capabilities | 689 | * struct ieee80211_ht_cap - HT capabilities |
274 | * | 690 | * |
@@ -300,26 +716,55 @@ struct ieee80211_ht_addt_info { | |||
300 | 716 | ||
301 | /* 802.11n HT capabilities masks */ | 717 | /* 802.11n HT capabilities masks */ |
302 | #define IEEE80211_HT_CAP_SUP_WIDTH 0x0002 | 718 | #define IEEE80211_HT_CAP_SUP_WIDTH 0x0002 |
303 | #define IEEE80211_HT_CAP_MIMO_PS 0x000C | 719 | #define IEEE80211_HT_CAP_SM_PS 0x000C |
304 | #define IEEE80211_HT_CAP_GRN_FLD 0x0010 | 720 | #define IEEE80211_HT_CAP_GRN_FLD 0x0010 |
305 | #define IEEE80211_HT_CAP_SGI_20 0x0020 | 721 | #define IEEE80211_HT_CAP_SGI_20 0x0020 |
306 | #define IEEE80211_HT_CAP_SGI_40 0x0040 | 722 | #define IEEE80211_HT_CAP_SGI_40 0x0040 |
307 | #define IEEE80211_HT_CAP_DELAY_BA 0x0400 | 723 | #define IEEE80211_HT_CAP_DELAY_BA 0x0400 |
308 | #define IEEE80211_HT_CAP_MAX_AMSDU 0x0800 | 724 | #define IEEE80211_HT_CAP_MAX_AMSDU 0x0800 |
725 | #define IEEE80211_HT_CAP_DSSSCCK40 0x1000 | ||
726 | /* 802.11n HT capability AMPDU settings */ | ||
309 | #define IEEE80211_HT_CAP_AMPDU_FACTOR 0x03 | 727 | #define IEEE80211_HT_CAP_AMPDU_FACTOR 0x03 |
310 | #define IEEE80211_HT_CAP_AMPDU_DENSITY 0x1C | 728 | #define IEEE80211_HT_CAP_AMPDU_DENSITY 0x1C |
729 | /* 802.11n HT capability MSC set */ | ||
730 | #define IEEE80211_SUPP_MCS_SET_UEQM 4 | ||
731 | #define IEEE80211_HT_CAP_MAX_STREAMS 4 | ||
732 | #define IEEE80211_SUPP_MCS_SET_LEN 10 | ||
733 | /* maximum streams the spec allows */ | ||
734 | #define IEEE80211_HT_CAP_MCS_TX_DEFINED 0x01 | ||
735 | #define IEEE80211_HT_CAP_MCS_TX_RX_DIFF 0x02 | ||
736 | #define IEEE80211_HT_CAP_MCS_TX_STREAMS 0x0C | ||
737 | #define IEEE80211_HT_CAP_MCS_TX_UEQM 0x10 | ||
311 | /* 802.11n HT IE masks */ | 738 | /* 802.11n HT IE masks */ |
312 | #define IEEE80211_HT_IE_CHA_SEC_OFFSET 0x03 | 739 | #define IEEE80211_HT_IE_CHA_SEC_OFFSET 0x03 |
740 | #define IEEE80211_HT_IE_CHA_SEC_NONE 0x00 | ||
741 | #define IEEE80211_HT_IE_CHA_SEC_ABOVE 0x01 | ||
742 | #define IEEE80211_HT_IE_CHA_SEC_BELOW 0x03 | ||
313 | #define IEEE80211_HT_IE_CHA_WIDTH 0x04 | 743 | #define IEEE80211_HT_IE_CHA_WIDTH 0x04 |
314 | #define IEEE80211_HT_IE_HT_PROTECTION 0x0003 | 744 | #define IEEE80211_HT_IE_HT_PROTECTION 0x0003 |
315 | #define IEEE80211_HT_IE_NON_GF_STA_PRSNT 0x0004 | 745 | #define IEEE80211_HT_IE_NON_GF_STA_PRSNT 0x0004 |
316 | #define IEEE80211_HT_IE_NON_HT_STA_PRSNT 0x0010 | 746 | #define IEEE80211_HT_IE_NON_HT_STA_PRSNT 0x0010 |
317 | 747 | ||
318 | /* MIMO Power Save Modes */ | 748 | /* block-ack parameters */ |
319 | #define WLAN_HT_CAP_MIMO_PS_STATIC 0 | 749 | #define IEEE80211_ADDBA_PARAM_POLICY_MASK 0x0002 |
320 | #define WLAN_HT_CAP_MIMO_PS_DYNAMIC 1 | 750 | #define IEEE80211_ADDBA_PARAM_TID_MASK 0x003C |
321 | #define WLAN_HT_CAP_MIMO_PS_INVALID 2 | 751 | #define IEEE80211_ADDBA_PARAM_BUF_SIZE_MASK 0xFFA0 |
322 | #define WLAN_HT_CAP_MIMO_PS_DISABLED 3 | 752 | #define IEEE80211_DELBA_PARAM_TID_MASK 0xF000 |
753 | #define IEEE80211_DELBA_PARAM_INITIATOR_MASK 0x0800 | ||
754 | |||
755 | /* | ||
756 | * A-PMDU buffer sizes | ||
757 | * According to IEEE802.11n spec size varies from 8K to 64K (in powers of 2) | ||
758 | */ | ||
759 | #define IEEE80211_MIN_AMPDU_BUF 0x8 | ||
760 | #define IEEE80211_MAX_AMPDU_BUF 0x40 | ||
761 | |||
762 | |||
763 | /* Spatial Multiplexing Power Save Modes */ | ||
764 | #define WLAN_HT_CAP_SM_PS_STATIC 0 | ||
765 | #define WLAN_HT_CAP_SM_PS_DYNAMIC 1 | ||
766 | #define WLAN_HT_CAP_SM_PS_INVALID 2 | ||
767 | #define WLAN_HT_CAP_SM_PS_DISABLED 3 | ||
323 | 768 | ||
324 | /* Authentication algorithms */ | 769 | /* Authentication algorithms */ |
325 | #define WLAN_AUTH_OPEN 0 | 770 | #define WLAN_AUTH_OPEN 0 |
@@ -337,11 +782,21 @@ struct ieee80211_ht_addt_info { | |||
337 | #define WLAN_CAPABILITY_SHORT_PREAMBLE (1<<5) | 782 | #define WLAN_CAPABILITY_SHORT_PREAMBLE (1<<5) |
338 | #define WLAN_CAPABILITY_PBCC (1<<6) | 783 | #define WLAN_CAPABILITY_PBCC (1<<6) |
339 | #define WLAN_CAPABILITY_CHANNEL_AGILITY (1<<7) | 784 | #define WLAN_CAPABILITY_CHANNEL_AGILITY (1<<7) |
785 | |||
340 | /* 802.11h */ | 786 | /* 802.11h */ |
341 | #define WLAN_CAPABILITY_SPECTRUM_MGMT (1<<8) | 787 | #define WLAN_CAPABILITY_SPECTRUM_MGMT (1<<8) |
342 | #define WLAN_CAPABILITY_QOS (1<<9) | 788 | #define WLAN_CAPABILITY_QOS (1<<9) |
343 | #define WLAN_CAPABILITY_SHORT_SLOT_TIME (1<<10) | 789 | #define WLAN_CAPABILITY_SHORT_SLOT_TIME (1<<10) |
344 | #define WLAN_CAPABILITY_DSSS_OFDM (1<<13) | 790 | #define WLAN_CAPABILITY_DSSS_OFDM (1<<13) |
791 | /* measurement */ | ||
792 | #define IEEE80211_SPCT_MSR_RPRT_MODE_LATE (1<<0) | ||
793 | #define IEEE80211_SPCT_MSR_RPRT_MODE_INCAPABLE (1<<1) | ||
794 | #define IEEE80211_SPCT_MSR_RPRT_MODE_REFUSED (1<<2) | ||
795 | |||
796 | #define IEEE80211_SPCT_MSR_RPRT_TYPE_BASIC 0 | ||
797 | #define IEEE80211_SPCT_MSR_RPRT_TYPE_CCA 1 | ||
798 | #define IEEE80211_SPCT_MSR_RPRT_TYPE_RPI 2 | ||
799 | |||
345 | 800 | ||
346 | /* 802.11g ERP information element */ | 801 | /* 802.11g ERP information element */ |
347 | #define WLAN_ERP_NON_ERP_PRESENT (1<<0) | 802 | #define WLAN_ERP_NON_ERP_PRESENT (1<<0) |
@@ -512,6 +967,15 @@ enum ieee80211_category { | |||
512 | WLAN_CATEGORY_WMM = 17, | 967 | WLAN_CATEGORY_WMM = 17, |
513 | }; | 968 | }; |
514 | 969 | ||
970 | /* SPECTRUM_MGMT action code */ | ||
971 | enum ieee80211_spectrum_mgmt_actioncode { | ||
972 | WLAN_ACTION_SPCT_MSR_REQ = 0, | ||
973 | WLAN_ACTION_SPCT_MSR_RPRT = 1, | ||
974 | WLAN_ACTION_SPCT_TPC_REQ = 2, | ||
975 | WLAN_ACTION_SPCT_TPC_RPRT = 3, | ||
976 | WLAN_ACTION_SPCT_CHL_SWITCH = 4, | ||
977 | }; | ||
978 | |||
515 | /* BACK action code */ | 979 | /* BACK action code */ |
516 | enum ieee80211_back_actioncode { | 980 | enum ieee80211_back_actioncode { |
517 | WLAN_ACTION_ADDBA_REQ = 0, | 981 | WLAN_ACTION_ADDBA_REQ = 0, |
@@ -540,63 +1004,57 @@ enum ieee80211_back_parties { | |||
540 | #define WLAN_MAX_KEY_LEN 32 | 1004 | #define WLAN_MAX_KEY_LEN 32 |
541 | 1005 | ||
542 | /** | 1006 | /** |
1007 | * ieee80211_get_qos_ctl - get pointer to qos control bytes | ||
1008 | * @hdr: the frame | ||
1009 | * | ||
1010 | * The qos ctrl bytes come after the frame_control, duration, seq_num | ||
1011 | * and 3 or 4 addresses of length ETH_ALEN. | ||
1012 | * 3 addr: 2 + 2 + 2 + 3*6 = 24 | ||
1013 | * 4 addr: 2 + 2 + 2 + 4*6 = 30 | ||
1014 | */ | ||
1015 | static inline u8 *ieee80211_get_qos_ctl(struct ieee80211_hdr *hdr) | ||
1016 | { | ||
1017 | if (ieee80211_has_a4(hdr->frame_control)) | ||
1018 | return (u8 *)hdr + 30; | ||
1019 | else | ||
1020 | return (u8 *)hdr + 24; | ||
1021 | } | ||
1022 | |||
1023 | /** | ||
543 | * ieee80211_get_SA - get pointer to SA | 1024 | * ieee80211_get_SA - get pointer to SA |
1025 | * @hdr: the frame | ||
544 | * | 1026 | * |
545 | * Given an 802.11 frame, this function returns the offset | 1027 | * Given an 802.11 frame, this function returns the offset |
546 | * to the source address (SA). It does not verify that the | 1028 | * to the source address (SA). It does not verify that the |
547 | * header is long enough to contain the address, and the | 1029 | * header is long enough to contain the address, and the |
548 | * header must be long enough to contain the frame control | 1030 | * header must be long enough to contain the frame control |
549 | * field. | 1031 | * field. |
550 | * | ||
551 | * @hdr: the frame | ||
552 | */ | 1032 | */ |
553 | static inline u8 *ieee80211_get_SA(struct ieee80211_hdr *hdr) | 1033 | static inline u8 *ieee80211_get_SA(struct ieee80211_hdr *hdr) |
554 | { | 1034 | { |
555 | u8 *raw = (u8 *) hdr; | 1035 | if (ieee80211_has_a4(hdr->frame_control)) |
556 | u8 tofrom = (*(raw+1)) & 3; /* get the TODS and FROMDS bits */ | 1036 | return hdr->addr4; |
557 | 1037 | if (ieee80211_has_fromds(hdr->frame_control)) | |
558 | switch (tofrom) { | 1038 | return hdr->addr3; |
559 | case 2: | ||
560 | return hdr->addr3; | ||
561 | case 3: | ||
562 | return hdr->addr4; | ||
563 | } | ||
564 | return hdr->addr2; | 1039 | return hdr->addr2; |
565 | } | 1040 | } |
566 | 1041 | ||
567 | /** | 1042 | /** |
568 | * ieee80211_get_DA - get pointer to DA | 1043 | * ieee80211_get_DA - get pointer to DA |
1044 | * @hdr: the frame | ||
569 | * | 1045 | * |
570 | * Given an 802.11 frame, this function returns the offset | 1046 | * Given an 802.11 frame, this function returns the offset |
571 | * to the destination address (DA). It does not verify that | 1047 | * to the destination address (DA). It does not verify that |
572 | * the header is long enough to contain the address, and the | 1048 | * the header is long enough to contain the address, and the |
573 | * header must be long enough to contain the frame control | 1049 | * header must be long enough to contain the frame control |
574 | * field. | 1050 | * field. |
575 | * | ||
576 | * @hdr: the frame | ||
577 | */ | 1051 | */ |
578 | static inline u8 *ieee80211_get_DA(struct ieee80211_hdr *hdr) | 1052 | static inline u8 *ieee80211_get_DA(struct ieee80211_hdr *hdr) |
579 | { | 1053 | { |
580 | u8 *raw = (u8 *) hdr; | 1054 | if (ieee80211_has_tods(hdr->frame_control)) |
581 | u8 to_ds = (*(raw+1)) & 1; /* get the TODS bit */ | ||
582 | |||
583 | if (to_ds) | ||
584 | return hdr->addr3; | 1055 | return hdr->addr3; |
585 | return hdr->addr1; | 1056 | else |
586 | } | 1057 | return hdr->addr1; |
587 | |||
588 | /** | ||
589 | * ieee80211_get_morefrag - determine whether the MOREFRAGS bit is set | ||
590 | * | ||
591 | * This function determines whether the "more fragments" bit is set | ||
592 | * in the frame. | ||
593 | * | ||
594 | * @hdr: the frame | ||
595 | */ | ||
596 | static inline int ieee80211_get_morefrag(struct ieee80211_hdr *hdr) | ||
597 | { | ||
598 | return (le16_to_cpu(hdr->frame_control) & | ||
599 | IEEE80211_FCTL_MOREFRAGS) != 0; | ||
600 | } | 1058 | } |
601 | 1059 | ||
602 | #endif /* IEEE80211_H */ | 1060 | #endif /* IEEE80211_H */ |
diff --git a/include/linux/if.h b/include/linux/if.h index 5c9d1fa93fef..65246846c844 100644 --- a/include/linux/if.h +++ b/include/linux/if.h | |||
@@ -24,6 +24,7 @@ | |||
24 | #include <linux/compiler.h> /* for "__user" et al */ | 24 | #include <linux/compiler.h> /* for "__user" et al */ |
25 | 25 | ||
26 | #define IFNAMSIZ 16 | 26 | #define IFNAMSIZ 16 |
27 | #define IFALIASZ 256 | ||
27 | #include <linux/hdlc/ioctl.h> | 28 | #include <linux/hdlc/ioctl.h> |
28 | 29 | ||
29 | /* Standard interface flags (netdevice->flags). */ | 30 | /* Standard interface flags (netdevice->flags). */ |
diff --git a/include/linux/if_bridge.h b/include/linux/if_bridge.h index 950e13d09e06..6badb3e2c4e4 100644 --- a/include/linux/if_bridge.h +++ b/include/linux/if_bridge.h | |||
@@ -4,8 +4,6 @@ | |||
4 | * Authors: | 4 | * Authors: |
5 | * Lennert Buytenhek <buytenh@gnu.org> | 5 | * Lennert Buytenhek <buytenh@gnu.org> |
6 | * | 6 | * |
7 | * $Id: if_bridge.h,v 1.1 2000/02/18 16:47:01 davem Exp $ | ||
8 | * | ||
9 | * This program is free software; you can redistribute it and/or | 7 | * This program is free software; you can redistribute it and/or |
10 | * modify it under the terms of the GNU General Public License | 8 | * modify it under the terms of the GNU General Public License |
11 | * as published by the Free Software Foundation; either version | 9 | * as published by the Free Software Foundation; either version |
diff --git a/include/linux/if_ether.h b/include/linux/if_ether.h index e157c1399b61..7f3c735f422b 100644 --- a/include/linux/if_ether.h +++ b/include/linux/if_ether.h | |||
@@ -9,7 +9,7 @@ | |||
9 | * | 9 | * |
10 | * Author: Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG> | 10 | * Author: Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG> |
11 | * Donald Becker, <becker@super.org> | 11 | * Donald Becker, <becker@super.org> |
12 | * Alan Cox, <alan@redhat.com> | 12 | * Alan Cox, <alan@lxorguk.ukuu.org.uk> |
13 | * Steve Whitehouse, <gw7rrm@eeshack3.swan.ac.uk> | 13 | * Steve Whitehouse, <gw7rrm@eeshack3.swan.ac.uk> |
14 | * | 14 | * |
15 | * This program is free software; you can redistribute it and/or | 15 | * This program is free software; you can redistribute it and/or |
@@ -56,6 +56,7 @@ | |||
56 | #define ETH_P_DIAG 0x6005 /* DEC Diagnostics */ | 56 | #define ETH_P_DIAG 0x6005 /* DEC Diagnostics */ |
57 | #define ETH_P_CUST 0x6006 /* DEC Customer use */ | 57 | #define ETH_P_CUST 0x6006 /* DEC Customer use */ |
58 | #define ETH_P_SCA 0x6007 /* DEC Systems Comms Arch */ | 58 | #define ETH_P_SCA 0x6007 /* DEC Systems Comms Arch */ |
59 | #define ETH_P_TEB 0x6558 /* Trans Ether Bridging */ | ||
59 | #define ETH_P_RARP 0x8035 /* Reverse Addr Res packet */ | 60 | #define ETH_P_RARP 0x8035 /* Reverse Addr Res packet */ |
60 | #define ETH_P_ATALK 0x809B /* Appletalk DDP */ | 61 | #define ETH_P_ATALK 0x809B /* Appletalk DDP */ |
61 | #define ETH_P_AARP 0x80F3 /* Appletalk AARP */ | 62 | #define ETH_P_AARP 0x80F3 /* Appletalk AARP */ |
@@ -74,8 +75,10 @@ | |||
74 | #define ETH_P_ATMFATE 0x8884 /* Frame-based ATM Transport | 75 | #define ETH_P_ATMFATE 0x8884 /* Frame-based ATM Transport |
75 | * over Ethernet | 76 | * over Ethernet |
76 | */ | 77 | */ |
78 | #define ETH_P_PAE 0x888E /* Port Access Entity (IEEE 802.1X) */ | ||
77 | #define ETH_P_AOE 0x88A2 /* ATA over Ethernet */ | 79 | #define ETH_P_AOE 0x88A2 /* ATA over Ethernet */ |
78 | #define ETH_P_TIPC 0x88CA /* TIPC */ | 80 | #define ETH_P_TIPC 0x88CA /* TIPC */ |
81 | #define ETH_P_EDSA 0xDADA /* Ethertype DSA [ NOT AN OFFICIALLY REGISTERED ID ] */ | ||
79 | 82 | ||
80 | /* | 83 | /* |
81 | * Non DIX types. Won't clash for 1500 types. | 84 | * Non DIX types. Won't clash for 1500 types. |
@@ -99,6 +102,9 @@ | |||
99 | #define ETH_P_ECONET 0x0018 /* Acorn Econet */ | 102 | #define ETH_P_ECONET 0x0018 /* Acorn Econet */ |
100 | #define ETH_P_HDLC 0x0019 /* HDLC frames */ | 103 | #define ETH_P_HDLC 0x0019 /* HDLC frames */ |
101 | #define ETH_P_ARCNET 0x001A /* 1A for ArcNet :-) */ | 104 | #define ETH_P_ARCNET 0x001A /* 1A for ArcNet :-) */ |
105 | #define ETH_P_DSA 0x001B /* Distributed Switch Arch. */ | ||
106 | #define ETH_P_TRAILER 0x001C /* Trailer switch tagging */ | ||
107 | #define ETH_P_PHONET 0x00F5 /* Nokia Phonet frames */ | ||
102 | 108 | ||
103 | /* | 109 | /* |
104 | * This is an Ethernet frame header. | 110 | * This is an Ethernet frame header. |
diff --git a/include/linux/if_fddi.h b/include/linux/if_fddi.h index ae77daed6c2f..45de1046dbbf 100644 --- a/include/linux/if_fddi.h +++ b/include/linux/if_fddi.h | |||
@@ -12,7 +12,7 @@ | |||
12 | * if_fddi.h is based on previous if_ether.h and if_tr.h work by | 12 | * if_fddi.h is based on previous if_ether.h and if_tr.h work by |
13 | * Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG> | 13 | * Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG> |
14 | * Donald Becker, <becker@super.org> | 14 | * Donald Becker, <becker@super.org> |
15 | * Alan Cox, <alan@redhat.com> | 15 | * Alan Cox, <alan@lxorguk.ukuu.org.uk> |
16 | * Steve Whitehouse, <gw7rrm@eeshack3.swan.ac.uk> | 16 | * Steve Whitehouse, <gw7rrm@eeshack3.swan.ac.uk> |
17 | * Peter De Schrijver, <stud11@cc4.kuleuven.ac.be> | 17 | * Peter De Schrijver, <stud11@cc4.kuleuven.ac.be> |
18 | * | 18 | * |
diff --git a/include/linux/if_hippi.h b/include/linux/if_hippi.h index 94d31ca7d71a..f0f23516bb59 100644 --- a/include/linux/if_hippi.h +++ b/include/linux/if_hippi.h | |||
@@ -9,7 +9,7 @@ | |||
9 | * | 9 | * |
10 | * Author: Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG> | 10 | * Author: Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG> |
11 | * Donald Becker, <becker@super.org> | 11 | * Donald Becker, <becker@super.org> |
12 | * Alan Cox, <alan@redhat.com> | 12 | * Alan Cox, <alan@lxorguk.ukuu.org.uk> |
13 | * Steve Whitehouse, <gw7rrm@eeshack3.swan.ac.uk> | 13 | * Steve Whitehouse, <gw7rrm@eeshack3.swan.ac.uk> |
14 | * Jes Sorensen, <Jes.Sorensen@cern.ch> | 14 | * Jes Sorensen, <Jes.Sorensen@cern.ch> |
15 | * | 15 | * |
diff --git a/include/linux/if_link.h b/include/linux/if_link.h index 84c3492ae5cb..f9032c88716a 100644 --- a/include/linux/if_link.h +++ b/include/linux/if_link.h | |||
@@ -79,6 +79,7 @@ enum | |||
79 | IFLA_LINKINFO, | 79 | IFLA_LINKINFO, |
80 | #define IFLA_LINKINFO IFLA_LINKINFO | 80 | #define IFLA_LINKINFO IFLA_LINKINFO |
81 | IFLA_NET_NS_PID, | 81 | IFLA_NET_NS_PID, |
82 | IFLA_IFALIAS, | ||
82 | __IFLA_MAX | 83 | __IFLA_MAX |
83 | }; | 84 | }; |
84 | 85 | ||
diff --git a/include/linux/if_packet.h b/include/linux/if_packet.h index ad09609227ff..18db0668065a 100644 --- a/include/linux/if_packet.h +++ b/include/linux/if_packet.h | |||
@@ -43,6 +43,9 @@ struct sockaddr_ll | |||
43 | #define PACKET_COPY_THRESH 7 | 43 | #define PACKET_COPY_THRESH 7 |
44 | #define PACKET_AUXDATA 8 | 44 | #define PACKET_AUXDATA 8 |
45 | #define PACKET_ORIGDEV 9 | 45 | #define PACKET_ORIGDEV 9 |
46 | #define PACKET_VERSION 10 | ||
47 | #define PACKET_HDRLEN 11 | ||
48 | #define PACKET_RESERVE 12 | ||
46 | 49 | ||
47 | struct tpacket_stats | 50 | struct tpacket_stats |
48 | { | 51 | { |
@@ -57,6 +60,7 @@ struct tpacket_auxdata | |||
57 | __u32 tp_snaplen; | 60 | __u32 tp_snaplen; |
58 | __u16 tp_mac; | 61 | __u16 tp_mac; |
59 | __u16 tp_net; | 62 | __u16 tp_net; |
63 | __u16 tp_vlan_tci; | ||
60 | }; | 64 | }; |
61 | 65 | ||
62 | struct tpacket_hdr | 66 | struct tpacket_hdr |
@@ -79,6 +83,26 @@ struct tpacket_hdr | |||
79 | #define TPACKET_ALIGN(x) (((x)+TPACKET_ALIGNMENT-1)&~(TPACKET_ALIGNMENT-1)) | 83 | #define TPACKET_ALIGN(x) (((x)+TPACKET_ALIGNMENT-1)&~(TPACKET_ALIGNMENT-1)) |
80 | #define TPACKET_HDRLEN (TPACKET_ALIGN(sizeof(struct tpacket_hdr)) + sizeof(struct sockaddr_ll)) | 84 | #define TPACKET_HDRLEN (TPACKET_ALIGN(sizeof(struct tpacket_hdr)) + sizeof(struct sockaddr_ll)) |
81 | 85 | ||
86 | struct tpacket2_hdr | ||
87 | { | ||
88 | __u32 tp_status; | ||
89 | __u32 tp_len; | ||
90 | __u32 tp_snaplen; | ||
91 | __u16 tp_mac; | ||
92 | __u16 tp_net; | ||
93 | __u32 tp_sec; | ||
94 | __u32 tp_nsec; | ||
95 | __u16 tp_vlan_tci; | ||
96 | }; | ||
97 | |||
98 | #define TPACKET2_HDRLEN (TPACKET_ALIGN(sizeof(struct tpacket2_hdr)) + sizeof(struct sockaddr_ll)) | ||
99 | |||
100 | enum tpacket_versions | ||
101 | { | ||
102 | TPACKET_V1, | ||
103 | TPACKET_V2, | ||
104 | }; | ||
105 | |||
82 | /* | 106 | /* |
83 | Frame structure: | 107 | Frame structure: |
84 | 108 | ||
diff --git a/include/linux/if_phonet.h b/include/linux/if_phonet.h new file mode 100644 index 000000000000..d70034bcec05 --- /dev/null +++ b/include/linux/if_phonet.h | |||
@@ -0,0 +1,19 @@ | |||
1 | /* | ||
2 | * File: if_phonet.h | ||
3 | * | ||
4 | * Phonet interface kernel definitions | ||
5 | * | ||
6 | * Copyright (C) 2008 Nokia Corporation. All rights reserved. | ||
7 | */ | ||
8 | #ifndef LINUX_IF_PHONET_H | ||
9 | #define LINUX_IF_PHONET_H | ||
10 | |||
11 | #define PHONET_MIN_MTU 6 /* pn_length = 0 */ | ||
12 | #define PHONET_MAX_MTU 65541 /* pn_length = 0xffff */ | ||
13 | #define PHONET_DEV_MTU PHONET_MAX_MTU | ||
14 | |||
15 | #ifdef __KERNEL__ | ||
16 | extern struct header_ops phonet_header_ops; | ||
17 | #endif | ||
18 | |||
19 | #endif | ||
diff --git a/include/linux/if_ppp.h b/include/linux/if_ppp.h index 0f2f70d4e48c..c3b1f8562709 100644 --- a/include/linux/if_ppp.h +++ b/include/linux/if_ppp.h | |||
@@ -1,5 +1,3 @@ | |||
1 | /* $Id: if_ppp.h,v 1.21 2000/03/27 06:03:36 paulus Exp $ */ | ||
2 | |||
3 | /* | 1 | /* |
4 | * if_ppp.h - Point-to-Point Protocol definitions. | 2 | * if_ppp.h - Point-to-Point Protocol definitions. |
5 | * | 3 | * |
diff --git a/include/linux/if_tun.h b/include/linux/if_tun.h index 8c71fe2fb1f5..8529f57ba263 100644 --- a/include/linux/if_tun.h +++ b/include/linux/if_tun.h | |||
@@ -11,14 +11,13 @@ | |||
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | * GNU General Public License for more details. | 13 | * GNU General Public License for more details. |
14 | * | ||
15 | * $Id: if_tun.h,v 1.2 2001/06/01 18:39:47 davem Exp $ | ||
16 | */ | 14 | */ |
17 | 15 | ||
18 | #ifndef __IF_TUN_H | 16 | #ifndef __IF_TUN_H |
19 | #define __IF_TUN_H | 17 | #define __IF_TUN_H |
20 | 18 | ||
21 | #include <linux/types.h> | 19 | #include <linux/types.h> |
20 | #include <linux/if_ether.h> | ||
22 | 21 | ||
23 | /* Read queue size */ | 22 | /* Read queue size */ |
24 | #define TUN_READQ_SIZE 500 | 23 | #define TUN_READQ_SIZE 500 |
@@ -33,6 +32,7 @@ | |||
33 | #define TUN_NO_PI 0x0040 | 32 | #define TUN_NO_PI 0x0040 |
34 | #define TUN_ONE_QUEUE 0x0080 | 33 | #define TUN_ONE_QUEUE 0x0080 |
35 | #define TUN_PERSIST 0x0100 | 34 | #define TUN_PERSIST 0x0100 |
35 | #define TUN_VNET_HDR 0x0200 | ||
36 | 36 | ||
37 | /* Ioctl defines */ | 37 | /* Ioctl defines */ |
38 | #define TUNSETNOCSUM _IOW('T', 200, int) | 38 | #define TUNSETNOCSUM _IOW('T', 200, int) |
@@ -42,17 +42,44 @@ | |||
42 | #define TUNSETOWNER _IOW('T', 204, int) | 42 | #define TUNSETOWNER _IOW('T', 204, int) |
43 | #define TUNSETLINK _IOW('T', 205, int) | 43 | #define TUNSETLINK _IOW('T', 205, int) |
44 | #define TUNSETGROUP _IOW('T', 206, int) | 44 | #define TUNSETGROUP _IOW('T', 206, int) |
45 | #define TUNGETFEATURES _IOR('T', 207, unsigned int) | ||
46 | #define TUNSETOFFLOAD _IOW('T', 208, unsigned int) | ||
47 | #define TUNSETTXFILTER _IOW('T', 209, unsigned int) | ||
48 | #define TUNGETIFF _IOR('T', 210, unsigned int) | ||
45 | 49 | ||
46 | /* TUNSETIFF ifr flags */ | 50 | /* TUNSETIFF ifr flags */ |
47 | #define IFF_TUN 0x0001 | 51 | #define IFF_TUN 0x0001 |
48 | #define IFF_TAP 0x0002 | 52 | #define IFF_TAP 0x0002 |
49 | #define IFF_NO_PI 0x1000 | 53 | #define IFF_NO_PI 0x1000 |
50 | #define IFF_ONE_QUEUE 0x2000 | 54 | #define IFF_ONE_QUEUE 0x2000 |
55 | #define IFF_VNET_HDR 0x4000 | ||
56 | |||
57 | /* Features for GSO (TUNSETOFFLOAD). */ | ||
58 | #define TUN_F_CSUM 0x01 /* You can hand me unchecksummed packets. */ | ||
59 | #define TUN_F_TSO4 0x02 /* I can handle TSO for IPv4 packets */ | ||
60 | #define TUN_F_TSO6 0x04 /* I can handle TSO for IPv6 packets */ | ||
61 | #define TUN_F_TSO_ECN 0x08 /* I can handle TSO with ECN bits. */ | ||
51 | 62 | ||
63 | /* Protocol info prepended to the packets (when IFF_NO_PI is not set) */ | ||
64 | #define TUN_PKT_STRIP 0x0001 | ||
52 | struct tun_pi { | 65 | struct tun_pi { |
53 | unsigned short flags; | 66 | __u16 flags; |
54 | __be16 proto; | 67 | __be16 proto; |
55 | }; | 68 | }; |
56 | #define TUN_PKT_STRIP 0x0001 | 69 | |
70 | /* | ||
71 | * Filter spec (used for SETXXFILTER ioctls) | ||
72 | * This stuff is applicable only to the TAP (Ethernet) devices. | ||
73 | * If the count is zero the filter is disabled and the driver accepts | ||
74 | * all packets (promisc mode). | ||
75 | * If the filter is enabled in order to accept broadcast packets | ||
76 | * broadcast addr must be explicitly included in the addr list. | ||
77 | */ | ||
78 | #define TUN_FLT_ALLMULTI 0x0001 /* Accept all multicast packets */ | ||
79 | struct tun_filter { | ||
80 | __u16 flags; /* TUN_FLT_ flags see above */ | ||
81 | __u16 count; /* Number of addresses */ | ||
82 | __u8 addr[0][ETH_ALEN]; | ||
83 | }; | ||
57 | 84 | ||
58 | #endif /* __IF_TUN_H */ | 85 | #endif /* __IF_TUN_H */ |
diff --git a/include/linux/if_tunnel.h b/include/linux/if_tunnel.h index d4efe4014705..aeab2cb32a9c 100644 --- a/include/linux/if_tunnel.h +++ b/include/linux/if_tunnel.h | |||
@@ -2,6 +2,7 @@ | |||
2 | #define _IF_TUNNEL_H_ | 2 | #define _IF_TUNNEL_H_ |
3 | 3 | ||
4 | #include <linux/types.h> | 4 | #include <linux/types.h> |
5 | #include <linux/ip.h> | ||
5 | 6 | ||
6 | #define SIOCGETTUNNEL (SIOCDEVPRIVATE + 0) | 7 | #define SIOCGETTUNNEL (SIOCDEVPRIVATE + 0) |
7 | #define SIOCADDTUNNEL (SIOCDEVPRIVATE + 1) | 8 | #define SIOCADDTUNNEL (SIOCDEVPRIVATE + 1) |
@@ -47,4 +48,22 @@ struct ip_tunnel_prl { | |||
47 | /* PRL flags */ | 48 | /* PRL flags */ |
48 | #define PRL_DEFAULT 0x0001 | 49 | #define PRL_DEFAULT 0x0001 |
49 | 50 | ||
51 | enum | ||
52 | { | ||
53 | IFLA_GRE_UNSPEC, | ||
54 | IFLA_GRE_LINK, | ||
55 | IFLA_GRE_IFLAGS, | ||
56 | IFLA_GRE_OFLAGS, | ||
57 | IFLA_GRE_IKEY, | ||
58 | IFLA_GRE_OKEY, | ||
59 | IFLA_GRE_LOCAL, | ||
60 | IFLA_GRE_REMOTE, | ||
61 | IFLA_GRE_TTL, | ||
62 | IFLA_GRE_TOS, | ||
63 | IFLA_GRE_PMTUDISC, | ||
64 | __IFLA_GRE_MAX, | ||
65 | }; | ||
66 | |||
67 | #define IFLA_GRE_MAX (__IFLA_GRE_MAX - 1) | ||
68 | |||
50 | #endif /* _IF_TUNNEL_H_ */ | 69 | #endif /* _IF_TUNNEL_H_ */ |
diff --git a/include/linux/if_vlan.h b/include/linux/if_vlan.h index 15ace02b7b24..9e7b49b8062d 100644 --- a/include/linux/if_vlan.h +++ b/include/linux/if_vlan.h | |||
@@ -14,10 +14,6 @@ | |||
14 | #define _LINUX_IF_VLAN_H_ | 14 | #define _LINUX_IF_VLAN_H_ |
15 | 15 | ||
16 | #ifdef __KERNEL__ | 16 | #ifdef __KERNEL__ |
17 | |||
18 | /* externally defined structs */ | ||
19 | struct hlist_node; | ||
20 | |||
21 | #include <linux/netdevice.h> | 17 | #include <linux/netdevice.h> |
22 | #include <linux/etherdevice.h> | 18 | #include <linux/etherdevice.h> |
23 | 19 | ||
@@ -91,7 +87,7 @@ struct vlan_group { | |||
91 | }; | 87 | }; |
92 | 88 | ||
93 | static inline struct net_device *vlan_group_get_device(struct vlan_group *vg, | 89 | static inline struct net_device *vlan_group_get_device(struct vlan_group *vg, |
94 | unsigned int vlan_id) | 90 | u16 vlan_id) |
95 | { | 91 | { |
96 | struct net_device **array; | 92 | struct net_device **array; |
97 | array = vg->vlan_devices_arrays[vlan_id / VLAN_GROUP_ARRAY_PART_LEN]; | 93 | array = vg->vlan_devices_arrays[vlan_id / VLAN_GROUP_ARRAY_PART_LEN]; |
@@ -99,7 +95,7 @@ static inline struct net_device *vlan_group_get_device(struct vlan_group *vg, | |||
99 | } | 95 | } |
100 | 96 | ||
101 | static inline void vlan_group_set_device(struct vlan_group *vg, | 97 | static inline void vlan_group_set_device(struct vlan_group *vg, |
102 | unsigned int vlan_id, | 98 | u16 vlan_id, |
103 | struct net_device *dev) | 99 | struct net_device *dev) |
104 | { | 100 | { |
105 | struct net_device **array; | 101 | struct net_device **array; |
@@ -109,164 +105,81 @@ static inline void vlan_group_set_device(struct vlan_group *vg, | |||
109 | array[vlan_id % VLAN_GROUP_ARRAY_PART_LEN] = dev; | 105 | array[vlan_id % VLAN_GROUP_ARRAY_PART_LEN] = dev; |
110 | } | 106 | } |
111 | 107 | ||
112 | struct vlan_priority_tci_mapping { | 108 | #define vlan_tx_tag_present(__skb) ((__skb)->vlan_tci) |
113 | u32 priority; | 109 | #define vlan_tx_tag_get(__skb) ((__skb)->vlan_tci) |
114 | unsigned short vlan_qos; /* This should be shifted when first set, so we only do it | ||
115 | * at provisioning time. | ||
116 | * ((skb->priority << 13) & 0xE000) | ||
117 | */ | ||
118 | struct vlan_priority_tci_mapping *next; | ||
119 | }; | ||
120 | 110 | ||
121 | /* Holds information that makes sense if this device is a VLAN device. */ | 111 | #if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE) |
122 | struct vlan_dev_info { | 112 | extern struct net_device *vlan_dev_real_dev(const struct net_device *dev); |
123 | /** This will be the mapping that correlates skb->priority to | 113 | extern u16 vlan_dev_vlan_id(const struct net_device *dev); |
124 | * 3 bits of VLAN QOS tags... | ||
125 | */ | ||
126 | unsigned int nr_ingress_mappings; | ||
127 | u32 ingress_priority_map[8]; | ||
128 | |||
129 | unsigned int nr_egress_mappings; | ||
130 | struct vlan_priority_tci_mapping *egress_priority_map[16]; /* hash table */ | ||
131 | |||
132 | unsigned short vlan_id; /* The VLAN Identifier for this interface. */ | ||
133 | unsigned short flags; /* (1 << 0) re_order_header This option will cause the | ||
134 | * VLAN code to move around the ethernet header on | ||
135 | * ingress to make the skb look **exactly** like it | ||
136 | * came in from an ethernet port. This destroys some of | ||
137 | * the VLAN information in the skb, but it fixes programs | ||
138 | * like DHCP that use packet-filtering and don't understand | ||
139 | * 802.1Q | ||
140 | */ | ||
141 | struct net_device *real_dev; /* the underlying device/interface */ | ||
142 | unsigned char real_dev_addr[ETH_ALEN]; | ||
143 | struct proc_dir_entry *dent; /* Holds the proc data */ | ||
144 | unsigned long cnt_inc_headroom_on_tx; /* How many times did we have to grow the skb on TX. */ | ||
145 | unsigned long cnt_encap_on_xmit; /* How many times did we have to encapsulate the skb on TX. */ | ||
146 | }; | ||
147 | 114 | ||
148 | static inline struct vlan_dev_info *vlan_dev_info(const struct net_device *dev) | 115 | extern int __vlan_hwaccel_rx(struct sk_buff *skb, struct vlan_group *grp, |
116 | u16 vlan_tci, int polling); | ||
117 | #else | ||
118 | static inline struct net_device *vlan_dev_real_dev(const struct net_device *dev) | ||
149 | { | 119 | { |
150 | return netdev_priv(dev); | 120 | BUG(); |
121 | return NULL; | ||
151 | } | 122 | } |
152 | 123 | ||
153 | /* inline functions */ | 124 | static inline u16 vlan_dev_vlan_id(const struct net_device *dev) |
154 | static inline __u32 vlan_get_ingress_priority(struct net_device *dev, | ||
155 | unsigned short vlan_tag) | ||
156 | { | 125 | { |
157 | struct vlan_dev_info *vip = vlan_dev_info(dev); | 126 | BUG(); |
158 | 127 | return 0; | |
159 | return vip->ingress_priority_map[(vlan_tag >> 13) & 0x7]; | ||
160 | } | 128 | } |
161 | 129 | ||
162 | /* VLAN tx hw acceleration helpers. */ | 130 | static inline int __vlan_hwaccel_rx(struct sk_buff *skb, struct vlan_group *grp, |
163 | struct vlan_skb_tx_cookie { | 131 | u16 vlan_tci, int polling) |
164 | u32 magic; | ||
165 | u32 vlan_tag; | ||
166 | }; | ||
167 | |||
168 | #define VLAN_TX_COOKIE_MAGIC 0x564c414e /* "VLAN" in ascii. */ | ||
169 | #define VLAN_TX_SKB_CB(__skb) ((struct vlan_skb_tx_cookie *)&((__skb)->cb[0])) | ||
170 | #define vlan_tx_tag_present(__skb) \ | ||
171 | (VLAN_TX_SKB_CB(__skb)->magic == VLAN_TX_COOKIE_MAGIC) | ||
172 | #define vlan_tx_tag_get(__skb) (VLAN_TX_SKB_CB(__skb)->vlan_tag) | ||
173 | |||
174 | /* VLAN rx hw acceleration helper. This acts like netif_{rx,receive_skb}(). */ | ||
175 | static inline int __vlan_hwaccel_rx(struct sk_buff *skb, | ||
176 | struct vlan_group *grp, | ||
177 | unsigned short vlan_tag, int polling) | ||
178 | { | 132 | { |
179 | struct net_device_stats *stats; | 133 | BUG(); |
180 | 134 | return NET_XMIT_SUCCESS; | |
181 | if (skb_bond_should_drop(skb)) { | ||
182 | dev_kfree_skb_any(skb); | ||
183 | return NET_RX_DROP; | ||
184 | } | ||
185 | |||
186 | skb->dev = vlan_group_get_device(grp, vlan_tag & VLAN_VID_MASK); | ||
187 | if (skb->dev == NULL) { | ||
188 | dev_kfree_skb_any(skb); | ||
189 | |||
190 | /* Not NET_RX_DROP, this is not being dropped | ||
191 | * due to congestion. | ||
192 | */ | ||
193 | return 0; | ||
194 | } | ||
195 | |||
196 | skb->dev->last_rx = jiffies; | ||
197 | |||
198 | stats = &skb->dev->stats; | ||
199 | stats->rx_packets++; | ||
200 | stats->rx_bytes += skb->len; | ||
201 | |||
202 | skb->priority = vlan_get_ingress_priority(skb->dev, vlan_tag); | ||
203 | switch (skb->pkt_type) { | ||
204 | case PACKET_BROADCAST: | ||
205 | break; | ||
206 | |||
207 | case PACKET_MULTICAST: | ||
208 | stats->multicast++; | ||
209 | break; | ||
210 | |||
211 | case PACKET_OTHERHOST: | ||
212 | /* Our lower layer thinks this is not local, let's make sure. | ||
213 | * This allows the VLAN to have a different MAC than the underlying | ||
214 | * device, and still route correctly. | ||
215 | */ | ||
216 | if (!compare_ether_addr(eth_hdr(skb)->h_dest, | ||
217 | skb->dev->dev_addr)) | ||
218 | skb->pkt_type = PACKET_HOST; | ||
219 | break; | ||
220 | }; | ||
221 | |||
222 | return (polling ? netif_receive_skb(skb) : netif_rx(skb)); | ||
223 | } | 135 | } |
136 | #endif | ||
224 | 137 | ||
138 | /** | ||
139 | * vlan_hwaccel_rx - netif_rx wrapper for VLAN RX acceleration | ||
140 | * @skb: buffer | ||
141 | * @grp: vlan group | ||
142 | * @vlan_tci: VLAN TCI as received from the card | ||
143 | */ | ||
225 | static inline int vlan_hwaccel_rx(struct sk_buff *skb, | 144 | static inline int vlan_hwaccel_rx(struct sk_buff *skb, |
226 | struct vlan_group *grp, | 145 | struct vlan_group *grp, |
227 | unsigned short vlan_tag) | 146 | u16 vlan_tci) |
228 | { | 147 | { |
229 | return __vlan_hwaccel_rx(skb, grp, vlan_tag, 0); | 148 | return __vlan_hwaccel_rx(skb, grp, vlan_tci, 0); |
230 | } | 149 | } |
231 | 150 | ||
151 | /** | ||
152 | * vlan_hwaccel_receive_skb - netif_receive_skb wrapper for VLAN RX acceleration | ||
153 | * @skb: buffer | ||
154 | * @grp: vlan group | ||
155 | * @vlan_tci: VLAN TCI as received from the card | ||
156 | */ | ||
232 | static inline int vlan_hwaccel_receive_skb(struct sk_buff *skb, | 157 | static inline int vlan_hwaccel_receive_skb(struct sk_buff *skb, |
233 | struct vlan_group *grp, | 158 | struct vlan_group *grp, |
234 | unsigned short vlan_tag) | 159 | u16 vlan_tci) |
235 | { | 160 | { |
236 | return __vlan_hwaccel_rx(skb, grp, vlan_tag, 1); | 161 | return __vlan_hwaccel_rx(skb, grp, vlan_tci, 1); |
237 | } | 162 | } |
238 | 163 | ||
239 | /** | 164 | /** |
240 | * __vlan_put_tag - regular VLAN tag inserting | 165 | * __vlan_put_tag - regular VLAN tag inserting |
241 | * @skb: skbuff to tag | 166 | * @skb: skbuff to tag |
242 | * @tag: VLAN tag to insert | 167 | * @vlan_tci: VLAN TCI to insert |
243 | * | 168 | * |
244 | * Inserts the VLAN tag into @skb as part of the payload | 169 | * Inserts the VLAN tag into @skb as part of the payload |
245 | * Returns a VLAN tagged skb. If a new skb is created, @skb is freed. | 170 | * Returns a VLAN tagged skb. If a new skb is created, @skb is freed. |
246 | * | 171 | * |
247 | * Following the skb_unshare() example, in case of error, the calling function | 172 | * Following the skb_unshare() example, in case of error, the calling function |
248 | * doesn't have to worry about freeing the original skb. | 173 | * doesn't have to worry about freeing the original skb. |
249 | */ | 174 | */ |
250 | static inline struct sk_buff *__vlan_put_tag(struct sk_buff *skb, unsigned short tag) | 175 | static inline struct sk_buff *__vlan_put_tag(struct sk_buff *skb, u16 vlan_tci) |
251 | { | 176 | { |
252 | struct vlan_ethhdr *veth; | 177 | struct vlan_ethhdr *veth; |
253 | 178 | ||
254 | if (skb_headroom(skb) < VLAN_HLEN) { | 179 | if (skb_cow_head(skb, VLAN_HLEN) < 0) { |
255 | struct sk_buff *sk_tmp = skb; | 180 | kfree_skb(skb); |
256 | skb = skb_realloc_headroom(sk_tmp, VLAN_HLEN); | 181 | return NULL; |
257 | kfree_skb(sk_tmp); | ||
258 | if (!skb) { | ||
259 | printk(KERN_ERR "vlan: failed to realloc headroom\n"); | ||
260 | return NULL; | ||
261 | } | ||
262 | } else { | ||
263 | skb = skb_unshare(skb, GFP_ATOMIC); | ||
264 | if (!skb) { | ||
265 | printk(KERN_ERR "vlan: failed to unshare skbuff\n"); | ||
266 | return NULL; | ||
267 | } | ||
268 | } | 182 | } |
269 | |||
270 | veth = (struct vlan_ethhdr *)skb_push(skb, VLAN_HLEN); | 183 | veth = (struct vlan_ethhdr *)skb_push(skb, VLAN_HLEN); |
271 | 184 | ||
272 | /* Move the mac addresses to the beginning of the new header. */ | 185 | /* Move the mac addresses to the beginning of the new header. */ |
@@ -275,12 +188,10 @@ static inline struct sk_buff *__vlan_put_tag(struct sk_buff *skb, unsigned short | |||
275 | /* first, the ethernet type */ | 188 | /* first, the ethernet type */ |
276 | veth->h_vlan_proto = htons(ETH_P_8021Q); | 189 | veth->h_vlan_proto = htons(ETH_P_8021Q); |
277 | 190 | ||
278 | /* now, the tag */ | 191 | /* now, the TCI */ |
279 | veth->h_vlan_TCI = htons(tag); | 192 | veth->h_vlan_TCI = htons(vlan_tci); |
280 | 193 | ||
281 | skb->protocol = htons(ETH_P_8021Q); | 194 | skb->protocol = htons(ETH_P_8021Q); |
282 | skb->mac_header -= VLAN_HLEN; | ||
283 | skb->network_header -= VLAN_HLEN; | ||
284 | 195 | ||
285 | return skb; | 196 | return skb; |
286 | } | 197 | } |
@@ -288,18 +199,14 @@ static inline struct sk_buff *__vlan_put_tag(struct sk_buff *skb, unsigned short | |||
288 | /** | 199 | /** |
289 | * __vlan_hwaccel_put_tag - hardware accelerated VLAN inserting | 200 | * __vlan_hwaccel_put_tag - hardware accelerated VLAN inserting |
290 | * @skb: skbuff to tag | 201 | * @skb: skbuff to tag |
291 | * @tag: VLAN tag to insert | 202 | * @vlan_tci: VLAN TCI to insert |
292 | * | 203 | * |
293 | * Puts the VLAN tag in @skb->cb[] and lets the device do the rest | 204 | * Puts the VLAN TCI in @skb->vlan_tci and lets the device do the rest |
294 | */ | 205 | */ |
295 | static inline struct sk_buff *__vlan_hwaccel_put_tag(struct sk_buff *skb, unsigned short tag) | 206 | static inline struct sk_buff *__vlan_hwaccel_put_tag(struct sk_buff *skb, |
207 | u16 vlan_tci) | ||
296 | { | 208 | { |
297 | struct vlan_skb_tx_cookie *cookie; | 209 | skb->vlan_tci = vlan_tci; |
298 | |||
299 | cookie = VLAN_TX_SKB_CB(skb); | ||
300 | cookie->magic = VLAN_TX_COOKIE_MAGIC; | ||
301 | cookie->vlan_tag = tag; | ||
302 | |||
303 | return skb; | 210 | return skb; |
304 | } | 211 | } |
305 | 212 | ||
@@ -308,28 +215,28 @@ static inline struct sk_buff *__vlan_hwaccel_put_tag(struct sk_buff *skb, unsign | |||
308 | /** | 215 | /** |
309 | * vlan_put_tag - inserts VLAN tag according to device features | 216 | * vlan_put_tag - inserts VLAN tag according to device features |
310 | * @skb: skbuff to tag | 217 | * @skb: skbuff to tag |
311 | * @tag: VLAN tag to insert | 218 | * @vlan_tci: VLAN TCI to insert |
312 | * | 219 | * |
313 | * Assumes skb->dev is the target that will xmit this frame. | 220 | * Assumes skb->dev is the target that will xmit this frame. |
314 | * Returns a VLAN tagged skb. | 221 | * Returns a VLAN tagged skb. |
315 | */ | 222 | */ |
316 | static inline struct sk_buff *vlan_put_tag(struct sk_buff *skb, unsigned short tag) | 223 | static inline struct sk_buff *vlan_put_tag(struct sk_buff *skb, u16 vlan_tci) |
317 | { | 224 | { |
318 | if (skb->dev->features & NETIF_F_HW_VLAN_TX) { | 225 | if (skb->dev->features & NETIF_F_HW_VLAN_TX) { |
319 | return __vlan_hwaccel_put_tag(skb, tag); | 226 | return __vlan_hwaccel_put_tag(skb, vlan_tci); |
320 | } else { | 227 | } else { |
321 | return __vlan_put_tag(skb, tag); | 228 | return __vlan_put_tag(skb, vlan_tci); |
322 | } | 229 | } |
323 | } | 230 | } |
324 | 231 | ||
325 | /** | 232 | /** |
326 | * __vlan_get_tag - get the VLAN ID that is part of the payload | 233 | * __vlan_get_tag - get the VLAN ID that is part of the payload |
327 | * @skb: skbuff to query | 234 | * @skb: skbuff to query |
328 | * @tag: buffer to store vlaue | 235 | * @vlan_tci: buffer to store vlaue |
329 | * | 236 | * |
330 | * Returns error if the skb is not of VLAN type | 237 | * Returns error if the skb is not of VLAN type |
331 | */ | 238 | */ |
332 | static inline int __vlan_get_tag(const struct sk_buff *skb, unsigned short *tag) | 239 | static inline int __vlan_get_tag(const struct sk_buff *skb, u16 *vlan_tci) |
333 | { | 240 | { |
334 | struct vlan_ethhdr *veth = (struct vlan_ethhdr *)skb->data; | 241 | struct vlan_ethhdr *veth = (struct vlan_ethhdr *)skb->data; |
335 | 242 | ||
@@ -337,29 +244,25 @@ static inline int __vlan_get_tag(const struct sk_buff *skb, unsigned short *tag) | |||
337 | return -EINVAL; | 244 | return -EINVAL; |
338 | } | 245 | } |
339 | 246 | ||
340 | *tag = ntohs(veth->h_vlan_TCI); | 247 | *vlan_tci = ntohs(veth->h_vlan_TCI); |
341 | |||
342 | return 0; | 248 | return 0; |
343 | } | 249 | } |
344 | 250 | ||
345 | /** | 251 | /** |
346 | * __vlan_hwaccel_get_tag - get the VLAN ID that is in @skb->cb[] | 252 | * __vlan_hwaccel_get_tag - get the VLAN ID that is in @skb->cb[] |
347 | * @skb: skbuff to query | 253 | * @skb: skbuff to query |
348 | * @tag: buffer to store vlaue | 254 | * @vlan_tci: buffer to store vlaue |
349 | * | 255 | * |
350 | * Returns error if @skb->cb[] is not set correctly | 256 | * Returns error if @skb->vlan_tci is not set correctly |
351 | */ | 257 | */ |
352 | static inline int __vlan_hwaccel_get_tag(const struct sk_buff *skb, | 258 | static inline int __vlan_hwaccel_get_tag(const struct sk_buff *skb, |
353 | unsigned short *tag) | 259 | u16 *vlan_tci) |
354 | { | 260 | { |
355 | struct vlan_skb_tx_cookie *cookie; | 261 | if (vlan_tx_tag_present(skb)) { |
356 | 262 | *vlan_tci = skb->vlan_tci; | |
357 | cookie = VLAN_TX_SKB_CB(skb); | ||
358 | if (cookie->magic == VLAN_TX_COOKIE_MAGIC) { | ||
359 | *tag = cookie->vlan_tag; | ||
360 | return 0; | 263 | return 0; |
361 | } else { | 264 | } else { |
362 | *tag = 0; | 265 | *vlan_tci = 0; |
363 | return -EINVAL; | 266 | return -EINVAL; |
364 | } | 267 | } |
365 | } | 268 | } |
@@ -369,16 +272,16 @@ static inline int __vlan_hwaccel_get_tag(const struct sk_buff *skb, | |||
369 | /** | 272 | /** |
370 | * vlan_get_tag - get the VLAN ID from the skb | 273 | * vlan_get_tag - get the VLAN ID from the skb |
371 | * @skb: skbuff to query | 274 | * @skb: skbuff to query |
372 | * @tag: buffer to store vlaue | 275 | * @vlan_tci: buffer to store vlaue |
373 | * | 276 | * |
374 | * Returns error if the skb is not VLAN tagged | 277 | * Returns error if the skb is not VLAN tagged |
375 | */ | 278 | */ |
376 | static inline int vlan_get_tag(const struct sk_buff *skb, unsigned short *tag) | 279 | static inline int vlan_get_tag(const struct sk_buff *skb, u16 *vlan_tci) |
377 | { | 280 | { |
378 | if (skb->dev->features & NETIF_F_HW_VLAN_TX) { | 281 | if (skb->dev->features & NETIF_F_HW_VLAN_TX) { |
379 | return __vlan_hwaccel_get_tag(skb, tag); | 282 | return __vlan_hwaccel_get_tag(skb, vlan_tci); |
380 | } else { | 283 | } else { |
381 | return __vlan_get_tag(skb, tag); | 284 | return __vlan_get_tag(skb, vlan_tci); |
382 | } | 285 | } |
383 | } | 286 | } |
384 | 287 | ||
@@ -402,6 +305,7 @@ enum vlan_ioctl_cmds { | |||
402 | 305 | ||
403 | enum vlan_flags { | 306 | enum vlan_flags { |
404 | VLAN_FLAG_REORDER_HDR = 0x1, | 307 | VLAN_FLAG_REORDER_HDR = 0x1, |
308 | VLAN_FLAG_GVRP = 0x2, | ||
405 | }; | 309 | }; |
406 | 310 | ||
407 | enum vlan_name_types { | 311 | enum vlan_name_types { |
diff --git a/include/linux/igmp.h b/include/linux/igmp.h index f5a1a0db2e8e..f734a0ba0698 100644 --- a/include/linux/igmp.h +++ b/include/linux/igmp.h | |||
@@ -2,7 +2,7 @@ | |||
2 | * Linux NET3: Internet Group Management Protocol [IGMP] | 2 | * Linux NET3: Internet Group Management Protocol [IGMP] |
3 | * | 3 | * |
4 | * Authors: | 4 | * Authors: |
5 | * Alan Cox <Alan.Cox@linux.org> | 5 | * Alan Cox <alan@lxorguk.ukuu.org.uk> |
6 | * | 6 | * |
7 | * Extended to talk the BSD extended IGMP protocol of mrouted 3.6 | 7 | * Extended to talk the BSD extended IGMP protocol of mrouted 3.6 |
8 | * | 8 | * |
@@ -228,7 +228,6 @@ extern int ip_mc_msfget(struct sock *sk, struct ip_msfilter *msf, | |||
228 | extern int ip_mc_gsfget(struct sock *sk, struct group_filter *gsf, | 228 | extern int ip_mc_gsfget(struct sock *sk, struct group_filter *gsf, |
229 | struct group_filter __user *optval, int __user *optlen); | 229 | struct group_filter __user *optval, int __user *optlen); |
230 | extern int ip_mc_sf_allow(struct sock *sk, __be32 local, __be32 rmt, int dif); | 230 | extern int ip_mc_sf_allow(struct sock *sk, __be32 local, __be32 rmt, int dif); |
231 | extern void ip_mr_init(void); | ||
232 | extern void ip_mc_init_dev(struct in_device *); | 231 | extern void ip_mc_init_dev(struct in_device *); |
233 | extern void ip_mc_destroy_dev(struct in_device *); | 232 | extern void ip_mc_destroy_dev(struct in_device *); |
234 | extern void ip_mc_up(struct in_device *); | 233 | extern void ip_mc_up(struct in_device *); |
diff --git a/include/linux/ihex.h b/include/linux/ihex.h new file mode 100644 index 000000000000..31d8629e75a1 --- /dev/null +++ b/include/linux/ihex.h | |||
@@ -0,0 +1,74 @@ | |||
1 | /* | ||
2 | * Compact binary representation of ihex records. Some devices need their | ||
3 | * firmware loaded in strange orders rather than a single big blob, but | ||
4 | * actually parsing ihex-as-text within the kernel seems silly. Thus,... | ||
5 | */ | ||
6 | |||
7 | #ifndef __LINUX_IHEX_H__ | ||
8 | #define __LINUX_IHEX_H__ | ||
9 | |||
10 | #include <linux/types.h> | ||
11 | #include <linux/firmware.h> | ||
12 | #include <linux/device.h> | ||
13 | |||
14 | /* Intel HEX files actually limit the length to 256 bytes, but we have | ||
15 | drivers which would benefit from using separate records which are | ||
16 | longer than that, so we extend to 16 bits of length */ | ||
17 | struct ihex_binrec { | ||
18 | __be32 addr; | ||
19 | __be16 len; | ||
20 | uint8_t data[0]; | ||
21 | } __attribute__((packed)); | ||
22 | |||
23 | /* Find the next record, taking into account the 4-byte alignment */ | ||
24 | static inline const struct ihex_binrec * | ||
25 | ihex_next_binrec(const struct ihex_binrec *rec) | ||
26 | { | ||
27 | int next = ((be16_to_cpu(rec->len) + 5) & ~3) - 2; | ||
28 | rec = (void *)&rec->data[next]; | ||
29 | |||
30 | return be16_to_cpu(rec->len) ? rec : NULL; | ||
31 | } | ||
32 | |||
33 | /* Check that ihex_next_binrec() won't take us off the end of the image... */ | ||
34 | static inline int ihex_validate_fw(const struct firmware *fw) | ||
35 | { | ||
36 | const struct ihex_binrec *rec; | ||
37 | size_t ofs = 0; | ||
38 | |||
39 | while (ofs <= fw->size - sizeof(*rec)) { | ||
40 | rec = (void *)&fw->data[ofs]; | ||
41 | |||
42 | /* Zero length marks end of records */ | ||
43 | if (!be16_to_cpu(rec->len)) | ||
44 | return 0; | ||
45 | |||
46 | /* Point to next record... */ | ||
47 | ofs += (sizeof(*rec) + be16_to_cpu(rec->len) + 3) & ~3; | ||
48 | } | ||
49 | return -EINVAL; | ||
50 | } | ||
51 | |||
52 | /* Request firmware and validate it so that we can trust we won't | ||
53 | * run off the end while reading records... */ | ||
54 | static inline int request_ihex_firmware(const struct firmware **fw, | ||
55 | const char *fw_name, | ||
56 | struct device *dev) | ||
57 | { | ||
58 | const struct firmware *lfw; | ||
59 | int ret; | ||
60 | |||
61 | ret = request_firmware(&lfw, fw_name, dev); | ||
62 | if (ret) | ||
63 | return ret; | ||
64 | ret = ihex_validate_fw(lfw); | ||
65 | if (ret) { | ||
66 | dev_err(dev, "Firmware \"%s\" not valid IHEX records\n", | ||
67 | fw_name); | ||
68 | release_firmware(lfw); | ||
69 | return ret; | ||
70 | } | ||
71 | *fw = lfw; | ||
72 | return 0; | ||
73 | } | ||
74 | #endif /* __LINUX_IHEX_H__ */ | ||
diff --git a/include/linux/in.h b/include/linux/in.h index 4065313cd7ee..db458beef19d 100644 --- a/include/linux/in.h +++ b/include/linux/in.h | |||
@@ -75,6 +75,7 @@ struct in_addr { | |||
75 | #define IP_IPSEC_POLICY 16 | 75 | #define IP_IPSEC_POLICY 16 |
76 | #define IP_XFRM_POLICY 17 | 76 | #define IP_XFRM_POLICY 17 |
77 | #define IP_PASSSEC 18 | 77 | #define IP_PASSSEC 18 |
78 | #define IP_TRANSPARENT 19 | ||
78 | 79 | ||
79 | /* BSD compatibility */ | 80 | /* BSD compatibility */ |
80 | #define IP_RECVRETOPTS IP_RETOPTS | 81 | #define IP_RECVRETOPTS IP_RETOPTS |
diff --git a/include/linux/inet.h b/include/linux/inet.h index 1354080cf8cf..4cca05c9678e 100644 --- a/include/linux/inet.h +++ b/include/linux/inet.h | |||
@@ -44,6 +44,13 @@ | |||
44 | 44 | ||
45 | #include <linux/types.h> | 45 | #include <linux/types.h> |
46 | 46 | ||
47 | /* | ||
48 | * These mimic similar macros defined in user-space for inet_ntop(3). | ||
49 | * See /usr/include/netinet/in.h . | ||
50 | */ | ||
51 | #define INET_ADDRSTRLEN (16) | ||
52 | #define INET6_ADDRSTRLEN (48) | ||
53 | |||
47 | extern __be32 in_aton(const char *str); | 54 | extern __be32 in_aton(const char *str); |
48 | extern int in4_pton(const char *src, int srclen, u8 *dst, int delim, const char **end); | 55 | extern int in4_pton(const char *src, int srclen, u8 *dst, int delim, const char **end); |
49 | extern int in6_pton(const char *src, int srclen, u8 *dst, int delim, const char **end); | 56 | extern int in6_pton(const char *src, int srclen, u8 *dst, int delim, const char **end); |
diff --git a/include/linux/inet_lro.h b/include/linux/inet_lro.h index 80335b7d77c5..c4335faebb63 100644 --- a/include/linux/inet_lro.h +++ b/include/linux/inet_lro.h | |||
@@ -84,7 +84,11 @@ struct net_lro_mgr { | |||
84 | from received packets and eth protocol | 84 | from received packets and eth protocol |
85 | is still ETH_P_8021Q */ | 85 | is still ETH_P_8021Q */ |
86 | 86 | ||
87 | u32 ip_summed; /* Set in non generated SKBs in page mode */ | 87 | /* |
88 | * Set for generated SKBs that are not added to | ||
89 | * the frag list in fragmented mode | ||
90 | */ | ||
91 | u32 ip_summed; | ||
88 | u32 ip_summed_aggr; /* Set in aggregated SKBs: CHECKSUM_UNNECESSARY | 92 | u32 ip_summed_aggr; /* Set in aggregated SKBs: CHECKSUM_UNNECESSARY |
89 | * or CHECKSUM_NONE */ | 93 | * or CHECKSUM_NONE */ |
90 | 94 | ||
diff --git a/include/linux/inetdevice.h b/include/linux/inetdevice.h index c6f51ad52d5b..06fcdb45106b 100644 --- a/include/linux/inetdevice.h +++ b/include/linux/inetdevice.h | |||
@@ -25,6 +25,7 @@ struct in_device | |||
25 | struct in_ifaddr *ifa_list; /* IP ifaddr chain */ | 25 | struct in_ifaddr *ifa_list; /* IP ifaddr chain */ |
26 | rwlock_t mc_list_lock; | 26 | rwlock_t mc_list_lock; |
27 | struct ip_mc_list *mc_list; /* IP multicast filter chain */ | 27 | struct ip_mc_list *mc_list; /* IP multicast filter chain */ |
28 | int mc_count; /* Number of installed mcasts */ | ||
28 | spinlock_t mc_tomb_lock; | 29 | spinlock_t mc_tomb_lock; |
29 | struct ip_mc_list *mc_tomb; | 30 | struct ip_mc_list *mc_tomb; |
30 | unsigned long mr_v1_seen; | 31 | unsigned long mr_v1_seen; |
diff --git a/include/linux/init.h b/include/linux/init.h index 21d658cdfa27..93538b696e3d 100644 --- a/include/linux/init.h +++ b/include/linux/init.h | |||
@@ -139,6 +139,7 @@ extern initcall_t __con_initcall_start[], __con_initcall_end[]; | |||
139 | extern initcall_t __security_initcall_start[], __security_initcall_end[]; | 139 | extern initcall_t __security_initcall_start[], __security_initcall_end[]; |
140 | 140 | ||
141 | /* Defined in init/main.c */ | 141 | /* Defined in init/main.c */ |
142 | extern int do_one_initcall(initcall_t fn); | ||
142 | extern char __initdata boot_command_line[]; | 143 | extern char __initdata boot_command_line[]; |
143 | extern char *saved_command_line; | 144 | extern char *saved_command_line; |
144 | extern unsigned int reset_devices; | 145 | extern unsigned int reset_devices; |
@@ -170,6 +171,13 @@ extern void (*late_time_init)(void); | |||
170 | __attribute__((__section__(".initcall" level ".init"))) = fn | 171 | __attribute__((__section__(".initcall" level ".init"))) = fn |
171 | 172 | ||
172 | /* | 173 | /* |
174 | * Early initcalls run before initializing SMP. | ||
175 | * | ||
176 | * Only for built-in code, not modules. | ||
177 | */ | ||
178 | #define early_initcall(fn) __define_initcall("early",fn,early) | ||
179 | |||
180 | /* | ||
173 | * A "pure" initcall has no dependencies on anything else, and purely | 181 | * A "pure" initcall has no dependencies on anything else, and purely |
174 | * initializes variables that couldn't be statically initialized. | 182 | * initializes variables that couldn't be statically initialized. |
175 | * | 183 | * |
@@ -275,13 +283,7 @@ void __init parse_early_param(void); | |||
275 | 283 | ||
276 | #define security_initcall(fn) module_init(fn) | 284 | #define security_initcall(fn) module_init(fn) |
277 | 285 | ||
278 | /* These macros create a dummy inline: gcc 2.9x does not count alias | 286 | /* Each module must use one module_init(). */ |
279 | as usage, hence the `unused function' warning when __init functions | ||
280 | are declared static. We use the dummy __*_module_inline functions | ||
281 | both to kill the warning and check the type of the init/cleanup | ||
282 | function. */ | ||
283 | |||
284 | /* Each module must use one module_init(), or one no_module_init */ | ||
285 | #define module_init(initfn) \ | 287 | #define module_init(initfn) \ |
286 | static inline initcall_t __inittest(void) \ | 288 | static inline initcall_t __inittest(void) \ |
287 | { return initfn; } \ | 289 | { return initfn; } \ |
diff --git a/include/linux/init_task.h b/include/linux/init_task.h index 9927a88674a3..021d8e720c79 100644 --- a/include/linux/init_task.h +++ b/include/linux/init_task.h | |||
@@ -122,7 +122,7 @@ extern struct group_info init_groups; | |||
122 | .state = 0, \ | 122 | .state = 0, \ |
123 | .stack = &init_thread_info, \ | 123 | .stack = &init_thread_info, \ |
124 | .usage = ATOMIC_INIT(2), \ | 124 | .usage = ATOMIC_INIT(2), \ |
125 | .flags = 0, \ | 125 | .flags = PF_KTHREAD, \ |
126 | .lock_depth = -1, \ | 126 | .lock_depth = -1, \ |
127 | .prio = MAX_PRIO-20, \ | 127 | .prio = MAX_PRIO-20, \ |
128 | .static_prio = MAX_PRIO-20, \ | 128 | .static_prio = MAX_PRIO-20, \ |
@@ -140,8 +140,8 @@ extern struct group_info init_groups; | |||
140 | .nr_cpus_allowed = NR_CPUS, \ | 140 | .nr_cpus_allowed = NR_CPUS, \ |
141 | }, \ | 141 | }, \ |
142 | .tasks = LIST_HEAD_INIT(tsk.tasks), \ | 142 | .tasks = LIST_HEAD_INIT(tsk.tasks), \ |
143 | .ptrace_children= LIST_HEAD_INIT(tsk.ptrace_children), \ | 143 | .ptraced = LIST_HEAD_INIT(tsk.ptraced), \ |
144 | .ptrace_list = LIST_HEAD_INIT(tsk.ptrace_list), \ | 144 | .ptrace_entry = LIST_HEAD_INIT(tsk.ptrace_entry), \ |
145 | .real_parent = &tsk, \ | 145 | .real_parent = &tsk, \ |
146 | .parent = &tsk, \ | 146 | .parent = &tsk, \ |
147 | .children = LIST_HEAD_INIT(tsk.children), \ | 147 | .children = LIST_HEAD_INIT(tsk.children), \ |
diff --git a/include/linux/inotify.h b/include/linux/inotify.h index 742b917e7d1b..bd578578a8b9 100644 --- a/include/linux/inotify.h +++ b/include/linux/inotify.h | |||
@@ -7,6 +7,8 @@ | |||
7 | #ifndef _LINUX_INOTIFY_H | 7 | #ifndef _LINUX_INOTIFY_H |
8 | #define _LINUX_INOTIFY_H | 8 | #define _LINUX_INOTIFY_H |
9 | 9 | ||
10 | /* For O_CLOEXEC and O_NONBLOCK */ | ||
11 | #include <linux/fcntl.h> | ||
10 | #include <linux/types.h> | 12 | #include <linux/types.h> |
11 | 13 | ||
12 | /* | 14 | /* |
@@ -63,6 +65,10 @@ struct inotify_event { | |||
63 | IN_MOVED_TO | IN_DELETE | IN_CREATE | IN_DELETE_SELF | \ | 65 | IN_MOVED_TO | IN_DELETE | IN_CREATE | IN_DELETE_SELF | \ |
64 | IN_MOVE_SELF) | 66 | IN_MOVE_SELF) |
65 | 67 | ||
68 | /* Flags for sys_inotify_init1. */ | ||
69 | #define IN_CLOEXEC O_CLOEXEC | ||
70 | #define IN_NONBLOCK O_NONBLOCK | ||
71 | |||
66 | #ifdef __KERNEL__ | 72 | #ifdef __KERNEL__ |
67 | 73 | ||
68 | #include <linux/dcache.h> | 74 | #include <linux/dcache.h> |
diff --git a/include/linux/input.h b/include/linux/input.h index e075c4b762fb..a5802c9c81a4 100644 --- a/include/linux/input.h +++ b/include/linux/input.h | |||
@@ -373,6 +373,8 @@ struct input_absinfo { | |||
373 | 373 | ||
374 | #define KEY_WIMAX 246 | 374 | #define KEY_WIMAX 246 |
375 | 375 | ||
376 | /* Range 248 - 255 is reserved for special needs of AT keyboard driver */ | ||
377 | |||
376 | #define BTN_MISC 0x100 | 378 | #define BTN_MISC 0x100 |
377 | #define BTN_0 0x100 | 379 | #define BTN_0 0x100 |
378 | #define BTN_1 0x101 | 380 | #define BTN_1 0x101 |
@@ -534,8 +536,8 @@ struct input_absinfo { | |||
534 | 536 | ||
535 | #define KEY_FRAMEBACK 0x1b4 /* Consumer - transport controls */ | 537 | #define KEY_FRAMEBACK 0x1b4 /* Consumer - transport controls */ |
536 | #define KEY_FRAMEFORWARD 0x1b5 | 538 | #define KEY_FRAMEFORWARD 0x1b5 |
537 | |||
538 | #define KEY_CONTEXT_MENU 0x1b6 /* GenDesc - system context menu */ | 539 | #define KEY_CONTEXT_MENU 0x1b6 /* GenDesc - system context menu */ |
540 | #define KEY_MEDIA_REPEAT 0x1b7 /* Consumer - transport control */ | ||
539 | 541 | ||
540 | #define KEY_DEL_EOL 0x1c0 | 542 | #define KEY_DEL_EOL 0x1c0 |
541 | #define KEY_DEL_EOS 0x1c1 | 543 | #define KEY_DEL_EOS 0x1c1 |
@@ -640,6 +642,8 @@ struct input_absinfo { | |||
640 | #define SW_RFKILL_ALL 0x03 /* rfkill master switch, type "any" | 642 | #define SW_RFKILL_ALL 0x03 /* rfkill master switch, type "any" |
641 | set = radio enabled */ | 643 | set = radio enabled */ |
642 | #define SW_RADIO SW_RFKILL_ALL /* deprecated */ | 644 | #define SW_RADIO SW_RFKILL_ALL /* deprecated */ |
645 | #define SW_MICROPHONE_INSERT 0x04 /* set = inserted */ | ||
646 | #define SW_DOCK 0x05 /* set = plugged into dock */ | ||
643 | #define SW_MAX 0x0f | 647 | #define SW_MAX 0x0f |
644 | #define SW_CNT (SW_MAX+1) | 648 | #define SW_CNT (SW_MAX+1) |
645 | 649 | ||
@@ -1215,11 +1219,6 @@ struct input_handle { | |||
1215 | struct list_head h_node; | 1219 | struct list_head h_node; |
1216 | }; | 1220 | }; |
1217 | 1221 | ||
1218 | #define to_dev(n) container_of(n, struct input_dev, node) | ||
1219 | #define to_handler(n) container_of(n, struct input_handler, node) | ||
1220 | #define to_handle(n) container_of(n, struct input_handle, d_node) | ||
1221 | #define to_handle_h(n) container_of(n, struct input_handle, h_node) | ||
1222 | |||
1223 | struct input_dev *input_allocate_device(void); | 1222 | struct input_dev *input_allocate_device(void); |
1224 | void input_free_device(struct input_dev *dev); | 1223 | void input_free_device(struct input_dev *dev); |
1225 | 1224 | ||
diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h index f1fc7470d26c..58ff4e74b2f3 100644 --- a/include/linux/interrupt.h +++ b/include/linux/interrupt.h | |||
@@ -104,8 +104,11 @@ extern void enable_irq(unsigned int irq); | |||
104 | 104 | ||
105 | #if defined(CONFIG_SMP) && defined(CONFIG_GENERIC_HARDIRQS) | 105 | #if defined(CONFIG_SMP) && defined(CONFIG_GENERIC_HARDIRQS) |
106 | 106 | ||
107 | extern cpumask_t irq_default_affinity; | ||
108 | |||
107 | extern int irq_set_affinity(unsigned int irq, cpumask_t cpumask); | 109 | extern int irq_set_affinity(unsigned int irq, cpumask_t cpumask); |
108 | extern int irq_can_set_affinity(unsigned int irq); | 110 | extern int irq_can_set_affinity(unsigned int irq); |
111 | extern int irq_select_affinity(unsigned int irq); | ||
109 | 112 | ||
110 | #else /* CONFIG_SMP */ | 113 | #else /* CONFIG_SMP */ |
111 | 114 | ||
@@ -119,6 +122,8 @@ static inline int irq_can_set_affinity(unsigned int irq) | |||
119 | return 0; | 122 | return 0; |
120 | } | 123 | } |
121 | 124 | ||
125 | static inline int irq_select_affinity(unsigned int irq) { return 0; } | ||
126 | |||
122 | #endif /* CONFIG_SMP && CONFIG_GENERIC_HARDIRQS */ | 127 | #endif /* CONFIG_SMP && CONFIG_GENERIC_HARDIRQS */ |
123 | 128 | ||
124 | #ifdef CONFIG_GENERIC_HARDIRQS | 129 | #ifdef CONFIG_GENERIC_HARDIRQS |
@@ -218,35 +223,6 @@ static inline int disable_irq_wake(unsigned int irq) | |||
218 | #define or_softirq_pending(x) (local_softirq_pending() |= (x)) | 223 | #define or_softirq_pending(x) (local_softirq_pending() |= (x)) |
219 | #endif | 224 | #endif |
220 | 225 | ||
221 | /* | ||
222 | * Temporary defines for UP kernels, until all code gets fixed. | ||
223 | */ | ||
224 | #ifndef CONFIG_SMP | ||
225 | static inline void __deprecated cli(void) | ||
226 | { | ||
227 | local_irq_disable(); | ||
228 | } | ||
229 | static inline void __deprecated sti(void) | ||
230 | { | ||
231 | local_irq_enable(); | ||
232 | } | ||
233 | static inline void __deprecated save_flags(unsigned long *x) | ||
234 | { | ||
235 | local_save_flags(*x); | ||
236 | } | ||
237 | #define save_flags(x) save_flags(&x) | ||
238 | static inline void __deprecated restore_flags(unsigned long x) | ||
239 | { | ||
240 | local_irq_restore(x); | ||
241 | } | ||
242 | |||
243 | static inline void __deprecated save_and_cli(unsigned long *x) | ||
244 | { | ||
245 | local_irq_save(*x); | ||
246 | } | ||
247 | #define save_and_cli(x) save_and_cli(&x) | ||
248 | #endif /* CONFIG_SMP */ | ||
249 | |||
250 | /* Some architectures might implement lazy enabling/disabling of | 226 | /* Some architectures might implement lazy enabling/disabling of |
251 | * interrupts. In some cases, such as stop_machine, we might want | 227 | * interrupts. In some cases, such as stop_machine, we might want |
252 | * to ensure that after a local_irq_disable(), interrupts have | 228 | * to ensure that after a local_irq_disable(), interrupts have |
@@ -285,12 +261,11 @@ enum | |||
285 | struct softirq_action | 261 | struct softirq_action |
286 | { | 262 | { |
287 | void (*action)(struct softirq_action *); | 263 | void (*action)(struct softirq_action *); |
288 | void *data; | ||
289 | }; | 264 | }; |
290 | 265 | ||
291 | asmlinkage void do_softirq(void); | 266 | asmlinkage void do_softirq(void); |
292 | asmlinkage void __do_softirq(void); | 267 | asmlinkage void __do_softirq(void); |
293 | extern void open_softirq(int nr, void (*action)(struct softirq_action*), void *data); | 268 | extern void open_softirq(int nr, void (*action)(struct softirq_action *)); |
294 | extern void softirq_init(void); | 269 | extern void softirq_init(void); |
295 | #define __raise_softirq_irqoff(nr) do { or_softirq_pending(1UL << (nr)); } while (0) | 270 | #define __raise_softirq_irqoff(nr) do { or_softirq_pending(1UL << (nr)); } while (0) |
296 | extern void raise_softirq_irqoff(unsigned int nr); | 271 | extern void raise_softirq_irqoff(unsigned int nr); |
diff --git a/include/linux/iocontext.h b/include/linux/iocontext.h index 2b7a1187cb29..08b987bccf89 100644 --- a/include/linux/iocontext.h +++ b/include/linux/iocontext.h | |||
@@ -99,4 +99,22 @@ static inline struct io_context *ioc_task_link(struct io_context *ioc) | |||
99 | return NULL; | 99 | return NULL; |
100 | } | 100 | } |
101 | 101 | ||
102 | #ifdef CONFIG_BLOCK | ||
103 | int put_io_context(struct io_context *ioc); | ||
104 | void exit_io_context(void); | ||
105 | 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); | ||
107 | void copy_io_context(struct io_context **pdst, struct io_context **psrc); | ||
108 | #else | ||
109 | static inline void exit_io_context(void) | ||
110 | { | ||
111 | } | ||
112 | |||
113 | struct io_context; | ||
114 | static inline int put_io_context(struct io_context *ioc) | ||
115 | { | ||
116 | return 1; | ||
117 | } | ||
118 | #endif | ||
119 | |||
102 | #endif | 120 | #endif |
diff --git a/include/linux/iommu-helper.h b/include/linux/iommu-helper.h index c975caf75385..a6d0586e2bf7 100644 --- a/include/linux/iommu-helper.h +++ b/include/linux/iommu-helper.h | |||
@@ -1,6 +1,20 @@ | |||
1 | #ifndef _LINUX_IOMMU_HELPER_H | ||
2 | #define _LINUX_IOMMU_HELPER_H | ||
3 | |||
4 | static inline unsigned long iommu_device_max_index(unsigned long size, | ||
5 | unsigned long offset, | ||
6 | u64 dma_mask) | ||
7 | { | ||
8 | if (size + offset > dma_mask) | ||
9 | return dma_mask - offset + 1; | ||
10 | else | ||
11 | return size; | ||
12 | } | ||
13 | |||
1 | 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, |
2 | unsigned long shift, | 15 | unsigned long shift, |
3 | unsigned long boundary_size); | 16 | unsigned long boundary_size); |
17 | extern void iommu_area_reserve(unsigned long *map, unsigned long i, int len); | ||
4 | extern unsigned long iommu_area_alloc(unsigned long *map, unsigned long size, | 18 | extern unsigned long iommu_area_alloc(unsigned long *map, unsigned long size, |
5 | unsigned long start, unsigned int nr, | 19 | unsigned long start, unsigned int nr, |
6 | unsigned long shift, | 20 | unsigned long shift, |
@@ -8,3 +22,5 @@ extern unsigned long iommu_area_alloc(unsigned long *map, unsigned long size, | |||
8 | unsigned long align_mask); | 22 | unsigned long align_mask); |
9 | extern void iommu_area_free(unsigned long *map, unsigned long start, | 23 | extern void iommu_area_free(unsigned long *map, unsigned long start, |
10 | unsigned int nr); | 24 | unsigned int nr); |
25 | |||
26 | #endif | ||
diff --git a/include/linux/ioport.h b/include/linux/ioport.h index c6801bffe76d..ee9bcc6f32b6 100644 --- a/include/linux/ioport.h +++ b/include/linux/ioport.h | |||
@@ -59,6 +59,7 @@ struct resource_list { | |||
59 | #define IORESOURCE_IRQ_HIGHLEVEL (1<<2) | 59 | #define IORESOURCE_IRQ_HIGHLEVEL (1<<2) |
60 | #define IORESOURCE_IRQ_LOWLEVEL (1<<3) | 60 | #define IORESOURCE_IRQ_LOWLEVEL (1<<3) |
61 | #define IORESOURCE_IRQ_SHAREABLE (1<<4) | 61 | #define IORESOURCE_IRQ_SHAREABLE (1<<4) |
62 | #define IORESOURCE_IRQ_OPTIONAL (1<<5) | ||
62 | 63 | ||
63 | /* PnP DMA specific bits (IORESOURCE_BITS) */ | 64 | /* PnP DMA specific bits (IORESOURCE_BITS) */ |
64 | #define IORESOURCE_DMA_TYPE_MASK (3<<0) | 65 | #define IORESOURCE_DMA_TYPE_MASK (3<<0) |
@@ -88,6 +89,10 @@ struct resource_list { | |||
88 | #define IORESOURCE_MEM_SHADOWABLE (1<<5) /* dup: IORESOURCE_SHADOWABLE */ | 89 | #define IORESOURCE_MEM_SHADOWABLE (1<<5) /* dup: IORESOURCE_SHADOWABLE */ |
89 | #define IORESOURCE_MEM_EXPANSIONROM (1<<6) | 90 | #define IORESOURCE_MEM_EXPANSIONROM (1<<6) |
90 | 91 | ||
92 | /* PnP I/O specific bits (IORESOURCE_BITS) */ | ||
93 | #define IORESOURCE_IO_16BIT_ADDR (1<<0) | ||
94 | #define IORESOURCE_IO_FIXED (1<<1) | ||
95 | |||
91 | /* PCI ROM control bits (IORESOURCE_BITS) */ | 96 | /* PCI ROM control bits (IORESOURCE_BITS) */ |
92 | #define IORESOURCE_ROM_ENABLE (1<<0) /* ROM is enabled, same as PCI_ROM_ADDRESS_ENABLE */ | 97 | #define IORESOURCE_ROM_ENABLE (1<<0) /* ROM is enabled, same as PCI_ROM_ADDRESS_ENABLE */ |
93 | #define IORESOURCE_ROM_SHADOW (1<<1) /* ROM is copy at C000:0 */ | 98 | #define IORESOURCE_ROM_SHADOW (1<<1) /* ROM is copy at C000:0 */ |
@@ -103,7 +108,11 @@ extern struct resource iomem_resource; | |||
103 | 108 | ||
104 | extern int request_resource(struct resource *root, struct resource *new); | 109 | extern int request_resource(struct resource *root, struct resource *new); |
105 | extern int release_resource(struct resource *new); | 110 | extern int release_resource(struct resource *new); |
111 | extern void reserve_region_with_split(struct resource *root, | ||
112 | resource_size_t start, resource_size_t end, | ||
113 | const char *name); | ||
106 | extern int insert_resource(struct resource *parent, struct resource *new); | 114 | extern int insert_resource(struct resource *parent, struct resource *new); |
115 | extern void insert_resource_expand_to_fit(struct resource *root, struct resource *new); | ||
107 | extern int allocate_resource(struct resource *root, struct resource *new, | 116 | extern int allocate_resource(struct resource *root, struct resource *new, |
108 | resource_size_t size, resource_size_t min, | 117 | resource_size_t size, resource_size_t min, |
109 | resource_size_t max, resource_size_t align, | 118 | resource_size_t max, resource_size_t align, |
@@ -113,6 +122,10 @@ extern int allocate_resource(struct resource *root, struct resource *new, | |||
113 | int adjust_resource(struct resource *res, resource_size_t start, | 122 | int adjust_resource(struct resource *res, resource_size_t start, |
114 | resource_size_t size); | 123 | resource_size_t size); |
115 | resource_size_t resource_alignment(struct resource *res); | 124 | resource_size_t resource_alignment(struct resource *res); |
125 | static inline resource_size_t resource_size(struct resource *res) | ||
126 | { | ||
127 | return res->end - res->start + 1; | ||
128 | } | ||
116 | 129 | ||
117 | /* Convenience shorthand with allocation */ | 130 | /* Convenience shorthand with allocation */ |
118 | #define request_region(start,n,name) __request_region(&ioport_resource, (start), (n), (name)) | 131 | #define request_region(start,n,name) __request_region(&ioport_resource, (start), (n), (name)) |
@@ -149,9 +162,9 @@ extern struct resource * __devm_request_region(struct device *dev, | |||
149 | struct resource *parent, resource_size_t start, | 162 | struct resource *parent, resource_size_t start, |
150 | resource_size_t n, const char *name); | 163 | resource_size_t n, const char *name); |
151 | 164 | ||
152 | #define devm_release_region(start,n) \ | 165 | #define devm_release_region(dev, start, n) \ |
153 | __devm_release_region(dev, &ioport_resource, (start), (n)) | 166 | __devm_release_region(dev, &ioport_resource, (start), (n)) |
154 | #define devm_release_mem_region(start,n) \ | 167 | #define devm_release_mem_region(dev, start, n) \ |
155 | __devm_release_region(dev, &iomem_resource, (start), (n)) | 168 | __devm_release_region(dev, &iomem_resource, (start), (n)) |
156 | 169 | ||
157 | extern void __devm_release_region(struct device *dev, struct resource *parent, | 170 | extern void __devm_release_region(struct device *dev, struct resource *parent, |
diff --git a/include/linux/ip6_tunnel.h b/include/linux/ip6_tunnel.h index af3f4a70f3df..1e7cc4af40de 100644 --- a/include/linux/ip6_tunnel.h +++ b/include/linux/ip6_tunnel.h | |||
@@ -1,7 +1,3 @@ | |||
1 | /* | ||
2 | * $Id$ | ||
3 | */ | ||
4 | |||
5 | #ifndef _IP6_TUNNEL_H | 1 | #ifndef _IP6_TUNNEL_H |
6 | #define _IP6_TUNNEL_H | 2 | #define _IP6_TUNNEL_H |
7 | 3 | ||
diff --git a/include/linux/ip_vs.h b/include/linux/ip_vs.h new file mode 100644 index 000000000000..0f434a28fb58 --- /dev/null +++ b/include/linux/ip_vs.h | |||
@@ -0,0 +1,405 @@ | |||
1 | /* | ||
2 | * IP Virtual Server | ||
3 | * data structure and functionality definitions | ||
4 | */ | ||
5 | |||
6 | #ifndef _IP_VS_H | ||
7 | #define _IP_VS_H | ||
8 | |||
9 | #include <linux/types.h> /* For __beXX types in userland */ | ||
10 | |||
11 | #define IP_VS_VERSION_CODE 0x010201 | ||
12 | #define NVERSION(version) \ | ||
13 | (version >> 16) & 0xFF, \ | ||
14 | (version >> 8) & 0xFF, \ | ||
15 | version & 0xFF | ||
16 | |||
17 | /* | ||
18 | * Virtual Service Flags | ||
19 | */ | ||
20 | #define IP_VS_SVC_F_PERSISTENT 0x0001 /* persistent port */ | ||
21 | #define IP_VS_SVC_F_HASHED 0x0002 /* hashed entry */ | ||
22 | |||
23 | /* | ||
24 | * Destination Server Flags | ||
25 | */ | ||
26 | #define IP_VS_DEST_F_AVAILABLE 0x0001 /* server is available */ | ||
27 | #define IP_VS_DEST_F_OVERLOAD 0x0002 /* server is overloaded */ | ||
28 | |||
29 | /* | ||
30 | * IPVS sync daemon states | ||
31 | */ | ||
32 | #define IP_VS_STATE_NONE 0x0000 /* daemon is stopped */ | ||
33 | #define IP_VS_STATE_MASTER 0x0001 /* started as master */ | ||
34 | #define IP_VS_STATE_BACKUP 0x0002 /* started as backup */ | ||
35 | |||
36 | /* | ||
37 | * IPVS socket options | ||
38 | */ | ||
39 | #define IP_VS_BASE_CTL (64+1024+64) /* base */ | ||
40 | |||
41 | #define IP_VS_SO_SET_NONE IP_VS_BASE_CTL /* just peek */ | ||
42 | #define IP_VS_SO_SET_INSERT (IP_VS_BASE_CTL+1) | ||
43 | #define IP_VS_SO_SET_ADD (IP_VS_BASE_CTL+2) | ||
44 | #define IP_VS_SO_SET_EDIT (IP_VS_BASE_CTL+3) | ||
45 | #define IP_VS_SO_SET_DEL (IP_VS_BASE_CTL+4) | ||
46 | #define IP_VS_SO_SET_FLUSH (IP_VS_BASE_CTL+5) | ||
47 | #define IP_VS_SO_SET_LIST (IP_VS_BASE_CTL+6) | ||
48 | #define IP_VS_SO_SET_ADDDEST (IP_VS_BASE_CTL+7) | ||
49 | #define IP_VS_SO_SET_DELDEST (IP_VS_BASE_CTL+8) | ||
50 | #define IP_VS_SO_SET_EDITDEST (IP_VS_BASE_CTL+9) | ||
51 | #define IP_VS_SO_SET_TIMEOUT (IP_VS_BASE_CTL+10) | ||
52 | #define IP_VS_SO_SET_STARTDAEMON (IP_VS_BASE_CTL+11) | ||
53 | #define IP_VS_SO_SET_STOPDAEMON (IP_VS_BASE_CTL+12) | ||
54 | #define IP_VS_SO_SET_RESTORE (IP_VS_BASE_CTL+13) | ||
55 | #define IP_VS_SO_SET_SAVE (IP_VS_BASE_CTL+14) | ||
56 | #define IP_VS_SO_SET_ZERO (IP_VS_BASE_CTL+15) | ||
57 | #define IP_VS_SO_SET_MAX IP_VS_SO_SET_ZERO | ||
58 | |||
59 | #define IP_VS_SO_GET_VERSION IP_VS_BASE_CTL | ||
60 | #define IP_VS_SO_GET_INFO (IP_VS_BASE_CTL+1) | ||
61 | #define IP_VS_SO_GET_SERVICES (IP_VS_BASE_CTL+2) | ||
62 | #define IP_VS_SO_GET_SERVICE (IP_VS_BASE_CTL+3) | ||
63 | #define IP_VS_SO_GET_DESTS (IP_VS_BASE_CTL+4) | ||
64 | #define IP_VS_SO_GET_DEST (IP_VS_BASE_CTL+5) /* not used now */ | ||
65 | #define IP_VS_SO_GET_TIMEOUT (IP_VS_BASE_CTL+6) | ||
66 | #define IP_VS_SO_GET_DAEMON (IP_VS_BASE_CTL+7) | ||
67 | #define IP_VS_SO_GET_MAX IP_VS_SO_GET_DAEMON | ||
68 | |||
69 | |||
70 | /* | ||
71 | * IPVS Connection Flags | ||
72 | */ | ||
73 | #define IP_VS_CONN_F_FWD_MASK 0x0007 /* mask for the fwd methods */ | ||
74 | #define IP_VS_CONN_F_MASQ 0x0000 /* masquerading/NAT */ | ||
75 | #define IP_VS_CONN_F_LOCALNODE 0x0001 /* local node */ | ||
76 | #define IP_VS_CONN_F_TUNNEL 0x0002 /* tunneling */ | ||
77 | #define IP_VS_CONN_F_DROUTE 0x0003 /* direct routing */ | ||
78 | #define IP_VS_CONN_F_BYPASS 0x0004 /* cache bypass */ | ||
79 | #define IP_VS_CONN_F_SYNC 0x0020 /* entry created by sync */ | ||
80 | #define IP_VS_CONN_F_HASHED 0x0040 /* hashed entry */ | ||
81 | #define IP_VS_CONN_F_NOOUTPUT 0x0080 /* no output packets */ | ||
82 | #define IP_VS_CONN_F_INACTIVE 0x0100 /* not established */ | ||
83 | #define IP_VS_CONN_F_OUT_SEQ 0x0200 /* must do output seq adjust */ | ||
84 | #define IP_VS_CONN_F_IN_SEQ 0x0400 /* must do input seq adjust */ | ||
85 | #define IP_VS_CONN_F_SEQ_MASK 0x0600 /* in/out sequence mask */ | ||
86 | #define IP_VS_CONN_F_NO_CPORT 0x0800 /* no client port set yet */ | ||
87 | #define IP_VS_CONN_F_TEMPLATE 0x1000 /* template, not connection */ | ||
88 | |||
89 | #define IP_VS_SCHEDNAME_MAXLEN 16 | ||
90 | #define IP_VS_IFNAME_MAXLEN 16 | ||
91 | |||
92 | |||
93 | /* | ||
94 | * The struct ip_vs_service_user and struct ip_vs_dest_user are | ||
95 | * used to set IPVS rules through setsockopt. | ||
96 | */ | ||
97 | struct ip_vs_service_user { | ||
98 | /* virtual service addresses */ | ||
99 | u_int16_t protocol; | ||
100 | __be32 addr; /* virtual ip address */ | ||
101 | __be16 port; | ||
102 | u_int32_t fwmark; /* firwall mark of service */ | ||
103 | |||
104 | /* virtual service options */ | ||
105 | char sched_name[IP_VS_SCHEDNAME_MAXLEN]; | ||
106 | unsigned flags; /* virtual service flags */ | ||
107 | unsigned timeout; /* persistent timeout in sec */ | ||
108 | __be32 netmask; /* persistent netmask */ | ||
109 | }; | ||
110 | |||
111 | |||
112 | struct ip_vs_dest_user { | ||
113 | /* destination server address */ | ||
114 | __be32 addr; | ||
115 | __be16 port; | ||
116 | |||
117 | /* real server options */ | ||
118 | unsigned conn_flags; /* connection flags */ | ||
119 | int weight; /* destination weight */ | ||
120 | |||
121 | /* thresholds for active connections */ | ||
122 | u_int32_t u_threshold; /* upper threshold */ | ||
123 | u_int32_t l_threshold; /* lower threshold */ | ||
124 | }; | ||
125 | |||
126 | |||
127 | /* | ||
128 | * IPVS statistics object (for user space) | ||
129 | */ | ||
130 | struct ip_vs_stats_user | ||
131 | { | ||
132 | __u32 conns; /* connections scheduled */ | ||
133 | __u32 inpkts; /* incoming packets */ | ||
134 | __u32 outpkts; /* outgoing packets */ | ||
135 | __u64 inbytes; /* incoming bytes */ | ||
136 | __u64 outbytes; /* outgoing bytes */ | ||
137 | |||
138 | __u32 cps; /* current connection rate */ | ||
139 | __u32 inpps; /* current in packet rate */ | ||
140 | __u32 outpps; /* current out packet rate */ | ||
141 | __u32 inbps; /* current in byte rate */ | ||
142 | __u32 outbps; /* current out byte rate */ | ||
143 | }; | ||
144 | |||
145 | |||
146 | /* The argument to IP_VS_SO_GET_INFO */ | ||
147 | struct ip_vs_getinfo { | ||
148 | /* version number */ | ||
149 | unsigned int version; | ||
150 | |||
151 | /* size of connection hash table */ | ||
152 | unsigned int size; | ||
153 | |||
154 | /* number of virtual services */ | ||
155 | unsigned int num_services; | ||
156 | }; | ||
157 | |||
158 | |||
159 | /* The argument to IP_VS_SO_GET_SERVICE */ | ||
160 | struct ip_vs_service_entry { | ||
161 | /* which service: user fills in these */ | ||
162 | u_int16_t protocol; | ||
163 | __be32 addr; /* virtual address */ | ||
164 | __be16 port; | ||
165 | u_int32_t fwmark; /* firwall mark of service */ | ||
166 | |||
167 | /* service options */ | ||
168 | char sched_name[IP_VS_SCHEDNAME_MAXLEN]; | ||
169 | unsigned flags; /* virtual service flags */ | ||
170 | unsigned timeout; /* persistent timeout */ | ||
171 | __be32 netmask; /* persistent netmask */ | ||
172 | |||
173 | /* number of real servers */ | ||
174 | unsigned int num_dests; | ||
175 | |||
176 | /* statistics */ | ||
177 | struct ip_vs_stats_user stats; | ||
178 | }; | ||
179 | |||
180 | |||
181 | struct ip_vs_dest_entry { | ||
182 | __be32 addr; /* destination address */ | ||
183 | __be16 port; | ||
184 | unsigned conn_flags; /* connection flags */ | ||
185 | int weight; /* destination weight */ | ||
186 | |||
187 | u_int32_t u_threshold; /* upper threshold */ | ||
188 | u_int32_t l_threshold; /* lower threshold */ | ||
189 | |||
190 | u_int32_t activeconns; /* active connections */ | ||
191 | u_int32_t inactconns; /* inactive connections */ | ||
192 | u_int32_t persistconns; /* persistent connections */ | ||
193 | |||
194 | /* statistics */ | ||
195 | struct ip_vs_stats_user stats; | ||
196 | }; | ||
197 | |||
198 | |||
199 | /* The argument to IP_VS_SO_GET_DESTS */ | ||
200 | struct ip_vs_get_dests { | ||
201 | /* which service: user fills in these */ | ||
202 | u_int16_t protocol; | ||
203 | __be32 addr; /* virtual address */ | ||
204 | __be16 port; | ||
205 | u_int32_t fwmark; /* firwall mark of service */ | ||
206 | |||
207 | /* number of real servers */ | ||
208 | unsigned int num_dests; | ||
209 | |||
210 | /* the real servers */ | ||
211 | struct ip_vs_dest_entry entrytable[0]; | ||
212 | }; | ||
213 | |||
214 | |||
215 | /* The argument to IP_VS_SO_GET_SERVICES */ | ||
216 | struct ip_vs_get_services { | ||
217 | /* number of virtual services */ | ||
218 | unsigned int num_services; | ||
219 | |||
220 | /* service table */ | ||
221 | struct ip_vs_service_entry entrytable[0]; | ||
222 | }; | ||
223 | |||
224 | |||
225 | /* The argument to IP_VS_SO_GET_TIMEOUT */ | ||
226 | struct ip_vs_timeout_user { | ||
227 | int tcp_timeout; | ||
228 | int tcp_fin_timeout; | ||
229 | int udp_timeout; | ||
230 | }; | ||
231 | |||
232 | |||
233 | /* The argument to IP_VS_SO_GET_DAEMON */ | ||
234 | struct ip_vs_daemon_user { | ||
235 | /* sync daemon state (master/backup) */ | ||
236 | int state; | ||
237 | |||
238 | /* multicast interface name */ | ||
239 | char mcast_ifn[IP_VS_IFNAME_MAXLEN]; | ||
240 | |||
241 | /* SyncID we belong to */ | ||
242 | int syncid; | ||
243 | }; | ||
244 | |||
245 | /* | ||
246 | * | ||
247 | * IPVS Generic Netlink interface definitions | ||
248 | * | ||
249 | */ | ||
250 | |||
251 | /* Generic Netlink family info */ | ||
252 | |||
253 | #define IPVS_GENL_NAME "IPVS" | ||
254 | #define IPVS_GENL_VERSION 0x1 | ||
255 | |||
256 | struct ip_vs_flags { | ||
257 | __be32 flags; | ||
258 | __be32 mask; | ||
259 | }; | ||
260 | |||
261 | /* Generic Netlink command attributes */ | ||
262 | enum { | ||
263 | IPVS_CMD_UNSPEC = 0, | ||
264 | |||
265 | IPVS_CMD_NEW_SERVICE, /* add service */ | ||
266 | IPVS_CMD_SET_SERVICE, /* modify service */ | ||
267 | IPVS_CMD_DEL_SERVICE, /* delete service */ | ||
268 | IPVS_CMD_GET_SERVICE, /* get service info */ | ||
269 | |||
270 | IPVS_CMD_NEW_DEST, /* add destination */ | ||
271 | IPVS_CMD_SET_DEST, /* modify destination */ | ||
272 | IPVS_CMD_DEL_DEST, /* delete destination */ | ||
273 | IPVS_CMD_GET_DEST, /* get destination info */ | ||
274 | |||
275 | IPVS_CMD_NEW_DAEMON, /* start sync daemon */ | ||
276 | IPVS_CMD_DEL_DAEMON, /* stop sync daemon */ | ||
277 | IPVS_CMD_GET_DAEMON, /* get sync daemon status */ | ||
278 | |||
279 | IPVS_CMD_SET_CONFIG, /* set config settings */ | ||
280 | IPVS_CMD_GET_CONFIG, /* get config settings */ | ||
281 | |||
282 | IPVS_CMD_SET_INFO, /* only used in GET_INFO reply */ | ||
283 | IPVS_CMD_GET_INFO, /* get general IPVS info */ | ||
284 | |||
285 | IPVS_CMD_ZERO, /* zero all counters and stats */ | ||
286 | IPVS_CMD_FLUSH, /* flush services and dests */ | ||
287 | |||
288 | __IPVS_CMD_MAX, | ||
289 | }; | ||
290 | |||
291 | #define IPVS_CMD_MAX (__IPVS_CMD_MAX - 1) | ||
292 | |||
293 | /* Attributes used in the first level of commands */ | ||
294 | enum { | ||
295 | IPVS_CMD_ATTR_UNSPEC = 0, | ||
296 | IPVS_CMD_ATTR_SERVICE, /* nested service attribute */ | ||
297 | IPVS_CMD_ATTR_DEST, /* nested destination attribute */ | ||
298 | IPVS_CMD_ATTR_DAEMON, /* nested sync daemon attribute */ | ||
299 | IPVS_CMD_ATTR_TIMEOUT_TCP, /* TCP connection timeout */ | ||
300 | IPVS_CMD_ATTR_TIMEOUT_TCP_FIN, /* TCP FIN wait timeout */ | ||
301 | IPVS_CMD_ATTR_TIMEOUT_UDP, /* UDP timeout */ | ||
302 | __IPVS_CMD_ATTR_MAX, | ||
303 | }; | ||
304 | |||
305 | #define IPVS_CMD_ATTR_MAX (__IPVS_SVC_ATTR_MAX - 1) | ||
306 | |||
307 | /* | ||
308 | * Attributes used to describe a service | ||
309 | * | ||
310 | * Used inside nested attribute IPVS_CMD_ATTR_SERVICE | ||
311 | */ | ||
312 | enum { | ||
313 | IPVS_SVC_ATTR_UNSPEC = 0, | ||
314 | IPVS_SVC_ATTR_AF, /* address family */ | ||
315 | IPVS_SVC_ATTR_PROTOCOL, /* virtual service protocol */ | ||
316 | IPVS_SVC_ATTR_ADDR, /* virtual service address */ | ||
317 | IPVS_SVC_ATTR_PORT, /* virtual service port */ | ||
318 | IPVS_SVC_ATTR_FWMARK, /* firewall mark of service */ | ||
319 | |||
320 | IPVS_SVC_ATTR_SCHED_NAME, /* name of scheduler */ | ||
321 | IPVS_SVC_ATTR_FLAGS, /* virtual service flags */ | ||
322 | IPVS_SVC_ATTR_TIMEOUT, /* persistent timeout */ | ||
323 | IPVS_SVC_ATTR_NETMASK, /* persistent netmask */ | ||
324 | |||
325 | IPVS_SVC_ATTR_STATS, /* nested attribute for service stats */ | ||
326 | __IPVS_SVC_ATTR_MAX, | ||
327 | }; | ||
328 | |||
329 | #define IPVS_SVC_ATTR_MAX (__IPVS_SVC_ATTR_MAX - 1) | ||
330 | |||
331 | /* | ||
332 | * Attributes used to describe a destination (real server) | ||
333 | * | ||
334 | * Used inside nested attribute IPVS_CMD_ATTR_DEST | ||
335 | */ | ||
336 | enum { | ||
337 | IPVS_DEST_ATTR_UNSPEC = 0, | ||
338 | IPVS_DEST_ATTR_ADDR, /* real server address */ | ||
339 | IPVS_DEST_ATTR_PORT, /* real server port */ | ||
340 | |||
341 | IPVS_DEST_ATTR_FWD_METHOD, /* forwarding method */ | ||
342 | IPVS_DEST_ATTR_WEIGHT, /* destination weight */ | ||
343 | |||
344 | IPVS_DEST_ATTR_U_THRESH, /* upper threshold */ | ||
345 | IPVS_DEST_ATTR_L_THRESH, /* lower threshold */ | ||
346 | |||
347 | IPVS_DEST_ATTR_ACTIVE_CONNS, /* active connections */ | ||
348 | IPVS_DEST_ATTR_INACT_CONNS, /* inactive connections */ | ||
349 | IPVS_DEST_ATTR_PERSIST_CONNS, /* persistent connections */ | ||
350 | |||
351 | IPVS_DEST_ATTR_STATS, /* nested attribute for dest stats */ | ||
352 | __IPVS_DEST_ATTR_MAX, | ||
353 | }; | ||
354 | |||
355 | #define IPVS_DEST_ATTR_MAX (__IPVS_DEST_ATTR_MAX - 1) | ||
356 | |||
357 | /* | ||
358 | * Attributes describing a sync daemon | ||
359 | * | ||
360 | * Used inside nested attribute IPVS_CMD_ATTR_DAEMON | ||
361 | */ | ||
362 | enum { | ||
363 | IPVS_DAEMON_ATTR_UNSPEC = 0, | ||
364 | IPVS_DAEMON_ATTR_STATE, /* sync daemon state (master/backup) */ | ||
365 | IPVS_DAEMON_ATTR_MCAST_IFN, /* multicast interface name */ | ||
366 | IPVS_DAEMON_ATTR_SYNC_ID, /* SyncID we belong to */ | ||
367 | __IPVS_DAEMON_ATTR_MAX, | ||
368 | }; | ||
369 | |||
370 | #define IPVS_DAEMON_ATTR_MAX (__IPVS_DAEMON_ATTR_MAX - 1) | ||
371 | |||
372 | /* | ||
373 | * Attributes used to describe service or destination entry statistics | ||
374 | * | ||
375 | * Used inside nested attributes IPVS_SVC_ATTR_STATS and IPVS_DEST_ATTR_STATS | ||
376 | */ | ||
377 | enum { | ||
378 | IPVS_STATS_ATTR_UNSPEC = 0, | ||
379 | IPVS_STATS_ATTR_CONNS, /* connections scheduled */ | ||
380 | IPVS_STATS_ATTR_INPKTS, /* incoming packets */ | ||
381 | IPVS_STATS_ATTR_OUTPKTS, /* outgoing packets */ | ||
382 | IPVS_STATS_ATTR_INBYTES, /* incoming bytes */ | ||
383 | IPVS_STATS_ATTR_OUTBYTES, /* outgoing bytes */ | ||
384 | |||
385 | IPVS_STATS_ATTR_CPS, /* current connection rate */ | ||
386 | IPVS_STATS_ATTR_INPPS, /* current in packet rate */ | ||
387 | IPVS_STATS_ATTR_OUTPPS, /* current out packet rate */ | ||
388 | IPVS_STATS_ATTR_INBPS, /* current in byte rate */ | ||
389 | IPVS_STATS_ATTR_OUTBPS, /* current out byte rate */ | ||
390 | __IPVS_STATS_ATTR_MAX, | ||
391 | }; | ||
392 | |||
393 | #define IPVS_STATS_ATTR_MAX (__IPVS_STATS_ATTR_MAX - 1) | ||
394 | |||
395 | /* Attributes used in response to IPVS_CMD_GET_INFO command */ | ||
396 | enum { | ||
397 | IPVS_INFO_ATTR_UNSPEC = 0, | ||
398 | IPVS_INFO_ATTR_VERSION, /* IPVS version number */ | ||
399 | IPVS_INFO_ATTR_CONN_TAB_SIZE, /* size of connection hash table */ | ||
400 | __IPVS_INFO_ATTR_MAX, | ||
401 | }; | ||
402 | |||
403 | #define IPVS_INFO_ATTR_MAX (__IPVS_INFO_ATTR_MAX - 1) | ||
404 | |||
405 | #endif /* _IP_VS_H */ | ||
diff --git a/include/linux/ipc_namespace.h b/include/linux/ipc_namespace.h index ea6c18a8b0d4..ea330f9e7100 100644 --- a/include/linux/ipc_namespace.h +++ b/include/linux/ipc_namespace.h | |||
@@ -36,6 +36,7 @@ struct ipc_namespace { | |||
36 | int msg_ctlmni; | 36 | int msg_ctlmni; |
37 | atomic_t msg_bytes; | 37 | atomic_t msg_bytes; |
38 | atomic_t msg_hdrs; | 38 | atomic_t msg_hdrs; |
39 | int auto_msgmni; | ||
39 | 40 | ||
40 | size_t shm_ctlmax; | 41 | size_t shm_ctlmax; |
41 | size_t shm_ctlall; | 42 | size_t shm_ctlall; |
@@ -53,7 +54,7 @@ extern atomic_t nr_ipc_ns; | |||
53 | 54 | ||
54 | extern int register_ipcns_notifier(struct ipc_namespace *); | 55 | extern int register_ipcns_notifier(struct ipc_namespace *); |
55 | extern int cond_register_ipcns_notifier(struct ipc_namespace *); | 56 | extern int cond_register_ipcns_notifier(struct ipc_namespace *); |
56 | extern int unregister_ipcns_notifier(struct ipc_namespace *); | 57 | extern void unregister_ipcns_notifier(struct ipc_namespace *); |
57 | extern int ipcns_notify(unsigned long); | 58 | extern int ipcns_notify(unsigned long); |
58 | 59 | ||
59 | #else /* CONFIG_SYSVIPC */ | 60 | #else /* CONFIG_SYSVIPC */ |
diff --git a/include/linux/ipv6.h b/include/linux/ipv6.h index cde056e08181..641e026eee8f 100644 --- a/include/linux/ipv6.h +++ b/include/linux/ipv6.h | |||
@@ -123,6 +123,7 @@ struct ipv6hdr { | |||
123 | struct in6_addr daddr; | 123 | struct in6_addr daddr; |
124 | }; | 124 | }; |
125 | 125 | ||
126 | #ifdef __KERNEL__ | ||
126 | /* | 127 | /* |
127 | * This structure contains configuration options per IPv6 link. | 128 | * This structure contains configuration options per IPv6 link. |
128 | */ | 129 | */ |
@@ -163,8 +164,11 @@ struct ipv6_devconf { | |||
163 | #ifdef CONFIG_IPV6_MROUTE | 164 | #ifdef CONFIG_IPV6_MROUTE |
164 | __s32 mc_forwarding; | 165 | __s32 mc_forwarding; |
165 | #endif | 166 | #endif |
167 | __s32 disable_ipv6; | ||
168 | __s32 accept_dad; | ||
166 | void *sysctl; | 169 | void *sysctl; |
167 | }; | 170 | }; |
171 | #endif | ||
168 | 172 | ||
169 | /* index values for the variables in ipv6_devconf */ | 173 | /* index values for the variables in ipv6_devconf */ |
170 | enum { | 174 | enum { |
@@ -194,6 +198,8 @@ enum { | |||
194 | DEVCONF_OPTIMISTIC_DAD, | 198 | DEVCONF_OPTIMISTIC_DAD, |
195 | DEVCONF_ACCEPT_SOURCE_ROUTE, | 199 | DEVCONF_ACCEPT_SOURCE_ROUTE, |
196 | DEVCONF_MC_FORWARDING, | 200 | DEVCONF_MC_FORWARDING, |
201 | DEVCONF_DISABLE_IPV6, | ||
202 | DEVCONF_ACCEPT_DAD, | ||
197 | DEVCONF_MAX | 203 | DEVCONF_MAX |
198 | }; | 204 | }; |
199 | 205 | ||
diff --git a/include/linux/irq.h b/include/linux/irq.h index 552e0ec269c9..8d9411bc60f6 100644 --- a/include/linux/irq.h +++ b/include/linux/irq.h | |||
@@ -62,6 +62,7 @@ typedef void (*irq_flow_handler_t)(unsigned int irq, | |||
62 | #define IRQ_MOVE_PENDING 0x00200000 /* need to re-target IRQ destination */ | 62 | #define IRQ_MOVE_PENDING 0x00200000 /* need to re-target IRQ destination */ |
63 | #define IRQ_NO_BALANCING 0x00400000 /* IRQ is excluded from balancing */ | 63 | #define IRQ_NO_BALANCING 0x00400000 /* IRQ is excluded from balancing */ |
64 | #define IRQ_SPURIOUS_DISABLED 0x00800000 /* IRQ was disabled by the spurious trap */ | 64 | #define IRQ_SPURIOUS_DISABLED 0x00800000 /* IRQ was disabled by the spurious trap */ |
65 | #define IRQ_MOVE_PCNTXT 0x01000000 /* IRQ migration from process context */ | ||
65 | 66 | ||
66 | #ifdef CONFIG_IRQ_PER_CPU | 67 | #ifdef CONFIG_IRQ_PER_CPU |
67 | # define CHECK_IRQ_PER_CPU(var) ((var) & IRQ_PER_CPU) | 68 | # define CHECK_IRQ_PER_CPU(var) ((var) & IRQ_PER_CPU) |
@@ -244,15 +245,6 @@ static inline void set_balance_irq_affinity(unsigned int irq, cpumask_t mask) | |||
244 | } | 245 | } |
245 | #endif | 246 | #endif |
246 | 247 | ||
247 | #ifdef CONFIG_AUTO_IRQ_AFFINITY | ||
248 | extern int select_smp_affinity(unsigned int irq); | ||
249 | #else | ||
250 | static inline int select_smp_affinity(unsigned int irq) | ||
251 | { | ||
252 | return 1; | ||
253 | } | ||
254 | #endif | ||
255 | |||
256 | extern int no_irq_affinity; | 248 | extern int no_irq_affinity; |
257 | 249 | ||
258 | static inline int irq_balancing_disabled(unsigned int irq) | 250 | static inline int irq_balancing_disabled(unsigned int irq) |
diff --git a/include/linux/irqflags.h b/include/linux/irqflags.h index e600c4e9b8c5..74bde13224c9 100644 --- a/include/linux/irqflags.h +++ b/include/linux/irqflags.h | |||
@@ -11,11 +11,13 @@ | |||
11 | #ifndef _LINUX_TRACE_IRQFLAGS_H | 11 | #ifndef _LINUX_TRACE_IRQFLAGS_H |
12 | #define _LINUX_TRACE_IRQFLAGS_H | 12 | #define _LINUX_TRACE_IRQFLAGS_H |
13 | 13 | ||
14 | #include <linux/typecheck.h> | ||
15 | |||
14 | #ifdef CONFIG_TRACE_IRQFLAGS | 16 | #ifdef CONFIG_TRACE_IRQFLAGS |
15 | extern void trace_hardirqs_on(void); | ||
16 | extern void trace_hardirqs_off(void); | ||
17 | extern void trace_softirqs_on(unsigned long ip); | 17 | extern void trace_softirqs_on(unsigned long ip); |
18 | extern void trace_softirqs_off(unsigned long ip); | 18 | extern void trace_softirqs_off(unsigned long ip); |
19 | extern void trace_hardirqs_on(void); | ||
20 | extern void trace_hardirqs_off(void); | ||
19 | # define trace_hardirq_context(p) ((p)->hardirq_context) | 21 | # define trace_hardirq_context(p) ((p)->hardirq_context) |
20 | # define trace_softirq_context(p) ((p)->softirq_context) | 22 | # define trace_softirq_context(p) ((p)->softirq_context) |
21 | # define trace_hardirqs_enabled(p) ((p)->hardirqs_enabled) | 23 | # define trace_hardirqs_enabled(p) ((p)->hardirqs_enabled) |
@@ -41,6 +43,15 @@ | |||
41 | # define INIT_TRACE_IRQFLAGS | 43 | # define INIT_TRACE_IRQFLAGS |
42 | #endif | 44 | #endif |
43 | 45 | ||
46 | #if defined(CONFIG_IRQSOFF_TRACER) || \ | ||
47 | defined(CONFIG_PREEMPT_TRACER) | ||
48 | extern void stop_critical_timings(void); | ||
49 | extern void start_critical_timings(void); | ||
50 | #else | ||
51 | # define stop_critical_timings() do { } while (0) | ||
52 | # define start_critical_timings() do { } while (0) | ||
53 | #endif | ||
54 | |||
44 | #ifdef CONFIG_TRACE_IRQFLAGS_SUPPORT | 55 | #ifdef CONFIG_TRACE_IRQFLAGS_SUPPORT |
45 | 56 | ||
46 | #include <asm/irqflags.h> | 57 | #include <asm/irqflags.h> |
@@ -49,18 +60,24 @@ | |||
49 | do { trace_hardirqs_on(); raw_local_irq_enable(); } while (0) | 60 | do { trace_hardirqs_on(); raw_local_irq_enable(); } while (0) |
50 | #define local_irq_disable() \ | 61 | #define local_irq_disable() \ |
51 | do { raw_local_irq_disable(); trace_hardirqs_off(); } while (0) | 62 | do { raw_local_irq_disable(); trace_hardirqs_off(); } while (0) |
52 | #define local_irq_save(flags) \ | 63 | #define local_irq_save(flags) \ |
53 | do { raw_local_irq_save(flags); trace_hardirqs_off(); } while (0) | 64 | do { \ |
65 | typecheck(unsigned long, flags); \ | ||
66 | raw_local_irq_save(flags); \ | ||
67 | trace_hardirqs_off(); \ | ||
68 | } while (0) | ||
54 | 69 | ||
55 | #define local_irq_restore(flags) \ | 70 | |
56 | do { \ | 71 | #define local_irq_restore(flags) \ |
57 | if (raw_irqs_disabled_flags(flags)) { \ | 72 | do { \ |
58 | raw_local_irq_restore(flags); \ | 73 | typecheck(unsigned long, flags); \ |
59 | trace_hardirqs_off(); \ | 74 | if (raw_irqs_disabled_flags(flags)) { \ |
60 | } else { \ | 75 | raw_local_irq_restore(flags); \ |
61 | trace_hardirqs_on(); \ | 76 | trace_hardirqs_off(); \ |
62 | raw_local_irq_restore(flags); \ | 77 | } else { \ |
63 | } \ | 78 | trace_hardirqs_on(); \ |
79 | raw_local_irq_restore(flags); \ | ||
80 | } \ | ||
64 | } while (0) | 81 | } while (0) |
65 | #else /* !CONFIG_TRACE_IRQFLAGS_SUPPORT */ | 82 | #else /* !CONFIG_TRACE_IRQFLAGS_SUPPORT */ |
66 | /* | 83 | /* |
@@ -69,8 +86,16 @@ | |||
69 | */ | 86 | */ |
70 | # define raw_local_irq_disable() local_irq_disable() | 87 | # define raw_local_irq_disable() local_irq_disable() |
71 | # define raw_local_irq_enable() local_irq_enable() | 88 | # define raw_local_irq_enable() local_irq_enable() |
72 | # define raw_local_irq_save(flags) local_irq_save(flags) | 89 | # define raw_local_irq_save(flags) \ |
73 | # define raw_local_irq_restore(flags) local_irq_restore(flags) | 90 | do { \ |
91 | typecheck(unsigned long, flags); \ | ||
92 | local_irq_save(flags); \ | ||
93 | } while (0) | ||
94 | # define raw_local_irq_restore(flags) \ | ||
95 | do { \ | ||
96 | typecheck(unsigned long, flags); \ | ||
97 | local_irq_restore(flags); \ | ||
98 | } while (0) | ||
74 | #endif /* CONFIG_TRACE_IRQFLAGS_SUPPORT */ | 99 | #endif /* CONFIG_TRACE_IRQFLAGS_SUPPORT */ |
75 | 100 | ||
76 | #ifdef CONFIG_TRACE_IRQFLAGS_SUPPORT | 101 | #ifdef CONFIG_TRACE_IRQFLAGS_SUPPORT |
@@ -80,7 +105,11 @@ | |||
80 | raw_safe_halt(); \ | 105 | raw_safe_halt(); \ |
81 | } while (0) | 106 | } while (0) |
82 | 107 | ||
83 | #define local_save_flags(flags) raw_local_save_flags(flags) | 108 | #define local_save_flags(flags) \ |
109 | do { \ | ||
110 | typecheck(unsigned long, flags); \ | ||
111 | raw_local_save_flags(flags); \ | ||
112 | } while (0) | ||
84 | 113 | ||
85 | #define irqs_disabled() \ | 114 | #define irqs_disabled() \ |
86 | ({ \ | 115 | ({ \ |
@@ -90,7 +119,11 @@ | |||
90 | raw_irqs_disabled_flags(_flags); \ | 119 | raw_irqs_disabled_flags(_flags); \ |
91 | }) | 120 | }) |
92 | 121 | ||
93 | #define irqs_disabled_flags(flags) raw_irqs_disabled_flags(flags) | 122 | #define irqs_disabled_flags(flags) \ |
123 | ({ \ | ||
124 | typecheck(unsigned long, flags); \ | ||
125 | raw_irqs_disabled_flags(flags); \ | ||
126 | }) | ||
94 | #endif /* CONFIG_X86 */ | 127 | #endif /* CONFIG_X86 */ |
95 | 128 | ||
96 | #endif | 129 | #endif |
diff --git a/include/linux/isdn_ppp.h b/include/linux/isdn_ppp.h index 8687a7dc0632..4c218ee7587a 100644 --- a/include/linux/isdn_ppp.h +++ b/include/linux/isdn_ppp.h | |||
@@ -157,7 +157,7 @@ typedef struct { | |||
157 | 157 | ||
158 | typedef struct { | 158 | typedef struct { |
159 | int mp_mrru; /* unused */ | 159 | int mp_mrru; /* unused */ |
160 | struct sk_buff * frags; /* fragments sl list -- use skb->next */ | 160 | struct sk_buff_head frags; /* fragments sl list */ |
161 | long frames; /* number of frames in the frame list */ | 161 | long frames; /* number of frames in the frame list */ |
162 | unsigned int seq; /* last processed packet seq #: any packets | 162 | unsigned int seq; /* last processed packet seq #: any packets |
163 | * with smaller seq # will be dropped | 163 | * with smaller seq # will be dropped |
diff --git a/include/linux/istallion.h b/include/linux/istallion.h index 5a84fe944b74..0d1840723249 100644 --- a/include/linux/istallion.h +++ b/include/linux/istallion.h | |||
@@ -51,25 +51,21 @@ | |||
51 | */ | 51 | */ |
52 | struct stliport { | 52 | struct stliport { |
53 | unsigned long magic; | 53 | unsigned long magic; |
54 | struct tty_port port; | ||
54 | unsigned int portnr; | 55 | unsigned int portnr; |
55 | unsigned int panelnr; | 56 | unsigned int panelnr; |
56 | unsigned int brdnr; | 57 | unsigned int brdnr; |
57 | unsigned long state; | 58 | unsigned long state; |
58 | unsigned int devnr; | 59 | unsigned int devnr; |
59 | int flags; | ||
60 | int baud_base; | 60 | int baud_base; |
61 | int custom_divisor; | 61 | int custom_divisor; |
62 | int close_delay; | 62 | int close_delay; |
63 | int closing_wait; | 63 | int closing_wait; |
64 | int refcount; | ||
65 | int openwaitcnt; | 64 | int openwaitcnt; |
66 | int rc; | 65 | int rc; |
67 | int argsize; | 66 | int argsize; |
68 | void *argp; | 67 | void *argp; |
69 | unsigned int rxmarkmsk; | 68 | unsigned int rxmarkmsk; |
70 | struct tty_struct *tty; | ||
71 | wait_queue_head_t open_wait; | ||
72 | wait_queue_head_t close_wait; | ||
73 | wait_queue_head_t raw_wait; | 69 | wait_queue_head_t raw_wait; |
74 | struct asysigs asig; | 70 | struct asysigs asig; |
75 | unsigned long addr; | 71 | unsigned long addr; |
diff --git a/include/linux/ivtv.h b/include/linux/ivtv.h index 794b8daa9378..f2720280b9ec 100644 --- a/include/linux/ivtv.h +++ b/include/linux/ivtv.h | |||
@@ -21,12 +21,9 @@ | |||
21 | #ifndef __LINUX_IVTV_H__ | 21 | #ifndef __LINUX_IVTV_H__ |
22 | #define __LINUX_IVTV_H__ | 22 | #define __LINUX_IVTV_H__ |
23 | 23 | ||
24 | #ifdef __KERNEL__ | 24 | #include <linux/compiler.h> |
25 | #include <linux/compiler.h> /* need __user */ | ||
26 | #else | ||
27 | #define __user | ||
28 | #endif | ||
29 | #include <linux/types.h> | 25 | #include <linux/types.h> |
26 | #include <linux/videodev2.h> | ||
30 | 27 | ||
31 | /* ivtv knows several distinct output modes: MPEG streaming, | 28 | /* ivtv knows several distinct output modes: MPEG streaming, |
32 | YUV streaming, YUV updates through user DMA and the passthrough | 29 | YUV streaming, YUV updates through user DMA and the passthrough |
diff --git a/include/linux/ivtvfb.h b/include/linux/ivtvfb.h index e980ba62ddcc..e20af47b59ad 100644 --- a/include/linux/ivtvfb.h +++ b/include/linux/ivtvfb.h | |||
@@ -21,11 +21,7 @@ | |||
21 | #ifndef __LINUX_IVTVFB_H__ | 21 | #ifndef __LINUX_IVTVFB_H__ |
22 | #define __LINUX_IVTVFB_H__ | 22 | #define __LINUX_IVTVFB_H__ |
23 | 23 | ||
24 | #ifdef __KERNEL__ | 24 | #include <linux/compiler.h> |
25 | #include <linux/compiler.h> /* need __user */ | ||
26 | #else | ||
27 | #define __user | ||
28 | #endif | ||
29 | #include <linux/types.h> | 25 | #include <linux/types.h> |
30 | 26 | ||
31 | /* Framebuffer external API */ | 27 | /* Framebuffer external API */ |
diff --git a/include/linux/jbd2.h b/include/linux/jbd2.h index d147f0f90360..d2e91ea998fd 100644 --- a/include/linux/jbd2.h +++ b/include/linux/jbd2.h | |||
@@ -168,6 +168,8 @@ struct commit_header { | |||
168 | unsigned char h_chksum_size; | 168 | unsigned char h_chksum_size; |
169 | unsigned char h_padding[2]; | 169 | unsigned char h_padding[2]; |
170 | __be32 h_chksum[JBD2_CHECKSUM_BYTES]; | 170 | __be32 h_chksum[JBD2_CHECKSUM_BYTES]; |
171 | __be64 h_commit_sec; | ||
172 | __be32 h_commit_nsec; | ||
171 | }; | 173 | }; |
172 | 174 | ||
173 | /* | 175 | /* |
@@ -379,6 +381,38 @@ static inline void jbd_unlock_bh_journal_head(struct buffer_head *bh) | |||
379 | bit_spin_unlock(BH_JournalHead, &bh->b_state); | 381 | bit_spin_unlock(BH_JournalHead, &bh->b_state); |
380 | } | 382 | } |
381 | 383 | ||
384 | /* Flags in jbd_inode->i_flags */ | ||
385 | #define __JI_COMMIT_RUNNING 0 | ||
386 | /* Commit of the inode data in progress. We use this flag to protect us from | ||
387 | * concurrent deletion of inode. We cannot use reference to inode for this | ||
388 | * since we cannot afford doing last iput() on behalf of kjournald | ||
389 | */ | ||
390 | #define JI_COMMIT_RUNNING (1 << __JI_COMMIT_RUNNING) | ||
391 | |||
392 | /** | ||
393 | * struct jbd_inode is the structure linking inodes in ordered mode | ||
394 | * present in a transaction so that we can sync them during commit. | ||
395 | */ | ||
396 | struct jbd2_inode { | ||
397 | /* Which transaction does this inode belong to? Either the running | ||
398 | * transaction or the committing one. [j_list_lock] */ | ||
399 | transaction_t *i_transaction; | ||
400 | |||
401 | /* Pointer to the running transaction modifying inode's data in case | ||
402 | * there is already a committing transaction touching it. [j_list_lock] */ | ||
403 | transaction_t *i_next_transaction; | ||
404 | |||
405 | /* List of inodes in the i_transaction [j_list_lock] */ | ||
406 | struct list_head i_list; | ||
407 | |||
408 | /* VFS inode this inode belongs to [constant during the lifetime | ||
409 | * of the structure] */ | ||
410 | struct inode *i_vfs_inode; | ||
411 | |||
412 | /* Flags of inode [j_list_lock] */ | ||
413 | unsigned int i_flags; | ||
414 | }; | ||
415 | |||
382 | struct jbd2_revoke_table_s; | 416 | struct jbd2_revoke_table_s; |
383 | 417 | ||
384 | /** | 418 | /** |
@@ -509,24 +543,12 @@ struct transaction_s | |||
509 | struct journal_head *t_reserved_list; | 543 | struct journal_head *t_reserved_list; |
510 | 544 | ||
511 | /* | 545 | /* |
512 | * Doubly-linked circular list of all buffers under writeout during | ||
513 | * commit [j_list_lock] | ||
514 | */ | ||
515 | struct journal_head *t_locked_list; | ||
516 | |||
517 | /* | ||
518 | * Doubly-linked circular list of all metadata buffers owned by this | 546 | * Doubly-linked circular list of all metadata buffers owned by this |
519 | * transaction [j_list_lock] | 547 | * transaction [j_list_lock] |
520 | */ | 548 | */ |
521 | struct journal_head *t_buffers; | 549 | struct journal_head *t_buffers; |
522 | 550 | ||
523 | /* | 551 | /* |
524 | * Doubly-linked circular list of all data buffers still to be | ||
525 | * flushed before this transaction can be committed [j_list_lock] | ||
526 | */ | ||
527 | struct journal_head *t_sync_datalist; | ||
528 | |||
529 | /* | ||
530 | * Doubly-linked circular list of all forget buffers (superseded | 552 | * Doubly-linked circular list of all forget buffers (superseded |
531 | * buffers which we can un-checkpoint once this transaction commits) | 553 | * buffers which we can un-checkpoint once this transaction commits) |
532 | * [j_list_lock] | 554 | * [j_list_lock] |
@@ -565,6 +587,12 @@ struct transaction_s | |||
565 | struct journal_head *t_log_list; | 587 | struct journal_head *t_log_list; |
566 | 588 | ||
567 | /* | 589 | /* |
590 | * List of inodes whose data we've modified in data=ordered mode. | ||
591 | * [j_list_lock] | ||
592 | */ | ||
593 | struct list_head t_inode_list; | ||
594 | |||
595 | /* | ||
568 | * Protects info related to handles | 596 | * Protects info related to handles |
569 | */ | 597 | */ |
570 | spinlock_t t_handle_lock; | 598 | spinlock_t t_handle_lock; |
@@ -822,7 +850,8 @@ struct journal_s | |||
822 | */ | 850 | */ |
823 | struct block_device *j_dev; | 851 | struct block_device *j_dev; |
824 | int j_blocksize; | 852 | int j_blocksize; |
825 | unsigned long long j_blk_offset; | 853 | unsigned long long j_blk_offset; |
854 | char j_devname[BDEVNAME_SIZE+24]; | ||
826 | 855 | ||
827 | /* | 856 | /* |
828 | * Device which holds the client fs. For internal journal this will be | 857 | * Device which holds the client fs. For internal journal this will be |
@@ -938,6 +967,9 @@ struct journal_s | |||
938 | #define JBD2_FLUSHED 0x008 /* The journal superblock has been flushed */ | 967 | #define JBD2_FLUSHED 0x008 /* The journal superblock has been flushed */ |
939 | #define JBD2_LOADED 0x010 /* The journal superblock has been loaded */ | 968 | #define JBD2_LOADED 0x010 /* The journal superblock has been loaded */ |
940 | #define JBD2_BARRIER 0x020 /* Use IDE barriers */ | 969 | #define JBD2_BARRIER 0x020 /* Use IDE barriers */ |
970 | #define JBD2_ABORT_ON_SYNCDATA_ERR 0x040 /* Abort the journal on file | ||
971 | * data write error in ordered | ||
972 | * mode */ | ||
941 | 973 | ||
942 | /* | 974 | /* |
943 | * Function declarations for the journaling transaction and buffer | 975 | * Function declarations for the journaling transaction and buffer |
@@ -1004,7 +1036,6 @@ extern int jbd2_journal_extend (handle_t *, int nblocks); | |||
1004 | extern int jbd2_journal_get_write_access(handle_t *, struct buffer_head *); | 1036 | extern int jbd2_journal_get_write_access(handle_t *, struct buffer_head *); |
1005 | extern int jbd2_journal_get_create_access (handle_t *, struct buffer_head *); | 1037 | extern int jbd2_journal_get_create_access (handle_t *, struct buffer_head *); |
1006 | extern int jbd2_journal_get_undo_access(handle_t *, struct buffer_head *); | 1038 | extern int jbd2_journal_get_undo_access(handle_t *, struct buffer_head *); |
1007 | extern int jbd2_journal_dirty_data (handle_t *, struct buffer_head *); | ||
1008 | extern int jbd2_journal_dirty_metadata (handle_t *, struct buffer_head *); | 1039 | extern int jbd2_journal_dirty_metadata (handle_t *, struct buffer_head *); |
1009 | extern void jbd2_journal_release_buffer (handle_t *, struct buffer_head *); | 1040 | extern void jbd2_journal_release_buffer (handle_t *, struct buffer_head *); |
1010 | extern int jbd2_journal_forget (handle_t *, struct buffer_head *); | 1041 | extern int jbd2_journal_forget (handle_t *, struct buffer_head *); |
@@ -1032,7 +1063,7 @@ extern void jbd2_journal_clear_features | |||
1032 | (journal_t *, unsigned long, unsigned long, unsigned long); | 1063 | (journal_t *, unsigned long, unsigned long, unsigned long); |
1033 | extern int jbd2_journal_create (journal_t *); | 1064 | extern int jbd2_journal_create (journal_t *); |
1034 | extern int jbd2_journal_load (journal_t *journal); | 1065 | extern int jbd2_journal_load (journal_t *journal); |
1035 | extern void jbd2_journal_destroy (journal_t *); | 1066 | extern int jbd2_journal_destroy (journal_t *); |
1036 | extern int jbd2_journal_recover (journal_t *journal); | 1067 | extern int jbd2_journal_recover (journal_t *journal); |
1037 | extern int jbd2_journal_wipe (journal_t *, int); | 1068 | extern int jbd2_journal_wipe (journal_t *, int); |
1038 | extern int jbd2_journal_skip_recovery (journal_t *); | 1069 | extern int jbd2_journal_skip_recovery (journal_t *); |
@@ -1044,6 +1075,10 @@ extern void jbd2_journal_ack_err (journal_t *); | |||
1044 | extern int jbd2_journal_clear_err (journal_t *); | 1075 | extern int jbd2_journal_clear_err (journal_t *); |
1045 | extern int jbd2_journal_bmap(journal_t *, unsigned long, unsigned long long *); | 1076 | extern int jbd2_journal_bmap(journal_t *, unsigned long, unsigned long long *); |
1046 | extern int jbd2_journal_force_commit(journal_t *); | 1077 | extern int jbd2_journal_force_commit(journal_t *); |
1078 | extern int jbd2_journal_file_inode(handle_t *handle, struct jbd2_inode *inode); | ||
1079 | extern int jbd2_journal_begin_ordered_truncate(struct jbd2_inode *inode, loff_t new_size); | ||
1080 | extern void jbd2_journal_init_jbd_inode(struct jbd2_inode *jinode, struct inode *inode); | ||
1081 | extern void jbd2_journal_release_jbd_inode(journal_t *journal, struct jbd2_inode *jinode); | ||
1047 | 1082 | ||
1048 | /* | 1083 | /* |
1049 | * journal_head management | 1084 | * journal_head management |
@@ -1179,15 +1214,13 @@ static inline int jbd_space_needed(journal_t *journal) | |||
1179 | 1214 | ||
1180 | /* journaling buffer types */ | 1215 | /* journaling buffer types */ |
1181 | #define BJ_None 0 /* Not journaled */ | 1216 | #define BJ_None 0 /* Not journaled */ |
1182 | #define BJ_SyncData 1 /* Normal data: flush before commit */ | 1217 | #define BJ_Metadata 1 /* Normal journaled metadata */ |
1183 | #define BJ_Metadata 2 /* Normal journaled metadata */ | 1218 | #define BJ_Forget 2 /* Buffer superseded by this transaction */ |
1184 | #define BJ_Forget 3 /* Buffer superseded by this transaction */ | 1219 | #define BJ_IO 3 /* Buffer is for temporary IO use */ |
1185 | #define BJ_IO 4 /* Buffer is for temporary IO use */ | 1220 | #define BJ_Shadow 4 /* Buffer contents being shadowed to the log */ |
1186 | #define BJ_Shadow 5 /* Buffer contents being shadowed to the log */ | 1221 | #define BJ_LogCtl 5 /* Buffer contains log descriptors */ |
1187 | #define BJ_LogCtl 6 /* Buffer contains log descriptors */ | 1222 | #define BJ_Reserved 6 /* Buffer is reserved for access by journal */ |
1188 | #define BJ_Reserved 7 /* Buffer is reserved for access by journal */ | 1223 | #define BJ_Types 7 |
1189 | #define BJ_Locked 8 /* Locked for I/O during commit */ | ||
1190 | #define BJ_Types 9 | ||
1191 | 1224 | ||
1192 | extern int jbd_blocks_per_page(struct inode *inode); | 1225 | extern int jbd_blocks_per_page(struct inode *inode); |
1193 | 1226 | ||
diff --git a/include/linux/jffs2.h b/include/linux/jffs2.h index 6b563cae23df..da720bc3eb15 100644 --- a/include/linux/jffs2.h +++ b/include/linux/jffs2.h | |||
@@ -7,9 +7,6 @@ | |||
7 | * | 7 | * |
8 | * For licensing information, see the file 'LICENCE' in the | 8 | * For licensing information, see the file 'LICENCE' in the |
9 | * jffs2 directory. | 9 | * jffs2 directory. |
10 | * | ||
11 | * $Id: jffs2.h,v 1.38 2005/09/26 11:37:23 havasi Exp $ | ||
12 | * | ||
13 | */ | 10 | */ |
14 | 11 | ||
15 | #ifndef __LINUX_JFFS2_H__ | 12 | #ifndef __LINUX_JFFS2_H__ |
diff --git a/include/linux/joystick.h b/include/linux/joystick.h index e2d3a18af456..b5e051295a67 100644 --- a/include/linux/joystick.h +++ b/include/linux/joystick.h | |||
@@ -2,8 +2,6 @@ | |||
2 | #define _LINUX_JOYSTICK_H | 2 | #define _LINUX_JOYSTICK_H |
3 | 3 | ||
4 | /* | 4 | /* |
5 | * $Id: joystick.h,v 1.3 2000/11/30 11:07:05 vojtech Exp $ | ||
6 | * | ||
7 | * Copyright (C) 1996-2000 Vojtech Pavlik | 5 | * Copyright (C) 1996-2000 Vojtech Pavlik |
8 | * | 6 | * |
9 | * Sponsored by SuSE | 7 | * Sponsored by SuSE |
diff --git a/include/linux/kallsyms.h b/include/linux/kallsyms.h index 00c1801099fa..b96144887444 100644 --- a/include/linux/kallsyms.h +++ b/include/linux/kallsyms.h | |||
@@ -6,6 +6,7 @@ | |||
6 | #define _LINUX_KALLSYMS_H | 6 | #define _LINUX_KALLSYMS_H |
7 | 7 | ||
8 | #include <linux/errno.h> | 8 | #include <linux/errno.h> |
9 | #include <linux/kernel.h> | ||
9 | #include <linux/stddef.h> | 10 | #include <linux/stddef.h> |
10 | 11 | ||
11 | #define KSYM_NAME_LEN 128 | 12 | #define KSYM_NAME_LEN 128 |
@@ -105,18 +106,9 @@ static inline void print_fn_descriptor_symbol(const char *fmt, void *addr) | |||
105 | print_symbol(fmt, (unsigned long)addr); | 106 | print_symbol(fmt, (unsigned long)addr); |
106 | } | 107 | } |
107 | 108 | ||
108 | #ifndef CONFIG_64BIT | 109 | static inline void print_ip_sym(unsigned long ip) |
109 | #define print_ip_sym(ip) \ | 110 | { |
110 | do { \ | 111 | printk("[<%p>] %pS\n", (void *) ip, (void *) ip); |
111 | printk("[<%08lx>]", ip); \ | 112 | } |
112 | print_symbol(" %s\n", ip); \ | ||
113 | } while(0) | ||
114 | #else | ||
115 | #define print_ip_sym(ip) \ | ||
116 | do { \ | ||
117 | printk("[<%016lx>]", ip); \ | ||
118 | print_symbol(" %s\n", ip); \ | ||
119 | } while(0) | ||
120 | #endif | ||
121 | 113 | ||
122 | #endif /*_LINUX_KALLSYMS_H*/ | 114 | #endif /*_LINUX_KALLSYMS_H*/ |
diff --git a/include/linux/kernel.h b/include/linux/kernel.h index 792bf0aa779b..75d81f157d2e 100644 --- a/include/linux/kernel.h +++ b/include/linux/kernel.h | |||
@@ -14,6 +14,8 @@ | |||
14 | #include <linux/compiler.h> | 14 | #include <linux/compiler.h> |
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> | ||
18 | #include <linux/ratelimit.h> | ||
17 | #include <asm/byteorder.h> | 19 | #include <asm/byteorder.h> |
18 | #include <asm/bug.h> | 20 | #include <asm/bug.h> |
19 | 21 | ||
@@ -46,6 +48,9 @@ extern const char linux_proc_banner[]; | |||
46 | #define DIV_ROUND_UP(n,d) (((n) + (d) - 1) / (d)) | 48 | #define DIV_ROUND_UP(n,d) (((n) + (d) - 1) / (d)) |
47 | #define roundup(x, y) ((((x) + ((y) - 1)) / (y)) * (y)) | 49 | #define roundup(x, y) ((((x) + ((y) - 1)) / (y)) * (y)) |
48 | 50 | ||
51 | #define _RET_IP_ (unsigned long)__builtin_return_address(0) | ||
52 | #define _THIS_IP_ ({ __label__ __here; __here: (unsigned long)&&__here; }) | ||
53 | |||
49 | #ifdef CONFIG_LBD | 54 | #ifdef CONFIG_LBD |
50 | # include <asm/div64.h> | 55 | # include <asm/div64.h> |
51 | # define sector_div(a, b) do_div(a, b) | 56 | # define sector_div(a, b) do_div(a, b) |
@@ -70,6 +75,12 @@ extern const char linux_proc_banner[]; | |||
70 | */ | 75 | */ |
71 | #define upper_32_bits(n) ((u32)(((n) >> 16) >> 16)) | 76 | #define upper_32_bits(n) ((u32)(((n) >> 16) >> 16)) |
72 | 77 | ||
78 | /** | ||
79 | * lower_32_bits - return bits 0-31 of a number | ||
80 | * @n: the number we're accessing | ||
81 | */ | ||
82 | #define lower_32_bits(n) ((u32)(n)) | ||
83 | |||
73 | #define KERN_EMERG "<0>" /* system is unusable */ | 84 | #define KERN_EMERG "<0>" /* system is unusable */ |
74 | #define KERN_ALERT "<1>" /* action must be taken immediately */ | 85 | #define KERN_ALERT "<1>" /* action must be taken immediately */ |
75 | #define KERN_CRIT "<2>" /* critical conditions */ | 86 | #define KERN_CRIT "<2>" /* critical conditions */ |
@@ -97,6 +108,13 @@ struct completion; | |||
97 | struct pt_regs; | 108 | struct pt_regs; |
98 | struct user; | 109 | struct user; |
99 | 110 | ||
111 | #ifdef CONFIG_PREEMPT_VOLUNTARY | ||
112 | extern int _cond_resched(void); | ||
113 | # define might_resched() _cond_resched() | ||
114 | #else | ||
115 | # define might_resched() do { } while (0) | ||
116 | #endif | ||
117 | |||
100 | /** | 118 | /** |
101 | * might_sleep - annotation for functions that can sleep | 119 | * might_sleep - annotation for functions that can sleep |
102 | * | 120 | * |
@@ -107,13 +125,6 @@ struct user; | |||
107 | * be bitten later when the calling function happens to sleep when it is not | 125 | * be bitten later when the calling function happens to sleep when it is not |
108 | * supposed to. | 126 | * supposed to. |
109 | */ | 127 | */ |
110 | #ifdef CONFIG_PREEMPT_VOLUNTARY | ||
111 | extern int _cond_resched(void); | ||
112 | # define might_resched() _cond_resched() | ||
113 | #else | ||
114 | # define might_resched() do { } while (0) | ||
115 | #endif | ||
116 | |||
117 | #ifdef CONFIG_DEBUG_SPINLOCK_SLEEP | 128 | #ifdef CONFIG_DEBUG_SPINLOCK_SLEEP |
118 | void __might_sleep(char *file, int line); | 129 | void __might_sleep(char *file, int line); |
119 | # define might_sleep() \ | 130 | # define might_sleep() \ |
@@ -171,7 +182,7 @@ extern int vsscanf(const char *, const char *, va_list) | |||
171 | 182 | ||
172 | extern int get_option(char **str, int *pint); | 183 | extern int get_option(char **str, int *pint); |
173 | extern char *get_options(const char *str, int nints, int *ints); | 184 | extern char *get_options(const char *str, int nints, int *ints); |
174 | extern unsigned long long memparse(char *ptr, char **retptr); | 185 | extern unsigned long long memparse(const char *ptr, char **retptr); |
175 | 186 | ||
176 | extern int core_kernel_text(unsigned long addr); | 187 | extern int core_kernel_text(unsigned long addr); |
177 | extern int __kernel_text_address(unsigned long addr); | 188 | extern int __kernel_text_address(unsigned long addr); |
@@ -184,15 +195,9 @@ asmlinkage int vprintk(const char *fmt, va_list args) | |||
184 | __attribute__ ((format (printf, 1, 0))); | 195 | __attribute__ ((format (printf, 1, 0))); |
185 | asmlinkage int printk(const char * fmt, ...) | 196 | asmlinkage int printk(const char * fmt, ...) |
186 | __attribute__ ((format (printf, 1, 2))) __cold; | 197 | __attribute__ ((format (printf, 1, 2))) __cold; |
187 | extern int log_buf_get_len(void); | ||
188 | extern int log_buf_read(int idx); | ||
189 | extern int log_buf_copy(char *dest, int idx, int len); | ||
190 | 198 | ||
191 | extern int printk_ratelimit_jiffies; | 199 | extern struct ratelimit_state printk_ratelimit_state; |
192 | extern int printk_ratelimit_burst; | ||
193 | extern int printk_ratelimit(void); | 200 | extern int printk_ratelimit(void); |
194 | extern int __ratelimit(int ratelimit_jiffies, int ratelimit_burst); | ||
195 | extern int __printk_ratelimit(int ratelimit_jiffies, int ratelimit_burst); | ||
196 | extern bool printk_timed_ratelimit(unsigned long *caller_jiffies, | 201 | extern bool printk_timed_ratelimit(unsigned long *caller_jiffies, |
197 | unsigned int interval_msec); | 202 | unsigned int interval_msec); |
198 | #else | 203 | #else |
@@ -202,18 +207,13 @@ static inline int vprintk(const char *s, va_list args) { return 0; } | |||
202 | static inline int printk(const char *s, ...) | 207 | static inline int printk(const char *s, ...) |
203 | __attribute__ ((format (printf, 1, 2))); | 208 | __attribute__ ((format (printf, 1, 2))); |
204 | static inline int __cold printk(const char *s, ...) { return 0; } | 209 | static inline int __cold printk(const char *s, ...) { return 0; } |
205 | static inline int log_buf_get_len(void) { return 0; } | ||
206 | static inline int log_buf_read(int idx) { return 0; } | ||
207 | static inline int log_buf_copy(char *dest, int idx, int len) { return 0; } | ||
208 | static inline int printk_ratelimit(void) { return 0; } | 210 | static inline int printk_ratelimit(void) { return 0; } |
209 | static inline int __printk_ratelimit(int ratelimit_jiffies, \ | ||
210 | int ratelimit_burst) { return 0; } | ||
211 | static inline bool printk_timed_ratelimit(unsigned long *caller_jiffies, \ | 211 | static inline bool printk_timed_ratelimit(unsigned long *caller_jiffies, \ |
212 | unsigned int interval_msec) \ | 212 | unsigned int interval_msec) \ |
213 | { return false; } | 213 | { return false; } |
214 | #endif | 214 | #endif |
215 | 215 | ||
216 | extern void __attribute__((format(printf, 1, 2))) | 216 | extern void asmlinkage __attribute__((format(printf, 1, 2))) |
217 | early_printk(const char *fmt, ...); | 217 | early_printk(const char *fmt, ...); |
218 | 218 | ||
219 | unsigned long int_sqrt(unsigned long); | 219 | unsigned long int_sqrt(unsigned long); |
@@ -444,26 +444,6 @@ static inline char *pack_hex_byte(char *buf, u8 byte) | |||
444 | const typeof( ((type *)0)->member ) *__mptr = (ptr); \ | 444 | const typeof( ((type *)0)->member ) *__mptr = (ptr); \ |
445 | (type *)( (char *)__mptr - offsetof(type,member) );}) | 445 | (type *)( (char *)__mptr - offsetof(type,member) );}) |
446 | 446 | ||
447 | /* | ||
448 | * Check at compile time that something is of a particular type. | ||
449 | * Always evaluates to 1 so you may use it easily in comparisons. | ||
450 | */ | ||
451 | #define typecheck(type,x) \ | ||
452 | ({ type __dummy; \ | ||
453 | typeof(x) __dummy2; \ | ||
454 | (void)(&__dummy == &__dummy2); \ | ||
455 | 1; \ | ||
456 | }) | ||
457 | |||
458 | /* | ||
459 | * Check at compile time that 'function' is a certain type, or is a pointer | ||
460 | * to that type (needs to use typedef for the function type.) | ||
461 | */ | ||
462 | #define typecheck_fn(type,function) \ | ||
463 | ({ typeof(type) __tmp = function; \ | ||
464 | (void)__tmp; \ | ||
465 | }) | ||
466 | |||
467 | struct sysinfo; | 447 | struct sysinfo; |
468 | extern int do_sysinfo(struct sysinfo *info); | 448 | extern int do_sysinfo(struct sysinfo *info); |
469 | 449 | ||
diff --git a/include/linux/kernel_stat.h b/include/linux/kernel_stat.h index e8ffce898bf9..cf9f40a91c9c 100644 --- a/include/linux/kernel_stat.h +++ b/include/linux/kernel_stat.h | |||
@@ -1,11 +1,11 @@ | |||
1 | #ifndef _LINUX_KERNEL_STAT_H | 1 | #ifndef _LINUX_KERNEL_STAT_H |
2 | #define _LINUX_KERNEL_STAT_H | 2 | #define _LINUX_KERNEL_STAT_H |
3 | 3 | ||
4 | #include <asm/irq.h> | ||
5 | #include <linux/smp.h> | 4 | #include <linux/smp.h> |
6 | #include <linux/threads.h> | 5 | #include <linux/threads.h> |
7 | #include <linux/percpu.h> | 6 | #include <linux/percpu.h> |
8 | #include <linux/cpumask.h> | 7 | #include <linux/cpumask.h> |
8 | #include <asm/irq.h> | ||
9 | #include <asm/cputime.h> | 9 | #include <asm/cputime.h> |
10 | 10 | ||
11 | /* | 11 | /* |
diff --git a/include/linux/kexec.h b/include/linux/kexec.h index 3265968cd2cd..17f76fc05173 100644 --- a/include/linux/kexec.h +++ b/include/linux/kexec.h | |||
@@ -25,8 +25,8 @@ | |||
25 | #error KEXEC_CONTROL_MEMORY_LIMIT not defined | 25 | #error KEXEC_CONTROL_MEMORY_LIMIT not defined |
26 | #endif | 26 | #endif |
27 | 27 | ||
28 | #ifndef KEXEC_CONTROL_CODE_SIZE | 28 | #ifndef KEXEC_CONTROL_PAGE_SIZE |
29 | #error KEXEC_CONTROL_CODE_SIZE not defined | 29 | #error KEXEC_CONTROL_PAGE_SIZE not defined |
30 | #endif | 30 | #endif |
31 | 31 | ||
32 | #ifndef KEXEC_ARCH | 32 | #ifndef KEXEC_ARCH |
@@ -83,6 +83,7 @@ struct kimage { | |||
83 | 83 | ||
84 | unsigned long start; | 84 | unsigned long start; |
85 | struct page *control_code_page; | 85 | struct page *control_code_page; |
86 | struct page *swap_page; | ||
86 | 87 | ||
87 | unsigned long nr_segments; | 88 | unsigned long nr_segments; |
88 | struct kexec_segment segment[KEXEC_SEGMENT_MAX]; | 89 | struct kexec_segment segment[KEXEC_SEGMENT_MAX]; |
@@ -98,18 +99,20 @@ struct kimage { | |||
98 | unsigned int type : 1; | 99 | unsigned int type : 1; |
99 | #define KEXEC_TYPE_DEFAULT 0 | 100 | #define KEXEC_TYPE_DEFAULT 0 |
100 | #define KEXEC_TYPE_CRASH 1 | 101 | #define KEXEC_TYPE_CRASH 1 |
102 | unsigned int preserve_context : 1; | ||
101 | }; | 103 | }; |
102 | 104 | ||
103 | 105 | ||
104 | 106 | ||
105 | /* kexec interface functions */ | 107 | /* kexec interface functions */ |
106 | extern NORET_TYPE void machine_kexec(struct kimage *image) ATTRIB_NORET; | 108 | extern void machine_kexec(struct kimage *image); |
107 | extern int machine_kexec_prepare(struct kimage *image); | 109 | extern int machine_kexec_prepare(struct kimage *image); |
108 | extern void machine_kexec_cleanup(struct kimage *image); | 110 | extern void machine_kexec_cleanup(struct kimage *image); |
109 | extern asmlinkage long sys_kexec_load(unsigned long entry, | 111 | extern asmlinkage long sys_kexec_load(unsigned long entry, |
110 | unsigned long nr_segments, | 112 | unsigned long nr_segments, |
111 | struct kexec_segment __user *segments, | 113 | struct kexec_segment __user *segments, |
112 | unsigned long flags); | 114 | unsigned long flags); |
115 | extern int kernel_kexec(void); | ||
113 | #ifdef CONFIG_COMPAT | 116 | #ifdef CONFIG_COMPAT |
114 | extern asmlinkage long compat_sys_kexec_load(unsigned long entry, | 117 | extern asmlinkage long compat_sys_kexec_load(unsigned long entry, |
115 | unsigned long nr_segments, | 118 | unsigned long nr_segments, |
@@ -127,8 +130,8 @@ void vmcoreinfo_append_str(const char *fmt, ...) | |||
127 | __attribute__ ((format (printf, 1, 2))); | 130 | __attribute__ ((format (printf, 1, 2))); |
128 | unsigned long paddr_vmcoreinfo_note(void); | 131 | unsigned long paddr_vmcoreinfo_note(void); |
129 | 132 | ||
130 | #define VMCOREINFO_OSRELEASE(name) \ | 133 | #define VMCOREINFO_OSRELEASE(value) \ |
131 | vmcoreinfo_append_str("OSRELEASE=%s\n", #name) | 134 | vmcoreinfo_append_str("OSRELEASE=%s\n", value) |
132 | #define VMCOREINFO_PAGESIZE(value) \ | 135 | #define VMCOREINFO_PAGESIZE(value) \ |
133 | vmcoreinfo_append_str("PAGESIZE=%ld\n", value) | 136 | vmcoreinfo_append_str("PAGESIZE=%ld\n", value) |
134 | #define VMCOREINFO_SYMBOL(name) \ | 137 | #define VMCOREINFO_SYMBOL(name) \ |
@@ -156,8 +159,9 @@ extern struct kimage *kexec_crash_image; | |||
156 | #define kexec_flush_icache_page(page) | 159 | #define kexec_flush_icache_page(page) |
157 | #endif | 160 | #endif |
158 | 161 | ||
159 | #define KEXEC_ON_CRASH 0x00000001 | 162 | #define KEXEC_ON_CRASH 0x00000001 |
160 | #define KEXEC_ARCH_MASK 0xffff0000 | 163 | #define KEXEC_PRESERVE_CONTEXT 0x00000002 |
164 | #define KEXEC_ARCH_MASK 0xffff0000 | ||
161 | 165 | ||
162 | /* These values match the ELF architecture values. | 166 | /* These values match the ELF architecture values. |
163 | * Unless there is a good reason that should continue to be the case. | 167 | * Unless there is a good reason that should continue to be the case. |
@@ -174,7 +178,12 @@ extern struct kimage *kexec_crash_image; | |||
174 | #define KEXEC_ARCH_MIPS_LE (10 << 16) | 178 | #define KEXEC_ARCH_MIPS_LE (10 << 16) |
175 | #define KEXEC_ARCH_MIPS ( 8 << 16) | 179 | #define KEXEC_ARCH_MIPS ( 8 << 16) |
176 | 180 | ||
177 | #define KEXEC_FLAGS (KEXEC_ON_CRASH) /* List of defined/legal kexec flags */ | 181 | /* List of defined/legal kexec flags */ |
182 | #ifndef CONFIG_KEXEC_JUMP | ||
183 | #define KEXEC_FLAGS KEXEC_ON_CRASH | ||
184 | #else | ||
185 | #define KEXEC_FLAGS (KEXEC_ON_CRASH | KEXEC_PRESERVE_CONTEXT) | ||
186 | #endif | ||
178 | 187 | ||
179 | #define VMCOREINFO_BYTES (4096) | 188 | #define VMCOREINFO_BYTES (4096) |
180 | #define VMCOREINFO_NOTE_NAME "VMCOREINFO" | 189 | #define VMCOREINFO_NOTE_NAME "VMCOREINFO" |
diff --git a/include/linux/key.h b/include/linux/key.h index c45c962d1cc5..1b70e35a71e3 100644 --- a/include/linux/key.h +++ b/include/linux/key.h | |||
@@ -299,6 +299,7 @@ extern void key_init(void); | |||
299 | #define key_validate(k) 0 | 299 | #define key_validate(k) 0 |
300 | #define key_serial(k) 0 | 300 | #define key_serial(k) 0 |
301 | #define key_get(k) ({ NULL; }) | 301 | #define key_get(k) ({ NULL; }) |
302 | #define key_revoke(k) do { } while(0) | ||
302 | #define key_put(k) do { } while(0) | 303 | #define key_put(k) do { } while(0) |
303 | #define key_ref_put(k) do { } while(0) | 304 | #define key_ref_put(k) do { } while(0) |
304 | #define make_key_ref(k, p) ({ NULL; }) | 305 | #define make_key_ref(k, p) ({ NULL; }) |
diff --git a/include/linux/klist.h b/include/linux/klist.h index 06c338ef7f1b..8ea98db223e5 100644 --- a/include/linux/klist.h +++ b/include/linux/klist.h | |||
@@ -38,7 +38,7 @@ extern void klist_init(struct klist *k, void (*get)(struct klist_node *), | |||
38 | void (*put)(struct klist_node *)); | 38 | void (*put)(struct klist_node *)); |
39 | 39 | ||
40 | struct klist_node { | 40 | struct klist_node { |
41 | struct klist *n_klist; | 41 | void *n_klist; /* never access directly */ |
42 | struct list_head n_node; | 42 | struct list_head n_node; |
43 | struct kref n_ref; | 43 | struct kref n_ref; |
44 | struct completion n_removed; | 44 | struct completion n_removed; |
@@ -57,7 +57,6 @@ extern int klist_node_attached(struct klist_node *n); | |||
57 | 57 | ||
58 | struct klist_iter { | 58 | struct klist_iter { |
59 | struct klist *i_klist; | 59 | struct klist *i_klist; |
60 | struct list_head *i_head; | ||
61 | struct klist_node *i_cur; | 60 | struct klist_node *i_cur; |
62 | }; | 61 | }; |
63 | 62 | ||
diff --git a/include/linux/kmod.h b/include/linux/kmod.h index 5dc13848891b..a1a91577813c 100644 --- a/include/linux/kmod.h +++ b/include/linux/kmod.h | |||
@@ -19,29 +19,31 @@ | |||
19 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | 19 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
20 | */ | 20 | */ |
21 | 21 | ||
22 | #include <linux/gfp.h> | ||
22 | #include <linux/stddef.h> | 23 | #include <linux/stddef.h> |
23 | #include <linux/errno.h> | 24 | #include <linux/errno.h> |
24 | #include <linux/compiler.h> | 25 | #include <linux/compiler.h> |
25 | 26 | ||
26 | #define KMOD_PATH_LEN 256 | 27 | #define KMOD_PATH_LEN 256 |
27 | 28 | ||
28 | #ifdef CONFIG_KMOD | 29 | #ifdef CONFIG_MODULES |
29 | /* modprobe exit status on success, -ve on error. Return value | 30 | /* modprobe exit status on success, -ve on error. Return value |
30 | * usually useless though. */ | 31 | * usually useless though. */ |
31 | extern int request_module(const char * name, ...) __attribute__ ((format (printf, 1, 2))); | 32 | extern int request_module(const char * name, ...) __attribute__ ((format (printf, 1, 2))); |
33 | #define try_then_request_module(x, mod...) ((x) ?: (request_module(mod), (x))) | ||
32 | #else | 34 | #else |
33 | static inline int request_module(const char * name, ...) { return -ENOSYS; } | 35 | static inline int request_module(const char * name, ...) { return -ENOSYS; } |
36 | #define try_then_request_module(x, mod...) (x) | ||
34 | #endif | 37 | #endif |
35 | 38 | ||
36 | #define try_then_request_module(x, mod...) ((x) ?: (request_module(mod), (x))) | ||
37 | 39 | ||
38 | struct key; | 40 | struct key; |
39 | struct file; | 41 | struct file; |
40 | struct subprocess_info; | 42 | struct subprocess_info; |
41 | 43 | ||
42 | /* Allocate a subprocess_info structure */ | 44 | /* Allocate a subprocess_info structure */ |
43 | struct subprocess_info *call_usermodehelper_setup(char *path, | 45 | struct subprocess_info *call_usermodehelper_setup(char *path, char **argv, |
44 | char **argv, char **envp); | 46 | char **envp, gfp_t gfp_mask); |
45 | 47 | ||
46 | /* Set various pieces of state into the subprocess_info structure */ | 48 | /* Set various pieces of state into the subprocess_info structure */ |
47 | void call_usermodehelper_setkeys(struct subprocess_info *info, | 49 | void call_usermodehelper_setkeys(struct subprocess_info *info, |
@@ -68,8 +70,9 @@ static inline int | |||
68 | call_usermodehelper(char *path, char **argv, char **envp, enum umh_wait wait) | 70 | call_usermodehelper(char *path, char **argv, char **envp, enum umh_wait wait) |
69 | { | 71 | { |
70 | struct subprocess_info *info; | 72 | struct subprocess_info *info; |
73 | gfp_t gfp_mask = (wait == UMH_NO_WAIT) ? GFP_ATOMIC : GFP_KERNEL; | ||
71 | 74 | ||
72 | info = call_usermodehelper_setup(path, argv, envp); | 75 | info = call_usermodehelper_setup(path, argv, envp, gfp_mask); |
73 | if (info == NULL) | 76 | if (info == NULL) |
74 | return -ENOMEM; | 77 | return -ENOMEM; |
75 | return call_usermodehelper_exec(info, wait); | 78 | return call_usermodehelper_exec(info, wait); |
@@ -80,8 +83,9 @@ call_usermodehelper_keys(char *path, char **argv, char **envp, | |||
80 | struct key *session_keyring, enum umh_wait wait) | 83 | struct key *session_keyring, enum umh_wait wait) |
81 | { | 84 | { |
82 | struct subprocess_info *info; | 85 | struct subprocess_info *info; |
86 | gfp_t gfp_mask = (wait == UMH_NO_WAIT) ? GFP_ATOMIC : GFP_KERNEL; | ||
83 | 87 | ||
84 | info = call_usermodehelper_setup(path, argv, envp); | 88 | info = call_usermodehelper_setup(path, argv, envp, gfp_mask); |
85 | if (info == NULL) | 89 | if (info == NULL) |
86 | return -ENOMEM; | 90 | return -ENOMEM; |
87 | 91 | ||
diff --git a/include/linux/kobject.h b/include/linux/kobject.h index 39e709f88aa0..5437ac0276e2 100644 --- a/include/linux/kobject.h +++ b/include/linux/kobject.h | |||
@@ -26,7 +26,6 @@ | |||
26 | #include <linux/wait.h> | 26 | #include <linux/wait.h> |
27 | #include <asm/atomic.h> | 27 | #include <asm/atomic.h> |
28 | 28 | ||
29 | #define KOBJ_NAME_LEN 20 | ||
30 | #define UEVENT_HELPER_PATH_LEN 256 | 29 | #define UEVENT_HELPER_PATH_LEN 256 |
31 | #define UEVENT_NUM_ENVP 32 /* number of env pointers */ | 30 | #define UEVENT_NUM_ENVP 32 /* number of env pointers */ |
32 | #define UEVENT_BUFFER_SIZE 2048 /* buffer for the variables */ | 31 | #define UEVENT_BUFFER_SIZE 2048 /* buffer for the variables */ |
@@ -59,12 +58,12 @@ enum kobject_action { | |||
59 | 58 | ||
60 | struct kobject { | 59 | struct kobject { |
61 | const char *name; | 60 | const char *name; |
62 | struct kref kref; | ||
63 | struct list_head entry; | 61 | struct list_head entry; |
64 | struct kobject *parent; | 62 | struct kobject *parent; |
65 | struct kset *kset; | 63 | struct kset *kset; |
66 | struct kobj_type *ktype; | 64 | struct kobj_type *ktype; |
67 | struct sysfs_dirent *sd; | 65 | struct sysfs_dirent *sd; |
66 | struct kref kref; | ||
68 | unsigned int state_initialized:1; | 67 | unsigned int state_initialized:1; |
69 | unsigned int state_in_sysfs:1; | 68 | unsigned int state_in_sysfs:1; |
70 | unsigned int state_add_uevent_sent:1; | 69 | unsigned int state_add_uevent_sent:1; |
@@ -187,6 +186,8 @@ extern struct kobject *kset_find_obj(struct kset *, const char *); | |||
187 | 186 | ||
188 | /* The global /sys/kernel/ kobject for people to chain off of */ | 187 | /* The global /sys/kernel/ kobject for people to chain off of */ |
189 | extern struct kobject *kernel_kobj; | 188 | extern struct kobject *kernel_kobj; |
189 | /* The global /sys/kernel/mm/ kobject for people to chain off of */ | ||
190 | extern struct kobject *mm_kobj; | ||
190 | /* The global /sys/hypervisor/ kobject for people to chain off of */ | 191 | /* The global /sys/hypervisor/ kobject for people to chain off of */ |
191 | extern struct kobject *hypervisor_kobj; | 192 | extern struct kobject *hypervisor_kobj; |
192 | /* The global /sys/power/ kobject for people to chain off of */ | 193 | /* The global /sys/power/ kobject for people to chain off of */ |
diff --git a/include/linux/kprobes.h b/include/linux/kprobes.h index 1036631ff4fa..0be7795655fa 100644 --- a/include/linux/kprobes.h +++ b/include/linux/kprobes.h | |||
@@ -157,11 +157,10 @@ struct kretprobe { | |||
157 | int nmissed; | 157 | int nmissed; |
158 | size_t data_size; | 158 | size_t data_size; |
159 | struct hlist_head free_instances; | 159 | struct hlist_head free_instances; |
160 | struct hlist_head used_instances; | 160 | spinlock_t lock; |
161 | }; | 161 | }; |
162 | 162 | ||
163 | struct kretprobe_instance { | 163 | struct kretprobe_instance { |
164 | struct hlist_node uflist; /* either on free list or used list */ | ||
165 | struct hlist_node hlist; | 164 | struct hlist_node hlist; |
166 | struct kretprobe *rp; | 165 | struct kretprobe *rp; |
167 | kprobe_opcode_t *ret_addr; | 166 | kprobe_opcode_t *ret_addr; |
@@ -201,7 +200,6 @@ static inline int init_test_probes(void) | |||
201 | } | 200 | } |
202 | #endif /* CONFIG_KPROBES_SANITY_TEST */ | 201 | #endif /* CONFIG_KPROBES_SANITY_TEST */ |
203 | 202 | ||
204 | extern spinlock_t kretprobe_lock; | ||
205 | extern struct mutex kprobe_mutex; | 203 | extern struct mutex kprobe_mutex; |
206 | extern int arch_prepare_kprobe(struct kprobe *p); | 204 | extern int arch_prepare_kprobe(struct kprobe *p); |
207 | extern void arch_arm_kprobe(struct kprobe *p); | 205 | extern void arch_arm_kprobe(struct kprobe *p); |
@@ -214,6 +212,9 @@ extern void kprobes_inc_nmissed_count(struct kprobe *p); | |||
214 | 212 | ||
215 | /* Get the kprobe at this addr (if any) - called with preemption disabled */ | 213 | /* Get the kprobe at this addr (if any) - called with preemption disabled */ |
216 | struct kprobe *get_kprobe(void *addr); | 214 | struct kprobe *get_kprobe(void *addr); |
215 | void kretprobe_hash_lock(struct task_struct *tsk, | ||
216 | struct hlist_head **head, unsigned long *flags); | ||
217 | void kretprobe_hash_unlock(struct task_struct *tsk, unsigned long *flags); | ||
217 | struct hlist_head * kretprobe_inst_table_head(struct task_struct *tsk); | 218 | struct hlist_head * kretprobe_inst_table_head(struct task_struct *tsk); |
218 | 219 | ||
219 | /* kprobe_running() will just return the current_kprobe on this CPU */ | 220 | /* kprobe_running() will just return the current_kprobe on this CPU */ |
@@ -259,6 +260,10 @@ void recycle_rp_inst(struct kretprobe_instance *ri, struct hlist_head *head); | |||
259 | struct jprobe; | 260 | struct jprobe; |
260 | struct kretprobe; | 261 | struct kretprobe; |
261 | 262 | ||
263 | static inline struct kprobe *get_kprobe(void *addr) | ||
264 | { | ||
265 | return NULL; | ||
266 | } | ||
262 | static inline struct kprobe *kprobe_running(void) | 267 | static inline struct kprobe *kprobe_running(void) |
263 | { | 268 | { |
264 | return NULL; | 269 | return NULL; |
diff --git a/include/linux/ks0108.h b/include/linux/ks0108.h index a2c54acceb4e..cb311798e0bc 100644 --- a/include/linux/ks0108.h +++ b/include/linux/ks0108.h | |||
@@ -4,7 +4,7 @@ | |||
4 | * Description: ks0108 LCD Controller driver header | 4 | * Description: ks0108 LCD Controller driver header |
5 | * License: GPLv2 | 5 | * License: GPLv2 |
6 | * | 6 | * |
7 | * Author: Copyright (C) Miguel Ojeda Sandonis <maxextreme@gmail.com> | 7 | * Author: Copyright (C) Miguel Ojeda Sandonis |
8 | * Date: 2006-10-31 | 8 | * Date: 2006-10-31 |
9 | * | 9 | * |
10 | * This program is free software; you can redistribute it and/or modify | 10 | * This program is free software; you can redistribute it and/or modify |
diff --git a/include/linux/kthread.h b/include/linux/kthread.h index 00dd957e245b..aabc8a13ba71 100644 --- a/include/linux/kthread.h +++ b/include/linux/kthread.h | |||
@@ -6,7 +6,8 @@ | |||
6 | 6 | ||
7 | struct task_struct *kthread_create(int (*threadfn)(void *data), | 7 | struct task_struct *kthread_create(int (*threadfn)(void *data), |
8 | void *data, | 8 | void *data, |
9 | const char namefmt[], ...); | 9 | const char namefmt[], ...) |
10 | __attribute__((format(printf, 3, 4))); | ||
10 | 11 | ||
11 | /** | 12 | /** |
12 | * kthread_run - create and wake a thread. | 13 | * kthread_run - create and wake a thread. |
diff --git a/include/linux/kvm.h b/include/linux/kvm.h index a281afeddfbb..70a30651cd12 100644 --- a/include/linux/kvm.h +++ b/include/linux/kvm.h | |||
@@ -173,6 +173,30 @@ struct kvm_run { | |||
173 | }; | 173 | }; |
174 | }; | 174 | }; |
175 | 175 | ||
176 | /* for KVM_REGISTER_COALESCED_MMIO / KVM_UNREGISTER_COALESCED_MMIO */ | ||
177 | |||
178 | struct kvm_coalesced_mmio_zone { | ||
179 | __u64 addr; | ||
180 | __u32 size; | ||
181 | __u32 pad; | ||
182 | }; | ||
183 | |||
184 | struct kvm_coalesced_mmio { | ||
185 | __u64 phys_addr; | ||
186 | __u32 len; | ||
187 | __u32 pad; | ||
188 | __u8 data[8]; | ||
189 | }; | ||
190 | |||
191 | struct kvm_coalesced_mmio_ring { | ||
192 | __u32 first, last; | ||
193 | struct kvm_coalesced_mmio coalesced_mmio[0]; | ||
194 | }; | ||
195 | |||
196 | #define KVM_COALESCED_MMIO_MAX \ | ||
197 | ((PAGE_SIZE - sizeof(struct kvm_coalesced_mmio_ring)) / \ | ||
198 | sizeof(struct kvm_coalesced_mmio)) | ||
199 | |||
176 | /* for KVM_TRANSLATE */ | 200 | /* for KVM_TRANSLATE */ |
177 | struct kvm_translation { | 201 | struct kvm_translation { |
178 | /* in */ | 202 | /* in */ |
@@ -294,9 +318,9 @@ struct kvm_trace_rec { | |||
294 | __u32 vcpu_id; | 318 | __u32 vcpu_id; |
295 | union { | 319 | union { |
296 | struct { | 320 | struct { |
297 | __u32 cycle_lo, cycle_hi; | 321 | __u64 cycle_u64; |
298 | __u32 extra_u32[KVM_TRC_EXTRA_MAX]; | 322 | __u32 extra_u32[KVM_TRC_EXTRA_MAX]; |
299 | } cycle; | 323 | } __attribute__((packed)) cycle; |
300 | struct { | 324 | struct { |
301 | __u32 extra_u32[KVM_TRC_EXTRA_MAX]; | 325 | __u32 extra_u32[KVM_TRC_EXTRA_MAX]; |
302 | } nocycle; | 326 | } nocycle; |
@@ -346,6 +370,8 @@ struct kvm_trace_rec { | |||
346 | #define KVM_CAP_NOP_IO_DELAY 12 | 370 | #define KVM_CAP_NOP_IO_DELAY 12 |
347 | #define KVM_CAP_PV_MMU 13 | 371 | #define KVM_CAP_PV_MMU 13 |
348 | #define KVM_CAP_MP_STATE 14 | 372 | #define KVM_CAP_MP_STATE 14 |
373 | #define KVM_CAP_COALESCED_MMIO 15 | ||
374 | #define KVM_CAP_SYNC_MMU 16 /* Changes to host mmap are reflected in guest */ | ||
349 | 375 | ||
350 | /* | 376 | /* |
351 | * ioctls for VM fds | 377 | * ioctls for VM fds |
@@ -371,6 +397,10 @@ struct kvm_trace_rec { | |||
371 | #define KVM_CREATE_PIT _IO(KVMIO, 0x64) | 397 | #define KVM_CREATE_PIT _IO(KVMIO, 0x64) |
372 | #define KVM_GET_PIT _IOWR(KVMIO, 0x65, struct kvm_pit_state) | 398 | #define KVM_GET_PIT _IOWR(KVMIO, 0x65, struct kvm_pit_state) |
373 | #define KVM_SET_PIT _IOR(KVMIO, 0x66, struct kvm_pit_state) | 399 | #define KVM_SET_PIT _IOR(KVMIO, 0x66, struct kvm_pit_state) |
400 | #define KVM_REGISTER_COALESCED_MMIO \ | ||
401 | _IOW(KVMIO, 0x67, struct kvm_coalesced_mmio_zone) | ||
402 | #define KVM_UNREGISTER_COALESCED_MMIO \ | ||
403 | _IOW(KVMIO, 0x68, struct kvm_coalesced_mmio_zone) | ||
374 | 404 | ||
375 | /* | 405 | /* |
376 | * ioctls for vcpu fds | 406 | * ioctls for vcpu fds |
diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h index de9d1df4bba2..8525afc53107 100644 --- a/include/linux/kvm_host.h +++ b/include/linux/kvm_host.h | |||
@@ -52,7 +52,8 @@ struct kvm_io_bus { | |||
52 | 52 | ||
53 | void kvm_io_bus_init(struct kvm_io_bus *bus); | 53 | void kvm_io_bus_init(struct kvm_io_bus *bus); |
54 | void kvm_io_bus_destroy(struct kvm_io_bus *bus); | 54 | void kvm_io_bus_destroy(struct kvm_io_bus *bus); |
55 | struct kvm_io_device *kvm_io_bus_find_dev(struct kvm_io_bus *bus, gpa_t addr); | 55 | struct kvm_io_device *kvm_io_bus_find_dev(struct kvm_io_bus *bus, |
56 | gpa_t addr, int len, int is_write); | ||
56 | void kvm_io_bus_register_dev(struct kvm_io_bus *bus, | 57 | void kvm_io_bus_register_dev(struct kvm_io_bus *bus, |
57 | struct kvm_io_device *dev); | 58 | struct kvm_io_device *dev); |
58 | 59 | ||
@@ -116,6 +117,16 @@ struct kvm { | |||
116 | struct kvm_vm_stat stat; | 117 | struct kvm_vm_stat stat; |
117 | struct kvm_arch arch; | 118 | struct kvm_arch arch; |
118 | atomic_t users_count; | 119 | atomic_t users_count; |
120 | #ifdef KVM_COALESCED_MMIO_PAGE_OFFSET | ||
121 | struct kvm_coalesced_mmio_dev *coalesced_mmio_dev; | ||
122 | struct kvm_coalesced_mmio_ring *coalesced_mmio_ring; | ||
123 | #endif | ||
124 | |||
125 | #ifdef KVM_ARCH_WANT_MMU_NOTIFIER | ||
126 | struct mmu_notifier mmu_notifier; | ||
127 | unsigned long mmu_notifier_seq; | ||
128 | long mmu_notifier_count; | ||
129 | #endif | ||
119 | }; | 130 | }; |
120 | 131 | ||
121 | /* The guest did something we don't support. */ | 132 | /* The guest did something we don't support. */ |
@@ -135,9 +146,6 @@ void kvm_vcpu_uninit(struct kvm_vcpu *vcpu); | |||
135 | void vcpu_load(struct kvm_vcpu *vcpu); | 146 | void vcpu_load(struct kvm_vcpu *vcpu); |
136 | void vcpu_put(struct kvm_vcpu *vcpu); | 147 | void vcpu_put(struct kvm_vcpu *vcpu); |
137 | 148 | ||
138 | void decache_vcpus_on_cpu(int cpu); | ||
139 | |||
140 | |||
141 | int kvm_init(void *opaque, unsigned int vcpu_size, | 149 | int kvm_init(void *opaque, unsigned int vcpu_size, |
142 | struct module *module); | 150 | struct module *module); |
143 | void kvm_exit(void); | 151 | void kvm_exit(void); |
@@ -166,6 +174,7 @@ int kvm_arch_set_memory_region(struct kvm *kvm, | |||
166 | struct kvm_userspace_memory_region *mem, | 174 | struct kvm_userspace_memory_region *mem, |
167 | struct kvm_memory_slot old, | 175 | struct kvm_memory_slot old, |
168 | int user_alloc); | 176 | int user_alloc); |
177 | void kvm_arch_flush_shadow(struct kvm *kvm); | ||
169 | gfn_t unalias_gfn(struct kvm *kvm, gfn_t gfn); | 178 | gfn_t unalias_gfn(struct kvm *kvm, gfn_t gfn); |
170 | struct page *gfn_to_page(struct kvm *kvm, gfn_t gfn); | 179 | struct page *gfn_to_page(struct kvm *kvm, gfn_t gfn); |
171 | unsigned long gfn_to_hva(struct kvm *kvm, gfn_t gfn); | 180 | unsigned long gfn_to_hva(struct kvm *kvm, gfn_t gfn); |
@@ -329,4 +338,22 @@ int kvm_trace_ioctl(unsigned int ioctl, unsigned long arg) | |||
329 | #define kvm_trace_cleanup() ((void)0) | 338 | #define kvm_trace_cleanup() ((void)0) |
330 | #endif | 339 | #endif |
331 | 340 | ||
341 | #ifdef KVM_ARCH_WANT_MMU_NOTIFIER | ||
342 | static inline int mmu_notifier_retry(struct kvm_vcpu *vcpu, unsigned long mmu_seq) | ||
343 | { | ||
344 | if (unlikely(vcpu->kvm->mmu_notifier_count)) | ||
345 | return 1; | ||
346 | /* | ||
347 | * Both reads happen under the mmu_lock and both values are | ||
348 | * modified under mmu_lock, so there's no need of smb_rmb() | ||
349 | * here in between, otherwise mmu_notifier_count should be | ||
350 | * read before mmu_notifier_seq, see | ||
351 | * mmu_notifier_invalidate_range_end write side. | ||
352 | */ | ||
353 | if (vcpu->kvm->mmu_notifier_seq != mmu_seq) | ||
354 | return 1; | ||
355 | return 0; | ||
356 | } | ||
357 | #endif | ||
358 | |||
332 | #endif | 359 | #endif |
diff --git a/include/linux/lcd.h b/include/linux/lcd.h index 1d379787f2e7..c67fecafff90 100644 --- a/include/linux/lcd.h +++ b/include/linux/lcd.h | |||
@@ -11,6 +11,7 @@ | |||
11 | #include <linux/device.h> | 11 | #include <linux/device.h> |
12 | #include <linux/mutex.h> | 12 | #include <linux/mutex.h> |
13 | #include <linux/notifier.h> | 13 | #include <linux/notifier.h> |
14 | #include <linux/fb.h> | ||
14 | 15 | ||
15 | /* Notes on locking: | 16 | /* Notes on locking: |
16 | * | 17 | * |
@@ -45,9 +46,11 @@ struct lcd_ops { | |||
45 | int (*get_contrast)(struct lcd_device *); | 46 | int (*get_contrast)(struct lcd_device *); |
46 | /* Set LCD panel contrast */ | 47 | /* Set LCD panel contrast */ |
47 | int (*set_contrast)(struct lcd_device *, int contrast); | 48 | int (*set_contrast)(struct lcd_device *, int contrast); |
49 | /* Set LCD panel mode (resolutions ...) */ | ||
50 | int (*set_mode)(struct lcd_device *, struct fb_videomode *); | ||
48 | /* Check if given framebuffer device is the one LCD is bound to; | 51 | /* Check if given framebuffer device is the one LCD is bound to; |
49 | return 0 if not, !=0 if it is. If NULL, lcd always matches the fb. */ | 52 | return 0 if not, !=0 if it is. If NULL, lcd always matches the fb. */ |
50 | int (*check_fb)(struct fb_info *); | 53 | int (*check_fb)(struct lcd_device *, struct fb_info *); |
51 | }; | 54 | }; |
52 | 55 | ||
53 | struct lcd_device { | 56 | struct lcd_device { |
diff --git a/include/linux/leds-pca9532.h b/include/linux/leds-pca9532.h new file mode 100644 index 000000000000..81b4207deb95 --- /dev/null +++ b/include/linux/leds-pca9532.h | |||
@@ -0,0 +1,45 @@ | |||
1 | /* | ||
2 | * pca9532.h - platform data structure for pca9532 led controller | ||
3 | * | ||
4 | * Copyright (C) 2008 Riku Voipio <riku.voipio@movial.fi> | ||
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 | * Datasheet: http://www.nxp.com/acrobat/datasheets/PCA9532_3.pdf | ||
11 | * | ||
12 | */ | ||
13 | |||
14 | #ifndef __LINUX_PCA9532_H | ||
15 | #define __LINUX_PCA9532_H | ||
16 | |||
17 | #include <linux/leds.h> | ||
18 | |||
19 | enum pca9532_state { | ||
20 | PCA9532_OFF = 0x0, | ||
21 | PCA9532_ON = 0x1, | ||
22 | PCA9532_PWM0 = 0x2, | ||
23 | PCA9532_PWM1 = 0x3 | ||
24 | }; | ||
25 | |||
26 | enum pca9532_type { PCA9532_TYPE_NONE, PCA9532_TYPE_LED, | ||
27 | PCA9532_TYPE_N2100_BEEP }; | ||
28 | |||
29 | struct pca9532_led { | ||
30 | u8 id; | ||
31 | struct i2c_client *client; | ||
32 | char *name; | ||
33 | struct led_classdev ldev; | ||
34 | enum pca9532_type type; | ||
35 | enum pca9532_state state; | ||
36 | }; | ||
37 | |||
38 | struct pca9532_platform_data { | ||
39 | struct pca9532_led leds[16]; | ||
40 | u8 pwm[2]; | ||
41 | u8 psc[2]; | ||
42 | }; | ||
43 | |||
44 | #endif /* __LINUX_PCA9532_H */ | ||
45 | |||
diff --git a/include/linux/leds.h b/include/linux/leds.h index 519df72e939d..d41ccb56146a 100644 --- a/include/linux/leds.h +++ b/include/linux/leds.h | |||
@@ -48,7 +48,7 @@ struct led_classdev { | |||
48 | 48 | ||
49 | struct device *dev; | 49 | struct device *dev; |
50 | struct list_head node; /* LED Device list */ | 50 | struct list_head node; /* LED Device list */ |
51 | char *default_trigger; /* Trigger to use */ | 51 | const char *default_trigger; /* Trigger to use */ |
52 | 52 | ||
53 | #ifdef CONFIG_LEDS_TRIGGERS | 53 | #ifdef CONFIG_LEDS_TRIGGERS |
54 | /* Protects the trigger data below */ | 54 | /* Protects the trigger data below */ |
@@ -118,6 +118,20 @@ extern void ledtrig_ide_activity(void); | |||
118 | #define ledtrig_ide_activity() do {} while(0) | 118 | #define ledtrig_ide_activity() do {} while(0) |
119 | #endif | 119 | #endif |
120 | 120 | ||
121 | /* | ||
122 | * Generic LED platform data for describing LED names and default triggers. | ||
123 | */ | ||
124 | struct led_info { | ||
125 | const char *name; | ||
126 | char *default_trigger; | ||
127 | int flags; | ||
128 | }; | ||
129 | |||
130 | struct led_platform_data { | ||
131 | int num_leds; | ||
132 | struct led_info *leds; | ||
133 | }; | ||
134 | |||
121 | /* For the leds-gpio driver */ | 135 | /* For the leds-gpio driver */ |
122 | struct gpio_led { | 136 | struct gpio_led { |
123 | const char *name; | 137 | const char *name; |
diff --git a/include/linux/libata.h b/include/linux/libata.h index e57e5d08312d..947cf84e555d 100644 --- a/include/linux/libata.h +++ b/include/linux/libata.h | |||
@@ -27,6 +27,7 @@ | |||
27 | #define __LINUX_LIBATA_H__ | 27 | #define __LINUX_LIBATA_H__ |
28 | 28 | ||
29 | #include <linux/delay.h> | 29 | #include <linux/delay.h> |
30 | #include <linux/jiffies.h> | ||
30 | #include <linux/interrupt.h> | 31 | #include <linux/interrupt.h> |
31 | #include <linux/dma-mapping.h> | 32 | #include <linux/dma-mapping.h> |
32 | #include <linux/scatterlist.h> | 33 | #include <linux/scatterlist.h> |
@@ -59,9 +60,9 @@ | |||
59 | 60 | ||
60 | /* note: prints function name for you */ | 61 | /* note: prints function name for you */ |
61 | #ifdef ATA_DEBUG | 62 | #ifdef ATA_DEBUG |
62 | #define DPRINTK(fmt, args...) printk(KERN_ERR "%s: " fmt, __FUNCTION__, ## args) | 63 | #define DPRINTK(fmt, args...) printk(KERN_ERR "%s: " fmt, __func__, ## args) |
63 | #ifdef ATA_VERBOSE_DEBUG | 64 | #ifdef ATA_VERBOSE_DEBUG |
64 | #define VPRINTK(fmt, args...) printk(KERN_ERR "%s: " fmt, __FUNCTION__, ## args) | 65 | #define VPRINTK(fmt, args...) printk(KERN_ERR "%s: " fmt, __func__, ## args) |
65 | #else | 66 | #else |
66 | #define VPRINTK(fmt, args...) | 67 | #define VPRINTK(fmt, args...) |
67 | #endif /* ATA_VERBOSE_DEBUG */ | 68 | #endif /* ATA_VERBOSE_DEBUG */ |
@@ -70,7 +71,7 @@ | |||
70 | #define VPRINTK(fmt, args...) | 71 | #define VPRINTK(fmt, args...) |
71 | #endif /* ATA_DEBUG */ | 72 | #endif /* ATA_DEBUG */ |
72 | 73 | ||
73 | #define BPRINTK(fmt, args...) if (ap->flags & ATA_FLAG_DEBUGMSG) printk(KERN_ERR "%s: " fmt, __FUNCTION__, ## args) | 74 | #define BPRINTK(fmt, args...) if (ap->flags & ATA_FLAG_DEBUGMSG) printk(KERN_ERR "%s: " fmt, __func__, ## args) |
74 | 75 | ||
75 | /* NEW: debug levels */ | 76 | /* NEW: debug levels */ |
76 | #define HAVE_LIBATA_MSG 1 | 77 | #define HAVE_LIBATA_MSG 1 |
@@ -115,7 +116,7 @@ enum { | |||
115 | /* tag ATA_MAX_QUEUE - 1 is reserved for internal commands */ | 116 | /* tag ATA_MAX_QUEUE - 1 is reserved for internal commands */ |
116 | ATA_MAX_QUEUE = 32, | 117 | ATA_MAX_QUEUE = 32, |
117 | ATA_TAG_INTERNAL = ATA_MAX_QUEUE - 1, | 118 | ATA_TAG_INTERNAL = ATA_MAX_QUEUE - 1, |
118 | ATA_SHORT_PAUSE = (HZ >> 6) + 1, | 119 | ATA_SHORT_PAUSE = 16, |
119 | 120 | ||
120 | ATAPI_MAX_DRAIN = 16 << 10, | 121 | ATAPI_MAX_DRAIN = 16 << 10, |
121 | 122 | ||
@@ -145,6 +146,7 @@ enum { | |||
145 | ATA_DFLAG_SPUNDOWN = (1 << 14), /* XXX: for spindown_compat */ | 146 | ATA_DFLAG_SPUNDOWN = (1 << 14), /* XXX: for spindown_compat */ |
146 | ATA_DFLAG_SLEEPING = (1 << 15), /* device is sleeping */ | 147 | ATA_DFLAG_SLEEPING = (1 << 15), /* device is sleeping */ |
147 | ATA_DFLAG_DUBIOUS_XFER = (1 << 16), /* data transfer not verified */ | 148 | ATA_DFLAG_DUBIOUS_XFER = (1 << 16), /* data transfer not verified */ |
149 | ATA_DFLAG_NO_UNLOAD = (1 << 17), /* device doesn't support unload */ | ||
148 | ATA_DFLAG_INIT_MASK = (1 << 24) - 1, | 150 | ATA_DFLAG_INIT_MASK = (1 << 24) - 1, |
149 | 151 | ||
150 | ATA_DFLAG_DETACH = (1 << 24), | 152 | ATA_DFLAG_DETACH = (1 << 24), |
@@ -162,12 +164,14 @@ enum { | |||
162 | ATA_DEV_NONE = 9, /* no device */ | 164 | ATA_DEV_NONE = 9, /* no device */ |
163 | 165 | ||
164 | /* struct ata_link flags */ | 166 | /* struct ata_link flags */ |
167 | ATA_LFLAG_NO_HRST = (1 << 1), /* avoid hardreset */ | ||
165 | ATA_LFLAG_NO_SRST = (1 << 2), /* avoid softreset */ | 168 | ATA_LFLAG_NO_SRST = (1 << 2), /* avoid softreset */ |
166 | ATA_LFLAG_ASSUME_ATA = (1 << 3), /* assume ATA class */ | 169 | ATA_LFLAG_ASSUME_ATA = (1 << 3), /* assume ATA class */ |
167 | ATA_LFLAG_ASSUME_SEMB = (1 << 4), /* assume SEMB class */ | 170 | ATA_LFLAG_ASSUME_SEMB = (1 << 4), /* assume SEMB class */ |
168 | ATA_LFLAG_ASSUME_CLASS = ATA_LFLAG_ASSUME_ATA | ATA_LFLAG_ASSUME_SEMB, | 171 | ATA_LFLAG_ASSUME_CLASS = ATA_LFLAG_ASSUME_ATA | ATA_LFLAG_ASSUME_SEMB, |
169 | ATA_LFLAG_NO_RETRY = (1 << 5), /* don't retry this link */ | 172 | ATA_LFLAG_NO_RETRY = (1 << 5), /* don't retry this link */ |
170 | ATA_LFLAG_DISABLED = (1 << 6), /* link is disabled */ | 173 | ATA_LFLAG_DISABLED = (1 << 6), /* link is disabled */ |
174 | ATA_LFLAG_SW_ACTIVITY = (1 << 7), /* keep activity stats */ | ||
171 | 175 | ||
172 | /* struct ata_port flags */ | 176 | /* struct ata_port flags */ |
173 | ATA_FLAG_SLAVE_POSS = (1 << 0), /* host supports slave dev */ | 177 | ATA_FLAG_SLAVE_POSS = (1 << 0), /* host supports slave dev */ |
@@ -190,6 +194,10 @@ enum { | |||
190 | ATA_FLAG_AN = (1 << 18), /* controller supports AN */ | 194 | ATA_FLAG_AN = (1 << 18), /* controller supports AN */ |
191 | ATA_FLAG_PMP = (1 << 19), /* controller supports PMP */ | 195 | ATA_FLAG_PMP = (1 << 19), /* controller supports PMP */ |
192 | ATA_FLAG_IPM = (1 << 20), /* driver can handle IPM */ | 196 | ATA_FLAG_IPM = (1 << 20), /* driver can handle IPM */ |
197 | ATA_FLAG_EM = (1 << 21), /* driver supports enclosure | ||
198 | * management */ | ||
199 | ATA_FLAG_SW_ACTIVITY = (1 << 22), /* driver supports sw activity | ||
200 | * led */ | ||
193 | 201 | ||
194 | /* The following flag belongs to ap->pflags but is kept in | 202 | /* The following flag belongs to ap->pflags but is kept in |
195 | * ap->flags because it's referenced in many LLDs and will be | 203 | * ap->flags because it's referenced in many LLDs and will be |
@@ -234,17 +242,17 @@ enum { | |||
234 | /* bits 24:31 of host->flags are reserved for LLD specific flags */ | 242 | /* bits 24:31 of host->flags are reserved for LLD specific flags */ |
235 | 243 | ||
236 | /* various lengths of time */ | 244 | /* various lengths of time */ |
237 | ATA_TMOUT_BOOT = 30 * HZ, /* heuristic */ | 245 | ATA_TMOUT_BOOT = 30000, /* heuristic */ |
238 | ATA_TMOUT_BOOT_QUICK = 7 * HZ, /* heuristic */ | 246 | ATA_TMOUT_BOOT_QUICK = 7000, /* heuristic */ |
239 | ATA_TMOUT_INTERNAL = 30 * HZ, | 247 | ATA_TMOUT_INTERNAL_QUICK = 5000, |
240 | ATA_TMOUT_INTERNAL_QUICK = 5 * HZ, | 248 | ATA_TMOUT_MAX_PARK = 30000, |
241 | 249 | ||
242 | /* FIXME: GoVault needs 2s but we can't afford that without | 250 | /* FIXME: GoVault needs 2s but we can't afford that without |
243 | * parallel probing. 800ms is enough for iVDR disk | 251 | * parallel probing. 800ms is enough for iVDR disk |
244 | * HHD424020F7SV00. Increase to 2secs when parallel probing | 252 | * HHD424020F7SV00. Increase to 2secs when parallel probing |
245 | * is in place. | 253 | * is in place. |
246 | */ | 254 | */ |
247 | ATA_TMOUT_FF_WAIT = 4 * HZ / 5, | 255 | ATA_TMOUT_FF_WAIT = 800, |
248 | 256 | ||
249 | /* Spec mandates to wait for ">= 2ms" before checking status | 257 | /* Spec mandates to wait for ">= 2ms" before checking status |
250 | * after reset. We wait 150ms, because that was the magic | 258 | * after reset. We wait 150ms, because that was the magic |
@@ -256,14 +264,14 @@ enum { | |||
256 | * | 264 | * |
257 | * Old drivers/ide uses the 2mS rule and then waits for ready. | 265 | * Old drivers/ide uses the 2mS rule and then waits for ready. |
258 | */ | 266 | */ |
259 | ATA_WAIT_AFTER_RESET_MSECS = 150, | 267 | ATA_WAIT_AFTER_RESET = 150, |
260 | 268 | ||
261 | /* If PMP is supported, we have to do follow-up SRST. As some | 269 | /* If PMP is supported, we have to do follow-up SRST. As some |
262 | * PMPs don't send D2H Reg FIS after hardreset, LLDs are | 270 | * PMPs don't send D2H Reg FIS after hardreset, LLDs are |
263 | * advised to wait only for the following duration before | 271 | * advised to wait only for the following duration before |
264 | * doing SRST. | 272 | * doing SRST. |
265 | */ | 273 | */ |
266 | ATA_TMOUT_PMP_SRST_WAIT = 1 * HZ, | 274 | ATA_TMOUT_PMP_SRST_WAIT = 1000, |
267 | 275 | ||
268 | /* ATA bus states */ | 276 | /* ATA bus states */ |
269 | BUS_UNKNOWN = 0, | 277 | BUS_UNKNOWN = 0, |
@@ -313,8 +321,11 @@ enum { | |||
313 | ATA_EH_RESET = ATA_EH_SOFTRESET | ATA_EH_HARDRESET, | 321 | ATA_EH_RESET = ATA_EH_SOFTRESET | ATA_EH_HARDRESET, |
314 | ATA_EH_ENABLE_LINK = (1 << 3), | 322 | ATA_EH_ENABLE_LINK = (1 << 3), |
315 | ATA_EH_LPM = (1 << 4), /* link power management action */ | 323 | ATA_EH_LPM = (1 << 4), /* link power management action */ |
324 | ATA_EH_PARK = (1 << 5), /* unload heads and stop I/O */ | ||
316 | 325 | ||
317 | ATA_EH_PERDEV_MASK = ATA_EH_REVALIDATE, | 326 | ATA_EH_PERDEV_MASK = ATA_EH_REVALIDATE | ATA_EH_PARK, |
327 | ATA_EH_ALL_ACTIONS = ATA_EH_REVALIDATE | ATA_EH_RESET | | ||
328 | ATA_EH_ENABLE_LINK | ATA_EH_LPM, | ||
318 | 329 | ||
319 | /* ata_eh_info->flags */ | 330 | /* ata_eh_info->flags */ |
320 | ATA_EHI_HOTPLUGGED = (1 << 0), /* could have been hotplugged */ | 331 | ATA_EHI_HOTPLUGGED = (1 << 0), /* could have been hotplugged */ |
@@ -340,6 +351,11 @@ enum { | |||
340 | 351 | ||
341 | SATA_PMP_RW_TIMEOUT = 3000, /* PMP read/write timeout */ | 352 | SATA_PMP_RW_TIMEOUT = 3000, /* PMP read/write timeout */ |
342 | 353 | ||
354 | /* This should match the actual table size of | ||
355 | * ata_eh_cmd_timeout_table in libata-eh.c. | ||
356 | */ | ||
357 | ATA_EH_CMD_TIMEOUT_TABLE_SIZE = 5, | ||
358 | |||
343 | /* Horkage types. May be set by libata or controller on drives | 359 | /* Horkage types. May be set by libata or controller on drives |
344 | (some horkage may be drive/controller pair dependant */ | 360 | (some horkage may be drive/controller pair dependant */ |
345 | 361 | ||
@@ -441,6 +457,16 @@ enum link_pm { | |||
441 | MEDIUM_POWER, | 457 | MEDIUM_POWER, |
442 | }; | 458 | }; |
443 | extern struct device_attribute dev_attr_link_power_management_policy; | 459 | extern struct device_attribute dev_attr_link_power_management_policy; |
460 | extern struct device_attribute dev_attr_unload_heads; | ||
461 | extern struct device_attribute dev_attr_em_message_type; | ||
462 | extern struct device_attribute dev_attr_em_message; | ||
463 | extern struct device_attribute dev_attr_sw_activity; | ||
464 | |||
465 | enum sw_activity { | ||
466 | OFF, | ||
467 | BLINK_ON, | ||
468 | BLINK_OFF, | ||
469 | }; | ||
444 | 470 | ||
445 | #ifdef CONFIG_ATA_SFF | 471 | #ifdef CONFIG_ATA_SFF |
446 | struct ata_ioports { | 472 | struct ata_ioports { |
@@ -534,8 +560,8 @@ struct ata_ering { | |||
534 | struct ata_device { | 560 | struct ata_device { |
535 | struct ata_link *link; | 561 | struct ata_link *link; |
536 | unsigned int devno; /* 0 or 1 */ | 562 | unsigned int devno; /* 0 or 1 */ |
537 | unsigned long flags; /* ATA_DFLAG_xxx */ | ||
538 | unsigned int horkage; /* List of broken features */ | 563 | unsigned int horkage; /* List of broken features */ |
564 | unsigned long flags; /* ATA_DFLAG_xxx */ | ||
539 | struct scsi_device *sdev; /* attached SCSI device */ | 565 | struct scsi_device *sdev; /* attached SCSI device */ |
540 | #ifdef CONFIG_ATA_ACPI | 566 | #ifdef CONFIG_ATA_ACPI |
541 | acpi_handle acpi_handle; | 567 | acpi_handle acpi_handle; |
@@ -544,6 +570,7 @@ struct ata_device { | |||
544 | /* n_sector is used as CLEAR_OFFSET, read comment above CLEAR_OFFSET */ | 570 | /* n_sector is used as CLEAR_OFFSET, read comment above CLEAR_OFFSET */ |
545 | u64 n_sectors; /* size of device, if ATA */ | 571 | u64 n_sectors; /* size of device, if ATA */ |
546 | unsigned int class; /* ATA_DEV_xxx */ | 572 | unsigned int class; /* ATA_DEV_xxx */ |
573 | unsigned long unpark_deadline; | ||
547 | 574 | ||
548 | u8 pio_mode; | 575 | u8 pio_mode; |
549 | u8 dma_mode; | 576 | u8 dma_mode; |
@@ -597,10 +624,15 @@ struct ata_eh_info { | |||
597 | struct ata_eh_context { | 624 | struct ata_eh_context { |
598 | struct ata_eh_info i; | 625 | struct ata_eh_info i; |
599 | int tries[ATA_MAX_DEVICES]; | 626 | int tries[ATA_MAX_DEVICES]; |
627 | int cmd_timeout_idx[ATA_MAX_DEVICES] | ||
628 | [ATA_EH_CMD_TIMEOUT_TABLE_SIZE]; | ||
600 | unsigned int classes[ATA_MAX_DEVICES]; | 629 | unsigned int classes[ATA_MAX_DEVICES]; |
601 | unsigned int did_probe_mask; | 630 | unsigned int did_probe_mask; |
631 | unsigned int unloaded_mask; | ||
602 | unsigned int saved_ncq_enabled; | 632 | unsigned int saved_ncq_enabled; |
603 | u8 saved_xfer_mode[ATA_MAX_DEVICES]; | 633 | u8 saved_xfer_mode[ATA_MAX_DEVICES]; |
634 | /* timestamp for the last reset attempt or success */ | ||
635 | unsigned long last_reset; | ||
604 | }; | 636 | }; |
605 | 637 | ||
606 | struct ata_acpi_drive | 638 | struct ata_acpi_drive |
@@ -623,6 +655,7 @@ struct ata_link { | |||
623 | 655 | ||
624 | unsigned int flags; /* ATA_LFLAG_xxx */ | 656 | unsigned int flags; /* ATA_LFLAG_xxx */ |
625 | 657 | ||
658 | u32 saved_scontrol; /* SControl on probe */ | ||
626 | unsigned int hw_sata_spd_limit; | 659 | unsigned int hw_sata_spd_limit; |
627 | unsigned int sata_spd_limit; | 660 | unsigned int sata_spd_limit; |
628 | unsigned int sata_spd; /* current SATA PHY speed */ | 661 | unsigned int sata_spd; /* current SATA PHY speed */ |
@@ -663,7 +696,8 @@ struct ata_port { | |||
663 | unsigned int qc_active; | 696 | unsigned int qc_active; |
664 | int nr_active_links; /* #links with active qcs */ | 697 | int nr_active_links; /* #links with active qcs */ |
665 | 698 | ||
666 | struct ata_link link; /* host default link */ | 699 | struct ata_link link; /* host default link */ |
700 | struct ata_link *slave_link; /* see ata_slave_link_init() */ | ||
667 | 701 | ||
668 | int nr_pmp_links; /* nr of available PMP links */ | 702 | int nr_pmp_links; /* nr of available PMP links */ |
669 | struct ata_link *pmp_link; /* array of PMP links */ | 703 | struct ata_link *pmp_link; /* array of PMP links */ |
@@ -684,6 +718,7 @@ struct ata_port { | |||
684 | struct list_head eh_done_q; | 718 | struct list_head eh_done_q; |
685 | wait_queue_head_t eh_wait_q; | 719 | wait_queue_head_t eh_wait_q; |
686 | int eh_tries; | 720 | int eh_tries; |
721 | struct completion park_req_pending; | ||
687 | 722 | ||
688 | pm_message_t pm_mesg; | 723 | pm_message_t pm_mesg; |
689 | int *pm_result; | 724 | int *pm_result; |
@@ -692,6 +727,7 @@ struct ata_port { | |||
692 | struct timer_list fastdrain_timer; | 727 | struct timer_list fastdrain_timer; |
693 | unsigned long fastdrain_cnt; | 728 | unsigned long fastdrain_cnt; |
694 | 729 | ||
730 | int em_message_type; | ||
695 | void *private_data; | 731 | void *private_data; |
696 | 732 | ||
697 | #ifdef CONFIG_ATA_ACPI | 733 | #ifdef CONFIG_ATA_ACPI |
@@ -726,6 +762,7 @@ struct ata_port_operations { | |||
726 | void (*set_piomode)(struct ata_port *ap, struct ata_device *dev); | 762 | void (*set_piomode)(struct ata_port *ap, struct ata_device *dev); |
727 | void (*set_dmamode)(struct ata_port *ap, struct ata_device *dev); | 763 | void (*set_dmamode)(struct ata_port *ap, struct ata_device *dev); |
728 | int (*set_mode)(struct ata_link *link, struct ata_device **r_failed_dev); | 764 | int (*set_mode)(struct ata_link *link, struct ata_device **r_failed_dev); |
765 | unsigned int (*read_id)(struct ata_device *dev, struct ata_taskfile *tf, u16 *id); | ||
729 | 766 | ||
730 | void (*dev_config)(struct ata_device *dev); | 767 | void (*dev_config)(struct ata_device *dev); |
731 | 768 | ||
@@ -745,8 +782,8 @@ struct ata_port_operations { | |||
745 | /* | 782 | /* |
746 | * Optional features | 783 | * Optional features |
747 | */ | 784 | */ |
748 | int (*scr_read)(struct ata_port *ap, unsigned int sc_reg, u32 *val); | 785 | int (*scr_read)(struct ata_link *link, unsigned int sc_reg, u32 *val); |
749 | int (*scr_write)(struct ata_port *ap, unsigned int sc_reg, u32 val); | 786 | int (*scr_write)(struct ata_link *link, unsigned int sc_reg, u32 val); |
750 | void (*pmp_attach)(struct ata_port *ap); | 787 | void (*pmp_attach)(struct ata_port *ap); |
751 | void (*pmp_detach)(struct ata_port *ap); | 788 | void (*pmp_detach)(struct ata_port *ap); |
752 | int (*enable_pm)(struct ata_port *ap, enum link_pm policy); | 789 | int (*enable_pm)(struct ata_port *ap, enum link_pm policy); |
@@ -783,6 +820,12 @@ struct ata_port_operations { | |||
783 | u8 (*bmdma_status)(struct ata_port *ap); | 820 | u8 (*bmdma_status)(struct ata_port *ap); |
784 | #endif /* CONFIG_ATA_SFF */ | 821 | #endif /* CONFIG_ATA_SFF */ |
785 | 822 | ||
823 | ssize_t (*em_show)(struct ata_port *ap, char *buf); | ||
824 | ssize_t (*em_store)(struct ata_port *ap, const char *message, | ||
825 | size_t size); | ||
826 | ssize_t (*sw_activity_show)(struct ata_device *dev, char *buf); | ||
827 | ssize_t (*sw_activity_store)(struct ata_device *dev, | ||
828 | enum sw_activity val); | ||
786 | /* | 829 | /* |
787 | * Obsolete | 830 | * Obsolete |
788 | */ | 831 | */ |
@@ -862,6 +905,7 @@ extern void ata_port_disable(struct ata_port *); | |||
862 | extern struct ata_host *ata_host_alloc(struct device *dev, int max_ports); | 905 | extern struct ata_host *ata_host_alloc(struct device *dev, int max_ports); |
863 | extern struct ata_host *ata_host_alloc_pinfo(struct device *dev, | 906 | extern struct ata_host *ata_host_alloc_pinfo(struct device *dev, |
864 | const struct ata_port_info * const * ppi, int n_ports); | 907 | const struct ata_port_info * const * ppi, int n_ports); |
908 | extern int ata_slave_link_init(struct ata_port *ap); | ||
865 | extern int ata_host_start(struct ata_host *host); | 909 | extern int ata_host_start(struct ata_host *host); |
866 | extern int ata_host_register(struct ata_host *host, | 910 | extern int ata_host_register(struct ata_host *host, |
867 | struct scsi_host_template *sht); | 911 | struct scsi_host_template *sht); |
@@ -887,16 +931,15 @@ extern int sata_scr_valid(struct ata_link *link); | |||
887 | extern int sata_scr_read(struct ata_link *link, int reg, u32 *val); | 931 | extern int sata_scr_read(struct ata_link *link, int reg, u32 *val); |
888 | extern int sata_scr_write(struct ata_link *link, int reg, u32 val); | 932 | extern int sata_scr_write(struct ata_link *link, int reg, u32 val); |
889 | extern int sata_scr_write_flush(struct ata_link *link, int reg, u32 val); | 933 | extern int sata_scr_write_flush(struct ata_link *link, int reg, u32 val); |
890 | extern int ata_link_online(struct ata_link *link); | 934 | extern bool ata_link_online(struct ata_link *link); |
891 | extern int ata_link_offline(struct ata_link *link); | 935 | extern bool ata_link_offline(struct ata_link *link); |
892 | #ifdef CONFIG_PM | 936 | #ifdef CONFIG_PM |
893 | extern int ata_host_suspend(struct ata_host *host, pm_message_t mesg); | 937 | extern int ata_host_suspend(struct ata_host *host, pm_message_t mesg); |
894 | extern void ata_host_resume(struct ata_host *host); | 938 | extern void ata_host_resume(struct ata_host *host); |
895 | #endif | 939 | #endif |
896 | extern int ata_ratelimit(void); | 940 | extern int ata_ratelimit(void); |
897 | extern u32 ata_wait_register(void __iomem *reg, u32 mask, u32 val, | 941 | extern u32 ata_wait_register(void __iomem *reg, u32 mask, u32 val, |
898 | unsigned long interval_msec, | 942 | unsigned long interval, unsigned long timeout); |
899 | unsigned long timeout_msec); | ||
900 | extern int atapi_cmd_type(u8 opcode); | 943 | extern int atapi_cmd_type(u8 opcode); |
901 | extern void ata_tf_to_fis(const struct ata_taskfile *tf, | 944 | extern void ata_tf_to_fis(const struct ata_taskfile *tf, |
902 | u8 pmp, int is_cmd, u8 *fis); | 945 | u8 pmp, int is_cmd, u8 *fis); |
@@ -922,6 +965,8 @@ extern void ata_id_string(const u16 *id, unsigned char *s, | |||
922 | unsigned int ofs, unsigned int len); | 965 | unsigned int ofs, unsigned int len); |
923 | extern void ata_id_c_string(const u16 *id, unsigned char *s, | 966 | extern void ata_id_c_string(const u16 *id, unsigned char *s, |
924 | unsigned int ofs, unsigned int len); | 967 | unsigned int ofs, unsigned int len); |
968 | extern unsigned int ata_do_dev_read_id(struct ata_device *dev, | ||
969 | struct ata_taskfile *tf, u16 *id); | ||
925 | extern void ata_qc_complete(struct ata_queued_cmd *qc); | 970 | extern void ata_qc_complete(struct ata_queued_cmd *qc); |
926 | extern int ata_qc_complete_multiple(struct ata_port *ap, u32 qc_active); | 971 | extern int ata_qc_complete_multiple(struct ata_port *ap, u32 qc_active); |
927 | extern void ata_scsi_simulate(struct ata_device *dev, struct scsi_cmnd *cmd, | 972 | extern void ata_scsi_simulate(struct ata_device *dev, struct scsi_cmnd *cmd, |
@@ -1064,6 +1109,7 @@ extern void ata_std_error_handler(struct ata_port *ap); | |||
1064 | */ | 1109 | */ |
1065 | extern const struct ata_port_operations ata_base_port_ops; | 1110 | extern const struct ata_port_operations ata_base_port_ops; |
1066 | extern const struct ata_port_operations sata_port_ops; | 1111 | extern const struct ata_port_operations sata_port_ops; |
1112 | extern struct device_attribute *ata_common_sdev_attrs[]; | ||
1067 | 1113 | ||
1068 | #define ATA_BASE_SHT(drv_name) \ | 1114 | #define ATA_BASE_SHT(drv_name) \ |
1069 | .module = THIS_MODULE, \ | 1115 | .module = THIS_MODULE, \ |
@@ -1078,7 +1124,8 @@ extern const struct ata_port_operations sata_port_ops; | |||
1078 | .proc_name = drv_name, \ | 1124 | .proc_name = drv_name, \ |
1079 | .slave_configure = ata_scsi_slave_config, \ | 1125 | .slave_configure = ata_scsi_slave_config, \ |
1080 | .slave_destroy = ata_scsi_slave_destroy, \ | 1126 | .slave_destroy = ata_scsi_slave_destroy, \ |
1081 | .bios_param = ata_std_bios_param | 1127 | .bios_param = ata_std_bios_param, \ |
1128 | .sdev_attrs = ata_common_sdev_attrs | ||
1082 | 1129 | ||
1083 | #define ATA_NCQ_SHT(drv_name) \ | 1130 | #define ATA_NCQ_SHT(drv_name) \ |
1084 | ATA_BASE_SHT(drv_name), \ | 1131 | ATA_BASE_SHT(drv_name), \ |
@@ -1100,7 +1147,7 @@ static inline bool sata_pmp_attached(struct ata_port *ap) | |||
1100 | 1147 | ||
1101 | static inline int ata_is_host_link(const struct ata_link *link) | 1148 | static inline int ata_is_host_link(const struct ata_link *link) |
1102 | { | 1149 | { |
1103 | return link == &link->ap->link; | 1150 | return link == &link->ap->link || link == link->ap->slave_link; |
1104 | } | 1151 | } |
1105 | #else /* CONFIG_SATA_PMP */ | 1152 | #else /* CONFIG_SATA_PMP */ |
1106 | static inline bool sata_pmp_supported(struct ata_port *ap) | 1153 | static inline bool sata_pmp_supported(struct ata_port *ap) |
@@ -1133,7 +1180,7 @@ static inline int sata_srst_pmp(struct ata_link *link) | |||
1133 | printk("%sata%u: "fmt, lv, (ap)->print_id , ##args) | 1180 | printk("%sata%u: "fmt, lv, (ap)->print_id , ##args) |
1134 | 1181 | ||
1135 | #define ata_link_printk(link, lv, fmt, args...) do { \ | 1182 | #define ata_link_printk(link, lv, fmt, args...) do { \ |
1136 | if (sata_pmp_attached((link)->ap)) \ | 1183 | if (sata_pmp_attached((link)->ap) || (link)->ap->slave_link) \ |
1137 | printk("%sata%u.%02u: "fmt, lv, (link)->ap->print_id, \ | 1184 | printk("%sata%u.%02u: "fmt, lv, (link)->ap->print_id, \ |
1138 | (link)->pmp , ##args); \ | 1185 | (link)->pmp , ##args); \ |
1139 | else \ | 1186 | else \ |
@@ -1231,34 +1278,17 @@ static inline int ata_link_active(struct ata_link *link) | |||
1231 | return ata_tag_valid(link->active_tag) || link->sactive; | 1278 | return ata_tag_valid(link->active_tag) || link->sactive; |
1232 | } | 1279 | } |
1233 | 1280 | ||
1234 | static inline struct ata_link *ata_port_first_link(struct ata_port *ap) | 1281 | extern struct ata_link *__ata_port_next_link(struct ata_port *ap, |
1235 | { | 1282 | struct ata_link *link, |
1236 | if (sata_pmp_attached(ap)) | 1283 | bool dev_only); |
1237 | return ap->pmp_link; | ||
1238 | return &ap->link; | ||
1239 | } | ||
1240 | 1284 | ||
1241 | static inline struct ata_link *ata_port_next_link(struct ata_link *link) | 1285 | #define __ata_port_for_each_link(link, ap) \ |
1242 | { | 1286 | for ((link) = __ata_port_next_link((ap), NULL, false); (link); \ |
1243 | struct ata_port *ap = link->ap; | 1287 | (link) = __ata_port_next_link((ap), (link), false)) |
1244 | |||
1245 | if (ata_is_host_link(link)) { | ||
1246 | if (!sata_pmp_attached(ap)) | ||
1247 | return NULL; | ||
1248 | return ap->pmp_link; | ||
1249 | } | ||
1250 | |||
1251 | if (++link < ap->nr_pmp_links + ap->pmp_link) | ||
1252 | return link; | ||
1253 | return NULL; | ||
1254 | } | ||
1255 | |||
1256 | #define __ata_port_for_each_link(lk, ap) \ | ||
1257 | for ((lk) = &(ap)->link; (lk); (lk) = ata_port_next_link(lk)) | ||
1258 | 1288 | ||
1259 | #define ata_port_for_each_link(link, ap) \ | 1289 | #define ata_port_for_each_link(link, ap) \ |
1260 | for ((link) = ata_port_first_link(ap); (link); \ | 1290 | for ((link) = __ata_port_next_link((ap), NULL, true); (link); \ |
1261 | (link) = ata_port_next_link(link)) | 1291 | (link) = __ata_port_next_link((ap), (link), true)) |
1262 | 1292 | ||
1263 | #define ata_link_for_each_dev(dev, link) \ | 1293 | #define ata_link_for_each_dev(dev, link) \ |
1264 | for ((dev) = (link)->device; \ | 1294 | for ((dev) = (link)->device; \ |
@@ -1389,6 +1419,34 @@ static inline int ata_check_ready(u8 status) | |||
1389 | return 0; | 1419 | return 0; |
1390 | } | 1420 | } |
1391 | 1421 | ||
1422 | static inline unsigned long ata_deadline(unsigned long from_jiffies, | ||
1423 | unsigned long timeout_msecs) | ||
1424 | { | ||
1425 | return from_jiffies + msecs_to_jiffies(timeout_msecs); | ||
1426 | } | ||
1427 | |||
1428 | /* Don't open code these in drivers as there are traps. Firstly the range may | ||
1429 | change in future hardware and specs, secondly 0xFF means 'no DMA' but is | ||
1430 | > UDMA_0. Dyma ddreigiau */ | ||
1431 | |||
1432 | static inline int ata_using_mwdma(struct ata_device *adev) | ||
1433 | { | ||
1434 | if (adev->dma_mode >= XFER_MW_DMA_0 && adev->dma_mode <= XFER_MW_DMA_4) | ||
1435 | return 1; | ||
1436 | return 0; | ||
1437 | } | ||
1438 | |||
1439 | static inline int ata_using_udma(struct ata_device *adev) | ||
1440 | { | ||
1441 | if (adev->dma_mode >= XFER_UDMA_0 && adev->dma_mode <= XFER_UDMA_7) | ||
1442 | return 1; | ||
1443 | return 0; | ||
1444 | } | ||
1445 | |||
1446 | static inline int ata_dma_enabled(struct ata_device *adev) | ||
1447 | { | ||
1448 | return (adev->dma_mode == 0xFF ? 0 : 1); | ||
1449 | } | ||
1392 | 1450 | ||
1393 | /************************************************************************** | 1451 | /************************************************************************** |
1394 | * PMP - drivers/ata/libata-pmp.c | 1452 | * PMP - drivers/ata/libata-pmp.c |
diff --git a/include/linux/libps2.h b/include/linux/libps2.h index f6f301e2b0f5..afc413369101 100644 --- a/include/linux/libps2.h +++ b/include/linux/libps2.h | |||
@@ -43,7 +43,6 @@ void ps2_init(struct ps2dev *ps2dev, struct serio *serio); | |||
43 | int ps2_sendbyte(struct ps2dev *ps2dev, unsigned char byte, int timeout); | 43 | int ps2_sendbyte(struct ps2dev *ps2dev, unsigned char byte, int timeout); |
44 | void ps2_drain(struct ps2dev *ps2dev, int maxbytes, int timeout); | 44 | void ps2_drain(struct ps2dev *ps2dev, int maxbytes, int timeout); |
45 | int ps2_command(struct ps2dev *ps2dev, unsigned char *param, int command); | 45 | int ps2_command(struct ps2dev *ps2dev, unsigned char *param, int command); |
46 | int ps2_schedule_command(struct ps2dev *ps2dev, unsigned char *param, int command); | ||
47 | int ps2_handle_ack(struct ps2dev *ps2dev, unsigned char data); | 46 | int ps2_handle_ack(struct ps2dev *ps2dev, unsigned char data); |
48 | int ps2_handle_response(struct ps2dev *ps2dev, unsigned char data); | 47 | int ps2_handle_response(struct ps2dev *ps2dev, unsigned char data); |
49 | void ps2_cmd_aborted(struct ps2dev *ps2dev); | 48 | void ps2_cmd_aborted(struct ps2dev *ps2dev); |
diff --git a/include/linux/linkage.h b/include/linux/linkage.h index 2119610b24f8..56ba37394656 100644 --- a/include/linux/linkage.h +++ b/include/linux/linkage.h | |||
@@ -1,8 +1,11 @@ | |||
1 | #ifndef _LINUX_LINKAGE_H | 1 | #ifndef _LINUX_LINKAGE_H |
2 | #define _LINUX_LINKAGE_H | 2 | #define _LINUX_LINKAGE_H |
3 | 3 | ||
4 | #include <linux/compiler.h> | ||
4 | #include <asm/linkage.h> | 5 | #include <asm/linkage.h> |
5 | 6 | ||
7 | #define notrace __attribute__((no_instrument_function)) | ||
8 | |||
6 | #ifdef __cplusplus | 9 | #ifdef __cplusplus |
7 | #define CPP_ASMLINKAGE extern "C" | 10 | #define CPP_ASMLINKAGE extern "C" |
8 | #else | 11 | #else |
@@ -17,6 +20,9 @@ | |||
17 | # define asmregparm | 20 | # define asmregparm |
18 | #endif | 21 | #endif |
19 | 22 | ||
23 | #define __page_aligned_data __section(.data.page_aligned) __aligned(PAGE_SIZE) | ||
24 | #define __page_aligned_bss __section(.bss.page_aligned) __aligned(PAGE_SIZE) | ||
25 | |||
20 | /* | 26 | /* |
21 | * This is used by architectures to keep arguments on the stack | 27 | * This is used by architectures to keep arguments on the stack |
22 | * untouched by the compiler by keeping them live until the end. | 28 | * untouched by the compiler by keeping them live until the end. |
diff --git a/include/linux/list.h b/include/linux/list.h index 08cf4f651889..969f6e92d089 100644 --- a/include/linux/list.h +++ b/include/linux/list.h | |||
@@ -61,14 +61,10 @@ extern void __list_add(struct list_head *new, | |||
61 | * Insert a new entry after the specified head. | 61 | * Insert a new entry after the specified head. |
62 | * This is good for implementing stacks. | 62 | * This is good for implementing stacks. |
63 | */ | 63 | */ |
64 | #ifndef CONFIG_DEBUG_LIST | ||
65 | static inline void list_add(struct list_head *new, struct list_head *head) | 64 | static inline void list_add(struct list_head *new, struct list_head *head) |
66 | { | 65 | { |
67 | __list_add(new, head, head->next); | 66 | __list_add(new, head, head->next); |
68 | } | 67 | } |
69 | #else | ||
70 | extern void list_add(struct list_head *new, struct list_head *head); | ||
71 | #endif | ||
72 | 68 | ||
73 | 69 | ||
74 | /** | 70 | /** |
@@ -85,65 +81,6 @@ static inline void list_add_tail(struct list_head *new, struct list_head *head) | |||
85 | } | 81 | } |
86 | 82 | ||
87 | /* | 83 | /* |
88 | * Insert a new entry between two known consecutive entries. | ||
89 | * | ||
90 | * This is only for internal list manipulation where we know | ||
91 | * the prev/next entries already! | ||
92 | */ | ||
93 | static inline void __list_add_rcu(struct list_head * new, | ||
94 | struct list_head * prev, struct list_head * next) | ||
95 | { | ||
96 | new->next = next; | ||
97 | new->prev = prev; | ||
98 | smp_wmb(); | ||
99 | next->prev = new; | ||
100 | prev->next = new; | ||
101 | } | ||
102 | |||
103 | /** | ||
104 | * list_add_rcu - add a new entry to rcu-protected list | ||
105 | * @new: new entry to be added | ||
106 | * @head: list head to add it after | ||
107 | * | ||
108 | * Insert a new entry after the specified head. | ||
109 | * This is good for implementing stacks. | ||
110 | * | ||
111 | * The caller must take whatever precautions are necessary | ||
112 | * (such as holding appropriate locks) to avoid racing | ||
113 | * with another list-mutation primitive, such as list_add_rcu() | ||
114 | * or list_del_rcu(), running on this same list. | ||
115 | * However, it is perfectly legal to run concurrently with | ||
116 | * the _rcu list-traversal primitives, such as | ||
117 | * list_for_each_entry_rcu(). | ||
118 | */ | ||
119 | static inline void list_add_rcu(struct list_head *new, struct list_head *head) | ||
120 | { | ||
121 | __list_add_rcu(new, head, head->next); | ||
122 | } | ||
123 | |||
124 | /** | ||
125 | * list_add_tail_rcu - add a new entry to rcu-protected list | ||
126 | * @new: new entry to be added | ||
127 | * @head: list head to add it before | ||
128 | * | ||
129 | * Insert a new entry before the specified head. | ||
130 | * This is useful for implementing queues. | ||
131 | * | ||
132 | * The caller must take whatever precautions are necessary | ||
133 | * (such as holding appropriate locks) to avoid racing | ||
134 | * with another list-mutation primitive, such as list_add_tail_rcu() | ||
135 | * or list_del_rcu(), running on this same list. | ||
136 | * However, it is perfectly legal to run concurrently with | ||
137 | * the _rcu list-traversal primitives, such as | ||
138 | * list_for_each_entry_rcu(). | ||
139 | */ | ||
140 | static inline void list_add_tail_rcu(struct list_head *new, | ||
141 | struct list_head *head) | ||
142 | { | ||
143 | __list_add_rcu(new, head->prev, head); | ||
144 | } | ||
145 | |||
146 | /* | ||
147 | * Delete a list entry by making the prev/next entries | 84 | * Delete a list entry by making the prev/next entries |
148 | * point to each other. | 85 | * point to each other. |
149 | * | 86 | * |
@@ -174,36 +111,6 @@ extern void list_del(struct list_head *entry); | |||
174 | #endif | 111 | #endif |
175 | 112 | ||
176 | /** | 113 | /** |
177 | * list_del_rcu - deletes entry from list without re-initialization | ||
178 | * @entry: the element to delete from the list. | ||
179 | * | ||
180 | * Note: list_empty() on entry does not return true after this, | ||
181 | * the entry is in an undefined state. It is useful for RCU based | ||
182 | * lockfree traversal. | ||
183 | * | ||
184 | * In particular, it means that we can not poison the forward | ||
185 | * pointers that may still be used for walking the list. | ||
186 | * | ||
187 | * The caller must take whatever precautions are necessary | ||
188 | * (such as holding appropriate locks) to avoid racing | ||
189 | * with another list-mutation primitive, such as list_del_rcu() | ||
190 | * or list_add_rcu(), running on this same list. | ||
191 | * However, it is perfectly legal to run concurrently with | ||
192 | * the _rcu list-traversal primitives, such as | ||
193 | * list_for_each_entry_rcu(). | ||
194 | * | ||
195 | * Note that the caller is not permitted to immediately free | ||
196 | * the newly deleted entry. Instead, either synchronize_rcu() | ||
197 | * or call_rcu() must be used to defer freeing until an RCU | ||
198 | * grace period has elapsed. | ||
199 | */ | ||
200 | static inline void list_del_rcu(struct list_head *entry) | ||
201 | { | ||
202 | __list_del(entry->prev, entry->next); | ||
203 | entry->prev = LIST_POISON2; | ||
204 | } | ||
205 | |||
206 | /** | ||
207 | * list_replace - replace old entry by new one | 114 | * list_replace - replace old entry by new one |
208 | * @old : the element to be replaced | 115 | * @old : the element to be replaced |
209 | * @new : the new element to insert | 116 | * @new : the new element to insert |
@@ -227,25 +134,6 @@ static inline void list_replace_init(struct list_head *old, | |||
227 | } | 134 | } |
228 | 135 | ||
229 | /** | 136 | /** |
230 | * list_replace_rcu - replace old entry by new one | ||
231 | * @old : the element to be replaced | ||
232 | * @new : the new element to insert | ||
233 | * | ||
234 | * The @old entry will be replaced with the @new entry atomically. | ||
235 | * Note: @old should not be empty. | ||
236 | */ | ||
237 | static inline void list_replace_rcu(struct list_head *old, | ||
238 | struct list_head *new) | ||
239 | { | ||
240 | new->next = old->next; | ||
241 | new->prev = old->prev; | ||
242 | smp_wmb(); | ||
243 | new->next->prev = new; | ||
244 | new->prev->next = new; | ||
245 | old->prev = LIST_POISON2; | ||
246 | } | ||
247 | |||
248 | /** | ||
249 | * list_del_init - deletes entry from list and reinitialize it. | 137 | * list_del_init - deletes entry from list and reinitialize it. |
250 | * @entry: the element to delete from the list. | 138 | * @entry: the element to delete from the list. |
251 | */ | 139 | */ |
@@ -326,22 +214,62 @@ static inline int list_is_singular(const struct list_head *head) | |||
326 | return !list_empty(head) && (head->next == head->prev); | 214 | return !list_empty(head) && (head->next == head->prev); |
327 | } | 215 | } |
328 | 216 | ||
217 | static inline void __list_cut_position(struct list_head *list, | ||
218 | struct list_head *head, struct list_head *entry) | ||
219 | { | ||
220 | struct list_head *new_first = entry->next; | ||
221 | list->next = head->next; | ||
222 | list->next->prev = list; | ||
223 | list->prev = entry; | ||
224 | entry->next = list; | ||
225 | head->next = new_first; | ||
226 | new_first->prev = head; | ||
227 | } | ||
228 | |||
229 | /** | ||
230 | * list_cut_position - cut a list into two | ||
231 | * @list: a new list to add all removed entries | ||
232 | * @head: a list with entries | ||
233 | * @entry: an entry within head, could be the head itself | ||
234 | * and if so we won't cut the list | ||
235 | * | ||
236 | * This helper moves the initial part of @head, up to and | ||
237 | * including @entry, from @head to @list. You should | ||
238 | * pass on @entry an element you know is on @head. @list | ||
239 | * should be an empty list or a list you do not care about | ||
240 | * losing its data. | ||
241 | * | ||
242 | */ | ||
243 | static inline void list_cut_position(struct list_head *list, | ||
244 | struct list_head *head, struct list_head *entry) | ||
245 | { | ||
246 | if (list_empty(head)) | ||
247 | return; | ||
248 | if (list_is_singular(head) && | ||
249 | (head->next != entry && head != entry)) | ||
250 | return; | ||
251 | if (entry == head) | ||
252 | INIT_LIST_HEAD(list); | ||
253 | else | ||
254 | __list_cut_position(list, head, entry); | ||
255 | } | ||
256 | |||
329 | static inline void __list_splice(const struct list_head *list, | 257 | static inline void __list_splice(const struct list_head *list, |
330 | struct list_head *head) | 258 | struct list_head *prev, |
259 | struct list_head *next) | ||
331 | { | 260 | { |
332 | struct list_head *first = list->next; | 261 | struct list_head *first = list->next; |
333 | struct list_head *last = list->prev; | 262 | struct list_head *last = list->prev; |
334 | struct list_head *at = head->next; | ||
335 | 263 | ||
336 | first->prev = head; | 264 | first->prev = prev; |
337 | head->next = first; | 265 | prev->next = first; |
338 | 266 | ||
339 | last->next = at; | 267 | last->next = next; |
340 | at->prev = last; | 268 | next->prev = last; |
341 | } | 269 | } |
342 | 270 | ||
343 | /** | 271 | /** |
344 | * list_splice - join two lists | 272 | * list_splice - join two lists, this is designed for stacks |
345 | * @list: the new list to add. | 273 | * @list: the new list to add. |
346 | * @head: the place to add it in the first list. | 274 | * @head: the place to add it in the first list. |
347 | */ | 275 | */ |
@@ -349,7 +277,19 @@ static inline void list_splice(const struct list_head *list, | |||
349 | struct list_head *head) | 277 | struct list_head *head) |
350 | { | 278 | { |
351 | if (!list_empty(list)) | 279 | if (!list_empty(list)) |
352 | __list_splice(list, head); | 280 | __list_splice(list, head, head->next); |
281 | } | ||
282 | |||
283 | /** | ||
284 | * list_splice_tail - join two lists, each list being a queue | ||
285 | * @list: the new list to add. | ||
286 | * @head: the place to add it in the first list. | ||
287 | */ | ||
288 | static inline void list_splice_tail(struct list_head *list, | ||
289 | struct list_head *head) | ||
290 | { | ||
291 | if (!list_empty(list)) | ||
292 | __list_splice(list, head->prev, head); | ||
353 | } | 293 | } |
354 | 294 | ||
355 | /** | 295 | /** |
@@ -363,65 +303,26 @@ static inline void list_splice_init(struct list_head *list, | |||
363 | struct list_head *head) | 303 | struct list_head *head) |
364 | { | 304 | { |
365 | if (!list_empty(list)) { | 305 | if (!list_empty(list)) { |
366 | __list_splice(list, head); | 306 | __list_splice(list, head, head->next); |
367 | INIT_LIST_HEAD(list); | 307 | INIT_LIST_HEAD(list); |
368 | } | 308 | } |
369 | } | 309 | } |
370 | 310 | ||
371 | /** | 311 | /** |
372 | * list_splice_init_rcu - splice an RCU-protected list into an existing list. | 312 | * list_splice_tail_init - join two lists and reinitialise the emptied list |
373 | * @list: the RCU-protected list to splice | 313 | * @list: the new list to add. |
374 | * @head: the place in the list to splice the first list into | 314 | * @head: the place to add it in the first list. |
375 | * @sync: function to sync: synchronize_rcu(), synchronize_sched(), ... | ||
376 | * | ||
377 | * @head can be RCU-read traversed concurrently with this function. | ||
378 | * | ||
379 | * Note that this function blocks. | ||
380 | * | 315 | * |
381 | * Important note: the caller must take whatever action is necessary to | 316 | * Each of the lists is a queue. |
382 | * prevent any other updates to @head. In principle, it is possible | 317 | * The list at @list is reinitialised |
383 | * to modify the list as soon as sync() begins execution. | ||
384 | * If this sort of thing becomes necessary, an alternative version | ||
385 | * based on call_rcu() could be created. But only if -really- | ||
386 | * needed -- there is no shortage of RCU API members. | ||
387 | */ | 318 | */ |
388 | static inline void list_splice_init_rcu(struct list_head *list, | 319 | static inline void list_splice_tail_init(struct list_head *list, |
389 | struct list_head *head, | 320 | struct list_head *head) |
390 | void (*sync)(void)) | ||
391 | { | 321 | { |
392 | struct list_head *first = list->next; | 322 | if (!list_empty(list)) { |
393 | struct list_head *last = list->prev; | 323 | __list_splice(list, head->prev, head); |
394 | struct list_head *at = head->next; | 324 | INIT_LIST_HEAD(list); |
395 | 325 | } | |
396 | if (list_empty(head)) | ||
397 | return; | ||
398 | |||
399 | /* "first" and "last" tracking list, so initialize it. */ | ||
400 | |||
401 | INIT_LIST_HEAD(list); | ||
402 | |||
403 | /* | ||
404 | * At this point, the list body still points to the source list. | ||
405 | * Wait for any readers to finish using the list before splicing | ||
406 | * the list body into the new list. Any new readers will see | ||
407 | * an empty list. | ||
408 | */ | ||
409 | |||
410 | sync(); | ||
411 | |||
412 | /* | ||
413 | * Readers are finished with the source list, so perform splice. | ||
414 | * The order is important if the new list is global and accessible | ||
415 | * to concurrent RCU readers. Note that RCU readers are not | ||
416 | * permitted to traverse the prev pointers without excluding | ||
417 | * this function. | ||
418 | */ | ||
419 | |||
420 | last->next = at; | ||
421 | smp_wmb(); | ||
422 | head->next = first; | ||
423 | first->prev = head; | ||
424 | at->prev = last; | ||
425 | } | 326 | } |
426 | 327 | ||
427 | /** | 328 | /** |
@@ -629,57 +530,6 @@ static inline void list_splice_init_rcu(struct list_head *list, | |||
629 | &pos->member != (head); \ | 530 | &pos->member != (head); \ |
630 | pos = n, n = list_entry(n->member.prev, typeof(*n), member)) | 531 | pos = n, n = list_entry(n->member.prev, typeof(*n), member)) |
631 | 532 | ||
632 | /** | ||
633 | * list_for_each_rcu - iterate over an rcu-protected list | ||
634 | * @pos: the &struct list_head to use as a loop cursor. | ||
635 | * @head: the head for your list. | ||
636 | * | ||
637 | * This list-traversal primitive may safely run concurrently with | ||
638 | * the _rcu list-mutation primitives such as list_add_rcu() | ||
639 | * as long as the traversal is guarded by rcu_read_lock(). | ||
640 | */ | ||
641 | #define list_for_each_rcu(pos, head) \ | ||
642 | for (pos = rcu_dereference((head)->next); \ | ||
643 | prefetch(pos->next), pos != (head); \ | ||
644 | pos = rcu_dereference(pos->next)) | ||
645 | |||
646 | #define __list_for_each_rcu(pos, head) \ | ||
647 | for (pos = rcu_dereference((head)->next); \ | ||
648 | pos != (head); \ | ||
649 | pos = rcu_dereference(pos->next)) | ||
650 | |||
651 | /** | ||
652 | * list_for_each_entry_rcu - iterate over rcu list of given type | ||
653 | * @pos: the type * to use as a loop cursor. | ||
654 | * @head: the head for your list. | ||
655 | * @member: the name of the list_struct within the struct. | ||
656 | * | ||
657 | * This list-traversal primitive may safely run concurrently with | ||
658 | * the _rcu list-mutation primitives such as list_add_rcu() | ||
659 | * as long as the traversal is guarded by rcu_read_lock(). | ||
660 | */ | ||
661 | #define list_for_each_entry_rcu(pos, head, member) \ | ||
662 | for (pos = list_entry(rcu_dereference((head)->next), typeof(*pos), member); \ | ||
663 | prefetch(pos->member.next), &pos->member != (head); \ | ||
664 | pos = list_entry(rcu_dereference(pos->member.next), typeof(*pos), member)) | ||
665 | |||
666 | |||
667 | /** | ||
668 | * list_for_each_continue_rcu | ||
669 | * @pos: the &struct list_head to use as a loop cursor. | ||
670 | * @head: the head for your list. | ||
671 | * | ||
672 | * Iterate over an rcu-protected list, continuing after current point. | ||
673 | * | ||
674 | * This list-traversal primitive may safely run concurrently with | ||
675 | * the _rcu list-mutation primitives such as list_add_rcu() | ||
676 | * as long as the traversal is guarded by rcu_read_lock(). | ||
677 | */ | ||
678 | #define list_for_each_continue_rcu(pos, head) \ | ||
679 | for ((pos) = rcu_dereference((pos)->next); \ | ||
680 | prefetch((pos)->next), (pos) != (head); \ | ||
681 | (pos) = rcu_dereference((pos)->next)) | ||
682 | |||
683 | /* | 533 | /* |
684 | * Double linked lists with a single pointer list head. | 534 | * Double linked lists with a single pointer list head. |
685 | * Mostly useful for hash tables where the two pointer list head is | 535 | * Mostly useful for hash tables where the two pointer list head is |
@@ -730,31 +580,6 @@ static inline void hlist_del(struct hlist_node *n) | |||
730 | n->pprev = LIST_POISON2; | 580 | n->pprev = LIST_POISON2; |
731 | } | 581 | } |
732 | 582 | ||
733 | /** | ||
734 | * hlist_del_rcu - deletes entry from hash list without re-initialization | ||
735 | * @n: the element to delete from the hash list. | ||
736 | * | ||
737 | * Note: list_unhashed() on entry does not return true after this, | ||
738 | * the entry is in an undefined state. It is useful for RCU based | ||
739 | * lockfree traversal. | ||
740 | * | ||
741 | * In particular, it means that we can not poison the forward | ||
742 | * pointers that may still be used for walking the hash list. | ||
743 | * | ||
744 | * The caller must take whatever precautions are necessary | ||
745 | * (such as holding appropriate locks) to avoid racing | ||
746 | * with another list-mutation primitive, such as hlist_add_head_rcu() | ||
747 | * or hlist_del_rcu(), running on this same list. | ||
748 | * However, it is perfectly legal to run concurrently with | ||
749 | * the _rcu list-traversal primitives, such as | ||
750 | * hlist_for_each_entry(). | ||
751 | */ | ||
752 | static inline void hlist_del_rcu(struct hlist_node *n) | ||
753 | { | ||
754 | __hlist_del(n); | ||
755 | n->pprev = LIST_POISON2; | ||
756 | } | ||
757 | |||
758 | static inline void hlist_del_init(struct hlist_node *n) | 583 | static inline void hlist_del_init(struct hlist_node *n) |
759 | { | 584 | { |
760 | if (!hlist_unhashed(n)) { | 585 | if (!hlist_unhashed(n)) { |
@@ -763,27 +588,6 @@ static inline void hlist_del_init(struct hlist_node *n) | |||
763 | } | 588 | } |
764 | } | 589 | } |
765 | 590 | ||
766 | /** | ||
767 | * hlist_replace_rcu - replace old entry by new one | ||
768 | * @old : the element to be replaced | ||
769 | * @new : the new element to insert | ||
770 | * | ||
771 | * The @old entry will be replaced with the @new entry atomically. | ||
772 | */ | ||
773 | static inline void hlist_replace_rcu(struct hlist_node *old, | ||
774 | struct hlist_node *new) | ||
775 | { | ||
776 | struct hlist_node *next = old->next; | ||
777 | |||
778 | new->next = next; | ||
779 | new->pprev = old->pprev; | ||
780 | smp_wmb(); | ||
781 | if (next) | ||
782 | new->next->pprev = &new->next; | ||
783 | *new->pprev = new; | ||
784 | old->pprev = LIST_POISON2; | ||
785 | } | ||
786 | |||
787 | static inline void hlist_add_head(struct hlist_node *n, struct hlist_head *h) | 591 | static inline void hlist_add_head(struct hlist_node *n, struct hlist_head *h) |
788 | { | 592 | { |
789 | struct hlist_node *first = h->first; | 593 | struct hlist_node *first = h->first; |
@@ -794,38 +598,6 @@ static inline void hlist_add_head(struct hlist_node *n, struct hlist_head *h) | |||
794 | n->pprev = &h->first; | 598 | n->pprev = &h->first; |
795 | } | 599 | } |
796 | 600 | ||
797 | |||
798 | /** | ||
799 | * hlist_add_head_rcu | ||
800 | * @n: the element to add to the hash list. | ||
801 | * @h: the list to add to. | ||
802 | * | ||
803 | * Description: | ||
804 | * Adds the specified element to the specified hlist, | ||
805 | * while permitting racing traversals. | ||
806 | * | ||
807 | * The caller must take whatever precautions are necessary | ||
808 | * (such as holding appropriate locks) to avoid racing | ||
809 | * with another list-mutation primitive, such as hlist_add_head_rcu() | ||
810 | * or hlist_del_rcu(), running on this same list. | ||
811 | * However, it is perfectly legal to run concurrently with | ||
812 | * the _rcu list-traversal primitives, such as | ||
813 | * hlist_for_each_entry_rcu(), used to prevent memory-consistency | ||
814 | * problems on Alpha CPUs. Regardless of the type of CPU, the | ||
815 | * list-traversal primitive must be guarded by rcu_read_lock(). | ||
816 | */ | ||
817 | static inline void hlist_add_head_rcu(struct hlist_node *n, | ||
818 | struct hlist_head *h) | ||
819 | { | ||
820 | struct hlist_node *first = h->first; | ||
821 | n->next = first; | ||
822 | n->pprev = &h->first; | ||
823 | smp_wmb(); | ||
824 | if (first) | ||
825 | first->pprev = &n->next; | ||
826 | h->first = n; | ||
827 | } | ||
828 | |||
829 | /* next must be != NULL */ | 601 | /* next must be != NULL */ |
830 | static inline void hlist_add_before(struct hlist_node *n, | 602 | static inline void hlist_add_before(struct hlist_node *n, |
831 | struct hlist_node *next) | 603 | struct hlist_node *next) |
@@ -847,61 +619,17 @@ static inline void hlist_add_after(struct hlist_node *n, | |||
847 | next->next->pprev = &next->next; | 619 | next->next->pprev = &next->next; |
848 | } | 620 | } |
849 | 621 | ||
850 | /** | 622 | /* |
851 | * hlist_add_before_rcu | 623 | * Move a list from one list head to another. Fixup the pprev |
852 | * @n: the new element to add to the hash list. | 624 | * reference of the first entry if it exists. |
853 | * @next: the existing element to add the new element before. | 625 | */ |
854 | * | 626 | static inline void hlist_move_list(struct hlist_head *old, |
855 | * Description: | 627 | struct hlist_head *new) |
856 | * Adds the specified element to the specified hlist | ||
857 | * before the specified node while permitting racing traversals. | ||
858 | * | ||
859 | * The caller must take whatever precautions are necessary | ||
860 | * (such as holding appropriate locks) to avoid racing | ||
861 | * with another list-mutation primitive, such as hlist_add_head_rcu() | ||
862 | * or hlist_del_rcu(), running on this same list. | ||
863 | * However, it is perfectly legal to run concurrently with | ||
864 | * the _rcu list-traversal primitives, such as | ||
865 | * hlist_for_each_entry_rcu(), used to prevent memory-consistency | ||
866 | * problems on Alpha CPUs. | ||
867 | */ | ||
868 | static inline void hlist_add_before_rcu(struct hlist_node *n, | ||
869 | struct hlist_node *next) | ||
870 | { | 628 | { |
871 | n->pprev = next->pprev; | 629 | new->first = old->first; |
872 | n->next = next; | 630 | if (new->first) |
873 | smp_wmb(); | 631 | new->first->pprev = &new->first; |
874 | next->pprev = &n->next; | 632 | old->first = NULL; |
875 | *(n->pprev) = n; | ||
876 | } | ||
877 | |||
878 | /** | ||
879 | * hlist_add_after_rcu | ||
880 | * @prev: the existing element to add the new element after. | ||
881 | * @n: the new element to add to the hash list. | ||
882 | * | ||
883 | * Description: | ||
884 | * Adds the specified element to the specified hlist | ||
885 | * after the specified node while permitting racing traversals. | ||
886 | * | ||
887 | * The caller must take whatever precautions are necessary | ||
888 | * (such as holding appropriate locks) to avoid racing | ||
889 | * with another list-mutation primitive, such as hlist_add_head_rcu() | ||
890 | * or hlist_del_rcu(), running on this same list. | ||
891 | * However, it is perfectly legal to run concurrently with | ||
892 | * the _rcu list-traversal primitives, such as | ||
893 | * hlist_for_each_entry_rcu(), used to prevent memory-consistency | ||
894 | * problems on Alpha CPUs. | ||
895 | */ | ||
896 | static inline void hlist_add_after_rcu(struct hlist_node *prev, | ||
897 | struct hlist_node *n) | ||
898 | { | ||
899 | n->next = prev->next; | ||
900 | n->pprev = &prev->next; | ||
901 | smp_wmb(); | ||
902 | prev->next = n; | ||
903 | if (n->next) | ||
904 | n->next->pprev = &n->next; | ||
905 | } | 633 | } |
906 | 634 | ||
907 | #define hlist_entry(ptr, type, member) container_of(ptr,type,member) | 635 | #define hlist_entry(ptr, type, member) container_of(ptr,type,member) |
@@ -964,21 +692,4 @@ static inline void hlist_add_after_rcu(struct hlist_node *prev, | |||
964 | ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1;}); \ | 692 | ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1;}); \ |
965 | pos = n) | 693 | pos = n) |
966 | 694 | ||
967 | /** | ||
968 | * hlist_for_each_entry_rcu - iterate over rcu list of given type | ||
969 | * @tpos: the type * to use as a loop cursor. | ||
970 | * @pos: the &struct hlist_node to use as a loop cursor. | ||
971 | * @head: the head for your list. | ||
972 | * @member: the name of the hlist_node within the struct. | ||
973 | * | ||
974 | * This list-traversal primitive may safely run concurrently with | ||
975 | * the _rcu list-mutation primitives such as hlist_add_head_rcu() | ||
976 | * as long as the traversal is guarded by rcu_read_lock(). | ||
977 | */ | ||
978 | #define hlist_for_each_entry_rcu(tpos, pos, head, member) \ | ||
979 | for (pos = rcu_dereference((head)->first); \ | ||
980 | pos && ({ prefetch(pos->next); 1;}) && \ | ||
981 | ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1;}); \ | ||
982 | pos = rcu_dereference(pos->next)) | ||
983 | |||
984 | #endif | 695 | #endif |
diff --git a/include/linux/lm_interface.h b/include/linux/lm_interface.h index f274997bc283..2ed8fa1b762b 100644 --- a/include/linux/lm_interface.h +++ b/include/linux/lm_interface.h | |||
@@ -122,11 +122,9 @@ typedef void (*lm_callback_t) (void *ptr, unsigned int type, void *data); | |||
122 | */ | 122 | */ |
123 | 123 | ||
124 | #define LM_OUT_ST_MASK 0x00000003 | 124 | #define LM_OUT_ST_MASK 0x00000003 |
125 | #define LM_OUT_CACHEABLE 0x00000004 | ||
126 | #define LM_OUT_CANCELED 0x00000008 | 125 | #define LM_OUT_CANCELED 0x00000008 |
127 | #define LM_OUT_ASYNC 0x00000080 | 126 | #define LM_OUT_ASYNC 0x00000080 |
128 | #define LM_OUT_ERROR 0x00000100 | 127 | #define LM_OUT_ERROR 0x00000100 |
129 | #define LM_OUT_CONV_DEADLK 0x00000200 | ||
130 | 128 | ||
131 | /* | 129 | /* |
132 | * lm_callback_t types | 130 | * lm_callback_t types |
@@ -138,9 +136,6 @@ typedef void (*lm_callback_t) (void *ptr, unsigned int type, void *data); | |||
138 | * LM_CB_NEED_RECOVERY | 136 | * LM_CB_NEED_RECOVERY |
139 | * The given journal needs to be recovered. | 137 | * The given journal needs to be recovered. |
140 | * | 138 | * |
141 | * LM_CB_DROPLOCKS | ||
142 | * Reduce the number of cached locks. | ||
143 | * | ||
144 | * LM_CB_ASYNC | 139 | * LM_CB_ASYNC |
145 | * The given lock has been granted. | 140 | * The given lock has been granted. |
146 | */ | 141 | */ |
@@ -149,7 +144,6 @@ typedef void (*lm_callback_t) (void *ptr, unsigned int type, void *data); | |||
149 | #define LM_CB_NEED_D 258 | 144 | #define LM_CB_NEED_D 258 |
150 | #define LM_CB_NEED_S 259 | 145 | #define LM_CB_NEED_S 259 |
151 | #define LM_CB_NEED_RECOVERY 260 | 146 | #define LM_CB_NEED_RECOVERY 260 |
152 | #define LM_CB_DROPLOCKS 261 | ||
153 | #define LM_CB_ASYNC 262 | 147 | #define LM_CB_ASYNC 262 |
154 | 148 | ||
155 | /* | 149 | /* |
diff --git a/include/linux/lockd/bind.h b/include/linux/lockd/bind.h index 3d25bcd139d1..e5872dc994c0 100644 --- a/include/linux/lockd/bind.h +++ b/include/linux/lockd/bind.h | |||
@@ -27,7 +27,6 @@ struct nlmsvc_binding { | |||
27 | struct nfs_fh *, | 27 | struct nfs_fh *, |
28 | struct file **); | 28 | struct file **); |
29 | void (*fclose)(struct file *); | 29 | void (*fclose)(struct file *); |
30 | unsigned long (*get_grace_period)(void); | ||
31 | }; | 30 | }; |
32 | 31 | ||
33 | extern struct nlmsvc_binding * nlmsvc_ops; | 32 | extern struct nlmsvc_binding * nlmsvc_ops; |
@@ -53,15 +52,7 @@ extern void nlmclnt_done(struct nlm_host *host); | |||
53 | 52 | ||
54 | extern int nlmclnt_proc(struct nlm_host *host, int cmd, | 53 | extern int nlmclnt_proc(struct nlm_host *host, int cmd, |
55 | struct file_lock *fl); | 54 | struct file_lock *fl); |
56 | extern int lockd_up(int proto); | 55 | extern int lockd_up(void); |
57 | extern void lockd_down(void); | 56 | extern void lockd_down(void); |
58 | 57 | ||
59 | unsigned long get_nfs_grace_period(void); | ||
60 | |||
61 | #ifdef CONFIG_NFSD_V4 | ||
62 | unsigned long get_nfs4_grace_period(void); | ||
63 | #else | ||
64 | static inline unsigned long get_nfs4_grace_period(void) {return 0;} | ||
65 | #endif | ||
66 | |||
67 | #endif /* LINUX_LOCKD_BIND_H */ | 58 | #endif /* LINUX_LOCKD_BIND_H */ |
diff --git a/include/linux/lockd/lockd.h b/include/linux/lockd/lockd.h index 102d928f7206..b56d5aa9b194 100644 --- a/include/linux/lockd/lockd.h +++ b/include/linux/lockd/lockd.h | |||
@@ -12,6 +12,8 @@ | |||
12 | #ifdef __KERNEL__ | 12 | #ifdef __KERNEL__ |
13 | 13 | ||
14 | #include <linux/in.h> | 14 | #include <linux/in.h> |
15 | #include <linux/in6.h> | ||
16 | #include <net/ipv6.h> | ||
15 | #include <linux/fs.h> | 17 | #include <linux/fs.h> |
16 | #include <linux/kref.h> | 18 | #include <linux/kref.h> |
17 | #include <linux/utsname.h> | 19 | #include <linux/utsname.h> |
@@ -38,8 +40,9 @@ | |||
38 | */ | 40 | */ |
39 | struct nlm_host { | 41 | struct nlm_host { |
40 | struct hlist_node h_hash; /* doubly linked list */ | 42 | struct hlist_node h_hash; /* doubly linked list */ |
41 | struct sockaddr_in h_addr; /* peer address */ | 43 | struct sockaddr_storage h_addr; /* peer address */ |
42 | struct sockaddr_in h_saddr; /* our address (optional) */ | 44 | size_t h_addrlen; |
45 | struct sockaddr_storage h_srcaddr; /* our address (optional) */ | ||
43 | struct rpc_clnt * h_rpcclnt; /* RPC client to talk to peer */ | 46 | struct rpc_clnt * h_rpcclnt; /* RPC client to talk to peer */ |
44 | char * h_name; /* remote hostname */ | 47 | char * h_name; /* remote hostname */ |
45 | u32 h_version; /* interface version */ | 48 | u32 h_version; /* interface version */ |
@@ -61,18 +64,56 @@ struct nlm_host { | |||
61 | struct list_head h_granted; /* Locks in GRANTED state */ | 64 | struct list_head h_granted; /* Locks in GRANTED state */ |
62 | struct list_head h_reclaim; /* Locks in RECLAIM state */ | 65 | struct list_head h_reclaim; /* Locks in RECLAIM state */ |
63 | struct nsm_handle * h_nsmhandle; /* NSM status handle */ | 66 | struct nsm_handle * h_nsmhandle; /* NSM status handle */ |
67 | |||
68 | char h_addrbuf[48], /* address eyecatchers */ | ||
69 | h_srcaddrbuf[48]; | ||
64 | }; | 70 | }; |
65 | 71 | ||
66 | struct nsm_handle { | 72 | struct nsm_handle { |
67 | struct list_head sm_link; | 73 | struct list_head sm_link; |
68 | atomic_t sm_count; | 74 | atomic_t sm_count; |
69 | char * sm_name; | 75 | char * sm_name; |
70 | struct sockaddr_in sm_addr; | 76 | struct sockaddr_storage sm_addr; |
77 | size_t sm_addrlen; | ||
71 | unsigned int sm_monitored : 1, | 78 | unsigned int sm_monitored : 1, |
72 | sm_sticky : 1; /* don't unmonitor */ | 79 | sm_sticky : 1; /* don't unmonitor */ |
80 | char sm_addrbuf[48]; /* address eyecatcher */ | ||
73 | }; | 81 | }; |
74 | 82 | ||
75 | /* | 83 | /* |
84 | * Rigorous type checking on sockaddr type conversions | ||
85 | */ | ||
86 | static inline struct sockaddr_in *nlm_addr_in(const struct nlm_host *host) | ||
87 | { | ||
88 | return (struct sockaddr_in *)&host->h_addr; | ||
89 | } | ||
90 | |||
91 | static inline struct sockaddr *nlm_addr(const struct nlm_host *host) | ||
92 | { | ||
93 | return (struct sockaddr *)&host->h_addr; | ||
94 | } | ||
95 | |||
96 | static inline struct sockaddr_in *nlm_srcaddr_in(const struct nlm_host *host) | ||
97 | { | ||
98 | return (struct sockaddr_in *)&host->h_srcaddr; | ||
99 | } | ||
100 | |||
101 | static inline struct sockaddr *nlm_srcaddr(const struct nlm_host *host) | ||
102 | { | ||
103 | return (struct sockaddr *)&host->h_srcaddr; | ||
104 | } | ||
105 | |||
106 | static inline struct sockaddr_in *nsm_addr_in(const struct nsm_handle *handle) | ||
107 | { | ||
108 | return (struct sockaddr_in *)&handle->sm_addr; | ||
109 | } | ||
110 | |||
111 | static inline struct sockaddr *nsm_addr(const struct nsm_handle *handle) | ||
112 | { | ||
113 | return (struct sockaddr *)&handle->sm_addr; | ||
114 | } | ||
115 | |||
116 | /* | ||
76 | * Map an fl_owner_t into a unique 32-bit "pid" | 117 | * Map an fl_owner_t into a unique 32-bit "pid" |
77 | */ | 118 | */ |
78 | struct nlm_lockowner { | 119 | struct nlm_lockowner { |
@@ -166,7 +207,8 @@ int nlm_async_reply(struct nlm_rqst *, u32, const struct rpc_call_ops *); | |||
166 | struct nlm_wait * nlmclnt_prepare_block(struct nlm_host *host, struct file_lock *fl); | 207 | struct nlm_wait * nlmclnt_prepare_block(struct nlm_host *host, struct file_lock *fl); |
167 | void nlmclnt_finish_block(struct nlm_wait *block); | 208 | void nlmclnt_finish_block(struct nlm_wait *block); |
168 | int nlmclnt_block(struct nlm_wait *block, struct nlm_rqst *req, long timeout); | 209 | int nlmclnt_block(struct nlm_wait *block, struct nlm_rqst *req, long timeout); |
169 | __be32 nlmclnt_grant(const struct sockaddr_in *addr, const struct nlm_lock *); | 210 | __be32 nlmclnt_grant(const struct sockaddr *addr, |
211 | const struct nlm_lock *lock); | ||
170 | void nlmclnt_recovery(struct nlm_host *); | 212 | void nlmclnt_recovery(struct nlm_host *); |
171 | int nlmclnt_reclaim(struct nlm_host *, struct file_lock *); | 213 | int nlmclnt_reclaim(struct nlm_host *, struct file_lock *); |
172 | void nlmclnt_next_cookie(struct nlm_cookie *); | 214 | void nlmclnt_next_cookie(struct nlm_cookie *); |
@@ -174,12 +216,14 @@ void nlmclnt_next_cookie(struct nlm_cookie *); | |||
174 | /* | 216 | /* |
175 | * Host cache | 217 | * Host cache |
176 | */ | 218 | */ |
177 | struct nlm_host *nlmclnt_lookup_host(const struct sockaddr_in *sin, | 219 | struct nlm_host *nlmclnt_lookup_host(const struct sockaddr *sap, |
178 | int proto, u32 version, | 220 | const size_t salen, |
221 | const unsigned short protocol, | ||
222 | const u32 version, | ||
223 | const char *hostname); | ||
224 | struct nlm_host *nlmsvc_lookup_host(const struct svc_rqst *rqstp, | ||
179 | const char *hostname, | 225 | const char *hostname, |
180 | unsigned int hostname_len); | 226 | const size_t hostname_len); |
181 | struct nlm_host *nlmsvc_lookup_host(struct svc_rqst *, const char *, | ||
182 | unsigned int); | ||
183 | struct rpc_clnt * nlm_bind_host(struct nlm_host *); | 227 | struct rpc_clnt * nlm_bind_host(struct nlm_host *); |
184 | void nlm_rebind_host(struct nlm_host *); | 228 | void nlm_rebind_host(struct nlm_host *); |
185 | struct nlm_host * nlm_get_host(struct nlm_host *); | 229 | struct nlm_host * nlm_get_host(struct nlm_host *); |
@@ -200,10 +244,12 @@ typedef int (*nlm_host_match_fn_t)(void *cur, struct nlm_host *ref); | |||
200 | * Server-side lock handling | 244 | * Server-side lock handling |
201 | */ | 245 | */ |
202 | __be32 nlmsvc_lock(struct svc_rqst *, struct nlm_file *, | 246 | __be32 nlmsvc_lock(struct svc_rqst *, struct nlm_file *, |
203 | struct nlm_lock *, int, struct nlm_cookie *); | 247 | struct nlm_host *, struct nlm_lock *, int, |
248 | struct nlm_cookie *, int); | ||
204 | __be32 nlmsvc_unlock(struct nlm_file *, struct nlm_lock *); | 249 | __be32 nlmsvc_unlock(struct nlm_file *, struct nlm_lock *); |
205 | __be32 nlmsvc_testlock(struct svc_rqst *, struct nlm_file *, | 250 | __be32 nlmsvc_testlock(struct svc_rqst *, struct nlm_file *, |
206 | struct nlm_lock *, struct nlm_lock *, struct nlm_cookie *); | 251 | struct nlm_host *, struct nlm_lock *, |
252 | struct nlm_lock *, struct nlm_cookie *); | ||
207 | __be32 nlmsvc_cancel_blocked(struct nlm_file *, struct nlm_lock *); | 253 | __be32 nlmsvc_cancel_blocked(struct nlm_file *, struct nlm_lock *); |
208 | unsigned long nlmsvc_retry_blocked(void); | 254 | unsigned long nlmsvc_retry_blocked(void); |
209 | void nlmsvc_traverse_blocks(struct nlm_host *, struct nlm_file *, | 255 | void nlmsvc_traverse_blocks(struct nlm_host *, struct nlm_file *, |
@@ -224,22 +270,89 @@ void nlmsvc_invalidate_all(void); | |||
224 | * Cluster failover support | 270 | * Cluster failover support |
225 | */ | 271 | */ |
226 | int nlmsvc_unlock_all_by_sb(struct super_block *sb); | 272 | int nlmsvc_unlock_all_by_sb(struct super_block *sb); |
227 | int nlmsvc_unlock_all_by_ip(__be32 server_addr); | 273 | int nlmsvc_unlock_all_by_ip(struct sockaddr *server_addr); |
228 | 274 | ||
229 | static inline struct inode *nlmsvc_file_inode(struct nlm_file *file) | 275 | static inline struct inode *nlmsvc_file_inode(struct nlm_file *file) |
230 | { | 276 | { |
231 | return file->f_file->f_path.dentry->d_inode; | 277 | return file->f_file->f_path.dentry->d_inode; |
232 | } | 278 | } |
233 | 279 | ||
280 | static inline int __nlm_privileged_request4(const struct sockaddr *sap) | ||
281 | { | ||
282 | const struct sockaddr_in *sin = (struct sockaddr_in *)sap; | ||
283 | return (sin->sin_addr.s_addr == htonl(INADDR_LOOPBACK)) && | ||
284 | (ntohs(sin->sin_port) < 1024); | ||
285 | } | ||
286 | |||
287 | #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) | ||
288 | static inline int __nlm_privileged_request6(const struct sockaddr *sap) | ||
289 | { | ||
290 | const struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)sap; | ||
291 | return (ipv6_addr_type(&sin6->sin6_addr) & IPV6_ADDR_LOOPBACK) && | ||
292 | (ntohs(sin6->sin6_port) < 1024); | ||
293 | } | ||
294 | #else /* defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) */ | ||
295 | static inline int __nlm_privileged_request6(const struct sockaddr *sap) | ||
296 | { | ||
297 | return 0; | ||
298 | } | ||
299 | #endif /* defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) */ | ||
300 | |||
234 | /* | 301 | /* |
235 | * Compare two host addresses (needs modifying for ipv6) | 302 | * Ensure incoming requests are from local privileged callers. |
303 | * | ||
304 | * Return TRUE if sender is local and is connecting via a privileged port; | ||
305 | * otherwise return FALSE. | ||
236 | */ | 306 | */ |
237 | static inline int nlm_cmp_addr(const struct sockaddr_in *sin1, | 307 | static inline int nlm_privileged_requester(const struct svc_rqst *rqstp) |
238 | const struct sockaddr_in *sin2) | ||
239 | { | 308 | { |
309 | const struct sockaddr *sap = svc_addr(rqstp); | ||
310 | |||
311 | switch (sap->sa_family) { | ||
312 | case AF_INET: | ||
313 | return __nlm_privileged_request4(sap); | ||
314 | case AF_INET6: | ||
315 | return __nlm_privileged_request6(sap); | ||
316 | default: | ||
317 | return 0; | ||
318 | } | ||
319 | } | ||
320 | |||
321 | static inline int __nlm_cmp_addr4(const struct sockaddr *sap1, | ||
322 | const struct sockaddr *sap2) | ||
323 | { | ||
324 | const struct sockaddr_in *sin1 = (const struct sockaddr_in *)sap1; | ||
325 | const struct sockaddr_in *sin2 = (const struct sockaddr_in *)sap2; | ||
240 | return sin1->sin_addr.s_addr == sin2->sin_addr.s_addr; | 326 | return sin1->sin_addr.s_addr == sin2->sin_addr.s_addr; |
241 | } | 327 | } |
242 | 328 | ||
329 | static inline int __nlm_cmp_addr6(const struct sockaddr *sap1, | ||
330 | const struct sockaddr *sap2) | ||
331 | { | ||
332 | const struct sockaddr_in6 *sin1 = (const struct sockaddr_in6 *)sap1; | ||
333 | const struct sockaddr_in6 *sin2 = (const struct sockaddr_in6 *)sap2; | ||
334 | return ipv6_addr_equal(&sin1->sin6_addr, &sin2->sin6_addr); | ||
335 | } | ||
336 | |||
337 | /* | ||
338 | * Compare two host addresses | ||
339 | * | ||
340 | * Return TRUE if the addresses are the same; otherwise FALSE. | ||
341 | */ | ||
342 | static inline int nlm_cmp_addr(const struct sockaddr *sap1, | ||
343 | const struct sockaddr *sap2) | ||
344 | { | ||
345 | if (sap1->sa_family == sap2->sa_family) { | ||
346 | switch (sap1->sa_family) { | ||
347 | case AF_INET: | ||
348 | return __nlm_cmp_addr4(sap1, sap2); | ||
349 | case AF_INET6: | ||
350 | return __nlm_cmp_addr6(sap1, sap2); | ||
351 | } | ||
352 | } | ||
353 | return 0; | ||
354 | } | ||
355 | |||
243 | /* | 356 | /* |
244 | * Compare two NLM locks. | 357 | * Compare two NLM locks. |
245 | * When the second lock is of type F_UNLCK, this acts like a wildcard. | 358 | * When the second lock is of type F_UNLCK, this acts like a wildcard. |
diff --git a/include/linux/lockd/xdr.h b/include/linux/lockd/xdr.h index df18fa053bcd..d6b3a802c046 100644 --- a/include/linux/lockd/xdr.h +++ b/include/linux/lockd/xdr.h | |||
@@ -81,8 +81,6 @@ struct nlm_reboot { | |||
81 | unsigned int len; | 81 | unsigned int len; |
82 | u32 state; | 82 | u32 state; |
83 | __be32 addr; | 83 | __be32 addr; |
84 | __be32 vers; | ||
85 | __be32 proto; | ||
86 | }; | 84 | }; |
87 | 85 | ||
88 | /* | 86 | /* |
diff --git a/include/linux/lockdep.h b/include/linux/lockdep.h index 4c4d236ded18..331e5f1c2d8e 100644 --- a/include/linux/lockdep.h +++ b/include/linux/lockdep.h | |||
@@ -89,6 +89,7 @@ struct lock_class { | |||
89 | 89 | ||
90 | struct lockdep_subclass_key *key; | 90 | struct lockdep_subclass_key *key; |
91 | unsigned int subclass; | 91 | unsigned int subclass; |
92 | unsigned int dep_gen_id; | ||
92 | 93 | ||
93 | /* | 94 | /* |
94 | * IRQ/softirq usage tracking bits: | 95 | * IRQ/softirq usage tracking bits: |
@@ -182,10 +183,21 @@ struct lock_list { | |||
182 | * We record lock dependency chains, so that we can cache them: | 183 | * We record lock dependency chains, so that we can cache them: |
183 | */ | 184 | */ |
184 | struct lock_chain { | 185 | struct lock_chain { |
186 | u8 irq_context; | ||
187 | u8 depth; | ||
188 | u16 base; | ||
185 | struct list_head entry; | 189 | struct list_head entry; |
186 | u64 chain_key; | 190 | u64 chain_key; |
187 | }; | 191 | }; |
188 | 192 | ||
193 | #define MAX_LOCKDEP_KEYS_BITS 13 | ||
194 | /* | ||
195 | * Subtract one because we offset hlock->class_idx by 1 in order | ||
196 | * to make 0 mean no class. This avoids overflowing the class_idx | ||
197 | * bitfield and hitting the BUG in hlock_class(). | ||
198 | */ | ||
199 | #define MAX_LOCKDEP_KEYS ((1UL << MAX_LOCKDEP_KEYS_BITS) - 1) | ||
200 | |||
189 | struct held_lock { | 201 | struct held_lock { |
190 | /* | 202 | /* |
191 | * One-way hash of the dependency chain up to this point. We | 203 | * One-way hash of the dependency chain up to this point. We |
@@ -202,14 +214,14 @@ struct held_lock { | |||
202 | * with zero), here we store the previous hash value: | 214 | * with zero), here we store the previous hash value: |
203 | */ | 215 | */ |
204 | u64 prev_chain_key; | 216 | u64 prev_chain_key; |
205 | struct lock_class *class; | ||
206 | unsigned long acquire_ip; | 217 | unsigned long acquire_ip; |
207 | struct lockdep_map *instance; | 218 | struct lockdep_map *instance; |
208 | 219 | struct lockdep_map *nest_lock; | |
209 | #ifdef CONFIG_LOCK_STAT | 220 | #ifdef CONFIG_LOCK_STAT |
210 | u64 waittime_stamp; | 221 | u64 waittime_stamp; |
211 | u64 holdtime_stamp; | 222 | u64 holdtime_stamp; |
212 | #endif | 223 | #endif |
224 | unsigned int class_idx:MAX_LOCKDEP_KEYS_BITS; | ||
213 | /* | 225 | /* |
214 | * The lock-stack is unified in that the lock chains of interrupt | 226 | * The lock-stack is unified in that the lock chains of interrupt |
215 | * contexts nest ontop of process context chains, but we 'separate' | 227 | * contexts nest ontop of process context chains, but we 'separate' |
@@ -223,11 +235,11 @@ struct held_lock { | |||
223 | * The following field is used to detect when we cross into an | 235 | * The following field is used to detect when we cross into an |
224 | * interrupt context: | 236 | * interrupt context: |
225 | */ | 237 | */ |
226 | int irq_context; | 238 | unsigned int irq_context:2; /* bit 0 - soft, bit 1 - hard */ |
227 | int trylock; | 239 | unsigned int trylock:1; |
228 | int read; | 240 | unsigned int read:2; /* see lock_acquire() comment */ |
229 | int check; | 241 | unsigned int check:2; /* see lock_acquire() comment */ |
230 | int hardirqs_off; | 242 | unsigned int hardirqs_off:1; |
231 | }; | 243 | }; |
232 | 244 | ||
233 | /* | 245 | /* |
@@ -276,14 +288,6 @@ extern void lockdep_init_map(struct lockdep_map *lock, const char *name, | |||
276 | (lock)->dep_map.key, sub) | 288 | (lock)->dep_map.key, sub) |
277 | 289 | ||
278 | /* | 290 | /* |
279 | * To initialize a lockdep_map statically use this macro. | ||
280 | * Note that _name must not be NULL. | ||
281 | */ | ||
282 | #define STATIC_LOCKDEP_MAP_INIT(_name, _key) \ | ||
283 | { .name = (_name), .key = (void *)(_key), } | ||
284 | |||
285 | |||
286 | /* | ||
287 | * Acquire a lock. | 291 | * Acquire a lock. |
288 | * | 292 | * |
289 | * Values for "read": | 293 | * Values for "read": |
@@ -299,11 +303,15 @@ extern void lockdep_init_map(struct lockdep_map *lock, const char *name, | |||
299 | * 2: full validation | 303 | * 2: full validation |
300 | */ | 304 | */ |
301 | extern void lock_acquire(struct lockdep_map *lock, unsigned int subclass, | 305 | extern void lock_acquire(struct lockdep_map *lock, unsigned int subclass, |
302 | int trylock, int read, int check, unsigned long ip); | 306 | int trylock, int read, int check, |
307 | struct lockdep_map *nest_lock, unsigned long ip); | ||
303 | 308 | ||
304 | extern void lock_release(struct lockdep_map *lock, int nested, | 309 | extern void lock_release(struct lockdep_map *lock, int nested, |
305 | unsigned long ip); | 310 | unsigned long ip); |
306 | 311 | ||
312 | extern void lock_set_subclass(struct lockdep_map *lock, unsigned int subclass, | ||
313 | unsigned long ip); | ||
314 | |||
307 | # define INIT_LOCKDEP .lockdep_recursion = 0, | 315 | # define INIT_LOCKDEP .lockdep_recursion = 0, |
308 | 316 | ||
309 | #define lockdep_depth(tsk) (debug_locks ? (tsk)->lockdep_depth : 0) | 317 | #define lockdep_depth(tsk) (debug_locks ? (tsk)->lockdep_depth : 0) |
@@ -318,8 +326,9 @@ static inline void lockdep_on(void) | |||
318 | { | 326 | { |
319 | } | 327 | } |
320 | 328 | ||
321 | # define lock_acquire(l, s, t, r, c, i) do { } while (0) | 329 | # define lock_acquire(l, s, t, r, c, n, i) do { } while (0) |
322 | # define lock_release(l, n, i) do { } while (0) | 330 | # define lock_release(l, n, i) do { } while (0) |
331 | # define lock_set_subclass(l, s, i) do { } while (0) | ||
323 | # define lockdep_init() do { } while (0) | 332 | # define lockdep_init() do { } while (0) |
324 | # define lockdep_info() do { } while (0) | 333 | # define lockdep_info() do { } while (0) |
325 | # define lockdep_init_map(lock, name, key, sub) do { (void)(key); } while (0) | 334 | # define lockdep_init_map(lock, name, key, sub) do { (void)(key); } while (0) |
@@ -405,9 +414,11 @@ static inline void print_irqtrace_events(struct task_struct *curr) | |||
405 | 414 | ||
406 | #ifdef CONFIG_DEBUG_LOCK_ALLOC | 415 | #ifdef CONFIG_DEBUG_LOCK_ALLOC |
407 | # ifdef CONFIG_PROVE_LOCKING | 416 | # ifdef CONFIG_PROVE_LOCKING |
408 | # define spin_acquire(l, s, t, i) lock_acquire(l, s, t, 0, 2, i) | 417 | # define spin_acquire(l, s, t, i) lock_acquire(l, s, t, 0, 2, NULL, i) |
418 | # define spin_acquire_nest(l, s, t, n, i) lock_acquire(l, s, t, 0, 2, n, i) | ||
409 | # else | 419 | # else |
410 | # define spin_acquire(l, s, t, i) lock_acquire(l, s, t, 0, 1, i) | 420 | # define spin_acquire(l, s, t, i) lock_acquire(l, s, t, 0, 1, NULL, i) |
421 | # define spin_acquire_nest(l, s, t, n, i) lock_acquire(l, s, t, 0, 1, NULL, i) | ||
411 | # endif | 422 | # endif |
412 | # define spin_release(l, n, i) lock_release(l, n, i) | 423 | # define spin_release(l, n, i) lock_release(l, n, i) |
413 | #else | 424 | #else |
@@ -417,11 +428,11 @@ static inline void print_irqtrace_events(struct task_struct *curr) | |||
417 | 428 | ||
418 | #ifdef CONFIG_DEBUG_LOCK_ALLOC | 429 | #ifdef CONFIG_DEBUG_LOCK_ALLOC |
419 | # ifdef CONFIG_PROVE_LOCKING | 430 | # ifdef CONFIG_PROVE_LOCKING |
420 | # define rwlock_acquire(l, s, t, i) lock_acquire(l, s, t, 0, 2, i) | 431 | # define rwlock_acquire(l, s, t, i) lock_acquire(l, s, t, 0, 2, NULL, i) |
421 | # define rwlock_acquire_read(l, s, t, i) lock_acquire(l, s, t, 2, 2, i) | 432 | # define rwlock_acquire_read(l, s, t, i) lock_acquire(l, s, t, 2, 2, NULL, i) |
422 | # else | 433 | # else |
423 | # define rwlock_acquire(l, s, t, i) lock_acquire(l, s, t, 0, 1, i) | 434 | # define rwlock_acquire(l, s, t, i) lock_acquire(l, s, t, 0, 1, NULL, i) |
424 | # define rwlock_acquire_read(l, s, t, i) lock_acquire(l, s, t, 2, 1, i) | 435 | # define rwlock_acquire_read(l, s, t, i) lock_acquire(l, s, t, 2, 1, NULL, i) |
425 | # endif | 436 | # endif |
426 | # define rwlock_release(l, n, i) lock_release(l, n, i) | 437 | # define rwlock_release(l, n, i) lock_release(l, n, i) |
427 | #else | 438 | #else |
@@ -432,9 +443,9 @@ static inline void print_irqtrace_events(struct task_struct *curr) | |||
432 | 443 | ||
433 | #ifdef CONFIG_DEBUG_LOCK_ALLOC | 444 | #ifdef CONFIG_DEBUG_LOCK_ALLOC |
434 | # ifdef CONFIG_PROVE_LOCKING | 445 | # ifdef CONFIG_PROVE_LOCKING |
435 | # define mutex_acquire(l, s, t, i) lock_acquire(l, s, t, 0, 2, i) | 446 | # define mutex_acquire(l, s, t, i) lock_acquire(l, s, t, 0, 2, NULL, i) |
436 | # else | 447 | # else |
437 | # define mutex_acquire(l, s, t, i) lock_acquire(l, s, t, 0, 1, i) | 448 | # define mutex_acquire(l, s, t, i) lock_acquire(l, s, t, 0, 1, NULL, i) |
438 | # endif | 449 | # endif |
439 | # define mutex_release(l, n, i) lock_release(l, n, i) | 450 | # define mutex_release(l, n, i) lock_release(l, n, i) |
440 | #else | 451 | #else |
@@ -444,11 +455,11 @@ static inline void print_irqtrace_events(struct task_struct *curr) | |||
444 | 455 | ||
445 | #ifdef CONFIG_DEBUG_LOCK_ALLOC | 456 | #ifdef CONFIG_DEBUG_LOCK_ALLOC |
446 | # ifdef CONFIG_PROVE_LOCKING | 457 | # ifdef CONFIG_PROVE_LOCKING |
447 | # define rwsem_acquire(l, s, t, i) lock_acquire(l, s, t, 0, 2, i) | 458 | # define rwsem_acquire(l, s, t, i) lock_acquire(l, s, t, 0, 2, NULL, i) |
448 | # define rwsem_acquire_read(l, s, t, i) lock_acquire(l, s, t, 1, 2, i) | 459 | # define rwsem_acquire_read(l, s, t, i) lock_acquire(l, s, t, 1, 2, NULL, i) |
449 | # else | 460 | # else |
450 | # define rwsem_acquire(l, s, t, i) lock_acquire(l, s, t, 0, 1, i) | 461 | # define rwsem_acquire(l, s, t, i) lock_acquire(l, s, t, 0, 1, NULL, i) |
451 | # define rwsem_acquire_read(l, s, t, i) lock_acquire(l, s, t, 1, 1, i) | 462 | # define rwsem_acquire_read(l, s, t, i) lock_acquire(l, s, t, 1, 1, NULL, i) |
452 | # endif | 463 | # endif |
453 | # define rwsem_release(l, n, i) lock_release(l, n, i) | 464 | # define rwsem_release(l, n, i) lock_release(l, n, i) |
454 | #else | 465 | #else |
@@ -457,4 +468,16 @@ static inline void print_irqtrace_events(struct task_struct *curr) | |||
457 | # define rwsem_release(l, n, i) do { } while (0) | 468 | # define rwsem_release(l, n, i) do { } while (0) |
458 | #endif | 469 | #endif |
459 | 470 | ||
471 | #ifdef CONFIG_DEBUG_LOCK_ALLOC | ||
472 | # ifdef CONFIG_PROVE_LOCKING | ||
473 | # define lock_map_acquire(l) lock_acquire(l, 0, 0, 0, 2, NULL, _THIS_IP_) | ||
474 | # else | ||
475 | # define lock_map_acquire(l) lock_acquire(l, 0, 0, 0, 1, NULL, _THIS_IP_) | ||
476 | # endif | ||
477 | # define lock_map_release(l) lock_release(l, 1, _THIS_IP_) | ||
478 | #else | ||
479 | # define lock_map_acquire(l) do { } while (0) | ||
480 | # define lock_map_release(l) do { } while (0) | ||
481 | #endif | ||
482 | |||
460 | #endif /* __LINUX_LOCKDEP_H */ | 483 | #endif /* __LINUX_LOCKDEP_H */ |
diff --git a/include/linux/mISDNdsp.h b/include/linux/mISDNdsp.h new file mode 100644 index 000000000000..6b71d2dce508 --- /dev/null +++ b/include/linux/mISDNdsp.h | |||
@@ -0,0 +1,37 @@ | |||
1 | #ifndef __mISDNdsp_H__ | ||
2 | #define __mISDNdsp_H__ | ||
3 | |||
4 | struct mISDN_dsp_element_arg { | ||
5 | char *name; | ||
6 | char *def; | ||
7 | char *desc; | ||
8 | }; | ||
9 | |||
10 | struct mISDN_dsp_element { | ||
11 | char *name; | ||
12 | void *(*new)(const char *arg); | ||
13 | void (*free)(void *p); | ||
14 | void (*process_tx)(void *p, unsigned char *data, int len); | ||
15 | void (*process_rx)(void *p, unsigned char *data, int len); | ||
16 | int num_args; | ||
17 | struct mISDN_dsp_element_arg | ||
18 | *args; | ||
19 | }; | ||
20 | |||
21 | extern int mISDN_dsp_element_register(struct mISDN_dsp_element *elem); | ||
22 | extern void mISDN_dsp_element_unregister(struct mISDN_dsp_element *elem); | ||
23 | |||
24 | struct dsp_features { | ||
25 | int hfc_id; /* unique id to identify the chip (or -1) */ | ||
26 | int hfc_dtmf; /* set if HFCmulti card supports dtmf */ | ||
27 | int hfc_loops; /* set if card supports tone loops */ | ||
28 | int hfc_echocanhw; /* set if card supports echocancelation*/ | ||
29 | int pcm_id; /* unique id to identify the pcm bus (or -1) */ | ||
30 | int pcm_slots; /* number of slots on the pcm bus */ | ||
31 | int pcm_banks; /* number of IO banks of pcm bus */ | ||
32 | int unclocked; /* data is not clocked (has jitter/loss) */ | ||
33 | int unordered; /* data is unordered (packets have index) */ | ||
34 | }; | ||
35 | |||
36 | #endif | ||
37 | |||
diff --git a/include/linux/mISDNhw.h b/include/linux/mISDNhw.h new file mode 100644 index 000000000000..e794dfb87504 --- /dev/null +++ b/include/linux/mISDNhw.h | |||
@@ -0,0 +1,193 @@ | |||
1 | /* | ||
2 | * | ||
3 | * Author Karsten Keil <kkeil@novell.com> | ||
4 | * | ||
5 | * Basic declarations for the mISDN HW channels | ||
6 | * | ||
7 | * Copyright 2008 by Karsten Keil <kkeil@novell.com> | ||
8 | * | ||
9 | * This program is free software; you can redistribute it and/or modify | ||
10 | * it under the terms of the GNU General Public License version 2 as | ||
11 | * published by the Free Software Foundation. | ||
12 | * | ||
13 | * This program is distributed in the hope that it will be useful, | ||
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
16 | * GNU General Public License for more details. | ||
17 | * | ||
18 | */ | ||
19 | |||
20 | #ifndef MISDNHW_H | ||
21 | #define MISDNHW_H | ||
22 | #include <linux/mISDNif.h> | ||
23 | #include <linux/timer.h> | ||
24 | |||
25 | /* | ||
26 | * HW DEBUG 0xHHHHGGGG | ||
27 | * H - hardware driver specific bits | ||
28 | * G - for all drivers | ||
29 | */ | ||
30 | |||
31 | #define DEBUG_HW 0x00000001 | ||
32 | #define DEBUG_HW_OPEN 0x00000002 | ||
33 | #define DEBUG_HW_DCHANNEL 0x00000100 | ||
34 | #define DEBUG_HW_DFIFO 0x00000200 | ||
35 | #define DEBUG_HW_BCHANNEL 0x00001000 | ||
36 | #define DEBUG_HW_BFIFO 0x00002000 | ||
37 | |||
38 | #define MAX_DFRAME_LEN_L1 300 | ||
39 | #define MAX_MON_FRAME 32 | ||
40 | #define MAX_LOG_SPACE 2048 | ||
41 | #define MISDN_COPY_SIZE 32 | ||
42 | |||
43 | /* channel->Flags bit field */ | ||
44 | #define FLG_TX_BUSY 0 /* tx_buf in use */ | ||
45 | #define FLG_TX_NEXT 1 /* next_skb in use */ | ||
46 | #define FLG_L1_BUSY 2 /* L1 is permanent busy */ | ||
47 | #define FLG_L2_ACTIVATED 3 /* activated from L2 */ | ||
48 | #define FLG_OPEN 5 /* channel is in use */ | ||
49 | #define FLG_ACTIVE 6 /* channel is activated */ | ||
50 | #define FLG_BUSY_TIMER 7 | ||
51 | /* channel type */ | ||
52 | #define FLG_DCHANNEL 8 /* channel is D-channel */ | ||
53 | #define FLG_BCHANNEL 9 /* channel is B-channel */ | ||
54 | #define FLG_ECHANNEL 10 /* channel is E-channel */ | ||
55 | #define FLG_TRANSPARENT 12 /* channel use transparent data */ | ||
56 | #define FLG_HDLC 13 /* channel use hdlc data */ | ||
57 | #define FLG_L2DATA 14 /* channel use L2 DATA primitivs */ | ||
58 | #define FLG_ORIGIN 15 /* channel is on origin site */ | ||
59 | /* channel specific stuff */ | ||
60 | /* arcofi specific */ | ||
61 | #define FLG_ARCOFI_TIMER 16 | ||
62 | #define FLG_ARCOFI_ERROR 17 | ||
63 | /* isar specific */ | ||
64 | #define FLG_INITIALIZED 16 | ||
65 | #define FLG_DLEETX 17 | ||
66 | #define FLG_LASTDLE 18 | ||
67 | #define FLG_FIRST 19 | ||
68 | #define FLG_LASTDATA 20 | ||
69 | #define FLG_NMD_DATA 21 | ||
70 | #define FLG_FTI_RUN 22 | ||
71 | #define FLG_LL_OK 23 | ||
72 | #define FLG_LL_CONN 24 | ||
73 | #define FLG_DTMFSEND 25 | ||
74 | |||
75 | /* workq events */ | ||
76 | #define FLG_RECVQUEUE 30 | ||
77 | #define FLG_PHCHANGE 31 | ||
78 | |||
79 | #define schedule_event(s, ev) do { \ | ||
80 | test_and_set_bit(ev, &((s)->Flags)); \ | ||
81 | schedule_work(&((s)->workq)); \ | ||
82 | } while (0) | ||
83 | |||
84 | struct dchannel { | ||
85 | struct mISDNdevice dev; | ||
86 | u_long Flags; | ||
87 | struct work_struct workq; | ||
88 | void (*phfunc) (struct dchannel *); | ||
89 | u_int state; | ||
90 | void *l1; | ||
91 | /* HW access */ | ||
92 | u_char (*read_reg) (void *, u_char); | ||
93 | void (*write_reg) (void *, u_char, u_char); | ||
94 | void (*read_fifo) (void *, u_char *, int); | ||
95 | void (*write_fifo) (void *, u_char *, int); | ||
96 | void *hw; | ||
97 | int slot; /* multiport card channel slot */ | ||
98 | struct timer_list timer; | ||
99 | /* receive data */ | ||
100 | struct sk_buff *rx_skb; | ||
101 | int maxlen; | ||
102 | /* send data */ | ||
103 | struct sk_buff_head squeue; | ||
104 | struct sk_buff_head rqueue; | ||
105 | struct sk_buff *tx_skb; | ||
106 | int tx_idx; | ||
107 | int debug; | ||
108 | /* statistics */ | ||
109 | int err_crc; | ||
110 | int err_tx; | ||
111 | int err_rx; | ||
112 | }; | ||
113 | |||
114 | typedef int (dchannel_l1callback)(struct dchannel *, u_int); | ||
115 | extern int create_l1(struct dchannel *, dchannel_l1callback *); | ||
116 | |||
117 | /* private L1 commands */ | ||
118 | #define INFO0 0x8002 | ||
119 | #define INFO1 0x8102 | ||
120 | #define INFO2 0x8202 | ||
121 | #define INFO3_P8 0x8302 | ||
122 | #define INFO3_P10 0x8402 | ||
123 | #define INFO4_P8 0x8502 | ||
124 | #define INFO4_P10 0x8602 | ||
125 | #define LOSTFRAMING 0x8702 | ||
126 | #define ANYSIGNAL 0x8802 | ||
127 | #define HW_POWERDOWN 0x8902 | ||
128 | #define HW_RESET_REQ 0x8a02 | ||
129 | #define HW_POWERUP_REQ 0x8b02 | ||
130 | #define HW_DEACT_REQ 0x8c02 | ||
131 | #define HW_ACTIVATE_REQ 0x8e02 | ||
132 | #define HW_D_NOBLOCKED 0x8f02 | ||
133 | #define HW_RESET_IND 0x9002 | ||
134 | #define HW_POWERUP_IND 0x9102 | ||
135 | #define HW_DEACT_IND 0x9202 | ||
136 | #define HW_ACTIVATE_IND 0x9302 | ||
137 | #define HW_DEACT_CNF 0x9402 | ||
138 | #define HW_TESTLOOP 0x9502 | ||
139 | #define HW_TESTRX_RAW 0x9602 | ||
140 | #define HW_TESTRX_HDLC 0x9702 | ||
141 | #define HW_TESTRX_OFF 0x9802 | ||
142 | |||
143 | struct layer1; | ||
144 | extern int l1_event(struct layer1 *, u_int); | ||
145 | |||
146 | |||
147 | struct bchannel { | ||
148 | struct mISDNchannel ch; | ||
149 | int nr; | ||
150 | u_long Flags; | ||
151 | struct work_struct workq; | ||
152 | u_int state; | ||
153 | /* HW access */ | ||
154 | u_char (*read_reg) (void *, u_char); | ||
155 | void (*write_reg) (void *, u_char, u_char); | ||
156 | void (*read_fifo) (void *, u_char *, int); | ||
157 | void (*write_fifo) (void *, u_char *, int); | ||
158 | void *hw; | ||
159 | int slot; /* multiport card channel slot */ | ||
160 | struct timer_list timer; | ||
161 | /* receive data */ | ||
162 | struct sk_buff *rx_skb; | ||
163 | int maxlen; | ||
164 | /* send data */ | ||
165 | struct sk_buff *next_skb; | ||
166 | struct sk_buff *tx_skb; | ||
167 | struct sk_buff_head rqueue; | ||
168 | int rcount; | ||
169 | int tx_idx; | ||
170 | int debug; | ||
171 | /* statistics */ | ||
172 | int err_crc; | ||
173 | int err_tx; | ||
174 | int err_rx; | ||
175 | }; | ||
176 | |||
177 | extern int mISDN_initdchannel(struct dchannel *, int, void *); | ||
178 | extern int mISDN_initbchannel(struct bchannel *, int); | ||
179 | extern int mISDN_freedchannel(struct dchannel *); | ||
180 | extern int mISDN_freebchannel(struct bchannel *); | ||
181 | extern void queue_ch_frame(struct mISDNchannel *, u_int, | ||
182 | int, struct sk_buff *); | ||
183 | extern int dchannel_senddata(struct dchannel *, struct sk_buff *); | ||
184 | extern int bchannel_senddata(struct bchannel *, struct sk_buff *); | ||
185 | extern void recv_Dchannel(struct dchannel *); | ||
186 | extern void recv_Bchannel(struct bchannel *); | ||
187 | extern void recv_Dchannel_skb(struct dchannel *, struct sk_buff *); | ||
188 | extern void recv_Bchannel_skb(struct bchannel *, struct sk_buff *); | ||
189 | extern void confirm_Bsend(struct bchannel *bch); | ||
190 | extern int get_next_bframe(struct bchannel *); | ||
191 | extern int get_next_dframe(struct dchannel *); | ||
192 | |||
193 | #endif | ||
diff --git a/include/linux/mISDNif.h b/include/linux/mISDNif.h new file mode 100644 index 000000000000..8f2d60da04e7 --- /dev/null +++ b/include/linux/mISDNif.h | |||
@@ -0,0 +1,509 @@ | |||
1 | /* | ||
2 | * | ||
3 | * Author Karsten Keil <kkeil@novell.com> | ||
4 | * | ||
5 | * Copyright 2008 by Karsten Keil <kkeil@novell.com> | ||
6 | * | ||
7 | * This code is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU LESSER GENERAL PUBLIC LICENSE | ||
9 | * version 2.1 as published by the Free Software Foundation. | ||
10 | * | ||
11 | * This code 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 LESSER GENERAL PUBLIC LICENSE for more details. | ||
15 | * | ||
16 | */ | ||
17 | |||
18 | #ifndef mISDNIF_H | ||
19 | #define mISDNIF_H | ||
20 | |||
21 | #include <stdarg.h> | ||
22 | #include <linux/types.h> | ||
23 | #include <linux/errno.h> | ||
24 | #include <linux/socket.h> | ||
25 | |||
26 | /* | ||
27 | * ABI Version 32 bit | ||
28 | * | ||
29 | * <8 bit> Major version | ||
30 | * - changed if any interface become backwards incompatible | ||
31 | * | ||
32 | * <8 bit> Minor version | ||
33 | * - changed if any interface is extended but backwards compatible | ||
34 | * | ||
35 | * <16 bit> Release number | ||
36 | * - should be incremented on every checkin | ||
37 | */ | ||
38 | #define MISDN_MAJOR_VERSION 1 | ||
39 | #define MISDN_MINOR_VERSION 0 | ||
40 | #define MISDN_RELEASE 19 | ||
41 | |||
42 | /* primitives for information exchange | ||
43 | * generell format | ||
44 | * <16 bit 0 > | ||
45 | * <8 bit command> | ||
46 | * BIT 8 = 1 LAYER private | ||
47 | * BIT 7 = 1 answer | ||
48 | * BIT 6 = 1 DATA | ||
49 | * <8 bit target layer mask> | ||
50 | * | ||
51 | * Layer = 00 is reserved for general commands | ||
52 | Layer = 01 L2 -> HW | ||
53 | Layer = 02 HW -> L2 | ||
54 | Layer = 04 L3 -> L2 | ||
55 | Layer = 08 L2 -> L3 | ||
56 | * Layer = FF is reserved for broadcast commands | ||
57 | */ | ||
58 | |||
59 | #define MISDN_CMDMASK 0xff00 | ||
60 | #define MISDN_LAYERMASK 0x00ff | ||
61 | |||
62 | /* generell commands */ | ||
63 | #define OPEN_CHANNEL 0x0100 | ||
64 | #define CLOSE_CHANNEL 0x0200 | ||
65 | #define CONTROL_CHANNEL 0x0300 | ||
66 | #define CHECK_DATA 0x0400 | ||
67 | |||
68 | /* layer 2 -> layer 1 */ | ||
69 | #define PH_ACTIVATE_REQ 0x0101 | ||
70 | #define PH_DEACTIVATE_REQ 0x0201 | ||
71 | #define PH_DATA_REQ 0x2001 | ||
72 | #define MPH_ACTIVATE_REQ 0x0501 | ||
73 | #define MPH_DEACTIVATE_REQ 0x0601 | ||
74 | #define MPH_INFORMATION_REQ 0x0701 | ||
75 | #define PH_CONTROL_REQ 0x0801 | ||
76 | |||
77 | /* layer 1 -> layer 2 */ | ||
78 | #define PH_ACTIVATE_IND 0x0102 | ||
79 | #define PH_ACTIVATE_CNF 0x4102 | ||
80 | #define PH_DEACTIVATE_IND 0x0202 | ||
81 | #define PH_DEACTIVATE_CNF 0x4202 | ||
82 | #define PH_DATA_IND 0x2002 | ||
83 | #define MPH_ACTIVATE_IND 0x0502 | ||
84 | #define MPH_DEACTIVATE_IND 0x0602 | ||
85 | #define MPH_INFORMATION_IND 0x0702 | ||
86 | #define PH_DATA_CNF 0x6002 | ||
87 | #define PH_CONTROL_IND 0x0802 | ||
88 | #define PH_CONTROL_CNF 0x4802 | ||
89 | |||
90 | /* layer 3 -> layer 2 */ | ||
91 | #define DL_ESTABLISH_REQ 0x1004 | ||
92 | #define DL_RELEASE_REQ 0x1104 | ||
93 | #define DL_DATA_REQ 0x3004 | ||
94 | #define DL_UNITDATA_REQ 0x3104 | ||
95 | #define DL_INFORMATION_REQ 0x0004 | ||
96 | |||
97 | /* layer 2 -> layer 3 */ | ||
98 | #define DL_ESTABLISH_IND 0x1008 | ||
99 | #define DL_ESTABLISH_CNF 0x5008 | ||
100 | #define DL_RELEASE_IND 0x1108 | ||
101 | #define DL_RELEASE_CNF 0x5108 | ||
102 | #define DL_DATA_IND 0x3008 | ||
103 | #define DL_UNITDATA_IND 0x3108 | ||
104 | #define DL_INFORMATION_IND 0x0008 | ||
105 | |||
106 | /* intern layer 2 managment */ | ||
107 | #define MDL_ASSIGN_REQ 0x1804 | ||
108 | #define MDL_ASSIGN_IND 0x1904 | ||
109 | #define MDL_REMOVE_REQ 0x1A04 | ||
110 | #define MDL_REMOVE_IND 0x1B04 | ||
111 | #define MDL_STATUS_UP_IND 0x1C04 | ||
112 | #define MDL_STATUS_DOWN_IND 0x1D04 | ||
113 | #define MDL_STATUS_UI_IND 0x1E04 | ||
114 | #define MDL_ERROR_IND 0x1F04 | ||
115 | #define MDL_ERROR_RSP 0x5F04 | ||
116 | |||
117 | /* DL_INFORMATION_IND types */ | ||
118 | #define DL_INFO_L2_CONNECT 0x0001 | ||
119 | #define DL_INFO_L2_REMOVED 0x0002 | ||
120 | |||
121 | /* PH_CONTROL types */ | ||
122 | /* TOUCH TONE IS 0x20XX XX "0"..."9", "A","B","C","D","*","#" */ | ||
123 | #define DTMF_TONE_VAL 0x2000 | ||
124 | #define DTMF_TONE_MASK 0x007F | ||
125 | #define DTMF_TONE_START 0x2100 | ||
126 | #define DTMF_TONE_STOP 0x2200 | ||
127 | #define DTMF_HFC_COEF 0x4000 | ||
128 | #define DSP_CONF_JOIN 0x2403 | ||
129 | #define DSP_CONF_SPLIT 0x2404 | ||
130 | #define DSP_RECEIVE_OFF 0x2405 | ||
131 | #define DSP_RECEIVE_ON 0x2406 | ||
132 | #define DSP_ECHO_ON 0x2407 | ||
133 | #define DSP_ECHO_OFF 0x2408 | ||
134 | #define DSP_MIX_ON 0x2409 | ||
135 | #define DSP_MIX_OFF 0x240a | ||
136 | #define DSP_DELAY 0x240b | ||
137 | #define DSP_JITTER 0x240c | ||
138 | #define DSP_TXDATA_ON 0x240d | ||
139 | #define DSP_TXDATA_OFF 0x240e | ||
140 | #define DSP_TX_DEJITTER 0x240f | ||
141 | #define DSP_TX_DEJ_OFF 0x2410 | ||
142 | #define DSP_TONE_PATT_ON 0x2411 | ||
143 | #define DSP_TONE_PATT_OFF 0x2412 | ||
144 | #define DSP_VOL_CHANGE_TX 0x2413 | ||
145 | #define DSP_VOL_CHANGE_RX 0x2414 | ||
146 | #define DSP_BF_ENABLE_KEY 0x2415 | ||
147 | #define DSP_BF_DISABLE 0x2416 | ||
148 | #define DSP_BF_ACCEPT 0x2416 | ||
149 | #define DSP_BF_REJECT 0x2417 | ||
150 | #define DSP_PIPELINE_CFG 0x2418 | ||
151 | #define HFC_VOL_CHANGE_TX 0x2601 | ||
152 | #define HFC_VOL_CHANGE_RX 0x2602 | ||
153 | #define HFC_SPL_LOOP_ON 0x2603 | ||
154 | #define HFC_SPL_LOOP_OFF 0x2604 | ||
155 | |||
156 | /* DSP_TONE_PATT_ON parameter */ | ||
157 | #define TONE_OFF 0x0000 | ||
158 | #define TONE_GERMAN_DIALTONE 0x0001 | ||
159 | #define TONE_GERMAN_OLDDIALTONE 0x0002 | ||
160 | #define TONE_AMERICAN_DIALTONE 0x0003 | ||
161 | #define TONE_GERMAN_DIALPBX 0x0004 | ||
162 | #define TONE_GERMAN_OLDDIALPBX 0x0005 | ||
163 | #define TONE_AMERICAN_DIALPBX 0x0006 | ||
164 | #define TONE_GERMAN_RINGING 0x0007 | ||
165 | #define TONE_GERMAN_OLDRINGING 0x0008 | ||
166 | #define TONE_AMERICAN_RINGPBX 0x000b | ||
167 | #define TONE_GERMAN_RINGPBX 0x000c | ||
168 | #define TONE_GERMAN_OLDRINGPBX 0x000d | ||
169 | #define TONE_AMERICAN_RINGING 0x000e | ||
170 | #define TONE_GERMAN_BUSY 0x000f | ||
171 | #define TONE_GERMAN_OLDBUSY 0x0010 | ||
172 | #define TONE_AMERICAN_BUSY 0x0011 | ||
173 | #define TONE_GERMAN_HANGUP 0x0012 | ||
174 | #define TONE_GERMAN_OLDHANGUP 0x0013 | ||
175 | #define TONE_AMERICAN_HANGUP 0x0014 | ||
176 | #define TONE_SPECIAL_INFO 0x0015 | ||
177 | #define TONE_GERMAN_GASSENBESETZT 0x0016 | ||
178 | #define TONE_GERMAN_AUFSCHALTTON 0x0016 | ||
179 | |||
180 | /* MPH_INFORMATION_IND */ | ||
181 | #define L1_SIGNAL_LOS_OFF 0x0010 | ||
182 | #define L1_SIGNAL_LOS_ON 0x0011 | ||
183 | #define L1_SIGNAL_AIS_OFF 0x0012 | ||
184 | #define L1_SIGNAL_AIS_ON 0x0013 | ||
185 | #define L1_SIGNAL_RDI_OFF 0x0014 | ||
186 | #define L1_SIGNAL_RDI_ON 0x0015 | ||
187 | #define L1_SIGNAL_SLIP_RX 0x0020 | ||
188 | #define L1_SIGNAL_SLIP_TX 0x0021 | ||
189 | |||
190 | /* | ||
191 | * protocol ids | ||
192 | * D channel 1-31 | ||
193 | * B channel 33 - 63 | ||
194 | */ | ||
195 | |||
196 | #define ISDN_P_NONE 0 | ||
197 | #define ISDN_P_BASE 0 | ||
198 | #define ISDN_P_TE_S0 0x01 | ||
199 | #define ISDN_P_NT_S0 0x02 | ||
200 | #define ISDN_P_TE_E1 0x03 | ||
201 | #define ISDN_P_NT_E1 0x04 | ||
202 | #define ISDN_P_LAPD_TE 0x10 | ||
203 | #define ISDN_P_LAPD_NT 0x11 | ||
204 | |||
205 | #define ISDN_P_B_MASK 0x1f | ||
206 | #define ISDN_P_B_START 0x20 | ||
207 | |||
208 | #define ISDN_P_B_RAW 0x21 | ||
209 | #define ISDN_P_B_HDLC 0x22 | ||
210 | #define ISDN_P_B_X75SLP 0x23 | ||
211 | #define ISDN_P_B_L2DTMF 0x24 | ||
212 | #define ISDN_P_B_L2DSP 0x25 | ||
213 | #define ISDN_P_B_L2DSPHDLC 0x26 | ||
214 | |||
215 | #define OPTION_L2_PMX 1 | ||
216 | #define OPTION_L2_PTP 2 | ||
217 | #define OPTION_L2_FIXEDTEI 3 | ||
218 | #define OPTION_L2_CLEANUP 4 | ||
219 | |||
220 | /* should be in sync with linux/kobject.h:KOBJ_NAME_LEN */ | ||
221 | #define MISDN_MAX_IDLEN 20 | ||
222 | |||
223 | struct mISDNhead { | ||
224 | unsigned int prim; | ||
225 | unsigned int id; | ||
226 | } __attribute__((packed)); | ||
227 | |||
228 | #define MISDN_HEADER_LEN sizeof(struct mISDNhead) | ||
229 | #define MAX_DATA_SIZE 2048 | ||
230 | #define MAX_DATA_MEM (MAX_DATA_SIZE + MISDN_HEADER_LEN) | ||
231 | #define MAX_DFRAME_LEN 260 | ||
232 | |||
233 | #define MISDN_ID_ADDR_MASK 0xFFFF | ||
234 | #define MISDN_ID_TEI_MASK 0xFF00 | ||
235 | #define MISDN_ID_SAPI_MASK 0x00FF | ||
236 | #define MISDN_ID_TEI_ANY 0x7F00 | ||
237 | |||
238 | #define MISDN_ID_ANY 0xFFFF | ||
239 | #define MISDN_ID_NONE 0xFFFE | ||
240 | |||
241 | #define GROUP_TEI 127 | ||
242 | #define TEI_SAPI 63 | ||
243 | #define CTRL_SAPI 0 | ||
244 | |||
245 | #define MISDN_MAX_CHANNEL 127 | ||
246 | #define MISDN_CHMAP_SIZE ((MISDN_MAX_CHANNEL + 1) >> 3) | ||
247 | |||
248 | #define SOL_MISDN 0 | ||
249 | |||
250 | struct sockaddr_mISDN { | ||
251 | sa_family_t family; | ||
252 | unsigned char dev; | ||
253 | unsigned char channel; | ||
254 | unsigned char sapi; | ||
255 | unsigned char tei; | ||
256 | }; | ||
257 | |||
258 | /* timer device ioctl */ | ||
259 | #define IMADDTIMER _IOR('I', 64, int) | ||
260 | #define IMDELTIMER _IOR('I', 65, int) | ||
261 | /* socket ioctls */ | ||
262 | #define IMGETVERSION _IOR('I', 66, int) | ||
263 | #define IMGETCOUNT _IOR('I', 67, int) | ||
264 | #define IMGETDEVINFO _IOR('I', 68, int) | ||
265 | #define IMCTRLREQ _IOR('I', 69, int) | ||
266 | #define IMCLEAR_L2 _IOR('I', 70, int) | ||
267 | |||
268 | struct mISDNversion { | ||
269 | unsigned char major; | ||
270 | unsigned char minor; | ||
271 | unsigned short release; | ||
272 | }; | ||
273 | |||
274 | struct mISDN_devinfo { | ||
275 | u_int id; | ||
276 | u_int Dprotocols; | ||
277 | u_int Bprotocols; | ||
278 | u_int protocol; | ||
279 | u_char channelmap[MISDN_CHMAP_SIZE]; | ||
280 | u_int nrbchan; | ||
281 | char name[MISDN_MAX_IDLEN]; | ||
282 | }; | ||
283 | |||
284 | static inline int | ||
285 | test_channelmap(u_int nr, u_char *map) | ||
286 | { | ||
287 | if (nr <= MISDN_MAX_CHANNEL) | ||
288 | return map[nr >> 3] & (1 << (nr & 7)); | ||
289 | else | ||
290 | return 0; | ||
291 | } | ||
292 | |||
293 | static inline void | ||
294 | set_channelmap(u_int nr, u_char *map) | ||
295 | { | ||
296 | map[nr >> 3] |= (1 << (nr & 7)); | ||
297 | } | ||
298 | |||
299 | static inline void | ||
300 | clear_channelmap(u_int nr, u_char *map) | ||
301 | { | ||
302 | map[nr >> 3] &= ~(1 << (nr & 7)); | ||
303 | } | ||
304 | |||
305 | /* CONTROL_CHANNEL parameters */ | ||
306 | #define MISDN_CTRL_GETOP 0x0000 | ||
307 | #define MISDN_CTRL_LOOP 0x0001 | ||
308 | #define MISDN_CTRL_CONNECT 0x0002 | ||
309 | #define MISDN_CTRL_DISCONNECT 0x0004 | ||
310 | #define MISDN_CTRL_PCMCONNECT 0x0010 | ||
311 | #define MISDN_CTRL_PCMDISCONNECT 0x0020 | ||
312 | #define MISDN_CTRL_SETPEER 0x0040 | ||
313 | #define MISDN_CTRL_UNSETPEER 0x0080 | ||
314 | #define MISDN_CTRL_RX_OFF 0x0100 | ||
315 | #define MISDN_CTRL_HW_FEATURES_OP 0x2000 | ||
316 | #define MISDN_CTRL_HW_FEATURES 0x2001 | ||
317 | #define MISDN_CTRL_HFC_OP 0x4000 | ||
318 | #define MISDN_CTRL_HFC_PCM_CONN 0x4001 | ||
319 | #define MISDN_CTRL_HFC_PCM_DISC 0x4002 | ||
320 | #define MISDN_CTRL_HFC_CONF_JOIN 0x4003 | ||
321 | #define MISDN_CTRL_HFC_CONF_SPLIT 0x4004 | ||
322 | #define MISDN_CTRL_HFC_RECEIVE_OFF 0x4005 | ||
323 | #define MISDN_CTRL_HFC_RECEIVE_ON 0x4006 | ||
324 | #define MISDN_CTRL_HFC_ECHOCAN_ON 0x4007 | ||
325 | #define MISDN_CTRL_HFC_ECHOCAN_OFF 0x4008 | ||
326 | |||
327 | |||
328 | /* socket options */ | ||
329 | #define MISDN_TIME_STAMP 0x0001 | ||
330 | |||
331 | struct mISDN_ctrl_req { | ||
332 | int op; | ||
333 | int channel; | ||
334 | int p1; | ||
335 | int p2; | ||
336 | }; | ||
337 | |||
338 | /* muxer options */ | ||
339 | #define MISDN_OPT_ALL 1 | ||
340 | #define MISDN_OPT_TEIMGR 2 | ||
341 | |||
342 | #ifdef __KERNEL__ | ||
343 | #include <linux/list.h> | ||
344 | #include <linux/skbuff.h> | ||
345 | #include <linux/net.h> | ||
346 | #include <net/sock.h> | ||
347 | #include <linux/completion.h> | ||
348 | |||
349 | #define DEBUG_CORE 0x000000ff | ||
350 | #define DEBUG_CORE_FUNC 0x00000002 | ||
351 | #define DEBUG_SOCKET 0x00000004 | ||
352 | #define DEBUG_MANAGER 0x00000008 | ||
353 | #define DEBUG_SEND_ERR 0x00000010 | ||
354 | #define DEBUG_MSG_THREAD 0x00000020 | ||
355 | #define DEBUG_QUEUE_FUNC 0x00000040 | ||
356 | #define DEBUG_L1 0x0000ff00 | ||
357 | #define DEBUG_L1_FSM 0x00000200 | ||
358 | #define DEBUG_L2 0x00ff0000 | ||
359 | #define DEBUG_L2_FSM 0x00020000 | ||
360 | #define DEBUG_L2_CTRL 0x00040000 | ||
361 | #define DEBUG_L2_RECV 0x00080000 | ||
362 | #define DEBUG_L2_TEI 0x00100000 | ||
363 | #define DEBUG_L2_TEIFSM 0x00200000 | ||
364 | #define DEBUG_TIMER 0x01000000 | ||
365 | |||
366 | #define mISDN_HEAD_P(s) ((struct mISDNhead *)&s->cb[0]) | ||
367 | #define mISDN_HEAD_PRIM(s) (((struct mISDNhead *)&s->cb[0])->prim) | ||
368 | #define mISDN_HEAD_ID(s) (((struct mISDNhead *)&s->cb[0])->id) | ||
369 | |||
370 | /* socket states */ | ||
371 | #define MISDN_OPEN 1 | ||
372 | #define MISDN_BOUND 2 | ||
373 | #define MISDN_CLOSED 3 | ||
374 | |||
375 | struct mISDNchannel; | ||
376 | struct mISDNdevice; | ||
377 | struct mISDNstack; | ||
378 | |||
379 | struct channel_req { | ||
380 | u_int protocol; | ||
381 | struct sockaddr_mISDN adr; | ||
382 | struct mISDNchannel *ch; | ||
383 | }; | ||
384 | |||
385 | typedef int (ctrl_func_t)(struct mISDNchannel *, u_int, void *); | ||
386 | typedef int (send_func_t)(struct mISDNchannel *, struct sk_buff *); | ||
387 | typedef int (create_func_t)(struct channel_req *); | ||
388 | |||
389 | struct Bprotocol { | ||
390 | struct list_head list; | ||
391 | char *name; | ||
392 | u_int Bprotocols; | ||
393 | create_func_t *create; | ||
394 | }; | ||
395 | |||
396 | struct mISDNchannel { | ||
397 | struct list_head list; | ||
398 | u_int protocol; | ||
399 | u_int nr; | ||
400 | u_long opt; | ||
401 | u_int addr; | ||
402 | struct mISDNstack *st; | ||
403 | struct mISDNchannel *peer; | ||
404 | send_func_t *send; | ||
405 | send_func_t *recv; | ||
406 | ctrl_func_t *ctrl; | ||
407 | }; | ||
408 | |||
409 | struct mISDN_sock_list { | ||
410 | struct hlist_head head; | ||
411 | rwlock_t lock; | ||
412 | }; | ||
413 | |||
414 | struct mISDN_sock { | ||
415 | struct sock sk; | ||
416 | struct mISDNchannel ch; | ||
417 | u_int cmask; | ||
418 | struct mISDNdevice *dev; | ||
419 | }; | ||
420 | |||
421 | |||
422 | |||
423 | struct mISDNdevice { | ||
424 | struct mISDNchannel D; | ||
425 | u_int id; | ||
426 | char name[MISDN_MAX_IDLEN]; | ||
427 | u_int Dprotocols; | ||
428 | u_int Bprotocols; | ||
429 | u_int nrbchan; | ||
430 | u_char channelmap[MISDN_CHMAP_SIZE]; | ||
431 | struct list_head bchannels; | ||
432 | struct mISDNchannel *teimgr; | ||
433 | struct device dev; | ||
434 | }; | ||
435 | |||
436 | struct mISDNstack { | ||
437 | u_long status; | ||
438 | struct mISDNdevice *dev; | ||
439 | struct task_struct *thread; | ||
440 | struct completion *notify; | ||
441 | wait_queue_head_t workq; | ||
442 | struct sk_buff_head msgq; | ||
443 | struct list_head layer2; | ||
444 | struct mISDNchannel *layer1; | ||
445 | struct mISDNchannel own; | ||
446 | struct mutex lmutex; /* protect lists */ | ||
447 | struct mISDN_sock_list l1sock; | ||
448 | #ifdef MISDN_MSG_STATS | ||
449 | u_int msg_cnt; | ||
450 | u_int sleep_cnt; | ||
451 | u_int stopped_cnt; | ||
452 | #endif | ||
453 | }; | ||
454 | |||
455 | /* global alloc/queue functions */ | ||
456 | |||
457 | static inline struct sk_buff * | ||
458 | mI_alloc_skb(unsigned int len, gfp_t gfp_mask) | ||
459 | { | ||
460 | struct sk_buff *skb; | ||
461 | |||
462 | skb = alloc_skb(len + MISDN_HEADER_LEN, gfp_mask); | ||
463 | if (likely(skb)) | ||
464 | skb_reserve(skb, MISDN_HEADER_LEN); | ||
465 | return skb; | ||
466 | } | ||
467 | |||
468 | static inline struct sk_buff * | ||
469 | _alloc_mISDN_skb(u_int prim, u_int id, u_int len, void *dp, gfp_t gfp_mask) | ||
470 | { | ||
471 | struct sk_buff *skb = mI_alloc_skb(len, gfp_mask); | ||
472 | struct mISDNhead *hh; | ||
473 | |||
474 | if (!skb) | ||
475 | return NULL; | ||
476 | if (len) | ||
477 | memcpy(skb_put(skb, len), dp, len); | ||
478 | hh = mISDN_HEAD_P(skb); | ||
479 | hh->prim = prim; | ||
480 | hh->id = id; | ||
481 | return skb; | ||
482 | } | ||
483 | |||
484 | static inline void | ||
485 | _queue_data(struct mISDNchannel *ch, u_int prim, | ||
486 | u_int id, u_int len, void *dp, gfp_t gfp_mask) | ||
487 | { | ||
488 | struct sk_buff *skb; | ||
489 | |||
490 | if (!ch->peer) | ||
491 | return; | ||
492 | skb = _alloc_mISDN_skb(prim, id, len, dp, gfp_mask); | ||
493 | if (!skb) | ||
494 | return; | ||
495 | if (ch->recv(ch->peer, skb)) | ||
496 | dev_kfree_skb(skb); | ||
497 | } | ||
498 | |||
499 | /* global register/unregister functions */ | ||
500 | |||
501 | extern int mISDN_register_device(struct mISDNdevice *, char *name); | ||
502 | extern void mISDN_unregister_device(struct mISDNdevice *); | ||
503 | extern int mISDN_register_Bprotocol(struct Bprotocol *); | ||
504 | extern void mISDN_unregister_Bprotocol(struct Bprotocol *); | ||
505 | |||
506 | extern void set_channel_address(struct mISDNchannel *, u_int, u_int); | ||
507 | |||
508 | #endif /* __KERNEL__ */ | ||
509 | #endif /* mISDNIF_H */ | ||
diff --git a/include/linux/magic.h b/include/linux/magic.h index 74e68e201166..a07aa79593b7 100644 --- a/include/linux/magic.h +++ b/include/linux/magic.h | |||
@@ -6,6 +6,10 @@ | |||
6 | #define AFS_SUPER_MAGIC 0x5346414F | 6 | #define AFS_SUPER_MAGIC 0x5346414F |
7 | #define AUTOFS_SUPER_MAGIC 0x0187 | 7 | #define AUTOFS_SUPER_MAGIC 0x0187 |
8 | #define CODA_SUPER_MAGIC 0x73757245 | 8 | #define CODA_SUPER_MAGIC 0x73757245 |
9 | #define DEBUGFS_MAGIC 0x64626720 | ||
10 | #define SYSFS_MAGIC 0x62656572 | ||
11 | #define SECURITYFS_MAGIC 0x73636673 | ||
12 | #define TMPFS_MAGIC 0x01021994 | ||
9 | #define EFS_SUPER_MAGIC 0x414A53 | 13 | #define EFS_SUPER_MAGIC 0x414A53 |
10 | #define EXT2_SUPER_MAGIC 0xEF53 | 14 | #define EXT2_SUPER_MAGIC 0xEF53 |
11 | #define EXT3_SUPER_MAGIC 0xEF53 | 15 | #define EXT3_SUPER_MAGIC 0xEF53 |
diff --git a/include/linux/major.h b/include/linux/major.h index 0cb98053537a..88249452b935 100644 --- a/include/linux/major.h +++ b/include/linux/major.h | |||
@@ -53,7 +53,7 @@ | |||
53 | #define STL_SIOMEMMAJOR 28 | 53 | #define STL_SIOMEMMAJOR 28 |
54 | #define ACSI_MAJOR 28 | 54 | #define ACSI_MAJOR 28 |
55 | #define AZTECH_CDROM_MAJOR 29 | 55 | #define AZTECH_CDROM_MAJOR 29 |
56 | #define GRAPHDEV_MAJOR 29 /* SparcLinux & Linux/68k /dev/fb */ | 56 | #define FB_MAJOR 29 /* /dev/fb* framebuffers */ |
57 | #define CM206_CDROM_MAJOR 32 | 57 | #define CM206_CDROM_MAJOR 32 |
58 | #define IDE2_MAJOR 33 | 58 | #define IDE2_MAJOR 33 |
59 | #define IDE3_MAJOR 34 | 59 | #define IDE3_MAJOR 34 |
@@ -170,4 +170,6 @@ | |||
170 | 170 | ||
171 | #define VIOTAPE_MAJOR 230 | 171 | #define VIOTAPE_MAJOR 230 |
172 | 172 | ||
173 | #define BLOCK_EXT_MAJOR 259 | ||
174 | |||
173 | #endif | 175 | #endif |
diff --git a/include/linux/maple.h b/include/linux/maple.h index d31e36ebb436..c23d3f51ba40 100644 --- a/include/linux/maple.h +++ b/include/linux/maple.h | |||
@@ -2,6 +2,7 @@ | |||
2 | #define __LINUX_MAPLE_H | 2 | #define __LINUX_MAPLE_H |
3 | 3 | ||
4 | #include <linux/device.h> | 4 | #include <linux/device.h> |
5 | #include <mach/maple.h> | ||
5 | 6 | ||
6 | extern struct bus_type maple_bus_type; | 7 | extern struct bus_type maple_bus_type; |
7 | 8 | ||
@@ -33,6 +34,7 @@ struct mapleq { | |||
33 | void *sendbuf, *recvbuf, *recvbufdcsp; | 34 | void *sendbuf, *recvbuf, *recvbufdcsp; |
34 | unsigned char length; | 35 | unsigned char length; |
35 | enum maple_code command; | 36 | enum maple_code command; |
37 | struct mutex mutex; | ||
36 | }; | 38 | }; |
37 | 39 | ||
38 | struct maple_devinfo { | 40 | struct maple_devinfo { |
@@ -49,7 +51,6 @@ struct maple_devinfo { | |||
49 | struct maple_device { | 51 | struct maple_device { |
50 | struct maple_driver *driver; | 52 | struct maple_driver *driver; |
51 | struct mapleq *mq; | 53 | struct mapleq *mq; |
52 | void *private_data; | ||
53 | void (*callback) (struct mapleq * mq); | 54 | void (*callback) (struct mapleq * mq); |
54 | unsigned long when, interval, function; | 55 | unsigned long when, interval, function; |
55 | struct maple_devinfo devinfo; | 56 | struct maple_devinfo devinfo; |
@@ -61,8 +62,6 @@ struct maple_device { | |||
61 | 62 | ||
62 | struct maple_driver { | 63 | struct maple_driver { |
63 | unsigned long function; | 64 | unsigned long function; |
64 | int (*connect) (struct maple_device * dev); | ||
65 | void (*disconnect) (struct maple_device * dev); | ||
66 | struct device_driver drv; | 65 | struct device_driver drv; |
67 | }; | 66 | }; |
68 | 67 | ||
@@ -70,10 +69,17 @@ void maple_getcond_callback(struct maple_device *dev, | |||
70 | void (*callback) (struct mapleq * mq), | 69 | void (*callback) (struct mapleq * mq), |
71 | unsigned long interval, | 70 | unsigned long interval, |
72 | unsigned long function); | 71 | unsigned long function); |
73 | int maple_driver_register(struct device_driver *drv); | 72 | int maple_driver_register(struct maple_driver *); |
74 | void maple_add_packet(struct mapleq *mq); | 73 | void maple_driver_unregister(struct maple_driver *); |
74 | |||
75 | int maple_add_packet_sleeps(struct maple_device *mdev, u32 function, | ||
76 | u32 command, u32 length, void *data); | ||
77 | void maple_clear_dev(struct maple_device *mdev); | ||
75 | 78 | ||
76 | #define to_maple_dev(n) container_of(n, struct maple_device, dev) | 79 | #define to_maple_dev(n) container_of(n, struct maple_device, dev) |
77 | #define to_maple_driver(n) container_of(n, struct maple_driver, drv) | 80 | #define to_maple_driver(n) container_of(n, struct maple_driver, drv) |
78 | 81 | ||
82 | #define maple_get_drvdata(d) dev_get_drvdata(&(d)->dev) | ||
83 | #define maple_set_drvdata(d,p) dev_set_drvdata(&(d)->dev, (p)) | ||
84 | |||
79 | #endif /* __LINUX_MAPLE_H */ | 85 | #endif /* __LINUX_MAPLE_H */ |
diff --git a/include/linux/marker.h b/include/linux/marker.h index 430f6adf9762..1290653f9241 100644 --- a/include/linux/marker.h +++ b/include/linux/marker.h | |||
@@ -44,8 +44,8 @@ struct marker { | |||
44 | */ | 44 | */ |
45 | char state; /* Marker state. */ | 45 | char state; /* Marker state. */ |
46 | char ptype; /* probe type : 0 : single, 1 : multi */ | 46 | char ptype; /* probe type : 0 : single, 1 : multi */ |
47 | void (*call)(const struct marker *mdata, /* Probe wrapper */ | 47 | /* Probe wrapper */ |
48 | void *call_private, const char *fmt, ...); | 48 | void (*call)(const struct marker *mdata, void *call_private, ...); |
49 | struct marker_probe_closure single; | 49 | struct marker_probe_closure single; |
50 | struct marker_probe_closure *multi; | 50 | struct marker_probe_closure *multi; |
51 | } __attribute__((aligned(8))); | 51 | } __attribute__((aligned(8))); |
@@ -58,8 +58,12 @@ struct marker { | |||
58 | * Make sure the alignment of the structure in the __markers section will | 58 | * Make sure the alignment of the structure in the __markers section will |
59 | * not add unwanted padding between the beginning of the section and the | 59 | * not add unwanted padding between the beginning of the section and the |
60 | * structure. Force alignment to the same alignment as the section start. | 60 | * structure. Force alignment to the same alignment as the section start. |
61 | * | ||
62 | * The "generic" argument controls which marker enabling mechanism must be used. | ||
63 | * If generic is true, a variable read is used. | ||
64 | * If generic is false, immediate values are used. | ||
61 | */ | 65 | */ |
62 | #define __trace_mark(name, call_private, format, args...) \ | 66 | #define __trace_mark(generic, name, call_private, format, args...) \ |
63 | do { \ | 67 | do { \ |
64 | static const char __mstrtab_##name[] \ | 68 | static const char __mstrtab_##name[] \ |
65 | __attribute__((section("__markers_strings"))) \ | 69 | __attribute__((section("__markers_strings"))) \ |
@@ -72,15 +76,14 @@ struct marker { | |||
72 | __mark_check_format(format, ## args); \ | 76 | __mark_check_format(format, ## args); \ |
73 | if (unlikely(__mark_##name.state)) { \ | 77 | if (unlikely(__mark_##name.state)) { \ |
74 | (*__mark_##name.call) \ | 78 | (*__mark_##name.call) \ |
75 | (&__mark_##name, call_private, \ | 79 | (&__mark_##name, call_private, ## args);\ |
76 | format, ## args); \ | ||
77 | } \ | 80 | } \ |
78 | } while (0) | 81 | } while (0) |
79 | 82 | ||
80 | extern void marker_update_probe_range(struct marker *begin, | 83 | extern void marker_update_probe_range(struct marker *begin, |
81 | struct marker *end); | 84 | struct marker *end); |
82 | #else /* !CONFIG_MARKERS */ | 85 | #else /* !CONFIG_MARKERS */ |
83 | #define __trace_mark(name, call_private, format, args...) \ | 86 | #define __trace_mark(generic, name, call_private, format, args...) \ |
84 | __mark_check_format(format, ## args) | 87 | __mark_check_format(format, ## args) |
85 | static inline void marker_update_probe_range(struct marker *begin, | 88 | static inline void marker_update_probe_range(struct marker *begin, |
86 | struct marker *end) | 89 | struct marker *end) |
@@ -88,15 +91,30 @@ static inline void marker_update_probe_range(struct marker *begin, | |||
88 | #endif /* CONFIG_MARKERS */ | 91 | #endif /* CONFIG_MARKERS */ |
89 | 92 | ||
90 | /** | 93 | /** |
91 | * trace_mark - Marker | 94 | * trace_mark - Marker using code patching |
92 | * @name: marker name, not quoted. | 95 | * @name: marker name, not quoted. |
93 | * @format: format string | 96 | * @format: format string |
94 | * @args...: variable argument list | 97 | * @args...: variable argument list |
95 | * | 98 | * |
96 | * Places a marker. | 99 | * Places a marker using optimized code patching technique (imv_read()) |
100 | * to be enabled when immediate values are present. | ||
97 | */ | 101 | */ |
98 | #define trace_mark(name, format, args...) \ | 102 | #define trace_mark(name, format, args...) \ |
99 | __trace_mark(name, NULL, format, ## args) | 103 | __trace_mark(0, name, NULL, format, ## args) |
104 | |||
105 | /** | ||
106 | * _trace_mark - Marker using variable read | ||
107 | * @name: marker name, not quoted. | ||
108 | * @format: format string | ||
109 | * @args...: variable argument list | ||
110 | * | ||
111 | * Places a marker using a standard memory read (_imv_read()) to be | ||
112 | * enabled. Should be used for markers in code paths where instruction | ||
113 | * modification based enabling is not welcome. (__init and __exit functions, | ||
114 | * lockdep, some traps, printk). | ||
115 | */ | ||
116 | #define _trace_mark(name, format, args...) \ | ||
117 | __trace_mark(1, name, NULL, format, ## args) | ||
100 | 118 | ||
101 | /** | 119 | /** |
102 | * MARK_NOARGS - Format string for a marker with no argument. | 120 | * MARK_NOARGS - Format string for a marker with no argument. |
@@ -117,9 +135,9 @@ static inline void __printf(1, 2) ___mark_check_format(const char *fmt, ...) | |||
117 | extern marker_probe_func __mark_empty_function; | 135 | extern marker_probe_func __mark_empty_function; |
118 | 136 | ||
119 | extern void marker_probe_cb(const struct marker *mdata, | 137 | extern void marker_probe_cb(const struct marker *mdata, |
120 | void *call_private, const char *fmt, ...); | 138 | void *call_private, ...); |
121 | extern void marker_probe_cb_noarg(const struct marker *mdata, | 139 | extern void marker_probe_cb_noarg(const struct marker *mdata, |
122 | void *call_private, const char *fmt, ...); | 140 | void *call_private, ...); |
123 | 141 | ||
124 | /* | 142 | /* |
125 | * Connect a probe to a marker. | 143 | * Connect a probe to a marker. |
diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h index e6608776bc96..fdf3967e1397 100644 --- a/include/linux/memcontrol.h +++ b/include/linux/memcontrol.h | |||
@@ -35,7 +35,10 @@ extern int mem_cgroup_charge(struct page *page, struct mm_struct *mm, | |||
35 | extern int mem_cgroup_cache_charge(struct page *page, struct mm_struct *mm, | 35 | extern int mem_cgroup_cache_charge(struct page *page, struct mm_struct *mm, |
36 | gfp_t gfp_mask); | 36 | gfp_t gfp_mask); |
37 | extern void mem_cgroup_uncharge_page(struct page *page); | 37 | extern void mem_cgroup_uncharge_page(struct page *page); |
38 | extern void mem_cgroup_uncharge_cache_page(struct page *page); | ||
38 | extern void mem_cgroup_move_lists(struct page *page, bool active); | 39 | extern void mem_cgroup_move_lists(struct page *page, bool active); |
40 | extern int mem_cgroup_shrink_usage(struct mm_struct *mm, gfp_t gfp_mask); | ||
41 | |||
39 | extern unsigned long mem_cgroup_isolate_pages(unsigned long nr_to_scan, | 42 | extern unsigned long mem_cgroup_isolate_pages(unsigned long nr_to_scan, |
40 | struct list_head *dst, | 43 | struct list_head *dst, |
41 | unsigned long *scanned, int order, | 44 | unsigned long *scanned, int order, |
@@ -50,9 +53,9 @@ extern struct mem_cgroup *mem_cgroup_from_task(struct task_struct *p); | |||
50 | #define mm_match_cgroup(mm, cgroup) \ | 53 | #define mm_match_cgroup(mm, cgroup) \ |
51 | ((cgroup) == mem_cgroup_from_task((mm)->owner)) | 54 | ((cgroup) == mem_cgroup_from_task((mm)->owner)) |
52 | 55 | ||
53 | extern int mem_cgroup_prepare_migration(struct page *page); | 56 | extern int |
57 | mem_cgroup_prepare_migration(struct page *page, struct page *newpage); | ||
54 | extern void mem_cgroup_end_migration(struct page *page); | 58 | extern void mem_cgroup_end_migration(struct page *page); |
55 | extern void mem_cgroup_page_migration(struct page *page, struct page *newpage); | ||
56 | 59 | ||
57 | /* | 60 | /* |
58 | * For memory reclaim. | 61 | * For memory reclaim. |
@@ -97,6 +100,15 @@ static inline void mem_cgroup_uncharge_page(struct page *page) | |||
97 | { | 100 | { |
98 | } | 101 | } |
99 | 102 | ||
103 | static inline void mem_cgroup_uncharge_cache_page(struct page *page) | ||
104 | { | ||
105 | } | ||
106 | |||
107 | static inline int mem_cgroup_shrink_usage(struct mm_struct *mm, gfp_t gfp_mask) | ||
108 | { | ||
109 | return 0; | ||
110 | } | ||
111 | |||
100 | static inline void mem_cgroup_move_lists(struct page *page, bool active) | 112 | static inline void mem_cgroup_move_lists(struct page *page, bool active) |
101 | { | 113 | { |
102 | } | 114 | } |
@@ -112,7 +124,8 @@ static inline int task_in_mem_cgroup(struct task_struct *task, | |||
112 | return 1; | 124 | return 1; |
113 | } | 125 | } |
114 | 126 | ||
115 | static inline int mem_cgroup_prepare_migration(struct page *page) | 127 | static inline int |
128 | mem_cgroup_prepare_migration(struct page *page, struct page *newpage) | ||
116 | { | 129 | { |
117 | return 0; | 130 | return 0; |
118 | } | 131 | } |
@@ -121,11 +134,6 @@ static inline void mem_cgroup_end_migration(struct page *page) | |||
121 | { | 134 | { |
122 | } | 135 | } |
123 | 136 | ||
124 | static inline void | ||
125 | mem_cgroup_page_migration(struct page *page, struct page *newpage) | ||
126 | { | ||
127 | } | ||
128 | |||
129 | static inline int mem_cgroup_calc_mapped_ratio(struct mem_cgroup *mem) | 137 | static inline int mem_cgroup_calc_mapped_ratio(struct mem_cgroup *mem) |
130 | { | 138 | { |
131 | return 0; | 139 | return 0; |
diff --git a/include/linux/memory_hotplug.h b/include/linux/memory_hotplug.h index ea9f5ad9ec8e..763ba81fc0f0 100644 --- a/include/linux/memory_hotplug.h +++ b/include/linux/memory_hotplug.h | |||
@@ -13,12 +13,12 @@ struct mem_section; | |||
13 | #ifdef CONFIG_MEMORY_HOTPLUG | 13 | #ifdef CONFIG_MEMORY_HOTPLUG |
14 | 14 | ||
15 | /* | 15 | /* |
16 | * Magic number for free bootmem. | 16 | * Types for free bootmem. |
17 | * The normal smallest mapcount is -1. Here is smaller value than it. | 17 | * The normal smallest mapcount is -1. Here is smaller value than it. |
18 | */ | 18 | */ |
19 | #define SECTION_INFO 0xfffffffe | 19 | #define SECTION_INFO (-1 - 1) |
20 | #define MIX_INFO 0xfffffffd | 20 | #define MIX_SECTION_INFO (-1 - 2) |
21 | #define NODE_INFO 0xfffffffc | 21 | #define NODE_INFO (-1 - 3) |
22 | 22 | ||
23 | /* | 23 | /* |
24 | * pgdat resizing functions | 24 | * pgdat resizing functions |
@@ -199,6 +199,18 @@ extern int walk_memory_resource(unsigned long start_pfn, | |||
199 | unsigned long nr_pages, void *arg, | 199 | unsigned long nr_pages, void *arg, |
200 | int (*func)(unsigned long, unsigned long, void *)); | 200 | int (*func)(unsigned long, unsigned long, void *)); |
201 | 201 | ||
202 | #ifdef CONFIG_MEMORY_HOTREMOVE | ||
203 | |||
204 | extern int is_mem_section_removable(unsigned long pfn, unsigned long nr_pages); | ||
205 | |||
206 | #else | ||
207 | static inline int is_mem_section_removable(unsigned long pfn, | ||
208 | unsigned long nr_pages) | ||
209 | { | ||
210 | return 0; | ||
211 | } | ||
212 | #endif /* CONFIG_MEMORY_HOTREMOVE */ | ||
213 | |||
202 | extern int add_memory(int nid, u64 start, u64 size); | 214 | extern int add_memory(int nid, u64 start, u64 size); |
203 | extern int arch_add_memory(int nid, u64 start, u64 size); | 215 | extern int arch_add_memory(int nid, u64 start, u64 size); |
204 | extern int remove_memory(u64 start, u64 size); | 216 | extern int remove_memory(u64 start, u64 size); |
diff --git a/include/linux/mempolicy.h b/include/linux/mempolicy.h index 3a39570b81b8..085c903fe0f1 100644 --- a/include/linux/mempolicy.h +++ b/include/linux/mempolicy.h | |||
@@ -59,6 +59,7 @@ enum { | |||
59 | #include <linux/rbtree.h> | 59 | #include <linux/rbtree.h> |
60 | #include <linux/spinlock.h> | 60 | #include <linux/spinlock.h> |
61 | #include <linux/nodemask.h> | 61 | #include <linux/nodemask.h> |
62 | #include <linux/pagemap.h> | ||
62 | 63 | ||
63 | struct mm_struct; | 64 | struct mm_struct; |
64 | 65 | ||
@@ -220,6 +221,24 @@ extern int mpol_parse_str(char *str, struct mempolicy **mpol, int no_context); | |||
220 | extern int mpol_to_str(char *buffer, int maxlen, struct mempolicy *pol, | 221 | extern int mpol_to_str(char *buffer, int maxlen, struct mempolicy *pol, |
221 | int no_context); | 222 | int no_context); |
222 | #endif | 223 | #endif |
224 | |||
225 | /* Check if a vma is migratable */ | ||
226 | static inline int vma_migratable(struct vm_area_struct *vma) | ||
227 | { | ||
228 | if (vma->vm_flags & (VM_IO|VM_HUGETLB|VM_PFNMAP|VM_RESERVED)) | ||
229 | return 0; | ||
230 | /* | ||
231 | * Migration allocates pages in the highest zone. If we cannot | ||
232 | * do so then migration (at least from node to node) is not | ||
233 | * possible. | ||
234 | */ | ||
235 | if (vma->vm_file && | ||
236 | gfp_zone(mapping_gfp_mask(vma->vm_file->f_mapping)) | ||
237 | < policy_zone) | ||
238 | return 0; | ||
239 | return 1; | ||
240 | } | ||
241 | |||
223 | #else | 242 | #else |
224 | 243 | ||
225 | struct mempolicy {}; | 244 | struct mempolicy {}; |
diff --git a/include/linux/memstick.h b/include/linux/memstick.h index 37a5cdb03918..d0c37e682234 100644 --- a/include/linux/memstick.h +++ b/include/linux/memstick.h | |||
@@ -21,30 +21,30 @@ | |||
21 | struct ms_status_register { | 21 | struct ms_status_register { |
22 | unsigned char reserved; | 22 | unsigned char reserved; |
23 | unsigned char interrupt; | 23 | unsigned char interrupt; |
24 | #define MEMSTICK_INT_CMDNAK 0x0001 | 24 | #define MEMSTICK_INT_CMDNAK 0x01 |
25 | #define MEMSTICK_INT_IOREQ 0x0008 | 25 | #define MEMSTICK_INT_IOREQ 0x08 |
26 | #define MEMSTICK_INT_IOBREQ 0x0010 | 26 | #define MEMSTICK_INT_IOBREQ 0x10 |
27 | #define MEMSTICK_INT_BREQ 0x0020 | 27 | #define MEMSTICK_INT_BREQ 0x20 |
28 | #define MEMSTICK_INT_ERR 0x0040 | 28 | #define MEMSTICK_INT_ERR 0x40 |
29 | #define MEMSTICK_INT_CED 0x0080 | 29 | #define MEMSTICK_INT_CED 0x80 |
30 | 30 | ||
31 | unsigned char status0; | 31 | unsigned char status0; |
32 | #define MEMSTICK_STATUS0_WP 0x0001 | 32 | #define MEMSTICK_STATUS0_WP 0x01 |
33 | #define MEMSTICK_STATUS0_SL 0x0002 | 33 | #define MEMSTICK_STATUS0_SL 0x02 |
34 | #define MEMSTICK_STATUS0_BF 0x0010 | 34 | #define MEMSTICK_STATUS0_BF 0x10 |
35 | #define MEMSTICK_STATUS0_BE 0x0020 | 35 | #define MEMSTICK_STATUS0_BE 0x20 |
36 | #define MEMSTICK_STATUS0_FB0 0x0040 | 36 | #define MEMSTICK_STATUS0_FB0 0x40 |
37 | #define MEMSTICK_STATUS0_MB 0x0080 | 37 | #define MEMSTICK_STATUS0_MB 0x80 |
38 | 38 | ||
39 | unsigned char status1; | 39 | unsigned char status1; |
40 | #define MEMSTICK_STATUS1_UCFG 0x0001 | 40 | #define MEMSTICK_STATUS1_UCFG 0x01 |
41 | #define MEMSTICK_STATUS1_FGER 0x0002 | 41 | #define MEMSTICK_STATUS1_FGER 0x02 |
42 | #define MEMSTICK_STATUS1_UCEX 0x0004 | 42 | #define MEMSTICK_STATUS1_UCEX 0x04 |
43 | #define MEMSTICK_STATUS1_EXER 0x0008 | 43 | #define MEMSTICK_STATUS1_EXER 0x08 |
44 | #define MEMSTICK_STATUS1_UCDT 0x0010 | 44 | #define MEMSTICK_STATUS1_UCDT 0x10 |
45 | #define MEMSTICK_STATUS1_DTER 0x0020 | 45 | #define MEMSTICK_STATUS1_DTER 0x20 |
46 | #define MEMSTICK_STATUS1_FBI 0x0040 | 46 | #define MEMSTICK_STATUS1_FB1 0x40 |
47 | #define MEMSTICK_STATUS1_MB 0x0080 | 47 | #define MEMSTICK_STATUS1_MB 0x80 |
48 | } __attribute__((packed)); | 48 | } __attribute__((packed)); |
49 | 49 | ||
50 | struct ms_id_register { | 50 | struct ms_id_register { |
@@ -56,32 +56,32 @@ struct ms_id_register { | |||
56 | 56 | ||
57 | struct ms_param_register { | 57 | struct ms_param_register { |
58 | unsigned char system; | 58 | unsigned char system; |
59 | #define MEMSTICK_SYS_ATEN 0xc0 | ||
60 | #define MEMSTICK_SYS_BAMD 0x80 | ||
61 | #define MEMSTICK_SYS_PAM 0x08 | 59 | #define MEMSTICK_SYS_PAM 0x08 |
60 | #define MEMSTICK_SYS_BAMD 0x80 | ||
62 | 61 | ||
63 | unsigned char block_address_msb; | 62 | unsigned char block_address_msb; |
64 | unsigned short block_address; | 63 | unsigned short block_address; |
65 | unsigned char cp; | 64 | unsigned char cp; |
66 | #define MEMSTICK_CP_BLOCK 0x0000 | 65 | #define MEMSTICK_CP_BLOCK 0x00 |
67 | #define MEMSTICK_CP_PAGE 0x0020 | 66 | #define MEMSTICK_CP_PAGE 0x20 |
68 | #define MEMSTICK_CP_EXTRA 0x0040 | 67 | #define MEMSTICK_CP_EXTRA 0x40 |
69 | #define MEMSTICK_CP_OVERWRITE 0x0080 | 68 | #define MEMSTICK_CP_OVERWRITE 0x80 |
70 | 69 | ||
71 | unsigned char page_address; | 70 | unsigned char page_address; |
72 | } __attribute__((packed)); | 71 | } __attribute__((packed)); |
73 | 72 | ||
74 | struct ms_extra_data_register { | 73 | struct ms_extra_data_register { |
75 | unsigned char overwrite_flag; | 74 | unsigned char overwrite_flag; |
76 | #define MEMSTICK_OVERWRITE_UPDATA 0x0010 | 75 | #define MEMSTICK_OVERWRITE_UDST 0x10 |
77 | #define MEMSTICK_OVERWRITE_PAGE 0x0060 | 76 | #define MEMSTICK_OVERWRITE_PGST1 0x20 |
78 | #define MEMSTICK_OVERWRITE_BLOCK 0x0080 | 77 | #define MEMSTICK_OVERWRITE_PGST0 0x40 |
78 | #define MEMSTICK_OVERWRITE_BKST 0x80 | ||
79 | 79 | ||
80 | unsigned char management_flag; | 80 | unsigned char management_flag; |
81 | #define MEMSTICK_MANAGEMENT_SYSTEM 0x0004 | 81 | #define MEMSTICK_MANAGEMENT_SYSFLG 0x04 |
82 | #define MEMSTICK_MANAGEMENT_TRANS_TABLE 0x0008 | 82 | #define MEMSTICK_MANAGEMENT_ATFLG 0x08 |
83 | #define MEMSTICK_MANAGEMENT_COPY 0x0010 | 83 | #define MEMSTICK_MANAGEMENT_SCMS1 0x10 |
84 | #define MEMSTICK_MANAGEMENT_ACCESS 0x0020 | 84 | #define MEMSTICK_MANAGEMENT_SCMS0 0x20 |
85 | 85 | ||
86 | unsigned short logical_address; | 86 | unsigned short logical_address; |
87 | } __attribute__((packed)); | 87 | } __attribute__((packed)); |
@@ -96,9 +96,9 @@ struct ms_register { | |||
96 | 96 | ||
97 | struct mspro_param_register { | 97 | struct mspro_param_register { |
98 | unsigned char system; | 98 | unsigned char system; |
99 | #define MEMSTICK_SYS_SERIAL 0x80 | ||
100 | #define MEMSTICK_SYS_PAR4 0x00 | 99 | #define MEMSTICK_SYS_PAR4 0x00 |
101 | #define MEMSTICK_SYS_PAR8 0x40 | 100 | #define MEMSTICK_SYS_PAR8 0x40 |
101 | #define MEMSTICK_SYS_SERIAL 0x80 | ||
102 | 102 | ||
103 | unsigned short data_count; | 103 | unsigned short data_count; |
104 | unsigned int data_address; | 104 | unsigned int data_address; |
@@ -147,7 +147,7 @@ struct ms_register_addr { | |||
147 | unsigned char w_length; | 147 | unsigned char w_length; |
148 | } __attribute__((packed)); | 148 | } __attribute__((packed)); |
149 | 149 | ||
150 | enum { | 150 | enum memstick_tpc { |
151 | MS_TPC_READ_MG_STATUS = 0x01, | 151 | MS_TPC_READ_MG_STATUS = 0x01, |
152 | MS_TPC_READ_LONG_DATA = 0x02, | 152 | MS_TPC_READ_LONG_DATA = 0x02, |
153 | MS_TPC_READ_SHORT_DATA = 0x03, | 153 | MS_TPC_READ_SHORT_DATA = 0x03, |
@@ -167,7 +167,7 @@ enum { | |||
167 | MS_TPC_SET_CMD = 0x0e | 167 | MS_TPC_SET_CMD = 0x0e |
168 | }; | 168 | }; |
169 | 169 | ||
170 | enum { | 170 | enum memstick_command { |
171 | MS_CMD_BLOCK_END = 0x33, | 171 | MS_CMD_BLOCK_END = 0x33, |
172 | MS_CMD_RESET = 0x3c, | 172 | MS_CMD_RESET = 0x3c, |
173 | MS_CMD_BLOCK_WRITE = 0x55, | 173 | MS_CMD_BLOCK_WRITE = 0x55, |
@@ -201,8 +201,6 @@ enum { | |||
201 | 201 | ||
202 | /*** Driver structures and functions ***/ | 202 | /*** Driver structures and functions ***/ |
203 | 203 | ||
204 | #define MEMSTICK_PART_SHIFT 3 | ||
205 | |||
206 | enum memstick_param { MEMSTICK_POWER = 1, MEMSTICK_INTERFACE }; | 204 | enum memstick_param { MEMSTICK_POWER = 1, MEMSTICK_INTERFACE }; |
207 | 205 | ||
208 | #define MEMSTICK_POWER_OFF 0 | 206 | #define MEMSTICK_POWER_OFF 0 |
@@ -215,24 +213,27 @@ enum memstick_param { MEMSTICK_POWER = 1, MEMSTICK_INTERFACE }; | |||
215 | struct memstick_host; | 213 | struct memstick_host; |
216 | struct memstick_driver; | 214 | struct memstick_driver; |
217 | 215 | ||
216 | struct memstick_device_id { | ||
217 | unsigned char match_flags; | ||
218 | #define MEMSTICK_MATCH_ALL 0x01 | 218 | #define MEMSTICK_MATCH_ALL 0x01 |
219 | 219 | ||
220 | unsigned char type; | ||
220 | #define MEMSTICK_TYPE_LEGACY 0xff | 221 | #define MEMSTICK_TYPE_LEGACY 0xff |
221 | #define MEMSTICK_TYPE_DUO 0x00 | 222 | #define MEMSTICK_TYPE_DUO 0x00 |
222 | #define MEMSTICK_TYPE_PRO 0x01 | 223 | #define MEMSTICK_TYPE_PRO 0x01 |
223 | 224 | ||
225 | unsigned char category; | ||
224 | #define MEMSTICK_CATEGORY_STORAGE 0xff | 226 | #define MEMSTICK_CATEGORY_STORAGE 0xff |
225 | #define MEMSTICK_CATEGORY_STORAGE_DUO 0x00 | 227 | #define MEMSTICK_CATEGORY_STORAGE_DUO 0x00 |
228 | #define MEMSTICK_CATEGORY_IO 0x01 | ||
229 | #define MEMSTICK_CATEGORY_IO_PRO 0x10 | ||
226 | 230 | ||
227 | #define MEMSTICK_CLASS_GENERIC 0xff | ||
228 | #define MEMSTICK_CLASS_GENERIC_DUO 0x00 | ||
229 | |||
230 | |||
231 | struct memstick_device_id { | ||
232 | unsigned char match_flags; | ||
233 | unsigned char type; | ||
234 | unsigned char category; | ||
235 | unsigned char class; | 231 | unsigned char class; |
232 | #define MEMSTICK_CLASS_FLASH 0xff | ||
233 | #define MEMSTICK_CLASS_DUO 0x00 | ||
234 | #define MEMSTICK_CLASS_ROM 0x01 | ||
235 | #define MEMSTICK_CLASS_RO 0x02 | ||
236 | #define MEMSTICK_CLASS_WP 0x03 | ||
236 | }; | 237 | }; |
237 | 238 | ||
238 | struct memstick_request { | 239 | struct memstick_request { |
@@ -263,6 +264,10 @@ struct memstick_dev { | |||
263 | /* Get next request from the media driver. */ | 264 | /* Get next request from the media driver. */ |
264 | int (*next_request)(struct memstick_dev *card, | 265 | int (*next_request)(struct memstick_dev *card, |
265 | struct memstick_request **mrq); | 266 | struct memstick_request **mrq); |
267 | /* Tell the media driver to stop doing things */ | ||
268 | void (*stop)(struct memstick_dev *card); | ||
269 | /* Allow the media driver to continue */ | ||
270 | void (*start)(struct memstick_dev *card); | ||
266 | 271 | ||
267 | struct device dev; | 272 | struct device dev; |
268 | }; | 273 | }; |
@@ -284,7 +289,7 @@ struct memstick_host { | |||
284 | /* Notify the host that some requests are pending. */ | 289 | /* Notify the host that some requests are pending. */ |
285 | void (*request)(struct memstick_host *host); | 290 | void (*request)(struct memstick_host *host); |
286 | /* Set host IO parameters (power, clock, etc). */ | 291 | /* Set host IO parameters (power, clock, etc). */ |
287 | void (*set_param)(struct memstick_host *host, | 292 | int (*set_param)(struct memstick_host *host, |
288 | enum memstick_param param, | 293 | enum memstick_param param, |
289 | int value); | 294 | int value); |
290 | unsigned long private[0] ____cacheline_aligned; | 295 | unsigned long private[0] ____cacheline_aligned; |
@@ -315,9 +320,9 @@ void memstick_suspend_host(struct memstick_host *host); | |||
315 | void memstick_resume_host(struct memstick_host *host); | 320 | void memstick_resume_host(struct memstick_host *host); |
316 | 321 | ||
317 | void memstick_init_req_sg(struct memstick_request *mrq, unsigned char tpc, | 322 | void memstick_init_req_sg(struct memstick_request *mrq, unsigned char tpc, |
318 | struct scatterlist *sg); | 323 | const struct scatterlist *sg); |
319 | void memstick_init_req(struct memstick_request *mrq, unsigned char tpc, | 324 | void memstick_init_req(struct memstick_request *mrq, unsigned char tpc, |
320 | void *buf, size_t length); | 325 | const void *buf, size_t length); |
321 | int memstick_next_req(struct memstick_host *host, | 326 | int memstick_next_req(struct memstick_host *host, |
322 | struct memstick_request **mrq); | 327 | struct memstick_request **mrq); |
323 | void memstick_new_req(struct memstick_host *host); | 328 | void memstick_new_req(struct memstick_host *host); |
diff --git a/include/linux/mfd/asic3.h b/include/linux/mfd/asic3.h index 4ab2162db13b..322cd6deb9f0 100644 --- a/include/linux/mfd/asic3.h +++ b/include/linux/mfd/asic3.h | |||
@@ -8,7 +8,7 @@ | |||
8 | * published by the Free Software Foundation. | 8 | * published by the Free Software Foundation. |
9 | * | 9 | * |
10 | * Copyright 2001 Compaq Computer Corporation. | 10 | * Copyright 2001 Compaq Computer Corporation. |
11 | * Copyright 2007 OpendHand. | 11 | * Copyright 2007-2008 OpenedHand Ltd. |
12 | */ | 12 | */ |
13 | 13 | ||
14 | #ifndef __ASIC3_H__ | 14 | #ifndef __ASIC3_H__ |
@@ -16,43 +16,22 @@ | |||
16 | 16 | ||
17 | #include <linux/types.h> | 17 | #include <linux/types.h> |
18 | 18 | ||
19 | struct asic3 { | ||
20 | void __iomem *mapping; | ||
21 | unsigned int bus_shift; | ||
22 | unsigned int irq_nr; | ||
23 | unsigned int irq_base; | ||
24 | spinlock_t lock; | ||
25 | u16 irq_bothedge[4]; | ||
26 | struct device *dev; | ||
27 | }; | ||
28 | |||
29 | struct asic3_platform_data { | 19 | struct asic3_platform_data { |
30 | struct { | 20 | u16 *gpio_config; |
31 | u32 dir; | 21 | unsigned int gpio_config_num; |
32 | u32 init; | ||
33 | u32 sleep_mask; | ||
34 | u32 sleep_out; | ||
35 | u32 batt_fault_out; | ||
36 | u32 sleep_conf; | ||
37 | u32 alt_function; | ||
38 | } gpio_a, gpio_b, gpio_c, gpio_d; | ||
39 | |||
40 | unsigned int bus_shift; | ||
41 | 22 | ||
42 | unsigned int irq_base; | 23 | unsigned int irq_base; |
43 | 24 | ||
44 | struct platform_device **children; | 25 | unsigned int gpio_base; |
45 | unsigned int n_children; | ||
46 | }; | 26 | }; |
47 | 27 | ||
48 | int asic3_gpio_get_value(struct asic3 *asic, unsigned gpio); | ||
49 | void asic3_gpio_set_value(struct asic3 *asic, unsigned gpio, int val); | ||
50 | |||
51 | #define ASIC3_NUM_GPIO_BANKS 4 | 28 | #define ASIC3_NUM_GPIO_BANKS 4 |
52 | #define ASIC3_GPIOS_PER_BANK 16 | 29 | #define ASIC3_GPIOS_PER_BANK 16 |
53 | #define ASIC3_NUM_GPIOS 64 | 30 | #define ASIC3_NUM_GPIOS 64 |
54 | #define ASIC3_NR_IRQS ASIC3_NUM_GPIOS + 6 | 31 | #define ASIC3_NR_IRQS ASIC3_NUM_GPIOS + 6 |
55 | 32 | ||
33 | #define ASIC3_TO_GPIO(gpio) (NR_BUILTIN_GPIO + (gpio)) | ||
34 | |||
56 | #define ASIC3_GPIO_BANK_A 0 | 35 | #define ASIC3_GPIO_BANK_A 0 |
57 | #define ASIC3_GPIO_BANK_B 1 | 36 | #define ASIC3_GPIO_BANK_B 1 |
58 | #define ASIC3_GPIO_BANK_C 2 | 37 | #define ASIC3_GPIO_BANK_C 2 |
@@ -64,32 +43,89 @@ void asic3_gpio_set_value(struct asic3 *asic, unsigned gpio, int val); | |||
64 | /* All offsets below are specified with this address bus shift */ | 43 | /* All offsets below are specified with this address bus shift */ |
65 | #define ASIC3_DEFAULT_ADDR_SHIFT 2 | 44 | #define ASIC3_DEFAULT_ADDR_SHIFT 2 |
66 | 45 | ||
67 | #define ASIC3_OFFSET(base, reg) (ASIC3_##base##_Base + ASIC3_##base##_##reg) | 46 | #define ASIC3_OFFSET(base, reg) (ASIC3_##base##_BASE + ASIC3_##base##_##reg) |
68 | #define ASIC3_GPIO_OFFSET(base, reg) \ | 47 | #define ASIC3_GPIO_OFFSET(base, reg) \ |
69 | (ASIC3_GPIO_##base##_Base + ASIC3_GPIO_##reg) | 48 | (ASIC3_GPIO_##base##_BASE + ASIC3_GPIO_##reg) |
70 | 49 | ||
71 | #define ASIC3_GPIO_A_Base 0x0000 | 50 | #define ASIC3_GPIO_A_BASE 0x0000 |
72 | #define ASIC3_GPIO_B_Base 0x0100 | 51 | #define ASIC3_GPIO_B_BASE 0x0100 |
73 | #define ASIC3_GPIO_C_Base 0x0200 | 52 | #define ASIC3_GPIO_C_BASE 0x0200 |
74 | #define ASIC3_GPIO_D_Base 0x0300 | 53 | #define ASIC3_GPIO_D_BASE 0x0300 |
75 | 54 | ||
76 | #define ASIC3_GPIO_Mask 0x00 /* R/W 0:don't mask */ | 55 | #define ASIC3_GPIO_TO_BANK(gpio) ((gpio) >> 4) |
77 | #define ASIC3_GPIO_Direction 0x04 /* R/W 0:input */ | 56 | #define ASIC3_GPIO_TO_BIT(gpio) ((gpio) - \ |
78 | #define ASIC3_GPIO_Out 0x08 /* R/W 0:output low */ | 57 | (ASIC3_GPIOS_PER_BANK * ((gpio) >> 4))) |
79 | #define ASIC3_GPIO_TriggerType 0x0c /* R/W 0:level */ | 58 | #define ASIC3_GPIO_TO_MASK(gpio) (1 << ASIC3_GPIO_TO_BIT(gpio)) |
80 | #define ASIC3_GPIO_EdgeTrigger 0x10 /* R/W 0:falling */ | 59 | #define ASIC3_GPIO_TO_BASE(gpio) (ASIC3_GPIO_A_BASE + (((gpio) >> 4) * 0x0100)) |
81 | #define ASIC3_GPIO_LevelTrigger 0x14 /* R/W 0:low level detect */ | 60 | #define ASIC3_BANK_TO_BASE(bank) (ASIC3_GPIO_A_BASE + ((bank) * 0x100)) |
82 | #define ASIC3_GPIO_SleepMask 0x18 /* R/W 0:don't mask in sleep mode */ | 61 | |
83 | #define ASIC3_GPIO_SleepOut 0x1c /* R/W level 0:low in sleep mode */ | 62 | #define ASIC3_GPIO_MASK 0x00 /* R/W 0:don't mask */ |
84 | #define ASIC3_GPIO_BattFaultOut 0x20 /* R/W level 0:low in batt_fault */ | 63 | #define ASIC3_GPIO_DIRECTION 0x04 /* R/W 0:input */ |
85 | #define ASIC3_GPIO_IntStatus 0x24 /* R/W 0:none, 1:detect */ | 64 | #define ASIC3_GPIO_OUT 0x08 /* R/W 0:output low */ |
86 | #define ASIC3_GPIO_AltFunction 0x28 /* R/W 1:LED register control */ | 65 | #define ASIC3_GPIO_TRIGGER_TYPE 0x0c /* R/W 0:level */ |
87 | #define ASIC3_GPIO_SleepConf 0x2c /* | 66 | #define ASIC3_GPIO_EDGE_TRIGGER 0x10 /* R/W 0:falling */ |
67 | #define ASIC3_GPIO_LEVEL_TRIGGER 0x14 /* R/W 0:low level detect */ | ||
68 | #define ASIC3_GPIO_SLEEP_MASK 0x18 /* R/W 0:don't mask in sleep mode */ | ||
69 | #define ASIC3_GPIO_SLEEP_OUT 0x1c /* R/W level 0:low in sleep mode */ | ||
70 | #define ASIC3_GPIO_BAT_FAULT_OUT 0x20 /* R/W level 0:low in batt_fault */ | ||
71 | #define ASIC3_GPIO_INT_STATUS 0x24 /* R/W 0:none, 1:detect */ | ||
72 | #define ASIC3_GPIO_ALT_FUNCTION 0x28 /* R/W 1:LED register control */ | ||
73 | #define ASIC3_GPIO_SLEEP_CONF 0x2c /* | ||
88 | * R/W bit 1: autosleep | 74 | * R/W bit 1: autosleep |
89 | * 0: disable gposlpout in normal mode, | 75 | * 0: disable gposlpout in normal mode, |
90 | * enable gposlpout in sleep mode. | 76 | * enable gposlpout in sleep mode. |
91 | */ | 77 | */ |
92 | #define ASIC3_GPIO_Status 0x30 /* R Pin status */ | 78 | #define ASIC3_GPIO_STATUS 0x30 /* R Pin status */ |
79 | |||
80 | /* | ||
81 | * ASIC3 GPIO config | ||
82 | * | ||
83 | * Bits 0..6 gpio number | ||
84 | * Bits 7..13 Alternate function | ||
85 | * Bit 14 Direction | ||
86 | * Bit 15 Initial value | ||
87 | * | ||
88 | */ | ||
89 | #define ASIC3_CONFIG_GPIO_PIN(config) ((config) & 0x7f) | ||
90 | #define ASIC3_CONFIG_GPIO_ALT(config) (((config) & (0x7f << 7)) >> 7) | ||
91 | #define ASIC3_CONFIG_GPIO_DIR(config) ((config & (1 << 14)) >> 14) | ||
92 | #define ASIC3_CONFIG_GPIO_INIT(config) ((config & (1 << 15)) >> 15) | ||
93 | #define ASIC3_CONFIG_GPIO(gpio, alt, dir, init) (((gpio) & 0x7f) \ | ||
94 | | (((alt) & 0x7f) << 7) | (((dir) & 0x1) << 14) \ | ||
95 | | (((init) & 0x1) << 15)) | ||
96 | #define ASIC3_CONFIG_GPIO_DEFAULT(gpio, dir, init) \ | ||
97 | ASIC3_CONFIG_GPIO((gpio), 0, (dir), (init)) | ||
98 | #define ASIC3_CONFIG_GPIO_DEFAULT_OUT(gpio, init) \ | ||
99 | ASIC3_CONFIG_GPIO((gpio), 0, 1, (init)) | ||
100 | |||
101 | /* | ||
102 | * Alternate functions | ||
103 | */ | ||
104 | #define ASIC3_GPIOA11_PWM0 ASIC3_CONFIG_GPIO(11, 1, 1, 0) | ||
105 | #define ASIC3_GPIOA12_PWM1 ASIC3_CONFIG_GPIO(12, 1, 1, 0) | ||
106 | #define ASIC3_GPIOA15_CONTROL_CX ASIC3_CONFIG_GPIO(15, 1, 1, 0) | ||
107 | #define ASIC3_GPIOC0_LED0 ASIC3_CONFIG_GPIO(32, 1, 1, 0) | ||
108 | #define ASIC3_GPIOC1_LED1 ASIC3_CONFIG_GPIO(33, 1, 1, 0) | ||
109 | #define ASIC3_GPIOC2_LED2 ASIC3_CONFIG_GPIO(34, 1, 1, 0) | ||
110 | #define ASIC3_GPIOC3_SPI_RXD ASIC3_CONFIG_GPIO(35, 1, 0, 0) | ||
111 | #define ASIC3_GPIOC4_CF_nCD ASIC3_CONFIG_GPIO(36, 1, 0, 0) | ||
112 | #define ASIC3_GPIOC4_SPI_TXD ASIC3_CONFIG_GPIO(36, 1, 1, 0) | ||
113 | #define ASIC3_GPIOC5_SPI_CLK ASIC3_CONFIG_GPIO(37, 1, 1, 0) | ||
114 | #define ASIC3_GPIOC5_nCIOW ASIC3_CONFIG_GPIO(37, 1, 1, 0) | ||
115 | #define ASIC3_GPIOC6_nCIOR ASIC3_CONFIG_GPIO(38, 1, 1, 0) | ||
116 | #define ASIC3_GPIOC7_nPCE_1 ASIC3_CONFIG_GPIO(39, 1, 0, 0) | ||
117 | #define ASIC3_GPIOC8_nPCE_2 ASIC3_CONFIG_GPIO(40, 1, 0, 0) | ||
118 | #define ASIC3_GPIOC9_nPOE ASIC3_CONFIG_GPIO(41, 1, 0, 0) | ||
119 | #define ASIC3_GPIOC10_nPWE ASIC3_CONFIG_GPIO(42, 1, 0, 0) | ||
120 | #define ASIC3_GPIOC11_PSKTSEL ASIC3_CONFIG_GPIO(43, 1, 0, 0) | ||
121 | #define ASIC3_GPIOC12_nPREG ASIC3_CONFIG_GPIO(44, 1, 0, 0) | ||
122 | #define ASIC3_GPIOC13_nPWAIT ASIC3_CONFIG_GPIO(45, 1, 1, 0) | ||
123 | #define ASIC3_GPIOC14_nPIOIS16 ASIC3_CONFIG_GPIO(46, 1, 1, 0) | ||
124 | #define ASIC3_GPIOC15_nPIOR ASIC3_CONFIG_GPIO(47, 1, 0, 0) | ||
125 | #define ASIC3_GPIOD11_nCIOIS16 ASIC3_CONFIG_GPIO(59, 1, 0, 0) | ||
126 | #define ASIC3_GPIOD12_nCWAIT ASIC3_CONFIG_GPIO(60, 1, 0, 0) | ||
127 | #define ASIC3_GPIOD15_nPIOW ASIC3_CONFIG_GPIO(63, 1, 0, 0) | ||
128 | |||
93 | 129 | ||
94 | #define ASIC3_SPI_Base 0x0400 | 130 | #define ASIC3_SPI_Base 0x0400 |
95 | #define ASIC3_SPI_Control 0x0000 | 131 | #define ASIC3_SPI_Control 0x0000 |
@@ -128,7 +164,7 @@ void asic3_gpio_set_value(struct asic3 *asic, unsigned gpio, int val); | |||
128 | #define LED_AUTOSTOP (1 << 5) /* LED ON/OFF auto stop 0:disable, 1:enable */ | 164 | #define LED_AUTOSTOP (1 << 5) /* LED ON/OFF auto stop 0:disable, 1:enable */ |
129 | #define LED_ALWAYS (1 << 6) /* LED Interrupt Mask 0:No mask, 1:mask */ | 165 | #define LED_ALWAYS (1 << 6) /* LED Interrupt Mask 0:No mask, 1:mask */ |
130 | 166 | ||
131 | #define ASIC3_CLOCK_Base 0x0A00 | 167 | #define ASIC3_CLOCK_BASE 0x0A00 |
132 | #define ASIC3_CLOCK_CDEX 0x00 | 168 | #define ASIC3_CLOCK_CDEX 0x00 |
133 | #define ASIC3_CLOCK_SEL 0x04 | 169 | #define ASIC3_CLOCK_SEL 0x04 |
134 | 170 | ||
@@ -159,12 +195,12 @@ void asic3_gpio_set_value(struct asic3 *asic, unsigned gpio, int val); | |||
159 | #define CLOCK_SEL_CX (1 << 2) | 195 | #define CLOCK_SEL_CX (1 << 2) |
160 | 196 | ||
161 | 197 | ||
162 | #define ASIC3_INTR_Base 0x0B00 | 198 | #define ASIC3_INTR_BASE 0x0B00 |
163 | 199 | ||
164 | #define ASIC3_INTR_IntMask 0x00 /* Interrupt mask control */ | 200 | #define ASIC3_INTR_INT_MASK 0x00 /* Interrupt mask control */ |
165 | #define ASIC3_INTR_PIntStat 0x04 /* Peripheral interrupt status */ | 201 | #define ASIC3_INTR_P_INT_STAT 0x04 /* Peripheral interrupt status */ |
166 | #define ASIC3_INTR_IntCPS 0x08 /* Interrupt timer clock pre-scale */ | 202 | #define ASIC3_INTR_INT_CPS 0x08 /* Interrupt timer clock pre-scale */ |
167 | #define ASIC3_INTR_IntTBS 0x0c /* Interrupt timer set */ | 203 | #define ASIC3_INTR_INT_TBS 0x0c /* Interrupt timer set */ |
168 | 204 | ||
169 | #define ASIC3_INTMASK_GINTMASK (1 << 0) /* Global INTs mask 1:enable */ | 205 | #define ASIC3_INTMASK_GINTMASK (1 << 0) /* Global INTs mask 1:enable */ |
170 | #define ASIC3_INTMASK_GINTEL (1 << 1) /* 1: rising edge, 0: hi level */ | 206 | #define ASIC3_INTMASK_GINTEL (1 << 1) /* 1: rising edge, 0: hi level */ |
@@ -227,44 +263,12 @@ void asic3_gpio_set_value(struct asic3 *asic, unsigned gpio, int val); | |||
227 | #define ASIC3_EXTCF_CF_SLEEP (1 << 15) /* CF sleep mode control */ | 263 | #define ASIC3_EXTCF_CF_SLEEP (1 << 15) /* CF sleep mode control */ |
228 | 264 | ||
229 | /********************************************* | 265 | /********************************************* |
230 | * The Onewire interface registers | 266 | * The Onewire interface (DS1WM) is handled |
231 | * | 267 | * by the ds1wm driver. |
232 | * OWM_CMD | ||
233 | * OWM_DAT | ||
234 | * OWM_INTR | ||
235 | * OWM_INTEN | ||
236 | * OWM_CLKDIV | ||
237 | * | 268 | * |
238 | *********************************************/ | 269 | *********************************************/ |
239 | 270 | ||
240 | #define ASIC3_OWM_Base 0xC00 | 271 | #define ASIC3_OWM_BASE 0xC00 |
241 | |||
242 | #define ASIC3_OWM_CMD 0x00 | ||
243 | #define ASIC3_OWM_DAT 0x04 | ||
244 | #define ASIC3_OWM_INTR 0x08 | ||
245 | #define ASIC3_OWM_INTEN 0x0C | ||
246 | #define ASIC3_OWM_CLKDIV 0x10 | ||
247 | |||
248 | #define ASIC3_OWM_CMD_ONEWR (1 << 0) | ||
249 | #define ASIC3_OWM_CMD_SRA (1 << 1) | ||
250 | #define ASIC3_OWM_CMD_DQO (1 << 2) | ||
251 | #define ASIC3_OWM_CMD_DQI (1 << 3) | ||
252 | |||
253 | #define ASIC3_OWM_INTR_PD (1 << 0) | ||
254 | #define ASIC3_OWM_INTR_PDR (1 << 1) | ||
255 | #define ASIC3_OWM_INTR_TBE (1 << 2) | ||
256 | #define ASIC3_OWM_INTR_TEMP (1 << 3) | ||
257 | #define ASIC3_OWM_INTR_RBF (1 << 4) | ||
258 | |||
259 | #define ASIC3_OWM_INTEN_EPD (1 << 0) | ||
260 | #define ASIC3_OWM_INTEN_IAS (1 << 1) | ||
261 | #define ASIC3_OWM_INTEN_ETBE (1 << 2) | ||
262 | #define ASIC3_OWM_INTEN_ETMT (1 << 3) | ||
263 | #define ASIC3_OWM_INTEN_ERBF (1 << 4) | ||
264 | |||
265 | #define ASIC3_OWM_CLKDIV_PRE (3 << 0) /* two bits wide at bit 0 */ | ||
266 | #define ASIC3_OWM_CLKDIV_DIV (7 << 2) /* 3 bits wide at bit 2 */ | ||
267 | |||
268 | 272 | ||
269 | /***************************************************************************** | 273 | /***************************************************************************** |
270 | * The SD configuration registers are at a completely different location | 274 | * The SD configuration registers are at a completely different location |
@@ -492,6 +496,7 @@ void asic3_gpio_set_value(struct asic3 *asic, unsigned gpio, int val); | |||
492 | #define ASIC3_SDIO_CTRL_LEDCtrl 0x7C | 496 | #define ASIC3_SDIO_CTRL_LEDCtrl 0x7C |
493 | #define ASIC3_SDIO_CTRL_SoftwareReset 0x1C0 | 497 | #define ASIC3_SDIO_CTRL_SoftwareReset 0x1C0 |
494 | 498 | ||
495 | #define ASIC3_MAP_SIZE 0x2000 | 499 | #define ASIC3_MAP_SIZE_32BIT 0x2000 |
500 | #define ASIC3_MAP_SIZE_16BIT 0x1000 | ||
496 | 501 | ||
497 | #endif /* __ASIC3_H__ */ | 502 | #endif /* __ASIC3_H__ */ |
diff --git a/include/linux/mfd/core.h b/include/linux/mfd/core.h new file mode 100644 index 000000000000..49ef857cdb2d --- /dev/null +++ b/include/linux/mfd/core.h | |||
@@ -0,0 +1,55 @@ | |||
1 | /* | ||
2 | * drivers/mfd/mfd-core.h | ||
3 | * | ||
4 | * core MFD support | ||
5 | * Copyright (c) 2006 Ian Molton | ||
6 | * Copyright (c) 2007 Dmitry Baryshkov | ||
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 | |||
14 | #ifndef MFD_CORE_H | ||
15 | #define MFD_CORE_H | ||
16 | |||
17 | #include <linux/platform_device.h> | ||
18 | |||
19 | /* | ||
20 | * This struct describes the MFD part ("cell"). | ||
21 | * After registration the copy of this structure will become the platform data | ||
22 | * of the resulting platform_device | ||
23 | */ | ||
24 | struct mfd_cell { | ||
25 | const char *name; | ||
26 | |||
27 | int (*enable)(struct platform_device *dev); | ||
28 | int (*disable)(struct platform_device *dev); | ||
29 | int (*suspend)(struct platform_device *dev); | ||
30 | int (*resume)(struct platform_device *dev); | ||
31 | |||
32 | /* driver-specific data for MFD-aware "cell" drivers */ | ||
33 | void *driver_data; | ||
34 | |||
35 | /* platform_data can be used to either pass data to "generic" | ||
36 | driver or as a hook to mfd_cell for the "cell" drivers */ | ||
37 | void *platform_data; | ||
38 | size_t data_size; | ||
39 | |||
40 | /* | ||
41 | * This resources can be specified relatievly to the parent device. | ||
42 | * For accessing device you should use resources from device | ||
43 | */ | ||
44 | int num_resources; | ||
45 | const struct resource *resources; | ||
46 | }; | ||
47 | |||
48 | extern int mfd_add_devices(struct device *parent, int id, | ||
49 | const struct mfd_cell *cells, int n_devs, | ||
50 | struct resource *mem_base, | ||
51 | int irq_base); | ||
52 | |||
53 | extern void mfd_remove_devices(struct device *parent); | ||
54 | |||
55 | #endif | ||
diff --git a/include/linux/mfd/t7l66xb.h b/include/linux/mfd/t7l66xb.h new file mode 100644 index 000000000000..e83c7f2036f9 --- /dev/null +++ b/include/linux/mfd/t7l66xb.h | |||
@@ -0,0 +1,36 @@ | |||
1 | /* | ||
2 | * This file contains the definitions for the T7L66XB | ||
3 | * | ||
4 | * (C) Copyright 2005 Ian Molton <spyro@f2s.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 MFD_T7L66XB_H | ||
12 | #define MFD_T7L66XB_H | ||
13 | |||
14 | #include <linux/mfd/core.h> | ||
15 | #include <linux/mfd/tmio.h> | ||
16 | |||
17 | struct t7l66xb_platform_data { | ||
18 | int (*enable_clk32k)(struct platform_device *dev); | ||
19 | void (*disable_clk32k)(struct platform_device *dev); | ||
20 | int (*enable)(struct platform_device *dev); | ||
21 | int (*disable)(struct platform_device *dev); | ||
22 | int (*suspend)(struct platform_device *dev); | ||
23 | int (*resume)(struct platform_device *dev); | ||
24 | |||
25 | int irq_base; /* The base for subdevice irqs */ | ||
26 | |||
27 | struct tmio_nand_data *nand_data; | ||
28 | }; | ||
29 | |||
30 | |||
31 | #define IRQ_T7L66XB_MMC (1) | ||
32 | #define IRQ_T7L66XB_NAND (3) | ||
33 | |||
34 | #define T7L66XB_NR_IRQS 8 | ||
35 | |||
36 | #endif | ||
diff --git a/include/linux/mfd/tc6387xb.h b/include/linux/mfd/tc6387xb.h new file mode 100644 index 000000000000..fa06e0610b8e --- /dev/null +++ b/include/linux/mfd/tc6387xb.h | |||
@@ -0,0 +1,23 @@ | |||
1 | /* | ||
2 | * This file contains the definitions for the TC6387XB | ||
3 | * | ||
4 | * (C) Copyright 2005 Ian Molton <spyro@f2s.com> | ||
5 | * | ||
6 | * May be copied or modified under the terms of the GNU General Public | ||
7 | * License. See linux/COPYING for more information. | ||
8 | * | ||
9 | */ | ||
10 | #ifndef MFD_TC6387XB_H | ||
11 | #define MFD_TC6387XB_H | ||
12 | |||
13 | struct tc6387xb_platform_data { | ||
14 | int (*enable_clk32k)(struct platform_device *dev); | ||
15 | void (*disable_clk32k)(struct platform_device *dev); | ||
16 | |||
17 | int (*enable)(struct platform_device *dev); | ||
18 | int (*disable)(struct platform_device *dev); | ||
19 | int (*suspend)(struct platform_device *dev); | ||
20 | int (*resume)(struct platform_device *dev); | ||
21 | }; | ||
22 | |||
23 | #endif | ||
diff --git a/include/linux/mfd/tc6393xb.h b/include/linux/mfd/tc6393xb.h new file mode 100644 index 000000000000..fec7b3f7a81f --- /dev/null +++ b/include/linux/mfd/tc6393xb.h | |||
@@ -0,0 +1,46 @@ | |||
1 | /* | ||
2 | * Toshiba TC6393XB SoC support | ||
3 | * | ||
4 | * Copyright(c) 2005-2006 Chris Humbert | ||
5 | * Copyright(c) 2005 Dirk Opfer | ||
6 | * Copyright(c) 2005 Ian Molton <spyro@f2s.com> | ||
7 | * Copyright(c) 2007 Dmitry Baryshkov | ||
8 | * | ||
9 | * Based on code written by Sharp/Lineo for 2.4 kernels | ||
10 | * Based on locomo.c | ||
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 version 2 as | ||
14 | * published by the Free Software Foundation. | ||
15 | */ | ||
16 | |||
17 | #ifndef MFD_TC6393XB_H | ||
18 | #define MFD_TC6393XB_H | ||
19 | |||
20 | /* Also one should provide the CK3P6MI clock */ | ||
21 | struct tc6393xb_platform_data { | ||
22 | u16 scr_pll2cr; /* PLL2 Control */ | ||
23 | u16 scr_gper; /* GP Enable */ | ||
24 | u32 scr_gpo_doecr; /* GPO Data OE Control */ | ||
25 | u32 scr_gpo_dsr; /* GPO Data Set */ | ||
26 | |||
27 | int (*enable)(struct platform_device *dev); | ||
28 | int (*disable)(struct platform_device *dev); | ||
29 | int (*suspend)(struct platform_device *dev); | ||
30 | int (*resume)(struct platform_device *dev); | ||
31 | |||
32 | int irq_base; /* base for subdevice irqs */ | ||
33 | int gpio_base; | ||
34 | |||
35 | struct tmio_nand_data *nand_data; | ||
36 | }; | ||
37 | |||
38 | /* | ||
39 | * Relative to irq_base | ||
40 | */ | ||
41 | #define IRQ_TC6393_NAND 0 | ||
42 | #define IRQ_TC6393_MMC 1 | ||
43 | |||
44 | #define TC6393XB_NR_IRQS 8 | ||
45 | |||
46 | #endif | ||
diff --git a/include/linux/mfd/tmio.h b/include/linux/mfd/tmio.h new file mode 100644 index 000000000000..ec612e66391c --- /dev/null +++ b/include/linux/mfd/tmio.h | |||
@@ -0,0 +1,28 @@ | |||
1 | #ifndef MFD_TMIO_H | ||
2 | #define MFD_TMIO_H | ||
3 | |||
4 | #define tmio_ioread8(addr) readb(addr) | ||
5 | #define tmio_ioread16(addr) readw(addr) | ||
6 | #define tmio_ioread16_rep(r, b, l) readsw(r, b, l) | ||
7 | #define tmio_ioread32(addr) \ | ||
8 | (((u32) readw((addr))) | (((u32) readw((addr) + 2)) << 16)) | ||
9 | |||
10 | #define tmio_iowrite8(val, addr) writeb((val), (addr)) | ||
11 | #define tmio_iowrite16(val, addr) writew((val), (addr)) | ||
12 | #define tmio_iowrite16_rep(r, b, l) writesw(r, b, l) | ||
13 | #define tmio_iowrite32(val, addr) \ | ||
14 | do { \ | ||
15 | writew((val), (addr)); \ | ||
16 | writew((val) >> 16, (addr) + 2); \ | ||
17 | } while (0) | ||
18 | |||
19 | /* | ||
20 | * data for the NAND controller | ||
21 | */ | ||
22 | struct tmio_nand_data { | ||
23 | struct nand_bbt_descr *badblock_pattern; | ||
24 | struct mtd_partition *partition; | ||
25 | unsigned int num_partitions; | ||
26 | }; | ||
27 | |||
28 | #endif | ||
diff --git a/include/linux/mfd/wm8350/audio.h b/include/linux/mfd/wm8350/audio.h new file mode 100644 index 000000000000..217bb22ebb8e --- /dev/null +++ b/include/linux/mfd/wm8350/audio.h | |||
@@ -0,0 +1,598 @@ | |||
1 | /* | ||
2 | * audio.h -- Audio Driver for Wolfson WM8350 PMIC | ||
3 | * | ||
4 | * Copyright 2007 Wolfson Microelectronics PLC | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify it | ||
7 | * under the terms of the GNU General Public License as published by the | ||
8 | * Free Software Foundation; either version 2 of the License, or (at your | ||
9 | * option) any later version. | ||
10 | * | ||
11 | */ | ||
12 | |||
13 | #ifndef __LINUX_MFD_WM8350_AUDIO_H_ | ||
14 | #define __LINUX_MFD_WM8350_AUDIO_H_ | ||
15 | |||
16 | #include <linux/platform_device.h> | ||
17 | |||
18 | #define WM8350_CLOCK_CONTROL_1 0x28 | ||
19 | #define WM8350_CLOCK_CONTROL_2 0x29 | ||
20 | #define WM8350_FLL_CONTROL_1 0x2A | ||
21 | #define WM8350_FLL_CONTROL_2 0x2B | ||
22 | #define WM8350_FLL_CONTROL_3 0x2C | ||
23 | #define WM8350_FLL_CONTROL_4 0x2D | ||
24 | #define WM8350_DAC_CONTROL 0x30 | ||
25 | #define WM8350_DAC_DIGITAL_VOLUME_L 0x32 | ||
26 | #define WM8350_DAC_DIGITAL_VOLUME_R 0x33 | ||
27 | #define WM8350_DAC_LR_RATE 0x35 | ||
28 | #define WM8350_DAC_CLOCK_CONTROL 0x36 | ||
29 | #define WM8350_DAC_MUTE 0x3A | ||
30 | #define WM8350_DAC_MUTE_VOLUME 0x3B | ||
31 | #define WM8350_DAC_SIDE 0x3C | ||
32 | #define WM8350_ADC_CONTROL 0x40 | ||
33 | #define WM8350_ADC_DIGITAL_VOLUME_L 0x42 | ||
34 | #define WM8350_ADC_DIGITAL_VOLUME_R 0x43 | ||
35 | #define WM8350_ADC_DIVIDER 0x44 | ||
36 | #define WM8350_ADC_LR_RATE 0x46 | ||
37 | #define WM8350_INPUT_CONTROL 0x48 | ||
38 | #define WM8350_IN3_INPUT_CONTROL 0x49 | ||
39 | #define WM8350_MIC_BIAS_CONTROL 0x4A | ||
40 | #define WM8350_OUTPUT_CONTROL 0x4C | ||
41 | #define WM8350_JACK_DETECT 0x4D | ||
42 | #define WM8350_ANTI_POP_CONTROL 0x4E | ||
43 | #define WM8350_LEFT_INPUT_VOLUME 0x50 | ||
44 | #define WM8350_RIGHT_INPUT_VOLUME 0x51 | ||
45 | #define WM8350_LEFT_MIXER_CONTROL 0x58 | ||
46 | #define WM8350_RIGHT_MIXER_CONTROL 0x59 | ||
47 | #define WM8350_OUT3_MIXER_CONTROL 0x5C | ||
48 | #define WM8350_OUT4_MIXER_CONTROL 0x5D | ||
49 | #define WM8350_OUTPUT_LEFT_MIXER_VOLUME 0x60 | ||
50 | #define WM8350_OUTPUT_RIGHT_MIXER_VOLUME 0x61 | ||
51 | #define WM8350_INPUT_MIXER_VOLUME_L 0x62 | ||
52 | #define WM8350_INPUT_MIXER_VOLUME_R 0x63 | ||
53 | #define WM8350_INPUT_MIXER_VOLUME 0x64 | ||
54 | #define WM8350_LOUT1_VOLUME 0x68 | ||
55 | #define WM8350_ROUT1_VOLUME 0x69 | ||
56 | #define WM8350_LOUT2_VOLUME 0x6A | ||
57 | #define WM8350_ROUT2_VOLUME 0x6B | ||
58 | #define WM8350_BEEP_VOLUME 0x6F | ||
59 | #define WM8350_AI_FORMATING 0x70 | ||
60 | #define WM8350_ADC_DAC_COMP 0x71 | ||
61 | #define WM8350_AI_ADC_CONTROL 0x72 | ||
62 | #define WM8350_AI_DAC_CONTROL 0x73 | ||
63 | #define WM8350_AIF_TEST 0x74 | ||
64 | #define WM8350_JACK_PIN_STATUS 0xE7 | ||
65 | |||
66 | /* Bit values for R08 (0x08) */ | ||
67 | #define WM8350_CODEC_ISEL_1_5 0 /* x1.5 */ | ||
68 | #define WM8350_CODEC_ISEL_1_0 1 /* x1.0 */ | ||
69 | #define WM8350_CODEC_ISEL_0_75 2 /* x0.75 */ | ||
70 | #define WM8350_CODEC_ISEL_0_5 3 /* x0.5 */ | ||
71 | |||
72 | #define WM8350_VMID_OFF 0 | ||
73 | #define WM8350_VMID_500K 1 | ||
74 | #define WM8350_VMID_100K 2 | ||
75 | #define WM8350_VMID_10K 3 | ||
76 | |||
77 | /* | ||
78 | * R40 (0x28) - Clock Control 1 | ||
79 | */ | ||
80 | #define WM8350_TOCLK_RATE 0x4000 | ||
81 | #define WM8350_MCLK_SEL 0x0800 | ||
82 | #define WM8350_MCLK_DIV_MASK 0x0100 | ||
83 | #define WM8350_BCLK_DIV_MASK 0x00F0 | ||
84 | #define WM8350_OPCLK_DIV_MASK 0x0007 | ||
85 | |||
86 | /* | ||
87 | * R41 (0x29) - Clock Control 2 | ||
88 | */ | ||
89 | #define WM8350_LRC_ADC_SEL 0x8000 | ||
90 | #define WM8350_MCLK_DIR 0x0001 | ||
91 | |||
92 | /* | ||
93 | * R42 (0x2A) - FLL Control 1 | ||
94 | */ | ||
95 | #define WM8350_FLL_DITHER_WIDTH_MASK 0x3000 | ||
96 | #define WM8350_FLL_DITHER_HP 0x0800 | ||
97 | #define WM8350_FLL_OUTDIV_MASK 0x0700 | ||
98 | #define WM8350_FLL_RSP_RATE_MASK 0x00F0 | ||
99 | #define WM8350_FLL_RATE_MASK 0x0007 | ||
100 | |||
101 | /* | ||
102 | * R43 (0x2B) - FLL Control 2 | ||
103 | */ | ||
104 | #define WM8350_FLL_RATIO_MASK 0xF800 | ||
105 | #define WM8350_FLL_N_MASK 0x03FF | ||
106 | |||
107 | /* | ||
108 | * R44 (0x2C) - FLL Control 3 | ||
109 | */ | ||
110 | #define WM8350_FLL_K_MASK 0xFFFF | ||
111 | |||
112 | /* | ||
113 | * R45 (0x2D) - FLL Control 4 | ||
114 | */ | ||
115 | #define WM8350_FLL_FRAC 0x0020 | ||
116 | #define WM8350_FLL_SLOW_LOCK_REF 0x0010 | ||
117 | #define WM8350_FLL_CLK_SRC_MASK 0x0003 | ||
118 | |||
119 | /* | ||
120 | * R48 (0x30) - DAC Control | ||
121 | */ | ||
122 | #define WM8350_DAC_MONO 0x2000 | ||
123 | #define WM8350_AIF_LRCLKRATE 0x1000 | ||
124 | #define WM8350_DEEMP_MASK 0x0030 | ||
125 | #define WM8350_DACL_DATINV 0x0002 | ||
126 | #define WM8350_DACR_DATINV 0x0001 | ||
127 | |||
128 | /* | ||
129 | * R50 (0x32) - DAC Digital Volume L | ||
130 | */ | ||
131 | #define WM8350_DAC_VU 0x0100 | ||
132 | #define WM8350_DACL_VOL_MASK 0x00FF | ||
133 | |||
134 | /* | ||
135 | * R51 (0x33) - DAC Digital Volume R | ||
136 | */ | ||
137 | #define WM8350_DAC_VU 0x0100 | ||
138 | #define WM8350_DACR_VOL_MASK 0x00FF | ||
139 | |||
140 | /* | ||
141 | * R53 (0x35) - DAC LR Rate | ||
142 | */ | ||
143 | #define WM8350_DACLRC_ENA 0x0800 | ||
144 | #define WM8350_DACLRC_RATE_MASK 0x07FF | ||
145 | |||
146 | /* | ||
147 | * R54 (0x36) - DAC Clock Control | ||
148 | */ | ||
149 | #define WM8350_DACCLK_POL 0x0010 | ||
150 | #define WM8350_DAC_CLKDIV_MASK 0x0007 | ||
151 | |||
152 | /* | ||
153 | * R58 (0x3A) - DAC Mute | ||
154 | */ | ||
155 | #define WM8350_DAC_MUTE_ENA 0x4000 | ||
156 | |||
157 | /* | ||
158 | * R59 (0x3B) - DAC Mute Volume | ||
159 | */ | ||
160 | #define WM8350_DAC_MUTEMODE 0x4000 | ||
161 | #define WM8350_DAC_MUTERATE 0x2000 | ||
162 | #define WM8350_DAC_SB_FILT 0x1000 | ||
163 | |||
164 | /* | ||
165 | * R60 (0x3C) - DAC Side | ||
166 | */ | ||
167 | #define WM8350_ADC_TO_DACL_MASK 0x3000 | ||
168 | #define WM8350_ADC_TO_DACR_MASK 0x0C00 | ||
169 | |||
170 | /* | ||
171 | * R64 (0x40) - ADC Control | ||
172 | */ | ||
173 | #define WM8350_ADC_HPF_CUT_MASK 0x0300 | ||
174 | #define WM8350_ADCL_DATINV 0x0002 | ||
175 | #define WM8350_ADCR_DATINV 0x0001 | ||
176 | |||
177 | /* | ||
178 | * R66 (0x42) - ADC Digital Volume L | ||
179 | */ | ||
180 | #define WM8350_ADC_VU 0x0100 | ||
181 | #define WM8350_ADCL_VOL_MASK 0x00FF | ||
182 | |||
183 | /* | ||
184 | * R67 (0x43) - ADC Digital Volume R | ||
185 | */ | ||
186 | #define WM8350_ADC_VU 0x0100 | ||
187 | #define WM8350_ADCR_VOL_MASK 0x00FF | ||
188 | |||
189 | /* | ||
190 | * R68 (0x44) - ADC Divider | ||
191 | */ | ||
192 | #define WM8350_ADCL_DAC_SVOL_MASK 0x0F00 | ||
193 | #define WM8350_ADCR_DAC_SVOL_MASK 0x00F0 | ||
194 | #define WM8350_ADCCLK_POL 0x0008 | ||
195 | #define WM8350_ADC_CLKDIV_MASK 0x0007 | ||
196 | |||
197 | /* | ||
198 | * R70 (0x46) - ADC LR Rate | ||
199 | */ | ||
200 | #define WM8350_ADCLRC_ENA 0x0800 | ||
201 | #define WM8350_ADCLRC_RATE_MASK 0x07FF | ||
202 | |||
203 | /* | ||
204 | * R72 (0x48) - Input Control | ||
205 | */ | ||
206 | #define WM8350_IN2R_ENA 0x0400 | ||
207 | #define WM8350_IN1RN_ENA 0x0200 | ||
208 | #define WM8350_IN1RP_ENA 0x0100 | ||
209 | #define WM8350_IN2L_ENA 0x0004 | ||
210 | #define WM8350_IN1LN_ENA 0x0002 | ||
211 | #define WM8350_IN1LP_ENA 0x0001 | ||
212 | |||
213 | /* | ||
214 | * R73 (0x49) - IN3 Input Control | ||
215 | */ | ||
216 | #define WM8350_IN3R_SHORT 0x4000 | ||
217 | #define WM8350_IN3L_SHORT 0x0040 | ||
218 | |||
219 | /* | ||
220 | * R74 (0x4A) - Mic Bias Control | ||
221 | */ | ||
222 | #define WM8350_MICBSEL 0x4000 | ||
223 | #define WM8350_MCDTHR_MASK 0x001C | ||
224 | #define WM8350_MCDSCTHR_MASK 0x0003 | ||
225 | |||
226 | /* | ||
227 | * R76 (0x4C) - Output Control | ||
228 | */ | ||
229 | #define WM8350_OUT4_VROI 0x0800 | ||
230 | #define WM8350_OUT3_VROI 0x0400 | ||
231 | #define WM8350_OUT2_VROI 0x0200 | ||
232 | #define WM8350_OUT1_VROI 0x0100 | ||
233 | #define WM8350_OUT2_FB 0x0004 | ||
234 | #define WM8350_OUT1_FB 0x0001 | ||
235 | |||
236 | /* | ||
237 | * R77 (0x4D) - Jack Detect | ||
238 | */ | ||
239 | #define WM8350_JDL_ENA 0x8000 | ||
240 | #define WM8350_JDR_ENA 0x4000 | ||
241 | |||
242 | /* | ||
243 | * R78 (0x4E) - Anti Pop Control | ||
244 | */ | ||
245 | #define WM8350_ANTI_POP_MASK 0x0300 | ||
246 | #define WM8350_DIS_OP_LN4_MASK 0x00C0 | ||
247 | #define WM8350_DIS_OP_LN3_MASK 0x0030 | ||
248 | #define WM8350_DIS_OP_OUT2_MASK 0x000C | ||
249 | #define WM8350_DIS_OP_OUT1_MASK 0x0003 | ||
250 | |||
251 | /* | ||
252 | * R80 (0x50) - Left Input Volume | ||
253 | */ | ||
254 | #define WM8350_INL_MUTE 0x4000 | ||
255 | #define WM8350_INL_ZC 0x2000 | ||
256 | #define WM8350_IN_VU 0x0100 | ||
257 | #define WM8350_INL_VOL_MASK 0x00FC | ||
258 | |||
259 | /* | ||
260 | * R81 (0x51) - Right Input Volume | ||
261 | */ | ||
262 | #define WM8350_INR_MUTE 0x4000 | ||
263 | #define WM8350_INR_ZC 0x2000 | ||
264 | #define WM8350_IN_VU 0x0100 | ||
265 | #define WM8350_INR_VOL_MASK 0x00FC | ||
266 | |||
267 | /* | ||
268 | * R88 (0x58) - Left Mixer Control | ||
269 | */ | ||
270 | #define WM8350_DACR_TO_MIXOUTL 0x1000 | ||
271 | #define WM8350_DACL_TO_MIXOUTL 0x0800 | ||
272 | #define WM8350_IN3L_TO_MIXOUTL 0x0004 | ||
273 | #define WM8350_INR_TO_MIXOUTL 0x0002 | ||
274 | #define WM8350_INL_TO_MIXOUTL 0x0001 | ||
275 | |||
276 | /* | ||
277 | * R89 (0x59) - Right Mixer Control | ||
278 | */ | ||
279 | #define WM8350_DACR_TO_MIXOUTR 0x1000 | ||
280 | #define WM8350_DACL_TO_MIXOUTR 0x0800 | ||
281 | #define WM8350_IN3R_TO_MIXOUTR 0x0008 | ||
282 | #define WM8350_INR_TO_MIXOUTR 0x0002 | ||
283 | #define WM8350_INL_TO_MIXOUTR 0x0001 | ||
284 | |||
285 | /* | ||
286 | * R92 (0x5C) - OUT3 Mixer Control | ||
287 | */ | ||
288 | #define WM8350_DACL_TO_OUT3 0x0800 | ||
289 | #define WM8350_MIXINL_TO_OUT3 0x0100 | ||
290 | #define WM8350_OUT4_TO_OUT3 0x0008 | ||
291 | #define WM8350_MIXOUTL_TO_OUT3 0x0001 | ||
292 | |||
293 | /* | ||
294 | * R93 (0x5D) - OUT4 Mixer Control | ||
295 | */ | ||
296 | #define WM8350_DACR_TO_OUT4 0x1000 | ||
297 | #define WM8350_DACL_TO_OUT4 0x0800 | ||
298 | #define WM8350_OUT4_ATTN 0x0400 | ||
299 | #define WM8350_MIXINR_TO_OUT4 0x0200 | ||
300 | #define WM8350_OUT3_TO_OUT4 0x0004 | ||
301 | #define WM8350_MIXOUTR_TO_OUT4 0x0002 | ||
302 | #define WM8350_MIXOUTL_TO_OUT4 0x0001 | ||
303 | |||
304 | /* | ||
305 | * R96 (0x60) - Output Left Mixer Volume | ||
306 | */ | ||
307 | #define WM8350_IN3L_MIXOUTL_VOL_MASK 0x0E00 | ||
308 | #define WM8350_IN3L_MIXOUTL_VOL_SHIFT 9 | ||
309 | #define WM8350_INR_MIXOUTL_VOL_MASK 0x00E0 | ||
310 | #define WM8350_INR_MIXOUTL_VOL_SHIFT 5 | ||
311 | #define WM8350_INL_MIXOUTL_VOL_MASK 0x000E | ||
312 | #define WM8350_INL_MIXOUTL_VOL_SHIFT 1 | ||
313 | |||
314 | /* Bit values for R96 (0x60) */ | ||
315 | #define WM8350_IN3L_MIXOUTL_VOL_OFF 0 | ||
316 | #define WM8350_IN3L_MIXOUTL_VOL_M12DB 1 | ||
317 | #define WM8350_IN3L_MIXOUTL_VOL_M9DB 2 | ||
318 | #define WM8350_IN3L_MIXOUTL_VOL_M6DB 3 | ||
319 | #define WM8350_IN3L_MIXOUTL_VOL_M3DB 4 | ||
320 | #define WM8350_IN3L_MIXOUTL_VOL_0DB 5 | ||
321 | #define WM8350_IN3L_MIXOUTL_VOL_3DB 6 | ||
322 | #define WM8350_IN3L_MIXOUTL_VOL_6DB 7 | ||
323 | |||
324 | #define WM8350_INR_MIXOUTL_VOL_OFF 0 | ||
325 | #define WM8350_INR_MIXOUTL_VOL_M12DB 1 | ||
326 | #define WM8350_INR_MIXOUTL_VOL_M9DB 2 | ||
327 | #define WM8350_INR_MIXOUTL_VOL_M6DB 3 | ||
328 | #define WM8350_INR_MIXOUTL_VOL_M3DB 4 | ||
329 | #define WM8350_INR_MIXOUTL_VOL_0DB 5 | ||
330 | #define WM8350_INR_MIXOUTL_VOL_3DB 6 | ||
331 | #define WM8350_INR_MIXOUTL_VOL_6DB 7 | ||
332 | |||
333 | #define WM8350_INL_MIXOUTL_VOL_OFF 0 | ||
334 | #define WM8350_INL_MIXOUTL_VOL_M12DB 1 | ||
335 | #define WM8350_INL_MIXOUTL_VOL_M9DB 2 | ||
336 | #define WM8350_INL_MIXOUTL_VOL_M6DB 3 | ||
337 | #define WM8350_INL_MIXOUTL_VOL_M3DB 4 | ||
338 | #define WM8350_INL_MIXOUTL_VOL_0DB 5 | ||
339 | #define WM8350_INL_MIXOUTL_VOL_3DB 6 | ||
340 | #define WM8350_INL_MIXOUTL_VOL_6DB 7 | ||
341 | |||
342 | /* | ||
343 | * R97 (0x61) - Output Right Mixer Volume | ||
344 | */ | ||
345 | #define WM8350_IN3R_MIXOUTR_VOL_MASK 0xE000 | ||
346 | #define WM8350_IN3R_MIXOUTR_VOL_SHIFT 13 | ||
347 | #define WM8350_INR_MIXOUTR_VOL_MASK 0x00E0 | ||
348 | #define WM8350_INR_MIXOUTR_VOL_SHIFT 5 | ||
349 | #define WM8350_INL_MIXOUTR_VOL_MASK 0x000E | ||
350 | #define WM8350_INL_MIXOUTR_VOL_SHIFT 1 | ||
351 | |||
352 | /* Bit values for R96 (0x60) */ | ||
353 | #define WM8350_IN3R_MIXOUTR_VOL_OFF 0 | ||
354 | #define WM8350_IN3R_MIXOUTR_VOL_M12DB 1 | ||
355 | #define WM8350_IN3R_MIXOUTR_VOL_M9DB 2 | ||
356 | #define WM8350_IN3R_MIXOUTR_VOL_M6DB 3 | ||
357 | #define WM8350_IN3R_MIXOUTR_VOL_M3DB 4 | ||
358 | #define WM8350_IN3R_MIXOUTR_VOL_0DB 5 | ||
359 | #define WM8350_IN3R_MIXOUTR_VOL_3DB 6 | ||
360 | #define WM8350_IN3R_MIXOUTR_VOL_6DB 7 | ||
361 | |||
362 | #define WM8350_INR_MIXOUTR_VOL_OFF 0 | ||
363 | #define WM8350_INR_MIXOUTR_VOL_M12DB 1 | ||
364 | #define WM8350_INR_MIXOUTR_VOL_M9DB 2 | ||
365 | #define WM8350_INR_MIXOUTR_VOL_M6DB 3 | ||
366 | #define WM8350_INR_MIXOUTR_VOL_M3DB 4 | ||
367 | #define WM8350_INR_MIXOUTR_VOL_0DB 5 | ||
368 | #define WM8350_INR_MIXOUTR_VOL_3DB 6 | ||
369 | #define WM8350_INR_MIXOUTR_VOL_6DB 7 | ||
370 | |||
371 | #define WM8350_INL_MIXOUTR_VOL_OFF 0 | ||
372 | #define WM8350_INL_MIXOUTR_VOL_M12DB 1 | ||
373 | #define WM8350_INL_MIXOUTR_VOL_M9DB 2 | ||
374 | #define WM8350_INL_MIXOUTR_VOL_M6DB 3 | ||
375 | #define WM8350_INL_MIXOUTR_VOL_M3DB 4 | ||
376 | #define WM8350_INL_MIXOUTR_VOL_0DB 5 | ||
377 | #define WM8350_INL_MIXOUTR_VOL_3DB 6 | ||
378 | #define WM8350_INL_MIXOUTR_VOL_6DB 7 | ||
379 | |||
380 | /* | ||
381 | * R98 (0x62) - Input Mixer Volume L | ||
382 | */ | ||
383 | #define WM8350_IN3L_MIXINL_VOL_MASK 0x0E00 | ||
384 | #define WM8350_IN2L_MIXINL_VOL_MASK 0x000E | ||
385 | #define WM8350_INL_MIXINL_VOL 0x0001 | ||
386 | |||
387 | /* | ||
388 | * R99 (0x63) - Input Mixer Volume R | ||
389 | */ | ||
390 | #define WM8350_IN3R_MIXINR_VOL_MASK 0xE000 | ||
391 | #define WM8350_IN2R_MIXINR_VOL_MASK 0x00E0 | ||
392 | #define WM8350_INR_MIXINR_VOL 0x0001 | ||
393 | |||
394 | /* | ||
395 | * R100 (0x64) - Input Mixer Volume | ||
396 | */ | ||
397 | #define WM8350_OUT4_MIXIN_DST 0x8000 | ||
398 | #define WM8350_OUT4_MIXIN_VOL_MASK 0x000E | ||
399 | |||
400 | /* | ||
401 | * R104 (0x68) - LOUT1 Volume | ||
402 | */ | ||
403 | #define WM8350_OUT1L_MUTE 0x4000 | ||
404 | #define WM8350_OUT1L_ZC 0x2000 | ||
405 | #define WM8350_OUT1_VU 0x0100 | ||
406 | #define WM8350_OUT1L_VOL_MASK 0x00FC | ||
407 | #define WM8350_OUT1L_VOL_SHIFT 2 | ||
408 | |||
409 | /* | ||
410 | * R105 (0x69) - ROUT1 Volume | ||
411 | */ | ||
412 | #define WM8350_OUT1R_MUTE 0x4000 | ||
413 | #define WM8350_OUT1R_ZC 0x2000 | ||
414 | #define WM8350_OUT1_VU 0x0100 | ||
415 | #define WM8350_OUT1R_VOL_MASK 0x00FC | ||
416 | #define WM8350_OUT1R_VOL_SHIFT 2 | ||
417 | |||
418 | /* | ||
419 | * R106 (0x6A) - LOUT2 Volume | ||
420 | */ | ||
421 | #define WM8350_OUT2L_MUTE 0x4000 | ||
422 | #define WM8350_OUT2L_ZC 0x2000 | ||
423 | #define WM8350_OUT2_VU 0x0100 | ||
424 | #define WM8350_OUT2L_VOL_MASK 0x00FC | ||
425 | |||
426 | /* | ||
427 | * R107 (0x6B) - ROUT2 Volume | ||
428 | */ | ||
429 | #define WM8350_OUT2R_MUTE 0x4000 | ||
430 | #define WM8350_OUT2R_ZC 0x2000 | ||
431 | #define WM8350_OUT2R_INV 0x0400 | ||
432 | #define WM8350_OUT2R_INV_MUTE 0x0200 | ||
433 | #define WM8350_OUT2_VU 0x0100 | ||
434 | #define WM8350_OUT2R_VOL_MASK 0x00FC | ||
435 | |||
436 | /* | ||
437 | * R111 (0x6F) - BEEP Volume | ||
438 | */ | ||
439 | #define WM8350_IN3R_OUT2R_VOL_MASK 0x00E0 | ||
440 | |||
441 | /* | ||
442 | * R112 (0x70) - AI Formating | ||
443 | */ | ||
444 | #define WM8350_AIF_BCLK_INV 0x8000 | ||
445 | #define WM8350_AIF_TRI 0x2000 | ||
446 | #define WM8350_AIF_LRCLK_INV 0x1000 | ||
447 | #define WM8350_AIF_WL_MASK 0x0C00 | ||
448 | #define WM8350_AIF_FMT_MASK 0x0300 | ||
449 | |||
450 | /* | ||
451 | * R113 (0x71) - ADC DAC COMP | ||
452 | */ | ||
453 | #define WM8350_DAC_COMP 0x0080 | ||
454 | #define WM8350_DAC_COMPMODE 0x0040 | ||
455 | #define WM8350_ADC_COMP 0x0020 | ||
456 | #define WM8350_ADC_COMPMODE 0x0010 | ||
457 | #define WM8350_LOOPBACK 0x0001 | ||
458 | |||
459 | /* | ||
460 | * R114 (0x72) - AI ADC Control | ||
461 | */ | ||
462 | #define WM8350_AIFADC_PD 0x0080 | ||
463 | #define WM8350_AIFADCL_SRC 0x0040 | ||
464 | #define WM8350_AIFADCR_SRC 0x0020 | ||
465 | #define WM8350_AIFADC_TDM_CHAN 0x0010 | ||
466 | #define WM8350_AIFADC_TDM 0x0008 | ||
467 | |||
468 | /* | ||
469 | * R115 (0x73) - AI DAC Control | ||
470 | */ | ||
471 | #define WM8350_BCLK_MSTR 0x4000 | ||
472 | #define WM8350_AIFDAC_PD 0x0080 | ||
473 | #define WM8350_DACL_SRC 0x0040 | ||
474 | #define WM8350_DACR_SRC 0x0020 | ||
475 | #define WM8350_AIFDAC_TDM_CHAN 0x0010 | ||
476 | #define WM8350_AIFDAC_TDM 0x0008 | ||
477 | #define WM8350_DAC_BOOST_MASK 0x0003 | ||
478 | |||
479 | /* | ||
480 | * R116 (0x74) - AIF Test | ||
481 | */ | ||
482 | #define WM8350_CODEC_BYP 0x4000 | ||
483 | #define WM8350_AIFADC_WR_TST 0x2000 | ||
484 | #define WM8350_AIFADC_RD_TST 0x1000 | ||
485 | #define WM8350_AIFDAC_WR_TST 0x0800 | ||
486 | #define WM8350_AIFDAC_RD_TST 0x0400 | ||
487 | #define WM8350_AIFADC_ASYN 0x0020 | ||
488 | #define WM8350_AIFDAC_ASYN 0x0010 | ||
489 | |||
490 | /* | ||
491 | * R231 (0xE7) - Jack Status | ||
492 | */ | ||
493 | #define WM8350_JACK_R_LVL 0x0400 | ||
494 | |||
495 | /* | ||
496 | * WM8350 Platform setup | ||
497 | */ | ||
498 | #define WM8350_S_CURVE_NONE 0x0 | ||
499 | #define WM8350_S_CURVE_FAST 0x1 | ||
500 | #define WM8350_S_CURVE_MEDIUM 0x2 | ||
501 | #define WM8350_S_CURVE_SLOW 0x3 | ||
502 | |||
503 | #define WM8350_DISCHARGE_OFF 0x0 | ||
504 | #define WM8350_DISCHARGE_FAST 0x1 | ||
505 | #define WM8350_DISCHARGE_MEDIUM 0x2 | ||
506 | #define WM8350_DISCHARGE_SLOW 0x3 | ||
507 | |||
508 | #define WM8350_TIE_OFF_500R 0x0 | ||
509 | #define WM8350_TIE_OFF_30K 0x1 | ||
510 | |||
511 | /* | ||
512 | * Clock sources & directions | ||
513 | */ | ||
514 | #define WM8350_SYSCLK 0 | ||
515 | |||
516 | #define WM8350_MCLK_SEL_PLL_MCLK 0 | ||
517 | #define WM8350_MCLK_SEL_PLL_DAC 1 | ||
518 | #define WM8350_MCLK_SEL_PLL_ADC 2 | ||
519 | #define WM8350_MCLK_SEL_PLL_32K 3 | ||
520 | #define WM8350_MCLK_SEL_MCLK 5 | ||
521 | |||
522 | #define WM8350_MCLK_DIR_OUT 0 | ||
523 | #define WM8350_MCLK_DIR_IN 1 | ||
524 | |||
525 | /* clock divider id's */ | ||
526 | #define WM8350_ADC_CLKDIV 0 | ||
527 | #define WM8350_DAC_CLKDIV 1 | ||
528 | #define WM8350_BCLK_CLKDIV 2 | ||
529 | #define WM8350_OPCLK_CLKDIV 3 | ||
530 | #define WM8350_TO_CLKDIV 4 | ||
531 | #define WM8350_SYS_CLKDIV 5 | ||
532 | #define WM8350_DACLR_CLKDIV 6 | ||
533 | #define WM8350_ADCLR_CLKDIV 7 | ||
534 | |||
535 | /* ADC clock dividers */ | ||
536 | #define WM8350_ADCDIV_1 0x0 | ||
537 | #define WM8350_ADCDIV_1_5 0x1 | ||
538 | #define WM8350_ADCDIV_2 0x2 | ||
539 | #define WM8350_ADCDIV_3 0x3 | ||
540 | #define WM8350_ADCDIV_4 0x4 | ||
541 | #define WM8350_ADCDIV_5_5 0x5 | ||
542 | #define WM8350_ADCDIV_6 0x6 | ||
543 | |||
544 | /* ADC clock dividers */ | ||
545 | #define WM8350_DACDIV_1 0x0 | ||
546 | #define WM8350_DACDIV_1_5 0x1 | ||
547 | #define WM8350_DACDIV_2 0x2 | ||
548 | #define WM8350_DACDIV_3 0x3 | ||
549 | #define WM8350_DACDIV_4 0x4 | ||
550 | #define WM8350_DACDIV_5_5 0x5 | ||
551 | #define WM8350_DACDIV_6 0x6 | ||
552 | |||
553 | /* BCLK clock dividers */ | ||
554 | #define WM8350_BCLK_DIV_1 (0x0 << 4) | ||
555 | #define WM8350_BCLK_DIV_1_5 (0x1 << 4) | ||
556 | #define WM8350_BCLK_DIV_2 (0x2 << 4) | ||
557 | #define WM8350_BCLK_DIV_3 (0x3 << 4) | ||
558 | #define WM8350_BCLK_DIV_4 (0x4 << 4) | ||
559 | #define WM8350_BCLK_DIV_5_5 (0x5 << 4) | ||
560 | #define WM8350_BCLK_DIV_6 (0x6 << 4) | ||
561 | #define WM8350_BCLK_DIV_8 (0x7 << 4) | ||
562 | #define WM8350_BCLK_DIV_11 (0x8 << 4) | ||
563 | #define WM8350_BCLK_DIV_12 (0x9 << 4) | ||
564 | #define WM8350_BCLK_DIV_16 (0xa << 4) | ||
565 | #define WM8350_BCLK_DIV_22 (0xb << 4) | ||
566 | #define WM8350_BCLK_DIV_24 (0xc << 4) | ||
567 | #define WM8350_BCLK_DIV_32 (0xd << 4) | ||
568 | #define WM8350_BCLK_DIV_44 (0xe << 4) | ||
569 | #define WM8350_BCLK_DIV_48 (0xf << 4) | ||
570 | |||
571 | /* Sys (MCLK) clock dividers */ | ||
572 | #define WM8350_MCLK_DIV_1 (0x0 << 8) | ||
573 | #define WM8350_MCLK_DIV_2 (0x1 << 8) | ||
574 | |||
575 | /* OP clock dividers */ | ||
576 | #define WM8350_OPCLK_DIV_1 0x0 | ||
577 | #define WM8350_OPCLK_DIV_2 0x1 | ||
578 | #define WM8350_OPCLK_DIV_3 0x2 | ||
579 | #define WM8350_OPCLK_DIV_4 0x3 | ||
580 | #define WM8350_OPCLK_DIV_5_5 0x4 | ||
581 | #define WM8350_OPCLK_DIV_6 0x5 | ||
582 | |||
583 | /* DAI ID */ | ||
584 | #define WM8350_HIFI_DAI 0 | ||
585 | |||
586 | /* | ||
587 | * Audio interrupts. | ||
588 | */ | ||
589 | #define WM8350_IRQ_CODEC_JCK_DET_L 39 | ||
590 | #define WM8350_IRQ_CODEC_JCK_DET_R 40 | ||
591 | #define WM8350_IRQ_CODEC_MICSCD 41 | ||
592 | #define WM8350_IRQ_CODEC_MICD 42 | ||
593 | |||
594 | struct wm8350_codec { | ||
595 | struct platform_device *pdev; | ||
596 | }; | ||
597 | |||
598 | #endif | ||
diff --git a/include/linux/mfd/wm8350/comparator.h b/include/linux/mfd/wm8350/comparator.h new file mode 100644 index 000000000000..053788649452 --- /dev/null +++ b/include/linux/mfd/wm8350/comparator.h | |||
@@ -0,0 +1,167 @@ | |||
1 | /* | ||
2 | * comparator.h -- Comparator Aux ADC for Wolfson WM8350 PMIC | ||
3 | * | ||
4 | * Copyright 2007 Wolfson Microelectronics PLC | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify it | ||
7 | * under the terms of the GNU General Public License as published by the | ||
8 | * Free Software Foundation; either version 2 of the License, or (at your | ||
9 | * option) any later version. | ||
10 | */ | ||
11 | |||
12 | #ifndef __LINUX_MFD_WM8350_COMPARATOR_H_ | ||
13 | #define __LINUX_MFD_WM8350_COMPARATOR_H_ | ||
14 | |||
15 | /* | ||
16 | * Registers | ||
17 | */ | ||
18 | |||
19 | #define WM8350_DIGITISER_CONTROL_1 0x90 | ||
20 | #define WM8350_DIGITISER_CONTROL_2 0x91 | ||
21 | #define WM8350_AUX1_READBACK 0x98 | ||
22 | #define WM8350_AUX2_READBACK 0x99 | ||
23 | #define WM8350_AUX3_READBACK 0x9A | ||
24 | #define WM8350_AUX4_READBACK 0x9B | ||
25 | #define WM8350_CHIP_TEMP_READBACK 0x9F | ||
26 | #define WM8350_GENERIC_COMPARATOR_CONTROL 0xA3 | ||
27 | #define WM8350_GENERIC_COMPARATOR_1 0xA4 | ||
28 | #define WM8350_GENERIC_COMPARATOR_2 0xA5 | ||
29 | #define WM8350_GENERIC_COMPARATOR_3 0xA6 | ||
30 | #define WM8350_GENERIC_COMPARATOR_4 0xA7 | ||
31 | |||
32 | /* | ||
33 | * R144 (0x90) - Digitiser Control (1) | ||
34 | */ | ||
35 | #define WM8350_AUXADC_CTC 0x4000 | ||
36 | #define WM8350_AUXADC_POLL 0x2000 | ||
37 | #define WM8350_AUXADC_HIB_MODE 0x1000 | ||
38 | #define WM8350_AUXADC_SEL8 0x0080 | ||
39 | #define WM8350_AUXADC_SEL7 0x0040 | ||
40 | #define WM8350_AUXADC_SEL6 0x0020 | ||
41 | #define WM8350_AUXADC_SEL5 0x0010 | ||
42 | #define WM8350_AUXADC_SEL4 0x0008 | ||
43 | #define WM8350_AUXADC_SEL3 0x0004 | ||
44 | #define WM8350_AUXADC_SEL2 0x0002 | ||
45 | #define WM8350_AUXADC_SEL1 0x0001 | ||
46 | |||
47 | /* | ||
48 | * R145 (0x91) - Digitiser Control (2) | ||
49 | */ | ||
50 | #define WM8350_AUXADC_MASKMODE_MASK 0x3000 | ||
51 | #define WM8350_AUXADC_CRATE_MASK 0x0700 | ||
52 | #define WM8350_AUXADC_CAL 0x0004 | ||
53 | #define WM8350_AUX_RBMODE 0x0002 | ||
54 | #define WM8350_AUXADC_WAIT 0x0001 | ||
55 | |||
56 | /* | ||
57 | * R152 (0x98) - AUX1 Readback | ||
58 | */ | ||
59 | #define WM8350_AUXADC_SCALE1_MASK 0x6000 | ||
60 | #define WM8350_AUXADC_REF1 0x1000 | ||
61 | #define WM8350_AUXADC_DATA1_MASK 0x0FFF | ||
62 | |||
63 | /* | ||
64 | * R153 (0x99) - AUX2 Readback | ||
65 | */ | ||
66 | #define WM8350_AUXADC_SCALE2_MASK 0x6000 | ||
67 | #define WM8350_AUXADC_REF2 0x1000 | ||
68 | #define WM8350_AUXADC_DATA2_MASK 0x0FFF | ||
69 | |||
70 | /* | ||
71 | * R154 (0x9A) - AUX3 Readback | ||
72 | */ | ||
73 | #define WM8350_AUXADC_SCALE3_MASK 0x6000 | ||
74 | #define WM8350_AUXADC_REF3 0x1000 | ||
75 | #define WM8350_AUXADC_DATA3_MASK 0x0FFF | ||
76 | |||
77 | /* | ||
78 | * R155 (0x9B) - AUX4 Readback | ||
79 | */ | ||
80 | #define WM8350_AUXADC_SCALE4_MASK 0x6000 | ||
81 | #define WM8350_AUXADC_REF4 0x1000 | ||
82 | #define WM8350_AUXADC_DATA4_MASK 0x0FFF | ||
83 | |||
84 | /* | ||
85 | * R156 (0x9C) - USB Voltage Readback | ||
86 | */ | ||
87 | #define WM8350_AUXADC_DATA_USB_MASK 0x0FFF | ||
88 | |||
89 | /* | ||
90 | * R157 (0x9D) - LINE Voltage Readback | ||
91 | */ | ||
92 | #define WM8350_AUXADC_DATA_LINE_MASK 0x0FFF | ||
93 | |||
94 | /* | ||
95 | * R158 (0x9E) - BATT Voltage Readback | ||
96 | */ | ||
97 | #define WM8350_AUXADC_DATA_BATT_MASK 0x0FFF | ||
98 | |||
99 | /* | ||
100 | * R159 (0x9F) - Chip Temp Readback | ||
101 | */ | ||
102 | #define WM8350_AUXADC_DATA_CHIPTEMP_MASK 0x0FFF | ||
103 | |||
104 | /* | ||
105 | * R163 (0xA3) - Generic Comparator Control | ||
106 | */ | ||
107 | #define WM8350_DCMP4_ENA 0x0008 | ||
108 | #define WM8350_DCMP3_ENA 0x0004 | ||
109 | #define WM8350_DCMP2_ENA 0x0002 | ||
110 | #define WM8350_DCMP1_ENA 0x0001 | ||
111 | |||
112 | /* | ||
113 | * R164 (0xA4) - Generic comparator 1 | ||
114 | */ | ||
115 | #define WM8350_DCMP1_SRCSEL_MASK 0xE000 | ||
116 | #define WM8350_DCMP1_GT 0x1000 | ||
117 | #define WM8350_DCMP1_THR_MASK 0x0FFF | ||
118 | |||
119 | /* | ||
120 | * R165 (0xA5) - Generic comparator 2 | ||
121 | */ | ||
122 | #define WM8350_DCMP2_SRCSEL_MASK 0xE000 | ||
123 | #define WM8350_DCMP2_GT 0x1000 | ||
124 | #define WM8350_DCMP2_THR_MASK 0x0FFF | ||
125 | |||
126 | /* | ||
127 | * R166 (0xA6) - Generic comparator 3 | ||
128 | */ | ||
129 | #define WM8350_DCMP3_SRCSEL_MASK 0xE000 | ||
130 | #define WM8350_DCMP3_GT 0x1000 | ||
131 | #define WM8350_DCMP3_THR_MASK 0x0FFF | ||
132 | |||
133 | /* | ||
134 | * R167 (0xA7) - Generic comparator 4 | ||
135 | */ | ||
136 | #define WM8350_DCMP4_SRCSEL_MASK 0xE000 | ||
137 | #define WM8350_DCMP4_GT 0x1000 | ||
138 | #define WM8350_DCMP4_THR_MASK 0x0FFF | ||
139 | |||
140 | /* | ||
141 | * Interrupts. | ||
142 | */ | ||
143 | #define WM8350_IRQ_AUXADC_DATARDY 16 | ||
144 | #define WM8350_IRQ_AUXADC_DCOMP4 17 | ||
145 | #define WM8350_IRQ_AUXADC_DCOMP3 18 | ||
146 | #define WM8350_IRQ_AUXADC_DCOMP2 19 | ||
147 | #define WM8350_IRQ_AUXADC_DCOMP1 20 | ||
148 | #define WM8350_IRQ_SYS_HYST_COMP_FAIL 21 | ||
149 | #define WM8350_IRQ_SYS_CHIP_GT115 22 | ||
150 | #define WM8350_IRQ_SYS_CHIP_GT140 23 | ||
151 | |||
152 | /* | ||
153 | * USB/2, LINE & BATT = ((VRTC * 2) / 4095)) * 10e6 uV | ||
154 | * Where VRTC = 2.7 V | ||
155 | */ | ||
156 | #define WM8350_AUX_COEFF 1319 | ||
157 | |||
158 | #define WM8350_AUXADC_AUX1 0 | ||
159 | #define WM8350_AUXADC_AUX2 1 | ||
160 | #define WM8350_AUXADC_AUX3 2 | ||
161 | #define WM8350_AUXADC_AUX4 3 | ||
162 | #define WM8350_AUXADC_USB 4 | ||
163 | #define WM8350_AUXADC_LINE 5 | ||
164 | #define WM8350_AUXADC_BATT 6 | ||
165 | #define WM8350_AUXADC_TEMP 7 | ||
166 | |||
167 | #endif | ||
diff --git a/include/linux/mfd/wm8350/core.h b/include/linux/mfd/wm8350/core.h new file mode 100644 index 000000000000..6ebf97f2a475 --- /dev/null +++ b/include/linux/mfd/wm8350/core.h | |||
@@ -0,0 +1,631 @@ | |||
1 | /* | ||
2 | * core.h -- Core Driver for Wolfson WM8350 PMIC | ||
3 | * | ||
4 | * Copyright 2007 Wolfson Microelectronics PLC | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify it | ||
7 | * under the terms of the GNU General Public License as published by the | ||
8 | * Free Software Foundation; either version 2 of the License, or (at your | ||
9 | * option) any later version. | ||
10 | * | ||
11 | */ | ||
12 | |||
13 | #ifndef __LINUX_MFD_WM8350_CORE_H_ | ||
14 | #define __LINUX_MFD_WM8350_CORE_H_ | ||
15 | |||
16 | #include <linux/kernel.h> | ||
17 | #include <linux/mutex.h> | ||
18 | #include <linux/workqueue.h> | ||
19 | |||
20 | #include <linux/mfd/wm8350/audio.h> | ||
21 | #include <linux/mfd/wm8350/gpio.h> | ||
22 | #include <linux/mfd/wm8350/pmic.h> | ||
23 | #include <linux/mfd/wm8350/rtc.h> | ||
24 | #include <linux/mfd/wm8350/supply.h> | ||
25 | #include <linux/mfd/wm8350/wdt.h> | ||
26 | |||
27 | /* | ||
28 | * Register values. | ||
29 | */ | ||
30 | #define WM8350_RESET_ID 0x00 | ||
31 | #define WM8350_ID 0x01 | ||
32 | #define WM8350_SYSTEM_CONTROL_1 0x03 | ||
33 | #define WM8350_SYSTEM_CONTROL_2 0x04 | ||
34 | #define WM8350_SYSTEM_HIBERNATE 0x05 | ||
35 | #define WM8350_INTERFACE_CONTROL 0x06 | ||
36 | #define WM8350_POWER_MGMT_1 0x08 | ||
37 | #define WM8350_POWER_MGMT_2 0x09 | ||
38 | #define WM8350_POWER_MGMT_3 0x0A | ||
39 | #define WM8350_POWER_MGMT_4 0x0B | ||
40 | #define WM8350_POWER_MGMT_5 0x0C | ||
41 | #define WM8350_POWER_MGMT_6 0x0D | ||
42 | #define WM8350_POWER_MGMT_7 0x0E | ||
43 | |||
44 | #define WM8350_SYSTEM_INTERRUPTS 0x18 | ||
45 | #define WM8350_INT_STATUS_1 0x19 | ||
46 | #define WM8350_INT_STATUS_2 0x1A | ||
47 | #define WM8350_POWER_UP_INT_STATUS 0x1B | ||
48 | #define WM8350_UNDER_VOLTAGE_INT_STATUS 0x1C | ||
49 | #define WM8350_OVER_CURRENT_INT_STATUS 0x1D | ||
50 | #define WM8350_GPIO_INT_STATUS 0x1E | ||
51 | #define WM8350_COMPARATOR_INT_STATUS 0x1F | ||
52 | #define WM8350_SYSTEM_INTERRUPTS_MASK 0x20 | ||
53 | #define WM8350_INT_STATUS_1_MASK 0x21 | ||
54 | #define WM8350_INT_STATUS_2_MASK 0x22 | ||
55 | #define WM8350_POWER_UP_INT_STATUS_MASK 0x23 | ||
56 | #define WM8350_UNDER_VOLTAGE_INT_STATUS_MASK 0x24 | ||
57 | #define WM8350_OVER_CURRENT_INT_STATUS_MASK 0x25 | ||
58 | #define WM8350_GPIO_INT_STATUS_MASK 0x26 | ||
59 | #define WM8350_COMPARATOR_INT_STATUS_MASK 0x27 | ||
60 | |||
61 | #define WM8350_MAX_REGISTER 0xFF | ||
62 | |||
63 | /* | ||
64 | * Field Definitions. | ||
65 | */ | ||
66 | |||
67 | /* | ||
68 | * R0 (0x00) - Reset/ID | ||
69 | */ | ||
70 | #define WM8350_SW_RESET_CHIP_ID_MASK 0xFFFF | ||
71 | |||
72 | /* | ||
73 | * R1 (0x01) - ID | ||
74 | */ | ||
75 | #define WM8350_CHIP_REV_MASK 0x7000 | ||
76 | #define WM8350_CONF_STS_MASK 0x0C00 | ||
77 | #define WM8350_CUST_ID_MASK 0x00FF | ||
78 | |||
79 | /* | ||
80 | * R3 (0x03) - System Control 1 | ||
81 | */ | ||
82 | #define WM8350_CHIP_ON 0x8000 | ||
83 | #define WM8350_POWERCYCLE 0x2000 | ||
84 | #define WM8350_VCC_FAULT_OV 0x1000 | ||
85 | #define WM8350_REG_RSTB_TIME_MASK 0x0C00 | ||
86 | #define WM8350_BG_SLEEP 0x0200 | ||
87 | #define WM8350_MEM_VALID 0x0020 | ||
88 | #define WM8350_CHIP_SET_UP 0x0010 | ||
89 | #define WM8350_ON_DEB_T 0x0008 | ||
90 | #define WM8350_ON_POL 0x0002 | ||
91 | #define WM8350_IRQ_POL 0x0001 | ||
92 | |||
93 | /* | ||
94 | * R4 (0x04) - System Control 2 | ||
95 | */ | ||
96 | #define WM8350_USB_SUSPEND_8MA 0x8000 | ||
97 | #define WM8350_USB_SUSPEND 0x4000 | ||
98 | #define WM8350_USB_MSTR 0x2000 | ||
99 | #define WM8350_USB_MSTR_SRC 0x1000 | ||
100 | #define WM8350_USB_500MA 0x0800 | ||
101 | #define WM8350_USB_NOLIM 0x0400 | ||
102 | |||
103 | /* | ||
104 | * R5 (0x05) - System Hibernate | ||
105 | */ | ||
106 | #define WM8350_HIBERNATE 0x8000 | ||
107 | #define WM8350_WDOG_HIB_MODE 0x0080 | ||
108 | #define WM8350_REG_HIB_STARTUP_SEQ 0x0040 | ||
109 | #define WM8350_REG_RESET_HIB_MODE 0x0020 | ||
110 | #define WM8350_RST_HIB_MODE 0x0010 | ||
111 | #define WM8350_IRQ_HIB_MODE 0x0008 | ||
112 | #define WM8350_MEMRST_HIB_MODE 0x0004 | ||
113 | #define WM8350_PCCOMP_HIB_MODE 0x0002 | ||
114 | #define WM8350_TEMPMON_HIB_MODE 0x0001 | ||
115 | |||
116 | /* | ||
117 | * R6 (0x06) - Interface Control | ||
118 | */ | ||
119 | #define WM8350_USE_DEV_PINS 0x8000 | ||
120 | #define WM8350_USE_DEV_PINS_MASK 0x8000 | ||
121 | #define WM8350_USE_DEV_PINS_SHIFT 15 | ||
122 | #define WM8350_DEV_ADDR_MASK 0x6000 | ||
123 | #define WM8350_DEV_ADDR_SHIFT 13 | ||
124 | #define WM8350_CONFIG_DONE 0x1000 | ||
125 | #define WM8350_CONFIG_DONE_MASK 0x1000 | ||
126 | #define WM8350_CONFIG_DONE_SHIFT 12 | ||
127 | #define WM8350_RECONFIG_AT_ON 0x0800 | ||
128 | #define WM8350_RECONFIG_AT_ON_MASK 0x0800 | ||
129 | #define WM8350_RECONFIG_AT_ON_SHIFT 11 | ||
130 | #define WM8350_AUTOINC 0x0200 | ||
131 | #define WM8350_AUTOINC_MASK 0x0200 | ||
132 | #define WM8350_AUTOINC_SHIFT 9 | ||
133 | #define WM8350_ARA 0x0100 | ||
134 | #define WM8350_ARA_MASK 0x0100 | ||
135 | #define WM8350_ARA_SHIFT 8 | ||
136 | #define WM8350_SPI_CFG 0x0008 | ||
137 | #define WM8350_SPI_CFG_MASK 0x0008 | ||
138 | #define WM8350_SPI_CFG_SHIFT 3 | ||
139 | #define WM8350_SPI_4WIRE 0x0004 | ||
140 | #define WM8350_SPI_4WIRE_MASK 0x0004 | ||
141 | #define WM8350_SPI_4WIRE_SHIFT 2 | ||
142 | #define WM8350_SPI_3WIRE 0x0002 | ||
143 | #define WM8350_SPI_3WIRE_MASK 0x0002 | ||
144 | #define WM8350_SPI_3WIRE_SHIFT 1 | ||
145 | |||
146 | /* Bit values for R06 (0x06) */ | ||
147 | #define WM8350_USE_DEV_PINS_PRIMARY 0 | ||
148 | #define WM8350_USE_DEV_PINS_DEV 1 | ||
149 | |||
150 | #define WM8350_DEV_ADDR_34 0 | ||
151 | #define WM8350_DEV_ADDR_36 1 | ||
152 | #define WM8350_DEV_ADDR_3C 2 | ||
153 | #define WM8350_DEV_ADDR_3E 3 | ||
154 | |||
155 | #define WM8350_CONFIG_DONE_OFF 0 | ||
156 | #define WM8350_CONFIG_DONE_DONE 1 | ||
157 | |||
158 | #define WM8350_RECONFIG_AT_ON_OFF 0 | ||
159 | #define WM8350_RECONFIG_AT_ON_ON 1 | ||
160 | |||
161 | #define WM8350_AUTOINC_OFF 0 | ||
162 | #define WM8350_AUTOINC_ON 1 | ||
163 | |||
164 | #define WM8350_ARA_OFF 0 | ||
165 | #define WM8350_ARA_ON 1 | ||
166 | |||
167 | #define WM8350_SPI_CFG_CMOS 0 | ||
168 | #define WM8350_SPI_CFG_OD 1 | ||
169 | |||
170 | #define WM8350_SPI_4WIRE_3WIRE 0 | ||
171 | #define WM8350_SPI_4WIRE_4WIRE 1 | ||
172 | |||
173 | #define WM8350_SPI_3WIRE_I2C 0 | ||
174 | #define WM8350_SPI_3WIRE_SPI 1 | ||
175 | |||
176 | /* | ||
177 | * R8 (0x08) - Power mgmt (1) | ||
178 | */ | ||
179 | #define WM8350_CODEC_ISEL_MASK 0xC000 | ||
180 | #define WM8350_VBUFEN 0x2000 | ||
181 | #define WM8350_OUTPUT_DRAIN_EN 0x0400 | ||
182 | #define WM8350_MIC_DET_ENA 0x0100 | ||
183 | #define WM8350_BIASEN 0x0020 | ||
184 | #define WM8350_MICBEN 0x0010 | ||
185 | #define WM8350_VMIDEN 0x0004 | ||
186 | #define WM8350_VMID_MASK 0x0003 | ||
187 | #define WM8350_VMID_SHIFT 0 | ||
188 | |||
189 | /* | ||
190 | * R9 (0x09) - Power mgmt (2) | ||
191 | */ | ||
192 | #define WM8350_IN3R_ENA 0x0800 | ||
193 | #define WM8350_IN3L_ENA 0x0400 | ||
194 | #define WM8350_INR_ENA 0x0200 | ||
195 | #define WM8350_INL_ENA 0x0100 | ||
196 | #define WM8350_MIXINR_ENA 0x0080 | ||
197 | #define WM8350_MIXINL_ENA 0x0040 | ||
198 | #define WM8350_OUT4_ENA 0x0020 | ||
199 | #define WM8350_OUT3_ENA 0x0010 | ||
200 | #define WM8350_MIXOUTR_ENA 0x0002 | ||
201 | #define WM8350_MIXOUTL_ENA 0x0001 | ||
202 | |||
203 | /* | ||
204 | * R10 (0x0A) - Power mgmt (3) | ||
205 | */ | ||
206 | #define WM8350_IN3R_TO_OUT2R 0x0080 | ||
207 | #define WM8350_OUT2R_ENA 0x0008 | ||
208 | #define WM8350_OUT2L_ENA 0x0004 | ||
209 | #define WM8350_OUT1R_ENA 0x0002 | ||
210 | #define WM8350_OUT1L_ENA 0x0001 | ||
211 | |||
212 | /* | ||
213 | * R11 (0x0B) - Power mgmt (4) | ||
214 | */ | ||
215 | #define WM8350_SYSCLK_ENA 0x4000 | ||
216 | #define WM8350_ADC_HPF_ENA 0x2000 | ||
217 | #define WM8350_FLL_ENA 0x0800 | ||
218 | #define WM8350_FLL_OSC_ENA 0x0400 | ||
219 | #define WM8350_TOCLK_ENA 0x0100 | ||
220 | #define WM8350_DACR_ENA 0x0020 | ||
221 | #define WM8350_DACL_ENA 0x0010 | ||
222 | #define WM8350_ADCR_ENA 0x0008 | ||
223 | #define WM8350_ADCL_ENA 0x0004 | ||
224 | |||
225 | /* | ||
226 | * R12 (0x0C) - Power mgmt (5) | ||
227 | */ | ||
228 | #define WM8350_CODEC_ENA 0x1000 | ||
229 | #define WM8350_RTC_TICK_ENA 0x0800 | ||
230 | #define WM8350_OSC32K_ENA 0x0400 | ||
231 | #define WM8350_CHG_ENA 0x0200 | ||
232 | #define WM8350_ACC_DET_ENA 0x0100 | ||
233 | #define WM8350_AUXADC_ENA 0x0080 | ||
234 | #define WM8350_DCMP4_ENA 0x0008 | ||
235 | #define WM8350_DCMP3_ENA 0x0004 | ||
236 | #define WM8350_DCMP2_ENA 0x0002 | ||
237 | #define WM8350_DCMP1_ENA 0x0001 | ||
238 | |||
239 | /* | ||
240 | * R13 (0x0D) - Power mgmt (6) | ||
241 | */ | ||
242 | #define WM8350_LS_ENA 0x8000 | ||
243 | #define WM8350_LDO4_ENA 0x0800 | ||
244 | #define WM8350_LDO3_ENA 0x0400 | ||
245 | #define WM8350_LDO2_ENA 0x0200 | ||
246 | #define WM8350_LDO1_ENA 0x0100 | ||
247 | #define WM8350_DC6_ENA 0x0020 | ||
248 | #define WM8350_DC5_ENA 0x0010 | ||
249 | #define WM8350_DC4_ENA 0x0008 | ||
250 | #define WM8350_DC3_ENA 0x0004 | ||
251 | #define WM8350_DC2_ENA 0x0002 | ||
252 | #define WM8350_DC1_ENA 0x0001 | ||
253 | |||
254 | /* | ||
255 | * R14 (0x0E) - Power mgmt (7) | ||
256 | */ | ||
257 | #define WM8350_CS2_ENA 0x0002 | ||
258 | #define WM8350_CS1_ENA 0x0001 | ||
259 | |||
260 | /* | ||
261 | * R24 (0x18) - System Interrupts | ||
262 | */ | ||
263 | #define WM8350_OC_INT 0x2000 | ||
264 | #define WM8350_UV_INT 0x1000 | ||
265 | #define WM8350_PUTO_INT 0x0800 | ||
266 | #define WM8350_CS_INT 0x0200 | ||
267 | #define WM8350_EXT_INT 0x0100 | ||
268 | #define WM8350_CODEC_INT 0x0080 | ||
269 | #define WM8350_GP_INT 0x0040 | ||
270 | #define WM8350_AUXADC_INT 0x0020 | ||
271 | #define WM8350_RTC_INT 0x0010 | ||
272 | #define WM8350_SYS_INT 0x0008 | ||
273 | #define WM8350_CHG_INT 0x0004 | ||
274 | #define WM8350_USB_INT 0x0002 | ||
275 | #define WM8350_WKUP_INT 0x0001 | ||
276 | |||
277 | /* | ||
278 | * R25 (0x19) - Interrupt Status 1 | ||
279 | */ | ||
280 | #define WM8350_CHG_BAT_HOT_EINT 0x8000 | ||
281 | #define WM8350_CHG_BAT_COLD_EINT 0x4000 | ||
282 | #define WM8350_CHG_BAT_FAIL_EINT 0x2000 | ||
283 | #define WM8350_CHG_TO_EINT 0x1000 | ||
284 | #define WM8350_CHG_END_EINT 0x0800 | ||
285 | #define WM8350_CHG_START_EINT 0x0400 | ||
286 | #define WM8350_CHG_FAST_RDY_EINT 0x0200 | ||
287 | #define WM8350_RTC_PER_EINT 0x0080 | ||
288 | #define WM8350_RTC_SEC_EINT 0x0040 | ||
289 | #define WM8350_RTC_ALM_EINT 0x0020 | ||
290 | #define WM8350_CHG_VBATT_LT_3P9_EINT 0x0004 | ||
291 | #define WM8350_CHG_VBATT_LT_3P1_EINT 0x0002 | ||
292 | #define WM8350_CHG_VBATT_LT_2P85_EINT 0x0001 | ||
293 | |||
294 | /* | ||
295 | * R26 (0x1A) - Interrupt Status 2 | ||
296 | */ | ||
297 | #define WM8350_CS1_EINT 0x2000 | ||
298 | #define WM8350_CS2_EINT 0x1000 | ||
299 | #define WM8350_USB_LIMIT_EINT 0x0400 | ||
300 | #define WM8350_AUXADC_DATARDY_EINT 0x0100 | ||
301 | #define WM8350_AUXADC_DCOMP4_EINT 0x0080 | ||
302 | #define WM8350_AUXADC_DCOMP3_EINT 0x0040 | ||
303 | #define WM8350_AUXADC_DCOMP2_EINT 0x0020 | ||
304 | #define WM8350_AUXADC_DCOMP1_EINT 0x0010 | ||
305 | #define WM8350_SYS_HYST_COMP_FAIL_EINT 0x0008 | ||
306 | #define WM8350_SYS_CHIP_GT115_EINT 0x0004 | ||
307 | #define WM8350_SYS_CHIP_GT140_EINT 0x0002 | ||
308 | #define WM8350_SYS_WDOG_TO_EINT 0x0001 | ||
309 | |||
310 | /* | ||
311 | * R27 (0x1B) - Power Up Interrupt Status | ||
312 | */ | ||
313 | #define WM8350_PUTO_LDO4_EINT 0x0800 | ||
314 | #define WM8350_PUTO_LDO3_EINT 0x0400 | ||
315 | #define WM8350_PUTO_LDO2_EINT 0x0200 | ||
316 | #define WM8350_PUTO_LDO1_EINT 0x0100 | ||
317 | #define WM8350_PUTO_DC6_EINT 0x0020 | ||
318 | #define WM8350_PUTO_DC5_EINT 0x0010 | ||
319 | #define WM8350_PUTO_DC4_EINT 0x0008 | ||
320 | #define WM8350_PUTO_DC3_EINT 0x0004 | ||
321 | #define WM8350_PUTO_DC2_EINT 0x0002 | ||
322 | #define WM8350_PUTO_DC1_EINT 0x0001 | ||
323 | |||
324 | /* | ||
325 | * R28 (0x1C) - Under Voltage Interrupt status | ||
326 | */ | ||
327 | #define WM8350_UV_LDO4_EINT 0x0800 | ||
328 | #define WM8350_UV_LDO3_EINT 0x0400 | ||
329 | #define WM8350_UV_LDO2_EINT 0x0200 | ||
330 | #define WM8350_UV_LDO1_EINT 0x0100 | ||
331 | #define WM8350_UV_DC6_EINT 0x0020 | ||
332 | #define WM8350_UV_DC5_EINT 0x0010 | ||
333 | #define WM8350_UV_DC4_EINT 0x0008 | ||
334 | #define WM8350_UV_DC3_EINT 0x0004 | ||
335 | #define WM8350_UV_DC2_EINT 0x0002 | ||
336 | #define WM8350_UV_DC1_EINT 0x0001 | ||
337 | |||
338 | /* | ||
339 | * R29 (0x1D) - Over Current Interrupt status | ||
340 | */ | ||
341 | #define WM8350_OC_LS_EINT 0x8000 | ||
342 | |||
343 | /* | ||
344 | * R30 (0x1E) - GPIO Interrupt Status | ||
345 | */ | ||
346 | #define WM8350_GP12_EINT 0x1000 | ||
347 | #define WM8350_GP11_EINT 0x0800 | ||
348 | #define WM8350_GP10_EINT 0x0400 | ||
349 | #define WM8350_GP9_EINT 0x0200 | ||
350 | #define WM8350_GP8_EINT 0x0100 | ||
351 | #define WM8350_GP7_EINT 0x0080 | ||
352 | #define WM8350_GP6_EINT 0x0040 | ||
353 | #define WM8350_GP5_EINT 0x0020 | ||
354 | #define WM8350_GP4_EINT 0x0010 | ||
355 | #define WM8350_GP3_EINT 0x0008 | ||
356 | #define WM8350_GP2_EINT 0x0004 | ||
357 | #define WM8350_GP1_EINT 0x0002 | ||
358 | #define WM8350_GP0_EINT 0x0001 | ||
359 | |||
360 | /* | ||
361 | * R31 (0x1F) - Comparator Interrupt Status | ||
362 | */ | ||
363 | #define WM8350_EXT_USB_FB_EINT 0x8000 | ||
364 | #define WM8350_EXT_WALL_FB_EINT 0x4000 | ||
365 | #define WM8350_EXT_BAT_FB_EINT 0x2000 | ||
366 | #define WM8350_CODEC_JCK_DET_L_EINT 0x0800 | ||
367 | #define WM8350_CODEC_JCK_DET_R_EINT 0x0400 | ||
368 | #define WM8350_CODEC_MICSCD_EINT 0x0200 | ||
369 | #define WM8350_CODEC_MICD_EINT 0x0100 | ||
370 | #define WM8350_WKUP_OFF_STATE_EINT 0x0040 | ||
371 | #define WM8350_WKUP_HIB_STATE_EINT 0x0020 | ||
372 | #define WM8350_WKUP_CONV_FAULT_EINT 0x0010 | ||
373 | #define WM8350_WKUP_WDOG_RST_EINT 0x0008 | ||
374 | #define WM8350_WKUP_GP_PWR_ON_EINT 0x0004 | ||
375 | #define WM8350_WKUP_ONKEY_EINT 0x0002 | ||
376 | #define WM8350_WKUP_GP_WAKEUP_EINT 0x0001 | ||
377 | |||
378 | /* | ||
379 | * R32 (0x20) - System Interrupts Mask | ||
380 | */ | ||
381 | #define WM8350_IM_OC_INT 0x2000 | ||
382 | #define WM8350_IM_UV_INT 0x1000 | ||
383 | #define WM8350_IM_PUTO_INT 0x0800 | ||
384 | #define WM8350_IM_SPARE_INT 0x0400 | ||
385 | #define WM8350_IM_CS_INT 0x0200 | ||
386 | #define WM8350_IM_EXT_INT 0x0100 | ||
387 | #define WM8350_IM_CODEC_INT 0x0080 | ||
388 | #define WM8350_IM_GP_INT 0x0040 | ||
389 | #define WM8350_IM_AUXADC_INT 0x0020 | ||
390 | #define WM8350_IM_RTC_INT 0x0010 | ||
391 | #define WM8350_IM_SYS_INT 0x0008 | ||
392 | #define WM8350_IM_CHG_INT 0x0004 | ||
393 | #define WM8350_IM_USB_INT 0x0002 | ||
394 | #define WM8350_IM_WKUP_INT 0x0001 | ||
395 | |||
396 | /* | ||
397 | * R33 (0x21) - Interrupt Status 1 Mask | ||
398 | */ | ||
399 | #define WM8350_IM_CHG_BAT_HOT_EINT 0x8000 | ||
400 | #define WM8350_IM_CHG_BAT_COLD_EINT 0x4000 | ||
401 | #define WM8350_IM_CHG_BAT_FAIL_EINT 0x2000 | ||
402 | #define WM8350_IM_CHG_TO_EINT 0x1000 | ||
403 | #define WM8350_IM_CHG_END_EINT 0x0800 | ||
404 | #define WM8350_IM_CHG_START_EINT 0x0400 | ||
405 | #define WM8350_IM_CHG_FAST_RDY_EINT 0x0200 | ||
406 | #define WM8350_IM_RTC_PER_EINT 0x0080 | ||
407 | #define WM8350_IM_RTC_SEC_EINT 0x0040 | ||
408 | #define WM8350_IM_RTC_ALM_EINT 0x0020 | ||
409 | #define WM8350_IM_CHG_VBATT_LT_3P9_EINT 0x0004 | ||
410 | #define WM8350_IM_CHG_VBATT_LT_3P1_EINT 0x0002 | ||
411 | #define WM8350_IM_CHG_VBATT_LT_2P85_EINT 0x0001 | ||
412 | |||
413 | /* | ||
414 | * R34 (0x22) - Interrupt Status 2 Mask | ||
415 | */ | ||
416 | #define WM8350_IM_SPARE2_EINT 0x8000 | ||
417 | #define WM8350_IM_SPARE1_EINT 0x4000 | ||
418 | #define WM8350_IM_CS1_EINT 0x2000 | ||
419 | #define WM8350_IM_CS2_EINT 0x1000 | ||
420 | #define WM8350_IM_USB_LIMIT_EINT 0x0400 | ||
421 | #define WM8350_IM_AUXADC_DATARDY_EINT 0x0100 | ||
422 | #define WM8350_IM_AUXADC_DCOMP4_EINT 0x0080 | ||
423 | #define WM8350_IM_AUXADC_DCOMP3_EINT 0x0040 | ||
424 | #define WM8350_IM_AUXADC_DCOMP2_EINT 0x0020 | ||
425 | #define WM8350_IM_AUXADC_DCOMP1_EINT 0x0010 | ||
426 | #define WM8350_IM_SYS_HYST_COMP_FAIL_EINT 0x0008 | ||
427 | #define WM8350_IM_SYS_CHIP_GT115_EINT 0x0004 | ||
428 | #define WM8350_IM_SYS_CHIP_GT140_EINT 0x0002 | ||
429 | #define WM8350_IM_SYS_WDOG_TO_EINT 0x0001 | ||
430 | |||
431 | /* | ||
432 | * R35 (0x23) - Power Up Interrupt Status Mask | ||
433 | */ | ||
434 | #define WM8350_IM_PUTO_LDO4_EINT 0x0800 | ||
435 | #define WM8350_IM_PUTO_LDO3_EINT 0x0400 | ||
436 | #define WM8350_IM_PUTO_LDO2_EINT 0x0200 | ||
437 | #define WM8350_IM_PUTO_LDO1_EINT 0x0100 | ||
438 | #define WM8350_IM_PUTO_DC6_EINT 0x0020 | ||
439 | #define WM8350_IM_PUTO_DC5_EINT 0x0010 | ||
440 | #define WM8350_IM_PUTO_DC4_EINT 0x0008 | ||
441 | #define WM8350_IM_PUTO_DC3_EINT 0x0004 | ||
442 | #define WM8350_IM_PUTO_DC2_EINT 0x0002 | ||
443 | #define WM8350_IM_PUTO_DC1_EINT 0x0001 | ||
444 | |||
445 | /* | ||
446 | * R36 (0x24) - Under Voltage Interrupt status Mask | ||
447 | */ | ||
448 | #define WM8350_IM_UV_LDO4_EINT 0x0800 | ||
449 | #define WM8350_IM_UV_LDO3_EINT 0x0400 | ||
450 | #define WM8350_IM_UV_LDO2_EINT 0x0200 | ||
451 | #define WM8350_IM_UV_LDO1_EINT 0x0100 | ||
452 | #define WM8350_IM_UV_DC6_EINT 0x0020 | ||
453 | #define WM8350_IM_UV_DC5_EINT 0x0010 | ||
454 | #define WM8350_IM_UV_DC4_EINT 0x0008 | ||
455 | #define WM8350_IM_UV_DC3_EINT 0x0004 | ||
456 | #define WM8350_IM_UV_DC2_EINT 0x0002 | ||
457 | #define WM8350_IM_UV_DC1_EINT 0x0001 | ||
458 | |||
459 | /* | ||
460 | * R37 (0x25) - Over Current Interrupt status Mask | ||
461 | */ | ||
462 | #define WM8350_IM_OC_LS_EINT 0x8000 | ||
463 | |||
464 | /* | ||
465 | * R38 (0x26) - GPIO Interrupt Status Mask | ||
466 | */ | ||
467 | #define WM8350_IM_GP12_EINT 0x1000 | ||
468 | #define WM8350_IM_GP11_EINT 0x0800 | ||
469 | #define WM8350_IM_GP10_EINT 0x0400 | ||
470 | #define WM8350_IM_GP9_EINT 0x0200 | ||
471 | #define WM8350_IM_GP8_EINT 0x0100 | ||
472 | #define WM8350_IM_GP7_EINT 0x0080 | ||
473 | #define WM8350_IM_GP6_EINT 0x0040 | ||
474 | #define WM8350_IM_GP5_EINT 0x0020 | ||
475 | #define WM8350_IM_GP4_EINT 0x0010 | ||
476 | #define WM8350_IM_GP3_EINT 0x0008 | ||
477 | #define WM8350_IM_GP2_EINT 0x0004 | ||
478 | #define WM8350_IM_GP1_EINT 0x0002 | ||
479 | #define WM8350_IM_GP0_EINT 0x0001 | ||
480 | |||
481 | /* | ||
482 | * R39 (0x27) - Comparator Interrupt Status Mask | ||
483 | */ | ||
484 | #define WM8350_IM_EXT_USB_FB_EINT 0x8000 | ||
485 | #define WM8350_IM_EXT_WALL_FB_EINT 0x4000 | ||
486 | #define WM8350_IM_EXT_BAT_FB_EINT 0x2000 | ||
487 | #define WM8350_IM_CODEC_JCK_DET_L_EINT 0x0800 | ||
488 | #define WM8350_IM_CODEC_JCK_DET_R_EINT 0x0400 | ||
489 | #define WM8350_IM_CODEC_MICSCD_EINT 0x0200 | ||
490 | #define WM8350_IM_CODEC_MICD_EINT 0x0100 | ||
491 | #define WM8350_IM_WKUP_OFF_STATE_EINT 0x0040 | ||
492 | #define WM8350_IM_WKUP_HIB_STATE_EINT 0x0020 | ||
493 | #define WM8350_IM_WKUP_CONV_FAULT_EINT 0x0010 | ||
494 | #define WM8350_IM_WKUP_WDOG_RST_EINT 0x0008 | ||
495 | #define WM8350_IM_WKUP_GP_PWR_ON_EINT 0x0004 | ||
496 | #define WM8350_IM_WKUP_ONKEY_EINT 0x0002 | ||
497 | #define WM8350_IM_WKUP_GP_WAKEUP_EINT 0x0001 | ||
498 | |||
499 | /* | ||
500 | * R220 (0xDC) - RAM BIST 1 | ||
501 | */ | ||
502 | #define WM8350_READ_STATUS 0x0800 | ||
503 | #define WM8350_TSTRAM_CLK 0x0100 | ||
504 | #define WM8350_TSTRAM_CLK_ENA 0x0080 | ||
505 | #define WM8350_STARTSEQ 0x0040 | ||
506 | #define WM8350_READ_SRC 0x0020 | ||
507 | #define WM8350_COUNT_DIR 0x0010 | ||
508 | #define WM8350_TSTRAM_MODE_MASK 0x000E | ||
509 | #define WM8350_TSTRAM_ENA 0x0001 | ||
510 | |||
511 | /* | ||
512 | * R225 (0xE1) - DCDC/LDO status | ||
513 | */ | ||
514 | #define WM8350_LS_STS 0x8000 | ||
515 | #define WM8350_LDO4_STS 0x0800 | ||
516 | #define WM8350_LDO3_STS 0x0400 | ||
517 | #define WM8350_LDO2_STS 0x0200 | ||
518 | #define WM8350_LDO1_STS 0x0100 | ||
519 | #define WM8350_DC6_STS 0x0020 | ||
520 | #define WM8350_DC5_STS 0x0010 | ||
521 | #define WM8350_DC4_STS 0x0008 | ||
522 | #define WM8350_DC3_STS 0x0004 | ||
523 | #define WM8350_DC2_STS 0x0002 | ||
524 | #define WM8350_DC1_STS 0x0001 | ||
525 | |||
526 | /* WM8350 wake up conditions */ | ||
527 | #define WM8350_IRQ_WKUP_OFF_STATE 43 | ||
528 | #define WM8350_IRQ_WKUP_HIB_STATE 44 | ||
529 | #define WM8350_IRQ_WKUP_CONV_FAULT 45 | ||
530 | #define WM8350_IRQ_WKUP_WDOG_RST 46 | ||
531 | #define WM8350_IRQ_WKUP_GP_PWR_ON 47 | ||
532 | #define WM8350_IRQ_WKUP_ONKEY 48 | ||
533 | #define WM8350_IRQ_WKUP_GP_WAKEUP 49 | ||
534 | |||
535 | /* wm8350 chip revisions */ | ||
536 | #define WM8350_REV_E 0x4 | ||
537 | #define WM8350_REV_F 0x5 | ||
538 | #define WM8350_REV_G 0x6 | ||
539 | |||
540 | #define WM8350_NUM_IRQ 63 | ||
541 | |||
542 | struct wm8350_reg_access { | ||
543 | u16 readable; /* Mask of readable bits */ | ||
544 | u16 writable; /* Mask of writable bits */ | ||
545 | u16 vol; /* Mask of volatile bits */ | ||
546 | }; | ||
547 | extern const struct wm8350_reg_access wm8350_reg_io_map[]; | ||
548 | extern const u16 wm8350_mode0_defaults[]; | ||
549 | extern const u16 wm8350_mode1_defaults[]; | ||
550 | extern const u16 wm8350_mode2_defaults[]; | ||
551 | extern const u16 wm8350_mode3_defaults[]; | ||
552 | |||
553 | struct wm8350; | ||
554 | |||
555 | struct wm8350_irq { | ||
556 | void (*handler) (struct wm8350 *, int, void *); | ||
557 | void *data; | ||
558 | }; | ||
559 | |||
560 | struct wm8350 { | ||
561 | int rev; /* chip revision */ | ||
562 | |||
563 | struct device *dev; | ||
564 | |||
565 | /* device IO */ | ||
566 | union { | ||
567 | struct i2c_client *i2c_client; | ||
568 | struct spi_device *spi_device; | ||
569 | }; | ||
570 | int (*read_dev)(struct wm8350 *wm8350, char reg, int size, void *dest); | ||
571 | int (*write_dev)(struct wm8350 *wm8350, char reg, int size, | ||
572 | void *src); | ||
573 | u16 *reg_cache; | ||
574 | |||
575 | /* Interrupt handling */ | ||
576 | struct work_struct irq_work; | ||
577 | struct mutex irq_mutex; /* IRQ table mutex */ | ||
578 | struct wm8350_irq irq[WM8350_NUM_IRQ]; | ||
579 | int chip_irq; | ||
580 | |||
581 | /* Client devices */ | ||
582 | struct wm8350_codec codec; | ||
583 | struct wm8350_gpio gpio; | ||
584 | struct wm8350_pmic pmic; | ||
585 | struct wm8350_power power; | ||
586 | struct wm8350_rtc rtc; | ||
587 | struct wm8350_wdt wdt; | ||
588 | }; | ||
589 | |||
590 | /** | ||
591 | * Data to be supplied by the platform to initialise the WM8350. | ||
592 | * | ||
593 | * @init: Function called during driver initialisation. Should be | ||
594 | * used by the platform to configure GPIO functions and similar. | ||
595 | */ | ||
596 | struct wm8350_platform_data { | ||
597 | int (*init)(struct wm8350 *wm8350); | ||
598 | }; | ||
599 | |||
600 | |||
601 | /* | ||
602 | * WM8350 device initialisation and exit. | ||
603 | */ | ||
604 | int wm8350_device_init(struct wm8350 *wm8350, int irq, | ||
605 | struct wm8350_platform_data *pdata); | ||
606 | void wm8350_device_exit(struct wm8350 *wm8350); | ||
607 | |||
608 | /* | ||
609 | * WM8350 device IO | ||
610 | */ | ||
611 | int wm8350_clear_bits(struct wm8350 *wm8350, u16 reg, u16 mask); | ||
612 | int wm8350_set_bits(struct wm8350 *wm8350, u16 reg, u16 mask); | ||
613 | u16 wm8350_reg_read(struct wm8350 *wm8350, int reg); | ||
614 | int wm8350_reg_write(struct wm8350 *wm8350, int reg, u16 val); | ||
615 | int wm8350_reg_lock(struct wm8350 *wm8350); | ||
616 | int wm8350_reg_unlock(struct wm8350 *wm8350); | ||
617 | int wm8350_block_read(struct wm8350 *wm8350, int reg, int size, u16 *dest); | ||
618 | int wm8350_block_write(struct wm8350 *wm8350, int reg, int size, u16 *src); | ||
619 | |||
620 | /* | ||
621 | * WM8350 internal interrupts | ||
622 | */ | ||
623 | int wm8350_register_irq(struct wm8350 *wm8350, int irq, | ||
624 | void (*handler) (struct wm8350 *, int, void *), | ||
625 | void *data); | ||
626 | int wm8350_free_irq(struct wm8350 *wm8350, int irq); | ||
627 | int wm8350_mask_irq(struct wm8350 *wm8350, int irq); | ||
628 | int wm8350_unmask_irq(struct wm8350 *wm8350, int irq); | ||
629 | |||
630 | |||
631 | #endif | ||
diff --git a/include/linux/mfd/wm8350/gpio.h b/include/linux/mfd/wm8350/gpio.h new file mode 100644 index 000000000000..ed91e8f5d298 --- /dev/null +++ b/include/linux/mfd/wm8350/gpio.h | |||
@@ -0,0 +1,342 @@ | |||
1 | /* | ||
2 | * gpio.h -- GPIO Driver for Wolfson WM8350 PMIC | ||
3 | * | ||
4 | * Copyright 2007 Wolfson Microelectronics PLC | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify it | ||
7 | * under the terms of the GNU General Public License as published by the | ||
8 | * Free Software Foundation; either version 2 of the License, or (at your | ||
9 | * option) any later version. | ||
10 | * | ||
11 | */ | ||
12 | |||
13 | #ifndef __LINUX_MFD_WM8350_GPIO_H_ | ||
14 | #define __LINUX_MFD_WM8350_GPIO_H_ | ||
15 | |||
16 | #include <linux/platform_device.h> | ||
17 | |||
18 | /* | ||
19 | * GPIO Registers. | ||
20 | */ | ||
21 | #define WM8350_GPIO_DEBOUNCE 0x80 | ||
22 | #define WM8350_GPIO_PIN_PULL_UP_CONTROL 0x81 | ||
23 | #define WM8350_GPIO_PULL_DOWN_CONTROL 0x82 | ||
24 | #define WM8350_GPIO_INT_MODE 0x83 | ||
25 | #define WM8350_GPIO_CONTROL 0x85 | ||
26 | #define WM8350_GPIO_CONFIGURATION_I_O 0x86 | ||
27 | #define WM8350_GPIO_PIN_POLARITY_TYPE 0x87 | ||
28 | #define WM8350_GPIO_FUNCTION_SELECT_1 0x8C | ||
29 | #define WM8350_GPIO_FUNCTION_SELECT_2 0x8D | ||
30 | #define WM8350_GPIO_FUNCTION_SELECT_3 0x8E | ||
31 | #define WM8350_GPIO_FUNCTION_SELECT_4 0x8F | ||
32 | |||
33 | /* | ||
34 | * GPIO Functions | ||
35 | */ | ||
36 | #define WM8350_GPIO0_GPIO_IN 0x0 | ||
37 | #define WM8350_GPIO0_GPIO_OUT 0x0 | ||
38 | #define WM8350_GPIO0_PWR_ON_IN 0x1 | ||
39 | #define WM8350_GPIO0_PWR_ON_OUT 0x1 | ||
40 | #define WM8350_GPIO0_LDO_EN_IN 0x2 | ||
41 | #define WM8350_GPIO0_VRTC_OUT 0x2 | ||
42 | #define WM8350_GPIO0_LPWR1_IN 0x3 | ||
43 | #define WM8350_GPIO0_POR_B_OUT 0x3 | ||
44 | |||
45 | #define WM8350_GPIO1_GPIO_IN 0x0 | ||
46 | #define WM8350_GPIO1_GPIO_OUT 0x0 | ||
47 | #define WM8350_GPIO1_PWR_ON_IN 0x1 | ||
48 | #define WM8350_GPIO1_DO_CONF_OUT 0x1 | ||
49 | #define WM8350_GPIO1_LDO_EN_IN 0x2 | ||
50 | #define WM8350_GPIO1_RESET_OUT 0x2 | ||
51 | #define WM8350_GPIO1_LPWR2_IN 0x3 | ||
52 | #define WM8350_GPIO1_MEMRST_OUT 0x3 | ||
53 | |||
54 | #define WM8350_GPIO2_GPIO_IN 0x0 | ||
55 | #define WM8350_GPIO2_GPIO_OUT 0x0 | ||
56 | #define WM8350_GPIO2_PWR_ON_IN 0x1 | ||
57 | #define WM8350_GPIO2_PWR_ON_OUT 0x1 | ||
58 | #define WM8350_GPIO2_WAKE_UP_IN 0x2 | ||
59 | #define WM8350_GPIO2_VRTC_OUT 0x2 | ||
60 | #define WM8350_GPIO2_32KHZ_IN 0x3 | ||
61 | #define WM8350_GPIO2_32KHZ_OUT 0x3 | ||
62 | |||
63 | #define WM8350_GPIO3_GPIO_IN 0x0 | ||
64 | #define WM8350_GPIO3_GPIO_OUT 0x0 | ||
65 | #define WM8350_GPIO3_PWR_ON_IN 0x1 | ||
66 | #define WM8350_GPIO3_P_CLK_OUT 0x1 | ||
67 | #define WM8350_GPIO3_LDO_EN_IN 0x2 | ||
68 | #define WM8350_GPIO3_VRTC_OUT 0x2 | ||
69 | #define WM8350_GPIO3_PWR_OFF_IN 0x3 | ||
70 | #define WM8350_GPIO3_32KHZ_OUT 0x3 | ||
71 | |||
72 | #define WM8350_GPIO4_GPIO_IN 0x0 | ||
73 | #define WM8350_GPIO4_GPIO_OUT 0x0 | ||
74 | #define WM8350_GPIO4_MR_IN 0x1 | ||
75 | #define WM8350_GPIO4_MEM_RST_OUT 0x1 | ||
76 | #define WM8350_GPIO4_FLASH_IN 0x2 | ||
77 | #define WM8350_GPIO4_ADA_OUT 0x2 | ||
78 | #define WM8350_GPIO4_HIBERNATE_IN 0x3 | ||
79 | #define WM8350_GPIO4_FLASH_OUT 0x3 | ||
80 | #define WM8350_GPIO4_MICDET_OUT 0x4 | ||
81 | #define WM8350_GPIO4_MICSHT_OUT 0x5 | ||
82 | |||
83 | #define WM8350_GPIO5_GPIO_IN 0x0 | ||
84 | #define WM8350_GPIO5_GPIO_OUT 0x0 | ||
85 | #define WM8350_GPIO5_LPWR1_IN 0x1 | ||
86 | #define WM8350_GPIO5_P_CLK_OUT 0x1 | ||
87 | #define WM8350_GPIO5_ADCLRCLK_IN 0x2 | ||
88 | #define WM8350_GPIO5_ADCLRCLK_OUT 0x2 | ||
89 | #define WM8350_GPIO5_HIBERNATE_IN 0x3 | ||
90 | #define WM8350_GPIO5_32KHZ_OUT 0x3 | ||
91 | #define WM8350_GPIO5_MICDET_OUT 0x4 | ||
92 | #define WM8350_GPIO5_MICSHT_OUT 0x5 | ||
93 | #define WM8350_GPIO5_ADA_OUT 0x6 | ||
94 | #define WM8350_GPIO5_OPCLK_OUT 0x7 | ||
95 | |||
96 | #define WM8350_GPIO6_GPIO_IN 0x0 | ||
97 | #define WM8350_GPIO6_GPIO_OUT 0x0 | ||
98 | #define WM8350_GPIO6_LPWR2_IN 0x1 | ||
99 | #define WM8350_GPIO6_MEMRST_OUT 0x1 | ||
100 | #define WM8350_GPIO6_FLASH_IN 0x2 | ||
101 | #define WM8350_GPIO6_ADA_OUT 0x2 | ||
102 | #define WM8350_GPIO6_HIBERNATE_IN 0x3 | ||
103 | #define WM8350_GPIO6_RTC_OUT 0x3 | ||
104 | #define WM8350_GPIO6_MICDET_OUT 0x4 | ||
105 | #define WM8350_GPIO6_MICSHT_OUT 0x5 | ||
106 | #define WM8350_GPIO6_ADCLRCLKB_OUT 0x6 | ||
107 | #define WM8350_GPIO6_SDOUT_OUT 0x7 | ||
108 | |||
109 | #define WM8350_GPIO7_GPIO_IN 0x0 | ||
110 | #define WM8350_GPIO7_GPIO_OUT 0x0 | ||
111 | #define WM8350_GPIO7_LPWR3_IN 0x1 | ||
112 | #define WM8350_GPIO7_P_CLK_OUT 0x1 | ||
113 | #define WM8350_GPIO7_MASK_IN 0x2 | ||
114 | #define WM8350_GPIO7_VCC_FAULT_OUT 0x2 | ||
115 | #define WM8350_GPIO7_HIBERNATE_IN 0x3 | ||
116 | #define WM8350_GPIO7_BATT_FAULT_OUT 0x3 | ||
117 | #define WM8350_GPIO7_MICDET_OUT 0x4 | ||
118 | #define WM8350_GPIO7_MICSHT_OUT 0x5 | ||
119 | #define WM8350_GPIO7_ADA_OUT 0x6 | ||
120 | #define WM8350_GPIO7_CSB_IN 0x7 | ||
121 | |||
122 | #define WM8350_GPIO8_GPIO_IN 0x0 | ||
123 | #define WM8350_GPIO8_GPIO_OUT 0x0 | ||
124 | #define WM8350_GPIO8_MR_IN 0x1 | ||
125 | #define WM8350_GPIO8_VCC_FAULT_OUT 0x1 | ||
126 | #define WM8350_GPIO8_ADCBCLK_IN 0x2 | ||
127 | #define WM8350_GPIO8_ADCBCLK_OUT 0x2 | ||
128 | #define WM8350_GPIO8_PWR_OFF_IN 0x3 | ||
129 | #define WM8350_GPIO8_BATT_FAULT_OUT 0x3 | ||
130 | #define WM8350_GPIO8_ALTSCL_IN 0xf | ||
131 | |||
132 | #define WM8350_GPIO9_GPIO_IN 0x0 | ||
133 | #define WM8350_GPIO9_GPIO_OUT 0x0 | ||
134 | #define WM8350_GPIO9_HEARTBEAT_IN 0x1 | ||
135 | #define WM8350_GPIO9_VCC_FAULT_OUT 0x1 | ||
136 | #define WM8350_GPIO9_MASK_IN 0x2 | ||
137 | #define WM8350_GPIO9_LINE_GT_BATT_OUT 0x2 | ||
138 | #define WM8350_GPIO9_PWR_OFF_IN 0x3 | ||
139 | #define WM8350_GPIO9_BATT_FAULT_OUT 0x3 | ||
140 | #define WM8350_GPIO9_ALTSDA_OUT 0xf | ||
141 | |||
142 | #define WM8350_GPIO10_GPIO_IN 0x0 | ||
143 | #define WM8350_GPIO10_GPIO_OUT 0x0 | ||
144 | #define WM8350_GPIO10_ISINKC_OUT 0x1 | ||
145 | #define WM8350_GPIO10_PWR_OFF_IN 0x2 | ||
146 | #define WM8350_GPIO10_LINE_GT_BATT_OUT 0x2 | ||
147 | #define WM8350_GPIO10_CHD_IND_IN 0x3 | ||
148 | |||
149 | #define WM8350_GPIO11_GPIO_IN 0x0 | ||
150 | #define WM8350_GPIO11_GPIO_OUT 0x0 | ||
151 | #define WM8350_GPIO11_ISINKD_OUT 0x1 | ||
152 | #define WM8350_GPIO11_WAKEUP_IN 0x2 | ||
153 | #define WM8350_GPIO11_LINE_GT_BATT_OUT 0x2 | ||
154 | #define WM8350_GPIO11_CHD_IND_IN 0x3 | ||
155 | |||
156 | #define WM8350_GPIO12_GPIO_IN 0x0 | ||
157 | #define WM8350_GPIO12_GPIO_OUT 0x0 | ||
158 | #define WM8350_GPIO12_ISINKE_OUT 0x1 | ||
159 | #define WM8350_GPIO12_LINE_GT_BATT_OUT 0x2 | ||
160 | #define WM8350_GPIO12_LINE_EN_OUT 0x3 | ||
161 | #define WM8350_GPIO12_32KHZ_OUT 0x4 | ||
162 | |||
163 | #define WM8350_GPIO_DIR_IN 0 | ||
164 | #define WM8350_GPIO_DIR_OUT 1 | ||
165 | #define WM8350_GPIO_ACTIVE_LOW 0 | ||
166 | #define WM8350_GPIO_ACTIVE_HIGH 1 | ||
167 | #define WM8350_GPIO_PULL_NONE 0 | ||
168 | #define WM8350_GPIO_PULL_UP 1 | ||
169 | #define WM8350_GPIO_PULL_DOWN 2 | ||
170 | #define WM8350_GPIO_INVERT_OFF 0 | ||
171 | #define WM8350_GPIO_INVERT_ON 1 | ||
172 | #define WM8350_GPIO_DEBOUNCE_OFF 0 | ||
173 | #define WM8350_GPIO_DEBOUNCE_ON 1 | ||
174 | |||
175 | /* | ||
176 | * R128 (0x80) - GPIO Debounce | ||
177 | */ | ||
178 | #define WM8350_GP12_DB 0x1000 | ||
179 | #define WM8350_GP11_DB 0x0800 | ||
180 | #define WM8350_GP10_DB 0x0400 | ||
181 | #define WM8350_GP9_DB 0x0200 | ||
182 | #define WM8350_GP8_DB 0x0100 | ||
183 | #define WM8350_GP7_DB 0x0080 | ||
184 | #define WM8350_GP6_DB 0x0040 | ||
185 | #define WM8350_GP5_DB 0x0020 | ||
186 | #define WM8350_GP4_DB 0x0010 | ||
187 | #define WM8350_GP3_DB 0x0008 | ||
188 | #define WM8350_GP2_DB 0x0004 | ||
189 | #define WM8350_GP1_DB 0x0002 | ||
190 | #define WM8350_GP0_DB 0x0001 | ||
191 | |||
192 | /* | ||
193 | * R129 (0x81) - GPIO Pin pull up Control | ||
194 | */ | ||
195 | #define WM8350_GP12_PU 0x1000 | ||
196 | #define WM8350_GP11_PU 0x0800 | ||
197 | #define WM8350_GP10_PU 0x0400 | ||
198 | #define WM8350_GP9_PU 0x0200 | ||
199 | #define WM8350_GP8_PU 0x0100 | ||
200 | #define WM8350_GP7_PU 0x0080 | ||
201 | #define WM8350_GP6_PU 0x0040 | ||
202 | #define WM8350_GP5_PU 0x0020 | ||
203 | #define WM8350_GP4_PU 0x0010 | ||
204 | #define WM8350_GP3_PU 0x0008 | ||
205 | #define WM8350_GP2_PU 0x0004 | ||
206 | #define WM8350_GP1_PU 0x0002 | ||
207 | #define WM8350_GP0_PU 0x0001 | ||
208 | |||
209 | /* | ||
210 | * R130 (0x82) - GPIO Pull down Control | ||
211 | */ | ||
212 | #define WM8350_GP12_PD 0x1000 | ||
213 | #define WM8350_GP11_PD 0x0800 | ||
214 | #define WM8350_GP10_PD 0x0400 | ||
215 | #define WM8350_GP9_PD 0x0200 | ||
216 | #define WM8350_GP8_PD 0x0100 | ||
217 | #define WM8350_GP7_PD 0x0080 | ||
218 | #define WM8350_GP6_PD 0x0040 | ||
219 | #define WM8350_GP5_PD 0x0020 | ||
220 | #define WM8350_GP4_PD 0x0010 | ||
221 | #define WM8350_GP3_PD 0x0008 | ||
222 | #define WM8350_GP2_PD 0x0004 | ||
223 | #define WM8350_GP1_PD 0x0002 | ||
224 | #define WM8350_GP0_PD 0x0001 | ||
225 | |||
226 | /* | ||
227 | * R131 (0x83) - GPIO Interrupt Mode | ||
228 | */ | ||
229 | #define WM8350_GP12_INTMODE 0x1000 | ||
230 | #define WM8350_GP11_INTMODE 0x0800 | ||
231 | #define WM8350_GP10_INTMODE 0x0400 | ||
232 | #define WM8350_GP9_INTMODE 0x0200 | ||
233 | #define WM8350_GP8_INTMODE 0x0100 | ||
234 | #define WM8350_GP7_INTMODE 0x0080 | ||
235 | #define WM8350_GP6_INTMODE 0x0040 | ||
236 | #define WM8350_GP5_INTMODE 0x0020 | ||
237 | #define WM8350_GP4_INTMODE 0x0010 | ||
238 | #define WM8350_GP3_INTMODE 0x0008 | ||
239 | #define WM8350_GP2_INTMODE 0x0004 | ||
240 | #define WM8350_GP1_INTMODE 0x0002 | ||
241 | #define WM8350_GP0_INTMODE 0x0001 | ||
242 | |||
243 | /* | ||
244 | * R133 (0x85) - GPIO Control | ||
245 | */ | ||
246 | #define WM8350_GP_DBTIME_MASK 0x00C0 | ||
247 | |||
248 | /* | ||
249 | * R134 (0x86) - GPIO Configuration (i/o) | ||
250 | */ | ||
251 | #define WM8350_GP12_DIR 0x1000 | ||
252 | #define WM8350_GP11_DIR 0x0800 | ||
253 | #define WM8350_GP10_DIR 0x0400 | ||
254 | #define WM8350_GP9_DIR 0x0200 | ||
255 | #define WM8350_GP8_DIR 0x0100 | ||
256 | #define WM8350_GP7_DIR 0x0080 | ||
257 | #define WM8350_GP6_DIR 0x0040 | ||
258 | #define WM8350_GP5_DIR 0x0020 | ||
259 | #define WM8350_GP4_DIR 0x0010 | ||
260 | #define WM8350_GP3_DIR 0x0008 | ||
261 | #define WM8350_GP2_DIR 0x0004 | ||
262 | #define WM8350_GP1_DIR 0x0002 | ||
263 | #define WM8350_GP0_DIR 0x0001 | ||
264 | |||
265 | /* | ||
266 | * R135 (0x87) - GPIO Pin Polarity / Type | ||
267 | */ | ||
268 | #define WM8350_GP12_CFG 0x1000 | ||
269 | #define WM8350_GP11_CFG 0x0800 | ||
270 | #define WM8350_GP10_CFG 0x0400 | ||
271 | #define WM8350_GP9_CFG 0x0200 | ||
272 | #define WM8350_GP8_CFG 0x0100 | ||
273 | #define WM8350_GP7_CFG 0x0080 | ||
274 | #define WM8350_GP6_CFG 0x0040 | ||
275 | #define WM8350_GP5_CFG 0x0020 | ||
276 | #define WM8350_GP4_CFG 0x0010 | ||
277 | #define WM8350_GP3_CFG 0x0008 | ||
278 | #define WM8350_GP2_CFG 0x0004 | ||
279 | #define WM8350_GP1_CFG 0x0002 | ||
280 | #define WM8350_GP0_CFG 0x0001 | ||
281 | |||
282 | /* | ||
283 | * R140 (0x8C) - GPIO Function Select 1 | ||
284 | */ | ||
285 | #define WM8350_GP3_FN_MASK 0xF000 | ||
286 | #define WM8350_GP2_FN_MASK 0x0F00 | ||
287 | #define WM8350_GP1_FN_MASK 0x00F0 | ||
288 | #define WM8350_GP0_FN_MASK 0x000F | ||
289 | |||
290 | /* | ||
291 | * R141 (0x8D) - GPIO Function Select 2 | ||
292 | */ | ||
293 | #define WM8350_GP7_FN_MASK 0xF000 | ||
294 | #define WM8350_GP6_FN_MASK 0x0F00 | ||
295 | #define WM8350_GP5_FN_MASK 0x00F0 | ||
296 | #define WM8350_GP4_FN_MASK 0x000F | ||
297 | |||
298 | /* | ||
299 | * R142 (0x8E) - GPIO Function Select 3 | ||
300 | */ | ||
301 | #define WM8350_GP11_FN_MASK 0xF000 | ||
302 | #define WM8350_GP10_FN_MASK 0x0F00 | ||
303 | #define WM8350_GP9_FN_MASK 0x00F0 | ||
304 | #define WM8350_GP8_FN_MASK 0x000F | ||
305 | |||
306 | /* | ||
307 | * R143 (0x8F) - GPIO Function Select 4 | ||
308 | */ | ||
309 | #define WM8350_GP12_FN_MASK 0x000F | ||
310 | |||
311 | /* | ||
312 | * R230 (0xE6) - GPIO Pin Status | ||
313 | */ | ||
314 | #define WM8350_GP12_LVL 0x1000 | ||
315 | #define WM8350_GP11_LVL 0x0800 | ||
316 | #define WM8350_GP10_LVL 0x0400 | ||
317 | #define WM8350_GP9_LVL 0x0200 | ||
318 | #define WM8350_GP8_LVL 0x0100 | ||
319 | #define WM8350_GP7_LVL 0x0080 | ||
320 | #define WM8350_GP6_LVL 0x0040 | ||
321 | #define WM8350_GP5_LVL 0x0020 | ||
322 | #define WM8350_GP4_LVL 0x0010 | ||
323 | #define WM8350_GP3_LVL 0x0008 | ||
324 | #define WM8350_GP2_LVL 0x0004 | ||
325 | #define WM8350_GP1_LVL 0x0002 | ||
326 | #define WM8350_GP0_LVL 0x0001 | ||
327 | |||
328 | struct wm8350; | ||
329 | |||
330 | int wm8350_gpio_config(struct wm8350 *wm8350, int gpio, int dir, int func, | ||
331 | int pol, int pull, int invert, int debounce); | ||
332 | |||
333 | struct wm8350_gpio { | ||
334 | struct platform_device *pdev; | ||
335 | }; | ||
336 | |||
337 | /* | ||
338 | * GPIO Interrupts | ||
339 | */ | ||
340 | #define WM8350_IRQ_GPIO(x) (50 + x) | ||
341 | |||
342 | #endif | ||
diff --git a/include/linux/mfd/wm8350/pmic.h b/include/linux/mfd/wm8350/pmic.h new file mode 100644 index 000000000000..69b69e07f62f --- /dev/null +++ b/include/linux/mfd/wm8350/pmic.h | |||
@@ -0,0 +1,741 @@ | |||
1 | /* | ||
2 | * pmic.h -- Power Managment Driver for Wolfson WM8350 PMIC | ||
3 | * | ||
4 | * Copyright 2007 Wolfson Microelectronics PLC | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify it | ||
7 | * under the terms of the GNU General Public License as published by the | ||
8 | * Free Software Foundation; either version 2 of the License, or (at your | ||
9 | * option) any later version. | ||
10 | * | ||
11 | */ | ||
12 | |||
13 | #ifndef __LINUX_MFD_WM8350_PMIC_H | ||
14 | #define __LINUX_MFD_WM8350_PMIC_H | ||
15 | |||
16 | /* | ||
17 | * Register values. | ||
18 | */ | ||
19 | |||
20 | #define WM8350_CURRENT_SINK_DRIVER_A 0xAC | ||
21 | #define WM8350_CSA_FLASH_CONTROL 0xAD | ||
22 | #define WM8350_CURRENT_SINK_DRIVER_B 0xAE | ||
23 | #define WM8350_CSB_FLASH_CONTROL 0xAF | ||
24 | #define WM8350_DCDC_LDO_REQUESTED 0xB0 | ||
25 | #define WM8350_DCDC_ACTIVE_OPTIONS 0xB1 | ||
26 | #define WM8350_DCDC_SLEEP_OPTIONS 0xB2 | ||
27 | #define WM8350_POWER_CHECK_COMPARATOR 0xB3 | ||
28 | #define WM8350_DCDC1_CONTROL 0xB4 | ||
29 | #define WM8350_DCDC1_TIMEOUTS 0xB5 | ||
30 | #define WM8350_DCDC1_LOW_POWER 0xB6 | ||
31 | #define WM8350_DCDC2_CONTROL 0xB7 | ||
32 | #define WM8350_DCDC2_TIMEOUTS 0xB8 | ||
33 | #define WM8350_DCDC3_CONTROL 0xBA | ||
34 | #define WM8350_DCDC3_TIMEOUTS 0xBB | ||
35 | #define WM8350_DCDC3_LOW_POWER 0xBC | ||
36 | #define WM8350_DCDC4_CONTROL 0xBD | ||
37 | #define WM8350_DCDC4_TIMEOUTS 0xBE | ||
38 | #define WM8350_DCDC4_LOW_POWER 0xBF | ||
39 | #define WM8350_DCDC5_CONTROL 0xC0 | ||
40 | #define WM8350_DCDC5_TIMEOUTS 0xC1 | ||
41 | #define WM8350_DCDC6_CONTROL 0xC3 | ||
42 | #define WM8350_DCDC6_TIMEOUTS 0xC4 | ||
43 | #define WM8350_DCDC6_LOW_POWER 0xC5 | ||
44 | #define WM8350_LIMIT_SWITCH_CONTROL 0xC7 | ||
45 | #define WM8350_LDO1_CONTROL 0xC8 | ||
46 | #define WM8350_LDO1_TIMEOUTS 0xC9 | ||
47 | #define WM8350_LDO1_LOW_POWER 0xCA | ||
48 | #define WM8350_LDO2_CONTROL 0xCB | ||
49 | #define WM8350_LDO2_TIMEOUTS 0xCC | ||
50 | #define WM8350_LDO2_LOW_POWER 0xCD | ||
51 | #define WM8350_LDO3_CONTROL 0xCE | ||
52 | #define WM8350_LDO3_TIMEOUTS 0xCF | ||
53 | #define WM8350_LDO3_LOW_POWER 0xD0 | ||
54 | #define WM8350_LDO4_CONTROL 0xD1 | ||
55 | #define WM8350_LDO4_TIMEOUTS 0xD2 | ||
56 | #define WM8350_LDO4_LOW_POWER 0xD3 | ||
57 | #define WM8350_VCC_FAULT_MASKS 0xD7 | ||
58 | #define WM8350_MAIN_BANDGAP_CONTROL 0xD8 | ||
59 | #define WM8350_OSC_CONTROL 0xD9 | ||
60 | #define WM8350_RTC_TICK_CONTROL 0xDA | ||
61 | #define WM8350_SECURITY 0xDB | ||
62 | #define WM8350_RAM_BIST_1 0xDC | ||
63 | #define WM8350_DCDC_LDO_STATUS 0xE1 | ||
64 | #define WM8350_GPIO_PIN_STATUS 0xE6 | ||
65 | |||
66 | #define WM8350_DCDC1_FORCE_PWM 0xF8 | ||
67 | #define WM8350_DCDC3_FORCE_PWM 0xFA | ||
68 | #define WM8350_DCDC4_FORCE_PWM 0xFB | ||
69 | #define WM8350_DCDC6_FORCE_PWM 0xFD | ||
70 | |||
71 | /* | ||
72 | * R172 (0xAC) - Current Sink Driver A | ||
73 | */ | ||
74 | #define WM8350_CS1_HIB_MODE 0x1000 | ||
75 | #define WM8350_CS1_HIB_MODE_MASK 0x1000 | ||
76 | #define WM8350_CS1_HIB_MODE_SHIFT 12 | ||
77 | #define WM8350_CS1_ISEL_MASK 0x003F | ||
78 | #define WM8350_CS1_ISEL_SHIFT 0 | ||
79 | |||
80 | /* Bit values for R172 (0xAC) */ | ||
81 | #define WM8350_CS1_HIB_MODE_DISABLE 0 | ||
82 | #define WM8350_CS1_HIB_MODE_LEAVE 1 | ||
83 | |||
84 | #define WM8350_CS1_ISEL_220M 0x3F | ||
85 | |||
86 | /* | ||
87 | * R173 (0xAD) - CSA Flash control | ||
88 | */ | ||
89 | #define WM8350_CS1_FLASH_MODE 0x8000 | ||
90 | #define WM8350_CS1_TRIGSRC 0x4000 | ||
91 | #define WM8350_CS1_DRIVE 0x2000 | ||
92 | #define WM8350_CS1_FLASH_DUR_MASK 0x0300 | ||
93 | #define WM8350_CS1_OFF_RAMP_MASK 0x0030 | ||
94 | #define WM8350_CS1_ON_RAMP_MASK 0x0003 | ||
95 | |||
96 | /* | ||
97 | * R174 (0xAE) - Current Sink Driver B | ||
98 | */ | ||
99 | #define WM8350_CS2_HIB_MODE 0x1000 | ||
100 | #define WM8350_CS2_ISEL_MASK 0x003F | ||
101 | |||
102 | /* | ||
103 | * R175 (0xAF) - CSB Flash control | ||
104 | */ | ||
105 | #define WM8350_CS2_FLASH_MODE 0x8000 | ||
106 | #define WM8350_CS2_TRIGSRC 0x4000 | ||
107 | #define WM8350_CS2_DRIVE 0x2000 | ||
108 | #define WM8350_CS2_FLASH_DUR_MASK 0x0300 | ||
109 | #define WM8350_CS2_OFF_RAMP_MASK 0x0030 | ||
110 | #define WM8350_CS2_ON_RAMP_MASK 0x0003 | ||
111 | |||
112 | /* | ||
113 | * R176 (0xB0) - DCDC/LDO requested | ||
114 | */ | ||
115 | #define WM8350_LS_ENA 0x8000 | ||
116 | #define WM8350_LDO4_ENA 0x0800 | ||
117 | #define WM8350_LDO3_ENA 0x0400 | ||
118 | #define WM8350_LDO2_ENA 0x0200 | ||
119 | #define WM8350_LDO1_ENA 0x0100 | ||
120 | #define WM8350_DC6_ENA 0x0020 | ||
121 | #define WM8350_DC5_ENA 0x0010 | ||
122 | #define WM8350_DC4_ENA 0x0008 | ||
123 | #define WM8350_DC3_ENA 0x0004 | ||
124 | #define WM8350_DC2_ENA 0x0002 | ||
125 | #define WM8350_DC1_ENA 0x0001 | ||
126 | |||
127 | /* | ||
128 | * R177 (0xB1) - DCDC Active options | ||
129 | */ | ||
130 | #define WM8350_PUTO_MASK 0x3000 | ||
131 | #define WM8350_PWRUP_DELAY_MASK 0x0300 | ||
132 | #define WM8350_DC6_ACTIVE 0x0020 | ||
133 | #define WM8350_DC4_ACTIVE 0x0008 | ||
134 | #define WM8350_DC3_ACTIVE 0x0004 | ||
135 | #define WM8350_DC1_ACTIVE 0x0001 | ||
136 | |||
137 | /* | ||
138 | * R178 (0xB2) - DCDC Sleep options | ||
139 | */ | ||
140 | #define WM8350_DC6_SLEEP 0x0020 | ||
141 | #define WM8350_DC4_SLEEP 0x0008 | ||
142 | #define WM8350_DC3_SLEEP 0x0004 | ||
143 | #define WM8350_DC1_SLEEP 0x0001 | ||
144 | |||
145 | /* | ||
146 | * R179 (0xB3) - Power-check comparator | ||
147 | */ | ||
148 | #define WM8350_PCCMP_ERRACT 0x4000 | ||
149 | #define WM8350_PCCMP_RAIL 0x0100 | ||
150 | #define WM8350_PCCMP_OFF_THR_MASK 0x0070 | ||
151 | #define WM8350_PCCMP_ON_THR_MASK 0x0007 | ||
152 | |||
153 | /* | ||
154 | * R180 (0xB4) - DCDC1 Control | ||
155 | */ | ||
156 | #define WM8350_DC1_OPFLT 0x0400 | ||
157 | #define WM8350_DC1_VSEL_MASK 0x007F | ||
158 | #define WM8350_DC1_VSEL_SHIFT 0 | ||
159 | |||
160 | /* | ||
161 | * R181 (0xB5) - DCDC1 Timeouts | ||
162 | */ | ||
163 | #define WM8350_DC1_ERRACT_MASK 0xC000 | ||
164 | #define WM8350_DC1_ERRACT_SHIFT 14 | ||
165 | #define WM8350_DC1_ENSLOT_MASK 0x3C00 | ||
166 | #define WM8350_DC1_ENSLOT_SHIFT 10 | ||
167 | #define WM8350_DC1_SDSLOT_MASK 0x03C0 | ||
168 | #define WM8350_DC1_UVTO_MASK 0x0030 | ||
169 | #define WM8350_DC1_SDSLOT_SHIFT 6 | ||
170 | |||
171 | /* Bit values for R181 (0xB5) */ | ||
172 | #define WM8350_DC1_ERRACT_NONE 0 | ||
173 | #define WM8350_DC1_ERRACT_SHUTDOWN_CONV 1 | ||
174 | #define WM8350_DC1_ERRACT_SHUTDOWN_SYS 2 | ||
175 | |||
176 | /* | ||
177 | * R182 (0xB6) - DCDC1 Low Power | ||
178 | */ | ||
179 | #define WM8350_DC1_HIB_MODE_MASK 0x7000 | ||
180 | #define WM8350_DC1_HIB_TRIG_MASK 0x0300 | ||
181 | #define WM8350_DC1_VIMG_MASK 0x007F | ||
182 | |||
183 | /* | ||
184 | * R183 (0xB7) - DCDC2 Control | ||
185 | */ | ||
186 | #define WM8350_DC2_MODE 0x4000 | ||
187 | #define WM8350_DC2_MODE_MASK 0x4000 | ||
188 | #define WM8350_DC2_MODE_SHIFT 14 | ||
189 | #define WM8350_DC2_HIB_MODE 0x1000 | ||
190 | #define WM8350_DC2_HIB_MODE_MASK 0x1000 | ||
191 | #define WM8350_DC2_HIB_MODE_SHIFT 12 | ||
192 | #define WM8350_DC2_HIB_TRIG_MASK 0x0300 | ||
193 | #define WM8350_DC2_HIB_TRIG_SHIFT 8 | ||
194 | #define WM8350_DC2_ILIM 0x0040 | ||
195 | #define WM8350_DC2_ILIM_MASK 0x0040 | ||
196 | #define WM8350_DC2_ILIM_SHIFT 6 | ||
197 | #define WM8350_DC2_RMP_MASK 0x0018 | ||
198 | #define WM8350_DC2_RMP_SHIFT 3 | ||
199 | #define WM8350_DC2_FBSRC_MASK 0x0003 | ||
200 | #define WM8350_DC2_FBSRC_SHIFT 0 | ||
201 | |||
202 | /* Bit values for R183 (0xB7) */ | ||
203 | #define WM8350_DC2_MODE_BOOST 0 | ||
204 | #define WM8350_DC2_MODE_SWITCH 1 | ||
205 | |||
206 | #define WM8350_DC2_HIB_MODE_ACTIVE 1 | ||
207 | #define WM8350_DC2_HIB_MODE_DISABLE 0 | ||
208 | |||
209 | #define WM8350_DC2_HIB_TRIG_NONE 0 | ||
210 | #define WM8350_DC2_HIB_TRIG_LPWR1 1 | ||
211 | #define WM8350_DC2_HIB_TRIG_LPWR2 2 | ||
212 | #define WM8350_DC2_HIB_TRIG_LPWR3 3 | ||
213 | |||
214 | #define WM8350_DC2_ILIM_HIGH 0 | ||
215 | #define WM8350_DC2_ILIM_LOW 1 | ||
216 | |||
217 | #define WM8350_DC2_RMP_30V 0 | ||
218 | #define WM8350_DC2_RMP_20V 1 | ||
219 | #define WM8350_DC2_RMP_10V 2 | ||
220 | #define WM8350_DC2_RMP_5V 3 | ||
221 | |||
222 | #define WM8350_DC2_FBSRC_FB2 0 | ||
223 | #define WM8350_DC2_FBSRC_ISINKA 1 | ||
224 | #define WM8350_DC2_FBSRC_ISINKB 2 | ||
225 | #define WM8350_DC2_FBSRC_USB 3 | ||
226 | |||
227 | /* | ||
228 | * R184 (0xB8) - DCDC2 Timeouts | ||
229 | */ | ||
230 | #define WM8350_DC2_ERRACT_MASK 0xC000 | ||
231 | #define WM8350_DC2_ERRACT_SHIFT 14 | ||
232 | #define WM8350_DC2_ENSLOT_MASK 0x3C00 | ||
233 | #define WM8350_DC2_ENSLOT_SHIFT 10 | ||
234 | #define WM8350_DC2_SDSLOT_MASK 0x03C0 | ||
235 | #define WM8350_DC2_UVTO_MASK 0x0030 | ||
236 | |||
237 | /* Bit values for R184 (0xB8) */ | ||
238 | #define WM8350_DC2_ERRACT_NONE 0 | ||
239 | #define WM8350_DC2_ERRACT_SHUTDOWN_CONV 1 | ||
240 | #define WM8350_DC2_ERRACT_SHUTDOWN_SYS 2 | ||
241 | |||
242 | /* | ||
243 | * R186 (0xBA) - DCDC3 Control | ||
244 | */ | ||
245 | #define WM8350_DC3_OPFLT 0x0400 | ||
246 | #define WM8350_DC3_VSEL_MASK 0x007F | ||
247 | #define WM8350_DC3_VSEL_SHIFT 0 | ||
248 | |||
249 | /* | ||
250 | * R187 (0xBB) - DCDC3 Timeouts | ||
251 | */ | ||
252 | #define WM8350_DC3_ERRACT_MASK 0xC000 | ||
253 | #define WM8350_DC3_ERRACT_SHIFT 14 | ||
254 | #define WM8350_DC3_ENSLOT_MASK 0x3C00 | ||
255 | #define WM8350_DC3_ENSLOT_SHIFT 10 | ||
256 | #define WM8350_DC3_SDSLOT_MASK 0x03C0 | ||
257 | #define WM8350_DC3_UVTO_MASK 0x0030 | ||
258 | #define WM8350_DC3_SDSLOT_SHIFT 6 | ||
259 | |||
260 | /* Bit values for R187 (0xBB) */ | ||
261 | #define WM8350_DC3_ERRACT_NONE 0 | ||
262 | #define WM8350_DC3_ERRACT_SHUTDOWN_CONV 1 | ||
263 | #define WM8350_DC3_ERRACT_SHUTDOWN_SYS 2 | ||
264 | /* | ||
265 | * R188 (0xBC) - DCDC3 Low Power | ||
266 | */ | ||
267 | #define WM8350_DC3_HIB_MODE_MASK 0x7000 | ||
268 | #define WM8350_DC3_HIB_TRIG_MASK 0x0300 | ||
269 | #define WM8350_DC3_VIMG_MASK 0x007F | ||
270 | |||
271 | /* | ||
272 | * R189 (0xBD) - DCDC4 Control | ||
273 | */ | ||
274 | #define WM8350_DC4_OPFLT 0x0400 | ||
275 | #define WM8350_DC4_VSEL_MASK 0x007F | ||
276 | #define WM8350_DC4_VSEL_SHIFT 0 | ||
277 | |||
278 | /* | ||
279 | * R190 (0xBE) - DCDC4 Timeouts | ||
280 | */ | ||
281 | #define WM8350_DC4_ERRACT_MASK 0xC000 | ||
282 | #define WM8350_DC4_ERRACT_SHIFT 14 | ||
283 | #define WM8350_DC4_ENSLOT_MASK 0x3C00 | ||
284 | #define WM8350_DC4_ENSLOT_SHIFT 10 | ||
285 | #define WM8350_DC4_SDSLOT_MASK 0x03C0 | ||
286 | #define WM8350_DC4_UVTO_MASK 0x0030 | ||
287 | #define WM8350_DC4_SDSLOT_SHIFT 6 | ||
288 | |||
289 | /* Bit values for R190 (0xBE) */ | ||
290 | #define WM8350_DC4_ERRACT_NONE 0 | ||
291 | #define WM8350_DC4_ERRACT_SHUTDOWN_CONV 1 | ||
292 | #define WM8350_DC4_ERRACT_SHUTDOWN_SYS 2 | ||
293 | |||
294 | /* | ||
295 | * R191 (0xBF) - DCDC4 Low Power | ||
296 | */ | ||
297 | #define WM8350_DC4_HIB_MODE_MASK 0x7000 | ||
298 | #define WM8350_DC4_HIB_TRIG_MASK 0x0300 | ||
299 | #define WM8350_DC4_VIMG_MASK 0x007F | ||
300 | |||
301 | /* | ||
302 | * R192 (0xC0) - DCDC5 Control | ||
303 | */ | ||
304 | #define WM8350_DC5_MODE 0x4000 | ||
305 | #define WM8350_DC5_MODE_MASK 0x4000 | ||
306 | #define WM8350_DC5_MODE_SHIFT 14 | ||
307 | #define WM8350_DC5_HIB_MODE 0x1000 | ||
308 | #define WM8350_DC5_HIB_MODE_MASK 0x1000 | ||
309 | #define WM8350_DC5_HIB_MODE_SHIFT 12 | ||
310 | #define WM8350_DC5_HIB_TRIG_MASK 0x0300 | ||
311 | #define WM8350_DC5_HIB_TRIG_SHIFT 8 | ||
312 | #define WM8350_DC5_ILIM 0x0040 | ||
313 | #define WM8350_DC5_ILIM_MASK 0x0040 | ||
314 | #define WM8350_DC5_ILIM_SHIFT 6 | ||
315 | #define WM8350_DC5_RMP_MASK 0x0018 | ||
316 | #define WM8350_DC5_RMP_SHIFT 3 | ||
317 | #define WM8350_DC5_FBSRC_MASK 0x0003 | ||
318 | #define WM8350_DC5_FBSRC_SHIFT 0 | ||
319 | |||
320 | /* Bit values for R192 (0xC0) */ | ||
321 | #define WM8350_DC5_MODE_BOOST 0 | ||
322 | #define WM8350_DC5_MODE_SWITCH 1 | ||
323 | |||
324 | #define WM8350_DC5_HIB_MODE_ACTIVE 1 | ||
325 | #define WM8350_DC5_HIB_MODE_DISABLE 0 | ||
326 | |||
327 | #define WM8350_DC5_HIB_TRIG_NONE 0 | ||
328 | #define WM8350_DC5_HIB_TRIG_LPWR1 1 | ||
329 | #define WM8350_DC5_HIB_TRIG_LPWR2 2 | ||
330 | #define WM8350_DC5_HIB_TRIG_LPWR3 3 | ||
331 | |||
332 | #define WM8350_DC5_ILIM_HIGH 0 | ||
333 | #define WM8350_DC5_ILIM_LOW 1 | ||
334 | |||
335 | #define WM8350_DC5_RMP_30V 0 | ||
336 | #define WM8350_DC5_RMP_20V 1 | ||
337 | #define WM8350_DC5_RMP_10V 2 | ||
338 | #define WM8350_DC5_RMP_5V 3 | ||
339 | |||
340 | #define WM8350_DC5_FBSRC_FB2 0 | ||
341 | #define WM8350_DC5_FBSRC_ISINKA 1 | ||
342 | #define WM8350_DC5_FBSRC_ISINKB 2 | ||
343 | #define WM8350_DC5_FBSRC_USB 3 | ||
344 | |||
345 | /* | ||
346 | * R193 (0xC1) - DCDC5 Timeouts | ||
347 | */ | ||
348 | #define WM8350_DC5_ERRACT_MASK 0xC000 | ||
349 | #define WM8350_DC5_ERRACT_SHIFT 14 | ||
350 | #define WM8350_DC5_ENSLOT_MASK 0x3C00 | ||
351 | #define WM8350_DC5_ENSLOT_SHIFT 10 | ||
352 | #define WM8350_DC5_SDSLOT_MASK 0x03C0 | ||
353 | #define WM8350_DC5_UVTO_MASK 0x0030 | ||
354 | #define WM8350_DC5_SDSLOT_SHIFT 6 | ||
355 | |||
356 | /* Bit values for R193 (0xC1) */ | ||
357 | #define WM8350_DC5_ERRACT_NONE 0 | ||
358 | #define WM8350_DC5_ERRACT_SHUTDOWN_CONV 1 | ||
359 | #define WM8350_DC5_ERRACT_SHUTDOWN_SYS 2 | ||
360 | |||
361 | /* | ||
362 | * R195 (0xC3) - DCDC6 Control | ||
363 | */ | ||
364 | #define WM8350_DC6_OPFLT 0x0400 | ||
365 | #define WM8350_DC6_VSEL_MASK 0x007F | ||
366 | #define WM8350_DC6_VSEL_SHIFT 0 | ||
367 | |||
368 | /* | ||
369 | * R196 (0xC4) - DCDC6 Timeouts | ||
370 | */ | ||
371 | #define WM8350_DC6_ERRACT_MASK 0xC000 | ||
372 | #define WM8350_DC6_ERRACT_SHIFT 14 | ||
373 | #define WM8350_DC6_ENSLOT_MASK 0x3C00 | ||
374 | #define WM8350_DC6_ENSLOT_SHIFT 10 | ||
375 | #define WM8350_DC6_SDSLOT_MASK 0x03C0 | ||
376 | #define WM8350_DC6_UVTO_MASK 0x0030 | ||
377 | #define WM8350_DC6_SDSLOT_SHIFT 6 | ||
378 | |||
379 | /* Bit values for R196 (0xC4) */ | ||
380 | #define WM8350_DC6_ERRACT_NONE 0 | ||
381 | #define WM8350_DC6_ERRACT_SHUTDOWN_CONV 1 | ||
382 | #define WM8350_DC6_ERRACT_SHUTDOWN_SYS 2 | ||
383 | |||
384 | /* | ||
385 | * R197 (0xC5) - DCDC6 Low Power | ||
386 | */ | ||
387 | #define WM8350_DC6_HIB_MODE_MASK 0x7000 | ||
388 | #define WM8350_DC6_HIB_TRIG_MASK 0x0300 | ||
389 | #define WM8350_DC6_VIMG_MASK 0x007F | ||
390 | |||
391 | /* | ||
392 | * R199 (0xC7) - Limit Switch Control | ||
393 | */ | ||
394 | #define WM8350_LS_ERRACT_MASK 0xC000 | ||
395 | #define WM8350_LS_ERRACT_SHIFT 14 | ||
396 | #define WM8350_LS_ENSLOT_MASK 0x3C00 | ||
397 | #define WM8350_LS_ENSLOT_SHIFT 10 | ||
398 | #define WM8350_LS_SDSLOT_MASK 0x03C0 | ||
399 | #define WM8350_LS_SDSLOT_SHIFT 6 | ||
400 | #define WM8350_LS_HIB_MODE 0x0010 | ||
401 | #define WM8350_LS_HIB_MODE_MASK 0x0010 | ||
402 | #define WM8350_LS_HIB_MODE_SHIFT 4 | ||
403 | #define WM8350_LS_HIB_PROT 0x0002 | ||
404 | #define WM8350_LS_HIB_PROT_MASK 0x0002 | ||
405 | #define WM8350_LS_HIB_PROT_SHIFT 1 | ||
406 | #define WM8350_LS_PROT 0x0001 | ||
407 | #define WM8350_LS_PROT_MASK 0x0001 | ||
408 | #define WM8350_LS_PROT_SHIFT 0 | ||
409 | |||
410 | /* Bit values for R199 (0xC7) */ | ||
411 | #define WM8350_LS_ERRACT_NONE 0 | ||
412 | #define WM8350_LS_ERRACT_SHUTDOWN_CONV 1 | ||
413 | #define WM8350_LS_ERRACT_SHUTDOWN_SYS 2 | ||
414 | |||
415 | /* | ||
416 | * R200 (0xC8) - LDO1 Control | ||
417 | */ | ||
418 | #define WM8350_LDO1_SWI 0x4000 | ||
419 | #define WM8350_LDO1_OPFLT 0x0400 | ||
420 | #define WM8350_LDO1_VSEL_MASK 0x001F | ||
421 | #define WM8350_LDO1_VSEL_SHIFT 0 | ||
422 | |||
423 | /* | ||
424 | * R201 (0xC9) - LDO1 Timeouts | ||
425 | */ | ||
426 | #define WM8350_LDO1_ERRACT_MASK 0xC000 | ||
427 | #define WM8350_LDO1_ERRACT_SHIFT 14 | ||
428 | #define WM8350_LDO1_ENSLOT_MASK 0x3C00 | ||
429 | #define WM8350_LDO1_ENSLOT_SHIFT 10 | ||
430 | #define WM8350_LDO1_SDSLOT_MASK 0x03C0 | ||
431 | #define WM8350_LDO1_UVTO_MASK 0x0030 | ||
432 | #define WM8350_LDO1_SDSLOT_SHIFT 6 | ||
433 | |||
434 | /* Bit values for R201 (0xC9) */ | ||
435 | #define WM8350_LDO1_ERRACT_NONE 0 | ||
436 | #define WM8350_LDO1_ERRACT_SHUTDOWN_CONV 1 | ||
437 | #define WM8350_LDO1_ERRACT_SHUTDOWN_SYS 2 | ||
438 | |||
439 | /* | ||
440 | * R202 (0xCA) - LDO1 Low Power | ||
441 | */ | ||
442 | #define WM8350_LDO1_HIB_MODE_MASK 0x3000 | ||
443 | #define WM8350_LDO1_HIB_TRIG_MASK 0x0300 | ||
444 | #define WM8350_LDO1_VIMG_MASK 0x001F | ||
445 | #define WM8350_LDO1_HIB_MODE_DIS (0x1 << 12) | ||
446 | |||
447 | |||
448 | /* | ||
449 | * R203 (0xCB) - LDO2 Control | ||
450 | */ | ||
451 | #define WM8350_LDO2_SWI 0x4000 | ||
452 | #define WM8350_LDO2_OPFLT 0x0400 | ||
453 | #define WM8350_LDO2_VSEL_MASK 0x001F | ||
454 | #define WM8350_LDO2_VSEL_SHIFT 0 | ||
455 | |||
456 | /* | ||
457 | * R204 (0xCC) - LDO2 Timeouts | ||
458 | */ | ||
459 | #define WM8350_LDO2_ERRACT_MASK 0xC000 | ||
460 | #define WM8350_LDO2_ERRACT_SHIFT 14 | ||
461 | #define WM8350_LDO2_ENSLOT_MASK 0x3C00 | ||
462 | #define WM8350_LDO2_ENSLOT_SHIFT 10 | ||
463 | #define WM8350_LDO2_SDSLOT_MASK 0x03C0 | ||
464 | #define WM8350_LDO2_SDSLOT_SHIFT 6 | ||
465 | |||
466 | /* Bit values for R204 (0xCC) */ | ||
467 | #define WM8350_LDO2_ERRACT_NONE 0 | ||
468 | #define WM8350_LDO2_ERRACT_SHUTDOWN_CONV 1 | ||
469 | #define WM8350_LDO2_ERRACT_SHUTDOWN_SYS 2 | ||
470 | |||
471 | /* | ||
472 | * R205 (0xCD) - LDO2 Low Power | ||
473 | */ | ||
474 | #define WM8350_LDO2_HIB_MODE_MASK 0x3000 | ||
475 | #define WM8350_LDO2_HIB_TRIG_MASK 0x0300 | ||
476 | #define WM8350_LDO2_VIMG_MASK 0x001F | ||
477 | |||
478 | /* | ||
479 | * R206 (0xCE) - LDO3 Control | ||
480 | */ | ||
481 | #define WM8350_LDO3_SWI 0x4000 | ||
482 | #define WM8350_LDO3_OPFLT 0x0400 | ||
483 | #define WM8350_LDO3_VSEL_MASK 0x001F | ||
484 | #define WM8350_LDO3_VSEL_SHIFT 0 | ||
485 | |||
486 | /* | ||
487 | * R207 (0xCF) - LDO3 Timeouts | ||
488 | */ | ||
489 | #define WM8350_LDO3_ERRACT_MASK 0xC000 | ||
490 | #define WM8350_LDO3_ERRACT_SHIFT 14 | ||
491 | #define WM8350_LDO3_ENSLOT_MASK 0x3C00 | ||
492 | #define WM8350_LDO3_ENSLOT_SHIFT 10 | ||
493 | #define WM8350_LDO3_SDSLOT_MASK 0x03C0 | ||
494 | #define WM8350_LDO3_UVTO_MASK 0x0030 | ||
495 | #define WM8350_LDO3_SDSLOT_SHIFT 6 | ||
496 | |||
497 | /* Bit values for R207 (0xCF) */ | ||
498 | #define WM8350_LDO3_ERRACT_NONE 0 | ||
499 | #define WM8350_LDO3_ERRACT_SHUTDOWN_CONV 1 | ||
500 | #define WM8350_LDO3_ERRACT_SHUTDOWN_SYS 2 | ||
501 | |||
502 | /* | ||
503 | * R208 (0xD0) - LDO3 Low Power | ||
504 | */ | ||
505 | #define WM8350_LDO3_HIB_MODE_MASK 0x3000 | ||
506 | #define WM8350_LDO3_HIB_TRIG_MASK 0x0300 | ||
507 | #define WM8350_LDO3_VIMG_MASK 0x001F | ||
508 | |||
509 | /* | ||
510 | * R209 (0xD1) - LDO4 Control | ||
511 | */ | ||
512 | #define WM8350_LDO4_SWI 0x4000 | ||
513 | #define WM8350_LDO4_OPFLT 0x0400 | ||
514 | #define WM8350_LDO4_VSEL_MASK 0x001F | ||
515 | #define WM8350_LDO4_VSEL_SHIFT 0 | ||
516 | |||
517 | /* | ||
518 | * R210 (0xD2) - LDO4 Timeouts | ||
519 | */ | ||
520 | #define WM8350_LDO4_ERRACT_MASK 0xC000 | ||
521 | #define WM8350_LDO4_ERRACT_SHIFT 14 | ||
522 | #define WM8350_LDO4_ENSLOT_MASK 0x3C00 | ||
523 | #define WM8350_LDO4_ENSLOT_SHIFT 10 | ||
524 | #define WM8350_LDO4_SDSLOT_MASK 0x03C0 | ||
525 | #define WM8350_LDO4_UVTO_MASK 0x0030 | ||
526 | #define WM8350_LDO4_SDSLOT_SHIFT 6 | ||
527 | |||
528 | /* Bit values for R210 (0xD2) */ | ||
529 | #define WM8350_LDO4_ERRACT_NONE 0 | ||
530 | #define WM8350_LDO4_ERRACT_SHUTDOWN_CONV 1 | ||
531 | #define WM8350_LDO4_ERRACT_SHUTDOWN_SYS 2 | ||
532 | |||
533 | /* | ||
534 | * R211 (0xD3) - LDO4 Low Power | ||
535 | */ | ||
536 | #define WM8350_LDO4_HIB_MODE_MASK 0x3000 | ||
537 | #define WM8350_LDO4_HIB_TRIG_MASK 0x0300 | ||
538 | #define WM8350_LDO4_VIMG_MASK 0x001F | ||
539 | |||
540 | /* | ||
541 | * R215 (0xD7) - VCC_FAULT Masks | ||
542 | */ | ||
543 | #define WM8350_LS_FAULT 0x8000 | ||
544 | #define WM8350_LDO4_FAULT 0x0800 | ||
545 | #define WM8350_LDO3_FAULT 0x0400 | ||
546 | #define WM8350_LDO2_FAULT 0x0200 | ||
547 | #define WM8350_LDO1_FAULT 0x0100 | ||
548 | #define WM8350_DC6_FAULT 0x0020 | ||
549 | #define WM8350_DC5_FAULT 0x0010 | ||
550 | #define WM8350_DC4_FAULT 0x0008 | ||
551 | #define WM8350_DC3_FAULT 0x0004 | ||
552 | #define WM8350_DC2_FAULT 0x0002 | ||
553 | #define WM8350_DC1_FAULT 0x0001 | ||
554 | |||
555 | /* | ||
556 | * R216 (0xD8) - Main Bandgap Control | ||
557 | */ | ||
558 | #define WM8350_MBG_LOAD_FUSES 0x8000 | ||
559 | #define WM8350_MBG_FUSE_WPREP 0x4000 | ||
560 | #define WM8350_MBG_FUSE_WRITE 0x2000 | ||
561 | #define WM8350_MBG_FUSE_TRIM_MASK 0x1F00 | ||
562 | #define WM8350_MBG_TRIM_SRC 0x0020 | ||
563 | #define WM8350_MBG_USER_TRIM_MASK 0x001F | ||
564 | |||
565 | /* | ||
566 | * R217 (0xD9) - OSC Control | ||
567 | */ | ||
568 | #define WM8350_OSC_LOAD_FUSES 0x8000 | ||
569 | #define WM8350_OSC_FUSE_WPREP 0x4000 | ||
570 | #define WM8350_OSC_FUSE_WRITE 0x2000 | ||
571 | #define WM8350_OSC_FUSE_TRIM_MASK 0x0F00 | ||
572 | #define WM8350_OSC_TRIM_SRC 0x0020 | ||
573 | #define WM8350_OSC_USER_TRIM_MASK 0x000F | ||
574 | |||
575 | /* | ||
576 | * R248 (0xF8) - DCDC1 Force PWM | ||
577 | */ | ||
578 | #define WM8350_DCDC1_FORCE_PWM_ENA 0x0010 | ||
579 | |||
580 | /* | ||
581 | * R250 (0xFA) - DCDC3 Force PWM | ||
582 | */ | ||
583 | #define WM8350_DCDC3_FORCE_PWM_ENA 0x0010 | ||
584 | |||
585 | /* | ||
586 | * R251 (0xFB) - DCDC4 Force PWM | ||
587 | */ | ||
588 | #define WM8350_DCDC4_FORCE_PWM_ENA 0x0010 | ||
589 | |||
590 | /* | ||
591 | * R253 (0xFD) - DCDC1 Force PWM | ||
592 | */ | ||
593 | #define WM8350_DCDC6_FORCE_PWM_ENA 0x0010 | ||
594 | |||
595 | /* | ||
596 | * DCDC's | ||
597 | */ | ||
598 | #define WM8350_DCDC_1 0 | ||
599 | #define WM8350_DCDC_2 1 | ||
600 | #define WM8350_DCDC_3 2 | ||
601 | #define WM8350_DCDC_4 3 | ||
602 | #define WM8350_DCDC_5 4 | ||
603 | #define WM8350_DCDC_6 5 | ||
604 | |||
605 | /* DCDC modes */ | ||
606 | #define WM8350_DCDC_ACTIVE_STANDBY 0 | ||
607 | #define WM8350_DCDC_ACTIVE_PULSE 1 | ||
608 | #define WM8350_DCDC_SLEEP_NORMAL 0 | ||
609 | #define WM8350_DCDC_SLEEP_LOW 1 | ||
610 | |||
611 | /* DCDC Low power (Hibernate) mode */ | ||
612 | #define WM8350_DCDC_HIB_MODE_CUR (0 << 12) | ||
613 | #define WM8350_DCDC_HIB_MODE_IMAGE (1 << 12) | ||
614 | #define WM8350_DCDC_HIB_MODE_STANDBY (2 << 12) | ||
615 | #define WM8350_DCDC_HIB_MODE_LDO (4 << 12) | ||
616 | #define WM8350_DCDC_HIB_MODE_LDO_IM (5 << 12) | ||
617 | #define WM8350_DCDC_HIB_MODE_DIS (7 << 12) | ||
618 | #define WM8350_DCDC_HIB_MODE_MASK (7 << 12) | ||
619 | |||
620 | /* DCDC Low Power (Hibernate) signal */ | ||
621 | #define WM8350_DCDC_HIB_SIG_REG (0 << 8) | ||
622 | #define WM8350_DCDC_HIB_SIG_LPWR1 (1 << 8) | ||
623 | #define WM8350_DCDC_HIB_SIG_LPWR2 (2 << 8) | ||
624 | #define WM8350_DCDC_HIB_SIG_LPWR3 (3 << 8) | ||
625 | |||
626 | /* LDO Low power (Hibernate) mode */ | ||
627 | #define WM8350_LDO_HIB_MODE_IMAGE (0 << 0) | ||
628 | #define WM8350_LDO_HIB_MODE_DIS (1 << 0) | ||
629 | |||
630 | /* LDO Low Power (Hibernate) signal */ | ||
631 | #define WM8350_LDO_HIB_SIG_REG (0 << 8) | ||
632 | #define WM8350_LDO_HIB_SIG_LPWR1 (1 << 8) | ||
633 | #define WM8350_LDO_HIB_SIG_LPWR2 (2 << 8) | ||
634 | #define WM8350_LDO_HIB_SIG_LPWR3 (3 << 8) | ||
635 | |||
636 | /* | ||
637 | * LDOs | ||
638 | */ | ||
639 | #define WM8350_LDO_1 6 | ||
640 | #define WM8350_LDO_2 7 | ||
641 | #define WM8350_LDO_3 8 | ||
642 | #define WM8350_LDO_4 9 | ||
643 | |||
644 | /* | ||
645 | * ISINKs | ||
646 | */ | ||
647 | #define WM8350_ISINK_A 10 | ||
648 | #define WM8350_ISINK_B 11 | ||
649 | |||
650 | #define WM8350_ISINK_MODE_BOOST 0 | ||
651 | #define WM8350_ISINK_MODE_SWITCH 1 | ||
652 | #define WM8350_ISINK_ILIM_NORMAL 0 | ||
653 | #define WM8350_ISINK_ILIM_LOW 1 | ||
654 | |||
655 | #define WM8350_ISINK_FLASH_DISABLE 0 | ||
656 | #define WM8350_ISINK_FLASH_ENABLE 1 | ||
657 | #define WM8350_ISINK_FLASH_TRIG_BIT 0 | ||
658 | #define WM8350_ISINK_FLASH_TRIG_GPIO 1 | ||
659 | #define WM8350_ISINK_FLASH_MODE_EN (1 << 13) | ||
660 | #define WM8350_ISINK_FLASH_MODE_DIS (0 << 13) | ||
661 | #define WM8350_ISINK_FLASH_DUR_32MS (0 << 8) | ||
662 | #define WM8350_ISINK_FLASH_DUR_64MS (1 << 8) | ||
663 | #define WM8350_ISINK_FLASH_DUR_96MS (2 << 8) | ||
664 | #define WM8350_ISINK_FLASH_DUR_1024MS (3 << 8) | ||
665 | #define WM8350_ISINK_FLASH_ON_INSTANT (0 << 4) | ||
666 | #define WM8350_ISINK_FLASH_ON_0_25S (1 << 4) | ||
667 | #define WM8350_ISINK_FLASH_ON_0_50S (2 << 4) | ||
668 | #define WM8350_ISINK_FLASH_ON_1_00S (3 << 4) | ||
669 | #define WM8350_ISINK_FLASH_ON_1_95S (1 << 4) | ||
670 | #define WM8350_ISINK_FLASH_ON_3_91S (2 << 4) | ||
671 | #define WM8350_ISINK_FLASH_ON_7_80S (3 << 4) | ||
672 | #define WM8350_ISINK_FLASH_OFF_INSTANT (0 << 0) | ||
673 | #define WM8350_ISINK_FLASH_OFF_0_25S (1 << 0) | ||
674 | #define WM8350_ISINK_FLASH_OFF_0_50S (2 << 0) | ||
675 | #define WM8350_ISINK_FLASH_OFF_1_00S (3 << 0) | ||
676 | #define WM8350_ISINK_FLASH_OFF_1_95S (1 << 0) | ||
677 | #define WM8350_ISINK_FLASH_OFF_3_91S (2 << 0) | ||
678 | #define WM8350_ISINK_FLASH_OFF_7_80S (3 << 0) | ||
679 | |||
680 | /* | ||
681 | * Regulator Interrupts. | ||
682 | */ | ||
683 | #define WM8350_IRQ_CS1 13 | ||
684 | #define WM8350_IRQ_CS2 14 | ||
685 | #define WM8350_IRQ_UV_LDO4 25 | ||
686 | #define WM8350_IRQ_UV_LDO3 26 | ||
687 | #define WM8350_IRQ_UV_LDO2 27 | ||
688 | #define WM8350_IRQ_UV_LDO1 28 | ||
689 | #define WM8350_IRQ_UV_DC6 29 | ||
690 | #define WM8350_IRQ_UV_DC5 30 | ||
691 | #define WM8350_IRQ_UV_DC4 31 | ||
692 | #define WM8350_IRQ_UV_DC3 32 | ||
693 | #define WM8350_IRQ_UV_DC2 33 | ||
694 | #define WM8350_IRQ_UV_DC1 34 | ||
695 | #define WM8350_IRQ_OC_LS 35 | ||
696 | |||
697 | #define NUM_WM8350_REGULATORS 12 | ||
698 | |||
699 | struct wm8350; | ||
700 | struct platform_device; | ||
701 | struct regulator_init_data; | ||
702 | |||
703 | struct wm8350_pmic { | ||
704 | /* ISINK to DCDC mapping */ | ||
705 | int isink_A_dcdc; | ||
706 | int isink_B_dcdc; | ||
707 | |||
708 | /* hibernate configs */ | ||
709 | u16 dcdc1_hib_mode; | ||
710 | u16 dcdc3_hib_mode; | ||
711 | u16 dcdc4_hib_mode; | ||
712 | u16 dcdc6_hib_mode; | ||
713 | |||
714 | /* regulator devices */ | ||
715 | struct platform_device *pdev[NUM_WM8350_REGULATORS]; | ||
716 | }; | ||
717 | |||
718 | int wm8350_register_regulator(struct wm8350 *wm8350, int reg, | ||
719 | struct regulator_init_data *initdata); | ||
720 | |||
721 | /* | ||
722 | * Additional DCDC control not supported via regulator API | ||
723 | */ | ||
724 | int wm8350_dcdc_set_slot(struct wm8350 *wm8350, int dcdc, u16 start, | ||
725 | u16 stop, u16 fault); | ||
726 | int wm8350_dcdc25_set_mode(struct wm8350 *wm8350, int dcdc, u16 mode, | ||
727 | u16 ilim, u16 ramp, u16 feedback); | ||
728 | |||
729 | /* | ||
730 | * Additional LDO control not supported via regulator API | ||
731 | */ | ||
732 | int wm8350_ldo_set_slot(struct wm8350 *wm8350, int ldo, u16 start, u16 stop); | ||
733 | |||
734 | /* | ||
735 | * Additional ISINK control not supported via regulator API | ||
736 | */ | ||
737 | int wm8350_isink_set_flash(struct wm8350 *wm8350, int isink, u16 mode, | ||
738 | u16 trigger, u16 duration, u16 on_ramp, | ||
739 | u16 off_ramp, u16 drive); | ||
740 | |||
741 | #endif | ||
diff --git a/include/linux/mfd/wm8350/rtc.h b/include/linux/mfd/wm8350/rtc.h new file mode 100644 index 000000000000..dfda69e9f440 --- /dev/null +++ b/include/linux/mfd/wm8350/rtc.h | |||
@@ -0,0 +1,266 @@ | |||
1 | /* | ||
2 | * rtc.h -- RTC driver for Wolfson WM8350 PMIC | ||
3 | * | ||
4 | * Copyright 2007 Wolfson Microelectronics PLC | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify it | ||
7 | * under the terms of the GNU General Public License as published by the | ||
8 | * Free Software Foundation; either version 2 of the License, or (at your | ||
9 | * option) any later version. | ||
10 | */ | ||
11 | |||
12 | #ifndef __LINUX_MFD_WM8350_RTC_H | ||
13 | #define __LINUX_MFD_WM8350_RTC_H | ||
14 | |||
15 | #include <linux/platform_device.h> | ||
16 | |||
17 | /* | ||
18 | * Register values. | ||
19 | */ | ||
20 | #define WM8350_RTC_SECONDS_MINUTES 0x10 | ||
21 | #define WM8350_RTC_HOURS_DAY 0x11 | ||
22 | #define WM8350_RTC_DATE_MONTH 0x12 | ||
23 | #define WM8350_RTC_YEAR 0x13 | ||
24 | #define WM8350_ALARM_SECONDS_MINUTES 0x14 | ||
25 | #define WM8350_ALARM_HOURS_DAY 0x15 | ||
26 | #define WM8350_ALARM_DATE_MONTH 0x16 | ||
27 | #define WM8350_RTC_TIME_CONTROL 0x17 | ||
28 | |||
29 | /* | ||
30 | * R16 (0x10) - RTC Seconds/Minutes | ||
31 | */ | ||
32 | #define WM8350_RTC_MINS_MASK 0x7F00 | ||
33 | #define WM8350_RTC_MINS_SHIFT 8 | ||
34 | #define WM8350_RTC_SECS_MASK 0x007F | ||
35 | #define WM8350_RTC_SECS_SHIFT 0 | ||
36 | |||
37 | /* | ||
38 | * R17 (0x11) - RTC Hours/Day | ||
39 | */ | ||
40 | #define WM8350_RTC_DAY_MASK 0x0700 | ||
41 | #define WM8350_RTC_DAY_SHIFT 8 | ||
42 | #define WM8350_RTC_HPM_MASK 0x0020 | ||
43 | #define WM8350_RTC_HPM_SHIFT 5 | ||
44 | #define WM8350_RTC_HRS_MASK 0x001F | ||
45 | #define WM8350_RTC_HRS_SHIFT 0 | ||
46 | |||
47 | /* Bit values for R21 (0x15) */ | ||
48 | #define WM8350_RTC_DAY_SUN 1 | ||
49 | #define WM8350_RTC_DAY_MON 2 | ||
50 | #define WM8350_RTC_DAY_TUE 3 | ||
51 | #define WM8350_RTC_DAY_WED 4 | ||
52 | #define WM8350_RTC_DAY_THU 5 | ||
53 | #define WM8350_RTC_DAY_FRI 6 | ||
54 | #define WM8350_RTC_DAY_SAT 7 | ||
55 | |||
56 | #define WM8350_RTC_HPM_AM 0 | ||
57 | #define WM8350_RTC_HPM_PM 1 | ||
58 | |||
59 | /* | ||
60 | * R18 (0x12) - RTC Date/Month | ||
61 | */ | ||
62 | #define WM8350_RTC_MTH_MASK 0x1F00 | ||
63 | #define WM8350_RTC_MTH_SHIFT 8 | ||
64 | #define WM8350_RTC_DATE_MASK 0x003F | ||
65 | #define WM8350_RTC_DATE_SHIFT 0 | ||
66 | |||
67 | /* Bit values for R22 (0x16) */ | ||
68 | #define WM8350_RTC_MTH_JAN 1 | ||
69 | #define WM8350_RTC_MTH_FEB 2 | ||
70 | #define WM8350_RTC_MTH_MAR 3 | ||
71 | #define WM8350_RTC_MTH_APR 4 | ||
72 | #define WM8350_RTC_MTH_MAY 5 | ||
73 | #define WM8350_RTC_MTH_JUN 6 | ||
74 | #define WM8350_RTC_MTH_JUL 7 | ||
75 | #define WM8350_RTC_MTH_AUG 8 | ||
76 | #define WM8350_RTC_MTH_SEP 9 | ||
77 | #define WM8350_RTC_MTH_OCT 10 | ||
78 | #define WM8350_RTC_MTH_NOV 11 | ||
79 | #define WM8350_RTC_MTH_DEC 12 | ||
80 | #define WM8350_RTC_MTH_JAN_BCD 0x01 | ||
81 | #define WM8350_RTC_MTH_FEB_BCD 0x02 | ||
82 | #define WM8350_RTC_MTH_MAR_BCD 0x03 | ||
83 | #define WM8350_RTC_MTH_APR_BCD 0x04 | ||
84 | #define WM8350_RTC_MTH_MAY_BCD 0x05 | ||
85 | #define WM8350_RTC_MTH_JUN_BCD 0x06 | ||
86 | #define WM8350_RTC_MTH_JUL_BCD 0x07 | ||
87 | #define WM8350_RTC_MTH_AUG_BCD 0x08 | ||
88 | #define WM8350_RTC_MTH_SEP_BCD 0x09 | ||
89 | #define WM8350_RTC_MTH_OCT_BCD 0x10 | ||
90 | #define WM8350_RTC_MTH_NOV_BCD 0x11 | ||
91 | #define WM8350_RTC_MTH_DEC_BCD 0x12 | ||
92 | |||
93 | /* | ||
94 | * R19 (0x13) - RTC Year | ||
95 | */ | ||
96 | #define WM8350_RTC_YHUNDREDS_MASK 0x3F00 | ||
97 | #define WM8350_RTC_YHUNDREDS_SHIFT 8 | ||
98 | #define WM8350_RTC_YUNITS_MASK 0x00FF | ||
99 | #define WM8350_RTC_YUNITS_SHIFT 0 | ||
100 | |||
101 | /* | ||
102 | * R20 (0x14) - Alarm Seconds/Minutes | ||
103 | */ | ||
104 | #define WM8350_RTC_ALMMINS_MASK 0x7F00 | ||
105 | #define WM8350_RTC_ALMMINS_SHIFT 8 | ||
106 | #define WM8350_RTC_ALMSECS_MASK 0x007F | ||
107 | #define WM8350_RTC_ALMSECS_SHIFT 0 | ||
108 | |||
109 | /* Bit values for R20 (0x14) */ | ||
110 | #define WM8350_RTC_ALMMINS_DONT_CARE -1 | ||
111 | #define WM8350_RTC_ALMSECS_DONT_CARE -1 | ||
112 | |||
113 | /* | ||
114 | * R21 (0x15) - Alarm Hours/Day | ||
115 | */ | ||
116 | #define WM8350_RTC_ALMDAY_MASK 0x0F00 | ||
117 | #define WM8350_RTC_ALMDAY_SHIFT 8 | ||
118 | #define WM8350_RTC_ALMHPM_MASK 0x0020 | ||
119 | #define WM8350_RTC_ALMHPM_SHIFT 5 | ||
120 | #define WM8350_RTC_ALMHRS_MASK 0x001F | ||
121 | #define WM8350_RTC_ALMHRS_SHIFT 0 | ||
122 | |||
123 | /* Bit values for R21 (0x15) */ | ||
124 | #define WM8350_RTC_ALMDAY_DONT_CARE -1 | ||
125 | #define WM8350_RTC_ALMDAY_SUN 1 | ||
126 | #define WM8350_RTC_ALMDAY_MON 2 | ||
127 | #define WM8350_RTC_ALMDAY_TUE 3 | ||
128 | #define WM8350_RTC_ALMDAY_WED 4 | ||
129 | #define WM8350_RTC_ALMDAY_THU 5 | ||
130 | #define WM8350_RTC_ALMDAY_FRI 6 | ||
131 | #define WM8350_RTC_ALMDAY_SAT 7 | ||
132 | |||
133 | #define WM8350_RTC_ALMHPM_AM 0 | ||
134 | #define WM8350_RTC_ALMHPM_PM 1 | ||
135 | |||
136 | #define WM8350_RTC_ALMHRS_DONT_CARE -1 | ||
137 | |||
138 | /* | ||
139 | * R22 (0x16) - Alarm Date/Month | ||
140 | */ | ||
141 | #define WM8350_RTC_ALMMTH_MASK 0x1F00 | ||
142 | #define WM8350_RTC_ALMMTH_SHIFT 8 | ||
143 | #define WM8350_RTC_ALMDATE_MASK 0x003F | ||
144 | #define WM8350_RTC_ALMDATE_SHIFT 0 | ||
145 | |||
146 | /* Bit values for R22 (0x16) */ | ||
147 | #define WM8350_RTC_ALMDATE_DONT_CARE -1 | ||
148 | |||
149 | #define WM8350_RTC_ALMMTH_DONT_CARE -1 | ||
150 | #define WM8350_RTC_ALMMTH_JAN 1 | ||
151 | #define WM8350_RTC_ALMMTH_FEB 2 | ||
152 | #define WM8350_RTC_ALMMTH_MAR 3 | ||
153 | #define WM8350_RTC_ALMMTH_APR 4 | ||
154 | #define WM8350_RTC_ALMMTH_MAY 5 | ||
155 | #define WM8350_RTC_ALMMTH_JUN 6 | ||
156 | #define WM8350_RTC_ALMMTH_JUL 7 | ||
157 | #define WM8350_RTC_ALMMTH_AUG 8 | ||
158 | #define WM8350_RTC_ALMMTH_SEP 9 | ||
159 | #define WM8350_RTC_ALMMTH_OCT 10 | ||
160 | #define WM8350_RTC_ALMMTH_NOV 11 | ||
161 | #define WM8350_RTC_ALMMTH_DEC 12 | ||
162 | #define WM8350_RTC_ALMMTH_JAN_BCD 0x01 | ||
163 | #define WM8350_RTC_ALMMTH_FEB_BCD 0x02 | ||
164 | #define WM8350_RTC_ALMMTH_MAR_BCD 0x03 | ||
165 | #define WM8350_RTC_ALMMTH_APR_BCD 0x04 | ||
166 | #define WM8350_RTC_ALMMTH_MAY_BCD 0x05 | ||
167 | #define WM8350_RTC_ALMMTH_JUN_BCD 0x06 | ||
168 | #define WM8350_RTC_ALMMTH_JUL_BCD 0x07 | ||
169 | #define WM8350_RTC_ALMMTH_AUG_BCD 0x08 | ||
170 | #define WM8350_RTC_ALMMTH_SEP_BCD 0x09 | ||
171 | #define WM8350_RTC_ALMMTH_OCT_BCD 0x10 | ||
172 | #define WM8350_RTC_ALMMTH_NOV_BCD 0x11 | ||
173 | #define WM8350_RTC_ALMMTH_DEC_BCD 0x12 | ||
174 | |||
175 | /* | ||
176 | * R23 (0x17) - RTC Time Control | ||
177 | */ | ||
178 | #define WM8350_RTC_BCD 0x8000 | ||
179 | #define WM8350_RTC_BCD_MASK 0x8000 | ||
180 | #define WM8350_RTC_BCD_SHIFT 15 | ||
181 | #define WM8350_RTC_12HR 0x4000 | ||
182 | #define WM8350_RTC_12HR_MASK 0x4000 | ||
183 | #define WM8350_RTC_12HR_SHIFT 14 | ||
184 | #define WM8350_RTC_DST 0x2000 | ||
185 | #define WM8350_RTC_DST_MASK 0x2000 | ||
186 | #define WM8350_RTC_DST_SHIFT 13 | ||
187 | #define WM8350_RTC_SET 0x0800 | ||
188 | #define WM8350_RTC_SET_MASK 0x0800 | ||
189 | #define WM8350_RTC_SET_SHIFT 11 | ||
190 | #define WM8350_RTC_STS 0x0400 | ||
191 | #define WM8350_RTC_STS_MASK 0x0400 | ||
192 | #define WM8350_RTC_STS_SHIFT 10 | ||
193 | #define WM8350_RTC_ALMSET 0x0200 | ||
194 | #define WM8350_RTC_ALMSET_MASK 0x0200 | ||
195 | #define WM8350_RTC_ALMSET_SHIFT 9 | ||
196 | #define WM8350_RTC_ALMSTS 0x0100 | ||
197 | #define WM8350_RTC_ALMSTS_MASK 0x0100 | ||
198 | #define WM8350_RTC_ALMSTS_SHIFT 8 | ||
199 | #define WM8350_RTC_PINT 0x0070 | ||
200 | #define WM8350_RTC_PINT_MASK 0x0070 | ||
201 | #define WM8350_RTC_PINT_SHIFT 4 | ||
202 | #define WM8350_RTC_DSW 0x000F | ||
203 | #define WM8350_RTC_DSW_MASK 0x000F | ||
204 | #define WM8350_RTC_DSW_SHIFT 0 | ||
205 | |||
206 | /* Bit values for R23 (0x17) */ | ||
207 | #define WM8350_RTC_BCD_BINARY 0 | ||
208 | #define WM8350_RTC_BCD_BCD 1 | ||
209 | |||
210 | #define WM8350_RTC_12HR_24HR 0 | ||
211 | #define WM8350_RTC_12HR_12HR 1 | ||
212 | |||
213 | #define WM8350_RTC_DST_DISABLED 0 | ||
214 | #define WM8350_RTC_DST_ENABLED 1 | ||
215 | |||
216 | #define WM8350_RTC_SET_RUN 0 | ||
217 | #define WM8350_RTC_SET_SET 1 | ||
218 | |||
219 | #define WM8350_RTC_STS_RUNNING 0 | ||
220 | #define WM8350_RTC_STS_STOPPED 1 | ||
221 | |||
222 | #define WM8350_RTC_ALMSET_RUN 0 | ||
223 | #define WM8350_RTC_ALMSET_SET 1 | ||
224 | |||
225 | #define WM8350_RTC_ALMSTS_RUNNING 0 | ||
226 | #define WM8350_RTC_ALMSTS_STOPPED 1 | ||
227 | |||
228 | #define WM8350_RTC_PINT_DISABLED 0 | ||
229 | #define WM8350_RTC_PINT_SECS 1 | ||
230 | #define WM8350_RTC_PINT_MINS 2 | ||
231 | #define WM8350_RTC_PINT_HRS 3 | ||
232 | #define WM8350_RTC_PINT_DAYS 4 | ||
233 | #define WM8350_RTC_PINT_MTHS 5 | ||
234 | |||
235 | #define WM8350_RTC_DSW_DISABLED 0 | ||
236 | #define WM8350_RTC_DSW_1HZ 1 | ||
237 | #define WM8350_RTC_DSW_2HZ 2 | ||
238 | #define WM8350_RTC_DSW_4HZ 3 | ||
239 | #define WM8350_RTC_DSW_8HZ 4 | ||
240 | #define WM8350_RTC_DSW_16HZ 5 | ||
241 | #define WM8350_RTC_DSW_32HZ 6 | ||
242 | #define WM8350_RTC_DSW_64HZ 7 | ||
243 | #define WM8350_RTC_DSW_128HZ 8 | ||
244 | #define WM8350_RTC_DSW_256HZ 9 | ||
245 | #define WM8350_RTC_DSW_512HZ 10 | ||
246 | #define WM8350_RTC_DSW_1024HZ 11 | ||
247 | |||
248 | /* | ||
249 | * R218 (0xDA) - RTC Tick Control | ||
250 | */ | ||
251 | #define WM8350_RTC_TICKSTS 0x4000 | ||
252 | #define WM8350_RTC_CLKSRC 0x2000 | ||
253 | #define WM8350_RTC_TRIM_MASK 0x03FF | ||
254 | |||
255 | /* | ||
256 | * RTC Interrupts. | ||
257 | */ | ||
258 | #define WM8350_IRQ_RTC_PER 7 | ||
259 | #define WM8350_IRQ_RTC_SEC 8 | ||
260 | #define WM8350_IRQ_RTC_ALM 9 | ||
261 | |||
262 | struct wm8350_rtc { | ||
263 | struct platform_device *pdev; | ||
264 | }; | ||
265 | |||
266 | #endif | ||
diff --git a/include/linux/mfd/wm8350/supply.h b/include/linux/mfd/wm8350/supply.h new file mode 100644 index 000000000000..1c8f3cde79b0 --- /dev/null +++ b/include/linux/mfd/wm8350/supply.h | |||
@@ -0,0 +1,111 @@ | |||
1 | /* | ||
2 | * supply.h -- Power Supply Driver for Wolfson WM8350 PMIC | ||
3 | * | ||
4 | * Copyright 2007 Wolfson Microelectronics PLC | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify it | ||
7 | * under the terms of the GNU General Public License as published by the | ||
8 | * Free Software Foundation; either version 2 of the License, or (at your | ||
9 | * option) any later version. | ||
10 | * | ||
11 | */ | ||
12 | |||
13 | #ifndef __LINUX_MFD_WM8350_SUPPLY_H_ | ||
14 | #define __LINUX_MFD_WM8350_SUPPLY_H_ | ||
15 | |||
16 | #include <linux/platform_device.h> | ||
17 | |||
18 | /* | ||
19 | * Charger registers | ||
20 | */ | ||
21 | #define WM8350_BATTERY_CHARGER_CONTROL_1 0xA8 | ||
22 | #define WM8350_BATTERY_CHARGER_CONTROL_2 0xA9 | ||
23 | #define WM8350_BATTERY_CHARGER_CONTROL_3 0xAA | ||
24 | |||
25 | /* | ||
26 | * R168 (0xA8) - Battery Charger Control 1 | ||
27 | */ | ||
28 | #define WM8350_CHG_ENA_R168 0x8000 | ||
29 | #define WM8350_CHG_THR 0x2000 | ||
30 | #define WM8350_CHG_EOC_SEL_MASK 0x1C00 | ||
31 | #define WM8350_CHG_TRICKLE_TEMP_CHOKE 0x0200 | ||
32 | #define WM8350_CHG_TRICKLE_USB_CHOKE 0x0100 | ||
33 | #define WM8350_CHG_RECOVER_T 0x0080 | ||
34 | #define WM8350_CHG_END_ACT 0x0040 | ||
35 | #define WM8350_CHG_FAST 0x0020 | ||
36 | #define WM8350_CHG_FAST_USB_THROTTLE 0x0010 | ||
37 | #define WM8350_CHG_NTC_MON 0x0008 | ||
38 | #define WM8350_CHG_BATT_HOT_MON 0x0004 | ||
39 | #define WM8350_CHG_BATT_COLD_MON 0x0002 | ||
40 | #define WM8350_CHG_CHIP_TEMP_MON 0x0001 | ||
41 | |||
42 | /* | ||
43 | * R169 (0xA9) - Battery Charger Control 2 | ||
44 | */ | ||
45 | #define WM8350_CHG_ACTIVE 0x8000 | ||
46 | #define WM8350_CHG_PAUSE 0x4000 | ||
47 | #define WM8350_CHG_STS_MASK 0x3000 | ||
48 | #define WM8350_CHG_TIME_MASK 0x0F00 | ||
49 | #define WM8350_CHG_MASK_WALL_FB 0x0080 | ||
50 | #define WM8350_CHG_TRICKLE_SEL 0x0040 | ||
51 | #define WM8350_CHG_VSEL_MASK 0x0030 | ||
52 | #define WM8350_CHG_ISEL_MASK 0x000F | ||
53 | #define WM8350_CHG_STS_OFF 0x0000 | ||
54 | #define WM8350_CHG_STS_TRICKLE 0x1000 | ||
55 | #define WM8350_CHG_STS_FAST 0x2000 | ||
56 | |||
57 | /* | ||
58 | * R170 (0xAA) - Battery Charger Control 3 | ||
59 | */ | ||
60 | #define WM8350_CHG_THROTTLE_T_MASK 0x0060 | ||
61 | #define WM8350_CHG_SMART 0x0010 | ||
62 | #define WM8350_CHG_TIMER_ADJT_MASK 0x000F | ||
63 | |||
64 | /* | ||
65 | * Charger Interrupts | ||
66 | */ | ||
67 | #define WM8350_IRQ_CHG_BAT_HOT 0 | ||
68 | #define WM8350_IRQ_CHG_BAT_COLD 1 | ||
69 | #define WM8350_IRQ_CHG_BAT_FAIL 2 | ||
70 | #define WM8350_IRQ_CHG_TO 3 | ||
71 | #define WM8350_IRQ_CHG_END 4 | ||
72 | #define WM8350_IRQ_CHG_START 5 | ||
73 | #define WM8350_IRQ_CHG_FAST_RDY 6 | ||
74 | #define WM8350_IRQ_CHG_VBATT_LT_3P9 10 | ||
75 | #define WM8350_IRQ_CHG_VBATT_LT_3P1 11 | ||
76 | #define WM8350_IRQ_CHG_VBATT_LT_2P85 12 | ||
77 | |||
78 | /* | ||
79 | * Charger Policy | ||
80 | */ | ||
81 | #define WM8350_CHG_TRICKLE_50mA (0 << 6) | ||
82 | #define WM8350_CHG_TRICKLE_100mA (1 << 6) | ||
83 | #define WM8350_CHG_4_05V (0 << 4) | ||
84 | #define WM8350_CHG_4_10V (1 << 4) | ||
85 | #define WM8350_CHG_4_15V (2 << 4) | ||
86 | #define WM8350_CHG_4_20V (3 << 4) | ||
87 | #define WM8350_CHG_FAST_LIMIT_mA(x) ((x / 50) & 0xf) | ||
88 | #define WM8350_CHG_EOC_mA(x) (((x - 10) & 0x7) << 10) | ||
89 | #define WM8350_CHG_TRICKLE_3_1V (0 << 13) | ||
90 | #define WM8350_CHG_TRICKLE_3_9V (1 << 13) | ||
91 | |||
92 | /* | ||
93 | * Supply Registers. | ||
94 | */ | ||
95 | #define WM8350_USB_VOLTAGE_READBACK 0x9C | ||
96 | #define WM8350_LINE_VOLTAGE_READBACK 0x9D | ||
97 | #define WM8350_BATT_VOLTAGE_READBACK 0x9E | ||
98 | |||
99 | /* | ||
100 | * Supply Interrupts. | ||
101 | */ | ||
102 | #define WM8350_IRQ_USB_LIMIT 15 | ||
103 | #define WM8350_IRQ_EXT_USB_FB 36 | ||
104 | #define WM8350_IRQ_EXT_WALL_FB 37 | ||
105 | #define WM8350_IRQ_EXT_BAT_FB 38 | ||
106 | |||
107 | struct wm8350_power { | ||
108 | struct platform_device *pdev; | ||
109 | }; | ||
110 | |||
111 | #endif | ||
diff --git a/include/linux/mfd/wm8350/wdt.h b/include/linux/mfd/wm8350/wdt.h new file mode 100644 index 000000000000..f6135b5e5ef4 --- /dev/null +++ b/include/linux/mfd/wm8350/wdt.h | |||
@@ -0,0 +1,28 @@ | |||
1 | /* | ||
2 | * wdt.h -- Watchdog Driver for Wolfson WM8350 PMIC | ||
3 | * | ||
4 | * Copyright 2007, 2008 Wolfson Microelectronics PLC | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify it | ||
7 | * under the terms of the GNU General Public License as published by the | ||
8 | * Free Software Foundation; either version 2 of the License, or (at your | ||
9 | * option) any later version. | ||
10 | */ | ||
11 | |||
12 | #ifndef __LINUX_MFD_WM8350_WDT_H_ | ||
13 | #define __LINUX_MFD_WM8350_WDT_H_ | ||
14 | |||
15 | #include <linux/platform_device.h> | ||
16 | |||
17 | #define WM8350_WDOG_HIB_MODE 0x0080 | ||
18 | #define WM8350_WDOG_DEBUG 0x0040 | ||
19 | #define WM8350_WDOG_MODE_MASK 0x0030 | ||
20 | #define WM8350_WDOG_TO_MASK 0x0007 | ||
21 | |||
22 | #define WM8350_IRQ_SYS_WDOG_TO 24 | ||
23 | |||
24 | struct wm8350_wdt { | ||
25 | struct platform_device *pdev; | ||
26 | }; | ||
27 | |||
28 | #endif | ||
diff --git a/include/linux/mfd/wm8400-audio.h b/include/linux/mfd/wm8400-audio.h new file mode 100644 index 000000000000..b6640e018046 --- /dev/null +++ b/include/linux/mfd/wm8400-audio.h | |||
@@ -0,0 +1,1186 @@ | |||
1 | /* | ||
2 | * wm8400 private definitions for audio | ||
3 | * | ||
4 | * Copyright 2008 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 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_MFD_WM8400_AUDIO_H | ||
22 | #define __LINUX_MFD_WM8400_AUDIO_H | ||
23 | |||
24 | #include <linux/mfd/wm8400-audio.h> | ||
25 | |||
26 | /* | ||
27 | * R2 (0x02) - Power Management (1) | ||
28 | */ | ||
29 | #define WM8400_CODEC_ENA 0x8000 /* CODEC_ENA */ | ||
30 | #define WM8400_CODEC_ENA_MASK 0x8000 /* CODEC_ENA */ | ||
31 | #define WM8400_CODEC_ENA_SHIFT 15 /* CODEC_ENA */ | ||
32 | #define WM8400_CODEC_ENA_WIDTH 1 /* CODEC_ENA */ | ||
33 | #define WM8400_SYSCLK_ENA 0x4000 /* SYSCLK_ENA */ | ||
34 | #define WM8400_SYSCLK_ENA_MASK 0x4000 /* SYSCLK_ENA */ | ||
35 | #define WM8400_SYSCLK_ENA_SHIFT 14 /* SYSCLK_ENA */ | ||
36 | #define WM8400_SYSCLK_ENA_WIDTH 1 /* SYSCLK_ENA */ | ||
37 | #define WM8400_SPK_MIX_ENA 0x2000 /* SPK_MIX_ENA */ | ||
38 | #define WM8400_SPK_MIX_ENA_MASK 0x2000 /* SPK_MIX_ENA */ | ||
39 | #define WM8400_SPK_MIX_ENA_SHIFT 13 /* SPK_MIX_ENA */ | ||
40 | #define WM8400_SPK_MIX_ENA_WIDTH 1 /* SPK_MIX_ENA */ | ||
41 | #define WM8400_SPK_ENA 0x1000 /* SPK_ENA */ | ||
42 | #define WM8400_SPK_ENA_MASK 0x1000 /* SPK_ENA */ | ||
43 | #define WM8400_SPK_ENA_SHIFT 12 /* SPK_ENA */ | ||
44 | #define WM8400_SPK_ENA_WIDTH 1 /* SPK_ENA */ | ||
45 | #define WM8400_OUT3_ENA 0x0800 /* OUT3_ENA */ | ||
46 | #define WM8400_OUT3_ENA_MASK 0x0800 /* OUT3_ENA */ | ||
47 | #define WM8400_OUT3_ENA_SHIFT 11 /* OUT3_ENA */ | ||
48 | #define WM8400_OUT3_ENA_WIDTH 1 /* OUT3_ENA */ | ||
49 | #define WM8400_OUT4_ENA 0x0400 /* OUT4_ENA */ | ||
50 | #define WM8400_OUT4_ENA_MASK 0x0400 /* OUT4_ENA */ | ||
51 | #define WM8400_OUT4_ENA_SHIFT 10 /* OUT4_ENA */ | ||
52 | #define WM8400_OUT4_ENA_WIDTH 1 /* OUT4_ENA */ | ||
53 | #define WM8400_LOUT_ENA 0x0200 /* LOUT_ENA */ | ||
54 | #define WM8400_LOUT_ENA_MASK 0x0200 /* LOUT_ENA */ | ||
55 | #define WM8400_LOUT_ENA_SHIFT 9 /* LOUT_ENA */ | ||
56 | #define WM8400_LOUT_ENA_WIDTH 1 /* LOUT_ENA */ | ||
57 | #define WM8400_ROUT_ENA 0x0100 /* ROUT_ENA */ | ||
58 | #define WM8400_ROUT_ENA_MASK 0x0100 /* ROUT_ENA */ | ||
59 | #define WM8400_ROUT_ENA_SHIFT 8 /* ROUT_ENA */ | ||
60 | #define WM8400_ROUT_ENA_WIDTH 1 /* ROUT_ENA */ | ||
61 | #define WM8400_MIC1BIAS_ENA 0x0010 /* MIC1BIAS_ENA */ | ||
62 | #define WM8400_MIC1BIAS_ENA_MASK 0x0010 /* MIC1BIAS_ENA */ | ||
63 | #define WM8400_MIC1BIAS_ENA_SHIFT 4 /* MIC1BIAS_ENA */ | ||
64 | #define WM8400_MIC1BIAS_ENA_WIDTH 1 /* MIC1BIAS_ENA */ | ||
65 | #define WM8400_VMID_MODE_MASK 0x0006 /* VMID_MODE - [2:1] */ | ||
66 | #define WM8400_VMID_MODE_SHIFT 1 /* VMID_MODE - [2:1] */ | ||
67 | #define WM8400_VMID_MODE_WIDTH 2 /* VMID_MODE - [2:1] */ | ||
68 | #define WM8400_VREF_ENA 0x0001 /* VREF_ENA */ | ||
69 | #define WM8400_VREF_ENA_MASK 0x0001 /* VREF_ENA */ | ||
70 | #define WM8400_VREF_ENA_SHIFT 0 /* VREF_ENA */ | ||
71 | #define WM8400_VREF_ENA_WIDTH 1 /* VREF_ENA */ | ||
72 | |||
73 | /* | ||
74 | * R3 (0x03) - Power Management (2) | ||
75 | */ | ||
76 | #define WM8400_FLL_ENA 0x8000 /* FLL_ENA */ | ||
77 | #define WM8400_FLL_ENA_MASK 0x8000 /* FLL_ENA */ | ||
78 | #define WM8400_FLL_ENA_SHIFT 15 /* FLL_ENA */ | ||
79 | #define WM8400_FLL_ENA_WIDTH 1 /* FLL_ENA */ | ||
80 | #define WM8400_TSHUT_ENA 0x4000 /* TSHUT_ENA */ | ||
81 | #define WM8400_TSHUT_ENA_MASK 0x4000 /* TSHUT_ENA */ | ||
82 | #define WM8400_TSHUT_ENA_SHIFT 14 /* TSHUT_ENA */ | ||
83 | #define WM8400_TSHUT_ENA_WIDTH 1 /* TSHUT_ENA */ | ||
84 | #define WM8400_TSHUT_OPDIS 0x2000 /* TSHUT_OPDIS */ | ||
85 | #define WM8400_TSHUT_OPDIS_MASK 0x2000 /* TSHUT_OPDIS */ | ||
86 | #define WM8400_TSHUT_OPDIS_SHIFT 13 /* TSHUT_OPDIS */ | ||
87 | #define WM8400_TSHUT_OPDIS_WIDTH 1 /* TSHUT_OPDIS */ | ||
88 | #define WM8400_OPCLK_ENA 0x0800 /* OPCLK_ENA */ | ||
89 | #define WM8400_OPCLK_ENA_MASK 0x0800 /* OPCLK_ENA */ | ||
90 | #define WM8400_OPCLK_ENA_SHIFT 11 /* OPCLK_ENA */ | ||
91 | #define WM8400_OPCLK_ENA_WIDTH 1 /* OPCLK_ENA */ | ||
92 | #define WM8400_AINL_ENA 0x0200 /* AINL_ENA */ | ||
93 | #define WM8400_AINL_ENA_MASK 0x0200 /* AINL_ENA */ | ||
94 | #define WM8400_AINL_ENA_SHIFT 9 /* AINL_ENA */ | ||
95 | #define WM8400_AINL_ENA_WIDTH 1 /* AINL_ENA */ | ||
96 | #define WM8400_AINR_ENA 0x0100 /* AINR_ENA */ | ||
97 | #define WM8400_AINR_ENA_MASK 0x0100 /* AINR_ENA */ | ||
98 | #define WM8400_AINR_ENA_SHIFT 8 /* AINR_ENA */ | ||
99 | #define WM8400_AINR_ENA_WIDTH 1 /* AINR_ENA */ | ||
100 | #define WM8400_LIN34_ENA 0x0080 /* LIN34_ENA */ | ||
101 | #define WM8400_LIN34_ENA_MASK 0x0080 /* LIN34_ENA */ | ||
102 | #define WM8400_LIN34_ENA_SHIFT 7 /* LIN34_ENA */ | ||
103 | #define WM8400_LIN34_ENA_WIDTH 1 /* LIN34_ENA */ | ||
104 | #define WM8400_LIN12_ENA 0x0040 /* LIN12_ENA */ | ||
105 | #define WM8400_LIN12_ENA_MASK 0x0040 /* LIN12_ENA */ | ||
106 | #define WM8400_LIN12_ENA_SHIFT 6 /* LIN12_ENA */ | ||
107 | #define WM8400_LIN12_ENA_WIDTH 1 /* LIN12_ENA */ | ||
108 | #define WM8400_RIN34_ENA 0x0020 /* RIN34_ENA */ | ||
109 | #define WM8400_RIN34_ENA_MASK 0x0020 /* RIN34_ENA */ | ||
110 | #define WM8400_RIN34_ENA_SHIFT 5 /* RIN34_ENA */ | ||
111 | #define WM8400_RIN34_ENA_WIDTH 1 /* RIN34_ENA */ | ||
112 | #define WM8400_RIN12_ENA 0x0010 /* RIN12_ENA */ | ||
113 | #define WM8400_RIN12_ENA_MASK 0x0010 /* RIN12_ENA */ | ||
114 | #define WM8400_RIN12_ENA_SHIFT 4 /* RIN12_ENA */ | ||
115 | #define WM8400_RIN12_ENA_WIDTH 1 /* RIN12_ENA */ | ||
116 | #define WM8400_ADCL_ENA 0x0002 /* ADCL_ENA */ | ||
117 | #define WM8400_ADCL_ENA_MASK 0x0002 /* ADCL_ENA */ | ||
118 | #define WM8400_ADCL_ENA_SHIFT 1 /* ADCL_ENA */ | ||
119 | #define WM8400_ADCL_ENA_WIDTH 1 /* ADCL_ENA */ | ||
120 | #define WM8400_ADCR_ENA 0x0001 /* ADCR_ENA */ | ||
121 | #define WM8400_ADCR_ENA_MASK 0x0001 /* ADCR_ENA */ | ||
122 | #define WM8400_ADCR_ENA_SHIFT 0 /* ADCR_ENA */ | ||
123 | #define WM8400_ADCR_ENA_WIDTH 1 /* ADCR_ENA */ | ||
124 | |||
125 | /* | ||
126 | * R4 (0x04) - Power Management (3) | ||
127 | */ | ||
128 | #define WM8400_LON_ENA 0x2000 /* LON_ENA */ | ||
129 | #define WM8400_LON_ENA_MASK 0x2000 /* LON_ENA */ | ||
130 | #define WM8400_LON_ENA_SHIFT 13 /* LON_ENA */ | ||
131 | #define WM8400_LON_ENA_WIDTH 1 /* LON_ENA */ | ||
132 | #define WM8400_LOP_ENA 0x1000 /* LOP_ENA */ | ||
133 | #define WM8400_LOP_ENA_MASK 0x1000 /* LOP_ENA */ | ||
134 | #define WM8400_LOP_ENA_SHIFT 12 /* LOP_ENA */ | ||
135 | #define WM8400_LOP_ENA_WIDTH 1 /* LOP_ENA */ | ||
136 | #define WM8400_RON_ENA 0x0800 /* RON_ENA */ | ||
137 | #define WM8400_RON_ENA_MASK 0x0800 /* RON_ENA */ | ||
138 | #define WM8400_RON_ENA_SHIFT 11 /* RON_ENA */ | ||
139 | #define WM8400_RON_ENA_WIDTH 1 /* RON_ENA */ | ||
140 | #define WM8400_ROP_ENA 0x0400 /* ROP_ENA */ | ||
141 | #define WM8400_ROP_ENA_MASK 0x0400 /* ROP_ENA */ | ||
142 | #define WM8400_ROP_ENA_SHIFT 10 /* ROP_ENA */ | ||
143 | #define WM8400_ROP_ENA_WIDTH 1 /* ROP_ENA */ | ||
144 | #define WM8400_LOPGA_ENA 0x0080 /* LOPGA_ENA */ | ||
145 | #define WM8400_LOPGA_ENA_MASK 0x0080 /* LOPGA_ENA */ | ||
146 | #define WM8400_LOPGA_ENA_SHIFT 7 /* LOPGA_ENA */ | ||
147 | #define WM8400_LOPGA_ENA_WIDTH 1 /* LOPGA_ENA */ | ||
148 | #define WM8400_ROPGA_ENA 0x0040 /* ROPGA_ENA */ | ||
149 | #define WM8400_ROPGA_ENA_MASK 0x0040 /* ROPGA_ENA */ | ||
150 | #define WM8400_ROPGA_ENA_SHIFT 6 /* ROPGA_ENA */ | ||
151 | #define WM8400_ROPGA_ENA_WIDTH 1 /* ROPGA_ENA */ | ||
152 | #define WM8400_LOMIX_ENA 0x0020 /* LOMIX_ENA */ | ||
153 | #define WM8400_LOMIX_ENA_MASK 0x0020 /* LOMIX_ENA */ | ||
154 | #define WM8400_LOMIX_ENA_SHIFT 5 /* LOMIX_ENA */ | ||
155 | #define WM8400_LOMIX_ENA_WIDTH 1 /* LOMIX_ENA */ | ||
156 | #define WM8400_ROMIX_ENA 0x0010 /* ROMIX_ENA */ | ||
157 | #define WM8400_ROMIX_ENA_MASK 0x0010 /* ROMIX_ENA */ | ||
158 | #define WM8400_ROMIX_ENA_SHIFT 4 /* ROMIX_ENA */ | ||
159 | #define WM8400_ROMIX_ENA_WIDTH 1 /* ROMIX_ENA */ | ||
160 | #define WM8400_DACL_ENA 0x0002 /* DACL_ENA */ | ||
161 | #define WM8400_DACL_ENA_MASK 0x0002 /* DACL_ENA */ | ||
162 | #define WM8400_DACL_ENA_SHIFT 1 /* DACL_ENA */ | ||
163 | #define WM8400_DACL_ENA_WIDTH 1 /* DACL_ENA */ | ||
164 | #define WM8400_DACR_ENA 0x0001 /* DACR_ENA */ | ||
165 | #define WM8400_DACR_ENA_MASK 0x0001 /* DACR_ENA */ | ||
166 | #define WM8400_DACR_ENA_SHIFT 0 /* DACR_ENA */ | ||
167 | #define WM8400_DACR_ENA_WIDTH 1 /* DACR_ENA */ | ||
168 | |||
169 | /* | ||
170 | * R5 (0x05) - Audio Interface (1) | ||
171 | */ | ||
172 | #define WM8400_AIFADCL_SRC 0x8000 /* AIFADCL_SRC */ | ||
173 | #define WM8400_AIFADCL_SRC_MASK 0x8000 /* AIFADCL_SRC */ | ||
174 | #define WM8400_AIFADCL_SRC_SHIFT 15 /* AIFADCL_SRC */ | ||
175 | #define WM8400_AIFADCL_SRC_WIDTH 1 /* AIFADCL_SRC */ | ||
176 | #define WM8400_AIFADCR_SRC 0x4000 /* AIFADCR_SRC */ | ||
177 | #define WM8400_AIFADCR_SRC_MASK 0x4000 /* AIFADCR_SRC */ | ||
178 | #define WM8400_AIFADCR_SRC_SHIFT 14 /* AIFADCR_SRC */ | ||
179 | #define WM8400_AIFADCR_SRC_WIDTH 1 /* AIFADCR_SRC */ | ||
180 | #define WM8400_AIFADC_TDM 0x2000 /* AIFADC_TDM */ | ||
181 | #define WM8400_AIFADC_TDM_MASK 0x2000 /* AIFADC_TDM */ | ||
182 | #define WM8400_AIFADC_TDM_SHIFT 13 /* AIFADC_TDM */ | ||
183 | #define WM8400_AIFADC_TDM_WIDTH 1 /* AIFADC_TDM */ | ||
184 | #define WM8400_AIFADC_TDM_CHAN 0x1000 /* AIFADC_TDM_CHAN */ | ||
185 | #define WM8400_AIFADC_TDM_CHAN_MASK 0x1000 /* AIFADC_TDM_CHAN */ | ||
186 | #define WM8400_AIFADC_TDM_CHAN_SHIFT 12 /* AIFADC_TDM_CHAN */ | ||
187 | #define WM8400_AIFADC_TDM_CHAN_WIDTH 1 /* AIFADC_TDM_CHAN */ | ||
188 | #define WM8400_AIF_BCLK_INV 0x0100 /* AIF_BCLK_INV */ | ||
189 | #define WM8400_AIF_BCLK_INV_MASK 0x0100 /* AIF_BCLK_INV */ | ||
190 | #define WM8400_AIF_BCLK_INV_SHIFT 8 /* AIF_BCLK_INV */ | ||
191 | #define WM8400_AIF_BCLK_INV_WIDTH 1 /* AIF_BCLK_INV */ | ||
192 | #define WM8400_AIF_LRCLK_INV 0x0080 /* AIF_LRCLK_INV */ | ||
193 | #define WM8400_AIF_LRCLK_INV_MASK 0x0080 /* AIF_LRCLK_INV */ | ||
194 | #define WM8400_AIF_LRCLK_INV_SHIFT 7 /* AIF_LRCLK_INV */ | ||
195 | #define WM8400_AIF_LRCLK_INV_WIDTH 1 /* AIF_LRCLK_INV */ | ||
196 | #define WM8400_AIF_WL_MASK 0x0060 /* AIF_WL - [6:5] */ | ||
197 | #define WM8400_AIF_WL_SHIFT 5 /* AIF_WL - [6:5] */ | ||
198 | #define WM8400_AIF_WL_WIDTH 2 /* AIF_WL - [6:5] */ | ||
199 | #define WM8400_AIF_WL_16BITS (0 << 5) | ||
200 | #define WM8400_AIF_WL_20BITS (1 << 5) | ||
201 | #define WM8400_AIF_WL_24BITS (2 << 5) | ||
202 | #define WM8400_AIF_WL_32BITS (3 << 5) | ||
203 | #define WM8400_AIF_FMT_MASK 0x0018 /* AIF_FMT - [4:3] */ | ||
204 | #define WM8400_AIF_FMT_SHIFT 3 /* AIF_FMT - [4:3] */ | ||
205 | #define WM8400_AIF_FMT_WIDTH 2 /* AIF_FMT - [4:3] */ | ||
206 | #define WM8400_AIF_FMT_RIGHTJ (0 << 3) | ||
207 | #define WM8400_AIF_FMT_LEFTJ (1 << 3) | ||
208 | #define WM8400_AIF_FMT_I2S (2 << 3) | ||
209 | #define WM8400_AIF_FMT_DSP (3 << 3) | ||
210 | |||
211 | /* | ||
212 | * R6 (0x06) - Audio Interface (2) | ||
213 | */ | ||
214 | #define WM8400_DACL_SRC 0x8000 /* DACL_SRC */ | ||
215 | #define WM8400_DACL_SRC_MASK 0x8000 /* DACL_SRC */ | ||
216 | #define WM8400_DACL_SRC_SHIFT 15 /* DACL_SRC */ | ||
217 | #define WM8400_DACL_SRC_WIDTH 1 /* DACL_SRC */ | ||
218 | #define WM8400_DACR_SRC 0x4000 /* DACR_SRC */ | ||
219 | #define WM8400_DACR_SRC_MASK 0x4000 /* DACR_SRC */ | ||
220 | #define WM8400_DACR_SRC_SHIFT 14 /* DACR_SRC */ | ||
221 | #define WM8400_DACR_SRC_WIDTH 1 /* DACR_SRC */ | ||
222 | #define WM8400_AIFDAC_TDM 0x2000 /* AIFDAC_TDM */ | ||
223 | #define WM8400_AIFDAC_TDM_MASK 0x2000 /* AIFDAC_TDM */ | ||
224 | #define WM8400_AIFDAC_TDM_SHIFT 13 /* AIFDAC_TDM */ | ||
225 | #define WM8400_AIFDAC_TDM_WIDTH 1 /* AIFDAC_TDM */ | ||
226 | #define WM8400_AIFDAC_TDM_CHAN 0x1000 /* AIFDAC_TDM_CHAN */ | ||
227 | #define WM8400_AIFDAC_TDM_CHAN_MASK 0x1000 /* AIFDAC_TDM_CHAN */ | ||
228 | #define WM8400_AIFDAC_TDM_CHAN_SHIFT 12 /* AIFDAC_TDM_CHAN */ | ||
229 | #define WM8400_AIFDAC_TDM_CHAN_WIDTH 1 /* AIFDAC_TDM_CHAN */ | ||
230 | #define WM8400_DAC_BOOST_MASK 0x0C00 /* DAC_BOOST - [11:10] */ | ||
231 | #define WM8400_DAC_BOOST_SHIFT 10 /* DAC_BOOST - [11:10] */ | ||
232 | #define WM8400_DAC_BOOST_WIDTH 2 /* DAC_BOOST - [11:10] */ | ||
233 | #define WM8400_DAC_COMP 0x0010 /* DAC_COMP */ | ||
234 | #define WM8400_DAC_COMP_MASK 0x0010 /* DAC_COMP */ | ||
235 | #define WM8400_DAC_COMP_SHIFT 4 /* DAC_COMP */ | ||
236 | #define WM8400_DAC_COMP_WIDTH 1 /* DAC_COMP */ | ||
237 | #define WM8400_DAC_COMPMODE 0x0008 /* DAC_COMPMODE */ | ||
238 | #define WM8400_DAC_COMPMODE_MASK 0x0008 /* DAC_COMPMODE */ | ||
239 | #define WM8400_DAC_COMPMODE_SHIFT 3 /* DAC_COMPMODE */ | ||
240 | #define WM8400_DAC_COMPMODE_WIDTH 1 /* DAC_COMPMODE */ | ||
241 | #define WM8400_ADC_COMP 0x0004 /* ADC_COMP */ | ||
242 | #define WM8400_ADC_COMP_MASK 0x0004 /* ADC_COMP */ | ||
243 | #define WM8400_ADC_COMP_SHIFT 2 /* ADC_COMP */ | ||
244 | #define WM8400_ADC_COMP_WIDTH 1 /* ADC_COMP */ | ||
245 | #define WM8400_ADC_COMPMODE 0x0002 /* ADC_COMPMODE */ | ||
246 | #define WM8400_ADC_COMPMODE_MASK 0x0002 /* ADC_COMPMODE */ | ||
247 | #define WM8400_ADC_COMPMODE_SHIFT 1 /* ADC_COMPMODE */ | ||
248 | #define WM8400_ADC_COMPMODE_WIDTH 1 /* ADC_COMPMODE */ | ||
249 | #define WM8400_LOOPBACK 0x0001 /* LOOPBACK */ | ||
250 | #define WM8400_LOOPBACK_MASK 0x0001 /* LOOPBACK */ | ||
251 | #define WM8400_LOOPBACK_SHIFT 0 /* LOOPBACK */ | ||
252 | #define WM8400_LOOPBACK_WIDTH 1 /* LOOPBACK */ | ||
253 | |||
254 | /* | ||
255 | * R7 (0x07) - Clocking (1) | ||
256 | */ | ||
257 | #define WM8400_TOCLK_RATE 0x8000 /* TOCLK_RATE */ | ||
258 | #define WM8400_TOCLK_RATE_MASK 0x8000 /* TOCLK_RATE */ | ||
259 | #define WM8400_TOCLK_RATE_SHIFT 15 /* TOCLK_RATE */ | ||
260 | #define WM8400_TOCLK_RATE_WIDTH 1 /* TOCLK_RATE */ | ||
261 | #define WM8400_TOCLK_ENA 0x4000 /* TOCLK_ENA */ | ||
262 | #define WM8400_TOCLK_ENA_MASK 0x4000 /* TOCLK_ENA */ | ||
263 | #define WM8400_TOCLK_ENA_SHIFT 14 /* TOCLK_ENA */ | ||
264 | #define WM8400_TOCLK_ENA_WIDTH 1 /* TOCLK_ENA */ | ||
265 | #define WM8400_OPCLKDIV_MASK 0x1E00 /* OPCLKDIV - [12:9] */ | ||
266 | #define WM8400_OPCLKDIV_SHIFT 9 /* OPCLKDIV - [12:9] */ | ||
267 | #define WM8400_OPCLKDIV_WIDTH 4 /* OPCLKDIV - [12:9] */ | ||
268 | #define WM8400_DCLKDIV_MASK 0x01C0 /* DCLKDIV - [8:6] */ | ||
269 | #define WM8400_DCLKDIV_SHIFT 6 /* DCLKDIV - [8:6] */ | ||
270 | #define WM8400_DCLKDIV_WIDTH 3 /* DCLKDIV - [8:6] */ | ||
271 | #define WM8400_BCLK_DIV_MASK 0x001E /* BCLK_DIV - [4:1] */ | ||
272 | #define WM8400_BCLK_DIV_SHIFT 1 /* BCLK_DIV - [4:1] */ | ||
273 | #define WM8400_BCLK_DIV_WIDTH 4 /* BCLK_DIV - [4:1] */ | ||
274 | |||
275 | /* | ||
276 | * R8 (0x08) - Clocking (2) | ||
277 | */ | ||
278 | #define WM8400_MCLK_SRC 0x8000 /* MCLK_SRC */ | ||
279 | #define WM8400_MCLK_SRC_MASK 0x8000 /* MCLK_SRC */ | ||
280 | #define WM8400_MCLK_SRC_SHIFT 15 /* MCLK_SRC */ | ||
281 | #define WM8400_MCLK_SRC_WIDTH 1 /* MCLK_SRC */ | ||
282 | #define WM8400_SYSCLK_SRC 0x4000 /* SYSCLK_SRC */ | ||
283 | #define WM8400_SYSCLK_SRC_MASK 0x4000 /* SYSCLK_SRC */ | ||
284 | #define WM8400_SYSCLK_SRC_SHIFT 14 /* SYSCLK_SRC */ | ||
285 | #define WM8400_SYSCLK_SRC_WIDTH 1 /* SYSCLK_SRC */ | ||
286 | #define WM8400_CLK_FORCE 0x2000 /* CLK_FORCE */ | ||
287 | #define WM8400_CLK_FORCE_MASK 0x2000 /* CLK_FORCE */ | ||
288 | #define WM8400_CLK_FORCE_SHIFT 13 /* CLK_FORCE */ | ||
289 | #define WM8400_CLK_FORCE_WIDTH 1 /* CLK_FORCE */ | ||
290 | #define WM8400_MCLK_DIV_MASK 0x1800 /* MCLK_DIV - [12:11] */ | ||
291 | #define WM8400_MCLK_DIV_SHIFT 11 /* MCLK_DIV - [12:11] */ | ||
292 | #define WM8400_MCLK_DIV_WIDTH 2 /* MCLK_DIV - [12:11] */ | ||
293 | #define WM8400_MCLK_INV 0x0400 /* MCLK_INV */ | ||
294 | #define WM8400_MCLK_INV_MASK 0x0400 /* MCLK_INV */ | ||
295 | #define WM8400_MCLK_INV_SHIFT 10 /* MCLK_INV */ | ||
296 | #define WM8400_MCLK_INV_WIDTH 1 /* MCLK_INV */ | ||
297 | #define WM8400_ADC_CLKDIV_MASK 0x00E0 /* ADC_CLKDIV - [7:5] */ | ||
298 | #define WM8400_ADC_CLKDIV_SHIFT 5 /* ADC_CLKDIV - [7:5] */ | ||
299 | #define WM8400_ADC_CLKDIV_WIDTH 3 /* ADC_CLKDIV - [7:5] */ | ||
300 | #define WM8400_DAC_CLKDIV_MASK 0x001C /* DAC_CLKDIV - [4:2] */ | ||
301 | #define WM8400_DAC_CLKDIV_SHIFT 2 /* DAC_CLKDIV - [4:2] */ | ||
302 | #define WM8400_DAC_CLKDIV_WIDTH 3 /* DAC_CLKDIV - [4:2] */ | ||
303 | |||
304 | /* | ||
305 | * R9 (0x09) - Audio Interface (3) | ||
306 | */ | ||
307 | #define WM8400_AIF_MSTR1 0x8000 /* AIF_MSTR1 */ | ||
308 | #define WM8400_AIF_MSTR1_MASK 0x8000 /* AIF_MSTR1 */ | ||
309 | #define WM8400_AIF_MSTR1_SHIFT 15 /* AIF_MSTR1 */ | ||
310 | #define WM8400_AIF_MSTR1_WIDTH 1 /* AIF_MSTR1 */ | ||
311 | #define WM8400_AIF_MSTR2 0x4000 /* AIF_MSTR2 */ | ||
312 | #define WM8400_AIF_MSTR2_MASK 0x4000 /* AIF_MSTR2 */ | ||
313 | #define WM8400_AIF_MSTR2_SHIFT 14 /* AIF_MSTR2 */ | ||
314 | #define WM8400_AIF_MSTR2_WIDTH 1 /* AIF_MSTR2 */ | ||
315 | #define WM8400_AIF_SEL 0x2000 /* AIF_SEL */ | ||
316 | #define WM8400_AIF_SEL_MASK 0x2000 /* AIF_SEL */ | ||
317 | #define WM8400_AIF_SEL_SHIFT 13 /* AIF_SEL */ | ||
318 | #define WM8400_AIF_SEL_WIDTH 1 /* AIF_SEL */ | ||
319 | #define WM8400_ADCLRC_DIR 0x0800 /* ADCLRC_DIR */ | ||
320 | #define WM8400_ADCLRC_DIR_MASK 0x0800 /* ADCLRC_DIR */ | ||
321 | #define WM8400_ADCLRC_DIR_SHIFT 11 /* ADCLRC_DIR */ | ||
322 | #define WM8400_ADCLRC_DIR_WIDTH 1 /* ADCLRC_DIR */ | ||
323 | #define WM8400_ADCLRC_RATE_MASK 0x07FF /* ADCLRC_RATE - [10:0] */ | ||
324 | #define WM8400_ADCLRC_RATE_SHIFT 0 /* ADCLRC_RATE - [10:0] */ | ||
325 | #define WM8400_ADCLRC_RATE_WIDTH 11 /* ADCLRC_RATE - [10:0] */ | ||
326 | |||
327 | /* | ||
328 | * R10 (0x0A) - Audio Interface (4) | ||
329 | */ | ||
330 | #define WM8400_ALRCGPIO1 0x8000 /* ALRCGPIO1 */ | ||
331 | #define WM8400_ALRCGPIO1_MASK 0x8000 /* ALRCGPIO1 */ | ||
332 | #define WM8400_ALRCGPIO1_SHIFT 15 /* ALRCGPIO1 */ | ||
333 | #define WM8400_ALRCGPIO1_WIDTH 1 /* ALRCGPIO1 */ | ||
334 | #define WM8400_ALRCBGPIO6 0x4000 /* ALRCBGPIO6 */ | ||
335 | #define WM8400_ALRCBGPIO6_MASK 0x4000 /* ALRCBGPIO6 */ | ||
336 | #define WM8400_ALRCBGPIO6_SHIFT 14 /* ALRCBGPIO6 */ | ||
337 | #define WM8400_ALRCBGPIO6_WIDTH 1 /* ALRCBGPIO6 */ | ||
338 | #define WM8400_AIF_TRIS 0x2000 /* AIF_TRIS */ | ||
339 | #define WM8400_AIF_TRIS_MASK 0x2000 /* AIF_TRIS */ | ||
340 | #define WM8400_AIF_TRIS_SHIFT 13 /* AIF_TRIS */ | ||
341 | #define WM8400_AIF_TRIS_WIDTH 1 /* AIF_TRIS */ | ||
342 | #define WM8400_DACLRC_DIR 0x0800 /* DACLRC_DIR */ | ||
343 | #define WM8400_DACLRC_DIR_MASK 0x0800 /* DACLRC_DIR */ | ||
344 | #define WM8400_DACLRC_DIR_SHIFT 11 /* DACLRC_DIR */ | ||
345 | #define WM8400_DACLRC_DIR_WIDTH 1 /* DACLRC_DIR */ | ||
346 | #define WM8400_DACLRC_RATE_MASK 0x07FF /* DACLRC_RATE - [10:0] */ | ||
347 | #define WM8400_DACLRC_RATE_SHIFT 0 /* DACLRC_RATE - [10:0] */ | ||
348 | #define WM8400_DACLRC_RATE_WIDTH 11 /* DACLRC_RATE - [10:0] */ | ||
349 | |||
350 | /* | ||
351 | * R11 (0x0B) - DAC CTRL | ||
352 | */ | ||
353 | #define WM8400_DAC_SDMCLK_RATE 0x2000 /* DAC_SDMCLK_RATE */ | ||
354 | #define WM8400_DAC_SDMCLK_RATE_MASK 0x2000 /* DAC_SDMCLK_RATE */ | ||
355 | #define WM8400_DAC_SDMCLK_RATE_SHIFT 13 /* DAC_SDMCLK_RATE */ | ||
356 | #define WM8400_DAC_SDMCLK_RATE_WIDTH 1 /* DAC_SDMCLK_RATE */ | ||
357 | #define WM8400_AIF_LRCLKRATE 0x0400 /* AIF_LRCLKRATE */ | ||
358 | #define WM8400_AIF_LRCLKRATE_MASK 0x0400 /* AIF_LRCLKRATE */ | ||
359 | #define WM8400_AIF_LRCLKRATE_SHIFT 10 /* AIF_LRCLKRATE */ | ||
360 | #define WM8400_AIF_LRCLKRATE_WIDTH 1 /* AIF_LRCLKRATE */ | ||
361 | #define WM8400_DAC_MONO 0x0200 /* DAC_MONO */ | ||
362 | #define WM8400_DAC_MONO_MASK 0x0200 /* DAC_MONO */ | ||
363 | #define WM8400_DAC_MONO_SHIFT 9 /* DAC_MONO */ | ||
364 | #define WM8400_DAC_MONO_WIDTH 1 /* DAC_MONO */ | ||
365 | #define WM8400_DAC_SB_FILT 0x0100 /* DAC_SB_FILT */ | ||
366 | #define WM8400_DAC_SB_FILT_MASK 0x0100 /* DAC_SB_FILT */ | ||
367 | #define WM8400_DAC_SB_FILT_SHIFT 8 /* DAC_SB_FILT */ | ||
368 | #define WM8400_DAC_SB_FILT_WIDTH 1 /* DAC_SB_FILT */ | ||
369 | #define WM8400_DAC_MUTERATE 0x0080 /* DAC_MUTERATE */ | ||
370 | #define WM8400_DAC_MUTERATE_MASK 0x0080 /* DAC_MUTERATE */ | ||
371 | #define WM8400_DAC_MUTERATE_SHIFT 7 /* DAC_MUTERATE */ | ||
372 | #define WM8400_DAC_MUTERATE_WIDTH 1 /* DAC_MUTERATE */ | ||
373 | #define WM8400_DAC_MUTEMODE 0x0040 /* DAC_MUTEMODE */ | ||
374 | #define WM8400_DAC_MUTEMODE_MASK 0x0040 /* DAC_MUTEMODE */ | ||
375 | #define WM8400_DAC_MUTEMODE_SHIFT 6 /* DAC_MUTEMODE */ | ||
376 | #define WM8400_DAC_MUTEMODE_WIDTH 1 /* DAC_MUTEMODE */ | ||
377 | #define WM8400_DEEMP_MASK 0x0030 /* DEEMP - [5:4] */ | ||
378 | #define WM8400_DEEMP_SHIFT 4 /* DEEMP - [5:4] */ | ||
379 | #define WM8400_DEEMP_WIDTH 2 /* DEEMP - [5:4] */ | ||
380 | #define WM8400_DAC_MUTE 0x0004 /* DAC_MUTE */ | ||
381 | #define WM8400_DAC_MUTE_MASK 0x0004 /* DAC_MUTE */ | ||
382 | #define WM8400_DAC_MUTE_SHIFT 2 /* DAC_MUTE */ | ||
383 | #define WM8400_DAC_MUTE_WIDTH 1 /* DAC_MUTE */ | ||
384 | #define WM8400_DACL_DATINV 0x0002 /* DACL_DATINV */ | ||
385 | #define WM8400_DACL_DATINV_MASK 0x0002 /* DACL_DATINV */ | ||
386 | #define WM8400_DACL_DATINV_SHIFT 1 /* DACL_DATINV */ | ||
387 | #define WM8400_DACL_DATINV_WIDTH 1 /* DACL_DATINV */ | ||
388 | #define WM8400_DACR_DATINV 0x0001 /* DACR_DATINV */ | ||
389 | #define WM8400_DACR_DATINV_MASK 0x0001 /* DACR_DATINV */ | ||
390 | #define WM8400_DACR_DATINV_SHIFT 0 /* DACR_DATINV */ | ||
391 | #define WM8400_DACR_DATINV_WIDTH 1 /* DACR_DATINV */ | ||
392 | |||
393 | /* | ||
394 | * R12 (0x0C) - Left DAC Digital Volume | ||
395 | */ | ||
396 | #define WM8400_DAC_VU 0x0100 /* DAC_VU */ | ||
397 | #define WM8400_DAC_VU_MASK 0x0100 /* DAC_VU */ | ||
398 | #define WM8400_DAC_VU_SHIFT 8 /* DAC_VU */ | ||
399 | #define WM8400_DAC_VU_WIDTH 1 /* DAC_VU */ | ||
400 | #define WM8400_DACL_VOL_MASK 0x00FF /* DACL_VOL - [7:0] */ | ||
401 | #define WM8400_DACL_VOL_SHIFT 0 /* DACL_VOL - [7:0] */ | ||
402 | #define WM8400_DACL_VOL_WIDTH 8 /* DACL_VOL - [7:0] */ | ||
403 | |||
404 | /* | ||
405 | * R13 (0x0D) - Right DAC Digital Volume | ||
406 | */ | ||
407 | #define WM8400_DAC_VU 0x0100 /* DAC_VU */ | ||
408 | #define WM8400_DAC_VU_MASK 0x0100 /* DAC_VU */ | ||
409 | #define WM8400_DAC_VU_SHIFT 8 /* DAC_VU */ | ||
410 | #define WM8400_DAC_VU_WIDTH 1 /* DAC_VU */ | ||
411 | #define WM8400_DACR_VOL_MASK 0x00FF /* DACR_VOL - [7:0] */ | ||
412 | #define WM8400_DACR_VOL_SHIFT 0 /* DACR_VOL - [7:0] */ | ||
413 | #define WM8400_DACR_VOL_WIDTH 8 /* DACR_VOL - [7:0] */ | ||
414 | |||
415 | /* | ||
416 | * R14 (0x0E) - Digital Side Tone | ||
417 | */ | ||
418 | #define WM8400_ADCL_DAC_SVOL_MASK 0x1E00 /* ADCL_DAC_SVOL - [12:9] */ | ||
419 | #define WM8400_ADCL_DAC_SVOL_SHIFT 9 /* ADCL_DAC_SVOL - [12:9] */ | ||
420 | #define WM8400_ADCL_DAC_SVOL_WIDTH 4 /* ADCL_DAC_SVOL - [12:9] */ | ||
421 | #define WM8400_ADCR_DAC_SVOL_MASK 0x01E0 /* ADCR_DAC_SVOL - [8:5] */ | ||
422 | #define WM8400_ADCR_DAC_SVOL_SHIFT 5 /* ADCR_DAC_SVOL - [8:5] */ | ||
423 | #define WM8400_ADCR_DAC_SVOL_WIDTH 4 /* ADCR_DAC_SVOL - [8:5] */ | ||
424 | #define WM8400_ADC_TO_DACL_MASK 0x000C /* ADC_TO_DACL - [3:2] */ | ||
425 | #define WM8400_ADC_TO_DACL_SHIFT 2 /* ADC_TO_DACL - [3:2] */ | ||
426 | #define WM8400_ADC_TO_DACL_WIDTH 2 /* ADC_TO_DACL - [3:2] */ | ||
427 | #define WM8400_ADC_TO_DACR_MASK 0x0003 /* ADC_TO_DACR - [1:0] */ | ||
428 | #define WM8400_ADC_TO_DACR_SHIFT 0 /* ADC_TO_DACR - [1:0] */ | ||
429 | #define WM8400_ADC_TO_DACR_WIDTH 2 /* ADC_TO_DACR - [1:0] */ | ||
430 | |||
431 | /* | ||
432 | * R15 (0x0F) - ADC CTRL | ||
433 | */ | ||
434 | #define WM8400_ADC_HPF_ENA 0x0100 /* ADC_HPF_ENA */ | ||
435 | #define WM8400_ADC_HPF_ENA_MASK 0x0100 /* ADC_HPF_ENA */ | ||
436 | #define WM8400_ADC_HPF_ENA_SHIFT 8 /* ADC_HPF_ENA */ | ||
437 | #define WM8400_ADC_HPF_ENA_WIDTH 1 /* ADC_HPF_ENA */ | ||
438 | #define WM8400_ADC_HPF_CUT_MASK 0x0060 /* ADC_HPF_CUT - [6:5] */ | ||
439 | #define WM8400_ADC_HPF_CUT_SHIFT 5 /* ADC_HPF_CUT - [6:5] */ | ||
440 | #define WM8400_ADC_HPF_CUT_WIDTH 2 /* ADC_HPF_CUT - [6:5] */ | ||
441 | #define WM8400_ADCL_DATINV 0x0002 /* ADCL_DATINV */ | ||
442 | #define WM8400_ADCL_DATINV_MASK 0x0002 /* ADCL_DATINV */ | ||
443 | #define WM8400_ADCL_DATINV_SHIFT 1 /* ADCL_DATINV */ | ||
444 | #define WM8400_ADCL_DATINV_WIDTH 1 /* ADCL_DATINV */ | ||
445 | #define WM8400_ADCR_DATINV 0x0001 /* ADCR_DATINV */ | ||
446 | #define WM8400_ADCR_DATINV_MASK 0x0001 /* ADCR_DATINV */ | ||
447 | #define WM8400_ADCR_DATINV_SHIFT 0 /* ADCR_DATINV */ | ||
448 | #define WM8400_ADCR_DATINV_WIDTH 1 /* ADCR_DATINV */ | ||
449 | |||
450 | /* | ||
451 | * R16 (0x10) - Left ADC Digital Volume | ||
452 | */ | ||
453 | #define WM8400_ADC_VU 0x0100 /* ADC_VU */ | ||
454 | #define WM8400_ADC_VU_MASK 0x0100 /* ADC_VU */ | ||
455 | #define WM8400_ADC_VU_SHIFT 8 /* ADC_VU */ | ||
456 | #define WM8400_ADC_VU_WIDTH 1 /* ADC_VU */ | ||
457 | #define WM8400_ADCL_VOL_MASK 0x00FF /* ADCL_VOL - [7:0] */ | ||
458 | #define WM8400_ADCL_VOL_SHIFT 0 /* ADCL_VOL - [7:0] */ | ||
459 | #define WM8400_ADCL_VOL_WIDTH 8 /* ADCL_VOL - [7:0] */ | ||
460 | |||
461 | /* | ||
462 | * R17 (0x11) - Right ADC Digital Volume | ||
463 | */ | ||
464 | #define WM8400_ADC_VU 0x0100 /* ADC_VU */ | ||
465 | #define WM8400_ADC_VU_MASK 0x0100 /* ADC_VU */ | ||
466 | #define WM8400_ADC_VU_SHIFT 8 /* ADC_VU */ | ||
467 | #define WM8400_ADC_VU_WIDTH 1 /* ADC_VU */ | ||
468 | #define WM8400_ADCR_VOL_MASK 0x00FF /* ADCR_VOL - [7:0] */ | ||
469 | #define WM8400_ADCR_VOL_SHIFT 0 /* ADCR_VOL - [7:0] */ | ||
470 | #define WM8400_ADCR_VOL_WIDTH 8 /* ADCR_VOL - [7:0] */ | ||
471 | |||
472 | /* | ||
473 | * R24 (0x18) - Left Line Input 1&2 Volume | ||
474 | */ | ||
475 | #define WM8400_IPVU 0x0100 /* IPVU */ | ||
476 | #define WM8400_IPVU_MASK 0x0100 /* IPVU */ | ||
477 | #define WM8400_IPVU_SHIFT 8 /* IPVU */ | ||
478 | #define WM8400_IPVU_WIDTH 1 /* IPVU */ | ||
479 | #define WM8400_LI12MUTE 0x0080 /* LI12MUTE */ | ||
480 | #define WM8400_LI12MUTE_MASK 0x0080 /* LI12MUTE */ | ||
481 | #define WM8400_LI12MUTE_SHIFT 7 /* LI12MUTE */ | ||
482 | #define WM8400_LI12MUTE_WIDTH 1 /* LI12MUTE */ | ||
483 | #define WM8400_LI12ZC 0x0040 /* LI12ZC */ | ||
484 | #define WM8400_LI12ZC_MASK 0x0040 /* LI12ZC */ | ||
485 | #define WM8400_LI12ZC_SHIFT 6 /* LI12ZC */ | ||
486 | #define WM8400_LI12ZC_WIDTH 1 /* LI12ZC */ | ||
487 | #define WM8400_LIN12VOL_MASK 0x001F /* LIN12VOL - [4:0] */ | ||
488 | #define WM8400_LIN12VOL_SHIFT 0 /* LIN12VOL - [4:0] */ | ||
489 | #define WM8400_LIN12VOL_WIDTH 5 /* LIN12VOL - [4:0] */ | ||
490 | |||
491 | /* | ||
492 | * R25 (0x19) - Left Line Input 3&4 Volume | ||
493 | */ | ||
494 | #define WM8400_IPVU 0x0100 /* IPVU */ | ||
495 | #define WM8400_IPVU_MASK 0x0100 /* IPVU */ | ||
496 | #define WM8400_IPVU_SHIFT 8 /* IPVU */ | ||
497 | #define WM8400_IPVU_WIDTH 1 /* IPVU */ | ||
498 | #define WM8400_LI34MUTE 0x0080 /* LI34MUTE */ | ||
499 | #define WM8400_LI34MUTE_MASK 0x0080 /* LI34MUTE */ | ||
500 | #define WM8400_LI34MUTE_SHIFT 7 /* LI34MUTE */ | ||
501 | #define WM8400_LI34MUTE_WIDTH 1 /* LI34MUTE */ | ||
502 | #define WM8400_LI34ZC 0x0040 /* LI34ZC */ | ||
503 | #define WM8400_LI34ZC_MASK 0x0040 /* LI34ZC */ | ||
504 | #define WM8400_LI34ZC_SHIFT 6 /* LI34ZC */ | ||
505 | #define WM8400_LI34ZC_WIDTH 1 /* LI34ZC */ | ||
506 | #define WM8400_LIN34VOL_MASK 0x001F /* LIN34VOL - [4:0] */ | ||
507 | #define WM8400_LIN34VOL_SHIFT 0 /* LIN34VOL - [4:0] */ | ||
508 | #define WM8400_LIN34VOL_WIDTH 5 /* LIN34VOL - [4:0] */ | ||
509 | |||
510 | /* | ||
511 | * R26 (0x1A) - Right Line Input 1&2 Volume | ||
512 | */ | ||
513 | #define WM8400_IPVU 0x0100 /* IPVU */ | ||
514 | #define WM8400_IPVU_MASK 0x0100 /* IPVU */ | ||
515 | #define WM8400_IPVU_SHIFT 8 /* IPVU */ | ||
516 | #define WM8400_IPVU_WIDTH 1 /* IPVU */ | ||
517 | #define WM8400_RI12MUTE 0x0080 /* RI12MUTE */ | ||
518 | #define WM8400_RI12MUTE_MASK 0x0080 /* RI12MUTE */ | ||
519 | #define WM8400_RI12MUTE_SHIFT 7 /* RI12MUTE */ | ||
520 | #define WM8400_RI12MUTE_WIDTH 1 /* RI12MUTE */ | ||
521 | #define WM8400_RI12ZC 0x0040 /* RI12ZC */ | ||
522 | #define WM8400_RI12ZC_MASK 0x0040 /* RI12ZC */ | ||
523 | #define WM8400_RI12ZC_SHIFT 6 /* RI12ZC */ | ||
524 | #define WM8400_RI12ZC_WIDTH 1 /* RI12ZC */ | ||
525 | #define WM8400_RIN12VOL_MASK 0x001F /* RIN12VOL - [4:0] */ | ||
526 | #define WM8400_RIN12VOL_SHIFT 0 /* RIN12VOL - [4:0] */ | ||
527 | #define WM8400_RIN12VOL_WIDTH 5 /* RIN12VOL - [4:0] */ | ||
528 | |||
529 | /* | ||
530 | * R27 (0x1B) - Right Line Input 3&4 Volume | ||
531 | */ | ||
532 | #define WM8400_IPVU 0x0100 /* IPVU */ | ||
533 | #define WM8400_IPVU_MASK 0x0100 /* IPVU */ | ||
534 | #define WM8400_IPVU_SHIFT 8 /* IPVU */ | ||
535 | #define WM8400_IPVU_WIDTH 1 /* IPVU */ | ||
536 | #define WM8400_RI34MUTE 0x0080 /* RI34MUTE */ | ||
537 | #define WM8400_RI34MUTE_MASK 0x0080 /* RI34MUTE */ | ||
538 | #define WM8400_RI34MUTE_SHIFT 7 /* RI34MUTE */ | ||
539 | #define WM8400_RI34MUTE_WIDTH 1 /* RI34MUTE */ | ||
540 | #define WM8400_RI34ZC 0x0040 /* RI34ZC */ | ||
541 | #define WM8400_RI34ZC_MASK 0x0040 /* RI34ZC */ | ||
542 | #define WM8400_RI34ZC_SHIFT 6 /* RI34ZC */ | ||
543 | #define WM8400_RI34ZC_WIDTH 1 /* RI34ZC */ | ||
544 | #define WM8400_RIN34VOL_MASK 0x001F /* RIN34VOL - [4:0] */ | ||
545 | #define WM8400_RIN34VOL_SHIFT 0 /* RIN34VOL - [4:0] */ | ||
546 | #define WM8400_RIN34VOL_WIDTH 5 /* RIN34VOL - [4:0] */ | ||
547 | |||
548 | /* | ||
549 | * R28 (0x1C) - Left Output Volume | ||
550 | */ | ||
551 | #define WM8400_OPVU 0x0100 /* OPVU */ | ||
552 | #define WM8400_OPVU_MASK 0x0100 /* OPVU */ | ||
553 | #define WM8400_OPVU_SHIFT 8 /* OPVU */ | ||
554 | #define WM8400_OPVU_WIDTH 1 /* OPVU */ | ||
555 | #define WM8400_LOZC 0x0080 /* LOZC */ | ||
556 | #define WM8400_LOZC_MASK 0x0080 /* LOZC */ | ||
557 | #define WM8400_LOZC_SHIFT 7 /* LOZC */ | ||
558 | #define WM8400_LOZC_WIDTH 1 /* LOZC */ | ||
559 | #define WM8400_LOUTVOL_MASK 0x007F /* LOUTVOL - [6:0] */ | ||
560 | #define WM8400_LOUTVOL_SHIFT 0 /* LOUTVOL - [6:0] */ | ||
561 | #define WM8400_LOUTVOL_WIDTH 7 /* LOUTVOL - [6:0] */ | ||
562 | |||
563 | /* | ||
564 | * R29 (0x1D) - Right Output Volume | ||
565 | */ | ||
566 | #define WM8400_OPVU 0x0100 /* OPVU */ | ||
567 | #define WM8400_OPVU_MASK 0x0100 /* OPVU */ | ||
568 | #define WM8400_OPVU_SHIFT 8 /* OPVU */ | ||
569 | #define WM8400_OPVU_WIDTH 1 /* OPVU */ | ||
570 | #define WM8400_ROZC 0x0080 /* ROZC */ | ||
571 | #define WM8400_ROZC_MASK 0x0080 /* ROZC */ | ||
572 | #define WM8400_ROZC_SHIFT 7 /* ROZC */ | ||
573 | #define WM8400_ROZC_WIDTH 1 /* ROZC */ | ||
574 | #define WM8400_ROUTVOL_MASK 0x007F /* ROUTVOL - [6:0] */ | ||
575 | #define WM8400_ROUTVOL_SHIFT 0 /* ROUTVOL - [6:0] */ | ||
576 | #define WM8400_ROUTVOL_WIDTH 7 /* ROUTVOL - [6:0] */ | ||
577 | |||
578 | /* | ||
579 | * R30 (0x1E) - Line Outputs Volume | ||
580 | */ | ||
581 | #define WM8400_LONMUTE 0x0040 /* LONMUTE */ | ||
582 | #define WM8400_LONMUTE_MASK 0x0040 /* LONMUTE */ | ||
583 | #define WM8400_LONMUTE_SHIFT 6 /* LONMUTE */ | ||
584 | #define WM8400_LONMUTE_WIDTH 1 /* LONMUTE */ | ||
585 | #define WM8400_LOPMUTE 0x0020 /* LOPMUTE */ | ||
586 | #define WM8400_LOPMUTE_MASK 0x0020 /* LOPMUTE */ | ||
587 | #define WM8400_LOPMUTE_SHIFT 5 /* LOPMUTE */ | ||
588 | #define WM8400_LOPMUTE_WIDTH 1 /* LOPMUTE */ | ||
589 | #define WM8400_LOATTN 0x0010 /* LOATTN */ | ||
590 | #define WM8400_LOATTN_MASK 0x0010 /* LOATTN */ | ||
591 | #define WM8400_LOATTN_SHIFT 4 /* LOATTN */ | ||
592 | #define WM8400_LOATTN_WIDTH 1 /* LOATTN */ | ||
593 | #define WM8400_RONMUTE 0x0004 /* RONMUTE */ | ||
594 | #define WM8400_RONMUTE_MASK 0x0004 /* RONMUTE */ | ||
595 | #define WM8400_RONMUTE_SHIFT 2 /* RONMUTE */ | ||
596 | #define WM8400_RONMUTE_WIDTH 1 /* RONMUTE */ | ||
597 | #define WM8400_ROPMUTE 0x0002 /* ROPMUTE */ | ||
598 | #define WM8400_ROPMUTE_MASK 0x0002 /* ROPMUTE */ | ||
599 | #define WM8400_ROPMUTE_SHIFT 1 /* ROPMUTE */ | ||
600 | #define WM8400_ROPMUTE_WIDTH 1 /* ROPMUTE */ | ||
601 | #define WM8400_ROATTN 0x0001 /* ROATTN */ | ||
602 | #define WM8400_ROATTN_MASK 0x0001 /* ROATTN */ | ||
603 | #define WM8400_ROATTN_SHIFT 0 /* ROATTN */ | ||
604 | #define WM8400_ROATTN_WIDTH 1 /* ROATTN */ | ||
605 | |||
606 | /* | ||
607 | * R31 (0x1F) - Out3/4 Volume | ||
608 | */ | ||
609 | #define WM8400_OUT3MUTE 0x0020 /* OUT3MUTE */ | ||
610 | #define WM8400_OUT3MUTE_MASK 0x0020 /* OUT3MUTE */ | ||
611 | #define WM8400_OUT3MUTE_SHIFT 5 /* OUT3MUTE */ | ||
612 | #define WM8400_OUT3MUTE_WIDTH 1 /* OUT3MUTE */ | ||
613 | #define WM8400_OUT3ATTN 0x0010 /* OUT3ATTN */ | ||
614 | #define WM8400_OUT3ATTN_MASK 0x0010 /* OUT3ATTN */ | ||
615 | #define WM8400_OUT3ATTN_SHIFT 4 /* OUT3ATTN */ | ||
616 | #define WM8400_OUT3ATTN_WIDTH 1 /* OUT3ATTN */ | ||
617 | #define WM8400_OUT4MUTE 0x0002 /* OUT4MUTE */ | ||
618 | #define WM8400_OUT4MUTE_MASK 0x0002 /* OUT4MUTE */ | ||
619 | #define WM8400_OUT4MUTE_SHIFT 1 /* OUT4MUTE */ | ||
620 | #define WM8400_OUT4MUTE_WIDTH 1 /* OUT4MUTE */ | ||
621 | #define WM8400_OUT4ATTN 0x0001 /* OUT4ATTN */ | ||
622 | #define WM8400_OUT4ATTN_MASK 0x0001 /* OUT4ATTN */ | ||
623 | #define WM8400_OUT4ATTN_SHIFT 0 /* OUT4ATTN */ | ||
624 | #define WM8400_OUT4ATTN_WIDTH 1 /* OUT4ATTN */ | ||
625 | |||
626 | /* | ||
627 | * R32 (0x20) - Left OPGA Volume | ||
628 | */ | ||
629 | #define WM8400_OPVU 0x0100 /* OPVU */ | ||
630 | #define WM8400_OPVU_MASK 0x0100 /* OPVU */ | ||
631 | #define WM8400_OPVU_SHIFT 8 /* OPVU */ | ||
632 | #define WM8400_OPVU_WIDTH 1 /* OPVU */ | ||
633 | #define WM8400_LOPGAZC 0x0080 /* LOPGAZC */ | ||
634 | #define WM8400_LOPGAZC_MASK 0x0080 /* LOPGAZC */ | ||
635 | #define WM8400_LOPGAZC_SHIFT 7 /* LOPGAZC */ | ||
636 | #define WM8400_LOPGAZC_WIDTH 1 /* LOPGAZC */ | ||
637 | #define WM8400_LOPGAVOL_MASK 0x007F /* LOPGAVOL - [6:0] */ | ||
638 | #define WM8400_LOPGAVOL_SHIFT 0 /* LOPGAVOL - [6:0] */ | ||
639 | #define WM8400_LOPGAVOL_WIDTH 7 /* LOPGAVOL - [6:0] */ | ||
640 | |||
641 | /* | ||
642 | * R33 (0x21) - Right OPGA Volume | ||
643 | */ | ||
644 | #define WM8400_OPVU 0x0100 /* OPVU */ | ||
645 | #define WM8400_OPVU_MASK 0x0100 /* OPVU */ | ||
646 | #define WM8400_OPVU_SHIFT 8 /* OPVU */ | ||
647 | #define WM8400_OPVU_WIDTH 1 /* OPVU */ | ||
648 | #define WM8400_ROPGAZC 0x0080 /* ROPGAZC */ | ||
649 | #define WM8400_ROPGAZC_MASK 0x0080 /* ROPGAZC */ | ||
650 | #define WM8400_ROPGAZC_SHIFT 7 /* ROPGAZC */ | ||
651 | #define WM8400_ROPGAZC_WIDTH 1 /* ROPGAZC */ | ||
652 | #define WM8400_ROPGAVOL_MASK 0x007F /* ROPGAVOL - [6:0] */ | ||
653 | #define WM8400_ROPGAVOL_SHIFT 0 /* ROPGAVOL - [6:0] */ | ||
654 | #define WM8400_ROPGAVOL_WIDTH 7 /* ROPGAVOL - [6:0] */ | ||
655 | |||
656 | /* | ||
657 | * R34 (0x22) - Speaker Volume | ||
658 | */ | ||
659 | #define WM8400_SPKATTN_MASK 0x0003 /* SPKATTN - [1:0] */ | ||
660 | #define WM8400_SPKATTN_SHIFT 0 /* SPKATTN - [1:0] */ | ||
661 | #define WM8400_SPKATTN_WIDTH 2 /* SPKATTN - [1:0] */ | ||
662 | |||
663 | /* | ||
664 | * R35 (0x23) - ClassD1 | ||
665 | */ | ||
666 | #define WM8400_CDMODE 0x0100 /* CDMODE */ | ||
667 | #define WM8400_CDMODE_MASK 0x0100 /* CDMODE */ | ||
668 | #define WM8400_CDMODE_SHIFT 8 /* CDMODE */ | ||
669 | #define WM8400_CDMODE_WIDTH 1 /* CDMODE */ | ||
670 | #define WM8400_CLASSD_CLK_SEL 0x0080 /* CLASSD_CLK_SEL */ | ||
671 | #define WM8400_CLASSD_CLK_SEL_MASK 0x0080 /* CLASSD_CLK_SEL */ | ||
672 | #define WM8400_CLASSD_CLK_SEL_SHIFT 7 /* CLASSD_CLK_SEL */ | ||
673 | #define WM8400_CLASSD_CLK_SEL_WIDTH 1 /* CLASSD_CLK_SEL */ | ||
674 | #define WM8400_CD_SRCTRL 0x0040 /* CD_SRCTRL */ | ||
675 | #define WM8400_CD_SRCTRL_MASK 0x0040 /* CD_SRCTRL */ | ||
676 | #define WM8400_CD_SRCTRL_SHIFT 6 /* CD_SRCTRL */ | ||
677 | #define WM8400_CD_SRCTRL_WIDTH 1 /* CD_SRCTRL */ | ||
678 | #define WM8400_SPKNOPOP 0x0020 /* SPKNOPOP */ | ||
679 | #define WM8400_SPKNOPOP_MASK 0x0020 /* SPKNOPOP */ | ||
680 | #define WM8400_SPKNOPOP_SHIFT 5 /* SPKNOPOP */ | ||
681 | #define WM8400_SPKNOPOP_WIDTH 1 /* SPKNOPOP */ | ||
682 | #define WM8400_DBLERATE 0x0010 /* DBLERATE */ | ||
683 | #define WM8400_DBLERATE_MASK 0x0010 /* DBLERATE */ | ||
684 | #define WM8400_DBLERATE_SHIFT 4 /* DBLERATE */ | ||
685 | #define WM8400_DBLERATE_WIDTH 1 /* DBLERATE */ | ||
686 | #define WM8400_LOOPTEST 0x0008 /* LOOPTEST */ | ||
687 | #define WM8400_LOOPTEST_MASK 0x0008 /* LOOPTEST */ | ||
688 | #define WM8400_LOOPTEST_SHIFT 3 /* LOOPTEST */ | ||
689 | #define WM8400_LOOPTEST_WIDTH 1 /* LOOPTEST */ | ||
690 | #define WM8400_HALFABBIAS 0x0004 /* HALFABBIAS */ | ||
691 | #define WM8400_HALFABBIAS_MASK 0x0004 /* HALFABBIAS */ | ||
692 | #define WM8400_HALFABBIAS_SHIFT 2 /* HALFABBIAS */ | ||
693 | #define WM8400_HALFABBIAS_WIDTH 1 /* HALFABBIAS */ | ||
694 | #define WM8400_TRIDEL_MASK 0x0003 /* TRIDEL - [1:0] */ | ||
695 | #define WM8400_TRIDEL_SHIFT 0 /* TRIDEL - [1:0] */ | ||
696 | #define WM8400_TRIDEL_WIDTH 2 /* TRIDEL - [1:0] */ | ||
697 | |||
698 | /* | ||
699 | * R37 (0x25) - ClassD3 | ||
700 | */ | ||
701 | #define WM8400_DCGAIN_MASK 0x0038 /* DCGAIN - [5:3] */ | ||
702 | #define WM8400_DCGAIN_SHIFT 3 /* DCGAIN - [5:3] */ | ||
703 | #define WM8400_DCGAIN_WIDTH 3 /* DCGAIN - [5:3] */ | ||
704 | #define WM8400_ACGAIN_MASK 0x0007 /* ACGAIN - [2:0] */ | ||
705 | #define WM8400_ACGAIN_SHIFT 0 /* ACGAIN - [2:0] */ | ||
706 | #define WM8400_ACGAIN_WIDTH 3 /* ACGAIN - [2:0] */ | ||
707 | |||
708 | /* | ||
709 | * R39 (0x27) - Input Mixer1 | ||
710 | */ | ||
711 | #define WM8400_AINLMODE_MASK 0x000C /* AINLMODE - [3:2] */ | ||
712 | #define WM8400_AINLMODE_SHIFT 2 /* AINLMODE - [3:2] */ | ||
713 | #define WM8400_AINLMODE_WIDTH 2 /* AINLMODE - [3:2] */ | ||
714 | #define WM8400_AINRMODE_MASK 0x0003 /* AINRMODE - [1:0] */ | ||
715 | #define WM8400_AINRMODE_SHIFT 0 /* AINRMODE - [1:0] */ | ||
716 | #define WM8400_AINRMODE_WIDTH 2 /* AINRMODE - [1:0] */ | ||
717 | |||
718 | /* | ||
719 | * R40 (0x28) - Input Mixer2 | ||
720 | */ | ||
721 | #define WM8400_LMP4 0x0080 /* LMP4 */ | ||
722 | #define WM8400_LMP4_MASK 0x0080 /* LMP4 */ | ||
723 | #define WM8400_LMP4_SHIFT 7 /* LMP4 */ | ||
724 | #define WM8400_LMP4_WIDTH 1 /* LMP4 */ | ||
725 | #define WM8400_LMN3 0x0040 /* LMN3 */ | ||
726 | #define WM8400_LMN3_MASK 0x0040 /* LMN3 */ | ||
727 | #define WM8400_LMN3_SHIFT 6 /* LMN3 */ | ||
728 | #define WM8400_LMN3_WIDTH 1 /* LMN3 */ | ||
729 | #define WM8400_LMP2 0x0020 /* LMP2 */ | ||
730 | #define WM8400_LMP2_MASK 0x0020 /* LMP2 */ | ||
731 | #define WM8400_LMP2_SHIFT 5 /* LMP2 */ | ||
732 | #define WM8400_LMP2_WIDTH 1 /* LMP2 */ | ||
733 | #define WM8400_LMN1 0x0010 /* LMN1 */ | ||
734 | #define WM8400_LMN1_MASK 0x0010 /* LMN1 */ | ||
735 | #define WM8400_LMN1_SHIFT 4 /* LMN1 */ | ||
736 | #define WM8400_LMN1_WIDTH 1 /* LMN1 */ | ||
737 | #define WM8400_RMP4 0x0008 /* RMP4 */ | ||
738 | #define WM8400_RMP4_MASK 0x0008 /* RMP4 */ | ||
739 | #define WM8400_RMP4_SHIFT 3 /* RMP4 */ | ||
740 | #define WM8400_RMP4_WIDTH 1 /* RMP4 */ | ||
741 | #define WM8400_RMN3 0x0004 /* RMN3 */ | ||
742 | #define WM8400_RMN3_MASK 0x0004 /* RMN3 */ | ||
743 | #define WM8400_RMN3_SHIFT 2 /* RMN3 */ | ||
744 | #define WM8400_RMN3_WIDTH 1 /* RMN3 */ | ||
745 | #define WM8400_RMP2 0x0002 /* RMP2 */ | ||
746 | #define WM8400_RMP2_MASK 0x0002 /* RMP2 */ | ||
747 | #define WM8400_RMP2_SHIFT 1 /* RMP2 */ | ||
748 | #define WM8400_RMP2_WIDTH 1 /* RMP2 */ | ||
749 | #define WM8400_RMN1 0x0001 /* RMN1 */ | ||
750 | #define WM8400_RMN1_MASK 0x0001 /* RMN1 */ | ||
751 | #define WM8400_RMN1_SHIFT 0 /* RMN1 */ | ||
752 | #define WM8400_RMN1_WIDTH 1 /* RMN1 */ | ||
753 | |||
754 | /* | ||
755 | * R41 (0x29) - Input Mixer3 | ||
756 | */ | ||
757 | #define WM8400_L34MNB 0x0100 /* L34MNB */ | ||
758 | #define WM8400_L34MNB_MASK 0x0100 /* L34MNB */ | ||
759 | #define WM8400_L34MNB_SHIFT 8 /* L34MNB */ | ||
760 | #define WM8400_L34MNB_WIDTH 1 /* L34MNB */ | ||
761 | #define WM8400_L34MNBST 0x0080 /* L34MNBST */ | ||
762 | #define WM8400_L34MNBST_MASK 0x0080 /* L34MNBST */ | ||
763 | #define WM8400_L34MNBST_SHIFT 7 /* L34MNBST */ | ||
764 | #define WM8400_L34MNBST_WIDTH 1 /* L34MNBST */ | ||
765 | #define WM8400_L12MNB 0x0020 /* L12MNB */ | ||
766 | #define WM8400_L12MNB_MASK 0x0020 /* L12MNB */ | ||
767 | #define WM8400_L12MNB_SHIFT 5 /* L12MNB */ | ||
768 | #define WM8400_L12MNB_WIDTH 1 /* L12MNB */ | ||
769 | #define WM8400_L12MNBST 0x0010 /* L12MNBST */ | ||
770 | #define WM8400_L12MNBST_MASK 0x0010 /* L12MNBST */ | ||
771 | #define WM8400_L12MNBST_SHIFT 4 /* L12MNBST */ | ||
772 | #define WM8400_L12MNBST_WIDTH 1 /* L12MNBST */ | ||
773 | #define WM8400_LDBVOL_MASK 0x0007 /* LDBVOL - [2:0] */ | ||
774 | #define WM8400_LDBVOL_SHIFT 0 /* LDBVOL - [2:0] */ | ||
775 | #define WM8400_LDBVOL_WIDTH 3 /* LDBVOL - [2:0] */ | ||
776 | |||
777 | /* | ||
778 | * R42 (0x2A) - Input Mixer4 | ||
779 | */ | ||
780 | #define WM8400_R34MNB 0x0100 /* R34MNB */ | ||
781 | #define WM8400_R34MNB_MASK 0x0100 /* R34MNB */ | ||
782 | #define WM8400_R34MNB_SHIFT 8 /* R34MNB */ | ||
783 | #define WM8400_R34MNB_WIDTH 1 /* R34MNB */ | ||
784 | #define WM8400_R34MNBST 0x0080 /* R34MNBST */ | ||
785 | #define WM8400_R34MNBST_MASK 0x0080 /* R34MNBST */ | ||
786 | #define WM8400_R34MNBST_SHIFT 7 /* R34MNBST */ | ||
787 | #define WM8400_R34MNBST_WIDTH 1 /* R34MNBST */ | ||
788 | #define WM8400_R12MNB 0x0020 /* R12MNB */ | ||
789 | #define WM8400_R12MNB_MASK 0x0020 /* R12MNB */ | ||
790 | #define WM8400_R12MNB_SHIFT 5 /* R12MNB */ | ||
791 | #define WM8400_R12MNB_WIDTH 1 /* R12MNB */ | ||
792 | #define WM8400_R12MNBST 0x0010 /* R12MNBST */ | ||
793 | #define WM8400_R12MNBST_MASK 0x0010 /* R12MNBST */ | ||
794 | #define WM8400_R12MNBST_SHIFT 4 /* R12MNBST */ | ||
795 | #define WM8400_R12MNBST_WIDTH 1 /* R12MNBST */ | ||
796 | #define WM8400_RDBVOL_MASK 0x0007 /* RDBVOL - [2:0] */ | ||
797 | #define WM8400_RDBVOL_SHIFT 0 /* RDBVOL - [2:0] */ | ||
798 | #define WM8400_RDBVOL_WIDTH 3 /* RDBVOL - [2:0] */ | ||
799 | |||
800 | /* | ||
801 | * R43 (0x2B) - Input Mixer5 | ||
802 | */ | ||
803 | #define WM8400_LI2BVOL_MASK 0x01C0 /* LI2BVOL - [8:6] */ | ||
804 | #define WM8400_LI2BVOL_SHIFT 6 /* LI2BVOL - [8:6] */ | ||
805 | #define WM8400_LI2BVOL_WIDTH 3 /* LI2BVOL - [8:6] */ | ||
806 | #define WM8400_LR4BVOL_MASK 0x0038 /* LR4BVOL - [5:3] */ | ||
807 | #define WM8400_LR4BVOL_SHIFT 3 /* LR4BVOL - [5:3] */ | ||
808 | #define WM8400_LR4BVOL_WIDTH 3 /* LR4BVOL - [5:3] */ | ||
809 | #define WM8400_LL4BVOL_MASK 0x0007 /* LL4BVOL - [2:0] */ | ||
810 | #define WM8400_LL4BVOL_SHIFT 0 /* LL4BVOL - [2:0] */ | ||
811 | #define WM8400_LL4BVOL_WIDTH 3 /* LL4BVOL - [2:0] */ | ||
812 | |||
813 | /* | ||
814 | * R44 (0x2C) - Input Mixer6 | ||
815 | */ | ||
816 | #define WM8400_RI2BVOL_MASK 0x01C0 /* RI2BVOL - [8:6] */ | ||
817 | #define WM8400_RI2BVOL_SHIFT 6 /* RI2BVOL - [8:6] */ | ||
818 | #define WM8400_RI2BVOL_WIDTH 3 /* RI2BVOL - [8:6] */ | ||
819 | #define WM8400_RL4BVOL_MASK 0x0038 /* RL4BVOL - [5:3] */ | ||
820 | #define WM8400_RL4BVOL_SHIFT 3 /* RL4BVOL - [5:3] */ | ||
821 | #define WM8400_RL4BVOL_WIDTH 3 /* RL4BVOL - [5:3] */ | ||
822 | #define WM8400_RR4BVOL_MASK 0x0007 /* RR4BVOL - [2:0] */ | ||
823 | #define WM8400_RR4BVOL_SHIFT 0 /* RR4BVOL - [2:0] */ | ||
824 | #define WM8400_RR4BVOL_WIDTH 3 /* RR4BVOL - [2:0] */ | ||
825 | |||
826 | /* | ||
827 | * R45 (0x2D) - Output Mixer1 | ||
828 | */ | ||
829 | #define WM8400_LRBLO 0x0080 /* LRBLO */ | ||
830 | #define WM8400_LRBLO_MASK 0x0080 /* LRBLO */ | ||
831 | #define WM8400_LRBLO_SHIFT 7 /* LRBLO */ | ||
832 | #define WM8400_LRBLO_WIDTH 1 /* LRBLO */ | ||
833 | #define WM8400_LLBLO 0x0040 /* LLBLO */ | ||
834 | #define WM8400_LLBLO_MASK 0x0040 /* LLBLO */ | ||
835 | #define WM8400_LLBLO_SHIFT 6 /* LLBLO */ | ||
836 | #define WM8400_LLBLO_WIDTH 1 /* LLBLO */ | ||
837 | #define WM8400_LRI3LO 0x0020 /* LRI3LO */ | ||
838 | #define WM8400_LRI3LO_MASK 0x0020 /* LRI3LO */ | ||
839 | #define WM8400_LRI3LO_SHIFT 5 /* LRI3LO */ | ||
840 | #define WM8400_LRI3LO_WIDTH 1 /* LRI3LO */ | ||
841 | #define WM8400_LLI3LO 0x0010 /* LLI3LO */ | ||
842 | #define WM8400_LLI3LO_MASK 0x0010 /* LLI3LO */ | ||
843 | #define WM8400_LLI3LO_SHIFT 4 /* LLI3LO */ | ||
844 | #define WM8400_LLI3LO_WIDTH 1 /* LLI3LO */ | ||
845 | #define WM8400_LR12LO 0x0008 /* LR12LO */ | ||
846 | #define WM8400_LR12LO_MASK 0x0008 /* LR12LO */ | ||
847 | #define WM8400_LR12LO_SHIFT 3 /* LR12LO */ | ||
848 | #define WM8400_LR12LO_WIDTH 1 /* LR12LO */ | ||
849 | #define WM8400_LL12LO 0x0004 /* LL12LO */ | ||
850 | #define WM8400_LL12LO_MASK 0x0004 /* LL12LO */ | ||
851 | #define WM8400_LL12LO_SHIFT 2 /* LL12LO */ | ||
852 | #define WM8400_LL12LO_WIDTH 1 /* LL12LO */ | ||
853 | #define WM8400_LDLO 0x0001 /* LDLO */ | ||
854 | #define WM8400_LDLO_MASK 0x0001 /* LDLO */ | ||
855 | #define WM8400_LDLO_SHIFT 0 /* LDLO */ | ||
856 | #define WM8400_LDLO_WIDTH 1 /* LDLO */ | ||
857 | |||
858 | /* | ||
859 | * R46 (0x2E) - Output Mixer2 | ||
860 | */ | ||
861 | #define WM8400_RLBRO 0x0080 /* RLBRO */ | ||
862 | #define WM8400_RLBRO_MASK 0x0080 /* RLBRO */ | ||
863 | #define WM8400_RLBRO_SHIFT 7 /* RLBRO */ | ||
864 | #define WM8400_RLBRO_WIDTH 1 /* RLBRO */ | ||
865 | #define WM8400_RRBRO 0x0040 /* RRBRO */ | ||
866 | #define WM8400_RRBRO_MASK 0x0040 /* RRBRO */ | ||
867 | #define WM8400_RRBRO_SHIFT 6 /* RRBRO */ | ||
868 | #define WM8400_RRBRO_WIDTH 1 /* RRBRO */ | ||
869 | #define WM8400_RLI3RO 0x0020 /* RLI3RO */ | ||
870 | #define WM8400_RLI3RO_MASK 0x0020 /* RLI3RO */ | ||
871 | #define WM8400_RLI3RO_SHIFT 5 /* RLI3RO */ | ||
872 | #define WM8400_RLI3RO_WIDTH 1 /* RLI3RO */ | ||
873 | #define WM8400_RRI3RO 0x0010 /* RRI3RO */ | ||
874 | #define WM8400_RRI3RO_MASK 0x0010 /* RRI3RO */ | ||
875 | #define WM8400_RRI3RO_SHIFT 4 /* RRI3RO */ | ||
876 | #define WM8400_RRI3RO_WIDTH 1 /* RRI3RO */ | ||
877 | #define WM8400_RL12RO 0x0008 /* RL12RO */ | ||
878 | #define WM8400_RL12RO_MASK 0x0008 /* RL12RO */ | ||
879 | #define WM8400_RL12RO_SHIFT 3 /* RL12RO */ | ||
880 | #define WM8400_RL12RO_WIDTH 1 /* RL12RO */ | ||
881 | #define WM8400_RR12RO 0x0004 /* RR12RO */ | ||
882 | #define WM8400_RR12RO_MASK 0x0004 /* RR12RO */ | ||
883 | #define WM8400_RR12RO_SHIFT 2 /* RR12RO */ | ||
884 | #define WM8400_RR12RO_WIDTH 1 /* RR12RO */ | ||
885 | #define WM8400_RDRO 0x0001 /* RDRO */ | ||
886 | #define WM8400_RDRO_MASK 0x0001 /* RDRO */ | ||
887 | #define WM8400_RDRO_SHIFT 0 /* RDRO */ | ||
888 | #define WM8400_RDRO_WIDTH 1 /* RDRO */ | ||
889 | |||
890 | /* | ||
891 | * R47 (0x2F) - Output Mixer3 | ||
892 | */ | ||
893 | #define WM8400_LLI3LOVOL_MASK 0x01C0 /* LLI3LOVOL - [8:6] */ | ||
894 | #define WM8400_LLI3LOVOL_SHIFT 6 /* LLI3LOVOL - [8:6] */ | ||
895 | #define WM8400_LLI3LOVOL_WIDTH 3 /* LLI3LOVOL - [8:6] */ | ||
896 | #define WM8400_LR12LOVOL_MASK 0x0038 /* LR12LOVOL - [5:3] */ | ||
897 | #define WM8400_LR12LOVOL_SHIFT 3 /* LR12LOVOL - [5:3] */ | ||
898 | #define WM8400_LR12LOVOL_WIDTH 3 /* LR12LOVOL - [5:3] */ | ||
899 | #define WM8400_LL12LOVOL_MASK 0x0007 /* LL12LOVOL - [2:0] */ | ||
900 | #define WM8400_LL12LOVOL_SHIFT 0 /* LL12LOVOL - [2:0] */ | ||
901 | #define WM8400_LL12LOVOL_WIDTH 3 /* LL12LOVOL - [2:0] */ | ||
902 | |||
903 | /* | ||
904 | * R48 (0x30) - Output Mixer4 | ||
905 | */ | ||
906 | #define WM8400_RRI3ROVOL_MASK 0x01C0 /* RRI3ROVOL - [8:6] */ | ||
907 | #define WM8400_RRI3ROVOL_SHIFT 6 /* RRI3ROVOL - [8:6] */ | ||
908 | #define WM8400_RRI3ROVOL_WIDTH 3 /* RRI3ROVOL - [8:6] */ | ||
909 | #define WM8400_RL12ROVOL_MASK 0x0038 /* RL12ROVOL - [5:3] */ | ||
910 | #define WM8400_RL12ROVOL_SHIFT 3 /* RL12ROVOL - [5:3] */ | ||
911 | #define WM8400_RL12ROVOL_WIDTH 3 /* RL12ROVOL - [5:3] */ | ||
912 | #define WM8400_RR12ROVOL_MASK 0x0007 /* RR12ROVOL - [2:0] */ | ||
913 | #define WM8400_RR12ROVOL_SHIFT 0 /* RR12ROVOL - [2:0] */ | ||
914 | #define WM8400_RR12ROVOL_WIDTH 3 /* RR12ROVOL - [2:0] */ | ||
915 | |||
916 | /* | ||
917 | * R49 (0x31) - Output Mixer5 | ||
918 | */ | ||
919 | #define WM8400_LRI3LOVOL_MASK 0x01C0 /* LRI3LOVOL - [8:6] */ | ||
920 | #define WM8400_LRI3LOVOL_SHIFT 6 /* LRI3LOVOL - [8:6] */ | ||
921 | #define WM8400_LRI3LOVOL_WIDTH 3 /* LRI3LOVOL - [8:6] */ | ||
922 | #define WM8400_LRBLOVOL_MASK 0x0038 /* LRBLOVOL - [5:3] */ | ||
923 | #define WM8400_LRBLOVOL_SHIFT 3 /* LRBLOVOL - [5:3] */ | ||
924 | #define WM8400_LRBLOVOL_WIDTH 3 /* LRBLOVOL - [5:3] */ | ||
925 | #define WM8400_LLBLOVOL_MASK 0x0007 /* LLBLOVOL - [2:0] */ | ||
926 | #define WM8400_LLBLOVOL_SHIFT 0 /* LLBLOVOL - [2:0] */ | ||
927 | #define WM8400_LLBLOVOL_WIDTH 3 /* LLBLOVOL - [2:0] */ | ||
928 | |||
929 | /* | ||
930 | * R50 (0x32) - Output Mixer6 | ||
931 | */ | ||
932 | #define WM8400_RLI3ROVOL_MASK 0x01C0 /* RLI3ROVOL - [8:6] */ | ||
933 | #define WM8400_RLI3ROVOL_SHIFT 6 /* RLI3ROVOL - [8:6] */ | ||
934 | #define WM8400_RLI3ROVOL_WIDTH 3 /* RLI3ROVOL - [8:6] */ | ||
935 | #define WM8400_RLBROVOL_MASK 0x0038 /* RLBROVOL - [5:3] */ | ||
936 | #define WM8400_RLBROVOL_SHIFT 3 /* RLBROVOL - [5:3] */ | ||
937 | #define WM8400_RLBROVOL_WIDTH 3 /* RLBROVOL - [5:3] */ | ||
938 | #define WM8400_RRBROVOL_MASK 0x0007 /* RRBROVOL - [2:0] */ | ||
939 | #define WM8400_RRBROVOL_SHIFT 0 /* RRBROVOL - [2:0] */ | ||
940 | #define WM8400_RRBROVOL_WIDTH 3 /* RRBROVOL - [2:0] */ | ||
941 | |||
942 | /* | ||
943 | * R51 (0x33) - Out3/4 Mixer | ||
944 | */ | ||
945 | #define WM8400_VSEL_MASK 0x0180 /* VSEL - [8:7] */ | ||
946 | #define WM8400_VSEL_SHIFT 7 /* VSEL - [8:7] */ | ||
947 | #define WM8400_VSEL_WIDTH 2 /* VSEL - [8:7] */ | ||
948 | #define WM8400_LI4O3 0x0020 /* LI4O3 */ | ||
949 | #define WM8400_LI4O3_MASK 0x0020 /* LI4O3 */ | ||
950 | #define WM8400_LI4O3_SHIFT 5 /* LI4O3 */ | ||
951 | #define WM8400_LI4O3_WIDTH 1 /* LI4O3 */ | ||
952 | #define WM8400_LPGAO3 0x0010 /* LPGAO3 */ | ||
953 | #define WM8400_LPGAO3_MASK 0x0010 /* LPGAO3 */ | ||
954 | #define WM8400_LPGAO3_SHIFT 4 /* LPGAO3 */ | ||
955 | #define WM8400_LPGAO3_WIDTH 1 /* LPGAO3 */ | ||
956 | #define WM8400_RI4O4 0x0002 /* RI4O4 */ | ||
957 | #define WM8400_RI4O4_MASK 0x0002 /* RI4O4 */ | ||
958 | #define WM8400_RI4O4_SHIFT 1 /* RI4O4 */ | ||
959 | #define WM8400_RI4O4_WIDTH 1 /* RI4O4 */ | ||
960 | #define WM8400_RPGAO4 0x0001 /* RPGAO4 */ | ||
961 | #define WM8400_RPGAO4_MASK 0x0001 /* RPGAO4 */ | ||
962 | #define WM8400_RPGAO4_SHIFT 0 /* RPGAO4 */ | ||
963 | #define WM8400_RPGAO4_WIDTH 1 /* RPGAO4 */ | ||
964 | |||
965 | /* | ||
966 | * R52 (0x34) - Line Mixer1 | ||
967 | */ | ||
968 | #define WM8400_LLOPGALON 0x0040 /* LLOPGALON */ | ||
969 | #define WM8400_LLOPGALON_MASK 0x0040 /* LLOPGALON */ | ||
970 | #define WM8400_LLOPGALON_SHIFT 6 /* LLOPGALON */ | ||
971 | #define WM8400_LLOPGALON_WIDTH 1 /* LLOPGALON */ | ||
972 | #define WM8400_LROPGALON 0x0020 /* LROPGALON */ | ||
973 | #define WM8400_LROPGALON_MASK 0x0020 /* LROPGALON */ | ||
974 | #define WM8400_LROPGALON_SHIFT 5 /* LROPGALON */ | ||
975 | #define WM8400_LROPGALON_WIDTH 1 /* LROPGALON */ | ||
976 | #define WM8400_LOPLON 0x0010 /* LOPLON */ | ||
977 | #define WM8400_LOPLON_MASK 0x0010 /* LOPLON */ | ||
978 | #define WM8400_LOPLON_SHIFT 4 /* LOPLON */ | ||
979 | #define WM8400_LOPLON_WIDTH 1 /* LOPLON */ | ||
980 | #define WM8400_LR12LOP 0x0004 /* LR12LOP */ | ||
981 | #define WM8400_LR12LOP_MASK 0x0004 /* LR12LOP */ | ||
982 | #define WM8400_LR12LOP_SHIFT 2 /* LR12LOP */ | ||
983 | #define WM8400_LR12LOP_WIDTH 1 /* LR12LOP */ | ||
984 | #define WM8400_LL12LOP 0x0002 /* LL12LOP */ | ||
985 | #define WM8400_LL12LOP_MASK 0x0002 /* LL12LOP */ | ||
986 | #define WM8400_LL12LOP_SHIFT 1 /* LL12LOP */ | ||
987 | #define WM8400_LL12LOP_WIDTH 1 /* LL12LOP */ | ||
988 | #define WM8400_LLOPGALOP 0x0001 /* LLOPGALOP */ | ||
989 | #define WM8400_LLOPGALOP_MASK 0x0001 /* LLOPGALOP */ | ||
990 | #define WM8400_LLOPGALOP_SHIFT 0 /* LLOPGALOP */ | ||
991 | #define WM8400_LLOPGALOP_WIDTH 1 /* LLOPGALOP */ | ||
992 | |||
993 | /* | ||
994 | * R53 (0x35) - Line Mixer2 | ||
995 | */ | ||
996 | #define WM8400_RROPGARON 0x0040 /* RROPGARON */ | ||
997 | #define WM8400_RROPGARON_MASK 0x0040 /* RROPGARON */ | ||
998 | #define WM8400_RROPGARON_SHIFT 6 /* RROPGARON */ | ||
999 | #define WM8400_RROPGARON_WIDTH 1 /* RROPGARON */ | ||
1000 | #define WM8400_RLOPGARON 0x0020 /* RLOPGARON */ | ||
1001 | #define WM8400_RLOPGARON_MASK 0x0020 /* RLOPGARON */ | ||
1002 | #define WM8400_RLOPGARON_SHIFT 5 /* RLOPGARON */ | ||
1003 | #define WM8400_RLOPGARON_WIDTH 1 /* RLOPGARON */ | ||
1004 | #define WM8400_ROPRON 0x0010 /* ROPRON */ | ||
1005 | #define WM8400_ROPRON_MASK 0x0010 /* ROPRON */ | ||
1006 | #define WM8400_ROPRON_SHIFT 4 /* ROPRON */ | ||
1007 | #define WM8400_ROPRON_WIDTH 1 /* ROPRON */ | ||
1008 | #define WM8400_RL12ROP 0x0004 /* RL12ROP */ | ||
1009 | #define WM8400_RL12ROP_MASK 0x0004 /* RL12ROP */ | ||
1010 | #define WM8400_RL12ROP_SHIFT 2 /* RL12ROP */ | ||
1011 | #define WM8400_RL12ROP_WIDTH 1 /* RL12ROP */ | ||
1012 | #define WM8400_RR12ROP 0x0002 /* RR12ROP */ | ||
1013 | #define WM8400_RR12ROP_MASK 0x0002 /* RR12ROP */ | ||
1014 | #define WM8400_RR12ROP_SHIFT 1 /* RR12ROP */ | ||
1015 | #define WM8400_RR12ROP_WIDTH 1 /* RR12ROP */ | ||
1016 | #define WM8400_RROPGAROP 0x0001 /* RROPGAROP */ | ||
1017 | #define WM8400_RROPGAROP_MASK 0x0001 /* RROPGAROP */ | ||
1018 | #define WM8400_RROPGAROP_SHIFT 0 /* RROPGAROP */ | ||
1019 | #define WM8400_RROPGAROP_WIDTH 1 /* RROPGAROP */ | ||
1020 | |||
1021 | /* | ||
1022 | * R54 (0x36) - Speaker Mixer | ||
1023 | */ | ||
1024 | #define WM8400_LB2SPK 0x0080 /* LB2SPK */ | ||
1025 | #define WM8400_LB2SPK_MASK 0x0080 /* LB2SPK */ | ||
1026 | #define WM8400_LB2SPK_SHIFT 7 /* LB2SPK */ | ||
1027 | #define WM8400_LB2SPK_WIDTH 1 /* LB2SPK */ | ||
1028 | #define WM8400_RB2SPK 0x0040 /* RB2SPK */ | ||
1029 | #define WM8400_RB2SPK_MASK 0x0040 /* RB2SPK */ | ||
1030 | #define WM8400_RB2SPK_SHIFT 6 /* RB2SPK */ | ||
1031 | #define WM8400_RB2SPK_WIDTH 1 /* RB2SPK */ | ||
1032 | #define WM8400_LI2SPK 0x0020 /* LI2SPK */ | ||
1033 | #define WM8400_LI2SPK_MASK 0x0020 /* LI2SPK */ | ||
1034 | #define WM8400_LI2SPK_SHIFT 5 /* LI2SPK */ | ||
1035 | #define WM8400_LI2SPK_WIDTH 1 /* LI2SPK */ | ||
1036 | #define WM8400_RI2SPK 0x0010 /* RI2SPK */ | ||
1037 | #define WM8400_RI2SPK_MASK 0x0010 /* RI2SPK */ | ||
1038 | #define WM8400_RI2SPK_SHIFT 4 /* RI2SPK */ | ||
1039 | #define WM8400_RI2SPK_WIDTH 1 /* RI2SPK */ | ||
1040 | #define WM8400_LOPGASPK 0x0008 /* LOPGASPK */ | ||
1041 | #define WM8400_LOPGASPK_MASK 0x0008 /* LOPGASPK */ | ||
1042 | #define WM8400_LOPGASPK_SHIFT 3 /* LOPGASPK */ | ||
1043 | #define WM8400_LOPGASPK_WIDTH 1 /* LOPGASPK */ | ||
1044 | #define WM8400_ROPGASPK 0x0004 /* ROPGASPK */ | ||
1045 | #define WM8400_ROPGASPK_MASK 0x0004 /* ROPGASPK */ | ||
1046 | #define WM8400_ROPGASPK_SHIFT 2 /* ROPGASPK */ | ||
1047 | #define WM8400_ROPGASPK_WIDTH 1 /* ROPGASPK */ | ||
1048 | #define WM8400_LDSPK 0x0002 /* LDSPK */ | ||
1049 | #define WM8400_LDSPK_MASK 0x0002 /* LDSPK */ | ||
1050 | #define WM8400_LDSPK_SHIFT 1 /* LDSPK */ | ||
1051 | #define WM8400_LDSPK_WIDTH 1 /* LDSPK */ | ||
1052 | #define WM8400_RDSPK 0x0001 /* RDSPK */ | ||
1053 | #define WM8400_RDSPK_MASK 0x0001 /* RDSPK */ | ||
1054 | #define WM8400_RDSPK_SHIFT 0 /* RDSPK */ | ||
1055 | #define WM8400_RDSPK_WIDTH 1 /* RDSPK */ | ||
1056 | |||
1057 | /* | ||
1058 | * R55 (0x37) - Additional Control | ||
1059 | */ | ||
1060 | #define WM8400_VROI 0x0001 /* VROI */ | ||
1061 | #define WM8400_VROI_MASK 0x0001 /* VROI */ | ||
1062 | #define WM8400_VROI_SHIFT 0 /* VROI */ | ||
1063 | #define WM8400_VROI_WIDTH 1 /* VROI */ | ||
1064 | |||
1065 | /* | ||
1066 | * R56 (0x38) - AntiPOP1 | ||
1067 | */ | ||
1068 | #define WM8400_DIS_LLINE 0x0020 /* DIS_LLINE */ | ||
1069 | #define WM8400_DIS_LLINE_MASK 0x0020 /* DIS_LLINE */ | ||
1070 | #define WM8400_DIS_LLINE_SHIFT 5 /* DIS_LLINE */ | ||
1071 | #define WM8400_DIS_LLINE_WIDTH 1 /* DIS_LLINE */ | ||
1072 | #define WM8400_DIS_RLINE 0x0010 /* DIS_RLINE */ | ||
1073 | #define WM8400_DIS_RLINE_MASK 0x0010 /* DIS_RLINE */ | ||
1074 | #define WM8400_DIS_RLINE_SHIFT 4 /* DIS_RLINE */ | ||
1075 | #define WM8400_DIS_RLINE_WIDTH 1 /* DIS_RLINE */ | ||
1076 | #define WM8400_DIS_OUT3 0x0008 /* DIS_OUT3 */ | ||
1077 | #define WM8400_DIS_OUT3_MASK 0x0008 /* DIS_OUT3 */ | ||
1078 | #define WM8400_DIS_OUT3_SHIFT 3 /* DIS_OUT3 */ | ||
1079 | #define WM8400_DIS_OUT3_WIDTH 1 /* DIS_OUT3 */ | ||
1080 | #define WM8400_DIS_OUT4 0x0004 /* DIS_OUT4 */ | ||
1081 | #define WM8400_DIS_OUT4_MASK 0x0004 /* DIS_OUT4 */ | ||
1082 | #define WM8400_DIS_OUT4_SHIFT 2 /* DIS_OUT4 */ | ||
1083 | #define WM8400_DIS_OUT4_WIDTH 1 /* DIS_OUT4 */ | ||
1084 | #define WM8400_DIS_LOUT 0x0002 /* DIS_LOUT */ | ||
1085 | #define WM8400_DIS_LOUT_MASK 0x0002 /* DIS_LOUT */ | ||
1086 | #define WM8400_DIS_LOUT_SHIFT 1 /* DIS_LOUT */ | ||
1087 | #define WM8400_DIS_LOUT_WIDTH 1 /* DIS_LOUT */ | ||
1088 | #define WM8400_DIS_ROUT 0x0001 /* DIS_ROUT */ | ||
1089 | #define WM8400_DIS_ROUT_MASK 0x0001 /* DIS_ROUT */ | ||
1090 | #define WM8400_DIS_ROUT_SHIFT 0 /* DIS_ROUT */ | ||
1091 | #define WM8400_DIS_ROUT_WIDTH 1 /* DIS_ROUT */ | ||
1092 | |||
1093 | /* | ||
1094 | * R57 (0x39) - AntiPOP2 | ||
1095 | */ | ||
1096 | #define WM8400_SOFTST 0x0040 /* SOFTST */ | ||
1097 | #define WM8400_SOFTST_MASK 0x0040 /* SOFTST */ | ||
1098 | #define WM8400_SOFTST_SHIFT 6 /* SOFTST */ | ||
1099 | #define WM8400_SOFTST_WIDTH 1 /* SOFTST */ | ||
1100 | #define WM8400_BUFIOEN 0x0008 /* BUFIOEN */ | ||
1101 | #define WM8400_BUFIOEN_MASK 0x0008 /* BUFIOEN */ | ||
1102 | #define WM8400_BUFIOEN_SHIFT 3 /* BUFIOEN */ | ||
1103 | #define WM8400_BUFIOEN_WIDTH 1 /* BUFIOEN */ | ||
1104 | #define WM8400_BUFDCOPEN 0x0004 /* BUFDCOPEN */ | ||
1105 | #define WM8400_BUFDCOPEN_MASK 0x0004 /* BUFDCOPEN */ | ||
1106 | #define WM8400_BUFDCOPEN_SHIFT 2 /* BUFDCOPEN */ | ||
1107 | #define WM8400_BUFDCOPEN_WIDTH 1 /* BUFDCOPEN */ | ||
1108 | #define WM8400_POBCTRL 0x0002 /* POBCTRL */ | ||
1109 | #define WM8400_POBCTRL_MASK 0x0002 /* POBCTRL */ | ||
1110 | #define WM8400_POBCTRL_SHIFT 1 /* POBCTRL */ | ||
1111 | #define WM8400_POBCTRL_WIDTH 1 /* POBCTRL */ | ||
1112 | #define WM8400_VMIDTOG 0x0001 /* VMIDTOG */ | ||
1113 | #define WM8400_VMIDTOG_MASK 0x0001 /* VMIDTOG */ | ||
1114 | #define WM8400_VMIDTOG_SHIFT 0 /* VMIDTOG */ | ||
1115 | #define WM8400_VMIDTOG_WIDTH 1 /* VMIDTOG */ | ||
1116 | |||
1117 | /* | ||
1118 | * R58 (0x3A) - MICBIAS | ||
1119 | */ | ||
1120 | #define WM8400_MCDSCTH_MASK 0x00C0 /* MCDSCTH - [7:6] */ | ||
1121 | #define WM8400_MCDSCTH_SHIFT 6 /* MCDSCTH - [7:6] */ | ||
1122 | #define WM8400_MCDSCTH_WIDTH 2 /* MCDSCTH - [7:6] */ | ||
1123 | #define WM8400_MCDTHR_MASK 0x0038 /* MCDTHR - [5:3] */ | ||
1124 | #define WM8400_MCDTHR_SHIFT 3 /* MCDTHR - [5:3] */ | ||
1125 | #define WM8400_MCDTHR_WIDTH 3 /* MCDTHR - [5:3] */ | ||
1126 | #define WM8400_MCD 0x0004 /* MCD */ | ||
1127 | #define WM8400_MCD_MASK 0x0004 /* MCD */ | ||
1128 | #define WM8400_MCD_SHIFT 2 /* MCD */ | ||
1129 | #define WM8400_MCD_WIDTH 1 /* MCD */ | ||
1130 | #define WM8400_MBSEL 0x0001 /* MBSEL */ | ||
1131 | #define WM8400_MBSEL_MASK 0x0001 /* MBSEL */ | ||
1132 | #define WM8400_MBSEL_SHIFT 0 /* MBSEL */ | ||
1133 | #define WM8400_MBSEL_WIDTH 1 /* MBSEL */ | ||
1134 | |||
1135 | /* | ||
1136 | * R60 (0x3C) - FLL Control 1 | ||
1137 | */ | ||
1138 | #define WM8400_FLL_REF_FREQ 0x1000 /* FLL_REF_FREQ */ | ||
1139 | #define WM8400_FLL_REF_FREQ_MASK 0x1000 /* FLL_REF_FREQ */ | ||
1140 | #define WM8400_FLL_REF_FREQ_SHIFT 12 /* FLL_REF_FREQ */ | ||
1141 | #define WM8400_FLL_REF_FREQ_WIDTH 1 /* FLL_REF_FREQ */ | ||
1142 | #define WM8400_FLL_CLK_SRC_MASK 0x0C00 /* FLL_CLK_SRC - [11:10] */ | ||
1143 | #define WM8400_FLL_CLK_SRC_SHIFT 10 /* FLL_CLK_SRC - [11:10] */ | ||
1144 | #define WM8400_FLL_CLK_SRC_WIDTH 2 /* FLL_CLK_SRC - [11:10] */ | ||
1145 | #define WM8400_FLL_FRAC 0x0200 /* FLL_FRAC */ | ||
1146 | #define WM8400_FLL_FRAC_MASK 0x0200 /* FLL_FRAC */ | ||
1147 | #define WM8400_FLL_FRAC_SHIFT 9 /* FLL_FRAC */ | ||
1148 | #define WM8400_FLL_FRAC_WIDTH 1 /* FLL_FRAC */ | ||
1149 | #define WM8400_FLL_OSC_ENA 0x0100 /* FLL_OSC_ENA */ | ||
1150 | #define WM8400_FLL_OSC_ENA_MASK 0x0100 /* FLL_OSC_ENA */ | ||
1151 | #define WM8400_FLL_OSC_ENA_SHIFT 8 /* FLL_OSC_ENA */ | ||
1152 | #define WM8400_FLL_OSC_ENA_WIDTH 1 /* FLL_OSC_ENA */ | ||
1153 | #define WM8400_FLL_CTRL_RATE_MASK 0x00E0 /* FLL_CTRL_RATE - [7:5] */ | ||
1154 | #define WM8400_FLL_CTRL_RATE_SHIFT 5 /* FLL_CTRL_RATE - [7:5] */ | ||
1155 | #define WM8400_FLL_CTRL_RATE_WIDTH 3 /* FLL_CTRL_RATE - [7:5] */ | ||
1156 | #define WM8400_FLL_FRATIO_MASK 0x001F /* FLL_FRATIO - [4:0] */ | ||
1157 | #define WM8400_FLL_FRATIO_SHIFT 0 /* FLL_FRATIO - [4:0] */ | ||
1158 | #define WM8400_FLL_FRATIO_WIDTH 5 /* FLL_FRATIO - [4:0] */ | ||
1159 | |||
1160 | /* | ||
1161 | * R61 (0x3D) - FLL Control 2 | ||
1162 | */ | ||
1163 | #define WM8400_FLL_K_MASK 0xFFFF /* FLL_K - [15:0] */ | ||
1164 | #define WM8400_FLL_K_SHIFT 0 /* FLL_K - [15:0] */ | ||
1165 | #define WM8400_FLL_K_WIDTH 16 /* FLL_K - [15:0] */ | ||
1166 | |||
1167 | /* | ||
1168 | * R62 (0x3E) - FLL Control 3 | ||
1169 | */ | ||
1170 | #define WM8400_FLL_N_MASK 0x03FF /* FLL_N - [9:0] */ | ||
1171 | #define WM8400_FLL_N_SHIFT 0 /* FLL_N - [9:0] */ | ||
1172 | #define WM8400_FLL_N_WIDTH 10 /* FLL_N - [9:0] */ | ||
1173 | |||
1174 | /* | ||
1175 | * R63 (0x3F) - FLL Control 4 | ||
1176 | */ | ||
1177 | #define WM8400_FLL_TRK_GAIN_MASK 0x0078 /* FLL_TRK_GAIN - [6:3] */ | ||
1178 | #define WM8400_FLL_TRK_GAIN_SHIFT 3 /* FLL_TRK_GAIN - [6:3] */ | ||
1179 | #define WM8400_FLL_TRK_GAIN_WIDTH 4 /* FLL_TRK_GAIN - [6:3] */ | ||
1180 | #define WM8400_FLL_OUTDIV_MASK 0x0007 /* FLL_OUTDIV - [2:0] */ | ||
1181 | #define WM8400_FLL_OUTDIV_SHIFT 0 /* FLL_OUTDIV - [2:0] */ | ||
1182 | #define WM8400_FLL_OUTDIV_WIDTH 3 /* FLL_OUTDIV - [2:0] */ | ||
1183 | |||
1184 | void wm8400_reset_codec_reg_cache(struct wm8400 *wm8400); | ||
1185 | |||
1186 | #endif | ||
diff --git a/include/linux/mfd/wm8400-private.h b/include/linux/mfd/wm8400-private.h new file mode 100644 index 000000000000..2aab4e93a5c9 --- /dev/null +++ b/include/linux/mfd/wm8400-private.h | |||
@@ -0,0 +1,936 @@ | |||
1 | /* | ||
2 | * wm8400 private definitions. | ||
3 | * | ||
4 | * Copyright 2008 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 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_MFD_WM8400_PRIV_H | ||
22 | #define __LINUX_MFD_WM8400_PRIV_H | ||
23 | |||
24 | #include <linux/mfd/wm8400.h> | ||
25 | #include <linux/mutex.h> | ||
26 | #include <linux/platform_device.h> | ||
27 | |||
28 | #define WM8400_REGISTER_COUNT 0x55 | ||
29 | |||
30 | struct wm8400 { | ||
31 | struct device *dev; | ||
32 | |||
33 | int (*read_dev)(void *data, char reg, int count, u16 *dst); | ||
34 | int (*write_dev)(void *data, char reg, int count, const u16 *src); | ||
35 | |||
36 | struct mutex io_lock; | ||
37 | void *io_data; | ||
38 | |||
39 | u16 reg_cache[WM8400_REGISTER_COUNT]; | ||
40 | |||
41 | struct platform_device regulators[6]; | ||
42 | }; | ||
43 | |||
44 | /* | ||
45 | * Register values. | ||
46 | */ | ||
47 | #define WM8400_RESET_ID 0x00 | ||
48 | #define WM8400_ID 0x01 | ||
49 | #define WM8400_POWER_MANAGEMENT_1 0x02 | ||
50 | #define WM8400_POWER_MANAGEMENT_2 0x03 | ||
51 | #define WM8400_POWER_MANAGEMENT_3 0x04 | ||
52 | #define WM8400_AUDIO_INTERFACE_1 0x05 | ||
53 | #define WM8400_AUDIO_INTERFACE_2 0x06 | ||
54 | #define WM8400_CLOCKING_1 0x07 | ||
55 | #define WM8400_CLOCKING_2 0x08 | ||
56 | #define WM8400_AUDIO_INTERFACE_3 0x09 | ||
57 | #define WM8400_AUDIO_INTERFACE_4 0x0A | ||
58 | #define WM8400_DAC_CTRL 0x0B | ||
59 | #define WM8400_LEFT_DAC_DIGITAL_VOLUME 0x0C | ||
60 | #define WM8400_RIGHT_DAC_DIGITAL_VOLUME 0x0D | ||
61 | #define WM8400_DIGITAL_SIDE_TONE 0x0E | ||
62 | #define WM8400_ADC_CTRL 0x0F | ||
63 | #define WM8400_LEFT_ADC_DIGITAL_VOLUME 0x10 | ||
64 | #define WM8400_RIGHT_ADC_DIGITAL_VOLUME 0x11 | ||
65 | #define WM8400_GPIO_CTRL_1 0x12 | ||
66 | #define WM8400_GPIO1_GPIO2 0x13 | ||
67 | #define WM8400_GPIO3_GPIO4 0x14 | ||
68 | #define WM8400_GPIO5_GPIO6 0x15 | ||
69 | #define WM8400_GPIOCTRL_2 0x16 | ||
70 | #define WM8400_GPIO_POL 0x17 | ||
71 | #define WM8400_LEFT_LINE_INPUT_1_2_VOLUME 0x18 | ||
72 | #define WM8400_LEFT_LINE_INPUT_3_4_VOLUME 0x19 | ||
73 | #define WM8400_RIGHT_LINE_INPUT_1_2_VOLUME 0x1A | ||
74 | #define WM8400_RIGHT_LINE_INPUT_3_4_VOLUME 0x1B | ||
75 | #define WM8400_LEFT_OUTPUT_VOLUME 0x1C | ||
76 | #define WM8400_RIGHT_OUTPUT_VOLUME 0x1D | ||
77 | #define WM8400_LINE_OUTPUTS_VOLUME 0x1E | ||
78 | #define WM8400_OUT3_4_VOLUME 0x1F | ||
79 | #define WM8400_LEFT_OPGA_VOLUME 0x20 | ||
80 | #define WM8400_RIGHT_OPGA_VOLUME 0x21 | ||
81 | #define WM8400_SPEAKER_VOLUME 0x22 | ||
82 | #define WM8400_CLASSD1 0x23 | ||
83 | #define WM8400_CLASSD3 0x25 | ||
84 | #define WM8400_INPUT_MIXER1 0x27 | ||
85 | #define WM8400_INPUT_MIXER2 0x28 | ||
86 | #define WM8400_INPUT_MIXER3 0x29 | ||
87 | #define WM8400_INPUT_MIXER4 0x2A | ||
88 | #define WM8400_INPUT_MIXER5 0x2B | ||
89 | #define WM8400_INPUT_MIXER6 0x2C | ||
90 | #define WM8400_OUTPUT_MIXER1 0x2D | ||
91 | #define WM8400_OUTPUT_MIXER2 0x2E | ||
92 | #define WM8400_OUTPUT_MIXER3 0x2F | ||
93 | #define WM8400_OUTPUT_MIXER4 0x30 | ||
94 | #define WM8400_OUTPUT_MIXER5 0x31 | ||
95 | #define WM8400_OUTPUT_MIXER6 0x32 | ||
96 | #define WM8400_OUT3_4_MIXER 0x33 | ||
97 | #define WM8400_LINE_MIXER1 0x34 | ||
98 | #define WM8400_LINE_MIXER2 0x35 | ||
99 | #define WM8400_SPEAKER_MIXER 0x36 | ||
100 | #define WM8400_ADDITIONAL_CONTROL 0x37 | ||
101 | #define WM8400_ANTIPOP1 0x38 | ||
102 | #define WM8400_ANTIPOP2 0x39 | ||
103 | #define WM8400_MICBIAS 0x3A | ||
104 | #define WM8400_FLL_CONTROL_1 0x3C | ||
105 | #define WM8400_FLL_CONTROL_2 0x3D | ||
106 | #define WM8400_FLL_CONTROL_3 0x3E | ||
107 | #define WM8400_FLL_CONTROL_4 0x3F | ||
108 | #define WM8400_LDO1_CONTROL 0x41 | ||
109 | #define WM8400_LDO2_CONTROL 0x42 | ||
110 | #define WM8400_LDO3_CONTROL 0x43 | ||
111 | #define WM8400_LDO4_CONTROL 0x44 | ||
112 | #define WM8400_DCDC1_CONTROL_1 0x46 | ||
113 | #define WM8400_DCDC1_CONTROL_2 0x47 | ||
114 | #define WM8400_DCDC2_CONTROL_1 0x48 | ||
115 | #define WM8400_DCDC2_CONTROL_2 0x49 | ||
116 | #define WM8400_INTERFACE 0x4B | ||
117 | #define WM8400_PM_GENERAL 0x4C | ||
118 | #define WM8400_PM_SHUTDOWN_CONTROL 0x4E | ||
119 | #define WM8400_INTERRUPT_STATUS_1 0x4F | ||
120 | #define WM8400_INTERRUPT_STATUS_1_MASK 0x50 | ||
121 | #define WM8400_INTERRUPT_LEVELS 0x51 | ||
122 | #define WM8400_SHUTDOWN_REASON 0x52 | ||
123 | #define WM8400_LINE_CIRCUITS 0x54 | ||
124 | |||
125 | /* | ||
126 | * Field Definitions. | ||
127 | */ | ||
128 | |||
129 | /* | ||
130 | * R0 (0x00) - Reset/ID | ||
131 | */ | ||
132 | #define WM8400_SW_RESET_CHIP_ID_MASK 0xFFFF /* SW_RESET/CHIP_ID - [15:0] */ | ||
133 | #define WM8400_SW_RESET_CHIP_ID_SHIFT 0 /* SW_RESET/CHIP_ID - [15:0] */ | ||
134 | #define WM8400_SW_RESET_CHIP_ID_WIDTH 16 /* SW_RESET/CHIP_ID - [15:0] */ | ||
135 | |||
136 | /* | ||
137 | * R1 (0x01) - ID | ||
138 | */ | ||
139 | #define WM8400_CHIP_REV_MASK 0x7000 /* CHIP_REV - [14:12] */ | ||
140 | #define WM8400_CHIP_REV_SHIFT 12 /* CHIP_REV - [14:12] */ | ||
141 | #define WM8400_CHIP_REV_WIDTH 3 /* CHIP_REV - [14:12] */ | ||
142 | |||
143 | /* | ||
144 | * R18 (0x12) - GPIO CTRL 1 | ||
145 | */ | ||
146 | #define WM8400_IRQ 0x1000 /* IRQ */ | ||
147 | #define WM8400_IRQ_MASK 0x1000 /* IRQ */ | ||
148 | #define WM8400_IRQ_SHIFT 12 /* IRQ */ | ||
149 | #define WM8400_IRQ_WIDTH 1 /* IRQ */ | ||
150 | #define WM8400_TEMPOK 0x0800 /* TEMPOK */ | ||
151 | #define WM8400_TEMPOK_MASK 0x0800 /* TEMPOK */ | ||
152 | #define WM8400_TEMPOK_SHIFT 11 /* TEMPOK */ | ||
153 | #define WM8400_TEMPOK_WIDTH 1 /* TEMPOK */ | ||
154 | #define WM8400_MIC1SHRT 0x0400 /* MIC1SHRT */ | ||
155 | #define WM8400_MIC1SHRT_MASK 0x0400 /* MIC1SHRT */ | ||
156 | #define WM8400_MIC1SHRT_SHIFT 10 /* MIC1SHRT */ | ||
157 | #define WM8400_MIC1SHRT_WIDTH 1 /* MIC1SHRT */ | ||
158 | #define WM8400_MIC1DET 0x0200 /* MIC1DET */ | ||
159 | #define WM8400_MIC1DET_MASK 0x0200 /* MIC1DET */ | ||
160 | #define WM8400_MIC1DET_SHIFT 9 /* MIC1DET */ | ||
161 | #define WM8400_MIC1DET_WIDTH 1 /* MIC1DET */ | ||
162 | #define WM8400_FLL_LCK 0x0100 /* FLL_LCK */ | ||
163 | #define WM8400_FLL_LCK_MASK 0x0100 /* FLL_LCK */ | ||
164 | #define WM8400_FLL_LCK_SHIFT 8 /* FLL_LCK */ | ||
165 | #define WM8400_FLL_LCK_WIDTH 1 /* FLL_LCK */ | ||
166 | #define WM8400_GPIO_STATUS_MASK 0x00FF /* GPIO_STATUS - [7:0] */ | ||
167 | #define WM8400_GPIO_STATUS_SHIFT 0 /* GPIO_STATUS - [7:0] */ | ||
168 | #define WM8400_GPIO_STATUS_WIDTH 8 /* GPIO_STATUS - [7:0] */ | ||
169 | |||
170 | /* | ||
171 | * R19 (0x13) - GPIO1 & GPIO2 | ||
172 | */ | ||
173 | #define WM8400_GPIO2_DEB_ENA 0x8000 /* GPIO2_DEB_ENA */ | ||
174 | #define WM8400_GPIO2_DEB_ENA_MASK 0x8000 /* GPIO2_DEB_ENA */ | ||
175 | #define WM8400_GPIO2_DEB_ENA_SHIFT 15 /* GPIO2_DEB_ENA */ | ||
176 | #define WM8400_GPIO2_DEB_ENA_WIDTH 1 /* GPIO2_DEB_ENA */ | ||
177 | #define WM8400_GPIO2_IRQ_ENA 0x4000 /* GPIO2_IRQ_ENA */ | ||
178 | #define WM8400_GPIO2_IRQ_ENA_MASK 0x4000 /* GPIO2_IRQ_ENA */ | ||
179 | #define WM8400_GPIO2_IRQ_ENA_SHIFT 14 /* GPIO2_IRQ_ENA */ | ||
180 | #define WM8400_GPIO2_IRQ_ENA_WIDTH 1 /* GPIO2_IRQ_ENA */ | ||
181 | #define WM8400_GPIO2_PU 0x2000 /* GPIO2_PU */ | ||
182 | #define WM8400_GPIO2_PU_MASK 0x2000 /* GPIO2_PU */ | ||
183 | #define WM8400_GPIO2_PU_SHIFT 13 /* GPIO2_PU */ | ||
184 | #define WM8400_GPIO2_PU_WIDTH 1 /* GPIO2_PU */ | ||
185 | #define WM8400_GPIO2_PD 0x1000 /* GPIO2_PD */ | ||
186 | #define WM8400_GPIO2_PD_MASK 0x1000 /* GPIO2_PD */ | ||
187 | #define WM8400_GPIO2_PD_SHIFT 12 /* GPIO2_PD */ | ||
188 | #define WM8400_GPIO2_PD_WIDTH 1 /* GPIO2_PD */ | ||
189 | #define WM8400_GPIO2_SEL_MASK 0x0F00 /* GPIO2_SEL - [11:8] */ | ||
190 | #define WM8400_GPIO2_SEL_SHIFT 8 /* GPIO2_SEL - [11:8] */ | ||
191 | #define WM8400_GPIO2_SEL_WIDTH 4 /* GPIO2_SEL - [11:8] */ | ||
192 | #define WM8400_GPIO1_DEB_ENA 0x0080 /* GPIO1_DEB_ENA */ | ||
193 | #define WM8400_GPIO1_DEB_ENA_MASK 0x0080 /* GPIO1_DEB_ENA */ | ||
194 | #define WM8400_GPIO1_DEB_ENA_SHIFT 7 /* GPIO1_DEB_ENA */ | ||
195 | #define WM8400_GPIO1_DEB_ENA_WIDTH 1 /* GPIO1_DEB_ENA */ | ||
196 | #define WM8400_GPIO1_IRQ_ENA 0x0040 /* GPIO1_IRQ_ENA */ | ||
197 | #define WM8400_GPIO1_IRQ_ENA_MASK 0x0040 /* GPIO1_IRQ_ENA */ | ||
198 | #define WM8400_GPIO1_IRQ_ENA_SHIFT 6 /* GPIO1_IRQ_ENA */ | ||
199 | #define WM8400_GPIO1_IRQ_ENA_WIDTH 1 /* GPIO1_IRQ_ENA */ | ||
200 | #define WM8400_GPIO1_PU 0x0020 /* GPIO1_PU */ | ||
201 | #define WM8400_GPIO1_PU_MASK 0x0020 /* GPIO1_PU */ | ||
202 | #define WM8400_GPIO1_PU_SHIFT 5 /* GPIO1_PU */ | ||
203 | #define WM8400_GPIO1_PU_WIDTH 1 /* GPIO1_PU */ | ||
204 | #define WM8400_GPIO1_PD 0x0010 /* GPIO1_PD */ | ||
205 | #define WM8400_GPIO1_PD_MASK 0x0010 /* GPIO1_PD */ | ||
206 | #define WM8400_GPIO1_PD_SHIFT 4 /* GPIO1_PD */ | ||
207 | #define WM8400_GPIO1_PD_WIDTH 1 /* GPIO1_PD */ | ||
208 | #define WM8400_GPIO1_SEL_MASK 0x000F /* GPIO1_SEL - [3:0] */ | ||
209 | #define WM8400_GPIO1_SEL_SHIFT 0 /* GPIO1_SEL - [3:0] */ | ||
210 | #define WM8400_GPIO1_SEL_WIDTH 4 /* GPIO1_SEL - [3:0] */ | ||
211 | |||
212 | /* | ||
213 | * R20 (0x14) - GPIO3 & GPIO4 | ||
214 | */ | ||
215 | #define WM8400_GPIO4_DEB_ENA 0x8000 /* GPIO4_DEB_ENA */ | ||
216 | #define WM8400_GPIO4_DEB_ENA_MASK 0x8000 /* GPIO4_DEB_ENA */ | ||
217 | #define WM8400_GPIO4_DEB_ENA_SHIFT 15 /* GPIO4_DEB_ENA */ | ||
218 | #define WM8400_GPIO4_DEB_ENA_WIDTH 1 /* GPIO4_DEB_ENA */ | ||
219 | #define WM8400_GPIO4_IRQ_ENA 0x4000 /* GPIO4_IRQ_ENA */ | ||
220 | #define WM8400_GPIO4_IRQ_ENA_MASK 0x4000 /* GPIO4_IRQ_ENA */ | ||
221 | #define WM8400_GPIO4_IRQ_ENA_SHIFT 14 /* GPIO4_IRQ_ENA */ | ||
222 | #define WM8400_GPIO4_IRQ_ENA_WIDTH 1 /* GPIO4_IRQ_ENA */ | ||
223 | #define WM8400_GPIO4_PU 0x2000 /* GPIO4_PU */ | ||
224 | #define WM8400_GPIO4_PU_MASK 0x2000 /* GPIO4_PU */ | ||
225 | #define WM8400_GPIO4_PU_SHIFT 13 /* GPIO4_PU */ | ||
226 | #define WM8400_GPIO4_PU_WIDTH 1 /* GPIO4_PU */ | ||
227 | #define WM8400_GPIO4_PD 0x1000 /* GPIO4_PD */ | ||
228 | #define WM8400_GPIO4_PD_MASK 0x1000 /* GPIO4_PD */ | ||
229 | #define WM8400_GPIO4_PD_SHIFT 12 /* GPIO4_PD */ | ||
230 | #define WM8400_GPIO4_PD_WIDTH 1 /* GPIO4_PD */ | ||
231 | #define WM8400_GPIO4_SEL_MASK 0x0F00 /* GPIO4_SEL - [11:8] */ | ||
232 | #define WM8400_GPIO4_SEL_SHIFT 8 /* GPIO4_SEL - [11:8] */ | ||
233 | #define WM8400_GPIO4_SEL_WIDTH 4 /* GPIO4_SEL - [11:8] */ | ||
234 | #define WM8400_GPIO3_DEB_ENA 0x0080 /* GPIO3_DEB_ENA */ | ||
235 | #define WM8400_GPIO3_DEB_ENA_MASK 0x0080 /* GPIO3_DEB_ENA */ | ||
236 | #define WM8400_GPIO3_DEB_ENA_SHIFT 7 /* GPIO3_DEB_ENA */ | ||
237 | #define WM8400_GPIO3_DEB_ENA_WIDTH 1 /* GPIO3_DEB_ENA */ | ||
238 | #define WM8400_GPIO3_IRQ_ENA 0x0040 /* GPIO3_IRQ_ENA */ | ||
239 | #define WM8400_GPIO3_IRQ_ENA_MASK 0x0040 /* GPIO3_IRQ_ENA */ | ||
240 | #define WM8400_GPIO3_IRQ_ENA_SHIFT 6 /* GPIO3_IRQ_ENA */ | ||
241 | #define WM8400_GPIO3_IRQ_ENA_WIDTH 1 /* GPIO3_IRQ_ENA */ | ||
242 | #define WM8400_GPIO3_PU 0x0020 /* GPIO3_PU */ | ||
243 | #define WM8400_GPIO3_PU_MASK 0x0020 /* GPIO3_PU */ | ||
244 | #define WM8400_GPIO3_PU_SHIFT 5 /* GPIO3_PU */ | ||
245 | #define WM8400_GPIO3_PU_WIDTH 1 /* GPIO3_PU */ | ||
246 | #define WM8400_GPIO3_PD 0x0010 /* GPIO3_PD */ | ||
247 | #define WM8400_GPIO3_PD_MASK 0x0010 /* GPIO3_PD */ | ||
248 | #define WM8400_GPIO3_PD_SHIFT 4 /* GPIO3_PD */ | ||
249 | #define WM8400_GPIO3_PD_WIDTH 1 /* GPIO3_PD */ | ||
250 | #define WM8400_GPIO3_SEL_MASK 0x000F /* GPIO3_SEL - [3:0] */ | ||
251 | #define WM8400_GPIO3_SEL_SHIFT 0 /* GPIO3_SEL - [3:0] */ | ||
252 | #define WM8400_GPIO3_SEL_WIDTH 4 /* GPIO3_SEL - [3:0] */ | ||
253 | |||
254 | /* | ||
255 | * R21 (0x15) - GPIO5 & GPIO6 | ||
256 | */ | ||
257 | #define WM8400_GPIO6_DEB_ENA 0x8000 /* GPIO6_DEB_ENA */ | ||
258 | #define WM8400_GPIO6_DEB_ENA_MASK 0x8000 /* GPIO6_DEB_ENA */ | ||
259 | #define WM8400_GPIO6_DEB_ENA_SHIFT 15 /* GPIO6_DEB_ENA */ | ||
260 | #define WM8400_GPIO6_DEB_ENA_WIDTH 1 /* GPIO6_DEB_ENA */ | ||
261 | #define WM8400_GPIO6_IRQ_ENA 0x4000 /* GPIO6_IRQ_ENA */ | ||
262 | #define WM8400_GPIO6_IRQ_ENA_MASK 0x4000 /* GPIO6_IRQ_ENA */ | ||
263 | #define WM8400_GPIO6_IRQ_ENA_SHIFT 14 /* GPIO6_IRQ_ENA */ | ||
264 | #define WM8400_GPIO6_IRQ_ENA_WIDTH 1 /* GPIO6_IRQ_ENA */ | ||
265 | #define WM8400_GPIO6_PU 0x2000 /* GPIO6_PU */ | ||
266 | #define WM8400_GPIO6_PU_MASK 0x2000 /* GPIO6_PU */ | ||
267 | #define WM8400_GPIO6_PU_SHIFT 13 /* GPIO6_PU */ | ||
268 | #define WM8400_GPIO6_PU_WIDTH 1 /* GPIO6_PU */ | ||
269 | #define WM8400_GPIO6_PD 0x1000 /* GPIO6_PD */ | ||
270 | #define WM8400_GPIO6_PD_MASK 0x1000 /* GPIO6_PD */ | ||
271 | #define WM8400_GPIO6_PD_SHIFT 12 /* GPIO6_PD */ | ||
272 | #define WM8400_GPIO6_PD_WIDTH 1 /* GPIO6_PD */ | ||
273 | #define WM8400_GPIO6_SEL_MASK 0x0F00 /* GPIO6_SEL - [11:8] */ | ||
274 | #define WM8400_GPIO6_SEL_SHIFT 8 /* GPIO6_SEL - [11:8] */ | ||
275 | #define WM8400_GPIO6_SEL_WIDTH 4 /* GPIO6_SEL - [11:8] */ | ||
276 | #define WM8400_GPIO5_DEB_ENA 0x0080 /* GPIO5_DEB_ENA */ | ||
277 | #define WM8400_GPIO5_DEB_ENA_MASK 0x0080 /* GPIO5_DEB_ENA */ | ||
278 | #define WM8400_GPIO5_DEB_ENA_SHIFT 7 /* GPIO5_DEB_ENA */ | ||
279 | #define WM8400_GPIO5_DEB_ENA_WIDTH 1 /* GPIO5_DEB_ENA */ | ||
280 | #define WM8400_GPIO5_IRQ_ENA 0x0040 /* GPIO5_IRQ_ENA */ | ||
281 | #define WM8400_GPIO5_IRQ_ENA_MASK 0x0040 /* GPIO5_IRQ_ENA */ | ||
282 | #define WM8400_GPIO5_IRQ_ENA_SHIFT 6 /* GPIO5_IRQ_ENA */ | ||
283 | #define WM8400_GPIO5_IRQ_ENA_WIDTH 1 /* GPIO5_IRQ_ENA */ | ||
284 | #define WM8400_GPIO5_PU 0x0020 /* GPIO5_PU */ | ||
285 | #define WM8400_GPIO5_PU_MASK 0x0020 /* GPIO5_PU */ | ||
286 | #define WM8400_GPIO5_PU_SHIFT 5 /* GPIO5_PU */ | ||
287 | #define WM8400_GPIO5_PU_WIDTH 1 /* GPIO5_PU */ | ||
288 | #define WM8400_GPIO5_PD 0x0010 /* GPIO5_PD */ | ||
289 | #define WM8400_GPIO5_PD_MASK 0x0010 /* GPIO5_PD */ | ||
290 | #define WM8400_GPIO5_PD_SHIFT 4 /* GPIO5_PD */ | ||
291 | #define WM8400_GPIO5_PD_WIDTH 1 /* GPIO5_PD */ | ||
292 | #define WM8400_GPIO5_SEL_MASK 0x000F /* GPIO5_SEL - [3:0] */ | ||
293 | #define WM8400_GPIO5_SEL_SHIFT 0 /* GPIO5_SEL - [3:0] */ | ||
294 | #define WM8400_GPIO5_SEL_WIDTH 4 /* GPIO5_SEL - [3:0] */ | ||
295 | |||
296 | /* | ||
297 | * R22 (0x16) - GPIOCTRL 2 | ||
298 | */ | ||
299 | #define WM8400_TEMPOK_IRQ_ENA 0x0800 /* TEMPOK_IRQ_ENA */ | ||
300 | #define WM8400_TEMPOK_IRQ_ENA_MASK 0x0800 /* TEMPOK_IRQ_ENA */ | ||
301 | #define WM8400_TEMPOK_IRQ_ENA_SHIFT 11 /* TEMPOK_IRQ_ENA */ | ||
302 | #define WM8400_TEMPOK_IRQ_ENA_WIDTH 1 /* TEMPOK_IRQ_ENA */ | ||
303 | #define WM8400_MIC1SHRT_IRQ_ENA 0x0400 /* MIC1SHRT_IRQ_ENA */ | ||
304 | #define WM8400_MIC1SHRT_IRQ_ENA_MASK 0x0400 /* MIC1SHRT_IRQ_ENA */ | ||
305 | #define WM8400_MIC1SHRT_IRQ_ENA_SHIFT 10 /* MIC1SHRT_IRQ_ENA */ | ||
306 | #define WM8400_MIC1SHRT_IRQ_ENA_WIDTH 1 /* MIC1SHRT_IRQ_ENA */ | ||
307 | #define WM8400_MIC1DET_IRQ_ENA 0x0200 /* MIC1DET_IRQ_ENA */ | ||
308 | #define WM8400_MIC1DET_IRQ_ENA_MASK 0x0200 /* MIC1DET_IRQ_ENA */ | ||
309 | #define WM8400_MIC1DET_IRQ_ENA_SHIFT 9 /* MIC1DET_IRQ_ENA */ | ||
310 | #define WM8400_MIC1DET_IRQ_ENA_WIDTH 1 /* MIC1DET_IRQ_ENA */ | ||
311 | #define WM8400_FLL_LCK_IRQ_ENA 0x0100 /* FLL_LCK_IRQ_ENA */ | ||
312 | #define WM8400_FLL_LCK_IRQ_ENA_MASK 0x0100 /* FLL_LCK_IRQ_ENA */ | ||
313 | #define WM8400_FLL_LCK_IRQ_ENA_SHIFT 8 /* FLL_LCK_IRQ_ENA */ | ||
314 | #define WM8400_FLL_LCK_IRQ_ENA_WIDTH 1 /* FLL_LCK_IRQ_ENA */ | ||
315 | #define WM8400_GPI8_DEB_ENA 0x0080 /* GPI8_DEB_ENA */ | ||
316 | #define WM8400_GPI8_DEB_ENA_MASK 0x0080 /* GPI8_DEB_ENA */ | ||
317 | #define WM8400_GPI8_DEB_ENA_SHIFT 7 /* GPI8_DEB_ENA */ | ||
318 | #define WM8400_GPI8_DEB_ENA_WIDTH 1 /* GPI8_DEB_ENA */ | ||
319 | #define WM8400_GPI8_IRQ_ENA 0x0040 /* GPI8_IRQ_ENA */ | ||
320 | #define WM8400_GPI8_IRQ_ENA_MASK 0x0040 /* GPI8_IRQ_ENA */ | ||
321 | #define WM8400_GPI8_IRQ_ENA_SHIFT 6 /* GPI8_IRQ_ENA */ | ||
322 | #define WM8400_GPI8_IRQ_ENA_WIDTH 1 /* GPI8_IRQ_ENA */ | ||
323 | #define WM8400_GPI8_ENA 0x0010 /* GPI8_ENA */ | ||
324 | #define WM8400_GPI8_ENA_MASK 0x0010 /* GPI8_ENA */ | ||
325 | #define WM8400_GPI8_ENA_SHIFT 4 /* GPI8_ENA */ | ||
326 | #define WM8400_GPI8_ENA_WIDTH 1 /* GPI8_ENA */ | ||
327 | #define WM8400_GPI7_DEB_ENA 0x0008 /* GPI7_DEB_ENA */ | ||
328 | #define WM8400_GPI7_DEB_ENA_MASK 0x0008 /* GPI7_DEB_ENA */ | ||
329 | #define WM8400_GPI7_DEB_ENA_SHIFT 3 /* GPI7_DEB_ENA */ | ||
330 | #define WM8400_GPI7_DEB_ENA_WIDTH 1 /* GPI7_DEB_ENA */ | ||
331 | #define WM8400_GPI7_IRQ_ENA 0x0004 /* GPI7_IRQ_ENA */ | ||
332 | #define WM8400_GPI7_IRQ_ENA_MASK 0x0004 /* GPI7_IRQ_ENA */ | ||
333 | #define WM8400_GPI7_IRQ_ENA_SHIFT 2 /* GPI7_IRQ_ENA */ | ||
334 | #define WM8400_GPI7_IRQ_ENA_WIDTH 1 /* GPI7_IRQ_ENA */ | ||
335 | #define WM8400_GPI7_ENA 0x0001 /* GPI7_ENA */ | ||
336 | #define WM8400_GPI7_ENA_MASK 0x0001 /* GPI7_ENA */ | ||
337 | #define WM8400_GPI7_ENA_SHIFT 0 /* GPI7_ENA */ | ||
338 | #define WM8400_GPI7_ENA_WIDTH 1 /* GPI7_ENA */ | ||
339 | |||
340 | /* | ||
341 | * R23 (0x17) - GPIO_POL | ||
342 | */ | ||
343 | #define WM8400_IRQ_INV 0x1000 /* IRQ_INV */ | ||
344 | #define WM8400_IRQ_INV_MASK 0x1000 /* IRQ_INV */ | ||
345 | #define WM8400_IRQ_INV_SHIFT 12 /* IRQ_INV */ | ||
346 | #define WM8400_IRQ_INV_WIDTH 1 /* IRQ_INV */ | ||
347 | #define WM8400_TEMPOK_POL 0x0800 /* TEMPOK_POL */ | ||
348 | #define WM8400_TEMPOK_POL_MASK 0x0800 /* TEMPOK_POL */ | ||
349 | #define WM8400_TEMPOK_POL_SHIFT 11 /* TEMPOK_POL */ | ||
350 | #define WM8400_TEMPOK_POL_WIDTH 1 /* TEMPOK_POL */ | ||
351 | #define WM8400_MIC1SHRT_POL 0x0400 /* MIC1SHRT_POL */ | ||
352 | #define WM8400_MIC1SHRT_POL_MASK 0x0400 /* MIC1SHRT_POL */ | ||
353 | #define WM8400_MIC1SHRT_POL_SHIFT 10 /* MIC1SHRT_POL */ | ||
354 | #define WM8400_MIC1SHRT_POL_WIDTH 1 /* MIC1SHRT_POL */ | ||
355 | #define WM8400_MIC1DET_POL 0x0200 /* MIC1DET_POL */ | ||
356 | #define WM8400_MIC1DET_POL_MASK 0x0200 /* MIC1DET_POL */ | ||
357 | #define WM8400_MIC1DET_POL_SHIFT 9 /* MIC1DET_POL */ | ||
358 | #define WM8400_MIC1DET_POL_WIDTH 1 /* MIC1DET_POL */ | ||
359 | #define WM8400_FLL_LCK_POL 0x0100 /* FLL_LCK_POL */ | ||
360 | #define WM8400_FLL_LCK_POL_MASK 0x0100 /* FLL_LCK_POL */ | ||
361 | #define WM8400_FLL_LCK_POL_SHIFT 8 /* FLL_LCK_POL */ | ||
362 | #define WM8400_FLL_LCK_POL_WIDTH 1 /* FLL_LCK_POL */ | ||
363 | #define WM8400_GPIO_POL_MASK 0x00FF /* GPIO_POL - [7:0] */ | ||
364 | #define WM8400_GPIO_POL_SHIFT 0 /* GPIO_POL - [7:0] */ | ||
365 | #define WM8400_GPIO_POL_WIDTH 8 /* GPIO_POL - [7:0] */ | ||
366 | |||
367 | /* | ||
368 | * R65 (0x41) - LDO 1 Control | ||
369 | */ | ||
370 | #define WM8400_LDO1_ENA 0x8000 /* LDO1_ENA */ | ||
371 | #define WM8400_LDO1_ENA_MASK 0x8000 /* LDO1_ENA */ | ||
372 | #define WM8400_LDO1_ENA_SHIFT 15 /* LDO1_ENA */ | ||
373 | #define WM8400_LDO1_ENA_WIDTH 1 /* LDO1_ENA */ | ||
374 | #define WM8400_LDO1_SWI 0x4000 /* LDO1_SWI */ | ||
375 | #define WM8400_LDO1_SWI_MASK 0x4000 /* LDO1_SWI */ | ||
376 | #define WM8400_LDO1_SWI_SHIFT 14 /* LDO1_SWI */ | ||
377 | #define WM8400_LDO1_SWI_WIDTH 1 /* LDO1_SWI */ | ||
378 | #define WM8400_LDO1_OPFLT 0x1000 /* LDO1_OPFLT */ | ||
379 | #define WM8400_LDO1_OPFLT_MASK 0x1000 /* LDO1_OPFLT */ | ||
380 | #define WM8400_LDO1_OPFLT_SHIFT 12 /* LDO1_OPFLT */ | ||
381 | #define WM8400_LDO1_OPFLT_WIDTH 1 /* LDO1_OPFLT */ | ||
382 | #define WM8400_LDO1_ERRACT 0x0800 /* LDO1_ERRACT */ | ||
383 | #define WM8400_LDO1_ERRACT_MASK 0x0800 /* LDO1_ERRACT */ | ||
384 | #define WM8400_LDO1_ERRACT_SHIFT 11 /* LDO1_ERRACT */ | ||
385 | #define WM8400_LDO1_ERRACT_WIDTH 1 /* LDO1_ERRACT */ | ||
386 | #define WM8400_LDO1_HIB_MODE 0x0400 /* LDO1_HIB_MODE */ | ||
387 | #define WM8400_LDO1_HIB_MODE_MASK 0x0400 /* LDO1_HIB_MODE */ | ||
388 | #define WM8400_LDO1_HIB_MODE_SHIFT 10 /* LDO1_HIB_MODE */ | ||
389 | #define WM8400_LDO1_HIB_MODE_WIDTH 1 /* LDO1_HIB_MODE */ | ||
390 | #define WM8400_LDO1_VIMG_MASK 0x03E0 /* LDO1_VIMG - [9:5] */ | ||
391 | #define WM8400_LDO1_VIMG_SHIFT 5 /* LDO1_VIMG - [9:5] */ | ||
392 | #define WM8400_LDO1_VIMG_WIDTH 5 /* LDO1_VIMG - [9:5] */ | ||
393 | #define WM8400_LDO1_VSEL_MASK 0x001F /* LDO1_VSEL - [4:0] */ | ||
394 | #define WM8400_LDO1_VSEL_SHIFT 0 /* LDO1_VSEL - [4:0] */ | ||
395 | #define WM8400_LDO1_VSEL_WIDTH 5 /* LDO1_VSEL - [4:0] */ | ||
396 | |||
397 | /* | ||
398 | * R66 (0x42) - LDO 2 Control | ||
399 | */ | ||
400 | #define WM8400_LDO2_ENA 0x8000 /* LDO2_ENA */ | ||
401 | #define WM8400_LDO2_ENA_MASK 0x8000 /* LDO2_ENA */ | ||
402 | #define WM8400_LDO2_ENA_SHIFT 15 /* LDO2_ENA */ | ||
403 | #define WM8400_LDO2_ENA_WIDTH 1 /* LDO2_ENA */ | ||
404 | #define WM8400_LDO2_SWI 0x4000 /* LDO2_SWI */ | ||
405 | #define WM8400_LDO2_SWI_MASK 0x4000 /* LDO2_SWI */ | ||
406 | #define WM8400_LDO2_SWI_SHIFT 14 /* LDO2_SWI */ | ||
407 | #define WM8400_LDO2_SWI_WIDTH 1 /* LDO2_SWI */ | ||
408 | #define WM8400_LDO2_OPFLT 0x1000 /* LDO2_OPFLT */ | ||
409 | #define WM8400_LDO2_OPFLT_MASK 0x1000 /* LDO2_OPFLT */ | ||
410 | #define WM8400_LDO2_OPFLT_SHIFT 12 /* LDO2_OPFLT */ | ||
411 | #define WM8400_LDO2_OPFLT_WIDTH 1 /* LDO2_OPFLT */ | ||
412 | #define WM8400_LDO2_ERRACT 0x0800 /* LDO2_ERRACT */ | ||
413 | #define WM8400_LDO2_ERRACT_MASK 0x0800 /* LDO2_ERRACT */ | ||
414 | #define WM8400_LDO2_ERRACT_SHIFT 11 /* LDO2_ERRACT */ | ||
415 | #define WM8400_LDO2_ERRACT_WIDTH 1 /* LDO2_ERRACT */ | ||
416 | #define WM8400_LDO2_HIB_MODE 0x0400 /* LDO2_HIB_MODE */ | ||
417 | #define WM8400_LDO2_HIB_MODE_MASK 0x0400 /* LDO2_HIB_MODE */ | ||
418 | #define WM8400_LDO2_HIB_MODE_SHIFT 10 /* LDO2_HIB_MODE */ | ||
419 | #define WM8400_LDO2_HIB_MODE_WIDTH 1 /* LDO2_HIB_MODE */ | ||
420 | #define WM8400_LDO2_VIMG_MASK 0x03E0 /* LDO2_VIMG - [9:5] */ | ||
421 | #define WM8400_LDO2_VIMG_SHIFT 5 /* LDO2_VIMG - [9:5] */ | ||
422 | #define WM8400_LDO2_VIMG_WIDTH 5 /* LDO2_VIMG - [9:5] */ | ||
423 | #define WM8400_LDO2_VSEL_MASK 0x001F /* LDO2_VSEL - [4:0] */ | ||
424 | #define WM8400_LDO2_VSEL_SHIFT 0 /* LDO2_VSEL - [4:0] */ | ||
425 | #define WM8400_LDO2_VSEL_WIDTH 5 /* LDO2_VSEL - [4:0] */ | ||
426 | |||
427 | /* | ||
428 | * R67 (0x43) - LDO 3 Control | ||
429 | */ | ||
430 | #define WM8400_LDO3_ENA 0x8000 /* LDO3_ENA */ | ||
431 | #define WM8400_LDO3_ENA_MASK 0x8000 /* LDO3_ENA */ | ||
432 | #define WM8400_LDO3_ENA_SHIFT 15 /* LDO3_ENA */ | ||
433 | #define WM8400_LDO3_ENA_WIDTH 1 /* LDO3_ENA */ | ||
434 | #define WM8400_LDO3_SWI 0x4000 /* LDO3_SWI */ | ||
435 | #define WM8400_LDO3_SWI_MASK 0x4000 /* LDO3_SWI */ | ||
436 | #define WM8400_LDO3_SWI_SHIFT 14 /* LDO3_SWI */ | ||
437 | #define WM8400_LDO3_SWI_WIDTH 1 /* LDO3_SWI */ | ||
438 | #define WM8400_LDO3_OPFLT 0x1000 /* LDO3_OPFLT */ | ||
439 | #define WM8400_LDO3_OPFLT_MASK 0x1000 /* LDO3_OPFLT */ | ||
440 | #define WM8400_LDO3_OPFLT_SHIFT 12 /* LDO3_OPFLT */ | ||
441 | #define WM8400_LDO3_OPFLT_WIDTH 1 /* LDO3_OPFLT */ | ||
442 | #define WM8400_LDO3_ERRACT 0x0800 /* LDO3_ERRACT */ | ||
443 | #define WM8400_LDO3_ERRACT_MASK 0x0800 /* LDO3_ERRACT */ | ||
444 | #define WM8400_LDO3_ERRACT_SHIFT 11 /* LDO3_ERRACT */ | ||
445 | #define WM8400_LDO3_ERRACT_WIDTH 1 /* LDO3_ERRACT */ | ||
446 | #define WM8400_LDO3_HIB_MODE 0x0400 /* LDO3_HIB_MODE */ | ||
447 | #define WM8400_LDO3_HIB_MODE_MASK 0x0400 /* LDO3_HIB_MODE */ | ||
448 | #define WM8400_LDO3_HIB_MODE_SHIFT 10 /* LDO3_HIB_MODE */ | ||
449 | #define WM8400_LDO3_HIB_MODE_WIDTH 1 /* LDO3_HIB_MODE */ | ||
450 | #define WM8400_LDO3_VIMG_MASK 0x03E0 /* LDO3_VIMG - [9:5] */ | ||
451 | #define WM8400_LDO3_VIMG_SHIFT 5 /* LDO3_VIMG - [9:5] */ | ||
452 | #define WM8400_LDO3_VIMG_WIDTH 5 /* LDO3_VIMG - [9:5] */ | ||
453 | #define WM8400_LDO3_VSEL_MASK 0x001F /* LDO3_VSEL - [4:0] */ | ||
454 | #define WM8400_LDO3_VSEL_SHIFT 0 /* LDO3_VSEL - [4:0] */ | ||
455 | #define WM8400_LDO3_VSEL_WIDTH 5 /* LDO3_VSEL - [4:0] */ | ||
456 | |||
457 | /* | ||
458 | * R68 (0x44) - LDO 4 Control | ||
459 | */ | ||
460 | #define WM8400_LDO4_ENA 0x8000 /* LDO4_ENA */ | ||
461 | #define WM8400_LDO4_ENA_MASK 0x8000 /* LDO4_ENA */ | ||
462 | #define WM8400_LDO4_ENA_SHIFT 15 /* LDO4_ENA */ | ||
463 | #define WM8400_LDO4_ENA_WIDTH 1 /* LDO4_ENA */ | ||
464 | #define WM8400_LDO4_SWI 0x4000 /* LDO4_SWI */ | ||
465 | #define WM8400_LDO4_SWI_MASK 0x4000 /* LDO4_SWI */ | ||
466 | #define WM8400_LDO4_SWI_SHIFT 14 /* LDO4_SWI */ | ||
467 | #define WM8400_LDO4_SWI_WIDTH 1 /* LDO4_SWI */ | ||
468 | #define WM8400_LDO4_OPFLT 0x1000 /* LDO4_OPFLT */ | ||
469 | #define WM8400_LDO4_OPFLT_MASK 0x1000 /* LDO4_OPFLT */ | ||
470 | #define WM8400_LDO4_OPFLT_SHIFT 12 /* LDO4_OPFLT */ | ||
471 | #define WM8400_LDO4_OPFLT_WIDTH 1 /* LDO4_OPFLT */ | ||
472 | #define WM8400_LDO4_ERRACT 0x0800 /* LDO4_ERRACT */ | ||
473 | #define WM8400_LDO4_ERRACT_MASK 0x0800 /* LDO4_ERRACT */ | ||
474 | #define WM8400_LDO4_ERRACT_SHIFT 11 /* LDO4_ERRACT */ | ||
475 | #define WM8400_LDO4_ERRACT_WIDTH 1 /* LDO4_ERRACT */ | ||
476 | #define WM8400_LDO4_HIB_MODE 0x0400 /* LDO4_HIB_MODE */ | ||
477 | #define WM8400_LDO4_HIB_MODE_MASK 0x0400 /* LDO4_HIB_MODE */ | ||
478 | #define WM8400_LDO4_HIB_MODE_SHIFT 10 /* LDO4_HIB_MODE */ | ||
479 | #define WM8400_LDO4_HIB_MODE_WIDTH 1 /* LDO4_HIB_MODE */ | ||
480 | #define WM8400_LDO4_VIMG_MASK 0x03E0 /* LDO4_VIMG - [9:5] */ | ||
481 | #define WM8400_LDO4_VIMG_SHIFT 5 /* LDO4_VIMG - [9:5] */ | ||
482 | #define WM8400_LDO4_VIMG_WIDTH 5 /* LDO4_VIMG - [9:5] */ | ||
483 | #define WM8400_LDO4_VSEL_MASK 0x001F /* LDO4_VSEL - [4:0] */ | ||
484 | #define WM8400_LDO4_VSEL_SHIFT 0 /* LDO4_VSEL - [4:0] */ | ||
485 | #define WM8400_LDO4_VSEL_WIDTH 5 /* LDO4_VSEL - [4:0] */ | ||
486 | |||
487 | /* | ||
488 | * R70 (0x46) - DCDC1 Control 1 | ||
489 | */ | ||
490 | #define WM8400_DC1_ENA 0x8000 /* DC1_ENA */ | ||
491 | #define WM8400_DC1_ENA_MASK 0x8000 /* DC1_ENA */ | ||
492 | #define WM8400_DC1_ENA_SHIFT 15 /* DC1_ENA */ | ||
493 | #define WM8400_DC1_ENA_WIDTH 1 /* DC1_ENA */ | ||
494 | #define WM8400_DC1_ACTIVE 0x4000 /* DC1_ACTIVE */ | ||
495 | #define WM8400_DC1_ACTIVE_MASK 0x4000 /* DC1_ACTIVE */ | ||
496 | #define WM8400_DC1_ACTIVE_SHIFT 14 /* DC1_ACTIVE */ | ||
497 | #define WM8400_DC1_ACTIVE_WIDTH 1 /* DC1_ACTIVE */ | ||
498 | #define WM8400_DC1_SLEEP 0x2000 /* DC1_SLEEP */ | ||
499 | #define WM8400_DC1_SLEEP_MASK 0x2000 /* DC1_SLEEP */ | ||
500 | #define WM8400_DC1_SLEEP_SHIFT 13 /* DC1_SLEEP */ | ||
501 | #define WM8400_DC1_SLEEP_WIDTH 1 /* DC1_SLEEP */ | ||
502 | #define WM8400_DC1_OPFLT 0x1000 /* DC1_OPFLT */ | ||
503 | #define WM8400_DC1_OPFLT_MASK 0x1000 /* DC1_OPFLT */ | ||
504 | #define WM8400_DC1_OPFLT_SHIFT 12 /* DC1_OPFLT */ | ||
505 | #define WM8400_DC1_OPFLT_WIDTH 1 /* DC1_OPFLT */ | ||
506 | #define WM8400_DC1_ERRACT 0x0800 /* DC1_ERRACT */ | ||
507 | #define WM8400_DC1_ERRACT_MASK 0x0800 /* DC1_ERRACT */ | ||
508 | #define WM8400_DC1_ERRACT_SHIFT 11 /* DC1_ERRACT */ | ||
509 | #define WM8400_DC1_ERRACT_WIDTH 1 /* DC1_ERRACT */ | ||
510 | #define WM8400_DC1_HIB_MODE 0x0400 /* DC1_HIB_MODE */ | ||
511 | #define WM8400_DC1_HIB_MODE_MASK 0x0400 /* DC1_HIB_MODE */ | ||
512 | #define WM8400_DC1_HIB_MODE_SHIFT 10 /* DC1_HIB_MODE */ | ||
513 | #define WM8400_DC1_HIB_MODE_WIDTH 1 /* DC1_HIB_MODE */ | ||
514 | #define WM8400_DC1_SOFTST_MASK 0x0300 /* DC1_SOFTST - [9:8] */ | ||
515 | #define WM8400_DC1_SOFTST_SHIFT 8 /* DC1_SOFTST - [9:8] */ | ||
516 | #define WM8400_DC1_SOFTST_WIDTH 2 /* DC1_SOFTST - [9:8] */ | ||
517 | #define WM8400_DC1_OV_PROT 0x0080 /* DC1_OV_PROT */ | ||
518 | #define WM8400_DC1_OV_PROT_MASK 0x0080 /* DC1_OV_PROT */ | ||
519 | #define WM8400_DC1_OV_PROT_SHIFT 7 /* DC1_OV_PROT */ | ||
520 | #define WM8400_DC1_OV_PROT_WIDTH 1 /* DC1_OV_PROT */ | ||
521 | #define WM8400_DC1_VSEL_MASK 0x007F /* DC1_VSEL - [6:0] */ | ||
522 | #define WM8400_DC1_VSEL_SHIFT 0 /* DC1_VSEL - [6:0] */ | ||
523 | #define WM8400_DC1_VSEL_WIDTH 7 /* DC1_VSEL - [6:0] */ | ||
524 | |||
525 | /* | ||
526 | * R71 (0x47) - DCDC1 Control 2 | ||
527 | */ | ||
528 | #define WM8400_DC1_FRC_PWM 0x2000 /* DC1_FRC_PWM */ | ||
529 | #define WM8400_DC1_FRC_PWM_MASK 0x2000 /* DC1_FRC_PWM */ | ||
530 | #define WM8400_DC1_FRC_PWM_SHIFT 13 /* DC1_FRC_PWM */ | ||
531 | #define WM8400_DC1_FRC_PWM_WIDTH 1 /* DC1_FRC_PWM */ | ||
532 | #define WM8400_DC1_STBY_LIM_MASK 0x0300 /* DC1_STBY_LIM - [9:8] */ | ||
533 | #define WM8400_DC1_STBY_LIM_SHIFT 8 /* DC1_STBY_LIM - [9:8] */ | ||
534 | #define WM8400_DC1_STBY_LIM_WIDTH 2 /* DC1_STBY_LIM - [9:8] */ | ||
535 | #define WM8400_DC1_ACT_LIM 0x0080 /* DC1_ACT_LIM */ | ||
536 | #define WM8400_DC1_ACT_LIM_MASK 0x0080 /* DC1_ACT_LIM */ | ||
537 | #define WM8400_DC1_ACT_LIM_SHIFT 7 /* DC1_ACT_LIM */ | ||
538 | #define WM8400_DC1_ACT_LIM_WIDTH 1 /* DC1_ACT_LIM */ | ||
539 | #define WM8400_DC1_VIMG_MASK 0x007F /* DC1_VIMG - [6:0] */ | ||
540 | #define WM8400_DC1_VIMG_SHIFT 0 /* DC1_VIMG - [6:0] */ | ||
541 | #define WM8400_DC1_VIMG_WIDTH 7 /* DC1_VIMG - [6:0] */ | ||
542 | |||
543 | /* | ||
544 | * R72 (0x48) - DCDC2 Control 1 | ||
545 | */ | ||
546 | #define WM8400_DC2_ENA 0x8000 /* DC2_ENA */ | ||
547 | #define WM8400_DC2_ENA_MASK 0x8000 /* DC2_ENA */ | ||
548 | #define WM8400_DC2_ENA_SHIFT 15 /* DC2_ENA */ | ||
549 | #define WM8400_DC2_ENA_WIDTH 1 /* DC2_ENA */ | ||
550 | #define WM8400_DC2_ACTIVE 0x4000 /* DC2_ACTIVE */ | ||
551 | #define WM8400_DC2_ACTIVE_MASK 0x4000 /* DC2_ACTIVE */ | ||
552 | #define WM8400_DC2_ACTIVE_SHIFT 14 /* DC2_ACTIVE */ | ||
553 | #define WM8400_DC2_ACTIVE_WIDTH 1 /* DC2_ACTIVE */ | ||
554 | #define WM8400_DC2_SLEEP 0x2000 /* DC2_SLEEP */ | ||
555 | #define WM8400_DC2_SLEEP_MASK 0x2000 /* DC2_SLEEP */ | ||
556 | #define WM8400_DC2_SLEEP_SHIFT 13 /* DC2_SLEEP */ | ||
557 | #define WM8400_DC2_SLEEP_WIDTH 1 /* DC2_SLEEP */ | ||
558 | #define WM8400_DC2_OPFLT 0x1000 /* DC2_OPFLT */ | ||
559 | #define WM8400_DC2_OPFLT_MASK 0x1000 /* DC2_OPFLT */ | ||
560 | #define WM8400_DC2_OPFLT_SHIFT 12 /* DC2_OPFLT */ | ||
561 | #define WM8400_DC2_OPFLT_WIDTH 1 /* DC2_OPFLT */ | ||
562 | #define WM8400_DC2_ERRACT 0x0800 /* DC2_ERRACT */ | ||
563 | #define WM8400_DC2_ERRACT_MASK 0x0800 /* DC2_ERRACT */ | ||
564 | #define WM8400_DC2_ERRACT_SHIFT 11 /* DC2_ERRACT */ | ||
565 | #define WM8400_DC2_ERRACT_WIDTH 1 /* DC2_ERRACT */ | ||
566 | #define WM8400_DC2_HIB_MODE 0x0400 /* DC2_HIB_MODE */ | ||
567 | #define WM8400_DC2_HIB_MODE_MASK 0x0400 /* DC2_HIB_MODE */ | ||
568 | #define WM8400_DC2_HIB_MODE_SHIFT 10 /* DC2_HIB_MODE */ | ||
569 | #define WM8400_DC2_HIB_MODE_WIDTH 1 /* DC2_HIB_MODE */ | ||
570 | #define WM8400_DC2_SOFTST_MASK 0x0300 /* DC2_SOFTST - [9:8] */ | ||
571 | #define WM8400_DC2_SOFTST_SHIFT 8 /* DC2_SOFTST - [9:8] */ | ||
572 | #define WM8400_DC2_SOFTST_WIDTH 2 /* DC2_SOFTST - [9:8] */ | ||
573 | #define WM8400_DC2_OV_PROT 0x0080 /* DC2_OV_PROT */ | ||
574 | #define WM8400_DC2_OV_PROT_MASK 0x0080 /* DC2_OV_PROT */ | ||
575 | #define WM8400_DC2_OV_PROT_SHIFT 7 /* DC2_OV_PROT */ | ||
576 | #define WM8400_DC2_OV_PROT_WIDTH 1 /* DC2_OV_PROT */ | ||
577 | #define WM8400_DC2_VSEL_MASK 0x007F /* DC2_VSEL - [6:0] */ | ||
578 | #define WM8400_DC2_VSEL_SHIFT 0 /* DC2_VSEL - [6:0] */ | ||
579 | #define WM8400_DC2_VSEL_WIDTH 7 /* DC2_VSEL - [6:0] */ | ||
580 | |||
581 | /* | ||
582 | * R73 (0x49) - DCDC2 Control 2 | ||
583 | */ | ||
584 | #define WM8400_DC2_FRC_PWM 0x2000 /* DC2_FRC_PWM */ | ||
585 | #define WM8400_DC2_FRC_PWM_MASK 0x2000 /* DC2_FRC_PWM */ | ||
586 | #define WM8400_DC2_FRC_PWM_SHIFT 13 /* DC2_FRC_PWM */ | ||
587 | #define WM8400_DC2_FRC_PWM_WIDTH 1 /* DC2_FRC_PWM */ | ||
588 | #define WM8400_DC2_STBY_LIM_MASK 0x0300 /* DC2_STBY_LIM - [9:8] */ | ||
589 | #define WM8400_DC2_STBY_LIM_SHIFT 8 /* DC2_STBY_LIM - [9:8] */ | ||
590 | #define WM8400_DC2_STBY_LIM_WIDTH 2 /* DC2_STBY_LIM - [9:8] */ | ||
591 | #define WM8400_DC2_ACT_LIM 0x0080 /* DC2_ACT_LIM */ | ||
592 | #define WM8400_DC2_ACT_LIM_MASK 0x0080 /* DC2_ACT_LIM */ | ||
593 | #define WM8400_DC2_ACT_LIM_SHIFT 7 /* DC2_ACT_LIM */ | ||
594 | #define WM8400_DC2_ACT_LIM_WIDTH 1 /* DC2_ACT_LIM */ | ||
595 | #define WM8400_DC2_VIMG_MASK 0x007F /* DC2_VIMG - [6:0] */ | ||
596 | #define WM8400_DC2_VIMG_SHIFT 0 /* DC2_VIMG - [6:0] */ | ||
597 | #define WM8400_DC2_VIMG_WIDTH 7 /* DC2_VIMG - [6:0] */ | ||
598 | |||
599 | /* | ||
600 | * R75 (0x4B) - Interface | ||
601 | */ | ||
602 | #define WM8400_AUTOINC 0x0008 /* AUTOINC */ | ||
603 | #define WM8400_AUTOINC_MASK 0x0008 /* AUTOINC */ | ||
604 | #define WM8400_AUTOINC_SHIFT 3 /* AUTOINC */ | ||
605 | #define WM8400_AUTOINC_WIDTH 1 /* AUTOINC */ | ||
606 | #define WM8400_ARA_ENA 0x0004 /* ARA_ENA */ | ||
607 | #define WM8400_ARA_ENA_MASK 0x0004 /* ARA_ENA */ | ||
608 | #define WM8400_ARA_ENA_SHIFT 2 /* ARA_ENA */ | ||
609 | #define WM8400_ARA_ENA_WIDTH 1 /* ARA_ENA */ | ||
610 | #define WM8400_SPI_CFG 0x0002 /* SPI_CFG */ | ||
611 | #define WM8400_SPI_CFG_MASK 0x0002 /* SPI_CFG */ | ||
612 | #define WM8400_SPI_CFG_SHIFT 1 /* SPI_CFG */ | ||
613 | #define WM8400_SPI_CFG_WIDTH 1 /* SPI_CFG */ | ||
614 | |||
615 | /* | ||
616 | * R76 (0x4C) - PM GENERAL | ||
617 | */ | ||
618 | #define WM8400_CODEC_SOFTST 0x8000 /* CODEC_SOFTST */ | ||
619 | #define WM8400_CODEC_SOFTST_MASK 0x8000 /* CODEC_SOFTST */ | ||
620 | #define WM8400_CODEC_SOFTST_SHIFT 15 /* CODEC_SOFTST */ | ||
621 | #define WM8400_CODEC_SOFTST_WIDTH 1 /* CODEC_SOFTST */ | ||
622 | #define WM8400_CODEC_SOFTSD 0x4000 /* CODEC_SOFTSD */ | ||
623 | #define WM8400_CODEC_SOFTSD_MASK 0x4000 /* CODEC_SOFTSD */ | ||
624 | #define WM8400_CODEC_SOFTSD_SHIFT 14 /* CODEC_SOFTSD */ | ||
625 | #define WM8400_CODEC_SOFTSD_WIDTH 1 /* CODEC_SOFTSD */ | ||
626 | #define WM8400_CHIP_SOFTSD 0x2000 /* CHIP_SOFTSD */ | ||
627 | #define WM8400_CHIP_SOFTSD_MASK 0x2000 /* CHIP_SOFTSD */ | ||
628 | #define WM8400_CHIP_SOFTSD_SHIFT 13 /* CHIP_SOFTSD */ | ||
629 | #define WM8400_CHIP_SOFTSD_WIDTH 1 /* CHIP_SOFTSD */ | ||
630 | #define WM8400_DSLEEP1_POL 0x0008 /* DSLEEP1_POL */ | ||
631 | #define WM8400_DSLEEP1_POL_MASK 0x0008 /* DSLEEP1_POL */ | ||
632 | #define WM8400_DSLEEP1_POL_SHIFT 3 /* DSLEEP1_POL */ | ||
633 | #define WM8400_DSLEEP1_POL_WIDTH 1 /* DSLEEP1_POL */ | ||
634 | #define WM8400_DSLEEP2_POL 0x0004 /* DSLEEP2_POL */ | ||
635 | #define WM8400_DSLEEP2_POL_MASK 0x0004 /* DSLEEP2_POL */ | ||
636 | #define WM8400_DSLEEP2_POL_SHIFT 2 /* DSLEEP2_POL */ | ||
637 | #define WM8400_DSLEEP2_POL_WIDTH 1 /* DSLEEP2_POL */ | ||
638 | #define WM8400_PWR_STATE_MASK 0x0003 /* PWR_STATE - [1:0] */ | ||
639 | #define WM8400_PWR_STATE_SHIFT 0 /* PWR_STATE - [1:0] */ | ||
640 | #define WM8400_PWR_STATE_WIDTH 2 /* PWR_STATE - [1:0] */ | ||
641 | |||
642 | /* | ||
643 | * R78 (0x4E) - PM Shutdown Control | ||
644 | */ | ||
645 | #define WM8400_CHIP_GT150_ERRACT 0x0200 /* CHIP_GT150_ERRACT */ | ||
646 | #define WM8400_CHIP_GT150_ERRACT_MASK 0x0200 /* CHIP_GT150_ERRACT */ | ||
647 | #define WM8400_CHIP_GT150_ERRACT_SHIFT 9 /* CHIP_GT150_ERRACT */ | ||
648 | #define WM8400_CHIP_GT150_ERRACT_WIDTH 1 /* CHIP_GT150_ERRACT */ | ||
649 | #define WM8400_CHIP_GT115_ERRACT 0x0100 /* CHIP_GT115_ERRACT */ | ||
650 | #define WM8400_CHIP_GT115_ERRACT_MASK 0x0100 /* CHIP_GT115_ERRACT */ | ||
651 | #define WM8400_CHIP_GT115_ERRACT_SHIFT 8 /* CHIP_GT115_ERRACT */ | ||
652 | #define WM8400_CHIP_GT115_ERRACT_WIDTH 1 /* CHIP_GT115_ERRACT */ | ||
653 | #define WM8400_LINE_CMP_ERRACT 0x0080 /* LINE_CMP_ERRACT */ | ||
654 | #define WM8400_LINE_CMP_ERRACT_MASK 0x0080 /* LINE_CMP_ERRACT */ | ||
655 | #define WM8400_LINE_CMP_ERRACT_SHIFT 7 /* LINE_CMP_ERRACT */ | ||
656 | #define WM8400_LINE_CMP_ERRACT_WIDTH 1 /* LINE_CMP_ERRACT */ | ||
657 | #define WM8400_UVLO_ERRACT 0x0040 /* UVLO_ERRACT */ | ||
658 | #define WM8400_UVLO_ERRACT_MASK 0x0040 /* UVLO_ERRACT */ | ||
659 | #define WM8400_UVLO_ERRACT_SHIFT 6 /* UVLO_ERRACT */ | ||
660 | #define WM8400_UVLO_ERRACT_WIDTH 1 /* UVLO_ERRACT */ | ||
661 | |||
662 | /* | ||
663 | * R79 (0x4F) - Interrupt Status 1 | ||
664 | */ | ||
665 | #define WM8400_MICD_CINT 0x8000 /* MICD_CINT */ | ||
666 | #define WM8400_MICD_CINT_MASK 0x8000 /* MICD_CINT */ | ||
667 | #define WM8400_MICD_CINT_SHIFT 15 /* MICD_CINT */ | ||
668 | #define WM8400_MICD_CINT_WIDTH 1 /* MICD_CINT */ | ||
669 | #define WM8400_MICSCD_CINT 0x4000 /* MICSCD_CINT */ | ||
670 | #define WM8400_MICSCD_CINT_MASK 0x4000 /* MICSCD_CINT */ | ||
671 | #define WM8400_MICSCD_CINT_SHIFT 14 /* MICSCD_CINT */ | ||
672 | #define WM8400_MICSCD_CINT_WIDTH 1 /* MICSCD_CINT */ | ||
673 | #define WM8400_JDL_CINT 0x2000 /* JDL_CINT */ | ||
674 | #define WM8400_JDL_CINT_MASK 0x2000 /* JDL_CINT */ | ||
675 | #define WM8400_JDL_CINT_SHIFT 13 /* JDL_CINT */ | ||
676 | #define WM8400_JDL_CINT_WIDTH 1 /* JDL_CINT */ | ||
677 | #define WM8400_JDR_CINT 0x1000 /* JDR_CINT */ | ||
678 | #define WM8400_JDR_CINT_MASK 0x1000 /* JDR_CINT */ | ||
679 | #define WM8400_JDR_CINT_SHIFT 12 /* JDR_CINT */ | ||
680 | #define WM8400_JDR_CINT_WIDTH 1 /* JDR_CINT */ | ||
681 | #define WM8400_CODEC_SEQ_END_EINT 0x0800 /* CODEC_SEQ_END_EINT */ | ||
682 | #define WM8400_CODEC_SEQ_END_EINT_MASK 0x0800 /* CODEC_SEQ_END_EINT */ | ||
683 | #define WM8400_CODEC_SEQ_END_EINT_SHIFT 11 /* CODEC_SEQ_END_EINT */ | ||
684 | #define WM8400_CODEC_SEQ_END_EINT_WIDTH 1 /* CODEC_SEQ_END_EINT */ | ||
685 | #define WM8400_CDEL_TO_EINT 0x0400 /* CDEL_TO_EINT */ | ||
686 | #define WM8400_CDEL_TO_EINT_MASK 0x0400 /* CDEL_TO_EINT */ | ||
687 | #define WM8400_CDEL_TO_EINT_SHIFT 10 /* CDEL_TO_EINT */ | ||
688 | #define WM8400_CDEL_TO_EINT_WIDTH 1 /* CDEL_TO_EINT */ | ||
689 | #define WM8400_CHIP_GT150_EINT 0x0200 /* CHIP_GT150_EINT */ | ||
690 | #define WM8400_CHIP_GT150_EINT_MASK 0x0200 /* CHIP_GT150_EINT */ | ||
691 | #define WM8400_CHIP_GT150_EINT_SHIFT 9 /* CHIP_GT150_EINT */ | ||
692 | #define WM8400_CHIP_GT150_EINT_WIDTH 1 /* CHIP_GT150_EINT */ | ||
693 | #define WM8400_CHIP_GT115_EINT 0x0100 /* CHIP_GT115_EINT */ | ||
694 | #define WM8400_CHIP_GT115_EINT_MASK 0x0100 /* CHIP_GT115_EINT */ | ||
695 | #define WM8400_CHIP_GT115_EINT_SHIFT 8 /* CHIP_GT115_EINT */ | ||
696 | #define WM8400_CHIP_GT115_EINT_WIDTH 1 /* CHIP_GT115_EINT */ | ||
697 | #define WM8400_LINE_CMP_EINT 0x0080 /* LINE_CMP_EINT */ | ||
698 | #define WM8400_LINE_CMP_EINT_MASK 0x0080 /* LINE_CMP_EINT */ | ||
699 | #define WM8400_LINE_CMP_EINT_SHIFT 7 /* LINE_CMP_EINT */ | ||
700 | #define WM8400_LINE_CMP_EINT_WIDTH 1 /* LINE_CMP_EINT */ | ||
701 | #define WM8400_UVLO_EINT 0x0040 /* UVLO_EINT */ | ||
702 | #define WM8400_UVLO_EINT_MASK 0x0040 /* UVLO_EINT */ | ||
703 | #define WM8400_UVLO_EINT_SHIFT 6 /* UVLO_EINT */ | ||
704 | #define WM8400_UVLO_EINT_WIDTH 1 /* UVLO_EINT */ | ||
705 | #define WM8400_DC2_UV_EINT 0x0020 /* DC2_UV_EINT */ | ||
706 | #define WM8400_DC2_UV_EINT_MASK 0x0020 /* DC2_UV_EINT */ | ||
707 | #define WM8400_DC2_UV_EINT_SHIFT 5 /* DC2_UV_EINT */ | ||
708 | #define WM8400_DC2_UV_EINT_WIDTH 1 /* DC2_UV_EINT */ | ||
709 | #define WM8400_DC1_UV_EINT 0x0010 /* DC1_UV_EINT */ | ||
710 | #define WM8400_DC1_UV_EINT_MASK 0x0010 /* DC1_UV_EINT */ | ||
711 | #define WM8400_DC1_UV_EINT_SHIFT 4 /* DC1_UV_EINT */ | ||
712 | #define WM8400_DC1_UV_EINT_WIDTH 1 /* DC1_UV_EINT */ | ||
713 | #define WM8400_LDO4_UV_EINT 0x0008 /* LDO4_UV_EINT */ | ||
714 | #define WM8400_LDO4_UV_EINT_MASK 0x0008 /* LDO4_UV_EINT */ | ||
715 | #define WM8400_LDO4_UV_EINT_SHIFT 3 /* LDO4_UV_EINT */ | ||
716 | #define WM8400_LDO4_UV_EINT_WIDTH 1 /* LDO4_UV_EINT */ | ||
717 | #define WM8400_LDO3_UV_EINT 0x0004 /* LDO3_UV_EINT */ | ||
718 | #define WM8400_LDO3_UV_EINT_MASK 0x0004 /* LDO3_UV_EINT */ | ||
719 | #define WM8400_LDO3_UV_EINT_SHIFT 2 /* LDO3_UV_EINT */ | ||
720 | #define WM8400_LDO3_UV_EINT_WIDTH 1 /* LDO3_UV_EINT */ | ||
721 | #define WM8400_LDO2_UV_EINT 0x0002 /* LDO2_UV_EINT */ | ||
722 | #define WM8400_LDO2_UV_EINT_MASK 0x0002 /* LDO2_UV_EINT */ | ||
723 | #define WM8400_LDO2_UV_EINT_SHIFT 1 /* LDO2_UV_EINT */ | ||
724 | #define WM8400_LDO2_UV_EINT_WIDTH 1 /* LDO2_UV_EINT */ | ||
725 | #define WM8400_LDO1_UV_EINT 0x0001 /* LDO1_UV_EINT */ | ||
726 | #define WM8400_LDO1_UV_EINT_MASK 0x0001 /* LDO1_UV_EINT */ | ||
727 | #define WM8400_LDO1_UV_EINT_SHIFT 0 /* LDO1_UV_EINT */ | ||
728 | #define WM8400_LDO1_UV_EINT_WIDTH 1 /* LDO1_UV_EINT */ | ||
729 | |||
730 | /* | ||
731 | * R80 (0x50) - Interrupt Status 1 Mask | ||
732 | */ | ||
733 | #define WM8400_IM_MICD_CINT 0x8000 /* IM_MICD_CINT */ | ||
734 | #define WM8400_IM_MICD_CINT_MASK 0x8000 /* IM_MICD_CINT */ | ||
735 | #define WM8400_IM_MICD_CINT_SHIFT 15 /* IM_MICD_CINT */ | ||
736 | #define WM8400_IM_MICD_CINT_WIDTH 1 /* IM_MICD_CINT */ | ||
737 | #define WM8400_IM_MICSCD_CINT 0x4000 /* IM_MICSCD_CINT */ | ||
738 | #define WM8400_IM_MICSCD_CINT_MASK 0x4000 /* IM_MICSCD_CINT */ | ||
739 | #define WM8400_IM_MICSCD_CINT_SHIFT 14 /* IM_MICSCD_CINT */ | ||
740 | #define WM8400_IM_MICSCD_CINT_WIDTH 1 /* IM_MICSCD_CINT */ | ||
741 | #define WM8400_IM_JDL_CINT 0x2000 /* IM_JDL_CINT */ | ||
742 | #define WM8400_IM_JDL_CINT_MASK 0x2000 /* IM_JDL_CINT */ | ||
743 | #define WM8400_IM_JDL_CINT_SHIFT 13 /* IM_JDL_CINT */ | ||
744 | #define WM8400_IM_JDL_CINT_WIDTH 1 /* IM_JDL_CINT */ | ||
745 | #define WM8400_IM_JDR_CINT 0x1000 /* IM_JDR_CINT */ | ||
746 | #define WM8400_IM_JDR_CINT_MASK 0x1000 /* IM_JDR_CINT */ | ||
747 | #define WM8400_IM_JDR_CINT_SHIFT 12 /* IM_JDR_CINT */ | ||
748 | #define WM8400_IM_JDR_CINT_WIDTH 1 /* IM_JDR_CINT */ | ||
749 | #define WM8400_IM_CODEC_SEQ_END_EINT 0x0800 /* IM_CODEC_SEQ_END_EINT */ | ||
750 | #define WM8400_IM_CODEC_SEQ_END_EINT_MASK 0x0800 /* IM_CODEC_SEQ_END_EINT */ | ||
751 | #define WM8400_IM_CODEC_SEQ_END_EINT_SHIFT 11 /* IM_CODEC_SEQ_END_EINT */ | ||
752 | #define WM8400_IM_CODEC_SEQ_END_EINT_WIDTH 1 /* IM_CODEC_SEQ_END_EINT */ | ||
753 | #define WM8400_IM_CDEL_TO_EINT 0x0400 /* IM_CDEL_TO_EINT */ | ||
754 | #define WM8400_IM_CDEL_TO_EINT_MASK 0x0400 /* IM_CDEL_TO_EINT */ | ||
755 | #define WM8400_IM_CDEL_TO_EINT_SHIFT 10 /* IM_CDEL_TO_EINT */ | ||
756 | #define WM8400_IM_CDEL_TO_EINT_WIDTH 1 /* IM_CDEL_TO_EINT */ | ||
757 | #define WM8400_IM_CHIP_GT150_EINT 0x0200 /* IM_CHIP_GT150_EINT */ | ||
758 | #define WM8400_IM_CHIP_GT150_EINT_MASK 0x0200 /* IM_CHIP_GT150_EINT */ | ||
759 | #define WM8400_IM_CHIP_GT150_EINT_SHIFT 9 /* IM_CHIP_GT150_EINT */ | ||
760 | #define WM8400_IM_CHIP_GT150_EINT_WIDTH 1 /* IM_CHIP_GT150_EINT */ | ||
761 | #define WM8400_IM_CHIP_GT115_EINT 0x0100 /* IM_CHIP_GT115_EINT */ | ||
762 | #define WM8400_IM_CHIP_GT115_EINT_MASK 0x0100 /* IM_CHIP_GT115_EINT */ | ||
763 | #define WM8400_IM_CHIP_GT115_EINT_SHIFT 8 /* IM_CHIP_GT115_EINT */ | ||
764 | #define WM8400_IM_CHIP_GT115_EINT_WIDTH 1 /* IM_CHIP_GT115_EINT */ | ||
765 | #define WM8400_IM_LINE_CMP_EINT 0x0080 /* IM_LINE_CMP_EINT */ | ||
766 | #define WM8400_IM_LINE_CMP_EINT_MASK 0x0080 /* IM_LINE_CMP_EINT */ | ||
767 | #define WM8400_IM_LINE_CMP_EINT_SHIFT 7 /* IM_LINE_CMP_EINT */ | ||
768 | #define WM8400_IM_LINE_CMP_EINT_WIDTH 1 /* IM_LINE_CMP_EINT */ | ||
769 | #define WM8400_IM_UVLO_EINT 0x0040 /* IM_UVLO_EINT */ | ||
770 | #define WM8400_IM_UVLO_EINT_MASK 0x0040 /* IM_UVLO_EINT */ | ||
771 | #define WM8400_IM_UVLO_EINT_SHIFT 6 /* IM_UVLO_EINT */ | ||
772 | #define WM8400_IM_UVLO_EINT_WIDTH 1 /* IM_UVLO_EINT */ | ||
773 | #define WM8400_IM_DC2_UV_EINT 0x0020 /* IM_DC2_UV_EINT */ | ||
774 | #define WM8400_IM_DC2_UV_EINT_MASK 0x0020 /* IM_DC2_UV_EINT */ | ||
775 | #define WM8400_IM_DC2_UV_EINT_SHIFT 5 /* IM_DC2_UV_EINT */ | ||
776 | #define WM8400_IM_DC2_UV_EINT_WIDTH 1 /* IM_DC2_UV_EINT */ | ||
777 | #define WM8400_IM_DC1_UV_EINT 0x0010 /* IM_DC1_UV_EINT */ | ||
778 | #define WM8400_IM_DC1_UV_EINT_MASK 0x0010 /* IM_DC1_UV_EINT */ | ||
779 | #define WM8400_IM_DC1_UV_EINT_SHIFT 4 /* IM_DC1_UV_EINT */ | ||
780 | #define WM8400_IM_DC1_UV_EINT_WIDTH 1 /* IM_DC1_UV_EINT */ | ||
781 | #define WM8400_IM_LDO4_UV_EINT 0x0008 /* IM_LDO4_UV_EINT */ | ||
782 | #define WM8400_IM_LDO4_UV_EINT_MASK 0x0008 /* IM_LDO4_UV_EINT */ | ||
783 | #define WM8400_IM_LDO4_UV_EINT_SHIFT 3 /* IM_LDO4_UV_EINT */ | ||
784 | #define WM8400_IM_LDO4_UV_EINT_WIDTH 1 /* IM_LDO4_UV_EINT */ | ||
785 | #define WM8400_IM_LDO3_UV_EINT 0x0004 /* IM_LDO3_UV_EINT */ | ||
786 | #define WM8400_IM_LDO3_UV_EINT_MASK 0x0004 /* IM_LDO3_UV_EINT */ | ||
787 | #define WM8400_IM_LDO3_UV_EINT_SHIFT 2 /* IM_LDO3_UV_EINT */ | ||
788 | #define WM8400_IM_LDO3_UV_EINT_WIDTH 1 /* IM_LDO3_UV_EINT */ | ||
789 | #define WM8400_IM_LDO2_UV_EINT 0x0002 /* IM_LDO2_UV_EINT */ | ||
790 | #define WM8400_IM_LDO2_UV_EINT_MASK 0x0002 /* IM_LDO2_UV_EINT */ | ||
791 | #define WM8400_IM_LDO2_UV_EINT_SHIFT 1 /* IM_LDO2_UV_EINT */ | ||
792 | #define WM8400_IM_LDO2_UV_EINT_WIDTH 1 /* IM_LDO2_UV_EINT */ | ||
793 | #define WM8400_IM_LDO1_UV_EINT 0x0001 /* IM_LDO1_UV_EINT */ | ||
794 | #define WM8400_IM_LDO1_UV_EINT_MASK 0x0001 /* IM_LDO1_UV_EINT */ | ||
795 | #define WM8400_IM_LDO1_UV_EINT_SHIFT 0 /* IM_LDO1_UV_EINT */ | ||
796 | #define WM8400_IM_LDO1_UV_EINT_WIDTH 1 /* IM_LDO1_UV_EINT */ | ||
797 | |||
798 | /* | ||
799 | * R81 (0x51) - Interrupt Levels | ||
800 | */ | ||
801 | #define WM8400_MICD_LVL 0x8000 /* MICD_LVL */ | ||
802 | #define WM8400_MICD_LVL_MASK 0x8000 /* MICD_LVL */ | ||
803 | #define WM8400_MICD_LVL_SHIFT 15 /* MICD_LVL */ | ||
804 | #define WM8400_MICD_LVL_WIDTH 1 /* MICD_LVL */ | ||
805 | #define WM8400_MICSCD_LVL 0x4000 /* MICSCD_LVL */ | ||
806 | #define WM8400_MICSCD_LVL_MASK 0x4000 /* MICSCD_LVL */ | ||
807 | #define WM8400_MICSCD_LVL_SHIFT 14 /* MICSCD_LVL */ | ||
808 | #define WM8400_MICSCD_LVL_WIDTH 1 /* MICSCD_LVL */ | ||
809 | #define WM8400_JDL_LVL 0x2000 /* JDL_LVL */ | ||
810 | #define WM8400_JDL_LVL_MASK 0x2000 /* JDL_LVL */ | ||
811 | #define WM8400_JDL_LVL_SHIFT 13 /* JDL_LVL */ | ||
812 | #define WM8400_JDL_LVL_WIDTH 1 /* JDL_LVL */ | ||
813 | #define WM8400_JDR_LVL 0x1000 /* JDR_LVL */ | ||
814 | #define WM8400_JDR_LVL_MASK 0x1000 /* JDR_LVL */ | ||
815 | #define WM8400_JDR_LVL_SHIFT 12 /* JDR_LVL */ | ||
816 | #define WM8400_JDR_LVL_WIDTH 1 /* JDR_LVL */ | ||
817 | #define WM8400_CODEC_SEQ_END_LVL 0x0800 /* CODEC_SEQ_END_LVL */ | ||
818 | #define WM8400_CODEC_SEQ_END_LVL_MASK 0x0800 /* CODEC_SEQ_END_LVL */ | ||
819 | #define WM8400_CODEC_SEQ_END_LVL_SHIFT 11 /* CODEC_SEQ_END_LVL */ | ||
820 | #define WM8400_CODEC_SEQ_END_LVL_WIDTH 1 /* CODEC_SEQ_END_LVL */ | ||
821 | #define WM8400_CDEL_TO_LVL 0x0400 /* CDEL_TO_LVL */ | ||
822 | #define WM8400_CDEL_TO_LVL_MASK 0x0400 /* CDEL_TO_LVL */ | ||
823 | #define WM8400_CDEL_TO_LVL_SHIFT 10 /* CDEL_TO_LVL */ | ||
824 | #define WM8400_CDEL_TO_LVL_WIDTH 1 /* CDEL_TO_LVL */ | ||
825 | #define WM8400_CHIP_GT150_LVL 0x0200 /* CHIP_GT150_LVL */ | ||
826 | #define WM8400_CHIP_GT150_LVL_MASK 0x0200 /* CHIP_GT150_LVL */ | ||
827 | #define WM8400_CHIP_GT150_LVL_SHIFT 9 /* CHIP_GT150_LVL */ | ||
828 | #define WM8400_CHIP_GT150_LVL_WIDTH 1 /* CHIP_GT150_LVL */ | ||
829 | #define WM8400_CHIP_GT115_LVL 0x0100 /* CHIP_GT115_LVL */ | ||
830 | #define WM8400_CHIP_GT115_LVL_MASK 0x0100 /* CHIP_GT115_LVL */ | ||
831 | #define WM8400_CHIP_GT115_LVL_SHIFT 8 /* CHIP_GT115_LVL */ | ||
832 | #define WM8400_CHIP_GT115_LVL_WIDTH 1 /* CHIP_GT115_LVL */ | ||
833 | #define WM8400_LINE_CMP_LVL 0x0080 /* LINE_CMP_LVL */ | ||
834 | #define WM8400_LINE_CMP_LVL_MASK 0x0080 /* LINE_CMP_LVL */ | ||
835 | #define WM8400_LINE_CMP_LVL_SHIFT 7 /* LINE_CMP_LVL */ | ||
836 | #define WM8400_LINE_CMP_LVL_WIDTH 1 /* LINE_CMP_LVL */ | ||
837 | #define WM8400_UVLO_LVL 0x0040 /* UVLO_LVL */ | ||
838 | #define WM8400_UVLO_LVL_MASK 0x0040 /* UVLO_LVL */ | ||
839 | #define WM8400_UVLO_LVL_SHIFT 6 /* UVLO_LVL */ | ||
840 | #define WM8400_UVLO_LVL_WIDTH 1 /* UVLO_LVL */ | ||
841 | #define WM8400_DC2_UV_LVL 0x0020 /* DC2_UV_LVL */ | ||
842 | #define WM8400_DC2_UV_LVL_MASK 0x0020 /* DC2_UV_LVL */ | ||
843 | #define WM8400_DC2_UV_LVL_SHIFT 5 /* DC2_UV_LVL */ | ||
844 | #define WM8400_DC2_UV_LVL_WIDTH 1 /* DC2_UV_LVL */ | ||
845 | #define WM8400_DC1_UV_LVL 0x0010 /* DC1_UV_LVL */ | ||
846 | #define WM8400_DC1_UV_LVL_MASK 0x0010 /* DC1_UV_LVL */ | ||
847 | #define WM8400_DC1_UV_LVL_SHIFT 4 /* DC1_UV_LVL */ | ||
848 | #define WM8400_DC1_UV_LVL_WIDTH 1 /* DC1_UV_LVL */ | ||
849 | #define WM8400_LDO4_UV_LVL 0x0008 /* LDO4_UV_LVL */ | ||
850 | #define WM8400_LDO4_UV_LVL_MASK 0x0008 /* LDO4_UV_LVL */ | ||
851 | #define WM8400_LDO4_UV_LVL_SHIFT 3 /* LDO4_UV_LVL */ | ||
852 | #define WM8400_LDO4_UV_LVL_WIDTH 1 /* LDO4_UV_LVL */ | ||
853 | #define WM8400_LDO3_UV_LVL 0x0004 /* LDO3_UV_LVL */ | ||
854 | #define WM8400_LDO3_UV_LVL_MASK 0x0004 /* LDO3_UV_LVL */ | ||
855 | #define WM8400_LDO3_UV_LVL_SHIFT 2 /* LDO3_UV_LVL */ | ||
856 | #define WM8400_LDO3_UV_LVL_WIDTH 1 /* LDO3_UV_LVL */ | ||
857 | #define WM8400_LDO2_UV_LVL 0x0002 /* LDO2_UV_LVL */ | ||
858 | #define WM8400_LDO2_UV_LVL_MASK 0x0002 /* LDO2_UV_LVL */ | ||
859 | #define WM8400_LDO2_UV_LVL_SHIFT 1 /* LDO2_UV_LVL */ | ||
860 | #define WM8400_LDO2_UV_LVL_WIDTH 1 /* LDO2_UV_LVL */ | ||
861 | #define WM8400_LDO1_UV_LVL 0x0001 /* LDO1_UV_LVL */ | ||
862 | #define WM8400_LDO1_UV_LVL_MASK 0x0001 /* LDO1_UV_LVL */ | ||
863 | #define WM8400_LDO1_UV_LVL_SHIFT 0 /* LDO1_UV_LVL */ | ||
864 | #define WM8400_LDO1_UV_LVL_WIDTH 1 /* LDO1_UV_LVL */ | ||
865 | |||
866 | /* | ||
867 | * R82 (0x52) - Shutdown Reason | ||
868 | */ | ||
869 | #define WM8400_SDR_CHIP_SOFTSD 0x2000 /* SDR_CHIP_SOFTSD */ | ||
870 | #define WM8400_SDR_CHIP_SOFTSD_MASK 0x2000 /* SDR_CHIP_SOFTSD */ | ||
871 | #define WM8400_SDR_CHIP_SOFTSD_SHIFT 13 /* SDR_CHIP_SOFTSD */ | ||
872 | #define WM8400_SDR_CHIP_SOFTSD_WIDTH 1 /* SDR_CHIP_SOFTSD */ | ||
873 | #define WM8400_SDR_NPDN 0x0800 /* SDR_NPDN */ | ||
874 | #define WM8400_SDR_NPDN_MASK 0x0800 /* SDR_NPDN */ | ||
875 | #define WM8400_SDR_NPDN_SHIFT 11 /* SDR_NPDN */ | ||
876 | #define WM8400_SDR_NPDN_WIDTH 1 /* SDR_NPDN */ | ||
877 | #define WM8400_SDR_CHIP_GT150 0x0200 /* SDR_CHIP_GT150 */ | ||
878 | #define WM8400_SDR_CHIP_GT150_MASK 0x0200 /* SDR_CHIP_GT150 */ | ||
879 | #define WM8400_SDR_CHIP_GT150_SHIFT 9 /* SDR_CHIP_GT150 */ | ||
880 | #define WM8400_SDR_CHIP_GT150_WIDTH 1 /* SDR_CHIP_GT150 */ | ||
881 | #define WM8400_SDR_CHIP_GT115 0x0100 /* SDR_CHIP_GT115 */ | ||
882 | #define WM8400_SDR_CHIP_GT115_MASK 0x0100 /* SDR_CHIP_GT115 */ | ||
883 | #define WM8400_SDR_CHIP_GT115_SHIFT 8 /* SDR_CHIP_GT115 */ | ||
884 | #define WM8400_SDR_CHIP_GT115_WIDTH 1 /* SDR_CHIP_GT115 */ | ||
885 | #define WM8400_SDR_LINE_CMP 0x0080 /* SDR_LINE_CMP */ | ||
886 | #define WM8400_SDR_LINE_CMP_MASK 0x0080 /* SDR_LINE_CMP */ | ||
887 | #define WM8400_SDR_LINE_CMP_SHIFT 7 /* SDR_LINE_CMP */ | ||
888 | #define WM8400_SDR_LINE_CMP_WIDTH 1 /* SDR_LINE_CMP */ | ||
889 | #define WM8400_SDR_UVLO 0x0040 /* SDR_UVLO */ | ||
890 | #define WM8400_SDR_UVLO_MASK 0x0040 /* SDR_UVLO */ | ||
891 | #define WM8400_SDR_UVLO_SHIFT 6 /* SDR_UVLO */ | ||
892 | #define WM8400_SDR_UVLO_WIDTH 1 /* SDR_UVLO */ | ||
893 | #define WM8400_SDR_DC2_UV 0x0020 /* SDR_DC2_UV */ | ||
894 | #define WM8400_SDR_DC2_UV_MASK 0x0020 /* SDR_DC2_UV */ | ||
895 | #define WM8400_SDR_DC2_UV_SHIFT 5 /* SDR_DC2_UV */ | ||
896 | #define WM8400_SDR_DC2_UV_WIDTH 1 /* SDR_DC2_UV */ | ||
897 | #define WM8400_SDR_DC1_UV 0x0010 /* SDR_DC1_UV */ | ||
898 | #define WM8400_SDR_DC1_UV_MASK 0x0010 /* SDR_DC1_UV */ | ||
899 | #define WM8400_SDR_DC1_UV_SHIFT 4 /* SDR_DC1_UV */ | ||
900 | #define WM8400_SDR_DC1_UV_WIDTH 1 /* SDR_DC1_UV */ | ||
901 | #define WM8400_SDR_LDO4_UV 0x0008 /* SDR_LDO4_UV */ | ||
902 | #define WM8400_SDR_LDO4_UV_MASK 0x0008 /* SDR_LDO4_UV */ | ||
903 | #define WM8400_SDR_LDO4_UV_SHIFT 3 /* SDR_LDO4_UV */ | ||
904 | #define WM8400_SDR_LDO4_UV_WIDTH 1 /* SDR_LDO4_UV */ | ||
905 | #define WM8400_SDR_LDO3_UV 0x0004 /* SDR_LDO3_UV */ | ||
906 | #define WM8400_SDR_LDO3_UV_MASK 0x0004 /* SDR_LDO3_UV */ | ||
907 | #define WM8400_SDR_LDO3_UV_SHIFT 2 /* SDR_LDO3_UV */ | ||
908 | #define WM8400_SDR_LDO3_UV_WIDTH 1 /* SDR_LDO3_UV */ | ||
909 | #define WM8400_SDR_LDO2_UV 0x0002 /* SDR_LDO2_UV */ | ||
910 | #define WM8400_SDR_LDO2_UV_MASK 0x0002 /* SDR_LDO2_UV */ | ||
911 | #define WM8400_SDR_LDO2_UV_SHIFT 1 /* SDR_LDO2_UV */ | ||
912 | #define WM8400_SDR_LDO2_UV_WIDTH 1 /* SDR_LDO2_UV */ | ||
913 | #define WM8400_SDR_LDO1_UV 0x0001 /* SDR_LDO1_UV */ | ||
914 | #define WM8400_SDR_LDO1_UV_MASK 0x0001 /* SDR_LDO1_UV */ | ||
915 | #define WM8400_SDR_LDO1_UV_SHIFT 0 /* SDR_LDO1_UV */ | ||
916 | #define WM8400_SDR_LDO1_UV_WIDTH 1 /* SDR_LDO1_UV */ | ||
917 | |||
918 | /* | ||
919 | * R84 (0x54) - Line Circuits | ||
920 | */ | ||
921 | #define WM8400_BG_LINE_COMP 0x8000 /* BG_LINE_COMP */ | ||
922 | #define WM8400_BG_LINE_COMP_MASK 0x8000 /* BG_LINE_COMP */ | ||
923 | #define WM8400_BG_LINE_COMP_SHIFT 15 /* BG_LINE_COMP */ | ||
924 | #define WM8400_BG_LINE_COMP_WIDTH 1 /* BG_LINE_COMP */ | ||
925 | #define WM8400_LINE_CMP_VTHI_MASK 0x00F0 /* LINE_CMP_VTHI - [7:4] */ | ||
926 | #define WM8400_LINE_CMP_VTHI_SHIFT 4 /* LINE_CMP_VTHI - [7:4] */ | ||
927 | #define WM8400_LINE_CMP_VTHI_WIDTH 4 /* LINE_CMP_VTHI - [7:4] */ | ||
928 | #define WM8400_LINE_CMP_VTHD_MASK 0x000F /* LINE_CMP_VTHD - [3:0] */ | ||
929 | #define WM8400_LINE_CMP_VTHD_SHIFT 0 /* LINE_CMP_VTHD - [3:0] */ | ||
930 | #define WM8400_LINE_CMP_VTHD_WIDTH 4 /* LINE_CMP_VTHD - [3:0] */ | ||
931 | |||
932 | u16 wm8400_reg_read(struct wm8400 *wm8400, u8 reg); | ||
933 | int wm8400_block_read(struct wm8400 *wm8400, u8 reg, int count, u16 *data); | ||
934 | int wm8400_set_bits(struct wm8400 *wm8400, u8 reg, u16 mask, u16 val); | ||
935 | |||
936 | #endif | ||
diff --git a/include/linux/mfd/wm8400.h b/include/linux/mfd/wm8400.h new file mode 100644 index 000000000000..b46b566ac1ac --- /dev/null +++ b/include/linux/mfd/wm8400.h | |||
@@ -0,0 +1,40 @@ | |||
1 | /* | ||
2 | * wm8400 client interface | ||
3 | * | ||
4 | * Copyright 2008 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 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_MFD_WM8400_H | ||
22 | #define __LINUX_MFD_WM8400_H | ||
23 | |||
24 | #include <linux/regulator/machine.h> | ||
25 | |||
26 | #define WM8400_LDO1 0 | ||
27 | #define WM8400_LDO2 1 | ||
28 | #define WM8400_LDO3 2 | ||
29 | #define WM8400_LDO4 3 | ||
30 | #define WM8400_DCDC1 4 | ||
31 | #define WM8400_DCDC2 5 | ||
32 | |||
33 | struct wm8400_platform_data { | ||
34 | int (*platform_init)(struct device *dev); | ||
35 | }; | ||
36 | |||
37 | int wm8400_register_regulator(struct device *dev, int reg, | ||
38 | struct regulator_init_data *initdata); | ||
39 | |||
40 | #endif | ||
diff --git a/include/linux/migrate.h b/include/linux/migrate.h index e10a90a93b5d..03aea612d284 100644 --- a/include/linux/migrate.h +++ b/include/linux/migrate.h | |||
@@ -3,28 +3,10 @@ | |||
3 | 3 | ||
4 | #include <linux/mm.h> | 4 | #include <linux/mm.h> |
5 | #include <linux/mempolicy.h> | 5 | #include <linux/mempolicy.h> |
6 | #include <linux/pagemap.h> | ||
7 | 6 | ||
8 | typedef struct page *new_page_t(struct page *, unsigned long private, int **); | 7 | typedef struct page *new_page_t(struct page *, unsigned long private, int **); |
9 | 8 | ||
10 | #ifdef CONFIG_MIGRATION | 9 | #ifdef CONFIG_MIGRATION |
11 | /* Check if a vma is migratable */ | ||
12 | static inline int vma_migratable(struct vm_area_struct *vma) | ||
13 | { | ||
14 | if (vma->vm_flags & (VM_IO|VM_HUGETLB|VM_PFNMAP|VM_RESERVED)) | ||
15 | return 0; | ||
16 | /* | ||
17 | * Migration allocates pages in the highest zone. If we cannot | ||
18 | * do so then migration (at least from node to node) is not | ||
19 | * possible. | ||
20 | */ | ||
21 | if (vma->vm_file && | ||
22 | gfp_zone(mapping_gfp_mask(vma->vm_file->f_mapping)) | ||
23 | < policy_zone) | ||
24 | return 0; | ||
25 | return 1; | ||
26 | } | ||
27 | |||
28 | extern int isolate_lru_page(struct page *p, struct list_head *pagelist); | 10 | extern int isolate_lru_page(struct page *p, struct list_head *pagelist); |
29 | extern int putback_lru_pages(struct list_head *l); | 11 | extern int putback_lru_pages(struct list_head *l); |
30 | extern int migrate_page(struct address_space *, | 12 | extern int migrate_page(struct address_space *, |
@@ -39,9 +21,6 @@ extern int migrate_vmas(struct mm_struct *mm, | |||
39 | const nodemask_t *from, const nodemask_t *to, | 21 | const nodemask_t *from, const nodemask_t *to, |
40 | unsigned long flags); | 22 | unsigned long flags); |
41 | #else | 23 | #else |
42 | static inline int vma_migratable(struct vm_area_struct *vma) | ||
43 | { return 0; } | ||
44 | |||
45 | static inline int isolate_lru_page(struct page *p, struct list_head *list) | 24 | static inline int isolate_lru_page(struct page *p, struct list_head *list) |
46 | { return -ENOSYS; } | 25 | { return -ENOSYS; } |
47 | static inline int putback_lru_pages(struct list_head *l) { return 0; } | 26 | static inline int putback_lru_pages(struct list_head *l) { return 0; } |
diff --git a/include/linux/mlx4/cq.h b/include/linux/mlx4/cq.h index 071cf96cf01f..6f65b2c8bb89 100644 --- a/include/linux/mlx4/cq.h +++ b/include/linux/mlx4/cq.h | |||
@@ -39,17 +39,18 @@ | |||
39 | #include <linux/mlx4/doorbell.h> | 39 | #include <linux/mlx4/doorbell.h> |
40 | 40 | ||
41 | struct mlx4_cqe { | 41 | struct mlx4_cqe { |
42 | __be32 my_qpn; | 42 | __be32 vlan_my_qpn; |
43 | __be32 immed_rss_invalid; | 43 | __be32 immed_rss_invalid; |
44 | __be32 g_mlpath_rqpn; | 44 | __be32 g_mlpath_rqpn; |
45 | u8 sl; | 45 | __be16 sl_vid; |
46 | u8 reserved1; | ||
47 | __be16 rlid; | 46 | __be16 rlid; |
48 | __be32 ipoib_status; | 47 | __be16 status; |
48 | u8 ipv6_ext_mask; | ||
49 | u8 badfcs_enc; | ||
49 | __be32 byte_cnt; | 50 | __be32 byte_cnt; |
50 | __be16 wqe_index; | 51 | __be16 wqe_index; |
51 | __be16 checksum; | 52 | __be16 checksum; |
52 | u8 reserved2[3]; | 53 | u8 reserved[3]; |
53 | u8 owner_sr_opcode; | 54 | u8 owner_sr_opcode; |
54 | }; | 55 | }; |
55 | 56 | ||
@@ -64,6 +65,11 @@ struct mlx4_err_cqe { | |||
64 | }; | 65 | }; |
65 | 66 | ||
66 | enum { | 67 | enum { |
68 | MLX4_CQE_VLAN_PRESENT_MASK = 1 << 29, | ||
69 | MLX4_CQE_QPN_MASK = 0xffffff, | ||
70 | }; | ||
71 | |||
72 | enum { | ||
67 | MLX4_CQE_OWNER_MASK = 0x80, | 73 | MLX4_CQE_OWNER_MASK = 0x80, |
68 | MLX4_CQE_IS_SEND_MASK = 0x40, | 74 | MLX4_CQE_IS_SEND_MASK = 0x40, |
69 | MLX4_CQE_OPCODE_MASK = 0x1f | 75 | MLX4_CQE_OPCODE_MASK = 0x1f |
@@ -86,13 +92,19 @@ enum { | |||
86 | }; | 92 | }; |
87 | 93 | ||
88 | enum { | 94 | enum { |
89 | MLX4_CQE_IPOIB_STATUS_IPV4 = 1 << 22, | 95 | MLX4_CQE_STATUS_IPV4 = 1 << 6, |
90 | MLX4_CQE_IPOIB_STATUS_IPV4F = 1 << 23, | 96 | MLX4_CQE_STATUS_IPV4F = 1 << 7, |
91 | MLX4_CQE_IPOIB_STATUS_IPV6 = 1 << 24, | 97 | MLX4_CQE_STATUS_IPV6 = 1 << 8, |
92 | MLX4_CQE_IPOIB_STATUS_IPV4OPT = 1 << 25, | 98 | MLX4_CQE_STATUS_IPV4OPT = 1 << 9, |
93 | MLX4_CQE_IPOIB_STATUS_TCP = 1 << 26, | 99 | MLX4_CQE_STATUS_TCP = 1 << 10, |
94 | MLX4_CQE_IPOIB_STATUS_UDP = 1 << 27, | 100 | MLX4_CQE_STATUS_UDP = 1 << 11, |
95 | MLX4_CQE_IPOIB_STATUS_IPOK = 1 << 28, | 101 | MLX4_CQE_STATUS_IPOK = 1 << 12, |
102 | }; | ||
103 | |||
104 | enum { | ||
105 | MLX4_CQE_LLC = 1, | ||
106 | MLX4_CQE_SNAP = 1 << 1, | ||
107 | MLX4_CQE_BAD_FCS = 1 << 4, | ||
96 | }; | 108 | }; |
97 | 109 | ||
98 | static inline void mlx4_cq_arm(struct mlx4_cq *cq, u32 cmd, | 110 | static inline void mlx4_cq_arm(struct mlx4_cq *cq, u32 cmd, |
diff --git a/include/linux/mlx4/device.h b/include/linux/mlx4/device.h index a744383d16e9..b2f944468313 100644 --- a/include/linux/mlx4/device.h +++ b/include/linux/mlx4/device.h | |||
@@ -68,6 +68,14 @@ enum { | |||
68 | MLX4_DEV_CAP_FLAG_UD_MCAST = 1 << 21 | 68 | MLX4_DEV_CAP_FLAG_UD_MCAST = 1 << 21 |
69 | }; | 69 | }; |
70 | 70 | ||
71 | enum { | ||
72 | MLX4_BMME_FLAG_LOCAL_INV = 1 << 6, | ||
73 | MLX4_BMME_FLAG_REMOTE_INV = 1 << 7, | ||
74 | MLX4_BMME_FLAG_TYPE_2_WIN = 1 << 9, | ||
75 | MLX4_BMME_FLAG_RESERVED_LKEY = 1 << 10, | ||
76 | MLX4_BMME_FLAG_FAST_REG_WR = 1 << 11, | ||
77 | }; | ||
78 | |||
71 | enum mlx4_event { | 79 | enum mlx4_event { |
72 | MLX4_EVENT_TYPE_COMP = 0x00, | 80 | MLX4_EVENT_TYPE_COMP = 0x00, |
73 | MLX4_EVENT_TYPE_PATH_MIG = 0x01, | 81 | MLX4_EVENT_TYPE_PATH_MIG = 0x01, |
@@ -133,6 +141,10 @@ enum { | |||
133 | MLX4_STAT_RATE_OFFSET = 5 | 141 | MLX4_STAT_RATE_OFFSET = 5 |
134 | }; | 142 | }; |
135 | 143 | ||
144 | enum { | ||
145 | MLX4_MTT_FLAG_PRESENT = 1 | ||
146 | }; | ||
147 | |||
136 | static inline u64 mlx4_fw_ver(u64 major, u64 minor, u64 subminor) | 148 | static inline u64 mlx4_fw_ver(u64 major, u64 minor, u64 subminor) |
137 | { | 149 | { |
138 | return (major << 32) | (minor << 16) | subminor; | 150 | return (major << 32) | (minor << 16) | subminor; |
@@ -184,6 +196,8 @@ struct mlx4_caps { | |||
184 | u32 max_msg_sz; | 196 | u32 max_msg_sz; |
185 | u32 page_size_cap; | 197 | u32 page_size_cap; |
186 | u32 flags; | 198 | u32 flags; |
199 | u32 bmme_flags; | ||
200 | u32 reserved_lkey; | ||
187 | u16 stat_rate_support; | 201 | u16 stat_rate_support; |
188 | u8 port_width_cap[MLX4_MAX_PORTS + 1]; | 202 | u8 port_width_cap[MLX4_MAX_PORTS + 1]; |
189 | int max_gso_sz; | 203 | int max_gso_sz; |
@@ -398,7 +412,8 @@ int mlx4_srq_query(struct mlx4_dev *dev, struct mlx4_srq *srq, int *limit_waterm | |||
398 | int mlx4_INIT_PORT(struct mlx4_dev *dev, int port); | 412 | int mlx4_INIT_PORT(struct mlx4_dev *dev, int port); |
399 | int mlx4_CLOSE_PORT(struct mlx4_dev *dev, int port); | 413 | int mlx4_CLOSE_PORT(struct mlx4_dev *dev, int port); |
400 | 414 | ||
401 | int mlx4_multicast_attach(struct mlx4_dev *dev, struct mlx4_qp *qp, u8 gid[16]); | 415 | int mlx4_multicast_attach(struct mlx4_dev *dev, struct mlx4_qp *qp, u8 gid[16], |
416 | int block_mcast_loopback); | ||
402 | int mlx4_multicast_detach(struct mlx4_dev *dev, struct mlx4_qp *qp, u8 gid[16]); | 417 | int mlx4_multicast_detach(struct mlx4_dev *dev, struct mlx4_qp *qp, u8 gid[16]); |
403 | 418 | ||
404 | int mlx4_map_phys_fmr(struct mlx4_dev *dev, struct mlx4_fmr *fmr, u64 *page_list, | 419 | int mlx4_map_phys_fmr(struct mlx4_dev *dev, struct mlx4_fmr *fmr, u64 *page_list, |
diff --git a/include/linux/mlx4/qp.h b/include/linux/mlx4/qp.h index 7f128b266faa..bf8f11982dae 100644 --- a/include/linux/mlx4/qp.h +++ b/include/linux/mlx4/qp.h | |||
@@ -164,11 +164,13 @@ enum { | |||
164 | MLX4_WQE_CTRL_SOLICITED = 1 << 1, | 164 | MLX4_WQE_CTRL_SOLICITED = 1 << 1, |
165 | MLX4_WQE_CTRL_IP_CSUM = 1 << 4, | 165 | MLX4_WQE_CTRL_IP_CSUM = 1 << 4, |
166 | MLX4_WQE_CTRL_TCP_UDP_CSUM = 1 << 5, | 166 | MLX4_WQE_CTRL_TCP_UDP_CSUM = 1 << 5, |
167 | MLX4_WQE_CTRL_INS_VLAN = 1 << 6, | ||
167 | }; | 168 | }; |
168 | 169 | ||
169 | struct mlx4_wqe_ctrl_seg { | 170 | struct mlx4_wqe_ctrl_seg { |
170 | __be32 owner_opcode; | 171 | __be32 owner_opcode; |
171 | u8 reserved2[3]; | 172 | __be16 vlan_tag; |
173 | u8 ins_vlan; | ||
172 | u8 fence_size; | 174 | u8 fence_size; |
173 | /* | 175 | /* |
174 | * High 24 bits are SRC remote buffer; low 8 bits are flags: | 176 | * High 24 bits are SRC remote buffer; low 8 bits are flags: |
@@ -219,7 +221,7 @@ struct mlx4_wqe_datagram_seg { | |||
219 | __be32 reservd[2]; | 221 | __be32 reservd[2]; |
220 | }; | 222 | }; |
221 | 223 | ||
222 | struct mlx4_lso_seg { | 224 | struct mlx4_wqe_lso_seg { |
223 | __be32 mss_hdr_size; | 225 | __be32 mss_hdr_size; |
224 | __be32 header[0]; | 226 | __be32 header[0]; |
225 | }; | 227 | }; |
@@ -233,6 +235,14 @@ struct mlx4_wqe_bind_seg { | |||
233 | __be64 length; | 235 | __be64 length; |
234 | }; | 236 | }; |
235 | 237 | ||
238 | enum { | ||
239 | MLX4_WQE_FMR_PERM_LOCAL_READ = 1 << 27, | ||
240 | MLX4_WQE_FMR_PERM_LOCAL_WRITE = 1 << 28, | ||
241 | MLX4_WQE_FMR_PERM_REMOTE_READ = 1 << 29, | ||
242 | MLX4_WQE_FMR_PERM_REMOTE_WRITE = 1 << 30, | ||
243 | MLX4_WQE_FMR_PERM_ATOMIC = 1 << 31 | ||
244 | }; | ||
245 | |||
236 | struct mlx4_wqe_fmr_seg { | 246 | struct mlx4_wqe_fmr_seg { |
237 | __be32 flags; | 247 | __be32 flags; |
238 | __be32 mem_key; | 248 | __be32 mem_key; |
@@ -255,11 +265,11 @@ struct mlx4_wqe_fmr_ext_seg { | |||
255 | }; | 265 | }; |
256 | 266 | ||
257 | struct mlx4_wqe_local_inval_seg { | 267 | struct mlx4_wqe_local_inval_seg { |
258 | u8 flags; | 268 | __be32 flags; |
259 | u8 reserved1[3]; | 269 | u32 reserved1; |
260 | __be32 mem_key; | 270 | __be32 mem_key; |
261 | u8 reserved2[3]; | 271 | u32 reserved2[2]; |
262 | u8 guest_id; | 272 | __be32 guest_id; |
263 | __be64 pa; | 273 | __be64 pa; |
264 | }; | 274 | }; |
265 | 275 | ||
diff --git a/include/linux/mm.h b/include/linux/mm.h index 586a943cab01..c61ba10768ea 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h | |||
@@ -7,6 +7,7 @@ | |||
7 | 7 | ||
8 | #include <linux/gfp.h> | 8 | #include <linux/gfp.h> |
9 | #include <linux/list.h> | 9 | #include <linux/list.h> |
10 | #include <linux/mmdebug.h> | ||
10 | #include <linux/mmzone.h> | 11 | #include <linux/mmzone.h> |
11 | #include <linux/rbtree.h> | 12 | #include <linux/rbtree.h> |
12 | #include <linux/prio_tree.h> | 13 | #include <linux/prio_tree.h> |
@@ -41,6 +42,9 @@ extern unsigned long mmap_min_addr; | |||
41 | 42 | ||
42 | #define nth_page(page,n) pfn_to_page(page_to_pfn((page)) + (n)) | 43 | #define nth_page(page,n) pfn_to_page(page_to_pfn((page)) + (n)) |
43 | 44 | ||
45 | /* to align the pointer to the (next) page boundary */ | ||
46 | #define PAGE_ALIGN(addr) ALIGN(addr, PAGE_SIZE) | ||
47 | |||
44 | /* | 48 | /* |
45 | * Linux kernel virtual memory manager primitives. | 49 | * Linux kernel virtual memory manager primitives. |
46 | * The idea being to have a "virtual" mm in the same way | 50 | * The idea being to have a "virtual" mm in the same way |
@@ -70,7 +74,7 @@ extern unsigned int kobjsize(const void *objp); | |||
70 | #endif | 74 | #endif |
71 | 75 | ||
72 | /* | 76 | /* |
73 | * vm_flags.. | 77 | * vm_flags in vm_area_struct, see mm_types.h. |
74 | */ | 78 | */ |
75 | #define VM_READ 0x00000001 /* currently active flags */ | 79 | #define VM_READ 0x00000001 /* currently active flags */ |
76 | #define VM_WRITE 0x00000002 | 80 | #define VM_WRITE 0x00000002 |
@@ -100,6 +104,7 @@ extern unsigned int kobjsize(const void *objp); | |||
100 | #define VM_DONTEXPAND 0x00040000 /* Cannot expand with mremap() */ | 104 | #define VM_DONTEXPAND 0x00040000 /* Cannot expand with mremap() */ |
101 | #define VM_RESERVED 0x00080000 /* Count as reserved_vm like IO */ | 105 | #define VM_RESERVED 0x00080000 /* Count as reserved_vm like IO */ |
102 | #define VM_ACCOUNT 0x00100000 /* Is a VM accounted object */ | 106 | #define VM_ACCOUNT 0x00100000 /* Is a VM accounted object */ |
107 | #define VM_NORESERVE 0x00200000 /* should the VM suppress accounting */ | ||
103 | #define VM_HUGETLB 0x00400000 /* Huge TLB Page VM */ | 108 | #define VM_HUGETLB 0x00400000 /* Huge TLB Page VM */ |
104 | #define VM_NONLINEAR 0x00800000 /* Is non-linear (remap_file_pages) */ | 109 | #define VM_NONLINEAR 0x00800000 /* Is non-linear (remap_file_pages) */ |
105 | #define VM_MAPPED_COPY 0x01000000 /* T if mapped copy of data (nommu mmap) */ | 110 | #define VM_MAPPED_COPY 0x01000000 /* T if mapped copy of data (nommu mmap) */ |
@@ -108,6 +113,7 @@ extern unsigned int kobjsize(const void *objp); | |||
108 | 113 | ||
109 | #define VM_CAN_NONLINEAR 0x08000000 /* Has ->fault & does nonlinear pages */ | 114 | #define VM_CAN_NONLINEAR 0x08000000 /* Has ->fault & does nonlinear pages */ |
110 | #define VM_MIXEDMAP 0x10000000 /* Can contain "struct page" and pure PFN pages */ | 115 | #define VM_MIXEDMAP 0x10000000 /* Can contain "struct page" and pure PFN pages */ |
116 | #define VM_SAO 0x20000000 /* Strong Access Ordering (powerpc) */ | ||
111 | 117 | ||
112 | #ifndef VM_STACK_DEFAULT_FLAGS /* arch can override this */ | 118 | #ifndef VM_STACK_DEFAULT_FLAGS /* arch can override this */ |
113 | #define VM_STACK_DEFAULT_FLAGS VM_DATA_DEFAULT_FLAGS | 119 | #define VM_STACK_DEFAULT_FLAGS VM_DATA_DEFAULT_FLAGS |
@@ -165,12 +171,16 @@ struct vm_operations_struct { | |||
165 | void (*open)(struct vm_area_struct * area); | 171 | void (*open)(struct vm_area_struct * area); |
166 | void (*close)(struct vm_area_struct * area); | 172 | void (*close)(struct vm_area_struct * area); |
167 | int (*fault)(struct vm_area_struct *vma, struct vm_fault *vmf); | 173 | int (*fault)(struct vm_area_struct *vma, struct vm_fault *vmf); |
168 | unsigned long (*nopfn)(struct vm_area_struct *area, | ||
169 | unsigned long address); | ||
170 | 174 | ||
171 | /* notification that a previously read-only page is about to become | 175 | /* notification that a previously read-only page is about to become |
172 | * writable, if an error is returned it will cause a SIGBUS */ | 176 | * writable, if an error is returned it will cause a SIGBUS */ |
173 | int (*page_mkwrite)(struct vm_area_struct *vma, struct page *page); | 177 | int (*page_mkwrite)(struct vm_area_struct *vma, struct page *page); |
178 | |||
179 | /* called by access_process_vm when get_user_pages() fails, typically | ||
180 | * for use by special VMAs that can switch between memory and hardware | ||
181 | */ | ||
182 | int (*access)(struct vm_area_struct *vma, unsigned long addr, | ||
183 | void *buf, int len, int write); | ||
174 | #ifdef CONFIG_NUMA | 184 | #ifdef CONFIG_NUMA |
175 | /* | 185 | /* |
176 | * set_policy() op must add a reference to any non-NULL @new mempolicy | 186 | * set_policy() op must add a reference to any non-NULL @new mempolicy |
@@ -210,12 +220,6 @@ struct inode; | |||
210 | */ | 220 | */ |
211 | #include <linux/page-flags.h> | 221 | #include <linux/page-flags.h> |
212 | 222 | ||
213 | #ifdef CONFIG_DEBUG_VM | ||
214 | #define VM_BUG_ON(cond) BUG_ON(cond) | ||
215 | #else | ||
216 | #define VM_BUG_ON(condition) do { } while(0) | ||
217 | #endif | ||
218 | |||
219 | /* | 223 | /* |
220 | * Methods to modify the page usage count. | 224 | * Methods to modify the page usage count. |
221 | * | 225 | * |
@@ -674,13 +678,6 @@ static inline int page_mapped(struct page *page) | |||
674 | } | 678 | } |
675 | 679 | ||
676 | /* | 680 | /* |
677 | * Error return values for the *_nopfn functions | ||
678 | */ | ||
679 | #define NOPFN_SIGBUS ((unsigned long) -1) | ||
680 | #define NOPFN_OOM ((unsigned long) -2) | ||
681 | #define NOPFN_REFAULT ((unsigned long) -3) | ||
682 | |||
683 | /* | ||
684 | * Different kinds of faults, as returned by handle_mm_fault(). | 681 | * Different kinds of faults, as returned by handle_mm_fault(). |
685 | * Used to decide whether a process gets delivered SIGBUS or | 682 | * Used to decide whether a process gets delivered SIGBUS or |
686 | * just gets major/minor fault counters bumped up. | 683 | * just gets major/minor fault counters bumped up. |
@@ -742,6 +739,8 @@ struct zap_details { | |||
742 | struct page *vm_normal_page(struct vm_area_struct *vma, unsigned long addr, | 739 | struct page *vm_normal_page(struct vm_area_struct *vma, unsigned long addr, |
743 | pte_t pte); | 740 | pte_t pte); |
744 | 741 | ||
742 | int zap_vma_ptes(struct vm_area_struct *vma, unsigned long address, | ||
743 | unsigned long size); | ||
745 | unsigned long zap_page_range(struct vm_area_struct *vma, unsigned long address, | 744 | unsigned long zap_page_range(struct vm_area_struct *vma, unsigned long address, |
746 | unsigned long size, struct zap_details *); | 745 | unsigned long size, struct zap_details *); |
747 | unsigned long unmap_vmas(struct mmu_gather **tlb, | 746 | unsigned long unmap_vmas(struct mmu_gather **tlb, |
@@ -771,14 +770,14 @@ struct mm_walk { | |||
771 | 770 | ||
772 | int walk_page_range(unsigned long addr, unsigned long end, | 771 | int walk_page_range(unsigned long addr, unsigned long end, |
773 | struct mm_walk *walk); | 772 | struct mm_walk *walk); |
774 | void free_pgd_range(struct mmu_gather **tlb, unsigned long addr, | 773 | void free_pgd_range(struct mmu_gather *tlb, unsigned long addr, |
775 | unsigned long end, unsigned long floor, unsigned long ceiling); | 774 | unsigned long end, unsigned long floor, unsigned long ceiling); |
776 | void free_pgtables(struct mmu_gather **tlb, struct vm_area_struct *start_vma, | ||
777 | unsigned long floor, unsigned long ceiling); | ||
778 | int copy_page_range(struct mm_struct *dst, struct mm_struct *src, | 775 | int copy_page_range(struct mm_struct *dst, struct mm_struct *src, |
779 | struct vm_area_struct *vma); | 776 | struct vm_area_struct *vma); |
780 | void unmap_mapping_range(struct address_space *mapping, | 777 | void unmap_mapping_range(struct address_space *mapping, |
781 | loff_t const holebegin, loff_t const holelen, int even_cows); | 778 | loff_t const holebegin, loff_t const holelen, int even_cows); |
779 | int generic_access_phys(struct vm_area_struct *vma, unsigned long addr, | ||
780 | void *buf, int len, int write); | ||
782 | 781 | ||
783 | static inline void unmap_shared_mapping_range(struct address_space *mapping, | 782 | static inline void unmap_shared_mapping_range(struct address_space *mapping, |
784 | loff_t const holebegin, loff_t const holelen) | 783 | loff_t const holebegin, loff_t const holelen) |
@@ -808,7 +807,6 @@ extern int access_process_vm(struct task_struct *tsk, unsigned long addr, void * | |||
808 | 807 | ||
809 | int get_user_pages(struct task_struct *tsk, struct mm_struct *mm, unsigned long start, | 808 | int get_user_pages(struct task_struct *tsk, struct mm_struct *mm, unsigned long start, |
810 | int len, int write, int force, struct page **pages, struct vm_area_struct **vmas); | 809 | int len, int write, int force, struct page **pages, struct vm_area_struct **vmas); |
811 | void print_bad_pte(struct vm_area_struct *, pte_t, unsigned long); | ||
812 | 810 | ||
813 | extern int try_to_release_page(struct page * page, gfp_t gfp_mask); | 811 | extern int try_to_release_page(struct page * page, gfp_t gfp_mask); |
814 | extern void do_invalidatepage(struct page *page, unsigned long offset); | 812 | extern void do_invalidatepage(struct page *page, unsigned long offset); |
@@ -832,6 +830,19 @@ extern int mprotect_fixup(struct vm_area_struct *vma, | |||
832 | unsigned long end, unsigned long newflags); | 830 | unsigned long end, unsigned long newflags); |
833 | 831 | ||
834 | /* | 832 | /* |
833 | * get_user_pages_fast provides equivalent functionality to get_user_pages, | ||
834 | * operating on current and current->mm (force=0 and doesn't return any vmas). | ||
835 | * | ||
836 | * get_user_pages_fast may take mmap_sem and page tables, so no assumptions | ||
837 | * can be made about locking. get_user_pages_fast is to be implemented in a | ||
838 | * way that is advantageous (vs get_user_pages()) when the user memory area is | ||
839 | * already faulted in and present in ptes. However if the pages have to be | ||
840 | * faulted in, it may turn out to be slightly slower). | ||
841 | */ | ||
842 | int get_user_pages_fast(unsigned long start, int nr_pages, int write, | ||
843 | struct page **pages); | ||
844 | |||
845 | /* | ||
835 | * A callback you can register to apply pressure to ageable caches. | 846 | * A callback you can register to apply pressure to ageable caches. |
836 | * | 847 | * |
837 | * 'shrink' is passed a count 'nr_to_scan' and a 'gfpmask'. It should | 848 | * 'shrink' is passed a count 'nr_to_scan' and a 'gfpmask'. It should |
@@ -903,7 +914,7 @@ static inline pmd_t *pmd_alloc(struct mm_struct *mm, pud_t *pud, unsigned long a | |||
903 | } | 914 | } |
904 | #endif /* CONFIG_MMU && !__ARCH_HAS_4LEVEL_HACK */ | 915 | #endif /* CONFIG_MMU && !__ARCH_HAS_4LEVEL_HACK */ |
905 | 916 | ||
906 | #if NR_CPUS >= CONFIG_SPLIT_PTLOCK_CPUS | 917 | #if USE_SPLIT_PTLOCKS |
907 | /* | 918 | /* |
908 | * We tuck a spinlock to guard each pagetable page into its struct page, | 919 | * We tuck a spinlock to guard each pagetable page into its struct page, |
909 | * at page->private, with BUILD_BUG_ON to make sure that this will not | 920 | * at page->private, with BUILD_BUG_ON to make sure that this will not |
@@ -916,14 +927,14 @@ static inline pmd_t *pmd_alloc(struct mm_struct *mm, pud_t *pud, unsigned long a | |||
916 | } while (0) | 927 | } while (0) |
917 | #define pte_lock_deinit(page) ((page)->mapping = NULL) | 928 | #define pte_lock_deinit(page) ((page)->mapping = NULL) |
918 | #define pte_lockptr(mm, pmd) ({(void)(mm); __pte_lockptr(pmd_page(*(pmd)));}) | 929 | #define pte_lockptr(mm, pmd) ({(void)(mm); __pte_lockptr(pmd_page(*(pmd)));}) |
919 | #else | 930 | #else /* !USE_SPLIT_PTLOCKS */ |
920 | /* | 931 | /* |
921 | * We use mm->page_table_lock to guard all pagetable pages of the mm. | 932 | * We use mm->page_table_lock to guard all pagetable pages of the mm. |
922 | */ | 933 | */ |
923 | #define pte_lock_init(page) do {} while (0) | 934 | #define pte_lock_init(page) do {} while (0) |
924 | #define pte_lock_deinit(page) do {} while (0) | 935 | #define pte_lock_deinit(page) do {} while (0) |
925 | #define pte_lockptr(mm, pmd) ({(void)(pmd); &(mm)->page_table_lock;}) | 936 | #define pte_lockptr(mm, pmd) ({(void)(pmd); &(mm)->page_table_lock;}) |
926 | #endif /* NR_CPUS < CONFIG_SPLIT_PTLOCK_CPUS */ | 937 | #endif /* USE_SPLIT_PTLOCKS */ |
927 | 938 | ||
928 | static inline void pgtable_page_ctor(struct page *page) | 939 | static inline void pgtable_page_ctor(struct page *page) |
929 | { | 940 | { |
@@ -964,9 +975,8 @@ static inline void pgtable_page_dtor(struct page *page) | |||
964 | NULL: pte_offset_kernel(pmd, address)) | 975 | NULL: pte_offset_kernel(pmd, address)) |
965 | 976 | ||
966 | extern void free_area_init(unsigned long * zones_size); | 977 | extern void free_area_init(unsigned long * zones_size); |
967 | extern void free_area_init_node(int nid, pg_data_t *pgdat, | 978 | extern void free_area_init_node(int nid, unsigned long * zones_size, |
968 | unsigned long * zones_size, unsigned long zone_start_pfn, | 979 | unsigned long zone_start_pfn, unsigned long *zholes_size); |
969 | unsigned long *zholes_size); | ||
970 | #ifdef CONFIG_ARCH_POPULATES_NODE_MAP | 980 | #ifdef CONFIG_ARCH_POPULATES_NODE_MAP |
971 | /* | 981 | /* |
972 | * With CONFIG_ARCH_POPULATES_NODE_MAP set, an architecture may initialise its | 982 | * With CONFIG_ARCH_POPULATES_NODE_MAP set, an architecture may initialise its |
@@ -998,8 +1008,8 @@ extern void free_area_init_node(int nid, pg_data_t *pgdat, | |||
998 | extern void free_area_init_nodes(unsigned long *max_zone_pfn); | 1008 | extern void free_area_init_nodes(unsigned long *max_zone_pfn); |
999 | extern void add_active_range(unsigned int nid, unsigned long start_pfn, | 1009 | extern void add_active_range(unsigned int nid, unsigned long start_pfn, |
1000 | unsigned long end_pfn); | 1010 | unsigned long end_pfn); |
1001 | extern void shrink_active_range(unsigned int nid, unsigned long old_end_pfn, | 1011 | extern void remove_active_range(unsigned int nid, unsigned long start_pfn, |
1002 | unsigned long new_end_pfn); | 1012 | unsigned long end_pfn); |
1003 | extern void push_node_boundaries(unsigned int nid, unsigned long start_pfn, | 1013 | extern void push_node_boundaries(unsigned int nid, unsigned long start_pfn, |
1004 | unsigned long end_pfn); | 1014 | unsigned long end_pfn); |
1005 | extern void remove_all_active_ranges(void); | 1015 | extern void remove_all_active_ranges(void); |
@@ -1008,9 +1018,10 @@ extern unsigned long absent_pages_in_range(unsigned long start_pfn, | |||
1008 | extern void get_pfn_range_for_nid(unsigned int nid, | 1018 | extern void get_pfn_range_for_nid(unsigned int nid, |
1009 | unsigned long *start_pfn, unsigned long *end_pfn); | 1019 | unsigned long *start_pfn, unsigned long *end_pfn); |
1010 | extern unsigned long find_min_pfn_with_active_regions(void); | 1020 | extern unsigned long find_min_pfn_with_active_regions(void); |
1011 | extern unsigned long find_max_pfn_with_active_regions(void); | ||
1012 | extern void free_bootmem_with_active_regions(int nid, | 1021 | extern void free_bootmem_with_active_regions(int nid, |
1013 | unsigned long max_low_pfn); | 1022 | unsigned long max_low_pfn); |
1023 | typedef int (*work_fn_t)(unsigned long, unsigned long, void *); | ||
1024 | extern void work_with_active_regions(int nid, work_fn_t work_fn, void *data); | ||
1014 | extern void sparse_memory_present_with_active_regions(int nid); | 1025 | extern void sparse_memory_present_with_active_regions(int nid); |
1015 | #ifndef CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID | 1026 | #ifndef CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID |
1016 | extern int early_pfn_to_nid(unsigned long pfn); | 1027 | extern int early_pfn_to_nid(unsigned long pfn); |
@@ -1024,6 +1035,7 @@ extern void mem_init(void); | |||
1024 | extern void show_mem(void); | 1035 | extern void show_mem(void); |
1025 | extern void si_meminfo(struct sysinfo * val); | 1036 | extern void si_meminfo(struct sysinfo * val); |
1026 | extern void si_meminfo_node(struct sysinfo *val, int nid); | 1037 | extern void si_meminfo_node(struct sysinfo *val, int nid); |
1038 | extern int after_bootmem; | ||
1027 | 1039 | ||
1028 | #ifdef CONFIG_NUMA | 1040 | #ifdef CONFIG_NUMA |
1029 | extern void setup_per_cpu_pageset(void); | 1041 | extern void setup_per_cpu_pageset(void); |
@@ -1068,6 +1080,9 @@ extern struct vm_area_struct *copy_vma(struct vm_area_struct **, | |||
1068 | unsigned long addr, unsigned long len, pgoff_t pgoff); | 1080 | unsigned long addr, unsigned long len, pgoff_t pgoff); |
1069 | extern void exit_mmap(struct mm_struct *); | 1081 | extern void exit_mmap(struct mm_struct *); |
1070 | 1082 | ||
1083 | extern int mm_take_all_locks(struct mm_struct *mm); | ||
1084 | extern void mm_drop_all_locks(struct mm_struct *mm); | ||
1085 | |||
1071 | #ifdef CONFIG_PROC_FS | 1086 | #ifdef CONFIG_PROC_FS |
1072 | /* From fs/proc/base.c. callers must _not_ hold the mm's exe_file_lock */ | 1087 | /* From fs/proc/base.c. callers must _not_ hold the mm's exe_file_lock */ |
1073 | extern void added_exe_file_vma(struct mm_struct *mm); | 1088 | extern void added_exe_file_vma(struct mm_struct *mm); |
diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h index 02a27ae78539..9d49fa36bbef 100644 --- a/include/linux/mm_types.h +++ b/include/linux/mm_types.h | |||
@@ -10,6 +10,7 @@ | |||
10 | #include <linux/rbtree.h> | 10 | #include <linux/rbtree.h> |
11 | #include <linux/rwsem.h> | 11 | #include <linux/rwsem.h> |
12 | #include <linux/completion.h> | 12 | #include <linux/completion.h> |
13 | #include <linux/cpumask.h> | ||
13 | #include <asm/page.h> | 14 | #include <asm/page.h> |
14 | #include <asm/mmu.h> | 15 | #include <asm/mmu.h> |
15 | 16 | ||
@@ -20,11 +21,13 @@ | |||
20 | 21 | ||
21 | struct address_space; | 22 | struct address_space; |
22 | 23 | ||
23 | #if NR_CPUS >= CONFIG_SPLIT_PTLOCK_CPUS | 24 | #define USE_SPLIT_PTLOCKS (NR_CPUS >= CONFIG_SPLIT_PTLOCK_CPUS) |
25 | |||
26 | #if USE_SPLIT_PTLOCKS | ||
24 | typedef atomic_long_t mm_counter_t; | 27 | typedef atomic_long_t mm_counter_t; |
25 | #else /* NR_CPUS < CONFIG_SPLIT_PTLOCK_CPUS */ | 28 | #else /* !USE_SPLIT_PTLOCKS */ |
26 | typedef unsigned long mm_counter_t; | 29 | typedef unsigned long mm_counter_t; |
27 | #endif /* NR_CPUS < CONFIG_SPLIT_PTLOCK_CPUS */ | 30 | #endif /* !USE_SPLIT_PTLOCKS */ |
28 | 31 | ||
29 | /* | 32 | /* |
30 | * Each physical page in the system has a struct page associated with | 33 | * Each physical page in the system has a struct page associated with |
@@ -64,7 +67,7 @@ struct page { | |||
64 | * see PAGE_MAPPING_ANON below. | 67 | * see PAGE_MAPPING_ANON below. |
65 | */ | 68 | */ |
66 | }; | 69 | }; |
67 | #if NR_CPUS >= CONFIG_SPLIT_PTLOCK_CPUS | 70 | #if USE_SPLIT_PTLOCKS |
68 | spinlock_t ptl; | 71 | spinlock_t ptl; |
69 | #endif | 72 | #endif |
70 | struct kmem_cache *slab; /* SLUB: Pointer to slab */ | 73 | struct kmem_cache *slab; /* SLUB: Pointer to slab */ |
@@ -112,7 +115,7 @@ struct vm_area_struct { | |||
112 | struct vm_area_struct *vm_next; | 115 | struct vm_area_struct *vm_next; |
113 | 116 | ||
114 | pgprot_t vm_page_prot; /* Access permissions of this VMA. */ | 117 | pgprot_t vm_page_prot; /* Access permissions of this VMA. */ |
115 | unsigned long vm_flags; /* Flags, listed below. */ | 118 | unsigned long vm_flags; /* Flags, see mm.h. */ |
116 | 119 | ||
117 | struct rb_node vm_rb; | 120 | struct rb_node vm_rb; |
118 | 121 | ||
@@ -159,6 +162,17 @@ struct vm_area_struct { | |||
159 | #endif | 162 | #endif |
160 | }; | 163 | }; |
161 | 164 | ||
165 | struct core_thread { | ||
166 | struct task_struct *task; | ||
167 | struct core_thread *next; | ||
168 | }; | ||
169 | |||
170 | struct core_state { | ||
171 | atomic_t nr_threads; | ||
172 | struct core_thread dumper; | ||
173 | struct completion startup; | ||
174 | }; | ||
175 | |||
162 | struct mm_struct { | 176 | struct mm_struct { |
163 | struct vm_area_struct * mmap; /* list of VMAs */ | 177 | struct vm_area_struct * mmap; /* list of VMAs */ |
164 | struct rb_root mm_rb; | 178 | struct rb_root mm_rb; |
@@ -175,7 +189,6 @@ struct mm_struct { | |||
175 | atomic_t mm_users; /* How many users with user space? */ | 189 | atomic_t mm_users; /* How many users with user space? */ |
176 | atomic_t mm_count; /* How many references to "struct mm_struct" (users count as 1) */ | 190 | atomic_t mm_count; /* How many references to "struct mm_struct" (users count as 1) */ |
177 | int map_count; /* number of VMAs */ | 191 | int map_count; /* number of VMAs */ |
178 | int core_waiters; | ||
179 | struct rw_semaphore mmap_sem; | 192 | struct rw_semaphore mmap_sem; |
180 | spinlock_t page_table_lock; /* Protects page tables and some counters */ | 193 | spinlock_t page_table_lock; /* Protects page tables and some counters */ |
181 | 194 | ||
@@ -219,8 +232,7 @@ struct mm_struct { | |||
219 | 232 | ||
220 | unsigned long flags; /* Must use atomic bitops to access the bits */ | 233 | unsigned long flags; /* Must use atomic bitops to access the bits */ |
221 | 234 | ||
222 | /* coredumping support */ | 235 | struct core_state *core_state; /* coredumping support */ |
223 | struct completion *core_startup_done, core_done; | ||
224 | 236 | ||
225 | /* aio bits */ | 237 | /* aio bits */ |
226 | rwlock_t ioctx_list_lock; /* aio lock */ | 238 | rwlock_t ioctx_list_lock; /* aio lock */ |
@@ -244,6 +256,9 @@ struct mm_struct { | |||
244 | struct file *exe_file; | 256 | struct file *exe_file; |
245 | unsigned long num_exe_file_vmas; | 257 | unsigned long num_exe_file_vmas; |
246 | #endif | 258 | #endif |
259 | #ifdef CONFIG_MMU_NOTIFIER | ||
260 | struct mmu_notifier_mm *mmu_notifier_mm; | ||
261 | #endif | ||
247 | }; | 262 | }; |
248 | 263 | ||
249 | #endif /* _LINUX_MM_TYPES_H */ | 264 | #endif /* _LINUX_MM_TYPES_H */ |
diff --git a/include/linux/mman.h b/include/linux/mman.h index dab8892e6ff1..30d1073bac3b 100644 --- a/include/linux/mman.h +++ b/include/linux/mman.h | |||
@@ -34,6 +34,32 @@ static inline void vm_unacct_memory(long pages) | |||
34 | } | 34 | } |
35 | 35 | ||
36 | /* | 36 | /* |
37 | * Allow architectures to handle additional protection bits | ||
38 | */ | ||
39 | |||
40 | #ifndef arch_calc_vm_prot_bits | ||
41 | #define arch_calc_vm_prot_bits(prot) 0 | ||
42 | #endif | ||
43 | |||
44 | #ifndef arch_vm_get_page_prot | ||
45 | #define arch_vm_get_page_prot(vm_flags) __pgprot(0) | ||
46 | #endif | ||
47 | |||
48 | #ifndef arch_validate_prot | ||
49 | /* | ||
50 | * This is called from mprotect(). PROT_GROWSDOWN and PROT_GROWSUP have | ||
51 | * already been masked out. | ||
52 | * | ||
53 | * Returns true if the prot flags are valid | ||
54 | */ | ||
55 | static inline int arch_validate_prot(unsigned long prot) | ||
56 | { | ||
57 | return (prot & ~(PROT_READ | PROT_WRITE | PROT_EXEC | PROT_SEM)) == 0; | ||
58 | } | ||
59 | #define arch_validate_prot arch_validate_prot | ||
60 | #endif | ||
61 | |||
62 | /* | ||
37 | * Optimisation macro. It is equivalent to: | 63 | * Optimisation macro. It is equivalent to: |
38 | * (x & bit1) ? bit2 : 0 | 64 | * (x & bit1) ? bit2 : 0 |
39 | * but this version is faster. | 65 | * but this version is faster. |
@@ -51,7 +77,8 @@ calc_vm_prot_bits(unsigned long prot) | |||
51 | { | 77 | { |
52 | return _calc_vm_trans(prot, PROT_READ, VM_READ ) | | 78 | return _calc_vm_trans(prot, PROT_READ, VM_READ ) | |
53 | _calc_vm_trans(prot, PROT_WRITE, VM_WRITE) | | 79 | _calc_vm_trans(prot, PROT_WRITE, VM_WRITE) | |
54 | _calc_vm_trans(prot, PROT_EXEC, VM_EXEC ); | 80 | _calc_vm_trans(prot, PROT_EXEC, VM_EXEC) | |
81 | arch_calc_vm_prot_bits(prot); | ||
55 | } | 82 | } |
56 | 83 | ||
57 | /* | 84 | /* |
diff --git a/include/linux/mmc/card.h b/include/linux/mmc/card.h index 0d508ac17d64..ee6e822d5994 100644 --- a/include/linux/mmc/card.h +++ b/include/linux/mmc/card.h | |||
@@ -111,6 +111,8 @@ struct mmc_card { | |||
111 | unsigned num_info; /* number of info strings */ | 111 | unsigned num_info; /* number of info strings */ |
112 | const char **info; /* info strings */ | 112 | const char **info; /* info strings */ |
113 | struct sdio_func_tuple *tuples; /* unknown common tuples */ | 113 | struct sdio_func_tuple *tuples; /* unknown common tuples */ |
114 | |||
115 | struct dentry *debugfs_root; | ||
114 | }; | 116 | }; |
115 | 117 | ||
116 | #define mmc_card_mmc(c) ((c)->type == MMC_TYPE_MMC) | 118 | #define mmc_card_mmc(c) ((c)->type == MMC_TYPE_MMC) |
diff --git a/include/linux/mmc/core.h b/include/linux/mmc/core.h index d0c3abed74c2..143cebf0586f 100644 --- a/include/linux/mmc/core.h +++ b/include/linux/mmc/core.h | |||
@@ -135,6 +135,7 @@ extern int mmc_wait_for_app_cmd(struct mmc_host *, struct mmc_card *, | |||
135 | struct mmc_command *, int); | 135 | struct mmc_command *, int); |
136 | 136 | ||
137 | extern void mmc_set_data_timeout(struct mmc_data *, const struct mmc_card *); | 137 | extern void mmc_set_data_timeout(struct mmc_data *, const struct mmc_card *); |
138 | extern unsigned int mmc_align_data_size(struct mmc_card *, unsigned int); | ||
138 | 139 | ||
139 | extern int __mmc_claim_host(struct mmc_host *host, atomic_t *abort); | 140 | extern int __mmc_claim_host(struct mmc_host *host, atomic_t *abort); |
140 | extern void mmc_release_host(struct mmc_host *host); | 141 | extern void mmc_release_host(struct mmc_host *host); |
diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h index 7ab962fa1d73..bde891f64591 100644 --- a/include/linux/mmc/host.h +++ b/include/linux/mmc/host.h | |||
@@ -51,8 +51,30 @@ struct mmc_ios { | |||
51 | 51 | ||
52 | struct mmc_host_ops { | 52 | struct mmc_host_ops { |
53 | void (*request)(struct mmc_host *host, struct mmc_request *req); | 53 | void (*request)(struct mmc_host *host, struct mmc_request *req); |
54 | /* | ||
55 | * Avoid calling these three functions too often or in a "fast path", | ||
56 | * since underlaying controller might implement them in an expensive | ||
57 | * and/or slow way. | ||
58 | * | ||
59 | * Also note that these functions might sleep, so don't call them | ||
60 | * in the atomic contexts! | ||
61 | * | ||
62 | * Return values for the get_ro callback should be: | ||
63 | * 0 for a read/write card | ||
64 | * 1 for a read-only card | ||
65 | * -ENOSYS when not supported (equal to NULL callback) | ||
66 | * or a negative errno value when something bad happened | ||
67 | * | ||
68 | * Return values for the get_cd callback should be: | ||
69 | * 0 for a absent card | ||
70 | * 1 for a present card | ||
71 | * -ENOSYS when not supported (equal to NULL callback) | ||
72 | * or a negative errno value when something bad happened | ||
73 | */ | ||
54 | void (*set_ios)(struct mmc_host *host, struct mmc_ios *ios); | 74 | void (*set_ios)(struct mmc_host *host, struct mmc_ios *ios); |
55 | int (*get_ro)(struct mmc_host *host); | 75 | int (*get_ro)(struct mmc_host *host); |
76 | int (*get_cd)(struct mmc_host *host); | ||
77 | |||
56 | void (*enable_sdio_irq)(struct mmc_host *host, int enable); | 78 | void (*enable_sdio_irq)(struct mmc_host *host, int enable); |
57 | }; | 79 | }; |
58 | 80 | ||
@@ -89,11 +111,11 @@ struct mmc_host { | |||
89 | unsigned long caps; /* Host capabilities */ | 111 | unsigned long caps; /* Host capabilities */ |
90 | 112 | ||
91 | #define MMC_CAP_4_BIT_DATA (1 << 0) /* Can the host do 4 bit transfers */ | 113 | #define MMC_CAP_4_BIT_DATA (1 << 0) /* Can the host do 4 bit transfers */ |
92 | #define MMC_CAP_MULTIWRITE (1 << 1) /* Can accurately report bytes sent to card on error */ | 114 | #define MMC_CAP_MMC_HIGHSPEED (1 << 1) /* Can do MMC high-speed timing */ |
93 | #define MMC_CAP_MMC_HIGHSPEED (1 << 2) /* Can do MMC high-speed timing */ | 115 | #define MMC_CAP_SD_HIGHSPEED (1 << 2) /* Can do SD high-speed timing */ |
94 | #define MMC_CAP_SD_HIGHSPEED (1 << 3) /* Can do SD high-speed timing */ | 116 | #define MMC_CAP_SDIO_IRQ (1 << 3) /* Can signal pending SDIO IRQs */ |
95 | #define MMC_CAP_SDIO_IRQ (1 << 4) /* Can signal pending SDIO IRQs */ | 117 | #define MMC_CAP_SPI (1 << 4) /* Talks only SPI protocols */ |
96 | #define MMC_CAP_SPI (1 << 5) /* Talks only SPI protocols */ | 118 | #define MMC_CAP_NEEDS_POLL (1 << 5) /* Needs polling for card-detection */ |
97 | 119 | ||
98 | /* host specific block data */ | 120 | /* host specific block data */ |
99 | unsigned int max_seg_size; /* see blk_queue_max_segment_size */ | 121 | unsigned int max_seg_size; /* see blk_queue_max_segment_size */ |
@@ -135,6 +157,8 @@ struct mmc_host { | |||
135 | struct led_trigger *led; /* activity led */ | 157 | struct led_trigger *led; /* activity led */ |
136 | #endif | 158 | #endif |
137 | 159 | ||
160 | struct dentry *debugfs_root; | ||
161 | |||
138 | unsigned long private[0] ____cacheline_aligned; | 162 | unsigned long private[0] ____cacheline_aligned; |
139 | }; | 163 | }; |
140 | 164 | ||
diff --git a/include/linux/mmc/mmc.h b/include/linux/mmc/mmc.h index 4236fbf0b6fb..14b81f3e5232 100644 --- a/include/linux/mmc/mmc.h +++ b/include/linux/mmc/mmc.h | |||
@@ -16,7 +16,6 @@ | |||
16 | * Based strongly on code by: | 16 | * Based strongly on code by: |
17 | * | 17 | * |
18 | * Author: Yong-iL Joh <tolkien@mizi.com> | 18 | * Author: Yong-iL Joh <tolkien@mizi.com> |
19 | * Date : $Date: 2002/06/18 12:37:30 $ | ||
20 | * | 19 | * |
21 | * Author: Andrew Christian | 20 | * Author: Andrew Christian |
22 | * 15 May 2002 | 21 | * 15 May 2002 |
diff --git a/include/linux/mmc/sdio_func.h b/include/linux/mmc/sdio_func.h index b050f4d7b41f..07bee4a0d457 100644 --- a/include/linux/mmc/sdio_func.h +++ b/include/linux/mmc/sdio_func.h | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * include/linux/mmc/sdio_func.h | 2 | * include/linux/mmc/sdio_func.h |
3 | * | 3 | * |
4 | * Copyright 2007 Pierre Ossman | 4 | * Copyright 2007-2008 Pierre Ossman |
5 | * | 5 | * |
6 | * This program is free software; you can redistribute it and/or modify | 6 | * This program is free software; you can redistribute it and/or modify |
7 | * it under the terms of the GNU General Public License as published by | 7 | * it under the terms of the GNU General Public License as published by |
@@ -46,6 +46,8 @@ struct sdio_func { | |||
46 | unsigned max_blksize; /* maximum block size */ | 46 | unsigned max_blksize; /* maximum block size */ |
47 | unsigned cur_blksize; /* current block size */ | 47 | unsigned cur_blksize; /* current block size */ |
48 | 48 | ||
49 | unsigned enable_timeout; /* max enable timeout in msec */ | ||
50 | |||
49 | unsigned int state; /* function state */ | 51 | unsigned int state; /* function state */ |
50 | #define SDIO_STATE_PRESENT (1<<0) /* present in sysfs */ | 52 | #define SDIO_STATE_PRESENT (1<<0) /* present in sysfs */ |
51 | 53 | ||
@@ -120,23 +122,22 @@ extern int sdio_set_block_size(struct sdio_func *func, unsigned blksz); | |||
120 | extern int sdio_claim_irq(struct sdio_func *func, sdio_irq_handler_t *handler); | 122 | extern int sdio_claim_irq(struct sdio_func *func, sdio_irq_handler_t *handler); |
121 | extern int sdio_release_irq(struct sdio_func *func); | 123 | extern int sdio_release_irq(struct sdio_func *func); |
122 | 124 | ||
123 | extern unsigned char sdio_readb(struct sdio_func *func, | 125 | extern unsigned int sdio_align_size(struct sdio_func *func, unsigned int sz); |
124 | unsigned int addr, int *err_ret); | 126 | |
125 | extern unsigned short sdio_readw(struct sdio_func *func, | 127 | extern u8 sdio_readb(struct sdio_func *func, unsigned int addr, int *err_ret); |
126 | unsigned int addr, int *err_ret); | 128 | extern u16 sdio_readw(struct sdio_func *func, unsigned int addr, int *err_ret); |
127 | extern unsigned long sdio_readl(struct sdio_func *func, | 129 | extern u32 sdio_readl(struct sdio_func *func, unsigned int addr, int *err_ret); |
128 | unsigned int addr, int *err_ret); | ||
129 | 130 | ||
130 | extern int sdio_memcpy_fromio(struct sdio_func *func, void *dst, | 131 | extern int sdio_memcpy_fromio(struct sdio_func *func, void *dst, |
131 | unsigned int addr, int count); | 132 | unsigned int addr, int count); |
132 | extern int sdio_readsb(struct sdio_func *func, void *dst, | 133 | extern int sdio_readsb(struct sdio_func *func, void *dst, |
133 | unsigned int addr, int count); | 134 | unsigned int addr, int count); |
134 | 135 | ||
135 | extern void sdio_writeb(struct sdio_func *func, unsigned char b, | 136 | extern void sdio_writeb(struct sdio_func *func, u8 b, |
136 | unsigned int addr, int *err_ret); | 137 | unsigned int addr, int *err_ret); |
137 | extern void sdio_writew(struct sdio_func *func, unsigned short b, | 138 | extern void sdio_writew(struct sdio_func *func, u16 b, |
138 | unsigned int addr, int *err_ret); | 139 | unsigned int addr, int *err_ret); |
139 | extern void sdio_writel(struct sdio_func *func, unsigned long b, | 140 | extern void sdio_writel(struct sdio_func *func, u32 b, |
140 | unsigned int addr, int *err_ret); | 141 | unsigned int addr, int *err_ret); |
141 | 142 | ||
142 | extern int sdio_memcpy_toio(struct sdio_func *func, unsigned int addr, | 143 | extern int sdio_memcpy_toio(struct sdio_func *func, unsigned int addr, |
diff --git a/include/linux/mmdebug.h b/include/linux/mmdebug.h new file mode 100644 index 000000000000..8a5509877192 --- /dev/null +++ b/include/linux/mmdebug.h | |||
@@ -0,0 +1,18 @@ | |||
1 | #ifndef LINUX_MM_DEBUG_H | ||
2 | #define LINUX_MM_DEBUG_H 1 | ||
3 | |||
4 | #include <linux/autoconf.h> | ||
5 | |||
6 | #ifdef CONFIG_DEBUG_VM | ||
7 | #define VM_BUG_ON(cond) BUG_ON(cond) | ||
8 | #else | ||
9 | #define VM_BUG_ON(cond) do { } while (0) | ||
10 | #endif | ||
11 | |||
12 | #ifdef CONFIG_DEBUG_VIRTUAL | ||
13 | #define VIRTUAL_BUG_ON(cond) BUG_ON(cond) | ||
14 | #else | ||
15 | #define VIRTUAL_BUG_ON(cond) do { } while (0) | ||
16 | #endif | ||
17 | |||
18 | #endif | ||
diff --git a/include/linux/mmiotrace.h b/include/linux/mmiotrace.h new file mode 100644 index 000000000000..61d19e1b7a0b --- /dev/null +++ b/include/linux/mmiotrace.h | |||
@@ -0,0 +1,85 @@ | |||
1 | #ifndef MMIOTRACE_H | ||
2 | #define MMIOTRACE_H | ||
3 | |||
4 | #include <linux/types.h> | ||
5 | #include <linux/list.h> | ||
6 | |||
7 | struct kmmio_probe; | ||
8 | struct pt_regs; | ||
9 | |||
10 | typedef void (*kmmio_pre_handler_t)(struct kmmio_probe *, | ||
11 | struct pt_regs *, unsigned long addr); | ||
12 | typedef void (*kmmio_post_handler_t)(struct kmmio_probe *, | ||
13 | unsigned long condition, struct pt_regs *); | ||
14 | |||
15 | struct kmmio_probe { | ||
16 | struct list_head list; /* kmmio internal list */ | ||
17 | unsigned long addr; /* start location of the probe point */ | ||
18 | unsigned long len; /* length of the probe region */ | ||
19 | kmmio_pre_handler_t pre_handler; /* Called before addr is executed. */ | ||
20 | kmmio_post_handler_t post_handler; /* Called after addr is executed */ | ||
21 | void *private; | ||
22 | }; | ||
23 | |||
24 | /* kmmio is active by some kmmio_probes? */ | ||
25 | static inline int is_kmmio_active(void) | ||
26 | { | ||
27 | extern unsigned int kmmio_count; | ||
28 | return kmmio_count; | ||
29 | } | ||
30 | |||
31 | extern int register_kmmio_probe(struct kmmio_probe *p); | ||
32 | extern void unregister_kmmio_probe(struct kmmio_probe *p); | ||
33 | |||
34 | /* Called from page fault handler. */ | ||
35 | extern int kmmio_handler(struct pt_regs *regs, unsigned long addr); | ||
36 | |||
37 | /* Called from ioremap.c */ | ||
38 | #ifdef CONFIG_MMIOTRACE | ||
39 | extern void mmiotrace_ioremap(resource_size_t offset, unsigned long size, | ||
40 | void __iomem *addr); | ||
41 | extern void mmiotrace_iounmap(volatile void __iomem *addr); | ||
42 | #else | ||
43 | static inline void mmiotrace_ioremap(resource_size_t offset, | ||
44 | unsigned long size, void __iomem *addr) | ||
45 | { | ||
46 | } | ||
47 | |||
48 | static inline void mmiotrace_iounmap(volatile void __iomem *addr) | ||
49 | { | ||
50 | } | ||
51 | #endif /* CONFIG_MMIOTRACE_HOOKS */ | ||
52 | |||
53 | enum mm_io_opcode { | ||
54 | MMIO_READ = 0x1, /* struct mmiotrace_rw */ | ||
55 | MMIO_WRITE = 0x2, /* struct mmiotrace_rw */ | ||
56 | MMIO_PROBE = 0x3, /* struct mmiotrace_map */ | ||
57 | MMIO_UNPROBE = 0x4, /* struct mmiotrace_map */ | ||
58 | MMIO_MARKER = 0x5, /* raw char data */ | ||
59 | MMIO_UNKNOWN_OP = 0x6, /* struct mmiotrace_rw */ | ||
60 | }; | ||
61 | |||
62 | struct mmiotrace_rw { | ||
63 | resource_size_t phys; /* PCI address of register */ | ||
64 | unsigned long value; | ||
65 | unsigned long pc; /* optional program counter */ | ||
66 | int map_id; | ||
67 | unsigned char opcode; /* one of MMIO_{READ,WRITE,UNKNOWN_OP} */ | ||
68 | unsigned char width; /* size of register access in bytes */ | ||
69 | }; | ||
70 | |||
71 | struct mmiotrace_map { | ||
72 | resource_size_t phys; /* base address in PCI space */ | ||
73 | unsigned long virt; /* base virtual address */ | ||
74 | unsigned long len; /* mapping size */ | ||
75 | int map_id; | ||
76 | unsigned char opcode; /* MMIO_PROBE or MMIO_UNPROBE */ | ||
77 | }; | ||
78 | |||
79 | /* in kernel/trace/trace_mmiotrace.c */ | ||
80 | extern void enable_mmiotrace(void); | ||
81 | extern void disable_mmiotrace(void); | ||
82 | extern void mmio_trace_rw(struct mmiotrace_rw *rw); | ||
83 | extern void mmio_trace_mapping(struct mmiotrace_map *map); | ||
84 | |||
85 | #endif /* MMIOTRACE_H */ | ||
diff --git a/include/linux/mmu_notifier.h b/include/linux/mmu_notifier.h new file mode 100644 index 000000000000..b77486d152cd --- /dev/null +++ b/include/linux/mmu_notifier.h | |||
@@ -0,0 +1,279 @@ | |||
1 | #ifndef _LINUX_MMU_NOTIFIER_H | ||
2 | #define _LINUX_MMU_NOTIFIER_H | ||
3 | |||
4 | #include <linux/list.h> | ||
5 | #include <linux/spinlock.h> | ||
6 | #include <linux/mm_types.h> | ||
7 | |||
8 | struct mmu_notifier; | ||
9 | struct mmu_notifier_ops; | ||
10 | |||
11 | #ifdef CONFIG_MMU_NOTIFIER | ||
12 | |||
13 | /* | ||
14 | * The mmu notifier_mm structure is allocated and installed in | ||
15 | * mm->mmu_notifier_mm inside the mm_take_all_locks() protected | ||
16 | * critical section and it's released only when mm_count reaches zero | ||
17 | * in mmdrop(). | ||
18 | */ | ||
19 | struct mmu_notifier_mm { | ||
20 | /* all mmu notifiers registerd in this mm are queued in this list */ | ||
21 | struct hlist_head list; | ||
22 | /* to serialize the list modifications and hlist_unhashed */ | ||
23 | spinlock_t lock; | ||
24 | }; | ||
25 | |||
26 | struct mmu_notifier_ops { | ||
27 | /* | ||
28 | * Called either by mmu_notifier_unregister or when the mm is | ||
29 | * being destroyed by exit_mmap, always before all pages are | ||
30 | * freed. This can run concurrently with other mmu notifier | ||
31 | * methods (the ones invoked outside the mm context) and it | ||
32 | * should tear down all secondary mmu mappings and freeze the | ||
33 | * secondary mmu. If this method isn't implemented you've to | ||
34 | * be sure that nothing could possibly write to the pages | ||
35 | * through the secondary mmu by the time the last thread with | ||
36 | * tsk->mm == mm exits. | ||
37 | * | ||
38 | * As side note: the pages freed after ->release returns could | ||
39 | * be immediately reallocated by the gart at an alias physical | ||
40 | * address with a different cache model, so if ->release isn't | ||
41 | * implemented because all _software_ driven memory accesses | ||
42 | * through the secondary mmu are terminated by the time the | ||
43 | * last thread of this mm quits, you've also to be sure that | ||
44 | * speculative _hardware_ operations can't allocate dirty | ||
45 | * cachelines in the cpu that could not be snooped and made | ||
46 | * coherent with the other read and write operations happening | ||
47 | * through the gart alias address, so leading to memory | ||
48 | * corruption. | ||
49 | */ | ||
50 | void (*release)(struct mmu_notifier *mn, | ||
51 | struct mm_struct *mm); | ||
52 | |||
53 | /* | ||
54 | * clear_flush_young is called after the VM is | ||
55 | * test-and-clearing the young/accessed bitflag in the | ||
56 | * pte. This way the VM will provide proper aging to the | ||
57 | * accesses to the page through the secondary MMUs and not | ||
58 | * only to the ones through the Linux pte. | ||
59 | */ | ||
60 | int (*clear_flush_young)(struct mmu_notifier *mn, | ||
61 | struct mm_struct *mm, | ||
62 | unsigned long address); | ||
63 | |||
64 | /* | ||
65 | * Before this is invoked any secondary MMU is still ok to | ||
66 | * read/write to the page previously pointed to by the Linux | ||
67 | * pte because the page hasn't been freed yet and it won't be | ||
68 | * freed until this returns. If required set_page_dirty has to | ||
69 | * be called internally to this method. | ||
70 | */ | ||
71 | void (*invalidate_page)(struct mmu_notifier *mn, | ||
72 | struct mm_struct *mm, | ||
73 | unsigned long address); | ||
74 | |||
75 | /* | ||
76 | * invalidate_range_start() and invalidate_range_end() must be | ||
77 | * paired and are called only when the mmap_sem and/or the | ||
78 | * locks protecting the reverse maps are held. The subsystem | ||
79 | * must guarantee that no additional references are taken to | ||
80 | * the pages in the range established between the call to | ||
81 | * invalidate_range_start() and the matching call to | ||
82 | * invalidate_range_end(). | ||
83 | * | ||
84 | * Invalidation of multiple concurrent ranges may be | ||
85 | * optionally permitted by the driver. Either way the | ||
86 | * establishment of sptes is forbidden in the range passed to | ||
87 | * invalidate_range_begin/end for the whole duration of the | ||
88 | * invalidate_range_begin/end critical section. | ||
89 | * | ||
90 | * invalidate_range_start() is called when all pages in the | ||
91 | * range are still mapped and have at least a refcount of one. | ||
92 | * | ||
93 | * invalidate_range_end() is called when all pages in the | ||
94 | * range have been unmapped and the pages have been freed by | ||
95 | * the VM. | ||
96 | * | ||
97 | * The VM will remove the page table entries and potentially | ||
98 | * the page between invalidate_range_start() and | ||
99 | * invalidate_range_end(). If the page must not be freed | ||
100 | * because of pending I/O or other circumstances then the | ||
101 | * invalidate_range_start() callback (or the initial mapping | ||
102 | * by the driver) must make sure that the refcount is kept | ||
103 | * elevated. | ||
104 | * | ||
105 | * If the driver increases the refcount when the pages are | ||
106 | * initially mapped into an address space then either | ||
107 | * invalidate_range_start() or invalidate_range_end() may | ||
108 | * decrease the refcount. If the refcount is decreased on | ||
109 | * invalidate_range_start() then the VM can free pages as page | ||
110 | * table entries are removed. If the refcount is only | ||
111 | * droppped on invalidate_range_end() then the driver itself | ||
112 | * will drop the last refcount but it must take care to flush | ||
113 | * any secondary tlb before doing the final free on the | ||
114 | * page. Pages will no longer be referenced by the linux | ||
115 | * address space but may still be referenced by sptes until | ||
116 | * the last refcount is dropped. | ||
117 | */ | ||
118 | void (*invalidate_range_start)(struct mmu_notifier *mn, | ||
119 | struct mm_struct *mm, | ||
120 | unsigned long start, unsigned long end); | ||
121 | void (*invalidate_range_end)(struct mmu_notifier *mn, | ||
122 | struct mm_struct *mm, | ||
123 | unsigned long start, unsigned long end); | ||
124 | }; | ||
125 | |||
126 | /* | ||
127 | * The notifier chains are protected by mmap_sem and/or the reverse map | ||
128 | * semaphores. Notifier chains are only changed when all reverse maps and | ||
129 | * the mmap_sem locks are taken. | ||
130 | * | ||
131 | * Therefore notifier chains can only be traversed when either | ||
132 | * | ||
133 | * 1. mmap_sem is held. | ||
134 | * 2. One of the reverse map locks is held (i_mmap_lock or anon_vma->lock). | ||
135 | * 3. No other concurrent thread can access the list (release) | ||
136 | */ | ||
137 | struct mmu_notifier { | ||
138 | struct hlist_node hlist; | ||
139 | const struct mmu_notifier_ops *ops; | ||
140 | }; | ||
141 | |||
142 | static inline int mm_has_notifiers(struct mm_struct *mm) | ||
143 | { | ||
144 | return unlikely(mm->mmu_notifier_mm); | ||
145 | } | ||
146 | |||
147 | extern int mmu_notifier_register(struct mmu_notifier *mn, | ||
148 | struct mm_struct *mm); | ||
149 | extern int __mmu_notifier_register(struct mmu_notifier *mn, | ||
150 | struct mm_struct *mm); | ||
151 | extern void mmu_notifier_unregister(struct mmu_notifier *mn, | ||
152 | struct mm_struct *mm); | ||
153 | extern void __mmu_notifier_mm_destroy(struct mm_struct *mm); | ||
154 | extern void __mmu_notifier_release(struct mm_struct *mm); | ||
155 | extern int __mmu_notifier_clear_flush_young(struct mm_struct *mm, | ||
156 | unsigned long address); | ||
157 | extern void __mmu_notifier_invalidate_page(struct mm_struct *mm, | ||
158 | unsigned long address); | ||
159 | extern void __mmu_notifier_invalidate_range_start(struct mm_struct *mm, | ||
160 | unsigned long start, unsigned long end); | ||
161 | extern void __mmu_notifier_invalidate_range_end(struct mm_struct *mm, | ||
162 | unsigned long start, unsigned long end); | ||
163 | |||
164 | static inline void mmu_notifier_release(struct mm_struct *mm) | ||
165 | { | ||
166 | if (mm_has_notifiers(mm)) | ||
167 | __mmu_notifier_release(mm); | ||
168 | } | ||
169 | |||
170 | static inline int mmu_notifier_clear_flush_young(struct mm_struct *mm, | ||
171 | unsigned long address) | ||
172 | { | ||
173 | if (mm_has_notifiers(mm)) | ||
174 | return __mmu_notifier_clear_flush_young(mm, address); | ||
175 | return 0; | ||
176 | } | ||
177 | |||
178 | static inline void mmu_notifier_invalidate_page(struct mm_struct *mm, | ||
179 | unsigned long address) | ||
180 | { | ||
181 | if (mm_has_notifiers(mm)) | ||
182 | __mmu_notifier_invalidate_page(mm, address); | ||
183 | } | ||
184 | |||
185 | static inline void mmu_notifier_invalidate_range_start(struct mm_struct *mm, | ||
186 | unsigned long start, unsigned long end) | ||
187 | { | ||
188 | if (mm_has_notifiers(mm)) | ||
189 | __mmu_notifier_invalidate_range_start(mm, start, end); | ||
190 | } | ||
191 | |||
192 | static inline void mmu_notifier_invalidate_range_end(struct mm_struct *mm, | ||
193 | unsigned long start, unsigned long end) | ||
194 | { | ||
195 | if (mm_has_notifiers(mm)) | ||
196 | __mmu_notifier_invalidate_range_end(mm, start, end); | ||
197 | } | ||
198 | |||
199 | static inline void mmu_notifier_mm_init(struct mm_struct *mm) | ||
200 | { | ||
201 | mm->mmu_notifier_mm = NULL; | ||
202 | } | ||
203 | |||
204 | static inline void mmu_notifier_mm_destroy(struct mm_struct *mm) | ||
205 | { | ||
206 | if (mm_has_notifiers(mm)) | ||
207 | __mmu_notifier_mm_destroy(mm); | ||
208 | } | ||
209 | |||
210 | /* | ||
211 | * These two macros will sometime replace ptep_clear_flush. | ||
212 | * ptep_clear_flush is impleemnted as macro itself, so this also is | ||
213 | * implemented as a macro until ptep_clear_flush will converted to an | ||
214 | * inline function, to diminish the risk of compilation failure. The | ||
215 | * invalidate_page method over time can be moved outside the PT lock | ||
216 | * and these two macros can be later removed. | ||
217 | */ | ||
218 | #define ptep_clear_flush_notify(__vma, __address, __ptep) \ | ||
219 | ({ \ | ||
220 | pte_t __pte; \ | ||
221 | struct vm_area_struct *___vma = __vma; \ | ||
222 | unsigned long ___address = __address; \ | ||
223 | __pte = ptep_clear_flush(___vma, ___address, __ptep); \ | ||
224 | mmu_notifier_invalidate_page(___vma->vm_mm, ___address); \ | ||
225 | __pte; \ | ||
226 | }) | ||
227 | |||
228 | #define ptep_clear_flush_young_notify(__vma, __address, __ptep) \ | ||
229 | ({ \ | ||
230 | int __young; \ | ||
231 | struct vm_area_struct *___vma = __vma; \ | ||
232 | unsigned long ___address = __address; \ | ||
233 | __young = ptep_clear_flush_young(___vma, ___address, __ptep); \ | ||
234 | __young |= mmu_notifier_clear_flush_young(___vma->vm_mm, \ | ||
235 | ___address); \ | ||
236 | __young; \ | ||
237 | }) | ||
238 | |||
239 | #else /* CONFIG_MMU_NOTIFIER */ | ||
240 | |||
241 | static inline void mmu_notifier_release(struct mm_struct *mm) | ||
242 | { | ||
243 | } | ||
244 | |||
245 | static inline int mmu_notifier_clear_flush_young(struct mm_struct *mm, | ||
246 | unsigned long address) | ||
247 | { | ||
248 | return 0; | ||
249 | } | ||
250 | |||
251 | static inline void mmu_notifier_invalidate_page(struct mm_struct *mm, | ||
252 | unsigned long address) | ||
253 | { | ||
254 | } | ||
255 | |||
256 | static inline void mmu_notifier_invalidate_range_start(struct mm_struct *mm, | ||
257 | unsigned long start, unsigned long end) | ||
258 | { | ||
259 | } | ||
260 | |||
261 | static inline void mmu_notifier_invalidate_range_end(struct mm_struct *mm, | ||
262 | unsigned long start, unsigned long end) | ||
263 | { | ||
264 | } | ||
265 | |||
266 | static inline void mmu_notifier_mm_init(struct mm_struct *mm) | ||
267 | { | ||
268 | } | ||
269 | |||
270 | static inline void mmu_notifier_mm_destroy(struct mm_struct *mm) | ||
271 | { | ||
272 | } | ||
273 | |||
274 | #define ptep_clear_flush_young_notify ptep_clear_flush_young | ||
275 | #define ptep_clear_flush_notify ptep_clear_flush | ||
276 | |||
277 | #endif /* CONFIG_MMU_NOTIFIER */ | ||
278 | |||
279 | #endif /* _LINUX_MMU_NOTIFIER_H */ | ||
diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h index 443bc7cd8c62..428328a05fa1 100644 --- a/include/linux/mmzone.h +++ b/include/linux/mmzone.h | |||
@@ -751,8 +751,9 @@ static inline int zonelist_node_idx(struct zoneref *zoneref) | |||
751 | * | 751 | * |
752 | * This function returns the next zone at or below a given zone index that is | 752 | * This function returns the next zone at or below a given zone index that is |
753 | * within the allowed nodemask using a cursor as the starting point for the | 753 | * within the allowed nodemask using a cursor as the starting point for the |
754 | * search. The zoneref returned is a cursor that is used as the next starting | 754 | * search. The zoneref returned is a cursor that represents the current zone |
755 | * point for future calls to next_zones_zonelist(). | 755 | * being examined. It should be advanced by one before calling |
756 | * next_zones_zonelist again. | ||
756 | */ | 757 | */ |
757 | struct zoneref *next_zones_zonelist(struct zoneref *z, | 758 | struct zoneref *next_zones_zonelist(struct zoneref *z, |
758 | enum zone_type highest_zoneidx, | 759 | enum zone_type highest_zoneidx, |
@@ -768,9 +769,8 @@ struct zoneref *next_zones_zonelist(struct zoneref *z, | |||
768 | * | 769 | * |
769 | * This function returns the first zone at or below a given zone index that is | 770 | * This function returns the first zone at or below a given zone index that is |
770 | * within the allowed nodemask. The zoneref returned is a cursor that can be | 771 | * within the allowed nodemask. The zoneref returned is a cursor that can be |
771 | * used to iterate the zonelist with next_zones_zonelist. The cursor should | 772 | * used to iterate the zonelist with next_zones_zonelist by advancing it by |
772 | * not be used by the caller as it does not match the value of the zone | 773 | * one before calling. |
773 | * returned. | ||
774 | */ | 774 | */ |
775 | static inline struct zoneref *first_zones_zonelist(struct zonelist *zonelist, | 775 | static inline struct zoneref *first_zones_zonelist(struct zonelist *zonelist, |
776 | enum zone_type highest_zoneidx, | 776 | enum zone_type highest_zoneidx, |
@@ -795,7 +795,7 @@ static inline struct zoneref *first_zones_zonelist(struct zonelist *zonelist, | |||
795 | #define for_each_zone_zonelist_nodemask(zone, z, zlist, highidx, nodemask) \ | 795 | #define for_each_zone_zonelist_nodemask(zone, z, zlist, highidx, nodemask) \ |
796 | for (z = first_zones_zonelist(zlist, highidx, nodemask, &zone); \ | 796 | for (z = first_zones_zonelist(zlist, highidx, nodemask, &zone); \ |
797 | zone; \ | 797 | zone; \ |
798 | z = next_zones_zonelist(z, highidx, nodemask, &zone)) \ | 798 | z = next_zones_zonelist(++z, highidx, nodemask, &zone)) \ |
799 | 799 | ||
800 | /** | 800 | /** |
801 | * for_each_zone_zonelist - helper macro to iterate over valid zones in a zonelist at or below a given zone index | 801 | * for_each_zone_zonelist - helper macro to iterate over valid zones in a zonelist at or below a given zone index |
diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h index 69b2342d5ebb..d6a3f47e95cb 100644 --- a/include/linux/mod_devicetable.h +++ b/include/linux/mod_devicetable.h | |||
@@ -131,6 +131,16 @@ struct usb_device_id { | |||
131 | #define USB_DEVICE_ID_MATCH_INT_SUBCLASS 0x0100 | 131 | #define USB_DEVICE_ID_MATCH_INT_SUBCLASS 0x0100 |
132 | #define USB_DEVICE_ID_MATCH_INT_PROTOCOL 0x0200 | 132 | #define USB_DEVICE_ID_MATCH_INT_PROTOCOL 0x0200 |
133 | 133 | ||
134 | #define HID_ANY_ID (~0) | ||
135 | |||
136 | struct hid_device_id { | ||
137 | __u16 bus; | ||
138 | __u32 vendor; | ||
139 | __u32 product; | ||
140 | kernel_ulong_t driver_data | ||
141 | __attribute__((aligned(sizeof(kernel_ulong_t)))); | ||
142 | }; | ||
143 | |||
134 | /* s390 CCW devices */ | 144 | /* s390 CCW devices */ |
135 | struct ccw_device_id { | 145 | struct ccw_device_id { |
136 | __u16 match_flags; /* which fields to match against */ | 146 | __u16 match_flags; /* which fields to match against */ |
@@ -159,6 +169,15 @@ struct ap_device_id { | |||
159 | 169 | ||
160 | #define AP_DEVICE_ID_MATCH_DEVICE_TYPE 0x01 | 170 | #define AP_DEVICE_ID_MATCH_DEVICE_TYPE 0x01 |
161 | 171 | ||
172 | /* s390 css bus devices (subchannels) */ | ||
173 | struct css_device_id { | ||
174 | __u8 match_flags; | ||
175 | __u8 type; /* subchannel type */ | ||
176 | __u16 pad2; | ||
177 | __u32 pad3; | ||
178 | kernel_ulong_t driver_data; | ||
179 | }; | ||
180 | |||
162 | #define ACPI_ID_LEN 16 /* only 9 bytes needed here, 16 bytes are used */ | 181 | #define ACPI_ID_LEN 16 /* only 9 bytes needed here, 16 bytes are used */ |
163 | /* to workaround crosscompile issues */ | 182 | /* to workaround crosscompile issues */ |
164 | 183 | ||
@@ -379,5 +398,52 @@ struct i2c_device_id { | |||
379 | __attribute__((aligned(sizeof(kernel_ulong_t)))); | 398 | __attribute__((aligned(sizeof(kernel_ulong_t)))); |
380 | }; | 399 | }; |
381 | 400 | ||
401 | /* dmi */ | ||
402 | enum dmi_field { | ||
403 | DMI_NONE, | ||
404 | DMI_BIOS_VENDOR, | ||
405 | DMI_BIOS_VERSION, | ||
406 | DMI_BIOS_DATE, | ||
407 | DMI_SYS_VENDOR, | ||
408 | DMI_PRODUCT_NAME, | ||
409 | DMI_PRODUCT_VERSION, | ||
410 | DMI_PRODUCT_SERIAL, | ||
411 | DMI_PRODUCT_UUID, | ||
412 | DMI_BOARD_VENDOR, | ||
413 | DMI_BOARD_NAME, | ||
414 | DMI_BOARD_VERSION, | ||
415 | DMI_BOARD_SERIAL, | ||
416 | DMI_BOARD_ASSET_TAG, | ||
417 | DMI_CHASSIS_VENDOR, | ||
418 | DMI_CHASSIS_TYPE, | ||
419 | DMI_CHASSIS_VERSION, | ||
420 | DMI_CHASSIS_SERIAL, | ||
421 | DMI_CHASSIS_ASSET_TAG, | ||
422 | DMI_STRING_MAX, | ||
423 | }; | ||
424 | |||
425 | struct dmi_strmatch { | ||
426 | unsigned char slot; | ||
427 | char substr[79]; | ||
428 | }; | ||
429 | |||
430 | #ifndef __KERNEL__ | ||
431 | struct dmi_system_id { | ||
432 | kernel_ulong_t callback; | ||
433 | kernel_ulong_t ident; | ||
434 | struct dmi_strmatch matches[4]; | ||
435 | kernel_ulong_t driver_data | ||
436 | __attribute__((aligned(sizeof(kernel_ulong_t)))); | ||
437 | }; | ||
438 | #else | ||
439 | struct dmi_system_id { | ||
440 | int (*callback)(const struct dmi_system_id *); | ||
441 | const char *ident; | ||
442 | struct dmi_strmatch matches[4]; | ||
443 | void *driver_data; | ||
444 | }; | ||
445 | #endif | ||
446 | |||
447 | #define DMI_MATCH(a, b) { a, b } | ||
382 | 448 | ||
383 | #endif /* LINUX_MOD_DEVICETABLE_H */ | 449 | #endif /* LINUX_MOD_DEVICETABLE_H */ |
diff --git a/include/linux/module.h b/include/linux/module.h index 3e03b1acbc94..68e09557c951 100644 --- a/include/linux/module.h +++ b/include/linux/module.h | |||
@@ -23,7 +23,7 @@ | |||
23 | /* Not Yet Implemented */ | 23 | /* Not Yet Implemented */ |
24 | #define MODULE_SUPPORTED_DEVICE(name) | 24 | #define MODULE_SUPPORTED_DEVICE(name) |
25 | 25 | ||
26 | /* v850 toolchain uses a `_' prefix for all user symbols */ | 26 | /* some toolchains uses a `_' prefix for all user symbols */ |
27 | #ifndef MODULE_SYMBOL_PREFIX | 27 | #ifndef MODULE_SYMBOL_PREFIX |
28 | #define MODULE_SYMBOL_PREFIX "" | 28 | #define MODULE_SYMBOL_PREFIX "" |
29 | #endif | 29 | #endif |
@@ -249,27 +249,30 @@ struct module | |||
249 | 249 | ||
250 | /* Exported symbols */ | 250 | /* Exported symbols */ |
251 | const struct kernel_symbol *syms; | 251 | const struct kernel_symbol *syms; |
252 | unsigned int num_syms; | ||
253 | const unsigned long *crcs; | 252 | const unsigned long *crcs; |
253 | unsigned int num_syms; | ||
254 | 254 | ||
255 | /* GPL-only exported symbols. */ | 255 | /* GPL-only exported symbols. */ |
256 | const struct kernel_symbol *gpl_syms; | ||
257 | unsigned int num_gpl_syms; | 256 | unsigned int num_gpl_syms; |
257 | const struct kernel_symbol *gpl_syms; | ||
258 | const unsigned long *gpl_crcs; | 258 | const unsigned long *gpl_crcs; |
259 | 259 | ||
260 | #ifdef CONFIG_UNUSED_SYMBOLS | ||
260 | /* unused exported symbols. */ | 261 | /* unused exported symbols. */ |
261 | const struct kernel_symbol *unused_syms; | 262 | const struct kernel_symbol *unused_syms; |
262 | unsigned int num_unused_syms; | ||
263 | const unsigned long *unused_crcs; | 263 | const unsigned long *unused_crcs; |
264 | unsigned int num_unused_syms; | ||
265 | |||
264 | /* GPL-only, unused exported symbols. */ | 266 | /* GPL-only, unused exported symbols. */ |
265 | const struct kernel_symbol *unused_gpl_syms; | ||
266 | unsigned int num_unused_gpl_syms; | 267 | unsigned int num_unused_gpl_syms; |
268 | const struct kernel_symbol *unused_gpl_syms; | ||
267 | const unsigned long *unused_gpl_crcs; | 269 | const unsigned long *unused_gpl_crcs; |
270 | #endif | ||
268 | 271 | ||
269 | /* symbols that will be GPL-only in the near future. */ | 272 | /* symbols that will be GPL-only in the near future. */ |
270 | const struct kernel_symbol *gpl_future_syms; | 273 | const struct kernel_symbol *gpl_future_syms; |
271 | unsigned int num_gpl_future_syms; | ||
272 | const unsigned long *gpl_future_crcs; | 274 | const unsigned long *gpl_future_crcs; |
275 | unsigned int num_gpl_future_syms; | ||
273 | 276 | ||
274 | /* Exception table */ | 277 | /* Exception table */ |
275 | unsigned int num_exentries; | 278 | unsigned int num_exentries; |
@@ -285,10 +288,10 @@ struct module | |||
285 | void *module_core; | 288 | void *module_core; |
286 | 289 | ||
287 | /* Here are the sizes of the init and core sections */ | 290 | /* Here are the sizes of the init and core sections */ |
288 | unsigned long init_size, core_size; | 291 | unsigned int init_size, core_size; |
289 | 292 | ||
290 | /* The size of the executable code in each section. */ | 293 | /* The size of the executable code in each section. */ |
291 | unsigned long init_text_size, core_text_size; | 294 | unsigned int init_text_size, core_text_size; |
292 | 295 | ||
293 | /* The handle returned from unwind_add_table. */ | 296 | /* The handle returned from unwind_add_table. */ |
294 | void *unwind_info; | 297 | void *unwind_info; |
@@ -300,29 +303,15 @@ struct module | |||
300 | 303 | ||
301 | #ifdef CONFIG_GENERIC_BUG | 304 | #ifdef CONFIG_GENERIC_BUG |
302 | /* Support for BUG */ | 305 | /* Support for BUG */ |
306 | unsigned num_bugs; | ||
303 | struct list_head bug_list; | 307 | struct list_head bug_list; |
304 | struct bug_entry *bug_table; | 308 | struct bug_entry *bug_table; |
305 | unsigned num_bugs; | ||
306 | #endif | ||
307 | |||
308 | #ifdef CONFIG_MODULE_UNLOAD | ||
309 | /* Reference counts */ | ||
310 | struct module_ref ref[NR_CPUS]; | ||
311 | |||
312 | /* What modules depend on me? */ | ||
313 | struct list_head modules_which_use_me; | ||
314 | |||
315 | /* Who is waiting for us to be unloaded */ | ||
316 | struct task_struct *waiter; | ||
317 | |||
318 | /* Destruction function. */ | ||
319 | void (*exit)(void); | ||
320 | #endif | 309 | #endif |
321 | 310 | ||
322 | #ifdef CONFIG_KALLSYMS | 311 | #ifdef CONFIG_KALLSYMS |
323 | /* We keep the symbol and string tables for kallsyms. */ | 312 | /* We keep the symbol and string tables for kallsyms. */ |
324 | Elf_Sym *symtab; | 313 | Elf_Sym *symtab; |
325 | unsigned long num_symtab; | 314 | unsigned int num_symtab; |
326 | char *strtab; | 315 | char *strtab; |
327 | 316 | ||
328 | /* Section attributes */ | 317 | /* Section attributes */ |
@@ -342,6 +331,21 @@ struct module | |||
342 | struct marker *markers; | 331 | struct marker *markers; |
343 | unsigned int num_markers; | 332 | unsigned int num_markers; |
344 | #endif | 333 | #endif |
334 | |||
335 | #ifdef CONFIG_MODULE_UNLOAD | ||
336 | /* What modules depend on me? */ | ||
337 | struct list_head modules_which_use_me; | ||
338 | |||
339 | /* Who is waiting for us to be unloaded */ | ||
340 | struct task_struct *waiter; | ||
341 | |||
342 | /* Destruction function. */ | ||
343 | void (*exit)(void); | ||
344 | |||
345 | /* Reference counts */ | ||
346 | struct module_ref ref[NR_CPUS]; | ||
347 | #endif | ||
348 | |||
345 | }; | 349 | }; |
346 | #ifndef MODULE_ARCH_INIT | 350 | #ifndef MODULE_ARCH_INIT |
347 | #define MODULE_ARCH_INIT {} | 351 | #define MODULE_ARCH_INIT {} |
diff --git a/include/linux/mount.h b/include/linux/mount.h index 4374d1adeb4b..30a1d63b6fb5 100644 --- a/include/linux/mount.h +++ b/include/linux/mount.h | |||
@@ -47,7 +47,7 @@ struct vfsmount { | |||
47 | struct list_head mnt_child; /* and going through their mnt_child */ | 47 | struct list_head mnt_child; /* and going through their mnt_child */ |
48 | int mnt_flags; | 48 | int mnt_flags; |
49 | /* 4 bytes hole on 64bits arches */ | 49 | /* 4 bytes hole on 64bits arches */ |
50 | char *mnt_devname; /* Name of device e.g. /dev/dsk/hda1 */ | 50 | const char *mnt_devname; /* Name of device e.g. /dev/dsk/hda1 */ |
51 | struct list_head mnt_list; | 51 | struct list_head mnt_list; |
52 | struct list_head mnt_expire; /* link in fs-specific expiry list */ | 52 | struct list_head mnt_expire; /* link in fs-specific expiry list */ |
53 | struct list_head mnt_share; /* circular list of shared mounts */ | 53 | struct list_head mnt_share; /* circular list of shared mounts */ |
@@ -105,7 +105,8 @@ extern struct vfsmount *vfs_kern_mount(struct file_system_type *type, | |||
105 | 105 | ||
106 | struct nameidata; | 106 | struct nameidata; |
107 | 107 | ||
108 | extern int do_add_mount(struct vfsmount *newmnt, struct nameidata *nd, | 108 | struct path; |
109 | extern int do_add_mount(struct vfsmount *newmnt, struct path *path, | ||
109 | int mnt_flags, struct list_head *fslist); | 110 | int mnt_flags, struct list_head *fslist); |
110 | 111 | ||
111 | extern void mark_mounts_for_expiry(struct list_head *mounts); | 112 | extern void mark_mounts_for_expiry(struct list_head *mounts); |
diff --git a/include/linux/mpage.h b/include/linux/mpage.h index 068a0c9946af..5c42821da2d1 100644 --- a/include/linux/mpage.h +++ b/include/linux/mpage.h | |||
@@ -11,11 +11,21 @@ | |||
11 | */ | 11 | */ |
12 | #ifdef CONFIG_BLOCK | 12 | #ifdef CONFIG_BLOCK |
13 | 13 | ||
14 | struct mpage_data { | ||
15 | struct bio *bio; | ||
16 | sector_t last_block_in_bio; | ||
17 | get_block_t *get_block; | ||
18 | unsigned use_writepage; | ||
19 | }; | ||
20 | |||
14 | struct writeback_control; | 21 | struct writeback_control; |
15 | 22 | ||
23 | struct bio *mpage_bio_submit(int rw, struct bio *bio); | ||
16 | int mpage_readpages(struct address_space *mapping, struct list_head *pages, | 24 | int mpage_readpages(struct address_space *mapping, struct list_head *pages, |
17 | unsigned nr_pages, get_block_t get_block); | 25 | unsigned nr_pages, get_block_t get_block); |
18 | int mpage_readpage(struct page *page, get_block_t get_block); | 26 | int mpage_readpage(struct page *page, get_block_t get_block); |
27 | int __mpage_writepage(struct page *page, struct writeback_control *wbc, | ||
28 | void *data); | ||
19 | int mpage_writepages(struct address_space *mapping, | 29 | int mpage_writepages(struct address_space *mapping, |
20 | struct writeback_control *wbc, get_block_t get_block); | 30 | struct writeback_control *wbc, get_block_t get_block); |
21 | int mpage_writepage(struct page *page, get_block_t *get_block, | 31 | int mpage_writepage(struct page *page, get_block_t *get_block, |
diff --git a/include/linux/mroute.h b/include/linux/mroute.h index de4decfa1bfc..8a455694d682 100644 --- a/include/linux/mroute.h +++ b/include/linux/mroute.h | |||
@@ -6,7 +6,6 @@ | |||
6 | #ifdef __KERNEL__ | 6 | #ifdef __KERNEL__ |
7 | #include <linux/in.h> | 7 | #include <linux/in.h> |
8 | #endif | 8 | #endif |
9 | #include <linux/pim.h> | ||
10 | 9 | ||
11 | /* | 10 | /* |
12 | * Based on the MROUTING 3.5 defines primarily to keep | 11 | * Based on the MROUTING 3.5 defines primarily to keep |
@@ -130,6 +129,7 @@ struct igmpmsg | |||
130 | */ | 129 | */ |
131 | 130 | ||
132 | #ifdef __KERNEL__ | 131 | #ifdef __KERNEL__ |
132 | #include <linux/pim.h> | ||
133 | #include <net/sock.h> | 133 | #include <net/sock.h> |
134 | 134 | ||
135 | #ifdef CONFIG_IP_MROUTE | 135 | #ifdef CONFIG_IP_MROUTE |
@@ -144,11 +144,37 @@ static inline int ip_mroute_opt(int opt) | |||
144 | } | 144 | } |
145 | #endif | 145 | #endif |
146 | 146 | ||
147 | #ifdef CONFIG_IP_MROUTE | ||
147 | extern int ip_mroute_setsockopt(struct sock *, int, char __user *, int); | 148 | extern int ip_mroute_setsockopt(struct sock *, int, char __user *, int); |
148 | extern int ip_mroute_getsockopt(struct sock *, int, char __user *, int __user *); | 149 | extern int ip_mroute_getsockopt(struct sock *, int, char __user *, int __user *); |
149 | extern int ipmr_ioctl(struct sock *sk, int cmd, void __user *arg); | 150 | extern int ipmr_ioctl(struct sock *sk, int cmd, void __user *arg); |
150 | extern void ip_mr_init(void); | 151 | extern int ip_mr_init(void); |
152 | #else | ||
153 | static inline | ||
154 | int ip_mroute_setsockopt(struct sock *sock, | ||
155 | int optname, char __user *optval, int optlen) | ||
156 | { | ||
157 | return -ENOPROTOOPT; | ||
158 | } | ||
159 | |||
160 | static inline | ||
161 | int ip_mroute_getsockopt(struct sock *sock, | ||
162 | int optname, char __user *optval, int __user *optlen) | ||
163 | { | ||
164 | return -ENOPROTOOPT; | ||
165 | } | ||
166 | |||
167 | static inline | ||
168 | int ipmr_ioctl(struct sock *sk, int cmd, void __user *arg) | ||
169 | { | ||
170 | return -ENOIOCTLCMD; | ||
171 | } | ||
151 | 172 | ||
173 | static inline int ip_mr_init(void) | ||
174 | { | ||
175 | return 0; | ||
176 | } | ||
177 | #endif | ||
152 | 178 | ||
153 | struct vif_device | 179 | struct vif_device |
154 | { | 180 | { |
diff --git a/include/linux/mroute6.h b/include/linux/mroute6.h index e7989593142b..6f4c180179e2 100644 --- a/include/linux/mroute6.h +++ b/include/linux/mroute6.h | |||
@@ -115,6 +115,7 @@ struct sioc_mif_req6 | |||
115 | 115 | ||
116 | #ifdef __KERNEL__ | 116 | #ifdef __KERNEL__ |
117 | 117 | ||
118 | #include <linux/pim.h> | ||
118 | #include <linux/skbuff.h> /* for struct sk_buff_head */ | 119 | #include <linux/skbuff.h> /* for struct sk_buff_head */ |
119 | 120 | ||
120 | #ifdef CONFIG_IPV6_MROUTE | 121 | #ifdef CONFIG_IPV6_MROUTE |
@@ -131,11 +132,44 @@ static inline int ip6_mroute_opt(int opt) | |||
131 | 132 | ||
132 | struct sock; | 133 | struct sock; |
133 | 134 | ||
135 | #ifdef CONFIG_IPV6_MROUTE | ||
134 | extern int ip6_mroute_setsockopt(struct sock *, int, char __user *, int); | 136 | extern int ip6_mroute_setsockopt(struct sock *, int, char __user *, int); |
135 | extern int ip6_mroute_getsockopt(struct sock *, int, char __user *, int __user *); | 137 | extern int ip6_mroute_getsockopt(struct sock *, int, char __user *, int __user *); |
136 | extern int ip6_mr_input(struct sk_buff *skb); | 138 | extern int ip6_mr_input(struct sk_buff *skb); |
137 | extern int ip6mr_ioctl(struct sock *sk, int cmd, void __user *arg); | 139 | extern int ip6mr_ioctl(struct sock *sk, int cmd, void __user *arg); |
138 | extern void ip6_mr_init(void); | 140 | extern int ip6_mr_init(void); |
141 | extern void ip6_mr_cleanup(void); | ||
142 | #else | ||
143 | static inline | ||
144 | int ip6_mroute_setsockopt(struct sock *sock, | ||
145 | int optname, char __user *optval, int optlen) | ||
146 | { | ||
147 | return -ENOPROTOOPT; | ||
148 | } | ||
149 | |||
150 | static inline | ||
151 | int ip6_mroute_getsockopt(struct sock *sock, | ||
152 | int optname, char __user *optval, int __user *optlen) | ||
153 | { | ||
154 | return -ENOPROTOOPT; | ||
155 | } | ||
156 | |||
157 | static inline | ||
158 | int ip6mr_ioctl(struct sock *sk, int cmd, void __user *arg) | ||
159 | { | ||
160 | return -ENOIOCTLCMD; | ||
161 | } | ||
162 | |||
163 | static inline int ip6_mr_init(void) | ||
164 | { | ||
165 | return 0; | ||
166 | } | ||
167 | |||
168 | static inline void ip6_mr_cleanup(void) | ||
169 | { | ||
170 | return; | ||
171 | } | ||
172 | #endif | ||
139 | 173 | ||
140 | struct mif_device | 174 | struct mif_device |
141 | { | 175 | { |
diff --git a/include/linux/msdos_fs.h b/include/linux/msdos_fs.h index 81cd36b735b0..ba63858056c7 100644 --- a/include/linux/msdos_fs.h +++ b/include/linux/msdos_fs.h | |||
@@ -2,11 +2,11 @@ | |||
2 | #define _LINUX_MSDOS_FS_H | 2 | #define _LINUX_MSDOS_FS_H |
3 | 3 | ||
4 | #include <linux/magic.h> | 4 | #include <linux/magic.h> |
5 | #include <asm/byteorder.h> | ||
5 | 6 | ||
6 | /* | 7 | /* |
7 | * The MS-DOS filesystem constants/structures | 8 | * The MS-DOS filesystem constants/structures |
8 | */ | 9 | */ |
9 | #include <asm/byteorder.h> | ||
10 | 10 | ||
11 | #define SECTOR_SIZE 512 /* sector size (bytes) */ | 11 | #define SECTOR_SIZE 512 /* sector size (bytes) */ |
12 | #define SECTOR_BITS 9 /* log2(SECTOR_SIZE) */ | 12 | #define SECTOR_BITS 9 /* log2(SECTOR_SIZE) */ |
@@ -89,24 +89,22 @@ | |||
89 | #define IS_FSINFO(x) (le32_to_cpu((x)->signature1) == FAT_FSINFO_SIG1 \ | 89 | #define IS_FSINFO(x) (le32_to_cpu((x)->signature1) == FAT_FSINFO_SIG1 \ |
90 | && le32_to_cpu((x)->signature2) == FAT_FSINFO_SIG2) | 90 | && le32_to_cpu((x)->signature2) == FAT_FSINFO_SIG2) |
91 | 91 | ||
92 | struct __fat_dirent { | ||
93 | long d_ino; | ||
94 | __kernel_off_t d_off; | ||
95 | unsigned short d_reclen; | ||
96 | char d_name[256]; /* We must not include limits.h! */ | ||
97 | }; | ||
98 | |||
92 | /* | 99 | /* |
93 | * ioctl commands | 100 | * ioctl commands |
94 | */ | 101 | */ |
95 | #define VFAT_IOCTL_READDIR_BOTH _IOR('r', 1, struct dirent [2]) | 102 | #define VFAT_IOCTL_READDIR_BOTH _IOR('r', 1, struct __fat_dirent[2]) |
96 | #define VFAT_IOCTL_READDIR_SHORT _IOR('r', 2, struct dirent [2]) | 103 | #define VFAT_IOCTL_READDIR_SHORT _IOR('r', 2, struct __fat_dirent[2]) |
97 | /* <linux/videotext.h> has used 0x72 ('r') in collision, so skip a few */ | 104 | /* <linux/videotext.h> has used 0x72 ('r') in collision, so skip a few */ |
98 | #define FAT_IOCTL_GET_ATTRIBUTES _IOR('r', 0x10, __u32) | 105 | #define FAT_IOCTL_GET_ATTRIBUTES _IOR('r', 0x10, __u32) |
99 | #define FAT_IOCTL_SET_ATTRIBUTES _IOW('r', 0x11, __u32) | 106 | #define FAT_IOCTL_SET_ATTRIBUTES _IOW('r', 0x11, __u32) |
100 | 107 | ||
101 | /* | ||
102 | * vfat shortname flags | ||
103 | */ | ||
104 | #define VFAT_SFN_DISPLAY_LOWER 0x0001 /* convert to lowercase for display */ | ||
105 | #define VFAT_SFN_DISPLAY_WIN95 0x0002 /* emulate win95 rule for display */ | ||
106 | #define VFAT_SFN_DISPLAY_WINNT 0x0004 /* emulate winnt rule for display */ | ||
107 | #define VFAT_SFN_CREATE_WIN95 0x0100 /* emulate win95 rule for create */ | ||
108 | #define VFAT_SFN_CREATE_WINNT 0x0200 /* emulate winnt rule for create */ | ||
109 | |||
110 | struct fat_boot_sector { | 108 | struct fat_boot_sector { |
111 | __u8 ignored[3]; /* Boot strap short or near jump */ | 109 | __u8 ignored[3]; /* Boot strap short or near jump */ |
112 | __u8 system_id[8]; /* Name - can be used to special case | 110 | __u8 system_id[8]; /* Name - can be used to special case |
@@ -168,14 +166,6 @@ struct msdos_dir_slot { | |||
168 | __u8 name11_12[4]; /* last 2 characters in name */ | 166 | __u8 name11_12[4]; /* last 2 characters in name */ |
169 | }; | 167 | }; |
170 | 168 | ||
171 | struct fat_slot_info { | ||
172 | loff_t i_pos; /* on-disk position of directory entry */ | ||
173 | loff_t slot_off; /* offset for slot or de start */ | ||
174 | int nr_slots; /* number of slots + 1(de) in filename */ | ||
175 | struct msdos_dir_entry *de; | ||
176 | struct buffer_head *bh; | ||
177 | }; | ||
178 | |||
179 | #ifdef __KERNEL__ | 169 | #ifdef __KERNEL__ |
180 | 170 | ||
181 | #include <linux/buffer_head.h> | 171 | #include <linux/buffer_head.h> |
@@ -184,6 +174,15 @@ struct fat_slot_info { | |||
184 | #include <linux/fs.h> | 174 | #include <linux/fs.h> |
185 | #include <linux/mutex.h> | 175 | #include <linux/mutex.h> |
186 | 176 | ||
177 | /* | ||
178 | * vfat shortname flags | ||
179 | */ | ||
180 | #define VFAT_SFN_DISPLAY_LOWER 0x0001 /* convert to lowercase for display */ | ||
181 | #define VFAT_SFN_DISPLAY_WIN95 0x0002 /* emulate win95 rule for display */ | ||
182 | #define VFAT_SFN_DISPLAY_WINNT 0x0004 /* emulate winnt rule for display */ | ||
183 | #define VFAT_SFN_CREATE_WIN95 0x0100 /* emulate win95 rule for create */ | ||
184 | #define VFAT_SFN_CREATE_WINNT 0x0200 /* emulate winnt rule for create */ | ||
185 | |||
187 | struct fat_mount_options { | 186 | struct fat_mount_options { |
188 | uid_t fs_uid; | 187 | uid_t fs_uid; |
189 | gid_t fs_gid; | 188 | gid_t fs_gid; |
@@ -202,10 +201,10 @@ struct fat_mount_options { | |||
202 | utf8:1, /* Use of UTF-8 character set (Default) */ | 201 | utf8:1, /* Use of UTF-8 character set (Default) */ |
203 | unicode_xlate:1, /* create escape sequences for unhandled Unicode */ | 202 | unicode_xlate:1, /* create escape sequences for unhandled Unicode */ |
204 | numtail:1, /* Does first alias have a numeric '~1' type tail? */ | 203 | numtail:1, /* Does first alias have a numeric '~1' type tail? */ |
205 | atari:1, /* Use Atari GEMDOS variation of MS-DOS fs */ | ||
206 | flush:1, /* write things quickly */ | 204 | flush:1, /* write things quickly */ |
207 | nocase:1, /* Does this need case conversion? 0=need case conversion*/ | 205 | nocase:1, /* Does this need case conversion? 0=need case conversion*/ |
208 | usefree:1; /* Use free_clusters for FAT32 */ | 206 | usefree:1, /* Use free_clusters for FAT32 */ |
207 | tz_utc:1; /* Filesystem timestamps are in UTC */ | ||
209 | }; | 208 | }; |
210 | 209 | ||
211 | #define FAT_HASH_BITS 8 | 210 | #define FAT_HASH_BITS 8 |
@@ -267,6 +266,14 @@ struct msdos_inode_info { | |||
267 | struct inode vfs_inode; | 266 | struct inode vfs_inode; |
268 | }; | 267 | }; |
269 | 268 | ||
269 | struct fat_slot_info { | ||
270 | loff_t i_pos; /* on-disk position of directory entry */ | ||
271 | loff_t slot_off; /* offset for slot or de start */ | ||
272 | int nr_slots; /* number of slots + 1(de) in filename */ | ||
273 | struct msdos_dir_entry *de; | ||
274 | struct buffer_head *bh; | ||
275 | }; | ||
276 | |||
270 | static inline struct msdos_sb_info *MSDOS_SB(struct super_block *sb) | 277 | static inline struct msdos_sb_info *MSDOS_SB(struct super_block *sb) |
271 | { | 278 | { |
272 | return sb->s_fs_info; | 279 | return sb->s_fs_info; |
@@ -428,8 +435,9 @@ extern int fat_flush_inodes(struct super_block *sb, struct inode *i1, | |||
428 | extern void fat_fs_panic(struct super_block *s, const char *fmt, ...); | 435 | extern void fat_fs_panic(struct super_block *s, const char *fmt, ...); |
429 | extern void fat_clusters_flush(struct super_block *sb); | 436 | extern void fat_clusters_flush(struct super_block *sb); |
430 | extern int fat_chain_add(struct inode *inode, int new_dclus, int nr_cluster); | 437 | extern int fat_chain_add(struct inode *inode, int new_dclus, int nr_cluster); |
431 | extern int date_dos2unix(unsigned short time, unsigned short date); | 438 | extern int date_dos2unix(unsigned short time, unsigned short date, int tz_utc); |
432 | extern void fat_date_unix2dos(int unix_date, __le16 *time, __le16 *date); | 439 | extern void fat_date_unix2dos(int unix_date, __le16 *time, __le16 *date, |
440 | int tz_utc); | ||
433 | extern int fat_sync_bhs(struct buffer_head **bhs, int nr_bhs); | 441 | extern int fat_sync_bhs(struct buffer_head **bhs, int nr_bhs); |
434 | 442 | ||
435 | int fat_cache_init(void); | 443 | int fat_cache_init(void); |
diff --git a/include/linux/mtd/blktrans.h b/include/linux/mtd/blktrans.h index 9a6e2f953cba..8b4aa0523db7 100644 --- a/include/linux/mtd/blktrans.h +++ b/include/linux/mtd/blktrans.h | |||
@@ -1,6 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * $Id: blktrans.h,v 1.6 2005/11/07 11:14:54 gleixner Exp $ | ||
3 | * | ||
4 | * (C) 2003 David Woodhouse <dwmw2@infradead.org> | 2 | * (C) 2003 David Woodhouse <dwmw2@infradead.org> |
5 | * | 3 | * |
6 | * Interface to Linux block layer for MTD 'translation layers'. | 4 | * Interface to Linux block layer for MTD 'translation layers'. |
@@ -43,6 +41,8 @@ struct mtd_blktrans_ops { | |||
43 | unsigned long block, char *buffer); | 41 | unsigned long block, char *buffer); |
44 | int (*writesect)(struct mtd_blktrans_dev *dev, | 42 | int (*writesect)(struct mtd_blktrans_dev *dev, |
45 | unsigned long block, char *buffer); | 43 | unsigned long block, char *buffer); |
44 | int (*discard)(struct mtd_blktrans_dev *dev, | ||
45 | unsigned long block, unsigned nr_blocks); | ||
46 | 46 | ||
47 | /* Block layer ioctls */ | 47 | /* Block layer ioctls */ |
48 | int (*getgeo)(struct mtd_blktrans_dev *dev, struct hd_geometry *geo); | 48 | int (*getgeo)(struct mtd_blktrans_dev *dev, struct hd_geometry *geo); |
diff --git a/include/linux/mtd/cfi.h b/include/linux/mtd/cfi.h index b0ddf4b25862..d6fb115f5a07 100644 --- a/include/linux/mtd/cfi.h +++ b/include/linux/mtd/cfi.h | |||
@@ -1,7 +1,6 @@ | |||
1 | 1 | ||
2 | /* Common Flash Interface structures | 2 | /* Common Flash Interface structures |
3 | * See http://support.intel.com/design/flash/technote/index.htm | 3 | * See http://support.intel.com/design/flash/technote/index.htm |
4 | * $Id: cfi.h,v 1.57 2005/11/15 23:28:17 tpoynor Exp $ | ||
5 | */ | 4 | */ |
6 | 5 | ||
7 | #ifndef __MTD_CFI_H__ | 6 | #ifndef __MTD_CFI_H__ |
diff --git a/include/linux/mtd/cfi_endian.h b/include/linux/mtd/cfi_endian.h index 25724f7d3867..d802f7736be3 100644 --- a/include/linux/mtd/cfi_endian.h +++ b/include/linux/mtd/cfi_endian.h | |||
@@ -1,8 +1,3 @@ | |||
1 | /* | ||
2 | * $Id: cfi_endian.h,v 1.11 2002/01/30 23:20:48 awozniak Exp $ | ||
3 | * | ||
4 | */ | ||
5 | |||
6 | #include <asm/byteorder.h> | 1 | #include <asm/byteorder.h> |
7 | 2 | ||
8 | #ifndef CONFIG_MTD_CFI_ADV_OPTIONS | 3 | #ifndef CONFIG_MTD_CFI_ADV_OPTIONS |
diff --git a/include/linux/mtd/concat.h b/include/linux/mtd/concat.h index ed8dc6755219..c02f3d264ecf 100644 --- a/include/linux/mtd/concat.h +++ b/include/linux/mtd/concat.h | |||
@@ -4,8 +4,6 @@ | |||
4 | * (C) 2002 Robert Kaiser <rkaiser@sysgo.de> | 4 | * (C) 2002 Robert Kaiser <rkaiser@sysgo.de> |
5 | * | 5 | * |
6 | * This code is GPL | 6 | * This code is GPL |
7 | * | ||
8 | * $Id: concat.h,v 1.1 2002/03/08 16:34:36 rkaiser Exp $ | ||
9 | */ | 7 | */ |
10 | 8 | ||
11 | #ifndef MTD_CONCAT_H | 9 | #ifndef MTD_CONCAT_H |
diff --git a/include/linux/mtd/doc2000.h b/include/linux/mtd/doc2000.h index 9addd073bf15..0a6d516ab71d 100644 --- a/include/linux/mtd/doc2000.h +++ b/include/linux/mtd/doc2000.h | |||
@@ -6,8 +6,6 @@ | |||
6 | * Copyright (C) 2002-2003 Greg Ungerer <gerg@snapgear.com> | 6 | * Copyright (C) 2002-2003 Greg Ungerer <gerg@snapgear.com> |
7 | * Copyright (C) 2002-2003 SnapGear Inc | 7 | * Copyright (C) 2002-2003 SnapGear Inc |
8 | * | 8 | * |
9 | * $Id: doc2000.h,v 1.25 2005/11/07 11:14:54 gleixner Exp $ | ||
10 | * | ||
11 | * Released under GPL | 9 | * Released under GPL |
12 | */ | 10 | */ |
13 | 11 | ||
diff --git a/include/linux/mtd/flashchip.h b/include/linux/mtd/flashchip.h index 39e7d2a1be9a..08dd131301c1 100644 --- a/include/linux/mtd/flashchip.h +++ b/include/linux/mtd/flashchip.h | |||
@@ -5,9 +5,6 @@ | |||
5 | * Contains information about the location and state of a given flash device | 5 | * Contains information about the location and state of a given flash device |
6 | * | 6 | * |
7 | * (C) 2000 Red Hat. GPLd. | 7 | * (C) 2000 Red Hat. GPLd. |
8 | * | ||
9 | * $Id: flashchip.h,v 1.18 2005/11/07 11:14:54 gleixner Exp $ | ||
10 | * | ||
11 | */ | 8 | */ |
12 | 9 | ||
13 | #ifndef __MTD_FLASHCHIP_H__ | 10 | #ifndef __MTD_FLASHCHIP_H__ |
diff --git a/include/linux/mtd/ftl.h b/include/linux/mtd/ftl.h index d99609113307..0be442f881dd 100644 --- a/include/linux/mtd/ftl.h +++ b/include/linux/mtd/ftl.h | |||
@@ -1,6 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * $Id: ftl.h,v 1.7 2005/11/07 11:14:54 gleixner Exp $ | ||
3 | * | ||
4 | * Derived from (and probably identical to): | 2 | * Derived from (and probably identical to): |
5 | * ftl.h 1.7 1999/10/25 20:23:17 | 3 | * ftl.h 1.7 1999/10/25 20:23:17 |
6 | * | 4 | * |
diff --git a/include/linux/mtd/gen_probe.h b/include/linux/mtd/gen_probe.h index 256e7342ed1e..df362ddf2949 100644 --- a/include/linux/mtd/gen_probe.h +++ b/include/linux/mtd/gen_probe.h | |||
@@ -1,7 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * (C) 2001, 2001 Red Hat, Inc. | 2 | * (C) 2001, 2001 Red Hat, Inc. |
3 | * GPL'd | 3 | * GPL'd |
4 | * $Id: gen_probe.h,v 1.4 2005/11/07 11:14:54 gleixner Exp $ | ||
5 | */ | 4 | */ |
6 | 5 | ||
7 | #ifndef __LINUX_MTD_GEN_PROBE_H__ | 6 | #ifndef __LINUX_MTD_GEN_PROBE_H__ |
diff --git a/include/linux/mtd/inftl.h b/include/linux/mtd/inftl.h index 85fd041d44ad..64ee53ce95a9 100644 --- a/include/linux/mtd/inftl.h +++ b/include/linux/mtd/inftl.h | |||
@@ -2,8 +2,6 @@ | |||
2 | * inftl.h -- defines to support the Inverse NAND Flash Translation Layer | 2 | * inftl.h -- defines to support the Inverse NAND Flash Translation Layer |
3 | * | 3 | * |
4 | * (C) Copyright 2002, Greg Ungerer (gerg@snapgear.com) | 4 | * (C) Copyright 2002, Greg Ungerer (gerg@snapgear.com) |
5 | * | ||
6 | * $Id: inftl.h,v 1.7 2005/06/13 13:08:45 sean Exp $ | ||
7 | */ | 5 | */ |
8 | 6 | ||
9 | #ifndef __MTD_INFTL_H__ | 7 | #ifndef __MTD_INFTL_H__ |
@@ -52,8 +50,6 @@ struct INFTLrecord { | |||
52 | int INFTL_mount(struct INFTLrecord *s); | 50 | int INFTL_mount(struct INFTLrecord *s); |
53 | int INFTL_formatblock(struct INFTLrecord *s, int block); | 51 | int INFTL_formatblock(struct INFTLrecord *s, int block); |
54 | 52 | ||
55 | extern char inftlmountrev[]; | ||
56 | |||
57 | void INFTL_dumptables(struct INFTLrecord *s); | 53 | void INFTL_dumptables(struct INFTLrecord *s); |
58 | void INFTL_dumpVUchains(struct INFTLrecord *s); | 54 | void INFTL_dumpVUchains(struct INFTLrecord *s); |
59 | 55 | ||
diff --git a/include/linux/mtd/map.h b/include/linux/mtd/map.h index a9fae032ba81..aa30244492c6 100644 --- a/include/linux/mtd/map.h +++ b/include/linux/mtd/map.h | |||
@@ -1,6 +1,5 @@ | |||
1 | 1 | ||
2 | /* Overhauled routines for dealing with different mmap regions of flash */ | 2 | /* Overhauled routines for dealing with different mmap regions of flash */ |
3 | /* $Id: map.h,v 1.54 2005/11/07 11:14:54 gleixner Exp $ */ | ||
4 | 3 | ||
5 | #ifndef __LINUX_MTD_MAP_H__ | 4 | #ifndef __LINUX_MTD_MAP_H__ |
6 | #define __LINUX_MTD_MAP_H__ | 5 | #define __LINUX_MTD_MAP_H__ |
@@ -189,7 +188,7 @@ typedef union { | |||
189 | */ | 188 | */ |
190 | 189 | ||
191 | struct map_info { | 190 | struct map_info { |
192 | char *name; | 191 | const char *name; |
193 | unsigned long size; | 192 | unsigned long size; |
194 | resource_size_t phys; | 193 | resource_size_t phys; |
195 | #define NO_XIP (-1UL) | 194 | #define NO_XIP (-1UL) |
diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h index 245f9098e171..922636548558 100644 --- a/include/linux/mtd/mtd.h +++ b/include/linux/mtd/mtd.h | |||
@@ -1,6 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * $Id: mtd.h,v 1.61 2005/11/07 11:14:54 gleixner Exp $ | ||
3 | * | ||
4 | * Copyright (C) 1999-2003 David Woodhouse <dwmw2@infradead.org> et al. | 2 | * Copyright (C) 1999-2003 David Woodhouse <dwmw2@infradead.org> et al. |
5 | * | 3 | * |
6 | * Released under GPL | 4 | * Released under GPL |
@@ -121,7 +119,7 @@ struct mtd_info { | |||
121 | u_int32_t oobavail; // Available OOB bytes per block | 119 | u_int32_t oobavail; // Available OOB bytes per block |
122 | 120 | ||
123 | // Kernel-only stuff starts here. | 121 | // Kernel-only stuff starts here. |
124 | char *name; | 122 | const char *name; |
125 | int index; | 123 | int index; |
126 | 124 | ||
127 | /* ecc layout structure pointer - read only ! */ | 125 | /* ecc layout structure pointer - read only ! */ |
@@ -274,7 +272,11 @@ static inline void mtd_erase_callback(struct erase_info *instr) | |||
274 | printk(KERN_INFO args); \ | 272 | printk(KERN_INFO args); \ |
275 | } while(0) | 273 | } while(0) |
276 | #else /* CONFIG_MTD_DEBUG */ | 274 | #else /* CONFIG_MTD_DEBUG */ |
277 | #define DEBUG(n, args...) do { } while(0) | 275 | #define DEBUG(n, args...) \ |
276 | do { \ | ||
277 | if (0) \ | ||
278 | printk(KERN_INFO args); \ | ||
279 | } while(0) | ||
278 | 280 | ||
279 | #endif /* CONFIG_MTD_DEBUG */ | 281 | #endif /* CONFIG_MTD_DEBUG */ |
280 | 282 | ||
diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h index 53ea3dc8b0e8..81774e5facf4 100644 --- a/include/linux/mtd/nand.h +++ b/include/linux/mtd/nand.h | |||
@@ -5,8 +5,6 @@ | |||
5 | * Steven J. Hill <sjhill@realitydiluted.com> | 5 | * Steven J. Hill <sjhill@realitydiluted.com> |
6 | * Thomas Gleixner <tglx@linutronix.de> | 6 | * Thomas Gleixner <tglx@linutronix.de> |
7 | * | 7 | * |
8 | * $Id: nand.h,v 1.74 2005/09/15 13:58:50 vwool Exp $ | ||
9 | * | ||
10 | * 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 |
11 | * it under the terms of the GNU General Public License version 2 as | 9 | * it under the terms of the GNU General Public License version 2 as |
12 | * published by the Free Software Foundation. | 10 | * published by the Free Software Foundation. |
@@ -179,6 +177,9 @@ typedef enum { | |||
179 | #define NAND_MUST_PAD(chip) (!(chip->options & NAND_NO_PADDING)) | 177 | #define NAND_MUST_PAD(chip) (!(chip->options & NAND_NO_PADDING)) |
180 | #define NAND_HAS_CACHEPROG(chip) ((chip->options & NAND_CACHEPRG)) | 178 | #define NAND_HAS_CACHEPROG(chip) ((chip->options & NAND_CACHEPRG)) |
181 | #define NAND_HAS_COPYBACK(chip) ((chip->options & NAND_COPYBACK)) | 179 | #define NAND_HAS_COPYBACK(chip) ((chip->options & NAND_COPYBACK)) |
180 | /* Large page NAND with SOFT_ECC should support subpage reads */ | ||
181 | #define NAND_SUBPAGE_READ(chip) ((chip->ecc.mode == NAND_ECC_SOFT) \ | ||
182 | && (chip->page_shift > 9)) | ||
182 | 183 | ||
183 | /* Mask to zero out the chip options, which come from the id table */ | 184 | /* Mask to zero out the chip options, which come from the id table */ |
184 | #define NAND_CHIPOPTIONS_MSK (0x0000ffff & ~NAND_NO_AUTOINCR) | 185 | #define NAND_CHIPOPTIONS_MSK (0x0000ffff & ~NAND_NO_AUTOINCR) |
@@ -276,6 +277,10 @@ struct nand_ecc_ctrl { | |||
276 | int (*read_page)(struct mtd_info *mtd, | 277 | int (*read_page)(struct mtd_info *mtd, |
277 | struct nand_chip *chip, | 278 | struct nand_chip *chip, |
278 | uint8_t *buf); | 279 | uint8_t *buf); |
280 | int (*read_subpage)(struct mtd_info *mtd, | ||
281 | struct nand_chip *chip, | ||
282 | uint32_t offs, uint32_t len, | ||
283 | uint8_t *buf); | ||
279 | void (*write_page)(struct mtd_info *mtd, | 284 | void (*write_page)(struct mtd_info *mtd, |
280 | struct nand_chip *chip, | 285 | struct nand_chip *chip, |
281 | const uint8_t *buf); | 286 | const uint8_t *buf); |
diff --git a/include/linux/mtd/nand_ecc.h b/include/linux/mtd/nand_ecc.h index 12c5bc342ead..090da505425d 100644 --- a/include/linux/mtd/nand_ecc.h +++ b/include/linux/mtd/nand_ecc.h | |||
@@ -3,8 +3,6 @@ | |||
3 | * | 3 | * |
4 | * Copyright (C) 2000 Steven J. Hill (sjhill@realitydiluted.com) | 4 | * Copyright (C) 2000 Steven J. Hill (sjhill@realitydiluted.com) |
5 | * | 5 | * |
6 | * $Id: nand_ecc.h,v 1.4 2004/06/17 02:35:02 dbrown Exp $ | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | 6 | * This program is free software; you can redistribute it and/or modify |
9 | * it under the terms of the GNU General Public License version 2 as | 7 | * it under the terms of the GNU General Public License version 2 as |
10 | * published by the Free Software Foundation. | 8 | * published by the Free Software Foundation. |
diff --git a/include/linux/mtd/nftl.h b/include/linux/mtd/nftl.h index 001eec50cac6..dcaf611ed748 100644 --- a/include/linux/mtd/nftl.h +++ b/include/linux/mtd/nftl.h | |||
@@ -1,6 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * $Id: nftl.h,v 1.16 2004/06/30 14:49:00 dbrown Exp $ | ||
3 | * | ||
4 | * (C) 1999-2003 David Woodhouse <dwmw2@infradead.org> | 2 | * (C) 1999-2003 David Woodhouse <dwmw2@infradead.org> |
5 | */ | 3 | */ |
6 | 4 | ||
diff --git a/include/linux/mtd/partitions.h b/include/linux/mtd/partitions.h index 7c37d7e55abc..5014f7a9f5df 100644 --- a/include/linux/mtd/partitions.h +++ b/include/linux/mtd/partitions.h | |||
@@ -4,8 +4,6 @@ | |||
4 | * (C) 2000 Nicolas Pitre <nico@cam.org> | 4 | * (C) 2000 Nicolas Pitre <nico@cam.org> |
5 | * | 5 | * |
6 | * This code is GPL | 6 | * This code is GPL |
7 | * | ||
8 | * $Id: partitions.h,v 1.17 2005/11/07 11:14:55 gleixner Exp $ | ||
9 | */ | 7 | */ |
10 | 8 | ||
11 | #ifndef MTD_PARTITIONS_H | 9 | #ifndef MTD_PARTITIONS_H |
diff --git a/include/linux/mtd/physmap.h b/include/linux/mtd/physmap.h index 0dc07d5f3354..c8e63a5ee72e 100644 --- a/include/linux/mtd/physmap.h +++ b/include/linux/mtd/physmap.h | |||
@@ -2,8 +2,6 @@ | |||
2 | * For boards with physically mapped flash and using | 2 | * For boards with physically mapped flash and using |
3 | * drivers/mtd/maps/physmap.c mapping driver. | 3 | * drivers/mtd/maps/physmap.c mapping driver. |
4 | * | 4 | * |
5 | * $Id: physmap.h,v 1.4 2005/11/07 11:14:55 gleixner Exp $ | ||
6 | * | ||
7 | * Copyright (C) 2003 MontaVista Software Inc. | 5 | * Copyright (C) 2003 MontaVista Software Inc. |
8 | * Author: Jun Sun, jsun@mvista.com or jsun@junsun.net | 6 | * Author: Jun Sun, jsun@mvista.com or jsun@junsun.net |
9 | * | 7 | * |
diff --git a/include/linux/mtd/plat-ram.h b/include/linux/mtd/plat-ram.h index 0e37ad07bce2..e07890aff1cf 100644 --- a/include/linux/mtd/plat-ram.h +++ b/include/linux/mtd/plat-ram.h | |||
@@ -6,8 +6,6 @@ | |||
6 | * | 6 | * |
7 | * Generic platform device based RAM map | 7 | * Generic platform device based RAM map |
8 | * | 8 | * |
9 | * $Id: plat-ram.h,v 1.2 2005/01/24 00:37:40 bjd Exp $ | ||
10 | * | ||
11 | * This program is free software; you can redistribute it and/or modify | 9 | * This program is free software; you can redistribute it and/or modify |
12 | * it under the terms of the GNU General Public License version 2 as | 10 | * it under the terms of the GNU General Public License version 2 as |
13 | * published by the Free Software Foundation. | 11 | * published by the Free Software Foundation. |
diff --git a/include/linux/mtd/pmc551.h b/include/linux/mtd/pmc551.h index 5cc070c24d88..27ad40aed19f 100644 --- a/include/linux/mtd/pmc551.h +++ b/include/linux/mtd/pmc551.h | |||
@@ -1,6 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * $Id: pmc551.h,v 1.6 2005/11/07 11:14:55 gleixner Exp $ | ||
3 | * | ||
4 | * PMC551 PCI Mezzanine Ram Device | 2 | * PMC551 PCI Mezzanine Ram Device |
5 | * | 3 | * |
6 | * Author: | 4 | * Author: |
@@ -17,7 +15,7 @@ | |||
17 | 15 | ||
18 | #include <linux/mtd/mtd.h> | 16 | #include <linux/mtd/mtd.h> |
19 | 17 | ||
20 | #define PMC551_VERSION "$Id: pmc551.h,v 1.6 2005/11/07 11:14:55 gleixner Exp $\n"\ | 18 | #define PMC551_VERSION \ |
21 | "Ramix PMC551 PCI Mezzanine Ram Driver. (C) 1999,2000 Nortel Networks.\n" | 19 | "Ramix PMC551 PCI Mezzanine Ram Driver. (C) 1999,2000 Nortel Networks.\n" |
22 | 20 | ||
23 | /* | 21 | /* |
diff --git a/include/linux/mtd/ubi.h b/include/linux/mtd/ubi.h index f71201d0f3e7..6316fafe5c2a 100644 --- a/include/linux/mtd/ubi.h +++ b/include/linux/mtd/ubi.h | |||
@@ -45,13 +45,13 @@ enum { | |||
45 | * @size: how many physical eraseblocks are reserved for this volume | 45 | * @size: how many physical eraseblocks are reserved for this volume |
46 | * @used_bytes: how many bytes of data this volume contains | 46 | * @used_bytes: how many bytes of data this volume contains |
47 | * @used_ebs: how many physical eraseblocks of this volume actually contain any | 47 | * @used_ebs: how many physical eraseblocks of this volume actually contain any |
48 | * data | 48 | * data |
49 | * @vol_type: volume type (%UBI_DYNAMIC_VOLUME or %UBI_STATIC_VOLUME) | 49 | * @vol_type: volume type (%UBI_DYNAMIC_VOLUME or %UBI_STATIC_VOLUME) |
50 | * @corrupted: non-zero if the volume is corrupted (static volumes only) | 50 | * @corrupted: non-zero if the volume is corrupted (static volumes only) |
51 | * @upd_marker: non-zero if the volume has update marker set | 51 | * @upd_marker: non-zero if the volume has update marker set |
52 | * @alignment: volume alignment | 52 | * @alignment: volume alignment |
53 | * @usable_leb_size: how many bytes are available in logical eraseblocks of | 53 | * @usable_leb_size: how many bytes are available in logical eraseblocks of |
54 | * this volume | 54 | * this volume |
55 | * @name_len: volume name length | 55 | * @name_len: volume name length |
56 | * @name: volume name | 56 | * @name: volume name |
57 | * @cdev: UBI volume character device major and minor numbers | 57 | * @cdev: UBI volume character device major and minor numbers |
@@ -152,6 +152,7 @@ int ubi_leb_erase(struct ubi_volume_desc *desc, int lnum); | |||
152 | int ubi_leb_unmap(struct ubi_volume_desc *desc, int lnum); | 152 | int ubi_leb_unmap(struct ubi_volume_desc *desc, int lnum); |
153 | int ubi_leb_map(struct ubi_volume_desc *desc, int lnum, int dtype); | 153 | int ubi_leb_map(struct ubi_volume_desc *desc, int lnum, int dtype); |
154 | int ubi_is_mapped(struct ubi_volume_desc *desc, int lnum); | 154 | int ubi_is_mapped(struct ubi_volume_desc *desc, int lnum); |
155 | int ubi_sync(int ubi_num); | ||
155 | 156 | ||
156 | /* | 157 | /* |
157 | * This function is the same as the 'ubi_leb_read()' function, but it does not | 158 | * This function is the same as the 'ubi_leb_read()' function, but it does not |
diff --git a/include/linux/mtd/xip.h b/include/linux/mtd/xip.h index e9d40bdde48c..36efcba15ecd 100644 --- a/include/linux/mtd/xip.h +++ b/include/linux/mtd/xip.h | |||
@@ -11,8 +11,6 @@ | |||
11 | * This program is free software; you can redistribute it and/or modify | 11 | * This program is free software; you can redistribute it and/or modify |
12 | * it under the terms of the GNU General Public License version 2 as | 12 | * it under the terms of the GNU General Public License version 2 as |
13 | * published by the Free Software Foundation. | 13 | * published by the Free Software Foundation. |
14 | * | ||
15 | * $Id: xip.h,v 1.5 2005/11/07 11:14:55 gleixner Exp $ | ||
16 | */ | 14 | */ |
17 | 15 | ||
18 | #ifndef __LINUX_MTD_XIP_H__ | 16 | #ifndef __LINUX_MTD_XIP_H__ |
diff --git a/include/linux/mv643xx_eth.h b/include/linux/mv643xx_eth.h index a15cdd4a8e58..cbbbe9bfecad 100644 --- a/include/linux/mv643xx_eth.h +++ b/include/linux/mv643xx_eth.h | |||
@@ -17,30 +17,62 @@ | |||
17 | 17 | ||
18 | struct mv643xx_eth_shared_platform_data { | 18 | struct mv643xx_eth_shared_platform_data { |
19 | struct mbus_dram_target_info *dram; | 19 | struct mbus_dram_target_info *dram; |
20 | unsigned int t_clk; | 20 | struct platform_device *shared_smi; |
21 | unsigned int t_clk; | ||
21 | }; | 22 | }; |
22 | 23 | ||
24 | #define MV643XX_ETH_PHY_ADDR_DEFAULT 0 | ||
25 | #define MV643XX_ETH_PHY_ADDR(x) (0x80 | (x)) | ||
26 | #define MV643XX_ETH_PHY_NONE 0xff | ||
27 | |||
23 | struct mv643xx_eth_platform_data { | 28 | struct mv643xx_eth_platform_data { |
29 | /* | ||
30 | * Pointer back to our parent instance, and our port number. | ||
31 | */ | ||
24 | struct platform_device *shared; | 32 | struct platform_device *shared; |
25 | int port_number; | 33 | int port_number; |
26 | 34 | ||
27 | struct platform_device *shared_smi; | 35 | /* |
36 | * Whether a PHY is present, and if yes, at which address. | ||
37 | */ | ||
38 | int phy_addr; | ||
39 | |||
40 | /* | ||
41 | * Use this MAC address if it is valid, overriding the | ||
42 | * address that is already in the hardware. | ||
43 | */ | ||
44 | u8 mac_addr[6]; | ||
28 | 45 | ||
29 | u16 force_phy_addr; /* force override if phy_addr == 0 */ | 46 | /* |
30 | u16 phy_addr; | 47 | * If speed is 0, autonegotiation is enabled. |
31 | 48 | * Valid values for speed: 0, SPEED_10, SPEED_100, SPEED_1000. | |
32 | /* If speed is 0, then speed and duplex are autonegotiated. */ | 49 | * Valid values for duplex: DUPLEX_HALF, DUPLEX_FULL. |
33 | int speed; /* 0, SPEED_10, SPEED_100, SPEED_1000 */ | 50 | */ |
34 | int duplex; /* DUPLEX_HALF or DUPLEX_FULL */ | 51 | int speed; |
35 | 52 | int duplex; | |
36 | /* non-zero values of the following fields override defaults */ | 53 | |
37 | u32 tx_queue_size; | 54 | /* |
38 | u32 rx_queue_size; | 55 | * How many RX/TX queues to use. |
39 | u32 tx_sram_addr; | 56 | */ |
40 | u32 tx_sram_size; | 57 | int rx_queue_count; |
41 | u32 rx_sram_addr; | 58 | int tx_queue_count; |
42 | u32 rx_sram_size; | 59 | |
43 | u8 mac_addr[6]; /* mac address if non-zero*/ | 60 | /* |
61 | * Override default RX/TX queue sizes if nonzero. | ||
62 | */ | ||
63 | int rx_queue_size; | ||
64 | int tx_queue_size; | ||
65 | |||
66 | /* | ||
67 | * Use on-chip SRAM for RX/TX descriptors if size is nonzero | ||
68 | * and sufficient to contain all descriptors for the requested | ||
69 | * ring sizes. | ||
70 | */ | ||
71 | unsigned long rx_sram_addr; | ||
72 | int rx_sram_size; | ||
73 | unsigned long tx_sram_addr; | ||
74 | int tx_sram_size; | ||
44 | }; | 75 | }; |
45 | 76 | ||
46 | #endif /* __LINUX_MV643XX_ETH_H */ | 77 | |
78 | #endif | ||
diff --git a/include/linux/namei.h b/include/linux/namei.h index 24d88e98a626..68f8c3203c89 100644 --- a/include/linux/namei.h +++ b/include/linux/namei.h | |||
@@ -47,27 +47,24 @@ enum {LAST_NORM, LAST_ROOT, LAST_DOT, LAST_DOTDOT, LAST_BIND}; | |||
47 | #define LOOKUP_DIRECTORY 2 | 47 | #define LOOKUP_DIRECTORY 2 |
48 | #define LOOKUP_CONTINUE 4 | 48 | #define LOOKUP_CONTINUE 4 |
49 | #define LOOKUP_PARENT 16 | 49 | #define LOOKUP_PARENT 16 |
50 | #define LOOKUP_NOALT 32 | ||
51 | #define LOOKUP_REVAL 64 | 50 | #define LOOKUP_REVAL 64 |
52 | /* | 51 | /* |
53 | * Intent data | 52 | * Intent data |
54 | */ | 53 | */ |
55 | #define LOOKUP_OPEN (0x0100) | 54 | #define LOOKUP_OPEN (0x0100) |
56 | #define LOOKUP_CREATE (0x0200) | 55 | #define LOOKUP_CREATE (0x0200) |
57 | #define LOOKUP_ACCESS (0x0400) | 56 | |
58 | #define LOOKUP_CHDIR (0x0800) | 57 | extern int user_path_at(int, const char __user *, unsigned, struct path *); |
59 | 58 | ||
60 | extern int __user_walk(const char __user *, unsigned, struct nameidata *); | 59 | #define user_path(name, path) user_path_at(AT_FDCWD, name, LOOKUP_FOLLOW, path) |
61 | extern int __user_walk_fd(int dfd, const char __user *, unsigned, struct nameidata *); | 60 | #define user_lpath(name, path) user_path_at(AT_FDCWD, name, 0, path) |
62 | #define user_path_walk(name,nd) \ | 61 | #define user_path_dir(name, path) \ |
63 | __user_walk_fd(AT_FDCWD, name, LOOKUP_FOLLOW, nd) | 62 | user_path_at(AT_FDCWD, name, LOOKUP_FOLLOW | LOOKUP_DIRECTORY, path) |
64 | #define user_path_walk_link(name,nd) \ | 63 | |
65 | __user_walk_fd(AT_FDCWD, name, 0, nd) | ||
66 | extern int path_lookup(const char *, unsigned, struct nameidata *); | 64 | extern int path_lookup(const char *, unsigned, struct nameidata *); |
67 | extern int vfs_path_lookup(struct dentry *, struct vfsmount *, | 65 | extern int vfs_path_lookup(struct dentry *, struct vfsmount *, |
68 | const char *, unsigned int, struct nameidata *); | 66 | const char *, unsigned int, struct nameidata *); |
69 | 67 | ||
70 | extern int __user_path_lookup_open(const char __user *, unsigned lookup_flags, struct nameidata *nd, int open_flags); | ||
71 | extern int path_lookup_open(int dfd, const char *name, unsigned lookup_flags, struct nameidata *, int open_flags); | 68 | extern int path_lookup_open(int dfd, const char *name, unsigned lookup_flags, struct nameidata *, int open_flags); |
72 | extern struct file *lookup_instantiate_filp(struct nameidata *nd, struct dentry *dentry, | 69 | extern struct file *lookup_instantiate_filp(struct nameidata *nd, struct dentry *dentry, |
73 | int (*open)(struct inode *, struct file *)); | 70 | int (*open)(struct inode *, struct file *)); |
diff --git a/include/linux/net.h b/include/linux/net.h index 71f7dd559285..6dc14a240042 100644 --- a/include/linux/net.h +++ b/include/linux/net.h | |||
@@ -18,15 +18,9 @@ | |||
18 | #ifndef _LINUX_NET_H | 18 | #ifndef _LINUX_NET_H |
19 | #define _LINUX_NET_H | 19 | #define _LINUX_NET_H |
20 | 20 | ||
21 | #include <linux/wait.h> | ||
22 | #include <linux/socket.h> | 21 | #include <linux/socket.h> |
23 | #include <asm/socket.h> | 22 | #include <asm/socket.h> |
24 | 23 | ||
25 | struct poll_table_struct; | ||
26 | struct pipe_inode_info; | ||
27 | struct inode; | ||
28 | struct net; | ||
29 | |||
30 | #define NPROTO AF_MAX | 24 | #define NPROTO AF_MAX |
31 | 25 | ||
32 | #define SYS_SOCKET 1 /* sys_socket(2) */ | 26 | #define SYS_SOCKET 1 /* sys_socket(2) */ |
@@ -46,6 +40,7 @@ struct net; | |||
46 | #define SYS_GETSOCKOPT 15 /* sys_getsockopt(2) */ | 40 | #define SYS_GETSOCKOPT 15 /* sys_getsockopt(2) */ |
47 | #define SYS_SENDMSG 16 /* sys_sendmsg(2) */ | 41 | #define SYS_SENDMSG 16 /* sys_sendmsg(2) */ |
48 | #define SYS_RECVMSG 17 /* sys_recvmsg(2) */ | 42 | #define SYS_RECVMSG 17 /* sys_recvmsg(2) */ |
43 | #define SYS_PACCEPT 18 /* sys_paccept(2) */ | ||
49 | 44 | ||
50 | typedef enum { | 45 | typedef enum { |
51 | SS_FREE = 0, /* not allocated */ | 46 | SS_FREE = 0, /* not allocated */ |
@@ -60,6 +55,13 @@ typedef enum { | |||
60 | #ifdef __KERNEL__ | 55 | #ifdef __KERNEL__ |
61 | #include <linux/stringify.h> | 56 | #include <linux/stringify.h> |
62 | #include <linux/random.h> | 57 | #include <linux/random.h> |
58 | #include <linux/wait.h> | ||
59 | #include <linux/fcntl.h> /* For O_CLOEXEC and O_NONBLOCK */ | ||
60 | |||
61 | struct poll_table_struct; | ||
62 | struct pipe_inode_info; | ||
63 | struct inode; | ||
64 | struct net; | ||
63 | 65 | ||
64 | #define SOCK_ASYNC_NOSPACE 0 | 66 | #define SOCK_ASYNC_NOSPACE 0 |
65 | #define SOCK_ASYNC_WAITDATA 1 | 67 | #define SOCK_ASYNC_WAITDATA 1 |
@@ -94,6 +96,15 @@ enum sock_type { | |||
94 | }; | 96 | }; |
95 | 97 | ||
96 | #define SOCK_MAX (SOCK_PACKET + 1) | 98 | #define SOCK_MAX (SOCK_PACKET + 1) |
99 | /* Mask which covers at least up to SOCK_MASK-1. The | ||
100 | * remaining bits are used as flags. */ | ||
101 | #define SOCK_TYPE_MASK 0xf | ||
102 | |||
103 | /* Flags for socket, socketpair, paccept */ | ||
104 | #define SOCK_CLOEXEC O_CLOEXEC | ||
105 | #ifndef SOCK_NONBLOCK | ||
106 | #define SOCK_NONBLOCK O_NONBLOCK | ||
107 | #endif | ||
97 | 108 | ||
98 | #endif /* ARCH_HAS_SOCKET_TYPES */ | 109 | #endif /* ARCH_HAS_SOCKET_TYPES */ |
99 | 110 | ||
@@ -106,23 +117,23 @@ enum sock_shutdown_cmd { | |||
106 | /** | 117 | /** |
107 | * struct socket - general BSD socket | 118 | * struct socket - general BSD socket |
108 | * @state: socket state (%SS_CONNECTED, etc) | 119 | * @state: socket state (%SS_CONNECTED, etc) |
120 | * @type: socket type (%SOCK_STREAM, etc) | ||
109 | * @flags: socket flags (%SOCK_ASYNC_NOSPACE, etc) | 121 | * @flags: socket flags (%SOCK_ASYNC_NOSPACE, etc) |
110 | * @ops: protocol specific socket operations | 122 | * @ops: protocol specific socket operations |
111 | * @fasync_list: Asynchronous wake up list | 123 | * @fasync_list: Asynchronous wake up list |
112 | * @file: File back pointer for gc | 124 | * @file: File back pointer for gc |
113 | * @sk: internal networking protocol agnostic socket representation | 125 | * @sk: internal networking protocol agnostic socket representation |
114 | * @wait: wait queue for several uses | 126 | * @wait: wait queue for several uses |
115 | * @type: socket type (%SOCK_STREAM, etc) | ||
116 | */ | 127 | */ |
117 | struct socket { | 128 | struct socket { |
118 | socket_state state; | 129 | socket_state state; |
130 | short type; | ||
119 | unsigned long flags; | 131 | unsigned long flags; |
120 | const struct proto_ops *ops; | 132 | const struct proto_ops *ops; |
121 | struct fasync_struct *fasync_list; | 133 | struct fasync_struct *fasync_list; |
122 | struct file *file; | 134 | struct file *file; |
123 | struct sock *sk; | 135 | struct sock *sk; |
124 | wait_queue_head_t wait; | 136 | wait_queue_head_t wait; |
125 | short type; | ||
126 | }; | 137 | }; |
127 | 138 | ||
128 | struct vm_area_struct; | 139 | struct vm_area_struct; |
@@ -208,10 +219,12 @@ extern int sock_sendmsg(struct socket *sock, struct msghdr *msg, | |||
208 | size_t len); | 219 | size_t len); |
209 | extern int sock_recvmsg(struct socket *sock, struct msghdr *msg, | 220 | extern int sock_recvmsg(struct socket *sock, struct msghdr *msg, |
210 | size_t size, int flags); | 221 | size_t size, int flags); |
211 | extern int sock_map_fd(struct socket *sock); | 222 | extern int sock_map_fd(struct socket *sock, int flags); |
212 | extern struct socket *sockfd_lookup(int fd, int *err); | 223 | extern struct socket *sockfd_lookup(int fd, int *err); |
213 | #define sockfd_put(sock) fput(sock->file) | 224 | #define sockfd_put(sock) fput(sock->file) |
214 | extern int net_ratelimit(void); | 225 | extern int net_ratelimit(void); |
226 | extern long do_accept(int fd, struct sockaddr __user *upeer_sockaddr, | ||
227 | int __user *upeer_addrlen, int flags); | ||
215 | 228 | ||
216 | #define net_random() random32() | 229 | #define net_random() random32() |
217 | #define net_srandom(seed) srandom32((__force u32)seed) | 230 | #define net_srandom(seed) srandom32((__force u32)seed) |
@@ -338,8 +351,7 @@ static const struct proto_ops name##_ops = { \ | |||
338 | 351 | ||
339 | #ifdef CONFIG_SYSCTL | 352 | #ifdef CONFIG_SYSCTL |
340 | #include <linux/sysctl.h> | 353 | #include <linux/sysctl.h> |
341 | extern int net_msg_cost; | 354 | extern struct ratelimit_state net_ratelimit_state; |
342 | extern int net_msg_burst; | ||
343 | #endif | 355 | #endif |
344 | 356 | ||
345 | #endif /* __KERNEL__ */ | 357 | #endif /* __KERNEL__ */ |
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index f27fd2009334..64875859d654 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h | |||
@@ -11,7 +11,7 @@ | |||
11 | * Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG> | 11 | * Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG> |
12 | * Corey Minyard <wf-rch!minyard@relay.EU.net> | 12 | * Corey Minyard <wf-rch!minyard@relay.EU.net> |
13 | * Donald J. Becker, <becker@cesdis.gsfc.nasa.gov> | 13 | * Donald J. Becker, <becker@cesdis.gsfc.nasa.gov> |
14 | * Alan Cox, <Alan.Cox@linux.org> | 14 | * Alan Cox, <alan@lxorguk.ukuu.org.uk> |
15 | * Bjorn Ekwall. <bj0rn@blox.se> | 15 | * Bjorn Ekwall. <bj0rn@blox.se> |
16 | * Pekka Riikonen <priikone@poseidon.pspt.fi> | 16 | * Pekka Riikonen <priikone@poseidon.pspt.fi> |
17 | * | 17 | * |
@@ -42,6 +42,7 @@ | |||
42 | #include <linux/workqueue.h> | 42 | #include <linux/workqueue.h> |
43 | 43 | ||
44 | #include <net/net_namespace.h> | 44 | #include <net/net_namespace.h> |
45 | #include <net/dsa.h> | ||
45 | 46 | ||
46 | struct vlan_group; | 47 | struct vlan_group; |
47 | struct ethtool_ops; | 48 | struct ethtool_ops; |
@@ -61,9 +62,7 @@ struct wireless_dev; | |||
61 | #define NET_XMIT_DROP 1 /* skb dropped */ | 62 | #define NET_XMIT_DROP 1 /* skb dropped */ |
62 | #define NET_XMIT_CN 2 /* congestion notification */ | 63 | #define NET_XMIT_CN 2 /* congestion notification */ |
63 | #define NET_XMIT_POLICED 3 /* skb is shot by police */ | 64 | #define NET_XMIT_POLICED 3 /* skb is shot by police */ |
64 | #define NET_XMIT_BYPASS 4 /* packet does not leave via dequeue; | 65 | #define NET_XMIT_MASK 0xFFFF /* qdisc flags in net/sch_generic.h */ |
65 | (TC use only - dev_queue_xmit | ||
66 | returns this as NET_XMIT_SUCCESS) */ | ||
67 | 66 | ||
68 | /* Backlog congestion levels */ | 67 | /* Backlog congestion levels */ |
69 | #define NET_RX_SUCCESS 0 /* keep 'em coming, baby */ | 68 | #define NET_RX_SUCCESS 0 /* keep 'em coming, baby */ |
@@ -88,6 +87,8 @@ struct wireless_dev; | |||
88 | #define NETDEV_TX_BUSY 1 /* driver tx path was busy*/ | 87 | #define NETDEV_TX_BUSY 1 /* driver tx path was busy*/ |
89 | #define NETDEV_TX_LOCKED -1 /* driver tx lock was already taken */ | 88 | #define NETDEV_TX_LOCKED -1 /* driver tx lock was already taken */ |
90 | 89 | ||
90 | #ifdef __KERNEL__ | ||
91 | |||
91 | /* | 92 | /* |
92 | * Compute the worst case header length according to the protocols | 93 | * Compute the worst case header length according to the protocols |
93 | * used. | 94 | * used. |
@@ -114,13 +115,7 @@ struct wireless_dev; | |||
114 | #define MAX_HEADER (LL_MAX_HEADER + 48) | 115 | #define MAX_HEADER (LL_MAX_HEADER + 48) |
115 | #endif | 116 | #endif |
116 | 117 | ||
117 | struct net_device_subqueue | 118 | #endif /* __KERNEL__ */ |
118 | { | ||
119 | /* Give a control state for each queue. This struct may contain | ||
120 | * per-queue locks in the future. | ||
121 | */ | ||
122 | unsigned long state; | ||
123 | }; | ||
124 | 119 | ||
125 | /* | 120 | /* |
126 | * Network device statistics. Akin to the 2.0 ether stats but | 121 | * Network device statistics. Akin to the 2.0 ether stats but |
@@ -277,14 +272,11 @@ struct header_ops { | |||
277 | 272 | ||
278 | enum netdev_state_t | 273 | enum netdev_state_t |
279 | { | 274 | { |
280 | __LINK_STATE_XOFF=0, | ||
281 | __LINK_STATE_START, | 275 | __LINK_STATE_START, |
282 | __LINK_STATE_PRESENT, | 276 | __LINK_STATE_PRESENT, |
283 | __LINK_STATE_SCHED, | ||
284 | __LINK_STATE_NOCARRIER, | 277 | __LINK_STATE_NOCARRIER, |
285 | __LINK_STATE_LINKWATCH_PENDING, | 278 | __LINK_STATE_LINKWATCH_PENDING, |
286 | __LINK_STATE_DORMANT, | 279 | __LINK_STATE_DORMANT, |
287 | __LINK_STATE_QDISC_RUNNING, | ||
288 | }; | 280 | }; |
289 | 281 | ||
290 | 282 | ||
@@ -444,6 +436,21 @@ static inline void napi_synchronize(const struct napi_struct *n) | |||
444 | # define napi_synchronize(n) barrier() | 436 | # define napi_synchronize(n) barrier() |
445 | #endif | 437 | #endif |
446 | 438 | ||
439 | enum netdev_queue_state_t | ||
440 | { | ||
441 | __QUEUE_STATE_XOFF, | ||
442 | __QUEUE_STATE_FROZEN, | ||
443 | }; | ||
444 | |||
445 | struct netdev_queue { | ||
446 | struct net_device *dev; | ||
447 | struct Qdisc *qdisc; | ||
448 | unsigned long state; | ||
449 | spinlock_t _xmit_lock; | ||
450 | int xmit_lock_owner; | ||
451 | struct Qdisc *qdisc_sleeping; | ||
452 | } ____cacheline_aligned_in_smp; | ||
453 | |||
447 | /* | 454 | /* |
448 | * The DEVICE structure. | 455 | * The DEVICE structure. |
449 | * Actually, this whole structure is a big mistake. It mixes I/O | 456 | * Actually, this whole structure is a big mistake. It mixes I/O |
@@ -465,6 +472,8 @@ struct net_device | |||
465 | char name[IFNAMSIZ]; | 472 | char name[IFNAMSIZ]; |
466 | /* device name hash chain */ | 473 | /* device name hash chain */ |
467 | struct hlist_node name_hlist; | 474 | struct hlist_node name_hlist; |
475 | /* snmp alias */ | ||
476 | char *ifalias; | ||
468 | 477 | ||
469 | /* | 478 | /* |
470 | * I/O specific fields | 479 | * I/O specific fields |
@@ -512,7 +521,6 @@ struct net_device | |||
512 | #define NETIF_F_LLTX 4096 /* LockLess TX - deprecated. Please */ | 521 | #define NETIF_F_LLTX 4096 /* LockLess TX - deprecated. Please */ |
513 | /* do not use LLTX in new drivers */ | 522 | /* do not use LLTX in new drivers */ |
514 | #define NETIF_F_NETNS_LOCAL 8192 /* Does not change network namespaces */ | 523 | #define NETIF_F_NETNS_LOCAL 8192 /* Does not change network namespaces */ |
515 | #define NETIF_F_MULTI_QUEUE 16384 /* Has multiple TX/RX queues */ | ||
516 | #define NETIF_F_LRO 32768 /* large receive offload */ | 524 | #define NETIF_F_LRO 32768 /* large receive offload */ |
517 | 525 | ||
518 | /* Segmentation offload features */ | 526 | /* Segmentation offload features */ |
@@ -533,8 +541,6 @@ struct net_device | |||
533 | #define NETIF_F_V6_CSUM (NETIF_F_GEN_CSUM | NETIF_F_IPV6_CSUM) | 541 | #define NETIF_F_V6_CSUM (NETIF_F_GEN_CSUM | NETIF_F_IPV6_CSUM) |
534 | #define NETIF_F_ALL_CSUM (NETIF_F_V4_CSUM | NETIF_F_V6_CSUM) | 542 | #define NETIF_F_ALL_CSUM (NETIF_F_V4_CSUM | NETIF_F_V6_CSUM) |
535 | 543 | ||
536 | struct net_device *next_sched; | ||
537 | |||
538 | /* Interface index. Unique device identifier */ | 544 | /* Interface index. Unique device identifier */ |
539 | int ifindex; | 545 | int ifindex; |
540 | int iflink; | 546 | int iflink; |
@@ -590,17 +596,21 @@ struct net_device | |||
590 | unsigned char addr_len; /* hardware address length */ | 596 | unsigned char addr_len; /* hardware address length */ |
591 | unsigned short dev_id; /* for shared network cards */ | 597 | unsigned short dev_id; /* for shared network cards */ |
592 | 598 | ||
599 | spinlock_t addr_list_lock; | ||
593 | struct dev_addr_list *uc_list; /* Secondary unicast mac addresses */ | 600 | struct dev_addr_list *uc_list; /* Secondary unicast mac addresses */ |
594 | int uc_count; /* Number of installed ucasts */ | 601 | int uc_count; /* Number of installed ucasts */ |
595 | int uc_promisc; | 602 | int uc_promisc; |
596 | struct dev_addr_list *mc_list; /* Multicast mac addresses */ | 603 | struct dev_addr_list *mc_list; /* Multicast mac addresses */ |
597 | int mc_count; /* Number of installed mcasts */ | 604 | int mc_count; /* Number of installed mcasts */ |
598 | int promiscuity; | 605 | unsigned int promiscuity; |
599 | int allmulti; | 606 | unsigned int allmulti; |
600 | 607 | ||
601 | 608 | ||
602 | /* Protocol specific pointers */ | 609 | /* Protocol specific pointers */ |
603 | 610 | ||
611 | #ifdef CONFIG_NET_DSA | ||
612 | void *dsa_ptr; /* dsa specific data */ | ||
613 | #endif | ||
604 | void *atalk_ptr; /* AppleTalk link */ | 614 | void *atalk_ptr; /* AppleTalk link */ |
605 | void *ip_ptr; /* IPv4 specific data */ | 615 | void *ip_ptr; /* IPv4 specific data */ |
606 | void *dn_ptr; /* DECnet specific data */ | 616 | void *dn_ptr; /* DECnet specific data */ |
@@ -620,32 +630,21 @@ struct net_device | |||
620 | 630 | ||
621 | unsigned char broadcast[MAX_ADDR_LEN]; /* hw bcast add */ | 631 | unsigned char broadcast[MAX_ADDR_LEN]; /* hw bcast add */ |
622 | 632 | ||
623 | /* ingress path synchronizer */ | 633 | struct netdev_queue rx_queue; |
624 | spinlock_t ingress_lock; | ||
625 | struct Qdisc *qdisc_ingress; | ||
626 | 634 | ||
627 | /* | 635 | struct netdev_queue *_tx ____cacheline_aligned_in_smp; |
628 | * Cache line mostly used on queue transmit path (qdisc) | 636 | |
629 | */ | 637 | /* Number of TX queues allocated at alloc_netdev_mq() time */ |
630 | /* device queue lock */ | 638 | unsigned int num_tx_queues; |
631 | spinlock_t queue_lock ____cacheline_aligned_in_smp; | ||
632 | struct Qdisc *qdisc; | ||
633 | struct Qdisc *qdisc_sleeping; | ||
634 | struct list_head qdisc_list; | ||
635 | unsigned long tx_queue_len; /* Max frames per queue allowed */ | ||
636 | 639 | ||
637 | /* Partially transmitted GSO packet. */ | 640 | /* Number of TX queues currently active in device */ |
638 | struct sk_buff *gso_skb; | 641 | unsigned int real_num_tx_queues; |
639 | 642 | ||
643 | unsigned long tx_queue_len; /* Max frames per queue allowed */ | ||
644 | spinlock_t tx_global_lock; | ||
640 | /* | 645 | /* |
641 | * One part is mostly used on xmit path (device) | 646 | * One part is mostly used on xmit path (device) |
642 | */ | 647 | */ |
643 | /* hard_start_xmit synchronizer */ | ||
644 | spinlock_t _xmit_lock ____cacheline_aligned_in_smp; | ||
645 | /* cpu id of processor entered to hard_start_xmit or -1, | ||
646 | if nobody entered there. | ||
647 | */ | ||
648 | int xmit_lock_owner; | ||
649 | void *priv; /* pointer to private data */ | 648 | void *priv; /* pointer to private data */ |
650 | int (*hard_start_xmit) (struct sk_buff *skb, | 649 | int (*hard_start_xmit) (struct sk_buff *skb, |
651 | struct net_device *dev); | 650 | struct net_device *dev); |
@@ -724,6 +723,9 @@ struct net_device | |||
724 | void (*poll_controller)(struct net_device *dev); | 723 | void (*poll_controller)(struct net_device *dev); |
725 | #endif | 724 | #endif |
726 | 725 | ||
726 | u16 (*select_queue)(struct net_device *dev, | ||
727 | struct sk_buff *skb); | ||
728 | |||
727 | #ifdef CONFIG_NET_NS | 729 | #ifdef CONFIG_NET_NS |
728 | /* Network namespace this network device is inside */ | 730 | /* Network namespace this network device is inside */ |
729 | struct net *nd_net; | 731 | struct net *nd_net; |
@@ -736,6 +738,8 @@ struct net_device | |||
736 | struct net_bridge_port *br_port; | 738 | struct net_bridge_port *br_port; |
737 | /* macvlan */ | 739 | /* macvlan */ |
738 | struct macvlan_port *macvlan_port; | 740 | struct macvlan_port *macvlan_port; |
741 | /* GARP */ | ||
742 | struct garp_port *garp_port; | ||
739 | 743 | ||
740 | /* class/net/name entry */ | 744 | /* class/net/name entry */ |
741 | struct device dev; | 745 | struct device dev; |
@@ -751,16 +755,31 @@ struct net_device | |||
751 | /* for setting kernel sock attribute on TCP connection setup */ | 755 | /* for setting kernel sock attribute on TCP connection setup */ |
752 | #define GSO_MAX_SIZE 65536 | 756 | #define GSO_MAX_SIZE 65536 |
753 | unsigned int gso_max_size; | 757 | unsigned int gso_max_size; |
754 | |||
755 | /* The TX queue control structures */ | ||
756 | unsigned int egress_subqueue_count; | ||
757 | struct net_device_subqueue egress_subqueue[1]; | ||
758 | }; | 758 | }; |
759 | #define to_net_dev(d) container_of(d, struct net_device, dev) | 759 | #define to_net_dev(d) container_of(d, struct net_device, dev) |
760 | 760 | ||
761 | #define NETDEV_ALIGN 32 | 761 | #define NETDEV_ALIGN 32 |
762 | #define NETDEV_ALIGN_CONST (NETDEV_ALIGN - 1) | 762 | #define NETDEV_ALIGN_CONST (NETDEV_ALIGN - 1) |
763 | 763 | ||
764 | static inline | ||
765 | struct netdev_queue *netdev_get_tx_queue(const struct net_device *dev, | ||
766 | unsigned int index) | ||
767 | { | ||
768 | return &dev->_tx[index]; | ||
769 | } | ||
770 | |||
771 | static inline void netdev_for_each_tx_queue(struct net_device *dev, | ||
772 | void (*f)(struct net_device *, | ||
773 | struct netdev_queue *, | ||
774 | void *), | ||
775 | void *arg) | ||
776 | { | ||
777 | unsigned int i; | ||
778 | |||
779 | for (i = 0; i < dev->num_tx_queues; i++) | ||
780 | f(dev, &dev->_tx[i], arg); | ||
781 | } | ||
782 | |||
764 | /* | 783 | /* |
765 | * Net namespace inlines | 784 | * Net namespace inlines |
766 | */ | 785 | */ |
@@ -783,6 +802,26 @@ void dev_net_set(struct net_device *dev, struct net *net) | |||
783 | #endif | 802 | #endif |
784 | } | 803 | } |
785 | 804 | ||
805 | static inline bool netdev_uses_dsa_tags(struct net_device *dev) | ||
806 | { | ||
807 | #ifdef CONFIG_NET_DSA_TAG_DSA | ||
808 | if (dev->dsa_ptr != NULL) | ||
809 | return dsa_uses_dsa_tags(dev->dsa_ptr); | ||
810 | #endif | ||
811 | |||
812 | return 0; | ||
813 | } | ||
814 | |||
815 | static inline bool netdev_uses_trailer_tags(struct net_device *dev) | ||
816 | { | ||
817 | #ifdef CONFIG_NET_DSA_TAG_TRAILER | ||
818 | if (dev->dsa_ptr != NULL) | ||
819 | return dsa_uses_trailer_tags(dev->dsa_ptr); | ||
820 | #endif | ||
821 | |||
822 | return 0; | ||
823 | } | ||
824 | |||
786 | /** | 825 | /** |
787 | * netdev_priv - access network device private data | 826 | * netdev_priv - access network device private data |
788 | * @dev: network device | 827 | * @dev: network device |
@@ -791,7 +830,9 @@ void dev_net_set(struct net_device *dev, struct net *net) | |||
791 | */ | 830 | */ |
792 | static inline void *netdev_priv(const struct net_device *dev) | 831 | static inline void *netdev_priv(const struct net_device *dev) |
793 | { | 832 | { |
794 | return dev->priv; | 833 | return (char *)dev + ((sizeof(struct net_device) |
834 | + NETDEV_ALIGN_CONST) | ||
835 | & ~NETDEV_ALIGN_CONST); | ||
795 | } | 836 | } |
796 | 837 | ||
797 | /* Set the sysfs physical device reference for the network logical device | 838 | /* Set the sysfs physical device reference for the network logical device |
@@ -826,6 +867,19 @@ static inline void netif_napi_add(struct net_device *dev, | |||
826 | set_bit(NAPI_STATE_SCHED, &napi->state); | 867 | set_bit(NAPI_STATE_SCHED, &napi->state); |
827 | } | 868 | } |
828 | 869 | ||
870 | /** | ||
871 | * netif_napi_del - remove a napi context | ||
872 | * @napi: napi context | ||
873 | * | ||
874 | * netif_napi_del() removes a napi context from the network device napi list | ||
875 | */ | ||
876 | static inline void netif_napi_del(struct napi_struct *napi) | ||
877 | { | ||
878 | #ifdef CONFIG_NETPOLL | ||
879 | list_del(&napi->dev_list); | ||
880 | #endif | ||
881 | } | ||
882 | |||
829 | struct packet_type { | 883 | struct packet_type { |
830 | __be16 type; /* This is really htons(ether_type). */ | 884 | __be16 type; /* This is really htons(ether_type). */ |
831 | struct net_device *dev; /* NULL is wildcarded here */ | 885 | struct net_device *dev; /* NULL is wildcarded here */ |
@@ -886,6 +940,7 @@ extern struct net_device *__dev_get_by_name(struct net *net, const char *name); | |||
886 | extern int dev_alloc_name(struct net_device *dev, const char *name); | 940 | extern int dev_alloc_name(struct net_device *dev, const char *name); |
887 | extern int dev_open(struct net_device *dev); | 941 | extern int dev_open(struct net_device *dev); |
888 | extern int dev_close(struct net_device *dev); | 942 | extern int dev_close(struct net_device *dev); |
943 | extern void dev_disable_lro(struct net_device *dev); | ||
889 | extern int dev_queue_xmit(struct sk_buff *skb); | 944 | extern int dev_queue_xmit(struct sk_buff *skb); |
890 | extern int register_netdevice(struct net_device *dev); | 945 | extern int register_netdevice(struct net_device *dev); |
891 | extern void unregister_netdevice(struct net_device *dev); | 946 | extern void unregister_netdevice(struct net_device *dev); |
@@ -935,7 +990,7 @@ static inline int unregister_gifconf(unsigned int family) | |||
935 | */ | 990 | */ |
936 | struct softnet_data | 991 | struct softnet_data |
937 | { | 992 | { |
938 | struct net_device *output_queue; | 993 | struct Qdisc *output_queue; |
939 | struct sk_buff_head input_pkt_queue; | 994 | struct sk_buff_head input_pkt_queue; |
940 | struct list_head poll_list; | 995 | struct list_head poll_list; |
941 | struct sk_buff *completion_queue; | 996 | struct sk_buff *completion_queue; |
@@ -950,12 +1005,25 @@ DECLARE_PER_CPU(struct softnet_data,softnet_data); | |||
950 | 1005 | ||
951 | #define HAVE_NETIF_QUEUE | 1006 | #define HAVE_NETIF_QUEUE |
952 | 1007 | ||
953 | extern void __netif_schedule(struct net_device *dev); | 1008 | extern void __netif_schedule(struct Qdisc *q); |
1009 | |||
1010 | static inline void netif_schedule_queue(struct netdev_queue *txq) | ||
1011 | { | ||
1012 | if (!test_bit(__QUEUE_STATE_XOFF, &txq->state)) | ||
1013 | __netif_schedule(txq->qdisc); | ||
1014 | } | ||
1015 | |||
1016 | static inline void netif_tx_schedule_all(struct net_device *dev) | ||
1017 | { | ||
1018 | unsigned int i; | ||
954 | 1019 | ||
955 | static inline void netif_schedule(struct net_device *dev) | 1020 | for (i = 0; i < dev->num_tx_queues; i++) |
1021 | netif_schedule_queue(netdev_get_tx_queue(dev, i)); | ||
1022 | } | ||
1023 | |||
1024 | static inline void netif_tx_start_queue(struct netdev_queue *dev_queue) | ||
956 | { | 1025 | { |
957 | if (!test_bit(__LINK_STATE_XOFF, &dev->state)) | 1026 | clear_bit(__QUEUE_STATE_XOFF, &dev_queue->state); |
958 | __netif_schedule(dev); | ||
959 | } | 1027 | } |
960 | 1028 | ||
961 | /** | 1029 | /** |
@@ -966,7 +1034,29 @@ static inline void netif_schedule(struct net_device *dev) | |||
966 | */ | 1034 | */ |
967 | static inline void netif_start_queue(struct net_device *dev) | 1035 | static inline void netif_start_queue(struct net_device *dev) |
968 | { | 1036 | { |
969 | clear_bit(__LINK_STATE_XOFF, &dev->state); | 1037 | netif_tx_start_queue(netdev_get_tx_queue(dev, 0)); |
1038 | } | ||
1039 | |||
1040 | static inline void netif_tx_start_all_queues(struct net_device *dev) | ||
1041 | { | ||
1042 | unsigned int i; | ||
1043 | |||
1044 | for (i = 0; i < dev->num_tx_queues; i++) { | ||
1045 | struct netdev_queue *txq = netdev_get_tx_queue(dev, i); | ||
1046 | netif_tx_start_queue(txq); | ||
1047 | } | ||
1048 | } | ||
1049 | |||
1050 | static inline void netif_tx_wake_queue(struct netdev_queue *dev_queue) | ||
1051 | { | ||
1052 | #ifdef CONFIG_NETPOLL_TRAP | ||
1053 | if (netpoll_trap()) { | ||
1054 | clear_bit(__QUEUE_STATE_XOFF, &dev_queue->state); | ||
1055 | return; | ||
1056 | } | ||
1057 | #endif | ||
1058 | if (test_and_clear_bit(__QUEUE_STATE_XOFF, &dev_queue->state)) | ||
1059 | __netif_schedule(dev_queue->qdisc); | ||
970 | } | 1060 | } |
971 | 1061 | ||
972 | /** | 1062 | /** |
@@ -978,14 +1068,22 @@ static inline void netif_start_queue(struct net_device *dev) | |||
978 | */ | 1068 | */ |
979 | static inline void netif_wake_queue(struct net_device *dev) | 1069 | static inline void netif_wake_queue(struct net_device *dev) |
980 | { | 1070 | { |
981 | #ifdef CONFIG_NETPOLL_TRAP | 1071 | netif_tx_wake_queue(netdev_get_tx_queue(dev, 0)); |
982 | if (netpoll_trap()) { | 1072 | } |
983 | clear_bit(__LINK_STATE_XOFF, &dev->state); | 1073 | |
984 | return; | 1074 | static inline void netif_tx_wake_all_queues(struct net_device *dev) |
1075 | { | ||
1076 | unsigned int i; | ||
1077 | |||
1078 | for (i = 0; i < dev->num_tx_queues; i++) { | ||
1079 | struct netdev_queue *txq = netdev_get_tx_queue(dev, i); | ||
1080 | netif_tx_wake_queue(txq); | ||
985 | } | 1081 | } |
986 | #endif | 1082 | } |
987 | if (test_and_clear_bit(__LINK_STATE_XOFF, &dev->state)) | 1083 | |
988 | __netif_schedule(dev); | 1084 | static inline void netif_tx_stop_queue(struct netdev_queue *dev_queue) |
1085 | { | ||
1086 | set_bit(__QUEUE_STATE_XOFF, &dev_queue->state); | ||
989 | } | 1087 | } |
990 | 1088 | ||
991 | /** | 1089 | /** |
@@ -997,7 +1095,22 @@ static inline void netif_wake_queue(struct net_device *dev) | |||
997 | */ | 1095 | */ |
998 | static inline void netif_stop_queue(struct net_device *dev) | 1096 | static inline void netif_stop_queue(struct net_device *dev) |
999 | { | 1097 | { |
1000 | set_bit(__LINK_STATE_XOFF, &dev->state); | 1098 | netif_tx_stop_queue(netdev_get_tx_queue(dev, 0)); |
1099 | } | ||
1100 | |||
1101 | static inline void netif_tx_stop_all_queues(struct net_device *dev) | ||
1102 | { | ||
1103 | unsigned int i; | ||
1104 | |||
1105 | for (i = 0; i < dev->num_tx_queues; i++) { | ||
1106 | struct netdev_queue *txq = netdev_get_tx_queue(dev, i); | ||
1107 | netif_tx_stop_queue(txq); | ||
1108 | } | ||
1109 | } | ||
1110 | |||
1111 | static inline int netif_tx_queue_stopped(const struct netdev_queue *dev_queue) | ||
1112 | { | ||
1113 | return test_bit(__QUEUE_STATE_XOFF, &dev_queue->state); | ||
1001 | } | 1114 | } |
1002 | 1115 | ||
1003 | /** | 1116 | /** |
@@ -1008,7 +1121,12 @@ static inline void netif_stop_queue(struct net_device *dev) | |||
1008 | */ | 1121 | */ |
1009 | static inline int netif_queue_stopped(const struct net_device *dev) | 1122 | static inline int netif_queue_stopped(const struct net_device *dev) |
1010 | { | 1123 | { |
1011 | return test_bit(__LINK_STATE_XOFF, &dev->state); | 1124 | return netif_tx_queue_stopped(netdev_get_tx_queue(dev, 0)); |
1125 | } | ||
1126 | |||
1127 | static inline int netif_tx_queue_frozen(const struct netdev_queue *dev_queue) | ||
1128 | { | ||
1129 | return test_bit(__QUEUE_STATE_FROZEN, &dev_queue->state); | ||
1012 | } | 1130 | } |
1013 | 1131 | ||
1014 | /** | 1132 | /** |
@@ -1038,9 +1156,8 @@ static inline int netif_running(const struct net_device *dev) | |||
1038 | */ | 1156 | */ |
1039 | static inline void netif_start_subqueue(struct net_device *dev, u16 queue_index) | 1157 | static inline void netif_start_subqueue(struct net_device *dev, u16 queue_index) |
1040 | { | 1158 | { |
1041 | #ifdef CONFIG_NETDEVICES_MULTIQUEUE | 1159 | struct netdev_queue *txq = netdev_get_tx_queue(dev, queue_index); |
1042 | clear_bit(__LINK_STATE_XOFF, &dev->egress_subqueue[queue_index].state); | 1160 | clear_bit(__QUEUE_STATE_XOFF, &txq->state); |
1043 | #endif | ||
1044 | } | 1161 | } |
1045 | 1162 | ||
1046 | /** | 1163 | /** |
@@ -1052,13 +1169,12 @@ static inline void netif_start_subqueue(struct net_device *dev, u16 queue_index) | |||
1052 | */ | 1169 | */ |
1053 | static inline void netif_stop_subqueue(struct net_device *dev, u16 queue_index) | 1170 | static inline void netif_stop_subqueue(struct net_device *dev, u16 queue_index) |
1054 | { | 1171 | { |
1055 | #ifdef CONFIG_NETDEVICES_MULTIQUEUE | 1172 | struct netdev_queue *txq = netdev_get_tx_queue(dev, queue_index); |
1056 | #ifdef CONFIG_NETPOLL_TRAP | 1173 | #ifdef CONFIG_NETPOLL_TRAP |
1057 | if (netpoll_trap()) | 1174 | if (netpoll_trap()) |
1058 | return; | 1175 | return; |
1059 | #endif | 1176 | #endif |
1060 | set_bit(__LINK_STATE_XOFF, &dev->egress_subqueue[queue_index].state); | 1177 | set_bit(__QUEUE_STATE_XOFF, &txq->state); |
1061 | #endif | ||
1062 | } | 1178 | } |
1063 | 1179 | ||
1064 | /** | 1180 | /** |
@@ -1071,12 +1187,8 @@ static inline void netif_stop_subqueue(struct net_device *dev, u16 queue_index) | |||
1071 | static inline int __netif_subqueue_stopped(const struct net_device *dev, | 1187 | static inline int __netif_subqueue_stopped(const struct net_device *dev, |
1072 | u16 queue_index) | 1188 | u16 queue_index) |
1073 | { | 1189 | { |
1074 | #ifdef CONFIG_NETDEVICES_MULTIQUEUE | 1190 | struct netdev_queue *txq = netdev_get_tx_queue(dev, queue_index); |
1075 | return test_bit(__LINK_STATE_XOFF, | 1191 | return test_bit(__QUEUE_STATE_XOFF, &txq->state); |
1076 | &dev->egress_subqueue[queue_index].state); | ||
1077 | #else | ||
1078 | return 0; | ||
1079 | #endif | ||
1080 | } | 1192 | } |
1081 | 1193 | ||
1082 | static inline int netif_subqueue_stopped(const struct net_device *dev, | 1194 | static inline int netif_subqueue_stopped(const struct net_device *dev, |
@@ -1094,15 +1206,13 @@ static inline int netif_subqueue_stopped(const struct net_device *dev, | |||
1094 | */ | 1206 | */ |
1095 | static inline void netif_wake_subqueue(struct net_device *dev, u16 queue_index) | 1207 | static inline void netif_wake_subqueue(struct net_device *dev, u16 queue_index) |
1096 | { | 1208 | { |
1097 | #ifdef CONFIG_NETDEVICES_MULTIQUEUE | 1209 | struct netdev_queue *txq = netdev_get_tx_queue(dev, queue_index); |
1098 | #ifdef CONFIG_NETPOLL_TRAP | 1210 | #ifdef CONFIG_NETPOLL_TRAP |
1099 | if (netpoll_trap()) | 1211 | if (netpoll_trap()) |
1100 | return; | 1212 | return; |
1101 | #endif | 1213 | #endif |
1102 | if (test_and_clear_bit(__LINK_STATE_XOFF, | 1214 | if (test_and_clear_bit(__QUEUE_STATE_XOFF, &txq->state)) |
1103 | &dev->egress_subqueue[queue_index].state)) | 1215 | __netif_schedule(txq->qdisc); |
1104 | __netif_schedule(dev); | ||
1105 | #endif | ||
1106 | } | 1216 | } |
1107 | 1217 | ||
1108 | /** | 1218 | /** |
@@ -1110,15 +1220,10 @@ static inline void netif_wake_subqueue(struct net_device *dev, u16 queue_index) | |||
1110 | * @dev: network device | 1220 | * @dev: network device |
1111 | * | 1221 | * |
1112 | * Check if device has multiple transmit queues | 1222 | * Check if device has multiple transmit queues |
1113 | * Always falls if NETDEVICE_MULTIQUEUE is not configured | ||
1114 | */ | 1223 | */ |
1115 | static inline int netif_is_multiqueue(const struct net_device *dev) | 1224 | static inline int netif_is_multiqueue(const struct net_device *dev) |
1116 | { | 1225 | { |
1117 | #ifdef CONFIG_NETDEVICES_MULTIQUEUE | 1226 | return (dev->num_tx_queues > 1); |
1118 | return (!!(NETIF_F_MULTI_QUEUE & dev->features)); | ||
1119 | #else | ||
1120 | return 0; | ||
1121 | #endif | ||
1122 | } | 1227 | } |
1123 | 1228 | ||
1124 | /* Use this variant when it is known for sure that it | 1229 | /* Use this variant when it is known for sure that it |
@@ -1138,19 +1243,22 @@ extern int netif_rx(struct sk_buff *skb); | |||
1138 | extern int netif_rx_ni(struct sk_buff *skb); | 1243 | extern int netif_rx_ni(struct sk_buff *skb); |
1139 | #define HAVE_NETIF_RECEIVE_SKB 1 | 1244 | #define HAVE_NETIF_RECEIVE_SKB 1 |
1140 | extern int netif_receive_skb(struct sk_buff *skb); | 1245 | extern int netif_receive_skb(struct sk_buff *skb); |
1246 | extern void netif_nit_deliver(struct sk_buff *skb); | ||
1141 | extern int dev_valid_name(const char *name); | 1247 | extern int dev_valid_name(const char *name); |
1142 | extern int dev_ioctl(struct net *net, unsigned int cmd, void __user *); | 1248 | extern int dev_ioctl(struct net *net, unsigned int cmd, void __user *); |
1143 | extern int dev_ethtool(struct net *net, struct ifreq *); | 1249 | extern int dev_ethtool(struct net *net, struct ifreq *); |
1144 | extern unsigned dev_get_flags(const struct net_device *); | 1250 | extern unsigned dev_get_flags(const struct net_device *); |
1145 | extern int dev_change_flags(struct net_device *, unsigned); | 1251 | extern int dev_change_flags(struct net_device *, unsigned); |
1146 | extern int dev_change_name(struct net_device *, char *); | 1252 | extern int dev_change_name(struct net_device *, const char *); |
1253 | extern int dev_set_alias(struct net_device *, const char *, size_t); | ||
1147 | extern int dev_change_net_namespace(struct net_device *, | 1254 | extern int dev_change_net_namespace(struct net_device *, |
1148 | struct net *, const char *); | 1255 | struct net *, const char *); |
1149 | extern int dev_set_mtu(struct net_device *, int); | 1256 | extern int dev_set_mtu(struct net_device *, int); |
1150 | extern int dev_set_mac_address(struct net_device *, | 1257 | extern int dev_set_mac_address(struct net_device *, |
1151 | struct sockaddr *); | 1258 | struct sockaddr *); |
1152 | extern int dev_hard_start_xmit(struct sk_buff *skb, | 1259 | extern int dev_hard_start_xmit(struct sk_buff *skb, |
1153 | struct net_device *dev); | 1260 | struct net_device *dev, |
1261 | struct netdev_queue *txq); | ||
1154 | 1262 | ||
1155 | extern int netdev_budget; | 1263 | extern int netdev_budget; |
1156 | 1264 | ||
@@ -1386,6 +1494,38 @@ static inline void netif_rx_complete(struct net_device *dev, | |||
1386 | local_irq_restore(flags); | 1494 | local_irq_restore(flags); |
1387 | } | 1495 | } |
1388 | 1496 | ||
1497 | static inline void __netif_tx_lock(struct netdev_queue *txq, int cpu) | ||
1498 | { | ||
1499 | spin_lock(&txq->_xmit_lock); | ||
1500 | txq->xmit_lock_owner = cpu; | ||
1501 | } | ||
1502 | |||
1503 | static inline void __netif_tx_lock_bh(struct netdev_queue *txq) | ||
1504 | { | ||
1505 | spin_lock_bh(&txq->_xmit_lock); | ||
1506 | txq->xmit_lock_owner = smp_processor_id(); | ||
1507 | } | ||
1508 | |||
1509 | static inline int __netif_tx_trylock(struct netdev_queue *txq) | ||
1510 | { | ||
1511 | int ok = spin_trylock(&txq->_xmit_lock); | ||
1512 | if (likely(ok)) | ||
1513 | txq->xmit_lock_owner = smp_processor_id(); | ||
1514 | return ok; | ||
1515 | } | ||
1516 | |||
1517 | static inline void __netif_tx_unlock(struct netdev_queue *txq) | ||
1518 | { | ||
1519 | txq->xmit_lock_owner = -1; | ||
1520 | spin_unlock(&txq->_xmit_lock); | ||
1521 | } | ||
1522 | |||
1523 | static inline void __netif_tx_unlock_bh(struct netdev_queue *txq) | ||
1524 | { | ||
1525 | txq->xmit_lock_owner = -1; | ||
1526 | spin_unlock_bh(&txq->_xmit_lock); | ||
1527 | } | ||
1528 | |||
1389 | /** | 1529 | /** |
1390 | * netif_tx_lock - grab network device transmit lock | 1530 | * netif_tx_lock - grab network device transmit lock |
1391 | * @dev: network device | 1531 | * @dev: network device |
@@ -1393,60 +1533,105 @@ static inline void netif_rx_complete(struct net_device *dev, | |||
1393 | * | 1533 | * |
1394 | * Get network device transmit lock | 1534 | * Get network device transmit lock |
1395 | */ | 1535 | */ |
1396 | static inline void __netif_tx_lock(struct net_device *dev, int cpu) | ||
1397 | { | ||
1398 | spin_lock(&dev->_xmit_lock); | ||
1399 | dev->xmit_lock_owner = cpu; | ||
1400 | } | ||
1401 | |||
1402 | static inline void netif_tx_lock(struct net_device *dev) | 1536 | static inline void netif_tx_lock(struct net_device *dev) |
1403 | { | 1537 | { |
1404 | __netif_tx_lock(dev, smp_processor_id()); | 1538 | unsigned int i; |
1539 | int cpu; | ||
1540 | |||
1541 | spin_lock(&dev->tx_global_lock); | ||
1542 | cpu = smp_processor_id(); | ||
1543 | for (i = 0; i < dev->num_tx_queues; i++) { | ||
1544 | struct netdev_queue *txq = netdev_get_tx_queue(dev, i); | ||
1545 | |||
1546 | /* We are the only thread of execution doing a | ||
1547 | * freeze, but we have to grab the _xmit_lock in | ||
1548 | * order to synchronize with threads which are in | ||
1549 | * the ->hard_start_xmit() handler and already | ||
1550 | * checked the frozen bit. | ||
1551 | */ | ||
1552 | __netif_tx_lock(txq, cpu); | ||
1553 | set_bit(__QUEUE_STATE_FROZEN, &txq->state); | ||
1554 | __netif_tx_unlock(txq); | ||
1555 | } | ||
1405 | } | 1556 | } |
1406 | 1557 | ||
1407 | static inline void netif_tx_lock_bh(struct net_device *dev) | 1558 | static inline void netif_tx_lock_bh(struct net_device *dev) |
1408 | { | 1559 | { |
1409 | spin_lock_bh(&dev->_xmit_lock); | 1560 | local_bh_disable(); |
1410 | dev->xmit_lock_owner = smp_processor_id(); | 1561 | netif_tx_lock(dev); |
1411 | } | ||
1412 | |||
1413 | static inline int netif_tx_trylock(struct net_device *dev) | ||
1414 | { | ||
1415 | int ok = spin_trylock(&dev->_xmit_lock); | ||
1416 | if (likely(ok)) | ||
1417 | dev->xmit_lock_owner = smp_processor_id(); | ||
1418 | return ok; | ||
1419 | } | 1562 | } |
1420 | 1563 | ||
1421 | static inline void netif_tx_unlock(struct net_device *dev) | 1564 | static inline void netif_tx_unlock(struct net_device *dev) |
1422 | { | 1565 | { |
1423 | dev->xmit_lock_owner = -1; | 1566 | unsigned int i; |
1424 | spin_unlock(&dev->_xmit_lock); | 1567 | |
1568 | for (i = 0; i < dev->num_tx_queues; i++) { | ||
1569 | struct netdev_queue *txq = netdev_get_tx_queue(dev, i); | ||
1570 | |||
1571 | /* No need to grab the _xmit_lock here. If the | ||
1572 | * queue is not stopped for another reason, we | ||
1573 | * force a schedule. | ||
1574 | */ | ||
1575 | clear_bit(__QUEUE_STATE_FROZEN, &txq->state); | ||
1576 | if (!test_bit(__QUEUE_STATE_XOFF, &txq->state)) | ||
1577 | __netif_schedule(txq->qdisc); | ||
1578 | } | ||
1579 | spin_unlock(&dev->tx_global_lock); | ||
1425 | } | 1580 | } |
1426 | 1581 | ||
1427 | static inline void netif_tx_unlock_bh(struct net_device *dev) | 1582 | static inline void netif_tx_unlock_bh(struct net_device *dev) |
1428 | { | 1583 | { |
1429 | dev->xmit_lock_owner = -1; | 1584 | netif_tx_unlock(dev); |
1430 | spin_unlock_bh(&dev->_xmit_lock); | 1585 | local_bh_enable(); |
1431 | } | 1586 | } |
1432 | 1587 | ||
1433 | #define HARD_TX_LOCK(dev, cpu) { \ | 1588 | #define HARD_TX_LOCK(dev, txq, cpu) { \ |
1434 | if ((dev->features & NETIF_F_LLTX) == 0) { \ | 1589 | if ((dev->features & NETIF_F_LLTX) == 0) { \ |
1435 | __netif_tx_lock(dev, cpu); \ | 1590 | __netif_tx_lock(txq, cpu); \ |
1436 | } \ | 1591 | } \ |
1437 | } | 1592 | } |
1438 | 1593 | ||
1439 | #define HARD_TX_UNLOCK(dev) { \ | 1594 | #define HARD_TX_UNLOCK(dev, txq) { \ |
1440 | if ((dev->features & NETIF_F_LLTX) == 0) { \ | 1595 | if ((dev->features & NETIF_F_LLTX) == 0) { \ |
1441 | netif_tx_unlock(dev); \ | 1596 | __netif_tx_unlock(txq); \ |
1442 | } \ | 1597 | } \ |
1443 | } | 1598 | } |
1444 | 1599 | ||
1445 | static inline void netif_tx_disable(struct net_device *dev) | 1600 | static inline void netif_tx_disable(struct net_device *dev) |
1446 | { | 1601 | { |
1447 | netif_tx_lock_bh(dev); | 1602 | unsigned int i; |
1448 | netif_stop_queue(dev); | 1603 | int cpu; |
1449 | netif_tx_unlock_bh(dev); | 1604 | |
1605 | local_bh_disable(); | ||
1606 | cpu = smp_processor_id(); | ||
1607 | for (i = 0; i < dev->num_tx_queues; i++) { | ||
1608 | struct netdev_queue *txq = netdev_get_tx_queue(dev, i); | ||
1609 | |||
1610 | __netif_tx_lock(txq, cpu); | ||
1611 | netif_tx_stop_queue(txq); | ||
1612 | __netif_tx_unlock(txq); | ||
1613 | } | ||
1614 | local_bh_enable(); | ||
1615 | } | ||
1616 | |||
1617 | static inline void netif_addr_lock(struct net_device *dev) | ||
1618 | { | ||
1619 | spin_lock(&dev->addr_list_lock); | ||
1620 | } | ||
1621 | |||
1622 | static inline void netif_addr_lock_bh(struct net_device *dev) | ||
1623 | { | ||
1624 | spin_lock_bh(&dev->addr_list_lock); | ||
1625 | } | ||
1626 | |||
1627 | static inline void netif_addr_unlock(struct net_device *dev) | ||
1628 | { | ||
1629 | spin_unlock(&dev->addr_list_lock); | ||
1630 | } | ||
1631 | |||
1632 | static inline void netif_addr_unlock_bh(struct net_device *dev) | ||
1633 | { | ||
1634 | spin_unlock_bh(&dev->addr_list_lock); | ||
1450 | } | 1635 | } |
1451 | 1636 | ||
1452 | /* These functions live elsewhere (drivers/net/net_init.c, but related) */ | 1637 | /* These functions live elsewhere (drivers/net/net_init.c, but related) */ |
@@ -1476,9 +1661,10 @@ extern int __dev_addr_delete(struct dev_addr_list **list, int *count, void *ad | |||
1476 | extern int __dev_addr_add(struct dev_addr_list **list, int *count, void *addr, int alen, int newonly); | 1661 | extern int __dev_addr_add(struct dev_addr_list **list, int *count, void *addr, int alen, int newonly); |
1477 | extern int __dev_addr_sync(struct dev_addr_list **to, int *to_count, struct dev_addr_list **from, int *from_count); | 1662 | extern int __dev_addr_sync(struct dev_addr_list **to, int *to_count, struct dev_addr_list **from, int *from_count); |
1478 | extern void __dev_addr_unsync(struct dev_addr_list **to, int *to_count, struct dev_addr_list **from, int *from_count); | 1663 | extern void __dev_addr_unsync(struct dev_addr_list **to, int *to_count, struct dev_addr_list **from, int *from_count); |
1479 | extern void dev_set_promiscuity(struct net_device *dev, int inc); | 1664 | extern int dev_set_promiscuity(struct net_device *dev, int inc); |
1480 | extern void dev_set_allmulti(struct net_device *dev, int inc); | 1665 | extern int dev_set_allmulti(struct net_device *dev, int inc); |
1481 | extern void netdev_state_change(struct net_device *dev); | 1666 | extern void netdev_state_change(struct net_device *dev); |
1667 | extern void netdev_bonding_change(struct net_device *dev); | ||
1482 | extern void netdev_features_change(struct net_device *dev); | 1668 | extern void netdev_features_change(struct net_device *dev); |
1483 | /* Load a device via the kmod */ | 1669 | /* Load a device via the kmod */ |
1484 | extern void dev_load(struct net *net, const char *name); | 1670 | extern void dev_load(struct net *net, const char *name); |
@@ -1505,6 +1691,11 @@ extern void *dev_seq_next(struct seq_file *seq, void *v, loff_t *pos); | |||
1505 | extern void dev_seq_stop(struct seq_file *seq, void *v); | 1691 | extern void dev_seq_stop(struct seq_file *seq, void *v); |
1506 | #endif | 1692 | #endif |
1507 | 1693 | ||
1694 | extern int netdev_class_create_file(struct class_attribute *class_attr); | ||
1695 | extern void netdev_class_remove_file(struct class_attribute *class_attr); | ||
1696 | |||
1697 | extern char *netdev_drivername(const struct net_device *dev, char *buffer, int len); | ||
1698 | |||
1508 | extern void linkwatch_run_queue(void); | 1699 | extern void linkwatch_run_queue(void); |
1509 | 1700 | ||
1510 | extern int netdev_compute_features(unsigned long all, unsigned long one); | 1701 | extern int netdev_compute_features(unsigned long all, unsigned long one); |
diff --git a/include/linux/netfilter.h b/include/linux/netfilter.h index 0c5eb7ed8b3f..48cfe51bfddc 100644 --- a/include/linux/netfilter.h +++ b/include/linux/netfilter.h | |||
@@ -5,13 +5,11 @@ | |||
5 | #include <linux/init.h> | 5 | #include <linux/init.h> |
6 | #include <linux/skbuff.h> | 6 | #include <linux/skbuff.h> |
7 | #include <linux/net.h> | 7 | #include <linux/net.h> |
8 | #include <linux/netdevice.h> | ||
9 | #include <linux/if.h> | 8 | #include <linux/if.h> |
10 | #include <linux/in.h> | 9 | #include <linux/in.h> |
11 | #include <linux/in6.h> | 10 | #include <linux/in6.h> |
12 | #include <linux/wait.h> | 11 | #include <linux/wait.h> |
13 | #include <linux/list.h> | 12 | #include <linux/list.h> |
14 | #include <net/net_namespace.h> | ||
15 | #endif | 13 | #endif |
16 | #include <linux/types.h> | 14 | #include <linux/types.h> |
17 | #include <linux/compiler.h> | 15 | #include <linux/compiler.h> |
@@ -52,6 +50,16 @@ enum nf_inet_hooks { | |||
52 | NF_INET_NUMHOOKS | 50 | NF_INET_NUMHOOKS |
53 | }; | 51 | }; |
54 | 52 | ||
53 | enum { | ||
54 | NFPROTO_UNSPEC = 0, | ||
55 | NFPROTO_IPV4 = 2, | ||
56 | NFPROTO_ARP = 3, | ||
57 | NFPROTO_BRIDGE = 7, | ||
58 | NFPROTO_IPV6 = 10, | ||
59 | NFPROTO_DECNET = 12, | ||
60 | NFPROTO_NUMPROTO, | ||
61 | }; | ||
62 | |||
55 | union nf_inet_addr { | 63 | union nf_inet_addr { |
56 | __u32 all[4]; | 64 | __u32 all[4]; |
57 | __be32 ip; | 65 | __be32 ip; |
@@ -92,8 +100,8 @@ struct nf_hook_ops | |||
92 | /* User fills in from here down. */ | 100 | /* User fills in from here down. */ |
93 | nf_hookfn *hook; | 101 | nf_hookfn *hook; |
94 | struct module *owner; | 102 | struct module *owner; |
95 | int pf; | 103 | u_int8_t pf; |
96 | int hooknum; | 104 | unsigned int hooknum; |
97 | /* Hooks are ordered in ascending priority. */ | 105 | /* Hooks are ordered in ascending priority. */ |
98 | int priority; | 106 | int priority; |
99 | }; | 107 | }; |
@@ -102,7 +110,7 @@ struct nf_sockopt_ops | |||
102 | { | 110 | { |
103 | struct list_head list; | 111 | struct list_head list; |
104 | 112 | ||
105 | int pf; | 113 | u_int8_t pf; |
106 | 114 | ||
107 | /* Non-inclusive ranges: use 0/0/NULL to never get called. */ | 115 | /* Non-inclusive ranges: use 0/0/NULL to never get called. */ |
108 | int set_optmin; | 116 | int set_optmin; |
@@ -138,9 +146,9 @@ extern struct ctl_path nf_net_netfilter_sysctl_path[]; | |||
138 | extern struct ctl_path nf_net_ipv4_netfilter_sysctl_path[]; | 146 | extern struct ctl_path nf_net_ipv4_netfilter_sysctl_path[]; |
139 | #endif /* CONFIG_SYSCTL */ | 147 | #endif /* CONFIG_SYSCTL */ |
140 | 148 | ||
141 | extern struct list_head nf_hooks[NPROTO][NF_MAX_HOOKS]; | 149 | extern struct list_head nf_hooks[NFPROTO_NUMPROTO][NF_MAX_HOOKS]; |
142 | 150 | ||
143 | int nf_hook_slow(int pf, unsigned int hook, struct sk_buff *skb, | 151 | int nf_hook_slow(u_int8_t pf, unsigned int hook, struct sk_buff *skb, |
144 | struct net_device *indev, struct net_device *outdev, | 152 | struct net_device *indev, struct net_device *outdev, |
145 | int (*okfn)(struct sk_buff *), int thresh); | 153 | int (*okfn)(struct sk_buff *), int thresh); |
146 | 154 | ||
@@ -151,7 +159,7 @@ int nf_hook_slow(int pf, unsigned int hook, struct sk_buff *skb, | |||
151 | * okfn must be invoked by the caller in this case. Any other return | 159 | * okfn must be invoked by the caller in this case. Any other return |
152 | * value indicates the packet has been consumed by the hook. | 160 | * value indicates the packet has been consumed by the hook. |
153 | */ | 161 | */ |
154 | static inline int nf_hook_thresh(int pf, unsigned int hook, | 162 | static inline int nf_hook_thresh(u_int8_t pf, unsigned int hook, |
155 | struct sk_buff *skb, | 163 | struct sk_buff *skb, |
156 | struct net_device *indev, | 164 | struct net_device *indev, |
157 | struct net_device *outdev, | 165 | struct net_device *outdev, |
@@ -167,7 +175,7 @@ static inline int nf_hook_thresh(int pf, unsigned int hook, | |||
167 | return nf_hook_slow(pf, hook, skb, indev, outdev, okfn, thresh); | 175 | return nf_hook_slow(pf, hook, skb, indev, outdev, okfn, thresh); |
168 | } | 176 | } |
169 | 177 | ||
170 | static inline int nf_hook(int pf, unsigned int hook, struct sk_buff *skb, | 178 | static inline int nf_hook(u_int8_t pf, unsigned int hook, struct sk_buff *skb, |
171 | struct net_device *indev, struct net_device *outdev, | 179 | struct net_device *indev, struct net_device *outdev, |
172 | int (*okfn)(struct sk_buff *)) | 180 | int (*okfn)(struct sk_buff *)) |
173 | { | 181 | { |
@@ -212,14 +220,14 @@ __ret;}) | |||
212 | NF_HOOK_THRESH(pf, hook, skb, indev, outdev, okfn, INT_MIN) | 220 | NF_HOOK_THRESH(pf, hook, skb, indev, outdev, okfn, INT_MIN) |
213 | 221 | ||
214 | /* Call setsockopt() */ | 222 | /* Call setsockopt() */ |
215 | int nf_setsockopt(struct sock *sk, int pf, int optval, char __user *opt, | 223 | int nf_setsockopt(struct sock *sk, u_int8_t pf, int optval, char __user *opt, |
216 | int len); | 224 | int len); |
217 | int nf_getsockopt(struct sock *sk, int pf, int optval, char __user *opt, | 225 | int nf_getsockopt(struct sock *sk, u_int8_t pf, int optval, char __user *opt, |
218 | int *len); | 226 | int *len); |
219 | 227 | ||
220 | int compat_nf_setsockopt(struct sock *sk, int pf, int optval, | 228 | int compat_nf_setsockopt(struct sock *sk, u_int8_t pf, int optval, |
221 | char __user *opt, int len); | 229 | char __user *opt, int len); |
222 | int compat_nf_getsockopt(struct sock *sk, int pf, int optval, | 230 | int compat_nf_getsockopt(struct sock *sk, u_int8_t pf, int optval, |
223 | char __user *opt, int *len); | 231 | char __user *opt, int *len); |
224 | 232 | ||
225 | /* Call this before modifying an existing packet: ensures it is | 233 | /* Call this before modifying an existing packet: ensures it is |
@@ -247,7 +255,7 @@ struct nf_afinfo { | |||
247 | int route_key_size; | 255 | int route_key_size; |
248 | }; | 256 | }; |
249 | 257 | ||
250 | extern const struct nf_afinfo *nf_afinfo[NPROTO]; | 258 | extern const struct nf_afinfo *nf_afinfo[NFPROTO_NUMPROTO]; |
251 | static inline const struct nf_afinfo *nf_get_afinfo(unsigned short family) | 259 | static inline const struct nf_afinfo *nf_get_afinfo(unsigned short family) |
252 | { | 260 | { |
253 | return rcu_dereference(nf_afinfo[family]); | 261 | return rcu_dereference(nf_afinfo[family]); |
@@ -292,7 +300,7 @@ extern void nf_unregister_afinfo(const struct nf_afinfo *afinfo); | |||
292 | extern void (*ip_nat_decode_session)(struct sk_buff *, struct flowi *); | 300 | extern void (*ip_nat_decode_session)(struct sk_buff *, struct flowi *); |
293 | 301 | ||
294 | static inline void | 302 | static inline void |
295 | nf_nat_decode_session(struct sk_buff *skb, struct flowi *fl, int family) | 303 | nf_nat_decode_session(struct sk_buff *skb, struct flowi *fl, u_int8_t family) |
296 | { | 304 | { |
297 | #ifdef CONFIG_NF_NAT_NEEDED | 305 | #ifdef CONFIG_NF_NAT_NEEDED |
298 | void (*decodefn)(struct sk_buff *, struct flowi *); | 306 | void (*decodefn)(struct sk_buff *, struct flowi *); |
@@ -315,7 +323,7 @@ extern struct proc_dir_entry *proc_net_netfilter; | |||
315 | #else /* !CONFIG_NETFILTER */ | 323 | #else /* !CONFIG_NETFILTER */ |
316 | #define NF_HOOK(pf, hook, skb, indev, outdev, okfn) (okfn)(skb) | 324 | #define NF_HOOK(pf, hook, skb, indev, outdev, okfn) (okfn)(skb) |
317 | #define NF_HOOK_COND(pf, hook, skb, indev, outdev, okfn, cond) (okfn)(skb) | 325 | #define NF_HOOK_COND(pf, hook, skb, indev, outdev, okfn, cond) (okfn)(skb) |
318 | static inline int nf_hook_thresh(int pf, unsigned int hook, | 326 | static inline int nf_hook_thresh(u_int8_t pf, unsigned int hook, |
319 | struct sk_buff *skb, | 327 | struct sk_buff *skb, |
320 | struct net_device *indev, | 328 | struct net_device *indev, |
321 | struct net_device *outdev, | 329 | struct net_device *outdev, |
@@ -324,7 +332,7 @@ static inline int nf_hook_thresh(int pf, unsigned int hook, | |||
324 | { | 332 | { |
325 | return okfn(skb); | 333 | return okfn(skb); |
326 | } | 334 | } |
327 | static inline int nf_hook(int pf, unsigned int hook, struct sk_buff *skb, | 335 | static inline int nf_hook(u_int8_t pf, unsigned int hook, struct sk_buff *skb, |
328 | struct net_device *indev, struct net_device *outdev, | 336 | struct net_device *indev, struct net_device *outdev, |
329 | int (*okfn)(struct sk_buff *)) | 337 | int (*okfn)(struct sk_buff *)) |
330 | { | 338 | { |
@@ -332,7 +340,9 @@ static inline int nf_hook(int pf, unsigned int hook, struct sk_buff *skb, | |||
332 | } | 340 | } |
333 | struct flowi; | 341 | struct flowi; |
334 | static inline void | 342 | static inline void |
335 | nf_nat_decode_session(struct sk_buff *skb, struct flowi *fl, int family) {} | 343 | nf_nat_decode_session(struct sk_buff *skb, struct flowi *fl, u_int8_t family) |
344 | { | ||
345 | } | ||
336 | #endif /*CONFIG_NETFILTER*/ | 346 | #endif /*CONFIG_NETFILTER*/ |
337 | 347 | ||
338 | #if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE) | 348 | #if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE) |
@@ -343,56 +353,5 @@ extern void (*nf_ct_destroy)(struct nf_conntrack *); | |||
343 | static inline void nf_ct_attach(struct sk_buff *new, struct sk_buff *skb) {} | 353 | static inline void nf_ct_attach(struct sk_buff *new, struct sk_buff *skb) {} |
344 | #endif | 354 | #endif |
345 | 355 | ||
346 | static inline struct net *nf_pre_routing_net(const struct net_device *in, | ||
347 | const struct net_device *out) | ||
348 | { | ||
349 | #ifdef CONFIG_NET_NS | ||
350 | return in->nd_net; | ||
351 | #else | ||
352 | return &init_net; | ||
353 | #endif | ||
354 | } | ||
355 | |||
356 | static inline struct net *nf_local_in_net(const struct net_device *in, | ||
357 | const struct net_device *out) | ||
358 | { | ||
359 | #ifdef CONFIG_NET_NS | ||
360 | return in->nd_net; | ||
361 | #else | ||
362 | return &init_net; | ||
363 | #endif | ||
364 | } | ||
365 | |||
366 | static inline struct net *nf_forward_net(const struct net_device *in, | ||
367 | const struct net_device *out) | ||
368 | { | ||
369 | #ifdef CONFIG_NET_NS | ||
370 | BUG_ON(in->nd_net != out->nd_net); | ||
371 | return in->nd_net; | ||
372 | #else | ||
373 | return &init_net; | ||
374 | #endif | ||
375 | } | ||
376 | |||
377 | static inline struct net *nf_local_out_net(const struct net_device *in, | ||
378 | const struct net_device *out) | ||
379 | { | ||
380 | #ifdef CONFIG_NET_NS | ||
381 | return out->nd_net; | ||
382 | #else | ||
383 | return &init_net; | ||
384 | #endif | ||
385 | } | ||
386 | |||
387 | static inline struct net *nf_post_routing_net(const struct net_device *in, | ||
388 | const struct net_device *out) | ||
389 | { | ||
390 | #ifdef CONFIG_NET_NS | ||
391 | return out->nd_net; | ||
392 | #else | ||
393 | return &init_net; | ||
394 | #endif | ||
395 | } | ||
396 | |||
397 | #endif /*__KERNEL__*/ | 356 | #endif /*__KERNEL__*/ |
398 | #endif /*__LINUX_NETFILTER_H*/ | 357 | #endif /*__LINUX_NETFILTER_H*/ |
diff --git a/include/linux/netfilter/Kbuild b/include/linux/netfilter/Kbuild index 3aff513d12c8..5a8af875bce2 100644 --- a/include/linux/netfilter/Kbuild +++ b/include/linux/netfilter/Kbuild | |||
@@ -32,6 +32,7 @@ header-y += xt_owner.h | |||
32 | header-y += xt_pkttype.h | 32 | header-y += xt_pkttype.h |
33 | header-y += xt_rateest.h | 33 | header-y += xt_rateest.h |
34 | header-y += xt_realm.h | 34 | header-y += xt_realm.h |
35 | header-y += xt_recent.h | ||
35 | header-y += xt_sctp.h | 36 | header-y += xt_sctp.h |
36 | header-y += xt_state.h | 37 | header-y += xt_state.h |
37 | header-y += xt_statistic.h | 38 | header-y += xt_statistic.h |
diff --git a/include/linux/netfilter/nf_conntrack_common.h b/include/linux/netfilter/nf_conntrack_common.h index bad1eb760f61..885cbe282260 100644 --- a/include/linux/netfilter/nf_conntrack_common.h +++ b/include/linux/netfilter/nf_conntrack_common.h | |||
@@ -122,7 +122,7 @@ enum ip_conntrack_events | |||
122 | IPCT_NATINFO_BIT = 10, | 122 | IPCT_NATINFO_BIT = 10, |
123 | IPCT_NATINFO = (1 << IPCT_NATINFO_BIT), | 123 | IPCT_NATINFO = (1 << IPCT_NATINFO_BIT), |
124 | 124 | ||
125 | /* Counter highest bit has been set */ | 125 | /* Counter highest bit has been set, unused */ |
126 | IPCT_COUNTER_FILLING_BIT = 11, | 126 | IPCT_COUNTER_FILLING_BIT = 11, |
127 | IPCT_COUNTER_FILLING = (1 << IPCT_COUNTER_FILLING_BIT), | 127 | IPCT_COUNTER_FILLING = (1 << IPCT_COUNTER_FILLING_BIT), |
128 | 128 | ||
@@ -145,12 +145,6 @@ enum ip_conntrack_expect_events { | |||
145 | }; | 145 | }; |
146 | 146 | ||
147 | #ifdef __KERNEL__ | 147 | #ifdef __KERNEL__ |
148 | struct ip_conntrack_counter | ||
149 | { | ||
150 | u_int32_t packets; | ||
151 | u_int32_t bytes; | ||
152 | }; | ||
153 | |||
154 | struct ip_conntrack_stat | 148 | struct ip_conntrack_stat |
155 | { | 149 | { |
156 | unsigned int searched; | 150 | unsigned int searched; |
diff --git a/include/linux/netfilter/nf_conntrack_proto_gre.h b/include/linux/netfilter/nf_conntrack_proto_gre.h index 535e4219d2bb..2a10efda17fb 100644 --- a/include/linux/netfilter/nf_conntrack_proto_gre.h +++ b/include/linux/netfilter/nf_conntrack_proto_gre.h | |||
@@ -87,7 +87,7 @@ int nf_ct_gre_keymap_add(struct nf_conn *ct, enum ip_conntrack_dir dir, | |||
87 | /* delete keymap entries */ | 87 | /* delete keymap entries */ |
88 | void nf_ct_gre_keymap_destroy(struct nf_conn *ct); | 88 | void nf_ct_gre_keymap_destroy(struct nf_conn *ct); |
89 | 89 | ||
90 | extern void nf_ct_gre_keymap_flush(void); | 90 | extern void nf_ct_gre_keymap_flush(struct net *net); |
91 | extern void nf_nat_need_gre(void); | 91 | extern void nf_nat_need_gre(void); |
92 | 92 | ||
93 | #endif /* __KERNEL__ */ | 93 | #endif /* __KERNEL__ */ |
diff --git a/include/linux/netfilter/nf_conntrack_tcp.h b/include/linux/netfilter/nf_conntrack_tcp.h index 22ce29995f13..a049df4f2236 100644 --- a/include/linux/netfilter/nf_conntrack_tcp.h +++ b/include/linux/netfilter/nf_conntrack_tcp.h | |||
@@ -30,6 +30,9 @@ enum tcp_conntrack { | |||
30 | /* Be liberal in window checking */ | 30 | /* Be liberal in window checking */ |
31 | #define IP_CT_TCP_FLAG_BE_LIBERAL 0x08 | 31 | #define IP_CT_TCP_FLAG_BE_LIBERAL 0x08 |
32 | 32 | ||
33 | /* Has unacknowledged data */ | ||
34 | #define IP_CT_TCP_FLAG_DATA_UNACKNOWLEDGED 0x10 | ||
35 | |||
33 | struct nf_ct_tcp_flags { | 36 | struct nf_ct_tcp_flags { |
34 | u_int8_t flags; | 37 | u_int8_t flags; |
35 | u_int8_t mask; | 38 | u_int8_t mask; |
diff --git a/include/linux/netfilter/nfnetlink_conntrack.h b/include/linux/netfilter/nfnetlink_conntrack.h index 0a383ac083cb..c19595c89304 100644 --- a/include/linux/netfilter/nfnetlink_conntrack.h +++ b/include/linux/netfilter/nfnetlink_conntrack.h | |||
@@ -81,6 +81,7 @@ enum ctattr_protoinfo { | |||
81 | CTA_PROTOINFO_UNSPEC, | 81 | CTA_PROTOINFO_UNSPEC, |
82 | CTA_PROTOINFO_TCP, | 82 | CTA_PROTOINFO_TCP, |
83 | CTA_PROTOINFO_DCCP, | 83 | CTA_PROTOINFO_DCCP, |
84 | CTA_PROTOINFO_SCTP, | ||
84 | __CTA_PROTOINFO_MAX | 85 | __CTA_PROTOINFO_MAX |
85 | }; | 86 | }; |
86 | #define CTA_PROTOINFO_MAX (__CTA_PROTOINFO_MAX - 1) | 87 | #define CTA_PROTOINFO_MAX (__CTA_PROTOINFO_MAX - 1) |
@@ -103,12 +104,21 @@ enum ctattr_protoinfo_dccp { | |||
103 | }; | 104 | }; |
104 | #define CTA_PROTOINFO_DCCP_MAX (__CTA_PROTOINFO_DCCP_MAX - 1) | 105 | #define CTA_PROTOINFO_DCCP_MAX (__CTA_PROTOINFO_DCCP_MAX - 1) |
105 | 106 | ||
107 | enum ctattr_protoinfo_sctp { | ||
108 | CTA_PROTOINFO_SCTP_UNSPEC, | ||
109 | CTA_PROTOINFO_SCTP_STATE, | ||
110 | CTA_PROTOINFO_SCTP_VTAG_ORIGINAL, | ||
111 | CTA_PROTOINFO_SCTP_VTAG_REPLY, | ||
112 | __CTA_PROTOINFO_SCTP_MAX | ||
113 | }; | ||
114 | #define CTA_PROTOINFO_SCTP_MAX (__CTA_PROTOINFO_SCTP_MAX - 1) | ||
115 | |||
106 | enum ctattr_counters { | 116 | enum ctattr_counters { |
107 | CTA_COUNTERS_UNSPEC, | 117 | CTA_COUNTERS_UNSPEC, |
108 | CTA_COUNTERS_PACKETS, /* old 64bit counters */ | 118 | CTA_COUNTERS_PACKETS, /* 64bit counters */ |
109 | CTA_COUNTERS_BYTES, /* old 64bit counters */ | 119 | CTA_COUNTERS_BYTES, /* 64bit counters */ |
110 | CTA_COUNTERS32_PACKETS, | 120 | CTA_COUNTERS32_PACKETS, /* old 32bit counters, unused */ |
111 | CTA_COUNTERS32_BYTES, | 121 | CTA_COUNTERS32_BYTES, /* old 32bit counters, unused */ |
112 | __CTA_COUNTERS_MAX | 122 | __CTA_COUNTERS_MAX |
113 | }; | 123 | }; |
114 | #define CTA_COUNTERS_MAX (__CTA_COUNTERS_MAX - 1) | 124 | #define CTA_COUNTERS_MAX (__CTA_COUNTERS_MAX - 1) |
diff --git a/include/linux/netfilter/nfnetlink_log.h b/include/linux/netfilter/nfnetlink_log.h index a85721332924..f661731f3cb1 100644 --- a/include/linux/netfilter/nfnetlink_log.h +++ b/include/linux/netfilter/nfnetlink_log.h | |||
@@ -48,6 +48,9 @@ enum nfulnl_attr_type { | |||
48 | NFULA_SEQ, /* instance-local sequence number */ | 48 | NFULA_SEQ, /* instance-local sequence number */ |
49 | NFULA_SEQ_GLOBAL, /* global sequence number */ | 49 | NFULA_SEQ_GLOBAL, /* global sequence number */ |
50 | NFULA_GID, /* group id of socket */ | 50 | NFULA_GID, /* group id of socket */ |
51 | NFULA_HWTYPE, /* hardware type */ | ||
52 | NFULA_HWHEADER, /* hardware header */ | ||
53 | NFULA_HWLEN, /* hardware header length */ | ||
51 | 54 | ||
52 | __NFULA_MAX | 55 | __NFULA_MAX |
53 | }; | 56 | }; |
diff --git a/include/linux/netfilter/x_tables.h b/include/linux/netfilter/x_tables.h index 2326296b6f25..be41b609c88f 100644 --- a/include/linux/netfilter/x_tables.h +++ b/include/linux/netfilter/x_tables.h | |||
@@ -173,6 +173,98 @@ struct xt_counters_info | |||
173 | 173 | ||
174 | #include <linux/netdevice.h> | 174 | #include <linux/netdevice.h> |
175 | 175 | ||
176 | /** | ||
177 | * struct xt_match_param - parameters for match extensions' match functions | ||
178 | * | ||
179 | * @in: input netdevice | ||
180 | * @out: output netdevice | ||
181 | * @match: struct xt_match through which this function was invoked | ||
182 | * @matchinfo: per-match data | ||
183 | * @fragoff: packet is a fragment, this is the data offset | ||
184 | * @thoff: position of transport header relative to skb->data | ||
185 | * @hotdrop: drop packet if we had inspection problems | ||
186 | * @family: Actual NFPROTO_* through which the function is invoked | ||
187 | * (helpful when match->family == NFPROTO_UNSPEC) | ||
188 | */ | ||
189 | struct xt_match_param { | ||
190 | const struct net_device *in, *out; | ||
191 | const struct xt_match *match; | ||
192 | const void *matchinfo; | ||
193 | int fragoff; | ||
194 | unsigned int thoff; | ||
195 | bool *hotdrop; | ||
196 | u_int8_t family; | ||
197 | }; | ||
198 | |||
199 | /** | ||
200 | * struct xt_mtchk_param - parameters for match extensions' | ||
201 | * checkentry functions | ||
202 | * | ||
203 | * @table: table the rule is tried to be inserted into | ||
204 | * @entryinfo: the family-specific rule data | ||
205 | * (struct ipt_ip, ip6t_ip, ebt_entry) | ||
206 | * @match: struct xt_match through which this function was invoked | ||
207 | * @matchinfo: per-match data | ||
208 | * @hook_mask: via which hooks the new rule is reachable | ||
209 | */ | ||
210 | struct xt_mtchk_param { | ||
211 | const char *table; | ||
212 | const void *entryinfo; | ||
213 | const struct xt_match *match; | ||
214 | void *matchinfo; | ||
215 | unsigned int hook_mask; | ||
216 | u_int8_t family; | ||
217 | }; | ||
218 | |||
219 | /* Match destructor parameters */ | ||
220 | struct xt_mtdtor_param { | ||
221 | const struct xt_match *match; | ||
222 | void *matchinfo; | ||
223 | u_int8_t family; | ||
224 | }; | ||
225 | |||
226 | /** | ||
227 | * struct xt_target_param - parameters for target extensions' target functions | ||
228 | * | ||
229 | * @hooknum: hook through which this target was invoked | ||
230 | * @target: struct xt_target through which this function was invoked | ||
231 | * @targinfo: per-target data | ||
232 | * | ||
233 | * Other fields see above. | ||
234 | */ | ||
235 | struct xt_target_param { | ||
236 | const struct net_device *in, *out; | ||
237 | unsigned int hooknum; | ||
238 | const struct xt_target *target; | ||
239 | const void *targinfo; | ||
240 | u_int8_t family; | ||
241 | }; | ||
242 | |||
243 | /** | ||
244 | * struct xt_tgchk_param - parameters for target extensions' | ||
245 | * checkentry functions | ||
246 | * | ||
247 | * @entryinfo: the family-specific rule data | ||
248 | * (struct ipt_entry, ip6t_entry, arpt_entry, ebt_entry) | ||
249 | * | ||
250 | * Other fields see above. | ||
251 | */ | ||
252 | struct xt_tgchk_param { | ||
253 | const char *table; | ||
254 | void *entryinfo; | ||
255 | const struct xt_target *target; | ||
256 | void *targinfo; | ||
257 | unsigned int hook_mask; | ||
258 | u_int8_t family; | ||
259 | }; | ||
260 | |||
261 | /* Target destructor parameters */ | ||
262 | struct xt_tgdtor_param { | ||
263 | const struct xt_target *target; | ||
264 | void *targinfo; | ||
265 | u_int8_t family; | ||
266 | }; | ||
267 | |||
176 | struct xt_match | 268 | struct xt_match |
177 | { | 269 | { |
178 | struct list_head list; | 270 | struct list_head list; |
@@ -185,24 +277,13 @@ struct xt_match | |||
185 | non-linear skb, using skb_header_pointer and | 277 | non-linear skb, using skb_header_pointer and |
186 | skb_ip_make_writable. */ | 278 | skb_ip_make_writable. */ |
187 | bool (*match)(const struct sk_buff *skb, | 279 | bool (*match)(const struct sk_buff *skb, |
188 | const struct net_device *in, | 280 | const struct xt_match_param *); |
189 | const struct net_device *out, | ||
190 | const struct xt_match *match, | ||
191 | const void *matchinfo, | ||
192 | int offset, | ||
193 | unsigned int protoff, | ||
194 | bool *hotdrop); | ||
195 | 281 | ||
196 | /* Called when user tries to insert an entry of this type. */ | 282 | /* Called when user tries to insert an entry of this type. */ |
197 | /* Should return true or false. */ | 283 | bool (*checkentry)(const struct xt_mtchk_param *); |
198 | bool (*checkentry)(const char *tablename, | ||
199 | const void *ip, | ||
200 | const struct xt_match *match, | ||
201 | void *matchinfo, | ||
202 | unsigned int hook_mask); | ||
203 | 284 | ||
204 | /* Called when entry of this type deleted. */ | 285 | /* Called when entry of this type deleted. */ |
205 | void (*destroy)(const struct xt_match *match, void *matchinfo); | 286 | void (*destroy)(const struct xt_mtdtor_param *); |
206 | 287 | ||
207 | /* Called when userspace align differs from kernel space one */ | 288 | /* Called when userspace align differs from kernel space one */ |
208 | void (*compat_from_user)(void *dst, void *src); | 289 | void (*compat_from_user)(void *dst, void *src); |
@@ -235,24 +316,16 @@ struct xt_target | |||
235 | must now handle non-linear skbs, using skb_copy_bits and | 316 | must now handle non-linear skbs, using skb_copy_bits and |
236 | skb_ip_make_writable. */ | 317 | skb_ip_make_writable. */ |
237 | unsigned int (*target)(struct sk_buff *skb, | 318 | unsigned int (*target)(struct sk_buff *skb, |
238 | const struct net_device *in, | 319 | const struct xt_target_param *); |
239 | const struct net_device *out, | ||
240 | unsigned int hooknum, | ||
241 | const struct xt_target *target, | ||
242 | const void *targinfo); | ||
243 | 320 | ||
244 | /* Called when user tries to insert an entry of this type: | 321 | /* Called when user tries to insert an entry of this type: |
245 | hook_mask is a bitmask of hooks from which it can be | 322 | hook_mask is a bitmask of hooks from which it can be |
246 | called. */ | 323 | called. */ |
247 | /* Should return true or false. */ | 324 | /* Should return true or false. */ |
248 | bool (*checkentry)(const char *tablename, | 325 | bool (*checkentry)(const struct xt_tgchk_param *); |
249 | const void *entry, | ||
250 | const struct xt_target *target, | ||
251 | void *targinfo, | ||
252 | unsigned int hook_mask); | ||
253 | 326 | ||
254 | /* Called when entry of this type deleted. */ | 327 | /* Called when entry of this type deleted. */ |
255 | void (*destroy)(const struct xt_target *target, void *targinfo); | 328 | void (*destroy)(const struct xt_tgdtor_param *); |
256 | 329 | ||
257 | /* Called when userspace align differs from kernel space one */ | 330 | /* Called when userspace align differs from kernel space one */ |
258 | void (*compat_from_user)(void *dst, void *src); | 331 | void (*compat_from_user)(void *dst, void *src); |
@@ -292,7 +365,7 @@ struct xt_table | |||
292 | /* Set this to THIS_MODULE if you are a module, otherwise NULL */ | 365 | /* Set this to THIS_MODULE if you are a module, otherwise NULL */ |
293 | struct module *me; | 366 | struct module *me; |
294 | 367 | ||
295 | int af; /* address/protocol family */ | 368 | u_int8_t af; /* address/protocol family */ |
296 | }; | 369 | }; |
297 | 370 | ||
298 | #include <linux/netfilter_ipv4.h> | 371 | #include <linux/netfilter_ipv4.h> |
@@ -328,12 +401,10 @@ extern void xt_unregister_match(struct xt_match *target); | |||
328 | extern int xt_register_matches(struct xt_match *match, unsigned int n); | 401 | extern int xt_register_matches(struct xt_match *match, unsigned int n); |
329 | extern void xt_unregister_matches(struct xt_match *match, unsigned int n); | 402 | extern void xt_unregister_matches(struct xt_match *match, unsigned int n); |
330 | 403 | ||
331 | extern int xt_check_match(const struct xt_match *match, unsigned short family, | 404 | extern int xt_check_match(struct xt_mtchk_param *, |
332 | unsigned int size, const char *table, unsigned int hook, | 405 | unsigned int size, u_int8_t proto, bool inv_proto); |
333 | unsigned short proto, int inv_proto); | 406 | extern int xt_check_target(struct xt_tgchk_param *, |
334 | extern int xt_check_target(const struct xt_target *target, unsigned short family, | 407 | unsigned int size, u_int8_t proto, bool inv_proto); |
335 | unsigned int size, const char *table, unsigned int hook, | ||
336 | unsigned short proto, int inv_proto); | ||
337 | 408 | ||
338 | extern struct xt_table *xt_register_table(struct net *net, | 409 | extern struct xt_table *xt_register_table(struct net *net, |
339 | struct xt_table *table, | 410 | struct xt_table *table, |
@@ -346,19 +417,19 @@ extern struct xt_table_info *xt_replace_table(struct xt_table *table, | |||
346 | struct xt_table_info *newinfo, | 417 | struct xt_table_info *newinfo, |
347 | int *error); | 418 | int *error); |
348 | 419 | ||
349 | extern struct xt_match *xt_find_match(int af, const char *name, u8 revision); | 420 | extern struct xt_match *xt_find_match(u8 af, const char *name, u8 revision); |
350 | extern struct xt_target *xt_find_target(int af, const char *name, u8 revision); | 421 | extern struct xt_target *xt_find_target(u8 af, const char *name, u8 revision); |
351 | extern struct xt_target *xt_request_find_target(int af, const char *name, | 422 | extern struct xt_target *xt_request_find_target(u8 af, const char *name, |
352 | u8 revision); | 423 | u8 revision); |
353 | extern int xt_find_revision(int af, const char *name, u8 revision, int target, | 424 | extern int xt_find_revision(u8 af, const char *name, u8 revision, |
354 | int *err); | 425 | int target, int *err); |
355 | 426 | ||
356 | extern struct xt_table *xt_find_table_lock(struct net *net, int af, | 427 | extern struct xt_table *xt_find_table_lock(struct net *net, u_int8_t af, |
357 | const char *name); | 428 | const char *name); |
358 | extern void xt_table_unlock(struct xt_table *t); | 429 | extern void xt_table_unlock(struct xt_table *t); |
359 | 430 | ||
360 | extern int xt_proto_init(struct net *net, int af); | 431 | extern int xt_proto_init(struct net *net, u_int8_t af); |
361 | extern void xt_proto_fini(struct net *net, int af); | 432 | extern void xt_proto_fini(struct net *net, u_int8_t af); |
362 | 433 | ||
363 | extern struct xt_table_info *xt_alloc_table_info(unsigned int size); | 434 | extern struct xt_table_info *xt_alloc_table_info(unsigned int size); |
364 | extern void xt_free_table_info(struct xt_table_info *info); | 435 | extern void xt_free_table_info(struct xt_table_info *info); |
@@ -423,12 +494,12 @@ struct compat_xt_counters_info | |||
423 | #define COMPAT_XT_ALIGN(s) (((s) + (__alignof__(struct compat_xt_counters)-1)) \ | 494 | #define COMPAT_XT_ALIGN(s) (((s) + (__alignof__(struct compat_xt_counters)-1)) \ |
424 | & ~(__alignof__(struct compat_xt_counters)-1)) | 495 | & ~(__alignof__(struct compat_xt_counters)-1)) |
425 | 496 | ||
426 | extern void xt_compat_lock(int af); | 497 | extern void xt_compat_lock(u_int8_t af); |
427 | extern void xt_compat_unlock(int af); | 498 | extern void xt_compat_unlock(u_int8_t af); |
428 | 499 | ||
429 | extern int xt_compat_add_offset(int af, unsigned int offset, short delta); | 500 | extern int xt_compat_add_offset(u_int8_t af, unsigned int offset, short delta); |
430 | extern void xt_compat_flush_offsets(int af); | 501 | extern void xt_compat_flush_offsets(u_int8_t af); |
431 | extern short xt_compat_calc_jump(int af, unsigned int offset); | 502 | extern short xt_compat_calc_jump(u_int8_t af, unsigned int offset); |
432 | 503 | ||
433 | extern int xt_compat_match_offset(const struct xt_match *match); | 504 | extern int xt_compat_match_offset(const struct xt_match *match); |
434 | extern int xt_compat_match_from_user(struct xt_entry_match *m, | 505 | extern int xt_compat_match_from_user(struct xt_entry_match *m, |
diff --git a/include/linux/netfilter/xt_TPROXY.h b/include/linux/netfilter/xt_TPROXY.h new file mode 100644 index 000000000000..152e8f97132b --- /dev/null +++ b/include/linux/netfilter/xt_TPROXY.h | |||
@@ -0,0 +1,14 @@ | |||
1 | #ifndef _XT_TPROXY_H_target | ||
2 | #define _XT_TPROXY_H_target | ||
3 | |||
4 | /* TPROXY target is capable of marking the packet to perform | ||
5 | * redirection. We can get rid of that whenever we get support for | ||
6 | * mutliple targets in the same rule. */ | ||
7 | struct xt_tproxy_target_info { | ||
8 | u_int32_t mark_mask; | ||
9 | u_int32_t mark_value; | ||
10 | __be32 laddr; | ||
11 | __be16 lport; | ||
12 | }; | ||
13 | |||
14 | #endif /* _XT_TPROXY_H_target */ | ||
diff --git a/include/linux/netfilter/xt_recent.h b/include/linux/netfilter/xt_recent.h new file mode 100644 index 000000000000..5cfeb81c6794 --- /dev/null +++ b/include/linux/netfilter/xt_recent.h | |||
@@ -0,0 +1,26 @@ | |||
1 | #ifndef _LINUX_NETFILTER_XT_RECENT_H | ||
2 | #define _LINUX_NETFILTER_XT_RECENT_H 1 | ||
3 | |||
4 | enum { | ||
5 | XT_RECENT_CHECK = 1 << 0, | ||
6 | XT_RECENT_SET = 1 << 1, | ||
7 | XT_RECENT_UPDATE = 1 << 2, | ||
8 | XT_RECENT_REMOVE = 1 << 3, | ||
9 | XT_RECENT_TTL = 1 << 4, | ||
10 | |||
11 | XT_RECENT_SOURCE = 0, | ||
12 | XT_RECENT_DEST = 1, | ||
13 | |||
14 | XT_RECENT_NAME_LEN = 200, | ||
15 | }; | ||
16 | |||
17 | struct xt_recent_mtinfo { | ||
18 | u_int32_t seconds; | ||
19 | u_int32_t hit_count; | ||
20 | u_int8_t check_set; | ||
21 | u_int8_t invert; | ||
22 | char name[XT_RECENT_NAME_LEN]; | ||
23 | u_int8_t side; | ||
24 | }; | ||
25 | |||
26 | #endif /* _LINUX_NETFILTER_XT_RECENT_H */ | ||
diff --git a/include/linux/netfilter/xt_string.h b/include/linux/netfilter/xt_string.h index bb21dd1aee2d..8a6ba7bbef9f 100644 --- a/include/linux/netfilter/xt_string.h +++ b/include/linux/netfilter/xt_string.h | |||
@@ -4,6 +4,11 @@ | |||
4 | #define XT_STRING_MAX_PATTERN_SIZE 128 | 4 | #define XT_STRING_MAX_PATTERN_SIZE 128 |
5 | #define XT_STRING_MAX_ALGO_NAME_SIZE 16 | 5 | #define XT_STRING_MAX_ALGO_NAME_SIZE 16 |
6 | 6 | ||
7 | enum { | ||
8 | XT_STRING_FLAG_INVERT = 0x01, | ||
9 | XT_STRING_FLAG_IGNORECASE = 0x02 | ||
10 | }; | ||
11 | |||
7 | struct xt_string_info | 12 | struct xt_string_info |
8 | { | 13 | { |
9 | u_int16_t from_offset; | 14 | u_int16_t from_offset; |
@@ -11,7 +16,15 @@ struct xt_string_info | |||
11 | char algo[XT_STRING_MAX_ALGO_NAME_SIZE]; | 16 | char algo[XT_STRING_MAX_ALGO_NAME_SIZE]; |
12 | char pattern[XT_STRING_MAX_PATTERN_SIZE]; | 17 | char pattern[XT_STRING_MAX_PATTERN_SIZE]; |
13 | u_int8_t patlen; | 18 | u_int8_t patlen; |
14 | u_int8_t invert; | 19 | union { |
20 | struct { | ||
21 | u_int8_t invert; | ||
22 | } v0; | ||
23 | |||
24 | struct { | ||
25 | u_int8_t flags; | ||
26 | } v1; | ||
27 | } u; | ||
15 | 28 | ||
16 | /* Used internally by the kernel */ | 29 | /* Used internally by the kernel */ |
17 | struct ts_config __attribute__((aligned(8))) *config; | 30 | struct ts_config __attribute__((aligned(8))) *config; |
diff --git a/include/linux/netfilter_bridge/ebt_ip6.h b/include/linux/netfilter_bridge/ebt_ip6.h new file mode 100644 index 000000000000..2273c3ae33ca --- /dev/null +++ b/include/linux/netfilter_bridge/ebt_ip6.h | |||
@@ -0,0 +1,40 @@ | |||
1 | /* | ||
2 | * ebt_ip6 | ||
3 | * | ||
4 | * Authors: | ||
5 | * Kuo-Lang Tseng <kuo-lang.tseng@intel.com> | ||
6 | * Manohar Castelino <manohar.r.castelino@intel.com> | ||
7 | * | ||
8 | * Jan 11, 2008 | ||
9 | * | ||
10 | */ | ||
11 | |||
12 | #ifndef __LINUX_BRIDGE_EBT_IP6_H | ||
13 | #define __LINUX_BRIDGE_EBT_IP6_H | ||
14 | |||
15 | #define EBT_IP6_SOURCE 0x01 | ||
16 | #define EBT_IP6_DEST 0x02 | ||
17 | #define EBT_IP6_TCLASS 0x04 | ||
18 | #define EBT_IP6_PROTO 0x08 | ||
19 | #define EBT_IP6_SPORT 0x10 | ||
20 | #define EBT_IP6_DPORT 0x20 | ||
21 | #define EBT_IP6_MASK (EBT_IP6_SOURCE | EBT_IP6_DEST | EBT_IP6_TCLASS |\ | ||
22 | EBT_IP6_PROTO | EBT_IP6_SPORT | EBT_IP6_DPORT) | ||
23 | #define EBT_IP6_MATCH "ip6" | ||
24 | |||
25 | /* the same values are used for the invflags */ | ||
26 | struct ebt_ip6_info | ||
27 | { | ||
28 | struct in6_addr saddr; | ||
29 | struct in6_addr daddr; | ||
30 | struct in6_addr smsk; | ||
31 | struct in6_addr dmsk; | ||
32 | uint8_t tclass; | ||
33 | uint8_t protocol; | ||
34 | uint8_t bitmask; | ||
35 | uint8_t invflags; | ||
36 | uint16_t sport[2]; | ||
37 | uint16_t dport[2]; | ||
38 | }; | ||
39 | |||
40 | #endif | ||
diff --git a/include/linux/netfilter_bridge/ebt_log.h b/include/linux/netfilter_bridge/ebt_log.h index 96e231ae7554..b76e653157e5 100644 --- a/include/linux/netfilter_bridge/ebt_log.h +++ b/include/linux/netfilter_bridge/ebt_log.h | |||
@@ -4,7 +4,8 @@ | |||
4 | #define EBT_LOG_IP 0x01 /* if the frame is made by ip, log the ip information */ | 4 | #define EBT_LOG_IP 0x01 /* if the frame is made by ip, log the ip information */ |
5 | #define EBT_LOG_ARP 0x02 | 5 | #define EBT_LOG_ARP 0x02 |
6 | #define EBT_LOG_NFLOG 0x04 | 6 | #define EBT_LOG_NFLOG 0x04 |
7 | #define EBT_LOG_MASK (EBT_LOG_IP | EBT_LOG_ARP) | 7 | #define EBT_LOG_IP6 0x08 |
8 | #define EBT_LOG_MASK (EBT_LOG_IP | EBT_LOG_ARP | EBT_LOG_IP6) | ||
8 | #define EBT_LOG_PREFIX_SIZE 30 | 9 | #define EBT_LOG_PREFIX_SIZE 30 |
9 | #define EBT_LOG_WATCHER "log" | 10 | #define EBT_LOG_WATCHER "log" |
10 | 11 | ||
diff --git a/include/linux/netfilter_bridge/ebtables.h b/include/linux/netfilter_bridge/ebtables.h index 892f5b7771c7..d45e29cd1cfb 100644 --- a/include/linux/netfilter_bridge/ebtables.h +++ b/include/linux/netfilter_bridge/ebtables.h | |||
@@ -31,6 +31,9 @@ | |||
31 | * The 4 lsb are more than enough to store the verdict. */ | 31 | * The 4 lsb are more than enough to store the verdict. */ |
32 | #define EBT_VERDICT_BITS 0x0000000F | 32 | #define EBT_VERDICT_BITS 0x0000000F |
33 | 33 | ||
34 | struct xt_match; | ||
35 | struct xt_target; | ||
36 | |||
34 | struct ebt_counter | 37 | struct ebt_counter |
35 | { | 38 | { |
36 | uint64_t pcnt; | 39 | uint64_t pcnt; |
@@ -121,7 +124,7 @@ struct ebt_entry_match | |||
121 | { | 124 | { |
122 | union { | 125 | union { |
123 | char name[EBT_FUNCTION_MAXNAMELEN]; | 126 | char name[EBT_FUNCTION_MAXNAMELEN]; |
124 | struct ebt_match *match; | 127 | struct xt_match *match; |
125 | } u; | 128 | } u; |
126 | /* size of data */ | 129 | /* size of data */ |
127 | unsigned int match_size; | 130 | unsigned int match_size; |
@@ -132,7 +135,7 @@ struct ebt_entry_watcher | |||
132 | { | 135 | { |
133 | union { | 136 | union { |
134 | char name[EBT_FUNCTION_MAXNAMELEN]; | 137 | char name[EBT_FUNCTION_MAXNAMELEN]; |
135 | struct ebt_watcher *watcher; | 138 | struct xt_target *watcher; |
136 | } u; | 139 | } u; |
137 | /* size of data */ | 140 | /* size of data */ |
138 | unsigned int watcher_size; | 141 | unsigned int watcher_size; |
@@ -143,7 +146,7 @@ struct ebt_entry_target | |||
143 | { | 146 | { |
144 | union { | 147 | union { |
145 | char name[EBT_FUNCTION_MAXNAMELEN]; | 148 | char name[EBT_FUNCTION_MAXNAMELEN]; |
146 | struct ebt_target *target; | 149 | struct xt_target *target; |
147 | } u; | 150 | } u; |
148 | /* size of data */ | 151 | /* size of data */ |
149 | unsigned int target_size; | 152 | unsigned int target_size; |
@@ -207,14 +210,17 @@ struct ebt_match | |||
207 | { | 210 | { |
208 | struct list_head list; | 211 | struct list_head list; |
209 | const char name[EBT_FUNCTION_MAXNAMELEN]; | 212 | const char name[EBT_FUNCTION_MAXNAMELEN]; |
210 | /* 0 == it matches */ | 213 | bool (*match)(const struct sk_buff *skb, const struct net_device *in, |
211 | int (*match)(const struct sk_buff *skb, const struct net_device *in, | 214 | const struct net_device *out, const struct xt_match *match, |
212 | const struct net_device *out, const void *matchdata, | 215 | const void *matchinfo, int offset, unsigned int protoff, |
213 | unsigned int datalen); | 216 | bool *hotdrop); |
214 | /* 0 == let it in */ | 217 | bool (*checkentry)(const char *table, const void *entry, |
215 | int (*check)(const char *tablename, unsigned int hookmask, | 218 | const struct xt_match *match, void *matchinfo, |
216 | const struct ebt_entry *e, void *matchdata, unsigned int datalen); | 219 | unsigned int hook_mask); |
217 | void (*destroy)(void *matchdata, unsigned int datalen); | 220 | void (*destroy)(const struct xt_match *match, void *matchinfo); |
221 | unsigned int matchsize; | ||
222 | u_int8_t revision; | ||
223 | u_int8_t family; | ||
218 | struct module *me; | 224 | struct module *me; |
219 | }; | 225 | }; |
220 | 226 | ||
@@ -222,13 +228,17 @@ struct ebt_watcher | |||
222 | { | 228 | { |
223 | struct list_head list; | 229 | struct list_head list; |
224 | const char name[EBT_FUNCTION_MAXNAMELEN]; | 230 | const char name[EBT_FUNCTION_MAXNAMELEN]; |
225 | void (*watcher)(const struct sk_buff *skb, unsigned int hooknr, | 231 | unsigned int (*target)(struct sk_buff *skb, |
226 | const struct net_device *in, const struct net_device *out, | 232 | const struct net_device *in, const struct net_device *out, |
227 | const void *watcherdata, unsigned int datalen); | 233 | unsigned int hook_num, const struct xt_target *target, |
228 | /* 0 == let it in */ | 234 | const void *targinfo); |
229 | int (*check)(const char *tablename, unsigned int hookmask, | 235 | bool (*checkentry)(const char *table, const void *entry, |
230 | const struct ebt_entry *e, void *watcherdata, unsigned int datalen); | 236 | const struct xt_target *target, void *targinfo, |
231 | void (*destroy)(void *watcherdata, unsigned int datalen); | 237 | unsigned int hook_mask); |
238 | void (*destroy)(const struct xt_target *target, void *targinfo); | ||
239 | unsigned int targetsize; | ||
240 | u_int8_t revision; | ||
241 | u_int8_t family; | ||
232 | struct module *me; | 242 | struct module *me; |
233 | }; | 243 | }; |
234 | 244 | ||
@@ -236,14 +246,18 @@ struct ebt_target | |||
236 | { | 246 | { |
237 | struct list_head list; | 247 | struct list_head list; |
238 | const char name[EBT_FUNCTION_MAXNAMELEN]; | 248 | const char name[EBT_FUNCTION_MAXNAMELEN]; |
239 | /* returns one of the standard verdicts */ | 249 | /* returns one of the standard EBT_* verdicts */ |
240 | int (*target)(struct sk_buff *skb, unsigned int hooknr, | 250 | unsigned int (*target)(struct sk_buff *skb, |
241 | const struct net_device *in, const struct net_device *out, | 251 | const struct net_device *in, const struct net_device *out, |
242 | const void *targetdata, unsigned int datalen); | 252 | unsigned int hook_num, const struct xt_target *target, |
243 | /* 0 == let it in */ | 253 | const void *targinfo); |
244 | int (*check)(const char *tablename, unsigned int hookmask, | 254 | bool (*checkentry)(const char *table, const void *entry, |
245 | const struct ebt_entry *e, void *targetdata, unsigned int datalen); | 255 | const struct xt_target *target, void *targinfo, |
246 | void (*destroy)(void *targetdata, unsigned int datalen); | 256 | unsigned int hook_mask); |
257 | void (*destroy)(const struct xt_target *target, void *targinfo); | ||
258 | unsigned int targetsize; | ||
259 | u_int8_t revision; | ||
260 | u_int8_t family; | ||
247 | struct module *me; | 261 | struct module *me; |
248 | }; | 262 | }; |
249 | 263 | ||
@@ -288,12 +302,6 @@ struct ebt_table | |||
288 | ~(__alignof__(struct ebt_replace)-1)) | 302 | ~(__alignof__(struct ebt_replace)-1)) |
289 | extern int ebt_register_table(struct ebt_table *table); | 303 | extern int ebt_register_table(struct ebt_table *table); |
290 | extern void ebt_unregister_table(struct ebt_table *table); | 304 | extern void ebt_unregister_table(struct ebt_table *table); |
291 | extern int ebt_register_match(struct ebt_match *match); | ||
292 | extern void ebt_unregister_match(struct ebt_match *match); | ||
293 | extern int ebt_register_watcher(struct ebt_watcher *watcher); | ||
294 | extern void ebt_unregister_watcher(struct ebt_watcher *watcher); | ||
295 | extern int ebt_register_target(struct ebt_target *target); | ||
296 | extern void ebt_unregister_target(struct ebt_target *target); | ||
297 | extern unsigned int ebt_do_table(unsigned int hook, struct sk_buff *skb, | 305 | extern unsigned int ebt_do_table(unsigned int hook, struct sk_buff *skb, |
298 | const struct net_device *in, const struct net_device *out, | 306 | const struct net_device *in, const struct net_device *out, |
299 | struct ebt_table *table); | 307 | struct ebt_table *table); |
@@ -302,9 +310,9 @@ extern unsigned int ebt_do_table(unsigned int hook, struct sk_buff *skb, | |||
302 | #define FWINV(bool,invflg) ((bool) ^ !!(info->invflags & invflg)) | 310 | #define FWINV(bool,invflg) ((bool) ^ !!(info->invflags & invflg)) |
303 | /* True if the hook mask denotes that the rule is in a base chain, | 311 | /* True if the hook mask denotes that the rule is in a base chain, |
304 | * used in the check() functions */ | 312 | * used in the check() functions */ |
305 | #define BASE_CHAIN (hookmask & (1 << NF_BR_NUMHOOKS)) | 313 | #define BASE_CHAIN (par->hook_mask & (1 << NF_BR_NUMHOOKS)) |
306 | /* Clear the bit in the hook mask that tells if the rule is on a base chain */ | 314 | /* Clear the bit in the hook mask that tells if the rule is on a base chain */ |
307 | #define CLEAR_BASE_CHAIN_BIT (hookmask &= ~(1 << NF_BR_NUMHOOKS)) | 315 | #define CLEAR_BASE_CHAIN_BIT (par->hook_mask &= ~(1 << NF_BR_NUMHOOKS)) |
308 | /* True if the target is not a standard target */ | 316 | /* True if the target is not a standard target */ |
309 | #define INVALID_TARGET (info->target < -NUM_STANDARD_TARGETS || info->target >= 0) | 317 | #define INVALID_TARGET (info->target < -NUM_STANDARD_TARGETS || info->target >= 0) |
310 | 318 | ||
diff --git a/include/linux/netfilter_ipv4.h b/include/linux/netfilter_ipv4.h index 650318b0c405..29c7727ff0e8 100644 --- a/include/linux/netfilter_ipv4.h +++ b/include/linux/netfilter_ipv4.h | |||
@@ -60,6 +60,7 @@ enum nf_ip_hook_priorities { | |||
60 | NF_IP_PRI_MANGLE = -150, | 60 | NF_IP_PRI_MANGLE = -150, |
61 | NF_IP_PRI_NAT_DST = -100, | 61 | NF_IP_PRI_NAT_DST = -100, |
62 | NF_IP_PRI_FILTER = 0, | 62 | NF_IP_PRI_FILTER = 0, |
63 | NF_IP_PRI_SECURITY = 50, | ||
63 | NF_IP_PRI_NAT_SRC = 100, | 64 | NF_IP_PRI_NAT_SRC = 100, |
64 | NF_IP_PRI_SELINUX_LAST = 225, | 65 | NF_IP_PRI_SELINUX_LAST = 225, |
65 | NF_IP_PRI_CONNTRACK_CONFIRM = INT_MAX, | 66 | NF_IP_PRI_CONNTRACK_CONFIRM = INT_MAX, |
diff --git a/include/linux/netfilter_ipv4/ipt_recent.h b/include/linux/netfilter_ipv4/ipt_recent.h index 6508a4592651..d636cca133c2 100644 --- a/include/linux/netfilter_ipv4/ipt_recent.h +++ b/include/linux/netfilter_ipv4/ipt_recent.h | |||
@@ -1,27 +1,21 @@ | |||
1 | #ifndef _IPT_RECENT_H | 1 | #ifndef _IPT_RECENT_H |
2 | #define _IPT_RECENT_H | 2 | #define _IPT_RECENT_H |
3 | 3 | ||
4 | #define RECENT_NAME "ipt_recent" | 4 | #include <linux/netfilter/xt_recent.h> |
5 | #define RECENT_VER "v0.3.1" | ||
6 | 5 | ||
7 | #define IPT_RECENT_CHECK 1 | 6 | #define ipt_recent_info xt_recent_mtinfo |
8 | #define IPT_RECENT_SET 2 | ||
9 | #define IPT_RECENT_UPDATE 4 | ||
10 | #define IPT_RECENT_REMOVE 8 | ||
11 | #define IPT_RECENT_TTL 16 | ||
12 | 7 | ||
13 | #define IPT_RECENT_SOURCE 0 | 8 | enum { |
14 | #define IPT_RECENT_DEST 1 | 9 | IPT_RECENT_CHECK = XT_RECENT_CHECK, |
10 | IPT_RECENT_SET = XT_RECENT_SET, | ||
11 | IPT_RECENT_UPDATE = XT_RECENT_UPDATE, | ||
12 | IPT_RECENT_REMOVE = XT_RECENT_REMOVE, | ||
13 | IPT_RECENT_TTL = XT_RECENT_TTL, | ||
15 | 14 | ||
16 | #define IPT_RECENT_NAME_LEN 200 | 15 | IPT_RECENT_SOURCE = XT_RECENT_SOURCE, |
16 | IPT_RECENT_DEST = XT_RECENT_DEST, | ||
17 | 17 | ||
18 | struct ipt_recent_info { | 18 | IPT_RECENT_NAME_LEN = XT_RECENT_NAME_LEN, |
19 | u_int32_t seconds; | ||
20 | u_int32_t hit_count; | ||
21 | u_int8_t check_set; | ||
22 | u_int8_t invert; | ||
23 | char name[IPT_RECENT_NAME_LEN]; | ||
24 | u_int8_t side; | ||
25 | }; | 19 | }; |
26 | 20 | ||
27 | #endif /*_IPT_RECENT_H*/ | 21 | #endif /*_IPT_RECENT_H*/ |
diff --git a/include/linux/netfilter_ipv6.h b/include/linux/netfilter_ipv6.h index 3475a65dae9b..d654873aa25a 100644 --- a/include/linux/netfilter_ipv6.h +++ b/include/linux/netfilter_ipv6.h | |||
@@ -64,11 +64,14 @@ enum nf_ip6_hook_priorities { | |||
64 | NF_IP6_PRI_MANGLE = -150, | 64 | NF_IP6_PRI_MANGLE = -150, |
65 | NF_IP6_PRI_NAT_DST = -100, | 65 | NF_IP6_PRI_NAT_DST = -100, |
66 | NF_IP6_PRI_FILTER = 0, | 66 | NF_IP6_PRI_FILTER = 0, |
67 | NF_IP6_PRI_SECURITY = 50, | ||
67 | NF_IP6_PRI_NAT_SRC = 100, | 68 | NF_IP6_PRI_NAT_SRC = 100, |
68 | NF_IP6_PRI_SELINUX_LAST = 225, | 69 | NF_IP6_PRI_SELINUX_LAST = 225, |
69 | NF_IP6_PRI_LAST = INT_MAX, | 70 | NF_IP6_PRI_LAST = INT_MAX, |
70 | }; | 71 | }; |
71 | 72 | ||
73 | #ifdef __KERNEL__ | ||
74 | |||
72 | #ifdef CONFIG_NETFILTER | 75 | #ifdef CONFIG_NETFILTER |
73 | extern int ip6_route_me_harder(struct sk_buff *skb); | 76 | extern int ip6_route_me_harder(struct sk_buff *skb); |
74 | extern __sum16 nf_ip6_checksum(struct sk_buff *skb, unsigned int hook, | 77 | extern __sum16 nf_ip6_checksum(struct sk_buff *skb, unsigned int hook, |
@@ -81,4 +84,6 @@ static inline int ipv6_netfilter_init(void) { return 0; } | |||
81 | static inline void ipv6_netfilter_fini(void) { return; } | 84 | static inline void ipv6_netfilter_fini(void) { return; } |
82 | #endif /* CONFIG_NETFILTER */ | 85 | #endif /* CONFIG_NETFILTER */ |
83 | 86 | ||
87 | #endif /* __KERNEL__ */ | ||
88 | |||
84 | #endif /*__LINUX_IP6_NETFILTER_H*/ | 89 | #endif /*__LINUX_IP6_NETFILTER_H*/ |
diff --git a/include/linux/netlink.h b/include/linux/netlink.h index bec1062a25a1..9ff1b54908f3 100644 --- a/include/linux/netlink.h +++ b/include/linux/netlink.h | |||
@@ -193,7 +193,7 @@ extern int netlink_unregister_notifier(struct notifier_block *nb); | |||
193 | 193 | ||
194 | /* finegrained unicast helpers: */ | 194 | /* finegrained unicast helpers: */ |
195 | struct sock *netlink_getsockbyfilp(struct file *filp); | 195 | struct sock *netlink_getsockbyfilp(struct file *filp); |
196 | int netlink_attachskb(struct sock *sk, struct sk_buff *skb, int nonblock, | 196 | int netlink_attachskb(struct sock *sk, struct sk_buff *skb, |
197 | long *timeo, struct sock *ssk); | 197 | long *timeo, struct sock *ssk); |
198 | void netlink_detachskb(struct sock *sk, struct sk_buff *skb); | 198 | void netlink_detachskb(struct sock *sk, struct sk_buff *skb); |
199 | int netlink_sendskb(struct sock *sk, struct sk_buff *skb); | 199 | int netlink_sendskb(struct sock *sk, struct sk_buff *skb); |
diff --git a/include/linux/nfs4.h b/include/linux/nfs4.h index 8726491de154..ea0366769484 100644 --- a/include/linux/nfs4.h +++ b/include/linux/nfs4.h | |||
@@ -65,9 +65,6 @@ | |||
65 | #define NFS4_ACE_SUCCESSFUL_ACCESS_ACE_FLAG 0x00000010 | 65 | #define NFS4_ACE_SUCCESSFUL_ACCESS_ACE_FLAG 0x00000010 |
66 | #define NFS4_ACE_FAILED_ACCESS_ACE_FLAG 0x00000020 | 66 | #define NFS4_ACE_FAILED_ACCESS_ACE_FLAG 0x00000020 |
67 | #define NFS4_ACE_IDENTIFIER_GROUP 0x00000040 | 67 | #define NFS4_ACE_IDENTIFIER_GROUP 0x00000040 |
68 | #define NFS4_ACE_OWNER 0x00000080 | ||
69 | #define NFS4_ACE_GROUP 0x00000100 | ||
70 | #define NFS4_ACE_EVERYONE 0x00000200 | ||
71 | 68 | ||
72 | #define NFS4_ACE_READ_DATA 0x00000001 | 69 | #define NFS4_ACE_READ_DATA 0x00000001 |
73 | #define NFS4_ACE_LIST_DIRECTORY 0x00000001 | 70 | #define NFS4_ACE_LIST_DIRECTORY 0x00000001 |
diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h index 27d6a8d98cef..78a5922a2f11 100644 --- a/include/linux/nfs_fs.h +++ b/include/linux/nfs_fs.h | |||
@@ -12,9 +12,19 @@ | |||
12 | #include <linux/magic.h> | 12 | #include <linux/magic.h> |
13 | 13 | ||
14 | /* Default timeout values */ | 14 | /* Default timeout values */ |
15 | #define NFS_DEF_UDP_TIMEO (11) | ||
16 | #define NFS_DEF_UDP_RETRANS (3) | ||
17 | #define NFS_DEF_TCP_TIMEO (600) | ||
18 | #define NFS_DEF_TCP_RETRANS (2) | ||
19 | |||
15 | #define NFS_MAX_UDP_TIMEOUT (60*HZ) | 20 | #define NFS_MAX_UDP_TIMEOUT (60*HZ) |
16 | #define NFS_MAX_TCP_TIMEOUT (600*HZ) | 21 | #define NFS_MAX_TCP_TIMEOUT (600*HZ) |
17 | 22 | ||
23 | #define NFS_DEF_ACREGMIN (3) | ||
24 | #define NFS_DEF_ACREGMAX (60) | ||
25 | #define NFS_DEF_ACDIRMIN (30) | ||
26 | #define NFS_DEF_ACDIRMAX (60) | ||
27 | |||
18 | /* | 28 | /* |
19 | * When flushing a cluster of dirty pages, there can be different | 29 | * When flushing a cluster of dirty pages, there can be different |
20 | * strategies: | 30 | * strategies: |
@@ -32,7 +42,6 @@ | |||
32 | #include <linux/in.h> | 42 | #include <linux/in.h> |
33 | #include <linux/kref.h> | 43 | #include <linux/kref.h> |
34 | #include <linux/mm.h> | 44 | #include <linux/mm.h> |
35 | #include <linux/namei.h> | ||
36 | #include <linux/pagemap.h> | 45 | #include <linux/pagemap.h> |
37 | #include <linux/rbtree.h> | 46 | #include <linux/rbtree.h> |
38 | #include <linux/rwsem.h> | 47 | #include <linux/rwsem.h> |
@@ -322,7 +331,7 @@ extern int nfs_refresh_inode(struct inode *, struct nfs_fattr *); | |||
322 | extern int nfs_post_op_update_inode(struct inode *inode, struct nfs_fattr *fattr); | 331 | extern int nfs_post_op_update_inode(struct inode *inode, struct nfs_fattr *fattr); |
323 | extern int nfs_post_op_update_inode_force_wcc(struct inode *inode, struct nfs_fattr *fattr); | 332 | extern int nfs_post_op_update_inode_force_wcc(struct inode *inode, struct nfs_fattr *fattr); |
324 | extern int nfs_getattr(struct vfsmount *, struct dentry *, struct kstat *); | 333 | extern int nfs_getattr(struct vfsmount *, struct dentry *, struct kstat *); |
325 | extern int nfs_permission(struct inode *, int, struct nameidata *); | 334 | extern int nfs_permission(struct inode *, int); |
326 | extern int nfs_open(struct inode *, struct file *); | 335 | extern int nfs_open(struct inode *, struct file *); |
327 | extern int nfs_release(struct inode *, struct file *); | 336 | extern int nfs_release(struct inode *, struct file *); |
328 | extern int nfs_attribute_timeout(struct inode *inode); | 337 | extern int nfs_attribute_timeout(struct inode *inode); |
diff --git a/include/linux/nfs_iostat.h b/include/linux/nfs_iostat.h new file mode 100644 index 000000000000..1cb9a3fed2b3 --- /dev/null +++ b/include/linux/nfs_iostat.h | |||
@@ -0,0 +1,119 @@ | |||
1 | /* | ||
2 | * User-space visible declarations for NFS client per-mount | ||
3 | * point statistics | ||
4 | * | ||
5 | * Copyright (C) 2005, 2006 Chuck Lever <cel@netapp.com> | ||
6 | * | ||
7 | * NFS client per-mount statistics provide information about the | ||
8 | * health of the NFS client and the health of each NFS mount point. | ||
9 | * Generally these are not for detailed problem diagnosis, but | ||
10 | * simply to indicate that there is a problem. | ||
11 | * | ||
12 | * These counters are not meant to be human-readable, but are meant | ||
13 | * to be integrated into system monitoring tools such as "sar" and | ||
14 | * "iostat". As such, the counters are sampled by the tools over | ||
15 | * time, and are never zeroed after a file system is mounted. | ||
16 | * Moving averages can be computed by the tools by taking the | ||
17 | * difference between two instantaneous samples and dividing that | ||
18 | * by the time between the samples. | ||
19 | */ | ||
20 | |||
21 | #ifndef _LINUX_NFS_IOSTAT | ||
22 | #define _LINUX_NFS_IOSTAT | ||
23 | |||
24 | #define NFS_IOSTAT_VERS "1.0" | ||
25 | |||
26 | /* | ||
27 | * NFS byte counters | ||
28 | * | ||
29 | * 1. SERVER - the number of payload bytes read from or written | ||
30 | * to the server by the NFS client via an NFS READ or WRITE | ||
31 | * request. | ||
32 | * | ||
33 | * 2. NORMAL - the number of bytes read or written by applications | ||
34 | * via the read(2) and write(2) system call interfaces. | ||
35 | * | ||
36 | * 3. DIRECT - the number of bytes read or written from files | ||
37 | * opened with the O_DIRECT flag. | ||
38 | * | ||
39 | * These counters give a view of the data throughput into and out | ||
40 | * of the NFS client. Comparing the number of bytes requested by | ||
41 | * an application with the number of bytes the client requests from | ||
42 | * the server can provide an indication of client efficiency | ||
43 | * (per-op, cache hits, etc). | ||
44 | * | ||
45 | * These counters can also help characterize which access methods | ||
46 | * are in use. DIRECT by itself shows whether there is any O_DIRECT | ||
47 | * traffic. NORMAL + DIRECT shows how much data is going through | ||
48 | * the system call interface. A large amount of SERVER traffic | ||
49 | * without much NORMAL or DIRECT traffic shows that applications | ||
50 | * are using mapped files. | ||
51 | * | ||
52 | * NFS page counters | ||
53 | * | ||
54 | * These count the number of pages read or written via nfs_readpage(), | ||
55 | * nfs_readpages(), or their write equivalents. | ||
56 | * | ||
57 | * NB: When adding new byte counters, please include the measured | ||
58 | * units in the name of each byte counter to help users of this | ||
59 | * interface determine what exactly is being counted. | ||
60 | */ | ||
61 | enum nfs_stat_bytecounters { | ||
62 | NFSIOS_NORMALREADBYTES = 0, | ||
63 | NFSIOS_NORMALWRITTENBYTES, | ||
64 | NFSIOS_DIRECTREADBYTES, | ||
65 | NFSIOS_DIRECTWRITTENBYTES, | ||
66 | NFSIOS_SERVERREADBYTES, | ||
67 | NFSIOS_SERVERWRITTENBYTES, | ||
68 | NFSIOS_READPAGES, | ||
69 | NFSIOS_WRITEPAGES, | ||
70 | __NFSIOS_BYTESMAX, | ||
71 | }; | ||
72 | |||
73 | /* | ||
74 | * NFS event counters | ||
75 | * | ||
76 | * These counters provide a low-overhead way of monitoring client | ||
77 | * activity without enabling NFS trace debugging. The counters | ||
78 | * show the rate at which VFS requests are made, and how often the | ||
79 | * client invalidates its data and attribute caches. This allows | ||
80 | * system administrators to monitor such things as how close-to-open | ||
81 | * is working, and answer questions such as "why are there so many | ||
82 | * GETATTR requests on the wire?" | ||
83 | * | ||
84 | * They also count anamolous events such as short reads and writes, | ||
85 | * silly renames due to close-after-delete, and operations that | ||
86 | * change the size of a file (such operations can often be the | ||
87 | * source of data corruption if applications aren't using file | ||
88 | * locking properly). | ||
89 | */ | ||
90 | enum nfs_stat_eventcounters { | ||
91 | NFSIOS_INODEREVALIDATE = 0, | ||
92 | NFSIOS_DENTRYREVALIDATE, | ||
93 | NFSIOS_DATAINVALIDATE, | ||
94 | NFSIOS_ATTRINVALIDATE, | ||
95 | NFSIOS_VFSOPEN, | ||
96 | NFSIOS_VFSLOOKUP, | ||
97 | NFSIOS_VFSACCESS, | ||
98 | NFSIOS_VFSUPDATEPAGE, | ||
99 | NFSIOS_VFSREADPAGE, | ||
100 | NFSIOS_VFSREADPAGES, | ||
101 | NFSIOS_VFSWRITEPAGE, | ||
102 | NFSIOS_VFSWRITEPAGES, | ||
103 | NFSIOS_VFSGETDENTS, | ||
104 | NFSIOS_VFSSETATTR, | ||
105 | NFSIOS_VFSFLUSH, | ||
106 | NFSIOS_VFSFSYNC, | ||
107 | NFSIOS_VFSLOCK, | ||
108 | NFSIOS_VFSRELEASE, | ||
109 | NFSIOS_CONGESTIONWAIT, | ||
110 | NFSIOS_SETATTRTRUNC, | ||
111 | NFSIOS_EXTENDWRITE, | ||
112 | NFSIOS_SILLYRENAME, | ||
113 | NFSIOS_SHORTREAD, | ||
114 | NFSIOS_SHORTWRITE, | ||
115 | NFSIOS_DELAY, | ||
116 | __NFSIOS_COUNTSMAX, | ||
117 | }; | ||
118 | |||
119 | #endif /* _LINUX_NFS_IOSTAT */ | ||
diff --git a/include/linux/nfs_page.h b/include/linux/nfs_page.h index a1676e19e491..3c60685d972b 100644 --- a/include/linux/nfs_page.h +++ b/include/linux/nfs_page.h | |||
@@ -27,9 +27,12 @@ | |||
27 | /* | 27 | /* |
28 | * Valid flags for a dirty buffer | 28 | * Valid flags for a dirty buffer |
29 | */ | 29 | */ |
30 | #define PG_BUSY 0 | 30 | enum { |
31 | #define PG_NEED_COMMIT 1 | 31 | PG_BUSY = 0, |
32 | #define PG_NEED_RESCHED 2 | 32 | PG_CLEAN, |
33 | PG_NEED_COMMIT, | ||
34 | PG_NEED_RESCHED, | ||
35 | }; | ||
33 | 36 | ||
34 | struct nfs_inode; | 37 | struct nfs_inode; |
35 | struct nfs_page { | 38 | struct nfs_page { |
diff --git a/include/linux/nfs_xdr.h b/include/linux/nfs_xdr.h index 24263bb8e0be..8c77c11224d1 100644 --- a/include/linux/nfs_xdr.h +++ b/include/linux/nfs_xdr.h | |||
@@ -829,9 +829,8 @@ struct nfs_rpc_ops { | |||
829 | int (*write_done) (struct rpc_task *, struct nfs_write_data *); | 829 | int (*write_done) (struct rpc_task *, struct nfs_write_data *); |
830 | void (*commit_setup) (struct nfs_write_data *, struct rpc_message *); | 830 | void (*commit_setup) (struct nfs_write_data *, struct rpc_message *); |
831 | int (*commit_done) (struct rpc_task *, struct nfs_write_data *); | 831 | int (*commit_done) (struct rpc_task *, struct nfs_write_data *); |
832 | int (*file_open) (struct inode *, struct file *); | ||
833 | int (*file_release) (struct inode *, struct file *); | ||
834 | int (*lock)(struct file *, int, struct file_lock *); | 832 | int (*lock)(struct file *, int, struct file_lock *); |
833 | int (*lock_check_bounds)(const struct file_lock *); | ||
835 | void (*clear_acl_cache)(struct inode *); | 834 | void (*clear_acl_cache)(struct inode *); |
836 | }; | 835 | }; |
837 | 836 | ||
diff --git a/include/linux/nfsd/nfsd.h b/include/linux/nfsd/nfsd.h index 41d30c9c9de6..21269405ffe2 100644 --- a/include/linux/nfsd/nfsd.h +++ b/include/linux/nfsd/nfsd.h | |||
@@ -12,7 +12,6 @@ | |||
12 | 12 | ||
13 | #include <linux/types.h> | 13 | #include <linux/types.h> |
14 | #include <linux/unistd.h> | 14 | #include <linux/unistd.h> |
15 | #include <linux/dirent.h> | ||
16 | #include <linux/fs.h> | 15 | #include <linux/fs.h> |
17 | #include <linux/posix_acl.h> | 16 | #include <linux/posix_acl.h> |
18 | #include <linux/mount.h> | 17 | #include <linux/mount.h> |
@@ -28,20 +27,21 @@ | |||
28 | #define NFSD_SUPPORTED_MINOR_VERSION 0 | 27 | #define NFSD_SUPPORTED_MINOR_VERSION 0 |
29 | 28 | ||
30 | /* | 29 | /* |
31 | * Special flags for nfsd_permission. These must be different from MAY_READ, | 30 | * Flags for nfsd_permission |
32 | * MAY_WRITE, and MAY_EXEC. | ||
33 | */ | 31 | */ |
34 | #define MAY_NOP 0 | 32 | #define NFSD_MAY_NOP 0 |
35 | #define MAY_SATTR 8 | 33 | #define NFSD_MAY_EXEC 1 /* == MAY_EXEC */ |
36 | #define MAY_TRUNC 16 | 34 | #define NFSD_MAY_WRITE 2 /* == MAY_WRITE */ |
37 | #define MAY_LOCK 32 | 35 | #define NFSD_MAY_READ 4 /* == MAY_READ */ |
38 | #define MAY_OWNER_OVERRIDE 64 | 36 | #define NFSD_MAY_SATTR 8 |
39 | #define MAY_LOCAL_ACCESS 128 /* IRIX doing local access check on device special file*/ | 37 | #define NFSD_MAY_TRUNC 16 |
40 | #if (MAY_SATTR | MAY_TRUNC | MAY_LOCK | MAY_OWNER_OVERRIDE | MAY_LOCAL_ACCESS) & (MAY_READ | MAY_WRITE | MAY_EXEC) | 38 | #define NFSD_MAY_LOCK 32 |
41 | # error "please use a different value for MAY_SATTR or MAY_TRUNC or MAY_LOCK or MAY_LOCAL_ACCESS or MAY_OWNER_OVERRIDE." | 39 | #define NFSD_MAY_OWNER_OVERRIDE 64 |
42 | #endif | 40 | #define NFSD_MAY_LOCAL_ACCESS 128 /* IRIX doing local access check on device special file*/ |
43 | #define MAY_CREATE (MAY_EXEC|MAY_WRITE) | 41 | #define NFSD_MAY_BYPASS_GSS_ON_ROOT 256 |
44 | #define MAY_REMOVE (MAY_EXEC|MAY_WRITE|MAY_TRUNC) | 42 | |
43 | #define NFSD_MAY_CREATE (NFSD_MAY_EXEC|NFSD_MAY_WRITE) | ||
44 | #define NFSD_MAY_REMOVE (NFSD_MAY_EXEC|NFSD_MAY_WRITE|NFSD_MAY_TRUNC) | ||
45 | 45 | ||
46 | /* | 46 | /* |
47 | * Callback function for readdir | 47 | * Callback function for readdir |
@@ -54,6 +54,7 @@ typedef int (*nfsd_dirop_t)(struct inode *, struct dentry *, int, int); | |||
54 | extern struct svc_program nfsd_program; | 54 | extern struct svc_program nfsd_program; |
55 | extern struct svc_version nfsd_version2, nfsd_version3, | 55 | extern struct svc_version nfsd_version2, nfsd_version3, |
56 | nfsd_version4; | 56 | nfsd_version4; |
57 | extern struct mutex nfsd_mutex; | ||
57 | extern struct svc_serv *nfsd_serv; | 58 | extern struct svc_serv *nfsd_serv; |
58 | 59 | ||
59 | extern struct seq_operations nfs_exports_op; | 60 | extern struct seq_operations nfs_exports_op; |
@@ -125,7 +126,7 @@ int nfsd_truncate(struct svc_rqst *, struct svc_fh *, | |||
125 | __be32 nfsd_readdir(struct svc_rqst *, struct svc_fh *, | 126 | __be32 nfsd_readdir(struct svc_rqst *, struct svc_fh *, |
126 | loff_t *, struct readdir_cd *, filldir_t); | 127 | loff_t *, struct readdir_cd *, filldir_t); |
127 | __be32 nfsd_statfs(struct svc_rqst *, struct svc_fh *, | 128 | __be32 nfsd_statfs(struct svc_rqst *, struct svc_fh *, |
128 | struct kstatfs *); | 129 | struct kstatfs *, int access); |
129 | 130 | ||
130 | int nfsd_notify_change(struct inode *, struct iattr *); | 131 | int nfsd_notify_change(struct inode *, struct iattr *); |
131 | __be32 nfsd_permission(struct svc_rqst *, struct svc_export *, | 132 | __be32 nfsd_permission(struct svc_rqst *, struct svc_export *, |
diff --git a/include/linux/nfsd/state.h b/include/linux/nfsd/state.h index db348f749376..d0fe2e378452 100644 --- a/include/linux/nfsd/state.h +++ b/include/linux/nfsd/state.h | |||
@@ -98,8 +98,6 @@ struct nfs4_callback { | |||
98 | u32 cb_ident; | 98 | u32 cb_ident; |
99 | /* RPC client info */ | 99 | /* RPC client info */ |
100 | atomic_t cb_set; /* successful CB_NULL call */ | 100 | atomic_t cb_set; /* successful CB_NULL call */ |
101 | struct rpc_program cb_program; | ||
102 | struct rpc_stat cb_stat; | ||
103 | struct rpc_clnt * cb_client; | 101 | struct rpc_clnt * cb_client; |
104 | }; | 102 | }; |
105 | 103 | ||
diff --git a/include/linux/nl80211.h b/include/linux/nl80211.h index ea6517e58b04..9bad65400fba 100644 --- a/include/linux/nl80211.h +++ b/include/linux/nl80211.h | |||
@@ -89,6 +89,22 @@ | |||
89 | * @NL80211_CMD_DEL_PATH: Remove a mesh path identified by %NL80211_ATTR_MAC | 89 | * @NL80211_CMD_DEL_PATH: Remove a mesh path identified by %NL80211_ATTR_MAC |
90 | * or, if no MAC address given, all mesh paths, on the interface identified | 90 | * or, if no MAC address given, all mesh paths, on the interface identified |
91 | * by %NL80211_ATTR_IFINDEX. | 91 | * by %NL80211_ATTR_IFINDEX. |
92 | * @NL80211_CMD_SET_BSS: Set BSS attributes for BSS identified by | ||
93 | * %NL80211_ATTR_IFINDEX. | ||
94 | * | ||
95 | * @NL80211_CMD_SET_REG: Set current regulatory domain. CRDA sends this command | ||
96 | * after being queried by the kernel. CRDA replies by sending a regulatory | ||
97 | * domain structure which consists of %NL80211_ATTR_REG_ALPHA set to our | ||
98 | * current alpha2 if it found a match. It also provides | ||
99 | * NL80211_ATTR_REG_RULE_FLAGS, and a set of regulatory rules. Each | ||
100 | * regulatory rule is a nested set of attributes given by | ||
101 | * %NL80211_ATTR_REG_RULE_FREQ_[START|END] and | ||
102 | * %NL80211_ATTR_FREQ_RANGE_MAX_BW with an attached power rule given by | ||
103 | * %NL80211_ATTR_REG_RULE_POWER_MAX_ANT_GAIN and | ||
104 | * %NL80211_ATTR_REG_RULE_POWER_MAX_EIRP. | ||
105 | * @NL80211_CMD_REQ_SET_REG: ask the wireless core to set the regulatory domain | ||
106 | * to the the specified ISO/IEC 3166-1 alpha2 country code. The core will | ||
107 | * store this as a valid request and then query userspace for it. | ||
92 | * | 108 | * |
93 | * @NL80211_CMD_MAX: highest used command number | 109 | * @NL80211_CMD_MAX: highest used command number |
94 | * @__NL80211_CMD_AFTER_LAST: internal use | 110 | * @__NL80211_CMD_AFTER_LAST: internal use |
@@ -122,18 +138,28 @@ enum nl80211_commands { | |||
122 | NL80211_CMD_NEW_STATION, | 138 | NL80211_CMD_NEW_STATION, |
123 | NL80211_CMD_DEL_STATION, | 139 | NL80211_CMD_DEL_STATION, |
124 | 140 | ||
125 | /* add commands here */ | ||
126 | |||
127 | NL80211_CMD_GET_MPATH, | 141 | NL80211_CMD_GET_MPATH, |
128 | NL80211_CMD_SET_MPATH, | 142 | NL80211_CMD_SET_MPATH, |
129 | NL80211_CMD_NEW_MPATH, | 143 | NL80211_CMD_NEW_MPATH, |
130 | NL80211_CMD_DEL_MPATH, | 144 | NL80211_CMD_DEL_MPATH, |
131 | 145 | ||
146 | NL80211_CMD_SET_BSS, | ||
147 | |||
148 | NL80211_CMD_SET_REG, | ||
149 | NL80211_CMD_REQ_SET_REG, | ||
150 | |||
151 | /* add new commands above here */ | ||
152 | |||
132 | /* used to define NL80211_CMD_MAX below */ | 153 | /* used to define NL80211_CMD_MAX below */ |
133 | __NL80211_CMD_AFTER_LAST, | 154 | __NL80211_CMD_AFTER_LAST, |
134 | NL80211_CMD_MAX = __NL80211_CMD_AFTER_LAST - 1 | 155 | NL80211_CMD_MAX = __NL80211_CMD_AFTER_LAST - 1 |
135 | }; | 156 | }; |
136 | 157 | ||
158 | /* | ||
159 | * Allow user space programs to use #ifdef on new commands by defining them | ||
160 | * here | ||
161 | */ | ||
162 | #define NL80211_CMD_SET_BSS NL80211_CMD_SET_BSS | ||
137 | 163 | ||
138 | /** | 164 | /** |
139 | * enum nl80211_attrs - nl80211 netlink attributes | 165 | * enum nl80211_attrs - nl80211 netlink attributes |
@@ -188,10 +214,34 @@ enum nl80211_commands { | |||
188 | * info given for %NL80211_CMD_GET_MPATH, nested attribute described at | 214 | * info given for %NL80211_CMD_GET_MPATH, nested attribute described at |
189 | * &enum nl80211_mpath_info. | 215 | * &enum nl80211_mpath_info. |
190 | * | 216 | * |
191 | * | ||
192 | * @NL80211_ATTR_MNTR_FLAGS: flags, nested element with NLA_FLAG attributes of | 217 | * @NL80211_ATTR_MNTR_FLAGS: flags, nested element with NLA_FLAG attributes of |
193 | * &enum nl80211_mntr_flags. | 218 | * &enum nl80211_mntr_flags. |
194 | * | 219 | * |
220 | * @NL80211_ATTR_REG_ALPHA2: an ISO-3166-alpha2 country code for which the | ||
221 | * current regulatory domain should be set to or is already set to. | ||
222 | * For example, 'CR', for Costa Rica. This attribute is used by the kernel | ||
223 | * to query the CRDA to retrieve one regulatory domain. This attribute can | ||
224 | * also be used by userspace to query the kernel for the currently set | ||
225 | * regulatory domain. We chose an alpha2 as that is also used by the | ||
226 | * IEEE-802.11d country information element to identify a country. | ||
227 | * Users can also simply ask the wireless core to set regulatory domain | ||
228 | * to a specific alpha2. | ||
229 | * @NL80211_ATTR_REG_RULES: a nested array of regulatory domain regulatory | ||
230 | * rules. | ||
231 | * | ||
232 | * @NL80211_ATTR_BSS_CTS_PROT: whether CTS protection is enabled (u8, 0 or 1) | ||
233 | * @NL80211_ATTR_BSS_SHORT_PREAMBLE: whether short preamble is enabled | ||
234 | * (u8, 0 or 1) | ||
235 | * @NL80211_ATTR_BSS_SHORT_SLOT_TIME: whether short slot time enabled | ||
236 | * (u8, 0 or 1) | ||
237 | * | ||
238 | * @NL80211_ATTR_HT_CAPABILITY: HT Capability information element (from | ||
239 | * association request when used with NL80211_CMD_NEW_STATION) | ||
240 | * | ||
241 | * @NL80211_ATTR_SUPPORTED_IFTYPES: nested attribute containing all | ||
242 | * supported interface types, each a flag attribute with the number | ||
243 | * of the interface mode. | ||
244 | * | ||
195 | * @NL80211_ATTR_MAX: highest attribute number currently defined | 245 | * @NL80211_ATTR_MAX: highest attribute number currently defined |
196 | * @__NL80211_ATTR_AFTER_LAST: internal use | 246 | * @__NL80211_ATTR_AFTER_LAST: internal use |
197 | */ | 247 | */ |
@@ -230,18 +280,40 @@ enum nl80211_attrs { | |||
230 | 280 | ||
231 | NL80211_ATTR_MNTR_FLAGS, | 281 | NL80211_ATTR_MNTR_FLAGS, |
232 | 282 | ||
233 | /* add attributes here, update the policy in nl80211.c */ | ||
234 | |||
235 | NL80211_ATTR_MESH_ID, | 283 | NL80211_ATTR_MESH_ID, |
236 | NL80211_ATTR_STA_PLINK_ACTION, | 284 | NL80211_ATTR_STA_PLINK_ACTION, |
237 | NL80211_ATTR_MPATH_NEXT_HOP, | 285 | NL80211_ATTR_MPATH_NEXT_HOP, |
238 | NL80211_ATTR_MPATH_INFO, | 286 | NL80211_ATTR_MPATH_INFO, |
239 | 287 | ||
288 | NL80211_ATTR_BSS_CTS_PROT, | ||
289 | NL80211_ATTR_BSS_SHORT_PREAMBLE, | ||
290 | NL80211_ATTR_BSS_SHORT_SLOT_TIME, | ||
291 | |||
292 | NL80211_ATTR_HT_CAPABILITY, | ||
293 | |||
294 | NL80211_ATTR_SUPPORTED_IFTYPES, | ||
295 | |||
296 | NL80211_ATTR_REG_ALPHA2, | ||
297 | NL80211_ATTR_REG_RULES, | ||
298 | |||
299 | /* add attributes here, update the policy in nl80211.c */ | ||
300 | |||
240 | __NL80211_ATTR_AFTER_LAST, | 301 | __NL80211_ATTR_AFTER_LAST, |
241 | NL80211_ATTR_MAX = __NL80211_ATTR_AFTER_LAST - 1 | 302 | NL80211_ATTR_MAX = __NL80211_ATTR_AFTER_LAST - 1 |
242 | }; | 303 | }; |
243 | 304 | ||
244 | #define NL80211_MAX_SUPP_RATES 32 | 305 | /* |
306 | * Allow user space programs to use #ifdef on new attributes by defining them | ||
307 | * here | ||
308 | */ | ||
309 | #define NL80211_ATTR_HT_CAPABILITY NL80211_ATTR_HT_CAPABILITY | ||
310 | |||
311 | #define NL80211_MAX_SUPP_RATES 32 | ||
312 | #define NL80211_MAX_SUPP_REG_RULES 32 | ||
313 | #define NL80211_TKIP_DATA_OFFSET_ENCR_KEY 0 | ||
314 | #define NL80211_TKIP_DATA_OFFSET_TX_MIC_KEY 16 | ||
315 | #define NL80211_TKIP_DATA_OFFSET_RX_MIC_KEY 24 | ||
316 | #define NL80211_HT_CAPABILITY_LEN 26 | ||
245 | 317 | ||
246 | /** | 318 | /** |
247 | * enum nl80211_iftype - (virtual) interface types | 319 | * enum nl80211_iftype - (virtual) interface types |
@@ -433,6 +505,66 @@ enum nl80211_bitrate_attr { | |||
433 | }; | 505 | }; |
434 | 506 | ||
435 | /** | 507 | /** |
508 | * enum nl80211_reg_rule_attr - regulatory rule attributes | ||
509 | * @NL80211_ATTR_REG_RULE_FLAGS: a set of flags which specify additional | ||
510 | * considerations for a given frequency range. These are the | ||
511 | * &enum nl80211_reg_rule_flags. | ||
512 | * @NL80211_ATTR_FREQ_RANGE_START: starting frequencry for the regulatory | ||
513 | * rule in KHz. This is not a center of frequency but an actual regulatory | ||
514 | * band edge. | ||
515 | * @NL80211_ATTR_FREQ_RANGE_END: ending frequency for the regulatory rule | ||
516 | * in KHz. This is not a center a frequency but an actual regulatory | ||
517 | * band edge. | ||
518 | * @NL80211_ATTR_FREQ_RANGE_MAX_BW: maximum allowed bandwidth for this | ||
519 | * frequency range, in KHz. | ||
520 | * @NL80211_ATTR_POWER_RULE_MAX_ANT_GAIN: the maximum allowed antenna gain | ||
521 | * for a given frequency range. The value is in mBi (100 * dBi). | ||
522 | * If you don't have one then don't send this. | ||
523 | * @NL80211_ATTR_POWER_RULE_MAX_EIRP: the maximum allowed EIRP for | ||
524 | * a given frequency range. The value is in mBm (100 * dBm). | ||
525 | */ | ||
526 | enum nl80211_reg_rule_attr { | ||
527 | __NL80211_REG_RULE_ATTR_INVALID, | ||
528 | NL80211_ATTR_REG_RULE_FLAGS, | ||
529 | |||
530 | NL80211_ATTR_FREQ_RANGE_START, | ||
531 | NL80211_ATTR_FREQ_RANGE_END, | ||
532 | NL80211_ATTR_FREQ_RANGE_MAX_BW, | ||
533 | |||
534 | NL80211_ATTR_POWER_RULE_MAX_ANT_GAIN, | ||
535 | NL80211_ATTR_POWER_RULE_MAX_EIRP, | ||
536 | |||
537 | /* keep last */ | ||
538 | __NL80211_REG_RULE_ATTR_AFTER_LAST, | ||
539 | NL80211_REG_RULE_ATTR_MAX = __NL80211_REG_RULE_ATTR_AFTER_LAST - 1 | ||
540 | }; | ||
541 | |||
542 | /** | ||
543 | * enum nl80211_reg_rule_flags - regulatory rule flags | ||
544 | * | ||
545 | * @NL80211_RRF_NO_OFDM: OFDM modulation not allowed | ||
546 | * @NL80211_RRF_NO_CCK: CCK modulation not allowed | ||
547 | * @NL80211_RRF_NO_INDOOR: indoor operation not allowed | ||
548 | * @NL80211_RRF_NO_OUTDOOR: outdoor operation not allowed | ||
549 | * @NL80211_RRF_DFS: DFS support is required to be used | ||
550 | * @NL80211_RRF_PTP_ONLY: this is only for Point To Point links | ||
551 | * @NL80211_RRF_PTMP_ONLY: this is only for Point To Multi Point links | ||
552 | * @NL80211_RRF_PASSIVE_SCAN: passive scan is required | ||
553 | * @NL80211_RRF_NO_IBSS: no IBSS is allowed | ||
554 | */ | ||
555 | enum nl80211_reg_rule_flags { | ||
556 | NL80211_RRF_NO_OFDM = 1<<0, | ||
557 | NL80211_RRF_NO_CCK = 1<<1, | ||
558 | NL80211_RRF_NO_INDOOR = 1<<2, | ||
559 | NL80211_RRF_NO_OUTDOOR = 1<<3, | ||
560 | NL80211_RRF_DFS = 1<<4, | ||
561 | NL80211_RRF_PTP_ONLY = 1<<5, | ||
562 | NL80211_RRF_PTMP_ONLY = 1<<6, | ||
563 | NL80211_RRF_PASSIVE_SCAN = 1<<7, | ||
564 | NL80211_RRF_NO_IBSS = 1<<8, | ||
565 | }; | ||
566 | |||
567 | /** | ||
436 | * enum nl80211_mntr_flags - monitor configuration flags | 568 | * enum nl80211_mntr_flags - monitor configuration flags |
437 | * | 569 | * |
438 | * Monitor configuration flags. | 570 | * Monitor configuration flags. |
diff --git a/include/linux/notifier.h b/include/linux/notifier.h index 0ff6224d172a..b86fa2ffca0c 100644 --- a/include/linux/notifier.h +++ b/include/linux/notifier.h | |||
@@ -197,6 +197,7 @@ static inline int notifier_to_errno(int ret) | |||
197 | #define NETDEV_GOING_DOWN 0x0009 | 197 | #define NETDEV_GOING_DOWN 0x0009 |
198 | #define NETDEV_CHANGENAME 0x000A | 198 | #define NETDEV_CHANGENAME 0x000A |
199 | #define NETDEV_FEAT_CHANGE 0x000B | 199 | #define NETDEV_FEAT_CHANGE 0x000B |
200 | #define NETDEV_BONDING_FAILOVER 0x000C | ||
200 | 201 | ||
201 | #define SYS_DOWN 0x0001 /* Notify of system down */ | 202 | #define SYS_DOWN 0x0001 /* Notify of system down */ |
202 | #define SYS_RESTART SYS_DOWN | 203 | #define SYS_RESTART SYS_DOWN |
@@ -212,7 +213,16 @@ static inline int notifier_to_errno(int ret) | |||
212 | #define CPU_DOWN_FAILED 0x0006 /* CPU (unsigned)v NOT going down */ | 213 | #define CPU_DOWN_FAILED 0x0006 /* CPU (unsigned)v NOT going down */ |
213 | #define CPU_DEAD 0x0007 /* CPU (unsigned)v dead */ | 214 | #define CPU_DEAD 0x0007 /* CPU (unsigned)v dead */ |
214 | #define CPU_DYING 0x0008 /* CPU (unsigned)v not running any task, | 215 | #define CPU_DYING 0x0008 /* CPU (unsigned)v not running any task, |
215 | * not handling interrupts, soon dead */ | 216 | * not handling interrupts, soon dead. |
217 | * Called on the dying cpu, interrupts | ||
218 | * are already disabled. Must not | ||
219 | * sleep, must not fail */ | ||
220 | #define CPU_POST_DEAD 0x0009 /* CPU (unsigned)v dead, cpu_hotplug | ||
221 | * lock is dropped */ | ||
222 | #define CPU_STARTING 0x000A /* CPU (unsigned)v soon running. | ||
223 | * Called on the new cpu, just before | ||
224 | * enabling interrupts. Must not sleep, | ||
225 | * must not fail */ | ||
216 | 226 | ||
217 | /* Used for CPU hotplug events occuring while tasks are frozen due to a suspend | 227 | /* Used for CPU hotplug events occuring while tasks are frozen due to a suspend |
218 | * operation in progress | 228 | * operation in progress |
@@ -226,6 +236,7 @@ static inline int notifier_to_errno(int ret) | |||
226 | #define CPU_DOWN_FAILED_FROZEN (CPU_DOWN_FAILED | CPU_TASKS_FROZEN) | 236 | #define CPU_DOWN_FAILED_FROZEN (CPU_DOWN_FAILED | CPU_TASKS_FROZEN) |
227 | #define CPU_DEAD_FROZEN (CPU_DEAD | CPU_TASKS_FROZEN) | 237 | #define CPU_DEAD_FROZEN (CPU_DEAD | CPU_TASKS_FROZEN) |
228 | #define CPU_DYING_FROZEN (CPU_DYING | CPU_TASKS_FROZEN) | 238 | #define CPU_DYING_FROZEN (CPU_DYING | CPU_TASKS_FROZEN) |
239 | #define CPU_STARTING_FROZEN (CPU_STARTING | CPU_TASKS_FROZEN) | ||
229 | 240 | ||
230 | /* Hibernation and suspend events */ | 241 | /* Hibernation and suspend events */ |
231 | #define PM_HIBERNATION_PREPARE 0x0001 /* Going to hibernate */ | 242 | #define PM_HIBERNATION_PREPARE 0x0001 /* Going to hibernate */ |
diff --git a/include/linux/nsproxy.h b/include/linux/nsproxy.h index 0e66b57631fc..c8a768e59640 100644 --- a/include/linux/nsproxy.h +++ b/include/linux/nsproxy.h | |||
@@ -82,9 +82,12 @@ static inline void get_nsproxy(struct nsproxy *ns) | |||
82 | } | 82 | } |
83 | 83 | ||
84 | #ifdef CONFIG_CGROUP_NS | 84 | #ifdef CONFIG_CGROUP_NS |
85 | int ns_cgroup_clone(struct task_struct *tsk); | 85 | int ns_cgroup_clone(struct task_struct *tsk, struct pid *pid); |
86 | #else | 86 | #else |
87 | static inline int ns_cgroup_clone(struct task_struct *tsk) { return 0; } | 87 | static inline int ns_cgroup_clone(struct task_struct *tsk, struct pid *pid) |
88 | { | ||
89 | return 0; | ||
90 | } | ||
88 | #endif | 91 | #endif |
89 | 92 | ||
90 | #endif | 93 | #endif |
diff --git a/include/linux/of.h b/include/linux/of.h index 59a61bdc98b6..79886ade070f 100644 --- a/include/linux/of.h +++ b/include/linux/of.h | |||
@@ -70,5 +70,6 @@ extern int of_n_addr_cells(struct device_node *np); | |||
70 | extern int of_n_size_cells(struct device_node *np); | 70 | extern int of_n_size_cells(struct device_node *np); |
71 | extern const struct of_device_id *of_match_node( | 71 | extern const struct of_device_id *of_match_node( |
72 | const struct of_device_id *matches, const struct device_node *node); | 72 | const struct of_device_id *matches, const struct device_node *node); |
73 | extern int of_modalias_node(struct device_node *node, char *modalias, int len); | ||
73 | 74 | ||
74 | #endif /* _LINUX_OF_H */ | 75 | #endif /* _LINUX_OF_H */ |
diff --git a/include/linux/of_device.h b/include/linux/of_device.h index afe338217d91..d3a74e00a3e1 100644 --- a/include/linux/of_device.h +++ b/include/linux/of_device.h | |||
@@ -24,4 +24,7 @@ static inline void of_device_free(struct of_device *dev) | |||
24 | of_release_dev(&dev->dev); | 24 | of_release_dev(&dev->dev); |
25 | } | 25 | } |
26 | 26 | ||
27 | extern ssize_t of_device_get_modalias(struct of_device *ofdev, | ||
28 | char *str, ssize_t len); | ||
29 | |||
27 | #endif /* _LINUX_OF_DEVICE_H */ | 30 | #endif /* _LINUX_OF_DEVICE_H */ |
diff --git a/include/linux/of_gpio.h b/include/linux/of_gpio.h index 2ee97e9877a7..67db101d0eb8 100644 --- a/include/linux/of_gpio.h +++ b/include/linux/of_gpio.h | |||
@@ -15,7 +15,7 @@ | |||
15 | #define __LINUX_OF_GPIO_H | 15 | #define __LINUX_OF_GPIO_H |
16 | 16 | ||
17 | #include <linux/errno.h> | 17 | #include <linux/errno.h> |
18 | #include <asm/gpio.h> | 18 | #include <linux/gpio.h> |
19 | 19 | ||
20 | #ifdef CONFIG_OF_GPIO | 20 | #ifdef CONFIG_OF_GPIO |
21 | 21 | ||
diff --git a/include/linux/of_spi.h b/include/linux/of_spi.h new file mode 100644 index 000000000000..5f71ee8c0868 --- /dev/null +++ b/include/linux/of_spi.h | |||
@@ -0,0 +1,18 @@ | |||
1 | /* | ||
2 | * OpenFirmware SPI support routines | ||
3 | * Copyright (C) 2008 Secret Lab Technologies Ltd. | ||
4 | * | ||
5 | * Support routines for deriving SPI device attachments from the device | ||
6 | * tree. | ||
7 | */ | ||
8 | |||
9 | #ifndef __LINUX_OF_SPI_H | ||
10 | #define __LINUX_OF_SPI_H | ||
11 | |||
12 | #include <linux/of.h> | ||
13 | #include <linux/spi/spi.h> | ||
14 | |||
15 | extern void of_register_spi_devices(struct spi_master *master, | ||
16 | struct device_node *np); | ||
17 | |||
18 | #endif /* __LINUX_OF_SPI */ | ||
diff --git a/include/linux/oprofile.h b/include/linux/oprofile.h index 041bb31100f4..bcb8f725427c 100644 --- a/include/linux/oprofile.h +++ b/include/linux/oprofile.h | |||
@@ -36,6 +36,8 @@ | |||
36 | #define XEN_ENTER_SWITCH_CODE 10 | 36 | #define XEN_ENTER_SWITCH_CODE 10 |
37 | #define SPU_PROFILING_CODE 11 | 37 | #define SPU_PROFILING_CODE 11 |
38 | #define SPU_CTX_SWITCH_CODE 12 | 38 | #define SPU_CTX_SWITCH_CODE 12 |
39 | #define IBS_FETCH_CODE 13 | ||
40 | #define IBS_OP_CODE 14 | ||
39 | 41 | ||
40 | struct super_block; | 42 | struct super_block; |
41 | struct dentry; | 43 | struct dentry; |
diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h index f31debfac926..c74d3e875314 100644 --- a/include/linux/page-flags.h +++ b/include/linux/page-flags.h | |||
@@ -96,7 +96,22 @@ enum pageflags { | |||
96 | #ifdef CONFIG_IA64_UNCACHED_ALLOCATOR | 96 | #ifdef CONFIG_IA64_UNCACHED_ALLOCATOR |
97 | PG_uncached, /* Page has been mapped as uncached */ | 97 | PG_uncached, /* Page has been mapped as uncached */ |
98 | #endif | 98 | #endif |
99 | __NR_PAGEFLAGS | 99 | __NR_PAGEFLAGS, |
100 | |||
101 | /* Filesystems */ | ||
102 | PG_checked = PG_owner_priv_1, | ||
103 | |||
104 | /* XEN */ | ||
105 | PG_pinned = PG_owner_priv_1, | ||
106 | PG_savepinned = PG_dirty, | ||
107 | |||
108 | /* SLOB */ | ||
109 | PG_slob_page = PG_active, | ||
110 | PG_slob_free = PG_private, | ||
111 | |||
112 | /* SLUB */ | ||
113 | PG_slub_frozen = PG_active, | ||
114 | PG_slub_debug = PG_error, | ||
100 | }; | 115 | }; |
101 | 116 | ||
102 | #ifndef __GENERATING_BOUNDS_H | 117 | #ifndef __GENERATING_BOUNDS_H |
@@ -148,19 +163,26 @@ static inline int Page##uname(struct page *page) \ | |||
148 | 163 | ||
149 | struct page; /* forward declaration */ | 164 | struct page; /* forward declaration */ |
150 | 165 | ||
151 | PAGEFLAG(Locked, locked) TESTSCFLAG(Locked, locked) | 166 | TESTPAGEFLAG(Locked, locked) |
152 | PAGEFLAG(Error, error) | 167 | PAGEFLAG(Error, error) |
153 | PAGEFLAG(Referenced, referenced) TESTCLEARFLAG(Referenced, referenced) | 168 | PAGEFLAG(Referenced, referenced) TESTCLEARFLAG(Referenced, referenced) |
154 | PAGEFLAG(Dirty, dirty) TESTSCFLAG(Dirty, dirty) __CLEARPAGEFLAG(Dirty, dirty) | 169 | PAGEFLAG(Dirty, dirty) TESTSCFLAG(Dirty, dirty) __CLEARPAGEFLAG(Dirty, dirty) |
155 | PAGEFLAG(LRU, lru) __CLEARPAGEFLAG(LRU, lru) | 170 | PAGEFLAG(LRU, lru) __CLEARPAGEFLAG(LRU, lru) |
156 | PAGEFLAG(Active, active) __CLEARPAGEFLAG(Active, active) | 171 | PAGEFLAG(Active, active) __CLEARPAGEFLAG(Active, active) |
157 | __PAGEFLAG(Slab, slab) | 172 | __PAGEFLAG(Slab, slab) |
158 | PAGEFLAG(Checked, owner_priv_1) /* Used by some filesystems */ | 173 | PAGEFLAG(Checked, checked) /* Used by some filesystems */ |
159 | PAGEFLAG(Pinned, owner_priv_1) TESTSCFLAG(Pinned, owner_priv_1) /* Xen */ | 174 | PAGEFLAG(Pinned, pinned) TESTSCFLAG(Pinned, pinned) /* Xen */ |
175 | PAGEFLAG(SavePinned, savepinned); /* Xen */ | ||
160 | PAGEFLAG(Reserved, reserved) __CLEARPAGEFLAG(Reserved, reserved) | 176 | PAGEFLAG(Reserved, reserved) __CLEARPAGEFLAG(Reserved, reserved) |
161 | PAGEFLAG(Private, private) __CLEARPAGEFLAG(Private, private) | 177 | PAGEFLAG(Private, private) __CLEARPAGEFLAG(Private, private) |
162 | __SETPAGEFLAG(Private, private) | 178 | __SETPAGEFLAG(Private, private) |
163 | 179 | ||
180 | __PAGEFLAG(SlobPage, slob_page) | ||
181 | __PAGEFLAG(SlobFree, slob_free) | ||
182 | |||
183 | __PAGEFLAG(SlubFrozen, slub_frozen) | ||
184 | __PAGEFLAG(SlubDebug, slub_debug) | ||
185 | |||
164 | /* | 186 | /* |
165 | * Only test-and-set exist for PG_writeback. The unconditional operators are | 187 | * Only test-and-set exist for PG_writeback. The unconditional operators are |
166 | * risky: they bypass page accounting. | 188 | * risky: they bypass page accounting. |
@@ -217,9 +239,6 @@ static inline void __SetPageUptodate(struct page *page) | |||
217 | { | 239 | { |
218 | smp_wmb(); | 240 | smp_wmb(); |
219 | __set_bit(PG_uptodate, &(page)->flags); | 241 | __set_bit(PG_uptodate, &(page)->flags); |
220 | #ifdef CONFIG_S390 | ||
221 | page_clear_dirty(page); | ||
222 | #endif | ||
223 | } | 242 | } |
224 | 243 | ||
225 | static inline void SetPageUptodate(struct page *page) | 244 | static inline void SetPageUptodate(struct page *page) |
diff --git a/include/linux/pageblock-flags.h b/include/linux/pageblock-flags.h index e875905f7b12..e8c06122be36 100644 --- a/include/linux/pageblock-flags.h +++ b/include/linux/pageblock-flags.h | |||
@@ -25,13 +25,11 @@ | |||
25 | 25 | ||
26 | #include <linux/types.h> | 26 | #include <linux/types.h> |
27 | 27 | ||
28 | /* Macro to aid the definition of ranges of bits */ | ||
29 | #define PB_range(name, required_bits) \ | ||
30 | name, name ## _end = (name + required_bits) - 1 | ||
31 | |||
32 | /* Bit indices that affect a whole block of pages */ | 28 | /* Bit indices that affect a whole block of pages */ |
33 | enum pageblock_bits { | 29 | enum pageblock_bits { |
34 | PB_range(PB_migrate, 3), /* 3 bits required for migrate types */ | 30 | PB_migrate, |
31 | PB_migrate_end = PB_migrate + 3 - 1, | ||
32 | /* 3 bits required for migrate types */ | ||
35 | NR_PAGEBLOCK_BITS | 33 | NR_PAGEBLOCK_BITS |
36 | }; | 34 | }; |
37 | 35 | ||
diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h index d2fca802f809..5da31c12101c 100644 --- a/include/linux/pagemap.h +++ b/include/linux/pagemap.h | |||
@@ -12,6 +12,7 @@ | |||
12 | #include <asm/uaccess.h> | 12 | #include <asm/uaccess.h> |
13 | #include <linux/gfp.h> | 13 | #include <linux/gfp.h> |
14 | #include <linux/bitops.h> | 14 | #include <linux/bitops.h> |
15 | #include <linux/hardirq.h> /* for in_interrupt() */ | ||
15 | 16 | ||
16 | /* | 17 | /* |
17 | * Bits in mapping->flags. The lower __GFP_BITS_SHIFT bits are the page | 18 | * Bits in mapping->flags. The lower __GFP_BITS_SHIFT bits are the page |
@@ -19,10 +20,11 @@ | |||
19 | */ | 20 | */ |
20 | #define AS_EIO (__GFP_BITS_SHIFT + 0) /* IO error on async write */ | 21 | #define AS_EIO (__GFP_BITS_SHIFT + 0) /* IO error on async write */ |
21 | #define AS_ENOSPC (__GFP_BITS_SHIFT + 1) /* ENOSPC on async write */ | 22 | #define AS_ENOSPC (__GFP_BITS_SHIFT + 1) /* ENOSPC on async write */ |
23 | #define AS_MM_ALL_LOCKS (__GFP_BITS_SHIFT + 2) /* under mm_take_all_locks() */ | ||
22 | 24 | ||
23 | static inline void mapping_set_error(struct address_space *mapping, int error) | 25 | static inline void mapping_set_error(struct address_space *mapping, int error) |
24 | { | 26 | { |
25 | if (error) { | 27 | if (unlikely(error)) { |
26 | if (error == -ENOSPC) | 28 | if (error == -ENOSPC) |
27 | set_bit(AS_ENOSPC, &mapping->flags); | 29 | set_bit(AS_ENOSPC, &mapping->flags); |
28 | else | 30 | else |
@@ -62,6 +64,121 @@ static inline void mapping_set_gfp_mask(struct address_space *m, gfp_t mask) | |||
62 | #define page_cache_release(page) put_page(page) | 64 | #define page_cache_release(page) put_page(page) |
63 | void release_pages(struct page **pages, int nr, int cold); | 65 | void release_pages(struct page **pages, int nr, int cold); |
64 | 66 | ||
67 | /* | ||
68 | * speculatively take a reference to a page. | ||
69 | * If the page is free (_count == 0), then _count is untouched, and 0 | ||
70 | * is returned. Otherwise, _count is incremented by 1 and 1 is returned. | ||
71 | * | ||
72 | * This function must be called inside the same rcu_read_lock() section as has | ||
73 | * been used to lookup the page in the pagecache radix-tree (or page table): | ||
74 | * this allows allocators to use a synchronize_rcu() to stabilize _count. | ||
75 | * | ||
76 | * Unless an RCU grace period has passed, the count of all pages coming out | ||
77 | * of the allocator must be considered unstable. page_count may return higher | ||
78 | * than expected, and put_page must be able to do the right thing when the | ||
79 | * page has been finished with, no matter what it is subsequently allocated | ||
80 | * for (because put_page is what is used here to drop an invalid speculative | ||
81 | * reference). | ||
82 | * | ||
83 | * This is the interesting part of the lockless pagecache (and lockless | ||
84 | * get_user_pages) locking protocol, where the lookup-side (eg. find_get_page) | ||
85 | * has the following pattern: | ||
86 | * 1. find page in radix tree | ||
87 | * 2. conditionally increment refcount | ||
88 | * 3. check the page is still in pagecache (if no, goto 1) | ||
89 | * | ||
90 | * Remove-side that cares about stability of _count (eg. reclaim) has the | ||
91 | * following (with tree_lock held for write): | ||
92 | * A. atomically check refcount is correct and set it to 0 (atomic_cmpxchg) | ||
93 | * B. remove page from pagecache | ||
94 | * C. free the page | ||
95 | * | ||
96 | * There are 2 critical interleavings that matter: | ||
97 | * - 2 runs before A: in this case, A sees elevated refcount and bails out | ||
98 | * - A runs before 2: in this case, 2 sees zero refcount and retries; | ||
99 | * subsequently, B will complete and 1 will find no page, causing the | ||
100 | * lookup to return NULL. | ||
101 | * | ||
102 | * It is possible that between 1 and 2, the page is removed then the exact same | ||
103 | * page is inserted into the same position in pagecache. That's OK: the | ||
104 | * old find_get_page using tree_lock could equally have run before or after | ||
105 | * such a re-insertion, depending on order that locks are granted. | ||
106 | * | ||
107 | * Lookups racing against pagecache insertion isn't a big problem: either 1 | ||
108 | * will find the page or it will not. Likewise, the old find_get_page could run | ||
109 | * either before the insertion or afterwards, depending on timing. | ||
110 | */ | ||
111 | static inline int page_cache_get_speculative(struct page *page) | ||
112 | { | ||
113 | VM_BUG_ON(in_interrupt()); | ||
114 | |||
115 | #if !defined(CONFIG_SMP) && defined(CONFIG_CLASSIC_RCU) | ||
116 | # ifdef CONFIG_PREEMPT | ||
117 | VM_BUG_ON(!in_atomic()); | ||
118 | # endif | ||
119 | /* | ||
120 | * Preempt must be disabled here - we rely on rcu_read_lock doing | ||
121 | * this for us. | ||
122 | * | ||
123 | * Pagecache won't be truncated from interrupt context, so if we have | ||
124 | * found a page in the radix tree here, we have pinned its refcount by | ||
125 | * disabling preempt, and hence no need for the "speculative get" that | ||
126 | * SMP requires. | ||
127 | */ | ||
128 | VM_BUG_ON(page_count(page) == 0); | ||
129 | atomic_inc(&page->_count); | ||
130 | |||
131 | #else | ||
132 | if (unlikely(!get_page_unless_zero(page))) { | ||
133 | /* | ||
134 | * Either the page has been freed, or will be freed. | ||
135 | * In either case, retry here and the caller should | ||
136 | * do the right thing (see comments above). | ||
137 | */ | ||
138 | return 0; | ||
139 | } | ||
140 | #endif | ||
141 | VM_BUG_ON(PageTail(page)); | ||
142 | |||
143 | return 1; | ||
144 | } | ||
145 | |||
146 | /* | ||
147 | * Same as above, but add instead of inc (could just be merged) | ||
148 | */ | ||
149 | static inline int page_cache_add_speculative(struct page *page, int count) | ||
150 | { | ||
151 | VM_BUG_ON(in_interrupt()); | ||
152 | |||
153 | #if !defined(CONFIG_SMP) && defined(CONFIG_CLASSIC_RCU) | ||
154 | # ifdef CONFIG_PREEMPT | ||
155 | VM_BUG_ON(!in_atomic()); | ||
156 | # endif | ||
157 | VM_BUG_ON(page_count(page) == 0); | ||
158 | atomic_add(count, &page->_count); | ||
159 | |||
160 | #else | ||
161 | if (unlikely(!atomic_add_unless(&page->_count, count, 0))) | ||
162 | return 0; | ||
163 | #endif | ||
164 | VM_BUG_ON(PageCompound(page) && page != compound_head(page)); | ||
165 | |||
166 | return 1; | ||
167 | } | ||
168 | |||
169 | static inline int page_freeze_refs(struct page *page, int count) | ||
170 | { | ||
171 | return likely(atomic_cmpxchg(&page->_count, count, 0) == count); | ||
172 | } | ||
173 | |||
174 | static inline void page_unfreeze_refs(struct page *page, int count) | ||
175 | { | ||
176 | VM_BUG_ON(page_count(page) != 0); | ||
177 | VM_BUG_ON(count == 0); | ||
178 | |||
179 | atomic_set(&page->_count, count); | ||
180 | } | ||
181 | |||
65 | #ifdef CONFIG_NUMA | 182 | #ifdef CONFIG_NUMA |
66 | extern struct page *__page_cache_alloc(gfp_t gfp); | 183 | extern struct page *__page_cache_alloc(gfp_t gfp); |
67 | #else | 184 | #else |
@@ -133,13 +250,6 @@ static inline struct page *read_mapping_page(struct address_space *mapping, | |||
133 | return read_cache_page(mapping, index, filler, data); | 250 | return read_cache_page(mapping, index, filler, data); |
134 | } | 251 | } |
135 | 252 | ||
136 | int add_to_page_cache(struct page *page, struct address_space *mapping, | ||
137 | pgoff_t index, gfp_t gfp_mask); | ||
138 | int add_to_page_cache_lru(struct page *page, struct address_space *mapping, | ||
139 | pgoff_t index, gfp_t gfp_mask); | ||
140 | extern void remove_from_page_cache(struct page *page); | ||
141 | extern void __remove_from_page_cache(struct page *page); | ||
142 | |||
143 | /* | 253 | /* |
144 | * Return byte-offset into filesystem object for page. | 254 | * Return byte-offset into filesystem object for page. |
145 | */ | 255 | */ |
@@ -161,13 +271,28 @@ extern int __lock_page_killable(struct page *page); | |||
161 | extern void __lock_page_nosync(struct page *page); | 271 | extern void __lock_page_nosync(struct page *page); |
162 | extern void unlock_page(struct page *page); | 272 | extern void unlock_page(struct page *page); |
163 | 273 | ||
274 | static inline void set_page_locked(struct page *page) | ||
275 | { | ||
276 | set_bit(PG_locked, &page->flags); | ||
277 | } | ||
278 | |||
279 | static inline void clear_page_locked(struct page *page) | ||
280 | { | ||
281 | clear_bit(PG_locked, &page->flags); | ||
282 | } | ||
283 | |||
284 | static inline int trylock_page(struct page *page) | ||
285 | { | ||
286 | return !test_and_set_bit(PG_locked, &page->flags); | ||
287 | } | ||
288 | |||
164 | /* | 289 | /* |
165 | * lock_page may only be called if we have the page's inode pinned. | 290 | * lock_page may only be called if we have the page's inode pinned. |
166 | */ | 291 | */ |
167 | static inline void lock_page(struct page *page) | 292 | static inline void lock_page(struct page *page) |
168 | { | 293 | { |
169 | might_sleep(); | 294 | might_sleep(); |
170 | if (TestSetPageLocked(page)) | 295 | if (!trylock_page(page)) |
171 | __lock_page(page); | 296 | __lock_page(page); |
172 | } | 297 | } |
173 | 298 | ||
@@ -179,7 +304,7 @@ static inline void lock_page(struct page *page) | |||
179 | static inline int lock_page_killable(struct page *page) | 304 | static inline int lock_page_killable(struct page *page) |
180 | { | 305 | { |
181 | might_sleep(); | 306 | might_sleep(); |
182 | if (TestSetPageLocked(page)) | 307 | if (!trylock_page(page)) |
183 | return __lock_page_killable(page); | 308 | return __lock_page_killable(page); |
184 | return 0; | 309 | return 0; |
185 | } | 310 | } |
@@ -191,7 +316,7 @@ static inline int lock_page_killable(struct page *page) | |||
191 | static inline void lock_page_nosync(struct page *page) | 316 | static inline void lock_page_nosync(struct page *page) |
192 | { | 317 | { |
193 | might_sleep(); | 318 | might_sleep(); |
194 | if (TestSetPageLocked(page)) | 319 | if (!trylock_page(page)) |
195 | __lock_page_nosync(page); | 320 | __lock_page_nosync(page); |
196 | } | 321 | } |
197 | 322 | ||
@@ -276,4 +401,27 @@ static inline int fault_in_pages_readable(const char __user *uaddr, int size) | |||
276 | return ret; | 401 | return ret; |
277 | } | 402 | } |
278 | 403 | ||
404 | int add_to_page_cache_locked(struct page *page, struct address_space *mapping, | ||
405 | pgoff_t index, gfp_t gfp_mask); | ||
406 | int add_to_page_cache_lru(struct page *page, struct address_space *mapping, | ||
407 | pgoff_t index, gfp_t gfp_mask); | ||
408 | extern void remove_from_page_cache(struct page *page); | ||
409 | extern void __remove_from_page_cache(struct page *page); | ||
410 | |||
411 | /* | ||
412 | * Like add_to_page_cache_locked, but used to add newly allocated pages: | ||
413 | * the page is new, so we can just run set_page_locked() against it. | ||
414 | */ | ||
415 | static inline int add_to_page_cache(struct page *page, | ||
416 | struct address_space *mapping, pgoff_t offset, gfp_t gfp_mask) | ||
417 | { | ||
418 | int error; | ||
419 | |||
420 | set_page_locked(page); | ||
421 | error = add_to_page_cache_locked(page, mapping, offset, gfp_mask); | ||
422 | if (unlikely(error)) | ||
423 | clear_page_locked(page); | ||
424 | return error; | ||
425 | } | ||
426 | |||
279 | #endif /* _LINUX_PAGEMAP_H */ | 427 | #endif /* _LINUX_PAGEMAP_H */ |
diff --git a/include/linux/parport.h b/include/linux/parport.h index dcb9e01a69ca..6a0d7cdb5774 100644 --- a/include/linux/parport.h +++ b/include/linux/parport.h | |||
@@ -560,5 +560,8 @@ extern int parport_device_proc_unregister(struct pardevice *device); | |||
560 | 560 | ||
561 | #endif /* !CONFIG_PARPORT_NOT_PC */ | 561 | #endif /* !CONFIG_PARPORT_NOT_PC */ |
562 | 562 | ||
563 | extern unsigned long parport_default_timeslice; | ||
564 | extern int parport_default_spintime; | ||
565 | |||
563 | #endif /* __KERNEL__ */ | 566 | #endif /* __KERNEL__ */ |
564 | #endif /* _PARPORT_H_ */ | 567 | #endif /* _PARPORT_H_ */ |
diff --git a/include/linux/parser.h b/include/linux/parser.h index 7dcd05075756..ea2281e726f6 100644 --- a/include/linux/parser.h +++ b/include/linux/parser.h | |||
@@ -25,7 +25,7 @@ typedef struct { | |||
25 | char *to; | 25 | char *to; |
26 | } substring_t; | 26 | } substring_t; |
27 | 27 | ||
28 | int match_token(char *, match_table_t table, substring_t args[]); | 28 | int match_token(char *, const match_table_t table, substring_t args[]); |
29 | int match_int(substring_t *, int *result); | 29 | int match_int(substring_t *, int *result); |
30 | int match_octal(substring_t *, int *result); | 30 | int match_octal(substring_t *, int *result); |
31 | int match_hex(substring_t *, int *result); | 31 | int match_hex(substring_t *, int *result); |
diff --git a/include/linux/pci-acpi.h b/include/linux/pci-acpi.h index 3ba25065fa96..8837928fbf33 100644 --- a/include/linux/pci-acpi.h +++ b/include/linux/pci-acpi.h | |||
@@ -57,6 +57,15 @@ static inline acpi_status pcie_osc_support_set(u32 flags) | |||
57 | { | 57 | { |
58 | return __pci_osc_support_set(flags, PCI_EXPRESS_ROOT_HID_STRING); | 58 | return __pci_osc_support_set(flags, PCI_EXPRESS_ROOT_HID_STRING); |
59 | } | 59 | } |
60 | static inline acpi_handle acpi_find_root_bridge_handle(struct pci_dev *pdev) | ||
61 | { | ||
62 | /* Find root host bridge */ | ||
63 | while (pdev->bus->self) | ||
64 | pdev = pdev->bus->self; | ||
65 | |||
66 | return acpi_get_pci_rootbridge_handle(pci_domain_nr(pdev->bus), | ||
67 | pdev->bus->number); | ||
68 | } | ||
60 | #else | 69 | #else |
61 | #if !defined(AE_ERROR) | 70 | #if !defined(AE_ERROR) |
62 | typedef u32 acpi_status; | 71 | typedef u32 acpi_status; |
@@ -66,6 +75,8 @@ static inline acpi_status pci_osc_control_set(acpi_handle handle, u32 flags) | |||
66 | {return AE_ERROR;} | 75 | {return AE_ERROR;} |
67 | static inline acpi_status pci_osc_support_set(u32 flags) {return AE_ERROR;} | 76 | static inline acpi_status pci_osc_support_set(u32 flags) {return AE_ERROR;} |
68 | static inline acpi_status pcie_osc_support_set(u32 flags) {return AE_ERROR;} | 77 | static inline acpi_status pcie_osc_support_set(u32 flags) {return AE_ERROR;} |
78 | static inline acpi_handle acpi_find_root_bridge_handle(struct pci_dev *pdev) | ||
79 | { return NULL; } | ||
69 | #endif | 80 | #endif |
70 | 81 | ||
71 | #endif /* _PCI_ACPI_H_ */ | 82 | #endif /* _PCI_ACPI_H_ */ |
diff --git a/include/linux/pci-aspm.h b/include/linux/pci-aspm.h index a1a1e618e996..91ba0b338b47 100644 --- a/include/linux/pci-aspm.h +++ b/include/linux/pci-aspm.h | |||
@@ -27,6 +27,7 @@ extern void pcie_aspm_init_link_state(struct pci_dev *pdev); | |||
27 | extern void pcie_aspm_exit_link_state(struct pci_dev *pdev); | 27 | extern void pcie_aspm_exit_link_state(struct pci_dev *pdev); |
28 | extern void pcie_aspm_pm_state_change(struct pci_dev *pdev); | 28 | extern void pcie_aspm_pm_state_change(struct pci_dev *pdev); |
29 | extern void pci_disable_link_state(struct pci_dev *pdev, int state); | 29 | extern void pci_disable_link_state(struct pci_dev *pdev, int state); |
30 | extern void pcie_no_aspm(void); | ||
30 | #else | 31 | #else |
31 | static inline void pcie_aspm_init_link_state(struct pci_dev *pdev) | 32 | static inline void pcie_aspm_init_link_state(struct pci_dev *pdev) |
32 | { | 33 | { |
@@ -40,6 +41,10 @@ static inline void pcie_aspm_pm_state_change(struct pci_dev *pdev) | |||
40 | static inline void pci_disable_link_state(struct pci_dev *pdev, int state) | 41 | static inline void pci_disable_link_state(struct pci_dev *pdev, int state) |
41 | { | 42 | { |
42 | } | 43 | } |
44 | |||
45 | static inline void pcie_no_aspm(void) | ||
46 | { | ||
47 | } | ||
43 | #endif | 48 | #endif |
44 | 49 | ||
45 | #ifdef CONFIG_PCIEASPM_DEBUG /* this depends on CONFIG_PCIEASPM */ | 50 | #ifdef CONFIG_PCIEASPM_DEBUG /* this depends on CONFIG_PCIEASPM */ |
diff --git a/include/linux/pci.h b/include/linux/pci.h index d18b1dd49fab..98dc6243a706 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h | |||
@@ -17,8 +17,7 @@ | |||
17 | #ifndef LINUX_PCI_H | 17 | #ifndef LINUX_PCI_H |
18 | #define LINUX_PCI_H | 18 | #define LINUX_PCI_H |
19 | 19 | ||
20 | /* Include the pci register defines */ | 20 | #include <linux/pci_regs.h> /* The pci register defines */ |
21 | #include <linux/pci_regs.h> | ||
22 | 21 | ||
23 | /* | 22 | /* |
24 | * The PCI interface treats multi-function devices as independent | 23 | * The PCI interface treats multi-function devices as independent |
@@ -49,12 +48,22 @@ | |||
49 | #include <linux/list.h> | 48 | #include <linux/list.h> |
50 | #include <linux/compiler.h> | 49 | #include <linux/compiler.h> |
51 | #include <linux/errno.h> | 50 | #include <linux/errno.h> |
51 | #include <linux/kobject.h> | ||
52 | #include <asm/atomic.h> | 52 | #include <asm/atomic.h> |
53 | #include <linux/device.h> | 53 | #include <linux/device.h> |
54 | 54 | ||
55 | /* Include the ID list */ | 55 | /* Include the ID list */ |
56 | #include <linux/pci_ids.h> | 56 | #include <linux/pci_ids.h> |
57 | 57 | ||
58 | /* pci_slot represents a physical slot */ | ||
59 | struct pci_slot { | ||
60 | struct pci_bus *bus; /* The bus this slot is on */ | ||
61 | struct list_head list; /* node in list of slots on this bus */ | ||
62 | struct hotplug_slot *hotplug; /* Hotplug info (migrate over time) */ | ||
63 | unsigned char number; /* PCI_SLOT(pci_dev->devfn) */ | ||
64 | struct kobject kobj; | ||
65 | }; | ||
66 | |||
58 | /* File state for mmap()s on /proc/bus/pci/X/Y */ | 67 | /* File state for mmap()s on /proc/bus/pci/X/Y */ |
59 | enum pci_mmap_state { | 68 | enum pci_mmap_state { |
60 | pci_mmap_io, | 69 | pci_mmap_io, |
@@ -115,6 +124,8 @@ enum pci_dev_flags { | |||
115 | * generation too. | 124 | * generation too. |
116 | */ | 125 | */ |
117 | PCI_DEV_FLAGS_MSI_INTX_DISABLE_BUG = (__force pci_dev_flags_t) 1, | 126 | PCI_DEV_FLAGS_MSI_INTX_DISABLE_BUG = (__force pci_dev_flags_t) 1, |
127 | /* Device configuration is irrevocably lost if disabled into D3 */ | ||
128 | PCI_DEV_FLAGS_NO_D3 = (__force pci_dev_flags_t) 2, | ||
118 | }; | 129 | }; |
119 | 130 | ||
120 | typedef unsigned short __bitwise pci_bus_flags_t; | 131 | typedef unsigned short __bitwise pci_bus_flags_t; |
@@ -142,6 +153,7 @@ struct pci_dev { | |||
142 | 153 | ||
143 | void *sysdata; /* hook for sys-specific extension */ | 154 | void *sysdata; /* hook for sys-specific extension */ |
144 | struct proc_dir_entry *procent; /* device entry in /proc/bus/pci */ | 155 | struct proc_dir_entry *procent; /* device entry in /proc/bus/pci */ |
156 | struct pci_slot *slot; /* Physical slot this device is in */ | ||
145 | 157 | ||
146 | unsigned int devfn; /* encoded device & function index */ | 158 | unsigned int devfn; /* encoded device & function index */ |
147 | unsigned short vendor; | 159 | unsigned short vendor; |
@@ -167,6 +179,13 @@ struct pci_dev { | |||
167 | pci_power_t current_state; /* Current operating state. In ACPI-speak, | 179 | pci_power_t current_state; /* Current operating state. In ACPI-speak, |
168 | this is D0-D3, D0 being fully functional, | 180 | this is D0-D3, D0 being fully functional, |
169 | and D3 being off. */ | 181 | and D3 being off. */ |
182 | int pm_cap; /* PM capability offset in the | ||
183 | configuration space */ | ||
184 | unsigned int pme_support:5; /* Bitmask of states from which PME# | ||
185 | can be generated */ | ||
186 | unsigned int d1_support:1; /* Low power state D1 is supported */ | ||
187 | unsigned int d2_support:1; /* Low power state D2 is supported */ | ||
188 | unsigned int no_d1d2:1; /* Only allow D0 and D3 */ | ||
170 | 189 | ||
171 | #ifdef CONFIG_PCIEASPM | 190 | #ifdef CONFIG_PCIEASPM |
172 | struct pcie_link_state *link_state; /* ASPM link state. */ | 191 | struct pcie_link_state *link_state; /* ASPM link state. */ |
@@ -191,7 +210,6 @@ struct pci_dev { | |||
191 | unsigned int is_added:1; | 210 | unsigned int is_added:1; |
192 | unsigned int is_busmaster:1; /* device is busmaster */ | 211 | unsigned int is_busmaster:1; /* device is busmaster */ |
193 | unsigned int no_msi:1; /* device may not use msi */ | 212 | unsigned int no_msi:1; /* device may not use msi */ |
194 | unsigned int no_d1d2:1; /* only allow d0 or d3 */ | ||
195 | unsigned int block_ucfg_access:1; /* userspace config space access is blocked */ | 213 | unsigned int block_ucfg_access:1; /* userspace config space access is blocked */ |
196 | unsigned int broken_parity_status:1; /* Device generates false positive parity */ | 214 | unsigned int broken_parity_status:1; /* Device generates false positive parity */ |
197 | unsigned int msi_enabled:1; | 215 | unsigned int msi_enabled:1; |
@@ -267,6 +285,7 @@ struct pci_bus { | |||
267 | struct list_head children; /* list of child buses */ | 285 | struct list_head children; /* list of child buses */ |
268 | struct list_head devices; /* list of devices on this bus */ | 286 | struct list_head devices; /* list of devices on this bus */ |
269 | struct pci_dev *self; /* bridge device as seen by parent */ | 287 | struct pci_dev *self; /* bridge device as seen by parent */ |
288 | struct list_head slots; /* list of slots on this bus */ | ||
270 | struct resource *resource[PCI_BUS_NUM_RESOURCES]; | 289 | struct resource *resource[PCI_BUS_NUM_RESOURCES]; |
271 | /* address space routed to this bus */ | 290 | /* address space routed to this bus */ |
272 | 291 | ||
@@ -328,7 +347,7 @@ struct pci_bus_region { | |||
328 | struct pci_dynids { | 347 | struct pci_dynids { |
329 | spinlock_t lock; /* protects list, index */ | 348 | spinlock_t lock; /* protects list, index */ |
330 | struct list_head list; /* for IDs added at runtime */ | 349 | struct list_head list; /* for IDs added at runtime */ |
331 | unsigned int use_driver_data:1; /* pci_driver->driver_data is used */ | 350 | unsigned int use_driver_data:1; /* pci_device_id->driver_data is used */ |
332 | }; | 351 | }; |
333 | 352 | ||
334 | /* ---------------------------------------------------------------- */ | 353 | /* ---------------------------------------------------------------- */ |
@@ -390,7 +409,7 @@ struct pci_driver { | |||
390 | int (*resume_early) (struct pci_dev *dev); | 409 | int (*resume_early) (struct pci_dev *dev); |
391 | int (*resume) (struct pci_dev *dev); /* Device woken up */ | 410 | int (*resume) (struct pci_dev *dev); /* Device woken up */ |
392 | void (*shutdown) (struct pci_dev *dev); | 411 | void (*shutdown) (struct pci_dev *dev); |
393 | 412 | struct pm_ext_ops *pm; | |
394 | struct pci_error_handlers *err_handler; | 413 | struct pci_error_handlers *err_handler; |
395 | struct device_driver driver; | 414 | struct device_driver driver; |
396 | struct pci_dynids dynids; | 415 | struct pci_dynids dynids; |
@@ -489,6 +508,10 @@ struct pci_bus *pci_create_bus(struct device *parent, int bus, | |||
489 | struct pci_ops *ops, void *sysdata); | 508 | struct pci_ops *ops, void *sysdata); |
490 | struct pci_bus *pci_add_new_bus(struct pci_bus *parent, struct pci_dev *dev, | 509 | struct pci_bus *pci_add_new_bus(struct pci_bus *parent, struct pci_dev *dev, |
491 | int busnr); | 510 | int busnr); |
511 | struct pci_slot *pci_create_slot(struct pci_bus *parent, int slot_nr, | ||
512 | const char *name); | ||
513 | void pci_destroy_slot(struct pci_slot *slot); | ||
514 | void pci_update_slot_number(struct pci_slot *slot, int slot_nr); | ||
492 | int pci_scan_slot(struct pci_bus *bus, int devfn); | 515 | int pci_scan_slot(struct pci_bus *bus, int devfn); |
493 | struct pci_dev *pci_scan_single_device(struct pci_bus *bus, int devfn); | 516 | struct pci_dev *pci_scan_single_device(struct pci_bus *bus, int devfn); |
494 | void pci_device_add(struct pci_dev *dev, struct pci_bus *bus); | 517 | void pci_device_add(struct pci_dev *dev, struct pci_bus *bus); |
@@ -511,7 +534,7 @@ extern void pci_sort_breadthfirst(void); | |||
511 | #ifdef CONFIG_PCI_LEGACY | 534 | #ifdef CONFIG_PCI_LEGACY |
512 | struct pci_dev __deprecated *pci_find_device(unsigned int vendor, | 535 | struct pci_dev __deprecated *pci_find_device(unsigned int vendor, |
513 | unsigned int device, | 536 | unsigned int device, |
514 | const struct pci_dev *from); | 537 | struct pci_dev *from); |
515 | struct pci_dev __deprecated *pci_find_slot(unsigned int bus, | 538 | struct pci_dev __deprecated *pci_find_slot(unsigned int bus, |
516 | unsigned int devfn); | 539 | unsigned int devfn); |
517 | #endif /* CONFIG_PCI_LEGACY */ | 540 | #endif /* CONFIG_PCI_LEGACY */ |
@@ -527,7 +550,7 @@ struct pci_dev *pci_get_device(unsigned int vendor, unsigned int device, | |||
527 | struct pci_dev *from); | 550 | struct pci_dev *from); |
528 | struct pci_dev *pci_get_subsys(unsigned int vendor, unsigned int device, | 551 | struct pci_dev *pci_get_subsys(unsigned int vendor, unsigned int device, |
529 | unsigned int ss_vendor, unsigned int ss_device, | 552 | unsigned int ss_vendor, unsigned int ss_device, |
530 | const struct pci_dev *from); | 553 | struct pci_dev *from); |
531 | struct pci_dev *pci_get_slot(struct pci_bus *bus, unsigned int devfn); | 554 | struct pci_dev *pci_get_slot(struct pci_bus *bus, unsigned int devfn); |
532 | struct pci_dev *pci_get_bus_and_slot(unsigned int bus, unsigned int devfn); | 555 | struct pci_dev *pci_get_bus_and_slot(unsigned int bus, unsigned int devfn); |
533 | struct pci_dev *pci_get_class(unsigned int class, struct pci_dev *from); | 556 | struct pci_dev *pci_get_class(unsigned int class, struct pci_dev *from); |
@@ -617,7 +640,12 @@ int pci_save_state(struct pci_dev *dev); | |||
617 | int pci_restore_state(struct pci_dev *dev); | 640 | int pci_restore_state(struct pci_dev *dev); |
618 | int pci_set_power_state(struct pci_dev *dev, pci_power_t state); | 641 | int pci_set_power_state(struct pci_dev *dev, pci_power_t state); |
619 | pci_power_t pci_choose_state(struct pci_dev *dev, pm_message_t state); | 642 | pci_power_t pci_choose_state(struct pci_dev *dev, pm_message_t state); |
643 | bool pci_pme_capable(struct pci_dev *dev, pci_power_t state); | ||
644 | void pci_pme_active(struct pci_dev *dev, bool enable); | ||
620 | int pci_enable_wake(struct pci_dev *dev, pci_power_t state, int enable); | 645 | int pci_enable_wake(struct pci_dev *dev, pci_power_t state, int enable); |
646 | pci_power_t pci_target_state(struct pci_dev *dev); | ||
647 | int pci_prepare_to_sleep(struct pci_dev *dev); | ||
648 | int pci_back_from_sleep(struct pci_dev *dev); | ||
621 | 649 | ||
622 | /* Functions for PCI Hotplug drivers to use */ | 650 | /* Functions for PCI Hotplug drivers to use */ |
623 | int pci_bus_find_capability(struct pci_bus *bus, unsigned int devfn, int cap); | 651 | int pci_bus_find_capability(struct pci_bus *bus, unsigned int devfn, int cap); |
@@ -653,10 +681,12 @@ void pci_enable_bridges(struct pci_bus *bus); | |||
653 | /* Proper probing supporting hot-pluggable devices */ | 681 | /* Proper probing supporting hot-pluggable devices */ |
654 | int __must_check __pci_register_driver(struct pci_driver *, struct module *, | 682 | int __must_check __pci_register_driver(struct pci_driver *, struct module *, |
655 | const char *mod_name); | 683 | const char *mod_name); |
656 | static inline int __must_check pci_register_driver(struct pci_driver *driver) | 684 | |
657 | { | 685 | /* |
658 | return __pci_register_driver(driver, THIS_MODULE, KBUILD_MODNAME); | 686 | * pci_register_driver must be a macro so that KBUILD_MODNAME can be expanded |
659 | } | 687 | */ |
688 | #define pci_register_driver(driver) \ | ||
689 | __pci_register_driver(driver, THIS_MODULE, KBUILD_MODNAME) | ||
660 | 690 | ||
661 | void pci_unregister_driver(struct pci_driver *dev); | 691 | void pci_unregister_driver(struct pci_driver *dev); |
662 | void pci_remove_behind_bridge(struct pci_dev *dev); | 692 | void pci_remove_behind_bridge(struct pci_dev *dev); |
@@ -786,7 +816,7 @@ _PCI_NOP_ALL(write,) | |||
786 | 816 | ||
787 | static inline struct pci_dev *pci_find_device(unsigned int vendor, | 817 | static inline struct pci_dev *pci_find_device(unsigned int vendor, |
788 | unsigned int device, | 818 | unsigned int device, |
789 | const struct pci_dev *from) | 819 | struct pci_dev *from) |
790 | { | 820 | { |
791 | return NULL; | 821 | return NULL; |
792 | } | 822 | } |
@@ -808,7 +838,7 @@ static inline struct pci_dev *pci_get_subsys(unsigned int vendor, | |||
808 | unsigned int device, | 838 | unsigned int device, |
809 | unsigned int ss_vendor, | 839 | unsigned int ss_vendor, |
810 | unsigned int ss_device, | 840 | unsigned int ss_device, |
811 | const struct pci_dev *from) | 841 | struct pci_dev *from) |
812 | { | 842 | { |
813 | return NULL; | 843 | return NULL; |
814 | } | 844 | } |
@@ -839,6 +869,11 @@ static inline int pci_set_dma_mask(struct pci_dev *dev, u64 mask) | |||
839 | return -EIO; | 869 | return -EIO; |
840 | } | 870 | } |
841 | 871 | ||
872 | static inline int pci_set_consistent_dma_mask(struct pci_dev *dev, u64 mask) | ||
873 | { | ||
874 | return -EIO; | ||
875 | } | ||
876 | |||
842 | static inline int pci_set_dma_max_seg_size(struct pci_dev *dev, | 877 | static inline int pci_set_dma_max_seg_size(struct pci_dev *dev, |
843 | unsigned int size) | 878 | unsigned int size) |
844 | { | 879 | { |
@@ -977,9 +1012,9 @@ static inline void pci_set_drvdata(struct pci_dev *pdev, void *data) | |||
977 | /* If you want to know what to call your pci_dev, ask this function. | 1012 | /* If you want to know what to call your pci_dev, ask this function. |
978 | * Again, it's a wrapper around the generic device. | 1013 | * Again, it's a wrapper around the generic device. |
979 | */ | 1014 | */ |
980 | static inline char *pci_name(struct pci_dev *pdev) | 1015 | static inline const char *pci_name(struct pci_dev *pdev) |
981 | { | 1016 | { |
982 | return pdev->dev.bus_id; | 1017 | return dev_name(&pdev->dev); |
983 | } | 1018 | } |
984 | 1019 | ||
985 | 1020 | ||
@@ -1014,7 +1049,9 @@ enum pci_fixup_pass { | |||
1014 | pci_fixup_header, /* After reading configuration header */ | 1049 | pci_fixup_header, /* After reading configuration header */ |
1015 | pci_fixup_final, /* Final phase of device fixups */ | 1050 | pci_fixup_final, /* Final phase of device fixups */ |
1016 | pci_fixup_enable, /* pci_enable_device() time */ | 1051 | pci_fixup_enable, /* pci_enable_device() time */ |
1017 | pci_fixup_resume, /* pci_enable_device() time */ | 1052 | pci_fixup_resume, /* pci_device_resume() */ |
1053 | pci_fixup_suspend, /* pci_device_suspend */ | ||
1054 | pci_fixup_resume_early, /* pci_device_resume_early() */ | ||
1018 | }; | 1055 | }; |
1019 | 1056 | ||
1020 | /* Anonymous variables would be nice... */ | 1057 | /* Anonymous variables would be nice... */ |
@@ -1036,6 +1073,12 @@ enum pci_fixup_pass { | |||
1036 | #define DECLARE_PCI_FIXUP_RESUME(vendor, device, hook) \ | 1073 | #define DECLARE_PCI_FIXUP_RESUME(vendor, device, hook) \ |
1037 | DECLARE_PCI_FIXUP_SECTION(.pci_fixup_resume, \ | 1074 | DECLARE_PCI_FIXUP_SECTION(.pci_fixup_resume, \ |
1038 | resume##vendor##device##hook, vendor, device, hook) | 1075 | resume##vendor##device##hook, vendor, device, hook) |
1076 | #define DECLARE_PCI_FIXUP_RESUME_EARLY(vendor, device, hook) \ | ||
1077 | DECLARE_PCI_FIXUP_SECTION(.pci_fixup_resume_early, \ | ||
1078 | resume_early##vendor##device##hook, vendor, device, hook) | ||
1079 | #define DECLARE_PCI_FIXUP_SUSPEND(vendor, device, hook) \ | ||
1080 | DECLARE_PCI_FIXUP_SECTION(.pci_fixup_suspend, \ | ||
1081 | suspend##vendor##device##hook, vendor, device, hook) | ||
1039 | 1082 | ||
1040 | 1083 | ||
1041 | void pci_fixup_device(enum pci_fixup_pass pass, struct pci_dev *dev); | 1084 | void pci_fixup_device(enum pci_fixup_pass pass, struct pci_dev *dev); |
@@ -1060,7 +1103,10 @@ extern int pci_pci_problems; | |||
1060 | extern unsigned long pci_cardbus_io_size; | 1103 | extern unsigned long pci_cardbus_io_size; |
1061 | extern unsigned long pci_cardbus_mem_size; | 1104 | extern unsigned long pci_cardbus_mem_size; |
1062 | 1105 | ||
1063 | extern int pcibios_add_platform_entries(struct pci_dev *dev); | 1106 | int pcibios_add_platform_entries(struct pci_dev *dev); |
1107 | void pcibios_disable_device(struct pci_dev *dev); | ||
1108 | int pcibios_set_pcie_reset_state(struct pci_dev *dev, | ||
1109 | enum pcie_reset_state state); | ||
1064 | 1110 | ||
1065 | #ifdef CONFIG_PCI_MMCONFIG | 1111 | #ifdef CONFIG_PCI_MMCONFIG |
1066 | extern void __init pci_mmcfg_early_init(void); | 1112 | extern void __init pci_mmcfg_early_init(void); |
diff --git a/include/linux/pci_hotplug.h b/include/linux/pci_hotplug.h index 8f67e8f2a3cc..a08cd06b541a 100644 --- a/include/linux/pci_hotplug.h +++ b/include/linux/pci_hotplug.h | |||
@@ -95,9 +95,6 @@ struct hotplug_slot_attribute { | |||
95 | * @get_adapter_status: Called to get see if an adapter is present in the slot or not. | 95 | * @get_adapter_status: Called to get see if an adapter is present in the slot or not. |
96 | * If this field is NULL, the value passed in the struct hotplug_slot_info | 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. | 97 | * will be used when this value is requested by a user. |
98 | * @get_address: Called to get pci address of a slot. | ||
99 | * If this field is NULL, the value passed in the struct hotplug_slot_info | ||
100 | * will be used when this value is requested by a user. | ||
101 | * @get_max_bus_speed: Called to get the max bus speed for a slot. | 98 | * @get_max_bus_speed: Called to get the max bus speed for a slot. |
102 | * If this field is NULL, the value passed in the struct hotplug_slot_info | 99 | * If this field is NULL, the value passed in the struct hotplug_slot_info |
103 | * will be used when this value is requested by a user. | 100 | * will be used when this value is requested by a user. |
@@ -120,7 +117,6 @@ struct hotplug_slot_ops { | |||
120 | int (*get_attention_status) (struct hotplug_slot *slot, u8 *value); | 117 | int (*get_attention_status) (struct hotplug_slot *slot, u8 *value); |
121 | int (*get_latch_status) (struct hotplug_slot *slot, u8 *value); | 118 | int (*get_latch_status) (struct hotplug_slot *slot, u8 *value); |
122 | int (*get_adapter_status) (struct hotplug_slot *slot, u8 *value); | 119 | int (*get_adapter_status) (struct hotplug_slot *slot, u8 *value); |
123 | int (*get_address) (struct hotplug_slot *slot, u32 *value); | ||
124 | int (*get_max_bus_speed) (struct hotplug_slot *slot, enum pci_bus_speed *value); | 120 | int (*get_max_bus_speed) (struct hotplug_slot *slot, enum pci_bus_speed *value); |
125 | int (*get_cur_bus_speed) (struct hotplug_slot *slot, enum pci_bus_speed *value); | 121 | int (*get_cur_bus_speed) (struct hotplug_slot *slot, enum pci_bus_speed *value); |
126 | }; | 122 | }; |
@@ -140,7 +136,6 @@ struct hotplug_slot_info { | |||
140 | u8 attention_status; | 136 | u8 attention_status; |
141 | u8 latch_status; | 137 | u8 latch_status; |
142 | u8 adapter_status; | 138 | u8 adapter_status; |
143 | u32 address; | ||
144 | enum pci_bus_speed max_bus_speed; | 139 | enum pci_bus_speed max_bus_speed; |
145 | enum pci_bus_speed cur_bus_speed; | 140 | enum pci_bus_speed cur_bus_speed; |
146 | }; | 141 | }; |
@@ -166,15 +161,14 @@ struct hotplug_slot { | |||
166 | 161 | ||
167 | /* Variables below this are for use only by the hotplug pci core. */ | 162 | /* Variables below this are for use only by the hotplug pci core. */ |
168 | struct list_head slot_list; | 163 | struct list_head slot_list; |
169 | struct kobject kobj; | 164 | struct pci_slot *pci_slot; |
170 | }; | 165 | }; |
171 | #define to_hotplug_slot(n) container_of(n, struct hotplug_slot, kobj) | 166 | #define to_hotplug_slot(n) container_of(n, struct hotplug_slot, kobj) |
172 | 167 | ||
173 | extern int pci_hp_register (struct hotplug_slot *slot); | 168 | extern int pci_hp_register(struct hotplug_slot *, struct pci_bus *, int nr); |
174 | extern int pci_hp_deregister (struct hotplug_slot *slot); | 169 | extern int pci_hp_deregister(struct hotplug_slot *slot); |
175 | extern int __must_check pci_hp_change_slot_info (struct hotplug_slot *slot, | 170 | extern int __must_check pci_hp_change_slot_info (struct hotplug_slot *slot, |
176 | struct hotplug_slot_info *info); | 171 | struct hotplug_slot_info *info); |
177 | extern struct kset *pci_hotplug_slots_kset; | ||
178 | 172 | ||
179 | /* PCI Setting Record (Type 0) */ | 173 | /* PCI Setting Record (Type 0) */ |
180 | struct hpp_type0 { | 174 | struct hpp_type0 { |
@@ -227,9 +221,9 @@ struct hotplug_params { | |||
227 | #include <acpi/acpi.h> | 221 | #include <acpi/acpi.h> |
228 | #include <acpi/acpi_bus.h> | 222 | #include <acpi/acpi_bus.h> |
229 | #include <acpi/actypes.h> | 223 | #include <acpi/actypes.h> |
230 | extern acpi_status acpi_run_oshp(acpi_handle handle); | ||
231 | extern acpi_status acpi_get_hp_params_from_firmware(struct pci_bus *bus, | 224 | extern acpi_status acpi_get_hp_params_from_firmware(struct pci_bus *bus, |
232 | struct hotplug_params *hpp); | 225 | struct hotplug_params *hpp); |
226 | int acpi_get_hp_hw_control_from_firmware(struct pci_dev *dev, u32 flags); | ||
233 | int acpi_root_bridge(acpi_handle handle); | 227 | int acpi_root_bridge(acpi_handle handle); |
234 | #endif | 228 | #endif |
235 | #endif | 229 | #endif |
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h index eafc9d6d2b35..1176f1f177e2 100644 --- a/include/linux/pci_ids.h +++ b/include/linux/pci_ids.h | |||
@@ -497,6 +497,16 @@ | |||
497 | #define PCI_DEVICE_ID_AMD_K8_NB_ADDRMAP 0x1101 | 497 | #define PCI_DEVICE_ID_AMD_K8_NB_ADDRMAP 0x1101 |
498 | #define PCI_DEVICE_ID_AMD_K8_NB_MEMCTL 0x1102 | 498 | #define PCI_DEVICE_ID_AMD_K8_NB_MEMCTL 0x1102 |
499 | #define PCI_DEVICE_ID_AMD_K8_NB_MISC 0x1103 | 499 | #define PCI_DEVICE_ID_AMD_K8_NB_MISC 0x1103 |
500 | #define PCI_DEVICE_ID_AMD_10H_NB_HT 0x1200 | ||
501 | #define PCI_DEVICE_ID_AMD_10H_NB_MAP 0x1201 | ||
502 | #define PCI_DEVICE_ID_AMD_10H_NB_DRAM 0x1202 | ||
503 | #define PCI_DEVICE_ID_AMD_10H_NB_MISC 0x1203 | ||
504 | #define PCI_DEVICE_ID_AMD_10H_NB_LINK 0x1204 | ||
505 | #define PCI_DEVICE_ID_AMD_11H_NB_HT 0x1300 | ||
506 | #define PCI_DEVICE_ID_AMD_11H_NB_MAP 0x1301 | ||
507 | #define PCI_DEVICE_ID_AMD_11H_NB_DRAM 0x1302 | ||
508 | #define PCI_DEVICE_ID_AMD_11H_NB_MISC 0x1303 | ||
509 | #define PCI_DEVICE_ID_AMD_11H_NB_LINK 0x1304 | ||
500 | #define PCI_DEVICE_ID_AMD_LANCE 0x2000 | 510 | #define PCI_DEVICE_ID_AMD_LANCE 0x2000 |
501 | #define PCI_DEVICE_ID_AMD_LANCE_HOME 0x2001 | 511 | #define PCI_DEVICE_ID_AMD_LANCE_HOME 0x2001 |
502 | #define PCI_DEVICE_ID_AMD_SCSI 0x2020 | 512 | #define PCI_DEVICE_ID_AMD_SCSI 0x2020 |
@@ -748,6 +758,7 @@ | |||
748 | #define PCI_VENDOR_ID_TI 0x104c | 758 | #define PCI_VENDOR_ID_TI 0x104c |
749 | #define PCI_DEVICE_ID_TI_TVP4020 0x3d07 | 759 | #define PCI_DEVICE_ID_TI_TVP4020 0x3d07 |
750 | #define PCI_DEVICE_ID_TI_4450 0x8011 | 760 | #define PCI_DEVICE_ID_TI_4450 0x8011 |
761 | #define PCI_DEVICE_ID_TI_TSB43AB22 0x8023 | ||
751 | #define PCI_DEVICE_ID_TI_XX21_XX11 0x8031 | 762 | #define PCI_DEVICE_ID_TI_XX21_XX11 0x8031 |
752 | #define PCI_DEVICE_ID_TI_XX21_XX11_FM 0x8033 | 763 | #define PCI_DEVICE_ID_TI_XX21_XX11_FM 0x8033 |
753 | #define PCI_DEVICE_ID_TI_XX21_XX11_SD 0x8034 | 764 | #define PCI_DEVICE_ID_TI_XX21_XX11_SD 0x8034 |
@@ -1410,6 +1421,8 @@ | |||
1410 | #define PCI_DEVICE_ID_EICON_MAESTRAQ_U 0xe013 | 1421 | #define PCI_DEVICE_ID_EICON_MAESTRAQ_U 0xe013 |
1411 | #define PCI_DEVICE_ID_EICON_MAESTRAP 0xe014 | 1422 | #define PCI_DEVICE_ID_EICON_MAESTRAP 0xe014 |
1412 | 1423 | ||
1424 | #define PCI_VENDOR_ID_CISCO 0x1137 | ||
1425 | |||
1413 | #define PCI_VENDOR_ID_ZIATECH 0x1138 | 1426 | #define PCI_VENDOR_ID_ZIATECH 0x1138 |
1414 | #define PCI_DEVICE_ID_ZIATECH_5550_HC 0x5550 | 1427 | #define PCI_DEVICE_ID_ZIATECH_5550_HC 0x5550 |
1415 | 1428 | ||
@@ -1520,6 +1533,9 @@ | |||
1520 | #define PCI_DEVICE_ID_MARVELL_GT64260 0x6430 | 1533 | #define PCI_DEVICE_ID_MARVELL_GT64260 0x6430 |
1521 | #define PCI_DEVICE_ID_MARVELL_MV64360 0x6460 | 1534 | #define PCI_DEVICE_ID_MARVELL_MV64360 0x6460 |
1522 | #define PCI_DEVICE_ID_MARVELL_MV64460 0x6480 | 1535 | #define PCI_DEVICE_ID_MARVELL_MV64460 0x6480 |
1536 | #define PCI_DEVICE_ID_MARVELL_88ALP01_NAND 0x4100 | ||
1537 | #define PCI_DEVICE_ID_MARVELL_88ALP01_SD 0x4101 | ||
1538 | #define PCI_DEVICE_ID_MARVELL_88ALP01_CCIC 0x4102 | ||
1523 | 1539 | ||
1524 | #define PCI_VENDOR_ID_V3 0x11b0 | 1540 | #define PCI_VENDOR_ID_V3 0x11b0 |
1525 | #define PCI_DEVICE_ID_V3_V960 0x0001 | 1541 | #define PCI_DEVICE_ID_V3_V960 0x0001 |
@@ -1831,7 +1847,13 @@ | |||
1831 | #define PCI_DEVICE_ID_MOXA_C320 0x3200 | 1847 | #define PCI_DEVICE_ID_MOXA_C320 0x3200 |
1832 | 1848 | ||
1833 | #define PCI_VENDOR_ID_CCD 0x1397 | 1849 | #define PCI_VENDOR_ID_CCD 0x1397 |
1850 | #define PCI_DEVICE_ID_CCD_HFC4S 0x08B4 | ||
1851 | #define PCI_SUBDEVICE_ID_CCD_PMX2S 0x1234 | ||
1852 | #define PCI_DEVICE_ID_CCD_HFC8S 0x16B8 | ||
1834 | #define PCI_DEVICE_ID_CCD_2BD0 0x2bd0 | 1853 | #define PCI_DEVICE_ID_CCD_2BD0 0x2bd0 |
1854 | #define PCI_DEVICE_ID_CCD_HFCE1 0x30B1 | ||
1855 | #define PCI_SUBDEVICE_ID_CCD_SPD4S 0x3136 | ||
1856 | #define PCI_SUBDEVICE_ID_CCD_SPDE1 0x3137 | ||
1835 | #define PCI_DEVICE_ID_CCD_B000 0xb000 | 1857 | #define PCI_DEVICE_ID_CCD_B000 0xb000 |
1836 | #define PCI_DEVICE_ID_CCD_B006 0xb006 | 1858 | #define PCI_DEVICE_ID_CCD_B006 0xb006 |
1837 | #define PCI_DEVICE_ID_CCD_B007 0xb007 | 1859 | #define PCI_DEVICE_ID_CCD_B007 0xb007 |
@@ -1841,8 +1863,32 @@ | |||
1841 | #define PCI_DEVICE_ID_CCD_B00B 0xb00b | 1863 | #define PCI_DEVICE_ID_CCD_B00B 0xb00b |
1842 | #define PCI_DEVICE_ID_CCD_B00C 0xb00c | 1864 | #define PCI_DEVICE_ID_CCD_B00C 0xb00c |
1843 | #define PCI_DEVICE_ID_CCD_B100 0xb100 | 1865 | #define PCI_DEVICE_ID_CCD_B100 0xb100 |
1866 | #define PCI_SUBDEVICE_ID_CCD_IOB4ST 0xB520 | ||
1867 | #define PCI_SUBDEVICE_ID_CCD_IOB8STR 0xB521 | ||
1868 | #define PCI_SUBDEVICE_ID_CCD_IOB8ST 0xB522 | ||
1869 | #define PCI_SUBDEVICE_ID_CCD_IOB1E1 0xB523 | ||
1870 | #define PCI_SUBDEVICE_ID_CCD_SWYX4S 0xB540 | ||
1871 | #define PCI_SUBDEVICE_ID_CCD_JH4S20 0xB550 | ||
1872 | #define PCI_SUBDEVICE_ID_CCD_IOB8ST_1 0xB552 | ||
1873 | #define PCI_SUBDEVICE_ID_CCD_BN4S 0xB560 | ||
1874 | #define PCI_SUBDEVICE_ID_CCD_BN8S 0xB562 | ||
1875 | #define PCI_SUBDEVICE_ID_CCD_BNE1 0xB563 | ||
1876 | #define PCI_SUBDEVICE_ID_CCD_BNE1D 0xB564 | ||
1877 | #define PCI_SUBDEVICE_ID_CCD_BNE1DP 0xB565 | ||
1878 | #define PCI_SUBDEVICE_ID_CCD_BN2S 0xB566 | ||
1879 | #define PCI_SUBDEVICE_ID_CCD_BN1SM 0xB567 | ||
1880 | #define PCI_SUBDEVICE_ID_CCD_BN4SM 0xB568 | ||
1881 | #define PCI_SUBDEVICE_ID_CCD_BN2SM 0xB569 | ||
1882 | #define PCI_SUBDEVICE_ID_CCD_BNE1M 0xB56A | ||
1883 | #define PCI_SUBDEVICE_ID_CCD_BN8SP 0xB56B | ||
1884 | #define PCI_SUBDEVICE_ID_CCD_HFC4S 0xB620 | ||
1885 | #define PCI_SUBDEVICE_ID_CCD_HFC8S 0xB622 | ||
1844 | #define PCI_DEVICE_ID_CCD_B700 0xb700 | 1886 | #define PCI_DEVICE_ID_CCD_B700 0xb700 |
1845 | #define PCI_DEVICE_ID_CCD_B701 0xb701 | 1887 | #define PCI_DEVICE_ID_CCD_B701 0xb701 |
1888 | #define PCI_SUBDEVICE_ID_CCD_HFCE1 0xC523 | ||
1889 | #define PCI_SUBDEVICE_ID_CCD_OV2S 0xE884 | ||
1890 | #define PCI_SUBDEVICE_ID_CCD_OV4S 0xE888 | ||
1891 | #define PCI_SUBDEVICE_ID_CCD_OV8S 0xE998 | ||
1846 | 1892 | ||
1847 | #define PCI_VENDOR_ID_EXAR 0x13a8 | 1893 | #define PCI_VENDOR_ID_EXAR 0x13a8 |
1848 | #define PCI_DEVICE_ID_EXAR_XR17C152 0x0152 | 1894 | #define PCI_DEVICE_ID_EXAR_XR17C152 0x0152 |
@@ -1949,6 +1995,8 @@ | |||
1949 | #define PCI_DEVICE_ID_NX2_5708 0x164c | 1995 | #define PCI_DEVICE_ID_NX2_5708 0x164c |
1950 | #define PCI_DEVICE_ID_TIGON3_5702FE 0x164d | 1996 | #define PCI_DEVICE_ID_TIGON3_5702FE 0x164d |
1951 | #define PCI_DEVICE_ID_NX2_57710 0x164e | 1997 | #define PCI_DEVICE_ID_NX2_57710 0x164e |
1998 | #define PCI_DEVICE_ID_NX2_57711 0x164f | ||
1999 | #define PCI_DEVICE_ID_NX2_57711E 0x1650 | ||
1952 | #define PCI_DEVICE_ID_TIGON3_5705 0x1653 | 2000 | #define PCI_DEVICE_ID_TIGON3_5705 0x1653 |
1953 | #define PCI_DEVICE_ID_TIGON3_5705_2 0x1654 | 2001 | #define PCI_DEVICE_ID_TIGON3_5705_2 0x1654 |
1954 | #define PCI_DEVICE_ID_TIGON3_5720 0x1658 | 2002 | #define PCI_DEVICE_ID_TIGON3_5720 0x1658 |
@@ -1981,6 +2029,7 @@ | |||
1981 | #define PCI_DEVICE_ID_TIGON3_5787M 0x1693 | 2029 | #define PCI_DEVICE_ID_TIGON3_5787M 0x1693 |
1982 | #define PCI_DEVICE_ID_TIGON3_5782 0x1696 | 2030 | #define PCI_DEVICE_ID_TIGON3_5782 0x1696 |
1983 | #define PCI_DEVICE_ID_TIGON3_5784 0x1698 | 2031 | #define PCI_DEVICE_ID_TIGON3_5784 0x1698 |
2032 | #define PCI_DEVICE_ID_TIGON3_5785 0x1699 | ||
1984 | #define PCI_DEVICE_ID_TIGON3_5786 0x169a | 2033 | #define PCI_DEVICE_ID_TIGON3_5786 0x169a |
1985 | #define PCI_DEVICE_ID_TIGON3_5787 0x169b | 2034 | #define PCI_DEVICE_ID_TIGON3_5787 0x169b |
1986 | #define PCI_DEVICE_ID_TIGON3_5788 0x169c | 2035 | #define PCI_DEVICE_ID_TIGON3_5788 0x169c |
@@ -2142,8 +2191,6 @@ | |||
2142 | #define PCI_DEVICE_ID_HERC_WIN 0x5732 | 2191 | #define PCI_DEVICE_ID_HERC_WIN 0x5732 |
2143 | #define PCI_DEVICE_ID_HERC_UNI 0x5832 | 2192 | #define PCI_DEVICE_ID_HERC_UNI 0x5832 |
2144 | 2193 | ||
2145 | #define PCI_VENDOR_ID_RDC 0x17f3 | ||
2146 | |||
2147 | #define PCI_VENDOR_ID_SITECOM 0x182d | 2194 | #define PCI_VENDOR_ID_SITECOM 0x182d |
2148 | #define PCI_DEVICE_ID_SITECOM_DC105V2 0x3069 | 2195 | #define PCI_DEVICE_ID_SITECOM_DC105V2 0x3069 |
2149 | 2196 | ||
@@ -2170,6 +2217,8 @@ | |||
2170 | #define PCI_DEVICE_ID_MPC8544 0x0033 | 2217 | #define PCI_DEVICE_ID_MPC8544 0x0033 |
2171 | #define PCI_DEVICE_ID_MPC8572E 0x0040 | 2218 | #define PCI_DEVICE_ID_MPC8572E 0x0040 |
2172 | #define PCI_DEVICE_ID_MPC8572 0x0041 | 2219 | #define PCI_DEVICE_ID_MPC8572 0x0041 |
2220 | #define PCI_DEVICE_ID_MPC8536E 0x0050 | ||
2221 | #define PCI_DEVICE_ID_MPC8536 0x0051 | ||
2173 | #define PCI_DEVICE_ID_MPC8641 0x7010 | 2222 | #define PCI_DEVICE_ID_MPC8641 0x7010 |
2174 | #define PCI_DEVICE_ID_MPC8641D 0x7011 | 2223 | #define PCI_DEVICE_ID_MPC8641D 0x7011 |
2175 | #define PCI_DEVICE_ID_MPC8610 0x7018 | 2224 | #define PCI_DEVICE_ID_MPC8610 0x7018 |
@@ -2178,6 +2227,7 @@ | |||
2178 | 2227 | ||
2179 | #define PCI_VENDOR_ID_ATTANSIC 0x1969 | 2228 | #define PCI_VENDOR_ID_ATTANSIC 0x1969 |
2180 | #define PCI_DEVICE_ID_ATTANSIC_L1 0x1048 | 2229 | #define PCI_DEVICE_ID_ATTANSIC_L1 0x1048 |
2230 | #define PCI_DEVICE_ID_ATTANSIC_L2 0x2048 | ||
2181 | 2231 | ||
2182 | #define PCI_VENDOR_ID_JMICRON 0x197B | 2232 | #define PCI_VENDOR_ID_JMICRON 0x197B |
2183 | #define PCI_DEVICE_ID_JMICRON_JMB360 0x2360 | 2233 | #define PCI_DEVICE_ID_JMICRON_JMB360 0x2360 |
@@ -2187,6 +2237,7 @@ | |||
2187 | #define PCI_DEVICE_ID_JMICRON_JMB366 0x2366 | 2237 | #define PCI_DEVICE_ID_JMICRON_JMB366 0x2366 |
2188 | #define PCI_DEVICE_ID_JMICRON_JMB368 0x2368 | 2238 | #define PCI_DEVICE_ID_JMICRON_JMB368 0x2368 |
2189 | #define PCI_DEVICE_ID_JMICRON_JMB38X_SD 0x2381 | 2239 | #define PCI_DEVICE_ID_JMICRON_JMB38X_SD 0x2381 |
2240 | #define PCI_DEVICE_ID_JMICRON_JMB38X_MMC 0x2382 | ||
2190 | #define PCI_DEVICE_ID_JMICRON_JMB38X_MS 0x2383 | 2241 | #define PCI_DEVICE_ID_JMICRON_JMB38X_MS 0x2383 |
2191 | 2242 | ||
2192 | #define PCI_VENDOR_ID_KORENIX 0x1982 | 2243 | #define PCI_VENDOR_ID_KORENIX 0x1982 |
@@ -2208,6 +2259,16 @@ | |||
2208 | #define PCI_DEVICE_ID_3DLABS_PERMEDIA2 0x0007 | 2259 | #define PCI_DEVICE_ID_3DLABS_PERMEDIA2 0x0007 |
2209 | #define PCI_DEVICE_ID_3DLABS_PERMEDIA2V 0x0009 | 2260 | #define PCI_DEVICE_ID_3DLABS_PERMEDIA2V 0x0009 |
2210 | 2261 | ||
2262 | #define PCI_VENDOR_ID_NETXEN 0x4040 | ||
2263 | #define PCI_DEVICE_ID_NX2031_10GXSR 0x0001 | ||
2264 | #define PCI_DEVICE_ID_NX2031_10GCX4 0x0002 | ||
2265 | #define PCI_DEVICE_ID_NX2031_4GCU 0x0003 | ||
2266 | #define PCI_DEVICE_ID_NX2031_IMEZ 0x0004 | ||
2267 | #define PCI_DEVICE_ID_NX2031_HMEZ 0x0005 | ||
2268 | #define PCI_DEVICE_ID_NX2031_XG_MGMT 0x0024 | ||
2269 | #define PCI_DEVICE_ID_NX2031_XG_MGMT2 0x0025 | ||
2270 | #define PCI_DEVICE_ID_NX3031 0x0100 | ||
2271 | |||
2211 | #define PCI_VENDOR_ID_AKS 0x416c | 2272 | #define PCI_VENDOR_ID_AKS 0x416c |
2212 | #define PCI_DEVICE_ID_AKS_ALADDINCARD 0x0100 | 2273 | #define PCI_DEVICE_ID_AKS_ALADDINCARD 0x0100 |
2213 | 2274 | ||
@@ -2364,6 +2425,14 @@ | |||
2364 | #define PCI_DEVICE_ID_INTEL_ICH9_7 0x2916 | 2425 | #define PCI_DEVICE_ID_INTEL_ICH9_7 0x2916 |
2365 | #define PCI_DEVICE_ID_INTEL_ICH9_8 0x2918 | 2426 | #define PCI_DEVICE_ID_INTEL_ICH9_8 0x2918 |
2366 | #define PCI_DEVICE_ID_INTEL_82855PM_HB 0x3340 | 2427 | #define PCI_DEVICE_ID_INTEL_82855PM_HB 0x3340 |
2428 | #define PCI_DEVICE_ID_INTEL_IOAT_TBG4 0x3429 | ||
2429 | #define PCI_DEVICE_ID_INTEL_IOAT_TBG5 0x342a | ||
2430 | #define PCI_DEVICE_ID_INTEL_IOAT_TBG6 0x342b | ||
2431 | #define PCI_DEVICE_ID_INTEL_IOAT_TBG7 0x342c | ||
2432 | #define PCI_DEVICE_ID_INTEL_IOAT_TBG0 0x3430 | ||
2433 | #define PCI_DEVICE_ID_INTEL_IOAT_TBG1 0x3431 | ||
2434 | #define PCI_DEVICE_ID_INTEL_IOAT_TBG2 0x3432 | ||
2435 | #define PCI_DEVICE_ID_INTEL_IOAT_TBG3 0x3433 | ||
2367 | #define PCI_DEVICE_ID_INTEL_82830_HB 0x3575 | 2436 | #define PCI_DEVICE_ID_INTEL_82830_HB 0x3575 |
2368 | #define PCI_DEVICE_ID_INTEL_82830_CGC 0x3577 | 2437 | #define PCI_DEVICE_ID_INTEL_82830_CGC 0x3577 |
2369 | #define PCI_DEVICE_ID_INTEL_82855GM_HB 0x3580 | 2438 | #define PCI_DEVICE_ID_INTEL_82855GM_HB 0x3580 |
@@ -2384,7 +2453,13 @@ | |||
2384 | #define PCI_DEVICE_ID_INTEL_ICH10_3 0x3a1a | 2453 | #define PCI_DEVICE_ID_INTEL_ICH10_3 0x3a1a |
2385 | #define PCI_DEVICE_ID_INTEL_ICH10_4 0x3a30 | 2454 | #define PCI_DEVICE_ID_INTEL_ICH10_4 0x3a30 |
2386 | #define PCI_DEVICE_ID_INTEL_ICH10_5 0x3a60 | 2455 | #define PCI_DEVICE_ID_INTEL_ICH10_5 0x3a60 |
2456 | #define PCI_DEVICE_ID_INTEL_PCH_0 0x3b10 | ||
2457 | #define PCI_DEVICE_ID_INTEL_PCH_1 0x3b11 | ||
2458 | #define PCI_DEVICE_ID_INTEL_PCH_2 0x3b30 | ||
2387 | #define PCI_DEVICE_ID_INTEL_IOAT_SNB 0x402f | 2459 | #define PCI_DEVICE_ID_INTEL_IOAT_SNB 0x402f |
2460 | #define PCI_DEVICE_ID_INTEL_5100_16 0x65f0 | ||
2461 | #define PCI_DEVICE_ID_INTEL_5100_21 0x65f5 | ||
2462 | #define PCI_DEVICE_ID_INTEL_5100_22 0x65f6 | ||
2388 | #define PCI_DEVICE_ID_INTEL_5400_ERR 0x4030 | 2463 | #define PCI_DEVICE_ID_INTEL_5400_ERR 0x4030 |
2389 | #define PCI_DEVICE_ID_INTEL_5400_FBD0 0x4035 | 2464 | #define PCI_DEVICE_ID_INTEL_5400_FBD0 0x4035 |
2390 | #define PCI_DEVICE_ID_INTEL_5400_FBD1 0x4036 | 2465 | #define PCI_DEVICE_ID_INTEL_5400_FBD1 0x4036 |
@@ -2505,6 +2580,9 @@ | |||
2505 | 2580 | ||
2506 | #define PCI_VENDOR_ID_3COM_2 0xa727 | 2581 | #define PCI_VENDOR_ID_3COM_2 0xa727 |
2507 | 2582 | ||
2583 | #define PCI_VENDOR_ID_DIGIUM 0xd161 | ||
2584 | #define PCI_DEVICE_ID_DIGIUM_HFC4S 0xb410 | ||
2585 | |||
2508 | #define PCI_SUBVENDOR_ID_EXSYS 0xd84d | 2586 | #define PCI_SUBVENDOR_ID_EXSYS 0xd84d |
2509 | #define PCI_SUBDEVICE_ID_EXSYS_4014 0x4014 | 2587 | #define PCI_SUBDEVICE_ID_EXSYS_4014 0x4014 |
2510 | #define PCI_SUBDEVICE_ID_EXSYS_4055 0x4055 | 2588 | #define PCI_SUBDEVICE_ID_EXSYS_4055 0x4055 |
diff --git a/include/linux/pci_regs.h b/include/linux/pci_regs.h index c0c1223c9194..450684f7eaac 100644 --- a/include/linux/pci_regs.h +++ b/include/linux/pci_regs.h | |||
@@ -231,6 +231,7 @@ | |||
231 | #define PCI_PM_CAP_PME_D2 0x2000 /* PME# from D2 */ | 231 | #define PCI_PM_CAP_PME_D2 0x2000 /* PME# from D2 */ |
232 | #define PCI_PM_CAP_PME_D3 0x4000 /* PME# from D3 (hot) */ | 232 | #define PCI_PM_CAP_PME_D3 0x4000 /* PME# from D3 (hot) */ |
233 | #define PCI_PM_CAP_PME_D3cold 0x8000 /* PME# from D3 (cold) */ | 233 | #define PCI_PM_CAP_PME_D3cold 0x8000 /* PME# from D3 (cold) */ |
234 | #define PCI_PM_CAP_PME_SHIFT 11 /* Start of the PME Mask in PMC */ | ||
234 | #define PCI_PM_CTRL 4 /* PM control and status register */ | 235 | #define PCI_PM_CTRL 4 /* PM control and status register */ |
235 | #define PCI_PM_CTRL_STATE_MASK 0x0003 /* Current power state (D0 to D3) */ | 236 | #define PCI_PM_CTRL_STATE_MASK 0x0003 /* Current power state (D0 to D3) */ |
236 | #define PCI_PM_CTRL_NO_SOFT_RESET 0x0004 /* No reset for D3hot->D0 */ | 237 | #define PCI_PM_CTRL_NO_SOFT_RESET 0x0004 /* No reset for D3hot->D0 */ |
@@ -373,6 +374,7 @@ | |||
373 | #define PCI_EXP_DEVCAP_ATN_BUT 0x1000 /* Attention Button Present */ | 374 | #define PCI_EXP_DEVCAP_ATN_BUT 0x1000 /* Attention Button Present */ |
374 | #define PCI_EXP_DEVCAP_ATN_IND 0x2000 /* Attention Indicator Present */ | 375 | #define PCI_EXP_DEVCAP_ATN_IND 0x2000 /* Attention Indicator Present */ |
375 | #define PCI_EXP_DEVCAP_PWR_IND 0x4000 /* Power Indicator Present */ | 376 | #define PCI_EXP_DEVCAP_PWR_IND 0x4000 /* Power Indicator Present */ |
377 | #define PCI_EXP_DEVCAP_RBER 0x8000 /* Role-Based Error Reporting */ | ||
376 | #define PCI_EXP_DEVCAP_PWR_VAL 0x3fc0000 /* Slot Power Limit Value */ | 378 | #define PCI_EXP_DEVCAP_PWR_VAL 0x3fc0000 /* Slot Power Limit Value */ |
377 | #define PCI_EXP_DEVCAP_PWR_SCL 0xc000000 /* Slot Power Limit Scale */ | 379 | #define PCI_EXP_DEVCAP_PWR_SCL 0xc000000 /* Slot Power Limit Scale */ |
378 | #define PCI_EXP_DEVCTL 8 /* Device Control */ | 380 | #define PCI_EXP_DEVCTL 8 /* Device Control */ |
diff --git a/include/linux/percpu.h b/include/linux/percpu.h index 4cdd393e71e1..9f2a3751873a 100644 --- a/include/linux/percpu.h +++ b/include/linux/percpu.h | |||
@@ -23,12 +23,19 @@ | |||
23 | __attribute__((__section__(SHARED_ALIGNED_SECTION))) \ | 23 | __attribute__((__section__(SHARED_ALIGNED_SECTION))) \ |
24 | PER_CPU_ATTRIBUTES __typeof__(type) per_cpu__##name \ | 24 | PER_CPU_ATTRIBUTES __typeof__(type) per_cpu__##name \ |
25 | ____cacheline_aligned_in_smp | 25 | ____cacheline_aligned_in_smp |
26 | |||
27 | #define DEFINE_PER_CPU_PAGE_ALIGNED(type, name) \ | ||
28 | __attribute__((__section__(".data.percpu.page_aligned"))) \ | ||
29 | PER_CPU_ATTRIBUTES __typeof__(type) per_cpu__##name | ||
26 | #else | 30 | #else |
27 | #define DEFINE_PER_CPU(type, name) \ | 31 | #define DEFINE_PER_CPU(type, name) \ |
28 | PER_CPU_ATTRIBUTES __typeof__(type) per_cpu__##name | 32 | PER_CPU_ATTRIBUTES __typeof__(type) per_cpu__##name |
29 | 33 | ||
30 | #define DEFINE_PER_CPU_SHARED_ALIGNED(type, name) \ | 34 | #define DEFINE_PER_CPU_SHARED_ALIGNED(type, name) \ |
31 | DEFINE_PER_CPU(type, name) | 35 | DEFINE_PER_CPU(type, name) |
36 | |||
37 | #define DEFINE_PER_CPU_PAGE_ALIGNED(type, name) \ | ||
38 | DEFINE_PER_CPU(type, name) | ||
32 | #endif | 39 | #endif |
33 | 40 | ||
34 | #define EXPORT_PER_CPU_SYMBOL(var) EXPORT_SYMBOL(per_cpu__##var) | 41 | #define EXPORT_PER_CPU_SYMBOL(var) EXPORT_SYMBOL(per_cpu__##var) |
@@ -74,11 +81,6 @@ struct percpu_data { | |||
74 | (__typeof__(ptr))__p->ptrs[(cpu)]; \ | 81 | (__typeof__(ptr))__p->ptrs[(cpu)]; \ |
75 | }) | 82 | }) |
76 | 83 | ||
77 | extern void *percpu_populate(void *__pdata, size_t size, gfp_t gfp, int cpu); | ||
78 | extern void percpu_depopulate(void *__pdata, int cpu); | ||
79 | extern int __percpu_populate_mask(void *__pdata, size_t size, gfp_t gfp, | ||
80 | cpumask_t *mask); | ||
81 | extern void __percpu_depopulate_mask(void *__pdata, cpumask_t *mask); | ||
82 | extern void *__percpu_alloc_mask(size_t size, gfp_t gfp, cpumask_t *mask); | 84 | extern void *__percpu_alloc_mask(size_t size, gfp_t gfp, cpumask_t *mask); |
83 | extern void percpu_free(void *__pdata); | 85 | extern void percpu_free(void *__pdata); |
84 | 86 | ||
@@ -86,26 +88,6 @@ extern void percpu_free(void *__pdata); | |||
86 | 88 | ||
87 | #define percpu_ptr(ptr, cpu) ({ (void)(cpu); (ptr); }) | 89 | #define percpu_ptr(ptr, cpu) ({ (void)(cpu); (ptr); }) |
88 | 90 | ||
89 | static inline void percpu_depopulate(void *__pdata, int cpu) | ||
90 | { | ||
91 | } | ||
92 | |||
93 | static inline void __percpu_depopulate_mask(void *__pdata, cpumask_t *mask) | ||
94 | { | ||
95 | } | ||
96 | |||
97 | static inline void *percpu_populate(void *__pdata, size_t size, gfp_t gfp, | ||
98 | int cpu) | ||
99 | { | ||
100 | return percpu_ptr(__pdata, cpu); | ||
101 | } | ||
102 | |||
103 | static inline int __percpu_populate_mask(void *__pdata, size_t size, gfp_t gfp, | ||
104 | cpumask_t *mask) | ||
105 | { | ||
106 | return 0; | ||
107 | } | ||
108 | |||
109 | static __always_inline void *__percpu_alloc_mask(size_t size, gfp_t gfp, cpumask_t *mask) | 91 | static __always_inline void *__percpu_alloc_mask(size_t size, gfp_t gfp, cpumask_t *mask) |
110 | { | 92 | { |
111 | return kzalloc(size, gfp); | 93 | return kzalloc(size, gfp); |
@@ -118,10 +100,6 @@ static inline void percpu_free(void *__pdata) | |||
118 | 100 | ||
119 | #endif /* CONFIG_SMP */ | 101 | #endif /* CONFIG_SMP */ |
120 | 102 | ||
121 | #define percpu_populate_mask(__pdata, size, gfp, mask) \ | ||
122 | __percpu_populate_mask((__pdata), (size), (gfp), &(mask)) | ||
123 | #define percpu_depopulate_mask(__pdata, mask) \ | ||
124 | __percpu_depopulate_mask((__pdata), &(mask)) | ||
125 | #define percpu_alloc_mask(size, gfp, mask) \ | 103 | #define percpu_alloc_mask(size, gfp, mask) \ |
126 | __percpu_alloc_mask((size), (gfp), &(mask)) | 104 | __percpu_alloc_mask((size), (gfp), &(mask)) |
127 | 105 | ||
diff --git a/include/linux/pfkeyv2.h b/include/linux/pfkeyv2.h index 700725ddcaae..01b262959f2e 100644 --- a/include/linux/pfkeyv2.h +++ b/include/linux/pfkeyv2.h | |||
@@ -226,6 +226,15 @@ struct sadb_x_sec_ctx { | |||
226 | } __attribute__((packed)); | 226 | } __attribute__((packed)); |
227 | /* sizeof(struct sadb_sec_ctx) = 8 */ | 227 | /* sizeof(struct sadb_sec_ctx) = 8 */ |
228 | 228 | ||
229 | /* Used by MIGRATE to pass addresses IKE will use to perform | ||
230 | * negotiation with the peer */ | ||
231 | struct sadb_x_kmaddress { | ||
232 | uint16_t sadb_x_kmaddress_len; | ||
233 | uint16_t sadb_x_kmaddress_exttype; | ||
234 | uint32_t sadb_x_kmaddress_reserved; | ||
235 | } __attribute__((packed)); | ||
236 | /* sizeof(struct sadb_x_kmaddress) == 8 */ | ||
237 | |||
229 | /* Message types */ | 238 | /* Message types */ |
230 | #define SADB_RESERVED 0 | 239 | #define SADB_RESERVED 0 |
231 | #define SADB_GETSPI 1 | 240 | #define SADB_GETSPI 1 |
@@ -346,7 +355,9 @@ struct sadb_x_sec_ctx { | |||
346 | #define SADB_X_EXT_NAT_T_DPORT 22 | 355 | #define SADB_X_EXT_NAT_T_DPORT 22 |
347 | #define SADB_X_EXT_NAT_T_OA 23 | 356 | #define SADB_X_EXT_NAT_T_OA 23 |
348 | #define SADB_X_EXT_SEC_CTX 24 | 357 | #define SADB_X_EXT_SEC_CTX 24 |
349 | #define SADB_EXT_MAX 24 | 358 | /* Used with MIGRATE to pass @ to IKE for negotiation */ |
359 | #define SADB_X_EXT_KMADDRESS 25 | ||
360 | #define SADB_EXT_MAX 25 | ||
350 | 361 | ||
351 | /* Identity Extension values */ | 362 | /* Identity Extension values */ |
352 | #define SADB_IDENTTYPE_RESERVED 0 | 363 | #define SADB_IDENTTYPE_RESERVED 0 |
diff --git a/include/linux/phonet.h b/include/linux/phonet.h new file mode 100644 index 000000000000..c9609f9aedac --- /dev/null +++ b/include/linux/phonet.h | |||
@@ -0,0 +1,170 @@ | |||
1 | /** | ||
2 | * file phonet.h | ||
3 | * | ||
4 | * Phonet sockets kernel interface | ||
5 | * | ||
6 | * Copyright (C) 2008 Nokia Corporation. All rights reserved. | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or | ||
9 | * modify it under the terms of the GNU General Public License | ||
10 | * version 2 as published by the Free Software Foundation. | ||
11 | * | ||
12 | * This program is distributed in the hope that it will be useful, but | ||
13 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
15 | * General Public License for more details. | ||
16 | * | ||
17 | * You should have received a copy of the GNU General Public License | ||
18 | * along with this program; if not, write to the Free Software | ||
19 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA | ||
20 | * 02110-1301 USA | ||
21 | */ | ||
22 | |||
23 | #ifndef LINUX_PHONET_H | ||
24 | #define LINUX_PHONET_H | ||
25 | |||
26 | /* Automatic protocol selection */ | ||
27 | #define PN_PROTO_TRANSPORT 0 | ||
28 | /* Phonet datagram socket */ | ||
29 | #define PN_PROTO_PHONET 1 | ||
30 | /* Phonet pipe */ | ||
31 | #define PN_PROTO_PIPE 2 | ||
32 | #define PHONET_NPROTO 3 | ||
33 | |||
34 | /* Socket options for SOL_PNPIPE level */ | ||
35 | #define PNPIPE_ENCAP 1 | ||
36 | #define PNPIPE_IFINDEX 2 | ||
37 | |||
38 | #define PNADDR_ANY 0 | ||
39 | #define PNPORT_RESOURCE_ROUTING 0 | ||
40 | |||
41 | /* Values for PNPIPE_ENCAP option */ | ||
42 | #define PNPIPE_ENCAP_NONE 0 | ||
43 | #define PNPIPE_ENCAP_IP 1 | ||
44 | |||
45 | /* ioctls */ | ||
46 | #define SIOCPNGETOBJECT (SIOCPROTOPRIVATE + 0) | ||
47 | |||
48 | /* Phonet protocol header */ | ||
49 | struct phonethdr { | ||
50 | __u8 pn_rdev; | ||
51 | __u8 pn_sdev; | ||
52 | __u8 pn_res; | ||
53 | __be16 pn_length; | ||
54 | __u8 pn_robj; | ||
55 | __u8 pn_sobj; | ||
56 | } __attribute__((packed)); | ||
57 | |||
58 | /* Common Phonet payload header */ | ||
59 | struct phonetmsg { | ||
60 | __u8 pn_trans_id; /* transaction ID */ | ||
61 | __u8 pn_msg_id; /* message type */ | ||
62 | union { | ||
63 | struct { | ||
64 | __u8 pn_submsg_id; /* message subtype */ | ||
65 | __u8 pn_data[5]; | ||
66 | } base; | ||
67 | struct { | ||
68 | __u16 pn_e_res_id; /* extended resource ID */ | ||
69 | __u8 pn_e_submsg_id; /* message subtype */ | ||
70 | __u8 pn_e_data[3]; | ||
71 | } ext; | ||
72 | } pn_msg_u; | ||
73 | }; | ||
74 | #define PN_COMMON_MESSAGE 0xF0 | ||
75 | #define PN_PREFIX 0xE0 /* resource for extended messages */ | ||
76 | #define pn_submsg_id pn_msg_u.base.pn_submsg_id | ||
77 | #define pn_e_submsg_id pn_msg_u.ext.pn_e_submsg_id | ||
78 | #define pn_e_res_id pn_msg_u.ext.pn_e_res_id | ||
79 | #define pn_data pn_msg_u.base.pn_data | ||
80 | #define pn_e_data pn_msg_u.ext.pn_e_data | ||
81 | |||
82 | /* data for unreachable errors */ | ||
83 | #define PN_COMM_SERVICE_NOT_IDENTIFIED_RESP 0x01 | ||
84 | #define PN_COMM_ISA_ENTITY_NOT_REACHABLE_RESP 0x14 | ||
85 | #define pn_orig_msg_id pn_data[0] | ||
86 | #define pn_status pn_data[1] | ||
87 | #define pn_e_orig_msg_id pn_e_data[0] | ||
88 | #define pn_e_status pn_e_data[1] | ||
89 | |||
90 | /* Phonet socket address structure */ | ||
91 | struct sockaddr_pn { | ||
92 | sa_family_t spn_family; | ||
93 | __u8 spn_obj; | ||
94 | __u8 spn_dev; | ||
95 | __u8 spn_resource; | ||
96 | __u8 spn_zero[sizeof(struct sockaddr) - sizeof(sa_family_t) - 3]; | ||
97 | } __attribute__ ((packed)); | ||
98 | |||
99 | static inline __u16 pn_object(__u8 addr, __u16 port) | ||
100 | { | ||
101 | return (addr << 8) | (port & 0x3ff); | ||
102 | } | ||
103 | |||
104 | static inline __u8 pn_obj(__u16 handle) | ||
105 | { | ||
106 | return handle & 0xff; | ||
107 | } | ||
108 | |||
109 | static inline __u8 pn_dev(__u16 handle) | ||
110 | { | ||
111 | return handle >> 8; | ||
112 | } | ||
113 | |||
114 | static inline __u16 pn_port(__u16 handle) | ||
115 | { | ||
116 | return handle & 0x3ff; | ||
117 | } | ||
118 | |||
119 | static inline __u8 pn_addr(__u16 handle) | ||
120 | { | ||
121 | return (handle >> 8) & 0xfc; | ||
122 | } | ||
123 | |||
124 | static inline void pn_sockaddr_set_addr(struct sockaddr_pn *spn, __u8 addr) | ||
125 | { | ||
126 | spn->spn_dev &= 0x03; | ||
127 | spn->spn_dev |= addr & 0xfc; | ||
128 | } | ||
129 | |||
130 | static inline void pn_sockaddr_set_port(struct sockaddr_pn *spn, __u16 port) | ||
131 | { | ||
132 | spn->spn_dev &= 0xfc; | ||
133 | spn->spn_dev |= (port >> 8) & 0x03; | ||
134 | spn->spn_obj = port & 0xff; | ||
135 | } | ||
136 | |||
137 | static inline void pn_sockaddr_set_object(struct sockaddr_pn *spn, | ||
138 | __u16 handle) | ||
139 | { | ||
140 | spn->spn_dev = pn_dev(handle); | ||
141 | spn->spn_obj = pn_obj(handle); | ||
142 | } | ||
143 | |||
144 | static inline void pn_sockaddr_set_resource(struct sockaddr_pn *spn, | ||
145 | __u8 resource) | ||
146 | { | ||
147 | spn->spn_resource = resource; | ||
148 | } | ||
149 | |||
150 | static inline __u8 pn_sockaddr_get_addr(const struct sockaddr_pn *spn) | ||
151 | { | ||
152 | return spn->spn_dev & 0xfc; | ||
153 | } | ||
154 | |||
155 | static inline __u16 pn_sockaddr_get_port(const struct sockaddr_pn *spn) | ||
156 | { | ||
157 | return ((spn->spn_dev & 0x03) << 8) | spn->spn_obj; | ||
158 | } | ||
159 | |||
160 | static inline __u16 pn_sockaddr_get_object(const struct sockaddr_pn *spn) | ||
161 | { | ||
162 | return pn_object(spn->spn_dev, spn->spn_obj); | ||
163 | } | ||
164 | |||
165 | static inline __u8 pn_sockaddr_get_resource(const struct sockaddr_pn *spn) | ||
166 | { | ||
167 | return spn->spn_resource; | ||
168 | } | ||
169 | |||
170 | #endif | ||
diff --git a/include/linux/phy.h b/include/linux/phy.h index 7224c4099a28..77c4ed60b982 100644 --- a/include/linux/phy.h +++ b/include/linux/phy.h | |||
@@ -99,7 +99,14 @@ struct mii_bus { | |||
99 | */ | 99 | */ |
100 | struct mutex mdio_lock; | 100 | struct mutex mdio_lock; |
101 | 101 | ||
102 | struct device *dev; | 102 | struct device *parent; |
103 | enum { | ||
104 | MDIOBUS_ALLOCATED = 1, | ||
105 | MDIOBUS_REGISTERED, | ||
106 | MDIOBUS_UNREGISTERED, | ||
107 | MDIOBUS_RELEASED, | ||
108 | } state; | ||
109 | struct device dev; | ||
103 | 110 | ||
104 | /* list of all PHYs on bus */ | 111 | /* list of all PHYs on bus */ |
105 | struct phy_device *phy_map[PHY_MAX_ADDR]; | 112 | struct phy_device *phy_map[PHY_MAX_ADDR]; |
@@ -113,6 +120,16 @@ struct mii_bus { | |||
113 | */ | 120 | */ |
114 | int *irq; | 121 | int *irq; |
115 | }; | 122 | }; |
123 | #define to_mii_bus(d) container_of(d, struct mii_bus, dev) | ||
124 | |||
125 | struct mii_bus *mdiobus_alloc(void); | ||
126 | int mdiobus_register(struct mii_bus *bus); | ||
127 | void mdiobus_unregister(struct mii_bus *bus); | ||
128 | void mdiobus_free(struct mii_bus *bus); | ||
129 | struct phy_device *mdiobus_scan(struct mii_bus *bus, int addr); | ||
130 | int mdiobus_read(struct mii_bus *bus, int addr, u16 regnum); | ||
131 | int mdiobus_write(struct mii_bus *bus, int addr, u16 regnum, u16 val); | ||
132 | |||
116 | 133 | ||
117 | #define PHY_INTERRUPT_DISABLED 0x0 | 134 | #define PHY_INTERRUPT_DISABLED 0x0 |
118 | #define PHY_INTERRUPT_ENABLED 0x80000000 | 135 | #define PHY_INTERRUPT_ENABLED 0x80000000 |
@@ -391,8 +408,35 @@ struct phy_fixup { | |||
391 | int (*run)(struct phy_device *phydev); | 408 | int (*run)(struct phy_device *phydev); |
392 | }; | 409 | }; |
393 | 410 | ||
394 | int phy_read(struct phy_device *phydev, u16 regnum); | 411 | /** |
395 | int phy_write(struct phy_device *phydev, u16 regnum, u16 val); | 412 | * phy_read - Convenience function for reading a given PHY register |
413 | * @phydev: the phy_device struct | ||
414 | * @regnum: register number to read | ||
415 | * | ||
416 | * NOTE: MUST NOT be called from interrupt context, | ||
417 | * because the bus read/write functions may wait for an interrupt | ||
418 | * to conclude the operation. | ||
419 | */ | ||
420 | static inline int phy_read(struct phy_device *phydev, u16 regnum) | ||
421 | { | ||
422 | return mdiobus_read(phydev->bus, phydev->addr, regnum); | ||
423 | } | ||
424 | |||
425 | /** | ||
426 | * phy_write - Convenience function for writing a given PHY register | ||
427 | * @phydev: the phy_device struct | ||
428 | * @regnum: register number to write | ||
429 | * @val: value to write to @regnum | ||
430 | * | ||
431 | * NOTE: MUST NOT be called from interrupt context, | ||
432 | * because the bus read/write functions may wait for an interrupt | ||
433 | * to conclude the operation. | ||
434 | */ | ||
435 | static inline int phy_write(struct phy_device *phydev, u16 regnum, u16 val) | ||
436 | { | ||
437 | return mdiobus_write(phydev->bus, phydev->addr, regnum, val); | ||
438 | } | ||
439 | |||
396 | int get_phy_id(struct mii_bus *bus, int addr, u32 *phy_id); | 440 | int get_phy_id(struct mii_bus *bus, int addr, u32 *phy_id); |
397 | struct phy_device* get_phy_device(struct mii_bus *bus, int addr); | 441 | struct phy_device* get_phy_device(struct mii_bus *bus, int addr); |
398 | int phy_clear_interrupt(struct phy_device *phydev); | 442 | int phy_clear_interrupt(struct phy_device *phydev); |
@@ -408,8 +452,6 @@ void phy_start(struct phy_device *phydev); | |||
408 | void phy_stop(struct phy_device *phydev); | 452 | void phy_stop(struct phy_device *phydev); |
409 | int phy_start_aneg(struct phy_device *phydev); | 453 | int phy_start_aneg(struct phy_device *phydev); |
410 | 454 | ||
411 | int mdiobus_register(struct mii_bus *bus); | ||
412 | void mdiobus_unregister(struct mii_bus *bus); | ||
413 | void phy_sanitize_settings(struct phy_device *phydev); | 455 | void phy_sanitize_settings(struct phy_device *phydev); |
414 | int phy_stop_interrupts(struct phy_device *phydev); | 456 | int phy_stop_interrupts(struct phy_device *phydev); |
415 | int phy_enable_interrupts(struct phy_device *phydev); | 457 | int phy_enable_interrupts(struct phy_device *phydev); |
diff --git a/include/linux/pid.h b/include/linux/pid.h index c21c7e8124a7..d7e98ff8021e 100644 --- a/include/linux/pid.h +++ b/include/linux/pid.h | |||
@@ -48,7 +48,7 @@ enum pid_type | |||
48 | */ | 48 | */ |
49 | 49 | ||
50 | struct upid { | 50 | struct upid { |
51 | /* Try to keep pid_chain in the same cacheline as nr for find_pid */ | 51 | /* Try to keep pid_chain in the same cacheline as nr for find_vpid */ |
52 | int nr; | 52 | int nr; |
53 | struct pid_namespace *ns; | 53 | struct pid_namespace *ns; |
54 | struct hlist_node pid_chain; | 54 | struct hlist_node pid_chain; |
@@ -57,10 +57,10 @@ struct upid { | |||
57 | struct pid | 57 | struct pid |
58 | { | 58 | { |
59 | atomic_t count; | 59 | atomic_t count; |
60 | unsigned int level; | ||
60 | /* lists of tasks that use this pid */ | 61 | /* lists of tasks that use this pid */ |
61 | struct hlist_head tasks[PIDTYPE_MAX]; | 62 | struct hlist_head tasks[PIDTYPE_MAX]; |
62 | struct rcu_head rcu; | 63 | struct rcu_head rcu; |
63 | unsigned int level; | ||
64 | struct upid numbers[1]; | 64 | struct upid numbers[1]; |
65 | }; | 65 | }; |
66 | 66 | ||
@@ -105,14 +105,12 @@ extern struct pid_namespace init_pid_ns; | |||
105 | * or rcu_read_lock() held. | 105 | * or rcu_read_lock() held. |
106 | * | 106 | * |
107 | * find_pid_ns() finds the pid in the namespace specified | 107 | * find_pid_ns() finds the pid in the namespace specified |
108 | * find_pid() find the pid by its global id, i.e. in the init namespace | ||
109 | * find_vpid() finr the pid by its virtual id, i.e. in the current namespace | 108 | * find_vpid() finr the pid by its virtual id, i.e. in the current namespace |
110 | * | 109 | * |
111 | * see also find_task_by_pid() set in include/linux/sched.h | 110 | * see also find_task_by_vpid() set in include/linux/sched.h |
112 | */ | 111 | */ |
113 | extern struct pid *find_pid_ns(int nr, struct pid_namespace *ns); | 112 | extern struct pid *find_pid_ns(int nr, struct pid_namespace *ns); |
114 | extern struct pid *find_vpid(int nr); | 113 | extern struct pid *find_vpid(int nr); |
115 | extern struct pid *find_pid(int nr); | ||
116 | 114 | ||
117 | /* | 115 | /* |
118 | * Lookup a PID in the hash table, and return with it's count elevated. | 116 | * Lookup a PID in the hash table, and return with it's count elevated. |
@@ -163,4 +161,13 @@ pid_t pid_vnr(struct pid *pid); | |||
163 | } \ | 161 | } \ |
164 | } while (0) | 162 | } while (0) |
165 | 163 | ||
164 | #define do_each_pid_thread(pid, type, task) \ | ||
165 | do_each_pid_task(pid, type, task) { \ | ||
166 | struct task_struct *tg___ = task; \ | ||
167 | do { | ||
168 | |||
169 | #define while_each_pid_thread(pid, type, task) \ | ||
170 | } while_each_thread(tg___, task); \ | ||
171 | task = tg___; \ | ||
172 | } while_each_pid_task(pid, type, task) | ||
166 | #endif /* _LINUX_PID_H */ | 173 | #endif /* _LINUX_PID_H */ |
diff --git a/include/linux/pid_namespace.h b/include/linux/pid_namespace.h index caff5283d15c..1af82c4e17d4 100644 --- a/include/linux/pid_namespace.h +++ b/include/linux/pid_namespace.h | |||
@@ -14,6 +14,8 @@ struct pidmap { | |||
14 | 14 | ||
15 | #define PIDMAP_ENTRIES ((PID_MAX_LIMIT + 8*PAGE_SIZE - 1)/PAGE_SIZE/8) | 15 | #define PIDMAP_ENTRIES ((PID_MAX_LIMIT + 8*PAGE_SIZE - 1)/PAGE_SIZE/8) |
16 | 16 | ||
17 | struct bsd_acct_struct; | ||
18 | |||
17 | struct pid_namespace { | 19 | struct pid_namespace { |
18 | struct kref kref; | 20 | struct kref kref; |
19 | struct pidmap pidmap[PIDMAP_ENTRIES]; | 21 | struct pidmap pidmap[PIDMAP_ENTRIES]; |
@@ -25,6 +27,9 @@ struct pid_namespace { | |||
25 | #ifdef CONFIG_PROC_FS | 27 | #ifdef CONFIG_PROC_FS |
26 | struct vfsmount *proc_mnt; | 28 | struct vfsmount *proc_mnt; |
27 | #endif | 29 | #endif |
30 | #ifdef CONFIG_BSD_PROCESS_ACCT | ||
31 | struct bsd_acct_struct *bacct; | ||
32 | #endif | ||
28 | }; | 33 | }; |
29 | 34 | ||
30 | extern struct pid_namespace init_pid_ns; | 35 | extern struct pid_namespace init_pid_ns; |
@@ -85,4 +90,7 @@ static inline struct task_struct *task_child_reaper(struct task_struct *tsk) | |||
85 | return tsk->nsproxy->pid_ns->child_reaper; | 90 | return tsk->nsproxy->pid_ns->child_reaper; |
86 | } | 91 | } |
87 | 92 | ||
93 | void pidhash_init(void); | ||
94 | void pidmap_init(void); | ||
95 | |||
88 | #endif /* _LINUX_PID_NS_H */ | 96 | #endif /* _LINUX_PID_NS_H */ |
diff --git a/include/linux/pim.h b/include/linux/pim.h index 236ffd317394..1ba0661561a4 100644 --- a/include/linux/pim.h +++ b/include/linux/pim.h | |||
@@ -3,22 +3,6 @@ | |||
3 | 3 | ||
4 | #include <asm/byteorder.h> | 4 | #include <asm/byteorder.h> |
5 | 5 | ||
6 | #ifndef __KERNEL__ | ||
7 | struct pim { | ||
8 | #if defined(__LITTLE_ENDIAN_BITFIELD) | ||
9 | __u8 pim_type:4, /* PIM message type */ | ||
10 | pim_ver:4; /* PIM version */ | ||
11 | #elif defined(__BIG_ENDIAN_BITFIELD) | ||
12 | __u8 pim_ver:4; /* PIM version */ | ||
13 | pim_type:4; /* PIM message type */ | ||
14 | #endif | ||
15 | __u8 pim_rsv; /* Reserved */ | ||
16 | __be16 pim_cksum; /* Checksum */ | ||
17 | }; | ||
18 | |||
19 | #define PIM_MINLEN 8 | ||
20 | #endif | ||
21 | |||
22 | /* Message types - V1 */ | 6 | /* Message types - V1 */ |
23 | #define PIM_V1_VERSION __constant_htonl(0x10000000) | 7 | #define PIM_V1_VERSION __constant_htonl(0x10000000) |
24 | #define PIM_V1_REGISTER 1 | 8 | #define PIM_V1_REGISTER 1 |
@@ -27,7 +11,6 @@ struct pim { | |||
27 | #define PIM_VERSION 2 | 11 | #define PIM_VERSION 2 |
28 | #define PIM_REGISTER 1 | 12 | #define PIM_REGISTER 1 |
29 | 13 | ||
30 | #if defined(__KERNEL__) | ||
31 | #define PIM_NULL_REGISTER __constant_htonl(0x40000000) | 14 | #define PIM_NULL_REGISTER __constant_htonl(0x40000000) |
32 | 15 | ||
33 | /* PIMv2 register message header layout (ietf-draft-idmr-pimvsm-v2-00.ps */ | 16 | /* PIMv2 register message header layout (ietf-draft-idmr-pimvsm-v2-00.ps */ |
@@ -42,4 +25,3 @@ struct pimreghdr | |||
42 | struct sk_buff; | 25 | struct sk_buff; |
43 | extern int pim_rcv_v1(struct sk_buff *); | 26 | extern int pim_rcv_v1(struct sk_buff *); |
44 | #endif | 27 | #endif |
45 | #endif | ||
diff --git a/include/linux/pkt_cls.h b/include/linux/pkt_cls.h index 99efbed81fa2..7cf7824df778 100644 --- a/include/linux/pkt_cls.h +++ b/include/linux/pkt_cls.h | |||
@@ -374,6 +374,7 @@ enum | |||
374 | TCA_FLOW_ACT, | 374 | TCA_FLOW_ACT, |
375 | TCA_FLOW_POLICE, | 375 | TCA_FLOW_POLICE, |
376 | TCA_FLOW_EMATCHES, | 376 | TCA_FLOW_EMATCHES, |
377 | TCA_FLOW_PERTURB, | ||
377 | __TCA_FLOW_MAX | 378 | __TCA_FLOW_MAX |
378 | }; | 379 | }; |
379 | 380 | ||
diff --git a/include/linux/pkt_sched.h b/include/linux/pkt_sched.h index dbb7ac37960d..5d921fa91a5b 100644 --- a/include/linux/pkt_sched.h +++ b/include/linux/pkt_sched.h | |||
@@ -85,6 +85,26 @@ struct tc_ratespec | |||
85 | 85 | ||
86 | #define TC_RTAB_SIZE 1024 | 86 | #define TC_RTAB_SIZE 1024 |
87 | 87 | ||
88 | struct tc_sizespec { | ||
89 | unsigned char cell_log; | ||
90 | unsigned char size_log; | ||
91 | short cell_align; | ||
92 | int overhead; | ||
93 | unsigned int linklayer; | ||
94 | unsigned int mpu; | ||
95 | unsigned int mtu; | ||
96 | unsigned int tsize; | ||
97 | }; | ||
98 | |||
99 | enum { | ||
100 | TCA_STAB_UNSPEC, | ||
101 | TCA_STAB_BASE, | ||
102 | TCA_STAB_DATA, | ||
103 | __TCA_STAB_MAX | ||
104 | }; | ||
105 | |||
106 | #define TCA_STAB_MAX (__TCA_STAB_MAX - 1) | ||
107 | |||
88 | /* FIFO section */ | 108 | /* FIFO section */ |
89 | 109 | ||
90 | struct tc_fifo_qopt | 110 | struct tc_fifo_qopt |
@@ -103,14 +123,12 @@ struct tc_prio_qopt | |||
103 | __u8 priomap[TC_PRIO_MAX+1]; /* Map: logical priority -> PRIO band */ | 123 | __u8 priomap[TC_PRIO_MAX+1]; /* Map: logical priority -> PRIO band */ |
104 | }; | 124 | }; |
105 | 125 | ||
106 | enum | 126 | /* MULTIQ section */ |
107 | { | ||
108 | TCA_PRIO_UNSPEC, | ||
109 | TCA_PRIO_MQ, | ||
110 | __TCA_PRIO_MAX | ||
111 | }; | ||
112 | 127 | ||
113 | #define TCA_PRIO_MAX (__TCA_PRIO_MAX - 1) | 128 | struct tc_multiq_qopt { |
129 | __u16 bands; /* Number of bands */ | ||
130 | __u16 max_bands; /* Maximum number of queues */ | ||
131 | }; | ||
114 | 132 | ||
115 | /* TBF section */ | 133 | /* TBF section */ |
116 | 134 | ||
diff --git a/include/linux/platform_device.h b/include/linux/platform_device.h index 3261681c82a4..95ac21ab3a09 100644 --- a/include/linux/platform_device.h +++ b/include/linux/platform_device.h | |||
@@ -53,6 +53,7 @@ struct platform_driver { | |||
53 | int (*suspend_late)(struct platform_device *, pm_message_t state); | 53 | int (*suspend_late)(struct platform_device *, pm_message_t state); |
54 | int (*resume_early)(struct platform_device *); | 54 | int (*resume_early)(struct platform_device *); |
55 | int (*resume)(struct platform_device *); | 55 | int (*resume)(struct platform_device *); |
56 | struct pm_ext_ops *pm; | ||
56 | struct device_driver driver; | 57 | struct device_driver driver; |
57 | }; | 58 | }; |
58 | 59 | ||
diff --git a/include/linux/pm.h b/include/linux/pm.h index 39a7ee859b67..4dcce54b6d76 100644 --- a/include/linux/pm.h +++ b/include/linux/pm.h | |||
@@ -22,104 +22,345 @@ | |||
22 | #define _LINUX_PM_H | 22 | #define _LINUX_PM_H |
23 | 23 | ||
24 | #include <linux/list.h> | 24 | #include <linux/list.h> |
25 | #include <asm/atomic.h> | ||
26 | #include <asm/errno.h> | ||
27 | 25 | ||
28 | /* | 26 | /* |
29 | * Power management requests... these are passed to pm_send_all() and friends. | 27 | * Callbacks for platform drivers to implement. |
30 | * | ||
31 | * these functions are old and deprecated, see below. | ||
32 | */ | 28 | */ |
33 | typedef int __bitwise pm_request_t; | 29 | extern void (*pm_idle)(void); |
34 | 30 | extern void (*pm_power_off)(void); | |
35 | #define PM_SUSPEND ((__force pm_request_t) 1) /* enter D1-D3 */ | 31 | extern void (*pm_power_off_prepare)(void); |
36 | #define PM_RESUME ((__force pm_request_t) 2) /* enter D0 */ | ||
37 | |||
38 | 32 | ||
39 | /* | 33 | /* |
40 | * Device types... these are passed to pm_register | 34 | * Device power management |
41 | */ | 35 | */ |
42 | typedef int __bitwise pm_dev_t; | ||
43 | 36 | ||
44 | #define PM_UNKNOWN_DEV ((__force pm_dev_t) 0) /* generic */ | 37 | struct device; |
45 | #define PM_SYS_DEV ((__force pm_dev_t) 1) /* system device (fan, KB controller, ...) */ | ||
46 | #define PM_PCI_DEV ((__force pm_dev_t) 2) /* PCI device */ | ||
47 | #define PM_USB_DEV ((__force pm_dev_t) 3) /* USB device */ | ||
48 | #define PM_SCSI_DEV ((__force pm_dev_t) 4) /* SCSI device */ | ||
49 | #define PM_ISA_DEV ((__force pm_dev_t) 5) /* ISA device */ | ||
50 | #define PM_MTD_DEV ((__force pm_dev_t) 6) /* Memory Technology Device */ | ||
51 | 38 | ||
52 | /* | 39 | typedef struct pm_message { |
53 | * System device hardware ID (PnP) values | 40 | int event; |
41 | } pm_message_t; | ||
42 | |||
43 | /** | ||
44 | * struct pm_ops - device PM callbacks | ||
45 | * | ||
46 | * Several driver power state transitions are externally visible, affecting | ||
47 | * the state of pending I/O queues and (for drivers that touch hardware) | ||
48 | * interrupts, wakeups, DMA, and other hardware state. There may also be | ||
49 | * internal transitions to various low power modes, which are transparent | ||
50 | * to the rest of the driver stack (such as a driver that's ON gating off | ||
51 | * clocks which are not in active use). | ||
52 | * | ||
53 | * The externally visible transitions are handled with the help of the following | ||
54 | * callbacks included in this structure: | ||
55 | * | ||
56 | * @prepare: Prepare the device for the upcoming transition, but do NOT change | ||
57 | * its hardware state. Prevent new children of the device from being | ||
58 | * registered after @prepare() returns (the driver's subsystem and | ||
59 | * generally the rest of the kernel is supposed to prevent new calls to the | ||
60 | * probe method from being made too once @prepare() has succeeded). If | ||
61 | * @prepare() detects a situation it cannot handle (e.g. registration of a | ||
62 | * child already in progress), it may return -EAGAIN, so that the PM core | ||
63 | * can execute it once again (e.g. after the new child has been registered) | ||
64 | * to recover from the race condition. This method is executed for all | ||
65 | * kinds of suspend transitions and is followed by one of the suspend | ||
66 | * callbacks: @suspend(), @freeze(), or @poweroff(). | ||
67 | * The PM core executes @prepare() for all devices before starting to | ||
68 | * execute suspend callbacks for any of them, so drivers may assume all of | ||
69 | * the other devices to be present and functional while @prepare() is being | ||
70 | * executed. In particular, it is safe to make GFP_KERNEL memory | ||
71 | * allocations from within @prepare(). However, drivers may NOT assume | ||
72 | * anything about the availability of the user space at that time and it | ||
73 | * is not correct to request firmware from within @prepare() (it's too | ||
74 | * late to do that). [To work around this limitation, drivers may | ||
75 | * register suspend and hibernation notifiers that are executed before the | ||
76 | * freezing of tasks.] | ||
77 | * | ||
78 | * @complete: Undo the changes made by @prepare(). This method is executed for | ||
79 | * all kinds of resume transitions, following one of the resume callbacks: | ||
80 | * @resume(), @thaw(), @restore(). Also called if the state transition | ||
81 | * fails before the driver's suspend callback (@suspend(), @freeze(), | ||
82 | * @poweroff()) can be executed (e.g. if the suspend callback fails for one | ||
83 | * of the other devices that the PM core has unsuccessfully attempted to | ||
84 | * suspend earlier). | ||
85 | * The PM core executes @complete() after it has executed the appropriate | ||
86 | * resume callback for all devices. | ||
87 | * | ||
88 | * @suspend: Executed before putting the system into a sleep state in which the | ||
89 | * contents of main memory are preserved. Quiesce the device, put it into | ||
90 | * a low power state appropriate for the upcoming system state (such as | ||
91 | * PCI_D3hot), and enable wakeup events as appropriate. | ||
92 | * | ||
93 | * @resume: Executed after waking the system up from a sleep state in which the | ||
94 | * contents of main memory were preserved. Put the device into the | ||
95 | * appropriate state, according to the information saved in memory by the | ||
96 | * preceding @suspend(). The driver starts working again, responding to | ||
97 | * hardware events and software requests. The hardware may have gone | ||
98 | * through a power-off reset, or it may have maintained state from the | ||
99 | * previous suspend() which the driver may rely on while resuming. On most | ||
100 | * platforms, there are no restrictions on availability of resources like | ||
101 | * clocks during @resume(). | ||
102 | * | ||
103 | * @freeze: Hibernation-specific, executed before creating a hibernation image. | ||
104 | * Quiesce operations so that a consistent image can be created, but do NOT | ||
105 | * otherwise put the device into a low power device state and do NOT emit | ||
106 | * system wakeup events. Save in main memory the device settings to be | ||
107 | * used by @restore() during the subsequent resume from hibernation or by | ||
108 | * the subsequent @thaw(), if the creation of the image or the restoration | ||
109 | * of main memory contents from it fails. | ||
110 | * | ||
111 | * @thaw: Hibernation-specific, executed after creating a hibernation image OR | ||
112 | * if the creation of the image fails. Also executed after a failing | ||
113 | * attempt to restore the contents of main memory from such an image. | ||
114 | * Undo the changes made by the preceding @freeze(), so the device can be | ||
115 | * operated in the same way as immediately before the call to @freeze(). | ||
116 | * | ||
117 | * @poweroff: Hibernation-specific, executed after saving a hibernation image. | ||
118 | * Quiesce the device, put it into a low power state appropriate for the | ||
119 | * upcoming system state (such as PCI_D3hot), and enable wakeup events as | ||
120 | * appropriate. | ||
121 | * | ||
122 | * @restore: Hibernation-specific, executed after restoring the contents of main | ||
123 | * memory from a hibernation image. Driver starts working again, | ||
124 | * responding to hardware events and software requests. Drivers may NOT | ||
125 | * make ANY assumptions about the hardware state right prior to @restore(). | ||
126 | * On most platforms, there are no restrictions on availability of | ||
127 | * resources like clocks during @restore(). | ||
128 | * | ||
129 | * All of the above callbacks, except for @complete(), return error codes. | ||
130 | * However, the error codes returned by the resume operations, @resume(), | ||
131 | * @thaw(), and @restore(), do not cause the PM core to abort the resume | ||
132 | * transition during which they are returned. The error codes returned in | ||
133 | * that cases are only printed by the PM core to the system logs for debugging | ||
134 | * purposes. Still, it is recommended that drivers only return error codes | ||
135 | * from their resume methods in case of an unrecoverable failure (i.e. when the | ||
136 | * device being handled refuses to resume and becomes unusable) to allow us to | ||
137 | * modify the PM core in the future, so that it can avoid attempting to handle | ||
138 | * devices that failed to resume and their children. | ||
139 | * | ||
140 | * It is allowed to unregister devices while the above callbacks are being | ||
141 | * executed. However, it is not allowed to unregister a device from within any | ||
142 | * of its own callbacks. | ||
54 | */ | 143 | */ |
55 | enum | 144 | |
56 | { | 145 | struct pm_ops { |
57 | PM_SYS_UNKNOWN = 0x00000000, /* generic */ | 146 | int (*prepare)(struct device *dev); |
58 | PM_SYS_KBC = 0x41d00303, /* keyboard controller */ | 147 | void (*complete)(struct device *dev); |
59 | PM_SYS_COM = 0x41d00500, /* serial port */ | 148 | int (*suspend)(struct device *dev); |
60 | PM_SYS_IRDA = 0x41d00510, /* IRDA controller */ | 149 | int (*resume)(struct device *dev); |
61 | PM_SYS_FDC = 0x41d00700, /* floppy controller */ | 150 | int (*freeze)(struct device *dev); |
62 | PM_SYS_VGA = 0x41d00900, /* VGA controller */ | 151 | int (*thaw)(struct device *dev); |
63 | PM_SYS_PCMCIA = 0x41d00e00, /* PCMCIA controller */ | 152 | int (*poweroff)(struct device *dev); |
153 | int (*restore)(struct device *dev); | ||
64 | }; | 154 | }; |
65 | 155 | ||
66 | /* | 156 | /** |
67 | * Device identifier | 157 | * struct pm_ext_ops - extended device PM callbacks |
158 | * | ||
159 | * Some devices require certain operations related to suspend and hibernation | ||
160 | * to be carried out with interrupts disabled. Thus, 'struct pm_ext_ops' below | ||
161 | * is defined, adding callbacks to be executed with interrupts disabled to | ||
162 | * 'struct pm_ops'. | ||
163 | * | ||
164 | * The following callbacks included in 'struct pm_ext_ops' are executed with | ||
165 | * the nonboot CPUs switched off and with interrupts disabled on the only | ||
166 | * functional CPU. They also are executed with the PM core list of devices | ||
167 | * locked, so they must NOT unregister any devices. | ||
168 | * | ||
169 | * @suspend_noirq: Complete the operations of ->suspend() by carrying out any | ||
170 | * actions required for suspending the device that need interrupts to be | ||
171 | * disabled | ||
172 | * | ||
173 | * @resume_noirq: Prepare for the execution of ->resume() by carrying out any | ||
174 | * actions required for resuming the device that need interrupts to be | ||
175 | * disabled | ||
176 | * | ||
177 | * @freeze_noirq: Complete the operations of ->freeze() by carrying out any | ||
178 | * actions required for freezing the device that need interrupts to be | ||
179 | * disabled | ||
180 | * | ||
181 | * @thaw_noirq: Prepare for the execution of ->thaw() by carrying out any | ||
182 | * actions required for thawing the device that need interrupts to be | ||
183 | * disabled | ||
184 | * | ||
185 | * @poweroff_noirq: Complete the operations of ->poweroff() by carrying out any | ||
186 | * actions required for handling the device that need interrupts to be | ||
187 | * disabled | ||
188 | * | ||
189 | * @restore_noirq: Prepare for the execution of ->restore() by carrying out any | ||
190 | * actions required for restoring the operations of the device that need | ||
191 | * interrupts to be disabled | ||
192 | * | ||
193 | * All of the above callbacks return error codes, but the error codes returned | ||
194 | * by the resume operations, @resume_noirq(), @thaw_noirq(), and | ||
195 | * @restore_noirq(), do not cause the PM core to abort the resume transition | ||
196 | * during which they are returned. The error codes returned in that cases are | ||
197 | * only printed by the PM core to the system logs for debugging purposes. | ||
198 | * Still, as stated above, it is recommended that drivers only return error | ||
199 | * codes from their resume methods if the device being handled fails to resume | ||
200 | * and is not usable any more. | ||
68 | */ | 201 | */ |
69 | #define PM_PCI_ID(dev) ((dev)->bus->number << 16 | (dev)->devfn) | ||
70 | 202 | ||
71 | /* | 203 | struct pm_ext_ops { |
72 | * Request handler callback | 204 | struct pm_ops base; |
205 | int (*suspend_noirq)(struct device *dev); | ||
206 | int (*resume_noirq)(struct device *dev); | ||
207 | int (*freeze_noirq)(struct device *dev); | ||
208 | int (*thaw_noirq)(struct device *dev); | ||
209 | int (*poweroff_noirq)(struct device *dev); | ||
210 | int (*restore_noirq)(struct device *dev); | ||
211 | }; | ||
212 | |||
213 | /** | ||
214 | * PM_EVENT_ messages | ||
215 | * | ||
216 | * The following PM_EVENT_ messages are defined for the internal use of the PM | ||
217 | * core, in order to provide a mechanism allowing the high level suspend and | ||
218 | * hibernation code to convey the necessary information to the device PM core | ||
219 | * code: | ||
220 | * | ||
221 | * ON No transition. | ||
222 | * | ||
223 | * FREEZE System is going to hibernate, call ->prepare() and ->freeze() | ||
224 | * for all devices. | ||
225 | * | ||
226 | * SUSPEND System is going to suspend, call ->prepare() and ->suspend() | ||
227 | * for all devices. | ||
228 | * | ||
229 | * HIBERNATE Hibernation image has been saved, call ->prepare() and | ||
230 | * ->poweroff() for all devices. | ||
231 | * | ||
232 | * QUIESCE Contents of main memory are going to be restored from a (loaded) | ||
233 | * hibernation image, call ->prepare() and ->freeze() for all | ||
234 | * devices. | ||
235 | * | ||
236 | * RESUME System is resuming, call ->resume() and ->complete() for all | ||
237 | * devices. | ||
238 | * | ||
239 | * THAW Hibernation image has been created, call ->thaw() and | ||
240 | * ->complete() for all devices. | ||
241 | * | ||
242 | * RESTORE Contents of main memory have been restored from a hibernation | ||
243 | * image, call ->restore() and ->complete() for all devices. | ||
244 | * | ||
245 | * RECOVER Creation of a hibernation image or restoration of the main | ||
246 | * memory contents from a hibernation image has failed, call | ||
247 | * ->thaw() and ->complete() for all devices. | ||
248 | * | ||
249 | * The following PM_EVENT_ messages are defined for internal use by | ||
250 | * kernel subsystems. They are never issued by the PM core. | ||
251 | * | ||
252 | * USER_SUSPEND Manual selective suspend was issued by userspace. | ||
253 | * | ||
254 | * USER_RESUME Manual selective resume was issued by userspace. | ||
255 | * | ||
256 | * REMOTE_WAKEUP Remote-wakeup request was received from the device. | ||
257 | * | ||
258 | * AUTO_SUSPEND Automatic (device idle) runtime suspend was | ||
259 | * initiated by the subsystem. | ||
260 | * | ||
261 | * AUTO_RESUME Automatic (device needed) runtime resume was | ||
262 | * requested by a driver. | ||
73 | */ | 263 | */ |
74 | struct pm_dev; | ||
75 | 264 | ||
76 | typedef int (*pm_callback)(struct pm_dev *dev, pm_request_t rqst, void *data); | 265 | #define PM_EVENT_ON 0x0000 |
266 | #define PM_EVENT_FREEZE 0x0001 | ||
267 | #define PM_EVENT_SUSPEND 0x0002 | ||
268 | #define PM_EVENT_HIBERNATE 0x0004 | ||
269 | #define PM_EVENT_QUIESCE 0x0008 | ||
270 | #define PM_EVENT_RESUME 0x0010 | ||
271 | #define PM_EVENT_THAW 0x0020 | ||
272 | #define PM_EVENT_RESTORE 0x0040 | ||
273 | #define PM_EVENT_RECOVER 0x0080 | ||
274 | #define PM_EVENT_USER 0x0100 | ||
275 | #define PM_EVENT_REMOTE 0x0200 | ||
276 | #define PM_EVENT_AUTO 0x0400 | ||
277 | |||
278 | #define PM_EVENT_SLEEP (PM_EVENT_SUSPEND | PM_EVENT_HIBERNATE) | ||
279 | #define PM_EVENT_USER_SUSPEND (PM_EVENT_USER | PM_EVENT_SUSPEND) | ||
280 | #define PM_EVENT_USER_RESUME (PM_EVENT_USER | PM_EVENT_RESUME) | ||
281 | #define PM_EVENT_REMOTE_WAKEUP (PM_EVENT_REMOTE | PM_EVENT_RESUME) | ||
282 | #define PM_EVENT_AUTO_SUSPEND (PM_EVENT_AUTO | PM_EVENT_SUSPEND) | ||
283 | #define PM_EVENT_AUTO_RESUME (PM_EVENT_AUTO | PM_EVENT_RESUME) | ||
77 | 284 | ||
78 | /* | 285 | #define PMSG_ON ((struct pm_message){ .event = PM_EVENT_ON, }) |
79 | * Dynamic device information | 286 | #define PMSG_FREEZE ((struct pm_message){ .event = PM_EVENT_FREEZE, }) |
287 | #define PMSG_QUIESCE ((struct pm_message){ .event = PM_EVENT_QUIESCE, }) | ||
288 | #define PMSG_SUSPEND ((struct pm_message){ .event = PM_EVENT_SUSPEND, }) | ||
289 | #define PMSG_HIBERNATE ((struct pm_message){ .event = PM_EVENT_HIBERNATE, }) | ||
290 | #define PMSG_RESUME ((struct pm_message){ .event = PM_EVENT_RESUME, }) | ||
291 | #define PMSG_THAW ((struct pm_message){ .event = PM_EVENT_THAW, }) | ||
292 | #define PMSG_RESTORE ((struct pm_message){ .event = PM_EVENT_RESTORE, }) | ||
293 | #define PMSG_RECOVER ((struct pm_message){ .event = PM_EVENT_RECOVER, }) | ||
294 | #define PMSG_USER_SUSPEND ((struct pm_messge) \ | ||
295 | { .event = PM_EVENT_USER_SUSPEND, }) | ||
296 | #define PMSG_USER_RESUME ((struct pm_messge) \ | ||
297 | { .event = PM_EVENT_USER_RESUME, }) | ||
298 | #define PMSG_REMOTE_RESUME ((struct pm_messge) \ | ||
299 | { .event = PM_EVENT_REMOTE_RESUME, }) | ||
300 | #define PMSG_AUTO_SUSPEND ((struct pm_messge) \ | ||
301 | { .event = PM_EVENT_AUTO_SUSPEND, }) | ||
302 | #define PMSG_AUTO_RESUME ((struct pm_messge) \ | ||
303 | { .event = PM_EVENT_AUTO_RESUME, }) | ||
304 | |||
305 | /** | ||
306 | * Device power management states | ||
307 | * | ||
308 | * These state labels are used internally by the PM core to indicate the current | ||
309 | * status of a device with respect to the PM core operations. | ||
310 | * | ||
311 | * DPM_ON Device is regarded as operational. Set this way | ||
312 | * initially and when ->complete() is about to be called. | ||
313 | * Also set when ->prepare() fails. | ||
314 | * | ||
315 | * DPM_PREPARING Device is going to be prepared for a PM transition. Set | ||
316 | * when ->prepare() is about to be called. | ||
317 | * | ||
318 | * DPM_RESUMING Device is going to be resumed. Set when ->resume(), | ||
319 | * ->thaw(), or ->restore() is about to be called. | ||
320 | * | ||
321 | * DPM_SUSPENDING Device has been prepared for a power transition. Set | ||
322 | * when ->prepare() has just succeeded. | ||
323 | * | ||
324 | * DPM_OFF Device is regarded as inactive. Set immediately after | ||
325 | * ->suspend(), ->freeze(), or ->poweroff() has succeeded. | ||
326 | * Also set when ->resume()_noirq, ->thaw_noirq(), or | ||
327 | * ->restore_noirq() is about to be called. | ||
328 | * | ||
329 | * DPM_OFF_IRQ Device is in a "deep sleep". Set immediately after | ||
330 | * ->suspend_noirq(), ->freeze_noirq(), or | ||
331 | * ->poweroff_noirq() has just succeeded. | ||
80 | */ | 332 | */ |
81 | struct pm_dev | ||
82 | { | ||
83 | pm_dev_t type; | ||
84 | unsigned long id; | ||
85 | pm_callback callback; | ||
86 | void *data; | ||
87 | 333 | ||
88 | unsigned long flags; | 334 | enum dpm_state { |
89 | unsigned long state; | 335 | DPM_INVALID, |
90 | unsigned long prev_state; | 336 | DPM_ON, |
91 | 337 | DPM_PREPARING, | |
92 | struct list_head entry; | 338 | DPM_RESUMING, |
339 | DPM_SUSPENDING, | ||
340 | DPM_OFF, | ||
341 | DPM_OFF_IRQ, | ||
93 | }; | 342 | }; |
94 | 343 | ||
95 | /* Functions above this comment are list-based old-style power | 344 | struct dev_pm_info { |
96 | * management. Please avoid using them. */ | 345 | pm_message_t power_state; |
346 | unsigned can_wakeup:1; | ||
347 | unsigned should_wakeup:1; | ||
348 | enum dpm_state status; /* Owned by the PM core */ | ||
349 | #ifdef CONFIG_PM_SLEEP | ||
350 | struct list_head entry; | ||
351 | #endif | ||
352 | }; | ||
97 | 353 | ||
98 | /* | 354 | /* |
99 | * Callbacks for platform drivers to implement. | 355 | * The PM_EVENT_ messages are also used by drivers implementing the legacy |
356 | * suspend framework, based on the ->suspend() and ->resume() callbacks common | ||
357 | * for suspend and hibernation transitions, according to the rules below. | ||
100 | */ | 358 | */ |
101 | extern void (*pm_idle)(void); | ||
102 | extern void (*pm_power_off)(void); | ||
103 | extern void (*pm_power_off_prepare)(void); | ||
104 | 359 | ||
105 | /* | 360 | /* Necessary, because several drivers use PM_EVENT_PRETHAW */ |
106 | * Device power management | 361 | #define PM_EVENT_PRETHAW PM_EVENT_QUIESCE |
107 | */ | ||
108 | |||
109 | struct device; | ||
110 | |||
111 | typedef struct pm_message { | ||
112 | int event; | ||
113 | } pm_message_t; | ||
114 | 362 | ||
115 | /* | 363 | /* |
116 | * Several driver power state transitions are externally visible, affecting | ||
117 | * the state of pending I/O queues and (for drivers that touch hardware) | ||
118 | * interrupts, wakeups, DMA, and other hardware state. There may also be | ||
119 | * internal transitions to various low power modes, which are transparent | ||
120 | * to the rest of the driver stack (such as a driver that's ON gating off | ||
121 | * clocks which are not in active use). | ||
122 | * | ||
123 | * One transition is triggered by resume(), after a suspend() call; the | 364 | * One transition is triggered by resume(), after a suspend() call; the |
124 | * message is implicit: | 365 | * message is implicit: |
125 | * | 366 | * |
@@ -164,35 +405,13 @@ typedef struct pm_message { | |||
164 | * or from system low-power states such as standby or suspend-to-RAM. | 405 | * or from system low-power states such as standby or suspend-to-RAM. |
165 | */ | 406 | */ |
166 | 407 | ||
167 | #define PM_EVENT_ON 0 | 408 | #ifdef CONFIG_PM_SLEEP |
168 | #define PM_EVENT_FREEZE 1 | 409 | extern void device_pm_lock(void); |
169 | #define PM_EVENT_SUSPEND 2 | 410 | extern void device_power_up(pm_message_t state); |
170 | #define PM_EVENT_HIBERNATE 4 | 411 | extern void device_resume(pm_message_t state); |
171 | #define PM_EVENT_PRETHAW 8 | ||
172 | |||
173 | #define PM_EVENT_SLEEP (PM_EVENT_SUSPEND | PM_EVENT_HIBERNATE) | ||
174 | |||
175 | #define PMSG_FREEZE ((struct pm_message){ .event = PM_EVENT_FREEZE, }) | ||
176 | #define PMSG_PRETHAW ((struct pm_message){ .event = PM_EVENT_PRETHAW, }) | ||
177 | #define PMSG_SUSPEND ((struct pm_message){ .event = PM_EVENT_SUSPEND, }) | ||
178 | #define PMSG_HIBERNATE ((struct pm_message){ .event = PM_EVENT_HIBERNATE, }) | ||
179 | #define PMSG_ON ((struct pm_message){ .event = PM_EVENT_ON, }) | ||
180 | |||
181 | struct dev_pm_info { | ||
182 | pm_message_t power_state; | ||
183 | unsigned can_wakeup:1; | ||
184 | unsigned should_wakeup:1; | ||
185 | bool sleeping:1; /* Owned by the PM core */ | ||
186 | #ifdef CONFIG_PM_SLEEP | ||
187 | struct list_head entry; | ||
188 | #endif | ||
189 | }; | ||
190 | 412 | ||
413 | extern void device_pm_unlock(void); | ||
191 | extern int device_power_down(pm_message_t state); | 414 | extern int device_power_down(pm_message_t state); |
192 | extern void device_power_up(void); | ||
193 | extern void device_resume(void); | ||
194 | |||
195 | #ifdef CONFIG_PM_SLEEP | ||
196 | extern int device_suspend(pm_message_t state); | 415 | extern int device_suspend(pm_message_t state); |
197 | extern int device_prepare_suspend(pm_message_t state); | 416 | extern int device_prepare_suspend(pm_message_t state); |
198 | 417 | ||
diff --git a/include/linux/pm_legacy.h b/include/linux/pm_legacy.h deleted file mode 100644 index 446f4f42b952..000000000000 --- a/include/linux/pm_legacy.h +++ /dev/null | |||
@@ -1,35 +0,0 @@ | |||
1 | #ifndef __LINUX_PM_LEGACY_H__ | ||
2 | #define __LINUX_PM_LEGACY_H__ | ||
3 | |||
4 | |||
5 | #ifdef CONFIG_PM_LEGACY | ||
6 | |||
7 | /* | ||
8 | * Register a device with power management | ||
9 | */ | ||
10 | struct pm_dev __deprecated * | ||
11 | pm_register(pm_dev_t type, unsigned long id, pm_callback callback); | ||
12 | |||
13 | /* | ||
14 | * Send a request to all devices | ||
15 | */ | ||
16 | int __deprecated pm_send_all(pm_request_t rqst, void *data); | ||
17 | |||
18 | #else /* CONFIG_PM_LEGACY */ | ||
19 | |||
20 | static inline struct pm_dev *pm_register(pm_dev_t type, | ||
21 | unsigned long id, | ||
22 | pm_callback callback) | ||
23 | { | ||
24 | return NULL; | ||
25 | } | ||
26 | |||
27 | static inline int pm_send_all(pm_request_t rqst, void *data) | ||
28 | { | ||
29 | return 0; | ||
30 | } | ||
31 | |||
32 | #endif /* CONFIG_PM_LEGACY */ | ||
33 | |||
34 | #endif /* __LINUX_PM_LEGACY_H__ */ | ||
35 | |||
diff --git a/include/linux/pm_qos_params.h b/include/linux/pm_qos_params.h index 2e4e97bd19f7..d74f75ed1e47 100644 --- a/include/linux/pm_qos_params.h +++ b/include/linux/pm_qos_params.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* interface for the pm_qos_power infrastructure of the linux kernel. | 1 | /* interface for the pm_qos_power infrastructure of the linux kernel. |
2 | * | 2 | * |
3 | * Mark Gross | 3 | * Mark Gross <mgross@linux.intel.com> |
4 | */ | 4 | */ |
5 | #include <linux/list.h> | 5 | #include <linux/list.h> |
6 | #include <linux/notifier.h> | 6 | #include <linux/notifier.h> |
diff --git a/include/linux/pm_wakeup.h b/include/linux/pm_wakeup.h index f0d0b2cb8d20..0aae7776185e 100644 --- a/include/linux/pm_wakeup.h +++ b/include/linux/pm_wakeup.h | |||
@@ -35,6 +35,11 @@ static inline void device_init_wakeup(struct device *dev, int val) | |||
35 | dev->power.can_wakeup = dev->power.should_wakeup = !!val; | 35 | dev->power.can_wakeup = dev->power.should_wakeup = !!val; |
36 | } | 36 | } |
37 | 37 | ||
38 | static inline void device_set_wakeup_capable(struct device *dev, int val) | ||
39 | { | ||
40 | dev->power.can_wakeup = !!val; | ||
41 | } | ||
42 | |||
38 | static inline int device_can_wakeup(struct device *dev) | 43 | static inline int device_can_wakeup(struct device *dev) |
39 | { | 44 | { |
40 | return dev->power.can_wakeup; | 45 | return dev->power.can_wakeup; |
@@ -47,21 +52,7 @@ static inline void device_set_wakeup_enable(struct device *dev, int val) | |||
47 | 52 | ||
48 | static inline int device_may_wakeup(struct device *dev) | 53 | static inline int device_may_wakeup(struct device *dev) |
49 | { | 54 | { |
50 | return dev->power.can_wakeup & dev->power.should_wakeup; | 55 | return dev->power.can_wakeup && dev->power.should_wakeup; |
51 | } | ||
52 | |||
53 | /* | ||
54 | * Platform hook to activate device wakeup capability, if that's not already | ||
55 | * handled by enable_irq_wake() etc. | ||
56 | * Returns zero on success, else negative errno | ||
57 | */ | ||
58 | extern int (*platform_enable_wakeup)(struct device *dev, int is_on); | ||
59 | |||
60 | static inline int call_platform_enable_wakeup(struct device *dev, int is_on) | ||
61 | { | ||
62 | if (platform_enable_wakeup) | ||
63 | return (*platform_enable_wakeup)(dev, is_on); | ||
64 | return 0; | ||
65 | } | 56 | } |
66 | 57 | ||
67 | #else /* !CONFIG_PM */ | 58 | #else /* !CONFIG_PM */ |
@@ -72,6 +63,8 @@ static inline void device_init_wakeup(struct device *dev, int val) | |||
72 | dev->power.can_wakeup = !!val; | 63 | dev->power.can_wakeup = !!val; |
73 | } | 64 | } |
74 | 65 | ||
66 | static inline void device_set_wakeup_capable(struct device *dev, int val) { } | ||
67 | |||
75 | static inline int device_can_wakeup(struct device *dev) | 68 | static inline int device_can_wakeup(struct device *dev) |
76 | { | 69 | { |
77 | return dev->power.can_wakeup; | 70 | return dev->power.can_wakeup; |
@@ -80,11 +73,6 @@ static inline int device_can_wakeup(struct device *dev) | |||
80 | #define device_set_wakeup_enable(dev, val) do {} while (0) | 73 | #define device_set_wakeup_enable(dev, val) do {} while (0) |
81 | #define device_may_wakeup(dev) 0 | 74 | #define device_may_wakeup(dev) 0 |
82 | 75 | ||
83 | static inline int call_platform_enable_wakeup(struct device *dev, int is_on) | ||
84 | { | ||
85 | return 0; | ||
86 | } | ||
87 | |||
88 | #endif /* !CONFIG_PM */ | 76 | #endif /* !CONFIG_PM */ |
89 | 77 | ||
90 | #endif /* _LINUX_PM_WAKEUP_H */ | 78 | #endif /* _LINUX_PM_WAKEUP_H */ |
diff --git a/include/linux/pnp.h b/include/linux/pnp.h index 63b128d512fb..be764e514e35 100644 --- a/include/linux/pnp.h +++ b/include/linux/pnp.h | |||
@@ -1,6 +1,8 @@ | |||
1 | /* | 1 | /* |
2 | * Linux Plug and Play Support | 2 | * Linux Plug and Play Support |
3 | * Copyright by Adam Belay <ambx1@neo.rr.com> | 3 | * Copyright by Adam Belay <ambx1@neo.rr.com> |
4 | * Copyright (C) 2008 Hewlett-Packard Development Company, L.P. | ||
5 | * Bjorn Helgaas <bjorn.helgaas@hp.com> | ||
4 | */ | 6 | */ |
5 | 7 | ||
6 | #ifndef _LINUX_PNP_H | 8 | #ifndef _LINUX_PNP_H |
@@ -15,16 +17,29 @@ | |||
15 | 17 | ||
16 | struct pnp_protocol; | 18 | struct pnp_protocol; |
17 | struct pnp_dev; | 19 | struct pnp_dev; |
18 | struct pnp_resource_table; | ||
19 | 20 | ||
20 | /* | 21 | /* |
21 | * Resource Management | 22 | * Resource Management |
22 | */ | 23 | */ |
24 | #ifdef CONFIG_PNP | ||
23 | struct resource *pnp_get_resource(struct pnp_dev *, unsigned int, unsigned int); | 25 | struct resource *pnp_get_resource(struct pnp_dev *, unsigned int, unsigned int); |
26 | #else | ||
27 | static inline struct resource *pnp_get_resource(struct pnp_dev *dev, unsigned int type, unsigned int num) | ||
28 | { | ||
29 | return NULL; | ||
30 | } | ||
31 | #endif | ||
24 | 32 | ||
25 | static inline int pnp_resource_valid(struct resource *res) | 33 | static inline int pnp_resource_valid(struct resource *res) |
26 | { | 34 | { |
27 | if (res && !(res->flags & IORESOURCE_UNSET)) | 35 | if (res) |
36 | return 1; | ||
37 | return 0; | ||
38 | } | ||
39 | |||
40 | static inline int pnp_resource_enabled(struct resource *res) | ||
41 | { | ||
42 | if (res && !(res->flags & IORESOURCE_DISABLED)) | ||
28 | return 1; | 43 | return 1; |
29 | return 0; | 44 | return 0; |
30 | } | 45 | } |
@@ -40,19 +55,31 @@ static inline resource_size_t pnp_resource_len(struct resource *res) | |||
40 | static inline resource_size_t pnp_port_start(struct pnp_dev *dev, | 55 | static inline resource_size_t pnp_port_start(struct pnp_dev *dev, |
41 | unsigned int bar) | 56 | unsigned int bar) |
42 | { | 57 | { |
43 | return pnp_get_resource(dev, IORESOURCE_IO, bar)->start; | 58 | struct resource *res = pnp_get_resource(dev, IORESOURCE_IO, bar); |
59 | |||
60 | if (pnp_resource_valid(res)) | ||
61 | return res->start; | ||
62 | return 0; | ||
44 | } | 63 | } |
45 | 64 | ||
46 | static inline resource_size_t pnp_port_end(struct pnp_dev *dev, | 65 | static inline resource_size_t pnp_port_end(struct pnp_dev *dev, |
47 | unsigned int bar) | 66 | unsigned int bar) |
48 | { | 67 | { |
49 | return pnp_get_resource(dev, IORESOURCE_IO, bar)->end; | 68 | struct resource *res = pnp_get_resource(dev, IORESOURCE_IO, bar); |
69 | |||
70 | if (pnp_resource_valid(res)) | ||
71 | return res->end; | ||
72 | return 0; | ||
50 | } | 73 | } |
51 | 74 | ||
52 | static inline unsigned long pnp_port_flags(struct pnp_dev *dev, | 75 | static inline unsigned long pnp_port_flags(struct pnp_dev *dev, |
53 | unsigned int bar) | 76 | unsigned int bar) |
54 | { | 77 | { |
55 | return pnp_get_resource(dev, IORESOURCE_IO, bar)->flags; | 78 | struct resource *res = pnp_get_resource(dev, IORESOURCE_IO, bar); |
79 | |||
80 | if (pnp_resource_valid(res)) | ||
81 | return res->flags; | ||
82 | return IORESOURCE_IO | IORESOURCE_AUTO; | ||
56 | } | 83 | } |
57 | 84 | ||
58 | static inline int pnp_port_valid(struct pnp_dev *dev, unsigned int bar) | 85 | static inline int pnp_port_valid(struct pnp_dev *dev, unsigned int bar) |
@@ -63,25 +90,41 @@ static inline int pnp_port_valid(struct pnp_dev *dev, unsigned int bar) | |||
63 | static inline resource_size_t pnp_port_len(struct pnp_dev *dev, | 90 | static inline resource_size_t pnp_port_len(struct pnp_dev *dev, |
64 | unsigned int bar) | 91 | unsigned int bar) |
65 | { | 92 | { |
66 | return pnp_resource_len(pnp_get_resource(dev, IORESOURCE_IO, bar)); | 93 | struct resource *res = pnp_get_resource(dev, IORESOURCE_IO, bar); |
94 | |||
95 | if (pnp_resource_valid(res)) | ||
96 | return pnp_resource_len(res); | ||
97 | return 0; | ||
67 | } | 98 | } |
68 | 99 | ||
69 | 100 | ||
70 | static inline resource_size_t pnp_mem_start(struct pnp_dev *dev, | 101 | static inline resource_size_t pnp_mem_start(struct pnp_dev *dev, |
71 | unsigned int bar) | 102 | unsigned int bar) |
72 | { | 103 | { |
73 | return pnp_get_resource(dev, IORESOURCE_MEM, bar)->start; | 104 | struct resource *res = pnp_get_resource(dev, IORESOURCE_MEM, bar); |
105 | |||
106 | if (pnp_resource_valid(res)) | ||
107 | return res->start; | ||
108 | return 0; | ||
74 | } | 109 | } |
75 | 110 | ||
76 | static inline resource_size_t pnp_mem_end(struct pnp_dev *dev, | 111 | static inline resource_size_t pnp_mem_end(struct pnp_dev *dev, |
77 | unsigned int bar) | 112 | unsigned int bar) |
78 | { | 113 | { |
79 | return pnp_get_resource(dev, IORESOURCE_MEM, bar)->end; | 114 | struct resource *res = pnp_get_resource(dev, IORESOURCE_MEM, bar); |
115 | |||
116 | if (pnp_resource_valid(res)) | ||
117 | return res->end; | ||
118 | return 0; | ||
80 | } | 119 | } |
81 | 120 | ||
82 | static inline unsigned long pnp_mem_flags(struct pnp_dev *dev, unsigned int bar) | 121 | static inline unsigned long pnp_mem_flags(struct pnp_dev *dev, unsigned int bar) |
83 | { | 122 | { |
84 | return pnp_get_resource(dev, IORESOURCE_MEM, bar)->flags; | 123 | struct resource *res = pnp_get_resource(dev, IORESOURCE_MEM, bar); |
124 | |||
125 | if (pnp_resource_valid(res)) | ||
126 | return res->flags; | ||
127 | return IORESOURCE_MEM | IORESOURCE_AUTO; | ||
85 | } | 128 | } |
86 | 129 | ||
87 | static inline int pnp_mem_valid(struct pnp_dev *dev, unsigned int bar) | 130 | static inline int pnp_mem_valid(struct pnp_dev *dev, unsigned int bar) |
@@ -92,18 +135,30 @@ static inline int pnp_mem_valid(struct pnp_dev *dev, unsigned int bar) | |||
92 | static inline resource_size_t pnp_mem_len(struct pnp_dev *dev, | 135 | static inline resource_size_t pnp_mem_len(struct pnp_dev *dev, |
93 | unsigned int bar) | 136 | unsigned int bar) |
94 | { | 137 | { |
95 | return pnp_resource_len(pnp_get_resource(dev, IORESOURCE_MEM, bar)); | 138 | struct resource *res = pnp_get_resource(dev, IORESOURCE_MEM, bar); |
139 | |||
140 | if (pnp_resource_valid(res)) | ||
141 | return pnp_resource_len(res); | ||
142 | return 0; | ||
96 | } | 143 | } |
97 | 144 | ||
98 | 145 | ||
99 | static inline resource_size_t pnp_irq(struct pnp_dev *dev, unsigned int bar) | 146 | static inline resource_size_t pnp_irq(struct pnp_dev *dev, unsigned int bar) |
100 | { | 147 | { |
101 | return pnp_get_resource(dev, IORESOURCE_IRQ, bar)->start; | 148 | struct resource *res = pnp_get_resource(dev, IORESOURCE_IRQ, bar); |
149 | |||
150 | if (pnp_resource_valid(res)) | ||
151 | return res->start; | ||
152 | return -1; | ||
102 | } | 153 | } |
103 | 154 | ||
104 | static inline unsigned long pnp_irq_flags(struct pnp_dev *dev, unsigned int bar) | 155 | static inline unsigned long pnp_irq_flags(struct pnp_dev *dev, unsigned int bar) |
105 | { | 156 | { |
106 | return pnp_get_resource(dev, IORESOURCE_IRQ, bar)->flags; | 157 | struct resource *res = pnp_get_resource(dev, IORESOURCE_IRQ, bar); |
158 | |||
159 | if (pnp_resource_valid(res)) | ||
160 | return res->flags; | ||
161 | return IORESOURCE_IRQ | IORESOURCE_AUTO; | ||
107 | } | 162 | } |
108 | 163 | ||
109 | static inline int pnp_irq_valid(struct pnp_dev *dev, unsigned int bar) | 164 | static inline int pnp_irq_valid(struct pnp_dev *dev, unsigned int bar) |
@@ -114,12 +169,20 @@ static inline int pnp_irq_valid(struct pnp_dev *dev, unsigned int bar) | |||
114 | 169 | ||
115 | static inline resource_size_t pnp_dma(struct pnp_dev *dev, unsigned int bar) | 170 | static inline resource_size_t pnp_dma(struct pnp_dev *dev, unsigned int bar) |
116 | { | 171 | { |
117 | return pnp_get_resource(dev, IORESOURCE_DMA, bar)->start; | 172 | struct resource *res = pnp_get_resource(dev, IORESOURCE_DMA, bar); |
173 | |||
174 | if (pnp_resource_valid(res)) | ||
175 | return res->start; | ||
176 | return -1; | ||
118 | } | 177 | } |
119 | 178 | ||
120 | static inline unsigned long pnp_dma_flags(struct pnp_dev *dev, unsigned int bar) | 179 | static inline unsigned long pnp_dma_flags(struct pnp_dev *dev, unsigned int bar) |
121 | { | 180 | { |
122 | return pnp_get_resource(dev, IORESOURCE_DMA, bar)->flags; | 181 | struct resource *res = pnp_get_resource(dev, IORESOURCE_DMA, bar); |
182 | |||
183 | if (pnp_resource_valid(res)) | ||
184 | return res->flags; | ||
185 | return IORESOURCE_DMA | IORESOURCE_AUTO; | ||
123 | } | 186 | } |
124 | 187 | ||
125 | static inline int pnp_dma_valid(struct pnp_dev *dev, unsigned int bar) | 188 | static inline int pnp_dma_valid(struct pnp_dev *dev, unsigned int bar) |
@@ -128,57 +191,6 @@ static inline int pnp_dma_valid(struct pnp_dev *dev, unsigned int bar) | |||
128 | } | 191 | } |
129 | 192 | ||
130 | 193 | ||
131 | #define PNP_PORT_FLAG_16BITADDR (1<<0) | ||
132 | #define PNP_PORT_FLAG_FIXED (1<<1) | ||
133 | |||
134 | struct pnp_port { | ||
135 | unsigned short min; /* min base number */ | ||
136 | unsigned short max; /* max base number */ | ||
137 | unsigned char align; /* align boundary */ | ||
138 | unsigned char size; /* size of range */ | ||
139 | unsigned char flags; /* port flags */ | ||
140 | unsigned char pad; /* pad */ | ||
141 | struct pnp_port *next; /* next port */ | ||
142 | }; | ||
143 | |||
144 | #define PNP_IRQ_NR 256 | ||
145 | struct pnp_irq { | ||
146 | DECLARE_BITMAP(map, PNP_IRQ_NR); /* bitmask for IRQ lines */ | ||
147 | unsigned char flags; /* IRQ flags */ | ||
148 | unsigned char pad; /* pad */ | ||
149 | struct pnp_irq *next; /* next IRQ */ | ||
150 | }; | ||
151 | |||
152 | struct pnp_dma { | ||
153 | unsigned char map; /* bitmask for DMA channels */ | ||
154 | unsigned char flags; /* DMA flags */ | ||
155 | struct pnp_dma *next; /* next port */ | ||
156 | }; | ||
157 | |||
158 | struct pnp_mem { | ||
159 | unsigned int min; /* min base number */ | ||
160 | unsigned int max; /* max base number */ | ||
161 | unsigned int align; /* align boundary */ | ||
162 | unsigned int size; /* size of range */ | ||
163 | unsigned char flags; /* memory flags */ | ||
164 | unsigned char pad; /* pad */ | ||
165 | struct pnp_mem *next; /* next memory resource */ | ||
166 | }; | ||
167 | |||
168 | #define PNP_RES_PRIORITY_PREFERRED 0 | ||
169 | #define PNP_RES_PRIORITY_ACCEPTABLE 1 | ||
170 | #define PNP_RES_PRIORITY_FUNCTIONAL 2 | ||
171 | #define PNP_RES_PRIORITY_INVALID 65535 | ||
172 | |||
173 | struct pnp_option { | ||
174 | unsigned short priority; /* priority */ | ||
175 | struct pnp_port *port; /* first port */ | ||
176 | struct pnp_irq *irq; /* first IRQ */ | ||
177 | struct pnp_dma *dma; /* first DMA */ | ||
178 | struct pnp_mem *mem; /* first memory resource */ | ||
179 | struct pnp_option *next; /* used to chain dependent resources */ | ||
180 | }; | ||
181 | |||
182 | /* | 194 | /* |
183 | * Device Management | 195 | * Device Management |
184 | */ | 196 | */ |
@@ -246,9 +258,9 @@ struct pnp_dev { | |||
246 | 258 | ||
247 | int active; | 259 | int active; |
248 | int capabilities; | 260 | int capabilities; |
249 | struct pnp_option *independent; | 261 | unsigned int num_dependent_sets; |
250 | struct pnp_option *dependent; | 262 | struct list_head resources; |
251 | struct pnp_resource_table *res; | 263 | struct list_head options; |
252 | 264 | ||
253 | char name[PNP_NAME_LEN]; /* contains a human-readable name */ | 265 | char name[PNP_NAME_LEN]; /* contains a human-readable name */ |
254 | int flags; /* used by protocols */ | 266 | int flags; /* used by protocols */ |
@@ -425,6 +437,8 @@ void pnp_unregister_card_driver(struct pnp_card_driver *drv); | |||
425 | extern struct list_head pnp_cards; | 437 | extern struct list_head pnp_cards; |
426 | 438 | ||
427 | /* resource management */ | 439 | /* resource management */ |
440 | int pnp_possible_config(struct pnp_dev *dev, int type, resource_size_t base, | ||
441 | resource_size_t size); | ||
428 | int pnp_auto_config_dev(struct pnp_dev *dev); | 442 | int pnp_auto_config_dev(struct pnp_dev *dev); |
429 | int pnp_start_dev(struct pnp_dev *dev); | 443 | int pnp_start_dev(struct pnp_dev *dev); |
430 | int pnp_stop_dev(struct pnp_dev *dev); | 444 | int pnp_stop_dev(struct pnp_dev *dev); |
@@ -452,6 +466,9 @@ static inline int pnp_register_card_driver(struct pnp_card_driver *drv) { return | |||
452 | static inline void pnp_unregister_card_driver(struct pnp_card_driver *drv) { } | 466 | static inline void pnp_unregister_card_driver(struct pnp_card_driver *drv) { } |
453 | 467 | ||
454 | /* resource management */ | 468 | /* resource management */ |
469 | static inline int pnp_possible_config(struct pnp_dev *dev, int type, | ||
470 | resource_size_t base, | ||
471 | resource_size_t size) { return 0; } | ||
455 | static inline int pnp_auto_config_dev(struct pnp_dev *dev) { return -ENODEV; } | 472 | static inline int pnp_auto_config_dev(struct pnp_dev *dev) { return -ENODEV; } |
456 | static inline int pnp_start_dev(struct pnp_dev *dev) { return -ENODEV; } | 473 | static inline int pnp_start_dev(struct pnp_dev *dev) { return -ENODEV; } |
457 | static inline int pnp_stop_dev(struct pnp_dev *dev) { return -ENODEV; } | 474 | static inline int pnp_stop_dev(struct pnp_dev *dev) { return -ENODEV; } |
diff --git a/include/linux/power_supply.h b/include/linux/power_supply.h index 68ed19ccf1f7..ea96ead1d39d 100644 --- a/include/linux/power_supply.h +++ b/include/linux/power_supply.h | |||
@@ -78,6 +78,7 @@ enum power_supply_property { | |||
78 | POWER_SUPPLY_PROP_CHARGE_EMPTY, | 78 | POWER_SUPPLY_PROP_CHARGE_EMPTY, |
79 | POWER_SUPPLY_PROP_CHARGE_NOW, | 79 | POWER_SUPPLY_PROP_CHARGE_NOW, |
80 | POWER_SUPPLY_PROP_CHARGE_AVG, | 80 | POWER_SUPPLY_PROP_CHARGE_AVG, |
81 | POWER_SUPPLY_PROP_CHARGE_COUNTER, | ||
81 | POWER_SUPPLY_PROP_ENERGY_FULL_DESIGN, | 82 | POWER_SUPPLY_PROP_ENERGY_FULL_DESIGN, |
82 | POWER_SUPPLY_PROP_ENERGY_EMPTY_DESIGN, | 83 | POWER_SUPPLY_PROP_ENERGY_EMPTY_DESIGN, |
83 | POWER_SUPPLY_PROP_ENERGY_FULL, | 84 | POWER_SUPPLY_PROP_ENERGY_FULL, |
diff --git a/include/linux/ppp-comp.h b/include/linux/ppp-comp.h index e86a7a5cf355..b8d4ddd22736 100644 --- a/include/linux/ppp-comp.h +++ b/include/linux/ppp-comp.h | |||
@@ -23,8 +23,6 @@ | |||
23 | * ON AN "AS IS" BASIS, AND THE AUSTRALIAN NATIONAL UNIVERSITY HAS NO | 23 | * ON AN "AS IS" BASIS, AND THE AUSTRALIAN NATIONAL UNIVERSITY HAS NO |
24 | * OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, | 24 | * OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, |
25 | * OR MODIFICATIONS. | 25 | * OR MODIFICATIONS. |
26 | * | ||
27 | * $Id: ppp-comp.h,v 1.6 1997/11/27 06:04:44 paulus Exp $ | ||
28 | */ | 26 | */ |
29 | 27 | ||
30 | /* | 28 | /* |
diff --git a/include/linux/ppp_defs.h b/include/linux/ppp_defs.h index c6b13ff85028..6e8adc77522c 100644 --- a/include/linux/ppp_defs.h +++ b/include/linux/ppp_defs.h | |||
@@ -1,5 +1,3 @@ | |||
1 | /* $Id: ppp_defs.h,v 1.2 1994/09/21 01:31:06 paulus Exp $ */ | ||
2 | |||
3 | /* | 1 | /* |
4 | * ppp_defs.h - PPP definitions. | 2 | * ppp_defs.h - PPP definitions. |
5 | * | 3 | * |
diff --git a/include/linux/preempt.h b/include/linux/preempt.h index 23f0c54175cd..72b1a10a59b6 100644 --- a/include/linux/preempt.h +++ b/include/linux/preempt.h | |||
@@ -10,7 +10,7 @@ | |||
10 | #include <linux/linkage.h> | 10 | #include <linux/linkage.h> |
11 | #include <linux/list.h> | 11 | #include <linux/list.h> |
12 | 12 | ||
13 | #ifdef CONFIG_DEBUG_PREEMPT | 13 | #if defined(CONFIG_DEBUG_PREEMPT) || defined(CONFIG_PREEMPT_TRACER) |
14 | extern void add_preempt_count(int val); | 14 | extern void add_preempt_count(int val); |
15 | extern void sub_preempt_count(int val); | 15 | extern void sub_preempt_count(int val); |
16 | #else | 16 | #else |
@@ -52,6 +52,34 @@ do { \ | |||
52 | preempt_check_resched(); \ | 52 | preempt_check_resched(); \ |
53 | } while (0) | 53 | } while (0) |
54 | 54 | ||
55 | /* For debugging and tracer internals only! */ | ||
56 | #define add_preempt_count_notrace(val) \ | ||
57 | do { preempt_count() += (val); } while (0) | ||
58 | #define sub_preempt_count_notrace(val) \ | ||
59 | do { preempt_count() -= (val); } while (0) | ||
60 | #define inc_preempt_count_notrace() add_preempt_count_notrace(1) | ||
61 | #define dec_preempt_count_notrace() sub_preempt_count_notrace(1) | ||
62 | |||
63 | #define preempt_disable_notrace() \ | ||
64 | do { \ | ||
65 | inc_preempt_count_notrace(); \ | ||
66 | barrier(); \ | ||
67 | } while (0) | ||
68 | |||
69 | #define preempt_enable_no_resched_notrace() \ | ||
70 | do { \ | ||
71 | barrier(); \ | ||
72 | dec_preempt_count_notrace(); \ | ||
73 | } while (0) | ||
74 | |||
75 | /* preempt_check_resched is OK to trace */ | ||
76 | #define preempt_enable_notrace() \ | ||
77 | do { \ | ||
78 | preempt_enable_no_resched_notrace(); \ | ||
79 | barrier(); \ | ||
80 | preempt_check_resched(); \ | ||
81 | } while (0) | ||
82 | |||
55 | #else | 83 | #else |
56 | 84 | ||
57 | #define preempt_disable() do { } while (0) | 85 | #define preempt_disable() do { } while (0) |
@@ -59,6 +87,10 @@ do { \ | |||
59 | #define preempt_enable() do { } while (0) | 87 | #define preempt_enable() do { } while (0) |
60 | #define preempt_check_resched() do { } while (0) | 88 | #define preempt_check_resched() do { } while (0) |
61 | 89 | ||
90 | #define preempt_disable_notrace() do { } while (0) | ||
91 | #define preempt_enable_no_resched_notrace() do { } while (0) | ||
92 | #define preempt_enable_notrace() do { } while (0) | ||
93 | |||
62 | #endif | 94 | #endif |
63 | 95 | ||
64 | #ifdef CONFIG_PREEMPT_NOTIFIERS | 96 | #ifdef CONFIG_PREEMPT_NOTIFIERS |
diff --git a/include/linux/proc_fs.h b/include/linux/proc_fs.h index fff1d27ddb4c..fb61850d1cfc 100644 --- a/include/linux/proc_fs.h +++ b/include/linux/proc_fs.h | |||
@@ -79,6 +79,7 @@ struct proc_dir_entry { | |||
79 | int pde_users; /* number of callers into module in progress */ | 79 | int pde_users; /* number of callers into module in progress */ |
80 | spinlock_t pde_unload_lock; /* proc_fops checks and pde_users bumps */ | 80 | spinlock_t pde_unload_lock; /* proc_fops checks and pde_users bumps */ |
81 | struct completion *pde_unload_completion; | 81 | struct completion *pde_unload_completion; |
82 | struct list_head pde_openers; /* who did ->open, but not ->release */ | ||
82 | }; | 83 | }; |
83 | 84 | ||
84 | struct kcore_list { | 85 | struct kcore_list { |
@@ -138,7 +139,6 @@ extern int proc_readdir(struct file *, void *, filldir_t); | |||
138 | extern struct dentry *proc_lookup(struct inode *, struct dentry *, struct nameidata *); | 139 | extern struct dentry *proc_lookup(struct inode *, struct dentry *, struct nameidata *); |
139 | 140 | ||
140 | extern const struct file_operations proc_kcore_operations; | 141 | extern const struct file_operations proc_kcore_operations; |
141 | extern const struct file_operations proc_kmsg_operations; | ||
142 | extern const struct file_operations ppc_htab_operations; | 142 | extern const struct file_operations ppc_htab_operations; |
143 | 143 | ||
144 | extern int pid_ns_prepare_proc(struct pid_namespace *ns); | 144 | extern int pid_ns_prepare_proc(struct pid_namespace *ns); |
@@ -282,11 +282,16 @@ union proc_op { | |||
282 | struct task_struct *task); | 282 | struct task_struct *task); |
283 | }; | 283 | }; |
284 | 284 | ||
285 | struct ctl_table_header; | ||
286 | struct ctl_table; | ||
287 | |||
285 | struct proc_inode { | 288 | struct proc_inode { |
286 | struct pid *pid; | 289 | struct pid *pid; |
287 | int fd; | 290 | int fd; |
288 | union proc_op op; | 291 | union proc_op op; |
289 | struct proc_dir_entry *pde; | 292 | struct proc_dir_entry *pde; |
293 | struct ctl_table_header *sysctl; | ||
294 | struct ctl_table *sysctl_entry; | ||
290 | struct inode vfs_inode; | 295 | struct inode vfs_inode; |
291 | }; | 296 | }; |
292 | 297 | ||
@@ -305,8 +310,6 @@ static inline struct net *PDE_NET(struct proc_dir_entry *pde) | |||
305 | return pde->parent->data; | 310 | return pde->parent->data; |
306 | } | 311 | } |
307 | 312 | ||
308 | struct net *get_proc_net(const struct inode *inode); | ||
309 | |||
310 | struct proc_maps_private { | 313 | struct proc_maps_private { |
311 | struct pid *pid; | 314 | struct pid *pid; |
312 | struct task_struct *task; | 315 | struct task_struct *task; |
diff --git a/include/linux/profile.h b/include/linux/profile.h index 05c1cc736937..7e7087239af5 100644 --- a/include/linux/profile.h +++ b/include/linux/profile.h | |||
@@ -8,8 +8,6 @@ | |||
8 | 8 | ||
9 | #include <asm/errno.h> | 9 | #include <asm/errno.h> |
10 | 10 | ||
11 | extern int prof_on __read_mostly; | ||
12 | |||
13 | #define CPU_PROFILING 1 | 11 | #define CPU_PROFILING 1 |
14 | #define SCHED_PROFILING 2 | 12 | #define SCHED_PROFILING 2 |
15 | #define SLEEP_PROFILING 3 | 13 | #define SLEEP_PROFILING 3 |
@@ -19,14 +17,31 @@ struct proc_dir_entry; | |||
19 | struct pt_regs; | 17 | struct pt_regs; |
20 | struct notifier_block; | 18 | struct notifier_block; |
21 | 19 | ||
20 | #if defined(CONFIG_PROFILING) && defined(CONFIG_PROC_FS) | ||
21 | void create_prof_cpu_mask(struct proc_dir_entry *de); | ||
22 | #else | ||
23 | static inline void create_prof_cpu_mask(struct proc_dir_entry *de) | ||
24 | { | ||
25 | } | ||
26 | #endif | ||
27 | |||
28 | enum profile_type { | ||
29 | PROFILE_TASK_EXIT, | ||
30 | PROFILE_MUNMAP | ||
31 | }; | ||
32 | |||
33 | #ifdef CONFIG_PROFILING | ||
34 | |||
35 | extern int prof_on __read_mostly; | ||
36 | |||
22 | /* init basic kernel profiler */ | 37 | /* init basic kernel profiler */ |
23 | void __init profile_init(void); | 38 | void __init profile_init(void); |
24 | void profile_tick(int); | 39 | void profile_tick(int type); |
25 | 40 | ||
26 | /* | 41 | /* |
27 | * Add multiple profiler hits to a given address: | 42 | * Add multiple profiler hits to a given address: |
28 | */ | 43 | */ |
29 | void profile_hits(int, void *ip, unsigned int nr_hits); | 44 | void profile_hits(int type, void *ip, unsigned int nr_hits); |
30 | 45 | ||
31 | /* | 46 | /* |
32 | * Single profiler hit: | 47 | * Single profiler hit: |
@@ -40,19 +55,6 @@ static inline void profile_hit(int type, void *ip) | |||
40 | profile_hits(type, ip, 1); | 55 | profile_hits(type, ip, 1); |
41 | } | 56 | } |
42 | 57 | ||
43 | #ifdef CONFIG_PROC_FS | ||
44 | void create_prof_cpu_mask(struct proc_dir_entry *); | ||
45 | #else | ||
46 | #define create_prof_cpu_mask(x) do { (void)(x); } while (0) | ||
47 | #endif | ||
48 | |||
49 | enum profile_type { | ||
50 | PROFILE_TASK_EXIT, | ||
51 | PROFILE_MUNMAP | ||
52 | }; | ||
53 | |||
54 | #ifdef CONFIG_PROFILING | ||
55 | |||
56 | struct task_struct; | 58 | struct task_struct; |
57 | struct mm_struct; | 59 | struct mm_struct; |
58 | 60 | ||
@@ -80,6 +82,28 @@ struct pt_regs; | |||
80 | 82 | ||
81 | #else | 83 | #else |
82 | 84 | ||
85 | #define prof_on 0 | ||
86 | |||
87 | static inline void profile_init(void) | ||
88 | { | ||
89 | return; | ||
90 | } | ||
91 | |||
92 | static inline void profile_tick(int type) | ||
93 | { | ||
94 | return; | ||
95 | } | ||
96 | |||
97 | static inline void profile_hits(int type, void *ip, unsigned int nr_hits) | ||
98 | { | ||
99 | return; | ||
100 | } | ||
101 | |||
102 | static inline void profile_hit(int type, void *ip) | ||
103 | { | ||
104 | return; | ||
105 | } | ||
106 | |||
83 | static inline int task_handoff_register(struct notifier_block * n) | 107 | static inline int task_handoff_register(struct notifier_block * n) |
84 | { | 108 | { |
85 | return -ENOSYS; | 109 | return -ENOSYS; |
diff --git a/include/linux/proportions.h b/include/linux/proportions.h index 5afc1b23346d..cf793bbbd05e 100644 --- a/include/linux/proportions.h +++ b/include/linux/proportions.h | |||
@@ -104,8 +104,8 @@ struct prop_local_single { | |||
104 | * snapshot of the last seen global state | 104 | * snapshot of the last seen global state |
105 | * and a lock protecting this state | 105 | * and a lock protecting this state |
106 | */ | 106 | */ |
107 | int shift; | ||
108 | unsigned long period; | 107 | unsigned long period; |
108 | int shift; | ||
109 | spinlock_t lock; /* protect the snapshot state */ | 109 | spinlock_t lock; /* protect the snapshot state */ |
110 | }; | 110 | }; |
111 | 111 | ||
diff --git a/include/linux/ptrace.h b/include/linux/ptrace.h index f98501ba557e..ea7416c901d1 100644 --- a/include/linux/ptrace.h +++ b/include/linux/ptrace.h | |||
@@ -95,8 +95,12 @@ extern void __ptrace_link(struct task_struct *child, | |||
95 | struct task_struct *new_parent); | 95 | struct task_struct *new_parent); |
96 | extern void __ptrace_unlink(struct task_struct *child); | 96 | extern void __ptrace_unlink(struct task_struct *child); |
97 | extern void ptrace_untrace(struct task_struct *child); | 97 | extern void ptrace_untrace(struct task_struct *child); |
98 | extern int ptrace_may_attach(struct task_struct *task); | 98 | #define PTRACE_MODE_READ 1 |
99 | extern int __ptrace_may_attach(struct task_struct *task); | 99 | #define PTRACE_MODE_ATTACH 2 |
100 | /* Returns 0 on success, -errno on denial. */ | ||
101 | extern int __ptrace_may_access(struct task_struct *task, unsigned int mode); | ||
102 | /* Returns true on success, false on denial. */ | ||
103 | extern bool ptrace_may_access(struct task_struct *task, unsigned int mode); | ||
100 | 104 | ||
101 | static inline int ptrace_reparented(struct task_struct *child) | 105 | static inline int ptrace_reparented(struct task_struct *child) |
102 | { | 106 | { |
@@ -117,6 +121,74 @@ static inline void ptrace_unlink(struct task_struct *child) | |||
117 | int generic_ptrace_peekdata(struct task_struct *tsk, long addr, long data); | 121 | int generic_ptrace_peekdata(struct task_struct *tsk, long addr, long data); |
118 | int generic_ptrace_pokedata(struct task_struct *tsk, long addr, long data); | 122 | int generic_ptrace_pokedata(struct task_struct *tsk, long addr, long data); |
119 | 123 | ||
124 | /** | ||
125 | * task_ptrace - return %PT_* flags that apply to a task | ||
126 | * @task: pointer to &task_struct in question | ||
127 | * | ||
128 | * Returns the %PT_* flags that apply to @task. | ||
129 | */ | ||
130 | static inline int task_ptrace(struct task_struct *task) | ||
131 | { | ||
132 | return task->ptrace; | ||
133 | } | ||
134 | |||
135 | /** | ||
136 | * ptrace_event - possibly stop for a ptrace event notification | ||
137 | * @mask: %PT_* bit to check in @current->ptrace | ||
138 | * @event: %PTRACE_EVENT_* value to report if @mask is set | ||
139 | * @message: value for %PTRACE_GETEVENTMSG to return | ||
140 | * | ||
141 | * This checks the @mask bit to see if ptrace wants stops for this event. | ||
142 | * If so we stop, reporting @event and @message to the ptrace parent. | ||
143 | * | ||
144 | * Returns nonzero if we did a ptrace notification, zero if not. | ||
145 | * | ||
146 | * Called without locks. | ||
147 | */ | ||
148 | static inline int ptrace_event(int mask, int event, unsigned long message) | ||
149 | { | ||
150 | if (mask && likely(!(current->ptrace & mask))) | ||
151 | return 0; | ||
152 | current->ptrace_message = message; | ||
153 | ptrace_notify((event << 8) | SIGTRAP); | ||
154 | return 1; | ||
155 | } | ||
156 | |||
157 | /** | ||
158 | * ptrace_init_task - initialize ptrace state for a new child | ||
159 | * @child: new child task | ||
160 | * @ptrace: true if child should be ptrace'd by parent's tracer | ||
161 | * | ||
162 | * This is called immediately after adding @child to its parent's children | ||
163 | * list. @ptrace is false in the normal case, and true to ptrace @child. | ||
164 | * | ||
165 | * Called with current's siglock and write_lock_irq(&tasklist_lock) held. | ||
166 | */ | ||
167 | static inline void ptrace_init_task(struct task_struct *child, bool ptrace) | ||
168 | { | ||
169 | INIT_LIST_HEAD(&child->ptrace_entry); | ||
170 | INIT_LIST_HEAD(&child->ptraced); | ||
171 | child->parent = child->real_parent; | ||
172 | child->ptrace = 0; | ||
173 | if (unlikely(ptrace)) { | ||
174 | child->ptrace = current->ptrace; | ||
175 | ptrace_link(child, current->parent); | ||
176 | } | ||
177 | } | ||
178 | |||
179 | /** | ||
180 | * ptrace_release_task - final ptrace-related cleanup of a zombie being reaped | ||
181 | * @task: task in %EXIT_DEAD state | ||
182 | * | ||
183 | * Called with write_lock(&tasklist_lock) held. | ||
184 | */ | ||
185 | static inline void ptrace_release_task(struct task_struct *task) | ||
186 | { | ||
187 | BUG_ON(!list_empty(&task->ptraced)); | ||
188 | ptrace_unlink(task); | ||
189 | BUG_ON(!list_empty(&task->ptrace_entry)); | ||
190 | } | ||
191 | |||
120 | #ifndef force_successful_syscall_return | 192 | #ifndef force_successful_syscall_return |
121 | /* | 193 | /* |
122 | * System call handlers that, upon successful completion, need to return a | 194 | * System call handlers that, upon successful completion, need to return a |
@@ -242,6 +314,10 @@ static inline void user_enable_block_step(struct task_struct *task) | |||
242 | #define arch_ptrace_stop(code, info) do { } while (0) | 314 | #define arch_ptrace_stop(code, info) do { } while (0) |
243 | #endif | 315 | #endif |
244 | 316 | ||
317 | extern int task_current_syscall(struct task_struct *target, long *callno, | ||
318 | unsigned long args[6], unsigned int maxargs, | ||
319 | unsigned long *sp, unsigned long *pc); | ||
320 | |||
245 | #endif | 321 | #endif |
246 | 322 | ||
247 | #endif | 323 | #endif |
diff --git a/include/linux/pwm.h b/include/linux/pwm.h new file mode 100644 index 000000000000..3945f803d514 --- /dev/null +++ b/include/linux/pwm.h | |||
@@ -0,0 +1,31 @@ | |||
1 | #ifndef __LINUX_PWM_H | ||
2 | #define __LINUX_PWM_H | ||
3 | |||
4 | struct pwm_device; | ||
5 | |||
6 | /* | ||
7 | * pwm_request - request a PWM device | ||
8 | */ | ||
9 | struct pwm_device *pwm_request(int pwm_id, const char *label); | ||
10 | |||
11 | /* | ||
12 | * pwm_free - free a PWM device | ||
13 | */ | ||
14 | void pwm_free(struct pwm_device *pwm); | ||
15 | |||
16 | /* | ||
17 | * pwm_config - change a PWM device configuration | ||
18 | */ | ||
19 | int pwm_config(struct pwm_device *pwm, int duty_ns, int period_ns); | ||
20 | |||
21 | /* | ||
22 | * pwm_enable - start a PWM output toggling | ||
23 | */ | ||
24 | int pwm_enable(struct pwm_device *pwm); | ||
25 | |||
26 | /* | ||
27 | * pwm_disable - stop a PWM output toggling | ||
28 | */ | ||
29 | void pwm_disable(struct pwm_device *pwm); | ||
30 | |||
31 | #endif /* __ASM_ARCH_PWM_H */ | ||
diff --git a/include/linux/pwm_backlight.h b/include/linux/pwm_backlight.h new file mode 100644 index 000000000000..7a9754c96775 --- /dev/null +++ b/include/linux/pwm_backlight.h | |||
@@ -0,0 +1,17 @@ | |||
1 | /* | ||
2 | * Generic PWM backlight driver data - see drivers/video/backlight/pwm_bl.c | ||
3 | */ | ||
4 | #ifndef __LINUX_PWM_BACKLIGHT_H | ||
5 | #define __LINUX_PWM_BACKLIGHT_H | ||
6 | |||
7 | struct platform_pwm_backlight_data { | ||
8 | int pwm_id; | ||
9 | unsigned int max_brightness; | ||
10 | unsigned int dft_brightness; | ||
11 | unsigned int pwm_period_ns; | ||
12 | int (*init)(struct device *dev); | ||
13 | int (*notify)(int brightness); | ||
14 | void (*exit)(struct device *dev); | ||
15 | }; | ||
16 | |||
17 | #endif | ||
diff --git a/include/linux/quicklist.h b/include/linux/quicklist.h index 39b66713a0bb..bd466439c588 100644 --- a/include/linux/quicklist.h +++ b/include/linux/quicklist.h | |||
@@ -80,6 +80,13 @@ void quicklist_trim(int nr, void (*dtor)(void *), | |||
80 | 80 | ||
81 | unsigned long quicklist_total_size(void); | 81 | unsigned long quicklist_total_size(void); |
82 | 82 | ||
83 | #else | ||
84 | |||
85 | static inline unsigned long quicklist_total_size(void) | ||
86 | { | ||
87 | return 0; | ||
88 | } | ||
89 | |||
83 | #endif | 90 | #endif |
84 | 91 | ||
85 | #endif /* LINUX_QUICKLIST_H */ | 92 | #endif /* LINUX_QUICKLIST_H */ |
diff --git a/include/linux/quota.h b/include/linux/quota.h index dcddfb200947..376a05048bc5 100644 --- a/include/linux/quota.h +++ b/include/linux/quota.h | |||
@@ -41,9 +41,6 @@ | |||
41 | #define __DQUOT_VERSION__ "dquot_6.5.1" | 41 | #define __DQUOT_VERSION__ "dquot_6.5.1" |
42 | #define __DQUOT_NUM_VERSION__ 6*10000+5*100+1 | 42 | #define __DQUOT_NUM_VERSION__ 6*10000+5*100+1 |
43 | 43 | ||
44 | typedef __kernel_uid32_t qid_t; /* Type in which we store ids in memory */ | ||
45 | typedef __u64 qsize_t; /* Type in which we store sizes */ | ||
46 | |||
47 | /* Size of blocks in which are counted size limits */ | 44 | /* Size of blocks in which are counted size limits */ |
48 | #define QUOTABLOCK_BITS 10 | 45 | #define QUOTABLOCK_BITS 10 |
49 | #define QUOTABLOCK_SIZE (1 << QUOTABLOCK_BITS) | 46 | #define QUOTABLOCK_SIZE (1 << QUOTABLOCK_BITS) |
@@ -138,6 +135,10 @@ struct if_dqinfo { | |||
138 | #define QUOTA_NL_BHARDWARN 4 /* Block hardlimit reached */ | 135 | #define QUOTA_NL_BHARDWARN 4 /* Block hardlimit reached */ |
139 | #define QUOTA_NL_BSOFTLONGWARN 5 /* Block grace time expired */ | 136 | #define QUOTA_NL_BSOFTLONGWARN 5 /* Block grace time expired */ |
140 | #define QUOTA_NL_BSOFTWARN 6 /* Block softlimit reached */ | 137 | #define QUOTA_NL_BSOFTWARN 6 /* Block softlimit reached */ |
138 | #define QUOTA_NL_IHARDBELOW 7 /* Usage got below inode hardlimit */ | ||
139 | #define QUOTA_NL_ISOFTBELOW 8 /* Usage got below inode softlimit */ | ||
140 | #define QUOTA_NL_BHARDBELOW 9 /* Usage got below block hardlimit */ | ||
141 | #define QUOTA_NL_BSOFTBELOW 10 /* Usage got below block softlimit */ | ||
141 | 142 | ||
142 | enum { | 143 | enum { |
143 | QUOTA_NL_C_UNSPEC, | 144 | QUOTA_NL_C_UNSPEC, |
@@ -172,6 +173,9 @@ enum { | |||
172 | 173 | ||
173 | #include <asm/atomic.h> | 174 | #include <asm/atomic.h> |
174 | 175 | ||
176 | typedef __kernel_uid32_t qid_t; /* Type in which we store ids in memory */ | ||
177 | typedef __u64 qsize_t; /* Type in which we store sizes */ | ||
178 | |||
175 | extern spinlock_t dq_data_lock; | 179 | extern spinlock_t dq_data_lock; |
176 | 180 | ||
177 | /* Maximal numbers of writes for quota operation (insert/delete/update) | 181 | /* Maximal numbers of writes for quota operation (insert/delete/update) |
@@ -223,12 +227,10 @@ struct super_block; | |||
223 | #define DQF_INFO_DIRTY (1 << DQF_INFO_DIRTY_B) /* Is info dirty? */ | 227 | #define DQF_INFO_DIRTY (1 << DQF_INFO_DIRTY_B) /* Is info dirty? */ |
224 | 228 | ||
225 | extern void mark_info_dirty(struct super_block *sb, int type); | 229 | extern void mark_info_dirty(struct super_block *sb, int type); |
226 | #define info_dirty(info) test_bit(DQF_INFO_DIRTY_B, &(info)->dqi_flags) | 230 | static inline int info_dirty(struct mem_dqinfo *info) |
227 | #define info_any_dquot_dirty(info) (!list_empty(&(info)->dqi_dirty_list)) | 231 | { |
228 | #define info_any_dirty(info) (info_dirty(info) || info_any_dquot_dirty(info)) | 232 | return test_bit(DQF_INFO_DIRTY_B, &info->dqi_flags); |
229 | 233 | } | |
230 | #define sb_dqopt(sb) (&(sb)->s_dquot) | ||
231 | #define sb_dqinfo(sb, type) (sb_dqopt(sb)->info+(type)) | ||
232 | 234 | ||
233 | struct dqstats { | 235 | struct dqstats { |
234 | int lookups; | 236 | int lookups; |
@@ -337,19 +339,6 @@ struct quota_info { | |||
337 | struct quota_format_ops *ops[MAXQUOTAS]; /* Operations for each type */ | 339 | struct quota_format_ops *ops[MAXQUOTAS]; /* Operations for each type */ |
338 | }; | 340 | }; |
339 | 341 | ||
340 | #define sb_has_quota_enabled(sb, type) ((type)==USRQUOTA ? \ | ||
341 | (sb_dqopt(sb)->flags & DQUOT_USR_ENABLED) : (sb_dqopt(sb)->flags & DQUOT_GRP_ENABLED)) | ||
342 | |||
343 | #define sb_any_quota_enabled(sb) (sb_has_quota_enabled(sb, USRQUOTA) | \ | ||
344 | sb_has_quota_enabled(sb, GRPQUOTA)) | ||
345 | |||
346 | #define sb_has_quota_suspended(sb, type) \ | ||
347 | ((type) == USRQUOTA ? (sb_dqopt(sb)->flags & DQUOT_USR_SUSPENDED) : \ | ||
348 | (sb_dqopt(sb)->flags & DQUOT_GRP_SUSPENDED)) | ||
349 | |||
350 | #define sb_any_quota_suspended(sb) (sb_has_quota_suspended(sb, USRQUOTA) | \ | ||
351 | sb_has_quota_suspended(sb, GRPQUOTA)) | ||
352 | |||
353 | int register_quota_format(struct quota_format_type *fmt); | 342 | int register_quota_format(struct quota_format_type *fmt); |
354 | void unregister_quota_format(struct quota_format_type *fmt); | 343 | void unregister_quota_format(struct quota_format_type *fmt); |
355 | 344 | ||
diff --git a/include/linux/quotaops.h b/include/linux/quotaops.h index f86702053853..ca6b9b5c8d52 100644 --- a/include/linux/quotaops.h +++ b/include/linux/quotaops.h | |||
@@ -11,42 +11,87 @@ | |||
11 | #define _LINUX_QUOTAOPS_ | 11 | #define _LINUX_QUOTAOPS_ |
12 | 12 | ||
13 | #include <linux/smp_lock.h> | 13 | #include <linux/smp_lock.h> |
14 | |||
15 | #include <linux/fs.h> | 14 | #include <linux/fs.h> |
16 | 15 | ||
16 | static inline struct quota_info *sb_dqopt(struct super_block *sb) | ||
17 | { | ||
18 | return &sb->s_dquot; | ||
19 | } | ||
20 | |||
17 | #if defined(CONFIG_QUOTA) | 21 | #if defined(CONFIG_QUOTA) |
18 | 22 | ||
19 | /* | 23 | /* |
20 | * declaration of quota_function calls in kernel. | 24 | * declaration of quota_function calls in kernel. |
21 | */ | 25 | */ |
22 | extern void sync_dquots(struct super_block *sb, int type); | 26 | void sync_dquots(struct super_block *sb, int type); |
23 | 27 | ||
24 | extern int dquot_initialize(struct inode *inode, int type); | 28 | int dquot_initialize(struct inode *inode, int type); |
25 | extern int dquot_drop(struct inode *inode); | 29 | int dquot_drop(struct inode *inode); |
26 | 30 | ||
27 | extern int dquot_alloc_space(struct inode *inode, qsize_t number, int prealloc); | 31 | int dquot_alloc_space(struct inode *inode, qsize_t number, int prealloc); |
28 | extern int dquot_alloc_inode(const struct inode *inode, unsigned long number); | 32 | int dquot_alloc_inode(const struct inode *inode, unsigned long number); |
29 | 33 | ||
30 | extern int dquot_free_space(struct inode *inode, qsize_t number); | 34 | int dquot_free_space(struct inode *inode, qsize_t number); |
31 | extern int dquot_free_inode(const struct inode *inode, unsigned long number); | 35 | int dquot_free_inode(const struct inode *inode, unsigned long number); |
32 | 36 | ||
33 | extern int dquot_transfer(struct inode *inode, struct iattr *iattr); | 37 | int dquot_transfer(struct inode *inode, struct iattr *iattr); |
34 | extern int dquot_commit(struct dquot *dquot); | 38 | int dquot_commit(struct dquot *dquot); |
35 | extern int dquot_acquire(struct dquot *dquot); | 39 | int dquot_acquire(struct dquot *dquot); |
36 | extern int dquot_release(struct dquot *dquot); | 40 | int dquot_release(struct dquot *dquot); |
37 | extern int dquot_commit_info(struct super_block *sb, int type); | 41 | int dquot_commit_info(struct super_block *sb, int type); |
38 | extern int dquot_mark_dquot_dirty(struct dquot *dquot); | 42 | int dquot_mark_dquot_dirty(struct dquot *dquot); |
39 | 43 | ||
40 | extern int vfs_quota_on(struct super_block *sb, int type, int format_id, | 44 | int vfs_quota_on(struct super_block *sb, int type, int format_id, |
41 | char *path, int remount); | 45 | char *path, int remount); |
42 | extern int vfs_quota_on_mount(struct super_block *sb, char *qf_name, | 46 | int vfs_quota_on_path(struct super_block *sb, int type, int format_id, |
43 | int format_id, int type); | 47 | struct path *path); |
44 | extern int vfs_quota_off(struct super_block *sb, int type, int remount); | 48 | int vfs_quota_on_mount(struct super_block *sb, char *qf_name, |
45 | extern int vfs_quota_sync(struct super_block *sb, int type); | 49 | int format_id, int type); |
46 | extern int vfs_get_dqinfo(struct super_block *sb, int type, struct if_dqinfo *ii); | 50 | int vfs_quota_off(struct super_block *sb, int type, int remount); |
47 | extern int vfs_set_dqinfo(struct super_block *sb, int type, struct if_dqinfo *ii); | 51 | int vfs_quota_sync(struct super_block *sb, int type); |
48 | extern int vfs_get_dqblk(struct super_block *sb, int type, qid_t id, struct if_dqblk *di); | 52 | int vfs_get_dqinfo(struct super_block *sb, int type, struct if_dqinfo *ii); |
49 | extern int vfs_set_dqblk(struct super_block *sb, int type, qid_t id, struct if_dqblk *di); | 53 | int vfs_set_dqinfo(struct super_block *sb, int type, struct if_dqinfo *ii); |
54 | int vfs_get_dqblk(struct super_block *sb, int type, qid_t id, struct if_dqblk *di); | ||
55 | int vfs_set_dqblk(struct super_block *sb, int type, qid_t id, struct if_dqblk *di); | ||
56 | |||
57 | void vfs_dq_drop(struct inode *inode); | ||
58 | int vfs_dq_transfer(struct inode *inode, struct iattr *iattr); | ||
59 | int vfs_dq_quota_on_remount(struct super_block *sb); | ||
60 | |||
61 | static inline struct mem_dqinfo *sb_dqinfo(struct super_block *sb, int type) | ||
62 | { | ||
63 | return sb_dqopt(sb)->info + type; | ||
64 | } | ||
65 | |||
66 | /* | ||
67 | * Functions for checking status of quota | ||
68 | */ | ||
69 | |||
70 | static inline int sb_has_quota_enabled(struct super_block *sb, int type) | ||
71 | { | ||
72 | if (type == USRQUOTA) | ||
73 | return sb_dqopt(sb)->flags & DQUOT_USR_ENABLED; | ||
74 | return sb_dqopt(sb)->flags & DQUOT_GRP_ENABLED; | ||
75 | } | ||
76 | |||
77 | static inline int sb_any_quota_enabled(struct super_block *sb) | ||
78 | { | ||
79 | return sb_has_quota_enabled(sb, USRQUOTA) || | ||
80 | sb_has_quota_enabled(sb, GRPQUOTA); | ||
81 | } | ||
82 | |||
83 | static inline int sb_has_quota_suspended(struct super_block *sb, int type) | ||
84 | { | ||
85 | if (type == USRQUOTA) | ||
86 | return sb_dqopt(sb)->flags & DQUOT_USR_SUSPENDED; | ||
87 | return sb_dqopt(sb)->flags & DQUOT_GRP_SUSPENDED; | ||
88 | } | ||
89 | |||
90 | static inline int sb_any_quota_suspended(struct super_block *sb) | ||
91 | { | ||
92 | return sb_has_quota_suspended(sb, USRQUOTA) || | ||
93 | sb_has_quota_suspended(sb, GRPQUOTA); | ||
94 | } | ||
50 | 95 | ||
51 | /* | 96 | /* |
52 | * Operations supported for diskquotas. | 97 | * Operations supported for diskquotas. |
@@ -59,38 +104,16 @@ extern struct quotactl_ops vfs_quotactl_ops; | |||
59 | 104 | ||
60 | /* It is better to call this function outside of any transaction as it might | 105 | /* It is better to call this function outside of any transaction as it might |
61 | * need a lot of space in journal for dquot structure allocation. */ | 106 | * need a lot of space in journal for dquot structure allocation. */ |
62 | static inline void DQUOT_INIT(struct inode *inode) | 107 | static inline void vfs_dq_init(struct inode *inode) |
63 | { | 108 | { |
64 | BUG_ON(!inode->i_sb); | 109 | BUG_ON(!inode->i_sb); |
65 | if (sb_any_quota_enabled(inode->i_sb) && !IS_NOQUOTA(inode)) | 110 | if (sb_any_quota_enabled(inode->i_sb) && !IS_NOQUOTA(inode)) |
66 | inode->i_sb->dq_op->initialize(inode, -1); | 111 | inode->i_sb->dq_op->initialize(inode, -1); |
67 | } | 112 | } |
68 | 113 | ||
69 | /* The same as with DQUOT_INIT */ | ||
70 | static inline void DQUOT_DROP(struct inode *inode) | ||
71 | { | ||
72 | /* Here we can get arbitrary inode from clear_inode() so we have | ||
73 | * to be careful. OTOH we don't need locking as quota operations | ||
74 | * are allowed to change only at mount time */ | ||
75 | if (!IS_NOQUOTA(inode) && inode->i_sb && inode->i_sb->dq_op | ||
76 | && inode->i_sb->dq_op->drop) { | ||
77 | int cnt; | ||
78 | /* Test before calling to rule out calls from proc and such | ||
79 | * where we are not allowed to block. Note that this is | ||
80 | * actually reliable test even without the lock - the caller | ||
81 | * must assure that nobody can come after the DQUOT_DROP and | ||
82 | * add quota pointers back anyway */ | ||
83 | for (cnt = 0; cnt < MAXQUOTAS; cnt++) | ||
84 | if (inode->i_dquot[cnt] != NODQUOT) | ||
85 | break; | ||
86 | if (cnt < MAXQUOTAS) | ||
87 | inode->i_sb->dq_op->drop(inode); | ||
88 | } | ||
89 | } | ||
90 | |||
91 | /* The following allocation/freeing/transfer functions *must* be called inside | 114 | /* The following allocation/freeing/transfer functions *must* be called inside |
92 | * a transaction (deadlocks possible otherwise) */ | 115 | * a transaction (deadlocks possible otherwise) */ |
93 | static inline int DQUOT_PREALLOC_SPACE_NODIRTY(struct inode *inode, qsize_t nr) | 116 | static inline int vfs_dq_prealloc_space_nodirty(struct inode *inode, qsize_t nr) |
94 | { | 117 | { |
95 | if (sb_any_quota_enabled(inode->i_sb)) { | 118 | if (sb_any_quota_enabled(inode->i_sb)) { |
96 | /* Used space is updated in alloc_space() */ | 119 | /* Used space is updated in alloc_space() */ |
@@ -102,15 +125,15 @@ static inline int DQUOT_PREALLOC_SPACE_NODIRTY(struct inode *inode, qsize_t nr) | |||
102 | return 0; | 125 | return 0; |
103 | } | 126 | } |
104 | 127 | ||
105 | static inline int DQUOT_PREALLOC_SPACE(struct inode *inode, qsize_t nr) | 128 | static inline int vfs_dq_prealloc_space(struct inode *inode, qsize_t nr) |
106 | { | 129 | { |
107 | int ret; | 130 | int ret; |
108 | if (!(ret = DQUOT_PREALLOC_SPACE_NODIRTY(inode, nr))) | 131 | if (!(ret = vfs_dq_prealloc_space_nodirty(inode, nr))) |
109 | mark_inode_dirty(inode); | 132 | mark_inode_dirty(inode); |
110 | return ret; | 133 | return ret; |
111 | } | 134 | } |
112 | 135 | ||
113 | static inline int DQUOT_ALLOC_SPACE_NODIRTY(struct inode *inode, qsize_t nr) | 136 | static inline int vfs_dq_alloc_space_nodirty(struct inode *inode, qsize_t nr) |
114 | { | 137 | { |
115 | if (sb_any_quota_enabled(inode->i_sb)) { | 138 | if (sb_any_quota_enabled(inode->i_sb)) { |
116 | /* Used space is updated in alloc_space() */ | 139 | /* Used space is updated in alloc_space() */ |
@@ -122,25 +145,25 @@ static inline int DQUOT_ALLOC_SPACE_NODIRTY(struct inode *inode, qsize_t nr) | |||
122 | return 0; | 145 | return 0; |
123 | } | 146 | } |
124 | 147 | ||
125 | static inline int DQUOT_ALLOC_SPACE(struct inode *inode, qsize_t nr) | 148 | static inline int vfs_dq_alloc_space(struct inode *inode, qsize_t nr) |
126 | { | 149 | { |
127 | int ret; | 150 | int ret; |
128 | if (!(ret = DQUOT_ALLOC_SPACE_NODIRTY(inode, nr))) | 151 | if (!(ret = vfs_dq_alloc_space_nodirty(inode, nr))) |
129 | mark_inode_dirty(inode); | 152 | mark_inode_dirty(inode); |
130 | return ret; | 153 | return ret; |
131 | } | 154 | } |
132 | 155 | ||
133 | static inline int DQUOT_ALLOC_INODE(struct inode *inode) | 156 | static inline int vfs_dq_alloc_inode(struct inode *inode) |
134 | { | 157 | { |
135 | if (sb_any_quota_enabled(inode->i_sb)) { | 158 | if (sb_any_quota_enabled(inode->i_sb)) { |
136 | DQUOT_INIT(inode); | 159 | vfs_dq_init(inode); |
137 | if (inode->i_sb->dq_op->alloc_inode(inode, 1) == NO_QUOTA) | 160 | if (inode->i_sb->dq_op->alloc_inode(inode, 1) == NO_QUOTA) |
138 | return 1; | 161 | return 1; |
139 | } | 162 | } |
140 | return 0; | 163 | return 0; |
141 | } | 164 | } |
142 | 165 | ||
143 | static inline void DQUOT_FREE_SPACE_NODIRTY(struct inode *inode, qsize_t nr) | 166 | static inline void vfs_dq_free_space_nodirty(struct inode *inode, qsize_t nr) |
144 | { | 167 | { |
145 | if (sb_any_quota_enabled(inode->i_sb)) | 168 | if (sb_any_quota_enabled(inode->i_sb)) |
146 | inode->i_sb->dq_op->free_space(inode, nr); | 169 | inode->i_sb->dq_op->free_space(inode, nr); |
@@ -148,35 +171,25 @@ static inline void DQUOT_FREE_SPACE_NODIRTY(struct inode *inode, qsize_t nr) | |||
148 | inode_sub_bytes(inode, nr); | 171 | inode_sub_bytes(inode, nr); |
149 | } | 172 | } |
150 | 173 | ||
151 | static inline void DQUOT_FREE_SPACE(struct inode *inode, qsize_t nr) | 174 | static inline void vfs_dq_free_space(struct inode *inode, qsize_t nr) |
152 | { | 175 | { |
153 | DQUOT_FREE_SPACE_NODIRTY(inode, nr); | 176 | vfs_dq_free_space_nodirty(inode, nr); |
154 | mark_inode_dirty(inode); | 177 | mark_inode_dirty(inode); |
155 | } | 178 | } |
156 | 179 | ||
157 | static inline void DQUOT_FREE_INODE(struct inode *inode) | 180 | static inline void vfs_dq_free_inode(struct inode *inode) |
158 | { | 181 | { |
159 | if (sb_any_quota_enabled(inode->i_sb)) | 182 | if (sb_any_quota_enabled(inode->i_sb)) |
160 | inode->i_sb->dq_op->free_inode(inode, 1); | 183 | inode->i_sb->dq_op->free_inode(inode, 1); |
161 | } | 184 | } |
162 | 185 | ||
163 | static inline int DQUOT_TRANSFER(struct inode *inode, struct iattr *iattr) | ||
164 | { | ||
165 | if (sb_any_quota_enabled(inode->i_sb) && !IS_NOQUOTA(inode)) { | ||
166 | DQUOT_INIT(inode); | ||
167 | if (inode->i_sb->dq_op->transfer(inode, iattr) == NO_QUOTA) | ||
168 | return 1; | ||
169 | } | ||
170 | return 0; | ||
171 | } | ||
172 | |||
173 | /* The following two functions cannot be called inside a transaction */ | 186 | /* The following two functions cannot be called inside a transaction */ |
174 | static inline void DQUOT_SYNC(struct super_block *sb) | 187 | static inline void vfs_dq_sync(struct super_block *sb) |
175 | { | 188 | { |
176 | sync_dquots(sb, -1); | 189 | sync_dquots(sb, -1); |
177 | } | 190 | } |
178 | 191 | ||
179 | static inline int DQUOT_OFF(struct super_block *sb, int remount) | 192 | static inline int vfs_dq_off(struct super_block *sb, int remount) |
180 | { | 193 | { |
181 | int ret = -ENOSYS; | 194 | int ret = -ENOSYS; |
182 | 195 | ||
@@ -185,22 +198,27 @@ static inline int DQUOT_OFF(struct super_block *sb, int remount) | |||
185 | return ret; | 198 | return ret; |
186 | } | 199 | } |
187 | 200 | ||
188 | static inline int DQUOT_ON_REMOUNT(struct super_block *sb) | 201 | #else |
202 | |||
203 | static inline int sb_has_quota_enabled(struct super_block *sb, int type) | ||
189 | { | 204 | { |
190 | int cnt; | 205 | return 0; |
191 | int ret = 0, err; | 206 | } |
192 | 207 | ||
193 | if (!sb->s_qcop || !sb->s_qcop->quota_on) | 208 | static inline int sb_any_quota_enabled(struct super_block *sb) |
194 | return -ENOSYS; | 209 | { |
195 | for (cnt = 0; cnt < MAXQUOTAS; cnt++) { | 210 | return 0; |
196 | err = sb->s_qcop->quota_on(sb, cnt, 0, NULL, 1); | ||
197 | if (err < 0 && !ret) | ||
198 | ret = err; | ||
199 | } | ||
200 | return ret; | ||
201 | } | 211 | } |
202 | 212 | ||
203 | #else | 213 | static inline int sb_has_quota_suspended(struct super_block *sb, int type) |
214 | { | ||
215 | return 0; | ||
216 | } | ||
217 | |||
218 | static inline int sb_any_quota_suspended(struct super_block *sb) | ||
219 | { | ||
220 | return 0; | ||
221 | } | ||
204 | 222 | ||
205 | /* | 223 | /* |
206 | * NO-OP when quota not configured. | 224 | * NO-OP when quota not configured. |
@@ -208,113 +226,144 @@ static inline int DQUOT_ON_REMOUNT(struct super_block *sb) | |||
208 | #define sb_dquot_ops (NULL) | 226 | #define sb_dquot_ops (NULL) |
209 | #define sb_quotactl_ops (NULL) | 227 | #define sb_quotactl_ops (NULL) |
210 | 228 | ||
211 | static inline void DQUOT_INIT(struct inode *inode) | 229 | static inline void vfs_dq_init(struct inode *inode) |
212 | { | 230 | { |
213 | } | 231 | } |
214 | 232 | ||
215 | static inline void DQUOT_DROP(struct inode *inode) | 233 | static inline void vfs_dq_drop(struct inode *inode) |
216 | { | 234 | { |
217 | } | 235 | } |
218 | 236 | ||
219 | static inline int DQUOT_ALLOC_INODE(struct inode *inode) | 237 | static inline int vfs_dq_alloc_inode(struct inode *inode) |
220 | { | 238 | { |
221 | return 0; | 239 | return 0; |
222 | } | 240 | } |
223 | 241 | ||
224 | static inline void DQUOT_FREE_INODE(struct inode *inode) | 242 | static inline void vfs_dq_free_inode(struct inode *inode) |
225 | { | 243 | { |
226 | } | 244 | } |
227 | 245 | ||
228 | static inline void DQUOT_SYNC(struct super_block *sb) | 246 | static inline void vfs_dq_sync(struct super_block *sb) |
229 | { | 247 | { |
230 | } | 248 | } |
231 | 249 | ||
232 | static inline int DQUOT_OFF(struct super_block *sb, int remount) | 250 | static inline int vfs_dq_off(struct super_block *sb, int remount) |
233 | { | 251 | { |
234 | return 0; | 252 | return 0; |
235 | } | 253 | } |
236 | 254 | ||
237 | static inline int DQUOT_ON_REMOUNT(struct super_block *sb) | 255 | static inline int vfs_dq_quota_on_remount(struct super_block *sb) |
238 | { | 256 | { |
239 | return 0; | 257 | return 0; |
240 | } | 258 | } |
241 | 259 | ||
242 | static inline int DQUOT_TRANSFER(struct inode *inode, struct iattr *iattr) | 260 | static inline int vfs_dq_transfer(struct inode *inode, struct iattr *iattr) |
243 | { | 261 | { |
244 | return 0; | 262 | return 0; |
245 | } | 263 | } |
246 | 264 | ||
247 | static inline int DQUOT_PREALLOC_SPACE_NODIRTY(struct inode *inode, qsize_t nr) | 265 | static inline int vfs_dq_prealloc_space_nodirty(struct inode *inode, qsize_t nr) |
248 | { | 266 | { |
249 | inode_add_bytes(inode, nr); | 267 | inode_add_bytes(inode, nr); |
250 | return 0; | 268 | return 0; |
251 | } | 269 | } |
252 | 270 | ||
253 | static inline int DQUOT_PREALLOC_SPACE(struct inode *inode, qsize_t nr) | 271 | static inline int vfs_dq_prealloc_space(struct inode *inode, qsize_t nr) |
254 | { | 272 | { |
255 | DQUOT_PREALLOC_SPACE_NODIRTY(inode, nr); | 273 | vfs_dq_prealloc_space_nodirty(inode, nr); |
256 | mark_inode_dirty(inode); | 274 | mark_inode_dirty(inode); |
257 | return 0; | 275 | return 0; |
258 | } | 276 | } |
259 | 277 | ||
260 | static inline int DQUOT_ALLOC_SPACE_NODIRTY(struct inode *inode, qsize_t nr) | 278 | static inline int vfs_dq_alloc_space_nodirty(struct inode *inode, qsize_t nr) |
261 | { | 279 | { |
262 | inode_add_bytes(inode, nr); | 280 | inode_add_bytes(inode, nr); |
263 | return 0; | 281 | return 0; |
264 | } | 282 | } |
265 | 283 | ||
266 | static inline int DQUOT_ALLOC_SPACE(struct inode *inode, qsize_t nr) | 284 | static inline int vfs_dq_alloc_space(struct inode *inode, qsize_t nr) |
267 | { | 285 | { |
268 | DQUOT_ALLOC_SPACE_NODIRTY(inode, nr); | 286 | vfs_dq_alloc_space_nodirty(inode, nr); |
269 | mark_inode_dirty(inode); | 287 | mark_inode_dirty(inode); |
270 | return 0; | 288 | return 0; |
271 | } | 289 | } |
272 | 290 | ||
273 | static inline void DQUOT_FREE_SPACE_NODIRTY(struct inode *inode, qsize_t nr) | 291 | static inline void vfs_dq_free_space_nodirty(struct inode *inode, qsize_t nr) |
274 | { | 292 | { |
275 | inode_sub_bytes(inode, nr); | 293 | inode_sub_bytes(inode, nr); |
276 | } | 294 | } |
277 | 295 | ||
278 | static inline void DQUOT_FREE_SPACE(struct inode *inode, qsize_t nr) | 296 | static inline void vfs_dq_free_space(struct inode *inode, qsize_t nr) |
279 | { | 297 | { |
280 | DQUOT_FREE_SPACE_NODIRTY(inode, nr); | 298 | vfs_dq_free_space_nodirty(inode, nr); |
281 | mark_inode_dirty(inode); | 299 | mark_inode_dirty(inode); |
282 | } | 300 | } |
283 | 301 | ||
284 | #endif /* CONFIG_QUOTA */ | 302 | #endif /* CONFIG_QUOTA */ |
285 | 303 | ||
286 | static inline int DQUOT_PREALLOC_BLOCK_NODIRTY(struct inode *inode, qsize_t nr) | 304 | static inline int vfs_dq_prealloc_block_nodirty(struct inode *inode, qsize_t nr) |
287 | { | 305 | { |
288 | return DQUOT_PREALLOC_SPACE_NODIRTY(inode, | 306 | return vfs_dq_prealloc_space_nodirty(inode, |
289 | nr << inode->i_sb->s_blocksize_bits); | 307 | nr << inode->i_sb->s_blocksize_bits); |
290 | } | 308 | } |
291 | 309 | ||
292 | static inline int DQUOT_PREALLOC_BLOCK(struct inode *inode, qsize_t nr) | 310 | static inline int vfs_dq_prealloc_block(struct inode *inode, qsize_t nr) |
293 | { | 311 | { |
294 | return DQUOT_PREALLOC_SPACE(inode, | 312 | return vfs_dq_prealloc_space(inode, |
295 | nr << inode->i_sb->s_blocksize_bits); | 313 | nr << inode->i_sb->s_blocksize_bits); |
296 | } | 314 | } |
297 | 315 | ||
298 | static inline int DQUOT_ALLOC_BLOCK_NODIRTY(struct inode *inode, qsize_t nr) | 316 | static inline int vfs_dq_alloc_block_nodirty(struct inode *inode, qsize_t nr) |
299 | { | 317 | { |
300 | return DQUOT_ALLOC_SPACE_NODIRTY(inode, | 318 | return vfs_dq_alloc_space_nodirty(inode, |
301 | nr << inode->i_sb->s_blocksize_bits); | 319 | nr << inode->i_sb->s_blocksize_bits); |
302 | } | 320 | } |
303 | 321 | ||
304 | static inline int DQUOT_ALLOC_BLOCK(struct inode *inode, qsize_t nr) | 322 | static inline int vfs_dq_alloc_block(struct inode *inode, qsize_t nr) |
305 | { | 323 | { |
306 | return DQUOT_ALLOC_SPACE(inode, | 324 | return vfs_dq_alloc_space(inode, |
307 | nr << inode->i_sb->s_blocksize_bits); | 325 | nr << inode->i_sb->s_blocksize_bits); |
308 | } | 326 | } |
309 | 327 | ||
310 | static inline void DQUOT_FREE_BLOCK_NODIRTY(struct inode *inode, qsize_t nr) | 328 | static inline void vfs_dq_free_block_nodirty(struct inode *inode, qsize_t nr) |
311 | { | 329 | { |
312 | DQUOT_FREE_SPACE_NODIRTY(inode, nr << inode->i_sb->s_blocksize_bits); | 330 | vfs_dq_free_space_nodirty(inode, nr << inode->i_sb->s_blocksize_bits); |
313 | } | 331 | } |
314 | 332 | ||
315 | static inline void DQUOT_FREE_BLOCK(struct inode *inode, qsize_t nr) | 333 | static inline void vfs_dq_free_block(struct inode *inode, qsize_t nr) |
316 | { | 334 | { |
317 | DQUOT_FREE_SPACE(inode, nr << inode->i_sb->s_blocksize_bits); | 335 | vfs_dq_free_space(inode, nr << inode->i_sb->s_blocksize_bits); |
318 | } | 336 | } |
319 | 337 | ||
338 | /* | ||
339 | * Define uppercase equivalents for compatibility with old function names | ||
340 | * Can go away when we think all users have been converted (15/04/2008) | ||
341 | */ | ||
342 | #define DQUOT_INIT(inode) vfs_dq_init(inode) | ||
343 | #define DQUOT_DROP(inode) vfs_dq_drop(inode) | ||
344 | #define DQUOT_PREALLOC_SPACE_NODIRTY(inode, nr) \ | ||
345 | vfs_dq_prealloc_space_nodirty(inode, nr) | ||
346 | #define DQUOT_PREALLOC_SPACE(inode, nr) vfs_dq_prealloc_space(inode, nr) | ||
347 | #define DQUOT_ALLOC_SPACE_NODIRTY(inode, nr) \ | ||
348 | vfs_dq_alloc_space_nodirty(inode, nr) | ||
349 | #define DQUOT_ALLOC_SPACE(inode, nr) vfs_dq_alloc_space(inode, nr) | ||
350 | #define DQUOT_PREALLOC_BLOCK_NODIRTY(inode, nr) \ | ||
351 | vfs_dq_prealloc_block_nodirty(inode, nr) | ||
352 | #define DQUOT_PREALLOC_BLOCK(inode, nr) vfs_dq_prealloc_block(inode, nr) | ||
353 | #define DQUOT_ALLOC_BLOCK_NODIRTY(inode, nr) \ | ||
354 | vfs_dq_alloc_block_nodirty(inode, nr) | ||
355 | #define DQUOT_ALLOC_BLOCK(inode, nr) vfs_dq_alloc_block(inode, nr) | ||
356 | #define DQUOT_ALLOC_INODE(inode) vfs_dq_alloc_inode(inode) | ||
357 | #define DQUOT_FREE_SPACE_NODIRTY(inode, nr) \ | ||
358 | vfs_dq_free_space_nodirty(inode, nr) | ||
359 | #define DQUOT_FREE_SPACE(inode, nr) vfs_dq_free_space(inode, nr) | ||
360 | #define DQUOT_FREE_BLOCK_NODIRTY(inode, nr) \ | ||
361 | vfs_dq_free_block_nodirty(inode, nr) | ||
362 | #define DQUOT_FREE_BLOCK(inode, nr) vfs_dq_free_block(inode, nr) | ||
363 | #define DQUOT_FREE_INODE(inode) vfs_dq_free_inode(inode) | ||
364 | #define DQUOT_TRANSFER(inode, iattr) vfs_dq_transfer(inode, iattr) | ||
365 | #define DQUOT_SYNC(sb) vfs_dq_sync(sb) | ||
366 | #define DQUOT_OFF(sb, remount) vfs_dq_off(sb, remount) | ||
367 | #define DQUOT_ON_REMOUNT(sb) vfs_dq_quota_on_remount(sb) | ||
368 | |||
320 | #endif /* _LINUX_QUOTAOPS_ */ | 369 | #endif /* _LINUX_QUOTAOPS_ */ |
diff --git a/include/linux/radix-tree.h b/include/linux/radix-tree.h index b8ce2b444bb5..a916c6660dfa 100644 --- a/include/linux/radix-tree.h +++ b/include/linux/radix-tree.h | |||
@@ -99,12 +99,15 @@ do { \ | |||
99 | * | 99 | * |
100 | * The notable exceptions to this rule are the following functions: | 100 | * The notable exceptions to this rule are the following functions: |
101 | * radix_tree_lookup | 101 | * radix_tree_lookup |
102 | * radix_tree_lookup_slot | ||
102 | * radix_tree_tag_get | 103 | * radix_tree_tag_get |
103 | * radix_tree_gang_lookup | 104 | * radix_tree_gang_lookup |
105 | * radix_tree_gang_lookup_slot | ||
104 | * radix_tree_gang_lookup_tag | 106 | * radix_tree_gang_lookup_tag |
107 | * radix_tree_gang_lookup_tag_slot | ||
105 | * radix_tree_tagged | 108 | * radix_tree_tagged |
106 | * | 109 | * |
107 | * The first 4 functions are able to be called locklessly, using RCU. The | 110 | * The first 7 functions are able to be called locklessly, using RCU. The |
108 | * caller must ensure calls to these functions are made within rcu_read_lock() | 111 | * caller must ensure calls to these functions are made within rcu_read_lock() |
109 | * regions. Other readers (lock-free or otherwise) and modifications may be | 112 | * regions. Other readers (lock-free or otherwise) and modifications may be |
110 | * running concurrently. | 113 | * running concurrently. |
@@ -159,6 +162,9 @@ void *radix_tree_delete(struct radix_tree_root *, unsigned long); | |||
159 | unsigned int | 162 | unsigned int |
160 | radix_tree_gang_lookup(struct radix_tree_root *root, void **results, | 163 | radix_tree_gang_lookup(struct radix_tree_root *root, void **results, |
161 | unsigned long first_index, unsigned int max_items); | 164 | unsigned long first_index, unsigned int max_items); |
165 | unsigned int | ||
166 | radix_tree_gang_lookup_slot(struct radix_tree_root *root, void ***results, | ||
167 | unsigned long first_index, unsigned int max_items); | ||
162 | unsigned long radix_tree_next_hole(struct radix_tree_root *root, | 168 | unsigned long radix_tree_next_hole(struct radix_tree_root *root, |
163 | unsigned long index, unsigned long max_scan); | 169 | unsigned long index, unsigned long max_scan); |
164 | int radix_tree_preload(gfp_t gfp_mask); | 170 | int radix_tree_preload(gfp_t gfp_mask); |
@@ -173,6 +179,10 @@ unsigned int | |||
173 | radix_tree_gang_lookup_tag(struct radix_tree_root *root, void **results, | 179 | radix_tree_gang_lookup_tag(struct radix_tree_root *root, void **results, |
174 | unsigned long first_index, unsigned int max_items, | 180 | unsigned long first_index, unsigned int max_items, |
175 | unsigned int tag); | 181 | unsigned int tag); |
182 | unsigned int | ||
183 | radix_tree_gang_lookup_tag_slot(struct radix_tree_root *root, void ***results, | ||
184 | unsigned long first_index, unsigned int max_items, | ||
185 | unsigned int tag); | ||
176 | int radix_tree_tagged(struct radix_tree_root *root, unsigned int tag); | 186 | int radix_tree_tagged(struct radix_tree_root *root, unsigned int tag); |
177 | 187 | ||
178 | static inline void radix_tree_preload_end(void) | 188 | static inline void radix_tree_preload_end(void) |
diff --git a/include/linux/raid/bitmap.h b/include/linux/raid/bitmap.h index 78bfdea24a8e..e98900671ca9 100644 --- a/include/linux/raid/bitmap.h +++ b/include/linux/raid/bitmap.h | |||
@@ -221,6 +221,7 @@ struct bitmap { | |||
221 | unsigned long syncchunk; | 221 | unsigned long syncchunk; |
222 | 222 | ||
223 | __u64 events_cleared; | 223 | __u64 events_cleared; |
224 | int need_sync; | ||
224 | 225 | ||
225 | /* bitmap spinlock */ | 226 | /* bitmap spinlock */ |
226 | spinlock_t lock; | 227 | spinlock_t lock; |
diff --git a/include/linux/raid/linear.h b/include/linux/raid/linear.h index ba15469daf11..7e375111d007 100644 --- a/include/linux/raid/linear.h +++ b/include/linux/raid/linear.h | |||
@@ -16,7 +16,7 @@ struct linear_private_data | |||
16 | struct linear_private_data *prev; /* earlier version */ | 16 | struct linear_private_data *prev; /* earlier version */ |
17 | dev_info_t **hash_table; | 17 | dev_info_t **hash_table; |
18 | sector_t hash_spacing; | 18 | sector_t hash_spacing; |
19 | sector_t array_size; | 19 | sector_t array_sectors; |
20 | int preshift; /* shift before dividing by hash_spacing */ | 20 | int preshift; /* shift before dividing by hash_spacing */ |
21 | dev_info_t disks[0]; | 21 | dev_info_t disks[0]; |
22 | }; | 22 | }; |
diff --git a/include/linux/raid/md.h b/include/linux/raid/md.h index b7386ae9d288..dc0e3fcb9f28 100644 --- a/include/linux/raid/md.h +++ b/include/linux/raid/md.h | |||
@@ -95,7 +95,7 @@ extern int sync_page_io(struct block_device *bdev, sector_t sector, int size, | |||
95 | struct page *page, int rw); | 95 | struct page *page, int rw); |
96 | extern void md_do_sync(mddev_t *mddev); | 96 | extern void md_do_sync(mddev_t *mddev); |
97 | extern void md_new_event(mddev_t *mddev); | 97 | extern void md_new_event(mddev_t *mddev); |
98 | extern void md_allow_write(mddev_t *mddev); | 98 | extern int md_allow_write(mddev_t *mddev); |
99 | extern void md_wait_for_blocked_rdev(mdk_rdev_t *rdev, mddev_t *mddev); | 99 | extern void md_wait_for_blocked_rdev(mdk_rdev_t *rdev, mddev_t *mddev); |
100 | 100 | ||
101 | #endif /* CONFIG_MD */ | 101 | #endif /* CONFIG_MD */ |
diff --git a/include/linux/raid/md_k.h b/include/linux/raid/md_k.h index 3dea9f545c8f..c200b9a34aff 100644 --- a/include/linux/raid/md_k.h +++ b/include/linux/raid/md_k.h | |||
@@ -59,7 +59,7 @@ struct mdk_rdev_s | |||
59 | int sb_loaded; | 59 | int sb_loaded; |
60 | __u64 sb_events; | 60 | __u64 sb_events; |
61 | sector_t data_offset; /* start of data in array */ | 61 | sector_t data_offset; /* start of data in array */ |
62 | sector_t sb_offset; | 62 | sector_t sb_start; /* offset of the super block (in 512byte sectors) */ |
63 | int sb_size; /* bytes in the superblock */ | 63 | int sb_size; /* bytes in the superblock */ |
64 | int preferred_minor; /* autorun support */ | 64 | int preferred_minor; /* autorun support */ |
65 | 65 | ||
@@ -87,6 +87,9 @@ struct mdk_rdev_s | |||
87 | #define Blocked 8 /* An error occured on an externally | 87 | #define Blocked 8 /* An error occured on an externally |
88 | * managed array, don't allow writes | 88 | * managed array, don't allow writes |
89 | * until it is cleared */ | 89 | * until it is cleared */ |
90 | #define StateChanged 9 /* Faulty or Blocked has changed during | ||
91 | * interrupt, so it needs to be | ||
92 | * notified by the thread */ | ||
90 | wait_queue_head_t blocked_wait; | 93 | wait_queue_head_t blocked_wait; |
91 | 94 | ||
92 | int desc_nr; /* descriptor index in the superblock */ | 95 | int desc_nr; /* descriptor index in the superblock */ |
@@ -125,6 +128,7 @@ struct mddev_s | |||
125 | #define MD_CHANGE_DEVS 0 /* Some device status has changed */ | 128 | #define MD_CHANGE_DEVS 0 /* Some device status has changed */ |
126 | #define MD_CHANGE_CLEAN 1 /* transition to or from 'clean' */ | 129 | #define MD_CHANGE_CLEAN 1 /* transition to or from 'clean' */ |
127 | #define MD_CHANGE_PENDING 2 /* superblock update in progress */ | 130 | #define MD_CHANGE_PENDING 2 /* superblock update in progress */ |
131 | #define MD_NOTIFY_ARRAY_STATE 3 /* atomic context wants to notify userspace */ | ||
128 | 132 | ||
129 | int ro; | 133 | int ro; |
130 | 134 | ||
@@ -147,7 +151,7 @@ struct mddev_s | |||
147 | int raid_disks; | 151 | int raid_disks; |
148 | int max_disks; | 152 | int max_disks; |
149 | sector_t size; /* used size of component devices */ | 153 | sector_t size; /* used size of component devices */ |
150 | sector_t array_size; /* exported array size */ | 154 | sector_t array_sectors; /* exported array size */ |
151 | __u64 events; | 155 | __u64 events; |
152 | 156 | ||
153 | char uuid[16]; | 157 | char uuid[16]; |
@@ -188,6 +192,7 @@ struct mddev_s | |||
188 | * NEEDED: we might need to start a resync/recover | 192 | * NEEDED: we might need to start a resync/recover |
189 | * RUNNING: a thread is running, or about to be started | 193 | * RUNNING: a thread is running, or about to be started |
190 | * SYNC: actually doing a resync, not a recovery | 194 | * SYNC: actually doing a resync, not a recovery |
195 | * RECOVER: doing recovery, or need to try it. | ||
191 | * INTR: resync needs to be aborted for some reason | 196 | * INTR: resync needs to be aborted for some reason |
192 | * DONE: thread is done and is waiting to be reaped | 197 | * DONE: thread is done and is waiting to be reaped |
193 | * REQUEST: user-space has requested a sync (used with SYNC) | 198 | * REQUEST: user-space has requested a sync (used with SYNC) |
@@ -198,6 +203,7 @@ struct mddev_s | |||
198 | */ | 203 | */ |
199 | #define MD_RECOVERY_RUNNING 0 | 204 | #define MD_RECOVERY_RUNNING 0 |
200 | #define MD_RECOVERY_SYNC 1 | 205 | #define MD_RECOVERY_SYNC 1 |
206 | #define MD_RECOVERY_RECOVER 2 | ||
201 | #define MD_RECOVERY_INTR 3 | 207 | #define MD_RECOVERY_INTR 3 |
202 | #define MD_RECOVERY_DONE 4 | 208 | #define MD_RECOVERY_DONE 4 |
203 | #define MD_RECOVERY_NEEDED 5 | 209 | #define MD_RECOVERY_NEEDED 5 |
@@ -210,7 +216,8 @@ struct mddev_s | |||
210 | 216 | ||
211 | int in_sync; /* know to not need resync */ | 217 | int in_sync; /* know to not need resync */ |
212 | struct mutex reconfig_mutex; | 218 | struct mutex reconfig_mutex; |
213 | atomic_t active; | 219 | atomic_t active; /* general refcount */ |
220 | atomic_t openers; /* number of active opens */ | ||
214 | 221 | ||
215 | int changed; /* true if we might need to reread partition info */ | 222 | int changed; /* true if we might need to reread partition info */ |
216 | int degraded; /* whether md should consider | 223 | int degraded; /* whether md should consider |
@@ -227,6 +234,8 @@ struct mddev_s | |||
227 | atomic_t recovery_active; /* blocks scheduled, but not written */ | 234 | atomic_t recovery_active; /* blocks scheduled, but not written */ |
228 | wait_queue_head_t recovery_wait; | 235 | wait_queue_head_t recovery_wait; |
229 | sector_t recovery_cp; | 236 | sector_t recovery_cp; |
237 | sector_t resync_min; /* user requested sync | ||
238 | * starts here */ | ||
230 | sector_t resync_max; /* resync should pause | 239 | sector_t resync_max; /* resync should pause |
231 | * when it gets here */ | 240 | * when it gets here */ |
232 | 241 | ||
@@ -331,6 +340,9 @@ static inline char * mdname (mddev_t * mddev) | |||
331 | #define rdev_for_each(rdev, tmp, mddev) \ | 340 | #define rdev_for_each(rdev, tmp, mddev) \ |
332 | rdev_for_each_list(rdev, tmp, (mddev)->disks) | 341 | rdev_for_each_list(rdev, tmp, (mddev)->disks) |
333 | 342 | ||
343 | #define rdev_for_each_rcu(rdev, mddev) \ | ||
344 | list_for_each_entry_rcu(rdev, &((mddev)->disks), same_set) | ||
345 | |||
334 | typedef struct mdk_thread_s { | 346 | typedef struct mdk_thread_s { |
335 | void (*run) (mddev_t *mddev); | 347 | void (*run) (mddev_t *mddev); |
336 | mddev_t *mddev; | 348 | mddev_t *mddev; |
diff --git a/include/linux/raid/md_p.h b/include/linux/raid/md_p.h index 3f2cd98c508b..8b4de4a41ff1 100644 --- a/include/linux/raid/md_p.h +++ b/include/linux/raid/md_p.h | |||
@@ -43,14 +43,11 @@ | |||
43 | */ | 43 | */ |
44 | #define MD_RESERVED_BYTES (64 * 1024) | 44 | #define MD_RESERVED_BYTES (64 * 1024) |
45 | #define MD_RESERVED_SECTORS (MD_RESERVED_BYTES / 512) | 45 | #define MD_RESERVED_SECTORS (MD_RESERVED_BYTES / 512) |
46 | #define MD_RESERVED_BLOCKS (MD_RESERVED_BYTES / BLOCK_SIZE) | ||
47 | 46 | ||
48 | #define MD_NEW_SIZE_SECTORS(x) ((x & ~(MD_RESERVED_SECTORS - 1)) - MD_RESERVED_SECTORS) | 47 | #define MD_NEW_SIZE_SECTORS(x) ((x & ~(MD_RESERVED_SECTORS - 1)) - MD_RESERVED_SECTORS) |
49 | #define MD_NEW_SIZE_BLOCKS(x) ((x & ~(MD_RESERVED_BLOCKS - 1)) - MD_RESERVED_BLOCKS) | ||
50 | 48 | ||
51 | #define MD_SB_BYTES 4096 | 49 | #define MD_SB_BYTES 4096 |
52 | #define MD_SB_WORDS (MD_SB_BYTES / 4) | 50 | #define MD_SB_WORDS (MD_SB_BYTES / 4) |
53 | #define MD_SB_BLOCKS (MD_SB_BYTES / BLOCK_SIZE) | ||
54 | #define MD_SB_SECTORS (MD_SB_BYTES / 512) | 51 | #define MD_SB_SECTORS (MD_SB_BYTES / 512) |
55 | 52 | ||
56 | /* | 53 | /* |
diff --git a/include/linux/raid/raid5.h b/include/linux/raid/raid5.h index f0827d31ae6f..3b2672792457 100644 --- a/include/linux/raid/raid5.h +++ b/include/linux/raid/raid5.h | |||
@@ -158,6 +158,43 @@ | |||
158 | * the compute block completes. | 158 | * the compute block completes. |
159 | */ | 159 | */ |
160 | 160 | ||
161 | /* | ||
162 | * Operations state - intermediate states that are visible outside of sh->lock | ||
163 | * In general _idle indicates nothing is running, _run indicates a data | ||
164 | * processing operation is active, and _result means the data processing result | ||
165 | * is stable and can be acted upon. For simple operations like biofill and | ||
166 | * compute that only have an _idle and _run state they are indicated with | ||
167 | * sh->state flags (STRIPE_BIOFILL_RUN and STRIPE_COMPUTE_RUN) | ||
168 | */ | ||
169 | /** | ||
170 | * enum check_states - handles syncing / repairing a stripe | ||
171 | * @check_state_idle - check operations are quiesced | ||
172 | * @check_state_run - check operation is running | ||
173 | * @check_state_result - set outside lock when check result is valid | ||
174 | * @check_state_compute_run - check failed and we are repairing | ||
175 | * @check_state_compute_result - set outside lock when compute result is valid | ||
176 | */ | ||
177 | enum check_states { | ||
178 | check_state_idle = 0, | ||
179 | check_state_run, /* parity check */ | ||
180 | check_state_check_result, | ||
181 | check_state_compute_run, /* parity repair */ | ||
182 | check_state_compute_result, | ||
183 | }; | ||
184 | |||
185 | /** | ||
186 | * enum reconstruct_states - handles writing or expanding a stripe | ||
187 | */ | ||
188 | enum reconstruct_states { | ||
189 | reconstruct_state_idle = 0, | ||
190 | reconstruct_state_prexor_drain_run, /* prexor-write */ | ||
191 | reconstruct_state_drain_run, /* write */ | ||
192 | reconstruct_state_run, /* expand */ | ||
193 | reconstruct_state_prexor_drain_result, | ||
194 | reconstruct_state_drain_result, | ||
195 | reconstruct_state_result, | ||
196 | }; | ||
197 | |||
161 | struct stripe_head { | 198 | struct stripe_head { |
162 | struct hlist_node hash; | 199 | struct hlist_node hash; |
163 | struct list_head lru; /* inactive_list or handle_list */ | 200 | struct list_head lru; /* inactive_list or handle_list */ |
@@ -169,19 +206,13 @@ struct stripe_head { | |||
169 | spinlock_t lock; | 206 | spinlock_t lock; |
170 | int bm_seq; /* sequence number for bitmap flushes */ | 207 | int bm_seq; /* sequence number for bitmap flushes */ |
171 | int disks; /* disks in stripe */ | 208 | int disks; /* disks in stripe */ |
209 | enum check_states check_state; | ||
210 | enum reconstruct_states reconstruct_state; | ||
172 | /* stripe_operations | 211 | /* stripe_operations |
173 | * @pending - pending ops flags (set for request->issue->complete) | ||
174 | * @ack - submitted ops flags (set for issue->complete) | ||
175 | * @complete - completed ops flags (set for complete) | ||
176 | * @target - STRIPE_OP_COMPUTE_BLK target | 212 | * @target - STRIPE_OP_COMPUTE_BLK target |
177 | * @count - raid5_runs_ops is set to run when this is non-zero | ||
178 | */ | 213 | */ |
179 | struct stripe_operations { | 214 | struct stripe_operations { |
180 | unsigned long pending; | ||
181 | unsigned long ack; | ||
182 | unsigned long complete; | ||
183 | int target; | 215 | int target; |
184 | int count; | ||
185 | u32 zero_sum_result; | 216 | u32 zero_sum_result; |
186 | } ops; | 217 | } ops; |
187 | struct r5dev { | 218 | struct r5dev { |
@@ -202,6 +233,7 @@ struct stripe_head_state { | |||
202 | int locked, uptodate, to_read, to_write, failed, written; | 233 | int locked, uptodate, to_read, to_write, failed, written; |
203 | int to_fill, compute, req_compute, non_overwrite; | 234 | int to_fill, compute, req_compute, non_overwrite; |
204 | int failed_num; | 235 | int failed_num; |
236 | unsigned long ops_request; | ||
205 | }; | 237 | }; |
206 | 238 | ||
207 | /* r6_state - extra state data only relevant to r6 */ | 239 | /* r6_state - extra state data only relevant to r6 */ |
@@ -228,9 +260,7 @@ struct r6_state { | |||
228 | #define R5_Wantfill 12 /* dev->toread contains a bio that needs | 260 | #define R5_Wantfill 12 /* dev->toread contains a bio that needs |
229 | * filling | 261 | * filling |
230 | */ | 262 | */ |
231 | #define R5_Wantprexor 13 /* distinguish blocks ready for rmw from | 263 | #define R5_Wantdrain 13 /* dev->towrite needs to be drained */ |
232 | * other "towrites" | ||
233 | */ | ||
234 | /* | 264 | /* |
235 | * Write method | 265 | * Write method |
236 | */ | 266 | */ |
@@ -254,8 +284,10 @@ struct r6_state { | |||
254 | #define STRIPE_EXPAND_READY 11 | 284 | #define STRIPE_EXPAND_READY 11 |
255 | #define STRIPE_IO_STARTED 12 /* do not count towards 'bypass_count' */ | 285 | #define STRIPE_IO_STARTED 12 /* do not count towards 'bypass_count' */ |
256 | #define STRIPE_FULL_WRITE 13 /* all blocks are set to be overwritten */ | 286 | #define STRIPE_FULL_WRITE 13 /* all blocks are set to be overwritten */ |
287 | #define STRIPE_BIOFILL_RUN 14 | ||
288 | #define STRIPE_COMPUTE_RUN 15 | ||
257 | /* | 289 | /* |
258 | * Operations flags (in issue order) | 290 | * Operation request flags |
259 | */ | 291 | */ |
260 | #define STRIPE_OP_BIOFILL 0 | 292 | #define STRIPE_OP_BIOFILL 0 |
261 | #define STRIPE_OP_COMPUTE_BLK 1 | 293 | #define STRIPE_OP_COMPUTE_BLK 1 |
@@ -263,14 +295,6 @@ struct r6_state { | |||
263 | #define STRIPE_OP_BIODRAIN 3 | 295 | #define STRIPE_OP_BIODRAIN 3 |
264 | #define STRIPE_OP_POSTXOR 4 | 296 | #define STRIPE_OP_POSTXOR 4 |
265 | #define STRIPE_OP_CHECK 5 | 297 | #define STRIPE_OP_CHECK 5 |
266 | #define STRIPE_OP_IO 6 | ||
267 | |||
268 | /* modifiers to the base operations | ||
269 | * STRIPE_OP_MOD_REPAIR_PD - compute the parity block and write it back | ||
270 | * STRIPE_OP_MOD_DMA_CHECK - parity is not corrupted by the check | ||
271 | */ | ||
272 | #define STRIPE_OP_MOD_REPAIR_PD 7 | ||
273 | #define STRIPE_OP_MOD_DMA_CHECK 8 | ||
274 | 298 | ||
275 | /* | 299 | /* |
276 | * Plugging: | 300 | * Plugging: |
diff --git a/include/linux/ramfs.h b/include/linux/ramfs.h index b160fb18e8d6..37aaf2b39863 100644 --- a/include/linux/ramfs.h +++ b/include/linux/ramfs.h | |||
@@ -6,6 +6,7 @@ extern int ramfs_get_sb(struct file_system_type *fs_type, | |||
6 | int flags, const char *dev_name, void *data, struct vfsmount *mnt); | 6 | int flags, const char *dev_name, void *data, struct vfsmount *mnt); |
7 | 7 | ||
8 | #ifndef CONFIG_MMU | 8 | #ifndef CONFIG_MMU |
9 | extern int ramfs_nommu_expand_for_mapping(struct inode *inode, size_t newsize); | ||
9 | extern unsigned long ramfs_nommu_get_unmapped_area(struct file *file, | 10 | extern unsigned long ramfs_nommu_get_unmapped_area(struct file *file, |
10 | unsigned long addr, | 11 | unsigned long addr, |
11 | unsigned long len, | 12 | unsigned long len, |
diff --git a/include/linux/ratelimit.h b/include/linux/ratelimit.h new file mode 100644 index 000000000000..18a5b9ba9d40 --- /dev/null +++ b/include/linux/ratelimit.h | |||
@@ -0,0 +1,27 @@ | |||
1 | #ifndef _LINUX_RATELIMIT_H | ||
2 | #define _LINUX_RATELIMIT_H | ||
3 | #include <linux/param.h> | ||
4 | |||
5 | #define DEFAULT_RATELIMIT_INTERVAL (5 * HZ) | ||
6 | #define DEFAULT_RATELIMIT_BURST 10 | ||
7 | |||
8 | struct ratelimit_state { | ||
9 | int interval; | ||
10 | int burst; | ||
11 | int printed; | ||
12 | int missed; | ||
13 | unsigned long begin; | ||
14 | }; | ||
15 | |||
16 | #define DEFINE_RATELIMIT_STATE(name, interval, burst) \ | ||
17 | struct ratelimit_state name = {interval, burst,} | ||
18 | |||
19 | extern int __ratelimit(struct ratelimit_state *rs); | ||
20 | |||
21 | static inline int ratelimit(void) | ||
22 | { | ||
23 | static DEFINE_RATELIMIT_STATE(rs, DEFAULT_RATELIMIT_INTERVAL, | ||
24 | DEFAULT_RATELIMIT_BURST); | ||
25 | return __ratelimit(&rs); | ||
26 | } | ||
27 | #endif | ||
diff --git a/include/linux/rcuclassic.h b/include/linux/rcuclassic.h index b3aa05baab8a..5f89b62e6983 100644 --- a/include/linux/rcuclassic.h +++ b/include/linux/rcuclassic.h | |||
@@ -40,12 +40,21 @@ | |||
40 | #include <linux/cpumask.h> | 40 | #include <linux/cpumask.h> |
41 | #include <linux/seqlock.h> | 41 | #include <linux/seqlock.h> |
42 | 42 | ||
43 | #ifdef CONFIG_RCU_CPU_STALL_DETECTOR | ||
44 | #define RCU_SECONDS_TILL_STALL_CHECK ( 3 * HZ) /* for rcp->jiffies_stall */ | ||
45 | #define RCU_SECONDS_TILL_STALL_RECHECK (30 * HZ) /* for rcp->jiffies_stall */ | ||
46 | #endif /* #ifdef CONFIG_RCU_CPU_STALL_DETECTOR */ | ||
43 | 47 | ||
44 | /* Global control variables for rcupdate callback mechanism. */ | 48 | /* Global control variables for rcupdate callback mechanism. */ |
45 | struct rcu_ctrlblk { | 49 | struct rcu_ctrlblk { |
46 | long cur; /* Current batch number. */ | 50 | long cur; /* Current batch number. */ |
47 | long completed; /* Number of the last completed batch */ | 51 | long completed; /* Number of the last completed batch */ |
48 | int next_pending; /* Is the next batch already waiting? */ | 52 | long pending; /* Number of the last pending batch */ |
53 | #ifdef CONFIG_RCU_CPU_STALL_DETECTOR | ||
54 | unsigned long gp_start; /* Time at which GP started in jiffies. */ | ||
55 | unsigned long jiffies_stall; | ||
56 | /* Time at which to check for CPU stalls. */ | ||
57 | #endif /* #ifdef CONFIG_RCU_CPU_STALL_DETECTOR */ | ||
49 | 58 | ||
50 | int signaled; | 59 | int signaled; |
51 | 60 | ||
@@ -66,11 +75,7 @@ static inline int rcu_batch_after(long a, long b) | |||
66 | return (a - b) > 0; | 75 | return (a - b) > 0; |
67 | } | 76 | } |
68 | 77 | ||
69 | /* | 78 | /* Per-CPU data for Read-Copy UPdate. */ |
70 | * Per-CPU data for Read-Copy UPdate. | ||
71 | * nxtlist - new callbacks are added here | ||
72 | * curlist - current batch for which quiescent cycle started if any | ||
73 | */ | ||
74 | struct rcu_data { | 79 | struct rcu_data { |
75 | /* 1) quiescent state handling : */ | 80 | /* 1) quiescent state handling : */ |
76 | long quiescbatch; /* Batch # for grace period */ | 81 | long quiescbatch; /* Batch # for grace period */ |
@@ -78,12 +83,24 @@ struct rcu_data { | |||
78 | int qs_pending; /* core waits for quiesc state */ | 83 | int qs_pending; /* core waits for quiesc state */ |
79 | 84 | ||
80 | /* 2) batch handling */ | 85 | /* 2) batch handling */ |
81 | long batch; /* Batch # for current RCU batch */ | 86 | /* |
87 | * if nxtlist is not NULL, then: | ||
88 | * batch: | ||
89 | * The batch # for the last entry of nxtlist | ||
90 | * [*nxttail[1], NULL = *nxttail[2]): | ||
91 | * Entries that batch # <= batch | ||
92 | * [*nxttail[0], *nxttail[1]): | ||
93 | * Entries that batch # <= batch - 1 | ||
94 | * [nxtlist, *nxttail[0]): | ||
95 | * Entries that batch # <= batch - 2 | ||
96 | * The grace period for these entries has completed, and | ||
97 | * the other grace-period-completed entries may be moved | ||
98 | * here temporarily in rcu_process_callbacks(). | ||
99 | */ | ||
100 | long batch; | ||
82 | struct rcu_head *nxtlist; | 101 | struct rcu_head *nxtlist; |
83 | struct rcu_head **nxttail; | 102 | struct rcu_head **nxttail[3]; |
84 | long qlen; /* # of queued callbacks */ | 103 | long qlen; /* # of queued callbacks */ |
85 | struct rcu_head *curlist; | ||
86 | struct rcu_head **curtail; | ||
87 | struct rcu_head *donelist; | 104 | struct rcu_head *donelist; |
88 | struct rcu_head **donetail; | 105 | struct rcu_head **donetail; |
89 | long blimit; /* Upper limit on a processed batch */ | 106 | long blimit; /* Upper limit on a processed batch */ |
@@ -117,7 +134,7 @@ extern int rcu_needs_cpu(int cpu); | |||
117 | #ifdef CONFIG_DEBUG_LOCK_ALLOC | 134 | #ifdef CONFIG_DEBUG_LOCK_ALLOC |
118 | extern struct lockdep_map rcu_lock_map; | 135 | extern struct lockdep_map rcu_lock_map; |
119 | # define rcu_read_acquire() \ | 136 | # define rcu_read_acquire() \ |
120 | lock_acquire(&rcu_lock_map, 0, 0, 2, 1, _THIS_IP_) | 137 | lock_acquire(&rcu_lock_map, 0, 0, 2, 1, NULL, _THIS_IP_) |
121 | # define rcu_read_release() lock_release(&rcu_lock_map, 1, _THIS_IP_) | 138 | # define rcu_read_release() lock_release(&rcu_lock_map, 1, _THIS_IP_) |
122 | #else | 139 | #else |
123 | # define rcu_read_acquire() do { } while (0) | 140 | # define rcu_read_acquire() do { } while (0) |
@@ -151,7 +168,10 @@ extern struct lockdep_map rcu_lock_map; | |||
151 | 168 | ||
152 | #define __synchronize_sched() synchronize_rcu() | 169 | #define __synchronize_sched() synchronize_rcu() |
153 | 170 | ||
171 | #define call_rcu_sched(head, func) call_rcu(head, func) | ||
172 | |||
154 | extern void __rcu_init(void); | 173 | extern void __rcu_init(void); |
174 | #define rcu_init_sched() do { } while (0) | ||
155 | extern void rcu_check_callbacks(int cpu, int user); | 175 | extern void rcu_check_callbacks(int cpu, int user); |
156 | extern void rcu_restart_cpu(int cpu); | 176 | extern void rcu_restart_cpu(int cpu); |
157 | 177 | ||
diff --git a/include/linux/rculist.h b/include/linux/rculist.h new file mode 100644 index 000000000000..e649bd3f2c97 --- /dev/null +++ b/include/linux/rculist.h | |||
@@ -0,0 +1,387 @@ | |||
1 | #ifndef _LINUX_RCULIST_H | ||
2 | #define _LINUX_RCULIST_H | ||
3 | |||
4 | #ifdef __KERNEL__ | ||
5 | |||
6 | /* | ||
7 | * RCU-protected list version | ||
8 | */ | ||
9 | #include <linux/list.h> | ||
10 | #include <linux/rcupdate.h> | ||
11 | |||
12 | /* | ||
13 | * Insert a new entry between two known consecutive entries. | ||
14 | * | ||
15 | * This is only for internal list manipulation where we know | ||
16 | * the prev/next entries already! | ||
17 | */ | ||
18 | static inline void __list_add_rcu(struct list_head *new, | ||
19 | struct list_head *prev, struct list_head *next) | ||
20 | { | ||
21 | new->next = next; | ||
22 | new->prev = prev; | ||
23 | rcu_assign_pointer(prev->next, new); | ||
24 | next->prev = new; | ||
25 | } | ||
26 | |||
27 | /** | ||
28 | * list_add_rcu - add a new entry to rcu-protected list | ||
29 | * @new: new entry to be added | ||
30 | * @head: list head to add it after | ||
31 | * | ||
32 | * Insert a new entry after the specified head. | ||
33 | * This is good for implementing stacks. | ||
34 | * | ||
35 | * The caller must take whatever precautions are necessary | ||
36 | * (such as holding appropriate locks) to avoid racing | ||
37 | * with another list-mutation primitive, such as list_add_rcu() | ||
38 | * or list_del_rcu(), running on this same list. | ||
39 | * However, it is perfectly legal to run concurrently with | ||
40 | * the _rcu list-traversal primitives, such as | ||
41 | * list_for_each_entry_rcu(). | ||
42 | */ | ||
43 | static inline void list_add_rcu(struct list_head *new, struct list_head *head) | ||
44 | { | ||
45 | __list_add_rcu(new, head, head->next); | ||
46 | } | ||
47 | |||
48 | /** | ||
49 | * list_add_tail_rcu - add a new entry to rcu-protected list | ||
50 | * @new: new entry to be added | ||
51 | * @head: list head to add it before | ||
52 | * | ||
53 | * Insert a new entry before the specified head. | ||
54 | * This is useful for implementing queues. | ||
55 | * | ||
56 | * The caller must take whatever precautions are necessary | ||
57 | * (such as holding appropriate locks) to avoid racing | ||
58 | * with another list-mutation primitive, such as list_add_tail_rcu() | ||
59 | * or list_del_rcu(), running on this same list. | ||
60 | * However, it is perfectly legal to run concurrently with | ||
61 | * the _rcu list-traversal primitives, such as | ||
62 | * list_for_each_entry_rcu(). | ||
63 | */ | ||
64 | static inline void list_add_tail_rcu(struct list_head *new, | ||
65 | struct list_head *head) | ||
66 | { | ||
67 | __list_add_rcu(new, head->prev, head); | ||
68 | } | ||
69 | |||
70 | /** | ||
71 | * list_del_rcu - deletes entry from list without re-initialization | ||
72 | * @entry: the element to delete from the list. | ||
73 | * | ||
74 | * Note: list_empty() on entry does not return true after this, | ||
75 | * the entry is in an undefined state. It is useful for RCU based | ||
76 | * lockfree traversal. | ||
77 | * | ||
78 | * In particular, it means that we can not poison the forward | ||
79 | * pointers that may still be used for walking the list. | ||
80 | * | ||
81 | * The caller must take whatever precautions are necessary | ||
82 | * (such as holding appropriate locks) to avoid racing | ||
83 | * with another list-mutation primitive, such as list_del_rcu() | ||
84 | * or list_add_rcu(), running on this same list. | ||
85 | * However, it is perfectly legal to run concurrently with | ||
86 | * the _rcu list-traversal primitives, such as | ||
87 | * list_for_each_entry_rcu(). | ||
88 | * | ||
89 | * Note that the caller is not permitted to immediately free | ||
90 | * the newly deleted entry. Instead, either synchronize_rcu() | ||
91 | * or call_rcu() must be used to defer freeing until an RCU | ||
92 | * grace period has elapsed. | ||
93 | */ | ||
94 | static inline void list_del_rcu(struct list_head *entry) | ||
95 | { | ||
96 | __list_del(entry->prev, entry->next); | ||
97 | entry->prev = LIST_POISON2; | ||
98 | } | ||
99 | |||
100 | /** | ||
101 | * hlist_del_init_rcu - deletes entry from hash list with re-initialization | ||
102 | * @n: the element to delete from the hash list. | ||
103 | * | ||
104 | * Note: list_unhashed() on the node return true after this. It is | ||
105 | * useful for RCU based read lockfree traversal if the writer side | ||
106 | * must know if the list entry is still hashed or already unhashed. | ||
107 | * | ||
108 | * In particular, it means that we can not poison the forward pointers | ||
109 | * that may still be used for walking the hash list and we can only | ||
110 | * zero the pprev pointer so list_unhashed() will return true after | ||
111 | * this. | ||
112 | * | ||
113 | * The caller must take whatever precautions are necessary (such as | ||
114 | * holding appropriate locks) to avoid racing with another | ||
115 | * list-mutation primitive, such as hlist_add_head_rcu() or | ||
116 | * hlist_del_rcu(), running on this same list. However, it is | ||
117 | * perfectly legal to run concurrently with the _rcu list-traversal | ||
118 | * primitives, such as hlist_for_each_entry_rcu(). | ||
119 | */ | ||
120 | static inline void hlist_del_init_rcu(struct hlist_node *n) | ||
121 | { | ||
122 | if (!hlist_unhashed(n)) { | ||
123 | __hlist_del(n); | ||
124 | n->pprev = NULL; | ||
125 | } | ||
126 | } | ||
127 | |||
128 | /** | ||
129 | * list_replace_rcu - replace old entry by new one | ||
130 | * @old : the element to be replaced | ||
131 | * @new : the new element to insert | ||
132 | * | ||
133 | * The @old entry will be replaced with the @new entry atomically. | ||
134 | * Note: @old should not be empty. | ||
135 | */ | ||
136 | static inline void list_replace_rcu(struct list_head *old, | ||
137 | struct list_head *new) | ||
138 | { | ||
139 | new->next = old->next; | ||
140 | new->prev = old->prev; | ||
141 | rcu_assign_pointer(new->prev->next, new); | ||
142 | new->next->prev = new; | ||
143 | old->prev = LIST_POISON2; | ||
144 | } | ||
145 | |||
146 | /** | ||
147 | * list_splice_init_rcu - splice an RCU-protected list into an existing list. | ||
148 | * @list: the RCU-protected list to splice | ||
149 | * @head: the place in the list to splice the first list into | ||
150 | * @sync: function to sync: synchronize_rcu(), synchronize_sched(), ... | ||
151 | * | ||
152 | * @head can be RCU-read traversed concurrently with this function. | ||
153 | * | ||
154 | * Note that this function blocks. | ||
155 | * | ||
156 | * Important note: the caller must take whatever action is necessary to | ||
157 | * prevent any other updates to @head. In principle, it is possible | ||
158 | * to modify the list as soon as sync() begins execution. | ||
159 | * If this sort of thing becomes necessary, an alternative version | ||
160 | * based on call_rcu() could be created. But only if -really- | ||
161 | * needed -- there is no shortage of RCU API members. | ||
162 | */ | ||
163 | static inline void list_splice_init_rcu(struct list_head *list, | ||
164 | struct list_head *head, | ||
165 | void (*sync)(void)) | ||
166 | { | ||
167 | struct list_head *first = list->next; | ||
168 | struct list_head *last = list->prev; | ||
169 | struct list_head *at = head->next; | ||
170 | |||
171 | if (list_empty(head)) | ||
172 | return; | ||
173 | |||
174 | /* "first" and "last" tracking list, so initialize it. */ | ||
175 | |||
176 | INIT_LIST_HEAD(list); | ||
177 | |||
178 | /* | ||
179 | * At this point, the list body still points to the source list. | ||
180 | * Wait for any readers to finish using the list before splicing | ||
181 | * the list body into the new list. Any new readers will see | ||
182 | * an empty list. | ||
183 | */ | ||
184 | |||
185 | sync(); | ||
186 | |||
187 | /* | ||
188 | * Readers are finished with the source list, so perform splice. | ||
189 | * The order is important if the new list is global and accessible | ||
190 | * to concurrent RCU readers. Note that RCU readers are not | ||
191 | * permitted to traverse the prev pointers without excluding | ||
192 | * this function. | ||
193 | */ | ||
194 | |||
195 | last->next = at; | ||
196 | rcu_assign_pointer(head->next, first); | ||
197 | first->prev = head; | ||
198 | at->prev = last; | ||
199 | } | ||
200 | |||
201 | #define __list_for_each_rcu(pos, head) \ | ||
202 | for (pos = rcu_dereference((head)->next); \ | ||
203 | pos != (head); \ | ||
204 | pos = rcu_dereference(pos->next)) | ||
205 | |||
206 | /** | ||
207 | * list_for_each_entry_rcu - iterate over rcu list of given type | ||
208 | * @pos: the type * to use as a loop cursor. | ||
209 | * @head: the head for your list. | ||
210 | * @member: the name of the list_struct within the struct. | ||
211 | * | ||
212 | * This list-traversal primitive may safely run concurrently with | ||
213 | * the _rcu list-mutation primitives such as list_add_rcu() | ||
214 | * as long as the traversal is guarded by rcu_read_lock(). | ||
215 | */ | ||
216 | #define list_for_each_entry_rcu(pos, head, member) \ | ||
217 | for (pos = list_entry(rcu_dereference((head)->next), typeof(*pos), member); \ | ||
218 | prefetch(pos->member.next), &pos->member != (head); \ | ||
219 | pos = list_entry(rcu_dereference(pos->member.next), typeof(*pos), member)) | ||
220 | |||
221 | |||
222 | /** | ||
223 | * list_for_each_continue_rcu | ||
224 | * @pos: the &struct list_head to use as a loop cursor. | ||
225 | * @head: the head for your list. | ||
226 | * | ||
227 | * Iterate over an rcu-protected list, continuing after current point. | ||
228 | * | ||
229 | * This list-traversal primitive may safely run concurrently with | ||
230 | * the _rcu list-mutation primitives such as list_add_rcu() | ||
231 | * as long as the traversal is guarded by rcu_read_lock(). | ||
232 | */ | ||
233 | #define list_for_each_continue_rcu(pos, head) \ | ||
234 | for ((pos) = rcu_dereference((pos)->next); \ | ||
235 | prefetch((pos)->next), (pos) != (head); \ | ||
236 | (pos) = rcu_dereference((pos)->next)) | ||
237 | |||
238 | /** | ||
239 | * hlist_del_rcu - deletes entry from hash list without re-initialization | ||
240 | * @n: the element to delete from the hash list. | ||
241 | * | ||
242 | * Note: list_unhashed() on entry does not return true after this, | ||
243 | * the entry is in an undefined state. It is useful for RCU based | ||
244 | * lockfree traversal. | ||
245 | * | ||
246 | * In particular, it means that we can not poison the forward | ||
247 | * pointers that may still be used for walking the hash list. | ||
248 | * | ||
249 | * The caller must take whatever precautions are necessary | ||
250 | * (such as holding appropriate locks) to avoid racing | ||
251 | * with another list-mutation primitive, such as hlist_add_head_rcu() | ||
252 | * or hlist_del_rcu(), running on this same list. | ||
253 | * However, it is perfectly legal to run concurrently with | ||
254 | * the _rcu list-traversal primitives, such as | ||
255 | * hlist_for_each_entry(). | ||
256 | */ | ||
257 | static inline void hlist_del_rcu(struct hlist_node *n) | ||
258 | { | ||
259 | __hlist_del(n); | ||
260 | n->pprev = LIST_POISON2; | ||
261 | } | ||
262 | |||
263 | /** | ||
264 | * hlist_replace_rcu - replace old entry by new one | ||
265 | * @old : the element to be replaced | ||
266 | * @new : the new element to insert | ||
267 | * | ||
268 | * The @old entry will be replaced with the @new entry atomically. | ||
269 | */ | ||
270 | static inline void hlist_replace_rcu(struct hlist_node *old, | ||
271 | struct hlist_node *new) | ||
272 | { | ||
273 | struct hlist_node *next = old->next; | ||
274 | |||
275 | new->next = next; | ||
276 | new->pprev = old->pprev; | ||
277 | rcu_assign_pointer(*new->pprev, new); | ||
278 | if (next) | ||
279 | new->next->pprev = &new->next; | ||
280 | old->pprev = LIST_POISON2; | ||
281 | } | ||
282 | |||
283 | /** | ||
284 | * hlist_add_head_rcu | ||
285 | * @n: the element to add to the hash list. | ||
286 | * @h: the list to add to. | ||
287 | * | ||
288 | * Description: | ||
289 | * Adds the specified element to the specified hlist, | ||
290 | * while permitting racing traversals. | ||
291 | * | ||
292 | * The caller must take whatever precautions are necessary | ||
293 | * (such as holding appropriate locks) to avoid racing | ||
294 | * with another list-mutation primitive, such as hlist_add_head_rcu() | ||
295 | * or hlist_del_rcu(), running on this same list. | ||
296 | * However, it is perfectly legal to run concurrently with | ||
297 | * the _rcu list-traversal primitives, such as | ||
298 | * hlist_for_each_entry_rcu(), used to prevent memory-consistency | ||
299 | * problems on Alpha CPUs. Regardless of the type of CPU, the | ||
300 | * list-traversal primitive must be guarded by rcu_read_lock(). | ||
301 | */ | ||
302 | static inline void hlist_add_head_rcu(struct hlist_node *n, | ||
303 | struct hlist_head *h) | ||
304 | { | ||
305 | struct hlist_node *first = h->first; | ||
306 | |||
307 | n->next = first; | ||
308 | n->pprev = &h->first; | ||
309 | rcu_assign_pointer(h->first, n); | ||
310 | if (first) | ||
311 | first->pprev = &n->next; | ||
312 | } | ||
313 | |||
314 | /** | ||
315 | * hlist_add_before_rcu | ||
316 | * @n: the new element to add to the hash list. | ||
317 | * @next: the existing element to add the new element before. | ||
318 | * | ||
319 | * Description: | ||
320 | * Adds the specified element to the specified hlist | ||
321 | * before the specified node while permitting racing traversals. | ||
322 | * | ||
323 | * The caller must take whatever precautions are necessary | ||
324 | * (such as holding appropriate locks) to avoid racing | ||
325 | * with another list-mutation primitive, such as hlist_add_head_rcu() | ||
326 | * or hlist_del_rcu(), running on this same list. | ||
327 | * However, it is perfectly legal to run concurrently with | ||
328 | * the _rcu list-traversal primitives, such as | ||
329 | * hlist_for_each_entry_rcu(), used to prevent memory-consistency | ||
330 | * problems on Alpha CPUs. | ||
331 | */ | ||
332 | static inline void hlist_add_before_rcu(struct hlist_node *n, | ||
333 | struct hlist_node *next) | ||
334 | { | ||
335 | n->pprev = next->pprev; | ||
336 | n->next = next; | ||
337 | rcu_assign_pointer(*(n->pprev), n); | ||
338 | next->pprev = &n->next; | ||
339 | } | ||
340 | |||
341 | /** | ||
342 | * hlist_add_after_rcu | ||
343 | * @prev: the existing element to add the new element after. | ||
344 | * @n: the new element to add to the hash list. | ||
345 | * | ||
346 | * Description: | ||
347 | * Adds the specified element to the specified hlist | ||
348 | * after the specified node while permitting racing traversals. | ||
349 | * | ||
350 | * The caller must take whatever precautions are necessary | ||
351 | * (such as holding appropriate locks) to avoid racing | ||
352 | * with another list-mutation primitive, such as hlist_add_head_rcu() | ||
353 | * or hlist_del_rcu(), running on this same list. | ||
354 | * However, it is perfectly legal to run concurrently with | ||
355 | * the _rcu list-traversal primitives, such as | ||
356 | * hlist_for_each_entry_rcu(), used to prevent memory-consistency | ||
357 | * problems on Alpha CPUs. | ||
358 | */ | ||
359 | static inline void hlist_add_after_rcu(struct hlist_node *prev, | ||
360 | struct hlist_node *n) | ||
361 | { | ||
362 | n->next = prev->next; | ||
363 | n->pprev = &prev->next; | ||
364 | rcu_assign_pointer(prev->next, n); | ||
365 | if (n->next) | ||
366 | n->next->pprev = &n->next; | ||
367 | } | ||
368 | |||
369 | /** | ||
370 | * hlist_for_each_entry_rcu - iterate over rcu list of given type | ||
371 | * @tpos: the type * to use as a loop cursor. | ||
372 | * @pos: the &struct hlist_node to use as a loop cursor. | ||
373 | * @head: the head for your list. | ||
374 | * @member: the name of the hlist_node within the struct. | ||
375 | * | ||
376 | * This list-traversal primitive may safely run concurrently with | ||
377 | * the _rcu list-mutation primitives such as hlist_add_head_rcu() | ||
378 | * as long as the traversal is guarded by rcu_read_lock(). | ||
379 | */ | ||
380 | #define hlist_for_each_entry_rcu(tpos, pos, head, member) \ | ||
381 | for (pos = rcu_dereference((head)->first); \ | ||
382 | pos && ({ prefetch(pos->next); 1; }) && \ | ||
383 | ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1; }); \ | ||
384 | pos = rcu_dereference(pos->next)) | ||
385 | |||
386 | #endif /* __KERNEL__ */ | ||
387 | #endif | ||
diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h index d42dbec06083..86f1f5e43e33 100644 --- a/include/linux/rcupdate.h +++ b/include/linux/rcupdate.h | |||
@@ -40,6 +40,7 @@ | |||
40 | #include <linux/cpumask.h> | 40 | #include <linux/cpumask.h> |
41 | #include <linux/seqlock.h> | 41 | #include <linux/seqlock.h> |
42 | #include <linux/lockdep.h> | 42 | #include <linux/lockdep.h> |
43 | #include <linux/completion.h> | ||
43 | 44 | ||
44 | /** | 45 | /** |
45 | * struct rcu_head - callback structure for use with RCU | 46 | * struct rcu_head - callback structure for use with RCU |
@@ -132,6 +133,26 @@ struct rcu_head { | |||
132 | #define rcu_read_unlock_bh() __rcu_read_unlock_bh() | 133 | #define rcu_read_unlock_bh() __rcu_read_unlock_bh() |
133 | 134 | ||
134 | /** | 135 | /** |
136 | * rcu_read_lock_sched - mark the beginning of a RCU-classic critical section | ||
137 | * | ||
138 | * Should be used with either | ||
139 | * - synchronize_sched() | ||
140 | * or | ||
141 | * - call_rcu_sched() and rcu_barrier_sched() | ||
142 | * on the write-side to insure proper synchronization. | ||
143 | */ | ||
144 | #define rcu_read_lock_sched() preempt_disable() | ||
145 | |||
146 | /* | ||
147 | * rcu_read_unlock_sched - marks the end of a RCU-classic critical section | ||
148 | * | ||
149 | * See rcu_read_lock_sched for more information. | ||
150 | */ | ||
151 | #define rcu_read_unlock_sched() preempt_enable() | ||
152 | |||
153 | |||
154 | |||
155 | /** | ||
135 | * rcu_dereference - fetch an RCU-protected pointer in an | 156 | * rcu_dereference - fetch an RCU-protected pointer in an |
136 | * RCU read-side critical section. This pointer may later | 157 | * RCU read-side critical section. This pointer may later |
137 | * be safely dereferenced. | 158 | * be safely dereferenced. |
@@ -168,6 +189,27 @@ struct rcu_head { | |||
168 | (p) = (v); \ | 189 | (p) = (v); \ |
169 | }) | 190 | }) |
170 | 191 | ||
192 | /* Infrastructure to implement the synchronize_() primitives. */ | ||
193 | |||
194 | struct rcu_synchronize { | ||
195 | struct rcu_head head; | ||
196 | struct completion completion; | ||
197 | }; | ||
198 | |||
199 | extern void wakeme_after_rcu(struct rcu_head *head); | ||
200 | |||
201 | #define synchronize_rcu_xxx(name, func) \ | ||
202 | void name(void) \ | ||
203 | { \ | ||
204 | struct rcu_synchronize rcu; \ | ||
205 | \ | ||
206 | init_completion(&rcu.completion); \ | ||
207 | /* Will wake me after RCU finished. */ \ | ||
208 | func(&rcu.head, wakeme_after_rcu); \ | ||
209 | /* Wait for it. */ \ | ||
210 | wait_for_completion(&rcu.completion); \ | ||
211 | } | ||
212 | |||
171 | /** | 213 | /** |
172 | * synchronize_sched - block until all CPUs have exited any non-preemptive | 214 | * synchronize_sched - block until all CPUs have exited any non-preemptive |
173 | * kernel code sequences. | 215 | * kernel code sequences. |
@@ -224,8 +266,8 @@ extern void call_rcu_bh(struct rcu_head *head, | |||
224 | /* Exported common interfaces */ | 266 | /* Exported common interfaces */ |
225 | extern void synchronize_rcu(void); | 267 | extern void synchronize_rcu(void); |
226 | extern void rcu_barrier(void); | 268 | extern void rcu_barrier(void); |
227 | extern long rcu_batches_completed(void); | 269 | extern void rcu_barrier_bh(void); |
228 | extern long rcu_batches_completed_bh(void); | 270 | extern void rcu_barrier_sched(void); |
229 | 271 | ||
230 | /* Internal to kernel */ | 272 | /* Internal to kernel */ |
231 | extern void rcu_init(void); | 273 | extern void rcu_init(void); |
diff --git a/include/linux/rcupreempt.h b/include/linux/rcupreempt.h index 8a05c7e20bc4..3e05c09b54a2 100644 --- a/include/linux/rcupreempt.h +++ b/include/linux/rcupreempt.h | |||
@@ -40,9 +40,44 @@ | |||
40 | #include <linux/cpumask.h> | 40 | #include <linux/cpumask.h> |
41 | #include <linux/seqlock.h> | 41 | #include <linux/seqlock.h> |
42 | 42 | ||
43 | #define rcu_qsctr_inc(cpu) | 43 | struct rcu_dyntick_sched { |
44 | int dynticks; | ||
45 | int dynticks_snap; | ||
46 | int sched_qs; | ||
47 | int sched_qs_snap; | ||
48 | int sched_dynticks_snap; | ||
49 | }; | ||
50 | |||
51 | DECLARE_PER_CPU(struct rcu_dyntick_sched, rcu_dyntick_sched); | ||
52 | |||
53 | static inline void rcu_qsctr_inc(int cpu) | ||
54 | { | ||
55 | struct rcu_dyntick_sched *rdssp = &per_cpu(rcu_dyntick_sched, cpu); | ||
56 | |||
57 | rdssp->sched_qs++; | ||
58 | } | ||
44 | #define rcu_bh_qsctr_inc(cpu) | 59 | #define rcu_bh_qsctr_inc(cpu) |
45 | #define call_rcu_bh(head, rcu) call_rcu(head, rcu) | 60 | |
61 | /* | ||
62 | * Someone might want to pass call_rcu_bh as a function pointer. | ||
63 | * So this needs to just be a rename and not a macro function. | ||
64 | * (no parentheses) | ||
65 | */ | ||
66 | #define call_rcu_bh call_rcu | ||
67 | |||
68 | /** | ||
69 | * call_rcu_sched - Queue RCU callback for invocation after sched grace period. | ||
70 | * @head: structure to be used for queueing the RCU updates. | ||
71 | * @func: actual update function to be invoked after the grace period | ||
72 | * | ||
73 | * The update function will be invoked some time after a full | ||
74 | * synchronize_sched()-style grace period elapses, in other words after | ||
75 | * all currently executing preempt-disabled sections of code (including | ||
76 | * hardirq handlers, NMI handlers, and local_irq_save() blocks) have | ||
77 | * completed. | ||
78 | */ | ||
79 | extern void call_rcu_sched(struct rcu_head *head, | ||
80 | void (*func)(struct rcu_head *head)); | ||
46 | 81 | ||
47 | extern void __rcu_read_lock(void) __acquires(RCU); | 82 | extern void __rcu_read_lock(void) __acquires(RCU); |
48 | extern void __rcu_read_unlock(void) __releases(RCU); | 83 | extern void __rcu_read_unlock(void) __releases(RCU); |
@@ -55,6 +90,7 @@ extern int rcu_needs_cpu(int cpu); | |||
55 | extern void __synchronize_sched(void); | 90 | extern void __synchronize_sched(void); |
56 | 91 | ||
57 | extern void __rcu_init(void); | 92 | extern void __rcu_init(void); |
93 | extern void rcu_init_sched(void); | ||
58 | extern void rcu_check_callbacks(int cpu, int user); | 94 | extern void rcu_check_callbacks(int cpu, int user); |
59 | extern void rcu_restart_cpu(int cpu); | 95 | extern void rcu_restart_cpu(int cpu); |
60 | extern long rcu_batches_completed(void); | 96 | extern long rcu_batches_completed(void); |
@@ -81,20 +117,24 @@ extern struct rcupreempt_trace *rcupreempt_trace_cpu(int cpu); | |||
81 | struct softirq_action; | 117 | struct softirq_action; |
82 | 118 | ||
83 | #ifdef CONFIG_NO_HZ | 119 | #ifdef CONFIG_NO_HZ |
84 | DECLARE_PER_CPU(long, dynticks_progress_counter); | ||
85 | 120 | ||
86 | static inline void rcu_enter_nohz(void) | 121 | static inline void rcu_enter_nohz(void) |
87 | { | 122 | { |
123 | static DEFINE_RATELIMIT_STATE(rs, 10 * HZ, 1); | ||
124 | |||
88 | smp_mb(); /* CPUs seeing ++ must see prior RCU read-side crit sects */ | 125 | smp_mb(); /* CPUs seeing ++ must see prior RCU read-side crit sects */ |
89 | __get_cpu_var(dynticks_progress_counter)++; | 126 | __get_cpu_var(rcu_dyntick_sched).dynticks++; |
90 | WARN_ON(__get_cpu_var(dynticks_progress_counter) & 0x1); | 127 | WARN_ON_RATELIMIT(__get_cpu_var(rcu_dyntick_sched).dynticks & 0x1, &rs); |
91 | } | 128 | } |
92 | 129 | ||
93 | static inline void rcu_exit_nohz(void) | 130 | static inline void rcu_exit_nohz(void) |
94 | { | 131 | { |
95 | __get_cpu_var(dynticks_progress_counter)++; | 132 | static DEFINE_RATELIMIT_STATE(rs, 10 * HZ, 1); |
133 | |||
134 | __get_cpu_var(rcu_dyntick_sched).dynticks++; | ||
96 | smp_mb(); /* CPUs seeing ++ must see later RCU read-side crit sects */ | 135 | smp_mb(); /* CPUs seeing ++ must see later RCU read-side crit sects */ |
97 | WARN_ON(!(__get_cpu_var(dynticks_progress_counter) & 0x1)); | 136 | WARN_ON_RATELIMIT(!(__get_cpu_var(rcu_dyntick_sched).dynticks & 0x1), |
137 | &rs); | ||
98 | } | 138 | } |
99 | 139 | ||
100 | #else /* CONFIG_NO_HZ */ | 140 | #else /* CONFIG_NO_HZ */ |
diff --git a/include/linux/reboot.h b/include/linux/reboot.h index b93b541cf111..988e55fe649b 100644 --- a/include/linux/reboot.h +++ b/include/linux/reboot.h | |||
@@ -59,6 +59,7 @@ extern void machine_crash_shutdown(struct pt_regs *); | |||
59 | * Architecture independent implemenations of sys_reboot commands. | 59 | * Architecture independent implemenations of sys_reboot commands. |
60 | */ | 60 | */ |
61 | 61 | ||
62 | extern void kernel_restart_prepare(char *cmd); | ||
62 | extern void kernel_restart(char *cmd); | 63 | extern void kernel_restart(char *cmd); |
63 | extern void kernel_halt(void); | 64 | extern void kernel_halt(void); |
64 | extern void kernel_power_off(void); | 65 | extern void kernel_power_off(void); |
diff --git a/include/linux/regulator/bq24022.h b/include/linux/regulator/bq24022.h new file mode 100644 index 000000000000..e84b0a9feda5 --- /dev/null +++ b/include/linux/regulator/bq24022.h | |||
@@ -0,0 +1,21 @@ | |||
1 | /* | ||
2 | * Support for TI bq24022 (bqTINY-II) Dual Input (USB/AC Adpater) | ||
3 | * 1-Cell Li-Ion Charger connected via GPIOs. | ||
4 | * | ||
5 | * Copyright (c) 2008 Philipp Zabel | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License version 2 as | ||
9 | * published by the Free Software Foundation. | ||
10 | * | ||
11 | */ | ||
12 | |||
13 | /** | ||
14 | * bq24022_mach_info - platform data for bq24022 | ||
15 | * @gpio_nce: GPIO line connected to the nCE pin, used to enable / disable charging | ||
16 | * @gpio_iset2: GPIO line connected to the ISET2 pin, used to limit charging current to 100 mA / 500 mA | ||
17 | */ | ||
18 | struct bq24022_mach_info { | ||
19 | int gpio_nce; | ||
20 | int gpio_iset2; | ||
21 | }; | ||
diff --git a/include/linux/regulator/consumer.h b/include/linux/regulator/consumer.h new file mode 100644 index 000000000000..afdc4558bb94 --- /dev/null +++ b/include/linux/regulator/consumer.h | |||
@@ -0,0 +1,284 @@ | |||
1 | /* | ||
2 | * consumer.h -- SoC Regulator consumer support. | ||
3 | * | ||
4 | * Copyright (C) 2007, 2008 Wolfson Microelectronics PLC. | ||
5 | * | ||
6 | * Author: Liam Girdwood <lg@opensource.wolfsonmicro.com> | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License version 2 as | ||
10 | * published by the Free Software Foundation. | ||
11 | * | ||
12 | * Regulator Consumer Interface. | ||
13 | * | ||
14 | * A Power Management Regulator framework for SoC based devices. | ||
15 | * Features:- | ||
16 | * o Voltage and current level control. | ||
17 | * o Operating mode control. | ||
18 | * o Regulator status. | ||
19 | * o sysfs entries for showing client devices and status | ||
20 | * | ||
21 | * EXPERIMENTAL FEATURES: | ||
22 | * Dynamic Regulator operating Mode Switching (DRMS) - allows regulators | ||
23 | * to use most efficient operating mode depending upon voltage and load and | ||
24 | * is transparent to client drivers. | ||
25 | * | ||
26 | * e.g. Devices x,y,z share regulator r. Device x and y draw 20mA each during | ||
27 | * IO and 1mA at idle. Device z draws 100mA when under load and 5mA when | ||
28 | * idling. Regulator r has > 90% efficiency in NORMAL mode at loads > 100mA | ||
29 | * but this drops rapidly to 60% when below 100mA. Regulator r has > 90% | ||
30 | * efficiency in IDLE mode at loads < 10mA. Thus regulator r will operate | ||
31 | * in normal mode for loads > 10mA and in IDLE mode for load <= 10mA. | ||
32 | * | ||
33 | */ | ||
34 | |||
35 | #ifndef __LINUX_REGULATOR_CONSUMER_H_ | ||
36 | #define __LINUX_REGULATOR_CONSUMER_H_ | ||
37 | |||
38 | /* | ||
39 | * Regulator operating modes. | ||
40 | * | ||
41 | * Regulators can run in a variety of different operating modes depending on | ||
42 | * output load. This allows further system power savings by selecting the | ||
43 | * best (and most efficient) regulator mode for a desired load. | ||
44 | * | ||
45 | * Most drivers will only care about NORMAL. The modes below are generic and | ||
46 | * will probably not match the naming convention of your regulator data sheet | ||
47 | * but should match the use cases in the datasheet. | ||
48 | * | ||
49 | * In order of power efficiency (least efficient at top). | ||
50 | * | ||
51 | * Mode Description | ||
52 | * FAST Regulator can handle fast changes in it's load. | ||
53 | * e.g. useful in CPU voltage & frequency scaling where | ||
54 | * load can quickly increase with CPU frequency increases. | ||
55 | * | ||
56 | * NORMAL Normal regulator power supply mode. Most drivers will | ||
57 | * use this mode. | ||
58 | * | ||
59 | * IDLE Regulator runs in a more efficient mode for light | ||
60 | * loads. Can be used for devices that have a low power | ||
61 | * requirement during periods of inactivity. This mode | ||
62 | * may be more noisy than NORMAL and may not be able | ||
63 | * to handle fast load switching. | ||
64 | * | ||
65 | * STANDBY Regulator runs in the most efficient mode for very | ||
66 | * light loads. Can be used by devices when they are | ||
67 | * in a sleep/standby state. This mode is likely to be | ||
68 | * the most noisy and may not be able to handle fast load | ||
69 | * switching. | ||
70 | * | ||
71 | * NOTE: Most regulators will only support a subset of these modes. Some | ||
72 | * will only just support NORMAL. | ||
73 | * | ||
74 | * These modes can be OR'ed together to make up a mask of valid register modes. | ||
75 | */ | ||
76 | |||
77 | #define REGULATOR_MODE_FAST 0x1 | ||
78 | #define REGULATOR_MODE_NORMAL 0x2 | ||
79 | #define REGULATOR_MODE_IDLE 0x4 | ||
80 | #define REGULATOR_MODE_STANDBY 0x8 | ||
81 | |||
82 | /* | ||
83 | * Regulator notifier events. | ||
84 | * | ||
85 | * UNDER_VOLTAGE Regulator output is under voltage. | ||
86 | * OVER_CURRENT Regulator output current is too high. | ||
87 | * REGULATION_OUT Regulator output is out of regulation. | ||
88 | * FAIL Regulator output has failed. | ||
89 | * OVER_TEMP Regulator over temp. | ||
90 | * FORCE_DISABLE Regulator shut down by software. | ||
91 | * | ||
92 | * NOTE: These events can be OR'ed together when passed into handler. | ||
93 | */ | ||
94 | |||
95 | #define REGULATOR_EVENT_UNDER_VOLTAGE 0x01 | ||
96 | #define REGULATOR_EVENT_OVER_CURRENT 0x02 | ||
97 | #define REGULATOR_EVENT_REGULATION_OUT 0x04 | ||
98 | #define REGULATOR_EVENT_FAIL 0x08 | ||
99 | #define REGULATOR_EVENT_OVER_TEMP 0x10 | ||
100 | #define REGULATOR_EVENT_FORCE_DISABLE 0x20 | ||
101 | |||
102 | struct regulator; | ||
103 | |||
104 | /** | ||
105 | * struct regulator_bulk_data - Data used for bulk regulator operations. | ||
106 | * | ||
107 | * @supply The name of the supply. Initialised by the user before | ||
108 | * using the bulk regulator APIs. | ||
109 | * @consumer The regulator consumer for the supply. This will be managed | ||
110 | * by the bulk API. | ||
111 | * | ||
112 | * The regulator APIs provide a series of regulator_bulk_() API calls as | ||
113 | * a convenience to consumers which require multiple supplies. This | ||
114 | * structure is used to manage data for these calls. | ||
115 | */ | ||
116 | struct regulator_bulk_data { | ||
117 | const char *supply; | ||
118 | struct regulator *consumer; | ||
119 | }; | ||
120 | |||
121 | #if defined(CONFIG_REGULATOR) | ||
122 | |||
123 | /* regulator get and put */ | ||
124 | struct regulator *__must_check regulator_get(struct device *dev, | ||
125 | const char *id); | ||
126 | void regulator_put(struct regulator *regulator); | ||
127 | |||
128 | /* regulator output control and status */ | ||
129 | int regulator_enable(struct regulator *regulator); | ||
130 | int regulator_disable(struct regulator *regulator); | ||
131 | int regulator_force_disable(struct regulator *regulator); | ||
132 | int regulator_is_enabled(struct regulator *regulator); | ||
133 | |||
134 | int regulator_bulk_get(struct device *dev, int num_consumers, | ||
135 | struct regulator_bulk_data *consumers); | ||
136 | int regulator_bulk_enable(int num_consumers, | ||
137 | struct regulator_bulk_data *consumers); | ||
138 | int regulator_bulk_disable(int num_consumers, | ||
139 | struct regulator_bulk_data *consumers); | ||
140 | void regulator_bulk_free(int num_consumers, | ||
141 | struct regulator_bulk_data *consumers); | ||
142 | |||
143 | int regulator_set_voltage(struct regulator *regulator, int min_uV, int max_uV); | ||
144 | int regulator_get_voltage(struct regulator *regulator); | ||
145 | int regulator_set_current_limit(struct regulator *regulator, | ||
146 | int min_uA, int max_uA); | ||
147 | int regulator_get_current_limit(struct regulator *regulator); | ||
148 | |||
149 | int regulator_set_mode(struct regulator *regulator, unsigned int mode); | ||
150 | unsigned int regulator_get_mode(struct regulator *regulator); | ||
151 | int regulator_set_optimum_mode(struct regulator *regulator, int load_uA); | ||
152 | |||
153 | /* regulator notifier block */ | ||
154 | int regulator_register_notifier(struct regulator *regulator, | ||
155 | struct notifier_block *nb); | ||
156 | int regulator_unregister_notifier(struct regulator *regulator, | ||
157 | struct notifier_block *nb); | ||
158 | |||
159 | /* driver data - core doesn't touch */ | ||
160 | void *regulator_get_drvdata(struct regulator *regulator); | ||
161 | void regulator_set_drvdata(struct regulator *regulator, void *data); | ||
162 | |||
163 | #else | ||
164 | |||
165 | /* | ||
166 | * Make sure client drivers will still build on systems with no software | ||
167 | * controllable voltage or current regulators. | ||
168 | */ | ||
169 | static inline struct regulator *__must_check regulator_get(struct device *dev, | ||
170 | const char *id) | ||
171 | { | ||
172 | /* Nothing except the stubbed out regulator API should be | ||
173 | * looking at the value except to check if it is an error | ||
174 | * value so the actual return value doesn't matter. | ||
175 | */ | ||
176 | return (struct regulator *)id; | ||
177 | } | ||
178 | static inline void regulator_put(struct regulator *regulator) | ||
179 | { | ||
180 | } | ||
181 | |||
182 | static inline int regulator_enable(struct regulator *regulator) | ||
183 | { | ||
184 | return 0; | ||
185 | } | ||
186 | |||
187 | static inline int regulator_disable(struct regulator *regulator) | ||
188 | { | ||
189 | return 0; | ||
190 | } | ||
191 | |||
192 | static inline int regulator_is_enabled(struct regulator *regulator) | ||
193 | { | ||
194 | return 1; | ||
195 | } | ||
196 | |||
197 | static inline int regulator_bulk_get(struct device *dev, | ||
198 | int num_consumers, | ||
199 | struct regulator_bulk_data *consumers) | ||
200 | { | ||
201 | return 0; | ||
202 | } | ||
203 | |||
204 | static inline int regulator_bulk_enable(int num_consumers, | ||
205 | struct regulator_bulk_data *consumers) | ||
206 | { | ||
207 | return 0; | ||
208 | } | ||
209 | |||
210 | static inline int regulator_bulk_disable(int num_consumers, | ||
211 | struct regulator_bulk_data *consumers) | ||
212 | { | ||
213 | return 0; | ||
214 | } | ||
215 | |||
216 | static inline void regulator_bulk_free(int num_consumers, | ||
217 | struct regulator_bulk_data *consumers) | ||
218 | { | ||
219 | } | ||
220 | |||
221 | static inline int regulator_set_voltage(struct regulator *regulator, | ||
222 | int min_uV, int max_uV) | ||
223 | { | ||
224 | return 0; | ||
225 | } | ||
226 | |||
227 | static inline int regulator_get_voltage(struct regulator *regulator) | ||
228 | { | ||
229 | return 0; | ||
230 | } | ||
231 | |||
232 | static inline int regulator_set_current_limit(struct regulator *regulator, | ||
233 | int min_uA, int max_uA) | ||
234 | { | ||
235 | return 0; | ||
236 | } | ||
237 | |||
238 | static inline int regulator_get_current_limit(struct regulator *regulator) | ||
239 | { | ||
240 | return 0; | ||
241 | } | ||
242 | |||
243 | static inline int regulator_set_mode(struct regulator *regulator, | ||
244 | unsigned int mode) | ||
245 | { | ||
246 | return 0; | ||
247 | } | ||
248 | |||
249 | static inline unsigned int regulator_get_mode(struct regulator *regulator) | ||
250 | { | ||
251 | return REGULATOR_MODE_NORMAL; | ||
252 | } | ||
253 | |||
254 | static inline int regulator_set_optimum_mode(struct regulator *regulator, | ||
255 | int load_uA) | ||
256 | { | ||
257 | return REGULATOR_MODE_NORMAL; | ||
258 | } | ||
259 | |||
260 | static inline int regulator_register_notifier(struct regulator *regulator, | ||
261 | struct notifier_block *nb) | ||
262 | { | ||
263 | return 0; | ||
264 | } | ||
265 | |||
266 | static inline int regulator_unregister_notifier(struct regulator *regulator, | ||
267 | struct notifier_block *nb) | ||
268 | { | ||
269 | return 0; | ||
270 | } | ||
271 | |||
272 | static inline void *regulator_get_drvdata(struct regulator *regulator) | ||
273 | { | ||
274 | return NULL; | ||
275 | } | ||
276 | |||
277 | static inline void regulator_set_drvdata(struct regulator *regulator, | ||
278 | void *data) | ||
279 | { | ||
280 | } | ||
281 | |||
282 | #endif | ||
283 | |||
284 | #endif | ||
diff --git a/include/linux/regulator/driver.h b/include/linux/regulator/driver.h new file mode 100644 index 000000000000..e37d80561985 --- /dev/null +++ b/include/linux/regulator/driver.h | |||
@@ -0,0 +1,101 @@ | |||
1 | /* | ||
2 | * driver.h -- SoC Regulator driver support. | ||
3 | * | ||
4 | * Copyright (C) 2007, 2008 Wolfson Microelectronics PLC. | ||
5 | * | ||
6 | * Author: Liam Girdwood <lg@opensource.wolfsonmicro.com> | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License version 2 as | ||
10 | * published by the Free Software Foundation. | ||
11 | * | ||
12 | * Regulator Driver Interface. | ||
13 | */ | ||
14 | |||
15 | #ifndef __LINUX_REGULATOR_DRIVER_H_ | ||
16 | #define __LINUX_REGULATOR_DRIVER_H_ | ||
17 | |||
18 | #include <linux/device.h> | ||
19 | #include <linux/regulator/consumer.h> | ||
20 | |||
21 | struct regulator_dev; | ||
22 | struct regulator_init_data; | ||
23 | |||
24 | /** | ||
25 | * struct regulator_ops - regulator operations. | ||
26 | * | ||
27 | * This struct describes regulator operations. | ||
28 | */ | ||
29 | struct regulator_ops { | ||
30 | |||
31 | /* get/set regulator voltage */ | ||
32 | int (*set_voltage) (struct regulator_dev *, int min_uV, int max_uV); | ||
33 | int (*get_voltage) (struct regulator_dev *); | ||
34 | |||
35 | /* get/set regulator current */ | ||
36 | int (*set_current_limit) (struct regulator_dev *, | ||
37 | int min_uA, int max_uA); | ||
38 | int (*get_current_limit) (struct regulator_dev *); | ||
39 | |||
40 | /* enable/disable regulator */ | ||
41 | int (*enable) (struct regulator_dev *); | ||
42 | int (*disable) (struct regulator_dev *); | ||
43 | int (*is_enabled) (struct regulator_dev *); | ||
44 | |||
45 | /* get/set regulator operating mode (defined in regulator.h) */ | ||
46 | int (*set_mode) (struct regulator_dev *, unsigned int mode); | ||
47 | unsigned int (*get_mode) (struct regulator_dev *); | ||
48 | |||
49 | /* get most efficient regulator operating mode for load */ | ||
50 | unsigned int (*get_optimum_mode) (struct regulator_dev *, int input_uV, | ||
51 | int output_uV, int load_uA); | ||
52 | |||
53 | /* the operations below are for configuration of regulator state when | ||
54 | * its parent PMIC enters a global STANDBY/HIBERNATE state */ | ||
55 | |||
56 | /* set regulator suspend voltage */ | ||
57 | int (*set_suspend_voltage) (struct regulator_dev *, int uV); | ||
58 | |||
59 | /* enable/disable regulator in suspend state */ | ||
60 | int (*set_suspend_enable) (struct regulator_dev *); | ||
61 | int (*set_suspend_disable) (struct regulator_dev *); | ||
62 | |||
63 | /* set regulator suspend operating mode (defined in regulator.h) */ | ||
64 | int (*set_suspend_mode) (struct regulator_dev *, unsigned int mode); | ||
65 | }; | ||
66 | |||
67 | /* | ||
68 | * Regulators can either control voltage or current. | ||
69 | */ | ||
70 | enum regulator_type { | ||
71 | REGULATOR_VOLTAGE, | ||
72 | REGULATOR_CURRENT, | ||
73 | }; | ||
74 | |||
75 | /** | ||
76 | * struct regulator_desc - Regulator descriptor | ||
77 | * | ||
78 | */ | ||
79 | struct regulator_desc { | ||
80 | const char *name; | ||
81 | int id; | ||
82 | struct regulator_ops *ops; | ||
83 | int irq; | ||
84 | enum regulator_type type; | ||
85 | struct module *owner; | ||
86 | }; | ||
87 | |||
88 | struct regulator_dev *regulator_register(struct regulator_desc *regulator_desc, | ||
89 | struct device *dev, void *driver_data); | ||
90 | void regulator_unregister(struct regulator_dev *rdev); | ||
91 | |||
92 | int regulator_notifier_call_chain(struct regulator_dev *rdev, | ||
93 | unsigned long event, void *data); | ||
94 | |||
95 | void *rdev_get_drvdata(struct regulator_dev *rdev); | ||
96 | struct device *rdev_get_dev(struct regulator_dev *rdev); | ||
97 | int rdev_get_id(struct regulator_dev *rdev); | ||
98 | |||
99 | void *regulator_get_init_drvdata(struct regulator_init_data *reg_init_data); | ||
100 | |||
101 | #endif | ||
diff --git a/include/linux/regulator/fixed.h b/include/linux/regulator/fixed.h new file mode 100644 index 000000000000..1387a5d2190e --- /dev/null +++ b/include/linux/regulator/fixed.h | |||
@@ -0,0 +1,22 @@ | |||
1 | /* | ||
2 | * fixed.h | ||
3 | * | ||
4 | * Copyright 2008 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 | ||
9 | * modify it under the terms of the GNU General Public License as | ||
10 | * published by the Free Software Foundation; either version 2 of the | ||
11 | * License, or (at your option) any later version. | ||
12 | */ | ||
13 | |||
14 | #ifndef __REGULATOR_FIXED_H | ||
15 | #define __REGULATOR_FIXED_H | ||
16 | |||
17 | struct fixed_voltage_config { | ||
18 | const char *supply_name; | ||
19 | int microvolts; | ||
20 | }; | ||
21 | |||
22 | #endif | ||
diff --git a/include/linux/regulator/machine.h b/include/linux/regulator/machine.h new file mode 100644 index 000000000000..c6d69331a81e --- /dev/null +++ b/include/linux/regulator/machine.h | |||
@@ -0,0 +1,122 @@ | |||
1 | /* | ||
2 | * machine.h -- SoC Regulator support, machine/board driver API. | ||
3 | * | ||
4 | * Copyright (C) 2007, 2008 Wolfson Microelectronics PLC. | ||
5 | * | ||
6 | * Author: Liam Girdwood <lg@opensource.wolfsonmicro.com> | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License version 2 as | ||
10 | * published by the Free Software Foundation. | ||
11 | * | ||
12 | * Regulator Machine/Board Interface. | ||
13 | */ | ||
14 | |||
15 | #ifndef __LINUX_REGULATOR_MACHINE_H_ | ||
16 | #define __LINUX_REGULATOR_MACHINE_H_ | ||
17 | |||
18 | #include <linux/regulator/consumer.h> | ||
19 | #include <linux/suspend.h> | ||
20 | |||
21 | struct regulator; | ||
22 | |||
23 | /* | ||
24 | * Regulator operation constraint flags. These flags are used to enable | ||
25 | * certain regulator operations and can be OR'ed together. | ||
26 | * | ||
27 | * VOLTAGE: Regulator output voltage can be changed by software on this | ||
28 | * board/machine. | ||
29 | * CURRENT: Regulator output current can be changed by software on this | ||
30 | * board/machine. | ||
31 | * MODE: Regulator operating mode can be changed by software on this | ||
32 | * board/machine. | ||
33 | * STATUS: Regulator can be enabled and disabled. | ||
34 | * DRMS: Dynamic Regulator Mode Switching is enabled for this regulator. | ||
35 | */ | ||
36 | |||
37 | #define REGULATOR_CHANGE_VOLTAGE 0x1 | ||
38 | #define REGULATOR_CHANGE_CURRENT 0x2 | ||
39 | #define REGULATOR_CHANGE_MODE 0x4 | ||
40 | #define REGULATOR_CHANGE_STATUS 0x8 | ||
41 | #define REGULATOR_CHANGE_DRMS 0x10 | ||
42 | |||
43 | /** | ||
44 | * struct regulator_state - regulator state during low power syatem states | ||
45 | * | ||
46 | * This describes a regulators state during a system wide low power state. | ||
47 | */ | ||
48 | struct regulator_state { | ||
49 | int uV; /* suspend voltage */ | ||
50 | unsigned int mode; /* suspend regulator operating mode */ | ||
51 | int enabled; /* is regulator enabled in this suspend state */ | ||
52 | }; | ||
53 | |||
54 | /** | ||
55 | * struct regulation_constraints - regulator operating constraints. | ||
56 | * | ||
57 | * This struct describes regulator and board/machine specific constraints. | ||
58 | */ | ||
59 | struct regulation_constraints { | ||
60 | |||
61 | char *name; | ||
62 | |||
63 | /* voltage output range (inclusive) - for voltage control */ | ||
64 | int min_uV; | ||
65 | int max_uV; | ||
66 | |||
67 | /* current output range (inclusive) - for current control */ | ||
68 | int min_uA; | ||
69 | int max_uA; | ||
70 | |||
71 | /* valid regulator operating modes for this machine */ | ||
72 | unsigned int valid_modes_mask; | ||
73 | |||
74 | /* valid operations for regulator on this machine */ | ||
75 | unsigned int valid_ops_mask; | ||
76 | |||
77 | /* regulator input voltage - only if supply is another regulator */ | ||
78 | int input_uV; | ||
79 | |||
80 | /* regulator suspend states for global PMIC STANDBY/HIBERNATE */ | ||
81 | struct regulator_state state_disk; | ||
82 | struct regulator_state state_mem; | ||
83 | struct regulator_state state_standby; | ||
84 | suspend_state_t initial_state; /* suspend state to set at init */ | ||
85 | |||
86 | /* constriant flags */ | ||
87 | unsigned always_on:1; /* regulator never off when system is on */ | ||
88 | unsigned boot_on:1; /* bootloader/firmware enabled regulator */ | ||
89 | unsigned apply_uV:1; /* apply uV constraint iff min == max */ | ||
90 | }; | ||
91 | |||
92 | /** | ||
93 | * struct regulator_consumer_supply - supply -> device mapping | ||
94 | * | ||
95 | * This maps a supply name to a device. | ||
96 | */ | ||
97 | struct regulator_consumer_supply { | ||
98 | struct device *dev; /* consumer */ | ||
99 | const char *supply; /* consumer supply - e.g. "vcc" */ | ||
100 | }; | ||
101 | |||
102 | /** | ||
103 | * struct regulator_init_data - regulator platform initialisation data. | ||
104 | * | ||
105 | * Initialisation constraints, our supply and consumers supplies. | ||
106 | */ | ||
107 | struct regulator_init_data { | ||
108 | struct device *supply_regulator_dev; /* or NULL for LINE */ | ||
109 | |||
110 | struct regulation_constraints constraints; | ||
111 | |||
112 | int num_consumer_supplies; | ||
113 | struct regulator_consumer_supply *consumer_supplies; | ||
114 | |||
115 | /* optional regulator machine specific init */ | ||
116 | int (*regulator_init)(void *driver_data); | ||
117 | void *driver_data; /* core does not touch this */ | ||
118 | }; | ||
119 | |||
120 | int regulator_suspend_prepare(suspend_state_t state); | ||
121 | |||
122 | #endif | ||
diff --git a/include/linux/reiserfs_fs.h b/include/linux/reiserfs_fs.h index 4aacaeecb56f..e9963af16cda 100644 --- a/include/linux/reiserfs_fs.h +++ b/include/linux/reiserfs_fs.h | |||
@@ -526,8 +526,8 @@ struct item_head { | |||
526 | ** p is the array of __u32, i is the index into the array, v is the value | 526 | ** p is the array of __u32, i is the index into the array, v is the value |
527 | ** to store there. | 527 | ** to store there. |
528 | */ | 528 | */ |
529 | #define get_block_num(p, i) le32_to_cpu(get_unaligned((p) + (i))) | 529 | #define get_block_num(p, i) get_unaligned_le32((p) + (i)) |
530 | #define put_block_num(p, i, v) put_unaligned(cpu_to_le32(v), (p) + (i)) | 530 | #define put_block_num(p, i, v) put_unaligned_le32((v), (p) + (i)) |
531 | 531 | ||
532 | // | 532 | // |
533 | // in old version uniqueness field shows key type | 533 | // in old version uniqueness field shows key type |
diff --git a/include/linux/reiserfs_fs_sb.h b/include/linux/reiserfs_fs_sb.h index 336ee43ed7d8..315517e8bfa1 100644 --- a/include/linux/reiserfs_fs_sb.h +++ b/include/linux/reiserfs_fs_sb.h | |||
@@ -152,7 +152,7 @@ struct reiserfs_journal_list { | |||
152 | atomic_t j_nonzerolen; | 152 | atomic_t j_nonzerolen; |
153 | atomic_t j_commit_left; | 153 | atomic_t j_commit_left; |
154 | atomic_t j_older_commits_done; /* all commits older than this on disk */ | 154 | atomic_t j_older_commits_done; /* all commits older than this on disk */ |
155 | struct semaphore j_commit_lock; | 155 | struct mutex j_commit_mutex; |
156 | unsigned long j_trans_id; | 156 | unsigned long j_trans_id; |
157 | time_t j_timestamp; | 157 | time_t j_timestamp; |
158 | struct reiserfs_list_bitmap *j_list_bitmap; | 158 | struct reiserfs_list_bitmap *j_list_bitmap; |
@@ -193,8 +193,8 @@ struct reiserfs_journal { | |||
193 | struct buffer_head *j_header_bh; | 193 | struct buffer_head *j_header_bh; |
194 | 194 | ||
195 | time_t j_trans_start_time; /* time this transaction started */ | 195 | time_t j_trans_start_time; /* time this transaction started */ |
196 | struct semaphore j_lock; | 196 | struct mutex j_mutex; |
197 | struct semaphore j_flush_sem; | 197 | struct mutex j_flush_mutex; |
198 | wait_queue_head_t j_join_wait; /* wait for current transaction to finish before starting new one */ | 198 | wait_queue_head_t j_join_wait; /* wait for current transaction to finish before starting new one */ |
199 | atomic_t j_jlock; /* lock for j_join_wait */ | 199 | atomic_t j_jlock; /* lock for j_join_wait */ |
200 | int j_list_bitmap_index; /* number of next list bitmap to use */ | 200 | int j_list_bitmap_index; /* number of next list bitmap to use */ |
diff --git a/include/linux/reiserfs_xattr.h b/include/linux/reiserfs_xattr.h index 66a96814d614..af135ae895db 100644 --- a/include/linux/reiserfs_xattr.h +++ b/include/linux/reiserfs_xattr.h | |||
@@ -55,7 +55,7 @@ int reiserfs_removexattr(struct dentry *dentry, const char *name); | |||
55 | int reiserfs_delete_xattrs(struct inode *inode); | 55 | int reiserfs_delete_xattrs(struct inode *inode); |
56 | int reiserfs_chown_xattrs(struct inode *inode, struct iattr *attrs); | 56 | int reiserfs_chown_xattrs(struct inode *inode, struct iattr *attrs); |
57 | int reiserfs_xattr_init(struct super_block *sb, int mount_flags); | 57 | int reiserfs_xattr_init(struct super_block *sb, int mount_flags); |
58 | int reiserfs_permission(struct inode *inode, int mask, struct nameidata *nd); | 58 | int reiserfs_permission(struct inode *inode, int mask); |
59 | 59 | ||
60 | int reiserfs_xattr_del(struct inode *, const char *); | 60 | int reiserfs_xattr_del(struct inode *, const char *); |
61 | int reiserfs_xattr_get(const struct inode *, const char *, void *, size_t); | 61 | int reiserfs_xattr_get(const struct inode *, const char *, void *, size_t); |
diff --git a/include/linux/relay.h b/include/linux/relay.h index 6cd8c4425fc7..953fc055e875 100644 --- a/include/linux/relay.h +++ b/include/linux/relay.h | |||
@@ -48,6 +48,7 @@ struct rchan_buf | |||
48 | size_t *padding; /* padding counts per sub-buffer */ | 48 | size_t *padding; /* padding counts per sub-buffer */ |
49 | size_t prev_padding; /* temporary variable */ | 49 | size_t prev_padding; /* temporary variable */ |
50 | size_t bytes_consumed; /* bytes consumed in cur read subbuf */ | 50 | size_t bytes_consumed; /* bytes consumed in cur read subbuf */ |
51 | size_t early_bytes; /* bytes consumed before VFS inited */ | ||
51 | unsigned int cpu; /* this buf's cpu */ | 52 | unsigned int cpu; /* this buf's cpu */ |
52 | } ____cacheline_aligned; | 53 | } ____cacheline_aligned; |
53 | 54 | ||
@@ -68,6 +69,7 @@ struct rchan | |||
68 | int is_global; /* One global buffer ? */ | 69 | int is_global; /* One global buffer ? */ |
69 | struct list_head list; /* for channel list */ | 70 | struct list_head list; /* for channel list */ |
70 | struct dentry *parent; /* parent dentry passed to open */ | 71 | struct dentry *parent; /* parent dentry passed to open */ |
72 | int has_base_filename; /* has a filename associated? */ | ||
71 | char base_filename[NAME_MAX]; /* saved base filename */ | 73 | char base_filename[NAME_MAX]; /* saved base filename */ |
72 | }; | 74 | }; |
73 | 75 | ||
@@ -169,6 +171,9 @@ struct rchan *relay_open(const char *base_filename, | |||
169 | size_t n_subbufs, | 171 | size_t n_subbufs, |
170 | struct rchan_callbacks *cb, | 172 | struct rchan_callbacks *cb, |
171 | void *private_data); | 173 | void *private_data); |
174 | extern int relay_late_setup_files(struct rchan *chan, | ||
175 | const char *base_filename, | ||
176 | struct dentry *parent); | ||
172 | extern void relay_close(struct rchan *chan); | 177 | extern void relay_close(struct rchan *chan); |
173 | extern void relay_flush(struct rchan *chan); | 178 | extern void relay_flush(struct rchan *chan); |
174 | extern void relay_subbufs_consumed(struct rchan *chan, | 179 | extern void relay_subbufs_consumed(struct rchan *chan, |
diff --git a/include/linux/res_counter.h b/include/linux/res_counter.h index 6d9e1fca098c..271c1c2c9f6f 100644 --- a/include/linux/res_counter.h +++ b/include/linux/res_counter.h | |||
@@ -63,9 +63,14 @@ u64 res_counter_read_u64(struct res_counter *counter, int member); | |||
63 | ssize_t res_counter_read(struct res_counter *counter, int member, | 63 | ssize_t res_counter_read(struct res_counter *counter, int member, |
64 | const char __user *buf, size_t nbytes, loff_t *pos, | 64 | const char __user *buf, size_t nbytes, loff_t *pos, |
65 | int (*read_strategy)(unsigned long long val, char *s)); | 65 | int (*read_strategy)(unsigned long long val, char *s)); |
66 | ssize_t res_counter_write(struct res_counter *counter, int member, | 66 | |
67 | const char __user *buf, size_t nbytes, loff_t *pos, | 67 | typedef int (*write_strategy_fn)(const char *buf, unsigned long long *val); |
68 | int (*write_strategy)(char *buf, unsigned long long *val)); | 68 | |
69 | int res_counter_memparse_write_strategy(const char *buf, | ||
70 | unsigned long long *res); | ||
71 | |||
72 | int res_counter_write(struct res_counter *counter, int member, | ||
73 | const char *buffer, write_strategy_fn write_strategy); | ||
69 | 74 | ||
70 | /* | 75 | /* |
71 | * the field descriptors. one for each member of res_counter | 76 | * the field descriptors. one for each member of res_counter |
@@ -95,8 +100,10 @@ void res_counter_init(struct res_counter *counter); | |||
95 | * counter->limit _locked call expects the counter->lock to be taken | 100 | * counter->limit _locked call expects the counter->lock to be taken |
96 | */ | 101 | */ |
97 | 102 | ||
98 | int res_counter_charge_locked(struct res_counter *counter, unsigned long val); | 103 | int __must_check res_counter_charge_locked(struct res_counter *counter, |
99 | int res_counter_charge(struct res_counter *counter, unsigned long val); | 104 | unsigned long val); |
105 | int __must_check res_counter_charge(struct res_counter *counter, | ||
106 | unsigned long val); | ||
100 | 107 | ||
101 | /* | 108 | /* |
102 | * uncharge - tell that some portion of the resource is released | 109 | * uncharge - tell that some portion of the resource is released |
@@ -151,4 +158,20 @@ static inline void res_counter_reset_failcnt(struct res_counter *cnt) | |||
151 | cnt->failcnt = 0; | 158 | cnt->failcnt = 0; |
152 | spin_unlock_irqrestore(&cnt->lock, flags); | 159 | spin_unlock_irqrestore(&cnt->lock, flags); |
153 | } | 160 | } |
161 | |||
162 | static inline int res_counter_set_limit(struct res_counter *cnt, | ||
163 | unsigned long long limit) | ||
164 | { | ||
165 | unsigned long flags; | ||
166 | int ret = -EBUSY; | ||
167 | |||
168 | spin_lock_irqsave(&cnt->lock, flags); | ||
169 | if (cnt->usage <= limit) { | ||
170 | cnt->limit = limit; | ||
171 | ret = 0; | ||
172 | } | ||
173 | spin_unlock_irqrestore(&cnt->lock, flags); | ||
174 | return ret; | ||
175 | } | ||
176 | |||
154 | #endif | 177 | #endif |
diff --git a/include/linux/resume-trace.h b/include/linux/resume-trace.h index f3f4f28c6960..c9ba2fdf807d 100644 --- a/include/linux/resume-trace.h +++ b/include/linux/resume-trace.h | |||
@@ -8,7 +8,7 @@ extern int pm_trace_enabled; | |||
8 | 8 | ||
9 | struct device; | 9 | struct device; |
10 | extern void set_trace_device(struct device *); | 10 | extern void set_trace_device(struct device *); |
11 | extern void generate_resume_trace(void *tracedata, unsigned int user); | 11 | extern void generate_resume_trace(const void *tracedata, unsigned int user); |
12 | 12 | ||
13 | #define TRACE_DEVICE(dev) do { \ | 13 | #define TRACE_DEVICE(dev) do { \ |
14 | if (pm_trace_enabled) \ | 14 | if (pm_trace_enabled) \ |
diff --git a/include/linux/rfkill.h b/include/linux/rfkill.h index e3ab21d7fc7f..4cd64b0d9825 100644 --- a/include/linux/rfkill.h +++ b/include/linux/rfkill.h | |||
@@ -34,33 +34,52 @@ | |||
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 | */ | 38 | */ |
38 | enum rfkill_type { | 39 | enum rfkill_type { |
39 | RFKILL_TYPE_WLAN , | 40 | RFKILL_TYPE_WLAN , |
40 | RFKILL_TYPE_BLUETOOTH, | 41 | RFKILL_TYPE_BLUETOOTH, |
41 | RFKILL_TYPE_UWB, | 42 | RFKILL_TYPE_UWB, |
42 | RFKILL_TYPE_WIMAX, | 43 | RFKILL_TYPE_WIMAX, |
44 | RFKILL_TYPE_WWAN, | ||
43 | RFKILL_TYPE_MAX, | 45 | RFKILL_TYPE_MAX, |
44 | }; | 46 | }; |
45 | 47 | ||
46 | enum rfkill_state { | 48 | enum rfkill_state { |
47 | RFKILL_STATE_OFF = 0, | 49 | RFKILL_STATE_SOFT_BLOCKED = 0, /* Radio output blocked */ |
48 | RFKILL_STATE_ON = 1, | 50 | RFKILL_STATE_UNBLOCKED = 1, /* Radio output allowed */ |
51 | RFKILL_STATE_HARD_BLOCKED = 2, /* Output blocked, non-overrideable */ | ||
52 | RFKILL_STATE_MAX, /* marker for last valid state */ | ||
49 | }; | 53 | }; |
50 | 54 | ||
55 | /* | ||
56 | * These are DEPRECATED, drivers using them should be verified to | ||
57 | * comply with the rfkill usage guidelines in Documentation/rfkill.txt | ||
58 | * and then converted to use the new names for rfkill_state | ||
59 | */ | ||
60 | #define RFKILL_STATE_OFF RFKILL_STATE_SOFT_BLOCKED | ||
61 | #define RFKILL_STATE_ON RFKILL_STATE_UNBLOCKED | ||
62 | |||
51 | /** | 63 | /** |
52 | * struct rfkill - rfkill control structure. | 64 | * struct rfkill - rfkill control structure. |
53 | * @name: Name of the switch. | 65 | * @name: Name of the switch. |
54 | * @type: Radio type which the button controls, the value stored | 66 | * @type: Radio type which the button controls, the value stored |
55 | * here should be a value from enum rfkill_type. | 67 | * here should be a value from enum rfkill_type. |
56 | * @state: State of the switch (on/off). | 68 | * @state: State of the switch, "UNBLOCKED" means radio can operate. |
57 | * @user_claim_unsupported: Whether the hardware supports exclusive | 69 | * @user_claim_unsupported: Whether the hardware supports exclusive |
58 | * RF-kill control by userspace. Set this before registering. | 70 | * RF-kill control by userspace. Set this before registering. |
59 | * @user_claim: Set when the switch is controlled exlusively by userspace. | 71 | * @user_claim: Set when the switch is controlled exlusively by userspace. |
60 | * @mutex: Guards switch state transitions | 72 | * @mutex: Guards switch state transitions. It serializes callbacks |
73 | * and also protects the state. | ||
61 | * @data: Pointer to the RF button drivers private data which will be | 74 | * @data: Pointer to the RF button drivers private data which will be |
62 | * passed along when toggling radio state. | 75 | * passed along when toggling radio state. |
63 | * @toggle_radio(): Mandatory handler to control state of the radio. | 76 | * @toggle_radio(): Mandatory handler to control state of the radio. |
77 | * only RFKILL_STATE_SOFT_BLOCKED and RFKILL_STATE_UNBLOCKED are | ||
78 | * valid parameters. | ||
79 | * @get_state(): handler to read current radio state from hardware, | ||
80 | * may be called from atomic context, should return 0 on success. | ||
81 | * Either this handler OR judicious use of rfkill_force_state() is | ||
82 | * MANDATORY for any driver capable of RFKILL_STATE_HARD_BLOCKED. | ||
64 | * @led_trigger: A LED trigger for this button's LED. | 83 | * @led_trigger: A LED trigger for this button's LED. |
65 | * @dev: Device structure integrating the switch into device tree. | 84 | * @dev: Device structure integrating the switch into device tree. |
66 | * @node: Used to place switch into list of all switches known to the | 85 | * @node: Used to place switch into list of all switches known to the |
@@ -72,14 +91,16 @@ struct rfkill { | |||
72 | const char *name; | 91 | const char *name; |
73 | enum rfkill_type type; | 92 | enum rfkill_type type; |
74 | 93 | ||
75 | enum rfkill_state state; | ||
76 | bool user_claim_unsupported; | 94 | bool user_claim_unsupported; |
77 | bool user_claim; | 95 | bool user_claim; |
78 | 96 | ||
97 | /* the mutex serializes callbacks and also protects | ||
98 | * the state */ | ||
79 | struct mutex mutex; | 99 | struct mutex mutex; |
80 | 100 | enum rfkill_state state; | |
81 | void *data; | 101 | void *data; |
82 | int (*toggle_radio)(void *data, enum rfkill_state state); | 102 | int (*toggle_radio)(void *data, enum rfkill_state state); |
103 | int (*get_state)(void *data, enum rfkill_state *state); | ||
83 | 104 | ||
84 | #ifdef CONFIG_RFKILL_LEDS | 105 | #ifdef CONFIG_RFKILL_LEDS |
85 | struct led_trigger led_trigger; | 106 | struct led_trigger led_trigger; |
@@ -90,11 +111,28 @@ struct rfkill { | |||
90 | }; | 111 | }; |
91 | #define to_rfkill(d) container_of(d, struct rfkill, dev) | 112 | #define to_rfkill(d) container_of(d, struct rfkill, dev) |
92 | 113 | ||
93 | struct rfkill *rfkill_allocate(struct device *parent, enum rfkill_type type); | 114 | struct rfkill * __must_check rfkill_allocate(struct device *parent, |
115 | enum rfkill_type type); | ||
94 | void rfkill_free(struct rfkill *rfkill); | 116 | void rfkill_free(struct rfkill *rfkill); |
95 | int rfkill_register(struct rfkill *rfkill); | 117 | int __must_check rfkill_register(struct rfkill *rfkill); |
96 | void rfkill_unregister(struct rfkill *rfkill); | 118 | void rfkill_unregister(struct rfkill *rfkill); |
97 | 119 | ||
120 | int rfkill_force_state(struct rfkill *rfkill, enum rfkill_state state); | ||
121 | int rfkill_set_default(enum rfkill_type type, enum rfkill_state state); | ||
122 | |||
123 | /** | ||
124 | * rfkill_state_complement - return complementar state | ||
125 | * @state: state to return the complement of | ||
126 | * | ||
127 | * Returns RFKILL_STATE_SOFT_BLOCKED if @state is RFKILL_STATE_UNBLOCKED, | ||
128 | * returns RFKILL_STATE_UNBLOCKED otherwise. | ||
129 | */ | ||
130 | static inline enum rfkill_state rfkill_state_complement(enum rfkill_state state) | ||
131 | { | ||
132 | return (state == RFKILL_STATE_UNBLOCKED) ? | ||
133 | RFKILL_STATE_SOFT_BLOCKED : RFKILL_STATE_UNBLOCKED; | ||
134 | } | ||
135 | |||
98 | /** | 136 | /** |
99 | * rfkill_get_led_name - Get the LED trigger name for the button's LED. | 137 | * rfkill_get_led_name - Get the LED trigger name for the button's LED. |
100 | * This function might return a NULL pointer if registering of the | 138 | * This function might return a NULL pointer if registering of the |
@@ -110,4 +148,11 @@ static inline char *rfkill_get_led_name(struct rfkill *rfkill) | |||
110 | #endif | 148 | #endif |
111 | } | 149 | } |
112 | 150 | ||
151 | /* rfkill notification chain */ | ||
152 | #define RFKILL_STATE_CHANGED 0x0001 /* state of a normal rfkill | ||
153 | switch has changed */ | ||
154 | |||
155 | int register_rfkill_notifier(struct notifier_block *nb); | ||
156 | int unregister_rfkill_notifier(struct notifier_block *nb); | ||
157 | |||
113 | #endif /* RFKILL_H */ | 158 | #endif /* RFKILL_H */ |
diff --git a/include/linux/rmap.h b/include/linux/rmap.h index 1383692ac5bd..fed6f5e0b411 100644 --- a/include/linux/rmap.h +++ b/include/linux/rmap.h | |||
@@ -26,6 +26,14 @@ | |||
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 | /* | ||
30 | * NOTE: the LSB of the head.next is set by | ||
31 | * mm_take_all_locks() _after_ taking the above lock. So the | ||
32 | * head must only be read/written after taking the above lock | ||
33 | * to be sure to see a valid next pointer. The LSB bit itself | ||
34 | * is serialized by a system wide lock only visible to | ||
35 | * mm_take_all_locks() (mm_all_locks_mutex). | ||
36 | */ | ||
29 | struct list_head head; /* List of private "related" vmas */ | 37 | struct list_head head; /* List of private "related" vmas */ |
30 | }; | 38 | }; |
31 | 39 | ||
@@ -94,7 +102,7 @@ int try_to_unmap(struct page *, int ignore_refs); | |||
94 | * Called from mm/filemap_xip.c to unmap empty zero page | 102 | * Called from mm/filemap_xip.c to unmap empty zero page |
95 | */ | 103 | */ |
96 | pte_t *page_check_address(struct page *, struct mm_struct *, | 104 | pte_t *page_check_address(struct page *, struct mm_struct *, |
97 | unsigned long, spinlock_t **); | 105 | unsigned long, spinlock_t **, int); |
98 | 106 | ||
99 | /* | 107 | /* |
100 | * Used by swapoff to help locate where page is expected in vma. | 108 | * Used by swapoff to help locate where page is expected in vma. |
diff --git a/include/linux/rtc.h b/include/linux/rtc.h index f2d0d1527721..91f597ad6acc 100644 --- a/include/linux/rtc.h +++ b/include/linux/rtc.h | |||
@@ -115,6 +115,23 @@ extern void rtc_time_to_tm(unsigned long time, struct rtc_time *tm); | |||
115 | 115 | ||
116 | extern struct class *rtc_class; | 116 | extern struct class *rtc_class; |
117 | 117 | ||
118 | /* | ||
119 | * For these RTC methods the device parameter is the physical device | ||
120 | * on whatever bus holds the hardware (I2C, Platform, SPI, etc), which | ||
121 | * was passed to rtc_device_register(). Its driver_data normally holds | ||
122 | * device state, including the rtc_device pointer for the RTC. | ||
123 | * | ||
124 | * Most of these methods are called with rtc_device.ops_lock held, | ||
125 | * through the rtc_*(struct rtc_device *, ...) calls. | ||
126 | * | ||
127 | * The (current) exceptions are mostly filesystem hooks: | ||
128 | * - the proc() hook for procfs | ||
129 | * - non-ioctl() chardev hooks: open(), release(), read_callback() | ||
130 | * - periodic irq calls: irq_set_state(), irq_set_freq() | ||
131 | * | ||
132 | * REVISIT those periodic irq calls *do* have ops_lock when they're | ||
133 | * issued through ioctl() ... | ||
134 | */ | ||
118 | struct rtc_class_ops { | 135 | struct rtc_class_ops { |
119 | int (*open)(struct device *); | 136 | int (*open)(struct device *); |
120 | void (*release)(struct device *); | 137 | void (*release)(struct device *); |
@@ -208,8 +225,6 @@ typedef struct rtc_task { | |||
208 | int rtc_register(rtc_task_t *task); | 225 | int rtc_register(rtc_task_t *task); |
209 | int rtc_unregister(rtc_task_t *task); | 226 | int rtc_unregister(rtc_task_t *task); |
210 | int rtc_control(rtc_task_t *t, unsigned int cmd, unsigned long arg); | 227 | int rtc_control(rtc_task_t *t, unsigned int cmd, unsigned long arg); |
211 | void rtc_get_rtc_time(struct rtc_time *rtc_tm); | ||
212 | irqreturn_t rtc_interrupt(int irq, void *dev_id); | ||
213 | 228 | ||
214 | #endif /* __KERNEL__ */ | 229 | #endif /* __KERNEL__ */ |
215 | 230 | ||
diff --git a/include/linux/rtc/m48t59.h b/include/linux/rtc/m48t59.h index e8c7c21ceb1f..6fc961459b4a 100644 --- a/include/linux/rtc/m48t59.h +++ b/include/linux/rtc/m48t59.h | |||
@@ -18,40 +18,47 @@ | |||
18 | /* | 18 | /* |
19 | * M48T59 Register Offset | 19 | * M48T59 Register Offset |
20 | */ | 20 | */ |
21 | #define M48T59_YEAR 0x1fff | 21 | #define M48T59_YEAR 0xf |
22 | #define M48T59_MONTH 0x1ffe | 22 | #define M48T59_MONTH 0xe |
23 | #define M48T59_MDAY 0x1ffd /* Day of Month */ | 23 | #define M48T59_MDAY 0xd /* Day of Month */ |
24 | #define M48T59_WDAY 0x1ffc /* Day of Week */ | 24 | #define M48T59_WDAY 0xc /* Day of Week */ |
25 | #define M48T59_WDAY_CB 0x20 /* Century Bit */ | 25 | #define M48T59_WDAY_CB 0x20 /* Century Bit */ |
26 | #define M48T59_WDAY_CEB 0x10 /* Century Enable Bit */ | 26 | #define M48T59_WDAY_CEB 0x10 /* Century Enable Bit */ |
27 | #define M48T59_HOUR 0x1ffb | 27 | #define M48T59_HOUR 0xb |
28 | #define M48T59_MIN 0x1ffa | 28 | #define M48T59_MIN 0xa |
29 | #define M48T59_SEC 0x1ff9 | 29 | #define M48T59_SEC 0x9 |
30 | #define M48T59_CNTL 0x1ff8 | 30 | #define M48T59_CNTL 0x8 |
31 | #define M48T59_CNTL_READ 0x40 | 31 | #define M48T59_CNTL_READ 0x40 |
32 | #define M48T59_CNTL_WRITE 0x80 | 32 | #define M48T59_CNTL_WRITE 0x80 |
33 | #define M48T59_WATCHDOG 0x1ff7 | 33 | #define M48T59_WATCHDOG 0x7 |
34 | #define M48T59_INTR 0x1ff6 | 34 | #define M48T59_INTR 0x6 |
35 | #define M48T59_INTR_AFE 0x80 /* Alarm Interrupt Enable */ | 35 | #define M48T59_INTR_AFE 0x80 /* Alarm Interrupt Enable */ |
36 | #define M48T59_INTR_ABE 0x20 | 36 | #define M48T59_INTR_ABE 0x20 |
37 | #define M48T59_ALARM_DATE 0x1ff5 | 37 | #define M48T59_ALARM_DATE 0x5 |
38 | #define M48T59_ALARM_HOUR 0x1ff4 | 38 | #define M48T59_ALARM_HOUR 0x4 |
39 | #define M48T59_ALARM_MIN 0x1ff3 | 39 | #define M48T59_ALARM_MIN 0x3 |
40 | #define M48T59_ALARM_SEC 0x1ff2 | 40 | #define M48T59_ALARM_SEC 0x2 |
41 | #define M48T59_UNUSED 0x1ff1 | 41 | #define M48T59_UNUSED 0x1 |
42 | #define M48T59_FLAGS 0x1ff0 | 42 | #define M48T59_FLAGS 0x0 |
43 | #define M48T59_FLAGS_WDT 0x80 /* watchdog timer expired */ | 43 | #define M48T59_FLAGS_WDT 0x80 /* watchdog timer expired */ |
44 | #define M48T59_FLAGS_AF 0x40 /* alarm */ | 44 | #define M48T59_FLAGS_AF 0x40 /* alarm */ |
45 | #define M48T59_FLAGS_BF 0x10 /* low battery */ | 45 | #define M48T59_FLAGS_BF 0x10 /* low battery */ |
46 | 46 | ||
47 | #define M48T59_NVRAM_SIZE 0x1ff0 | 47 | #define M48T59RTC_TYPE_M48T59 0 /* to keep compatibility */ |
48 | #define M48T59RTC_TYPE_M48T02 1 | ||
49 | #define M48T59RTC_TYPE_M48T08 2 | ||
48 | 50 | ||
49 | struct m48t59_plat_data { | 51 | struct m48t59_plat_data { |
50 | /* The method to access M48T59 registers, | 52 | /* The method to access M48T59 registers */ |
51 | * NOTE: The 'ofs' should be 0x00~0x1fff | ||
52 | */ | ||
53 | void (*write_byte)(struct device *dev, u32 ofs, u8 val); | 53 | void (*write_byte)(struct device *dev, u32 ofs, u8 val); |
54 | unsigned char (*read_byte)(struct device *dev, u32 ofs); | 54 | unsigned char (*read_byte)(struct device *dev, u32 ofs); |
55 | |||
56 | int type; /* RTC model */ | ||
57 | |||
58 | /* ioaddr mapped externally */ | ||
59 | void __iomem *ioaddr; | ||
60 | /* offset to RTC registers, automatically set according to the type */ | ||
61 | unsigned int offset; | ||
55 | }; | 62 | }; |
56 | 63 | ||
57 | #endif /* _LINUX_RTC_M48T59_H_ */ | 64 | #endif /* _LINUX_RTC_M48T59_H_ */ |
diff --git a/include/linux/rtnetlink.h b/include/linux/rtnetlink.h index b358c704d102..2b3d51c6ec9c 100644 --- a/include/linux/rtnetlink.h +++ b/include/linux/rtnetlink.h | |||
@@ -482,6 +482,7 @@ enum | |||
482 | TCA_RATE, | 482 | TCA_RATE, |
483 | TCA_FCNT, | 483 | TCA_FCNT, |
484 | TCA_STATS2, | 484 | TCA_STATS2, |
485 | TCA_STAB, | ||
485 | __TCA_MAX | 486 | __TCA_MAX |
486 | }; | 487 | }; |
487 | 488 | ||
@@ -581,6 +582,10 @@ enum rtnetlink_groups { | |||
581 | #define RTNLGRP_IPV6_RULE RTNLGRP_IPV6_RULE | 582 | #define RTNLGRP_IPV6_RULE RTNLGRP_IPV6_RULE |
582 | RTNLGRP_ND_USEROPT, | 583 | RTNLGRP_ND_USEROPT, |
583 | #define RTNLGRP_ND_USEROPT RTNLGRP_ND_USEROPT | 584 | #define RTNLGRP_ND_USEROPT RTNLGRP_ND_USEROPT |
585 | RTNLGRP_PHONET_IFADDR, | ||
586 | #define RTNLGRP_PHONET_IFADDR RTNLGRP_PHONET_IFADDR | ||
587 | RTNLGRP_PHONET_ROUTE, | ||
588 | #define RTNLGRP_PHONET_ROUTE RTNLGRP_PHONET_ROUTE | ||
584 | __RTNLGRP_MAX | 589 | __RTNLGRP_MAX |
585 | }; | 590 | }; |
586 | #define RTNLGRP_MAX (__RTNLGRP_MAX - 1) | 591 | #define RTNLGRP_MAX (__RTNLGRP_MAX - 1) |
@@ -754,13 +759,6 @@ extern void __rtnl_unlock(void); | |||
754 | } \ | 759 | } \ |
755 | } while(0) | 760 | } while(0) |
756 | 761 | ||
757 | #define BUG_TRAP(x) do { \ | ||
758 | if (unlikely(!(x))) { \ | ||
759 | printk(KERN_ERR "KERNEL: assertion (%s) failed at %s (%d)\n", \ | ||
760 | #x, __FILE__ , __LINE__); \ | ||
761 | } \ | ||
762 | } while(0) | ||
763 | |||
764 | static inline u32 rtm_get_table(struct rtattr **rta, u8 table) | 762 | static inline u32 rtm_get_table(struct rtattr **rta, u8 table) |
765 | { | 763 | { |
766 | return RTA_GET_U32(rta[RTA_TABLE-1]); | 764 | return RTA_GET_U32(rta[RTA_TABLE-1]); |
diff --git a/include/linux/scatterlist.h b/include/linux/scatterlist.h index 71fc81360048..e5996984ddd0 100644 --- a/include/linux/scatterlist.h +++ b/include/linux/scatterlist.h | |||
@@ -224,4 +224,42 @@ size_t sg_copy_to_buffer(struct scatterlist *sgl, unsigned int nents, | |||
224 | */ | 224 | */ |
225 | #define SG_MAX_SINGLE_ALLOC (PAGE_SIZE / sizeof(struct scatterlist)) | 225 | #define SG_MAX_SINGLE_ALLOC (PAGE_SIZE / sizeof(struct scatterlist)) |
226 | 226 | ||
227 | |||
228 | /* | ||
229 | * Mapping sg iterator | ||
230 | * | ||
231 | * Iterates over sg entries mapping page-by-page. On each successful | ||
232 | * iteration, @miter->page points to the mapped page and | ||
233 | * @miter->length bytes of data can be accessed at @miter->addr. As | ||
234 | * long as an interation is enclosed between start and stop, the user | ||
235 | * is free to choose control structure and when to stop. | ||
236 | * | ||
237 | * @miter->consumed is set to @miter->length on each iteration. It | ||
238 | * can be adjusted if the user can't consume all the bytes in one go. | ||
239 | * Also, a stopped iteration can be resumed by calling next on it. | ||
240 | * This is useful when iteration needs to release all resources and | ||
241 | * continue later (e.g. at the next interrupt). | ||
242 | */ | ||
243 | |||
244 | #define SG_MITER_ATOMIC (1 << 0) /* use kmap_atomic */ | ||
245 | |||
246 | struct sg_mapping_iter { | ||
247 | /* the following three fields can be accessed directly */ | ||
248 | struct page *page; /* currently mapped page */ | ||
249 | void *addr; /* pointer to the mapped area */ | ||
250 | size_t length; /* length of the mapped area */ | ||
251 | size_t consumed; /* number of consumed bytes */ | ||
252 | |||
253 | /* these are internal states, keep away */ | ||
254 | struct scatterlist *__sg; /* current entry */ | ||
255 | unsigned int __nents; /* nr of remaining entries */ | ||
256 | unsigned int __offset; /* offset within sg */ | ||
257 | unsigned int __flags; | ||
258 | }; | ||
259 | |||
260 | void sg_miter_start(struct sg_mapping_iter *miter, struct scatterlist *sgl, | ||
261 | unsigned int nents, unsigned int flags); | ||
262 | bool sg_miter_next(struct sg_mapping_iter *miter); | ||
263 | void sg_miter_stop(struct sg_mapping_iter *miter); | ||
264 | |||
227 | #endif /* _LINUX_SCATTERLIST_H */ | 265 | #endif /* _LINUX_SCATTERLIST_H */ |
diff --git a/include/linux/sched.h b/include/linux/sched.h index f0132f9ef4dd..1a7e8461db5a 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h | |||
@@ -87,6 +87,7 @@ struct sched_param { | |||
87 | #include <linux/task_io_accounting.h> | 87 | #include <linux/task_io_accounting.h> |
88 | #include <linux/kobject.h> | 88 | #include <linux/kobject.h> |
89 | #include <linux/latencytop.h> | 89 | #include <linux/latencytop.h> |
90 | #include <linux/cred.h> | ||
90 | 91 | ||
91 | #include <asm/processor.h> | 92 | #include <asm/processor.h> |
92 | 93 | ||
@@ -134,7 +135,6 @@ extern unsigned long nr_running(void); | |||
134 | extern unsigned long nr_uninterruptible(void); | 135 | extern unsigned long nr_uninterruptible(void); |
135 | extern unsigned long nr_active(void); | 136 | extern unsigned long nr_active(void); |
136 | extern unsigned long nr_iowait(void); | 137 | extern unsigned long nr_iowait(void); |
137 | extern unsigned long weighted_cpuload(const int cpu); | ||
138 | 138 | ||
139 | struct seq_file; | 139 | struct seq_file; |
140 | struct cfs_rq; | 140 | struct cfs_rq; |
@@ -246,6 +246,8 @@ extern asmlinkage void schedule_tail(struct task_struct *prev); | |||
246 | extern void init_idle(struct task_struct *idle, int cpu); | 246 | extern void init_idle(struct task_struct *idle, int cpu); |
247 | extern void init_idle_bootup_task(struct task_struct *idle); | 247 | extern void init_idle_bootup_task(struct task_struct *idle); |
248 | 248 | ||
249 | extern int runqueue_is_locked(void); | ||
250 | |||
249 | extern cpumask_t nohz_cpu_mask; | 251 | extern cpumask_t nohz_cpu_mask; |
250 | #if defined(CONFIG_SMP) && defined(CONFIG_NO_HZ) | 252 | #if defined(CONFIG_SMP) && defined(CONFIG_NO_HZ) |
251 | extern int select_nohz_load_balancer(int cpu); | 253 | extern int select_nohz_load_balancer(int cpu); |
@@ -291,13 +293,13 @@ extern void sched_show_task(struct task_struct *p); | |||
291 | 293 | ||
292 | #ifdef CONFIG_DETECT_SOFTLOCKUP | 294 | #ifdef CONFIG_DETECT_SOFTLOCKUP |
293 | extern void softlockup_tick(void); | 295 | extern void softlockup_tick(void); |
294 | extern void spawn_softlockup_task(void); | ||
295 | extern void touch_softlockup_watchdog(void); | 296 | extern void touch_softlockup_watchdog(void); |
296 | extern void touch_all_softlockup_watchdogs(void); | 297 | extern void touch_all_softlockup_watchdogs(void); |
297 | extern unsigned long softlockup_thresh; | 298 | extern unsigned int softlockup_panic; |
298 | extern unsigned long sysctl_hung_task_check_count; | 299 | extern unsigned long sysctl_hung_task_check_count; |
299 | extern unsigned long sysctl_hung_task_timeout_secs; | 300 | extern unsigned long sysctl_hung_task_timeout_secs; |
300 | extern unsigned long sysctl_hung_task_warnings; | 301 | extern unsigned long sysctl_hung_task_warnings; |
302 | extern int softlockup_thresh; | ||
301 | #else | 303 | #else |
302 | static inline void softlockup_tick(void) | 304 | static inline void softlockup_tick(void) |
303 | { | 305 | { |
@@ -350,7 +352,7 @@ arch_get_unmapped_area_topdown(struct file *filp, unsigned long addr, | |||
350 | extern void arch_unmap_area(struct mm_struct *, unsigned long); | 352 | extern void arch_unmap_area(struct mm_struct *, unsigned long); |
351 | extern void arch_unmap_area_topdown(struct mm_struct *, unsigned long); | 353 | extern void arch_unmap_area_topdown(struct mm_struct *, unsigned long); |
352 | 354 | ||
353 | #if NR_CPUS >= CONFIG_SPLIT_PTLOCK_CPUS | 355 | #if USE_SPLIT_PTLOCKS |
354 | /* | 356 | /* |
355 | * The mm counters are not protected by its page_table_lock, | 357 | * The mm counters are not protected by its page_table_lock, |
356 | * so must be incremented atomically. | 358 | * so must be incremented atomically. |
@@ -361,7 +363,7 @@ extern void arch_unmap_area_topdown(struct mm_struct *, unsigned long); | |||
361 | #define inc_mm_counter(mm, member) atomic_long_inc(&(mm)->_##member) | 363 | #define inc_mm_counter(mm, member) atomic_long_inc(&(mm)->_##member) |
362 | #define dec_mm_counter(mm, member) atomic_long_dec(&(mm)->_##member) | 364 | #define dec_mm_counter(mm, member) atomic_long_dec(&(mm)->_##member) |
363 | 365 | ||
364 | #else /* NR_CPUS < CONFIG_SPLIT_PTLOCK_CPUS */ | 366 | #else /* !USE_SPLIT_PTLOCKS */ |
365 | /* | 367 | /* |
366 | * The mm counters are protected by its page_table_lock, | 368 | * The mm counters are protected by its page_table_lock, |
367 | * so can be incremented directly. | 369 | * so can be incremented directly. |
@@ -372,7 +374,7 @@ extern void arch_unmap_area_topdown(struct mm_struct *, unsigned long); | |||
372 | #define inc_mm_counter(mm, member) (mm)->_##member++ | 374 | #define inc_mm_counter(mm, member) (mm)->_##member++ |
373 | #define dec_mm_counter(mm, member) (mm)->_##member-- | 375 | #define dec_mm_counter(mm, member) (mm)->_##member-- |
374 | 376 | ||
375 | #endif /* NR_CPUS < CONFIG_SPLIT_PTLOCK_CPUS */ | 377 | #endif /* !USE_SPLIT_PTLOCKS */ |
376 | 378 | ||
377 | #define get_mm_rss(mm) \ | 379 | #define get_mm_rss(mm) \ |
378 | (get_mm_counter(mm, file_rss) + get_mm_counter(mm, anon_rss)) | 380 | (get_mm_counter(mm, file_rss) + get_mm_counter(mm, anon_rss)) |
@@ -449,8 +451,8 @@ struct signal_struct { | |||
449 | * - everyone except group_exit_task is stopped during signal delivery | 451 | * - everyone except group_exit_task is stopped during signal delivery |
450 | * of fatal signals, group_exit_task processes the signal. | 452 | * of fatal signals, group_exit_task processes the signal. |
451 | */ | 453 | */ |
452 | struct task_struct *group_exit_task; | ||
453 | int notify_count; | 454 | int notify_count; |
455 | struct task_struct *group_exit_task; | ||
454 | 456 | ||
455 | /* thread group stop support, overloads group_exit_code too */ | 457 | /* thread group stop support, overloads group_exit_code too */ |
456 | int group_stop_count; | 458 | int group_stop_count; |
@@ -504,6 +506,7 @@ struct signal_struct { | |||
504 | unsigned long nvcsw, nivcsw, cnvcsw, cnivcsw; | 506 | unsigned long nvcsw, nivcsw, cnvcsw, cnivcsw; |
505 | unsigned long min_flt, maj_flt, cmin_flt, cmaj_flt; | 507 | unsigned long min_flt, maj_flt, cmin_flt, cmaj_flt; |
506 | unsigned long inblock, oublock, cinblock, coublock; | 508 | unsigned long inblock, oublock, cinblock, coublock; |
509 | struct task_io_accounting ioac; | ||
507 | 510 | ||
508 | /* | 511 | /* |
509 | * Cumulative ns of scheduled CPU time for dead threads in the | 512 | * Cumulative ns of scheduled CPU time for dead threads in the |
@@ -666,6 +669,10 @@ struct task_delay_info { | |||
666 | /* io operations performed */ | 669 | /* io operations performed */ |
667 | u32 swapin_count; /* total count of the number of swapin block */ | 670 | u32 swapin_count; /* total count of the number of swapin block */ |
668 | /* io operations performed */ | 671 | /* io operations performed */ |
672 | |||
673 | struct timespec freepages_start, freepages_end; | ||
674 | u64 freepages_delay; /* wait for memory reclaim */ | ||
675 | u32 freepages_count; /* total count of memory reclaim */ | ||
669 | }; | 676 | }; |
670 | #endif /* CONFIG_TASK_DELAY_ACCT */ | 677 | #endif /* CONFIG_TASK_DELAY_ACCT */ |
671 | 678 | ||
@@ -784,6 +791,8 @@ struct sched_domain { | |||
784 | unsigned int balance_interval; /* initialise to 1. units in ms. */ | 791 | unsigned int balance_interval; /* initialise to 1. units in ms. */ |
785 | unsigned int nr_balance_failed; /* initialise to 0 */ | 792 | unsigned int nr_balance_failed; /* initialise to 0 */ |
786 | 793 | ||
794 | u64 last_update; | ||
795 | |||
787 | #ifdef CONFIG_SCHEDSTATS | 796 | #ifdef CONFIG_SCHEDSTATS |
788 | /* load_balance() stats */ | 797 | /* load_balance() stats */ |
789 | unsigned int lb_count[CPU_MAX_IDLE_TYPES]; | 798 | unsigned int lb_count[CPU_MAX_IDLE_TYPES]; |
@@ -815,30 +824,25 @@ struct sched_domain { | |||
815 | unsigned int ttwu_move_affine; | 824 | unsigned int ttwu_move_affine; |
816 | unsigned int ttwu_move_balance; | 825 | unsigned int ttwu_move_balance; |
817 | #endif | 826 | #endif |
827 | #ifdef CONFIG_SCHED_DEBUG | ||
828 | char *name; | ||
829 | #endif | ||
818 | }; | 830 | }; |
819 | 831 | ||
820 | extern void partition_sched_domains(int ndoms_new, cpumask_t *doms_new, | 832 | extern void partition_sched_domains(int ndoms_new, cpumask_t *doms_new, |
821 | struct sched_domain_attr *dattr_new); | 833 | struct sched_domain_attr *dattr_new); |
822 | extern int arch_reinit_sched_domains(void); | 834 | extern int arch_reinit_sched_domains(void); |
823 | 835 | ||
824 | #endif /* CONFIG_SMP */ | 836 | #else /* CONFIG_SMP */ |
825 | 837 | ||
826 | /* | 838 | struct sched_domain_attr; |
827 | * A runqueue laden with a single nice 0 task scores a weighted_cpuload of | ||
828 | * SCHED_LOAD_SCALE. This function returns 1 if any cpu is laden with a | ||
829 | * task of nice 0 or enough lower priority tasks to bring up the | ||
830 | * weighted_cpuload | ||
831 | */ | ||
832 | static inline int above_background_load(void) | ||
833 | { | ||
834 | unsigned long cpu; | ||
835 | 839 | ||
836 | for_each_online_cpu(cpu) { | 840 | static inline void |
837 | if (weighted_cpuload(cpu) >= SCHED_LOAD_SCALE) | 841 | partition_sched_domains(int ndoms_new, cpumask_t *doms_new, |
838 | return 1; | 842 | struct sched_domain_attr *dattr_new) |
839 | } | 843 | { |
840 | return 0; | ||
841 | } | 844 | } |
845 | #endif /* !CONFIG_SMP */ | ||
842 | 846 | ||
843 | struct io_context; /* See blkdev.h */ | 847 | struct io_context; /* See blkdev.h */ |
844 | #define NGROUPS_SMALL 32 | 848 | #define NGROUPS_SMALL 32 |
@@ -896,7 +900,7 @@ struct sched_class { | |||
896 | void (*yield_task) (struct rq *rq); | 900 | void (*yield_task) (struct rq *rq); |
897 | int (*select_task_rq)(struct task_struct *p, int sync); | 901 | int (*select_task_rq)(struct task_struct *p, int sync); |
898 | 902 | ||
899 | void (*check_preempt_curr) (struct rq *rq, struct task_struct *p); | 903 | void (*check_preempt_curr) (struct rq *rq, struct task_struct *p, int sync); |
900 | 904 | ||
901 | struct task_struct * (*pick_next_task) (struct rq *rq); | 905 | struct task_struct * (*pick_next_task) (struct rq *rq); |
902 | void (*put_prev_task) (struct rq *rq, struct task_struct *p); | 906 | void (*put_prev_task) (struct rq *rq, struct task_struct *p); |
@@ -921,8 +925,8 @@ struct sched_class { | |||
921 | void (*set_cpus_allowed)(struct task_struct *p, | 925 | void (*set_cpus_allowed)(struct task_struct *p, |
922 | const cpumask_t *newmask); | 926 | const cpumask_t *newmask); |
923 | 927 | ||
924 | void (*join_domain)(struct rq *rq); | 928 | void (*rq_online)(struct rq *rq); |
925 | void (*leave_domain)(struct rq *rq); | 929 | void (*rq_offline)(struct rq *rq); |
926 | 930 | ||
927 | void (*switched_from) (struct rq *this_rq, struct task_struct *task, | 931 | void (*switched_from) (struct rq *this_rq, struct task_struct *task, |
928 | int running); | 932 | int running); |
@@ -1009,8 +1013,8 @@ struct sched_entity { | |||
1009 | 1013 | ||
1010 | struct sched_rt_entity { | 1014 | struct sched_rt_entity { |
1011 | struct list_head run_list; | 1015 | struct list_head run_list; |
1012 | unsigned int time_slice; | ||
1013 | unsigned long timeout; | 1016 | unsigned long timeout; |
1017 | unsigned int time_slice; | ||
1014 | int nr_cpus_allowed; | 1018 | int nr_cpus_allowed; |
1015 | 1019 | ||
1016 | struct sched_rt_entity *back; | 1020 | struct sched_rt_entity *back; |
@@ -1039,6 +1043,7 @@ struct task_struct { | |||
1039 | #endif | 1043 | #endif |
1040 | 1044 | ||
1041 | int prio, static_prio, normal_prio; | 1045 | int prio, static_prio, normal_prio; |
1046 | unsigned int rt_priority; | ||
1042 | const struct sched_class *sched_class; | 1047 | const struct sched_class *sched_class; |
1043 | struct sched_entity se; | 1048 | struct sched_entity se; |
1044 | struct sched_rt_entity rt; | 1049 | struct sched_rt_entity rt; |
@@ -1075,12 +1080,6 @@ struct task_struct { | |||
1075 | #endif | 1080 | #endif |
1076 | 1081 | ||
1077 | struct list_head tasks; | 1082 | struct list_head tasks; |
1078 | /* | ||
1079 | * ptrace_list/ptrace_children forms the list of my children | ||
1080 | * that were stolen by a ptracer. | ||
1081 | */ | ||
1082 | struct list_head ptrace_children; | ||
1083 | struct list_head ptrace_list; | ||
1084 | 1083 | ||
1085 | struct mm_struct *mm, *active_mm; | 1084 | struct mm_struct *mm, *active_mm; |
1086 | 1085 | ||
@@ -1101,18 +1100,25 @@ struct task_struct { | |||
1101 | /* | 1100 | /* |
1102 | * pointers to (original) parent process, youngest child, younger sibling, | 1101 | * pointers to (original) parent process, youngest child, younger sibling, |
1103 | * older sibling, respectively. (p->father can be replaced with | 1102 | * older sibling, respectively. (p->father can be replaced with |
1104 | * p->parent->pid) | 1103 | * p->real_parent->pid) |
1105 | */ | 1104 | */ |
1106 | struct task_struct *real_parent; /* real parent process (when being debugged) */ | 1105 | struct task_struct *real_parent; /* real parent process */ |
1107 | struct task_struct *parent; /* parent process */ | 1106 | struct task_struct *parent; /* recipient of SIGCHLD, wait4() reports */ |
1108 | /* | 1107 | /* |
1109 | * children/sibling forms the list of my children plus the | 1108 | * children/sibling forms the list of my natural children |
1110 | * tasks I'm ptracing. | ||
1111 | */ | 1109 | */ |
1112 | struct list_head children; /* list of my children */ | 1110 | struct list_head children; /* list of my children */ |
1113 | struct list_head sibling; /* linkage in my parent's children list */ | 1111 | struct list_head sibling; /* linkage in my parent's children list */ |
1114 | struct task_struct *group_leader; /* threadgroup leader */ | 1112 | struct task_struct *group_leader; /* threadgroup leader */ |
1115 | 1113 | ||
1114 | /* | ||
1115 | * ptraced is the list of tasks this task is using ptrace on. | ||
1116 | * This includes both natural children and PTRACE_ATTACH targets. | ||
1117 | * p->ptrace_entry is p's link on the p->parent->ptraced list. | ||
1118 | */ | ||
1119 | struct list_head ptraced; | ||
1120 | struct list_head ptrace_entry; | ||
1121 | |||
1116 | /* PID/PID hash table linkage. */ | 1122 | /* PID/PID hash table linkage. */ |
1117 | struct pid_link pids[PIDTYPE_MAX]; | 1123 | struct pid_link pids[PIDTYPE_MAX]; |
1118 | struct list_head thread_group; | 1124 | struct list_head thread_group; |
@@ -1121,7 +1127,6 @@ struct task_struct { | |||
1121 | int __user *set_child_tid; /* CLONE_CHILD_SETTID */ | 1127 | int __user *set_child_tid; /* CLONE_CHILD_SETTID */ |
1122 | int __user *clear_child_tid; /* CLONE_CHILD_CLEARTID */ | 1128 | int __user *clear_child_tid; /* CLONE_CHILD_CLEARTID */ |
1123 | 1129 | ||
1124 | unsigned int rt_priority; | ||
1125 | cputime_t utime, stime, utimescaled, stimescaled; | 1130 | cputime_t utime, stime, utimescaled, stimescaled; |
1126 | cputime_t gtime; | 1131 | cputime_t gtime; |
1127 | cputime_t prev_utime, prev_stime; | 1132 | cputime_t prev_utime, prev_stime; |
@@ -1140,12 +1145,12 @@ struct task_struct { | |||
1140 | gid_t gid,egid,sgid,fsgid; | 1145 | gid_t gid,egid,sgid,fsgid; |
1141 | struct group_info *group_info; | 1146 | struct group_info *group_info; |
1142 | kernel_cap_t cap_effective, cap_inheritable, cap_permitted, cap_bset; | 1147 | kernel_cap_t cap_effective, cap_inheritable, cap_permitted, cap_bset; |
1143 | unsigned securebits; | ||
1144 | struct user_struct *user; | 1148 | struct user_struct *user; |
1149 | unsigned securebits; | ||
1145 | #ifdef CONFIG_KEYS | 1150 | #ifdef CONFIG_KEYS |
1151 | unsigned char jit_keyring; /* default keyring to attach requested keys to */ | ||
1146 | struct key *request_key_auth; /* assumed request_key authority */ | 1152 | struct key *request_key_auth; /* assumed request_key authority */ |
1147 | struct key *thread_keyring; /* keyring private to this thread */ | 1153 | struct key *thread_keyring; /* keyring private to this thread */ |
1148 | unsigned char jit_keyring; /* default keyring to attach requested keys to */ | ||
1149 | #endif | 1154 | #endif |
1150 | char comm[TASK_COMM_LEN]; /* executable name excluding path | 1155 | char comm[TASK_COMM_LEN]; /* executable name excluding path |
1151 | - access with [gs]et_task_comm (which lock | 1156 | - access with [gs]et_task_comm (which lock |
@@ -1232,8 +1237,8 @@ struct task_struct { | |||
1232 | # define MAX_LOCK_DEPTH 48UL | 1237 | # define MAX_LOCK_DEPTH 48UL |
1233 | u64 curr_chain_key; | 1238 | u64 curr_chain_key; |
1234 | int lockdep_depth; | 1239 | int lockdep_depth; |
1235 | struct held_lock held_locks[MAX_LOCK_DEPTH]; | ||
1236 | unsigned int lockdep_recursion; | 1240 | unsigned int lockdep_recursion; |
1241 | struct held_lock held_locks[MAX_LOCK_DEPTH]; | ||
1237 | #endif | 1242 | #endif |
1238 | 1243 | ||
1239 | /* journalling filesystem info */ | 1244 | /* journalling filesystem info */ |
@@ -1251,19 +1256,11 @@ struct task_struct { | |||
1251 | 1256 | ||
1252 | unsigned long ptrace_message; | 1257 | unsigned long ptrace_message; |
1253 | siginfo_t *last_siginfo; /* For ptrace use. */ | 1258 | siginfo_t *last_siginfo; /* For ptrace use. */ |
1254 | #ifdef CONFIG_TASK_XACCT | ||
1255 | /* i/o counters(bytes read/written, #syscalls */ | ||
1256 | u64 rchar, wchar, syscr, syscw; | ||
1257 | #endif | ||
1258 | struct task_io_accounting ioac; | 1259 | struct task_io_accounting ioac; |
1259 | #if defined(CONFIG_TASK_XACCT) | 1260 | #if defined(CONFIG_TASK_XACCT) |
1260 | u64 acct_rss_mem1; /* accumulated rss usage */ | 1261 | u64 acct_rss_mem1; /* accumulated rss usage */ |
1261 | u64 acct_vm_mem1; /* accumulated virtual memory usage */ | 1262 | u64 acct_vm_mem1; /* accumulated virtual memory usage */ |
1262 | cputime_t acct_stimexpd;/* stime since last update */ | 1263 | cputime_t acct_timexpd; /* stime + utime since last update */ |
1263 | #endif | ||
1264 | #ifdef CONFIG_NUMA | ||
1265 | struct mempolicy *mempolicy; | ||
1266 | short il_next; | ||
1267 | #endif | 1264 | #endif |
1268 | #ifdef CONFIG_CPUSETS | 1265 | #ifdef CONFIG_CPUSETS |
1269 | nodemask_t mems_allowed; | 1266 | nodemask_t mems_allowed; |
@@ -1284,6 +1281,10 @@ struct task_struct { | |||
1284 | struct list_head pi_state_list; | 1281 | struct list_head pi_state_list; |
1285 | struct futex_pi_state *pi_state_cache; | 1282 | struct futex_pi_state *pi_state_cache; |
1286 | #endif | 1283 | #endif |
1284 | #ifdef CONFIG_NUMA | ||
1285 | struct mempolicy *mempolicy; | ||
1286 | short il_next; | ||
1287 | #endif | ||
1287 | atomic_t fs_excl; /* holding fs exclusive resources */ | 1288 | atomic_t fs_excl; /* holding fs exclusive resources */ |
1288 | struct rcu_head rcu; | 1289 | struct rcu_head rcu; |
1289 | 1290 | ||
@@ -1476,6 +1477,10 @@ static inline void put_task_struct(struct task_struct *t) | |||
1476 | __put_task_struct(t); | 1477 | __put_task_struct(t); |
1477 | } | 1478 | } |
1478 | 1479 | ||
1480 | extern cputime_t task_utime(struct task_struct *p); | ||
1481 | extern cputime_t task_stime(struct task_struct *p); | ||
1482 | extern cputime_t task_gtime(struct task_struct *p); | ||
1483 | |||
1479 | /* | 1484 | /* |
1480 | * Per process flags | 1485 | * Per process flags |
1481 | */ | 1486 | */ |
@@ -1498,14 +1503,16 @@ static inline void put_task_struct(struct task_struct *t) | |||
1498 | #define PF_KSWAPD 0x00040000 /* I am kswapd */ | 1503 | #define PF_KSWAPD 0x00040000 /* I am kswapd */ |
1499 | #define PF_SWAPOFF 0x00080000 /* I am in swapoff */ | 1504 | #define PF_SWAPOFF 0x00080000 /* I am in swapoff */ |
1500 | #define PF_LESS_THROTTLE 0x00100000 /* Throttle me less: I clean memory */ | 1505 | #define PF_LESS_THROTTLE 0x00100000 /* Throttle me less: I clean memory */ |
1501 | #define PF_BORROWED_MM 0x00200000 /* I am a kthread doing use_mm */ | 1506 | #define PF_KTHREAD 0x00200000 /* I am a kernel thread */ |
1502 | #define PF_RANDOMIZE 0x00400000 /* randomize virtual address space */ | 1507 | #define PF_RANDOMIZE 0x00400000 /* randomize virtual address space */ |
1503 | #define PF_SWAPWRITE 0x00800000 /* Allowed to write to swap */ | 1508 | #define PF_SWAPWRITE 0x00800000 /* Allowed to write to swap */ |
1504 | #define PF_SPREAD_PAGE 0x01000000 /* Spread page cache over cpuset */ | 1509 | #define PF_SPREAD_PAGE 0x01000000 /* Spread page cache over cpuset */ |
1505 | #define PF_SPREAD_SLAB 0x02000000 /* Spread some slab caches over cpuset */ | 1510 | #define PF_SPREAD_SLAB 0x02000000 /* Spread some slab caches over cpuset */ |
1511 | #define PF_THREAD_BOUND 0x04000000 /* Thread bound to specific cpu */ | ||
1506 | #define PF_MEMPOLICY 0x10000000 /* Non-default NUMA mempolicy */ | 1512 | #define PF_MEMPOLICY 0x10000000 /* Non-default NUMA mempolicy */ |
1507 | #define PF_MUTEX_TESTER 0x20000000 /* Thread belongs to the rt mutex tester */ | 1513 | #define PF_MUTEX_TESTER 0x20000000 /* Thread belongs to the rt mutex tester */ |
1508 | #define PF_FREEZER_SKIP 0x40000000 /* Freezer should not count it as freezeable */ | 1514 | #define PF_FREEZER_SKIP 0x40000000 /* Freezer should not count it as freezeable */ |
1515 | #define PF_FREEZER_NOSIG 0x80000000 /* Freezer won't send signals to it */ | ||
1509 | 1516 | ||
1510 | /* | 1517 | /* |
1511 | * Only the _current_ task can read/write to tsk->flags, but other | 1518 | * Only the _current_ task can read/write to tsk->flags, but other |
@@ -1551,16 +1558,10 @@ static inline int set_cpus_allowed(struct task_struct *p, cpumask_t new_mask) | |||
1551 | 1558 | ||
1552 | extern unsigned long long sched_clock(void); | 1559 | extern unsigned long long sched_clock(void); |
1553 | 1560 | ||
1554 | #ifndef CONFIG_HAVE_UNSTABLE_SCHED_CLOCK | 1561 | extern void sched_clock_init(void); |
1555 | static inline void sched_clock_init(void) | 1562 | extern u64 sched_clock_cpu(int cpu); |
1556 | { | ||
1557 | } | ||
1558 | |||
1559 | static inline u64 sched_clock_cpu(int cpu) | ||
1560 | { | ||
1561 | return sched_clock(); | ||
1562 | } | ||
1563 | 1563 | ||
1564 | #ifndef CONFIG_HAVE_UNSTABLE_SCHED_CLOCK | ||
1564 | static inline void sched_clock_tick(void) | 1565 | static inline void sched_clock_tick(void) |
1565 | { | 1566 | { |
1566 | } | 1567 | } |
@@ -1573,8 +1574,6 @@ static inline void sched_clock_idle_wakeup_event(u64 delta_ns) | |||
1573 | { | 1574 | { |
1574 | } | 1575 | } |
1575 | #else | 1576 | #else |
1576 | extern void sched_clock_init(void); | ||
1577 | extern u64 sched_clock_cpu(int cpu); | ||
1578 | extern void sched_clock_tick(void); | 1577 | extern void sched_clock_tick(void); |
1579 | extern void sched_clock_idle_sleep_event(void); | 1578 | extern void sched_clock_idle_sleep_event(void); |
1580 | extern void sched_clock_idle_wakeup_event(u64 delta_ns); | 1579 | extern void sched_clock_idle_wakeup_event(u64 delta_ns); |
@@ -1621,6 +1620,7 @@ extern unsigned int sysctl_sched_child_runs_first; | |||
1621 | extern unsigned int sysctl_sched_features; | 1620 | extern unsigned int sysctl_sched_features; |
1622 | extern unsigned int sysctl_sched_migration_cost; | 1621 | extern unsigned int sysctl_sched_migration_cost; |
1623 | extern unsigned int sysctl_sched_nr_migrate; | 1622 | extern unsigned int sysctl_sched_nr_migrate; |
1623 | extern unsigned int sysctl_sched_shares_ratelimit; | ||
1624 | 1624 | ||
1625 | int sched_nr_latency_handler(struct ctl_table *table, int write, | 1625 | int sched_nr_latency_handler(struct ctl_table *table, int write, |
1626 | struct file *file, void __user *buffer, size_t *length, | 1626 | struct file *file, void __user *buffer, size_t *length, |
@@ -1654,6 +1654,8 @@ extern int can_nice(const struct task_struct *p, const int nice); | |||
1654 | extern int task_curr(const struct task_struct *p); | 1654 | extern int task_curr(const struct task_struct *p); |
1655 | extern int idle_cpu(int cpu); | 1655 | extern int idle_cpu(int cpu); |
1656 | extern int sched_setscheduler(struct task_struct *, int, struct sched_param *); | 1656 | extern int sched_setscheduler(struct task_struct *, int, struct sched_param *); |
1657 | extern int sched_setscheduler_nocheck(struct task_struct *, int, | ||
1658 | struct sched_param *); | ||
1657 | extern struct task_struct *idle_task(int cpu); | 1659 | extern struct task_struct *idle_task(int cpu); |
1658 | extern struct task_struct *curr_task(int cpu); | 1660 | extern struct task_struct *curr_task(int cpu); |
1659 | extern void set_curr_task(int cpu, struct task_struct *p); | 1661 | extern void set_curr_task(int cpu, struct task_struct *p); |
@@ -1697,19 +1699,13 @@ extern struct pid_namespace init_pid_ns; | |||
1697 | * finds a task by its pid in the specified namespace | 1699 | * finds a task by its pid in the specified namespace |
1698 | * find_task_by_vpid(): | 1700 | * find_task_by_vpid(): |
1699 | * finds a task by its virtual pid | 1701 | * finds a task by its virtual pid |
1700 | * find_task_by_pid(): | ||
1701 | * finds a task by its global pid | ||
1702 | * | 1702 | * |
1703 | * see also find_pid() etc in include/linux/pid.h | 1703 | * see also find_vpid() etc in include/linux/pid.h |
1704 | */ | 1704 | */ |
1705 | 1705 | ||
1706 | extern struct task_struct *find_task_by_pid_type_ns(int type, int pid, | 1706 | extern struct task_struct *find_task_by_pid_type_ns(int type, int pid, |
1707 | struct pid_namespace *ns); | 1707 | struct pid_namespace *ns); |
1708 | 1708 | ||
1709 | static inline struct task_struct *__deprecated find_task_by_pid(pid_t nr) | ||
1710 | { | ||
1711 | return find_task_by_pid_type_ns(PIDTYPE_PID, nr, &init_pid_ns); | ||
1712 | } | ||
1713 | extern struct task_struct *find_task_by_vpid(pid_t nr); | 1709 | extern struct task_struct *find_task_by_vpid(pid_t nr); |
1714 | extern struct task_struct *find_task_by_pid_ns(pid_t nr, | 1710 | extern struct task_struct *find_task_by_pid_ns(pid_t nr, |
1715 | struct pid_namespace *ns); | 1711 | struct pid_namespace *ns); |
@@ -1777,12 +1773,11 @@ extern int kill_pid_info_as_uid(int, struct siginfo *, struct pid *, uid_t, uid_ | |||
1777 | extern int kill_pgrp(struct pid *pid, int sig, int priv); | 1773 | extern int kill_pgrp(struct pid *pid, int sig, int priv); |
1778 | extern int kill_pid(struct pid *pid, int sig, int priv); | 1774 | extern int kill_pid(struct pid *pid, int sig, int priv); |
1779 | extern int kill_proc_info(int, struct siginfo *, pid_t); | 1775 | extern int kill_proc_info(int, struct siginfo *, pid_t); |
1780 | extern void do_notify_parent(struct task_struct *, int); | 1776 | extern int do_notify_parent(struct task_struct *, int); |
1781 | extern void force_sig(int, struct task_struct *); | 1777 | extern void force_sig(int, struct task_struct *); |
1782 | extern void force_sig_specific(int, struct task_struct *); | 1778 | extern void force_sig_specific(int, struct task_struct *); |
1783 | extern int send_sig(int, struct task_struct *, int); | 1779 | extern int send_sig(int, struct task_struct *, int); |
1784 | extern void zap_other_threads(struct task_struct *p); | 1780 | extern void zap_other_threads(struct task_struct *p); |
1785 | extern int kill_proc(pid_t, int, int); | ||
1786 | extern struct sigqueue *sigqueue_alloc(void); | 1781 | extern struct sigqueue *sigqueue_alloc(void); |
1787 | extern void sigqueue_free(struct sigqueue *); | 1782 | extern void sigqueue_free(struct sigqueue *); |
1788 | extern int send_sigqueue(struct sigqueue *, struct task_struct *, int group); | 1783 | extern int send_sigqueue(struct sigqueue *, struct task_struct *, int group); |
@@ -1864,14 +1859,15 @@ extern void set_task_comm(struct task_struct *tsk, char *from); | |||
1864 | extern char *get_task_comm(char *to, struct task_struct *tsk); | 1859 | extern char *get_task_comm(char *to, struct task_struct *tsk); |
1865 | 1860 | ||
1866 | #ifdef CONFIG_SMP | 1861 | #ifdef CONFIG_SMP |
1867 | extern void wait_task_inactive(struct task_struct * p); | 1862 | extern unsigned long wait_task_inactive(struct task_struct *, long match_state); |
1868 | #else | 1863 | #else |
1869 | #define wait_task_inactive(p) do { } while (0) | 1864 | static inline unsigned long wait_task_inactive(struct task_struct *p, |
1865 | long match_state) | ||
1866 | { | ||
1867 | return 1; | ||
1868 | } | ||
1870 | #endif | 1869 | #endif |
1871 | 1870 | ||
1872 | #define remove_parent(p) list_del_init(&(p)->sibling) | ||
1873 | #define add_parent(p) list_add_tail(&(p)->sibling,&(p)->parent->children) | ||
1874 | |||
1875 | #define next_task(p) list_entry(rcu_dereference((p)->tasks.next), struct task_struct, tasks) | 1871 | #define next_task(p) list_entry(rcu_dereference((p)->tasks.next), struct task_struct, tasks) |
1876 | 1872 | ||
1877 | #define for_each_process(p) \ | 1873 | #define for_each_process(p) \ |
@@ -1968,6 +1964,13 @@ static inline unsigned long *end_of_stack(struct task_struct *p) | |||
1968 | 1964 | ||
1969 | #endif | 1965 | #endif |
1970 | 1966 | ||
1967 | static inline int object_is_on_stack(void *obj) | ||
1968 | { | ||
1969 | void *stack = task_stack_page(current); | ||
1970 | |||
1971 | return (obj >= stack) && (obj < (stack + THREAD_SIZE)); | ||
1972 | } | ||
1973 | |||
1971 | extern void thread_info_cache_init(void); | 1974 | extern void thread_info_cache_init(void); |
1972 | 1975 | ||
1973 | #ifdef CONFIG_DEBUG_STACK_USAGE | 1976 | #ifdef CONFIG_DEBUG_STACK_USAGE |
@@ -2045,9 +2048,6 @@ static inline int signal_pending_state(long state, struct task_struct *p) | |||
2045 | if (!signal_pending(p)) | 2048 | if (!signal_pending(p)) |
2046 | return 0; | 2049 | return 0; |
2047 | 2050 | ||
2048 | if (state & (__TASK_STOPPED | __TASK_TRACED)) | ||
2049 | return 0; | ||
2050 | |||
2051 | return (state & TASK_INTERRUPTIBLE) || __fatal_signal_pending(p); | 2051 | return (state & TASK_INTERRUPTIBLE) || __fatal_signal_pending(p); |
2052 | } | 2052 | } |
2053 | 2053 | ||
@@ -2132,14 +2132,17 @@ static inline void set_task_cpu(struct task_struct *p, unsigned int cpu) | |||
2132 | 2132 | ||
2133 | #endif /* CONFIG_SMP */ | 2133 | #endif /* CONFIG_SMP */ |
2134 | 2134 | ||
2135 | #ifdef HAVE_ARCH_PICK_MMAP_LAYOUT | ||
2136 | extern void arch_pick_mmap_layout(struct mm_struct *mm); | 2135 | extern void arch_pick_mmap_layout(struct mm_struct *mm); |
2136 | |||
2137 | #ifdef CONFIG_TRACING | ||
2138 | extern void | ||
2139 | __trace_special(void *__tr, void *__data, | ||
2140 | unsigned long arg1, unsigned long arg2, unsigned long arg3); | ||
2137 | #else | 2141 | #else |
2138 | static inline void arch_pick_mmap_layout(struct mm_struct *mm) | 2142 | static inline void |
2143 | __trace_special(void *__tr, void *__data, | ||
2144 | unsigned long arg1, unsigned long arg2, unsigned long arg3) | ||
2139 | { | 2145 | { |
2140 | mm->mmap_base = TASK_UNMAPPED_BASE; | ||
2141 | mm->get_unmapped_area = arch_get_unmapped_area; | ||
2142 | mm->unmap_area = arch_unmap_area; | ||
2143 | } | 2146 | } |
2144 | #endif | 2147 | #endif |
2145 | 2148 | ||
@@ -2177,22 +2180,22 @@ extern long sched_group_rt_period(struct task_group *tg); | |||
2177 | #ifdef CONFIG_TASK_XACCT | 2180 | #ifdef CONFIG_TASK_XACCT |
2178 | static inline void add_rchar(struct task_struct *tsk, ssize_t amt) | 2181 | static inline void add_rchar(struct task_struct *tsk, ssize_t amt) |
2179 | { | 2182 | { |
2180 | tsk->rchar += amt; | 2183 | tsk->ioac.rchar += amt; |
2181 | } | 2184 | } |
2182 | 2185 | ||
2183 | static inline void add_wchar(struct task_struct *tsk, ssize_t amt) | 2186 | static inline void add_wchar(struct task_struct *tsk, ssize_t amt) |
2184 | { | 2187 | { |
2185 | tsk->wchar += amt; | 2188 | tsk->ioac.wchar += amt; |
2186 | } | 2189 | } |
2187 | 2190 | ||
2188 | static inline void inc_syscr(struct task_struct *tsk) | 2191 | static inline void inc_syscr(struct task_struct *tsk) |
2189 | { | 2192 | { |
2190 | tsk->syscr++; | 2193 | tsk->ioac.syscr++; |
2191 | } | 2194 | } |
2192 | 2195 | ||
2193 | static inline void inc_syscw(struct task_struct *tsk) | 2196 | static inline void inc_syscw(struct task_struct *tsk) |
2194 | { | 2197 | { |
2195 | tsk->syscw++; | 2198 | tsk->ioac.syscw++; |
2196 | } | 2199 | } |
2197 | #else | 2200 | #else |
2198 | static inline void add_rchar(struct task_struct *tsk, ssize_t amt) | 2201 | static inline void add_rchar(struct task_struct *tsk, ssize_t amt) |
@@ -2212,14 +2215,6 @@ static inline void inc_syscw(struct task_struct *tsk) | |||
2212 | } | 2215 | } |
2213 | #endif | 2216 | #endif |
2214 | 2217 | ||
2215 | #ifdef CONFIG_SMP | ||
2216 | void migration_init(void); | ||
2217 | #else | ||
2218 | static inline void migration_init(void) | ||
2219 | { | ||
2220 | } | ||
2221 | #endif | ||
2222 | |||
2223 | #ifndef TASK_SIZE_OF | 2218 | #ifndef TASK_SIZE_OF |
2224 | #define TASK_SIZE_OF(tsk) TASK_SIZE | 2219 | #define TASK_SIZE_OF(tsk) TASK_SIZE |
2225 | #endif | 2220 | #endif |
@@ -2237,6 +2232,8 @@ static inline void mm_init_owner(struct mm_struct *mm, struct task_struct *p) | |||
2237 | } | 2232 | } |
2238 | #endif /* CONFIG_MM_OWNER */ | 2233 | #endif /* CONFIG_MM_OWNER */ |
2239 | 2234 | ||
2235 | #define TASK_STATE_TO_CHAR_STR "RSDTtZX" | ||
2236 | |||
2240 | #endif /* __KERNEL__ */ | 2237 | #endif /* __KERNEL__ */ |
2241 | 2238 | ||
2242 | #endif | 2239 | #endif |
diff --git a/include/linux/securebits.h b/include/linux/securebits.h index c1f19dbceb05..92f09bdf1175 100644 --- a/include/linux/securebits.h +++ b/include/linux/securebits.h | |||
@@ -7,14 +7,15 @@ | |||
7 | inheritance of root-permissions and suid-root executable under | 7 | inheritance of root-permissions and suid-root executable under |
8 | compatibility mode. We raise the effective and inheritable bitmasks | 8 | compatibility mode. We raise the effective and inheritable bitmasks |
9 | *of the executable file* if the effective uid of the new process is | 9 | *of the executable file* if the effective uid of the new process is |
10 | 0. If the real uid is 0, we raise the inheritable bitmask of the | 10 | 0. If the real uid is 0, we raise the effective (legacy) bit of the |
11 | executable file. */ | 11 | executable file. */ |
12 | #define SECURE_NOROOT 0 | 12 | #define SECURE_NOROOT 0 |
13 | #define SECURE_NOROOT_LOCKED 1 /* make bit-0 immutable */ | 13 | #define SECURE_NOROOT_LOCKED 1 /* make bit-0 immutable */ |
14 | 14 | ||
15 | /* When set, setuid to/from uid 0 does not trigger capability-"fixes" | 15 | /* When set, setuid to/from uid 0 does not trigger capability-"fixup". |
16 | to be compatible with old programs relying on set*uid to loose | 16 | When unset, to provide compatiblility with old programs relying on |
17 | privileges. When unset, setuid doesn't change privileges. */ | 17 | set*uid to gain/lose privilege, transitions to/from uid 0 cause |
18 | capabilities to be gained/lost. */ | ||
18 | #define SECURE_NO_SETUID_FIXUP 2 | 19 | #define SECURE_NO_SETUID_FIXUP 2 |
19 | #define SECURE_NO_SETUID_FIXUP_LOCKED 3 /* make bit-2 immutable */ | 20 | #define SECURE_NO_SETUID_FIXUP_LOCKED 3 /* make bit-2 immutable */ |
20 | 21 | ||
@@ -26,10 +27,10 @@ | |||
26 | #define SECURE_KEEP_CAPS 4 | 27 | #define SECURE_KEEP_CAPS 4 |
27 | #define SECURE_KEEP_CAPS_LOCKED 5 /* make bit-4 immutable */ | 28 | #define SECURE_KEEP_CAPS_LOCKED 5 /* make bit-4 immutable */ |
28 | 29 | ||
29 | /* Each securesetting is implemented using two bits. One bit specify | 30 | /* Each securesetting is implemented using two bits. One bit specifies |
30 | whether the setting is on or off. The other bit specify whether the | 31 | whether the setting is on or off. The other bit specify whether the |
31 | setting is fixed or not. A setting which is fixed cannot be changed | 32 | setting is locked or not. A setting which is locked cannot be |
32 | from user-level. */ | 33 | changed from user-level. */ |
33 | #define issecure_mask(X) (1 << (X)) | 34 | #define issecure_mask(X) (1 << (X)) |
34 | #define issecure(X) (issecure_mask(X) & current->securebits) | 35 | #define issecure(X) (issecure_mask(X) & current->securebits) |
35 | 36 | ||
diff --git a/include/linux/security.h b/include/linux/security.h index 50737c70e78e..f5c4a51eb42e 100644 --- a/include/linux/security.h +++ b/include/linux/security.h | |||
@@ -46,7 +46,8 @@ struct audit_krule; | |||
46 | */ | 46 | */ |
47 | extern int cap_capable(struct task_struct *tsk, int cap); | 47 | extern int cap_capable(struct task_struct *tsk, int cap); |
48 | extern int cap_settime(struct timespec *ts, struct timezone *tz); | 48 | extern int cap_settime(struct timespec *ts, struct timezone *tz); |
49 | extern int cap_ptrace(struct task_struct *parent, struct task_struct *child); | 49 | extern int cap_ptrace_may_access(struct task_struct *child, unsigned int mode); |
50 | extern int cap_ptrace_traceme(struct task_struct *parent); | ||
50 | extern int cap_capget(struct task_struct *target, kernel_cap_t *effective, kernel_cap_t *inheritable, kernel_cap_t *permitted); | 51 | extern int cap_capget(struct task_struct *target, kernel_cap_t *effective, kernel_cap_t *inheritable, kernel_cap_t *permitted); |
51 | extern int cap_capset_check(struct task_struct *target, kernel_cap_t *effective, kernel_cap_t *inheritable, kernel_cap_t *permitted); | 52 | extern int cap_capset_check(struct task_struct *target, kernel_cap_t *effective, kernel_cap_t *inheritable, kernel_cap_t *permitted); |
52 | extern void cap_capset_set(struct task_struct *target, kernel_cap_t *effective, kernel_cap_t *inheritable, kernel_cap_t *permitted); | 53 | extern void cap_capset_set(struct task_struct *target, kernel_cap_t *effective, kernel_cap_t *inheritable, kernel_cap_t *permitted); |
@@ -79,6 +80,7 @@ struct xfrm_selector; | |||
79 | struct xfrm_policy; | 80 | struct xfrm_policy; |
80 | struct xfrm_state; | 81 | struct xfrm_state; |
81 | struct xfrm_user_sec_ctx; | 82 | struct xfrm_user_sec_ctx; |
83 | struct seq_file; | ||
82 | 84 | ||
83 | extern int cap_netlink_send(struct sock *sk, struct sk_buff *skb); | 85 | extern int cap_netlink_send(struct sock *sk, struct sk_buff *skb); |
84 | extern int cap_netlink_recv(struct sk_buff *skb, int cap); | 86 | extern int cap_netlink_recv(struct sk_buff *skb, int cap); |
@@ -100,9 +102,7 @@ extern unsigned long mmap_min_addr; | |||
100 | #define LSM_SETID_FS 8 | 102 | #define LSM_SETID_FS 8 |
101 | 103 | ||
102 | /* forward declares to avoid warnings */ | 104 | /* forward declares to avoid warnings */ |
103 | struct nfsctl_arg; | ||
104 | struct sched_param; | 105 | struct sched_param; |
105 | struct swap_info_struct; | ||
106 | struct request_sock; | 106 | struct request_sock; |
107 | 107 | ||
108 | /* bprm_apply_creds unsafe reasons */ | 108 | /* bprm_apply_creds unsafe reasons */ |
@@ -289,10 +289,6 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts) | |||
289 | * Update module state after a successful pivot. | 289 | * Update module state after a successful pivot. |
290 | * @old_path contains the path for the old root. | 290 | * @old_path contains the path for the old root. |
291 | * @new_path contains the path for the new root. | 291 | * @new_path contains the path for the new root. |
292 | * @sb_get_mnt_opts: | ||
293 | * Get the security relevant mount options used for a superblock | ||
294 | * @sb the superblock to get security mount options from | ||
295 | * @opts binary data structure containing all lsm mount data | ||
296 | * @sb_set_mnt_opts: | 292 | * @sb_set_mnt_opts: |
297 | * Set the security relevant mount options used for a superblock | 293 | * Set the security relevant mount options used for a superblock |
298 | * @sb the superblock to set security mount options for | 294 | * @sb the superblock to set security mount options for |
@@ -1161,15 +1157,23 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts) | |||
1161 | * @alter contains the flag indicating whether changes are to be made. | 1157 | * @alter contains the flag indicating whether changes are to be made. |
1162 | * Return 0 if permission is granted. | 1158 | * Return 0 if permission is granted. |
1163 | * | 1159 | * |
1164 | * @ptrace: | 1160 | * @ptrace_may_access: |
1165 | * Check permission before allowing the @parent process to trace the | 1161 | * Check permission before allowing the current process to trace the |
1166 | * @child process. | 1162 | * @child process. |
1167 | * Security modules may also want to perform a process tracing check | 1163 | * Security modules may also want to perform a process tracing check |
1168 | * during an execve in the set_security or apply_creds hooks of | 1164 | * during an execve in the set_security or apply_creds hooks of |
1169 | * binprm_security_ops if the process is being traced and its security | 1165 | * binprm_security_ops if the process is being traced and its security |
1170 | * attributes would be changed by the execve. | 1166 | * attributes would be changed by the execve. |
1171 | * @parent contains the task_struct structure for parent process. | 1167 | * @child contains the task_struct structure for the target process. |
1172 | * @child contains the task_struct structure for child process. | 1168 | * @mode contains the PTRACE_MODE flags indicating the form of access. |
1169 | * Return 0 if permission is granted. | ||
1170 | * @ptrace_traceme: | ||
1171 | * Check that the @parent process has sufficient permission to trace the | ||
1172 | * current process before allowing the current process to present itself | ||
1173 | * to the @parent process for tracing. | ||
1174 | * The parent process will still have to undergo the ptrace_may_access | ||
1175 | * checks before it is allowed to trace this one. | ||
1176 | * @parent contains the task_struct structure for debugger process. | ||
1173 | * Return 0 if permission is granted. | 1177 | * Return 0 if permission is granted. |
1174 | * @capget: | 1178 | * @capget: |
1175 | * Get the @effective, @inheritable, and @permitted capability sets for | 1179 | * Get the @effective, @inheritable, and @permitted capability sets for |
@@ -1240,11 +1244,6 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts) | |||
1240 | * @pages contains the number of pages. | 1244 | * @pages contains the number of pages. |
1241 | * Return 0 if permission is granted. | 1245 | * Return 0 if permission is granted. |
1242 | * | 1246 | * |
1243 | * @register_security: | ||
1244 | * allow module stacking. | ||
1245 | * @name contains the name of the security module being stacked. | ||
1246 | * @ops contains a pointer to the struct security_operations of the module to stack. | ||
1247 | * | ||
1248 | * @secid_to_secctx: | 1247 | * @secid_to_secctx: |
1249 | * Convert secid to security context. | 1248 | * Convert secid to security context. |
1250 | * @secid contains the security ID. | 1249 | * @secid contains the security ID. |
@@ -1295,7 +1294,8 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts) | |||
1295 | struct security_operations { | 1294 | struct security_operations { |
1296 | char name[SECURITY_NAME_MAX + 1]; | 1295 | char name[SECURITY_NAME_MAX + 1]; |
1297 | 1296 | ||
1298 | int (*ptrace) (struct task_struct *parent, struct task_struct *child); | 1297 | int (*ptrace_may_access) (struct task_struct *child, unsigned int mode); |
1298 | int (*ptrace_traceme) (struct task_struct *parent); | ||
1299 | int (*capget) (struct task_struct *target, | 1299 | int (*capget) (struct task_struct *target, |
1300 | kernel_cap_t *effective, | 1300 | kernel_cap_t *effective, |
1301 | kernel_cap_t *inheritable, kernel_cap_t *permitted); | 1301 | kernel_cap_t *inheritable, kernel_cap_t *permitted); |
@@ -1328,6 +1328,7 @@ struct security_operations { | |||
1328 | void (*sb_free_security) (struct super_block *sb); | 1328 | void (*sb_free_security) (struct super_block *sb); |
1329 | int (*sb_copy_data) (char *orig, char *copy); | 1329 | int (*sb_copy_data) (char *orig, char *copy); |
1330 | int (*sb_kern_mount) (struct super_block *sb, void *data); | 1330 | int (*sb_kern_mount) (struct super_block *sb, void *data); |
1331 | int (*sb_show_options) (struct seq_file *m, struct super_block *sb); | ||
1331 | int (*sb_statfs) (struct dentry *dentry); | 1332 | int (*sb_statfs) (struct dentry *dentry); |
1332 | int (*sb_mount) (char *dev_name, struct path *path, | 1333 | int (*sb_mount) (char *dev_name, struct path *path, |
1333 | char *type, unsigned long flags, void *data); | 1334 | char *type, unsigned long flags, void *data); |
@@ -1343,8 +1344,6 @@ struct security_operations { | |||
1343 | struct path *new_path); | 1344 | struct path *new_path); |
1344 | void (*sb_post_pivotroot) (struct path *old_path, | 1345 | void (*sb_post_pivotroot) (struct path *old_path, |
1345 | struct path *new_path); | 1346 | struct path *new_path); |
1346 | int (*sb_get_mnt_opts) (const struct super_block *sb, | ||
1347 | struct security_mnt_opts *opts); | ||
1348 | int (*sb_set_mnt_opts) (struct super_block *sb, | 1347 | int (*sb_set_mnt_opts) (struct super_block *sb, |
1349 | struct security_mnt_opts *opts); | 1348 | struct security_mnt_opts *opts); |
1350 | void (*sb_clone_mnt_opts) (const struct super_block *oldsb, | 1349 | void (*sb_clone_mnt_opts) (const struct super_block *oldsb, |
@@ -1370,7 +1369,7 @@ struct security_operations { | |||
1370 | struct inode *new_dir, struct dentry *new_dentry); | 1369 | struct inode *new_dir, struct dentry *new_dentry); |
1371 | int (*inode_readlink) (struct dentry *dentry); | 1370 | int (*inode_readlink) (struct dentry *dentry); |
1372 | int (*inode_follow_link) (struct dentry *dentry, struct nameidata *nd); | 1371 | int (*inode_follow_link) (struct dentry *dentry, struct nameidata *nd); |
1373 | int (*inode_permission) (struct inode *inode, int mask, struct nameidata *nd); | 1372 | int (*inode_permission) (struct inode *inode, int mask); |
1374 | int (*inode_setattr) (struct dentry *dentry, struct iattr *attr); | 1373 | int (*inode_setattr) (struct dentry *dentry, struct iattr *attr); |
1375 | int (*inode_getattr) (struct vfsmount *mnt, struct dentry *dentry); | 1374 | int (*inode_getattr) (struct vfsmount *mnt, struct dentry *dentry); |
1376 | void (*inode_delete) (struct inode *inode); | 1375 | void (*inode_delete) (struct inode *inode); |
@@ -1472,10 +1471,6 @@ struct security_operations { | |||
1472 | int (*netlink_send) (struct sock *sk, struct sk_buff *skb); | 1471 | int (*netlink_send) (struct sock *sk, struct sk_buff *skb); |
1473 | int (*netlink_recv) (struct sk_buff *skb, int cap); | 1472 | int (*netlink_recv) (struct sk_buff *skb, int cap); |
1474 | 1473 | ||
1475 | /* allow module stacking */ | ||
1476 | int (*register_security) (const char *name, | ||
1477 | struct security_operations *ops); | ||
1478 | |||
1479 | void (*d_instantiate) (struct dentry *dentry, struct inode *inode); | 1474 | void (*d_instantiate) (struct dentry *dentry, struct inode *inode); |
1480 | 1475 | ||
1481 | int (*getprocattr) (struct task_struct *p, char *name, char **value); | 1476 | int (*getprocattr) (struct task_struct *p, char *name, char **value); |
@@ -1565,15 +1560,10 @@ struct security_operations { | |||
1565 | extern int security_init(void); | 1560 | extern int security_init(void); |
1566 | extern int security_module_enable(struct security_operations *ops); | 1561 | extern int security_module_enable(struct security_operations *ops); |
1567 | extern int register_security(struct security_operations *ops); | 1562 | extern int register_security(struct security_operations *ops); |
1568 | extern int mod_reg_security(const char *name, struct security_operations *ops); | ||
1569 | extern struct dentry *securityfs_create_file(const char *name, mode_t mode, | ||
1570 | struct dentry *parent, void *data, | ||
1571 | const struct file_operations *fops); | ||
1572 | extern struct dentry *securityfs_create_dir(const char *name, struct dentry *parent); | ||
1573 | extern void securityfs_remove(struct dentry *dentry); | ||
1574 | 1563 | ||
1575 | /* Security operations */ | 1564 | /* Security operations */ |
1576 | int security_ptrace(struct task_struct *parent, struct task_struct *child); | 1565 | int security_ptrace_may_access(struct task_struct *child, unsigned int mode); |
1566 | int security_ptrace_traceme(struct task_struct *parent); | ||
1577 | int security_capget(struct task_struct *target, | 1567 | int security_capget(struct task_struct *target, |
1578 | kernel_cap_t *effective, | 1568 | kernel_cap_t *effective, |
1579 | kernel_cap_t *inheritable, | 1569 | kernel_cap_t *inheritable, |
@@ -1606,6 +1596,7 @@ int security_sb_alloc(struct super_block *sb); | |||
1606 | void security_sb_free(struct super_block *sb); | 1596 | void security_sb_free(struct super_block *sb); |
1607 | int security_sb_copy_data(char *orig, char *copy); | 1597 | int security_sb_copy_data(char *orig, char *copy); |
1608 | int security_sb_kern_mount(struct super_block *sb, void *data); | 1598 | int security_sb_kern_mount(struct super_block *sb, void *data); |
1599 | int security_sb_show_options(struct seq_file *m, struct super_block *sb); | ||
1609 | int security_sb_statfs(struct dentry *dentry); | 1600 | int security_sb_statfs(struct dentry *dentry); |
1610 | int security_sb_mount(char *dev_name, struct path *path, | 1601 | int security_sb_mount(char *dev_name, struct path *path, |
1611 | char *type, unsigned long flags, void *data); | 1602 | char *type, unsigned long flags, void *data); |
@@ -1617,8 +1608,6 @@ void security_sb_post_remount(struct vfsmount *mnt, unsigned long flags, void *d | |||
1617 | void security_sb_post_addmount(struct vfsmount *mnt, struct path *mountpoint); | 1608 | void security_sb_post_addmount(struct vfsmount *mnt, struct path *mountpoint); |
1618 | int security_sb_pivotroot(struct path *old_path, struct path *new_path); | 1609 | int security_sb_pivotroot(struct path *old_path, struct path *new_path); |
1619 | void security_sb_post_pivotroot(struct path *old_path, struct path *new_path); | 1610 | void security_sb_post_pivotroot(struct path *old_path, struct path *new_path); |
1620 | int security_sb_get_mnt_opts(const struct super_block *sb, | ||
1621 | struct security_mnt_opts *opts); | ||
1622 | int security_sb_set_mnt_opts(struct super_block *sb, struct security_mnt_opts *opts); | 1611 | int security_sb_set_mnt_opts(struct super_block *sb, struct security_mnt_opts *opts); |
1623 | void security_sb_clone_mnt_opts(const struct super_block *oldsb, | 1612 | void security_sb_clone_mnt_opts(const struct super_block *oldsb, |
1624 | struct super_block *newsb); | 1613 | struct super_block *newsb); |
@@ -1641,7 +1630,7 @@ int security_inode_rename(struct inode *old_dir, struct dentry *old_dentry, | |||
1641 | struct inode *new_dir, struct dentry *new_dentry); | 1630 | struct inode *new_dir, struct dentry *new_dentry); |
1642 | int security_inode_readlink(struct dentry *dentry); | 1631 | int security_inode_readlink(struct dentry *dentry); |
1643 | int security_inode_follow_link(struct dentry *dentry, struct nameidata *nd); | 1632 | int security_inode_follow_link(struct dentry *dentry, struct nameidata *nd); |
1644 | int security_inode_permission(struct inode *inode, int mask, struct nameidata *nd); | 1633 | int security_inode_permission(struct inode *inode, int mask); |
1645 | int security_inode_setattr(struct dentry *dentry, struct iattr *attr); | 1634 | int security_inode_setattr(struct dentry *dentry, struct iattr *attr); |
1646 | int security_inode_getattr(struct vfsmount *mnt, struct dentry *dentry); | 1635 | int security_inode_getattr(struct vfsmount *mnt, struct dentry *dentry); |
1647 | void security_inode_delete(struct inode *inode); | 1636 | void security_inode_delete(struct inode *inode); |
@@ -1755,9 +1744,15 @@ static inline int security_init(void) | |||
1755 | return 0; | 1744 | return 0; |
1756 | } | 1745 | } |
1757 | 1746 | ||
1758 | static inline int security_ptrace(struct task_struct *parent, struct task_struct *child) | 1747 | static inline int security_ptrace_may_access(struct task_struct *child, |
1748 | unsigned int mode) | ||
1759 | { | 1749 | { |
1760 | return cap_ptrace(parent, child); | 1750 | return cap_ptrace_may_access(child, mode); |
1751 | } | ||
1752 | |||
1753 | static inline int security_ptrace_traceme(struct task_struct *parent) | ||
1754 | { | ||
1755 | return cap_ptrace_traceme(parent); | ||
1761 | } | 1756 | } |
1762 | 1757 | ||
1763 | static inline int security_capget(struct task_struct *target, | 1758 | static inline int security_capget(struct task_struct *target, |
@@ -1881,6 +1876,12 @@ static inline int security_sb_kern_mount(struct super_block *sb, void *data) | |||
1881 | return 0; | 1876 | return 0; |
1882 | } | 1877 | } |
1883 | 1878 | ||
1879 | static inline int security_sb_show_options(struct seq_file *m, | ||
1880 | struct super_block *sb) | ||
1881 | { | ||
1882 | return 0; | ||
1883 | } | ||
1884 | |||
1884 | static inline int security_sb_statfs(struct dentry *dentry) | 1885 | static inline int security_sb_statfs(struct dentry *dentry) |
1885 | { | 1886 | { |
1886 | return 0; | 1887 | return 0; |
@@ -1927,12 +1928,6 @@ static inline int security_sb_pivotroot(struct path *old_path, | |||
1927 | static inline void security_sb_post_pivotroot(struct path *old_path, | 1928 | static inline void security_sb_post_pivotroot(struct path *old_path, |
1928 | struct path *new_path) | 1929 | struct path *new_path) |
1929 | { } | 1930 | { } |
1930 | static inline int security_sb_get_mnt_opts(const struct super_block *sb, | ||
1931 | struct security_mnt_opts *opts) | ||
1932 | { | ||
1933 | security_init_mnt_opts(opts); | ||
1934 | return 0; | ||
1935 | } | ||
1936 | 1931 | ||
1937 | static inline int security_sb_set_mnt_opts(struct super_block *sb, | 1932 | static inline int security_sb_set_mnt_opts(struct super_block *sb, |
1938 | struct security_mnt_opts *opts) | 1933 | struct security_mnt_opts *opts) |
@@ -2032,8 +2027,7 @@ static inline int security_inode_follow_link(struct dentry *dentry, | |||
2032 | return 0; | 2027 | return 0; |
2033 | } | 2028 | } |
2034 | 2029 | ||
2035 | static inline int security_inode_permission(struct inode *inode, int mask, | 2030 | static inline int security_inode_permission(struct inode *inode, int mask) |
2036 | struct nameidata *nd) | ||
2037 | { | 2031 | { |
2038 | return 0; | 2032 | return 0; |
2039 | } | 2033 | } |
@@ -2425,25 +2419,6 @@ static inline int security_netlink_recv(struct sk_buff *skb, int cap) | |||
2425 | return cap_netlink_recv(skb, cap); | 2419 | return cap_netlink_recv(skb, cap); |
2426 | } | 2420 | } |
2427 | 2421 | ||
2428 | static inline struct dentry *securityfs_create_dir(const char *name, | ||
2429 | struct dentry *parent) | ||
2430 | { | ||
2431 | return ERR_PTR(-ENODEV); | ||
2432 | } | ||
2433 | |||
2434 | static inline struct dentry *securityfs_create_file(const char *name, | ||
2435 | mode_t mode, | ||
2436 | struct dentry *parent, | ||
2437 | void *data, | ||
2438 | const struct file_operations *fops) | ||
2439 | { | ||
2440 | return ERR_PTR(-ENODEV); | ||
2441 | } | ||
2442 | |||
2443 | static inline void securityfs_remove(struct dentry *dentry) | ||
2444 | { | ||
2445 | } | ||
2446 | |||
2447 | static inline int security_secid_to_secctx(u32 secid, char **secdata, u32 *seclen) | 2422 | static inline int security_secid_to_secctx(u32 secid, char **secdata, u32 *seclen) |
2448 | { | 2423 | { |
2449 | return -EOPNOTSUPP; | 2424 | return -EOPNOTSUPP; |
@@ -2807,5 +2782,35 @@ static inline void security_audit_rule_free(void *lsmrule) | |||
2807 | #endif /* CONFIG_SECURITY */ | 2782 | #endif /* CONFIG_SECURITY */ |
2808 | #endif /* CONFIG_AUDIT */ | 2783 | #endif /* CONFIG_AUDIT */ |
2809 | 2784 | ||
2785 | #ifdef CONFIG_SECURITYFS | ||
2786 | |||
2787 | extern struct dentry *securityfs_create_file(const char *name, mode_t mode, | ||
2788 | struct dentry *parent, void *data, | ||
2789 | const struct file_operations *fops); | ||
2790 | extern struct dentry *securityfs_create_dir(const char *name, struct dentry *parent); | ||
2791 | extern void securityfs_remove(struct dentry *dentry); | ||
2792 | |||
2793 | #else /* CONFIG_SECURITYFS */ | ||
2794 | |||
2795 | static inline struct dentry *securityfs_create_dir(const char *name, | ||
2796 | struct dentry *parent) | ||
2797 | { | ||
2798 | return ERR_PTR(-ENODEV); | ||
2799 | } | ||
2800 | |||
2801 | static inline struct dentry *securityfs_create_file(const char *name, | ||
2802 | mode_t mode, | ||
2803 | struct dentry *parent, | ||
2804 | void *data, | ||
2805 | const struct file_operations *fops) | ||
2806 | { | ||
2807 | return ERR_PTR(-ENODEV); | ||
2808 | } | ||
2809 | |||
2810 | static inline void securityfs_remove(struct dentry *dentry) | ||
2811 | {} | ||
2812 | |||
2813 | #endif | ||
2814 | |||
2810 | #endif /* ! __LINUX_SECURITY_H */ | 2815 | #endif /* ! __LINUX_SECURITY_H */ |
2811 | 2816 | ||
diff --git a/include/linux/sem.h b/include/linux/sem.h index c8eaad9e4b72..1b191c176bcd 100644 --- a/include/linux/sem.h +++ b/include/linux/sem.h | |||
@@ -78,6 +78,7 @@ struct seminfo { | |||
78 | 78 | ||
79 | #ifdef __KERNEL__ | 79 | #ifdef __KERNEL__ |
80 | #include <asm/atomic.h> | 80 | #include <asm/atomic.h> |
81 | #include <linux/rcupdate.h> | ||
81 | 82 | ||
82 | struct task_struct; | 83 | struct task_struct; |
83 | 84 | ||
@@ -93,23 +94,19 @@ struct sem_array { | |||
93 | time_t sem_otime; /* last semop time */ | 94 | time_t sem_otime; /* last semop time */ |
94 | time_t sem_ctime; /* last change time */ | 95 | time_t sem_ctime; /* last change time */ |
95 | struct sem *sem_base; /* ptr to first semaphore in array */ | 96 | struct sem *sem_base; /* ptr to first semaphore in array */ |
96 | struct sem_queue *sem_pending; /* pending operations to be processed */ | 97 | struct list_head sem_pending; /* pending operations to be processed */ |
97 | struct sem_queue **sem_pending_last; /* last pending operation */ | 98 | struct list_head list_id; /* undo requests on this array */ |
98 | struct sem_undo *undo; /* undo requests on this array */ | ||
99 | unsigned long sem_nsems; /* no. of semaphores in array */ | 99 | unsigned long sem_nsems; /* no. of semaphores in array */ |
100 | }; | 100 | }; |
101 | 101 | ||
102 | /* One queue for each sleeping process in the system. */ | 102 | /* One queue for each sleeping process in the system. */ |
103 | struct sem_queue { | 103 | struct sem_queue { |
104 | struct sem_queue * next; /* next entry in the queue */ | 104 | struct list_head list; /* queue of pending operations */ |
105 | struct sem_queue ** prev; /* previous entry in the queue, *(q->prev) == q */ | 105 | struct task_struct *sleeper; /* this process */ |
106 | struct task_struct* sleeper; /* this process */ | 106 | struct sem_undo *undo; /* undo structure */ |
107 | struct sem_undo * undo; /* undo structure */ | ||
108 | int pid; /* process id of requesting process */ | 107 | int pid; /* process id of requesting process */ |
109 | int status; /* completion status of operation */ | 108 | int status; /* completion status of operation */ |
110 | struct sem_array * sma; /* semaphore array for operations */ | 109 | struct sembuf *sops; /* array of pending operations */ |
111 | int id; /* internal sem id */ | ||
112 | struct sembuf * sops; /* array of pending operations */ | ||
113 | int nsops; /* number of operations */ | 110 | int nsops; /* number of operations */ |
114 | int alter; /* does the operation alter the array? */ | 111 | int alter; /* does the operation alter the array? */ |
115 | }; | 112 | }; |
@@ -118,8 +115,11 @@ struct sem_queue { | |||
118 | * when the process exits. | 115 | * when the process exits. |
119 | */ | 116 | */ |
120 | struct sem_undo { | 117 | struct sem_undo { |
121 | struct sem_undo * proc_next; /* next entry on this process */ | 118 | struct list_head list_proc; /* per-process list: all undos from one process. */ |
122 | struct sem_undo * id_next; /* next entry on this semaphore set */ | 119 | /* rcu protected */ |
120 | struct rcu_head rcu; /* rcu struct for sem_undo() */ | ||
121 | struct sem_undo_list *ulp; /* sem_undo_list for the process */ | ||
122 | struct list_head list_id; /* per semaphore array list: all undos for one array */ | ||
123 | int semid; /* semaphore set identifier */ | 123 | int semid; /* semaphore set identifier */ |
124 | short * semadj; /* array of adjustments, one per semaphore */ | 124 | short * semadj; /* array of adjustments, one per semaphore */ |
125 | }; | 125 | }; |
@@ -128,9 +128,9 @@ struct sem_undo { | |||
128 | * that may be shared among all a CLONE_SYSVSEM task group. | 128 | * that may be shared among all a CLONE_SYSVSEM task group. |
129 | */ | 129 | */ |
130 | struct sem_undo_list { | 130 | struct sem_undo_list { |
131 | atomic_t refcnt; | 131 | atomic_t refcnt; |
132 | spinlock_t lock; | 132 | spinlock_t lock; |
133 | struct sem_undo *proc_list; | 133 | struct list_head list_proc; |
134 | }; | 134 | }; |
135 | 135 | ||
136 | struct sysv_sem { | 136 | struct sysv_sem { |
diff --git a/include/linux/semaphore.h b/include/linux/semaphore.h index 9cae64b00d6b..7415839ac890 100644 --- a/include/linux/semaphore.h +++ b/include/linux/semaphore.h | |||
@@ -26,10 +26,8 @@ struct semaphore { | |||
26 | .wait_list = LIST_HEAD_INIT((name).wait_list), \ | 26 | .wait_list = LIST_HEAD_INIT((name).wait_list), \ |
27 | } | 27 | } |
28 | 28 | ||
29 | #define __DECLARE_SEMAPHORE_GENERIC(name, count) \ | 29 | #define DECLARE_MUTEX(name) \ |
30 | struct semaphore name = __SEMAPHORE_INITIALIZER(name, count) | 30 | struct semaphore name = __SEMAPHORE_INITIALIZER(name, 1) |
31 | |||
32 | #define DECLARE_MUTEX(name) __DECLARE_SEMAPHORE_GENERIC(name, 1) | ||
33 | 31 | ||
34 | static inline void sema_init(struct semaphore *sem, int val) | 32 | static inline void sema_init(struct semaphore *sem, int val) |
35 | { | 33 | { |
diff --git a/include/linux/seq_file.h b/include/linux/seq_file.h index a66304a09955..a1783b229ef4 100644 --- a/include/linux/seq_file.h +++ b/include/linux/seq_file.h | |||
@@ -4,6 +4,8 @@ | |||
4 | #include <linux/types.h> | 4 | #include <linux/types.h> |
5 | #include <linux/string.h> | 5 | #include <linux/string.h> |
6 | #include <linux/mutex.h> | 6 | #include <linux/mutex.h> |
7 | #include <linux/cpumask.h> | ||
8 | #include <linux/nodemask.h> | ||
7 | 9 | ||
8 | struct seq_operations; | 10 | struct seq_operations; |
9 | struct file; | 11 | struct file; |
@@ -47,6 +49,16 @@ int seq_path(struct seq_file *, struct path *, char *); | |||
47 | int seq_dentry(struct seq_file *, struct dentry *, char *); | 49 | int seq_dentry(struct seq_file *, struct dentry *, char *); |
48 | int seq_path_root(struct seq_file *m, struct path *path, struct path *root, | 50 | int seq_path_root(struct seq_file *m, struct path *path, struct path *root, |
49 | char *esc); | 51 | char *esc); |
52 | int seq_bitmap(struct seq_file *m, unsigned long *bits, unsigned int nr_bits); | ||
53 | static inline int seq_cpumask(struct seq_file *m, cpumask_t *mask) | ||
54 | { | ||
55 | return seq_bitmap(m, mask->bits, NR_CPUS); | ||
56 | } | ||
57 | |||
58 | static inline int seq_nodemask(struct seq_file *m, nodemask_t *mask) | ||
59 | { | ||
60 | return seq_bitmap(m, mask->bits, MAX_NUMNODES); | ||
61 | } | ||
50 | 62 | ||
51 | int single_open(struct file *, int (*)(struct seq_file *, void *), void *); | 63 | int single_open(struct file *, int (*)(struct seq_file *, void *), void *); |
52 | int single_release(struct inode *, struct file *); | 64 | int single_release(struct inode *, struct file *); |
diff --git a/include/linux/seq_file_net.h b/include/linux/seq_file_net.h index 4ac52542a563..32c89bbe24a2 100644 --- a/include/linux/seq_file_net.h +++ b/include/linux/seq_file_net.h | |||
@@ -14,7 +14,10 @@ struct seq_net_private { | |||
14 | 14 | ||
15 | int seq_open_net(struct inode *, struct file *, | 15 | int seq_open_net(struct inode *, struct file *, |
16 | const struct seq_operations *, int); | 16 | const struct seq_operations *, int); |
17 | int single_open_net(struct inode *, struct file *file, | ||
18 | int (*show)(struct seq_file *, void *)); | ||
17 | int seq_release_net(struct inode *, struct file *); | 19 | int seq_release_net(struct inode *, struct file *); |
20 | int single_release_net(struct inode *, struct file *); | ||
18 | static inline struct net *seq_file_net(struct seq_file *seq) | 21 | static inline struct net *seq_file_net(struct seq_file *seq) |
19 | { | 22 | { |
20 | #ifdef CONFIG_NET_NS | 23 | #ifdef CONFIG_NET_NS |
diff --git a/include/linux/serial.h b/include/linux/serial.h index deb714314fb1..1ea8d9265bf6 100644 --- a/include/linux/serial.h +++ b/include/linux/serial.h | |||
@@ -173,6 +173,22 @@ struct serial_icounter_struct { | |||
173 | int reserved[9]; | 173 | int reserved[9]; |
174 | }; | 174 | }; |
175 | 175 | ||
176 | /* | ||
177 | * Serial interface for controlling RS485 settings on chips with suitable | ||
178 | * support. Set with TIOCSRS485 and get with TIOCGRS485 if supported by your | ||
179 | * platform. The set function returns the new state, with any unsupported bits | ||
180 | * reverted appropriately. | ||
181 | */ | ||
182 | |||
183 | struct serial_rs485 { | ||
184 | __u32 flags; /* RS485 feature flags */ | ||
185 | #define SER_RS485_ENABLED (1 << 0) | ||
186 | #define SER_RS485_RTS_ON_SEND (1 << 1) | ||
187 | #define SER_RS485_RTS_AFTER_SEND (1 << 2) | ||
188 | __u32 delay_rts_before_send; /* Milliseconds */ | ||
189 | __u32 padding[6]; /* Memory is cheap, new structs | ||
190 | are a royal PITA .. */ | ||
191 | }; | ||
176 | 192 | ||
177 | #ifdef __KERNEL__ | 193 | #ifdef __KERNEL__ |
178 | #include <linux/compiler.h> | 194 | #include <linux/compiler.h> |
diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h index d8f31de632c5..e27f216361fc 100644 --- a/include/linux/serial_core.h +++ b/include/linux/serial_core.h | |||
@@ -59,9 +59,6 @@ | |||
59 | #define PORT_SUNZILOG 38 | 59 | #define PORT_SUNZILOG 38 |
60 | #define PORT_SUNSAB 39 | 60 | #define PORT_SUNSAB 39 |
61 | 61 | ||
62 | /* NEC v850. */ | ||
63 | #define PORT_V850E_UART 40 | ||
64 | |||
65 | /* DEC */ | 62 | /* DEC */ |
66 | #define PORT_DZ 46 | 63 | #define PORT_DZ 46 |
67 | #define PORT_ZS 47 | 64 | #define PORT_ZS 47 |
@@ -190,6 +187,7 @@ struct uart_ops { | |||
190 | void (*break_ctl)(struct uart_port *, int ctl); | 187 | void (*break_ctl)(struct uart_port *, int ctl); |
191 | int (*startup)(struct uart_port *); | 188 | int (*startup)(struct uart_port *); |
192 | void (*shutdown)(struct uart_port *); | 189 | void (*shutdown)(struct uart_port *); |
190 | void (*flush_buffer)(struct uart_port *); | ||
193 | void (*set_termios)(struct uart_port *, struct ktermios *new, | 191 | void (*set_termios)(struct uart_port *, struct ktermios *new, |
194 | struct ktermios *old); | 192 | struct ktermios *old); |
195 | void (*set_ldisc)(struct uart_port *); | 193 | void (*set_ldisc)(struct uart_port *); |
@@ -243,7 +241,7 @@ typedef unsigned int __bitwise__ upf_t; | |||
243 | 241 | ||
244 | struct uart_port { | 242 | struct uart_port { |
245 | spinlock_t lock; /* port lock */ | 243 | spinlock_t lock; /* port lock */ |
246 | unsigned int iobase; /* in/out[bwl] */ | 244 | unsigned long iobase; /* in/out[bwl] */ |
247 | unsigned char __iomem *membase; /* read/write[bwl] */ | 245 | unsigned char __iomem *membase; /* read/write[bwl] */ |
248 | unsigned int irq; /* irq number */ | 246 | unsigned int irq; /* irq number */ |
249 | unsigned int uartclk; /* base uart clock */ | 247 | unsigned int uartclk; /* base uart clock */ |
@@ -343,13 +341,15 @@ typedef unsigned int __bitwise__ uif_t; | |||
343 | * stuff here. | 341 | * stuff here. |
344 | */ | 342 | */ |
345 | struct uart_info { | 343 | struct uart_info { |
346 | struct tty_struct *tty; | 344 | struct tty_port port; |
347 | struct circ_buf xmit; | 345 | struct circ_buf xmit; |
348 | uif_t flags; | 346 | uif_t flags; |
349 | 347 | ||
350 | /* | 348 | /* |
351 | * Definitions for info->flags. These are _private_ to serial_core, and | 349 | * Definitions for info->flags. These are _private_ to serial_core, and |
352 | * are specific to this structure. They may be queried by low level drivers. | 350 | * are specific to this structure. They may be queried by low level drivers. |
351 | * | ||
352 | * FIXME: use the ASY_ definitions | ||
353 | */ | 353 | */ |
354 | #define UIF_CHECK_CD ((__force uif_t) (1 << 25)) | 354 | #define UIF_CHECK_CD ((__force uif_t) (1 << 25)) |
355 | #define UIF_CTS_FLOW ((__force uif_t) (1 << 26)) | 355 | #define UIF_CTS_FLOW ((__force uif_t) (1 << 26)) |
@@ -357,11 +357,7 @@ struct uart_info { | |||
357 | #define UIF_INITIALIZED ((__force uif_t) (1 << 31)) | 357 | #define UIF_INITIALIZED ((__force uif_t) (1 << 31)) |
358 | #define UIF_SUSPENDED ((__force uif_t) (1 << 30)) | 358 | #define UIF_SUSPENDED ((__force uif_t) (1 << 30)) |
359 | 359 | ||
360 | int blocked_open; | ||
361 | |||
362 | struct tasklet_struct tlet; | 360 | struct tasklet_struct tlet; |
363 | |||
364 | wait_queue_head_t open_wait; | ||
365 | wait_queue_head_t delta_msr_wait; | 361 | wait_queue_head_t delta_msr_wait; |
366 | }; | 362 | }; |
367 | 363 | ||
@@ -438,8 +434,8 @@ int uart_resume_port(struct uart_driver *reg, struct uart_port *port); | |||
438 | #define uart_circ_chars_free(circ) \ | 434 | #define uart_circ_chars_free(circ) \ |
439 | (CIRC_SPACE((circ)->head, (circ)->tail, UART_XMIT_SIZE)) | 435 | (CIRC_SPACE((circ)->head, (circ)->tail, UART_XMIT_SIZE)) |
440 | 436 | ||
441 | #define uart_tx_stopped(port) \ | 437 | #define uart_tx_stopped(portp) \ |
442 | ((port)->info->tty->stopped || (port)->info->tty->hw_stopped) | 438 | ((portp)->info->port.tty->stopped || (portp)->info->port.tty->hw_stopped) |
443 | 439 | ||
444 | /* | 440 | /* |
445 | * The following are helper functions for the low level drivers. | 441 | * The following are helper functions for the low level drivers. |
@@ -450,7 +446,7 @@ uart_handle_sysrq_char(struct uart_port *port, unsigned int ch) | |||
450 | #ifdef SUPPORT_SYSRQ | 446 | #ifdef SUPPORT_SYSRQ |
451 | if (port->sysrq) { | 447 | if (port->sysrq) { |
452 | if (ch && time_before(jiffies, port->sysrq)) { | 448 | if (ch && time_before(jiffies, port->sysrq)) { |
453 | handle_sysrq(ch, port->info ? port->info->tty : NULL); | 449 | handle_sysrq(ch, port->info ? port->info->port.tty : NULL); |
454 | port->sysrq = 0; | 450 | port->sysrq = 0; |
455 | return 1; | 451 | return 1; |
456 | } | 452 | } |
@@ -479,7 +475,7 @@ static inline int uart_handle_break(struct uart_port *port) | |||
479 | } | 475 | } |
480 | #endif | 476 | #endif |
481 | if (port->flags & UPF_SAK) | 477 | if (port->flags & UPF_SAK) |
482 | do_SAK(info->tty); | 478 | do_SAK(info->port.tty); |
483 | return 0; | 479 | return 0; |
484 | } | 480 | } |
485 | 481 | ||
@@ -502,9 +498,9 @@ uart_handle_dcd_change(struct uart_port *port, unsigned int status) | |||
502 | 498 | ||
503 | if (info->flags & UIF_CHECK_CD) { | 499 | if (info->flags & UIF_CHECK_CD) { |
504 | if (status) | 500 | if (status) |
505 | wake_up_interruptible(&info->open_wait); | 501 | wake_up_interruptible(&info->port.open_wait); |
506 | else if (info->tty) | 502 | else if (info->port.tty) |
507 | tty_hangup(info->tty); | 503 | tty_hangup(info->port.tty); |
508 | } | 504 | } |
509 | } | 505 | } |
510 | 506 | ||
@@ -517,7 +513,7 @@ static inline void | |||
517 | uart_handle_cts_change(struct uart_port *port, unsigned int status) | 513 | uart_handle_cts_change(struct uart_port *port, unsigned int status) |
518 | { | 514 | { |
519 | struct uart_info *info = port->info; | 515 | struct uart_info *info = port->info; |
520 | struct tty_struct *tty = info->tty; | 516 | struct tty_struct *tty = info->port.tty; |
521 | 517 | ||
522 | port->icount.cts++; | 518 | port->icount.cts++; |
523 | 519 | ||
@@ -543,7 +539,7 @@ static inline void | |||
543 | uart_insert_char(struct uart_port *port, unsigned int status, | 539 | uart_insert_char(struct uart_port *port, unsigned int status, |
544 | unsigned int overrun, unsigned int ch, unsigned int flag) | 540 | unsigned int overrun, unsigned int ch, unsigned int flag) |
545 | { | 541 | { |
546 | struct tty_struct *tty = port->info->tty; | 542 | struct tty_struct *tty = port->info->port.tty; |
547 | 543 | ||
548 | if ((status & port->ignore_status_mask & ~overrun) == 0) | 544 | if ((status & port->ignore_status_mask & ~overrun) == 0) |
549 | tty_insert_flip_char(tty, ch, flag); | 545 | tty_insert_flip_char(tty, ch, flag); |
diff --git a/include/linux/serio.h b/include/linux/serio.h index 95674d97dabd..25641d9e0ea8 100644 --- a/include/linux/serio.h +++ b/include/linux/serio.h | |||
@@ -87,11 +87,10 @@ void serio_unregister_port(struct serio *serio); | |||
87 | void serio_unregister_child_port(struct serio *serio); | 87 | void serio_unregister_child_port(struct serio *serio); |
88 | 88 | ||
89 | int __serio_register_driver(struct serio_driver *drv, struct module *owner, const char *mod_name); | 89 | int __serio_register_driver(struct serio_driver *drv, struct module *owner, const char *mod_name); |
90 | static inline int serio_register_driver(struct serio_driver *drv) | 90 | static inline int __must_check serio_register_driver(struct serio_driver *drv) |
91 | { | 91 | { |
92 | return __serio_register_driver(drv, THIS_MODULE, KBUILD_MODNAME); | 92 | return __serio_register_driver(drv, THIS_MODULE, KBUILD_MODNAME); |
93 | } | 93 | } |
94 | int serio_register_driver(struct serio_driver *drv); | ||
95 | void serio_unregister_driver(struct serio_driver *drv); | 94 | void serio_unregister_driver(struct serio_driver *drv); |
96 | 95 | ||
97 | static inline int serio_write(struct serio *serio, unsigned char data) | 96 | static inline int serio_write(struct serio *serio, unsigned char data) |
@@ -175,7 +174,7 @@ static inline void serio_unpin_driver(struct serio *serio) | |||
175 | #define SERIO_8042_XL 0x06 | 174 | #define SERIO_8042_XL 0x06 |
176 | 175 | ||
177 | /* | 176 | /* |
178 | * Serio types | 177 | * Serio protocols |
179 | */ | 178 | */ |
180 | #define SERIO_UNKNOWN 0x00 | 179 | #define SERIO_UNKNOWN 0x00 |
181 | #define SERIO_MSC 0x01 | 180 | #define SERIO_MSC 0x01 |
@@ -212,5 +211,7 @@ static inline void serio_unpin_driver(struct serio *serio) | |||
212 | #define SERIO_TAOSEVM 0x34 | 211 | #define SERIO_TAOSEVM 0x34 |
213 | #define SERIO_FUJITSU 0x35 | 212 | #define SERIO_FUJITSU 0x35 |
214 | #define SERIO_ZHENHUA 0x36 | 213 | #define SERIO_ZHENHUA 0x36 |
214 | #define SERIO_INEXIO 0x37 | ||
215 | #define SERIO_TOUCHIT213 0x37 | ||
215 | 216 | ||
216 | #endif | 217 | #endif |
diff --git a/include/linux/shmem_fs.h b/include/linux/shmem_fs.h index f2d12d5a21b8..fd83f2584b15 100644 --- a/include/linux/shmem_fs.h +++ b/include/linux/shmem_fs.h | |||
@@ -43,7 +43,7 @@ static inline struct shmem_inode_info *SHMEM_I(struct inode *inode) | |||
43 | } | 43 | } |
44 | 44 | ||
45 | #ifdef CONFIG_TMPFS_POSIX_ACL | 45 | #ifdef CONFIG_TMPFS_POSIX_ACL |
46 | int shmem_permission(struct inode *, int, struct nameidata *); | 46 | int shmem_permission(struct inode *, int); |
47 | int shmem_acl_init(struct inode *, struct inode *); | 47 | int shmem_acl_init(struct inode *, struct inode *); |
48 | void shmem_acl_destroy_inode(struct inode *); | 48 | void shmem_acl_destroy_inode(struct inode *); |
49 | 49 | ||
diff --git a/include/linux/signalfd.h b/include/linux/signalfd.h index ea037f28df91..bef0c46d4713 100644 --- a/include/linux/signalfd.h +++ b/include/linux/signalfd.h | |||
@@ -8,6 +8,12 @@ | |||
8 | #ifndef _LINUX_SIGNALFD_H | 8 | #ifndef _LINUX_SIGNALFD_H |
9 | #define _LINUX_SIGNALFD_H | 9 | #define _LINUX_SIGNALFD_H |
10 | 10 | ||
11 | /* For O_CLOEXEC and O_NONBLOCK */ | ||
12 | #include <linux/fcntl.h> | ||
13 | |||
14 | /* Flags for signalfd4. */ | ||
15 | #define SFD_CLOEXEC O_CLOEXEC | ||
16 | #define SFD_NONBLOCK O_NONBLOCK | ||
11 | 17 | ||
12 | struct signalfd_siginfo { | 18 | struct signalfd_siginfo { |
13 | __u32 ssi_signo; | 19 | __u32 ssi_signo; |
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index 299ec4b31412..2725f4e5a9bf 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h | |||
@@ -146,8 +146,14 @@ struct skb_shared_info { | |||
146 | unsigned short gso_segs; | 146 | unsigned short gso_segs; |
147 | unsigned short gso_type; | 147 | unsigned short gso_type; |
148 | __be32 ip6_frag_id; | 148 | __be32 ip6_frag_id; |
149 | #ifdef CONFIG_HAS_DMA | ||
150 | unsigned int num_dma_maps; | ||
151 | #endif | ||
149 | struct sk_buff *frag_list; | 152 | struct sk_buff *frag_list; |
150 | skb_frag_t frags[MAX_SKB_FRAGS]; | 153 | skb_frag_t frags[MAX_SKB_FRAGS]; |
154 | #ifdef CONFIG_HAS_DMA | ||
155 | dma_addr_t dma_maps[MAX_SKB_FRAGS + 1]; | ||
156 | #endif | ||
151 | }; | 157 | }; |
152 | 158 | ||
153 | /* We divide dataref into two halves. The higher 16 bits hold references | 159 | /* We divide dataref into two halves. The higher 16 bits hold references |
@@ -243,9 +249,11 @@ typedef unsigned char *sk_buff_data_t; | |||
243 | * @tc_index: Traffic control index | 249 | * @tc_index: Traffic control index |
244 | * @tc_verd: traffic control verdict | 250 | * @tc_verd: traffic control verdict |
245 | * @ndisc_nodetype: router type (from link layer) | 251 | * @ndisc_nodetype: router type (from link layer) |
252 | * @do_not_encrypt: set to prevent encryption of this frame | ||
246 | * @dma_cookie: a cookie to one of several possible DMA operations | 253 | * @dma_cookie: a cookie to one of several possible DMA operations |
247 | * done by skb DMA functions | 254 | * done by skb DMA functions |
248 | * @secmark: security marking | 255 | * @secmark: security marking |
256 | * @vlan_tci: vlan tag control information | ||
249 | */ | 257 | */ |
250 | 258 | ||
251 | struct sk_buff { | 259 | struct sk_buff { |
@@ -305,9 +313,7 @@ struct sk_buff { | |||
305 | #endif | 313 | #endif |
306 | 314 | ||
307 | int iif; | 315 | int iif; |
308 | #ifdef CONFIG_NETDEVICES_MULTIQUEUE | ||
309 | __u16 queue_mapping; | 316 | __u16 queue_mapping; |
310 | #endif | ||
311 | #ifdef CONFIG_NET_SCHED | 317 | #ifdef CONFIG_NET_SCHED |
312 | __u16 tc_index; /* traffic control index */ | 318 | __u16 tc_index; /* traffic control index */ |
313 | #ifdef CONFIG_NET_CLS_ACT | 319 | #ifdef CONFIG_NET_CLS_ACT |
@@ -317,7 +323,10 @@ struct sk_buff { | |||
317 | #ifdef CONFIG_IPV6_NDISC_NODETYPE | 323 | #ifdef CONFIG_IPV6_NDISC_NODETYPE |
318 | __u8 ndisc_nodetype:2; | 324 | __u8 ndisc_nodetype:2; |
319 | #endif | 325 | #endif |
320 | /* 14 bit hole */ | 326 | #if defined(CONFIG_MAC80211) || defined(CONFIG_MAC80211_MODULE) |
327 | __u8 do_not_encrypt:1; | ||
328 | #endif | ||
329 | /* 0/13/14 bit hole */ | ||
321 | 330 | ||
322 | #ifdef CONFIG_NET_DMA | 331 | #ifdef CONFIG_NET_DMA |
323 | dma_cookie_t dma_cookie; | 332 | dma_cookie_t dma_cookie; |
@@ -328,6 +337,8 @@ struct sk_buff { | |||
328 | 337 | ||
329 | __u32 mark; | 338 | __u32 mark; |
330 | 339 | ||
340 | __u16 vlan_tci; | ||
341 | |||
331 | sk_buff_data_t transport_header; | 342 | sk_buff_data_t transport_header; |
332 | sk_buff_data_t network_header; | 343 | sk_buff_data_t network_header; |
333 | sk_buff_data_t mac_header; | 344 | sk_buff_data_t mac_header; |
@@ -348,6 +359,14 @@ struct sk_buff { | |||
348 | 359 | ||
349 | #include <asm/system.h> | 360 | #include <asm/system.h> |
350 | 361 | ||
362 | #ifdef CONFIG_HAS_DMA | ||
363 | #include <linux/dma-mapping.h> | ||
364 | extern int skb_dma_map(struct device *dev, struct sk_buff *skb, | ||
365 | enum dma_data_direction dir); | ||
366 | extern void skb_dma_unmap(struct device *dev, struct sk_buff *skb, | ||
367 | enum dma_data_direction dir); | ||
368 | #endif | ||
369 | |||
351 | extern void kfree_skb(struct sk_buff *skb); | 370 | extern void kfree_skb(struct sk_buff *skb); |
352 | extern void __kfree_skb(struct sk_buff *skb); | 371 | extern void __kfree_skb(struct sk_buff *skb); |
353 | extern struct sk_buff *__alloc_skb(unsigned int size, | 372 | extern struct sk_buff *__alloc_skb(unsigned int size, |
@@ -364,6 +383,8 @@ static inline struct sk_buff *alloc_skb_fclone(unsigned int size, | |||
364 | return __alloc_skb(size, priority, 1, -1); | 383 | return __alloc_skb(size, priority, 1, -1); |
365 | } | 384 | } |
366 | 385 | ||
386 | extern int skb_recycle_check(struct sk_buff *skb, int skb_size); | ||
387 | |||
367 | extern struct sk_buff *skb_morph(struct sk_buff *dst, struct sk_buff *src); | 388 | extern struct sk_buff *skb_morph(struct sk_buff *dst, struct sk_buff *src); |
368 | extern struct sk_buff *skb_clone(struct sk_buff *skb, | 389 | extern struct sk_buff *skb_clone(struct sk_buff *skb, |
369 | gfp_t priority); | 390 | gfp_t priority); |
@@ -454,6 +475,37 @@ static inline int skb_queue_empty(const struct sk_buff_head *list) | |||
454 | } | 475 | } |
455 | 476 | ||
456 | /** | 477 | /** |
478 | * skb_queue_is_last - check if skb is the last entry in the queue | ||
479 | * @list: queue head | ||
480 | * @skb: buffer | ||
481 | * | ||
482 | * Returns true if @skb is the last buffer on the list. | ||
483 | */ | ||
484 | static inline bool skb_queue_is_last(const struct sk_buff_head *list, | ||
485 | const struct sk_buff *skb) | ||
486 | { | ||
487 | return (skb->next == (struct sk_buff *) list); | ||
488 | } | ||
489 | |||
490 | /** | ||
491 | * skb_queue_next - return the next packet in the queue | ||
492 | * @list: queue head | ||
493 | * @skb: current buffer | ||
494 | * | ||
495 | * Return the next packet in @list after @skb. It is only valid to | ||
496 | * call this if skb_queue_is_last() evaluates to false. | ||
497 | */ | ||
498 | static inline struct sk_buff *skb_queue_next(const struct sk_buff_head *list, | ||
499 | const struct sk_buff *skb) | ||
500 | { | ||
501 | /* This BUG_ON may seem severe, but if we just return then we | ||
502 | * are going to dereference garbage. | ||
503 | */ | ||
504 | BUG_ON(skb_queue_is_last(list, skb)); | ||
505 | return skb->next; | ||
506 | } | ||
507 | |||
508 | /** | ||
457 | * skb_get - reference buffer | 509 | * skb_get - reference buffer |
458 | * @skb: buffer to reference | 510 | * @skb: buffer to reference |
459 | * | 511 | * |
@@ -641,6 +693,22 @@ static inline __u32 skb_queue_len(const struct sk_buff_head *list_) | |||
641 | return list_->qlen; | 693 | return list_->qlen; |
642 | } | 694 | } |
643 | 695 | ||
696 | /** | ||
697 | * __skb_queue_head_init - initialize non-spinlock portions of sk_buff_head | ||
698 | * @list: queue to initialize | ||
699 | * | ||
700 | * This initializes only the list and queue length aspects of | ||
701 | * an sk_buff_head object. This allows to initialize the list | ||
702 | * aspects of an sk_buff_head without reinitializing things like | ||
703 | * the spinlock. It can also be used for on-stack sk_buff_head | ||
704 | * objects where the spinlock is known to not be used. | ||
705 | */ | ||
706 | static inline void __skb_queue_head_init(struct sk_buff_head *list) | ||
707 | { | ||
708 | list->prev = list->next = (struct sk_buff *)list; | ||
709 | list->qlen = 0; | ||
710 | } | ||
711 | |||
644 | /* | 712 | /* |
645 | * This function creates a split out lock class for each invocation; | 713 | * This function creates a split out lock class for each invocation; |
646 | * this is needed for now since a whole lot of users of the skb-queue | 714 | * this is needed for now since a whole lot of users of the skb-queue |
@@ -652,8 +720,7 @@ static inline __u32 skb_queue_len(const struct sk_buff_head *list_) | |||
652 | static inline void skb_queue_head_init(struct sk_buff_head *list) | 720 | static inline void skb_queue_head_init(struct sk_buff_head *list) |
653 | { | 721 | { |
654 | spin_lock_init(&list->lock); | 722 | spin_lock_init(&list->lock); |
655 | list->prev = list->next = (struct sk_buff *)list; | 723 | __skb_queue_head_init(list); |
656 | list->qlen = 0; | ||
657 | } | 724 | } |
658 | 725 | ||
659 | static inline void skb_queue_head_init_class(struct sk_buff_head *list, | 726 | static inline void skb_queue_head_init_class(struct sk_buff_head *list, |
@@ -680,6 +747,83 @@ static inline void __skb_insert(struct sk_buff *newsk, | |||
680 | list->qlen++; | 747 | list->qlen++; |
681 | } | 748 | } |
682 | 749 | ||
750 | static inline void __skb_queue_splice(const struct sk_buff_head *list, | ||
751 | struct sk_buff *prev, | ||
752 | struct sk_buff *next) | ||
753 | { | ||
754 | struct sk_buff *first = list->next; | ||
755 | struct sk_buff *last = list->prev; | ||
756 | |||
757 | first->prev = prev; | ||
758 | prev->next = first; | ||
759 | |||
760 | last->next = next; | ||
761 | next->prev = last; | ||
762 | } | ||
763 | |||
764 | /** | ||
765 | * skb_queue_splice - join two skb lists, this is designed for stacks | ||
766 | * @list: the new list to add | ||
767 | * @head: the place to add it in the first list | ||
768 | */ | ||
769 | static inline void skb_queue_splice(const struct sk_buff_head *list, | ||
770 | struct sk_buff_head *head) | ||
771 | { | ||
772 | if (!skb_queue_empty(list)) { | ||
773 | __skb_queue_splice(list, (struct sk_buff *) head, head->next); | ||
774 | head->qlen += list->qlen; | ||
775 | } | ||
776 | } | ||
777 | |||
778 | /** | ||
779 | * skb_queue_splice - join two skb lists and reinitialise the emptied list | ||
780 | * @list: the new list to add | ||
781 | * @head: the place to add it in the first list | ||
782 | * | ||
783 | * The list at @list is reinitialised | ||
784 | */ | ||
785 | static inline void skb_queue_splice_init(struct sk_buff_head *list, | ||
786 | struct sk_buff_head *head) | ||
787 | { | ||
788 | if (!skb_queue_empty(list)) { | ||
789 | __skb_queue_splice(list, (struct sk_buff *) head, head->next); | ||
790 | head->qlen += list->qlen; | ||
791 | __skb_queue_head_init(list); | ||
792 | } | ||
793 | } | ||
794 | |||
795 | /** | ||
796 | * skb_queue_splice_tail - join two skb lists, each list being a queue | ||
797 | * @list: the new list to add | ||
798 | * @head: the place to add it in the first list | ||
799 | */ | ||
800 | static inline void skb_queue_splice_tail(const struct sk_buff_head *list, | ||
801 | struct sk_buff_head *head) | ||
802 | { | ||
803 | if (!skb_queue_empty(list)) { | ||
804 | __skb_queue_splice(list, head->prev, (struct sk_buff *) head); | ||
805 | head->qlen += list->qlen; | ||
806 | } | ||
807 | } | ||
808 | |||
809 | /** | ||
810 | * skb_queue_splice_tail - join two skb lists and reinitialise the emptied list | ||
811 | * @list: the new list to add | ||
812 | * @head: the place to add it in the first list | ||
813 | * | ||
814 | * Each of the lists is a queue. | ||
815 | * The list at @list is reinitialised | ||
816 | */ | ||
817 | static inline void skb_queue_splice_tail_init(struct sk_buff_head *list, | ||
818 | struct sk_buff_head *head) | ||
819 | { | ||
820 | if (!skb_queue_empty(list)) { | ||
821 | __skb_queue_splice(list, head->prev, (struct sk_buff *) head); | ||
822 | head->qlen += list->qlen; | ||
823 | __skb_queue_head_init(list); | ||
824 | } | ||
825 | } | ||
826 | |||
683 | /** | 827 | /** |
684 | * __skb_queue_after - queue a buffer at the list head | 828 | * __skb_queue_after - queue a buffer at the list head |
685 | * @list: list to use | 829 | * @list: list to use |
@@ -824,6 +968,9 @@ static inline void skb_fill_page_desc(struct sk_buff *skb, int i, | |||
824 | skb_shinfo(skb)->nr_frags = i + 1; | 968 | skb_shinfo(skb)->nr_frags = i + 1; |
825 | } | 969 | } |
826 | 970 | ||
971 | extern void skb_add_rx_frag(struct sk_buff *skb, int i, struct page *page, | ||
972 | int off, int size); | ||
973 | |||
827 | #define SKB_PAGE_ASSERT(skb) BUG_ON(skb_shinfo(skb)->nr_frags) | 974 | #define SKB_PAGE_ASSERT(skb) BUG_ON(skb_shinfo(skb)->nr_frags) |
828 | #define SKB_FRAG_ASSERT(skb) BUG_ON(skb_shinfo(skb)->frag_list) | 975 | #define SKB_FRAG_ASSERT(skb) BUG_ON(skb_shinfo(skb)->frag_list) |
829 | #define SKB_LINEAR_ASSERT(skb) BUG_ON(skb_is_nonlinear(skb)) | 976 | #define SKB_LINEAR_ASSERT(skb) BUG_ON(skb_is_nonlinear(skb)) |
@@ -896,7 +1043,7 @@ extern unsigned char *__pskb_pull_tail(struct sk_buff *skb, int delta); | |||
896 | static inline unsigned char *__pskb_pull(struct sk_buff *skb, unsigned int len) | 1043 | static inline unsigned char *__pskb_pull(struct sk_buff *skb, unsigned int len) |
897 | { | 1044 | { |
898 | if (len > skb_headlen(skb) && | 1045 | if (len > skb_headlen(skb) && |
899 | !__pskb_pull_tail(skb, len-skb_headlen(skb))) | 1046 | !__pskb_pull_tail(skb, len - skb_headlen(skb))) |
900 | return NULL; | 1047 | return NULL; |
901 | skb->len -= len; | 1048 | skb->len -= len; |
902 | return skb->data += len; | 1049 | return skb->data += len; |
@@ -913,7 +1060,7 @@ static inline int pskb_may_pull(struct sk_buff *skb, unsigned int len) | |||
913 | return 1; | 1060 | return 1; |
914 | if (unlikely(len > skb->len)) | 1061 | if (unlikely(len > skb->len)) |
915 | return 0; | 1062 | return 0; |
916 | return __pskb_pull_tail(skb, len-skb_headlen(skb)) != NULL; | 1063 | return __pskb_pull_tail(skb, len - skb_headlen(skb)) != NULL; |
917 | } | 1064 | } |
918 | 1065 | ||
919 | /** | 1066 | /** |
@@ -1238,6 +1385,26 @@ static inline struct sk_buff *netdev_alloc_skb(struct net_device *dev, | |||
1238 | return __netdev_alloc_skb(dev, length, GFP_ATOMIC); | 1385 | return __netdev_alloc_skb(dev, length, GFP_ATOMIC); |
1239 | } | 1386 | } |
1240 | 1387 | ||
1388 | extern struct page *__netdev_alloc_page(struct net_device *dev, gfp_t gfp_mask); | ||
1389 | |||
1390 | /** | ||
1391 | * netdev_alloc_page - allocate a page for ps-rx on a specific device | ||
1392 | * @dev: network device to receive on | ||
1393 | * | ||
1394 | * Allocate a new page node local to the specified device. | ||
1395 | * | ||
1396 | * %NULL is returned if there is no free memory. | ||
1397 | */ | ||
1398 | static inline struct page *netdev_alloc_page(struct net_device *dev) | ||
1399 | { | ||
1400 | return __netdev_alloc_page(dev, GFP_ATOMIC); | ||
1401 | } | ||
1402 | |||
1403 | static inline void netdev_free_page(struct net_device *dev, struct page *page) | ||
1404 | { | ||
1405 | __free_page(page); | ||
1406 | } | ||
1407 | |||
1241 | /** | 1408 | /** |
1242 | * skb_clone_writable - is the header of a clone writable | 1409 | * skb_clone_writable - is the header of a clone writable |
1243 | * @skb: buffer to check | 1410 | * @skb: buffer to check |
@@ -1316,7 +1483,7 @@ static inline int skb_padto(struct sk_buff *skb, unsigned int len) | |||
1316 | unsigned int size = skb->len; | 1483 | unsigned int size = skb->len; |
1317 | if (likely(size >= len)) | 1484 | if (likely(size >= len)) |
1318 | return 0; | 1485 | return 0; |
1319 | return skb_pad(skb, len-size); | 1486 | return skb_pad(skb, len - size); |
1320 | } | 1487 | } |
1321 | 1488 | ||
1322 | static inline int skb_add_data(struct sk_buff *skb, | 1489 | static inline int skb_add_data(struct sk_buff *skb, |
@@ -1429,6 +1596,15 @@ static inline int pskb_trim_rcsum(struct sk_buff *skb, unsigned int len) | |||
1429 | skb != (struct sk_buff *)(queue); \ | 1596 | skb != (struct sk_buff *)(queue); \ |
1430 | skb = tmp, tmp = skb->next) | 1597 | skb = tmp, tmp = skb->next) |
1431 | 1598 | ||
1599 | #define skb_queue_walk_from(queue, skb) \ | ||
1600 | for (; prefetch(skb->next), (skb != (struct sk_buff *)(queue)); \ | ||
1601 | skb = skb->next) | ||
1602 | |||
1603 | #define skb_queue_walk_from_safe(queue, skb, tmp) \ | ||
1604 | for (tmp = skb->next; \ | ||
1605 | skb != (struct sk_buff *)(queue); \ | ||
1606 | skb = tmp, tmp = skb->next) | ||
1607 | |||
1432 | #define skb_queue_reverse_walk(queue, skb) \ | 1608 | #define skb_queue_reverse_walk(queue, skb) \ |
1433 | for (skb = (queue)->prev; \ | 1609 | for (skb = (queue)->prev; \ |
1434 | prefetch(skb->prev), (skb != (struct sk_buff *)(queue)); \ | 1610 | prefetch(skb->prev), (skb != (struct sk_buff *)(queue)); \ |
@@ -1447,6 +1623,10 @@ extern int skb_copy_datagram_iovec(const struct sk_buff *from, | |||
1447 | extern int skb_copy_and_csum_datagram_iovec(struct sk_buff *skb, | 1623 | extern int skb_copy_and_csum_datagram_iovec(struct sk_buff *skb, |
1448 | int hlen, | 1624 | int hlen, |
1449 | struct iovec *iov); | 1625 | struct iovec *iov); |
1626 | extern int skb_copy_datagram_from_iovec(struct sk_buff *skb, | ||
1627 | int offset, | ||
1628 | struct iovec *from, | ||
1629 | int len); | ||
1450 | extern void skb_free_datagram(struct sock *sk, struct sk_buff *skb); | 1630 | extern void skb_free_datagram(struct sock *sk, struct sk_buff *skb); |
1451 | extern int skb_kill_datagram(struct sock *sk, struct sk_buff *skb, | 1631 | extern int skb_kill_datagram(struct sock *sk, struct sk_buff *skb, |
1452 | unsigned int flags); | 1632 | unsigned int flags); |
@@ -1671,25 +1851,17 @@ static inline void skb_init_secmark(struct sk_buff *skb) | |||
1671 | 1851 | ||
1672 | static inline void skb_set_queue_mapping(struct sk_buff *skb, u16 queue_mapping) | 1852 | static inline void skb_set_queue_mapping(struct sk_buff *skb, u16 queue_mapping) |
1673 | { | 1853 | { |
1674 | #ifdef CONFIG_NETDEVICES_MULTIQUEUE | ||
1675 | skb->queue_mapping = queue_mapping; | 1854 | skb->queue_mapping = queue_mapping; |
1676 | #endif | ||
1677 | } | 1855 | } |
1678 | 1856 | ||
1679 | static inline u16 skb_get_queue_mapping(struct sk_buff *skb) | 1857 | static inline u16 skb_get_queue_mapping(struct sk_buff *skb) |
1680 | { | 1858 | { |
1681 | #ifdef CONFIG_NETDEVICES_MULTIQUEUE | ||
1682 | return skb->queue_mapping; | 1859 | return skb->queue_mapping; |
1683 | #else | ||
1684 | return 0; | ||
1685 | #endif | ||
1686 | } | 1860 | } |
1687 | 1861 | ||
1688 | static inline void skb_copy_queue_mapping(struct sk_buff *to, const struct sk_buff *from) | 1862 | static inline void skb_copy_queue_mapping(struct sk_buff *to, const struct sk_buff *from) |
1689 | { | 1863 | { |
1690 | #ifdef CONFIG_NETDEVICES_MULTIQUEUE | ||
1691 | to->queue_mapping = from->queue_mapping; | 1864 | to->queue_mapping = from->queue_mapping; |
1692 | #endif | ||
1693 | } | 1865 | } |
1694 | 1866 | ||
1695 | static inline int skb_is_gso(const struct sk_buff *skb) | 1867 | static inline int skb_is_gso(const struct sk_buff *skb) |
@@ -1702,6 +1874,20 @@ static inline int skb_is_gso_v6(const struct sk_buff *skb) | |||
1702 | return skb_shinfo(skb)->gso_type & SKB_GSO_TCPV6; | 1874 | return skb_shinfo(skb)->gso_type & SKB_GSO_TCPV6; |
1703 | } | 1875 | } |
1704 | 1876 | ||
1877 | extern void __skb_warn_lro_forwarding(const struct sk_buff *skb); | ||
1878 | |||
1879 | static inline bool skb_warn_if_lro(const struct sk_buff *skb) | ||
1880 | { | ||
1881 | /* LRO sets gso_size but not gso_type, whereas if GSO is really | ||
1882 | * wanted then gso_type will be set. */ | ||
1883 | struct skb_shared_info *shinfo = skb_shinfo(skb); | ||
1884 | if (shinfo->gso_size != 0 && unlikely(shinfo->gso_type == 0)) { | ||
1885 | __skb_warn_lro_forwarding(skb); | ||
1886 | return true; | ||
1887 | } | ||
1888 | return false; | ||
1889 | } | ||
1890 | |||
1705 | static inline void skb_forward_csum(struct sk_buff *skb) | 1891 | static inline void skb_forward_csum(struct sk_buff *skb) |
1706 | { | 1892 | { |
1707 | /* Unfortunately we don't support this one. Any brave souls? */ | 1893 | /* Unfortunately we don't support this one. Any brave souls? */ |
diff --git a/include/linux/slab.h b/include/linux/slab.h index c2ad35016599..5ff9676c1e2c 100644 --- a/include/linux/slab.h +++ b/include/linux/slab.h | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * Written by Mark Hemment, 1996 (markhe@nextd.demon.co.uk). | 2 | * Written by Mark Hemment, 1996 (markhe@nextd.demon.co.uk). |
3 | * | 3 | * |
4 | * (C) SGI 2006, Christoph Lameter <clameter@sgi.com> | 4 | * (C) SGI 2006, Christoph Lameter |
5 | * Cleaned up and restructured to ease the addition of alternative | 5 | * Cleaned up and restructured to ease the addition of alternative |
6 | * implementations of SLAB allocators. | 6 | * implementations of SLAB allocators. |
7 | */ | 7 | */ |
@@ -58,7 +58,7 @@ int slab_is_available(void); | |||
58 | 58 | ||
59 | struct kmem_cache *kmem_cache_create(const char *, size_t, size_t, | 59 | struct kmem_cache *kmem_cache_create(const char *, size_t, size_t, |
60 | unsigned long, | 60 | unsigned long, |
61 | void (*)(struct kmem_cache *, void *)); | 61 | void (*)(void *)); |
62 | void kmem_cache_destroy(struct kmem_cache *); | 62 | void kmem_cache_destroy(struct kmem_cache *); |
63 | int kmem_cache_shrink(struct kmem_cache *); | 63 | int kmem_cache_shrink(struct kmem_cache *); |
64 | void kmem_cache_free(struct kmem_cache *, void *); | 64 | void kmem_cache_free(struct kmem_cache *, void *); |
@@ -96,6 +96,7 @@ int kmem_ptr_validate(struct kmem_cache *cachep, const void *ptr); | |||
96 | /* | 96 | /* |
97 | * Common kmalloc functions provided by all allocators | 97 | * Common kmalloc functions provided by all allocators |
98 | */ | 98 | */ |
99 | void * __must_check __krealloc(const void *, size_t, gfp_t); | ||
99 | void * __must_check krealloc(const void *, size_t, gfp_t); | 100 | void * __must_check krealloc(const void *, size_t, gfp_t); |
100 | void kfree(const void *); | 101 | void kfree(const void *); |
101 | size_t ksize(const void *); | 102 | size_t ksize(const void *); |
@@ -180,7 +181,7 @@ size_t ksize(const void *); | |||
180 | */ | 181 | */ |
181 | static inline void *kcalloc(size_t n, size_t size, gfp_t flags) | 182 | static inline void *kcalloc(size_t n, size_t size, gfp_t flags) |
182 | { | 183 | { |
183 | if (n != 0 && size > ULONG_MAX / n) | 184 | if (size != 0 && n > ULONG_MAX / size) |
184 | return NULL; | 185 | return NULL; |
185 | return __kmalloc(n * size, flags | __GFP_ZERO); | 186 | return __kmalloc(n * size, flags | __GFP_ZERO); |
186 | } | 187 | } |
diff --git a/include/linux/slub_def.h b/include/linux/slub_def.h index 71e43a12ebbb..2f5c16b1aacd 100644 --- a/include/linux/slub_def.h +++ b/include/linux/slub_def.h | |||
@@ -4,7 +4,7 @@ | |||
4 | /* | 4 | /* |
5 | * SLUB : A Slab allocator without object queues. | 5 | * SLUB : A Slab allocator without object queues. |
6 | * | 6 | * |
7 | * (C) 2007 SGI, Christoph Lameter <clameter@sgi.com> | 7 | * (C) 2007 SGI, Christoph Lameter |
8 | */ | 8 | */ |
9 | #include <linux/types.h> | 9 | #include <linux/types.h> |
10 | #include <linux/gfp.h> | 10 | #include <linux/gfp.h> |
@@ -46,6 +46,7 @@ struct kmem_cache_cpu { | |||
46 | struct kmem_cache_node { | 46 | struct kmem_cache_node { |
47 | spinlock_t list_lock; /* Protect partial list and nr_partial */ | 47 | spinlock_t list_lock; /* Protect partial list and nr_partial */ |
48 | unsigned long nr_partial; | 48 | unsigned long nr_partial; |
49 | unsigned long min_partial; | ||
49 | struct list_head partial; | 50 | struct list_head partial; |
50 | #ifdef CONFIG_SLUB_DEBUG | 51 | #ifdef CONFIG_SLUB_DEBUG |
51 | atomic_long_t nr_slabs; | 52 | atomic_long_t nr_slabs; |
@@ -85,7 +86,7 @@ struct kmem_cache { | |||
85 | struct kmem_cache_order_objects min; | 86 | struct kmem_cache_order_objects min; |
86 | gfp_t allocflags; /* gfp flags to use on each alloc */ | 87 | gfp_t allocflags; /* gfp flags to use on each alloc */ |
87 | int refcount; /* Refcount for slab cache destroy */ | 88 | int refcount; /* Refcount for slab cache destroy */ |
88 | void (*ctor)(struct kmem_cache *, void *); | 89 | void (*ctor)(void *); |
89 | int inuse; /* Offset to metadata */ | 90 | int inuse; /* Offset to metadata */ |
90 | int align; /* Alignment */ | 91 | int align; /* Alignment */ |
91 | const char *name; /* Name (only for display!) */ | 92 | const char *name; /* Name (only for display!) */ |
@@ -137,10 +138,12 @@ static __always_inline int kmalloc_index(size_t size) | |||
137 | if (size <= KMALLOC_MIN_SIZE) | 138 | if (size <= KMALLOC_MIN_SIZE) |
138 | return KMALLOC_SHIFT_LOW; | 139 | return KMALLOC_SHIFT_LOW; |
139 | 140 | ||
141 | #if KMALLOC_MIN_SIZE <= 64 | ||
140 | if (size > 64 && size <= 96) | 142 | if (size > 64 && size <= 96) |
141 | return 1; | 143 | return 1; |
142 | if (size > 128 && size <= 192) | 144 | if (size > 128 && size <= 192) |
143 | return 2; | 145 | return 2; |
146 | #endif | ||
144 | if (size <= 8) return 3; | 147 | if (size <= 8) return 3; |
145 | if (size <= 16) return 4; | 148 | if (size <= 16) return 4; |
146 | if (size <= 32) return 5; | 149 | if (size <= 32) return 5; |
diff --git a/include/linux/sm501.h b/include/linux/sm501.h index 95c1c39ba445..214f93209b8c 100644 --- a/include/linux/sm501.h +++ b/include/linux/sm501.h | |||
@@ -46,24 +46,6 @@ extern unsigned long sm501_modify_reg(struct device *dev, | |||
46 | unsigned long set, | 46 | unsigned long set, |
47 | unsigned long clear); | 47 | unsigned long clear); |
48 | 48 | ||
49 | /* sm501_gpio_set | ||
50 | * | ||
51 | * set the state of the given GPIO line | ||
52 | */ | ||
53 | |||
54 | extern void sm501_gpio_set(struct device *dev, | ||
55 | unsigned long gpio, | ||
56 | unsigned int to, | ||
57 | unsigned int dir); | ||
58 | |||
59 | /* sm501_gpio_get | ||
60 | * | ||
61 | * get the state of the given GPIO line | ||
62 | */ | ||
63 | |||
64 | extern unsigned long sm501_gpio_get(struct device *dev, | ||
65 | unsigned long gpio); | ||
66 | |||
67 | 49 | ||
68 | /* Platform data definitions */ | 50 | /* Platform data definitions */ |
69 | 51 | ||
@@ -73,6 +55,8 @@ extern unsigned long sm501_gpio_get(struct device *dev, | |||
73 | #define SM501FB_FLAG_USE_HWACCEL (1<<3) | 55 | #define SM501FB_FLAG_USE_HWACCEL (1<<3) |
74 | #define SM501FB_FLAG_PANEL_NO_FPEN (1<<4) | 56 | #define SM501FB_FLAG_PANEL_NO_FPEN (1<<4) |
75 | #define SM501FB_FLAG_PANEL_NO_VBIASEN (1<<5) | 57 | #define SM501FB_FLAG_PANEL_NO_VBIASEN (1<<5) |
58 | #define SM501FB_FLAG_PANEL_INV_FPEN (1<<6) | ||
59 | #define SM501FB_FLAG_PANEL_INV_VBIASEN (1<<7) | ||
76 | 60 | ||
77 | struct sm501_platdata_fbsub { | 61 | struct sm501_platdata_fbsub { |
78 | struct fb_videomode *def_mode; | 62 | struct fb_videomode *def_mode; |
@@ -102,11 +86,19 @@ struct sm501_platdata_fb { | |||
102 | struct sm501_platdata_fbsub *fb_pnl; | 86 | struct sm501_platdata_fbsub *fb_pnl; |
103 | }; | 87 | }; |
104 | 88 | ||
105 | /* gpio i2c */ | 89 | /* gpio i2c |
90 | * | ||
91 | * Note, we have to pass in the bus number, as the number used will be | ||
92 | * passed to the i2c-gpio driver's platform_device.id, subsequently used | ||
93 | * to register the i2c bus. | ||
94 | */ | ||
106 | 95 | ||
107 | struct sm501_platdata_gpio_i2c { | 96 | struct sm501_platdata_gpio_i2c { |
97 | unsigned int bus_num; | ||
108 | unsigned int pin_sda; | 98 | unsigned int pin_sda; |
109 | unsigned int pin_scl; | 99 | unsigned int pin_scl; |
100 | int udelay; | ||
101 | int timeout; | ||
110 | }; | 102 | }; |
111 | 103 | ||
112 | /* sm501_initdata | 104 | /* sm501_initdata |
@@ -129,6 +121,7 @@ struct sm501_reg_init { | |||
129 | #define SM501_USE_FBACCEL (1<<6) | 121 | #define SM501_USE_FBACCEL (1<<6) |
130 | #define SM501_USE_AC97 (1<<7) | 122 | #define SM501_USE_AC97 (1<<7) |
131 | #define SM501_USE_I2S (1<<8) | 123 | #define SM501_USE_I2S (1<<8) |
124 | #define SM501_USE_GPIO (1<<9) | ||
132 | 125 | ||
133 | #define SM501_USE_ALL (0xffffffff) | 126 | #define SM501_USE_ALL (0xffffffff) |
134 | 127 | ||
@@ -155,6 +148,8 @@ struct sm501_init_gpio { | |||
155 | struct sm501_reg_init gpio_ddr_high; | 148 | struct sm501_reg_init gpio_ddr_high; |
156 | }; | 149 | }; |
157 | 150 | ||
151 | #define SM501_FLAG_SUSPEND_OFF (1<<4) | ||
152 | |||
158 | /* sm501_platdata | 153 | /* sm501_platdata |
159 | * | 154 | * |
160 | * This is passed with the platform device to allow the board | 155 | * This is passed with the platform device to allow the board |
@@ -168,6 +163,12 @@ struct sm501_platdata { | |||
168 | struct sm501_init_gpio *init_gpiop; | 163 | struct sm501_init_gpio *init_gpiop; |
169 | struct sm501_platdata_fb *fb; | 164 | struct sm501_platdata_fb *fb; |
170 | 165 | ||
166 | int flags; | ||
167 | int gpio_base; | ||
168 | |||
169 | int (*get_power)(struct device *dev); | ||
170 | int (*set_power)(struct device *dev, unsigned int on); | ||
171 | |||
171 | struct sm501_platdata_gpio_i2c *gpio_i2c; | 172 | struct sm501_platdata_gpio_i2c *gpio_i2c; |
172 | unsigned int gpio_i2c_nr; | 173 | unsigned int gpio_i2c_nr; |
173 | }; | 174 | }; |
diff --git a/include/linux/smb.h b/include/linux/smb.h index caa43b2370cb..82fefddc5987 100644 --- a/include/linux/smb.h +++ b/include/linux/smb.h | |||
@@ -11,7 +11,9 @@ | |||
11 | 11 | ||
12 | #include <linux/types.h> | 12 | #include <linux/types.h> |
13 | #include <linux/magic.h> | 13 | #include <linux/magic.h> |
14 | #ifdef __KERNEL__ | ||
14 | #include <linux/time.h> | 15 | #include <linux/time.h> |
16 | #endif | ||
15 | 17 | ||
16 | enum smb_protocol { | 18 | enum smb_protocol { |
17 | SMB_PROTOCOL_NONE, | 19 | SMB_PROTOCOL_NONE, |
diff --git a/include/linux/smb_fs.h b/include/linux/smb_fs.h index 2c5cd55f44ff..923cd8a247b1 100644 --- a/include/linux/smb_fs.h +++ b/include/linux/smb_fs.h | |||
@@ -43,18 +43,13 @@ static inline struct smb_inode_info *SMB_I(struct inode *inode) | |||
43 | } | 43 | } |
44 | 44 | ||
45 | /* macro names are short for word, double-word, long value (?) */ | 45 | /* macro names are short for word, double-word, long value (?) */ |
46 | #define WVAL(buf,pos) \ | 46 | #define WVAL(buf, pos) (get_unaligned_le16((u8 *)(buf) + (pos))) |
47 | (le16_to_cpu(get_unaligned((__le16 *)((u8 *)(buf) + (pos))))) | 47 | #define DVAL(buf, pos) (get_unaligned_le32((u8 *)(buf) + (pos))) |
48 | #define DVAL(buf,pos) \ | 48 | #define LVAL(buf, pos) (get_unaligned_le64((u8 *)(buf) + (pos))) |
49 | (le32_to_cpu(get_unaligned((__le32 *)((u8 *)(buf) + (pos))))) | 49 | |
50 | #define LVAL(buf,pos) \ | 50 | #define WSET(buf, pos, val) put_unaligned_le16((val), (u8 *)(buf) + (pos)) |
51 | (le64_to_cpu(get_unaligned((__le64 *)((u8 *)(buf) + (pos))))) | 51 | #define DSET(buf, pos, val) put_unaligned_le32((val), (u8 *)(buf) + (pos)) |
52 | #define WSET(buf,pos,val) \ | 52 | #define LSET(buf, pos, val) put_unaligned_le64((val), (u8 *)(buf) + (pos)) |
53 | put_unaligned(cpu_to_le16((u16)(val)), (__le16 *)((u8 *)(buf) + (pos))) | ||
54 | #define DSET(buf,pos,val) \ | ||
55 | put_unaligned(cpu_to_le32((u32)(val)), (__le32 *)((u8 *)(buf) + (pos))) | ||
56 | #define LSET(buf,pos,val) \ | ||
57 | put_unaligned(cpu_to_le64((u64)(val)), (__le64 *)((u8 *)(buf) + (pos))) | ||
58 | 53 | ||
59 | /* where to find the base of the SMB packet proper */ | 54 | /* where to find the base of the SMB packet proper */ |
60 | #define smb_base(buf) ((u8 *)(((u8 *)(buf))+4)) | 55 | #define smb_base(buf) ((u8 *)(((u8 *)(buf))+4)) |
diff --git a/include/linux/smc911x.h b/include/linux/smc911x.h new file mode 100644 index 000000000000..b58f54c24183 --- /dev/null +++ b/include/linux/smc911x.h | |||
@@ -0,0 +1,12 @@ | |||
1 | #ifndef __SMC911X_H__ | ||
2 | #define __SMC911X_H__ | ||
3 | |||
4 | #define SMC911X_USE_16BIT (1 << 0) | ||
5 | #define SMC911X_USE_32BIT (1 << 1) | ||
6 | |||
7 | struct smc911x_platdata { | ||
8 | unsigned long flags; | ||
9 | unsigned long irq_flags; /* IRQF_... */ | ||
10 | }; | ||
11 | |||
12 | #endif /* __SMC911X_H__ */ | ||
diff --git a/include/linux/smc91x.h b/include/linux/smc91x.h index 8e0556b8781c..bc21db598c06 100644 --- a/include/linux/smc91x.h +++ b/include/linux/smc91x.h | |||
@@ -5,9 +5,30 @@ | |||
5 | #define SMC91X_USE_16BIT (1 << 1) | 5 | #define SMC91X_USE_16BIT (1 << 1) |
6 | #define SMC91X_USE_32BIT (1 << 2) | 6 | #define SMC91X_USE_32BIT (1 << 2) |
7 | 7 | ||
8 | #define SMC91X_NOWAIT (1 << 3) | ||
9 | |||
10 | /* two bits for IO_SHIFT, let's hope later designs will keep this sane */ | ||
11 | #define SMC91X_IO_SHIFT_0 (0 << 4) | ||
12 | #define SMC91X_IO_SHIFT_1 (1 << 4) | ||
13 | #define SMC91X_IO_SHIFT_2 (2 << 4) | ||
14 | #define SMC91X_IO_SHIFT_3 (3 << 4) | ||
15 | #define SMC91X_IO_SHIFT(x) (((x) >> 4) & 0x3) | ||
16 | |||
17 | #define SMC91X_USE_DMA (1 << 6) | ||
18 | |||
19 | #define RPC_LED_100_10 (0x00) /* LED = 100Mbps OR's with 10Mbps link detect */ | ||
20 | #define RPC_LED_RES (0x01) /* LED = Reserved */ | ||
21 | #define RPC_LED_10 (0x02) /* LED = 10Mbps link detect */ | ||
22 | #define RPC_LED_FD (0x03) /* LED = Full Duplex Mode */ | ||
23 | #define RPC_LED_TX_RX (0x04) /* LED = TX or RX packet occurred */ | ||
24 | #define RPC_LED_100 (0x05) /* LED = 100Mbps link dectect */ | ||
25 | #define RPC_LED_TX (0x06) /* LED = TX packet occurred */ | ||
26 | #define RPC_LED_RX (0x07) /* LED = RX packet occurred */ | ||
27 | |||
8 | struct smc91x_platdata { | 28 | struct smc91x_platdata { |
9 | unsigned long flags; | 29 | unsigned long flags; |
10 | unsigned long irq_flags; /* IRQF_... */ | 30 | unsigned char leda; |
31 | unsigned char ledb; | ||
11 | }; | 32 | }; |
12 | 33 | ||
13 | #endif /* __SMC91X_H__ */ | 34 | #endif /* __SMC91X_H__ */ |
diff --git a/include/linux/smp.h b/include/linux/smp.h index 55232ccf9cfd..66484d4a8459 100644 --- a/include/linux/smp.h +++ b/include/linux/smp.h | |||
@@ -7,9 +7,18 @@ | |||
7 | */ | 7 | */ |
8 | 8 | ||
9 | #include <linux/errno.h> | 9 | #include <linux/errno.h> |
10 | #include <linux/list.h> | ||
11 | #include <linux/cpumask.h> | ||
10 | 12 | ||
11 | extern void cpu_idle(void); | 13 | extern void cpu_idle(void); |
12 | 14 | ||
15 | struct call_single_data { | ||
16 | struct list_head list; | ||
17 | void (*func) (void *info); | ||
18 | void *info; | ||
19 | unsigned int flags; | ||
20 | }; | ||
21 | |||
13 | #ifdef CONFIG_SMP | 22 | #ifdef CONFIG_SMP |
14 | 23 | ||
15 | #include <linux/preempt.h> | 24 | #include <linux/preempt.h> |
@@ -52,15 +61,29 @@ extern void smp_cpus_done(unsigned int max_cpus); | |||
52 | /* | 61 | /* |
53 | * Call a function on all other processors | 62 | * Call a function on all other processors |
54 | */ | 63 | */ |
55 | int smp_call_function(void(*func)(void *info), void *info, int retry, int wait); | 64 | int smp_call_function(void(*func)(void *info), void *info, int wait); |
56 | 65 | int smp_call_function_mask(cpumask_t mask, void(*func)(void *info), void *info, | |
66 | int wait); | ||
57 | int smp_call_function_single(int cpuid, void (*func) (void *info), void *info, | 67 | int smp_call_function_single(int cpuid, void (*func) (void *info), void *info, |
58 | int retry, int wait); | 68 | int wait); |
69 | void __smp_call_function_single(int cpuid, struct call_single_data *data); | ||
70 | |||
71 | /* | ||
72 | * Generic and arch helpers | ||
73 | */ | ||
74 | #ifdef CONFIG_USE_GENERIC_SMP_HELPERS | ||
75 | void generic_smp_call_function_single_interrupt(void); | ||
76 | void generic_smp_call_function_interrupt(void); | ||
77 | void ipi_call_lock(void); | ||
78 | void ipi_call_unlock(void); | ||
79 | void ipi_call_lock_irq(void); | ||
80 | void ipi_call_unlock_irq(void); | ||
81 | #endif | ||
59 | 82 | ||
60 | /* | 83 | /* |
61 | * Call a function on all processors | 84 | * Call a function on all processors |
62 | */ | 85 | */ |
63 | int on_each_cpu(void (*func) (void *info), void *info, int retry, int wait); | 86 | int on_each_cpu(void (*func) (void *info), void *info, int wait); |
64 | 87 | ||
65 | #define MSG_ALL_BUT_SELF 0x8000 /* Assume <32768 CPU's */ | 88 | #define MSG_ALL_BUT_SELF 0x8000 /* Assume <32768 CPU's */ |
66 | #define MSG_ALL 0x8001 | 89 | #define MSG_ALL 0x8001 |
@@ -90,9 +113,9 @@ static inline int up_smp_call_function(void (*func)(void *), void *info) | |||
90 | { | 113 | { |
91 | return 0; | 114 | return 0; |
92 | } | 115 | } |
93 | #define smp_call_function(func, info, retry, wait) \ | 116 | #define smp_call_function(func, info, wait) \ |
94 | (up_smp_call_function(func, info)) | 117 | (up_smp_call_function(func, info)) |
95 | #define on_each_cpu(func,info,retry,wait) \ | 118 | #define on_each_cpu(func,info,wait) \ |
96 | ({ \ | 119 | ({ \ |
97 | local_irq_disable(); \ | 120 | local_irq_disable(); \ |
98 | func(info); \ | 121 | func(info); \ |
@@ -102,7 +125,7 @@ static inline int up_smp_call_function(void (*func)(void *), void *info) | |||
102 | static inline void smp_send_reschedule(int cpu) { } | 125 | static inline void smp_send_reschedule(int cpu) { } |
103 | #define num_booting_cpus() 1 | 126 | #define num_booting_cpus() 1 |
104 | #define smp_prepare_boot_cpu() do {} while (0) | 127 | #define smp_prepare_boot_cpu() do {} while (0) |
105 | #define smp_call_function_single(cpuid, func, info, retry, wait) \ | 128 | #define smp_call_function_single(cpuid, func, info, wait) \ |
106 | ({ \ | 129 | ({ \ |
107 | WARN_ON(cpuid != 0); \ | 130 | WARN_ON(cpuid != 0); \ |
108 | local_irq_disable(); \ | 131 | local_irq_disable(); \ |
@@ -112,7 +135,9 @@ static inline void smp_send_reschedule(int cpu) { } | |||
112 | }) | 135 | }) |
113 | #define smp_call_function_mask(mask, func, info, wait) \ | 136 | #define smp_call_function_mask(mask, func, info, wait) \ |
114 | (up_smp_call_function(func, info)) | 137 | (up_smp_call_function(func, info)) |
115 | 138 | static inline void init_call_single_data(void) | |
139 | { | ||
140 | } | ||
116 | #endif /* !SMP */ | 141 | #endif /* !SMP */ |
117 | 142 | ||
118 | /* | 143 | /* |
diff --git a/include/linux/smp_lock.h b/include/linux/smp_lock.h index aab3a4cff4e1..813be59bf345 100644 --- a/include/linux/smp_lock.h +++ b/include/linux/smp_lock.h | |||
@@ -27,11 +27,24 @@ static inline int reacquire_kernel_lock(struct task_struct *task) | |||
27 | extern void __lockfunc lock_kernel(void) __acquires(kernel_lock); | 27 | extern void __lockfunc lock_kernel(void) __acquires(kernel_lock); |
28 | extern void __lockfunc unlock_kernel(void) __releases(kernel_lock); | 28 | extern void __lockfunc unlock_kernel(void) __releases(kernel_lock); |
29 | 29 | ||
30 | /* | ||
31 | * Various legacy drivers don't really need the BKL in a specific | ||
32 | * function, but they *do* need to know that the BKL became available. | ||
33 | * This function just avoids wrapping a bunch of lock/unlock pairs | ||
34 | * around code which doesn't really need it. | ||
35 | */ | ||
36 | static inline void cycle_kernel_lock(void) | ||
37 | { | ||
38 | lock_kernel(); | ||
39 | unlock_kernel(); | ||
40 | } | ||
41 | |||
30 | #else | 42 | #else |
31 | 43 | ||
32 | #define lock_kernel() do { } while(0) | 44 | #define lock_kernel() do { } while(0) |
33 | #define unlock_kernel() do { } while(0) | 45 | #define unlock_kernel() do { } while(0) |
34 | #define release_kernel_lock(task) do { } while(0) | 46 | #define release_kernel_lock(task) do { } while(0) |
47 | #define cycle_kernel_lock() do { } while(0) | ||
35 | #define reacquire_kernel_lock(task) 0 | 48 | #define reacquire_kernel_lock(task) 0 |
36 | #define kernel_locked() 1 | 49 | #define kernel_locked() 1 |
37 | 50 | ||
diff --git a/include/linux/snmp.h b/include/linux/snmp.h index 5df62ef1280c..7a6e6bba4a71 100644 --- a/include/linux/snmp.h +++ b/include/linux/snmp.h | |||
@@ -214,6 +214,8 @@ enum | |||
214 | LINUX_MIB_TCPDSACKIGNOREDOLD, /* TCPSACKIgnoredOld */ | 214 | LINUX_MIB_TCPDSACKIGNOREDOLD, /* TCPSACKIgnoredOld */ |
215 | LINUX_MIB_TCPDSACKIGNOREDNOUNDO, /* TCPSACKIgnoredNoUndo */ | 215 | LINUX_MIB_TCPDSACKIGNOREDNOUNDO, /* TCPSACKIgnoredNoUndo */ |
216 | LINUX_MIB_TCPSPURIOUSRTOS, /* TCPSpuriousRTOs */ | 216 | LINUX_MIB_TCPSPURIOUSRTOS, /* TCPSpuriousRTOs */ |
217 | LINUX_MIB_TCPMD5NOTFOUND, /* TCPMD5NotFound */ | ||
218 | LINUX_MIB_TCPMD5UNEXPECTED, /* TCPMD5Unexpected */ | ||
217 | __LINUX_MIB_MAX | 219 | __LINUX_MIB_MAX |
218 | }; | 220 | }; |
219 | 221 | ||
diff --git a/include/linux/socket.h b/include/linux/socket.h index bd2b30a74e76..20fc4bbfca42 100644 --- a/include/linux/socket.h +++ b/include/linux/socket.h | |||
@@ -189,7 +189,9 @@ struct ucred { | |||
189 | #define AF_BLUETOOTH 31 /* Bluetooth sockets */ | 189 | #define AF_BLUETOOTH 31 /* Bluetooth sockets */ |
190 | #define AF_IUCV 32 /* IUCV sockets */ | 190 | #define AF_IUCV 32 /* IUCV sockets */ |
191 | #define AF_RXRPC 33 /* RxRPC sockets */ | 191 | #define AF_RXRPC 33 /* RxRPC sockets */ |
192 | #define AF_MAX 34 /* For now.. */ | 192 | #define AF_ISDN 34 /* mISDN sockets */ |
193 | #define AF_PHONET 35 /* Phonet sockets */ | ||
194 | #define AF_MAX 36 /* For now.. */ | ||
193 | 195 | ||
194 | /* Protocol families, same as address families. */ | 196 | /* Protocol families, same as address families. */ |
195 | #define PF_UNSPEC AF_UNSPEC | 197 | #define PF_UNSPEC AF_UNSPEC |
@@ -225,6 +227,8 @@ struct ucred { | |||
225 | #define PF_BLUETOOTH AF_BLUETOOTH | 227 | #define PF_BLUETOOTH AF_BLUETOOTH |
226 | #define PF_IUCV AF_IUCV | 228 | #define PF_IUCV AF_IUCV |
227 | #define PF_RXRPC AF_RXRPC | 229 | #define PF_RXRPC AF_RXRPC |
230 | #define PF_ISDN AF_ISDN | ||
231 | #define PF_PHONET AF_PHONET | ||
228 | #define PF_MAX AF_MAX | 232 | #define PF_MAX AF_MAX |
229 | 233 | ||
230 | /* Maximum queue length specifiable by listen. */ | 234 | /* Maximum queue length specifiable by listen. */ |
@@ -293,6 +297,7 @@ struct ucred { | |||
293 | #define SOL_RXRPC 272 | 297 | #define SOL_RXRPC 272 |
294 | #define SOL_PPPOL2TP 273 | 298 | #define SOL_PPPOL2TP 273 |
295 | #define SOL_BLUETOOTH 274 | 299 | #define SOL_BLUETOOTH 274 |
300 | #define SOL_PNPIPE 275 | ||
296 | 301 | ||
297 | /* IPX options */ | 302 | /* IPX options */ |
298 | #define IPX_TYPE 1 | 303 | #define IPX_TYPE 1 |
@@ -306,10 +311,10 @@ extern int csum_partial_copy_fromiovecend(unsigned char *kdata, | |||
306 | int offset, | 311 | int offset, |
307 | unsigned int len, __wsum *csump); | 312 | unsigned int len, __wsum *csump); |
308 | 313 | ||
309 | extern int verify_iovec(struct msghdr *m, struct iovec *iov, char *address, int mode); | 314 | extern int verify_iovec(struct msghdr *m, struct iovec *iov, struct sockaddr *address, int mode); |
310 | extern int memcpy_toiovec(struct iovec *v, unsigned char *kdata, int len); | 315 | extern int memcpy_toiovec(struct iovec *v, unsigned char *kdata, int len); |
311 | extern int move_addr_to_user(void *kaddr, int klen, void __user *uaddr, int __user *ulen); | 316 | extern int move_addr_to_user(struct sockaddr *kaddr, int klen, void __user *uaddr, int __user *ulen); |
312 | extern int move_addr_to_kernel(void __user *uaddr, int ulen, void *kaddr); | 317 | 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); | 318 | extern int put_cmsg(struct msghdr*, int level, int type, int len, void *data); |
314 | 319 | ||
315 | #endif | 320 | #endif |
diff --git a/include/linux/sonet.h b/include/linux/sonet.h index 753680296e17..67ad11fcf88b 100644 --- a/include/linux/sonet.h +++ b/include/linux/sonet.h | |||
@@ -34,7 +34,7 @@ struct sonet_stats { | |||
34 | /* clear error insertion */ | 34 | /* clear error insertion */ |
35 | #define SONET_GETDIAG _IOR('a',ATMIOC_PHYTYP+4,int) | 35 | #define SONET_GETDIAG _IOR('a',ATMIOC_PHYTYP+4,int) |
36 | /* query error insertion */ | 36 | /* query error insertion */ |
37 | #define SONET_SETFRAMING _IO('a',ATMIOC_PHYTYP+5) | 37 | #define SONET_SETFRAMING _IOW('a',ATMIOC_PHYTYP+5,int) |
38 | /* set framing mode (SONET/SDH) */ | 38 | /* set framing mode (SONET/SDH) */ |
39 | #define SONET_GETFRAMING _IOR('a',ATMIOC_PHYTYP+6,int) | 39 | #define SONET_GETFRAMING _IOR('a',ATMIOC_PHYTYP+6,int) |
40 | /* get framing mode */ | 40 | /* get framing mode */ |
diff --git a/include/linux/spi/ads7846.h b/include/linux/spi/ads7846.h index daf744017a31..05eab2f11e63 100644 --- a/include/linux/spi/ads7846.h +++ b/include/linux/spi/ads7846.h | |||
@@ -43,6 +43,9 @@ struct ads7846_platform_data { | |||
43 | u16 debounce_tol; /* tolerance used for filtering */ | 43 | u16 debounce_tol; /* tolerance used for filtering */ |
44 | u16 debounce_rep; /* additional consecutive good readings | 44 | u16 debounce_rep; /* additional consecutive good readings |
45 | * required after the first two */ | 45 | * required after the first two */ |
46 | int gpio_pendown; /* the GPIO used to decide the pendown | ||
47 | * state if get_pendown_state == NULL | ||
48 | */ | ||
46 | int (*get_pendown_state)(void); | 49 | int (*get_pendown_state)(void); |
47 | int (*filter_init) (struct ads7846_platform_data *pdata, | 50 | int (*filter_init) (struct ads7846_platform_data *pdata, |
48 | void **filter_data); | 51 | void **filter_data); |
diff --git a/include/linux/spi/corgi_lcd.h b/include/linux/spi/corgi_lcd.h new file mode 100644 index 000000000000..6692b3418ccf --- /dev/null +++ b/include/linux/spi/corgi_lcd.h | |||
@@ -0,0 +1,20 @@ | |||
1 | #ifndef __LINUX_SPI_CORGI_LCD_H | ||
2 | #define __LINUX_SPI_CORGI_LCD_H | ||
3 | |||
4 | #define CORGI_LCD_MODE_QVGA 1 | ||
5 | #define CORGI_LCD_MODE_VGA 2 | ||
6 | |||
7 | struct corgi_lcd_platform_data { | ||
8 | int init_mode; | ||
9 | int max_intensity; | ||
10 | int default_intensity; | ||
11 | int limit_mask; | ||
12 | |||
13 | int gpio_backlight_on; /* -1 if n/a */ | ||
14 | int gpio_backlight_cont; /* -1 if n/a */ | ||
15 | |||
16 | void (*notify)(int intensity); | ||
17 | void (*kick_battery)(void); | ||
18 | }; | ||
19 | |||
20 | #endif /* __LINUX_SPI_CORGI_LCD_H */ | ||
diff --git a/include/linux/spi/ds1305.h b/include/linux/spi/ds1305.h new file mode 100644 index 000000000000..287ec830eab7 --- /dev/null +++ b/include/linux/spi/ds1305.h | |||
@@ -0,0 +1,35 @@ | |||
1 | #ifndef __LINUX_SPI_DS1305_H | ||
2 | #define __LINUX_SPI_DS1305_H | ||
3 | |||
4 | /* | ||
5 | * One-time configuration for ds1305 and ds1306 RTC chips. | ||
6 | * | ||
7 | * Put a pointer to this in spi_board_info.platform_data if you want to | ||
8 | * be sure that Linux (re)initializes this as needed ... after losing | ||
9 | * backup power, and potentially on the first boot. | ||
10 | */ | ||
11 | struct ds1305_platform_data { | ||
12 | |||
13 | /* Trickle charge configuration: it's OK to leave out the MAGIC | ||
14 | * bitmask; mask in either DS1 or DS2, and then one of 2K/4k/8K. | ||
15 | */ | ||
16 | #define DS1305_TRICKLE_MAGIC 0xa0 | ||
17 | #define DS1305_TRICKLE_DS2 0x08 /* two diodes */ | ||
18 | #define DS1305_TRICKLE_DS1 0x04 /* one diode */ | ||
19 | #define DS1305_TRICKLE_2K 0x01 /* 2 KOhm resistance */ | ||
20 | #define DS1305_TRICKLE_4K 0x02 /* 4 KOhm resistance */ | ||
21 | #define DS1305_TRICKLE_8K 0x03 /* 8 KOhm resistance */ | ||
22 | u8 trickle; | ||
23 | |||
24 | /* set only on ds1306 parts */ | ||
25 | bool is_ds1306; | ||
26 | |||
27 | /* ds1306 only: enable 1 Hz output */ | ||
28 | bool en_1hz; | ||
29 | |||
30 | /* REVISIT: the driver currently expects nINT0 to be wired | ||
31 | * as the alarm IRQ. ALM1 may also need to be set up ... | ||
32 | */ | ||
33 | }; | ||
34 | |||
35 | #endif /* __LINUX_SPI_DS1305_H */ | ||
diff --git a/include/linux/spi/max7301.h b/include/linux/spi/max7301.h new file mode 100644 index 000000000000..6dfd83f19b4b --- /dev/null +++ b/include/linux/spi/max7301.h | |||
@@ -0,0 +1,9 @@ | |||
1 | #ifndef LINUX_SPI_MAX7301_H | ||
2 | #define LINUX_SPI_MAX7301_H | ||
3 | |||
4 | struct max7301_platform_data { | ||
5 | /* number assigned to the first GPIO */ | ||
6 | unsigned base; | ||
7 | }; | ||
8 | |||
9 | #endif | ||
diff --git a/include/linux/spi/mcp23s08.h b/include/linux/spi/mcp23s08.h index 835ddf47d45c..22ef107d7704 100644 --- a/include/linux/spi/mcp23s08.h +++ b/include/linux/spi/mcp23s08.h | |||
@@ -1,18 +1,25 @@ | |||
1 | 1 | ||
2 | /* FIXME driver should be able to handle all four slaves that | 2 | /* FIXME driver should be able to handle IRQs... */ |
3 | * can be hooked up to each chipselect, as well as IRQs... | 3 | |
4 | */ | 4 | struct mcp23s08_chip_info { |
5 | bool is_present; /* true iff populated */ | ||
6 | u8 pullups; /* BIT(x) means enable pullup x */ | ||
7 | }; | ||
5 | 8 | ||
6 | struct mcp23s08_platform_data { | 9 | struct mcp23s08_platform_data { |
7 | /* four slaves can share one SPI chipselect */ | 10 | /* Four slaves (numbered 0..3) can share one SPI chipselect, and |
8 | u8 slave; | 11 | * will provide 8..32 GPIOs using 1..4 gpio_chip instances. |
12 | */ | ||
13 | struct mcp23s08_chip_info chip[4]; | ||
9 | 14 | ||
10 | /* number assigned to the first GPIO */ | 15 | /* "base" is the number of the first GPIO. Dynamic assignment is |
16 | * not currently supported, and even if there are gaps in chip | ||
17 | * addressing the GPIO numbers are sequential .. so for example | ||
18 | * if only slaves 0 and 3 are present, their GPIOs range from | ||
19 | * base to base+15. | ||
20 | */ | ||
11 | unsigned base; | 21 | unsigned base; |
12 | 22 | ||
13 | /* pins with pullups */ | ||
14 | u8 pullups; | ||
15 | |||
16 | void *context; /* param to setup/teardown */ | 23 | void *context; /* param to setup/teardown */ |
17 | 24 | ||
18 | int (*setup)(struct spi_device *spi, | 25 | int (*setup)(struct spi_device *spi, |
diff --git a/include/linux/spi/mmc_spi.h b/include/linux/spi/mmc_spi.h index d5ca78b93a3b..a3626aedaec9 100644 --- a/include/linux/spi/mmc_spi.h +++ b/include/linux/spi/mmc_spi.h | |||
@@ -23,6 +23,15 @@ struct mmc_spi_platform_data { | |||
23 | /* sense switch on sd cards */ | 23 | /* sense switch on sd cards */ |
24 | int (*get_ro)(struct device *); | 24 | int (*get_ro)(struct device *); |
25 | 25 | ||
26 | /* | ||
27 | * If board does not use CD interrupts, driver can optimize polling | ||
28 | * using this function. | ||
29 | */ | ||
30 | int (*get_cd)(struct device *); | ||
31 | |||
32 | /* Capabilities to pass into mmc core (e.g. MMC_CAP_NEEDS_POLL). */ | ||
33 | unsigned long caps; | ||
34 | |||
26 | /* how long to debounce card detect, in msecs */ | 35 | /* how long to debounce card detect, in msecs */ |
27 | u16 detect_delay; | 36 | u16 detect_delay; |
28 | 37 | ||
diff --git a/include/linux/spi/orion_spi.h b/include/linux/spi/orion_spi.h new file mode 100644 index 000000000000..b4d9fa6f797c --- /dev/null +++ b/include/linux/spi/orion_spi.h | |||
@@ -0,0 +1,17 @@ | |||
1 | /* | ||
2 | * orion_spi.h | ||
3 | * | ||
4 | * This file is licensed under the terms of the GNU General Public | ||
5 | * License version 2. This program is licensed "as is" without any | ||
6 | * warranty of any kind, whether express or implied. | ||
7 | */ | ||
8 | |||
9 | #ifndef __LINUX_SPI_ORION_SPI_H | ||
10 | #define __LINUX_SPI_ORION_SPI_H | ||
11 | |||
12 | struct orion_spi_info { | ||
13 | u32 tclk; /* no <linux/clk.h> support yet */ | ||
14 | }; | ||
15 | |||
16 | |||
17 | #endif | ||
diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h index 387e428f1cdf..4be01bb44377 100644 --- a/include/linux/spi/spi.h +++ b/include/linux/spi/spi.h | |||
@@ -82,7 +82,7 @@ struct spi_device { | |||
82 | int irq; | 82 | int irq; |
83 | void *controller_state; | 83 | void *controller_state; |
84 | void *controller_data; | 84 | void *controller_data; |
85 | const char *modalias; | 85 | char modalias[32]; |
86 | 86 | ||
87 | /* | 87 | /* |
88 | * likely need more hooks for more protocol options affecting how | 88 | * likely need more hooks for more protocol options affecting how |
@@ -733,7 +733,7 @@ struct spi_board_info { | |||
733 | * controller_data goes to spi_device.controller_data, | 733 | * controller_data goes to spi_device.controller_data, |
734 | * irq is copied too | 734 | * irq is copied too |
735 | */ | 735 | */ |
736 | char modalias[KOBJ_NAME_LEN]; | 736 | char modalias[32]; |
737 | const void *platform_data; | 737 | const void *platform_data; |
738 | void *controller_data; | 738 | void *controller_data; |
739 | int irq; | 739 | int irq; |
@@ -778,8 +778,20 @@ spi_register_board_info(struct spi_board_info const *info, unsigned n) | |||
778 | * use spi_new_device() to describe each device. You can also call | 778 | * use spi_new_device() to describe each device. You can also call |
779 | * spi_unregister_device() to start making that device vanish, but | 779 | * spi_unregister_device() to start making that device vanish, but |
780 | * normally that would be handled by spi_unregister_master(). | 780 | * normally that would be handled by spi_unregister_master(). |
781 | * | ||
782 | * You can also use spi_alloc_device() and spi_add_device() to use a two | ||
783 | * stage registration sequence for each spi_device. This gives the caller | ||
784 | * some more control over the spi_device structure before it is registered, | ||
785 | * but requires that caller to initialize fields that would otherwise | ||
786 | * be defined using the board info. | ||
781 | */ | 787 | */ |
782 | extern struct spi_device * | 788 | extern struct spi_device * |
789 | spi_alloc_device(struct spi_master *master); | ||
790 | |||
791 | extern int | ||
792 | spi_add_device(struct spi_device *spi); | ||
793 | |||
794 | extern struct spi_device * | ||
783 | spi_new_device(struct spi_master *, struct spi_board_info *); | 795 | spi_new_device(struct spi_master *, struct spi_board_info *); |
784 | 796 | ||
785 | static inline void | 797 | static inline void |
diff --git a/include/linux/spinlock.h b/include/linux/spinlock.h index d311a090fae7..e0c0fccced46 100644 --- a/include/linux/spinlock.h +++ b/include/linux/spinlock.h | |||
@@ -46,6 +46,7 @@ | |||
46 | * linux/spinlock.h: builds the final spin_*() APIs. | 46 | * linux/spinlock.h: builds the final spin_*() APIs. |
47 | */ | 47 | */ |
48 | 48 | ||
49 | #include <linux/typecheck.h> | ||
49 | #include <linux/preempt.h> | 50 | #include <linux/preempt.h> |
50 | #include <linux/linkage.h> | 51 | #include <linux/linkage.h> |
51 | #include <linux/compiler.h> | 52 | #include <linux/compiler.h> |
@@ -182,8 +183,14 @@ do { \ | |||
182 | 183 | ||
183 | #ifdef CONFIG_DEBUG_LOCK_ALLOC | 184 | #ifdef CONFIG_DEBUG_LOCK_ALLOC |
184 | # define spin_lock_nested(lock, subclass) _spin_lock_nested(lock, subclass) | 185 | # define spin_lock_nested(lock, subclass) _spin_lock_nested(lock, subclass) |
186 | # define spin_lock_nest_lock(lock, nest_lock) \ | ||
187 | do { \ | ||
188 | typecheck(struct lockdep_map *, &(nest_lock)->dep_map);\ | ||
189 | _spin_lock_nest_lock(lock, &(nest_lock)->dep_map); \ | ||
190 | } while (0) | ||
185 | #else | 191 | #else |
186 | # define spin_lock_nested(lock, subclass) _spin_lock(lock) | 192 | # define spin_lock_nested(lock, subclass) _spin_lock(lock) |
193 | # define spin_lock_nest_lock(lock, nest_lock) _spin_lock(lock) | ||
187 | #endif | 194 | #endif |
188 | 195 | ||
189 | #define write_lock(lock) _write_lock(lock) | 196 | #define write_lock(lock) _write_lock(lock) |
@@ -191,23 +198,53 @@ do { \ | |||
191 | 198 | ||
192 | #if defined(CONFIG_SMP) || defined(CONFIG_DEBUG_SPINLOCK) | 199 | #if defined(CONFIG_SMP) || defined(CONFIG_DEBUG_SPINLOCK) |
193 | 200 | ||
194 | #define spin_lock_irqsave(lock, flags) flags = _spin_lock_irqsave(lock) | 201 | #define spin_lock_irqsave(lock, flags) \ |
195 | #define read_lock_irqsave(lock, flags) flags = _read_lock_irqsave(lock) | 202 | do { \ |
196 | #define write_lock_irqsave(lock, flags) flags = _write_lock_irqsave(lock) | 203 | typecheck(unsigned long, flags); \ |
204 | flags = _spin_lock_irqsave(lock); \ | ||
205 | } while (0) | ||
206 | #define read_lock_irqsave(lock, flags) \ | ||
207 | do { \ | ||
208 | typecheck(unsigned long, flags); \ | ||
209 | flags = _read_lock_irqsave(lock); \ | ||
210 | } while (0) | ||
211 | #define write_lock_irqsave(lock, flags) \ | ||
212 | do { \ | ||
213 | typecheck(unsigned long, flags); \ | ||
214 | flags = _write_lock_irqsave(lock); \ | ||
215 | } while (0) | ||
197 | 216 | ||
198 | #ifdef CONFIG_DEBUG_LOCK_ALLOC | 217 | #ifdef CONFIG_DEBUG_LOCK_ALLOC |
199 | #define spin_lock_irqsave_nested(lock, flags, subclass) \ | 218 | #define spin_lock_irqsave_nested(lock, flags, subclass) \ |
200 | flags = _spin_lock_irqsave_nested(lock, subclass) | 219 | do { \ |
220 | typecheck(unsigned long, flags); \ | ||
221 | flags = _spin_lock_irqsave_nested(lock, subclass); \ | ||
222 | } while (0) | ||
201 | #else | 223 | #else |
202 | #define spin_lock_irqsave_nested(lock, flags, subclass) \ | 224 | #define spin_lock_irqsave_nested(lock, flags, subclass) \ |
203 | flags = _spin_lock_irqsave(lock) | 225 | do { \ |
226 | typecheck(unsigned long, flags); \ | ||
227 | flags = _spin_lock_irqsave(lock); \ | ||
228 | } while (0) | ||
204 | #endif | 229 | #endif |
205 | 230 | ||
206 | #else | 231 | #else |
207 | 232 | ||
208 | #define spin_lock_irqsave(lock, flags) _spin_lock_irqsave(lock, flags) | 233 | #define spin_lock_irqsave(lock, flags) \ |
209 | #define read_lock_irqsave(lock, flags) _read_lock_irqsave(lock, flags) | 234 | do { \ |
210 | #define write_lock_irqsave(lock, flags) _write_lock_irqsave(lock, flags) | 235 | typecheck(unsigned long, flags); \ |
236 | _spin_lock_irqsave(lock, flags); \ | ||
237 | } while (0) | ||
238 | #define read_lock_irqsave(lock, flags) \ | ||
239 | do { \ | ||
240 | typecheck(unsigned long, flags); \ | ||
241 | _read_lock_irqsave(lock, flags); \ | ||
242 | } while (0) | ||
243 | #define write_lock_irqsave(lock, flags) \ | ||
244 | do { \ | ||
245 | typecheck(unsigned long, flags); \ | ||
246 | _write_lock_irqsave(lock, flags); \ | ||
247 | } while (0) | ||
211 | #define spin_lock_irqsave_nested(lock, flags, subclass) \ | 248 | #define spin_lock_irqsave_nested(lock, flags, subclass) \ |
212 | spin_lock_irqsave(lock, flags) | 249 | spin_lock_irqsave(lock, flags) |
213 | 250 | ||
@@ -260,16 +297,25 @@ do { \ | |||
260 | } while (0) | 297 | } while (0) |
261 | #endif | 298 | #endif |
262 | 299 | ||
263 | #define spin_unlock_irqrestore(lock, flags) \ | 300 | #define spin_unlock_irqrestore(lock, flags) \ |
264 | _spin_unlock_irqrestore(lock, flags) | 301 | do { \ |
302 | typecheck(unsigned long, flags); \ | ||
303 | _spin_unlock_irqrestore(lock, flags); \ | ||
304 | } while (0) | ||
265 | #define spin_unlock_bh(lock) _spin_unlock_bh(lock) | 305 | #define spin_unlock_bh(lock) _spin_unlock_bh(lock) |
266 | 306 | ||
267 | #define read_unlock_irqrestore(lock, flags) \ | 307 | #define read_unlock_irqrestore(lock, flags) \ |
268 | _read_unlock_irqrestore(lock, flags) | 308 | do { \ |
309 | typecheck(unsigned long, flags); \ | ||
310 | _read_unlock_irqrestore(lock, flags); \ | ||
311 | } while (0) | ||
269 | #define read_unlock_bh(lock) _read_unlock_bh(lock) | 312 | #define read_unlock_bh(lock) _read_unlock_bh(lock) |
270 | 313 | ||
271 | #define write_unlock_irqrestore(lock, flags) \ | 314 | #define write_unlock_irqrestore(lock, flags) \ |
272 | _write_unlock_irqrestore(lock, flags) | 315 | do { \ |
316 | typecheck(unsigned long, flags); \ | ||
317 | _write_unlock_irqrestore(lock, flags); \ | ||
318 | } while (0) | ||
273 | #define write_unlock_bh(lock) _write_unlock_bh(lock) | 319 | #define write_unlock_bh(lock) _write_unlock_bh(lock) |
274 | 320 | ||
275 | #define spin_trylock_bh(lock) __cond_lock(lock, _spin_trylock_bh(lock)) | 321 | #define spin_trylock_bh(lock) __cond_lock(lock, _spin_trylock_bh(lock)) |
diff --git a/include/linux/spinlock_api_smp.h b/include/linux/spinlock_api_smp.h index 8a2307ce7296..d79845d034b5 100644 --- a/include/linux/spinlock_api_smp.h +++ b/include/linux/spinlock_api_smp.h | |||
@@ -22,6 +22,8 @@ int in_lock_functions(unsigned long addr); | |||
22 | void __lockfunc _spin_lock(spinlock_t *lock) __acquires(lock); | 22 | void __lockfunc _spin_lock(spinlock_t *lock) __acquires(lock); |
23 | void __lockfunc _spin_lock_nested(spinlock_t *lock, int subclass) | 23 | void __lockfunc _spin_lock_nested(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) | ||
26 | __acquires(lock); | ||
25 | void __lockfunc _read_lock(rwlock_t *lock) __acquires(lock); | 27 | void __lockfunc _read_lock(rwlock_t *lock) __acquires(lock); |
26 | void __lockfunc _write_lock(rwlock_t *lock) __acquires(lock); | 28 | void __lockfunc _write_lock(rwlock_t *lock) __acquires(lock); |
27 | void __lockfunc _spin_lock_bh(spinlock_t *lock) __acquires(lock); | 29 | void __lockfunc _spin_lock_bh(spinlock_t *lock) __acquires(lock); |
diff --git a/include/linux/ssb/ssb.h b/include/linux/ssb/ssb.h index 50dfd0dc4093..e530026eedf7 100644 --- a/include/linux/ssb/ssb.h +++ b/include/linux/ssb/ssb.h | |||
@@ -7,6 +7,7 @@ | |||
7 | #include <linux/spinlock.h> | 7 | #include <linux/spinlock.h> |
8 | #include <linux/pci.h> | 8 | #include <linux/pci.h> |
9 | #include <linux/mod_devicetable.h> | 9 | #include <linux/mod_devicetable.h> |
10 | #include <linux/dma-mapping.h> | ||
10 | 11 | ||
11 | #include <linux/ssb/ssb_regs.h> | 12 | #include <linux/ssb/ssb_regs.h> |
12 | 13 | ||
@@ -137,9 +138,6 @@ struct ssb_device { | |||
137 | const struct ssb_bus_ops *ops; | 138 | const struct ssb_bus_ops *ops; |
138 | 139 | ||
139 | struct device *dev; | 140 | struct device *dev; |
140 | /* Pointer to the device that has to be used for | ||
141 | * any DMA related operation. */ | ||
142 | struct device *dma_dev; | ||
143 | 141 | ||
144 | struct ssb_bus *bus; | 142 | struct ssb_bus *bus; |
145 | struct ssb_device_id id; | 143 | struct ssb_device_id id; |
@@ -399,13 +397,151 @@ static inline void ssb_block_write(struct ssb_device *dev, const void *buffer, | |||
399 | #endif /* CONFIG_SSB_BLOCKIO */ | 397 | #endif /* CONFIG_SSB_BLOCKIO */ |
400 | 398 | ||
401 | 399 | ||
400 | /* The SSB DMA API. Use this API for any DMA operation on the device. | ||
401 | * This API basically is a wrapper that calls the correct DMA API for | ||
402 | * the host device type the SSB device is attached to. */ | ||
403 | |||
402 | /* Translation (routing) bits that need to be ORed to DMA | 404 | /* Translation (routing) bits that need to be ORed to DMA |
403 | * addresses before they are given to a device. */ | 405 | * addresses before they are given to a device. */ |
404 | extern u32 ssb_dma_translation(struct ssb_device *dev); | 406 | extern u32 ssb_dma_translation(struct ssb_device *dev); |
405 | #define SSB_DMA_TRANSLATION_MASK 0xC0000000 | 407 | #define SSB_DMA_TRANSLATION_MASK 0xC0000000 |
406 | #define SSB_DMA_TRANSLATION_SHIFT 30 | 408 | #define SSB_DMA_TRANSLATION_SHIFT 30 |
407 | 409 | ||
408 | extern int ssb_dma_set_mask(struct ssb_device *ssb_dev, u64 mask); | 410 | extern int ssb_dma_set_mask(struct ssb_device *dev, u64 mask); |
411 | |||
412 | extern void * ssb_dma_alloc_consistent(struct ssb_device *dev, size_t size, | ||
413 | dma_addr_t *dma_handle, gfp_t gfp_flags); | ||
414 | extern void ssb_dma_free_consistent(struct ssb_device *dev, size_t size, | ||
415 | void *vaddr, dma_addr_t dma_handle, | ||
416 | gfp_t gfp_flags); | ||
417 | |||
418 | static inline void __cold __ssb_dma_not_implemented(struct ssb_device *dev) | ||
419 | { | ||
420 | #ifdef CONFIG_SSB_DEBUG | ||
421 | printk(KERN_ERR "SSB: BUG! Calling DMA API for " | ||
422 | "unsupported bustype %d\n", dev->bus->bustype); | ||
423 | #endif /* DEBUG */ | ||
424 | } | ||
425 | |||
426 | static inline int ssb_dma_mapping_error(struct ssb_device *dev, dma_addr_t addr) | ||
427 | { | ||
428 | switch (dev->bus->bustype) { | ||
429 | case SSB_BUSTYPE_PCI: | ||
430 | return pci_dma_mapping_error(dev->bus->host_pci, addr); | ||
431 | case SSB_BUSTYPE_SSB: | ||
432 | return dma_mapping_error(dev->dev, addr); | ||
433 | default: | ||
434 | __ssb_dma_not_implemented(dev); | ||
435 | } | ||
436 | return -ENOSYS; | ||
437 | } | ||
438 | |||
439 | static inline dma_addr_t ssb_dma_map_single(struct ssb_device *dev, void *p, | ||
440 | size_t size, enum dma_data_direction dir) | ||
441 | { | ||
442 | switch (dev->bus->bustype) { | ||
443 | case SSB_BUSTYPE_PCI: | ||
444 | return pci_map_single(dev->bus->host_pci, p, size, dir); | ||
445 | case SSB_BUSTYPE_SSB: | ||
446 | return dma_map_single(dev->dev, p, size, dir); | ||
447 | default: | ||
448 | __ssb_dma_not_implemented(dev); | ||
449 | } | ||
450 | return 0; | ||
451 | } | ||
452 | |||
453 | static inline void ssb_dma_unmap_single(struct ssb_device *dev, dma_addr_t dma_addr, | ||
454 | size_t size, enum dma_data_direction dir) | ||
455 | { | ||
456 | switch (dev->bus->bustype) { | ||
457 | case SSB_BUSTYPE_PCI: | ||
458 | pci_unmap_single(dev->bus->host_pci, dma_addr, size, dir); | ||
459 | return; | ||
460 | case SSB_BUSTYPE_SSB: | ||
461 | dma_unmap_single(dev->dev, dma_addr, size, dir); | ||
462 | return; | ||
463 | default: | ||
464 | __ssb_dma_not_implemented(dev); | ||
465 | } | ||
466 | } | ||
467 | |||
468 | static inline void ssb_dma_sync_single_for_cpu(struct ssb_device *dev, | ||
469 | dma_addr_t dma_addr, | ||
470 | size_t size, | ||
471 | enum dma_data_direction dir) | ||
472 | { | ||
473 | switch (dev->bus->bustype) { | ||
474 | case SSB_BUSTYPE_PCI: | ||
475 | pci_dma_sync_single_for_cpu(dev->bus->host_pci, dma_addr, | ||
476 | size, dir); | ||
477 | return; | ||
478 | case SSB_BUSTYPE_SSB: | ||
479 | dma_sync_single_for_cpu(dev->dev, dma_addr, size, dir); | ||
480 | return; | ||
481 | default: | ||
482 | __ssb_dma_not_implemented(dev); | ||
483 | } | ||
484 | } | ||
485 | |||
486 | static inline void ssb_dma_sync_single_for_device(struct ssb_device *dev, | ||
487 | dma_addr_t dma_addr, | ||
488 | size_t size, | ||
489 | enum dma_data_direction dir) | ||
490 | { | ||
491 | switch (dev->bus->bustype) { | ||
492 | case SSB_BUSTYPE_PCI: | ||
493 | pci_dma_sync_single_for_device(dev->bus->host_pci, dma_addr, | ||
494 | size, dir); | ||
495 | return; | ||
496 | case SSB_BUSTYPE_SSB: | ||
497 | dma_sync_single_for_device(dev->dev, dma_addr, size, dir); | ||
498 | return; | ||
499 | default: | ||
500 | __ssb_dma_not_implemented(dev); | ||
501 | } | ||
502 | } | ||
503 | |||
504 | static inline void ssb_dma_sync_single_range_for_cpu(struct ssb_device *dev, | ||
505 | dma_addr_t dma_addr, | ||
506 | unsigned long offset, | ||
507 | size_t size, | ||
508 | enum dma_data_direction dir) | ||
509 | { | ||
510 | switch (dev->bus->bustype) { | ||
511 | case SSB_BUSTYPE_PCI: | ||
512 | /* Just sync everything. That's all the PCI API can do. */ | ||
513 | pci_dma_sync_single_for_cpu(dev->bus->host_pci, dma_addr, | ||
514 | offset + size, dir); | ||
515 | return; | ||
516 | case SSB_BUSTYPE_SSB: | ||
517 | dma_sync_single_range_for_cpu(dev->dev, dma_addr, offset, | ||
518 | size, dir); | ||
519 | return; | ||
520 | default: | ||
521 | __ssb_dma_not_implemented(dev); | ||
522 | } | ||
523 | } | ||
524 | |||
525 | static inline void ssb_dma_sync_single_range_for_device(struct ssb_device *dev, | ||
526 | dma_addr_t dma_addr, | ||
527 | unsigned long offset, | ||
528 | size_t size, | ||
529 | enum dma_data_direction dir) | ||
530 | { | ||
531 | switch (dev->bus->bustype) { | ||
532 | case SSB_BUSTYPE_PCI: | ||
533 | /* Just sync everything. That's all the PCI API can do. */ | ||
534 | pci_dma_sync_single_for_device(dev->bus->host_pci, dma_addr, | ||
535 | offset + size, dir); | ||
536 | return; | ||
537 | case SSB_BUSTYPE_SSB: | ||
538 | dma_sync_single_range_for_device(dev->dev, dma_addr, offset, | ||
539 | size, dir); | ||
540 | return; | ||
541 | default: | ||
542 | __ssb_dma_not_implemented(dev); | ||
543 | } | ||
544 | } | ||
409 | 545 | ||
410 | 546 | ||
411 | #ifdef CONFIG_SSB_PCIHOST | 547 | #ifdef CONFIG_SSB_PCIHOST |
diff --git a/include/linux/ssb/ssb_regs.h b/include/linux/ssb/ssb_regs.h index ebad0bac9801..99a0f991e850 100644 --- a/include/linux/ssb/ssb_regs.h +++ b/include/linux/ssb/ssb_regs.h | |||
@@ -245,8 +245,6 @@ | |||
245 | 245 | ||
246 | /* SPROM Revision 3 (inherits most data from rev 2) */ | 246 | /* SPROM Revision 3 (inherits most data from rev 2) */ |
247 | #define SSB_SPROM3_IL0MAC 0x104A /* 6 bytes MAC address for 802.11b/g */ | 247 | #define SSB_SPROM3_IL0MAC 0x104A /* 6 bytes MAC address for 802.11b/g */ |
248 | #define SSB_SPROM3_ET0MAC 0x1050 /* 6 bytes MAC address for Ethernet ?? */ | ||
249 | #define SSB_SPROM3_ET1MAC 0x1050 /* 6 bytes MAC address for 802.11a ?? */ | ||
250 | #define SSB_SPROM3_OFDMAPO 0x102C /* A-PHY OFDM Mid Power Offset (4 bytes, BigEndian) */ | 248 | #define SSB_SPROM3_OFDMAPO 0x102C /* A-PHY OFDM Mid Power Offset (4 bytes, BigEndian) */ |
251 | #define SSB_SPROM3_OFDMALPO 0x1030 /* A-PHY OFDM Low Power Offset (4 bytes, BigEndian) */ | 249 | #define SSB_SPROM3_OFDMALPO 0x1030 /* A-PHY OFDM Low Power Offset (4 bytes, BigEndian) */ |
252 | #define SSB_SPROM3_OFDMAHPO 0x1034 /* A-PHY OFDM High Power Offset (4 bytes, BigEndian) */ | 250 | #define SSB_SPROM3_OFDMAHPO 0x1034 /* A-PHY OFDM High Power Offset (4 bytes, BigEndian) */ |
@@ -267,8 +265,6 @@ | |||
267 | 265 | ||
268 | /* SPROM Revision 4 */ | 266 | /* SPROM Revision 4 */ |
269 | #define SSB_SPROM4_IL0MAC 0x104C /* 6 byte MAC address for a/b/g/n */ | 267 | #define SSB_SPROM4_IL0MAC 0x104C /* 6 byte MAC address for a/b/g/n */ |
270 | #define SSB_SPROM4_ET0MAC 0x1018 /* 6 bytes MAC address for Ethernet ?? */ | ||
271 | #define SSB_SPROM4_ET1MAC 0x1018 /* 6 bytes MAC address for 802.11a ?? */ | ||
272 | #define SSB_SPROM4_ETHPHY 0x105A /* Ethernet PHY settings ?? */ | 268 | #define SSB_SPROM4_ETHPHY 0x105A /* Ethernet PHY settings ?? */ |
273 | #define SSB_SPROM4_ETHPHY_ET0A 0x001F /* MII Address for enet0 */ | 269 | #define SSB_SPROM4_ETHPHY_ET0A 0x001F /* MII Address for enet0 */ |
274 | #define SSB_SPROM4_ETHPHY_ET1A 0x03E0 /* MII Address for enet1 */ | 270 | #define SSB_SPROM4_ETHPHY_ET1A 0x03E0 /* MII Address for enet1 */ |
@@ -316,6 +312,21 @@ | |||
316 | #define SSB_SPROM4_PA1B1 0x1090 | 312 | #define SSB_SPROM4_PA1B1 0x1090 |
317 | #define SSB_SPROM4_PA1B2 0x1092 | 313 | #define SSB_SPROM4_PA1B2 0x1092 |
318 | 314 | ||
315 | /* SPROM Revision 5 (inherits most data from rev 4) */ | ||
316 | #define SSB_SPROM5_BFLLO 0x104A /* Boardflags (low 16 bits) */ | ||
317 | #define SSB_SPROM5_BFLHI 0x104C /* Board Flags Hi */ | ||
318 | #define SSB_SPROM5_IL0MAC 0x1052 /* 6 byte MAC address for a/b/g/n */ | ||
319 | #define SSB_SPROM5_CCODE 0x1044 /* Country Code (2 bytes) */ | ||
320 | #define SSB_SPROM5_GPIOA 0x1076 /* Gen. Purpose IO # 0 and 1 */ | ||
321 | #define SSB_SPROM5_GPIOA_P0 0x00FF /* Pin 0 */ | ||
322 | #define SSB_SPROM5_GPIOA_P1 0xFF00 /* Pin 1 */ | ||
323 | #define SSB_SPROM5_GPIOA_P1_SHIFT 8 | ||
324 | #define SSB_SPROM5_GPIOB 0x1078 /* Gen. Purpose IO # 2 and 3 */ | ||
325 | #define SSB_SPROM5_GPIOB_P2 0x00FF /* Pin 2 */ | ||
326 | #define SSB_SPROM5_GPIOB_P3 0xFF00 /* Pin 3 */ | ||
327 | #define SSB_SPROM5_GPIOB_P3_SHIFT 8 | ||
328 | |||
329 | |||
319 | /* Values for SSB_SPROM1_BINF_CCODE */ | 330 | /* Values for SSB_SPROM1_BINF_CCODE */ |
320 | enum { | 331 | enum { |
321 | SSB_SPROM1CCODE_WORLD = 0, | 332 | SSB_SPROM1CCODE_WORLD = 0, |
diff --git a/include/linux/stacktrace.h b/include/linux/stacktrace.h index 5da9794b2d78..b106fd8e0d5c 100644 --- a/include/linux/stacktrace.h +++ b/include/linux/stacktrace.h | |||
@@ -1,6 +1,8 @@ | |||
1 | #ifndef __LINUX_STACKTRACE_H | 1 | #ifndef __LINUX_STACKTRACE_H |
2 | #define __LINUX_STACKTRACE_H | 2 | #define __LINUX_STACKTRACE_H |
3 | 3 | ||
4 | struct task_struct; | ||
5 | |||
4 | #ifdef CONFIG_STACKTRACE | 6 | #ifdef CONFIG_STACKTRACE |
5 | struct stack_trace { | 7 | struct stack_trace { |
6 | unsigned int nr_entries, max_entries; | 8 | unsigned int nr_entries, max_entries; |
diff --git a/include/linux/stallion.h b/include/linux/stallion.h index 0424d75a5aaa..336af33c6ea4 100644 --- a/include/linux/stallion.h +++ b/include/linux/stallion.h | |||
@@ -69,6 +69,7 @@ struct stlrq { | |||
69 | */ | 69 | */ |
70 | struct stlport { | 70 | struct stlport { |
71 | unsigned long magic; | 71 | unsigned long magic; |
72 | struct tty_port port; | ||
72 | unsigned int portnr; | 73 | unsigned int portnr; |
73 | unsigned int panelnr; | 74 | unsigned int panelnr; |
74 | unsigned int brdnr; | 75 | unsigned int brdnr; |
@@ -76,12 +77,10 @@ struct stlport { | |||
76 | int uartaddr; | 77 | int uartaddr; |
77 | unsigned int pagenr; | 78 | unsigned int pagenr; |
78 | unsigned long istate; | 79 | unsigned long istate; |
79 | int flags; | ||
80 | int baud_base; | 80 | int baud_base; |
81 | int custom_divisor; | 81 | int custom_divisor; |
82 | int close_delay; | 82 | int close_delay; |
83 | int closing_wait; | 83 | int closing_wait; |
84 | int refcount; | ||
85 | int openwaitcnt; | 84 | int openwaitcnt; |
86 | int brklen; | 85 | int brklen; |
87 | unsigned int sigs; | 86 | unsigned int sigs; |
@@ -92,9 +91,6 @@ struct stlport { | |||
92 | unsigned long clk; | 91 | unsigned long clk; |
93 | unsigned long hwid; | 92 | unsigned long hwid; |
94 | void *uartp; | 93 | void *uartp; |
95 | struct tty_struct *tty; | ||
96 | wait_queue_head_t open_wait; | ||
97 | wait_queue_head_t close_wait; | ||
98 | comstats_t stats; | 94 | comstats_t stats; |
99 | struct stlrq tx; | 95 | struct stlrq tx; |
100 | }; | 96 | }; |
diff --git a/include/linux/stop_machine.h b/include/linux/stop_machine.h index 5bfc553bdb21..faf1519b5adc 100644 --- a/include/linux/stop_machine.h +++ b/include/linux/stop_machine.h | |||
@@ -3,43 +3,42 @@ | |||
3 | /* "Bogolock": stop the entire machine, disable interrupts. This is a | 3 | /* "Bogolock": stop the entire machine, disable interrupts. This is a |
4 | very heavy lock, which is equivalent to grabbing every spinlock | 4 | very heavy lock, which is equivalent to grabbing every spinlock |
5 | (and more). So the "read" side to such a lock is anything which | 5 | (and more). So the "read" side to such a lock is anything which |
6 | diables preeempt. */ | 6 | disables preeempt. */ |
7 | #include <linux/cpu.h> | 7 | #include <linux/cpu.h> |
8 | #include <linux/cpumask.h> | ||
8 | #include <asm/system.h> | 9 | #include <asm/system.h> |
9 | 10 | ||
10 | #if defined(CONFIG_STOP_MACHINE) && defined(CONFIG_SMP) | 11 | #if defined(CONFIG_STOP_MACHINE) && defined(CONFIG_SMP) |
12 | |||
11 | /** | 13 | /** |
12 | * stop_machine_run: freeze the machine on all CPUs and run this function | 14 | * stop_machine: freeze the machine on all CPUs and run this function |
13 | * @fn: the function to run | 15 | * @fn: the function to run |
14 | * @data: the data ptr for the @fn() | 16 | * @data: the data ptr for the @fn() |
15 | * @cpu: the cpu to run @fn() on (or any, if @cpu == NR_CPUS. | 17 | * @cpus: the cpus to run the @fn() on (NULL = any online cpu) |
16 | * | 18 | * |
17 | * Description: This causes a thread to be scheduled on every other cpu, | 19 | * Description: This causes a thread to be scheduled on every cpu, |
18 | * each of which disables interrupts, and finally interrupts are disabled | 20 | * each of which disables interrupts. The result is that noone is |
19 | * on the current CPU. The result is that noone is holding a spinlock | 21 | * holding a spinlock or inside any other preempt-disabled region when |
20 | * or inside any other preempt-disabled region when @fn() runs. | 22 | * @fn() runs. |
21 | * | 23 | * |
22 | * This can be thought of as a very heavy write lock, equivalent to | 24 | * This can be thought of as a very heavy write lock, equivalent to |
23 | * grabbing every spinlock in the kernel. */ | 25 | * grabbing every spinlock in the kernel. */ |
24 | int stop_machine_run(int (*fn)(void *), void *data, unsigned int cpu); | 26 | int stop_machine(int (*fn)(void *), void *data, const cpumask_t *cpus); |
25 | 27 | ||
26 | /** | 28 | /** |
27 | * __stop_machine_run: freeze the machine on all CPUs and run this function | 29 | * __stop_machine: freeze the machine on all CPUs and run this function |
28 | * @fn: the function to run | 30 | * @fn: the function to run |
29 | * @data: the data ptr for the @fn | 31 | * @data: the data ptr for the @fn |
30 | * @cpu: the cpu to run @fn on (or any, if @cpu == NR_CPUS. | 32 | * @cpus: the cpus to run the @fn() on (NULL = any online cpu) |
31 | * | 33 | * |
32 | * Description: This is a special version of the above, which returns the | 34 | * Description: This is a special version of the above, which assumes cpus |
33 | * thread which has run @fn(): kthread_stop will return the return value | 35 | * won't come or go while it's being called. Used by hotplug cpu. |
34 | * of @fn(). Used by hotplug cpu. | ||
35 | */ | 36 | */ |
36 | struct task_struct *__stop_machine_run(int (*fn)(void *), void *data, | 37 | int __stop_machine(int (*fn)(void *), void *data, const cpumask_t *cpus); |
37 | unsigned int cpu); | ||
38 | |||
39 | #else | 38 | #else |
40 | 39 | ||
41 | static inline int stop_machine_run(int (*fn)(void *), void *data, | 40 | static inline int stop_machine(int (*fn)(void *), void *data, |
42 | unsigned int cpu) | 41 | const cpumask_t *cpus) |
43 | { | 42 | { |
44 | int ret; | 43 | int ret; |
45 | local_irq_disable(); | 44 | local_irq_disable(); |
diff --git a/include/linux/string.h b/include/linux/string.h index efdc44593b52..810d80df0a1d 100644 --- a/include/linux/string.h +++ b/include/linux/string.h | |||
@@ -111,5 +111,8 @@ extern void argv_free(char **argv); | |||
111 | 111 | ||
112 | extern bool sysfs_streq(const char *s1, const char *s2); | 112 | extern bool sysfs_streq(const char *s1, const char *s2); |
113 | 113 | ||
114 | extern ssize_t memory_read_from_buffer(void *to, size_t count, loff_t *ppos, | ||
115 | const void *from, size_t available); | ||
116 | |||
114 | #endif | 117 | #endif |
115 | #endif /* _LINUX_STRING_H_ */ | 118 | #endif /* _LINUX_STRING_H_ */ |
diff --git a/include/linux/string_helpers.h b/include/linux/string_helpers.h new file mode 100644 index 000000000000..a3eb2f65b656 --- /dev/null +++ b/include/linux/string_helpers.h | |||
@@ -0,0 +1,16 @@ | |||
1 | #ifndef _LINUX_STRING_HELPERS_H_ | ||
2 | #define _LINUX_STRING_HELPERS_H_ | ||
3 | |||
4 | #include <linux/types.h> | ||
5 | |||
6 | /* Descriptions of the types of units to | ||
7 | * print in */ | ||
8 | enum string_size_units { | ||
9 | STRING_UNITS_10, /* use powers of 10^3 (standard SI) */ | ||
10 | STRING_UNITS_2, /* use binary powers of 2^10 */ | ||
11 | }; | ||
12 | |||
13 | int string_get_size(u64 size, enum string_size_units units, | ||
14 | char *buf, int len); | ||
15 | |||
16 | #endif | ||
diff --git a/include/linux/sunrpc/auth_gss.h b/include/linux/sunrpc/auth_gss.h index fec6899bf355..d48d4e605f74 100644 --- a/include/linux/sunrpc/auth_gss.h +++ b/include/linux/sunrpc/auth_gss.h | |||
@@ -7,8 +7,6 @@ | |||
7 | * Andy Adamson <andros@umich.edu> | 7 | * Andy Adamson <andros@umich.edu> |
8 | * Bruce Fields <bfields@umich.edu> | 8 | * Bruce Fields <bfields@umich.edu> |
9 | * Copyright (c) 2000 The Regents of the University of Michigan | 9 | * Copyright (c) 2000 The Regents of the University of Michigan |
10 | * | ||
11 | * $Id$ | ||
12 | */ | 10 | */ |
13 | 11 | ||
14 | #ifndef _LINUX_SUNRPC_AUTH_GSS_H | 12 | #ifndef _LINUX_SUNRPC_AUTH_GSS_H |
diff --git a/include/linux/sunrpc/clnt.h b/include/linux/sunrpc/clnt.h index 6fff7f82ef12..6f0ee1b84a4f 100644 --- a/include/linux/sunrpc/clnt.h +++ b/include/linux/sunrpc/clnt.h | |||
@@ -42,7 +42,8 @@ struct rpc_clnt { | |||
42 | 42 | ||
43 | unsigned int cl_softrtry : 1,/* soft timeouts */ | 43 | unsigned int cl_softrtry : 1,/* soft timeouts */ |
44 | cl_discrtry : 1,/* disconnect before retry */ | 44 | cl_discrtry : 1,/* disconnect before retry */ |
45 | cl_autobind : 1;/* use getport() */ | 45 | cl_autobind : 1,/* use getport() */ |
46 | cl_chatty : 1;/* be verbose */ | ||
46 | 47 | ||
47 | struct rpc_rtt * cl_rtt; /* RTO estimator data */ | 48 | struct rpc_rtt * cl_rtt; /* RTO estimator data */ |
48 | const struct rpc_timeout *cl_timeout; /* Timeout strategy */ | 49 | const struct rpc_timeout *cl_timeout; /* Timeout strategy */ |
@@ -103,6 +104,7 @@ struct rpc_create_args { | |||
103 | const struct rpc_timeout *timeout; | 104 | const struct rpc_timeout *timeout; |
104 | char *servername; | 105 | char *servername; |
105 | struct rpc_program *program; | 106 | struct rpc_program *program; |
107 | u32 prognumber; /* overrides program->number */ | ||
106 | u32 version; | 108 | u32 version; |
107 | rpc_authflavor_t authflavor; | 109 | rpc_authflavor_t authflavor; |
108 | unsigned long flags; | 110 | unsigned long flags; |
@@ -114,6 +116,7 @@ struct rpc_create_args { | |||
114 | #define RPC_CLNT_CREATE_NONPRIVPORT (1UL << 3) | 116 | #define RPC_CLNT_CREATE_NONPRIVPORT (1UL << 3) |
115 | #define RPC_CLNT_CREATE_NOPING (1UL << 4) | 117 | #define RPC_CLNT_CREATE_NOPING (1UL << 4) |
116 | #define RPC_CLNT_CREATE_DISCRTRY (1UL << 5) | 118 | #define RPC_CLNT_CREATE_DISCRTRY (1UL << 5) |
119 | #define RPC_CLNT_CREATE_QUIET (1UL << 6) | ||
117 | 120 | ||
118 | struct rpc_clnt *rpc_create(struct rpc_create_args *args); | 121 | struct rpc_clnt *rpc_create(struct rpc_create_args *args); |
119 | struct rpc_clnt *rpc_bind_new_program(struct rpc_clnt *, | 122 | struct rpc_clnt *rpc_bind_new_program(struct rpc_clnt *, |
@@ -122,7 +125,10 @@ struct rpc_clnt *rpc_clone_client(struct rpc_clnt *); | |||
122 | void rpc_shutdown_client(struct rpc_clnt *); | 125 | void rpc_shutdown_client(struct rpc_clnt *); |
123 | void rpc_release_client(struct rpc_clnt *); | 126 | void rpc_release_client(struct rpc_clnt *); |
124 | 127 | ||
125 | int rpcb_register(u32, u32, int, unsigned short, int *); | 128 | int rpcb_register(u32, u32, int, unsigned short); |
129 | int rpcb_v4_register(const u32 program, const u32 version, | ||
130 | const struct sockaddr *address, | ||
131 | const char *netid); | ||
126 | int rpcb_getport_sync(struct sockaddr_in *, u32, u32, int); | 132 | int rpcb_getport_sync(struct sockaddr_in *, u32, u32, int); |
127 | void rpcb_getport_async(struct rpc_task *); | 133 | void rpcb_getport_async(struct rpc_task *); |
128 | 134 | ||
diff --git a/include/linux/sunrpc/gss_api.h b/include/linux/sunrpc/gss_api.h index 459c5fc11d51..03f33330ece2 100644 --- a/include/linux/sunrpc/gss_api.h +++ b/include/linux/sunrpc/gss_api.h | |||
@@ -7,8 +7,6 @@ | |||
7 | * Andy Adamson <andros@umich.edu> | 7 | * Andy Adamson <andros@umich.edu> |
8 | * Bruce Fields <bfields@umich.edu> | 8 | * Bruce Fields <bfields@umich.edu> |
9 | * Copyright (c) 2000 The Regents of the University of Michigan | 9 | * Copyright (c) 2000 The Regents of the University of Michigan |
10 | * | ||
11 | * $Id$ | ||
12 | */ | 10 | */ |
13 | 11 | ||
14 | #ifndef _LINUX_SUNRPC_GSS_API_H | 12 | #ifndef _LINUX_SUNRPC_GSS_API_H |
diff --git a/include/linux/sunrpc/gss_krb5.h b/include/linux/sunrpc/gss_krb5.h index a10f1fb0bf7c..e7bbdba474d5 100644 --- a/include/linux/sunrpc/gss_krb5.h +++ b/include/linux/sunrpc/gss_krb5.h | |||
@@ -51,6 +51,9 @@ struct krb5_ctx { | |||
51 | 51 | ||
52 | extern spinlock_t krb5_seq_lock; | 52 | extern spinlock_t krb5_seq_lock; |
53 | 53 | ||
54 | /* The length of the Kerberos GSS token header */ | ||
55 | #define GSS_KRB5_TOK_HDR_LEN (16) | ||
56 | |||
54 | #define KG_TOK_MIC_MSG 0x0101 | 57 | #define KG_TOK_MIC_MSG 0x0101 |
55 | #define KG_TOK_WRAP_MSG 0x0201 | 58 | #define KG_TOK_WRAP_MSG 0x0201 |
56 | 59 | ||
diff --git a/include/linux/sunrpc/sched.h b/include/linux/sunrpc/sched.h index d1a5c8c1a0f1..64981a2f1cae 100644 --- a/include/linux/sunrpc/sched.h +++ b/include/linux/sunrpc/sched.h | |||
@@ -135,7 +135,6 @@ struct rpc_task_setup { | |||
135 | #define RPC_IS_SWAPPER(t) ((t)->tk_flags & RPC_TASK_SWAPPER) | 135 | #define RPC_IS_SWAPPER(t) ((t)->tk_flags & RPC_TASK_SWAPPER) |
136 | #define RPC_DO_ROOTOVERRIDE(t) ((t)->tk_flags & RPC_TASK_ROOTCREDS) | 136 | #define RPC_DO_ROOTOVERRIDE(t) ((t)->tk_flags & RPC_TASK_ROOTCREDS) |
137 | #define RPC_ASSASSINATED(t) ((t)->tk_flags & RPC_TASK_KILLED) | 137 | #define RPC_ASSASSINATED(t) ((t)->tk_flags & RPC_TASK_KILLED) |
138 | #define RPC_DO_CALLBACK(t) ((t)->tk_callback != NULL) | ||
139 | #define RPC_IS_SOFT(t) ((t)->tk_flags & RPC_TASK_SOFT) | 138 | #define RPC_IS_SOFT(t) ((t)->tk_flags & RPC_TASK_SOFT) |
140 | 139 | ||
141 | #define RPC_TASK_RUNNING 0 | 140 | #define RPC_TASK_RUNNING 0 |
diff --git a/include/linux/sunrpc/svc.h b/include/linux/sunrpc/svc.h index 4b54c5fdcfd9..3afe7fb403b2 100644 --- a/include/linux/sunrpc/svc.h +++ b/include/linux/sunrpc/svc.h | |||
@@ -22,7 +22,7 @@ | |||
22 | /* | 22 | /* |
23 | * This is the RPC server thread function prototype | 23 | * This is the RPC server thread function prototype |
24 | */ | 24 | */ |
25 | typedef void (*svc_thread_fn)(struct svc_rqst *); | 25 | typedef int (*svc_thread_fn)(void *); |
26 | 26 | ||
27 | /* | 27 | /* |
28 | * | 28 | * |
@@ -66,6 +66,7 @@ struct svc_serv { | |||
66 | struct list_head sv_tempsocks; /* all temporary sockets */ | 66 | struct list_head sv_tempsocks; /* all temporary sockets */ |
67 | int sv_tmpcnt; /* count of temporary sockets */ | 67 | int sv_tmpcnt; /* count of temporary sockets */ |
68 | struct timer_list sv_temptimer; /* timer for aging temporary sockets */ | 68 | struct timer_list sv_temptimer; /* timer for aging temporary sockets */ |
69 | sa_family_t sv_family; /* listener's address family */ | ||
69 | 70 | ||
70 | char * sv_name; /* service name */ | 71 | char * sv_name; /* service name */ |
71 | 72 | ||
@@ -80,7 +81,6 @@ struct svc_serv { | |||
80 | struct module * sv_module; /* optional module to count when | 81 | struct module * sv_module; /* optional module to count when |
81 | * adding threads */ | 82 | * adding threads */ |
82 | svc_thread_fn sv_function; /* main function for threads */ | 83 | svc_thread_fn sv_function; /* main function for threads */ |
83 | int sv_kill_signal; /* signal to kill threads */ | ||
84 | }; | 84 | }; |
85 | 85 | ||
86 | /* | 86 | /* |
@@ -266,17 +266,17 @@ struct svc_rqst { | |||
266 | /* | 266 | /* |
267 | * Rigorous type checking on sockaddr type conversions | 267 | * Rigorous type checking on sockaddr type conversions |
268 | */ | 268 | */ |
269 | static inline struct sockaddr_in *svc_addr_in(struct svc_rqst *rqst) | 269 | static inline struct sockaddr_in *svc_addr_in(const struct svc_rqst *rqst) |
270 | { | 270 | { |
271 | return (struct sockaddr_in *) &rqst->rq_addr; | 271 | return (struct sockaddr_in *) &rqst->rq_addr; |
272 | } | 272 | } |
273 | 273 | ||
274 | static inline struct sockaddr_in6 *svc_addr_in6(struct svc_rqst *rqst) | 274 | static inline struct sockaddr_in6 *svc_addr_in6(const struct svc_rqst *rqst) |
275 | { | 275 | { |
276 | return (struct sockaddr_in6 *) &rqst->rq_addr; | 276 | return (struct sockaddr_in6 *) &rqst->rq_addr; |
277 | } | 277 | } |
278 | 278 | ||
279 | static inline struct sockaddr *svc_addr(struct svc_rqst *rqst) | 279 | static inline struct sockaddr *svc_addr(const struct svc_rqst *rqst) |
280 | { | 280 | { |
281 | return (struct sockaddr *) &rqst->rq_addr; | 281 | return (struct sockaddr *) &rqst->rq_addr; |
282 | } | 282 | } |
@@ -382,18 +382,20 @@ struct svc_procedure { | |||
382 | /* | 382 | /* |
383 | * Function prototypes. | 383 | * Function prototypes. |
384 | */ | 384 | */ |
385 | struct svc_serv * svc_create(struct svc_program *, unsigned int, | 385 | struct svc_serv *svc_create(struct svc_program *, unsigned int, sa_family_t, |
386 | void (*shutdown)(struct svc_serv*)); | 386 | void (*shutdown)(struct svc_serv *)); |
387 | struct svc_rqst *svc_prepare_thread(struct svc_serv *serv, | 387 | struct svc_rqst *svc_prepare_thread(struct svc_serv *serv, |
388 | struct svc_pool *pool); | 388 | struct svc_pool *pool); |
389 | void svc_exit_thread(struct svc_rqst *); | 389 | void svc_exit_thread(struct svc_rqst *); |
390 | struct svc_serv * svc_create_pooled(struct svc_program *, unsigned int, | 390 | struct svc_serv * svc_create_pooled(struct svc_program *, unsigned int, |
391 | void (*shutdown)(struct svc_serv*), | 391 | sa_family_t, void (*shutdown)(struct svc_serv *), |
392 | svc_thread_fn, int sig, struct module *); | 392 | svc_thread_fn, struct module *); |
393 | int svc_set_num_threads(struct svc_serv *, struct svc_pool *, int); | 393 | int svc_set_num_threads(struct svc_serv *, struct svc_pool *, int); |
394 | void svc_destroy(struct svc_serv *); | 394 | void svc_destroy(struct svc_serv *); |
395 | int svc_process(struct svc_rqst *); | 395 | int svc_process(struct svc_rqst *); |
396 | int svc_register(struct svc_serv *, int, unsigned short); | 396 | int svc_register(const struct svc_serv *, const unsigned short, |
397 | const unsigned short); | ||
398 | |||
397 | void svc_wake_up(struct svc_serv *); | 399 | void svc_wake_up(struct svc_serv *); |
398 | void svc_reserve(struct svc_rqst *rqstp, int space); | 400 | void svc_reserve(struct svc_rqst *rqstp, int space); |
399 | struct svc_pool * svc_pool_for_cpu(struct svc_serv *serv, int cpu); | 401 | struct svc_pool * svc_pool_for_cpu(struct svc_serv *serv, int cpu); |
diff --git a/include/linux/sunrpc/svc_rdma.h b/include/linux/sunrpc/svc_rdma.h index 05eb4664d0dd..c14fe86dac59 100644 --- a/include/linux/sunrpc/svc_rdma.h +++ b/include/linux/sunrpc/svc_rdma.h | |||
@@ -72,7 +72,8 @@ extern atomic_t rdma_stat_sq_prod; | |||
72 | */ | 72 | */ |
73 | struct svc_rdma_op_ctxt { | 73 | struct svc_rdma_op_ctxt { |
74 | struct svc_rdma_op_ctxt *read_hdr; | 74 | struct svc_rdma_op_ctxt *read_hdr; |
75 | struct list_head free_list; | 75 | struct svc_rdma_fastreg_mr *frmr; |
76 | int hdr_count; | ||
76 | struct xdr_buf arg; | 77 | struct xdr_buf arg; |
77 | struct list_head dto_q; | 78 | struct list_head dto_q; |
78 | enum ib_wr_opcode wr_op; | 79 | enum ib_wr_opcode wr_op; |
@@ -86,14 +87,52 @@ struct svc_rdma_op_ctxt { | |||
86 | struct page *pages[RPCSVC_MAXPAGES]; | 87 | struct page *pages[RPCSVC_MAXPAGES]; |
87 | }; | 88 | }; |
88 | 89 | ||
90 | /* | ||
91 | * NFS_ requests are mapped on the client side by the chunk lists in | ||
92 | * the RPCRDMA header. During the fetching of the RPC from the client | ||
93 | * and the writing of the reply to the client, the memory in the | ||
94 | * client and the memory in the server must be mapped as contiguous | ||
95 | * vaddr/len for access by the hardware. These data strucures keep | ||
96 | * these mappings. | ||
97 | * | ||
98 | * For an RDMA_WRITE, the 'sge' maps the RPC REPLY. For RDMA_READ, the | ||
99 | * 'sge' in the svc_rdma_req_map maps the server side RPC reply and the | ||
100 | * 'ch' field maps the read-list of the RPCRDMA header to the 'sge' | ||
101 | * mapping of the reply. | ||
102 | */ | ||
103 | struct svc_rdma_chunk_sge { | ||
104 | int start; /* sge no for this chunk */ | ||
105 | int count; /* sge count for this chunk */ | ||
106 | }; | ||
107 | struct svc_rdma_fastreg_mr { | ||
108 | struct ib_mr *mr; | ||
109 | void *kva; | ||
110 | struct ib_fast_reg_page_list *page_list; | ||
111 | int page_list_len; | ||
112 | unsigned long access_flags; | ||
113 | unsigned long map_len; | ||
114 | enum dma_data_direction direction; | ||
115 | struct list_head frmr_list; | ||
116 | }; | ||
117 | struct svc_rdma_req_map { | ||
118 | struct svc_rdma_fastreg_mr *frmr; | ||
119 | unsigned long count; | ||
120 | union { | ||
121 | struct kvec sge[RPCSVC_MAXPAGES]; | ||
122 | struct svc_rdma_chunk_sge ch[RPCSVC_MAXPAGES]; | ||
123 | }; | ||
124 | }; | ||
125 | #define RDMACTXT_F_FAST_UNREG 1 | ||
89 | #define RDMACTXT_F_LAST_CTXT 2 | 126 | #define RDMACTXT_F_LAST_CTXT 2 |
90 | 127 | ||
128 | #define SVCRDMA_DEVCAP_FAST_REG 1 /* fast mr registration */ | ||
129 | #define SVCRDMA_DEVCAP_READ_W_INV 2 /* read w/ invalidate */ | ||
130 | |||
91 | struct svcxprt_rdma { | 131 | struct svcxprt_rdma { |
92 | struct svc_xprt sc_xprt; /* SVC transport structure */ | 132 | struct svc_xprt sc_xprt; /* SVC transport structure */ |
93 | struct rdma_cm_id *sc_cm_id; /* RDMA connection id */ | 133 | struct rdma_cm_id *sc_cm_id; /* RDMA connection id */ |
94 | struct list_head sc_accept_q; /* Conn. waiting accept */ | 134 | struct list_head sc_accept_q; /* Conn. waiting accept */ |
95 | int sc_ord; /* RDMA read limit */ | 135 | int sc_ord; /* RDMA read limit */ |
96 | wait_queue_head_t sc_read_wait; | ||
97 | int sc_max_sge; | 136 | int sc_max_sge; |
98 | 137 | ||
99 | int sc_sq_depth; /* Depth of SQ */ | 138 | int sc_sq_depth; /* Depth of SQ */ |
@@ -104,18 +143,19 @@ struct svcxprt_rdma { | |||
104 | 143 | ||
105 | struct ib_pd *sc_pd; | 144 | struct ib_pd *sc_pd; |
106 | 145 | ||
146 | atomic_t sc_dma_used; | ||
107 | atomic_t sc_ctxt_used; | 147 | atomic_t sc_ctxt_used; |
108 | struct list_head sc_ctxt_free; | ||
109 | int sc_ctxt_cnt; | ||
110 | int sc_ctxt_bump; | ||
111 | int sc_ctxt_max; | ||
112 | spinlock_t sc_ctxt_lock; | ||
113 | struct list_head sc_rq_dto_q; | 148 | struct list_head sc_rq_dto_q; |
114 | spinlock_t sc_rq_dto_lock; | 149 | spinlock_t sc_rq_dto_lock; |
115 | struct ib_qp *sc_qp; | 150 | struct ib_qp *sc_qp; |
116 | struct ib_cq *sc_rq_cq; | 151 | struct ib_cq *sc_rq_cq; |
117 | struct ib_cq *sc_sq_cq; | 152 | struct ib_cq *sc_sq_cq; |
118 | struct ib_mr *sc_phys_mr; /* MR for server memory */ | 153 | struct ib_mr *sc_phys_mr; /* MR for server memory */ |
154 | u32 sc_dev_caps; /* distilled device caps */ | ||
155 | u32 sc_dma_lkey; /* local dma key */ | ||
156 | unsigned int sc_frmr_pg_list_len; | ||
157 | struct list_head sc_frmr_q; | ||
158 | spinlock_t sc_frmr_q_lock; | ||
119 | 159 | ||
120 | spinlock_t sc_lock; /* transport lock */ | 160 | spinlock_t sc_lock; /* transport lock */ |
121 | 161 | ||
@@ -123,7 +163,6 @@ struct svcxprt_rdma { | |||
123 | unsigned long sc_flags; | 163 | unsigned long sc_flags; |
124 | struct list_head sc_dto_q; /* DTO tasklet I/O pending Q */ | 164 | struct list_head sc_dto_q; /* DTO tasklet I/O pending Q */ |
125 | struct list_head sc_read_complete_q; | 165 | struct list_head sc_read_complete_q; |
126 | spinlock_t sc_read_complete_lock; | ||
127 | struct work_struct sc_work; | 166 | struct work_struct sc_work; |
128 | }; | 167 | }; |
129 | /* sc_flags */ | 168 | /* sc_flags */ |
@@ -173,6 +212,13 @@ extern int svc_rdma_post_recv(struct svcxprt_rdma *); | |||
173 | extern int svc_rdma_create_listen(struct svc_serv *, int, struct sockaddr *); | 212 | extern int svc_rdma_create_listen(struct svc_serv *, int, struct sockaddr *); |
174 | extern struct svc_rdma_op_ctxt *svc_rdma_get_context(struct svcxprt_rdma *); | 213 | extern struct svc_rdma_op_ctxt *svc_rdma_get_context(struct svcxprt_rdma *); |
175 | extern void svc_rdma_put_context(struct svc_rdma_op_ctxt *, int); | 214 | extern void svc_rdma_put_context(struct svc_rdma_op_ctxt *, int); |
215 | extern void svc_rdma_unmap_dma(struct svc_rdma_op_ctxt *ctxt); | ||
216 | extern struct svc_rdma_req_map *svc_rdma_get_req_map(void); | ||
217 | extern void svc_rdma_put_req_map(struct svc_rdma_req_map *); | ||
218 | extern int svc_rdma_fastreg(struct svcxprt_rdma *, struct svc_rdma_fastreg_mr *); | ||
219 | extern struct svc_rdma_fastreg_mr *svc_rdma_get_frmr(struct svcxprt_rdma *); | ||
220 | extern void svc_rdma_put_frmr(struct svcxprt_rdma *, | ||
221 | struct svc_rdma_fastreg_mr *); | ||
176 | extern void svc_sq_reap(struct svcxprt_rdma *); | 222 | extern void svc_sq_reap(struct svcxprt_rdma *); |
177 | extern void svc_rq_reap(struct svcxprt_rdma *); | 223 | extern void svc_rq_reap(struct svcxprt_rdma *); |
178 | extern struct svc_xprt_class svc_rdma_class; | 224 | extern struct svc_xprt_class svc_rdma_class; |
diff --git a/include/linux/sunrpc/svcauth_gss.h b/include/linux/sunrpc/svcauth_gss.h index 417a1def56db..c9165d9771a8 100644 --- a/include/linux/sunrpc/svcauth_gss.h +++ b/include/linux/sunrpc/svcauth_gss.h | |||
@@ -3,9 +3,6 @@ | |||
3 | * | 3 | * |
4 | * Bruce Fields <bfields@umich.edu> | 4 | * Bruce Fields <bfields@umich.edu> |
5 | * Copyright (c) 2002 The Regents of the Unviersity of Michigan | 5 | * Copyright (c) 2002 The Regents of the Unviersity of Michigan |
6 | * | ||
7 | * $Id$ | ||
8 | * | ||
9 | */ | 6 | */ |
10 | 7 | ||
11 | #ifndef _LINUX_SUNRPC_SVCAUTH_GSS_H | 8 | #ifndef _LINUX_SUNRPC_SVCAUTH_GSS_H |
diff --git a/include/linux/sunrpc/svcsock.h b/include/linux/sunrpc/svcsock.h index 8cff696dedf5..483e10380aae 100644 --- a/include/linux/sunrpc/svcsock.h +++ b/include/linux/sunrpc/svcsock.h | |||
@@ -39,10 +39,7 @@ int svc_send(struct svc_rqst *); | |||
39 | void svc_drop(struct svc_rqst *); | 39 | void svc_drop(struct svc_rqst *); |
40 | void svc_sock_update_bufs(struct svc_serv *serv); | 40 | void svc_sock_update_bufs(struct svc_serv *serv); |
41 | int svc_sock_names(char *buf, struct svc_serv *serv, char *toclose); | 41 | int svc_sock_names(char *buf, struct svc_serv *serv, char *toclose); |
42 | int svc_addsock(struct svc_serv *serv, | 42 | int svc_addsock(struct svc_serv *serv, int fd, char *name_return); |
43 | int fd, | ||
44 | char *name_return, | ||
45 | int *proto); | ||
46 | void svc_init_xprt_sock(void); | 43 | void svc_init_xprt_sock(void); |
47 | void svc_cleanup_xprt_sock(void); | 44 | void svc_cleanup_xprt_sock(void); |
48 | 45 | ||
diff --git a/include/linux/suspend.h b/include/linux/suspend.h index a6977423baf7..2ce8207686e2 100644 --- a/include/linux/suspend.h +++ b/include/linux/suspend.h | |||
@@ -86,6 +86,11 @@ typedef int __bitwise suspend_state_t; | |||
86 | * that implement @begin(), but platforms implementing @begin() should | 86 | * that implement @begin(), but platforms implementing @begin() should |
87 | * also provide a @end() which cleans up transitions aborted before | 87 | * also provide a @end() which cleans up transitions aborted before |
88 | * @enter(). | 88 | * @enter(). |
89 | * | ||
90 | * @recover: Recover the platform from a suspend failure. | ||
91 | * Called by the PM core if the suspending of devices fails. | ||
92 | * This callback is optional and should only be implemented by platforms | ||
93 | * which require special recovery actions in that situation. | ||
89 | */ | 94 | */ |
90 | struct platform_suspend_ops { | 95 | struct platform_suspend_ops { |
91 | int (*valid)(suspend_state_t state); | 96 | int (*valid)(suspend_state_t state); |
@@ -94,6 +99,7 @@ struct platform_suspend_ops { | |||
94 | int (*enter)(suspend_state_t state); | 99 | int (*enter)(suspend_state_t state); |
95 | void (*finish)(void); | 100 | void (*finish)(void); |
96 | void (*end)(void); | 101 | void (*end)(void); |
102 | void (*recover)(void); | ||
97 | }; | 103 | }; |
98 | 104 | ||
99 | #ifdef CONFIG_SUSPEND | 105 | #ifdef CONFIG_SUSPEND |
@@ -149,7 +155,7 @@ extern void mark_free_pages(struct zone *zone); | |||
149 | * The methods in this structure allow a platform to carry out special | 155 | * The methods in this structure allow a platform to carry out special |
150 | * operations required by it during a hibernation transition. | 156 | * operations required by it during a hibernation transition. |
151 | * | 157 | * |
152 | * All the methods below must be implemented. | 158 | * All the methods below, except for @recover(), must be implemented. |
153 | * | 159 | * |
154 | * @begin: Tell the platform driver that we're starting hibernation. | 160 | * @begin: Tell the platform driver that we're starting hibernation. |
155 | * Called right after shrinking memory and before freezing devices. | 161 | * Called right after shrinking memory and before freezing devices. |
@@ -189,6 +195,11 @@ extern void mark_free_pages(struct zone *zone); | |||
189 | * @restore_cleanup: Clean up after a failing image restoration. | 195 | * @restore_cleanup: Clean up after a failing image restoration. |
190 | * Called right after the nonboot CPUs have been enabled and before | 196 | * Called right after the nonboot CPUs have been enabled and before |
191 | * thawing devices (runs with IRQs on). | 197 | * thawing devices (runs with IRQs on). |
198 | * | ||
199 | * @recover: Recover the platform from a failure to suspend devices. | ||
200 | * Called by the PM core if the suspending of devices during hibernation | ||
201 | * fails. This callback is optional and should only be implemented by | ||
202 | * platforms which require special recovery actions in that situation. | ||
192 | */ | 203 | */ |
193 | struct platform_hibernation_ops { | 204 | struct platform_hibernation_ops { |
194 | int (*begin)(void); | 205 | int (*begin)(void); |
@@ -200,16 +211,17 @@ struct platform_hibernation_ops { | |||
200 | void (*leave)(void); | 211 | void (*leave)(void); |
201 | int (*pre_restore)(void); | 212 | int (*pre_restore)(void); |
202 | void (*restore_cleanup)(void); | 213 | void (*restore_cleanup)(void); |
214 | void (*recover)(void); | ||
203 | }; | 215 | }; |
204 | 216 | ||
205 | #ifdef CONFIG_HIBERNATION | 217 | #ifdef CONFIG_HIBERNATION |
206 | /* kernel/power/snapshot.c */ | 218 | /* kernel/power/snapshot.c */ |
207 | extern void __register_nosave_region(unsigned long b, unsigned long e, int km); | 219 | extern void __register_nosave_region(unsigned long b, unsigned long e, int km); |
208 | static inline void register_nosave_region(unsigned long b, unsigned long e) | 220 | static inline void __init register_nosave_region(unsigned long b, unsigned long e) |
209 | { | 221 | { |
210 | __register_nosave_region(b, e, 0); | 222 | __register_nosave_region(b, e, 0); |
211 | } | 223 | } |
212 | static inline void register_nosave_region_late(unsigned long b, unsigned long e) | 224 | static inline void __init register_nosave_region_late(unsigned long b, unsigned long e) |
213 | { | 225 | { |
214 | __register_nosave_region(b, e, 1); | 226 | __register_nosave_region(b, e, 1); |
215 | } | 227 | } |
@@ -266,4 +278,6 @@ static inline void register_nosave_region_late(unsigned long b, unsigned long e) | |||
266 | } | 278 | } |
267 | #endif | 279 | #endif |
268 | 280 | ||
281 | extern struct mutex pm_mutex; | ||
282 | |||
269 | #endif /* _LINUX_SUSPEND_H */ | 283 | #endif /* _LINUX_SUSPEND_H */ |
diff --git a/include/linux/swab.h b/include/linux/swab.h new file mode 100644 index 000000000000..270d5c208a89 --- /dev/null +++ b/include/linux/swab.h | |||
@@ -0,0 +1,309 @@ | |||
1 | #ifndef _LINUX_SWAB_H | ||
2 | #define _LINUX_SWAB_H | ||
3 | |||
4 | #include <linux/types.h> | ||
5 | #include <linux/compiler.h> | ||
6 | #include <asm/byteorder.h> | ||
7 | |||
8 | /* | ||
9 | * casts are necessary for constants, because we never know how for sure | ||
10 | * how U/UL/ULL map to __u16, __u32, __u64. At least not in a portable way. | ||
11 | */ | ||
12 | #define __const_swab16(x) ((__u16)( \ | ||
13 | (((__u16)(x) & (__u16)0x00ffU) << 8) | \ | ||
14 | (((__u16)(x) & (__u16)0xff00U) >> 8))) | ||
15 | |||
16 | #define __const_swab32(x) ((__u32)( \ | ||
17 | (((__u32)(x) & (__u32)0x000000ffUL) << 24) | \ | ||
18 | (((__u32)(x) & (__u32)0x0000ff00UL) << 8) | \ | ||
19 | (((__u32)(x) & (__u32)0x00ff0000UL) >> 8) | \ | ||
20 | (((__u32)(x) & (__u32)0xff000000UL) >> 24))) | ||
21 | |||
22 | #define __const_swab64(x) ((__u64)( \ | ||
23 | (((__u64)(x) & (__u64)0x00000000000000ffULL) << 56) | \ | ||
24 | (((__u64)(x) & (__u64)0x000000000000ff00ULL) << 40) | \ | ||
25 | (((__u64)(x) & (__u64)0x0000000000ff0000ULL) << 24) | \ | ||
26 | (((__u64)(x) & (__u64)0x00000000ff000000ULL) << 8) | \ | ||
27 | (((__u64)(x) & (__u64)0x000000ff00000000ULL) >> 8) | \ | ||
28 | (((__u64)(x) & (__u64)0x0000ff0000000000ULL) >> 24) | \ | ||
29 | (((__u64)(x) & (__u64)0x00ff000000000000ULL) >> 40) | \ | ||
30 | (((__u64)(x) & (__u64)0xff00000000000000ULL) >> 56))) | ||
31 | |||
32 | #define __const_swahw32(x) ((__u32)( \ | ||
33 | (((__u32)(x) & (__u32)0x0000ffffUL) << 16) | \ | ||
34 | (((__u32)(x) & (__u32)0xffff0000UL) >> 16))) | ||
35 | |||
36 | #define __const_swahb32(x) ((__u32)( \ | ||
37 | (((__u32)(x) & (__u32)0x00ff00ffUL) << 8) | \ | ||
38 | (((__u32)(x) & (__u32)0xff00ff00UL) >> 8))) | ||
39 | |||
40 | /* | ||
41 | * Implement the following as inlines, but define the interface using | ||
42 | * macros to allow constant folding when possible: | ||
43 | * ___swab16, ___swab32, ___swab64, ___swahw32, ___swahb32 | ||
44 | */ | ||
45 | |||
46 | static inline __attribute_const__ __u16 ___swab16(__u16 val) | ||
47 | { | ||
48 | #ifdef __arch_swab16 | ||
49 | return __arch_swab16(val); | ||
50 | #elif defined(__arch_swab16p) | ||
51 | return __arch_swab16p(&val); | ||
52 | #else | ||
53 | return __const_swab16(val); | ||
54 | #endif | ||
55 | } | ||
56 | |||
57 | static inline __attribute_const__ __u32 ___swab32(__u32 val) | ||
58 | { | ||
59 | #ifdef __arch_swab32 | ||
60 | return __arch_swab32(val); | ||
61 | #elif defined(__arch_swab32p) | ||
62 | return __arch_swab32p(&val); | ||
63 | #else | ||
64 | return __const_swab32(val); | ||
65 | #endif | ||
66 | } | ||
67 | |||
68 | static inline __attribute_const__ __u64 ___swab64(__u64 val) | ||
69 | { | ||
70 | #ifdef __arch_swab64 | ||
71 | return __arch_swab64(val); | ||
72 | #elif defined(__arch_swab64p) | ||
73 | return __arch_swab64p(&val); | ||
74 | #elif defined(__SWAB_64_THRU_32__) | ||
75 | __u32 h = val >> 32; | ||
76 | __u32 l = val & ((1ULL << 32) - 1); | ||
77 | return (((__u64)___swab32(l)) << 32) | ((__u64)(___swab32(h))); | ||
78 | #else | ||
79 | return __const_swab64(val); | ||
80 | #endif | ||
81 | } | ||
82 | |||
83 | static inline __attribute_const__ __u32 ___swahw32(__u32 val) | ||
84 | { | ||
85 | #ifdef __arch_swahw32 | ||
86 | return __arch_swahw32(val); | ||
87 | #elif defined(__arch_swahw32p) | ||
88 | return __arch_swahw32p(&val); | ||
89 | #else | ||
90 | return __const_swahw32(val); | ||
91 | #endif | ||
92 | } | ||
93 | |||
94 | static inline __attribute_const__ __u32 ___swahb32(__u32 val) | ||
95 | { | ||
96 | #ifdef __arch_swahb32 | ||
97 | return __arch_swahb32(val); | ||
98 | #elif defined(__arch_swahb32p) | ||
99 | return __arch_swahb32p(&val); | ||
100 | #else | ||
101 | return __const_swahb32(val); | ||
102 | #endif | ||
103 | } | ||
104 | |||
105 | /** | ||
106 | * __swab16 - return a byteswapped 16-bit value | ||
107 | * @x: value to byteswap | ||
108 | */ | ||
109 | #define __swab16(x) \ | ||
110 | (__builtin_constant_p((__u16)(x)) ? \ | ||
111 | __const_swab16((x)) : \ | ||
112 | ___swab16((x))) | ||
113 | |||
114 | /** | ||
115 | * __swab32 - return a byteswapped 32-bit value | ||
116 | * @x: value to byteswap | ||
117 | */ | ||
118 | #define __swab32(x) \ | ||
119 | (__builtin_constant_p((__u32)(x)) ? \ | ||
120 | __const_swab32((x)) : \ | ||
121 | ___swab32((x))) | ||
122 | |||
123 | /** | ||
124 | * __swab64 - return a byteswapped 64-bit value | ||
125 | * @x: value to byteswap | ||
126 | */ | ||
127 | #define __swab64(x) \ | ||
128 | (__builtin_constant_p((__u64)(x)) ? \ | ||
129 | __const_swab64((x)) : \ | ||
130 | ___swab64((x))) | ||
131 | |||
132 | /** | ||
133 | * __swahw32 - return a word-swapped 32-bit value | ||
134 | * @x: value to wordswap | ||
135 | * | ||
136 | * __swahw32(0x12340000) is 0x00001234 | ||
137 | */ | ||
138 | #define __swahw32(x) \ | ||
139 | (__builtin_constant_p((__u32)(x)) ? \ | ||
140 | __const_swahw32((x)) : \ | ||
141 | ___swahw32((x))) | ||
142 | |||
143 | /** | ||
144 | * __swahb32 - return a high and low byte-swapped 32-bit value | ||
145 | * @x: value to byteswap | ||
146 | * | ||
147 | * __swahb32(0x12345678) is 0x34127856 | ||
148 | */ | ||
149 | #define __swahb32(x) \ | ||
150 | (__builtin_constant_p((__u32)(x)) ? \ | ||
151 | __const_swahb32((x)) : \ | ||
152 | ___swahb32((x))) | ||
153 | |||
154 | /** | ||
155 | * __swab16p - return a byteswapped 16-bit value from a pointer | ||
156 | * @p: pointer to a naturally-aligned 16-bit value | ||
157 | */ | ||
158 | static inline __u16 __swab16p(const __u16 *p) | ||
159 | { | ||
160 | #ifdef __arch_swab16p | ||
161 | return __arch_swab16p(p); | ||
162 | #else | ||
163 | return __swab16(*p); | ||
164 | #endif | ||
165 | } | ||
166 | |||
167 | /** | ||
168 | * __swab32p - return a byteswapped 32-bit value from a pointer | ||
169 | * @p: pointer to a naturally-aligned 32-bit value | ||
170 | */ | ||
171 | static inline __u32 __swab32p(const __u32 *p) | ||
172 | { | ||
173 | #ifdef __arch_swab32p | ||
174 | return __arch_swab32p(p); | ||
175 | #else | ||
176 | return __swab32(*p); | ||
177 | #endif | ||
178 | } | ||
179 | |||
180 | /** | ||
181 | * __swab64p - return a byteswapped 64-bit value from a pointer | ||
182 | * @p: pointer to a naturally-aligned 64-bit value | ||
183 | */ | ||
184 | static inline __u64 __swab64p(const __u64 *p) | ||
185 | { | ||
186 | #ifdef __arch_swab64p | ||
187 | return __arch_swab64p(p); | ||
188 | #else | ||
189 | return __swab64(*p); | ||
190 | #endif | ||
191 | } | ||
192 | |||
193 | /** | ||
194 | * __swahw32p - return a wordswapped 32-bit value from a pointer | ||
195 | * @p: pointer to a naturally-aligned 32-bit value | ||
196 | * | ||
197 | * See __swahw32() for details of wordswapping. | ||
198 | */ | ||
199 | static inline __u32 __swahw32p(const __u32 *p) | ||
200 | { | ||
201 | #ifdef __arch_swahw32p | ||
202 | return __arch_swahw32p(p); | ||
203 | #else | ||
204 | return __swahw32(*p); | ||
205 | #endif | ||
206 | } | ||
207 | |||
208 | /** | ||
209 | * __swahb32p - return a high and low byteswapped 32-bit value from a pointer | ||
210 | * @p: pointer to a naturally-aligned 32-bit value | ||
211 | * | ||
212 | * See __swahb32() for details of high/low byteswapping. | ||
213 | */ | ||
214 | static inline __u32 __swahb32p(const __u32 *p) | ||
215 | { | ||
216 | #ifdef __arch_swahb32p | ||
217 | return __arch_swahb32p(p); | ||
218 | #else | ||
219 | return __swahb32(*p); | ||
220 | #endif | ||
221 | } | ||
222 | |||
223 | /** | ||
224 | * __swab16s - byteswap a 16-bit value in-place | ||
225 | * @p: pointer to a naturally-aligned 16-bit value | ||
226 | */ | ||
227 | static inline void __swab16s(__u16 *p) | ||
228 | { | ||
229 | #ifdef __arch_swab16s | ||
230 | __arch_swab16s(p); | ||
231 | #else | ||
232 | *p = __swab16p(p); | ||
233 | #endif | ||
234 | } | ||
235 | /** | ||
236 | * __swab32s - byteswap a 32-bit value in-place | ||
237 | * @p: pointer to a naturally-aligned 32-bit value | ||
238 | */ | ||
239 | static inline void __swab32s(__u32 *p) | ||
240 | { | ||
241 | #ifdef __arch_swab32s | ||
242 | __arch_swab32s(p); | ||
243 | #else | ||
244 | *p = __swab32p(p); | ||
245 | #endif | ||
246 | } | ||
247 | |||
248 | /** | ||
249 | * __swab64s - byteswap a 64-bit value in-place | ||
250 | * @p: pointer to a naturally-aligned 64-bit value | ||
251 | */ | ||
252 | static inline void __swab64s(__u64 *p) | ||
253 | { | ||
254 | #ifdef __arch_swab64s | ||
255 | __arch_swab64s(p); | ||
256 | #else | ||
257 | *p = __swab64p(p); | ||
258 | #endif | ||
259 | } | ||
260 | |||
261 | /** | ||
262 | * __swahw32s - wordswap a 32-bit value in-place | ||
263 | * @p: pointer to a naturally-aligned 32-bit value | ||
264 | * | ||
265 | * See __swahw32() for details of wordswapping | ||
266 | */ | ||
267 | static inline void __swahw32s(__u32 *p) | ||
268 | { | ||
269 | #ifdef __arch_swahw32s | ||
270 | __arch_swahw32s(p); | ||
271 | #else | ||
272 | *p = __swahw32p(p); | ||
273 | #endif | ||
274 | } | ||
275 | |||
276 | /** | ||
277 | * __swahb32s - high and low byteswap a 32-bit value in-place | ||
278 | * @p: pointer to a naturally-aligned 32-bit value | ||
279 | * | ||
280 | * See __swahb32() for details of high and low byte swapping | ||
281 | */ | ||
282 | static inline void __swahb32s(__u32 *p) | ||
283 | { | ||
284 | #ifdef __arch_swahb32s | ||
285 | __arch_swahb32s(p); | ||
286 | #else | ||
287 | *p = __swahb32p(p); | ||
288 | #endif | ||
289 | } | ||
290 | |||
291 | #ifdef __KERNEL__ | ||
292 | # define swab16 __swab16 | ||
293 | # define swab32 __swab32 | ||
294 | # define swab64 __swab64 | ||
295 | # define swahw32 __swahw32 | ||
296 | # define swahb32 __swahb32 | ||
297 | # define swab16p __swab16p | ||
298 | # define swab32p __swab32p | ||
299 | # define swab64p __swab64p | ||
300 | # define swahw32p __swahw32p | ||
301 | # define swahb32p __swahb32p | ||
302 | # define swab16s __swab16s | ||
303 | # define swab32s __swab32s | ||
304 | # define swab64s __swab64s | ||
305 | # define swahw32s __swahw32s | ||
306 | # define swahb32s __swahb32s | ||
307 | #endif /* __KERNEL__ */ | ||
308 | |||
309 | #endif /* _LINUX_SWAB_H */ | ||
diff --git a/include/linux/swap.h b/include/linux/swap.h index 0b3377650c85..de40f169a4e4 100644 --- a/include/linux/swap.h +++ b/include/linux/swap.h | |||
@@ -237,7 +237,6 @@ extern struct page *swapin_readahead(swp_entry_t, gfp_t, | |||
237 | 237 | ||
238 | /* linux/mm/swapfile.c */ | 238 | /* linux/mm/swapfile.c */ |
239 | extern long total_swap_pages; | 239 | extern long total_swap_pages; |
240 | extern unsigned int nr_swapfiles; | ||
241 | extern void si_swapinfo(struct sysinfo *); | 240 | extern void si_swapinfo(struct sysinfo *); |
242 | extern swp_entry_t get_swap_page(void); | 241 | extern swp_entry_t get_swap_page(void); |
243 | extern swp_entry_t get_swap_page_of_type(int); | 242 | extern swp_entry_t get_swap_page_of_type(int); |
@@ -254,8 +253,6 @@ extern int can_share_swap_page(struct page *); | |||
254 | extern int remove_exclusive_swap_page(struct page *); | 253 | extern int remove_exclusive_swap_page(struct page *); |
255 | struct backing_dev_info; | 254 | struct backing_dev_info; |
256 | 255 | ||
257 | extern spinlock_t swap_lock; | ||
258 | |||
259 | /* linux/mm/thrash.c */ | 256 | /* linux/mm/thrash.c */ |
260 | extern struct mm_struct * swap_token_mm; | 257 | extern struct mm_struct * swap_token_mm; |
261 | extern void grab_swap_token(void); | 258 | extern void grab_swap_token(void); |
diff --git a/include/linux/synclink.h b/include/linux/synclink.h index 45f6bc82d317..c844a229acc9 100644 --- a/include/linux/synclink.h +++ b/include/linux/synclink.h | |||
@@ -136,6 +136,7 @@ | |||
136 | #define MGSL_INTERFACE_RTS_EN 0x10 | 136 | #define MGSL_INTERFACE_RTS_EN 0x10 |
137 | #define MGSL_INTERFACE_LL 0x20 | 137 | #define MGSL_INTERFACE_LL 0x20 |
138 | #define MGSL_INTERFACE_RL 0x40 | 138 | #define MGSL_INTERFACE_RL 0x40 |
139 | #define MGSL_INTERFACE_MSB_FIRST 0x80 | ||
139 | 140 | ||
140 | typedef struct _MGSL_PARAMS | 141 | typedef struct _MGSL_PARAMS |
141 | { | 142 | { |
diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h index 0522f368f9d7..d6ff145919ca 100644 --- a/include/linux/syscalls.h +++ b/include/linux/syscalls.h | |||
@@ -305,6 +305,7 @@ asmlinkage long sys_fcntl64(unsigned int fd, | |||
305 | #endif | 305 | #endif |
306 | asmlinkage long sys_dup(unsigned int fildes); | 306 | asmlinkage long sys_dup(unsigned int fildes); |
307 | asmlinkage long sys_dup2(unsigned int oldfd, unsigned int newfd); | 307 | asmlinkage long sys_dup2(unsigned int oldfd, unsigned int newfd); |
308 | asmlinkage long sys_dup3(unsigned int oldfd, unsigned int newfd, int flags); | ||
308 | asmlinkage long sys_ioperm(unsigned long from, unsigned long num, int on); | 309 | asmlinkage long sys_ioperm(unsigned long from, unsigned long num, int on); |
309 | asmlinkage long sys_ioctl(unsigned int fd, unsigned int cmd, | 310 | asmlinkage long sys_ioctl(unsigned int fd, unsigned int cmd, |
310 | unsigned long arg); | 311 | unsigned long arg); |
@@ -409,6 +410,8 @@ asmlinkage long sys_getsockopt(int fd, int level, int optname, | |||
409 | asmlinkage long sys_bind(int, struct sockaddr __user *, int); | 410 | asmlinkage long sys_bind(int, struct sockaddr __user *, int); |
410 | asmlinkage long sys_connect(int, struct sockaddr __user *, int); | 411 | asmlinkage long sys_connect(int, struct sockaddr __user *, int); |
411 | asmlinkage long sys_accept(int, struct sockaddr __user *, int __user *); | 412 | asmlinkage long sys_accept(int, struct sockaddr __user *, int __user *); |
413 | asmlinkage long sys_paccept(int, struct sockaddr __user *, int __user *, | ||
414 | const __user sigset_t *, size_t, int); | ||
412 | asmlinkage long sys_getsockname(int, struct sockaddr __user *, int __user *); | 415 | asmlinkage long sys_getsockname(int, struct sockaddr __user *, int __user *); |
413 | asmlinkage long sys_getpeername(int, struct sockaddr __user *, int __user *); | 416 | asmlinkage long sys_getpeername(int, struct sockaddr __user *, int __user *); |
414 | asmlinkage long sys_send(int, void __user *, size_t, unsigned); | 417 | asmlinkage long sys_send(int, void __user *, size_t, unsigned); |
@@ -428,6 +431,7 @@ asmlinkage long sys_poll(struct pollfd __user *ufds, unsigned int nfds, | |||
428 | asmlinkage long sys_select(int n, fd_set __user *inp, fd_set __user *outp, | 431 | asmlinkage long sys_select(int n, fd_set __user *inp, fd_set __user *outp, |
429 | fd_set __user *exp, struct timeval __user *tvp); | 432 | fd_set __user *exp, struct timeval __user *tvp); |
430 | asmlinkage long sys_epoll_create(int size); | 433 | asmlinkage long sys_epoll_create(int size); |
434 | asmlinkage long sys_epoll_create1(int flags); | ||
431 | asmlinkage long sys_epoll_ctl(int epfd, int op, int fd, | 435 | asmlinkage long sys_epoll_ctl(int epfd, int op, int fd, |
432 | struct epoll_event __user *event); | 436 | struct epoll_event __user *event); |
433 | asmlinkage long sys_epoll_wait(int epfd, struct epoll_event __user *events, | 437 | asmlinkage long sys_epoll_wait(int epfd, struct epoll_event __user *events, |
@@ -443,7 +447,7 @@ asmlinkage long sys_newuname(struct new_utsname __user *name); | |||
443 | 447 | ||
444 | asmlinkage long sys_getrlimit(unsigned int resource, | 448 | asmlinkage long sys_getrlimit(unsigned int resource, |
445 | struct rlimit __user *rlim); | 449 | struct rlimit __user *rlim); |
446 | #if defined(COMPAT_RLIM_OLD_INFINITY) || !(defined(CONFIG_IA64) || defined(CONFIG_V850)) | 450 | #if defined(COMPAT_RLIM_OLD_INFINITY) || !(defined(CONFIG_IA64)) |
447 | asmlinkage long sys_old_getrlimit(unsigned int resource, struct rlimit __user *rlim); | 451 | asmlinkage long sys_old_getrlimit(unsigned int resource, struct rlimit __user *rlim); |
448 | #endif | 452 | #endif |
449 | asmlinkage long sys_setrlimit(unsigned int resource, | 453 | asmlinkage long sys_setrlimit(unsigned int resource, |
@@ -543,6 +547,7 @@ asmlinkage long sys_get_mempolicy(int __user *policy, | |||
543 | unsigned long addr, unsigned long flags); | 547 | unsigned long addr, unsigned long flags); |
544 | 548 | ||
545 | asmlinkage long sys_inotify_init(void); | 549 | asmlinkage long sys_inotify_init(void); |
550 | asmlinkage long sys_inotify_init1(int flags); | ||
546 | asmlinkage long sys_inotify_add_watch(int fd, const char __user *path, | 551 | asmlinkage long sys_inotify_add_watch(int fd, const char __user *path, |
547 | u32 mask); | 552 | u32 mask); |
548 | asmlinkage long sys_inotify_rm_watch(int fd, u32 wd); | 553 | asmlinkage long sys_inotify_rm_watch(int fd, u32 wd); |
@@ -608,12 +613,14 @@ asmlinkage long sys_set_robust_list(struct robust_list_head __user *head, | |||
608 | size_t len); | 613 | size_t len); |
609 | asmlinkage long sys_getcpu(unsigned __user *cpu, unsigned __user *node, struct getcpu_cache __user *cache); | 614 | asmlinkage long sys_getcpu(unsigned __user *cpu, unsigned __user *node, struct getcpu_cache __user *cache); |
610 | asmlinkage long sys_signalfd(int ufd, sigset_t __user *user_mask, size_t sizemask); | 615 | asmlinkage long sys_signalfd(int ufd, sigset_t __user *user_mask, size_t sizemask); |
616 | asmlinkage long sys_signalfd4(int ufd, sigset_t __user *user_mask, size_t sizemask, int flags); | ||
611 | asmlinkage long sys_timerfd_create(int clockid, int flags); | 617 | asmlinkage long sys_timerfd_create(int clockid, int flags); |
612 | asmlinkage long sys_timerfd_settime(int ufd, int flags, | 618 | asmlinkage long sys_timerfd_settime(int ufd, int flags, |
613 | const struct itimerspec __user *utmr, | 619 | const struct itimerspec __user *utmr, |
614 | struct itimerspec __user *otmr); | 620 | struct itimerspec __user *otmr); |
615 | asmlinkage long sys_timerfd_gettime(int ufd, struct itimerspec __user *otmr); | 621 | asmlinkage long sys_timerfd_gettime(int ufd, struct itimerspec __user *otmr); |
616 | asmlinkage long sys_eventfd(unsigned int count); | 622 | asmlinkage long sys_eventfd(unsigned int count); |
623 | asmlinkage long sys_eventfd2(unsigned int count, int flags); | ||
617 | asmlinkage long sys_fallocate(int fd, int mode, loff_t offset, loff_t len); | 624 | asmlinkage long sys_fallocate(int fd, int mode, loff_t offset, loff_t len); |
618 | 625 | ||
619 | int kernel_execve(const char *filename, char *const argv[], char *const envp[]); | 626 | int kernel_execve(const char *filename, char *const argv[], char *const envp[]); |
diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h index 24141b4d1a11..d0437f36921f 100644 --- a/include/linux/sysctl.h +++ b/include/linux/sysctl.h | |||
@@ -947,6 +947,22 @@ struct ctl_table; | |||
947 | struct nsproxy; | 947 | struct nsproxy; |
948 | struct ctl_table_root; | 948 | struct ctl_table_root; |
949 | 949 | ||
950 | struct ctl_table_set { | ||
951 | struct list_head list; | ||
952 | struct ctl_table_set *parent; | ||
953 | int (*is_seen)(struct ctl_table_set *); | ||
954 | }; | ||
955 | |||
956 | extern void setup_sysctl_set(struct ctl_table_set *p, | ||
957 | struct ctl_table_set *parent, | ||
958 | int (*is_seen)(struct ctl_table_set *)); | ||
959 | |||
960 | struct ctl_table_header; | ||
961 | |||
962 | extern void sysctl_head_get(struct ctl_table_header *); | ||
963 | extern void sysctl_head_put(struct ctl_table_header *); | ||
964 | extern int sysctl_is_seen(struct ctl_table_header *); | ||
965 | extern struct ctl_table_header *sysctl_head_grab(struct ctl_table_header *); | ||
950 | extern struct ctl_table_header *sysctl_head_next(struct ctl_table_header *prev); | 966 | extern struct ctl_table_header *sysctl_head_next(struct ctl_table_header *prev); |
951 | extern struct ctl_table_header *__sysctl_head_next(struct nsproxy *namespaces, | 967 | extern struct ctl_table_header *__sysctl_head_next(struct nsproxy *namespaces, |
952 | struct ctl_table_header *prev); | 968 | struct ctl_table_header *prev); |
@@ -1049,8 +1065,8 @@ struct ctl_table | |||
1049 | 1065 | ||
1050 | struct ctl_table_root { | 1066 | struct ctl_table_root { |
1051 | struct list_head root_list; | 1067 | struct list_head root_list; |
1052 | struct list_head header_list; | 1068 | struct ctl_table_set default_set; |
1053 | struct list_head *(*lookup)(struct ctl_table_root *root, | 1069 | struct ctl_table_set *(*lookup)(struct ctl_table_root *root, |
1054 | struct nsproxy *namespaces); | 1070 | struct nsproxy *namespaces); |
1055 | int (*permissions)(struct ctl_table_root *root, | 1071 | int (*permissions)(struct ctl_table_root *root, |
1056 | struct nsproxy *namespaces, struct ctl_table *table); | 1072 | struct nsproxy *namespaces, struct ctl_table *table); |
@@ -1063,9 +1079,14 @@ struct ctl_table_header | |||
1063 | struct ctl_table *ctl_table; | 1079 | struct ctl_table *ctl_table; |
1064 | struct list_head ctl_entry; | 1080 | struct list_head ctl_entry; |
1065 | int used; | 1081 | int used; |
1082 | int count; | ||
1066 | struct completion *unregistering; | 1083 | struct completion *unregistering; |
1067 | struct ctl_table *ctl_table_arg; | 1084 | struct ctl_table *ctl_table_arg; |
1068 | struct ctl_table_root *root; | 1085 | struct ctl_table_root *root; |
1086 | struct ctl_table_set *set; | ||
1087 | struct ctl_table *attached_by; | ||
1088 | struct ctl_table *attached_to; | ||
1089 | struct ctl_table_header *parent; | ||
1069 | }; | 1090 | }; |
1070 | 1091 | ||
1071 | /* struct ctl_path describes where in the hierarchy a table is added */ | 1092 | /* struct ctl_path describes where in the hierarchy a table is added */ |
diff --git a/include/linux/sysdev.h b/include/linux/sysdev.h index f2767bc6b735..f395bb3fa2f2 100644 --- a/include/linux/sysdev.h +++ b/include/linux/sysdev.h | |||
@@ -99,8 +99,9 @@ extern void sysdev_unregister(struct sys_device *); | |||
99 | 99 | ||
100 | struct sysdev_attribute { | 100 | struct sysdev_attribute { |
101 | struct attribute attr; | 101 | struct attribute attr; |
102 | ssize_t (*show)(struct sys_device *, char *); | 102 | ssize_t (*show)(struct sys_device *, struct sysdev_attribute *, char *); |
103 | ssize_t (*store)(struct sys_device *, const char *, size_t); | 103 | ssize_t (*store)(struct sys_device *, struct sysdev_attribute *, |
104 | const char *, size_t); | ||
104 | }; | 105 | }; |
105 | 106 | ||
106 | 107 | ||
@@ -118,4 +119,38 @@ struct sysdev_attribute { | |||
118 | extern int sysdev_create_file(struct sys_device *, struct sysdev_attribute *); | 119 | extern int sysdev_create_file(struct sys_device *, struct sysdev_attribute *); |
119 | extern void sysdev_remove_file(struct sys_device *, struct sysdev_attribute *); | 120 | extern void sysdev_remove_file(struct sys_device *, struct sysdev_attribute *); |
120 | 121 | ||
122 | struct sysdev_ext_attribute { | ||
123 | struct sysdev_attribute attr; | ||
124 | void *var; | ||
125 | }; | ||
126 | |||
127 | /* | ||
128 | * Support for simple variable sysdev attributes. | ||
129 | * The pointer to the variable is stored in a sysdev_ext_attribute | ||
130 | */ | ||
131 | |||
132 | /* Add more types as needed */ | ||
133 | |||
134 | extern ssize_t sysdev_show_ulong(struct sys_device *, struct sysdev_attribute *, | ||
135 | char *); | ||
136 | extern ssize_t sysdev_store_ulong(struct sys_device *, | ||
137 | struct sysdev_attribute *, const char *, size_t); | ||
138 | extern ssize_t sysdev_show_int(struct sys_device *, struct sysdev_attribute *, | ||
139 | char *); | ||
140 | extern ssize_t sysdev_store_int(struct sys_device *, | ||
141 | struct sysdev_attribute *, const char *, size_t); | ||
142 | |||
143 | #define _SYSDEV_ULONG_ATTR(_name, _mode, _var) \ | ||
144 | { _SYSDEV_ATTR(_name, _mode, sysdev_show_ulong, sysdev_store_ulong), \ | ||
145 | &(_var) } | ||
146 | #define SYSDEV_ULONG_ATTR(_name, _mode, _var) \ | ||
147 | struct sysdev_ext_attribute attr_##_name = \ | ||
148 | _SYSDEV_ULONG_ATTR(_name, _mode, _var); | ||
149 | #define _SYSDEV_INT_ATTR(_name, _mode, _var) \ | ||
150 | { _SYSDEV_ATTR(_name, _mode, sysdev_show_int, sysdev_store_int), \ | ||
151 | &(_var) } | ||
152 | #define SYSDEV_INT_ATTR(_name, _mode, _var) \ | ||
153 | struct sysdev_ext_attribute attr_##_name = \ | ||
154 | _SYSDEV_INT_ATTR(_name, _mode, _var); | ||
155 | |||
121 | #endif /* _SYSDEV_H_ */ | 156 | #endif /* _SYSDEV_H_ */ |
diff --git a/include/linux/sysfs.h b/include/linux/sysfs.h index 7858eac40aa7..37fa24152bd8 100644 --- a/include/linux/sysfs.h +++ b/include/linux/sysfs.h | |||
@@ -101,6 +101,9 @@ void sysfs_remove_bin_file(struct kobject *kobj, struct bin_attribute *attr); | |||
101 | 101 | ||
102 | int __must_check sysfs_create_link(struct kobject *kobj, struct kobject *target, | 102 | int __must_check sysfs_create_link(struct kobject *kobj, struct kobject *target, |
103 | const char *name); | 103 | const char *name); |
104 | int __must_check sysfs_create_link_nowarn(struct kobject *kobj, | ||
105 | struct kobject *target, | ||
106 | const char *name); | ||
104 | void sysfs_remove_link(struct kobject *kobj, const char *name); | 107 | void sysfs_remove_link(struct kobject *kobj, const char *name); |
105 | 108 | ||
106 | int __must_check sysfs_create_group(struct kobject *kobj, | 109 | int __must_check sysfs_create_group(struct kobject *kobj, |
@@ -180,6 +183,13 @@ static inline int sysfs_create_link(struct kobject *kobj, | |||
180 | return 0; | 183 | return 0; |
181 | } | 184 | } |
182 | 185 | ||
186 | static inline int sysfs_create_link_nowarn(struct kobject *kobj, | ||
187 | struct kobject *target, | ||
188 | const char *name) | ||
189 | { | ||
190 | return 0; | ||
191 | } | ||
192 | |||
183 | static inline void sysfs_remove_link(struct kobject *kobj, const char *name) | 193 | static inline void sysfs_remove_link(struct kobject *kobj, const char *name) |
184 | { | 194 | { |
185 | } | 195 | } |
diff --git a/include/linux/task_io_accounting.h b/include/linux/task_io_accounting.h index 44d00e9cceea..5e88afc9a2fb 100644 --- a/include/linux/task_io_accounting.h +++ b/include/linux/task_io_accounting.h | |||
@@ -8,8 +8,19 @@ | |||
8 | * Blame akpm@osdl.org for all this. | 8 | * Blame akpm@osdl.org for all this. |
9 | */ | 9 | */ |
10 | 10 | ||
11 | #ifdef CONFIG_TASK_IO_ACCOUNTING | ||
12 | struct task_io_accounting { | 11 | struct task_io_accounting { |
12 | #ifdef CONFIG_TASK_XACCT | ||
13 | /* bytes read */ | ||
14 | u64 rchar; | ||
15 | /* bytes written */ | ||
16 | u64 wchar; | ||
17 | /* # of read syscalls */ | ||
18 | u64 syscr; | ||
19 | /* # of write syscalls */ | ||
20 | u64 syscw; | ||
21 | #endif /* CONFIG_TASK_XACCT */ | ||
22 | |||
23 | #ifdef CONFIG_TASK_IO_ACCOUNTING | ||
13 | /* | 24 | /* |
14 | * The number of bytes which this task has caused to be read from | 25 | * The number of bytes which this task has caused to be read from |
15 | * storage. | 26 | * storage. |
@@ -30,8 +41,5 @@ struct task_io_accounting { | |||
30 | * information loss in doing that. | 41 | * information loss in doing that. |
31 | */ | 42 | */ |
32 | u64 cancelled_write_bytes; | 43 | u64 cancelled_write_bytes; |
44 | #endif /* CONFIG_TASK_IO_ACCOUNTING */ | ||
33 | }; | 45 | }; |
34 | #else | ||
35 | struct task_io_accounting { | ||
36 | }; | ||
37 | #endif | ||
diff --git a/include/linux/task_io_accounting_ops.h b/include/linux/task_io_accounting_ops.h index ff46c6fad79d..4d090f9ee608 100644 --- a/include/linux/task_io_accounting_ops.h +++ b/include/linux/task_io_accounting_ops.h | |||
@@ -40,9 +40,17 @@ static inline void task_io_account_cancelled_write(size_t bytes) | |||
40 | current->ioac.cancelled_write_bytes += bytes; | 40 | current->ioac.cancelled_write_bytes += bytes; |
41 | } | 41 | } |
42 | 42 | ||
43 | static inline void task_io_accounting_init(struct task_struct *tsk) | 43 | static inline void task_io_accounting_init(struct task_io_accounting *ioac) |
44 | { | 44 | { |
45 | memset(&tsk->ioac, 0, sizeof(tsk->ioac)); | 45 | memset(ioac, 0, sizeof(*ioac)); |
46 | } | ||
47 | |||
48 | static inline void task_blk_io_accounting_add(struct task_io_accounting *dst, | ||
49 | struct task_io_accounting *src) | ||
50 | { | ||
51 | dst->read_bytes += src->read_bytes; | ||
52 | dst->write_bytes += src->write_bytes; | ||
53 | dst->cancelled_write_bytes += src->cancelled_write_bytes; | ||
46 | } | 54 | } |
47 | 55 | ||
48 | #else | 56 | #else |
@@ -69,9 +77,37 @@ static inline void task_io_account_cancelled_write(size_t bytes) | |||
69 | { | 77 | { |
70 | } | 78 | } |
71 | 79 | ||
72 | static inline void task_io_accounting_init(struct task_struct *tsk) | 80 | static inline void task_io_accounting_init(struct task_io_accounting *ioac) |
81 | { | ||
82 | } | ||
83 | |||
84 | static inline void task_blk_io_accounting_add(struct task_io_accounting *dst, | ||
85 | struct task_io_accounting *src) | ||
73 | { | 86 | { |
74 | } | 87 | } |
75 | 88 | ||
76 | #endif /* CONFIG_TASK_IO_ACCOUNTING */ | 89 | #endif /* CONFIG_TASK_IO_ACCOUNTING */ |
77 | #endif /* __TASK_IO_ACCOUNTING_OPS_INCLUDED */ | 90 | |
91 | #ifdef CONFIG_TASK_XACCT | ||
92 | static inline void task_chr_io_accounting_add(struct task_io_accounting *dst, | ||
93 | struct task_io_accounting *src) | ||
94 | { | ||
95 | dst->rchar += src->rchar; | ||
96 | dst->wchar += src->wchar; | ||
97 | dst->syscr += src->syscr; | ||
98 | dst->syscw += src->syscw; | ||
99 | } | ||
100 | #else | ||
101 | static inline void task_chr_io_accounting_add(struct task_io_accounting *dst, | ||
102 | struct task_io_accounting *src) | ||
103 | { | ||
104 | } | ||
105 | #endif /* CONFIG_TASK_XACCT */ | ||
106 | |||
107 | static inline void task_io_accounting_add(struct task_io_accounting *dst, | ||
108 | struct task_io_accounting *src) | ||
109 | { | ||
110 | task_chr_io_accounting_add(dst, src); | ||
111 | task_blk_io_accounting_add(dst, src); | ||
112 | } | ||
113 | #endif /* __TASK_IO_ACCOUNTING_OPS_INCLUDED */ | ||
diff --git a/include/linux/taskstats.h b/include/linux/taskstats.h index 5d69c0744fff..18269e956a71 100644 --- a/include/linux/taskstats.h +++ b/include/linux/taskstats.h | |||
@@ -31,7 +31,7 @@ | |||
31 | */ | 31 | */ |
32 | 32 | ||
33 | 33 | ||
34 | #define TASKSTATS_VERSION 6 | 34 | #define TASKSTATS_VERSION 7 |
35 | #define TS_COMM_LEN 32 /* should be >= TASK_COMM_LEN | 35 | #define TS_COMM_LEN 32 /* should be >= TASK_COMM_LEN |
36 | * in linux/sched.h */ | 36 | * in linux/sched.h */ |
37 | 37 | ||
@@ -157,6 +157,10 @@ struct taskstats { | |||
157 | __u64 ac_utimescaled; /* utime scaled on frequency etc */ | 157 | __u64 ac_utimescaled; /* utime scaled on frequency etc */ |
158 | __u64 ac_stimescaled; /* stime scaled on frequency etc */ | 158 | __u64 ac_stimescaled; /* stime scaled on frequency etc */ |
159 | __u64 cpu_scaled_run_real_total; /* scaled cpu_run_real_total */ | 159 | __u64 cpu_scaled_run_real_total; /* scaled cpu_run_real_total */ |
160 | |||
161 | /* Delay waiting for memory reclaim */ | ||
162 | __u64 freepages_count; | ||
163 | __u64 freepages_delay_total; | ||
160 | }; | 164 | }; |
161 | 165 | ||
162 | 166 | ||
diff --git a/include/linux/tc_act/Kbuild b/include/linux/tc_act/Kbuild index 6dac0d7365cc..76990937f4c9 100644 --- a/include/linux/tc_act/Kbuild +++ b/include/linux/tc_act/Kbuild | |||
@@ -3,3 +3,4 @@ header-y += tc_ipt.h | |||
3 | header-y += tc_mirred.h | 3 | header-y += tc_mirred.h |
4 | header-y += tc_pedit.h | 4 | header-y += tc_pedit.h |
5 | header-y += tc_nat.h | 5 | header-y += tc_nat.h |
6 | header-y += tc_skbedit.h | ||
diff --git a/include/linux/tc_act/tc_skbedit.h b/include/linux/tc_act/tc_skbedit.h new file mode 100644 index 000000000000..a14e461a7af7 --- /dev/null +++ b/include/linux/tc_act/tc_skbedit.h | |||
@@ -0,0 +1,44 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2008, Intel Corporation. | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify it | ||
5 | * under the terms and conditions of the GNU General Public License, | ||
6 | * version 2, as published by the Free Software Foundation. | ||
7 | * | ||
8 | * This program is distributed in the hope it will be useful, but WITHOUT | ||
9 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
10 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
11 | * more details. | ||
12 | * | ||
13 | * You should have received a copy of the GNU General Public License along with | ||
14 | * this program; if not, write to the Free Software Foundation, Inc., 59 Temple | ||
15 | * Place - Suite 330, Boston, MA 02111-1307 USA. | ||
16 | * | ||
17 | * Author: Alexander Duyck <alexander.h.duyck@intel.com> | ||
18 | */ | ||
19 | |||
20 | #ifndef __LINUX_TC_SKBEDIT_H | ||
21 | #define __LINUX_TC_SKBEDIT_H | ||
22 | |||
23 | #include <linux/pkt_cls.h> | ||
24 | |||
25 | #define TCA_ACT_SKBEDIT 11 | ||
26 | |||
27 | #define SKBEDIT_F_PRIORITY 0x1 | ||
28 | #define SKBEDIT_F_QUEUE_MAPPING 0x2 | ||
29 | |||
30 | struct tc_skbedit { | ||
31 | tc_gen; | ||
32 | }; | ||
33 | |||
34 | enum { | ||
35 | TCA_SKBEDIT_UNSPEC, | ||
36 | TCA_SKBEDIT_TM, | ||
37 | TCA_SKBEDIT_PARMS, | ||
38 | TCA_SKBEDIT_PRIORITY, | ||
39 | TCA_SKBEDIT_QUEUE_MAPPING, | ||
40 | __TCA_SKBEDIT_MAX | ||
41 | }; | ||
42 | #define TCA_SKBEDIT_MAX (__TCA_SKBEDIT_MAX - 1) | ||
43 | |||
44 | #endif | ||
diff --git a/include/linux/tcp.h b/include/linux/tcp.h index b31b6b74aa28..fe77e1499ab7 100644 --- a/include/linux/tcp.h +++ b/include/linux/tcp.h | |||
@@ -224,6 +224,12 @@ struct tcp_options_received { | |||
224 | u16 mss_clamp; /* Maximal mss, negotiated at connection setup */ | 224 | u16 mss_clamp; /* Maximal mss, negotiated at connection setup */ |
225 | }; | 225 | }; |
226 | 226 | ||
227 | /* This is the max number of SACKS that we'll generate and process. It's safe | ||
228 | * to increse this, although since: | ||
229 | * size = TCPOLEN_SACK_BASE_ALIGNED (4) + n * TCPOLEN_SACK_PERBLOCK (8) | ||
230 | * only four options will fit in a standard TCP header */ | ||
231 | #define TCP_NUM_SACKS 4 | ||
232 | |||
227 | struct tcp_request_sock { | 233 | struct tcp_request_sock { |
228 | struct inet_request_sock req; | 234 | struct inet_request_sock req; |
229 | #ifdef CONFIG_TCP_MD5SIG | 235 | #ifdef CONFIG_TCP_MD5SIG |
@@ -291,10 +297,9 @@ struct tcp_sock { | |||
291 | u32 rcv_ssthresh; /* Current window clamp */ | 297 | u32 rcv_ssthresh; /* Current window clamp */ |
292 | 298 | ||
293 | u32 frto_highmark; /* snd_nxt when RTO occurred */ | 299 | u32 frto_highmark; /* snd_nxt when RTO occurred */ |
294 | u8 reordering; /* Packet reordering metric. */ | 300 | u16 advmss; /* Advertised MSS */ |
295 | u8 frto_counter; /* Number of new acks after RTO */ | 301 | u8 frto_counter; /* Number of new acks after RTO */ |
296 | u8 nonagle; /* Disable Nagle algorithm? */ | 302 | u8 nonagle; /* Disable Nagle algorithm? */ |
297 | u8 keepalive_probes; /* num of allowed keep alive probes */ | ||
298 | 303 | ||
299 | /* RTT measurement */ | 304 | /* RTT measurement */ |
300 | u32 srtt; /* smoothed round trip time << 3 */ | 305 | u32 srtt; /* smoothed round trip time << 3 */ |
@@ -305,6 +310,13 @@ struct tcp_sock { | |||
305 | 310 | ||
306 | u32 packets_out; /* Packets which are "in flight" */ | 311 | u32 packets_out; /* Packets which are "in flight" */ |
307 | u32 retrans_out; /* Retransmitted packets out */ | 312 | u32 retrans_out; /* Retransmitted packets out */ |
313 | |||
314 | u16 urg_data; /* Saved octet of OOB data and control flags */ | ||
315 | u8 ecn_flags; /* ECN status bits. */ | ||
316 | u8 reordering; /* Packet reordering metric. */ | ||
317 | u32 snd_up; /* Urgent pointer */ | ||
318 | |||
319 | u8 keepalive_probes; /* num of allowed keep alive probes */ | ||
308 | /* | 320 | /* |
309 | * Options received (usually on last packet, some only on SYN packets). | 321 | * Options received (usually on last packet, some only on SYN packets). |
310 | */ | 322 | */ |
@@ -320,13 +332,23 @@ struct tcp_sock { | |||
320 | u32 snd_cwnd_used; | 332 | u32 snd_cwnd_used; |
321 | u32 snd_cwnd_stamp; | 333 | u32 snd_cwnd_stamp; |
322 | 334 | ||
323 | struct sk_buff_head out_of_order_queue; /* Out of order segments go here */ | ||
324 | |||
325 | u32 rcv_wnd; /* Current receiver window */ | 335 | u32 rcv_wnd; /* Current receiver window */ |
326 | u32 write_seq; /* Tail(+1) of data held in tcp send buffer */ | 336 | u32 write_seq; /* Tail(+1) of data held in tcp send buffer */ |
327 | u32 pushed_seq; /* Last pushed seq, required to talk to windows */ | 337 | u32 pushed_seq; /* Last pushed seq, required to talk to windows */ |
338 | u32 lost_out; /* Lost packets */ | ||
339 | u32 sacked_out; /* SACK'd packets */ | ||
340 | u32 fackets_out; /* FACK'd packets */ | ||
341 | u32 tso_deferred; | ||
342 | u32 bytes_acked; /* Appropriate Byte Counting - RFC3465 */ | ||
328 | 343 | ||
329 | /* SACKs data */ | 344 | /* from STCP, retrans queue hinting */ |
345 | struct sk_buff* lost_skb_hint; | ||
346 | struct sk_buff *scoreboard_skb_hint; | ||
347 | struct sk_buff *retransmit_skb_hint; | ||
348 | |||
349 | struct sk_buff_head out_of_order_queue; /* Out of order segments go here */ | ||
350 | |||
351 | /* SACKs data, these 2 need to be together (see tcp_build_and_update_options) */ | ||
330 | struct tcp_sack_block duplicate_sack[1]; /* D-SACK block */ | 352 | struct tcp_sack_block duplicate_sack[1]; /* D-SACK block */ |
331 | struct tcp_sack_block selective_acks[4]; /* The SACKS themselves*/ | 353 | struct tcp_sack_block selective_acks[4]; /* The SACKS themselves*/ |
332 | 354 | ||
@@ -337,23 +359,12 @@ struct tcp_sock { | |||
337 | * sacked_out > 0) | 359 | * sacked_out > 0) |
338 | */ | 360 | */ |
339 | 361 | ||
340 | /* from STCP, retrans queue hinting */ | ||
341 | struct sk_buff* lost_skb_hint; | ||
342 | |||
343 | struct sk_buff *scoreboard_skb_hint; | ||
344 | struct sk_buff *retransmit_skb_hint; | ||
345 | struct sk_buff *forward_skb_hint; | ||
346 | |||
347 | int lost_cnt_hint; | 362 | int lost_cnt_hint; |
348 | int retransmit_cnt_hint; | 363 | u32 retransmit_high; /* L-bits may be on up to this seqno */ |
349 | 364 | ||
350 | u32 lost_retrans_low; /* Sent seq after any rxmit (lowest) */ | 365 | u32 lost_retrans_low; /* Sent seq after any rxmit (lowest) */ |
351 | 366 | ||
352 | u16 advmss; /* Advertised MSS */ | ||
353 | u32 prior_ssthresh; /* ssthresh saved at recovery start */ | 367 | u32 prior_ssthresh; /* ssthresh saved at recovery start */ |
354 | u32 lost_out; /* Lost packets */ | ||
355 | u32 sacked_out; /* SACK'd packets */ | ||
356 | u32 fackets_out; /* FACK'd packets */ | ||
357 | u32 high_seq; /* snd_nxt at onset of congestion */ | 368 | u32 high_seq; /* snd_nxt at onset of congestion */ |
358 | 369 | ||
359 | u32 retrans_stamp; /* Timestamp of the last retransmit, | 370 | u32 retrans_stamp; /* Timestamp of the last retransmit, |
@@ -361,23 +372,14 @@ struct tcp_sock { | |||
361 | * the first SYN. */ | 372 | * the first SYN. */ |
362 | u32 undo_marker; /* tracking retrans started here. */ | 373 | u32 undo_marker; /* tracking retrans started here. */ |
363 | int undo_retrans; /* number of undoable retransmissions. */ | 374 | int undo_retrans; /* number of undoable retransmissions. */ |
364 | u32 urg_seq; /* Seq of received urgent pointer */ | ||
365 | u16 urg_data; /* Saved octet of OOB data and control flags */ | ||
366 | u8 urg_mode; /* In urgent mode */ | ||
367 | u8 ecn_flags; /* ECN status bits. */ | ||
368 | u32 snd_up; /* Urgent pointer */ | ||
369 | |||
370 | u32 total_retrans; /* Total retransmits for entire connection */ | 375 | u32 total_retrans; /* Total retransmits for entire connection */ |
371 | u32 bytes_acked; /* Appropriate Byte Counting - RFC3465 */ | ||
372 | 376 | ||
377 | u32 urg_seq; /* Seq of received urgent pointer */ | ||
373 | unsigned int keepalive_time; /* time before keep alive takes place */ | 378 | unsigned int keepalive_time; /* time before keep alive takes place */ |
374 | unsigned int keepalive_intvl; /* time interval between keep alive probes */ | 379 | unsigned int keepalive_intvl; /* time interval between keep alive probes */ |
375 | int linger2; | ||
376 | 380 | ||
377 | unsigned long last_synq_overflow; | 381 | unsigned long last_synq_overflow; |
378 | 382 | ||
379 | u32 tso_deferred; | ||
380 | |||
381 | /* Receiver side RTT estimation */ | 383 | /* Receiver side RTT estimation */ |
382 | struct { | 384 | struct { |
383 | u32 rtt; | 385 | u32 rtt; |
@@ -405,6 +407,8 @@ struct tcp_sock { | |||
405 | /* TCP MD5 Signagure Option information */ | 407 | /* TCP MD5 Signagure Option information */ |
406 | struct tcp_md5sig_info *md5sig_info; | 408 | struct tcp_md5sig_info *md5sig_info; |
407 | #endif | 409 | #endif |
410 | |||
411 | int linger2; | ||
408 | }; | 412 | }; |
409 | 413 | ||
410 | static inline struct tcp_sock *tcp_sk(const struct sock *sk) | 414 | static inline struct tcp_sock *tcp_sk(const struct sock *sk) |
diff --git a/include/linux/termios.h b/include/linux/termios.h index 478662889f48..2acd0c1f8a2a 100644 --- a/include/linux/termios.h +++ b/include/linux/termios.h | |||
@@ -4,4 +4,19 @@ | |||
4 | #include <linux/types.h> | 4 | #include <linux/types.h> |
5 | #include <asm/termios.h> | 5 | #include <asm/termios.h> |
6 | 6 | ||
7 | #define NFF 5 | ||
8 | |||
9 | struct termiox | ||
10 | { | ||
11 | __u16 x_hflag; | ||
12 | __u16 x_cflag; | ||
13 | __u16 x_rflag[NFF]; | ||
14 | __u16 x_sflag; | ||
15 | }; | ||
16 | |||
17 | #define RTSXOFF 0x0001 /* RTS flow control on input */ | ||
18 | #define CTSXON 0x0002 /* CTS flow control on output */ | ||
19 | #define DTRXOFF 0x0004 /* DTR flow control on input */ | ||
20 | #define DSRXON 0x0008 /* DCD flow control on output */ | ||
21 | |||
7 | #endif | 22 | #endif |
diff --git a/include/linux/textsearch.h b/include/linux/textsearch.h index 6f371f24160b..d9a85d616385 100644 --- a/include/linux/textsearch.h +++ b/include/linux/textsearch.h | |||
@@ -10,10 +10,8 @@ | |||
10 | 10 | ||
11 | struct ts_config; | 11 | struct ts_config; |
12 | 12 | ||
13 | /** | 13 | #define TS_AUTOLOAD 1 /* Automatically load textsearch modules when needed */ |
14 | * TS_AUTOLOAD - Automatically load textsearch modules when needed | 14 | #define TS_IGNORECASE 2 /* Searches string case insensitively */ |
15 | */ | ||
16 | #define TS_AUTOLOAD 1 | ||
17 | 15 | ||
18 | /** | 16 | /** |
19 | * struct ts_state - search state | 17 | * struct ts_state - search state |
@@ -39,7 +37,7 @@ struct ts_state | |||
39 | struct ts_ops | 37 | struct ts_ops |
40 | { | 38 | { |
41 | const char *name; | 39 | const char *name; |
42 | struct ts_config * (*init)(const void *, unsigned int, gfp_t); | 40 | struct ts_config * (*init)(const void *, unsigned int, gfp_t, int); |
43 | unsigned int (*find)(struct ts_config *, | 41 | unsigned int (*find)(struct ts_config *, |
44 | struct ts_state *); | 42 | struct ts_state *); |
45 | void (*destroy)(struct ts_config *); | 43 | void (*destroy)(struct ts_config *); |
@@ -52,12 +50,14 @@ struct ts_ops | |||
52 | /** | 50 | /** |
53 | * struct ts_config - search configuration | 51 | * struct ts_config - search configuration |
54 | * @ops: operations of chosen algorithm | 52 | * @ops: operations of chosen algorithm |
53 | * @flags: flags | ||
55 | * @get_next_block: callback to fetch the next block to search in | 54 | * @get_next_block: callback to fetch the next block to search in |
56 | * @finish: callback to finalize a search | 55 | * @finish: callback to finalize a search |
57 | */ | 56 | */ |
58 | struct ts_config | 57 | struct ts_config |
59 | { | 58 | { |
60 | struct ts_ops *ops; | 59 | struct ts_ops *ops; |
60 | int flags; | ||
61 | 61 | ||
62 | /** | 62 | /** |
63 | * get_next_block - fetch next block of data | 63 | * get_next_block - fetch next block of data |
@@ -162,11 +162,10 @@ static inline struct ts_config *alloc_ts_config(size_t payload, | |||
162 | { | 162 | { |
163 | struct ts_config *conf; | 163 | struct ts_config *conf; |
164 | 164 | ||
165 | conf = kmalloc(TS_PRIV_ALIGN(sizeof(*conf)) + payload, gfp_mask); | 165 | conf = kzalloc(TS_PRIV_ALIGN(sizeof(*conf)) + payload, gfp_mask); |
166 | if (conf == NULL) | 166 | if (conf == NULL) |
167 | return ERR_PTR(-ENOMEM); | 167 | return ERR_PTR(-ENOMEM); |
168 | 168 | ||
169 | memset(conf, 0, TS_PRIV_ALIGN(sizeof(*conf)) + payload); | ||
170 | return conf; | 169 | return conf; |
171 | } | 170 | } |
172 | 171 | ||
diff --git a/include/linux/thermal.h b/include/linux/thermal.h index 06d3e6eb9ca8..917707e6151d 100644 --- a/include/linux/thermal.h +++ b/include/linux/thermal.h | |||
@@ -66,8 +66,7 @@ struct thermal_cooling_device { | |||
66 | ((long)t-2732+5)/10 : ((long)t-2732-5)/10) | 66 | ((long)t-2732+5)/10 : ((long)t-2732-5)/10) |
67 | #define CELSIUS_TO_KELVIN(t) ((t)*10+2732) | 67 | #define CELSIUS_TO_KELVIN(t) ((t)*10+2732) |
68 | 68 | ||
69 | #if defined(CONFIG_HWMON) || \ | 69 | #if defined(CONFIG_THERMAL_HWMON) |
70 | (defined(CONFIG_HWMON_MODULE) && defined(CONFIG_THERMAL_MODULE)) | ||
71 | /* thermal zone devices with the same type share one hwmon device */ | 70 | /* thermal zone devices with the same type share one hwmon device */ |
72 | struct thermal_hwmon_device { | 71 | struct thermal_hwmon_device { |
73 | char type[THERMAL_NAME_LENGTH]; | 72 | char type[THERMAL_NAME_LENGTH]; |
@@ -94,8 +93,7 @@ struct thermal_zone_device { | |||
94 | struct idr idr; | 93 | struct idr idr; |
95 | struct mutex lock; /* protect cooling devices list */ | 94 | struct mutex lock; /* protect cooling devices list */ |
96 | struct list_head node; | 95 | struct list_head node; |
97 | #if defined(CONFIG_HWMON) || \ | 96 | #if defined(CONFIG_THERMAL_HWMON) |
98 | (defined(CONFIG_HWMON_MODULE) && defined(CONFIG_THERMAL_MODULE)) | ||
99 | struct list_head hwmon_node; | 97 | struct list_head hwmon_node; |
100 | struct thermal_hwmon_device *hwmon; | 98 | struct thermal_hwmon_device *hwmon; |
101 | struct thermal_hwmon_attr temp_input; /* hwmon sys attr */ | 99 | struct thermal_hwmon_attr temp_input; /* hwmon sys attr */ |
diff --git a/include/linux/tick.h b/include/linux/tick.h index a881c652f7e9..98921a3e1aa8 100644 --- a/include/linux/tick.h +++ b/include/linux/tick.h | |||
@@ -49,6 +49,7 @@ struct tick_sched { | |||
49 | unsigned long check_clocks; | 49 | unsigned long check_clocks; |
50 | enum tick_nohz_mode nohz_mode; | 50 | enum tick_nohz_mode nohz_mode; |
51 | ktime_t idle_tick; | 51 | ktime_t idle_tick; |
52 | int inidle; | ||
52 | int tick_stopped; | 53 | int tick_stopped; |
53 | unsigned long idle_jiffies; | 54 | unsigned long idle_jiffies; |
54 | unsigned long idle_calls; | 55 | unsigned long idle_calls; |
@@ -73,10 +74,13 @@ extern struct tick_device *tick_get_device(int cpu); | |||
73 | extern int tick_init_highres(void); | 74 | extern int tick_init_highres(void); |
74 | extern int tick_program_event(ktime_t expires, int force); | 75 | extern int tick_program_event(ktime_t expires, int force); |
75 | extern void tick_setup_sched_timer(void); | 76 | extern void tick_setup_sched_timer(void); |
77 | # endif | ||
78 | |||
79 | # if defined CONFIG_NO_HZ || defined CONFIG_HIGH_RES_TIMERS | ||
76 | extern void tick_cancel_sched_timer(int cpu); | 80 | extern void tick_cancel_sched_timer(int cpu); |
77 | # else | 81 | # else |
78 | static inline void tick_cancel_sched_timer(int cpu) { } | 82 | static inline void tick_cancel_sched_timer(int cpu) { } |
79 | # endif /* HIGHRES */ | 83 | # endif |
80 | 84 | ||
81 | # ifdef CONFIG_GENERIC_CLOCKEVENTS_BROADCAST | 85 | # ifdef CONFIG_GENERIC_CLOCKEVENTS_BROADCAST |
82 | extern struct tick_device *tick_get_broadcast_device(void); | 86 | extern struct tick_device *tick_get_broadcast_device(void); |
@@ -105,14 +109,14 @@ static inline int tick_check_oneshot_change(int allow_nohz) { return 0; } | |||
105 | #endif /* !CONFIG_GENERIC_CLOCKEVENTS */ | 109 | #endif /* !CONFIG_GENERIC_CLOCKEVENTS */ |
106 | 110 | ||
107 | # ifdef CONFIG_NO_HZ | 111 | # ifdef CONFIG_NO_HZ |
108 | extern void tick_nohz_stop_sched_tick(void); | 112 | extern void tick_nohz_stop_sched_tick(int inidle); |
109 | extern void tick_nohz_restart_sched_tick(void); | 113 | extern void tick_nohz_restart_sched_tick(void); |
110 | extern void tick_nohz_update_jiffies(void); | 114 | extern void tick_nohz_update_jiffies(void); |
111 | extern ktime_t tick_nohz_get_sleep_length(void); | 115 | extern ktime_t tick_nohz_get_sleep_length(void); |
112 | extern void tick_nohz_stop_idle(int cpu); | 116 | extern void tick_nohz_stop_idle(int cpu); |
113 | extern u64 get_cpu_idle_time_us(int cpu, u64 *last_update_time); | 117 | extern u64 get_cpu_idle_time_us(int cpu, u64 *last_update_time); |
114 | # else | 118 | # else |
115 | static inline void tick_nohz_stop_sched_tick(void) { } | 119 | static inline void tick_nohz_stop_sched_tick(int inidle) { } |
116 | static inline void tick_nohz_restart_sched_tick(void) { } | 120 | static inline void tick_nohz_restart_sched_tick(void) { } |
117 | static inline void tick_nohz_update_jiffies(void) { } | 121 | static inline void tick_nohz_update_jiffies(void) { } |
118 | static inline ktime_t tick_nohz_get_sleep_length(void) | 122 | static inline ktime_t tick_nohz_get_sleep_length(void) |
@@ -122,7 +126,7 @@ static inline ktime_t tick_nohz_get_sleep_length(void) | |||
122 | return len; | 126 | return len; |
123 | } | 127 | } |
124 | static inline void tick_nohz_stop_idle(int cpu) { } | 128 | static inline void tick_nohz_stop_idle(int cpu) { } |
125 | static inline u64 get_cpu_idle_time_us(int cpu, u64 *unused) { return 0; } | 129 | static inline u64 get_cpu_idle_time_us(int cpu, u64 *unused) { return -1; } |
126 | # endif /* !NO_HZ */ | 130 | # endif /* !NO_HZ */ |
127 | 131 | ||
128 | #endif | 132 | #endif |
diff --git a/include/linux/timerfd.h b/include/linux/timerfd.h index cf2b10d75731..86cb0501d3e2 100644 --- a/include/linux/timerfd.h +++ b/include/linux/timerfd.h | |||
@@ -8,9 +8,15 @@ | |||
8 | #ifndef _LINUX_TIMERFD_H | 8 | #ifndef _LINUX_TIMERFD_H |
9 | #define _LINUX_TIMERFD_H | 9 | #define _LINUX_TIMERFD_H |
10 | 10 | ||
11 | /* For O_CLOEXEC and O_NONBLOCK */ | ||
12 | #include <linux/fcntl.h> | ||
11 | 13 | ||
14 | /* Flags for timerfd_settime. */ | ||
12 | #define TFD_TIMER_ABSTIME (1 << 0) | 15 | #define TFD_TIMER_ABSTIME (1 << 0) |
13 | 16 | ||
17 | /* Flags for timerfd_create. */ | ||
18 | #define TFD_CLOEXEC O_CLOEXEC | ||
19 | #define TFD_NONBLOCK O_NONBLOCK | ||
14 | 20 | ||
15 | 21 | ||
16 | #endif /* _LINUX_TIMERFD_H */ | 22 | #endif /* _LINUX_TIMERFD_H */ |
diff --git a/include/linux/tipc_config.h b/include/linux/tipc_config.h index b0c916d1f375..2bc6fa4adeb5 100644 --- a/include/linux/tipc_config.h +++ b/include/linux/tipc_config.h | |||
@@ -2,7 +2,7 @@ | |||
2 | * include/linux/tipc_config.h: Include file for TIPC configuration interface | 2 | * include/linux/tipc_config.h: Include file for TIPC configuration interface |
3 | * | 3 | * |
4 | * Copyright (c) 2003-2006, Ericsson AB | 4 | * Copyright (c) 2003-2006, Ericsson AB |
5 | * Copyright (c) 2005, Wind River Systems | 5 | * Copyright (c) 2005-2007, Wind River Systems |
6 | * All rights reserved. | 6 | * All rights reserved. |
7 | * | 7 | * |
8 | * Redistribution and use in source and binary forms, with or without | 8 | * Redistribution and use in source and binary forms, with or without |
@@ -136,6 +136,14 @@ | |||
136 | #define TIPC_CMD_SET_NETID 0x800B /* tx unsigned, rx none */ | 136 | #define TIPC_CMD_SET_NETID 0x800B /* tx unsigned, rx none */ |
137 | 137 | ||
138 | /* | 138 | /* |
139 | * Reserved commands: | ||
140 | * May not be issued by any process. | ||
141 | * Used internally by TIPC. | ||
142 | */ | ||
143 | |||
144 | #define TIPC_CMD_NOT_NET_ADMIN 0xC001 /* tx none, rx none */ | ||
145 | |||
146 | /* | ||
139 | * TLV types defined for TIPC | 147 | * TLV types defined for TIPC |
140 | */ | 148 | */ |
141 | 149 | ||
diff --git a/include/linux/topology.h b/include/linux/topology.h index 24f3d2282e11..2158fc0d5a56 100644 --- a/include/linux/topology.h +++ b/include/linux/topology.h | |||
@@ -179,4 +179,17 @@ void arch_update_cpu_topology(void); | |||
179 | #endif | 179 | #endif |
180 | #endif /* CONFIG_NUMA */ | 180 | #endif /* CONFIG_NUMA */ |
181 | 181 | ||
182 | #ifndef topology_physical_package_id | ||
183 | #define topology_physical_package_id(cpu) ((void)(cpu), -1) | ||
184 | #endif | ||
185 | #ifndef topology_core_id | ||
186 | #define topology_core_id(cpu) ((void)(cpu), 0) | ||
187 | #endif | ||
188 | #ifndef topology_thread_siblings | ||
189 | #define topology_thread_siblings(cpu) cpumask_of_cpu(cpu) | ||
190 | #endif | ||
191 | #ifndef topology_core_siblings | ||
192 | #define topology_core_siblings(cpu) cpumask_of_cpu(cpu) | ||
193 | #endif | ||
194 | |||
182 | #endif /* _LINUX_TOPOLOGY_H */ | 195 | #endif /* _LINUX_TOPOLOGY_H */ |
diff --git a/include/linux/tracehook.h b/include/linux/tracehook.h new file mode 100644 index 000000000000..6186a789d6c7 --- /dev/null +++ b/include/linux/tracehook.h | |||
@@ -0,0 +1,582 @@ | |||
1 | /* | ||
2 | * Tracing hooks | ||
3 | * | ||
4 | * Copyright (C) 2008 Red Hat, Inc. All rights reserved. | ||
5 | * | ||
6 | * This copyrighted material is made available to anyone wishing to use, | ||
7 | * modify, copy, or redistribute it subject to the terms and conditions | ||
8 | * of the GNU General Public License v.2. | ||
9 | * | ||
10 | * This file defines hook entry points called by core code where | ||
11 | * user tracing/debugging support might need to do something. These | ||
12 | * entry points are called tracehook_*(). Each hook declared below | ||
13 | * has a detailed kerneldoc comment giving the context (locking et | ||
14 | * al) from which it is called, and the meaning of its return value. | ||
15 | * | ||
16 | * Each function here typically has only one call site, so it is ok | ||
17 | * to have some nontrivial tracehook_*() inlines. In all cases, the | ||
18 | * fast path when no tracing is enabled should be very short. | ||
19 | * | ||
20 | * The purpose of this file and the tracehook_* layer is to consolidate | ||
21 | * the interface that the kernel core and arch code uses to enable any | ||
22 | * user debugging or tracing facility (such as ptrace). The interfaces | ||
23 | * here are carefully documented so that maintainers of core and arch | ||
24 | * code do not need to think about the implementation details of the | ||
25 | * tracing facilities. Likewise, maintainers of the tracing code do not | ||
26 | * need to understand all the calling core or arch code in detail, just | ||
27 | * documented circumstances of each call, such as locking conditions. | ||
28 | * | ||
29 | * If the calling core code changes so that locking is different, then | ||
30 | * it is ok to change the interface documented here. The maintainer of | ||
31 | * core code changing should notify the maintainers of the tracing code | ||
32 | * that they need to work out the change. | ||
33 | * | ||
34 | * Some tracehook_*() inlines take arguments that the current tracing | ||
35 | * implementations might not necessarily use. These function signatures | ||
36 | * are chosen to pass in all the information that is on hand in the | ||
37 | * caller and might conceivably be relevant to a tracer, so that the | ||
38 | * core code won't have to be updated when tracing adds more features. | ||
39 | * If a call site changes so that some of those parameters are no longer | ||
40 | * already on hand without extra work, then the tracehook_* interface | ||
41 | * can change so there is no make-work burden on the core code. The | ||
42 | * maintainer of core code changing should notify the maintainers of the | ||
43 | * tracing code that they need to work out the change. | ||
44 | */ | ||
45 | |||
46 | #ifndef _LINUX_TRACEHOOK_H | ||
47 | #define _LINUX_TRACEHOOK_H 1 | ||
48 | |||
49 | #include <linux/sched.h> | ||
50 | #include <linux/ptrace.h> | ||
51 | #include <linux/security.h> | ||
52 | struct linux_binprm; | ||
53 | |||
54 | /** | ||
55 | * tracehook_expect_breakpoints - guess if task memory might be touched | ||
56 | * @task: current task, making a new mapping | ||
57 | * | ||
58 | * Return nonzero if @task is expected to want breakpoint insertion in | ||
59 | * its memory at some point. A zero return is no guarantee it won't | ||
60 | * be done, but this is a hint that it's known to be likely. | ||
61 | * | ||
62 | * May be called with @task->mm->mmap_sem held for writing. | ||
63 | */ | ||
64 | static inline int tracehook_expect_breakpoints(struct task_struct *task) | ||
65 | { | ||
66 | return (task_ptrace(task) & PT_PTRACED) != 0; | ||
67 | } | ||
68 | |||
69 | /* | ||
70 | * ptrace report for syscall entry and exit looks identical. | ||
71 | */ | ||
72 | static inline void ptrace_report_syscall(struct pt_regs *regs) | ||
73 | { | ||
74 | int ptrace = task_ptrace(current); | ||
75 | |||
76 | if (!(ptrace & PT_PTRACED)) | ||
77 | return; | ||
78 | |||
79 | ptrace_notify(SIGTRAP | ((ptrace & PT_TRACESYSGOOD) ? 0x80 : 0)); | ||
80 | |||
81 | /* | ||
82 | * this isn't the same as continuing with a signal, but it will do | ||
83 | * for normal use. strace only continues with a signal if the | ||
84 | * stopping signal is not SIGTRAP. -brl | ||
85 | */ | ||
86 | if (current->exit_code) { | ||
87 | send_sig(current->exit_code, current, 1); | ||
88 | current->exit_code = 0; | ||
89 | } | ||
90 | } | ||
91 | |||
92 | /** | ||
93 | * tracehook_report_syscall_entry - task is about to attempt a system call | ||
94 | * @regs: user register state of current task | ||
95 | * | ||
96 | * This will be called if %TIF_SYSCALL_TRACE has been set, when the | ||
97 | * current task has just entered the kernel for a system call. | ||
98 | * Full user register state is available here. Changing the values | ||
99 | * in @regs can affect the system call number and arguments to be tried. | ||
100 | * It is safe to block here, preventing the system call from beginning. | ||
101 | * | ||
102 | * Returns zero normally, or nonzero if the calling arch code should abort | ||
103 | * the system call. That must prevent normal entry so no system call is | ||
104 | * made. If @task ever returns to user mode after this, its register state | ||
105 | * is unspecified, but should be something harmless like an %ENOSYS error | ||
106 | * return. It should preserve enough information so that syscall_rollback() | ||
107 | * can work (see asm-generic/syscall.h). | ||
108 | * | ||
109 | * Called without locks, just after entering kernel mode. | ||
110 | */ | ||
111 | static inline __must_check int tracehook_report_syscall_entry( | ||
112 | struct pt_regs *regs) | ||
113 | { | ||
114 | ptrace_report_syscall(regs); | ||
115 | return 0; | ||
116 | } | ||
117 | |||
118 | /** | ||
119 | * tracehook_report_syscall_exit - task has just finished a system call | ||
120 | * @regs: user register state of current task | ||
121 | * @step: nonzero if simulating single-step or block-step | ||
122 | * | ||
123 | * This will be called if %TIF_SYSCALL_TRACE has been set, when the | ||
124 | * current task has just finished an attempted system call. Full | ||
125 | * user register state is available here. It is safe to block here, | ||
126 | * preventing signals from being processed. | ||
127 | * | ||
128 | * If @step is nonzero, this report is also in lieu of the normal | ||
129 | * trap that would follow the system call instruction because | ||
130 | * user_enable_block_step() or user_enable_single_step() was used. | ||
131 | * In this case, %TIF_SYSCALL_TRACE might not be set. | ||
132 | * | ||
133 | * Called without locks, just before checking for pending signals. | ||
134 | */ | ||
135 | static inline void tracehook_report_syscall_exit(struct pt_regs *regs, int step) | ||
136 | { | ||
137 | ptrace_report_syscall(regs); | ||
138 | } | ||
139 | |||
140 | /** | ||
141 | * tracehook_unsafe_exec - check for exec declared unsafe due to tracing | ||
142 | * @task: current task doing exec | ||
143 | * | ||
144 | * Return %LSM_UNSAFE_* bits applied to an exec because of tracing. | ||
145 | * | ||
146 | * Called with task_lock() held on @task. | ||
147 | */ | ||
148 | static inline int tracehook_unsafe_exec(struct task_struct *task) | ||
149 | { | ||
150 | int unsafe = 0; | ||
151 | int ptrace = task_ptrace(task); | ||
152 | if (ptrace & PT_PTRACED) { | ||
153 | if (ptrace & PT_PTRACE_CAP) | ||
154 | unsafe |= LSM_UNSAFE_PTRACE_CAP; | ||
155 | else | ||
156 | unsafe |= LSM_UNSAFE_PTRACE; | ||
157 | } | ||
158 | return unsafe; | ||
159 | } | ||
160 | |||
161 | /** | ||
162 | * tracehook_tracer_task - return the task that is tracing the given task | ||
163 | * @tsk: task to consider | ||
164 | * | ||
165 | * Returns NULL if noone is tracing @task, or the &struct task_struct | ||
166 | * pointer to its tracer. | ||
167 | * | ||
168 | * Must called under rcu_read_lock(). The pointer returned might be kept | ||
169 | * live only by RCU. During exec, this may be called with task_lock() | ||
170 | * held on @task, still held from when tracehook_unsafe_exec() was called. | ||
171 | */ | ||
172 | static inline struct task_struct *tracehook_tracer_task(struct task_struct *tsk) | ||
173 | { | ||
174 | if (task_ptrace(tsk) & PT_PTRACED) | ||
175 | return rcu_dereference(tsk->parent); | ||
176 | return NULL; | ||
177 | } | ||
178 | |||
179 | /** | ||
180 | * tracehook_report_exec - a successful exec was completed | ||
181 | * @fmt: &struct linux_binfmt that performed the exec | ||
182 | * @bprm: &struct linux_binprm containing exec details | ||
183 | * @regs: user-mode register state | ||
184 | * | ||
185 | * An exec just completed, we are shortly going to return to user mode. | ||
186 | * The freshly initialized register state can be seen and changed in @regs. | ||
187 | * The name, file and other pointers in @bprm are still on hand to be | ||
188 | * inspected, but will be freed as soon as this returns. | ||
189 | * | ||
190 | * Called with no locks, but with some kernel resources held live | ||
191 | * and a reference on @fmt->module. | ||
192 | */ | ||
193 | static inline void tracehook_report_exec(struct linux_binfmt *fmt, | ||
194 | struct linux_binprm *bprm, | ||
195 | struct pt_regs *regs) | ||
196 | { | ||
197 | if (!ptrace_event(PT_TRACE_EXEC, PTRACE_EVENT_EXEC, 0) && | ||
198 | unlikely(task_ptrace(current) & PT_PTRACED)) | ||
199 | send_sig(SIGTRAP, current, 0); | ||
200 | } | ||
201 | |||
202 | /** | ||
203 | * tracehook_report_exit - task has begun to exit | ||
204 | * @exit_code: pointer to value destined for @current->exit_code | ||
205 | * | ||
206 | * @exit_code points to the value passed to do_exit(), which tracing | ||
207 | * might change here. This is almost the first thing in do_exit(), | ||
208 | * before freeing any resources or setting the %PF_EXITING flag. | ||
209 | * | ||
210 | * Called with no locks held. | ||
211 | */ | ||
212 | static inline void tracehook_report_exit(long *exit_code) | ||
213 | { | ||
214 | ptrace_event(PT_TRACE_EXIT, PTRACE_EVENT_EXIT, *exit_code); | ||
215 | } | ||
216 | |||
217 | /** | ||
218 | * tracehook_prepare_clone - prepare for new child to be cloned | ||
219 | * @clone_flags: %CLONE_* flags from clone/fork/vfork system call | ||
220 | * | ||
221 | * This is called before a new user task is to be cloned. | ||
222 | * Its return value will be passed to tracehook_finish_clone(). | ||
223 | * | ||
224 | * Called with no locks held. | ||
225 | */ | ||
226 | static inline int tracehook_prepare_clone(unsigned clone_flags) | ||
227 | { | ||
228 | if (clone_flags & CLONE_UNTRACED) | ||
229 | return 0; | ||
230 | |||
231 | if (clone_flags & CLONE_VFORK) { | ||
232 | if (current->ptrace & PT_TRACE_VFORK) | ||
233 | return PTRACE_EVENT_VFORK; | ||
234 | } else if ((clone_flags & CSIGNAL) != SIGCHLD) { | ||
235 | if (current->ptrace & PT_TRACE_CLONE) | ||
236 | return PTRACE_EVENT_CLONE; | ||
237 | } else if (current->ptrace & PT_TRACE_FORK) | ||
238 | return PTRACE_EVENT_FORK; | ||
239 | |||
240 | return 0; | ||
241 | } | ||
242 | |||
243 | /** | ||
244 | * tracehook_finish_clone - new child created and being attached | ||
245 | * @child: new child task | ||
246 | * @clone_flags: %CLONE_* flags from clone/fork/vfork system call | ||
247 | * @trace: return value from tracehook_prepare_clone() | ||
248 | * | ||
249 | * This is called immediately after adding @child to its parent's children list. | ||
250 | * The @trace value is that returned by tracehook_prepare_clone(). | ||
251 | * | ||
252 | * Called with current's siglock and write_lock_irq(&tasklist_lock) held. | ||
253 | */ | ||
254 | static inline void tracehook_finish_clone(struct task_struct *child, | ||
255 | unsigned long clone_flags, int trace) | ||
256 | { | ||
257 | ptrace_init_task(child, (clone_flags & CLONE_PTRACE) || trace); | ||
258 | } | ||
259 | |||
260 | /** | ||
261 | * tracehook_report_clone - in parent, new child is about to start running | ||
262 | * @trace: return value from tracehook_prepare_clone() | ||
263 | * @regs: parent's user register state | ||
264 | * @clone_flags: flags from parent's system call | ||
265 | * @pid: new child's PID in the parent's namespace | ||
266 | * @child: new child task | ||
267 | * | ||
268 | * Called after a child is set up, but before it has been started | ||
269 | * running. @trace is the value returned by tracehook_prepare_clone(). | ||
270 | * This is not a good place to block, because the child has not started | ||
271 | * yet. Suspend the child here if desired, and then block in | ||
272 | * tracehook_report_clone_complete(). This must prevent the child from | ||
273 | * self-reaping if tracehook_report_clone_complete() uses the @child | ||
274 | * pointer; otherwise it might have died and been released by the time | ||
275 | * tracehook_report_clone_complete() is called. | ||
276 | * | ||
277 | * Called with no locks held, but the child cannot run until this returns. | ||
278 | */ | ||
279 | static inline void tracehook_report_clone(int trace, struct pt_regs *regs, | ||
280 | unsigned long clone_flags, | ||
281 | pid_t pid, struct task_struct *child) | ||
282 | { | ||
283 | if (unlikely(trace) || unlikely(clone_flags & CLONE_PTRACE)) { | ||
284 | /* | ||
285 | * The child starts up with an immediate SIGSTOP. | ||
286 | */ | ||
287 | sigaddset(&child->pending.signal, SIGSTOP); | ||
288 | set_tsk_thread_flag(child, TIF_SIGPENDING); | ||
289 | } | ||
290 | } | ||
291 | |||
292 | /** | ||
293 | * tracehook_report_clone_complete - new child is running | ||
294 | * @trace: return value from tracehook_prepare_clone() | ||
295 | * @regs: parent's user register state | ||
296 | * @clone_flags: flags from parent's system call | ||
297 | * @pid: new child's PID in the parent's namespace | ||
298 | * @child: child task, already running | ||
299 | * | ||
300 | * This is called just after the child has started running. This is | ||
301 | * just before the clone/fork syscall returns, or blocks for vfork | ||
302 | * child completion if @clone_flags has the %CLONE_VFORK bit set. | ||
303 | * The @child pointer may be invalid if a self-reaping child died and | ||
304 | * tracehook_report_clone() took no action to prevent it from self-reaping. | ||
305 | * | ||
306 | * Called with no locks held. | ||
307 | */ | ||
308 | static inline void tracehook_report_clone_complete(int trace, | ||
309 | struct pt_regs *regs, | ||
310 | unsigned long clone_flags, | ||
311 | pid_t pid, | ||
312 | struct task_struct *child) | ||
313 | { | ||
314 | if (unlikely(trace)) | ||
315 | ptrace_event(0, trace, pid); | ||
316 | } | ||
317 | |||
318 | /** | ||
319 | * tracehook_report_vfork_done - vfork parent's child has exited or exec'd | ||
320 | * @child: child task, already running | ||
321 | * @pid: new child's PID in the parent's namespace | ||
322 | * | ||
323 | * Called after a %CLONE_VFORK parent has waited for the child to complete. | ||
324 | * The clone/vfork system call will return immediately after this. | ||
325 | * The @child pointer may be invalid if a self-reaping child died and | ||
326 | * tracehook_report_clone() took no action to prevent it from self-reaping. | ||
327 | * | ||
328 | * Called with no locks held. | ||
329 | */ | ||
330 | static inline void tracehook_report_vfork_done(struct task_struct *child, | ||
331 | pid_t pid) | ||
332 | { | ||
333 | ptrace_event(PT_TRACE_VFORK_DONE, PTRACE_EVENT_VFORK_DONE, pid); | ||
334 | } | ||
335 | |||
336 | /** | ||
337 | * tracehook_prepare_release_task - task is being reaped, clean up tracing | ||
338 | * @task: task in %EXIT_DEAD state | ||
339 | * | ||
340 | * This is called in release_task() just before @task gets finally reaped | ||
341 | * and freed. This would be the ideal place to remove and clean up any | ||
342 | * tracing-related state for @task. | ||
343 | * | ||
344 | * Called with no locks held. | ||
345 | */ | ||
346 | static inline void tracehook_prepare_release_task(struct task_struct *task) | ||
347 | { | ||
348 | } | ||
349 | |||
350 | /** | ||
351 | * tracehook_finish_release_task - final tracing clean-up | ||
352 | * @task: task in %EXIT_DEAD state | ||
353 | * | ||
354 | * This is called in release_task() when @task is being in the middle of | ||
355 | * being reaped. After this, there must be no tracing entanglements. | ||
356 | * | ||
357 | * Called with write_lock_irq(&tasklist_lock) held. | ||
358 | */ | ||
359 | static inline void tracehook_finish_release_task(struct task_struct *task) | ||
360 | { | ||
361 | ptrace_release_task(task); | ||
362 | } | ||
363 | |||
364 | /** | ||
365 | * tracehook_signal_handler - signal handler setup is complete | ||
366 | * @sig: number of signal being delivered | ||
367 | * @info: siginfo_t of signal being delivered | ||
368 | * @ka: sigaction setting that chose the handler | ||
369 | * @regs: user register state | ||
370 | * @stepping: nonzero if debugger single-step or block-step in use | ||
371 | * | ||
372 | * Called by the arch code after a signal handler has been set up. | ||
373 | * Register and stack state reflects the user handler about to run. | ||
374 | * Signal mask changes have already been made. | ||
375 | * | ||
376 | * Called without locks, shortly before returning to user mode | ||
377 | * (or handling more signals). | ||
378 | */ | ||
379 | static inline void tracehook_signal_handler(int sig, siginfo_t *info, | ||
380 | const struct k_sigaction *ka, | ||
381 | struct pt_regs *regs, int stepping) | ||
382 | { | ||
383 | if (stepping) | ||
384 | ptrace_notify(SIGTRAP); | ||
385 | } | ||
386 | |||
387 | /** | ||
388 | * tracehook_consider_ignored_signal - suppress short-circuit of ignored signal | ||
389 | * @task: task receiving the signal | ||
390 | * @sig: signal number being sent | ||
391 | * @handler: %SIG_IGN or %SIG_DFL | ||
392 | * | ||
393 | * Return zero iff tracing doesn't care to examine this ignored signal, | ||
394 | * so it can short-circuit normal delivery and never even get queued. | ||
395 | * Either @handler is %SIG_DFL and @sig's default is ignore, or it's %SIG_IGN. | ||
396 | * | ||
397 | * Called with @task->sighand->siglock held. | ||
398 | */ | ||
399 | static inline int tracehook_consider_ignored_signal(struct task_struct *task, | ||
400 | int sig, | ||
401 | void __user *handler) | ||
402 | { | ||
403 | return (task_ptrace(task) & PT_PTRACED) != 0; | ||
404 | } | ||
405 | |||
406 | /** | ||
407 | * tracehook_consider_fatal_signal - suppress special handling of fatal signal | ||
408 | * @task: task receiving the signal | ||
409 | * @sig: signal number being sent | ||
410 | * @handler: %SIG_DFL or %SIG_IGN | ||
411 | * | ||
412 | * Return nonzero to prevent special handling of this termination signal. | ||
413 | * Normally @handler is %SIG_DFL. It can be %SIG_IGN if @sig is ignored, | ||
414 | * in which case force_sig() is about to reset it to %SIG_DFL. | ||
415 | * When this returns zero, this signal might cause a quick termination | ||
416 | * that does not give the debugger a chance to intercept the signal. | ||
417 | * | ||
418 | * Called with or without @task->sighand->siglock held. | ||
419 | */ | ||
420 | static inline int tracehook_consider_fatal_signal(struct task_struct *task, | ||
421 | int sig, | ||
422 | void __user *handler) | ||
423 | { | ||
424 | return (task_ptrace(task) & PT_PTRACED) != 0; | ||
425 | } | ||
426 | |||
427 | /** | ||
428 | * tracehook_force_sigpending - let tracing force signal_pending(current) on | ||
429 | * | ||
430 | * Called when recomputing our signal_pending() flag. Return nonzero | ||
431 | * to force the signal_pending() flag on, so that tracehook_get_signal() | ||
432 | * will be called before the next return to user mode. | ||
433 | * | ||
434 | * Called with @current->sighand->siglock held. | ||
435 | */ | ||
436 | static inline int tracehook_force_sigpending(void) | ||
437 | { | ||
438 | return 0; | ||
439 | } | ||
440 | |||
441 | /** | ||
442 | * tracehook_get_signal - deliver synthetic signal to traced task | ||
443 | * @task: @current | ||
444 | * @regs: task_pt_regs(@current) | ||
445 | * @info: details of synthetic signal | ||
446 | * @return_ka: sigaction for synthetic signal | ||
447 | * | ||
448 | * Return zero to check for a real pending signal normally. | ||
449 | * Return -1 after releasing the siglock to repeat the check. | ||
450 | * Return a signal number to induce an artifical signal delivery, | ||
451 | * setting *@info and *@return_ka to specify its details and behavior. | ||
452 | * | ||
453 | * The @return_ka->sa_handler value controls the disposition of the | ||
454 | * signal, no matter the signal number. For %SIG_DFL, the return value | ||
455 | * is a representative signal to indicate the behavior (e.g. %SIGTERM | ||
456 | * for death, %SIGQUIT for core dump, %SIGSTOP for job control stop, | ||
457 | * %SIGTSTP for stop unless in an orphaned pgrp), but the signal number | ||
458 | * reported will be @info->si_signo instead. | ||
459 | * | ||
460 | * Called with @task->sighand->siglock held, before dequeuing pending signals. | ||
461 | */ | ||
462 | static inline int tracehook_get_signal(struct task_struct *task, | ||
463 | struct pt_regs *regs, | ||
464 | siginfo_t *info, | ||
465 | struct k_sigaction *return_ka) | ||
466 | { | ||
467 | return 0; | ||
468 | } | ||
469 | |||
470 | /** | ||
471 | * tracehook_notify_jctl - report about job control stop/continue | ||
472 | * @notify: nonzero if this is the last thread in the group to stop | ||
473 | * @why: %CLD_STOPPED or %CLD_CONTINUED | ||
474 | * | ||
475 | * This is called when we might call do_notify_parent_cldstop(). | ||
476 | * It's called when about to stop for job control; we are already in | ||
477 | * %TASK_STOPPED state, about to call schedule(). It's also called when | ||
478 | * a delayed %CLD_STOPPED or %CLD_CONTINUED report is ready to be made. | ||
479 | * | ||
480 | * Return nonzero to generate a %SIGCHLD with @why, which is | ||
481 | * normal if @notify is nonzero. | ||
482 | * | ||
483 | * Called with no locks held. | ||
484 | */ | ||
485 | static inline int tracehook_notify_jctl(int notify, int why) | ||
486 | { | ||
487 | return notify || (current->ptrace & PT_PTRACED); | ||
488 | } | ||
489 | |||
490 | #define DEATH_REAP -1 | ||
491 | #define DEATH_DELAYED_GROUP_LEADER -2 | ||
492 | |||
493 | /** | ||
494 | * tracehook_notify_death - task is dead, ready to notify parent | ||
495 | * @task: @current task now exiting | ||
496 | * @death_cookie: value to pass to tracehook_report_death() | ||
497 | * @group_dead: nonzero if this was the last thread in the group to die | ||
498 | * | ||
499 | * A return value >= 0 means call do_notify_parent() with that signal | ||
500 | * number. Negative return value can be %DEATH_REAP to self-reap right | ||
501 | * now, or %DEATH_DELAYED_GROUP_LEADER to a zombie without notifying our | ||
502 | * parent. Note that a return value of 0 means a do_notify_parent() call | ||
503 | * that sends no signal, but still wakes up a parent blocked in wait*(). | ||
504 | * | ||
505 | * Called with write_lock_irq(&tasklist_lock) held. | ||
506 | */ | ||
507 | static inline int tracehook_notify_death(struct task_struct *task, | ||
508 | void **death_cookie, int group_dead) | ||
509 | { | ||
510 | if (task->exit_signal == -1) | ||
511 | return task->ptrace ? SIGCHLD : DEATH_REAP; | ||
512 | |||
513 | /* | ||
514 | * If something other than our normal parent is ptracing us, then | ||
515 | * send it a SIGCHLD instead of honoring exit_signal. exit_signal | ||
516 | * only has special meaning to our real parent. | ||
517 | */ | ||
518 | if (thread_group_empty(task) && !ptrace_reparented(task)) | ||
519 | return task->exit_signal; | ||
520 | |||
521 | return task->ptrace ? SIGCHLD : DEATH_DELAYED_GROUP_LEADER; | ||
522 | } | ||
523 | |||
524 | /** | ||
525 | * tracehook_report_death - task is dead and ready to be reaped | ||
526 | * @task: @current task now exiting | ||
527 | * @signal: return value from tracheook_notify_death() | ||
528 | * @death_cookie: value passed back from tracehook_notify_death() | ||
529 | * @group_dead: nonzero if this was the last thread in the group to die | ||
530 | * | ||
531 | * Thread has just become a zombie or is about to self-reap. If positive, | ||
532 | * @signal is the signal number just sent to the parent (usually %SIGCHLD). | ||
533 | * If @signal is %DEATH_REAP, this thread will self-reap. If @signal is | ||
534 | * %DEATH_DELAYED_GROUP_LEADER, this is a delayed_group_leader() zombie. | ||
535 | * The @death_cookie was passed back by tracehook_notify_death(). | ||
536 | * | ||
537 | * If normal reaping is not inhibited, @task->exit_state might be changing | ||
538 | * in parallel. | ||
539 | * | ||
540 | * Called without locks. | ||
541 | */ | ||
542 | static inline void tracehook_report_death(struct task_struct *task, | ||
543 | int signal, void *death_cookie, | ||
544 | int group_dead) | ||
545 | { | ||
546 | } | ||
547 | |||
548 | #ifdef TIF_NOTIFY_RESUME | ||
549 | /** | ||
550 | * set_notify_resume - cause tracehook_notify_resume() to be called | ||
551 | * @task: task that will call tracehook_notify_resume() | ||
552 | * | ||
553 | * Calling this arranges that @task will call tracehook_notify_resume() | ||
554 | * before returning to user mode. If it's already running in user mode, | ||
555 | * it will enter the kernel and call tracehook_notify_resume() soon. | ||
556 | * If it's blocked, it will not be woken. | ||
557 | */ | ||
558 | static inline void set_notify_resume(struct task_struct *task) | ||
559 | { | ||
560 | if (!test_and_set_tsk_thread_flag(task, TIF_NOTIFY_RESUME)) | ||
561 | kick_process(task); | ||
562 | } | ||
563 | |||
564 | /** | ||
565 | * tracehook_notify_resume - report when about to return to user mode | ||
566 | * @regs: user-mode registers of @current task | ||
567 | * | ||
568 | * This is called when %TIF_NOTIFY_RESUME has been set. Now we are | ||
569 | * about to return to user mode, and the user state in @regs can be | ||
570 | * inspected or adjusted. The caller in arch code has cleared | ||
571 | * %TIF_NOTIFY_RESUME before the call. If the flag gets set again | ||
572 | * asynchronously, this will be called again before we return to | ||
573 | * user mode. | ||
574 | * | ||
575 | * Called without locks. | ||
576 | */ | ||
577 | static inline void tracehook_notify_resume(struct pt_regs *regs) | ||
578 | { | ||
579 | } | ||
580 | #endif /* TIF_NOTIFY_RESUME */ | ||
581 | |||
582 | #endif /* <linux/tracehook.h> */ | ||
diff --git a/include/linux/tty.h b/include/linux/tty.h index 324a3b231d40..3b8121d4e36f 100644 --- a/include/linux/tty.h +++ b/include/linux/tty.h | |||
@@ -23,7 +23,7 @@ | |||
23 | */ | 23 | */ |
24 | #define NR_UNIX98_PTY_DEFAULT 4096 /* Default maximum for Unix98 ptys */ | 24 | #define NR_UNIX98_PTY_DEFAULT 4096 /* Default maximum for Unix98 ptys */ |
25 | #define NR_UNIX98_PTY_MAX (1 << MINORBITS) /* Absolute limit */ | 25 | #define NR_UNIX98_PTY_MAX (1 << MINORBITS) /* Absolute limit */ |
26 | #define NR_LDISCS 18 | 26 | #define NR_LDISCS 19 |
27 | 27 | ||
28 | /* line disciplines */ | 28 | /* line disciplines */ |
29 | #define N_TTY 0 | 29 | #define N_TTY 0 |
@@ -45,6 +45,7 @@ | |||
45 | #define N_HCI 15 /* Bluetooth HCI UART */ | 45 | #define N_HCI 15 /* Bluetooth HCI UART */ |
46 | #define N_GIGASET_M101 16 /* Siemens Gigaset M101 serial DECT adapter */ | 46 | #define N_GIGASET_M101 16 /* Siemens Gigaset M101 serial DECT adapter */ |
47 | #define N_SLCAN 17 /* Serial / USB serial CAN Adaptors */ | 47 | #define N_SLCAN 17 /* Serial / USB serial CAN Adaptors */ |
48 | #define N_PPS 18 /* Pulse per Second */ | ||
48 | 49 | ||
49 | /* | 50 | /* |
50 | * This character is the same as _POSIX_VDISABLE: it cannot be used as | 51 | * This character is the same as _POSIX_VDISABLE: it cannot be used as |
@@ -71,7 +72,8 @@ struct tty_bufhead { | |||
71 | struct tty_buffer *head; /* Queue head */ | 72 | struct tty_buffer *head; /* Queue head */ |
72 | struct tty_buffer *tail; /* Active buffer */ | 73 | struct tty_buffer *tail; /* Active buffer */ |
73 | struct tty_buffer *free; /* Free queue head */ | 74 | struct tty_buffer *free; /* Free queue head */ |
74 | int memory_used; /* Buffer space used excluding free queue */ | 75 | int memory_used; /* Buffer space used excluding |
76 | free queue */ | ||
75 | }; | 77 | }; |
76 | /* | 78 | /* |
77 | * When a break, frame error, or parity error happens, these codes are | 79 | * When a break, frame error, or parity error happens, these codes are |
@@ -101,71 +103,97 @@ struct tty_bufhead { | |||
101 | #define LNEXT_CHAR(tty) ((tty)->termios->c_cc[VLNEXT]) | 103 | #define LNEXT_CHAR(tty) ((tty)->termios->c_cc[VLNEXT]) |
102 | #define EOL2_CHAR(tty) ((tty)->termios->c_cc[VEOL2]) | 104 | #define EOL2_CHAR(tty) ((tty)->termios->c_cc[VEOL2]) |
103 | 105 | ||
104 | #define _I_FLAG(tty,f) ((tty)->termios->c_iflag & (f)) | 106 | #define _I_FLAG(tty, f) ((tty)->termios->c_iflag & (f)) |
105 | #define _O_FLAG(tty,f) ((tty)->termios->c_oflag & (f)) | 107 | #define _O_FLAG(tty, f) ((tty)->termios->c_oflag & (f)) |
106 | #define _C_FLAG(tty,f) ((tty)->termios->c_cflag & (f)) | 108 | #define _C_FLAG(tty, f) ((tty)->termios->c_cflag & (f)) |
107 | #define _L_FLAG(tty,f) ((tty)->termios->c_lflag & (f)) | 109 | #define _L_FLAG(tty, f) ((tty)->termios->c_lflag & (f)) |
108 | 110 | ||
109 | #define I_IGNBRK(tty) _I_FLAG((tty),IGNBRK) | 111 | #define I_IGNBRK(tty) _I_FLAG((tty), IGNBRK) |
110 | #define I_BRKINT(tty) _I_FLAG((tty),BRKINT) | 112 | #define I_BRKINT(tty) _I_FLAG((tty), BRKINT) |
111 | #define I_IGNPAR(tty) _I_FLAG((tty),IGNPAR) | 113 | #define I_IGNPAR(tty) _I_FLAG((tty), IGNPAR) |
112 | #define I_PARMRK(tty) _I_FLAG((tty),PARMRK) | 114 | #define I_PARMRK(tty) _I_FLAG((tty), PARMRK) |
113 | #define I_INPCK(tty) _I_FLAG((tty),INPCK) | 115 | #define I_INPCK(tty) _I_FLAG((tty), INPCK) |
114 | #define I_ISTRIP(tty) _I_FLAG((tty),ISTRIP) | 116 | #define I_ISTRIP(tty) _I_FLAG((tty), ISTRIP) |
115 | #define I_INLCR(tty) _I_FLAG((tty),INLCR) | 117 | #define I_INLCR(tty) _I_FLAG((tty), INLCR) |
116 | #define I_IGNCR(tty) _I_FLAG((tty),IGNCR) | 118 | #define I_IGNCR(tty) _I_FLAG((tty), IGNCR) |
117 | #define I_ICRNL(tty) _I_FLAG((tty),ICRNL) | 119 | #define I_ICRNL(tty) _I_FLAG((tty), ICRNL) |
118 | #define I_IUCLC(tty) _I_FLAG((tty),IUCLC) | 120 | #define I_IUCLC(tty) _I_FLAG((tty), IUCLC) |
119 | #define I_IXON(tty) _I_FLAG((tty),IXON) | 121 | #define I_IXON(tty) _I_FLAG((tty), IXON) |
120 | #define I_IXANY(tty) _I_FLAG((tty),IXANY) | 122 | #define I_IXANY(tty) _I_FLAG((tty), IXANY) |
121 | #define I_IXOFF(tty) _I_FLAG((tty),IXOFF) | 123 | #define I_IXOFF(tty) _I_FLAG((tty), IXOFF) |
122 | #define I_IMAXBEL(tty) _I_FLAG((tty),IMAXBEL) | 124 | #define I_IMAXBEL(tty) _I_FLAG((tty), IMAXBEL) |
123 | #define I_IUTF8(tty) _I_FLAG((tty),IUTF8) | 125 | #define I_IUTF8(tty) _I_FLAG((tty), IUTF8) |
124 | 126 | ||
125 | #define O_OPOST(tty) _O_FLAG((tty),OPOST) | 127 | #define O_OPOST(tty) _O_FLAG((tty), OPOST) |
126 | #define O_OLCUC(tty) _O_FLAG((tty),OLCUC) | 128 | #define O_OLCUC(tty) _O_FLAG((tty), OLCUC) |
127 | #define O_ONLCR(tty) _O_FLAG((tty),ONLCR) | 129 | #define O_ONLCR(tty) _O_FLAG((tty), ONLCR) |
128 | #define O_OCRNL(tty) _O_FLAG((tty),OCRNL) | 130 | #define O_OCRNL(tty) _O_FLAG((tty), OCRNL) |
129 | #define O_ONOCR(tty) _O_FLAG((tty),ONOCR) | 131 | #define O_ONOCR(tty) _O_FLAG((tty), ONOCR) |
130 | #define O_ONLRET(tty) _O_FLAG((tty),ONLRET) | 132 | #define O_ONLRET(tty) _O_FLAG((tty), ONLRET) |
131 | #define O_OFILL(tty) _O_FLAG((tty),OFILL) | 133 | #define O_OFILL(tty) _O_FLAG((tty), OFILL) |
132 | #define O_OFDEL(tty) _O_FLAG((tty),OFDEL) | 134 | #define O_OFDEL(tty) _O_FLAG((tty), OFDEL) |
133 | #define O_NLDLY(tty) _O_FLAG((tty),NLDLY) | 135 | #define O_NLDLY(tty) _O_FLAG((tty), NLDLY) |
134 | #define O_CRDLY(tty) _O_FLAG((tty),CRDLY) | 136 | #define O_CRDLY(tty) _O_FLAG((tty), CRDLY) |
135 | #define O_TABDLY(tty) _O_FLAG((tty),TABDLY) | 137 | #define O_TABDLY(tty) _O_FLAG((tty), TABDLY) |
136 | #define O_BSDLY(tty) _O_FLAG((tty),BSDLY) | 138 | #define O_BSDLY(tty) _O_FLAG((tty), BSDLY) |
137 | #define O_VTDLY(tty) _O_FLAG((tty),VTDLY) | 139 | #define O_VTDLY(tty) _O_FLAG((tty), VTDLY) |
138 | #define O_FFDLY(tty) _O_FLAG((tty),FFDLY) | 140 | #define O_FFDLY(tty) _O_FLAG((tty), FFDLY) |
139 | 141 | ||
140 | #define C_BAUD(tty) _C_FLAG((tty),CBAUD) | 142 | #define C_BAUD(tty) _C_FLAG((tty), CBAUD) |
141 | #define C_CSIZE(tty) _C_FLAG((tty),CSIZE) | 143 | #define C_CSIZE(tty) _C_FLAG((tty), CSIZE) |
142 | #define C_CSTOPB(tty) _C_FLAG((tty),CSTOPB) | 144 | #define C_CSTOPB(tty) _C_FLAG((tty), CSTOPB) |
143 | #define C_CREAD(tty) _C_FLAG((tty),CREAD) | 145 | #define C_CREAD(tty) _C_FLAG((tty), CREAD) |
144 | #define C_PARENB(tty) _C_FLAG((tty),PARENB) | 146 | #define C_PARENB(tty) _C_FLAG((tty), PARENB) |
145 | #define C_PARODD(tty) _C_FLAG((tty),PARODD) | 147 | #define C_PARODD(tty) _C_FLAG((tty), PARODD) |
146 | #define C_HUPCL(tty) _C_FLAG((tty),HUPCL) | 148 | #define C_HUPCL(tty) _C_FLAG((tty), HUPCL) |
147 | #define C_CLOCAL(tty) _C_FLAG((tty),CLOCAL) | 149 | #define C_CLOCAL(tty) _C_FLAG((tty), CLOCAL) |
148 | #define C_CIBAUD(tty) _C_FLAG((tty),CIBAUD) | 150 | #define C_CIBAUD(tty) _C_FLAG((tty), CIBAUD) |
149 | #define C_CRTSCTS(tty) _C_FLAG((tty),CRTSCTS) | 151 | #define C_CRTSCTS(tty) _C_FLAG((tty), CRTSCTS) |
150 | 152 | ||
151 | #define L_ISIG(tty) _L_FLAG((tty),ISIG) | 153 | #define L_ISIG(tty) _L_FLAG((tty), ISIG) |
152 | #define L_ICANON(tty) _L_FLAG((tty),ICANON) | 154 | #define L_ICANON(tty) _L_FLAG((tty), ICANON) |
153 | #define L_XCASE(tty) _L_FLAG((tty),XCASE) | 155 | #define L_XCASE(tty) _L_FLAG((tty), XCASE) |
154 | #define L_ECHO(tty) _L_FLAG((tty),ECHO) | 156 | #define L_ECHO(tty) _L_FLAG((tty), ECHO) |
155 | #define L_ECHOE(tty) _L_FLAG((tty),ECHOE) | 157 | #define L_ECHOE(tty) _L_FLAG((tty), ECHOE) |
156 | #define L_ECHOK(tty) _L_FLAG((tty),ECHOK) | 158 | #define L_ECHOK(tty) _L_FLAG((tty), ECHOK) |
157 | #define L_ECHONL(tty) _L_FLAG((tty),ECHONL) | 159 | #define L_ECHONL(tty) _L_FLAG((tty), ECHONL) |
158 | #define L_NOFLSH(tty) _L_FLAG((tty),NOFLSH) | 160 | #define L_NOFLSH(tty) _L_FLAG((tty), NOFLSH) |
159 | #define L_TOSTOP(tty) _L_FLAG((tty),TOSTOP) | 161 | #define L_TOSTOP(tty) _L_FLAG((tty), TOSTOP) |
160 | #define L_ECHOCTL(tty) _L_FLAG((tty),ECHOCTL) | 162 | #define L_ECHOCTL(tty) _L_FLAG((tty), ECHOCTL) |
161 | #define L_ECHOPRT(tty) _L_FLAG((tty),ECHOPRT) | 163 | #define L_ECHOPRT(tty) _L_FLAG((tty), ECHOPRT) |
162 | #define L_ECHOKE(tty) _L_FLAG((tty),ECHOKE) | 164 | #define L_ECHOKE(tty) _L_FLAG((tty), ECHOKE) |
163 | #define L_FLUSHO(tty) _L_FLAG((tty),FLUSHO) | 165 | #define L_FLUSHO(tty) _L_FLAG((tty), FLUSHO) |
164 | #define L_PENDIN(tty) _L_FLAG((tty),PENDIN) | 166 | #define L_PENDIN(tty) _L_FLAG((tty), PENDIN) |
165 | #define L_IEXTEN(tty) _L_FLAG((tty),IEXTEN) | 167 | #define L_IEXTEN(tty) _L_FLAG((tty), IEXTEN) |
166 | 168 | ||
167 | struct device; | 169 | struct device; |
168 | struct signal_struct; | 170 | struct signal_struct; |
171 | |||
172 | /* | ||
173 | * Port level information. Each device keeps its own port level information | ||
174 | * so provide a common structure for those ports wanting to use common support | ||
175 | * routines. | ||
176 | * | ||
177 | * The tty port has a different lifetime to the tty so must be kept apart. | ||
178 | * In addition be careful as tty -> port mappings are valid for the life | ||
179 | * of the tty object but in many cases port -> tty mappings are valid only | ||
180 | * until a hangup so don't use the wrong path. | ||
181 | */ | ||
182 | |||
183 | struct tty_port { | ||
184 | struct tty_struct *tty; /* Back pointer */ | ||
185 | spinlock_t lock; /* Lock protecting tty field */ | ||
186 | int blocked_open; /* Waiting to open */ | ||
187 | int count; /* Usage count */ | ||
188 | wait_queue_head_t open_wait; /* Open waiters */ | ||
189 | wait_queue_head_t close_wait; /* Close waiters */ | ||
190 | unsigned long flags; /* TTY flags ASY_*/ | ||
191 | struct mutex mutex; /* Locking */ | ||
192 | unsigned char *xmit_buf; /* Optional buffer */ | ||
193 | int close_delay; /* Close port delay */ | ||
194 | int closing_wait; /* Delay for output */ | ||
195 | }; | ||
196 | |||
169 | /* | 197 | /* |
170 | * Where all of the state associated with a tty is kept while the tty | 198 | * Where all of the state associated with a tty is kept while the tty |
171 | * is open. Since the termios state should be kept even if the tty | 199 | * is open. Since the termios state should be kept even if the tty |
@@ -182,14 +210,17 @@ struct tty_operations; | |||
182 | 210 | ||
183 | struct tty_struct { | 211 | struct tty_struct { |
184 | int magic; | 212 | int magic; |
213 | struct kref kref; | ||
185 | struct tty_driver *driver; | 214 | struct tty_driver *driver; |
186 | const struct tty_operations *ops; | 215 | const struct tty_operations *ops; |
187 | int index; | 216 | int index; |
217 | /* The ldisc objects are protected by tty_ldisc_lock at the moment */ | ||
188 | struct tty_ldisc ldisc; | 218 | struct tty_ldisc ldisc; |
189 | struct mutex termios_mutex; | 219 | struct mutex termios_mutex; |
190 | spinlock_t ctrl_lock; | 220 | spinlock_t ctrl_lock; |
191 | /* Termios values are protected by the termios mutex */ | 221 | /* Termios values are protected by the termios mutex */ |
192 | struct ktermios *termios, *termios_locked; | 222 | struct ktermios *termios, *termios_locked; |
223 | struct termiox *termiox; /* May be NULL for unsupported */ | ||
193 | char name[64]; | 224 | char name[64]; |
194 | struct pid *pgrp; /* Protected by ctrl lock */ | 225 | struct pid *pgrp; /* Protected by ctrl lock */ |
195 | struct pid *session; | 226 | struct pid *session; |
@@ -213,7 +244,7 @@ struct tty_struct { | |||
213 | struct list_head tty_files; | 244 | struct list_head tty_files; |
214 | 245 | ||
215 | #define N_TTY_BUF_SIZE 4096 | 246 | #define N_TTY_BUF_SIZE 4096 |
216 | 247 | ||
217 | /* | 248 | /* |
218 | * The following is data for the N_TTY line discipline. For | 249 | * The following is data for the N_TTY line discipline. For |
219 | * historical reasons, this is included in the tty structure. | 250 | * historical reasons, this is included in the tty structure. |
@@ -241,6 +272,7 @@ struct tty_struct { | |||
241 | spinlock_t read_lock; | 272 | spinlock_t read_lock; |
242 | /* If the tty has a pending do_SAK, queue it here - akpm */ | 273 | /* If the tty has a pending do_SAK, queue it here - akpm */ |
243 | struct work_struct SAK_work; | 274 | struct work_struct SAK_work; |
275 | struct tty_port *port; | ||
244 | }; | 276 | }; |
245 | 277 | ||
246 | /* tty magic number */ | 278 | /* tty magic number */ |
@@ -248,14 +280,14 @@ struct tty_struct { | |||
248 | 280 | ||
249 | /* | 281 | /* |
250 | * These bits are used in the flags field of the tty structure. | 282 | * These bits are used in the flags field of the tty structure. |
251 | * | 283 | * |
252 | * So that interrupts won't be able to mess up the queues, | 284 | * So that interrupts won't be able to mess up the queues, |
253 | * copy_to_cooked must be atomic with respect to itself, as must | 285 | * copy_to_cooked must be atomic with respect to itself, as must |
254 | * tty->write. Thus, you must use the inline functions set_bit() and | 286 | * tty->write. Thus, you must use the inline functions set_bit() and |
255 | * clear_bit() to make things atomic. | 287 | * clear_bit() to make things atomic. |
256 | */ | 288 | */ |
257 | #define TTY_THROTTLED 0 /* Call unthrottle() at threshold min */ | 289 | #define TTY_THROTTLED 0 /* Call unthrottle() at threshold min */ |
258 | #define TTY_IO_ERROR 1 /* Canse an I/O error (may be no ldisc too) */ | 290 | #define TTY_IO_ERROR 1 /* Cause an I/O error (may be no ldisc too) */ |
259 | #define TTY_OTHER_CLOSED 2 /* Other side (if any) has closed */ | 291 | #define TTY_OTHER_CLOSED 2 /* Other side (if any) has closed */ |
260 | #define TTY_EXCLUSIVE 3 /* Exclusive open mode */ | 292 | #define TTY_EXCLUSIVE 3 /* Exclusive open mode */ |
261 | #define TTY_DEBUG 4 /* Debugging */ | 293 | #define TTY_DEBUG 4 /* Debugging */ |
@@ -282,15 +314,32 @@ extern int kmsg_redirect; | |||
282 | extern void console_init(void); | 314 | extern void console_init(void); |
283 | extern int vcs_init(void); | 315 | extern int vcs_init(void); |
284 | 316 | ||
317 | extern struct class *tty_class; | ||
318 | |||
319 | /** | ||
320 | * tty_kref_get - get a tty reference | ||
321 | * @tty: tty device | ||
322 | * | ||
323 | * Return a new reference to a tty object. The caller must hold | ||
324 | * sufficient locks/counts to ensure that their existing reference cannot | ||
325 | * go away | ||
326 | */ | ||
327 | |||
328 | extern inline struct tty_struct *tty_kref_get(struct tty_struct *tty) | ||
329 | { | ||
330 | if (tty) | ||
331 | kref_get(&tty->kref); | ||
332 | return tty; | ||
333 | } | ||
334 | extern void tty_kref_put(struct tty_struct *tty); | ||
335 | |||
285 | extern int tty_paranoia_check(struct tty_struct *tty, struct inode *inode, | 336 | extern int tty_paranoia_check(struct tty_struct *tty, struct inode *inode, |
286 | const char *routine); | 337 | const char *routine); |
287 | extern char *tty_name(struct tty_struct *tty, char *buf); | 338 | extern char *tty_name(struct tty_struct *tty, char *buf); |
288 | extern void tty_wait_until_sent(struct tty_struct * tty, long timeout); | 339 | extern void tty_wait_until_sent(struct tty_struct *tty, long timeout); |
289 | extern int tty_check_change(struct tty_struct * tty); | 340 | extern int tty_check_change(struct tty_struct *tty); |
290 | extern void stop_tty(struct tty_struct * tty); | 341 | extern void stop_tty(struct tty_struct *tty); |
291 | extern void start_tty(struct tty_struct * tty); | 342 | extern void start_tty(struct tty_struct *tty); |
292 | extern int tty_register_ldisc(int disc, struct tty_ldisc *new_ldisc); | ||
293 | extern int tty_unregister_ldisc(int disc); | ||
294 | extern int tty_register_driver(struct tty_driver *driver); | 343 | extern int tty_register_driver(struct tty_driver *driver); |
295 | extern int tty_unregister_driver(struct tty_driver *driver); | 344 | extern int tty_unregister_driver(struct tty_driver *driver); |
296 | extern struct device *tty_register_device(struct tty_driver *driver, | 345 | extern struct device *tty_register_device(struct tty_driver *driver, |
@@ -305,34 +354,41 @@ extern int tty_write_room(struct tty_struct *tty); | |||
305 | extern void tty_driver_flush_buffer(struct tty_struct *tty); | 354 | extern void tty_driver_flush_buffer(struct tty_struct *tty); |
306 | extern void tty_throttle(struct tty_struct *tty); | 355 | extern void tty_throttle(struct tty_struct *tty); |
307 | extern void tty_unthrottle(struct tty_struct *tty); | 356 | extern void tty_unthrottle(struct tty_struct *tty); |
308 | 357 | extern int tty_do_resize(struct tty_struct *tty, struct tty_struct *real_tty, | |
358 | struct winsize *ws); | ||
359 | extern void tty_shutdown(struct tty_struct *tty); | ||
360 | extern void tty_free_termios(struct tty_struct *tty); | ||
309 | extern int is_current_pgrp_orphaned(void); | 361 | extern int is_current_pgrp_orphaned(void); |
310 | extern struct pid *tty_get_pgrp(struct tty_struct *tty); | 362 | extern struct pid *tty_get_pgrp(struct tty_struct *tty); |
311 | extern int is_ignored(int sig); | 363 | extern int is_ignored(int sig); |
312 | extern int tty_signal(int sig, struct tty_struct *tty); | 364 | extern int tty_signal(int sig, struct tty_struct *tty); |
313 | extern void tty_hangup(struct tty_struct * tty); | 365 | extern void tty_hangup(struct tty_struct *tty); |
314 | extern void tty_vhangup(struct tty_struct * tty); | 366 | extern void tty_vhangup(struct tty_struct *tty); |
367 | extern void tty_vhangup_self(void); | ||
315 | extern void tty_unhangup(struct file *filp); | 368 | extern void tty_unhangup(struct file *filp); |
316 | extern int tty_hung_up_p(struct file * filp); | 369 | extern int tty_hung_up_p(struct file *filp); |
317 | extern void do_SAK(struct tty_struct *tty); | 370 | extern void do_SAK(struct tty_struct *tty); |
318 | extern void __do_SAK(struct tty_struct *tty); | 371 | extern void __do_SAK(struct tty_struct *tty); |
319 | extern void disassociate_ctty(int priv); | 372 | extern void disassociate_ctty(int priv); |
320 | extern void no_tty(void); | 373 | extern void no_tty(void); |
321 | extern void tty_flip_buffer_push(struct tty_struct *tty); | 374 | extern void tty_flip_buffer_push(struct tty_struct *tty); |
375 | extern void tty_buffer_free_all(struct tty_struct *tty); | ||
376 | extern void tty_buffer_flush(struct tty_struct *tty); | ||
377 | extern void tty_buffer_init(struct tty_struct *tty); | ||
322 | extern speed_t tty_get_baud_rate(struct tty_struct *tty); | 378 | extern speed_t tty_get_baud_rate(struct tty_struct *tty); |
323 | extern speed_t tty_termios_baud_rate(struct ktermios *termios); | 379 | extern speed_t tty_termios_baud_rate(struct ktermios *termios); |
324 | extern speed_t tty_termios_input_baud_rate(struct ktermios *termios); | 380 | extern speed_t tty_termios_input_baud_rate(struct ktermios *termios); |
325 | extern void tty_termios_encode_baud_rate(struct ktermios *termios, speed_t ibaud, speed_t obaud); | 381 | extern void tty_termios_encode_baud_rate(struct ktermios *termios, |
326 | extern void tty_encode_baud_rate(struct tty_struct *tty, speed_t ibaud, speed_t obaud); | 382 | speed_t ibaud, speed_t obaud); |
383 | extern void tty_encode_baud_rate(struct tty_struct *tty, | ||
384 | speed_t ibaud, speed_t obaud); | ||
327 | extern void tty_termios_copy_hw(struct ktermios *new, struct ktermios *old); | 385 | extern void tty_termios_copy_hw(struct ktermios *new, struct ktermios *old); |
328 | extern int tty_termios_hw_change(struct ktermios *a, struct ktermios *b); | 386 | extern int tty_termios_hw_change(struct ktermios *a, struct ktermios *b); |
329 | 387 | ||
330 | extern struct tty_ldisc *tty_ldisc_ref(struct tty_struct *); | 388 | extern struct tty_ldisc *tty_ldisc_ref(struct tty_struct *); |
331 | extern void tty_ldisc_deref(struct tty_ldisc *); | 389 | extern void tty_ldisc_deref(struct tty_ldisc *); |
332 | extern struct tty_ldisc *tty_ldisc_ref_wait(struct tty_struct *); | 390 | extern struct tty_ldisc *tty_ldisc_ref_wait(struct tty_struct *); |
333 | 391 | extern const struct file_operations tty_ldiscs_proc_fops; | |
334 | extern struct tty_ldisc *tty_ldisc_get(int); | ||
335 | extern void tty_ldisc_put(int); | ||
336 | 392 | ||
337 | extern void tty_wakeup(struct tty_struct *tty); | 393 | extern void tty_wakeup(struct tty_struct *tty); |
338 | extern void tty_ldisc_flush(struct tty_struct *tty); | 394 | extern void tty_ldisc_flush(struct tty_struct *tty); |
@@ -344,6 +400,15 @@ extern int tty_perform_flush(struct tty_struct *tty, unsigned long arg); | |||
344 | extern dev_t tty_devnum(struct tty_struct *tty); | 400 | extern dev_t tty_devnum(struct tty_struct *tty); |
345 | extern void proc_clear_tty(struct task_struct *p); | 401 | extern void proc_clear_tty(struct task_struct *p); |
346 | extern struct tty_struct *get_current_tty(void); | 402 | extern struct tty_struct *get_current_tty(void); |
403 | extern void tty_default_fops(struct file_operations *fops); | ||
404 | extern struct tty_struct *alloc_tty_struct(void); | ||
405 | extern void free_tty_struct(struct tty_struct *tty); | ||
406 | extern void initialize_tty_struct(struct tty_struct *tty, | ||
407 | struct tty_driver *driver, int idx); | ||
408 | extern struct tty_struct *tty_init_dev(struct tty_driver *driver, int idx, | ||
409 | int first_ok); | ||
410 | extern void tty_release_dev(struct file *filp); | ||
411 | extern int tty_init_termios(struct tty_struct *tty); | ||
347 | 412 | ||
348 | extern struct mutex tty_mutex; | 413 | extern struct mutex tty_mutex; |
349 | 414 | ||
@@ -351,10 +416,25 @@ extern void tty_write_unlock(struct tty_struct *tty); | |||
351 | extern int tty_write_lock(struct tty_struct *tty, int ndelay); | 416 | extern int tty_write_lock(struct tty_struct *tty, int ndelay); |
352 | #define tty_is_writelocked(tty) (mutex_is_locked(&tty->atomic_write_lock)) | 417 | #define tty_is_writelocked(tty) (mutex_is_locked(&tty->atomic_write_lock)) |
353 | 418 | ||
419 | extern void tty_port_init(struct tty_port *port); | ||
420 | extern int tty_port_alloc_xmit_buf(struct tty_port *port); | ||
421 | extern void tty_port_free_xmit_buf(struct tty_port *port); | ||
422 | extern struct tty_struct *tty_port_tty_get(struct tty_port *port); | ||
423 | extern void tty_port_tty_set(struct tty_port *port, struct tty_struct *tty); | ||
424 | |||
425 | extern int tty_register_ldisc(int disc, struct tty_ldisc_ops *new_ldisc); | ||
426 | extern int tty_unregister_ldisc(int disc); | ||
427 | extern int tty_set_ldisc(struct tty_struct *tty, int ldisc); | ||
428 | extern int tty_ldisc_setup(struct tty_struct *tty, struct tty_struct *o_tty); | ||
429 | extern void tty_ldisc_release(struct tty_struct *tty, struct tty_struct *o_tty); | ||
430 | extern void tty_ldisc_init(struct tty_struct *tty); | ||
431 | extern void tty_ldisc_begin(void); | ||
432 | /* This last one is just for the tty layer internals and shouldn't be used elsewhere */ | ||
433 | extern void tty_ldisc_enable(struct tty_struct *tty); | ||
354 | 434 | ||
355 | 435 | ||
356 | /* n_tty.c */ | 436 | /* n_tty.c */ |
357 | extern struct tty_ldisc tty_ldisc_N_TTY; | 437 | extern struct tty_ldisc_ops tty_ldisc_N_TTY; |
358 | 438 | ||
359 | /* tty_audit.c */ | 439 | /* tty_audit.c */ |
360 | #ifdef CONFIG_AUDIT | 440 | #ifdef CONFIG_AUDIT |
@@ -363,7 +443,8 @@ extern void tty_audit_add_data(struct tty_struct *tty, unsigned char *data, | |||
363 | extern void tty_audit_exit(void); | 443 | extern void tty_audit_exit(void); |
364 | extern void tty_audit_fork(struct signal_struct *sig); | 444 | extern void tty_audit_fork(struct signal_struct *sig); |
365 | extern void tty_audit_push(struct tty_struct *tty); | 445 | extern void tty_audit_push(struct tty_struct *tty); |
366 | extern void tty_audit_push_task(struct task_struct *tsk, uid_t loginuid, u32 sessionid); | 446 | extern void tty_audit_push_task(struct task_struct *tsk, |
447 | uid_t loginuid, u32 sessionid); | ||
367 | #else | 448 | #else |
368 | static inline void tty_audit_add_data(struct tty_struct *tty, | 449 | static inline void tty_audit_add_data(struct tty_struct *tty, |
369 | unsigned char *data, size_t size) | 450 | unsigned char *data, size_t size) |
@@ -378,19 +459,20 @@ static inline void tty_audit_fork(struct signal_struct *sig) | |||
378 | static inline void tty_audit_push(struct tty_struct *tty) | 459 | static inline void tty_audit_push(struct tty_struct *tty) |
379 | { | 460 | { |
380 | } | 461 | } |
381 | static inline void tty_audit_push_task(struct task_struct *tsk, uid_t loginuid, u32 sessionid) | 462 | static inline void tty_audit_push_task(struct task_struct *tsk, |
463 | uid_t loginuid, u32 sessionid) | ||
382 | { | 464 | { |
383 | } | 465 | } |
384 | #endif | 466 | #endif |
385 | 467 | ||
386 | /* tty_ioctl.c */ | 468 | /* tty_ioctl.c */ |
387 | extern int n_tty_ioctl(struct tty_struct * tty, struct file * file, | 469 | extern int n_tty_ioctl_helper(struct tty_struct *tty, struct file *file, |
388 | unsigned int cmd, unsigned long arg); | 470 | unsigned int cmd, unsigned long arg); |
389 | 471 | ||
390 | /* serial.c */ | 472 | /* serial.c */ |
391 | 473 | ||
392 | extern void serial_console_init(void); | 474 | extern void serial_console_init(void); |
393 | 475 | ||
394 | /* pcxx.c */ | 476 | /* pcxx.c */ |
395 | 477 | ||
396 | extern int pcxe_open(struct tty_struct *tty, struct file *filp); | 478 | extern int pcxe_open(struct tty_struct *tty, struct file *filp); |
@@ -401,7 +483,7 @@ extern void console_print(const char *); | |||
401 | 483 | ||
402 | /* vt.c */ | 484 | /* vt.c */ |
403 | 485 | ||
404 | extern int vt_ioctl(struct tty_struct *tty, struct file * file, | 486 | extern int vt_ioctl(struct tty_struct *tty, struct file *file, |
405 | unsigned int cmd, unsigned long arg); | 487 | unsigned int cmd, unsigned long arg); |
406 | 488 | ||
407 | #endif /* __KERNEL__ */ | 489 | #endif /* __KERNEL__ */ |
diff --git a/include/linux/tty_driver.h b/include/linux/tty_driver.h index d2a003586761..78416b901589 100644 --- a/include/linux/tty_driver.h +++ b/include/linux/tty_driver.h | |||
@@ -7,6 +7,28 @@ | |||
7 | * defined; unless noted otherwise, they are optional, and can be | 7 | * defined; unless noted otherwise, they are optional, and can be |
8 | * filled in with a null pointer. | 8 | * filled in with a null pointer. |
9 | * | 9 | * |
10 | * struct tty_struct * (*lookup)(struct tty_driver *self, int idx) | ||
11 | * | ||
12 | * Return the tty device corresponding to idx, NULL if there is not | ||
13 | * one currently in use and an ERR_PTR value on error. Called under | ||
14 | * tty_mutex (for now!) | ||
15 | * | ||
16 | * Optional method. Default behaviour is to use the ttys array | ||
17 | * | ||
18 | * int (*install)(struct tty_driver *self, struct tty_struct *tty) | ||
19 | * | ||
20 | * Install a new tty into the tty driver internal tables. Used in | ||
21 | * conjunction with lookup and remove methods. | ||
22 | * | ||
23 | * Optional method. Default behaviour is to use the ttys array | ||
24 | * | ||
25 | * void (*remove)(struct tty_driver *self, struct tty_struct *tty) | ||
26 | * | ||
27 | * Remove a closed tty from the tty driver internal tables. Used in | ||
28 | * conjunction with lookup and remove methods. | ||
29 | * | ||
30 | * Optional method. Default behaviour is to use the ttys array | ||
31 | * | ||
10 | * int (*open)(struct tty_struct * tty, struct file * filp); | 32 | * int (*open)(struct tty_struct * tty, struct file * filp); |
11 | * | 33 | * |
12 | * This routine is called when a particular tty device is opened. | 34 | * This routine is called when a particular tty device is opened. |
@@ -21,6 +43,11 @@ | |||
21 | * | 43 | * |
22 | * Required method. | 44 | * Required method. |
23 | * | 45 | * |
46 | * void (*shutdown)(struct tty_struct * tty); | ||
47 | * | ||
48 | * This routine is called when a particular tty device is closed for | ||
49 | * the last time freeing up the resources. | ||
50 | * | ||
24 | * int (*write)(struct tty_struct * tty, | 51 | * int (*write)(struct tty_struct * tty, |
25 | * const unsigned char *buf, int count); | 52 | * const unsigned char *buf, int count); |
26 | * | 53 | * |
@@ -135,7 +162,7 @@ | |||
135 | * | 162 | * |
136 | * Optional: | 163 | * Optional: |
137 | * | 164 | * |
138 | * void (*break_ctl)(struct tty_stuct *tty, int state); | 165 | * int (*break_ctl)(struct tty_stuct *tty, int state); |
139 | * | 166 | * |
140 | * This optional routine requests the tty driver to turn on or | 167 | * This optional routine requests the tty driver to turn on or |
141 | * off BREAK status on the RS-232 port. If state is -1, | 168 | * off BREAK status on the RS-232 port. If state is -1, |
@@ -146,6 +173,10 @@ | |||
146 | * handle the following ioctls: TCSBRK, TCSBRKP, TIOCSBRK, | 173 | * handle the following ioctls: TCSBRK, TCSBRKP, TIOCSBRK, |
147 | * TIOCCBRK. | 174 | * TIOCCBRK. |
148 | * | 175 | * |
176 | * If the driver sets TTY_DRIVER_HARDWARE_BREAK then the interface | ||
177 | * will also be called with actual times and the hardware is expected | ||
178 | * to do the delay work itself. 0 and -1 are still used for on/off. | ||
179 | * | ||
149 | * Optional: Required for TCSBRK/BRKP/etc handling. | 180 | * Optional: Required for TCSBRK/BRKP/etc handling. |
150 | * | 181 | * |
151 | * void (*wait_until_sent)(struct tty_struct *tty, int timeout); | 182 | * void (*wait_until_sent)(struct tty_struct *tty, int timeout); |
@@ -164,6 +195,26 @@ | |||
164 | * | 195 | * |
165 | * Optional: If not provided then the write method is called under | 196 | * Optional: If not provided then the write method is called under |
166 | * the atomic write lock to keep it serialized with the ldisc. | 197 | * the atomic write lock to keep it serialized with the ldisc. |
198 | * | ||
199 | * int (*resize)(struct tty_struct *tty, struct tty_struct *real_tty, | ||
200 | * unsigned int rows, unsigned int cols); | ||
201 | * | ||
202 | * Called when a termios request is issued which changes the | ||
203 | * requested terminal geometry. | ||
204 | * | ||
205 | * Optional: the default action is to update the termios structure | ||
206 | * without error. This is usually the correct behaviour. Drivers should | ||
207 | * not force errors here if they are not resizable objects (eg a serial | ||
208 | * line). See tty_do_resize() if you need to wrap the standard method | ||
209 | * in your own logic - the usual case. | ||
210 | * | ||
211 | * void (*set_termiox)(struct tty_struct *tty, struct termiox *new); | ||
212 | * | ||
213 | * Called when the device receives a termiox based ioctl. Passes down | ||
214 | * the requested data from user space. This method will not be invoked | ||
215 | * unless the tty also has a valid tty->termiox pointer. | ||
216 | * | ||
217 | * Optional: Called under the termios lock | ||
167 | */ | 218 | */ |
168 | 219 | ||
169 | #include <linux/fs.h> | 220 | #include <linux/fs.h> |
@@ -174,8 +225,13 @@ struct tty_struct; | |||
174 | struct tty_driver; | 225 | struct tty_driver; |
175 | 226 | ||
176 | struct tty_operations { | 227 | struct tty_operations { |
228 | struct tty_struct * (*lookup)(struct tty_driver *driver, | ||
229 | struct inode *inode, int idx); | ||
230 | int (*install)(struct tty_driver *driver, struct tty_struct *tty); | ||
231 | void (*remove)(struct tty_driver *driver, struct tty_struct *tty); | ||
177 | int (*open)(struct tty_struct * tty, struct file * filp); | 232 | int (*open)(struct tty_struct * tty, struct file * filp); |
178 | void (*close)(struct tty_struct * tty, struct file * filp); | 233 | void (*close)(struct tty_struct * tty, struct file * filp); |
234 | void (*shutdown)(struct tty_struct *tty); | ||
179 | int (*write)(struct tty_struct * tty, | 235 | int (*write)(struct tty_struct * tty, |
180 | const unsigned char *buf, int count); | 236 | const unsigned char *buf, int count); |
181 | int (*put_char)(struct tty_struct *tty, unsigned char ch); | 237 | int (*put_char)(struct tty_struct *tty, unsigned char ch); |
@@ -192,7 +248,7 @@ struct tty_operations { | |||
192 | void (*stop)(struct tty_struct *tty); | 248 | void (*stop)(struct tty_struct *tty); |
193 | void (*start)(struct tty_struct *tty); | 249 | void (*start)(struct tty_struct *tty); |
194 | void (*hangup)(struct tty_struct *tty); | 250 | void (*hangup)(struct tty_struct *tty); |
195 | void (*break_ctl)(struct tty_struct *tty, int state); | 251 | int (*break_ctl)(struct tty_struct *tty, int state); |
196 | void (*flush_buffer)(struct tty_struct *tty); | 252 | void (*flush_buffer)(struct tty_struct *tty); |
197 | void (*set_ldisc)(struct tty_struct *tty); | 253 | void (*set_ldisc)(struct tty_struct *tty); |
198 | void (*wait_until_sent)(struct tty_struct *tty, int timeout); | 254 | void (*wait_until_sent)(struct tty_struct *tty, int timeout); |
@@ -202,6 +258,9 @@ struct tty_operations { | |||
202 | int (*tiocmget)(struct tty_struct *tty, struct file *file); | 258 | int (*tiocmget)(struct tty_struct *tty, struct file *file); |
203 | int (*tiocmset)(struct tty_struct *tty, struct file *file, | 259 | int (*tiocmset)(struct tty_struct *tty, struct file *file, |
204 | unsigned int set, unsigned int clear); | 260 | unsigned int set, unsigned int clear); |
261 | int (*resize)(struct tty_struct *tty, struct tty_struct *real_tty, | ||
262 | struct winsize *ws); | ||
263 | int (*set_termiox)(struct tty_struct *tty, struct termiox *tnew); | ||
205 | #ifdef CONFIG_CONSOLE_POLL | 264 | #ifdef CONFIG_CONSOLE_POLL |
206 | int (*poll_init)(struct tty_driver *driver, int line, char *options); | 265 | int (*poll_init)(struct tty_driver *driver, int line, char *options); |
207 | int (*poll_get_char)(struct tty_driver *driver, int line); | 266 | int (*poll_get_char)(struct tty_driver *driver, int line); |
@@ -211,6 +270,7 @@ struct tty_operations { | |||
211 | 270 | ||
212 | struct tty_driver { | 271 | struct tty_driver { |
213 | int magic; /* magic number for this structure */ | 272 | int magic; /* magic number for this structure */ |
273 | struct kref kref; /* Reference management */ | ||
214 | struct cdev cdev; | 274 | struct cdev cdev; |
215 | struct module *owner; | 275 | struct module *owner; |
216 | const char *driver_name; | 276 | const char *driver_name; |
@@ -224,7 +284,6 @@ struct tty_driver { | |||
224 | short subtype; /* subtype of tty driver */ | 284 | short subtype; /* subtype of tty driver */ |
225 | struct ktermios init_termios; /* Initial termios */ | 285 | struct ktermios init_termios; /* Initial termios */ |
226 | int flags; /* tty driver flags */ | 286 | int flags; /* tty driver flags */ |
227 | int refcount; /* for loadable tty drivers */ | ||
228 | struct proc_dir_entry *proc_entry; /* /proc fs entry */ | 287 | struct proc_dir_entry *proc_entry; /* /proc fs entry */ |
229 | struct tty_driver *other; /* only used for the PTY driver */ | 288 | struct tty_driver *other; /* only used for the PTY driver */ |
230 | 289 | ||
@@ -246,12 +305,19 @@ struct tty_driver { | |||
246 | 305 | ||
247 | extern struct list_head tty_drivers; | 306 | extern struct list_head tty_drivers; |
248 | 307 | ||
249 | struct tty_driver *alloc_tty_driver(int lines); | 308 | extern struct tty_driver *alloc_tty_driver(int lines); |
250 | void put_tty_driver(struct tty_driver *driver); | 309 | extern void put_tty_driver(struct tty_driver *driver); |
251 | void tty_set_operations(struct tty_driver *driver, | 310 | extern void tty_set_operations(struct tty_driver *driver, |
252 | const struct tty_operations *op); | 311 | const struct tty_operations *op); |
253 | extern struct tty_driver *tty_find_polling_driver(char *name, int *line); | 312 | extern struct tty_driver *tty_find_polling_driver(char *name, int *line); |
254 | 313 | ||
314 | extern void tty_driver_kref_put(struct tty_driver *driver); | ||
315 | extern inline struct tty_driver *tty_driver_kref_get(struct tty_driver *d) | ||
316 | { | ||
317 | kref_get(&d->kref); | ||
318 | return d; | ||
319 | } | ||
320 | |||
255 | /* tty driver magic number */ | 321 | /* tty driver magic number */ |
256 | #define TTY_DRIVER_MAGIC 0x5402 | 322 | #define TTY_DRIVER_MAGIC 0x5402 |
257 | 323 | ||
@@ -285,12 +351,18 @@ extern struct tty_driver *tty_find_polling_driver(char *name, int *line); | |||
285 | * TTY_DRIVER_DEVPTS_MEM -- don't use the standard arrays, instead | 351 | * TTY_DRIVER_DEVPTS_MEM -- don't use the standard arrays, instead |
286 | * use dynamic memory keyed through the devpts filesystem. This | 352 | * use dynamic memory keyed through the devpts filesystem. This |
287 | * is only applicable to the pty driver. | 353 | * is only applicable to the pty driver. |
354 | * | ||
355 | * TTY_DRIVER_HARDWARE_BREAK -- hardware handles break signals. Pass | ||
356 | * the requested timeout to the caller instead of using a simple | ||
357 | * on/off interface. | ||
358 | * | ||
288 | */ | 359 | */ |
289 | #define TTY_DRIVER_INSTALLED 0x0001 | 360 | #define TTY_DRIVER_INSTALLED 0x0001 |
290 | #define TTY_DRIVER_RESET_TERMIOS 0x0002 | 361 | #define TTY_DRIVER_RESET_TERMIOS 0x0002 |
291 | #define TTY_DRIVER_REAL_RAW 0x0004 | 362 | #define TTY_DRIVER_REAL_RAW 0x0004 |
292 | #define TTY_DRIVER_DYNAMIC_DEV 0x0008 | 363 | #define TTY_DRIVER_DYNAMIC_DEV 0x0008 |
293 | #define TTY_DRIVER_DEVPTS_MEM 0x0010 | 364 | #define TTY_DRIVER_DEVPTS_MEM 0x0010 |
365 | #define TTY_DRIVER_HARDWARE_BREAK 0x0020 | ||
294 | 366 | ||
295 | /* tty driver types */ | 367 | /* tty driver types */ |
296 | #define TTY_DRIVER_TYPE_SYSTEM 0x0001 | 368 | #define TTY_DRIVER_TYPE_SYSTEM 0x0001 |
diff --git a/include/linux/tty_ldisc.h b/include/linux/tty_ldisc.h index 6226504d9108..40f38d896777 100644 --- a/include/linux/tty_ldisc.h +++ b/include/linux/tty_ldisc.h | |||
@@ -104,7 +104,7 @@ | |||
104 | #include <linux/fs.h> | 104 | #include <linux/fs.h> |
105 | #include <linux/wait.h> | 105 | #include <linux/wait.h> |
106 | 106 | ||
107 | struct tty_ldisc { | 107 | struct tty_ldisc_ops { |
108 | int magic; | 108 | int magic; |
109 | char *name; | 109 | char *name; |
110 | int num; | 110 | int num; |
@@ -142,6 +142,11 @@ struct tty_ldisc { | |||
142 | int refcount; | 142 | int refcount; |
143 | }; | 143 | }; |
144 | 144 | ||
145 | struct tty_ldisc { | ||
146 | struct tty_ldisc_ops *ops; | ||
147 | int refcount; | ||
148 | }; | ||
149 | |||
145 | #define TTY_LDISC_MAGIC 0x5403 | 150 | #define TTY_LDISC_MAGIC 0x5403 |
146 | 151 | ||
147 | #define LDISC_FLAG_DEFINED 0x00000001 | 152 | #define LDISC_FLAG_DEFINED 0x00000001 |
diff --git a/include/linux/typecheck.h b/include/linux/typecheck.h new file mode 100644 index 000000000000..eb5b74a575be --- /dev/null +++ b/include/linux/typecheck.h | |||
@@ -0,0 +1,24 @@ | |||
1 | #ifndef TYPECHECK_H_INCLUDED | ||
2 | #define TYPECHECK_H_INCLUDED | ||
3 | |||
4 | /* | ||
5 | * Check at compile time that something is of a particular type. | ||
6 | * Always evaluates to 1 so you may use it easily in comparisons. | ||
7 | */ | ||
8 | #define typecheck(type,x) \ | ||
9 | ({ type __dummy; \ | ||
10 | typeof(x) __dummy2; \ | ||
11 | (void)(&__dummy == &__dummy2); \ | ||
12 | 1; \ | ||
13 | }) | ||
14 | |||
15 | /* | ||
16 | * Check at compile time that 'function' is a certain type, or is a pointer | ||
17 | * to that type (needs to use typedef for the function type.) | ||
18 | */ | ||
19 | #define typecheck_fn(type,function) \ | ||
20 | ({ typeof(type) __tmp = function; \ | ||
21 | (void)__tmp; \ | ||
22 | }) | ||
23 | |||
24 | #endif /* TYPECHECK_H_INCLUDED */ | ||
diff --git a/include/linux/ucb1400.h b/include/linux/ucb1400.h new file mode 100644 index 000000000000..970473bf8d5a --- /dev/null +++ b/include/linux/ucb1400.h | |||
@@ -0,0 +1,161 @@ | |||
1 | /* | ||
2 | * Register definitions and functions for: | ||
3 | * Philips UCB1400 driver | ||
4 | * | ||
5 | * Based on ucb1400_ts: | ||
6 | * Author: Nicolas Pitre | ||
7 | * Created: September 25, 2006 | ||
8 | * Copyright: MontaVista Software, Inc. | ||
9 | * | ||
10 | * Spliting done by: Marek Vasut <marek.vasut@gmail.com> | ||
11 | * If something doesnt work and it worked before spliting, e-mail me, | ||
12 | * dont bother Nicolas please ;-) | ||
13 | * | ||
14 | * This program is free software; you can redistribute it and/or modify | ||
15 | * it under the terms of the GNU General Public License version 2 as | ||
16 | * published by the Free Software Foundation. | ||
17 | * | ||
18 | * This code is heavily based on ucb1x00-*.c copyrighted by Russell King | ||
19 | * covering the UCB1100, UCB1200 and UCB1300.. Support for the UCB1400 has | ||
20 | * been made separate from ucb1x00-core/ucb1x00-ts on Russell's request. | ||
21 | */ | ||
22 | |||
23 | #ifndef _LINUX__UCB1400_H | ||
24 | #define _LINUX__UCB1400_H | ||
25 | |||
26 | #include <sound/ac97_codec.h> | ||
27 | #include <linux/mutex.h> | ||
28 | #include <linux/platform_device.h> | ||
29 | |||
30 | /* | ||
31 | * UCB1400 AC-link registers | ||
32 | */ | ||
33 | |||
34 | #define UCB_IO_DATA 0x5a | ||
35 | #define UCB_IO_DIR 0x5c | ||
36 | #define UCB_IE_RIS 0x5e | ||
37 | #define UCB_IE_FAL 0x60 | ||
38 | #define UCB_IE_STATUS 0x62 | ||
39 | #define UCB_IE_CLEAR 0x62 | ||
40 | #define UCB_IE_ADC (1 << 11) | ||
41 | #define UCB_IE_TSPX (1 << 12) | ||
42 | |||
43 | #define UCB_TS_CR 0x64 | ||
44 | #define UCB_TS_CR_TSMX_POW (1 << 0) | ||
45 | #define UCB_TS_CR_TSPX_POW (1 << 1) | ||
46 | #define UCB_TS_CR_TSMY_POW (1 << 2) | ||
47 | #define UCB_TS_CR_TSPY_POW (1 << 3) | ||
48 | #define UCB_TS_CR_TSMX_GND (1 << 4) | ||
49 | #define UCB_TS_CR_TSPX_GND (1 << 5) | ||
50 | #define UCB_TS_CR_TSMY_GND (1 << 6) | ||
51 | #define UCB_TS_CR_TSPY_GND (1 << 7) | ||
52 | #define UCB_TS_CR_MODE_INT (0 << 8) | ||
53 | #define UCB_TS_CR_MODE_PRES (1 << 8) | ||
54 | #define UCB_TS_CR_MODE_POS (2 << 8) | ||
55 | #define UCB_TS_CR_BIAS_ENA (1 << 11) | ||
56 | #define UCB_TS_CR_TSPX_LOW (1 << 12) | ||
57 | #define UCB_TS_CR_TSMX_LOW (1 << 13) | ||
58 | |||
59 | #define UCB_ADC_CR 0x66 | ||
60 | #define UCB_ADC_SYNC_ENA (1 << 0) | ||
61 | #define UCB_ADC_VREFBYP_CON (1 << 1) | ||
62 | #define UCB_ADC_INP_TSPX (0 << 2) | ||
63 | #define UCB_ADC_INP_TSMX (1 << 2) | ||
64 | #define UCB_ADC_INP_TSPY (2 << 2) | ||
65 | #define UCB_ADC_INP_TSMY (3 << 2) | ||
66 | #define UCB_ADC_INP_AD0 (4 << 2) | ||
67 | #define UCB_ADC_INP_AD1 (5 << 2) | ||
68 | #define UCB_ADC_INP_AD2 (6 << 2) | ||
69 | #define UCB_ADC_INP_AD3 (7 << 2) | ||
70 | #define UCB_ADC_EXT_REF (1 << 5) | ||
71 | #define UCB_ADC_START (1 << 7) | ||
72 | #define UCB_ADC_ENA (1 << 15) | ||
73 | |||
74 | #define UCB_ADC_DATA 0x68 | ||
75 | #define UCB_ADC_DAT_VALID (1 << 15) | ||
76 | #define UCB_ADC_DAT_MASK 0x3ff | ||
77 | |||
78 | #define UCB_ID 0x7e | ||
79 | #define UCB_ID_1400 0x4304 | ||
80 | |||
81 | struct ucb1400_ts { | ||
82 | struct input_dev *ts_idev; | ||
83 | struct task_struct *ts_task; | ||
84 | int id; | ||
85 | wait_queue_head_t ts_wait; | ||
86 | unsigned int ts_restart:1; | ||
87 | int irq; | ||
88 | unsigned int irq_pending; /* not bit field shared */ | ||
89 | struct snd_ac97 *ac97; | ||
90 | }; | ||
91 | |||
92 | struct ucb1400 { | ||
93 | struct platform_device *ucb1400_ts; | ||
94 | }; | ||
95 | |||
96 | static inline u16 ucb1400_reg_read(struct snd_ac97 *ac97, u16 reg) | ||
97 | { | ||
98 | return ac97->bus->ops->read(ac97, reg); | ||
99 | } | ||
100 | |||
101 | static inline void ucb1400_reg_write(struct snd_ac97 *ac97, u16 reg, u16 val) | ||
102 | { | ||
103 | ac97->bus->ops->write(ac97, reg, val); | ||
104 | } | ||
105 | |||
106 | static inline u16 ucb1400_gpio_get_value(struct snd_ac97 *ac97, u16 gpio) | ||
107 | { | ||
108 | return ucb1400_reg_read(ac97, UCB_IO_DATA) & (1 << gpio); | ||
109 | } | ||
110 | |||
111 | static inline void ucb1400_gpio_set_value(struct snd_ac97 *ac97, u16 gpio, | ||
112 | u16 val) | ||
113 | { | ||
114 | ucb1400_reg_write(ac97, UCB_IO_DATA, val ? | ||
115 | ucb1400_reg_read(ac97, UCB_IO_DATA) | (1 << gpio) : | ||
116 | ucb1400_reg_read(ac97, UCB_IO_DATA) & ~(1 << gpio)); | ||
117 | } | ||
118 | |||
119 | static inline u16 ucb1400_gpio_get_direction(struct snd_ac97 *ac97, u16 gpio) | ||
120 | { | ||
121 | return ucb1400_reg_read(ac97, UCB_IO_DIR) & (1 << gpio); | ||
122 | } | ||
123 | |||
124 | static inline void ucb1400_gpio_set_direction(struct snd_ac97 *ac97, u16 gpio, | ||
125 | u16 dir) | ||
126 | { | ||
127 | ucb1400_reg_write(ac97, UCB_IO_DIR, dir ? | ||
128 | ucb1400_reg_read(ac97, UCB_IO_DIR) | (1 << gpio) : | ||
129 | ucb1400_reg_read(ac97, UCB_IO_DIR) & ~(1 << gpio)); | ||
130 | } | ||
131 | |||
132 | static inline void ucb1400_adc_enable(struct snd_ac97 *ac97) | ||
133 | { | ||
134 | ucb1400_reg_write(ac97, UCB_ADC_CR, UCB_ADC_ENA); | ||
135 | } | ||
136 | |||
137 | static unsigned int ucb1400_adc_read(struct snd_ac97 *ac97, u16 adc_channel, | ||
138 | int adcsync) | ||
139 | { | ||
140 | unsigned int val; | ||
141 | |||
142 | if (adcsync) | ||
143 | adc_channel |= UCB_ADC_SYNC_ENA; | ||
144 | |||
145 | ucb1400_reg_write(ac97, UCB_ADC_CR, UCB_ADC_ENA | adc_channel); | ||
146 | ucb1400_reg_write(ac97, UCB_ADC_CR, UCB_ADC_ENA | adc_channel | | ||
147 | UCB_ADC_START); | ||
148 | |||
149 | while (!((val = ucb1400_reg_read(ac97, UCB_ADC_DATA)) | ||
150 | & UCB_ADC_DAT_VALID)) | ||
151 | schedule_timeout_uninterruptible(1); | ||
152 | |||
153 | return val & UCB_ADC_DAT_MASK; | ||
154 | } | ||
155 | |||
156 | static inline void ucb1400_adc_disable(struct snd_ac97 *ac97) | ||
157 | { | ||
158 | ucb1400_reg_write(ac97, UCB_ADC_CR, 0); | ||
159 | } | ||
160 | |||
161 | #endif | ||
diff --git a/include/linux/udp.h b/include/linux/udp.h index 581ca2c14c52..0cf5c4c0ec81 100644 --- a/include/linux/udp.h +++ b/include/linux/udp.h | |||
@@ -38,6 +38,7 @@ struct udphdr { | |||
38 | #ifdef __KERNEL__ | 38 | #ifdef __KERNEL__ |
39 | #include <net/inet_sock.h> | 39 | #include <net/inet_sock.h> |
40 | #include <linux/skbuff.h> | 40 | #include <linux/skbuff.h> |
41 | #include <net/netns/hash.h> | ||
41 | 42 | ||
42 | static inline struct udphdr *udp_hdr(const struct sk_buff *skb) | 43 | static inline struct udphdr *udp_hdr(const struct sk_buff *skb) |
43 | { | 44 | { |
@@ -46,6 +47,11 @@ static inline struct udphdr *udp_hdr(const struct sk_buff *skb) | |||
46 | 47 | ||
47 | #define UDP_HTABLE_SIZE 128 | 48 | #define UDP_HTABLE_SIZE 128 |
48 | 49 | ||
50 | static inline int udp_hashfn(struct net *net, const unsigned num) | ||
51 | { | ||
52 | return (num + net_hash_mix(net)) & (UDP_HTABLE_SIZE - 1); | ||
53 | } | ||
54 | |||
49 | struct udp_sock { | 55 | struct udp_sock { |
50 | /* inet_sock has to be the first member */ | 56 | /* inet_sock has to be the first member */ |
51 | struct inet_sock inet; | 57 | struct inet_sock inet; |
diff --git a/include/linux/uio_driver.h b/include/linux/uio_driver.h index 973386d439da..cdf338d94b7f 100644 --- a/include/linux/uio_driver.h +++ b/include/linux/uio_driver.h | |||
@@ -36,7 +36,7 @@ struct uio_mem { | |||
36 | struct uio_map *map; | 36 | struct uio_map *map; |
37 | }; | 37 | }; |
38 | 38 | ||
39 | #define MAX_UIO_MAPS 5 | 39 | #define MAX_UIO_MAPS 5 |
40 | 40 | ||
41 | struct uio_device; | 41 | struct uio_device; |
42 | 42 | ||
@@ -53,6 +53,7 @@ struct uio_device; | |||
53 | * @mmap: mmap operation for this uio device | 53 | * @mmap: mmap operation for this uio device |
54 | * @open: open operation for this uio device | 54 | * @open: open operation for this uio device |
55 | * @release: release operation for this uio device | 55 | * @release: release operation for this uio device |
56 | * @irqcontrol: disable/enable irqs when 0/1 is written to /dev/uioX | ||
56 | */ | 57 | */ |
57 | struct uio_info { | 58 | struct uio_info { |
58 | struct uio_device *uio_dev; | 59 | struct uio_device *uio_dev; |
@@ -66,6 +67,7 @@ struct uio_info { | |||
66 | int (*mmap)(struct uio_info *info, struct vm_area_struct *vma); | 67 | int (*mmap)(struct uio_info *info, struct vm_area_struct *vma); |
67 | int (*open)(struct uio_info *info, struct inode *inode); | 68 | int (*open)(struct uio_info *info, struct inode *inode); |
68 | int (*release)(struct uio_info *info, struct inode *inode); | 69 | int (*release)(struct uio_info *info, struct inode *inode); |
70 | int (*irqcontrol)(struct uio_info *info, s32 irq_on); | ||
69 | }; | 71 | }; |
70 | 72 | ||
71 | extern int __must_check | 73 | extern int __must_check |
@@ -80,11 +82,11 @@ static inline int __must_check | |||
80 | extern void uio_unregister_device(struct uio_info *info); | 82 | extern void uio_unregister_device(struct uio_info *info); |
81 | extern void uio_event_notify(struct uio_info *info); | 83 | extern void uio_event_notify(struct uio_info *info); |
82 | 84 | ||
83 | /* defines for uio_device->irq */ | 85 | /* defines for uio_info->irq */ |
84 | #define UIO_IRQ_CUSTOM -1 | 86 | #define UIO_IRQ_CUSTOM -1 |
85 | #define UIO_IRQ_NONE -2 | 87 | #define UIO_IRQ_NONE -2 |
86 | 88 | ||
87 | /* defines for uio_device->memtype */ | 89 | /* defines for uio_mem->memtype */ |
88 | #define UIO_MEM_NONE 0 | 90 | #define UIO_MEM_NONE 0 |
89 | #define UIO_MEM_PHYS 1 | 91 | #define UIO_MEM_PHYS 1 |
90 | #define UIO_MEM_LOGICAL 2 | 92 | #define UIO_MEM_LOGICAL 2 |
diff --git a/include/linux/usb.h b/include/linux/usb.h index c08689ea9b4b..94ac74aba6b6 100644 --- a/include/linux/usb.h +++ b/include/linux/usb.h | |||
@@ -110,6 +110,10 @@ enum usb_interface_condition { | |||
110 | * @sysfs_files_created: sysfs attributes exist | 110 | * @sysfs_files_created: sysfs attributes exist |
111 | * @needs_remote_wakeup: flag set when the driver requires remote-wakeup | 111 | * @needs_remote_wakeup: flag set when the driver requires remote-wakeup |
112 | * capability during autosuspend. | 112 | * capability during autosuspend. |
113 | * @needs_altsetting0: flag set when a set-interface request for altsetting 0 | ||
114 | * has been deferred. | ||
115 | * @needs_binding: flag set when the driver should be re-probed or unbound | ||
116 | * following a reset or suspend operation it doesn't support. | ||
113 | * @dev: driver model's view of this device | 117 | * @dev: driver model's view of this device |
114 | * @usb_dev: if an interface is bound to the USB major, this will point | 118 | * @usb_dev: if an interface is bound to the USB major, this will point |
115 | * to the sysfs representation for that device. | 119 | * to the sysfs representation for that device. |
@@ -160,6 +164,8 @@ struct usb_interface { | |||
160 | unsigned is_active:1; /* the interface is not suspended */ | 164 | unsigned is_active:1; /* the interface is not suspended */ |
161 | unsigned sysfs_files_created:1; /* the sysfs attributes exist */ | 165 | unsigned sysfs_files_created:1; /* the sysfs attributes exist */ |
162 | unsigned needs_remote_wakeup:1; /* driver requires remote wakeup */ | 166 | unsigned needs_remote_wakeup:1; /* driver requires remote wakeup */ |
167 | unsigned needs_altsetting0:1; /* switch to altsetting 0 is pending */ | ||
168 | unsigned needs_binding:1; /* needs delayed unbind/rebind */ | ||
163 | 169 | ||
164 | struct device dev; /* interface specific device info */ | 170 | struct device dev; /* interface specific device info */ |
165 | struct device *usb_dev; | 171 | struct device *usb_dev; |
@@ -293,7 +299,7 @@ struct usb_devmap { | |||
293 | struct usb_bus { | 299 | struct usb_bus { |
294 | struct device *controller; /* host/master side hardware */ | 300 | struct device *controller; /* host/master side hardware */ |
295 | int busnum; /* Bus number (in order of reg) */ | 301 | int busnum; /* Bus number (in order of reg) */ |
296 | char *bus_name; /* stable id (PCI slot_name etc) */ | 302 | const char *bus_name; /* stable id (PCI slot_name etc) */ |
297 | u8 uses_dma; /* Does the host controller use DMA? */ | 303 | u8 uses_dma; /* Does the host controller use DMA? */ |
298 | u8 otg_port; /* 0, or number of OTG/HNP port */ | 304 | u8 otg_port; /* 0, or number of OTG/HNP port */ |
299 | unsigned is_b_host:1; /* true during some HNP roleswitches */ | 305 | unsigned is_b_host:1; /* true during some HNP roleswitches */ |
@@ -497,8 +503,6 @@ extern int usb_lock_device_for_reset(struct usb_device *udev, | |||
497 | 503 | ||
498 | /* USB port reset for device reinitialization */ | 504 | /* USB port reset for device reinitialization */ |
499 | extern int usb_reset_device(struct usb_device *dev); | 505 | extern int usb_reset_device(struct usb_device *dev); |
500 | extern int usb_reset_composite_device(struct usb_device *dev, | ||
501 | struct usb_interface *iface); | ||
502 | 506 | ||
503 | extern struct usb_device *usb_find_device(u16 vendor_id, u16 product_id); | 507 | extern struct usb_device *usb_find_device(u16 vendor_id, u16 product_id); |
504 | 508 | ||
@@ -958,9 +962,9 @@ struct usbdrv_wrap { | |||
958 | * @resume: Called when the device is being resumed by the system. | 962 | * @resume: Called when the device is being resumed by the system. |
959 | * @reset_resume: Called when the suspended device has been reset instead | 963 | * @reset_resume: Called when the suspended device has been reset instead |
960 | * of being resumed. | 964 | * of being resumed. |
961 | * @pre_reset: Called by usb_reset_composite_device() when the device | 965 | * @pre_reset: Called by usb_reset_device() when the device |
962 | * is about to be reset. | 966 | * is about to be reset. |
963 | * @post_reset: Called by usb_reset_composite_device() after the device | 967 | * @post_reset: Called by usb_reset_device() after the device |
964 | * has been reset | 968 | * has been reset |
965 | * @id_table: USB drivers use ID table to support hotplugging. | 969 | * @id_table: USB drivers use ID table to support hotplugging. |
966 | * Export this with MODULE_DEVICE_TABLE(usb,...). This must be set | 970 | * Export this with MODULE_DEVICE_TABLE(usb,...). This must be set |
@@ -972,6 +976,8 @@ struct usbdrv_wrap { | |||
972 | * added to this driver by preventing the sysfs file from being created. | 976 | * added to this driver by preventing the sysfs file from being created. |
973 | * @supports_autosuspend: if set to 0, the USB core will not allow autosuspend | 977 | * @supports_autosuspend: if set to 0, the USB core will not allow autosuspend |
974 | * for interfaces bound to this driver. | 978 | * for interfaces bound to this driver. |
979 | * @soft_unbind: if set to 1, the USB core will not kill URBs and disable | ||
980 | * endpoints before calling the driver's disconnect method. | ||
975 | * | 981 | * |
976 | * USB interface drivers must provide a name, probe() and disconnect() | 982 | * USB interface drivers must provide a name, probe() and disconnect() |
977 | * methods, and an id_table. Other driver fields are optional. | 983 | * methods, and an id_table. Other driver fields are optional. |
@@ -1012,6 +1018,7 @@ struct usb_driver { | |||
1012 | struct usbdrv_wrap drvwrap; | 1018 | struct usbdrv_wrap drvwrap; |
1013 | unsigned int no_dynamic_id:1; | 1019 | unsigned int no_dynamic_id:1; |
1014 | unsigned int supports_autosuspend:1; | 1020 | unsigned int supports_autosuspend:1; |
1021 | unsigned int soft_unbind:1; | ||
1015 | }; | 1022 | }; |
1016 | #define to_usb_driver(d) container_of(d, struct usb_driver, drvwrap.driver) | 1023 | #define to_usb_driver(d) container_of(d, struct usb_driver, drvwrap.driver) |
1017 | 1024 | ||
diff --git a/include/linux/usb/composite.h b/include/linux/usb/composite.h new file mode 100644 index 000000000000..c932390c6da0 --- /dev/null +++ b/include/linux/usb/composite.h | |||
@@ -0,0 +1,338 @@ | |||
1 | /* | ||
2 | * composite.h -- framework for usb gadgets which are composite devices | ||
3 | * | ||
4 | * Copyright (C) 2006-2008 David Brownell | ||
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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | ||
19 | */ | ||
20 | |||
21 | #ifndef __LINUX_USB_COMPOSITE_H | ||
22 | #define __LINUX_USB_COMPOSITE_H | ||
23 | |||
24 | /* | ||
25 | * This framework is an optional layer on top of the USB Gadget interface, | ||
26 | * making it easier to build (a) Composite devices, supporting multiple | ||
27 | * functions within any single configuration, and (b) Multi-configuration | ||
28 | * devices, also supporting multiple functions but without necessarily | ||
29 | * having more than one function per configuration. | ||
30 | * | ||
31 | * Example: a device with a single configuration supporting both network | ||
32 | * link and mass storage functions is a composite device. Those functions | ||
33 | * might alternatively be packaged in individual configurations, but in | ||
34 | * the composite model the host can use both functions at the same time. | ||
35 | */ | ||
36 | |||
37 | #include <linux/usb/ch9.h> | ||
38 | #include <linux/usb/gadget.h> | ||
39 | |||
40 | |||
41 | struct usb_configuration; | ||
42 | |||
43 | /** | ||
44 | * struct usb_function - describes one function of a configuration | ||
45 | * @name: For diagnostics, identifies the function. | ||
46 | * @strings: tables of strings, keyed by identifiers assigned during bind() | ||
47 | * and by language IDs provided in control requests | ||
48 | * @descriptors: Table of full (or low) speed descriptors, using interface and | ||
49 | * string identifiers assigned during @bind(). If this pointer is null, | ||
50 | * the function will not be available at full speed (or at low speed). | ||
51 | * @hs_descriptors: Table of high speed descriptors, using interface and | ||
52 | * string identifiers assigned during @bind(). If this pointer is null, | ||
53 | * the function will not be available at high speed. | ||
54 | * @config: assigned when @usb_add_function() is called; this is the | ||
55 | * configuration with which this function is associated. | ||
56 | * @bind: Before the gadget can register, all of its functions bind() to the | ||
57 | * available resources including string and interface identifiers used | ||
58 | * in interface or class descriptors; endpoints; I/O buffers; and so on. | ||
59 | * @unbind: Reverses @bind; called as a side effect of unregistering the | ||
60 | * driver which added this function. | ||
61 | * @set_alt: (REQUIRED) Reconfigures altsettings; function drivers may | ||
62 | * initialize usb_ep.driver data at this time (when it is used). | ||
63 | * Note that setting an interface to its current altsetting resets | ||
64 | * interface state, and that all interfaces have a disabled state. | ||
65 | * @get_alt: Returns the active altsetting. If this is not provided, | ||
66 | * then only altsetting zero is supported. | ||
67 | * @disable: (REQUIRED) Indicates the function should be disabled. Reasons | ||
68 | * include host resetting or reconfiguring the gadget, and disconnection. | ||
69 | * @setup: Used for interface-specific control requests. | ||
70 | * @suspend: Notifies functions when the host stops sending USB traffic. | ||
71 | * @resume: Notifies functions when the host restarts USB traffic. | ||
72 | * | ||
73 | * A single USB function uses one or more interfaces, and should in most | ||
74 | * cases support operation at both full and high speeds. Each function is | ||
75 | * associated by @usb_add_function() with a one configuration; that function | ||
76 | * causes @bind() to be called so resources can be allocated as part of | ||
77 | * setting up a gadget driver. Those resources include endpoints, which | ||
78 | * should be allocated using @usb_ep_autoconfig(). | ||
79 | * | ||
80 | * To support dual speed operation, a function driver provides descriptors | ||
81 | * for both high and full speed operation. Except in rare cases that don't | ||
82 | * involve bulk endpoints, each speed needs different endpoint descriptors. | ||
83 | * | ||
84 | * Function drivers choose their own strategies for managing instance data. | ||
85 | * The simplest strategy just declares it "static', which means the function | ||
86 | * can only be activated once. If the function needs to be exposed in more | ||
87 | * than one configuration at a given speed, it needs to support multiple | ||
88 | * usb_function structures (one for each configuration). | ||
89 | * | ||
90 | * A more complex strategy might encapsulate a @usb_function structure inside | ||
91 | * a driver-specific instance structure to allows multiple activations. An | ||
92 | * example of multiple activations might be a CDC ACM function that supports | ||
93 | * two or more distinct instances within the same configuration, providing | ||
94 | * several independent logical data links to a USB host. | ||
95 | */ | ||
96 | struct usb_function { | ||
97 | const char *name; | ||
98 | struct usb_gadget_strings **strings; | ||
99 | struct usb_descriptor_header **descriptors; | ||
100 | struct usb_descriptor_header **hs_descriptors; | ||
101 | |||
102 | struct usb_configuration *config; | ||
103 | |||
104 | /* REVISIT: bind() functions can be marked __init, which | ||
105 | * makes trouble for section mismatch analysis. See if | ||
106 | * we can't restructure things to avoid mismatching. | ||
107 | * Related: unbind() may kfree() but bind() won't... | ||
108 | */ | ||
109 | |||
110 | /* configuration management: bind/unbind */ | ||
111 | int (*bind)(struct usb_configuration *, | ||
112 | struct usb_function *); | ||
113 | void (*unbind)(struct usb_configuration *, | ||
114 | struct usb_function *); | ||
115 | |||
116 | /* runtime state management */ | ||
117 | int (*set_alt)(struct usb_function *, | ||
118 | unsigned interface, unsigned alt); | ||
119 | int (*get_alt)(struct usb_function *, | ||
120 | unsigned interface); | ||
121 | void (*disable)(struct usb_function *); | ||
122 | int (*setup)(struct usb_function *, | ||
123 | const struct usb_ctrlrequest *); | ||
124 | void (*suspend)(struct usb_function *); | ||
125 | void (*resume)(struct usb_function *); | ||
126 | |||
127 | /* internals */ | ||
128 | struct list_head list; | ||
129 | }; | ||
130 | |||
131 | int usb_add_function(struct usb_configuration *, struct usb_function *); | ||
132 | |||
133 | int usb_interface_id(struct usb_configuration *, struct usb_function *); | ||
134 | |||
135 | /** | ||
136 | * ep_choose - select descriptor endpoint at current device speed | ||
137 | * @g: gadget, connected and running at some speed | ||
138 | * @hs: descriptor to use for high speed operation | ||
139 | * @fs: descriptor to use for full or low speed operation | ||
140 | */ | ||
141 | static inline struct usb_endpoint_descriptor * | ||
142 | ep_choose(struct usb_gadget *g, struct usb_endpoint_descriptor *hs, | ||
143 | struct usb_endpoint_descriptor *fs) | ||
144 | { | ||
145 | if (gadget_is_dualspeed(g) && g->speed == USB_SPEED_HIGH) | ||
146 | return hs; | ||
147 | return fs; | ||
148 | } | ||
149 | |||
150 | #define MAX_CONFIG_INTERFACES 16 /* arbitrary; max 255 */ | ||
151 | |||
152 | /** | ||
153 | * struct usb_configuration - represents one gadget configuration | ||
154 | * @label: For diagnostics, describes the configuration. | ||
155 | * @strings: Tables of strings, keyed by identifiers assigned during @bind() | ||
156 | * and by language IDs provided in control requests. | ||
157 | * @descriptors: Table of descriptors preceding all function descriptors. | ||
158 | * Examples include OTG and vendor-specific descriptors. | ||
159 | * @bind: Called from @usb_add_config() to allocate resources unique to this | ||
160 | * configuration and to call @usb_add_function() for each function used. | ||
161 | * @unbind: Reverses @bind; called as a side effect of unregistering the | ||
162 | * driver which added this configuration. | ||
163 | * @setup: Used to delegate control requests that aren't handled by standard | ||
164 | * device infrastructure or directed at a specific interface. | ||
165 | * @bConfigurationValue: Copied into configuration descriptor. | ||
166 | * @iConfiguration: Copied into configuration descriptor. | ||
167 | * @bmAttributes: Copied into configuration descriptor. | ||
168 | * @bMaxPower: Copied into configuration descriptor. | ||
169 | * @cdev: assigned by @usb_add_config() before calling @bind(); this is | ||
170 | * the device associated with this configuration. | ||
171 | * | ||
172 | * Configurations are building blocks for gadget drivers structured around | ||
173 | * function drivers. Simple USB gadgets require only one function and one | ||
174 | * configuration, and handle dual-speed hardware by always providing the same | ||
175 | * functionality. Slightly more complex gadgets may have more than one | ||
176 | * single-function configuration at a given speed; or have configurations | ||
177 | * that only work at one speed. | ||
178 | * | ||
179 | * Composite devices are, by definition, ones with configurations which | ||
180 | * include more than one function. | ||
181 | * | ||
182 | * The lifecycle of a usb_configuration includes allocation, initialization | ||
183 | * of the fields described above, and calling @usb_add_config() to set up | ||
184 | * internal data and bind it to a specific device. The configuration's | ||
185 | * @bind() method is then used to initialize all the functions and then | ||
186 | * call @usb_add_function() for them. | ||
187 | * | ||
188 | * Those functions would normally be independant of each other, but that's | ||
189 | * not mandatory. CDC WMC devices are an example where functions often | ||
190 | * depend on other functions, with some functions subsidiary to others. | ||
191 | * Such interdependency may be managed in any way, so long as all of the | ||
192 | * descriptors complete by the time the composite driver returns from | ||
193 | * its bind() routine. | ||
194 | */ | ||
195 | struct usb_configuration { | ||
196 | const char *label; | ||
197 | struct usb_gadget_strings **strings; | ||
198 | const struct usb_descriptor_header **descriptors; | ||
199 | |||
200 | /* REVISIT: bind() functions can be marked __init, which | ||
201 | * makes trouble for section mismatch analysis. See if | ||
202 | * we can't restructure things to avoid mismatching... | ||
203 | */ | ||
204 | |||
205 | /* configuration management: bind/unbind */ | ||
206 | int (*bind)(struct usb_configuration *); | ||
207 | void (*unbind)(struct usb_configuration *); | ||
208 | int (*setup)(struct usb_configuration *, | ||
209 | const struct usb_ctrlrequest *); | ||
210 | |||
211 | /* fields in the config descriptor */ | ||
212 | u8 bConfigurationValue; | ||
213 | u8 iConfiguration; | ||
214 | u8 bmAttributes; | ||
215 | u8 bMaxPower; | ||
216 | |||
217 | struct usb_composite_dev *cdev; | ||
218 | |||
219 | /* internals */ | ||
220 | struct list_head list; | ||
221 | struct list_head functions; | ||
222 | u8 next_interface_id; | ||
223 | unsigned highspeed:1; | ||
224 | unsigned fullspeed:1; | ||
225 | struct usb_function *interface[MAX_CONFIG_INTERFACES]; | ||
226 | }; | ||
227 | |||
228 | int usb_add_config(struct usb_composite_dev *, | ||
229 | struct usb_configuration *); | ||
230 | |||
231 | /** | ||
232 | * struct usb_composite_driver - groups configurations into a gadget | ||
233 | * @name: For diagnostics, identifies the driver. | ||
234 | * @dev: Template descriptor for the device, including default device | ||
235 | * identifiers. | ||
236 | * @strings: tables of strings, keyed by identifiers assigned during bind() | ||
237 | * and language IDs provided in control requests | ||
238 | * @bind: (REQUIRED) Used to allocate resources that are shared across the | ||
239 | * whole device, such as string IDs, and add its configurations using | ||
240 | * @usb_add_config(). This may fail by returning a negative errno | ||
241 | * value; it should return zero on successful initialization. | ||
242 | * @unbind: Reverses @bind(); called as a side effect of unregistering | ||
243 | * this driver. | ||
244 | * | ||
245 | * Devices default to reporting self powered operation. Devices which rely | ||
246 | * on bus powered operation should report this in their @bind() method. | ||
247 | * | ||
248 | * Before returning from @bind, various fields in the template descriptor | ||
249 | * may be overridden. These include the idVendor/idProduct/bcdDevice values | ||
250 | * normally to bind the appropriate host side driver, and the three strings | ||
251 | * (iManufacturer, iProduct, iSerialNumber) normally used to provide user | ||
252 | * meaningful device identifiers. (The strings will not be defined unless | ||
253 | * they are defined in @dev and @strings.) The correct ep0 maxpacket size | ||
254 | * is also reported, as defined by the underlying controller driver. | ||
255 | */ | ||
256 | struct usb_composite_driver { | ||
257 | const char *name; | ||
258 | const struct usb_device_descriptor *dev; | ||
259 | struct usb_gadget_strings **strings; | ||
260 | |||
261 | /* REVISIT: bind() functions can be marked __init, which | ||
262 | * makes trouble for section mismatch analysis. See if | ||
263 | * we can't restructure things to avoid mismatching... | ||
264 | */ | ||
265 | |||
266 | int (*bind)(struct usb_composite_dev *); | ||
267 | int (*unbind)(struct usb_composite_dev *); | ||
268 | }; | ||
269 | |||
270 | extern int usb_composite_register(struct usb_composite_driver *); | ||
271 | extern void usb_composite_unregister(struct usb_composite_driver *); | ||
272 | |||
273 | |||
274 | /** | ||
275 | * struct usb_composite_device - represents one composite usb gadget | ||
276 | * @gadget: read-only, abstracts the gadget's usb peripheral controller | ||
277 | * @req: used for control responses; buffer is pre-allocated | ||
278 | * @bufsiz: size of buffer pre-allocated in @req | ||
279 | * @config: the currently active configuration | ||
280 | * | ||
281 | * One of these devices is allocated and initialized before the | ||
282 | * associated device driver's bind() is called. | ||
283 | * | ||
284 | * OPEN ISSUE: it appears that some WUSB devices will need to be | ||
285 | * built by combining a normal (wired) gadget with a wireless one. | ||
286 | * This revision of the gadget framework should probably try to make | ||
287 | * sure doing that won't hurt too much. | ||
288 | * | ||
289 | * One notion for how to handle Wireless USB devices involves: | ||
290 | * (a) a second gadget here, discovery mechanism TBD, but likely | ||
291 | * needing separate "register/unregister WUSB gadget" calls; | ||
292 | * (b) updates to usb_gadget to include flags "is it wireless", | ||
293 | * "is it wired", plus (presumably in a wrapper structure) | ||
294 | * bandgroup and PHY info; | ||
295 | * (c) presumably a wireless_ep wrapping a usb_ep, and reporting | ||
296 | * wireless-specific parameters like maxburst and maxsequence; | ||
297 | * (d) configurations that are specific to wireless links; | ||
298 | * (e) function drivers that understand wireless configs and will | ||
299 | * support wireless for (additional) function instances; | ||
300 | * (f) a function to support association setup (like CBAF), not | ||
301 | * necessarily requiring a wireless adapter; | ||
302 | * (g) composite device setup that can create one or more wireless | ||
303 | * configs, including appropriate association setup support; | ||
304 | * (h) more, TBD. | ||
305 | */ | ||
306 | struct usb_composite_dev { | ||
307 | struct usb_gadget *gadget; | ||
308 | struct usb_request *req; | ||
309 | unsigned bufsiz; | ||
310 | |||
311 | struct usb_configuration *config; | ||
312 | |||
313 | /* internals */ | ||
314 | struct usb_device_descriptor desc; | ||
315 | struct list_head configs; | ||
316 | struct usb_composite_driver *driver; | ||
317 | u8 next_string_id; | ||
318 | |||
319 | spinlock_t lock; | ||
320 | |||
321 | /* REVISIT use and existence of lock ... */ | ||
322 | }; | ||
323 | |||
324 | extern int usb_string_id(struct usb_composite_dev *c); | ||
325 | |||
326 | /* messaging utils */ | ||
327 | #define DBG(d, fmt, args...) \ | ||
328 | dev_dbg(&(d)->gadget->dev , fmt , ## args) | ||
329 | #define VDBG(d, fmt, args...) \ | ||
330 | dev_vdbg(&(d)->gadget->dev , fmt , ## args) | ||
331 | #define ERROR(d, fmt, args...) \ | ||
332 | dev_err(&(d)->gadget->dev , fmt , ## args) | ||
333 | #define WARNING(d, fmt, args...) \ | ||
334 | dev_warn(&(d)->gadget->dev , fmt , ## args) | ||
335 | #define INFO(d, fmt, args...) \ | ||
336 | dev_info(&(d)->gadget->dev , fmt , ## args) | ||
337 | |||
338 | #endif /* __LINUX_USB_COMPOSITE_H */ | ||
diff --git a/include/linux/usb/ehci_def.h b/include/linux/usb/ehci_def.h new file mode 100644 index 000000000000..5b88e36c9103 --- /dev/null +++ b/include/linux/usb/ehci_def.h | |||
@@ -0,0 +1,160 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2001-2002 by David Brownell | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify it | ||
5 | * under the terms of the GNU General Public License as published by the | ||
6 | * Free Software Foundation; either version 2 of the License, or (at your | ||
7 | * option) any later version. | ||
8 | * | ||
9 | * This program is distributed in the hope that it will be useful, but | ||
10 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY | ||
11 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | ||
12 | * for more details. | ||
13 | * | ||
14 | * You should have received a copy of the GNU General Public License | ||
15 | * along with this program; if not, write to the Free Software Foundation, | ||
16 | * Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
17 | */ | ||
18 | |||
19 | #ifndef __LINUX_USB_EHCI_DEF_H | ||
20 | #define __LINUX_USB_EHCI_DEF_H | ||
21 | |||
22 | /* EHCI register interface, corresponds to EHCI Revision 0.95 specification */ | ||
23 | |||
24 | /* Section 2.2 Host Controller Capability Registers */ | ||
25 | struct ehci_caps { | ||
26 | /* these fields are specified as 8 and 16 bit registers, | ||
27 | * but some hosts can't perform 8 or 16 bit PCI accesses. | ||
28 | */ | ||
29 | u32 hc_capbase; | ||
30 | #define HC_LENGTH(p) (((p)>>00)&0x00ff) /* bits 7:0 */ | ||
31 | #define HC_VERSION(p) (((p)>>16)&0xffff) /* bits 31:16 */ | ||
32 | u32 hcs_params; /* HCSPARAMS - offset 0x4 */ | ||
33 | #define HCS_DEBUG_PORT(p) (((p)>>20)&0xf) /* bits 23:20, debug port? */ | ||
34 | #define HCS_INDICATOR(p) ((p)&(1 << 16)) /* true: has port indicators */ | ||
35 | #define HCS_N_CC(p) (((p)>>12)&0xf) /* bits 15:12, #companion HCs */ | ||
36 | #define HCS_N_PCC(p) (((p)>>8)&0xf) /* bits 11:8, ports per CC */ | ||
37 | #define HCS_PORTROUTED(p) ((p)&(1 << 7)) /* true: port routing */ | ||
38 | #define HCS_PPC(p) ((p)&(1 << 4)) /* true: port power control */ | ||
39 | #define HCS_N_PORTS(p) (((p)>>0)&0xf) /* bits 3:0, ports on HC */ | ||
40 | |||
41 | u32 hcc_params; /* HCCPARAMS - offset 0x8 */ | ||
42 | #define HCC_EXT_CAPS(p) (((p)>>8)&0xff) /* for pci extended caps */ | ||
43 | #define HCC_ISOC_CACHE(p) ((p)&(1 << 7)) /* true: can cache isoc frame */ | ||
44 | #define HCC_ISOC_THRES(p) (((p)>>4)&0x7) /* bits 6:4, uframes cached */ | ||
45 | #define HCC_CANPARK(p) ((p)&(1 << 2)) /* true: can park on async qh */ | ||
46 | #define HCC_PGM_FRAMELISTLEN(p) ((p)&(1 << 1)) /* true: periodic_size changes*/ | ||
47 | #define HCC_64BIT_ADDR(p) ((p)&(1)) /* true: can use 64-bit addr */ | ||
48 | u8 portroute [8]; /* nibbles for routing - offset 0xC */ | ||
49 | } __attribute__ ((packed)); | ||
50 | |||
51 | |||
52 | /* Section 2.3 Host Controller Operational Registers */ | ||
53 | struct ehci_regs { | ||
54 | |||
55 | /* USBCMD: offset 0x00 */ | ||
56 | u32 command; | ||
57 | /* 23:16 is r/w intr rate, in microframes; default "8" == 1/msec */ | ||
58 | #define CMD_PARK (1<<11) /* enable "park" on async qh */ | ||
59 | #define CMD_PARK_CNT(c) (((c)>>8)&3) /* how many transfers to park for */ | ||
60 | #define CMD_LRESET (1<<7) /* partial reset (no ports, etc) */ | ||
61 | #define CMD_IAAD (1<<6) /* "doorbell" interrupt async advance */ | ||
62 | #define CMD_ASE (1<<5) /* async schedule enable */ | ||
63 | #define CMD_PSE (1<<4) /* periodic schedule enable */ | ||
64 | /* 3:2 is periodic frame list size */ | ||
65 | #define CMD_RESET (1<<1) /* reset HC not bus */ | ||
66 | #define CMD_RUN (1<<0) /* start/stop HC */ | ||
67 | |||
68 | /* USBSTS: offset 0x04 */ | ||
69 | u32 status; | ||
70 | #define STS_ASS (1<<15) /* Async Schedule Status */ | ||
71 | #define STS_PSS (1<<14) /* Periodic Schedule Status */ | ||
72 | #define STS_RECL (1<<13) /* Reclamation */ | ||
73 | #define STS_HALT (1<<12) /* Not running (any reason) */ | ||
74 | /* some bits reserved */ | ||
75 | /* these STS_* flags are also intr_enable bits (USBINTR) */ | ||
76 | #define STS_IAA (1<<5) /* Interrupted on async advance */ | ||
77 | #define STS_FATAL (1<<4) /* such as some PCI access errors */ | ||
78 | #define STS_FLR (1<<3) /* frame list rolled over */ | ||
79 | #define STS_PCD (1<<2) /* port change detect */ | ||
80 | #define STS_ERR (1<<1) /* "error" completion (overflow, ...) */ | ||
81 | #define STS_INT (1<<0) /* "normal" completion (short, ...) */ | ||
82 | |||
83 | /* USBINTR: offset 0x08 */ | ||
84 | u32 intr_enable; | ||
85 | |||
86 | /* FRINDEX: offset 0x0C */ | ||
87 | u32 frame_index; /* current microframe number */ | ||
88 | /* CTRLDSSEGMENT: offset 0x10 */ | ||
89 | u32 segment; /* address bits 63:32 if needed */ | ||
90 | /* PERIODICLISTBASE: offset 0x14 */ | ||
91 | u32 frame_list; /* points to periodic list */ | ||
92 | /* ASYNCLISTADDR: offset 0x18 */ | ||
93 | u32 async_next; /* address of next async queue head */ | ||
94 | |||
95 | u32 reserved [9]; | ||
96 | |||
97 | /* CONFIGFLAG: offset 0x40 */ | ||
98 | u32 configured_flag; | ||
99 | #define FLAG_CF (1<<0) /* true: we'll support "high speed" */ | ||
100 | |||
101 | /* PORTSC: offset 0x44 */ | ||
102 | u32 port_status [0]; /* up to N_PORTS */ | ||
103 | /* 31:23 reserved */ | ||
104 | #define PORT_WKOC_E (1<<22) /* wake on overcurrent (enable) */ | ||
105 | #define PORT_WKDISC_E (1<<21) /* wake on disconnect (enable) */ | ||
106 | #define PORT_WKCONN_E (1<<20) /* wake on connect (enable) */ | ||
107 | /* 19:16 for port testing */ | ||
108 | #define PORT_LED_OFF (0<<14) | ||
109 | #define PORT_LED_AMBER (1<<14) | ||
110 | #define PORT_LED_GREEN (2<<14) | ||
111 | #define PORT_LED_MASK (3<<14) | ||
112 | #define PORT_OWNER (1<<13) /* true: companion hc owns this port */ | ||
113 | #define PORT_POWER (1<<12) /* true: has power (see PPC) */ | ||
114 | #define PORT_USB11(x) (((x)&(3<<10)) == (1<<10)) /* USB 1.1 device */ | ||
115 | /* 11:10 for detecting lowspeed devices (reset vs release ownership) */ | ||
116 | /* 9 reserved */ | ||
117 | #define PORT_RESET (1<<8) /* reset port */ | ||
118 | #define PORT_SUSPEND (1<<7) /* suspend port */ | ||
119 | #define PORT_RESUME (1<<6) /* resume it */ | ||
120 | #define PORT_OCC (1<<5) /* over current change */ | ||
121 | #define PORT_OC (1<<4) /* over current active */ | ||
122 | #define PORT_PEC (1<<3) /* port enable change */ | ||
123 | #define PORT_PE (1<<2) /* port enable */ | ||
124 | #define PORT_CSC (1<<1) /* connect status change */ | ||
125 | #define PORT_CONNECT (1<<0) /* device connected */ | ||
126 | #define PORT_RWC_BITS (PORT_CSC | PORT_PEC | PORT_OCC) | ||
127 | } __attribute__ ((packed)); | ||
128 | |||
129 | #define USBMODE 0x68 /* USB Device mode */ | ||
130 | #define USBMODE_SDIS (1<<3) /* Stream disable */ | ||
131 | #define USBMODE_BE (1<<2) /* BE/LE endianness select */ | ||
132 | #define USBMODE_CM_HC (3<<0) /* host controller mode */ | ||
133 | #define USBMODE_CM_IDLE (0<<0) /* idle state */ | ||
134 | |||
135 | /* Appendix C, Debug port ... intended for use with special "debug devices" | ||
136 | * that can help if there's no serial console. (nonstandard enumeration.) | ||
137 | */ | ||
138 | struct ehci_dbg_port { | ||
139 | u32 control; | ||
140 | #define DBGP_OWNER (1<<30) | ||
141 | #define DBGP_ENABLED (1<<28) | ||
142 | #define DBGP_DONE (1<<16) | ||
143 | #define DBGP_INUSE (1<<10) | ||
144 | #define DBGP_ERRCODE(x) (((x)>>7)&0x07) | ||
145 | # define DBGP_ERR_BAD 1 | ||
146 | # define DBGP_ERR_SIGNAL 2 | ||
147 | #define DBGP_ERROR (1<<6) | ||
148 | #define DBGP_GO (1<<5) | ||
149 | #define DBGP_OUT (1<<4) | ||
150 | #define DBGP_LEN(x) (((x)>>0)&0x0f) | ||
151 | u32 pids; | ||
152 | #define DBGP_PID_GET(x) (((x)>>16)&0xff) | ||
153 | #define DBGP_PID_SET(data, tok) (((data)<<8)|(tok)) | ||
154 | u32 data03; | ||
155 | u32 data47; | ||
156 | u32 address; | ||
157 | #define DBGP_EPADDR(dev, ep) (((dev)<<8)|(ep)) | ||
158 | } __attribute__ ((packed)); | ||
159 | |||
160 | #endif /* __LINUX_USB_EHCI_DEF_H */ | ||
diff --git a/include/linux/usb/gadget.h b/include/linux/usb/gadget.h index cf468fbdbf8e..0460a746480c 100644 --- a/include/linux/usb/gadget.h +++ b/include/linux/usb/gadget.h | |||
@@ -33,7 +33,8 @@ struct usb_ep; | |||
33 | * @short_not_ok: When reading data, makes short packets be | 33 | * @short_not_ok: When reading data, makes short packets be |
34 | * treated as errors (queue stops advancing till cleanup). | 34 | * treated as errors (queue stops advancing till cleanup). |
35 | * @complete: Function called when request completes, so this request and | 35 | * @complete: Function called when request completes, so this request and |
36 | * its buffer may be re-used. | 36 | * its buffer may be re-used. The function will always be called with |
37 | * interrupts disabled, and it must not sleep. | ||
37 | * Reads terminate with a short packet, or when the buffer fills, | 38 | * Reads terminate with a short packet, or when the buffer fills, |
38 | * whichever comes first. When writes terminate, some data bytes | 39 | * whichever comes first. When writes terminate, some data bytes |
39 | * will usually still be in flight (often in a hardware fifo). | 40 | * will usually still be in flight (often in a hardware fifo). |
@@ -271,7 +272,10 @@ static inline void usb_ep_free_request(struct usb_ep *ep, | |||
271 | * (Note that some USB device controllers disallow protocol stall responses | 272 | * (Note that some USB device controllers disallow protocol stall responses |
272 | * in some cases.) When control responses are deferred (the response is | 273 | * in some cases.) When control responses are deferred (the response is |
273 | * written after the setup callback returns), then usb_ep_set_halt() may be | 274 | * written after the setup callback returns), then usb_ep_set_halt() may be |
274 | * used on ep0 to trigger protocol stalls. | 275 | * used on ep0 to trigger protocol stalls. Depending on the controller, |
276 | * it may not be possible to trigger a status-stage protocol stall when the | ||
277 | * data stage is over, that is, from within the response's completion | ||
278 | * routine. | ||
275 | * | 279 | * |
276 | * For periodic endpoints, like interrupt or isochronous ones, the usb host | 280 | * For periodic endpoints, like interrupt or isochronous ones, the usb host |
277 | * arranges to poll once per interval, and the gadget driver usually will | 281 | * arranges to poll once per interval, and the gadget driver usually will |
@@ -858,6 +862,25 @@ int usb_descriptor_fillbuf(void *, unsigned, | |||
858 | int usb_gadget_config_buf(const struct usb_config_descriptor *config, | 862 | int usb_gadget_config_buf(const struct usb_config_descriptor *config, |
859 | void *buf, unsigned buflen, const struct usb_descriptor_header **desc); | 863 | void *buf, unsigned buflen, const struct usb_descriptor_header **desc); |
860 | 864 | ||
865 | /* copy a NULL-terminated vector of descriptors */ | ||
866 | struct usb_descriptor_header **usb_copy_descriptors( | ||
867 | struct usb_descriptor_header **); | ||
868 | |||
869 | /* return copy of endpoint descriptor given original descriptor set */ | ||
870 | struct usb_endpoint_descriptor *usb_find_endpoint( | ||
871 | struct usb_descriptor_header **src, | ||
872 | struct usb_descriptor_header **copy, | ||
873 | struct usb_endpoint_descriptor *match); | ||
874 | |||
875 | /** | ||
876 | * usb_free_descriptors - free descriptors returned by usb_copy_descriptors() | ||
877 | * @v: vector of descriptors | ||
878 | */ | ||
879 | static inline void usb_free_descriptors(struct usb_descriptor_header **v) | ||
880 | { | ||
881 | kfree(v); | ||
882 | } | ||
883 | |||
861 | /*-------------------------------------------------------------------------*/ | 884 | /*-------------------------------------------------------------------------*/ |
862 | 885 | ||
863 | /* utility wrapping a simple endpoint selection policy */ | 886 | /* utility wrapping a simple endpoint selection policy */ |
diff --git a/include/linux/usb/irda.h b/include/linux/usb/irda.h new file mode 100644 index 000000000000..e345ceaf72d6 --- /dev/null +++ b/include/linux/usb/irda.h | |||
@@ -0,0 +1,151 @@ | |||
1 | /* | ||
2 | * USB IrDA Bridge Device Definition | ||
3 | */ | ||
4 | |||
5 | #ifndef __LINUX_USB_IRDA_H | ||
6 | #define __LINUX_USB_IRDA_H | ||
7 | |||
8 | /* This device should use Application-specific class */ | ||
9 | |||
10 | #define USB_SUBCLASS_IRDA 0x02 | ||
11 | |||
12 | /*-------------------------------------------------------------------------*/ | ||
13 | |||
14 | /* Class-Specific requests (bRequest field) */ | ||
15 | |||
16 | #define USB_REQ_CS_IRDA_RECEIVING 1 | ||
17 | #define USB_REQ_CS_IRDA_CHECK_MEDIA_BUSY 3 | ||
18 | #define USB_REQ_CS_IRDA_RATE_SNIFF 4 | ||
19 | #define USB_REQ_CS_IRDA_UNICAST_LIST 5 | ||
20 | #define USB_REQ_CS_IRDA_GET_CLASS_DESC 6 | ||
21 | |||
22 | /*-------------------------------------------------------------------------*/ | ||
23 | |||
24 | /* Class-Specific descriptor */ | ||
25 | |||
26 | #define USB_DT_CS_IRDA 0x21 | ||
27 | |||
28 | /*-------------------------------------------------------------------------*/ | ||
29 | |||
30 | /* Data sizes */ | ||
31 | |||
32 | #define USB_IRDA_DS_2048 (1 << 5) | ||
33 | #define USB_IRDA_DS_1024 (1 << 4) | ||
34 | #define USB_IRDA_DS_512 (1 << 3) | ||
35 | #define USB_IRDA_DS_256 (1 << 2) | ||
36 | #define USB_IRDA_DS_128 (1 << 1) | ||
37 | #define USB_IRDA_DS_64 (1 << 0) | ||
38 | |||
39 | /* Window sizes */ | ||
40 | |||
41 | #define USB_IRDA_WS_7 (1 << 6) | ||
42 | #define USB_IRDA_WS_6 (1 << 5) | ||
43 | #define USB_IRDA_WS_5 (1 << 4) | ||
44 | #define USB_IRDA_WS_4 (1 << 3) | ||
45 | #define USB_IRDA_WS_3 (1 << 2) | ||
46 | #define USB_IRDA_WS_2 (1 << 1) | ||
47 | #define USB_IRDA_WS_1 (1 << 0) | ||
48 | |||
49 | /* Min turnaround times in usecs */ | ||
50 | |||
51 | #define USB_IRDA_MTT_0 (1 << 7) | ||
52 | #define USB_IRDA_MTT_10 (1 << 6) | ||
53 | #define USB_IRDA_MTT_50 (1 << 5) | ||
54 | #define USB_IRDA_MTT_100 (1 << 4) | ||
55 | #define USB_IRDA_MTT_500 (1 << 3) | ||
56 | #define USB_IRDA_MTT_1000 (1 << 2) | ||
57 | #define USB_IRDA_MTT_5000 (1 << 1) | ||
58 | #define USB_IRDA_MTT_10000 (1 << 0) | ||
59 | |||
60 | /* Baud rates */ | ||
61 | |||
62 | #define USB_IRDA_BR_4000000 (1 << 8) | ||
63 | #define USB_IRDA_BR_1152000 (1 << 7) | ||
64 | #define USB_IRDA_BR_576000 (1 << 6) | ||
65 | #define USB_IRDA_BR_115200 (1 << 5) | ||
66 | #define USB_IRDA_BR_57600 (1 << 4) | ||
67 | #define USB_IRDA_BR_38400 (1 << 3) | ||
68 | #define USB_IRDA_BR_19200 (1 << 2) | ||
69 | #define USB_IRDA_BR_9600 (1 << 1) | ||
70 | #define USB_IRDA_BR_2400 (1 << 0) | ||
71 | |||
72 | /* Additional BOFs */ | ||
73 | |||
74 | #define USB_IRDA_AB_0 (1 << 7) | ||
75 | #define USB_IRDA_AB_1 (1 << 6) | ||
76 | #define USB_IRDA_AB_2 (1 << 5) | ||
77 | #define USB_IRDA_AB_3 (1 << 4) | ||
78 | #define USB_IRDA_AB_6 (1 << 3) | ||
79 | #define USB_IRDA_AB_12 (1 << 2) | ||
80 | #define USB_IRDA_AB_24 (1 << 1) | ||
81 | #define USB_IRDA_AB_48 (1 << 0) | ||
82 | |||
83 | /* IRDA Rate Sniff */ | ||
84 | |||
85 | #define USB_IRDA_RATE_SNIFF 1 | ||
86 | |||
87 | /*-------------------------------------------------------------------------*/ | ||
88 | |||
89 | struct usb_irda_cs_descriptor { | ||
90 | __u8 bLength; | ||
91 | __u8 bDescriptorType; | ||
92 | |||
93 | __le16 bcdSpecRevision; | ||
94 | __u8 bmDataSize; | ||
95 | __u8 bmWindowSize; | ||
96 | __u8 bmMinTurnaroundTime; | ||
97 | __le16 wBaudRate; | ||
98 | __u8 bmAdditionalBOFs; | ||
99 | __u8 bIrdaRateSniff; | ||
100 | __u8 bMaxUnicastList; | ||
101 | } __attribute__ ((packed)); | ||
102 | |||
103 | /*-------------------------------------------------------------------------*/ | ||
104 | |||
105 | /* Data Format */ | ||
106 | |||
107 | #define USB_IRDA_STATUS_MEDIA_BUSY (1 << 7) | ||
108 | |||
109 | /* The following is a 4-bit value used for both | ||
110 | * inbound and outbound headers: | ||
111 | * | ||
112 | * 0 - speed ignored | ||
113 | * 1 - 2400 bps | ||
114 | * 2 - 9600 bps | ||
115 | * 3 - 19200 bps | ||
116 | * 4 - 38400 bps | ||
117 | * 5 - 57600 bps | ||
118 | * 6 - 115200 bps | ||
119 | * 7 - 576000 bps | ||
120 | * 8 - 1.152 Mbps | ||
121 | * 9 - 5 mbps | ||
122 | * 10..15 - Reserved | ||
123 | */ | ||
124 | #define USB_IRDA_STATUS_LINK_SPEED 0x0f | ||
125 | |||
126 | /* The following is a 4-bit value used only for | ||
127 | * outbound header: | ||
128 | * | ||
129 | * 0 - No change (BOF ignored) | ||
130 | * 1 - 48 BOFs | ||
131 | * 2 - 24 BOFs | ||
132 | * 3 - 12 BOFs | ||
133 | * 4 - 6 BOFs | ||
134 | * 5 - 3 BOFs | ||
135 | * 6 - 2 BOFs | ||
136 | * 7 - 1 BOFs | ||
137 | * 8 - 0 BOFs | ||
138 | * 9..15 - Reserved | ||
139 | */ | ||
140 | #define USB_IRDA_EXTRA_BOFS 0xf0 | ||
141 | |||
142 | struct usb_irda_inbound_header { | ||
143 | __u8 bmStatus; | ||
144 | }; | ||
145 | |||
146 | struct usb_irda_outbound_header { | ||
147 | __u8 bmChange; | ||
148 | }; | ||
149 | |||
150 | #endif /* __LINUX_USB_IRDA_H */ | ||
151 | |||
diff --git a/include/linux/usb/musb.h b/include/linux/usb/musb.h new file mode 100644 index 000000000000..630962c04ca4 --- /dev/null +++ b/include/linux/usb/musb.h | |||
@@ -0,0 +1,98 @@ | |||
1 | /* | ||
2 | * This is used to for host and peripheral modes of the driver for | ||
3 | * Inventra (Multidrop) Highspeed Dual-Role Controllers: (M)HDRC. | ||
4 | * | ||
5 | * Board initialization should put one of these into dev->platform_data, | ||
6 | * probably on some platform_device named "musb_hdrc". It encapsulates | ||
7 | * key configuration differences between boards. | ||
8 | */ | ||
9 | |||
10 | /* The USB role is defined by the connector used on the board, so long as | ||
11 | * standards are being followed. (Developer boards sometimes won't.) | ||
12 | */ | ||
13 | enum musb_mode { | ||
14 | MUSB_UNDEFINED = 0, | ||
15 | MUSB_HOST, /* A or Mini-A connector */ | ||
16 | MUSB_PERIPHERAL, /* B or Mini-B connector */ | ||
17 | MUSB_OTG /* Mini-AB connector */ | ||
18 | }; | ||
19 | |||
20 | struct clk; | ||
21 | |||
22 | struct musb_hdrc_eps_bits { | ||
23 | const char name[16]; | ||
24 | u8 bits; | ||
25 | }; | ||
26 | |||
27 | struct musb_hdrc_config { | ||
28 | /* MUSB configuration-specific details */ | ||
29 | unsigned multipoint:1; /* multipoint device */ | ||
30 | unsigned dyn_fifo:1; /* supports dynamic fifo sizing */ | ||
31 | unsigned soft_con:1; /* soft connect required */ | ||
32 | unsigned utm_16:1; /* utm data witdh is 16 bits */ | ||
33 | unsigned big_endian:1; /* true if CPU uses big-endian */ | ||
34 | unsigned mult_bulk_tx:1; /* Tx ep required for multbulk pkts */ | ||
35 | unsigned mult_bulk_rx:1; /* Rx ep required for multbulk pkts */ | ||
36 | unsigned high_iso_tx:1; /* Tx ep required for HB iso */ | ||
37 | unsigned high_iso_rx:1; /* Rx ep required for HD iso */ | ||
38 | unsigned dma:1; /* supports DMA */ | ||
39 | unsigned vendor_req:1; /* vendor registers required */ | ||
40 | |||
41 | u8 num_eps; /* number of endpoints _with_ ep0 */ | ||
42 | u8 dma_channels; /* number of dma channels */ | ||
43 | u8 dyn_fifo_size; /* dynamic size in bytes */ | ||
44 | u8 vendor_ctrl; /* vendor control reg width */ | ||
45 | u8 vendor_stat; /* vendor status reg witdh */ | ||
46 | u8 dma_req_chan; /* bitmask for required dma channels */ | ||
47 | u8 ram_bits; /* ram address size */ | ||
48 | |||
49 | struct musb_hdrc_eps_bits *eps_bits; | ||
50 | }; | ||
51 | |||
52 | struct musb_hdrc_platform_data { | ||
53 | /* MUSB_HOST, MUSB_PERIPHERAL, or MUSB_OTG */ | ||
54 | u8 mode; | ||
55 | |||
56 | /* for clk_get() */ | ||
57 | const char *clock; | ||
58 | |||
59 | /* (HOST or OTG) switch VBUS on/off */ | ||
60 | int (*set_vbus)(struct device *dev, int is_on); | ||
61 | |||
62 | /* (HOST or OTG) mA/2 power supplied on (default = 8mA) */ | ||
63 | u8 power; | ||
64 | |||
65 | /* (PERIPHERAL) mA/2 max power consumed (default = 100mA) */ | ||
66 | u8 min_power; | ||
67 | |||
68 | /* (HOST or OTG) msec/2 after VBUS on till power good */ | ||
69 | u8 potpgt; | ||
70 | |||
71 | /* Power the device on or off */ | ||
72 | int (*set_power)(int state); | ||
73 | |||
74 | /* Turn device clock on or off */ | ||
75 | int (*set_clock)(struct clk *clock, int is_on); | ||
76 | |||
77 | /* MUSB configuration-specific details */ | ||
78 | struct musb_hdrc_config *config; | ||
79 | }; | ||
80 | |||
81 | |||
82 | /* TUSB 6010 support */ | ||
83 | |||
84 | #define TUSB6010_OSCCLK_60 16667 /* psec/clk @ 60.0 MHz */ | ||
85 | #define TUSB6010_REFCLK_24 41667 /* psec/clk @ 24.0 MHz XI */ | ||
86 | #define TUSB6010_REFCLK_19 52083 /* psec/clk @ 19.2 MHz CLKIN */ | ||
87 | |||
88 | #ifdef CONFIG_ARCH_OMAP2 | ||
89 | |||
90 | extern int __init tusb6010_setup_interface( | ||
91 | struct musb_hdrc_platform_data *data, | ||
92 | unsigned ps_refclk, unsigned waitpin, | ||
93 | unsigned async_cs, unsigned sync_cs, | ||
94 | unsigned irq, unsigned dmachan); | ||
95 | |||
96 | extern int tusb6010_platform_retime(unsigned is_refclk); | ||
97 | |||
98 | #endif /* OMAP2 */ | ||
diff --git a/include/linux/usb/rndis_host.h b/include/linux/usb/rndis_host.h index 29d6458ecb8d..0a6e6d4b929a 100644 --- a/include/linux/usb/rndis_host.h +++ b/include/linux/usb/rndis_host.h | |||
@@ -260,7 +260,8 @@ struct rndis_keepalive_c { /* IN (optionally OUT) */ | |||
260 | 260 | ||
261 | 261 | ||
262 | extern void rndis_status(struct usbnet *dev, struct urb *urb); | 262 | extern void rndis_status(struct usbnet *dev, struct urb *urb); |
263 | extern int rndis_command(struct usbnet *dev, struct rndis_msg_hdr *buf); | 263 | extern int |
264 | rndis_command(struct usbnet *dev, struct rndis_msg_hdr *buf, int buflen); | ||
264 | extern int | 265 | extern int |
265 | generic_rndis_bind(struct usbnet *dev, struct usb_interface *intf, int flags); | 266 | generic_rndis_bind(struct usbnet *dev, struct usb_interface *intf, int flags); |
266 | extern void rndis_unbind(struct usbnet *dev, struct usb_interface *intf); | 267 | extern void rndis_unbind(struct usbnet *dev, struct usb_interface *intf); |
diff --git a/include/linux/usb/serial.h b/include/linux/usb/serial.h index 8f891cbaf9ab..655341d0f534 100644 --- a/include/linux/usb/serial.h +++ b/include/linux/usb/serial.h | |||
@@ -17,7 +17,8 @@ | |||
17 | #include <linux/mutex.h> | 17 | #include <linux/mutex.h> |
18 | 18 | ||
19 | #define SERIAL_TTY_MAJOR 188 /* Nice legal number now */ | 19 | #define SERIAL_TTY_MAJOR 188 /* Nice legal number now */ |
20 | #define SERIAL_TTY_MINORS 255 /* loads of devices :) */ | 20 | #define SERIAL_TTY_MINORS 254 /* loads of devices :) */ |
21 | #define SERIAL_TTY_NO_MINOR 255 /* No minor was assigned */ | ||
21 | 22 | ||
22 | /* The maximum number of ports one device can grab at once */ | 23 | /* The maximum number of ports one device can grab at once */ |
23 | #define MAX_NUM_PORTS 8 | 24 | #define MAX_NUM_PORTS 8 |
@@ -62,7 +63,7 @@ | |||
62 | */ | 63 | */ |
63 | struct usb_serial_port { | 64 | struct usb_serial_port { |
64 | struct usb_serial *serial; | 65 | struct usb_serial *serial; |
65 | struct tty_struct *tty; | 66 | struct tty_port port; |
66 | spinlock_t lock; | 67 | spinlock_t lock; |
67 | struct mutex mutex; | 68 | struct mutex mutex; |
68 | unsigned char number; | 69 | unsigned char number; |
@@ -89,7 +90,6 @@ struct usb_serial_port { | |||
89 | 90 | ||
90 | wait_queue_head_t write_wait; | 91 | wait_queue_head_t write_wait; |
91 | struct work_struct work; | 92 | struct work_struct work; |
92 | int open_count; | ||
93 | char throttled; | 93 | char throttled; |
94 | char throttle_req; | 94 | char throttle_req; |
95 | char console; | 95 | char console; |
@@ -217,22 +217,27 @@ struct usb_serial_driver { | |||
217 | int (*resume)(struct usb_serial *serial); | 217 | int (*resume)(struct usb_serial *serial); |
218 | 218 | ||
219 | /* serial function calls */ | 219 | /* serial function calls */ |
220 | int (*open)(struct usb_serial_port *port, struct file *filp); | 220 | /* Called by console with tty = NULL and by tty */ |
221 | void (*close)(struct usb_serial_port *port, struct file *filp); | 221 | int (*open)(struct tty_struct *tty, |
222 | int (*write)(struct usb_serial_port *port, const unsigned char *buf, | 222 | struct usb_serial_port *port, struct file *filp); |
223 | int count); | 223 | void (*close)(struct tty_struct *tty, |
224 | int (*write_room)(struct usb_serial_port *port); | 224 | struct usb_serial_port *port, struct file *filp); |
225 | int (*ioctl)(struct usb_serial_port *port, struct file *file, | 225 | int (*write)(struct tty_struct *tty, struct usb_serial_port *port, |
226 | const unsigned char *buf, int count); | ||
227 | /* Called only by the tty layer */ | ||
228 | int (*write_room)(struct tty_struct *tty); | ||
229 | int (*ioctl)(struct tty_struct *tty, struct file *file, | ||
226 | unsigned int cmd, unsigned long arg); | 230 | unsigned int cmd, unsigned long arg); |
227 | void (*set_termios)(struct usb_serial_port *port, struct ktermios *old); | 231 | void (*set_termios)(struct tty_struct *tty, |
228 | void (*break_ctl)(struct usb_serial_port *port, int break_state); | 232 | struct usb_serial_port *port, struct ktermios *old); |
229 | int (*chars_in_buffer)(struct usb_serial_port *port); | 233 | void (*break_ctl)(struct tty_struct *tty, int break_state); |
230 | void (*throttle)(struct usb_serial_port *port); | 234 | int (*chars_in_buffer)(struct tty_struct *tty); |
231 | void (*unthrottle)(struct usb_serial_port *port); | 235 | void (*throttle)(struct tty_struct *tty); |
232 | int (*tiocmget)(struct usb_serial_port *port, struct file *file); | 236 | void (*unthrottle)(struct tty_struct *tty); |
233 | int (*tiocmset)(struct usb_serial_port *port, struct file *file, | 237 | int (*tiocmget)(struct tty_struct *tty, struct file *file); |
238 | int (*tiocmset)(struct tty_struct *tty, struct file *file, | ||
234 | unsigned int set, unsigned int clear); | 239 | unsigned int set, unsigned int clear); |
235 | 240 | /* USB events */ | |
236 | void (*read_int_callback)(struct urb *urb); | 241 | void (*read_int_callback)(struct urb *urb); |
237 | void (*write_int_callback)(struct urb *urb); | 242 | void (*write_int_callback)(struct urb *urb); |
238 | void (*read_bulk_callback)(struct urb *urb); | 243 | void (*read_bulk_callback)(struct urb *urb); |
@@ -270,19 +275,19 @@ static inline void usb_serial_console_disconnect(struct usb_serial *serial) {} | |||
270 | /* Functions needed by other parts of the usbserial core */ | 275 | /* Functions needed by other parts of the usbserial core */ |
271 | extern struct usb_serial *usb_serial_get_by_index(unsigned int minor); | 276 | extern struct usb_serial *usb_serial_get_by_index(unsigned int minor); |
272 | extern void usb_serial_put(struct usb_serial *serial); | 277 | extern void usb_serial_put(struct usb_serial *serial); |
273 | extern int usb_serial_generic_open(struct usb_serial_port *port, | 278 | extern int usb_serial_generic_open(struct tty_struct *tty, |
274 | struct file *filp); | 279 | struct usb_serial_port *port, struct file *filp); |
275 | extern int usb_serial_generic_write(struct usb_serial_port *port, | 280 | extern int usb_serial_generic_write(struct tty_struct *tty, |
276 | const unsigned char *buf, int count); | 281 | struct usb_serial_port *port, const unsigned char *buf, int count); |
277 | extern void usb_serial_generic_close(struct usb_serial_port *port, | 282 | extern void usb_serial_generic_close(struct tty_struct *tty, |
278 | struct file *filp); | 283 | struct usb_serial_port *port, struct file *filp); |
279 | extern int usb_serial_generic_resume(struct usb_serial *serial); | 284 | extern int usb_serial_generic_resume(struct usb_serial *serial); |
280 | extern int usb_serial_generic_write_room(struct usb_serial_port *port); | 285 | extern int usb_serial_generic_write_room(struct tty_struct *tty); |
281 | extern int usb_serial_generic_chars_in_buffer(struct usb_serial_port *port); | 286 | extern int usb_serial_generic_chars_in_buffer(struct tty_struct *tty); |
282 | extern void usb_serial_generic_read_bulk_callback(struct urb *urb); | 287 | extern void usb_serial_generic_read_bulk_callback(struct urb *urb); |
283 | extern void usb_serial_generic_write_bulk_callback(struct urb *urb); | 288 | extern void usb_serial_generic_write_bulk_callback(struct urb *urb); |
284 | extern void usb_serial_generic_throttle(struct usb_serial_port *port); | 289 | extern void usb_serial_generic_throttle(struct tty_struct *tty); |
285 | extern void usb_serial_generic_unthrottle(struct usb_serial_port *port); | 290 | extern void usb_serial_generic_unthrottle(struct tty_struct *tty); |
286 | extern void usb_serial_generic_shutdown(struct usb_serial *serial); | 291 | extern void usb_serial_generic_shutdown(struct usb_serial *serial); |
287 | extern int usb_serial_generic_register(int debug); | 292 | extern int usb_serial_generic_register(int debug); |
288 | extern void usb_serial_generic_deregister(void); | 293 | extern void usb_serial_generic_deregister(void); |
diff --git a/include/linux/usbdevice_fs.h b/include/linux/usbdevice_fs.h index 3118ede2c67b..0044d9b4cb85 100644 --- a/include/linux/usbdevice_fs.h +++ b/include/linux/usbdevice_fs.h | |||
@@ -22,8 +22,6 @@ | |||
22 | * | 22 | * |
23 | * History: | 23 | * History: |
24 | * 0.1 04.01.2000 Created | 24 | * 0.1 04.01.2000 Created |
25 | * | ||
26 | * $Id: usbdevice_fs.h,v 1.1 2000/01/06 18:40:41 tom Exp $ | ||
27 | */ | 25 | */ |
28 | 26 | ||
29 | /*****************************************************************************/ | 27 | /*****************************************************************************/ |
diff --git a/include/linux/videodev.h b/include/linux/videodev.h index 9385a566aed8..15a653d41132 100644 --- a/include/linux/videodev.h +++ b/include/linux/videodev.h | |||
@@ -17,6 +17,21 @@ | |||
17 | 17 | ||
18 | #if defined(CONFIG_VIDEO_V4L1_COMPAT) || !defined (__KERNEL__) | 18 | #if defined(CONFIG_VIDEO_V4L1_COMPAT) || !defined (__KERNEL__) |
19 | 19 | ||
20 | #define VID_TYPE_CAPTURE 1 /* Can capture */ | ||
21 | #define VID_TYPE_TUNER 2 /* Can tune */ | ||
22 | #define VID_TYPE_TELETEXT 4 /* Does teletext */ | ||
23 | #define VID_TYPE_OVERLAY 8 /* Overlay onto frame buffer */ | ||
24 | #define VID_TYPE_CHROMAKEY 16 /* Overlay by chromakey */ | ||
25 | #define VID_TYPE_CLIPPING 32 /* Can clip */ | ||
26 | #define VID_TYPE_FRAMERAM 64 /* Uses the frame buffer memory */ | ||
27 | #define VID_TYPE_SCALES 128 /* Scalable */ | ||
28 | #define VID_TYPE_MONOCHROME 256 /* Monochrome only */ | ||
29 | #define VID_TYPE_SUBCAPTURE 512 /* Can capture subareas of the image */ | ||
30 | #define VID_TYPE_MPEG_DECODER 1024 /* Can decode MPEG streams */ | ||
31 | #define VID_TYPE_MPEG_ENCODER 2048 /* Can encode MPEG streams */ | ||
32 | #define VID_TYPE_MJPEG_DECODER 4096 /* Can decode MJPEG streams */ | ||
33 | #define VID_TYPE_MJPEG_ENCODER 8192 /* Can encode MJPEG streams */ | ||
34 | |||
20 | struct video_capability | 35 | struct video_capability |
21 | { | 36 | { |
22 | char name[32]; | 37 | char name[32]; |
diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h index 4a535ea1e123..d4b03034ee73 100644 --- a/include/linux/videodev2.h +++ b/include/linux/videodev2.h | |||
@@ -55,13 +55,13 @@ | |||
55 | */ | 55 | */ |
56 | #ifndef __LINUX_VIDEODEV2_H | 56 | #ifndef __LINUX_VIDEODEV2_H |
57 | #define __LINUX_VIDEODEV2_H | 57 | #define __LINUX_VIDEODEV2_H |
58 | |||
58 | #ifdef __KERNEL__ | 59 | #ifdef __KERNEL__ |
59 | #include <linux/time.h> /* need struct timeval */ | 60 | #include <linux/time.h> /* need struct timeval */ |
60 | #include <linux/compiler.h> /* need __user */ | ||
61 | #else | 61 | #else |
62 | #define __user | ||
63 | #include <sys/time.h> | 62 | #include <sys/time.h> |
64 | #endif | 63 | #endif |
64 | #include <linux/compiler.h> | ||
65 | #include <linux/ioctl.h> | 65 | #include <linux/ioctl.h> |
66 | #include <linux/types.h> | 66 | #include <linux/types.h> |
67 | 67 | ||
@@ -71,6 +71,11 @@ | |||
71 | */ | 71 | */ |
72 | #define VIDEO_MAX_FRAME 32 | 72 | #define VIDEO_MAX_FRAME 32 |
73 | 73 | ||
74 | #ifndef __KERNEL__ | ||
75 | |||
76 | /* These defines are V4L1 specific and should not be used with the V4L2 API! | ||
77 | They will be removed from this header in the future. */ | ||
78 | |||
74 | #define VID_TYPE_CAPTURE 1 /* Can capture */ | 79 | #define VID_TYPE_CAPTURE 1 /* Can capture */ |
75 | #define VID_TYPE_TUNER 2 /* Can tune */ | 80 | #define VID_TYPE_TUNER 2 /* Can tune */ |
76 | #define VID_TYPE_TELETEXT 4 /* Does teletext */ | 81 | #define VID_TYPE_TELETEXT 4 /* Does teletext */ |
@@ -85,14 +90,15 @@ | |||
85 | #define VID_TYPE_MPEG_ENCODER 2048 /* Can encode MPEG streams */ | 90 | #define VID_TYPE_MPEG_ENCODER 2048 /* Can encode MPEG streams */ |
86 | #define VID_TYPE_MJPEG_DECODER 4096 /* Can decode MJPEG streams */ | 91 | #define VID_TYPE_MJPEG_DECODER 4096 /* Can decode MJPEG streams */ |
87 | #define VID_TYPE_MJPEG_ENCODER 8192 /* Can encode MJPEG streams */ | 92 | #define VID_TYPE_MJPEG_ENCODER 8192 /* Can encode MJPEG streams */ |
93 | #endif | ||
88 | 94 | ||
89 | /* | 95 | /* |
90 | * M I S C E L L A N E O U S | 96 | * M I S C E L L A N E O U S |
91 | */ | 97 | */ |
92 | 98 | ||
93 | /* Four-character-code (FOURCC) */ | 99 | /* Four-character-code (FOURCC) */ |
94 | #define v4l2_fourcc(a,b,c,d)\ | 100 | #define v4l2_fourcc(a, b, c, d)\ |
95 | (((__u32)(a)<<0)|((__u32)(b)<<8)|((__u32)(c)<<16)|((__u32)(d)<<24)) | 101 | ((__u32)(a) | ((__u32)(b) << 8) | ((__u32)(c) << 16) | ((__u32)(d) << 24)) |
96 | 102 | ||
97 | /* | 103 | /* |
98 | * E N U M S | 104 | * E N U M S |
@@ -226,8 +232,7 @@ struct v4l2_fract { | |||
226 | /* | 232 | /* |
227 | * D R I V E R C A P A B I L I T I E S | 233 | * D R I V E R C A P A B I L I T I E S |
228 | */ | 234 | */ |
229 | struct v4l2_capability | 235 | struct v4l2_capability { |
230 | { | ||
231 | __u8 driver[16]; /* i.e. "bttv" */ | 236 | __u8 driver[16]; /* i.e. "bttv" */ |
232 | __u8 card[32]; /* i.e. "Hauppauge WinTV" */ | 237 | __u8 card[32]; /* i.e. "Hauppauge WinTV" */ |
233 | __u8 bus_info[32]; /* "PCI:" + pci_name(pci_dev) */ | 238 | __u8 bus_info[32]; /* "PCI:" + pci_name(pci_dev) */ |
@@ -246,6 +251,7 @@ struct v4l2_capability | |||
246 | #define V4L2_CAP_SLICED_VBI_OUTPUT 0x00000080 /* Is a sliced VBI output device */ | 251 | #define V4L2_CAP_SLICED_VBI_OUTPUT 0x00000080 /* Is a sliced VBI output device */ |
247 | #define V4L2_CAP_RDS_CAPTURE 0x00000100 /* RDS data capture */ | 252 | #define V4L2_CAP_RDS_CAPTURE 0x00000100 /* RDS data capture */ |
248 | #define V4L2_CAP_VIDEO_OUTPUT_OVERLAY 0x00000200 /* Can do video output overlay */ | 253 | #define V4L2_CAP_VIDEO_OUTPUT_OVERLAY 0x00000200 /* Can do video output overlay */ |
254 | #define V4L2_CAP_HW_FREQ_SEEK 0x00000400 /* Can do hardware frequency seek */ | ||
249 | 255 | ||
250 | #define V4L2_CAP_TUNER 0x00010000 /* has a tuner */ | 256 | #define V4L2_CAP_TUNER 0x00010000 /* has a tuner */ |
251 | #define V4L2_CAP_AUDIO 0x00020000 /* has audio support */ | 257 | #define V4L2_CAP_AUDIO 0x00020000 /* has audio support */ |
@@ -258,8 +264,7 @@ struct v4l2_capability | |||
258 | /* | 264 | /* |
259 | * V I D E O I M A G E F O R M A T | 265 | * V I D E O I M A G E F O R M A T |
260 | */ | 266 | */ |
261 | struct v4l2_pix_format | 267 | struct v4l2_pix_format { |
262 | { | ||
263 | __u32 width; | 268 | __u32 width; |
264 | __u32 height; | 269 | __u32 height; |
265 | __u32 pixelformat; | 270 | __u32 pixelformat; |
@@ -271,64 +276,71 @@ struct v4l2_pix_format | |||
271 | }; | 276 | }; |
272 | 277 | ||
273 | /* Pixel format FOURCC depth Description */ | 278 | /* Pixel format FOURCC depth Description */ |
274 | #define V4L2_PIX_FMT_RGB332 v4l2_fourcc('R','G','B','1') /* 8 RGB-3-3-2 */ | 279 | #define V4L2_PIX_FMT_RGB332 v4l2_fourcc('R', 'G', 'B', '1') /* 8 RGB-3-3-2 */ |
275 | #define V4L2_PIX_FMT_RGB444 v4l2_fourcc('R','4','4','4') /* 16 xxxxrrrr ggggbbbb */ | 280 | #define V4L2_PIX_FMT_RGB444 v4l2_fourcc('R', '4', '4', '4') /* 16 xxxxrrrr ggggbbbb */ |
276 | #define V4L2_PIX_FMT_RGB555 v4l2_fourcc('R','G','B','O') /* 16 RGB-5-5-5 */ | 281 | #define V4L2_PIX_FMT_RGB555 v4l2_fourcc('R', 'G', 'B', 'O') /* 16 RGB-5-5-5 */ |
277 | #define V4L2_PIX_FMT_RGB565 v4l2_fourcc('R','G','B','P') /* 16 RGB-5-6-5 */ | 282 | #define V4L2_PIX_FMT_RGB565 v4l2_fourcc('R', 'G', 'B', 'P') /* 16 RGB-5-6-5 */ |
278 | #define V4L2_PIX_FMT_RGB555X v4l2_fourcc('R','G','B','Q') /* 16 RGB-5-5-5 BE */ | 283 | #define V4L2_PIX_FMT_RGB555X v4l2_fourcc('R', 'G', 'B', 'Q') /* 16 RGB-5-5-5 BE */ |
279 | #define V4L2_PIX_FMT_RGB565X v4l2_fourcc('R','G','B','R') /* 16 RGB-5-6-5 BE */ | 284 | #define V4L2_PIX_FMT_RGB565X v4l2_fourcc('R', 'G', 'B', 'R') /* 16 RGB-5-6-5 BE */ |
280 | #define V4L2_PIX_FMT_BGR24 v4l2_fourcc('B','G','R','3') /* 24 BGR-8-8-8 */ | 285 | #define V4L2_PIX_FMT_BGR24 v4l2_fourcc('B', 'G', 'R', '3') /* 24 BGR-8-8-8 */ |
281 | #define V4L2_PIX_FMT_RGB24 v4l2_fourcc('R','G','B','3') /* 24 RGB-8-8-8 */ | 286 | #define V4L2_PIX_FMT_RGB24 v4l2_fourcc('R', 'G', 'B', '3') /* 24 RGB-8-8-8 */ |
282 | #define V4L2_PIX_FMT_BGR32 v4l2_fourcc('B','G','R','4') /* 32 BGR-8-8-8-8 */ | 287 | #define V4L2_PIX_FMT_BGR32 v4l2_fourcc('B', 'G', 'R', '4') /* 32 BGR-8-8-8-8 */ |
283 | #define V4L2_PIX_FMT_RGB32 v4l2_fourcc('R','G','B','4') /* 32 RGB-8-8-8-8 */ | 288 | #define V4L2_PIX_FMT_RGB32 v4l2_fourcc('R', 'G', 'B', '4') /* 32 RGB-8-8-8-8 */ |
284 | #define V4L2_PIX_FMT_GREY v4l2_fourcc('G','R','E','Y') /* 8 Greyscale */ | 289 | #define V4L2_PIX_FMT_GREY v4l2_fourcc('G', 'R', 'E', 'Y') /* 8 Greyscale */ |
285 | #define V4L2_PIX_FMT_Y16 v4l2_fourcc('Y','1','6',' ') /* 16 Greyscale */ | 290 | #define V4L2_PIX_FMT_Y16 v4l2_fourcc('Y', '1', '6', ' ') /* 16 Greyscale */ |
286 | #define V4L2_PIX_FMT_PAL8 v4l2_fourcc('P','A','L','8') /* 8 8-bit palette */ | 291 | #define V4L2_PIX_FMT_PAL8 v4l2_fourcc('P', 'A', 'L', '8') /* 8 8-bit palette */ |
287 | #define V4L2_PIX_FMT_YVU410 v4l2_fourcc('Y','V','U','9') /* 9 YVU 4:1:0 */ | 292 | #define V4L2_PIX_FMT_YVU410 v4l2_fourcc('Y', 'V', 'U', '9') /* 9 YVU 4:1:0 */ |
288 | #define V4L2_PIX_FMT_YVU420 v4l2_fourcc('Y','V','1','2') /* 12 YVU 4:2:0 */ | 293 | #define V4L2_PIX_FMT_YVU420 v4l2_fourcc('Y', 'V', '1', '2') /* 12 YVU 4:2:0 */ |
289 | #define V4L2_PIX_FMT_YUYV v4l2_fourcc('Y','U','Y','V') /* 16 YUV 4:2:2 */ | 294 | #define V4L2_PIX_FMT_YUYV v4l2_fourcc('Y', 'U', 'Y', 'V') /* 16 YUV 4:2:2 */ |
290 | #define V4L2_PIX_FMT_UYVY v4l2_fourcc('U','Y','V','Y') /* 16 YUV 4:2:2 */ | 295 | #define V4L2_PIX_FMT_UYVY v4l2_fourcc('U', 'Y', 'V', 'Y') /* 16 YUV 4:2:2 */ |
291 | #define V4L2_PIX_FMT_YUV422P v4l2_fourcc('4','2','2','P') /* 16 YVU422 planar */ | 296 | #define V4L2_PIX_FMT_YUV422P v4l2_fourcc('4', '2', '2', 'P') /* 16 YVU422 planar */ |
292 | #define V4L2_PIX_FMT_YUV411P v4l2_fourcc('4','1','1','P') /* 16 YVU411 planar */ | 297 | #define V4L2_PIX_FMT_YUV411P v4l2_fourcc('4', '1', '1', 'P') /* 16 YVU411 planar */ |
293 | #define V4L2_PIX_FMT_Y41P v4l2_fourcc('Y','4','1','P') /* 12 YUV 4:1:1 */ | 298 | #define V4L2_PIX_FMT_Y41P v4l2_fourcc('Y', '4', '1', 'P') /* 12 YUV 4:1:1 */ |
294 | #define V4L2_PIX_FMT_YUV444 v4l2_fourcc('Y','4','4','4') /* 16 xxxxyyyy uuuuvvvv */ | 299 | #define V4L2_PIX_FMT_YUV444 v4l2_fourcc('Y', '4', '4', '4') /* 16 xxxxyyyy uuuuvvvv */ |
295 | #define V4L2_PIX_FMT_YUV555 v4l2_fourcc('Y','U','V','O') /* 16 YUV-5-5-5 */ | 300 | #define V4L2_PIX_FMT_YUV555 v4l2_fourcc('Y', 'U', 'V', 'O') /* 16 YUV-5-5-5 */ |
296 | #define V4L2_PIX_FMT_YUV565 v4l2_fourcc('Y','U','V','P') /* 16 YUV-5-6-5 */ | 301 | #define V4L2_PIX_FMT_YUV565 v4l2_fourcc('Y', 'U', 'V', 'P') /* 16 YUV-5-6-5 */ |
297 | #define V4L2_PIX_FMT_YUV32 v4l2_fourcc('Y','U','V','4') /* 32 YUV-8-8-8-8 */ | 302 | #define V4L2_PIX_FMT_YUV32 v4l2_fourcc('Y', 'U', 'V', '4') /* 32 YUV-8-8-8-8 */ |
298 | 303 | ||
299 | /* two planes -- one Y, one Cr + Cb interleaved */ | 304 | /* two planes -- one Y, one Cr + Cb interleaved */ |
300 | #define V4L2_PIX_FMT_NV12 v4l2_fourcc('N','V','1','2') /* 12 Y/CbCr 4:2:0 */ | 305 | #define V4L2_PIX_FMT_NV12 v4l2_fourcc('N', 'V', '1', '2') /* 12 Y/CbCr 4:2:0 */ |
301 | #define V4L2_PIX_FMT_NV21 v4l2_fourcc('N','V','2','1') /* 12 Y/CrCb 4:2:0 */ | 306 | #define V4L2_PIX_FMT_NV21 v4l2_fourcc('N', 'V', '2', '1') /* 12 Y/CrCb 4:2:0 */ |
302 | 307 | ||
303 | /* The following formats are not defined in the V4L2 specification */ | 308 | /* The following formats are not defined in the V4L2 specification */ |
304 | #define V4L2_PIX_FMT_YUV410 v4l2_fourcc('Y','U','V','9') /* 9 YUV 4:1:0 */ | 309 | #define V4L2_PIX_FMT_YUV410 v4l2_fourcc('Y', 'U', 'V', '9') /* 9 YUV 4:1:0 */ |
305 | #define V4L2_PIX_FMT_YUV420 v4l2_fourcc('Y','U','1','2') /* 12 YUV 4:2:0 */ | 310 | #define V4L2_PIX_FMT_YUV420 v4l2_fourcc('Y', 'U', '1', '2') /* 12 YUV 4:2:0 */ |
306 | #define V4L2_PIX_FMT_YYUV v4l2_fourcc('Y','Y','U','V') /* 16 YUV 4:2:2 */ | 311 | #define V4L2_PIX_FMT_YYUV v4l2_fourcc('Y', 'Y', 'U', 'V') /* 16 YUV 4:2:2 */ |
307 | #define V4L2_PIX_FMT_HI240 v4l2_fourcc('H','I','2','4') /* 8 8-bit color */ | 312 | #define V4L2_PIX_FMT_HI240 v4l2_fourcc('H', 'I', '2', '4') /* 8 8-bit color */ |
308 | #define V4L2_PIX_FMT_HM12 v4l2_fourcc('H','M','1','2') /* 8 YUV 4:2:0 16x16 macroblocks */ | 313 | #define V4L2_PIX_FMT_HM12 v4l2_fourcc('H', 'M', '1', '2') /* 8 YUV 4:2:0 16x16 macroblocks */ |
309 | 314 | ||
310 | /* see http://www.siliconimaging.com/RGB%20Bayer.htm */ | 315 | /* see http://www.siliconimaging.com/RGB%20Bayer.htm */ |
311 | #define V4L2_PIX_FMT_SBGGR8 v4l2_fourcc('B','A','8','1') /* 8 BGBG.. GRGR.. */ | 316 | #define V4L2_PIX_FMT_SBGGR8 v4l2_fourcc('B', 'A', '8', '1') /* 8 BGBG.. GRGR.. */ |
312 | #define V4L2_PIX_FMT_SBGGR16 v4l2_fourcc('B','Y','R','2') /* 16 BGBG.. GRGR.. */ | 317 | #define V4L2_PIX_FMT_SGBRG8 v4l2_fourcc('G', 'B', 'R', 'G') /* 8 GBGB.. RGRG.. */ |
318 | #define V4L2_PIX_FMT_SBGGR16 v4l2_fourcc('B', 'Y', 'R', '2') /* 16 BGBG.. GRGR.. */ | ||
313 | 319 | ||
314 | /* compressed formats */ | 320 | /* compressed formats */ |
315 | #define V4L2_PIX_FMT_MJPEG v4l2_fourcc('M','J','P','G') /* Motion-JPEG */ | 321 | #define V4L2_PIX_FMT_MJPEG v4l2_fourcc('M', 'J', 'P', 'G') /* Motion-JPEG */ |
316 | #define V4L2_PIX_FMT_JPEG v4l2_fourcc('J','P','E','G') /* JFIF JPEG */ | 322 | #define V4L2_PIX_FMT_JPEG v4l2_fourcc('J', 'P', 'E', 'G') /* JFIF JPEG */ |
317 | #define V4L2_PIX_FMT_DV v4l2_fourcc('d','v','s','d') /* 1394 */ | 323 | #define V4L2_PIX_FMT_DV v4l2_fourcc('d', 'v', 's', 'd') /* 1394 */ |
318 | #define V4L2_PIX_FMT_MPEG v4l2_fourcc('M','P','E','G') /* MPEG-1/2/4 */ | 324 | #define V4L2_PIX_FMT_MPEG v4l2_fourcc('M', 'P', 'E', 'G') /* MPEG-1/2/4 */ |
319 | 325 | ||
320 | /* Vendor-specific formats */ | 326 | /* Vendor-specific formats */ |
321 | #define V4L2_PIX_FMT_WNVA v4l2_fourcc('W','N','V','A') /* Winnov hw compress */ | 327 | #define V4L2_PIX_FMT_WNVA v4l2_fourcc('W', 'N', 'V', 'A') /* Winnov hw compress */ |
322 | #define V4L2_PIX_FMT_SN9C10X v4l2_fourcc('S','9','1','0') /* SN9C10x compression */ | 328 | #define V4L2_PIX_FMT_SN9C10X v4l2_fourcc('S', '9', '1', '0') /* SN9C10x compression */ |
323 | #define V4L2_PIX_FMT_PWC1 v4l2_fourcc('P','W','C','1') /* pwc older webcam */ | 329 | #define V4L2_PIX_FMT_PWC1 v4l2_fourcc('P', 'W', 'C', '1') /* pwc older webcam */ |
324 | #define V4L2_PIX_FMT_PWC2 v4l2_fourcc('P','W','C','2') /* pwc newer webcam */ | 330 | #define V4L2_PIX_FMT_PWC2 v4l2_fourcc('P', 'W', 'C', '2') /* pwc newer webcam */ |
325 | #define V4L2_PIX_FMT_ET61X251 v4l2_fourcc('E','6','2','5') /* ET61X251 compression */ | 331 | #define V4L2_PIX_FMT_ET61X251 v4l2_fourcc('E', '6', '2', '5') /* ET61X251 compression */ |
332 | #define V4L2_PIX_FMT_SPCA501 v4l2_fourcc('S', '5', '0', '1') /* YUYV per line */ | ||
333 | #define V4L2_PIX_FMT_SPCA505 v4l2_fourcc('S', '5', '0', '5') /* YYUV per line */ | ||
334 | #define V4L2_PIX_FMT_SPCA508 v4l2_fourcc('S', '5', '0', '8') /* YUVY per line */ | ||
335 | #define V4L2_PIX_FMT_SPCA561 v4l2_fourcc('S', '5', '6', '1') /* compressed GBRG bayer */ | ||
336 | #define V4L2_PIX_FMT_PAC207 v4l2_fourcc('P', '2', '0', '7') /* compressed BGGR bayer */ | ||
337 | #define V4L2_PIX_FMT_PJPG v4l2_fourcc('P', 'J', 'P', 'G') /* Pixart 73xx JPEG */ | ||
338 | #define V4L2_PIX_FMT_YVYU v4l2_fourcc('Y', 'V', 'Y', 'U') /* 16 YVU 4:2:2 */ | ||
326 | 339 | ||
327 | /* | 340 | /* |
328 | * F O R M A T E N U M E R A T I O N | 341 | * F O R M A T E N U M E R A T I O N |
329 | */ | 342 | */ |
330 | struct v4l2_fmtdesc | 343 | struct v4l2_fmtdesc { |
331 | { | ||
332 | __u32 index; /* Format number */ | 344 | __u32 index; /* Format number */ |
333 | enum v4l2_buf_type type; /* buffer type */ | 345 | enum v4l2_buf_type type; /* buffer type */ |
334 | __u32 flags; | 346 | __u32 flags; |
@@ -344,21 +356,18 @@ struct v4l2_fmtdesc | |||
344 | /* | 356 | /* |
345 | * F R A M E S I Z E E N U M E R A T I O N | 357 | * F R A M E S I Z E E N U M E R A T I O N |
346 | */ | 358 | */ |
347 | enum v4l2_frmsizetypes | 359 | enum v4l2_frmsizetypes { |
348 | { | ||
349 | V4L2_FRMSIZE_TYPE_DISCRETE = 1, | 360 | V4L2_FRMSIZE_TYPE_DISCRETE = 1, |
350 | V4L2_FRMSIZE_TYPE_CONTINUOUS = 2, | 361 | V4L2_FRMSIZE_TYPE_CONTINUOUS = 2, |
351 | V4L2_FRMSIZE_TYPE_STEPWISE = 3, | 362 | V4L2_FRMSIZE_TYPE_STEPWISE = 3, |
352 | }; | 363 | }; |
353 | 364 | ||
354 | struct v4l2_frmsize_discrete | 365 | struct v4l2_frmsize_discrete { |
355 | { | ||
356 | __u32 width; /* Frame width [pixel] */ | 366 | __u32 width; /* Frame width [pixel] */ |
357 | __u32 height; /* Frame height [pixel] */ | 367 | __u32 height; /* Frame height [pixel] */ |
358 | }; | 368 | }; |
359 | 369 | ||
360 | struct v4l2_frmsize_stepwise | 370 | struct v4l2_frmsize_stepwise { |
361 | { | ||
362 | __u32 min_width; /* Minimum frame width [pixel] */ | 371 | __u32 min_width; /* Minimum frame width [pixel] */ |
363 | __u32 max_width; /* Maximum frame width [pixel] */ | 372 | __u32 max_width; /* Maximum frame width [pixel] */ |
364 | __u32 step_width; /* Frame width step size [pixel] */ | 373 | __u32 step_width; /* Frame width step size [pixel] */ |
@@ -367,8 +376,7 @@ struct v4l2_frmsize_stepwise | |||
367 | __u32 step_height; /* Frame height step size [pixel] */ | 376 | __u32 step_height; /* Frame height step size [pixel] */ |
368 | }; | 377 | }; |
369 | 378 | ||
370 | struct v4l2_frmsizeenum | 379 | struct v4l2_frmsizeenum { |
371 | { | ||
372 | __u32 index; /* Frame size number */ | 380 | __u32 index; /* Frame size number */ |
373 | __u32 pixel_format; /* Pixel format */ | 381 | __u32 pixel_format; /* Pixel format */ |
374 | __u32 type; /* Frame size type the device supports. */ | 382 | __u32 type; /* Frame size type the device supports. */ |
@@ -384,22 +392,19 @@ struct v4l2_frmsizeenum | |||
384 | /* | 392 | /* |
385 | * F R A M E R A T E E N U M E R A T I O N | 393 | * F R A M E R A T E E N U M E R A T I O N |
386 | */ | 394 | */ |
387 | enum v4l2_frmivaltypes | 395 | enum v4l2_frmivaltypes { |
388 | { | ||
389 | V4L2_FRMIVAL_TYPE_DISCRETE = 1, | 396 | V4L2_FRMIVAL_TYPE_DISCRETE = 1, |
390 | V4L2_FRMIVAL_TYPE_CONTINUOUS = 2, | 397 | V4L2_FRMIVAL_TYPE_CONTINUOUS = 2, |
391 | V4L2_FRMIVAL_TYPE_STEPWISE = 3, | 398 | V4L2_FRMIVAL_TYPE_STEPWISE = 3, |
392 | }; | 399 | }; |
393 | 400 | ||
394 | struct v4l2_frmival_stepwise | 401 | struct v4l2_frmival_stepwise { |
395 | { | ||
396 | struct v4l2_fract min; /* Minimum frame interval [s] */ | 402 | struct v4l2_fract min; /* Minimum frame interval [s] */ |
397 | struct v4l2_fract max; /* Maximum frame interval [s] */ | 403 | struct v4l2_fract max; /* Maximum frame interval [s] */ |
398 | struct v4l2_fract step; /* Frame interval step size [s] */ | 404 | struct v4l2_fract step; /* Frame interval step size [s] */ |
399 | }; | 405 | }; |
400 | 406 | ||
401 | struct v4l2_frmivalenum | 407 | struct v4l2_frmivalenum { |
402 | { | ||
403 | __u32 index; /* Frame format index */ | 408 | __u32 index; /* Frame format index */ |
404 | __u32 pixel_format; /* Pixel format */ | 409 | __u32 pixel_format; /* Pixel format */ |
405 | __u32 width; /* Frame width */ | 410 | __u32 width; /* Frame width */ |
@@ -418,8 +423,7 @@ struct v4l2_frmivalenum | |||
418 | /* | 423 | /* |
419 | * T I M E C O D E | 424 | * T I M E C O D E |
420 | */ | 425 | */ |
421 | struct v4l2_timecode | 426 | struct v4l2_timecode { |
422 | { | ||
423 | __u32 type; | 427 | __u32 type; |
424 | __u32 flags; | 428 | __u32 flags; |
425 | __u8 frames; | 429 | __u8 frames; |
@@ -444,8 +448,7 @@ struct v4l2_timecode | |||
444 | #define V4L2_TC_USERBITS_8BITCHARS 0x0008 | 448 | #define V4L2_TC_USERBITS_8BITCHARS 0x0008 |
445 | /* The above is based on SMPTE timecodes */ | 449 | /* The above is based on SMPTE timecodes */ |
446 | 450 | ||
447 | struct v4l2_jpegcompression | 451 | struct v4l2_jpegcompression { |
448 | { | ||
449 | int quality; | 452 | int quality; |
450 | 453 | ||
451 | int APPn; /* Number of APP segment to be written, | 454 | int APPn; /* Number of APP segment to be written, |
@@ -477,16 +480,14 @@ struct v4l2_jpegcompression | |||
477 | /* | 480 | /* |
478 | * M E M O R Y - M A P P I N G B U F F E R S | 481 | * M E M O R Y - M A P P I N G B U F F E R S |
479 | */ | 482 | */ |
480 | struct v4l2_requestbuffers | 483 | struct v4l2_requestbuffers { |
481 | { | ||
482 | __u32 count; | 484 | __u32 count; |
483 | enum v4l2_buf_type type; | 485 | enum v4l2_buf_type type; |
484 | enum v4l2_memory memory; | 486 | enum v4l2_memory memory; |
485 | __u32 reserved[2]; | 487 | __u32 reserved[2]; |
486 | }; | 488 | }; |
487 | 489 | ||
488 | struct v4l2_buffer | 490 | struct v4l2_buffer { |
489 | { | ||
490 | __u32 index; | 491 | __u32 index; |
491 | enum v4l2_buf_type type; | 492 | enum v4l2_buf_type type; |
492 | __u32 bytesused; | 493 | __u32 bytesused; |
@@ -520,13 +521,12 @@ struct v4l2_buffer | |||
520 | /* | 521 | /* |
521 | * O V E R L A Y P R E V I E W | 522 | * O V E R L A Y P R E V I E W |
522 | */ | 523 | */ |
523 | struct v4l2_framebuffer | 524 | struct v4l2_framebuffer { |
524 | { | ||
525 | __u32 capability; | 525 | __u32 capability; |
526 | __u32 flags; | 526 | __u32 flags; |
527 | /* FIXME: in theory we should pass something like PCI device + memory | 527 | /* FIXME: in theory we should pass something like PCI device + memory |
528 | * region + offset instead of some physical address */ | 528 | * region + offset instead of some physical address */ |
529 | void* base; | 529 | void *base; |
530 | struct v4l2_pix_format fmt; | 530 | struct v4l2_pix_format fmt; |
531 | }; | 531 | }; |
532 | /* Flags for the 'capability' field. Read only */ | 532 | /* Flags for the 'capability' field. Read only */ |
@@ -545,14 +545,12 @@ struct v4l2_framebuffer | |||
545 | #define V4L2_FBUF_FLAG_GLOBAL_ALPHA 0x0010 | 545 | #define V4L2_FBUF_FLAG_GLOBAL_ALPHA 0x0010 |
546 | #define V4L2_FBUF_FLAG_LOCAL_INV_ALPHA 0x0020 | 546 | #define V4L2_FBUF_FLAG_LOCAL_INV_ALPHA 0x0020 |
547 | 547 | ||
548 | struct v4l2_clip | 548 | struct v4l2_clip { |
549 | { | ||
550 | struct v4l2_rect c; | 549 | struct v4l2_rect c; |
551 | struct v4l2_clip __user *next; | 550 | struct v4l2_clip __user *next; |
552 | }; | 551 | }; |
553 | 552 | ||
554 | struct v4l2_window | 553 | struct v4l2_window { |
555 | { | ||
556 | struct v4l2_rect w; | 554 | struct v4l2_rect w; |
557 | enum v4l2_field field; | 555 | enum v4l2_field field; |
558 | __u32 chromakey; | 556 | __u32 chromakey; |
@@ -565,8 +563,7 @@ struct v4l2_window | |||
565 | /* | 563 | /* |
566 | * C A P T U R E P A R A M E T E R S | 564 | * C A P T U R E P A R A M E T E R S |
567 | */ | 565 | */ |
568 | struct v4l2_captureparm | 566 | struct v4l2_captureparm { |
569 | { | ||
570 | __u32 capability; /* Supported modes */ | 567 | __u32 capability; /* Supported modes */ |
571 | __u32 capturemode; /* Current mode */ | 568 | __u32 capturemode; /* Current mode */ |
572 | struct v4l2_fract timeperframe; /* Time per frame in .1us units */ | 569 | struct v4l2_fract timeperframe; /* Time per frame in .1us units */ |
@@ -579,8 +576,7 @@ struct v4l2_captureparm | |||
579 | #define V4L2_MODE_HIGHQUALITY 0x0001 /* High quality imaging mode */ | 576 | #define V4L2_MODE_HIGHQUALITY 0x0001 /* High quality imaging mode */ |
580 | #define V4L2_CAP_TIMEPERFRAME 0x1000 /* timeperframe field is supported */ | 577 | #define V4L2_CAP_TIMEPERFRAME 0x1000 /* timeperframe field is supported */ |
581 | 578 | ||
582 | struct v4l2_outputparm | 579 | struct v4l2_outputparm { |
583 | { | ||
584 | __u32 capability; /* Supported modes */ | 580 | __u32 capability; /* Supported modes */ |
585 | __u32 outputmode; /* Current mode */ | 581 | __u32 outputmode; /* Current mode */ |
586 | struct v4l2_fract timeperframe; /* Time per frame in seconds */ | 582 | struct v4l2_fract timeperframe; /* Time per frame in seconds */ |
@@ -697,8 +693,7 @@ typedef __u64 v4l2_std_id; | |||
697 | #define V4L2_STD_ALL (V4L2_STD_525_60 |\ | 693 | #define V4L2_STD_ALL (V4L2_STD_525_60 |\ |
698 | V4L2_STD_625_50) | 694 | V4L2_STD_625_50) |
699 | 695 | ||
700 | struct v4l2_standard | 696 | struct v4l2_standard { |
701 | { | ||
702 | __u32 index; | 697 | __u32 index; |
703 | v4l2_std_id id; | 698 | v4l2_std_id id; |
704 | __u8 name[24]; | 699 | __u8 name[24]; |
@@ -710,8 +705,7 @@ struct v4l2_standard | |||
710 | /* | 705 | /* |
711 | * V I D E O I N P U T S | 706 | * V I D E O I N P U T S |
712 | */ | 707 | */ |
713 | struct v4l2_input | 708 | struct v4l2_input { |
714 | { | ||
715 | __u32 index; /* Which input */ | 709 | __u32 index; /* Which input */ |
716 | __u8 name[32]; /* Label */ | 710 | __u8 name[32]; /* Label */ |
717 | __u32 type; /* Type of input */ | 711 | __u32 type; /* Type of input */ |
@@ -748,8 +742,7 @@ struct v4l2_input | |||
748 | /* | 742 | /* |
749 | * V I D E O O U T P U T S | 743 | * V I D E O O U T P U T S |
750 | */ | 744 | */ |
751 | struct v4l2_output | 745 | struct v4l2_output { |
752 | { | ||
753 | __u32 index; /* Which output */ | 746 | __u32 index; /* Which output */ |
754 | __u8 name[32]; /* Label */ | 747 | __u8 name[32]; /* Label */ |
755 | __u32 type; /* Type of output */ | 748 | __u32 type; /* Type of output */ |
@@ -766,14 +759,12 @@ struct v4l2_output | |||
766 | /* | 759 | /* |
767 | * C O N T R O L S | 760 | * C O N T R O L S |
768 | */ | 761 | */ |
769 | struct v4l2_control | 762 | struct v4l2_control { |
770 | { | ||
771 | __u32 id; | 763 | __u32 id; |
772 | __s32 value; | 764 | __s32 value; |
773 | }; | 765 | }; |
774 | 766 | ||
775 | struct v4l2_ext_control | 767 | struct v4l2_ext_control { |
776 | { | ||
777 | __u32 id; | 768 | __u32 id; |
778 | __u32 reserved2[2]; | 769 | __u32 reserved2[2]; |
779 | union { | 770 | union { |
@@ -783,8 +774,7 @@ struct v4l2_ext_control | |||
783 | }; | 774 | }; |
784 | } __attribute__ ((packed)); | 775 | } __attribute__ ((packed)); |
785 | 776 | ||
786 | struct v4l2_ext_controls | 777 | struct v4l2_ext_controls { |
787 | { | ||
788 | __u32 ctrl_class; | 778 | __u32 ctrl_class; |
789 | __u32 count; | 779 | __u32 count; |
790 | __u32 error_idx; | 780 | __u32 error_idx; |
@@ -802,8 +792,7 @@ struct v4l2_ext_controls | |||
802 | #define V4L2_CTRL_DRIVER_PRIV(id) (((id) & 0xffff) >= 0x1000) | 792 | #define V4L2_CTRL_DRIVER_PRIV(id) (((id) & 0xffff) >= 0x1000) |
803 | 793 | ||
804 | /* Used in the VIDIOC_QUERYCTRL ioctl for querying controls */ | 794 | /* Used in the VIDIOC_QUERYCTRL ioctl for querying controls */ |
805 | struct v4l2_queryctrl | 795 | struct v4l2_queryctrl { |
806 | { | ||
807 | __u32 id; | 796 | __u32 id; |
808 | enum v4l2_ctrl_type type; | 797 | enum v4l2_ctrl_type type; |
809 | __u8 name[32]; /* Whatever */ | 798 | __u8 name[32]; /* Whatever */ |
@@ -816,8 +805,7 @@ struct v4l2_queryctrl | |||
816 | }; | 805 | }; |
817 | 806 | ||
818 | /* Used in the VIDIOC_QUERYMENU ioctl for querying menu items */ | 807 | /* Used in the VIDIOC_QUERYMENU ioctl for querying menu items */ |
819 | struct v4l2_querymenu | 808 | struct v4l2_querymenu { |
820 | { | ||
821 | __u32 id; | 809 | __u32 id; |
822 | __u32 index; | 810 | __u32 index; |
823 | __u8 name[32]; /* Whatever */ | 811 | __u8 name[32]; /* Whatever */ |
@@ -922,6 +910,8 @@ enum v4l2_mpeg_audio_encoding { | |||
922 | V4L2_MPEG_AUDIO_ENCODING_LAYER_1 = 0, | 910 | V4L2_MPEG_AUDIO_ENCODING_LAYER_1 = 0, |
923 | V4L2_MPEG_AUDIO_ENCODING_LAYER_2 = 1, | 911 | V4L2_MPEG_AUDIO_ENCODING_LAYER_2 = 1, |
924 | V4L2_MPEG_AUDIO_ENCODING_LAYER_3 = 2, | 912 | V4L2_MPEG_AUDIO_ENCODING_LAYER_3 = 2, |
913 | V4L2_MPEG_AUDIO_ENCODING_AAC = 3, | ||
914 | V4L2_MPEG_AUDIO_ENCODING_AC3 = 4, | ||
925 | }; | 915 | }; |
926 | #define V4L2_CID_MPEG_AUDIO_L1_BITRATE (V4L2_CID_MPEG_BASE+102) | 916 | #define V4L2_CID_MPEG_AUDIO_L1_BITRATE (V4L2_CID_MPEG_BASE+102) |
927 | enum v4l2_mpeg_audio_l1_bitrate { | 917 | enum v4l2_mpeg_audio_l1_bitrate { |
@@ -1000,12 +990,36 @@ enum v4l2_mpeg_audio_crc { | |||
1000 | V4L2_MPEG_AUDIO_CRC_CRC16 = 1, | 990 | V4L2_MPEG_AUDIO_CRC_CRC16 = 1, |
1001 | }; | 991 | }; |
1002 | #define V4L2_CID_MPEG_AUDIO_MUTE (V4L2_CID_MPEG_BASE+109) | 992 | #define V4L2_CID_MPEG_AUDIO_MUTE (V4L2_CID_MPEG_BASE+109) |
993 | #define V4L2_CID_MPEG_AUDIO_AAC_BITRATE (V4L2_CID_MPEG_BASE+110) | ||
994 | #define V4L2_CID_MPEG_AUDIO_AC3_BITRATE (V4L2_CID_MPEG_BASE+111) | ||
995 | enum v4l2_mpeg_audio_ac3_bitrate { | ||
996 | V4L2_MPEG_AUDIO_AC3_BITRATE_32K = 0, | ||
997 | V4L2_MPEG_AUDIO_AC3_BITRATE_40K = 1, | ||
998 | V4L2_MPEG_AUDIO_AC3_BITRATE_48K = 2, | ||
999 | V4L2_MPEG_AUDIO_AC3_BITRATE_56K = 3, | ||
1000 | V4L2_MPEG_AUDIO_AC3_BITRATE_64K = 4, | ||
1001 | V4L2_MPEG_AUDIO_AC3_BITRATE_80K = 5, | ||
1002 | V4L2_MPEG_AUDIO_AC3_BITRATE_96K = 6, | ||
1003 | V4L2_MPEG_AUDIO_AC3_BITRATE_112K = 7, | ||
1004 | V4L2_MPEG_AUDIO_AC3_BITRATE_128K = 8, | ||
1005 | V4L2_MPEG_AUDIO_AC3_BITRATE_160K = 9, | ||
1006 | V4L2_MPEG_AUDIO_AC3_BITRATE_192K = 10, | ||
1007 | V4L2_MPEG_AUDIO_AC3_BITRATE_224K = 11, | ||
1008 | V4L2_MPEG_AUDIO_AC3_BITRATE_256K = 12, | ||
1009 | V4L2_MPEG_AUDIO_AC3_BITRATE_320K = 13, | ||
1010 | V4L2_MPEG_AUDIO_AC3_BITRATE_384K = 14, | ||
1011 | V4L2_MPEG_AUDIO_AC3_BITRATE_448K = 15, | ||
1012 | V4L2_MPEG_AUDIO_AC3_BITRATE_512K = 16, | ||
1013 | V4L2_MPEG_AUDIO_AC3_BITRATE_576K = 17, | ||
1014 | V4L2_MPEG_AUDIO_AC3_BITRATE_640K = 18, | ||
1015 | }; | ||
1003 | 1016 | ||
1004 | /* MPEG video */ | 1017 | /* MPEG video */ |
1005 | #define V4L2_CID_MPEG_VIDEO_ENCODING (V4L2_CID_MPEG_BASE+200) | 1018 | #define V4L2_CID_MPEG_VIDEO_ENCODING (V4L2_CID_MPEG_BASE+200) |
1006 | enum v4l2_mpeg_video_encoding { | 1019 | enum v4l2_mpeg_video_encoding { |
1007 | V4L2_MPEG_VIDEO_ENCODING_MPEG_1 = 0, | 1020 | V4L2_MPEG_VIDEO_ENCODING_MPEG_1 = 0, |
1008 | V4L2_MPEG_VIDEO_ENCODING_MPEG_2 = 1, | 1021 | V4L2_MPEG_VIDEO_ENCODING_MPEG_2 = 1, |
1022 | V4L2_MPEG_VIDEO_ENCODING_MPEG_4_AVC = 2, | ||
1009 | }; | 1023 | }; |
1010 | #define V4L2_CID_MPEG_VIDEO_ASPECT (V4L2_CID_MPEG_BASE+201) | 1024 | #define V4L2_CID_MPEG_VIDEO_ASPECT (V4L2_CID_MPEG_BASE+201) |
1011 | enum v4l2_mpeg_video_aspect { | 1025 | enum v4l2_mpeg_video_aspect { |
@@ -1099,8 +1113,7 @@ enum v4l2_exposure_auto_type { | |||
1099 | /* | 1113 | /* |
1100 | * T U N I N G | 1114 | * T U N I N G |
1101 | */ | 1115 | */ |
1102 | struct v4l2_tuner | 1116 | struct v4l2_tuner { |
1103 | { | ||
1104 | __u32 index; | 1117 | __u32 index; |
1105 | __u8 name[32]; | 1118 | __u8 name[32]; |
1106 | enum v4l2_tuner_type type; | 1119 | enum v4l2_tuner_type type; |
@@ -1114,8 +1127,7 @@ struct v4l2_tuner | |||
1114 | __u32 reserved[4]; | 1127 | __u32 reserved[4]; |
1115 | }; | 1128 | }; |
1116 | 1129 | ||
1117 | struct v4l2_modulator | 1130 | struct v4l2_modulator { |
1118 | { | ||
1119 | __u32 index; | 1131 | __u32 index; |
1120 | __u8 name[32]; | 1132 | __u8 name[32]; |
1121 | __u32 capability; | 1133 | __u32 capability; |
@@ -1148,19 +1160,25 @@ struct v4l2_modulator | |||
1148 | #define V4L2_TUNER_MODE_LANG1 0x0003 | 1160 | #define V4L2_TUNER_MODE_LANG1 0x0003 |
1149 | #define V4L2_TUNER_MODE_LANG1_LANG2 0x0004 | 1161 | #define V4L2_TUNER_MODE_LANG1_LANG2 0x0004 |
1150 | 1162 | ||
1151 | struct v4l2_frequency | 1163 | struct v4l2_frequency { |
1152 | { | ||
1153 | __u32 tuner; | 1164 | __u32 tuner; |
1154 | enum v4l2_tuner_type type; | 1165 | enum v4l2_tuner_type type; |
1155 | __u32 frequency; | 1166 | __u32 frequency; |
1156 | __u32 reserved[8]; | 1167 | __u32 reserved[8]; |
1157 | }; | 1168 | }; |
1158 | 1169 | ||
1170 | struct v4l2_hw_freq_seek { | ||
1171 | __u32 tuner; | ||
1172 | enum v4l2_tuner_type type; | ||
1173 | __u32 seek_upward; | ||
1174 | __u32 wrap_around; | ||
1175 | __u32 reserved[8]; | ||
1176 | }; | ||
1177 | |||
1159 | /* | 1178 | /* |
1160 | * A U D I O | 1179 | * A U D I O |
1161 | */ | 1180 | */ |
1162 | struct v4l2_audio | 1181 | struct v4l2_audio { |
1163 | { | ||
1164 | __u32 index; | 1182 | __u32 index; |
1165 | __u8 name[32]; | 1183 | __u8 name[32]; |
1166 | __u32 capability; | 1184 | __u32 capability; |
@@ -1175,8 +1193,7 @@ struct v4l2_audio | |||
1175 | /* Flags for the 'mode' field */ | 1193 | /* Flags for the 'mode' field */ |
1176 | #define V4L2_AUDMODE_AVL 0x00001 | 1194 | #define V4L2_AUDMODE_AVL 0x00001 |
1177 | 1195 | ||
1178 | struct v4l2_audioout | 1196 | struct v4l2_audioout { |
1179 | { | ||
1180 | __u32 index; | 1197 | __u32 index; |
1181 | __u8 name[32]; | 1198 | __u8 name[32]; |
1182 | __u32 capability; | 1199 | __u32 capability; |
@@ -1240,8 +1257,7 @@ struct v4l2_encoder_cmd { | |||
1240 | */ | 1257 | */ |
1241 | 1258 | ||
1242 | /* Raw VBI */ | 1259 | /* Raw VBI */ |
1243 | struct v4l2_vbi_format | 1260 | struct v4l2_vbi_format { |
1244 | { | ||
1245 | __u32 sampling_rate; /* in 1 Hz */ | 1261 | __u32 sampling_rate; /* in 1 Hz */ |
1246 | __u32 offset; | 1262 | __u32 offset; |
1247 | __u32 samples_per_line; | 1263 | __u32 samples_per_line; |
@@ -1253,8 +1269,8 @@ struct v4l2_vbi_format | |||
1253 | }; | 1269 | }; |
1254 | 1270 | ||
1255 | /* VBI flags */ | 1271 | /* VBI flags */ |
1256 | #define V4L2_VBI_UNSYNC (1<< 0) | 1272 | #define V4L2_VBI_UNSYNC (1 << 0) |
1257 | #define V4L2_VBI_INTERLACED (1<< 1) | 1273 | #define V4L2_VBI_INTERLACED (1 << 1) |
1258 | 1274 | ||
1259 | /* Sliced VBI | 1275 | /* Sliced VBI |
1260 | * | 1276 | * |
@@ -1263,8 +1279,7 @@ struct v4l2_vbi_format | |||
1263 | * notice in the definitive implementation. | 1279 | * notice in the definitive implementation. |
1264 | */ | 1280 | */ |
1265 | 1281 | ||
1266 | struct v4l2_sliced_vbi_format | 1282 | struct v4l2_sliced_vbi_format { |
1267 | { | ||
1268 | __u16 service_set; | 1283 | __u16 service_set; |
1269 | /* service_lines[0][...] specifies lines 0-23 (1-23 used) of the first field | 1284 | /* service_lines[0][...] specifies lines 0-23 (1-23 used) of the first field |
1270 | service_lines[1][...] specifies lines 0-23 (1-23 used) of the second field | 1285 | service_lines[1][...] specifies lines 0-23 (1-23 used) of the second field |
@@ -1288,8 +1303,7 @@ struct v4l2_sliced_vbi_format | |||
1288 | #define V4L2_SLICED_VBI_525 (V4L2_SLICED_CAPTION_525) | 1303 | #define V4L2_SLICED_VBI_525 (V4L2_SLICED_CAPTION_525) |
1289 | #define V4L2_SLICED_VBI_625 (V4L2_SLICED_TELETEXT_B | V4L2_SLICED_VPS | V4L2_SLICED_WSS_625) | 1304 | #define V4L2_SLICED_VBI_625 (V4L2_SLICED_TELETEXT_B | V4L2_SLICED_VPS | V4L2_SLICED_WSS_625) |
1290 | 1305 | ||
1291 | struct v4l2_sliced_vbi_cap | 1306 | struct v4l2_sliced_vbi_cap { |
1292 | { | ||
1293 | __u16 service_set; | 1307 | __u16 service_set; |
1294 | /* service_lines[0][...] specifies lines 0-23 (1-23 used) of the first field | 1308 | /* service_lines[0][...] specifies lines 0-23 (1-23 used) of the first field |
1295 | service_lines[1][...] specifies lines 0-23 (1-23 used) of the second field | 1309 | service_lines[1][...] specifies lines 0-23 (1-23 used) of the second field |
@@ -1300,8 +1314,7 @@ struct v4l2_sliced_vbi_cap | |||
1300 | __u32 reserved[3]; /* must be 0 */ | 1314 | __u32 reserved[3]; /* must be 0 */ |
1301 | }; | 1315 | }; |
1302 | 1316 | ||
1303 | struct v4l2_sliced_vbi_data | 1317 | struct v4l2_sliced_vbi_data { |
1304 | { | ||
1305 | __u32 id; | 1318 | __u32 id; |
1306 | __u32 field; /* 0: first field, 1: second field */ | 1319 | __u32 field; /* 0: first field, 1: second field */ |
1307 | __u32 line; /* 1-23 */ | 1320 | __u32 line; /* 1-23 */ |
@@ -1315,27 +1328,23 @@ struct v4l2_sliced_vbi_data | |||
1315 | 1328 | ||
1316 | /* Stream data format | 1329 | /* Stream data format |
1317 | */ | 1330 | */ |
1318 | struct v4l2_format | 1331 | struct v4l2_format { |
1319 | { | ||
1320 | enum v4l2_buf_type type; | 1332 | enum v4l2_buf_type type; |
1321 | union | 1333 | union { |
1322 | { | 1334 | struct v4l2_pix_format pix; /* V4L2_BUF_TYPE_VIDEO_CAPTURE */ |
1323 | struct v4l2_pix_format pix; // V4L2_BUF_TYPE_VIDEO_CAPTURE | 1335 | struct v4l2_window win; /* V4L2_BUF_TYPE_VIDEO_OVERLAY */ |
1324 | struct v4l2_window win; // V4L2_BUF_TYPE_VIDEO_OVERLAY | 1336 | struct v4l2_vbi_format vbi; /* V4L2_BUF_TYPE_VBI_CAPTURE */ |
1325 | struct v4l2_vbi_format vbi; // V4L2_BUF_TYPE_VBI_CAPTURE | 1337 | struct v4l2_sliced_vbi_format sliced; /* V4L2_BUF_TYPE_SLICED_VBI_CAPTURE */ |
1326 | struct v4l2_sliced_vbi_format sliced; // V4L2_BUF_TYPE_SLICED_VBI_CAPTURE | 1338 | __u8 raw_data[200]; /* user-defined */ |
1327 | __u8 raw_data[200]; // user-defined | ||
1328 | } fmt; | 1339 | } fmt; |
1329 | }; | 1340 | }; |
1330 | 1341 | ||
1331 | 1342 | ||
1332 | /* Stream type-dependent parameters | 1343 | /* Stream type-dependent parameters |
1333 | */ | 1344 | */ |
1334 | struct v4l2_streamparm | 1345 | struct v4l2_streamparm { |
1335 | { | ||
1336 | enum v4l2_buf_type type; | 1346 | enum v4l2_buf_type type; |
1337 | union | 1347 | union { |
1338 | { | ||
1339 | struct v4l2_captureparm capture; | 1348 | struct v4l2_captureparm capture; |
1340 | struct v4l2_outputparm output; | 1349 | struct v4l2_outputparm output; |
1341 | __u8 raw_data[200]; /* user-defined */ | 1350 | __u8 raw_data[200]; /* user-defined */ |
@@ -1373,91 +1382,86 @@ struct v4l2_chip_ident { | |||
1373 | * I O C T L C O D E S F O R V I D E O D E V I C E S | 1382 | * I O C T L C O D E S F O R V I D E O D E V I C E S |
1374 | * | 1383 | * |
1375 | */ | 1384 | */ |
1376 | #define VIDIOC_QUERYCAP _IOR ('V', 0, struct v4l2_capability) | 1385 | #define VIDIOC_QUERYCAP _IOR('V', 0, struct v4l2_capability) |
1377 | #define VIDIOC_RESERVED _IO ('V', 1) | 1386 | #define VIDIOC_RESERVED _IO('V', 1) |
1378 | #define VIDIOC_ENUM_FMT _IOWR ('V', 2, struct v4l2_fmtdesc) | 1387 | #define VIDIOC_ENUM_FMT _IOWR('V', 2, struct v4l2_fmtdesc) |
1379 | #define VIDIOC_G_FMT _IOWR ('V', 4, struct v4l2_format) | 1388 | #define VIDIOC_G_FMT _IOWR('V', 4, struct v4l2_format) |
1380 | #define VIDIOC_S_FMT _IOWR ('V', 5, struct v4l2_format) | 1389 | #define VIDIOC_S_FMT _IOWR('V', 5, struct v4l2_format) |
1381 | #define VIDIOC_REQBUFS _IOWR ('V', 8, struct v4l2_requestbuffers) | 1390 | #define VIDIOC_REQBUFS _IOWR('V', 8, struct v4l2_requestbuffers) |
1382 | #define VIDIOC_QUERYBUF _IOWR ('V', 9, struct v4l2_buffer) | 1391 | #define VIDIOC_QUERYBUF _IOWR('V', 9, struct v4l2_buffer) |
1383 | #define VIDIOC_G_FBUF _IOR ('V', 10, struct v4l2_framebuffer) | 1392 | #define VIDIOC_G_FBUF _IOR('V', 10, struct v4l2_framebuffer) |
1384 | #define VIDIOC_S_FBUF _IOW ('V', 11, struct v4l2_framebuffer) | 1393 | #define VIDIOC_S_FBUF _IOW('V', 11, struct v4l2_framebuffer) |
1385 | #define VIDIOC_OVERLAY _IOW ('V', 14, int) | 1394 | #define VIDIOC_OVERLAY _IOW('V', 14, int) |
1386 | #define VIDIOC_QBUF _IOWR ('V', 15, struct v4l2_buffer) | 1395 | #define VIDIOC_QBUF _IOWR('V', 15, struct v4l2_buffer) |
1387 | #define VIDIOC_DQBUF _IOWR ('V', 17, struct v4l2_buffer) | 1396 | #define VIDIOC_DQBUF _IOWR('V', 17, struct v4l2_buffer) |
1388 | #define VIDIOC_STREAMON _IOW ('V', 18, int) | 1397 | #define VIDIOC_STREAMON _IOW('V', 18, int) |
1389 | #define VIDIOC_STREAMOFF _IOW ('V', 19, int) | 1398 | #define VIDIOC_STREAMOFF _IOW('V', 19, int) |
1390 | #define VIDIOC_G_PARM _IOWR ('V', 21, struct v4l2_streamparm) | 1399 | #define VIDIOC_G_PARM _IOWR('V', 21, struct v4l2_streamparm) |
1391 | #define VIDIOC_S_PARM _IOWR ('V', 22, struct v4l2_streamparm) | 1400 | #define VIDIOC_S_PARM _IOWR('V', 22, struct v4l2_streamparm) |
1392 | #define VIDIOC_G_STD _IOR ('V', 23, v4l2_std_id) | 1401 | #define VIDIOC_G_STD _IOR('V', 23, v4l2_std_id) |
1393 | #define VIDIOC_S_STD _IOW ('V', 24, v4l2_std_id) | 1402 | #define VIDIOC_S_STD _IOW('V', 24, v4l2_std_id) |
1394 | #define VIDIOC_ENUMSTD _IOWR ('V', 25, struct v4l2_standard) | 1403 | #define VIDIOC_ENUMSTD _IOWR('V', 25, struct v4l2_standard) |
1395 | #define VIDIOC_ENUMINPUT _IOWR ('V', 26, struct v4l2_input) | 1404 | #define VIDIOC_ENUMINPUT _IOWR('V', 26, struct v4l2_input) |
1396 | #define VIDIOC_G_CTRL _IOWR ('V', 27, struct v4l2_control) | 1405 | #define VIDIOC_G_CTRL _IOWR('V', 27, struct v4l2_control) |
1397 | #define VIDIOC_S_CTRL _IOWR ('V', 28, struct v4l2_control) | 1406 | #define VIDIOC_S_CTRL _IOWR('V', 28, struct v4l2_control) |
1398 | #define VIDIOC_G_TUNER _IOWR ('V', 29, struct v4l2_tuner) | 1407 | #define VIDIOC_G_TUNER _IOWR('V', 29, struct v4l2_tuner) |
1399 | #define VIDIOC_S_TUNER _IOW ('V', 30, struct v4l2_tuner) | 1408 | #define VIDIOC_S_TUNER _IOW('V', 30, struct v4l2_tuner) |
1400 | #define VIDIOC_G_AUDIO _IOR ('V', 33, struct v4l2_audio) | 1409 | #define VIDIOC_G_AUDIO _IOR('V', 33, struct v4l2_audio) |
1401 | #define VIDIOC_S_AUDIO _IOW ('V', 34, struct v4l2_audio) | 1410 | #define VIDIOC_S_AUDIO _IOW('V', 34, struct v4l2_audio) |
1402 | #define VIDIOC_QUERYCTRL _IOWR ('V', 36, struct v4l2_queryctrl) | 1411 | #define VIDIOC_QUERYCTRL _IOWR('V', 36, struct v4l2_queryctrl) |
1403 | #define VIDIOC_QUERYMENU _IOWR ('V', 37, struct v4l2_querymenu) | 1412 | #define VIDIOC_QUERYMENU _IOWR('V', 37, struct v4l2_querymenu) |
1404 | #define VIDIOC_G_INPUT _IOR ('V', 38, int) | 1413 | #define VIDIOC_G_INPUT _IOR('V', 38, int) |
1405 | #define VIDIOC_S_INPUT _IOWR ('V', 39, int) | 1414 | #define VIDIOC_S_INPUT _IOWR('V', 39, int) |
1406 | #define VIDIOC_G_OUTPUT _IOR ('V', 46, int) | 1415 | #define VIDIOC_G_OUTPUT _IOR('V', 46, int) |
1407 | #define VIDIOC_S_OUTPUT _IOWR ('V', 47, int) | 1416 | #define VIDIOC_S_OUTPUT _IOWR('V', 47, int) |
1408 | #define VIDIOC_ENUMOUTPUT _IOWR ('V', 48, struct v4l2_output) | 1417 | #define VIDIOC_ENUMOUTPUT _IOWR('V', 48, struct v4l2_output) |
1409 | #define VIDIOC_G_AUDOUT _IOR ('V', 49, struct v4l2_audioout) | 1418 | #define VIDIOC_G_AUDOUT _IOR('V', 49, struct v4l2_audioout) |
1410 | #define VIDIOC_S_AUDOUT _IOW ('V', 50, struct v4l2_audioout) | 1419 | #define VIDIOC_S_AUDOUT _IOW('V', 50, struct v4l2_audioout) |
1411 | #define VIDIOC_G_MODULATOR _IOWR ('V', 54, struct v4l2_modulator) | 1420 | #define VIDIOC_G_MODULATOR _IOWR('V', 54, struct v4l2_modulator) |
1412 | #define VIDIOC_S_MODULATOR _IOW ('V', 55, struct v4l2_modulator) | 1421 | #define VIDIOC_S_MODULATOR _IOW('V', 55, struct v4l2_modulator) |
1413 | #define VIDIOC_G_FREQUENCY _IOWR ('V', 56, struct v4l2_frequency) | 1422 | #define VIDIOC_G_FREQUENCY _IOWR('V', 56, struct v4l2_frequency) |
1414 | #define VIDIOC_S_FREQUENCY _IOW ('V', 57, struct v4l2_frequency) | 1423 | #define VIDIOC_S_FREQUENCY _IOW('V', 57, struct v4l2_frequency) |
1415 | #define VIDIOC_CROPCAP _IOWR ('V', 58, struct v4l2_cropcap) | 1424 | #define VIDIOC_CROPCAP _IOWR('V', 58, struct v4l2_cropcap) |
1416 | #define VIDIOC_G_CROP _IOWR ('V', 59, struct v4l2_crop) | 1425 | #define VIDIOC_G_CROP _IOWR('V', 59, struct v4l2_crop) |
1417 | #define VIDIOC_S_CROP _IOW ('V', 60, struct v4l2_crop) | 1426 | #define VIDIOC_S_CROP _IOW('V', 60, struct v4l2_crop) |
1418 | #define VIDIOC_G_JPEGCOMP _IOR ('V', 61, struct v4l2_jpegcompression) | 1427 | #define VIDIOC_G_JPEGCOMP _IOR('V', 61, struct v4l2_jpegcompression) |
1419 | #define VIDIOC_S_JPEGCOMP _IOW ('V', 62, struct v4l2_jpegcompression) | 1428 | #define VIDIOC_S_JPEGCOMP _IOW('V', 62, struct v4l2_jpegcompression) |
1420 | #define VIDIOC_QUERYSTD _IOR ('V', 63, v4l2_std_id) | 1429 | #define VIDIOC_QUERYSTD _IOR('V', 63, v4l2_std_id) |
1421 | #define VIDIOC_TRY_FMT _IOWR ('V', 64, struct v4l2_format) | 1430 | #define VIDIOC_TRY_FMT _IOWR('V', 64, struct v4l2_format) |
1422 | #define VIDIOC_ENUMAUDIO _IOWR ('V', 65, struct v4l2_audio) | 1431 | #define VIDIOC_ENUMAUDIO _IOWR('V', 65, struct v4l2_audio) |
1423 | #define VIDIOC_ENUMAUDOUT _IOWR ('V', 66, struct v4l2_audioout) | 1432 | #define VIDIOC_ENUMAUDOUT _IOWR('V', 66, struct v4l2_audioout) |
1424 | #define VIDIOC_G_PRIORITY _IOR ('V', 67, enum v4l2_priority) | 1433 | #define VIDIOC_G_PRIORITY _IOR('V', 67, enum v4l2_priority) |
1425 | #define VIDIOC_S_PRIORITY _IOW ('V', 68, enum v4l2_priority) | 1434 | #define VIDIOC_S_PRIORITY _IOW('V', 68, enum v4l2_priority) |
1426 | #define VIDIOC_G_SLICED_VBI_CAP _IOWR ('V', 69, struct v4l2_sliced_vbi_cap) | 1435 | #define VIDIOC_G_SLICED_VBI_CAP _IOWR('V', 69, struct v4l2_sliced_vbi_cap) |
1427 | #define VIDIOC_LOG_STATUS _IO ('V', 70) | 1436 | #define VIDIOC_LOG_STATUS _IO('V', 70) |
1428 | #define VIDIOC_G_EXT_CTRLS _IOWR ('V', 71, struct v4l2_ext_controls) | 1437 | #define VIDIOC_G_EXT_CTRLS _IOWR('V', 71, struct v4l2_ext_controls) |
1429 | #define VIDIOC_S_EXT_CTRLS _IOWR ('V', 72, struct v4l2_ext_controls) | 1438 | #define VIDIOC_S_EXT_CTRLS _IOWR('V', 72, struct v4l2_ext_controls) |
1430 | #define VIDIOC_TRY_EXT_CTRLS _IOWR ('V', 73, struct v4l2_ext_controls) | 1439 | #define VIDIOC_TRY_EXT_CTRLS _IOWR('V', 73, struct v4l2_ext_controls) |
1431 | #if 1 | 1440 | #if 1 |
1432 | #define VIDIOC_ENUM_FRAMESIZES _IOWR ('V', 74, struct v4l2_frmsizeenum) | 1441 | #define VIDIOC_ENUM_FRAMESIZES _IOWR('V', 74, struct v4l2_frmsizeenum) |
1433 | #define VIDIOC_ENUM_FRAMEINTERVALS _IOWR ('V', 75, struct v4l2_frmivalenum) | 1442 | #define VIDIOC_ENUM_FRAMEINTERVALS _IOWR('V', 75, struct v4l2_frmivalenum) |
1434 | #define VIDIOC_G_ENC_INDEX _IOR ('V', 76, struct v4l2_enc_idx) | 1443 | #define VIDIOC_G_ENC_INDEX _IOR('V', 76, struct v4l2_enc_idx) |
1435 | #define VIDIOC_ENCODER_CMD _IOWR ('V', 77, struct v4l2_encoder_cmd) | 1444 | #define VIDIOC_ENCODER_CMD _IOWR('V', 77, struct v4l2_encoder_cmd) |
1436 | #define VIDIOC_TRY_ENCODER_CMD _IOWR ('V', 78, struct v4l2_encoder_cmd) | 1445 | #define VIDIOC_TRY_ENCODER_CMD _IOWR('V', 78, struct v4l2_encoder_cmd) |
1437 | 1446 | ||
1438 | /* Experimental, only implemented if CONFIG_VIDEO_ADV_DEBUG is defined */ | 1447 | /* Experimental, only implemented if CONFIG_VIDEO_ADV_DEBUG is defined */ |
1439 | #define VIDIOC_DBG_S_REGISTER _IOW ('V', 79, struct v4l2_register) | 1448 | #define VIDIOC_DBG_S_REGISTER _IOW('V', 79, struct v4l2_register) |
1440 | #define VIDIOC_DBG_G_REGISTER _IOWR ('V', 80, struct v4l2_register) | 1449 | #define VIDIOC_DBG_G_REGISTER _IOWR('V', 80, struct v4l2_register) |
1441 | 1450 | ||
1442 | #define VIDIOC_G_CHIP_IDENT _IOWR ('V', 81, struct v4l2_chip_ident) | 1451 | #define VIDIOC_G_CHIP_IDENT _IOWR('V', 81, struct v4l2_chip_ident) |
1443 | #endif | 1452 | #endif |
1453 | #define VIDIOC_S_HW_FREQ_SEEK _IOW('V', 82, struct v4l2_hw_freq_seek) | ||
1444 | 1454 | ||
1445 | #ifdef __OLD_VIDIOC_ | 1455 | #ifdef __OLD_VIDIOC_ |
1446 | /* for compatibility, will go away some day */ | 1456 | /* for compatibility, will go away some day */ |
1447 | #define VIDIOC_OVERLAY_OLD _IOWR ('V', 14, int) | 1457 | #define VIDIOC_OVERLAY_OLD _IOWR('V', 14, int) |
1448 | #define VIDIOC_S_PARM_OLD _IOW ('V', 22, struct v4l2_streamparm) | 1458 | #define VIDIOC_S_PARM_OLD _IOW('V', 22, struct v4l2_streamparm) |
1449 | #define VIDIOC_S_CTRL_OLD _IOW ('V', 28, struct v4l2_control) | 1459 | #define VIDIOC_S_CTRL_OLD _IOW('V', 28, struct v4l2_control) |
1450 | #define VIDIOC_G_AUDIO_OLD _IOWR ('V', 33, struct v4l2_audio) | 1460 | #define VIDIOC_G_AUDIO_OLD _IOWR('V', 33, struct v4l2_audio) |
1451 | #define VIDIOC_G_AUDOUT_OLD _IOWR ('V', 49, struct v4l2_audioout) | 1461 | #define VIDIOC_G_AUDOUT_OLD _IOWR('V', 49, struct v4l2_audioout) |
1452 | #define VIDIOC_CROPCAP_OLD _IOR ('V', 58, struct v4l2_cropcap) | 1462 | #define VIDIOC_CROPCAP_OLD _IOR('V', 58, struct v4l2_cropcap) |
1453 | #endif | 1463 | #endif |
1454 | 1464 | ||
1455 | #define BASE_VIDIOC_PRIVATE 192 /* 192-255 are private */ | 1465 | #define BASE_VIDIOC_PRIVATE 192 /* 192-255 are private */ |
1456 | 1466 | ||
1457 | #endif /* __LINUX_VIDEODEV2_H */ | 1467 | #endif /* __LINUX_VIDEODEV2_H */ |
1458 | |||
1459 | /* | ||
1460 | * Local variables: | ||
1461 | * c-basic-offset: 8 | ||
1462 | * End: | ||
1463 | */ | ||
diff --git a/include/linux/videotext.h b/include/linux/videotext.h index 018f92047ff8..3e68c8d1c7f7 100644 --- a/include/linux/videotext.h +++ b/include/linux/videotext.h | |||
@@ -45,10 +45,10 @@ | |||
45 | #define VTXIOCCLRCACHE_OLD 0x710b /* clear cache on VTX-interface (if avail.) */ | 45 | #define VTXIOCCLRCACHE_OLD 0x710b /* clear cache on VTX-interface (if avail.) */ |
46 | #define VTXIOCSETVIRT_OLD 0x710c /* turn on virtual mode (this disables TV-display) */ | 46 | #define VTXIOCSETVIRT_OLD 0x710c /* turn on virtual mode (this disables TV-display) */ |
47 | 47 | ||
48 | /* | 48 | /* |
49 | * Definitions for VTXIOCGETINFO | 49 | * Definitions for VTXIOCGETINFO |
50 | */ | 50 | */ |
51 | 51 | ||
52 | #define SAA5243 0 | 52 | #define SAA5243 0 |
53 | #define SAA5246 1 | 53 | #define SAA5246 1 |
54 | #define SAA5249 2 | 54 | #define SAA5249 2 |
@@ -57,10 +57,10 @@ | |||
57 | 57 | ||
58 | typedef struct { | 58 | typedef struct { |
59 | int version_major, version_minor; /* version of driver; if version_major changes, driver */ | 59 | int version_major, version_minor; /* version of driver; if version_major changes, driver */ |
60 | /* is not backward compatible!!! CHECK THIS!!! */ | 60 | /* is not backward compatible!!! CHECK THIS!!! */ |
61 | int numpages; /* number of page-buffers of vtx-chipset */ | 61 | int numpages; /* number of page-buffers of vtx-chipset */ |
62 | int cct_type; /* type of vtx-chipset (SAA5243, SAA5246, SAA5248 or | 62 | int cct_type; /* type of vtx-chipset (SAA5243, SAA5246, SAA5248 or |
63 | * SAA5249) */ | 63 | * SAA5249) */ |
64 | } | 64 | } |
65 | vtx_info_t; | 65 | vtx_info_t; |
66 | 66 | ||
@@ -81,7 +81,7 @@ vtx_info_t; | |||
81 | #define PGMASK_HOUR (HR_TEN | HR_UNIT) | 81 | #define PGMASK_HOUR (HR_TEN | HR_UNIT) |
82 | #define PGMASK_MINUTE (MIN_TEN | MIN_UNIT) | 82 | #define PGMASK_MINUTE (MIN_TEN | MIN_UNIT) |
83 | 83 | ||
84 | typedef struct | 84 | typedef struct |
85 | { | 85 | { |
86 | int page; /* number of requested page (hexadecimal) */ | 86 | int page; /* number of requested page (hexadecimal) */ |
87 | int hour; /* requested hour (hexadecimal) */ | 87 | int hour; /* requested hour (hexadecimal) */ |
@@ -98,11 +98,11 @@ vtx_pagereq_t; | |||
98 | /* | 98 | /* |
99 | * Definitions for VTXIOC{GETSTAT,PUTSTAT} | 99 | * Definitions for VTXIOC{GETSTAT,PUTSTAT} |
100 | */ | 100 | */ |
101 | 101 | ||
102 | #define VTX_PAGESIZE (40 * 24) | 102 | #define VTX_PAGESIZE (40 * 24) |
103 | #define VTX_VIRTUALSIZE (40 * 49) | 103 | #define VTX_VIRTUALSIZE (40 * 49) |
104 | 104 | ||
105 | typedef struct | 105 | typedef struct |
106 | { | 106 | { |
107 | int pagenum; /* number of page (hexadecimal) */ | 107 | int pagenum; /* number of page (hexadecimal) */ |
108 | int hour; /* hour (hexadecimal) */ | 108 | int hour; /* hour (hexadecimal) */ |
@@ -121,5 +121,5 @@ typedef struct | |||
121 | unsigned hamming : 1; /* hamming-error occurred */ | 121 | unsigned hamming : 1; /* hamming-error occurred */ |
122 | } | 122 | } |
123 | vtx_pageinfo_t; | 123 | vtx_pageinfo_t; |
124 | 124 | ||
125 | #endif /* _VTX_H */ | 125 | #endif /* _VTX_H */ |
diff --git a/include/linux/virtio_9p.h b/include/linux/virtio_9p.h index 8eff0b53910b..b3c4a60ceeb3 100644 --- a/include/linux/virtio_9p.h +++ b/include/linux/virtio_9p.h | |||
@@ -1,5 +1,7 @@ | |||
1 | #ifndef _LINUX_VIRTIO_9P_H | 1 | #ifndef _LINUX_VIRTIO_9P_H |
2 | #define _LINUX_VIRTIO_9P_H | 2 | #define _LINUX_VIRTIO_9P_H |
3 | /* This header is BSD licensed so anyone can use the definitions to implement | ||
4 | * compatible drivers/servers. */ | ||
3 | #include <linux/virtio_config.h> | 5 | #include <linux/virtio_config.h> |
4 | 6 | ||
5 | /* The ID for virtio console */ | 7 | /* The ID for virtio console */ |
diff --git a/include/linux/virtio_balloon.h b/include/linux/virtio_balloon.h index 979524ee75b7..c30c7bfbf39b 100644 --- a/include/linux/virtio_balloon.h +++ b/include/linux/virtio_balloon.h | |||
@@ -1,5 +1,7 @@ | |||
1 | #ifndef _LINUX_VIRTIO_BALLOON_H | 1 | #ifndef _LINUX_VIRTIO_BALLOON_H |
2 | #define _LINUX_VIRTIO_BALLOON_H | 2 | #define _LINUX_VIRTIO_BALLOON_H |
3 | /* This header is BSD licensed so anyone can use the definitions to implement | ||
4 | * compatible drivers/servers. */ | ||
3 | #include <linux/virtio_config.h> | 5 | #include <linux/virtio_config.h> |
4 | 6 | ||
5 | /* The ID for virtio_balloon */ | 7 | /* The ID for virtio_balloon */ |
diff --git a/include/linux/virtio_blk.h b/include/linux/virtio_blk.h index 5f79a5f9de79..c1aef85243bf 100644 --- a/include/linux/virtio_blk.h +++ b/include/linux/virtio_blk.h | |||
@@ -1,5 +1,7 @@ | |||
1 | #ifndef _LINUX_VIRTIO_BLK_H | 1 | #ifndef _LINUX_VIRTIO_BLK_H |
2 | #define _LINUX_VIRTIO_BLK_H | 2 | #define _LINUX_VIRTIO_BLK_H |
3 | /* This header is BSD licensed so anyone can use the definitions to implement | ||
4 | * compatible drivers/servers. */ | ||
3 | #include <linux/virtio_config.h> | 5 | #include <linux/virtio_config.h> |
4 | 6 | ||
5 | /* The ID for virtio_block */ | 7 | /* The ID for virtio_block */ |
@@ -11,6 +13,7 @@ | |||
11 | #define VIRTIO_BLK_F_SEG_MAX 2 /* Indicates maximum # of segments */ | 13 | #define VIRTIO_BLK_F_SEG_MAX 2 /* Indicates maximum # of segments */ |
12 | #define VIRTIO_BLK_F_GEOMETRY 4 /* Legacy geometry available */ | 14 | #define VIRTIO_BLK_F_GEOMETRY 4 /* Legacy geometry available */ |
13 | #define VIRTIO_BLK_F_RO 5 /* Disk is read-only */ | 15 | #define VIRTIO_BLK_F_RO 5 /* Disk is read-only */ |
16 | #define VIRTIO_BLK_F_BLK_SIZE 6 /* Block size of disk is available*/ | ||
14 | 17 | ||
15 | struct virtio_blk_config | 18 | struct virtio_blk_config |
16 | { | 19 | { |
@@ -26,6 +29,8 @@ struct virtio_blk_config | |||
26 | __u8 heads; | 29 | __u8 heads; |
27 | __u8 sectors; | 30 | __u8 sectors; |
28 | } geometry; | 31 | } geometry; |
32 | /* block size of device (if VIRTIO_BLK_F_BLK_SIZE) */ | ||
33 | __u32 blk_size; | ||
29 | } __attribute__((packed)); | 34 | } __attribute__((packed)); |
30 | 35 | ||
31 | /* These two define direction. */ | 36 | /* These two define direction. */ |
diff --git a/include/linux/virtio_config.h b/include/linux/virtio_config.h index f364bbf63c34..bf8ec283b232 100644 --- a/include/linux/virtio_config.h +++ b/include/linux/virtio_config.h | |||
@@ -1,5 +1,8 @@ | |||
1 | #ifndef _LINUX_VIRTIO_CONFIG_H | 1 | #ifndef _LINUX_VIRTIO_CONFIG_H |
2 | #define _LINUX_VIRTIO_CONFIG_H | 2 | #define _LINUX_VIRTIO_CONFIG_H |
3 | /* This header, excluding the #ifdef __KERNEL__ part, is BSD licensed so | ||
4 | * anyone can use the definitions to implement compatible drivers/servers. */ | ||
5 | |||
3 | /* Virtio devices use a standardized configuration space to define their | 6 | /* Virtio devices use a standardized configuration space to define their |
4 | * features and pass configuration information, but each implementation can | 7 | * features and pass configuration information, but each implementation can |
5 | * store and access that space differently. */ | 8 | * store and access that space differently. */ |
@@ -15,6 +18,12 @@ | |||
15 | /* We've given up on this device. */ | 18 | /* We've given up on this device. */ |
16 | #define VIRTIO_CONFIG_S_FAILED 0x80 | 19 | #define VIRTIO_CONFIG_S_FAILED 0x80 |
17 | 20 | ||
21 | /* Some virtio feature bits (currently bits 28 through 31) are reserved for the | ||
22 | * transport being used (eg. virtio_ring), the rest are per-device feature | ||
23 | * bits. */ | ||
24 | #define VIRTIO_TRANSPORT_F_START 28 | ||
25 | #define VIRTIO_TRANSPORT_F_END 32 | ||
26 | |||
18 | /* Do we get callbacks when the ring is completely used, even if we've | 27 | /* Do we get callbacks when the ring is completely used, even if we've |
19 | * suppressed them? */ | 28 | * suppressed them? */ |
20 | #define VIRTIO_F_NOTIFY_ON_EMPTY 24 | 29 | #define VIRTIO_F_NOTIFY_ON_EMPTY 24 |
@@ -52,9 +61,10 @@ | |||
52 | * @get_features: get the array of feature bits for this device. | 61 | * @get_features: get the array of feature bits for this device. |
53 | * vdev: the virtio_device | 62 | * vdev: the virtio_device |
54 | * Returns the first 32 feature bits (all we currently need). | 63 | * Returns the first 32 feature bits (all we currently need). |
55 | * @set_features: confirm what device features we'll be using. | 64 | * @finalize_features: confirm what device features we'll be using. |
56 | * vdev: the virtio_device | 65 | * vdev: the virtio_device |
57 | * feature: the first 32 feature bits | 66 | * This gives the final feature bits for the device: it can change |
67 | * the dev->feature bits if it wants. | ||
58 | */ | 68 | */ |
59 | struct virtio_config_ops | 69 | struct virtio_config_ops |
60 | { | 70 | { |
@@ -70,7 +80,7 @@ struct virtio_config_ops | |||
70 | void (*callback)(struct virtqueue *)); | 80 | void (*callback)(struct virtqueue *)); |
71 | void (*del_vq)(struct virtqueue *vq); | 81 | void (*del_vq)(struct virtqueue *vq); |
72 | u32 (*get_features)(struct virtio_device *vdev); | 82 | u32 (*get_features)(struct virtio_device *vdev); |
73 | void (*set_features)(struct virtio_device *vdev, u32 features); | 83 | void (*finalize_features)(struct virtio_device *vdev); |
74 | }; | 84 | }; |
75 | 85 | ||
76 | /* If driver didn't advertise the feature, it will never appear. */ | 86 | /* If driver didn't advertise the feature, it will never appear. */ |
diff --git a/include/linux/virtio_console.h b/include/linux/virtio_console.h index ed2d4ead7eb7..19a0da0dba41 100644 --- a/include/linux/virtio_console.h +++ b/include/linux/virtio_console.h | |||
@@ -1,6 +1,8 @@ | |||
1 | #ifndef _LINUX_VIRTIO_CONSOLE_H | 1 | #ifndef _LINUX_VIRTIO_CONSOLE_H |
2 | #define _LINUX_VIRTIO_CONSOLE_H | 2 | #define _LINUX_VIRTIO_CONSOLE_H |
3 | #include <linux/virtio_config.h> | 3 | #include <linux/virtio_config.h> |
4 | /* This header, excluding the #ifdef __KERNEL__ part, is BSD licensed so | ||
5 | * anyone can use the definitions to implement compatible drivers/servers. */ | ||
4 | 6 | ||
5 | /* The ID for virtio console */ | 7 | /* The ID for virtio console */ |
6 | #define VIRTIO_ID_CONSOLE 3 | 8 | #define VIRTIO_ID_CONSOLE 3 |
diff --git a/include/linux/virtio_net.h b/include/linux/virtio_net.h index 38c0571820fb..5e33761b9b8a 100644 --- a/include/linux/virtio_net.h +++ b/include/linux/virtio_net.h | |||
@@ -1,5 +1,7 @@ | |||
1 | #ifndef _LINUX_VIRTIO_NET_H | 1 | #ifndef _LINUX_VIRTIO_NET_H |
2 | #define _LINUX_VIRTIO_NET_H | 2 | #define _LINUX_VIRTIO_NET_H |
3 | /* This header is BSD licensed so anyone can use the definitions to implement | ||
4 | * compatible drivers/servers. */ | ||
3 | #include <linux/virtio_config.h> | 5 | #include <linux/virtio_config.h> |
4 | 6 | ||
5 | /* The ID for virtio_net */ | 7 | /* The ID for virtio_net */ |
diff --git a/include/linux/virtio_pci.h b/include/linux/virtio_pci.h index b3151659cf49..cdef35742932 100644 --- a/include/linux/virtio_pci.h +++ b/include/linux/virtio_pci.h | |||
@@ -9,9 +9,8 @@ | |||
9 | * Authors: | 9 | * Authors: |
10 | * Anthony Liguori <aliguori@us.ibm.com> | 10 | * Anthony Liguori <aliguori@us.ibm.com> |
11 | * | 11 | * |
12 | * This work is licensed under the terms of the GNU GPL, version 2 or later. | 12 | * This header is BSD licensed so anyone can use the definitions to implement |
13 | * See the COPYING file in the top-level directory. | 13 | * compatible drivers/servers. |
14 | * | ||
15 | */ | 14 | */ |
16 | 15 | ||
17 | #ifndef _LINUX_VIRTIO_PCI_H | 16 | #ifndef _LINUX_VIRTIO_PCI_H |
diff --git a/include/linux/virtio_ring.h b/include/linux/virtio_ring.h index abe481ed990e..c4a598fb3826 100644 --- a/include/linux/virtio_ring.h +++ b/include/linux/virtio_ring.h | |||
@@ -120,6 +120,8 @@ struct virtqueue *vring_new_virtqueue(unsigned int num, | |||
120 | void (*notify)(struct virtqueue *vq), | 120 | void (*notify)(struct virtqueue *vq), |
121 | void (*callback)(struct virtqueue *vq)); | 121 | void (*callback)(struct virtqueue *vq)); |
122 | void vring_del_virtqueue(struct virtqueue *vq); | 122 | void vring_del_virtqueue(struct virtqueue *vq); |
123 | /* Filter out transport-specific feature bits. */ | ||
124 | void vring_transport_features(struct virtio_device *vdev); | ||
123 | 125 | ||
124 | irqreturn_t vring_interrupt(int irq, void *_vq); | 126 | irqreturn_t vring_interrupt(int irq, void *_vq); |
125 | #endif /* __KERNEL__ */ | 127 | #endif /* __KERNEL__ */ |
diff --git a/include/linux/virtio_rng.h b/include/linux/virtio_rng.h index 331afb6c9f62..1a85dab8a940 100644 --- a/include/linux/virtio_rng.h +++ b/include/linux/virtio_rng.h | |||
@@ -1,5 +1,7 @@ | |||
1 | #ifndef _LINUX_VIRTIO_RNG_H | 1 | #ifndef _LINUX_VIRTIO_RNG_H |
2 | #define _LINUX_VIRTIO_RNG_H | 2 | #define _LINUX_VIRTIO_RNG_H |
3 | /* This header is BSD licensed so anyone can use the definitions to implement | ||
4 | * compatible drivers/servers. */ | ||
3 | #include <linux/virtio_config.h> | 5 | #include <linux/virtio_config.h> |
4 | 6 | ||
5 | /* The ID for virtio_rng */ | 7 | /* The ID for virtio_rng */ |
diff --git a/include/linux/vmalloc.h b/include/linux/vmalloc.h index 364789aae9f3..328eb4022727 100644 --- a/include/linux/vmalloc.h +++ b/include/linux/vmalloc.h | |||
@@ -4,9 +4,9 @@ | |||
4 | #include <linux/spinlock.h> | 4 | #include <linux/spinlock.h> |
5 | #include <asm/page.h> /* pgprot_t */ | 5 | #include <asm/page.h> /* pgprot_t */ |
6 | 6 | ||
7 | struct vm_area_struct; | 7 | struct vm_area_struct; /* vma defining user mapping in mm_types.h */ |
8 | 8 | ||
9 | /* bits in vm_struct->flags */ | 9 | /* bits in flags of vmalloc's vm_struct below */ |
10 | #define VM_IOREMAP 0x00000001 /* ioremap() and friends */ | 10 | #define VM_IOREMAP 0x00000001 /* ioremap() and friends */ |
11 | #define VM_ALLOC 0x00000002 /* vmalloc() */ | 11 | #define VM_ALLOC 0x00000002 /* vmalloc() */ |
12 | #define VM_MAP 0x00000004 /* vmap()ed pages */ | 12 | #define VM_MAP 0x00000004 /* vmap()ed pages */ |
diff --git a/include/linux/vmstat.h b/include/linux/vmstat.h index e83b69346d23..58334d439516 100644 --- a/include/linux/vmstat.h +++ b/include/linux/vmstat.h | |||
@@ -44,6 +44,12 @@ enum vm_event_item { PGPGIN, PGPGOUT, PSWPIN, PSWPOUT, | |||
44 | NR_VM_EVENT_ITEMS | 44 | NR_VM_EVENT_ITEMS |
45 | }; | 45 | }; |
46 | 46 | ||
47 | extern const struct seq_operations fragmentation_op; | ||
48 | extern const struct seq_operations pagetypeinfo_op; | ||
49 | extern const struct seq_operations zoneinfo_op; | ||
50 | extern const struct seq_operations vmstat_op; | ||
51 | extern int sysctl_stat_interval; | ||
52 | |||
47 | #ifdef CONFIG_VM_EVENT_COUNTERS | 53 | #ifdef CONFIG_VM_EVENT_COUNTERS |
48 | /* | 54 | /* |
49 | * Light weight per cpu counter implementation. | 55 | * Light weight per cpu counter implementation. |
diff --git a/include/linux/vt_kern.h b/include/linux/vt_kern.h index 9448ffbdcbf6..2f1113467f70 100644 --- a/include/linux/vt_kern.h +++ b/include/linux/vt_kern.h | |||
@@ -12,6 +12,7 @@ | |||
12 | #include <linux/mutex.h> | 12 | #include <linux/mutex.h> |
13 | #include <linux/console_struct.h> | 13 | #include <linux/console_struct.h> |
14 | #include <linux/mm.h> | 14 | #include <linux/mm.h> |
15 | #include <linux/consolemap.h> | ||
15 | 16 | ||
16 | /* | 17 | /* |
17 | * Presently, a lot of graphics programs do not restore the contents of | 18 | * Presently, a lot of graphics programs do not restore the contents of |
@@ -34,7 +35,6 @@ extern int fg_console, last_console, want_console; | |||
34 | int vc_allocate(unsigned int console); | 35 | int vc_allocate(unsigned int console); |
35 | int vc_cons_allocated(unsigned int console); | 36 | int vc_cons_allocated(unsigned int console); |
36 | int vc_resize(struct vc_data *vc, unsigned int cols, unsigned int lines); | 37 | int vc_resize(struct vc_data *vc, unsigned int cols, unsigned int lines); |
37 | int vc_lock_resize(struct vc_data *vc, unsigned int cols, unsigned int lines); | ||
38 | void vc_deallocate(unsigned int console); | 38 | void vc_deallocate(unsigned int console); |
39 | void reset_palette(struct vc_data *vc); | 39 | void reset_palette(struct vc_data *vc); |
40 | void do_blank_screen(int entering_gfx); | 40 | void do_blank_screen(int entering_gfx); |
@@ -54,6 +54,7 @@ void redraw_screen(struct vc_data *vc, int is_switch); | |||
54 | struct tty_struct; | 54 | struct tty_struct; |
55 | int tioclinux(struct tty_struct *tty, unsigned long arg); | 55 | int tioclinux(struct tty_struct *tty, unsigned long arg); |
56 | 56 | ||
57 | #ifdef CONFIG_CONSOLE_TRANSLATIONS | ||
57 | /* consolemap.c */ | 58 | /* consolemap.c */ |
58 | 59 | ||
59 | struct unimapinit; | 60 | struct unimapinit; |
@@ -71,13 +72,31 @@ void con_free_unimap(struct vc_data *vc); | |||
71 | void con_protect_unimap(struct vc_data *vc, int rdonly); | 72 | void con_protect_unimap(struct vc_data *vc, int rdonly); |
72 | int con_copy_unimap(struct vc_data *dst_vc, struct vc_data *src_vc); | 73 | int con_copy_unimap(struct vc_data *dst_vc, struct vc_data *src_vc); |
73 | 74 | ||
75 | #define vc_translate(vc, c) ((vc)->vc_translate[(c) | \ | ||
76 | ((vc)->vc_toggle_meta ? 0x80 : 0)]) | ||
77 | #else | ||
78 | #define con_set_trans_old(arg) (0) | ||
79 | #define con_get_trans_old(arg) (-EINVAL) | ||
80 | #define con_set_trans_new(arg) (0) | ||
81 | #define con_get_trans_new(arg) (-EINVAL) | ||
82 | #define con_clear_unimap(vc, ui) (0) | ||
83 | #define con_set_unimap(vc, ct, list) (0) | ||
84 | #define con_set_default_unimap(vc) (0) | ||
85 | #define con_copy_unimap(d, s) (0) | ||
86 | #define con_get_unimap(vc, ct, uct, list) (-EINVAL) | ||
87 | #define con_free_unimap(vc) do { ; } while (0) | ||
88 | #define con_protect_unimap(vc, rdonly) do { ; } while (0) | ||
89 | |||
90 | #define vc_translate(vc, c) (c) | ||
91 | #endif | ||
92 | |||
74 | /* vt.c */ | 93 | /* vt.c */ |
75 | int vt_waitactive(int vt); | 94 | int vt_waitactive(int vt); |
76 | void change_console(struct vc_data *new_vc); | 95 | void change_console(struct vc_data *new_vc); |
77 | void reset_vc(struct vc_data *vc); | 96 | void reset_vc(struct vc_data *vc); |
78 | extern int unbind_con_driver(const struct consw *csw, int first, int last, | 97 | extern int unbind_con_driver(const struct consw *csw, int first, int last, |
79 | int deflt); | 98 | int deflt); |
80 | int vty_init(void); | 99 | int vty_init(const struct file_operations *console_fops); |
81 | 100 | ||
82 | /* | 101 | /* |
83 | * vc_screen.c shares this temporary buffer with the console write code so that | 102 | * vc_screen.c shares this temporary buffer with the console write code so that |
diff --git a/include/linux/wanrouter.h b/include/linux/wanrouter.h index 3add87465b1f..e0aa39612eba 100644 --- a/include/linux/wanrouter.h +++ b/include/linux/wanrouter.h | |||
@@ -522,7 +522,7 @@ extern int wanrouter_proc_init(void); | |||
522 | extern void wanrouter_proc_cleanup(void); | 522 | extern void wanrouter_proc_cleanup(void); |
523 | extern int wanrouter_proc_add(struct wan_device *wandev); | 523 | extern int wanrouter_proc_add(struct wan_device *wandev); |
524 | extern int wanrouter_proc_delete(struct wan_device *wandev); | 524 | extern int wanrouter_proc_delete(struct wan_device *wandev); |
525 | extern int wanrouter_ioctl( struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg); | 525 | extern long wanrouter_ioctl(struct file *file, unsigned int cmd, unsigned long arg); |
526 | 526 | ||
527 | /* Public Data */ | 527 | /* Public Data */ |
528 | /* list of registered devices */ | 528 | /* list of registered devices */ |
diff --git a/include/linux/wireless.h b/include/linux/wireless.h index 0a9b5b41ed67..d7958f9b52cb 100644 --- a/include/linux/wireless.h +++ b/include/linux/wireless.h | |||
@@ -611,6 +611,7 @@ | |||
611 | #define IW_ENCODE_ALG_WEP 1 | 611 | #define IW_ENCODE_ALG_WEP 1 |
612 | #define IW_ENCODE_ALG_TKIP 2 | 612 | #define IW_ENCODE_ALG_TKIP 2 |
613 | #define IW_ENCODE_ALG_CCMP 3 | 613 | #define IW_ENCODE_ALG_CCMP 3 |
614 | #define IW_ENCODE_ALG_PMK 4 | ||
614 | /* struct iw_encode_ext ->ext_flags */ | 615 | /* struct iw_encode_ext ->ext_flags */ |
615 | #define IW_ENCODE_EXT_TX_SEQ_VALID 0x00000001 | 616 | #define IW_ENCODE_EXT_TX_SEQ_VALID 0x00000001 |
616 | #define IW_ENCODE_EXT_RX_SEQ_VALID 0x00000002 | 617 | #define IW_ENCODE_EXT_RX_SEQ_VALID 0x00000002 |
@@ -630,6 +631,7 @@ | |||
630 | #define IW_ENC_CAPA_WPA2 0x00000002 | 631 | #define IW_ENC_CAPA_WPA2 0x00000002 |
631 | #define IW_ENC_CAPA_CIPHER_TKIP 0x00000004 | 632 | #define IW_ENC_CAPA_CIPHER_TKIP 0x00000004 |
632 | #define IW_ENC_CAPA_CIPHER_CCMP 0x00000008 | 633 | #define IW_ENC_CAPA_CIPHER_CCMP 0x00000008 |
634 | #define IW_ENC_CAPA_4WAY_HANDSHAKE 0x00000010 | ||
633 | 635 | ||
634 | /* Event capability macros - in (struct iw_range *)->event_capa | 636 | /* Event capability macros - in (struct iw_range *)->event_capa |
635 | * Because we have more than 32 possible events, we use an array of | 637 | * Because we have more than 32 possible events, we use an array of |
@@ -675,6 +677,19 @@ struct iw_point | |||
675 | __u16 flags; /* Optional params */ | 677 | __u16 flags; /* Optional params */ |
676 | }; | 678 | }; |
677 | 679 | ||
680 | #ifdef __KERNEL__ | ||
681 | #ifdef CONFIG_COMPAT | ||
682 | |||
683 | #include <linux/compat.h> | ||
684 | |||
685 | struct compat_iw_point { | ||
686 | compat_caddr_t pointer; | ||
687 | __u16 length; | ||
688 | __u16 flags; | ||
689 | }; | ||
690 | #endif | ||
691 | #endif | ||
692 | |||
678 | /* | 693 | /* |
679 | * A frequency | 694 | * A frequency |
680 | * For numbers lower than 10^9, we encode the number in 'm' and | 695 | * For numbers lower than 10^9, we encode the number in 'm' and |
@@ -1098,6 +1113,21 @@ struct iw_event | |||
1098 | #define IW_EV_POINT_LEN (IW_EV_LCP_LEN + sizeof(struct iw_point) - \ | 1113 | #define IW_EV_POINT_LEN (IW_EV_LCP_LEN + sizeof(struct iw_point) - \ |
1099 | IW_EV_POINT_OFF) | 1114 | IW_EV_POINT_OFF) |
1100 | 1115 | ||
1116 | #ifdef __KERNEL__ | ||
1117 | #ifdef CONFIG_COMPAT | ||
1118 | struct __compat_iw_event { | ||
1119 | __u16 len; /* Real length of this stuff */ | ||
1120 | __u16 cmd; /* Wireless IOCTL */ | ||
1121 | compat_caddr_t pointer; | ||
1122 | }; | ||
1123 | #define IW_EV_COMPAT_LCP_LEN offsetof(struct __compat_iw_event, pointer) | ||
1124 | #define IW_EV_COMPAT_POINT_OFF offsetof(struct compat_iw_point, length) | ||
1125 | #define IW_EV_COMPAT_POINT_LEN \ | ||
1126 | (IW_EV_COMPAT_LCP_LEN + sizeof(struct compat_iw_point) - \ | ||
1127 | IW_EV_COMPAT_POINT_OFF) | ||
1128 | #endif | ||
1129 | #endif | ||
1130 | |||
1101 | /* Size of the Event prefix when packed in stream */ | 1131 | /* Size of the Event prefix when packed in stream */ |
1102 | #define IW_EV_LCP_PK_LEN (4) | 1132 | #define IW_EV_LCP_PK_LEN (4) |
1103 | /* Size of the various events when packed in stream */ | 1133 | /* Size of the various events when packed in stream */ |
diff --git a/include/linux/wm97xx_batt.h b/include/linux/wm97xx_batt.h new file mode 100644 index 000000000000..9681d1ab0e4f --- /dev/null +++ b/include/linux/wm97xx_batt.h | |||
@@ -0,0 +1,26 @@ | |||
1 | #ifndef _LINUX_WM97XX_BAT_H | ||
2 | #define _LINUX_WM97XX_BAT_H | ||
3 | |||
4 | #include <linux/wm97xx.h> | ||
5 | |||
6 | struct wm97xx_batt_info { | ||
7 | int batt_aux; | ||
8 | int temp_aux; | ||
9 | int charge_gpio; | ||
10 | int min_voltage; | ||
11 | int max_voltage; | ||
12 | int batt_div; | ||
13 | int batt_mult; | ||
14 | int temp_div; | ||
15 | int temp_mult; | ||
16 | int batt_tech; | ||
17 | char *batt_name; | ||
18 | }; | ||
19 | |||
20 | #ifdef CONFIG_BATTERY_WM97XX | ||
21 | void __init wm97xx_bat_set_pdata(struct wm97xx_batt_info *data); | ||
22 | #else | ||
23 | static inline void wm97xx_bat_set_pdata(struct wm97xx_batt_info *data) {} | ||
24 | #endif | ||
25 | |||
26 | #endif | ||
diff --git a/include/linux/workqueue.h b/include/linux/workqueue.h index 542526c6e8ef..5c158c477ac7 100644 --- a/include/linux/workqueue.h +++ b/include/linux/workqueue.h | |||
@@ -179,6 +179,8 @@ __create_workqueue_key(const char *name, int singlethread, | |||
179 | extern void destroy_workqueue(struct workqueue_struct *wq); | 179 | extern void destroy_workqueue(struct workqueue_struct *wq); |
180 | 180 | ||
181 | extern int queue_work(struct workqueue_struct *wq, struct work_struct *work); | 181 | extern int queue_work(struct workqueue_struct *wq, struct work_struct *work); |
182 | extern int queue_work_on(int cpu, struct workqueue_struct *wq, | ||
183 | struct work_struct *work); | ||
182 | extern int queue_delayed_work(struct workqueue_struct *wq, | 184 | extern int queue_delayed_work(struct workqueue_struct *wq, |
183 | struct delayed_work *work, unsigned long delay); | 185 | struct delayed_work *work, unsigned long delay); |
184 | extern int queue_delayed_work_on(int cpu, struct workqueue_struct *wq, | 186 | extern int queue_delayed_work_on(int cpu, struct workqueue_struct *wq, |
@@ -188,6 +190,7 @@ extern void flush_workqueue(struct workqueue_struct *wq); | |||
188 | extern void flush_scheduled_work(void); | 190 | extern void flush_scheduled_work(void); |
189 | 191 | ||
190 | extern int schedule_work(struct work_struct *work); | 192 | extern int schedule_work(struct work_struct *work); |
193 | extern int schedule_work_on(int cpu, struct work_struct *work); | ||
191 | extern int schedule_delayed_work(struct delayed_work *work, unsigned long delay); | 194 | extern int schedule_delayed_work(struct delayed_work *work, unsigned long delay); |
192 | extern int schedule_delayed_work_on(int cpu, struct delayed_work *work, | 195 | extern int schedule_delayed_work_on(int cpu, struct delayed_work *work, |
193 | unsigned long delay); | 196 | unsigned long delay); |
@@ -198,6 +201,8 @@ extern int keventd_up(void); | |||
198 | extern void init_workqueues(void); | 201 | extern void init_workqueues(void); |
199 | int execute_in_process_context(work_func_t fn, struct execute_work *); | 202 | int execute_in_process_context(work_func_t fn, struct execute_work *); |
200 | 203 | ||
204 | extern int flush_work(struct work_struct *work); | ||
205 | |||
201 | extern int cancel_work_sync(struct work_struct *work); | 206 | extern int cancel_work_sync(struct work_struct *work); |
202 | 207 | ||
203 | /* | 208 | /* |
diff --git a/include/linux/writeback.h b/include/linux/writeback.h index f462439cc288..12b15c561a1f 100644 --- a/include/linux/writeback.h +++ b/include/linux/writeback.h | |||
@@ -63,6 +63,7 @@ struct writeback_control { | |||
63 | unsigned for_writepages:1; /* This is a writepages() call */ | 63 | unsigned for_writepages:1; /* This is a writepages() call */ |
64 | unsigned range_cyclic:1; /* range_start is cyclic */ | 64 | unsigned range_cyclic:1; /* range_start is cyclic */ |
65 | unsigned more_io:1; /* more io to be dispatched */ | 65 | unsigned more_io:1; /* more io to be dispatched */ |
66 | unsigned range_cont:1; | ||
66 | }; | 67 | }; |
67 | 68 | ||
68 | /* | 69 | /* |
@@ -105,6 +106,8 @@ extern int vm_highmem_is_dirtyable; | |||
105 | extern int block_dump; | 106 | extern int block_dump; |
106 | extern int laptop_mode; | 107 | extern int laptop_mode; |
107 | 108 | ||
109 | extern unsigned long determine_dirtyable_memory(void); | ||
110 | |||
108 | extern int dirty_ratio_handler(struct ctl_table *table, int write, | 111 | extern int dirty_ratio_handler(struct ctl_table *table, int write, |
109 | struct file *filp, void __user *buffer, size_t *lenp, | 112 | struct file *filp, void __user *buffer, size_t *lenp, |
110 | loff_t *ppos); | 113 | loff_t *ppos); |
diff --git a/include/linux/xfrm.h b/include/linux/xfrm.h index 2ca6bae88721..4bc1e6b86cb2 100644 --- a/include/linux/xfrm.h +++ b/include/linux/xfrm.h | |||
@@ -279,6 +279,7 @@ enum xfrm_attr_type_t { | |||
279 | XFRMA_POLICY_TYPE, /* struct xfrm_userpolicy_type */ | 279 | XFRMA_POLICY_TYPE, /* struct xfrm_userpolicy_type */ |
280 | XFRMA_MIGRATE, | 280 | XFRMA_MIGRATE, |
281 | XFRMA_ALG_AEAD, /* struct xfrm_algo_aead */ | 281 | XFRMA_ALG_AEAD, /* struct xfrm_algo_aead */ |
282 | XFRMA_KMADDRESS, /* struct xfrm_user_kmaddress */ | ||
282 | __XFRMA_MAX | 283 | __XFRMA_MAX |
283 | 284 | ||
284 | #define XFRMA_MAX (__XFRMA_MAX - 1) | 285 | #define XFRMA_MAX (__XFRMA_MAX - 1) |
@@ -339,6 +340,7 @@ struct xfrm_usersa_info { | |||
339 | #define XFRM_STATE_NOPMTUDISC 4 | 340 | #define XFRM_STATE_NOPMTUDISC 4 |
340 | #define XFRM_STATE_WILDRECV 8 | 341 | #define XFRM_STATE_WILDRECV 8 |
341 | #define XFRM_STATE_ICMP 16 | 342 | #define XFRM_STATE_ICMP 16 |
343 | #define XFRM_STATE_AF_UNSPEC 32 | ||
342 | }; | 344 | }; |
343 | 345 | ||
344 | struct xfrm_usersa_id { | 346 | struct xfrm_usersa_id { |
@@ -414,6 +416,15 @@ struct xfrm_user_report { | |||
414 | struct xfrm_selector sel; | 416 | struct xfrm_selector sel; |
415 | }; | 417 | }; |
416 | 418 | ||
419 | /* Used by MIGRATE to pass addresses IKE should use to perform | ||
420 | * SA negotiation with the peer */ | ||
421 | struct xfrm_user_kmaddress { | ||
422 | xfrm_address_t local; | ||
423 | xfrm_address_t remote; | ||
424 | __u32 reserved; | ||
425 | __u16 family; | ||
426 | }; | ||
427 | |||
417 | struct xfrm_user_migrate { | 428 | struct xfrm_user_migrate { |
418 | xfrm_address_t old_daddr; | 429 | xfrm_address_t old_daddr; |
419 | xfrm_address_t old_saddr; | 430 | xfrm_address_t old_saddr; |