diff options
author | David S. Miller <davem@davemloft.net> | 2009-03-29 04:40:34 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-03-29 04:40:34 -0400 |
commit | 13223cb02ccfa375f2d683d08d30db5b72264f1e (patch) | |
tree | d3fc7d803d22bbfe03b96cf0ba38041d42c8a1c2 /include | |
parent | 1383bdb98c01bbd28d72336d1bf614ce79114d29 (diff) | |
parent | 07d43ba98621f08e252a48c96b258b4d572b0257 (diff) |
Merge branch 'master' of /home/davem/src/GIT/linux-2.6/
Diffstat (limited to 'include')
63 files changed, 3029 insertions, 331 deletions
diff --git a/include/acpi/acpiosxf.h b/include/acpi/acpiosxf.h index a62720a7edc0..ab0b85cf21f3 100644 --- a/include/acpi/acpiosxf.h +++ b/include/acpi/acpiosxf.h | |||
@@ -144,6 +144,7 @@ void __iomem *acpi_os_map_memory(acpi_physical_address where, | |||
144 | acpi_size length); | 144 | acpi_size length); |
145 | 145 | ||
146 | void acpi_os_unmap_memory(void __iomem * logical_address, acpi_size size); | 146 | void acpi_os_unmap_memory(void __iomem * logical_address, acpi_size size); |
147 | void early_acpi_os_unmap_memory(void __iomem * virt, acpi_size size); | ||
147 | 148 | ||
148 | #ifdef ACPI_FUTURE_USAGE | 149 | #ifdef ACPI_FUTURE_USAGE |
149 | acpi_status | 150 | acpi_status |
diff --git a/include/acpi/acpixf.h b/include/acpi/acpixf.h index c8e8cf45830f..cc40102fe2f3 100644 --- a/include/acpi/acpixf.h +++ b/include/acpi/acpixf.h | |||
@@ -130,6 +130,10 @@ acpi_get_table_header(acpi_string signature, | |||
130 | struct acpi_table_header *out_table_header); | 130 | struct acpi_table_header *out_table_header); |
131 | 131 | ||
132 | acpi_status | 132 | acpi_status |
133 | acpi_get_table_with_size(acpi_string signature, | ||
134 | u32 instance, struct acpi_table_header **out_table, | ||
135 | acpi_size *tbl_size); | ||
136 | acpi_status | ||
133 | acpi_get_table(acpi_string signature, | 137 | acpi_get_table(acpi_string signature, |
134 | u32 instance, struct acpi_table_header **out_table); | 138 | u32 instance, struct acpi_table_header **out_table); |
135 | 139 | ||
diff --git a/include/asm-generic/percpu.h b/include/asm-generic/percpu.h index b0e63c672ebd..00f45ff081a6 100644 --- a/include/asm-generic/percpu.h +++ b/include/asm-generic/percpu.h | |||
@@ -80,4 +80,56 @@ extern void setup_per_cpu_areas(void); | |||
80 | #define DECLARE_PER_CPU(type, name) extern PER_CPU_ATTRIBUTES \ | 80 | #define DECLARE_PER_CPU(type, name) extern PER_CPU_ATTRIBUTES \ |
81 | __typeof__(type) per_cpu_var(name) | 81 | __typeof__(type) per_cpu_var(name) |
82 | 82 | ||
83 | /* | ||
84 | * Optional methods for optimized non-lvalue per-cpu variable access. | ||
85 | * | ||
86 | * @var can be a percpu variable or a field of it and its size should | ||
87 | * equal char, int or long. percpu_read() evaluates to a lvalue and | ||
88 | * all others to void. | ||
89 | * | ||
90 | * These operations are guaranteed to be atomic w.r.t. preemption. | ||
91 | * The generic versions use plain get/put_cpu_var(). Archs are | ||
92 | * encouraged to implement single-instruction alternatives which don't | ||
93 | * require preemption protection. | ||
94 | */ | ||
95 | #ifndef percpu_read | ||
96 | # define percpu_read(var) \ | ||
97 | ({ \ | ||
98 | typeof(per_cpu_var(var)) __tmp_var__; \ | ||
99 | __tmp_var__ = get_cpu_var(var); \ | ||
100 | put_cpu_var(var); \ | ||
101 | __tmp_var__; \ | ||
102 | }) | ||
103 | #endif | ||
104 | |||
105 | #define __percpu_generic_to_op(var, val, op) \ | ||
106 | do { \ | ||
107 | get_cpu_var(var) op val; \ | ||
108 | put_cpu_var(var); \ | ||
109 | } while (0) | ||
110 | |||
111 | #ifndef percpu_write | ||
112 | # define percpu_write(var, val) __percpu_generic_to_op(var, (val), =) | ||
113 | #endif | ||
114 | |||
115 | #ifndef percpu_add | ||
116 | # define percpu_add(var, val) __percpu_generic_to_op(var, (val), +=) | ||
117 | #endif | ||
118 | |||
119 | #ifndef percpu_sub | ||
120 | # define percpu_sub(var, val) __percpu_generic_to_op(var, (val), -=) | ||
121 | #endif | ||
122 | |||
123 | #ifndef percpu_and | ||
124 | # define percpu_and(var, val) __percpu_generic_to_op(var, (val), &=) | ||
125 | #endif | ||
126 | |||
127 | #ifndef percpu_or | ||
128 | # define percpu_or(var, val) __percpu_generic_to_op(var, (val), |=) | ||
129 | #endif | ||
130 | |||
131 | #ifndef percpu_xor | ||
132 | # define percpu_xor(var, val) __percpu_generic_to_op(var, (val), ^=) | ||
133 | #endif | ||
134 | |||
83 | #endif /* _ASM_GENERIC_PERCPU_H_ */ | 135 | #endif /* _ASM_GENERIC_PERCPU_H_ */ |
diff --git a/include/asm-generic/sections.h b/include/asm-generic/sections.h index 79a7ff925bf8..4ce48e878530 100644 --- a/include/asm-generic/sections.h +++ b/include/asm-generic/sections.h | |||
@@ -9,7 +9,7 @@ extern char __bss_start[], __bss_stop[]; | |||
9 | extern char __init_begin[], __init_end[]; | 9 | extern char __init_begin[], __init_end[]; |
10 | extern char _sinittext[], _einittext[]; | 10 | extern char _sinittext[], _einittext[]; |
11 | extern char _end[]; | 11 | extern char _end[]; |
12 | extern char __per_cpu_start[], __per_cpu_end[]; | 12 | extern char __per_cpu_load[], __per_cpu_start[], __per_cpu_end[]; |
13 | extern char __kprobes_text_start[], __kprobes_text_end[]; | 13 | extern char __kprobes_text_start[], __kprobes_text_end[]; |
14 | extern char __initdata_begin[], __initdata_end[]; | 14 | extern char __initdata_begin[], __initdata_end[]; |
15 | extern char __start_rodata[], __end_rodata[]; | 15 | extern char __start_rodata[], __end_rodata[]; |
diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h index aca40b93bd28..a654d724d3b0 100644 --- a/include/asm-generic/vmlinux.lds.h +++ b/include/asm-generic/vmlinux.lds.h | |||
@@ -427,12 +427,59 @@ | |||
427 | *(.initcall7.init) \ | 427 | *(.initcall7.init) \ |
428 | *(.initcall7s.init) | 428 | *(.initcall7s.init) |
429 | 429 | ||
430 | /** | ||
431 | * PERCPU_VADDR - define output section for percpu area | ||
432 | * @vaddr: explicit base address (optional) | ||
433 | * @phdr: destination PHDR (optional) | ||
434 | * | ||
435 | * Macro which expands to output section for percpu area. If @vaddr | ||
436 | * is not blank, it specifies explicit base address and all percpu | ||
437 | * symbols will be offset from the given address. If blank, @vaddr | ||
438 | * always equals @laddr + LOAD_OFFSET. | ||
439 | * | ||
440 | * @phdr defines the output PHDR to use if not blank. Be warned that | ||
441 | * output PHDR is sticky. If @phdr is specified, the next output | ||
442 | * section in the linker script will go there too. @phdr should have | ||
443 | * a leading colon. | ||
444 | * | ||
445 | * Note that this macros defines __per_cpu_load as an absolute symbol. | ||
446 | * If there is no need to put the percpu section at a predetermined | ||
447 | * address, use PERCPU(). | ||
448 | */ | ||
449 | #define PERCPU_VADDR(vaddr, phdr) \ | ||
450 | VMLINUX_SYMBOL(__per_cpu_load) = .; \ | ||
451 | .data.percpu vaddr : AT(VMLINUX_SYMBOL(__per_cpu_load) \ | ||
452 | - LOAD_OFFSET) { \ | ||
453 | VMLINUX_SYMBOL(__per_cpu_start) = .; \ | ||
454 | *(.data.percpu.first) \ | ||
455 | *(.data.percpu.page_aligned) \ | ||
456 | *(.data.percpu) \ | ||
457 | *(.data.percpu.shared_aligned) \ | ||
458 | VMLINUX_SYMBOL(__per_cpu_end) = .; \ | ||
459 | } phdr \ | ||
460 | . = VMLINUX_SYMBOL(__per_cpu_load) + SIZEOF(.data.percpu); | ||
461 | |||
462 | /** | ||
463 | * PERCPU - define output section for percpu area, simple version | ||
464 | * @align: required alignment | ||
465 | * | ||
466 | * Align to @align and outputs output section for percpu area. This | ||
467 | * macro doesn't maniuplate @vaddr or @phdr and __per_cpu_load and | ||
468 | * __per_cpu_start will be identical. | ||
469 | * | ||
470 | * This macro is equivalent to ALIGN(align); PERCPU_VADDR( , ) except | ||
471 | * that __per_cpu_load is defined as a relative symbol against | ||
472 | * .data.percpu which is required for relocatable x86_32 | ||
473 | * configuration. | ||
474 | */ | ||
430 | #define PERCPU(align) \ | 475 | #define PERCPU(align) \ |
431 | . = ALIGN(align); \ | 476 | . = ALIGN(align); \ |
432 | VMLINUX_SYMBOL(__per_cpu_start) = .; \ | 477 | .data.percpu : AT(ADDR(.data.percpu) - LOAD_OFFSET) { \ |
433 | .data.percpu : AT(ADDR(.data.percpu) - LOAD_OFFSET) { \ | 478 | VMLINUX_SYMBOL(__per_cpu_load) = .; \ |
479 | VMLINUX_SYMBOL(__per_cpu_start) = .; \ | ||
480 | *(.data.percpu.first) \ | ||
434 | *(.data.percpu.page_aligned) \ | 481 | *(.data.percpu.page_aligned) \ |
435 | *(.data.percpu) \ | 482 | *(.data.percpu) \ |
436 | *(.data.percpu.shared_aligned) \ | 483 | *(.data.percpu.shared_aligned) \ |
437 | } \ | 484 | VMLINUX_SYMBOL(__per_cpu_end) = .; \ |
438 | VMLINUX_SYMBOL(__per_cpu_end) = .; | 485 | } |
diff --git a/include/drm/drmP.h b/include/drm/drmP.h index e5f4ae989abf..c19a93c3be85 100644 --- a/include/drm/drmP.h +++ b/include/drm/drmP.h | |||
@@ -758,6 +758,8 @@ struct drm_driver { | |||
758 | 758 | ||
759 | int (*proc_init)(struct drm_minor *minor); | 759 | int (*proc_init)(struct drm_minor *minor); |
760 | void (*proc_cleanup)(struct drm_minor *minor); | 760 | void (*proc_cleanup)(struct drm_minor *minor); |
761 | int (*debugfs_init)(struct drm_minor *minor); | ||
762 | void (*debugfs_cleanup)(struct drm_minor *minor); | ||
761 | 763 | ||
762 | /** | 764 | /** |
763 | * Driver-specific constructor for drm_gem_objects, to set up | 765 | * Driver-specific constructor for drm_gem_objects, to set up |
@@ -793,6 +795,48 @@ struct drm_driver { | |||
793 | #define DRM_MINOR_CONTROL 2 | 795 | #define DRM_MINOR_CONTROL 2 |
794 | #define DRM_MINOR_RENDER 3 | 796 | #define DRM_MINOR_RENDER 3 |
795 | 797 | ||
798 | |||
799 | /** | ||
800 | * debugfs node list. This structure represents a debugfs file to | ||
801 | * be created by the drm core | ||
802 | */ | ||
803 | struct drm_debugfs_list { | ||
804 | const char *name; /** file name */ | ||
805 | int (*show)(struct seq_file*, void*); /** show callback */ | ||
806 | u32 driver_features; /**< Required driver features for this entry */ | ||
807 | }; | ||
808 | |||
809 | /** | ||
810 | * debugfs node structure. This structure represents a debugfs file. | ||
811 | */ | ||
812 | struct drm_debugfs_node { | ||
813 | struct list_head list; | ||
814 | struct drm_minor *minor; | ||
815 | struct drm_debugfs_list *debugfs_ent; | ||
816 | struct dentry *dent; | ||
817 | }; | ||
818 | |||
819 | /** | ||
820 | * Info file list entry. This structure represents a debugfs or proc file to | ||
821 | * be created by the drm core | ||
822 | */ | ||
823 | struct drm_info_list { | ||
824 | const char *name; /** file name */ | ||
825 | int (*show)(struct seq_file*, void*); /** show callback */ | ||
826 | u32 driver_features; /**< Required driver features for this entry */ | ||
827 | void *data; | ||
828 | }; | ||
829 | |||
830 | /** | ||
831 | * debugfs node structure. This structure represents a debugfs file. | ||
832 | */ | ||
833 | struct drm_info_node { | ||
834 | struct list_head list; | ||
835 | struct drm_minor *minor; | ||
836 | struct drm_info_list *info_ent; | ||
837 | struct dentry *dent; | ||
838 | }; | ||
839 | |||
796 | /** | 840 | /** |
797 | * DRM minor structure. This structure represents a drm minor number. | 841 | * DRM minor structure. This structure represents a drm minor number. |
798 | */ | 842 | */ |
@@ -802,7 +846,12 @@ struct drm_minor { | |||
802 | dev_t device; /**< Device number for mknod */ | 846 | dev_t device; /**< Device number for mknod */ |
803 | struct device kdev; /**< Linux device */ | 847 | struct device kdev; /**< Linux device */ |
804 | struct drm_device *dev; | 848 | struct drm_device *dev; |
805 | struct proc_dir_entry *dev_root; /**< proc directory entry */ | 849 | |
850 | struct proc_dir_entry *proc_root; /**< proc directory entry */ | ||
851 | struct drm_info_node proc_nodes; | ||
852 | struct dentry *debugfs_root; | ||
853 | struct drm_info_node debugfs_nodes; | ||
854 | |||
806 | struct drm_master *master; /* currently active master for this node */ | 855 | struct drm_master *master; /* currently active master for this node */ |
807 | struct list_head master_list; | 856 | struct list_head master_list; |
808 | struct drm_mode_group mode_group; | 857 | struct drm_mode_group mode_group; |
@@ -1258,6 +1307,7 @@ extern unsigned int drm_debug; | |||
1258 | 1307 | ||
1259 | extern struct class *drm_class; | 1308 | extern struct class *drm_class; |
1260 | extern struct proc_dir_entry *drm_proc_root; | 1309 | extern struct proc_dir_entry *drm_proc_root; |
1310 | extern struct dentry *drm_debugfs_root; | ||
1261 | 1311 | ||
1262 | extern struct idr drm_minors_idr; | 1312 | extern struct idr drm_minors_idr; |
1263 | 1313 | ||
@@ -1268,6 +1318,31 @@ extern int drm_proc_init(struct drm_minor *minor, int minor_id, | |||
1268 | struct proc_dir_entry *root); | 1318 | struct proc_dir_entry *root); |
1269 | extern int drm_proc_cleanup(struct drm_minor *minor, struct proc_dir_entry *root); | 1319 | extern int drm_proc_cleanup(struct drm_minor *minor, struct proc_dir_entry *root); |
1270 | 1320 | ||
1321 | /* Debugfs support */ | ||
1322 | #if defined(CONFIG_DEBUG_FS) | ||
1323 | extern int drm_debugfs_init(struct drm_minor *minor, int minor_id, | ||
1324 | struct dentry *root); | ||
1325 | extern int drm_debugfs_create_files(struct drm_info_list *files, int count, | ||
1326 | struct dentry *root, struct drm_minor *minor); | ||
1327 | extern int drm_debugfs_remove_files(struct drm_info_list *files, int count, | ||
1328 | struct drm_minor *minor); | ||
1329 | extern int drm_debugfs_cleanup(struct drm_minor *minor); | ||
1330 | #endif | ||
1331 | |||
1332 | /* Info file support */ | ||
1333 | extern int drm_name_info(struct seq_file *m, void *data); | ||
1334 | extern int drm_vm_info(struct seq_file *m, void *data); | ||
1335 | extern int drm_queues_info(struct seq_file *m, void *data); | ||
1336 | extern int drm_bufs_info(struct seq_file *m, void *data); | ||
1337 | extern int drm_vblank_info(struct seq_file *m, void *data); | ||
1338 | extern int drm_clients_info(struct seq_file *m, void* data); | ||
1339 | extern int drm_gem_name_info(struct seq_file *m, void *data); | ||
1340 | extern int drm_gem_object_info(struct seq_file *m, void* data); | ||
1341 | |||
1342 | #if DRM_DEBUG_CODE | ||
1343 | extern int drm_vma_info(struct seq_file *m, void *data); | ||
1344 | #endif | ||
1345 | |||
1271 | /* Scatter Gather Support (drm_scatter.h) */ | 1346 | /* Scatter Gather Support (drm_scatter.h) */ |
1272 | extern void drm_sg_cleanup(struct drm_sg_mem * entry); | 1347 | extern void drm_sg_cleanup(struct drm_sg_mem * entry); |
1273 | extern int drm_sg_alloc_ioctl(struct drm_device *dev, void *data, | 1348 | extern int drm_sg_alloc_ioctl(struct drm_device *dev, void *data, |
diff --git a/include/drm/drm_pciids.h b/include/drm/drm_pciids.h index 5165f240aa68..76c4c8243038 100644 --- a/include/drm/drm_pciids.h +++ b/include/drm/drm_pciids.h | |||
@@ -418,4 +418,6 @@ | |||
418 | {0x8086, 0x2e02, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_DISPLAY_VGA << 8, 0xffff00, 0}, \ | 418 | {0x8086, 0x2e02, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_DISPLAY_VGA << 8, 0xffff00, 0}, \ |
419 | {0x8086, 0x2e12, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_DISPLAY_VGA << 8, 0xffff00, 0}, \ | 419 | {0x8086, 0x2e12, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_DISPLAY_VGA << 8, 0xffff00, 0}, \ |
420 | {0x8086, 0x2e22, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_DISPLAY_VGA << 8, 0xffff00, 0}, \ | 420 | {0x8086, 0x2e22, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_DISPLAY_VGA << 8, 0xffff00, 0}, \ |
421 | {0x8086, 0xa001, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_DISPLAY_VGA << 8, 0xffff00, 0}, \ | ||
422 | {0x8086, 0xa011, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_DISPLAY_VGA << 8, 0xffff00, 0}, \ | ||
421 | {0, 0, 0} | 423 | {0, 0, 0} |
diff --git a/include/linux/acpi.h b/include/linux/acpi.h index 6fce2fc2d124..78199151c00b 100644 --- a/include/linux/acpi.h +++ b/include/linux/acpi.h | |||
@@ -79,6 +79,7 @@ typedef int (*acpi_table_handler) (struct acpi_table_header *table); | |||
79 | typedef int (*acpi_table_entry_handler) (struct acpi_subtable_header *header, const unsigned long end); | 79 | typedef int (*acpi_table_entry_handler) (struct acpi_subtable_header *header, const unsigned long end); |
80 | 80 | ||
81 | char * __acpi_map_table (unsigned long phys_addr, unsigned long size); | 81 | char * __acpi_map_table (unsigned long phys_addr, unsigned long size); |
82 | void __acpi_unmap_table(char *map, unsigned long size); | ||
82 | int early_acpi_boot_init(void); | 83 | int early_acpi_boot_init(void); |
83 | int acpi_boot_init (void); | 84 | int acpi_boot_init (void); |
84 | int acpi_boot_table_init (void); | 85 | int acpi_boot_table_init (void); |
diff --git a/include/linux/bootmem.h b/include/linux/bootmem.h index 95837bfb5256..455d83219fae 100644 --- a/include/linux/bootmem.h +++ b/include/linux/bootmem.h | |||
@@ -65,23 +65,20 @@ extern void free_bootmem(unsigned long addr, unsigned long size); | |||
65 | #define BOOTMEM_DEFAULT 0 | 65 | #define BOOTMEM_DEFAULT 0 |
66 | #define BOOTMEM_EXCLUSIVE (1<<0) | 66 | #define BOOTMEM_EXCLUSIVE (1<<0) |
67 | 67 | ||
68 | extern int reserve_bootmem(unsigned long addr, | ||
69 | unsigned long size, | ||
70 | int flags); | ||
68 | extern int reserve_bootmem_node(pg_data_t *pgdat, | 71 | extern int reserve_bootmem_node(pg_data_t *pgdat, |
69 | unsigned long physaddr, | 72 | unsigned long physaddr, |
70 | unsigned long size, | 73 | unsigned long size, |
71 | int flags); | 74 | int flags); |
72 | #ifndef CONFIG_HAVE_ARCH_BOOTMEM_NODE | ||
73 | extern int reserve_bootmem(unsigned long addr, unsigned long size, int flags); | ||
74 | #endif | ||
75 | 75 | ||
76 | extern void *__alloc_bootmem_nopanic(unsigned long size, | 76 | extern void *__alloc_bootmem(unsigned long size, |
77 | unsigned long align, | 77 | unsigned long align, |
78 | unsigned long goal); | 78 | unsigned long goal); |
79 | extern void *__alloc_bootmem(unsigned long size, | 79 | extern void *__alloc_bootmem_nopanic(unsigned long size, |
80 | unsigned long align, | 80 | unsigned long align, |
81 | unsigned long goal); | 81 | unsigned long goal); |
82 | extern void *__alloc_bootmem_low(unsigned long size, | ||
83 | unsigned long align, | ||
84 | unsigned long goal); | ||
85 | extern void *__alloc_bootmem_node(pg_data_t *pgdat, | 82 | extern void *__alloc_bootmem_node(pg_data_t *pgdat, |
86 | unsigned long size, | 83 | unsigned long size, |
87 | unsigned long align, | 84 | unsigned long align, |
@@ -90,30 +87,35 @@ extern void *__alloc_bootmem_node_nopanic(pg_data_t *pgdat, | |||
90 | unsigned long size, | 87 | unsigned long size, |
91 | unsigned long align, | 88 | unsigned long align, |
92 | unsigned long goal); | 89 | unsigned long goal); |
90 | extern void *__alloc_bootmem_low(unsigned long size, | ||
91 | unsigned long align, | ||
92 | unsigned long goal); | ||
93 | extern void *__alloc_bootmem_low_node(pg_data_t *pgdat, | 93 | extern void *__alloc_bootmem_low_node(pg_data_t *pgdat, |
94 | unsigned long size, | 94 | unsigned long size, |
95 | unsigned long align, | 95 | unsigned long align, |
96 | unsigned long goal); | 96 | unsigned long goal); |
97 | #ifndef CONFIG_HAVE_ARCH_BOOTMEM_NODE | 97 | |
98 | #define alloc_bootmem(x) \ | 98 | #define alloc_bootmem(x) \ |
99 | __alloc_bootmem(x, SMP_CACHE_BYTES, __pa(MAX_DMA_ADDRESS)) | 99 | __alloc_bootmem(x, SMP_CACHE_BYTES, __pa(MAX_DMA_ADDRESS)) |
100 | #define alloc_bootmem_nopanic(x) \ | 100 | #define alloc_bootmem_nopanic(x) \ |
101 | __alloc_bootmem_nopanic(x, SMP_CACHE_BYTES, __pa(MAX_DMA_ADDRESS)) | 101 | __alloc_bootmem_nopanic(x, SMP_CACHE_BYTES, __pa(MAX_DMA_ADDRESS)) |
102 | #define alloc_bootmem_low(x) \ | ||
103 | __alloc_bootmem_low(x, SMP_CACHE_BYTES, 0) | ||
104 | #define alloc_bootmem_pages(x) \ | 102 | #define alloc_bootmem_pages(x) \ |
105 | __alloc_bootmem(x, PAGE_SIZE, __pa(MAX_DMA_ADDRESS)) | 103 | __alloc_bootmem(x, PAGE_SIZE, __pa(MAX_DMA_ADDRESS)) |
106 | #define alloc_bootmem_pages_nopanic(x) \ | 104 | #define alloc_bootmem_pages_nopanic(x) \ |
107 | __alloc_bootmem_nopanic(x, PAGE_SIZE, __pa(MAX_DMA_ADDRESS)) | 105 | __alloc_bootmem_nopanic(x, PAGE_SIZE, __pa(MAX_DMA_ADDRESS)) |
108 | #define alloc_bootmem_low_pages(x) \ | ||
109 | __alloc_bootmem_low(x, PAGE_SIZE, 0) | ||
110 | #define alloc_bootmem_node(pgdat, x) \ | 106 | #define alloc_bootmem_node(pgdat, x) \ |
111 | __alloc_bootmem_node(pgdat, x, SMP_CACHE_BYTES, __pa(MAX_DMA_ADDRESS)) | 107 | __alloc_bootmem_node(pgdat, x, SMP_CACHE_BYTES, __pa(MAX_DMA_ADDRESS)) |
112 | #define alloc_bootmem_pages_node(pgdat, x) \ | 108 | #define alloc_bootmem_pages_node(pgdat, x) \ |
113 | __alloc_bootmem_node(pgdat, x, PAGE_SIZE, __pa(MAX_DMA_ADDRESS)) | 109 | __alloc_bootmem_node(pgdat, x, PAGE_SIZE, __pa(MAX_DMA_ADDRESS)) |
110 | #define alloc_bootmem_pages_node_nopanic(pgdat, x) \ | ||
111 | __alloc_bootmem_node_nopanic(pgdat, x, PAGE_SIZE, __pa(MAX_DMA_ADDRESS)) | ||
112 | |||
113 | #define alloc_bootmem_low(x) \ | ||
114 | __alloc_bootmem_low(x, SMP_CACHE_BYTES, 0) | ||
115 | #define alloc_bootmem_low_pages(x) \ | ||
116 | __alloc_bootmem_low(x, PAGE_SIZE, 0) | ||
114 | #define alloc_bootmem_low_pages_node(pgdat, x) \ | 117 | #define alloc_bootmem_low_pages_node(pgdat, x) \ |
115 | __alloc_bootmem_low_node(pgdat, x, PAGE_SIZE, 0) | 118 | __alloc_bootmem_low_node(pgdat, x, PAGE_SIZE, 0) |
116 | #endif /* !CONFIG_HAVE_ARCH_BOOTMEM_NODE */ | ||
117 | 119 | ||
118 | extern int reserve_bootmem_generic(unsigned long addr, unsigned long size, | 120 | extern int reserve_bootmem_generic(unsigned long addr, unsigned long size, |
119 | int flags); | 121 | int flags); |
diff --git a/include/linux/bsg.h b/include/linux/bsg.h index 3f0c64ace424..ecb4730d0868 100644 --- a/include/linux/bsg.h +++ b/include/linux/bsg.h | |||
@@ -1,6 +1,8 @@ | |||
1 | #ifndef BSG_H | 1 | #ifndef BSG_H |
2 | #define BSG_H | 2 | #define BSG_H |
3 | 3 | ||
4 | #include <linux/types.h> | ||
5 | |||
4 | #define BSG_PROTOCOL_SCSI 0 | 6 | #define BSG_PROTOCOL_SCSI 0 |
5 | 7 | ||
6 | #define BSG_SUB_PROTOCOL_SCSI_CMD 0 | 8 | #define BSG_SUB_PROTOCOL_SCSI_CMD 0 |
diff --git a/include/linux/buffer_head.h b/include/linux/buffer_head.h index bd7ac793be19..f19fd9045ea0 100644 --- a/include/linux/buffer_head.h +++ b/include/linux/buffer_head.h | |||
@@ -165,15 +165,8 @@ int sync_mapping_buffers(struct address_space *mapping); | |||
165 | void unmap_underlying_metadata(struct block_device *bdev, sector_t block); | 165 | void unmap_underlying_metadata(struct block_device *bdev, sector_t block); |
166 | 166 | ||
167 | void mark_buffer_async_write(struct buffer_head *bh); | 167 | void mark_buffer_async_write(struct buffer_head *bh); |
168 | void invalidate_bdev(struct block_device *); | ||
169 | int sync_blockdev(struct block_device *bdev); | ||
170 | void __wait_on_buffer(struct buffer_head *); | 168 | void __wait_on_buffer(struct buffer_head *); |
171 | wait_queue_head_t *bh_waitq_head(struct buffer_head *bh); | 169 | wait_queue_head_t *bh_waitq_head(struct buffer_head *bh); |
172 | int fsync_bdev(struct block_device *); | ||
173 | struct super_block *freeze_bdev(struct block_device *); | ||
174 | int thaw_bdev(struct block_device *, struct super_block *); | ||
175 | int fsync_super(struct super_block *); | ||
176 | int fsync_no_super(struct block_device *); | ||
177 | struct buffer_head *__find_get_block(struct block_device *bdev, sector_t block, | 170 | struct buffer_head *__find_get_block(struct block_device *bdev, sector_t block, |
178 | unsigned size); | 171 | unsigned size); |
179 | struct buffer_head *__getblk(struct block_device *bdev, sector_t block, | 172 | struct buffer_head *__getblk(struct block_device *bdev, sector_t block, |
diff --git a/include/linux/clk.h b/include/linux/clk.h index 778777316ea4..1db9bbf444a3 100644 --- a/include/linux/clk.h +++ b/include/linux/clk.h | |||
@@ -125,4 +125,21 @@ int clk_set_parent(struct clk *clk, struct clk *parent); | |||
125 | */ | 125 | */ |
126 | struct clk *clk_get_parent(struct clk *clk); | 126 | struct clk *clk_get_parent(struct clk *clk); |
127 | 127 | ||
128 | /** | ||
129 | * clk_get_sys - get a clock based upon the device name | ||
130 | * @dev_id: device name | ||
131 | * @con_id: connection ID | ||
132 | * | ||
133 | * Returns a struct clk corresponding to the clock producer, or | ||
134 | * valid IS_ERR() condition containing errno. The implementation | ||
135 | * uses @dev_id and @con_id to determine the clock consumer, and | ||
136 | * thereby the clock producer. In contrast to clk_get() this function | ||
137 | * takes the device name instead of the device itself for identification. | ||
138 | * | ||
139 | * Drivers must assume that the clock source is not enabled. | ||
140 | * | ||
141 | * clk_get_sys should not be called from within interrupt context. | ||
142 | */ | ||
143 | struct clk *clk_get_sys(const char *dev_id, const char *con_id); | ||
144 | |||
128 | #endif | 145 | #endif |
diff --git a/include/linux/compat.h b/include/linux/compat.h index 3fd2194ff573..b880864672de 100644 --- a/include/linux/compat.h +++ b/include/linux/compat.h | |||
@@ -125,6 +125,13 @@ struct compat_dirent { | |||
125 | char d_name[256]; | 125 | char d_name[256]; |
126 | }; | 126 | }; |
127 | 127 | ||
128 | struct compat_ustat { | ||
129 | compat_daddr_t f_tfree; | ||
130 | compat_ino_t f_tinode; | ||
131 | char f_fname[6]; | ||
132 | char f_fpack[6]; | ||
133 | }; | ||
134 | |||
128 | typedef union compat_sigval { | 135 | typedef union compat_sigval { |
129 | compat_int_t sival_int; | 136 | compat_int_t sival_int; |
130 | compat_uptr_t sival_ptr; | 137 | compat_uptr_t sival_ptr; |
@@ -178,6 +185,7 @@ long compat_sys_semtimedop(int semid, struct sembuf __user *tsems, | |||
178 | unsigned nsems, const struct compat_timespec __user *timeout); | 185 | unsigned nsems, const struct compat_timespec __user *timeout); |
179 | asmlinkage long compat_sys_keyctl(u32 option, | 186 | asmlinkage long compat_sys_keyctl(u32 option, |
180 | u32 arg2, u32 arg3, u32 arg4, u32 arg5); | 187 | u32 arg2, u32 arg3, u32 arg4, u32 arg5); |
188 | asmlinkage long compat_sys_ustat(unsigned dev, struct compat_ustat __user *u32); | ||
181 | 189 | ||
182 | asmlinkage ssize_t compat_sys_readv(unsigned long fd, | 190 | asmlinkage ssize_t compat_sys_readv(unsigned long fd, |
183 | const struct compat_iovec __user *vec, unsigned long vlen); | 191 | const struct compat_iovec __user *vec, unsigned long vlen); |
diff --git a/include/linux/dcache.h b/include/linux/dcache.h index c66d22487bf8..15156364d196 100644 --- a/include/linux/dcache.h +++ b/include/linux/dcache.h | |||
@@ -112,7 +112,7 @@ struct dentry { | |||
112 | struct list_head d_subdirs; /* our children */ | 112 | struct list_head d_subdirs; /* our children */ |
113 | struct list_head d_alias; /* inode alias list */ | 113 | struct list_head d_alias; /* inode alias list */ |
114 | unsigned long d_time; /* used by d_revalidate */ | 114 | unsigned long d_time; /* used by d_revalidate */ |
115 | struct dentry_operations *d_op; | 115 | const struct dentry_operations *d_op; |
116 | struct super_block *d_sb; /* The root of the dentry tree */ | 116 | struct super_block *d_sb; /* The root of the dentry tree */ |
117 | void *d_fsdata; /* fs-specific data */ | 117 | void *d_fsdata; /* fs-specific data */ |
118 | 118 | ||
diff --git a/include/linux/decompress/bunzip2.h b/include/linux/decompress/bunzip2.h new file mode 100644 index 000000000000..115272137a9c --- /dev/null +++ b/include/linux/decompress/bunzip2.h | |||
@@ -0,0 +1,10 @@ | |||
1 | #ifndef DECOMPRESS_BUNZIP2_H | ||
2 | #define DECOMPRESS_BUNZIP2_H | ||
3 | |||
4 | int bunzip2(unsigned char *inbuf, int len, | ||
5 | int(*fill)(void*, unsigned int), | ||
6 | int(*flush)(void*, unsigned int), | ||
7 | unsigned char *output, | ||
8 | int *pos, | ||
9 | void(*error)(char *x)); | ||
10 | #endif | ||
diff --git a/include/linux/decompress/generic.h b/include/linux/decompress/generic.h new file mode 100644 index 000000000000..6dfb856327bb --- /dev/null +++ b/include/linux/decompress/generic.h | |||
@@ -0,0 +1,33 @@ | |||
1 | #ifndef DECOMPRESS_GENERIC_H | ||
2 | #define DECOMPRESS_GENERIC_H | ||
3 | |||
4 | /* Minimal chunksize to be read. | ||
5 | *Bzip2 prefers at least 4096 | ||
6 | *Lzma prefers 0x10000 */ | ||
7 | #define COMPR_IOBUF_SIZE 4096 | ||
8 | |||
9 | typedef int (*decompress_fn) (unsigned char *inbuf, int len, | ||
10 | int(*fill)(void*, unsigned int), | ||
11 | int(*writebb)(void*, unsigned int), | ||
12 | unsigned char *output, | ||
13 | int *posp, | ||
14 | void(*error)(char *x)); | ||
15 | |||
16 | /* inbuf - input buffer | ||
17 | *len - len of pre-read data in inbuf | ||
18 | *fill - function to fill inbuf if empty | ||
19 | *writebb - function to write out outbug | ||
20 | *posp - if non-null, input position (number of bytes read) will be | ||
21 | * returned here | ||
22 | * | ||
23 | *If len != 0, the inbuf is initialized (with as much data), and fill | ||
24 | *should not be called | ||
25 | *If len = 0, the inbuf is allocated, but empty. Its size is IOBUF_SIZE | ||
26 | *fill should be called (repeatedly...) to read data, at most IOBUF_SIZE | ||
27 | */ | ||
28 | |||
29 | /* Utility routine to detect the decompression method */ | ||
30 | decompress_fn decompress_method(const unsigned char *inbuf, int len, | ||
31 | const char **name); | ||
32 | |||
33 | #endif | ||
diff --git a/include/linux/decompress/inflate.h b/include/linux/decompress/inflate.h new file mode 100644 index 000000000000..f9b06ccc3e5c --- /dev/null +++ b/include/linux/decompress/inflate.h | |||
@@ -0,0 +1,13 @@ | |||
1 | #ifndef INFLATE_H | ||
2 | #define INFLATE_H | ||
3 | |||
4 | /* Other housekeeping constants */ | ||
5 | #define INBUFSIZ 4096 | ||
6 | |||
7 | int gunzip(unsigned char *inbuf, int len, | ||
8 | int(*fill)(void*, unsigned int), | ||
9 | int(*flush)(void*, unsigned int), | ||
10 | unsigned char *output, | ||
11 | int *pos, | ||
12 | void(*error_fn)(char *x)); | ||
13 | #endif | ||
diff --git a/include/linux/decompress/mm.h b/include/linux/decompress/mm.h new file mode 100644 index 000000000000..12ff8c3f1d05 --- /dev/null +++ b/include/linux/decompress/mm.h | |||
@@ -0,0 +1,87 @@ | |||
1 | /* | ||
2 | * linux/compr_mm.h | ||
3 | * | ||
4 | * Memory management for pre-boot and ramdisk uncompressors | ||
5 | * | ||
6 | * Authors: Alain Knaff <alain@knaff.lu> | ||
7 | * | ||
8 | */ | ||
9 | |||
10 | #ifndef DECOMPR_MM_H | ||
11 | #define DECOMPR_MM_H | ||
12 | |||
13 | #ifdef STATIC | ||
14 | |||
15 | /* Code active when included from pre-boot environment: */ | ||
16 | |||
17 | /* A trivial malloc implementation, adapted from | ||
18 | * malloc by Hannu Savolainen 1993 and Matthias Urlichs 1994 | ||
19 | */ | ||
20 | static unsigned long malloc_ptr; | ||
21 | static int malloc_count; | ||
22 | |||
23 | static void *malloc(int size) | ||
24 | { | ||
25 | void *p; | ||
26 | |||
27 | if (size < 0) | ||
28 | error("Malloc error"); | ||
29 | if (!malloc_ptr) | ||
30 | malloc_ptr = free_mem_ptr; | ||
31 | |||
32 | malloc_ptr = (malloc_ptr + 3) & ~3; /* Align */ | ||
33 | |||
34 | p = (void *)malloc_ptr; | ||
35 | malloc_ptr += size; | ||
36 | |||
37 | if (free_mem_end_ptr && malloc_ptr >= free_mem_end_ptr) | ||
38 | error("Out of memory"); | ||
39 | |||
40 | malloc_count++; | ||
41 | return p; | ||
42 | } | ||
43 | |||
44 | static void free(void *where) | ||
45 | { | ||
46 | malloc_count--; | ||
47 | if (!malloc_count) | ||
48 | malloc_ptr = free_mem_ptr; | ||
49 | } | ||
50 | |||
51 | #define large_malloc(a) malloc(a) | ||
52 | #define large_free(a) free(a) | ||
53 | |||
54 | #define set_error_fn(x) | ||
55 | |||
56 | #define INIT | ||
57 | |||
58 | #else /* STATIC */ | ||
59 | |||
60 | /* Code active when compiled standalone for use when loading ramdisk: */ | ||
61 | |||
62 | #include <linux/kernel.h> | ||
63 | #include <linux/fs.h> | ||
64 | #include <linux/string.h> | ||
65 | #include <linux/vmalloc.h> | ||
66 | |||
67 | /* Use defines rather than static inline in order to avoid spurious | ||
68 | * warnings when not needed (indeed large_malloc / large_free are not | ||
69 | * needed by inflate */ | ||
70 | |||
71 | #define malloc(a) kmalloc(a, GFP_KERNEL) | ||
72 | #define free(a) kfree(a) | ||
73 | |||
74 | #define large_malloc(a) vmalloc(a) | ||
75 | #define large_free(a) vfree(a) | ||
76 | |||
77 | static void(*error)(char *m); | ||
78 | #define set_error_fn(x) error = x; | ||
79 | |||
80 | #define INIT __init | ||
81 | #define STATIC | ||
82 | |||
83 | #include <linux/init.h> | ||
84 | |||
85 | #endif /* STATIC */ | ||
86 | |||
87 | #endif /* DECOMPR_MM_H */ | ||
diff --git a/include/linux/decompress/unlzma.h b/include/linux/decompress/unlzma.h new file mode 100644 index 000000000000..7796538f1bf4 --- /dev/null +++ b/include/linux/decompress/unlzma.h | |||
@@ -0,0 +1,12 @@ | |||
1 | #ifndef DECOMPRESS_UNLZMA_H | ||
2 | #define DECOMPRESS_UNLZMA_H | ||
3 | |||
4 | int unlzma(unsigned char *, int, | ||
5 | int(*fill)(void*, unsigned int), | ||
6 | int(*flush)(void*, unsigned int), | ||
7 | unsigned char *output, | ||
8 | int *posp, | ||
9 | void(*error)(char *x) | ||
10 | ); | ||
11 | |||
12 | #endif | ||
diff --git a/include/linux/elfcore.h b/include/linux/elfcore.h index 5ca54d77079f..7605c5e9589f 100644 --- a/include/linux/elfcore.h +++ b/include/linux/elfcore.h | |||
@@ -111,6 +111,15 @@ static inline void elf_core_copy_regs(elf_gregset_t *elfregs, struct pt_regs *re | |||
111 | #endif | 111 | #endif |
112 | } | 112 | } |
113 | 113 | ||
114 | static inline void elf_core_copy_kernel_regs(elf_gregset_t *elfregs, struct pt_regs *regs) | ||
115 | { | ||
116 | #ifdef ELF_CORE_COPY_KERNEL_REGS | ||
117 | ELF_CORE_COPY_KERNEL_REGS((*elfregs), regs); | ||
118 | #else | ||
119 | elf_core_copy_regs(elfregs, regs); | ||
120 | #endif | ||
121 | } | ||
122 | |||
114 | static inline int elf_core_copy_task_regs(struct task_struct *t, elf_gregset_t* elfregs) | 123 | static inline int elf_core_copy_task_regs(struct task_struct *t, elf_gregset_t* elfregs) |
115 | { | 124 | { |
116 | #ifdef ELF_CORE_COPY_TASK_REGS | 125 | #ifdef ELF_CORE_COPY_TASK_REGS |
diff --git a/include/linux/firewire-cdev.h b/include/linux/firewire-cdev.h index 4d078e99c017..c6b3ca3af6df 100644 --- a/include/linux/firewire-cdev.h +++ b/include/linux/firewire-cdev.h | |||
@@ -25,10 +25,12 @@ | |||
25 | #include <linux/types.h> | 25 | #include <linux/types.h> |
26 | #include <linux/firewire-constants.h> | 26 | #include <linux/firewire-constants.h> |
27 | 27 | ||
28 | #define FW_CDEV_EVENT_BUS_RESET 0x00 | 28 | #define FW_CDEV_EVENT_BUS_RESET 0x00 |
29 | #define FW_CDEV_EVENT_RESPONSE 0x01 | 29 | #define FW_CDEV_EVENT_RESPONSE 0x01 |
30 | #define FW_CDEV_EVENT_REQUEST 0x02 | 30 | #define FW_CDEV_EVENT_REQUEST 0x02 |
31 | #define FW_CDEV_EVENT_ISO_INTERRUPT 0x03 | 31 | #define FW_CDEV_EVENT_ISO_INTERRUPT 0x03 |
32 | #define FW_CDEV_EVENT_ISO_RESOURCE_ALLOCATED 0x04 | ||
33 | #define FW_CDEV_EVENT_ISO_RESOURCE_DEALLOCATED 0x05 | ||
32 | 34 | ||
33 | /** | 35 | /** |
34 | * struct fw_cdev_event_common - Common part of all fw_cdev_event_ types | 36 | * struct fw_cdev_event_common - Common part of all fw_cdev_event_ types |
@@ -136,7 +138,24 @@ struct fw_cdev_event_request { | |||
136 | * This event is sent when the controller has completed an &fw_cdev_iso_packet | 138 | * This event is sent when the controller has completed an &fw_cdev_iso_packet |
137 | * with the %FW_CDEV_ISO_INTERRUPT bit set. In the receive case, the headers | 139 | * with the %FW_CDEV_ISO_INTERRUPT bit set. In the receive case, the headers |
138 | * stripped of all packets up until and including the interrupt packet are | 140 | * stripped of all packets up until and including the interrupt packet are |
139 | * returned in the @header field. | 141 | * returned in the @header field. The amount of header data per packet is as |
142 | * specified at iso context creation by &fw_cdev_create_iso_context.header_size. | ||
143 | * | ||
144 | * In version 1 of this ABI, header data consisted of the 1394 isochronous | ||
145 | * packet header, followed by quadlets from the packet payload if | ||
146 | * &fw_cdev_create_iso_context.header_size > 4. | ||
147 | * | ||
148 | * In version 2 of this ABI, header data consist of the 1394 isochronous | ||
149 | * packet header, followed by a timestamp quadlet if | ||
150 | * &fw_cdev_create_iso_context.header_size > 4, followed by quadlets from the | ||
151 | * packet payload if &fw_cdev_create_iso_context.header_size > 8. | ||
152 | * | ||
153 | * Behaviour of ver. 1 of this ABI is no longer available since ABI ver. 2. | ||
154 | * | ||
155 | * Format of 1394 iso packet header: 16 bits len, 2 bits tag, 6 bits channel, | ||
156 | * 4 bits tcode, 4 bits sy, in big endian byte order. Format of timestamp: | ||
157 | * 16 bits invalid, 3 bits cycleSeconds, 13 bits cycleCount, in big endian byte | ||
158 | * order. | ||
140 | */ | 159 | */ |
141 | struct fw_cdev_event_iso_interrupt { | 160 | struct fw_cdev_event_iso_interrupt { |
142 | __u64 closure; | 161 | __u64 closure; |
@@ -147,12 +166,44 @@ struct fw_cdev_event_iso_interrupt { | |||
147 | }; | 166 | }; |
148 | 167 | ||
149 | /** | 168 | /** |
169 | * struct fw_cdev_event_iso_resource - Iso resources were allocated or freed | ||
170 | * @closure: See &fw_cdev_event_common; | ||
171 | * set by %FW_CDEV_IOC_(DE)ALLOCATE_ISO_RESOURCE(_ONCE) ioctl | ||
172 | * @type: %FW_CDEV_EVENT_ISO_RESOURCE_ALLOCATED or | ||
173 | * %FW_CDEV_EVENT_ISO_RESOURCE_DEALLOCATED | ||
174 | * @handle: Reference by which an allocated resource can be deallocated | ||
175 | * @channel: Isochronous channel which was (de)allocated, if any | ||
176 | * @bandwidth: Bandwidth allocation units which were (de)allocated, if any | ||
177 | * | ||
178 | * An %FW_CDEV_EVENT_ISO_RESOURCE_ALLOCATED event is sent after an isochronous | ||
179 | * resource was allocated at the IRM. The client has to check @channel and | ||
180 | * @bandwidth for whether the allocation actually succeeded. | ||
181 | * | ||
182 | * An %FW_CDEV_EVENT_ISO_RESOURCE_DEALLOCATED event is sent after an isochronous | ||
183 | * resource was deallocated at the IRM. It is also sent when automatic | ||
184 | * reallocation after a bus reset failed. | ||
185 | * | ||
186 | * @channel is <0 if no channel was (de)allocated or if reallocation failed. | ||
187 | * @bandwidth is 0 if no bandwidth was (de)allocated or if reallocation failed. | ||
188 | */ | ||
189 | struct fw_cdev_event_iso_resource { | ||
190 | __u64 closure; | ||
191 | __u32 type; | ||
192 | __u32 handle; | ||
193 | __s32 channel; | ||
194 | __s32 bandwidth; | ||
195 | }; | ||
196 | |||
197 | /** | ||
150 | * union fw_cdev_event - Convenience union of fw_cdev_event_ types | 198 | * union fw_cdev_event - Convenience union of fw_cdev_event_ types |
151 | * @common: Valid for all types | 199 | * @common: Valid for all types |
152 | * @bus_reset: Valid if @common.type == %FW_CDEV_EVENT_BUS_RESET | 200 | * @bus_reset: Valid if @common.type == %FW_CDEV_EVENT_BUS_RESET |
153 | * @response: Valid if @common.type == %FW_CDEV_EVENT_RESPONSE | 201 | * @response: Valid if @common.type == %FW_CDEV_EVENT_RESPONSE |
154 | * @request: Valid if @common.type == %FW_CDEV_EVENT_REQUEST | 202 | * @request: Valid if @common.type == %FW_CDEV_EVENT_REQUEST |
155 | * @iso_interrupt: Valid if @common.type == %FW_CDEV_EVENT_ISO_INTERRUPT | 203 | * @iso_interrupt: Valid if @common.type == %FW_CDEV_EVENT_ISO_INTERRUPT |
204 | * @iso_resource: Valid if @common.type == | ||
205 | * %FW_CDEV_EVENT_ISO_RESOURCE_ALLOCATED or | ||
206 | * %FW_CDEV_EVENT_ISO_RESOURCE_DEALLOCATED | ||
156 | * | 207 | * |
157 | * Convenience union for userspace use. Events could be read(2) into an | 208 | * Convenience union for userspace use. Events could be read(2) into an |
158 | * appropriately aligned char buffer and then cast to this union for further | 209 | * appropriately aligned char buffer and then cast to this union for further |
@@ -163,33 +214,47 @@ struct fw_cdev_event_iso_interrupt { | |||
163 | * not fit will be discarded so that the next read(2) will return a new event. | 214 | * not fit will be discarded so that the next read(2) will return a new event. |
164 | */ | 215 | */ |
165 | union fw_cdev_event { | 216 | union fw_cdev_event { |
166 | struct fw_cdev_event_common common; | 217 | struct fw_cdev_event_common common; |
167 | struct fw_cdev_event_bus_reset bus_reset; | 218 | struct fw_cdev_event_bus_reset bus_reset; |
168 | struct fw_cdev_event_response response; | 219 | struct fw_cdev_event_response response; |
169 | struct fw_cdev_event_request request; | 220 | struct fw_cdev_event_request request; |
170 | struct fw_cdev_event_iso_interrupt iso_interrupt; | 221 | struct fw_cdev_event_iso_interrupt iso_interrupt; |
222 | struct fw_cdev_event_iso_resource iso_resource; | ||
171 | }; | 223 | }; |
172 | 224 | ||
173 | #define FW_CDEV_IOC_GET_INFO _IOWR('#', 0x00, struct fw_cdev_get_info) | 225 | /* available since kernel version 2.6.22 */ |
174 | #define FW_CDEV_IOC_SEND_REQUEST _IOW('#', 0x01, struct fw_cdev_send_request) | 226 | #define FW_CDEV_IOC_GET_INFO _IOWR('#', 0x00, struct fw_cdev_get_info) |
175 | #define FW_CDEV_IOC_ALLOCATE _IOWR('#', 0x02, struct fw_cdev_allocate) | 227 | #define FW_CDEV_IOC_SEND_REQUEST _IOW('#', 0x01, struct fw_cdev_send_request) |
176 | #define FW_CDEV_IOC_DEALLOCATE _IOW('#', 0x03, struct fw_cdev_deallocate) | 228 | #define FW_CDEV_IOC_ALLOCATE _IOWR('#', 0x02, struct fw_cdev_allocate) |
177 | #define FW_CDEV_IOC_SEND_RESPONSE _IOW('#', 0x04, struct fw_cdev_send_response) | 229 | #define FW_CDEV_IOC_DEALLOCATE _IOW('#', 0x03, struct fw_cdev_deallocate) |
178 | #define FW_CDEV_IOC_INITIATE_BUS_RESET _IOW('#', 0x05, struct fw_cdev_initiate_bus_reset) | 230 | #define FW_CDEV_IOC_SEND_RESPONSE _IOW('#', 0x04, struct fw_cdev_send_response) |
179 | #define FW_CDEV_IOC_ADD_DESCRIPTOR _IOWR('#', 0x06, struct fw_cdev_add_descriptor) | 231 | #define FW_CDEV_IOC_INITIATE_BUS_RESET _IOW('#', 0x05, struct fw_cdev_initiate_bus_reset) |
180 | #define FW_CDEV_IOC_REMOVE_DESCRIPTOR _IOW('#', 0x07, struct fw_cdev_remove_descriptor) | 232 | #define FW_CDEV_IOC_ADD_DESCRIPTOR _IOWR('#', 0x06, struct fw_cdev_add_descriptor) |
233 | #define FW_CDEV_IOC_REMOVE_DESCRIPTOR _IOW('#', 0x07, struct fw_cdev_remove_descriptor) | ||
234 | #define FW_CDEV_IOC_CREATE_ISO_CONTEXT _IOWR('#', 0x08, struct fw_cdev_create_iso_context) | ||
235 | #define FW_CDEV_IOC_QUEUE_ISO _IOWR('#', 0x09, struct fw_cdev_queue_iso) | ||
236 | #define FW_CDEV_IOC_START_ISO _IOW('#', 0x0a, struct fw_cdev_start_iso) | ||
237 | #define FW_CDEV_IOC_STOP_ISO _IOW('#', 0x0b, struct fw_cdev_stop_iso) | ||
181 | 238 | ||
182 | #define FW_CDEV_IOC_CREATE_ISO_CONTEXT _IOWR('#', 0x08, struct fw_cdev_create_iso_context) | 239 | /* available since kernel version 2.6.24 */ |
183 | #define FW_CDEV_IOC_QUEUE_ISO _IOWR('#', 0x09, struct fw_cdev_queue_iso) | 240 | #define FW_CDEV_IOC_GET_CYCLE_TIMER _IOR('#', 0x0c, struct fw_cdev_get_cycle_timer) |
184 | #define FW_CDEV_IOC_START_ISO _IOW('#', 0x0a, struct fw_cdev_start_iso) | ||
185 | #define FW_CDEV_IOC_STOP_ISO _IOW('#', 0x0b, struct fw_cdev_stop_iso) | ||
186 | #define FW_CDEV_IOC_GET_CYCLE_TIMER _IOR('#', 0x0c, struct fw_cdev_get_cycle_timer) | ||
187 | 241 | ||
188 | /* FW_CDEV_VERSION History | 242 | /* available since kernel version 2.6.30 */ |
189 | * | 243 | #define FW_CDEV_IOC_ALLOCATE_ISO_RESOURCE _IOWR('#', 0x0d, struct fw_cdev_allocate_iso_resource) |
190 | * 1 Feb 18, 2007: Initial version. | 244 | #define FW_CDEV_IOC_DEALLOCATE_ISO_RESOURCE _IOW('#', 0x0e, struct fw_cdev_deallocate) |
245 | #define FW_CDEV_IOC_ALLOCATE_ISO_RESOURCE_ONCE _IOW('#', 0x0f, struct fw_cdev_allocate_iso_resource) | ||
246 | #define FW_CDEV_IOC_DEALLOCATE_ISO_RESOURCE_ONCE _IOW('#', 0x10, struct fw_cdev_allocate_iso_resource) | ||
247 | #define FW_CDEV_IOC_GET_SPEED _IO('#', 0x11) /* returns speed code */ | ||
248 | #define FW_CDEV_IOC_SEND_BROADCAST_REQUEST _IOW('#', 0x12, struct fw_cdev_send_request) | ||
249 | #define FW_CDEV_IOC_SEND_STREAM_PACKET _IOW('#', 0x13, struct fw_cdev_send_stream_packet) | ||
250 | |||
251 | /* | ||
252 | * FW_CDEV_VERSION History | ||
253 | * 1 (2.6.22) - initial version | ||
254 | * 2 (2.6.30) - changed &fw_cdev_event_iso_interrupt.header if | ||
255 | * &fw_cdev_create_iso_context.header_size is 8 or more | ||
191 | */ | 256 | */ |
192 | #define FW_CDEV_VERSION 1 | 257 | #define FW_CDEV_VERSION 2 |
193 | 258 | ||
194 | /** | 259 | /** |
195 | * struct fw_cdev_get_info - General purpose information ioctl | 260 | * struct fw_cdev_get_info - General purpose information ioctl |
@@ -201,7 +266,7 @@ union fw_cdev_event { | |||
201 | * case, @rom_length is updated with the actual length of the | 266 | * case, @rom_length is updated with the actual length of the |
202 | * configuration ROM. | 267 | * configuration ROM. |
203 | * @rom: If non-zero, address of a buffer to be filled by a copy of the | 268 | * @rom: If non-zero, address of a buffer to be filled by a copy of the |
204 | * local node's configuration ROM | 269 | * device's configuration ROM |
205 | * @bus_reset: If non-zero, address of a buffer to be filled by a | 270 | * @bus_reset: If non-zero, address of a buffer to be filled by a |
206 | * &struct fw_cdev_event_bus_reset with the current state | 271 | * &struct fw_cdev_event_bus_reset with the current state |
207 | * of the bus. This does not cause a bus reset to happen. | 272 | * of the bus. This does not cause a bus reset to happen. |
@@ -229,7 +294,7 @@ struct fw_cdev_get_info { | |||
229 | * Send a request to the device. This ioctl implements all outgoing requests. | 294 | * Send a request to the device. This ioctl implements all outgoing requests. |
230 | * Both quadlet and block request specify the payload as a pointer to the data | 295 | * Both quadlet and block request specify the payload as a pointer to the data |
231 | * in the @data field. Once the transaction completes, the kernel writes an | 296 | * in the @data field. Once the transaction completes, the kernel writes an |
232 | * &fw_cdev_event_request event back. The @closure field is passed back to | 297 | * &fw_cdev_event_response event back. The @closure field is passed back to |
233 | * user space in the response event. | 298 | * user space in the response event. |
234 | */ | 299 | */ |
235 | struct fw_cdev_send_request { | 300 | struct fw_cdev_send_request { |
@@ -284,9 +349,9 @@ struct fw_cdev_allocate { | |||
284 | }; | 349 | }; |
285 | 350 | ||
286 | /** | 351 | /** |
287 | * struct fw_cdev_deallocate - Free an address range allocation | 352 | * struct fw_cdev_deallocate - Free a CSR address range or isochronous resource |
288 | * @handle: Handle to the address range, as returned by the kernel when the | 353 | * @handle: Handle to the address range or iso resource, as returned by the |
289 | * range was allocated | 354 | * kernel when the range or resource was allocated |
290 | */ | 355 | */ |
291 | struct fw_cdev_deallocate { | 356 | struct fw_cdev_deallocate { |
292 | __u32 handle; | 357 | __u32 handle; |
@@ -329,6 +394,9 @@ struct fw_cdev_initiate_bus_reset { | |||
329 | * If successful, the kernel adds the descriptor and writes back a handle to the | 394 | * If successful, the kernel adds the descriptor and writes back a handle to the |
330 | * kernel-side object to be used for later removal of the descriptor block and | 395 | * kernel-side object to be used for later removal of the descriptor block and |
331 | * immediate key. | 396 | * immediate key. |
397 | * | ||
398 | * This ioctl affects the configuration ROMs of all local nodes. | ||
399 | * The ioctl only succeeds on device files which represent a local node. | ||
332 | */ | 400 | */ |
333 | struct fw_cdev_add_descriptor { | 401 | struct fw_cdev_add_descriptor { |
334 | __u32 immediate; | 402 | __u32 immediate; |
@@ -344,7 +412,7 @@ struct fw_cdev_add_descriptor { | |||
344 | * descriptor was added | 412 | * descriptor was added |
345 | * | 413 | * |
346 | * Remove a descriptor block and accompanying immediate key from the local | 414 | * Remove a descriptor block and accompanying immediate key from the local |
347 | * node's configuration ROM. | 415 | * nodes' configuration ROMs. |
348 | */ | 416 | */ |
349 | struct fw_cdev_remove_descriptor { | 417 | struct fw_cdev_remove_descriptor { |
350 | __u32 handle; | 418 | __u32 handle; |
@@ -370,6 +438,9 @@ struct fw_cdev_remove_descriptor { | |||
370 | * | 438 | * |
371 | * If a context was successfully created, the kernel writes back a handle to the | 439 | * If a context was successfully created, the kernel writes back a handle to the |
372 | * context, which must be passed in for subsequent operations on that context. | 440 | * context, which must be passed in for subsequent operations on that context. |
441 | * | ||
442 | * Note that the effect of a @header_size > 4 depends on | ||
443 | * &fw_cdev_get_info.version, as documented at &fw_cdev_event_iso_interrupt. | ||
373 | */ | 444 | */ |
374 | struct fw_cdev_create_iso_context { | 445 | struct fw_cdev_create_iso_context { |
375 | __u32 type; | 446 | __u32 type; |
@@ -473,10 +544,91 @@ struct fw_cdev_stop_iso { | |||
473 | * The %FW_CDEV_IOC_GET_CYCLE_TIMER ioctl reads the isochronous cycle timer | 544 | * The %FW_CDEV_IOC_GET_CYCLE_TIMER ioctl reads the isochronous cycle timer |
474 | * and also the system clock. This allows to express the receive time of an | 545 | * and also the system clock. This allows to express the receive time of an |
475 | * isochronous packet as a system time with microsecond accuracy. | 546 | * isochronous packet as a system time with microsecond accuracy. |
547 | * | ||
548 | * @cycle_timer consists of 7 bits cycleSeconds, 13 bits cycleCount, and | ||
549 | * 12 bits cycleOffset, in host byte order. | ||
476 | */ | 550 | */ |
477 | struct fw_cdev_get_cycle_timer { | 551 | struct fw_cdev_get_cycle_timer { |
478 | __u64 local_time; | 552 | __u64 local_time; |
479 | __u32 cycle_timer; | 553 | __u32 cycle_timer; |
480 | }; | 554 | }; |
481 | 555 | ||
556 | /** | ||
557 | * struct fw_cdev_allocate_iso_resource - (De)allocate a channel or bandwidth | ||
558 | * @closure: Passed back to userspace in correponding iso resource events | ||
559 | * @channels: Isochronous channels of which one is to be (de)allocated | ||
560 | * @bandwidth: Isochronous bandwidth units to be (de)allocated | ||
561 | * @handle: Handle to the allocation, written by the kernel (only valid in | ||
562 | * case of %FW_CDEV_IOC_ALLOCATE_ISO_RESOURCE ioctls) | ||
563 | * | ||
564 | * The %FW_CDEV_IOC_ALLOCATE_ISO_RESOURCE ioctl initiates allocation of an | ||
565 | * isochronous channel and/or of isochronous bandwidth at the isochronous | ||
566 | * resource manager (IRM). Only one of the channels specified in @channels is | ||
567 | * allocated. An %FW_CDEV_EVENT_ISO_RESOURCE_ALLOCATED is sent after | ||
568 | * communication with the IRM, indicating success or failure in the event data. | ||
569 | * The kernel will automatically reallocate the resources after bus resets. | ||
570 | * Should a reallocation fail, an %FW_CDEV_EVENT_ISO_RESOURCE_DEALLOCATED event | ||
571 | * will be sent. The kernel will also automatically deallocate the resources | ||
572 | * when the file descriptor is closed. | ||
573 | * | ||
574 | * The %FW_CDEV_IOC_DEALLOCATE_ISO_RESOURCE ioctl can be used to initiate | ||
575 | * deallocation of resources which were allocated as described above. | ||
576 | * An %FW_CDEV_EVENT_ISO_RESOURCE_DEALLOCATED event concludes this operation. | ||
577 | * | ||
578 | * The %FW_CDEV_IOC_ALLOCATE_ISO_RESOURCE_ONCE ioctl is a variant of allocation | ||
579 | * without automatic re- or deallocation. | ||
580 | * An %FW_CDEV_EVENT_ISO_RESOURCE_ALLOCATED event concludes this operation, | ||
581 | * indicating success or failure in its data. | ||
582 | * | ||
583 | * The %FW_CDEV_IOC_DEALLOCATE_ISO_RESOURCE_ONCE ioctl works like | ||
584 | * %FW_CDEV_IOC_ALLOCATE_ISO_RESOURCE_ONCE except that resources are freed | ||
585 | * instead of allocated. | ||
586 | * An %FW_CDEV_EVENT_ISO_RESOURCE_DEALLOCATED event concludes this operation. | ||
587 | * | ||
588 | * To summarize, %FW_CDEV_IOC_DEALLOCATE_ISO_RESOURCE allocates iso resources | ||
589 | * for the lifetime of the fd or handle. | ||
590 | * In contrast, %FW_CDEV_IOC_ALLOCATE_ISO_RESOURCE_ONCE allocates iso resources | ||
591 | * for the duration of a bus generation. | ||
592 | * | ||
593 | * @channels is a host-endian bitfield with the least significant bit | ||
594 | * representing channel 0 and the most significant bit representing channel 63: | ||
595 | * 1ULL << c for each channel c that is a candidate for (de)allocation. | ||
596 | * | ||
597 | * @bandwidth is expressed in bandwidth allocation units, i.e. the time to send | ||
598 | * one quadlet of data (payload or header data) at speed S1600. | ||
599 | */ | ||
600 | struct fw_cdev_allocate_iso_resource { | ||
601 | __u64 closure; | ||
602 | __u64 channels; | ||
603 | __u32 bandwidth; | ||
604 | __u32 handle; | ||
605 | }; | ||
606 | |||
607 | /** | ||
608 | * struct fw_cdev_send_stream_packet - send an asynchronous stream packet | ||
609 | * @length: Length of outgoing payload, in bytes | ||
610 | * @tag: Data format tag | ||
611 | * @channel: Isochronous channel to transmit to | ||
612 | * @sy: Synchronization code | ||
613 | * @closure: Passed back to userspace in the response event | ||
614 | * @data: Userspace pointer to payload | ||
615 | * @generation: The bus generation where packet is valid | ||
616 | * @speed: Speed to transmit at | ||
617 | * | ||
618 | * The %FW_CDEV_IOC_SEND_STREAM_PACKET ioctl sends an asynchronous stream packet | ||
619 | * to every device which is listening to the specified channel. The kernel | ||
620 | * writes an &fw_cdev_event_response event which indicates success or failure of | ||
621 | * the transmission. | ||
622 | */ | ||
623 | struct fw_cdev_send_stream_packet { | ||
624 | __u32 length; | ||
625 | __u32 tag; | ||
626 | __u32 channel; | ||
627 | __u32 sy; | ||
628 | __u64 closure; | ||
629 | __u64 data; | ||
630 | __u32 generation; | ||
631 | __u32 speed; | ||
632 | }; | ||
633 | |||
482 | #endif /* _LINUX_FIREWIRE_CDEV_H */ | 634 | #endif /* _LINUX_FIREWIRE_CDEV_H */ |
diff --git a/include/linux/fs.h b/include/linux/fs.h index 1cd44f727dac..42436ae42f70 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h | |||
@@ -1064,34 +1064,147 @@ extern int lease_modify(struct file_lock **, int); | |||
1064 | extern int lock_may_read(struct inode *, loff_t start, unsigned long count); | 1064 | extern int lock_may_read(struct inode *, loff_t start, unsigned long count); |
1065 | extern int lock_may_write(struct inode *, loff_t start, unsigned long count); | 1065 | extern int lock_may_write(struct inode *, loff_t start, unsigned long count); |
1066 | #else /* !CONFIG_FILE_LOCKING */ | 1066 | #else /* !CONFIG_FILE_LOCKING */ |
1067 | #define fcntl_getlk(a, b) ({ -EINVAL; }) | 1067 | static inline int fcntl_getlk(struct file *file, struct flock __user *user) |
1068 | #define fcntl_setlk(a, b, c, d) ({ -EACCES; }) | 1068 | { |
1069 | return -EINVAL; | ||
1070 | } | ||
1071 | |||
1072 | static inline int fcntl_setlk(unsigned int fd, struct file *file, | ||
1073 | unsigned int cmd, struct flock __user *user) | ||
1074 | { | ||
1075 | return -EACCES; | ||
1076 | } | ||
1077 | |||
1069 | #if BITS_PER_LONG == 32 | 1078 | #if BITS_PER_LONG == 32 |
1070 | #define fcntl_getlk64(a, b) ({ -EINVAL; }) | 1079 | static inline int fcntl_getlk64(struct file *file, struct flock64 __user *user) |
1071 | #define fcntl_setlk64(a, b, c, d) ({ -EACCES; }) | 1080 | { |
1081 | return -EINVAL; | ||
1082 | } | ||
1083 | |||
1084 | static inline int fcntl_setlk64(unsigned int fd, struct file *file, | ||
1085 | unsigned int cmd, struct flock64 __user *user) | ||
1086 | { | ||
1087 | return -EACCES; | ||
1088 | } | ||
1072 | #endif | 1089 | #endif |
1073 | #define fcntl_setlease(a, b, c) ({ 0; }) | 1090 | static inline int fcntl_setlease(unsigned int fd, struct file *filp, long arg) |
1074 | #define fcntl_getlease(a) ({ 0; }) | 1091 | { |
1075 | #define locks_init_lock(a) ({ }) | 1092 | return 0; |
1076 | #define __locks_copy_lock(a, b) ({ }) | 1093 | } |
1077 | #define locks_copy_lock(a, b) ({ }) | 1094 | |
1078 | #define locks_remove_posix(a, b) ({ }) | 1095 | static inline int fcntl_getlease(struct file *filp) |
1079 | #define locks_remove_flock(a) ({ }) | 1096 | { |
1080 | #define posix_test_lock(a, b) ({ 0; }) | 1097 | return 0; |
1081 | #define posix_lock_file(a, b, c) ({ -ENOLCK; }) | 1098 | } |
1082 | #define posix_lock_file_wait(a, b) ({ -ENOLCK; }) | 1099 | |
1083 | #define posix_unblock_lock(a, b) (-ENOENT) | 1100 | static inline void locks_init_lock(struct file_lock *fl) |
1084 | #define vfs_test_lock(a, b) ({ 0; }) | 1101 | { |
1085 | #define vfs_lock_file(a, b, c, d) (-ENOLCK) | 1102 | return; |
1086 | #define vfs_cancel_lock(a, b) ({ 0; }) | 1103 | } |
1087 | #define flock_lock_file_wait(a, b) ({ -ENOLCK; }) | 1104 | |
1088 | #define __break_lease(a, b) ({ 0; }) | 1105 | static inline void __locks_copy_lock(struct file_lock *new, struct file_lock *fl) |
1089 | #define lease_get_mtime(a, b) ({ }) | 1106 | { |
1090 | #define generic_setlease(a, b, c) ({ -EINVAL; }) | 1107 | return; |
1091 | #define vfs_setlease(a, b, c) ({ -EINVAL; }) | 1108 | } |
1092 | #define lease_modify(a, b) ({ -EINVAL; }) | 1109 | |
1093 | #define lock_may_read(a, b, c) ({ 1; }) | 1110 | static inline void locks_copy_lock(struct file_lock *new, struct file_lock *fl) |
1094 | #define lock_may_write(a, b, c) ({ 1; }) | 1111 | { |
1112 | return; | ||
1113 | } | ||
1114 | |||
1115 | static inline void locks_remove_posix(struct file *filp, fl_owner_t owner) | ||
1116 | { | ||
1117 | return; | ||
1118 | } | ||
1119 | |||
1120 | static inline void locks_remove_flock(struct file *filp) | ||
1121 | { | ||
1122 | return; | ||
1123 | } | ||
1124 | |||
1125 | static inline void posix_test_lock(struct file *filp, struct file_lock *fl) | ||
1126 | { | ||
1127 | return; | ||
1128 | } | ||
1129 | |||
1130 | static inline int posix_lock_file(struct file *filp, struct file_lock *fl, | ||
1131 | struct file_lock *conflock) | ||
1132 | { | ||
1133 | return -ENOLCK; | ||
1134 | } | ||
1135 | |||
1136 | static inline int posix_lock_file_wait(struct file *filp, struct file_lock *fl) | ||
1137 | { | ||
1138 | return -ENOLCK; | ||
1139 | } | ||
1140 | |||
1141 | static inline int posix_unblock_lock(struct file *filp, | ||
1142 | struct file_lock *waiter) | ||
1143 | { | ||
1144 | return -ENOENT; | ||
1145 | } | ||
1146 | |||
1147 | static inline int vfs_test_lock(struct file *filp, struct file_lock *fl) | ||
1148 | { | ||
1149 | return 0; | ||
1150 | } | ||
1151 | |||
1152 | static inline int vfs_lock_file(struct file *filp, unsigned int cmd, | ||
1153 | struct file_lock *fl, struct file_lock *conf) | ||
1154 | { | ||
1155 | return -ENOLCK; | ||
1156 | } | ||
1157 | |||
1158 | static inline int vfs_cancel_lock(struct file *filp, struct file_lock *fl) | ||
1159 | { | ||
1160 | return 0; | ||
1161 | } | ||
1162 | |||
1163 | static inline int flock_lock_file_wait(struct file *filp, | ||
1164 | struct file_lock *request) | ||
1165 | { | ||
1166 | return -ENOLCK; | ||
1167 | } | ||
1168 | |||
1169 | static inline int __break_lease(struct inode *inode, unsigned int mode) | ||
1170 | { | ||
1171 | return 0; | ||
1172 | } | ||
1173 | |||
1174 | static inline void lease_get_mtime(struct inode *inode, struct timespec *time) | ||
1175 | { | ||
1176 | return; | ||
1177 | } | ||
1178 | |||
1179 | static inline int generic_setlease(struct file *filp, long arg, | ||
1180 | struct file_lock **flp) | ||
1181 | { | ||
1182 | return -EINVAL; | ||
1183 | } | ||
1184 | |||
1185 | static inline int vfs_setlease(struct file *filp, long arg, | ||
1186 | struct file_lock **lease) | ||
1187 | { | ||
1188 | return -EINVAL; | ||
1189 | } | ||
1190 | |||
1191 | static inline int lease_modify(struct file_lock **before, int arg) | ||
1192 | { | ||
1193 | return -EINVAL; | ||
1194 | } | ||
1195 | |||
1196 | static inline int lock_may_read(struct inode *inode, loff_t start, | ||
1197 | unsigned long len) | ||
1198 | { | ||
1199 | return 1; | ||
1200 | } | ||
1201 | |||
1202 | static inline int lock_may_write(struct inode *inode, loff_t start, | ||
1203 | unsigned long len) | ||
1204 | { | ||
1205 | return 1; | ||
1206 | } | ||
1207 | |||
1095 | #endif /* !CONFIG_FILE_LOCKING */ | 1208 | #endif /* !CONFIG_FILE_LOCKING */ |
1096 | 1209 | ||
1097 | 1210 | ||
@@ -1607,7 +1720,7 @@ struct super_block *sget(struct file_system_type *type, | |||
1607 | extern int get_sb_pseudo(struct file_system_type *, char *, | 1720 | extern int get_sb_pseudo(struct file_system_type *, char *, |
1608 | const struct super_operations *ops, unsigned long, | 1721 | const struct super_operations *ops, unsigned long, |
1609 | struct vfsmount *mnt); | 1722 | struct vfsmount *mnt); |
1610 | extern int simple_set_mnt(struct vfsmount *mnt, struct super_block *sb); | 1723 | extern void simple_set_mnt(struct vfsmount *mnt, struct super_block *sb); |
1611 | int __put_super_and_need_restart(struct super_block *sb); | 1724 | int __put_super_and_need_restart(struct super_block *sb); |
1612 | 1725 | ||
1613 | /* Alas, no aliases. Too much hassle with bringing module.h everywhere */ | 1726 | /* Alas, no aliases. Too much hassle with bringing module.h everywhere */ |
@@ -1688,13 +1801,44 @@ static inline int break_lease(struct inode *inode, unsigned int mode) | |||
1688 | return 0; | 1801 | return 0; |
1689 | } | 1802 | } |
1690 | #else /* !CONFIG_FILE_LOCKING */ | 1803 | #else /* !CONFIG_FILE_LOCKING */ |
1691 | #define locks_mandatory_locked(a) ({ 0; }) | 1804 | static inline int locks_mandatory_locked(struct inode *inode) |
1692 | #define locks_mandatory_area(a, b, c, d, e) ({ 0; }) | 1805 | { |
1693 | #define __mandatory_lock(a) ({ 0; }) | 1806 | return 0; |
1694 | #define mandatory_lock(a) ({ 0; }) | 1807 | } |
1695 | #define locks_verify_locked(a) ({ 0; }) | 1808 | |
1696 | #define locks_verify_truncate(a, b, c) ({ 0; }) | 1809 | static inline int locks_mandatory_area(int rw, struct inode *inode, |
1697 | #define break_lease(a, b) ({ 0; }) | 1810 | struct file *filp, loff_t offset, |
1811 | size_t count) | ||
1812 | { | ||
1813 | return 0; | ||
1814 | } | ||
1815 | |||
1816 | static inline int __mandatory_lock(struct inode *inode) | ||
1817 | { | ||
1818 | return 0; | ||
1819 | } | ||
1820 | |||
1821 | static inline int mandatory_lock(struct inode *inode) | ||
1822 | { | ||
1823 | return 0; | ||
1824 | } | ||
1825 | |||
1826 | static inline int locks_verify_locked(struct inode *inode) | ||
1827 | { | ||
1828 | return 0; | ||
1829 | } | ||
1830 | |||
1831 | static inline int locks_verify_truncate(struct inode *inode, struct file *filp, | ||
1832 | size_t size) | ||
1833 | { | ||
1834 | return 0; | ||
1835 | } | ||
1836 | |||
1837 | static inline int break_lease(struct inode *inode, unsigned int mode) | ||
1838 | { | ||
1839 | return 0; | ||
1840 | } | ||
1841 | |||
1698 | #endif /* CONFIG_FILE_LOCKING */ | 1842 | #endif /* CONFIG_FILE_LOCKING */ |
1699 | 1843 | ||
1700 | /* fs/open.c */ | 1844 | /* fs/open.c */ |
@@ -1731,6 +1875,13 @@ extern void bd_set_size(struct block_device *, loff_t size); | |||
1731 | extern void bd_forget(struct inode *inode); | 1875 | extern void bd_forget(struct inode *inode); |
1732 | extern void bdput(struct block_device *); | 1876 | extern void bdput(struct block_device *); |
1733 | extern struct block_device *open_by_devnum(dev_t, fmode_t); | 1877 | extern struct block_device *open_by_devnum(dev_t, fmode_t); |
1878 | extern void invalidate_bdev(struct block_device *); | ||
1879 | extern int sync_blockdev(struct block_device *bdev); | ||
1880 | extern struct super_block *freeze_bdev(struct block_device *); | ||
1881 | extern int thaw_bdev(struct block_device *bdev, struct super_block *sb); | ||
1882 | extern int fsync_bdev(struct block_device *); | ||
1883 | extern int fsync_super(struct super_block *); | ||
1884 | extern int fsync_no_super(struct block_device *); | ||
1734 | #else | 1885 | #else |
1735 | static inline void bd_forget(struct inode *inode) {} | 1886 | static inline void bd_forget(struct inode *inode) {} |
1736 | #endif | 1887 | #endif |
@@ -1882,7 +2033,6 @@ static inline void allow_write_access(struct file *file) | |||
1882 | if (file) | 2033 | if (file) |
1883 | atomic_inc(&file->f_path.dentry->d_inode->i_writecount); | 2034 | atomic_inc(&file->f_path.dentry->d_inode->i_writecount); |
1884 | } | 2035 | } |
1885 | extern int do_pipe(int *); | ||
1886 | extern int do_pipe_flags(int *, int); | 2036 | extern int do_pipe_flags(int *, int); |
1887 | extern struct file *create_read_pipe(struct file *f, int flags); | 2037 | extern struct file *create_read_pipe(struct file *f, int flags); |
1888 | extern struct file *create_write_pipe(int flags); | 2038 | extern struct file *create_write_pipe(int flags); |
diff --git a/include/linux/i2c-algo-pca.h b/include/linux/i2c-algo-pca.h index adcb3dc7ac26..1364d62e2fbe 100644 --- a/include/linux/i2c-algo-pca.h +++ b/include/linux/i2c-algo-pca.h | |||
@@ -1,7 +1,14 @@ | |||
1 | #ifndef _LINUX_I2C_ALGO_PCA_H | 1 | #ifndef _LINUX_I2C_ALGO_PCA_H |
2 | #define _LINUX_I2C_ALGO_PCA_H | 2 | #define _LINUX_I2C_ALGO_PCA_H |
3 | 3 | ||
4 | /* Clock speeds for the bus */ | 4 | /* Chips known to the pca algo */ |
5 | #define I2C_PCA_CHIP_9564 0x00 | ||
6 | #define I2C_PCA_CHIP_9665 0x01 | ||
7 | |||
8 | /* Internal period for PCA9665 oscilator */ | ||
9 | #define I2C_PCA_OSC_PER 3 /* e10-8s */ | ||
10 | |||
11 | /* Clock speeds for the bus for PCA9564*/ | ||
5 | #define I2C_PCA_CON_330kHz 0x00 | 12 | #define I2C_PCA_CON_330kHz 0x00 |
6 | #define I2C_PCA_CON_288kHz 0x01 | 13 | #define I2C_PCA_CON_288kHz 0x01 |
7 | #define I2C_PCA_CON_217kHz 0x02 | 14 | #define I2C_PCA_CON_217kHz 0x02 |
@@ -18,6 +25,26 @@ | |||
18 | #define I2C_PCA_ADR 0x02 /* OWN ADR Read/Write */ | 25 | #define I2C_PCA_ADR 0x02 /* OWN ADR Read/Write */ |
19 | #define I2C_PCA_CON 0x03 /* CONTROL Read/Write */ | 26 | #define I2C_PCA_CON 0x03 /* CONTROL Read/Write */ |
20 | 27 | ||
28 | /* PCA9665 registers */ | ||
29 | #define I2C_PCA_INDPTR 0x00 /* INDIRECT Pointer Write Only */ | ||
30 | #define I2C_PCA_IND 0x02 /* INDIRECT Read/Write */ | ||
31 | |||
32 | /* PCA9665 indirect registers */ | ||
33 | #define I2C_PCA_ICOUNT 0x00 /* Byte Count for buffered mode */ | ||
34 | #define I2C_PCA_IADR 0x01 /* OWN ADR */ | ||
35 | #define I2C_PCA_ISCLL 0x02 /* SCL LOW period */ | ||
36 | #define I2C_PCA_ISCLH 0x03 /* SCL HIGH period */ | ||
37 | #define I2C_PCA_ITO 0x04 /* TIMEOUT */ | ||
38 | #define I2C_PCA_IPRESET 0x05 /* Parallel bus reset */ | ||
39 | #define I2C_PCA_IMODE 0x06 /* I2C Bus mode */ | ||
40 | |||
41 | /* PCA9665 I2C bus mode */ | ||
42 | #define I2C_PCA_MODE_STD 0x00 /* Standard mode */ | ||
43 | #define I2C_PCA_MODE_FAST 0x01 /* Fast mode */ | ||
44 | #define I2C_PCA_MODE_FASTP 0x02 /* Fast Plus mode */ | ||
45 | #define I2C_PCA_MODE_TURBO 0x03 /* Turbo mode */ | ||
46 | |||
47 | |||
21 | #define I2C_PCA_CON_AA 0x80 /* Assert Acknowledge */ | 48 | #define I2C_PCA_CON_AA 0x80 /* Assert Acknowledge */ |
22 | #define I2C_PCA_CON_ENSIO 0x40 /* Enable */ | 49 | #define I2C_PCA_CON_ENSIO 0x40 /* Enable */ |
23 | #define I2C_PCA_CON_STA 0x20 /* Start */ | 50 | #define I2C_PCA_CON_STA 0x20 /* Start */ |
@@ -31,7 +58,9 @@ struct i2c_algo_pca_data { | |||
31 | int (*read_byte) (void *data, int reg); | 58 | int (*read_byte) (void *data, int reg); |
32 | int (*wait_for_completion) (void *data); | 59 | int (*wait_for_completion) (void *data); |
33 | void (*reset_chip) (void *data); | 60 | void (*reset_chip) (void *data); |
34 | /* i2c_clock values are defined in linux/i2c-algo-pca.h */ | 61 | /* For PCA9564, use one of the predefined frequencies: |
62 | * 330000, 288000, 217000, 146000, 88000, 59000, 44000, 36000 | ||
63 | * For PCA9665, use the frequency you want here. */ | ||
35 | unsigned int i2c_clock; | 64 | unsigned int i2c_clock; |
36 | }; | 65 | }; |
37 | 66 | ||
diff --git a/include/linux/i2c-pca-platform.h b/include/linux/i2c-pca-platform.h index 3d191873f2d1..aba33759dec4 100644 --- a/include/linux/i2c-pca-platform.h +++ b/include/linux/i2c-pca-platform.h | |||
@@ -6,7 +6,7 @@ struct i2c_pca9564_pf_platform_data { | |||
6 | * not supplied (negative value), but it | 6 | * not supplied (negative value), but it |
7 | * cannot exit some error conditions then */ | 7 | * cannot exit some error conditions then */ |
8 | int i2c_clock_speed; /* values are defined in linux/i2c-algo-pca.h */ | 8 | int i2c_clock_speed; /* values are defined in linux/i2c-algo-pca.h */ |
9 | int timeout; /* timeout = this value * 10us */ | 9 | int timeout; /* timeout in jiffies */ |
10 | }; | 10 | }; |
11 | 11 | ||
12 | #endif /* I2C_PCA9564_PLATFORM_H */ | 12 | #endif /* I2C_PCA9564_PLATFORM_H */ |
diff --git a/include/linux/if_ether.h b/include/linux/if_ether.h index 0216e1bdbc56..cfe4fe1b7132 100644 --- a/include/linux/if_ether.h +++ b/include/linux/if_ether.h | |||
@@ -78,6 +78,7 @@ | |||
78 | #define ETH_P_PAE 0x888E /* Port Access Entity (IEEE 802.1X) */ | 78 | #define ETH_P_PAE 0x888E /* Port Access Entity (IEEE 802.1X) */ |
79 | #define ETH_P_AOE 0x88A2 /* ATA over Ethernet */ | 79 | #define ETH_P_AOE 0x88A2 /* ATA over Ethernet */ |
80 | #define ETH_P_TIPC 0x88CA /* TIPC */ | 80 | #define ETH_P_TIPC 0x88CA /* TIPC */ |
81 | #define ETH_P_FCOE 0x8906 /* Fibre Channel over Ethernet */ | ||
81 | #define ETH_P_EDSA 0xDADA /* Ethertype DSA [ NOT AN OFFICIALLY REGISTERED ID ] */ | 82 | #define ETH_P_EDSA 0xDADA /* Ethertype DSA [ NOT AN OFFICIALLY REGISTERED ID ] */ |
82 | 83 | ||
83 | /* | 84 | /* |
diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h index 91658d076598..0c9cb63e6895 100644 --- a/include/linux/interrupt.h +++ b/include/linux/interrupt.h | |||
@@ -484,6 +484,7 @@ int show_interrupts(struct seq_file *p, void *v); | |||
484 | struct irq_desc; | 484 | struct irq_desc; |
485 | 485 | ||
486 | extern int early_irq_init(void); | 486 | extern int early_irq_init(void); |
487 | extern int arch_probe_nr_irqs(void); | ||
487 | extern int arch_early_irq_init(void); | 488 | extern int arch_early_irq_init(void); |
488 | extern int arch_init_chip_data(struct irq_desc *desc, int cpu); | 489 | extern int arch_init_chip_data(struct irq_desc *desc, int cpu); |
489 | 490 | ||
diff --git a/include/linux/irq.h b/include/linux/irq.h index 6db939a575bd..873e4ac11b81 100644 --- a/include/linux/irq.h +++ b/include/linux/irq.h | |||
@@ -180,11 +180,11 @@ struct irq_desc { | |||
180 | unsigned int irqs_unhandled; | 180 | unsigned int irqs_unhandled; |
181 | spinlock_t lock; | 181 | spinlock_t lock; |
182 | #ifdef CONFIG_SMP | 182 | #ifdef CONFIG_SMP |
183 | cpumask_t affinity; | 183 | cpumask_var_t affinity; |
184 | unsigned int cpu; | 184 | unsigned int cpu; |
185 | #endif | ||
186 | #ifdef CONFIG_GENERIC_PENDING_IRQ | 185 | #ifdef CONFIG_GENERIC_PENDING_IRQ |
187 | cpumask_t pending_mask; | 186 | cpumask_var_t pending_mask; |
187 | #endif | ||
188 | #endif | 188 | #endif |
189 | #ifdef CONFIG_PROC_FS | 189 | #ifdef CONFIG_PROC_FS |
190 | struct proc_dir_entry *dir; | 190 | struct proc_dir_entry *dir; |
@@ -414,4 +414,84 @@ extern int set_irq_msi(unsigned int irq, struct msi_desc *entry); | |||
414 | 414 | ||
415 | #endif /* !CONFIG_S390 */ | 415 | #endif /* !CONFIG_S390 */ |
416 | 416 | ||
417 | #ifdef CONFIG_SMP | ||
418 | /** | ||
419 | * init_alloc_desc_masks - allocate cpumasks for irq_desc | ||
420 | * @desc: pointer to irq_desc struct | ||
421 | * @cpu: cpu which will be handling the cpumasks | ||
422 | * @boot: true if need bootmem | ||
423 | * | ||
424 | * Allocates affinity and pending_mask cpumask if required. | ||
425 | * Returns true if successful (or not required). | ||
426 | * Side effect: affinity has all bits set, pending_mask has all bits clear. | ||
427 | */ | ||
428 | static inline bool init_alloc_desc_masks(struct irq_desc *desc, int cpu, | ||
429 | bool boot) | ||
430 | { | ||
431 | int node; | ||
432 | |||
433 | if (boot) { | ||
434 | alloc_bootmem_cpumask_var(&desc->affinity); | ||
435 | cpumask_setall(desc->affinity); | ||
436 | |||
437 | #ifdef CONFIG_GENERIC_PENDING_IRQ | ||
438 | alloc_bootmem_cpumask_var(&desc->pending_mask); | ||
439 | cpumask_clear(desc->pending_mask); | ||
440 | #endif | ||
441 | return true; | ||
442 | } | ||
443 | |||
444 | node = cpu_to_node(cpu); | ||
445 | |||
446 | if (!alloc_cpumask_var_node(&desc->affinity, GFP_ATOMIC, node)) | ||
447 | return false; | ||
448 | cpumask_setall(desc->affinity); | ||
449 | |||
450 | #ifdef CONFIG_GENERIC_PENDING_IRQ | ||
451 | if (!alloc_cpumask_var_node(&desc->pending_mask, GFP_ATOMIC, node)) { | ||
452 | free_cpumask_var(desc->affinity); | ||
453 | return false; | ||
454 | } | ||
455 | cpumask_clear(desc->pending_mask); | ||
456 | #endif | ||
457 | return true; | ||
458 | } | ||
459 | |||
460 | /** | ||
461 | * init_copy_desc_masks - copy cpumasks for irq_desc | ||
462 | * @old_desc: pointer to old irq_desc struct | ||
463 | * @new_desc: pointer to new irq_desc struct | ||
464 | * | ||
465 | * Insures affinity and pending_masks are copied to new irq_desc. | ||
466 | * If !CONFIG_CPUMASKS_OFFSTACK the cpumasks are embedded in the | ||
467 | * irq_desc struct so the copy is redundant. | ||
468 | */ | ||
469 | |||
470 | static inline void init_copy_desc_masks(struct irq_desc *old_desc, | ||
471 | struct irq_desc *new_desc) | ||
472 | { | ||
473 | #ifdef CONFIG_CPUMASKS_OFFSTACK | ||
474 | cpumask_copy(new_desc->affinity, old_desc->affinity); | ||
475 | |||
476 | #ifdef CONFIG_GENERIC_PENDING_IRQ | ||
477 | cpumask_copy(new_desc->pending_mask, old_desc->pending_mask); | ||
478 | #endif | ||
479 | #endif | ||
480 | } | ||
481 | |||
482 | #else /* !CONFIG_SMP */ | ||
483 | |||
484 | static inline bool init_alloc_desc_masks(struct irq_desc *desc, int cpu, | ||
485 | bool boot) | ||
486 | { | ||
487 | return true; | ||
488 | } | ||
489 | |||
490 | static inline void init_copy_desc_masks(struct irq_desc *old_desc, | ||
491 | struct irq_desc *new_desc) | ||
492 | { | ||
493 | } | ||
494 | |||
495 | #endif /* CONFIG_SMP */ | ||
496 | |||
417 | #endif /* _LINUX_IRQ_H */ | 497 | #endif /* _LINUX_IRQ_H */ |
diff --git a/include/linux/irqnr.h b/include/linux/irqnr.h index 52ebbb4b161d..ec87b212ff7d 100644 --- a/include/linux/irqnr.h +++ b/include/linux/irqnr.h | |||
@@ -20,6 +20,7 @@ | |||
20 | 20 | ||
21 | # define for_each_irq_desc_reverse(irq, desc) \ | 21 | # define for_each_irq_desc_reverse(irq, desc) \ |
22 | for (irq = nr_irqs - 1; irq >= 0; irq--) | 22 | for (irq = nr_irqs - 1; irq >= 0; irq--) |
23 | |||
23 | #else /* CONFIG_GENERIC_HARDIRQS */ | 24 | #else /* CONFIG_GENERIC_HARDIRQS */ |
24 | 25 | ||
25 | extern int nr_irqs; | 26 | extern int nr_irqs; |
diff --git a/include/linux/kprobes.h b/include/linux/kprobes.h index 32851eef48f0..2ec6cc14a114 100644 --- a/include/linux/kprobes.h +++ b/include/linux/kprobes.h | |||
@@ -182,6 +182,14 @@ struct kprobe_blackpoint { | |||
182 | DECLARE_PER_CPU(struct kprobe *, current_kprobe); | 182 | DECLARE_PER_CPU(struct kprobe *, current_kprobe); |
183 | DECLARE_PER_CPU(struct kprobe_ctlblk, kprobe_ctlblk); | 183 | DECLARE_PER_CPU(struct kprobe_ctlblk, kprobe_ctlblk); |
184 | 184 | ||
185 | /* | ||
186 | * For #ifdef avoidance: | ||
187 | */ | ||
188 | static inline int kprobes_built_in(void) | ||
189 | { | ||
190 | return 1; | ||
191 | } | ||
192 | |||
185 | #ifdef CONFIG_KRETPROBES | 193 | #ifdef CONFIG_KRETPROBES |
186 | extern void arch_prepare_kretprobe(struct kretprobe_instance *ri, | 194 | extern void arch_prepare_kretprobe(struct kretprobe_instance *ri, |
187 | struct pt_regs *regs); | 195 | struct pt_regs *regs); |
@@ -271,8 +279,16 @@ void unregister_kretprobes(struct kretprobe **rps, int num); | |||
271 | void kprobe_flush_task(struct task_struct *tk); | 279 | void kprobe_flush_task(struct task_struct *tk); |
272 | void recycle_rp_inst(struct kretprobe_instance *ri, struct hlist_head *head); | 280 | void recycle_rp_inst(struct kretprobe_instance *ri, struct hlist_head *head); |
273 | 281 | ||
274 | #else /* CONFIG_KPROBES */ | 282 | #else /* !CONFIG_KPROBES: */ |
275 | 283 | ||
284 | static inline int kprobes_built_in(void) | ||
285 | { | ||
286 | return 0; | ||
287 | } | ||
288 | static inline int kprobe_fault_handler(struct pt_regs *regs, int trapnr) | ||
289 | { | ||
290 | return 0; | ||
291 | } | ||
276 | static inline struct kprobe *get_kprobe(void *addr) | 292 | static inline struct kprobe *get_kprobe(void *addr) |
277 | { | 293 | { |
278 | return NULL; | 294 | return NULL; |
@@ -329,5 +345,5 @@ static inline void unregister_kretprobes(struct kretprobe **rps, int num) | |||
329 | static inline void kprobe_flush_task(struct task_struct *tk) | 345 | static inline void kprobe_flush_task(struct task_struct *tk) |
330 | { | 346 | { |
331 | } | 347 | } |
332 | #endif /* CONFIG_KPROBES */ | 348 | #endif /* CONFIG_KPROBES */ |
333 | #endif /* _LINUX_KPROBES_H */ | 349 | #endif /* _LINUX_KPROBES_H */ |
diff --git a/include/linux/magic.h b/include/linux/magic.h index 0b4df7eba852..5b4e28bcb788 100644 --- a/include/linux/magic.h +++ b/include/linux/magic.h | |||
@@ -49,4 +49,5 @@ | |||
49 | #define FUTEXFS_SUPER_MAGIC 0xBAD1DEA | 49 | #define FUTEXFS_SUPER_MAGIC 0xBAD1DEA |
50 | #define INOTIFYFS_SUPER_MAGIC 0x2BAD1DEA | 50 | #define INOTIFYFS_SUPER_MAGIC 0x2BAD1DEA |
51 | 51 | ||
52 | #define STACK_END_MAGIC 0x57AC6E9D | ||
52 | #endif /* __LINUX_MAGIC_H__ */ | 53 | #endif /* __LINUX_MAGIC_H__ */ |
diff --git a/include/linux/major.h b/include/linux/major.h index 88249452b935..058ec15dd060 100644 --- a/include/linux/major.h +++ b/include/linux/major.h | |||
@@ -171,5 +171,6 @@ | |||
171 | #define VIOTAPE_MAJOR 230 | 171 | #define VIOTAPE_MAJOR 230 |
172 | 172 | ||
173 | #define BLOCK_EXT_MAJOR 259 | 173 | #define BLOCK_EXT_MAJOR 259 |
174 | #define SCSI_OSD_MAJOR 260 /* open-osd's OSD scsi device */ | ||
174 | 175 | ||
175 | #endif | 176 | #endif |
diff --git a/include/linux/miscdevice.h b/include/linux/miscdevice.h index a820f816a49e..beb6ec99cfef 100644 --- a/include/linux/miscdevice.h +++ b/include/linux/miscdevice.h | |||
@@ -26,6 +26,7 @@ | |||
26 | #define TUN_MINOR 200 | 26 | #define TUN_MINOR 200 |
27 | #define MWAVE_MINOR 219 /* ACP/Mwave Modem */ | 27 | #define MWAVE_MINOR 219 /* ACP/Mwave Modem */ |
28 | #define MPT_MINOR 220 | 28 | #define MPT_MINOR 220 |
29 | #define MPT2SAS_MINOR 221 | ||
29 | #define HPET_MINOR 228 | 30 | #define HPET_MINOR 228 |
30 | #define FUSE_MINOR 229 | 31 | #define FUSE_MINOR 229 |
31 | #define KVM_MINOR 232 | 32 | #define KVM_MINOR 232 |
diff --git a/include/linux/mmiotrace.h b/include/linux/mmiotrace.h index 139d7c88d9c9..3d1b7bde1283 100644 --- a/include/linux/mmiotrace.h +++ b/include/linux/mmiotrace.h | |||
@@ -1,5 +1,5 @@ | |||
1 | #ifndef MMIOTRACE_H | 1 | #ifndef _LINUX_MMIOTRACE_H |
2 | #define MMIOTRACE_H | 2 | #define _LINUX_MMIOTRACE_H |
3 | 3 | ||
4 | #include <linux/types.h> | 4 | #include <linux/types.h> |
5 | #include <linux/list.h> | 5 | #include <linux/list.h> |
@@ -13,28 +13,34 @@ typedef void (*kmmio_post_handler_t)(struct kmmio_probe *, | |||
13 | unsigned long condition, struct pt_regs *); | 13 | unsigned long condition, struct pt_regs *); |
14 | 14 | ||
15 | struct kmmio_probe { | 15 | struct kmmio_probe { |
16 | struct list_head list; /* kmmio internal list */ | 16 | /* kmmio internal list: */ |
17 | unsigned long addr; /* start location of the probe point */ | 17 | struct list_head list; |
18 | unsigned long len; /* length of the probe region */ | 18 | /* start location of the probe point: */ |
19 | kmmio_pre_handler_t pre_handler; /* Called before addr is executed. */ | 19 | unsigned long addr; |
20 | kmmio_post_handler_t post_handler; /* Called after addr is executed */ | 20 | /* length of the probe region: */ |
21 | void *private; | 21 | unsigned long len; |
22 | /* Called before addr is executed: */ | ||
23 | kmmio_pre_handler_t pre_handler; | ||
24 | /* Called after addr is executed: */ | ||
25 | kmmio_post_handler_t post_handler; | ||
26 | void *private; | ||
22 | }; | 27 | }; |
23 | 28 | ||
29 | extern unsigned int kmmio_count; | ||
30 | |||
31 | extern int register_kmmio_probe(struct kmmio_probe *p); | ||
32 | extern void unregister_kmmio_probe(struct kmmio_probe *p); | ||
33 | |||
34 | #ifdef CONFIG_MMIOTRACE | ||
24 | /* kmmio is active by some kmmio_probes? */ | 35 | /* kmmio is active by some kmmio_probes? */ |
25 | static inline int is_kmmio_active(void) | 36 | static inline int is_kmmio_active(void) |
26 | { | 37 | { |
27 | extern unsigned int kmmio_count; | ||
28 | return kmmio_count; | 38 | return kmmio_count; |
29 | } | 39 | } |
30 | 40 | ||
31 | extern int register_kmmio_probe(struct kmmio_probe *p); | ||
32 | extern void unregister_kmmio_probe(struct kmmio_probe *p); | ||
33 | |||
34 | /* Called from page fault handler. */ | 41 | /* Called from page fault handler. */ |
35 | extern int kmmio_handler(struct pt_regs *regs, unsigned long addr); | 42 | extern int kmmio_handler(struct pt_regs *regs, unsigned long addr); |
36 | 43 | ||
37 | #ifdef CONFIG_MMIOTRACE | ||
38 | /* Called from ioremap.c */ | 44 | /* Called from ioremap.c */ |
39 | extern void mmiotrace_ioremap(resource_size_t offset, unsigned long size, | 45 | extern void mmiotrace_ioremap(resource_size_t offset, unsigned long size, |
40 | void __iomem *addr); | 46 | void __iomem *addr); |
@@ -43,7 +49,17 @@ extern void mmiotrace_iounmap(volatile void __iomem *addr); | |||
43 | /* For anyone to insert markers. Remember trailing newline. */ | 49 | /* For anyone to insert markers. Remember trailing newline. */ |
44 | extern int mmiotrace_printk(const char *fmt, ...) | 50 | extern int mmiotrace_printk(const char *fmt, ...) |
45 | __attribute__ ((format (printf, 1, 2))); | 51 | __attribute__ ((format (printf, 1, 2))); |
46 | #else | 52 | #else /* !CONFIG_MMIOTRACE: */ |
53 | static inline int is_kmmio_active(void) | ||
54 | { | ||
55 | return 0; | ||
56 | } | ||
57 | |||
58 | static inline int kmmio_handler(struct pt_regs *regs, unsigned long addr) | ||
59 | { | ||
60 | return 0; | ||
61 | } | ||
62 | |||
47 | static inline void mmiotrace_ioremap(resource_size_t offset, | 63 | static inline void mmiotrace_ioremap(resource_size_t offset, |
48 | unsigned long size, void __iomem *addr) | 64 | unsigned long size, void __iomem *addr) |
49 | { | 65 | { |
@@ -63,28 +79,28 @@ static inline int mmiotrace_printk(const char *fmt, ...) | |||
63 | #endif /* CONFIG_MMIOTRACE */ | 79 | #endif /* CONFIG_MMIOTRACE */ |
64 | 80 | ||
65 | enum mm_io_opcode { | 81 | enum mm_io_opcode { |
66 | MMIO_READ = 0x1, /* struct mmiotrace_rw */ | 82 | MMIO_READ = 0x1, /* struct mmiotrace_rw */ |
67 | MMIO_WRITE = 0x2, /* struct mmiotrace_rw */ | 83 | MMIO_WRITE = 0x2, /* struct mmiotrace_rw */ |
68 | MMIO_PROBE = 0x3, /* struct mmiotrace_map */ | 84 | MMIO_PROBE = 0x3, /* struct mmiotrace_map */ |
69 | MMIO_UNPROBE = 0x4, /* struct mmiotrace_map */ | 85 | MMIO_UNPROBE = 0x4, /* struct mmiotrace_map */ |
70 | MMIO_UNKNOWN_OP = 0x5, /* struct mmiotrace_rw */ | 86 | MMIO_UNKNOWN_OP = 0x5, /* struct mmiotrace_rw */ |
71 | }; | 87 | }; |
72 | 88 | ||
73 | struct mmiotrace_rw { | 89 | struct mmiotrace_rw { |
74 | resource_size_t phys; /* PCI address of register */ | 90 | resource_size_t phys; /* PCI address of register */ |
75 | unsigned long value; | 91 | unsigned long value; |
76 | unsigned long pc; /* optional program counter */ | 92 | unsigned long pc; /* optional program counter */ |
77 | int map_id; | 93 | int map_id; |
78 | unsigned char opcode; /* one of MMIO_{READ,WRITE,UNKNOWN_OP} */ | 94 | unsigned char opcode; /* one of MMIO_{READ,WRITE,UNKNOWN_OP} */ |
79 | unsigned char width; /* size of register access in bytes */ | 95 | unsigned char width; /* size of register access in bytes */ |
80 | }; | 96 | }; |
81 | 97 | ||
82 | struct mmiotrace_map { | 98 | struct mmiotrace_map { |
83 | resource_size_t phys; /* base address in PCI space */ | 99 | resource_size_t phys; /* base address in PCI space */ |
84 | unsigned long virt; /* base virtual address */ | 100 | unsigned long virt; /* base virtual address */ |
85 | unsigned long len; /* mapping size */ | 101 | unsigned long len; /* mapping size */ |
86 | int map_id; | 102 | int map_id; |
87 | unsigned char opcode; /* MMIO_PROBE or MMIO_UNPROBE */ | 103 | unsigned char opcode; /* MMIO_PROBE or MMIO_UNPROBE */ |
88 | }; | 104 | }; |
89 | 105 | ||
90 | /* in kernel/trace/trace_mmiotrace.c */ | 106 | /* in kernel/trace/trace_mmiotrace.c */ |
@@ -94,4 +110,4 @@ extern void mmio_trace_rw(struct mmiotrace_rw *rw); | |||
94 | extern void mmio_trace_mapping(struct mmiotrace_map *map); | 110 | extern void mmio_trace_mapping(struct mmiotrace_map *map); |
95 | extern int mmio_trace_printk(const char *fmt, va_list args); | 111 | extern int mmio_trace_printk(const char *fmt, va_list args); |
96 | 112 | ||
97 | #endif /* MMIOTRACE_H */ | 113 | #endif /* _LINUX_MMIOTRACE_H */ |
diff --git a/include/linux/ncp_fs.h b/include/linux/ncp_fs.h index f69e66d151cc..30b06c893944 100644 --- a/include/linux/ncp_fs.h +++ b/include/linux/ncp_fs.h | |||
@@ -204,7 +204,7 @@ void ncp_update_inode2(struct inode *, struct ncp_entry_info *); | |||
204 | /* linux/fs/ncpfs/dir.c */ | 204 | /* linux/fs/ncpfs/dir.c */ |
205 | extern const struct inode_operations ncp_dir_inode_operations; | 205 | extern const struct inode_operations ncp_dir_inode_operations; |
206 | extern const struct file_operations ncp_dir_operations; | 206 | extern const struct file_operations ncp_dir_operations; |
207 | extern struct dentry_operations ncp_root_dentry_operations; | 207 | extern const struct dentry_operations ncp_root_dentry_operations; |
208 | int ncp_conn_logged_in(struct super_block *); | 208 | int ncp_conn_logged_in(struct super_block *); |
209 | int ncp_date_dos2unix(__le16 time, __le16 date); | 209 | int ncp_date_dos2unix(__le16 time, __le16 date); |
210 | void ncp_date_unix2dos(int unix_date, __le16 * time, __le16 * date); | 210 | void ncp_date_unix2dos(int unix_date, __le16 * time, __le16 * date); |
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index 1b55952a17f6..2e7783f4a755 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h | |||
@@ -594,6 +594,14 @@ struct net_device_ops { | |||
594 | #define HAVE_NETDEV_POLL | 594 | #define HAVE_NETDEV_POLL |
595 | void (*ndo_poll_controller)(struct net_device *dev); | 595 | void (*ndo_poll_controller)(struct net_device *dev); |
596 | #endif | 596 | #endif |
597 | #if defined(CONFIG_FCOE) || defined(CONFIG_FCOE_MODULE) | ||
598 | int (*ndo_fcoe_ddp_setup)(struct net_device *dev, | ||
599 | u16 xid, | ||
600 | struct scatterlist *sgl, | ||
601 | unsigned int sgc); | ||
602 | int (*ndo_fcoe_ddp_done)(struct net_device *dev, | ||
603 | u16 xid); | ||
604 | #endif | ||
597 | }; | 605 | }; |
598 | 606 | ||
599 | /* | 607 | /* |
@@ -662,14 +670,17 @@ struct net_device | |||
662 | #define NETIF_F_GRO 16384 /* Generic receive offload */ | 670 | #define NETIF_F_GRO 16384 /* Generic receive offload */ |
663 | #define NETIF_F_LRO 32768 /* large receive offload */ | 671 | #define NETIF_F_LRO 32768 /* large receive offload */ |
664 | 672 | ||
673 | #define NETIF_F_FCOE_CRC (1 << 24) /* FCoE CRC32 */ | ||
674 | |||
665 | /* Segmentation offload features */ | 675 | /* Segmentation offload features */ |
666 | #define NETIF_F_GSO_SHIFT 16 | 676 | #define NETIF_F_GSO_SHIFT 16 |
667 | #define NETIF_F_GSO_MASK 0xffff0000 | 677 | #define NETIF_F_GSO_MASK 0x00ff0000 |
668 | #define NETIF_F_TSO (SKB_GSO_TCPV4 << NETIF_F_GSO_SHIFT) | 678 | #define NETIF_F_TSO (SKB_GSO_TCPV4 << NETIF_F_GSO_SHIFT) |
669 | #define NETIF_F_UFO (SKB_GSO_UDP << NETIF_F_GSO_SHIFT) | 679 | #define NETIF_F_UFO (SKB_GSO_UDP << NETIF_F_GSO_SHIFT) |
670 | #define NETIF_F_GSO_ROBUST (SKB_GSO_DODGY << NETIF_F_GSO_SHIFT) | 680 | #define NETIF_F_GSO_ROBUST (SKB_GSO_DODGY << NETIF_F_GSO_SHIFT) |
671 | #define NETIF_F_TSO_ECN (SKB_GSO_TCP_ECN << NETIF_F_GSO_SHIFT) | 681 | #define NETIF_F_TSO_ECN (SKB_GSO_TCP_ECN << NETIF_F_GSO_SHIFT) |
672 | #define NETIF_F_TSO6 (SKB_GSO_TCPV6 << NETIF_F_GSO_SHIFT) | 682 | #define NETIF_F_TSO6 (SKB_GSO_TCPV6 << NETIF_F_GSO_SHIFT) |
683 | #define NETIF_F_FSO (SKB_GSO_FCOE << NETIF_F_GSO_SHIFT) | ||
673 | 684 | ||
674 | /* List of features with software fallbacks. */ | 685 | /* List of features with software fallbacks. */ |
675 | #define NETIF_F_GSO_SOFTWARE (NETIF_F_TSO | NETIF_F_TSO_ECN | NETIF_F_TSO6) | 686 | #define NETIF_F_GSO_SOFTWARE (NETIF_F_TSO | NETIF_F_TSO_ECN | NETIF_F_TSO6) |
@@ -852,6 +863,11 @@ struct net_device | |||
852 | struct dcbnl_rtnl_ops *dcbnl_ops; | 863 | struct dcbnl_rtnl_ops *dcbnl_ops; |
853 | #endif | 864 | #endif |
854 | 865 | ||
866 | #if defined(CONFIG_FCOE) || defined(CONFIG_FCOE_MODULE) | ||
867 | /* max exchange id for FCoE LRO by ddp */ | ||
868 | unsigned int fcoe_ddp_xid; | ||
869 | #endif | ||
870 | |||
855 | #ifdef CONFIG_COMPAT_NET_DEV_OPS | 871 | #ifdef CONFIG_COMPAT_NET_DEV_OPS |
856 | struct { | 872 | struct { |
857 | int (*init)(struct net_device *dev); | 873 | int (*init)(struct net_device *dev); |
diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h index db867b04ac3c..8cc8807f77d6 100644 --- a/include/linux/nfs_fs.h +++ b/include/linux/nfs_fs.h | |||
@@ -415,7 +415,7 @@ extern const struct inode_operations nfs_dir_inode_operations; | |||
415 | extern const struct inode_operations nfs3_dir_inode_operations; | 415 | extern const struct inode_operations nfs3_dir_inode_operations; |
416 | #endif /* CONFIG_NFS_V3 */ | 416 | #endif /* CONFIG_NFS_V3 */ |
417 | extern const struct file_operations nfs_dir_operations; | 417 | extern const struct file_operations nfs_dir_operations; |
418 | extern struct dentry_operations nfs_dentry_operations; | 418 | extern const struct dentry_operations nfs_dentry_operations; |
419 | 419 | ||
420 | extern void nfs_force_lookup_revalidate(struct inode *dir); | 420 | extern void nfs_force_lookup_revalidate(struct inode *dir); |
421 | extern int nfs_instantiate(struct dentry *dentry, struct nfs_fh *fh, struct nfs_fattr *fattr); | 421 | extern int nfs_instantiate(struct dentry *dentry, struct nfs_fh *fh, struct nfs_fattr *fattr); |
diff --git a/include/linux/nfs_xdr.h b/include/linux/nfs_xdr.h index 2e5f00066afd..43a713fce11c 100644 --- a/include/linux/nfs_xdr.h +++ b/include/linux/nfs_xdr.h | |||
@@ -785,7 +785,7 @@ struct nfs_access_entry; | |||
785 | */ | 785 | */ |
786 | struct nfs_rpc_ops { | 786 | struct nfs_rpc_ops { |
787 | u32 version; /* Protocol version */ | 787 | u32 version; /* Protocol version */ |
788 | struct dentry_operations *dentry_ops; | 788 | const struct dentry_operations *dentry_ops; |
789 | const struct inode_operations *dir_inode_ops; | 789 | const struct inode_operations *dir_inode_ops; |
790 | const struct inode_operations *file_inode_ops; | 790 | const struct inode_operations *file_inode_ops; |
791 | 791 | ||
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h index 05dfa7c4fb64..2c9e8080da5e 100644 --- a/include/linux/pci_ids.h +++ b/include/linux/pci_ids.h | |||
@@ -1237,6 +1237,7 @@ | |||
1237 | #define PCI_DEVICE_ID_NVIDIA_NVENET_21 0x0451 | 1237 | #define PCI_DEVICE_ID_NVIDIA_NVENET_21 0x0451 |
1238 | #define PCI_DEVICE_ID_NVIDIA_NVENET_22 0x0452 | 1238 | #define PCI_DEVICE_ID_NVIDIA_NVENET_22 0x0452 |
1239 | #define PCI_DEVICE_ID_NVIDIA_NVENET_23 0x0453 | 1239 | #define PCI_DEVICE_ID_NVIDIA_NVENET_23 0x0453 |
1240 | #define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP67_SMBUS 0x0542 | ||
1240 | #define PCI_DEVICE_ID_NVIDIA_NVENET_24 0x054C | 1241 | #define PCI_DEVICE_ID_NVIDIA_NVENET_24 0x054C |
1241 | #define PCI_DEVICE_ID_NVIDIA_NVENET_25 0x054D | 1242 | #define PCI_DEVICE_ID_NVIDIA_NVENET_25 0x054D |
1242 | #define PCI_DEVICE_ID_NVIDIA_NVENET_26 0x054E | 1243 | #define PCI_DEVICE_ID_NVIDIA_NVENET_26 0x054E |
@@ -1247,11 +1248,14 @@ | |||
1247 | #define PCI_DEVICE_ID_NVIDIA_NVENET_31 0x07DF | 1248 | #define PCI_DEVICE_ID_NVIDIA_NVENET_31 0x07DF |
1248 | #define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP67_IDE 0x0560 | 1249 | #define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP67_IDE 0x0560 |
1249 | #define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP73_IDE 0x056C | 1250 | #define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP73_IDE 0x056C |
1251 | #define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP78S_SMBUS 0x0752 | ||
1250 | #define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP77_IDE 0x0759 | 1252 | #define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP77_IDE 0x0759 |
1251 | #define PCI_DEVICE_ID_NVIDIA_NVENET_32 0x0760 | 1253 | #define PCI_DEVICE_ID_NVIDIA_NVENET_32 0x0760 |
1252 | #define PCI_DEVICE_ID_NVIDIA_NVENET_33 0x0761 | 1254 | #define PCI_DEVICE_ID_NVIDIA_NVENET_33 0x0761 |
1253 | #define PCI_DEVICE_ID_NVIDIA_NVENET_34 0x0762 | 1255 | #define PCI_DEVICE_ID_NVIDIA_NVENET_34 0x0762 |
1254 | #define PCI_DEVICE_ID_NVIDIA_NVENET_35 0x0763 | 1256 | #define PCI_DEVICE_ID_NVIDIA_NVENET_35 0x0763 |
1257 | #define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP73_SMBUS 0x07D8 | ||
1258 | #define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP79_SMBUS 0x0AA2 | ||
1255 | #define PCI_DEVICE_ID_NVIDIA_NVENET_36 0x0AB0 | 1259 | #define PCI_DEVICE_ID_NVIDIA_NVENET_36 0x0AB0 |
1256 | #define PCI_DEVICE_ID_NVIDIA_NVENET_37 0x0AB1 | 1260 | #define PCI_DEVICE_ID_NVIDIA_NVENET_37 0x0AB1 |
1257 | #define PCI_DEVICE_ID_NVIDIA_NVENET_38 0x0AB2 | 1261 | #define PCI_DEVICE_ID_NVIDIA_NVENET_38 0x0AB2 |
@@ -1475,6 +1479,7 @@ | |||
1475 | #define PCI_DEVICE_ID_SERVERWORKS_HT1000IDE 0x0214 | 1479 | #define PCI_DEVICE_ID_SERVERWORKS_HT1000IDE 0x0214 |
1476 | #define PCI_DEVICE_ID_SERVERWORKS_CSB6IDE2 0x0217 | 1480 | #define PCI_DEVICE_ID_SERVERWORKS_CSB6IDE2 0x0217 |
1477 | #define PCI_DEVICE_ID_SERVERWORKS_CSB6LPC 0x0227 | 1481 | #define PCI_DEVICE_ID_SERVERWORKS_CSB6LPC 0x0227 |
1482 | #define PCI_DEVICE_ID_SERVERWORKS_HT1100LD 0x0408 | ||
1478 | 1483 | ||
1479 | #define PCI_VENDOR_ID_SBE 0x1176 | 1484 | #define PCI_VENDOR_ID_SBE 0x1176 |
1480 | #define PCI_DEVICE_ID_SBE_WANXL100 0x0301 | 1485 | #define PCI_DEVICE_ID_SBE_WANXL100 0x0301 |
diff --git a/include/linux/percpu.h b/include/linux/percpu.h index 9f2a3751873a..ee5615d65211 100644 --- a/include/linux/percpu.h +++ b/include/linux/percpu.h | |||
@@ -5,53 +5,66 @@ | |||
5 | #include <linux/slab.h> /* For kmalloc() */ | 5 | #include <linux/slab.h> /* For kmalloc() */ |
6 | #include <linux/smp.h> | 6 | #include <linux/smp.h> |
7 | #include <linux/cpumask.h> | 7 | #include <linux/cpumask.h> |
8 | #include <linux/pfn.h> | ||
8 | 9 | ||
9 | #include <asm/percpu.h> | 10 | #include <asm/percpu.h> |
10 | 11 | ||
12 | #ifndef PER_CPU_BASE_SECTION | ||
13 | #ifdef CONFIG_SMP | ||
14 | #define PER_CPU_BASE_SECTION ".data.percpu" | ||
15 | #else | ||
16 | #define PER_CPU_BASE_SECTION ".data" | ||
17 | #endif | ||
18 | #endif | ||
19 | |||
11 | #ifdef CONFIG_SMP | 20 | #ifdef CONFIG_SMP |
12 | #define DEFINE_PER_CPU(type, name) \ | ||
13 | __attribute__((__section__(".data.percpu"))) \ | ||
14 | PER_CPU_ATTRIBUTES __typeof__(type) per_cpu__##name | ||
15 | 21 | ||
16 | #ifdef MODULE | 22 | #ifdef MODULE |
17 | #define SHARED_ALIGNED_SECTION ".data.percpu" | 23 | #define PER_CPU_SHARED_ALIGNED_SECTION "" |
18 | #else | 24 | #else |
19 | #define SHARED_ALIGNED_SECTION ".data.percpu.shared_aligned" | 25 | #define PER_CPU_SHARED_ALIGNED_SECTION ".shared_aligned" |
20 | #endif | 26 | #endif |
27 | #define PER_CPU_FIRST_SECTION ".first" | ||
21 | 28 | ||
22 | #define DEFINE_PER_CPU_SHARED_ALIGNED(type, name) \ | 29 | #else |
23 | __attribute__((__section__(SHARED_ALIGNED_SECTION))) \ | 30 | |
24 | PER_CPU_ATTRIBUTES __typeof__(type) per_cpu__##name \ | 31 | #define PER_CPU_SHARED_ALIGNED_SECTION "" |
25 | ____cacheline_aligned_in_smp | 32 | #define PER_CPU_FIRST_SECTION "" |
26 | 33 | ||
27 | #define DEFINE_PER_CPU_PAGE_ALIGNED(type, name) \ | 34 | #endif |
28 | __attribute__((__section__(".data.percpu.page_aligned"))) \ | 35 | |
36 | #define DEFINE_PER_CPU_SECTION(type, name, section) \ | ||
37 | __attribute__((__section__(PER_CPU_BASE_SECTION section))) \ | ||
29 | PER_CPU_ATTRIBUTES __typeof__(type) per_cpu__##name | 38 | PER_CPU_ATTRIBUTES __typeof__(type) per_cpu__##name |
30 | #else | 39 | |
31 | #define DEFINE_PER_CPU(type, name) \ | 40 | #define DEFINE_PER_CPU(type, name) \ |
32 | PER_CPU_ATTRIBUTES __typeof__(type) per_cpu__##name | 41 | DEFINE_PER_CPU_SECTION(type, name, "") |
33 | 42 | ||
34 | #define DEFINE_PER_CPU_SHARED_ALIGNED(type, name) \ | 43 | #define DEFINE_PER_CPU_SHARED_ALIGNED(type, name) \ |
35 | DEFINE_PER_CPU(type, name) | 44 | DEFINE_PER_CPU_SECTION(type, name, PER_CPU_SHARED_ALIGNED_SECTION) \ |
45 | ____cacheline_aligned_in_smp | ||
36 | 46 | ||
37 | #define DEFINE_PER_CPU_PAGE_ALIGNED(type, name) \ | 47 | #define DEFINE_PER_CPU_PAGE_ALIGNED(type, name) \ |
38 | DEFINE_PER_CPU(type, name) | 48 | DEFINE_PER_CPU_SECTION(type, name, ".page_aligned") |
39 | #endif | 49 | |
50 | #define DEFINE_PER_CPU_FIRST(type, name) \ | ||
51 | DEFINE_PER_CPU_SECTION(type, name, PER_CPU_FIRST_SECTION) | ||
40 | 52 | ||
41 | #define EXPORT_PER_CPU_SYMBOL(var) EXPORT_SYMBOL(per_cpu__##var) | 53 | #define EXPORT_PER_CPU_SYMBOL(var) EXPORT_SYMBOL(per_cpu__##var) |
42 | #define EXPORT_PER_CPU_SYMBOL_GPL(var) EXPORT_SYMBOL_GPL(per_cpu__##var) | 54 | #define EXPORT_PER_CPU_SYMBOL_GPL(var) EXPORT_SYMBOL_GPL(per_cpu__##var) |
43 | 55 | ||
44 | /* Enough to cover all DEFINE_PER_CPUs in kernel, including modules. */ | 56 | /* enough to cover all DEFINE_PER_CPUs in modules */ |
45 | #ifndef PERCPU_ENOUGH_ROOM | ||
46 | #ifdef CONFIG_MODULES | 57 | #ifdef CONFIG_MODULES |
47 | #define PERCPU_MODULE_RESERVE 8192 | 58 | #define PERCPU_MODULE_RESERVE (8 << 10) |
48 | #else | 59 | #else |
49 | #define PERCPU_MODULE_RESERVE 0 | 60 | #define PERCPU_MODULE_RESERVE 0 |
50 | #endif | 61 | #endif |
51 | 62 | ||
63 | #ifndef PERCPU_ENOUGH_ROOM | ||
52 | #define PERCPU_ENOUGH_ROOM \ | 64 | #define PERCPU_ENOUGH_ROOM \ |
53 | (__per_cpu_end - __per_cpu_start + PERCPU_MODULE_RESERVE) | 65 | (ALIGN(__per_cpu_end - __per_cpu_start, SMP_CACHE_BYTES) + \ |
54 | #endif /* PERCPU_ENOUGH_ROOM */ | 66 | PERCPU_MODULE_RESERVE) |
67 | #endif | ||
55 | 68 | ||
56 | /* | 69 | /* |
57 | * Must be an lvalue. Since @var must be a simple identifier, | 70 | * Must be an lvalue. Since @var must be a simple identifier, |
@@ -65,52 +78,94 @@ | |||
65 | 78 | ||
66 | #ifdef CONFIG_SMP | 79 | #ifdef CONFIG_SMP |
67 | 80 | ||
81 | #ifdef CONFIG_HAVE_DYNAMIC_PER_CPU_AREA | ||
82 | |||
83 | /* minimum unit size, also is the maximum supported allocation size */ | ||
84 | #define PCPU_MIN_UNIT_SIZE PFN_ALIGN(64 << 10) | ||
85 | |||
86 | /* | ||
87 | * PERCPU_DYNAMIC_RESERVE indicates the amount of free area to piggy | ||
88 | * back on the first chunk for dynamic percpu allocation if arch is | ||
89 | * manually allocating and mapping it for faster access (as a part of | ||
90 | * large page mapping for example). | ||
91 | * | ||
92 | * The following values give between one and two pages of free space | ||
93 | * after typical minimal boot (2-way SMP, single disk and NIC) with | ||
94 | * both defconfig and a distro config on x86_64 and 32. More | ||
95 | * intelligent way to determine this would be nice. | ||
96 | */ | ||
97 | #if BITS_PER_LONG > 32 | ||
98 | #define PERCPU_DYNAMIC_RESERVE (20 << 10) | ||
99 | #else | ||
100 | #define PERCPU_DYNAMIC_RESERVE (12 << 10) | ||
101 | #endif | ||
102 | |||
103 | extern void *pcpu_base_addr; | ||
104 | |||
105 | typedef struct page * (*pcpu_get_page_fn_t)(unsigned int cpu, int pageno); | ||
106 | typedef void (*pcpu_populate_pte_fn_t)(unsigned long addr); | ||
107 | |||
108 | extern size_t __init pcpu_setup_first_chunk(pcpu_get_page_fn_t get_page_fn, | ||
109 | size_t static_size, size_t reserved_size, | ||
110 | ssize_t dyn_size, ssize_t unit_size, | ||
111 | void *base_addr, | ||
112 | pcpu_populate_pte_fn_t populate_pte_fn); | ||
113 | |||
114 | extern ssize_t __init pcpu_embed_first_chunk( | ||
115 | size_t static_size, size_t reserved_size, | ||
116 | ssize_t dyn_size, ssize_t unit_size); | ||
117 | |||
118 | /* | ||
119 | * Use this to get to a cpu's version of the per-cpu object | ||
120 | * dynamically allocated. Non-atomic access to the current CPU's | ||
121 | * version should probably be combined with get_cpu()/put_cpu(). | ||
122 | */ | ||
123 | #define per_cpu_ptr(ptr, cpu) SHIFT_PERCPU_PTR((ptr), per_cpu_offset((cpu))) | ||
124 | |||
125 | extern void *__alloc_reserved_percpu(size_t size, size_t align); | ||
126 | |||
127 | #else /* CONFIG_HAVE_DYNAMIC_PER_CPU_AREA */ | ||
128 | |||
68 | struct percpu_data { | 129 | struct percpu_data { |
69 | void *ptrs[1]; | 130 | void *ptrs[1]; |
70 | }; | 131 | }; |
71 | 132 | ||
72 | #define __percpu_disguise(pdata) (struct percpu_data *)~(unsigned long)(pdata) | 133 | #define __percpu_disguise(pdata) (struct percpu_data *)~(unsigned long)(pdata) |
73 | /* | 134 | |
74 | * Use this to get to a cpu's version of the per-cpu object dynamically | 135 | #define per_cpu_ptr(ptr, cpu) \ |
75 | * allocated. Non-atomic access to the current CPU's version should | 136 | ({ \ |
76 | * probably be combined with get_cpu()/put_cpu(). | 137 | struct percpu_data *__p = __percpu_disguise(ptr); \ |
77 | */ | 138 | (__typeof__(ptr))__p->ptrs[(cpu)]; \ |
78 | #define percpu_ptr(ptr, cpu) \ | ||
79 | ({ \ | ||
80 | struct percpu_data *__p = __percpu_disguise(ptr); \ | ||
81 | (__typeof__(ptr))__p->ptrs[(cpu)]; \ | ||
82 | }) | 139 | }) |
83 | 140 | ||
84 | extern void *__percpu_alloc_mask(size_t size, gfp_t gfp, cpumask_t *mask); | 141 | #endif /* CONFIG_HAVE_DYNAMIC_PER_CPU_AREA */ |
85 | extern void percpu_free(void *__pdata); | 142 | |
143 | extern void *__alloc_percpu(size_t size, size_t align); | ||
144 | extern void free_percpu(void *__pdata); | ||
86 | 145 | ||
87 | #else /* CONFIG_SMP */ | 146 | #else /* CONFIG_SMP */ |
88 | 147 | ||
89 | #define percpu_ptr(ptr, cpu) ({ (void)(cpu); (ptr); }) | 148 | #define per_cpu_ptr(ptr, cpu) ({ (void)(cpu); (ptr); }) |
90 | 149 | ||
91 | static __always_inline void *__percpu_alloc_mask(size_t size, gfp_t gfp, cpumask_t *mask) | 150 | static inline void *__alloc_percpu(size_t size, size_t align) |
92 | { | 151 | { |
93 | return kzalloc(size, gfp); | 152 | /* |
153 | * Can't easily make larger alignment work with kmalloc. WARN | ||
154 | * on it. Larger alignment should only be used for module | ||
155 | * percpu sections on SMP for which this path isn't used. | ||
156 | */ | ||
157 | WARN_ON_ONCE(align > SMP_CACHE_BYTES); | ||
158 | return kzalloc(size, GFP_KERNEL); | ||
94 | } | 159 | } |
95 | 160 | ||
96 | static inline void percpu_free(void *__pdata) | 161 | static inline void free_percpu(void *p) |
97 | { | 162 | { |
98 | kfree(__pdata); | 163 | kfree(p); |
99 | } | 164 | } |
100 | 165 | ||
101 | #endif /* CONFIG_SMP */ | 166 | #endif /* CONFIG_SMP */ |
102 | 167 | ||
103 | #define percpu_alloc_mask(size, gfp, mask) \ | 168 | #define alloc_percpu(type) (type *)__alloc_percpu(sizeof(type), \ |
104 | __percpu_alloc_mask((size), (gfp), &(mask)) | 169 | __alignof__(type)) |
105 | |||
106 | #define percpu_alloc(size, gfp) percpu_alloc_mask((size), (gfp), cpu_online_map) | ||
107 | |||
108 | /* (legacy) interface for use without CPU hotplug handling */ | ||
109 | |||
110 | #define __alloc_percpu(size) percpu_alloc_mask((size), GFP_KERNEL, \ | ||
111 | cpu_possible_map) | ||
112 | #define alloc_percpu(type) (type *)__alloc_percpu(sizeof(type)) | ||
113 | #define free_percpu(ptr) percpu_free((ptr)) | ||
114 | #define per_cpu_ptr(ptr, cpu) percpu_ptr((ptr), (cpu)) | ||
115 | 170 | ||
116 | #endif /* __LINUX_PERCPU_H */ | 171 | #endif /* __LINUX_PERCPU_H */ |
diff --git a/include/linux/quota.h b/include/linux/quota.h index d72d5d84fde5..78c48895b12a 100644 --- a/include/linux/quota.h +++ b/include/linux/quota.h | |||
@@ -198,6 +198,7 @@ struct mem_dqblk { | |||
198 | qsize_t dqb_bhardlimit; /* absolute limit on disk blks alloc */ | 198 | qsize_t dqb_bhardlimit; /* absolute limit on disk blks alloc */ |
199 | qsize_t dqb_bsoftlimit; /* preferred limit on disk blks */ | 199 | qsize_t dqb_bsoftlimit; /* preferred limit on disk blks */ |
200 | qsize_t dqb_curspace; /* current used space */ | 200 | qsize_t dqb_curspace; /* current used space */ |
201 | qsize_t dqb_rsvspace; /* current reserved space for delalloc*/ | ||
201 | qsize_t dqb_ihardlimit; /* absolute limit on allocated inodes */ | 202 | qsize_t dqb_ihardlimit; /* absolute limit on allocated inodes */ |
202 | qsize_t dqb_isoftlimit; /* preferred inode limit */ | 203 | qsize_t dqb_isoftlimit; /* preferred inode limit */ |
203 | qsize_t dqb_curinodes; /* current # allocated inodes */ | 204 | qsize_t dqb_curinodes; /* current # allocated inodes */ |
@@ -276,8 +277,6 @@ struct dquot { | |||
276 | struct mem_dqblk dq_dqb; /* Diskquota usage */ | 277 | struct mem_dqblk dq_dqb; /* Diskquota usage */ |
277 | }; | 278 | }; |
278 | 279 | ||
279 | #define NODQUOT (struct dquot *)NULL | ||
280 | |||
281 | #define QUOTA_OK 0 | 280 | #define QUOTA_OK 0 |
282 | #define NO_QUOTA 1 | 281 | #define NO_QUOTA 1 |
283 | 282 | ||
@@ -308,6 +307,14 @@ struct dquot_operations { | |||
308 | int (*release_dquot) (struct dquot *); /* Quota is going to be deleted from disk */ | 307 | int (*release_dquot) (struct dquot *); /* Quota is going to be deleted from disk */ |
309 | int (*mark_dirty) (struct dquot *); /* Dquot is marked dirty */ | 308 | int (*mark_dirty) (struct dquot *); /* Dquot is marked dirty */ |
310 | int (*write_info) (struct super_block *, int); /* Write of quota "superblock" */ | 309 | int (*write_info) (struct super_block *, int); /* Write of quota "superblock" */ |
310 | /* reserve quota for delayed block allocation */ | ||
311 | int (*reserve_space) (struct inode *, qsize_t, int); | ||
312 | /* claim reserved quota for delayed alloc */ | ||
313 | int (*claim_space) (struct inode *, qsize_t); | ||
314 | /* release rsved quota for delayed alloc */ | ||
315 | void (*release_rsv) (struct inode *, qsize_t); | ||
316 | /* get reserved quota for delayed alloc */ | ||
317 | qsize_t (*get_reserved_space) (struct inode *); | ||
311 | }; | 318 | }; |
312 | 319 | ||
313 | /* Operations handling requests from userspace */ | 320 | /* Operations handling requests from userspace */ |
diff --git a/include/linux/quotaops.h b/include/linux/quotaops.h index 0b35b3a1be05..36353d95c8db 100644 --- a/include/linux/quotaops.h +++ b/include/linux/quotaops.h | |||
@@ -35,6 +35,11 @@ void dquot_destroy(struct dquot *dquot); | |||
35 | int dquot_alloc_space(struct inode *inode, qsize_t number, int prealloc); | 35 | int dquot_alloc_space(struct inode *inode, qsize_t number, int prealloc); |
36 | int dquot_alloc_inode(const struct inode *inode, qsize_t number); | 36 | int dquot_alloc_inode(const struct inode *inode, qsize_t number); |
37 | 37 | ||
38 | int dquot_reserve_space(struct inode *inode, qsize_t number, int prealloc); | ||
39 | int dquot_claim_space(struct inode *inode, qsize_t number); | ||
40 | void dquot_release_reserved_space(struct inode *inode, qsize_t number); | ||
41 | qsize_t dquot_get_reserved_space(struct inode *inode); | ||
42 | |||
38 | int dquot_free_space(struct inode *inode, qsize_t number); | 43 | int dquot_free_space(struct inode *inode, qsize_t number); |
39 | int dquot_free_inode(const struct inode *inode, qsize_t number); | 44 | int dquot_free_inode(const struct inode *inode, qsize_t number); |
40 | 45 | ||
@@ -183,6 +188,16 @@ static inline int vfs_dq_alloc_space(struct inode *inode, qsize_t nr) | |||
183 | return ret; | 188 | return ret; |
184 | } | 189 | } |
185 | 190 | ||
191 | static inline int vfs_dq_reserve_space(struct inode *inode, qsize_t nr) | ||
192 | { | ||
193 | if (sb_any_quota_active(inode->i_sb)) { | ||
194 | /* Used space is updated in alloc_space() */ | ||
195 | if (inode->i_sb->dq_op->reserve_space(inode, nr, 0) == NO_QUOTA) | ||
196 | return 1; | ||
197 | } | ||
198 | return 0; | ||
199 | } | ||
200 | |||
186 | static inline int vfs_dq_alloc_inode(struct inode *inode) | 201 | static inline int vfs_dq_alloc_inode(struct inode *inode) |
187 | { | 202 | { |
188 | if (sb_any_quota_active(inode->i_sb)) { | 203 | if (sb_any_quota_active(inode->i_sb)) { |
@@ -193,6 +208,31 @@ static inline int vfs_dq_alloc_inode(struct inode *inode) | |||
193 | return 0; | 208 | return 0; |
194 | } | 209 | } |
195 | 210 | ||
211 | /* | ||
212 | * Convert in-memory reserved quotas to real consumed quotas | ||
213 | */ | ||
214 | static inline int vfs_dq_claim_space(struct inode *inode, qsize_t nr) | ||
215 | { | ||
216 | if (sb_any_quota_active(inode->i_sb)) { | ||
217 | if (inode->i_sb->dq_op->claim_space(inode, nr) == NO_QUOTA) | ||
218 | return 1; | ||
219 | } else | ||
220 | inode_add_bytes(inode, nr); | ||
221 | |||
222 | mark_inode_dirty(inode); | ||
223 | return 0; | ||
224 | } | ||
225 | |||
226 | /* | ||
227 | * Release reserved (in-memory) quotas | ||
228 | */ | ||
229 | static inline | ||
230 | void vfs_dq_release_reservation_space(struct inode *inode, qsize_t nr) | ||
231 | { | ||
232 | if (sb_any_quota_active(inode->i_sb)) | ||
233 | inode->i_sb->dq_op->release_rsv(inode, nr); | ||
234 | } | ||
235 | |||
196 | static inline void vfs_dq_free_space_nodirty(struct inode *inode, qsize_t nr) | 236 | static inline void vfs_dq_free_space_nodirty(struct inode *inode, qsize_t nr) |
197 | { | 237 | { |
198 | if (sb_any_quota_active(inode->i_sb)) | 238 | if (sb_any_quota_active(inode->i_sb)) |
@@ -339,6 +379,22 @@ static inline int vfs_dq_alloc_space(struct inode *inode, qsize_t nr) | |||
339 | return 0; | 379 | return 0; |
340 | } | 380 | } |
341 | 381 | ||
382 | static inline int vfs_dq_reserve_space(struct inode *inode, qsize_t nr) | ||
383 | { | ||
384 | return 0; | ||
385 | } | ||
386 | |||
387 | static inline int vfs_dq_claim_space(struct inode *inode, qsize_t nr) | ||
388 | { | ||
389 | return vfs_dq_alloc_space(inode, nr); | ||
390 | } | ||
391 | |||
392 | static inline | ||
393 | int vfs_dq_release_reservation_space(struct inode *inode, qsize_t nr) | ||
394 | { | ||
395 | return 0; | ||
396 | } | ||
397 | |||
342 | static inline void vfs_dq_free_space_nodirty(struct inode *inode, qsize_t nr) | 398 | static inline void vfs_dq_free_space_nodirty(struct inode *inode, qsize_t nr) |
343 | { | 399 | { |
344 | inode_sub_bytes(inode, nr); | 400 | inode_sub_bytes(inode, nr); |
@@ -354,67 +410,48 @@ static inline void vfs_dq_free_space(struct inode *inode, qsize_t nr) | |||
354 | 410 | ||
355 | static inline int vfs_dq_prealloc_block_nodirty(struct inode *inode, qsize_t nr) | 411 | static inline int vfs_dq_prealloc_block_nodirty(struct inode *inode, qsize_t nr) |
356 | { | 412 | { |
357 | return vfs_dq_prealloc_space_nodirty(inode, | 413 | return vfs_dq_prealloc_space_nodirty(inode, nr << inode->i_blkbits); |
358 | nr << inode->i_sb->s_blocksize_bits); | ||
359 | } | 414 | } |
360 | 415 | ||
361 | static inline int vfs_dq_prealloc_block(struct inode *inode, qsize_t nr) | 416 | static inline int vfs_dq_prealloc_block(struct inode *inode, qsize_t nr) |
362 | { | 417 | { |
363 | return vfs_dq_prealloc_space(inode, | 418 | return vfs_dq_prealloc_space(inode, nr << inode->i_blkbits); |
364 | nr << inode->i_sb->s_blocksize_bits); | ||
365 | } | 419 | } |
366 | 420 | ||
367 | static inline int vfs_dq_alloc_block_nodirty(struct inode *inode, qsize_t nr) | 421 | static inline int vfs_dq_alloc_block_nodirty(struct inode *inode, qsize_t nr) |
368 | { | 422 | { |
369 | return vfs_dq_alloc_space_nodirty(inode, | 423 | return vfs_dq_alloc_space_nodirty(inode, nr << inode->i_blkbits); |
370 | nr << inode->i_sb->s_blocksize_bits); | ||
371 | } | 424 | } |
372 | 425 | ||
373 | static inline int vfs_dq_alloc_block(struct inode *inode, qsize_t nr) | 426 | static inline int vfs_dq_alloc_block(struct inode *inode, qsize_t nr) |
374 | { | 427 | { |
375 | return vfs_dq_alloc_space(inode, | 428 | return vfs_dq_alloc_space(inode, nr << inode->i_blkbits); |
376 | nr << inode->i_sb->s_blocksize_bits); | 429 | } |
430 | |||
431 | static inline int vfs_dq_reserve_block(struct inode *inode, qsize_t nr) | ||
432 | { | ||
433 | return vfs_dq_reserve_space(inode, nr << inode->i_blkbits); | ||
434 | } | ||
435 | |||
436 | static inline int vfs_dq_claim_block(struct inode *inode, qsize_t nr) | ||
437 | { | ||
438 | return vfs_dq_claim_space(inode, nr << inode->i_blkbits); | ||
439 | } | ||
440 | |||
441 | static inline | ||
442 | void vfs_dq_release_reservation_block(struct inode *inode, qsize_t nr) | ||
443 | { | ||
444 | vfs_dq_release_reservation_space(inode, nr << inode->i_blkbits); | ||
377 | } | 445 | } |
378 | 446 | ||
379 | static inline void vfs_dq_free_block_nodirty(struct inode *inode, qsize_t nr) | 447 | static inline void vfs_dq_free_block_nodirty(struct inode *inode, qsize_t nr) |
380 | { | 448 | { |
381 | vfs_dq_free_space_nodirty(inode, nr << inode->i_sb->s_blocksize_bits); | 449 | vfs_dq_free_space_nodirty(inode, nr << inode->i_blkbits); |
382 | } | 450 | } |
383 | 451 | ||
384 | static inline void vfs_dq_free_block(struct inode *inode, qsize_t nr) | 452 | static inline void vfs_dq_free_block(struct inode *inode, qsize_t nr) |
385 | { | 453 | { |
386 | vfs_dq_free_space(inode, nr << inode->i_sb->s_blocksize_bits); | 454 | vfs_dq_free_space(inode, nr << inode->i_blkbits); |
387 | } | 455 | } |
388 | 456 | ||
389 | /* | ||
390 | * Define uppercase equivalents for compatibility with old function names | ||
391 | * Can go away when we think all users have been converted (15/04/2008) | ||
392 | */ | ||
393 | #define DQUOT_INIT(inode) vfs_dq_init(inode) | ||
394 | #define DQUOT_DROP(inode) vfs_dq_drop(inode) | ||
395 | #define DQUOT_PREALLOC_SPACE_NODIRTY(inode, nr) \ | ||
396 | vfs_dq_prealloc_space_nodirty(inode, nr) | ||
397 | #define DQUOT_PREALLOC_SPACE(inode, nr) vfs_dq_prealloc_space(inode, nr) | ||
398 | #define DQUOT_ALLOC_SPACE_NODIRTY(inode, nr) \ | ||
399 | vfs_dq_alloc_space_nodirty(inode, nr) | ||
400 | #define DQUOT_ALLOC_SPACE(inode, nr) vfs_dq_alloc_space(inode, nr) | ||
401 | #define DQUOT_PREALLOC_BLOCK_NODIRTY(inode, nr) \ | ||
402 | vfs_dq_prealloc_block_nodirty(inode, nr) | ||
403 | #define DQUOT_PREALLOC_BLOCK(inode, nr) vfs_dq_prealloc_block(inode, nr) | ||
404 | #define DQUOT_ALLOC_BLOCK_NODIRTY(inode, nr) \ | ||
405 | vfs_dq_alloc_block_nodirty(inode, nr) | ||
406 | #define DQUOT_ALLOC_BLOCK(inode, nr) vfs_dq_alloc_block(inode, nr) | ||
407 | #define DQUOT_ALLOC_INODE(inode) vfs_dq_alloc_inode(inode) | ||
408 | #define DQUOT_FREE_SPACE_NODIRTY(inode, nr) \ | ||
409 | vfs_dq_free_space_nodirty(inode, nr) | ||
410 | #define DQUOT_FREE_SPACE(inode, nr) vfs_dq_free_space(inode, nr) | ||
411 | #define DQUOT_FREE_BLOCK_NODIRTY(inode, nr) \ | ||
412 | vfs_dq_free_block_nodirty(inode, nr) | ||
413 | #define DQUOT_FREE_BLOCK(inode, nr) vfs_dq_free_block(inode, nr) | ||
414 | #define DQUOT_FREE_INODE(inode) vfs_dq_free_inode(inode) | ||
415 | #define DQUOT_TRANSFER(inode, iattr) vfs_dq_transfer(inode, iattr) | ||
416 | #define DQUOT_SYNC(sb) vfs_dq_sync(sb) | ||
417 | #define DQUOT_OFF(sb, remount) vfs_dq_off(sb, remount) | ||
418 | #define DQUOT_ON_REMOUNT(sb) vfs_dq_quota_on_remount(sb) | ||
419 | |||
420 | #endif /* _LINUX_QUOTAOPS_ */ | 457 | #endif /* _LINUX_QUOTAOPS_ */ |
diff --git a/include/linux/sched.h b/include/linux/sched.h index ff904b0606d4..1d19c025f9d2 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h | |||
@@ -1185,10 +1185,9 @@ struct task_struct { | |||
1185 | pid_t pid; | 1185 | pid_t pid; |
1186 | pid_t tgid; | 1186 | pid_t tgid; |
1187 | 1187 | ||
1188 | #ifdef CONFIG_CC_STACKPROTECTOR | ||
1189 | /* Canary value for the -fstack-protector gcc feature */ | 1188 | /* Canary value for the -fstack-protector gcc feature */ |
1190 | unsigned long stack_canary; | 1189 | unsigned long stack_canary; |
1191 | #endif | 1190 | |
1192 | /* | 1191 | /* |
1193 | * pointers to (original) parent process, youngest child, younger sibling, | 1192 | * pointers to (original) parent process, youngest child, younger sibling, |
1194 | * older sibling, respectively. (p->father can be replaced with | 1193 | * older sibling, respectively. (p->father can be replaced with |
@@ -2107,6 +2106,19 @@ static inline int object_is_on_stack(void *obj) | |||
2107 | 2106 | ||
2108 | extern void thread_info_cache_init(void); | 2107 | extern void thread_info_cache_init(void); |
2109 | 2108 | ||
2109 | #ifdef CONFIG_DEBUG_STACK_USAGE | ||
2110 | static inline unsigned long stack_not_used(struct task_struct *p) | ||
2111 | { | ||
2112 | unsigned long *n = end_of_stack(p); | ||
2113 | |||
2114 | do { /* Skip over canary */ | ||
2115 | n++; | ||
2116 | } while (!*n); | ||
2117 | |||
2118 | return (unsigned long)n - (unsigned long)end_of_stack(p); | ||
2119 | } | ||
2120 | #endif | ||
2121 | |||
2110 | /* set thread flags in other task's structures | 2122 | /* set thread flags in other task's structures |
2111 | * - see asm/thread_info.h for TIF_xxxx flags available | 2123 | * - see asm/thread_info.h for TIF_xxxx flags available |
2112 | */ | 2124 | */ |
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index eb2e837afaf3..5fd389162f01 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h | |||
@@ -237,6 +237,8 @@ enum { | |||
237 | SKB_GSO_TCP_ECN = 1 << 3, | 237 | SKB_GSO_TCP_ECN = 1 << 3, |
238 | 238 | ||
239 | SKB_GSO_TCPV6 = 1 << 4, | 239 | SKB_GSO_TCPV6 = 1 << 4, |
240 | |||
241 | SKB_GSO_FCOE = 1 << 5, | ||
240 | }; | 242 | }; |
241 | 243 | ||
242 | #if BITS_PER_LONG > 32 | 244 | #if BITS_PER_LONG > 32 |
diff --git a/include/linux/smp.h b/include/linux/smp.h index 715196b09d67..bbacb7baa446 100644 --- a/include/linux/smp.h +++ b/include/linux/smp.h | |||
@@ -176,6 +176,12 @@ static inline void init_call_single_data(void) | |||
176 | #define put_cpu() preempt_enable() | 176 | #define put_cpu() preempt_enable() |
177 | #define put_cpu_no_resched() preempt_enable_no_resched() | 177 | #define put_cpu_no_resched() preempt_enable_no_resched() |
178 | 178 | ||
179 | /* | ||
180 | * Callback to arch code if there's nosmp or maxcpus=0 on the | ||
181 | * boot command line: | ||
182 | */ | ||
183 | extern void arch_disable_smp_support(void); | ||
184 | |||
179 | void smp_setup_processor_id(void); | 185 | void smp_setup_processor_id(void); |
180 | 186 | ||
181 | #endif /* __LINUX_SMP_H */ | 187 | #endif /* __LINUX_SMP_H */ |
diff --git a/include/linux/stackprotector.h b/include/linux/stackprotector.h new file mode 100644 index 000000000000..6f3e54c704c0 --- /dev/null +++ b/include/linux/stackprotector.h | |||
@@ -0,0 +1,16 @@ | |||
1 | #ifndef _LINUX_STACKPROTECTOR_H | ||
2 | #define _LINUX_STACKPROTECTOR_H 1 | ||
3 | |||
4 | #include <linux/compiler.h> | ||
5 | #include <linux/sched.h> | ||
6 | #include <linux/random.h> | ||
7 | |||
8 | #ifdef CONFIG_CC_STACKPROTECTOR | ||
9 | # include <asm/stackprotector.h> | ||
10 | #else | ||
11 | static inline void boot_init_stack_canary(void) | ||
12 | { | ||
13 | } | ||
14 | #endif | ||
15 | |||
16 | #endif | ||
diff --git a/include/linux/topology.h b/include/linux/topology.h index e632d29f0544..a16b9e06f2e5 100644 --- a/include/linux/topology.h +++ b/include/linux/topology.h | |||
@@ -193,5 +193,11 @@ int arch_update_cpu_topology(void); | |||
193 | #ifndef topology_core_siblings | 193 | #ifndef topology_core_siblings |
194 | #define topology_core_siblings(cpu) cpumask_of_cpu(cpu) | 194 | #define topology_core_siblings(cpu) cpumask_of_cpu(cpu) |
195 | #endif | 195 | #endif |
196 | #ifndef topology_thread_cpumask | ||
197 | #define topology_thread_cpumask(cpu) cpumask_of(cpu) | ||
198 | #endif | ||
199 | #ifndef topology_core_cpumask | ||
200 | #define topology_core_cpumask(cpu) cpumask_of(cpu) | ||
201 | #endif | ||
196 | 202 | ||
197 | #endif /* _LINUX_TOPOLOGY_H */ | 203 | #endif /* _LINUX_TOPOLOGY_H */ |
diff --git a/include/linux/vmalloc.h b/include/linux/vmalloc.h index 9c0890c7a06a..a43ebec3a7b9 100644 --- a/include/linux/vmalloc.h +++ b/include/linux/vmalloc.h | |||
@@ -95,6 +95,9 @@ extern struct vm_struct *remove_vm_area(const void *addr); | |||
95 | 95 | ||
96 | extern int map_vm_area(struct vm_struct *area, pgprot_t prot, | 96 | extern int map_vm_area(struct vm_struct *area, pgprot_t prot, |
97 | struct page ***pages); | 97 | struct page ***pages); |
98 | extern int map_kernel_range_noflush(unsigned long start, unsigned long size, | ||
99 | pgprot_t prot, struct page **pages); | ||
100 | extern void unmap_kernel_range_noflush(unsigned long addr, unsigned long size); | ||
98 | extern void unmap_kernel_range(unsigned long addr, unsigned long size); | 101 | extern void unmap_kernel_range(unsigned long addr, unsigned long size); |
99 | 102 | ||
100 | /* Allocate/destroy a 'vmalloc' VM area. */ | 103 | /* Allocate/destroy a 'vmalloc' VM area. */ |
@@ -110,5 +113,6 @@ extern long vwrite(char *buf, char *addr, unsigned long count); | |||
110 | */ | 113 | */ |
111 | extern rwlock_t vmlist_lock; | 114 | extern rwlock_t vmlist_lock; |
112 | extern struct vm_struct *vmlist; | 115 | extern struct vm_struct *vmlist; |
116 | extern __init void vm_area_register_early(struct vm_struct *vm, size_t align); | ||
113 | 117 | ||
114 | #endif /* _LINUX_VMALLOC_H */ | 118 | #endif /* _LINUX_VMALLOC_H */ |
diff --git a/include/scsi/fc/fc_fcoe.h b/include/scsi/fc/fc_fcoe.h index f271d9cc0fc2..ccb3dbe90463 100644 --- a/include/scsi/fc/fc_fcoe.h +++ b/include/scsi/fc/fc_fcoe.h | |||
@@ -25,13 +25,6 @@ | |||
25 | */ | 25 | */ |
26 | 26 | ||
27 | /* | 27 | /* |
28 | * The FCoE ethertype eventually goes in net/if_ether.h. | ||
29 | */ | ||
30 | #ifndef ETH_P_FCOE | ||
31 | #define ETH_P_FCOE 0x8906 /* FCOE ether type */ | ||
32 | #endif | ||
33 | |||
34 | /* | ||
35 | * FC_FCOE_OUI hasn't been standardized yet. XXX TBD. | 28 | * FC_FCOE_OUI hasn't been standardized yet. XXX TBD. |
36 | */ | 29 | */ |
37 | #ifndef FC_FCOE_OUI | 30 | #ifndef FC_FCOE_OUI |
diff --git a/include/scsi/fc_frame.h b/include/scsi/fc_frame.h index 04d34a71355f..59511057cee0 100644 --- a/include/scsi/fc_frame.h +++ b/include/scsi/fc_frame.h | |||
@@ -54,8 +54,7 @@ | |||
54 | #define fr_eof(fp) (fr_cb(fp)->fr_eof) | 54 | #define fr_eof(fp) (fr_cb(fp)->fr_eof) |
55 | #define fr_flags(fp) (fr_cb(fp)->fr_flags) | 55 | #define fr_flags(fp) (fr_cb(fp)->fr_flags) |
56 | #define fr_max_payload(fp) (fr_cb(fp)->fr_max_payload) | 56 | #define fr_max_payload(fp) (fr_cb(fp)->fr_max_payload) |
57 | #define fr_cmd(fp) (fr_cb(fp)->fr_cmd) | 57 | #define fr_fsp(fp) (fr_cb(fp)->fr_fsp) |
58 | #define fr_dir(fp) (fr_cmd(fp)->sc_data_direction) | ||
59 | #define fr_crc(fp) (fr_cb(fp)->fr_crc) | 58 | #define fr_crc(fp) (fr_cb(fp)->fr_crc) |
60 | 59 | ||
61 | struct fc_frame { | 60 | struct fc_frame { |
@@ -66,7 +65,7 @@ struct fcoe_rcv_info { | |||
66 | struct packet_type *ptype; | 65 | struct packet_type *ptype; |
67 | struct fc_lport *fr_dev; /* transport layer private pointer */ | 66 | struct fc_lport *fr_dev; /* transport layer private pointer */ |
68 | struct fc_seq *fr_seq; /* for use with exchange manager */ | 67 | struct fc_seq *fr_seq; /* for use with exchange manager */ |
69 | struct scsi_cmnd *fr_cmd; /* for use of scsi command */ | 68 | struct fc_fcp_pkt *fr_fsp; /* for the corresponding fcp I/O */ |
70 | u32 fr_crc; | 69 | u32 fr_crc; |
71 | u16 fr_max_payload; /* max FC payload */ | 70 | u16 fr_max_payload; /* max FC payload */ |
72 | enum fc_sof fr_sof; /* start of frame delimiter */ | 71 | enum fc_sof fr_sof; /* start of frame delimiter */ |
@@ -218,20 +217,6 @@ static inline bool fc_frame_is_cmd(const struct fc_frame *fp) | |||
218 | return fc_frame_rctl(fp) == FC_RCTL_DD_UNSOL_CMD; | 217 | return fc_frame_rctl(fp) == FC_RCTL_DD_UNSOL_CMD; |
219 | } | 218 | } |
220 | 219 | ||
221 | static inline bool fc_frame_is_read(const struct fc_frame *fp) | ||
222 | { | ||
223 | if (fc_frame_is_cmd(fp) && fr_cmd(fp)) | ||
224 | return fr_dir(fp) == DMA_FROM_DEVICE; | ||
225 | return false; | ||
226 | } | ||
227 | |||
228 | static inline bool fc_frame_is_write(const struct fc_frame *fp) | ||
229 | { | ||
230 | if (fc_frame_is_cmd(fp) && fr_cmd(fp)) | ||
231 | return fr_dir(fp) == DMA_TO_DEVICE; | ||
232 | return false; | ||
233 | } | ||
234 | |||
235 | /* | 220 | /* |
236 | * Check for leaks. | 221 | * Check for leaks. |
237 | * Print the frame header of any currently allocated frame, assuming there | 222 | * Print the frame header of any currently allocated frame, assuming there |
diff --git a/include/scsi/libfc.h b/include/scsi/libfc.h index a2e126b86e3e..a70eafaad084 100644 --- a/include/scsi/libfc.h +++ b/include/scsi/libfc.h | |||
@@ -245,6 +245,7 @@ struct fc_fcp_pkt { | |||
245 | */ | 245 | */ |
246 | struct fcp_cmnd cdb_cmd; | 246 | struct fcp_cmnd cdb_cmd; |
247 | size_t xfer_len; | 247 | size_t xfer_len; |
248 | u16 xfer_ddp; /* this xfer is ddped */ | ||
248 | u32 xfer_contig_end; /* offset of end of contiguous xfer */ | 249 | u32 xfer_contig_end; /* offset of end of contiguous xfer */ |
249 | u16 max_payload; /* max payload size in bytes */ | 250 | u16 max_payload; /* max payload size in bytes */ |
250 | 251 | ||
@@ -267,6 +268,15 @@ struct fc_fcp_pkt { | |||
267 | u8 recov_retry; /* count of recovery retries */ | 268 | u8 recov_retry; /* count of recovery retries */ |
268 | struct fc_seq *recov_seq; /* sequence for REC or SRR */ | 269 | struct fc_seq *recov_seq; /* sequence for REC or SRR */ |
269 | }; | 270 | }; |
271 | /* | ||
272 | * FC_FCP HELPER FUNCTIONS | ||
273 | *****************************/ | ||
274 | static inline bool fc_fcp_is_read(const struct fc_fcp_pkt *fsp) | ||
275 | { | ||
276 | if (fsp && fsp->cmd) | ||
277 | return fsp->cmd->sc_data_direction == DMA_FROM_DEVICE; | ||
278 | return false; | ||
279 | } | ||
270 | 280 | ||
271 | /* | 281 | /* |
272 | * Structure and function definitions for managing Fibre Channel Exchanges | 282 | * Structure and function definitions for managing Fibre Channel Exchanges |
@@ -400,6 +410,21 @@ struct libfc_function_template { | |||
400 | void *arg, unsigned int timer_msec); | 410 | void *arg, unsigned int timer_msec); |
401 | 411 | ||
402 | /* | 412 | /* |
413 | * Sets up the DDP context for a given exchange id on the given | ||
414 | * scatterlist if LLD supports DDP for large receive. | ||
415 | * | ||
416 | * STATUS: OPTIONAL | ||
417 | */ | ||
418 | int (*ddp_setup)(struct fc_lport *lp, u16 xid, | ||
419 | struct scatterlist *sgl, unsigned int sgc); | ||
420 | /* | ||
421 | * Completes the DDP transfer and returns the length of data DDPed | ||
422 | * for the given exchange id. | ||
423 | * | ||
424 | * STATUS: OPTIONAL | ||
425 | */ | ||
426 | int (*ddp_done)(struct fc_lport *lp, u16 xid); | ||
427 | /* | ||
403 | * Send a frame using an existing sequence and exchange. | 428 | * Send a frame using an existing sequence and exchange. |
404 | * | 429 | * |
405 | * STATUS: OPTIONAL | 430 | * STATUS: OPTIONAL |
@@ -654,6 +679,7 @@ struct fc_lport { | |||
654 | u16 link_speed; | 679 | u16 link_speed; |
655 | u16 link_supported_speeds; | 680 | u16 link_supported_speeds; |
656 | u16 lro_xid; /* max xid for fcoe lro */ | 681 | u16 lro_xid; /* max xid for fcoe lro */ |
682 | unsigned int lso_max; /* max large send size */ | ||
657 | struct fc_ns_fts fcts; /* FC-4 type masks */ | 683 | struct fc_ns_fts fcts; /* FC-4 type masks */ |
658 | struct fc_els_rnid_gen rnid_gen; /* RNID information */ | 684 | struct fc_els_rnid_gen rnid_gen; /* RNID information */ |
659 | 685 | ||
@@ -821,6 +847,11 @@ int fc_change_queue_type(struct scsi_device *sdev, int tag_type); | |||
821 | void fc_fcp_destroy(struct fc_lport *); | 847 | void fc_fcp_destroy(struct fc_lport *); |
822 | 848 | ||
823 | /* | 849 | /* |
850 | * Set up direct-data placement for this I/O request | ||
851 | */ | ||
852 | void fc_fcp_ddp_setup(struct fc_fcp_pkt *fsp, u16 xid); | ||
853 | |||
854 | /* | ||
824 | * ELS/CT interface | 855 | * ELS/CT interface |
825 | *****************************/ | 856 | *****************************/ |
826 | /* | 857 | /* |
diff --git a/include/scsi/libfcoe.h b/include/scsi/libfcoe.h index 941818f29f59..c41f7d0c6efc 100644 --- a/include/scsi/libfcoe.h +++ b/include/scsi/libfcoe.h | |||
@@ -124,24 +124,6 @@ static inline u16 skb_fc_rxid(const struct sk_buff *skb) | |||
124 | return be16_to_cpu(skb_fc_header(skb)->fh_rx_id); | 124 | return be16_to_cpu(skb_fc_header(skb)->fh_rx_id); |
125 | } | 125 | } |
126 | 126 | ||
127 | /* FIXME - DMA_BIDIRECTIONAL ? */ | ||
128 | #define skb_cb(skb) ((struct fcoe_rcv_info *)&((skb)->cb[0])) | ||
129 | #define skb_cmd(skb) (skb_cb(skb)->fr_cmd) | ||
130 | #define skb_dir(skb) (skb_cmd(skb)->sc_data_direction) | ||
131 | static inline bool skb_fc_is_read(const struct sk_buff *skb) | ||
132 | { | ||
133 | if (skb_fc_is_cmd(skb) && skb_cmd(skb)) | ||
134 | return skb_dir(skb) == DMA_FROM_DEVICE; | ||
135 | return false; | ||
136 | } | ||
137 | |||
138 | static inline bool skb_fc_is_write(const struct sk_buff *skb) | ||
139 | { | ||
140 | if (skb_fc_is_cmd(skb) && skb_cmd(skb)) | ||
141 | return skb_dir(skb) == DMA_TO_DEVICE; | ||
142 | return false; | ||
143 | } | ||
144 | |||
145 | /* libfcoe funcs */ | 127 | /* libfcoe funcs */ |
146 | int fcoe_reset(struct Scsi_Host *shost); | 128 | int fcoe_reset(struct Scsi_Host *shost); |
147 | u64 fcoe_wwn_from_mac(unsigned char mac[MAX_ADDR_LEN], | 129 | u64 fcoe_wwn_from_mac(unsigned char mac[MAX_ADDR_LEN], |
diff --git a/include/scsi/libiscsi.h b/include/scsi/libiscsi.h index 7360e1916e75..7ffaed2f94dd 100644 --- a/include/scsi/libiscsi.h +++ b/include/scsi/libiscsi.h | |||
@@ -45,18 +45,10 @@ struct iscsi_session; | |||
45 | struct iscsi_nopin; | 45 | struct iscsi_nopin; |
46 | struct device; | 46 | struct device; |
47 | 47 | ||
48 | /* #define DEBUG_SCSI */ | ||
49 | #ifdef DEBUG_SCSI | ||
50 | #define debug_scsi(fmt...) printk(KERN_INFO "iscsi: " fmt) | ||
51 | #else | ||
52 | #define debug_scsi(fmt...) | ||
53 | #endif | ||
54 | |||
55 | #define ISCSI_DEF_XMIT_CMDS_MAX 128 /* must be power of 2 */ | 48 | #define ISCSI_DEF_XMIT_CMDS_MAX 128 /* must be power of 2 */ |
56 | #define ISCSI_MGMT_CMDS_MAX 15 | 49 | #define ISCSI_MGMT_CMDS_MAX 15 |
57 | 50 | ||
58 | #define ISCSI_DEF_CMD_PER_LUN 32 | 51 | #define ISCSI_DEF_CMD_PER_LUN 32 |
59 | #define ISCSI_MAX_CMD_PER_LUN 128 | ||
60 | 52 | ||
61 | /* Task Mgmt states */ | 53 | /* Task Mgmt states */ |
62 | enum { | 54 | enum { |
@@ -326,6 +318,9 @@ struct iscsi_host { | |||
326 | spinlock_t lock; | 318 | spinlock_t lock; |
327 | int num_sessions; | 319 | int num_sessions; |
328 | int state; | 320 | int state; |
321 | |||
322 | struct workqueue_struct *workq; | ||
323 | char workq_name[20]; | ||
329 | }; | 324 | }; |
330 | 325 | ||
331 | /* | 326 | /* |
@@ -351,7 +346,8 @@ extern int iscsi_host_get_param(struct Scsi_Host *shost, | |||
351 | enum iscsi_host_param param, char *buf); | 346 | enum iscsi_host_param param, char *buf); |
352 | extern int iscsi_host_add(struct Scsi_Host *shost, struct device *pdev); | 347 | extern int iscsi_host_add(struct Scsi_Host *shost, struct device *pdev); |
353 | extern struct Scsi_Host *iscsi_host_alloc(struct scsi_host_template *sht, | 348 | extern struct Scsi_Host *iscsi_host_alloc(struct scsi_host_template *sht, |
354 | int dd_data_size, uint16_t qdepth); | 349 | int dd_data_size, |
350 | bool xmit_can_sleep); | ||
355 | extern void iscsi_host_remove(struct Scsi_Host *shost); | 351 | extern void iscsi_host_remove(struct Scsi_Host *shost); |
356 | extern void iscsi_host_free(struct Scsi_Host *shost); | 352 | extern void iscsi_host_free(struct Scsi_Host *shost); |
357 | 353 | ||
@@ -382,11 +378,12 @@ extern void iscsi_conn_stop(struct iscsi_cls_conn *, int); | |||
382 | extern int iscsi_conn_bind(struct iscsi_cls_session *, struct iscsi_cls_conn *, | 378 | extern int iscsi_conn_bind(struct iscsi_cls_session *, struct iscsi_cls_conn *, |
383 | int); | 379 | int); |
384 | extern void iscsi_conn_failure(struct iscsi_conn *conn, enum iscsi_err err); | 380 | extern void iscsi_conn_failure(struct iscsi_conn *conn, enum iscsi_err err); |
385 | extern void iscsi_session_failure(struct iscsi_cls_session *cls_session, | 381 | extern void iscsi_session_failure(struct iscsi_session *session, |
386 | enum iscsi_err err); | 382 | enum iscsi_err err); |
387 | extern int iscsi_conn_get_param(struct iscsi_cls_conn *cls_conn, | 383 | extern int iscsi_conn_get_param(struct iscsi_cls_conn *cls_conn, |
388 | enum iscsi_param param, char *buf); | 384 | enum iscsi_param param, char *buf); |
389 | extern void iscsi_suspend_tx(struct iscsi_conn *conn); | 385 | extern void iscsi_suspend_tx(struct iscsi_conn *conn); |
386 | extern void iscsi_conn_queue_work(struct iscsi_conn *conn); | ||
390 | 387 | ||
391 | #define iscsi_conn_printk(prefix, _c, fmt, a...) \ | 388 | #define iscsi_conn_printk(prefix, _c, fmt, a...) \ |
392 | iscsi_cls_conn_printk(prefix, ((struct iscsi_conn *)_c)->cls_conn, \ | 389 | iscsi_cls_conn_printk(prefix, ((struct iscsi_conn *)_c)->cls_conn, \ |
diff --git a/include/scsi/osd_attributes.h b/include/scsi/osd_attributes.h new file mode 100644 index 000000000000..f888a6fda073 --- /dev/null +++ b/include/scsi/osd_attributes.h | |||
@@ -0,0 +1,327 @@ | |||
1 | #ifndef __OSD_ATTRIBUTES_H__ | ||
2 | #define __OSD_ATTRIBUTES_H__ | ||
3 | |||
4 | #include "osd_protocol.h" | ||
5 | |||
6 | /* | ||
7 | * Contains types and constants that define attribute pages and attribute | ||
8 | * numbers and their data types. | ||
9 | */ | ||
10 | |||
11 | #define ATTR_SET(pg, id, l, ptr) \ | ||
12 | { .attr_page = pg, .attr_id = id, .len = l, .val_ptr = ptr } | ||
13 | |||
14 | #define ATTR_DEF(pg, id, l) ATTR_SET(pg, id, l, NULL) | ||
15 | |||
16 | /* osd-r10 4.7.3 Attributes pages */ | ||
17 | enum { | ||
18 | OSD_APAGE_OBJECT_FIRST = 0x0, | ||
19 | OSD_APAGE_OBJECT_DIRECTORY = 0, | ||
20 | OSD_APAGE_OBJECT_INFORMATION = 1, | ||
21 | OSD_APAGE_OBJECT_QUOTAS = 2, | ||
22 | OSD_APAGE_OBJECT_TIMESTAMP = 3, | ||
23 | OSD_APAGE_OBJECT_COLLECTIONS = 4, | ||
24 | OSD_APAGE_OBJECT_SECURITY = 5, | ||
25 | OSD_APAGE_OBJECT_LAST = 0x2fffffff, | ||
26 | |||
27 | OSD_APAGE_PARTITION_FIRST = 0x30000000, | ||
28 | OSD_APAGE_PARTITION_DIRECTORY = OSD_APAGE_PARTITION_FIRST + 0, | ||
29 | OSD_APAGE_PARTITION_INFORMATION = OSD_APAGE_PARTITION_FIRST + 1, | ||
30 | OSD_APAGE_PARTITION_QUOTAS = OSD_APAGE_PARTITION_FIRST + 2, | ||
31 | OSD_APAGE_PARTITION_TIMESTAMP = OSD_APAGE_PARTITION_FIRST + 3, | ||
32 | OSD_APAGE_PARTITION_SECURITY = OSD_APAGE_PARTITION_FIRST + 5, | ||
33 | OSD_APAGE_PARTITION_LAST = 0x5FFFFFFF, | ||
34 | |||
35 | OSD_APAGE_COLLECTION_FIRST = 0x60000000, | ||
36 | OSD_APAGE_COLLECTION_DIRECTORY = OSD_APAGE_COLLECTION_FIRST + 0, | ||
37 | OSD_APAGE_COLLECTION_INFORMATION = OSD_APAGE_COLLECTION_FIRST + 1, | ||
38 | OSD_APAGE_COLLECTION_TIMESTAMP = OSD_APAGE_COLLECTION_FIRST + 3, | ||
39 | OSD_APAGE_COLLECTION_SECURITY = OSD_APAGE_COLLECTION_FIRST + 5, | ||
40 | OSD_APAGE_COLLECTION_LAST = 0x8FFFFFFF, | ||
41 | |||
42 | OSD_APAGE_ROOT_FIRST = 0x90000000, | ||
43 | OSD_APAGE_ROOT_DIRECTORY = OSD_APAGE_ROOT_FIRST + 0, | ||
44 | OSD_APAGE_ROOT_INFORMATION = OSD_APAGE_ROOT_FIRST + 1, | ||
45 | OSD_APAGE_ROOT_QUOTAS = OSD_APAGE_ROOT_FIRST + 2, | ||
46 | OSD_APAGE_ROOT_TIMESTAMP = OSD_APAGE_ROOT_FIRST + 3, | ||
47 | OSD_APAGE_ROOT_SECURITY = OSD_APAGE_ROOT_FIRST + 5, | ||
48 | OSD_APAGE_ROOT_LAST = 0xBFFFFFFF, | ||
49 | |||
50 | OSD_APAGE_RESERVED_TYPE_FIRST = 0xC0000000, | ||
51 | OSD_APAGE_RESERVED_TYPE_LAST = 0xEFFFFFFF, | ||
52 | |||
53 | OSD_APAGE_COMMON_FIRST = 0xF0000000, | ||
54 | OSD_APAGE_COMMON_LAST = 0xFFFFFFFE, | ||
55 | |||
56 | OSD_APAGE_REQUEST_ALL = 0xFFFFFFFF, | ||
57 | }; | ||
58 | |||
59 | /* subcategories of attr pages within each range above */ | ||
60 | enum { | ||
61 | OSD_APAGE_STD_FIRST = 0x0, | ||
62 | OSD_APAGE_STD_DIRECTORY = 0, | ||
63 | OSD_APAGE_STD_INFORMATION = 1, | ||
64 | OSD_APAGE_STD_QUOTAS = 2, | ||
65 | OSD_APAGE_STD_TIMESTAMP = 3, | ||
66 | OSD_APAGE_STD_COLLECTIONS = 4, | ||
67 | OSD_APAGE_STD_POLICY_SECURITY = 5, | ||
68 | OSD_APAGE_STD_LAST = 0x0000007F, | ||
69 | |||
70 | OSD_APAGE_RESERVED_FIRST = 0x00000080, | ||
71 | OSD_APAGE_RESERVED_LAST = 0x00007FFF, | ||
72 | |||
73 | OSD_APAGE_OTHER_STD_FIRST = 0x00008000, | ||
74 | OSD_APAGE_OTHER_STD_LAST = 0x0000EFFF, | ||
75 | |||
76 | OSD_APAGE_PUBLIC_FIRST = 0x0000F000, | ||
77 | OSD_APAGE_PUBLIC_LAST = 0x0000FFFF, | ||
78 | |||
79 | OSD_APAGE_APP_DEFINED_FIRST = 0x00010000, | ||
80 | OSD_APAGE_APP_DEFINED_LAST = 0x1FFFFFFF, | ||
81 | |||
82 | OSD_APAGE_VENDOR_SPECIFIC_FIRST = 0x20000000, | ||
83 | OSD_APAGE_VENDOR_SPECIFIC_LAST = 0x2FFFFFFF, | ||
84 | }; | ||
85 | |||
86 | enum { | ||
87 | OSD_ATTR_PAGE_IDENTIFICATION = 0, /* in all pages 40 bytes */ | ||
88 | }; | ||
89 | |||
90 | struct page_identification { | ||
91 | u8 vendor_identification[8]; | ||
92 | u8 page_identification[32]; | ||
93 | } __packed; | ||
94 | |||
95 | struct osd_attr_page_header { | ||
96 | __be32 page_number; | ||
97 | __be32 page_length; | ||
98 | } __packed; | ||
99 | |||
100 | /* 7.1.2.8 Root Information attributes page (OSD_APAGE_ROOT_INFORMATION) */ | ||
101 | enum { | ||
102 | OSD_ATTR_RI_OSD_SYSTEM_ID = 0x3, /* 20 */ | ||
103 | OSD_ATTR_RI_VENDOR_IDENTIFICATION = 0x4, /* 8 */ | ||
104 | OSD_ATTR_RI_PRODUCT_IDENTIFICATION = 0x5, /* 16 */ | ||
105 | OSD_ATTR_RI_PRODUCT_MODEL = 0x6, /* 32 */ | ||
106 | OSD_ATTR_RI_PRODUCT_REVISION_LEVEL = 0x7, /* 4 */ | ||
107 | OSD_ATTR_RI_PRODUCT_SERIAL_NUMBER = 0x8, /* variable */ | ||
108 | OSD_ATTR_RI_OSD_NAME = 0x9, /* variable */ | ||
109 | OSD_ATTR_RI_TOTAL_CAPACITY = 0x80, /* 8 */ | ||
110 | OSD_ATTR_RI_USED_CAPACITY = 0x81, /* 8 */ | ||
111 | OSD_ATTR_RI_NUMBER_OF_PARTITIONS = 0xC0, /* 8 */ | ||
112 | OSD_ATTR_RI_CLOCK = 0x100, /* 6 */ | ||
113 | }; | ||
114 | /* Root_Information_attributes_page does not have a get_page structure */ | ||
115 | |||
116 | /* 7.1.2.9 Partition Information attributes page | ||
117 | * (OSD_APAGE_PARTITION_INFORMATION) | ||
118 | */ | ||
119 | enum { | ||
120 | OSD_ATTR_PI_PARTITION_ID = 0x1, /* 8 */ | ||
121 | OSD_ATTR_PI_USERNAME = 0x9, /* variable */ | ||
122 | OSD_ATTR_PI_USED_CAPACITY = 0x81, /* 8 */ | ||
123 | OSD_ATTR_PI_NUMBER_OF_OBJECTS = 0xC1, /* 8 */ | ||
124 | }; | ||
125 | /* Partition Information attributes page does not have a get_page structure */ | ||
126 | |||
127 | /* 7.1.2.10 Collection Information attributes page | ||
128 | * (OSD_APAGE_COLLECTION_INFORMATION) | ||
129 | */ | ||
130 | enum { | ||
131 | OSD_ATTR_CI_PARTITION_ID = 0x1, /* 8 */ | ||
132 | OSD_ATTR_CI_COLLECTION_OBJECT_ID = 0x2, /* 8 */ | ||
133 | OSD_ATTR_CI_USERNAME = 0x9, /* variable */ | ||
134 | OSD_ATTR_CI_USED_CAPACITY = 0x81, /* 8 */ | ||
135 | }; | ||
136 | /* Collection Information attributes page does not have a get_page structure */ | ||
137 | |||
138 | /* 7.1.2.11 User Object Information attributes page | ||
139 | * (OSD_APAGE_OBJECT_INFORMATION) | ||
140 | */ | ||
141 | enum { | ||
142 | OSD_ATTR_OI_PARTITION_ID = 0x1, /* 8 */ | ||
143 | OSD_ATTR_OI_OBJECT_ID = 0x2, /* 8 */ | ||
144 | OSD_ATTR_OI_USERNAME = 0x9, /* variable */ | ||
145 | OSD_ATTR_OI_USED_CAPACITY = 0x81, /* 8 */ | ||
146 | OSD_ATTR_OI_LOGICAL_LENGTH = 0x82, /* 8 */ | ||
147 | }; | ||
148 | /* Object Information attributes page does not have a get_page structure */ | ||
149 | |||
150 | /* 7.1.2.12 Root Quotas attributes page (OSD_APAGE_ROOT_QUOTAS) */ | ||
151 | enum { | ||
152 | OSD_ATTR_RQ_DEFAULT_MAXIMUM_USER_OBJECT_LENGTH = 0x1, /* 8 */ | ||
153 | OSD_ATTR_RQ_PARTITION_CAPACITY_QUOTA = 0x10001, /* 8 */ | ||
154 | OSD_ATTR_RQ_PARTITION_OBJECT_COUNT = 0x10002, /* 8 */ | ||
155 | OSD_ATTR_RQ_PARTITION_COLLECTIONS_PER_USER_OBJECT = 0x10081, /* 4 */ | ||
156 | OSD_ATTR_RQ_PARTITION_COUNT = 0x20002, /* 8 */ | ||
157 | }; | ||
158 | |||
159 | struct Root_Quotas_attributes_page { | ||
160 | struct osd_attr_page_header hdr; /* id=R+2, size=0x24 */ | ||
161 | __be64 default_maximum_user_object_length; | ||
162 | __be64 partition_capacity_quota; | ||
163 | __be64 partition_object_count; | ||
164 | __be64 partition_collections_per_user_object; | ||
165 | __be64 partition_count; | ||
166 | } __packed; | ||
167 | |||
168 | /* 7.1.2.13 Partition Quotas attributes page (OSD_APAGE_PARTITION_QUOTAS)*/ | ||
169 | enum { | ||
170 | OSD_ATTR_PQ_DEFAULT_MAXIMUM_USER_OBJECT_LENGTH = 0x1, /* 8 */ | ||
171 | OSD_ATTR_PQ_CAPACITY_QUOTA = 0x10001, /* 8 */ | ||
172 | OSD_ATTR_PQ_OBJECT_COUNT = 0x10002, /* 8 */ | ||
173 | OSD_ATTR_PQ_COLLECTIONS_PER_USER_OBJECT = 0x10081, /* 4 */ | ||
174 | }; | ||
175 | |||
176 | struct Partition_Quotas_attributes_page { | ||
177 | struct osd_attr_page_header hdr; /* id=P+2, size=0x1C */ | ||
178 | __be64 default_maximum_user_object_length; | ||
179 | __be64 capacity_quota; | ||
180 | __be64 object_count; | ||
181 | __be64 collections_per_user_object; | ||
182 | } __packed; | ||
183 | |||
184 | /* 7.1.2.14 User Object Quotas attributes page (OSD_APAGE_OBJECT_QUOTAS) */ | ||
185 | enum { | ||
186 | OSD_ATTR_OQ_MAXIMUM_LENGTH = 0x1, /* 8 */ | ||
187 | }; | ||
188 | |||
189 | struct Object_Quotas_attributes_page { | ||
190 | struct osd_attr_page_header hdr; /* id=U+2, size=0x8 */ | ||
191 | __be64 maximum_length; | ||
192 | } __packed; | ||
193 | |||
194 | /* 7.1.2.15 Root Timestamps attributes page (OSD_APAGE_ROOT_TIMESTAMP) */ | ||
195 | enum { | ||
196 | OSD_ATTR_RT_ATTRIBUTES_ACCESSED_TIME = 0x2, /* 6 */ | ||
197 | OSD_ATTR_RT_ATTRIBUTES_MODIFIED_TIME = 0x3, /* 6 */ | ||
198 | OSD_ATTR_RT_TIMESTAMP_BYPASS = 0xFFFFFFFE, /* 1 */ | ||
199 | }; | ||
200 | |||
201 | struct root_timestamps_attributes_page { | ||
202 | struct osd_attr_page_header hdr; /* id=R+3, size=0xD */ | ||
203 | struct osd_timestamp attributes_accessed_time; | ||
204 | struct osd_timestamp attributes_modified_time; | ||
205 | u8 timestamp_bypass; | ||
206 | } __packed; | ||
207 | |||
208 | /* 7.1.2.16 Partition Timestamps attributes page | ||
209 | * (OSD_APAGE_PARTITION_TIMESTAMP) | ||
210 | */ | ||
211 | enum { | ||
212 | OSD_ATTR_PT_CREATED_TIME = 0x1, /* 6 */ | ||
213 | OSD_ATTR_PT_ATTRIBUTES_ACCESSED_TIME = 0x2, /* 6 */ | ||
214 | OSD_ATTR_PT_ATTRIBUTES_MODIFIED_TIME = 0x3, /* 6 */ | ||
215 | OSD_ATTR_PT_DATA_ACCESSED_TIME = 0x4, /* 6 */ | ||
216 | OSD_ATTR_PT_DATA_MODIFIED_TIME = 0x5, /* 6 */ | ||
217 | OSD_ATTR_PT_TIMESTAMP_BYPASS = 0xFFFFFFFE, /* 1 */ | ||
218 | }; | ||
219 | |||
220 | struct partition_timestamps_attributes_page { | ||
221 | struct osd_attr_page_header hdr; /* id=P+3, size=0x1F */ | ||
222 | struct osd_timestamp created_time; | ||
223 | struct osd_timestamp attributes_accessed_time; | ||
224 | struct osd_timestamp attributes_modified_time; | ||
225 | struct osd_timestamp data_accessed_time; | ||
226 | struct osd_timestamp data_modified_time; | ||
227 | u8 timestamp_bypass; | ||
228 | } __packed; | ||
229 | |||
230 | /* 7.1.2.17/18 Collection/Object Timestamps attributes page | ||
231 | * (OSD_APAGE_COLLECTION_TIMESTAMP/OSD_APAGE_OBJECT_TIMESTAMP) | ||
232 | */ | ||
233 | enum { | ||
234 | OSD_ATTR_OT_CREATED_TIME = 0x1, /* 6 */ | ||
235 | OSD_ATTR_OT_ATTRIBUTES_ACCESSED_TIME = 0x2, /* 6 */ | ||
236 | OSD_ATTR_OT_ATTRIBUTES_MODIFIED_TIME = 0x3, /* 6 */ | ||
237 | OSD_ATTR_OT_DATA_ACCESSED_TIME = 0x4, /* 6 */ | ||
238 | OSD_ATTR_OT_DATA_MODIFIED_TIME = 0x5, /* 6 */ | ||
239 | }; | ||
240 | |||
241 | /* same for collection */ | ||
242 | struct object_timestamps_attributes_page { | ||
243 | struct osd_attr_page_header hdr; /* id=C+3/3, size=0x1E */ | ||
244 | struct osd_timestamp created_time; | ||
245 | struct osd_timestamp attributes_accessed_time; | ||
246 | struct osd_timestamp attributes_modified_time; | ||
247 | struct osd_timestamp data_accessed_time; | ||
248 | struct osd_timestamp data_modified_time; | ||
249 | } __packed; | ||
250 | |||
251 | /* 7.1.2.19 Collections attributes page */ | ||
252 | /* TBD */ | ||
253 | |||
254 | /* 7.1.2.20 Root Policy/Security attributes page (OSD_APAGE_ROOT_SECURITY) */ | ||
255 | enum { | ||
256 | OSD_ATTR_RS_DEFAULT_SECURITY_METHOD = 0x1, /* 1 */ | ||
257 | OSD_ATTR_RS_OLDEST_VALID_NONCE_LIMIT = 0x2, /* 6 */ | ||
258 | OSD_ATTR_RS_NEWEST_VALID_NONCE_LIMIT = 0x3, /* 6 */ | ||
259 | OSD_ATTR_RS_PARTITION_DEFAULT_SECURITY_METHOD = 0x6, /* 1 */ | ||
260 | OSD_ATTR_RS_SUPPORTED_SECURITY_METHODS = 0x7, /* 2 */ | ||
261 | OSD_ATTR_RS_ADJUSTABLE_CLOCK = 0x9, /* 6 */ | ||
262 | OSD_ATTR_RS_MASTER_KEY_IDENTIFIER = 0x7FFD, /* 0 or 7 */ | ||
263 | OSD_ATTR_RS_ROOT_KEY_IDENTIFIER = 0x7FFE, /* 0 or 7 */ | ||
264 | OSD_ATTR_RS_SUPPORTED_INTEGRITY_ALGORITHM_0 = 0x80000000,/* 1,(x16)*/ | ||
265 | OSD_ATTR_RS_SUPPORTED_DH_GROUP_0 = 0x80000010,/* 1,(x16)*/ | ||
266 | }; | ||
267 | |||
268 | struct root_security_attributes_page { | ||
269 | struct osd_attr_page_header hdr; /* id=R+5, size=0x3F */ | ||
270 | u8 default_security_method; | ||
271 | u8 partition_default_security_method; | ||
272 | __be16 supported_security_methods; | ||
273 | u8 mki_valid_rki_valid; | ||
274 | struct osd_timestamp oldest_valid_nonce_limit; | ||
275 | struct osd_timestamp newest_valid_nonce_limit; | ||
276 | struct osd_timestamp adjustable_clock; | ||
277 | u8 master_key_identifier[32-25]; | ||
278 | u8 root_key_identifier[39-32]; | ||
279 | u8 supported_integrity_algorithm[16]; | ||
280 | u8 supported_dh_group[16]; | ||
281 | } __packed; | ||
282 | |||
283 | /* 7.1.2.21 Partition Policy/Security attributes page | ||
284 | * (OSD_APAGE_PARTITION_SECURITY) | ||
285 | */ | ||
286 | enum { | ||
287 | OSD_ATTR_PS_DEFAULT_SECURITY_METHOD = 0x1, /* 1 */ | ||
288 | OSD_ATTR_PS_OLDEST_VALID_NONCE = 0x2, /* 6 */ | ||
289 | OSD_ATTR_PS_NEWEST_VALID_NONCE = 0x3, /* 6 */ | ||
290 | OSD_ATTR_PS_REQUEST_NONCE_LIST_DEPTH = 0x4, /* 2 */ | ||
291 | OSD_ATTR_PS_FROZEN_WORKING_KEY_BIT_MASK = 0x5, /* 2 */ | ||
292 | OSD_ATTR_PS_PARTITION_KEY_IDENTIFIER = 0x7FFF, /* 0 or 7 */ | ||
293 | OSD_ATTR_PS_WORKING_KEY_IDENTIFIER_FIRST = 0x8000, /* 0 or 7 */ | ||
294 | OSD_ATTR_PS_WORKING_KEY_IDENTIFIER_LAST = 0x800F, /* 0 or 7 */ | ||
295 | OSD_ATTR_PS_POLICY_ACCESS_TAG = 0x40000001, /* 4 */ | ||
296 | OSD_ATTR_PS_USER_OBJECT_POLICY_ACCESS_TAG = 0x40000002, /* 4 */ | ||
297 | }; | ||
298 | |||
299 | struct partition_security_attributes_page { | ||
300 | struct osd_attr_page_header hdr; /* id=p+5, size=0x8f */ | ||
301 | u8 reserved[3]; | ||
302 | u8 default_security_method; | ||
303 | struct osd_timestamp oldest_valid_nonce; | ||
304 | struct osd_timestamp newest_valid_nonce; | ||
305 | __be16 request_nonce_list_depth; | ||
306 | __be16 frozen_working_key_bit_mask; | ||
307 | __be32 policy_access_tag; | ||
308 | __be32 user_object_policy_access_tag; | ||
309 | u8 pki_valid; | ||
310 | __be16 wki_00_0f_vld; | ||
311 | struct osd_key_identifier partition_key_identifier; | ||
312 | struct osd_key_identifier working_key_identifiers[16]; | ||
313 | } __packed; | ||
314 | |||
315 | /* 7.1.2.22/23 Collection/Object Policy-Security attributes page | ||
316 | * (OSD_APAGE_COLLECTION_SECURITY/OSD_APAGE_OBJECT_SECURITY) | ||
317 | */ | ||
318 | enum { | ||
319 | OSD_ATTR_OS_POLICY_ACCESS_TAG = 0x40000001, /* 4 */ | ||
320 | }; | ||
321 | |||
322 | struct object_security_attributes_page { | ||
323 | struct osd_attr_page_header hdr; /* id=C+5/5, size=4 */ | ||
324 | __be32 policy_access_tag; | ||
325 | } __packed; | ||
326 | |||
327 | #endif /*ndef __OSD_ATTRIBUTES_H__*/ | ||
diff --git a/include/scsi/osd_initiator.h b/include/scsi/osd_initiator.h new file mode 100644 index 000000000000..b24d9616eb46 --- /dev/null +++ b/include/scsi/osd_initiator.h | |||
@@ -0,0 +1,433 @@ | |||
1 | /* | ||
2 | * osd_initiator.h - OSD initiator API definition | ||
3 | * | ||
4 | * Copyright (C) 2008 Panasas Inc. All rights reserved. | ||
5 | * | ||
6 | * Authors: | ||
7 | * Boaz Harrosh <bharrosh@panasas.com> | ||
8 | * Benny Halevy <bhalevy@panasas.com> | ||
9 | * | ||
10 | * This program is free software; you can redistribute it and/or modify | ||
11 | * it under the terms of the GNU General Public License version 2 | ||
12 | * | ||
13 | */ | ||
14 | #ifndef __OSD_INITIATOR_H__ | ||
15 | #define __OSD_INITIATOR_H__ | ||
16 | |||
17 | #include "osd_protocol.h" | ||
18 | #include "osd_types.h" | ||
19 | |||
20 | #include <linux/blkdev.h> | ||
21 | |||
22 | /* Note: "NI" in comments below means "Not Implemented yet" */ | ||
23 | |||
24 | /* Configure of code: | ||
25 | * #undef if you *don't* want OSD v1 support in runtime. | ||
26 | * If #defined the initiator will dynamically configure to encode OSD v1 | ||
27 | * CDB's if the target is detected to be OSD v1 only. | ||
28 | * OSD v2 only commands, options, and attributes will be ignored if target | ||
29 | * is v1 only. | ||
30 | * If #defined will result in bigger/slower code (OK Slower maybe not) | ||
31 | * Q: Should this be CONFIG_SCSI_OSD_VER1_SUPPORT and set from Kconfig? | ||
32 | */ | ||
33 | #define OSD_VER1_SUPPORT y | ||
34 | |||
35 | enum osd_std_version { | ||
36 | OSD_VER_NONE = 0, | ||
37 | OSD_VER1 = 1, | ||
38 | OSD_VER2 = 2, | ||
39 | }; | ||
40 | |||
41 | /* | ||
42 | * Object-based Storage Device. | ||
43 | * This object represents an OSD device. | ||
44 | * It is not a full linux device in any way. It is only | ||
45 | * a place to hang resources associated with a Linux | ||
46 | * request Q and some default properties. | ||
47 | */ | ||
48 | struct osd_dev { | ||
49 | struct scsi_device *scsi_device; | ||
50 | unsigned def_timeout; | ||
51 | |||
52 | #ifdef OSD_VER1_SUPPORT | ||
53 | enum osd_std_version version; | ||
54 | #endif | ||
55 | }; | ||
56 | |||
57 | /* Retrieve/return osd_dev(s) for use by Kernel clients */ | ||
58 | struct osd_dev *osduld_path_lookup(const char *dev_name); /*Use IS_ERR/ERR_PTR*/ | ||
59 | void osduld_put_device(struct osd_dev *od); | ||
60 | |||
61 | /* Add/remove test ioctls from external modules */ | ||
62 | typedef int (do_test_fn)(struct osd_dev *od, unsigned cmd, unsigned long arg); | ||
63 | int osduld_register_test(unsigned ioctl, do_test_fn *do_test); | ||
64 | void osduld_unregister_test(unsigned ioctl); | ||
65 | |||
66 | /* These are called by uld at probe time */ | ||
67 | void osd_dev_init(struct osd_dev *od, struct scsi_device *scsi_device); | ||
68 | void osd_dev_fini(struct osd_dev *od); | ||
69 | |||
70 | /* some hi level device operations */ | ||
71 | int osd_auto_detect_ver(struct osd_dev *od, void *caps); /* GFP_KERNEL */ | ||
72 | |||
73 | /* we might want to use function vector in the future */ | ||
74 | static inline void osd_dev_set_ver(struct osd_dev *od, enum osd_std_version v) | ||
75 | { | ||
76 | #ifdef OSD_VER1_SUPPORT | ||
77 | od->version = v; | ||
78 | #endif | ||
79 | } | ||
80 | |||
81 | struct osd_request; | ||
82 | typedef void (osd_req_done_fn)(struct osd_request *or, void *private); | ||
83 | |||
84 | struct osd_request { | ||
85 | struct osd_cdb cdb; | ||
86 | struct osd_data_out_integrity_info out_data_integ; | ||
87 | struct osd_data_in_integrity_info in_data_integ; | ||
88 | |||
89 | struct osd_dev *osd_dev; | ||
90 | struct request *request; | ||
91 | |||
92 | struct _osd_req_data_segment { | ||
93 | void *buff; | ||
94 | unsigned alloc_size; /* 0 here means: don't call kfree */ | ||
95 | unsigned total_bytes; | ||
96 | } set_attr, enc_get_attr, get_attr; | ||
97 | |||
98 | struct _osd_io_info { | ||
99 | struct bio *bio; | ||
100 | u64 total_bytes; | ||
101 | struct request *req; | ||
102 | struct _osd_req_data_segment *last_seg; | ||
103 | u8 *pad_buff; | ||
104 | } out, in; | ||
105 | |||
106 | gfp_t alloc_flags; | ||
107 | unsigned timeout; | ||
108 | unsigned retries; | ||
109 | u8 sense[OSD_MAX_SENSE_LEN]; | ||
110 | enum osd_attributes_mode attributes_mode; | ||
111 | |||
112 | osd_req_done_fn *async_done; | ||
113 | void *async_private; | ||
114 | int async_error; | ||
115 | }; | ||
116 | |||
117 | /* OSD Version control */ | ||
118 | static inline bool osd_req_is_ver1(struct osd_request *or) | ||
119 | { | ||
120 | #ifdef OSD_VER1_SUPPORT | ||
121 | return or->osd_dev->version == OSD_VER1; | ||
122 | #else | ||
123 | return false; | ||
124 | #endif | ||
125 | } | ||
126 | |||
127 | /* | ||
128 | * How to use the osd library: | ||
129 | * | ||
130 | * osd_start_request | ||
131 | * Allocates a request. | ||
132 | * | ||
133 | * osd_req_* | ||
134 | * Call one of, to encode the desired operation. | ||
135 | * | ||
136 | * osd_add_{get,set}_attr | ||
137 | * Optionally add attributes to the CDB, list or page mode. | ||
138 | * | ||
139 | * osd_finalize_request | ||
140 | * Computes final data out/in offsets and signs the request, | ||
141 | * making it ready for execution. | ||
142 | * | ||
143 | * osd_execute_request | ||
144 | * May be called to execute it through the block layer. Other wise submit | ||
145 | * the associated block request in some other way. | ||
146 | * | ||
147 | * After execution: | ||
148 | * osd_req_decode_sense | ||
149 | * Decodes sense information to verify execution results. | ||
150 | * | ||
151 | * osd_req_decode_get_attr | ||
152 | * Retrieve osd_add_get_attr_list() values if used. | ||
153 | * | ||
154 | * osd_end_request | ||
155 | * Must be called to deallocate the request. | ||
156 | */ | ||
157 | |||
158 | /** | ||
159 | * osd_start_request - Allocate and initialize an osd_request | ||
160 | * | ||
161 | * @osd_dev: OSD device that holds the scsi-device and default values | ||
162 | * that the request is associated with. | ||
163 | * @gfp: The allocation flags to use for request allocation, and all | ||
164 | * subsequent allocations. This will be stored at | ||
165 | * osd_request->alloc_flags, can be changed by user later | ||
166 | * | ||
167 | * Allocate osd_request and initialize all members to the | ||
168 | * default/initial state. | ||
169 | */ | ||
170 | struct osd_request *osd_start_request(struct osd_dev *od, gfp_t gfp); | ||
171 | |||
172 | enum osd_req_options { | ||
173 | OSD_REQ_FUA = 0x08, /* Force Unit Access */ | ||
174 | OSD_REQ_DPO = 0x10, /* Disable Page Out */ | ||
175 | |||
176 | OSD_REQ_BYPASS_TIMESTAMPS = 0x80, | ||
177 | }; | ||
178 | |||
179 | /** | ||
180 | * osd_finalize_request - Sign request and prepare request for execution | ||
181 | * | ||
182 | * @or: osd_request to prepare | ||
183 | * @options: combination of osd_req_options bit flags or 0. | ||
184 | * @cap: A Pointer to an OSD_CAP_LEN bytes buffer that is received from | ||
185 | * The security manager as capabilities for this cdb. | ||
186 | * @cap_key: The cryptographic key used to sign the cdb/data. Can be null | ||
187 | * if NOSEC is used. | ||
188 | * | ||
189 | * The actual request and bios are only allocated here, so are the get_attr | ||
190 | * buffers that will receive the returned attributes. Copy's @cap to cdb. | ||
191 | * Sign the cdb/data with @cap_key. | ||
192 | */ | ||
193 | int osd_finalize_request(struct osd_request *or, | ||
194 | u8 options, const void *cap, const u8 *cap_key); | ||
195 | |||
196 | /** | ||
197 | * osd_execute_request - Execute the request synchronously through block-layer | ||
198 | * | ||
199 | * @or: osd_request to Executed | ||
200 | * | ||
201 | * Calls blk_execute_rq to q the command and waits for completion. | ||
202 | */ | ||
203 | int osd_execute_request(struct osd_request *or); | ||
204 | |||
205 | /** | ||
206 | * osd_execute_request_async - Execute the request without waitting. | ||
207 | * | ||
208 | * @or: - osd_request to Executed | ||
209 | * @done: (Optional) - Called at end of execution | ||
210 | * @private: - Will be passed to @done function | ||
211 | * | ||
212 | * Calls blk_execute_rq_nowait to queue the command. When execution is done | ||
213 | * optionally calls @done with @private as parameter. @or->async_error will | ||
214 | * have the return code | ||
215 | */ | ||
216 | int osd_execute_request_async(struct osd_request *or, | ||
217 | osd_req_done_fn *done, void *private); | ||
218 | |||
219 | /** | ||
220 | * osd_req_decode_sense_full - Decode sense information after execution. | ||
221 | * | ||
222 | * @or: - osd_request to examine | ||
223 | * @osi - Recievs a more detailed error report information (optional). | ||
224 | * @silent - Do not print to dmsg (Even if enabled) | ||
225 | * @bad_obj_list - Some commands act on multiple objects. Failed objects will | ||
226 | * be recieved here (optional) | ||
227 | * @max_obj - Size of @bad_obj_list. | ||
228 | * @bad_attr_list - List of failing attributes (optional) | ||
229 | * @max_attr - Size of @bad_attr_list. | ||
230 | * | ||
231 | * After execution, sense + return code can be analyzed using this function. The | ||
232 | * return code is the final disposition on the error. So it is possible that a | ||
233 | * CHECK_CONDITION was returned from target but this will return NO_ERROR, for | ||
234 | * example on recovered errors. All parameters are optional if caller does | ||
235 | * not need any returned information. | ||
236 | * Note: This function will also dump the error to dmsg according to settings | ||
237 | * of the SCSI_OSD_DPRINT_SENSE Kconfig value. Set @silent if you know the | ||
238 | * command would routinely fail, to not spam the dmsg file. | ||
239 | */ | ||
240 | struct osd_sense_info { | ||
241 | int key; /* one of enum scsi_sense_keys */ | ||
242 | int additional_code ; /* enum osd_additional_sense_codes */ | ||
243 | union { /* Sense specific information */ | ||
244 | u16 sense_info; | ||
245 | u16 cdb_field_offset; /* scsi_invalid_field_in_cdb */ | ||
246 | }; | ||
247 | union { /* Command specific information */ | ||
248 | u64 command_info; | ||
249 | }; | ||
250 | |||
251 | u32 not_initiated_command_functions; /* osd_command_functions_bits */ | ||
252 | u32 completed_command_functions; /* osd_command_functions_bits */ | ||
253 | struct osd_obj_id obj; | ||
254 | struct osd_attr attr; | ||
255 | }; | ||
256 | |||
257 | int osd_req_decode_sense_full(struct osd_request *or, | ||
258 | struct osd_sense_info *osi, bool silent, | ||
259 | struct osd_obj_id *bad_obj_list, int max_obj, | ||
260 | struct osd_attr *bad_attr_list, int max_attr); | ||
261 | |||
262 | static inline int osd_req_decode_sense(struct osd_request *or, | ||
263 | struct osd_sense_info *osi) | ||
264 | { | ||
265 | return osd_req_decode_sense_full(or, osi, false, NULL, 0, NULL, 0); | ||
266 | } | ||
267 | |||
268 | /** | ||
269 | * osd_end_request - return osd_request to free store | ||
270 | * | ||
271 | * @or: osd_request to free | ||
272 | * | ||
273 | * Deallocate all osd_request resources (struct req's, BIOs, buffers, etc.) | ||
274 | */ | ||
275 | void osd_end_request(struct osd_request *or); | ||
276 | |||
277 | /* | ||
278 | * CDB Encoding | ||
279 | * | ||
280 | * Note: call only one of the following methods. | ||
281 | */ | ||
282 | |||
283 | /* | ||
284 | * Device commands | ||
285 | */ | ||
286 | void osd_req_set_master_seed_xchg(struct osd_request *or, ...);/* NI */ | ||
287 | void osd_req_set_master_key(struct osd_request *or, ...);/* NI */ | ||
288 | |||
289 | void osd_req_format(struct osd_request *or, u64 tot_capacity); | ||
290 | |||
291 | /* list all partitions | ||
292 | * @list header must be initialized to zero on first run. | ||
293 | * | ||
294 | * Call osd_is_obj_list_done() to find if we got the complete list. | ||
295 | */ | ||
296 | int osd_req_list_dev_partitions(struct osd_request *or, | ||
297 | osd_id initial_id, struct osd_obj_id_list *list, unsigned nelem); | ||
298 | |||
299 | void osd_req_flush_obsd(struct osd_request *or, | ||
300 | enum osd_options_flush_scope_values); | ||
301 | |||
302 | void osd_req_perform_scsi_command(struct osd_request *or, | ||
303 | const u8 *cdb, ...);/* NI */ | ||
304 | void osd_req_task_management(struct osd_request *or, ...);/* NI */ | ||
305 | |||
306 | /* | ||
307 | * Partition commands | ||
308 | */ | ||
309 | void osd_req_create_partition(struct osd_request *or, osd_id partition); | ||
310 | void osd_req_remove_partition(struct osd_request *or, osd_id partition); | ||
311 | |||
312 | void osd_req_set_partition_key(struct osd_request *or, | ||
313 | osd_id partition, u8 new_key_id[OSD_CRYPTO_KEYID_SIZE], | ||
314 | u8 seed[OSD_CRYPTO_SEED_SIZE]);/* NI */ | ||
315 | |||
316 | /* list all collections in the partition | ||
317 | * @list header must be init to zero on first run. | ||
318 | * | ||
319 | * Call osd_is_obj_list_done() to find if we got the complete list. | ||
320 | */ | ||
321 | int osd_req_list_partition_collections(struct osd_request *or, | ||
322 | osd_id partition, osd_id initial_id, struct osd_obj_id_list *list, | ||
323 | unsigned nelem); | ||
324 | |||
325 | /* list all objects in the partition | ||
326 | * @list header must be init to zero on first run. | ||
327 | * | ||
328 | * Call osd_is_obj_list_done() to find if we got the complete list. | ||
329 | */ | ||
330 | int osd_req_list_partition_objects(struct osd_request *or, | ||
331 | osd_id partition, osd_id initial_id, struct osd_obj_id_list *list, | ||
332 | unsigned nelem); | ||
333 | |||
334 | void osd_req_flush_partition(struct osd_request *or, | ||
335 | osd_id partition, enum osd_options_flush_scope_values); | ||
336 | |||
337 | /* | ||
338 | * Collection commands | ||
339 | */ | ||
340 | void osd_req_create_collection(struct osd_request *or, | ||
341 | const struct osd_obj_id *);/* NI */ | ||
342 | void osd_req_remove_collection(struct osd_request *or, | ||
343 | const struct osd_obj_id *);/* NI */ | ||
344 | |||
345 | /* list all objects in the collection */ | ||
346 | int osd_req_list_collection_objects(struct osd_request *or, | ||
347 | const struct osd_obj_id *, osd_id initial_id, | ||
348 | struct osd_obj_id_list *list, unsigned nelem); | ||
349 | |||
350 | /* V2 only filtered list of objects in the collection */ | ||
351 | void osd_req_query(struct osd_request *or, ...);/* NI */ | ||
352 | |||
353 | void osd_req_flush_collection(struct osd_request *or, | ||
354 | const struct osd_obj_id *, enum osd_options_flush_scope_values); | ||
355 | |||
356 | void osd_req_get_member_attrs(struct osd_request *or, ...);/* V2-only NI */ | ||
357 | void osd_req_set_member_attrs(struct osd_request *or, ...);/* V2-only NI */ | ||
358 | |||
359 | /* | ||
360 | * Object commands | ||
361 | */ | ||
362 | void osd_req_create_object(struct osd_request *or, struct osd_obj_id *); | ||
363 | void osd_req_remove_object(struct osd_request *or, struct osd_obj_id *); | ||
364 | |||
365 | void osd_req_write(struct osd_request *or, | ||
366 | const struct osd_obj_id *, struct bio *data_out, u64 offset); | ||
367 | void osd_req_append(struct osd_request *or, | ||
368 | const struct osd_obj_id *, struct bio *data_out);/* NI */ | ||
369 | void osd_req_create_write(struct osd_request *or, | ||
370 | const struct osd_obj_id *, struct bio *data_out, u64 offset);/* NI */ | ||
371 | void osd_req_clear(struct osd_request *or, | ||
372 | const struct osd_obj_id *, u64 offset, u64 len);/* NI */ | ||
373 | void osd_req_punch(struct osd_request *or, | ||
374 | const struct osd_obj_id *, u64 offset, u64 len);/* V2-only NI */ | ||
375 | |||
376 | void osd_req_flush_object(struct osd_request *or, | ||
377 | const struct osd_obj_id *, enum osd_options_flush_scope_values, | ||
378 | /*V2*/ u64 offset, /*V2*/ u64 len); | ||
379 | |||
380 | void osd_req_read(struct osd_request *or, | ||
381 | const struct osd_obj_id *, struct bio *data_in, u64 offset); | ||
382 | |||
383 | /* | ||
384 | * Root/Partition/Collection/Object Attributes commands | ||
385 | */ | ||
386 | |||
387 | /* get before set */ | ||
388 | void osd_req_get_attributes(struct osd_request *or, const struct osd_obj_id *); | ||
389 | |||
390 | /* set before get */ | ||
391 | void osd_req_set_attributes(struct osd_request *or, const struct osd_obj_id *); | ||
392 | |||
393 | /* | ||
394 | * Attributes appended to most commands | ||
395 | */ | ||
396 | |||
397 | /* Attributes List mode (or V2 CDB) */ | ||
398 | /* | ||
399 | * TODO: In ver2 if at finalize time only one attr was set and no gets, | ||
400 | * then the Attributes CDB mode is used automatically to save IO. | ||
401 | */ | ||
402 | |||
403 | /* set a list of attributes. */ | ||
404 | int osd_req_add_set_attr_list(struct osd_request *or, | ||
405 | const struct osd_attr *, unsigned nelem); | ||
406 | |||
407 | /* get a list of attributes */ | ||
408 | int osd_req_add_get_attr_list(struct osd_request *or, | ||
409 | const struct osd_attr *, unsigned nelem); | ||
410 | |||
411 | /* | ||
412 | * Attributes list decoding | ||
413 | * Must be called after osd_request.request was executed | ||
414 | * It is called in a loop to decode the returned get_attr | ||
415 | * (see osd_add_get_attr) | ||
416 | */ | ||
417 | int osd_req_decode_get_attr_list(struct osd_request *or, | ||
418 | struct osd_attr *, int *nelem, void **iterator); | ||
419 | |||
420 | /* Attributes Page mode */ | ||
421 | |||
422 | /* | ||
423 | * Read an attribute page and optionally set one attribute | ||
424 | * | ||
425 | * Retrieves the attribute page directly to a user buffer. | ||
426 | * @attr_page_data shall stay valid until end of execution. | ||
427 | * See osd_attributes.h for common page structures | ||
428 | */ | ||
429 | int osd_req_add_get_attr_page(struct osd_request *or, | ||
430 | u32 page_id, void *attr_page_data, unsigned max_page_len, | ||
431 | const struct osd_attr *set_one); | ||
432 | |||
433 | #endif /* __OSD_LIB_H__ */ | ||
diff --git a/include/scsi/osd_protocol.h b/include/scsi/osd_protocol.h new file mode 100644 index 000000000000..cd3cbf764650 --- /dev/null +++ b/include/scsi/osd_protocol.h | |||
@@ -0,0 +1,579 @@ | |||
1 | /* | ||
2 | * osd_protocol.h - OSD T10 standard C definitions. | ||
3 | * | ||
4 | * Copyright (C) 2008 Panasas Inc. All rights reserved. | ||
5 | * | ||
6 | * Authors: | ||
7 | * Boaz Harrosh <bharrosh@panasas.com> | ||
8 | * Benny Halevy <bhalevy@panasas.com> | ||
9 | * | ||
10 | * This program is free software; you can redistribute it and/or modify | ||
11 | * it under the terms of the GNU General Public License version 2 | ||
12 | * | ||
13 | * This file contains types and constants that are defined by the protocol | ||
14 | * Note: All names and symbols are taken from the OSD standard's text. | ||
15 | */ | ||
16 | #ifndef __OSD_PROTOCOL_H__ | ||
17 | #define __OSD_PROTOCOL_H__ | ||
18 | |||
19 | #include <linux/types.h> | ||
20 | #include <asm/unaligned.h> | ||
21 | #include <scsi/scsi.h> | ||
22 | |||
23 | enum { | ||
24 | OSDv1_ADDITIONAL_CDB_LENGTH = 192, | ||
25 | OSDv1_TOTAL_CDB_LEN = OSDv1_ADDITIONAL_CDB_LENGTH + 8, | ||
26 | OSDv1_CAP_LEN = 80, | ||
27 | /* Latest supported version */ | ||
28 | /* OSD_ADDITIONAL_CDB_LENGTH = 216,*/ | ||
29 | OSD_ADDITIONAL_CDB_LENGTH = | ||
30 | OSDv1_ADDITIONAL_CDB_LENGTH, /* FIXME: Pete rev-001 sup */ | ||
31 | OSD_TOTAL_CDB_LEN = OSD_ADDITIONAL_CDB_LENGTH + 8, | ||
32 | /* OSD_CAP_LEN = 104,*/ | ||
33 | OSD_CAP_LEN = OSDv1_CAP_LEN,/* FIXME: Pete rev-001 sup */ | ||
34 | |||
35 | OSD_SYSTEMID_LEN = 20, | ||
36 | OSD_CRYPTO_KEYID_SIZE = 20, | ||
37 | /*FIXME: OSDv2_CRYPTO_KEYID_SIZE = 32,*/ | ||
38 | OSD_CRYPTO_SEED_SIZE = 4, | ||
39 | OSD_CRYPTO_NONCE_SIZE = 12, | ||
40 | OSD_MAX_SENSE_LEN = 252, /* from SPC-3 */ | ||
41 | |||
42 | OSD_PARTITION_FIRST_ID = 0x10000, | ||
43 | OSD_OBJECT_FIRST_ID = 0x10000, | ||
44 | }; | ||
45 | |||
46 | /* (osd-r10 5.2.4) | ||
47 | * osd2r03: 5.2.3 Caching control bits | ||
48 | */ | ||
49 | enum osd_options_byte { | ||
50 | OSD_CDB_FUA = 0x08, /* Force Unit Access */ | ||
51 | OSD_CDB_DPO = 0x10, /* Disable Page Out */ | ||
52 | }; | ||
53 | |||
54 | /* | ||
55 | * osd2r03: 5.2.5 Isolation. | ||
56 | * First 3 bits, V2-only. | ||
57 | * Also for attr 110h "default isolation method" at Root Information page | ||
58 | */ | ||
59 | enum osd_options_byte_isolation { | ||
60 | OSD_ISOLATION_DEFAULT = 0, | ||
61 | OSD_ISOLATION_NONE = 1, | ||
62 | OSD_ISOLATION_STRICT = 2, | ||
63 | OSD_ISOLATION_RANGE = 4, | ||
64 | OSD_ISOLATION_FUNCTIONAL = 5, | ||
65 | OSD_ISOLATION_VENDOR = 7, | ||
66 | }; | ||
67 | |||
68 | /* (osd-r10: 6.7) | ||
69 | * osd2r03: 6.8 FLUSH, FLUSH COLLECTION, FLUSH OSD, FLUSH PARTITION | ||
70 | */ | ||
71 | enum osd_options_flush_scope_values { | ||
72 | OSD_CDB_FLUSH_ALL = 0, | ||
73 | OSD_CDB_FLUSH_ATTR_ONLY = 1, | ||
74 | |||
75 | OSD_CDB_FLUSH_ALL_RECURSIVE = 2, | ||
76 | /* V2-only */ | ||
77 | OSD_CDB_FLUSH_ALL_RANGE = 2, | ||
78 | }; | ||
79 | |||
80 | /* osd2r03: 5.2.10 Timestamps control */ | ||
81 | enum { | ||
82 | OSD_CDB_NORMAL_TIMESTAMPS = 0, | ||
83 | OSD_CDB_BYPASS_TIMESTAMPS = 0x7f, | ||
84 | }; | ||
85 | |||
86 | /* (osd-r10: 5.2.2.1) | ||
87 | * osd2r03: 5.2.4.1 Get and set attributes CDB format selection | ||
88 | * 2 bits at second nibble of command_specific_options byte | ||
89 | */ | ||
90 | enum osd_attributes_mode { | ||
91 | /* V2-only */ | ||
92 | OSD_CDB_SET_ONE_ATTR = 0x10, | ||
93 | |||
94 | OSD_CDB_GET_ATTR_PAGE_SET_ONE = 0x20, | ||
95 | OSD_CDB_GET_SET_ATTR_LISTS = 0x30, | ||
96 | |||
97 | OSD_CDB_GET_SET_ATTR_MASK = 0x30, | ||
98 | }; | ||
99 | |||
100 | /* (osd-r10: 4.12.5) | ||
101 | * osd2r03: 4.14.5 Data-In and Data-Out buffer offsets | ||
102 | * byte offset = mantissa * (2^(exponent+8)) | ||
103 | * struct { | ||
104 | * unsigned mantissa: 28; | ||
105 | * int exponent: 04; | ||
106 | * } | ||
107 | */ | ||
108 | typedef __be32 __bitwise osd_cdb_offset; | ||
109 | |||
110 | enum { | ||
111 | OSD_OFFSET_UNUSED = 0xFFFFFFFF, | ||
112 | OSD_OFFSET_MAX_BITS = 28, | ||
113 | |||
114 | OSDv1_OFFSET_MIN_SHIFT = 8, | ||
115 | OSD_OFFSET_MIN_SHIFT = 3, | ||
116 | OSD_OFFSET_MAX_SHIFT = 16, | ||
117 | }; | ||
118 | |||
119 | /* Return the smallest allowed encoded offset that contains @offset. | ||
120 | * | ||
121 | * The actual encoded offset returned is @offset + *padding. | ||
122 | * (up to max_shift, non-inclusive) | ||
123 | */ | ||
124 | osd_cdb_offset __osd_encode_offset(u64 offset, unsigned *padding, | ||
125 | int min_shift, int max_shift); | ||
126 | |||
127 | /* Minimum alignment is 256 bytes | ||
128 | * Note: Seems from std v1 that exponent can be from 0+8 to 0xE+8 (inclusive) | ||
129 | * which is 8 to 23 but IBM code restricts it to 16, so be it. | ||
130 | */ | ||
131 | static inline osd_cdb_offset osd_encode_offset_v1(u64 offset, unsigned *padding) | ||
132 | { | ||
133 | return __osd_encode_offset(offset, padding, | ||
134 | OSDv1_OFFSET_MIN_SHIFT, OSD_OFFSET_MAX_SHIFT); | ||
135 | } | ||
136 | |||
137 | /* Minimum 8 bytes alignment | ||
138 | * Same as v1 but since exponent can be signed than a less than | ||
139 | * 256 alignment can be reached with small offsets (<2GB) | ||
140 | */ | ||
141 | static inline osd_cdb_offset osd_encode_offset_v2(u64 offset, unsigned *padding) | ||
142 | { | ||
143 | return __osd_encode_offset(offset, padding, | ||
144 | OSD_OFFSET_MIN_SHIFT, OSD_OFFSET_MAX_SHIFT); | ||
145 | } | ||
146 | |||
147 | /* osd2r03: 5.2.1 Overview */ | ||
148 | struct osd_cdb_head { | ||
149 | struct scsi_varlen_cdb_hdr varlen_cdb; | ||
150 | /*10*/ u8 options; | ||
151 | u8 command_specific_options; | ||
152 | u8 timestamp_control; | ||
153 | /*13*/ u8 reserved1[3]; | ||
154 | /*16*/ __be64 partition; | ||
155 | /*24*/ __be64 object; | ||
156 | /*32*/ union { /* V1 vs V2 alignment differences */ | ||
157 | struct __osdv1_cdb_addr_len { | ||
158 | /*32*/ __be32 list_identifier;/* Rarely used */ | ||
159 | /*36*/ __be64 length; | ||
160 | /*44*/ __be64 start_address; | ||
161 | } __packed v1; | ||
162 | |||
163 | struct __osdv2_cdb_addr_len { | ||
164 | /* called allocation_length in some commands */ | ||
165 | /*32*/ __be64 length; | ||
166 | /*40*/ __be64 start_address; | ||
167 | /*48*/ __be32 list_identifier;/* Rarely used */ | ||
168 | } __packed v2; | ||
169 | }; | ||
170 | /*52*/ union { /* selected attributes mode Page/List/Single */ | ||
171 | struct osd_attributes_page_mode { | ||
172 | /*52*/ __be32 get_attr_page; | ||
173 | /*56*/ __be32 get_attr_alloc_length; | ||
174 | /*60*/ osd_cdb_offset get_attr_offset; | ||
175 | |||
176 | /*64*/ __be32 set_attr_page; | ||
177 | /*68*/ __be32 set_attr_id; | ||
178 | /*72*/ __be32 set_attr_length; | ||
179 | /*76*/ osd_cdb_offset set_attr_offset; | ||
180 | /*80*/ } __packed attrs_page; | ||
181 | |||
182 | struct osd_attributes_list_mode { | ||
183 | /*52*/ __be32 get_attr_desc_bytes; | ||
184 | /*56*/ osd_cdb_offset get_attr_desc_offset; | ||
185 | |||
186 | /*60*/ __be32 get_attr_alloc_length; | ||
187 | /*64*/ osd_cdb_offset get_attr_offset; | ||
188 | |||
189 | /*68*/ __be32 set_attr_bytes; | ||
190 | /*72*/ osd_cdb_offset set_attr_offset; | ||
191 | __be32 not_used; | ||
192 | /*80*/ } __packed attrs_list; | ||
193 | |||
194 | /* osd2r03:5.2.4.2 Set one attribute value using CDB fields */ | ||
195 | struct osd_attributes_cdb_mode { | ||
196 | /*52*/ __be32 set_attr_page; | ||
197 | /*56*/ __be32 set_attr_id; | ||
198 | /*60*/ __be16 set_attr_len; | ||
199 | /*62*/ u8 set_attr_val[18]; | ||
200 | /*80*/ } __packed attrs_cdb; | ||
201 | /*52*/ u8 get_set_attributes_parameters[28]; | ||
202 | }; | ||
203 | } __packed; | ||
204 | /*80*/ | ||
205 | |||
206 | /*160 v1*/ | ||
207 | /*184 v2*/ | ||
208 | struct osd_security_parameters { | ||
209 | /*160*/u8 integrity_check_value[OSD_CRYPTO_KEYID_SIZE]; | ||
210 | /*180*/u8 request_nonce[OSD_CRYPTO_NONCE_SIZE]; | ||
211 | /*192*/osd_cdb_offset data_in_integrity_check_offset; | ||
212 | /*196*/osd_cdb_offset data_out_integrity_check_offset; | ||
213 | } __packed; | ||
214 | /*200 v1*/ | ||
215 | /*224 v2*/ | ||
216 | |||
217 | /* FIXME: osdv2_security_parameters */ | ||
218 | |||
219 | struct osdv1_cdb { | ||
220 | struct osd_cdb_head h; | ||
221 | u8 caps[OSDv1_CAP_LEN]; | ||
222 | struct osd_security_parameters sec_params; | ||
223 | } __packed; | ||
224 | |||
225 | struct osdv2_cdb { | ||
226 | struct osd_cdb_head h; | ||
227 | u8 caps[OSD_CAP_LEN]; | ||
228 | struct osd_security_parameters sec_params; | ||
229 | /* FIXME: osdv2_security_parameters */ | ||
230 | } __packed; | ||
231 | |||
232 | struct osd_cdb { | ||
233 | union { | ||
234 | struct osdv1_cdb v1; | ||
235 | struct osdv2_cdb v2; | ||
236 | u8 buff[OSD_TOTAL_CDB_LEN]; | ||
237 | }; | ||
238 | } __packed; | ||
239 | |||
240 | static inline struct osd_cdb_head *osd_cdb_head(struct osd_cdb *ocdb) | ||
241 | { | ||
242 | return (struct osd_cdb_head *)ocdb->buff; | ||
243 | } | ||
244 | |||
245 | /* define both version actions | ||
246 | * Ex name = FORMAT_OSD we have OSD_ACT_FORMAT_OSD && OSDv1_ACT_FORMAT_OSD | ||
247 | */ | ||
248 | #define OSD_ACT___(Name, Num) \ | ||
249 | OSD_ACT_##Name = __constant_cpu_to_be16(0x8880 + Num), \ | ||
250 | OSDv1_ACT_##Name = __constant_cpu_to_be16(0x8800 + Num), | ||
251 | |||
252 | /* V2 only actions */ | ||
253 | #define OSD_ACT_V2(Name, Num) \ | ||
254 | OSD_ACT_##Name = __constant_cpu_to_be16(0x8880 + Num), | ||
255 | |||
256 | #define OSD_ACT_V1_V2(Name, Num1, Num2) \ | ||
257 | OSD_ACT_##Name = __constant_cpu_to_be16(Num2), \ | ||
258 | OSDv1_ACT_##Name = __constant_cpu_to_be16(Num1), | ||
259 | |||
260 | enum osd_service_actions { | ||
261 | OSD_ACT_V2(OBJECT_STRUCTURE_CHECK, 0x00) | ||
262 | OSD_ACT___(FORMAT_OSD, 0x01) | ||
263 | OSD_ACT___(CREATE, 0x02) | ||
264 | OSD_ACT___(LIST, 0x03) | ||
265 | OSD_ACT_V2(PUNCH, 0x04) | ||
266 | OSD_ACT___(READ, 0x05) | ||
267 | OSD_ACT___(WRITE, 0x06) | ||
268 | OSD_ACT___(APPEND, 0x07) | ||
269 | OSD_ACT___(FLUSH, 0x08) | ||
270 | OSD_ACT_V2(CLEAR, 0x09) | ||
271 | OSD_ACT___(REMOVE, 0x0A) | ||
272 | OSD_ACT___(CREATE_PARTITION, 0x0B) | ||
273 | OSD_ACT___(REMOVE_PARTITION, 0x0C) | ||
274 | OSD_ACT___(GET_ATTRIBUTES, 0x0E) | ||
275 | OSD_ACT___(SET_ATTRIBUTES, 0x0F) | ||
276 | OSD_ACT___(CREATE_AND_WRITE, 0x12) | ||
277 | OSD_ACT___(CREATE_COLLECTION, 0x15) | ||
278 | OSD_ACT___(REMOVE_COLLECTION, 0x16) | ||
279 | OSD_ACT___(LIST_COLLECTION, 0x17) | ||
280 | OSD_ACT___(SET_KEY, 0x18) | ||
281 | OSD_ACT___(SET_MASTER_KEY, 0x19) | ||
282 | OSD_ACT___(FLUSH_COLLECTION, 0x1A) | ||
283 | OSD_ACT___(FLUSH_PARTITION, 0x1B) | ||
284 | OSD_ACT___(FLUSH_OSD, 0x1C) | ||
285 | |||
286 | OSD_ACT_V2(QUERY, 0x20) | ||
287 | OSD_ACT_V2(REMOVE_MEMBER_OBJECTS, 0x21) | ||
288 | OSD_ACT_V2(GET_MEMBER_ATTRIBUTES, 0x22) | ||
289 | OSD_ACT_V2(SET_MEMBER_ATTRIBUTES, 0x23) | ||
290 | OSD_ACT_V2(READ_MAP, 0x31) | ||
291 | |||
292 | OSD_ACT_V1_V2(PERFORM_SCSI_COMMAND, 0x8F7E, 0x8F7C) | ||
293 | OSD_ACT_V1_V2(SCSI_TASK_MANAGEMENT, 0x8F7F, 0x8F7D) | ||
294 | /* 0x8F80 to 0x8FFF are Vendor specific */ | ||
295 | }; | ||
296 | |||
297 | /* osd2r03: 7.1.3.2 List entry format for retrieving attributes */ | ||
298 | struct osd_attributes_list_attrid { | ||
299 | __be32 attr_page; | ||
300 | __be32 attr_id; | ||
301 | } __packed; | ||
302 | |||
303 | /* | ||
304 | * osd2r03: 7.1.3.3 List entry format for retrieved attributes and | ||
305 | * for setting attributes | ||
306 | * NOTE: v2 is 8-bytes aligned, v1 is not aligned. | ||
307 | */ | ||
308 | struct osd_attributes_list_element { | ||
309 | __be32 attr_page; | ||
310 | __be32 attr_id; | ||
311 | __be16 attr_bytes; | ||
312 | u8 attr_val[0]; | ||
313 | } __packed; | ||
314 | |||
315 | enum { | ||
316 | OSDv1_ATTRIBUTES_ELEM_ALIGN = 1, | ||
317 | OSD_ATTRIBUTES_ELEM_ALIGN = 8, | ||
318 | }; | ||
319 | |||
320 | enum { | ||
321 | OSD_ATTR_LIST_ALL_PAGES = 0xFFFFFFFF, | ||
322 | OSD_ATTR_LIST_ALL_IN_PAGE = 0xFFFFFFFF, | ||
323 | }; | ||
324 | |||
325 | static inline unsigned osdv1_attr_list_elem_size(unsigned len) | ||
326 | { | ||
327 | return ALIGN(len + sizeof(struct osd_attributes_list_element), | ||
328 | OSDv1_ATTRIBUTES_ELEM_ALIGN); | ||
329 | } | ||
330 | |||
331 | static inline unsigned osdv2_attr_list_elem_size(unsigned len) | ||
332 | { | ||
333 | return ALIGN(len + sizeof(struct osd_attributes_list_element), | ||
334 | OSD_ATTRIBUTES_ELEM_ALIGN); | ||
335 | } | ||
336 | |||
337 | /* | ||
338 | * osd2r03: 7.1.3 OSD attributes lists (Table 184) — List type values | ||
339 | */ | ||
340 | enum osd_attr_list_types { | ||
341 | OSD_ATTR_LIST_GET = 0x1, /* descriptors only */ | ||
342 | OSD_ATTR_LIST_SET_RETRIEVE = 0x9, /*descriptors/values variable-length*/ | ||
343 | OSD_V2_ATTR_LIST_MULTIPLE = 0xE, /* ver2, Multiple Objects lists*/ | ||
344 | OSD_V1_ATTR_LIST_CREATE_MULTIPLE = 0xF,/*ver1, used by create_multple*/ | ||
345 | }; | ||
346 | |||
347 | /* osd2r03: 7.1.3.4 Multi-object retrieved attributes format */ | ||
348 | struct osd_attributes_list_multi_header { | ||
349 | __be64 object_id; | ||
350 | u8 object_type; /* object_type enum below */ | ||
351 | u8 reserved[5]; | ||
352 | __be16 list_bytes; | ||
353 | /* followed by struct osd_attributes_list_element's */ | ||
354 | }; | ||
355 | |||
356 | struct osdv1_attributes_list_header { | ||
357 | u8 type; /* low 4-bit only */ | ||
358 | u8 pad; | ||
359 | __be16 list_bytes; /* Initiator shall set to Zero. Only set by target */ | ||
360 | /* | ||
361 | * type=9 followed by struct osd_attributes_list_element's | ||
362 | * type=E followed by struct osd_attributes_list_multi_header's | ||
363 | */ | ||
364 | } __packed; | ||
365 | |||
366 | static inline unsigned osdv1_list_size(struct osdv1_attributes_list_header *h) | ||
367 | { | ||
368 | return be16_to_cpu(h->list_bytes); | ||
369 | } | ||
370 | |||
371 | struct osdv2_attributes_list_header { | ||
372 | u8 type; /* lower 4-bits only */ | ||
373 | u8 pad[3]; | ||
374 | /*4*/ __be32 list_bytes; /* Initiator shall set to zero. Only set by target */ | ||
375 | /* | ||
376 | * type=9 followed by struct osd_attributes_list_element's | ||
377 | * type=E followed by struct osd_attributes_list_multi_header's | ||
378 | */ | ||
379 | } __packed; | ||
380 | |||
381 | static inline unsigned osdv2_list_size(struct osdv2_attributes_list_header *h) | ||
382 | { | ||
383 | return be32_to_cpu(h->list_bytes); | ||
384 | } | ||
385 | |||
386 | /* (osd-r10 6.13) | ||
387 | * osd2r03: 6.15 LIST (Table 79) LIST command parameter data. | ||
388 | * for root_lstchg below | ||
389 | */ | ||
390 | enum { | ||
391 | OSD_OBJ_ID_LIST_PAR = 0x1, /* V1-only. Not used in V2 */ | ||
392 | OSD_OBJ_ID_LIST_LSTCHG = 0x2, | ||
393 | }; | ||
394 | |||
395 | /* | ||
396 | * osd2r03: 6.15.2 LIST command parameter data | ||
397 | * (Also for LIST COLLECTION) | ||
398 | */ | ||
399 | struct osd_obj_id_list { | ||
400 | __be64 list_bytes; /* bytes in list excluding list_bytes (-8) */ | ||
401 | __be64 continuation_id; | ||
402 | __be32 list_identifier; | ||
403 | u8 pad[3]; | ||
404 | u8 root_lstchg; | ||
405 | __be64 object_ids[0]; | ||
406 | } __packed; | ||
407 | |||
408 | static inline bool osd_is_obj_list_done(struct osd_obj_id_list *list, | ||
409 | bool *is_changed) | ||
410 | { | ||
411 | *is_changed = (0 != (list->root_lstchg & OSD_OBJ_ID_LIST_LSTCHG)); | ||
412 | return 0 != list->continuation_id; | ||
413 | } | ||
414 | |||
415 | /* | ||
416 | * osd2r03: 4.12.4.5 The ALLDATA security method | ||
417 | */ | ||
418 | struct osd_data_out_integrity_info { | ||
419 | __be64 data_bytes; | ||
420 | __be64 set_attributes_bytes; | ||
421 | __be64 get_attributes_bytes; | ||
422 | __be64 integrity_check_value; | ||
423 | } __packed; | ||
424 | |||
425 | struct osd_data_in_integrity_info { | ||
426 | __be64 data_bytes; | ||
427 | __be64 retrieved_attributes_bytes; | ||
428 | __be64 integrity_check_value; | ||
429 | } __packed; | ||
430 | |||
431 | struct osd_timestamp { | ||
432 | u8 time[6]; /* number of milliseconds since 1/1/1970 UT (big endian) */ | ||
433 | } __packed; | ||
434 | /* FIXME: define helper functions to convert to/from osd time format */ | ||
435 | |||
436 | /* | ||
437 | * Capability & Security definitions | ||
438 | * osd2r03: 4.11.2.2 Capability format | ||
439 | * osd2r03: 5.2.8 Security parameters | ||
440 | */ | ||
441 | |||
442 | struct osd_key_identifier { | ||
443 | u8 id[7]; /* if you know why 7 please email bharrosh@panasas.com */ | ||
444 | } __packed; | ||
445 | |||
446 | /* for osd_capability.format */ | ||
447 | enum { | ||
448 | OSD_SEC_CAP_FORMAT_NO_CAPS = 0, | ||
449 | OSD_SEC_CAP_FORMAT_VER1 = 1, | ||
450 | OSD_SEC_CAP_FORMAT_VER2 = 2, | ||
451 | }; | ||
452 | |||
453 | /* security_method */ | ||
454 | enum { | ||
455 | OSD_SEC_NOSEC = 0, | ||
456 | OSD_SEC_CAPKEY = 1, | ||
457 | OSD_SEC_CMDRSP = 2, | ||
458 | OSD_SEC_ALLDATA = 3, | ||
459 | }; | ||
460 | |||
461 | enum object_type { | ||
462 | OSD_SEC_OBJ_ROOT = 0x1, | ||
463 | OSD_SEC_OBJ_PARTITION = 0x2, | ||
464 | OSD_SEC_OBJ_COLLECTION = 0x40, | ||
465 | OSD_SEC_OBJ_USER = 0x80, | ||
466 | }; | ||
467 | |||
468 | enum osd_capability_bit_masks { | ||
469 | OSD_SEC_CAP_APPEND = BIT(0), | ||
470 | OSD_SEC_CAP_OBJ_MGMT = BIT(1), | ||
471 | OSD_SEC_CAP_REMOVE = BIT(2), | ||
472 | OSD_SEC_CAP_CREATE = BIT(3), | ||
473 | OSD_SEC_CAP_SET_ATTR = BIT(4), | ||
474 | OSD_SEC_CAP_GET_ATTR = BIT(5), | ||
475 | OSD_SEC_CAP_WRITE = BIT(6), | ||
476 | OSD_SEC_CAP_READ = BIT(7), | ||
477 | |||
478 | OSD_SEC_CAP_NONE1 = BIT(8), | ||
479 | OSD_SEC_CAP_NONE2 = BIT(9), | ||
480 | OSD_SEC_CAP_NONE3 = BIT(10), | ||
481 | OSD_SEC_CAP_QUERY = BIT(11), /*v2 only*/ | ||
482 | OSD_SEC_CAP_M_OBJECT = BIT(12), /*v2 only*/ | ||
483 | OSD_SEC_CAP_POL_SEC = BIT(13), | ||
484 | OSD_SEC_CAP_GLOBAL = BIT(14), | ||
485 | OSD_SEC_CAP_DEV_MGMT = BIT(15), | ||
486 | }; | ||
487 | |||
488 | /* for object_descriptor_type (hi nibble used) */ | ||
489 | enum { | ||
490 | OSD_SEC_OBJ_DESC_NONE = 0, /* Not allowed */ | ||
491 | OSD_SEC_OBJ_DESC_OBJ = 1 << 4, /* v1: also collection */ | ||
492 | OSD_SEC_OBJ_DESC_PAR = 2 << 4, /* also root */ | ||
493 | OSD_SEC_OBJ_DESC_COL = 3 << 4, /* v2 only */ | ||
494 | }; | ||
495 | |||
496 | /* (osd-r10:4.9.2.2) | ||
497 | * osd2r03:4.11.2.2 Capability format | ||
498 | */ | ||
499 | struct osd_capability_head { | ||
500 | u8 format; /* low nibble */ | ||
501 | u8 integrity_algorithm__key_version; /* MAKE_BYTE(integ_alg, key_ver) */ | ||
502 | u8 security_method; | ||
503 | u8 reserved1; | ||
504 | /*04*/ struct osd_timestamp expiration_time; | ||
505 | /*10*/ u8 audit[20]; | ||
506 | /*30*/ u8 discriminator[12]; | ||
507 | /*42*/ struct osd_timestamp object_created_time; | ||
508 | /*48*/ u8 object_type; | ||
509 | /*49*/ u8 permissions_bit_mask[5]; | ||
510 | /*54*/ u8 reserved2; | ||
511 | /*55*/ u8 object_descriptor_type; /* high nibble */ | ||
512 | } __packed; | ||
513 | |||
514 | /*56 v1*/ | ||
515 | struct osdv1_cap_object_descriptor { | ||
516 | union { | ||
517 | struct { | ||
518 | /*56*/ __be32 policy_access_tag; | ||
519 | /*60*/ __be64 allowed_partition_id; | ||
520 | /*68*/ __be64 allowed_object_id; | ||
521 | /*76*/ __be32 reserved; | ||
522 | } __packed obj_desc; | ||
523 | |||
524 | /*56*/ u8 object_descriptor[24]; | ||
525 | }; | ||
526 | } __packed; | ||
527 | /*80 v1*/ | ||
528 | |||
529 | /*56 v2*/ | ||
530 | struct osd_cap_object_descriptor { | ||
531 | union { | ||
532 | struct { | ||
533 | /*56*/ __be32 allowed_attributes_access; | ||
534 | /*60*/ __be32 policy_access_tag; | ||
535 | /*64*/ __be16 boot_epoch; | ||
536 | /*66*/ u8 reserved[6]; | ||
537 | /*72*/ __be64 allowed_partition_id; | ||
538 | /*80*/ __be64 allowed_object_id; | ||
539 | /*88*/ __be64 allowed_range_length; | ||
540 | /*96*/ __be64 allowed_range_start; | ||
541 | } __packed obj_desc; | ||
542 | |||
543 | /*56*/ u8 object_descriptor[48]; | ||
544 | }; | ||
545 | } __packed; | ||
546 | /*104 v2*/ | ||
547 | |||
548 | struct osdv1_capability { | ||
549 | struct osd_capability_head h; | ||
550 | struct osdv1_cap_object_descriptor od; | ||
551 | } __packed; | ||
552 | |||
553 | struct osd_capability { | ||
554 | struct osd_capability_head h; | ||
555 | /* struct osd_cap_object_descriptor od;*/ | ||
556 | struct osdv1_cap_object_descriptor od; /* FIXME: Pete rev-001 sup */ | ||
557 | } __packed; | ||
558 | |||
559 | /** | ||
560 | * osd_sec_set_caps - set cap-bits into the capabilities header | ||
561 | * | ||
562 | * @cap: The osd_capability_head to set cap bits to. | ||
563 | * @bit_mask: Use an ORed list of enum osd_capability_bit_masks values | ||
564 | * | ||
565 | * permissions_bit_mask is unaligned use below to set into caps | ||
566 | * in a version independent way | ||
567 | */ | ||
568 | static inline void osd_sec_set_caps(struct osd_capability_head *cap, | ||
569 | u16 bit_mask) | ||
570 | { | ||
571 | /* | ||
572 | *Note: The bits above are defined LE order this is because this way | ||
573 | * they can grow in the future to more then 16, and still retain | ||
574 | * there constant values. | ||
575 | */ | ||
576 | put_unaligned_le16(bit_mask, &cap->permissions_bit_mask); | ||
577 | } | ||
578 | |||
579 | #endif /* ndef __OSD_PROTOCOL_H__ */ | ||
diff --git a/include/scsi/osd_sec.h b/include/scsi/osd_sec.h new file mode 100644 index 000000000000..4c09fee8ae1e --- /dev/null +++ b/include/scsi/osd_sec.h | |||
@@ -0,0 +1,45 @@ | |||
1 | /* | ||
2 | * osd_sec.h - OSD security manager API | ||
3 | * | ||
4 | * Copyright (C) 2008 Panasas Inc. All rights reserved. | ||
5 | * | ||
6 | * Authors: | ||
7 | * Boaz Harrosh <bharrosh@panasas.com> | ||
8 | * Benny Halevy <bhalevy@panasas.com> | ||
9 | * | ||
10 | * This program is free software; you can redistribute it and/or modify | ||
11 | * it under the terms of the GNU General Public License version 2 | ||
12 | * | ||
13 | */ | ||
14 | #ifndef __OSD_SEC_H__ | ||
15 | #define __OSD_SEC_H__ | ||
16 | |||
17 | #include "osd_protocol.h" | ||
18 | #include "osd_types.h" | ||
19 | |||
20 | /* | ||
21 | * Contains types and constants of osd capabilities and security | ||
22 | * encoding/decoding. | ||
23 | * API is trying to keep security abstract so initiator of an object | ||
24 | * based pNFS client knows as little as possible about security and | ||
25 | * capabilities. It is the Server's osd-initiator place to know more. | ||
26 | * Also can be used by osd-target. | ||
27 | */ | ||
28 | void osd_sec_encode_caps(void *caps, ...);/* NI */ | ||
29 | void osd_sec_init_nosec_doall_caps(void *caps, | ||
30 | const struct osd_obj_id *obj, bool is_collection, const bool is_v1); | ||
31 | |||
32 | bool osd_is_sec_alldata(struct osd_security_parameters *sec_params); | ||
33 | |||
34 | /* Conditionally sign the CDB according to security setting in ocdb | ||
35 | * with cap_key */ | ||
36 | void osd_sec_sign_cdb(struct osd_cdb *ocdb, const u8 *cap_key); | ||
37 | |||
38 | /* Unconditionally sign the BIO data with cap_key. | ||
39 | * Check for osd_is_sec_alldata() was done prior to calling this. */ | ||
40 | void osd_sec_sign_data(void *data_integ, struct bio *bio, const u8 *cap_key); | ||
41 | |||
42 | /* Version independent copy of caps into the cdb */ | ||
43 | void osd_set_caps(struct osd_cdb *cdb, const void *caps); | ||
44 | |||
45 | #endif /* ndef __OSD_SEC_H__ */ | ||
diff --git a/include/scsi/osd_sense.h b/include/scsi/osd_sense.h new file mode 100644 index 000000000000..ff9b33c773c7 --- /dev/null +++ b/include/scsi/osd_sense.h | |||
@@ -0,0 +1,260 @@ | |||
1 | /* | ||
2 | * osd_sense.h - OSD Related sense handling definitions. | ||
3 | * | ||
4 | * Copyright (C) 2008 Panasas Inc. All rights reserved. | ||
5 | * | ||
6 | * Authors: | ||
7 | * Boaz Harrosh <bharrosh@panasas.com> | ||
8 | * Benny Halevy <bhalevy@panasas.com> | ||
9 | * | ||
10 | * This program is free software; you can redistribute it and/or modify | ||
11 | * it under the terms of the GNU General Public License version 2 | ||
12 | * | ||
13 | * This file contains types and constants that are defined by the protocol | ||
14 | * Note: All names and symbols are taken from the OSD standard's text. | ||
15 | */ | ||
16 | #ifndef __OSD_SENSE_H__ | ||
17 | #define __OSD_SENSE_H__ | ||
18 | |||
19 | #include <scsi/osd_protocol.h> | ||
20 | |||
21 | /* SPC3r23 4.5.6 Sense key and sense code definitions table 27 */ | ||
22 | enum scsi_sense_keys { | ||
23 | scsi_sk_no_sense = 0x0, | ||
24 | scsi_sk_recovered_error = 0x1, | ||
25 | scsi_sk_not_ready = 0x2, | ||
26 | scsi_sk_medium_error = 0x3, | ||
27 | scsi_sk_hardware_error = 0x4, | ||
28 | scsi_sk_illegal_request = 0x5, | ||
29 | scsi_sk_unit_attention = 0x6, | ||
30 | scsi_sk_data_protect = 0x7, | ||
31 | scsi_sk_blank_check = 0x8, | ||
32 | scsi_sk_vendor_specific = 0x9, | ||
33 | scsi_sk_copy_aborted = 0xa, | ||
34 | scsi_sk_aborted_command = 0xb, | ||
35 | scsi_sk_volume_overflow = 0xd, | ||
36 | scsi_sk_miscompare = 0xe, | ||
37 | scsi_sk_reserved = 0xf, | ||
38 | }; | ||
39 | |||
40 | /* SPC3r23 4.5.6 Sense key and sense code definitions table 28 */ | ||
41 | /* Note: only those which can be returned by an OSD target. Most of | ||
42 | * these errors are taken care of by the generic scsi layer. | ||
43 | */ | ||
44 | enum osd_additional_sense_codes { | ||
45 | scsi_no_additional_sense_information = 0x0000, | ||
46 | scsi_operation_in_progress = 0x0016, | ||
47 | scsi_cleaning_requested = 0x0017, | ||
48 | scsi_lunr_cause_not_reportable = 0x0400, | ||
49 | scsi_logical_unit_is_in_process_of_becoming_ready = 0x0401, | ||
50 | scsi_lunr_initializing_command_required = 0x0402, | ||
51 | scsi_lunr_manual_intervention_required = 0x0403, | ||
52 | scsi_lunr_operation_in_progress = 0x0407, | ||
53 | scsi_lunr_selftest_in_progress = 0x0409, | ||
54 | scsi_luna_asymmetric_access_state_transition = 0x040a, | ||
55 | scsi_luna_target_port_in_standby_state = 0x040b, | ||
56 | scsi_luna_target_port_in_unavailable_state = 0x040c, | ||
57 | scsi_lunr_notify_enable_spinup_required = 0x0411, | ||
58 | scsi_logical_unit_does_not_respond_to_selection = 0x0500, | ||
59 | scsi_logical_unit_communication_failure = 0x0800, | ||
60 | scsi_logical_unit_communication_timeout = 0x0801, | ||
61 | scsi_logical_unit_communication_parity_error = 0x0802, | ||
62 | scsi_error_log_overflow = 0x0a00, | ||
63 | scsi_warning = 0x0b00, | ||
64 | scsi_warning_specified_temperature_exceeded = 0x0b01, | ||
65 | scsi_warning_enclosure_degraded = 0x0b02, | ||
66 | scsi_write_error_unexpected_unsolicited_data = 0x0c0c, | ||
67 | scsi_write_error_not_enough_unsolicited_data = 0x0c0d, | ||
68 | scsi_invalid_information_unit = 0x0e00, | ||
69 | scsi_invalid_field_in_command_information_unit = 0x0e03, | ||
70 | scsi_read_error_failed_retransmission_request = 0x1113, | ||
71 | scsi_parameter_list_length_error = 0x1a00, | ||
72 | scsi_invalid_command_operation_code = 0x2000, | ||
73 | scsi_invalid_field_in_cdb = 0x2400, | ||
74 | osd_security_audit_value_frozen = 0x2404, | ||
75 | osd_security_working_key_frozen = 0x2405, | ||
76 | osd_nonce_not_unique = 0x2406, | ||
77 | osd_nonce_timestamp_out_of_range = 0x2407, | ||
78 | scsi_logical_unit_not_supported = 0x2500, | ||
79 | scsi_invalid_field_in_parameter_list = 0x2600, | ||
80 | scsi_parameter_not_supported = 0x2601, | ||
81 | scsi_parameter_value_invalid = 0x2602, | ||
82 | scsi_invalid_release_of_persistent_reservation = 0x2604, | ||
83 | osd_invalid_dataout_buffer_integrity_check_value = 0x260f, | ||
84 | scsi_not_ready_to_ready_change_medium_may_have_changed = 0x2800, | ||
85 | scsi_power_on_reset_or_bus_device_reset_occurred = 0x2900, | ||
86 | scsi_power_on_occurred = 0x2901, | ||
87 | scsi_scsi_bus_reset_occurred = 0x2902, | ||
88 | scsi_bus_device_reset_function_occurred = 0x2903, | ||
89 | scsi_device_internal_reset = 0x2904, | ||
90 | scsi_transceiver_mode_changed_to_single_ended = 0x2905, | ||
91 | scsi_transceiver_mode_changed_to_lvd = 0x2906, | ||
92 | scsi_i_t_nexus_loss_occurred = 0x2907, | ||
93 | scsi_parameters_changed = 0x2a00, | ||
94 | scsi_mode_parameters_changed = 0x2a01, | ||
95 | scsi_asymmetric_access_state_changed = 0x2a06, | ||
96 | scsi_priority_changed = 0x2a08, | ||
97 | scsi_command_sequence_error = 0x2c00, | ||
98 | scsi_previous_busy_status = 0x2c07, | ||
99 | scsi_previous_task_set_full_status = 0x2c08, | ||
100 | scsi_previous_reservation_conflict_status = 0x2c09, | ||
101 | osd_partition_or_collection_contains_user_objects = 0x2c0a, | ||
102 | scsi_commands_cleared_by_another_initiator = 0x2f00, | ||
103 | scsi_cleaning_failure = 0x3007, | ||
104 | scsi_enclosure_failure = 0x3400, | ||
105 | scsi_enclosure_services_failure = 0x3500, | ||
106 | scsi_unsupported_enclosure_function = 0x3501, | ||
107 | scsi_enclosure_services_unavailable = 0x3502, | ||
108 | scsi_enclosure_services_transfer_failure = 0x3503, | ||
109 | scsi_enclosure_services_transfer_refused = 0x3504, | ||
110 | scsi_enclosure_services_checksum_error = 0x3505, | ||
111 | scsi_rounded_parameter = 0x3700, | ||
112 | osd_read_past_end_of_user_object = 0x3b17, | ||
113 | scsi_logical_unit_has_not_self_configured_yet = 0x3e00, | ||
114 | scsi_logical_unit_failure = 0x3e01, | ||
115 | scsi_timeout_on_logical_unit = 0x3e02, | ||
116 | scsi_logical_unit_failed_selftest = 0x3e03, | ||
117 | scsi_logical_unit_unable_to_update_selftest_log = 0x3e04, | ||
118 | scsi_target_operating_conditions_have_changed = 0x3f00, | ||
119 | scsi_microcode_has_been_changed = 0x3f01, | ||
120 | scsi_inquiry_data_has_changed = 0x3f03, | ||
121 | scsi_echo_buffer_overwritten = 0x3f0f, | ||
122 | scsi_diagnostic_failure_on_component_nn_first = 0x4080, | ||
123 | scsi_diagnostic_failure_on_component_nn_last = 0x40ff, | ||
124 | scsi_message_error = 0x4300, | ||
125 | scsi_internal_target_failure = 0x4400, | ||
126 | scsi_select_or_reselect_failure = 0x4500, | ||
127 | scsi_scsi_parity_error = 0x4700, | ||
128 | scsi_data_phase_crc_error_detected = 0x4701, | ||
129 | scsi_scsi_parity_error_detected_during_st_data_phase = 0x4702, | ||
130 | scsi_asynchronous_information_protection_error_detected = 0x4704, | ||
131 | scsi_protocol_service_crc_error = 0x4705, | ||
132 | scsi_phy_test_function_in_progress = 0x4706, | ||
133 | scsi_invalid_message_error = 0x4900, | ||
134 | scsi_command_phase_error = 0x4a00, | ||
135 | scsi_data_phase_error = 0x4b00, | ||
136 | scsi_logical_unit_failed_self_configuration = 0x4c00, | ||
137 | scsi_overlapped_commands_attempted = 0x4e00, | ||
138 | osd_quota_error = 0x5507, | ||
139 | scsi_failure_prediction_threshold_exceeded = 0x5d00, | ||
140 | scsi_failure_prediction_threshold_exceeded_false = 0x5dff, | ||
141 | scsi_voltage_fault = 0x6500, | ||
142 | }; | ||
143 | |||
144 | enum scsi_descriptor_types { | ||
145 | scsi_sense_information = 0x0, | ||
146 | scsi_sense_command_specific_information = 0x1, | ||
147 | scsi_sense_key_specific = 0x2, | ||
148 | scsi_sense_field_replaceable_unit = 0x3, | ||
149 | scsi_sense_stream_commands = 0x4, | ||
150 | scsi_sense_block_commands = 0x5, | ||
151 | osd_sense_object_identification = 0x6, | ||
152 | osd_sense_response_integrity_check = 0x7, | ||
153 | osd_sense_attribute_identification = 0x8, | ||
154 | scsi_sense_ata_return = 0x9, | ||
155 | |||
156 | scsi_sense_Reserved_first = 0x0A, | ||
157 | scsi_sense_Reserved_last = 0x7F, | ||
158 | scsi_sense_Vendor_specific_first = 0x80, | ||
159 | scsi_sense_Vendor_specific_last = 0xFF, | ||
160 | }; | ||
161 | |||
162 | struct scsi_sense_descriptor { /* for picking into desc type */ | ||
163 | u8 descriptor_type; /* one of enum scsi_descriptor_types */ | ||
164 | u8 additional_length; /* n - 1 */ | ||
165 | u8 data[]; | ||
166 | } __packed; | ||
167 | |||
168 | /* OSD deploys only scsi descriptor_based sense buffers */ | ||
169 | struct scsi_sense_descriptor_based { | ||
170 | /*0*/ u8 response_code; /* 0x72 or 0x73 */ | ||
171 | /*1*/ u8 sense_key; /* one of enum scsi_sense_keys (4 lower bits) */ | ||
172 | /*2*/ __be16 additional_sense_code; /* enum osd_additional_sense_codes */ | ||
173 | /*4*/ u8 Reserved[3]; | ||
174 | /*7*/ u8 additional_sense_length; /* n - 7 */ | ||
175 | /*8*/ struct scsi_sense_descriptor ssd[0]; /* variable length, 1 or more */ | ||
176 | } __packed; | ||
177 | |||
178 | /* some descriptors deployed by OSD */ | ||
179 | |||
180 | /* SPC3r23 4.5.2.3 Command-specific information sense data descriptor */ | ||
181 | /* Note: this is the same for descriptor_type=00 but with type=00 the | ||
182 | * Reserved[0] == 0x80 (ie. bit-7 set) | ||
183 | */ | ||
184 | struct scsi_sense_command_specific_data_descriptor { | ||
185 | /*0*/ u8 descriptor_type; /* (00h/01h) */ | ||
186 | /*1*/ u8 additional_length; /* (0Ah) */ | ||
187 | /*2*/ u8 Reserved[2]; | ||
188 | /*4*/ __be64 information; | ||
189 | } __packed; | ||
190 | /*12*/ | ||
191 | |||
192 | struct scsi_sense_key_specific_data_descriptor { | ||
193 | /*0*/ u8 descriptor_type; /* (02h) */ | ||
194 | /*1*/ u8 additional_length; /* (06h) */ | ||
195 | /*2*/ u8 Reserved[2]; | ||
196 | /* SKSV, C/D, Reserved (2), BPV, BIT POINTER (3) */ | ||
197 | /*4*/ u8 sksv_cd_bpv_bp; | ||
198 | /*5*/ __be16 value; /* field-pointer/progress-value/retry-count/... */ | ||
199 | /*7*/ u8 Reserved2; | ||
200 | } __packed; | ||
201 | /*8*/ | ||
202 | |||
203 | /* 4.16.2.1 OSD error identification sense data descriptor - table 52 */ | ||
204 | /* Note: these bits are defined LE order for easy definition, this way the BIT() | ||
205 | * number is the same as in the documentation. Below members at | ||
206 | * osd_sense_identification_data_descriptor are therefore defined __le32. | ||
207 | */ | ||
208 | enum osd_command_functions_bits { | ||
209 | OSD_CFB_COMMAND = BIT(4), | ||
210 | OSD_CFB_CMD_CAP_VERIFIED = BIT(5), | ||
211 | OSD_CFB_VALIDATION = BIT(7), | ||
212 | OSD_CFB_IMP_ST_ATT = BIT(12), | ||
213 | OSD_CFB_SET_ATT = BIT(20), | ||
214 | OSD_CFB_SA_CAP_VERIFIED = BIT(21), | ||
215 | OSD_CFB_GET_ATT = BIT(28), | ||
216 | OSD_CFB_GA_CAP_VERIFIED = BIT(29), | ||
217 | }; | ||
218 | |||
219 | struct osd_sense_identification_data_descriptor { | ||
220 | /*0*/ u8 descriptor_type; /* (06h) */ | ||
221 | /*1*/ u8 additional_length; /* (1Eh) */ | ||
222 | /*2*/ u8 Reserved[6]; | ||
223 | /*8*/ __le32 not_initiated_functions; /*osd_command_functions_bits*/ | ||
224 | /*12*/ __le32 completed_functions; /*osd_command_functions_bits*/ | ||
225 | /*16*/ __be64 partition_id; | ||
226 | /*24*/ __be64 object_id; | ||
227 | } __packed; | ||
228 | /*32*/ | ||
229 | |||
230 | struct osd_sense_response_integrity_check_descriptor { | ||
231 | /*0*/ u8 descriptor_type; /* (07h) */ | ||
232 | /*1*/ u8 additional_length; /* (20h) */ | ||
233 | /*2*/ u8 integrity_check_value[32]; /*FIXME: OSDv2_CRYPTO_KEYID_SIZE*/ | ||
234 | } __packed; | ||
235 | /*34*/ | ||
236 | |||
237 | struct osd_sense_attributes_data_descriptor { | ||
238 | /*0*/ u8 descriptor_type; /* (08h) */ | ||
239 | /*1*/ u8 additional_length; /* (n-2) */ | ||
240 | /*2*/ u8 Reserved[6]; | ||
241 | struct osd_sense_attr { | ||
242 | /*8*/ __be32 attr_page; | ||
243 | /*12*/ __be32 attr_id; | ||
244 | /*16*/ } sense_attrs[0]; /* 1 or more */ | ||
245 | } __packed; | ||
246 | /*variable*/ | ||
247 | |||
248 | /* Dig into scsi_sk_illegal_request/scsi_invalid_field_in_cdb errors */ | ||
249 | |||
250 | /*FIXME: Support also field in CAPS*/ | ||
251 | #define OSD_CDB_OFFSET(F) offsetof(struct osd_cdb_head, F) | ||
252 | |||
253 | enum osdv2_cdb_field_offset { | ||
254 | OSDv1_CFO_STARTING_BYTE = OSD_CDB_OFFSET(v1.start_address), | ||
255 | OSD_CFO_STARTING_BYTE = OSD_CDB_OFFSET(v2.start_address), | ||
256 | OSD_CFO_PARTITION_ID = OSD_CDB_OFFSET(partition), | ||
257 | OSD_CFO_OBJECT_ID = OSD_CDB_OFFSET(object), | ||
258 | }; | ||
259 | |||
260 | #endif /* ndef __OSD_SENSE_H__ */ | ||
diff --git a/include/scsi/osd_types.h b/include/scsi/osd_types.h new file mode 100644 index 000000000000..3f5e88cc75c0 --- /dev/null +++ b/include/scsi/osd_types.h | |||
@@ -0,0 +1,40 @@ | |||
1 | /* | ||
2 | * osd_types.h - Types and constants which are not part of the protocol. | ||
3 | * | ||
4 | * Copyright (C) 2008 Panasas Inc. All rights reserved. | ||
5 | * | ||
6 | * Authors: | ||
7 | * Boaz Harrosh <bharrosh@panasas.com> | ||
8 | * Benny Halevy <bhalevy@panasas.com> | ||
9 | * | ||
10 | * This program is free software; you can redistribute it and/or modify | ||
11 | * it under the terms of the GNU General Public License version 2 | ||
12 | * | ||
13 | * Contains types and constants that are implementation specific and are | ||
14 | * used by more than one part of the osd library. | ||
15 | * (Eg initiator/target/security_manager/...) | ||
16 | */ | ||
17 | #ifndef __OSD_TYPES_H__ | ||
18 | #define __OSD_TYPES_H__ | ||
19 | |||
20 | struct osd_systemid { | ||
21 | u8 data[OSD_SYSTEMID_LEN]; | ||
22 | }; | ||
23 | |||
24 | typedef u64 __bitwise osd_id; | ||
25 | |||
26 | struct osd_obj_id { | ||
27 | osd_id partition; | ||
28 | osd_id id; | ||
29 | }; | ||
30 | |||
31 | static const struct __weak osd_obj_id osd_root_object = {0, 0}; | ||
32 | |||
33 | struct osd_attr { | ||
34 | u32 attr_page; | ||
35 | u32 attr_id; | ||
36 | u16 len; /* byte count of operand */ | ||
37 | void *val_ptr; /* in network order */ | ||
38 | }; | ||
39 | |||
40 | #endif /* ndef __OSD_TYPES_H__ */ | ||
diff --git a/include/scsi/scsi.h b/include/scsi/scsi.h index a109165714d6..084478e14d24 100644 --- a/include/scsi/scsi.h +++ b/include/scsi/scsi.h | |||
@@ -9,7 +9,8 @@ | |||
9 | #define _SCSI_SCSI_H | 9 | #define _SCSI_SCSI_H |
10 | 10 | ||
11 | #include <linux/types.h> | 11 | #include <linux/types.h> |
12 | #include <scsi/scsi_cmnd.h> | 12 | |
13 | struct scsi_cmnd; | ||
13 | 14 | ||
14 | /* | 15 | /* |
15 | * The maximum number of SG segments that we will put inside a | 16 | * The maximum number of SG segments that we will put inside a |
@@ -263,6 +264,7 @@ static inline int scsi_status_is_good(int status) | |||
263 | #define TYPE_RAID 0x0c | 264 | #define TYPE_RAID 0x0c |
264 | #define TYPE_ENCLOSURE 0x0d /* Enclosure Services Device */ | 265 | #define TYPE_ENCLOSURE 0x0d /* Enclosure Services Device */ |
265 | #define TYPE_RBC 0x0e | 266 | #define TYPE_RBC 0x0e |
267 | #define TYPE_OSD 0x11 | ||
266 | #define TYPE_NO_LUN 0x7f | 268 | #define TYPE_NO_LUN 0x7f |
267 | 269 | ||
268 | /* SCSI protocols; these are taken from SPC-3 section 7.5 */ | 270 | /* SCSI protocols; these are taken from SPC-3 section 7.5 */ |
@@ -402,16 +404,6 @@ static inline int scsi_is_wlun(unsigned int lun) | |||
402 | #define DRIVER_HARD 0x07 | 404 | #define DRIVER_HARD 0x07 |
403 | #define DRIVER_SENSE 0x08 | 405 | #define DRIVER_SENSE 0x08 |
404 | 406 | ||
405 | #define SUGGEST_RETRY 0x10 | ||
406 | #define SUGGEST_ABORT 0x20 | ||
407 | #define SUGGEST_REMAP 0x30 | ||
408 | #define SUGGEST_DIE 0x40 | ||
409 | #define SUGGEST_SENSE 0x80 | ||
410 | #define SUGGEST_IS_OK 0xff | ||
411 | |||
412 | #define DRIVER_MASK 0x0f | ||
413 | #define SUGGEST_MASK 0xf0 | ||
414 | |||
415 | /* | 407 | /* |
416 | * Internal return values. | 408 | * Internal return values. |
417 | */ | 409 | */ |
@@ -447,23 +439,6 @@ static inline int scsi_is_wlun(unsigned int lun) | |||
447 | #define msg_byte(result) (((result) >> 8) & 0xff) | 439 | #define msg_byte(result) (((result) >> 8) & 0xff) |
448 | #define host_byte(result) (((result) >> 16) & 0xff) | 440 | #define host_byte(result) (((result) >> 16) & 0xff) |
449 | #define driver_byte(result) (((result) >> 24) & 0xff) | 441 | #define driver_byte(result) (((result) >> 24) & 0xff) |
450 | #define suggestion(result) (driver_byte(result) & SUGGEST_MASK) | ||
451 | |||
452 | static inline void set_msg_byte(struct scsi_cmnd *cmd, char status) | ||
453 | { | ||
454 | cmd->result |= status << 8; | ||
455 | } | ||
456 | |||
457 | static inline void set_host_byte(struct scsi_cmnd *cmd, char status) | ||
458 | { | ||
459 | cmd->result |= status << 16; | ||
460 | } | ||
461 | |||
462 | static inline void set_driver_byte(struct scsi_cmnd *cmd, char status) | ||
463 | { | ||
464 | cmd->result |= status << 24; | ||
465 | } | ||
466 | |||
467 | 442 | ||
468 | #define sense_class(sense) (((sense) >> 4) & 0x7) | 443 | #define sense_class(sense) (((sense) >> 4) & 0x7) |
469 | #define sense_error(sense) ((sense) & 0xf) | 444 | #define sense_error(sense) ((sense) & 0xf) |
diff --git a/include/scsi/scsi_cmnd.h b/include/scsi/scsi_cmnd.h index 855bf95963e7..43b50d36925c 100644 --- a/include/scsi/scsi_cmnd.h +++ b/include/scsi/scsi_cmnd.h | |||
@@ -291,4 +291,19 @@ static inline struct scsi_data_buffer *scsi_prot(struct scsi_cmnd *cmd) | |||
291 | #define scsi_for_each_prot_sg(cmd, sg, nseg, __i) \ | 291 | #define scsi_for_each_prot_sg(cmd, sg, nseg, __i) \ |
292 | for_each_sg(scsi_prot_sglist(cmd), sg, nseg, __i) | 292 | for_each_sg(scsi_prot_sglist(cmd), sg, nseg, __i) |
293 | 293 | ||
294 | static inline void set_msg_byte(struct scsi_cmnd *cmd, char status) | ||
295 | { | ||
296 | cmd->result |= status << 8; | ||
297 | } | ||
298 | |||
299 | static inline void set_host_byte(struct scsi_cmnd *cmd, char status) | ||
300 | { | ||
301 | cmd->result |= status << 16; | ||
302 | } | ||
303 | |||
304 | static inline void set_driver_byte(struct scsi_cmnd *cmd, char status) | ||
305 | { | ||
306 | cmd->result |= status << 24; | ||
307 | } | ||
308 | |||
294 | #endif /* _SCSI_SCSI_CMND_H */ | 309 | #endif /* _SCSI_SCSI_CMND_H */ |
diff --git a/include/scsi/scsi_device.h b/include/scsi/scsi_device.h index 01a4c58f8bad..3f566af3f101 100644 --- a/include/scsi/scsi_device.h +++ b/include/scsi/scsi_device.h | |||
@@ -340,6 +340,7 @@ extern int scsi_mode_select(struct scsi_device *sdev, int pf, int sp, | |||
340 | struct scsi_sense_hdr *); | 340 | struct scsi_sense_hdr *); |
341 | extern int scsi_test_unit_ready(struct scsi_device *sdev, int timeout, | 341 | extern int scsi_test_unit_ready(struct scsi_device *sdev, int timeout, |
342 | int retries, struct scsi_sense_hdr *sshdr); | 342 | int retries, struct scsi_sense_hdr *sshdr); |
343 | extern unsigned char *scsi_get_vpd_page(struct scsi_device *, u8 page); | ||
343 | extern int scsi_device_set_state(struct scsi_device *sdev, | 344 | extern int scsi_device_set_state(struct scsi_device *sdev, |
344 | enum scsi_device_state state); | 345 | enum scsi_device_state state); |
345 | extern struct scsi_event *sdev_evt_alloc(enum scsi_device_event evt_type, | 346 | extern struct scsi_event *sdev_evt_alloc(enum scsi_device_event evt_type, |
@@ -370,12 +371,6 @@ extern int scsi_execute_req(struct scsi_device *sdev, const unsigned char *cmd, | |||
370 | int data_direction, void *buffer, unsigned bufflen, | 371 | int data_direction, void *buffer, unsigned bufflen, |
371 | struct scsi_sense_hdr *, int timeout, int retries, | 372 | struct scsi_sense_hdr *, int timeout, int retries, |
372 | int *resid); | 373 | int *resid); |
373 | extern int scsi_execute_async(struct scsi_device *sdev, | ||
374 | const unsigned char *cmd, int cmd_len, int data_direction, | ||
375 | void *buffer, unsigned bufflen, int use_sg, | ||
376 | int timeout, int retries, void *privdata, | ||
377 | void (*done)(void *, char *, int, int), | ||
378 | gfp_t gfp); | ||
379 | 374 | ||
380 | static inline int __must_check scsi_device_reprobe(struct scsi_device *sdev) | 375 | static inline int __must_check scsi_device_reprobe(struct scsi_device *sdev) |
381 | { | 376 | { |
@@ -400,7 +395,8 @@ static inline unsigned int sdev_id(struct scsi_device *sdev) | |||
400 | */ | 395 | */ |
401 | static inline int scsi_device_online(struct scsi_device *sdev) | 396 | static inline int scsi_device_online(struct scsi_device *sdev) |
402 | { | 397 | { |
403 | return sdev->sdev_state != SDEV_OFFLINE; | 398 | return (sdev->sdev_state != SDEV_OFFLINE && |
399 | sdev->sdev_state != SDEV_DEL); | ||
404 | } | 400 | } |
405 | static inline int scsi_device_blocked(struct scsi_device *sdev) | 401 | static inline int scsi_device_blocked(struct scsi_device *sdev) |
406 | { | 402 | { |
diff --git a/include/scsi/scsi_transport_iscsi.h b/include/scsi/scsi_transport_iscsi.h index b50aabe2861e..457588e1119b 100644 --- a/include/scsi/scsi_transport_iscsi.h +++ b/include/scsi/scsi_transport_iscsi.h | |||
@@ -88,7 +88,7 @@ struct iscsi_transport { | |||
88 | uint64_t host_param_mask; | 88 | uint64_t host_param_mask; |
89 | struct iscsi_cls_session *(*create_session) (struct iscsi_endpoint *ep, | 89 | struct iscsi_cls_session *(*create_session) (struct iscsi_endpoint *ep, |
90 | uint16_t cmds_max, uint16_t qdepth, | 90 | uint16_t cmds_max, uint16_t qdepth, |
91 | uint32_t sn, uint32_t *hn); | 91 | uint32_t sn); |
92 | void (*destroy_session) (struct iscsi_cls_session *session); | 92 | void (*destroy_session) (struct iscsi_cls_session *session); |
93 | struct iscsi_cls_conn *(*create_conn) (struct iscsi_cls_session *sess, | 93 | struct iscsi_cls_conn *(*create_conn) (struct iscsi_cls_session *sess, |
94 | uint32_t cid); | 94 | uint32_t cid); |
@@ -206,8 +206,6 @@ struct iscsi_cls_session { | |||
206 | struct iscsi_cls_host { | 206 | struct iscsi_cls_host { |
207 | atomic_t nr_scans; | 207 | atomic_t nr_scans; |
208 | struct mutex mutex; | 208 | struct mutex mutex; |
209 | struct workqueue_struct *scan_workq; | ||
210 | char scan_workq_name[20]; | ||
211 | }; | 209 | }; |
212 | 210 | ||
213 | extern void iscsi_host_for_each_session(struct Scsi_Host *shost, | 211 | extern void iscsi_host_for_each_session(struct Scsi_Host *shost, |
diff --git a/include/video/broadsheetfb.h b/include/video/broadsheetfb.h new file mode 100644 index 000000000000..a758534c0272 --- /dev/null +++ b/include/video/broadsheetfb.h | |||
@@ -0,0 +1,59 @@ | |||
1 | /* | ||
2 | * broadsheetfb.h - definitions for the broadsheet framebuffer driver | ||
3 | * | ||
4 | * Copyright (C) 2008 by Jaya Kumar | ||
5 | * | ||
6 | * This file is subject to the terms and conditions of the GNU General Public | ||
7 | * License. See the file COPYING in the main directory of this archive for | ||
8 | * more details. | ||
9 | * | ||
10 | */ | ||
11 | |||
12 | #ifndef _LINUX_BROADSHEETFB_H_ | ||
13 | #define _LINUX_BROADSHEETFB_H_ | ||
14 | |||
15 | /* Broadsheet command defines */ | ||
16 | #define BS_CMD_INIT_SYS_RUN 0x06 | ||
17 | #define BS_CMD_INIT_DSPE_CFG 0x09 | ||
18 | #define BS_CMD_INIT_DSPE_TMG 0x0A | ||
19 | #define BS_CMD_INIT_ROTMODE 0x0B | ||
20 | #define BS_CMD_RD_REG 0x10 | ||
21 | #define BS_CMD_WR_REG 0x11 | ||
22 | #define BS_CMD_LD_IMG 0x20 | ||
23 | #define BS_CMD_LD_IMG_AREA 0x22 | ||
24 | #define BS_CMD_LD_IMG_END 0x23 | ||
25 | #define BS_CMD_WAIT_DSPE_TRG 0x28 | ||
26 | #define BS_CMD_WAIT_DSPE_FREND 0x29 | ||
27 | #define BS_CMD_RD_WFM_INFO 0x30 | ||
28 | #define BS_CMD_UPD_INIT 0x32 | ||
29 | #define BS_CMD_UPD_FULL 0x33 | ||
30 | #define BS_CMD_UPD_GDRV_CLR 0x37 | ||
31 | |||
32 | /* Broadsheet pin interface specific defines */ | ||
33 | #define BS_CS 0x01 | ||
34 | #define BS_DC 0x02 | ||
35 | #define BS_WR 0x03 | ||
36 | |||
37 | /* struct used by broadsheet. board specific stuff comes from *board */ | ||
38 | struct broadsheetfb_par { | ||
39 | struct fb_info *info; | ||
40 | struct broadsheet_board *board; | ||
41 | void (*write_reg)(struct broadsheetfb_par *, u16 reg, u16 val); | ||
42 | u16 (*read_reg)(struct broadsheetfb_par *, u16 reg); | ||
43 | wait_queue_head_t waitq; | ||
44 | }; | ||
45 | |||
46 | /* board specific routines */ | ||
47 | struct broadsheet_board { | ||
48 | struct module *owner; | ||
49 | int (*init)(struct broadsheetfb_par *); | ||
50 | int (*wait_for_rdy)(struct broadsheetfb_par *); | ||
51 | void (*set_ctl)(struct broadsheetfb_par *, unsigned char, u8); | ||
52 | void (*set_hdb)(struct broadsheetfb_par *, u16); | ||
53 | u16 (*get_hdb)(struct broadsheetfb_par *); | ||
54 | void (*cleanup)(struct broadsheetfb_par *); | ||
55 | int (*get_panel_type)(void); | ||
56 | int (*setup_irq)(struct fb_info *); | ||
57 | }; | ||
58 | |||
59 | #endif | ||