aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorDavid Woodhouse <dwmw2@shinybook.infradead.org>2005-07-13 10:25:59 -0400
committerDavid Woodhouse <dwmw2@shinybook.infradead.org>2005-07-13 10:25:59 -0400
commit30beab1491f0b96b2f23d3fb68af01fd921a16d8 (patch)
treec580bdc0846269fbb10feeda901ecec1a48ee2ef /include
parent21af6c4f2aa5f63138871b4ddd77d7ebf2588c9d (diff)
parentc32511e2718618f0b53479eb36e07439aa363a74 (diff)
Merge with /shiny/git/linux-2.6/.git
Diffstat (limited to 'include')
-rw-r--r--include/acpi/acconfig.h7
-rw-r--r--include/acpi/acdebug.h146
-rw-r--r--include/acpi/acdisasm.h114
-rw-r--r--include/acpi/acdispat.h171
-rw-r--r--include/acpi/acevents.h85
-rw-r--r--include/acpi/acexcep.h5
-rw-r--r--include/acpi/acglobal.h12
-rw-r--r--include/acpi/achware.h52
-rw-r--r--include/acpi/acinterp.h243
-rw-r--r--include/acpi/aclocal.h10
-rw-r--r--include/acpi/acmacros.h10
-rw-r--r--include/acpi/acnames.h84
-rw-r--r--include/acpi/acnamesp.h163
-rw-r--r--include/acpi/acobject.h2
-rw-r--r--include/acpi/acopcode.h325
-rw-r--r--include/acpi/acparser.h134
-rw-r--r--include/acpi/acpi.h1
-rw-r--r--include/acpi/acpi_bus.h21
-rw-r--r--include/acpi/acpi_drivers.h5
-rw-r--r--include/acpi/acpiosxf.h18
-rw-r--r--include/acpi/acpixf.h13
-rw-r--r--include/acpi/acresrc.h67
-rw-r--r--include/acpi/acstruct.h1
-rw-r--r--include/acpi/actables.h70
-rw-r--r--include/acpi/actbl.h2
-rw-r--r--include/acpi/actypes.h2
-rw-r--r--include/acpi/acutils.h274
-rw-r--r--include/acpi/amlcode.h12
-rw-r--r--include/acpi/pdc_intel.h29
-rw-r--r--include/acpi/platform/acenv.h20
-rw-r--r--include/acpi/processor.h34
-rw-r--r--include/asm-alpha/pci.h2
-rw-r--r--include/asm-alpha/pgtable.h6
-rw-r--r--include/asm-arm/arch-ixp2000/platform.h1
-rw-r--r--include/asm-arm/arch-ixp4xx/io.h176
-rw-r--r--include/asm-arm/arch-omap/board-h2.h5
-rw-r--r--include/asm-arm/arch-omap/board-h3.h5
-rw-r--r--include/asm-arm/arch-omap/board-osk.h5
-rw-r--r--include/asm-arm/arch-omap/board.h12
-rw-r--r--include/asm-arm/arch-omap/common.h36
-rw-r--r--include/asm-arm/arch-omap/dma.h1
-rw-r--r--include/asm-arm/arch-omap/hardware.h24
-rw-r--r--include/asm-arm/arch-omap/irqs.h3
-rw-r--r--include/asm-arm/arch-omap/mux.h28
-rw-r--r--include/asm-arm/arch-omap/omap16xx.h32
-rw-r--r--include/asm-arm/arch-omap/system.h21
-rw-r--r--include/asm-arm/arch-pxa/mtd-xip.h37
-rw-r--r--include/asm-arm/arch-pxa/pxa-regs.h2
-rw-r--r--include/asm-arm/arch-sa1100/mtd-xip.h26
-rw-r--r--include/asm-arm/mach/arch.h34
-rw-r--r--include/asm-arm/mtd-xip.h26
-rw-r--r--include/asm-arm/pci.h2
-rw-r--r--include/asm-arm/stat.h2
-rw-r--r--include/asm-h8300/pci.h2
-rw-r--r--include/asm-i386/acpi.h10
-rw-r--r--include/asm-i386/apicdef.h6
-rw-r--r--include/asm-i386/mmzone.h24
-rw-r--r--include/asm-i386/pci.h2
-rw-r--r--include/asm-i386/processor.h8
-rw-r--r--include/asm-i386/unistd.h5
-rw-r--r--include/asm-ia64/acpi.h9
-rw-r--r--include/asm-ia64/hw_irq.h1
-rw-r--r--include/asm-ia64/pci.h2
-rw-r--r--include/asm-ia64/sn/arch.h1
-rw-r--r--include/asm-ia64/sn/intr.h6
-rw-r--r--include/asm-ia64/sn/pcibr_provider.h159
-rw-r--r--include/asm-ia64/sn/pcidev.h16
-rw-r--r--include/asm-ia64/sn/pic.h261
-rw-r--r--include/asm-ia64/sn/sn_cpuid.h5
-rw-r--r--include/asm-ia64/sn/sn_sal.h39
-rw-r--r--include/asm-ia64/sn/tiocp.h256
-rw-r--r--include/asm-ia64/sn/xp.h1
-rw-r--r--include/asm-m32r/s1d13806.h199
-rw-r--r--include/asm-m68k/pci.h2
-rw-r--r--include/asm-mips/pci.h2
-rw-r--r--include/asm-ppc/kexec.h2
-rw-r--r--include/asm-ppc/macio.h5
-rw-r--r--include/asm-ppc/mpc8xx.h4
-rw-r--r--include/asm-ppc/of_device.h20
-rw-r--r--include/asm-ppc/pci.h2
-rw-r--r--include/asm-ppc/unistd.h2
-rw-r--r--include/asm-ppc64/cputable.h3
-rw-r--r--include/asm-ppc64/hvconsole.h17
-rw-r--r--include/asm-ppc64/machdep.h5
-rw-r--r--include/asm-ppc64/pci.h2
-rw-r--r--include/asm-ppc64/processor.h26
-rw-r--r--include/asm-ppc64/unistd.h6
-rw-r--r--include/asm-sh/pci.h2
-rw-r--r--include/asm-sh64/pci.h2
-rw-r--r--include/asm-sparc/pci.h2
-rw-r--r--include/asm-sparc/unistd.h4
-rw-r--r--include/asm-sparc64/irq.h49
-rw-r--r--include/asm-sparc64/param.h5
-rw-r--r--include/asm-sparc64/parport.h4
-rw-r--r--include/asm-sparc64/pbm.h3
-rw-r--r--include/asm-sparc64/pci.h2
-rw-r--r--include/asm-sparc64/seccomp.h21
-rw-r--r--include/asm-sparc64/signal.h15
-rw-r--r--include/asm-sparc64/thread_info.h11
-rw-r--r--include/asm-sparc64/unistd.h4
-rw-r--r--include/asm-um/mmu_context.h10
-rw-r--r--include/asm-v850/checksum.h11
-rw-r--r--include/asm-v850/mmu.h17
-rw-r--r--include/asm-x86_64/acpi.h8
-rw-r--r--include/asm-x86_64/pci.h2
-rw-r--r--include/asm-x86_64/proto.h7
-rw-r--r--include/asm-xtensa/ipc.h16
-rw-r--r--include/asm-xtensa/unistd.h98
-rw-r--r--include/linux/acpi.h7
-rw-r--r--include/linux/audit.h2
-rw-r--r--include/linux/buffer_head.h3
-rw-r--r--include/linux/cache.h6
-rw-r--r--include/linux/compat_ioctl.h19
-rw-r--r--include/linux/cpufreq.h2
-rw-r--r--include/linux/crypto.h34
-rw-r--r--include/linux/device.h6
-rw-r--r--include/linux/etherdevice.h2
-rw-r--r--include/linux/ext3_fs.h14
-rw-r--r--include/linux/fddidevice.h2
-rw-r--r--include/linux/fs.h7
-rw-r--r--include/linux/fsnotify.h248
-rw-r--r--include/linux/gfp.h4
-rw-r--r--include/linux/hardirq.h1
-rw-r--r--include/linux/hdlc.h4
-rw-r--r--include/linux/if_shaper.h2
-rw-r--r--include/linux/igmp.h1
-rw-r--r--include/linux/inotify.h108
-rw-r--r--include/linux/ioprio.h3
-rw-r--r--include/linux/jffs2_fs_sb.h9
-rw-r--r--include/linux/kprobes.h2
-rw-r--r--include/linux/mod_devicetable.h11
-rw-r--r--include/linux/mount.h8
-rw-r--r--include/linux/mtd/cfi.h85
-rw-r--r--include/linux/mtd/flashchip.h7
-rw-r--r--include/linux/mtd/inftl.h4
-rw-r--r--include/linux/mtd/map.h33
-rw-r--r--include/linux/mtd/mtd.h15
-rw-r--r--include/linux/mtd/nand.h48
-rw-r--r--include/linux/mtd/plat-ram.h35
-rw-r--r--include/linux/mtd/xip.h31
-rw-r--r--include/linux/namespace.h3
-rw-r--r--include/linux/netlink.h1
-rw-r--r--include/linux/nfsd/nfsd.h2
-rw-r--r--include/linux/nfsd/state.h9
-rw-r--r--include/linux/pci-dynids.h18
-rw-r--r--include/linux/pci.h5
-rw-r--r--include/linux/pci_ids.h1
-rw-r--r--include/linux/pm.h2
-rw-r--r--include/linux/reiserfs_acl.h52
-rw-r--r--include/linux/reiserfs_fs.h1595
-rw-r--r--include/linux/reiserfs_fs_i.h59
-rw-r--r--include/linux/reiserfs_fs_sb.h616
-rw-r--r--include/linux/reiserfs_xattr.h126
-rw-r--r--include/linux/sched.h4
-rw-r--r--include/linux/skbuff.h48
-rw-r--r--include/linux/slab.h4
-rw-r--r--include/linux/string.h2
-rw-r--r--include/linux/swap.h4
-rw-r--r--include/linux/syscalls.h3
-rw-r--r--include/linux/sysctl.h11
-rw-r--r--include/linux/tc_ematch/tc_em_meta.h2
-rw-r--r--include/linux/tcp.h2
-rw-r--r--include/linux/usb.h8
-rw-r--r--include/linux/usb_cdc.h13
-rw-r--r--include/linux/usb_gadget.h12
-rw-r--r--include/linux/wanrouter.h3
-rw-r--r--include/media/audiochip.h3
-rw-r--r--include/media/saa6752hs.h49
-rw-r--r--include/media/tuner.h51
-rw-r--r--include/mtd/mtd-abi.h19
-rw-r--r--include/net/irda/irda_device.h2
-rw-r--r--include/net/pkt_sched.h17
-rw-r--r--include/net/sch_generic.h13
-rw-r--r--include/net/sctp/sctp.h3
-rw-r--r--include/net/sctp/sm.h11
-rw-r--r--include/net/sctp/structs.h50
-rw-r--r--include/net/sctp/ulpevent.h16
-rw-r--r--include/net/sctp/ulpqueue.h11
-rw-r--r--include/net/slhc_vj.h21
-rw-r--r--include/net/sock.h25
-rw-r--r--include/net/tcp.h161
-rw-r--r--include/net/x25device.h3
-rw-r--r--include/pcmcia/cs.h42
-rw-r--r--include/pcmcia/cs_types.h4
-rw-r--r--include/pcmcia/ds.h25
-rw-r--r--include/pcmcia/version.h3
186 files changed, 4592 insertions, 3326 deletions
diff --git a/include/acpi/acconfig.h b/include/acpi/acconfig.h
index 2b41e47b7d8..2f6ab189fc6 100644
--- a/include/acpi/acconfig.h
+++ b/include/acpi/acconfig.h
@@ -64,7 +64,7 @@
64 64
65/* Version string */ 65/* Version string */
66 66
67#define ACPI_CA_VERSION 0x20050309 67#define ACPI_CA_VERSION 0x20050408
68 68
69/* 69/*
70 * OS name, used for the _OS object. The _OS object is essentially obsolete, 70 * OS name, used for the _OS object. The _OS object is essentially obsolete,
@@ -130,9 +130,8 @@
130#define ACPI_MAX_GPE_BLOCKS 2 130#define ACPI_MAX_GPE_BLOCKS 2
131#define ACPI_GPE_REGISTER_WIDTH 8 131#define ACPI_GPE_REGISTER_WIDTH 8
132 132
133/* 133/* Method info (in WALK_STATE), containing local variables and argumetns */
134 * Method info (in WALK_STATE), containing local variables and argumetns 134
135 */
136#define ACPI_METHOD_NUM_LOCALS 8 135#define ACPI_METHOD_NUM_LOCALS 8
137#define ACPI_METHOD_MAX_LOCAL 7 136#define ACPI_METHOD_MAX_LOCAL 7
138 137
diff --git a/include/acpi/acdebug.h b/include/acpi/acdebug.h
index 223b2a506e4..8ba372b0f24 100644
--- a/include/acpi/acdebug.h
+++ b/include/acpi/acdebug.h
@@ -61,9 +61,7 @@ struct argument_info
61 61
62 62
63#define PARAM_LIST(pl) pl 63#define PARAM_LIST(pl) pl
64
65#define DBTEST_OUTPUT_LEVEL(lvl) if (acpi_gbl_db_opt_verbose) 64#define DBTEST_OUTPUT_LEVEL(lvl) if (acpi_gbl_db_opt_verbose)
66
67#define VERBOSE_PRINT(fp) DBTEST_OUTPUT_LEVEL(lvl) {\ 65#define VERBOSE_PRINT(fp) DBTEST_OUTPUT_LEVEL(lvl) {\
68 acpi_os_printf PARAM_LIST(fp);} 66 acpi_os_printf PARAM_LIST(fp);}
69 67
@@ -71,13 +69,9 @@ struct argument_info
71#define EX_SINGLE_STEP 2 69#define EX_SINGLE_STEP 2
72 70
73 71
74/* Prototypes */
75
76
77/* 72/*
78 * dbxface - external debugger interfaces 73 * dbxface - external debugger interfaces
79 */ 74 */
80
81acpi_status 75acpi_status
82acpi_db_initialize ( 76acpi_db_initialize (
83 void); 77 void);
@@ -92,20 +86,10 @@ acpi_db_single_step (
92 union acpi_parse_object *op, 86 union acpi_parse_object *op,
93 u32 op_type); 87 u32 op_type);
94 88
95acpi_status
96acpi_db_start_command (
97 struct acpi_walk_state *walk_state,
98 union acpi_parse_object *op);
99
100void
101acpi_db_method_end (
102 struct acpi_walk_state *walk_state);
103
104 89
105/* 90/*
106 * dbcmds - debug commands and output routines 91 * dbcmds - debug commands and output routines
107 */ 92 */
108
109acpi_status 93acpi_status
110acpi_db_disassemble_method ( 94acpi_db_disassemble_method (
111 char *name); 95 char *name);
@@ -177,57 +161,30 @@ acpi_db_find_references (
177 char *object_arg); 161 char *object_arg);
178 162
179void 163void
180acpi_db_display_locks (void); 164acpi_db_display_locks (
181 165 void);
182 166
183void 167void
184acpi_db_display_resources ( 168acpi_db_display_resources (
185 char *object_arg); 169 char *object_arg);
186 170
187void 171void
188acpi_db_display_gpes (void); 172acpi_db_display_gpes (
173 void);
189 174
190void 175void
191acpi_db_check_integrity ( 176acpi_db_check_integrity (
192 void); 177 void);
193 178
194acpi_status
195acpi_db_integrity_walk (
196 acpi_handle obj_handle,
197 u32 nesting_level,
198 void *context,
199 void **return_value);
200
201acpi_status
202acpi_db_walk_and_match_name (
203 acpi_handle obj_handle,
204 u32 nesting_level,
205 void *context,
206 void **return_value);
207
208acpi_status
209acpi_db_walk_for_references (
210 acpi_handle obj_handle,
211 u32 nesting_level,
212 void *context,
213 void **return_value);
214
215acpi_status
216acpi_db_walk_for_specific_objects (
217 acpi_handle obj_handle,
218 u32 nesting_level,
219 void *context,
220 void **return_value);
221
222void 179void
223acpi_db_generate_gpe ( 180acpi_db_generate_gpe (
224 char *gpe_arg, 181 char *gpe_arg,
225 char *block_arg); 182 char *block_arg);
226 183
184
227/* 185/*
228 * dbdisply - debug display commands 186 * dbdisply - debug display commands
229 */ 187 */
230
231void 188void
232acpi_db_display_method_info ( 189acpi_db_display_method_info (
233 union acpi_parse_object *op); 190 union acpi_parse_object *op);
@@ -271,19 +228,10 @@ acpi_db_display_argument_object (
271 union acpi_operand_object *obj_desc, 228 union acpi_operand_object *obj_desc,
272 struct acpi_walk_state *walk_state); 229 struct acpi_walk_state *walk_state);
273 230
274void
275acpi_db_dump_parser_descriptor (
276 union acpi_parse_object *op);
277
278void *
279acpi_db_get_pointer (
280 void *target);
281
282 231
283/* 232/*
284 * dbexec - debugger control method execution 233 * dbexec - debugger control method execution
285 */ 234 */
286
287void 235void
288acpi_db_execute ( 236acpi_db_execute (
289 char *name, 237 char *name,
@@ -296,44 +244,15 @@ acpi_db_create_execution_threads (
296 char *num_loops_arg, 244 char *num_loops_arg,
297 char *method_name_arg); 245 char *method_name_arg);
298 246
299acpi_status
300acpi_db_execute_method (
301 struct acpi_db_method_info *info,
302 struct acpi_buffer *return_obj);
303
304void
305acpi_db_execute_setup (
306 struct acpi_db_method_info *info);
307
308u32
309acpi_db_get_outstanding_allocations (
310 void);
311
312void ACPI_SYSTEM_XFACE
313acpi_db_method_thread (
314 void *context);
315
316acpi_status
317acpi_db_execution_walk (
318 acpi_handle obj_handle,
319 u32 nesting_level,
320 void *context,
321 void **return_value);
322
323 247
324/* 248/*
325 * dbfileio - Debugger file I/O commands 249 * dbfileio - Debugger file I/O commands
326 */ 250 */
327
328acpi_object_type 251acpi_object_type
329acpi_db_match_argument ( 252acpi_db_match_argument (
330 char *user_argument, 253 char *user_argument,
331 struct argument_info *arguments); 254 struct argument_info *arguments);
332 255
333acpi_status
334ae_local_load_table (
335 struct acpi_table_header *table_ptr);
336
337void 256void
338acpi_db_close_debug_file ( 257acpi_db_close_debug_file (
339 void); 258 void);
@@ -356,16 +275,17 @@ acpi_db_read_table_from_file (
356 char *filename, 275 char *filename,
357 struct acpi_table_header **table); 276 struct acpi_table_header **table);
358 277
278
359/* 279/*
360 * dbhistry - debugger HISTORY command 280 * dbhistry - debugger HISTORY command
361 */ 281 */
362
363void 282void
364acpi_db_add_to_history ( 283acpi_db_add_to_history (
365 char *command_line); 284 char *command_line);
366 285
367void 286void
368acpi_db_display_history (void); 287acpi_db_display_history (
288 void);
369 289
370char * 290char *
371acpi_db_get_from_history ( 291acpi_db_get_from_history (
@@ -375,7 +295,6 @@ acpi_db_get_from_history (
375/* 295/*
376 * dbinput - user front-end to the AML debugger 296 * dbinput - user front-end to the AML debugger
377 */ 297 */
378
379acpi_status 298acpi_status
380acpi_db_command_dispatch ( 299acpi_db_command_dispatch (
381 char *input_buffer, 300 char *input_buffer,
@@ -386,71 +305,28 @@ void ACPI_SYSTEM_XFACE
386acpi_db_execute_thread ( 305acpi_db_execute_thread (
387 void *context); 306 void *context);
388 307
389void
390acpi_db_display_help (
391 char *help_type);
392
393char *
394acpi_db_get_next_token (
395 char *string,
396 char **next);
397
398u32
399acpi_db_get_line (
400 char *input_buffer);
401
402u32
403acpi_db_match_command (
404 char *user_command);
405
406void
407acpi_db_single_thread (
408 void);
409
410 308
411/* 309/*
412 * dbstats - Generation and display of ACPI table statistics 310 * dbstats - Generation and display of ACPI table statistics
413 */ 311 */
414
415void 312void
416acpi_db_generate_statistics ( 313acpi_db_generate_statistics (
417 union acpi_parse_object *root, 314 union acpi_parse_object *root,
418 u8 is_method); 315 u8 is_method);
419 316
420
421acpi_status 317acpi_status
422acpi_db_display_statistics ( 318acpi_db_display_statistics (
423 char *type_arg); 319 char *type_arg);
424 320
425acpi_status
426acpi_db_classify_one_object (
427 acpi_handle obj_handle,
428 u32 nesting_level,
429 void *context,
430 void **return_value);
431
432void
433acpi_db_count_namespace_objects (
434 void);
435
436void
437acpi_db_enumerate_object (
438 union acpi_operand_object *obj_desc);
439
440 321
441/* 322/*
442 * dbutils - AML debugger utilities 323 * dbutils - AML debugger utilities
443 */ 324 */
444
445void 325void
446acpi_db_set_output_destination ( 326acpi_db_set_output_destination (
447 u32 where); 327 u32 where);
448 328
449void 329void
450acpi_db_dump_buffer (
451 u32 address);
452
453void
454acpi_db_dump_object ( 330acpi_db_dump_object (
455 union acpi_object *obj_desc, 331 union acpi_object *obj_desc,
456 u32 level); 332 u32 level);
@@ -459,14 +335,8 @@ void
459acpi_db_prep_namestring ( 335acpi_db_prep_namestring (
460 char *name); 336 char *name);
461 337
462
463acpi_status
464acpi_db_second_pass_parse (
465 union acpi_parse_object *root);
466
467struct acpi_namespace_node * 338struct acpi_namespace_node *
468acpi_db_local_ns_lookup ( 339acpi_db_local_ns_lookup (
469 char *name); 340 char *name);
470 341
471
472#endif /* __ACDEBUG_H__ */ 342#endif /* __ACDEBUG_H__ */
diff --git a/include/acpi/acdisasm.h b/include/acpi/acdisasm.h
index 26d907eae6f..dbfa877121b 100644
--- a/include/acpi/acdisasm.h
+++ b/include/acpi/acdisasm.h
@@ -102,58 +102,16 @@ acpi_status (*asl_walk_callback) (
102/* 102/*
103 * dmwalk 103 * dmwalk
104 */ 104 */
105
106void
107acpi_dm_walk_parse_tree (
108 union acpi_parse_object *op,
109 asl_walk_callback descending_callback,
110 asl_walk_callback ascending_callback,
111 void *context);
112
113acpi_status
114acpi_dm_descending_op (
115 union acpi_parse_object *op,
116 u32 level,
117 void *context);
118
119acpi_status
120acpi_dm_ascending_op (
121 union acpi_parse_object *op,
122 u32 level,
123 void *context);
124
125
126/*
127 * dmopcode
128 */
129
130void
131acpi_dm_validate_name (
132 char *name,
133 union acpi_parse_object *op);
134
135u32
136acpi_dm_dump_name (
137 char *name);
138
139void
140acpi_dm_unicode (
141 union acpi_parse_object *op);
142
143void 105void
144acpi_dm_disassemble ( 106acpi_dm_disassemble (
145 struct acpi_walk_state *walk_state, 107 struct acpi_walk_state *walk_state,
146 union acpi_parse_object *origin, 108 union acpi_parse_object *origin,
147 u32 num_opcodes); 109 u32 num_opcodes);
148 110
149void
150acpi_dm_namestring (
151 char *name);
152
153void
154acpi_dm_display_path (
155 union acpi_parse_object *op);
156 111
112/*
113 * dmopcode
114 */
157void 115void
158acpi_dm_disassemble_one_op ( 116acpi_dm_disassemble_one_op (
159 struct acpi_walk_state *walk_state, 117 struct acpi_walk_state *walk_state,
@@ -165,18 +123,9 @@ acpi_dm_decode_internal_object (
165 union acpi_operand_object *obj_desc); 123 union acpi_operand_object *obj_desc);
166 124
167u32 125u32
168acpi_dm_block_type (
169 union acpi_parse_object *op);
170
171u32
172acpi_dm_list_type ( 126acpi_dm_list_type (
173 union acpi_parse_object *op); 127 union acpi_parse_object *op);
174 128
175acpi_status
176acpi_ps_display_object_pathname (
177 struct acpi_walk_state *walk_state,
178 union acpi_parse_object *op);
179
180void 129void
181acpi_dm_method_flags ( 130acpi_dm_method_flags (
182 union acpi_parse_object *op); 131 union acpi_parse_object *op);
@@ -197,10 +146,6 @@ void
197acpi_dm_match_op ( 146acpi_dm_match_op (
198 union acpi_parse_object *op); 147 union acpi_parse_object *op);
199 148
200void
201acpi_dm_match_keyword (
202 union acpi_parse_object *op);
203
204u8 149u8
205acpi_dm_comma_if_list_member ( 150acpi_dm_comma_if_list_member (
206 union acpi_parse_object *op); 151 union acpi_parse_object *op);
@@ -211,13 +156,25 @@ acpi_dm_comma_if_field_member (
211 156
212 157
213/* 158/*
214 * dmobject 159 * dmnames
215 */ 160 */
161u32
162acpi_dm_dump_name (
163 char *name);
164
165acpi_status
166acpi_ps_display_object_pathname (
167 struct acpi_walk_state *walk_state,
168 union acpi_parse_object *op);
216 169
217void 170void
218acpi_dm_decode_node ( 171acpi_dm_namestring (
219 struct acpi_namespace_node *node); 172 char *name);
173
220 174
175/*
176 * dmobject
177 */
221void 178void
222acpi_dm_display_internal_object ( 179acpi_dm_display_internal_object (
223 union acpi_operand_object *obj_desc, 180 union acpi_operand_object *obj_desc,
@@ -241,6 +198,16 @@ acpi_dm_dump_method_info (
241/* 198/*
242 * dmbuffer 199 * dmbuffer
243 */ 200 */
201void
202acpi_dm_disasm_byte_list (
203 u32 level,
204 u8 *byte_data,
205 u32 byte_count);
206
207void
208acpi_dm_byte_list (
209 struct acpi_op_walk_info *info,
210 union acpi_parse_object *op);
244 211
245void 212void
246acpi_is_eisa_id ( 213acpi_is_eisa_id (
@@ -262,18 +229,6 @@ acpi_dm_is_string_buffer (
262/* 229/*
263 * dmresrc 230 * dmresrc
264 */ 231 */
265
266void
267acpi_dm_disasm_byte_list (
268 u32 level,
269 u8 *byte_data,
270 u32 byte_count);
271
272void
273acpi_dm_byte_list (
274 struct acpi_op_walk_info *info,
275 union acpi_parse_object *op);
276
277void 232void
278acpi_dm_resource_descriptor ( 233acpi_dm_resource_descriptor (
279 struct acpi_op_walk_info *info, 234 struct acpi_op_walk_info *info,
@@ -296,19 +251,10 @@ void
296acpi_dm_decode_attribute ( 251acpi_dm_decode_attribute (
297 u8 attribute); 252 u8 attribute);
298 253
254
299/* 255/*
300 * dmresrcl 256 * dmresrcl
301 */ 257 */
302
303void
304acpi_dm_io_flags (
305 u8 flags);
306
307void
308acpi_dm_memory_flags (
309 u8 flags,
310 u8 specific_flags);
311
312void 258void
313acpi_dm_word_descriptor ( 259acpi_dm_word_descriptor (
314 struct asl_word_address_desc *resource, 260 struct asl_word_address_desc *resource,
@@ -373,7 +319,6 @@ acpi_dm_vendor_large_descriptor (
373/* 319/*
374 * dmresrcs 320 * dmresrcs
375 */ 321 */
376
377void 322void
378acpi_dm_irq_descriptor ( 323acpi_dm_irq_descriptor (
379 struct asl_irq_format_desc *resource, 324 struct asl_irq_format_desc *resource,
@@ -420,7 +365,6 @@ acpi_dm_vendor_small_descriptor (
420/* 365/*
421 * dmutils 366 * dmutils
422 */ 367 */
423
424void 368void
425acpi_dm_add_to_external_list ( 369acpi_dm_add_to_external_list (
426 char *path); 370 char *path);
diff --git a/include/acpi/acdispat.h b/include/acpi/acdispat.h
index 237d6343358..8f5f2f71b1d 100644
--- a/include/acpi/acdispat.h
+++ b/include/acpi/acdispat.h
@@ -50,40 +50,9 @@
50#define NAMEOF_ARG_NTE "__A0" 50#define NAMEOF_ARG_NTE "__A0"
51 51
52 52
53/* Common interfaces */ 53/*
54 54 * dsopcode - support for late evaluation
55acpi_status 55 */
56acpi_ds_obj_stack_push (
57 void *object,
58 struct acpi_walk_state *walk_state);
59
60acpi_status
61acpi_ds_obj_stack_pop (
62 u32 pop_count,
63 struct acpi_walk_state *walk_state);
64
65#ifdef ACPI_FUTURE_USAGE
66void *
67acpi_ds_obj_stack_get_value (
68 u32 index,
69 struct acpi_walk_state *walk_state);
70#endif
71
72acpi_status
73acpi_ds_obj_stack_pop_object (
74 union acpi_operand_object **object,
75 struct acpi_walk_state *walk_state);
76
77
78/* dsopcode - support for late evaluation */
79
80acpi_status
81acpi_ds_execute_arguments (
82 struct acpi_namespace_node *node,
83 struct acpi_namespace_node *scope_node,
84 u32 aml_length,
85 u8 *aml_start);
86
87acpi_status 56acpi_status
88acpi_ds_get_buffer_field_arguments ( 57acpi_ds_get_buffer_field_arguments (
89 union acpi_operand_object *obj_desc); 58 union acpi_operand_object *obj_desc);
@@ -101,15 +70,6 @@ acpi_ds_get_package_arguments (
101 union acpi_operand_object *obj_desc); 70 union acpi_operand_object *obj_desc);
102 71
103acpi_status 72acpi_status
104acpi_ds_init_buffer_field (
105 u16 aml_opcode,
106 union acpi_operand_object *obj_desc,
107 union acpi_operand_object *buffer_desc,
108 union acpi_operand_object *offset_desc,
109 union acpi_operand_object *length_desc,
110 union acpi_operand_object *result_desc);
111
112acpi_status
113acpi_ds_eval_buffer_field_operands ( 73acpi_ds_eval_buffer_field_operands (
114 struct acpi_walk_state *walk_state, 74 struct acpi_walk_state *walk_state,
115 union acpi_parse_object *op); 75 union acpi_parse_object *op);
@@ -130,9 +90,9 @@ acpi_ds_initialize_region (
130 acpi_handle obj_handle); 90 acpi_handle obj_handle);
131 91
132 92
133/* dsctrl - Parser/Interpreter interface, control stack routines */ 93/*
134 94 * dsctrl - Parser/Interpreter interface, control stack routines
135 95 */
136acpi_status 96acpi_status
137acpi_ds_exec_begin_control_op ( 97acpi_ds_exec_begin_control_op (
138 struct acpi_walk_state *walk_state, 98 struct acpi_walk_state *walk_state,
@@ -144,9 +104,9 @@ acpi_ds_exec_end_control_op (
144 union acpi_parse_object *op); 104 union acpi_parse_object *op);
145 105
146 106
147/* dsexec - Parser/Interpreter interface, method execution callbacks */ 107/*
148 108 * dsexec - Parser/Interpreter interface, method execution callbacks
149 109 */
150acpi_status 110acpi_status
151acpi_ds_get_predicate_value ( 111acpi_ds_get_predicate_value (
152 struct acpi_walk_state *walk_state, 112 struct acpi_walk_state *walk_state,
@@ -162,14 +122,9 @@ acpi_ds_exec_end_op (
162 struct acpi_walk_state *state); 122 struct acpi_walk_state *state);
163 123
164 124
165/* dsfield - Parser/Interpreter interface for AML fields */ 125/*
166 126 * dsfield - Parser/Interpreter interface for AML fields
167acpi_status 127 */
168acpi_ds_get_field_names (
169 struct acpi_create_field_info *info,
170 struct acpi_walk_state *walk_state,
171 union acpi_parse_object *arg);
172
173acpi_status 128acpi_status
174acpi_ds_create_field ( 129acpi_ds_create_field (
175 union acpi_parse_object *op, 130 union acpi_parse_object *op,
@@ -199,8 +154,9 @@ acpi_ds_init_field_objects (
199 struct acpi_walk_state *walk_state); 154 struct acpi_walk_state *walk_state);
200 155
201 156
202/* dsload - Parser/Interpreter interface, namespace load callbacks */ 157/*
203 158 * dsload - Parser/Interpreter interface, namespace load callbacks
159 */
204acpi_status 160acpi_status
205acpi_ds_load1_begin_op ( 161acpi_ds_load1_begin_op (
206 struct acpi_walk_state *walk_state, 162 struct acpi_walk_state *walk_state,
@@ -225,9 +181,9 @@ acpi_ds_init_callbacks (
225 u32 pass_number); 181 u32 pass_number);
226 182
227 183
228/* dsmthdat - method data (locals/args) */ 184/*
229 185 * dsmthdat - method data (locals/args)
230 186 */
231acpi_status 187acpi_status
232acpi_ds_store_object_to_local ( 188acpi_ds_store_object_to_local (
233 u16 opcode, 189 u16 opcode,
@@ -250,14 +206,6 @@ u8
250acpi_ds_is_method_value ( 206acpi_ds_is_method_value (
251 union acpi_operand_object *obj_desc); 207 union acpi_operand_object *obj_desc);
252 208
253#ifdef ACPI_FUTURE_USAGE
254acpi_object_type
255acpi_ds_method_data_get_type (
256 u16 opcode,
257 u32 index,
258 struct acpi_walk_state *walk_state);
259#endif
260
261acpi_status 209acpi_status
262acpi_ds_method_data_get_value ( 210acpi_ds_method_data_get_value (
263 u16 opcode, 211 u16 opcode,
@@ -265,12 +213,6 @@ acpi_ds_method_data_get_value (
265 struct acpi_walk_state *walk_state, 213 struct acpi_walk_state *walk_state,
266 union acpi_operand_object **dest_desc); 214 union acpi_operand_object **dest_desc);
267 215
268void
269acpi_ds_method_data_delete_value (
270 u16 opcode,
271 u32 index,
272 struct acpi_walk_state *walk_state);
273
274acpi_status 216acpi_status
275acpi_ds_method_data_init_args ( 217acpi_ds_method_data_init_args (
276 union acpi_operand_object **params, 218 union acpi_operand_object **params,
@@ -288,16 +230,10 @@ void
288acpi_ds_method_data_init ( 230acpi_ds_method_data_init (
289 struct acpi_walk_state *walk_state); 231 struct acpi_walk_state *walk_state);
290 232
291acpi_status
292acpi_ds_method_data_set_value (
293 u16 opcode,
294 u32 index,
295 union acpi_operand_object *object,
296 struct acpi_walk_state *walk_state);
297
298
299/* dsmethod - Parser/Interpreter interface - control method parsing */
300 233
234/*
235 * dsmethod - Parser/Interpreter interface - control method parsing
236 */
301acpi_status 237acpi_status
302acpi_ds_parse_method ( 238acpi_ds_parse_method (
303 acpi_handle obj_handle); 239 acpi_handle obj_handle);
@@ -324,20 +260,18 @@ acpi_ds_begin_method_execution (
324 struct acpi_namespace_node *calling_method_node); 260 struct acpi_namespace_node *calling_method_node);
325 261
326 262
327/* dsobj - Parser/Interpreter interface - object initialization and conversion */ 263/*
328 264 * dsinit
329acpi_status 265 */
330acpi_ds_init_one_object (
331 acpi_handle obj_handle,
332 u32 level,
333 void *context,
334 void **return_value);
335
336acpi_status 266acpi_status
337acpi_ds_initialize_objects ( 267acpi_ds_initialize_objects (
338 struct acpi_table_desc *table_desc, 268 struct acpi_table_desc *table_desc,
339 struct acpi_namespace_node *start_node); 269 struct acpi_namespace_node *start_node);
340 270
271
272/*
273 * dsobject - Parser/Interpreter interface - object initialization and conversion
274 */
341acpi_status 275acpi_status
342acpi_ds_build_internal_buffer_obj ( 276acpi_ds_build_internal_buffer_obj (
343 struct acpi_walk_state *walk_state, 277 struct acpi_walk_state *walk_state,
@@ -353,12 +287,6 @@ acpi_ds_build_internal_package_obj (
353 union acpi_operand_object **obj_desc); 287 union acpi_operand_object **obj_desc);
354 288
355acpi_status 289acpi_status
356acpi_ds_build_internal_object (
357 struct acpi_walk_state *walk_state,
358 union acpi_parse_object *op,
359 union acpi_operand_object **obj_desc_ptr);
360
361acpi_status
362acpi_ds_init_object_from_op ( 290acpi_ds_init_object_from_op (
363 struct acpi_walk_state *walk_state, 291 struct acpi_walk_state *walk_state,
364 union acpi_parse_object *op, 292 union acpi_parse_object *op,
@@ -372,8 +300,9 @@ acpi_ds_create_node (
372 union acpi_parse_object *op); 300 union acpi_parse_object *op);
373 301
374 302
375/* dsutils - Parser/Interpreter interface utility routines */ 303/*
376 304 * dsutils - Parser/Interpreter interface utility routines
305 */
377void 306void
378acpi_ds_clear_implicit_return ( 307acpi_ds_clear_implicit_return (
379 struct acpi_walk_state *walk_state); 308 struct acpi_walk_state *walk_state);
@@ -418,7 +347,6 @@ acpi_ds_clear_operands (
418/* 347/*
419 * dswscope - Scope Stack manipulation 348 * dswscope - Scope Stack manipulation
420 */ 349 */
421
422acpi_status 350acpi_status
423acpi_ds_scope_stack_push ( 351acpi_ds_scope_stack_push (
424 struct acpi_namespace_node *node, 352 struct acpi_namespace_node *node,
@@ -435,7 +363,18 @@ acpi_ds_scope_stack_clear (
435 struct acpi_walk_state *walk_state); 363 struct acpi_walk_state *walk_state);
436 364
437 365
438/* dswstate - parser WALK_STATE management routines */ 366/*
367 * dswstate - parser WALK_STATE management routines
368 */
369acpi_status
370acpi_ds_obj_stack_push (
371 void *object,
372 struct acpi_walk_state *walk_state);
373
374acpi_status
375acpi_ds_obj_stack_pop (
376 u32 pop_count,
377 struct acpi_walk_state *walk_state);
439 378
440struct acpi_walk_state * 379struct acpi_walk_state *
441acpi_ds_create_walk_state ( 380acpi_ds_create_walk_state (
@@ -454,12 +393,6 @@ acpi_ds_init_aml_walk (
454 struct acpi_parameter_info *info, 393 struct acpi_parameter_info *info,
455 u32 pass_number); 394 u32 pass_number);
456 395
457#ifdef ACPI_FUTURE_USAGE
458acpi_status
459acpi_ds_obj_stack_delete_all (
460 struct acpi_walk_state *walk_state);
461#endif
462
463acpi_status 396acpi_status
464acpi_ds_obj_stack_pop_and_delete ( 397acpi_ds_obj_stack_pop_and_delete (
465 u32 pop_count, 398 u32 pop_count,
@@ -494,20 +427,8 @@ struct acpi_walk_state *
494acpi_ds_get_current_walk_state ( 427acpi_ds_get_current_walk_state (
495 struct acpi_thread_state *thread); 428 struct acpi_thread_state *thread);
496 429
497#ifdef ACPI_ENABLE_OBJECT_CACHE
498void
499acpi_ds_delete_walk_state_cache (
500 void);
501#endif
502
503#ifdef ACPI_FUTURE_USAGE 430#ifdef ACPI_FUTURE_USAGE
504acpi_status 431acpi_status
505acpi_ds_result_insert (
506 void *object,
507 u32 index,
508 struct acpi_walk_state *walk_state);
509
510acpi_status
511acpi_ds_result_remove ( 432acpi_ds_result_remove (
512 union acpi_operand_object **object, 433 union acpi_operand_object **object,
513 u32 index, 434 u32 index,
@@ -529,4 +450,10 @@ acpi_ds_result_pop_from_bottom (
529 union acpi_operand_object **object, 450 union acpi_operand_object **object,
530 struct acpi_walk_state *walk_state); 451 struct acpi_walk_state *walk_state);
531 452
453#ifdef ACPI_ENABLE_OBJECT_CACHE
454void
455acpi_ds_delete_walk_state_cache (
456 void);
457#endif
458
532#endif /* _ACDISPAT_H_ */ 459#endif /* _ACDISPAT_H_ */
diff --git a/include/acpi/acevents.h b/include/acpi/acevents.h
index 2dec083ba1c..61a27c8c507 100644
--- a/include/acpi/acevents.h
+++ b/include/acpi/acevents.h
@@ -45,6 +45,9 @@
45#define __ACEVENTS_H__ 45#define __ACEVENTS_H__
46 46
47 47
48/*
49 * evevent
50 */
48acpi_status 51acpi_status
49acpi_ev_initialize_events ( 52acpi_ev_initialize_events (
50 void); 53 void);
@@ -53,28 +56,14 @@ acpi_status
53acpi_ev_install_xrupt_handlers ( 56acpi_ev_install_xrupt_handlers (
54 void); 57 void);
55 58
56
57/*
58 * Evfixed - Fixed event handling
59 */
60
61acpi_status
62acpi_ev_fixed_event_initialize (
63 void);
64
65u32 59u32
66acpi_ev_fixed_event_detect ( 60acpi_ev_fixed_event_detect (
67 void); 61 void);
68 62
69u32
70acpi_ev_fixed_event_dispatch (
71 u32 event);
72
73 63
74/* 64/*
75 * Evmisc 65 * evmisc
76 */ 66 */
77
78u8 67u8
79acpi_ev_is_notify_object ( 68acpi_ev_is_notify_object (
80 struct acpi_namespace_node *node); 69 struct acpi_namespace_node *node);
@@ -100,24 +89,10 @@ acpi_ev_queue_notify_request (
100 struct acpi_namespace_node *node, 89 struct acpi_namespace_node *node,
101 u32 notify_value); 90 u32 notify_value);
102 91
103void ACPI_SYSTEM_XFACE
104acpi_ev_notify_dispatch (
105 void *context);
106
107 92
108/* 93/*
109 * Evgpe - GPE handling and dispatch 94 * evgpe - GPE handling and dispatch
110 */ 95 */
111
112acpi_status
113acpi_ev_walk_gpe_list (
114 ACPI_GPE_CALLBACK gpe_walk_callback,
115 u32 flags);
116
117u8
118acpi_ev_valid_gpe_event (
119 struct acpi_gpe_event_info *gpe_event_info);
120
121acpi_status 96acpi_status
122acpi_ev_update_gpe_enable_masks ( 97acpi_ev_update_gpe_enable_masks (
123 struct acpi_gpe_event_info *gpe_event_info, 98 struct acpi_gpe_event_info *gpe_event_info,
@@ -137,9 +112,23 @@ acpi_ev_get_gpe_event_info (
137 acpi_handle gpe_device, 112 acpi_handle gpe_device,
138 u32 gpe_number); 113 u32 gpe_number);
139 114
115
116/*
117 * evgpeblk
118 */
119u8
120acpi_ev_valid_gpe_event (
121 struct acpi_gpe_event_info *gpe_event_info);
122
140acpi_status 123acpi_status
141acpi_ev_gpe_initialize ( 124acpi_ev_walk_gpe_list (
142 void); 125 ACPI_GPE_CALLBACK gpe_walk_callback,
126 u32 flags);
127
128acpi_status
129acpi_ev_delete_gpe_handlers (
130 struct acpi_gpe_xrupt_info *gpe_xrupt_info,
131 struct acpi_gpe_block_info *gpe_block);
143 132
144acpi_status 133acpi_status
145acpi_ev_create_gpe_block ( 134acpi_ev_create_gpe_block (
@@ -154,11 +143,6 @@ acpi_status
154acpi_ev_delete_gpe_block ( 143acpi_ev_delete_gpe_block (
155 struct acpi_gpe_block_info *gpe_block); 144 struct acpi_gpe_block_info *gpe_block);
156 145
157acpi_status
158acpi_ev_delete_gpe_handlers (
159 struct acpi_gpe_xrupt_info *gpe_xrupt_info,
160 struct acpi_gpe_block_info *gpe_block);
161
162u32 146u32
163acpi_ev_gpe_dispatch ( 147acpi_ev_gpe_dispatch (
164 struct acpi_gpe_event_info *gpe_event_info, 148 struct acpi_gpe_event_info *gpe_event_info,
@@ -177,10 +161,14 @@ acpi_status
177acpi_ev_check_for_wake_only_gpe ( 161acpi_ev_check_for_wake_only_gpe (
178 struct acpi_gpe_event_info *gpe_event_info); 162 struct acpi_gpe_event_info *gpe_event_info);
179 163
164acpi_status
165acpi_ev_gpe_initialize (
166 void);
167
168
180/* 169/*
181 * Evregion - Address Space handling 170 * evregion - Address Space handling
182 */ 171 */
183
184acpi_status 172acpi_status
185acpi_ev_install_region_handlers ( 173acpi_ev_install_region_handlers (
186 void); 174 void);
@@ -198,13 +186,6 @@ acpi_ev_address_space_dispatch (
198 void *value); 186 void *value);
199 187
200acpi_status 188acpi_status
201acpi_ev_install_handler (
202 acpi_handle obj_handle,
203 u32 level,
204 void *context,
205 void **return_value);
206
207acpi_status
208acpi_ev_attach_region ( 189acpi_ev_attach_region (
209 union acpi_operand_object *handler_obj, 190 union acpi_operand_object *handler_obj,
210 union acpi_operand_object *region_obj, 191 union acpi_operand_object *region_obj,
@@ -233,17 +214,10 @@ acpi_ev_execute_reg_method (
233 union acpi_operand_object *region_obj, 214 union acpi_operand_object *region_obj,
234 u32 function); 215 u32 function);
235 216
236acpi_status
237acpi_ev_reg_run (
238 acpi_handle obj_handle,
239 u32 level,
240 void *context,
241 void **return_value);
242 217
243/* 218/*
244 * Evregini - Region initialization and setup 219 * evregini - Region initialization and setup
245 */ 220 */
246
247acpi_status 221acpi_status
248acpi_ev_system_memory_region_setup ( 222acpi_ev_system_memory_region_setup (
249 acpi_handle handle, 223 acpi_handle handle,
@@ -293,9 +267,8 @@ acpi_ev_initialize_region (
293 267
294 268
295/* 269/*
296 * Evsci - SCI (System Control Interrupt) handling/dispatch 270 * evsci - SCI (System Control Interrupt) handling/dispatch
297 */ 271 */
298
299u32 ACPI_SYSTEM_XFACE 272u32 ACPI_SYSTEM_XFACE
300acpi_ev_gpe_xrupt_handler ( 273acpi_ev_gpe_xrupt_handler (
301 void *context); 274 void *context);
diff --git a/include/acpi/acexcep.h b/include/acpi/acexcep.h
index 53f8b50fac1..60d737b2d70 100644
--- a/include/acpi/acexcep.h
+++ b/include/acpi/acexcep.h
@@ -48,7 +48,6 @@
48/* 48/*
49 * Exceptions returned by external ACPI interfaces 49 * Exceptions returned by external ACPI interfaces
50 */ 50 */
51
52#define AE_CODE_ENVIRONMENTAL 0x0000 51#define AE_CODE_ENVIRONMENTAL 0x0000
53#define AE_CODE_PROGRAMMER 0x1000 52#define AE_CODE_PROGRAMMER 0x1000
54#define AE_CODE_ACPI_TABLES 0x2000 53#define AE_CODE_ACPI_TABLES 0x2000
@@ -99,6 +98,7 @@
99 98
100#define AE_CODE_ENV_MAX 0x001E 99#define AE_CODE_ENV_MAX 0x001E
101 100
101
102/* 102/*
103 * Programmer exceptions 103 * Programmer exceptions
104 */ 104 */
@@ -168,6 +168,7 @@
168 168
169#define AE_CODE_AML_MAX 0x0021 169#define AE_CODE_AML_MAX 0x0021
170 170
171
171/* 172/*
172 * Internal exceptions used for control 173 * Internal exceptions used for control
173 */ 174 */
@@ -188,6 +189,7 @@
188 189
189#ifdef DEFINE_ACPI_GLOBALS 190#ifdef DEFINE_ACPI_GLOBALS
190 191
192
191/* 193/*
192 * String versions of the exception codes above 194 * String versions of the exception codes above
193 * These strings must match the corresponding defines exactly 195 * These strings must match the corresponding defines exactly
@@ -304,5 +306,4 @@ char const *acpi_gbl_exception_names_ctrl[] =
304 306
305#endif /* ACPI GLOBALS */ 307#endif /* ACPI GLOBALS */
306 308
307
308#endif /* __ACEXCEP_H__ */ 309#endif /* __ACEXCEP_H__ */
diff --git a/include/acpi/acglobal.h b/include/acpi/acglobal.h
index c7f387a972c..4946696088c 100644
--- a/include/acpi/acglobal.h
+++ b/include/acpi/acglobal.h
@@ -146,15 +146,15 @@ ACPI_EXTERN struct acpi_table_header *acpi_gbl_DSDT;
146ACPI_EXTERN FACS_DESCRIPTOR *acpi_gbl_FACS; 146ACPI_EXTERN FACS_DESCRIPTOR *acpi_gbl_FACS;
147ACPI_EXTERN struct acpi_common_facs acpi_gbl_common_fACS; 147ACPI_EXTERN struct acpi_common_facs acpi_gbl_common_fACS;
148/* 148/*
149 * Since there may be multiple SSDTs and PSDTS, a single pointer is not 149 * Since there may be multiple SSDTs and PSDTs, a single pointer is not
150 * sufficient; Therefore, there isn't one! 150 * sufficient; Therefore, there isn't one!
151 */ 151 */
152 152
153 153
154/* 154/*
155 * Handle both ACPI 1.0 and ACPI 2.0 Integer widths 155 * Handle both ACPI 1.0 and ACPI 2.0 Integer widths:
156 * If we are running a method that exists in a 32-bit ACPI table. 156 * If we are executing a method that exists in a 32-bit ACPI table,
157 * Use only 32 bits of the Integer for conversion. 157 * use only the lower 32 bits of the (internal) 64-bit Integer.
158 */ 158 */
159ACPI_EXTERN u8 acpi_gbl_integer_bit_width; 159ACPI_EXTERN u8 acpi_gbl_integer_bit_width;
160ACPI_EXTERN u8 acpi_gbl_integer_byte_width; 160ACPI_EXTERN u8 acpi_gbl_integer_byte_width;
@@ -246,6 +246,7 @@ ACPI_EXTERN acpi_size acpi_gbl_lowest_stack_pointer;
246ACPI_EXTERN u32 acpi_gbl_deepest_nesting; 246ACPI_EXTERN u32 acpi_gbl_deepest_nesting;
247#endif 247#endif
248 248
249
249/***************************************************************************** 250/*****************************************************************************
250 * 251 *
251 * Interpreter globals 252 * Interpreter globals
@@ -268,6 +269,7 @@ ACPI_EXTERN u8 acpi_gbl_cm_single_step;
268 269
269ACPI_EXTERN union acpi_parse_object *acpi_gbl_parsed_namespace_root; 270ACPI_EXTERN union acpi_parse_object *acpi_gbl_parsed_namespace_root;
270 271
272
271/***************************************************************************** 273/*****************************************************************************
272 * 274 *
273 * Hardware globals 275 * Hardware globals
@@ -298,7 +300,6 @@ ACPI_EXTERN acpi_handle acpi_gbl_gpe_lock;
298 * 300 *
299 ****************************************************************************/ 301 ****************************************************************************/
300 302
301
302ACPI_EXTERN u8 acpi_gbl_db_output_flags; 303ACPI_EXTERN u8 acpi_gbl_db_output_flags;
303 304
304#ifdef ACPI_DISASSEMBLER 305#ifdef ACPI_DISASSEMBLER
@@ -353,5 +354,4 @@ ACPI_EXTERN u32 acpi_gbl_size_of_acpi_objects;
353 354
354#endif /* ACPI_DEBUGGER */ 355#endif /* ACPI_DEBUGGER */
355 356
356
357#endif /* __ACGLOBAL_H__ */ 357#endif /* __ACGLOBAL_H__ */
diff --git a/include/acpi/achware.h b/include/acpi/achware.h
index 28ad1398c15..9d63641b8e7 100644
--- a/include/acpi/achware.h
+++ b/include/acpi/achware.h
@@ -46,22 +46,26 @@
46 46
47 47
48/* PM Timer ticks per second (HZ) */ 48/* PM Timer ticks per second (HZ) */
49
49#define PM_TIMER_FREQUENCY 3579545 50#define PM_TIMER_FREQUENCY 3579545
50 51
52/* Values for the _SST reserved method */
51 53
52/* Prototypes */ 54#define ACPI_SST_INDICATOR_OFF 0
55#define ACPI_SST_WORKING 1
56#define ACPI_SST_WAKING 2
57#define ACPI_SST_SLEEPING 3
58#define ACPI_SST_SLEEP_CONTEXT 4
53 59
54 60
55acpi_status 61/* Prototypes */
56acpi_hw_initialize (
57 void);
58 62
59acpi_status
60acpi_hw_shutdown (
61 void);
62 63
64/*
65 * hwacpi - high level functions
66 */
63acpi_status 67acpi_status
64acpi_hw_initialize_system_info ( 68acpi_hw_initialize (
65 void); 69 void);
66 70
67acpi_status 71acpi_status
@@ -72,12 +76,10 @@ u32
72acpi_hw_get_mode ( 76acpi_hw_get_mode (
73 void); 77 void);
74 78
75u32
76acpi_hw_get_mode_capabilities (
77 void);
78
79/* Register I/O Prototypes */
80 79
80/*
81 * hwregs - ACPI Register I/O
82 */
81struct acpi_bit_register_info * 83struct acpi_bit_register_info *
82acpi_hw_get_bit_register_info ( 84acpi_hw_get_bit_register_info (
83 u32 register_id); 85 u32 register_id);
@@ -111,8 +113,9 @@ acpi_hw_clear_acpi_status (
111 u32 flags); 113 u32 flags);
112 114
113 115
114/* GPE support */ 116/*
115 117 * hwgpe - GPE support
118 */
116acpi_status 119acpi_status
117acpi_hw_write_gpe_enable_reg ( 120acpi_hw_write_gpe_enable_reg (
118 struct acpi_gpe_event_info *gpe_event_info); 121 struct acpi_gpe_event_info *gpe_event_info);
@@ -131,12 +134,12 @@ acpi_hw_clear_gpe_block (
131 struct acpi_gpe_xrupt_info *gpe_xrupt_info, 134 struct acpi_gpe_xrupt_info *gpe_xrupt_info,
132 struct acpi_gpe_block_info *gpe_block); 135 struct acpi_gpe_block_info *gpe_block);
133 136
134#ifdef ACPI_FUTURE_USAGE 137#ifdef ACPI_FUTURE_USAGE
135acpi_status 138acpi_status
136acpi_hw_get_gpe_status ( 139acpi_hw_get_gpe_status (
137 struct acpi_gpe_event_info *gpe_event_info, 140 struct acpi_gpe_event_info *gpe_event_info,
138 acpi_event_status *event_status); 141 acpi_event_status *event_status);
139#endif 142#endif /* ACPI_FUTURE_USAGE */
140 143
141acpi_status 144acpi_status
142acpi_hw_disable_all_gpes ( 145acpi_hw_disable_all_gpes (
@@ -155,15 +158,11 @@ acpi_hw_enable_runtime_gpe_block (
155 struct acpi_gpe_xrupt_info *gpe_xrupt_info, 158 struct acpi_gpe_xrupt_info *gpe_xrupt_info,
156 struct acpi_gpe_block_info *gpe_block); 159 struct acpi_gpe_block_info *gpe_block);
157 160
158acpi_status
159acpi_hw_enable_wakeup_gpe_block (
160 struct acpi_gpe_xrupt_info *gpe_xrupt_info,
161 struct acpi_gpe_block_info *gpe_block);
162
163
164/* ACPI Timer prototypes */
165 161
166#ifdef ACPI_FUTURE_USAGE 162#ifdef ACPI_FUTURE_USAGE
163/*
164 * hwtimer - ACPI Timer prototypes
165 */
167acpi_status 166acpi_status
168acpi_get_timer_resolution ( 167acpi_get_timer_resolution (
169 u32 *resolution); 168 u32 *resolution);
@@ -177,6 +176,7 @@ acpi_get_timer_duration (
177 u32 start_ticks, 176 u32 start_ticks,
178 u32 end_ticks, 177 u32 end_ticks,
179 u32 *time_elapsed); 178 u32 *time_elapsed);
180#endif /* ACPI_FUTURE_USAGE */ 179#endif /* ACPI_FUTURE_USAGE */
180
181 181
182#endif /* __ACHWARE_H__ */ 182#endif /* __ACHWARE_H__ */
diff --git a/include/acpi/acinterp.h b/include/acpi/acinterp.h
index c5301f5ffaf..5c7172477a0 100644
--- a/include/acpi/acinterp.h
+++ b/include/acpi/acinterp.h
@@ -48,37 +48,9 @@
48#define ACPI_WALK_OPERANDS (&(walk_state->operands [walk_state->num_operands -1])) 48#define ACPI_WALK_OPERANDS (&(walk_state->operands [walk_state->num_operands -1]))
49 49
50 50
51acpi_status
52acpi_ex_resolve_operands (
53 u16 opcode,
54 union acpi_operand_object **stack_ptr,
55 struct acpi_walk_state *walk_state);
56
57acpi_status
58acpi_ex_check_object_type (
59 acpi_object_type type_needed,
60 acpi_object_type this_type,
61 void *object);
62
63/*
64 * exxface - External interpreter interfaces
65 */
66
67acpi_status
68acpi_ex_load_table (
69 acpi_table_type table_id);
70
71acpi_status
72acpi_ex_execute_method (
73 struct acpi_namespace_node *method_node,
74 union acpi_operand_object **params,
75 union acpi_operand_object **return_obj_desc);
76
77
78/* 51/*
79 * exconvrt - object conversion 52 * exconvrt - object conversion
80 */ 53 */
81
82acpi_status 54acpi_status
83acpi_ex_convert_to_integer ( 55acpi_ex_convert_to_integer (
84 union acpi_operand_object *obj_desc, 56 union acpi_operand_object *obj_desc,
@@ -110,17 +82,10 @@ acpi_ex_convert_to_target_type (
110 union acpi_operand_object **result_desc, 82 union acpi_operand_object **result_desc,
111 struct acpi_walk_state *walk_state); 83 struct acpi_walk_state *walk_state);
112 84
113u32
114acpi_ex_convert_to_ascii (
115 acpi_integer integer,
116 u16 base,
117 u8 *string,
118 u8 max_length);
119 85
120/* 86/*
121 * exfield - ACPI AML (p-code) execution - field manipulation 87 * exfield - ACPI AML (p-code) execution - field manipulation
122 */ 88 */
123
124acpi_status 89acpi_status
125acpi_ex_common_buffer_setup ( 90acpi_ex_common_buffer_setup (
126 union acpi_operand_object *obj_desc, 91 union acpi_operand_object *obj_desc,
@@ -128,42 +93,6 @@ acpi_ex_common_buffer_setup (
128 u32 *datum_count); 93 u32 *datum_count);
129 94
130acpi_status 95acpi_status
131acpi_ex_extract_from_field (
132 union acpi_operand_object *obj_desc,
133 void *buffer,
134 u32 buffer_length);
135
136acpi_status
137acpi_ex_insert_into_field (
138 union acpi_operand_object *obj_desc,
139 void *buffer,
140 u32 buffer_length);
141
142acpi_status
143acpi_ex_setup_region (
144 union acpi_operand_object *obj_desc,
145 u32 field_datum_byte_offset);
146
147acpi_status
148acpi_ex_access_region (
149 union acpi_operand_object *obj_desc,
150 u32 field_datum_byte_offset,
151 acpi_integer *value,
152 u32 read_write);
153
154u8
155acpi_ex_register_overflow (
156 union acpi_operand_object *obj_desc,
157 acpi_integer value);
158
159acpi_status
160acpi_ex_field_datum_io (
161 union acpi_operand_object *obj_desc,
162 u32 field_datum_byte_offset,
163 acpi_integer *value,
164 u32 read_write);
165
166acpi_status
167acpi_ex_write_with_update_rule ( 96acpi_ex_write_with_update_rule (
168 union acpi_operand_object *obj_desc, 97 union acpi_operand_object *obj_desc,
169 acpi_integer mask, 98 acpi_integer mask,
@@ -198,28 +127,33 @@ acpi_ex_write_data_to_field (
198 union acpi_operand_object *obj_desc, 127 union acpi_operand_object *obj_desc,
199 union acpi_operand_object **result_desc); 128 union acpi_operand_object **result_desc);
200 129
130
201/* 131/*
202 * exmisc - ACPI AML (p-code) execution - specific opcodes 132 * exfldio - low level field I/O
203 */ 133 */
204
205acpi_status 134acpi_status
206acpi_ex_opcode_3A_0T_0R ( 135acpi_ex_extract_from_field (
207 struct acpi_walk_state *walk_state); 136 union acpi_operand_object *obj_desc,
137 void *buffer,
138 u32 buffer_length);
208 139
209acpi_status 140acpi_status
210acpi_ex_opcode_3A_1T_1R ( 141acpi_ex_insert_into_field (
211 struct acpi_walk_state *walk_state); 142 union acpi_operand_object *obj_desc,
143 void *buffer,
144 u32 buffer_length);
212 145
213acpi_status 146acpi_status
214acpi_ex_opcode_6A_0T_1R ( 147acpi_ex_access_region (
215 struct acpi_walk_state *walk_state); 148 union acpi_operand_object *obj_desc,
149 u32 field_datum_byte_offset,
150 acpi_integer *value,
151 u32 read_write);
216 152
217u8
218acpi_ex_do_match (
219 u32 match_op,
220 union acpi_operand_object *package_obj,
221 union acpi_operand_object *match_obj);
222 153
154/*
155 * exmisc - misc support routines
156 */
223acpi_status 157acpi_status
224acpi_ex_get_object_reference ( 158acpi_ex_get_object_reference (
225 union acpi_operand_object *obj_desc, 159 union acpi_operand_object *obj_desc,
@@ -227,13 +161,6 @@ acpi_ex_get_object_reference (
227 struct acpi_walk_state *walk_state); 161 struct acpi_walk_state *walk_state);
228 162
229acpi_status 163acpi_status
230acpi_ex_resolve_multiple (
231 struct acpi_walk_state *walk_state,
232 union acpi_operand_object *operand,
233 acpi_object_type *return_type,
234 union acpi_operand_object **return_desc);
235
236acpi_status
237acpi_ex_concat_template ( 164acpi_ex_concat_template (
238 union acpi_operand_object *obj_desc, 165 union acpi_operand_object *obj_desc,
239 union acpi_operand_object *obj_desc2, 166 union acpi_operand_object *obj_desc2,
@@ -308,13 +235,6 @@ acpi_ex_create_method (
308/* 235/*
309 * exconfig - dynamic table load/unload 236 * exconfig - dynamic table load/unload
310 */ 237 */
311
312acpi_status
313acpi_ex_add_table (
314 struct acpi_table_header *table,
315 struct acpi_namespace_node *parent_node,
316 union acpi_operand_object **ddb_handle);
317
318acpi_status 238acpi_status
319acpi_ex_load_op ( 239acpi_ex_load_op (
320 union acpi_operand_object *obj_desc, 240 union acpi_operand_object *obj_desc,
@@ -334,7 +254,6 @@ acpi_ex_unload_table (
334/* 254/*
335 * exmutex - mutex support 255 * exmutex - mutex support
336 */ 256 */
337
338acpi_status 257acpi_status
339acpi_ex_acquire_mutex ( 258acpi_ex_acquire_mutex (
340 union acpi_operand_object *time_desc, 259 union acpi_operand_object *time_desc,
@@ -354,15 +273,10 @@ void
354acpi_ex_unlink_mutex ( 273acpi_ex_unlink_mutex (
355 union acpi_operand_object *obj_desc); 274 union acpi_operand_object *obj_desc);
356 275
357void
358acpi_ex_link_mutex (
359 union acpi_operand_object *obj_desc,
360 struct acpi_thread_state *thread);
361 276
362/* 277/*
363 * exprep - ACPI AML (p-code) execution - prep utilities 278 * exprep - ACPI AML execution - prep utilities
364 */ 279 */
365
366acpi_status 280acpi_status
367acpi_ex_prep_common_field_object ( 281acpi_ex_prep_common_field_object (
368 union acpi_operand_object *obj_desc, 282 union acpi_operand_object *obj_desc,
@@ -375,10 +289,10 @@ acpi_status
375acpi_ex_prep_field_value ( 289acpi_ex_prep_field_value (
376 struct acpi_create_field_info *info); 290 struct acpi_create_field_info *info);
377 291
292
378/* 293/*
379 * exsystem - Interface to OS services 294 * exsystem - Interface to OS services
380 */ 295 */
381
382acpi_status 296acpi_status
383acpi_ex_system_do_notify_op ( 297acpi_ex_system_do_notify_op (
384 union acpi_operand_object *value, 298 union acpi_operand_object *value,
@@ -421,9 +335,8 @@ acpi_ex_system_wait_semaphore (
421 335
422 336
423/* 337/*
424 * exmonadic - ACPI AML (p-code) execution, monadic operators 338 * exoparg1 - ACPI AML execution, 1 operand
425 */ 339 */
426
427acpi_status 340acpi_status
428acpi_ex_opcode_0A_0T_1R ( 341acpi_ex_opcode_0A_0T_1R (
429 struct acpi_walk_state *walk_state); 342 struct acpi_walk_state *walk_state);
@@ -445,9 +358,8 @@ acpi_ex_opcode_1A_1T_0R (
445 struct acpi_walk_state *walk_state); 358 struct acpi_walk_state *walk_state);
446 359
447/* 360/*
448 * exdyadic - ACPI AML (p-code) execution, dyadic operators 361 * exoparg2 - ACPI AML execution, 2 operands
449 */ 362 */
450
451acpi_status 363acpi_status
452acpi_ex_opcode_2A_0T_0R ( 364acpi_ex_opcode_2A_0T_0R (
453 struct acpi_walk_state *walk_state); 365 struct acpi_walk_state *walk_state);
@@ -466,21 +378,56 @@ acpi_ex_opcode_2A_2T_1R (
466 378
467 379
468/* 380/*
469 * exresolv - Object resolution and get value functions 381 * exoparg3 - ACPI AML execution, 3 operands
382 */
383acpi_status
384acpi_ex_opcode_3A_0T_0R (
385 struct acpi_walk_state *walk_state);
386
387acpi_status
388acpi_ex_opcode_3A_1T_1R (
389 struct acpi_walk_state *walk_state);
390
391
392/*
393 * exoparg6 - ACPI AML execution, 6 operands
470 */ 394 */
395acpi_status
396acpi_ex_opcode_6A_0T_1R (
397 struct acpi_walk_state *walk_state);
398
471 399
400/*
401 * exresolv - Object resolution and get value functions
402 */
472acpi_status 403acpi_status
473acpi_ex_resolve_to_value ( 404acpi_ex_resolve_to_value (
474 union acpi_operand_object **stack_ptr, 405 union acpi_operand_object **stack_ptr,
475 struct acpi_walk_state *walk_state); 406 struct acpi_walk_state *walk_state);
476 407
477acpi_status 408acpi_status
409acpi_ex_resolve_multiple (
410 struct acpi_walk_state *walk_state,
411 union acpi_operand_object *operand,
412 acpi_object_type *return_type,
413 union acpi_operand_object **return_desc);
414
415
416/*
417 * exresnte - resolve namespace node
418 */
419acpi_status
478acpi_ex_resolve_node_to_value ( 420acpi_ex_resolve_node_to_value (
479 struct acpi_namespace_node **stack_ptr, 421 struct acpi_namespace_node **stack_ptr,
480 struct acpi_walk_state *walk_state); 422 struct acpi_walk_state *walk_state);
481 423
424
425/*
426 * exresop - resolve operand to value
427 */
482acpi_status 428acpi_status
483acpi_ex_resolve_object_to_value ( 429acpi_ex_resolve_operands (
430 u16 opcode,
484 union acpi_operand_object **stack_ptr, 431 union acpi_operand_object **stack_ptr,
485 struct acpi_walk_state *walk_state); 432 struct acpi_walk_state *walk_state);
486 433
@@ -488,7 +435,6 @@ acpi_ex_resolve_object_to_value (
488/* 435/*
489 * exdump - Interpreter debug output routines 436 * exdump - Interpreter debug output routines
490 */ 437 */
491
492void 438void
493acpi_ex_dump_operand ( 439acpi_ex_dump_operand (
494 union acpi_operand_object *obj_desc, 440 union acpi_operand_object *obj_desc,
@@ -504,7 +450,7 @@ acpi_ex_dump_operands (
504 char *module_name, 450 char *module_name,
505 u32 line_number); 451 u32 line_number);
506 452
507#ifdef ACPI_FUTURE_USAGE 453#ifdef ACPI_FUTURE_USAGE
508void 454void
509acpi_ex_dump_object_descriptor ( 455acpi_ex_dump_object_descriptor (
510 union acpi_operand_object *object, 456 union acpi_operand_object *object,
@@ -514,46 +460,12 @@ void
514acpi_ex_dump_node ( 460acpi_ex_dump_node (
515 struct acpi_namespace_node *node, 461 struct acpi_namespace_node *node,
516 u32 flags); 462 u32 flags);
463#endif /* ACPI_FUTURE_USAGE */
517 464
518void
519acpi_ex_out_string (
520 char *title,
521 char *value);
522
523void
524acpi_ex_out_pointer (
525 char *title,
526 void *value);
527
528void
529acpi_ex_out_integer (
530 char *title,
531 u32 value);
532
533void
534acpi_ex_out_address (
535 char *title,
536 acpi_physical_address value);
537#endif /* ACPI_FUTURE_USAGE */
538 465
539/* 466/*
540 * exnames - interpreter/scanner name load/execute 467 * exnames - AML namestring support
541 */ 468 */
542
543char *
544acpi_ex_allocate_name_string (
545 u32 prefix_count,
546 u32 num_name_segs);
547
548u32
549acpi_ex_good_char (
550 u32 character);
551
552acpi_status
553acpi_ex_name_segment (
554 u8 **in_aml_address,
555 char *name_string);
556
557acpi_status 469acpi_status
558acpi_ex_get_name_string ( 470acpi_ex_get_name_string (
559 acpi_object_type data_type, 471 acpi_object_type data_type,
@@ -561,16 +473,10 @@ acpi_ex_get_name_string (
561 char **out_name_string, 473 char **out_name_string,
562 u32 *out_name_length); 474 u32 *out_name_length);
563 475
564acpi_status
565acpi_ex_do_name (
566 acpi_object_type data_type,
567 acpi_interpreter_mode load_exec_mode);
568
569 476
570/* 477/*
571 * exstore - Object store support 478 * exstore - Object store support
572 */ 479 */
573
574acpi_status 480acpi_status
575acpi_ex_store ( 481acpi_ex_store (
576 union acpi_operand_object *val_desc, 482 union acpi_operand_object *val_desc,
@@ -578,12 +484,6 @@ acpi_ex_store (
578 struct acpi_walk_state *walk_state); 484 struct acpi_walk_state *walk_state);
579 485
580acpi_status 486acpi_status
581acpi_ex_store_object_to_index (
582 union acpi_operand_object *val_desc,
583 union acpi_operand_object *dest_desc,
584 struct acpi_walk_state *walk_state);
585
586acpi_status
587acpi_ex_store_object_to_node ( 487acpi_ex_store_object_to_node (
588 union acpi_operand_object *source_desc, 488 union acpi_operand_object *source_desc,
589 struct acpi_namespace_node *node, 489 struct acpi_namespace_node *node,
@@ -593,10 +493,10 @@ acpi_ex_store_object_to_node (
593#define ACPI_IMPLICIT_CONVERSION TRUE 493#define ACPI_IMPLICIT_CONVERSION TRUE
594#define ACPI_NO_IMPLICIT_CONVERSION FALSE 494#define ACPI_NO_IMPLICIT_CONVERSION FALSE
595 495
496
596/* 497/*
597 * exstoren 498 * exstoren - resolve/store object
598 */ 499 */
599
600acpi_status 500acpi_status
601acpi_ex_resolve_object ( 501acpi_ex_resolve_object (
602 union acpi_operand_object **source_desc_ptr, 502 union acpi_operand_object **source_desc_ptr,
@@ -612,9 +512,8 @@ acpi_ex_store_object_to_object (
612 512
613 513
614/* 514/*
615 * excopy - object copy 515 * exstorob - store object - buffer/string
616 */ 516 */
617
618acpi_status 517acpi_status
619acpi_ex_store_buffer_to_buffer ( 518acpi_ex_store_buffer_to_buffer (
620 union acpi_operand_object *source_desc, 519 union acpi_operand_object *source_desc,
@@ -625,6 +524,10 @@ acpi_ex_store_string_to_string (
625 union acpi_operand_object *source_desc, 524 union acpi_operand_object *source_desc,
626 union acpi_operand_object *target_desc); 525 union acpi_operand_object *target_desc);
627 526
527
528/*
529 * excopy - object copy
530 */
628acpi_status 531acpi_status
629acpi_ex_copy_integer_to_index_field ( 532acpi_ex_copy_integer_to_index_field (
630 union acpi_operand_object *source_desc, 533 union acpi_operand_object *source_desc,
@@ -645,10 +548,10 @@ acpi_ex_copy_integer_to_buffer_field (
645 union acpi_operand_object *source_desc, 548 union acpi_operand_object *source_desc,
646 union acpi_operand_object *target_desc); 549 union acpi_operand_object *target_desc);
647 550
551
648/* 552/*
649 * exutils - interpreter/scanner utilities 553 * exutils - interpreter/scanner utilities
650 */ 554 */
651
652acpi_status 555acpi_status
653acpi_ex_enter_interpreter ( 556acpi_ex_enter_interpreter (
654 void); 557 void);
@@ -669,11 +572,6 @@ void
669acpi_ex_release_global_lock ( 572acpi_ex_release_global_lock (
670 u8 locked); 573 u8 locked);
671 574
672u32
673acpi_ex_digits_needed (
674 acpi_integer value,
675 u32 base);
676
677void 575void
678acpi_ex_eisa_id_to_string ( 576acpi_ex_eisa_id_to_string (
679 u32 numeric_id, 577 u32 numeric_id,
@@ -688,7 +586,6 @@ acpi_ex_unsigned_integer_to_string (
688/* 586/*
689 * exregion - default op_region handlers 587 * exregion - default op_region handlers
690 */ 588 */
691
692acpi_status 589acpi_status
693acpi_ex_system_memory_space_handler ( 590acpi_ex_system_memory_space_handler (
694 u32 function, 591 u32 function,
diff --git a/include/acpi/aclocal.h b/include/acpi/aclocal.h
index 01d3b4bc0c8..030e641115c 100644
--- a/include/acpi/aclocal.h
+++ b/include/acpi/aclocal.h
@@ -72,7 +72,6 @@ typedef u32 acpi_mutex_handle;
72 * 72 *
73 * NOTE: any changes here must be reflected in the acpi_gbl_mutex_names table also! 73 * NOTE: any changes here must be reflected in the acpi_gbl_mutex_names table also!
74 */ 74 */
75
76#define ACPI_MTX_EXECUTE 0 75#define ACPI_MTX_EXECUTE 0
77#define ACPI_MTX_INTERPRETER 1 76#define ACPI_MTX_INTERPRETER 1
78#define ACPI_MTX_PARSER 2 77#define ACPI_MTX_PARSER 2
@@ -151,13 +150,13 @@ typedef u16 acpi_owner_id;
151#define ACPI_FIELD_DWORD_GRANULARITY 4 150#define ACPI_FIELD_DWORD_GRANULARITY 4
152#define ACPI_FIELD_QWORD_GRANULARITY 8 151#define ACPI_FIELD_QWORD_GRANULARITY 8
153 152
153
154/***************************************************************************** 154/*****************************************************************************
155 * 155 *
156 * Namespace typedefs and structs 156 * Namespace typedefs and structs
157 * 157 *
158 ****************************************************************************/ 158 ****************************************************************************/
159 159
160
161/* Operational modes of the AML interpreter/scanner */ 160/* Operational modes of the AML interpreter/scanner */
162 161
163typedef enum 162typedef enum
@@ -176,7 +175,6 @@ typedef enum
176 * data_type is used to differentiate between internal descriptors, and MUST 175 * data_type is used to differentiate between internal descriptors, and MUST
177 * be the first byte in this structure. 176 * be the first byte in this structure.
178 */ 177 */
179
180union acpi_name_union 178union acpi_name_union
181{ 179{
182 u32 integer; 180 u32 integer;
@@ -415,7 +413,6 @@ struct acpi_field_info
415 * 413 *
416 ****************************************************************************/ 414 ****************************************************************************/
417 415
418
419#define ACPI_CONTROL_NORMAL 0xC0 416#define ACPI_CONTROL_NORMAL 0xC0
420#define ACPI_CONTROL_CONDITIONAL_EXECUTING 0xC1 417#define ACPI_CONTROL_CONDITIONAL_EXECUTING 0xC1
421#define ACPI_CONTROL_PREDICATE_EXECUTING 0xC2 418#define ACPI_CONTROL_PREDICATE_EXECUTING 0xC2
@@ -424,6 +421,7 @@ struct acpi_field_info
424 421
425 422
426/* Forward declarations */ 423/* Forward declarations */
424
427struct acpi_walk_state ; 425struct acpi_walk_state ;
428struct acpi_obj_mutex; 426struct acpi_obj_mutex;
429union acpi_parse_object ; 427union acpi_parse_object ;
@@ -601,7 +599,6 @@ struct acpi_opcode_info
601 u8 type; /* Opcode type */ 599 u8 type; /* Opcode type */
602}; 600};
603 601
604
605union acpi_parse_value 602union acpi_parse_value
606{ 603{
607 acpi_integer integer; /* Integer constant (Up to 64 bits) */ 604 acpi_integer integer; /* Integer constant (Up to 64 bits) */
@@ -613,7 +610,6 @@ union acpi_parse_value
613 union acpi_parse_object *arg; /* arguments and contained ops */ 610 union acpi_parse_object *arg; /* arguments and contained ops */
614}; 611};
615 612
616
617#define ACPI_PARSE_COMMON \ 613#define ACPI_PARSE_COMMON \
618 u8 data_type; /* To differentiate various internal objs */\ 614 u8 data_type; /* To differentiate various internal objs */\
619 u8 flags; /* Type of Op */\ 615 u8 flags; /* Type of Op */\
@@ -691,7 +687,6 @@ struct acpi_parse_obj_asl
691 char parse_op_name[12]; 687 char parse_op_name[12];
692}; 688};
693 689
694
695union acpi_parse_object 690union acpi_parse_object
696{ 691{
697 struct acpi_parse_obj_common common; 692 struct acpi_parse_obj_common common;
@@ -834,7 +829,6 @@ struct acpi_bit_register_info
834 * 829 *
835 ****************************************************************************/ 830 ****************************************************************************/
836 831
837
838/* resource_type values */ 832/* resource_type values */
839 833
840#define ACPI_RESOURCE_TYPE_MEMORY_RANGE 0 834#define ACPI_RESOURCE_TYPE_MEMORY_RANGE 0
diff --git a/include/acpi/acmacros.h b/include/acpi/acmacros.h
index fcaced16b16..09be937d2c3 100644
--- a/include/acpi/acmacros.h
+++ b/include/acpi/acmacros.h
@@ -539,11 +539,6 @@
539 539
540 540
541#define ACPI_DUMP_ENTRY(a,b) acpi_ns_dump_entry (a,b) 541#define ACPI_DUMP_ENTRY(a,b) acpi_ns_dump_entry (a,b)
542
543#ifdef ACPI_FUTURE_USAGE
544#define ACPI_DUMP_TABLES(a,b) acpi_ns_dump_tables(a,b)
545#endif
546
547#define ACPI_DUMP_PATHNAME(a,b,c,d) acpi_ns_dump_pathname(a,b,c,d) 542#define ACPI_DUMP_PATHNAME(a,b,c,d) acpi_ns_dump_pathname(a,b,c,d)
548#define ACPI_DUMP_RESOURCE_LIST(a) acpi_rs_dump_resource_list(a) 543#define ACPI_DUMP_RESOURCE_LIST(a) acpi_rs_dump_resource_list(a)
549#define ACPI_DUMP_BUFFER(a,b) acpi_ut_dump_buffer((u8 *)a,b,DB_BYTE_DISPLAY,_COMPONENT) 544#define ACPI_DUMP_BUFFER(a,b) acpi_ut_dump_buffer((u8 *)a,b,DB_BYTE_DISPLAY,_COMPONENT)
@@ -596,11 +591,6 @@
596#define ACPI_DUMP_STACK_ENTRY(a) 591#define ACPI_DUMP_STACK_ENTRY(a)
597#define ACPI_DUMP_OPERANDS(a,b,c,d,e) 592#define ACPI_DUMP_OPERANDS(a,b,c,d,e)
598#define ACPI_DUMP_ENTRY(a,b) 593#define ACPI_DUMP_ENTRY(a,b)
599
600#ifdef ACPI_FUTURE_USAGE
601#define ACPI_DUMP_TABLES(a,b)
602#endif
603
604#define ACPI_DUMP_PATHNAME(a,b,c,d) 594#define ACPI_DUMP_PATHNAME(a,b,c,d)
605#define ACPI_DUMP_RESOURCE_LIST(a) 595#define ACPI_DUMP_RESOURCE_LIST(a)
606#define ACPI_DUMP_BUFFER(a,b) 596#define ACPI_DUMP_BUFFER(a,b)
diff --git a/include/acpi/acnames.h b/include/acpi/acnames.h
new file mode 100644
index 00000000000..deb7cb06f5f
--- /dev/null
+++ b/include/acpi/acnames.h
@@ -0,0 +1,84 @@
1/******************************************************************************
2 *
3 * Name: acnames.h - Global names and strings
4 *
5 *****************************************************************************/
6
7/*
8 * Copyright (C) 2000 - 2005, R. Byron Moore
9 * All rights reserved.
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions, and the following disclaimer,
16 * without modification.
17 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18 * substantially similar to the "NO WARRANTY" disclaimer below
19 * ("Disclaimer") and any redistribution must be conditioned upon
20 * including a substantially similar Disclaimer requirement for further
21 * binary redistribution.
22 * 3. Neither the names of the above-listed copyright holders nor the names
23 * of any contributors may be used to endorse or promote products derived
24 * from this software without specific prior written permission.
25 *
26 * Alternatively, this software may be distributed under the terms of the
27 * GNU General Public License ("GPL") version 2 as published by the Free
28 * Software Foundation.
29 *
30 * NO WARRANTY
31 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
34 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41 * POSSIBILITY OF SUCH DAMAGES.
42 */
43
44#ifndef __ACNAMES_H__
45#define __ACNAMES_H__
46
47/* Method names - these methods can appear anywhere in the namespace */
48
49#define METHOD_NAME__HID "_HID"
50#define METHOD_NAME__CID "_CID"
51#define METHOD_NAME__UID "_UID"
52#define METHOD_NAME__ADR "_ADR"
53#define METHOD_NAME__INI "_INI"
54#define METHOD_NAME__STA "_STA"
55#define METHOD_NAME__REG "_REG"
56#define METHOD_NAME__SEG "_SEG"
57#define METHOD_NAME__BBN "_BBN"
58#define METHOD_NAME__PRT "_PRT"
59#define METHOD_NAME__CRS "_CRS"
60#define METHOD_NAME__PRS "_PRS"
61#define METHOD_NAME__PRW "_PRW"
62#define METHOD_NAME__SRS "_SRS"
63
64/* Method names - these methods must appear at the namespace root */
65
66#define METHOD_NAME__BFS "\\_BFS"
67#define METHOD_NAME__GTS "\\_GTS"
68#define METHOD_NAME__PTS "\\_PTS"
69#define METHOD_NAME__SST "\\_SI._SST"
70#define METHOD_NAME__WAK "\\_WAK"
71
72/* Definitions of the predefined namespace names */
73
74#define ACPI_UNKNOWN_NAME (u32) 0x3F3F3F3F /* Unknown name is "????" */
75#define ACPI_ROOT_NAME (u32) 0x5F5F5F5C /* Root name is "\___" */
76#define ACPI_SYS_BUS_NAME (u32) 0x5F53425F /* Sys bus name is "_SB_" */
77
78#define ACPI_NS_ROOT_PATH "\\"
79#define ACPI_NS_SYSTEM_BUS "_SB_"
80
81
82#endif /* __ACNAMES_H__ */
83
84
diff --git a/include/acpi/acnamesp.h b/include/acpi/acnamesp.h
index 8b3cdc3566b..d1b3ce80056 100644
--- a/include/acpi/acnamesp.h
+++ b/include/acpi/acnamesp.h
@@ -57,17 +57,6 @@
57#define ACPI_NS_NEWSCOPE 1 /* a definition of this type opens a name scope */ 57#define ACPI_NS_NEWSCOPE 1 /* a definition of this type opens a name scope */
58#define ACPI_NS_LOCAL 2 /* suppress search of enclosing scopes */ 58#define ACPI_NS_LOCAL 2 /* suppress search of enclosing scopes */
59 59
60
61/* Definitions of the predefined namespace names */
62
63#define ACPI_UNKNOWN_NAME (u32) 0x3F3F3F3F /* Unknown name is "????" */
64#define ACPI_ROOT_NAME (u32) 0x5F5F5F5C /* Root name is "\___" */
65#define ACPI_SYS_BUS_NAME (u32) 0x5F53425F /* Sys bus name is "_SB_" */
66
67#define ACPI_NS_ROOT_PATH "\\"
68#define ACPI_NS_SYSTEM_BUS "_SB_"
69
70
71/* Flags for acpi_ns_lookup, acpi_ns_search_and_enter */ 60/* Flags for acpi_ns_lookup, acpi_ns_search_and_enter */
72 61
73#define ACPI_NS_NO_UPSEARCH 0 62#define ACPI_NS_NO_UPSEARCH 0
@@ -80,10 +69,9 @@
80#define ACPI_NS_WALK_NO_UNLOCK FALSE 69#define ACPI_NS_WALK_NO_UNLOCK FALSE
81 70
82 71
83acpi_status 72/*
84acpi_ns_load_namespace ( 73 * nsinit - Namespace initialization
85 void); 74 */
86
87acpi_status 75acpi_status
88acpi_ns_initialize_objects ( 76acpi_ns_initialize_objects (
89 void); 77 void);
@@ -93,23 +81,22 @@ acpi_ns_initialize_devices (
93 void); 81 void);
94 82
95 83
96/* Namespace init - nsxfinit */ 84/*
97 85 * nsload - Namespace loading
86 */
98acpi_status 87acpi_status
99acpi_ns_init_one_device ( 88acpi_ns_load_namespace (
100 acpi_handle obj_handle, 89 void);
101 u32 nesting_level,
102 void *context,
103 void **return_value);
104 90
105acpi_status 91acpi_status
106acpi_ns_init_one_object ( 92acpi_ns_load_table (
107 acpi_handle obj_handle, 93 struct acpi_table_desc *table_desc,
108 u32 level, 94 struct acpi_namespace_node *node);
109 void *context,
110 void **return_value);
111 95
112 96
97/*
98 * nswalk - walk the namespace
99 */
113acpi_status 100acpi_status
114acpi_ns_walk_namespace ( 101acpi_ns_walk_namespace (
115 acpi_object_type type, 102 acpi_object_type type,
@@ -126,37 +113,24 @@ acpi_ns_get_next_node (
126 struct acpi_namespace_node *parent, 113 struct acpi_namespace_node *parent,
127 struct acpi_namespace_node *child); 114 struct acpi_namespace_node *child);
128 115
129void
130acpi_ns_delete_namespace_by_owner (
131 u16 table_id);
132
133
134/* Namespace loading - nsload */
135
136acpi_status
137acpi_ns_one_complete_parse (
138 u32 pass_number,
139 struct acpi_table_desc *table_desc);
140 116
117/*
118 * nsparse - table parsing
119 */
141acpi_status 120acpi_status
142acpi_ns_parse_table ( 121acpi_ns_parse_table (
143 struct acpi_table_desc *table_desc, 122 struct acpi_table_desc *table_desc,
144 struct acpi_namespace_node *scope); 123 struct acpi_namespace_node *scope);
145 124
146acpi_status 125acpi_status
147acpi_ns_load_table ( 126acpi_ns_one_complete_parse (
148 struct acpi_table_desc *table_desc, 127 u32 pass_number,
149 struct acpi_namespace_node *node); 128 struct acpi_table_desc *table_desc);
150
151acpi_status
152acpi_ns_load_table_by_type (
153 acpi_table_type table_type);
154 129
155 130
156/* 131/*
157 * Top-level namespace access - nsaccess 132 * nsaccess - Top-level namespace access
158 */ 133 */
159
160acpi_status 134acpi_status
161acpi_ns_root_initialize ( 135acpi_ns_root_initialize (
162 void); 136 void);
@@ -173,9 +147,8 @@ acpi_ns_lookup (
173 147
174 148
175/* 149/*
176 * Named object allocation/deallocation - nsalloc 150 * nsalloc - Named object allocation/deallocation
177 */ 151 */
178
179struct acpi_namespace_node * 152struct acpi_namespace_node *
180acpi_ns_create_node ( 153acpi_ns_create_node (
181 u32 name); 154 u32 name);
@@ -189,6 +162,10 @@ acpi_ns_delete_namespace_subtree (
189 struct acpi_namespace_node *parent_handle); 162 struct acpi_namespace_node *parent_handle);
190 163
191void 164void
165acpi_ns_delete_namespace_by_owner (
166 u16 table_id);
167
168void
192acpi_ns_detach_object ( 169acpi_ns_detach_object (
193 struct acpi_namespace_node *node); 170 struct acpi_namespace_node *node);
194 171
@@ -201,36 +178,16 @@ acpi_ns_compare_names (
201 char *name1, 178 char *name1,
202 char *name2); 179 char *name2);
203 180
204void
205acpi_ns_remove_reference (
206 struct acpi_namespace_node *node);
207
208 181
209/* 182/*
210 * Namespace modification - nsmodify 183 * nsdump - Namespace dump/print utilities
211 */ 184 */
212 185#ifdef ACPI_FUTURE_USAGE
213#ifdef ACPI_FUTURE_USAGE
214acpi_status
215acpi_ns_unload_namespace (
216 acpi_handle handle);
217
218acpi_status
219acpi_ns_delete_subtree (
220 acpi_handle start_handle);
221#endif
222
223
224/*
225 * Namespace dump/print utilities - nsdump
226 */
227
228#ifdef ACPI_FUTURE_USAGE
229void 186void
230acpi_ns_dump_tables ( 187acpi_ns_dump_tables (
231 acpi_handle search_base, 188 acpi_handle search_base,
232 u32 max_depth); 189 u32 max_depth);
233#endif 190#endif /* ACPI_FUTURE_USAGE */
234 191
235void 192void
236acpi_ns_dump_entry ( 193acpi_ns_dump_entry (
@@ -249,19 +206,6 @@ acpi_ns_print_pathname (
249 u32 num_segments, 206 u32 num_segments,
250 char *pathname); 207 char *pathname);
251 208
252#ifdef ACPI_FUTURE_USAGE
253acpi_status
254acpi_ns_dump_one_device (
255 acpi_handle obj_handle,
256 u32 level,
257 void *context,
258 void **return_value);
259
260void
261acpi_ns_dump_root_devices (
262 void);
263#endif /* ACPI_FUTURE_USAGE */
264
265acpi_status 209acpi_status
266acpi_ns_dump_one_object ( 210acpi_ns_dump_one_object (
267 acpi_handle obj_handle, 211 acpi_handle obj_handle,
@@ -269,7 +213,7 @@ acpi_ns_dump_one_object (
269 void *context, 213 void *context,
270 void **return_value); 214 void **return_value);
271 215
272#ifdef ACPI_FUTURE_USAGE 216#ifdef ACPI_FUTURE_USAGE
273void 217void
274acpi_ns_dump_objects ( 218acpi_ns_dump_objects (
275 acpi_object_type type, 219 acpi_object_type type,
@@ -277,13 +221,12 @@ acpi_ns_dump_objects (
277 u32 max_depth, 221 u32 max_depth,
278 u32 ownder_id, 222 u32 ownder_id,
279 acpi_handle start_handle); 223 acpi_handle start_handle);
280#endif 224#endif /* ACPI_FUTURE_USAGE */
281 225
282 226
283/* 227/*
284 * Namespace evaluation functions - nseval 228 * nseval - Namespace evaluation functions
285 */ 229 */
286
287acpi_status 230acpi_status
288acpi_ns_evaluate_by_handle ( 231acpi_ns_evaluate_by_handle (
289 struct acpi_parameter_info *info); 232 struct acpi_parameter_info *info);
@@ -298,40 +241,14 @@ acpi_ns_evaluate_relative (
298 char *pathname, 241 char *pathname,
299 struct acpi_parameter_info *info); 242 struct acpi_parameter_info *info);
300 243
301acpi_status
302acpi_ns_execute_control_method (
303 struct acpi_parameter_info *info);
304
305acpi_status
306acpi_ns_get_object_value (
307 struct acpi_parameter_info *info);
308
309
310/*
311 * Parent/Child/Peer utility functions
312 */
313
314#ifdef ACPI_FUTURE_USAGE
315acpi_name
316acpi_ns_find_parent_name (
317 struct acpi_namespace_node *node_to_search);
318#endif
319
320 244
321/* 245/*
322 * Name and Scope manipulation - nsnames 246 * nsnames - Name and Scope manipulation
323 */ 247 */
324
325u32 248u32
326acpi_ns_opens_scope ( 249acpi_ns_opens_scope (
327 acpi_object_type type); 250 acpi_object_type type);
328 251
329void
330acpi_ns_build_external_path (
331 struct acpi_namespace_node *node,
332 acpi_size size,
333 char *name_buffer);
334
335char * 252char *
336acpi_ns_get_external_pathname ( 253acpi_ns_get_external_pathname (
337 struct acpi_namespace_node *node); 254 struct acpi_namespace_node *node);
@@ -363,9 +280,8 @@ acpi_ns_get_pathname_length (
363 280
364 281
365/* 282/*
366 * Object management for namespace nodes - nsobject 283 * nsobject - Object management for namespace nodes
367 */ 284 */
368
369acpi_status 285acpi_status
370acpi_ns_attach_object ( 286acpi_ns_attach_object (
371 struct acpi_namespace_node *node, 287 struct acpi_namespace_node *node,
@@ -399,9 +315,8 @@ acpi_ns_get_attached_data (
399 315
400 316
401/* 317/*
402 * Namespace searching and entry - nssearch 318 * nssearch - Namespace searching and entry
403 */ 319 */
404
405acpi_status 320acpi_status
406acpi_ns_search_and_enter ( 321acpi_ns_search_and_enter (
407 u32 entry_name, 322 u32 entry_name,
@@ -428,17 +343,12 @@ acpi_ns_install_node (
428 343
429 344
430/* 345/*
431 * Utility functions - nsutils 346 * nsutils - Utility functions
432 */ 347 */
433
434u8 348u8
435acpi_ns_valid_root_prefix ( 349acpi_ns_valid_root_prefix (
436 char prefix); 350 char prefix);
437 351
438u8
439acpi_ns_valid_path_separator (
440 char sep);
441
442acpi_object_type 352acpi_object_type
443acpi_ns_get_type ( 353acpi_ns_get_type (
444 struct acpi_namespace_node *node); 354 struct acpi_namespace_node *node);
@@ -511,5 +421,4 @@ struct acpi_namespace_node *
511acpi_ns_get_next_valid_node ( 421acpi_ns_get_next_valid_node (
512 struct acpi_namespace_node *node); 422 struct acpi_namespace_node *node);
513 423
514
515#endif /* __ACNAMESP_H__ */ 424#endif /* __ACNAMESP_H__ */
diff --git a/include/acpi/acobject.h b/include/acpi/acobject.h
index 036023a940b..e079b94e4fc 100644
--- a/include/acpi/acobject.h
+++ b/include/acpi/acobject.h
@@ -133,6 +133,7 @@ struct acpi_object_integer
133 acpi_integer value; 133 acpi_integer value;
134}; 134};
135 135
136
136/* 137/*
137 * Note: The String and Buffer object must be identical through the Pointer 138 * Note: The String and Buffer object must be identical through the Pointer
138 * element. There is code that depends on this. 139 * element. There is code that depends on this.
@@ -468,7 +469,6 @@ union acpi_operand_object
468 * 469 *
469 *****************************************************************************/ 470 *****************************************************************************/
470 471
471
472/* Object descriptor types */ 472/* Object descriptor types */
473 473
474#define ACPI_DESC_TYPE_CACHED 0x01 /* Used only when object is cached */ 474#define ACPI_DESC_TYPE_CACHED 0x01 /* Used only when object is cached */
diff --git a/include/acpi/acopcode.h b/include/acpi/acopcode.h
new file mode 100644
index 00000000000..118ecba4cf0
--- /dev/null
+++ b/include/acpi/acopcode.h
@@ -0,0 +1,325 @@
1/******************************************************************************
2 *
3 * Name: acopcode.h - AML opcode information for the AML parser and interpreter
4 *
5 *****************************************************************************/
6
7/*
8 * Copyright (C) 2000 - 2005, R. Byron Moore
9 * All rights reserved.
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions, and the following disclaimer,
16 * without modification.
17 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18 * substantially similar to the "NO WARRANTY" disclaimer below
19 * ("Disclaimer") and any redistribution must be conditioned upon
20 * including a substantially similar Disclaimer requirement for further
21 * binary redistribution.
22 * 3. Neither the names of the above-listed copyright holders nor the names
23 * of any contributors may be used to endorse or promote products derived
24 * from this software without specific prior written permission.
25 *
26 * Alternatively, this software may be distributed under the terms of the
27 * GNU General Public License ("GPL") version 2 as published by the Free
28 * Software Foundation.
29 *
30 * NO WARRANTY
31 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
34 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41 * POSSIBILITY OF SUCH DAMAGES.
42 */
43
44#ifndef __ACOPCODE_H__
45#define __ACOPCODE_H__
46
47#define MAX_EXTENDED_OPCODE 0x88
48#define NUM_EXTENDED_OPCODE (MAX_EXTENDED_OPCODE + 1)
49#define MAX_INTERNAL_OPCODE
50#define NUM_INTERNAL_OPCODE (MAX_INTERNAL_OPCODE + 1)
51
52/* Used for non-assigned opcodes */
53
54#define _UNK 0x6B
55
56/*
57 * Reserved ASCII characters. Do not use any of these for
58 * internal opcodes, since they are used to differentiate
59 * name strings from AML opcodes
60 */
61#define _ASC 0x6C
62#define _NAM 0x6C
63#define _PFX 0x6D
64
65
66/*
67 * All AML opcodes and the parse-time arguments for each. Used by the AML
68 * parser Each list is compressed into a 32-bit number and stored in the
69 * master opcode table (in psopcode.c).
70 */
71#define ARGP_ACCESSFIELD_OP ARGP_LIST1 (ARGP_NAMESTRING)
72#define ARGP_ACQUIRE_OP ARGP_LIST2 (ARGP_SUPERNAME, ARGP_WORDDATA)
73#define ARGP_ADD_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
74#define ARGP_ALIAS_OP ARGP_LIST2 (ARGP_NAMESTRING, ARGP_NAME)
75#define ARGP_ARG0 ARG_NONE
76#define ARGP_ARG1 ARG_NONE
77#define ARGP_ARG2 ARG_NONE
78#define ARGP_ARG3 ARG_NONE
79#define ARGP_ARG4 ARG_NONE
80#define ARGP_ARG5 ARG_NONE
81#define ARGP_ARG6 ARG_NONE
82#define ARGP_BANK_FIELD_OP ARGP_LIST6 (ARGP_PKGLENGTH, ARGP_NAMESTRING, ARGP_NAMESTRING,ARGP_TERMARG, ARGP_BYTEDATA, ARGP_FIELDLIST)
83#define ARGP_BIT_AND_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
84#define ARGP_BIT_NAND_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
85#define ARGP_BIT_NOR_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
86#define ARGP_BIT_NOT_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TARGET)
87#define ARGP_BIT_OR_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
88#define ARGP_BIT_XOR_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
89#define ARGP_BREAK_OP ARG_NONE
90#define ARGP_BREAK_POINT_OP ARG_NONE
91#define ARGP_BUFFER_OP ARGP_LIST3 (ARGP_PKGLENGTH, ARGP_TERMARG, ARGP_BYTELIST)
92#define ARGP_BYTE_OP ARGP_LIST1 (ARGP_BYTEDATA)
93#define ARGP_BYTELIST_OP ARGP_LIST1 (ARGP_NAMESTRING)
94#define ARGP_CONCAT_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
95#define ARGP_CONCAT_RES_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
96#define ARGP_COND_REF_OF_OP ARGP_LIST2 (ARGP_SUPERNAME, ARGP_SUPERNAME)
97#define ARGP_CONTINUE_OP ARG_NONE
98#define ARGP_COPY_OP ARGP_LIST2 (ARGP_SUPERNAME, ARGP_SIMPLENAME)
99#define ARGP_CREATE_BIT_FIELD_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_NAME)
100#define ARGP_CREATE_BYTE_FIELD_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_NAME)
101#define ARGP_CREATE_DWORD_FIELD_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_NAME)
102#define ARGP_CREATE_FIELD_OP ARGP_LIST4 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TERMARG, ARGP_NAME)
103#define ARGP_CREATE_QWORD_FIELD_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_NAME)
104#define ARGP_CREATE_WORD_FIELD_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_NAME)
105#define ARGP_DATA_REGION_OP ARGP_LIST4 (ARGP_NAME, ARGP_TERMARG, ARGP_TERMARG, ARGP_TERMARG)
106#define ARGP_DEBUG_OP ARG_NONE
107#define ARGP_DECREMENT_OP ARGP_LIST1 (ARGP_SUPERNAME)
108#define ARGP_DEREF_OF_OP ARGP_LIST1 (ARGP_TERMARG)
109#define ARGP_DEVICE_OP ARGP_LIST3 (ARGP_PKGLENGTH, ARGP_NAME, ARGP_OBJLIST)
110#define ARGP_DIVIDE_OP ARGP_LIST4 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET, ARGP_TARGET)
111#define ARGP_DWORD_OP ARGP_LIST1 (ARGP_DWORDDATA)
112#define ARGP_ELSE_OP ARGP_LIST2 (ARGP_PKGLENGTH, ARGP_TERMLIST)
113#define ARGP_EVENT_OP ARGP_LIST1 (ARGP_NAME)
114#define ARGP_FATAL_OP ARGP_LIST3 (ARGP_BYTEDATA, ARGP_DWORDDATA, ARGP_TERMARG)
115#define ARGP_FIELD_OP ARGP_LIST4 (ARGP_PKGLENGTH, ARGP_NAMESTRING, ARGP_BYTEDATA, ARGP_FIELDLIST)
116#define ARGP_FIND_SET_LEFT_BIT_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TARGET)
117#define ARGP_FIND_SET_RIGHT_BIT_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TARGET)
118#define ARGP_FROM_BCD_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TARGET)
119#define ARGP_IF_OP ARGP_LIST3 (ARGP_PKGLENGTH, ARGP_TERMARG, ARGP_TERMLIST)
120#define ARGP_INCREMENT_OP ARGP_LIST1 (ARGP_SUPERNAME)
121#define ARGP_INDEX_FIELD_OP ARGP_LIST5 (ARGP_PKGLENGTH, ARGP_NAMESTRING, ARGP_NAMESTRING,ARGP_BYTEDATA, ARGP_FIELDLIST)
122#define ARGP_INDEX_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
123#define ARGP_LAND_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TERMARG)
124#define ARGP_LEQUAL_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TERMARG)
125#define ARGP_LGREATER_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TERMARG)
126#define ARGP_LGREATEREQUAL_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TERMARG)
127#define ARGP_LLESS_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TERMARG)
128#define ARGP_LLESSEQUAL_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TERMARG)
129#define ARGP_LNOT_OP ARGP_LIST1 (ARGP_TERMARG)
130#define ARGP_LNOTEQUAL_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TERMARG)
131#define ARGP_LOAD_OP ARGP_LIST2 (ARGP_NAMESTRING, ARGP_SUPERNAME)
132#define ARGP_LOAD_TABLE_OP ARGP_LIST6 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TERMARG, ARGP_TERMARG, ARGP_TERMARG, ARGP_TERMARG)
133#define ARGP_LOCAL0 ARG_NONE
134#define ARGP_LOCAL1 ARG_NONE
135#define ARGP_LOCAL2 ARG_NONE
136#define ARGP_LOCAL3 ARG_NONE
137#define ARGP_LOCAL4 ARG_NONE
138#define ARGP_LOCAL5 ARG_NONE
139#define ARGP_LOCAL6 ARG_NONE
140#define ARGP_LOCAL7 ARG_NONE
141#define ARGP_LOR_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TERMARG)
142#define ARGP_MATCH_OP ARGP_LIST6 (ARGP_TERMARG, ARGP_BYTEDATA, ARGP_TERMARG, ARGP_BYTEDATA, ARGP_TERMARG, ARGP_TERMARG)
143#define ARGP_METHOD_OP ARGP_LIST4 (ARGP_PKGLENGTH, ARGP_NAME, ARGP_BYTEDATA, ARGP_TERMLIST)
144#define ARGP_METHODCALL_OP ARGP_LIST1 (ARGP_NAMESTRING)
145#define ARGP_MID_OP ARGP_LIST4 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
146#define ARGP_MOD_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
147#define ARGP_MULTIPLY_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
148#define ARGP_MUTEX_OP ARGP_LIST2 (ARGP_NAME, ARGP_BYTEDATA)
149#define ARGP_NAME_OP ARGP_LIST2 (ARGP_NAME, ARGP_DATAOBJ)
150#define ARGP_NAMEDFIELD_OP ARGP_LIST1 (ARGP_NAMESTRING)
151#define ARGP_NAMEPATH_OP ARGP_LIST1 (ARGP_NAMESTRING)
152#define ARGP_NOOP_OP ARG_NONE
153#define ARGP_NOTIFY_OP ARGP_LIST2 (ARGP_SUPERNAME, ARGP_TERMARG)
154#define ARGP_ONE_OP ARG_NONE
155#define ARGP_ONES_OP ARG_NONE
156#define ARGP_PACKAGE_OP ARGP_LIST3 (ARGP_PKGLENGTH, ARGP_BYTEDATA, ARGP_DATAOBJLIST)
157#define ARGP_POWER_RES_OP ARGP_LIST5 (ARGP_PKGLENGTH, ARGP_NAME, ARGP_BYTEDATA, ARGP_WORDDATA, ARGP_OBJLIST)
158#define ARGP_PROCESSOR_OP ARGP_LIST6 (ARGP_PKGLENGTH, ARGP_NAME, ARGP_BYTEDATA, ARGP_DWORDDATA, ARGP_BYTEDATA, ARGP_OBJLIST)
159#define ARGP_QWORD_OP ARGP_LIST1 (ARGP_QWORDDATA)
160#define ARGP_REF_OF_OP ARGP_LIST1 (ARGP_SUPERNAME)
161#define ARGP_REGION_OP ARGP_LIST4 (ARGP_NAME, ARGP_BYTEDATA, ARGP_TERMARG, ARGP_TERMARG)
162#define ARGP_RELEASE_OP ARGP_LIST1 (ARGP_SUPERNAME)
163#define ARGP_RESERVEDFIELD_OP ARGP_LIST1 (ARGP_NAMESTRING)
164#define ARGP_RESET_OP ARGP_LIST1 (ARGP_SUPERNAME)
165#define ARGP_RETURN_OP ARGP_LIST1 (ARGP_TERMARG)
166#define ARGP_REVISION_OP ARG_NONE
167#define ARGP_SCOPE_OP ARGP_LIST3 (ARGP_PKGLENGTH, ARGP_NAME, ARGP_TERMLIST)
168#define ARGP_SHIFT_LEFT_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
169#define ARGP_SHIFT_RIGHT_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
170#define ARGP_SIGNAL_OP ARGP_LIST1 (ARGP_SUPERNAME)
171#define ARGP_SIZE_OF_OP ARGP_LIST1 (ARGP_SUPERNAME)
172#define ARGP_SLEEP_OP ARGP_LIST1 (ARGP_TERMARG)
173#define ARGP_STALL_OP ARGP_LIST1 (ARGP_TERMARG)
174#define ARGP_STATICSTRING_OP ARGP_LIST1 (ARGP_NAMESTRING)
175#define ARGP_STORE_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_SUPERNAME)
176#define ARGP_STRING_OP ARGP_LIST1 (ARGP_CHARLIST)
177#define ARGP_SUBTRACT_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
178#define ARGP_THERMAL_ZONE_OP ARGP_LIST3 (ARGP_PKGLENGTH, ARGP_NAME, ARGP_OBJLIST)
179#define ARGP_TIMER_OP ARG_NONE
180#define ARGP_TO_BCD_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TARGET)
181#define ARGP_TO_BUFFER_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TARGET)
182#define ARGP_TO_DEC_STR_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TARGET)
183#define ARGP_TO_HEX_STR_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TARGET)
184#define ARGP_TO_INTEGER_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TARGET)
185#define ARGP_TO_STRING_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
186#define ARGP_TYPE_OP ARGP_LIST1 (ARGP_SUPERNAME)
187#define ARGP_UNLOAD_OP ARGP_LIST1 (ARGP_SUPERNAME)
188#define ARGP_VAR_PACKAGE_OP ARGP_LIST3 (ARGP_PKGLENGTH, ARGP_TERMARG, ARGP_DATAOBJLIST)
189#define ARGP_WAIT_OP ARGP_LIST2 (ARGP_SUPERNAME, ARGP_TERMARG)
190#define ARGP_WHILE_OP ARGP_LIST3 (ARGP_PKGLENGTH, ARGP_TERMARG, ARGP_TERMLIST)
191#define ARGP_WORD_OP ARGP_LIST1 (ARGP_WORDDATA)
192#define ARGP_ZERO_OP ARG_NONE
193
194
195/*
196 * All AML opcodes and the runtime arguments for each. Used by the AML
197 * interpreter Each list is compressed into a 32-bit number and stored
198 * in the master opcode table (in psopcode.c).
199 *
200 * (Used by prep_operands procedure and the ASL Compiler)
201 */
202#define ARGI_ACCESSFIELD_OP ARGI_INVALID_OPCODE
203#define ARGI_ACQUIRE_OP ARGI_LIST2 (ARGI_MUTEX, ARGI_INTEGER)
204#define ARGI_ADD_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF)
205#define ARGI_ALIAS_OP ARGI_INVALID_OPCODE
206#define ARGI_ARG0 ARG_NONE
207#define ARGI_ARG1 ARG_NONE
208#define ARGI_ARG2 ARG_NONE
209#define ARGI_ARG3 ARG_NONE
210#define ARGI_ARG4 ARG_NONE
211#define ARGI_ARG5 ARG_NONE
212#define ARGI_ARG6 ARG_NONE
213#define ARGI_BANK_FIELD_OP ARGI_INVALID_OPCODE
214#define ARGI_BIT_AND_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF)
215#define ARGI_BIT_NAND_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF)
216#define ARGI_BIT_NOR_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF)
217#define ARGI_BIT_NOT_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_TARGETREF)
218#define ARGI_BIT_OR_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF)
219#define ARGI_BIT_XOR_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF)
220#define ARGI_BREAK_OP ARG_NONE
221#define ARGI_BREAK_POINT_OP ARG_NONE
222#define ARGI_BUFFER_OP ARGI_LIST1 (ARGI_INTEGER)
223#define ARGI_BYTE_OP ARGI_INVALID_OPCODE
224#define ARGI_BYTELIST_OP ARGI_INVALID_OPCODE
225#define ARGI_CONCAT_OP ARGI_LIST3 (ARGI_COMPUTEDATA,ARGI_COMPUTEDATA, ARGI_TARGETREF)
226#define ARGI_CONCAT_RES_OP ARGI_LIST3 (ARGI_BUFFER, ARGI_BUFFER, ARGI_TARGETREF)
227#define ARGI_COND_REF_OF_OP ARGI_LIST2 (ARGI_OBJECT_REF, ARGI_TARGETREF)
228#define ARGI_CONTINUE_OP ARGI_INVALID_OPCODE
229#define ARGI_COPY_OP ARGI_LIST2 (ARGI_ANYTYPE, ARGI_SIMPLE_TARGET)
230#define ARGI_CREATE_BIT_FIELD_OP ARGI_LIST3 (ARGI_BUFFER, ARGI_INTEGER, ARGI_REFERENCE)
231#define ARGI_CREATE_BYTE_FIELD_OP ARGI_LIST3 (ARGI_BUFFER, ARGI_INTEGER, ARGI_REFERENCE)
232#define ARGI_CREATE_DWORD_FIELD_OP ARGI_LIST3 (ARGI_BUFFER, ARGI_INTEGER, ARGI_REFERENCE)
233#define ARGI_CREATE_FIELD_OP ARGI_LIST4 (ARGI_BUFFER, ARGI_INTEGER, ARGI_INTEGER, ARGI_REFERENCE)
234#define ARGI_CREATE_QWORD_FIELD_OP ARGI_LIST3 (ARGI_BUFFER, ARGI_INTEGER, ARGI_REFERENCE)
235#define ARGI_CREATE_WORD_FIELD_OP ARGI_LIST3 (ARGI_BUFFER, ARGI_INTEGER, ARGI_REFERENCE)
236#define ARGI_DATA_REGION_OP ARGI_LIST3 (ARGI_STRING, ARGI_STRING, ARGI_STRING)
237#define ARGI_DEBUG_OP ARG_NONE
238#define ARGI_DECREMENT_OP ARGI_LIST1 (ARGI_INTEGER_REF)
239#define ARGI_DEREF_OF_OP ARGI_LIST1 (ARGI_REF_OR_STRING)
240#define ARGI_DEVICE_OP ARGI_INVALID_OPCODE
241#define ARGI_DIVIDE_OP ARGI_LIST4 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF, ARGI_TARGETREF)
242#define ARGI_DWORD_OP ARGI_INVALID_OPCODE
243#define ARGI_ELSE_OP ARGI_INVALID_OPCODE
244#define ARGI_EVENT_OP ARGI_INVALID_OPCODE
245#define ARGI_FATAL_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_INTEGER)
246#define ARGI_FIELD_OP ARGI_INVALID_OPCODE
247#define ARGI_FIND_SET_LEFT_BIT_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_TARGETREF)
248#define ARGI_FIND_SET_RIGHT_BIT_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_TARGETREF)
249#define ARGI_FROM_BCD_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_TARGETREF)
250#define ARGI_IF_OP ARGI_INVALID_OPCODE
251#define ARGI_INCREMENT_OP ARGI_LIST1 (ARGI_INTEGER_REF)
252#define ARGI_INDEX_FIELD_OP ARGI_INVALID_OPCODE
253#define ARGI_INDEX_OP ARGI_LIST3 (ARGI_COMPLEXOBJ, ARGI_INTEGER, ARGI_TARGETREF)
254#define ARGI_LAND_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_INTEGER)
255#define ARGI_LEQUAL_OP ARGI_LIST2 (ARGI_COMPUTEDATA,ARGI_COMPUTEDATA)
256#define ARGI_LGREATER_OP ARGI_LIST2 (ARGI_COMPUTEDATA,ARGI_COMPUTEDATA)
257#define ARGI_LGREATEREQUAL_OP ARGI_INVALID_OPCODE
258#define ARGI_LLESS_OP ARGI_LIST2 (ARGI_COMPUTEDATA,ARGI_COMPUTEDATA)
259#define ARGI_LLESSEQUAL_OP ARGI_INVALID_OPCODE
260#define ARGI_LNOT_OP ARGI_LIST1 (ARGI_INTEGER)
261#define ARGI_LNOTEQUAL_OP ARGI_INVALID_OPCODE
262#define ARGI_LOAD_OP ARGI_LIST2 (ARGI_REGION_OR_FIELD,ARGI_TARGETREF)
263#define ARGI_LOAD_TABLE_OP ARGI_LIST6 (ARGI_STRING, ARGI_STRING, ARGI_STRING, ARGI_STRING, ARGI_STRING, ARGI_ANYTYPE)
264#define ARGI_LOCAL0 ARG_NONE
265#define ARGI_LOCAL1 ARG_NONE
266#define ARGI_LOCAL2 ARG_NONE
267#define ARGI_LOCAL3 ARG_NONE
268#define ARGI_LOCAL4 ARG_NONE
269#define ARGI_LOCAL5 ARG_NONE
270#define ARGI_LOCAL6 ARG_NONE
271#define ARGI_LOCAL7 ARG_NONE
272#define ARGI_LOR_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_INTEGER)
273#define ARGI_MATCH_OP ARGI_LIST6 (ARGI_PACKAGE, ARGI_INTEGER, ARGI_COMPUTEDATA, ARGI_INTEGER,ARGI_COMPUTEDATA,ARGI_INTEGER)
274#define ARGI_METHOD_OP ARGI_INVALID_OPCODE
275#define ARGI_METHODCALL_OP ARGI_INVALID_OPCODE
276#define ARGI_MID_OP ARGI_LIST4 (ARGI_BUFFER_OR_STRING,ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF)
277#define ARGI_MOD_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF)
278#define ARGI_MULTIPLY_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF)
279#define ARGI_MUTEX_OP ARGI_INVALID_OPCODE
280#define ARGI_NAME_OP ARGI_INVALID_OPCODE
281#define ARGI_NAMEDFIELD_OP ARGI_INVALID_OPCODE
282#define ARGI_NAMEPATH_OP ARGI_INVALID_OPCODE
283#define ARGI_NOOP_OP ARG_NONE
284#define ARGI_NOTIFY_OP ARGI_LIST2 (ARGI_DEVICE_REF, ARGI_INTEGER)
285#define ARGI_ONE_OP ARG_NONE
286#define ARGI_ONES_OP ARG_NONE
287#define ARGI_PACKAGE_OP ARGI_LIST1 (ARGI_INTEGER)
288#define ARGI_POWER_RES_OP ARGI_INVALID_OPCODE
289#define ARGI_PROCESSOR_OP ARGI_INVALID_OPCODE
290#define ARGI_QWORD_OP ARGI_INVALID_OPCODE
291#define ARGI_REF_OF_OP ARGI_LIST1 (ARGI_OBJECT_REF)
292#define ARGI_REGION_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_INTEGER)
293#define ARGI_RELEASE_OP ARGI_LIST1 (ARGI_MUTEX)
294#define ARGI_RESERVEDFIELD_OP ARGI_INVALID_OPCODE
295#define ARGI_RESET_OP ARGI_LIST1 (ARGI_EVENT)
296#define ARGI_RETURN_OP ARGI_INVALID_OPCODE
297#define ARGI_REVISION_OP ARG_NONE
298#define ARGI_SCOPE_OP ARGI_INVALID_OPCODE
299#define ARGI_SHIFT_LEFT_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF)
300#define ARGI_SHIFT_RIGHT_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF)
301#define ARGI_SIGNAL_OP ARGI_LIST1 (ARGI_EVENT)
302#define ARGI_SIZE_OF_OP ARGI_LIST1 (ARGI_DATAOBJECT)
303#define ARGI_SLEEP_OP ARGI_LIST1 (ARGI_INTEGER)
304#define ARGI_STALL_OP ARGI_LIST1 (ARGI_INTEGER)
305#define ARGI_STATICSTRING_OP ARGI_INVALID_OPCODE
306#define ARGI_STORE_OP ARGI_LIST2 (ARGI_DATAREFOBJ, ARGI_TARGETREF)
307#define ARGI_STRING_OP ARGI_INVALID_OPCODE
308#define ARGI_SUBTRACT_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF)
309#define ARGI_THERMAL_ZONE_OP ARGI_INVALID_OPCODE
310#define ARGI_TIMER_OP ARG_NONE
311#define ARGI_TO_BCD_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_FIXED_TARGET)
312#define ARGI_TO_BUFFER_OP ARGI_LIST2 (ARGI_COMPUTEDATA,ARGI_FIXED_TARGET)
313#define ARGI_TO_DEC_STR_OP ARGI_LIST2 (ARGI_COMPUTEDATA,ARGI_FIXED_TARGET)
314#define ARGI_TO_HEX_STR_OP ARGI_LIST2 (ARGI_COMPUTEDATA,ARGI_FIXED_TARGET)
315#define ARGI_TO_INTEGER_OP ARGI_LIST2 (ARGI_COMPUTEDATA,ARGI_FIXED_TARGET)
316#define ARGI_TO_STRING_OP ARGI_LIST3 (ARGI_BUFFER, ARGI_INTEGER, ARGI_FIXED_TARGET)
317#define ARGI_TYPE_OP ARGI_LIST1 (ARGI_ANYTYPE)
318#define ARGI_UNLOAD_OP ARGI_LIST1 (ARGI_DDBHANDLE)
319#define ARGI_VAR_PACKAGE_OP ARGI_LIST1 (ARGI_INTEGER)
320#define ARGI_WAIT_OP ARGI_LIST2 (ARGI_EVENT, ARGI_INTEGER)
321#define ARGI_WHILE_OP ARGI_INVALID_OPCODE
322#define ARGI_WORD_OP ARGI_INVALID_OPCODE
323#define ARGI_ZERO_OP ARG_NONE
324
325#endif /* __ACOPCODE_H__ */
diff --git a/include/acpi/acparser.h b/include/acpi/acparser.h
index c0395ef2b0d..69827657181 100644
--- a/include/acpi/acparser.h
+++ b/include/acpi/acparser.h
@@ -64,8 +64,17 @@
64 64
65#define ACPI_PARSE_DEFERRED_OP 0x0100 65#define ACPI_PARSE_DEFERRED_OP 0x0100
66 66
67/* Parser external interfaces */
68 67
68/******************************************************************************
69 *
70 * Parser interfaces
71 *
72 *****************************************************************************/
73
74
75/*
76 * psxface - Parser external interfaces
77 */
69acpi_status 78acpi_status
70acpi_psx_load_table ( 79acpi_psx_load_table (
71 u8 *pcode_addr, 80 u8 *pcode_addr,
@@ -76,23 +85,13 @@ acpi_psx_execute (
76 struct acpi_parameter_info *info); 85 struct acpi_parameter_info *info);
77 86
78 87
79/****************************************************************************** 88/*
80 * 89 * psargs - Parse AML opcode arguments
81 * Parser interfaces 90 */
82 *
83 *****************************************************************************/
84
85
86/* psargs - Parse AML opcode arguments */
87
88u8 * 91u8 *
89acpi_ps_get_next_package_end ( 92acpi_ps_get_next_package_end (
90 struct acpi_parse_state *parser_state); 93 struct acpi_parse_state *parser_state);
91 94
92u32
93acpi_ps_get_next_package_length (
94 struct acpi_parse_state *parser_state);
95
96char * 95char *
97acpi_ps_get_next_namestring ( 96acpi_ps_get_next_namestring (
98 struct acpi_parse_state *parser_state); 97 struct acpi_parse_state *parser_state);
@@ -110,10 +109,6 @@ acpi_ps_get_next_namepath (
110 union acpi_parse_object *arg, 109 union acpi_parse_object *arg,
111 u8 method_call); 110 u8 method_call);
112 111
113union acpi_parse_object *
114acpi_ps_get_next_field (
115 struct acpi_parse_state *parser_state);
116
117acpi_status 112acpi_status
118acpi_ps_get_next_arg ( 113acpi_ps_get_next_arg (
119 struct acpi_walk_state *walk_state, 114 struct acpi_walk_state *walk_state,
@@ -122,8 +117,9 @@ acpi_ps_get_next_arg (
122 union acpi_parse_object **return_arg); 117 union acpi_parse_object **return_arg);
123 118
124 119
125/* psfind */ 120/*
126 121 * psfind
122 */
127union acpi_parse_object * 123union acpi_parse_object *
128acpi_ps_find_name ( 124acpi_ps_find_name (
129 union acpi_parse_object *scope, 125 union acpi_parse_object *scope,
@@ -135,8 +131,9 @@ acpi_ps_get_parent (
135 union acpi_parse_object *op); 131 union acpi_parse_object *op);
136 132
137 133
138/* psopcode - AML Opcode information */ 134/*
139 135 * psopcode - AML Opcode information
136 */
140const struct acpi_opcode_info * 137const struct acpi_opcode_info *
141acpi_ps_get_opcode_info ( 138acpi_ps_get_opcode_info (
142 u16 opcode); 139 u16 opcode);
@@ -146,56 +143,25 @@ acpi_ps_get_opcode_name (
146 u16 opcode); 143 u16 opcode);
147 144
148 145
149/* psparse - top level parsing routines */ 146/*
150 147 * psparse - top level parsing routines
151u32 148 */
152acpi_ps_get_opcode_size (
153 u32 opcode);
154
155void
156acpi_ps_complete_this_op (
157 struct acpi_walk_state *walk_state,
158 union acpi_parse_object *op);
159
160acpi_status
161acpi_ps_next_parse_state (
162 struct acpi_walk_state *walk_state,
163 union acpi_parse_object *op,
164 acpi_status callback_status);
165
166acpi_status
167acpi_ps_find_object (
168 struct acpi_walk_state *walk_state,
169 union acpi_parse_object **out_op);
170
171void
172acpi_ps_delete_parse_tree (
173 union acpi_parse_object *root);
174
175acpi_status
176acpi_ps_parse_loop (
177 struct acpi_walk_state *walk_state);
178
179acpi_status 149acpi_status
180acpi_ps_parse_aml ( 150acpi_ps_parse_aml (
181 struct acpi_walk_state *walk_state); 151 struct acpi_walk_state *walk_state);
182 152
183acpi_status 153u32
184acpi_ps_parse_table ( 154acpi_ps_get_opcode_size (
185 u8 *aml, 155 u32 opcode);
186 u32 aml_size,
187 acpi_parse_downwards descending_callback,
188 acpi_parse_upwards ascending_callback,
189 union acpi_parse_object **root_object);
190 156
191u16 157u16
192acpi_ps_peek_opcode ( 158acpi_ps_peek_opcode (
193 struct acpi_parse_state *state); 159 struct acpi_parse_state *state);
194 160
195 161
196/* psscope - Scope stack management routines */ 162/*
197 163 * psscope - Scope stack management routines
198 164 */
199acpi_status 165acpi_status
200acpi_ps_init_scope ( 166acpi_ps_init_scope (
201 struct acpi_parse_state *parser_state, 167 struct acpi_parse_state *parser_state,
@@ -228,8 +194,9 @@ acpi_ps_cleanup_scope (
228 struct acpi_parse_state *state); 194 struct acpi_parse_state *state);
229 195
230 196
231/* pstree - parse tree manipulation routines */ 197/*
232 198 * pstree - parse tree manipulation routines
199 */
233void 200void
234acpi_ps_append_arg( 201acpi_ps_append_arg(
235 union acpi_parse_object *op, 202 union acpi_parse_object *op,
@@ -247,20 +214,17 @@ acpi_ps_get_arg(
247 union acpi_parse_object *op, 214 union acpi_parse_object *op,
248 u32 argn); 215 u32 argn);
249 216
250#ifdef ACPI_FUTURE_USAGE 217#ifdef ACPI_FUTURE_USAGE
251union acpi_parse_object *
252acpi_ps_get_child (
253 union acpi_parse_object *op);
254
255union acpi_parse_object * 218union acpi_parse_object *
256acpi_ps_get_depth_next ( 219acpi_ps_get_depth_next (
257 union acpi_parse_object *origin, 220 union acpi_parse_object *origin,
258 union acpi_parse_object *op); 221 union acpi_parse_object *op);
259#endif /* ACPI_FUTURE_USAGE */ 222#endif /* ACPI_FUTURE_USAGE */
260
261 223
262/* pswalk - parse tree walk routines */
263 224
225/*
226 * pswalk - parse tree walk routines
227 */
264acpi_status 228acpi_status
265acpi_ps_walk_parsed_aml ( 229acpi_ps_walk_parsed_aml (
266 union acpi_parse_object *start_op, 230 union acpi_parse_object *start_op,
@@ -283,9 +247,14 @@ acpi_status
283acpi_ps_delete_completed_op ( 247acpi_ps_delete_completed_op (
284 struct acpi_walk_state *walk_state); 248 struct acpi_walk_state *walk_state);
285 249
250void
251acpi_ps_delete_parse_tree (
252 union acpi_parse_object *root);
286 253
287/* psutils - parser utilities */
288 254
255/*
256 * psutils - parser utilities
257 */
289union acpi_parse_object * 258union acpi_parse_object *
290acpi_ps_create_scope_op ( 259acpi_ps_create_scope_op (
291 void); 260 void);
@@ -303,12 +272,6 @@ void
303acpi_ps_free_op ( 272acpi_ps_free_op (
304 union acpi_parse_object *op); 273 union acpi_parse_object *op);
305 274
306#ifdef ACPI_ENABLE_OBJECT_CACHE
307void
308acpi_ps_delete_parse_cache (
309 void);
310#endif
311
312u8 275u8
313acpi_ps_is_leading_char ( 276acpi_ps_is_leading_char (
314 u32 c); 277 u32 c);
@@ -317,20 +280,27 @@ u8
317acpi_ps_is_prefix_char ( 280acpi_ps_is_prefix_char (
318 u32 c); 281 u32 c);
319 282
320#ifdef ACPI_FUTURE_USAGE 283#ifdef ACPI_FUTURE_USAGE
321u32 284u32
322acpi_ps_get_name( 285acpi_ps_get_name(
323 union acpi_parse_object *op); 286 union acpi_parse_object *op);
324#endif 287#endif /* ACPI_FUTURE_USAGE */
325 288
326void 289void
327acpi_ps_set_name( 290acpi_ps_set_name(
328 union acpi_parse_object *op, 291 union acpi_parse_object *op,
329 u32 name); 292 u32 name);
330 293
294#ifdef ACPI_ENABLE_OBJECT_CACHE
295void
296acpi_ps_delete_parse_cache (
297 void);
298#endif
331 299
332/* psdump - display parser tree */
333 300
301/*
302 * psdump - display parser tree
303 */
334u32 304u32
335acpi_ps_sprint_path ( 305acpi_ps_sprint_path (
336 char *buffer_start, 306 char *buffer_start,
diff --git a/include/acpi/acpi.h b/include/acpi/acpi.h
index ad53252dd42..a69d7894204 100644
--- a/include/acpi/acpi.h
+++ b/include/acpi/acpi.h
@@ -49,6 +49,7 @@
49 * We put them here because we don't want to duplicate them 49 * We put them here because we don't want to duplicate them
50 * in the rest of the source code again and again. 50 * in the rest of the source code again and again.
51 */ 51 */
52#include "acnames.h" /* Global ACPI names and strings */
52#include "acconfig.h" /* Configuration constants */ 53#include "acconfig.h" /* Configuration constants */
53#include "platform/acenv.h" /* Target environment specific items */ 54#include "platform/acenv.h" /* Target environment specific items */
54#include "actypes.h" /* Fundamental common data types */ 55#include "actypes.h" /* Fundamental common data types */
diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h
index 9ad142476f3..8d0e1290bc7 100644
--- a/include/acpi/acpi_bus.h
+++ b/include/acpi/acpi_bus.h
@@ -351,6 +351,27 @@ int acpi_match_ids (struct acpi_device *device, char *ids);
351int acpi_create_dir(struct acpi_device *); 351int acpi_create_dir(struct acpi_device *);
352void acpi_remove_dir(struct acpi_device *); 352void acpi_remove_dir(struct acpi_device *);
353 353
354
355/*
356 * Bind physical devices with ACPI devices
357 */
358#include <linux/device.h>
359struct acpi_bus_type {
360 struct list_head list;
361 struct bus_type *bus;
362 /* For general devices under the bus*/
363 int (*find_device)(struct device *, acpi_handle*);
364 /* For bridges, such as PCI root bridge, IDE controller */
365 int (*find_bridge)(struct device *, acpi_handle *);
366};
367int register_acpi_bus_type(struct acpi_bus_type *);
368int unregister_acpi_bus_type(struct acpi_bus_type *);
369struct device *acpi_get_physical_device(acpi_handle);
370/* helper */
371acpi_handle acpi_get_child(acpi_handle, acpi_integer);
372acpi_handle acpi_get_pci_rootbridge_handle(unsigned int, unsigned int);
373#define DEVICE_ACPI_HANDLE(dev) ((acpi_handle)((dev)->firmware_data))
374
354#endif /*CONFIG_ACPI_BUS*/ 375#endif /*CONFIG_ACPI_BUS*/
355 376
356#endif /*__ACPI_BUS_H__*/ 377#endif /*__ACPI_BUS_H__*/
diff --git a/include/acpi/acpi_drivers.h b/include/acpi/acpi_drivers.h
index 4ec722d7338..caeaa71a566 100644
--- a/include/acpi/acpi_drivers.h
+++ b/include/acpi/acpi_drivers.h
@@ -109,5 +109,10 @@ int acpi_ec_ecdt_probe (void);
109 109
110int acpi_processor_set_thermal_limit(acpi_handle handle, int type); 110int acpi_processor_set_thermal_limit(acpi_handle handle, int type);
111 111
112/* --------------------------------------------------------------------------
113 Hot Keys
114 -------------------------------------------------------------------------- */
115
116extern int acpi_specific_hotkey_enabled;
112 117
113#endif /*__ACPI_DRIVERS_H__*/ 118#endif /*__ACPI_DRIVERS_H__*/
diff --git a/include/acpi/acpiosxf.h b/include/acpi/acpiosxf.h
index 857c8072eb1..ea489f23521 100644
--- a/include/acpi/acpiosxf.h
+++ b/include/acpi/acpiosxf.h
@@ -79,7 +79,6 @@ struct acpi_signal_fatal_info
79/* 79/*
80 * OSL Initialization and shutdown primitives 80 * OSL Initialization and shutdown primitives
81 */ 81 */
82
83acpi_status 82acpi_status
84acpi_os_initialize ( 83acpi_os_initialize (
85 void); 84 void);
@@ -92,7 +91,6 @@ acpi_os_terminate (
92/* 91/*
93 * ACPI Table interfaces 92 * ACPI Table interfaces
94 */ 93 */
95
96acpi_status 94acpi_status
97acpi_os_get_root_pointer ( 95acpi_os_get_root_pointer (
98 u32 flags, 96 u32 flags,
@@ -112,7 +110,6 @@ acpi_os_table_override (
112/* 110/*
113 * Synchronization primitives 111 * Synchronization primitives
114 */ 112 */
115
116acpi_status 113acpi_status
117acpi_os_create_semaphore ( 114acpi_os_create_semaphore (
118 u32 max_units, 115 u32 max_units,
@@ -156,7 +153,6 @@ acpi_os_release_lock (
156/* 153/*
157 * Memory allocation and mapping 154 * Memory allocation and mapping
158 */ 155 */
159
160void * 156void *
161acpi_os_allocate ( 157acpi_os_allocate (
162 acpi_size size); 158 acpi_size size);
@@ -187,7 +183,6 @@ acpi_os_get_physical_address (
187/* 183/*
188 * Interrupt handlers 184 * Interrupt handlers
189 */ 185 */
190
191acpi_status 186acpi_status
192acpi_os_install_interrupt_handler ( 187acpi_os_install_interrupt_handler (
193 u32 gsi, 188 u32 gsi,
@@ -203,7 +198,6 @@ acpi_os_remove_interrupt_handler (
203/* 198/*
204 * Threads and Scheduling 199 * Threads and Scheduling
205 */ 200 */
206
207u32 201u32
208acpi_os_get_thread_id ( 202acpi_os_get_thread_id (
209 void); 203 void);
@@ -234,7 +228,6 @@ acpi_os_stall (
234/* 228/*
235 * Platform and hardware-independent I/O interfaces 229 * Platform and hardware-independent I/O interfaces
236 */ 230 */
237
238acpi_status 231acpi_status
239acpi_os_read_port ( 232acpi_os_read_port (
240 acpi_io_address address, 233 acpi_io_address address,
@@ -251,7 +244,6 @@ acpi_os_write_port (
251/* 244/*
252 * Platform and hardware-independent physical memory interfaces 245 * Platform and hardware-independent physical memory interfaces
253 */ 246 */
254
255acpi_status 247acpi_status
256acpi_os_read_memory ( 248acpi_os_read_memory (
257 acpi_physical_address address, 249 acpi_physical_address address,
@@ -270,7 +262,6 @@ acpi_os_write_memory (
270 * Note: Can't use "Register" as a parameter, changed to "Reg" -- 262 * Note: Can't use "Register" as a parameter, changed to "Reg" --
271 * certain compilers complain. 263 * certain compilers complain.
272 */ 264 */
273
274acpi_status 265acpi_status
275acpi_os_read_pci_configuration ( 266acpi_os_read_pci_configuration (
276 struct acpi_pci_id *pci_id, 267 struct acpi_pci_id *pci_id,
@@ -288,7 +279,6 @@ acpi_os_write_pci_configuration (
288/* 279/*
289 * Interim function needed for PCI IRQ routing 280 * Interim function needed for PCI IRQ routing
290 */ 281 */
291
292void 282void
293acpi_os_derive_pci_id( 283acpi_os_derive_pci_id(
294 acpi_handle rhandle, 284 acpi_handle rhandle,
@@ -298,7 +288,6 @@ acpi_os_derive_pci_id(
298/* 288/*
299 * Miscellaneous 289 * Miscellaneous
300 */ 290 */
301
302u8 291u8
303acpi_os_readable ( 292acpi_os_readable (
304 void *pointer, 293 void *pointer,
@@ -323,7 +312,6 @@ acpi_os_signal (
323/* 312/*
324 * Debug print routines 313 * Debug print routines
325 */ 314 */
326
327void ACPI_INTERNAL_VAR_XFACE 315void ACPI_INTERNAL_VAR_XFACE
328acpi_os_printf ( 316acpi_os_printf (
329 const char *format, 317 const char *format,
@@ -339,11 +327,10 @@ acpi_os_redirect_output (
339 void *destination); 327 void *destination);
340 328
341 329
330#ifdef ACPI_FUTURE_USAGE
342/* 331/*
343 * Debug input 332 * Debug input
344 */ 333 */
345
346#ifdef ACPI_FUTURE_USAGE
347u32 334u32
348acpi_os_get_line ( 335acpi_os_get_line (
349 char *buffer); 336 char *buffer);
@@ -353,7 +340,6 @@ acpi_os_get_line (
353/* 340/*
354 * Directory manipulation 341 * Directory manipulation
355 */ 342 */
356
357void * 343void *
358acpi_os_open_directory ( 344acpi_os_open_directory (
359 char *pathname, 345 char *pathname,
@@ -377,7 +363,6 @@ acpi_os_close_directory (
377/* 363/*
378 * Debug 364 * Debug
379 */ 365 */
380
381void 366void
382acpi_os_dbg_assert( 367acpi_os_dbg_assert(
383 void *failed_assertion, 368 void *failed_assertion,
@@ -385,5 +370,4 @@ acpi_os_dbg_assert(
385 u32 line_number, 370 u32 line_number,
386 char *message); 371 char *message);
387 372
388
389#endif /* __ACPIOSXF_H__ */ 373#endif /* __ACPIOSXF_H__ */
diff --git a/include/acpi/acpixf.h b/include/acpi/acpixf.h
index 00d78b79652..f8f619f8e4f 100644
--- a/include/acpi/acpixf.h
+++ b/include/acpi/acpixf.h
@@ -50,10 +50,9 @@
50#include "actbl.h" 50#include "actbl.h"
51 51
52 52
53 /* 53/*
54 * Global interfaces 54 * Global interfaces
55 */ 55 */
56
57acpi_status 56acpi_status
58acpi_initialize_subsystem ( 57acpi_initialize_subsystem (
59 void); 58 void);
@@ -106,9 +105,8 @@ acpi_install_initialization_handler (
106#endif 105#endif
107 106
108/* 107/*
109 * ACPI Memory manager 108 * ACPI Memory managment
110 */ 109 */
111
112void * 110void *
113acpi_allocate ( 111acpi_allocate (
114 u32 size); 112 u32 size);
@@ -125,7 +123,6 @@ acpi_free (
125/* 123/*
126 * ACPI table manipulation interfaces 124 * ACPI table manipulation interfaces
127 */ 125 */
128
129acpi_status 126acpi_status
130acpi_find_root_pointer ( 127acpi_find_root_pointer (
131 u32 flags, 128 u32 flags,
@@ -168,7 +165,6 @@ acpi_get_firmware_table (
168/* 165/*
169 * Namespace and name interfaces 166 * Namespace and name interfaces
170 */ 167 */
171
172acpi_status 168acpi_status
173acpi_walk_namespace ( 169acpi_walk_namespace (
174 acpi_object_type type, 170 acpi_object_type type,
@@ -218,7 +214,6 @@ acpi_get_data (
218/* 214/*
219 * Object manipulation and enumeration 215 * Object manipulation and enumeration
220 */ 216 */
221
222acpi_status 217acpi_status
223acpi_evaluate_object ( 218acpi_evaluate_object (
224 acpi_handle object, 219 acpi_handle object,
@@ -262,7 +257,6 @@ acpi_get_parent (
262/* 257/*
263 * Event handler interfaces 258 * Event handler interfaces
264 */ 259 */
265
266acpi_status 260acpi_status
267acpi_install_fixed_event_handler ( 261acpi_install_fixed_event_handler (
268 u32 acpi_event, 262 u32 acpi_event,
@@ -319,7 +313,6 @@ acpi_install_exception_handler (
319/* 313/*
320 * Event interfaces 314 * Event interfaces
321 */ 315 */
322
323acpi_status 316acpi_status
324acpi_acquire_global_lock ( 317acpi_acquire_global_lock (
325 u16 timeout, 318 u16 timeout,
@@ -404,7 +397,6 @@ acpi_remove_gpe_block (
404/* 397/*
405 * Resource interfaces 398 * Resource interfaces
406 */ 399 */
407
408typedef 400typedef
409acpi_status (*ACPI_WALK_RESOURCE_CALLBACK) ( 401acpi_status (*ACPI_WALK_RESOURCE_CALLBACK) (
410 struct acpi_resource *resource, 402 struct acpi_resource *resource,
@@ -448,7 +440,6 @@ acpi_resource_to_address64 (
448/* 440/*
449 * Hardware (ACPI device) interfaces 441 * Hardware (ACPI device) interfaces
450 */ 442 */
451
452acpi_status 443acpi_status
453acpi_get_register ( 444acpi_get_register (
454 u32 register_id, 445 u32 register_id,
diff --git a/include/acpi/acresrc.h b/include/acpi/acresrc.h
index 93c55ff5c23..ed679264c12 100644
--- a/include/acpi/acresrc.h
+++ b/include/acpi/acresrc.h
@@ -48,7 +48,6 @@
48/* 48/*
49 * Function prototypes called from Acpi* APIs 49 * Function prototypes called from Acpi* APIs
50 */ 50 */
51
52acpi_status 51acpi_status
53acpi_rs_get_prt_method_data ( 52acpi_rs_get_prt_method_data (
54 acpi_handle handle, 53 acpi_handle handle,
@@ -60,12 +59,12 @@ acpi_rs_get_crs_method_data (
60 acpi_handle handle, 59 acpi_handle handle,
61 struct acpi_buffer *ret_buffer); 60 struct acpi_buffer *ret_buffer);
62 61
63#ifdef ACPI_FUTURE_USAGE 62#ifdef ACPI_FUTURE_USAGE
64acpi_status 63acpi_status
65acpi_rs_get_prs_method_data ( 64acpi_rs_get_prs_method_data (
66 acpi_handle handle, 65 acpi_handle handle,
67 struct acpi_buffer *ret_buffer); 66 struct acpi_buffer *ret_buffer);
68#endif 67#endif /* ACPI_FUTURE_USAGE */
69 68
70acpi_status 69acpi_status
71acpi_rs_get_method_data ( 70acpi_rs_get_method_data (
@@ -95,61 +94,9 @@ acpi_rs_create_pci_routing_table (
95 94
96 95
97/* 96/*
98 * Function prototypes called from acpi_rs_create* 97 * rsdump
99 */ 98 */
100#ifdef ACPI_FUTURE_USAGE 99#ifdef ACPI_FUTURE_USAGE
101void
102acpi_rs_dump_irq (
103 union acpi_resource_data *data);
104
105void
106acpi_rs_dump_address16 (
107 union acpi_resource_data *data);
108
109void
110acpi_rs_dump_address32 (
111 union acpi_resource_data *data);
112
113void
114acpi_rs_dump_address64 (
115 union acpi_resource_data *data);
116
117void
118acpi_rs_dump_dma (
119 union acpi_resource_data *data);
120
121void
122acpi_rs_dump_io (
123 union acpi_resource_data *data);
124
125void
126acpi_rs_dump_extended_irq (
127 union acpi_resource_data *data);
128
129void
130acpi_rs_dump_fixed_io (
131 union acpi_resource_data *data);
132
133void
134acpi_rs_dump_fixed_memory32 (
135 union acpi_resource_data *data);
136
137void
138acpi_rs_dump_memory24 (
139 union acpi_resource_data *data);
140
141void
142acpi_rs_dump_memory32 (
143 union acpi_resource_data *data);
144
145void
146acpi_rs_dump_start_depend_fns (
147 union acpi_resource_data *data);
148
149void
150acpi_rs_dump_vendor_specific (
151 union acpi_resource_data *data);
152
153void 100void
154acpi_rs_dump_resource_list ( 101acpi_rs_dump_resource_list (
155 struct acpi_resource *resource); 102 struct acpi_resource *resource);
@@ -157,8 +104,12 @@ acpi_rs_dump_resource_list (
157void 104void
158acpi_rs_dump_irq_list ( 105acpi_rs_dump_irq_list (
159 u8 *route_table); 106 u8 *route_table);
160#endif /* ACPI_FUTURE_USAGE */ 107#endif /* ACPI_FUTURE_USAGE */
161 108
109
110/*
111 * rscalc
112 */
162acpi_status 113acpi_status
163acpi_rs_get_byte_stream_start ( 114acpi_rs_get_byte_stream_start (
164 u8 *byte_stream_buffer, 115 u8 *byte_stream_buffer,
diff --git a/include/acpi/acstruct.h b/include/acpi/acstruct.h
index c97843f6bcb..e6b9e36a2ed 100644
--- a/include/acpi/acstruct.h
+++ b/include/acpi/acstruct.h
@@ -56,7 +56,6 @@
56 * Walk state - current state of a parse tree walk. Used for both a leisurely stroll through 56 * Walk state - current state of a parse tree walk. Used for both a leisurely stroll through
57 * the tree (for whatever reason), and for control method execution. 57 * the tree (for whatever reason), and for control method execution.
58 */ 58 */
59
60#define ACPI_NEXT_OP_DOWNWARD 1 59#define ACPI_NEXT_OP_DOWNWARD 1
61#define ACPI_NEXT_OP_UPWARD 2 60#define ACPI_NEXT_OP_UPWARD 2
62 61
diff --git a/include/acpi/actables.h b/include/acpi/actables.h
index e8f5d4ffd45..39df92e21a0 100644
--- a/include/acpi/actables.h
+++ b/include/acpi/actables.h
@@ -50,17 +50,9 @@
50#define SIZE_IN_HEADER 0 50#define SIZE_IN_HEADER 0
51 51
52 52
53#ifdef ACPI_FUTURE_USAGE
54acpi_status
55acpi_tb_handle_to_object (
56 u16 table_id,
57 struct acpi_table_desc **table_desc);
58#endif
59
60/* 53/*
61 * tbconvrt - Table conversion routines 54 * tbconvrt - Table conversion routines
62 */ 55 */
63
64acpi_status 56acpi_status
65acpi_tb_convert_to_xsdt ( 57acpi_tb_convert_to_xsdt (
66 struct acpi_table_desc *table_info); 58 struct acpi_table_desc *table_info);
@@ -78,10 +70,10 @@ acpi_tb_get_table_count (
78 struct rsdp_descriptor *RSDP, 70 struct rsdp_descriptor *RSDP,
79 struct acpi_table_header *RSDT); 71 struct acpi_table_header *RSDT);
80 72
73
81/* 74/*
82 * tbget - Table "get" routines 75 * tbget - Table "get" routines
83 */ 76 */
84
85acpi_status 77acpi_status
86acpi_tb_get_table ( 78acpi_tb_get_table (
87 struct acpi_pointer *address, 79 struct acpi_pointer *address,
@@ -99,17 +91,6 @@ acpi_tb_get_table_body (
99 struct acpi_table_desc *table_info); 91 struct acpi_table_desc *table_info);
100 92
101acpi_status 93acpi_status
102acpi_tb_get_this_table (
103 struct acpi_pointer *address,
104 struct acpi_table_header *header,
105 struct acpi_table_desc *table_info);
106
107acpi_status
108acpi_tb_table_override (
109 struct acpi_table_header *header,
110 struct acpi_table_desc *table_info);
111
112acpi_status
113acpi_tb_get_table_ptr ( 94acpi_tb_get_table_ptr (
114 acpi_table_type table_type, 95 acpi_table_type table_type,
115 u32 instance, 96 u32 instance,
@@ -127,36 +108,23 @@ acpi_status
127acpi_tb_validate_rsdt ( 108acpi_tb_validate_rsdt (
128 struct acpi_table_header *table_ptr); 109 struct acpi_table_header *table_ptr);
129 110
111
112/*
113 * tbgetall - get multiple required tables
114 */
130acpi_status 115acpi_status
131acpi_tb_get_required_tables ( 116acpi_tb_get_required_tables (
132 void); 117 void);
133 118
134acpi_status
135acpi_tb_get_primary_table (
136 struct acpi_pointer *address,
137 struct acpi_table_desc *table_info);
138
139acpi_status
140acpi_tb_get_secondary_table (
141 struct acpi_pointer *address,
142 acpi_string signature,
143 struct acpi_table_desc *table_info);
144 119
145/* 120/*
146 * tbinstall - Table installation 121 * tbinstall - Table installation
147 */ 122 */
148
149acpi_status 123acpi_status
150acpi_tb_install_table ( 124acpi_tb_install_table (
151 struct acpi_table_desc *table_info); 125 struct acpi_table_desc *table_info);
152 126
153acpi_status 127acpi_status
154acpi_tb_match_signature (
155 char *signature,
156 struct acpi_table_desc *table_info,
157 u8 search_type);
158
159acpi_status
160acpi_tb_recognize_table ( 128acpi_tb_recognize_table (
161 struct acpi_table_desc *table_info, 129 struct acpi_table_desc *table_info,
162 u8 search_type); 130 u8 search_type);
@@ -170,7 +138,6 @@ acpi_tb_init_table_descriptor (
170/* 138/*
171 * tbremove - Table removal and deletion 139 * tbremove - Table removal and deletion
172 */ 140 */
173
174void 141void
175acpi_tb_delete_all_tables ( 142acpi_tb_delete_all_tables (
176 void); 143 void);
@@ -189,35 +156,23 @@ acpi_tb_uninstall_table (
189 156
190 157
191/* 158/*
192 * tbrsd - RSDP, RSDT utilities 159 * tbxfroot - RSDP, RSDT utilities
193 */ 160 */
161acpi_status
162acpi_tb_find_table (
163 char *signature,
164 char *oem_id,
165 char *oem_table_id,
166 struct acpi_table_header **table_ptr);
194 167
195acpi_status 168acpi_status
196acpi_tb_get_table_rsdt ( 169acpi_tb_get_table_rsdt (
197 void); 170 void);
198 171
199u8 *
200acpi_tb_scan_memory_for_rsdp (
201 u8 *start_address,
202 u32 length);
203
204acpi_status
205acpi_tb_find_rsdp (
206 struct acpi_table_desc *table_info,
207 u32 flags);
208
209 172
210/* 173/*
211 * tbutils - common table utilities 174 * tbutils - common table utilities
212 */ 175 */
213
214acpi_status
215acpi_tb_find_table (
216 char *signature,
217 char *oem_id,
218 char *oem_table_id,
219 struct acpi_table_header **table_ptr);
220
221acpi_status 176acpi_status
222acpi_tb_verify_table_checksum ( 177acpi_tb_verify_table_checksum (
223 struct acpi_table_header *table_header); 178 struct acpi_table_header *table_header);
@@ -231,5 +186,4 @@ acpi_status
231acpi_tb_validate_table_header ( 186acpi_tb_validate_table_header (
232 struct acpi_table_header *table_header); 187 struct acpi_table_header *table_header);
233 188
234
235#endif /* __ACTABLES_H__ */ 189#endif /* __ACTABLES_H__ */
diff --git a/include/acpi/actbl.h b/include/acpi/actbl.h
index 7eee731112b..b5cdcca444c 100644
--- a/include/acpi/actbl.h
+++ b/include/acpi/actbl.h
@@ -133,7 +133,6 @@ struct acpi_table_header /* ACPI common table header */
133#define DUAL_PIC 0 133#define DUAL_PIC 0
134#define MULTIPLE_APIC 1 134#define MULTIPLE_APIC 1
135 135
136
137/* Master MADT */ 136/* Master MADT */
138 137
139struct multiple_apic_table 138struct multiple_apic_table
@@ -144,7 +143,6 @@ struct multiple_apic_table
144 u32 reserved1 : 31; 143 u32 reserved1 : 31;
145}; 144};
146 145
147
148/* Values for Type in APIC_HEADER_DEF */ 146/* Values for Type in APIC_HEADER_DEF */
149 147
150#define APIC_PROCESSOR 0 148#define APIC_PROCESSOR 0
diff --git a/include/acpi/actypes.h b/include/acpi/actypes.h
index 7acb550af3e..3a451dc48ac 100644
--- a/include/acpi/actypes.h
+++ b/include/acpi/actypes.h
@@ -478,7 +478,6 @@ typedef u32 acpi_object_type;
478#define ACPI_TYPE_INVALID 0x1E 478#define ACPI_TYPE_INVALID 0x1E
479#define ACPI_TYPE_NOT_FOUND 0xFF 479#define ACPI_TYPE_NOT_FOUND 0xFF
480 480
481
482/* 481/*
483 * Bitmapped ACPI types. Used internally only 482 * Bitmapped ACPI types. Used internally only
484 */ 483 */
@@ -803,7 +802,6 @@ struct acpi_system_info
803/* 802/*
804 * Types specific to the OS service interfaces 803 * Types specific to the OS service interfaces
805 */ 804 */
806
807typedef u32 805typedef u32
808(ACPI_SYSTEM_XFACE *acpi_osd_handler) ( 806(ACPI_SYSTEM_XFACE *acpi_osd_handler) (
809 void *context); 807 void *context);
diff --git a/include/acpi/acutils.h b/include/acpi/acutils.h
index 0de26b8f102..192d0bea388 100644
--- a/include/acpi/acutils.h
+++ b/include/acpi/acutils.h
@@ -52,13 +52,6 @@ acpi_status (*acpi_pkg_callback) (
52 union acpi_generic_state *state, 52 union acpi_generic_state *state,
53 void *context); 53 void *context);
54 54
55acpi_status
56acpi_ut_walk_package_tree (
57 union acpi_operand_object *source_object,
58 void *target_object,
59 acpi_pkg_callback walk_callback,
60 void *context);
61
62struct acpi_pkg_info 55struct acpi_pkg_info
63{ 56{
64 u8 *free_space; 57 u8 *free_space;
@@ -79,37 +72,13 @@ struct acpi_pkg_info
79#define DB_QWORD_DISPLAY 8 72#define DB_QWORD_DISPLAY 8
80 73
81 74
82/* Global initialization interfaces */
83
84void
85acpi_ut_init_globals (
86 void);
87
88void
89acpi_ut_terminate (
90 void);
91
92
93/* 75/*
94 * ut_init - miscellaneous initialization and shutdown 76 * utglobal - Global data structures and procedures
95 */ 77 */
96
97acpi_status
98acpi_ut_hardware_initialize (
99 void);
100
101void 78void
102acpi_ut_subsystem_shutdown ( 79acpi_ut_init_globals (
103 void);
104
105acpi_status
106acpi_ut_validate_fadt (
107 void); 80 void);
108 81
109/*
110 * ut_global - Global data structures and procedures
111 */
112
113#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) 82#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
114 83
115char * 84char *
@@ -157,9 +126,24 @@ acpi_ut_allocate_owner_id (
157 126
158 127
159/* 128/*
160 * ut_clib - Local implementations of C library functions 129 * utinit - miscellaneous initialization and shutdown
161 */ 130 */
131acpi_status
132acpi_ut_hardware_initialize (
133 void);
162 134
135void
136acpi_ut_subsystem_shutdown (
137 void);
138
139acpi_status
140acpi_ut_validate_fadt (
141 void);
142
143
144/*
145 * utclib - Local implementations of C library functions
146 */
163#ifndef ACPI_USE_SYSTEM_CLIBRARY 147#ifndef ACPI_USE_SYSTEM_CLIBRARY
164 148
165acpi_size 149acpi_size
@@ -260,10 +244,10 @@ extern const u8 _acpi_ctype[];
260 244
261#endif /* ACPI_USE_SYSTEM_CLIBRARY */ 245#endif /* ACPI_USE_SYSTEM_CLIBRARY */
262 246
247
263/* 248/*
264 * ut_copy - Object construction and conversion interfaces 249 * utcopy - Object construction and conversion interfaces
265 */ 250 */
266
267acpi_status 251acpi_status
268acpi_ut_build_simple_object( 252acpi_ut_build_simple_object(
269 union acpi_operand_object *obj, 253 union acpi_operand_object *obj,
@@ -278,30 +262,11 @@ acpi_ut_build_package_object (
278 u32 *space_used); 262 u32 *space_used);
279 263
280acpi_status 264acpi_status
281acpi_ut_copy_ielement_to_eelement (
282 u8 object_type,
283 union acpi_operand_object *source_object,
284 union acpi_generic_state *state,
285 void *context);
286
287acpi_status
288acpi_ut_copy_ielement_to_ielement (
289 u8 object_type,
290 union acpi_operand_object *source_object,
291 union acpi_generic_state *state,
292 void *context);
293
294acpi_status
295acpi_ut_copy_iobject_to_eobject ( 265acpi_ut_copy_iobject_to_eobject (
296 union acpi_operand_object *obj, 266 union acpi_operand_object *obj,
297 struct acpi_buffer *ret_buffer); 267 struct acpi_buffer *ret_buffer);
298 268
299acpi_status 269acpi_status
300acpi_ut_copy_esimple_to_isimple(
301 union acpi_object *user_obj,
302 union acpi_operand_object **return_obj);
303
304acpi_status
305acpi_ut_copy_eobject_to_iobject ( 270acpi_ut_copy_eobject_to_iobject (
306 union acpi_object *obj, 271 union acpi_object *obj,
307 union acpi_operand_object **internal_obj); 272 union acpi_operand_object **internal_obj);
@@ -312,17 +277,6 @@ acpi_ut_copy_isimple_to_isimple (
312 union acpi_operand_object *dest_obj); 277 union acpi_operand_object *dest_obj);
313 278
314acpi_status 279acpi_status
315acpi_ut_copy_ipackage_to_ipackage (
316 union acpi_operand_object *source_obj,
317 union acpi_operand_object *dest_obj,
318 struct acpi_walk_state *walk_state);
319
320acpi_status
321acpi_ut_copy_simple_object (
322 union acpi_operand_object *source_desc,
323 union acpi_operand_object *dest_desc);
324
325acpi_status
326acpi_ut_copy_iobject_to_iobject ( 280acpi_ut_copy_iobject_to_iobject (
327 union acpi_operand_object *source_desc, 281 union acpi_operand_object *source_desc,
328 union acpi_operand_object **dest_desc, 282 union acpi_operand_object **dest_desc,
@@ -330,9 +284,8 @@ acpi_ut_copy_iobject_to_iobject (
330 284
331 285
332/* 286/*
333 * ut_create - Object creation 287 * utcreate - Object creation
334 */ 288 */
335
336acpi_status 289acpi_status
337acpi_ut_update_object_reference ( 290acpi_ut_update_object_reference (
338 union acpi_operand_object *object, 291 union acpi_operand_object *object,
@@ -340,9 +293,8 @@ acpi_ut_update_object_reference (
340 293
341 294
342/* 295/*
343 * ut_debug - Debug interfaces 296 * utdebug - Debug interfaces
344 */ 297 */
345
346void 298void
347acpi_ut_init_stack_ptr_trace ( 299acpi_ut_init_stack_ptr_trace (
348 void); 300 void);
@@ -440,11 +392,14 @@ acpi_ut_debug_print_raw (
440 392
441 393
442/* 394/*
443 * ut_delete - Object deletion 395 * utdelete - Object deletion and reference counts
444 */ 396 */
397void
398acpi_ut_add_reference (
399 union acpi_operand_object *object);
445 400
446void 401void
447acpi_ut_delete_internal_obj ( 402acpi_ut_remove_reference (
448 union acpi_operand_object *object); 403 union acpi_operand_object *object);
449 404
450void 405void
@@ -461,25 +416,8 @@ acpi_ut_delete_internal_object_list (
461 416
462 417
463/* 418/*
464 * ut_eval - object evaluation 419 * uteval - object evaluation
465 */ 420 */
466
467/* Method name strings */
468
469#define METHOD_NAME__HID "_HID"
470#define METHOD_NAME__CID "_CID"
471#define METHOD_NAME__UID "_UID"
472#define METHOD_NAME__ADR "_ADR"
473#define METHOD_NAME__STA "_STA"
474#define METHOD_NAME__REG "_REG"
475#define METHOD_NAME__SEG "_SEG"
476#define METHOD_NAME__BBN "_BBN"
477#define METHOD_NAME__PRT "_PRT"
478#define METHOD_NAME__CRS "_CRS"
479#define METHOD_NAME__PRS "_PRS"
480#define METHOD_NAME__PRW "_PRW"
481
482
483acpi_status 421acpi_status
484acpi_ut_osi_implementation ( 422acpi_ut_osi_implementation (
485 struct acpi_walk_state *walk_state); 423 struct acpi_walk_state *walk_state);
@@ -522,39 +460,10 @@ acpi_ut_execute_sxds (
522 struct acpi_namespace_node *device_node, 460 struct acpi_namespace_node *device_node,
523 u8 *highest); 461 u8 *highest);
524 462
525/*
526 * ut_mutex - mutual exclusion interfaces
527 */
528
529acpi_status
530acpi_ut_mutex_initialize (
531 void);
532
533void
534acpi_ut_mutex_terminate (
535 void);
536
537acpi_status
538acpi_ut_create_mutex (
539 acpi_mutex_handle mutex_id);
540
541acpi_status
542acpi_ut_delete_mutex (
543 acpi_mutex_handle mutex_id);
544
545acpi_status
546acpi_ut_acquire_mutex (
547 acpi_mutex_handle mutex_id);
548
549acpi_status
550acpi_ut_release_mutex (
551 acpi_mutex_handle mutex_id);
552
553 463
554/* 464/*
555 * ut_object - internal object create/delete/cache routines 465 * utobject - internal object create/delete/cache routines
556 */ 466 */
557
558union acpi_operand_object * 467union acpi_operand_object *
559acpi_ut_create_internal_object_dbg ( 468acpi_ut_create_internal_object_dbg (
560 char *module_name, 469 char *module_name,
@@ -587,50 +496,15 @@ union acpi_operand_object *
587acpi_ut_create_string_object ( 496acpi_ut_create_string_object (
588 acpi_size string_size); 497 acpi_size string_size);
589 498
590
591/*
592 * ut_ref_cnt - Object reference count management
593 */
594
595void
596acpi_ut_add_reference (
597 union acpi_operand_object *object);
598
599void
600acpi_ut_remove_reference (
601 union acpi_operand_object *object);
602
603/*
604 * ut_size - Object size routines
605 */
606
607acpi_status
608acpi_ut_get_simple_object_size (
609 union acpi_operand_object *obj,
610 acpi_size *obj_length);
611
612acpi_status
613acpi_ut_get_package_object_size (
614 union acpi_operand_object *obj,
615 acpi_size *obj_length);
616
617acpi_status 499acpi_status
618acpi_ut_get_object_size( 500acpi_ut_get_object_size(
619 union acpi_operand_object *obj, 501 union acpi_operand_object *obj,
620 acpi_size *obj_length); 502 acpi_size *obj_length);
621 503
622acpi_status
623acpi_ut_get_element_length (
624 u8 object_type,
625 union acpi_operand_object *source_object,
626 union acpi_generic_state *state,
627 void *context);
628
629 504
630/* 505/*
631 * ut_state - Generic state creation/cache routines 506 * utstate - Generic state creation/cache routines
632 */ 507 */
633
634void 508void
635acpi_ut_push_generic_state ( 509acpi_ut_push_generic_state (
636 union acpi_generic_state **list_head, 510 union acpi_generic_state **list_head,
@@ -666,14 +540,14 @@ acpi_ut_create_update_state_and_push (
666 u16 action, 540 u16 action,
667 union acpi_generic_state **state_list); 541 union acpi_generic_state **state_list);
668 542
669#ifdef ACPI_FUTURE_USAGE 543#ifdef ACPI_FUTURE_USAGE
670acpi_status 544acpi_status
671acpi_ut_create_pkg_state_and_push ( 545acpi_ut_create_pkg_state_and_push (
672 void *internal_object, 546 void *internal_object,
673 void *external_object, 547 void *external_object,
674 u16 index, 548 u16 index,
675 union acpi_generic_state **state_list); 549 union acpi_generic_state **state_list);
676#endif 550#endif /* ACPI_FUTURE_USAGE */
677 551
678union acpi_generic_state * 552union acpi_generic_state *
679acpi_ut_create_control_state ( 553acpi_ut_create_control_state (
@@ -693,15 +567,10 @@ acpi_ut_delete_object_cache (
693 void); 567 void);
694#endif 568#endif
695 569
570
696/* 571/*
697 * utmisc 572 * utmath
698 */ 573 */
699
700void
701acpi_ut_print_string (
702 char *string,
703 u8 max_length);
704
705acpi_status 574acpi_status
706acpi_ut_divide ( 575acpi_ut_divide (
707 acpi_integer in_dividend, 576 acpi_integer in_dividend,
@@ -716,6 +585,25 @@ acpi_ut_short_divide (
716 acpi_integer *out_quotient, 585 acpi_integer *out_quotient,
717 u32 *out_remainder); 586 u32 *out_remainder);
718 587
588/*
589 * utmisc
590 */
591acpi_status
592acpi_ut_walk_package_tree (
593 union acpi_operand_object *source_object,
594 void *target_object,
595 acpi_pkg_callback walk_callback,
596 void *context);
597
598char *
599acpi_ut_strupr (
600 char *src_string);
601
602void
603acpi_ut_print_string (
604 char *string,
605 u8 max_length);
606
719u8 607u8
720acpi_ut_valid_acpi_name ( 608acpi_ut_valid_acpi_name (
721 u32 name); 609 u32 name);
@@ -734,11 +622,21 @@ acpi_ut_strtoul64 (
734 622
735#define ACPI_ANY_BASE 0 623#define ACPI_ANY_BASE 0
736 624
737#ifdef ACPI_FUTURE_USAGE 625acpi_status
738char * 626acpi_ut_mutex_initialize (
739acpi_ut_strupr ( 627 void);
740 char *src_string); 628
741#endif 629void
630acpi_ut_mutex_terminate (
631 void);
632
633acpi_status
634acpi_ut_acquire_mutex (
635 acpi_mutex_handle mutex_id);
636
637acpi_status
638acpi_ut_release_mutex (
639 acpi_mutex_handle mutex_id);
742 640
743u8 * 641u8 *
744acpi_ut_get_resource_end_tag ( 642acpi_ut_get_resource_end_tag (
@@ -768,9 +666,8 @@ acpi_ut_display_init_pathname (
768 666
769 667
770/* 668/*
771 * Utalloc - memory allocation and object caching 669 * utalloc - memory allocation and object caching
772 */ 670 */
773
774void * 671void *
775acpi_ut_acquire_from_cache ( 672acpi_ut_acquire_from_cache (
776 u32 list_id); 673 u32 list_id);
@@ -795,9 +692,6 @@ acpi_ut_initialize_buffer (
795 struct acpi_buffer *buffer, 692 struct acpi_buffer *buffer,
796 acpi_size required_length); 693 acpi_size required_length);
797 694
798
799/* Memory allocation functions */
800
801void * 695void *
802acpi_ut_allocate ( 696acpi_ut_allocate (
803 acpi_size size, 697 acpi_size size,
@@ -812,9 +706,7 @@ acpi_ut_callocate (
812 char *module, 706 char *module,
813 u32 line); 707 u32 line);
814 708
815
816#ifdef ACPI_DBG_TRACK_ALLOCATIONS 709#ifdef ACPI_DBG_TRACK_ALLOCATIONS
817
818void * 710void *
819acpi_ut_allocate_and_track ( 711acpi_ut_allocate_and_track (
820 acpi_size size, 712 acpi_size size,
@@ -836,34 +728,11 @@ acpi_ut_free_and_track (
836 char *module, 728 char *module,
837 u32 line); 729 u32 line);
838 730
839struct acpi_debug_mem_block * 731#ifdef ACPI_FUTURE_USAGE
840acpi_ut_find_allocation (
841 u32 list_id,
842 void *allocation);
843
844acpi_status
845acpi_ut_track_allocation (
846 u32 list_id,
847 struct acpi_debug_mem_block *address,
848 acpi_size size,
849 u8 alloc_type,
850 u32 component,
851 char *module,
852 u32 line);
853
854acpi_status
855acpi_ut_remove_allocation (
856 u32 list_id,
857 struct acpi_debug_mem_block *address,
858 u32 component,
859 char *module,
860 u32 line);
861
862#ifdef ACPI_FUTURE_USAGE
863void 732void
864acpi_ut_dump_allocation_info ( 733acpi_ut_dump_allocation_info (
865 void); 734 void);
866#endif 735#endif /* ACPI_FUTURE_USAGE */
867 736
868void 737void
869acpi_ut_dump_allocations ( 738acpi_ut_dump_allocations (
@@ -871,5 +740,4 @@ acpi_ut_dump_allocations (
871 char *module); 740 char *module);
872#endif 741#endif
873 742
874
875#endif /* _ACUTILS_H */ 743#endif /* _ACUTILS_H */
diff --git a/include/acpi/amlcode.h b/include/acpi/amlcode.h
index 2ec538eac58..55e97ed2919 100644
--- a/include/acpi/amlcode.h
+++ b/include/acpi/amlcode.h
@@ -146,8 +146,7 @@
146 146
147/* prefixed opcodes */ 147/* prefixed opcodes */
148 148
149#define AML_EXTOP (u16) 0x005b 149#define AML_EXTOP (u16) 0x005b /* prefix for 2-byte opcodes */
150
151 150
152#define AML_MUTEX_OP (u16) 0x5b01 151#define AML_MUTEX_OP (u16) 0x5b01
153#define AML_EVENT_OP (u16) 0x5b02 152#define AML_EVENT_OP (u16) 0x5b02
@@ -194,7 +193,6 @@
194 * Use only "Unknown" AML opcodes, don't attempt to use 193 * Use only "Unknown" AML opcodes, don't attempt to use
195 * any valid ACPI ASCII values (A-Z, 0-9, '-') 194 * any valid ACPI ASCII values (A-Z, 0-9, '-')
196 */ 195 */
197
198#define AML_INT_NAMEPATH_OP (u16) 0x002d 196#define AML_INT_NAMEPATH_OP (u16) 0x002d
199#define AML_INT_NAMEDFIELD_OP (u16) 0x0030 197#define AML_INT_NAMEDFIELD_OP (u16) 0x0030
200#define AML_INT_RESERVEDFIELD_OP (u16) 0x0031 198#define AML_INT_RESERVEDFIELD_OP (u16) 0x0031
@@ -214,7 +212,6 @@
214 * There can be up to 31 unique argument types 212 * There can be up to 31 unique argument types
215 * Zero is reserved as end-of-list indicator 213 * Zero is reserved as end-of-list indicator
216 */ 214 */
217
218#define ARGP_BYTEDATA 0x01 215#define ARGP_BYTEDATA 0x01
219#define ARGP_BYTELIST 0x02 216#define ARGP_BYTELIST 0x02
220#define ARGP_CHARLIST 0x03 217#define ARGP_CHARLIST 0x03
@@ -295,7 +292,6 @@
295/* 292/*
296 * opcode groups and types 293 * opcode groups and types
297 */ 294 */
298
299#define OPGRP_NAMED 0x01 295#define OPGRP_NAMED 0x01
300#define OPGRP_FIELD 0x02 296#define OPGRP_FIELD 0x02
301#define OPGRP_BYTELIST 0x04 297#define OPGRP_BYTELIST 0x04
@@ -381,6 +377,12 @@
381#define AML_TYPE_UNDEFINED 0x19 377#define AML_TYPE_UNDEFINED 0x19
382#define AML_TYPE_BOGUS 0x1A 378#define AML_TYPE_BOGUS 0x1A
383 379
380/* AML Package Length encodings */
381
382#define ACPI_AML_PACKAGE_TYPE1 0x40
383#define ACPI_AML_PACKAGE_TYPE2 0x4000
384#define ACPI_AML_PACKAGE_TYPE3 0x400000
385#define ACPI_AML_PACKAGE_TYPE4 0x40000000
384 386
385/* 387/*
386 * Opcode classes 388 * Opcode classes
diff --git a/include/acpi/pdc_intel.h b/include/acpi/pdc_intel.h
new file mode 100644
index 00000000000..fd6730e4e56
--- /dev/null
+++ b/include/acpi/pdc_intel.h
@@ -0,0 +1,29 @@
1
2/* _PDC bit definition for Intel processors */
3
4#ifndef __PDC_INTEL_H__
5#define __PDC_INTEL_H__
6
7#define ACPI_PDC_P_FFH (0x0001)
8#define ACPI_PDC_C_C1_HALT (0x0002)
9#define ACPI_PDC_T_FFH (0x0004)
10#define ACPI_PDC_SMP_C1PT (0x0008)
11#define ACPI_PDC_SMP_C2C3 (0x0010)
12#define ACPI_PDC_SMP_P_SWCOORD (0x0020)
13#define ACPI_PDC_SMP_C_SWCOORD (0x0040)
14#define ACPI_PDC_SMP_T_SWCOORD (0x0080)
15#define ACPI_PDC_C_C1_FFH (0x0100)
16
17
18#define ACPI_PDC_EST_CAPABILITY_SMP (ACPI_PDC_SMP_C1PT | \
19 ACPI_PDC_C_C1_HALT)
20
21#define ACPI_PDC_EST_CAPABILITY_SMP_MSR (ACPI_PDC_EST_CAPABILITY_SMP | \
22 ACPI_PDC_P_FFH)
23
24#define ACPI_PDC_C_CAPABILITY_SMP (ACPI_PDC_SMP_C2C3 | \
25 ACPI_PDC_SMP_C1PT | \
26 ACPI_PDC_C_C1_HALT)
27
28#endif /* __PDC_INTEL_H__ */
29
diff --git a/include/acpi/platform/acenv.h b/include/acpi/platform/acenv.h
index 57bf9362335..adf969efa51 100644
--- a/include/acpi/platform/acenv.h
+++ b/include/acpi/platform/acenv.h
@@ -198,6 +198,7 @@
198#endif 198#endif
199#endif /* !DEBUGGER_THREADING */ 199#endif /* !DEBUGGER_THREADING */
200 200
201
201/****************************************************************************** 202/******************************************************************************
202 * 203 *
203 * C library configuration 204 * C library configuration
@@ -209,7 +210,6 @@
209 * Use the standard C library headers. 210 * Use the standard C library headers.
210 * We want to keep these to a minimum. 211 * We want to keep these to a minimum.
211 */ 212 */
212
213#ifdef ACPI_USE_STANDARD_HEADERS 213#ifdef ACPI_USE_STANDARD_HEADERS
214/* 214/*
215 * Use the standard headers from the standard locations 215 * Use the standard headers from the standard locations
@@ -224,14 +224,8 @@
224/* 224/*
225 * We will be linking to the standard Clib functions 225 * We will be linking to the standard Clib functions
226 */ 226 */
227
228#define ACPI_STRSTR(s1,s2) strstr((s1), (s2)) 227#define ACPI_STRSTR(s1,s2) strstr((s1), (s2))
229#define ACPI_STRCHR(s1,c) strchr((s1), (c)) 228#define ACPI_STRCHR(s1,c) strchr((s1), (c))
230
231#ifdef ACPI_FUTURE_USAGE
232#define ACPI_STRUPR(s) (void) acpi_ut_strupr ((s))
233#endif
234
235#define ACPI_STRLEN(s) (acpi_size) strlen((s)) 229#define ACPI_STRLEN(s) (acpi_size) strlen((s))
236#define ACPI_STRCPY(d,s) (void) strcpy((d), (s)) 230#define ACPI_STRCPY(d,s) (void) strcpy((d), (s))
237#define ACPI_STRNCPY(d,s,n) (void) strncpy((d), (s), (acpi_size)(n)) 231#define ACPI_STRNCPY(d,s,n) (void) strncpy((d), (s), (acpi_size)(n))
@@ -254,14 +248,15 @@
254#define ACPI_IS_ALPHA isalpha 248#define ACPI_IS_ALPHA isalpha
255#define ACPI_IS_ASCII isascii 249#define ACPI_IS_ASCII isascii
256 250
251#else
252
257/****************************************************************************** 253/******************************************************************************
258 * 254 *
259 * Not using native C library, use local implementations 255 * Not using native C library, use local implementations
260 * 256 *
261 *****************************************************************************/ 257 *****************************************************************************/
262#else
263 258
264/* 259 /*
265 * Use local definitions of C library macros and functions 260 * Use local definitions of C library macros and functions
266 * NOTE: The function implementations may not be as efficient 261 * NOTE: The function implementations may not be as efficient
267 * as an inline or assembly code implementation provided by a 262 * as an inline or assembly code implementation provided by a
@@ -278,14 +273,12 @@ typedef char *va_list;
278/* 273/*
279 * Storage alignment properties 274 * Storage alignment properties
280 */ 275 */
281
282#define _AUPBND (sizeof (acpi_native_int) - 1) 276#define _AUPBND (sizeof (acpi_native_int) - 1)
283#define _ADNBND (sizeof (acpi_native_int) - 1) 277#define _ADNBND (sizeof (acpi_native_int) - 1)
284 278
285/* 279/*
286 * Variable argument list macro definitions 280 * Variable argument list macro definitions
287 */ 281 */
288
289#define _bnd(X, bnd) (((sizeof (X)) + (bnd)) & (~(bnd))) 282#define _bnd(X, bnd) (((sizeof (X)) + (bnd)) & (~(bnd)))
290#define va_arg(ap, T) (*(T *)(((ap) += (_bnd (T, _AUPBND))) - (_bnd (T,_ADNBND)))) 283#define va_arg(ap, T) (*(T *)(((ap) += (_bnd (T, _AUPBND))) - (_bnd (T,_ADNBND))))
291#define va_end(ap) (void) 0 284#define va_end(ap) (void) 0
@@ -296,11 +289,6 @@ typedef char *va_list;
296 289
297#define ACPI_STRSTR(s1,s2) acpi_ut_strstr ((s1), (s2)) 290#define ACPI_STRSTR(s1,s2) acpi_ut_strstr ((s1), (s2))
298#define ACPI_STRCHR(s1,c) acpi_ut_strchr ((s1), (c)) 291#define ACPI_STRCHR(s1,c) acpi_ut_strchr ((s1), (c))
299
300#ifdef ACPI_FUTURE_USAGE
301#define ACPI_STRUPR(s) (void) acpi_ut_strupr ((s))
302#endif
303
304#define ACPI_STRLEN(s) (acpi_size) acpi_ut_strlen ((s)) 292#define ACPI_STRLEN(s) (acpi_size) acpi_ut_strlen ((s))
305#define ACPI_STRCPY(d,s) (void) acpi_ut_strcpy ((d), (s)) 293#define ACPI_STRCPY(d,s) (void) acpi_ut_strcpy ((d), (s))
306#define ACPI_STRNCPY(d,s,n) (void) acpi_ut_strncpy ((d), (s), (acpi_size)(n)) 294#define ACPI_STRNCPY(d,s,n) (void) acpi_ut_strncpy ((d), (s), (acpi_size)(n))
diff --git a/include/acpi/processor.h b/include/acpi/processor.h
index 2f50a5bb0c7..50cfea4ff6c 100644
--- a/include/acpi/processor.h
+++ b/include/acpi/processor.h
@@ -4,6 +4,8 @@
4#include <linux/kernel.h> 4#include <linux/kernel.h>
5#include <linux/config.h> 5#include <linux/config.h>
6 6
7#include <asm/acpi.h>
8
7#define ACPI_PROCESSOR_BUSY_METRIC 10 9#define ACPI_PROCESSOR_BUSY_METRIC 10
8 10
9#define ACPI_PROCESSOR_MAX_POWER 8 11#define ACPI_PROCESSOR_MAX_POWER 8
@@ -14,6 +16,8 @@
14#define ACPI_PROCESSOR_MAX_THROTTLE 250 /* 25% */ 16#define ACPI_PROCESSOR_MAX_THROTTLE 250 /* 25% */
15#define ACPI_PROCESSOR_MAX_DUTY_WIDTH 4 17#define ACPI_PROCESSOR_MAX_DUTY_WIDTH 4
16 18
19#define ACPI_PDC_REVISION_ID 0x1
20
17/* Power Management */ 21/* Power Management */
18 22
19struct acpi_processor_cx; 23struct acpi_processor_cx;
@@ -59,6 +63,9 @@ struct acpi_processor_power {
59 u32 bm_activity; 63 u32 bm_activity;
60 int count; 64 int count;
61 struct acpi_processor_cx states[ACPI_PROCESSOR_MAX_POWER]; 65 struct acpi_processor_cx states[ACPI_PROCESSOR_MAX_POWER];
66
67 /* the _PDC objects passed by the driver, if any */
68 struct acpi_object_list *pdc;
62}; 69};
63 70
64/* Performance Management */ 71/* Performance Management */
@@ -82,8 +89,6 @@ struct acpi_processor_px {
82 acpi_integer status; /* success indicator */ 89 acpi_integer status; /* success indicator */
83}; 90};
84 91
85#define ACPI_PDC_REVISION_ID 0x1
86
87struct acpi_processor_performance { 92struct acpi_processor_performance {
88 unsigned int state; 93 unsigned int state;
89 unsigned int platform_limit; 94 unsigned int platform_limit;
@@ -179,7 +184,32 @@ int acpi_processor_notify_smm(struct module *calling_module);
179extern struct acpi_processor *processors[NR_CPUS]; 184extern struct acpi_processor *processors[NR_CPUS];
180extern struct acpi_processor_errata errata; 185extern struct acpi_processor_errata errata;
181 186
187int acpi_processor_set_pdc(struct acpi_processor *pr,
188 struct acpi_object_list *pdc_in);
189
190#ifdef ARCH_HAS_POWER_PDC_INIT
191void acpi_processor_power_init_pdc(struct acpi_processor_power *pow,
192 unsigned int cpu);
193void acpi_processor_power_init_bm_check(struct acpi_processor_flags *flags,
194 unsigned int cpu);
195#else
196static inline void acpi_processor_power_init_pdc(
197 struct acpi_processor_power *pow, unsigned int cpu)
198{
199 pow->pdc = NULL;
200 return;
201}
202
203static inline void acpi_processor_power_init_bm_check(
204 struct acpi_processor_flags *flags, unsigned int cpu)
205{
206 flags->bm_check = 1;
207 return;
208}
209#endif
210
182/* in processor_perflib.c */ 211/* in processor_perflib.c */
212
183#ifdef CONFIG_CPU_FREQ 213#ifdef CONFIG_CPU_FREQ
184void acpi_processor_ppc_init(void); 214void acpi_processor_ppc_init(void);
185void acpi_processor_ppc_exit(void); 215void acpi_processor_ppc_exit(void);
diff --git a/include/asm-alpha/pci.h b/include/asm-alpha/pci.h
index b7806aa3785..28957697e59 100644
--- a/include/asm-alpha/pci.h
+++ b/include/asm-alpha/pci.h
@@ -58,7 +58,7 @@ struct pci_controller {
58 58
59extern void pcibios_set_master(struct pci_dev *dev); 59extern void pcibios_set_master(struct pci_dev *dev);
60 60
61extern inline void pcibios_penalize_isa_irq(int irq) 61extern inline void pcibios_penalize_isa_irq(int irq, int active)
62{ 62{
63 /* We don't do dynamic PCI IRQ allocation */ 63 /* We don't do dynamic PCI IRQ allocation */
64} 64}
diff --git a/include/asm-alpha/pgtable.h b/include/asm-alpha/pgtable.h
index 408aea55e0c..22b53e369f5 100644
--- a/include/asm-alpha/pgtable.h
+++ b/include/asm-alpha/pgtable.h
@@ -133,6 +133,12 @@
133#define __S111 _PAGE_S(0) 133#define __S111 _PAGE_S(0)
134 134
135/* 135/*
136 * pgprot_noncached() is only for infiniband pci support, and a real
137 * implementation for RAM would be more complicated.
138 */
139#define pgprot_noncached(prot) (prot)
140
141/*
136 * BAD_PAGETABLE is used when we need a bogus page-table, while 142 * BAD_PAGETABLE is used when we need a bogus page-table, while
137 * BAD_PAGE is used for a bogus page. 143 * BAD_PAGE is used for a bogus page.
138 * 144 *
diff --git a/include/asm-arm/arch-ixp2000/platform.h b/include/asm-arm/arch-ixp2000/platform.h
index 52ded516ea5..c0caf3e3e6f 100644
--- a/include/asm-arm/arch-ixp2000/platform.h
+++ b/include/asm-arm/arch-ixp2000/platform.h
@@ -115,6 +115,7 @@ static inline unsigned int ixp2000_is_pcimaster(void)
115} 115}
116 116
117void ixp2000_map_io(void); 117void ixp2000_map_io(void);
118void ixp2000_uart_init(void);
118void ixp2000_init_irq(void); 119void ixp2000_init_irq(void);
119void ixp2000_init_time(unsigned long); 120void ixp2000_init_time(unsigned long);
120unsigned long ixp2000_gettimeoffset(void); 121unsigned long ixp2000_gettimeoffset(void);
diff --git a/include/asm-arm/arch-ixp4xx/io.h b/include/asm-arm/arch-ixp4xx/io.h
index c27b9d3079a..7495026e2c1 100644
--- a/include/asm-arm/arch-ixp4xx/io.h
+++ b/include/asm-arm/arch-ixp4xx/io.h
@@ -3,7 +3,7 @@
3 * 3 *
4 * Author: Deepak Saxena <dsaxena@plexity.net> 4 * Author: Deepak Saxena <dsaxena@plexity.net>
5 * 5 *
6 * Copyright (C) 2002-2004 MontaVista Software, Inc. 6 * Copyright (C) 2002-2005 MontaVista Software, Inc.
7 * 7 *
8 * This program is free software; you can redistribute it and/or modify 8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as 9 * it under the terms of the GNU General Public License version 2 as
@@ -383,6 +383,180 @@ __ixp4xx_insl(u32 io_addr, u32 *vaddr, u32 count)
383 *vaddr++ = inl(io_addr); 383 *vaddr++ = inl(io_addr);
384} 384}
385 385
386#define __is_io_address(p) (((unsigned long)p >= 0x0) && \
387 ((unsigned long)p <= 0x0000ffff))
388static inline unsigned int
389__ixp4xx_ioread8(void __iomem *port)
390{
391 if (__is_io_address(port))
392 return (unsigned int)__ixp4xx_inb((unsigned int)port);
393 else
394#ifndef CONFIG_IXP4XX_INDIRECT_PCI
395 return (unsigned int)__raw_readb((u32)port);
396#else
397 return (unsigned int)__ixp4xx_readb((u32)port);
398#endif
399}
400
401static inline void
402__ixp4xx_ioread8_rep(u32 port, u8 *vaddr, u32 count)
403{
404 if (__is_io_address(port))
405 __ixp4xx_insb(port, vaddr, count);
406 else
407#ifndef CONFIG_IXP4XX_INDIRECT_PCI
408 __raw_readsb((void __iomem *)port, vaddr, count);
409#else
410 __ixp4xx_readsb(port, vaddr, count);
411#endif
412}
413
414static inline unsigned int
415__ixp4xx_ioread16(void __iomem *port)
416{
417 if (__is_io_address(port))
418 return (unsigned int)__ixp4xx_inw((unsigned int)port);
419 else
420#ifndef CONFIG_IXP4XX_INDIRECT_PCI
421 return le16_to_cpu(__raw_readw((u32)port));
422#else
423 return (unsigned int)__ixp4xx_readw((u32)port);
424#endif
425}
426
427static inline void
428__ixp4xx_ioread16_rep(u32 port, u16 *vaddr, u32 count)
429{
430 if (__is_io_address(port))
431 __ixp4xx_insw(port, vaddr, count);
432 else
433#ifndef CONFIG_IXP4XX_INDIRECT_PCI
434 __raw_readsw((void __iomem *)port, vaddr, count);
435#else
436 __ixp4xx_readsw(port, vaddr, count);
437#endif
438}
439
440static inline unsigned int
441__ixp4xx_ioread32(void __iomem *port)
442{
443 if (__is_io_address(port))
444 return (unsigned int)__ixp4xx_inl((unsigned int)port);
445 else {
446#ifndef CONFIG_IXP4XX_INDIRECT_PCI
447 return le32_to_cpu(__raw_readl((u32)port));
448#else
449 return (unsigned int)__ixp4xx_readl((u32)port);
450#endif
451 }
452}
453
454static inline void
455__ixp4xx_ioread32_rep(u32 port, u32 *vaddr, u32 count)
456{
457 if (__is_io_address(port))
458 __ixp4xx_insl(port, vaddr, count);
459 else
460#ifndef CONFIG_IXP4XX_INDIRECT_PCI
461 __raw_readsl((void __iomem *)port, vaddr, count);
462#else
463 __ixp4xx_readsl(port, vaddr, count);
464#endif
465}
466
467static inline void
468__ixp4xx_iowrite8(u8 value, void __iomem *port)
469{
470 if (__is_io_address(port))
471 __ixp4xx_outb(value, (unsigned int)port);
472 else
473#ifndef CONFIG_IXP4XX_INDIRECT_PCI
474 __raw_writeb(value, (u32)port);
475#else
476 __ixp4xx_writeb(value, (u32)port);
477#endif
478}
479
480static inline void
481__ixp4xx_iowrite8_rep(u32 port, u8 *vaddr, u32 count)
482{
483 if (__is_io_address(port))
484 __ixp4xx_outsb(port, vaddr, count);
485#ifndef CONFIG_IXP4XX_INDIRECT_PCI
486 __raw_writesb((void __iomem *)port, vaddr, count);
487#else
488 __ixp4xx_writesb(port, vaddr, count);
489#endif
490}
491
492static inline void
493__ixp4xx_iowrite16(u16 value, void __iomem *port)
494{
495 if (__is_io_address(port))
496 __ixp4xx_outw(value, (unsigned int)port);
497 else
498#ifndef CONFIG_IXP4XX_INDIRECT_PCI
499 __raw_writew(cpu_to_le16(value), (u32)port);
500#else
501 __ixp4xx_writew(value, (u32)port);
502#endif
503}
504
505static inline void
506__ixp4xx_iowrite16_rep(u32 port, u16 *vaddr, u32 count)
507{
508 if (__is_io_address(port))
509 __ixp4xx_outsw(port, vaddr, count);
510#ifndef CONFIG_IXP4XX_INDIRECT_PCI
511 __raw_readsw((void __iomem *)port, vaddr, count);
512#else
513 __ixp4xx_writesw(port, vaddr, count);
514#endif
515}
516
517static inline void
518__ixp4xx_iowrite32(u32 value, void __iomem *port)
519{
520 if (__is_io_address(port))
521 __ixp4xx_outl(value, (unsigned int)port);
522 else
523#ifndef CONFIG_IXP4XX_INDIRECT_PCI
524 __raw_writel(cpu_to_le32(value), (u32)port);
525#else
526 __ixp4xx_writel(value, (u32)port);
527#endif
528}
529
530static inline void
531__ixp4xx_iowrite32_rep(u32 port, u32 *vaddr, u32 count)
532{
533 if (__is_io_address(port))
534 __ixp4xx_outsl(port, vaddr, count);
535#ifndef CONFIG_IXP4XX_INDIRECT_PCI
536 __raw_readsl((void __iomem *)port, vaddr, count);
537#else
538 __ixp4xx_outsl(port, vaddr, count);
539#endif
540}
541
542#define ioread8(p) __ixp4xx_ioread8(p)
543#define ioread16(p) __ixp4xx_ioread16(p)
544#define ioread32(p) __ixp4xx_ioread32(p)
545
546#define ioread8_rep(p, v, c) __ixp4xx_ioread8_rep(p, v, c)
547#define ioread16_rep(p, v, c) __ixp4xx_ioread16_rep(p, v, c)
548#define ioread32_rep(p, v, c) __ixp4xx_ioread32_rep(p, v, c)
549
550#define iowrite8(v,p) __ixp4xx_iowrite8(v,p)
551#define iowrite16(v,p) __ixp4xx_iowrite16(v,p)
552#define iowrite32(v,p) __ixp4xx_iowrite32(v,p)
553
554#define iowrite8_rep(p, v, c) __ixp4xx_iowrite8_rep(p, v, c)
555#define iowrite16_rep(p, v, c) __ixp4xx_iowrite16_rep(p, v, c)
556#define iowrite32_rep(p, v, c) __ixp4xx_iowrite32_rep(p, v, c)
557
558#define ioport_map(port, nr) ((void __iomem*)port)
559#define ioport_unmap(addr)
386 560
387#endif // __ASM_ARM_ARCH_IO_H 561#endif // __ASM_ARM_ARCH_IO_H
388 562
diff --git a/include/asm-arm/arch-omap/board-h2.h b/include/asm-arm/arch-omap/board-h2.h
index 60f002b7298..39ca5a31aee 100644
--- a/include/asm-arm/arch-omap/board-h2.h
+++ b/include/asm-arm/arch-omap/board-h2.h
@@ -34,11 +34,6 @@
34/* At OMAP1610 Innovator the Ethernet is directly connected to CS1 */ 34/* At OMAP1610 Innovator the Ethernet is directly connected to CS1 */
35#define OMAP1610_ETHR_START 0x04000300 35#define OMAP1610_ETHR_START 0x04000300
36 36
37/* Intel STRATA NOR flash at CS3 or CS2B(NAND Boot) */
38#define OMAP_NOR_FLASH_SIZE SZ_32M
39#define OMAP_NOR_FLASH_START1 0x0C000000 /* CS3 */
40#define OMAP_NOR_FLASH_START2 0x0A000000 /* CS2B */
41
42/* Samsung NAND flash at CS2B or CS3(NAND Boot) */ 37/* Samsung NAND flash at CS2B or CS3(NAND Boot) */
43#define OMAP_NAND_FLASH_START1 0x0A000000 /* CS2B */ 38#define OMAP_NAND_FLASH_START1 0x0A000000 /* CS2B */
44#define OMAP_NAND_FLASH_START2 0x0C000000 /* CS3 */ 39#define OMAP_NAND_FLASH_START2 0x0C000000 /* CS3 */
diff --git a/include/asm-arm/arch-omap/board-h3.h b/include/asm-arm/arch-omap/board-h3.h
index e4d1cd23173..1b12c1dcc2f 100644
--- a/include/asm-arm/arch-omap/board-h3.h
+++ b/include/asm-arm/arch-omap/board-h3.h
@@ -30,11 +30,6 @@
30/* In OMAP1710 H3 the Ethernet is directly connected to CS1 */ 30/* In OMAP1710 H3 the Ethernet is directly connected to CS1 */
31#define OMAP1710_ETHR_START 0x04000300 31#define OMAP1710_ETHR_START 0x04000300
32 32
33/* Intel STRATA NOR flash at CS3 or CS2B(NAND Boot) */
34#define OMAP_NOR_FLASH_SIZE SZ_32M
35#define OMAP_NOR_FLASH_START1 0x0C000000 /* CS3 */
36#define OMAP_NOR_FLASH_START2 0x0A000000 /* CS2B */
37
38/* Samsung NAND flash at CS2B or CS3(NAND Boot) */ 33/* Samsung NAND flash at CS2B or CS3(NAND Boot) */
39#define OMAP_NAND_FLASH_START1 0x0A000000 /* CS2B */ 34#define OMAP_NAND_FLASH_START1 0x0A000000 /* CS2B */
40#define OMAP_NAND_FLASH_START2 0x0C000000 /* CS3 */ 35#define OMAP_NAND_FLASH_START2 0x0C000000 /* CS3 */
diff --git a/include/asm-arm/arch-omap/board-osk.h b/include/asm-arm/arch-omap/board-osk.h
index aaa49a0fbd2..2b1a8a4fe44 100644
--- a/include/asm-arm/arch-omap/board-osk.h
+++ b/include/asm-arm/arch-omap/board-osk.h
@@ -32,10 +32,5 @@
32/* At OMAP5912 OSK the Ethernet is directly connected to CS1 */ 32/* At OMAP5912 OSK the Ethernet is directly connected to CS1 */
33#define OMAP_OSK_ETHR_START 0x04800300 33#define OMAP_OSK_ETHR_START 0x04800300
34 34
35/* Micron NOR flash at CS3 mapped to address 0x0 if BM bit is 1 */
36#define OMAP_OSK_NOR_FLASH_BASE 0xD8000000
37#define OMAP_OSK_NOR_FLASH_SIZE SZ_32M
38#define OMAP_OSK_NOR_FLASH_START 0x00000000
39
40#endif /* __ASM_ARCH_OMAP_OSK_H */ 35#endif /* __ASM_ARCH_OMAP_OSK_H */
41 36
diff --git a/include/asm-arm/arch-omap/board.h b/include/asm-arm/arch-omap/board.h
index 1cefd60b6f2..95bd625480c 100644
--- a/include/asm-arm/arch-omap/board.h
+++ b/include/asm-arm/arch-omap/board.h
@@ -16,10 +16,11 @@
16/* Different peripheral ids */ 16/* Different peripheral ids */
17#define OMAP_TAG_CLOCK 0x4f01 17#define OMAP_TAG_CLOCK 0x4f01
18#define OMAP_TAG_MMC 0x4f02 18#define OMAP_TAG_MMC 0x4f02
19#define OMAP_TAG_UART 0x4f03 19#define OMAP_TAG_SERIAL_CONSOLE 0x4f03
20#define OMAP_TAG_USB 0x4f04 20#define OMAP_TAG_USB 0x4f04
21#define OMAP_TAG_LCD 0x4f05 21#define OMAP_TAG_LCD 0x4f05
22#define OMAP_TAG_GPIO_SWITCH 0x4f06 22#define OMAP_TAG_GPIO_SWITCH 0x4f06
23#define OMAP_TAG_UART 0x4f07
23 24
24#define OMAP_TAG_BOOT_REASON 0x4f80 25#define OMAP_TAG_BOOT_REASON 0x4f80
25#define OMAP_TAG_FLASH_PART 0x4f81 26#define OMAP_TAG_FLASH_PART 0x4f81
@@ -35,7 +36,7 @@ struct omap_mmc_config {
35 s16 mmc1_switch_pin, mmc2_switch_pin; 36 s16 mmc1_switch_pin, mmc2_switch_pin;
36}; 37};
37 38
38struct omap_uart_config { 39struct omap_serial_console_config {
39 u8 console_uart; 40 u8 console_uart;
40 u32 console_speed; 41 u32 console_speed;
41}; 42};
@@ -82,7 +83,8 @@ struct omap_lcd_config {
82 */ 83 */
83#define OMAP_GPIO_SWITCH_TYPE_COVER 0x0000 84#define OMAP_GPIO_SWITCH_TYPE_COVER 0x0000
84#define OMAP_GPIO_SWITCH_TYPE_CONNECTION 0x0001 85#define OMAP_GPIO_SWITCH_TYPE_CONNECTION 0x0001
85#define OMAP_GPIO_SWITCH_FLAG_INVERTED 0x0001 86#define OMAP_GPIO_SWITCH_FLAG_INVERTED 0x0001
87#define OMAP_GPIO_SWITCH_FLAG_OUTPUT 0x0002
86struct omap_gpio_switch_config { 88struct omap_gpio_switch_config {
87 char name[12]; 89 char name[12];
88 u16 gpio; 90 u16 gpio;
@@ -99,6 +101,10 @@ struct omap_boot_reason_config {
99 char reason_str[12]; 101 char reason_str[12];
100}; 102};
101 103
104struct omap_uart_config {
105 /* Bit field of UARTs present; bit 0 --> UART1 */
106 unsigned int enabled_uarts;
107};
102 108
103struct omap_board_config_entry { 109struct omap_board_config_entry {
104 u16 tag; 110 u16 tag;
diff --git a/include/asm-arm/arch-omap/common.h b/include/asm-arm/arch-omap/common.h
new file mode 100644
index 00000000000..2a676b4f13b
--- /dev/null
+++ b/include/asm-arm/arch-omap/common.h
@@ -0,0 +1,36 @@
1/*
2 * linux/include/asm-arm/arch-omap/common.h
3 *
4 * Header for code common to all OMAP machines.
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 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
12 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
13 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
14 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
15 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
16 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
17 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
18 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
19 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
20 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
21 *
22 * You should have received a copy of the GNU General Public License along
23 * with this program; if not, write to the Free Software Foundation, Inc.,
24 * 675 Mass Ave, Cambridge, MA 02139, USA.
25 */
26
27#ifndef __ARCH_ARM_MACH_OMAP_COMMON_H
28#define __ARCH_ARM_MACH_OMAP_COMMON_H
29
30struct sys_timer;
31
32extern void omap_map_common_io(void);
33extern struct sys_timer omap_timer;
34extern void omap_serial_init(int ports[]);
35
36#endif /* __ARCH_ARM_MACH_OMAP_COMMON_H */
diff --git a/include/asm-arm/arch-omap/dma.h b/include/asm-arm/arch-omap/dma.h
index d785248377d..ce114ce5af5 100644
--- a/include/asm-arm/arch-omap/dma.h
+++ b/include/asm-arm/arch-omap/dma.h
@@ -241,6 +241,7 @@ extern void omap_dma_unlink_lch (int lch_head, int lch_queue);
241extern dma_addr_t omap_get_dma_src_pos(int lch); 241extern dma_addr_t omap_get_dma_src_pos(int lch);
242extern dma_addr_t omap_get_dma_dst_pos(int lch); 242extern dma_addr_t omap_get_dma_dst_pos(int lch);
243extern void omap_clear_dma(int lch); 243extern void omap_clear_dma(int lch);
244extern int omap_dma_running(void);
244 245
245/* Returns 1 if the DMA module is in OMAP1510-compatible mode, 0 otherwise */ 246/* Returns 1 if the DMA module is in OMAP1510-compatible mode, 0 otherwise */
246extern int omap_dma_in_1510_mode(void); 247extern int omap_dma_in_1510_mode(void);
diff --git a/include/asm-arm/arch-omap/hardware.h b/include/asm-arm/arch-omap/hardware.h
index 37e06c782bd..48258c7f654 100644
--- a/include/asm-arm/arch-omap/hardware.h
+++ b/include/asm-arm/arch-omap/hardware.h
@@ -54,6 +54,19 @@
54 54
55/* 55/*
56 * ---------------------------------------------------------------------------- 56 * ----------------------------------------------------------------------------
57 * Timers
58 * ----------------------------------------------------------------------------
59 */
60#define OMAP_MPU_TIMER1_BASE (0xfffec500)
61#define OMAP_MPU_TIMER2_BASE (0xfffec600)
62#define OMAP_MPU_TIMER3_BASE (0xfffec700)
63#define MPU_TIMER_FREE (1 << 6)
64#define MPU_TIMER_CLOCK_ENABLE (1 << 5)
65#define MPU_TIMER_AR (1 << 1)
66#define MPU_TIMER_ST (1 << 0)
67
68/*
69 * ----------------------------------------------------------------------------
57 * Clocks 70 * Clocks
58 * ---------------------------------------------------------------------------- 71 * ----------------------------------------------------------------------------
59 */ 72 */
@@ -78,6 +91,7 @@
78 91
79/* DSP clock control */ 92/* DSP clock control */
80#define DSP_CONFIG_REG_BASE (0xe1008000) 93#define DSP_CONFIG_REG_BASE (0xe1008000)
94#define DSP_CKCTL (DSP_CONFIG_REG_BASE + 0x0)
81#define DSP_IDLECT1 (DSP_CONFIG_REG_BASE + 0x4) 95#define DSP_IDLECT1 (DSP_CONFIG_REG_BASE + 0x4)
82#define DSP_IDLECT2 (DSP_CONFIG_REG_BASE + 0x8) 96#define DSP_IDLECT2 (DSP_CONFIG_REG_BASE + 0x8)
83 97
@@ -88,6 +102,7 @@
88 */ 102 */
89#define ULPD_REG_BASE (0xfffe0800) 103#define ULPD_REG_BASE (0xfffe0800)
90#define ULPD_IT_STATUS (ULPD_REG_BASE + 0x14) 104#define ULPD_IT_STATUS (ULPD_REG_BASE + 0x14)
105#define ULPD_SETUP_ANALOG_CELL_3 (ULPD_REG_BASE + 0x24)
91#define ULPD_CLOCK_CTRL (ULPD_REG_BASE + 0x30) 106#define ULPD_CLOCK_CTRL (ULPD_REG_BASE + 0x30)
92# define DIS_USB_PVCI_CLK (1 << 5) /* no USB/FAC synch */ 107# define DIS_USB_PVCI_CLK (1 << 5) /* no USB/FAC synch */
93# define USB_MCLK_EN (1 << 4) /* enable W4_USB_CLKO */ 108# define USB_MCLK_EN (1 << 4) /* enable W4_USB_CLKO */
@@ -268,17 +283,10 @@
268 * Processor specific defines 283 * Processor specific defines
269 * --------------------------------------------------------------------------- 284 * ---------------------------------------------------------------------------
270 */ 285 */
271#ifdef CONFIG_ARCH_OMAP730
272#include "omap730.h"
273#endif
274 286
275#ifdef CONFIG_ARCH_OMAP1510 287#include "omap730.h"
276#include "omap1510.h" 288#include "omap1510.h"
277#endif
278
279#ifdef CONFIG_ARCH_OMAP16XX
280#include "omap16xx.h" 289#include "omap16xx.h"
281#endif
282 290
283/* 291/*
284 * --------------------------------------------------------------------------- 292 * ---------------------------------------------------------------------------
diff --git a/include/asm-arm/arch-omap/irqs.h b/include/asm-arm/arch-omap/irqs.h
index 6701fd9e5f9..0d05a7c957d 100644
--- a/include/asm-arm/arch-omap/irqs.h
+++ b/include/asm-arm/arch-omap/irqs.h
@@ -159,6 +159,7 @@
159#define INT_1610_GPIO_BANK3 (41 + IH2_BASE) 159#define INT_1610_GPIO_BANK3 (41 + IH2_BASE)
160#define INT_1610_MMC2 (42 + IH2_BASE) 160#define INT_1610_MMC2 (42 + IH2_BASE)
161#define INT_1610_CF (43 + IH2_BASE) 161#define INT_1610_CF (43 + IH2_BASE)
162#define INT_1610_WAKE_UP_REQ (46 + IH2_BASE)
162#define INT_1610_GPIO_BANK4 (48 + IH2_BASE) 163#define INT_1610_GPIO_BANK4 (48 + IH2_BASE)
163#define INT_1610_SPI (49 + IH2_BASE) 164#define INT_1610_SPI (49 + IH2_BASE)
164#define INT_1610_DMA_CH6 (53 + IH2_BASE) 165#define INT_1610_DMA_CH6 (53 + IH2_BASE)
@@ -238,6 +239,8 @@
238#define IH_MPUIO_BASE (OMAP_MAX_GPIO_LINES + IH_GPIO_BASE) 239#define IH_MPUIO_BASE (OMAP_MAX_GPIO_LINES + IH_GPIO_BASE)
239#define IH_BOARD_BASE (16 + IH_MPUIO_BASE) 240#define IH_BOARD_BASE (16 + IH_MPUIO_BASE)
240 241
242#define OMAP_IRQ_BIT(irq) (1 << ((irq) % 32))
243
241#ifndef __ASSEMBLY__ 244#ifndef __ASSEMBLY__
242extern void omap_init_irq(void); 245extern void omap_init_irq(void);
243#endif 246#endif
diff --git a/include/asm-arm/arch-omap/mux.h b/include/asm-arm/arch-omap/mux.h
index 39f99decbb7..5bd3f0097fc 100644
--- a/include/asm-arm/arch-omap/mux.h
+++ b/include/asm-arm/arch-omap/mux.h
@@ -231,7 +231,7 @@ typedef enum {
231 J19_1610_ETM_D6, 231 J19_1610_ETM_D6,
232 J18_1610_ETM_D7, 232 J18_1610_ETM_D7,
233 233
234 /* OMAP-1610 GPIO */ 234 /* OMAP16XX GPIO */
235 P20_1610_GPIO4, 235 P20_1610_GPIO4,
236 V9_1610_GPIO7, 236 V9_1610_GPIO7,
237 W8_1610_GPIO9, 237 W8_1610_GPIO9,
@@ -241,6 +241,9 @@ typedef enum {
241 AA20_1610_GPIO_41, 241 AA20_1610_GPIO_41,
242 W19_1610_GPIO48, 242 W19_1610_GPIO48,
243 M7_1610_GPIO62, 243 M7_1610_GPIO62,
244 V14_16XX_GPIO37,
245 R9_16XX_GPIO18,
246 L14_16XX_GPIO49,
244 247
245 /* OMAP-1610 uWire */ 248 /* OMAP-1610 uWire */
246 V19_1610_UWIRE_SCLK, 249 V19_1610_UWIRE_SCLK,
@@ -285,12 +288,13 @@ typedef enum {
285 V6_USB2_TXD, 288 V6_USB2_TXD,
286 W5_USB2_SE0, 289 W5_USB2_SE0,
287 290
288 /* UART1 1610 */ 291 /* 16XX UART */
289
290 R13_1610_UART1_TX, 292 R13_1610_UART1_TX,
291 V14_1610_UART1_RX, 293 V14_16XX_UART1_RX,
292 R14_1610_UART1_CTS, 294 R14_1610_UART1_CTS,
293 AA15_1610_UART1_RTS, 295 AA15_1610_UART1_RTS,
296 R9_16XX_UART2_RX,
297 L14_16XX_UART3_RX,
294 298
295 /* I2C OMAP-1610 */ 299 /* I2C OMAP-1610 */
296 I2C_SCL, 300 I2C_SCL,
@@ -332,7 +336,7 @@ typedef enum {
332 * Table of various FUNC_MUX and PULL_DWN combinations for each device. 336 * Table of various FUNC_MUX and PULL_DWN combinations for each device.
333 * See also reg_cfg_t above for the lookup table. 337 * See also reg_cfg_t above for the lookup table.
334 */ 338 */
335static reg_cfg_set __initdata_or_module 339static const reg_cfg_set __initdata_or_module
336reg_cfg_table[] = { 340reg_cfg_table[] = {
337/* 341/*
338 * description mux mode mux pull pull pull pu_pd pu dbg 342 * description mux mode mux pull pull pull pu_pd pu dbg
@@ -455,7 +459,7 @@ MUX_CFG("L19_1610_ETM_D0", 5, 18, 1, 0, 26, 0, 0, 0, 1)
455MUX_CFG("J19_1610_ETM_D6", 5, 0, 1, 0, 20, 0, 0, 0, 1) 459MUX_CFG("J19_1610_ETM_D6", 5, 0, 1, 0, 20, 0, 0, 0, 1)
456MUX_CFG("J18_1610_ETM_D7", 5, 27, 1, 0, 19, 0, 0, 0, 1) 460MUX_CFG("J18_1610_ETM_D7", 5, 27, 1, 0, 19, 0, 0, 0, 1)
457 461
458/* OMAP-1610 GPIO */ 462/* OMAP16XX GPIO */
459MUX_CFG("P20_1610_GPIO4", 6, 27, 0, 1, 7, 0, 1, 1, 1) 463MUX_CFG("P20_1610_GPIO4", 6, 27, 0, 1, 7, 0, 1, 1, 1)
460MUX_CFG("V9_1610_GPIO7", B, 12, 1, 2, 20, 0, 2, 1, 1) 464MUX_CFG("V9_1610_GPIO7", B, 12, 1, 2, 20, 0, 2, 1, 1)
461MUX_CFG("W8_1610_GPIO9", B, 21, 0, 2, 23, 0, 2, 1, 1) 465MUX_CFG("W8_1610_GPIO9", B, 21, 0, 2, 23, 0, 2, 1, 1)
@@ -465,6 +469,9 @@ MUX_CFG("V5_1610_GPIO24", B, 15, 7, 2, 21, 0, 2, 1, 1)
465MUX_CFG("AA20_1610_GPIO_41", 9, 9, 7, 1, 31, 0, 1, 1, 1) 469MUX_CFG("AA20_1610_GPIO_41", 9, 9, 7, 1, 31, 0, 1, 1, 1)
466MUX_CFG("W19_1610_GPIO48", 8, 15, 7, 1, 23, 1, 1, 0, 1) 470MUX_CFG("W19_1610_GPIO48", 8, 15, 7, 1, 23, 1, 1, 0, 1)
467MUX_CFG("M7_1610_GPIO62", 10, 0, 0, 4, 24, 0, 4, 0, 1) 471MUX_CFG("M7_1610_GPIO62", 10, 0, 0, 4, 24, 0, 4, 0, 1)
472MUX_CFG("V14_16XX_GPIO37", 9, 18, 7, 2, 2, 0, 2, 2, 0)
473MUX_CFG("R9_16XX_GPIO18", C, 18, 7, 3, 0, 0, 3, 0, 0)
474MUX_CFG("L14_16XX_GPIO49", 6, 3, 7, 0, 31, 0, 0, 31, 0)
468 475
469/* OMAP-1610 uWire */ 476/* OMAP-1610 uWire */
470MUX_CFG("V19_1610_UWIRE_SCLK", 8, 6, 0, 1, 20, 0, 1, 1, 1) 477MUX_CFG("V19_1610_UWIRE_SCLK", 8, 6, 0, 1, 20, 0, 1, 1, 1)
@@ -503,16 +510,17 @@ MUX_CFG("Y10_USB0_SUSP", B, 3, 5, 2, 17, 0, 2, 0, 1)
503MUX_CFG("W9_USB2_TXEN", B, 9, 1, NA, 0, 0, NA, 0, 1) 510MUX_CFG("W9_USB2_TXEN", B, 9, 1, NA, 0, 0, NA, 0, 1)
504MUX_CFG("AA9_USB2_VP", B, 6, 1, NA, 0, 0, NA, 0, 1) 511MUX_CFG("AA9_USB2_VP", B, 6, 1, NA, 0, 0, NA, 0, 1)
505MUX_CFG("Y5_USB2_RCV", C, 21, 1, NA, 0, 0, NA, 0, 1) 512MUX_CFG("Y5_USB2_RCV", C, 21, 1, NA, 0, 0, NA, 0, 1)
506MUX_CFG("R8_USB2_VM", C, 18, 1, NA, 0, 0, NA, 0, 1) 513MUX_CFG("R9_USB2_VM", C, 18, 1, NA, 0, 0, NA, 0, 1)
507MUX_CFG("V6_USB2_TXD", C, 27, 2, NA, 0, 0, NA, 0, 1) 514MUX_CFG("V6_USB2_TXD", C, 27, 2, NA, 0, 0, NA, 0, 1)
508MUX_CFG("W5_USB2_SE0", C, 24, 2, NA, 0, 0, NA, 0, 1) 515MUX_CFG("W5_USB2_SE0", C, 24, 2, NA, 0, 0, NA, 0, 1)
509 516
510 517/* 16XX UART */
511/* UART1 */
512MUX_CFG("R13_1610_UART1_TX", A, 12, 6, 2, 10, 0, 2, 10, 1) 518MUX_CFG("R13_1610_UART1_TX", A, 12, 6, 2, 10, 0, 2, 10, 1)
513MUX_CFG("V14_1610_UART1_RX", 9, 18, 0, 2, 2, 0, 2, 2, 1) 519MUX_CFG("V14_16XX_UART1_RX", 9, 18, 0, 2, 2, 0, 2, 2, 1)
514MUX_CFG("R14_1610_UART1_CTS", 9, 15, 0, 2, 1, 0, 2, 1, 1) 520MUX_CFG("R14_1610_UART1_CTS", 9, 15, 0, 2, 1, 0, 2, 1, 1)
515MUX_CFG("AA15_1610_UART1_RTS", 9, 12, 1, 2, 0, 0, 2, 0, 1) 521MUX_CFG("AA15_1610_UART1_RTS", 9, 12, 1, 2, 0, 0, 2, 0, 1)
522MUX_CFG("R9_16XX_UART2_RX", C, 18, 0, 3, 0, 0, 3, 0, 1)
523MUX_CFG("L14_16XX_UART3_RX", 6, 3, 0, 0, 31, 0, 0, 31, 1)
516 524
517/* I2C interface */ 525/* I2C interface */
518MUX_CFG("I2C_SCL", 7, 24, 0, NA, 0, 0, NA, 0, 0) 526MUX_CFG("I2C_SCL", 7, 24, 0, NA, 0, 0, NA, 0, 0)
diff --git a/include/asm-arm/arch-omap/omap16xx.h b/include/asm-arm/arch-omap/omap16xx.h
index 88b1fe43ae9..38a9b95e6a3 100644
--- a/include/asm-arm/arch-omap/omap16xx.h
+++ b/include/asm-arm/arch-omap/omap16xx.h
@@ -183,5 +183,37 @@
183#define OMAP16XX_PWL_ENABLE (OMAP16XX_PWL_BASE + 0x00) 183#define OMAP16XX_PWL_ENABLE (OMAP16XX_PWL_BASE + 0x00)
184#define OMAP16XX_PWL_CLK_ENABLE (OMAP16XX_PWL_BASE + 0x04) 184#define OMAP16XX_PWL_CLK_ENABLE (OMAP16XX_PWL_BASE + 0x04)
185 185
186/*
187 * ---------------------------------------------------------------------------
188 * Watchdog timer
189 * ---------------------------------------------------------------------------
190 */
191
192/* 32-bit Watchdog timer in OMAP 16XX */
193#define OMAP_16XX_WATCHDOG_BASE (0xfffeb000)
194#define OMAP_16XX_WIDR (OMAP_16XX_WATCHDOG_BASE + 0x00)
195#define OMAP_16XX_WD_SYSCONFIG (OMAP_16XX_WATCHDOG_BASE + 0x10)
196#define OMAP_16XX_WD_SYSSTATUS (OMAP_16XX_WATCHDOG_BASE + 0x14)
197#define OMAP_16XX_WCLR (OMAP_16XX_WATCHDOG_BASE + 0x24)
198#define OMAP_16XX_WCRR (OMAP_16XX_WATCHDOG_BASE + 0x28)
199#define OMAP_16XX_WLDR (OMAP_16XX_WATCHDOG_BASE + 0x2c)
200#define OMAP_16XX_WTGR (OMAP_16XX_WATCHDOG_BASE + 0x30)
201#define OMAP_16XX_WWPS (OMAP_16XX_WATCHDOG_BASE + 0x34)
202#define OMAP_16XX_WSPR (OMAP_16XX_WATCHDOG_BASE + 0x48)
203
204#define WCLR_PRE_SHIFT 5
205#define WCLR_PTV_SHIFT 2
206
207#define WWPS_W_PEND_WSPR (1 << 4)
208#define WWPS_W_PEND_WTGR (1 << 3)
209#define WWPS_W_PEND_WLDR (1 << 2)
210#define WWPS_W_PEND_WCRR (1 << 1)
211#define WWPS_W_PEND_WCLR (1 << 0)
212
213#define WSPR_ENABLE_0 (0x0000bbbb)
214#define WSPR_ENABLE_1 (0x00004444)
215#define WSPR_DISABLE_0 (0x0000aaaa)
216#define WSPR_DISABLE_1 (0x00005555)
217
186#endif /* __ASM_ARCH_OMAP16XX_H */ 218#endif /* __ASM_ARCH_OMAP16XX_H */
187 219
diff --git a/include/asm-arm/arch-omap/system.h b/include/asm-arm/arch-omap/system.h
index 17a2c4825f0..ff37bc27e60 100644
--- a/include/asm-arm/arch-omap/system.h
+++ b/include/asm-arm/arch-omap/system.h
@@ -5,7 +5,9 @@
5#ifndef __ASM_ARCH_SYSTEM_H 5#ifndef __ASM_ARCH_SYSTEM_H
6#define __ASM_ARCH_SYSTEM_H 6#define __ASM_ARCH_SYSTEM_H
7#include <linux/config.h> 7#include <linux/config.h>
8#include <asm/mach-types.h>
8#include <asm/arch/hardware.h> 9#include <asm/arch/hardware.h>
10#include <asm/mach-types.h>
9 11
10static inline void arch_idle(void) 12static inline void arch_idle(void)
11{ 13{
@@ -14,7 +16,24 @@ static inline void arch_idle(void)
14 16
15static inline void arch_reset(char mode) 17static inline void arch_reset(char mode)
16{ 18{
17 omap_writew(1, ARM_RSTCT1); 19
20#ifdef CONFIG_ARCH_OMAP16XX
21 /*
22 * Workaround for 5912/1611b bug mentioned in sprz209d.pdf p. 28
23 * "Global Software Reset Affects Traffic Controller Frequency".
24 */
25 if (cpu_is_omap5912()) {
26 omap_writew(omap_readw(DPLL_CTL) & ~(1 << 4),
27 DPLL_CTL);
28 omap_writew(0x8, ARM_RSTCT1);
29 }
30#endif
31#ifdef CONFIG_MACH_VOICEBLUE
32 if (machine_is_voiceblue())
33 voiceblue_reset();
34 else
35#endif
36 omap_writew(1, ARM_RSTCT1);
18} 37}
19 38
20#endif 39#endif
diff --git a/include/asm-arm/arch-pxa/mtd-xip.h b/include/asm-arm/arch-pxa/mtd-xip.h
new file mode 100644
index 00000000000..8704dbceb43
--- /dev/null
+++ b/include/asm-arm/arch-pxa/mtd-xip.h
@@ -0,0 +1,37 @@
1/*
2 * MTD primitives for XIP support. Architecture specific functions
3 *
4 * Do not include this file directly. It's included from linux/mtd/xip.h
5 *
6 * Author: Nicolas Pitre
7 * Created: Nov 2, 2004
8 * Copyright: (C) 2004 MontaVista Software, Inc.
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13 *
14 * $Id: xip.h,v 1.2 2004/12/01 15:49:10 nico Exp $
15 */
16
17#ifndef __ARCH_PXA_MTD_XIP_H__
18#define __ARCH_PXA_MTD_XIP_H__
19
20#include <asm/arch/pxa-regs.h>
21
22#define xip_irqpending() (ICIP & ICMR)
23
24/* we sample OSCR and convert desired delta to usec (1/4 ~= 1000000/3686400) */
25#define xip_currtime() (OSCR)
26#define xip_elapsed_since(x) (signed)((OSCR - (x)) / 4)
27
28/*
29 * xip_cpu_idle() is used when waiting for a delay equal or larger than
30 * the system timer tick period. This should put the CPU into idle mode
31 * to save power and to be woken up only when some interrupts are pending.
32 * As above, this should not rely upon standard kernel code.
33 */
34
35#define xip_cpu_idle() asm volatile ("mcr p14, 0, %0, c7, c0, 0" :: "r" (1))
36
37#endif /* __ARCH_PXA_MTD_XIP_H__ */
diff --git a/include/asm-arm/arch-pxa/pxa-regs.h b/include/asm-arm/arch-pxa/pxa-regs.h
index b5e54a9e9fa..51f0fe0ac16 100644
--- a/include/asm-arm/arch-pxa/pxa-regs.h
+++ b/include/asm-arm/arch-pxa/pxa-regs.h
@@ -1505,6 +1505,7 @@
1505#define PSSR_OTGPH (1 << 6) /* OTG Peripheral control Hold */ 1505#define PSSR_OTGPH (1 << 6) /* OTG Peripheral control Hold */
1506#define PSSR_RDH (1 << 5) /* Read Disable Hold */ 1506#define PSSR_RDH (1 << 5) /* Read Disable Hold */
1507#define PSSR_PH (1 << 4) /* Peripheral Control Hold */ 1507#define PSSR_PH (1 << 4) /* Peripheral Control Hold */
1508#define PSSR_STS (1 << 3) /* Standby Mode Status */
1508#define PSSR_VFS (1 << 2) /* VDD Fault Status */ 1509#define PSSR_VFS (1 << 2) /* VDD Fault Status */
1509#define PSSR_BFS (1 << 1) /* Battery Fault Status */ 1510#define PSSR_BFS (1 << 1) /* Battery Fault Status */
1510#define PSSR_SSS (1 << 0) /* Software Sleep Status */ 1511#define PSSR_SSS (1 << 0) /* Software Sleep Status */
@@ -1965,6 +1966,7 @@
1965#define MECR_NOS (1 << 0) /* Number Of Sockets: 0 -> 1 sock, 1 -> 2 sock */ 1966#define MECR_NOS (1 << 0) /* Number Of Sockets: 0 -> 1 sock, 1 -> 2 sock */
1966#define MECR_CIT (1 << 1) /* Card Is There: 0 -> no card, 1 -> card inserted */ 1967#define MECR_CIT (1 << 1) /* Card Is There: 0 -> no card, 1 -> card inserted */
1967 1968
1969#define MDREFR_K0DB4 (1 << 29) /* SDCLK0 Divide by 4 Control/Status */
1968#define MDREFR_K2FREE (1 << 25) /* SDRAM Free-Running Control */ 1970#define MDREFR_K2FREE (1 << 25) /* SDRAM Free-Running Control */
1969#define MDREFR_K1FREE (1 << 24) /* SDRAM Free-Running Control */ 1971#define MDREFR_K1FREE (1 << 24) /* SDRAM Free-Running Control */
1970#define MDREFR_K0FREE (1 << 23) /* SDRAM Free-Running Control */ 1972#define MDREFR_K0FREE (1 << 23) /* SDRAM Free-Running Control */
diff --git a/include/asm-arm/arch-sa1100/mtd-xip.h b/include/asm-arm/arch-sa1100/mtd-xip.h
new file mode 100644
index 00000000000..80cfdac2b94
--- /dev/null
+++ b/include/asm-arm/arch-sa1100/mtd-xip.h
@@ -0,0 +1,26 @@
1/*
2 * MTD primitives for XIP support. Architecture specific functions
3 *
4 * Do not include this file directly. It's included from linux/mtd/xip.h
5 *
6 * Author: Nicolas Pitre
7 * Created: Nov 2, 2004
8 * Copyright: (C) 2004 MontaVista Software, Inc.
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13 *
14 * $Id: xip.h,v 1.2 2004/12/01 15:49:10 nico Exp $
15 */
16
17#ifndef __ARCH_SA1100_MTD_XIP_H__
18#define __ARCH_SA1100_MTD_XIP_H__
19
20#define xip_irqpending() (ICIP & ICMR)
21
22/* we sample OSCR and convert desired delta to usec (1/4 ~= 1000000/3686400) */
23#define xip_currtime() (OSCR)
24#define xip_elapsed_since(x) (signed)((OSCR - (x)) / 4)
25
26#endif /* __ARCH_SA1100_MTD_XIP_H__ */
diff --git a/include/asm-arm/mach/arch.h b/include/asm-arm/mach/arch.h
index 3a32e929ec8..56c6bf4ab0c 100644
--- a/include/asm-arm/mach/arch.h
+++ b/include/asm-arm/mach/arch.h
@@ -26,7 +26,7 @@ struct machine_desc {
26 * page tabe entry */ 26 * page tabe entry */
27 27
28 const char *name; /* architecture name */ 28 const char *name; /* architecture name */
29 unsigned int param_offset; /* parameter page */ 29 unsigned long boot_params; /* tagged list */
30 30
31 unsigned int video_start; /* start of video RAM */ 31 unsigned int video_start; /* start of video RAM */
32 unsigned int video_end; /* end of video RAM */ 32 unsigned int video_end; /* end of video RAM */
@@ -54,38 +54,6 @@ const struct machine_desc __mach_desc_##_type \
54 .nr = MACH_TYPE_##_type, \ 54 .nr = MACH_TYPE_##_type, \
55 .name = _name, 55 .name = _name,
56 56
57#define MAINTAINER(n)
58
59#define BOOT_MEM(_pram,_pio,_vio) \
60 .phys_ram = _pram, \
61 .phys_io = _pio, \
62 .io_pg_offst = ((_vio)>>18)&0xfffc,
63
64#define BOOT_PARAMS(_params) \
65 .param_offset = _params,
66
67#define VIDEO(_start,_end) \
68 .video_start = _start, \
69 .video_end = _end,
70
71#define DISABLE_PARPORT(_n) \
72 .reserve_lp##_n = 1,
73
74#define SOFT_REBOOT \
75 .soft_reboot = 1,
76
77#define FIXUP(_func) \
78 .fixup = _func,
79
80#define MAPIO(_func) \
81 .map_io = _func,
82
83#define INITIRQ(_func) \
84 .init_irq = _func,
85
86#define INIT_MACHINE(_func) \
87 .init_machine = _func,
88
89#define MACHINE_END \ 57#define MACHINE_END \
90}; 58};
91 59
diff --git a/include/asm-arm/mtd-xip.h b/include/asm-arm/mtd-xip.h
new file mode 100644
index 00000000000..9eb127cc7db
--- /dev/null
+++ b/include/asm-arm/mtd-xip.h
@@ -0,0 +1,26 @@
1/*
2 * MTD primitives for XIP support. Architecture specific functions
3 *
4 * Do not include this file directly. It's included from linux/mtd/xip.h
5 *
6 * Author: Nicolas Pitre
7 * Created: Nov 2, 2004
8 * Copyright: (C) 2004 MontaVista Software, Inc.
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13 *
14 * $Id: xip.h,v 1.2 2004/12/01 15:49:10 nico Exp $
15 */
16
17#ifndef __ARM_MTD_XIP_H__
18#define __ARM_MTD_XIP_H__
19
20#include <asm/hardware.h>
21#include <asm/arch/mtd-xip.h>
22
23/* fill instruction prefetch */
24#define xip_iprefetch() do { asm volatile (".rep 8; nop; .endr"); } while (0)
25
26#endif /* __ARM_MTD_XIP_H__ */
diff --git a/include/asm-arm/pci.h b/include/asm-arm/pci.h
index e300646fe65..b28f1c95dd6 100644
--- a/include/asm-arm/pci.h
+++ b/include/asm-arm/pci.h
@@ -14,7 +14,7 @@ static inline void pcibios_set_master(struct pci_dev *dev)
14 /* No special bus mastering setup handling */ 14 /* No special bus mastering setup handling */
15} 15}
16 16
17static inline void pcibios_penalize_isa_irq(int irq) 17static inline void pcibios_penalize_isa_irq(int irq, int active)
18{ 18{
19 /* We don't do dynamic PCI IRQ allocation */ 19 /* We don't do dynamic PCI IRQ allocation */
20} 20}
diff --git a/include/asm-arm/stat.h b/include/asm-arm/stat.h
index ca8e7a8436d..ec4e2c2e3b4 100644
--- a/include/asm-arm/stat.h
+++ b/include/asm-arm/stat.h
@@ -89,6 +89,6 @@ struct stat64 {
89 unsigned long st_ctime_nsec; 89 unsigned long st_ctime_nsec;
90 90
91 unsigned long long st_ino; 91 unsigned long long st_ino;
92}; 92} __attribute__((packed));
93 93
94#endif 94#endif
diff --git a/include/asm-h8300/pci.h b/include/asm-h8300/pci.h
index d032729b19d..5edad5b70fd 100644
--- a/include/asm-h8300/pci.h
+++ b/include/asm-h8300/pci.h
@@ -15,7 +15,7 @@ extern inline void pcibios_set_master(struct pci_dev *dev)
15 /* No special bus mastering setup handling */ 15 /* No special bus mastering setup handling */
16} 16}
17 17
18extern inline void pcibios_penalize_isa_irq(int irq) 18extern inline void pcibios_penalize_isa_irq(int irq, int active)
19{ 19{
20 /* We don't do dynamic PCI IRQ allocation */ 20 /* We don't do dynamic PCI IRQ allocation */
21} 21}
diff --git a/include/asm-i386/acpi.h b/include/asm-i386/acpi.h
index c976c1dadec..cf828ace13f 100644
--- a/include/asm-i386/acpi.h
+++ b/include/asm-i386/acpi.h
@@ -28,6 +28,8 @@
28 28
29#ifdef __KERNEL__ 29#ifdef __KERNEL__
30 30
31#include <acpi/pdc_intel.h>
32
31#include <asm/system.h> /* defines cmpxchg */ 33#include <asm/system.h> /* defines cmpxchg */
32 34
33#define COMPILER_DEPENDENT_INT64 long long 35#define COMPILER_DEPENDENT_INT64 long long
@@ -101,12 +103,6 @@ __acpi_release_global_lock (unsigned int *lock)
101 :"=r"(n_hi), "=r"(n_lo) \ 103 :"=r"(n_hi), "=r"(n_lo) \
102 :"0"(n_hi), "1"(n_lo)) 104 :"0"(n_hi), "1"(n_lo))
103 105
104/*
105 * Refer Intel ACPI _PDC support document for bit definitions
106 */
107#define ACPI_PDC_EST_CAPABILITY_SMP 0xa
108#define ACPI_PDC_EST_CAPABILITY_MSR 0x1
109
110#ifdef CONFIG_ACPI_BOOT 106#ifdef CONFIG_ACPI_BOOT
111extern int acpi_lapic; 107extern int acpi_lapic;
112extern int acpi_ioapic; 108extern int acpi_ioapic;
@@ -185,6 +181,8 @@ extern void acpi_reserve_bootmem(void);
185 181
186extern u8 x86_acpiid_to_apicid[]; 182extern u8 x86_acpiid_to_apicid[];
187 183
184#define ARCH_HAS_POWER_PDC_INIT 1
185
188#endif /*__KERNEL__*/ 186#endif /*__KERNEL__*/
189 187
190#endif /*_ASM_ACPI_H*/ 188#endif /*_ASM_ACPI_H*/
diff --git a/include/asm-i386/apicdef.h b/include/asm-i386/apicdef.h
index 0fed5e3c699..a96a8f48fbf 100644
--- a/include/asm-i386/apicdef.h
+++ b/include/asm-i386/apicdef.h
@@ -109,11 +109,7 @@
109 109
110#define APIC_BASE (fix_to_virt(FIX_APIC_BASE)) 110#define APIC_BASE (fix_to_virt(FIX_APIC_BASE))
111 111
112#ifdef CONFIG_NUMA 112#define MAX_IO_APICS 64
113 #define MAX_IO_APICS 32
114#else
115 #define MAX_IO_APICS 8
116#endif
117 113
118/* 114/*
119 * the local APIC register structure, memory mapped. Not terribly well 115 * the local APIC register structure, memory mapped. Not terribly well
diff --git a/include/asm-i386/mmzone.h b/include/asm-i386/mmzone.h
index 33ce5d37e89..516421300ea 100644
--- a/include/asm-i386/mmzone.h
+++ b/include/asm-i386/mmzone.h
@@ -8,20 +8,15 @@
8 8
9#include <asm/smp.h> 9#include <asm/smp.h>
10 10
11#if CONFIG_NUMA 11#ifdef CONFIG_NUMA
12extern struct pglist_data *node_data[]; 12extern struct pglist_data *node_data[];
13#define NODE_DATA(nid) (node_data[nid]) 13#define NODE_DATA(nid) (node_data[nid])
14 14
15#ifdef CONFIG_NUMA 15#ifdef CONFIG_X86_NUMAQ
16 #ifdef CONFIG_X86_NUMAQ 16 #include <asm/numaq.h>
17 #include <asm/numaq.h> 17#else /* summit or generic arch */
18 #else /* summit or generic arch */ 18 #include <asm/srat.h>
19 #include <asm/srat.h> 19#endif
20 #endif
21#else /* !CONFIG_NUMA */
22 #define get_memcfg_numa get_memcfg_numa_flat
23 #define get_zholes_size(n) (0)
24#endif /* CONFIG_NUMA */
25 20
26extern int get_memcfg_numa_flat(void ); 21extern int get_memcfg_numa_flat(void );
27/* 22/*
@@ -42,6 +37,11 @@ static inline void get_memcfg_numa(void)
42 get_memcfg_numa_flat(); 37 get_memcfg_numa_flat();
43} 38}
44 39
40extern int early_pfn_to_nid(unsigned long pfn);
41
42#else /* !CONFIG_NUMA */
43#define get_memcfg_numa get_memcfg_numa_flat
44#define get_zholes_size(n) (0)
45#endif /* CONFIG_NUMA */ 45#endif /* CONFIG_NUMA */
46 46
47#ifdef CONFIG_DISCONTIGMEM 47#ifdef CONFIG_DISCONTIGMEM
@@ -151,6 +151,4 @@ static inline int pfn_valid(int pfn)
151 151
152#endif /* CONFIG_NEED_MULTIPLE_NODES */ 152#endif /* CONFIG_NEED_MULTIPLE_NODES */
153 153
154extern int early_pfn_to_nid(unsigned long pfn);
155
156#endif /* _ASM_MMZONE_H_ */ 154#endif /* _ASM_MMZONE_H_ */
diff --git a/include/asm-i386/pci.h b/include/asm-i386/pci.h
index 3561899eb82..78c85985aee 100644
--- a/include/asm-i386/pci.h
+++ b/include/asm-i386/pci.h
@@ -27,7 +27,7 @@ void pcibios_config_init(void);
27struct pci_bus * pcibios_scan_root(int bus); 27struct pci_bus * pcibios_scan_root(int bus);
28 28
29void pcibios_set_master(struct pci_dev *dev); 29void pcibios_set_master(struct pci_dev *dev);
30void pcibios_penalize_isa_irq(int irq); 30void pcibios_penalize_isa_irq(int irq, int active);
31struct irq_routing_table *pcibios_get_irq_routing_table(void); 31struct irq_routing_table *pcibios_get_irq_routing_table(void);
32int pcibios_set_irq_routing(struct pci_dev *dev, int pin, int irq); 32int pcibios_set_irq_routing(struct pci_dev *dev, int pin, int irq);
33 33
diff --git a/include/asm-i386/processor.h b/include/asm-i386/processor.h
index 6f0f93d0d41..5d06e6bd6ba 100644
--- a/include/asm-i386/processor.h
+++ b/include/asm-i386/processor.h
@@ -694,4 +694,12 @@ extern unsigned long boot_option_idle_override;
694extern void enable_sep_cpu(void); 694extern void enable_sep_cpu(void);
695extern int sysenter_setup(void); 695extern int sysenter_setup(void);
696 696
697#ifdef CONFIG_MTRR
698extern void mtrr_ap_init(void);
699extern void mtrr_bp_init(void);
700#else
701#define mtrr_ap_init() do {} while (0)
702#define mtrr_bp_init() do {} while (0)
703#endif
704
697#endif /* __ASM_I386_PROCESSOR_H */ 705#endif /* __ASM_I386_PROCESSOR_H */
diff --git a/include/asm-i386/unistd.h b/include/asm-i386/unistd.h
index e25e4c71a87..a7cb377745b 100644
--- a/include/asm-i386/unistd.h
+++ b/include/asm-i386/unistd.h
@@ -296,8 +296,11 @@
296#define __NR_keyctl 288 296#define __NR_keyctl 288
297#define __NR_ioprio_set 289 297#define __NR_ioprio_set 289
298#define __NR_ioprio_get 290 298#define __NR_ioprio_get 290
299#define __NR_inotify_init 291
300#define __NR_inotify_add_watch 292
301#define __NR_inotify_rm_watch 293
299 302
300#define NR_syscalls 291 303#define NR_syscalls 294
301 304
302/* 305/*
303 * user-visible error numbers are in the range -1 - -128: see 306 * user-visible error numbers are in the range -1 - -128: see
diff --git a/include/asm-ia64/acpi.h b/include/asm-ia64/acpi.h
index 6a26a977f25..4c06d455139 100644
--- a/include/asm-ia64/acpi.h
+++ b/include/asm-ia64/acpi.h
@@ -98,6 +98,15 @@ const char *acpi_get_sysname (void);
98int acpi_request_vector (u32 int_type); 98int acpi_request_vector (u32 int_type);
99int acpi_gsi_to_irq (u32 gsi, unsigned int *irq); 99int acpi_gsi_to_irq (u32 gsi, unsigned int *irq);
100 100
101/*
102 * Record the cpei override flag and current logical cpu. This is
103 * useful for CPU removal.
104 */
105extern unsigned int can_cpei_retarget(void);
106extern unsigned int is_cpu_cpei_target(unsigned int cpu);
107extern void set_cpei_target_cpu(unsigned int cpu);
108extern unsigned int get_cpei_target_cpu(void);
109
101#ifdef CONFIG_ACPI_NUMA 110#ifdef CONFIG_ACPI_NUMA
102/* Proximity bitmap length; _PXM is at most 255 (8 bit)*/ 111/* Proximity bitmap length; _PXM is at most 255 (8 bit)*/
103#define MAX_PXM_DOMAINS (256) 112#define MAX_PXM_DOMAINS (256)
diff --git a/include/asm-ia64/hw_irq.h b/include/asm-ia64/hw_irq.h
index cd4e06b74ab..041ab8c51a6 100644
--- a/include/asm-ia64/hw_irq.h
+++ b/include/asm-ia64/hw_irq.h
@@ -81,7 +81,6 @@ extern __u8 isa_irq_to_vector_map[16];
81 81
82extern struct hw_interrupt_type irq_type_ia64_lsapic; /* CPU-internal interrupt controller */ 82extern struct hw_interrupt_type irq_type_ia64_lsapic; /* CPU-internal interrupt controller */
83 83
84extern int assign_irq_vector_nopanic (int irq); /* allocate a free vector without panic */
85extern int assign_irq_vector (int irq); /* allocate a free vector */ 84extern int assign_irq_vector (int irq); /* allocate a free vector */
86extern void free_irq_vector (int vector); 85extern void free_irq_vector (int vector);
87extern void ia64_send_ipi (int cpu, int vector, int delivery_mode, int redirect); 86extern void ia64_send_ipi (int cpu, int vector, int delivery_mode, int redirect);
diff --git a/include/asm-ia64/pci.h b/include/asm-ia64/pci.h
index 0c4c5d801d3..f11771eadc4 100644
--- a/include/asm-ia64/pci.h
+++ b/include/asm-ia64/pci.h
@@ -47,7 +47,7 @@ pcibios_set_master (struct pci_dev *dev)
47} 47}
48 48
49static inline void 49static inline void
50pcibios_penalize_isa_irq (int irq) 50pcibios_penalize_isa_irq (int irq, int active)
51{ 51{
52 /* We don't do dynamic PCI IRQ allocation */ 52 /* We don't do dynamic PCI IRQ allocation */
53} 53}
diff --git a/include/asm-ia64/sn/arch.h b/include/asm-ia64/sn/arch.h
index 635fdce854a..ab827d29856 100644
--- a/include/asm-ia64/sn/arch.h
+++ b/include/asm-ia64/sn/arch.h
@@ -11,6 +11,7 @@
11#ifndef _ASM_IA64_SN_ARCH_H 11#ifndef _ASM_IA64_SN_ARCH_H
12#define _ASM_IA64_SN_ARCH_H 12#define _ASM_IA64_SN_ARCH_H
13 13
14#include <linux/numa.h>
14#include <asm/types.h> 15#include <asm/types.h>
15#include <asm/percpu.h> 16#include <asm/percpu.h>
16#include <asm/sn/types.h> 17#include <asm/sn/types.h>
diff --git a/include/asm-ia64/sn/intr.h b/include/asm-ia64/sn/intr.h
index e51471fb086..e190dd4213d 100644
--- a/include/asm-ia64/sn/intr.h
+++ b/include/asm-ia64/sn/intr.h
@@ -9,6 +9,8 @@
9#ifndef _ASM_IA64_SN_INTR_H 9#ifndef _ASM_IA64_SN_INTR_H
10#define _ASM_IA64_SN_INTR_H 10#define _ASM_IA64_SN_INTR_H
11 11
12#include <linux/rcupdate.h>
13
12#define SGI_UART_VECTOR (0xe9) 14#define SGI_UART_VECTOR (0xe9)
13#define SGI_PCIBR_ERROR (0x33) 15#define SGI_PCIBR_ERROR (0x33)
14 16
@@ -33,7 +35,7 @@
33 35
34// The SN PROM irq struct 36// The SN PROM irq struct
35struct sn_irq_info { 37struct sn_irq_info {
36 struct sn_irq_info *irq_next; /* sharing irq list */ 38 struct sn_irq_info *irq_next; /* deprecated DO NOT USE */
37 short irq_nasid; /* Nasid IRQ is assigned to */ 39 short irq_nasid; /* Nasid IRQ is assigned to */
38 int irq_slice; /* slice IRQ is assigned to */ 40 int irq_slice; /* slice IRQ is assigned to */
39 int irq_cpuid; /* kernel logical cpuid */ 41 int irq_cpuid; /* kernel logical cpuid */
@@ -47,6 +49,8 @@ struct sn_irq_info {
47 int irq_cookie; /* unique cookie */ 49 int irq_cookie; /* unique cookie */
48 int irq_flags; /* flags */ 50 int irq_flags; /* flags */
49 int irq_share_cnt; /* num devices sharing IRQ */ 51 int irq_share_cnt; /* num devices sharing IRQ */
52 struct list_head list; /* list of sn_irq_info structs */
53 struct rcu_head rcu; /* rcu callback list */
50}; 54};
51 55
52extern void sn_send_IPI_phys(int, long, int, int); 56extern void sn_send_IPI_phys(int, long, int, int);
diff --git a/include/asm-ia64/sn/pcibr_provider.h b/include/asm-ia64/sn/pcibr_provider.h
new file mode 100644
index 00000000000..f9b8d216400
--- /dev/null
+++ b/include/asm-ia64/sn/pcibr_provider.h
@@ -0,0 +1,159 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 1992-1997,2000-2004 Silicon Graphics, Inc. All rights reserved.
7 */
8#ifndef _ASM_IA64_SN_PCI_PCIBR_PROVIDER_H
9#define _ASM_IA64_SN_PCI_PCIBR_PROVIDER_H
10
11#include <asm/sn/intr.h>
12#include <asm/sn/pcibus_provider_defs.h>
13
14/* Workarounds */
15#define PV907516 (1 << 1) /* TIOCP: Don't write the write buffer flush reg */
16
17#define BUSTYPE_MASK 0x1
18
19/* Macros given a pcibus structure */
20#define IS_PCIX(ps) ((ps)->pbi_bridge_mode & BUSTYPE_MASK)
21#define IS_PCI_BRIDGE_ASIC(asic) (asic == PCIIO_ASIC_TYPE_PIC || \
22 asic == PCIIO_ASIC_TYPE_TIOCP)
23#define IS_PIC_SOFT(ps) (ps->pbi_bridge_type == PCIBR_BRIDGETYPE_PIC)
24
25
26/*
27 * The different PCI Bridge types supported on the SGI Altix platforms
28 */
29#define PCIBR_BRIDGETYPE_UNKNOWN -1
30#define PCIBR_BRIDGETYPE_PIC 2
31#define PCIBR_BRIDGETYPE_TIOCP 3
32
33/*
34 * Bridge 64bit Direct Map Attributes
35 */
36#define PCI64_ATTR_PREF (1ull << 59)
37#define PCI64_ATTR_PREC (1ull << 58)
38#define PCI64_ATTR_VIRTUAL (1ull << 57)
39#define PCI64_ATTR_BAR (1ull << 56)
40#define PCI64_ATTR_SWAP (1ull << 55)
41#define PCI64_ATTR_VIRTUAL1 (1ull << 54)
42
43#define PCI32_LOCAL_BASE 0
44#define PCI32_MAPPED_BASE 0x40000000
45#define PCI32_DIRECT_BASE 0x80000000
46
47#define IS_PCI32_MAPPED(x) ((uint64_t)(x) < PCI32_DIRECT_BASE && \
48 (uint64_t)(x) >= PCI32_MAPPED_BASE)
49#define IS_PCI32_DIRECT(x) ((uint64_t)(x) >= PCI32_MAPPED_BASE)
50
51
52/*
53 * Bridge PMU Address Transaltion Entry Attibutes
54 */
55#define PCI32_ATE_V (0x1 << 0)
56#define PCI32_ATE_CO (0x1 << 1)
57#define PCI32_ATE_PREC (0x1 << 2)
58#define PCI32_ATE_PREF (0x1 << 3)
59#define PCI32_ATE_BAR (0x1 << 4)
60#define PCI32_ATE_ADDR_SHFT 12
61
62#define MINIMAL_ATES_REQUIRED(addr, size) \
63 (IOPG(IOPGOFF(addr) + (size) - 1) == IOPG((size) - 1))
64
65#define MINIMAL_ATE_FLAG(addr, size) \
66 (MINIMAL_ATES_REQUIRED((uint64_t)addr, size) ? 1 : 0)
67
68/* bit 29 of the pci address is the SWAP bit */
69#define ATE_SWAPSHIFT 29
70#define ATE_SWAP_ON(x) ((x) |= (1 << ATE_SWAPSHIFT))
71#define ATE_SWAP_OFF(x) ((x) &= ~(1 << ATE_SWAPSHIFT))
72
73/*
74 * I/O page size
75 */
76#if PAGE_SIZE < 16384
77#define IOPFNSHIFT 12 /* 4K per mapped page */
78#else
79#define IOPFNSHIFT 14 /* 16K per mapped page */
80#endif
81
82#define IOPGSIZE (1 << IOPFNSHIFT)
83#define IOPG(x) ((x) >> IOPFNSHIFT)
84#define IOPGOFF(x) ((x) & (IOPGSIZE-1))
85
86#define PCIBR_DEV_SWAP_DIR (1ull << 19)
87#define PCIBR_CTRL_PAGE_SIZE (0x1 << 21)
88
89/*
90 * PMU resources.
91 */
92struct ate_resource{
93 uint64_t *ate;
94 uint64_t num_ate;
95 uint64_t lowest_free_index;
96};
97
98struct pcibus_info {
99 struct pcibus_bussoft pbi_buscommon; /* common header */
100 uint32_t pbi_moduleid;
101 short pbi_bridge_type;
102 short pbi_bridge_mode;
103
104 struct ate_resource pbi_int_ate_resource;
105 uint64_t pbi_int_ate_size;
106
107 uint64_t pbi_dir_xbase;
108 char pbi_hub_xid;
109
110 uint64_t pbi_devreg[8];
111
112 uint32_t pbi_valid_devices;
113 uint32_t pbi_enabled_devices;
114
115 spinlock_t pbi_lock;
116};
117
118/*
119 * pcibus_info structure locking macros
120 */
121inline static unsigned long
122pcibr_lock(struct pcibus_info *pcibus_info)
123{
124 unsigned long flag;
125 spin_lock_irqsave(&pcibus_info->pbi_lock, flag);
126 return(flag);
127}
128#define pcibr_unlock(pcibus_info, flag) spin_unlock_irqrestore(&pcibus_info->pbi_lock, flag)
129
130extern int pcibr_init_provider(void);
131extern void *pcibr_bus_fixup(struct pcibus_bussoft *);
132extern dma_addr_t pcibr_dma_map(struct pci_dev *, unsigned long, size_t);
133extern dma_addr_t pcibr_dma_map_consistent(struct pci_dev *, unsigned long, size_t);
134extern void pcibr_dma_unmap(struct pci_dev *, dma_addr_t, int);
135
136/*
137 * prototypes for the bridge asic register access routines in pcibr_reg.c
138 */
139extern void pcireg_control_bit_clr(struct pcibus_info *, uint64_t);
140extern void pcireg_control_bit_set(struct pcibus_info *, uint64_t);
141extern uint64_t pcireg_tflush_get(struct pcibus_info *);
142extern uint64_t pcireg_intr_status_get(struct pcibus_info *);
143extern void pcireg_intr_enable_bit_clr(struct pcibus_info *, uint64_t);
144extern void pcireg_intr_enable_bit_set(struct pcibus_info *, uint64_t);
145extern void pcireg_intr_addr_addr_set(struct pcibus_info *, int, uint64_t);
146extern void pcireg_force_intr_set(struct pcibus_info *, int);
147extern uint64_t pcireg_wrb_flush_get(struct pcibus_info *, int);
148extern void pcireg_int_ate_set(struct pcibus_info *, int, uint64_t);
149extern uint64_t * pcireg_int_ate_addr(struct pcibus_info *, int);
150extern void pcibr_force_interrupt(struct sn_irq_info *sn_irq_info);
151extern void pcibr_change_devices_irq(struct sn_irq_info *sn_irq_info);
152extern int pcibr_ate_alloc(struct pcibus_info *, int);
153extern void pcibr_ate_free(struct pcibus_info *, int);
154extern void ate_write(struct pcibus_info *, int, int, uint64_t);
155extern int sal_pcibr_slot_enable(struct pcibus_info *soft, int device,
156 void *resp);
157extern int sal_pcibr_slot_disable(struct pcibus_info *soft, int device,
158 int action, void *resp);
159#endif
diff --git a/include/asm-ia64/sn/pcidev.h b/include/asm-ia64/sn/pcidev.h
index ed4031d8081..49711d00ad0 100644
--- a/include/asm-ia64/sn/pcidev.h
+++ b/include/asm-ia64/sn/pcidev.h
@@ -10,11 +10,11 @@
10 10
11#include <linux/pci.h> 11#include <linux/pci.h>
12 12
13extern struct sn_irq_info **sn_irq;
14
15#define SN_PCIDEV_INFO(pci_dev) \ 13#define SN_PCIDEV_INFO(pci_dev) \
16 ((struct pcidev_info *)(pci_dev)->sysdata) 14 ((struct pcidev_info *)(pci_dev)->sysdata)
17 15
16#define SN_PCIBUS_BUSSOFT_INFO(pci_bus) \
17 (struct pcibus_info *)((struct pcibus_bussoft *)(PCI_CONTROLLER((pci_bus))->platform_data))
18/* 18/*
19 * Given a pci_bus, return the sn pcibus_bussoft struct. Note that 19 * Given a pci_bus, return the sn pcibus_bussoft struct. Note that
20 * this only works for root busses, not for busses represented by PPB's. 20 * this only works for root busses, not for busses represented by PPB's.
@@ -23,6 +23,8 @@ extern struct sn_irq_info **sn_irq;
23#define SN_PCIBUS_BUSSOFT(pci_bus) \ 23#define SN_PCIBUS_BUSSOFT(pci_bus) \
24 ((struct pcibus_bussoft *)(PCI_CONTROLLER((pci_bus))->platform_data)) 24 ((struct pcibus_bussoft *)(PCI_CONTROLLER((pci_bus))->platform_data))
25 25
26#define SN_PCIBUS_BUSSOFT_INFO(pci_bus) \
27 (struct pcibus_info *)((struct pcibus_bussoft *)(PCI_CONTROLLER((pci_bus))->platform_data))
26/* 28/*
27 * Given a struct pci_dev, return the sn pcibus_bussoft struct. Note 29 * Given a struct pci_dev, return the sn pcibus_bussoft struct. Note
28 * that this is not equivalent to SN_PCIBUS_BUSSOFT(pci_dev->bus) due 30 * that this is not equivalent to SN_PCIBUS_BUSSOFT(pci_dev->bus) due
@@ -50,9 +52,17 @@ struct pcidev_info {
50 52
51 struct sn_irq_info *pdi_sn_irq_info; 53 struct sn_irq_info *pdi_sn_irq_info;
52 struct sn_pcibus_provider *pdi_provider; /* sn pci ops */ 54 struct sn_pcibus_provider *pdi_provider; /* sn pci ops */
55 struct pci_dev *host_pci_dev; /* host bus link */
53}; 56};
54 57
55extern void sn_irq_fixup(struct pci_dev *pci_dev, 58extern void sn_irq_fixup(struct pci_dev *pci_dev,
56 struct sn_irq_info *sn_irq_info); 59 struct sn_irq_info *sn_irq_info);
57 60extern void sn_irq_unfixup(struct pci_dev *pci_dev);
61extern void sn_pci_controller_fixup(int segment, int busnum,
62 struct pci_bus *bus);
63extern void sn_bus_store_sysdata(struct pci_dev *dev);
64extern void sn_bus_free_sysdata(void);
65extern void sn_pci_fixup_slot(struct pci_dev *dev);
66extern void sn_pci_unfixup_slot(struct pci_dev *dev);
67extern void sn_irq_lh_init(void);
58#endif /* _ASM_IA64_SN_PCI_PCIDEV_H */ 68#endif /* _ASM_IA64_SN_PCI_PCIDEV_H */
diff --git a/include/asm-ia64/sn/pic.h b/include/asm-ia64/sn/pic.h
new file mode 100644
index 00000000000..0de82e6b089
--- /dev/null
+++ b/include/asm-ia64/sn/pic.h
@@ -0,0 +1,261 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 1992 - 1997, 2000-2003 Silicon Graphics, Inc. All rights reserved.
7 */
8#ifndef _ASM_IA64_SN_PCI_PIC_H
9#define _ASM_IA64_SN_PCI_PIC_H
10
11/*
12 * PIC AS DEVICE ZERO
13 * ------------------
14 *
15 * PIC handles PCI/X busses. PCI/X requires that the 'bridge' (i.e. PIC)
16 * be designated as 'device 0'. That is a departure from earlier SGI
17 * PCI bridges. Because of that we use config space 1 to access the
18 * config space of the first actual PCI device on the bus.
19 * Here's what the PIC manual says:
20 *
21 * The current PCI-X bus specification now defines that the parent
22 * hosts bus bridge (PIC for example) must be device 0 on bus 0. PIC
23 * reduced the total number of devices from 8 to 4 and removed the
24 * device registers and windows, now only supporting devices 0,1,2, and
25 * 3. PIC did leave all 8 configuration space windows. The reason was
26 * there was nothing to gain by removing them. Here in lies the problem.
27 * The device numbering we do using 0 through 3 is unrelated to the device
28 * numbering which PCI-X requires in configuration space. In the past we
29 * correlated Configs pace and our device space 0 <-> 0, 1 <-> 1, etc.
30 * PCI-X requires we start a 1, not 0 and currently the PX brick
31 * does associate our:
32 *
33 * device 0 with configuration space window 1,
34 * device 1 with configuration space window 2,
35 * device 2 with configuration space window 3,
36 * device 3 with configuration space window 4.
37 *
38 * The net effect is that all config space access are off-by-one with
39 * relation to other per-slot accesses on the PIC.
40 * Here is a table that shows some of that:
41 *
42 * Internal Slot#
43 * |
44 * | 0 1 2 3
45 * ----------|---------------------------------------
46 * config | 0x21000 0x22000 0x23000 0x24000
47 * |
48 * even rrb | 0[0] n/a 1[0] n/a [] == implied even/odd
49 * |
50 * odd rrb | n/a 0[1] n/a 1[1]
51 * |
52 * int dev | 00 01 10 11
53 * |
54 * ext slot# | 1 2 3 4
55 * ----------|---------------------------------------
56 */
57
58#define PIC_ATE_TARGETID_SHFT 8
59#define PIC_HOST_INTR_ADDR 0x0000FFFFFFFFFFFFUL
60#define PIC_PCI64_ATTR_TARG_SHFT 60
61
62
63/*****************************************************************************
64 *********************** PIC MMR structure mapping ***************************
65 *****************************************************************************/
66
67/* NOTE: PIC WAR. PV#854697. PIC does not allow writes just to [31:0]
68 * of a 64-bit register. When writing PIC registers, always write the
69 * entire 64 bits.
70 */
71
72struct pic {
73
74 /* 0x000000-0x00FFFF -- Local Registers */
75
76 /* 0x000000-0x000057 -- Standard Widget Configuration */
77 uint64_t p_wid_id; /* 0x000000 */
78 uint64_t p_wid_stat; /* 0x000008 */
79 uint64_t p_wid_err_upper; /* 0x000010 */
80 uint64_t p_wid_err_lower; /* 0x000018 */
81 #define p_wid_err p_wid_err_lower
82 uint64_t p_wid_control; /* 0x000020 */
83 uint64_t p_wid_req_timeout; /* 0x000028 */
84 uint64_t p_wid_int_upper; /* 0x000030 */
85 uint64_t p_wid_int_lower; /* 0x000038 */
86 #define p_wid_int p_wid_int_lower
87 uint64_t p_wid_err_cmdword; /* 0x000040 */
88 uint64_t p_wid_llp; /* 0x000048 */
89 uint64_t p_wid_tflush; /* 0x000050 */
90
91 /* 0x000058-0x00007F -- Bridge-specific Widget Configuration */
92 uint64_t p_wid_aux_err; /* 0x000058 */
93 uint64_t p_wid_resp_upper; /* 0x000060 */
94 uint64_t p_wid_resp_lower; /* 0x000068 */
95 #define p_wid_resp p_wid_resp_lower
96 uint64_t p_wid_tst_pin_ctrl; /* 0x000070 */
97 uint64_t p_wid_addr_lkerr; /* 0x000078 */
98
99 /* 0x000080-0x00008F -- PMU & MAP */
100 uint64_t p_dir_map; /* 0x000080 */
101 uint64_t _pad_000088; /* 0x000088 */
102
103 /* 0x000090-0x00009F -- SSRAM */
104 uint64_t p_map_fault; /* 0x000090 */
105 uint64_t _pad_000098; /* 0x000098 */
106
107 /* 0x0000A0-0x0000AF -- Arbitration */
108 uint64_t p_arb; /* 0x0000A0 */
109 uint64_t _pad_0000A8; /* 0x0000A8 */
110
111 /* 0x0000B0-0x0000BF -- Number In A Can or ATE Parity Error */
112 uint64_t p_ate_parity_err; /* 0x0000B0 */
113 uint64_t _pad_0000B8; /* 0x0000B8 */
114
115 /* 0x0000C0-0x0000FF -- PCI/GIO */
116 uint64_t p_bus_timeout; /* 0x0000C0 */
117 uint64_t p_pci_cfg; /* 0x0000C8 */
118 uint64_t p_pci_err_upper; /* 0x0000D0 */
119 uint64_t p_pci_err_lower; /* 0x0000D8 */
120 #define p_pci_err p_pci_err_lower
121 uint64_t _pad_0000E0[4]; /* 0x0000{E0..F8} */
122
123 /* 0x000100-0x0001FF -- Interrupt */
124 uint64_t p_int_status; /* 0x000100 */
125 uint64_t p_int_enable; /* 0x000108 */
126 uint64_t p_int_rst_stat; /* 0x000110 */
127 uint64_t p_int_mode; /* 0x000118 */
128 uint64_t p_int_device; /* 0x000120 */
129 uint64_t p_int_host_err; /* 0x000128 */
130 uint64_t p_int_addr[8]; /* 0x0001{30,,,68} */
131 uint64_t p_err_int_view; /* 0x000170 */
132 uint64_t p_mult_int; /* 0x000178 */
133 uint64_t p_force_always[8]; /* 0x0001{80,,,B8} */
134 uint64_t p_force_pin[8]; /* 0x0001{C0,,,F8} */
135
136 /* 0x000200-0x000298 -- Device */
137 uint64_t p_device[4]; /* 0x0002{00,,,18} */
138 uint64_t _pad_000220[4]; /* 0x0002{20,,,38} */
139 uint64_t p_wr_req_buf[4]; /* 0x0002{40,,,58} */
140 uint64_t _pad_000260[4]; /* 0x0002{60,,,78} */
141 uint64_t p_rrb_map[2]; /* 0x0002{80,,,88} */
142 #define p_even_resp p_rrb_map[0] /* 0x000280 */
143 #define p_odd_resp p_rrb_map[1] /* 0x000288 */
144 uint64_t p_resp_status; /* 0x000290 */
145 uint64_t p_resp_clear; /* 0x000298 */
146
147 uint64_t _pad_0002A0[12]; /* 0x0002{A0..F8} */
148
149 /* 0x000300-0x0003F8 -- Buffer Address Match Registers */
150 struct {
151 uint64_t upper; /* 0x0003{00,,,F0} */
152 uint64_t lower; /* 0x0003{08,,,F8} */
153 } p_buf_addr_match[16];
154
155 /* 0x000400-0x0005FF -- Performance Monitor Registers (even only) */
156 struct {
157 uint64_t flush_w_touch; /* 0x000{400,,,5C0} */
158 uint64_t flush_wo_touch; /* 0x000{408,,,5C8} */
159 uint64_t inflight; /* 0x000{410,,,5D0} */
160 uint64_t prefetch; /* 0x000{418,,,5D8} */
161 uint64_t total_pci_retry; /* 0x000{420,,,5E0} */
162 uint64_t max_pci_retry; /* 0x000{428,,,5E8} */
163 uint64_t max_latency; /* 0x000{430,,,5F0} */
164 uint64_t clear_all; /* 0x000{438,,,5F8} */
165 } p_buf_count[8];
166
167
168 /* 0x000600-0x0009FF -- PCI/X registers */
169 uint64_t p_pcix_bus_err_addr; /* 0x000600 */
170 uint64_t p_pcix_bus_err_attr; /* 0x000608 */
171 uint64_t p_pcix_bus_err_data; /* 0x000610 */
172 uint64_t p_pcix_pio_split_addr; /* 0x000618 */
173 uint64_t p_pcix_pio_split_attr; /* 0x000620 */
174 uint64_t p_pcix_dma_req_err_attr; /* 0x000628 */
175 uint64_t p_pcix_dma_req_err_addr; /* 0x000630 */
176 uint64_t p_pcix_timeout; /* 0x000638 */
177
178 uint64_t _pad_000640[120]; /* 0x000{640,,,9F8} */
179
180 /* 0x000A00-0x000BFF -- PCI/X Read&Write Buffer */
181 struct {
182 uint64_t p_buf_addr; /* 0x000{A00,,,AF0} */
183 uint64_t p_buf_attr; /* 0X000{A08,,,AF8} */
184 } p_pcix_read_buf_64[16];
185
186 struct {
187 uint64_t p_buf_addr; /* 0x000{B00,,,BE0} */
188 uint64_t p_buf_attr; /* 0x000{B08,,,BE8} */
189 uint64_t p_buf_valid; /* 0x000{B10,,,BF0} */
190 uint64_t __pad1; /* 0x000{B18,,,BF8} */
191 } p_pcix_write_buf_64[8];
192
193 /* End of Local Registers -- Start of Address Map space */
194
195 char _pad_000c00[0x010000 - 0x000c00];
196
197 /* 0x010000-0x011fff -- Internal ATE RAM (Auto Parity Generation) */
198 uint64_t p_int_ate_ram[1024]; /* 0x010000-0x011fff */
199
200 /* 0x012000-0x013fff -- Internal ATE RAM (Manual Parity Generation) */
201 uint64_t p_int_ate_ram_mp[1024]; /* 0x012000-0x013fff */
202
203 char _pad_014000[0x18000 - 0x014000];
204
205 /* 0x18000-0x197F8 -- PIC Write Request Ram */
206 uint64_t p_wr_req_lower[256]; /* 0x18000 - 0x187F8 */
207 uint64_t p_wr_req_upper[256]; /* 0x18800 - 0x18FF8 */
208 uint64_t p_wr_req_parity[256]; /* 0x19000 - 0x197F8 */
209
210 char _pad_019800[0x20000 - 0x019800];
211
212 /* 0x020000-0x027FFF -- PCI Device Configuration Spaces */
213 union {
214 uint8_t c[0x1000 / 1]; /* 0x02{0000,,,7FFF} */
215 uint16_t s[0x1000 / 2]; /* 0x02{0000,,,7FFF} */
216 uint32_t l[0x1000 / 4]; /* 0x02{0000,,,7FFF} */
217 uint64_t d[0x1000 / 8]; /* 0x02{0000,,,7FFF} */
218 union {
219 uint8_t c[0x100 / 1];
220 uint16_t s[0x100 / 2];
221 uint32_t l[0x100 / 4];
222 uint64_t d[0x100 / 8];
223 } f[8];
224 } p_type0_cfg_dev[8]; /* 0x02{0000,,,7FFF} */
225
226 /* 0x028000-0x028FFF -- PCI Type 1 Configuration Space */
227 union {
228 uint8_t c[0x1000 / 1]; /* 0x028000-0x029000 */
229 uint16_t s[0x1000 / 2]; /* 0x028000-0x029000 */
230 uint32_t l[0x1000 / 4]; /* 0x028000-0x029000 */
231 uint64_t d[0x1000 / 8]; /* 0x028000-0x029000 */
232 union {
233 uint8_t c[0x100 / 1];
234 uint16_t s[0x100 / 2];
235 uint32_t l[0x100 / 4];
236 uint64_t d[0x100 / 8];
237 } f[8];
238 } p_type1_cfg; /* 0x028000-0x029000 */
239
240 char _pad_029000[0x030000-0x029000];
241
242 /* 0x030000-0x030007 -- PCI Interrupt Acknowledge Cycle */
243 union {
244 uint8_t c[8 / 1];
245 uint16_t s[8 / 2];
246 uint32_t l[8 / 4];
247 uint64_t d[8 / 8];
248 } p_pci_iack; /* 0x030000-0x030007 */
249
250 char _pad_030007[0x040000-0x030008];
251
252 /* 0x040000-0x030007 -- PCIX Special Cycle */
253 union {
254 uint8_t c[8 / 1];
255 uint16_t s[8 / 2];
256 uint32_t l[8 / 4];
257 uint64_t d[8 / 8];
258 } p_pcix_cycle; /* 0x040000-0x040007 */
259};
260
261#endif /* _ASM_IA64_SN_PCI_PIC_H */
diff --git a/include/asm-ia64/sn/sn_cpuid.h b/include/asm-ia64/sn/sn_cpuid.h
index 20b30018766..d2c1d34dcce 100644
--- a/include/asm-ia64/sn/sn_cpuid.h
+++ b/include/asm-ia64/sn/sn_cpuid.h
@@ -81,11 +81,6 @@
81 * 81 *
82 */ 82 */
83 83
84#ifndef CONFIG_SMP
85#define cpu_physical_id(cpuid) ((ia64_getreg(_IA64_REG_CR_LID) >> 16) & 0xffff)
86#endif
87
88
89#define get_node_number(addr) NASID_GET(addr) 84#define get_node_number(addr) NASID_GET(addr)
90 85
91/* 86/*
diff --git a/include/asm-ia64/sn/sn_sal.h b/include/asm-ia64/sn/sn_sal.h
index 1455375d2ce..27976d22318 100644
--- a/include/asm-ia64/sn/sn_sal.h
+++ b/include/asm-ia64/sn/sn_sal.h
@@ -134,43 +134,28 @@
134 134
135#define SN_SAL_FAKE_PROM 0x02009999 135#define SN_SAL_FAKE_PROM 0x02009999
136 136
137
138/** 137/**
139 * sn_sal_rev_major - get the major SGI SAL revision number 138 * sn_sal_revision - get the SGI SAL revision number
140 * 139 *
141 * The SGI PROM stores its version in sal_[ab]_rev_(major|minor). 140 * The SGI PROM stores its version in the sal_[ab]_rev_(major|minor).
142 * This routine simply extracts the major value from the 141 * This routine simply extracts the major and minor values and
143 * @ia64_sal_systab structure constructed by ia64_sal_init(). 142 * presents them in a u32 format.
144 */ 143 *
145static inline int 144 * For example, version 4.05 would be represented at 0x0405.
146sn_sal_rev_major(void) 145 */
146static inline u32
147sn_sal_rev(void)
147{ 148{
148 struct ia64_sal_systab *systab = efi.sal_systab; 149 struct ia64_sal_systab *systab = efi.sal_systab;
149 150
150 return (int)systab->sal_b_rev_major; 151 return (u32)(systab->sal_b_rev_major << 8 | systab->sal_b_rev_minor);
151}
152
153/**
154 * sn_sal_rev_minor - get the minor SGI SAL revision number
155 *
156 * The SGI PROM stores its version in sal_[ab]_rev_(major|minor).
157 * This routine simply extracts the minor value from the
158 * @ia64_sal_systab structure constructed by ia64_sal_init().
159 */
160static inline int
161sn_sal_rev_minor(void)
162{
163 struct ia64_sal_systab *systab = efi.sal_systab;
164
165 return (int)systab->sal_b_rev_minor;
166} 152}
167 153
168/* 154/*
169 * Specify the minimum PROM revsion required for this kernel. 155 * Specify the minimum PROM revsion required for this kernel.
170 * Note that they're stored in hex format... 156 * Note that they're stored in hex format...
171 */ 157 */
172#define SN_SAL_MIN_MAJOR 0x4 /* SN2 kernels need at least PROM 4.0 */ 158#define SN_SAL_MIN_VERSION 0x0404
173#define SN_SAL_MIN_MINOR 0x0
174 159
175/* 160/*
176 * Returns the master console nasid, if the call fails, return an illegal 161 * Returns the master console nasid, if the call fails, return an illegal
diff --git a/include/asm-ia64/sn/tiocp.h b/include/asm-ia64/sn/tiocp.h
new file mode 100644
index 00000000000..5f2489c9d2d
--- /dev/null
+++ b/include/asm-ia64/sn/tiocp.h
@@ -0,0 +1,256 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 2003-2004 Silicon Graphics, Inc. All rights reserved.
7 */
8#ifndef _ASM_IA64_SN_PCI_TIOCP_H
9#define _ASM_IA64_SN_PCI_TIOCP_H
10
11#define TIOCP_HOST_INTR_ADDR 0x003FFFFFFFFFFFFFUL
12#define TIOCP_PCI64_CMDTYPE_MEM (0x1ull << 60)
13
14
15/*****************************************************************************
16 *********************** TIOCP MMR structure mapping ***************************
17 *****************************************************************************/
18
19struct tiocp{
20
21 /* 0x000000-0x00FFFF -- Local Registers */
22
23 /* 0x000000-0x000057 -- (Legacy Widget Space) Configuration */
24 uint64_t cp_id; /* 0x000000 */
25 uint64_t cp_stat; /* 0x000008 */
26 uint64_t cp_err_upper; /* 0x000010 */
27 uint64_t cp_err_lower; /* 0x000018 */
28 #define cp_err cp_err_lower
29 uint64_t cp_control; /* 0x000020 */
30 uint64_t cp_req_timeout; /* 0x000028 */
31 uint64_t cp_intr_upper; /* 0x000030 */
32 uint64_t cp_intr_lower; /* 0x000038 */
33 #define cp_intr cp_intr_lower
34 uint64_t cp_err_cmdword; /* 0x000040 */
35 uint64_t _pad_000048; /* 0x000048 */
36 uint64_t cp_tflush; /* 0x000050 */
37
38 /* 0x000058-0x00007F -- Bridge-specific Configuration */
39 uint64_t cp_aux_err; /* 0x000058 */
40 uint64_t cp_resp_upper; /* 0x000060 */
41 uint64_t cp_resp_lower; /* 0x000068 */
42 #define cp_resp cp_resp_lower
43 uint64_t cp_tst_pin_ctrl; /* 0x000070 */
44 uint64_t cp_addr_lkerr; /* 0x000078 */
45
46 /* 0x000080-0x00008F -- PMU & MAP */
47 uint64_t cp_dir_map; /* 0x000080 */
48 uint64_t _pad_000088; /* 0x000088 */
49
50 /* 0x000090-0x00009F -- SSRAM */
51 uint64_t cp_map_fault; /* 0x000090 */
52 uint64_t _pad_000098; /* 0x000098 */
53
54 /* 0x0000A0-0x0000AF -- Arbitration */
55 uint64_t cp_arb; /* 0x0000A0 */
56 uint64_t _pad_0000A8; /* 0x0000A8 */
57
58 /* 0x0000B0-0x0000BF -- Number In A Can or ATE Parity Error */
59 uint64_t cp_ate_parity_err; /* 0x0000B0 */
60 uint64_t _pad_0000B8; /* 0x0000B8 */
61
62 /* 0x0000C0-0x0000FF -- PCI/GIO */
63 uint64_t cp_bus_timeout; /* 0x0000C0 */
64 uint64_t cp_pci_cfg; /* 0x0000C8 */
65 uint64_t cp_pci_err_upper; /* 0x0000D0 */
66 uint64_t cp_pci_err_lower; /* 0x0000D8 */
67 #define cp_pci_err cp_pci_err_lower
68 uint64_t _pad_0000E0[4]; /* 0x0000{E0..F8} */
69
70 /* 0x000100-0x0001FF -- Interrupt */
71 uint64_t cp_int_status; /* 0x000100 */
72 uint64_t cp_int_enable; /* 0x000108 */
73 uint64_t cp_int_rst_stat; /* 0x000110 */
74 uint64_t cp_int_mode; /* 0x000118 */
75 uint64_t cp_int_device; /* 0x000120 */
76 uint64_t cp_int_host_err; /* 0x000128 */
77 uint64_t cp_int_addr[8]; /* 0x0001{30,,,68} */
78 uint64_t cp_err_int_view; /* 0x000170 */
79 uint64_t cp_mult_int; /* 0x000178 */
80 uint64_t cp_force_always[8]; /* 0x0001{80,,,B8} */
81 uint64_t cp_force_pin[8]; /* 0x0001{C0,,,F8} */
82
83 /* 0x000200-0x000298 -- Device */
84 uint64_t cp_device[4]; /* 0x0002{00,,,18} */
85 uint64_t _pad_000220[4]; /* 0x0002{20,,,38} */
86 uint64_t cp_wr_req_buf[4]; /* 0x0002{40,,,58} */
87 uint64_t _pad_000260[4]; /* 0x0002{60,,,78} */
88 uint64_t cp_rrb_map[2]; /* 0x0002{80,,,88} */
89 #define cp_even_resp cp_rrb_map[0] /* 0x000280 */
90 #define cp_odd_resp cp_rrb_map[1] /* 0x000288 */
91 uint64_t cp_resp_status; /* 0x000290 */
92 uint64_t cp_resp_clear; /* 0x000298 */
93
94 uint64_t _pad_0002A0[12]; /* 0x0002{A0..F8} */
95
96 /* 0x000300-0x0003F8 -- Buffer Address Match Registers */
97 struct {
98 uint64_t upper; /* 0x0003{00,,,F0} */
99 uint64_t lower; /* 0x0003{08,,,F8} */
100 } cp_buf_addr_match[16];
101
102 /* 0x000400-0x0005FF -- Performance Monitor Registers (even only) */
103 struct {
104 uint64_t flush_w_touch; /* 0x000{400,,,5C0} */
105 uint64_t flush_wo_touch; /* 0x000{408,,,5C8} */
106 uint64_t inflight; /* 0x000{410,,,5D0} */
107 uint64_t prefetch; /* 0x000{418,,,5D8} */
108 uint64_t total_pci_retry; /* 0x000{420,,,5E0} */
109 uint64_t max_pci_retry; /* 0x000{428,,,5E8} */
110 uint64_t max_latency; /* 0x000{430,,,5F0} */
111 uint64_t clear_all; /* 0x000{438,,,5F8} */
112 } cp_buf_count[8];
113
114
115 /* 0x000600-0x0009FF -- PCI/X registers */
116 uint64_t cp_pcix_bus_err_addr; /* 0x000600 */
117 uint64_t cp_pcix_bus_err_attr; /* 0x000608 */
118 uint64_t cp_pcix_bus_err_data; /* 0x000610 */
119 uint64_t cp_pcix_pio_split_addr; /* 0x000618 */
120 uint64_t cp_pcix_pio_split_attr; /* 0x000620 */
121 uint64_t cp_pcix_dma_req_err_attr; /* 0x000628 */
122 uint64_t cp_pcix_dma_req_err_addr; /* 0x000630 */
123 uint64_t cp_pcix_timeout; /* 0x000638 */
124
125 uint64_t _pad_000640[24]; /* 0x000{640,,,6F8} */
126
127 /* 0x000700-0x000737 -- Debug Registers */
128 uint64_t cp_ct_debug_ctl; /* 0x000700 */
129 uint64_t cp_br_debug_ctl; /* 0x000708 */
130 uint64_t cp_mux3_debug_ctl; /* 0x000710 */
131 uint64_t cp_mux4_debug_ctl; /* 0x000718 */
132 uint64_t cp_mux5_debug_ctl; /* 0x000720 */
133 uint64_t cp_mux6_debug_ctl; /* 0x000728 */
134 uint64_t cp_mux7_debug_ctl; /* 0x000730 */
135
136 uint64_t _pad_000738[89]; /* 0x000{738,,,9F8} */
137
138 /* 0x000A00-0x000BFF -- PCI/X Read&Write Buffer */
139 struct {
140 uint64_t cp_buf_addr; /* 0x000{A00,,,AF0} */
141 uint64_t cp_buf_attr; /* 0X000{A08,,,AF8} */
142 } cp_pcix_read_buf_64[16];
143
144 struct {
145 uint64_t cp_buf_addr; /* 0x000{B00,,,BE0} */
146 uint64_t cp_buf_attr; /* 0x000{B08,,,BE8} */
147 uint64_t cp_buf_valid; /* 0x000{B10,,,BF0} */
148 uint64_t __pad1; /* 0x000{B18,,,BF8} */
149 } cp_pcix_write_buf_64[8];
150
151 /* End of Local Registers -- Start of Address Map space */
152
153 char _pad_000c00[0x010000 - 0x000c00];
154
155 /* 0x010000-0x011FF8 -- Internal ATE RAM (Auto Parity Generation) */
156 uint64_t cp_int_ate_ram[1024]; /* 0x010000-0x011FF8 */
157
158 char _pad_012000[0x14000 - 0x012000];
159
160 /* 0x014000-0x015FF8 -- Internal ATE RAM (Manual Parity Generation) */
161 uint64_t cp_int_ate_ram_mp[1024]; /* 0x014000-0x015FF8 */
162
163 char _pad_016000[0x18000 - 0x016000];
164
165 /* 0x18000-0x197F8 -- TIOCP Write Request Ram */
166 uint64_t cp_wr_req_lower[256]; /* 0x18000 - 0x187F8 */
167 uint64_t cp_wr_req_upper[256]; /* 0x18800 - 0x18FF8 */
168 uint64_t cp_wr_req_parity[256]; /* 0x19000 - 0x197F8 */
169
170 char _pad_019800[0x1C000 - 0x019800];
171
172 /* 0x1C000-0x1EFF8 -- TIOCP Read Response Ram */
173 uint64_t cp_rd_resp_lower[512]; /* 0x1C000 - 0x1CFF8 */
174 uint64_t cp_rd_resp_upper[512]; /* 0x1D000 - 0x1DFF8 */
175 uint64_t cp_rd_resp_parity[512]; /* 0x1E000 - 0x1EFF8 */
176
177 char _pad_01F000[0x20000 - 0x01F000];
178
179 /* 0x020000-0x021FFF -- Host Device (CP) Configuration Space (not used) */
180 char _pad_020000[0x021000 - 0x20000];
181
182 /* 0x021000-0x027FFF -- PCI Device Configuration Spaces */
183 union {
184 uint8_t c[0x1000 / 1]; /* 0x02{0000,,,7FFF} */
185 uint16_t s[0x1000 / 2]; /* 0x02{0000,,,7FFF} */
186 uint32_t l[0x1000 / 4]; /* 0x02{0000,,,7FFF} */
187 uint64_t d[0x1000 / 8]; /* 0x02{0000,,,7FFF} */
188 union {
189 uint8_t c[0x100 / 1];
190 uint16_t s[0x100 / 2];
191 uint32_t l[0x100 / 4];
192 uint64_t d[0x100 / 8];
193 } f[8];
194 } cp_type0_cfg_dev[7]; /* 0x02{1000,,,7FFF} */
195
196 /* 0x028000-0x028FFF -- PCI Type 1 Configuration Space */
197 union {
198 uint8_t c[0x1000 / 1]; /* 0x028000-0x029000 */
199 uint16_t s[0x1000 / 2]; /* 0x028000-0x029000 */
200 uint32_t l[0x1000 / 4]; /* 0x028000-0x029000 */
201 uint64_t d[0x1000 / 8]; /* 0x028000-0x029000 */
202 union {
203 uint8_t c[0x100 / 1];
204 uint16_t s[0x100 / 2];
205 uint32_t l[0x100 / 4];
206 uint64_t d[0x100 / 8];
207 } f[8];
208 } cp_type1_cfg; /* 0x028000-0x029000 */
209
210 char _pad_029000[0x030000-0x029000];
211
212 /* 0x030000-0x030007 -- PCI Interrupt Acknowledge Cycle */
213 union {
214 uint8_t c[8 / 1];
215 uint16_t s[8 / 2];
216 uint32_t l[8 / 4];
217 uint64_t d[8 / 8];
218 } cp_pci_iack; /* 0x030000-0x030007 */
219
220 char _pad_030007[0x040000-0x030008];
221
222 /* 0x040000-0x040007 -- PCIX Special Cycle */
223 union {
224 uint8_t c[8 / 1];
225 uint16_t s[8 / 2];
226 uint32_t l[8 / 4];
227 uint64_t d[8 / 8];
228 } cp_pcix_cycle; /* 0x040000-0x040007 */
229
230 char _pad_040007[0x200000-0x040008];
231
232 /* 0x200000-0x7FFFFF -- PCI/GIO Device Spaces */
233 union {
234 uint8_t c[0x100000 / 1];
235 uint16_t s[0x100000 / 2];
236 uint32_t l[0x100000 / 4];
237 uint64_t d[0x100000 / 8];
238 } cp_devio_raw[6]; /* 0x200000-0x7FFFFF */
239
240 #define cp_devio(n) cp_devio_raw[((n)<2)?(n*2):(n+2)]
241
242 char _pad_800000[0xA00000-0x800000];
243
244 /* 0xA00000-0xBFFFFF -- PCI/GIO Device Spaces w/flush */
245 union {
246 uint8_t c[0x100000 / 1];
247 uint16_t s[0x100000 / 2];
248 uint32_t l[0x100000 / 4];
249 uint64_t d[0x100000 / 8];
250 } cp_devio_raw_flush[6]; /* 0xA00000-0xBFFFFF */
251
252 #define cp_devio_flush(n) cp_devio_raw_flush[((n)<2)?(n*2):(n+2)]
253
254};
255
256#endif /* _ASM_IA64_SN_PCI_TIOCP_H */
diff --git a/include/asm-ia64/sn/xp.h b/include/asm-ia64/sn/xp.h
index 9902185c028..1df1c9f61a6 100644
--- a/include/asm-ia64/sn/xp.h
+++ b/include/asm-ia64/sn/xp.h
@@ -16,7 +16,6 @@
16#define _ASM_IA64_SN_XP_H 16#define _ASM_IA64_SN_XP_H
17 17
18 18
19#include <linux/version.h>
20#include <linux/cache.h> 19#include <linux/cache.h>
21#include <linux/hardirq.h> 20#include <linux/hardirq.h>
22#include <asm/sn/types.h> 21#include <asm/sn/types.h>
diff --git a/include/asm-m32r/s1d13806.h b/include/asm-m32r/s1d13806.h
new file mode 100644
index 00000000000..248d36a82d7
--- /dev/null
+++ b/include/asm-m32r/s1d13806.h
@@ -0,0 +1,199 @@
1//----------------------------------------------------------------------------
2//
3// File generated by S1D13806CFG.EXE
4//
5// Copyright (c) 2000,2001 Epson Research and Development, Inc.
6// All rights reserved.
7//
8//----------------------------------------------------------------------------
9
10// Panel: (active) 640x480 77Hz STN Single 8-bit (PCLK=CLKI=25.175MHz)
11// Memory: Embedded SDRAM (MCLK=CLKI3=50.000MHz) (BUSCLK=33.333MHz)
12
13#define SWIVEL_VIEW 0 /* 0:none, 1:90 not completed */
14
15static struct s1d13xxxfb_regval s1d13xxxfb_initregs[] = {
16
17 {0x0001,0x00}, // Miscellaneous Register
18 {0x01FC,0x00}, // Display Mode Register
19#if defined(CONFIG_PLAT_MAPPI)
20 {0x0004,0x00}, // General IO Pins Configuration Register 0
21 {0x0005,0x00}, // General IO Pins Configuration Register 1
22 {0x0008,0x00}, // General IO Pins Control Register 0
23 {0x0009,0x00}, // General IO Pins Control Register 1
24 {0x0010,0x00}, // Memory Clock Configuration Register
25 {0x0014,0x00}, // LCD Pixel Clock Configuration Register
26 {0x0018,0x00}, // CRT/TV Pixel Clock Configuration Register
27 {0x001C,0x00}, // MediaPlug Clock Configuration Register
28/*
29 * .. 10MHz: 0x00
30 * .. 30MHz: 0x01
31 * 30MHz ..: 0x02
32 */
33 {0x001E,0x02}, // CPU To Memory Wait State Select Register
34 {0x0021,0x02}, // DRAM Refresh Rate Register
35 {0x002A,0x11}, // DRAM Timings Control Register 0
36 {0x002B,0x13}, // DRAM Timings Control Register 1
37 {0x0020,0x80}, // Memory Configuration Register
38 {0x0030,0x25}, // Panel Type Register
39 {0x0031,0x00}, // MOD Rate Register
40 {0x0032,0x4F}, // LCD Horizontal Display Width Register
41 {0x0034,0x12}, // LCD Horizontal Non-Display Period Register
42 {0x0035,0x01}, // TFT FPLINE Start Position Register
43 {0x0036,0x0B}, // TFT FPLINE Pulse Width Register
44 {0x0038,0xDF}, // LCD Vertical Display Height Register 0
45 {0x0039,0x01}, // LCD Vertical Display Height Register 1
46 {0x003A,0x2C}, // LCD Vertical Non-Display Period Register
47 {0x003B,0x0A}, // TFT FPFRAME Start Position Register
48 {0x003C,0x01}, // TFT FPFRAME Pulse Width Register
49
50 {0x0041,0x00}, // LCD Miscellaneous Register
51 {0x0042,0x00}, // LCD Display Start Address Register 0
52 {0x0043,0x00}, // LCD Display Start Address Register 1
53 {0x0044,0x00}, // LCD Display Start Address Register 2
54
55#elif defined(CONFIG_PLAT_M32700UT) || defined(CONFIG_PLAT_OPSPUT) || defined(CONFIG_PLAT_MAPPI3)
56 {0x0004,0x07}, // GPIO[0:7] direction
57 {0x0005,0x00}, // GPIO[8:12] direction
58 {0x0008,0x00}, // GPIO[0:7] data
59 {0x0009,0x00}, // GPIO[8:12] data
60 {0x0008,0x04}, // LCD panel Vcc on
61 {0x0008,0x05}, // LCD panel reset
62 {0x0010,0x01}, // Memory Clock Configuration Register
63 {0x0014,0x30}, // LCD Pixel Clock Configuration Register (CLKI 22MHz/4)
64 {0x0018,0x00}, // CRT/TV Pixel Clock Configuration Register
65 {0x001C,0x00}, // MediaPlug Clock Configuration Register(10MHz)
66 {0x001E,0x00}, // CPU To Memory Wait State Select Register
67 {0x0020,0x80}, // Memory Configuration Register
68 {0x0021,0x03}, // DRAM Refresh Rate Register
69 {0x002A,0x00}, // DRAM Timings Control Register 0
70 {0x002B,0x01}, // DRAM Timings Control Register 1
71 {0x0030,0x25}, // Panel Type Register
72 {0x0031,0x00}, // MOD Rate Register
73 {0x0032,0x1d}, // LCD Horizontal Display Width Register
74 {0x0034,0x05}, // LCD Horizontal Non-Display Period Register
75 {0x0035,0x01}, // TFT FPLINE Start Position Register
76 {0x0036,0x01}, // TFT FPLINE Pulse Width Register
77 {0x0038,0x3F}, // LCD Vertical Display Height Register 0
78 {0x0039,0x01}, // LCD Vertical Display Height Register 1
79 {0x003A,0x0b}, // LCD Vertical Non-Display Period Register
80 {0x003B,0x07}, // TFT FPFRAME Start Position Register
81 {0x003C,0x02}, // TFT FPFRAME Pulse Width Register
82
83 {0x0041,0x00}, // LCD Miscellaneous Register
84#if (SWIVEL_VIEW == 0)
85 {0x0042,0x00}, // LCD Display Start Address Register 0
86 {0x0043,0x00}, // LCD Display Start Address Register 1
87 {0x0044,0x00}, // LCD Display Start Address Register 2
88
89#elif (SWIVEL_VIEW == 1)
90 // 1024 - W(320) = 0x2C0
91 {0x0042,0xC0}, // LCD Display Start Address Register 0
92 {0x0043,0x02}, // LCD Display Start Address Register 1
93 {0x0044,0x00}, // LCD Display Start Address Register 2
94 // 1024
95 {0x0046,0x00}, // LCD Memory Address Offset Register 0
96 {0x0047,0x02}, // LCD Memory Address Offset Register 1
97#else
98#error unsupported SWIVEL_VIEW mode
99#endif
100#else
101#error no platform configuration
102#endif /* CONFIG_PLAT_XXX */
103
104 {0x0048,0x00}, // LCD Pixel Panning Register
105 {0x004A,0x00}, // LCD Display FIFO High Threshold Control Register
106 {0x004B,0x00}, // LCD Display FIFO Low Threshold Control Register
107 {0x0050,0x4F}, // CRT/TV Horizontal Display Width Register
108 {0x0052,0x13}, // CRT/TV Horizontal Non-Display Period Register
109 {0x0053,0x01}, // CRT/TV HRTC Start Position Register
110 {0x0054,0x0B}, // CRT/TV HRTC Pulse Width Register
111 {0x0056,0xDF}, // CRT/TV Vertical Display Height Register 0
112 {0x0057,0x01}, // CRT/TV Vertical Display Height Register 1
113 {0x0058,0x2B}, // CRT/TV Vertical Non-Display Period Register
114 {0x0059,0x09}, // CRT/TV VRTC Start Position Register
115 {0x005A,0x01}, // CRT/TV VRTC Pulse Width Register
116 {0x005B,0x10}, // TV Output Control Register
117
118 {0x0062,0x00}, // CRT/TV Display Start Address Register 0
119 {0x0063,0x00}, // CRT/TV Display Start Address Register 1
120 {0x0064,0x00}, // CRT/TV Display Start Address Register 2
121
122 {0x0068,0x00}, // CRT/TV Pixel Panning Register
123 {0x006A,0x00}, // CRT/TV Display FIFO High Threshold Control Register
124 {0x006B,0x00}, // CRT/TV Display FIFO Low Threshold Control Register
125 {0x0070,0x00}, // LCD Ink/Cursor Control Register
126 {0x0071,0x01}, // LCD Ink/Cursor Start Address Register
127 {0x0072,0x00}, // LCD Cursor X Position Register 0
128 {0x0073,0x00}, // LCD Cursor X Position Register 1
129 {0x0074,0x00}, // LCD Cursor Y Position Register 0
130 {0x0075,0x00}, // LCD Cursor Y Position Register 1
131 {0x0076,0x00}, // LCD Ink/Cursor Blue Color 0 Register
132 {0x0077,0x00}, // LCD Ink/Cursor Green Color 0 Register
133 {0x0078,0x00}, // LCD Ink/Cursor Red Color 0 Register
134 {0x007A,0x1F}, // LCD Ink/Cursor Blue Color 1 Register
135 {0x007B,0x3F}, // LCD Ink/Cursor Green Color 1 Register
136 {0x007C,0x1F}, // LCD Ink/Cursor Red Color 1 Register
137 {0x007E,0x00}, // LCD Ink/Cursor FIFO Threshold Register
138 {0x0080,0x00}, // CRT/TV Ink/Cursor Control Register
139 {0x0081,0x01}, // CRT/TV Ink/Cursor Start Address Register
140 {0x0082,0x00}, // CRT/TV Cursor X Position Register 0
141 {0x0083,0x00}, // CRT/TV Cursor X Position Register 1
142 {0x0084,0x00}, // CRT/TV Cursor Y Position Register 0
143 {0x0085,0x00}, // CRT/TV Cursor Y Position Register 1
144 {0x0086,0x00}, // CRT/TV Ink/Cursor Blue Color 0 Register
145 {0x0087,0x00}, // CRT/TV Ink/Cursor Green Color 0 Register
146 {0x0088,0x00}, // CRT/TV Ink/Cursor Red Color 0 Register
147 {0x008A,0x1F}, // CRT/TV Ink/Cursor Blue Color 1 Register
148 {0x008B,0x3F}, // CRT/TV Ink/Cursor Green Color 1 Register
149 {0x008C,0x1F}, // CRT/TV Ink/Cursor Red Color 1 Register
150 {0x008E,0x00}, // CRT/TV Ink/Cursor FIFO Threshold Register
151 {0x0100,0x00}, // BitBlt Control Register 0
152 {0x0101,0x00}, // BitBlt Control Register 1
153 {0x0102,0x00}, // BitBlt ROP Code/Color Expansion Register
154 {0x0103,0x00}, // BitBlt Operation Register
155 {0x0104,0x00}, // BitBlt Source Start Address Register 0
156 {0x0105,0x00}, // BitBlt Source Start Address Register 1
157 {0x0106,0x00}, // BitBlt Source Start Address Register 2
158 {0x0108,0x00}, // BitBlt Destination Start Address Register 0
159 {0x0109,0x00}, // BitBlt Destination Start Address Register 1
160 {0x010A,0x00}, // BitBlt Destination Start Address Register 2
161 {0x010C,0x00}, // BitBlt Memory Address Offset Register 0
162 {0x010D,0x00}, // BitBlt Memory Address Offset Register 1
163 {0x0110,0x00}, // BitBlt Width Register 0
164 {0x0111,0x00}, // BitBlt Width Register 1
165 {0x0112,0x00}, // BitBlt Height Register 0
166 {0x0113,0x00}, // BitBlt Height Register 1
167 {0x0114,0x00}, // BitBlt Background Color Register 0
168 {0x0115,0x00}, // BitBlt Background Color Register 1
169 {0x0118,0x00}, // BitBlt Foreground Color Register 0
170 {0x0119,0x00}, // BitBlt Foreground Color Register 1
171 {0x01E0,0x00}, // Look-Up Table Mode Register
172 {0x01E2,0x00}, // Look-Up Table Address Register
173 {0x01F0,0x10}, // Power Save Configuration Register
174 {0x01F1,0x00}, // Power Save Status Register
175 {0x01F4,0x00}, // CPU-to-Memory Access Watchdog Timer Register
176#if (SWIVEL_VIEW == 0)
177 {0x01FC,0x01}, // Display Mode Register(0x01:LCD, 0x02:CRT, 0x03:LCD&CRT)
178#elif (SWIVEL_VIEW == 1)
179 {0x01FC,0x41}, // Display Mode Register(0x01:LCD, 0x02:CRT, 0x03:LCD&CRT)
180#else
181#error unsupported SWIVEL_VIEW mode
182#endif /* SWIVEL_VIEW */
183
184#if defined(CONFIG_PLAT_M32700UT) || defined(CONFIG_PLAT_OPSPUT) || defined(CONFIG_PLAT_MAPPI3)
185 {0x0008,0x07}, // LCD panel Vdd & Vg on
186#endif
187
188 {0x0040,0x05}, // LCD Display Mode Register (2:4bpp,3:8bpp,5:16bpp)
189#if defined(CONFIG_PLAT_MAPPI)
190 {0x0046,0x80}, // LCD Memory Address Offset Register 0
191 {0x0047,0x02}, // LCD Memory Address Offset Register 1
192#elif defined(CONFIG_PLAT_M32700UT) || defined(CONFIG_PLAT_OPSPUT) || defined(CONFIG_PLAT_MAPPI3)
193 {0x0046,0xf0}, // LCD Memory Address Offset Register 0
194 {0x0047,0x00}, // LCD Memory Address Offset Register 1
195#endif
196 {0x0060,0x05}, // CRT/TV Display Mode Register (2:4bpp,3:8bpp,5:16bpp)
197 {0x0066,0x80}, // CRT/TV Memory Address Offset Register 0 // takeo
198 {0x0067,0x02}, // CRT/TV Memory Address Offset Register 1
199};
diff --git a/include/asm-m68k/pci.h b/include/asm-m68k/pci.h
index 9e7d79ab5d1..9d2c07abe44 100644
--- a/include/asm-m68k/pci.h
+++ b/include/asm-m68k/pci.h
@@ -43,7 +43,7 @@ static inline void pcibios_set_master(struct pci_dev *dev)
43 /* No special bus mastering setup handling */ 43 /* No special bus mastering setup handling */
44} 44}
45 45
46static inline void pcibios_penalize_isa_irq(int irq) 46static inline void pcibios_penalize_isa_irq(int irq, int active)
47{ 47{
48 /* We don't do dynamic PCI IRQ allocation */ 48 /* We don't do dynamic PCI IRQ allocation */
49} 49}
diff --git a/include/asm-mips/pci.h b/include/asm-mips/pci.h
index 2d323b6e147..d70dc355c1f 100644
--- a/include/asm-mips/pci.h
+++ b/include/asm-mips/pci.h
@@ -69,7 +69,7 @@ extern unsigned long PCIBIOS_MIN_MEM;
69 69
70extern void pcibios_set_master(struct pci_dev *dev); 70extern void pcibios_set_master(struct pci_dev *dev);
71 71
72static inline void pcibios_penalize_isa_irq(int irq) 72static inline void pcibios_penalize_isa_irq(int irq, int active)
73{ 73{
74 /* We don't do dynamic PCI IRQ allocation */ 74 /* We don't do dynamic PCI IRQ allocation */
75} 75}
diff --git a/include/asm-ppc/kexec.h b/include/asm-ppc/kexec.h
index 73191310d8d..6d2aa0aa464 100644
--- a/include/asm-ppc/kexec.h
+++ b/include/asm-ppc/kexec.h
@@ -27,6 +27,8 @@
27 27
28#ifndef __ASSEMBLY__ 28#ifndef __ASSEMBLY__
29 29
30extern void *crash_notes;
31
30struct kimage; 32struct kimage;
31 33
32extern void machine_kexec_simple(struct kimage *image); 34extern void machine_kexec_simple(struct kimage *image);
diff --git a/include/asm-ppc/macio.h b/include/asm-ppc/macio.h
index 2cafc997860..a481b772d15 100644
--- a/include/asm-ppc/macio.h
+++ b/include/asm-ppc/macio.h
@@ -1,6 +1,7 @@
1#ifndef __MACIO_ASIC_H__ 1#ifndef __MACIO_ASIC_H__
2#define __MACIO_ASIC_H__ 2#define __MACIO_ASIC_H__
3 3
4#include <linux/mod_devicetable.h>
4#include <asm/of_device.h> 5#include <asm/of_device.h>
5 6
6extern struct bus_type macio_bus_type; 7extern struct bus_type macio_bus_type;
@@ -120,10 +121,10 @@ static inline struct pci_dev *macio_get_pci_dev(struct macio_dev *mdev)
120struct macio_driver 121struct macio_driver
121{ 122{
122 char *name; 123 char *name;
123 struct of_match *match_table; 124 struct of_device_id *match_table;
124 struct module *owner; 125 struct module *owner;
125 126
126 int (*probe)(struct macio_dev* dev, const struct of_match *match); 127 int (*probe)(struct macio_dev* dev, const struct of_device_id *match);
127 int (*remove)(struct macio_dev* dev); 128 int (*remove)(struct macio_dev* dev);
128 129
129 int (*suspend)(struct macio_dev* dev, pm_message_t state); 130 int (*suspend)(struct macio_dev* dev, pm_message_t state);
diff --git a/include/asm-ppc/mpc8xx.h b/include/asm-ppc/mpc8xx.h
index 714d69c819d..7c31f2d564a 100644
--- a/include/asm-ppc/mpc8xx.h
+++ b/include/asm-ppc/mpc8xx.h
@@ -68,6 +68,10 @@
68#include <platforms/lantec.h> 68#include <platforms/lantec.h>
69#endif 69#endif
70 70
71#if defined(CONFIG_MPC885ADS)
72#include <platforms/mpc885ads.h>
73#endif
74
71/* Currently, all 8xx boards that support a processor to PCI/ISA bridge 75/* Currently, all 8xx boards that support a processor to PCI/ISA bridge
72 * use the same memory map. 76 * use the same memory map.
73 */ 77 */
diff --git a/include/asm-ppc/of_device.h b/include/asm-ppc/of_device.h
index 7229735a7c1..4b264cfd399 100644
--- a/include/asm-ppc/of_device.h
+++ b/include/asm-ppc/of_device.h
@@ -24,20 +24,8 @@ struct of_device
24}; 24};
25#define to_of_device(d) container_of(d, struct of_device, dev) 25#define to_of_device(d) container_of(d, struct of_device, dev)
26 26
27/* 27extern const struct of_device_id *of_match_device(
28 * Struct used for matching a device 28 const struct of_device_id *matches, const struct of_device *dev);
29 */
30struct of_match
31{
32 char *name;
33 char *type;
34 char *compatible;
35 void *data;
36};
37#define OF_ANY_MATCH ((char *)-1L)
38
39extern const struct of_match *of_match_device(
40 const struct of_match *matches, const struct of_device *dev);
41 29
42extern struct of_device *of_dev_get(struct of_device *dev); 30extern struct of_device *of_dev_get(struct of_device *dev);
43extern void of_dev_put(struct of_device *dev); 31extern void of_dev_put(struct of_device *dev);
@@ -49,10 +37,10 @@ extern void of_dev_put(struct of_device *dev);
49struct of_platform_driver 37struct of_platform_driver
50{ 38{
51 char *name; 39 char *name;
52 struct of_match *match_table; 40 struct of_device_id *match_table;
53 struct module *owner; 41 struct module *owner;
54 42
55 int (*probe)(struct of_device* dev, const struct of_match *match); 43 int (*probe)(struct of_device* dev, const struct of_device_id *match);
56 int (*remove)(struct of_device* dev); 44 int (*remove)(struct of_device* dev);
57 45
58 int (*suspend)(struct of_device* dev, pm_message_t state); 46 int (*suspend)(struct of_device* dev, pm_message_t state);
diff --git a/include/asm-ppc/pci.h b/include/asm-ppc/pci.h
index db0a2a0ec74..a13d55870e6 100644
--- a/include/asm-ppc/pci.h
+++ b/include/asm-ppc/pci.h
@@ -37,7 +37,7 @@ extern inline void pcibios_set_master(struct pci_dev *dev)
37 /* No special bus mastering setup handling */ 37 /* No special bus mastering setup handling */
38} 38}
39 39
40extern inline void pcibios_penalize_isa_irq(int irq) 40extern inline void pcibios_penalize_isa_irq(int irq, int active)
41{ 41{
42 /* We don't do dynamic PCI IRQ allocation */ 42 /* We don't do dynamic PCI IRQ allocation */
43} 43}
diff --git a/include/asm-ppc/unistd.h b/include/asm-ppc/unistd.h
index e8b79220b29..a7894e0fbbb 100644
--- a/include/asm-ppc/unistd.h
+++ b/include/asm-ppc/unistd.h
@@ -262,7 +262,7 @@
262#define __NR_rtas 255 262#define __NR_rtas 255
263#define __NR_sys_debug_setcontext 256 263#define __NR_sys_debug_setcontext 256
264/* Number 257 is reserved for vserver */ 264/* Number 257 is reserved for vserver */
265/* Number 258 is reserved for new sys_remap_file_pages */ 265/* 258 currently unused */
266/* Number 259 is reserved for new sys_mbind */ 266/* Number 259 is reserved for new sys_mbind */
267/* Number 260 is reserved for new sys_get_mempolicy */ 267/* Number 260 is reserved for new sys_get_mempolicy */
268/* Number 261 is reserved for new sys_set_mempolicy */ 268/* Number 261 is reserved for new sys_set_mempolicy */
diff --git a/include/asm-ppc64/cputable.h b/include/asm-ppc64/cputable.h
index cbbfbec78b6..d67fa9e2607 100644
--- a/include/asm-ppc64/cputable.h
+++ b/include/asm-ppc64/cputable.h
@@ -138,6 +138,7 @@ extern firmware_feature_t firmware_features_table[];
138#define CPU_FTR_COHERENT_ICACHE ASM_CONST(0x0000020000000000) 138#define CPU_FTR_COHERENT_ICACHE ASM_CONST(0x0000020000000000)
139#define CPU_FTR_LOCKLESS_TLBIE ASM_CONST(0x0000040000000000) 139#define CPU_FTR_LOCKLESS_TLBIE ASM_CONST(0x0000040000000000)
140#define CPU_FTR_MMCRA_SIHV ASM_CONST(0x0000080000000000) 140#define CPU_FTR_MMCRA_SIHV ASM_CONST(0x0000080000000000)
141#define CPU_FTR_CTRL ASM_CONST(0x0000100000000000)
141 142
142/* Platform firmware features */ 143/* Platform firmware features */
143#define FW_FTR_ ASM_CONST(0x0000000000000001) 144#define FW_FTR_ ASM_CONST(0x0000000000000001)
@@ -148,7 +149,7 @@ extern firmware_feature_t firmware_features_table[];
148 149
149#define CPU_FTR_PPCAS_ARCH_V2_BASE (CPU_FTR_SLB | \ 150#define CPU_FTR_PPCAS_ARCH_V2_BASE (CPU_FTR_SLB | \
150 CPU_FTR_TLBIEL | CPU_FTR_NOEXECUTE | \ 151 CPU_FTR_TLBIEL | CPU_FTR_NOEXECUTE | \
151 CPU_FTR_NODSISRALIGN) 152 CPU_FTR_NODSISRALIGN | CPU_FTR_CTRL)
152 153
153/* iSeries doesn't support large pages */ 154/* iSeries doesn't support large pages */
154#ifdef CONFIG_PPC_ISERIES 155#ifdef CONFIG_PPC_ISERIES
diff --git a/include/asm-ppc64/hvconsole.h b/include/asm-ppc64/hvconsole.h
index d89d94c9181..6da93ce74dc 100644
--- a/include/asm-ppc64/hvconsole.h
+++ b/include/asm-ppc64/hvconsole.h
@@ -29,12 +29,21 @@
29 */ 29 */
30#define MAX_NR_HVC_CONSOLES 16 30#define MAX_NR_HVC_CONSOLES 16
31 31
32/* implemented by a low level driver */
33struct hv_ops {
34 int (*get_chars)(uint32_t vtermno, char *buf, int count);
35 int (*put_chars)(uint32_t vtermno, const char *buf, int count);
36};
32extern int hvc_get_chars(uint32_t vtermno, char *buf, int count); 37extern int hvc_get_chars(uint32_t vtermno, char *buf, int count);
33extern int hvc_put_chars(uint32_t vtermno, const char *buf, int count); 38extern int hvc_put_chars(uint32_t vtermno, const char *buf, int count);
34 39
35/* Early discovery of console adapters. */ 40struct hvc_struct;
36extern int hvc_find_vtys(void);
37 41
38/* Implemented by a console driver */ 42/* Register a vterm and a slot index for use as a console (console_init) */
39extern int hvc_instantiate(uint32_t vtermno, int index); 43extern int hvc_instantiate(uint32_t vtermno, int index, struct hv_ops *ops);
44/* register a vterm for hvc tty operation (module_init or hotplug add) */
45extern struct hvc_struct * __devinit hvc_alloc(uint32_t vtermno, int irq,
46 struct hv_ops *ops);
47/* remove a vterm from hvc tty operation (modele_exit or hotplug remove) */
48extern int __devexit hvc_remove(struct hvc_struct *hp);
40#endif /* _PPC64_HVCONSOLE_H */ 49#endif /* _PPC64_HVCONSOLE_H */
diff --git a/include/asm-ppc64/machdep.h b/include/asm-ppc64/machdep.h
index 9cdad3ed152..1e6ad482413 100644
--- a/include/asm-ppc64/machdep.h
+++ b/include/asm-ppc64/machdep.h
@@ -140,8 +140,13 @@ struct machdep_calls {
140 unsigned long size, 140 unsigned long size,
141 pgprot_t vma_prot); 141 pgprot_t vma_prot);
142 142
143 /* Idle loop for this platform, leave empty for default idle loop */
144 int (*idle_loop)(void);
143}; 145};
144 146
147extern int default_idle(void);
148extern int native_idle(void);
149
145extern struct machdep_calls ppc_md; 150extern struct machdep_calls ppc_md;
146extern char cmd_line[COMMAND_LINE_SIZE]; 151extern char cmd_line[COMMAND_LINE_SIZE];
147 152
diff --git a/include/asm-ppc64/pci.h b/include/asm-ppc64/pci.h
index d12dfce21e2..faa77222307 100644
--- a/include/asm-ppc64/pci.h
+++ b/include/asm-ppc64/pci.h
@@ -37,7 +37,7 @@ static inline void pcibios_set_master(struct pci_dev *dev)
37 /* No special bus mastering setup handling */ 37 /* No special bus mastering setup handling */
38} 38}
39 39
40static inline void pcibios_penalize_isa_irq(int irq) 40static inline void pcibios_penalize_isa_irq(int irq, int active)
41{ 41{
42 /* We don't do dynamic PCI IRQ allocation */ 42 /* We don't do dynamic PCI IRQ allocation */
43} 43}
diff --git a/include/asm-ppc64/processor.h b/include/asm-ppc64/processor.h
index af28aa55d8c..352306cfb57 100644
--- a/include/asm-ppc64/processor.h
+++ b/include/asm-ppc64/processor.h
@@ -20,6 +20,7 @@
20#include <asm/ptrace.h> 20#include <asm/ptrace.h>
21#include <asm/types.h> 21#include <asm/types.h>
22#include <asm/systemcfg.h> 22#include <asm/systemcfg.h>
23#include <asm/cputable.h>
23 24
24/* Machine State Register (MSR) Fields */ 25/* Machine State Register (MSR) Fields */
25#define MSR_SF_LG 63 /* Enable 64 bit mode */ 26#define MSR_SF_LG 63 /* Enable 64 bit mode */
@@ -501,24 +502,37 @@ static inline void ppc64_runlatch_on(void)
501{ 502{
502 unsigned long ctrl; 503 unsigned long ctrl;
503 504
504 ctrl = mfspr(SPRN_CTRLF); 505 if (cpu_has_feature(CPU_FTR_CTRL)) {
505 ctrl |= CTRL_RUNLATCH; 506 ctrl = mfspr(SPRN_CTRLF);
506 mtspr(SPRN_CTRLT, ctrl); 507 ctrl |= CTRL_RUNLATCH;
508 mtspr(SPRN_CTRLT, ctrl);
509 }
507} 510}
508 511
509static inline void ppc64_runlatch_off(void) 512static inline void ppc64_runlatch_off(void)
510{ 513{
511 unsigned long ctrl; 514 unsigned long ctrl;
512 515
513 ctrl = mfspr(SPRN_CTRLF); 516 if (cpu_has_feature(CPU_FTR_CTRL)) {
514 ctrl &= ~CTRL_RUNLATCH; 517 ctrl = mfspr(SPRN_CTRLF);
515 mtspr(SPRN_CTRLT, ctrl); 518 ctrl &= ~CTRL_RUNLATCH;
519 mtspr(SPRN_CTRLT, ctrl);
520 }
516} 521}
517 522
518#endif /* __KERNEL__ */ 523#endif /* __KERNEL__ */
519 524
520#endif /* __ASSEMBLY__ */ 525#endif /* __ASSEMBLY__ */
521 526
527#ifdef __KERNEL__
528#define RUNLATCH_ON(REG) \
529BEGIN_FTR_SECTION \
530 mfspr (REG),SPRN_CTRLF; \
531 ori (REG),(REG),CTRL_RUNLATCH; \
532 mtspr SPRN_CTRLT,(REG); \
533END_FTR_SECTION_IFSET(CPU_FTR_CTRL)
534#endif
535
522/* 536/*
523 * Number of entries in the SLB. If this ever changes we should handle 537 * Number of entries in the SLB. If this ever changes we should handle
524 * it with a use a cpu feature fixup. 538 * it with a use a cpu feature fixup.
diff --git a/include/asm-ppc64/unistd.h b/include/asm-ppc64/unistd.h
index 605d91e011e..4a94acf6bfe 100644
--- a/include/asm-ppc64/unistd.h
+++ b/include/asm-ppc64/unistd.h
@@ -268,7 +268,7 @@
268#define __NR_rtas 255 268#define __NR_rtas 255
269/* Number 256 is reserved for sys_debug_setcontext */ 269/* Number 256 is reserved for sys_debug_setcontext */
270/* Number 257 is reserved for vserver */ 270/* Number 257 is reserved for vserver */
271/* Number 258 is reserved for new sys_remap_file_pages */ 271/* 258 currently unused */
272#define __NR_mbind 259 272#define __NR_mbind 259
273#define __NR_get_mempolicy 260 273#define __NR_get_mempolicy 260
274#define __NR_set_mempolicy 261 274#define __NR_set_mempolicy 261
@@ -283,8 +283,10 @@
283#define __NR_request_key 270 283#define __NR_request_key 270
284#define __NR_keyctl 271 284#define __NR_keyctl 271
285#define __NR_waitid 272 285#define __NR_waitid 272
286#define __NR_ioprio_set 273
287#define __NR_ioprio_get 274
286 288
287#define __NR_syscalls 273 289#define __NR_syscalls 275
288#ifdef __KERNEL__ 290#ifdef __KERNEL__
289#define NR_syscalls __NR_syscalls 291#define NR_syscalls __NR_syscalls
290#endif 292#endif
diff --git a/include/asm-sh/pci.h b/include/asm-sh/pci.h
index 26044889c77..0a523c85b11 100644
--- a/include/asm-sh/pci.h
+++ b/include/asm-sh/pci.h
@@ -36,7 +36,7 @@ struct pci_dev;
36 36
37extern void pcibios_set_master(struct pci_dev *dev); 37extern void pcibios_set_master(struct pci_dev *dev);
38 38
39static inline void pcibios_penalize_isa_irq(int irq) 39static inline void pcibios_penalize_isa_irq(int irq, int active)
40{ 40{
41 /* We don't do dynamic PCI IRQ allocation */ 41 /* We don't do dynamic PCI IRQ allocation */
42} 42}
diff --git a/include/asm-sh64/pci.h b/include/asm-sh64/pci.h
index c68870e02d9..aa8043089bb 100644
--- a/include/asm-sh64/pci.h
+++ b/include/asm-sh64/pci.h
@@ -26,7 +26,7 @@ extern void pcibios_set_master(struct pci_dev *dev);
26/* 26/*
27 * Set penalize isa irq function 27 * Set penalize isa irq function
28 */ 28 */
29static inline void pcibios_penalize_isa_irq(int irq) 29static inline void pcibios_penalize_isa_irq(int irq, int active)
30{ 30{
31 /* We don't do dynamic PCI IRQ allocation */ 31 /* We don't do dynamic PCI IRQ allocation */
32} 32}
diff --git a/include/asm-sparc/pci.h b/include/asm-sparc/pci.h
index 44bb38758c9..97052baf90c 100644
--- a/include/asm-sparc/pci.h
+++ b/include/asm-sparc/pci.h
@@ -20,7 +20,7 @@ extern inline void pcibios_set_master(struct pci_dev *dev)
20 /* No special bus mastering setup handling */ 20 /* No special bus mastering setup handling */
21} 21}
22 22
23extern inline void pcibios_penalize_isa_irq(int irq) 23extern inline void pcibios_penalize_isa_irq(int irq, int active)
24{ 24{
25 /* We don't do dynamic PCI IRQ allocation */ 25 /* We don't do dynamic PCI IRQ allocation */
26} 26}
diff --git a/include/asm-sparc/unistd.h b/include/asm-sparc/unistd.h
index 84670840390..aee17d7e2e4 100644
--- a/include/asm-sparc/unistd.h
+++ b/include/asm-sparc/unistd.h
@@ -212,7 +212,7 @@
212#define __NR_epoll_create 193 /* Linux Specific */ 212#define __NR_epoll_create 193 /* Linux Specific */
213#define __NR_epoll_ctl 194 /* Linux Specific */ 213#define __NR_epoll_ctl 194 /* Linux Specific */
214#define __NR_epoll_wait 195 /* Linux Specific */ 214#define __NR_epoll_wait 195 /* Linux Specific */
215/* #define __NR_ulimit 196 Linux Specific */ 215#define __NR_ioprio_set 196 /* Linux Specific */
216#define __NR_getppid 197 /* Linux Specific */ 216#define __NR_getppid 197 /* Linux Specific */
217#define __NR_sigaction 198 /* Linux Specific */ 217#define __NR_sigaction 198 /* Linux Specific */
218#define __NR_sgetmask 199 /* Linux Specific */ 218#define __NR_sgetmask 199 /* Linux Specific */
@@ -234,7 +234,7 @@
234#define __NR_ipc 215 /* Linux Specific */ 234#define __NR_ipc 215 /* Linux Specific */
235#define __NR_sigreturn 216 /* Linux Specific */ 235#define __NR_sigreturn 216 /* Linux Specific */
236#define __NR_clone 217 /* Linux Specific */ 236#define __NR_clone 217 /* Linux Specific */
237/* #define __NR_modify_ldt 218 Linux Specific - i386 specific, unused */ 237#define __NR_ioprio_get 218 /* Linux Specific */
238#define __NR_adjtimex 219 /* Linux Specific */ 238#define __NR_adjtimex 219 /* Linux Specific */
239#define __NR_sigprocmask 220 /* Linux Specific */ 239#define __NR_sigprocmask 220 /* Linux Specific */
240#define __NR_create_module 221 /* Linux Specific */ 240#define __NR_create_module 221 /* Linux Specific */
diff --git a/include/asm-sparc64/irq.h b/include/asm-sparc64/irq.h
index 018e2e46082..8b70edcb80d 100644
--- a/include/asm-sparc64/irq.h
+++ b/include/asm-sparc64/irq.h
@@ -16,6 +16,18 @@
16#include <asm/pil.h> 16#include <asm/pil.h>
17#include <asm/ptrace.h> 17#include <asm/ptrace.h>
18 18
19struct ino_bucket;
20
21#define MAX_IRQ_DESC_ACTION 4
22
23struct irq_desc {
24 void (*pre_handler)(struct ino_bucket *, void *, void *);
25 void *pre_handler_arg1;
26 void *pre_handler_arg2;
27 u32 action_active_mask;
28 struct irqaction action[MAX_IRQ_DESC_ACTION];
29};
30
19/* You should not mess with this directly. That's the job of irq.c. 31/* You should not mess with this directly. That's the job of irq.c.
20 * 32 *
21 * If you make changes here, please update hand coded assembler of 33 * If you make changes here, please update hand coded assembler of
@@ -42,24 +54,11 @@ struct ino_bucket {
42 /* Miscellaneous flags. */ 54 /* Miscellaneous flags. */
43/*0x06*/unsigned char flags; 55/*0x06*/unsigned char flags;
44 56
45 /* This is used to deal with IBF_DMA_SYNC on 57 /* Currently unused. */
46 * Sabre systems. 58/*0x07*/unsigned char __pad;
47 */ 59
48/*0x07*/unsigned char synctab_ent; 60 /* Reference to IRQ descriptor for this bucket. */
49 61/*0x08*/struct irq_desc *irq_info;
50 /* Reference to handler for this IRQ. If this is
51 * non-NULL this means it is active and should be
52 * serviced. Else the pending member is set to one
53 * and later registry of the interrupt checks for
54 * this condition.
55 *
56 * Normally this is just an irq_action structure.
57 * But, on PCI, if multiple interrupt sources behind
58 * a bridge have multiple interrupt sources that share
59 * the same INO bucket, this points to an array of
60 * pointers to four IRQ action structures.
61 */
62/*0x08*/void *irq_info;
63 62
64 /* Sun5 Interrupt Clear Register. */ 63 /* Sun5 Interrupt Clear Register. */
65/*0x10*/unsigned long iclr; 64/*0x10*/unsigned long iclr;
@@ -69,12 +68,6 @@ struct ino_bucket {
69 68
70}; 69};
71 70
72#ifdef CONFIG_PCI
73extern unsigned long pci_dma_wsync;
74extern unsigned long dma_sync_reg_table[256];
75extern unsigned char dma_sync_reg_table_entry;
76#endif
77
78/* IMAP/ICLR register defines */ 71/* IMAP/ICLR register defines */
79#define IMAP_VALID 0x80000000 /* IRQ Enabled */ 72#define IMAP_VALID 0x80000000 /* IRQ Enabled */
80#define IMAP_TID_UPA 0x7c000000 /* UPA TargetID */ 73#define IMAP_TID_UPA 0x7c000000 /* UPA TargetID */
@@ -90,11 +83,9 @@ extern unsigned char dma_sync_reg_table_entry;
90#define ICLR_PENDING 0x00000003 /* Pending state */ 83#define ICLR_PENDING 0x00000003 /* Pending state */
91 84
92/* Only 8-bits are available, be careful. -DaveM */ 85/* Only 8-bits are available, be careful. -DaveM */
93#define IBF_DMA_SYNC 0x01 /* DMA synchronization behind PCI bridge needed. */ 86#define IBF_PCI 0x02 /* PSYCHO/SABRE/SCHIZO PCI interrupt. */
94#define IBF_PCI 0x02 /* Indicates PSYCHO/SABRE/SCHIZO PCI interrupt. */ 87#define IBF_ACTIVE 0x04 /* Interrupt is active and has a handler.*/
95#define IBF_ACTIVE 0x04 /* This interrupt is active and has a handler. */ 88#define IBF_INPROGRESS 0x10 /* IRQ is being serviced. */
96#define IBF_MULTI 0x08 /* On PCI, indicates shared bucket. */
97#define IBF_INPROGRESS 0x10 /* IRQ is being serviced. */
98 89
99#define NUM_IVECS (IMAP_INR + 1) 90#define NUM_IVECS (IMAP_INR + 1)
100extern struct ino_bucket ivector_table[NUM_IVECS]; 91extern struct ino_bucket ivector_table[NUM_IVECS];
diff --git a/include/asm-sparc64/param.h b/include/asm-sparc64/param.h
index 6a12f3ac035..a1cd4974630 100644
--- a/include/asm-sparc64/param.h
+++ b/include/asm-sparc64/param.h
@@ -1,9 +1,10 @@
1/* $Id: param.h,v 1.2 2000/10/30 21:01:41 davem Exp $ */
2#ifndef _ASMSPARC64_PARAM_H 1#ifndef _ASMSPARC64_PARAM_H
3#define _ASMSPARC64_PARAM_H 2#define _ASMSPARC64_PARAM_H
4 3
4#include <linux/config.h>
5
5#ifdef __KERNEL__ 6#ifdef __KERNEL__
6# define HZ 1000 /* Internal kernel timer frequency */ 7# define HZ CONFIG_HZ /* Internal kernel timer frequency */
7# define USER_HZ 100 /* .. some user interfaces are in "ticks" */ 8# define USER_HZ 100 /* .. some user interfaces are in "ticks" */
8# define CLOCKS_PER_SEC (USER_HZ) 9# define CLOCKS_PER_SEC (USER_HZ)
9#endif 10#endif
diff --git a/include/asm-sparc64/parport.h b/include/asm-sparc64/parport.h
index b7e635544ce..56b5197d789 100644
--- a/include/asm-sparc64/parport.h
+++ b/include/asm-sparc64/parport.h
@@ -27,12 +27,12 @@ static struct sparc_ebus_info {
27 27
28static __inline__ void enable_dma(unsigned int dmanr) 28static __inline__ void enable_dma(unsigned int dmanr)
29{ 29{
30 ebus_dma_enable(&sparc_ebus_dmas[dmanr].info, 1);
31
30 if (ebus_dma_request(&sparc_ebus_dmas[dmanr].info, 32 if (ebus_dma_request(&sparc_ebus_dmas[dmanr].info,
31 sparc_ebus_dmas[dmanr].addr, 33 sparc_ebus_dmas[dmanr].addr,
32 sparc_ebus_dmas[dmanr].count)) 34 sparc_ebus_dmas[dmanr].count))
33 BUG(); 35 BUG();
34
35 ebus_dma_enable(&sparc_ebus_dmas[dmanr].info, 1);
36} 36}
37 37
38static __inline__ void disable_dma(unsigned int dmanr) 38static __inline__ void disable_dma(unsigned int dmanr)
diff --git a/include/asm-sparc64/pbm.h b/include/asm-sparc64/pbm.h
index 4c15610a2ba..38bbbccb406 100644
--- a/include/asm-sparc64/pbm.h
+++ b/include/asm-sparc64/pbm.h
@@ -145,6 +145,9 @@ struct pci_pbm_info {
145 /* Physical address base of PBM registers. */ 145 /* Physical address base of PBM registers. */
146 unsigned long pbm_regs; 146 unsigned long pbm_regs;
147 147
148 /* Physical address of DMA sync register, if any. */
149 unsigned long sync_reg;
150
148 /* Opaque 32-bit system bus Port ID. */ 151 /* Opaque 32-bit system bus Port ID. */
149 u32 portid; 152 u32 portid;
150 153
diff --git a/include/asm-sparc64/pci.h b/include/asm-sparc64/pci.h
index 84e41c1ef3f..a4ab0ec7143 100644
--- a/include/asm-sparc64/pci.h
+++ b/include/asm-sparc64/pci.h
@@ -23,7 +23,7 @@ static inline void pcibios_set_master(struct pci_dev *dev)
23 /* No special bus mastering setup handling */ 23 /* No special bus mastering setup handling */
24} 24}
25 25
26static inline void pcibios_penalize_isa_irq(int irq) 26static inline void pcibios_penalize_isa_irq(int irq, int active)
27{ 27{
28 /* We don't do dynamic PCI IRQ allocation */ 28 /* We don't do dynamic PCI IRQ allocation */
29} 29}
diff --git a/include/asm-sparc64/seccomp.h b/include/asm-sparc64/seccomp.h
new file mode 100644
index 00000000000..7fcd9968192
--- /dev/null
+++ b/include/asm-sparc64/seccomp.h
@@ -0,0 +1,21 @@
1#ifndef _ASM_SECCOMP_H
2
3#include <linux/thread_info.h> /* already defines TIF_32BIT */
4
5#ifndef TIF_32BIT
6#error "unexpected TIF_32BIT on sparc64"
7#endif
8
9#include <linux/unistd.h>
10
11#define __NR_seccomp_read __NR_read
12#define __NR_seccomp_write __NR_write
13#define __NR_seccomp_exit __NR_exit
14#define __NR_seccomp_sigreturn __NR_rt_sigreturn
15
16#define __NR_seccomp_read_32 __NR_read
17#define __NR_seccomp_write_32 __NR_write
18#define __NR_seccomp_exit_32 __NR_exit
19#define __NR_seccomp_sigreturn_32 __NR_sigreturn
20
21#endif /* _ASM_SECCOMP_H */
diff --git a/include/asm-sparc64/signal.h b/include/asm-sparc64/signal.h
index becdf1bc592..e3059bb4a46 100644
--- a/include/asm-sparc64/signal.h
+++ b/include/asm-sparc64/signal.h
@@ -162,21 +162,6 @@ struct sigstack {
162#define MINSIGSTKSZ 4096 162#define MINSIGSTKSZ 4096
163#define SIGSTKSZ 16384 163#define SIGSTKSZ 16384
164 164
165#ifdef __KERNEL__
166/*
167 * DJHR
168 * SA_STATIC_ALLOC is used for the SPARC system to indicate that this
169 * interrupt handler's irq structure should be statically allocated
170 * by the request_irq routine.
171 * The alternative is that arch/sparc/kernel/irq.c has carnal knowledge
172 * of interrupt usage and that sucks. Also without a flag like this
173 * it may be possible for the free_irq routine to attempt to free
174 * statically allocated data.. which is NOT GOOD.
175 *
176 */
177#define SA_STATIC_ALLOC 0x80
178#endif
179
180#include <asm-generic/signal.h> 165#include <asm-generic/signal.h>
181 166
182struct __new_sigaction { 167struct __new_sigaction {
diff --git a/include/asm-sparc64/thread_info.h b/include/asm-sparc64/thread_info.h
index 0cd65295692..a1d25c06f92 100644
--- a/include/asm-sparc64/thread_info.h
+++ b/include/asm-sparc64/thread_info.h
@@ -220,8 +220,8 @@ register struct thread_info *current_thread_info_reg asm("g6");
220#define TIF_NEWSIGNALS 6 /* wants new-style signals */ 220#define TIF_NEWSIGNALS 6 /* wants new-style signals */
221#define TIF_32BIT 7 /* 32-bit binary */ 221#define TIF_32BIT 7 /* 32-bit binary */
222#define TIF_NEWCHILD 8 /* just-spawned child process */ 222#define TIF_NEWCHILD 8 /* just-spawned child process */
223/* TIF_* value 9 is available */ 223#define TIF_SECCOMP 9 /* secure computing */
224#define TIF_POLLING_NRFLAG 10 224#define TIF_SYSCALL_AUDIT 10 /* syscall auditing active */
225#define TIF_SYSCALL_SUCCESS 11 225#define TIF_SYSCALL_SUCCESS 11
226/* NOTE: Thread flags >= 12 should be ones we have no interest 226/* NOTE: Thread flags >= 12 should be ones we have no interest
227 * in using in assembly, else we can't use the mask as 227 * in using in assembly, else we can't use the mask as
@@ -229,6 +229,7 @@ register struct thread_info *current_thread_info_reg asm("g6");
229 */ 229 */
230#define TIF_ABI_PENDING 12 230#define TIF_ABI_PENDING 12
231#define TIF_MEMDIE 13 231#define TIF_MEMDIE 13
232#define TIF_POLLING_NRFLAG 14
232 233
233#define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE) 234#define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE)
234#define _TIF_NOTIFY_RESUME (1<<TIF_NOTIFY_RESUME) 235#define _TIF_NOTIFY_RESUME (1<<TIF_NOTIFY_RESUME)
@@ -239,9 +240,11 @@ register struct thread_info *current_thread_info_reg asm("g6");
239#define _TIF_NEWSIGNALS (1<<TIF_NEWSIGNALS) 240#define _TIF_NEWSIGNALS (1<<TIF_NEWSIGNALS)
240#define _TIF_32BIT (1<<TIF_32BIT) 241#define _TIF_32BIT (1<<TIF_32BIT)
241#define _TIF_NEWCHILD (1<<TIF_NEWCHILD) 242#define _TIF_NEWCHILD (1<<TIF_NEWCHILD)
242#define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG) 243#define _TIF_SECCOMP (1<<TIF_SECCOMP)
243#define _TIF_ABI_PENDING (1<<TIF_ABI_PENDING) 244#define _TIF_SYSCALL_AUDIT (1<<TIF_SYSCALL_AUDIT)
244#define _TIF_SYSCALL_SUCCESS (1<<TIF_SYSCALL_SUCCESS) 245#define _TIF_SYSCALL_SUCCESS (1<<TIF_SYSCALL_SUCCESS)
246#define _TIF_ABI_PENDING (1<<TIF_ABI_PENDING)
247#define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG)
245 248
246#define _TIF_USER_WORK_MASK ((0xff << TI_FLAG_WSAVED_SHIFT) | \ 249#define _TIF_USER_WORK_MASK ((0xff << TI_FLAG_WSAVED_SHIFT) | \
247 (_TIF_NOTIFY_RESUME | _TIF_SIGPENDING | \ 250 (_TIF_NOTIFY_RESUME | _TIF_SIGPENDING | \
diff --git a/include/asm-sparc64/unistd.h b/include/asm-sparc64/unistd.h
index 5b8dcf5786a..f59144c6b76 100644
--- a/include/asm-sparc64/unistd.h
+++ b/include/asm-sparc64/unistd.h
@@ -212,7 +212,7 @@
212#define __NR_epoll_create 193 /* Linux Specific */ 212#define __NR_epoll_create 193 /* Linux Specific */
213#define __NR_epoll_ctl 194 /* Linux Specific */ 213#define __NR_epoll_ctl 194 /* Linux Specific */
214#define __NR_epoll_wait 195 /* Linux Specific */ 214#define __NR_epoll_wait 195 /* Linux Specific */
215/* #define __NR_ulimit 196 Linux Specific */ 215#define __NR_ioprio_set 196 /* Linux Specific */
216#define __NR_getppid 197 /* Linux Specific */ 216#define __NR_getppid 197 /* Linux Specific */
217#define __NR_sigaction 198 /* Linux Specific */ 217#define __NR_sigaction 198 /* Linux Specific */
218#define __NR_sgetmask 199 /* Linux Specific */ 218#define __NR_sgetmask 199 /* Linux Specific */
@@ -234,7 +234,7 @@
234#define __NR_ipc 215 /* Linux Specific */ 234#define __NR_ipc 215 /* Linux Specific */
235#define __NR_sigreturn 216 /* Linux Specific */ 235#define __NR_sigreturn 216 /* Linux Specific */
236#define __NR_clone 217 /* Linux Specific */ 236#define __NR_clone 217 /* Linux Specific */
237/* #define __NR_modify_ldt 218 Linux Specific - i386 specific, unused */ 237#define __NR_ioprio_get 218 /* Linux Specific */
238#define __NR_adjtimex 219 /* Linux Specific */ 238#define __NR_adjtimex 219 /* Linux Specific */
239#define __NR_sigprocmask 220 /* Linux Specific */ 239#define __NR_sigprocmask 220 /* Linux Specific */
240#define __NR_create_module 221 /* Linux Specific */ 240#define __NR_create_module 221 /* Linux Specific */
diff --git a/include/asm-um/mmu_context.h b/include/asm-um/mmu_context.h
index 89bff310b7a..095bb627b96 100644
--- a/include/asm-um/mmu_context.h
+++ b/include/asm-um/mmu_context.h
@@ -7,19 +7,23 @@
7#define __UM_MMU_CONTEXT_H 7#define __UM_MMU_CONTEXT_H
8 8
9#include "linux/sched.h" 9#include "linux/sched.h"
10#include "linux/config.h"
10#include "choose-mode.h" 11#include "choose-mode.h"
12#include "um_mmu.h"
11 13
12#define get_mmu_context(task) do ; while(0) 14#define get_mmu_context(task) do ; while(0)
13#define activate_context(tsk) do ; while(0) 15#define activate_context(tsk) do ; while(0)
14 16
15#define deactivate_mm(tsk,mm) do { } while (0) 17#define deactivate_mm(tsk,mm) do { } while (0)
16 18
19extern void force_flush_all(void);
20
17static inline void activate_mm(struct mm_struct *old, struct mm_struct *new) 21static inline void activate_mm(struct mm_struct *old, struct mm_struct *new)
18{ 22{
23 if (old != new)
24 force_flush_all();
19} 25}
20 26
21extern void switch_mm_skas(int mm_fd);
22
23static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next, 27static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next,
24 struct task_struct *tsk) 28 struct task_struct *tsk)
25{ 29{
@@ -30,7 +34,7 @@ static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next,
30 cpu_set(cpu, next->cpu_vm_mask); 34 cpu_set(cpu, next->cpu_vm_mask);
31 if(next != &init_mm) 35 if(next != &init_mm)
32 CHOOSE_MODE((void) 0, 36 CHOOSE_MODE((void) 0,
33 switch_mm_skas(next->context.skas.mm_fd)); 37 switch_mm_skas(&next->context.skas.id));
34 } 38 }
35} 39}
36 40
diff --git a/include/asm-v850/checksum.h b/include/asm-v850/checksum.h
index d3aedb7bfc5..4df5e71098f 100644
--- a/include/asm-v850/checksum.h
+++ b/include/asm-v850/checksum.h
@@ -1,8 +1,8 @@
1/* 1/*
2 * include/asm-v850/checksum.h -- Checksum ops 2 * include/asm-v850/checksum.h -- Checksum ops
3 * 3 *
4 * Copyright (C) 2001 NEC Corporation 4 * Copyright (C) 2001,2005 NEC Corporation
5 * Copyright (C) 2001 Miles Bader <miles@gnu.org> 5 * Copyright (C) 2001,2005 Miles Bader <miles@gnu.org>
6 * 6 *
7 * This file is subject to the terms and conditions of the GNU General 7 * This file is subject to the terms and conditions of the GNU General
8 * Public License. See the file COPYING in the main directory of this 8 * Public License. See the file COPYING in the main directory of this
@@ -36,8 +36,8 @@ extern unsigned int csum_partial (const unsigned char * buff, int len,
36 * here even more important to align src and dst on a 32-bit (or even 36 * here even more important to align src and dst on a 32-bit (or even
37 * better 64-bit) boundary 37 * better 64-bit) boundary
38 */ 38 */
39extern unsigned csum_partial_copy (const char *src, char *dst, int len, 39extern unsigned csum_partial_copy (const unsigned char *src,
40 unsigned sum); 40 unsigned char *dst, int len, unsigned sum);
41 41
42 42
43/* 43/*
@@ -46,7 +46,8 @@ extern unsigned csum_partial_copy (const char *src, char *dst, int len,
46 * here even more important to align src and dst on a 32-bit (or even 46 * here even more important to align src and dst on a 32-bit (or even
47 * better 64-bit) boundary 47 * better 64-bit) boundary
48 */ 48 */
49extern unsigned csum_partial_copy_from_user (const char *src, char *dst, 49extern unsigned csum_partial_copy_from_user (const unsigned char *src,
50 unsigned char *dst,
50 int len, unsigned sum, 51 int len, unsigned sum,
51 int *csum_err); 52 int *csum_err);
52 53
diff --git a/include/asm-v850/mmu.h b/include/asm-v850/mmu.h
index e30a52becfd..267768c66ef 100644
--- a/include/asm-v850/mmu.h
+++ b/include/asm-v850/mmu.h
@@ -1,22 +1,11 @@
1/* Copyright (C) 2002, David McCullough <davidm@snapgear.com> */ 1/* Copyright (C) 2002, 2005, David McCullough <davidm@snapgear.com> */
2 2
3#ifndef __V850_MMU_H__ 3#ifndef __V850_MMU_H__
4#define __V850_MMU_H__ 4#define __V850_MMU_H__
5 5
6struct mm_rblock_struct {
7 int size;
8 int refcount;
9 void *kblock;
10};
11
12struct mm_tblock_struct {
13 struct mm_rblock_struct *rblock;
14 struct mm_tblock_struct *next;
15};
16
17typedef struct { 6typedef struct {
18 struct mm_tblock_struct tblock; 7 struct vm_list_struct *vmlist;
19 unsigned long end_brk; 8 unsigned long end_brk;
20} mm_context_t; 9} mm_context_t;
21 10
22#endif /* __V850_MMU_H__ */ 11#endif /* __V850_MMU_H__ */
diff --git a/include/asm-x86_64/acpi.h b/include/asm-x86_64/acpi.h
index a6b41b89206..dc8c981af27 100644
--- a/include/asm-x86_64/acpi.h
+++ b/include/asm-x86_64/acpi.h
@@ -28,6 +28,8 @@
28 28
29#ifdef __KERNEL__ 29#ifdef __KERNEL__
30 30
31#include <acpi/pdc_intel.h>
32
31#define COMPILER_DEPENDENT_INT64 long long 33#define COMPILER_DEPENDENT_INT64 long long
32#define COMPILER_DEPENDENT_UINT64 unsigned long long 34#define COMPILER_DEPENDENT_UINT64 unsigned long long
33 35
@@ -99,12 +101,6 @@ __acpi_release_global_lock (unsigned int *lock)
99 :"=r"(n_hi), "=r"(n_lo) \ 101 :"=r"(n_hi), "=r"(n_lo) \
100 :"0"(n_hi), "1"(n_lo)) 102 :"0"(n_hi), "1"(n_lo))
101 103
102/*
103 * Refer Intel ACPI _PDC support document for bit definitions
104 */
105#define ACPI_PDC_EST_CAPABILITY_SMP 0xa
106#define ACPI_PDC_EST_CAPABILITY_MSR 0x1
107
108#ifdef CONFIG_ACPI_BOOT 104#ifdef CONFIG_ACPI_BOOT
109extern int acpi_lapic; 105extern int acpi_lapic;
110extern int acpi_ioapic; 106extern int acpi_ioapic;
diff --git a/include/asm-x86_64/pci.h b/include/asm-x86_64/pci.h
index c1961db88fa..eeb3088a1c9 100644
--- a/include/asm-x86_64/pci.h
+++ b/include/asm-x86_64/pci.h
@@ -33,7 +33,7 @@ extern int (*pci_config_read)(int seg, int bus, int dev, int fn, int reg, int le
33extern int (*pci_config_write)(int seg, int bus, int dev, int fn, int reg, int len, u32 value); 33extern int (*pci_config_write)(int seg, int bus, int dev, int fn, int reg, int len, u32 value);
34 34
35void pcibios_set_master(struct pci_dev *dev); 35void pcibios_set_master(struct pci_dev *dev);
36void pcibios_penalize_isa_irq(int irq); 36void pcibios_penalize_isa_irq(int irq, int active);
37struct irq_routing_table *pcibios_get_irq_routing_table(void); 37struct irq_routing_table *pcibios_get_irq_routing_table(void);
38int pcibios_set_irq_routing(struct pci_dev *dev, int pin, int irq); 38int pcibios_set_irq_routing(struct pci_dev *dev, int pin, int irq);
39 39
diff --git a/include/asm-x86_64/proto.h b/include/asm-x86_64/proto.h
index f2f073642d6..6c813eb521f 100644
--- a/include/asm-x86_64/proto.h
+++ b/include/asm-x86_64/proto.h
@@ -15,6 +15,13 @@ extern void pda_init(int);
15extern void early_idt_handler(void); 15extern void early_idt_handler(void);
16 16
17extern void mcheck_init(struct cpuinfo_x86 *c); 17extern void mcheck_init(struct cpuinfo_x86 *c);
18#ifdef CONFIG_MTRR
19extern void mtrr_ap_init(void);
20extern void mtrr_bp_init(void);
21#else
22#define mtrr_ap_init() do {} while (0)
23#define mtrr_bp_init() do {} while (0)
24#endif
18extern void init_memory_mapping(unsigned long start, unsigned long end); 25extern void init_memory_mapping(unsigned long start, unsigned long end);
19 26
20extern void system_call(void); 27extern void system_call(void);
diff --git a/include/asm-xtensa/ipc.h b/include/asm-xtensa/ipc.h
deleted file mode 100644
index a9eed4e21cb..00000000000
--- a/include/asm-xtensa/ipc.h
+++ /dev/null
@@ -1,16 +0,0 @@
1/*
2 * include/asm-xtensa/ipc.h
3 *
4 * This file is subject to the terms and conditions of the GNU General
5 * Public License. See the file "COPYING" in the main directory of
6 * this archive for more details.
7 *
8 * Copyright (C) 2001 - 2005 Tensilica Inc.
9 */
10
11#ifndef _XTENSA_IPC_H
12#define _XTENSA_IPC_H
13
14#include <asm-generic/ipc.h>
15
16#endif /* _XTENSA_IPC_H */
diff --git a/include/asm-xtensa/unistd.h b/include/asm-xtensa/unistd.h
index 64c64dd83ba..6b39d6609d9 100644
--- a/include/asm-xtensa/unistd.h
+++ b/include/asm-xtensa/unistd.h
@@ -13,42 +13,31 @@
13 13
14#include <linux/linkage.h> 14#include <linux/linkage.h>
15 15
16//#define __NR_setup 0 /* used only by init, to get system going */
17#define __NR_spill 0 16#define __NR_spill 0
18#define __NR_exit 1 17#define __NR_exit 1
19#define __NR_fork 2
20#define __NR_read 3 18#define __NR_read 3
21#define __NR_write 4 19#define __NR_write 4
22#define __NR_open 5 20#define __NR_open 5
23#define __NR_close 6 21#define __NR_close 6
24#define __NR_waitpid 7
25#define __NR_creat 8 22#define __NR_creat 8
26#define __NR_link 9 23#define __NR_link 9
27#define __NR_unlink 10 24#define __NR_unlink 10
28#define __NR_execve 11 25#define __NR_execve 11
29#define __NR_chdir 12 26#define __NR_chdir 12
30#define __NR_time 13
31#define __NR_mknod 14 27#define __NR_mknod 14
32#define __NR_chmod 15 28#define __NR_chmod 15
33#define __NR_lchown 16 29#define __NR_lchown 16
34#define __NR_break 17 30#define __NR_break 17
35#define __NR_oldstat 18
36#define __NR_lseek 19 31#define __NR_lseek 19
37#define __NR_getpid 20 32#define __NR_getpid 20
38#define __NR_mount 21 33#define __NR_mount 21
39#define __NR_oldumount 22
40#define __NR_setuid 23 34#define __NR_setuid 23
41#define __NR_getuid 24 35#define __NR_getuid 24
42#define __NR_stime 25
43#define __NR_ptrace 26 36#define __NR_ptrace 26
44#define __NR_alarm 27
45#define __NR_oldfstat 28
46#define __NR_pause 29
47#define __NR_utime 30 37#define __NR_utime 30
48#define __NR_stty 31 38#define __NR_stty 31
49#define __NR_gtty 32 39#define __NR_gtty 32
50#define __NR_access 33 40#define __NR_access 33
51#define __NR_nice 34
52#define __NR_ftime 35 41#define __NR_ftime 35
53#define __NR_sync 36 42#define __NR_sync 36
54#define __NR_kill 37 43#define __NR_kill 37
@@ -66,24 +55,18 @@
66#define __NR_geteuid 49 55#define __NR_geteuid 49
67#define __NR_getegid 50 56#define __NR_getegid 50
68#define __NR_acct 51 57#define __NR_acct 51
69#define __NR_umount 52
70#define __NR_lock 53 58#define __NR_lock 53
71#define __NR_ioctl 54 59#define __NR_ioctl 54
72#define __NR_fcntl 55 60#define __NR_fcntl 55
73#define __NR_mpx 56
74#define __NR_setpgid 57 61#define __NR_setpgid 57
75#define __NR_ulimit 58 62#define __NR_ulimit 58
76#define __NR_oldolduname 59
77#define __NR_umask 60 63#define __NR_umask 60
78#define __NR_chroot 61 64#define __NR_chroot 61
79#define __NR_ustat 62 65#define __NR_ustat 62
80#define __NR_dup2 63 66#define __NR_dup2 63
81#define __NR_getppid 64 67#define __NR_getppid 64
82#define __NR_getpgrp 65
83#define __NR_setsid 66 68#define __NR_setsid 66
84#define __NR_sigaction 67 69#define __NR_sigaction 67
85#define __NR_sgetmask 68
86#define __NR_ssetmask 69
87#define __NR_setreuid 70 70#define __NR_setreuid 70
88#define __NR_setregid 71 71#define __NR_setregid 71
89#define __NR_sigsuspend 72 72#define __NR_sigsuspend 72
@@ -98,13 +81,10 @@
98#define __NR_setgroups 81 81#define __NR_setgroups 81
99#define __NR_select 82 82#define __NR_select 82
100#define __NR_symlink 83 83#define __NR_symlink 83
101#define __NR_oldlstat 84
102#define __NR_readlink 85 84#define __NR_readlink 85
103#define __NR_uselib 86 85#define __NR_uselib 86
104#define __NR_swapon 87 86#define __NR_swapon 87
105#define __NR_reboot 88 87#define __NR_reboot 88
106#define __NR_readdir 89
107#define __NR_mmap 90
108#define __NR_munmap 91 88#define __NR_munmap 91
109#define __NR_truncate 92 89#define __NR_truncate 92
110#define __NR_ftruncate 93 90#define __NR_ftruncate 93
@@ -116,22 +96,18 @@
116#define __NR_statfs 99 96#define __NR_statfs 99
117#define __NR_fstatfs 100 97#define __NR_fstatfs 100
118#define __NR_ioperm 101 98#define __NR_ioperm 101
119#define __NR_socketcall 102
120#define __NR_syslog 103 99#define __NR_syslog 103
121#define __NR_setitimer 104 100#define __NR_setitimer 104
122#define __NR_getitimer 105 101#define __NR_getitimer 105
123#define __NR_stat 106 102#define __NR_stat 106
124#define __NR_lstat 107 103#define __NR_lstat 107
125#define __NR_fstat 108 104#define __NR_fstat 108
126#define __NR_olduname 109
127#define __NR_iopl 110 105#define __NR_iopl 110
128#define __NR_vhangup 111 106#define __NR_vhangup 111
129#define __NR_idle 112 107#define __NR_idle 112
130#define __NR_vm86 113
131#define __NR_wait4 114 108#define __NR_wait4 114
132#define __NR_swapoff 115 109#define __NR_swapoff 115
133#define __NR_sysinfo 116 110#define __NR_sysinfo 116
134#define __NR_ipc 117
135#define __NR_fsync 118 111#define __NR_fsync 118
136#define __NR_sigreturn 119 112#define __NR_sigreturn 119
137#define __NR_clone 120 113#define __NR_clone 120
@@ -140,18 +116,15 @@
140#define __NR_modify_ldt 123 116#define __NR_modify_ldt 123
141#define __NR_adjtimex 124 117#define __NR_adjtimex 124
142#define __NR_mprotect 125 118#define __NR_mprotect 125
143#define __NR_sigprocmask 126
144#define __NR_create_module 127 119#define __NR_create_module 127
145#define __NR_init_module 128 120#define __NR_init_module 128
146#define __NR_delete_module 129 121#define __NR_delete_module 129
147#define __NR_get_kernel_syms 130
148#define __NR_quotactl 131 122#define __NR_quotactl 131
149#define __NR_getpgid 132 123#define __NR_getpgid 132
150#define __NR_fchdir 133 124#define __NR_fchdir 133
151#define __NR_bdflush 134 125#define __NR_bdflush 134
152#define __NR_sysfs 135 126#define __NR_sysfs 135
153#define __NR_personality 136 127#define __NR_personality 136
154#define __NR_afs_syscall 137 /* Syscall for Andrew File System */
155#define __NR_setfsuid 138 128#define __NR_setfsuid 138
156#define __NR_setfsgid 139 129#define __NR_setfsgid 139
157#define __NR__llseek 140 130#define __NR__llseek 140
@@ -222,8 +195,6 @@
222#define __NR_capset 205 195#define __NR_capset 205
223#define __NR_sigaltstack 206 196#define __NR_sigaltstack 206
224#define __NR_sendfile 207 197#define __NR_sendfile 207
225#define __NR_streams1 208 /* some people actually want it */
226#define __NR_streams2 209 /* some people actually want it */
227#define __NR_mmap2 210 198#define __NR_mmap2 210
228#define __NR_truncate64 211 199#define __NR_truncate64 211
229#define __NR_ftruncate64 212 200#define __NR_ftruncate64 212
@@ -234,7 +205,6 @@
234#define __NR_mincore 217 205#define __NR_mincore 217
235#define __NR_madvise 218 206#define __NR_madvise 218
236#define __NR_getdents64 219 207#define __NR_getdents64 219
237#define __NR_vfork 220
238 208
239/* Keep this last; should always equal the last valid call number. */ 209/* Keep this last; should always equal the last valid call number. */
240#define __NR_Linux_syscalls 220 210#define __NR_Linux_syscalls 220
@@ -448,55 +418,7 @@ __syscall_return(type,__res); \
448 418
449 419
450#ifdef __KERNEL_SYSCALLS__ 420#ifdef __KERNEL_SYSCALLS__
451
452#include <linux/compiler.h>
453#include <linux/types.h>
454#include <linux/syscalls.h>
455
456/*
457 * we need this inline - forking from kernel space will result
458 * in NO COPY ON WRITE (!!!), until an execve is executed. This
459 * is no problem, but for the stack. This is handled by not letting
460 * main() use the stack at all after fork(). Thus, no function
461 * calls - which means inline code for fork too, as otherwise we
462 * would use the stack upon exit from 'fork()'.
463 *
464 * Actually only pause and fork are needed inline, so that there
465 * won't be any messing with the stack from main(), but we define
466 * some others too.
467 */
468
469#define __NR__exit __NR_exit
470
471static __inline__ _syscall0(int,pause)
472//static __inline__ _syscall1(int,setup,int,magic) FIXME
473static __inline__ _syscall0(int,sync)
474static __inline__ _syscall0(pid_t,setsid)
475static __inline__ _syscall3(int,write,int,fd,const char *,buf,off_t,count)
476static __inline__ _syscall3(int,read,int,fd,char *,buf,off_t,count)
477static __inline__ _syscall3(off_t,lseek,int,fd,off_t,offset,int,count)
478static __inline__ _syscall1(int,dup,int,fd)
479static __inline__ _syscall3(int,execve,const char*,file,char**,argv,char**,envp) 421static __inline__ _syscall3(int,execve,const char*,file,char**,argv,char**,envp)
480static __inline__ _syscall3(int,open,const char *,file,int,flag,int,mode)
481static __inline__ _syscall1(int,close,int,fd)
482static __inline__ _syscall1(int,_exit,int,exitcode)
483static __inline__ _syscall3(pid_t,waitpid,pid_t,pid,int *,wait_stat,int,options)
484static __inline__ _syscall1(int,delete_module,const char *,name)
485
486struct stat;
487static __inline__ _syscall2(int,fstat,int,fd,struct stat *,buf)
488static __inline__ _syscall0(pid_t,getpid)
489static __inline__ _syscall2(int,kill,int,pid,int,sig)
490static __inline__ _syscall2(int,stat,const char *, path,struct stat *,buf)
491static __inline__ _syscall1(int,unlink,char *,pathname)
492
493
494
495extern pid_t waitpid(int, int*, int );
496static __inline__ pid_t wait(int * wait_stat)
497{
498 return waitpid(-1,wait_stat,0);
499}
500#endif 422#endif
501 423
502/* 424/*
@@ -508,30 +430,10 @@ static __inline__ pid_t wait(int * wait_stat)
508#define cond_syscall(x) asm(".weak\t" #x "\n\t.set\t" #x ",sys_ni_syscall"); 430#define cond_syscall(x) asm(".weak\t" #x "\n\t.set\t" #x ",sys_ni_syscall");
509 431
510#ifdef __KERNEL__ 432#ifdef __KERNEL__
511#define __ARCH_WANT_IPC_PARSE_VERSION
512#define __ARCH_WANT_OLD_READDIR
513#define __ARCH_WANT_OLD_STAT
514#define __ARCH_WANT_STAT64 433#define __ARCH_WANT_STAT64
515#define __ARCH_WANT_SYS_ALARM
516#define __ARCH_WANT_SYS_GETHOSTNAME
517#define __ARCH_WANT_SYS_PAUSE
518#define __ARCH_WANT_SYS_SGETMASK
519#define __ARCH_WANT_SYS_SIGNAL
520#define __ARCH_WANT_SYS_TIME
521#define __ARCH_WANT_SYS_UTIME 434#define __ARCH_WANT_SYS_UTIME
522#define __ARCH_WANT_SYS_WAITPID
523#define __ARCH_WANT_SYS_SOCKETCALL
524#define __ARCH_WANT_SYS_FADVISE64
525#define __ARCH_WANT_SYS_GETPGRP
526#define __ARCH_WANT_SYS_LLSEEK 435#define __ARCH_WANT_SYS_LLSEEK
527#define __ARCH_WANT_SYS_NICE
528#define __ARCH_WANT_SYS_OLD_GETRLIMIT
529#define __ARCH_WANT_SYS_OLDUMOUNT
530#define __ARCH_WANT_SYS_SIGPENDING
531#define __ARCH_WANT_SYS_SIGPROCMASK
532#define __ARCH_WANT_SYS_RT_SIGACTION 436#define __ARCH_WANT_SYS_RT_SIGACTION
533#endif 437#endif
534 438
535
536
537#endif /* _XTENSA_UNISTD_H */ 439#endif /* _XTENSA_UNISTD_H */
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index ef8483673aa..f85cbe919e1 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -206,7 +206,10 @@ struct acpi_table_plat_int_src {
206 u8 eid; 206 u8 eid;
207 u8 iosapic_vector; 207 u8 iosapic_vector;
208 u32 global_irq; 208 u32 global_irq;
209 u32 reserved; 209 struct {
210 u32 cpei_override_flag:1;
211 u32 reserved:31;
212 } plint_flags;
210} __attribute__ ((packed)); 213} __attribute__ ((packed));
211 214
212enum acpi_interrupt_id { 215enum acpi_interrupt_id {
@@ -475,7 +478,7 @@ struct acpi_prt_list {
475struct pci_dev; 478struct pci_dev;
476 479
477int acpi_pci_irq_enable (struct pci_dev *dev); 480int acpi_pci_irq_enable (struct pci_dev *dev);
478void acpi_penalize_isa_irq(int irq); 481void acpi_penalize_isa_irq(int irq, int active);
479 482
480#ifdef CONFIG_ACPI_DEALLOCATE_IRQ 483#ifdef CONFIG_ACPI_DEALLOCATE_IRQ
481void acpi_pci_irq_disable (struct pci_dev *dev); 484void acpi_pci_irq_disable (struct pci_dev *dev);
diff --git a/include/linux/audit.h b/include/linux/audit.h
index d68e85580a5..b2a2509bd7e 100644
--- a/include/linux/audit.h
+++ b/include/linux/audit.h
@@ -171,7 +171,7 @@
171#define AUDIT_ARCH_SH64 (EM_SH|__AUDIT_ARCH_64BIT) 171#define AUDIT_ARCH_SH64 (EM_SH|__AUDIT_ARCH_64BIT)
172#define AUDIT_ARCH_SHEL64 (EM_SH|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE) 172#define AUDIT_ARCH_SHEL64 (EM_SH|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE)
173#define AUDIT_ARCH_SPARC (EM_SPARC) 173#define AUDIT_ARCH_SPARC (EM_SPARC)
174#define AUDIT_ARCH_SPARC64 (EM_SPARC64|__AUDIT_ARCH_64BIT) 174#define AUDIT_ARCH_SPARC64 (EM_SPARCV9|__AUDIT_ARCH_64BIT)
175#define AUDIT_ARCH_V850 (EM_V850|__AUDIT_ARCH_LE) 175#define AUDIT_ARCH_V850 (EM_V850|__AUDIT_ARCH_LE)
176#define AUDIT_ARCH_X86_64 (EM_X86_64|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE) 176#define AUDIT_ARCH_X86_64 (EM_X86_64|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE)
177 177
diff --git a/include/linux/buffer_head.h b/include/linux/buffer_head.h
index 802c91e9b3d..90828493791 100644
--- a/include/linux/buffer_head.h
+++ b/include/linux/buffer_head.h
@@ -19,6 +19,9 @@ enum bh_state_bits {
19 BH_Dirty, /* Is dirty */ 19 BH_Dirty, /* Is dirty */
20 BH_Lock, /* Is locked */ 20 BH_Lock, /* Is locked */
21 BH_Req, /* Has been submitted for I/O */ 21 BH_Req, /* Has been submitted for I/O */
22 BH_Uptodate_Lock,/* Used by the first bh in a page, to serialise
23 * IO completion of other buffers in the page
24 */
22 25
23 BH_Mapped, /* Has a disk mapping */ 26 BH_Mapped, /* Has a disk mapping */
24 BH_New, /* Disk mapping was newly created by get_block */ 27 BH_New, /* Disk mapping was newly created by get_block */
diff --git a/include/linux/cache.h b/include/linux/cache.h
index 4d767b93738..f6b5a46c5f8 100644
--- a/include/linux/cache.h
+++ b/include/linux/cache.h
@@ -13,6 +13,12 @@
13#define SMP_CACHE_BYTES L1_CACHE_BYTES 13#define SMP_CACHE_BYTES L1_CACHE_BYTES
14#endif 14#endif
15 15
16#if defined(CONFIG_X86) || defined(CONFIG_SPARC64)
17#define __read_mostly __attribute__((__section__(".data.read_mostly")))
18#else
19#define __read_mostly
20#endif
21
16#ifndef ____cacheline_aligned 22#ifndef ____cacheline_aligned
17#define ____cacheline_aligned __attribute__((__aligned__(SMP_CACHE_BYTES))) 23#define ____cacheline_aligned __attribute__((__aligned__(SMP_CACHE_BYTES)))
18#endif 24#endif
diff --git a/include/linux/compat_ioctl.h b/include/linux/compat_ioctl.h
index 70a4ebb5d96..ecb0d39c079 100644
--- a/include/linux/compat_ioctl.h
+++ b/include/linux/compat_ioctl.h
@@ -346,10 +346,27 @@ COMPATIBLE_IOCTL(PPPOEIOCDFWD)
346/* LP */ 346/* LP */
347COMPATIBLE_IOCTL(LPGETSTATUS) 347COMPATIBLE_IOCTL(LPGETSTATUS)
348/* ppdev */ 348/* ppdev */
349COMPATIBLE_IOCTL(PPSETMODE)
350COMPATIBLE_IOCTL(PPRSTATUS)
351COMPATIBLE_IOCTL(PPRCONTROL)
352COMPATIBLE_IOCTL(PPWCONTROL)
353COMPATIBLE_IOCTL(PPFCONTROL)
354COMPATIBLE_IOCTL(PPRDATA)
355COMPATIBLE_IOCTL(PPWDATA)
349COMPATIBLE_IOCTL(PPCLAIM) 356COMPATIBLE_IOCTL(PPCLAIM)
350COMPATIBLE_IOCTL(PPRELEASE) 357COMPATIBLE_IOCTL(PPRELEASE)
351COMPATIBLE_IOCTL(PPEXCL)
352COMPATIBLE_IOCTL(PPYIELD) 358COMPATIBLE_IOCTL(PPYIELD)
359COMPATIBLE_IOCTL(PPEXCL)
360COMPATIBLE_IOCTL(PPDATADIR)
361COMPATIBLE_IOCTL(PPNEGOT)
362COMPATIBLE_IOCTL(PPWCTLONIRQ)
363COMPATIBLE_IOCTL(PPCLRIRQ)
364COMPATIBLE_IOCTL(PPSETPHASE)
365COMPATIBLE_IOCTL(PPGETMODES)
366COMPATIBLE_IOCTL(PPGETMODE)
367COMPATIBLE_IOCTL(PPGETPHASE)
368COMPATIBLE_IOCTL(PPGETFLAGS)
369COMPATIBLE_IOCTL(PPSETFLAGS)
353/* CDROM stuff */ 370/* CDROM stuff */
354COMPATIBLE_IOCTL(CDROMPAUSE) 371COMPATIBLE_IOCTL(CDROMPAUSE)
355COMPATIBLE_IOCTL(CDROMRESUME) 372COMPATIBLE_IOCTL(CDROMRESUME)
diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h
index 927daa86c9b..ff7f80f48df 100644
--- a/include/linux/cpufreq.h
+++ b/include/linux/cpufreq.h
@@ -201,7 +201,7 @@ struct cpufreq_driver {
201 201
202 /* optional */ 202 /* optional */
203 int (*exit) (struct cpufreq_policy *policy); 203 int (*exit) (struct cpufreq_policy *policy);
204 int (*suspend) (struct cpufreq_policy *policy, u32 state); 204 int (*suspend) (struct cpufreq_policy *policy, pm_message_t pmsg);
205 int (*resume) (struct cpufreq_policy *policy); 205 int (*resume) (struct cpufreq_policy *policy);
206 struct freq_attr **attr; 206 struct freq_attr **attr;
207}; 207};
diff --git a/include/linux/crypto.h b/include/linux/crypto.h
index 387da6a3e58..5e2bcc636a0 100644
--- a/include/linux/crypto.h
+++ b/include/linux/crypto.h
@@ -61,6 +61,15 @@
61#define CRYPTO_DIR_DECRYPT 0 61#define CRYPTO_DIR_DECRYPT 0
62 62
63struct scatterlist; 63struct scatterlist;
64struct crypto_tfm;
65
66struct cipher_desc {
67 struct crypto_tfm *tfm;
68 void (*crfn)(void *ctx, u8 *dst, const u8 *src);
69 unsigned int (*prfn)(const struct cipher_desc *desc, u8 *dst,
70 const u8 *src, unsigned int nbytes);
71 void *info;
72};
64 73
65/* 74/*
66 * Algorithms: modular crypto algorithm implementations, managed 75 * Algorithms: modular crypto algorithm implementations, managed
@@ -73,6 +82,19 @@ struct cipher_alg {
73 unsigned int keylen, u32 *flags); 82 unsigned int keylen, u32 *flags);
74 void (*cia_encrypt)(void *ctx, u8 *dst, const u8 *src); 83 void (*cia_encrypt)(void *ctx, u8 *dst, const u8 *src);
75 void (*cia_decrypt)(void *ctx, u8 *dst, const u8 *src); 84 void (*cia_decrypt)(void *ctx, u8 *dst, const u8 *src);
85
86 unsigned int (*cia_encrypt_ecb)(const struct cipher_desc *desc,
87 u8 *dst, const u8 *src,
88 unsigned int nbytes);
89 unsigned int (*cia_decrypt_ecb)(const struct cipher_desc *desc,
90 u8 *dst, const u8 *src,
91 unsigned int nbytes);
92 unsigned int (*cia_encrypt_cbc)(const struct cipher_desc *desc,
93 u8 *dst, const u8 *src,
94 unsigned int nbytes);
95 unsigned int (*cia_decrypt_cbc)(const struct cipher_desc *desc,
96 u8 *dst, const u8 *src,
97 unsigned int nbytes);
76}; 98};
77 99
78struct digest_alg { 100struct digest_alg {
@@ -102,6 +124,7 @@ struct crypto_alg {
102 u32 cra_flags; 124 u32 cra_flags;
103 unsigned int cra_blocksize; 125 unsigned int cra_blocksize;
104 unsigned int cra_ctxsize; 126 unsigned int cra_ctxsize;
127 unsigned int cra_alignmask;
105 const char cra_name[CRYPTO_MAX_ALG_NAME]; 128 const char cra_name[CRYPTO_MAX_ALG_NAME];
106 129
107 union { 130 union {
@@ -136,7 +159,6 @@ static inline int crypto_alg_available(const char *name, u32 flags)
136 * and core processing logic. Managed via crypto_alloc_tfm() and 159 * and core processing logic. Managed via crypto_alloc_tfm() and
137 * crypto_free_tfm(), as well as the various helpers below. 160 * crypto_free_tfm(), as well as the various helpers below.
138 */ 161 */
139struct crypto_tfm;
140 162
141struct cipher_tfm { 163struct cipher_tfm {
142 void *cit_iv; 164 void *cit_iv;
@@ -266,6 +288,16 @@ static inline unsigned int crypto_tfm_alg_digestsize(struct crypto_tfm *tfm)
266 return tfm->__crt_alg->cra_digest.dia_digestsize; 288 return tfm->__crt_alg->cra_digest.dia_digestsize;
267} 289}
268 290
291static inline unsigned int crypto_tfm_alg_alignmask(struct crypto_tfm *tfm)
292{
293 return tfm->__crt_alg->cra_alignmask;
294}
295
296static inline void *crypto_tfm_ctx(struct crypto_tfm *tfm)
297{
298 return (void *)&tfm[1];
299}
300
269/* 301/*
270 * API wrappers. 302 * API wrappers.
271 */ 303 */
diff --git a/include/linux/device.h b/include/linux/device.h
index f378c846e6d..06e5d42f2c7 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -284,8 +284,10 @@ struct device {
284 struct device_driver *driver; /* which driver has allocated this 284 struct device_driver *driver; /* which driver has allocated this
285 device */ 285 device */
286 void *driver_data; /* data private to the driver */ 286 void *driver_data; /* data private to the driver */
287 void *platform_data; /* Platform specific data (e.g. ACPI, 287 void *platform_data; /* Platform specific data, device
288 BIOS data relevant to device) */ 288 core doesn't touch it */
289 void *firmware_data; /* Firmware specific data (e.g. ACPI,
290 BIOS data),reserved for device core*/
289 struct dev_pm_info power; 291 struct dev_pm_info power;
290 292
291 u64 *dma_mask; /* dma mask (if dma'able device) */ 293 u64 *dma_mask; /* dma mask (if dma'able device) */
diff --git a/include/linux/etherdevice.h b/include/linux/etherdevice.h
index cf3847edc50..ce8518e658b 100644
--- a/include/linux/etherdevice.h
+++ b/include/linux/etherdevice.h
@@ -33,7 +33,7 @@ extern int eth_header(struct sk_buff *skb, struct net_device *dev,
33 unsigned short type, void *daddr, 33 unsigned short type, void *daddr,
34 void *saddr, unsigned len); 34 void *saddr, unsigned len);
35extern int eth_rebuild_header(struct sk_buff *skb); 35extern int eth_rebuild_header(struct sk_buff *skb);
36extern unsigned short eth_type_trans(struct sk_buff *skb, struct net_device *dev); 36extern __be16 eth_type_trans(struct sk_buff *skb, struct net_device *dev);
37extern void eth_header_cache_update(struct hh_cache *hh, struct net_device *dev, 37extern void eth_header_cache_update(struct hh_cache *hh, struct net_device *dev,
38 unsigned char * haddr); 38 unsigned char * haddr);
39extern int eth_header_cache(struct neighbour *neigh, 39extern int eth_header_cache(struct neighbour *neigh,
diff --git a/include/linux/ext3_fs.h b/include/linux/ext3_fs.h
index 4b6e1ab216a..c16662836c5 100644
--- a/include/linux/ext3_fs.h
+++ b/include/linux/ext3_fs.h
@@ -239,6 +239,20 @@ struct ext3_new_group_data {
239#define EXT3_IOC_SETRSVSZ _IOW('f', 6, long) 239#define EXT3_IOC_SETRSVSZ _IOW('f', 6, long)
240 240
241/* 241/*
242 * Mount options
243 */
244struct ext3_mount_options {
245 unsigned long s_mount_opt;
246 uid_t s_resuid;
247 gid_t s_resgid;
248 unsigned long s_commit_interval;
249#ifdef CONFIG_QUOTA
250 int s_jquota_fmt;
251 char *s_qf_names[MAXQUOTAS];
252#endif
253};
254
255/*
242 * Structure of an inode on the disk 256 * Structure of an inode on the disk
243 */ 257 */
244struct ext3_inode { 258struct ext3_inode {
diff --git a/include/linux/fddidevice.h b/include/linux/fddidevice.h
index 002f6367697..e61e42dfd31 100644
--- a/include/linux/fddidevice.h
+++ b/include/linux/fddidevice.h
@@ -25,7 +25,7 @@
25#include <linux/if_fddi.h> 25#include <linux/if_fddi.h>
26 26
27#ifdef __KERNEL__ 27#ifdef __KERNEL__
28extern unsigned short fddi_type_trans(struct sk_buff *skb, 28extern __be16 fddi_type_trans(struct sk_buff *skb,
29 struct net_device *dev); 29 struct net_device *dev);
30extern struct net_device *alloc_fddidev(int sizeof_priv); 30extern struct net_device *alloc_fddidev(int sizeof_priv);
31#endif 31#endif
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 047bde30836..c9bf3746a9f 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -474,6 +474,11 @@ struct inode {
474 struct dnotify_struct *i_dnotify; /* for directory notifications */ 474 struct dnotify_struct *i_dnotify; /* for directory notifications */
475#endif 475#endif
476 476
477#ifdef CONFIG_INOTIFY
478 struct list_head inotify_watches; /* watches on this inode */
479 struct semaphore inotify_sem; /* protects the watches list */
480#endif
481
477 unsigned long i_state; 482 unsigned long i_state;
478 unsigned long dirtied_when; /* jiffies of first dirtying */ 483 unsigned long dirtied_when; /* jiffies of first dirtying */
479 484
@@ -1393,7 +1398,6 @@ extern void emergency_remount(void);
1393extern int do_remount_sb(struct super_block *sb, int flags, 1398extern int do_remount_sb(struct super_block *sb, int flags,
1394 void *data, int force); 1399 void *data, int force);
1395extern sector_t bmap(struct inode *, sector_t); 1400extern sector_t bmap(struct inode *, sector_t);
1396extern int setattr_mask(unsigned int);
1397extern int notify_change(struct dentry *, struct iattr *); 1401extern int notify_change(struct dentry *, struct iattr *);
1398extern int permission(struct inode *, int, struct nameidata *); 1402extern int permission(struct inode *, int, struct nameidata *);
1399extern int generic_permission(struct inode *, int, 1403extern int generic_permission(struct inode *, int,
@@ -1435,6 +1439,7 @@ extern struct inode * igrab(struct inode *);
1435extern ino_t iunique(struct super_block *, ino_t); 1439extern ino_t iunique(struct super_block *, ino_t);
1436extern int inode_needs_sync(struct inode *inode); 1440extern int inode_needs_sync(struct inode *inode);
1437extern void generic_delete_inode(struct inode *inode); 1441extern void generic_delete_inode(struct inode *inode);
1442extern void generic_drop_inode(struct inode *inode);
1438 1443
1439extern struct inode *ilookup5(struct super_block *sb, unsigned long hashval, 1444extern struct inode *ilookup5(struct super_block *sb, unsigned long hashval,
1440 int (*test)(struct inode *, void *), void *data); 1445 int (*test)(struct inode *, void *), void *data);
diff --git a/include/linux/fsnotify.h b/include/linux/fsnotify.h
new file mode 100644
index 00000000000..eb581b6cfca
--- /dev/null
+++ b/include/linux/fsnotify.h
@@ -0,0 +1,248 @@
1#ifndef _LINUX_FS_NOTIFY_H
2#define _LINUX_FS_NOTIFY_H
3
4/*
5 * include/linux/fsnotify.h - generic hooks for filesystem notification, to
6 * reduce in-source duplication from both dnotify and inotify.
7 *
8 * We don't compile any of this away in some complicated menagerie of ifdefs.
9 * Instead, we rely on the code inside to optimize away as needed.
10 *
11 * (C) Copyright 2005 Robert Love
12 */
13
14#ifdef __KERNEL__
15
16#include <linux/dnotify.h>
17#include <linux/inotify.h>
18
19/*
20 * fsnotify_move - file old_name at old_dir was moved to new_name at new_dir
21 */
22static inline void fsnotify_move(struct inode *old_dir, struct inode *new_dir,
23 const char *old_name, const char *new_name,
24 int isdir)
25{
26 u32 cookie = inotify_get_cookie();
27
28 if (old_dir == new_dir)
29 inode_dir_notify(old_dir, DN_RENAME);
30 else {
31 inode_dir_notify(old_dir, DN_DELETE);
32 inode_dir_notify(new_dir, DN_CREATE);
33 }
34
35 if (isdir)
36 isdir = IN_ISDIR;
37 inotify_inode_queue_event(old_dir, IN_MOVED_FROM|isdir,cookie,old_name);
38 inotify_inode_queue_event(new_dir, IN_MOVED_TO|isdir, cookie, new_name);
39}
40
41/*
42 * fsnotify_unlink - file was unlinked
43 */
44static inline void fsnotify_unlink(struct dentry *dentry, struct inode *dir)
45{
46 struct inode *inode = dentry->d_inode;
47
48 inode_dir_notify(dir, DN_DELETE);
49 inotify_inode_queue_event(dir, IN_DELETE, 0, dentry->d_name.name);
50 inotify_inode_queue_event(inode, IN_DELETE_SELF, 0, NULL);
51
52 inotify_inode_is_dead(inode);
53}
54
55/*
56 * fsnotify_rmdir - directory was removed
57 */
58static inline void fsnotify_rmdir(struct dentry *dentry, struct inode *inode,
59 struct inode *dir)
60{
61 inode_dir_notify(dir, DN_DELETE);
62 inotify_inode_queue_event(dir,IN_DELETE|IN_ISDIR,0,dentry->d_name.name);
63 inotify_inode_queue_event(inode, IN_DELETE_SELF | IN_ISDIR, 0, NULL);
64 inotify_inode_is_dead(inode);
65}
66
67/*
68 * fsnotify_create - 'name' was linked in
69 */
70static inline void fsnotify_create(struct inode *inode, const char *name)
71{
72 inode_dir_notify(inode, DN_CREATE);
73 inotify_inode_queue_event(inode, IN_CREATE, 0, name);
74}
75
76/*
77 * fsnotify_mkdir - directory 'name' was created
78 */
79static inline void fsnotify_mkdir(struct inode *inode, const char *name)
80{
81 inode_dir_notify(inode, DN_CREATE);
82 inotify_inode_queue_event(inode, IN_CREATE | IN_ISDIR, 0, name);
83}
84
85/*
86 * fsnotify_access - file was read
87 */
88static inline void fsnotify_access(struct dentry *dentry)
89{
90 struct inode *inode = dentry->d_inode;
91 u32 mask = IN_ACCESS;
92
93 if (S_ISDIR(inode->i_mode))
94 mask |= IN_ISDIR;
95
96 dnotify_parent(dentry, DN_ACCESS);
97 inotify_dentry_parent_queue_event(dentry, mask, 0, dentry->d_name.name);
98 inotify_inode_queue_event(inode, mask, 0, NULL);
99}
100
101/*
102 * fsnotify_modify - file was modified
103 */
104static inline void fsnotify_modify(struct dentry *dentry)
105{
106 struct inode *inode = dentry->d_inode;
107 u32 mask = IN_MODIFY;
108
109 if (S_ISDIR(inode->i_mode))
110 mask |= IN_ISDIR;
111
112 dnotify_parent(dentry, DN_MODIFY);
113 inotify_dentry_parent_queue_event(dentry, mask, 0, dentry->d_name.name);
114 inotify_inode_queue_event(inode, mask, 0, NULL);
115}
116
117/*
118 * fsnotify_open - file was opened
119 */
120static inline void fsnotify_open(struct dentry *dentry)
121{
122 struct inode *inode = dentry->d_inode;
123 u32 mask = IN_OPEN;
124
125 if (S_ISDIR(inode->i_mode))
126 mask |= IN_ISDIR;
127
128 inotify_inode_queue_event(inode, mask, 0, NULL);
129 inotify_dentry_parent_queue_event(dentry, mask, 0, dentry->d_name.name);
130}
131
132/*
133 * fsnotify_close - file was closed
134 */
135static inline void fsnotify_close(struct file *file)
136{
137 struct dentry *dentry = file->f_dentry;
138 struct inode *inode = dentry->d_inode;
139 const char *name = dentry->d_name.name;
140 mode_t mode = file->f_mode;
141 u32 mask = (mode & FMODE_WRITE) ? IN_CLOSE_WRITE : IN_CLOSE_NOWRITE;
142
143 if (S_ISDIR(inode->i_mode))
144 mask |= IN_ISDIR;
145
146 inotify_dentry_parent_queue_event(dentry, mask, 0, name);
147 inotify_inode_queue_event(inode, mask, 0, NULL);
148}
149
150/*
151 * fsnotify_xattr - extended attributes were changed
152 */
153static inline void fsnotify_xattr(struct dentry *dentry)
154{
155 struct inode *inode = dentry->d_inode;
156 u32 mask = IN_ATTRIB;
157
158 if (S_ISDIR(inode->i_mode))
159 mask |= IN_ISDIR;
160
161 inotify_dentry_parent_queue_event(dentry, mask, 0, dentry->d_name.name);
162 inotify_inode_queue_event(inode, mask, 0, NULL);
163}
164
165/*
166 * fsnotify_change - notify_change event. file was modified and/or metadata
167 * was changed.
168 */
169static inline void fsnotify_change(struct dentry *dentry, unsigned int ia_valid)
170{
171 struct inode *inode = dentry->d_inode;
172 int dn_mask = 0;
173 u32 in_mask = 0;
174
175 if (ia_valid & ATTR_UID) {
176 in_mask |= IN_ATTRIB;
177 dn_mask |= DN_ATTRIB;
178 }
179 if (ia_valid & ATTR_GID) {
180 in_mask |= IN_ATTRIB;
181 dn_mask |= DN_ATTRIB;
182 }
183 if (ia_valid & ATTR_SIZE) {
184 in_mask |= IN_MODIFY;
185 dn_mask |= DN_MODIFY;
186 }
187 /* both times implies a utime(s) call */
188 if ((ia_valid & (ATTR_ATIME | ATTR_MTIME)) == (ATTR_ATIME | ATTR_MTIME))
189 {
190 in_mask |= IN_ATTRIB;
191 dn_mask |= DN_ATTRIB;
192 } else if (ia_valid & ATTR_ATIME) {
193 in_mask |= IN_ACCESS;
194 dn_mask |= DN_ACCESS;
195 } else if (ia_valid & ATTR_MTIME) {
196 in_mask |= IN_MODIFY;
197 dn_mask |= DN_MODIFY;
198 }
199 if (ia_valid & ATTR_MODE) {
200 in_mask |= IN_ATTRIB;
201 dn_mask |= DN_ATTRIB;
202 }
203
204 if (dn_mask)
205 dnotify_parent(dentry, dn_mask);
206 if (in_mask) {
207 if (S_ISDIR(inode->i_mode))
208 in_mask |= IN_ISDIR;
209 inotify_inode_queue_event(inode, in_mask, 0, NULL);
210 inotify_dentry_parent_queue_event(dentry, in_mask, 0,
211 dentry->d_name.name);
212 }
213}
214
215#ifdef CONFIG_INOTIFY /* inotify helpers */
216
217/*
218 * fsnotify_oldname_init - save off the old filename before we change it
219 */
220static inline const char *fsnotify_oldname_init(const char *name)
221{
222 return kstrdup(name, GFP_KERNEL);
223}
224
225/*
226 * fsnotify_oldname_free - free the name we got from fsnotify_oldname_init
227 */
228static inline void fsnotify_oldname_free(const char *old_name)
229{
230 kfree(old_name);
231}
232
233#else /* CONFIG_INOTIFY */
234
235static inline const char *fsnotify_oldname_init(const char *name)
236{
237 return NULL;
238}
239
240static inline void fsnotify_oldname_free(const char *old_name)
241{
242}
243
244#endif /* ! CONFIG_INOTIFY */
245
246#endif /* __KERNEL__ */
247
248#endif /* _LINUX_FS_NOTIFY_H */
diff --git a/include/linux/gfp.h b/include/linux/gfp.h
index 8d6bf608b19..7c7400137e9 100644
--- a/include/linux/gfp.h
+++ b/include/linux/gfp.h
@@ -12,8 +12,8 @@ struct vm_area_struct;
12 * GFP bitmasks.. 12 * GFP bitmasks..
13 */ 13 */
14/* Zone modifiers in GFP_ZONEMASK (see linux/mmzone.h - low two bits) */ 14/* Zone modifiers in GFP_ZONEMASK (see linux/mmzone.h - low two bits) */
15#define __GFP_DMA 0x01 15#define __GFP_DMA 0x01u
16#define __GFP_HIGHMEM 0x02 16#define __GFP_HIGHMEM 0x02u
17 17
18/* 18/*
19 * Action modifiers - doesn't change the zoning 19 * Action modifiers - doesn't change the zoning
diff --git a/include/linux/hardirq.h b/include/linux/hardirq.h
index 8336dba1897..5912874ca83 100644
--- a/include/linux/hardirq.h
+++ b/include/linux/hardirq.h
@@ -2,6 +2,7 @@
2#define LINUX_HARDIRQ_H 2#define LINUX_HARDIRQ_H
3 3
4#include <linux/config.h> 4#include <linux/config.h>
5#include <linux/preempt.h>
5#include <linux/smp_lock.h> 6#include <linux/smp_lock.h>
6#include <asm/hardirq.h> 7#include <asm/hardirq.h>
7#include <asm/system.h> 8#include <asm/system.h>
diff --git a/include/linux/hdlc.h b/include/linux/hdlc.h
index ed2927ef1ff..df695e9ae32 100644
--- a/include/linux/hdlc.h
+++ b/include/linux/hdlc.h
@@ -242,8 +242,8 @@ static __inline__ struct net_device_stats *hdlc_stats(struct net_device *dev)
242} 242}
243 243
244 244
245static __inline__ unsigned short hdlc_type_trans(struct sk_buff *skb, 245static __inline__ __be16 hdlc_type_trans(struct sk_buff *skb,
246 struct net_device *dev) 246 struct net_device *dev)
247{ 247{
248 hdlc_device *hdlc = dev_to_hdlc(dev); 248 hdlc_device *hdlc = dev_to_hdlc(dev);
249 249
diff --git a/include/linux/if_shaper.h b/include/linux/if_shaper.h
index 004e6f09a6e..68c896a36a3 100644
--- a/include/linux/if_shaper.h
+++ b/include/linux/if_shaper.h
@@ -23,7 +23,7 @@ struct shaper
23 __u32 shapeclock; 23 __u32 shapeclock;
24 unsigned long recovery; /* Time we can next clock a packet out on 24 unsigned long recovery; /* Time we can next clock a packet out on
25 an empty queue */ 25 an empty queue */
26 struct semaphore sem; 26 spinlock_t lock;
27 struct net_device_stats stats; 27 struct net_device_stats stats;
28 struct net_device *dev; 28 struct net_device *dev;
29 int (*hard_start_xmit) (struct sk_buff *skb, 29 int (*hard_start_xmit) (struct sk_buff *skb,
diff --git a/include/linux/igmp.h b/include/linux/igmp.h
index 390e760a96d..0c31ef0b5ba 100644
--- a/include/linux/igmp.h
+++ b/include/linux/igmp.h
@@ -148,7 +148,6 @@ struct ip_sf_socklist
148struct ip_mc_socklist 148struct ip_mc_socklist
149{ 149{
150 struct ip_mc_socklist *next; 150 struct ip_mc_socklist *next;
151 int count;
152 struct ip_mreqn multi; 151 struct ip_mreqn multi;
153 unsigned int sfmode; /* MCAST_{INCLUDE,EXCLUDE} */ 152 unsigned int sfmode; /* MCAST_{INCLUDE,EXCLUDE} */
154 struct ip_sf_socklist *sflist; 153 struct ip_sf_socklist *sflist;
diff --git a/include/linux/inotify.h b/include/linux/inotify.h
new file mode 100644
index 00000000000..a40c2bf0408
--- /dev/null
+++ b/include/linux/inotify.h
@@ -0,0 +1,108 @@
1/*
2 * Inode based directory notification for Linux
3 *
4 * Copyright (C) 2005 John McCutchan
5 */
6
7#ifndef _LINUX_INOTIFY_H
8#define _LINUX_INOTIFY_H
9
10#include <linux/types.h>
11
12/*
13 * struct inotify_event - structure read from the inotify device for each event
14 *
15 * When you are watching a directory, you will receive the filename for events
16 * such as IN_CREATE, IN_DELETE, IN_OPEN, IN_CLOSE, ..., relative to the wd.
17 */
18struct inotify_event {
19 __s32 wd; /* watch descriptor */
20 __u32 mask; /* watch mask */
21 __u32 cookie; /* cookie to synchronize two events */
22 __u32 len; /* length (including nulls) of name */
23 char name[0]; /* stub for possible name */
24};
25
26/* the following are legal, implemented events that user-space can watch for */
27#define IN_ACCESS 0x00000001 /* File was accessed */
28#define IN_MODIFY 0x00000002 /* File was modified */
29#define IN_ATTRIB 0x00000004 /* Metadata changed */
30#define IN_CLOSE_WRITE 0x00000008 /* Writtable file was closed */
31#define IN_CLOSE_NOWRITE 0x00000010 /* Unwrittable file closed */
32#define IN_OPEN 0x00000020 /* File was opened */
33#define IN_MOVED_FROM 0x00000040 /* File was moved from X */
34#define IN_MOVED_TO 0x00000080 /* File was moved to Y */
35#define IN_CREATE 0x00000100 /* Subfile was created */
36#define IN_DELETE 0x00000200 /* Subfile was deleted */
37#define IN_DELETE_SELF 0x00000400 /* Self was deleted */
38
39/* the following are legal events. they are sent as needed to any watch */
40#define IN_UNMOUNT 0x00002000 /* Backing fs was unmounted */
41#define IN_Q_OVERFLOW 0x00004000 /* Event queued overflowed */
42#define IN_IGNORED 0x00008000 /* File was ignored */
43
44/* helper events */
45#define IN_CLOSE (IN_CLOSE_WRITE | IN_CLOSE_NOWRITE) /* close */
46#define IN_MOVE (IN_MOVED_FROM | IN_MOVED_TO) /* moves */
47
48/* special flags */
49#define IN_ISDIR 0x40000000 /* event occurred against dir */
50#define IN_ONESHOT 0x80000000 /* only send event once */
51
52/*
53 * All of the events - we build the list by hand so that we can add flags in
54 * the future and not break backward compatibility. Apps will get only the
55 * events that they originally wanted. Be sure to add new events here!
56 */
57#define IN_ALL_EVENTS (IN_ACCESS | IN_MODIFY | IN_ATTRIB | IN_CLOSE_WRITE | \
58 IN_CLOSE_NOWRITE | IN_OPEN | IN_MOVED_FROM | \
59 IN_MOVED_TO | IN_DELETE | IN_CREATE | IN_DELETE_SELF)
60
61#ifdef __KERNEL__
62
63#include <linux/dcache.h>
64#include <linux/fs.h>
65#include <linux/config.h>
66
67#ifdef CONFIG_INOTIFY
68
69extern void inotify_inode_queue_event(struct inode *, __u32, __u32,
70 const char *);
71extern void inotify_dentry_parent_queue_event(struct dentry *, __u32, __u32,
72 const char *);
73extern void inotify_unmount_inodes(struct list_head *);
74extern void inotify_inode_is_dead(struct inode *);
75extern u32 inotify_get_cookie(void);
76
77#else
78
79static inline void inotify_inode_queue_event(struct inode *inode,
80 __u32 mask, __u32 cookie,
81 const char *filename)
82{
83}
84
85static inline void inotify_dentry_parent_queue_event(struct dentry *dentry,
86 __u32 mask, __u32 cookie,
87 const char *filename)
88{
89}
90
91static inline void inotify_unmount_inodes(struct list_head *list)
92{
93}
94
95static inline void inotify_inode_is_dead(struct inode *inode)
96{
97}
98
99static inline u32 inotify_get_cookie(void)
100{
101 return 0;
102}
103
104#endif /* CONFIG_INOTIFY */
105
106#endif /* __KERNEL __ */
107
108#endif /* _LINUX_INOTIFY_H */
diff --git a/include/linux/ioprio.h b/include/linux/ioprio.h
index 8a453a0b5e4..88d5961f7a3 100644
--- a/include/linux/ioprio.h
+++ b/include/linux/ioprio.h
@@ -34,9 +34,6 @@ enum {
34 */ 34 */
35#define IOPRIO_BE_NR (8) 35#define IOPRIO_BE_NR (8)
36 36
37asmlinkage int sys_ioprio_set(int, int, int);
38asmlinkage int sys_ioprio_get(int, int);
39
40enum { 37enum {
41 IOPRIO_WHO_PROCESS = 1, 38 IOPRIO_WHO_PROCESS = 1,
42 IOPRIO_WHO_PGRP, 39 IOPRIO_WHO_PGRP,
diff --git a/include/linux/jffs2_fs_sb.h b/include/linux/jffs2_fs_sb.h
index 4afc8d8c2e9..1e21546622d 100644
--- a/include/linux/jffs2_fs_sb.h
+++ b/include/linux/jffs2_fs_sb.h
@@ -1,4 +1,4 @@
1/* $Id: jffs2_fs_sb.h,v 1.48 2004/11/20 10:41:12 dwmw2 Exp $ */ 1/* $Id: jffs2_fs_sb.h,v 1.52 2005/05/19 16:12:17 gleixner Exp $ */
2 2
3#ifndef _JFFS2_FS_SB 3#ifndef _JFFS2_FS_SB
4#define _JFFS2_FS_SB 4#define _JFFS2_FS_SB
@@ -14,7 +14,8 @@
14#include <linux/rwsem.h> 14#include <linux/rwsem.h>
15 15
16#define JFFS2_SB_FLAG_RO 1 16#define JFFS2_SB_FLAG_RO 1
17#define JFFS2_SB_FLAG_MOUNTING 2 17#define JFFS2_SB_FLAG_SCANNING 2 /* Flash scanning is in progress */
18#define JFFS2_SB_FLAG_BUILDING 4 /* File system building is in progress */
18 19
19struct jffs2_inodirty; 20struct jffs2_inodirty;
20 21
@@ -31,7 +32,7 @@ struct jffs2_sb_info {
31 unsigned int flags; 32 unsigned int flags;
32 33
33 struct task_struct *gc_task; /* GC task struct */ 34 struct task_struct *gc_task; /* GC task struct */
34 struct semaphore gc_thread_start; /* GC thread start mutex */ 35 struct completion gc_thread_start; /* GC thread start completion */
35 struct completion gc_thread_exit; /* GC thread exit completion port */ 36 struct completion gc_thread_exit; /* GC thread exit completion port */
36 37
37 struct semaphore alloc_sem; /* Used to protect all the following 38 struct semaphore alloc_sem; /* Used to protect all the following
@@ -94,7 +95,7 @@ struct jffs2_sb_info {
94 to an obsoleted node. I don't like this. Alternatives welcomed. */ 95 to an obsoleted node. I don't like this. Alternatives welcomed. */
95 struct semaphore erase_free_sem; 96 struct semaphore erase_free_sem;
96 97
97#if defined CONFIG_JFFS2_FS_NAND || defined CONFIG_JFFS2_FS_NOR_ECC 98#ifdef CONFIG_JFFS2_FS_WRITEBUFFER
98 /* Write-behind buffer for NAND flash */ 99 /* Write-behind buffer for NAND flash */
99 unsigned char *wbuf; 100 unsigned char *wbuf;
100 uint32_t wbuf_ofs; 101 uint32_t wbuf_ofs;
diff --git a/include/linux/kprobes.h b/include/linux/kprobes.h
index b7a194c4362..e050fc2d4c2 100644
--- a/include/linux/kprobes.h
+++ b/include/linux/kprobes.h
@@ -155,7 +155,7 @@ extern void arch_copy_kprobe(struct kprobe *p);
155extern void arch_arm_kprobe(struct kprobe *p); 155extern void arch_arm_kprobe(struct kprobe *p);
156extern void arch_disarm_kprobe(struct kprobe *p); 156extern void arch_disarm_kprobe(struct kprobe *p);
157extern void arch_remove_kprobe(struct kprobe *p); 157extern void arch_remove_kprobe(struct kprobe *p);
158extern int arch_init(void); 158extern int arch_init_kprobes(void);
159extern void show_registers(struct pt_regs *regs); 159extern void show_registers(struct pt_regs *regs);
160extern kprobe_opcode_t *get_insn_slot(void); 160extern kprobe_opcode_t *get_insn_slot(void);
161extern void free_insn_slot(kprobe_opcode_t *slot); 161extern void free_insn_slot(kprobe_opcode_t *slot);
diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h
index 9b6d05172ed..dce53ac1625 100644
--- a/include/linux/mod_devicetable.h
+++ b/include/linux/mod_devicetable.h
@@ -174,6 +174,17 @@ struct serio_device_id {
174 __u8 proto; 174 __u8 proto;
175}; 175};
176 176
177/*
178 * Struct used for matching a device
179 */
180struct of_device_id
181{
182 char name[32];
183 char type[32];
184 char compatible[128];
185 void *data;
186};
187
177 188
178/* PCMCIA */ 189/* PCMCIA */
179 190
diff --git a/include/linux/mount.h b/include/linux/mount.h
index 8b8d3b9beef..f8f39937e30 100644
--- a/include/linux/mount.h
+++ b/include/linux/mount.h
@@ -12,6 +12,7 @@
12#define _LINUX_MOUNT_H 12#define _LINUX_MOUNT_H
13#ifdef __KERNEL__ 13#ifdef __KERNEL__
14 14
15#include <linux/types.h>
15#include <linux/list.h> 16#include <linux/list.h>
16#include <linux/spinlock.h> 17#include <linux/spinlock.h>
17#include <asm/atomic.h> 18#include <asm/atomic.h>
@@ -34,7 +35,7 @@ struct vfsmount
34 int mnt_expiry_mark; /* true if marked for expiry */ 35 int mnt_expiry_mark; /* true if marked for expiry */
35 char *mnt_devname; /* Name of device e.g. /dev/dsk/hda1 */ 36 char *mnt_devname; /* Name of device e.g. /dev/dsk/hda1 */
36 struct list_head mnt_list; 37 struct list_head mnt_list;
37 struct list_head mnt_fslink; /* link in fs-specific expiry list */ 38 struct list_head mnt_expire; /* link in fs-specific expiry list */
38 struct namespace *mnt_namespace; /* containing namespace */ 39 struct namespace *mnt_namespace; /* containing namespace */
39}; 40};
40 41
@@ -47,7 +48,7 @@ static inline struct vfsmount *mntget(struct vfsmount *mnt)
47 48
48extern void __mntput(struct vfsmount *mnt); 49extern void __mntput(struct vfsmount *mnt);
49 50
50static inline void _mntput(struct vfsmount *mnt) 51static inline void mntput_no_expire(struct vfsmount *mnt)
51{ 52{
52 if (mnt) { 53 if (mnt) {
53 if (atomic_dec_and_test(&mnt->mnt_count)) 54 if (atomic_dec_and_test(&mnt->mnt_count))
@@ -59,7 +60,7 @@ static inline void mntput(struct vfsmount *mnt)
59{ 60{
60 if (mnt) { 61 if (mnt) {
61 mnt->mnt_expiry_mark = 0; 62 mnt->mnt_expiry_mark = 0;
62 _mntput(mnt); 63 mntput_no_expire(mnt);
63 } 64 }
64} 65}
65 66
@@ -76,6 +77,7 @@ extern int do_add_mount(struct vfsmount *newmnt, struct nameidata *nd,
76extern void mark_mounts_for_expiry(struct list_head *mounts); 77extern void mark_mounts_for_expiry(struct list_head *mounts);
77 78
78extern spinlock_t vfsmount_lock; 79extern spinlock_t vfsmount_lock;
80extern dev_t name_to_dev_t(char *name);
79 81
80#endif 82#endif
81#endif /* _LINUX_MOUNT_H */ 83#endif /* _LINUX_MOUNT_H */
diff --git a/include/linux/mtd/cfi.h b/include/linux/mtd/cfi.h
index 2ed8c585021..e6b6a1c66bd 100644
--- a/include/linux/mtd/cfi.h
+++ b/include/linux/mtd/cfi.h
@@ -1,7 +1,7 @@
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.50 2004/11/20 12:46:51 dwmw2 Exp $ 4 * $Id: cfi.h,v 1.54 2005/06/06 23:04:36 tpoynor Exp $
5 */ 5 */
6 6
7#ifndef __MTD_CFI_H__ 7#ifndef __MTD_CFI_H__
@@ -148,6 +148,14 @@ struct cfi_pri_intelext {
148 uint8_t extra[0]; 148 uint8_t extra[0];
149} __attribute__((packed)); 149} __attribute__((packed));
150 150
151struct cfi_intelext_otpinfo {
152 uint32_t ProtRegAddr;
153 uint16_t FactGroups;
154 uint8_t FactProtRegSize;
155 uint16_t UserGroups;
156 uint8_t UserProtRegSize;
157} __attribute__((packed));
158
151struct cfi_intelext_blockinfo { 159struct cfi_intelext_blockinfo {
152 uint16_t NumIdentBlocks; 160 uint16_t NumIdentBlocks;
153 uint16_t BlockSize; 161 uint16_t BlockSize;
@@ -244,7 +252,7 @@ static inline uint32_t cfi_build_cmd_addr(uint32_t cmd_ofs, int interleave, int
244 * It looks too long to be inline, but in the common case it should almost all 252 * It looks too long to be inline, but in the common case it should almost all
245 * get optimised away. 253 * get optimised away.
246 */ 254 */
247static inline map_word cfi_build_cmd(u_char cmd, struct map_info *map, struct cfi_private *cfi) 255static inline map_word cfi_build_cmd(u_long cmd, struct map_info *map, struct cfi_private *cfi)
248{ 256{
249 map_word val = { {0} }; 257 map_word val = { {0} };
250 int wordwidth, words_per_bus, chip_mode, chips_per_word; 258 int wordwidth, words_per_bus, chip_mode, chips_per_word;
@@ -307,6 +315,69 @@ static inline map_word cfi_build_cmd(u_char cmd, struct map_info *map, struct cf
307} 315}
308#define CMD(x) cfi_build_cmd((x), map, cfi) 316#define CMD(x) cfi_build_cmd((x), map, cfi)
309 317
318
319static inline unsigned char cfi_merge_status(map_word val, struct map_info *map,
320 struct cfi_private *cfi)
321{
322 int wordwidth, words_per_bus, chip_mode, chips_per_word;
323 unsigned long onestat, res = 0;
324 int i;
325
326 /* We do it this way to give the compiler a fighting chance
327 of optimising away all the crap for 'bankwidth' larger than
328 an unsigned long, in the common case where that support is
329 disabled */
330 if (map_bankwidth_is_large(map)) {
331 wordwidth = sizeof(unsigned long);
332 words_per_bus = (map_bankwidth(map)) / wordwidth; // i.e. normally 1
333 } else {
334 wordwidth = map_bankwidth(map);
335 words_per_bus = 1;
336 }
337
338 chip_mode = map_bankwidth(map) / cfi_interleave(cfi);
339 chips_per_word = wordwidth * cfi_interleave(cfi) / map_bankwidth(map);
340
341 onestat = val.x[0];
342 /* Or all status words together */
343 for (i=1; i < words_per_bus; i++) {
344 onestat |= val.x[i];
345 }
346
347 res = onestat;
348 switch(chips_per_word) {
349 default: BUG();
350#if BITS_PER_LONG >= 64
351 case 8:
352 res |= (onestat >> (chip_mode * 32));
353#endif
354 case 4:
355 res |= (onestat >> (chip_mode * 16));
356 case 2:
357 res |= (onestat >> (chip_mode * 8));
358 case 1:
359 ;
360 }
361
362 /* Last, determine what the bit-pattern should be for a single
363 device, according to chip mode and endianness... */
364 switch (chip_mode) {
365 case 1:
366 break;
367 case 2:
368 res = cfi16_to_cpu(res);
369 break;
370 case 4:
371 res = cfi32_to_cpu(res);
372 break;
373 default: BUG();
374 }
375 return res;
376}
377
378#define MERGESTATUS(x) cfi_merge_status((x), map, cfi)
379
380
310/* 381/*
311 * Sends a CFI command to a bank of flash for the given geometry. 382 * Sends a CFI command to a bank of flash for the given geometry.
312 * 383 *
@@ -357,16 +428,6 @@ static inline void cfi_udelay(int us)
357 } 428 }
358} 429}
359 430
360static inline void cfi_spin_lock(spinlock_t *mutex)
361{
362 spin_lock_bh(mutex);
363}
364
365static inline void cfi_spin_unlock(spinlock_t *mutex)
366{
367 spin_unlock_bh(mutex);
368}
369
370struct cfi_extquery *cfi_read_pri(struct map_info *map, uint16_t adr, uint16_t size, 431struct cfi_extquery *cfi_read_pri(struct map_info *map, uint16_t adr, uint16_t size,
371 const char* name); 432 const char* name);
372struct cfi_fixup { 433struct cfi_fixup {
diff --git a/include/linux/mtd/flashchip.h b/include/linux/mtd/flashchip.h
index c66ba812bf9..675776fa3e2 100644
--- a/include/linux/mtd/flashchip.h
+++ b/include/linux/mtd/flashchip.h
@@ -6,7 +6,7 @@
6 * 6 *
7 * (C) 2000 Red Hat. GPLd. 7 * (C) 2000 Red Hat. GPLd.
8 * 8 *
9 * $Id: flashchip.h,v 1.15 2004/11/05 22:41:06 nico Exp $ 9 * $Id: flashchip.h,v 1.17 2005/03/14 18:27:15 bjd Exp $
10 * 10 *
11 */ 11 */
12 12
@@ -29,6 +29,7 @@ typedef enum {
29 FL_ERASE_SUSPENDED, 29 FL_ERASE_SUSPENDED,
30 FL_WRITING, 30 FL_WRITING,
31 FL_WRITING_TO_BUFFER, 31 FL_WRITING_TO_BUFFER,
32 FL_OTP_WRITE,
32 FL_WRITE_SUSPENDING, 33 FL_WRITE_SUSPENDING,
33 FL_WRITE_SUSPENDED, 34 FL_WRITE_SUSPENDED,
34 FL_PM_SUSPENDED, 35 FL_PM_SUSPENDED,
@@ -62,8 +63,8 @@ struct flchip {
62 flstate_t state; 63 flstate_t state;
63 flstate_t oldstate; 64 flstate_t oldstate;
64 65
65 int write_suspended:1; 66 unsigned int write_suspended:1;
66 int erase_suspended:1; 67 unsigned int erase_suspended:1;
67 unsigned long in_progress_block_addr; 68 unsigned long in_progress_block_addr;
68 69
69 spinlock_t *mutex; 70 spinlock_t *mutex;
diff --git a/include/linux/mtd/inftl.h b/include/linux/mtd/inftl.h
index b52c8cbd235..0268125a627 100644
--- a/include/linux/mtd/inftl.h
+++ b/include/linux/mtd/inftl.h
@@ -3,7 +3,7 @@
3 * 3 *
4 * (C) Copyright 2002, Greg Ungerer (gerg@snapgear.com) 4 * (C) Copyright 2002, Greg Ungerer (gerg@snapgear.com)
5 * 5 *
6 * $Id: inftl.h,v 1.6 2004/06/30 14:49:00 dbrown Exp $ 6 * $Id: inftl.h,v 1.7 2005/06/13 13:08:45 sean Exp $
7 */ 7 */
8 8
9#ifndef __MTD_INFTL_H__ 9#ifndef __MTD_INFTL_H__
@@ -20,7 +20,7 @@
20#include <mtd/inftl-user.h> 20#include <mtd/inftl-user.h>
21 21
22#ifndef INFTL_MAJOR 22#ifndef INFTL_MAJOR
23#define INFTL_MAJOR 94 23#define INFTL_MAJOR 96
24#endif 24#endif
25#define INFTL_PARTN_BITS 4 25#define INFTL_PARTN_BITS 4
26 26
diff --git a/include/linux/mtd/map.h b/include/linux/mtd/map.h
index f0268b99c90..142963f01d2 100644
--- a/include/linux/mtd/map.h
+++ b/include/linux/mtd/map.h
@@ -1,6 +1,6 @@
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.46 2005/01/05 17:09:44 dwmw2 Exp $ */ 3/* $Id: map.h,v 1.52 2005/05/25 10:29:41 gleixner Exp $ */
4 4
5#ifndef __LINUX_MTD_MAP_H__ 5#ifndef __LINUX_MTD_MAP_H__
6#define __LINUX_MTD_MAP_H__ 6#define __LINUX_MTD_MAP_H__
@@ -263,6 +263,17 @@ static inline map_word map_word_and(struct map_info *map, map_word val1, map_wor
263 return r; 263 return r;
264} 264}
265 265
266static inline map_word map_word_clr(struct map_info *map, map_word val1, map_word val2)
267{
268 map_word r;
269 int i;
270
271 for (i=0; i<map_words(map); i++) {
272 r.x[i] = val1.x[i] & ~val2.x[i];
273 }
274 return r;
275}
276
266static inline map_word map_word_or(struct map_info *map, map_word val1, map_word val2) 277static inline map_word map_word_or(struct map_info *map, map_word val1, map_word val2)
267{ 278{
268 map_word r; 279 map_word r;
@@ -273,6 +284,7 @@ static inline map_word map_word_or(struct map_info *map, map_word val1, map_word
273 } 284 }
274 return r; 285 return r;
275} 286}
287
276#define map_word_andequal(m, a, b, z) map_word_equal(m, z, map_word_and(m, a, b)) 288#define map_word_andequal(m, a, b, z) map_word_equal(m, z, map_word_and(m, a, b))
277 289
278static inline int map_word_bitsset(struct map_info *map, map_word val1, map_word val2) 290static inline int map_word_bitsset(struct map_info *map, map_word val1, map_word val2)
@@ -328,16 +340,27 @@ static inline map_word map_word_load_partial(struct map_info *map, map_word orig
328 return orig; 340 return orig;
329} 341}
330 342
343#if BITS_PER_LONG < 64
344#define MAP_FF_LIMIT 4
345#else
346#define MAP_FF_LIMIT 8
347#endif
348
331static inline map_word map_word_ff(struct map_info *map) 349static inline map_word map_word_ff(struct map_info *map)
332{ 350{
333 map_word r; 351 map_word r;
334 int i; 352 int i;
335 353
336 for (i=0; i<map_words(map); i++) { 354 if (map_bankwidth(map) < MAP_FF_LIMIT) {
337 r.x[i] = ~0UL; 355 int bw = 8 * map_bankwidth(map);
356 r.x[0] = (1 << bw) - 1;
357 } else {
358 for (i=0; i<map_words(map); i++)
359 r.x[i] = ~0UL;
338 } 360 }
339 return r; 361 return r;
340} 362}
363
341static inline map_word inline_map_read(struct map_info *map, unsigned long ofs) 364static inline map_word inline_map_read(struct map_info *map, unsigned long ofs)
342{ 365{
343 map_word r; 366 map_word r;
@@ -405,7 +428,7 @@ extern void simple_map_init(struct map_info *);
405 428
406 429
407#define simple_map_init(map) BUG_ON(!map_bankwidth_supported((map)->bankwidth)) 430#define simple_map_init(map) BUG_ON(!map_bankwidth_supported((map)->bankwidth))
408#define map_is_linear(map) (1) 431#define map_is_linear(map) ({ (void)(map); 1; })
409 432
410#endif /* !CONFIG_MTD_COMPLEX_MAPPINGS */ 433#endif /* !CONFIG_MTD_COMPLEX_MAPPINGS */
411 434
diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h
index b3d134392b3..c50c3f3927d 100644
--- a/include/linux/mtd/mtd.h
+++ b/include/linux/mtd/mtd.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * $Id: mtd.h,v 1.56 2004/08/09 18:46:04 dmarlin Exp $ 2 * $Id: mtd.h,v 1.59 2005/04/11 10:19:02 gleixner Exp $
3 * 3 *
4 * Copyright (C) 1999-2003 David Woodhouse <dwmw2@infradead.org> et al. 4 * Copyright (C) 1999-2003 David Woodhouse <dwmw2@infradead.org> et al.
5 * 5 *
@@ -18,6 +18,7 @@
18#include <linux/types.h> 18#include <linux/types.h>
19#include <linux/module.h> 19#include <linux/module.h>
20#include <linux/uio.h> 20#include <linux/uio.h>
21#include <linux/notifier.h>
21 22
22#include <linux/mtd/compatmac.h> 23#include <linux/mtd/compatmac.h>
23#include <mtd/mtd-abi.h> 24#include <mtd/mtd-abi.h>
@@ -69,7 +70,6 @@ struct mtd_info {
69 70
70 u_int32_t oobblock; // Size of OOB blocks (e.g. 512) 71 u_int32_t oobblock; // Size of OOB blocks (e.g. 512)
71 u_int32_t oobsize; // Amount of OOB data per block (e.g. 16) 72 u_int32_t oobsize; // Amount of OOB data per block (e.g. 16)
72 u_int32_t oobavail; // Number of bytes in OOB area available for fs
73 u_int32_t ecctype; 73 u_int32_t ecctype;
74 u_int32_t eccsize; 74 u_int32_t eccsize;
75 75
@@ -80,6 +80,7 @@ struct mtd_info {
80 80
81 // oobinfo is a nand_oobinfo structure, which can be set by iotcl (MEMSETOOBINFO) 81 // oobinfo is a nand_oobinfo structure, which can be set by iotcl (MEMSETOOBINFO)
82 struct nand_oobinfo oobinfo; 82 struct nand_oobinfo oobinfo;
83 u_int32_t oobavail; // Number of bytes in OOB area available for fs
83 84
84 /* Data for variable erase regions. If numeraseregions is zero, 85 /* Data for variable erase regions. If numeraseregions is zero,
85 * it means that the whole device has erasesize as given above. 86 * it means that the whole device has erasesize as given above.
@@ -113,12 +114,12 @@ struct mtd_info {
113 * flash devices. The user data is one time programmable but the 114 * flash devices. The user data is one time programmable but the
114 * factory data is read only. 115 * factory data is read only.
115 */ 116 */
116 int (*read_user_prot_reg) (struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, u_char *buf); 117 int (*get_fact_prot_info) (struct mtd_info *mtd, struct otp_info *buf, size_t len);
117
118 int (*read_fact_prot_reg) (struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, u_char *buf); 118 int (*read_fact_prot_reg) (struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, u_char *buf);
119 119 int (*get_user_prot_info) (struct mtd_info *mtd, struct otp_info *buf, size_t len);
120 /* This function is not yet implemented */ 120 int (*read_user_prot_reg) (struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, u_char *buf);
121 int (*write_user_prot_reg) (struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, u_char *buf); 121 int (*write_user_prot_reg) (struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, u_char *buf);
122 int (*lock_user_prot_reg) (struct mtd_info *mtd, loff_t from, size_t len);
122 123
123 /* kvec-based read/write methods. We need these especially for NAND flash, 124 /* kvec-based read/write methods. We need these especially for NAND flash,
124 with its limited number of write cycles per erase. 125 with its limited number of write cycles per erase.
@@ -147,6 +148,8 @@ struct mtd_info {
147 int (*block_isbad) (struct mtd_info *mtd, loff_t ofs); 148 int (*block_isbad) (struct mtd_info *mtd, loff_t ofs);
148 int (*block_markbad) (struct mtd_info *mtd, loff_t ofs); 149 int (*block_markbad) (struct mtd_info *mtd, loff_t ofs);
149 150
151 struct notifier_block reboot_notifier; /* default mode before reboot */
152
150 void *priv; 153 void *priv;
151 154
152 struct module *owner; 155 struct module *owner;
diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h
index 9a19c65abd7..9b5b7621758 100644
--- a/include/linux/mtd/nand.h
+++ b/include/linux/mtd/nand.h
@@ -5,7 +5,7 @@
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.68 2004/11/12 10:40:37 gleixner Exp $ 8 * $Id: nand.h,v 1.73 2005/05/31 19:39:17 gleixner Exp $
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
11 * it under the terms of the GNU General Public License version 2 as 11 * it under the terms of the GNU General Public License version 2 as
@@ -48,6 +48,10 @@
48 * 02-08-2004 tglx added option field to nand structure for chip anomalities 48 * 02-08-2004 tglx added option field to nand structure for chip anomalities
49 * 05-25-2004 tglx added bad block table support, ST-MICRO manufacturer id 49 * 05-25-2004 tglx added bad block table support, ST-MICRO manufacturer id
50 * update of nand_chip structure description 50 * update of nand_chip structure description
51 * 01-17-2005 dmarlin added extended commands for AG-AND device and added option
52 * for BBT_AUTO_REFRESH.
53 * 01-20-2005 dmarlin added optional pointer to hardware specific callback for
54 * extra error status checks.
51 */ 55 */
52#ifndef __LINUX_MTD_NAND_H 56#ifndef __LINUX_MTD_NAND_H
53#define __LINUX_MTD_NAND_H 57#define __LINUX_MTD_NAND_H
@@ -115,6 +119,25 @@ extern int nand_read_raw (struct mtd_info *mtd, uint8_t *buf, loff_t from, size_
115#define NAND_CMD_READSTART 0x30 119#define NAND_CMD_READSTART 0x30
116#define NAND_CMD_CACHEDPROG 0x15 120#define NAND_CMD_CACHEDPROG 0x15
117 121
122/* Extended commands for AG-AND device */
123/*
124 * Note: the command for NAND_CMD_DEPLETE1 is really 0x00 but
125 * there is no way to distinguish that from NAND_CMD_READ0
126 * until the remaining sequence of commands has been completed
127 * so add a high order bit and mask it off in the command.
128 */
129#define NAND_CMD_DEPLETE1 0x100
130#define NAND_CMD_DEPLETE2 0x38
131#define NAND_CMD_STATUS_MULTI 0x71
132#define NAND_CMD_STATUS_ERROR 0x72
133/* multi-bank error status (banks 0-3) */
134#define NAND_CMD_STATUS_ERROR0 0x73
135#define NAND_CMD_STATUS_ERROR1 0x74
136#define NAND_CMD_STATUS_ERROR2 0x75
137#define NAND_CMD_STATUS_ERROR3 0x76
138#define NAND_CMD_STATUS_RESET 0x7f
139#define NAND_CMD_STATUS_CLEAR 0xff
140
118/* Status bits */ 141/* Status bits */
119#define NAND_STATUS_FAIL 0x01 142#define NAND_STATUS_FAIL 0x01
120#define NAND_STATUS_FAIL_N1 0x02 143#define NAND_STATUS_FAIL_N1 0x02
@@ -143,7 +166,7 @@ extern int nand_read_raw (struct mtd_info *mtd, uint8_t *buf, loff_t from, size_
143 166
144/* 167/*
145 * Constants for Hardware ECC 168 * Constants for Hardware ECC
146*/ 169 */
147/* Reset Hardware ECC for read */ 170/* Reset Hardware ECC for read */
148#define NAND_ECC_READ 0 171#define NAND_ECC_READ 0
149/* Reset Hardware ECC for write */ 172/* Reset Hardware ECC for write */
@@ -151,6 +174,10 @@ extern int nand_read_raw (struct mtd_info *mtd, uint8_t *buf, loff_t from, size_
151/* Enable Hardware ECC before syndrom is read back from flash */ 174/* Enable Hardware ECC before syndrom is read back from flash */
152#define NAND_ECC_READSYN 2 175#define NAND_ECC_READSYN 2
153 176
177/* Bit mask for flags passed to do_nand_read_ecc */
178#define NAND_GET_DEVICE 0x80
179
180
154/* Option constants for bizarre disfunctionality and real 181/* Option constants for bizarre disfunctionality and real
155* features 182* features
156*/ 183*/
@@ -170,6 +197,10 @@ extern int nand_read_raw (struct mtd_info *mtd, uint8_t *buf, loff_t from, size_
170/* Chip has a array of 4 pages which can be read without 197/* Chip has a array of 4 pages which can be read without
171 * additional ready /busy waits */ 198 * additional ready /busy waits */
172#define NAND_4PAGE_ARRAY 0x00000040 199#define NAND_4PAGE_ARRAY 0x00000040
200/* Chip requires that BBT is periodically rewritten to prevent
201 * bits from adjacent blocks from 'leaking' in altering data.
202 * This happens with the Renesas AG-AND chips, possibly others. */
203#define BBT_AUTO_REFRESH 0x00000080
173 204
174/* Options valid for Samsung large page devices */ 205/* Options valid for Samsung large page devices */
175#define NAND_SAMSUNG_LP_OPTIONS \ 206#define NAND_SAMSUNG_LP_OPTIONS \
@@ -192,7 +223,8 @@ extern int nand_read_raw (struct mtd_info *mtd, uint8_t *buf, loff_t from, size_
192 * This can only work if we have the ecc bytes directly behind the 223 * This can only work if we have the ecc bytes directly behind the
193 * data bytes. Applies for DOC and AG-AND Renesas HW Reed Solomon generators */ 224 * data bytes. Applies for DOC and AG-AND Renesas HW Reed Solomon generators */
194#define NAND_HWECC_SYNDROME 0x00020000 225#define NAND_HWECC_SYNDROME 0x00020000
195 226/* This option skips the bbt scan during initialization. */
227#define NAND_SKIP_BBTSCAN 0x00040000
196 228
197/* Options set by nand scan */ 229/* Options set by nand scan */
198/* Nand scan has allocated oob_buf */ 230/* Nand scan has allocated oob_buf */
@@ -221,10 +253,13 @@ struct nand_chip;
221 * struct nand_hw_control - Control structure for hardware controller (e.g ECC generator) shared among independend devices 253 * struct nand_hw_control - Control structure for hardware controller (e.g ECC generator) shared among independend devices
222 * @lock: protection lock 254 * @lock: protection lock
223 * @active: the mtd device which holds the controller currently 255 * @active: the mtd device which holds the controller currently
256 * @wq: wait queue to sleep on if a NAND operation is in progress
257 * used instead of the per chip wait queue when a hw controller is available
224 */ 258 */
225struct nand_hw_control { 259struct nand_hw_control {
226 spinlock_t lock; 260 spinlock_t lock;
227 struct nand_chip *active; 261 struct nand_chip *active;
262 wait_queue_head_t wq;
228}; 263};
229 264
230/** 265/**
@@ -283,6 +318,8 @@ struct nand_hw_control {
283 * @badblock_pattern: [REPLACEABLE] bad block scan pattern used for initial bad block scan 318 * @badblock_pattern: [REPLACEABLE] bad block scan pattern used for initial bad block scan
284 * @controller: [OPTIONAL] a pointer to a hardware controller structure which is shared among multiple independend devices 319 * @controller: [OPTIONAL] a pointer to a hardware controller structure which is shared among multiple independend devices
285 * @priv: [OPTIONAL] pointer to private chip date 320 * @priv: [OPTIONAL] pointer to private chip date
321 * @errstat: [OPTIONAL] hardware specific function to perform additional error status checks
322 * (determine if errors are correctable)
286 */ 323 */
287 324
288struct nand_chip { 325struct nand_chip {
@@ -338,6 +375,7 @@ struct nand_chip {
338 struct nand_bbt_descr *badblock_pattern; 375 struct nand_bbt_descr *badblock_pattern;
339 struct nand_hw_control *controller; 376 struct nand_hw_control *controller;
340 void *priv; 377 void *priv;
378 int (*errstat)(struct mtd_info *mtd, struct nand_chip *this, int state, int status, int page);
341}; 379};
342 380
343/* 381/*
@@ -349,6 +387,7 @@ struct nand_chip {
349#define NAND_MFR_NATIONAL 0x8f 387#define NAND_MFR_NATIONAL 0x8f
350#define NAND_MFR_RENESAS 0x07 388#define NAND_MFR_RENESAS 0x07
351#define NAND_MFR_STMICRO 0x20 389#define NAND_MFR_STMICRO 0x20
390#define NAND_MFR_HYNIX 0xad
352 391
353/** 392/**
354 * struct nand_flash_dev - NAND Flash Device ID Structure 393 * struct nand_flash_dev - NAND Flash Device ID Structure
@@ -459,6 +498,9 @@ extern int nand_update_bbt (struct mtd_info *mtd, loff_t offs);
459extern int nand_default_bbt (struct mtd_info *mtd); 498extern int nand_default_bbt (struct mtd_info *mtd);
460extern int nand_isbad_bbt (struct mtd_info *mtd, loff_t offs, int allowbbt); 499extern int nand_isbad_bbt (struct mtd_info *mtd, loff_t offs, int allowbbt);
461extern int nand_erase_nand (struct mtd_info *mtd, struct erase_info *instr, int allowbbt); 500extern int nand_erase_nand (struct mtd_info *mtd, struct erase_info *instr, int allowbbt);
501extern int nand_do_read_ecc (struct mtd_info *mtd, loff_t from, size_t len,
502 size_t * retlen, u_char * buf, u_char * oob_buf,
503 struct nand_oobinfo *oobsel, int flags);
462 504
463/* 505/*
464* Constants for oob configuration 506* Constants for oob configuration
diff --git a/include/linux/mtd/plat-ram.h b/include/linux/mtd/plat-ram.h
new file mode 100644
index 00000000000..2332eda07e0
--- /dev/null
+++ b/include/linux/mtd/plat-ram.h
@@ -0,0 +1,35 @@
1/* linux/include/mtd/plat-ram.h
2 *
3 * (c) 2004 Simtec Electronics
4 * http://www.simtec.co.uk/products/SWLINUX/
5 * Ben Dooks <ben@simtec.co.uk>
6 *
7 * Generic platform device based RAM map
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
12 * it under the terms of the GNU General Public License version 2 as
13 * published by the Free Software Foundation.
14 *
15 */
16
17#ifndef __LINUX_MTD_PLATRAM_H
18#define __LINUX_MTD_PLATRAM_H __FILE__
19
20#define PLATRAM_RO (0)
21#define PLATRAM_RW (1)
22
23struct platdata_mtd_ram {
24 char *mapname;
25 char **probes;
26 struct mtd_partition *partitions;
27 int nr_partitions;
28 int bankwidth;
29
30 /* control callbacks */
31
32 void (*set_rw)(struct device *dev, int to);
33};
34
35#endif /* __LINUX_MTD_PLATRAM_H */
diff --git a/include/linux/mtd/xip.h b/include/linux/mtd/xip.h
index fc071125cbc..7b7deef6b18 100644
--- a/include/linux/mtd/xip.h
+++ b/include/linux/mtd/xip.h
@@ -58,22 +58,16 @@
58 * returned value is <= the real elapsed time. 58 * returned value is <= the real elapsed time.
59 * note 2: this should be able to cope with a few seconds without 59 * note 2: this should be able to cope with a few seconds without
60 * overflowing. 60 * overflowing.
61 *
62 * xip_iprefetch()
63 *
64 * Macro to fill instruction prefetch
65 * e.g. a series of nops: asm volatile (".rep 8; nop; .endr");
61 */ 66 */
62 67
63#if defined(CONFIG_ARCH_SA1100) || defined(CONFIG_ARCH_PXA) 68#include <asm/mtd-xip.h>
64
65#include <asm/hardware.h>
66#ifdef CONFIG_ARCH_PXA
67#include <asm/arch/pxa-regs.h>
68#endif
69
70#define xip_irqpending() (ICIP & ICMR)
71
72/* we sample OSCR and convert desired delta to usec (1/4 ~= 1000000/3686400) */
73#define xip_currtime() (OSCR)
74#define xip_elapsed_since(x) (signed)((OSCR - (x)) / 4)
75 69
76#else 70#ifndef xip_irqpending
77 71
78#warning "missing IRQ and timer primitives for XIP MTD support" 72#warning "missing IRQ and timer primitives for XIP MTD support"
79#warning "some of the XIP MTD support code will be disabled" 73#warning "some of the XIP MTD support code will be disabled"
@@ -85,16 +79,17 @@
85 79
86#endif 80#endif
87 81
82#ifndef xip_iprefetch
83#define xip_iprefetch() do { } while (0)
84#endif
85
88/* 86/*
89 * xip_cpu_idle() is used when waiting for a delay equal or larger than 87 * xip_cpu_idle() is used when waiting for a delay equal or larger than
90 * the system timer tick period. This should put the CPU into idle mode 88 * the system timer tick period. This should put the CPU into idle mode
91 * to save power and to be woken up only when some interrupts are pending. 89 * to save power and to be woken up only when some interrupts are pending.
92 * As above, this should not rely upon standard kernel code. 90 * This should not rely upon standard kernel code.
93 */ 91 */
94 92#ifndef xip_cpu_idle
95#if defined(CONFIG_CPU_XSCALE)
96#define xip_cpu_idle() asm volatile ("mcr p14, 0, %0, c7, c0, 0" :: "r" (1))
97#else
98#define xip_cpu_idle() do { } while (0) 93#define xip_cpu_idle() do { } while (0)
99#endif 94#endif
100 95
diff --git a/include/linux/namespace.h b/include/linux/namespace.h
index 697991b69f9..0e5a86f13b2 100644
--- a/include/linux/namespace.h
+++ b/include/linux/namespace.h
@@ -17,7 +17,8 @@ extern void __put_namespace(struct namespace *namespace);
17 17
18static inline void put_namespace(struct namespace *namespace) 18static inline void put_namespace(struct namespace *namespace)
19{ 19{
20 if (atomic_dec_and_test(&namespace->count)) 20 if (atomic_dec_and_lock(&namespace->count, &vfsmount_lock))
21 /* releases vfsmount_lock */
21 __put_namespace(namespace); 22 __put_namespace(namespace);
22} 23}
23 24
diff --git a/include/linux/netlink.h b/include/linux/netlink.h
index 27e4d164a10..2f0c085f2c7 100644
--- a/include/linux/netlink.h
+++ b/include/linux/netlink.h
@@ -16,6 +16,7 @@
16#define NETLINK_AUDIT 9 /* auditing */ 16#define NETLINK_AUDIT 9 /* auditing */
17#define NETLINK_FIB_LOOKUP 10 17#define NETLINK_FIB_LOOKUP 10
18#define NETLINK_ROUTE6 11 /* af_inet6 route comm channel */ 18#define NETLINK_ROUTE6 11 /* af_inet6 route comm channel */
19#define NETLINK_NETFILTER 12 /* netfilter subsystem */
19#define NETLINK_IP6_FW 13 20#define NETLINK_IP6_FW 13
20#define NETLINK_DNRTMSG 14 /* DECnet routing messages */ 21#define NETLINK_DNRTMSG 14 /* DECnet routing messages */
21#define NETLINK_KOBJECT_UEVENT 15 /* Kernel messages to userspace */ 22#define NETLINK_KOBJECT_UEVENT 15 /* Kernel messages to userspace */
diff --git a/include/linux/nfsd/nfsd.h b/include/linux/nfsd/nfsd.h
index 5791dfd30dd..6d5a24f3fc6 100644
--- a/include/linux/nfsd/nfsd.h
+++ b/include/linux/nfsd/nfsd.h
@@ -124,6 +124,7 @@ int nfsd_statfs(struct svc_rqst *, struct svc_fh *,
124 124
125int nfsd_notify_change(struct inode *, struct iattr *); 125int nfsd_notify_change(struct inode *, struct iattr *);
126int nfsd_permission(struct svc_export *, struct dentry *, int); 126int nfsd_permission(struct svc_export *, struct dentry *, int);
127void nfsd_sync_dir(struct dentry *dp);
127 128
128#if defined(CONFIG_NFSD_V2_ACL) || defined(CONFIG_NFSD_V3_ACL) 129#if defined(CONFIG_NFSD_V2_ACL) || defined(CONFIG_NFSD_V3_ACL)
129#ifdef CONFIG_NFSD_V2_ACL 130#ifdef CONFIG_NFSD_V2_ACL
@@ -230,6 +231,7 @@ void nfsd_lockd_shutdown(void);
230#define nfserr_reclaim_bad __constant_htonl(NFSERR_RECLAIM_BAD) 231#define nfserr_reclaim_bad __constant_htonl(NFSERR_RECLAIM_BAD)
231#define nfserr_badname __constant_htonl(NFSERR_BADNAME) 232#define nfserr_badname __constant_htonl(NFSERR_BADNAME)
232#define nfserr_cb_path_down __constant_htonl(NFSERR_CB_PATH_DOWN) 233#define nfserr_cb_path_down __constant_htonl(NFSERR_CB_PATH_DOWN)
234#define nfserr_locked __constant_htonl(NFSERR_LOCKED)
233 235
234/* error codes for internal use */ 236/* error codes for internal use */
235/* if a request fails due to kmalloc failure, it gets dropped. 237/* if a request fails due to kmalloc failure, it gets dropped.
diff --git a/include/linux/nfsd/state.h b/include/linux/nfsd/state.h
index a84a3fa99be..8bf23cf8b60 100644
--- a/include/linux/nfsd/state.h
+++ b/include/linux/nfsd/state.h
@@ -203,7 +203,9 @@ struct nfs4_stateowner {
203 int so_is_open_owner; /* 1=openowner,0=lockowner */ 203 int so_is_open_owner; /* 1=openowner,0=lockowner */
204 u32 so_id; 204 u32 so_id;
205 struct nfs4_client * so_client; 205 struct nfs4_client * so_client;
206 u32 so_seqid; 206 /* after increment in ENCODE_SEQID_OP_TAIL, represents the next
207 * sequence id expected from the client: */
208 u32 so_seqid;
207 struct xdr_netobj so_owner; /* open owner name */ 209 struct xdr_netobj so_owner; /* open owner name */
208 int so_confirmed; /* successful OPEN_CONFIRM? */ 210 int so_confirmed; /* successful OPEN_CONFIRM? */
209 struct nfs4_replay so_replay; 211 struct nfs4_replay so_replay;
@@ -235,6 +237,10 @@ struct nfs4_file {
235* st_perlockowner: (open stateid) list of lock nfs4_stateowners 237* st_perlockowner: (open stateid) list of lock nfs4_stateowners
236* st_access_bmap: used only for open stateid 238* st_access_bmap: used only for open stateid
237* st_deny_bmap: used only for open stateid 239* st_deny_bmap: used only for open stateid
240* st_openstp: open stateid lock stateid was derived from
241*
242* XXX: open stateids and lock stateids have diverged sufficiently that
243* we should consider defining separate structs for the two cases.
238*/ 244*/
239 245
240struct nfs4_stateid { 246struct nfs4_stateid {
@@ -248,6 +254,7 @@ struct nfs4_stateid {
248 struct file * st_vfs_file; 254 struct file * st_vfs_file;
249 unsigned long st_access_bmap; 255 unsigned long st_access_bmap;
250 unsigned long st_deny_bmap; 256 unsigned long st_deny_bmap;
257 struct nfs4_stateid * st_openstp;
251}; 258};
252 259
253/* flags for preprocess_seqid_op() */ 260/* flags for preprocess_seqid_op() */
diff --git a/include/linux/pci-dynids.h b/include/linux/pci-dynids.h
deleted file mode 100644
index 183b6b0de81..00000000000
--- a/include/linux/pci-dynids.h
+++ /dev/null
@@ -1,18 +0,0 @@
1/*
2 * PCI defines and function prototypes
3 * Copyright 2003 Dell Inc.
4 * by Matt Domsch <Matt_Domsch@dell.com>
5 */
6
7#ifndef LINUX_PCI_DYNIDS_H
8#define LINUX_PCI_DYNIDS_H
9
10#include <linux/list.h>
11#include <linux/mod_devicetable.h>
12
13struct dynid {
14 struct list_head node;
15 struct pci_device_id id;
16};
17
18#endif
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 66798b46f30..7ac14961ba2 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -586,7 +586,7 @@ struct pci_dev {
586#define PCI_NUM_RESOURCES 11 586#define PCI_NUM_RESOURCES 11
587 587
588#ifndef PCI_BUS_NUM_RESOURCES 588#ifndef PCI_BUS_NUM_RESOURCES
589#define PCI_BUS_NUM_RESOURCES 4 589#define PCI_BUS_NUM_RESOURCES 8
590#endif 590#endif
591 591
592#define PCI_REGION_FLAG_MASK 0x0fU /* These bits of resource flags tell us the PCI region flags */ 592#define PCI_REGION_FLAG_MASK 0x0fU /* These bits of resource flags tell us the PCI region flags */
@@ -860,7 +860,8 @@ int pci_register_driver(struct pci_driver *);
860void pci_unregister_driver(struct pci_driver *); 860void pci_unregister_driver(struct pci_driver *);
861void pci_remove_behind_bridge(struct pci_dev *); 861void pci_remove_behind_bridge(struct pci_dev *);
862struct pci_driver *pci_dev_driver(const struct pci_dev *); 862struct pci_driver *pci_dev_driver(const struct pci_dev *);
863const struct pci_device_id *pci_match_device(const struct pci_device_id *ids, const struct pci_dev *dev); 863const struct pci_device_id *pci_match_device(struct pci_driver *drv, struct pci_dev *dev);
864const struct pci_device_id *pci_match_id(const struct pci_device_id *ids, struct pci_dev *dev);
864int pci_scan_bridge(struct pci_bus *bus, struct pci_dev * dev, int max, int pass); 865int pci_scan_bridge(struct pci_bus *bus, struct pci_dev * dev, int max, int pass);
865 866
866/* kmem_cache style wrapper around pci_alloc_consistent() */ 867/* kmem_cache style wrapper around pci_alloc_consistent() */
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index c3ee1ae4545..27348c22dac 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -1238,6 +1238,7 @@
1238#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP51_IDE 0x0265 1238#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP51_IDE 0x0265
1239#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP51_SATA 0x0266 1239#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP51_SATA 0x0266
1240#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP51_SATA2 0x0267 1240#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP51_SATA2 0x0267
1241#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP55_IDE 0x036E
1241#define PCI_DEVICE_ID_NVIDIA_NVENET_12 0x0268 1242#define PCI_DEVICE_ID_NVIDIA_NVENET_12 0x0268
1242#define PCI_DEVICE_ID_NVIDIA_NVENET_13 0x0269 1243#define PCI_DEVICE_ID_NVIDIA_NVENET_13 0x0269
1243#define PCI_DEVICE_ID_NVIDIA_MCP51_AUDIO 0x026B 1244#define PCI_DEVICE_ID_NVIDIA_MCP51_AUDIO 0x026B
diff --git a/include/linux/pm.h b/include/linux/pm.h
index 14479325e3f..7aeb208ed71 100644
--- a/include/linux/pm.h
+++ b/include/linux/pm.h
@@ -176,7 +176,7 @@ struct pm_ops {
176}; 176};
177 177
178extern void pm_set_ops(struct pm_ops *); 178extern void pm_set_ops(struct pm_ops *);
179 179extern struct pm_ops *pm_ops;
180extern int pm_suspend(suspend_state_t state); 180extern int pm_suspend(suspend_state_t state);
181 181
182 182
diff --git a/include/linux/reiserfs_acl.h b/include/linux/reiserfs_acl.h
index 0760507a545..0a3605099c4 100644
--- a/include/linux/reiserfs_acl.h
+++ b/include/linux/reiserfs_acl.h
@@ -4,29 +4,29 @@
4#define REISERFS_ACL_VERSION 0x0001 4#define REISERFS_ACL_VERSION 0x0001
5 5
6typedef struct { 6typedef struct {
7 __le16 e_tag; 7 __le16 e_tag;
8 __le16 e_perm; 8 __le16 e_perm;
9 __le32 e_id; 9 __le32 e_id;
10} reiserfs_acl_entry; 10} reiserfs_acl_entry;
11 11
12typedef struct { 12typedef struct {
13 __le16 e_tag; 13 __le16 e_tag;
14 __le16 e_perm; 14 __le16 e_perm;
15} reiserfs_acl_entry_short; 15} reiserfs_acl_entry_short;
16 16
17typedef struct { 17typedef struct {
18 __le32 a_version; 18 __le32 a_version;
19} reiserfs_acl_header; 19} reiserfs_acl_header;
20 20
21static inline size_t reiserfs_acl_size(int count) 21static inline size_t reiserfs_acl_size(int count)
22{ 22{
23 if (count <= 4) { 23 if (count <= 4) {
24 return sizeof(reiserfs_acl_header) + 24 return sizeof(reiserfs_acl_header) +
25 count * sizeof(reiserfs_acl_entry_short); 25 count * sizeof(reiserfs_acl_entry_short);
26 } else { 26 } else {
27 return sizeof(reiserfs_acl_header) + 27 return sizeof(reiserfs_acl_header) +
28 4 * sizeof(reiserfs_acl_entry_short) + 28 4 * sizeof(reiserfs_acl_entry_short) +
29 (count - 4) * sizeof(reiserfs_acl_entry); 29 (count - 4) * sizeof(reiserfs_acl_entry);
30 } 30 }
31} 31}
32 32
@@ -46,14 +46,14 @@ static inline int reiserfs_acl_count(size_t size)
46 } 46 }
47} 47}
48 48
49
50#ifdef CONFIG_REISERFS_FS_POSIX_ACL 49#ifdef CONFIG_REISERFS_FS_POSIX_ACL
51struct posix_acl * reiserfs_get_acl(struct inode *inode, int type); 50struct posix_acl *reiserfs_get_acl(struct inode *inode, int type);
52int reiserfs_acl_chmod (struct inode *inode); 51int reiserfs_acl_chmod(struct inode *inode);
53int reiserfs_inherit_default_acl (struct inode *dir, struct dentry *dentry, struct inode *inode); 52int reiserfs_inherit_default_acl(struct inode *dir, struct dentry *dentry,
54int reiserfs_cache_default_acl (struct inode *dir); 53 struct inode *inode);
55extern int reiserfs_xattr_posix_acl_init (void) __init; 54int reiserfs_cache_default_acl(struct inode *dir);
56extern int reiserfs_xattr_posix_acl_exit (void); 55extern int reiserfs_xattr_posix_acl_init(void) __init;
56extern int reiserfs_xattr_posix_acl_exit(void);
57extern struct reiserfs_xattr_handler posix_acl_default_handler; 57extern struct reiserfs_xattr_handler posix_acl_default_handler;
58extern struct reiserfs_xattr_handler posix_acl_access_handler; 58extern struct reiserfs_xattr_handler posix_acl_access_handler;
59#else 59#else
@@ -61,28 +61,26 @@ extern struct reiserfs_xattr_handler posix_acl_access_handler;
61#define reiserfs_get_acl NULL 61#define reiserfs_get_acl NULL
62#define reiserfs_cache_default_acl(inode) 0 62#define reiserfs_cache_default_acl(inode) 0
63 63
64static inline int 64static inline int reiserfs_xattr_posix_acl_init(void)
65reiserfs_xattr_posix_acl_init (void)
66{ 65{
67 return 0; 66 return 0;
68} 67}
69 68
70static inline int 69static inline int reiserfs_xattr_posix_acl_exit(void)
71reiserfs_xattr_posix_acl_exit (void)
72{ 70{
73 return 0; 71 return 0;
74} 72}
75 73
76static inline int 74static inline int reiserfs_acl_chmod(struct inode *inode)
77reiserfs_acl_chmod (struct inode *inode)
78{ 75{
79 return 0; 76 return 0;
80} 77}
81 78
82static inline int 79static inline int
83reiserfs_inherit_default_acl (const struct inode *dir, struct dentry *dentry, struct inode *inode) 80reiserfs_inherit_default_acl(const struct inode *dir, struct dentry *dentry,
81 struct inode *inode)
84{ 82{
85 return 0; 83 return 0;
86} 84}
87 85
88#endif 86#endif
diff --git a/include/linux/reiserfs_fs.h b/include/linux/reiserfs_fs.h
index 4c7c5689ad9..17e458e17e2 100644
--- a/include/linux/reiserfs_fs.h
+++ b/include/linux/reiserfs_fs.h
@@ -3,11 +3,10 @@
3 */ 3 */
4 4
5 /* this file has an amazingly stupid 5 /* this file has an amazingly stupid
6 name, yura please fix it to be 6 name, yura please fix it to be
7 reiserfs.h, and merge all the rest 7 reiserfs.h, and merge all the rest
8 of our .h files that are in this 8 of our .h files that are in this
9 directory into it. */ 9 directory into it. */
10
11 10
12#ifndef _LINUX_REISER_FS_H 11#ifndef _LINUX_REISER_FS_H
13#define _LINUX_REISER_FS_H 12#define _LINUX_REISER_FS_H
@@ -74,9 +73,9 @@
74/* debug levels. Right now, CONFIG_REISERFS_CHECK means print all debug 73/* debug levels. Right now, CONFIG_REISERFS_CHECK means print all debug
75** messages. 74** messages.
76*/ 75*/
77#define REISERFS_DEBUG_CODE 5 /* extra messages to help find/debug errors */ 76#define REISERFS_DEBUG_CODE 5 /* extra messages to help find/debug errors */
78 77
79void reiserfs_warning (struct super_block *s, const char * fmt, ...); 78void reiserfs_warning(struct super_block *s, const char *fmt, ...);
80/* assertions handling */ 79/* assertions handling */
81 80
82/** always check a condition and panic if it's false. */ 81/** always check a condition and panic if it's false. */
@@ -105,82 +104,78 @@ if( !( cond ) ) \
105 * Structure of super block on disk, a version of which in RAM is often accessed as REISERFS_SB(s)->s_rs 104 * Structure of super block on disk, a version of which in RAM is often accessed as REISERFS_SB(s)->s_rs
106 * the version in RAM is part of a larger structure containing fields never written to disk. 105 * the version in RAM is part of a larger structure containing fields never written to disk.
107 */ 106 */
108#define UNSET_HASH 0 // read_super will guess about, what hash names 107#define UNSET_HASH 0 // read_super will guess about, what hash names
109 // in directories were sorted with 108 // in directories were sorted with
110#define TEA_HASH 1 109#define TEA_HASH 1
111#define YURA_HASH 2 110#define YURA_HASH 2
112#define R5_HASH 3 111#define R5_HASH 3
113#define DEFAULT_HASH R5_HASH 112#define DEFAULT_HASH R5_HASH
114 113
115
116struct journal_params { 114struct journal_params {
117 __le32 jp_journal_1st_block; /* where does journal start from on its 115 __le32 jp_journal_1st_block; /* where does journal start from on its
118 * device */ 116 * device */
119 __le32 jp_journal_dev; /* journal device st_rdev */ 117 __le32 jp_journal_dev; /* journal device st_rdev */
120 __le32 jp_journal_size; /* size of the journal */ 118 __le32 jp_journal_size; /* size of the journal */
121 __le32 jp_journal_trans_max; /* max number of blocks in a transaction. */ 119 __le32 jp_journal_trans_max; /* max number of blocks in a transaction. */
122 __le32 jp_journal_magic; /* random value made on fs creation (this 120 __le32 jp_journal_magic; /* random value made on fs creation (this
123 * was sb_journal_block_count) */ 121 * was sb_journal_block_count) */
124 __le32 jp_journal_max_batch; /* max number of blocks to batch into a 122 __le32 jp_journal_max_batch; /* max number of blocks to batch into a
125 * trans */ 123 * trans */
126 __le32 jp_journal_max_commit_age; /* in seconds, how old can an async 124 __le32 jp_journal_max_commit_age; /* in seconds, how old can an async
127 * commit be */ 125 * commit be */
128 __le32 jp_journal_max_trans_age; /* in seconds, how old can a transaction 126 __le32 jp_journal_max_trans_age; /* in seconds, how old can a transaction
129 * be */ 127 * be */
130}; 128};
131 129
132/* this is the super from 3.5.X, where X >= 10 */ 130/* this is the super from 3.5.X, where X >= 10 */
133struct reiserfs_super_block_v1 131struct reiserfs_super_block_v1 {
134{ 132 __le32 s_block_count; /* blocks count */
135 __le32 s_block_count; /* blocks count */ 133 __le32 s_free_blocks; /* free blocks count */
136 __le32 s_free_blocks; /* free blocks count */ 134 __le32 s_root_block; /* root block number */
137 __le32 s_root_block; /* root block number */ 135 struct journal_params s_journal;
138 struct journal_params s_journal; 136 __le16 s_blocksize; /* block size */
139 __le16 s_blocksize; /* block size */ 137 __le16 s_oid_maxsize; /* max size of object id array, see
140 __le16 s_oid_maxsize; /* max size of object id array, see 138 * get_objectid() commentary */
141 * get_objectid() commentary */ 139 __le16 s_oid_cursize; /* current size of object id array */
142 __le16 s_oid_cursize; /* current size of object id array */ 140 __le16 s_umount_state; /* this is set to 1 when filesystem was
143 __le16 s_umount_state; /* this is set to 1 when filesystem was 141 * umounted, to 2 - when not */
144 * umounted, to 2 - when not */ 142 char s_magic[10]; /* reiserfs magic string indicates that
145 char s_magic[10]; /* reiserfs magic string indicates that 143 * file system is reiserfs:
146 * file system is reiserfs: 144 * "ReIsErFs" or "ReIsEr2Fs" or "ReIsEr3Fs" */
147 * "ReIsErFs" or "ReIsEr2Fs" or "ReIsEr3Fs" */ 145 __le16 s_fs_state; /* it is set to used by fsck to mark which
148 __le16 s_fs_state; /* it is set to used by fsck to mark which 146 * phase of rebuilding is done */
149 * phase of rebuilding is done */ 147 __le32 s_hash_function_code; /* indicate, what hash function is being use
150 __le32 s_hash_function_code; /* indicate, what hash function is being use 148 * to sort names in a directory*/
151 * to sort names in a directory*/ 149 __le16 s_tree_height; /* height of disk tree */
152 __le16 s_tree_height; /* height of disk tree */ 150 __le16 s_bmap_nr; /* amount of bitmap blocks needed to address
153 __le16 s_bmap_nr; /* amount of bitmap blocks needed to address 151 * each block of file system */
154 * each block of file system */ 152 __le16 s_version; /* this field is only reliable on filesystem
155 __le16 s_version; /* this field is only reliable on filesystem 153 * with non-standard journal */
156 * with non-standard journal */ 154 __le16 s_reserved_for_journal; /* size in blocks of journal area on main
157 __le16 s_reserved_for_journal; /* size in blocks of journal area on main 155 * device, we need to keep after
158 * device, we need to keep after 156 * making fs with non-standard journal */
159 * making fs with non-standard journal */
160} __attribute__ ((__packed__)); 157} __attribute__ ((__packed__));
161 158
162#define SB_SIZE_V1 (sizeof(struct reiserfs_super_block_v1)) 159#define SB_SIZE_V1 (sizeof(struct reiserfs_super_block_v1))
163 160
164/* this is the on disk super block */ 161/* this is the on disk super block */
165struct reiserfs_super_block 162struct reiserfs_super_block {
166{ 163 struct reiserfs_super_block_v1 s_v1;
167 struct reiserfs_super_block_v1 s_v1; 164 __le32 s_inode_generation;
168 __le32 s_inode_generation; 165 __le32 s_flags; /* Right now used only by inode-attributes, if enabled */
169 __le32 s_flags; /* Right now used only by inode-attributes, if enabled */ 166 unsigned char s_uuid[16]; /* filesystem unique identifier */
170 unsigned char s_uuid[16]; /* filesystem unique identifier */ 167 unsigned char s_label[16]; /* filesystem volume label */
171 unsigned char s_label[16]; /* filesystem volume label */ 168 char s_unused[88]; /* zero filled by mkreiserfs and
172 char s_unused[88] ; /* zero filled by mkreiserfs and 169 * reiserfs_convert_objectid_map_v1()
173 * reiserfs_convert_objectid_map_v1() 170 * so any additions must be updated
174 * so any additions must be updated 171 * there as well. */
175 * there as well. */ 172} __attribute__ ((__packed__));
176} __attribute__ ((__packed__));
177 173
178#define SB_SIZE (sizeof(struct reiserfs_super_block)) 174#define SB_SIZE (sizeof(struct reiserfs_super_block))
179 175
180#define REISERFS_VERSION_1 0 176#define REISERFS_VERSION_1 0
181#define REISERFS_VERSION_2 2 177#define REISERFS_VERSION_2 2
182 178
183
184// on-disk super block fields converted to cpu form 179// on-disk super block fields converted to cpu form
185#define SB_DISK_SUPER_BLOCK(s) (REISERFS_SB(s)->s_rs) 180#define SB_DISK_SUPER_BLOCK(s) (REISERFS_SB(s)->s_rs)
186#define SB_V1_DISK_SUPER_BLOCK(s) (&(SB_DISK_SUPER_BLOCK(s)->s_v1)) 181#define SB_V1_DISK_SUPER_BLOCK(s) (&(SB_DISK_SUPER_BLOCK(s)->s_v1))
@@ -210,13 +205,12 @@ struct reiserfs_super_block
210#define PUT_SB_TREE_HEIGHT(s, val) \ 205#define PUT_SB_TREE_HEIGHT(s, val) \
211 do { SB_V1_DISK_SUPER_BLOCK(s)->s_tree_height = cpu_to_le16(val); } while (0) 206 do { SB_V1_DISK_SUPER_BLOCK(s)->s_tree_height = cpu_to_le16(val); } while (0)
212#define PUT_SB_REISERFS_STATE(s, val) \ 207#define PUT_SB_REISERFS_STATE(s, val) \
213 do { SB_V1_DISK_SUPER_BLOCK(s)->s_umount_state = cpu_to_le16(val); } while (0) 208 do { SB_V1_DISK_SUPER_BLOCK(s)->s_umount_state = cpu_to_le16(val); } while (0)
214#define PUT_SB_VERSION(s, val) \ 209#define PUT_SB_VERSION(s, val) \
215 do { SB_V1_DISK_SUPER_BLOCK(s)->s_version = cpu_to_le16(val); } while (0) 210 do { SB_V1_DISK_SUPER_BLOCK(s)->s_version = cpu_to_le16(val); } while (0)
216#define PUT_SB_BMAP_NR(s, val) \ 211#define PUT_SB_BMAP_NR(s, val) \
217 do { SB_V1_DISK_SUPER_BLOCK(s)->s_bmap_nr = cpu_to_le16 (val); } while (0) 212 do { SB_V1_DISK_SUPER_BLOCK(s)->s_bmap_nr = cpu_to_le16 (val); } while (0)
218 213
219
220#define SB_ONDISK_JP(s) (&SB_V1_DISK_SUPER_BLOCK(s)->s_journal) 214#define SB_ONDISK_JP(s) (&SB_V1_DISK_SUPER_BLOCK(s)->s_journal)
221#define SB_ONDISK_JOURNAL_SIZE(s) \ 215#define SB_ONDISK_JOURNAL_SIZE(s) \
222 le32_to_cpu ((SB_ONDISK_JP(s)->jp_journal_size)) 216 le32_to_cpu ((SB_ONDISK_JP(s)->jp_journal_size))
@@ -231,21 +225,19 @@ struct reiserfs_super_block
231 block >= SB_JOURNAL_1st_RESERVED_BLOCK(s) \ 225 block >= SB_JOURNAL_1st_RESERVED_BLOCK(s) \
232 && block < SB_JOURNAL_1st_RESERVED_BLOCK(s) + \ 226 && block < SB_JOURNAL_1st_RESERVED_BLOCK(s) + \
233 ((!is_reiserfs_jr(SB_DISK_SUPER_BLOCK(s)) ? \ 227 ((!is_reiserfs_jr(SB_DISK_SUPER_BLOCK(s)) ? \
234 SB_ONDISK_JOURNAL_SIZE(s) + 1 : SB_ONDISK_RESERVED_FOR_JOURNAL(s))) 228 SB_ONDISK_JOURNAL_SIZE(s) + 1 : SB_ONDISK_RESERVED_FOR_JOURNAL(s)))
235
236
237 229
238 /* used by gcc */ 230 /* used by gcc */
239#define REISERFS_SUPER_MAGIC 0x52654973 231#define REISERFS_SUPER_MAGIC 0x52654973
240 /* used by file system utilities that 232 /* used by file system utilities that
241 look at the superblock, etc. */ 233 look at the superblock, etc. */
242#define REISERFS_SUPER_MAGIC_STRING "ReIsErFs" 234#define REISERFS_SUPER_MAGIC_STRING "ReIsErFs"
243#define REISER2FS_SUPER_MAGIC_STRING "ReIsEr2Fs" 235#define REISER2FS_SUPER_MAGIC_STRING "ReIsEr2Fs"
244#define REISER2FS_JR_SUPER_MAGIC_STRING "ReIsEr3Fs" 236#define REISER2FS_JR_SUPER_MAGIC_STRING "ReIsEr3Fs"
245 237
246int is_reiserfs_3_5 (struct reiserfs_super_block * rs); 238int is_reiserfs_3_5(struct reiserfs_super_block *rs);
247int is_reiserfs_3_6 (struct reiserfs_super_block * rs); 239int is_reiserfs_3_6(struct reiserfs_super_block *rs);
248int is_reiserfs_jr (struct reiserfs_super_block * rs); 240int is_reiserfs_jr(struct reiserfs_super_block *rs);
249 241
250/* ReiserFS leaves the first 64k unused, so that partition labels have 242/* ReiserFS leaves the first 64k unused, so that partition labels have
251 enough space. If someone wants to write a fancy bootloader that 243 enough space. If someone wants to write a fancy bootloader that
@@ -272,8 +264,8 @@ typedef __u32 b_blocknr_t;
272typedef __le32 unp_t; 264typedef __le32 unp_t;
273 265
274struct unfm_nodeinfo { 266struct unfm_nodeinfo {
275 unp_t unfm_nodenum; 267 unp_t unfm_nodenum;
276 unsigned short unfm_freespace; 268 unsigned short unfm_freespace;
277}; 269};
278 270
279/* there are two formats of keys: 3.5 and 3.6 271/* there are two formats of keys: 3.5 and 3.6
@@ -285,7 +277,6 @@ struct unfm_nodeinfo {
285#define STAT_DATA_V1 0 277#define STAT_DATA_V1 0
286#define STAT_DATA_V2 1 278#define STAT_DATA_V2 1
287 279
288
289static inline struct reiserfs_inode_info *REISERFS_I(const struct inode *inode) 280static inline struct reiserfs_inode_info *REISERFS_I(const struct inode *inode)
290{ 281{
291 return container_of(inode, struct reiserfs_inode_info, vfs_inode); 282 return container_of(inode, struct reiserfs_inode_info, vfs_inode);
@@ -343,15 +334,13 @@ static inline struct reiserfs_sb_info *REISERFS_SB(const struct super_block *sb)
343 file would fit into one DIRECT item. 334 file would fit into one DIRECT item.
344 Primary intention for this one is to increase performance by decreasing 335 Primary intention for this one is to increase performance by decreasing
345 seeking. 336 seeking.
346*/ 337*/
347#define STORE_TAIL_IN_UNFM_S2(n_file_size,n_tail_size,n_block_size) \ 338#define STORE_TAIL_IN_UNFM_S2(n_file_size,n_tail_size,n_block_size) \
348(\ 339(\
349 (!(n_tail_size)) || \ 340 (!(n_tail_size)) || \
350 (((n_file_size) > MAX_DIRECT_ITEM_LEN(n_block_size)) ) \ 341 (((n_file_size) > MAX_DIRECT_ITEM_LEN(n_block_size)) ) \
351) 342)
352 343
353
354
355/* 344/*
356 * values for s_umount_state field 345 * values for s_umount_state field
357 */ 346 */
@@ -364,9 +353,9 @@ static inline struct reiserfs_sb_info *REISERFS_SB(const struct super_block *sb)
364#define TYPE_STAT_DATA 0 353#define TYPE_STAT_DATA 0
365#define TYPE_INDIRECT 1 354#define TYPE_INDIRECT 1
366#define TYPE_DIRECT 2 355#define TYPE_DIRECT 2
367#define TYPE_DIRENTRY 3 356#define TYPE_DIRENTRY 3
368#define TYPE_MAXTYPE 3 357#define TYPE_MAXTYPE 3
369#define TYPE_ANY 15 // FIXME: comment is required 358#define TYPE_ANY 15 // FIXME: comment is required
370 359
371/***************************************************************************/ 360/***************************************************************************/
372/* KEY & ITEM HEAD */ 361/* KEY & ITEM HEAD */
@@ -376,60 +365,62 @@ static inline struct reiserfs_sb_info *REISERFS_SB(const struct super_block *sb)
376// directories use this key as well as old files 365// directories use this key as well as old files
377// 366//
378struct offset_v1 { 367struct offset_v1 {
379 __le32 k_offset; 368 __le32 k_offset;
380 __le32 k_uniqueness; 369 __le32 k_uniqueness;
381} __attribute__ ((__packed__)); 370} __attribute__ ((__packed__));
382 371
383struct offset_v2 { 372struct offset_v2 {
384 __le64 v; 373 __le64 v;
385} __attribute__ ((__packed__)); 374} __attribute__ ((__packed__));
386 375
387static inline __u16 offset_v2_k_type( const struct offset_v2 *v2 ) 376static inline __u16 offset_v2_k_type(const struct offset_v2 *v2)
388{ 377{
389 __u8 type = le64_to_cpu(v2->v) >> 60; 378 __u8 type = le64_to_cpu(v2->v) >> 60;
390 return (type <= TYPE_MAXTYPE)?type:TYPE_ANY; 379 return (type <= TYPE_MAXTYPE) ? type : TYPE_ANY;
391} 380}
392 381
393static inline void set_offset_v2_k_type( struct offset_v2 *v2, int type ) 382static inline void set_offset_v2_k_type(struct offset_v2 *v2, int type)
394{ 383{
395 v2->v = (v2->v & cpu_to_le64(~0ULL>>4)) | cpu_to_le64((__u64)type<<60); 384 v2->v =
385 (v2->v & cpu_to_le64(~0ULL >> 4)) | cpu_to_le64((__u64) type << 60);
396} 386}
397 387
398static inline loff_t offset_v2_k_offset( const struct offset_v2 *v2 ) 388static inline loff_t offset_v2_k_offset(const struct offset_v2 *v2)
399{ 389{
400 return le64_to_cpu(v2->v) & (~0ULL>>4); 390 return le64_to_cpu(v2->v) & (~0ULL >> 4);
401} 391}
402 392
403static inline void set_offset_v2_k_offset( struct offset_v2 *v2, loff_t offset ){ 393static inline void set_offset_v2_k_offset(struct offset_v2 *v2, loff_t offset)
404 offset &= (~0ULL>>4); 394{
405 v2->v = (v2->v & cpu_to_le64(15ULL<<60)) | cpu_to_le64(offset); 395 offset &= (~0ULL >> 4);
396 v2->v = (v2->v & cpu_to_le64(15ULL << 60)) | cpu_to_le64(offset);
406} 397}
407 398
408/* Key of an item determines its location in the S+tree, and 399/* Key of an item determines its location in the S+tree, and
409 is composed of 4 components */ 400 is composed of 4 components */
410struct reiserfs_key { 401struct reiserfs_key {
411 __le32 k_dir_id; /* packing locality: by default parent 402 __le32 k_dir_id; /* packing locality: by default parent
412 directory object id */ 403 directory object id */
413 __le32 k_objectid; /* object identifier */ 404 __le32 k_objectid; /* object identifier */
414 union { 405 union {
415 struct offset_v1 k_offset_v1; 406 struct offset_v1 k_offset_v1;
416 struct offset_v2 k_offset_v2; 407 struct offset_v2 k_offset_v2;
417 } __attribute__ ((__packed__)) u; 408 } __attribute__ ((__packed__)) u;
418} __attribute__ ((__packed__)); 409} __attribute__ ((__packed__));
419 410
420struct in_core_key { 411struct in_core_key {
421 __u32 k_dir_id; /* packing locality: by default parent 412 __u32 k_dir_id; /* packing locality: by default parent
422 directory object id */ 413 directory object id */
423 __u32 k_objectid; /* object identifier */ 414 __u32 k_objectid; /* object identifier */
424 __u64 k_offset; 415 __u64 k_offset;
425 __u8 k_type; 416 __u8 k_type;
426}; 417};
427 418
428struct cpu_key { 419struct cpu_key {
429 struct in_core_key on_disk_key; 420 struct in_core_key on_disk_key;
430 int version; 421 int version;
431 int key_length; /* 3 in all cases but direct2indirect and 422 int key_length; /* 3 in all cases but direct2indirect and
432 indirect2direct conversion */ 423 indirect2direct conversion */
433}; 424};
434 425
435/* Our function for comparing keys can compare keys of different 426/* Our function for comparing keys can compare keys of different
@@ -475,8 +466,7 @@ struct cpu_key {
475 indirect items) and specifies the location of the item itself 466 indirect items) and specifies the location of the item itself
476 within the block. */ 467 within the block. */
477 468
478struct item_head 469struct item_head {
479{
480 /* Everything in the tree is found by searching for it based on 470 /* Everything in the tree is found by searching for it based on
481 * its key.*/ 471 * its key.*/
482 struct reiserfs_key ih_key; 472 struct reiserfs_key ih_key;
@@ -492,13 +482,13 @@ struct item_head
492 number of directory entries in the directory item. */ 482 number of directory entries in the directory item. */
493 __le16 ih_entry_count; 483 __le16 ih_entry_count;
494 } __attribute__ ((__packed__)) u; 484 } __attribute__ ((__packed__)) u;
495 __le16 ih_item_len; /* total size of the item body */ 485 __le16 ih_item_len; /* total size of the item body */
496 __le16 ih_item_location; /* an offset to the item body 486 __le16 ih_item_location; /* an offset to the item body
497 * within the block */ 487 * within the block */
498 __le16 ih_version; /* 0 for all old items, 2 for new 488 __le16 ih_version; /* 0 for all old items, 2 for new
499 ones. Highest bit is set by fsck 489 ones. Highest bit is set by fsck
500 temporary, cleaned after all 490 temporary, cleaned after all
501 done */ 491 done */
502} __attribute__ ((__packed__)); 492} __attribute__ ((__packed__));
503/* size of item header */ 493/* size of item header */
504#define IH_SIZE (sizeof(struct item_head)) 494#define IH_SIZE (sizeof(struct item_head))
@@ -515,7 +505,6 @@ struct item_head
515#define put_ih_location(ih, val) do { (ih)->ih_item_location = cpu_to_le16(val); } while (0) 505#define put_ih_location(ih, val) do { (ih)->ih_item_location = cpu_to_le16(val); } while (0)
516#define put_ih_item_len(ih, val) do { (ih)->ih_item_len = cpu_to_le16(val); } while (0) 506#define put_ih_item_len(ih, val) do { (ih)->ih_item_len = cpu_to_le16(val); } while (0)
517 507
518
519#define unreachable_item(ih) (ih_version(ih) & (1 << 15)) 508#define unreachable_item(ih) (ih_version(ih) & (1 << 15))
520 509
521#define get_ih_free_space(ih) (ih_version (ih) == KEY_FORMAT_3_6 ? 0 : ih_free_space (ih)) 510#define get_ih_free_space(ih) (ih_version (ih) == KEY_FORMAT_3_6 ? 0 : ih_free_space (ih))
@@ -537,40 +526,48 @@ struct item_head
537#define V1_INDIRECT_UNIQUENESS 0xfffffffe 526#define V1_INDIRECT_UNIQUENESS 0xfffffffe
538#define V1_DIRECT_UNIQUENESS 0xffffffff 527#define V1_DIRECT_UNIQUENESS 0xffffffff
539#define V1_DIRENTRY_UNIQUENESS 500 528#define V1_DIRENTRY_UNIQUENESS 500
540#define V1_ANY_UNIQUENESS 555 // FIXME: comment is required 529#define V1_ANY_UNIQUENESS 555 // FIXME: comment is required
541 530
542// 531//
543// here are conversion routines 532// here are conversion routines
544// 533//
545static inline int uniqueness2type (__u32 uniqueness) CONSTF; 534static inline int uniqueness2type(__u32 uniqueness) CONSTF;
546static inline int uniqueness2type (__u32 uniqueness) 535static inline int uniqueness2type(__u32 uniqueness)
547{ 536{
548 switch ((int)uniqueness) { 537 switch ((int)uniqueness) {
549 case V1_SD_UNIQUENESS: return TYPE_STAT_DATA; 538 case V1_SD_UNIQUENESS:
550 case V1_INDIRECT_UNIQUENESS: return TYPE_INDIRECT; 539 return TYPE_STAT_DATA;
551 case V1_DIRECT_UNIQUENESS: return TYPE_DIRECT; 540 case V1_INDIRECT_UNIQUENESS:
552 case V1_DIRENTRY_UNIQUENESS: return TYPE_DIRENTRY; 541 return TYPE_INDIRECT;
553 default: 542 case V1_DIRECT_UNIQUENESS:
554 reiserfs_warning (NULL, "vs-500: unknown uniqueness %d", 543 return TYPE_DIRECT;
555 uniqueness); 544 case V1_DIRENTRY_UNIQUENESS:
545 return TYPE_DIRENTRY;
546 default:
547 reiserfs_warning(NULL, "vs-500: unknown uniqueness %d",
548 uniqueness);
556 case V1_ANY_UNIQUENESS: 549 case V1_ANY_UNIQUENESS:
557 return TYPE_ANY; 550 return TYPE_ANY;
558 } 551 }
559} 552}
560 553
561static inline __u32 type2uniqueness (int type) CONSTF; 554static inline __u32 type2uniqueness(int type) CONSTF;
562static inline __u32 type2uniqueness (int type) 555static inline __u32 type2uniqueness(int type)
563{ 556{
564 switch (type) { 557 switch (type) {
565 case TYPE_STAT_DATA: return V1_SD_UNIQUENESS; 558 case TYPE_STAT_DATA:
566 case TYPE_INDIRECT: return V1_INDIRECT_UNIQUENESS; 559 return V1_SD_UNIQUENESS;
567 case TYPE_DIRECT: return V1_DIRECT_UNIQUENESS; 560 case TYPE_INDIRECT:
568 case TYPE_DIRENTRY: return V1_DIRENTRY_UNIQUENESS; 561 return V1_INDIRECT_UNIQUENESS;
569 default: 562 case TYPE_DIRECT:
570 reiserfs_warning (NULL, "vs-501: unknown type %d", type); 563 return V1_DIRECT_UNIQUENESS;
564 case TYPE_DIRENTRY:
565 return V1_DIRENTRY_UNIQUENESS;
566 default:
567 reiserfs_warning(NULL, "vs-501: unknown type %d", type);
571 case TYPE_ANY: 568 case TYPE_ANY:
572 return V1_ANY_UNIQUENESS; 569 return V1_ANY_UNIQUENESS;
573 } 570 }
574} 571}
575 572
576// 573//
@@ -578,57 +575,56 @@ static inline __u32 type2uniqueness (int type)
578// there is no way to get version of object from key, so, provide 575// there is no way to get version of object from key, so, provide
579// version to these defines 576// version to these defines
580// 577//
581static inline loff_t le_key_k_offset (int version, const struct reiserfs_key * key) 578static inline loff_t le_key_k_offset(int version,
579 const struct reiserfs_key *key)
582{ 580{
583 return (version == KEY_FORMAT_3_5) ? 581 return (version == KEY_FORMAT_3_5) ?
584 le32_to_cpu( key->u.k_offset_v1.k_offset ) : 582 le32_to_cpu(key->u.k_offset_v1.k_offset) :
585 offset_v2_k_offset( &(key->u.k_offset_v2) ); 583 offset_v2_k_offset(&(key->u.k_offset_v2));
586} 584}
587 585
588static inline loff_t le_ih_k_offset (const struct item_head * ih) 586static inline loff_t le_ih_k_offset(const struct item_head *ih)
589{ 587{
590 return le_key_k_offset (ih_version (ih), &(ih->ih_key)); 588 return le_key_k_offset(ih_version(ih), &(ih->ih_key));
591} 589}
592 590
593static inline loff_t le_key_k_type (int version, const struct reiserfs_key * key) 591static inline loff_t le_key_k_type(int version, const struct reiserfs_key *key)
594{ 592{
595 return (version == KEY_FORMAT_3_5) ? 593 return (version == KEY_FORMAT_3_5) ?
596 uniqueness2type( le32_to_cpu( key->u.k_offset_v1.k_uniqueness)) : 594 uniqueness2type(le32_to_cpu(key->u.k_offset_v1.k_uniqueness)) :
597 offset_v2_k_type( &(key->u.k_offset_v2) ); 595 offset_v2_k_type(&(key->u.k_offset_v2));
598} 596}
599 597
600static inline loff_t le_ih_k_type (const struct item_head * ih) 598static inline loff_t le_ih_k_type(const struct item_head *ih)
601{ 599{
602 return le_key_k_type (ih_version (ih), &(ih->ih_key)); 600 return le_key_k_type(ih_version(ih), &(ih->ih_key));
603} 601}
604 602
605 603static inline void set_le_key_k_offset(int version, struct reiserfs_key *key,
606static inline void set_le_key_k_offset (int version, struct reiserfs_key * key, loff_t offset) 604 loff_t offset)
607{ 605{
608 (version == KEY_FORMAT_3_5) ? 606 (version == KEY_FORMAT_3_5) ? (void)(key->u.k_offset_v1.k_offset = cpu_to_le32(offset)) : /* jdm check */
609 (void)(key->u.k_offset_v1.k_offset = cpu_to_le32 (offset)) : /* jdm check */ 607 (void)(set_offset_v2_k_offset(&(key->u.k_offset_v2), offset));
610 (void)(set_offset_v2_k_offset( &(key->u.k_offset_v2), offset ));
611} 608}
612 609
613 610static inline void set_le_ih_k_offset(struct item_head *ih, loff_t offset)
614static inline void set_le_ih_k_offset (struct item_head * ih, loff_t offset)
615{ 611{
616 set_le_key_k_offset (ih_version (ih), &(ih->ih_key), offset); 612 set_le_key_k_offset(ih_version(ih), &(ih->ih_key), offset);
617} 613}
618 614
619 615static inline void set_le_key_k_type(int version, struct reiserfs_key *key,
620static inline void set_le_key_k_type (int version, struct reiserfs_key * key, int type) 616 int type)
621{ 617{
622 (version == KEY_FORMAT_3_5) ? 618 (version == KEY_FORMAT_3_5) ?
623 (void)(key->u.k_offset_v1.k_uniqueness = cpu_to_le32(type2uniqueness(type))): 619 (void)(key->u.k_offset_v1.k_uniqueness =
624 (void)(set_offset_v2_k_type( &(key->u.k_offset_v2), type )); 620 cpu_to_le32(type2uniqueness(type)))
621 : (void)(set_offset_v2_k_type(&(key->u.k_offset_v2), type));
625} 622}
626static inline void set_le_ih_k_type (struct item_head * ih, int type) 623static inline void set_le_ih_k_type(struct item_head *ih, int type)
627{ 624{
628 set_le_key_k_type (ih_version (ih), &(ih->ih_key), type); 625 set_le_key_k_type(ih_version(ih), &(ih->ih_key), type);
629} 626}
630 627
631
632#define is_direntry_le_key(version,key) (le_key_k_type (version, key) == TYPE_DIRENTRY) 628#define is_direntry_le_key(version,key) (le_key_k_type (version, key) == TYPE_DIRENTRY)
633#define is_direct_le_key(version,key) (le_key_k_type (version, key) == TYPE_DIRECT) 629#define is_direct_le_key(version,key) (le_key_k_type (version, key) == TYPE_DIRECT)
634#define is_indirect_le_key(version,key) (le_key_k_type (version, key) == TYPE_INDIRECT) 630#define is_indirect_le_key(version,key) (le_key_k_type (version, key) == TYPE_INDIRECT)
@@ -642,34 +638,32 @@ static inline void set_le_ih_k_type (struct item_head * ih, int type)
642#define is_indirect_le_ih(ih) is_indirect_le_key (ih_version(ih), &((ih)->ih_key)) 638#define is_indirect_le_ih(ih) is_indirect_le_key (ih_version(ih), &((ih)->ih_key))
643#define is_statdata_le_ih(ih) is_statdata_le_key (ih_version (ih), &((ih)->ih_key)) 639#define is_statdata_le_ih(ih) is_statdata_le_key (ih_version (ih), &((ih)->ih_key))
644 640
645
646
647// 641//
648// key is pointer to cpu key, result is cpu 642// key is pointer to cpu key, result is cpu
649// 643//
650static inline loff_t cpu_key_k_offset (const struct cpu_key * key) 644static inline loff_t cpu_key_k_offset(const struct cpu_key *key)
651{ 645{
652 return key->on_disk_key.k_offset; 646 return key->on_disk_key.k_offset;
653} 647}
654 648
655static inline loff_t cpu_key_k_type (const struct cpu_key * key) 649static inline loff_t cpu_key_k_type(const struct cpu_key *key)
656{ 650{
657 return key->on_disk_key.k_type; 651 return key->on_disk_key.k_type;
658} 652}
659 653
660static inline void set_cpu_key_k_offset (struct cpu_key * key, loff_t offset) 654static inline void set_cpu_key_k_offset(struct cpu_key *key, loff_t offset)
661{ 655{
662 key->on_disk_key.k_offset = offset; 656 key->on_disk_key.k_offset = offset;
663} 657}
664 658
665static inline void set_cpu_key_k_type (struct cpu_key * key, int type) 659static inline void set_cpu_key_k_type(struct cpu_key *key, int type)
666{ 660{
667 key->on_disk_key.k_type = type; 661 key->on_disk_key.k_type = type;
668} 662}
669 663
670static inline void cpu_key_k_offset_dec (struct cpu_key * key) 664static inline void cpu_key_k_offset_dec(struct cpu_key *key)
671{ 665{
672 key->on_disk_key.k_offset --; 666 key->on_disk_key.k_offset--;
673} 667}
674 668
675#define is_direntry_cpu_key(key) (cpu_key_k_type (key) == TYPE_DIRENTRY) 669#define is_direntry_cpu_key(key) (cpu_key_k_type (key) == TYPE_DIRENTRY)
@@ -677,34 +671,25 @@ static inline void cpu_key_k_offset_dec (struct cpu_key * key)
677#define is_indirect_cpu_key(key) (cpu_key_k_type (key) == TYPE_INDIRECT) 671#define is_indirect_cpu_key(key) (cpu_key_k_type (key) == TYPE_INDIRECT)
678#define is_statdata_cpu_key(key) (cpu_key_k_type (key) == TYPE_STAT_DATA) 672#define is_statdata_cpu_key(key) (cpu_key_k_type (key) == TYPE_STAT_DATA)
679 673
680
681/* are these used ? */ 674/* are these used ? */
682#define is_direntry_cpu_ih(ih) (is_direntry_cpu_key (&((ih)->ih_key))) 675#define is_direntry_cpu_ih(ih) (is_direntry_cpu_key (&((ih)->ih_key)))
683#define is_direct_cpu_ih(ih) (is_direct_cpu_key (&((ih)->ih_key))) 676#define is_direct_cpu_ih(ih) (is_direct_cpu_key (&((ih)->ih_key)))
684#define is_indirect_cpu_ih(ih) (is_indirect_cpu_key (&((ih)->ih_key))) 677#define is_indirect_cpu_ih(ih) (is_indirect_cpu_key (&((ih)->ih_key)))
685#define is_statdata_cpu_ih(ih) (is_statdata_cpu_key (&((ih)->ih_key))) 678#define is_statdata_cpu_ih(ih) (is_statdata_cpu_key (&((ih)->ih_key)))
686 679
687
688
689
690
691#define I_K_KEY_IN_ITEM(p_s_ih, p_s_key, n_blocksize) \ 680#define I_K_KEY_IN_ITEM(p_s_ih, p_s_key, n_blocksize) \
692 ( ! COMP_SHORT_KEYS(p_s_ih, p_s_key) && \ 681 ( ! COMP_SHORT_KEYS(p_s_ih, p_s_key) && \
693 I_OFF_BYTE_IN_ITEM(p_s_ih, k_offset (p_s_key), n_blocksize) ) 682 I_OFF_BYTE_IN_ITEM(p_s_ih, k_offset (p_s_key), n_blocksize) )
694 683
695/* maximal length of item */ 684/* maximal length of item */
696#define MAX_ITEM_LEN(block_size) (block_size - BLKH_SIZE - IH_SIZE) 685#define MAX_ITEM_LEN(block_size) (block_size - BLKH_SIZE - IH_SIZE)
697#define MIN_ITEM_LEN 1 686#define MIN_ITEM_LEN 1
698 687
699
700/* object identifier for root dir */ 688/* object identifier for root dir */
701#define REISERFS_ROOT_OBJECTID 2 689#define REISERFS_ROOT_OBJECTID 2
702#define REISERFS_ROOT_PARENT_OBJECTID 1 690#define REISERFS_ROOT_PARENT_OBJECTID 1
703extern struct reiserfs_key root_key; 691extern struct reiserfs_key root_key;
704 692
705
706
707
708/* 693/*
709 * Picture represents a leaf of the S+tree 694 * Picture represents a leaf of the S+tree
710 * ______________________________________________________ 695 * ______________________________________________________
@@ -716,13 +701,13 @@ extern struct reiserfs_key root_key;
716 701
717/* Header of a disk block. More precisely, header of a formatted leaf 702/* Header of a disk block. More precisely, header of a formatted leaf
718 or internal node, and not the header of an unformatted node. */ 703 or internal node, and not the header of an unformatted node. */
719struct block_head { 704struct block_head {
720 __le16 blk_level; /* Level of a block in the tree. */ 705 __le16 blk_level; /* Level of a block in the tree. */
721 __le16 blk_nr_item; /* Number of keys/items in a block. */ 706 __le16 blk_nr_item; /* Number of keys/items in a block. */
722 __le16 blk_free_space; /* Block free space in bytes. */ 707 __le16 blk_free_space; /* Block free space in bytes. */
723 __le16 blk_reserved; 708 __le16 blk_reserved;
724 /* dump this in v4/planA */ 709 /* dump this in v4/planA */
725 struct reiserfs_key blk_right_delim_key; /* kept only for compatibility */ 710 struct reiserfs_key blk_right_delim_key; /* kept only for compatibility */
726}; 711};
727 712
728#define BLKH_SIZE (sizeof(struct block_head)) 713#define BLKH_SIZE (sizeof(struct block_head))
@@ -741,12 +726,12 @@ struct block_head {
741 * values for blk_level field of the struct block_head 726 * values for blk_level field of the struct block_head
742 */ 727 */
743 728
744#define FREE_LEVEL 0 /* when node gets removed from the tree its 729#define FREE_LEVEL 0 /* when node gets removed from the tree its
745 blk_level is set to FREE_LEVEL. It is then 730 blk_level is set to FREE_LEVEL. It is then
746 used to see whether the node is still in the 731 used to see whether the node is still in the
747 tree */ 732 tree */
748 733
749#define DISK_LEAF_NODE_LEVEL 1 /* Leaf node level.*/ 734#define DISK_LEAF_NODE_LEVEL 1 /* Leaf node level. */
750 735
751/* Given the buffer head of a formatted node, resolve to the block head of that node. */ 736/* Given the buffer head of a formatted node, resolve to the block head of that node. */
752#define B_BLK_HEAD(p_s_bh) ((struct block_head *)((p_s_bh)->b_data)) 737#define B_BLK_HEAD(p_s_bh) ((struct block_head *)((p_s_bh)->b_data))
@@ -759,7 +744,6 @@ struct block_head {
759#define PUT_B_LEVEL(p_s_bh,val) do { set_blkh_level(B_BLK_HEAD(p_s_bh),val); } while (0) 744#define PUT_B_LEVEL(p_s_bh,val) do { set_blkh_level(B_BLK_HEAD(p_s_bh),val); } while (0)
760#define PUT_B_FREE_SPACE(p_s_bh,val) do { set_blkh_free_space(B_BLK_HEAD(p_s_bh),val); } while (0) 745#define PUT_B_FREE_SPACE(p_s_bh,val) do { set_blkh_free_space(B_BLK_HEAD(p_s_bh),val); } while (0)
761 746
762
763/* Get right delimiting key. -- little endian */ 747/* Get right delimiting key. -- little endian */
764#define B_PRIGHT_DELIM_KEY(p_s_bh) (&(blk_right_delim_key(B_BLK_HEAD(p_s_bh)) 748#define B_PRIGHT_DELIM_KEY(p_s_bh) (&(blk_right_delim_key(B_BLK_HEAD(p_s_bh))
765 749
@@ -770,41 +754,36 @@ struct block_head {
770#define B_IS_KEYS_LEVEL(p_s_bh) (B_LEVEL(p_s_bh) > DISK_LEAF_NODE_LEVEL \ 754#define B_IS_KEYS_LEVEL(p_s_bh) (B_LEVEL(p_s_bh) > DISK_LEAF_NODE_LEVEL \
771 && B_LEVEL(p_s_bh) <= MAX_HEIGHT) 755 && B_LEVEL(p_s_bh) <= MAX_HEIGHT)
772 756
773
774
775
776/***************************************************************************/ 757/***************************************************************************/
777/* STAT DATA */ 758/* STAT DATA */
778/***************************************************************************/ 759/***************************************************************************/
779 760
780
781// 761//
782// old stat data is 32 bytes long. We are going to distinguish new one by 762// old stat data is 32 bytes long. We are going to distinguish new one by
783// different size 763// different size
784// 764//
785struct stat_data_v1 765struct stat_data_v1 {
786{ 766 __le16 sd_mode; /* file type, permissions */
787 __le16 sd_mode; /* file type, permissions */ 767 __le16 sd_nlink; /* number of hard links */
788 __le16 sd_nlink; /* number of hard links */ 768 __le16 sd_uid; /* owner */
789 __le16 sd_uid; /* owner */ 769 __le16 sd_gid; /* group */
790 __le16 sd_gid; /* group */ 770 __le32 sd_size; /* file size */
791 __le32 sd_size; /* file size */ 771 __le32 sd_atime; /* time of last access */
792 __le32 sd_atime; /* time of last access */ 772 __le32 sd_mtime; /* time file was last modified */
793 __le32 sd_mtime; /* time file was last modified */ 773 __le32 sd_ctime; /* time inode (stat data) was last changed (except changes to sd_atime and sd_mtime) */
794 __le32 sd_ctime; /* time inode (stat data) was last changed (except changes to sd_atime and sd_mtime) */ 774 union {
795 union { 775 __le32 sd_rdev;
796 __le32 sd_rdev; 776 __le32 sd_blocks; /* number of blocks file uses */
797 __le32 sd_blocks; /* number of blocks file uses */ 777 } __attribute__ ((__packed__)) u;
798 } __attribute__ ((__packed__)) u; 778 __le32 sd_first_direct_byte; /* first byte of file which is stored
799 __le32 sd_first_direct_byte; /* first byte of file which is stored 779 in a direct item: except that if it
800 in a direct item: except that if it 780 equals 1 it is a symlink and if it
801 equals 1 it is a symlink and if it 781 equals ~(__u32)0 there is no
802 equals ~(__u32)0 there is no 782 direct item. The existence of this
803 direct item. The existence of this 783 field really grates on me. Let's
804 field really grates on me. Let's 784 replace it with a macro based on
805 replace it with a macro based on 785 sd_size and our tail suppression
806 sd_size and our tail suppression 786 policy. Someday. -Hans */
807 policy. Someday. -Hans */
808} __attribute__ ((__packed__)); 787} __attribute__ ((__packed__));
809 788
810#define SD_V1_SIZE (sizeof(struct stat_data_v1)) 789#define SD_V1_SIZE (sizeof(struct stat_data_v1))
@@ -862,29 +841,29 @@ struct stat_data_v1
862/* Stat Data on disk (reiserfs version of UFS disk inode minus the 841/* Stat Data on disk (reiserfs version of UFS disk inode minus the
863 address blocks) */ 842 address blocks) */
864struct stat_data { 843struct stat_data {
865 __le16 sd_mode; /* file type, permissions */ 844 __le16 sd_mode; /* file type, permissions */
866 __le16 sd_attrs; /* persistent inode flags */ 845 __le16 sd_attrs; /* persistent inode flags */
867 __le32 sd_nlink; /* number of hard links */ 846 __le32 sd_nlink; /* number of hard links */
868 __le64 sd_size; /* file size */ 847 __le64 sd_size; /* file size */
869 __le32 sd_uid; /* owner */ 848 __le32 sd_uid; /* owner */
870 __le32 sd_gid; /* group */ 849 __le32 sd_gid; /* group */
871 __le32 sd_atime; /* time of last access */ 850 __le32 sd_atime; /* time of last access */
872 __le32 sd_mtime; /* time file was last modified */ 851 __le32 sd_mtime; /* time file was last modified */
873 __le32 sd_ctime; /* time inode (stat data) was last changed (except changes to sd_atime and sd_mtime) */ 852 __le32 sd_ctime; /* time inode (stat data) was last changed (except changes to sd_atime and sd_mtime) */
874 __le32 sd_blocks; 853 __le32 sd_blocks;
875 union { 854 union {
876 __le32 sd_rdev; 855 __le32 sd_rdev;
877 __le32 sd_generation; 856 __le32 sd_generation;
878 //__le32 sd_first_direct_byte; 857 //__le32 sd_first_direct_byte;
879 /* first byte of file which is stored in a 858 /* first byte of file which is stored in a
880 direct item: except that if it equals 1 859 direct item: except that if it equals 1
881 it is a symlink and if it equals 860 it is a symlink and if it equals
882 ~(__u32)0 there is no direct item. The 861 ~(__u32)0 there is no direct item. The
883 existence of this field really grates 862 existence of this field really grates
884 on me. Let's replace it with a macro 863 on me. Let's replace it with a macro
885 based on sd_size and our tail 864 based on sd_size and our tail
886 suppression policy? */ 865 suppression policy? */
887 } __attribute__ ((__packed__)) u; 866 } __attribute__ ((__packed__)) u;
888} __attribute__ ((__packed__)); 867} __attribute__ ((__packed__));
889// 868//
890// this is 44 bytes long 869// this is 44 bytes long
@@ -919,7 +898,6 @@ struct stat_data {
919#define sd_v2_attrs(sdp) (le16_to_cpu((sdp)->sd_attrs)) 898#define sd_v2_attrs(sdp) (le16_to_cpu((sdp)->sd_attrs))
920#define set_sd_v2_attrs(sdp,v) ((sdp)->sd_attrs = cpu_to_le16(v)) 899#define set_sd_v2_attrs(sdp,v) ((sdp)->sd_attrs = cpu_to_le16(v))
921 900
922
923/***************************************************************************/ 901/***************************************************************************/
924/* DIRECTORY STRUCTURE */ 902/* DIRECTORY STRUCTURE */
925/***************************************************************************/ 903/***************************************************************************/
@@ -954,17 +932,14 @@ struct stat_data {
954/* NOT IMPLEMENTED: 932/* NOT IMPLEMENTED:
955 Directory will someday contain stat data of object */ 933 Directory will someday contain stat data of object */
956 934
957 935struct reiserfs_de_head {
958 936 __le32 deh_offset; /* third component of the directory entry key */
959struct reiserfs_de_head 937 __le32 deh_dir_id; /* objectid of the parent directory of the object, that is referenced
960{ 938 by directory entry */
961 __le32 deh_offset; /* third component of the directory entry key */ 939 __le32 deh_objectid; /* objectid of the object, that is referenced by directory entry */
962 __le32 deh_dir_id; /* objectid of the parent directory of the object, that is referenced 940 __le16 deh_location; /* offset of name in the whole item */
963 by directory entry */ 941 __le16 deh_state; /* whether 1) entry contains stat data (for future), and 2) whether
964 __le32 deh_objectid; /* objectid of the object, that is referenced by directory entry */ 942 entry is hidden (unlinked) */
965 __le16 deh_location; /* offset of name in the whole item */
966 __le16 deh_state; /* whether 1) entry contains stat data (for future), and 2) whether
967 entry is hidden (unlinked) */
968} __attribute__ ((__packed__)); 943} __attribute__ ((__packed__));
969#define DEH_SIZE sizeof(struct reiserfs_de_head) 944#define DEH_SIZE sizeof(struct reiserfs_de_head)
970#define deh_offset(p_deh) (le32_to_cpu((p_deh)->deh_offset)) 945#define deh_offset(p_deh) (le32_to_cpu((p_deh)->deh_offset))
@@ -986,7 +961,7 @@ struct reiserfs_de_head
986/* old format directories have this size when empty */ 961/* old format directories have this size when empty */
987#define EMPTY_DIR_SIZE_V1 (DEH_SIZE * 2 + 3) 962#define EMPTY_DIR_SIZE_V1 (DEH_SIZE * 2 + 3)
988 963
989#define DEH_Statdata 0 /* not used now */ 964#define DEH_Statdata 0 /* not used now */
990#define DEH_Visible 2 965#define DEH_Visible 2
991 966
992/* 64 bit systems (and the S/390) need to be aligned explicitly -jdm */ 967/* 64 bit systems (and the S/390) need to be aligned explicitly -jdm */
@@ -1023,10 +998,10 @@ struct reiserfs_de_head
1023#define de_visible(deh) test_bit_unaligned (DEH_Visible, &((deh)->deh_state)) 998#define de_visible(deh) test_bit_unaligned (DEH_Visible, &((deh)->deh_state))
1024#define de_hidden(deh) !test_bit_unaligned (DEH_Visible, &((deh)->deh_state)) 999#define de_hidden(deh) !test_bit_unaligned (DEH_Visible, &((deh)->deh_state))
1025 1000
1026extern void make_empty_dir_item_v1 (char * body, __le32 dirid, __le32 objid, 1001extern void make_empty_dir_item_v1(char *body, __le32 dirid, __le32 objid,
1027 __le32 par_dirid, __le32 par_objid); 1002 __le32 par_dirid, __le32 par_objid);
1028extern void make_empty_dir_item (char * body, __le32 dirid, __le32 objid, 1003extern void make_empty_dir_item(char *body, __le32 dirid, __le32 objid,
1029 __le32 par_dirid, __le32 par_objid); 1004 __le32 par_dirid, __le32 par_objid);
1030 1005
1031/* array of the entry headers */ 1006/* array of the entry headers */
1032 /* get item body */ 1007 /* get item body */
@@ -1043,53 +1018,48 @@ extern void make_empty_dir_item (char * body, __le32 dirid, __le32 objid,
1043#define I_DEH_N_ENTRY_LENGTH(ih,deh,i) \ 1018#define I_DEH_N_ENTRY_LENGTH(ih,deh,i) \
1044((i) ? (deh_location((deh)-1) - deh_location((deh))) : (ih_item_len((ih)) - deh_location((deh)))) 1019((i) ? (deh_location((deh)-1) - deh_location((deh))) : (ih_item_len((ih)) - deh_location((deh))))
1045*/ 1020*/
1046static inline int entry_length (const struct buffer_head * bh, 1021static inline int entry_length(const struct buffer_head *bh,
1047 const struct item_head * ih, int pos_in_item) 1022 const struct item_head *ih, int pos_in_item)
1048{ 1023{
1049 struct reiserfs_de_head * deh; 1024 struct reiserfs_de_head *deh;
1050 1025
1051 deh = B_I_DEH (bh, ih) + pos_in_item; 1026 deh = B_I_DEH(bh, ih) + pos_in_item;
1052 if (pos_in_item) 1027 if (pos_in_item)
1053 return deh_location(deh-1) - deh_location(deh); 1028 return deh_location(deh - 1) - deh_location(deh);
1054 1029
1055 return ih_item_len(ih) - deh_location(deh); 1030 return ih_item_len(ih) - deh_location(deh);
1056} 1031}
1057 1032
1058
1059
1060/* number of entries in the directory item, depends on ENTRY_COUNT being at the start of directory dynamic data. */ 1033/* number of entries in the directory item, depends on ENTRY_COUNT being at the start of directory dynamic data. */
1061#define I_ENTRY_COUNT(ih) (ih_entry_count((ih))) 1034#define I_ENTRY_COUNT(ih) (ih_entry_count((ih)))
1062 1035
1063
1064/* name by bh, ih and entry_num */ 1036/* name by bh, ih and entry_num */
1065#define B_I_E_NAME(bh,ih,entry_num) ((char *)(bh->b_data + ih_location(ih) + deh_location(B_I_DEH(bh,ih)+(entry_num)))) 1037#define B_I_E_NAME(bh,ih,entry_num) ((char *)(bh->b_data + ih_location(ih) + deh_location(B_I_DEH(bh,ih)+(entry_num))))
1066 1038
1067// two entries per block (at least) 1039// two entries per block (at least)
1068#define REISERFS_MAX_NAME(block_size) 255 1040#define REISERFS_MAX_NAME(block_size) 255
1069 1041
1070
1071/* this structure is used for operations on directory entries. It is 1042/* this structure is used for operations on directory entries. It is
1072 not a disk structure. */ 1043 not a disk structure. */
1073/* When reiserfs_find_entry or search_by_entry_key find directory 1044/* When reiserfs_find_entry or search_by_entry_key find directory
1074 entry, they return filled reiserfs_dir_entry structure */ 1045 entry, they return filled reiserfs_dir_entry structure */
1075struct reiserfs_dir_entry 1046struct reiserfs_dir_entry {
1076{ 1047 struct buffer_head *de_bh;
1077 struct buffer_head * de_bh; 1048 int de_item_num;
1078 int de_item_num; 1049 struct item_head *de_ih;
1079 struct item_head * de_ih; 1050 int de_entry_num;
1080 int de_entry_num; 1051 struct reiserfs_de_head *de_deh;
1081 struct reiserfs_de_head * de_deh; 1052 int de_entrylen;
1082 int de_entrylen; 1053 int de_namelen;
1083 int de_namelen; 1054 char *de_name;
1084 char * de_name; 1055 char *de_gen_number_bit_string;
1085 char * de_gen_number_bit_string; 1056
1086 1057 __u32 de_dir_id;
1087 __u32 de_dir_id; 1058 __u32 de_objectid;
1088 __u32 de_objectid; 1059
1089 1060 struct cpu_key de_entry_key;
1090 struct cpu_key de_entry_key;
1091}; 1061};
1092 1062
1093/* these defines are useful when a particular member of a reiserfs_dir_entry is needed */ 1063/* these defines are useful when a particular member of a reiserfs_dir_entry is needed */
1094 1064
1095/* pointer to file name, stored in entry */ 1065/* pointer to file name, stored in entry */
@@ -1099,8 +1069,6 @@ struct reiserfs_dir_entry
1099#define I_DEH_N_ENTRY_FILE_NAME_LENGTH(ih,deh,entry_num) \ 1069#define I_DEH_N_ENTRY_FILE_NAME_LENGTH(ih,deh,entry_num) \
1100(I_DEH_N_ENTRY_LENGTH (ih, deh, entry_num) - (de_with_sd (deh) ? SD_SIZE : 0)) 1070(I_DEH_N_ENTRY_LENGTH (ih, deh, entry_num) - (de_with_sd (deh) ? SD_SIZE : 0))
1101 1071
1102
1103
1104/* hash value occupies bits from 7 up to 30 */ 1072/* hash value occupies bits from 7 up to 30 */
1105#define GET_HASH_VALUE(offset) ((offset) & 0x7fffff80LL) 1073#define GET_HASH_VALUE(offset) ((offset) & 0x7fffff80LL)
1106/* generation number occupies 7 bits starting from 0 up to 6 */ 1074/* generation number occupies 7 bits starting from 0 up to 6 */
@@ -1109,7 +1077,6 @@ struct reiserfs_dir_entry
1109 1077
1110#define SET_GENERATION_NUMBER(offset,gen_number) (GET_HASH_VALUE(offset)|(gen_number)) 1078#define SET_GENERATION_NUMBER(offset,gen_number) (GET_HASH_VALUE(offset)|(gen_number))
1111 1079
1112
1113/* 1080/*
1114 * Picture represents an internal node of the reiserfs tree 1081 * Picture represents an internal node of the reiserfs tree
1115 * ______________________________________________________ 1082 * ______________________________________________________
@@ -1125,9 +1092,9 @@ struct reiserfs_dir_entry
1125/* Disk child pointer: The pointer from an internal node of the tree 1092/* Disk child pointer: The pointer from an internal node of the tree
1126 to a node that is on disk. */ 1093 to a node that is on disk. */
1127struct disk_child { 1094struct disk_child {
1128 __le32 dc_block_number; /* Disk child's block number. */ 1095 __le32 dc_block_number; /* Disk child's block number. */
1129 __le16 dc_size; /* Disk child's used space. */ 1096 __le16 dc_size; /* Disk child's used space. */
1130 __le16 dc_reserved; 1097 __le16 dc_reserved;
1131}; 1098};
1132 1099
1133#define DC_SIZE (sizeof(struct disk_child)) 1100#define DC_SIZE (sizeof(struct disk_child))
@@ -1144,7 +1111,7 @@ struct disk_child {
1144#define B_N_CHILD_NUM(p_s_bh,n_pos) (dc_block_number(B_N_CHILD(p_s_bh,n_pos))) 1111#define B_N_CHILD_NUM(p_s_bh,n_pos) (dc_block_number(B_N_CHILD(p_s_bh,n_pos)))
1145#define PUT_B_N_CHILD_NUM(p_s_bh,n_pos, val) (put_dc_block_number(B_N_CHILD(p_s_bh,n_pos), val )) 1112#define PUT_B_N_CHILD_NUM(p_s_bh,n_pos, val) (put_dc_block_number(B_N_CHILD(p_s_bh,n_pos), val ))
1146 1113
1147 /* maximal value of field child_size in structure disk_child */ 1114 /* maximal value of field child_size in structure disk_child */
1148 /* child size is the combined size of all items and their headers */ 1115 /* child size is the combined size of all items and their headers */
1149#define MAX_CHILD_SIZE(bh) ((int)( (bh)->b_size - BLKH_SIZE )) 1116#define MAX_CHILD_SIZE(bh) ((int)( (bh)->b_size - BLKH_SIZE ))
1150 1117
@@ -1159,7 +1126,6 @@ struct disk_child {
1159/* PATH STRUCTURES AND DEFINES */ 1126/* PATH STRUCTURES AND DEFINES */
1160/***************************************************************************/ 1127/***************************************************************************/
1161 1128
1162
1163/* Search_by_key fills up the path from the root to the leaf as it descends the tree looking for the 1129/* Search_by_key fills up the path from the root to the leaf as it descends the tree looking for the
1164 key. It uses reiserfs_bread to try to find buffers in the cache given their block number. If it 1130 key. It uses reiserfs_bread to try to find buffers in the cache given their block number. If it
1165 does not find them in the cache it reads them from disk. For each node search_by_key finds using 1131 does not find them in the cache it reads them from disk. For each node search_by_key finds using
@@ -1168,20 +1134,18 @@ struct disk_child {
1168 is looking through a leaf node bin_search will find the position of the item which has key either 1134 is looking through a leaf node bin_search will find the position of the item which has key either
1169 equal to given key, or which is the maximal key less than the given key. */ 1135 equal to given key, or which is the maximal key less than the given key. */
1170 1136
1171struct path_element { 1137struct path_element {
1172 struct buffer_head * pe_buffer; /* Pointer to the buffer at the path in the tree. */ 1138 struct buffer_head *pe_buffer; /* Pointer to the buffer at the path in the tree. */
1173 int pe_position; /* Position in the tree node which is placed in the */ 1139 int pe_position; /* Position in the tree node which is placed in the */
1174 /* buffer above. */ 1140 /* buffer above. */
1175}; 1141};
1176 1142
1177#define MAX_HEIGHT 5 /* maximal height of a tree. don't change this without changing JOURNAL_PER_BALANCE_CNT */ 1143#define MAX_HEIGHT 5 /* maximal height of a tree. don't change this without changing JOURNAL_PER_BALANCE_CNT */
1178#define EXTENDED_MAX_HEIGHT 7 /* Must be equals MAX_HEIGHT + FIRST_PATH_ELEMENT_OFFSET */ 1144#define EXTENDED_MAX_HEIGHT 7 /* Must be equals MAX_HEIGHT + FIRST_PATH_ELEMENT_OFFSET */
1179#define FIRST_PATH_ELEMENT_OFFSET 2 /* Must be equal to at least 2. */ 1145#define FIRST_PATH_ELEMENT_OFFSET 2 /* Must be equal to at least 2. */
1180
1181#define ILLEGAL_PATH_ELEMENT_OFFSET 1 /* Must be equal to FIRST_PATH_ELEMENT_OFFSET - 1 */
1182#define MAX_FEB_SIZE 6 /* this MUST be MAX_HEIGHT + 1. See about FEB below */
1183
1184 1146
1147#define ILLEGAL_PATH_ELEMENT_OFFSET 1 /* Must be equal to FIRST_PATH_ELEMENT_OFFSET - 1 */
1148#define MAX_FEB_SIZE 6 /* this MUST be MAX_HEIGHT + 1. See about FEB below */
1185 1149
1186/* We need to keep track of who the ancestors of nodes are. When we 1150/* We need to keep track of who the ancestors of nodes are. When we
1187 perform a search we record which nodes were visited while 1151 perform a search we record which nodes were visited while
@@ -1200,14 +1164,14 @@ excessive effort to avoid disturbing the precious VFS code.:-( The
1200gods only know how we are going to SMP the code that uses them. 1164gods only know how we are going to SMP the code that uses them.
1201znodes are the way! */ 1165znodes are the way! */
1202 1166
1203#define PATH_READA 0x1 /* do read ahead */ 1167#define PATH_READA 0x1 /* do read ahead */
1204#define PATH_READA_BACK 0x2 /* read backwards */ 1168#define PATH_READA_BACK 0x2 /* read backwards */
1205 1169
1206struct path { 1170struct path {
1207 int path_length; /* Length of the array above. */ 1171 int path_length; /* Length of the array above. */
1208 int reada; 1172 int reada;
1209 struct path_element path_elements[EXTENDED_MAX_HEIGHT]; /* Array of the path elements. */ 1173 struct path_element path_elements[EXTENDED_MAX_HEIGHT]; /* Array of the path elements. */
1210 int pos_in_item; 1174 int pos_in_item;
1211}; 1175};
1212 1176
1213#define pos_in_item(path) ((path)->pos_in_item) 1177#define pos_in_item(path) ((path)->pos_in_item)
@@ -1224,25 +1188,23 @@ struct path var = {.path_length = ILLEGAL_PATH_ELEMENT_OFFSET, .reada = 0,}
1224/* Get position in the element at the path by path and path position. */ 1188/* Get position in the element at the path by path and path position. */
1225#define PATH_OFFSET_POSITION(p_s_path,n_offset) (PATH_OFFSET_PELEMENT(p_s_path,n_offset)->pe_position) 1189#define PATH_OFFSET_POSITION(p_s_path,n_offset) (PATH_OFFSET_PELEMENT(p_s_path,n_offset)->pe_position)
1226 1190
1227
1228#define PATH_PLAST_BUFFER(p_s_path) (PATH_OFFSET_PBUFFER((p_s_path), (p_s_path)->path_length)) 1191#define PATH_PLAST_BUFFER(p_s_path) (PATH_OFFSET_PBUFFER((p_s_path), (p_s_path)->path_length))
1229 /* you know, to the person who didn't 1192 /* you know, to the person who didn't
1230 write this the macro name does not 1193 write this the macro name does not
1231 at first suggest what it does. 1194 at first suggest what it does.
1232 Maybe POSITION_FROM_PATH_END? Or 1195 Maybe POSITION_FROM_PATH_END? Or
1233 maybe we should just focus on 1196 maybe we should just focus on
1234 dumping paths... -Hans */ 1197 dumping paths... -Hans */
1235#define PATH_LAST_POSITION(p_s_path) (PATH_OFFSET_POSITION((p_s_path), (p_s_path)->path_length)) 1198#define PATH_LAST_POSITION(p_s_path) (PATH_OFFSET_POSITION((p_s_path), (p_s_path)->path_length))
1236 1199
1237
1238#define PATH_PITEM_HEAD(p_s_path) B_N_PITEM_HEAD(PATH_PLAST_BUFFER(p_s_path),PATH_LAST_POSITION(p_s_path)) 1200#define PATH_PITEM_HEAD(p_s_path) B_N_PITEM_HEAD(PATH_PLAST_BUFFER(p_s_path),PATH_LAST_POSITION(p_s_path))
1239 1201
1240/* in do_balance leaf has h == 0 in contrast with path structure, 1202/* in do_balance leaf has h == 0 in contrast with path structure,
1241 where root has level == 0. That is why we need these defines */ 1203 where root has level == 0. That is why we need these defines */
1242#define PATH_H_PBUFFER(p_s_path, h) PATH_OFFSET_PBUFFER (p_s_path, p_s_path->path_length - (h)) /* tb->S[h] */ 1204#define PATH_H_PBUFFER(p_s_path, h) PATH_OFFSET_PBUFFER (p_s_path, p_s_path->path_length - (h)) /* tb->S[h] */
1243#define PATH_H_PPARENT(path, h) PATH_H_PBUFFER (path, (h) + 1) /* tb->F[h] or tb->S[0]->b_parent */ 1205#define PATH_H_PPARENT(path, h) PATH_H_PBUFFER (path, (h) + 1) /* tb->F[h] or tb->S[0]->b_parent */
1244#define PATH_H_POSITION(path, h) PATH_OFFSET_POSITION (path, path->path_length - (h)) 1206#define PATH_H_POSITION(path, h) PATH_OFFSET_POSITION (path, path->path_length - (h))
1245#define PATH_H_B_ITEM_ORDER(path, h) PATH_H_POSITION(path, h + 1) /* tb->S[h]->b_item_order */ 1207#define PATH_H_B_ITEM_ORDER(path, h) PATH_H_POSITION(path, h + 1) /* tb->S[h]->b_item_order */
1246 1208
1247#define PATH_H_PATH_OFFSET(p_s_path, n_h) ((p_s_path)->path_length - (n_h)) 1209#define PATH_H_PATH_OFFSET(p_s_path, n_h) ((p_s_path)->path_length - (n_h))
1248 1210
@@ -1253,7 +1215,6 @@ struct path var = {.path_length = ILLEGAL_PATH_ELEMENT_OFFSET, .reada = 0,}
1253#define item_moved(ih,path) comp_items(ih, path) 1215#define item_moved(ih,path) comp_items(ih, path)
1254#define path_changed(ih,path) comp_items (ih, path) 1216#define path_changed(ih,path) comp_items (ih, path)
1255 1217
1256
1257/***************************************************************************/ 1218/***************************************************************************/
1258/* MISC */ 1219/* MISC */
1259/***************************************************************************/ 1220/***************************************************************************/
@@ -1272,30 +1233,26 @@ struct path var = {.path_length = ILLEGAL_PATH_ELEMENT_OFFSET, .reada = 0,}
1272// reiserfs version 2 has max offset 60 bits. Version 1 - 32 bit offset 1233// reiserfs version 2 has max offset 60 bits. Version 1 - 32 bit offset
1273#define U32_MAX (~(__u32)0) 1234#define U32_MAX (~(__u32)0)
1274 1235
1275static inline loff_t max_reiserfs_offset (struct inode * inode) 1236static inline loff_t max_reiserfs_offset(struct inode *inode)
1276{ 1237{
1277 if (get_inode_item_key_version(inode) == KEY_FORMAT_3_5) 1238 if (get_inode_item_key_version(inode) == KEY_FORMAT_3_5)
1278 return (loff_t)U32_MAX; 1239 return (loff_t) U32_MAX;
1279 1240
1280 return (loff_t)((~(__u64)0) >> 4); 1241 return (loff_t) ((~(__u64) 0) >> 4);
1281} 1242}
1282 1243
1283
1284/*#define MAX_KEY_UNIQUENESS MAX_UL_INT*/ 1244/*#define MAX_KEY_UNIQUENESS MAX_UL_INT*/
1285#define MAX_KEY_OBJECTID MAX_UL_INT 1245#define MAX_KEY_OBJECTID MAX_UL_INT
1286 1246
1287
1288#define MAX_B_NUM MAX_UL_INT 1247#define MAX_B_NUM MAX_UL_INT
1289#define MAX_FC_NUM MAX_US_INT 1248#define MAX_FC_NUM MAX_US_INT
1290 1249
1291
1292/* the purpose is to detect overflow of an unsigned short */ 1250/* the purpose is to detect overflow of an unsigned short */
1293#define REISERFS_LINK_MAX (MAX_US_INT - 1000) 1251#define REISERFS_LINK_MAX (MAX_US_INT - 1000)
1294 1252
1295
1296/* The following defines are used in reiserfs_insert_item and reiserfs_append_item */ 1253/* The following defines are used in reiserfs_insert_item and reiserfs_append_item */
1297#define REISERFS_KERNEL_MEM 0 /* reiserfs kernel memory mode */ 1254#define REISERFS_KERNEL_MEM 0 /* reiserfs kernel memory mode */
1298#define REISERFS_USER_MEM 1 /* reiserfs user memory mode */ 1255#define REISERFS_USER_MEM 1 /* reiserfs user memory mode */
1299 1256
1300#define fs_generation(s) (REISERFS_SB(s)->s_generation_counter) 1257#define fs_generation(s) (REISERFS_SB(s)->s_generation_counter)
1301#define get_generation(s) atomic_read (&fs_generation(s)) 1258#define get_generation(s) atomic_read (&fs_generation(s))
@@ -1303,7 +1260,6 @@ static inline loff_t max_reiserfs_offset (struct inode * inode)
1303#define __fs_changed(gen,s) (gen != get_generation (s)) 1260#define __fs_changed(gen,s) (gen != get_generation (s))
1304#define fs_changed(gen,s) ({cond_resched(); __fs_changed(gen, s);}) 1261#define fs_changed(gen,s) ({cond_resched(); __fs_changed(gen, s);})
1305 1262
1306
1307/***************************************************************************/ 1263/***************************************************************************/
1308/* FIXATE NODES */ 1264/* FIXATE NODES */
1309/***************************************************************************/ 1265/***************************************************************************/
@@ -1324,38 +1280,34 @@ static inline loff_t max_reiserfs_offset (struct inode * inode)
1324 calculating what we can shift to neighbors and how many nodes we 1280 calculating what we can shift to neighbors and how many nodes we
1325 have to have if we do not any shiftings, if we shift to left/right 1281 have to have if we do not any shiftings, if we shift to left/right
1326 neighbor or to both. */ 1282 neighbor or to both. */
1327struct virtual_item 1283struct virtual_item {
1328{ 1284 int vi_index; // index in the array of item operations
1329 int vi_index; // index in the array of item operations 1285 unsigned short vi_type; // left/right mergeability
1330 unsigned short vi_type; // left/right mergeability 1286 unsigned short vi_item_len; /* length of item that it will have after balancing */
1331 unsigned short vi_item_len; /* length of item that it will have after balancing */ 1287 struct item_head *vi_ih;
1332 struct item_head * vi_ih; 1288 const char *vi_item; // body of item (old or new)
1333 const char * vi_item; // body of item (old or new) 1289 const void *vi_new_data; // 0 always but paste mode
1334 const void * vi_new_data; // 0 always but paste mode 1290 void *vi_uarea; // item specific area
1335 void * vi_uarea; // item specific area
1336}; 1291};
1337 1292
1338 1293struct virtual_node {
1339struct virtual_node 1294 char *vn_free_ptr; /* this is a pointer to the free space in the buffer */
1340{ 1295 unsigned short vn_nr_item; /* number of items in virtual node */
1341 char * vn_free_ptr; /* this is a pointer to the free space in the buffer */ 1296 short vn_size; /* size of node , that node would have if it has unlimited size and no balancing is performed */
1342 unsigned short vn_nr_item; /* number of items in virtual node */ 1297 short vn_mode; /* mode of balancing (paste, insert, delete, cut) */
1343 short vn_size; /* size of node , that node would have if it has unlimited size and no balancing is performed */ 1298 short vn_affected_item_num;
1344 short vn_mode; /* mode of balancing (paste, insert, delete, cut) */ 1299 short vn_pos_in_item;
1345 short vn_affected_item_num; 1300 struct item_head *vn_ins_ih; /* item header of inserted item, 0 for other modes */
1346 short vn_pos_in_item; 1301 const void *vn_data;
1347 struct item_head * vn_ins_ih; /* item header of inserted item, 0 for other modes */ 1302 struct virtual_item *vn_vi; /* array of items (including a new one, excluding item to be deleted) */
1348 const void * vn_data;
1349 struct virtual_item * vn_vi; /* array of items (including a new one, excluding item to be deleted) */
1350}; 1303};
1351 1304
1352/* used by directory items when creating virtual nodes */ 1305/* used by directory items when creating virtual nodes */
1353struct direntry_uarea { 1306struct direntry_uarea {
1354 int flags; 1307 int flags;
1355 __u16 entry_count; 1308 __u16 entry_count;
1356 __u16 entry_sizes[1]; 1309 __u16 entry_sizes[1];
1357} __attribute__ ((__packed__)) ; 1310} __attribute__ ((__packed__));
1358
1359 1311
1360/***************************************************************************/ 1312/***************************************************************************/
1361/* TREE BALANCE */ 1313/* TREE BALANCE */
@@ -1378,73 +1330,72 @@ struct direntry_uarea {
1378#define MAX_AMOUNT_NEEDED 2 1330#define MAX_AMOUNT_NEEDED 2
1379 1331
1380/* someday somebody will prefix every field in this struct with tb_ */ 1332/* someday somebody will prefix every field in this struct with tb_ */
1381struct tree_balance 1333struct tree_balance {
1382{ 1334 int tb_mode;
1383 int tb_mode; 1335 int need_balance_dirty;
1384 int need_balance_dirty; 1336 struct super_block *tb_sb;
1385 struct super_block * tb_sb; 1337 struct reiserfs_transaction_handle *transaction_handle;
1386 struct reiserfs_transaction_handle *transaction_handle ; 1338 struct path *tb_path;
1387 struct path * tb_path; 1339 struct buffer_head *L[MAX_HEIGHT]; /* array of left neighbors of nodes in the path */
1388 struct buffer_head * L[MAX_HEIGHT]; /* array of left neighbors of nodes in the path */ 1340 struct buffer_head *R[MAX_HEIGHT]; /* array of right neighbors of nodes in the path */
1389 struct buffer_head * R[MAX_HEIGHT]; /* array of right neighbors of nodes in the path*/ 1341 struct buffer_head *FL[MAX_HEIGHT]; /* array of fathers of the left neighbors */
1390 struct buffer_head * FL[MAX_HEIGHT]; /* array of fathers of the left neighbors */ 1342 struct buffer_head *FR[MAX_HEIGHT]; /* array of fathers of the right neighbors */
1391 struct buffer_head * FR[MAX_HEIGHT]; /* array of fathers of the right neighbors */ 1343 struct buffer_head *CFL[MAX_HEIGHT]; /* array of common parents of center node and its left neighbor */
1392 struct buffer_head * CFL[MAX_HEIGHT]; /* array of common parents of center node and its left neighbor */ 1344 struct buffer_head *CFR[MAX_HEIGHT]; /* array of common parents of center node and its right neighbor */
1393 struct buffer_head * CFR[MAX_HEIGHT]; /* array of common parents of center node and its right neighbor */ 1345
1394 1346 struct buffer_head *FEB[MAX_FEB_SIZE]; /* array of empty buffers. Number of buffers in array equals
1395 struct buffer_head * FEB[MAX_FEB_SIZE]; /* array of empty buffers. Number of buffers in array equals 1347 cur_blknum. */
1396 cur_blknum. */ 1348 struct buffer_head *used[MAX_FEB_SIZE];
1397 struct buffer_head * used[MAX_FEB_SIZE]; 1349 struct buffer_head *thrown[MAX_FEB_SIZE];
1398 struct buffer_head * thrown[MAX_FEB_SIZE]; 1350 int lnum[MAX_HEIGHT]; /* array of number of items which must be
1399 int lnum[MAX_HEIGHT]; /* array of number of items which must be 1351 shifted to the left in order to balance the
1400 shifted to the left in order to balance the 1352 current node; for leaves includes item that
1401 current node; for leaves includes item that 1353 will be partially shifted; for internal
1402 will be partially shifted; for internal 1354 nodes, it is the number of child pointers
1403 nodes, it is the number of child pointers 1355 rather than items. It includes the new item
1404 rather than items. It includes the new item 1356 being created. The code sometimes subtracts
1405 being created. The code sometimes subtracts 1357 one to get the number of wholly shifted
1406 one to get the number of wholly shifted 1358 items for other purposes. */
1407 items for other purposes. */ 1359 int rnum[MAX_HEIGHT]; /* substitute right for left in comment above */
1408 int rnum[MAX_HEIGHT]; /* substitute right for left in comment above */ 1360 int lkey[MAX_HEIGHT]; /* array indexed by height h mapping the key delimiting L[h] and
1409 int lkey[MAX_HEIGHT]; /* array indexed by height h mapping the key delimiting L[h] and 1361 S[h] to its item number within the node CFL[h] */
1410 S[h] to its item number within the node CFL[h] */ 1362 int rkey[MAX_HEIGHT]; /* substitute r for l in comment above */
1411 int rkey[MAX_HEIGHT]; /* substitute r for l in comment above */ 1363 int insert_size[MAX_HEIGHT]; /* the number of bytes by we are trying to add or remove from
1412 int insert_size[MAX_HEIGHT]; /* the number of bytes by we are trying to add or remove from 1364 S[h]. A negative value means removing. */
1413 S[h]. A negative value means removing. */ 1365 int blknum[MAX_HEIGHT]; /* number of nodes that will replace node S[h] after
1414 int blknum[MAX_HEIGHT]; /* number of nodes that will replace node S[h] after 1366 balancing on the level h of the tree. If 0 then S is
1415 balancing on the level h of the tree. If 0 then S is 1367 being deleted, if 1 then S is remaining and no new nodes
1416 being deleted, if 1 then S is remaining and no new nodes 1368 are being created, if 2 or 3 then 1 or 2 new nodes is
1417 are being created, if 2 or 3 then 1 or 2 new nodes is 1369 being created */
1418 being created */ 1370
1419 1371 /* fields that are used only for balancing leaves of the tree */
1420 /* fields that are used only for balancing leaves of the tree */ 1372 int cur_blknum; /* number of empty blocks having been already allocated */
1421 int cur_blknum; /* number of empty blocks having been already allocated */ 1373 int s0num; /* number of items that fall into left most node when S[0] splits */
1422 int s0num; /* number of items that fall into left most node when S[0] splits */ 1374 int s1num; /* number of items that fall into first new node when S[0] splits */
1423 int s1num; /* number of items that fall into first new node when S[0] splits */ 1375 int s2num; /* number of items that fall into second new node when S[0] splits */
1424 int s2num; /* number of items that fall into second new node when S[0] splits */ 1376 int lbytes; /* number of bytes which can flow to the left neighbor from the left */
1425 int lbytes; /* number of bytes which can flow to the left neighbor from the left */ 1377 /* most liquid item that cannot be shifted from S[0] entirely */
1426 /* most liquid item that cannot be shifted from S[0] entirely */ 1378 /* if -1 then nothing will be partially shifted */
1427 /* if -1 then nothing will be partially shifted */ 1379 int rbytes; /* number of bytes which will flow to the right neighbor from the right */
1428 int rbytes; /* number of bytes which will flow to the right neighbor from the right */ 1380 /* most liquid item that cannot be shifted from S[0] entirely */
1429 /* most liquid item that cannot be shifted from S[0] entirely */ 1381 /* if -1 then nothing will be partially shifted */
1430 /* if -1 then nothing will be partially shifted */ 1382 int s1bytes; /* number of bytes which flow to the first new node when S[0] splits */
1431 int s1bytes; /* number of bytes which flow to the first new node when S[0] splits */ 1383 /* note: if S[0] splits into 3 nodes, then items do not need to be cut */
1432 /* note: if S[0] splits into 3 nodes, then items do not need to be cut */ 1384 int s2bytes;
1433 int s2bytes; 1385 struct buffer_head *buf_to_free[MAX_FREE_BLOCK]; /* buffers which are to be freed after do_balance finishes by unfix_nodes */
1434 struct buffer_head * buf_to_free[MAX_FREE_BLOCK]; /* buffers which are to be freed after do_balance finishes by unfix_nodes */ 1386 char *vn_buf; /* kmalloced memory. Used to create
1435 char * vn_buf; /* kmalloced memory. Used to create
1436 virtual node and keep map of 1387 virtual node and keep map of
1437 dirtied bitmap blocks */ 1388 dirtied bitmap blocks */
1438 int vn_buf_size; /* size of the vn_buf */ 1389 int vn_buf_size; /* size of the vn_buf */
1439 struct virtual_node * tb_vn; /* VN starts after bitmap of bitmap blocks */ 1390 struct virtual_node *tb_vn; /* VN starts after bitmap of bitmap blocks */
1440 1391
1441 int fs_gen; /* saved value of `reiserfs_generation' counter 1392 int fs_gen; /* saved value of `reiserfs_generation' counter
1442 see FILESYSTEM_CHANGED() macro in reiserfs_fs.h */ 1393 see FILESYSTEM_CHANGED() macro in reiserfs_fs.h */
1443#ifdef DISPLACE_NEW_PACKING_LOCALITIES 1394#ifdef DISPLACE_NEW_PACKING_LOCALITIES
1444 struct in_core_key key; /* key pointer, to pass to block allocator or 1395 struct in_core_key key; /* key pointer, to pass to block allocator or
1445 another low-level subsystem */ 1396 another low-level subsystem */
1446#endif 1397#endif
1447} ; 1398};
1448 1399
1449/* These are modes of balancing */ 1400/* These are modes of balancing */
1450 1401
@@ -1479,13 +1430,12 @@ struct tree_balance
1479/* used in do_balance for passing parent of node information that has 1430/* used in do_balance for passing parent of node information that has
1480 been gotten from tb struct */ 1431 been gotten from tb struct */
1481struct buffer_info { 1432struct buffer_info {
1482 struct tree_balance * tb; 1433 struct tree_balance *tb;
1483 struct buffer_head * bi_bh; 1434 struct buffer_head *bi_bh;
1484 struct buffer_head * bi_parent; 1435 struct buffer_head *bi_parent;
1485 int bi_position; 1436 int bi_position;
1486}; 1437};
1487 1438
1488
1489/* there are 4 types of items: stat data, directory item, indirect, direct. 1439/* there are 4 types of items: stat data, directory item, indirect, direct.
1490+-------------------+------------+--------------+------------+ 1440+-------------------+------------+--------------+------------+
1491| | k_offset | k_uniqueness | mergeable? | 1441| | k_offset | k_uniqueness | mergeable? |
@@ -1503,24 +1453,24 @@ struct buffer_info {
1503*/ 1453*/
1504 1454
1505struct item_operations { 1455struct item_operations {
1506 int (*bytes_number) (struct item_head * ih, int block_size); 1456 int (*bytes_number) (struct item_head * ih, int block_size);
1507 void (*decrement_key) (struct cpu_key *); 1457 void (*decrement_key) (struct cpu_key *);
1508 int (*is_left_mergeable) (struct reiserfs_key * ih, unsigned long bsize); 1458 int (*is_left_mergeable) (struct reiserfs_key * ih,
1509 void (*print_item) (struct item_head *, char * item); 1459 unsigned long bsize);
1510 void (*check_item) (struct item_head *, char * item); 1460 void (*print_item) (struct item_head *, char *item);
1511 1461 void (*check_item) (struct item_head *, char *item);
1512 int (*create_vi) (struct virtual_node * vn, struct virtual_item * vi, 1462
1513 int is_affected, int insert_size); 1463 int (*create_vi) (struct virtual_node * vn, struct virtual_item * vi,
1514 int (*check_left) (struct virtual_item * vi, int free, 1464 int is_affected, int insert_size);
1515 int start_skip, int end_skip); 1465 int (*check_left) (struct virtual_item * vi, int free,
1516 int (*check_right) (struct virtual_item * vi, int free); 1466 int start_skip, int end_skip);
1517 int (*part_size) (struct virtual_item * vi, int from, int to); 1467 int (*check_right) (struct virtual_item * vi, int free);
1518 int (*unit_num) (struct virtual_item * vi); 1468 int (*part_size) (struct virtual_item * vi, int from, int to);
1519 void (*print_vi) (struct virtual_item * vi); 1469 int (*unit_num) (struct virtual_item * vi);
1470 void (*print_vi) (struct virtual_item * vi);
1520}; 1471};
1521 1472
1522 1473extern struct item_operations *item_ops[TYPE_ANY + 1];
1523extern struct item_operations * item_ops [TYPE_ANY + 1];
1524 1474
1525#define op_bytes_number(ih,bsize) item_ops[le_ih_k_type (ih)]->bytes_number (ih, bsize) 1475#define op_bytes_number(ih,bsize) item_ops[le_ih_k_type (ih)]->bytes_number (ih, bsize)
1526#define op_is_left_mergeable(key,bsize) item_ops[le_key_k_type (le_key_version (key), key)]->is_left_mergeable (key, bsize) 1476#define op_is_left_mergeable(key,bsize) item_ops[le_key_k_type (le_key_version (key), key)]->is_left_mergeable (key, bsize)
@@ -1533,8 +1483,6 @@ extern struct item_operations * item_ops [TYPE_ANY + 1];
1533#define op_unit_num(vi) item_ops[(vi)->vi_index]->unit_num (vi) 1483#define op_unit_num(vi) item_ops[(vi)->vi_index]->unit_num (vi)
1534#define op_print_vi(vi) item_ops[(vi)->vi_index]->print_vi (vi) 1484#define op_print_vi(vi) item_ops[(vi)->vi_index]->print_vi (vi)
1535 1485
1536
1537
1538#define COMP_SHORT_KEYS comp_short_keys 1486#define COMP_SHORT_KEYS comp_short_keys
1539 1487
1540/* number of blocks pointed to by the indirect item */ 1488/* number of blocks pointed to by the indirect item */
@@ -1545,8 +1493,7 @@ extern struct item_operations * item_ops [TYPE_ANY + 1];
1545 1493
1546/* number of bytes contained by the direct item or the unformatted nodes the indirect item points to */ 1494/* number of bytes contained by the direct item or the unformatted nodes the indirect item points to */
1547 1495
1548 1496/* get the item header */
1549/* get the item header */
1550#define B_N_PITEM_HEAD(bh,item_num) ( (struct item_head * )((bh)->b_data + BLKH_SIZE) + (item_num) ) 1497#define B_N_PITEM_HEAD(bh,item_num) ( (struct item_head * )((bh)->b_data + BLKH_SIZE) + (item_num) )
1551 1498
1552/* get key */ 1499/* get key */
@@ -1577,9 +1524,9 @@ extern struct item_operations * item_ops [TYPE_ANY + 1];
1577#define PUT_B_I_POS_UNFM_POINTER(bh,ih,pos, val) do {*(((unp_t *)B_I_PITEM(bh,ih)) + (pos)) = cpu_to_le32(val); } while (0) 1524#define PUT_B_I_POS_UNFM_POINTER(bh,ih,pos, val) do {*(((unp_t *)B_I_PITEM(bh,ih)) + (pos)) = cpu_to_le32(val); } while (0)
1578 1525
1579struct reiserfs_iget_args { 1526struct reiserfs_iget_args {
1580 __u32 objectid ; 1527 __u32 objectid;
1581 __u32 dirid ; 1528 __u32 dirid;
1582} ; 1529};
1583 1530
1584/***************************************************************************/ 1531/***************************************************************************/
1585/* FUNCTION DECLARATIONS */ 1532/* FUNCTION DECLARATIONS */
@@ -1595,11 +1542,11 @@ struct reiserfs_iget_args {
1595 1542
1596/* first block written in a commit. */ 1543/* first block written in a commit. */
1597struct reiserfs_journal_desc { 1544struct reiserfs_journal_desc {
1598 __le32 j_trans_id ; /* id of commit */ 1545 __le32 j_trans_id; /* id of commit */
1599 __le32 j_len ; /* length of commit. len +1 is the commit block */ 1546 __le32 j_len; /* length of commit. len +1 is the commit block */
1600 __le32 j_mount_id ; /* mount id of this trans*/ 1547 __le32 j_mount_id; /* mount id of this trans */
1601 __le32 j_realblock[1] ; /* real locations for each block */ 1548 __le32 j_realblock[1]; /* real locations for each block */
1602} ; 1549};
1603 1550
1604#define get_desc_trans_id(d) le32_to_cpu((d)->j_trans_id) 1551#define get_desc_trans_id(d) le32_to_cpu((d)->j_trans_id)
1605#define get_desc_trans_len(d) le32_to_cpu((d)->j_len) 1552#define get_desc_trans_len(d) le32_to_cpu((d)->j_len)
@@ -1611,10 +1558,10 @@ struct reiserfs_journal_desc {
1611 1558
1612/* last block written in a commit */ 1559/* last block written in a commit */
1613struct reiserfs_journal_commit { 1560struct reiserfs_journal_commit {
1614 __le32 j_trans_id ; /* must match j_trans_id from the desc block */ 1561 __le32 j_trans_id; /* must match j_trans_id from the desc block */
1615 __le32 j_len ; /* ditto */ 1562 __le32 j_len; /* ditto */
1616 __le32 j_realblock[1] ; /* real locations for each block */ 1563 __le32 j_realblock[1]; /* real locations for each block */
1617} ; 1564};
1618 1565
1619#define get_commit_trans_id(c) le32_to_cpu((c)->j_trans_id) 1566#define get_commit_trans_id(c) le32_to_cpu((c)->j_trans_id)
1620#define get_commit_trans_len(c) le32_to_cpu((c)->j_len) 1567#define get_commit_trans_len(c) le32_to_cpu((c)->j_len)
@@ -1628,19 +1575,19 @@ struct reiserfs_journal_commit {
1628** and this transaction does not need to be replayed. 1575** and this transaction does not need to be replayed.
1629*/ 1576*/
1630struct reiserfs_journal_header { 1577struct reiserfs_journal_header {
1631 __le32 j_last_flush_trans_id ; /* id of last fully flushed transaction */ 1578 __le32 j_last_flush_trans_id; /* id of last fully flushed transaction */
1632 __le32 j_first_unflushed_offset ; /* offset in the log of where to start replay after a crash */ 1579 __le32 j_first_unflushed_offset; /* offset in the log of where to start replay after a crash */
1633 __le32 j_mount_id ; 1580 __le32 j_mount_id;
1634 /* 12 */ struct journal_params jh_journal; 1581 /* 12 */ struct journal_params jh_journal;
1635} ; 1582};
1636 1583
1637/* biggest tunable defines are right here */ 1584/* biggest tunable defines are right here */
1638#define JOURNAL_BLOCK_COUNT 8192 /* number of blocks in the journal */ 1585#define JOURNAL_BLOCK_COUNT 8192 /* number of blocks in the journal */
1639#define JOURNAL_TRANS_MAX_DEFAULT 1024 /* biggest possible single transaction, don't change for now (8/3/99) */ 1586#define JOURNAL_TRANS_MAX_DEFAULT 1024 /* biggest possible single transaction, don't change for now (8/3/99) */
1640#define JOURNAL_TRANS_MIN_DEFAULT 256 1587#define JOURNAL_TRANS_MIN_DEFAULT 256
1641#define JOURNAL_MAX_BATCH_DEFAULT 900 /* max blocks to batch into one transaction, don't make this any bigger than 900 */ 1588#define JOURNAL_MAX_BATCH_DEFAULT 900 /* max blocks to batch into one transaction, don't make this any bigger than 900 */
1642#define JOURNAL_MIN_RATIO 2 1589#define JOURNAL_MIN_RATIO 2
1643#define JOURNAL_MAX_COMMIT_AGE 30 1590#define JOURNAL_MAX_COMMIT_AGE 30
1644#define JOURNAL_MAX_TRANS_AGE 30 1591#define JOURNAL_MAX_TRANS_AGE 30
1645#define JOURNAL_PER_BALANCE_CNT (3 * (MAX_HEIGHT-2) + 9) 1592#define JOURNAL_PER_BALANCE_CNT (3 * (MAX_HEIGHT-2) + 9)
1646#ifdef CONFIG_QUOTA 1593#ifdef CONFIG_QUOTA
@@ -1664,10 +1611,10 @@ struct reiserfs_journal_header {
1664** the current number of nodes is > max, the node is freed, otherwise, 1611** the current number of nodes is > max, the node is freed, otherwise,
1665** it is put on a free list for faster use later. 1612** it is put on a free list for faster use later.
1666*/ 1613*/
1667#define REISERFS_MIN_BITMAP_NODES 10 1614#define REISERFS_MIN_BITMAP_NODES 10
1668#define REISERFS_MAX_BITMAP_NODES 100 1615#define REISERFS_MAX_BITMAP_NODES 100
1669 1616
1670#define JBH_HASH_SHIFT 13 /* these are based on journal hash size of 8192 */ 1617#define JBH_HASH_SHIFT 13 /* these are based on journal hash size of 8192 */
1671#define JBH_HASH_MASK 8191 1618#define JBH_HASH_MASK 8191
1672 1619
1673#define _jhashfn(sb,block) \ 1620#define _jhashfn(sb,block) \
@@ -1681,14 +1628,14 @@ struct reiserfs_journal_header {
1681#define journal_bread(s, block) __bread(SB_JOURNAL(s)->j_dev_bd, block, s->s_blocksize) 1628#define journal_bread(s, block) __bread(SB_JOURNAL(s)->j_dev_bd, block, s->s_blocksize)
1682 1629
1683enum reiserfs_bh_state_bits { 1630enum reiserfs_bh_state_bits {
1684 BH_JDirty = BH_PrivateStart, /* buffer is in current transaction */ 1631 BH_JDirty = BH_PrivateStart, /* buffer is in current transaction */
1685 BH_JDirty_wait, 1632 BH_JDirty_wait,
1686 BH_JNew, /* disk block was taken off free list before 1633 BH_JNew, /* disk block was taken off free list before
1687 * being in a finished transaction, or 1634 * being in a finished transaction, or
1688 * written to disk. Can be reused immed. */ 1635 * written to disk. Can be reused immed. */
1689 BH_JPrepared, 1636 BH_JPrepared,
1690 BH_JRestore_dirty, 1637 BH_JRestore_dirty,
1691 BH_JTest, // debugging only will go away 1638 BH_JTest, // debugging only will go away
1692}; 1639};
1693 1640
1694BUFFER_FNS(JDirty, journaled); 1641BUFFER_FNS(JDirty, journaled);
@@ -1708,175 +1655,192 @@ TAS_BUFFER_FNS(JTest, journal_test);
1708** transaction handle which is passed around for all journal calls 1655** transaction handle which is passed around for all journal calls
1709*/ 1656*/
1710struct reiserfs_transaction_handle { 1657struct reiserfs_transaction_handle {
1711 struct super_block *t_super ; /* super for this FS when journal_begin was 1658 struct super_block *t_super; /* super for this FS when journal_begin was
1712 called. saves calls to reiserfs_get_super 1659 called. saves calls to reiserfs_get_super
1713 also used by nested transactions to make 1660 also used by nested transactions to make
1714 sure they are nesting on the right FS 1661 sure they are nesting on the right FS
1715 _must_ be first in the handle 1662 _must_ be first in the handle
1716 */ 1663 */
1717 int t_refcount; 1664 int t_refcount;
1718 int t_blocks_logged ; /* number of blocks this writer has logged */ 1665 int t_blocks_logged; /* number of blocks this writer has logged */
1719 int t_blocks_allocated ; /* number of blocks this writer allocated */ 1666 int t_blocks_allocated; /* number of blocks this writer allocated */
1720 unsigned long t_trans_id ; /* sanity check, equals the current trans id */ 1667 unsigned long t_trans_id; /* sanity check, equals the current trans id */
1721 void *t_handle_save ; /* save existing current->journal_info */ 1668 void *t_handle_save; /* save existing current->journal_info */
1722 unsigned displace_new_blocks:1; /* if new block allocation occurres, that block 1669 unsigned displace_new_blocks:1; /* if new block allocation occurres, that block
1723 should be displaced from others */ 1670 should be displaced from others */
1724 struct list_head t_list; 1671 struct list_head t_list;
1725} ; 1672};
1726 1673
1727/* used to keep track of ordered and tail writes, attached to the buffer 1674/* used to keep track of ordered and tail writes, attached to the buffer
1728 * head through b_journal_head. 1675 * head through b_journal_head.
1729 */ 1676 */
1730struct reiserfs_jh { 1677struct reiserfs_jh {
1731 struct reiserfs_journal_list *jl; 1678 struct reiserfs_journal_list *jl;
1732 struct buffer_head *bh; 1679 struct buffer_head *bh;
1733 struct list_head list; 1680 struct list_head list;
1734}; 1681};
1735 1682
1736void reiserfs_free_jh(struct buffer_head *bh); 1683void reiserfs_free_jh(struct buffer_head *bh);
1737int reiserfs_add_tail_list(struct inode *inode, struct buffer_head *bh); 1684int reiserfs_add_tail_list(struct inode *inode, struct buffer_head *bh);
1738int reiserfs_add_ordered_list(struct inode *inode, struct buffer_head *bh); 1685int reiserfs_add_ordered_list(struct inode *inode, struct buffer_head *bh);
1739int journal_mark_dirty(struct reiserfs_transaction_handle *, struct super_block *, struct buffer_head *bh) ; 1686int journal_mark_dirty(struct reiserfs_transaction_handle *,
1740 1687 struct super_block *, struct buffer_head *bh);
1741static inline int 1688
1742reiserfs_file_data_log(struct inode *inode) { 1689static inline int reiserfs_file_data_log(struct inode *inode)
1743 if (reiserfs_data_log(inode->i_sb) || 1690{
1744 (REISERFS_I(inode)->i_flags & i_data_log)) 1691 if (reiserfs_data_log(inode->i_sb) ||
1745 return 1 ; 1692 (REISERFS_I(inode)->i_flags & i_data_log))
1746 return 0 ; 1693 return 1;
1694 return 0;
1747} 1695}
1748 1696
1749static inline int reiserfs_transaction_running(struct super_block *s) { 1697static inline int reiserfs_transaction_running(struct super_block *s)
1750 struct reiserfs_transaction_handle *th = current->journal_info ; 1698{
1751 if (th && th->t_super == s) 1699 struct reiserfs_transaction_handle *th = current->journal_info;
1752 return 1 ; 1700 if (th && th->t_super == s)
1753 if (th && th->t_super == NULL) 1701 return 1;
1754 BUG(); 1702 if (th && th->t_super == NULL)
1755 return 0 ; 1703 BUG();
1704 return 0;
1756} 1705}
1757 1706
1758int reiserfs_async_progress_wait(struct super_block *s); 1707int reiserfs_async_progress_wait(struct super_block *s);
1759 1708
1760struct reiserfs_transaction_handle * 1709struct reiserfs_transaction_handle *reiserfs_persistent_transaction(struct
1761reiserfs_persistent_transaction(struct super_block *, int count); 1710 super_block
1711 *,
1712 int count);
1762int reiserfs_end_persistent_transaction(struct reiserfs_transaction_handle *); 1713int reiserfs_end_persistent_transaction(struct reiserfs_transaction_handle *);
1763int reiserfs_commit_page(struct inode *inode, struct page *page, 1714int reiserfs_commit_page(struct inode *inode, struct page *page,
1764 unsigned from, unsigned to); 1715 unsigned from, unsigned to);
1765int reiserfs_flush_old_commits(struct super_block *); 1716int reiserfs_flush_old_commits(struct super_block *);
1766int reiserfs_commit_for_inode(struct inode *) ; 1717int reiserfs_commit_for_inode(struct inode *);
1767int reiserfs_inode_needs_commit(struct inode *) ; 1718int reiserfs_inode_needs_commit(struct inode *);
1768void reiserfs_update_inode_transaction(struct inode *) ; 1719void reiserfs_update_inode_transaction(struct inode *);
1769void reiserfs_wait_on_write_block(struct super_block *s) ; 1720void reiserfs_wait_on_write_block(struct super_block *s);
1770void reiserfs_block_writes(struct reiserfs_transaction_handle *th) ; 1721void reiserfs_block_writes(struct reiserfs_transaction_handle *th);
1771void reiserfs_allow_writes(struct super_block *s) ; 1722void reiserfs_allow_writes(struct super_block *s);
1772void reiserfs_check_lock_depth(struct super_block *s, char *caller) ; 1723void reiserfs_check_lock_depth(struct super_block *s, char *caller);
1773int reiserfs_prepare_for_journal(struct super_block *, struct buffer_head *bh, int wait) ; 1724int reiserfs_prepare_for_journal(struct super_block *, struct buffer_head *bh,
1774void reiserfs_restore_prepared_buffer(struct super_block *, struct buffer_head *bh) ; 1725 int wait);
1775int journal_init(struct super_block *, const char * j_dev_name, int old_format, unsigned int) ; 1726void reiserfs_restore_prepared_buffer(struct super_block *,
1776int journal_release(struct reiserfs_transaction_handle*, struct super_block *) ; 1727 struct buffer_head *bh);
1777int journal_release_error(struct reiserfs_transaction_handle*, struct super_block *) ; 1728int journal_init(struct super_block *, const char *j_dev_name, int old_format,
1778int journal_end(struct reiserfs_transaction_handle *, struct super_block *, unsigned long) ; 1729 unsigned int);
1779int journal_end_sync(struct reiserfs_transaction_handle *, struct super_block *, unsigned long) ; 1730int journal_release(struct reiserfs_transaction_handle *, struct super_block *);
1780int journal_mark_freed(struct reiserfs_transaction_handle *, struct super_block *, b_blocknr_t blocknr) ; 1731int journal_release_error(struct reiserfs_transaction_handle *,
1781int journal_transaction_should_end(struct reiserfs_transaction_handle *, int) ; 1732 struct super_block *);
1782int reiserfs_in_journal(struct super_block *p_s_sb, int bmap_nr, int bit_nr, int searchall, b_blocknr_t *next) ; 1733int journal_end(struct reiserfs_transaction_handle *, struct super_block *,
1783int journal_begin(struct reiserfs_transaction_handle *, struct super_block *p_s_sb, unsigned long) ; 1734 unsigned long);
1784int journal_join_abort(struct reiserfs_transaction_handle *, struct super_block *p_s_sb, unsigned long) ; 1735int journal_end_sync(struct reiserfs_transaction_handle *, struct super_block *,
1785void reiserfs_journal_abort (struct super_block *sb, int errno); 1736 unsigned long);
1786void reiserfs_abort (struct super_block *sb, int errno, const char *fmt, ...); 1737int journal_mark_freed(struct reiserfs_transaction_handle *,
1787int reiserfs_allocate_list_bitmaps(struct super_block *s, struct reiserfs_list_bitmap *, int) ; 1738 struct super_block *, b_blocknr_t blocknr);
1788 1739int journal_transaction_should_end(struct reiserfs_transaction_handle *, int);
1789void add_save_link (struct reiserfs_transaction_handle * th, 1740int reiserfs_in_journal(struct super_block *p_s_sb, int bmap_nr, int bit_nr,
1790 struct inode * inode, int truncate); 1741 int searchall, b_blocknr_t * next);
1791int remove_save_link (struct inode * inode, int truncate); 1742int journal_begin(struct reiserfs_transaction_handle *,
1743 struct super_block *p_s_sb, unsigned long);
1744int journal_join_abort(struct reiserfs_transaction_handle *,
1745 struct super_block *p_s_sb, unsigned long);
1746void reiserfs_journal_abort(struct super_block *sb, int errno);
1747void reiserfs_abort(struct super_block *sb, int errno, const char *fmt, ...);
1748int reiserfs_allocate_list_bitmaps(struct super_block *s,
1749 struct reiserfs_list_bitmap *, int);
1750
1751void add_save_link(struct reiserfs_transaction_handle *th,
1752 struct inode *inode, int truncate);
1753int remove_save_link(struct inode *inode, int truncate);
1792 1754
1793/* objectid.c */ 1755/* objectid.c */
1794__u32 reiserfs_get_unused_objectid (struct reiserfs_transaction_handle *th); 1756__u32 reiserfs_get_unused_objectid(struct reiserfs_transaction_handle *th);
1795void reiserfs_release_objectid (struct reiserfs_transaction_handle *th, __u32 objectid_to_release); 1757void reiserfs_release_objectid(struct reiserfs_transaction_handle *th,
1796int reiserfs_convert_objectid_map_v1(struct super_block *) ; 1758 __u32 objectid_to_release);
1759int reiserfs_convert_objectid_map_v1(struct super_block *);
1797 1760
1798/* stree.c */ 1761/* stree.c */
1799int B_IS_IN_TREE(const struct buffer_head *); 1762int B_IS_IN_TREE(const struct buffer_head *);
1800extern void copy_item_head(struct item_head * p_v_to, 1763extern void copy_item_head(struct item_head *p_v_to,
1801 const struct item_head * p_v_from); 1764 const struct item_head *p_v_from);
1802 1765
1803// first key is in cpu form, second - le 1766// first key is in cpu form, second - le
1804extern int comp_short_keys (const struct reiserfs_key * le_key, 1767extern int comp_short_keys(const struct reiserfs_key *le_key,
1805 const struct cpu_key * cpu_key); 1768 const struct cpu_key *cpu_key);
1806extern void le_key2cpu_key (struct cpu_key * to, const struct reiserfs_key * from); 1769extern void le_key2cpu_key(struct cpu_key *to, const struct reiserfs_key *from);
1807 1770
1808// both are in le form 1771// both are in le form
1809extern int comp_le_keys (const struct reiserfs_key *, const struct reiserfs_key *); 1772extern int comp_le_keys(const struct reiserfs_key *,
1810extern int comp_short_le_keys (const struct reiserfs_key *, const struct reiserfs_key *); 1773 const struct reiserfs_key *);
1774extern int comp_short_le_keys(const struct reiserfs_key *,
1775 const struct reiserfs_key *);
1811 1776
1812// 1777//
1813// get key version from on disk key - kludge 1778// get key version from on disk key - kludge
1814// 1779//
1815static inline int le_key_version (const struct reiserfs_key * key) 1780static inline int le_key_version(const struct reiserfs_key *key)
1816{ 1781{
1817 int type; 1782 int type;
1818
1819 type = offset_v2_k_type( &(key->u.k_offset_v2));
1820 if (type != TYPE_DIRECT && type != TYPE_INDIRECT && type != TYPE_DIRENTRY)
1821 return KEY_FORMAT_3_5;
1822
1823 return KEY_FORMAT_3_6;
1824
1825}
1826 1783
1784 type = offset_v2_k_type(&(key->u.k_offset_v2));
1785 if (type != TYPE_DIRECT && type != TYPE_INDIRECT
1786 && type != TYPE_DIRENTRY)
1787 return KEY_FORMAT_3_5;
1788
1789 return KEY_FORMAT_3_6;
1827 1790
1828static inline void copy_key (struct reiserfs_key *to, const struct reiserfs_key *from)
1829{
1830 memcpy (to, from, KEY_SIZE);
1831} 1791}
1832 1792
1793static inline void copy_key(struct reiserfs_key *to,
1794 const struct reiserfs_key *from)
1795{
1796 memcpy(to, from, KEY_SIZE);
1797}
1833 1798
1834int comp_items (const struct item_head * stored_ih, const struct path * p_s_path); 1799int comp_items(const struct item_head *stored_ih, const struct path *p_s_path);
1835const struct reiserfs_key * get_rkey (const struct path * p_s_chk_path, 1800const struct reiserfs_key *get_rkey(const struct path *p_s_chk_path,
1836 const struct super_block * p_s_sb); 1801 const struct super_block *p_s_sb);
1837int search_by_key (struct super_block *, const struct cpu_key *, 1802int search_by_key(struct super_block *, const struct cpu_key *,
1838 struct path *, int); 1803 struct path *, int);
1839#define search_item(s,key,path) search_by_key (s, key, path, DISK_LEAF_NODE_LEVEL) 1804#define search_item(s,key,path) search_by_key (s, key, path, DISK_LEAF_NODE_LEVEL)
1840int search_for_position_by_key (struct super_block * p_s_sb, 1805int search_for_position_by_key(struct super_block *p_s_sb,
1841 const struct cpu_key * p_s_cpu_key, 1806 const struct cpu_key *p_s_cpu_key,
1842 struct path * p_s_search_path); 1807 struct path *p_s_search_path);
1843extern void decrement_bcount (struct buffer_head * p_s_bh); 1808extern void decrement_bcount(struct buffer_head *p_s_bh);
1844void decrement_counters_in_path (struct path * p_s_search_path); 1809void decrement_counters_in_path(struct path *p_s_search_path);
1845void pathrelse (struct path * p_s_search_path); 1810void pathrelse(struct path *p_s_search_path);
1846int reiserfs_check_path(struct path *p) ; 1811int reiserfs_check_path(struct path *p);
1847void pathrelse_and_restore (struct super_block *s, struct path * p_s_search_path); 1812void pathrelse_and_restore(struct super_block *s, struct path *p_s_search_path);
1848 1813
1849int reiserfs_insert_item (struct reiserfs_transaction_handle *th, 1814int reiserfs_insert_item(struct reiserfs_transaction_handle *th,
1850 struct path * path, 1815 struct path *path,
1851 const struct cpu_key * key, 1816 const struct cpu_key *key,
1852 struct item_head * ih, 1817 struct item_head *ih,
1853 struct inode *inode, const char * body); 1818 struct inode *inode, const char *body);
1854 1819
1855int reiserfs_paste_into_item (struct reiserfs_transaction_handle *th, 1820int reiserfs_paste_into_item(struct reiserfs_transaction_handle *th,
1856 struct path * path, 1821 struct path *path,
1857 const struct cpu_key * key, 1822 const struct cpu_key *key,
1858 struct inode *inode, 1823 struct inode *inode,
1859 const char * body, int paste_size); 1824 const char *body, int paste_size);
1860 1825
1861int reiserfs_cut_from_item (struct reiserfs_transaction_handle *th, 1826int reiserfs_cut_from_item(struct reiserfs_transaction_handle *th,
1862 struct path * path, 1827 struct path *path,
1863 struct cpu_key * key, 1828 struct cpu_key *key,
1864 struct inode * inode, 1829 struct inode *inode,
1865 struct page *page, 1830 struct page *page, loff_t new_file_size);
1866 loff_t new_file_size); 1831
1867 1832int reiserfs_delete_item(struct reiserfs_transaction_handle *th,
1868int reiserfs_delete_item (struct reiserfs_transaction_handle *th, 1833 struct path *path,
1869 struct path * path, 1834 const struct cpu_key *key,
1870 const struct cpu_key * key, 1835 struct inode *inode, struct buffer_head *p_s_un_bh);
1871 struct inode * inode, 1836
1872 struct buffer_head * p_s_un_bh); 1837void reiserfs_delete_solid_item(struct reiserfs_transaction_handle *th,
1873 1838 struct inode *inode, struct reiserfs_key *key);
1874void reiserfs_delete_solid_item (struct reiserfs_transaction_handle *th, 1839int reiserfs_delete_object(struct reiserfs_transaction_handle *th,
1875 struct inode *inode, struct reiserfs_key * key); 1840 struct inode *p_s_inode);
1876int reiserfs_delete_object (struct reiserfs_transaction_handle *th, struct inode * p_s_inode); 1841int reiserfs_do_truncate(struct reiserfs_transaction_handle *th,
1877int reiserfs_do_truncate (struct reiserfs_transaction_handle *th, 1842 struct inode *p_s_inode, struct page *,
1878 struct inode * p_s_inode, struct page *, 1843 int update_timestamps);
1879 int update_timestamps);
1880 1844
1881#define i_block_size(inode) ((inode)->i_sb->s_blocksize) 1845#define i_block_size(inode) ((inode)->i_sb->s_blocksize)
1882#define file_size(inode) ((inode)->i_size) 1846#define file_size(inode) ((inode)->i_size)
@@ -1885,66 +1849,67 @@ int reiserfs_do_truncate (struct reiserfs_transaction_handle *th,
1885#define tail_has_to_be_packed(inode) (have_large_tails ((inode)->i_sb)?\ 1849#define tail_has_to_be_packed(inode) (have_large_tails ((inode)->i_sb)?\
1886!STORE_TAIL_IN_UNFM_S1(file_size (inode), tail_size(inode), inode->i_sb->s_blocksize):have_small_tails ((inode)->i_sb)?!STORE_TAIL_IN_UNFM_S2(file_size (inode), tail_size(inode), inode->i_sb->s_blocksize):0 ) 1850!STORE_TAIL_IN_UNFM_S1(file_size (inode), tail_size(inode), inode->i_sb->s_blocksize):have_small_tails ((inode)->i_sb)?!STORE_TAIL_IN_UNFM_S2(file_size (inode), tail_size(inode), inode->i_sb->s_blocksize):0 )
1887 1851
1888void padd_item (char * item, int total_length, int length); 1852void padd_item(char *item, int total_length, int length);
1889 1853
1890/* inode.c */ 1854/* inode.c */
1891/* args for the create parameter of reiserfs_get_block */ 1855/* args for the create parameter of reiserfs_get_block */
1892#define GET_BLOCK_NO_CREATE 0 /* don't create new blocks or convert tails */ 1856#define GET_BLOCK_NO_CREATE 0 /* don't create new blocks or convert tails */
1893#define GET_BLOCK_CREATE 1 /* add anything you need to find block */ 1857#define GET_BLOCK_CREATE 1 /* add anything you need to find block */
1894#define GET_BLOCK_NO_HOLE 2 /* return -ENOENT for file holes */ 1858#define GET_BLOCK_NO_HOLE 2 /* return -ENOENT for file holes */
1895#define GET_BLOCK_READ_DIRECT 4 /* read the tail if indirect item not found */ 1859#define GET_BLOCK_READ_DIRECT 4 /* read the tail if indirect item not found */
1896#define GET_BLOCK_NO_ISEM 8 /* i_sem is not held, don't preallocate */ 1860#define GET_BLOCK_NO_ISEM 8 /* i_sem is not held, don't preallocate */
1897#define GET_BLOCK_NO_DANGLE 16 /* don't leave any transactions running */ 1861#define GET_BLOCK_NO_DANGLE 16 /* don't leave any transactions running */
1898 1862
1899int restart_transaction(struct reiserfs_transaction_handle *th, struct inode *inode, struct path *path); 1863int restart_transaction(struct reiserfs_transaction_handle *th,
1900void reiserfs_read_locked_inode(struct inode * inode, struct reiserfs_iget_args *args) ; 1864 struct inode *inode, struct path *path);
1901int reiserfs_find_actor(struct inode * inode, void *p) ; 1865void reiserfs_read_locked_inode(struct inode *inode,
1902int reiserfs_init_locked_inode(struct inode * inode, void *p) ; 1866 struct reiserfs_iget_args *args);
1903void reiserfs_delete_inode (struct inode * inode); 1867int reiserfs_find_actor(struct inode *inode, void *p);
1904int reiserfs_write_inode (struct inode * inode, int) ; 1868int reiserfs_init_locked_inode(struct inode *inode, void *p);
1905int reiserfs_get_block (struct inode * inode, sector_t block, struct buffer_head * bh_result, int create); 1869void reiserfs_delete_inode(struct inode *inode);
1906struct dentry *reiserfs_get_dentry(struct super_block *, void *) ; 1870int reiserfs_write_inode(struct inode *inode, int);
1907struct dentry *reiserfs_decode_fh(struct super_block *sb, __u32 *data, 1871int reiserfs_get_block(struct inode *inode, sector_t block,
1908 int len, int fhtype, 1872 struct buffer_head *bh_result, int create);
1909 int (*acceptable)(void *contect, struct dentry *de), 1873struct dentry *reiserfs_get_dentry(struct super_block *, void *);
1910 void *context) ; 1874struct dentry *reiserfs_decode_fh(struct super_block *sb, __u32 * data,
1911int reiserfs_encode_fh( struct dentry *dentry, __u32 *data, int *lenp, 1875 int len, int fhtype,
1912 int connectable ); 1876 int (*acceptable) (void *contect,
1913 1877 struct dentry * de),
1914int reiserfs_truncate_file(struct inode *, int update_timestamps) ; 1878 void *context);
1915void make_cpu_key (struct cpu_key * cpu_key, struct inode * inode, loff_t offset, 1879int reiserfs_encode_fh(struct dentry *dentry, __u32 * data, int *lenp,
1916 int type, int key_length); 1880 int connectable);
1917void make_le_item_head (struct item_head * ih, const struct cpu_key * key, 1881
1918 int version, 1882int reiserfs_truncate_file(struct inode *, int update_timestamps);
1919 loff_t offset, int type, int length, int entry_count); 1883void make_cpu_key(struct cpu_key *cpu_key, struct inode *inode, loff_t offset,
1920struct inode * reiserfs_iget (struct super_block * s, 1884 int type, int key_length);
1921 const struct cpu_key * key); 1885void make_le_item_head(struct item_head *ih, const struct cpu_key *key,
1922 1886 int version,
1923 1887 loff_t offset, int type, int length, int entry_count);
1924int reiserfs_new_inode (struct reiserfs_transaction_handle *th, 1888struct inode *reiserfs_iget(struct super_block *s, const struct cpu_key *key);
1925 struct inode * dir, int mode, 1889
1926 const char * symname, loff_t i_size, 1890int reiserfs_new_inode(struct reiserfs_transaction_handle *th,
1927 struct dentry *dentry, struct inode *inode); 1891 struct inode *dir, int mode,
1928 1892 const char *symname, loff_t i_size,
1929void reiserfs_update_sd_size (struct reiserfs_transaction_handle *th, 1893 struct dentry *dentry, struct inode *inode);
1930 struct inode * inode, loff_t size); 1894
1895void reiserfs_update_sd_size(struct reiserfs_transaction_handle *th,
1896 struct inode *inode, loff_t size);
1931 1897
1932static inline void reiserfs_update_sd(struct reiserfs_transaction_handle *th, 1898static inline void reiserfs_update_sd(struct reiserfs_transaction_handle *th,
1933 struct inode *inode) 1899 struct inode *inode)
1934{ 1900{
1935 reiserfs_update_sd_size(th, inode, inode->i_size) ; 1901 reiserfs_update_sd_size(th, inode, inode->i_size);
1936} 1902}
1937 1903
1938void sd_attrs_to_i_attrs( __u16 sd_attrs, struct inode *inode ); 1904void sd_attrs_to_i_attrs(__u16 sd_attrs, struct inode *inode);
1939void i_attrs_to_sd_attrs( struct inode *inode, __u16 *sd_attrs ); 1905void i_attrs_to_sd_attrs(struct inode *inode, __u16 * sd_attrs);
1940int reiserfs_setattr(struct dentry *dentry, struct iattr *attr); 1906int reiserfs_setattr(struct dentry *dentry, struct iattr *attr);
1941 1907
1942/* namei.c */ 1908/* namei.c */
1943void set_de_name_and_namelen (struct reiserfs_dir_entry * de); 1909void set_de_name_and_namelen(struct reiserfs_dir_entry *de);
1944int search_by_entry_key (struct super_block * sb, const struct cpu_key * key, 1910int search_by_entry_key(struct super_block *sb, const struct cpu_key *key,
1945 struct path * path, 1911 struct path *path, struct reiserfs_dir_entry *de);
1946 struct reiserfs_dir_entry * de); 1912struct dentry *reiserfs_get_parent(struct dentry *);
1947struct dentry *reiserfs_get_parent(struct dentry *) ;
1948/* procfs.c */ 1913/* procfs.c */
1949 1914
1950#if defined( CONFIG_PROC_FS ) && defined( CONFIG_REISERFS_PROC_INFO ) 1915#if defined( CONFIG_PROC_FS ) && defined( CONFIG_REISERFS_PROC_INFO )
@@ -1953,15 +1918,15 @@ struct dentry *reiserfs_get_parent(struct dentry *) ;
1953#undef REISERFS_PROC_INFO 1918#undef REISERFS_PROC_INFO
1954#endif 1919#endif
1955 1920
1956int reiserfs_proc_info_init( struct super_block *sb ); 1921int reiserfs_proc_info_init(struct super_block *sb);
1957int reiserfs_proc_info_done( struct super_block *sb ); 1922int reiserfs_proc_info_done(struct super_block *sb);
1958struct proc_dir_entry *reiserfs_proc_register_global( char *name, 1923struct proc_dir_entry *reiserfs_proc_register_global(char *name,
1959 read_proc_t *func ); 1924 read_proc_t * func);
1960void reiserfs_proc_unregister_global( const char *name ); 1925void reiserfs_proc_unregister_global(const char *name);
1961int reiserfs_proc_info_global_init( void ); 1926int reiserfs_proc_info_global_init(void);
1962int reiserfs_proc_info_global_done( void ); 1927int reiserfs_proc_info_global_done(void);
1963int reiserfs_global_version_in_proc( char *buffer, char **start, off_t offset, 1928int reiserfs_global_version_in_proc(char *buffer, char **start, off_t offset,
1964 int count, int *eof, void *data ); 1929 int count, int *eof, void *data);
1965 1930
1966#if defined( REISERFS_PROC_INFO ) 1931#if defined( REISERFS_PROC_INFO )
1967 1932
@@ -1993,123 +1958,132 @@ extern struct inode_operations reiserfs_special_inode_operations;
1993extern struct file_operations reiserfs_dir_operations; 1958extern struct file_operations reiserfs_dir_operations;
1994 1959
1995/* tail_conversion.c */ 1960/* tail_conversion.c */
1996int direct2indirect (struct reiserfs_transaction_handle *, struct inode *, struct path *, struct buffer_head *, loff_t); 1961int direct2indirect(struct reiserfs_transaction_handle *, struct inode *,
1997int indirect2direct (struct reiserfs_transaction_handle *, struct inode *, struct page *, struct path *, const struct cpu_key *, loff_t, char *); 1962 struct path *, struct buffer_head *, loff_t);
1998void reiserfs_unmap_buffer(struct buffer_head *) ; 1963int indirect2direct(struct reiserfs_transaction_handle *, struct inode *,
1999 1964 struct page *, struct path *, const struct cpu_key *,
1965 loff_t, char *);
1966void reiserfs_unmap_buffer(struct buffer_head *);
2000 1967
2001/* file.c */ 1968/* file.c */
2002extern struct inode_operations reiserfs_file_inode_operations; 1969extern struct inode_operations reiserfs_file_inode_operations;
2003extern struct file_operations reiserfs_file_operations; 1970extern struct file_operations reiserfs_file_operations;
2004extern struct address_space_operations reiserfs_address_space_operations ; 1971extern struct address_space_operations reiserfs_address_space_operations;
2005 1972
2006/* fix_nodes.c */ 1973/* fix_nodes.c */
2007#ifdef CONFIG_REISERFS_CHECK 1974#ifdef CONFIG_REISERFS_CHECK
2008void * reiserfs_kmalloc (size_t size, int flags, struct super_block * s); 1975void *reiserfs_kmalloc(size_t size, int flags, struct super_block *s);
2009void reiserfs_kfree (const void * vp, size_t size, struct super_block * s); 1976void reiserfs_kfree(const void *vp, size_t size, struct super_block *s);
2010#else 1977#else
2011static inline void *reiserfs_kmalloc(size_t size, int flags, 1978static inline void *reiserfs_kmalloc(size_t size, int flags,
2012 struct super_block *s) 1979 struct super_block *s)
2013{ 1980{
2014 return kmalloc(size, flags); 1981 return kmalloc(size, flags);
2015} 1982}
2016 1983
2017static inline void reiserfs_kfree(const void *vp, size_t size, 1984static inline void reiserfs_kfree(const void *vp, size_t size,
2018 struct super_block *s) 1985 struct super_block *s)
2019{ 1986{
2020 kfree(vp); 1987 kfree(vp);
2021} 1988}
2022#endif 1989#endif
2023 1990
2024int fix_nodes (int n_op_mode, struct tree_balance * p_s_tb, 1991int fix_nodes(int n_op_mode, struct tree_balance *p_s_tb,
2025 struct item_head * p_s_ins_ih, const void *); 1992 struct item_head *p_s_ins_ih, const void *);
2026void unfix_nodes (struct tree_balance *); 1993void unfix_nodes(struct tree_balance *);
2027
2028 1994
2029/* prints.c */ 1995/* prints.c */
2030void reiserfs_panic (struct super_block * s, const char * fmt, ...) __attribute__ ( ( noreturn ) ); 1996void reiserfs_panic(struct super_block *s, const char *fmt, ...)
2031void reiserfs_info (struct super_block *s, const char * fmt, ...); 1997 __attribute__ ((noreturn));
2032void reiserfs_debug (struct super_block *s, int level, const char * fmt, ...); 1998void reiserfs_info(struct super_block *s, const char *fmt, ...);
2033void print_indirect_item (struct buffer_head * bh, int item_num); 1999void reiserfs_debug(struct super_block *s, int level, const char *fmt, ...);
2034void store_print_tb (struct tree_balance * tb); 2000void print_indirect_item(struct buffer_head *bh, int item_num);
2035void print_cur_tb (char * mes); 2001void store_print_tb(struct tree_balance *tb);
2036void print_de (struct reiserfs_dir_entry * de); 2002void print_cur_tb(char *mes);
2037void print_bi (struct buffer_info * bi, char * mes); 2003void print_de(struct reiserfs_dir_entry *de);
2038#define PRINT_LEAF_ITEMS 1 /* print all items */ 2004void print_bi(struct buffer_info *bi, char *mes);
2039#define PRINT_DIRECTORY_ITEMS 2 /* print directory items */ 2005#define PRINT_LEAF_ITEMS 1 /* print all items */
2040#define PRINT_DIRECT_ITEMS 4 /* print contents of direct items */ 2006#define PRINT_DIRECTORY_ITEMS 2 /* print directory items */
2041void print_block (struct buffer_head * bh, ...); 2007#define PRINT_DIRECT_ITEMS 4 /* print contents of direct items */
2042void print_bmap (struct super_block * s, int silent); 2008void print_block(struct buffer_head *bh, ...);
2043void print_bmap_block (int i, char * data, int size, int silent); 2009void print_bmap(struct super_block *s, int silent);
2010void print_bmap_block(int i, char *data, int size, int silent);
2044/*void print_super_block (struct super_block * s, char * mes);*/ 2011/*void print_super_block (struct super_block * s, char * mes);*/
2045void print_objectid_map (struct super_block * s); 2012void print_objectid_map(struct super_block *s);
2046void print_block_head (struct buffer_head * bh, char * mes); 2013void print_block_head(struct buffer_head *bh, char *mes);
2047void check_leaf (struct buffer_head * bh); 2014void check_leaf(struct buffer_head *bh);
2048void check_internal (struct buffer_head * bh); 2015void check_internal(struct buffer_head *bh);
2049void print_statistics (struct super_block * s); 2016void print_statistics(struct super_block *s);
2050char * reiserfs_hashname(int code); 2017char *reiserfs_hashname(int code);
2051 2018
2052/* lbalance.c */ 2019/* lbalance.c */
2053int leaf_move_items (int shift_mode, struct tree_balance * tb, int mov_num, int mov_bytes, struct buffer_head * Snew); 2020int leaf_move_items(int shift_mode, struct tree_balance *tb, int mov_num,
2054int leaf_shift_left (struct tree_balance * tb, int shift_num, int shift_bytes); 2021 int mov_bytes, struct buffer_head *Snew);
2055int leaf_shift_right (struct tree_balance * tb, int shift_num, int shift_bytes); 2022int leaf_shift_left(struct tree_balance *tb, int shift_num, int shift_bytes);
2056void leaf_delete_items (struct buffer_info * cur_bi, int last_first, int first, int del_num, int del_bytes); 2023int leaf_shift_right(struct tree_balance *tb, int shift_num, int shift_bytes);
2057void leaf_insert_into_buf (struct buffer_info * bi, int before, 2024void leaf_delete_items(struct buffer_info *cur_bi, int last_first, int first,
2058 struct item_head * inserted_item_ih, const char * inserted_item_body, int zeros_number); 2025 int del_num, int del_bytes);
2059void leaf_paste_in_buffer (struct buffer_info * bi, int pasted_item_num, 2026void leaf_insert_into_buf(struct buffer_info *bi, int before,
2060 int pos_in_item, int paste_size, const char * body, int zeros_number); 2027 struct item_head *inserted_item_ih,
2061void leaf_cut_from_buffer (struct buffer_info * bi, int cut_item_num, int pos_in_item, 2028 const char *inserted_item_body, int zeros_number);
2062 int cut_size); 2029void leaf_paste_in_buffer(struct buffer_info *bi, int pasted_item_num,
2063void leaf_paste_entries (struct buffer_head * bh, int item_num, int before, 2030 int pos_in_item, int paste_size, const char *body,
2064 int new_entry_count, struct reiserfs_de_head * new_dehs, const char * records, int paste_size); 2031 int zeros_number);
2032void leaf_cut_from_buffer(struct buffer_info *bi, int cut_item_num,
2033 int pos_in_item, int cut_size);
2034void leaf_paste_entries(struct buffer_head *bh, int item_num, int before,
2035 int new_entry_count, struct reiserfs_de_head *new_dehs,
2036 const char *records, int paste_size);
2065/* ibalance.c */ 2037/* ibalance.c */
2066int balance_internal (struct tree_balance * , int, int, struct item_head * , 2038int balance_internal(struct tree_balance *, int, int, struct item_head *,
2067 struct buffer_head **); 2039 struct buffer_head **);
2068 2040
2069/* do_balance.c */ 2041/* do_balance.c */
2070void do_balance_mark_leaf_dirty (struct tree_balance * tb, 2042void do_balance_mark_leaf_dirty(struct tree_balance *tb,
2071 struct buffer_head * bh, int flag); 2043 struct buffer_head *bh, int flag);
2072#define do_balance_mark_internal_dirty do_balance_mark_leaf_dirty 2044#define do_balance_mark_internal_dirty do_balance_mark_leaf_dirty
2073#define do_balance_mark_sb_dirty do_balance_mark_leaf_dirty 2045#define do_balance_mark_sb_dirty do_balance_mark_leaf_dirty
2074 2046
2075void do_balance (struct tree_balance * tb, struct item_head * ih, 2047void do_balance(struct tree_balance *tb, struct item_head *ih,
2076 const char * body, int flag); 2048 const char *body, int flag);
2077void reiserfs_invalidate_buffer (struct tree_balance * tb, struct buffer_head * bh); 2049void reiserfs_invalidate_buffer(struct tree_balance *tb,
2050 struct buffer_head *bh);
2078 2051
2079int get_left_neighbor_position (struct tree_balance * tb, int h); 2052int get_left_neighbor_position(struct tree_balance *tb, int h);
2080int get_right_neighbor_position (struct tree_balance * tb, int h); 2053int get_right_neighbor_position(struct tree_balance *tb, int h);
2081void replace_key (struct tree_balance * tb, struct buffer_head *, int, struct buffer_head *, int); 2054void replace_key(struct tree_balance *tb, struct buffer_head *, int,
2082void make_empty_node (struct buffer_info *); 2055 struct buffer_head *, int);
2083struct buffer_head * get_FEB (struct tree_balance *); 2056void make_empty_node(struct buffer_info *);
2057struct buffer_head *get_FEB(struct tree_balance *);
2084 2058
2085/* bitmap.c */ 2059/* bitmap.c */
2086 2060
2087/* structure contains hints for block allocator, and it is a container for 2061/* structure contains hints for block allocator, and it is a container for
2088 * arguments, such as node, search path, transaction_handle, etc. */ 2062 * arguments, such as node, search path, transaction_handle, etc. */
2089 struct __reiserfs_blocknr_hint { 2063struct __reiserfs_blocknr_hint {
2090 struct inode * inode; /* inode passed to allocator, if we allocate unf. nodes */ 2064 struct inode *inode; /* inode passed to allocator, if we allocate unf. nodes */
2091 long block; /* file offset, in blocks */ 2065 long block; /* file offset, in blocks */
2092 struct in_core_key key; 2066 struct in_core_key key;
2093 struct path * path; /* search path, used by allocator to deternine search_start by 2067 struct path *path; /* search path, used by allocator to deternine search_start by
2094 * various ways */ 2068 * various ways */
2095 struct reiserfs_transaction_handle * th; /* transaction handle is needed to log super blocks and 2069 struct reiserfs_transaction_handle *th; /* transaction handle is needed to log super blocks and
2096 * bitmap blocks changes */ 2070 * bitmap blocks changes */
2097 b_blocknr_t beg, end; 2071 b_blocknr_t beg, end;
2098 b_blocknr_t search_start; /* a field used to transfer search start value (block number) 2072 b_blocknr_t search_start; /* a field used to transfer search start value (block number)
2099 * between different block allocator procedures 2073 * between different block allocator procedures
2100 * (determine_search_start() and others) */ 2074 * (determine_search_start() and others) */
2101 int prealloc_size; /* is set in determine_prealloc_size() function, used by underlayed 2075 int prealloc_size; /* is set in determine_prealloc_size() function, used by underlayed
2102 * function that do actual allocation */ 2076 * function that do actual allocation */
2103 2077
2104 unsigned formatted_node:1; /* the allocator uses different polices for getting disk space for 2078 unsigned formatted_node:1; /* the allocator uses different polices for getting disk space for
2105 * formatted/unformatted blocks with/without preallocation */ 2079 * formatted/unformatted blocks with/without preallocation */
2106 unsigned preallocate:1; 2080 unsigned preallocate:1;
2107}; 2081};
2108 2082
2109typedef struct __reiserfs_blocknr_hint reiserfs_blocknr_hint_t; 2083typedef struct __reiserfs_blocknr_hint reiserfs_blocknr_hint_t;
2110 2084
2111int reiserfs_parse_alloc_options (struct super_block *, char *); 2085int reiserfs_parse_alloc_options(struct super_block *, char *);
2112void reiserfs_init_alloc_options (struct super_block *s); 2086void reiserfs_init_alloc_options(struct super_block *s);
2113 2087
2114/* 2088/*
2115 * given a directory, this will tell you what packing locality 2089 * given a directory, this will tell you what packing locality
@@ -2118,68 +2092,72 @@ void reiserfs_init_alloc_options (struct super_block *s);
2118 */ 2092 */
2119__le32 reiserfs_choose_packing(struct inode *dir); 2093__le32 reiserfs_choose_packing(struct inode *dir);
2120 2094
2121int is_reusable (struct super_block * s, b_blocknr_t block, int bit_value); 2095int is_reusable(struct super_block *s, b_blocknr_t block, int bit_value);
2122void reiserfs_free_block (struct reiserfs_transaction_handle *th, struct inode *, b_blocknr_t, int for_unformatted); 2096void reiserfs_free_block(struct reiserfs_transaction_handle *th, struct inode *,
2123int reiserfs_allocate_blocknrs(reiserfs_blocknr_hint_t *, b_blocknr_t * , int, int); 2097 b_blocknr_t, int for_unformatted);
2124extern inline int reiserfs_new_form_blocknrs (struct tree_balance * tb, 2098int reiserfs_allocate_blocknrs(reiserfs_blocknr_hint_t *, b_blocknr_t *, int,
2125 b_blocknr_t *new_blocknrs, int amount_needed) 2099 int);
2100extern inline int reiserfs_new_form_blocknrs(struct tree_balance *tb,
2101 b_blocknr_t * new_blocknrs,
2102 int amount_needed)
2126{ 2103{
2127 reiserfs_blocknr_hint_t hint = { 2104 reiserfs_blocknr_hint_t hint = {
2128 .th = tb->transaction_handle, 2105 .th = tb->transaction_handle,
2129 .path = tb->tb_path, 2106 .path = tb->tb_path,
2130 .inode = NULL, 2107 .inode = NULL,
2131 .key = tb->key, 2108 .key = tb->key,
2132 .block = 0, 2109 .block = 0,
2133 .formatted_node = 1 2110 .formatted_node = 1
2134 }; 2111 };
2135 return reiserfs_allocate_blocknrs(&hint, new_blocknrs, amount_needed, 0); 2112 return reiserfs_allocate_blocknrs(&hint, new_blocknrs, amount_needed,
2113 0);
2136} 2114}
2137 2115
2138extern inline int reiserfs_new_unf_blocknrs (struct reiserfs_transaction_handle *th, 2116extern inline int reiserfs_new_unf_blocknrs(struct reiserfs_transaction_handle
2139 struct inode *inode, 2117 *th, struct inode *inode,
2140 b_blocknr_t *new_blocknrs, 2118 b_blocknr_t * new_blocknrs,
2141 struct path * path, long block) 2119 struct path *path, long block)
2142{ 2120{
2143 reiserfs_blocknr_hint_t hint = { 2121 reiserfs_blocknr_hint_t hint = {
2144 .th = th, 2122 .th = th,
2145 .path = path, 2123 .path = path,
2146 .inode = inode, 2124 .inode = inode,
2147 .block = block, 2125 .block = block,
2148 .formatted_node = 0, 2126 .formatted_node = 0,
2149 .preallocate = 0 2127 .preallocate = 0
2150 }; 2128 };
2151 return reiserfs_allocate_blocknrs(&hint, new_blocknrs, 1, 0); 2129 return reiserfs_allocate_blocknrs(&hint, new_blocknrs, 1, 0);
2152} 2130}
2153 2131
2154#ifdef REISERFS_PREALLOCATE 2132#ifdef REISERFS_PREALLOCATE
2155extern inline int reiserfs_new_unf_blocknrs2(struct reiserfs_transaction_handle *th, 2133extern inline int reiserfs_new_unf_blocknrs2(struct reiserfs_transaction_handle
2156 struct inode * inode, 2134 *th, struct inode *inode,
2157 b_blocknr_t *new_blocknrs, 2135 b_blocknr_t * new_blocknrs,
2158 struct path * path, long block) 2136 struct path *path, long block)
2159{ 2137{
2160 reiserfs_blocknr_hint_t hint = { 2138 reiserfs_blocknr_hint_t hint = {
2161 .th = th, 2139 .th = th,
2162 .path = path, 2140 .path = path,
2163 .inode = inode, 2141 .inode = inode,
2164 .block = block, 2142 .block = block,
2165 .formatted_node = 0, 2143 .formatted_node = 0,
2166 .preallocate = 1 2144 .preallocate = 1
2167 }; 2145 };
2168 return reiserfs_allocate_blocknrs(&hint, new_blocknrs, 1, 0); 2146 return reiserfs_allocate_blocknrs(&hint, new_blocknrs, 1, 0);
2169} 2147}
2170 2148
2171void reiserfs_discard_prealloc (struct reiserfs_transaction_handle *th, 2149void reiserfs_discard_prealloc(struct reiserfs_transaction_handle *th,
2172 struct inode * inode); 2150 struct inode *inode);
2173void reiserfs_discard_all_prealloc (struct reiserfs_transaction_handle *th); 2151void reiserfs_discard_all_prealloc(struct reiserfs_transaction_handle *th);
2174#endif 2152#endif
2175void reiserfs_claim_blocks_to_be_allocated( struct super_block *sb, int blocks); 2153void reiserfs_claim_blocks_to_be_allocated(struct super_block *sb, int blocks);
2176void reiserfs_release_claimed_blocks( struct super_block *sb, int blocks); 2154void reiserfs_release_claimed_blocks(struct super_block *sb, int blocks);
2177int reiserfs_can_fit_pages(struct super_block *sb); 2155int reiserfs_can_fit_pages(struct super_block *sb);
2178 2156
2179/* hashes.c */ 2157/* hashes.c */
2180__u32 keyed_hash (const signed char *msg, int len); 2158__u32 keyed_hash(const signed char *msg, int len);
2181__u32 yura_hash (const signed char *msg, int len); 2159__u32 yura_hash(const signed char *msg, int len);
2182__u32 r5_hash (const signed char *msg, int len); 2160__u32 r5_hash(const signed char *msg, int len);
2183 2161
2184/* the ext2 bit routines adjust for big or little endian as 2162/* the ext2 bit routines adjust for big or little endian as
2185** appropriate for the arch, so in our laziness we use them rather 2163** appropriate for the arch, so in our laziness we use them rather
@@ -2199,11 +2177,10 @@ __u32 r5_hash (const signed char *msg, int len);
2199 absolutely safe */ 2177 absolutely safe */
2200#define SPARE_SPACE 500 2178#define SPARE_SPACE 500
2201 2179
2202
2203/* prototypes from ioctl.c */ 2180/* prototypes from ioctl.c */
2204int reiserfs_ioctl (struct inode * inode, struct file * filp, 2181int reiserfs_ioctl(struct inode *inode, struct file *filp,
2205 unsigned int cmd, unsigned long arg); 2182 unsigned int cmd, unsigned long arg);
2206 2183
2207/* ioctl's command */ 2184/* ioctl's command */
2208#define REISERFS_IOC_UNPACK _IOW(0xCD,1,long) 2185#define REISERFS_IOC_UNPACK _IOW(0xCD,1,long)
2209/* define following flags to be the same as in ext2, so that chattr(1), 2186/* define following flags to be the same as in ext2, so that chattr(1),
@@ -2218,10 +2195,8 @@ int reiserfs_ioctl (struct inode * inode, struct file * filp,
2218 would evolve into real per-fs locks */ 2195 would evolve into real per-fs locks */
2219#define reiserfs_write_lock( sb ) lock_kernel() 2196#define reiserfs_write_lock( sb ) lock_kernel()
2220#define reiserfs_write_unlock( sb ) unlock_kernel() 2197#define reiserfs_write_unlock( sb ) unlock_kernel()
2221 2198
2222/* xattr stuff */ 2199/* xattr stuff */
2223#define REISERFS_XATTR_DIR_SEM(s) (REISERFS_SB(s)->xattr_dir_sem) 2200#define REISERFS_XATTR_DIR_SEM(s) (REISERFS_SB(s)->xattr_dir_sem)
2224 2201
2225#endif /* _LINUX_REISER_FS_H */ 2202#endif /* _LINUX_REISER_FS_H */
2226
2227
diff --git a/include/linux/reiserfs_fs_i.h b/include/linux/reiserfs_fs_i.h
index e321eb050d6..149be8d9a0c 100644
--- a/include/linux/reiserfs_fs_i.h
+++ b/include/linux/reiserfs_fs_i.h
@@ -10,54 +10,53 @@ typedef enum {
10 /** this says what format of key do all items (but stat data) of 10 /** this says what format of key do all items (but stat data) of
11 an object have. If this is set, that format is 3.6 otherwise 11 an object have. If this is set, that format is 3.6 otherwise
12 - 3.5 */ 12 - 3.5 */
13 i_item_key_version_mask = 0x0001, 13 i_item_key_version_mask = 0x0001,
14 /** If this is unset, object has 3.5 stat data, otherwise, it has 14 /** If this is unset, object has 3.5 stat data, otherwise, it has
15 3.6 stat data with 64bit size, 32bit nlink etc. */ 15 3.6 stat data with 64bit size, 32bit nlink etc. */
16 i_stat_data_version_mask = 0x0002, 16 i_stat_data_version_mask = 0x0002,
17 /** file might need tail packing on close */ 17 /** file might need tail packing on close */
18 i_pack_on_close_mask = 0x0004, 18 i_pack_on_close_mask = 0x0004,
19 /** don't pack tail of file */ 19 /** don't pack tail of file */
20 i_nopack_mask = 0x0008, 20 i_nopack_mask = 0x0008,
21 /** If those is set, "safe link" was created for this file during 21 /** If those is set, "safe link" was created for this file during
22 truncate or unlink. Safe link is used to avoid leakage of disk 22 truncate or unlink. Safe link is used to avoid leakage of disk
23 space on crash with some files open, but unlinked. */ 23 space on crash with some files open, but unlinked. */
24 i_link_saved_unlink_mask = 0x0010, 24 i_link_saved_unlink_mask = 0x0010,
25 i_link_saved_truncate_mask = 0x0020, 25 i_link_saved_truncate_mask = 0x0020,
26 i_has_xattr_dir = 0x0040, 26 i_has_xattr_dir = 0x0040,
27 i_data_log = 0x0080, 27 i_data_log = 0x0080,
28} reiserfs_inode_flags; 28} reiserfs_inode_flags;
29 29
30
31struct reiserfs_inode_info { 30struct reiserfs_inode_info {
32 __u32 i_key [4];/* key is still 4 32 bit integers */ 31 __u32 i_key[4]; /* key is still 4 32 bit integers */
33 /** transient inode flags that are never stored on disk. Bitmasks 32 /** transient inode flags that are never stored on disk. Bitmasks
34 for this field are defined above. */ 33 for this field are defined above. */
35 __u32 i_flags; 34 __u32 i_flags;
36 35
37 __u32 i_first_direct_byte; // offset of first byte stored in direct item. 36 __u32 i_first_direct_byte; // offset of first byte stored in direct item.
38 37
39 /* copy of persistent inode flags read from sd_attrs. */ 38 /* copy of persistent inode flags read from sd_attrs. */
40 __u32 i_attrs; 39 __u32 i_attrs;
41 40
42 int i_prealloc_block; /* first unused block of a sequence of unused blocks */ 41 int i_prealloc_block; /* first unused block of a sequence of unused blocks */
43 int i_prealloc_count; /* length of that sequence */ 42 int i_prealloc_count; /* length of that sequence */
44 struct list_head i_prealloc_list; /* per-transaction list of inodes which 43 struct list_head i_prealloc_list; /* per-transaction list of inodes which
45 * have preallocated blocks */ 44 * have preallocated blocks */
46 45
47 unsigned new_packing_locality:1; /* new_packig_locality is created; new blocks 46 unsigned new_packing_locality:1; /* new_packig_locality is created; new blocks
48 * for the contents of this directory should be 47 * for the contents of this directory should be
49 * displaced */ 48 * displaced */
50 49
51 /* we use these for fsync or O_SYNC to decide which transaction 50 /* we use these for fsync or O_SYNC to decide which transaction
52 ** needs to be committed in order for this inode to be properly 51 ** needs to be committed in order for this inode to be properly
53 ** flushed */ 52 ** flushed */
54 unsigned long i_trans_id ; 53 unsigned long i_trans_id;
55 struct reiserfs_journal_list *i_jl; 54 struct reiserfs_journal_list *i_jl;
56 55
57 struct posix_acl *i_acl_access; 56 struct posix_acl *i_acl_access;
58 struct posix_acl *i_acl_default; 57 struct posix_acl *i_acl_default;
59 struct rw_semaphore xattr_sem; 58 struct rw_semaphore xattr_sem;
60 struct inode vfs_inode; 59 struct inode vfs_inode;
61}; 60};
62 61
63#endif 62#endif
diff --git a/include/linux/reiserfs_fs_sb.h b/include/linux/reiserfs_fs_sb.h
index 31c709d0fe1..3e68592e52e 100644
--- a/include/linux/reiserfs_fs_sb.h
+++ b/include/linux/reiserfs_fs_sb.h
@@ -10,7 +10,7 @@
10#endif 10#endif
11 11
12typedef enum { 12typedef enum {
13 reiserfs_attrs_cleared = 0x00000001, 13 reiserfs_attrs_cleared = 0x00000001,
14} reiserfs_super_block_flags; 14} reiserfs_super_block_flags;
15 15
16/* struct reiserfs_super_block accessors/mutators 16/* struct reiserfs_super_block accessors/mutators
@@ -61,7 +61,7 @@ typedef enum {
61#define sb_umount_state(sbp) (le16_to_cpu((sbp)->s_v1.s_umount_state)) 61#define sb_umount_state(sbp) (le16_to_cpu((sbp)->s_v1.s_umount_state))
62#define set_sb_umount_state(sbp,v) ((sbp)->s_v1.s_umount_state = cpu_to_le16(v)) 62#define set_sb_umount_state(sbp,v) ((sbp)->s_v1.s_umount_state = cpu_to_le16(v))
63#define sb_fs_state(sbp) (le16_to_cpu((sbp)->s_v1.s_fs_state)) 63#define sb_fs_state(sbp) (le16_to_cpu((sbp)->s_v1.s_fs_state))
64#define set_sb_fs_state(sbp,v) ((sbp)->s_v1.s_fs_state = cpu_to_le16(v)) 64#define set_sb_fs_state(sbp,v) ((sbp)->s_v1.s_fs_state = cpu_to_le16(v))
65#define sb_hash_function_code(sbp) \ 65#define sb_hash_function_code(sbp) \
66 (le32_to_cpu((sbp)->s_v1.s_hash_function_code)) 66 (le32_to_cpu((sbp)->s_v1.s_hash_function_code))
67#define set_sb_hash_function_code(sbp,v) \ 67#define set_sb_hash_function_code(sbp,v) \
@@ -103,10 +103,10 @@ typedef enum {
103 103
104/* don't mess with these for a while */ 104/* don't mess with these for a while */
105 /* we have a node size define somewhere in reiserfs_fs.h. -Hans */ 105 /* we have a node size define somewhere in reiserfs_fs.h. -Hans */
106#define JOURNAL_BLOCK_SIZE 4096 /* BUG gotta get rid of this */ 106#define JOURNAL_BLOCK_SIZE 4096 /* BUG gotta get rid of this */
107#define JOURNAL_MAX_CNODE 1500 /* max cnodes to allocate. */ 107#define JOURNAL_MAX_CNODE 1500 /* max cnodes to allocate. */
108#define JOURNAL_HASH_SIZE 8192 108#define JOURNAL_HASH_SIZE 8192
109#define JOURNAL_NUM_BITMAPS 5 /* number of copies of the bitmaps to have floating. Must be >= 2 */ 109#define JOURNAL_NUM_BITMAPS 5 /* number of copies of the bitmaps to have floating. Must be >= 2 */
110 110
111/* One of these for every block in every transaction 111/* One of these for every block in every transaction
112** Each one is in two hash tables. First, a hash of the current transaction, and after journal_end, a 112** Each one is in two hash tables. First, a hash of the current transaction, and after journal_end, a
@@ -117,27 +117,27 @@ typedef enum {
117** to a given transaction. 117** to a given transaction.
118*/ 118*/
119struct reiserfs_journal_cnode { 119struct reiserfs_journal_cnode {
120 struct buffer_head *bh ; /* real buffer head */ 120 struct buffer_head *bh; /* real buffer head */
121 struct super_block *sb ; /* dev of real buffer head */ 121 struct super_block *sb; /* dev of real buffer head */
122 __u32 blocknr ; /* block number of real buffer head, == 0 when buffer on disk */ 122 __u32 blocknr; /* block number of real buffer head, == 0 when buffer on disk */
123 long state ; 123 long state;
124 struct reiserfs_journal_list *jlist ; /* journal list this cnode lives in */ 124 struct reiserfs_journal_list *jlist; /* journal list this cnode lives in */
125 struct reiserfs_journal_cnode *next ; /* next in transaction list */ 125 struct reiserfs_journal_cnode *next; /* next in transaction list */
126 struct reiserfs_journal_cnode *prev ; /* prev in transaction list */ 126 struct reiserfs_journal_cnode *prev; /* prev in transaction list */
127 struct reiserfs_journal_cnode *hprev ; /* prev in hash list */ 127 struct reiserfs_journal_cnode *hprev; /* prev in hash list */
128 struct reiserfs_journal_cnode *hnext ; /* next in hash list */ 128 struct reiserfs_journal_cnode *hnext; /* next in hash list */
129}; 129};
130 130
131struct reiserfs_bitmap_node { 131struct reiserfs_bitmap_node {
132 int id ; 132 int id;
133 char *data ; 133 char *data;
134 struct list_head list ; 134 struct list_head list;
135} ; 135};
136 136
137struct reiserfs_list_bitmap { 137struct reiserfs_list_bitmap {
138 struct reiserfs_journal_list *journal_list ; 138 struct reiserfs_journal_list *journal_list;
139 struct reiserfs_bitmap_node **bitmaps ; 139 struct reiserfs_bitmap_node **bitmaps;
140} ; 140};
141 141
142/* 142/*
143** one of these for each transaction. The most important part here is the j_realblock. 143** one of these for each transaction. The most important part here is the j_realblock.
@@ -146,273 +146,269 @@ struct reiserfs_list_bitmap {
146** and to make sure every real block in a transaction is on disk before allowing the log area 146** and to make sure every real block in a transaction is on disk before allowing the log area
147** to be overwritten */ 147** to be overwritten */
148struct reiserfs_journal_list { 148struct reiserfs_journal_list {
149 unsigned long j_start ; 149 unsigned long j_start;
150 unsigned long j_state; 150 unsigned long j_state;
151 unsigned long j_len ; 151 unsigned long j_len;
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 semaphore j_commit_lock;
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;
159 struct buffer_head *j_commit_bh ; /* commit buffer head */ 159 struct buffer_head *j_commit_bh; /* commit buffer head */
160 struct reiserfs_journal_cnode *j_realblock ; 160 struct reiserfs_journal_cnode *j_realblock;
161 struct reiserfs_journal_cnode *j_freedlist ; /* list of buffers that were freed during this trans. free each of these on flush */ 161 struct reiserfs_journal_cnode *j_freedlist; /* list of buffers that were freed during this trans. free each of these on flush */
162 /* time ordered list of all active transactions */ 162 /* time ordered list of all active transactions */
163 struct list_head j_list; 163 struct list_head j_list;
164 164
165 /* time ordered list of all transactions we haven't tried to flush yet */ 165 /* time ordered list of all transactions we haven't tried to flush yet */
166 struct list_head j_working_list; 166 struct list_head j_working_list;
167 167
168 /* list of tail conversion targets in need of flush before commit */ 168 /* list of tail conversion targets in need of flush before commit */
169 struct list_head j_tail_bh_list; 169 struct list_head j_tail_bh_list;
170 /* list of data=ordered buffers in need of flush before commit */ 170 /* list of data=ordered buffers in need of flush before commit */
171 struct list_head j_bh_list; 171 struct list_head j_bh_list;
172 int j_refcount; 172 int j_refcount;
173} ; 173};
174 174
175struct reiserfs_journal { 175struct reiserfs_journal {
176 struct buffer_head ** j_ap_blocks ; /* journal blocks on disk */ 176 struct buffer_head **j_ap_blocks; /* journal blocks on disk */
177 struct reiserfs_journal_cnode *j_last ; /* newest journal block */ 177 struct reiserfs_journal_cnode *j_last; /* newest journal block */
178 struct reiserfs_journal_cnode *j_first ; /* oldest journal block. start here for traverse */ 178 struct reiserfs_journal_cnode *j_first; /* oldest journal block. start here for traverse */
179 179
180 struct file *j_dev_file; 180 struct file *j_dev_file;
181 struct block_device *j_dev_bd; 181 struct block_device *j_dev_bd;
182 int j_1st_reserved_block; /* first block on s_dev of reserved area journal */ 182 int j_1st_reserved_block; /* first block on s_dev of reserved area journal */
183 183
184 long j_state ; 184 long j_state;
185 unsigned long j_trans_id ; 185 unsigned long j_trans_id;
186 unsigned long j_mount_id ; 186 unsigned long j_mount_id;
187 unsigned long j_start ; /* start of current waiting commit (index into j_ap_blocks) */ 187 unsigned long j_start; /* start of current waiting commit (index into j_ap_blocks) */
188 unsigned long j_len ; /* lenght of current waiting commit */ 188 unsigned long j_len; /* lenght of current waiting commit */
189 unsigned long j_len_alloc ; /* number of buffers requested by journal_begin() */ 189 unsigned long j_len_alloc; /* number of buffers requested by journal_begin() */
190 atomic_t j_wcount ; /* count of writers for current commit */ 190 atomic_t j_wcount; /* count of writers for current commit */
191 unsigned long j_bcount ; /* batch count. allows turning X transactions into 1 */ 191 unsigned long j_bcount; /* batch count. allows turning X transactions into 1 */
192 unsigned long j_first_unflushed_offset ; /* first unflushed transactions offset */ 192 unsigned long j_first_unflushed_offset; /* first unflushed transactions offset */
193 unsigned long j_last_flush_trans_id ; /* last fully flushed journal timestamp */ 193 unsigned long j_last_flush_trans_id; /* last fully flushed journal timestamp */
194 struct buffer_head *j_header_bh ; 194 struct buffer_head *j_header_bh;
195 195
196 time_t j_trans_start_time ; /* time this transaction started */ 196 time_t j_trans_start_time; /* time this transaction started */
197 struct semaphore j_lock; 197 struct semaphore j_lock;
198 struct semaphore j_flush_sem; 198 struct semaphore j_flush_sem;
199 wait_queue_head_t j_join_wait ; /* wait for current transaction to finish before starting new one */ 199 wait_queue_head_t j_join_wait; /* wait for current transaction to finish before starting new one */
200 atomic_t j_jlock ; /* lock for j_join_wait */ 200 atomic_t j_jlock; /* lock for j_join_wait */
201 int j_list_bitmap_index ; /* number of next list bitmap to use */ 201 int j_list_bitmap_index; /* number of next list bitmap to use */
202 int j_must_wait ; /* no more journal begins allowed. MUST sleep on j_join_wait */ 202 int j_must_wait; /* no more journal begins allowed. MUST sleep on j_join_wait */
203 int j_next_full_flush ; /* next journal_end will flush all journal list */ 203 int j_next_full_flush; /* next journal_end will flush all journal list */
204 int j_next_async_flush ; /* next journal_end will flush all async commits */ 204 int j_next_async_flush; /* next journal_end will flush all async commits */
205 205
206 int j_cnode_used ; /* number of cnodes on the used list */ 206 int j_cnode_used; /* number of cnodes on the used list */
207 int j_cnode_free ; /* number of cnodes on the free list */ 207 int j_cnode_free; /* number of cnodes on the free list */
208 208
209 unsigned int j_trans_max ; /* max number of blocks in a transaction. */ 209 unsigned int j_trans_max; /* max number of blocks in a transaction. */
210 unsigned int j_max_batch ; /* max number of blocks to batch into a trans */ 210 unsigned int j_max_batch; /* max number of blocks to batch into a trans */
211 unsigned int j_max_commit_age ; /* in seconds, how old can an async commit be */ 211 unsigned int j_max_commit_age; /* in seconds, how old can an async commit be */
212 unsigned int j_max_trans_age ; /* in seconds, how old can a transaction be */ 212 unsigned int j_max_trans_age; /* in seconds, how old can a transaction be */
213 unsigned int j_default_max_commit_age ; /* the default for the max commit age */ 213 unsigned int j_default_max_commit_age; /* the default for the max commit age */
214 214
215 struct reiserfs_journal_cnode *j_cnode_free_list ; 215 struct reiserfs_journal_cnode *j_cnode_free_list;
216 struct reiserfs_journal_cnode *j_cnode_free_orig ; /* orig pointer returned from vmalloc */ 216 struct reiserfs_journal_cnode *j_cnode_free_orig; /* orig pointer returned from vmalloc */
217 217
218 struct reiserfs_journal_list *j_current_jl; 218 struct reiserfs_journal_list *j_current_jl;
219 int j_free_bitmap_nodes ; 219 int j_free_bitmap_nodes;
220 int j_used_bitmap_nodes ; 220 int j_used_bitmap_nodes;
221 221
222 int j_num_lists; /* total number of active transactions */ 222 int j_num_lists; /* total number of active transactions */
223 int j_num_work_lists; /* number that need attention from kreiserfsd */ 223 int j_num_work_lists; /* number that need attention from kreiserfsd */
224 224
225 /* debugging to make sure things are flushed in order */ 225 /* debugging to make sure things are flushed in order */
226 int j_last_flush_id; 226 int j_last_flush_id;
227 227
228 /* debugging to make sure things are committed in order */ 228 /* debugging to make sure things are committed in order */
229 int j_last_commit_id; 229 int j_last_commit_id;
230 230
231 struct list_head j_bitmap_nodes ; 231 struct list_head j_bitmap_nodes;
232 struct list_head j_dirty_buffers ; 232 struct list_head j_dirty_buffers;
233 spinlock_t j_dirty_buffers_lock ; /* protects j_dirty_buffers */ 233 spinlock_t j_dirty_buffers_lock; /* protects j_dirty_buffers */
234 234
235 /* list of all active transactions */ 235 /* list of all active transactions */
236 struct list_head j_journal_list; 236 struct list_head j_journal_list;
237 /* lists that haven't been touched by writeback attempts */ 237 /* lists that haven't been touched by writeback attempts */
238 struct list_head j_working_list; 238 struct list_head j_working_list;
239 239
240 struct reiserfs_list_bitmap j_list_bitmap[JOURNAL_NUM_BITMAPS] ; /* array of bitmaps to record the deleted blocks */ 240 struct reiserfs_list_bitmap j_list_bitmap[JOURNAL_NUM_BITMAPS]; /* array of bitmaps to record the deleted blocks */
241 struct reiserfs_journal_cnode *j_hash_table[JOURNAL_HASH_SIZE] ; /* hash table for real buffer heads in current trans */ 241 struct reiserfs_journal_cnode *j_hash_table[JOURNAL_HASH_SIZE]; /* hash table for real buffer heads in current trans */
242 struct reiserfs_journal_cnode *j_list_hash_table[JOURNAL_HASH_SIZE] ; /* hash table for all the real buffer heads in all 242 struct reiserfs_journal_cnode *j_list_hash_table[JOURNAL_HASH_SIZE]; /* hash table for all the real buffer heads in all
243 the transactions */ 243 the transactions */
244 struct list_head j_prealloc_list; /* list of inodes which have preallocated blocks */ 244 struct list_head j_prealloc_list; /* list of inodes which have preallocated blocks */
245 int j_persistent_trans; 245 int j_persistent_trans;
246 unsigned long j_max_trans_size ; 246 unsigned long j_max_trans_size;
247 unsigned long j_max_batch_size ; 247 unsigned long j_max_batch_size;
248 248
249 int j_errno; 249 int j_errno;
250 250
251 /* when flushing ordered buffers, throttle new ordered writers */ 251 /* when flushing ordered buffers, throttle new ordered writers */
252 struct work_struct j_work; 252 struct work_struct j_work;
253 atomic_t j_async_throttle; 253 atomic_t j_async_throttle;
254}; 254};
255 255
256enum journal_state_bits { 256enum journal_state_bits {
257 J_WRITERS_BLOCKED = 1, /* set when new writers not allowed */ 257 J_WRITERS_BLOCKED = 1, /* set when new writers not allowed */
258 J_WRITERS_QUEUED, /* set when log is full due to too many writers */ 258 J_WRITERS_QUEUED, /* set when log is full due to too many writers */
259 J_ABORTED, /* set when log is aborted */ 259 J_ABORTED, /* set when log is aborted */
260}; 260};
261 261
262#define JOURNAL_DESC_MAGIC "ReIsErLB" /* ick. magic string to find desc blocks in the journal */
262 263
263#define JOURNAL_DESC_MAGIC "ReIsErLB" /* ick. magic string to find desc blocks in the journal */ 264typedef __u32(*hashf_t) (const signed char *, int);
264 265
265typedef __u32 (*hashf_t) (const signed char *, int); 266struct reiserfs_bitmap_info {
266 267 // FIXME: Won't work with block sizes > 8K
267struct reiserfs_bitmap_info 268 __u16 first_zero_hint;
268{ 269 __u16 free_count;
269 // FIXME: Won't work with block sizes > 8K 270 struct buffer_head *bh; /* the actual bitmap */
270 __u16 first_zero_hint;
271 __u16 free_count;
272 struct buffer_head *bh; /* the actual bitmap */
273}; 271};
274 272
275struct proc_dir_entry; 273struct proc_dir_entry;
276 274
277#if defined( CONFIG_PROC_FS ) && defined( CONFIG_REISERFS_PROC_INFO ) 275#if defined( CONFIG_PROC_FS ) && defined( CONFIG_REISERFS_PROC_INFO )
278typedef unsigned long int stat_cnt_t; 276typedef unsigned long int stat_cnt_t;
279typedef struct reiserfs_proc_info_data 277typedef struct reiserfs_proc_info_data {
280{ 278 spinlock_t lock;
281 spinlock_t lock; 279 int exiting;
282 int exiting; 280 int max_hash_collisions;
283 int max_hash_collisions; 281
284 282 stat_cnt_t breads;
285 stat_cnt_t breads; 283 stat_cnt_t bread_miss;
286 stat_cnt_t bread_miss; 284 stat_cnt_t search_by_key;
287 stat_cnt_t search_by_key; 285 stat_cnt_t search_by_key_fs_changed;
288 stat_cnt_t search_by_key_fs_changed; 286 stat_cnt_t search_by_key_restarted;
289 stat_cnt_t search_by_key_restarted; 287
290 288 stat_cnt_t insert_item_restarted;
291 stat_cnt_t insert_item_restarted; 289 stat_cnt_t paste_into_item_restarted;
292 stat_cnt_t paste_into_item_restarted; 290 stat_cnt_t cut_from_item_restarted;
293 stat_cnt_t cut_from_item_restarted; 291 stat_cnt_t delete_solid_item_restarted;
294 stat_cnt_t delete_solid_item_restarted; 292 stat_cnt_t delete_item_restarted;
295 stat_cnt_t delete_item_restarted; 293
296 294 stat_cnt_t leaked_oid;
297 stat_cnt_t leaked_oid; 295 stat_cnt_t leaves_removable;
298 stat_cnt_t leaves_removable; 296
299 297 /* balances per level. Use explicit 5 as MAX_HEIGHT is not visible yet. */
300 /* balances per level. Use explicit 5 as MAX_HEIGHT is not visible yet. */ 298 stat_cnt_t balance_at[5]; /* XXX */
301 stat_cnt_t balance_at[ 5 ]; /* XXX */ 299 /* sbk == search_by_key */
302 /* sbk == search_by_key */ 300 stat_cnt_t sbk_read_at[5]; /* XXX */
303 stat_cnt_t sbk_read_at[ 5 ]; /* XXX */ 301 stat_cnt_t sbk_fs_changed[5];
304 stat_cnt_t sbk_fs_changed[ 5 ]; 302 stat_cnt_t sbk_restarted[5];
305 stat_cnt_t sbk_restarted[ 5 ]; 303 stat_cnt_t items_at[5]; /* XXX */
306 stat_cnt_t items_at[ 5 ]; /* XXX */ 304 stat_cnt_t free_at[5]; /* XXX */
307 stat_cnt_t free_at[ 5 ]; /* XXX */ 305 stat_cnt_t can_node_be_removed[5]; /* XXX */
308 stat_cnt_t can_node_be_removed[ 5 ]; /* XXX */ 306 long int lnum[5]; /* XXX */
309 long int lnum[ 5 ]; /* XXX */ 307 long int rnum[5]; /* XXX */
310 long int rnum[ 5 ]; /* XXX */ 308 long int lbytes[5]; /* XXX */
311 long int lbytes[ 5 ]; /* XXX */ 309 long int rbytes[5]; /* XXX */
312 long int rbytes[ 5 ]; /* XXX */ 310 stat_cnt_t get_neighbors[5];
313 stat_cnt_t get_neighbors[ 5 ]; 311 stat_cnt_t get_neighbors_restart[5];
314 stat_cnt_t get_neighbors_restart[ 5 ]; 312 stat_cnt_t need_l_neighbor[5];
315 stat_cnt_t need_l_neighbor[ 5 ]; 313 stat_cnt_t need_r_neighbor[5];
316 stat_cnt_t need_r_neighbor[ 5 ]; 314
317 315 stat_cnt_t free_block;
318 stat_cnt_t free_block; 316 struct __scan_bitmap_stats {
319 struct __scan_bitmap_stats { 317 stat_cnt_t call;
320 stat_cnt_t call; 318 stat_cnt_t wait;
321 stat_cnt_t wait; 319 stat_cnt_t bmap;
322 stat_cnt_t bmap; 320 stat_cnt_t retry;
323 stat_cnt_t retry; 321 stat_cnt_t in_journal_hint;
324 stat_cnt_t in_journal_hint; 322 stat_cnt_t in_journal_nohint;
325 stat_cnt_t in_journal_nohint; 323 stat_cnt_t stolen;
326 stat_cnt_t stolen; 324 } scan_bitmap;
327 } scan_bitmap; 325 struct __journal_stats {
328 struct __journal_stats { 326 stat_cnt_t in_journal;
329 stat_cnt_t in_journal; 327 stat_cnt_t in_journal_bitmap;
330 stat_cnt_t in_journal_bitmap; 328 stat_cnt_t in_journal_reusable;
331 stat_cnt_t in_journal_reusable; 329 stat_cnt_t lock_journal;
332 stat_cnt_t lock_journal; 330 stat_cnt_t lock_journal_wait;
333 stat_cnt_t lock_journal_wait; 331 stat_cnt_t journal_being;
334 stat_cnt_t journal_being; 332 stat_cnt_t journal_relock_writers;
335 stat_cnt_t journal_relock_writers; 333 stat_cnt_t journal_relock_wcount;
336 stat_cnt_t journal_relock_wcount; 334 stat_cnt_t mark_dirty;
337 stat_cnt_t mark_dirty; 335 stat_cnt_t mark_dirty_already;
338 stat_cnt_t mark_dirty_already; 336 stat_cnt_t mark_dirty_notjournal;
339 stat_cnt_t mark_dirty_notjournal; 337 stat_cnt_t restore_prepared;
340 stat_cnt_t restore_prepared; 338 stat_cnt_t prepare;
341 stat_cnt_t prepare; 339 stat_cnt_t prepare_retry;
342 stat_cnt_t prepare_retry; 340 } journal;
343 } journal;
344} reiserfs_proc_info_data_t; 341} reiserfs_proc_info_data_t;
345#else 342#else
346typedef struct reiserfs_proc_info_data 343typedef struct reiserfs_proc_info_data {
347{} reiserfs_proc_info_data_t; 344} reiserfs_proc_info_data_t;
348#endif 345#endif
349 346
350/* reiserfs union of in-core super block data */ 347/* reiserfs union of in-core super block data */
351struct reiserfs_sb_info 348struct reiserfs_sb_info {
352{ 349 struct buffer_head *s_sbh; /* Buffer containing the super block */
353 struct buffer_head * s_sbh; /* Buffer containing the super block */ 350 /* both the comment and the choice of
354 /* both the comment and the choice of 351 name are unclear for s_rs -Hans */
355 name are unclear for s_rs -Hans */ 352 struct reiserfs_super_block *s_rs; /* Pointer to the super block in the buffer */
356 struct reiserfs_super_block * s_rs; /* Pointer to the super block in the buffer */ 353 struct reiserfs_bitmap_info *s_ap_bitmap;
357 struct reiserfs_bitmap_info * s_ap_bitmap; 354 struct reiserfs_journal *s_journal; /* pointer to journal information */
358 struct reiserfs_journal *s_journal ; /* pointer to journal information */ 355 unsigned short s_mount_state; /* reiserfs state (valid, invalid) */
359 unsigned short s_mount_state; /* reiserfs state (valid, invalid) */ 356
360 357 /* Comment? -Hans */
361 /* Comment? -Hans */ 358 void (*end_io_handler) (struct buffer_head *, int);
362 void (*end_io_handler)(struct buffer_head *, int); 359 hashf_t s_hash_function; /* pointer to function which is used
363 hashf_t s_hash_function; /* pointer to function which is used 360 to sort names in directory. Set on
364 to sort names in directory. Set on 361 mount */
365 mount */ 362 unsigned long s_mount_opt; /* reiserfs's mount options are set
366 unsigned long s_mount_opt; /* reiserfs's mount options are set 363 here (currently - NOTAIL, NOLOG,
367 here (currently - NOTAIL, NOLOG, 364 REPLAYONLY) */
368 REPLAYONLY) */ 365
369 366 struct { /* This is a structure that describes block allocator options */
370 struct { /* This is a structure that describes block allocator options */ 367 unsigned long bits; /* Bitfield for enable/disable kind of options */
371 unsigned long bits; /* Bitfield for enable/disable kind of options */ 368 unsigned long large_file_size; /* size started from which we consider file to be a large one(in blocks) */
372 unsigned long large_file_size; /* size started from which we consider file to be a large one(in blocks) */ 369 int border; /* percentage of disk, border takes */
373 int border; /* percentage of disk, border takes */ 370 int preallocmin; /* Minimal file size (in blocks) starting from which we do preallocations */
374 int preallocmin; /* Minimal file size (in blocks) starting from which we do preallocations */ 371 int preallocsize; /* Number of blocks we try to prealloc when file
375 int preallocsize; /* Number of blocks we try to prealloc when file 372 reaches preallocmin size (in blocks) or
376 reaches preallocmin size (in blocks) or 373 prealloc_list is empty. */
377 prealloc_list is empty. */ 374 } s_alloc_options;
378 } s_alloc_options; 375
379 376 /* Comment? -Hans */
380 /* Comment? -Hans */ 377 wait_queue_head_t s_wait;
381 wait_queue_head_t s_wait; 378 /* To be obsoleted soon by per buffer seals.. -Hans */
382 /* To be obsoleted soon by per buffer seals.. -Hans */ 379 atomic_t s_generation_counter; // increased by one every time the
383 atomic_t s_generation_counter; // increased by one every time the 380 // tree gets re-balanced
384 // tree gets re-balanced 381 unsigned long s_properties; /* File system properties. Currently holds
385 unsigned long s_properties; /* File system properties. Currently holds 382 on-disk FS format */
386 on-disk FS format */ 383
387 384 /* session statistics */
388 /* session statistics */ 385 int s_kmallocs;
389 int s_kmallocs; 386 int s_disk_reads;
390 int s_disk_reads; 387 int s_disk_writes;
391 int s_disk_writes; 388 int s_fix_nodes;
392 int s_fix_nodes; 389 int s_do_balance;
393 int s_do_balance; 390 int s_unneeded_left_neighbor;
394 int s_unneeded_left_neighbor; 391 int s_good_search_by_key_reada;
395 int s_good_search_by_key_reada; 392 int s_bmaps;
396 int s_bmaps; 393 int s_bmaps_without_search;
397 int s_bmaps_without_search; 394 int s_direct2indirect;
398 int s_direct2indirect; 395 int s_indirect2direct;
399 int s_indirect2direct;
400 /* set up when it's ok for reiserfs_read_inode2() to read from 396 /* set up when it's ok for reiserfs_read_inode2() to read from
401 disk inode with nlink==0. Currently this is only used during 397 disk inode with nlink==0. Currently this is only used during
402 finish_unfinished() processing at mount time */ 398 finish_unfinished() processing at mount time */
403 int s_is_unlinked_ok; 399 int s_is_unlinked_ok;
404 reiserfs_proc_info_data_t s_proc_info_data; 400 reiserfs_proc_info_data_t s_proc_info_data;
405 struct proc_dir_entry *procdir; 401 struct proc_dir_entry *procdir;
406 int reserved_blocks; /* amount of blocks reserved for further allocations */ 402 int reserved_blocks; /* amount of blocks reserved for further allocations */
407 spinlock_t bitmap_lock; /* this lock on now only used to protect reserved_blocks variable */ 403 spinlock_t bitmap_lock; /* this lock on now only used to protect reserved_blocks variable */
408 struct dentry *priv_root; /* root of /.reiserfs_priv */ 404 struct dentry *priv_root; /* root of /.reiserfs_priv */
409 struct dentry *xattr_root; /* root of /.reiserfs_priv/.xa */ 405 struct dentry *xattr_root; /* root of /.reiserfs_priv/.xa */
410 struct rw_semaphore xattr_dir_sem; 406 struct rw_semaphore xattr_dir_sem;
411 407
412 int j_errno; 408 int j_errno;
413#ifdef CONFIG_QUOTA 409#ifdef CONFIG_QUOTA
414 char *s_qf_names[MAXQUOTAS]; 410 char *s_qf_names[MAXQUOTAS];
415 int s_jquota_fmt; 411 int s_jquota_fmt;
416#endif 412#endif
417}; 413};
418 414
@@ -422,14 +418,14 @@ struct reiserfs_sb_info
422 418
423enum reiserfs_mount_options { 419enum reiserfs_mount_options {
424/* Mount options */ 420/* Mount options */
425 REISERFS_LARGETAIL, /* large tails will be created in a session */ 421 REISERFS_LARGETAIL, /* large tails will be created in a session */
426 REISERFS_SMALLTAIL, /* small (for files less than block size) tails will be created in a session */ 422 REISERFS_SMALLTAIL, /* small (for files less than block size) tails will be created in a session */
427 REPLAYONLY, /* replay journal and return 0. Use by fsck */ 423 REPLAYONLY, /* replay journal and return 0. Use by fsck */
428 REISERFS_CONVERT, /* -o conv: causes conversion of old 424 REISERFS_CONVERT, /* -o conv: causes conversion of old
429 format super block to the new 425 format super block to the new
430 format. If not specified - old 426 format. If not specified - old
431 partition will be dealt with in a 427 partition will be dealt with in a
432 manner of 3.5.x */ 428 manner of 3.5.x */
433 429
434/* -o hash={tea, rupasov, r5, detect} is meant for properly mounting 430/* -o hash={tea, rupasov, r5, detect} is meant for properly mounting
435** reiserfs disks from 3.5.19 or earlier. 99% of the time, this option 431** reiserfs disks from 3.5.19 or earlier. 99% of the time, this option
@@ -439,41 +435,41 @@ enum reiserfs_mount_options {
439** the existing hash on the FS, so if you have a tea hash disk, and mount 435** the existing hash on the FS, so if you have a tea hash disk, and mount
440** with -o hash=rupasov, the mount will fail. 436** with -o hash=rupasov, the mount will fail.
441*/ 437*/
442 FORCE_TEA_HASH, /* try to force tea hash on mount */ 438 FORCE_TEA_HASH, /* try to force tea hash on mount */
443 FORCE_RUPASOV_HASH, /* try to force rupasov hash on mount */ 439 FORCE_RUPASOV_HASH, /* try to force rupasov hash on mount */
444 FORCE_R5_HASH, /* try to force rupasov hash on mount */ 440 FORCE_R5_HASH, /* try to force rupasov hash on mount */
445 FORCE_HASH_DETECT, /* try to detect hash function on mount */ 441 FORCE_HASH_DETECT, /* try to detect hash function on mount */
446 442
447 REISERFS_DATA_LOG, 443 REISERFS_DATA_LOG,
448 REISERFS_DATA_ORDERED, 444 REISERFS_DATA_ORDERED,
449 REISERFS_DATA_WRITEBACK, 445 REISERFS_DATA_WRITEBACK,
450 446
451/* used for testing experimental features, makes benchmarking new 447/* used for testing experimental features, makes benchmarking new
452 features with and without more convenient, should never be used by 448 features with and without more convenient, should never be used by
453 users in any code shipped to users (ideally) */ 449 users in any code shipped to users (ideally) */
454 450
455 REISERFS_NO_BORDER, 451 REISERFS_NO_BORDER,
456 REISERFS_NO_UNHASHED_RELOCATION, 452 REISERFS_NO_UNHASHED_RELOCATION,
457 REISERFS_HASHED_RELOCATION, 453 REISERFS_HASHED_RELOCATION,
458 REISERFS_ATTRS, 454 REISERFS_ATTRS,
459 REISERFS_XATTRS, 455 REISERFS_XATTRS,
460 REISERFS_XATTRS_USER, 456 REISERFS_XATTRS_USER,
461 REISERFS_POSIXACL, 457 REISERFS_POSIXACL,
462 REISERFS_BARRIER_NONE, 458 REISERFS_BARRIER_NONE,
463 REISERFS_BARRIER_FLUSH, 459 REISERFS_BARRIER_FLUSH,
464 460
465 /* Actions on error */ 461 /* Actions on error */
466 REISERFS_ERROR_PANIC, 462 REISERFS_ERROR_PANIC,
467 REISERFS_ERROR_RO, 463 REISERFS_ERROR_RO,
468 REISERFS_ERROR_CONTINUE, 464 REISERFS_ERROR_CONTINUE,
469 465
470 REISERFS_QUOTA, /* Some quota option specified */ 466 REISERFS_QUOTA, /* Some quota option specified */
471 467
472 REISERFS_TEST1, 468 REISERFS_TEST1,
473 REISERFS_TEST2, 469 REISERFS_TEST2,
474 REISERFS_TEST3, 470 REISERFS_TEST3,
475 REISERFS_TEST4, 471 REISERFS_TEST4,
476 REISERFS_UNSUPPORTED_OPT, 472 REISERFS_UNSUPPORTED_OPT,
477}; 473};
478 474
479#define reiserfs_r5_hash(s) (REISERFS_SB(s)->s_mount_opt & (1 << FORCE_R5_HASH)) 475#define reiserfs_r5_hash(s) (REISERFS_SB(s)->s_mount_opt & (1 << FORCE_R5_HASH))
@@ -504,18 +500,17 @@ enum reiserfs_mount_options {
504#define reiserfs_error_panic(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_ERROR_PANIC)) 500#define reiserfs_error_panic(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_ERROR_PANIC))
505#define reiserfs_error_ro(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_ERROR_RO)) 501#define reiserfs_error_ro(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_ERROR_RO))
506 502
507void reiserfs_file_buffer (struct buffer_head * bh, int list); 503void reiserfs_file_buffer(struct buffer_head *bh, int list);
508extern struct file_system_type reiserfs_fs_type; 504extern struct file_system_type reiserfs_fs_type;
509int reiserfs_resize(struct super_block *, unsigned long) ; 505int reiserfs_resize(struct super_block *, unsigned long);
510 506
511#define CARRY_ON 0 507#define CARRY_ON 0
512#define SCHEDULE_OCCURRED 1 508#define SCHEDULE_OCCURRED 1
513 509
514
515#define SB_BUFFER_WITH_SB(s) (REISERFS_SB(s)->s_sbh) 510#define SB_BUFFER_WITH_SB(s) (REISERFS_SB(s)->s_sbh)
516#define SB_JOURNAL(s) (REISERFS_SB(s)->s_journal) 511#define SB_JOURNAL(s) (REISERFS_SB(s)->s_journal)
517#define SB_JOURNAL_1st_RESERVED_BLOCK(s) (SB_JOURNAL(s)->j_1st_reserved_block) 512#define SB_JOURNAL_1st_RESERVED_BLOCK(s) (SB_JOURNAL(s)->j_1st_reserved_block)
518#define SB_JOURNAL_LEN_FREE(s) (SB_JOURNAL(s)->j_journal_len_free) 513#define SB_JOURNAL_LEN_FREE(s) (SB_JOURNAL(s)->j_journal_len_free)
519#define SB_AP_BITMAP(s) (REISERFS_SB(s)->s_ap_bitmap) 514#define SB_AP_BITMAP(s) (REISERFS_SB(s)->s_ap_bitmap)
520 515
521#define SB_DISK_JOURNAL_HEAD(s) (SB_JOURNAL(s)->j_header_bh->) 516#define SB_DISK_JOURNAL_HEAD(s) (SB_JOURNAL(s)->j_header_bh->)
@@ -525,13 +520,14 @@ int reiserfs_resize(struct super_block *, unsigned long) ;
525 */ 520 */
526static inline char *reiserfs_bdevname(struct super_block *s) 521static inline char *reiserfs_bdevname(struct super_block *s)
527{ 522{
528 return (s == NULL) ? "Null superblock" : s -> s_id; 523 return (s == NULL) ? "Null superblock" : s->s_id;
529} 524}
530 525
531#define reiserfs_is_journal_aborted(journal) (unlikely (__reiserfs_is_journal_aborted (journal))) 526#define reiserfs_is_journal_aborted(journal) (unlikely (__reiserfs_is_journal_aborted (journal)))
532static inline int __reiserfs_is_journal_aborted (struct reiserfs_journal *journal) 527static inline int __reiserfs_is_journal_aborted(struct reiserfs_journal
528 *journal)
533{ 529{
534 return test_bit (J_ABORTED, &journal->j_state); 530 return test_bit(J_ABORTED, &journal->j_state);
535} 531}
536 532
537#endif /* _LINUX_REISER_FS_SB */ 533#endif /* _LINUX_REISER_FS_SB */
diff --git a/include/linux/reiserfs_xattr.h b/include/linux/reiserfs_xattr.h
index 9244c574882..c84354e8374 100644
--- a/include/linux/reiserfs_xattr.h
+++ b/include/linux/reiserfs_xattr.h
@@ -7,48 +7,48 @@
7#include <linux/xattr.h> 7#include <linux/xattr.h>
8 8
9/* Magic value in header */ 9/* Magic value in header */
10#define REISERFS_XATTR_MAGIC 0x52465841 /* "RFXA" */ 10#define REISERFS_XATTR_MAGIC 0x52465841 /* "RFXA" */
11 11
12struct reiserfs_xattr_header { 12struct reiserfs_xattr_header {
13 __le32 h_magic; /* magic number for identification */ 13 __le32 h_magic; /* magic number for identification */
14 __le32 h_hash; /* hash of the value */ 14 __le32 h_hash; /* hash of the value */
15}; 15};
16 16
17#ifdef __KERNEL__ 17#ifdef __KERNEL__
18 18
19struct reiserfs_xattr_handler { 19struct reiserfs_xattr_handler {
20 char *prefix; 20 char *prefix;
21 int (*init)(void); 21 int (*init) (void);
22 void (*exit)(void); 22 void (*exit) (void);
23 int (*get)(struct inode *inode, const char *name, void *buffer, 23 int (*get) (struct inode * inode, const char *name, void *buffer,
24 size_t size); 24 size_t size);
25 int (*set)(struct inode *inode, const char *name, const void *buffer, 25 int (*set) (struct inode * inode, const char *name, const void *buffer,
26 size_t size, int flags); 26 size_t size, int flags);
27 int (*del)(struct inode *inode, const char *name); 27 int (*del) (struct inode * inode, const char *name);
28 int (*list)(struct inode *inode, const char *name, int namelen, char *out); 28 int (*list) (struct inode * inode, const char *name, int namelen,
29 struct list_head handlers; 29 char *out);
30 struct list_head handlers;
30}; 31};
31 32
32
33#ifdef CONFIG_REISERFS_FS_XATTR 33#ifdef CONFIG_REISERFS_FS_XATTR
34#define is_reiserfs_priv_object(inode) IS_PRIVATE(inode) 34#define is_reiserfs_priv_object(inode) IS_PRIVATE(inode)
35#define has_xattr_dir(inode) (REISERFS_I(inode)->i_flags & i_has_xattr_dir) 35#define has_xattr_dir(inode) (REISERFS_I(inode)->i_flags & i_has_xattr_dir)
36ssize_t reiserfs_getxattr (struct dentry *dentry, const char *name, 36ssize_t reiserfs_getxattr(struct dentry *dentry, const char *name,
37 void *buffer, size_t size); 37 void *buffer, size_t size);
38int reiserfs_setxattr (struct dentry *dentry, const char *name, 38int reiserfs_setxattr(struct dentry *dentry, const char *name,
39 const void *value, size_t size, int flags); 39 const void *value, size_t size, int flags);
40ssize_t reiserfs_listxattr (struct dentry *dentry, char *buffer, size_t size); 40ssize_t reiserfs_listxattr(struct dentry *dentry, char *buffer, size_t size);
41int reiserfs_removexattr (struct dentry *dentry, const char *name); 41int reiserfs_removexattr(struct dentry *dentry, const char *name);
42int reiserfs_delete_xattrs (struct inode *inode); 42int reiserfs_delete_xattrs(struct inode *inode);
43int reiserfs_chown_xattrs (struct inode *inode, struct iattr *attrs); 43int reiserfs_chown_xattrs(struct inode *inode, struct iattr *attrs);
44int reiserfs_xattr_init (struct super_block *sb, int mount_flags); 44int reiserfs_xattr_init(struct super_block *sb, int mount_flags);
45int reiserfs_permission (struct inode *inode, int mask, struct nameidata *nd); 45int reiserfs_permission(struct inode *inode, int mask, struct nameidata *nd);
46int reiserfs_permission_locked (struct inode *inode, int mask, struct nameidata *nd); 46int reiserfs_permission_locked(struct inode *inode, int mask,
47 47 struct nameidata *nd);
48int reiserfs_xattr_del (struct inode *, const char *); 48
49int reiserfs_xattr_get (const struct inode *, const char *, void *, size_t); 49int reiserfs_xattr_del(struct inode *, const char *);
50int reiserfs_xattr_set (struct inode *, const char *, const void *, 50int reiserfs_xattr_get(const struct inode *, const char *, void *, size_t);
51 size_t, int); 51int reiserfs_xattr_set(struct inode *, const char *, const void *, size_t, int);
52 52
53extern struct reiserfs_xattr_handler user_handler; 53extern struct reiserfs_xattr_handler user_handler;
54extern struct reiserfs_xattr_handler trusted_handler; 54extern struct reiserfs_xattr_handler trusted_handler;
@@ -56,57 +56,48 @@ extern struct reiserfs_xattr_handler trusted_handler;
56extern struct reiserfs_xattr_handler security_handler; 56extern struct reiserfs_xattr_handler security_handler;
57#endif 57#endif
58 58
59int reiserfs_xattr_register_handlers (void) __init; 59int reiserfs_xattr_register_handlers(void) __init;
60void reiserfs_xattr_unregister_handlers (void); 60void reiserfs_xattr_unregister_handlers(void);
61 61
62static inline void 62static inline void reiserfs_write_lock_xattrs(struct super_block *sb)
63reiserfs_write_lock_xattrs(struct super_block *sb)
64{ 63{
65 down_write (&REISERFS_XATTR_DIR_SEM(sb)); 64 down_write(&REISERFS_XATTR_DIR_SEM(sb));
66} 65}
67static inline void 66static inline void reiserfs_write_unlock_xattrs(struct super_block *sb)
68reiserfs_write_unlock_xattrs(struct super_block *sb)
69{ 67{
70 up_write (&REISERFS_XATTR_DIR_SEM(sb)); 68 up_write(&REISERFS_XATTR_DIR_SEM(sb));
71} 69}
72static inline void 70static inline void reiserfs_read_lock_xattrs(struct super_block *sb)
73reiserfs_read_lock_xattrs(struct super_block *sb)
74{ 71{
75 down_read (&REISERFS_XATTR_DIR_SEM(sb)); 72 down_read(&REISERFS_XATTR_DIR_SEM(sb));
76} 73}
77 74
78static inline void 75static inline void reiserfs_read_unlock_xattrs(struct super_block *sb)
79reiserfs_read_unlock_xattrs(struct super_block *sb)
80{ 76{
81 up_read (&REISERFS_XATTR_DIR_SEM(sb)); 77 up_read(&REISERFS_XATTR_DIR_SEM(sb));
82} 78}
83 79
84static inline void 80static inline void reiserfs_write_lock_xattr_i(struct inode *inode)
85reiserfs_write_lock_xattr_i(struct inode *inode)
86{ 81{
87 down_write (&REISERFS_I(inode)->xattr_sem); 82 down_write(&REISERFS_I(inode)->xattr_sem);
88} 83}
89static inline void 84static inline void reiserfs_write_unlock_xattr_i(struct inode *inode)
90reiserfs_write_unlock_xattr_i(struct inode *inode)
91{ 85{
92 up_write (&REISERFS_I(inode)->xattr_sem); 86 up_write(&REISERFS_I(inode)->xattr_sem);
93} 87}
94static inline void 88static inline void reiserfs_read_lock_xattr_i(struct inode *inode)
95reiserfs_read_lock_xattr_i(struct inode *inode)
96{ 89{
97 down_read (&REISERFS_I(inode)->xattr_sem); 90 down_read(&REISERFS_I(inode)->xattr_sem);
98} 91}
99 92
100static inline void 93static inline void reiserfs_read_unlock_xattr_i(struct inode *inode)
101reiserfs_read_unlock_xattr_i(struct inode *inode)
102{ 94{
103 up_read (&REISERFS_I(inode)->xattr_sem); 95 up_read(&REISERFS_I(inode)->xattr_sem);
104} 96}
105 97
106static inline void 98static inline void reiserfs_mark_inode_private(struct inode *inode)
107reiserfs_mark_inode_private(struct inode *inode)
108{ 99{
109 inode->i_flags |= S_PRIVATE; 100 inode->i_flags |= S_PRIVATE;
110} 101}
111 102
112#else 103#else
@@ -127,13 +118,20 @@ reiserfs_mark_inode_private(struct inode *inode)
127#define reiserfs_xattr_register_handlers() 0 118#define reiserfs_xattr_register_handlers() 0
128#define reiserfs_xattr_unregister_handlers() 119#define reiserfs_xattr_unregister_handlers()
129 120
130static inline int reiserfs_delete_xattrs (struct inode *inode) { return 0; }; 121static inline int reiserfs_delete_xattrs(struct inode *inode)
131static inline int reiserfs_chown_xattrs (struct inode *inode, struct iattr *attrs) { return 0; }; 122{
132static inline int reiserfs_xattr_init (struct super_block *sb, int mount_flags) 123 return 0;
124};
125static inline int reiserfs_chown_xattrs(struct inode *inode,
126 struct iattr *attrs)
127{
128 return 0;
129};
130static inline int reiserfs_xattr_init(struct super_block *sb, int mount_flags)
133{ 131{
134 sb->s_flags = (sb->s_flags & ~MS_POSIXACL); /* to be sure */ 132 sb->s_flags = (sb->s_flags & ~MS_POSIXACL); /* to be sure */
135 return 0; 133 return 0;
136}; 134};
137#endif 135#endif
138 136
139#endif /* __KERNEL__ */ 137#endif /* __KERNEL__ */
diff --git a/include/linux/sched.h b/include/linux/sched.h
index ff48815bd3a..dec5827c774 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -410,6 +410,10 @@ struct user_struct {
410 atomic_t processes; /* How many processes does this user have? */ 410 atomic_t processes; /* How many processes does this user have? */
411 atomic_t files; /* How many open files does this user have? */ 411 atomic_t files; /* How many open files does this user have? */
412 atomic_t sigpending; /* How many pending signals does this user have? */ 412 atomic_t sigpending; /* How many pending signals does this user have? */
413#ifdef CONFIG_INOTIFY
414 atomic_t inotify_watches; /* How many inotify watches does this user have? */
415 atomic_t inotify_devs; /* How many inotify devs does this user have opened? */
416#endif
413 /* protected by mq_lock */ 417 /* protected by mq_lock */
414 unsigned long mq_bytes; /* How many bytes can be allocated to mqueue? */ 418 unsigned long mq_bytes; /* How many bytes can be allocated to mqueue? */
415 unsigned long locked_shm; /* How many pages of mlocked shm ? */ 419 unsigned long locked_shm; /* How many pages of mlocked shm ? */
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index 416a2e4024b..5d4a990d557 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -183,7 +183,6 @@ struct skb_shared_info {
183 * @priority: Packet queueing priority 183 * @priority: Packet queueing priority
184 * @users: User count - see {datagram,tcp}.c 184 * @users: User count - see {datagram,tcp}.c
185 * @protocol: Packet protocol from driver 185 * @protocol: Packet protocol from driver
186 * @security: Security level of packet
187 * @truesize: Buffer size 186 * @truesize: Buffer size
188 * @head: Head of buffer 187 * @head: Head of buffer
189 * @data: Data head pointer 188 * @data: Data head pointer
@@ -249,18 +248,18 @@ struct sk_buff {
249 data_len, 248 data_len,
250 mac_len, 249 mac_len,
251 csum; 250 csum;
252 unsigned char local_df,
253 cloned:1,
254 nohdr:1,
255 pkt_type,
256 ip_summed;
257 __u32 priority; 251 __u32 priority;
258 unsigned short protocol, 252 __u8 local_df:1,
259 security; 253 cloned:1,
254 ip_summed:2,
255 nohdr:1;
256 /* 3 bits spare */
257 __u8 pkt_type;
258 __u16 protocol;
260 259
261 void (*destructor)(struct sk_buff *skb); 260 void (*destructor)(struct sk_buff *skb);
262#ifdef CONFIG_NETFILTER 261#ifdef CONFIG_NETFILTER
263 unsigned long nfmark; 262 unsigned long nfmark;
264 __u32 nfcache; 263 __u32 nfcache;
265 __u32 nfctinfo; 264 __u32 nfctinfo;
266 struct nf_conntrack *nfct; 265 struct nf_conntrack *nfct;
@@ -301,20 +300,26 @@ struct sk_buff {
301#include <asm/system.h> 300#include <asm/system.h>
302 301
303extern void __kfree_skb(struct sk_buff *skb); 302extern void __kfree_skb(struct sk_buff *skb);
304extern struct sk_buff *alloc_skb(unsigned int size, int priority); 303extern struct sk_buff *alloc_skb(unsigned int size,
304 unsigned int __nocast priority);
305extern struct sk_buff *alloc_skb_from_cache(kmem_cache_t *cp, 305extern struct sk_buff *alloc_skb_from_cache(kmem_cache_t *cp,
306 unsigned int size, int priority); 306 unsigned int size,
307 unsigned int __nocast priority);
307extern void kfree_skbmem(struct sk_buff *skb); 308extern void kfree_skbmem(struct sk_buff *skb);
308extern struct sk_buff *skb_clone(struct sk_buff *skb, int priority); 309extern struct sk_buff *skb_clone(struct sk_buff *skb,
309extern struct sk_buff *skb_copy(const struct sk_buff *skb, int priority); 310 unsigned int __nocast priority);
310extern struct sk_buff *pskb_copy(struct sk_buff *skb, int gfp_mask); 311extern struct sk_buff *skb_copy(const struct sk_buff *skb,
312 unsigned int __nocast priority);
313extern struct sk_buff *pskb_copy(struct sk_buff *skb,
314 unsigned int __nocast gfp_mask);
311extern int pskb_expand_head(struct sk_buff *skb, 315extern int pskb_expand_head(struct sk_buff *skb,
312 int nhead, int ntail, int gfp_mask); 316 int nhead, int ntail,
317 unsigned int __nocast gfp_mask);
313extern struct sk_buff *skb_realloc_headroom(struct sk_buff *skb, 318extern struct sk_buff *skb_realloc_headroom(struct sk_buff *skb,
314 unsigned int headroom); 319 unsigned int headroom);
315extern struct sk_buff *skb_copy_expand(const struct sk_buff *skb, 320extern struct sk_buff *skb_copy_expand(const struct sk_buff *skb,
316 int newheadroom, int newtailroom, 321 int newheadroom, int newtailroom,
317 int priority); 322 unsigned int __nocast priority);
318extern struct sk_buff * skb_pad(struct sk_buff *skb, int pad); 323extern struct sk_buff * skb_pad(struct sk_buff *skb, int pad);
319#define dev_kfree_skb(a) kfree_skb(a) 324#define dev_kfree_skb(a) kfree_skb(a)
320extern void skb_over_panic(struct sk_buff *skb, int len, 325extern void skb_over_panic(struct sk_buff *skb, int len,
@@ -465,7 +470,8 @@ static inline int skb_shared(const struct sk_buff *skb)
465 * 470 *
466 * NULL is returned on a memory allocation failure. 471 * NULL is returned on a memory allocation failure.
467 */ 472 */
468static inline struct sk_buff *skb_share_check(struct sk_buff *skb, int pri) 473static inline struct sk_buff *skb_share_check(struct sk_buff *skb,
474 unsigned int __nocast pri)
469{ 475{
470 might_sleep_if(pri & __GFP_WAIT); 476 might_sleep_if(pri & __GFP_WAIT);
471 if (skb_shared(skb)) { 477 if (skb_shared(skb)) {
@@ -1002,7 +1008,7 @@ static inline void __skb_queue_purge(struct sk_buff_head *list)
1002 * %NULL is returned in there is no free memory. 1008 * %NULL is returned in there is no free memory.
1003 */ 1009 */
1004static inline struct sk_buff *__dev_alloc_skb(unsigned int length, 1010static inline struct sk_buff *__dev_alloc_skb(unsigned int length,
1005 int gfp_mask) 1011 unsigned int __nocast gfp_mask)
1006{ 1012{
1007 struct sk_buff *skb = alloc_skb(length + 16, gfp_mask); 1013 struct sk_buff *skb = alloc_skb(length + 16, gfp_mask);
1008 if (likely(skb)) 1014 if (likely(skb))
@@ -1115,8 +1121,8 @@ static inline int skb_can_coalesce(struct sk_buff *skb, int i,
1115 * If there is no free memory -ENOMEM is returned, otherwise zero 1121 * If there is no free memory -ENOMEM is returned, otherwise zero
1116 * is returned and the old skb data released. 1122 * is returned and the old skb data released.
1117 */ 1123 */
1118extern int __skb_linearize(struct sk_buff *skb, int gfp); 1124extern int __skb_linearize(struct sk_buff *skb, unsigned int __nocast gfp);
1119static inline int skb_linearize(struct sk_buff *skb, int gfp) 1125static inline int skb_linearize(struct sk_buff *skb, unsigned int __nocast gfp)
1120{ 1126{
1121 return __skb_linearize(skb, gfp); 1127 return __skb_linearize(skb, gfp);
1122} 1128}
@@ -1211,7 +1217,7 @@ static inline void *skb_header_pointer(const struct sk_buff *skb, int offset,
1211{ 1217{
1212 int hlen = skb_headlen(skb); 1218 int hlen = skb_headlen(skb);
1213 1219
1214 if (offset + len <= hlen) 1220 if (hlen - offset >= len)
1215 return skb->data + offset; 1221 return skb->data + offset;
1216 1222
1217 if (skb_copy_bits(skb, offset, buffer, len) < 0) 1223 if (skb_copy_bits(skb, offset, buffer, len) < 0)
diff --git a/include/linux/slab.h b/include/linux/slab.h
index 76cf7e60216..4c8e552471b 100644
--- a/include/linux/slab.h
+++ b/include/linux/slab.h
@@ -65,7 +65,7 @@ extern void *kmem_cache_alloc(kmem_cache_t *, unsigned int __nocast);
65extern void kmem_cache_free(kmem_cache_t *, void *); 65extern void kmem_cache_free(kmem_cache_t *, void *);
66extern unsigned int kmem_cache_size(kmem_cache_t *); 66extern unsigned int kmem_cache_size(kmem_cache_t *);
67extern const char *kmem_cache_name(kmem_cache_t *); 67extern const char *kmem_cache_name(kmem_cache_t *);
68extern kmem_cache_t *kmem_find_general_cachep(size_t size, int gfpflags); 68extern kmem_cache_t *kmem_find_general_cachep(size_t size, unsigned int __nocast gfpflags);
69 69
70/* Size description struct for general caches. */ 70/* Size description struct for general caches. */
71struct cache_sizes { 71struct cache_sizes {
@@ -105,7 +105,7 @@ extern unsigned int ksize(const void *);
105 105
106#ifdef CONFIG_NUMA 106#ifdef CONFIG_NUMA
107extern void *kmem_cache_alloc_node(kmem_cache_t *, int flags, int node); 107extern void *kmem_cache_alloc_node(kmem_cache_t *, int flags, int node);
108extern void *kmalloc_node(size_t size, int flags, int node); 108extern void *kmalloc_node(size_t size, unsigned int __nocast flags, int node);
109#else 109#else
110static inline void *kmem_cache_alloc_node(kmem_cache_t *cachep, int flags, int node) 110static inline void *kmem_cache_alloc_node(kmem_cache_t *cachep, int flags, int node)
111{ 111{
diff --git a/include/linux/string.h b/include/linux/string.h
index 93994c61309..dab2652acbd 100644
--- a/include/linux/string.h
+++ b/include/linux/string.h
@@ -88,7 +88,7 @@ extern int memcmp(const void *,const void *,__kernel_size_t);
88extern void * memchr(const void *,int,__kernel_size_t); 88extern void * memchr(const void *,int,__kernel_size_t);
89#endif 89#endif
90 90
91extern char *kstrdup(const char *s, int gfp); 91extern char *kstrdup(const char *s, unsigned int __nocast gfp);
92 92
93#ifdef __cplusplus 93#ifdef __cplusplus
94} 94}
diff --git a/include/linux/swap.h b/include/linux/swap.h
index 2343f999e6e..239f520cc49 100644
--- a/include/linux/swap.h
+++ b/include/linux/swap.h
@@ -7,6 +7,8 @@
7#include <linux/mmzone.h> 7#include <linux/mmzone.h>
8#include <linux/list.h> 8#include <linux/list.h>
9#include <linux/sched.h> 9#include <linux/sched.h>
10#include <linux/pagemap.h>
11
10#include <asm/atomic.h> 12#include <asm/atomic.h>
11#include <asm/page.h> 13#include <asm/page.h>
12 14
@@ -148,7 +150,7 @@ struct swap_list_t {
148#define vm_swap_full() (nr_swap_pages*2 < total_swap_pages) 150#define vm_swap_full() (nr_swap_pages*2 < total_swap_pages)
149 151
150/* linux/mm/oom_kill.c */ 152/* linux/mm/oom_kill.c */
151extern void out_of_memory(unsigned int __nocast gfp_mask); 153extern void out_of_memory(unsigned int __nocast gfp_mask, int order);
152 154
153/* linux/mm/memory.c */ 155/* linux/mm/memory.c */
154extern void swapin_readahead(swp_entry_t, unsigned long, struct vm_area_struct *); 156extern void swapin_readahead(swp_entry_t, unsigned long, struct vm_area_struct *);
diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h
index 52830b6d94e..425f58c8ea4 100644
--- a/include/linux/syscalls.h
+++ b/include/linux/syscalls.h
@@ -506,4 +506,7 @@ asmlinkage long sys_request_key(const char __user *_type,
506asmlinkage long sys_keyctl(int cmd, unsigned long arg2, unsigned long arg3, 506asmlinkage long sys_keyctl(int cmd, unsigned long arg2, unsigned long arg3,
507 unsigned long arg4, unsigned long arg5); 507 unsigned long arg4, unsigned long arg5);
508 508
509asmlinkage long sys_ioprio_set(int which, int who, int ioprio);
510asmlinkage long sys_ioprio_get(int which, int who);
511
509#endif 512#endif
diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h
index 5b5f434ac9a..ce19a2aa0b2 100644
--- a/include/linux/sysctl.h
+++ b/include/linux/sysctl.h
@@ -61,7 +61,8 @@ enum
61 CTL_DEV=7, /* Devices */ 61 CTL_DEV=7, /* Devices */
62 CTL_BUS=8, /* Busses */ 62 CTL_BUS=8, /* Busses */
63 CTL_ABI=9, /* Binary emulation */ 63 CTL_ABI=9, /* Binary emulation */
64 CTL_CPU=10 /* CPU stuff (speed scaling, etc) */ 64 CTL_CPU=10, /* CPU stuff (speed scaling, etc) */
65 CTL_INOTIFY=11 /* Inotify */
65}; 66};
66 67
67/* CTL_BUS names: */ 68/* CTL_BUS names: */
@@ -70,6 +71,14 @@ enum
70 CTL_BUS_ISA=1 /* ISA */ 71 CTL_BUS_ISA=1 /* ISA */
71}; 72};
72 73
74/* CTL_INOTIFY names: */
75enum
76{
77 INOTIFY_MAX_USER_DEVICES=1, /* max number of inotify device instances per user */
78 INOTIFY_MAX_USER_WATCHES=2, /* max number of inotify watches per user */
79 INOTIFY_MAX_QUEUED_EVENTS=3 /* Max number of queued events per inotify device instance */
80};
81
73/* CTL_KERN names: */ 82/* CTL_KERN names: */
74enum 83enum
75{ 84{
diff --git a/include/linux/tc_ematch/tc_em_meta.h b/include/linux/tc_ematch/tc_em_meta.h
index a6b2cc530af..bcb762d9312 100644
--- a/include/linux/tc_ematch/tc_em_meta.h
+++ b/include/linux/tc_ematch/tc_em_meta.h
@@ -45,7 +45,7 @@ enum
45 TCF_META_ID_REALDEV, 45 TCF_META_ID_REALDEV,
46 TCF_META_ID_PRIORITY, 46 TCF_META_ID_PRIORITY,
47 TCF_META_ID_PROTOCOL, 47 TCF_META_ID_PROTOCOL,
48 TCF_META_ID_SECURITY, 48 TCF_META_ID_SECURITY, /* obsolete */
49 TCF_META_ID_PKTTYPE, 49 TCF_META_ID_PKTTYPE,
50 TCF_META_ID_PKTLEN, 50 TCF_META_ID_PKTLEN,
51 TCF_META_ID_DATALEN, 51 TCF_META_ID_DATALEN,
diff --git a/include/linux/tcp.h b/include/linux/tcp.h
index dfd93d03f5d..e4fd82e4210 100644
--- a/include/linux/tcp.h
+++ b/include/linux/tcp.h
@@ -286,7 +286,7 @@ struct tcp_sock {
286 __u32 max_window; /* Maximal window ever seen from peer */ 286 __u32 max_window; /* Maximal window ever seen from peer */
287 __u32 pmtu_cookie; /* Last pmtu seen by socket */ 287 __u32 pmtu_cookie; /* Last pmtu seen by socket */
288 __u32 mss_cache; /* Cached effective mss, not including SACKS */ 288 __u32 mss_cache; /* Cached effective mss, not including SACKS */
289 __u16 mss_cache_std; /* Like mss_cache, but without TSO */ 289 __u16 xmit_size_goal; /* Goal for segmenting output packets */
290 __u16 ext_header_len; /* Network protocol overhead (IP/IPv6 options) */ 290 __u16 ext_header_len; /* Network protocol overhead (IP/IPv6 options) */
291 __u8 ca_state; /* State of fast-retransmit machine */ 291 __u8 ca_state; /* State of fast-retransmit machine */
292 __u8 retransmits; /* Number of unrecovered RTO timeouts. */ 292 __u8 retransmits; /* Number of unrecovered RTO timeouts. */
diff --git a/include/linux/usb.h b/include/linux/usb.h
index eb282b58154..72463779299 100644
--- a/include/linux/usb.h
+++ b/include/linux/usb.h
@@ -938,17 +938,17 @@ static inline void usb_fill_int_urb (struct urb *urb,
938} 938}
939 939
940extern void usb_init_urb(struct urb *urb); 940extern void usb_init_urb(struct urb *urb);
941extern struct urb *usb_alloc_urb(int iso_packets, int mem_flags); 941extern struct urb *usb_alloc_urb(int iso_packets, unsigned mem_flags);
942extern void usb_free_urb(struct urb *urb); 942extern void usb_free_urb(struct urb *urb);
943#define usb_put_urb usb_free_urb 943#define usb_put_urb usb_free_urb
944extern struct urb *usb_get_urb(struct urb *urb); 944extern struct urb *usb_get_urb(struct urb *urb);
945extern int usb_submit_urb(struct urb *urb, int mem_flags); 945extern int usb_submit_urb(struct urb *urb, unsigned mem_flags);
946extern int usb_unlink_urb(struct urb *urb); 946extern int usb_unlink_urb(struct urb *urb);
947extern void usb_kill_urb(struct urb *urb); 947extern void usb_kill_urb(struct urb *urb);
948 948
949#define HAVE_USB_BUFFERS 949#define HAVE_USB_BUFFERS
950void *usb_buffer_alloc (struct usb_device *dev, size_t size, 950void *usb_buffer_alloc (struct usb_device *dev, size_t size,
951 int mem_flags, dma_addr_t *dma); 951 unsigned mem_flags, dma_addr_t *dma);
952void usb_buffer_free (struct usb_device *dev, size_t size, 952void usb_buffer_free (struct usb_device *dev, size_t size,
953 void *addr, dma_addr_t dma); 953 void *addr, dma_addr_t dma);
954 954
@@ -1055,7 +1055,7 @@ int usb_sg_init (
1055 struct scatterlist *sg, 1055 struct scatterlist *sg,
1056 int nents, 1056 int nents,
1057 size_t length, 1057 size_t length,
1058 int mem_flags 1058 unsigned mem_flags
1059); 1059);
1060void usb_sg_cancel (struct usb_sg_request *io); 1060void usb_sg_cancel (struct usb_sg_request *io);
1061void usb_sg_wait (struct usb_sg_request *io); 1061void usb_sg_wait (struct usb_sg_request *io);
diff --git a/include/linux/usb_cdc.h b/include/linux/usb_cdc.h
index f22d6beecc7..ba617c37245 100644
--- a/include/linux/usb_cdc.h
+++ b/include/linux/usb_cdc.h
@@ -34,6 +34,7 @@
34#define USB_CDC_ACM_TYPE 0x02 /* acm_descriptor */ 34#define USB_CDC_ACM_TYPE 0x02 /* acm_descriptor */
35#define USB_CDC_UNION_TYPE 0x06 /* union_desc */ 35#define USB_CDC_UNION_TYPE 0x06 /* union_desc */
36#define USB_CDC_COUNTRY_TYPE 0x07 36#define USB_CDC_COUNTRY_TYPE 0x07
37#define USB_CDC_NETWORK_TERMINAL_TYPE 0x0a /* network_terminal_desc */
37#define USB_CDC_ETHERNET_TYPE 0x0f /* ether_desc */ 38#define USB_CDC_ETHERNET_TYPE 0x0f /* ether_desc */
38#define USB_CDC_WHCM_TYPE 0x11 39#define USB_CDC_WHCM_TYPE 0x11
39#define USB_CDC_MDLM_TYPE 0x12 /* mdlm_desc */ 40#define USB_CDC_MDLM_TYPE 0x12 /* mdlm_desc */
@@ -83,6 +84,18 @@ struct usb_cdc_union_desc {
83 /* ... and there could be other slave interfaces */ 84 /* ... and there could be other slave interfaces */
84} __attribute__ ((packed)); 85} __attribute__ ((packed));
85 86
87/* "Network Channel Terminal Functional Descriptor" from CDC spec 5.2.3.11 */
88struct usb_cdc_network_terminal_desc {
89 __u8 bLength;
90 __u8 bDescriptorType;
91 __u8 bDescriptorSubType;
92
93 __u8 bEntityId;
94 __u8 iName;
95 __u8 bChannelIndex;
96 __u8 bPhysicalInterface;
97} __attribute__ ((packed));
98
86/* "Ethernet Networking Functional Descriptor" from CDC spec 5.2.3.16 */ 99/* "Ethernet Networking Functional Descriptor" from CDC spec 5.2.3.16 */
87struct usb_cdc_ether_desc { 100struct usb_cdc_ether_desc {
88 __u8 bLength; 101 __u8 bLength;
diff --git a/include/linux/usb_gadget.h b/include/linux/usb_gadget.h
index b00f127cb44..71e60860732 100644
--- a/include/linux/usb_gadget.h
+++ b/include/linux/usb_gadget.h
@@ -107,18 +107,18 @@ struct usb_ep_ops {
107 int (*disable) (struct usb_ep *ep); 107 int (*disable) (struct usb_ep *ep);
108 108
109 struct usb_request *(*alloc_request) (struct usb_ep *ep, 109 struct usb_request *(*alloc_request) (struct usb_ep *ep,
110 int gfp_flags); 110 unsigned gfp_flags);
111 void (*free_request) (struct usb_ep *ep, struct usb_request *req); 111 void (*free_request) (struct usb_ep *ep, struct usb_request *req);
112 112
113 void *(*alloc_buffer) (struct usb_ep *ep, unsigned bytes, 113 void *(*alloc_buffer) (struct usb_ep *ep, unsigned bytes,
114 dma_addr_t *dma, int gfp_flags); 114 dma_addr_t *dma, unsigned gfp_flags);
115 void (*free_buffer) (struct usb_ep *ep, void *buf, dma_addr_t dma, 115 void (*free_buffer) (struct usb_ep *ep, void *buf, dma_addr_t dma,
116 unsigned bytes); 116 unsigned bytes);
117 // NOTE: on 2.6, drivers may also use dma_map() and 117 // NOTE: on 2.6, drivers may also use dma_map() and
118 // dma_sync_single_*() to directly manage dma overhead. 118 // dma_sync_single_*() to directly manage dma overhead.
119 119
120 int (*queue) (struct usb_ep *ep, struct usb_request *req, 120 int (*queue) (struct usb_ep *ep, struct usb_request *req,
121 int gfp_flags); 121 unsigned gfp_flags);
122 int (*dequeue) (struct usb_ep *ep, struct usb_request *req); 122 int (*dequeue) (struct usb_ep *ep, struct usb_request *req);
123 123
124 int (*set_halt) (struct usb_ep *ep, int value); 124 int (*set_halt) (struct usb_ep *ep, int value);
@@ -214,7 +214,7 @@ usb_ep_disable (struct usb_ep *ep)
214 * Returns the request, or null if one could not be allocated. 214 * Returns the request, or null if one could not be allocated.
215 */ 215 */
216static inline struct usb_request * 216static inline struct usb_request *
217usb_ep_alloc_request (struct usb_ep *ep, int gfp_flags) 217usb_ep_alloc_request (struct usb_ep *ep, unsigned gfp_flags)
218{ 218{
219 return ep->ops->alloc_request (ep, gfp_flags); 219 return ep->ops->alloc_request (ep, gfp_flags);
220} 220}
@@ -254,7 +254,7 @@ usb_ep_free_request (struct usb_ep *ep, struct usb_request *req)
254 */ 254 */
255static inline void * 255static inline void *
256usb_ep_alloc_buffer (struct usb_ep *ep, unsigned len, dma_addr_t *dma, 256usb_ep_alloc_buffer (struct usb_ep *ep, unsigned len, dma_addr_t *dma,
257 int gfp_flags) 257 unsigned gfp_flags)
258{ 258{
259 return ep->ops->alloc_buffer (ep, len, dma, gfp_flags); 259 return ep->ops->alloc_buffer (ep, len, dma, gfp_flags);
260} 260}
@@ -330,7 +330,7 @@ usb_ep_free_buffer (struct usb_ep *ep, void *buf, dma_addr_t dma, unsigned len)
330 * reported when the usb peripheral is disconnected. 330 * reported when the usb peripheral is disconnected.
331 */ 331 */
332static inline int 332static inline int
333usb_ep_queue (struct usb_ep *ep, struct usb_request *req, int gfp_flags) 333usb_ep_queue (struct usb_ep *ep, struct usb_request *req, unsigned gfp_flags)
334{ 334{
335 return ep->ops->queue (ep, req, gfp_flags); 335 return ep->ops->queue (ep, req, gfp_flags);
336} 336}
diff --git a/include/linux/wanrouter.h b/include/linux/wanrouter.h
index 3e89f0f15f4..1b6b76a4eb5 100644
--- a/include/linux/wanrouter.h
+++ b/include/linux/wanrouter.h
@@ -516,8 +516,7 @@ struct wan_device {
516/* Public functions available for device drivers */ 516/* Public functions available for device drivers */
517extern int register_wan_device(struct wan_device *wandev); 517extern int register_wan_device(struct wan_device *wandev);
518extern int unregister_wan_device(char *name); 518extern int unregister_wan_device(char *name);
519unsigned short wanrouter_type_trans(struct sk_buff *skb, 519__be16 wanrouter_type_trans(struct sk_buff *skb, struct net_device *dev);
520 struct net_device *dev);
521int wanrouter_encapsulate(struct sk_buff *skb, struct net_device *dev, 520int wanrouter_encapsulate(struct sk_buff *skb, struct net_device *dev,
522 unsigned short type); 521 unsigned short type);
523 522
diff --git a/include/media/audiochip.h b/include/media/audiochip.h
index f345a61c3bd..cd831168fdc 100644
--- a/include/media/audiochip.h
+++ b/include/media/audiochip.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * $Id: audiochip.h,v 1.3 2005/06/12 04:19:19 mchehab Exp $ 2 * $Id: audiochip.h,v 1.5 2005/06/16 22:59:16 hhackmann Exp $
3 */ 3 */
4 4
5#ifndef AUDIOCHIP_H 5#ifndef AUDIOCHIP_H
@@ -35,5 +35,4 @@
35 35
36/* misc stuff to pass around config info to i2c chips */ 36/* misc stuff to pass around config info to i2c chips */
37#define AUDC_CONFIG_PINNACLE _IOW('m',32,int) 37#define AUDC_CONFIG_PINNACLE _IOW('m',32,int)
38
39#endif /* AUDIOCHIP_H */ 38#endif /* AUDIOCHIP_H */
diff --git a/include/media/saa6752hs.h b/include/media/saa6752hs.h
index 791bad2b86e..3b8686ead80 100644
--- a/include/media/saa6752hs.h
+++ b/include/media/saa6752hs.h
@@ -18,55 +18,6 @@
18 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 18 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19*/ 19*/
20 20
21#if 0 /* ndef _SAA6752HS_H */
22#define _SAA6752HS_H
23
24enum mpeg_video_bitrate_mode {
25 MPEG_VIDEO_BITRATE_MODE_VBR = 0, /* Variable bitrate */
26 MPEG_VIDEO_BITRATE_MODE_CBR = 1, /* Constant bitrate */
27
28 MPEG_VIDEO_BITRATE_MODE_MAX
29};
30
31enum mpeg_audio_bitrate {
32 MPEG_AUDIO_BITRATE_256 = 0, /* 256 kBit/sec */
33 MPEG_AUDIO_BITRATE_384 = 1, /* 384 kBit/sec */
34
35 MPEG_AUDIO_BITRATE_MAX
36};
37
38enum mpeg_video_format {
39 MPEG_VIDEO_FORMAT_D1 = 0,
40 MPEG_VIDEO_FORMAT_2_3_D1 = 1,
41 MPEG_VIDEO_FORMAT_1_2_D1 = 2,
42 MPEG_VIDEO_FORMAT_SIF = 3,
43
44 MPEG_VIDEO_FORMAT_MAX
45};
46
47#define MPEG_VIDEO_TARGET_BITRATE_MAX 27000
48#define MPEG_VIDEO_MAX_BITRATE_MAX 27000
49#define MPEG_TOTAL_BITRATE_MAX 27000
50#define MPEG_PID_MAX ((1 << 14) - 1)
51
52struct mpeg_params {
53 enum mpeg_video_bitrate_mode video_bitrate_mode;
54 unsigned int video_target_bitrate;
55 unsigned int video_max_bitrate; // only used for VBR
56 enum mpeg_audio_bitrate audio_bitrate;
57 unsigned int total_bitrate;
58
59 unsigned int pmt_pid;
60 unsigned int video_pid;
61 unsigned int audio_pid;
62 unsigned int pcr_pid;
63
64 enum mpeg_video_format video_format;
65};
66
67#define MPEG_SETPARAMS _IOW('6',100,struct mpeg_params)
68
69#endif // _SAA6752HS_H
70 21
71/* 22/*
72 * Local variables: 23 * Local variables:
diff --git a/include/media/tuner.h b/include/media/tuner.h
index 4794c563236..d8c0a556328 100644
--- a/include/media/tuner.h
+++ b/include/media/tuner.h
@@ -1,5 +1,5 @@
1 1
2/* $Id: tuner.h,v 1.33 2005/06/21 14:58:08 mkrufky Exp $ 2/* $Id: tuner.h,v 1.42 2005/07/06 09:42:19 mchehab Exp $
3 * 3 *
4 tuner.h - definition for different tuners 4 tuner.h - definition for different tuners
5 5
@@ -26,8 +26,6 @@
26 26
27#include <linux/videodev2.h> 27#include <linux/videodev2.h>
28 28
29#include "id.h"
30
31#define ADDR_UNSET (255) 29#define ADDR_UNSET (255)
32 30
33#define TUNER_TEMIC_PAL 0 /* 4002 FH5 (3X 7756, 9483) */ 31#define TUNER_TEMIC_PAL 0 /* 4002 FH5 (3X 7756, 9483) */
@@ -111,8 +109,6 @@
111#define TUNER_TEA5767 62 /* Only FM Radio Tuner */ 109#define TUNER_TEA5767 62 /* Only FM Radio Tuner */
112#define TUNER_PHILIPS_FMD1216ME_MK3 63 110#define TUNER_PHILIPS_FMD1216ME_MK3 63
113 111
114#define TEA5767_TUNER_NAME "Philips TEA5767HN FM Radio"
115
116#define NOTUNER 0 112#define NOTUNER 0
117#define PAL 1 /* PAL_BG */ 113#define PAL 1 /* PAL_BG */
118#define PAL_I 2 114#define PAL_I 2
@@ -135,19 +131,8 @@
135#define TCL 11 131#define TCL 11
136#define THOMSON 12 132#define THOMSON 12
137 133
138enum v4l_radio_tuner { 134#define TUNER_SET_TYPE_ADDR _IOW('T',3,int)
139 TEA5767_LOW_LO_32768 = 0, 135#define TDA9887_SET_CONFIG _IOW('t',5,int)
140 TEA5767_HIGH_LO_32768 = 1,
141 TEA5767_LOW_LO_13MHz = 2,
142 TEA5767_HIGH_LO_13MHz = 3,
143};
144
145
146#define TUNER_SET_TYPE _IOW('t',1,int) /* set tuner type */
147#define TUNER_SET_TVFREQ _IOW('t',2,int) /* set tv freq */
148#define TUNER_SET_TYPE_ADDR _IOW('T',3,int) /* set tuner type and I2C addr */
149
150#define TDA9887_SET_CONFIG _IOW('t',5,int)
151 136
152/* tv card specific */ 137/* tv card specific */
153# define TDA9887_PRESENT (1<<0) 138# define TDA9887_PRESENT (1<<0)
@@ -169,25 +154,34 @@ enum v4l_radio_tuner {
169#define I2C_ADDR_TDA8290 0x4b 154#define I2C_ADDR_TDA8290 0x4b
170#define I2C_ADDR_TDA8275 0x61 155#define I2C_ADDR_TDA8275 0x61
171 156
172struct tuner_addr { 157enum tuner_mode {
173 enum v4l2_tuner_type v4l2_tuner; 158 T_UNINITIALIZED = 0,
174 unsigned int type; 159 T_RADIO = 1 << V4L2_TUNER_RADIO,
160 T_ANALOG_TV = 1 << V4L2_TUNER_ANALOG_TV,
161 T_DIGITAL_TV = 1 << V4L2_TUNER_DIGITAL_TV,
162 T_STANDBY = 1 << 31
163};
164
165struct tuner_setup {
175 unsigned short addr; 166 unsigned short addr;
167 unsigned int type;
168 unsigned int mode_mask;
176}; 169};
177 170
178struct tuner { 171struct tuner {
179 /* device */ 172 /* device */
180 struct i2c_client i2c; 173 struct i2c_client i2c;
181 174
182 /* state + config */
183 unsigned int initialized;
184 unsigned int type; /* chip type */ 175 unsigned int type; /* chip type */
176
177 unsigned int mode;
178 unsigned int mode_mask; /* Combination of allowable modes */
179
185 unsigned int freq; /* keep track of the current settings */ 180 unsigned int freq; /* keep track of the current settings */
181 unsigned int audmode;
186 v4l2_std_id std; 182 v4l2_std_id std;
187 int using_v4l2;
188 183
189 enum v4l2_tuner_type mode; 184 int using_v4l2;
190 unsigned int input;
191 185
192 /* used by MT2032 */ 186 /* used by MT2032 */
193 unsigned int xogc; 187 unsigned int xogc;
@@ -197,15 +191,11 @@ struct tuner {
197 unsigned char i2c_easy_mode[2]; 191 unsigned char i2c_easy_mode[2];
198 unsigned char i2c_set_freq[8]; 192 unsigned char i2c_set_freq[8];
199 193
200 /* used to keep track of audmode */
201 unsigned int audmode;
202
203 /* function ptrs */ 194 /* function ptrs */
204 void (*tv_freq)(struct i2c_client *c, unsigned int freq); 195 void (*tv_freq)(struct i2c_client *c, unsigned int freq);
205 void (*radio_freq)(struct i2c_client *c, unsigned int freq); 196 void (*radio_freq)(struct i2c_client *c, unsigned int freq);
206 int (*has_signal)(struct i2c_client *c); 197 int (*has_signal)(struct i2c_client *c);
207 int (*is_stereo)(struct i2c_client *c); 198 int (*is_stereo)(struct i2c_client *c);
208 int (*set_tuner)(struct i2c_client *c, struct v4l2_tuner *v);
209}; 199};
210 200
211extern unsigned int tuner_debug; 201extern unsigned int tuner_debug;
@@ -215,6 +205,7 @@ extern int microtune_init(struct i2c_client *c);
215extern int tda8290_init(struct i2c_client *c); 205extern int tda8290_init(struct i2c_client *c);
216extern int tea5767_tuner_init(struct i2c_client *c); 206extern int tea5767_tuner_init(struct i2c_client *c);
217extern int default_tuner_init(struct i2c_client *c); 207extern int default_tuner_init(struct i2c_client *c);
208extern int tea5767_autodetection(struct i2c_client *c);
218 209
219#define tuner_warn(fmt, arg...) \ 210#define tuner_warn(fmt, arg...) \
220 dev_printk(KERN_WARNING , &t->i2c.dev , fmt , ## arg) 211 dev_printk(KERN_WARNING , &t->i2c.dev , fmt , ## arg)
diff --git a/include/mtd/mtd-abi.h b/include/mtd/mtd-abi.h
index a76ab898f44..428d9122940 100644
--- a/include/mtd/mtd-abi.h
+++ b/include/mtd/mtd-abi.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * $Id: mtd-abi.h,v 1.7 2004/11/23 15:37:32 gleixner Exp $ 2 * $Id: mtd-abi.h,v 1.11 2005/05/19 16:08:58 gleixner Exp $
3 * 3 *
4 * Portions of MTD ABI definition which are shared by kernel and user space 4 * Portions of MTD ABI definition which are shared by kernel and user space
5 */ 5 */
@@ -29,6 +29,7 @@ struct mtd_oob_buf {
29#define MTD_NORFLASH 3 29#define MTD_NORFLASH 3
30#define MTD_NANDFLASH 4 30#define MTD_NANDFLASH 4
31#define MTD_PEROM 5 31#define MTD_PEROM 5
32#define MTD_DATAFLASH 6
32#define MTD_OTHER 14 33#define MTD_OTHER 14
33#define MTD_UNKNOWN 15 34#define MTD_UNKNOWN 15
34 35
@@ -60,6 +61,12 @@ struct mtd_oob_buf {
60#define MTD_NANDECC_PLACE 1 // Use the given placement in the structure (YAFFS1 legacy mode) 61#define MTD_NANDECC_PLACE 1 // Use the given placement in the structure (YAFFS1 legacy mode)
61#define MTD_NANDECC_AUTOPLACE 2 // Use the default placement scheme 62#define MTD_NANDECC_AUTOPLACE 2 // Use the default placement scheme
62#define MTD_NANDECC_PLACEONLY 3 // Use the given placement in the structure (Do not store ecc result on read) 63#define MTD_NANDECC_PLACEONLY 3 // Use the given placement in the structure (Do not store ecc result on read)
64#define MTD_NANDECC_AUTOPL_USR 4 // Use the given autoplacement scheme rather than using the default
65
66/* OTP mode selection */
67#define MTD_OTP_OFF 0
68#define MTD_OTP_FACTORY 1
69#define MTD_OTP_USER 2
63 70
64struct mtd_info_user { 71struct mtd_info_user {
65 uint8_t type; 72 uint8_t type;
@@ -80,6 +87,12 @@ struct region_info_user {
80 uint32_t regionindex; 87 uint32_t regionindex;
81}; 88};
82 89
90struct otp_info {
91 uint32_t start;
92 uint32_t length;
93 uint32_t locked;
94};
95
83#define MEMGETINFO _IOR('M', 1, struct mtd_info_user) 96#define MEMGETINFO _IOR('M', 1, struct mtd_info_user)
84#define MEMERASE _IOW('M', 2, struct erase_info_user) 97#define MEMERASE _IOW('M', 2, struct erase_info_user)
85#define MEMWRITEOOB _IOWR('M', 3, struct mtd_oob_buf) 98#define MEMWRITEOOB _IOWR('M', 3, struct mtd_oob_buf)
@@ -92,6 +105,10 @@ struct region_info_user {
92#define MEMGETOOBSEL _IOR('M', 10, struct nand_oobinfo) 105#define MEMGETOOBSEL _IOR('M', 10, struct nand_oobinfo)
93#define MEMGETBADBLOCK _IOW('M', 11, loff_t) 106#define MEMGETBADBLOCK _IOW('M', 11, loff_t)
94#define MEMSETBADBLOCK _IOW('M', 12, loff_t) 107#define MEMSETBADBLOCK _IOW('M', 12, loff_t)
108#define OTPSELECT _IOR('M', 13, int)
109#define OTPGETREGIONCOUNT _IOW('M', 14, int)
110#define OTPGETREGIONINFO _IOW('M', 15, struct otp_info)
111#define OTPLOCK _IOR('M', 16, struct otp_info)
95 112
96struct nand_oobinfo { 113struct nand_oobinfo {
97 uint32_t useecc; 114 uint32_t useecc;
diff --git a/include/net/irda/irda_device.h b/include/net/irda/irda_device.h
index 71d6af83b63..92c828029cd 100644
--- a/include/net/irda/irda_device.h
+++ b/include/net/irda/irda_device.h
@@ -224,7 +224,7 @@ int irda_device_is_receiving(struct net_device *dev);
224/* Interface for internal use */ 224/* Interface for internal use */
225static inline int irda_device_txqueue_empty(const struct net_device *dev) 225static inline int irda_device_txqueue_empty(const struct net_device *dev)
226{ 226{
227 return (skb_queue_len(&dev->qdisc->q) == 0); 227 return skb_queue_empty(&dev->qdisc->q);
228} 228}
229int irda_device_set_raw_mode(struct net_device* self, int status); 229int irda_device_set_raw_mode(struct net_device* self, int status);
230struct net_device *alloc_irdadev(int sizeof_priv); 230struct net_device *alloc_irdadev(int sizeof_priv);
diff --git a/include/net/pkt_sched.h b/include/net/pkt_sched.h
index fcb05a387db..6492e7363d8 100644
--- a/include/net/pkt_sched.h
+++ b/include/net/pkt_sched.h
@@ -13,13 +13,12 @@ struct qdisc_walker
13 13
14extern rwlock_t qdisc_tree_lock; 14extern rwlock_t qdisc_tree_lock;
15 15
16#define QDISC_ALIGN 32 16#define QDISC_ALIGNTO 32
17#define QDISC_ALIGN_CONST (QDISC_ALIGN - 1) 17#define QDISC_ALIGN(len) (((len) + QDISC_ALIGNTO-1) & ~(QDISC_ALIGNTO-1))
18 18
19static inline void *qdisc_priv(struct Qdisc *q) 19static inline void *qdisc_priv(struct Qdisc *q)
20{ 20{
21 return (char *)q + ((sizeof(struct Qdisc) + QDISC_ALIGN_CONST) 21 return (char *) q + QDISC_ALIGN(sizeof(struct Qdisc));
22 & ~QDISC_ALIGN_CONST);
23} 22}
24 23
25/* 24/*
@@ -207,8 +206,6 @@ psched_tod_diff(int delta_sec, int bound)
207 206
208#endif /* !CONFIG_NET_SCH_CLK_GETTIMEOFDAY */ 207#endif /* !CONFIG_NET_SCH_CLK_GETTIMEOFDAY */
209 208
210extern struct Qdisc noop_qdisc;
211extern struct Qdisc_ops noop_qdisc_ops;
212extern struct Qdisc_ops pfifo_qdisc_ops; 209extern struct Qdisc_ops pfifo_qdisc_ops;
213extern struct Qdisc_ops bfifo_qdisc_ops; 210extern struct Qdisc_ops bfifo_qdisc_ops;
214 211
@@ -216,14 +213,6 @@ extern int register_qdisc(struct Qdisc_ops *qops);
216extern int unregister_qdisc(struct Qdisc_ops *qops); 213extern int unregister_qdisc(struct Qdisc_ops *qops);
217extern struct Qdisc *qdisc_lookup(struct net_device *dev, u32 handle); 214extern struct Qdisc *qdisc_lookup(struct net_device *dev, u32 handle);
218extern struct Qdisc *qdisc_lookup_class(struct net_device *dev, u32 handle); 215extern struct Qdisc *qdisc_lookup_class(struct net_device *dev, u32 handle);
219extern void dev_init_scheduler(struct net_device *dev);
220extern void dev_shutdown(struct net_device *dev);
221extern void dev_activate(struct net_device *dev);
222extern void dev_deactivate(struct net_device *dev);
223extern void qdisc_reset(struct Qdisc *qdisc);
224extern void qdisc_destroy(struct Qdisc *qdisc);
225extern struct Qdisc * qdisc_create_dflt(struct net_device *dev,
226 struct Qdisc_ops *ops);
227extern struct qdisc_rate_table *qdisc_get_rtab(struct tc_ratespec *r, 216extern struct qdisc_rate_table *qdisc_get_rtab(struct tc_ratespec *r,
228 struct rtattr *tab); 217 struct rtattr *tab);
229extern void qdisc_put_rtab(struct qdisc_rate_table *tab); 218extern void qdisc_put_rtab(struct qdisc_rate_table *tab);
diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h
index 7b97405e2db..7b6ec998671 100644
--- a/include/net/sch_generic.h
+++ b/include/net/sch_generic.h
@@ -164,6 +164,19 @@ extern void qdisc_unlock_tree(struct net_device *dev);
164#define tcf_tree_lock(tp) qdisc_lock_tree((tp)->q->dev) 164#define tcf_tree_lock(tp) qdisc_lock_tree((tp)->q->dev)
165#define tcf_tree_unlock(tp) qdisc_unlock_tree((tp)->q->dev) 165#define tcf_tree_unlock(tp) qdisc_unlock_tree((tp)->q->dev)
166 166
167extern struct Qdisc noop_qdisc;
168extern struct Qdisc_ops noop_qdisc_ops;
169
170extern void dev_init_scheduler(struct net_device *dev);
171extern void dev_shutdown(struct net_device *dev);
172extern void dev_activate(struct net_device *dev);
173extern void dev_deactivate(struct net_device *dev);
174extern void qdisc_reset(struct Qdisc *qdisc);
175extern void qdisc_destroy(struct Qdisc *qdisc);
176extern struct Qdisc *qdisc_alloc(struct net_device *dev, struct Qdisc_ops *ops);
177extern struct Qdisc *qdisc_create_dflt(struct net_device *dev,
178 struct Qdisc_ops *ops);
179
167static inline void 180static inline void
168tcf_destroy(struct tcf_proto *tp) 181tcf_destroy(struct tcf_proto *tp)
169{ 182{
diff --git a/include/net/sctp/sctp.h b/include/net/sctp/sctp.h
index ef2738159ab..4a26adfaed7 100644
--- a/include/net/sctp/sctp.h
+++ b/include/net/sctp/sctp.h
@@ -125,7 +125,8 @@
125 */ 125 */
126extern struct sock *sctp_get_ctl_sock(void); 126extern struct sock *sctp_get_ctl_sock(void);
127extern int sctp_copy_local_addr_list(struct sctp_bind_addr *, 127extern int sctp_copy_local_addr_list(struct sctp_bind_addr *,
128 sctp_scope_t, int gfp, int flags); 128 sctp_scope_t, unsigned int __nocast gfp,
129 int flags);
129extern struct sctp_pf *sctp_get_pf_specific(sa_family_t family); 130extern struct sctp_pf *sctp_get_pf_specific(sa_family_t family);
130extern int sctp_register_pf(struct sctp_pf *, sa_family_t); 131extern int sctp_register_pf(struct sctp_pf *, sa_family_t);
131 132
diff --git a/include/net/sctp/sm.h b/include/net/sctp/sm.h
index 88d9fe5975d..58462164d96 100644
--- a/include/net/sctp/sm.h
+++ b/include/net/sctp/sm.h
@@ -181,17 +181,17 @@ const sctp_sm_table_entry_t *sctp_sm_lookup_event(sctp_event_t,
181int sctp_chunk_iif(const struct sctp_chunk *); 181int sctp_chunk_iif(const struct sctp_chunk *);
182struct sctp_association *sctp_make_temp_asoc(const struct sctp_endpoint *, 182struct sctp_association *sctp_make_temp_asoc(const struct sctp_endpoint *,
183 struct sctp_chunk *, 183 struct sctp_chunk *,
184 int gfp); 184 unsigned int __nocast gfp);
185__u32 sctp_generate_verification_tag(void); 185__u32 sctp_generate_verification_tag(void);
186void sctp_populate_tie_tags(__u8 *cookie, __u32 curTag, __u32 hisTag); 186void sctp_populate_tie_tags(__u8 *cookie, __u32 curTag, __u32 hisTag);
187 187
188/* Prototypes for chunk-building functions. */ 188/* Prototypes for chunk-building functions. */
189struct sctp_chunk *sctp_make_init(const struct sctp_association *, 189struct sctp_chunk *sctp_make_init(const struct sctp_association *,
190 const struct sctp_bind_addr *, 190 const struct sctp_bind_addr *,
191 int gfp, int vparam_len); 191 unsigned int __nocast gfp, int vparam_len);
192struct sctp_chunk *sctp_make_init_ack(const struct sctp_association *, 192struct sctp_chunk *sctp_make_init_ack(const struct sctp_association *,
193 const struct sctp_chunk *, 193 const struct sctp_chunk *,
194 const int gfp, 194 const unsigned int __nocast gfp,
195 const int unkparam_len); 195 const int unkparam_len);
196struct sctp_chunk *sctp_make_cookie_echo(const struct sctp_association *, 196struct sctp_chunk *sctp_make_cookie_echo(const struct sctp_association *,
197 const struct sctp_chunk *); 197 const struct sctp_chunk *);
@@ -265,7 +265,7 @@ int sctp_do_sm(sctp_event_t event_type, sctp_subtype_t subtype,
265 struct sctp_endpoint *, 265 struct sctp_endpoint *,
266 struct sctp_association *asoc, 266 struct sctp_association *asoc,
267 void *event_arg, 267 void *event_arg,
268 int gfp); 268 unsigned int __nocast gfp);
269 269
270/* 2nd level prototypes */ 270/* 2nd level prototypes */
271void sctp_generate_t3_rtx_event(unsigned long peer); 271void sctp_generate_t3_rtx_event(unsigned long peer);
@@ -275,7 +275,8 @@ void sctp_ootb_pkt_free(struct sctp_packet *);
275 275
276struct sctp_association *sctp_unpack_cookie(const struct sctp_endpoint *, 276struct sctp_association *sctp_unpack_cookie(const struct sctp_endpoint *,
277 const struct sctp_association *, 277 const struct sctp_association *,
278 struct sctp_chunk *, int gfp, int *err, 278 struct sctp_chunk *,
279 unsigned int __nocast gfp, int *err,
279 struct sctp_chunk **err_chk_p); 280 struct sctp_chunk **err_chk_p);
280int sctp_addip_addr_config(struct sctp_association *, sctp_param_t, 281int sctp_addip_addr_config(struct sctp_association *, sctp_param_t,
281 struct sockaddr_storage*, int); 282 struct sockaddr_storage*, int);
diff --git a/include/net/sctp/structs.h b/include/net/sctp/structs.h
index 47727c7cc62..994009bbe3b 100644
--- a/include/net/sctp/structs.h
+++ b/include/net/sctp/structs.h
@@ -445,7 +445,8 @@ struct sctp_ssnmap {
445 int malloced; 445 int malloced;
446}; 446};
447 447
448struct sctp_ssnmap *sctp_ssnmap_new(__u16 in, __u16 out, int gfp); 448struct sctp_ssnmap *sctp_ssnmap_new(__u16 in, __u16 out,
449 unsigned int __nocast gfp);
449void sctp_ssnmap_free(struct sctp_ssnmap *map); 450void sctp_ssnmap_free(struct sctp_ssnmap *map);
450void sctp_ssnmap_clear(struct sctp_ssnmap *map); 451void sctp_ssnmap_clear(struct sctp_ssnmap *map);
451 452
@@ -582,7 +583,6 @@ void sctp_datamsg_track(struct sctp_chunk *);
582void sctp_chunk_fail(struct sctp_chunk *, int error); 583void sctp_chunk_fail(struct sctp_chunk *, int error);
583int sctp_chunk_abandoned(struct sctp_chunk *); 584int sctp_chunk_abandoned(struct sctp_chunk *);
584 585
585
586/* RFC2960 1.4 Key Terms 586/* RFC2960 1.4 Key Terms
587 * 587 *
588 * o Chunk: A unit of information within an SCTP packet, consisting of 588 * o Chunk: A unit of information within an SCTP packet, consisting of
@@ -592,13 +592,8 @@ int sctp_chunk_abandoned(struct sctp_chunk *);
592 * each chunk as well as a few other header pointers... 592 * each chunk as well as a few other header pointers...
593 */ 593 */
594struct sctp_chunk { 594struct sctp_chunk {
595 /* These first three elements MUST PRECISELY match the first 595 struct list_head list;
596 * three elements of struct sk_buff. This allows us to reuse 596
597 * all the skb_* queue management functions.
598 */
599 struct sctp_chunk *next;
600 struct sctp_chunk *prev;
601 struct sk_buff_head *list;
602 atomic_t refcnt; 597 atomic_t refcnt;
603 598
604 /* This is our link to the per-transport transmitted list. */ 599 /* This is our link to the per-transport transmitted list. */
@@ -717,7 +712,7 @@ struct sctp_packet {
717 __u32 vtag; 712 __u32 vtag;
718 713
719 /* This contains the payload chunks. */ 714 /* This contains the payload chunks. */
720 struct sk_buff_head chunks; 715 struct list_head chunk_list;
721 716
722 /* This is the overhead of the sctp and ip headers. */ 717 /* This is the overhead of the sctp and ip headers. */
723 size_t overhead; 718 size_t overhead;
@@ -951,7 +946,8 @@ struct sctp_transport {
951 } cacc; 946 } cacc;
952}; 947};
953 948
954struct sctp_transport *sctp_transport_new(const union sctp_addr *, int); 949struct sctp_transport *sctp_transport_new(const union sctp_addr *,
950 unsigned int __nocast);
955void sctp_transport_set_owner(struct sctp_transport *, 951void sctp_transport_set_owner(struct sctp_transport *,
956 struct sctp_association *); 952 struct sctp_association *);
957void sctp_transport_route(struct sctp_transport *, union sctp_addr *, 953void sctp_transport_route(struct sctp_transport *, union sctp_addr *,
@@ -974,7 +970,7 @@ struct sctp_inq {
974 /* This is actually a queue of sctp_chunk each 970 /* This is actually a queue of sctp_chunk each
975 * containing a partially decoded packet. 971 * containing a partially decoded packet.
976 */ 972 */
977 struct sk_buff_head in; 973 struct list_head in_chunk_list;
978 /* This is the packet which is currently off the in queue and is 974 /* This is the packet which is currently off the in queue and is
979 * being worked on through the inbound chunk processing. 975 * being worked on through the inbound chunk processing.
980 */ 976 */
@@ -1017,7 +1013,7 @@ struct sctp_outq {
1017 struct sctp_association *asoc; 1013 struct sctp_association *asoc;
1018 1014
1019 /* Data pending that has never been transmitted. */ 1015 /* Data pending that has never been transmitted. */
1020 struct sk_buff_head out; 1016 struct list_head out_chunk_list;
1021 1017
1022 unsigned out_qlen; /* Total length of queued data chunks. */ 1018 unsigned out_qlen; /* Total length of queued data chunks. */
1023 1019
@@ -1025,7 +1021,7 @@ struct sctp_outq {
1025 unsigned error; 1021 unsigned error;
1026 1022
1027 /* These are control chunks we want to send. */ 1023 /* These are control chunks we want to send. */
1028 struct sk_buff_head control; 1024 struct list_head control_chunk_list;
1029 1025
1030 /* These are chunks that have been sacked but are above the 1026 /* These are chunks that have been sacked but are above the
1031 * CTSN, or cumulative tsn ack point. 1027 * CTSN, or cumulative tsn ack point.
@@ -1099,9 +1095,10 @@ void sctp_bind_addr_init(struct sctp_bind_addr *, __u16 port);
1099void sctp_bind_addr_free(struct sctp_bind_addr *); 1095void sctp_bind_addr_free(struct sctp_bind_addr *);
1100int sctp_bind_addr_copy(struct sctp_bind_addr *dest, 1096int sctp_bind_addr_copy(struct sctp_bind_addr *dest,
1101 const struct sctp_bind_addr *src, 1097 const struct sctp_bind_addr *src,
1102 sctp_scope_t scope, int gfp,int flags); 1098 sctp_scope_t scope, unsigned int __nocast gfp,
1099 int flags);
1103int sctp_add_bind_addr(struct sctp_bind_addr *, union sctp_addr *, 1100int sctp_add_bind_addr(struct sctp_bind_addr *, union sctp_addr *,
1104 int gfp); 1101 unsigned int __nocast gfp);
1105int sctp_del_bind_addr(struct sctp_bind_addr *, union sctp_addr *); 1102int sctp_del_bind_addr(struct sctp_bind_addr *, union sctp_addr *);
1106int sctp_bind_addr_match(struct sctp_bind_addr *, const union sctp_addr *, 1103int sctp_bind_addr_match(struct sctp_bind_addr *, const union sctp_addr *,
1107 struct sctp_sock *); 1104 struct sctp_sock *);
@@ -1110,9 +1107,10 @@ union sctp_addr *sctp_find_unmatch_addr(struct sctp_bind_addr *bp,
1110 int addrcnt, 1107 int addrcnt,
1111 struct sctp_sock *opt); 1108 struct sctp_sock *opt);
1112union sctp_params sctp_bind_addrs_to_raw(const struct sctp_bind_addr *bp, 1109union sctp_params sctp_bind_addrs_to_raw(const struct sctp_bind_addr *bp,
1113 int *addrs_len, int gfp); 1110 int *addrs_len,
1111 unsigned int __nocast gfp);
1114int sctp_raw_to_bind_addrs(struct sctp_bind_addr *bp, __u8 *raw, int len, 1112int sctp_raw_to_bind_addrs(struct sctp_bind_addr *bp, __u8 *raw, int len,
1115 __u16 port, int gfp); 1113 __u16 port, unsigned int __nocast gfp);
1116 1114
1117sctp_scope_t sctp_scope(const union sctp_addr *); 1115sctp_scope_t sctp_scope(const union sctp_addr *);
1118int sctp_in_scope(const union sctp_addr *addr, const sctp_scope_t scope); 1116int sctp_in_scope(const union sctp_addr *addr, const sctp_scope_t scope);
@@ -1241,7 +1239,7 @@ static inline struct sctp_endpoint *sctp_ep(struct sctp_ep_common *base)
1241} 1239}
1242 1240
1243/* These are function signatures for manipulating endpoints. */ 1241/* These are function signatures for manipulating endpoints. */
1244struct sctp_endpoint *sctp_endpoint_new(struct sock *, int); 1242struct sctp_endpoint *sctp_endpoint_new(struct sock *, unsigned int __nocast);
1245void sctp_endpoint_free(struct sctp_endpoint *); 1243void sctp_endpoint_free(struct sctp_endpoint *);
1246void sctp_endpoint_put(struct sctp_endpoint *); 1244void sctp_endpoint_put(struct sctp_endpoint *);
1247void sctp_endpoint_hold(struct sctp_endpoint *); 1245void sctp_endpoint_hold(struct sctp_endpoint *);
@@ -1262,7 +1260,7 @@ int sctp_verify_init(const struct sctp_association *asoc, sctp_cid_t,
1262 struct sctp_chunk **err_chunk); 1260 struct sctp_chunk **err_chunk);
1263int sctp_process_init(struct sctp_association *, sctp_cid_t cid, 1261int sctp_process_init(struct sctp_association *, sctp_cid_t cid,
1264 const union sctp_addr *peer, 1262 const union sctp_addr *peer,
1265 sctp_init_chunk_t *init, int gfp); 1263 sctp_init_chunk_t *init, unsigned int __nocast gfp);
1266__u32 sctp_generate_tag(const struct sctp_endpoint *); 1264__u32 sctp_generate_tag(const struct sctp_endpoint *);
1267__u32 sctp_generate_tsn(const struct sctp_endpoint *); 1265__u32 sctp_generate_tsn(const struct sctp_endpoint *);
1268 1266
@@ -1672,7 +1670,7 @@ struct sctp_association {
1672 * which already resides in sctp_outq. Please move this 1670 * which already resides in sctp_outq. Please move this
1673 * queue and its supporting logic down there. --piggy] 1671 * queue and its supporting logic down there. --piggy]
1674 */ 1672 */
1675 struct sk_buff_head addip_chunks; 1673 struct list_head addip_chunk_list;
1676 1674
1677 /* ADDIP Section 4.1 ASCONF Chunk Procedures 1675 /* ADDIP Section 4.1 ASCONF Chunk Procedures
1678 * 1676 *
@@ -1725,7 +1723,7 @@ static inline struct sctp_association *sctp_assoc(struct sctp_ep_common *base)
1725 1723
1726struct sctp_association * 1724struct sctp_association *
1727sctp_association_new(const struct sctp_endpoint *, const struct sock *, 1725sctp_association_new(const struct sctp_endpoint *, const struct sock *,
1728 sctp_scope_t scope, int gfp); 1726 sctp_scope_t scope, unsigned int __nocast gfp);
1729void sctp_association_free(struct sctp_association *); 1727void sctp_association_free(struct sctp_association *);
1730void sctp_association_put(struct sctp_association *); 1728void sctp_association_put(struct sctp_association *);
1731void sctp_association_hold(struct sctp_association *); 1729void sctp_association_hold(struct sctp_association *);
@@ -1741,7 +1739,7 @@ int sctp_assoc_lookup_laddr(struct sctp_association *asoc,
1741 const union sctp_addr *laddr); 1739 const union sctp_addr *laddr);
1742struct sctp_transport *sctp_assoc_add_peer(struct sctp_association *, 1740struct sctp_transport *sctp_assoc_add_peer(struct sctp_association *,
1743 const union sctp_addr *address, 1741 const union sctp_addr *address,
1744 const int gfp, 1742 const unsigned int __nocast gfp,
1745 const int peer_state); 1743 const int peer_state);
1746void sctp_assoc_del_peer(struct sctp_association *asoc, 1744void sctp_assoc_del_peer(struct sctp_association *asoc,
1747 const union sctp_addr *addr); 1745 const union sctp_addr *addr);
@@ -1765,9 +1763,11 @@ void sctp_assoc_rwnd_increase(struct sctp_association *, unsigned);
1765void sctp_assoc_rwnd_decrease(struct sctp_association *, unsigned); 1763void sctp_assoc_rwnd_decrease(struct sctp_association *, unsigned);
1766void sctp_assoc_set_primary(struct sctp_association *, 1764void sctp_assoc_set_primary(struct sctp_association *,
1767 struct sctp_transport *); 1765 struct sctp_transport *);
1768int sctp_assoc_set_bind_addr_from_ep(struct sctp_association *, int); 1766int sctp_assoc_set_bind_addr_from_ep(struct sctp_association *,
1767 unsigned int __nocast);
1769int sctp_assoc_set_bind_addr_from_cookie(struct sctp_association *, 1768int sctp_assoc_set_bind_addr_from_cookie(struct sctp_association *,
1770 struct sctp_cookie*, int gfp); 1769 struct sctp_cookie*,
1770 unsigned int __nocast gfp);
1771 1771
1772int sctp_cmp_addr_exact(const union sctp_addr *ss1, 1772int sctp_cmp_addr_exact(const union sctp_addr *ss1,
1773 const union sctp_addr *ss2); 1773 const union sctp_addr *ss2);
diff --git a/include/net/sctp/ulpevent.h b/include/net/sctp/ulpevent.h
index 1019d83a580..90fe4bf6754 100644
--- a/include/net/sctp/ulpevent.h
+++ b/include/net/sctp/ulpevent.h
@@ -88,7 +88,7 @@ struct sctp_ulpevent *sctp_ulpevent_make_assoc_change(
88 __u16 error, 88 __u16 error,
89 __u16 outbound, 89 __u16 outbound,
90 __u16 inbound, 90 __u16 inbound,
91 int gfp); 91 unsigned int __nocast gfp);
92 92
93struct sctp_ulpevent *sctp_ulpevent_make_peer_addr_change( 93struct sctp_ulpevent *sctp_ulpevent_make_peer_addr_change(
94 const struct sctp_association *asoc, 94 const struct sctp_association *asoc,
@@ -96,35 +96,35 @@ struct sctp_ulpevent *sctp_ulpevent_make_peer_addr_change(
96 int flags, 96 int flags,
97 int state, 97 int state,
98 int error, 98 int error,
99 int gfp); 99 unsigned int __nocast gfp);
100 100
101struct sctp_ulpevent *sctp_ulpevent_make_remote_error( 101struct sctp_ulpevent *sctp_ulpevent_make_remote_error(
102 const struct sctp_association *asoc, 102 const struct sctp_association *asoc,
103 struct sctp_chunk *chunk, 103 struct sctp_chunk *chunk,
104 __u16 flags, 104 __u16 flags,
105 int gfp); 105 unsigned int __nocast gfp);
106struct sctp_ulpevent *sctp_ulpevent_make_send_failed( 106struct sctp_ulpevent *sctp_ulpevent_make_send_failed(
107 const struct sctp_association *asoc, 107 const struct sctp_association *asoc,
108 struct sctp_chunk *chunk, 108 struct sctp_chunk *chunk,
109 __u16 flags, 109 __u16 flags,
110 __u32 error, 110 __u32 error,
111 int gfp); 111 unsigned int __nocast gfp);
112 112
113struct sctp_ulpevent *sctp_ulpevent_make_shutdown_event( 113struct sctp_ulpevent *sctp_ulpevent_make_shutdown_event(
114 const struct sctp_association *asoc, 114 const struct sctp_association *asoc,
115 __u16 flags, 115 __u16 flags,
116 int gfp); 116 unsigned int __nocast gfp);
117 117
118struct sctp_ulpevent *sctp_ulpevent_make_pdapi( 118struct sctp_ulpevent *sctp_ulpevent_make_pdapi(
119 const struct sctp_association *asoc, 119 const struct sctp_association *asoc,
120 __u32 indication, int gfp); 120 __u32 indication, unsigned int __nocast gfp);
121 121
122struct sctp_ulpevent *sctp_ulpevent_make_adaption_indication( 122struct sctp_ulpevent *sctp_ulpevent_make_adaption_indication(
123 const struct sctp_association *asoc, int gfp); 123 const struct sctp_association *asoc, unsigned int __nocast gfp);
124 124
125struct sctp_ulpevent *sctp_ulpevent_make_rcvmsg(struct sctp_association *asoc, 125struct sctp_ulpevent *sctp_ulpevent_make_rcvmsg(struct sctp_association *asoc,
126 struct sctp_chunk *chunk, 126 struct sctp_chunk *chunk,
127 int gfp); 127 unsigned int __nocast gfp);
128 128
129void sctp_ulpevent_read_sndrcvinfo(const struct sctp_ulpevent *event, 129void sctp_ulpevent_read_sndrcvinfo(const struct sctp_ulpevent *event,
130 struct msghdr *); 130 struct msghdr *);
diff --git a/include/net/sctp/ulpqueue.h b/include/net/sctp/ulpqueue.h
index 961736d29d2..1a60c6d943c 100644
--- a/include/net/sctp/ulpqueue.h
+++ b/include/net/sctp/ulpqueue.h
@@ -62,19 +62,22 @@ struct sctp_ulpq *sctp_ulpq_init(struct sctp_ulpq *,
62void sctp_ulpq_free(struct sctp_ulpq *); 62void sctp_ulpq_free(struct sctp_ulpq *);
63 63
64/* Add a new DATA chunk for processing. */ 64/* Add a new DATA chunk for processing. */
65int sctp_ulpq_tail_data(struct sctp_ulpq *, struct sctp_chunk *, int); 65int sctp_ulpq_tail_data(struct sctp_ulpq *, struct sctp_chunk *,
66 unsigned int __nocast);
66 67
67/* Add a new event for propagation to the ULP. */ 68/* Add a new event for propagation to the ULP. */
68int sctp_ulpq_tail_event(struct sctp_ulpq *, struct sctp_ulpevent *ev); 69int sctp_ulpq_tail_event(struct sctp_ulpq *, struct sctp_ulpevent *ev);
69 70
70/* Renege previously received chunks. */ 71/* Renege previously received chunks. */
71void sctp_ulpq_renege(struct sctp_ulpq *, struct sctp_chunk *, int); 72void sctp_ulpq_renege(struct sctp_ulpq *, struct sctp_chunk *,
73 unsigned int __nocast);
72 74
73/* Perform partial delivery. */ 75/* Perform partial delivery. */
74void sctp_ulpq_partial_delivery(struct sctp_ulpq *, struct sctp_chunk *, int); 76void sctp_ulpq_partial_delivery(struct sctp_ulpq *, struct sctp_chunk *,
77 unsigned int __nocast);
75 78
76/* Abort the partial delivery. */ 79/* Abort the partial delivery. */
77void sctp_ulpq_abort_pd(struct sctp_ulpq *, int); 80void sctp_ulpq_abort_pd(struct sctp_ulpq *, unsigned int __nocast);
78 81
79/* Clear the partial data delivery condition on this socket. */ 82/* Clear the partial data delivery condition on this socket. */
80int sctp_clear_pd(struct sock *sk); 83int sctp_clear_pd(struct sock *sk);
diff --git a/include/net/slhc_vj.h b/include/net/slhc_vj.h
index 0b2c2784f33..8716d5942b6 100644
--- a/include/net/slhc_vj.h
+++ b/include/net/slhc_vj.h
@@ -170,19 +170,14 @@ struct slcompress {
170}; 170};
171#define NULLSLCOMPR (struct slcompress *)0 171#define NULLSLCOMPR (struct slcompress *)0
172 172
173#define __ARGS(x) x
174
175/* In slhc.c: */ 173/* In slhc.c: */
176struct slcompress *slhc_init __ARGS((int rslots, int tslots)); 174struct slcompress *slhc_init(int rslots, int tslots);
177void slhc_free __ARGS((struct slcompress *comp)); 175void slhc_free(struct slcompress *comp);
178 176
179int slhc_compress __ARGS((struct slcompress *comp, unsigned char *icp, 177int slhc_compress(struct slcompress *comp, unsigned char *icp, int isize,
180 int isize, unsigned char *ocp, unsigned char **cpp, 178 unsigned char *ocp, unsigned char **cpp, int compress_cid);
181 int compress_cid)); 179int slhc_uncompress(struct slcompress *comp, unsigned char *icp, int isize);
182int slhc_uncompress __ARGS((struct slcompress *comp, unsigned char *icp, 180int slhc_remember(struct slcompress *comp, unsigned char *icp, int isize);
183 int isize)); 181int slhc_toss(struct slcompress *comp);
184int slhc_remember __ARGS((struct slcompress *comp, unsigned char *icp,
185 int isize));
186int slhc_toss __ARGS((struct slcompress *comp));
187 182
188#endif /* _SLHC_H */ 183#endif /* _SLHC_H */
diff --git a/include/net/sock.h b/include/net/sock.h
index e593af5b1ec..a1042d08bec 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -684,16 +684,17 @@ extern void FASTCALL(release_sock(struct sock *sk));
684#define bh_lock_sock(__sk) spin_lock(&((__sk)->sk_lock.slock)) 684#define bh_lock_sock(__sk) spin_lock(&((__sk)->sk_lock.slock))
685#define bh_unlock_sock(__sk) spin_unlock(&((__sk)->sk_lock.slock)) 685#define bh_unlock_sock(__sk) spin_unlock(&((__sk)->sk_lock.slock))
686 686
687extern struct sock *sk_alloc(int family, int priority, 687extern struct sock *sk_alloc(int family,
688 unsigned int __nocast priority,
688 struct proto *prot, int zero_it); 689 struct proto *prot, int zero_it);
689extern void sk_free(struct sock *sk); 690extern void sk_free(struct sock *sk);
690 691
691extern struct sk_buff *sock_wmalloc(struct sock *sk, 692extern struct sk_buff *sock_wmalloc(struct sock *sk,
692 unsigned long size, int force, 693 unsigned long size, int force,
693 int priority); 694 unsigned int __nocast priority);
694extern struct sk_buff *sock_rmalloc(struct sock *sk, 695extern struct sk_buff *sock_rmalloc(struct sock *sk,
695 unsigned long size, int force, 696 unsigned long size, int force,
696 int priority); 697 unsigned int __nocast priority);
697extern void sock_wfree(struct sk_buff *skb); 698extern void sock_wfree(struct sk_buff *skb);
698extern void sock_rfree(struct sk_buff *skb); 699extern void sock_rfree(struct sk_buff *skb);
699 700
@@ -708,7 +709,8 @@ extern struct sk_buff *sock_alloc_send_skb(struct sock *sk,
708 unsigned long size, 709 unsigned long size,
709 int noblock, 710 int noblock,
710 int *errcode); 711 int *errcode);
711extern void *sock_kmalloc(struct sock *sk, int size, int priority); 712extern void *sock_kmalloc(struct sock *sk, int size,
713 unsigned int __nocast priority);
712extern void sock_kfree_s(struct sock *sk, void *mem, int size); 714extern void sock_kfree_s(struct sock *sk, void *mem, int size);
713extern void sk_send_sigurg(struct sock *sk); 715extern void sk_send_sigurg(struct sock *sk);
714 716
@@ -1132,15 +1134,19 @@ static inline void sk_stream_moderate_sndbuf(struct sock *sk)
1132} 1134}
1133 1135
1134static inline struct sk_buff *sk_stream_alloc_pskb(struct sock *sk, 1136static inline struct sk_buff *sk_stream_alloc_pskb(struct sock *sk,
1135 int size, int mem, int gfp) 1137 int size, int mem,
1138 unsigned int __nocast gfp)
1136{ 1139{
1137 struct sk_buff *skb = alloc_skb(size + sk->sk_prot->max_header, gfp); 1140 struct sk_buff *skb;
1141 int hdr_len;
1138 1142
1143 hdr_len = SKB_DATA_ALIGN(sk->sk_prot->max_header);
1144 skb = alloc_skb(size + hdr_len, gfp);
1139 if (skb) { 1145 if (skb) {
1140 skb->truesize += mem; 1146 skb->truesize += mem;
1141 if (sk->sk_forward_alloc >= (int)skb->truesize || 1147 if (sk->sk_forward_alloc >= (int)skb->truesize ||
1142 sk_stream_mem_schedule(sk, skb->truesize, 0)) { 1148 sk_stream_mem_schedule(sk, skb->truesize, 0)) {
1143 skb_reserve(skb, sk->sk_prot->max_header); 1149 skb_reserve(skb, hdr_len);
1144 return skb; 1150 return skb;
1145 } 1151 }
1146 __kfree_skb(skb); 1152 __kfree_skb(skb);
@@ -1152,7 +1158,8 @@ static inline struct sk_buff *sk_stream_alloc_pskb(struct sock *sk,
1152} 1158}
1153 1159
1154static inline struct sk_buff *sk_stream_alloc_skb(struct sock *sk, 1160static inline struct sk_buff *sk_stream_alloc_skb(struct sock *sk,
1155 int size, int gfp) 1161 int size,
1162 unsigned int __nocast gfp)
1156{ 1163{
1157 return sk_stream_alloc_pskb(sk, size, 0, gfp); 1164 return sk_stream_alloc_pskb(sk, size, 0, gfp);
1158} 1165}
@@ -1185,7 +1192,7 @@ static inline int sock_writeable(const struct sock *sk)
1185 return atomic_read(&sk->sk_wmem_alloc) < (sk->sk_sndbuf / 2); 1192 return atomic_read(&sk->sk_wmem_alloc) < (sk->sk_sndbuf / 2);
1186} 1193}
1187 1194
1188static inline int gfp_any(void) 1195static inline unsigned int __nocast gfp_any(void)
1189{ 1196{
1190 return in_softirq() ? GFP_ATOMIC : GFP_KERNEL; 1197 return in_softirq() ? GFP_ATOMIC : GFP_KERNEL;
1191} 1198}
diff --git a/include/net/tcp.h b/include/net/tcp.h
index ec9e20c2717..f4f9aba07ac 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -721,11 +721,16 @@ static inline int tcp_ack_scheduled(struct tcp_sock *tp)
721 return tp->ack.pending&TCP_ACK_SCHED; 721 return tp->ack.pending&TCP_ACK_SCHED;
722} 722}
723 723
724static __inline__ void tcp_dec_quickack_mode(struct tcp_sock *tp) 724static __inline__ void tcp_dec_quickack_mode(struct tcp_sock *tp, unsigned int pkts)
725{ 725{
726 if (tp->ack.quick && --tp->ack.quick == 0) { 726 if (tp->ack.quick) {
727 /* Leaving quickack mode we deflate ATO. */ 727 if (pkts >= tp->ack.quick) {
728 tp->ack.ato = TCP_ATO_MIN; 728 tp->ack.quick = 0;
729
730 /* Leaving quickack mode we deflate ATO. */
731 tp->ack.ato = TCP_ATO_MIN;
732 } else
733 tp->ack.quick -= pkts;
729 } 734 }
730} 735}
731 736
@@ -843,7 +848,9 @@ extern __u32 cookie_v4_init_sequence(struct sock *sk, struct sk_buff *skb,
843 848
844/* tcp_output.c */ 849/* tcp_output.c */
845 850
846extern int tcp_write_xmit(struct sock *, int nonagle); 851extern void __tcp_push_pending_frames(struct sock *sk, struct tcp_sock *tp,
852 unsigned int cur_mss, int nonagle);
853extern int tcp_may_send_now(struct sock *sk, struct tcp_sock *tp);
847extern int tcp_retransmit_skb(struct sock *, struct sk_buff *); 854extern int tcp_retransmit_skb(struct sock *, struct sk_buff *);
848extern void tcp_xmit_retransmit_queue(struct sock *); 855extern void tcp_xmit_retransmit_queue(struct sock *);
849extern void tcp_simple_retransmit(struct sock *); 856extern void tcp_simple_retransmit(struct sock *);
@@ -853,12 +860,16 @@ extern void tcp_send_probe0(struct sock *);
853extern void tcp_send_partial(struct sock *); 860extern void tcp_send_partial(struct sock *);
854extern int tcp_write_wakeup(struct sock *); 861extern int tcp_write_wakeup(struct sock *);
855extern void tcp_send_fin(struct sock *sk); 862extern void tcp_send_fin(struct sock *sk);
856extern void tcp_send_active_reset(struct sock *sk, int priority); 863extern void tcp_send_active_reset(struct sock *sk,
864 unsigned int __nocast priority);
857extern int tcp_send_synack(struct sock *); 865extern int tcp_send_synack(struct sock *);
858extern void tcp_push_one(struct sock *, unsigned mss_now); 866extern void tcp_push_one(struct sock *, unsigned int mss_now);
859extern void tcp_send_ack(struct sock *sk); 867extern void tcp_send_ack(struct sock *sk);
860extern void tcp_send_delayed_ack(struct sock *sk); 868extern void tcp_send_delayed_ack(struct sock *sk);
861 869
870/* tcp_input.c */
871extern void tcp_cwnd_application_limited(struct sock *sk);
872
862/* tcp_timer.c */ 873/* tcp_timer.c */
863extern void tcp_init_xmit_timers(struct sock *); 874extern void tcp_init_xmit_timers(struct sock *);
864extern void tcp_clear_xmit_timers(struct sock *); 875extern void tcp_clear_xmit_timers(struct sock *);
@@ -958,7 +969,7 @@ static inline void tcp_reset_xmit_timer(struct sock *sk, int what, unsigned long
958static inline void tcp_initialize_rcv_mss(struct sock *sk) 969static inline void tcp_initialize_rcv_mss(struct sock *sk)
959{ 970{
960 struct tcp_sock *tp = tcp_sk(sk); 971 struct tcp_sock *tp = tcp_sk(sk);
961 unsigned int hint = min(tp->advmss, tp->mss_cache_std); 972 unsigned int hint = min_t(unsigned int, tp->advmss, tp->mss_cache);
962 973
963 hint = min(hint, tp->rcv_wnd/2); 974 hint = min(hint, tp->rcv_wnd/2);
964 hint = min(hint, TCP_MIN_RCVMSS); 975 hint = min(hint, TCP_MIN_RCVMSS);
@@ -981,7 +992,7 @@ static __inline__ void tcp_fast_path_on(struct tcp_sock *tp)
981 992
982static inline void tcp_fast_path_check(struct sock *sk, struct tcp_sock *tp) 993static inline void tcp_fast_path_check(struct sock *sk, struct tcp_sock *tp)
983{ 994{
984 if (skb_queue_len(&tp->out_of_order_queue) == 0 && 995 if (skb_queue_empty(&tp->out_of_order_queue) &&
985 tp->rcv_wnd && 996 tp->rcv_wnd &&
986 atomic_read(&sk->sk_rmem_alloc) < sk->sk_rcvbuf && 997 atomic_read(&sk->sk_rmem_alloc) < sk->sk_rcvbuf &&
987 !tp->urg_data) 998 !tp->urg_data)
@@ -1225,28 +1236,6 @@ static inline void tcp_sync_left_out(struct tcp_sock *tp)
1225 tp->left_out = tp->sacked_out + tp->lost_out; 1236 tp->left_out = tp->sacked_out + tp->lost_out;
1226} 1237}
1227 1238
1228extern void tcp_cwnd_application_limited(struct sock *sk);
1229
1230/* Congestion window validation. (RFC2861) */
1231
1232static inline void tcp_cwnd_validate(struct sock *sk, struct tcp_sock *tp)
1233{
1234 __u32 packets_out = tp->packets_out;
1235
1236 if (packets_out >= tp->snd_cwnd) {
1237 /* Network is feed fully. */
1238 tp->snd_cwnd_used = 0;
1239 tp->snd_cwnd_stamp = tcp_time_stamp;
1240 } else {
1241 /* Network starves. */
1242 if (tp->packets_out > tp->snd_cwnd_used)
1243 tp->snd_cwnd_used = tp->packets_out;
1244
1245 if ((s32)(tcp_time_stamp - tp->snd_cwnd_stamp) >= tp->rto)
1246 tcp_cwnd_application_limited(sk);
1247 }
1248}
1249
1250/* Set slow start threshould and cwnd not falling to slow start */ 1239/* Set slow start threshould and cwnd not falling to slow start */
1251static inline void __tcp_enter_cwr(struct tcp_sock *tp) 1240static inline void __tcp_enter_cwr(struct tcp_sock *tp)
1252{ 1241{
@@ -1279,12 +1268,6 @@ static __inline__ __u32 tcp_max_burst(const struct tcp_sock *tp)
1279 return 3; 1268 return 3;
1280} 1269}
1281 1270
1282static __inline__ int tcp_minshall_check(const struct tcp_sock *tp)
1283{
1284 return after(tp->snd_sml,tp->snd_una) &&
1285 !after(tp->snd_sml, tp->snd_nxt);
1286}
1287
1288static __inline__ void tcp_minshall_update(struct tcp_sock *tp, int mss, 1271static __inline__ void tcp_minshall_update(struct tcp_sock *tp, int mss,
1289 const struct sk_buff *skb) 1272 const struct sk_buff *skb)
1290{ 1273{
@@ -1292,122 +1275,18 @@ static __inline__ void tcp_minshall_update(struct tcp_sock *tp, int mss,
1292 tp->snd_sml = TCP_SKB_CB(skb)->end_seq; 1275 tp->snd_sml = TCP_SKB_CB(skb)->end_seq;
1293} 1276}
1294 1277
1295/* Return 0, if packet can be sent now without violation Nagle's rules:
1296 1. It is full sized.
1297 2. Or it contains FIN.
1298 3. Or TCP_NODELAY was set.
1299 4. Or TCP_CORK is not set, and all sent packets are ACKed.
1300 With Minshall's modification: all sent small packets are ACKed.
1301 */
1302
1303static __inline__ int
1304tcp_nagle_check(const struct tcp_sock *tp, const struct sk_buff *skb,
1305 unsigned mss_now, int nonagle)
1306{
1307 return (skb->len < mss_now &&
1308 !(TCP_SKB_CB(skb)->flags & TCPCB_FLAG_FIN) &&
1309 ((nonagle&TCP_NAGLE_CORK) ||
1310 (!nonagle &&
1311 tp->packets_out &&
1312 tcp_minshall_check(tp))));
1313}
1314
1315extern void tcp_set_skb_tso_segs(struct sock *, struct sk_buff *);
1316
1317/* This checks if the data bearing packet SKB (usually sk->sk_send_head)
1318 * should be put on the wire right now.
1319 */
1320static __inline__ int tcp_snd_test(struct sock *sk,
1321 struct sk_buff *skb,
1322 unsigned cur_mss, int nonagle)
1323{
1324 struct tcp_sock *tp = tcp_sk(sk);
1325 int pkts = tcp_skb_pcount(skb);
1326
1327 if (!pkts) {
1328 tcp_set_skb_tso_segs(sk, skb);
1329 pkts = tcp_skb_pcount(skb);
1330 }
1331
1332 /* RFC 1122 - section 4.2.3.4
1333 *
1334 * We must queue if
1335 *
1336 * a) The right edge of this frame exceeds the window
1337 * b) There are packets in flight and we have a small segment
1338 * [SWS avoidance and Nagle algorithm]
1339 * (part of SWS is done on packetization)
1340 * Minshall version sounds: there are no _small_
1341 * segments in flight. (tcp_nagle_check)
1342 * c) We have too many packets 'in flight'
1343 *
1344 * Don't use the nagle rule for urgent data (or
1345 * for the final FIN -DaveM).
1346 *
1347 * Also, Nagle rule does not apply to frames, which
1348 * sit in the middle of queue (they have no chances
1349 * to get new data) and if room at tail of skb is
1350 * not enough to save something seriously (<32 for now).
1351 */
1352
1353 /* Don't be strict about the congestion window for the
1354 * final FIN frame. -DaveM
1355 */
1356 return (((nonagle&TCP_NAGLE_PUSH) || tp->urg_mode
1357 || !tcp_nagle_check(tp, skb, cur_mss, nonagle)) &&
1358 (((tcp_packets_in_flight(tp) + (pkts-1)) < tp->snd_cwnd) ||
1359 (TCP_SKB_CB(skb)->flags & TCPCB_FLAG_FIN)) &&
1360 !after(TCP_SKB_CB(skb)->end_seq, tp->snd_una + tp->snd_wnd));
1361}
1362
1363static __inline__ void tcp_check_probe_timer(struct sock *sk, struct tcp_sock *tp) 1278static __inline__ void tcp_check_probe_timer(struct sock *sk, struct tcp_sock *tp)
1364{ 1279{
1365 if (!tp->packets_out && !tp->pending) 1280 if (!tp->packets_out && !tp->pending)
1366 tcp_reset_xmit_timer(sk, TCP_TIME_PROBE0, tp->rto); 1281 tcp_reset_xmit_timer(sk, TCP_TIME_PROBE0, tp->rto);
1367} 1282}
1368 1283
1369static __inline__ int tcp_skb_is_last(const struct sock *sk,
1370 const struct sk_buff *skb)
1371{
1372 return skb->next == (struct sk_buff *)&sk->sk_write_queue;
1373}
1374
1375/* Push out any pending frames which were held back due to
1376 * TCP_CORK or attempt at coalescing tiny packets.
1377 * The socket must be locked by the caller.
1378 */
1379static __inline__ void __tcp_push_pending_frames(struct sock *sk,
1380 struct tcp_sock *tp,
1381 unsigned cur_mss,
1382 int nonagle)
1383{
1384 struct sk_buff *skb = sk->sk_send_head;
1385
1386 if (skb) {
1387 if (!tcp_skb_is_last(sk, skb))
1388 nonagle = TCP_NAGLE_PUSH;
1389 if (!tcp_snd_test(sk, skb, cur_mss, nonagle) ||
1390 tcp_write_xmit(sk, nonagle))
1391 tcp_check_probe_timer(sk, tp);
1392 }
1393 tcp_cwnd_validate(sk, tp);
1394}
1395
1396static __inline__ void tcp_push_pending_frames(struct sock *sk, 1284static __inline__ void tcp_push_pending_frames(struct sock *sk,
1397 struct tcp_sock *tp) 1285 struct tcp_sock *tp)
1398{ 1286{
1399 __tcp_push_pending_frames(sk, tp, tcp_current_mss(sk, 1), tp->nonagle); 1287 __tcp_push_pending_frames(sk, tp, tcp_current_mss(sk, 1), tp->nonagle);
1400} 1288}
1401 1289
1402static __inline__ int tcp_may_send_now(struct sock *sk, struct tcp_sock *tp)
1403{
1404 struct sk_buff *skb = sk->sk_send_head;
1405
1406 return (skb &&
1407 tcp_snd_test(sk, skb, tcp_current_mss(sk, 1),
1408 tcp_skb_is_last(sk, skb) ? TCP_NAGLE_PUSH : tp->nonagle));
1409}
1410
1411static __inline__ void tcp_init_wl(struct tcp_sock *tp, u32 ack, u32 seq) 1290static __inline__ void tcp_init_wl(struct tcp_sock *tp, u32 ack, u32 seq)
1412{ 1291{
1413 tp->snd_wl1 = seq; 1292 tp->snd_wl1 = seq;
diff --git a/include/net/x25device.h b/include/net/x25device.h
index cf36a20ea3c..d45ae883bd1 100644
--- a/include/net/x25device.h
+++ b/include/net/x25device.h
@@ -5,8 +5,7 @@
5#include <linux/if_packet.h> 5#include <linux/if_packet.h>
6#include <linux/skbuff.h> 6#include <linux/skbuff.h>
7 7
8static inline unsigned short x25_type_trans(struct sk_buff *skb, 8static inline __be16 x25_type_trans(struct sk_buff *skb, struct net_device *dev)
9 struct net_device *dev)
10{ 9{
11 skb->mac.raw = skb->data; 10 skb->mac.raw = skb->data;
12 skb->input_dev = skb->dev = dev; 11 skb->input_dev = skb->dev = dev;
diff --git a/include/pcmcia/cs.h b/include/pcmcia/cs.h
index b42ddc0c114..2cab39f49eb 100644
--- a/include/pcmcia/cs.h
+++ b/include/pcmcia/cs.h
@@ -68,21 +68,9 @@ typedef struct adjust_t {
68#define RES_ALLOCATED 0x20 68#define RES_ALLOCATED 0x20
69#define RES_REMOVED 0x40 69#define RES_REMOVED 0x40
70 70
71typedef struct servinfo_t {
72 char Signature[2];
73 u_int Count;
74 u_int Revision;
75 u_int CSLevel;
76 char *VendorString;
77} servinfo_t;
78
79typedef struct event_callback_args_t { 71typedef struct event_callback_args_t {
80 client_handle_t client_handle; 72 struct pcmcia_device *client_handle;
81 void *info; 73 void *client_data;
82 void *mtdrequest;
83 void *buffer;
84 void *misc;
85 void *client_data;
86} event_callback_args_t; 74} event_callback_args_t;
87 75
88/* for GetConfigurationInfo */ 76/* for GetConfigurationInfo */
@@ -393,25 +381,25 @@ enum service {
393 381
394struct pcmcia_socket; 382struct pcmcia_socket;
395 383
396int pcmcia_access_configuration_register(client_handle_t handle, conf_reg_t *reg); 384int pcmcia_access_configuration_register(struct pcmcia_device *p_dev, conf_reg_t *reg);
397int pcmcia_deregister_client(client_handle_t handle); 385int pcmcia_deregister_client(struct pcmcia_device *p_dev);
398int pcmcia_get_configuration_info(client_handle_t handle, config_info_t *config); 386int pcmcia_get_configuration_info(struct pcmcia_device *p_dev, config_info_t *config);
399int pcmcia_get_first_window(window_handle_t *win, win_req_t *req); 387int pcmcia_get_first_window(window_handle_t *win, win_req_t *req);
400int pcmcia_get_next_window(window_handle_t *win, win_req_t *req); 388int pcmcia_get_next_window(window_handle_t *win, win_req_t *req);
401int pcmcia_get_status(client_handle_t handle, cs_status_t *status); 389int pcmcia_get_status(struct pcmcia_device *p_dev, cs_status_t *status);
402int pcmcia_get_mem_page(window_handle_t win, memreq_t *req); 390int pcmcia_get_mem_page(window_handle_t win, memreq_t *req);
403int pcmcia_map_mem_page(window_handle_t win, memreq_t *req); 391int pcmcia_map_mem_page(window_handle_t win, memreq_t *req);
404int pcmcia_modify_configuration(client_handle_t handle, modconf_t *mod); 392int pcmcia_modify_configuration(struct pcmcia_device *p_dev, modconf_t *mod);
405int pcmcia_register_client(client_handle_t *handle, client_reg_t *req); 393int pcmcia_register_client(client_handle_t *handle, client_reg_t *req);
406int pcmcia_release_configuration(client_handle_t handle); 394int pcmcia_release_configuration(struct pcmcia_device *p_dev);
407int pcmcia_release_io(client_handle_t handle, io_req_t *req); 395int pcmcia_release_io(struct pcmcia_device *p_dev, io_req_t *req);
408int pcmcia_release_irq(client_handle_t handle, irq_req_t *req); 396int pcmcia_release_irq(struct pcmcia_device *p_dev, irq_req_t *req);
409int pcmcia_release_window(window_handle_t win); 397int pcmcia_release_window(window_handle_t win);
410int pcmcia_request_configuration(client_handle_t handle, config_req_t *req); 398int pcmcia_request_configuration(struct pcmcia_device *p_dev, config_req_t *req);
411int pcmcia_request_io(client_handle_t handle, io_req_t *req); 399int pcmcia_request_io(struct pcmcia_device *p_dev, io_req_t *req);
412int pcmcia_request_irq(client_handle_t handle, irq_req_t *req); 400int pcmcia_request_irq(struct pcmcia_device *p_dev, irq_req_t *req);
413int pcmcia_request_window(client_handle_t *handle, win_req_t *req, window_handle_t *wh); 401int pcmcia_request_window(struct pcmcia_device **p_dev, win_req_t *req, window_handle_t *wh);
414int pcmcia_reset_card(client_handle_t handle, client_req_t *req); 402int pcmcia_reset_card(struct pcmcia_device *p_dev, client_req_t *req);
415int pcmcia_suspend_card(struct pcmcia_socket *skt); 403int pcmcia_suspend_card(struct pcmcia_socket *skt);
416int pcmcia_resume_card(struct pcmcia_socket *skt); 404int pcmcia_resume_card(struct pcmcia_socket *skt);
417int pcmcia_eject_card(struct pcmcia_socket *skt); 405int pcmcia_eject_card(struct pcmcia_socket *skt);
diff --git a/include/pcmcia/cs_types.h b/include/pcmcia/cs_types.h
index 7881d40aac8..c1d1629fcd2 100644
--- a/include/pcmcia/cs_types.h
+++ b/include/pcmcia/cs_types.h
@@ -34,8 +34,8 @@ typedef u_int event_t;
34typedef u_char cisdata_t; 34typedef u_char cisdata_t;
35typedef u_short page_t; 35typedef u_short page_t;
36 36
37struct client_t; 37struct pcmcia_device;
38typedef struct client_t *client_handle_t; 38typedef struct pcmcia_device *client_handle_t;
39 39
40struct window_t; 40struct window_t;
41typedef struct window_t *window_handle_t; 41typedef struct window_t *window_handle_t;
diff --git a/include/pcmcia/ds.h b/include/pcmcia/ds.h
index 2b52553f2d9..b707a603351 100644
--- a/include/pcmcia/ds.h
+++ b/include/pcmcia/ds.h
@@ -16,10 +16,13 @@
16#ifndef _LINUX_DS_H 16#ifndef _LINUX_DS_H
17#define _LINUX_DS_H 17#define _LINUX_DS_H
18 18
19#ifdef __KERNEL__
20#include <linux/mod_devicetable.h>
21#endif
22
19#include <pcmcia/bulkmem.h> 23#include <pcmcia/bulkmem.h>
20#include <pcmcia/cs_types.h> 24#include <pcmcia/cs_types.h>
21#include <pcmcia/device_id.h> 25#include <pcmcia/device_id.h>
22#include <linux/mod_devicetable.h>
23 26
24typedef struct tuple_parse_t { 27typedef struct tuple_parse_t {
25 tuple_t tuple; 28 tuple_t tuple;
@@ -49,7 +52,6 @@ typedef struct mtd_info_t {
49} mtd_info_t; 52} mtd_info_t;
50 53
51typedef union ds_ioctl_arg_t { 54typedef union ds_ioctl_arg_t {
52 servinfo_t servinfo;
53 adjust_t adjust; 55 adjust_t adjust;
54 config_info_t config; 56 config_info_t config;
55 tuple_t tuple; 57 tuple_t tuple;
@@ -65,7 +67,6 @@ typedef union ds_ioctl_arg_t {
65 cisdump_t cisdump; 67 cisdump_t cisdump;
66} ds_ioctl_arg_t; 68} ds_ioctl_arg_t;
67 69
68#define DS_GET_CARD_SERVICES_INFO _IOR ('d', 1, servinfo_t)
69#define DS_ADJUST_RESOURCE_INFO _IOWR('d', 2, adjust_t) 70#define DS_ADJUST_RESOURCE_INFO _IOWR('d', 2, adjust_t)
70#define DS_GET_CONFIGURATION_INFO _IOWR('d', 3, config_info_t) 71#define DS_GET_CONFIGURATION_INFO _IOWR('d', 3, config_info_t)
71#define DS_GET_FIRST_TUPLE _IOWR('d', 4, tuple_t) 72#define DS_GET_FIRST_TUPLE _IOWR('d', 4, tuple_t)
@@ -133,6 +134,8 @@ struct pcmcia_socket;
133 134
134struct pcmcia_driver { 135struct pcmcia_driver {
135 dev_link_t *(*attach)(void); 136 dev_link_t *(*attach)(void);
137 int (*event) (event_t event, int priority,
138 event_callback_args_t *);
136 void (*detach)(dev_link_t *); 139 void (*detach)(dev_link_t *);
137 struct module *owner; 140 struct module *owner;
138 struct pcmcia_device_id *id_table; 141 struct pcmcia_device_id *id_table;
@@ -159,16 +162,8 @@ struct pcmcia_device {
159 /* deprecated, a cleaned up version will be moved into this 162 /* deprecated, a cleaned up version will be moved into this
160 struct soon */ 163 struct soon */
161 dev_link_t *instance; 164 dev_link_t *instance;
162 struct client_t { 165 event_callback_args_t event_callback_args;
163 u_short client_magic; 166 u_int state;
164 struct pcmcia_socket *Socket;
165 u_char Function;
166 u_int state;
167 event_t EventMask;
168 int (*event_handler) (event_t event, int priority,
169 event_callback_args_t *);
170 event_callback_args_t event_callback_args;
171 } client;
172 167
173 /* information about this device */ 168 /* information about this device */
174 u8 has_manf_id:1; 169 u8 has_manf_id:1;
@@ -193,8 +188,8 @@ struct pcmcia_device {
193#define to_pcmcia_dev(n) container_of(n, struct pcmcia_device, dev) 188#define to_pcmcia_dev(n) container_of(n, struct pcmcia_device, dev)
194#define to_pcmcia_drv(n) container_of(n, struct pcmcia_driver, drv) 189#define to_pcmcia_drv(n) container_of(n, struct pcmcia_driver, drv)
195 190
196#define handle_to_pdev(handle) container_of(handle, struct pcmcia_device, client); 191#define handle_to_pdev(handle) (handle)
197#define handle_to_dev(handle) ((container_of(handle, struct pcmcia_device, client))->dev) 192#define handle_to_dev(handle) (handle->dev)
198 193
199/* error reporting */ 194/* error reporting */
200void cs_error(client_handle_t handle, int func, int ret); 195void cs_error(client_handle_t handle, int func, int ret);
diff --git a/include/pcmcia/version.h b/include/pcmcia/version.h
index eb88263fc8d..5ad9c5e198b 100644
--- a/include/pcmcia/version.h
+++ b/include/pcmcia/version.h
@@ -1,4 +1,3 @@
1/* version.h 1.94 2000/10/03 17:55:48 (David Hinds) */ 1/* version.h 1.94 2000/10/03 17:55:48 (David Hinds) */
2 2
3#define CS_RELEASE "3.1.22" 3/* This file will be removed, please don't include it */
4#define CS_RELEASE_CODE 0x3116