diff options
144 files changed, 1608 insertions, 999 deletions
diff --git a/Documentation/filesystems/ntfs.txt b/Documentation/filesystems/ntfs.txt index 614de3124901..251168587899 100644 --- a/Documentation/filesystems/ntfs.txt +++ b/Documentation/filesystems/ntfs.txt | |||
@@ -457,6 +457,12 @@ ChangeLog | |||
457 | 457 | ||
458 | Note, a technical ChangeLog aimed at kernel hackers is in fs/ntfs/ChangeLog. | 458 | Note, a technical ChangeLog aimed at kernel hackers is in fs/ntfs/ChangeLog. |
459 | 459 | ||
460 | 2.1.26: | ||
461 | - Implement support for sector sizes above 512 bytes (up to the maximum | ||
462 | supported by NTFS which is 4096 bytes). | ||
463 | - Enhance support for NTFS volumes which were supported by Windows but | ||
464 | not by Linux due to invalid attribute list attribute flags. | ||
465 | - A few minor updates and bug fixes. | ||
460 | 2.1.25: | 466 | 2.1.25: |
461 | - Write support is now extended with write(2) being able to both | 467 | - Write support is now extended with write(2) being able to both |
462 | overwrite existing file data and to extend files. Also, if a write | 468 | overwrite existing file data and to extend files. Also, if a write |
diff --git a/Documentation/filesystems/tmpfs.txt b/Documentation/filesystems/tmpfs.txt index 8a155418c705..1773106976a2 100644 --- a/Documentation/filesystems/tmpfs.txt +++ b/Documentation/filesystems/tmpfs.txt | |||
@@ -92,6 +92,15 @@ NodeList format is a comma-separated list of decimal numbers and ranges, | |||
92 | a range being two hyphen-separated decimal numbers, the smallest and | 92 | a range being two hyphen-separated decimal numbers, the smallest and |
93 | largest node numbers in the range. For example, mpol=bind:0-3,5,7,9-15 | 93 | largest node numbers in the range. For example, mpol=bind:0-3,5,7,9-15 |
94 | 94 | ||
95 | Note that trying to mount a tmpfs with an mpol option will fail if the | ||
96 | running kernel does not support NUMA; and will fail if its nodelist | ||
97 | specifies a node >= MAX_NUMNODES. If your system relies on that tmpfs | ||
98 | being mounted, but from time to time runs a kernel built without NUMA | ||
99 | capability (perhaps a safe recovery kernel), or configured to support | ||
100 | fewer nodes, then it is advisable to omit the mpol option from automatic | ||
101 | mount options. It can be added later, when the tmpfs is already mounted | ||
102 | on MountPoint, by 'mount -o remount,mpol=Policy:NodeList MountPoint'. | ||
103 | |||
95 | 104 | ||
96 | To specify the initial root directory you can use the following mount | 105 | To specify the initial root directory you can use the following mount |
97 | options: | 106 | options: |
diff --git a/Documentation/x86_64/boot-options.txt b/Documentation/x86_64/boot-options.txt index 153740f460a6..1921353259ae 100644 --- a/Documentation/x86_64/boot-options.txt +++ b/Documentation/x86_64/boot-options.txt | |||
@@ -52,6 +52,10 @@ APICs | |||
52 | apicmaintimer. Useful when your PIT timer is totally | 52 | apicmaintimer. Useful when your PIT timer is totally |
53 | broken. | 53 | broken. |
54 | 54 | ||
55 | disable_8254_timer / enable_8254_timer | ||
56 | Enable interrupt 0 timer routing over the 8254 in addition to over | ||
57 | the IO-APIC. The kernel tries to set a sensible default. | ||
58 | |||
55 | Early Console | 59 | Early Console |
56 | 60 | ||
57 | syntax: earlyprintk=vga | 61 | syntax: earlyprintk=vga |
@@ -1,7 +1,7 @@ | |||
1 | VERSION = 2 | 1 | VERSION = 2 |
2 | PATCHLEVEL = 6 | 2 | PATCHLEVEL = 6 |
3 | SUBLEVEL = 16 | 3 | SUBLEVEL = 16 |
4 | EXTRAVERSION =-rc4 | 4 | EXTRAVERSION =-rc5 |
5 | NAME=Sliding Snow Leopard | 5 | NAME=Sliding Snow Leopard |
6 | 6 | ||
7 | # *DOCUMENTATION* | 7 | # *DOCUMENTATION* |
diff --git a/arch/arm/mach-at91rm9200/gpio.c b/arch/arm/mach-at91rm9200/gpio.c index a9f718bf8ba8..0e396feec468 100644 --- a/arch/arm/mach-at91rm9200/gpio.c +++ b/arch/arm/mach-at91rm9200/gpio.c | |||
@@ -274,8 +274,18 @@ static void gpio_irq_handler(unsigned irq, struct irqdesc *desc, struct pt_regs | |||
274 | gpio = &irq_desc[pin]; | 274 | gpio = &irq_desc[pin]; |
275 | 275 | ||
276 | while (isr) { | 276 | while (isr) { |
277 | if (isr & 1) | 277 | if (isr & 1) { |
278 | gpio->handle(pin, gpio, regs); | 278 | if (unlikely(gpio->disable_depth)) { |
279 | /* | ||
280 | * The core ARM interrupt handler lazily disables IRQs so | ||
281 | * another IRQ must be generated before it actually gets | ||
282 | * here to be disabled on the GPIO controller. | ||
283 | */ | ||
284 | gpio_irq_mask(pin); | ||
285 | } | ||
286 | else | ||
287 | gpio->handle(pin, gpio, regs); | ||
288 | } | ||
279 | pin++; | 289 | pin++; |
280 | gpio++; | 290 | gpio++; |
281 | isr >>= 1; | 291 | isr >>= 1; |
diff --git a/arch/i386/Kconfig b/arch/i386/Kconfig index 0afec8566e7b..5b1a7d46d1d9 100644 --- a/arch/i386/Kconfig +++ b/arch/i386/Kconfig | |||
@@ -733,7 +733,7 @@ config PHYSICAL_START | |||
733 | 733 | ||
734 | config HOTPLUG_CPU | 734 | config HOTPLUG_CPU |
735 | bool "Support for hot-pluggable CPUs (EXPERIMENTAL)" | 735 | bool "Support for hot-pluggable CPUs (EXPERIMENTAL)" |
736 | depends on SMP && HOTPLUG && EXPERIMENTAL | 736 | depends on SMP && HOTPLUG && EXPERIMENTAL && !X86_VOYAGER |
737 | ---help--- | 737 | ---help--- |
738 | Say Y here to experiment with turning CPUs off and on. CPUs | 738 | Say Y here to experiment with turning CPUs off and on. CPUs |
739 | can be controlled through /sys/devices/system/cpu. | 739 | can be controlled through /sys/devices/system/cpu. |
@@ -1060,6 +1060,7 @@ source "arch/i386/oprofile/Kconfig" | |||
1060 | 1060 | ||
1061 | config KPROBES | 1061 | config KPROBES |
1062 | bool "Kprobes (EXPERIMENTAL)" | 1062 | bool "Kprobes (EXPERIMENTAL)" |
1063 | depends on EXPERIMENTAL && MODULES | ||
1063 | help | 1064 | help |
1064 | Kprobes allows you to trap at almost any kernel address and | 1065 | Kprobes allows you to trap at almost any kernel address and |
1065 | execute a callback function. register_kprobe() establishes | 1066 | execute a callback function. register_kprobe() establishes |
diff --git a/arch/i386/kernel/Makefile b/arch/i386/kernel/Makefile index 60c3f76dfca4..53bb9a79e274 100644 --- a/arch/i386/kernel/Makefile +++ b/arch/i386/kernel/Makefile | |||
@@ -7,7 +7,7 @@ extra-y := head.o init_task.o vmlinux.lds | |||
7 | obj-y := process.o semaphore.o signal.o entry.o traps.o irq.o \ | 7 | obj-y := process.o semaphore.o signal.o entry.o traps.o irq.o \ |
8 | ptrace.o time.o ioport.o ldt.o setup.o i8259.o sys_i386.o \ | 8 | ptrace.o time.o ioport.o ldt.o setup.o i8259.o sys_i386.o \ |
9 | pci-dma.o i386_ksyms.o i387.o dmi_scan.o bootflag.o \ | 9 | pci-dma.o i386_ksyms.o i387.o dmi_scan.o bootflag.o \ |
10 | quirks.o i8237.o | 10 | quirks.o i8237.o topology.o |
11 | 11 | ||
12 | obj-y += cpu/ | 12 | obj-y += cpu/ |
13 | obj-y += timers/ | 13 | obj-y += timers/ |
diff --git a/arch/i386/kernel/cpu/common.c b/arch/i386/kernel/cpu/common.c index 7eb9213734a3..4ecd4b326ded 100644 --- a/arch/i386/kernel/cpu/common.c +++ b/arch/i386/kernel/cpu/common.c | |||
@@ -4,6 +4,7 @@ | |||
4 | #include <linux/smp.h> | 4 | #include <linux/smp.h> |
5 | #include <linux/module.h> | 5 | #include <linux/module.h> |
6 | #include <linux/percpu.h> | 6 | #include <linux/percpu.h> |
7 | #include <linux/bootmem.h> | ||
7 | #include <asm/semaphore.h> | 8 | #include <asm/semaphore.h> |
8 | #include <asm/processor.h> | 9 | #include <asm/processor.h> |
9 | #include <asm/i387.h> | 10 | #include <asm/i387.h> |
@@ -18,6 +19,9 @@ | |||
18 | 19 | ||
19 | #include "cpu.h" | 20 | #include "cpu.h" |
20 | 21 | ||
22 | DEFINE_PER_CPU(struct Xgt_desc_struct, cpu_gdt_descr); | ||
23 | EXPORT_PER_CPU_SYMBOL(cpu_gdt_descr); | ||
24 | |||
21 | DEFINE_PER_CPU(unsigned char, cpu_16bit_stack[CPU_16BIT_STACK_SIZE]); | 25 | DEFINE_PER_CPU(unsigned char, cpu_16bit_stack[CPU_16BIT_STACK_SIZE]); |
22 | EXPORT_PER_CPU_SYMBOL(cpu_16bit_stack); | 26 | EXPORT_PER_CPU_SYMBOL(cpu_16bit_stack); |
23 | 27 | ||
@@ -571,8 +575,9 @@ void __devinit cpu_init(void) | |||
571 | int cpu = smp_processor_id(); | 575 | int cpu = smp_processor_id(); |
572 | struct tss_struct * t = &per_cpu(init_tss, cpu); | 576 | struct tss_struct * t = &per_cpu(init_tss, cpu); |
573 | struct thread_struct *thread = ¤t->thread; | 577 | struct thread_struct *thread = ¤t->thread; |
574 | struct desc_struct *gdt = get_cpu_gdt_table(cpu); | 578 | struct desc_struct *gdt; |
575 | __u32 stk16_off = (__u32)&per_cpu(cpu_16bit_stack, cpu); | 579 | __u32 stk16_off = (__u32)&per_cpu(cpu_16bit_stack, cpu); |
580 | struct Xgt_desc_struct *cpu_gdt_descr = &per_cpu(cpu_gdt_descr, cpu); | ||
576 | 581 | ||
577 | if (cpu_test_and_set(cpu, cpu_initialized)) { | 582 | if (cpu_test_and_set(cpu, cpu_initialized)) { |
578 | printk(KERN_WARNING "CPU#%d already initialized!\n", cpu); | 583 | printk(KERN_WARNING "CPU#%d already initialized!\n", cpu); |
@@ -590,6 +595,25 @@ void __devinit cpu_init(void) | |||
590 | } | 595 | } |
591 | 596 | ||
592 | /* | 597 | /* |
598 | * This is a horrible hack to allocate the GDT. The problem | ||
599 | * is that cpu_init() is called really early for the boot CPU | ||
600 | * (and hence needs bootmem) but much later for the secondary | ||
601 | * CPUs, when bootmem will have gone away | ||
602 | */ | ||
603 | if (NODE_DATA(0)->bdata->node_bootmem_map) { | ||
604 | gdt = (struct desc_struct *)alloc_bootmem_pages(PAGE_SIZE); | ||
605 | /* alloc_bootmem_pages panics on failure, so no check */ | ||
606 | memset(gdt, 0, PAGE_SIZE); | ||
607 | } else { | ||
608 | gdt = (struct desc_struct *)get_zeroed_page(GFP_KERNEL); | ||
609 | if (unlikely(!gdt)) { | ||
610 | printk(KERN_CRIT "CPU%d failed to allocate GDT\n", cpu); | ||
611 | for (;;) | ||
612 | local_irq_enable(); | ||
613 | } | ||
614 | } | ||
615 | |||
616 | /* | ||
593 | * Initialize the per-CPU GDT with the boot GDT, | 617 | * Initialize the per-CPU GDT with the boot GDT, |
594 | * and set up the GDT descriptor: | 618 | * and set up the GDT descriptor: |
595 | */ | 619 | */ |
@@ -601,10 +625,10 @@ void __devinit cpu_init(void) | |||
601 | ((((__u64)stk16_off) << 32) & 0xff00000000000000ULL) | | 625 | ((((__u64)stk16_off) << 32) & 0xff00000000000000ULL) | |
602 | (CPU_16BIT_STACK_SIZE - 1); | 626 | (CPU_16BIT_STACK_SIZE - 1); |
603 | 627 | ||
604 | cpu_gdt_descr[cpu].size = GDT_SIZE - 1; | 628 | cpu_gdt_descr->size = GDT_SIZE - 1; |
605 | cpu_gdt_descr[cpu].address = (unsigned long)gdt; | 629 | cpu_gdt_descr->address = (unsigned long)gdt; |
606 | 630 | ||
607 | load_gdt(&cpu_gdt_descr[cpu]); | 631 | load_gdt(cpu_gdt_descr); |
608 | load_idt(&idt_descr); | 632 | load_idt(&idt_descr); |
609 | 633 | ||
610 | /* | 634 | /* |
diff --git a/arch/i386/kernel/efi.c b/arch/i386/kernel/efi.c index ecad519fd395..e3e42fd62401 100644 --- a/arch/i386/kernel/efi.c +++ b/arch/i386/kernel/efi.c | |||
@@ -103,17 +103,19 @@ static void efi_call_phys_prelog(void) | |||
103 | */ | 103 | */ |
104 | local_flush_tlb(); | 104 | local_flush_tlb(); |
105 | 105 | ||
106 | cpu_gdt_descr[0].address = __pa(cpu_gdt_descr[0].address); | 106 | per_cpu(cpu_gdt_descr, 0).address = |
107 | load_gdt((struct Xgt_desc_struct *) __pa(&cpu_gdt_descr[0])); | 107 | __pa(per_cpu(cpu_gdt_descr, 0).address); |
108 | load_gdt((struct Xgt_desc_struct *)__pa(&per_cpu(cpu_gdt_descr, 0))); | ||
108 | } | 109 | } |
109 | 110 | ||
110 | static void efi_call_phys_epilog(void) | 111 | static void efi_call_phys_epilog(void) |
111 | { | 112 | { |
112 | unsigned long cr4; | 113 | unsigned long cr4; |
113 | 114 | ||
114 | cpu_gdt_descr[0].address = | 115 | per_cpu(cpu_gdt_descr, 0).address = |
115 | (unsigned long) __va(cpu_gdt_descr[0].address); | 116 | (unsigned long)__va(per_cpu(cpu_gdt_descr, 0).address); |
116 | load_gdt(&cpu_gdt_descr[0]); | 117 | load_gdt((struct Xgt_desc_struct *)__va(&per_cpu(cpu_gdt_descr, 0))); |
118 | |||
117 | cr4 = read_cr4(); | 119 | cr4 = read_cr4(); |
118 | 120 | ||
119 | if (cr4 & X86_CR4_PSE) { | 121 | if (cr4 & X86_CR4_PSE) { |
diff --git a/arch/i386/kernel/head.S b/arch/i386/kernel/head.S index 2bee6499edd9..e0b7c632efbc 100644 --- a/arch/i386/kernel/head.S +++ b/arch/i386/kernel/head.S | |||
@@ -534,5 +534,3 @@ ENTRY(cpu_gdt_table) | |||
534 | .quad 0x0000000000000000 /* 0xf0 - unused */ | 534 | .quad 0x0000000000000000 /* 0xf0 - unused */ |
535 | .quad 0x0000000000000000 /* 0xf8 - GDT entry 31: double-fault TSS */ | 535 | .quad 0x0000000000000000 /* 0xf8 - GDT entry 31: double-fault TSS */ |
536 | 536 | ||
537 | /* Be sure this is zeroed to avoid false validations in Xen */ | ||
538 | .fill PAGE_SIZE_asm / 8 - GDT_ENTRIES,8,0 | ||
diff --git a/arch/i386/kernel/i386_ksyms.c b/arch/i386/kernel/i386_ksyms.c index 3999bec50c33..055325056a74 100644 --- a/arch/i386/kernel/i386_ksyms.c +++ b/arch/i386/kernel/i386_ksyms.c | |||
@@ -3,8 +3,6 @@ | |||
3 | #include <asm/checksum.h> | 3 | #include <asm/checksum.h> |
4 | #include <asm/desc.h> | 4 | #include <asm/desc.h> |
5 | 5 | ||
6 | EXPORT_SYMBOL_GPL(cpu_gdt_descr); | ||
7 | |||
8 | EXPORT_SYMBOL(__down_failed); | 6 | EXPORT_SYMBOL(__down_failed); |
9 | EXPORT_SYMBOL(__down_failed_interruptible); | 7 | EXPORT_SYMBOL(__down_failed_interruptible); |
10 | EXPORT_SYMBOL(__down_failed_trylock); | 8 | EXPORT_SYMBOL(__down_failed_trylock); |
diff --git a/arch/i386/kernel/io_apic.c b/arch/i386/kernel/io_apic.c index f2dd218d88cb..235822b3f41b 100644 --- a/arch/i386/kernel/io_apic.c +++ b/arch/i386/kernel/io_apic.c | |||
@@ -2566,8 +2566,10 @@ int __init io_apic_get_unique_id (int ioapic, int apic_id) | |||
2566 | spin_unlock_irqrestore(&ioapic_lock, flags); | 2566 | spin_unlock_irqrestore(&ioapic_lock, flags); |
2567 | 2567 | ||
2568 | /* Sanity check */ | 2568 | /* Sanity check */ |
2569 | if (reg_00.bits.ID != apic_id) | 2569 | if (reg_00.bits.ID != apic_id) { |
2570 | panic("IOAPIC[%d]: Unable change apic_id!\n", ioapic); | 2570 | printk("IOAPIC[%d]: Unable to change apic_id!\n", ioapic); |
2571 | return -1; | ||
2572 | } | ||
2571 | } | 2573 | } |
2572 | 2574 | ||
2573 | apic_printk(APIC_VERBOSE, KERN_INFO | 2575 | apic_printk(APIC_VERBOSE, KERN_INFO |
diff --git a/arch/i386/kernel/kprobes.c b/arch/i386/kernel/kprobes.c index 6483eeb1a4e8..694a13997637 100644 --- a/arch/i386/kernel/kprobes.c +++ b/arch/i386/kernel/kprobes.c | |||
@@ -58,6 +58,11 @@ static inline int is_IF_modifier(kprobe_opcode_t opcode) | |||
58 | 58 | ||
59 | int __kprobes arch_prepare_kprobe(struct kprobe *p) | 59 | int __kprobes arch_prepare_kprobe(struct kprobe *p) |
60 | { | 60 | { |
61 | /* insn: must be on special executable page on i386. */ | ||
62 | p->ainsn.insn = get_insn_slot(); | ||
63 | if (!p->ainsn.insn) | ||
64 | return -ENOMEM; | ||
65 | |||
61 | memcpy(p->ainsn.insn, p->addr, MAX_INSN_SIZE * sizeof(kprobe_opcode_t)); | 66 | memcpy(p->ainsn.insn, p->addr, MAX_INSN_SIZE * sizeof(kprobe_opcode_t)); |
62 | p->opcode = *p->addr; | 67 | p->opcode = *p->addr; |
63 | return 0; | 68 | return 0; |
@@ -77,6 +82,13 @@ void __kprobes arch_disarm_kprobe(struct kprobe *p) | |||
77 | (unsigned long) p->addr + sizeof(kprobe_opcode_t)); | 82 | (unsigned long) p->addr + sizeof(kprobe_opcode_t)); |
78 | } | 83 | } |
79 | 84 | ||
85 | void __kprobes arch_remove_kprobe(struct kprobe *p) | ||
86 | { | ||
87 | down(&kprobe_mutex); | ||
88 | free_insn_slot(p->ainsn.insn); | ||
89 | up(&kprobe_mutex); | ||
90 | } | ||
91 | |||
80 | static inline void save_previous_kprobe(struct kprobe_ctlblk *kcb) | 92 | static inline void save_previous_kprobe(struct kprobe_ctlblk *kcb) |
81 | { | 93 | { |
82 | kcb->prev_kprobe.kp = kprobe_running(); | 94 | kcb->prev_kprobe.kp = kprobe_running(); |
@@ -111,7 +123,7 @@ static inline void prepare_singlestep(struct kprobe *p, struct pt_regs *regs) | |||
111 | if (p->opcode == BREAKPOINT_INSTRUCTION) | 123 | if (p->opcode == BREAKPOINT_INSTRUCTION) |
112 | regs->eip = (unsigned long)p->addr; | 124 | regs->eip = (unsigned long)p->addr; |
113 | else | 125 | else |
114 | regs->eip = (unsigned long)&p->ainsn.insn; | 126 | regs->eip = (unsigned long)p->ainsn.insn; |
115 | } | 127 | } |
116 | 128 | ||
117 | /* Called with kretprobe_lock held */ | 129 | /* Called with kretprobe_lock held */ |
@@ -351,7 +363,7 @@ static void __kprobes resume_execution(struct kprobe *p, | |||
351 | { | 363 | { |
352 | unsigned long *tos = (unsigned long *)®s->esp; | 364 | unsigned long *tos = (unsigned long *)®s->esp; |
353 | unsigned long next_eip = 0; | 365 | unsigned long next_eip = 0; |
354 | unsigned long copy_eip = (unsigned long)&p->ainsn.insn; | 366 | unsigned long copy_eip = (unsigned long)p->ainsn.insn; |
355 | unsigned long orig_eip = (unsigned long)p->addr; | 367 | unsigned long orig_eip = (unsigned long)p->addr; |
356 | 368 | ||
357 | switch (p->ainsn.insn[0]) { | 369 | switch (p->ainsn.insn[0]) { |
diff --git a/arch/i386/kernel/mpparse.c b/arch/i386/kernel/mpparse.c index e7609abf3796..e6e2f43db85e 100644 --- a/arch/i386/kernel/mpparse.c +++ b/arch/i386/kernel/mpparse.c | |||
@@ -915,6 +915,7 @@ void __init mp_register_ioapic ( | |||
915 | u32 gsi_base) | 915 | u32 gsi_base) |
916 | { | 916 | { |
917 | int idx = 0; | 917 | int idx = 0; |
918 | int tmpid; | ||
918 | 919 | ||
919 | if (nr_ioapics >= MAX_IO_APICS) { | 920 | if (nr_ioapics >= MAX_IO_APICS) { |
920 | printk(KERN_ERR "ERROR: Max # of I/O APICs (%d) exceeded " | 921 | printk(KERN_ERR "ERROR: Max # of I/O APICs (%d) exceeded " |
@@ -935,9 +936,14 @@ void __init mp_register_ioapic ( | |||
935 | 936 | ||
936 | set_fixmap_nocache(FIX_IO_APIC_BASE_0 + idx, address); | 937 | set_fixmap_nocache(FIX_IO_APIC_BASE_0 + idx, address); |
937 | if ((boot_cpu_data.x86_vendor == X86_VENDOR_INTEL) && (boot_cpu_data.x86 < 15)) | 938 | if ((boot_cpu_data.x86_vendor == X86_VENDOR_INTEL) && (boot_cpu_data.x86 < 15)) |
938 | mp_ioapics[idx].mpc_apicid = io_apic_get_unique_id(idx, id); | 939 | tmpid = io_apic_get_unique_id(idx, id); |
939 | else | 940 | else |
940 | mp_ioapics[idx].mpc_apicid = id; | 941 | tmpid = id; |
942 | if (tmpid == -1) { | ||
943 | nr_ioapics--; | ||
944 | return; | ||
945 | } | ||
946 | mp_ioapics[idx].mpc_apicid = tmpid; | ||
941 | mp_ioapics[idx].mpc_apicver = io_apic_get_version(idx); | 947 | mp_ioapics[idx].mpc_apicver = io_apic_get_version(idx); |
942 | 948 | ||
943 | /* | 949 | /* |
diff --git a/arch/i386/kernel/smpboot.c b/arch/i386/kernel/smpboot.c index fb00ab7b7612..eba7f53f8b4a 100644 --- a/arch/i386/kernel/smpboot.c +++ b/arch/i386/kernel/smpboot.c | |||
@@ -898,12 +898,6 @@ static int __devinit do_boot_cpu(int apicid, int cpu) | |||
898 | unsigned long start_eip; | 898 | unsigned long start_eip; |
899 | unsigned short nmi_high = 0, nmi_low = 0; | 899 | unsigned short nmi_high = 0, nmi_low = 0; |
900 | 900 | ||
901 | if (!cpu_gdt_descr[cpu].address && | ||
902 | !(cpu_gdt_descr[cpu].address = get_zeroed_page(GFP_KERNEL))) { | ||
903 | printk("Failed to allocate GDT for CPU %d\n", cpu); | ||
904 | return 1; | ||
905 | } | ||
906 | |||
907 | ++cpucount; | 901 | ++cpucount; |
908 | 902 | ||
909 | /* | 903 | /* |
diff --git a/arch/i386/mach-default/topology.c b/arch/i386/kernel/topology.c index b64314069e78..67a0e1baa28b 100644 --- a/arch/i386/mach-default/topology.c +++ b/arch/i386/kernel/topology.c | |||
@@ -1,12 +1,12 @@ | |||
1 | /* | 1 | /* |
2 | * arch/i386/mach-generic/topology.c - Populate driverfs with topology information | 2 | * arch/i386/kernel/topology.c - Populate driverfs with topology information |
3 | * | 3 | * |
4 | * Written by: Matthew Dobson, IBM Corporation | 4 | * Written by: Matthew Dobson, IBM Corporation |
5 | * Original Code: Paul Dorwin, IBM Corporation, Patrick Mochel, OSDL | 5 | * Original Code: Paul Dorwin, IBM Corporation, Patrick Mochel, OSDL |
6 | * | 6 | * |
7 | * Copyright (C) 2002, IBM Corp. | 7 | * Copyright (C) 2002, IBM Corp. |
8 | * | 8 | * |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * This program is free software; you can redistribute it and/or modify | 11 | * This program is free software; you can redistribute it and/or modify |
12 | * it under the terms of the GNU General Public License as published by | 12 | * it under the terms of the GNU General Public License as published by |
@@ -34,7 +34,7 @@ static struct i386_cpu cpu_devices[NR_CPUS]; | |||
34 | 34 | ||
35 | int arch_register_cpu(int num){ | 35 | int arch_register_cpu(int num){ |
36 | struct node *parent = NULL; | 36 | struct node *parent = NULL; |
37 | 37 | ||
38 | #ifdef CONFIG_NUMA | 38 | #ifdef CONFIG_NUMA |
39 | int node = cpu_to_node(num); | 39 | int node = cpu_to_node(num); |
40 | if (node_online(node)) | 40 | if (node_online(node)) |
diff --git a/arch/i386/mach-default/Makefile b/arch/i386/mach-default/Makefile index e95bb0237921..012fe34459e6 100644 --- a/arch/i386/mach-default/Makefile +++ b/arch/i386/mach-default/Makefile | |||
@@ -2,4 +2,4 @@ | |||
2 | # Makefile for the linux kernel. | 2 | # Makefile for the linux kernel. |
3 | # | 3 | # |
4 | 4 | ||
5 | obj-y := setup.o topology.o | 5 | obj-y := setup.o |
diff --git a/arch/i386/mach-voyager/voyager_basic.c b/arch/i386/mach-voyager/voyager_basic.c index aa49a33a572c..b584060ec004 100644 --- a/arch/i386/mach-voyager/voyager_basic.c +++ b/arch/i386/mach-voyager/voyager_basic.c | |||
@@ -23,6 +23,8 @@ | |||
23 | #include <linux/delay.h> | 23 | #include <linux/delay.h> |
24 | #include <linux/reboot.h> | 24 | #include <linux/reboot.h> |
25 | #include <linux/sysrq.h> | 25 | #include <linux/sysrq.h> |
26 | #include <linux/smp.h> | ||
27 | #include <linux/nodemask.h> | ||
26 | #include <asm/io.h> | 28 | #include <asm/io.h> |
27 | #include <asm/voyager.h> | 29 | #include <asm/voyager.h> |
28 | #include <asm/vic.h> | 30 | #include <asm/vic.h> |
@@ -328,4 +330,3 @@ void machine_power_off(void) | |||
328 | if (pm_power_off) | 330 | if (pm_power_off) |
329 | pm_power_off(); | 331 | pm_power_off(); |
330 | } | 332 | } |
331 | |||
diff --git a/arch/i386/mach-voyager/voyager_smp.c b/arch/i386/mach-voyager/voyager_smp.c index 6e4c3baef6cc..8165626a5c30 100644 --- a/arch/i386/mach-voyager/voyager_smp.c +++ b/arch/i386/mach-voyager/voyager_smp.c | |||
@@ -402,6 +402,7 @@ find_smp_config(void) | |||
402 | cpus_addr(phys_cpu_present_map)[0] |= voyager_extended_cmos_read(VOYAGER_PROCESSOR_PRESENT_MASK + 1) << 8; | 402 | cpus_addr(phys_cpu_present_map)[0] |= voyager_extended_cmos_read(VOYAGER_PROCESSOR_PRESENT_MASK + 1) << 8; |
403 | cpus_addr(phys_cpu_present_map)[0] |= voyager_extended_cmos_read(VOYAGER_PROCESSOR_PRESENT_MASK + 2) << 16; | 403 | cpus_addr(phys_cpu_present_map)[0] |= voyager_extended_cmos_read(VOYAGER_PROCESSOR_PRESENT_MASK + 2) << 16; |
404 | cpus_addr(phys_cpu_present_map)[0] |= voyager_extended_cmos_read(VOYAGER_PROCESSOR_PRESENT_MASK + 3) << 24; | 404 | cpus_addr(phys_cpu_present_map)[0] |= voyager_extended_cmos_read(VOYAGER_PROCESSOR_PRESENT_MASK + 3) << 24; |
405 | cpu_possible_map = phys_cpu_present_map; | ||
405 | printk("VOYAGER SMP: phys_cpu_present_map = 0x%lx\n", cpus_addr(phys_cpu_present_map)[0]); | 406 | printk("VOYAGER SMP: phys_cpu_present_map = 0x%lx\n", cpus_addr(phys_cpu_present_map)[0]); |
406 | /* Here we set up the VIC to enable SMP */ | 407 | /* Here we set up the VIC to enable SMP */ |
407 | /* enable the CPIs by writing the base vector to their register */ | 408 | /* enable the CPIs by writing the base vector to their register */ |
diff --git a/arch/ia64/Kconfig b/arch/ia64/Kconfig index 845cd0902a50..a85ea9d37f05 100644 --- a/arch/ia64/Kconfig +++ b/arch/ia64/Kconfig | |||
@@ -453,6 +453,7 @@ source "arch/ia64/oprofile/Kconfig" | |||
453 | 453 | ||
454 | config KPROBES | 454 | config KPROBES |
455 | bool "Kprobes (EXPERIMENTAL)" | 455 | bool "Kprobes (EXPERIMENTAL)" |
456 | depends on EXPERIMENTAL && MODULES | ||
456 | help | 457 | help |
457 | Kprobes allows you to trap at almost any kernel address and | 458 | Kprobes allows you to trap at almost any kernel address and |
458 | execute a callback function. register_kprobe() establishes | 459 | execute a callback function. register_kprobe() establishes |
diff --git a/arch/m32r/Makefile b/arch/m32r/Makefile index 983d438b14b6..4b3c90ba926c 100644 --- a/arch/m32r/Makefile +++ b/arch/m32r/Makefile | |||
@@ -12,14 +12,14 @@ CFLAGS_MODULE += -mmodel=large | |||
12 | 12 | ||
13 | ifdef CONFIG_CHIP_VDEC2 | 13 | ifdef CONFIG_CHIP_VDEC2 |
14 | cflags-$(CONFIG_ISA_M32R2) += -DNO_FPU -Wa,-bitinst | 14 | cflags-$(CONFIG_ISA_M32R2) += -DNO_FPU -Wa,-bitinst |
15 | aflags-$(CONFIG_ISA_M32R2) += -DNO_FPU -Wa,-bitinst | 15 | aflags-$(CONFIG_ISA_M32R2) += -DNO_FPU -O2 -Wa,-bitinst -Wa,-no-parallel |
16 | else | 16 | else |
17 | cflags-$(CONFIG_ISA_M32R2) += -DNO_FPU -m32r2 | 17 | cflags-$(CONFIG_ISA_M32R2) += -DNO_FPU -m32r2 |
18 | aflags-$(CONFIG_ISA_M32R2) += -DNO_FPU -m32r2 | 18 | aflags-$(CONFIG_ISA_M32R2) += -DNO_FPU -m32r2 -O2 |
19 | endif | 19 | endif |
20 | 20 | ||
21 | cflags-$(CONFIG_ISA_M32R) += -DNO_FPU | 21 | cflags-$(CONFIG_ISA_M32R) += -DNO_FPU |
22 | aflags-$(CONFIG_ISA_M32R) += -DNO_FPU -Wa,-no-bitinst | 22 | aflags-$(CONFIG_ISA_M32R) += -DNO_FPU -O2 -Wa,-no-bitinst |
23 | 23 | ||
24 | CFLAGS += $(cflags-y) | 24 | CFLAGS += $(cflags-y) |
25 | AFLAGS += $(aflags-y) | 25 | AFLAGS += $(aflags-y) |
diff --git a/arch/m32r/kernel/signal.c b/arch/m32r/kernel/signal.c index 71763f7a1d19..cb33097fefc4 100644 --- a/arch/m32r/kernel/signal.c +++ b/arch/m32r/kernel/signal.c | |||
@@ -36,7 +36,7 @@ int do_signal(struct pt_regs *, sigset_t *); | |||
36 | asmlinkage int | 36 | asmlinkage int |
37 | sys_rt_sigsuspend(sigset_t *unewset, size_t sigsetsize, | 37 | sys_rt_sigsuspend(sigset_t *unewset, size_t sigsetsize, |
38 | unsigned long r2, unsigned long r3, unsigned long r4, | 38 | unsigned long r2, unsigned long r3, unsigned long r4, |
39 | unsigned long r5, unsigned long r6, struct pt_regs regs) | 39 | unsigned long r5, unsigned long r6, struct pt_regs *regs) |
40 | { | 40 | { |
41 | sigset_t saveset, newset; | 41 | sigset_t saveset, newset; |
42 | 42 | ||
@@ -54,21 +54,21 @@ sys_rt_sigsuspend(sigset_t *unewset, size_t sigsetsize, | |||
54 | recalc_sigpending(); | 54 | recalc_sigpending(); |
55 | spin_unlock_irq(¤t->sighand->siglock); | 55 | spin_unlock_irq(¤t->sighand->siglock); |
56 | 56 | ||
57 | regs.r0 = -EINTR; | 57 | regs->r0 = -EINTR; |
58 | while (1) { | 58 | while (1) { |
59 | current->state = TASK_INTERRUPTIBLE; | 59 | current->state = TASK_INTERRUPTIBLE; |
60 | schedule(); | 60 | schedule(); |
61 | if (do_signal(®s, &saveset)) | 61 | if (do_signal(regs, &saveset)) |
62 | return regs.r0; | 62 | return regs->r0; |
63 | } | 63 | } |
64 | } | 64 | } |
65 | 65 | ||
66 | asmlinkage int | 66 | asmlinkage int |
67 | sys_sigaltstack(const stack_t __user *uss, stack_t __user *uoss, | 67 | sys_sigaltstack(const stack_t __user *uss, stack_t __user *uoss, |
68 | unsigned long r2, unsigned long r3, unsigned long r4, | 68 | unsigned long r2, unsigned long r3, unsigned long r4, |
69 | unsigned long r5, unsigned long r6, struct pt_regs regs) | 69 | unsigned long r5, unsigned long r6, struct pt_regs *regs) |
70 | { | 70 | { |
71 | return do_sigaltstack(uss, uoss, regs.spu); | 71 | return do_sigaltstack(uss, uoss, regs->spu); |
72 | } | 72 | } |
73 | 73 | ||
74 | 74 | ||
@@ -140,11 +140,10 @@ restore_sigcontext(struct pt_regs *regs, struct sigcontext __user *sc, | |||
140 | asmlinkage int | 140 | asmlinkage int |
141 | sys_rt_sigreturn(unsigned long r0, unsigned long r1, | 141 | sys_rt_sigreturn(unsigned long r0, unsigned long r1, |
142 | unsigned long r2, unsigned long r3, unsigned long r4, | 142 | unsigned long r2, unsigned long r3, unsigned long r4, |
143 | unsigned long r5, unsigned long r6, struct pt_regs regs) | 143 | unsigned long r5, unsigned long r6, struct pt_regs *regs) |
144 | { | 144 | { |
145 | struct rt_sigframe __user *frame = (struct rt_sigframe __user *)regs.spu; | 145 | struct rt_sigframe __user *frame = (struct rt_sigframe __user *)regs->spu; |
146 | sigset_t set; | 146 | sigset_t set; |
147 | stack_t st; | ||
148 | int result; | 147 | int result; |
149 | 148 | ||
150 | if (!access_ok(VERIFY_READ, frame, sizeof(*frame))) | 149 | if (!access_ok(VERIFY_READ, frame, sizeof(*frame))) |
@@ -158,14 +157,11 @@ sys_rt_sigreturn(unsigned long r0, unsigned long r1, | |||
158 | recalc_sigpending(); | 157 | recalc_sigpending(); |
159 | spin_unlock_irq(¤t->sighand->siglock); | 158 | spin_unlock_irq(¤t->sighand->siglock); |
160 | 159 | ||
161 | if (restore_sigcontext(®s, &frame->uc.uc_mcontext, &result)) | 160 | if (restore_sigcontext(regs, &frame->uc.uc_mcontext, &result)) |
162 | goto badframe; | 161 | goto badframe; |
163 | 162 | ||
164 | if (__copy_from_user(&st, &frame->uc.uc_stack, sizeof(st))) | 163 | if (do_sigaltstack(&frame->uc.uc_stack, NULL, regs->spu) == -EFAULT) |
165 | goto badframe; | 164 | goto badframe; |
166 | /* It is more difficult to avoid calling this function than to | ||
167 | call it and ignore errors. */ | ||
168 | do_sigaltstack(&st, NULL, regs.spu); | ||
169 | 165 | ||
170 | return result; | 166 | return result; |
171 | 167 | ||
diff --git a/arch/m32r/lib/usercopy.c b/arch/m32r/lib/usercopy.c index ce16bbe26a52..2d1dd2106c4d 100644 --- a/arch/m32r/lib/usercopy.c +++ b/arch/m32r/lib/usercopy.c | |||
@@ -64,7 +64,7 @@ do { \ | |||
64 | " .balign 4\n" \ | 64 | " .balign 4\n" \ |
65 | " .long 0b,3b\n" \ | 65 | " .long 0b,3b\n" \ |
66 | ".previous" \ | 66 | ".previous" \ |
67 | : "=r"(res), "=r"(count), "=&r" (__d0), "=&r" (__d1), \ | 67 | : "=&r"(res), "=&r"(count), "=&r" (__d0), "=&r" (__d1), \ |
68 | "=&r" (__d2) \ | 68 | "=&r" (__d2) \ |
69 | : "i"(-EFAULT), "0"(count), "1"(count), "3"(src), \ | 69 | : "i"(-EFAULT), "0"(count), "1"(count), "3"(src), \ |
70 | "4"(dst) \ | 70 | "4"(dst) \ |
@@ -101,7 +101,7 @@ do { \ | |||
101 | " .balign 4\n" \ | 101 | " .balign 4\n" \ |
102 | " .long 0b,3b\n" \ | 102 | " .long 0b,3b\n" \ |
103 | ".previous" \ | 103 | ".previous" \ |
104 | : "=r"(res), "=r"(count), "=&r" (__d0), "=&r" (__d1), \ | 104 | : "=&r"(res), "=&r"(count), "=&r" (__d0), "=&r" (__d1), \ |
105 | "=&r" (__d2) \ | 105 | "=&r" (__d2) \ |
106 | : "i"(-EFAULT), "0"(count), "1"(count), "3"(src), \ | 106 | : "i"(-EFAULT), "0"(count), "1"(count), "3"(src), \ |
107 | "4"(dst) \ | 107 | "4"(dst) \ |
diff --git a/arch/mips/kernel/linux32.c b/arch/mips/kernel/linux32.c index 5f68b220c26d..e00e5f6e7fdd 100644 --- a/arch/mips/kernel/linux32.c +++ b/arch/mips/kernel/linux32.c | |||
@@ -161,60 +161,6 @@ out: | |||
161 | return error; | 161 | return error; |
162 | } | 162 | } |
163 | 163 | ||
164 | struct dirent32 { | ||
165 | unsigned int d_ino; | ||
166 | unsigned int d_off; | ||
167 | unsigned short d_reclen; | ||
168 | char d_name[NAME_MAX + 1]; | ||
169 | }; | ||
170 | |||
171 | static void | ||
172 | xlate_dirent(void *dirent64, void *dirent32, long n) | ||
173 | { | ||
174 | long off; | ||
175 | struct dirent *dirp; | ||
176 | struct dirent32 *dirp32; | ||
177 | |||
178 | off = 0; | ||
179 | while (off < n) { | ||
180 | dirp = (struct dirent *)(dirent64 + off); | ||
181 | dirp32 = (struct dirent32 *)(dirent32 + off); | ||
182 | off += dirp->d_reclen; | ||
183 | dirp32->d_ino = dirp->d_ino; | ||
184 | dirp32->d_off = (unsigned int)dirp->d_off; | ||
185 | dirp32->d_reclen = dirp->d_reclen; | ||
186 | strncpy(dirp32->d_name, dirp->d_name, dirp->d_reclen - ((3 * 4) + 2)); | ||
187 | } | ||
188 | return; | ||
189 | } | ||
190 | |||
191 | asmlinkage long | ||
192 | sys32_getdents(unsigned int fd, void * dirent32, unsigned int count) | ||
193 | { | ||
194 | long n; | ||
195 | void *dirent64; | ||
196 | |||
197 | dirent64 = (void *)((unsigned long)(dirent32 + (sizeof(long) - 1)) & ~(sizeof(long) - 1)); | ||
198 | if ((n = sys_getdents(fd, dirent64, count - (dirent64 - dirent32))) < 0) | ||
199 | return(n); | ||
200 | xlate_dirent(dirent64, dirent32, n); | ||
201 | return(n); | ||
202 | } | ||
203 | |||
204 | asmlinkage int old_readdir(unsigned int fd, void * dirent, unsigned int count); | ||
205 | |||
206 | asmlinkage int | ||
207 | sys32_readdir(unsigned int fd, void * dirent32, unsigned int count) | ||
208 | { | ||
209 | int n; | ||
210 | struct dirent dirent64; | ||
211 | |||
212 | if ((n = old_readdir(fd, &dirent64, count)) < 0) | ||
213 | return(n); | ||
214 | xlate_dirent(&dirent64, dirent32, dirent64.d_reclen); | ||
215 | return(n); | ||
216 | } | ||
217 | |||
218 | asmlinkage int | 164 | asmlinkage int |
219 | sys32_waitpid(compat_pid_t pid, unsigned int *stat_addr, int options) | 165 | sys32_waitpid(compat_pid_t pid, unsigned int *stat_addr, int options) |
220 | { | 166 | { |
diff --git a/arch/mips/kernel/scall32-o32.S b/arch/mips/kernel/scall32-o32.S index d83e033dbc87..2f2dc54b2e26 100644 --- a/arch/mips/kernel/scall32-o32.S +++ b/arch/mips/kernel/scall32-o32.S | |||
@@ -626,7 +626,7 @@ einval: li v0, -EINVAL | |||
626 | sys sys_fstatat64 4 | 626 | sys sys_fstatat64 4 |
627 | sys sys_unlinkat 3 | 627 | sys sys_unlinkat 3 |
628 | sys sys_renameat 4 /* 4295 */ | 628 | sys sys_renameat 4 /* 4295 */ |
629 | sys sys_linkat 4 | 629 | sys sys_linkat 5 |
630 | sys sys_symlinkat 3 | 630 | sys sys_symlinkat 3 |
631 | sys sys_readlinkat 4 | 631 | sys sys_readlinkat 4 |
632 | sys sys_fchmodat 3 | 632 | sys sys_fchmodat 3 |
diff --git a/arch/mips/kernel/scall64-n32.S b/arch/mips/kernel/scall64-n32.S index d87b5446fa13..02c8267e45e7 100644 --- a/arch/mips/kernel/scall64-n32.S +++ b/arch/mips/kernel/scall64-n32.S | |||
@@ -195,7 +195,7 @@ EXPORT(sysn32_call_table) | |||
195 | PTR sys_fdatasync | 195 | PTR sys_fdatasync |
196 | PTR sys_truncate | 196 | PTR sys_truncate |
197 | PTR sys_ftruncate /* 6075 */ | 197 | PTR sys_ftruncate /* 6075 */ |
198 | PTR sys32_getdents | 198 | PTR compat_sys_getdents |
199 | PTR sys_getcwd | 199 | PTR sys_getcwd |
200 | PTR sys_chdir | 200 | PTR sys_chdir |
201 | PTR sys_fchdir | 201 | PTR sys_fchdir |
diff --git a/arch/mips/kernel/scall64-o32.S b/arch/mips/kernel/scall64-o32.S index 5b0414018c9a..797e0d874889 100644 --- a/arch/mips/kernel/scall64-o32.S +++ b/arch/mips/kernel/scall64-o32.S | |||
@@ -293,7 +293,7 @@ sys_call_table: | |||
293 | PTR sys_uselib | 293 | PTR sys_uselib |
294 | PTR sys_swapon | 294 | PTR sys_swapon |
295 | PTR sys_reboot | 295 | PTR sys_reboot |
296 | PTR sys32_readdir | 296 | PTR compat_sys_old_readdir |
297 | PTR old_mmap /* 4090 */ | 297 | PTR old_mmap /* 4090 */ |
298 | PTR sys_munmap | 298 | PTR sys_munmap |
299 | PTR sys_truncate | 299 | PTR sys_truncate |
@@ -345,7 +345,7 @@ sys_call_table: | |||
345 | PTR sys_setfsuid | 345 | PTR sys_setfsuid |
346 | PTR sys_setfsgid | 346 | PTR sys_setfsgid |
347 | PTR sys32_llseek /* 4140 */ | 347 | PTR sys32_llseek /* 4140 */ |
348 | PTR sys32_getdents | 348 | PTR compat_sys_getdents |
349 | PTR compat_sys_select | 349 | PTR compat_sys_select |
350 | PTR sys_flock | 350 | PTR sys_flock |
351 | PTR sys_msync | 351 | PTR sys_msync |
diff --git a/arch/mips/kernel/setup.c b/arch/mips/kernel/setup.c index d86affa21278..d9293c558e41 100644 --- a/arch/mips/kernel/setup.c +++ b/arch/mips/kernel/setup.c | |||
@@ -540,6 +540,9 @@ void __init setup_arch(char **cmdline_p) | |||
540 | sparse_init(); | 540 | sparse_init(); |
541 | paging_init(); | 541 | paging_init(); |
542 | resource_init(); | 542 | resource_init(); |
543 | #ifdef CONFIG_SMP | ||
544 | plat_smp_setup(); | ||
545 | #endif | ||
543 | } | 546 | } |
544 | 547 | ||
545 | int __init fpu_disable(char *s) | 548 | int __init fpu_disable(char *s) |
diff --git a/arch/mips/kernel/smp.c b/arch/mips/kernel/smp.c index 5e189862e523..06ed90752424 100644 --- a/arch/mips/kernel/smp.c +++ b/arch/mips/kernel/smp.c | |||
@@ -236,7 +236,7 @@ void __init smp_prepare_cpus(unsigned int max_cpus) | |||
236 | init_new_context(current, &init_mm); | 236 | init_new_context(current, &init_mm); |
237 | current_thread_info()->cpu = 0; | 237 | current_thread_info()->cpu = 0; |
238 | smp_tune_scheduling(); | 238 | smp_tune_scheduling(); |
239 | prom_prepare_cpus(max_cpus); | 239 | plat_prepare_cpus(max_cpus); |
240 | } | 240 | } |
241 | 241 | ||
242 | /* preload SMP state for boot cpu */ | 242 | /* preload SMP state for boot cpu */ |
diff --git a/arch/mips/kernel/smp_mt.c b/arch/mips/kernel/smp_mt.c index c930364830d0..993b8bf56aaf 100644 --- a/arch/mips/kernel/smp_mt.c +++ b/arch/mips/kernel/smp_mt.c | |||
@@ -143,7 +143,7 @@ static struct irqaction irq_call = { | |||
143 | * Make sure all CPU's are in a sensible state before we boot any of the | 143 | * Make sure all CPU's are in a sensible state before we boot any of the |
144 | * secondarys | 144 | * secondarys |
145 | */ | 145 | */ |
146 | void prom_prepare_cpus(unsigned int max_cpus) | 146 | void plat_smp_setup(void) |
147 | { | 147 | { |
148 | unsigned long val; | 148 | unsigned long val; |
149 | int i, num; | 149 | int i, num; |
@@ -179,11 +179,9 @@ void prom_prepare_cpus(unsigned int max_cpus) | |||
179 | write_vpe_c0_vpeconf0(tmp); | 179 | write_vpe_c0_vpeconf0(tmp); |
180 | 180 | ||
181 | /* Record this as available CPU */ | 181 | /* Record this as available CPU */ |
182 | if (i < max_cpus) { | 182 | cpu_set(i, phys_cpu_present_map); |
183 | cpu_set(i, phys_cpu_present_map); | 183 | __cpu_number_map[i] = ++num; |
184 | __cpu_number_map[i] = ++num; | 184 | __cpu_logical_map[num] = i; |
185 | __cpu_logical_map[num] = i; | ||
186 | } | ||
187 | } | 185 | } |
188 | 186 | ||
189 | /* disable multi-threading with TC's */ | 187 | /* disable multi-threading with TC's */ |
@@ -241,7 +239,10 @@ void prom_prepare_cpus(unsigned int max_cpus) | |||
241 | set_vi_handler (MIPS_CPU_IPI_RESCHED_IRQ, ipi_resched_dispatch); | 239 | set_vi_handler (MIPS_CPU_IPI_RESCHED_IRQ, ipi_resched_dispatch); |
242 | set_vi_handler (MIPS_CPU_IPI_CALL_IRQ, ipi_call_dispatch); | 240 | set_vi_handler (MIPS_CPU_IPI_CALL_IRQ, ipi_call_dispatch); |
243 | } | 241 | } |
242 | } | ||
244 | 243 | ||
244 | void __init plat_prepare_cpus(unsigned int max_cpus) | ||
245 | { | ||
245 | cpu_ipi_resched_irq = MIPSCPU_INT_BASE + MIPS_CPU_IPI_RESCHED_IRQ; | 246 | cpu_ipi_resched_irq = MIPSCPU_INT_BASE + MIPS_CPU_IPI_RESCHED_IRQ; |
246 | cpu_ipi_call_irq = MIPSCPU_INT_BASE + MIPS_CPU_IPI_CALL_IRQ; | 247 | cpu_ipi_call_irq = MIPSCPU_INT_BASE + MIPS_CPU_IPI_CALL_IRQ; |
247 | 248 | ||
diff --git a/arch/mips/pmc-sierra/yosemite/smp.c b/arch/mips/pmc-sierra/yosemite/smp.c index 7f8fda962190..c197311e15d3 100644 --- a/arch/mips/pmc-sierra/yosemite/smp.c +++ b/arch/mips/pmc-sierra/yosemite/smp.c | |||
@@ -50,37 +50,25 @@ void __init prom_grab_secondary(void) | |||
50 | * We don't want to start the secondary CPU yet nor do we have a nice probing | 50 | * We don't want to start the secondary CPU yet nor do we have a nice probing |
51 | * feature in PMON so we just assume presence of the secondary core. | 51 | * feature in PMON so we just assume presence of the secondary core. |
52 | */ | 52 | */ |
53 | static char maxcpus_string[] __initdata = | 53 | void __init plat_smp_setup(void) |
54 | KERN_WARNING "max_cpus set to 0; using 1 instead\n"; | ||
55 | |||
56 | void __init prom_prepare_cpus(unsigned int max_cpus) | ||
57 | { | 54 | { |
58 | int enabled = 0, i; | 55 | int i; |
59 | |||
60 | if (max_cpus == 0) { | ||
61 | printk(maxcpus_string); | ||
62 | max_cpus = 1; | ||
63 | } | ||
64 | 56 | ||
65 | cpus_clear(phys_cpu_present_map); | 57 | cpus_clear(phys_cpu_present_map); |
66 | 58 | ||
67 | for (i = 0; i < 2; i++) { | 59 | for (i = 0; i < 2; i++) { |
68 | if (i == max_cpus) | ||
69 | break; | ||
70 | |||
71 | /* | ||
72 | * The boot CPU | ||
73 | */ | ||
74 | cpu_set(i, phys_cpu_present_map); | 60 | cpu_set(i, phys_cpu_present_map); |
75 | __cpu_number_map[i] = i; | 61 | __cpu_number_map[i] = i; |
76 | __cpu_logical_map[i] = i; | 62 | __cpu_logical_map[i] = i; |
77 | enabled++; | ||
78 | } | 63 | } |
64 | } | ||
79 | 65 | ||
66 | void __init plat_prepare_cpus(unsigned int max_cpus) | ||
67 | { | ||
80 | /* | 68 | /* |
81 | * Be paranoid. Enable the IPI only if we're really about to go SMP. | 69 | * Be paranoid. Enable the IPI only if we're really about to go SMP. |
82 | */ | 70 | */ |
83 | if (enabled > 1) | 71 | if (cpus_weight(cpu_possible_map)) |
84 | set_c0_status(STATUSF_IP5); | 72 | set_c0_status(STATUSF_IP5); |
85 | } | 73 | } |
86 | 74 | ||
diff --git a/arch/mips/sgi-ip27/ip27-smp.c b/arch/mips/sgi-ip27/ip27-smp.c index dbef3f6b5650..09fa7f5216f0 100644 --- a/arch/mips/sgi-ip27/ip27-smp.c +++ b/arch/mips/sgi-ip27/ip27-smp.c | |||
@@ -140,7 +140,7 @@ static __init void intr_clear_all(nasid_t nasid) | |||
140 | REMOTE_HUB_CLR_INTR(nasid, i); | 140 | REMOTE_HUB_CLR_INTR(nasid, i); |
141 | } | 141 | } |
142 | 142 | ||
143 | void __init prom_prepare_cpus(unsigned int max_cpus) | 143 | void __init plat_smp_setup(void) |
144 | { | 144 | { |
145 | cnodeid_t cnode; | 145 | cnodeid_t cnode; |
146 | 146 | ||
@@ -161,6 +161,11 @@ void __init prom_prepare_cpus(unsigned int max_cpus) | |||
161 | alloc_cpupda(0, 0); | 161 | alloc_cpupda(0, 0); |
162 | } | 162 | } |
163 | 163 | ||
164 | void __init plat_prepare_cpus(unsigned int max_cpus) | ||
165 | { | ||
166 | /* We already did everything necessary earlier */ | ||
167 | } | ||
168 | |||
164 | /* | 169 | /* |
165 | * Launch a slave into smp_bootstrap(). It doesn't take an argument, and we | 170 | * Launch a slave into smp_bootstrap(). It doesn't take an argument, and we |
166 | * set sp to the kernel stack of the newly created idle process, gp to the proc | 171 | * set sp to the kernel stack of the newly created idle process, gp to the proc |
diff --git a/arch/mips/sibyte/cfe/smp.c b/arch/mips/sibyte/cfe/smp.c index 4477af3d8074..eab20e2db323 100644 --- a/arch/mips/sibyte/cfe/smp.c +++ b/arch/mips/sibyte/cfe/smp.c | |||
@@ -31,7 +31,7 @@ | |||
31 | * | 31 | * |
32 | * Common setup before any secondaries are started | 32 | * Common setup before any secondaries are started |
33 | */ | 33 | */ |
34 | void __init prom_prepare_cpus(unsigned int max_cpus) | 34 | void __init plat_smp_setup(void) |
35 | { | 35 | { |
36 | int i, num; | 36 | int i, num; |
37 | 37 | ||
@@ -40,14 +40,18 @@ void __init prom_prepare_cpus(unsigned int max_cpus) | |||
40 | __cpu_number_map[0] = 0; | 40 | __cpu_number_map[0] = 0; |
41 | __cpu_logical_map[0] = 0; | 41 | __cpu_logical_map[0] = 0; |
42 | 42 | ||
43 | for (i=1, num=0; i<NR_CPUS; i++) { | 43 | for (i = 1, num = 0; i < NR_CPUS; i++) { |
44 | if (cfe_cpu_stop(i) == 0) { | 44 | if (cfe_cpu_stop(i) == 0) { |
45 | cpu_set(i, phys_cpu_present_map); | 45 | cpu_set(i, phys_cpu_present_map); |
46 | __cpu_number_map[i] = ++num; | 46 | __cpu_number_map[i] = ++num; |
47 | __cpu_logical_map[num] = i; | 47 | __cpu_logical_map[num] = i; |
48 | } | 48 | } |
49 | } | 49 | } |
50 | printk("Detected %i available secondary CPU(s)\n", num); | 50 | printk(KERN_INFO "Detected %i available secondary CPU(s)\n", num); |
51 | } | ||
52 | |||
53 | void __init plat_prepare_cpus(unsigned int max_cpus) | ||
54 | { | ||
51 | } | 55 | } |
52 | 56 | ||
53 | /* | 57 | /* |
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig index d112aed2999b..fec07a12c6cd 100644 --- a/arch/powerpc/Kconfig +++ b/arch/powerpc/Kconfig | |||
@@ -989,7 +989,7 @@ source "arch/powerpc/oprofile/Kconfig" | |||
989 | 989 | ||
990 | config KPROBES | 990 | config KPROBES |
991 | bool "Kprobes (EXPERIMENTAL)" | 991 | bool "Kprobes (EXPERIMENTAL)" |
992 | depends on PPC64 | 992 | depends on PPC64 && EXPERIMENTAL && MODULES |
993 | help | 993 | help |
994 | Kprobes allows you to trap at almost any kernel address and | 994 | Kprobes allows you to trap at almost any kernel address and |
995 | execute a callback function. register_kprobe() establishes | 995 | execute a callback function. register_kprobe() establishes |
diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c index 82d117c60d7f..d63cd562d9d5 100644 --- a/arch/powerpc/kernel/prom.c +++ b/arch/powerpc/kernel/prom.c | |||
@@ -816,8 +816,6 @@ void __init unflatten_device_tree(void) | |||
816 | { | 816 | { |
817 | unsigned long start, mem, size; | 817 | unsigned long start, mem, size; |
818 | struct device_node **allnextp = &allnodes; | 818 | struct device_node **allnextp = &allnodes; |
819 | char *p = NULL; | ||
820 | int l = 0; | ||
821 | 819 | ||
822 | DBG(" -> unflatten_device_tree()\n"); | 820 | DBG(" -> unflatten_device_tree()\n"); |
823 | 821 | ||
@@ -853,19 +851,6 @@ void __init unflatten_device_tree(void) | |||
853 | if (of_chosen == NULL) | 851 | if (of_chosen == NULL) |
854 | of_chosen = of_find_node_by_path("/chosen@0"); | 852 | of_chosen = of_find_node_by_path("/chosen@0"); |
855 | 853 | ||
856 | /* Retreive command line */ | ||
857 | if (of_chosen != NULL) { | ||
858 | p = (char *)get_property(of_chosen, "bootargs", &l); | ||
859 | if (p != NULL && l > 0) | ||
860 | strlcpy(cmd_line, p, min(l, COMMAND_LINE_SIZE)); | ||
861 | } | ||
862 | #ifdef CONFIG_CMDLINE | ||
863 | if (l == 0 || (l == 1 && (*p) == 0)) | ||
864 | strlcpy(cmd_line, CONFIG_CMDLINE, COMMAND_LINE_SIZE); | ||
865 | #endif /* CONFIG_CMDLINE */ | ||
866 | |||
867 | DBG("Command line is: %s\n", cmd_line); | ||
868 | |||
869 | DBG(" <- unflatten_device_tree()\n"); | 854 | DBG(" <- unflatten_device_tree()\n"); |
870 | } | 855 | } |
871 | 856 | ||
@@ -936,6 +921,8 @@ static int __init early_init_dt_scan_chosen(unsigned long node, | |||
936 | { | 921 | { |
937 | u32 *prop; | 922 | u32 *prop; |
938 | unsigned long *lprop; | 923 | unsigned long *lprop; |
924 | unsigned long l; | ||
925 | char *p; | ||
939 | 926 | ||
940 | DBG("search \"chosen\", depth: %d, uname: %s\n", depth, uname); | 927 | DBG("search \"chosen\", depth: %d, uname: %s\n", depth, uname); |
941 | 928 | ||
@@ -1000,6 +987,41 @@ static int __init early_init_dt_scan_chosen(unsigned long node, | |||
1000 | crashk_res.end = crashk_res.start + *lprop - 1; | 987 | crashk_res.end = crashk_res.start + *lprop - 1; |
1001 | #endif | 988 | #endif |
1002 | 989 | ||
990 | /* Retreive command line */ | ||
991 | p = of_get_flat_dt_prop(node, "bootargs", &l); | ||
992 | if (p != NULL && l > 0) | ||
993 | strlcpy(cmd_line, p, min((int)l, COMMAND_LINE_SIZE)); | ||
994 | |||
995 | #ifdef CONFIG_CMDLINE | ||
996 | if (l == 0 || (l == 1 && (*p) == 0)) | ||
997 | strlcpy(cmd_line, CONFIG_CMDLINE, COMMAND_LINE_SIZE); | ||
998 | #endif /* CONFIG_CMDLINE */ | ||
999 | |||
1000 | DBG("Command line is: %s\n", cmd_line); | ||
1001 | |||
1002 | if (strstr(cmd_line, "mem=")) { | ||
1003 | char *p, *q; | ||
1004 | unsigned long maxmem = 0; | ||
1005 | |||
1006 | for (q = cmd_line; (p = strstr(q, "mem=")) != 0; ) { | ||
1007 | q = p + 4; | ||
1008 | if (p > cmd_line && p[-1] != ' ') | ||
1009 | continue; | ||
1010 | maxmem = simple_strtoul(q, &q, 0); | ||
1011 | if (*q == 'k' || *q == 'K') { | ||
1012 | maxmem <<= 10; | ||
1013 | ++q; | ||
1014 | } else if (*q == 'm' || *q == 'M') { | ||
1015 | maxmem <<= 20; | ||
1016 | ++q; | ||
1017 | } else if (*q == 'g' || *q == 'G') { | ||
1018 | maxmem <<= 30; | ||
1019 | ++q; | ||
1020 | } | ||
1021 | } | ||
1022 | memory_limit = maxmem; | ||
1023 | } | ||
1024 | |||
1003 | /* break now */ | 1025 | /* break now */ |
1004 | return 1; | 1026 | return 1; |
1005 | } | 1027 | } |
@@ -1120,7 +1142,7 @@ static void __init early_reserve_mem(void) | |||
1120 | size_32 = *(reserve_map_32++); | 1142 | size_32 = *(reserve_map_32++); |
1121 | if (size_32 == 0) | 1143 | if (size_32 == 0) |
1122 | break; | 1144 | break; |
1123 | DBG("reserving: %lx -> %lx\n", base_32, size_32); | 1145 | DBG("reserving: %x -> %x\n", base_32, size_32); |
1124 | lmb_reserve(base_32, size_32); | 1146 | lmb_reserve(base_32, size_32); |
1125 | } | 1147 | } |
1126 | return; | 1148 | return; |
diff --git a/arch/powerpc/kernel/vdso64/gettimeofday.S b/arch/powerpc/kernel/vdso64/gettimeofday.S index ccaeda5136d1..4ee871f1cadb 100644 --- a/arch/powerpc/kernel/vdso64/gettimeofday.S +++ b/arch/powerpc/kernel/vdso64/gettimeofday.S | |||
@@ -225,9 +225,9 @@ V_FUNCTION_BEGIN(__do_get_xsec) | |||
225 | .cfi_startproc | 225 | .cfi_startproc |
226 | /* check for update count & load values */ | 226 | /* check for update count & load values */ |
227 | 1: ld r8,CFG_TB_UPDATE_COUNT(r3) | 227 | 1: ld r8,CFG_TB_UPDATE_COUNT(r3) |
228 | andi. r0,r4,1 /* pending update ? loop */ | 228 | andi. r0,r8,1 /* pending update ? loop */ |
229 | bne- 1b | 229 | bne- 1b |
230 | xor r0,r4,r4 /* create dependency */ | 230 | xor r0,r8,r8 /* create dependency */ |
231 | add r3,r3,r0 | 231 | add r3,r3,r0 |
232 | 232 | ||
233 | /* Get TB & offset it */ | 233 | /* Get TB & offset it */ |
diff --git a/arch/powerpc/mm/hash_utils_64.c b/arch/powerpc/mm/hash_utils_64.c index ae2c919cbecd..7d9ce9a48219 100644 --- a/arch/powerpc/mm/hash_utils_64.c +++ b/arch/powerpc/mm/hash_utils_64.c | |||
@@ -169,7 +169,7 @@ int htab_bolt_mapping(unsigned long vstart, unsigned long vend, | |||
169 | #ifdef CONFIG_PPC_ISERIES | 169 | #ifdef CONFIG_PPC_ISERIES |
170 | if (_machine == PLATFORM_ISERIES_LPAR) | 170 | if (_machine == PLATFORM_ISERIES_LPAR) |
171 | ret = iSeries_hpte_insert(hpteg, va, | 171 | ret = iSeries_hpte_insert(hpteg, va, |
172 | virt_to_abs(paddr), | 172 | __pa(vaddr), |
173 | tmp_mode, | 173 | tmp_mode, |
174 | HPTE_V_BOLTED, | 174 | HPTE_V_BOLTED, |
175 | psize); | 175 | psize); |
diff --git a/arch/powerpc/platforms/pseries/eeh.c b/arch/powerpc/platforms/pseries/eeh.c index 83578313ee7e..2ab9dcdfb415 100644 --- a/arch/powerpc/platforms/pseries/eeh.c +++ b/arch/powerpc/platforms/pseries/eeh.c | |||
@@ -893,6 +893,20 @@ void eeh_add_device_tree_early(struct device_node *dn) | |||
893 | } | 893 | } |
894 | EXPORT_SYMBOL_GPL(eeh_add_device_tree_early); | 894 | EXPORT_SYMBOL_GPL(eeh_add_device_tree_early); |
895 | 895 | ||
896 | void eeh_add_device_tree_late(struct pci_bus *bus) | ||
897 | { | ||
898 | struct pci_dev *dev; | ||
899 | |||
900 | list_for_each_entry(dev, &bus->devices, bus_list) { | ||
901 | eeh_add_device_late(dev); | ||
902 | if (dev->hdr_type == PCI_HEADER_TYPE_BRIDGE) { | ||
903 | struct pci_bus *subbus = dev->subordinate; | ||
904 | if (subbus) | ||
905 | eeh_add_device_tree_late(subbus); | ||
906 | } | ||
907 | } | ||
908 | } | ||
909 | |||
896 | /** | 910 | /** |
897 | * eeh_add_device_late - perform EEH initialization for the indicated pci device | 911 | * eeh_add_device_late - perform EEH initialization for the indicated pci device |
898 | * @dev: pci device for which to set up EEH | 912 | * @dev: pci device for which to set up EEH |
diff --git a/arch/powerpc/platforms/pseries/eeh_driver.c b/arch/powerpc/platforms/pseries/eeh_driver.c index e3cbba49fd6e..b811d5ff92fe 100644 --- a/arch/powerpc/platforms/pseries/eeh_driver.c +++ b/arch/powerpc/platforms/pseries/eeh_driver.c | |||
@@ -37,7 +37,7 @@ | |||
37 | 37 | ||
38 | static inline const char * pcid_name (struct pci_dev *pdev) | 38 | static inline const char * pcid_name (struct pci_dev *pdev) |
39 | { | 39 | { |
40 | if (pdev->dev.driver) | 40 | if (pdev && pdev->dev.driver) |
41 | return pdev->dev.driver->name; | 41 | return pdev->dev.driver->name; |
42 | return ""; | 42 | return ""; |
43 | } | 43 | } |
diff --git a/arch/powerpc/platforms/pseries/pci_dlpar.c b/arch/powerpc/platforms/pseries/pci_dlpar.c index bdaa8aabdaa6..f3bad900bbcf 100644 --- a/arch/powerpc/platforms/pseries/pci_dlpar.c +++ b/arch/powerpc/platforms/pseries/pci_dlpar.c | |||
@@ -106,6 +106,8 @@ pcibios_fixup_new_pci_devices(struct pci_bus *bus, int fix_bus) | |||
106 | } | 106 | } |
107 | } | 107 | } |
108 | } | 108 | } |
109 | |||
110 | eeh_add_device_tree_late(bus); | ||
109 | } | 111 | } |
110 | EXPORT_SYMBOL_GPL(pcibios_fixup_new_pci_devices); | 112 | EXPORT_SYMBOL_GPL(pcibios_fixup_new_pci_devices); |
111 | 113 | ||
@@ -114,7 +116,6 @@ pcibios_pci_config_bridge(struct pci_dev *dev) | |||
114 | { | 116 | { |
115 | u8 sec_busno; | 117 | u8 sec_busno; |
116 | struct pci_bus *child_bus; | 118 | struct pci_bus *child_bus; |
117 | struct pci_dev *child_dev; | ||
118 | 119 | ||
119 | /* Get busno of downstream bus */ | 120 | /* Get busno of downstream bus */ |
120 | pci_read_config_byte(dev, PCI_SECONDARY_BUS, &sec_busno); | 121 | pci_read_config_byte(dev, PCI_SECONDARY_BUS, &sec_busno); |
@@ -129,10 +130,6 @@ pcibios_pci_config_bridge(struct pci_dev *dev) | |||
129 | 130 | ||
130 | pci_scan_child_bus(child_bus); | 131 | pci_scan_child_bus(child_bus); |
131 | 132 | ||
132 | list_for_each_entry(child_dev, &child_bus->devices, bus_list) { | ||
133 | eeh_add_device_late(child_dev); | ||
134 | } | ||
135 | |||
136 | /* Fixup new pci devices without touching bus struct */ | 133 | /* Fixup new pci devices without touching bus struct */ |
137 | pcibios_fixup_new_pci_devices(child_bus, 0); | 134 | pcibios_fixup_new_pci_devices(child_bus, 0); |
138 | 135 | ||
@@ -160,18 +157,25 @@ pcibios_add_pci_devices(struct pci_bus * bus) | |||
160 | 157 | ||
161 | eeh_add_device_tree_early(dn); | 158 | eeh_add_device_tree_early(dn); |
162 | 159 | ||
163 | /* pci_scan_slot should find all children */ | 160 | if (_machine == PLATFORM_PSERIES_LPAR) { |
164 | slotno = PCI_SLOT(PCI_DN(dn->child)->devfn); | 161 | /* use ofdt-based probe */ |
165 | num = pci_scan_slot(bus, PCI_DEVFN(slotno, 0)); | 162 | of_scan_bus(dn, bus); |
166 | if (num) { | 163 | if (!list_empty(&bus->devices)) { |
167 | pcibios_fixup_new_pci_devices(bus, 1); | 164 | pcibios_fixup_new_pci_devices(bus, 0); |
168 | pci_bus_add_devices(bus); | 165 | pci_bus_add_devices(bus); |
169 | } | 166 | } |
167 | } else { | ||
168 | /* use legacy probe */ | ||
169 | slotno = PCI_SLOT(PCI_DN(dn->child)->devfn); | ||
170 | num = pci_scan_slot(bus, PCI_DEVFN(slotno, 0)); | ||
171 | if (num) { | ||
172 | pcibios_fixup_new_pci_devices(bus, 1); | ||
173 | pci_bus_add_devices(bus); | ||
174 | } | ||
170 | 175 | ||
171 | list_for_each_entry(dev, &bus->devices, bus_list) { | 176 | list_for_each_entry(dev, &bus->devices, bus_list) |
172 | eeh_add_device_late (dev); | 177 | if (dev->hdr_type == PCI_HEADER_TYPE_BRIDGE) |
173 | if (dev->hdr_type == PCI_HEADER_TYPE_BRIDGE) | 178 | pcibios_pci_config_bridge(dev); |
174 | pcibios_pci_config_bridge(dev); | ||
175 | } | 179 | } |
176 | } | 180 | } |
177 | EXPORT_SYMBOL_GPL(pcibios_add_pci_devices); | 181 | EXPORT_SYMBOL_GPL(pcibios_add_pci_devices); |
diff --git a/arch/s390/kernel/compat_wrapper.S b/arch/s390/kernel/compat_wrapper.S index 615964cca15f..50e80138e7ad 100644 --- a/arch/s390/kernel/compat_wrapper.S +++ b/arch/s390/kernel/compat_wrapper.S | |||
@@ -1552,6 +1552,7 @@ sys_linkat_wrapper: | |||
1552 | llgtr %r3,%r3 # const char * | 1552 | llgtr %r3,%r3 # const char * |
1553 | lgfr %r4,%r4 # int | 1553 | lgfr %r4,%r4 # int |
1554 | llgtr %r5,%r5 # const char * | 1554 | llgtr %r5,%r5 # const char * |
1555 | lgfr %r6,%r6 # int | ||
1555 | jg sys_linkat | 1556 | jg sys_linkat |
1556 | 1557 | ||
1557 | .globl sys_symlinkat_wrapper | 1558 | .globl sys_symlinkat_wrapper |
diff --git a/arch/sparc64/Kconfig b/arch/sparc64/Kconfig index ab733be9af08..4c0a50a76554 100644 --- a/arch/sparc64/Kconfig +++ b/arch/sparc64/Kconfig | |||
@@ -383,6 +383,7 @@ source "arch/sparc64/oprofile/Kconfig" | |||
383 | 383 | ||
384 | config KPROBES | 384 | config KPROBES |
385 | bool "Kprobes (EXPERIMENTAL)" | 385 | bool "Kprobes (EXPERIMENTAL)" |
386 | depends on EXPERIMENTAL && MODULES | ||
386 | help | 387 | help |
387 | Kprobes allows you to trap at almost any kernel address and | 388 | Kprobes allows you to trap at almost any kernel address and |
388 | execute a callback function. register_kprobe() establishes | 389 | execute a callback function. register_kprobe() establishes |
diff --git a/arch/sparc64/kernel/setup.c b/arch/sparc64/kernel/setup.c index 054461e6946d..158bd31e15b7 100644 --- a/arch/sparc64/kernel/setup.c +++ b/arch/sparc64/kernel/setup.c | |||
@@ -542,6 +542,8 @@ void __init setup_arch(char **cmdline_p) | |||
542 | } | 542 | } |
543 | #endif | 543 | #endif |
544 | 544 | ||
545 | smp_setup_cpu_possible_map(); | ||
546 | |||
545 | paging_init(); | 547 | paging_init(); |
546 | } | 548 | } |
547 | 549 | ||
diff --git a/arch/sparc64/kernel/smp.c b/arch/sparc64/kernel/smp.c index 1fb6323e65a4..1f7ad8a69052 100644 --- a/arch/sparc64/kernel/smp.c +++ b/arch/sparc64/kernel/smp.c | |||
@@ -1079,18 +1079,12 @@ int setup_profiling_timer(unsigned int multiplier) | |||
1079 | return 0; | 1079 | return 0; |
1080 | } | 1080 | } |
1081 | 1081 | ||
1082 | /* Constrain the number of cpus to max_cpus. */ | ||
1082 | void __init smp_prepare_cpus(unsigned int max_cpus) | 1083 | void __init smp_prepare_cpus(unsigned int max_cpus) |
1083 | { | 1084 | { |
1084 | int instance, mid; | ||
1085 | |||
1086 | instance = 0; | ||
1087 | while (!cpu_find_by_instance(instance, NULL, &mid)) { | ||
1088 | if (mid < max_cpus) | ||
1089 | cpu_set(mid, phys_cpu_present_map); | ||
1090 | instance++; | ||
1091 | } | ||
1092 | |||
1093 | if (num_possible_cpus() > max_cpus) { | 1085 | if (num_possible_cpus() > max_cpus) { |
1086 | int instance, mid; | ||
1087 | |||
1094 | instance = 0; | 1088 | instance = 0; |
1095 | while (!cpu_find_by_instance(instance, NULL, &mid)) { | 1089 | while (!cpu_find_by_instance(instance, NULL, &mid)) { |
1096 | if (mid != boot_cpu_id) { | 1090 | if (mid != boot_cpu_id) { |
@@ -1105,6 +1099,22 @@ void __init smp_prepare_cpus(unsigned int max_cpus) | |||
1105 | smp_store_cpu_info(boot_cpu_id); | 1099 | smp_store_cpu_info(boot_cpu_id); |
1106 | } | 1100 | } |
1107 | 1101 | ||
1102 | /* Set this up early so that things like the scheduler can init | ||
1103 | * properly. We use the same cpu mask for both the present and | ||
1104 | * possible cpu map. | ||
1105 | */ | ||
1106 | void __init smp_setup_cpu_possible_map(void) | ||
1107 | { | ||
1108 | int instance, mid; | ||
1109 | |||
1110 | instance = 0; | ||
1111 | while (!cpu_find_by_instance(instance, NULL, &mid)) { | ||
1112 | if (mid < NR_CPUS) | ||
1113 | cpu_set(mid, phys_cpu_present_map); | ||
1114 | instance++; | ||
1115 | } | ||
1116 | } | ||
1117 | |||
1108 | void __devinit smp_prepare_boot_cpu(void) | 1118 | void __devinit smp_prepare_boot_cpu(void) |
1109 | { | 1119 | { |
1110 | if (hard_smp_processor_id() >= NR_CPUS) { | 1120 | if (hard_smp_processor_id() >= NR_CPUS) { |
diff --git a/arch/um/drivers/cow.h b/arch/um/drivers/cow.h index dc36b222100b..04e3958266e0 100644 --- a/arch/um/drivers/cow.h +++ b/arch/um/drivers/cow.h | |||
@@ -46,7 +46,7 @@ extern int file_reader(__u64 offset, char *buf, int len, void *arg); | |||
46 | extern int read_cow_header(int (*reader)(__u64, char *, int, void *), | 46 | extern int read_cow_header(int (*reader)(__u64, char *, int, void *), |
47 | void *arg, __u32 *version_out, | 47 | void *arg, __u32 *version_out, |
48 | char **backing_file_out, time_t *mtime_out, | 48 | char **backing_file_out, time_t *mtime_out, |
49 | unsigned long long *size_out, int *sectorsize_out, | 49 | __u64 *size_out, int *sectorsize_out, |
50 | __u32 *align_out, int *bitmap_offset_out); | 50 | __u32 *align_out, int *bitmap_offset_out); |
51 | 51 | ||
52 | extern int write_cow_header(char *cow_file, int fd, char *backing_file, | 52 | extern int write_cow_header(char *cow_file, int fd, char *backing_file, |
diff --git a/arch/um/drivers/cow_sys.h b/arch/um/drivers/cow_sys.h index c83fc5d68936..94de4ead4f7a 100644 --- a/arch/um/drivers/cow_sys.h +++ b/arch/um/drivers/cow_sys.h | |||
@@ -23,17 +23,17 @@ static inline char *cow_strdup(char *str) | |||
23 | return(uml_strdup(str)); | 23 | return(uml_strdup(str)); |
24 | } | 24 | } |
25 | 25 | ||
26 | static inline int cow_seek_file(int fd, unsigned long long offset) | 26 | static inline int cow_seek_file(int fd, __u64 offset) |
27 | { | 27 | { |
28 | return(os_seek_file(fd, offset)); | 28 | return(os_seek_file(fd, offset)); |
29 | } | 29 | } |
30 | 30 | ||
31 | static inline int cow_file_size(char *file, unsigned long long *size_out) | 31 | static inline int cow_file_size(char *file, __u64 *size_out) |
32 | { | 32 | { |
33 | return(os_file_size(file, size_out)); | 33 | return(os_file_size(file, size_out)); |
34 | } | 34 | } |
35 | 35 | ||
36 | static inline int cow_write_file(int fd, char *buf, int size) | 36 | static inline int cow_write_file(int fd, void *buf, int size) |
37 | { | 37 | { |
38 | return(os_write_file(fd, buf, size)); | 38 | return(os_write_file(fd, buf, size)); |
39 | } | 39 | } |
diff --git a/arch/um/drivers/cow_user.c b/arch/um/drivers/cow_user.c index fbe2217db5dd..61951b721268 100644 --- a/arch/um/drivers/cow_user.c +++ b/arch/um/drivers/cow_user.c | |||
@@ -176,7 +176,7 @@ int write_cow_header(char *cow_file, int fd, char *backing_file, | |||
176 | err = -ENOMEM; | 176 | err = -ENOMEM; |
177 | header = cow_malloc(sizeof(*header)); | 177 | header = cow_malloc(sizeof(*header)); |
178 | if(header == NULL){ | 178 | if(header == NULL){ |
179 | cow_printf("Failed to allocate COW V3 header\n"); | 179 | cow_printf("write_cow_header - failed to allocate COW V3 header\n"); |
180 | goto out; | 180 | goto out; |
181 | } | 181 | } |
182 | header->magic = htonl(COW_MAGIC); | 182 | header->magic = htonl(COW_MAGIC); |
@@ -196,15 +196,17 @@ int write_cow_header(char *cow_file, int fd, char *backing_file, | |||
196 | 196 | ||
197 | err = os_file_modtime(header->backing_file, &modtime); | 197 | err = os_file_modtime(header->backing_file, &modtime); |
198 | if(err < 0){ | 198 | if(err < 0){ |
199 | cow_printf("Backing file '%s' mtime request failed, " | 199 | cow_printf("write_cow_header - backing file '%s' mtime " |
200 | "err = %d\n", header->backing_file, -err); | 200 | "request failed, err = %d\n", header->backing_file, |
201 | -err); | ||
201 | goto out_free; | 202 | goto out_free; |
202 | } | 203 | } |
203 | 204 | ||
204 | err = cow_file_size(header->backing_file, size); | 205 | err = cow_file_size(header->backing_file, size); |
205 | if(err < 0){ | 206 | if(err < 0){ |
206 | cow_printf("Couldn't get size of backing file '%s', " | 207 | cow_printf("write_cow_header - couldn't get size of " |
207 | "err = %d\n", header->backing_file, -err); | 208 | "backing file '%s', err = %d\n", |
209 | header->backing_file, -err); | ||
208 | goto out_free; | 210 | goto out_free; |
209 | } | 211 | } |
210 | 212 | ||
@@ -214,10 +216,11 @@ int write_cow_header(char *cow_file, int fd, char *backing_file, | |||
214 | header->alignment = htonl(alignment); | 216 | header->alignment = htonl(alignment); |
215 | header->cow_format = COW_BITMAP; | 217 | header->cow_format = COW_BITMAP; |
216 | 218 | ||
217 | err = os_write_file(fd, header, sizeof(*header)); | 219 | err = cow_write_file(fd, header, sizeof(*header)); |
218 | if(err != sizeof(*header)){ | 220 | if(err != sizeof(*header)){ |
219 | cow_printf("Write of header to new COW file '%s' failed, " | 221 | cow_printf("write_cow_header - write of header to " |
220 | "err = %d\n", cow_file, -err); | 222 | "new COW file '%s' failed, err = %d\n", cow_file, |
223 | -err); | ||
221 | goto out_free; | 224 | goto out_free; |
222 | } | 225 | } |
223 | err = 0; | 226 | err = 0; |
@@ -299,7 +302,7 @@ int read_cow_header(int (*reader)(__u64, char *, int, void *), void *arg, | |||
299 | } | 302 | } |
300 | else if(version == 3){ | 303 | else if(version == 3){ |
301 | if(n < sizeof(header->v3)){ | 304 | if(n < sizeof(header->v3)){ |
302 | cow_printf("read_cow_header - failed to read V2 " | 305 | cow_printf("read_cow_header - failed to read V3 " |
303 | "header\n"); | 306 | "header\n"); |
304 | goto out; | 307 | goto out; |
305 | } | 308 | } |
@@ -359,7 +362,8 @@ int init_cow_file(int fd, char *cow_file, char *backing_file, int sectorsize, | |||
359 | if(err != sizeof(zero)){ | 362 | if(err != sizeof(zero)){ |
360 | cow_printf("Write of bitmap to new COW file '%s' failed, " | 363 | cow_printf("Write of bitmap to new COW file '%s' failed, " |
361 | "err = %d\n", cow_file, -err); | 364 | "err = %d\n", cow_file, -err); |
362 | err = -EINVAL; | 365 | if (err >= 0) |
366 | err = -EINVAL; | ||
363 | goto out; | 367 | goto out; |
364 | } | 368 | } |
365 | 369 | ||
diff --git a/arch/um/drivers/net_user.c b/arch/um/drivers/net_user.c index 098fa65981ab..0e2f06187ea7 100644 --- a/arch/um/drivers/net_user.c +++ b/arch/um/drivers/net_user.c | |||
@@ -47,10 +47,12 @@ void tap_check_ips(char *gate_addr, unsigned char *eth_addr) | |||
47 | } | 47 | } |
48 | } | 48 | } |
49 | 49 | ||
50 | /* Do reliable error handling as this fails frequently enough. */ | ||
50 | void read_output(int fd, char *output, int len) | 51 | void read_output(int fd, char *output, int len) |
51 | { | 52 | { |
52 | int remain, n, actual; | 53 | int remain, ret, expected; |
53 | char c; | 54 | char c; |
55 | char *str; | ||
54 | 56 | ||
55 | if(output == NULL){ | 57 | if(output == NULL){ |
56 | output = &c; | 58 | output = &c; |
@@ -58,23 +60,31 @@ void read_output(int fd, char *output, int len) | |||
58 | } | 60 | } |
59 | 61 | ||
60 | *output = '\0'; | 62 | *output = '\0'; |
61 | n = os_read_file(fd, &remain, sizeof(remain)); | 63 | ret = os_read_file(fd, &remain, sizeof(remain)); |
62 | if(n != sizeof(remain)){ | 64 | |
63 | printk("read_output - read of length failed, err = %d\n", -n); | 65 | if (ret != sizeof(remain)) { |
64 | return; | 66 | expected = sizeof(remain); |
67 | str = "length"; | ||
68 | goto err; | ||
65 | } | 69 | } |
66 | 70 | ||
67 | while(remain != 0){ | 71 | while(remain != 0){ |
68 | n = (remain < len) ? remain : len; | 72 | expected = (remain < len) ? remain : len; |
69 | actual = os_read_file(fd, output, n); | 73 | ret = os_read_file(fd, output, expected); |
70 | if(actual != n){ | 74 | if (ret != expected) { |
71 | printk("read_output - read of data failed, " | 75 | str = "data"; |
72 | "err = %d\n", -actual); | 76 | goto err; |
73 | return; | ||
74 | } | 77 | } |
75 | remain -= actual; | 78 | remain -= ret; |
76 | } | 79 | } |
80 | |||
77 | return; | 81 | return; |
82 | |||
83 | err: | ||
84 | if (ret < 0) | ||
85 | printk("read_output - read of %s failed, errno = %d\n", str, -ret); | ||
86 | else | ||
87 | printk("read_output - read of %s failed, read only %d of %d bytes\n", str, ret, expected); | ||
78 | } | 88 | } |
79 | 89 | ||
80 | int net_read(int fd, void *buf, int len) | 90 | int net_read(int fd, void *buf, int len) |
diff --git a/arch/um/drivers/ubd_kern.c b/arch/um/drivers/ubd_kern.c index 101efd26d467..fa617e0719ab 100644 --- a/arch/um/drivers/ubd_kern.c +++ b/arch/um/drivers/ubd_kern.c | |||
@@ -1135,7 +1135,7 @@ static int path_requires_switch(char *from_cmdline, char *from_cow, char *cow) | |||
1135 | static int backing_file_mismatch(char *file, __u64 size, time_t mtime) | 1135 | static int backing_file_mismatch(char *file, __u64 size, time_t mtime) |
1136 | { | 1136 | { |
1137 | unsigned long modtime; | 1137 | unsigned long modtime; |
1138 | long long actual; | 1138 | unsigned long long actual; |
1139 | int err; | 1139 | int err; |
1140 | 1140 | ||
1141 | err = os_file_modtime(file, &modtime); | 1141 | err = os_file_modtime(file, &modtime); |
diff --git a/arch/um/include/init.h b/arch/um/include/init.h index cbd79a8d213d..d4de7c0120ce 100644 --- a/arch/um/include/init.h +++ b/arch/um/include/init.h | |||
@@ -122,7 +122,7 @@ extern struct uml_param __uml_setup_start, __uml_setup_end; | |||
122 | 122 | ||
123 | #define __exitcall(fn) static exitcall_t __exitcall_##fn __exit_call = fn | 123 | #define __exitcall(fn) static exitcall_t __exitcall_##fn __exit_call = fn |
124 | 124 | ||
125 | #define __init_call __attribute__ ((unused,__section__ (".initcall.init"))) | 125 | #define __init_call __attribute_used__ __attribute__ ((__section__ (".initcall.init"))) |
126 | 126 | ||
127 | #endif | 127 | #endif |
128 | 128 | ||
diff --git a/arch/um/include/os.h b/arch/um/include/os.h index eb1710b81255..2a1c64d8d0bf 100644 --- a/arch/um/include/os.h +++ b/arch/um/include/os.h | |||
@@ -179,8 +179,11 @@ extern void os_stop_process(int pid); | |||
179 | extern void os_kill_process(int pid, int reap_child); | 179 | extern void os_kill_process(int pid, int reap_child); |
180 | extern void os_kill_ptraced_process(int pid, int reap_child); | 180 | extern void os_kill_ptraced_process(int pid, int reap_child); |
181 | extern void os_usr1_process(int pid); | 181 | extern void os_usr1_process(int pid); |
182 | extern long os_ptrace_ldt(long pid, long addr, long data); | ||
183 | |||
182 | extern int os_getpid(void); | 184 | extern int os_getpid(void); |
183 | extern int os_getpgrp(void); | 185 | extern int os_getpgrp(void); |
186 | |||
184 | extern void init_new_thread_stack(void *sig_stack, void (*usr1_handler)(int)); | 187 | extern void init_new_thread_stack(void *sig_stack, void (*usr1_handler)(int)); |
185 | extern void init_new_thread_signals(int altstack); | 188 | extern void init_new_thread_signals(int altstack); |
186 | extern int run_kernel_thread(int (*fn)(void *), void *arg, void **jmp_ptr); | 189 | extern int run_kernel_thread(int (*fn)(void *), void *arg, void **jmp_ptr); |
diff --git a/arch/um/os-Linux/file.c b/arch/um/os-Linux/file.c index f55773c819e6..3bd10deea280 100644 --- a/arch/um/os-Linux/file.c +++ b/arch/um/os-Linux/file.c | |||
@@ -272,14 +272,23 @@ int os_connect_socket(char *name) | |||
272 | snprintf(sock.sun_path, sizeof(sock.sun_path), "%s", name); | 272 | snprintf(sock.sun_path, sizeof(sock.sun_path), "%s", name); |
273 | 273 | ||
274 | fd = socket(AF_UNIX, SOCK_STREAM, 0); | 274 | fd = socket(AF_UNIX, SOCK_STREAM, 0); |
275 | if(fd < 0) | 275 | if(fd < 0) { |
276 | return(fd); | 276 | err = -errno; |
277 | goto out; | ||
278 | } | ||
277 | 279 | ||
278 | err = connect(fd, (struct sockaddr *) &sock, sizeof(sock)); | 280 | err = connect(fd, (struct sockaddr *) &sock, sizeof(sock)); |
279 | if(err) | 281 | if(err) { |
280 | return(-errno); | 282 | err = -errno; |
283 | goto out_close; | ||
284 | } | ||
281 | 285 | ||
282 | return(fd); | 286 | return fd; |
287 | |||
288 | out_close: | ||
289 | close(fd); | ||
290 | out: | ||
291 | return err; | ||
283 | } | 292 | } |
284 | 293 | ||
285 | void os_close_file(int fd) | 294 | void os_close_file(int fd) |
diff --git a/arch/um/os-Linux/process.c b/arch/um/os-Linux/process.c index 7f5e2dac2a35..d261888f39c4 100644 --- a/arch/um/os-Linux/process.c +++ b/arch/um/os-Linux/process.c | |||
@@ -19,6 +19,7 @@ | |||
19 | #include "irq_user.h" | 19 | #include "irq_user.h" |
20 | #include "kern_util.h" | 20 | #include "kern_util.h" |
21 | #include "longjmp.h" | 21 | #include "longjmp.h" |
22 | #include "skas_ptrace.h" | ||
22 | 23 | ||
23 | #define ARBITRARY_ADDR -1 | 24 | #define ARBITRARY_ADDR -1 |
24 | #define FAILURE_PID -1 | 25 | #define FAILURE_PID -1 |
@@ -100,6 +101,21 @@ void os_kill_process(int pid, int reap_child) | |||
100 | 101 | ||
101 | } | 102 | } |
102 | 103 | ||
104 | /* This is here uniquely to have access to the userspace errno, i.e. the one | ||
105 | * used by ptrace in case of error. | ||
106 | */ | ||
107 | |||
108 | long os_ptrace_ldt(long pid, long addr, long data) | ||
109 | { | ||
110 | int ret; | ||
111 | |||
112 | ret = ptrace(PTRACE_LDT, pid, addr, data); | ||
113 | |||
114 | if (ret < 0) | ||
115 | return -errno; | ||
116 | return ret; | ||
117 | } | ||
118 | |||
103 | /* Kill off a ptraced child by all means available. kill it normally first, | 119 | /* Kill off a ptraced child by all means available. kill it normally first, |
104 | * then PTRACE_KILL it, then PTRACE_CONT it in case it's in a run state from | 120 | * then PTRACE_KILL it, then PTRACE_CONT it in case it's in a run state from |
105 | * which it can't exit directly. | 121 | * which it can't exit directly. |
diff --git a/arch/um/sys-i386/ldt.c b/arch/um/sys-i386/ldt.c index 1fa09a79a10b..fe0877b3509c 100644 --- a/arch/um/sys-i386/ldt.c +++ b/arch/um/sys-i386/ldt.c | |||
@@ -107,7 +107,7 @@ long write_ldt_entry(struct mm_id * mm_idp, int func, struct user_desc * desc, | |||
107 | * So we need to switch child's mm into our userspace, then | 107 | * So we need to switch child's mm into our userspace, then |
108 | * later switch back. | 108 | * later switch back. |
109 | * | 109 | * |
110 | * Note: I'm unshure: should interrupts be disabled here? | 110 | * Note: I'm unsure: should interrupts be disabled here? |
111 | */ | 111 | */ |
112 | if(!current->active_mm || current->active_mm == &init_mm || | 112 | if(!current->active_mm || current->active_mm == &init_mm || |
113 | mm_idp != ¤t->active_mm->context.skas.id) | 113 | mm_idp != ¤t->active_mm->context.skas.id) |
@@ -129,9 +129,7 @@ long write_ldt_entry(struct mm_id * mm_idp, int func, struct user_desc * desc, | |||
129 | pid = userspace_pid[cpu]; | 129 | pid = userspace_pid[cpu]; |
130 | } | 130 | } |
131 | 131 | ||
132 | res = ptrace(PTRACE_LDT, pid, 0, (unsigned long) &ldt_op); | 132 | res = os_ptrace_ldt(pid, 0, (unsigned long) &ldt_op); |
133 | if(res) | ||
134 | res = errno; | ||
135 | 133 | ||
136 | if(proc_mm) | 134 | if(proc_mm) |
137 | put_cpu(); | 135 | put_cpu(); |
@@ -181,8 +179,7 @@ static long read_ldt_from_host(void __user * ptr, unsigned long bytecount) | |||
181 | */ | 179 | */ |
182 | 180 | ||
183 | cpu = get_cpu(); | 181 | cpu = get_cpu(); |
184 | res = ptrace(PTRACE_LDT, userspace_pid[cpu], 0, | 182 | res = os_ptrace_ldt(userspace_pid[cpu], 0, (unsigned long) &ptrace_ldt); |
185 | (unsigned long) &ptrace_ldt); | ||
186 | put_cpu(); | 183 | put_cpu(); |
187 | if(res < 0) | 184 | if(res < 0) |
188 | goto out; | 185 | goto out; |
diff --git a/arch/x86_64/Kconfig b/arch/x86_64/Kconfig index 2f9deca31cc9..e18eb79bf855 100644 --- a/arch/x86_64/Kconfig +++ b/arch/x86_64/Kconfig | |||
@@ -354,21 +354,6 @@ config HPET_TIMER | |||
354 | as it is off-chip. You can find the HPET spec at | 354 | as it is off-chip. You can find the HPET spec at |
355 | <http://www.intel.com/hardwaredesign/hpetspec.htm>. | 355 | <http://www.intel.com/hardwaredesign/hpetspec.htm>. |
356 | 356 | ||
357 | config X86_PM_TIMER | ||
358 | bool "PM timer" if EMBEDDED | ||
359 | depends on ACPI | ||
360 | default y | ||
361 | help | ||
362 | Support the ACPI PM timer for time keeping. This is slow, | ||
363 | but is useful on some chipsets without HPET on systems with more | ||
364 | than one CPU. On a single processor or single socket multi core | ||
365 | system it is normally not required. | ||
366 | When the PM timer is active 64bit vsyscalls are disabled | ||
367 | and should not be enabled (/proc/sys/kernel/vsyscall64 should | ||
368 | not be changed). | ||
369 | The kernel selects the PM timer only as a last resort, so it is | ||
370 | useful to enable just in case. | ||
371 | |||
372 | config HPET_EMULATE_RTC | 357 | config HPET_EMULATE_RTC |
373 | bool "Provide RTC interrupt" | 358 | bool "Provide RTC interrupt" |
374 | depends on HPET_TIMER && RTC=y | 359 | depends on HPET_TIMER && RTC=y |
@@ -592,6 +577,7 @@ source "arch/x86_64/oprofile/Kconfig" | |||
592 | 577 | ||
593 | config KPROBES | 578 | config KPROBES |
594 | bool "Kprobes (EXPERIMENTAL)" | 579 | bool "Kprobes (EXPERIMENTAL)" |
580 | depends on EXPERIMENTAL && MODULES | ||
595 | help | 581 | help |
596 | Kprobes allows you to trap at almost any kernel address and | 582 | Kprobes allows you to trap at almost any kernel address and |
597 | execute a callback function. register_kprobe() establishes | 583 | execute a callback function. register_kprobe() establishes |
diff --git a/arch/x86_64/kernel/Makefile b/arch/x86_64/kernel/Makefile index 72fe60c20d39..a098a11e7755 100644 --- a/arch/x86_64/kernel/Makefile +++ b/arch/x86_64/kernel/Makefile | |||
@@ -43,7 +43,7 @@ CFLAGS_vsyscall.o := $(PROFILING) -g0 | |||
43 | 43 | ||
44 | bootflag-y += ../../i386/kernel/bootflag.o | 44 | bootflag-y += ../../i386/kernel/bootflag.o |
45 | cpuid-$(subst m,y,$(CONFIG_X86_CPUID)) += ../../i386/kernel/cpuid.o | 45 | cpuid-$(subst m,y,$(CONFIG_X86_CPUID)) += ../../i386/kernel/cpuid.o |
46 | topology-y += ../../i386/mach-default/topology.o | 46 | topology-y += ../../i386/kernel/topology.o |
47 | microcode-$(subst m,y,$(CONFIG_MICROCODE)) += ../../i386/kernel/microcode.o | 47 | microcode-$(subst m,y,$(CONFIG_MICROCODE)) += ../../i386/kernel/microcode.o |
48 | intel_cacheinfo-y += ../../i386/kernel/cpu/intel_cacheinfo.o | 48 | intel_cacheinfo-y += ../../i386/kernel/cpu/intel_cacheinfo.o |
49 | quirks-y += ../../i386/kernel/quirks.o | 49 | quirks-y += ../../i386/kernel/quirks.o |
diff --git a/arch/x86_64/kernel/aperture.c b/arch/x86_64/kernel/aperture.c index e4e2b7d01f89..a0f955b9995f 100644 --- a/arch/x86_64/kernel/aperture.c +++ b/arch/x86_64/kernel/aperture.c | |||
@@ -248,7 +248,7 @@ void __init iommu_hole_init(void) | |||
248 | /* Got the aperture from the AGP bridge */ | 248 | /* Got the aperture from the AGP bridge */ |
249 | } else if (swiotlb && !valid_agp) { | 249 | } else if (swiotlb && !valid_agp) { |
250 | /* Do nothing */ | 250 | /* Do nothing */ |
251 | } else if ((!no_iommu && end_pfn >= MAX_DMA32_PFN) || | 251 | } else if ((!no_iommu && end_pfn > MAX_DMA32_PFN) || |
252 | force_iommu || | 252 | force_iommu || |
253 | valid_agp || | 253 | valid_agp || |
254 | fallback_aper_force) { | 254 | fallback_aper_force) { |
diff --git a/arch/x86_64/kernel/io_apic.c b/arch/x86_64/kernel/io_apic.c index 2585c1d92b26..ffed464e6b12 100644 --- a/arch/x86_64/kernel/io_apic.c +++ b/arch/x86_64/kernel/io_apic.c | |||
@@ -50,6 +50,8 @@ static int no_timer_check; | |||
50 | 50 | ||
51 | int disable_timer_pin_1 __initdata; | 51 | int disable_timer_pin_1 __initdata; |
52 | 52 | ||
53 | int timer_over_8254 __initdata = 1; | ||
54 | |||
53 | /* Where if anywhere is the i8259 connect in external int mode */ | 55 | /* Where if anywhere is the i8259 connect in external int mode */ |
54 | static struct { int pin, apic; } ioapic_i8259 = { -1, -1 }; | 56 | static struct { int pin, apic; } ioapic_i8259 = { -1, -1 }; |
55 | 57 | ||
@@ -251,6 +253,20 @@ static int __init enable_ioapic_setup(char *str) | |||
251 | __setup("noapic", disable_ioapic_setup); | 253 | __setup("noapic", disable_ioapic_setup); |
252 | __setup("apic", enable_ioapic_setup); | 254 | __setup("apic", enable_ioapic_setup); |
253 | 255 | ||
256 | static int __init setup_disable_8254_timer(char *s) | ||
257 | { | ||
258 | timer_over_8254 = -1; | ||
259 | return 1; | ||
260 | } | ||
261 | static int __init setup_enable_8254_timer(char *s) | ||
262 | { | ||
263 | timer_over_8254 = 2; | ||
264 | return 1; | ||
265 | } | ||
266 | |||
267 | __setup("disable_8254_timer", setup_disable_8254_timer); | ||
268 | __setup("enable_8254_timer", setup_enable_8254_timer); | ||
269 | |||
254 | #include <asm/pci-direct.h> | 270 | #include <asm/pci-direct.h> |
255 | #include <linux/pci_ids.h> | 271 | #include <linux/pci_ids.h> |
256 | #include <linux/pci.h> | 272 | #include <linux/pci.h> |
@@ -309,27 +325,20 @@ void __init check_ioapic(void) | |||
309 | #endif | 325 | #endif |
310 | /* RED-PEN skip them on mptables too? */ | 326 | /* RED-PEN skip them on mptables too? */ |
311 | return; | 327 | return; |
328 | |||
329 | /* This should be actually default, but | ||
330 | for 2.6.16 let's do it for ATI only where | ||
331 | it's really needed. */ | ||
312 | case PCI_VENDOR_ID_ATI: | 332 | case PCI_VENDOR_ID_ATI: |
313 | if (apic_runs_main_timer != 0) | 333 | if (timer_over_8254 == 1) { |
314 | break; | 334 | timer_over_8254 = 0; |
315 | #ifdef CONFIG_ACPI | ||
316 | /* Don't do this for laptops right | ||
317 | right now because their timer | ||
318 | doesn't necessarily tick in C2/3 */ | ||
319 | if (acpi_fadt.revision >= 3 && | ||
320 | (acpi_fadt.plvl2_lat + acpi_fadt.plvl3_lat) < 1100) { | ||
321 | printk(KERN_INFO | ||
322 | "ATI board detected, but seems to be a laptop. Timer might be shakey, sorry\n"); | ||
323 | break; | ||
324 | } | ||
325 | #endif | ||
326 | printk(KERN_INFO | 335 | printk(KERN_INFO |
327 | "ATI board detected. Using APIC/PM timer.\n"); | 336 | "ATI board detected. Disabling timer routing over 8254.\n"); |
328 | apic_runs_main_timer = 1; | 337 | } |
329 | nohpet = 1; | ||
330 | return; | 338 | return; |
331 | } | 339 | } |
332 | 340 | ||
341 | |||
333 | /* No multi-function device? */ | 342 | /* No multi-function device? */ |
334 | type = read_pci_config_byte(num,slot,func, | 343 | type = read_pci_config_byte(num,slot,func, |
335 | PCI_HEADER_TYPE); | 344 | PCI_HEADER_TYPE); |
@@ -1773,6 +1782,8 @@ static inline void unlock_ExtINT_logic(void) | |||
1773 | * a wide range of boards and BIOS bugs. Fortunately only the timer IRQ | 1782 | * a wide range of boards and BIOS bugs. Fortunately only the timer IRQ |
1774 | * is so screwy. Thanks to Brian Perkins for testing/hacking this beast | 1783 | * is so screwy. Thanks to Brian Perkins for testing/hacking this beast |
1775 | * fanatically on his truly buggy board. | 1784 | * fanatically on his truly buggy board. |
1785 | * | ||
1786 | * FIXME: really need to revamp this for modern platforms only. | ||
1776 | */ | 1787 | */ |
1777 | static inline void check_timer(void) | 1788 | static inline void check_timer(void) |
1778 | { | 1789 | { |
@@ -1795,7 +1806,8 @@ static inline void check_timer(void) | |||
1795 | */ | 1806 | */ |
1796 | apic_write(APIC_LVT0, APIC_LVT_MASKED | APIC_DM_EXTINT); | 1807 | apic_write(APIC_LVT0, APIC_LVT_MASKED | APIC_DM_EXTINT); |
1797 | init_8259A(1); | 1808 | init_8259A(1); |
1798 | enable_8259A_irq(0); | 1809 | if (timer_over_8254 > 0) |
1810 | enable_8259A_irq(0); | ||
1799 | 1811 | ||
1800 | pin1 = find_isa_irq_pin(0, mp_INT); | 1812 | pin1 = find_isa_irq_pin(0, mp_INT); |
1801 | apic1 = find_isa_irq_apic(0, mp_INT); | 1813 | apic1 = find_isa_irq_apic(0, mp_INT); |
@@ -1850,7 +1862,7 @@ static inline void check_timer(void) | |||
1850 | } | 1862 | } |
1851 | printk(" failed.\n"); | 1863 | printk(" failed.\n"); |
1852 | 1864 | ||
1853 | if (nmi_watchdog) { | 1865 | if (nmi_watchdog == NMI_IO_APIC) { |
1854 | printk(KERN_WARNING "timer doesn't work through the IO-APIC - disabling NMI Watchdog!\n"); | 1866 | printk(KERN_WARNING "timer doesn't work through the IO-APIC - disabling NMI Watchdog!\n"); |
1855 | nmi_watchdog = 0; | 1867 | nmi_watchdog = 0; |
1856 | } | 1868 | } |
diff --git a/arch/x86_64/kernel/pci-gart.c b/arch/x86_64/kernel/pci-gart.c index dd0718dc178b..0c3f052ba6ce 100644 --- a/arch/x86_64/kernel/pci-gart.c +++ b/arch/x86_64/kernel/pci-gart.c | |||
@@ -228,11 +228,6 @@ static inline int need_iommu(struct device *dev, unsigned long addr, size_t size | |||
228 | int mmu = high; | 228 | int mmu = high; |
229 | if (force_iommu) | 229 | if (force_iommu) |
230 | mmu = 1; | 230 | mmu = 1; |
231 | if (no_iommu) { | ||
232 | if (high) | ||
233 | panic("PCI-DMA: high address but no IOMMU.\n"); | ||
234 | mmu = 0; | ||
235 | } | ||
236 | return mmu; | 231 | return mmu; |
237 | } | 232 | } |
238 | 233 | ||
@@ -241,11 +236,6 @@ static inline int nonforced_iommu(struct device *dev, unsigned long addr, size_t | |||
241 | u64 mask = *dev->dma_mask; | 236 | u64 mask = *dev->dma_mask; |
242 | int high = addr + size >= mask; | 237 | int high = addr + size >= mask; |
243 | int mmu = high; | 238 | int mmu = high; |
244 | if (no_iommu) { | ||
245 | if (high) | ||
246 | panic("PCI-DMA: high address but no IOMMU.\n"); | ||
247 | mmu = 0; | ||
248 | } | ||
249 | return mmu; | 239 | return mmu; |
250 | } | 240 | } |
251 | 241 | ||
@@ -310,7 +300,7 @@ void gart_unmap_sg(struct device *dev, struct scatterlist *sg, int nents, int di | |||
310 | 300 | ||
311 | for (i = 0; i < nents; i++) { | 301 | for (i = 0; i < nents; i++) { |
312 | struct scatterlist *s = &sg[i]; | 302 | struct scatterlist *s = &sg[i]; |
313 | if (!s->dma_length) | 303 | if (!s->dma_length || !s->length) |
314 | break; | 304 | break; |
315 | dma_unmap_single(dev, s->dma_address, s->dma_length, dir); | 305 | dma_unmap_single(dev, s->dma_address, s->dma_length, dir); |
316 | } | 306 | } |
@@ -364,6 +354,7 @@ static int __dma_map_cont(struct scatterlist *sg, int start, int stopat, | |||
364 | 354 | ||
365 | BUG_ON(i > start && s->offset); | 355 | BUG_ON(i > start && s->offset); |
366 | if (i == start) { | 356 | if (i == start) { |
357 | *sout = *s; | ||
367 | sout->dma_address = iommu_bus_base; | 358 | sout->dma_address = iommu_bus_base; |
368 | sout->dma_address += iommu_page*PAGE_SIZE + s->offset; | 359 | sout->dma_address += iommu_page*PAGE_SIZE + s->offset; |
369 | sout->dma_length = s->length; | 360 | sout->dma_length = s->length; |
@@ -390,6 +381,7 @@ static inline int dma_map_cont(struct scatterlist *sg, int start, int stopat, | |||
390 | { | 381 | { |
391 | if (!need) { | 382 | if (!need) { |
392 | BUG_ON(stopat - start != 1); | 383 | BUG_ON(stopat - start != 1); |
384 | *sout = sg[start]; | ||
393 | sout->dma_length = sg[start].length; | 385 | sout->dma_length = sg[start].length; |
394 | return 0; | 386 | return 0; |
395 | } | 387 | } |
@@ -632,17 +624,13 @@ static int __init pci_iommu_init(void) | |||
632 | (agp_copy_info(agp_bridge, &info) < 0); | 624 | (agp_copy_info(agp_bridge, &info) < 0); |
633 | #endif | 625 | #endif |
634 | 626 | ||
635 | if (swiotlb) { | 627 | if (swiotlb) |
636 | no_iommu = 1; | ||
637 | return -1; | 628 | return -1; |
638 | } | 629 | |
639 | |||
640 | if (no_iommu || | 630 | if (no_iommu || |
641 | (!force_iommu && end_pfn <= MAX_DMA32_PFN) || | 631 | (!force_iommu && end_pfn <= MAX_DMA32_PFN) || |
642 | !iommu_aperture || | 632 | !iommu_aperture || |
643 | (no_agp && init_k8_gatt(&info) < 0)) { | 633 | (no_agp && init_k8_gatt(&info) < 0)) { |
644 | no_iommu = 1; | ||
645 | no_iommu_init(); | ||
646 | printk(KERN_INFO "PCI-DMA: Disabling IOMMU.\n"); | 634 | printk(KERN_INFO "PCI-DMA: Disabling IOMMU.\n"); |
647 | if (end_pfn > MAX_DMA32_PFN) { | 635 | if (end_pfn > MAX_DMA32_PFN) { |
648 | printk(KERN_ERR "WARNING more than 4GB of memory " | 636 | printk(KERN_ERR "WARNING more than 4GB of memory " |
diff --git a/arch/x86_64/kernel/setup.c b/arch/x86_64/kernel/setup.c index 9435ab7d6fb8..aa55e3cec665 100644 --- a/arch/x86_64/kernel/setup.c +++ b/arch/x86_64/kernel/setup.c | |||
@@ -423,6 +423,12 @@ static __init void parse_cmdline_early (char ** cmdline_p) | |||
423 | else if(!memcmp(from, "elfcorehdr=", 11)) | 423 | else if(!memcmp(from, "elfcorehdr=", 11)) |
424 | elfcorehdr_addr = memparse(from+11, &from); | 424 | elfcorehdr_addr = memparse(from+11, &from); |
425 | #endif | 425 | #endif |
426 | |||
427 | #ifdef CONFIG_HOTPLUG_CPU | ||
428 | else if (!memcmp(from, "additional_cpus=", 16)) | ||
429 | setup_additional_cpus(from+16); | ||
430 | #endif | ||
431 | |||
426 | next_char: | 432 | next_char: |
427 | c = *(from++); | 433 | c = *(from++); |
428 | if (!c) | 434 | if (!c) |
diff --git a/arch/x86_64/kernel/smpboot.c b/arch/x86_64/kernel/smpboot.c index 67e4e28f4df8..66e98659d077 100644 --- a/arch/x86_64/kernel/smpboot.c +++ b/arch/x86_64/kernel/smpboot.c | |||
@@ -1152,8 +1152,6 @@ void __init smp_cpus_done(unsigned int max_cpus) | |||
1152 | setup_ioapic_dest(); | 1152 | setup_ioapic_dest(); |
1153 | #endif | 1153 | #endif |
1154 | 1154 | ||
1155 | time_init_gtod(); | ||
1156 | |||
1157 | check_nmi_watchdog(); | 1155 | check_nmi_watchdog(); |
1158 | } | 1156 | } |
1159 | 1157 | ||
@@ -1244,7 +1242,7 @@ void __cpu_die(unsigned int cpu) | |||
1244 | printk(KERN_ERR "CPU %u didn't die...\n", cpu); | 1242 | printk(KERN_ERR "CPU %u didn't die...\n", cpu); |
1245 | } | 1243 | } |
1246 | 1244 | ||
1247 | static __init int setup_additional_cpus(char *s) | 1245 | __init int setup_additional_cpus(char *s) |
1248 | { | 1246 | { |
1249 | return get_option(&s, &additional_cpus); | 1247 | return get_option(&s, &additional_cpus); |
1250 | } | 1248 | } |
diff --git a/arch/x86_64/kernel/time.c b/arch/x86_64/kernel/time.c index 67841d11ed1f..3080f84bf7b7 100644 --- a/arch/x86_64/kernel/time.c +++ b/arch/x86_64/kernel/time.c | |||
@@ -48,6 +48,8 @@ static void cpufreq_delayed_get(void); | |||
48 | extern void i8254_timer_resume(void); | 48 | extern void i8254_timer_resume(void); |
49 | extern int using_apic_timer; | 49 | extern int using_apic_timer; |
50 | 50 | ||
51 | static char *time_init_gtod(void); | ||
52 | |||
51 | DEFINE_SPINLOCK(rtc_lock); | 53 | DEFINE_SPINLOCK(rtc_lock); |
52 | DEFINE_SPINLOCK(i8253_lock); | 54 | DEFINE_SPINLOCK(i8253_lock); |
53 | 55 | ||
@@ -901,6 +903,7 @@ static struct irqaction irq0 = { | |||
901 | void __init time_init(void) | 903 | void __init time_init(void) |
902 | { | 904 | { |
903 | char *timename; | 905 | char *timename; |
906 | char *gtod; | ||
904 | 907 | ||
905 | #ifdef HPET_HACK_ENABLE_DANGEROUS | 908 | #ifdef HPET_HACK_ENABLE_DANGEROUS |
906 | if (!vxtime.hpet_address) { | 909 | if (!vxtime.hpet_address) { |
@@ -945,21 +948,19 @@ void __init time_init(void) | |||
945 | timename = "PIT"; | 948 | timename = "PIT"; |
946 | } | 949 | } |
947 | 950 | ||
948 | printk(KERN_INFO "time.c: Using %ld.%06ld MHz %s timer.\n", | 951 | vxtime.mode = VXTIME_TSC; |
949 | vxtime_hz / 1000000, vxtime_hz % 1000000, timename); | 952 | gtod = time_init_gtod(); |
953 | |||
954 | printk(KERN_INFO "time.c: Using %ld.%06ld MHz WALL %s GTOD %s timer.\n", | ||
955 | vxtime_hz / 1000000, vxtime_hz % 1000000, timename, gtod); | ||
950 | printk(KERN_INFO "time.c: Detected %d.%03d MHz processor.\n", | 956 | printk(KERN_INFO "time.c: Detected %d.%03d MHz processor.\n", |
951 | cpu_khz / 1000, cpu_khz % 1000); | 957 | cpu_khz / 1000, cpu_khz % 1000); |
952 | vxtime.mode = VXTIME_TSC; | ||
953 | vxtime.quot = (1000000L << 32) / vxtime_hz; | 958 | vxtime.quot = (1000000L << 32) / vxtime_hz; |
954 | vxtime.tsc_quot = (1000L << 32) / cpu_khz; | 959 | vxtime.tsc_quot = (1000L << 32) / cpu_khz; |
955 | vxtime.last_tsc = get_cycles_sync(); | 960 | vxtime.last_tsc = get_cycles_sync(); |
956 | setup_irq(0, &irq0); | 961 | setup_irq(0, &irq0); |
957 | 962 | ||
958 | set_cyc2ns_scale(cpu_khz); | 963 | set_cyc2ns_scale(cpu_khz); |
959 | |||
960 | #ifndef CONFIG_SMP | ||
961 | time_init_gtod(); | ||
962 | #endif | ||
963 | } | 964 | } |
964 | 965 | ||
965 | /* | 966 | /* |
@@ -981,9 +982,9 @@ __cpuinit int unsynchronized_tsc(void) | |||
981 | } | 982 | } |
982 | 983 | ||
983 | /* | 984 | /* |
984 | * Decide after all CPUs are booted what mode gettimeofday should use. | 985 | * Decide what mode gettimeofday should use. |
985 | */ | 986 | */ |
986 | void __init time_init_gtod(void) | 987 | __init static char *time_init_gtod(void) |
987 | { | 988 | { |
988 | char *timetype; | 989 | char *timetype; |
989 | 990 | ||
@@ -1011,8 +1012,7 @@ void __init time_init_gtod(void) | |||
1011 | timetype = hpet_use_timer ? "HPET/TSC" : "PIT/TSC"; | 1012 | timetype = hpet_use_timer ? "HPET/TSC" : "PIT/TSC"; |
1012 | vxtime.mode = VXTIME_TSC; | 1013 | vxtime.mode = VXTIME_TSC; |
1013 | } | 1014 | } |
1014 | 1015 | return timetype; | |
1015 | printk(KERN_INFO "time.c: Using %s based timekeeping.\n", timetype); | ||
1016 | } | 1016 | } |
1017 | 1017 | ||
1018 | __setup("report_lost_ticks", time_setup); | 1018 | __setup("report_lost_ticks", time_setup); |
diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig index 0cce28c4025b..33e2ca847a26 100644 --- a/drivers/acpi/Kconfig +++ b/drivers/acpi/Kconfig | |||
@@ -247,7 +247,7 @@ config ACPI_CUSTOM_DSDT_FILE | |||
247 | Enter the full path name to the file wich includes the AmlCode declaration. | 247 | Enter the full path name to the file wich includes the AmlCode declaration. |
248 | 248 | ||
249 | config ACPI_BLACKLIST_YEAR | 249 | config ACPI_BLACKLIST_YEAR |
250 | int "Disable ACPI for systems before Jan 1st this year" if X86 | 250 | int "Disable ACPI for systems before Jan 1st this year" if X86_32 |
251 | default 0 | 251 | default 0 |
252 | help | 252 | help |
253 | enter a 4-digit year, eg. 2001 to disable ACPI by default | 253 | enter a 4-digit year, eg. 2001 to disable ACPI by default |
@@ -285,9 +285,8 @@ config ACPI_SYSTEM | |||
285 | dump your ACPI DSDT table using /proc/acpi/dsdt. | 285 | dump your ACPI DSDT table using /proc/acpi/dsdt. |
286 | 286 | ||
287 | config X86_PM_TIMER | 287 | config X86_PM_TIMER |
288 | bool "Power Management Timer Support" | 288 | bool "Power Management Timer Support" if EMBEDDED |
289 | depends on X86 | 289 | depends on X86 |
290 | depends on !X86_64 | ||
291 | default y | 290 | default y |
292 | help | 291 | help |
293 | The Power Management Timer is available on all ACPI-capable, | 292 | The Power Management Timer is available on all ACPI-capable, |
@@ -298,9 +297,8 @@ config X86_PM_TIMER | |||
298 | voltage scaling, unlike the commonly used Time Stamp Counter | 297 | voltage scaling, unlike the commonly used Time Stamp Counter |
299 | (TSC) timing source. | 298 | (TSC) timing source. |
300 | 299 | ||
301 | So, if you see messages like 'Losing too many ticks!' in the | 300 | You should nearly always say Y here because many modern |
302 | kernel logs, and/or you are using this on a notebook which | 301 | systems require this timer. |
303 | does not yet have an HPET, you should say "Y" here. | ||
304 | 302 | ||
305 | config ACPI_CONTAINER | 303 | config ACPI_CONTAINER |
306 | tristate "ACPI0004,PNP0A05 and PNP0A06 Container Driver (EXPERIMENTAL)" | 304 | tristate "ACPI0004,PNP0A05 and PNP0A06 Container Driver (EXPERIMENTAL)" |
diff --git a/drivers/char/sx.c b/drivers/char/sx.c index c2490e270f1f..a6b4f02bdceb 100644 --- a/drivers/char/sx.c +++ b/drivers/char/sx.c | |||
@@ -1095,17 +1095,17 @@ static inline void sx_receive_chars (struct sx_port *port) | |||
1095 | 1095 | ||
1096 | sx_dprintk (SX_DEBUG_RECEIVE, "rxop=%d, c = %d.\n", rx_op, c); | 1096 | sx_dprintk (SX_DEBUG_RECEIVE, "rxop=%d, c = %d.\n", rx_op, c); |
1097 | 1097 | ||
1098 | /* Don't copy past the end of the hardware receive buffer */ | ||
1099 | if (rx_op + c > 0x100) c = 0x100 - rx_op; | ||
1100 | |||
1101 | sx_dprintk (SX_DEBUG_RECEIVE, "c = %d.\n", c); | ||
1102 | |||
1098 | /* Don't copy more bytes than there is room for in the buffer */ | 1103 | /* Don't copy more bytes than there is room for in the buffer */ |
1099 | 1104 | ||
1100 | c = tty_prepare_flip_string(tty, &rp, c); | 1105 | c = tty_prepare_flip_string(tty, &rp, c); |
1101 | 1106 | ||
1102 | sx_dprintk (SX_DEBUG_RECEIVE, "c = %d.\n", c); | 1107 | sx_dprintk (SX_DEBUG_RECEIVE, "c = %d.\n", c); |
1103 | 1108 | ||
1104 | /* Don't copy past the end of the hardware receive buffer */ | ||
1105 | if (rx_op + c > 0x100) c = 0x100 - rx_op; | ||
1106 | |||
1107 | sx_dprintk (SX_DEBUG_RECEIVE, "c = %d.\n", c); | ||
1108 | |||
1109 | /* If for one reason or another, we can't copy more data, we're done! */ | 1109 | /* If for one reason or another, we can't copy more data, we're done! */ |
1110 | if (c == 0) break; | 1110 | if (c == 0) break; |
1111 | 1111 | ||
@@ -2173,15 +2173,17 @@ static int probe_si (struct sx_board *board) | |||
2173 | if ( IS_SI1_BOARD(board)) { | 2173 | if ( IS_SI1_BOARD(board)) { |
2174 | /* This should be an SI1 board, which has this | 2174 | /* This should be an SI1 board, which has this |
2175 | location writable... */ | 2175 | location writable... */ |
2176 | if (read_sx_byte (board, SI2_ISA_ID_BASE) != 0x10) | 2176 | if (read_sx_byte (board, SI2_ISA_ID_BASE) != 0x10) { |
2177 | func_exit (); | 2177 | func_exit (); |
2178 | return 0; | 2178 | return 0; |
2179 | } | ||
2179 | } else { | 2180 | } else { |
2180 | /* This should be an SI2 board, which has the bottom | 2181 | /* This should be an SI2 board, which has the bottom |
2181 | 3 bits non-writable... */ | 2182 | 3 bits non-writable... */ |
2182 | if (read_sx_byte (board, SI2_ISA_ID_BASE) == 0x10) | 2183 | if (read_sx_byte (board, SI2_ISA_ID_BASE) == 0x10) { |
2183 | func_exit (); | 2184 | func_exit (); |
2184 | return 0; | 2185 | return 0; |
2186 | } | ||
2185 | } | 2187 | } |
2186 | 2188 | ||
2187 | /* Now we're pretty much convinced that there is an SI board here, | 2189 | /* Now we're pretty much convinced that there is an SI board here, |
@@ -2192,15 +2194,17 @@ static int probe_si (struct sx_board *board) | |||
2192 | if ( IS_SI1_BOARD(board)) { | 2194 | if ( IS_SI1_BOARD(board)) { |
2193 | /* This should be an SI1 board, which has this | 2195 | /* This should be an SI1 board, which has this |
2194 | location writable... */ | 2196 | location writable... */ |
2195 | if (read_sx_byte (board, SI2_ISA_ID_BASE) != 0x10) | 2197 | if (read_sx_byte (board, SI2_ISA_ID_BASE) != 0x10) { |
2196 | func_exit(); | 2198 | func_exit(); |
2197 | return 0; | 2199 | return 0; |
2200 | } | ||
2198 | } else { | 2201 | } else { |
2199 | /* This should be an SI2 board, which has the bottom | 2202 | /* This should be an SI2 board, which has the bottom |
2200 | 3 bits non-writable... */ | 2203 | 3 bits non-writable... */ |
2201 | if (read_sx_byte (board, SI2_ISA_ID_BASE) == 0x10) | 2204 | if (read_sx_byte (board, SI2_ISA_ID_BASE) == 0x10) { |
2202 | func_exit (); | 2205 | func_exit (); |
2203 | return 0; | 2206 | return 0; |
2207 | } | ||
2204 | } | 2208 | } |
2205 | 2209 | ||
2206 | printheader (); | 2210 | printheader (); |
diff --git a/drivers/ieee1394/sbp2.c b/drivers/ieee1394/sbp2.c index c2c776fbda01..eca92eb475a1 100644 --- a/drivers/ieee1394/sbp2.c +++ b/drivers/ieee1394/sbp2.c | |||
@@ -137,15 +137,15 @@ MODULE_PARM_DESC(exclusive_login, "Exclusive login to sbp2 device (default = 1)" | |||
137 | /* | 137 | /* |
138 | * SCSI inquiry hack for really badly behaved sbp2 devices. Turn this on | 138 | * SCSI inquiry hack for really badly behaved sbp2 devices. Turn this on |
139 | * if your sbp2 device is not properly handling the SCSI inquiry command. | 139 | * if your sbp2 device is not properly handling the SCSI inquiry command. |
140 | * This hack makes the inquiry look more like a typical MS Windows | 140 | * This hack makes the inquiry look more like a typical MS Windows inquiry |
141 | * inquiry. | 141 | * by enforcing 36 byte inquiry and avoiding access to mode_sense page 8. |
142 | * | 142 | * |
143 | * If force_inquiry_hack=1 is required for your device to work, | 143 | * If force_inquiry_hack=1 is required for your device to work, |
144 | * please submit the logged sbp2_firmware_revision value of this device to | 144 | * please submit the logged sbp2_firmware_revision value of this device to |
145 | * the linux1394-devel mailing list. | 145 | * the linux1394-devel mailing list. |
146 | */ | 146 | */ |
147 | static int force_inquiry_hack; | 147 | static int force_inquiry_hack; |
148 | module_param(force_inquiry_hack, int, 0444); | 148 | module_param(force_inquiry_hack, int, 0644); |
149 | MODULE_PARM_DESC(force_inquiry_hack, "Force SCSI inquiry hack (default = 0)"); | 149 | MODULE_PARM_DESC(force_inquiry_hack, "Force SCSI inquiry hack (default = 0)"); |
150 | 150 | ||
151 | /* | 151 | /* |
@@ -264,18 +264,17 @@ static struct hpsb_protocol_driver sbp2_driver = { | |||
264 | }, | 264 | }, |
265 | }; | 265 | }; |
266 | 266 | ||
267 | 267 | /* | |
268 | /* List of device firmware's that require a forced 36 byte inquiry. */ | 268 | * List of device firmwares that require the inquiry hack. |
269 | * Yields a few false positives but did not break other devices so far. | ||
270 | */ | ||
269 | static u32 sbp2_broken_inquiry_list[] = { | 271 | static u32 sbp2_broken_inquiry_list[] = { |
270 | 0x00002800, /* Stefan Richter <richtest@bauwesen.tu-cottbus.de> */ | 272 | 0x00002800, /* Stefan Richter <stefanr@s5r6.in-berlin.de> */ |
271 | /* DViCO Momobay CX-1 */ | 273 | /* DViCO Momobay CX-1 */ |
272 | 0x00000200 /* Andreas Plesch <plesch@fas.harvard.edu> */ | 274 | 0x00000200 /* Andreas Plesch <plesch@fas.harvard.edu> */ |
273 | /* QPS Fire DVDBurner */ | 275 | /* QPS Fire DVDBurner */ |
274 | }; | 276 | }; |
275 | 277 | ||
276 | #define NUM_BROKEN_INQUIRY_DEVS \ | ||
277 | (sizeof(sbp2_broken_inquiry_list)/sizeof(*sbp2_broken_inquiry_list)) | ||
278 | |||
279 | /************************************** | 278 | /************************************** |
280 | * General utility functions | 279 | * General utility functions |
281 | **************************************/ | 280 | **************************************/ |
@@ -643,9 +642,15 @@ static int sbp2_remove(struct device *dev) | |||
643 | if (!scsi_id) | 642 | if (!scsi_id) |
644 | return 0; | 643 | return 0; |
645 | 644 | ||
646 | /* Trigger shutdown functions in scsi's highlevel. */ | 645 | if (scsi_id->scsi_host) { |
647 | if (scsi_id->scsi_host) | 646 | /* Get rid of enqueued commands if there is no chance to |
647 | * send them. */ | ||
648 | if (!sbp2util_node_is_available(scsi_id)) | ||
649 | sbp2scsi_complete_all_commands(scsi_id, DID_NO_CONNECT); | ||
650 | /* scsi_remove_device() will trigger shutdown functions of SCSI | ||
651 | * highlevel drivers which would deadlock if blocked. */ | ||
648 | scsi_unblock_requests(scsi_id->scsi_host); | 652 | scsi_unblock_requests(scsi_id->scsi_host); |
653 | } | ||
649 | sdev = scsi_id->sdev; | 654 | sdev = scsi_id->sdev; |
650 | if (sdev) { | 655 | if (sdev) { |
651 | scsi_id->sdev = NULL; | 656 | scsi_id->sdev = NULL; |
@@ -742,11 +747,6 @@ static struct scsi_id_instance_data *sbp2_alloc_device(struct unit_directory *ud | |||
742 | hi->host = ud->ne->host; | 747 | hi->host = ud->ne->host; |
743 | INIT_LIST_HEAD(&hi->scsi_ids); | 748 | INIT_LIST_HEAD(&hi->scsi_ids); |
744 | 749 | ||
745 | /* Register our sbp2 status address space... */ | ||
746 | hpsb_register_addrspace(&sbp2_highlevel, ud->ne->host, &sbp2_ops, | ||
747 | SBP2_STATUS_FIFO_ADDRESS, | ||
748 | SBP2_STATUS_FIFO_ADDRESS + | ||
749 | SBP2_STATUS_FIFO_ENTRY_TO_OFFSET(SBP2_MAX_UDS_PER_NODE+1)); | ||
750 | #ifdef CONFIG_IEEE1394_SBP2_PHYS_DMA | 750 | #ifdef CONFIG_IEEE1394_SBP2_PHYS_DMA |
751 | /* Handle data movement if physical dma is not | 751 | /* Handle data movement if physical dma is not |
752 | * enabled/supportedon host controller */ | 752 | * enabled/supportedon host controller */ |
@@ -759,6 +759,18 @@ static struct scsi_id_instance_data *sbp2_alloc_device(struct unit_directory *ud | |||
759 | 759 | ||
760 | list_add_tail(&scsi_id->scsi_list, &hi->scsi_ids); | 760 | list_add_tail(&scsi_id->scsi_list, &hi->scsi_ids); |
761 | 761 | ||
762 | /* Register the status FIFO address range. We could use the same FIFO | ||
763 | * for targets at different nodes. However we need different FIFOs per | ||
764 | * target in order to support multi-unit devices. */ | ||
765 | scsi_id->status_fifo_addr = hpsb_allocate_and_register_addrspace( | ||
766 | &sbp2_highlevel, ud->ne->host, &sbp2_ops, | ||
767 | sizeof(struct sbp2_status_block), sizeof(quadlet_t), | ||
768 | ~0ULL, ~0ULL); | ||
769 | if (!scsi_id->status_fifo_addr) { | ||
770 | SBP2_ERR("failed to allocate status FIFO address range"); | ||
771 | goto failed_alloc; | ||
772 | } | ||
773 | |||
762 | /* Register our host with the SCSI stack. */ | 774 | /* Register our host with the SCSI stack. */ |
763 | scsi_host = scsi_host_alloc(&scsi_driver_template, | 775 | scsi_host = scsi_host_alloc(&scsi_driver_template, |
764 | sizeof(unsigned long)); | 776 | sizeof(unsigned long)); |
@@ -997,6 +1009,10 @@ static void sbp2_remove_device(struct scsi_id_instance_data *scsi_id) | |||
997 | SBP2_DMA_FREE("single query logins data"); | 1009 | SBP2_DMA_FREE("single query logins data"); |
998 | } | 1010 | } |
999 | 1011 | ||
1012 | if (scsi_id->status_fifo_addr) | ||
1013 | hpsb_unregister_addrspace(&sbp2_highlevel, hi->host, | ||
1014 | scsi_id->status_fifo_addr); | ||
1015 | |||
1000 | scsi_id->ud->device.driver_data = NULL; | 1016 | scsi_id->ud->device.driver_data = NULL; |
1001 | 1017 | ||
1002 | SBP2_DEBUG("SBP-2 device removed, SCSI ID = %d", scsi_id->ud->id); | 1018 | SBP2_DEBUG("SBP-2 device removed, SCSI ID = %d", scsi_id->ud->id); |
@@ -1075,11 +1091,10 @@ static int sbp2_query_logins(struct scsi_id_instance_data *scsi_id) | |||
1075 | ORB_SET_QUERY_LOGINS_RESP_LENGTH(sizeof(struct sbp2_query_logins_response)); | 1091 | ORB_SET_QUERY_LOGINS_RESP_LENGTH(sizeof(struct sbp2_query_logins_response)); |
1076 | SBP2_DEBUG("sbp2_query_logins: reserved_resp_length initialized"); | 1092 | SBP2_DEBUG("sbp2_query_logins: reserved_resp_length initialized"); |
1077 | 1093 | ||
1078 | scsi_id->query_logins_orb->status_FIFO_lo = SBP2_STATUS_FIFO_ADDRESS_LO + | 1094 | scsi_id->query_logins_orb->status_fifo_hi = |
1079 | SBP2_STATUS_FIFO_ENTRY_TO_OFFSET(scsi_id->ud->id); | 1095 | ORB_SET_STATUS_FIFO_HI(scsi_id->status_fifo_addr, hi->host->node_id); |
1080 | scsi_id->query_logins_orb->status_FIFO_hi = (ORB_SET_NODE_ID(hi->host->node_id) | | 1096 | scsi_id->query_logins_orb->status_fifo_lo = |
1081 | SBP2_STATUS_FIFO_ADDRESS_HI); | 1097 | ORB_SET_STATUS_FIFO_LO(scsi_id->status_fifo_addr); |
1082 | SBP2_DEBUG("sbp2_query_logins: status FIFO initialized"); | ||
1083 | 1098 | ||
1084 | sbp2util_cpu_to_be32_buffer(scsi_id->query_logins_orb, sizeof(struct sbp2_query_logins_orb)); | 1099 | sbp2util_cpu_to_be32_buffer(scsi_id->query_logins_orb, sizeof(struct sbp2_query_logins_orb)); |
1085 | 1100 | ||
@@ -1184,11 +1199,10 @@ static int sbp2_login_device(struct scsi_id_instance_data *scsi_id) | |||
1184 | ORB_SET_LOGIN_RESP_LENGTH(sizeof(struct sbp2_login_response)); | 1199 | ORB_SET_LOGIN_RESP_LENGTH(sizeof(struct sbp2_login_response)); |
1185 | SBP2_DEBUG("sbp2_login_device: passwd_resp_lengths initialized"); | 1200 | SBP2_DEBUG("sbp2_login_device: passwd_resp_lengths initialized"); |
1186 | 1201 | ||
1187 | scsi_id->login_orb->status_FIFO_lo = SBP2_STATUS_FIFO_ADDRESS_LO + | 1202 | scsi_id->login_orb->status_fifo_hi = |
1188 | SBP2_STATUS_FIFO_ENTRY_TO_OFFSET(scsi_id->ud->id); | 1203 | ORB_SET_STATUS_FIFO_HI(scsi_id->status_fifo_addr, hi->host->node_id); |
1189 | scsi_id->login_orb->status_FIFO_hi = (ORB_SET_NODE_ID(hi->host->node_id) | | 1204 | scsi_id->login_orb->status_fifo_lo = |
1190 | SBP2_STATUS_FIFO_ADDRESS_HI); | 1205 | ORB_SET_STATUS_FIFO_LO(scsi_id->status_fifo_addr); |
1191 | SBP2_DEBUG("sbp2_login_device: status FIFO initialized"); | ||
1192 | 1206 | ||
1193 | /* | 1207 | /* |
1194 | * Byte swap ORB if necessary | 1208 | * Byte swap ORB if necessary |
@@ -1301,10 +1315,10 @@ static int sbp2_logout_device(struct scsi_id_instance_data *scsi_id) | |||
1301 | scsi_id->logout_orb->login_ID_misc |= ORB_SET_NOTIFY(1); | 1315 | scsi_id->logout_orb->login_ID_misc |= ORB_SET_NOTIFY(1); |
1302 | 1316 | ||
1303 | scsi_id->logout_orb->reserved5 = 0x0; | 1317 | scsi_id->logout_orb->reserved5 = 0x0; |
1304 | scsi_id->logout_orb->status_FIFO_lo = SBP2_STATUS_FIFO_ADDRESS_LO + | 1318 | scsi_id->logout_orb->status_fifo_hi = |
1305 | SBP2_STATUS_FIFO_ENTRY_TO_OFFSET(scsi_id->ud->id); | 1319 | ORB_SET_STATUS_FIFO_HI(scsi_id->status_fifo_addr, hi->host->node_id); |
1306 | scsi_id->logout_orb->status_FIFO_hi = (ORB_SET_NODE_ID(hi->host->node_id) | | 1320 | scsi_id->logout_orb->status_fifo_lo = |
1307 | SBP2_STATUS_FIFO_ADDRESS_HI); | 1321 | ORB_SET_STATUS_FIFO_LO(scsi_id->status_fifo_addr); |
1308 | 1322 | ||
1309 | /* | 1323 | /* |
1310 | * Byte swap ORB if necessary | 1324 | * Byte swap ORB if necessary |
@@ -1366,10 +1380,10 @@ static int sbp2_reconnect_device(struct scsi_id_instance_data *scsi_id) | |||
1366 | scsi_id->reconnect_orb->login_ID_misc |= ORB_SET_NOTIFY(1); | 1380 | scsi_id->reconnect_orb->login_ID_misc |= ORB_SET_NOTIFY(1); |
1367 | 1381 | ||
1368 | scsi_id->reconnect_orb->reserved5 = 0x0; | 1382 | scsi_id->reconnect_orb->reserved5 = 0x0; |
1369 | scsi_id->reconnect_orb->status_FIFO_lo = SBP2_STATUS_FIFO_ADDRESS_LO + | 1383 | scsi_id->reconnect_orb->status_fifo_hi = |
1370 | SBP2_STATUS_FIFO_ENTRY_TO_OFFSET(scsi_id->ud->id); | 1384 | ORB_SET_STATUS_FIFO_HI(scsi_id->status_fifo_addr, hi->host->node_id); |
1371 | scsi_id->reconnect_orb->status_FIFO_hi = | 1385 | scsi_id->reconnect_orb->status_fifo_lo = |
1372 | (ORB_SET_NODE_ID(hi->host->node_id) | SBP2_STATUS_FIFO_ADDRESS_HI); | 1386 | ORB_SET_STATUS_FIFO_LO(scsi_id->status_fifo_addr); |
1373 | 1387 | ||
1374 | /* | 1388 | /* |
1375 | * Byte swap ORB if necessary | 1389 | * Byte swap ORB if necessary |
@@ -1560,7 +1574,7 @@ static void sbp2_parse_unit_directory(struct scsi_id_instance_data *scsi_id, | |||
1560 | /* Check for a blacklisted set of devices that require us to force | 1574 | /* Check for a blacklisted set of devices that require us to force |
1561 | * a 36 byte host inquiry. This can be overriden as a module param | 1575 | * a 36 byte host inquiry. This can be overriden as a module param |
1562 | * (to force all hosts). */ | 1576 | * (to force all hosts). */ |
1563 | for (i = 0; i < NUM_BROKEN_INQUIRY_DEVS; i++) { | 1577 | for (i = 0; i < ARRAY_SIZE(sbp2_broken_inquiry_list); i++) { |
1564 | if ((firmware_revision & 0xffff00) == | 1578 | if ((firmware_revision & 0xffff00) == |
1565 | sbp2_broken_inquiry_list[i]) { | 1579 | sbp2_broken_inquiry_list[i]) { |
1566 | SBP2_WARN("Node " NODE_BUS_FMT ": Using 36byte inquiry workaround", | 1580 | SBP2_WARN("Node " NODE_BUS_FMT ": Using 36byte inquiry workaround", |
@@ -2007,18 +2021,6 @@ static int sbp2_send_command(struct scsi_id_instance_data *scsi_id, | |||
2007 | } | 2021 | } |
2008 | 2022 | ||
2009 | /* | 2023 | /* |
2010 | * The scsi stack sends down a request_bufflen which does not match the | ||
2011 | * length field in the scsi cdb. This causes some sbp2 devices to | ||
2012 | * reject this inquiry command. Fix the request_bufflen. | ||
2013 | */ | ||
2014 | if (*cmd == INQUIRY) { | ||
2015 | if (force_inquiry_hack || scsi_id->workarounds & SBP2_BREAKAGE_INQUIRY_HACK) | ||
2016 | request_bufflen = cmd[4] = 0x24; | ||
2017 | else | ||
2018 | request_bufflen = cmd[4]; | ||
2019 | } | ||
2020 | |||
2021 | /* | ||
2022 | * Now actually fill in the comamnd orb and sbp2 s/g list | 2024 | * Now actually fill in the comamnd orb and sbp2 s/g list |
2023 | */ | 2025 | */ |
2024 | sbp2_create_command_orb(scsi_id, command, cmd, SCpnt->use_sg, | 2026 | sbp2_create_command_orb(scsi_id, command, cmd, SCpnt->use_sg, |
@@ -2106,7 +2108,6 @@ static int sbp2_handle_status_write(struct hpsb_host *host, int nodeid, int dest | |||
2106 | { | 2108 | { |
2107 | struct sbp2scsi_host_info *hi; | 2109 | struct sbp2scsi_host_info *hi; |
2108 | struct scsi_id_instance_data *scsi_id = NULL, *scsi_id_tmp; | 2110 | struct scsi_id_instance_data *scsi_id = NULL, *scsi_id_tmp; |
2109 | u32 id; | ||
2110 | struct scsi_cmnd *SCpnt = NULL; | 2111 | struct scsi_cmnd *SCpnt = NULL; |
2111 | u32 scsi_status = SBP2_SCSI_STATUS_GOOD; | 2112 | u32 scsi_status = SBP2_SCSI_STATUS_GOOD; |
2112 | struct sbp2_command_info *command; | 2113 | struct sbp2_command_info *command; |
@@ -2129,12 +2130,12 @@ static int sbp2_handle_status_write(struct hpsb_host *host, int nodeid, int dest | |||
2129 | } | 2130 | } |
2130 | 2131 | ||
2131 | /* | 2132 | /* |
2132 | * Find our scsi_id structure by looking at the status fifo address written to by | 2133 | * Find our scsi_id structure by looking at the status fifo address |
2133 | * the sbp2 device. | 2134 | * written to by the sbp2 device. |
2134 | */ | 2135 | */ |
2135 | id = SBP2_STATUS_FIFO_OFFSET_TO_ENTRY((u32)(addr - SBP2_STATUS_FIFO_ADDRESS)); | ||
2136 | list_for_each_entry(scsi_id_tmp, &hi->scsi_ids, scsi_list) { | 2136 | list_for_each_entry(scsi_id_tmp, &hi->scsi_ids, scsi_list) { |
2137 | if (scsi_id_tmp->ne->nodeid == nodeid && scsi_id_tmp->ud->id == id) { | 2137 | if (scsi_id_tmp->ne->nodeid == nodeid && |
2138 | scsi_id_tmp->status_fifo_addr == addr) { | ||
2138 | scsi_id = scsi_id_tmp; | 2139 | scsi_id = scsi_id_tmp; |
2139 | break; | 2140 | break; |
2140 | } | 2141 | } |
@@ -2475,7 +2476,16 @@ static void sbp2scsi_complete_command(struct scsi_id_instance_data *scsi_id, | |||
2475 | 2476 | ||
2476 | static int sbp2scsi_slave_alloc(struct scsi_device *sdev) | 2477 | static int sbp2scsi_slave_alloc(struct scsi_device *sdev) |
2477 | { | 2478 | { |
2478 | ((struct scsi_id_instance_data *)sdev->host->hostdata[0])->sdev = sdev; | 2479 | struct scsi_id_instance_data *scsi_id = |
2480 | (struct scsi_id_instance_data *)sdev->host->hostdata[0]; | ||
2481 | |||
2482 | scsi_id->sdev = sdev; | ||
2483 | |||
2484 | if (force_inquiry_hack || | ||
2485 | scsi_id->workarounds & SBP2_BREAKAGE_INQUIRY_HACK) { | ||
2486 | sdev->inquiry_len = 36; | ||
2487 | sdev->skip_ms_page_8 = 1; | ||
2488 | } | ||
2479 | return 0; | 2489 | return 0; |
2480 | } | 2490 | } |
2481 | 2491 | ||
diff --git a/drivers/ieee1394/sbp2.h b/drivers/ieee1394/sbp2.h index 900ea1d25e71..e2d357a9ea3a 100644 --- a/drivers/ieee1394/sbp2.h +++ b/drivers/ieee1394/sbp2.h | |||
@@ -33,15 +33,17 @@ | |||
33 | #define ORB_DIRECTION_NO_DATA_TRANSFER 0x2 | 33 | #define ORB_DIRECTION_NO_DATA_TRANSFER 0x2 |
34 | 34 | ||
35 | #define ORB_SET_NULL_PTR(value) ((value & 0x1) << 31) | 35 | #define ORB_SET_NULL_PTR(value) ((value & 0x1) << 31) |
36 | #define ORB_SET_NOTIFY(value) ((value & 0x1) << 31) | 36 | #define ORB_SET_NOTIFY(value) ((value & 0x1) << 31) |
37 | #define ORB_SET_RQ_FMT(value) ((value & 0x3) << 29) /* unused ? */ | 37 | #define ORB_SET_RQ_FMT(value) ((value & 0x3) << 29) /* unused ? */ |
38 | #define ORB_SET_NODE_ID(value) ((value & 0xffff) << 16) | 38 | #define ORB_SET_NODE_ID(value) ((value & 0xffff) << 16) |
39 | #define ORB_SET_DATA_SIZE(value) (value & 0xffff) | 39 | #define ORB_SET_STATUS_FIFO_HI(value, id) (value >> 32 | ORB_SET_NODE_ID(id)) |
40 | #define ORB_SET_PAGE_SIZE(value) ((value & 0x7) << 16) | 40 | #define ORB_SET_STATUS_FIFO_LO(value) (value & 0xffffffff) |
41 | #define ORB_SET_PAGE_TABLE_PRESENT(value) ((value & 0x1) << 19) | 41 | #define ORB_SET_DATA_SIZE(value) (value & 0xffff) |
42 | #define ORB_SET_MAX_PAYLOAD(value) ((value & 0xf) << 20) | 42 | #define ORB_SET_PAGE_SIZE(value) ((value & 0x7) << 16) |
43 | #define ORB_SET_SPEED(value) ((value & 0x7) << 24) | 43 | #define ORB_SET_PAGE_TABLE_PRESENT(value) ((value & 0x1) << 19) |
44 | #define ORB_SET_DIRECTION(value) ((value & 0x1) << 27) | 44 | #define ORB_SET_MAX_PAYLOAD(value) ((value & 0xf) << 20) |
45 | #define ORB_SET_SPEED(value) ((value & 0x7) << 24) | ||
46 | #define ORB_SET_DIRECTION(value) ((value & 0x1) << 27) | ||
45 | 47 | ||
46 | struct sbp2_command_orb { | 48 | struct sbp2_command_orb { |
47 | volatile u32 next_ORB_hi; | 49 | volatile u32 next_ORB_hi; |
@@ -76,8 +78,8 @@ struct sbp2_login_orb { | |||
76 | u32 login_response_lo; | 78 | u32 login_response_lo; |
77 | u32 lun_misc; | 79 | u32 lun_misc; |
78 | u32 passwd_resp_lengths; | 80 | u32 passwd_resp_lengths; |
79 | u32 status_FIFO_hi; | 81 | u32 status_fifo_hi; |
80 | u32 status_FIFO_lo; | 82 | u32 status_fifo_lo; |
81 | }; | 83 | }; |
82 | 84 | ||
83 | #define RESPONSE_GET_LOGIN_ID(value) (value & 0xffff) | 85 | #define RESPONSE_GET_LOGIN_ID(value) (value & 0xffff) |
@@ -102,8 +104,8 @@ struct sbp2_query_logins_orb { | |||
102 | u32 query_response_lo; | 104 | u32 query_response_lo; |
103 | u32 lun_misc; | 105 | u32 lun_misc; |
104 | u32 reserved_resp_length; | 106 | u32 reserved_resp_length; |
105 | u32 status_FIFO_hi; | 107 | u32 status_fifo_hi; |
106 | u32 status_FIFO_lo; | 108 | u32 status_fifo_lo; |
107 | }; | 109 | }; |
108 | 110 | ||
109 | #define RESPONSE_GET_MAX_LOGINS(value) (value & 0xffff) | 111 | #define RESPONSE_GET_MAX_LOGINS(value) (value & 0xffff) |
@@ -123,8 +125,8 @@ struct sbp2_reconnect_orb { | |||
123 | u32 reserved4; | 125 | u32 reserved4; |
124 | u32 login_ID_misc; | 126 | u32 login_ID_misc; |
125 | u32 reserved5; | 127 | u32 reserved5; |
126 | u32 status_FIFO_hi; | 128 | u32 status_fifo_hi; |
127 | u32 status_FIFO_lo; | 129 | u32 status_fifo_lo; |
128 | }; | 130 | }; |
129 | 131 | ||
130 | struct sbp2_logout_orb { | 132 | struct sbp2_logout_orb { |
@@ -134,8 +136,8 @@ struct sbp2_logout_orb { | |||
134 | u32 reserved4; | 136 | u32 reserved4; |
135 | u32 login_ID_misc; | 137 | u32 login_ID_misc; |
136 | u32 reserved5; | 138 | u32 reserved5; |
137 | u32 status_FIFO_hi; | 139 | u32 status_fifo_hi; |
138 | u32 status_FIFO_lo; | 140 | u32 status_fifo_lo; |
139 | }; | 141 | }; |
140 | 142 | ||
141 | #define PAGE_TABLE_SET_SEGMENT_BASE_HI(value) (value & 0xffff) | 143 | #define PAGE_TABLE_SET_SEGMENT_BASE_HI(value) (value & 0xffff) |
@@ -195,30 +197,6 @@ struct sbp2_status_block { | |||
195 | * Miscellaneous SBP2 related config rom defines | 197 | * Miscellaneous SBP2 related config rom defines |
196 | */ | 198 | */ |
197 | 199 | ||
198 | /* The status fifo address definition below is used as a base for each | ||
199 | * node, which a chunk seperately assigned to each unit directory in the | ||
200 | * node. For example, 0xfffe00000000ULL is used for the first sbp2 device | ||
201 | * detected on node 0, 0xfffe00000020ULL for the next sbp2 device on node | ||
202 | * 0, and so on. | ||
203 | * | ||
204 | * Note: We could use a single status fifo address for all sbp2 devices, | ||
205 | * and figure out which sbp2 device the status belongs to by looking at | ||
206 | * the source node id of the status write... but, using separate addresses | ||
207 | * for each sbp2 unit directory allows for better code and the ability to | ||
208 | * support multiple luns within a single 1394 node. | ||
209 | * | ||
210 | * Also note that we choose the address range below as it is a region | ||
211 | * specified for write posting, where the ohci controller will | ||
212 | * automatically send an ack_complete when the status is written by the | ||
213 | * sbp2 device... saving a split transaction. =) | ||
214 | */ | ||
215 | #define SBP2_STATUS_FIFO_ADDRESS 0xfffe00000000ULL | ||
216 | #define SBP2_STATUS_FIFO_ADDRESS_HI 0xfffe | ||
217 | #define SBP2_STATUS_FIFO_ADDRESS_LO 0x0 | ||
218 | |||
219 | #define SBP2_STATUS_FIFO_ENTRY_TO_OFFSET(entry) ((entry) << 5) | ||
220 | #define SBP2_STATUS_FIFO_OFFSET_TO_ENTRY(offset) ((offset) >> 5) | ||
221 | |||
222 | #define SBP2_UNIT_DIRECTORY_OFFSET_KEY 0xd1 | 200 | #define SBP2_UNIT_DIRECTORY_OFFSET_KEY 0xd1 |
223 | #define SBP2_CSR_OFFSET_KEY 0x54 | 201 | #define SBP2_CSR_OFFSET_KEY 0x54 |
224 | #define SBP2_UNIT_SPEC_ID_KEY 0x12 | 202 | #define SBP2_UNIT_SPEC_ID_KEY 0x12 |
@@ -258,7 +236,6 @@ struct sbp2_status_block { | |||
258 | */ | 236 | */ |
259 | 237 | ||
260 | #define SBP2_MAX_SG_ELEMENT_LENGTH 0xf000 | 238 | #define SBP2_MAX_SG_ELEMENT_LENGTH 0xf000 |
261 | #define SBP2_MAX_UDS_PER_NODE 16 /* Maximum scsi devices per node */ | ||
262 | #define SBP2_MAX_SECTORS 255 /* Max sectors supported */ | 239 | #define SBP2_MAX_SECTORS 255 /* Max sectors supported */ |
263 | #define SBP2_MAX_CMDS 8 /* This should be safe */ | 240 | #define SBP2_MAX_CMDS 8 /* This should be safe */ |
264 | 241 | ||
@@ -338,6 +315,11 @@ struct scsi_id_instance_data { | |||
338 | u32 sbp2_firmware_revision; | 315 | u32 sbp2_firmware_revision; |
339 | 316 | ||
340 | /* | 317 | /* |
318 | * Address for the device to write status blocks to | ||
319 | */ | ||
320 | u64 status_fifo_addr; | ||
321 | |||
322 | /* | ||
341 | * Variable used for logins, reconnects, logouts, query logins | 323 | * Variable used for logins, reconnects, logouts, query logins |
342 | */ | 324 | */ |
343 | atomic_t sbp2_login_complete; | 325 | atomic_t sbp2_login_complete; |
diff --git a/drivers/md/dm.c b/drivers/md/dm.c index e9adeb9d172f..745ca1f67b14 100644 --- a/drivers/md/dm.c +++ b/drivers/md/dm.c | |||
@@ -849,10 +849,16 @@ static struct mapped_device *alloc_dev(unsigned int minor, int persistent) | |||
849 | 849 | ||
850 | static void free_dev(struct mapped_device *md) | 850 | static void free_dev(struct mapped_device *md) |
851 | { | 851 | { |
852 | free_minor(md->disk->first_minor); | 852 | unsigned int minor = md->disk->first_minor; |
853 | |||
854 | if (md->suspended_bdev) { | ||
855 | thaw_bdev(md->suspended_bdev, NULL); | ||
856 | bdput(md->suspended_bdev); | ||
857 | } | ||
853 | mempool_destroy(md->tio_pool); | 858 | mempool_destroy(md->tio_pool); |
854 | mempool_destroy(md->io_pool); | 859 | mempool_destroy(md->io_pool); |
855 | del_gendisk(md->disk); | 860 | del_gendisk(md->disk); |
861 | free_minor(minor); | ||
856 | put_disk(md->disk); | 862 | put_disk(md->disk); |
857 | blk_put_queue(md->queue); | 863 | blk_put_queue(md->queue); |
858 | kfree(md); | 864 | kfree(md); |
diff --git a/drivers/mtd/chips/cfi_cmdset_0001.c b/drivers/mtd/chips/cfi_cmdset_0001.c index ded2c33f5b85..1c074d63ff3a 100644 --- a/drivers/mtd/chips/cfi_cmdset_0001.c +++ b/drivers/mtd/chips/cfi_cmdset_0001.c | |||
@@ -408,6 +408,7 @@ struct mtd_info *cfi_cmdset_0001(struct map_info *map, int primary) | |||
408 | cfi->chips[i].buffer_write_time = 1<<cfi->cfiq->BufWriteTimeoutTyp; | 408 | cfi->chips[i].buffer_write_time = 1<<cfi->cfiq->BufWriteTimeoutTyp; |
409 | cfi->chips[i].erase_time = 1<<cfi->cfiq->BlockEraseTimeoutTyp; | 409 | cfi->chips[i].erase_time = 1<<cfi->cfiq->BlockEraseTimeoutTyp; |
410 | cfi->chips[i].ref_point_counter = 0; | 410 | cfi->chips[i].ref_point_counter = 0; |
411 | init_waitqueue_head(&(cfi->chips[i].wq)); | ||
411 | } | 412 | } |
412 | 413 | ||
413 | map->fldrv = &cfi_intelext_chipdrv; | 414 | map->fldrv = &cfi_intelext_chipdrv; |
diff --git a/drivers/net/ifb.c b/drivers/net/ifb.c index 1b699259b4ec..31fb2d75dc44 100644 --- a/drivers/net/ifb.c +++ b/drivers/net/ifb.c | |||
@@ -57,7 +57,7 @@ struct ifb_private { | |||
57 | struct sk_buff_head tq; | 57 | struct sk_buff_head tq; |
58 | }; | 58 | }; |
59 | 59 | ||
60 | static int numifbs = 1; | 60 | static int numifbs = 2; |
61 | 61 | ||
62 | static void ri_tasklet(unsigned long dev); | 62 | static void ri_tasklet(unsigned long dev); |
63 | static int ifb_xmit(struct sk_buff *skb, struct net_device *dev); | 63 | static int ifb_xmit(struct sk_buff *skb, struct net_device *dev); |
diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c index 6e1018448eea..8cc0d0bbdf50 100644 --- a/drivers/net/r8169.c +++ b/drivers/net/r8169.c | |||
@@ -287,6 +287,20 @@ enum RTL8169_register_content { | |||
287 | TxInterFrameGapShift = 24, | 287 | TxInterFrameGapShift = 24, |
288 | TxDMAShift = 8, /* DMA burst value (0-7) is shift this many bits */ | 288 | TxDMAShift = 8, /* DMA burst value (0-7) is shift this many bits */ |
289 | 289 | ||
290 | /* Config1 register p.24 */ | ||
291 | PMEnable = (1 << 0), /* Power Management Enable */ | ||
292 | |||
293 | /* Config3 register p.25 */ | ||
294 | MagicPacket = (1 << 5), /* Wake up when receives a Magic Packet */ | ||
295 | LinkUp = (1 << 4), /* Wake up when the cable connection is re-established */ | ||
296 | |||
297 | /* Config5 register p.27 */ | ||
298 | BWF = (1 << 6), /* Accept Broadcast wakeup frame */ | ||
299 | MWF = (1 << 5), /* Accept Multicast wakeup frame */ | ||
300 | UWF = (1 << 4), /* Accept Unicast wakeup frame */ | ||
301 | LanWake = (1 << 1), /* LanWake enable/disable */ | ||
302 | PMEStatus = (1 << 0), /* PME status can be reset by PCI RST# */ | ||
303 | |||
290 | /* TBICSR p.28 */ | 304 | /* TBICSR p.28 */ |
291 | TBIReset = 0x80000000, | 305 | TBIReset = 0x80000000, |
292 | TBILoopback = 0x40000000, | 306 | TBILoopback = 0x40000000, |
@@ -433,6 +447,7 @@ struct rtl8169_private { | |||
433 | unsigned int (*phy_reset_pending)(void __iomem *); | 447 | unsigned int (*phy_reset_pending)(void __iomem *); |
434 | unsigned int (*link_ok)(void __iomem *); | 448 | unsigned int (*link_ok)(void __iomem *); |
435 | struct work_struct task; | 449 | struct work_struct task; |
450 | unsigned wol_enabled : 1; | ||
436 | }; | 451 | }; |
437 | 452 | ||
438 | MODULE_AUTHOR("Realtek and the Linux r8169 crew <netdev@vger.kernel.org>"); | 453 | MODULE_AUTHOR("Realtek and the Linux r8169 crew <netdev@vger.kernel.org>"); |
@@ -607,6 +622,80 @@ static void rtl8169_link_option(int idx, u8 *autoneg, u16 *speed, u8 *duplex) | |||
607 | *duplex = p->duplex; | 622 | *duplex = p->duplex; |
608 | } | 623 | } |
609 | 624 | ||
625 | static void rtl8169_get_wol(struct net_device *dev, struct ethtool_wolinfo *wol) | ||
626 | { | ||
627 | struct rtl8169_private *tp = netdev_priv(dev); | ||
628 | void __iomem *ioaddr = tp->mmio_addr; | ||
629 | u8 options; | ||
630 | |||
631 | wol->wolopts = 0; | ||
632 | |||
633 | #define WAKE_ANY (WAKE_PHY | WAKE_MAGIC | WAKE_UCAST | WAKE_BCAST | WAKE_MCAST) | ||
634 | wol->supported = WAKE_ANY; | ||
635 | |||
636 | spin_lock_irq(&tp->lock); | ||
637 | |||
638 | options = RTL_R8(Config1); | ||
639 | if (!(options & PMEnable)) | ||
640 | goto out_unlock; | ||
641 | |||
642 | options = RTL_R8(Config3); | ||
643 | if (options & LinkUp) | ||
644 | wol->wolopts |= WAKE_PHY; | ||
645 | if (options & MagicPacket) | ||
646 | wol->wolopts |= WAKE_MAGIC; | ||
647 | |||
648 | options = RTL_R8(Config5); | ||
649 | if (options & UWF) | ||
650 | wol->wolopts |= WAKE_UCAST; | ||
651 | if (options & BWF) | ||
652 | wol->wolopts |= WAKE_BCAST; | ||
653 | if (options & MWF) | ||
654 | wol->wolopts |= WAKE_MCAST; | ||
655 | |||
656 | out_unlock: | ||
657 | spin_unlock_irq(&tp->lock); | ||
658 | } | ||
659 | |||
660 | static int rtl8169_set_wol(struct net_device *dev, struct ethtool_wolinfo *wol) | ||
661 | { | ||
662 | struct rtl8169_private *tp = netdev_priv(dev); | ||
663 | void __iomem *ioaddr = tp->mmio_addr; | ||
664 | int i; | ||
665 | static struct { | ||
666 | u32 opt; | ||
667 | u16 reg; | ||
668 | u8 mask; | ||
669 | } cfg[] = { | ||
670 | { WAKE_ANY, Config1, PMEnable }, | ||
671 | { WAKE_PHY, Config3, LinkUp }, | ||
672 | { WAKE_MAGIC, Config3, MagicPacket }, | ||
673 | { WAKE_UCAST, Config5, UWF }, | ||
674 | { WAKE_BCAST, Config5, BWF }, | ||
675 | { WAKE_MCAST, Config5, MWF }, | ||
676 | { WAKE_ANY, Config5, LanWake } | ||
677 | }; | ||
678 | |||
679 | spin_lock_irq(&tp->lock); | ||
680 | |||
681 | RTL_W8(Cfg9346, Cfg9346_Unlock); | ||
682 | |||
683 | for (i = 0; i < ARRAY_SIZE(cfg); i++) { | ||
684 | u8 options = RTL_R8(cfg[i].reg) & ~cfg[i].mask; | ||
685 | if (wol->wolopts & cfg[i].opt) | ||
686 | options |= cfg[i].mask; | ||
687 | RTL_W8(cfg[i].reg, options); | ||
688 | } | ||
689 | |||
690 | RTL_W8(Cfg9346, Cfg9346_Lock); | ||
691 | |||
692 | tp->wol_enabled = (wol->wolopts) ? 1 : 0; | ||
693 | |||
694 | spin_unlock_irq(&tp->lock); | ||
695 | |||
696 | return 0; | ||
697 | } | ||
698 | |||
610 | static void rtl8169_get_drvinfo(struct net_device *dev, | 699 | static void rtl8169_get_drvinfo(struct net_device *dev, |
611 | struct ethtool_drvinfo *info) | 700 | struct ethtool_drvinfo *info) |
612 | { | 701 | { |
@@ -1025,6 +1114,8 @@ static struct ethtool_ops rtl8169_ethtool_ops = { | |||
1025 | .get_tso = ethtool_op_get_tso, | 1114 | .get_tso = ethtool_op_get_tso, |
1026 | .set_tso = ethtool_op_set_tso, | 1115 | .set_tso = ethtool_op_set_tso, |
1027 | .get_regs = rtl8169_get_regs, | 1116 | .get_regs = rtl8169_get_regs, |
1117 | .get_wol = rtl8169_get_wol, | ||
1118 | .set_wol = rtl8169_set_wol, | ||
1028 | .get_strings = rtl8169_get_strings, | 1119 | .get_strings = rtl8169_get_strings, |
1029 | .get_stats_count = rtl8169_get_stats_count, | 1120 | .get_stats_count = rtl8169_get_stats_count, |
1030 | .get_ethtool_stats = rtl8169_get_ethtool_stats, | 1121 | .get_ethtool_stats = rtl8169_get_ethtool_stats, |
@@ -1442,6 +1533,11 @@ rtl8169_init_board(struct pci_dev *pdev, struct net_device **dev_out, | |||
1442 | } | 1533 | } |
1443 | tp->chipset = i; | 1534 | tp->chipset = i; |
1444 | 1535 | ||
1536 | RTL_W8(Cfg9346, Cfg9346_Unlock); | ||
1537 | RTL_W8(Config1, RTL_R8(Config1) | PMEnable); | ||
1538 | RTL_W8(Config5, RTL_R8(Config5) & PMEStatus); | ||
1539 | RTL_W8(Cfg9346, Cfg9346_Lock); | ||
1540 | |||
1445 | *ioaddr_out = ioaddr; | 1541 | *ioaddr_out = ioaddr; |
1446 | *dev_out = dev; | 1542 | *dev_out = dev; |
1447 | out: | 1543 | out: |
@@ -1612,49 +1708,6 @@ rtl8169_remove_one(struct pci_dev *pdev) | |||
1612 | pci_set_drvdata(pdev, NULL); | 1708 | pci_set_drvdata(pdev, NULL); |
1613 | } | 1709 | } |
1614 | 1710 | ||
1615 | #ifdef CONFIG_PM | ||
1616 | |||
1617 | static int rtl8169_suspend(struct pci_dev *pdev, pm_message_t state) | ||
1618 | { | ||
1619 | struct net_device *dev = pci_get_drvdata(pdev); | ||
1620 | struct rtl8169_private *tp = netdev_priv(dev); | ||
1621 | void __iomem *ioaddr = tp->mmio_addr; | ||
1622 | unsigned long flags; | ||
1623 | |||
1624 | if (!netif_running(dev)) | ||
1625 | return 0; | ||
1626 | |||
1627 | netif_device_detach(dev); | ||
1628 | netif_stop_queue(dev); | ||
1629 | spin_lock_irqsave(&tp->lock, flags); | ||
1630 | |||
1631 | /* Disable interrupts, stop Rx and Tx */ | ||
1632 | RTL_W16(IntrMask, 0); | ||
1633 | RTL_W8(ChipCmd, 0); | ||
1634 | |||
1635 | /* Update the error counts. */ | ||
1636 | tp->stats.rx_missed_errors += RTL_R32(RxMissed); | ||
1637 | RTL_W32(RxMissed, 0); | ||
1638 | spin_unlock_irqrestore(&tp->lock, flags); | ||
1639 | |||
1640 | return 0; | ||
1641 | } | ||
1642 | |||
1643 | static int rtl8169_resume(struct pci_dev *pdev) | ||
1644 | { | ||
1645 | struct net_device *dev = pci_get_drvdata(pdev); | ||
1646 | |||
1647 | if (!netif_running(dev)) | ||
1648 | return 0; | ||
1649 | |||
1650 | netif_device_attach(dev); | ||
1651 | rtl8169_hw_start(dev); | ||
1652 | |||
1653 | return 0; | ||
1654 | } | ||
1655 | |||
1656 | #endif /* CONFIG_PM */ | ||
1657 | |||
1658 | static void rtl8169_set_rxbufsize(struct rtl8169_private *tp, | 1711 | static void rtl8169_set_rxbufsize(struct rtl8169_private *tp, |
1659 | struct net_device *dev) | 1712 | struct net_device *dev) |
1660 | { | 1713 | { |
@@ -2700,6 +2753,56 @@ static struct net_device_stats *rtl8169_get_stats(struct net_device *dev) | |||
2700 | return &tp->stats; | 2753 | return &tp->stats; |
2701 | } | 2754 | } |
2702 | 2755 | ||
2756 | #ifdef CONFIG_PM | ||
2757 | |||
2758 | static int rtl8169_suspend(struct pci_dev *pdev, pm_message_t state) | ||
2759 | { | ||
2760 | struct net_device *dev = pci_get_drvdata(pdev); | ||
2761 | struct rtl8169_private *tp = netdev_priv(dev); | ||
2762 | void __iomem *ioaddr = tp->mmio_addr; | ||
2763 | |||
2764 | if (!netif_running(dev)) | ||
2765 | goto out; | ||
2766 | |||
2767 | netif_device_detach(dev); | ||
2768 | netif_stop_queue(dev); | ||
2769 | |||
2770 | spin_lock_irq(&tp->lock); | ||
2771 | |||
2772 | rtl8169_asic_down(ioaddr); | ||
2773 | |||
2774 | tp->stats.rx_missed_errors += RTL_R32(RxMissed); | ||
2775 | RTL_W32(RxMissed, 0); | ||
2776 | |||
2777 | spin_unlock_irq(&tp->lock); | ||
2778 | |||
2779 | pci_save_state(pdev); | ||
2780 | pci_enable_wake(pdev, pci_choose_state(pdev, state), tp->wol_enabled); | ||
2781 | pci_set_power_state(pdev, pci_choose_state(pdev, state)); | ||
2782 | out: | ||
2783 | return 0; | ||
2784 | } | ||
2785 | |||
2786 | static int rtl8169_resume(struct pci_dev *pdev) | ||
2787 | { | ||
2788 | struct net_device *dev = pci_get_drvdata(pdev); | ||
2789 | |||
2790 | if (!netif_running(dev)) | ||
2791 | goto out; | ||
2792 | |||
2793 | netif_device_attach(dev); | ||
2794 | |||
2795 | pci_set_power_state(pdev, PCI_D0); | ||
2796 | pci_restore_state(pdev); | ||
2797 | pci_enable_wake(pdev, PCI_D0, 0); | ||
2798 | |||
2799 | rtl8169_schedule_work(dev, rtl8169_reset_task); | ||
2800 | out: | ||
2801 | return 0; | ||
2802 | } | ||
2803 | |||
2804 | #endif /* CONFIG_PM */ | ||
2805 | |||
2703 | static struct pci_driver rtl8169_pci_driver = { | 2806 | static struct pci_driver rtl8169_pci_driver = { |
2704 | .name = MODULENAME, | 2807 | .name = MODULENAME, |
2705 | .id_table = rtl8169_pci_tbl, | 2808 | .id_table = rtl8169_pci_tbl, |
diff --git a/drivers/net/sis900.c b/drivers/net/sis900.c index 3d95fa20cd88..7a952fe60be2 100644 --- a/drivers/net/sis900.c +++ b/drivers/net/sis900.c | |||
@@ -540,7 +540,7 @@ static int __devinit sis900_probe(struct pci_dev *pci_dev, | |||
540 | printk("%2.2x.\n", net_dev->dev_addr[i]); | 540 | printk("%2.2x.\n", net_dev->dev_addr[i]); |
541 | 541 | ||
542 | /* Detect Wake on Lan support */ | 542 | /* Detect Wake on Lan support */ |
543 | ret = inl(CFGPMC & PMESP); | 543 | ret = (inl(net_dev->base_addr + CFGPMC) & PMESP) >> 27; |
544 | if (netif_msg_probe(sis_priv) && (ret & PME_D3C) == 0) | 544 | if (netif_msg_probe(sis_priv) && (ret & PME_D3C) == 0) |
545 | printk(KERN_INFO "%s: Wake on LAN only available from suspend to RAM.", net_dev->name); | 545 | printk(KERN_INFO "%s: Wake on LAN only available from suspend to RAM.", net_dev->name); |
546 | 546 | ||
@@ -2040,7 +2040,7 @@ static int sis900_set_wol(struct net_device *net_dev, struct ethtool_wolinfo *wo | |||
2040 | 2040 | ||
2041 | if (wol->wolopts == 0) { | 2041 | if (wol->wolopts == 0) { |
2042 | pci_read_config_dword(sis_priv->pci_dev, CFGPMCSR, &cfgpmcsr); | 2042 | pci_read_config_dword(sis_priv->pci_dev, CFGPMCSR, &cfgpmcsr); |
2043 | cfgpmcsr |= ~PME_EN; | 2043 | cfgpmcsr &= ~PME_EN; |
2044 | pci_write_config_dword(sis_priv->pci_dev, CFGPMCSR, cfgpmcsr); | 2044 | pci_write_config_dword(sis_priv->pci_dev, CFGPMCSR, cfgpmcsr); |
2045 | outl(pmctrl_bits, pmctrl_addr); | 2045 | outl(pmctrl_bits, pmctrl_addr); |
2046 | if (netif_msg_wol(sis_priv)) | 2046 | if (netif_msg_wol(sis_priv)) |
diff --git a/drivers/net/skge.c b/drivers/net/skge.c index 67fb19b8fde9..25e028b7ce48 100644 --- a/drivers/net/skge.c +++ b/drivers/net/skge.c | |||
@@ -879,13 +879,12 @@ static int __xm_phy_read(struct skge_hw *hw, int port, u16 reg, u16 *val) | |||
879 | int i; | 879 | int i; |
880 | 880 | ||
881 | xm_write16(hw, port, XM_PHY_ADDR, reg | hw->phy_addr); | 881 | xm_write16(hw, port, XM_PHY_ADDR, reg | hw->phy_addr); |
882 | xm_read16(hw, port, XM_PHY_DATA); | 882 | *val = xm_read16(hw, port, XM_PHY_DATA); |
883 | 883 | ||
884 | /* Need to wait for external PHY */ | ||
885 | for (i = 0; i < PHY_RETRIES; i++) { | 884 | for (i = 0; i < PHY_RETRIES; i++) { |
886 | udelay(1); | ||
887 | if (xm_read16(hw, port, XM_MMU_CMD) & XM_MMU_PHY_RDY) | 885 | if (xm_read16(hw, port, XM_MMU_CMD) & XM_MMU_PHY_RDY) |
888 | goto ready; | 886 | goto ready; |
887 | udelay(1); | ||
889 | } | 888 | } |
890 | 889 | ||
891 | return -ETIMEDOUT; | 890 | return -ETIMEDOUT; |
@@ -918,7 +917,12 @@ static int xm_phy_write(struct skge_hw *hw, int port, u16 reg, u16 val) | |||
918 | 917 | ||
919 | ready: | 918 | ready: |
920 | xm_write16(hw, port, XM_PHY_DATA, val); | 919 | xm_write16(hw, port, XM_PHY_DATA, val); |
921 | return 0; | 920 | for (i = 0; i < PHY_RETRIES; i++) { |
921 | if (!(xm_read16(hw, port, XM_MMU_CMD) & XM_MMU_PHY_BUSY)) | ||
922 | return 0; | ||
923 | udelay(1); | ||
924 | } | ||
925 | return -ETIMEDOUT; | ||
922 | } | 926 | } |
923 | 927 | ||
924 | static void genesis_init(struct skge_hw *hw) | 928 | static void genesis_init(struct skge_hw *hw) |
@@ -1168,13 +1172,17 @@ static void genesis_mac_init(struct skge_hw *hw, int port) | |||
1168 | u32 r; | 1172 | u32 r; |
1169 | const u8 zero[6] = { 0 }; | 1173 | const u8 zero[6] = { 0 }; |
1170 | 1174 | ||
1171 | /* Clear MIB counters */ | 1175 | for (i = 0; i < 10; i++) { |
1172 | xm_write16(hw, port, XM_STAT_CMD, | 1176 | skge_write16(hw, SK_REG(port, TX_MFF_CTRL1), |
1173 | XM_SC_CLR_RXC | XM_SC_CLR_TXC); | 1177 | MFF_SET_MAC_RST); |
1174 | /* Clear two times according to Errata #3 */ | 1178 | if (skge_read16(hw, SK_REG(port, TX_MFF_CTRL1)) & MFF_SET_MAC_RST) |
1175 | xm_write16(hw, port, XM_STAT_CMD, | 1179 | goto reset_ok; |
1176 | XM_SC_CLR_RXC | XM_SC_CLR_TXC); | 1180 | udelay(1); |
1181 | } | ||
1182 | |||
1183 | printk(KERN_WARNING PFX "%s: genesis reset failed\n", dev->name); | ||
1177 | 1184 | ||
1185 | reset_ok: | ||
1178 | /* Unreset the XMAC. */ | 1186 | /* Unreset the XMAC. */ |
1179 | skge_write16(hw, SK_REG(port, TX_MFF_CTRL1), MFF_CLR_MAC_RST); | 1187 | skge_write16(hw, SK_REG(port, TX_MFF_CTRL1), MFF_CLR_MAC_RST); |
1180 | 1188 | ||
@@ -1191,7 +1199,7 @@ static void genesis_mac_init(struct skge_hw *hw, int port) | |||
1191 | r |= GP_DIR_2|GP_IO_2; | 1199 | r |= GP_DIR_2|GP_IO_2; |
1192 | 1200 | ||
1193 | skge_write32(hw, B2_GP_IO, r); | 1201 | skge_write32(hw, B2_GP_IO, r); |
1194 | skge_read32(hw, B2_GP_IO); | 1202 | |
1195 | 1203 | ||
1196 | /* Enable GMII interface */ | 1204 | /* Enable GMII interface */ |
1197 | xm_write16(hw, port, XM_HW_CFG, XM_HW_GMII_MD); | 1205 | xm_write16(hw, port, XM_HW_CFG, XM_HW_GMII_MD); |
@@ -1205,6 +1213,13 @@ static void genesis_mac_init(struct skge_hw *hw, int port) | |||
1205 | for (i = 1; i < 16; i++) | 1213 | for (i = 1; i < 16; i++) |
1206 | xm_outaddr(hw, port, XM_EXM(i), zero); | 1214 | xm_outaddr(hw, port, XM_EXM(i), zero); |
1207 | 1215 | ||
1216 | /* Clear MIB counters */ | ||
1217 | xm_write16(hw, port, XM_STAT_CMD, | ||
1218 | XM_SC_CLR_RXC | XM_SC_CLR_TXC); | ||
1219 | /* Clear two times according to Errata #3 */ | ||
1220 | xm_write16(hw, port, XM_STAT_CMD, | ||
1221 | XM_SC_CLR_RXC | XM_SC_CLR_TXC); | ||
1222 | |||
1208 | /* configure Rx High Water Mark (XM_RX_HI_WM) */ | 1223 | /* configure Rx High Water Mark (XM_RX_HI_WM) */ |
1209 | xm_write16(hw, port, XM_RX_HI_WM, 1450); | 1224 | xm_write16(hw, port, XM_RX_HI_WM, 1450); |
1210 | 1225 | ||
@@ -2170,8 +2185,10 @@ static int skge_up(struct net_device *dev) | |||
2170 | skge->tx_avail = skge->tx_ring.count - 1; | 2185 | skge->tx_avail = skge->tx_ring.count - 1; |
2171 | 2186 | ||
2172 | /* Enable IRQ from port */ | 2187 | /* Enable IRQ from port */ |
2188 | spin_lock_irq(&hw->hw_lock); | ||
2173 | hw->intr_mask |= portirqmask[port]; | 2189 | hw->intr_mask |= portirqmask[port]; |
2174 | skge_write32(hw, B0_IMSK, hw->intr_mask); | 2190 | skge_write32(hw, B0_IMSK, hw->intr_mask); |
2191 | spin_unlock_irq(&hw->hw_lock); | ||
2175 | 2192 | ||
2176 | /* Initialize MAC */ | 2193 | /* Initialize MAC */ |
2177 | spin_lock_bh(&hw->phy_lock); | 2194 | spin_lock_bh(&hw->phy_lock); |
@@ -2229,8 +2246,10 @@ static int skge_down(struct net_device *dev) | |||
2229 | else | 2246 | else |
2230 | yukon_stop(skge); | 2247 | yukon_stop(skge); |
2231 | 2248 | ||
2249 | spin_lock_irq(&hw->hw_lock); | ||
2232 | hw->intr_mask &= ~portirqmask[skge->port]; | 2250 | hw->intr_mask &= ~portirqmask[skge->port]; |
2233 | skge_write32(hw, B0_IMSK, hw->intr_mask); | 2251 | skge_write32(hw, B0_IMSK, hw->intr_mask); |
2252 | spin_unlock_irq(&hw->hw_lock); | ||
2234 | 2253 | ||
2235 | /* Stop transmitter */ | 2254 | /* Stop transmitter */ |
2236 | skge_write8(hw, Q_ADDR(txqaddr[port], Q_CSR), CSR_STOP); | 2255 | skge_write8(hw, Q_ADDR(txqaddr[port], Q_CSR), CSR_STOP); |
@@ -2678,8 +2697,7 @@ static int skge_poll(struct net_device *dev, int *budget) | |||
2678 | 2697 | ||
2679 | /* restart receiver */ | 2698 | /* restart receiver */ |
2680 | wmb(); | 2699 | wmb(); |
2681 | skge_write8(hw, Q_ADDR(rxqaddr[skge->port], Q_CSR), | 2700 | skge_write8(hw, Q_ADDR(rxqaddr[skge->port], Q_CSR), CSR_START); |
2682 | CSR_START | CSR_IRQ_CL_F); | ||
2683 | 2701 | ||
2684 | *budget -= work_done; | 2702 | *budget -= work_done; |
2685 | dev->quota -= work_done; | 2703 | dev->quota -= work_done; |
@@ -2687,10 +2705,11 @@ static int skge_poll(struct net_device *dev, int *budget) | |||
2687 | if (work_done >= to_do) | 2705 | if (work_done >= to_do) |
2688 | return 1; /* not done */ | 2706 | return 1; /* not done */ |
2689 | 2707 | ||
2690 | netif_rx_complete(dev); | 2708 | spin_lock_irq(&hw->hw_lock); |
2691 | hw->intr_mask |= portirqmask[skge->port]; | 2709 | __netif_rx_complete(dev); |
2692 | skge_write32(hw, B0_IMSK, hw->intr_mask); | 2710 | hw->intr_mask |= portirqmask[skge->port]; |
2693 | skge_read32(hw, B0_IMSK); | 2711 | skge_write32(hw, B0_IMSK, hw->intr_mask); |
2712 | spin_unlock_irq(&hw->hw_lock); | ||
2694 | 2713 | ||
2695 | return 0; | 2714 | return 0; |
2696 | } | 2715 | } |
@@ -2850,18 +2869,10 @@ static void skge_extirq(unsigned long data) | |||
2850 | } | 2869 | } |
2851 | spin_unlock(&hw->phy_lock); | 2870 | spin_unlock(&hw->phy_lock); |
2852 | 2871 | ||
2853 | local_irq_disable(); | 2872 | spin_lock_irq(&hw->hw_lock); |
2854 | hw->intr_mask |= IS_EXT_REG; | 2873 | hw->intr_mask |= IS_EXT_REG; |
2855 | skge_write32(hw, B0_IMSK, hw->intr_mask); | 2874 | skge_write32(hw, B0_IMSK, hw->intr_mask); |
2856 | local_irq_enable(); | 2875 | spin_unlock_irq(&hw->hw_lock); |
2857 | } | ||
2858 | |||
2859 | static inline void skge_wakeup(struct net_device *dev) | ||
2860 | { | ||
2861 | struct skge_port *skge = netdev_priv(dev); | ||
2862 | |||
2863 | prefetch(skge->rx_ring.to_clean); | ||
2864 | netif_rx_schedule(dev); | ||
2865 | } | 2876 | } |
2866 | 2877 | ||
2867 | static irqreturn_t skge_intr(int irq, void *dev_id, struct pt_regs *regs) | 2878 | static irqreturn_t skge_intr(int irq, void *dev_id, struct pt_regs *regs) |
@@ -2872,15 +2883,17 @@ static irqreturn_t skge_intr(int irq, void *dev_id, struct pt_regs *regs) | |||
2872 | if (status == 0 || status == ~0) /* hotplug or shared irq */ | 2883 | if (status == 0 || status == ~0) /* hotplug or shared irq */ |
2873 | return IRQ_NONE; | 2884 | return IRQ_NONE; |
2874 | 2885 | ||
2875 | status &= hw->intr_mask; | 2886 | spin_lock(&hw->hw_lock); |
2876 | if (status & IS_R1_F) { | 2887 | if (status & IS_R1_F) { |
2888 | skge_write8(hw, Q_ADDR(Q_R1, Q_CSR), CSR_IRQ_CL_F); | ||
2877 | hw->intr_mask &= ~IS_R1_F; | 2889 | hw->intr_mask &= ~IS_R1_F; |
2878 | skge_wakeup(hw->dev[0]); | 2890 | netif_rx_schedule(hw->dev[0]); |
2879 | } | 2891 | } |
2880 | 2892 | ||
2881 | if (status & IS_R2_F) { | 2893 | if (status & IS_R2_F) { |
2894 | skge_write8(hw, Q_ADDR(Q_R2, Q_CSR), CSR_IRQ_CL_F); | ||
2882 | hw->intr_mask &= ~IS_R2_F; | 2895 | hw->intr_mask &= ~IS_R2_F; |
2883 | skge_wakeup(hw->dev[1]); | 2896 | netif_rx_schedule(hw->dev[1]); |
2884 | } | 2897 | } |
2885 | 2898 | ||
2886 | if (status & IS_XA1_F) | 2899 | if (status & IS_XA1_F) |
@@ -2922,6 +2935,7 @@ static irqreturn_t skge_intr(int irq, void *dev_id, struct pt_regs *regs) | |||
2922 | } | 2935 | } |
2923 | 2936 | ||
2924 | skge_write32(hw, B0_IMSK, hw->intr_mask); | 2937 | skge_write32(hw, B0_IMSK, hw->intr_mask); |
2938 | spin_unlock(&hw->hw_lock); | ||
2925 | 2939 | ||
2926 | return IRQ_HANDLED; | 2940 | return IRQ_HANDLED; |
2927 | } | 2941 | } |
@@ -3290,6 +3304,7 @@ static int __devinit skge_probe(struct pci_dev *pdev, | |||
3290 | 3304 | ||
3291 | hw->pdev = pdev; | 3305 | hw->pdev = pdev; |
3292 | spin_lock_init(&hw->phy_lock); | 3306 | spin_lock_init(&hw->phy_lock); |
3307 | spin_lock_init(&hw->hw_lock); | ||
3293 | tasklet_init(&hw->ext_tasklet, skge_extirq, (unsigned long) hw); | 3308 | tasklet_init(&hw->ext_tasklet, skge_extirq, (unsigned long) hw); |
3294 | 3309 | ||
3295 | hw->regs = ioremap_nocache(pci_resource_start(pdev, 0), 0x4000); | 3310 | hw->regs = ioremap_nocache(pci_resource_start(pdev, 0), 0x4000); |
diff --git a/drivers/net/skge.h b/drivers/net/skge.h index 2efdacc290e5..941f12a333b6 100644 --- a/drivers/net/skge.h +++ b/drivers/net/skge.h | |||
@@ -2402,6 +2402,7 @@ struct skge_hw { | |||
2402 | 2402 | ||
2403 | struct tasklet_struct ext_tasklet; | 2403 | struct tasklet_struct ext_tasklet; |
2404 | spinlock_t phy_lock; | 2404 | spinlock_t phy_lock; |
2405 | spinlock_t hw_lock; | ||
2405 | }; | 2406 | }; |
2406 | 2407 | ||
2407 | enum { | 2408 | enum { |
diff --git a/drivers/net/sky2.c b/drivers/net/sky2.c index bfeba5b9cd7a..ca8160d68229 100644 --- a/drivers/net/sky2.c +++ b/drivers/net/sky2.c | |||
@@ -195,11 +195,11 @@ static int sky2_set_power_state(struct sky2_hw *hw, pci_power_t state) | |||
195 | pr_debug("sky2_set_power_state %d\n", state); | 195 | pr_debug("sky2_set_power_state %d\n", state); |
196 | sky2_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_ON); | 196 | sky2_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_ON); |
197 | 197 | ||
198 | pci_read_config_word(hw->pdev, hw->pm_cap + PCI_PM_PMC, &power_control); | 198 | power_control = sky2_pci_read16(hw, hw->pm_cap + PCI_PM_PMC); |
199 | vaux = (sky2_read16(hw, B0_CTST) & Y2_VAUX_AVAIL) && | 199 | vaux = (sky2_read16(hw, B0_CTST) & Y2_VAUX_AVAIL) && |
200 | (power_control & PCI_PM_CAP_PME_D3cold); | 200 | (power_control & PCI_PM_CAP_PME_D3cold); |
201 | 201 | ||
202 | pci_read_config_word(hw->pdev, hw->pm_cap + PCI_PM_CTRL, &power_control); | 202 | power_control = sky2_pci_read16(hw, hw->pm_cap + PCI_PM_CTRL); |
203 | 203 | ||
204 | power_control |= PCI_PM_CTRL_PME_STATUS; | 204 | power_control |= PCI_PM_CTRL_PME_STATUS; |
205 | power_control &= ~(PCI_PM_CTRL_STATE_MASK); | 205 | power_control &= ~(PCI_PM_CTRL_STATE_MASK); |
@@ -223,7 +223,7 @@ static int sky2_set_power_state(struct sky2_hw *hw, pci_power_t state) | |||
223 | sky2_write8(hw, B2_Y2_CLK_GATE, 0); | 223 | sky2_write8(hw, B2_Y2_CLK_GATE, 0); |
224 | 224 | ||
225 | /* Turn off phy power saving */ | 225 | /* Turn off phy power saving */ |
226 | pci_read_config_dword(hw->pdev, PCI_DEV_REG1, ®1); | 226 | reg1 = sky2_pci_read32(hw, PCI_DEV_REG1); |
227 | reg1 &= ~(PCI_Y2_PHY1_POWD | PCI_Y2_PHY2_POWD); | 227 | reg1 &= ~(PCI_Y2_PHY1_POWD | PCI_Y2_PHY2_POWD); |
228 | 228 | ||
229 | /* looks like this XL is back asswards .. */ | 229 | /* looks like this XL is back asswards .. */ |
@@ -232,18 +232,28 @@ static int sky2_set_power_state(struct sky2_hw *hw, pci_power_t state) | |||
232 | if (hw->ports > 1) | 232 | if (hw->ports > 1) |
233 | reg1 |= PCI_Y2_PHY2_COMA; | 233 | reg1 |= PCI_Y2_PHY2_COMA; |
234 | } | 234 | } |
235 | pci_write_config_dword(hw->pdev, PCI_DEV_REG1, reg1); | 235 | |
236 | if (hw->chip_id == CHIP_ID_YUKON_EC_U) { | ||
237 | sky2_pci_write32(hw, PCI_DEV_REG3, 0); | ||
238 | reg1 = sky2_pci_read32(hw, PCI_DEV_REG4); | ||
239 | reg1 &= P_ASPM_CONTROL_MSK; | ||
240 | sky2_pci_write32(hw, PCI_DEV_REG4, reg1); | ||
241 | sky2_pci_write32(hw, PCI_DEV_REG5, 0); | ||
242 | } | ||
243 | |||
244 | sky2_pci_write32(hw, PCI_DEV_REG1, reg1); | ||
245 | |||
236 | break; | 246 | break; |
237 | 247 | ||
238 | case PCI_D3hot: | 248 | case PCI_D3hot: |
239 | case PCI_D3cold: | 249 | case PCI_D3cold: |
240 | /* Turn on phy power saving */ | 250 | /* Turn on phy power saving */ |
241 | pci_read_config_dword(hw->pdev, PCI_DEV_REG1, ®1); | 251 | reg1 = sky2_pci_read32(hw, PCI_DEV_REG1); |
242 | if (hw->chip_id == CHIP_ID_YUKON_XL && hw->chip_rev > 1) | 252 | if (hw->chip_id == CHIP_ID_YUKON_XL && hw->chip_rev > 1) |
243 | reg1 &= ~(PCI_Y2_PHY1_POWD | PCI_Y2_PHY2_POWD); | 253 | reg1 &= ~(PCI_Y2_PHY1_POWD | PCI_Y2_PHY2_POWD); |
244 | else | 254 | else |
245 | reg1 |= (PCI_Y2_PHY1_POWD | PCI_Y2_PHY2_POWD); | 255 | reg1 |= (PCI_Y2_PHY1_POWD | PCI_Y2_PHY2_POWD); |
246 | pci_write_config_dword(hw->pdev, PCI_DEV_REG1, reg1); | 256 | sky2_pci_write32(hw, PCI_DEV_REG1, reg1); |
247 | 257 | ||
248 | if (hw->chip_id == CHIP_ID_YUKON_XL && hw->chip_rev > 1) | 258 | if (hw->chip_id == CHIP_ID_YUKON_XL && hw->chip_rev > 1) |
249 | sky2_write8(hw, B2_Y2_CLK_GATE, 0); | 259 | sky2_write8(hw, B2_Y2_CLK_GATE, 0); |
@@ -265,7 +275,7 @@ static int sky2_set_power_state(struct sky2_hw *hw, pci_power_t state) | |||
265 | ret = -1; | 275 | ret = -1; |
266 | } | 276 | } |
267 | 277 | ||
268 | pci_write_config_byte(hw->pdev, hw->pm_cap + PCI_PM_CTRL, power_control); | 278 | sky2_pci_write16(hw, hw->pm_cap + PCI_PM_CTRL, power_control); |
269 | sky2_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_OFF); | 279 | sky2_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_OFF); |
270 | return ret; | 280 | return ret; |
271 | } | 281 | } |
@@ -463,16 +473,31 @@ static void sky2_phy_init(struct sky2_hw *hw, unsigned port) | |||
463 | ledover |= PHY_M_LED_MO_RX(MO_LED_OFF); | 473 | ledover |= PHY_M_LED_MO_RX(MO_LED_OFF); |
464 | } | 474 | } |
465 | 475 | ||
466 | gm_phy_write(hw, port, PHY_MARV_LED_CTRL, ledctrl); | 476 | if (hw->chip_id == CHIP_ID_YUKON_EC_U && hw->chip_rev >= 2) { |
477 | /* apply fixes in PHY AFE */ | ||
478 | gm_phy_write(hw, port, 22, 255); | ||
479 | /* increase differential signal amplitude in 10BASE-T */ | ||
480 | gm_phy_write(hw, port, 24, 0xaa99); | ||
481 | gm_phy_write(hw, port, 23, 0x2011); | ||
467 | 482 | ||
468 | if (sky2->autoneg == AUTONEG_DISABLE || sky2->speed == SPEED_100) { | 483 | /* fix for IEEE A/B Symmetry failure in 1000BASE-T */ |
469 | /* turn on 100 Mbps LED (LED_LINK100) */ | 484 | gm_phy_write(hw, port, 24, 0xa204); |
470 | ledover |= PHY_M_LED_MO_100(MO_LED_ON); | 485 | gm_phy_write(hw, port, 23, 0x2002); |
471 | } | ||
472 | 486 | ||
473 | if (ledover) | 487 | /* set page register to 0 */ |
474 | gm_phy_write(hw, port, PHY_MARV_LED_OVER, ledover); | 488 | gm_phy_write(hw, port, 22, 0); |
489 | } else { | ||
490 | gm_phy_write(hw, port, PHY_MARV_LED_CTRL, ledctrl); | ||
475 | 491 | ||
492 | if (sky2->autoneg == AUTONEG_DISABLE || sky2->speed == SPEED_100) { | ||
493 | /* turn on 100 Mbps LED (LED_LINK100) */ | ||
494 | ledover |= PHY_M_LED_MO_100(MO_LED_ON); | ||
495 | } | ||
496 | |||
497 | if (ledover) | ||
498 | gm_phy_write(hw, port, PHY_MARV_LED_OVER, ledover); | ||
499 | |||
500 | } | ||
476 | /* Enable phy interrupt on auto-negotiation complete (or link up) */ | 501 | /* Enable phy interrupt on auto-negotiation complete (or link up) */ |
477 | if (sky2->autoneg == AUTONEG_ENABLE) | 502 | if (sky2->autoneg == AUTONEG_ENABLE) |
478 | gm_phy_write(hw, port, PHY_MARV_INT_MASK, PHY_M_IS_AN_COMPL); | 503 | gm_phy_write(hw, port, PHY_MARV_INT_MASK, PHY_M_IS_AN_COMPL); |
@@ -953,6 +978,12 @@ static int sky2_rx_start(struct sky2_port *sky2) | |||
953 | 978 | ||
954 | sky2->rx_put = sky2->rx_next = 0; | 979 | sky2->rx_put = sky2->rx_next = 0; |
955 | sky2_qset(hw, rxq); | 980 | sky2_qset(hw, rxq); |
981 | |||
982 | if (hw->chip_id == CHIP_ID_YUKON_EC_U && hw->chip_rev >= 2) { | ||
983 | /* MAC Rx RAM Read is controlled by hardware */ | ||
984 | sky2_write32(hw, Q_ADDR(rxq, Q_F), F_M_RX_RAM_DIS); | ||
985 | } | ||
986 | |||
956 | sky2_prefetch_init(hw, rxq, sky2->rx_le_map, RX_LE_SIZE - 1); | 987 | sky2_prefetch_init(hw, rxq, sky2->rx_le_map, RX_LE_SIZE - 1); |
957 | 988 | ||
958 | rx_set_checksum(sky2); | 989 | rx_set_checksum(sky2); |
@@ -1035,9 +1066,10 @@ static int sky2_up(struct net_device *dev) | |||
1035 | RB_RST_SET); | 1066 | RB_RST_SET); |
1036 | 1067 | ||
1037 | sky2_qset(hw, txqaddr[port]); | 1068 | sky2_qset(hw, txqaddr[port]); |
1038 | if (hw->chip_id == CHIP_ID_YUKON_EC_U) | ||
1039 | sky2_write16(hw, Q_ADDR(txqaddr[port], Q_AL), 0x1a0); | ||
1040 | 1069 | ||
1070 | /* Set almost empty threshold */ | ||
1071 | if (hw->chip_id == CHIP_ID_YUKON_EC_U && hw->chip_rev == 1) | ||
1072 | sky2_write16(hw, Q_ADDR(txqaddr[port], Q_AL), 0x1a0); | ||
1041 | 1073 | ||
1042 | sky2_prefetch_init(hw, txqaddr[port], sky2->tx_le_map, | 1074 | sky2_prefetch_init(hw, txqaddr[port], sky2->tx_le_map, |
1043 | TX_RING_SIZE - 1); | 1075 | TX_RING_SIZE - 1); |
@@ -1047,8 +1079,10 @@ static int sky2_up(struct net_device *dev) | |||
1047 | goto err_out; | 1079 | goto err_out; |
1048 | 1080 | ||
1049 | /* Enable interrupts from phy/mac for port */ | 1081 | /* Enable interrupts from phy/mac for port */ |
1082 | spin_lock_irq(&hw->hw_lock); | ||
1050 | hw->intr_mask |= (port == 0) ? Y2_IS_PORT_1 : Y2_IS_PORT_2; | 1083 | hw->intr_mask |= (port == 0) ? Y2_IS_PORT_1 : Y2_IS_PORT_2; |
1051 | sky2_write32(hw, B0_IMSK, hw->intr_mask); | 1084 | sky2_write32(hw, B0_IMSK, hw->intr_mask); |
1085 | spin_unlock_irq(&hw->hw_lock); | ||
1052 | return 0; | 1086 | return 0; |
1053 | 1087 | ||
1054 | err_out: | 1088 | err_out: |
@@ -1348,10 +1382,10 @@ static int sky2_down(struct net_device *dev) | |||
1348 | netif_stop_queue(dev); | 1382 | netif_stop_queue(dev); |
1349 | 1383 | ||
1350 | /* Disable port IRQ */ | 1384 | /* Disable port IRQ */ |
1351 | local_irq_disable(); | 1385 | spin_lock_irq(&hw->hw_lock); |
1352 | hw->intr_mask &= ~((sky2->port == 0) ? Y2_IS_IRQ_PHY1 : Y2_IS_IRQ_PHY2); | 1386 | hw->intr_mask &= ~((sky2->port == 0) ? Y2_IS_IRQ_PHY1 : Y2_IS_IRQ_PHY2); |
1353 | sky2_write32(hw, B0_IMSK, hw->intr_mask); | 1387 | sky2_write32(hw, B0_IMSK, hw->intr_mask); |
1354 | local_irq_enable(); | 1388 | spin_unlock_irq(&hw->hw_lock); |
1355 | 1389 | ||
1356 | flush_scheduled_work(); | 1390 | flush_scheduled_work(); |
1357 | 1391 | ||
@@ -1633,10 +1667,10 @@ static void sky2_phy_task(void *arg) | |||
1633 | out: | 1667 | out: |
1634 | up(&sky2->phy_sema); | 1668 | up(&sky2->phy_sema); |
1635 | 1669 | ||
1636 | local_irq_disable(); | 1670 | spin_lock_irq(&hw->hw_lock); |
1637 | hw->intr_mask |= (sky2->port == 0) ? Y2_IS_IRQ_PHY1 : Y2_IS_IRQ_PHY2; | 1671 | hw->intr_mask |= (sky2->port == 0) ? Y2_IS_IRQ_PHY1 : Y2_IS_IRQ_PHY2; |
1638 | sky2_write32(hw, B0_IMSK, hw->intr_mask); | 1672 | sky2_write32(hw, B0_IMSK, hw->intr_mask); |
1639 | local_irq_enable(); | 1673 | spin_unlock_irq(&hw->hw_lock); |
1640 | } | 1674 | } |
1641 | 1675 | ||
1642 | 1676 | ||
@@ -1863,6 +1897,17 @@ static int sky2_poll(struct net_device *dev0, int *budget) | |||
1863 | 1897 | ||
1864 | sky2_write32(hw, STAT_CTRL, SC_STAT_CLR_IRQ); | 1898 | sky2_write32(hw, STAT_CTRL, SC_STAT_CLR_IRQ); |
1865 | 1899 | ||
1900 | /* | ||
1901 | * Kick the STAT_LEV_TIMER_CTRL timer. | ||
1902 | * This fixes my hangs on Yukon-EC (0xb6) rev 1. | ||
1903 | * The if clause is there to start the timer only if it has been | ||
1904 | * configured correctly and not been disabled via ethtool. | ||
1905 | */ | ||
1906 | if (sky2_read8(hw, STAT_LEV_TIMER_CTRL) == TIM_START) { | ||
1907 | sky2_write8(hw, STAT_LEV_TIMER_CTRL, TIM_STOP); | ||
1908 | sky2_write8(hw, STAT_LEV_TIMER_CTRL, TIM_START); | ||
1909 | } | ||
1910 | |||
1866 | hwidx = sky2_read16(hw, STAT_PUT_IDX); | 1911 | hwidx = sky2_read16(hw, STAT_PUT_IDX); |
1867 | BUG_ON(hwidx >= STATUS_RING_SIZE); | 1912 | BUG_ON(hwidx >= STATUS_RING_SIZE); |
1868 | rmb(); | 1913 | rmb(); |
@@ -1945,16 +1990,19 @@ exit_loop: | |||
1945 | sky2_tx_check(hw, 0, tx_done[0]); | 1990 | sky2_tx_check(hw, 0, tx_done[0]); |
1946 | sky2_tx_check(hw, 1, tx_done[1]); | 1991 | sky2_tx_check(hw, 1, tx_done[1]); |
1947 | 1992 | ||
1993 | if (sky2_read8(hw, STAT_TX_TIMER_CTRL) == TIM_START) { | ||
1994 | sky2_write8(hw, STAT_TX_TIMER_CTRL, TIM_STOP); | ||
1995 | sky2_write8(hw, STAT_TX_TIMER_CTRL, TIM_START); | ||
1996 | } | ||
1997 | |||
1948 | if (likely(work_done < to_do)) { | 1998 | if (likely(work_done < to_do)) { |
1949 | /* need to restart TX timer */ | 1999 | spin_lock_irq(&hw->hw_lock); |
1950 | if (is_ec_a1(hw)) { | 2000 | __netif_rx_complete(dev0); |
1951 | sky2_write8(hw, STAT_TX_TIMER_CTRL, TIM_STOP); | ||
1952 | sky2_write8(hw, STAT_TX_TIMER_CTRL, TIM_START); | ||
1953 | } | ||
1954 | 2001 | ||
1955 | netif_rx_complete(dev0); | ||
1956 | hw->intr_mask |= Y2_IS_STAT_BMU; | 2002 | hw->intr_mask |= Y2_IS_STAT_BMU; |
1957 | sky2_write32(hw, B0_IMSK, hw->intr_mask); | 2003 | sky2_write32(hw, B0_IMSK, hw->intr_mask); |
2004 | spin_unlock_irq(&hw->hw_lock); | ||
2005 | |||
1958 | return 0; | 2006 | return 0; |
1959 | } else { | 2007 | } else { |
1960 | *budget -= work_done; | 2008 | *budget -= work_done; |
@@ -2017,13 +2065,13 @@ static void sky2_hw_intr(struct sky2_hw *hw) | |||
2017 | if (status & (Y2_IS_MST_ERR | Y2_IS_IRQ_STAT)) { | 2065 | if (status & (Y2_IS_MST_ERR | Y2_IS_IRQ_STAT)) { |
2018 | u16 pci_err; | 2066 | u16 pci_err; |
2019 | 2067 | ||
2020 | pci_read_config_word(hw->pdev, PCI_STATUS, &pci_err); | 2068 | pci_err = sky2_pci_read16(hw, PCI_STATUS); |
2021 | if (net_ratelimit()) | 2069 | if (net_ratelimit()) |
2022 | printk(KERN_ERR PFX "%s: pci hw error (0x%x)\n", | 2070 | printk(KERN_ERR PFX "%s: pci hw error (0x%x)\n", |
2023 | pci_name(hw->pdev), pci_err); | 2071 | pci_name(hw->pdev), pci_err); |
2024 | 2072 | ||
2025 | sky2_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_ON); | 2073 | sky2_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_ON); |
2026 | pci_write_config_word(hw->pdev, PCI_STATUS, | 2074 | sky2_pci_write16(hw, PCI_STATUS, |
2027 | pci_err | PCI_STATUS_ERROR_BITS); | 2075 | pci_err | PCI_STATUS_ERROR_BITS); |
2028 | sky2_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_OFF); | 2076 | sky2_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_OFF); |
2029 | } | 2077 | } |
@@ -2032,7 +2080,7 @@ static void sky2_hw_intr(struct sky2_hw *hw) | |||
2032 | /* PCI-Express uncorrectable Error occurred */ | 2080 | /* PCI-Express uncorrectable Error occurred */ |
2033 | u32 pex_err; | 2081 | u32 pex_err; |
2034 | 2082 | ||
2035 | pci_read_config_dword(hw->pdev, PEX_UNC_ERR_STAT, &pex_err); | 2083 | pex_err = sky2_pci_read32(hw, PEX_UNC_ERR_STAT); |
2036 | 2084 | ||
2037 | if (net_ratelimit()) | 2085 | if (net_ratelimit()) |
2038 | printk(KERN_ERR PFX "%s: pci express error (0x%x)\n", | 2086 | printk(KERN_ERR PFX "%s: pci express error (0x%x)\n", |
@@ -2040,7 +2088,7 @@ static void sky2_hw_intr(struct sky2_hw *hw) | |||
2040 | 2088 | ||
2041 | /* clear the interrupt */ | 2089 | /* clear the interrupt */ |
2042 | sky2_write32(hw, B2_TST_CTRL1, TST_CFG_WRITE_ON); | 2090 | sky2_write32(hw, B2_TST_CTRL1, TST_CFG_WRITE_ON); |
2043 | pci_write_config_dword(hw->pdev, PEX_UNC_ERR_STAT, | 2091 | sky2_pci_write32(hw, PEX_UNC_ERR_STAT, |
2044 | 0xffffffffUL); | 2092 | 0xffffffffUL); |
2045 | sky2_write32(hw, B2_TST_CTRL1, TST_CFG_WRITE_OFF); | 2093 | sky2_write32(hw, B2_TST_CTRL1, TST_CFG_WRITE_OFF); |
2046 | 2094 | ||
@@ -2086,6 +2134,7 @@ static void sky2_phy_intr(struct sky2_hw *hw, unsigned port) | |||
2086 | 2134 | ||
2087 | hw->intr_mask &= ~(port == 0 ? Y2_IS_IRQ_PHY1 : Y2_IS_IRQ_PHY2); | 2135 | hw->intr_mask &= ~(port == 0 ? Y2_IS_IRQ_PHY1 : Y2_IS_IRQ_PHY2); |
2088 | sky2_write32(hw, B0_IMSK, hw->intr_mask); | 2136 | sky2_write32(hw, B0_IMSK, hw->intr_mask); |
2137 | |||
2089 | schedule_work(&sky2->phy_task); | 2138 | schedule_work(&sky2->phy_task); |
2090 | } | 2139 | } |
2091 | 2140 | ||
@@ -2099,6 +2148,7 @@ static irqreturn_t sky2_intr(int irq, void *dev_id, struct pt_regs *regs) | |||
2099 | if (status == 0 || status == ~0) | 2148 | if (status == 0 || status == ~0) |
2100 | return IRQ_NONE; | 2149 | return IRQ_NONE; |
2101 | 2150 | ||
2151 | spin_lock(&hw->hw_lock); | ||
2102 | if (status & Y2_IS_HW_ERR) | 2152 | if (status & Y2_IS_HW_ERR) |
2103 | sky2_hw_intr(hw); | 2153 | sky2_hw_intr(hw); |
2104 | 2154 | ||
@@ -2127,7 +2177,7 @@ static irqreturn_t sky2_intr(int irq, void *dev_id, struct pt_regs *regs) | |||
2127 | 2177 | ||
2128 | sky2_write32(hw, B0_Y2_SP_ICR, 2); | 2178 | sky2_write32(hw, B0_Y2_SP_ICR, 2); |
2129 | 2179 | ||
2130 | sky2_read32(hw, B0_IMSK); | 2180 | spin_unlock(&hw->hw_lock); |
2131 | 2181 | ||
2132 | return IRQ_HANDLED; | 2182 | return IRQ_HANDLED; |
2133 | } | 2183 | } |
@@ -2170,7 +2220,7 @@ static int sky2_reset(struct sky2_hw *hw) | |||
2170 | { | 2220 | { |
2171 | u16 status; | 2221 | u16 status; |
2172 | u8 t8, pmd_type; | 2222 | u8 t8, pmd_type; |
2173 | int i, err; | 2223 | int i; |
2174 | 2224 | ||
2175 | sky2_write8(hw, B0_CTST, CS_RST_CLR); | 2225 | sky2_write8(hw, B0_CTST, CS_RST_CLR); |
2176 | 2226 | ||
@@ -2192,25 +2242,18 @@ static int sky2_reset(struct sky2_hw *hw) | |||
2192 | sky2_write8(hw, B0_CTST, CS_RST_CLR); | 2242 | sky2_write8(hw, B0_CTST, CS_RST_CLR); |
2193 | 2243 | ||
2194 | /* clear PCI errors, if any */ | 2244 | /* clear PCI errors, if any */ |
2195 | err = pci_read_config_word(hw->pdev, PCI_STATUS, &status); | 2245 | status = sky2_pci_read16(hw, PCI_STATUS); |
2196 | if (err) | ||
2197 | goto pci_err; | ||
2198 | 2246 | ||
2199 | sky2_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_ON); | 2247 | sky2_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_ON); |
2200 | err = pci_write_config_word(hw->pdev, PCI_STATUS, | 2248 | sky2_pci_write16(hw, PCI_STATUS, status | PCI_STATUS_ERROR_BITS); |
2201 | status | PCI_STATUS_ERROR_BITS); | 2249 | |
2202 | if (err) | ||
2203 | goto pci_err; | ||
2204 | 2250 | ||
2205 | sky2_write8(hw, B0_CTST, CS_MRST_CLR); | 2251 | sky2_write8(hw, B0_CTST, CS_MRST_CLR); |
2206 | 2252 | ||
2207 | /* clear any PEX errors */ | 2253 | /* clear any PEX errors */ |
2208 | if (pci_find_capability(hw->pdev, PCI_CAP_ID_EXP)) { | 2254 | if (pci_find_capability(hw->pdev, PCI_CAP_ID_EXP)) |
2209 | err = pci_write_config_dword(hw->pdev, PEX_UNC_ERR_STAT, | 2255 | sky2_pci_write32(hw, PEX_UNC_ERR_STAT, 0xffffffffUL); |
2210 | 0xffffffffUL); | 2256 | |
2211 | if (err) | ||
2212 | goto pci_err; | ||
2213 | } | ||
2214 | 2257 | ||
2215 | pmd_type = sky2_read8(hw, B2_PMD_TYP); | 2258 | pmd_type = sky2_read8(hw, B2_PMD_TYP); |
2216 | hw->copper = !(pmd_type == 'L' || pmd_type == 'S'); | 2259 | hw->copper = !(pmd_type == 'L' || pmd_type == 'S'); |
@@ -2309,8 +2352,7 @@ static int sky2_reset(struct sky2_hw *hw) | |||
2309 | sky2_write8(hw, STAT_FIFO_ISR_WM, 16); | 2352 | sky2_write8(hw, STAT_FIFO_ISR_WM, 16); |
2310 | 2353 | ||
2311 | sky2_write32(hw, STAT_TX_TIMER_INI, sky2_us2clk(hw, 1000)); | 2354 | sky2_write32(hw, STAT_TX_TIMER_INI, sky2_us2clk(hw, 1000)); |
2312 | sky2_write32(hw, STAT_LEV_TIMER_INI, sky2_us2clk(hw, 100)); | 2355 | sky2_write32(hw, STAT_ISR_TIMER_INI, sky2_us2clk(hw, 7)); |
2313 | sky2_write32(hw, STAT_ISR_TIMER_INI, sky2_us2clk(hw, 20)); | ||
2314 | } | 2356 | } |
2315 | 2357 | ||
2316 | /* enable status unit */ | 2358 | /* enable status unit */ |
@@ -2321,14 +2363,6 @@ static int sky2_reset(struct sky2_hw *hw) | |||
2321 | sky2_write8(hw, STAT_ISR_TIMER_CTRL, TIM_START); | 2363 | sky2_write8(hw, STAT_ISR_TIMER_CTRL, TIM_START); |
2322 | 2364 | ||
2323 | return 0; | 2365 | return 0; |
2324 | |||
2325 | pci_err: | ||
2326 | /* This is to catch a BIOS bug workaround where | ||
2327 | * mmconfig table doesn't have other buses. | ||
2328 | */ | ||
2329 | printk(KERN_ERR PFX "%s: can't access PCI config space\n", | ||
2330 | pci_name(hw->pdev)); | ||
2331 | return err; | ||
2332 | } | 2366 | } |
2333 | 2367 | ||
2334 | static u32 sky2_supported_modes(const struct sky2_hw *hw) | 2368 | static u32 sky2_supported_modes(const struct sky2_hw *hw) |
@@ -2852,11 +2886,11 @@ static int sky2_set_coalesce(struct net_device *dev, | |||
2852 | (ecmd->rx_coalesce_usecs_irq < tmin || ecmd->rx_coalesce_usecs_irq > tmax)) | 2886 | (ecmd->rx_coalesce_usecs_irq < tmin || ecmd->rx_coalesce_usecs_irq > tmax)) |
2853 | return -EINVAL; | 2887 | return -EINVAL; |
2854 | 2888 | ||
2855 | if (ecmd->tx_max_coalesced_frames > 0xffff) | 2889 | if (ecmd->tx_max_coalesced_frames >= TX_RING_SIZE-1) |
2856 | return -EINVAL; | 2890 | return -EINVAL; |
2857 | if (ecmd->rx_max_coalesced_frames > 0xff) | 2891 | if (ecmd->rx_max_coalesced_frames > RX_MAX_PENDING) |
2858 | return -EINVAL; | 2892 | return -EINVAL; |
2859 | if (ecmd->rx_max_coalesced_frames_irq > 0xff) | 2893 | if (ecmd->rx_max_coalesced_frames_irq >RX_MAX_PENDING) |
2860 | return -EINVAL; | 2894 | return -EINVAL; |
2861 | 2895 | ||
2862 | if (ecmd->tx_coalesce_usecs == 0) | 2896 | if (ecmd->tx_coalesce_usecs == 0) |
@@ -3198,17 +3232,6 @@ static int __devinit sky2_probe(struct pci_dev *pdev, | |||
3198 | } | 3232 | } |
3199 | } | 3233 | } |
3200 | 3234 | ||
3201 | #ifdef __BIG_ENDIAN | ||
3202 | /* byte swap descriptors in hardware */ | ||
3203 | { | ||
3204 | u32 reg; | ||
3205 | |||
3206 | pci_read_config_dword(pdev, PCI_DEV_REG2, ®); | ||
3207 | reg |= PCI_REV_DESC; | ||
3208 | pci_write_config_dword(pdev, PCI_DEV_REG2, reg); | ||
3209 | } | ||
3210 | #endif | ||
3211 | |||
3212 | err = -ENOMEM; | 3235 | err = -ENOMEM; |
3213 | hw = kzalloc(sizeof(*hw), GFP_KERNEL); | 3236 | hw = kzalloc(sizeof(*hw), GFP_KERNEL); |
3214 | if (!hw) { | 3237 | if (!hw) { |
@@ -3226,6 +3249,18 @@ static int __devinit sky2_probe(struct pci_dev *pdev, | |||
3226 | goto err_out_free_hw; | 3249 | goto err_out_free_hw; |
3227 | } | 3250 | } |
3228 | hw->pm_cap = pm_cap; | 3251 | hw->pm_cap = pm_cap; |
3252 | spin_lock_init(&hw->hw_lock); | ||
3253 | |||
3254 | #ifdef __BIG_ENDIAN | ||
3255 | /* byte swap descriptors in hardware */ | ||
3256 | { | ||
3257 | u32 reg; | ||
3258 | |||
3259 | reg = sky2_pci_read32(hw, PCI_DEV_REG2); | ||
3260 | reg |= PCI_REV_DESC; | ||
3261 | sky2_pci_write32(hw, PCI_DEV_REG2, reg); | ||
3262 | } | ||
3263 | #endif | ||
3229 | 3264 | ||
3230 | /* ring for status responses */ | 3265 | /* ring for status responses */ |
3231 | hw->st_le = pci_alloc_consistent(hw->pdev, STATUS_LE_BYTES, | 3266 | hw->st_le = pci_alloc_consistent(hw->pdev, STATUS_LE_BYTES, |
diff --git a/drivers/net/sky2.h b/drivers/net/sky2.h index fd12c289a238..3edb98075e0a 100644 --- a/drivers/net/sky2.h +++ b/drivers/net/sky2.h | |||
@@ -5,14 +5,22 @@ | |||
5 | #define _SKY2_H | 5 | #define _SKY2_H |
6 | 6 | ||
7 | /* PCI config registers */ | 7 | /* PCI config registers */ |
8 | #define PCI_DEV_REG1 0x40 | 8 | enum { |
9 | #define PCI_DEV_REG2 0x44 | 9 | PCI_DEV_REG1 = 0x40, |
10 | #define PCI_DEV_STATUS 0x7c | 10 | PCI_DEV_REG2 = 0x44, |
11 | #define PCI_OS_PCI_X (1<<26) | 11 | PCI_DEV_STATUS = 0x7c, |
12 | PCI_DEV_REG3 = 0x80, | ||
13 | PCI_DEV_REG4 = 0x84, | ||
14 | PCI_DEV_REG5 = 0x88, | ||
15 | }; | ||
12 | 16 | ||
13 | #define PEX_LNK_STAT 0xf2 | 17 | enum { |
14 | #define PEX_UNC_ERR_STAT 0x104 | 18 | PEX_DEV_CAP = 0xe4, |
15 | #define PEX_DEV_CTRL 0xe8 | 19 | PEX_DEV_CTRL = 0xe8, |
20 | PEX_DEV_STA = 0xea, | ||
21 | PEX_LNK_STAT = 0xf2, | ||
22 | PEX_UNC_ERR_STAT= 0x104, | ||
23 | }; | ||
16 | 24 | ||
17 | /* Yukon-2 */ | 25 | /* Yukon-2 */ |
18 | enum pci_dev_reg_1 { | 26 | enum pci_dev_reg_1 { |
@@ -37,6 +45,25 @@ enum pci_dev_reg_2 { | |||
37 | PCI_USEDATA64 = 1<<0, /* Use 64Bit Data bus ext */ | 45 | PCI_USEDATA64 = 1<<0, /* Use 64Bit Data bus ext */ |
38 | }; | 46 | }; |
39 | 47 | ||
48 | /* PCI_OUR_REG_4 32 bit Our Register 4 (Yukon-ECU only) */ | ||
49 | enum pci_dev_reg_4 { | ||
50 | /* (Link Training & Status State Machine) */ | ||
51 | P_TIMER_VALUE_MSK = 0xffL<<16, /* Bit 23..16: Timer Value Mask */ | ||
52 | /* (Active State Power Management) */ | ||
53 | P_FORCE_ASPM_REQUEST = 1<<15, /* Force ASPM Request (A1 only) */ | ||
54 | P_ASPM_GPHY_LINK_DOWN = 1<<14, /* GPHY Link Down (A1 only) */ | ||
55 | P_ASPM_INT_FIFO_EMPTY = 1<<13, /* Internal FIFO Empty (A1 only) */ | ||
56 | P_ASPM_CLKRUN_REQUEST = 1<<12, /* CLKRUN Request (A1 only) */ | ||
57 | |||
58 | P_ASPM_FORCE_CLKREQ_ENA = 1<<4, /* Force CLKREQ Enable (A1b only) */ | ||
59 | P_ASPM_CLKREQ_PAD_CTL = 1<<3, /* CLKREQ PAD Control (A1 only) */ | ||
60 | P_ASPM_A1_MODE_SELECT = 1<<2, /* A1 Mode Select (A1 only) */ | ||
61 | P_CLK_GATE_PEX_UNIT_ENA = 1<<1, /* Enable Gate PEX Unit Clock */ | ||
62 | P_CLK_GATE_ROOT_COR_ENA = 1<<0, /* Enable Gate Root Core Clock */ | ||
63 | P_ASPM_CONTROL_MSK = P_FORCE_ASPM_REQUEST | P_ASPM_GPHY_LINK_DOWN | ||
64 | | P_ASPM_CLKRUN_REQUEST | P_ASPM_INT_FIFO_EMPTY, | ||
65 | }; | ||
66 | |||
40 | 67 | ||
41 | #define PCI_STATUS_ERROR_BITS (PCI_STATUS_DETECTED_PARITY | \ | 68 | #define PCI_STATUS_ERROR_BITS (PCI_STATUS_DETECTED_PARITY | \ |
42 | PCI_STATUS_SIG_SYSTEM_ERROR | \ | 69 | PCI_STATUS_SIG_SYSTEM_ERROR | \ |
@@ -507,6 +534,16 @@ enum { | |||
507 | }; | 534 | }; |
508 | #define Q_ADDR(reg, offs) (B8_Q_REGS + (reg) + (offs)) | 535 | #define Q_ADDR(reg, offs) (B8_Q_REGS + (reg) + (offs)) |
509 | 536 | ||
537 | /* Q_F 32 bit Flag Register */ | ||
538 | enum { | ||
539 | F_ALM_FULL = 1<<27, /* Rx FIFO: almost full */ | ||
540 | F_EMPTY = 1<<27, /* Tx FIFO: empty flag */ | ||
541 | F_FIFO_EOF = 1<<26, /* Tag (EOF Flag) bit in FIFO */ | ||
542 | F_WM_REACHED = 1<<25, /* Watermark reached */ | ||
543 | F_M_RX_RAM_DIS = 1<<24, /* MAC Rx RAM Read Port disable */ | ||
544 | F_FIFO_LEVEL = 0x1fL<<16, /* Bit 23..16: # of Qwords in FIFO */ | ||
545 | F_WATER_MARK = 0x0007ffL, /* Bit 10.. 0: Watermark */ | ||
546 | }; | ||
510 | 547 | ||
511 | /* Queue Prefetch Unit Offsets, use Y2_QADDR() to address (Yukon-2 only)*/ | 548 | /* Queue Prefetch Unit Offsets, use Y2_QADDR() to address (Yukon-2 only)*/ |
512 | enum { | 549 | enum { |
@@ -909,10 +946,12 @@ enum { | |||
909 | PHY_BCOM_ID1_C0 = 0x6044, | 946 | PHY_BCOM_ID1_C0 = 0x6044, |
910 | PHY_BCOM_ID1_C5 = 0x6047, | 947 | PHY_BCOM_ID1_C5 = 0x6047, |
911 | 948 | ||
912 | PHY_MARV_ID1_B0 = 0x0C23, /* Yukon (PHY 88E1011) */ | 949 | PHY_MARV_ID1_B0 = 0x0C23, /* Yukon (PHY 88E1011) */ |
913 | PHY_MARV_ID1_B2 = 0x0C25, /* Yukon-Plus (PHY 88E1011) */ | 950 | PHY_MARV_ID1_B2 = 0x0C25, /* Yukon-Plus (PHY 88E1011) */ |
914 | PHY_MARV_ID1_C2 = 0x0CC2, /* Yukon-EC (PHY 88E1111) */ | 951 | PHY_MARV_ID1_C2 = 0x0CC2, /* Yukon-EC (PHY 88E1111) */ |
915 | PHY_MARV_ID1_Y2 = 0x0C91, /* Yukon-2 (PHY 88E1112) */ | 952 | PHY_MARV_ID1_Y2 = 0x0C91, /* Yukon-2 (PHY 88E1112) */ |
953 | PHY_MARV_ID1_FE = 0x0C83, /* Yukon-FE (PHY 88E3082 Rev.A1) */ | ||
954 | PHY_MARV_ID1_ECU= 0x0CB0, /* Yukon-ECU (PHY 88E1149 Rev.B2?) */ | ||
916 | }; | 955 | }; |
917 | 956 | ||
918 | /* Advertisement register bits */ | 957 | /* Advertisement register bits */ |
@@ -1837,8 +1876,9 @@ struct sky2_port { | |||
1837 | struct sky2_hw { | 1876 | struct sky2_hw { |
1838 | void __iomem *regs; | 1877 | void __iomem *regs; |
1839 | struct pci_dev *pdev; | 1878 | struct pci_dev *pdev; |
1840 | u32 intr_mask; | ||
1841 | struct net_device *dev[2]; | 1879 | struct net_device *dev[2]; |
1880 | spinlock_t hw_lock; | ||
1881 | u32 intr_mask; | ||
1842 | 1882 | ||
1843 | int pm_cap; | 1883 | int pm_cap; |
1844 | int msi; | 1884 | int msi; |
@@ -1912,4 +1952,25 @@ static inline void gma_set_addr(struct sky2_hw *hw, unsigned port, unsigned reg, | |||
1912 | gma_write16(hw, port, reg+4,(u16) addr[2] | ((u16) addr[3] << 8)); | 1952 | gma_write16(hw, port, reg+4,(u16) addr[2] | ((u16) addr[3] << 8)); |
1913 | gma_write16(hw, port, reg+8,(u16) addr[4] | ((u16) addr[5] << 8)); | 1953 | gma_write16(hw, port, reg+8,(u16) addr[4] | ((u16) addr[5] << 8)); |
1914 | } | 1954 | } |
1955 | |||
1956 | /* PCI config space access */ | ||
1957 | static inline u32 sky2_pci_read32(const struct sky2_hw *hw, unsigned reg) | ||
1958 | { | ||
1959 | return sky2_read32(hw, Y2_CFG_SPC + reg); | ||
1960 | } | ||
1961 | |||
1962 | static inline u16 sky2_pci_read16(const struct sky2_hw *hw, unsigned reg) | ||
1963 | { | ||
1964 | return sky2_read16(hw, Y2_CFG_SPC + reg); | ||
1965 | } | ||
1966 | |||
1967 | static inline void sky2_pci_write32(struct sky2_hw *hw, unsigned reg, u32 val) | ||
1968 | { | ||
1969 | sky2_write32(hw, Y2_CFG_SPC + reg, val); | ||
1970 | } | ||
1971 | |||
1972 | static inline void sky2_pci_write16(struct sky2_hw *hw, unsigned reg, u16 val) | ||
1973 | { | ||
1974 | sky2_write16(hw, Y2_CFG_SPC + reg, val); | ||
1975 | } | ||
1915 | #endif | 1976 | #endif |
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c index e7dc653d5bd6..e8e92c853e89 100644 --- a/drivers/net/tg3.c +++ b/drivers/net/tg3.c | |||
@@ -9408,6 +9408,15 @@ static int __devinit tg3_is_sun_570X(struct tg3 *tp) | |||
9408 | return 0; | 9408 | return 0; |
9409 | if (venid == PCI_VENDOR_ID_SUN) | 9409 | if (venid == PCI_VENDOR_ID_SUN) |
9410 | return 1; | 9410 | return 1; |
9411 | |||
9412 | /* TG3 chips onboard the SunBlade-2500 don't have the | ||
9413 | * subsystem-vendor-id set to PCI_VENDOR_ID_SUN but they | ||
9414 | * are distinguishable from non-Sun variants by being | ||
9415 | * named "network" by the firmware. Non-Sun cards will | ||
9416 | * show up as being named "ethernet". | ||
9417 | */ | ||
9418 | if (!strcmp(pcp->prom_name, "network")) | ||
9419 | return 1; | ||
9411 | } | 9420 | } |
9412 | return 0; | 9421 | return 0; |
9413 | } | 9422 | } |
diff --git a/drivers/net/tlan.c b/drivers/net/tlan.c index c2506b56a186..12076f8f942c 100644 --- a/drivers/net/tlan.c +++ b/drivers/net/tlan.c | |||
@@ -536,6 +536,7 @@ static int __devinit TLan_probe1(struct pci_dev *pdev, | |||
536 | u16 device_id; | 536 | u16 device_id; |
537 | int reg, rc = -ENODEV; | 537 | int reg, rc = -ENODEV; |
538 | 538 | ||
539 | #ifdef CONFIG_PCI | ||
539 | if (pdev) { | 540 | if (pdev) { |
540 | rc = pci_enable_device(pdev); | 541 | rc = pci_enable_device(pdev); |
541 | if (rc) | 542 | if (rc) |
@@ -547,6 +548,7 @@ static int __devinit TLan_probe1(struct pci_dev *pdev, | |||
547 | goto err_out; | 548 | goto err_out; |
548 | } | 549 | } |
549 | } | 550 | } |
551 | #endif /* CONFIG_PCI */ | ||
550 | 552 | ||
551 | dev = alloc_etherdev(sizeof(TLanPrivateInfo)); | 553 | dev = alloc_etherdev(sizeof(TLanPrivateInfo)); |
552 | if (dev == NULL) { | 554 | if (dev == NULL) { |
diff --git a/drivers/scsi/libata-core.c b/drivers/scsi/libata-core.c index 5f1d7580218d..4f91b0dc572b 100644 --- a/drivers/scsi/libata-core.c +++ b/drivers/scsi/libata-core.c | |||
@@ -82,6 +82,10 @@ int atapi_enabled = 0; | |||
82 | module_param(atapi_enabled, int, 0444); | 82 | module_param(atapi_enabled, int, 0444); |
83 | MODULE_PARM_DESC(atapi_enabled, "Enable discovery of ATAPI devices (0=off, 1=on)"); | 83 | MODULE_PARM_DESC(atapi_enabled, "Enable discovery of ATAPI devices (0=off, 1=on)"); |
84 | 84 | ||
85 | int libata_fua = 0; | ||
86 | module_param_named(fua, libata_fua, int, 0444); | ||
87 | MODULE_PARM_DESC(fua, "FUA support (0=off, 1=on)"); | ||
88 | |||
85 | MODULE_AUTHOR("Jeff Garzik"); | 89 | MODULE_AUTHOR("Jeff Garzik"); |
86 | MODULE_DESCRIPTION("Library module for ATA devices"); | 90 | MODULE_DESCRIPTION("Library module for ATA devices"); |
87 | MODULE_LICENSE("GPL"); | 91 | MODULE_LICENSE("GPL"); |
diff --git a/drivers/scsi/libata-scsi.c b/drivers/scsi/libata-scsi.c index 07b1e7cc61df..59503c9ccac9 100644 --- a/drivers/scsi/libata-scsi.c +++ b/drivers/scsi/libata-scsi.c | |||
@@ -1708,6 +1708,8 @@ static int ata_dev_supports_fua(u16 *id) | |||
1708 | { | 1708 | { |
1709 | unsigned char model[41], fw[9]; | 1709 | unsigned char model[41], fw[9]; |
1710 | 1710 | ||
1711 | if (!libata_fua) | ||
1712 | return 0; | ||
1711 | if (!ata_id_has_fua(id)) | 1713 | if (!ata_id_has_fua(id)) |
1712 | return 0; | 1714 | return 0; |
1713 | 1715 | ||
diff --git a/drivers/scsi/libata.h b/drivers/scsi/libata.h index e03ce48b7b4b..fddaf479a544 100644 --- a/drivers/scsi/libata.h +++ b/drivers/scsi/libata.h | |||
@@ -41,6 +41,7 @@ struct ata_scsi_args { | |||
41 | 41 | ||
42 | /* libata-core.c */ | 42 | /* libata-core.c */ |
43 | extern int atapi_enabled; | 43 | extern int atapi_enabled; |
44 | extern int libata_fua; | ||
44 | extern struct ata_queued_cmd *ata_qc_new_init(struct ata_port *ap, | 45 | extern struct ata_queued_cmd *ata_qc_new_init(struct ata_port *ap, |
45 | struct ata_device *dev); | 46 | struct ata_device *dev); |
46 | extern int ata_rwcmd_protocol(struct ata_queued_cmd *qc); | 47 | extern int ata_rwcmd_protocol(struct ata_queued_cmd *qc); |
diff --git a/drivers/scsi/sata_sil.c b/drivers/scsi/sata_sil.c index 17f74d3c10e7..9face3c6aa21 100644 --- a/drivers/scsi/sata_sil.c +++ b/drivers/scsi/sata_sil.c | |||
@@ -49,11 +49,13 @@ | |||
49 | #define DRV_VERSION "0.9" | 49 | #define DRV_VERSION "0.9" |
50 | 50 | ||
51 | enum { | 51 | enum { |
52 | SIL_FLAG_RERR_ON_DMA_ACT = (1 << 29), | ||
52 | SIL_FLAG_MOD15WRITE = (1 << 30), | 53 | SIL_FLAG_MOD15WRITE = (1 << 30), |
53 | 54 | ||
54 | sil_3112 = 0, | 55 | sil_3112 = 0, |
55 | sil_3112_m15w = 1, | 56 | sil_3112_m15w = 1, |
56 | sil_3114 = 2, | 57 | sil_3512 = 2, |
58 | sil_3114 = 3, | ||
57 | 59 | ||
58 | SIL_FIFO_R0 = 0x40, | 60 | SIL_FIFO_R0 = 0x40, |
59 | SIL_FIFO_W0 = 0x41, | 61 | SIL_FIFO_W0 = 0x41, |
@@ -90,7 +92,7 @@ static void sil_post_set_mode (struct ata_port *ap); | |||
90 | static const struct pci_device_id sil_pci_tbl[] = { | 92 | static const struct pci_device_id sil_pci_tbl[] = { |
91 | { 0x1095, 0x3112, PCI_ANY_ID, PCI_ANY_ID, 0, 0, sil_3112_m15w }, | 93 | { 0x1095, 0x3112, PCI_ANY_ID, PCI_ANY_ID, 0, 0, sil_3112_m15w }, |
92 | { 0x1095, 0x0240, PCI_ANY_ID, PCI_ANY_ID, 0, 0, sil_3112_m15w }, | 94 | { 0x1095, 0x0240, PCI_ANY_ID, PCI_ANY_ID, 0, 0, sil_3112_m15w }, |
93 | { 0x1095, 0x3512, PCI_ANY_ID, PCI_ANY_ID, 0, 0, sil_3112 }, | 95 | { 0x1095, 0x3512, PCI_ANY_ID, PCI_ANY_ID, 0, 0, sil_3512 }, |
94 | { 0x1095, 0x3114, PCI_ANY_ID, PCI_ANY_ID, 0, 0, sil_3114 }, | 96 | { 0x1095, 0x3114, PCI_ANY_ID, PCI_ANY_ID, 0, 0, sil_3114 }, |
95 | { 0x1002, 0x436e, PCI_ANY_ID, PCI_ANY_ID, 0, 0, sil_3112_m15w }, | 97 | { 0x1002, 0x436e, PCI_ANY_ID, PCI_ANY_ID, 0, 0, sil_3112_m15w }, |
96 | { 0x1002, 0x4379, PCI_ANY_ID, PCI_ANY_ID, 0, 0, sil_3112_m15w }, | 98 | { 0x1002, 0x4379, PCI_ANY_ID, PCI_ANY_ID, 0, 0, sil_3112_m15w }, |
@@ -185,7 +187,8 @@ static const struct ata_port_info sil_port_info[] = { | |||
185 | .mwdma_mask = 0x07, /* mwdma0-2 */ | 187 | .mwdma_mask = 0x07, /* mwdma0-2 */ |
186 | .udma_mask = 0x3f, /* udma0-5 */ | 188 | .udma_mask = 0x3f, /* udma0-5 */ |
187 | .port_ops = &sil_ops, | 189 | .port_ops = &sil_ops, |
188 | }, /* sil_3112_15w - keep it sync'd w/ sil_3112 */ | 190 | }, |
191 | /* sil_3112_15w - keep it sync'd w/ sil_3112 */ | ||
189 | { | 192 | { |
190 | .sht = &sil_sht, | 193 | .sht = &sil_sht, |
191 | .host_flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY | | 194 | .host_flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY | |
@@ -195,11 +198,24 @@ static const struct ata_port_info sil_port_info[] = { | |||
195 | .mwdma_mask = 0x07, /* mwdma0-2 */ | 198 | .mwdma_mask = 0x07, /* mwdma0-2 */ |
196 | .udma_mask = 0x3f, /* udma0-5 */ | 199 | .udma_mask = 0x3f, /* udma0-5 */ |
197 | .port_ops = &sil_ops, | 200 | .port_ops = &sil_ops, |
198 | }, /* sil_3114 */ | 201 | }, |
202 | /* sil_3512 */ | ||
199 | { | 203 | { |
200 | .sht = &sil_sht, | 204 | .sht = &sil_sht, |
201 | .host_flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY | | 205 | .host_flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY | |
202 | ATA_FLAG_SRST | ATA_FLAG_MMIO, | 206 | ATA_FLAG_SRST | ATA_FLAG_MMIO | |
207 | SIL_FLAG_RERR_ON_DMA_ACT, | ||
208 | .pio_mask = 0x1f, /* pio0-4 */ | ||
209 | .mwdma_mask = 0x07, /* mwdma0-2 */ | ||
210 | .udma_mask = 0x3f, /* udma0-5 */ | ||
211 | .port_ops = &sil_ops, | ||
212 | }, | ||
213 | /* sil_3114 */ | ||
214 | { | ||
215 | .sht = &sil_sht, | ||
216 | .host_flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY | | ||
217 | ATA_FLAG_SRST | ATA_FLAG_MMIO | | ||
218 | SIL_FLAG_RERR_ON_DMA_ACT, | ||
203 | .pio_mask = 0x1f, /* pio0-4 */ | 219 | .pio_mask = 0x1f, /* pio0-4 */ |
204 | .mwdma_mask = 0x07, /* mwdma0-2 */ | 220 | .mwdma_mask = 0x07, /* mwdma0-2 */ |
205 | .udma_mask = 0x3f, /* udma0-5 */ | 221 | .udma_mask = 0x3f, /* udma0-5 */ |
@@ -216,12 +232,13 @@ static const struct { | |||
216 | unsigned long scr; /* SATA control register block */ | 232 | unsigned long scr; /* SATA control register block */ |
217 | unsigned long sien; /* SATA Interrupt Enable register */ | 233 | unsigned long sien; /* SATA Interrupt Enable register */ |
218 | unsigned long xfer_mode;/* data transfer mode register */ | 234 | unsigned long xfer_mode;/* data transfer mode register */ |
235 | unsigned long sfis_cfg; /* SATA FIS reception config register */ | ||
219 | } sil_port[] = { | 236 | } sil_port[] = { |
220 | /* port 0 ... */ | 237 | /* port 0 ... */ |
221 | { 0x80, 0x8A, 0x00, 0x100, 0x148, 0xb4 }, | 238 | { 0x80, 0x8A, 0x00, 0x100, 0x148, 0xb4, 0x14c }, |
222 | { 0xC0, 0xCA, 0x08, 0x180, 0x1c8, 0xf4 }, | 239 | { 0xC0, 0xCA, 0x08, 0x180, 0x1c8, 0xf4, 0x1cc }, |
223 | { 0x280, 0x28A, 0x200, 0x300, 0x348, 0x2b4 }, | 240 | { 0x280, 0x28A, 0x200, 0x300, 0x348, 0x2b4, 0x34c }, |
224 | { 0x2C0, 0x2CA, 0x208, 0x380, 0x3c8, 0x2f4 }, | 241 | { 0x2C0, 0x2CA, 0x208, 0x380, 0x3c8, 0x2f4, 0x3cc }, |
225 | /* ... port 3 */ | 242 | /* ... port 3 */ |
226 | }; | 243 | }; |
227 | 244 | ||
@@ -471,6 +488,23 @@ static int sil_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) | |||
471 | dev_printk(KERN_WARNING, &pdev->dev, | 488 | dev_printk(KERN_WARNING, &pdev->dev, |
472 | "cache line size not set. Driver may not function\n"); | 489 | "cache line size not set. Driver may not function\n"); |
473 | 490 | ||
491 | /* Apply R_ERR on DMA activate FIS errata workaround */ | ||
492 | if (probe_ent->host_flags & SIL_FLAG_RERR_ON_DMA_ACT) { | ||
493 | int cnt; | ||
494 | |||
495 | for (i = 0, cnt = 0; i < probe_ent->n_ports; i++) { | ||
496 | tmp = readl(mmio_base + sil_port[i].sfis_cfg); | ||
497 | if ((tmp & 0x3) != 0x01) | ||
498 | continue; | ||
499 | if (!cnt) | ||
500 | dev_printk(KERN_INFO, &pdev->dev, | ||
501 | "Applying R_ERR on DMA activate " | ||
502 | "FIS errata fix\n"); | ||
503 | writel(tmp & ~0x3, mmio_base + sil_port[i].sfis_cfg); | ||
504 | cnt++; | ||
505 | } | ||
506 | } | ||
507 | |||
474 | if (ent->driver_data == sil_3114) { | 508 | if (ent->driver_data == sil_3114) { |
475 | irq_mask = SIL_MASK_4PORT; | 509 | irq_mask = SIL_MASK_4PORT; |
476 | 510 | ||
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index 930db398d107..9d9872347f56 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c | |||
@@ -89,6 +89,11 @@ | |||
89 | #define SD_MAX_RETRIES 5 | 89 | #define SD_MAX_RETRIES 5 |
90 | #define SD_PASSTHROUGH_RETRIES 1 | 90 | #define SD_PASSTHROUGH_RETRIES 1 |
91 | 91 | ||
92 | /* | ||
93 | * Size of the initial data buffer for mode and read capacity data | ||
94 | */ | ||
95 | #define SD_BUF_SIZE 512 | ||
96 | |||
92 | static void scsi_disk_release(struct kref *kref); | 97 | static void scsi_disk_release(struct kref *kref); |
93 | 98 | ||
94 | struct scsi_disk { | 99 | struct scsi_disk { |
@@ -1239,7 +1244,7 @@ sd_do_mode_sense(struct scsi_device *sdp, int dbd, int modepage, | |||
1239 | 1244 | ||
1240 | /* | 1245 | /* |
1241 | * read write protect setting, if possible - called only in sd_revalidate_disk() | 1246 | * read write protect setting, if possible - called only in sd_revalidate_disk() |
1242 | * called with buffer of length 512 | 1247 | * called with buffer of length SD_BUF_SIZE |
1243 | */ | 1248 | */ |
1244 | static void | 1249 | static void |
1245 | sd_read_write_protect_flag(struct scsi_disk *sdkp, char *diskname, | 1250 | sd_read_write_protect_flag(struct scsi_disk *sdkp, char *diskname, |
@@ -1297,7 +1302,7 @@ sd_read_write_protect_flag(struct scsi_disk *sdkp, char *diskname, | |||
1297 | 1302 | ||
1298 | /* | 1303 | /* |
1299 | * sd_read_cache_type - called only from sd_revalidate_disk() | 1304 | * sd_read_cache_type - called only from sd_revalidate_disk() |
1300 | * called with buffer of length 512 | 1305 | * called with buffer of length SD_BUF_SIZE |
1301 | */ | 1306 | */ |
1302 | static void | 1307 | static void |
1303 | sd_read_cache_type(struct scsi_disk *sdkp, char *diskname, | 1308 | sd_read_cache_type(struct scsi_disk *sdkp, char *diskname, |
@@ -1342,6 +1347,8 @@ sd_read_cache_type(struct scsi_disk *sdkp, char *diskname, | |||
1342 | 1347 | ||
1343 | /* Take headers and block descriptors into account */ | 1348 | /* Take headers and block descriptors into account */ |
1344 | len += data.header_length + data.block_descriptor_length; | 1349 | len += data.header_length + data.block_descriptor_length; |
1350 | if (len > SD_BUF_SIZE) | ||
1351 | goto bad_sense; | ||
1345 | 1352 | ||
1346 | /* Get the data */ | 1353 | /* Get the data */ |
1347 | res = sd_do_mode_sense(sdp, dbd, modepage, buffer, len, &data, &sshdr); | 1354 | res = sd_do_mode_sense(sdp, dbd, modepage, buffer, len, &data, &sshdr); |
@@ -1354,6 +1361,12 @@ sd_read_cache_type(struct scsi_disk *sdkp, char *diskname, | |||
1354 | int ct = 0; | 1361 | int ct = 0; |
1355 | int offset = data.header_length + data.block_descriptor_length; | 1362 | int offset = data.header_length + data.block_descriptor_length; |
1356 | 1363 | ||
1364 | if (offset >= SD_BUF_SIZE - 2) { | ||
1365 | printk(KERN_ERR "%s: malformed MODE SENSE response", | ||
1366 | diskname); | ||
1367 | goto defaults; | ||
1368 | } | ||
1369 | |||
1357 | if ((buffer[offset] & 0x3f) != modepage) { | 1370 | if ((buffer[offset] & 0x3f) != modepage) { |
1358 | printk(KERN_ERR "%s: got wrong page\n", diskname); | 1371 | printk(KERN_ERR "%s: got wrong page\n", diskname); |
1359 | goto defaults; | 1372 | goto defaults; |
@@ -1398,6 +1411,7 @@ defaults: | |||
1398 | diskname); | 1411 | diskname); |
1399 | sdkp->WCE = 0; | 1412 | sdkp->WCE = 0; |
1400 | sdkp->RCD = 0; | 1413 | sdkp->RCD = 0; |
1414 | sdkp->DPOFUA = 0; | ||
1401 | } | 1415 | } |
1402 | 1416 | ||
1403 | /** | 1417 | /** |
@@ -1421,7 +1435,7 @@ static int sd_revalidate_disk(struct gendisk *disk) | |||
1421 | if (!scsi_device_online(sdp)) | 1435 | if (!scsi_device_online(sdp)) |
1422 | goto out; | 1436 | goto out; |
1423 | 1437 | ||
1424 | buffer = kmalloc(512, GFP_KERNEL | __GFP_DMA); | 1438 | buffer = kmalloc(SD_BUF_SIZE, GFP_KERNEL | __GFP_DMA); |
1425 | if (!buffer) { | 1439 | if (!buffer) { |
1426 | printk(KERN_WARNING "(sd_revalidate_disk:) Memory allocation " | 1440 | printk(KERN_WARNING "(sd_revalidate_disk:) Memory allocation " |
1427 | "failure.\n"); | 1441 | "failure.\n"); |
diff --git a/drivers/serial/8250.c b/drivers/serial/8250.c index 244e8ff11977..7aca22c9976d 100644 --- a/drivers/serial/8250.c +++ b/drivers/serial/8250.c | |||
@@ -2326,6 +2326,12 @@ static struct uart_driver serial8250_reg = { | |||
2326 | .cons = SERIAL8250_CONSOLE, | 2326 | .cons = SERIAL8250_CONSOLE, |
2327 | }; | 2327 | }; |
2328 | 2328 | ||
2329 | /* | ||
2330 | * early_serial_setup - early registration for 8250 ports | ||
2331 | * | ||
2332 | * Setup an 8250 port structure prior to console initialisation. Use | ||
2333 | * after console initialisation will cause undefined behaviour. | ||
2334 | */ | ||
2329 | int __init early_serial_setup(struct uart_port *port) | 2335 | int __init early_serial_setup(struct uart_port *port) |
2330 | { | 2336 | { |
2331 | if (port->line >= ARRAY_SIZE(serial8250_ports)) | 2337 | if (port->line >= ARRAY_SIZE(serial8250_ports)) |
diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig index e64ed16bd42f..f5079c78ba4e 100644 --- a/drivers/video/Kconfig +++ b/drivers/video/Kconfig | |||
@@ -520,7 +520,7 @@ config FB_GBE | |||
520 | config FB_GBE_MEM | 520 | config FB_GBE_MEM |
521 | int "Video memory size in MB" | 521 | int "Video memory size in MB" |
522 | depends on FB_GBE | 522 | depends on FB_GBE |
523 | default 8 | 523 | default 4 |
524 | help | 524 | help |
525 | This is the amount of memory reserved for the framebuffer, | 525 | This is the amount of memory reserved for the framebuffer, |
526 | which can be any value between 1MB and 8MB. | 526 | which can be any value between 1MB and 8MB. |
diff --git a/drivers/video/asiliantfb.c b/drivers/video/asiliantfb.c index 69f75547865d..c924d81f7978 100644 --- a/drivers/video/asiliantfb.c +++ b/drivers/video/asiliantfb.c | |||
@@ -322,32 +322,29 @@ static int asiliantfb_setcolreg(u_int regno, u_int red, u_int green, u_int blue, | |||
322 | writeb(green, mmio_base + 0x791); | 322 | writeb(green, mmio_base + 0x791); |
323 | writeb(blue, mmio_base + 0x791); | 323 | writeb(blue, mmio_base + 0x791); |
324 | 324 | ||
325 | switch(p->var.bits_per_pixel) { | 325 | if (regno < 16) { |
326 | case 15: | 326 | switch(p->var.red.offset) { |
327 | if (regno < 16) { | 327 | case 10: /* RGB 555 */ |
328 | ((u32 *)(p->pseudo_palette))[regno] = | 328 | ((u32 *)(p->pseudo_palette))[regno] = |
329 | ((red & 0xf8) << 7) | | 329 | ((red & 0xf8) << 7) | |
330 | ((green & 0xf8) << 2) | | 330 | ((green & 0xf8) << 2) | |
331 | ((blue & 0xf8) >> 3); | 331 | ((blue & 0xf8) >> 3); |
332 | } | 332 | break; |
333 | break; | 333 | case 11: /* RGB 565 */ |
334 | case 16: | ||
335 | if (regno < 16) { | ||
336 | ((u32 *)(p->pseudo_palette))[regno] = | 334 | ((u32 *)(p->pseudo_palette))[regno] = |
337 | ((red & 0xf8) << 8) | | 335 | ((red & 0xf8) << 8) | |
338 | ((green & 0xfc) << 3) | | 336 | ((green & 0xfc) << 3) | |
339 | ((blue & 0xf8) >> 3); | 337 | ((blue & 0xf8) >> 3); |
340 | } | 338 | break; |
341 | break; | 339 | case 16: /* RGB 888 */ |
342 | case 24: | ||
343 | if (regno < 24) { | ||
344 | ((u32 *)(p->pseudo_palette))[regno] = | 340 | ((u32 *)(p->pseudo_palette))[regno] = |
345 | (red << 16) | | 341 | (red << 16) | |
346 | (green << 8) | | 342 | (green << 8) | |
347 | (blue); | 343 | (blue); |
344 | break; | ||
348 | } | 345 | } |
349 | break; | ||
350 | } | 346 | } |
347 | |||
351 | return 0; | 348 | return 0; |
352 | } | 349 | } |
353 | 350 | ||
diff --git a/drivers/video/au1100fb.c b/drivers/video/au1100fb.c index 2406899f1207..3d04b2def0f1 100644 --- a/drivers/video/au1100fb.c +++ b/drivers/video/au1100fb.c | |||
@@ -49,6 +49,7 @@ | |||
49 | #include <linux/interrupt.h> | 49 | #include <linux/interrupt.h> |
50 | #include <linux/ctype.h> | 50 | #include <linux/ctype.h> |
51 | #include <linux/dma-mapping.h> | 51 | #include <linux/dma-mapping.h> |
52 | #include <linux/platform_device.h> | ||
52 | 53 | ||
53 | #include <asm/mach-au1x00/au1000.h> | 54 | #include <asm/mach-au1x00/au1000.h> |
54 | 55 | ||
@@ -406,7 +407,7 @@ int au1100fb_fb_mmap(struct fb_info *fbi, struct vm_area_struct *vma) | |||
406 | 407 | ||
407 | vma->vm_flags |= VM_IO; | 408 | vma->vm_flags |= VM_IO; |
408 | 409 | ||
409 | if (io_remap_page_range(vma, vma->vm_start, off, | 410 | if (io_remap_pfn_range(vma, vma->vm_start, off >> PAGE_SHIFT, |
410 | vma->vm_end - vma->vm_start, | 411 | vma->vm_end - vma->vm_start, |
411 | vma->vm_page_prot)) { | 412 | vma->vm_page_prot)) { |
412 | return -EAGAIN; | 413 | return -EAGAIN; |
diff --git a/drivers/video/console/vgacon.c b/drivers/video/console/vgacon.c index 12d9329d1408..5a86978537d2 100644 --- a/drivers/video/console/vgacon.c +++ b/drivers/video/console/vgacon.c | |||
@@ -509,57 +509,60 @@ static int vgacon_doresize(struct vc_data *c, | |||
509 | { | 509 | { |
510 | unsigned long flags; | 510 | unsigned long flags; |
511 | unsigned int scanlines = height * c->vc_font.height; | 511 | unsigned int scanlines = height * c->vc_font.height; |
512 | u8 scanlines_lo, r7, vsync_end, mode, max_scan; | 512 | u8 scanlines_lo = 0, r7 = 0, vsync_end = 0, mode, max_scan; |
513 | 513 | ||
514 | spin_lock_irqsave(&vga_lock, flags); | 514 | spin_lock_irqsave(&vga_lock, flags); |
515 | 515 | ||
516 | outb_p(VGA_CRTC_MAX_SCAN, vga_video_port_reg); | ||
517 | max_scan = inb_p(vga_video_port_val); | ||
518 | |||
519 | if (max_scan & 0x80) | ||
520 | scanlines <<= 1; | ||
521 | |||
522 | vgacon_xres = width * VGA_FONTWIDTH; | 516 | vgacon_xres = width * VGA_FONTWIDTH; |
523 | vgacon_yres = height * c->vc_font.height; | 517 | vgacon_yres = height * c->vc_font.height; |
524 | outb_p(VGA_CRTC_MODE, vga_video_port_reg); | 518 | if (vga_video_type >= VIDEO_TYPE_VGAC) { |
525 | mode = inb_p(vga_video_port_val); | 519 | outb_p(VGA_CRTC_MAX_SCAN, vga_video_port_reg); |
520 | max_scan = inb_p(vga_video_port_val); | ||
526 | 521 | ||
527 | if (mode & 0x04) | 522 | if (max_scan & 0x80) |
528 | scanlines >>= 1; | 523 | scanlines <<= 1; |
529 | 524 | ||
530 | scanlines -= 1; | 525 | outb_p(VGA_CRTC_MODE, vga_video_port_reg); |
531 | scanlines_lo = scanlines & 0xff; | 526 | mode = inb_p(vga_video_port_val); |
532 | 527 | ||
533 | outb_p(VGA_CRTC_OVERFLOW, vga_video_port_reg); | 528 | if (mode & 0x04) |
534 | r7 = inb_p(vga_video_port_val) & ~0x42; | 529 | scanlines >>= 1; |
535 | 530 | ||
536 | if (scanlines & 0x100) | 531 | scanlines -= 1; |
537 | r7 |= 0x02; | 532 | scanlines_lo = scanlines & 0xff; |
538 | if (scanlines & 0x200) | ||
539 | r7 |= 0x40; | ||
540 | 533 | ||
541 | /* deprotect registers */ | 534 | outb_p(VGA_CRTC_OVERFLOW, vga_video_port_reg); |
542 | outb_p(VGA_CRTC_V_SYNC_END, vga_video_port_reg); | 535 | r7 = inb_p(vga_video_port_val) & ~0x42; |
543 | vsync_end = inb_p(vga_video_port_val); | 536 | |
544 | outb_p(VGA_CRTC_V_SYNC_END, vga_video_port_reg); | 537 | if (scanlines & 0x100) |
545 | outb_p(vsync_end & ~0x80, vga_video_port_val); | 538 | r7 |= 0x02; |
539 | if (scanlines & 0x200) | ||
540 | r7 |= 0x40; | ||
541 | |||
542 | /* deprotect registers */ | ||
543 | outb_p(VGA_CRTC_V_SYNC_END, vga_video_port_reg); | ||
544 | vsync_end = inb_p(vga_video_port_val); | ||
545 | outb_p(VGA_CRTC_V_SYNC_END, vga_video_port_reg); | ||
546 | outb_p(vsync_end & ~0x80, vga_video_port_val); | ||
547 | } | ||
546 | 548 | ||
547 | outb_p(VGA_CRTC_H_DISP, vga_video_port_reg); | 549 | outb_p(VGA_CRTC_H_DISP, vga_video_port_reg); |
548 | outb_p(width - 1, vga_video_port_val); | 550 | outb_p(width - 1, vga_video_port_val); |
549 | outb_p(VGA_CRTC_OFFSET, vga_video_port_reg); | 551 | outb_p(VGA_CRTC_OFFSET, vga_video_port_reg); |
550 | outb_p(width >> 1, vga_video_port_val); | 552 | outb_p(width >> 1, vga_video_port_val); |
551 | 553 | ||
552 | outb_p(VGA_CRTC_V_DISP_END, vga_video_port_reg); | 554 | if (vga_video_type >= VIDEO_TYPE_VGAC) { |
553 | outb_p(scanlines_lo, vga_video_port_val); | 555 | outb_p(VGA_CRTC_V_DISP_END, vga_video_port_reg); |
554 | outb_p(VGA_CRTC_OVERFLOW, vga_video_port_reg); | 556 | outb_p(scanlines_lo, vga_video_port_val); |
555 | outb_p(r7,vga_video_port_val); | 557 | outb_p(VGA_CRTC_OVERFLOW, vga_video_port_reg); |
558 | outb_p(r7,vga_video_port_val); | ||
556 | 559 | ||
557 | /* reprotect registers */ | 560 | /* reprotect registers */ |
558 | outb_p(VGA_CRTC_V_SYNC_END, vga_video_port_reg); | 561 | outb_p(VGA_CRTC_V_SYNC_END, vga_video_port_reg); |
559 | outb_p(vsync_end, vga_video_port_val); | 562 | outb_p(vsync_end, vga_video_port_val); |
563 | } | ||
560 | 564 | ||
561 | spin_unlock_irqrestore(&vga_lock, flags); | 565 | spin_unlock_irqrestore(&vga_lock, flags); |
562 | |||
563 | return 0; | 566 | return 0; |
564 | } | 567 | } |
565 | 568 | ||
diff --git a/drivers/video/gbefb.c b/drivers/video/gbefb.c index c9a7cdf6d543..5e25b9860196 100644 --- a/drivers/video/gbefb.c +++ b/drivers/video/gbefb.c | |||
@@ -656,12 +656,15 @@ static int gbefb_set_par(struct fb_info *info) | |||
656 | switch (bytesPerPixel) { | 656 | switch (bytesPerPixel) { |
657 | case 1: | 657 | case 1: |
658 | SET_GBE_FIELD(WID, TYP, val, GBE_CMODE_I8); | 658 | SET_GBE_FIELD(WID, TYP, val, GBE_CMODE_I8); |
659 | info->fix.visual = FB_VISUAL_PSEUDOCOLOR; | ||
659 | break; | 660 | break; |
660 | case 2: | 661 | case 2: |
661 | SET_GBE_FIELD(WID, TYP, val, GBE_CMODE_ARGB5); | 662 | SET_GBE_FIELD(WID, TYP, val, GBE_CMODE_ARGB5); |
663 | info->fix.visual = FB_VISUAL_TRUECOLOR; | ||
662 | break; | 664 | break; |
663 | case 4: | 665 | case 4: |
664 | SET_GBE_FIELD(WID, TYP, val, GBE_CMODE_RGB8); | 666 | SET_GBE_FIELD(WID, TYP, val, GBE_CMODE_RGB8); |
667 | info->fix.visual = FB_VISUAL_TRUECOLOR; | ||
665 | break; | 668 | break; |
666 | } | 669 | } |
667 | SET_GBE_FIELD(WID, BUF, val, GBE_BMODE_BOTH); | 670 | SET_GBE_FIELD(WID, BUF, val, GBE_BMODE_BOTH); |
diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c index 1b117a441298..c2eac2a50bd2 100644 --- a/fs/binfmt_elf.c +++ b/fs/binfmt_elf.c | |||
@@ -938,6 +938,11 @@ static int load_elf_binary(struct linux_binprm * bprm, struct pt_regs * regs) | |||
938 | kfree(elf_interpreter); | 938 | kfree(elf_interpreter); |
939 | } else { | 939 | } else { |
940 | elf_entry = loc->elf_ex.e_entry; | 940 | elf_entry = loc->elf_ex.e_entry; |
941 | if (BAD_ADDR(elf_entry)) { | ||
942 | send_sig(SIGSEGV, current, 0); | ||
943 | retval = -ENOEXEC; /* Nobody gets to see this, but.. */ | ||
944 | goto out_free_dentry; | ||
945 | } | ||
941 | } | 946 | } |
942 | 947 | ||
943 | kfree(elf_phdata); | 948 | kfree(elf_phdata); |
diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c index 057e60217fc5..537ac70edfe5 100644 --- a/fs/compat_ioctl.c +++ b/fs/compat_ioctl.c | |||
@@ -2531,18 +2531,9 @@ static int rtc_ioctl(unsigned fd, unsigned cmd, unsigned long arg) | |||
2531 | val32 = kval; | 2531 | val32 = kval; |
2532 | return put_user(val32, (unsigned int __user *)arg); | 2532 | return put_user(val32, (unsigned int __user *)arg); |
2533 | case RTC_IRQP_SET32: | 2533 | case RTC_IRQP_SET32: |
2534 | return sys_ioctl(fd, RTC_IRQP_SET, arg); | ||
2534 | case RTC_EPOCH_SET32: | 2535 | case RTC_EPOCH_SET32: |
2535 | ret = get_user(val32, (unsigned int __user *)arg); | 2536 | return sys_ioctl(fd, RTC_EPOCH_SET, arg); |
2536 | if (ret) | ||
2537 | return ret; | ||
2538 | kval = val32; | ||
2539 | |||
2540 | set_fs(KERNEL_DS); | ||
2541 | ret = sys_ioctl(fd, (cmd == RTC_IRQP_SET32) ? | ||
2542 | RTC_IRQP_SET : RTC_EPOCH_SET, | ||
2543 | (unsigned long)&kval); | ||
2544 | set_fs(oldfs); | ||
2545 | return ret; | ||
2546 | default: | 2537 | default: |
2547 | /* unreached */ | 2538 | /* unreached */ |
2548 | return -ENOIOCTLCMD; | 2539 | return -ENOIOCTLCMD; |
diff --git a/fs/namei.c b/fs/namei.c index e28de846c591..557dcf395ca1 100644 --- a/fs/namei.c +++ b/fs/namei.c | |||
@@ -2224,13 +2224,17 @@ int vfs_link(struct dentry *old_dentry, struct inode *dir, struct dentry *new_de | |||
2224 | * and other special files. --ADM | 2224 | * and other special files. --ADM |
2225 | */ | 2225 | */ |
2226 | asmlinkage long sys_linkat(int olddfd, const char __user *oldname, | 2226 | asmlinkage long sys_linkat(int olddfd, const char __user *oldname, |
2227 | int newdfd, const char __user *newname) | 2227 | int newdfd, const char __user *newname, |
2228 | int flags) | ||
2228 | { | 2229 | { |
2229 | struct dentry *new_dentry; | 2230 | struct dentry *new_dentry; |
2230 | struct nameidata nd, old_nd; | 2231 | struct nameidata nd, old_nd; |
2231 | int error; | 2232 | int error; |
2232 | char * to; | 2233 | char * to; |
2233 | 2234 | ||
2235 | if (flags != 0) | ||
2236 | return -EINVAL; | ||
2237 | |||
2234 | to = getname(newname); | 2238 | to = getname(newname); |
2235 | if (IS_ERR(to)) | 2239 | if (IS_ERR(to)) |
2236 | return PTR_ERR(to); | 2240 | return PTR_ERR(to); |
@@ -2263,7 +2267,7 @@ exit: | |||
2263 | 2267 | ||
2264 | asmlinkage long sys_link(const char __user *oldname, const char __user *newname) | 2268 | asmlinkage long sys_link(const char __user *oldname, const char __user *newname) |
2265 | { | 2269 | { |
2266 | return sys_linkat(AT_FDCWD, oldname, AT_FDCWD, newname); | 2270 | return sys_linkat(AT_FDCWD, oldname, AT_FDCWD, newname, 0); |
2267 | } | 2271 | } |
2268 | 2272 | ||
2269 | /* | 2273 | /* |
diff --git a/fs/ntfs/ChangeLog b/fs/ntfs/ChangeLog index 02f44094bda9..9d8ffa89e2c2 100644 --- a/fs/ntfs/ChangeLog +++ b/fs/ntfs/ChangeLog | |||
@@ -1,9 +1,9 @@ | |||
1 | ToDo/Notes: | 1 | ToDo/Notes: |
2 | - Find and fix bugs. | 2 | - Find and fix bugs. |
3 | - The only places in the kernel where a file is resized are | 3 | - The only places in the kernel where a file is resized are |
4 | ntfs_file_write*() and ntfs_truncate() for both of which i_sem is | 4 | ntfs_file_write*() and ntfs_truncate() for both of which i_mutex is |
5 | held. Just have to be careful in read-/writepage and other helpers | 5 | held. Just have to be careful in read-/writepage and other helpers |
6 | not running under i_sem that we play nice... Also need to be careful | 6 | not running under i_mutex that we play nice. Also need to be careful |
7 | with initialized_size extension in ntfs_file_write*() and writepage. | 7 | with initialized_size extension in ntfs_file_write*() and writepage. |
8 | UPDATE: The only things that need to be checked are the compressed | 8 | UPDATE: The only things that need to be checked are the compressed |
9 | write and the other attribute resize/write cases like index | 9 | write and the other attribute resize/write cases like index |
@@ -19,6 +19,24 @@ ToDo/Notes: | |||
19 | - Enable the code for setting the NT4 compatibility flag when we start | 19 | - Enable the code for setting the NT4 compatibility flag when we start |
20 | making NTFS 1.2 specific modifications. | 20 | making NTFS 1.2 specific modifications. |
21 | 21 | ||
22 | 2.1.26 - Minor bug fixes and updates. | ||
23 | |||
24 | - Fix a potential overflow in file.c where a cast to s64 was missing in | ||
25 | a left shift of a page index. | ||
26 | - The struct inode has had its i_sem semaphore changed to a mutex named | ||
27 | i_mutex. | ||
28 | - We have struct kmem_cache now so use it instead of the typedef | ||
29 | kmem_cache_t. (Pekka Enberg) | ||
30 | - Implement support for sector sizes above 512 bytes (up to the maximum | ||
31 | supported by NTFS which is 4096 bytes). | ||
32 | - Do more detailed reporting of why we cannot mount read-write by | ||
33 | special casing the VOLUME_MODIFIED_BY_CHKDSK flag. | ||
34 | - Miscellaneous updates to layout.h. | ||
35 | - Cope with attribute list attribute having invalid flags. Windows | ||
36 | copes with this and even chkdsk does not detect or fix this so we | ||
37 | have to cope with it, too. Thanks to Pawel Kot for reporting the | ||
38 | problem. | ||
39 | |||
22 | 2.1.25 - (Almost) fully implement write(2) and truncate(2). | 40 | 2.1.25 - (Almost) fully implement write(2) and truncate(2). |
23 | 41 | ||
24 | - Change ntfs_map_runlist_nolock(), ntfs_attr_find_vcn_nolock() and | 42 | - Change ntfs_map_runlist_nolock(), ntfs_attr_find_vcn_nolock() and |
@@ -373,7 +391,7 @@ ToDo/Notes: | |||
373 | single one of them had an mst error. (Thanks to Ken MacFerrin for | 391 | single one of them had an mst error. (Thanks to Ken MacFerrin for |
374 | the bug report.) | 392 | the bug report.) |
375 | - Fix error handling in fs/ntfs/quota.c::ntfs_mark_quotas_out_of_date() | 393 | - Fix error handling in fs/ntfs/quota.c::ntfs_mark_quotas_out_of_date() |
376 | where we failed to release i_sem on the $Quota/$Q attribute inode. | 394 | where we failed to release i_mutex on the $Quota/$Q attribute inode. |
377 | - Fix bug in handling of bad inodes in fs/ntfs/namei.c::ntfs_lookup(). | 395 | - Fix bug in handling of bad inodes in fs/ntfs/namei.c::ntfs_lookup(). |
378 | - Add mapping of unmapped buffers to all remaining code paths, i.e. | 396 | - Add mapping of unmapped buffers to all remaining code paths, i.e. |
379 | fs/ntfs/aops.c::ntfs_write_mst_block(), mft.c::ntfs_sync_mft_mirror(), | 397 | fs/ntfs/aops.c::ntfs_write_mst_block(), mft.c::ntfs_sync_mft_mirror(), |
@@ -874,7 +892,7 @@ ToDo/Notes: | |||
874 | clusters. (Philipp Thomas) | 892 | clusters. (Philipp Thomas) |
875 | - attrib.c::load_attribute_list(): Fix bug when initialized_size is a | 893 | - attrib.c::load_attribute_list(): Fix bug when initialized_size is a |
876 | multiple of the block_size but not the cluster size. (Szabolcs | 894 | multiple of the block_size but not the cluster size. (Szabolcs |
877 | Szakacsits <szaka@sienet.hu>) | 895 | Szakacsits) |
878 | 896 | ||
879 | 2.1.2 - Important bug fixes aleviating the hangs in statfs. | 897 | 2.1.2 - Important bug fixes aleviating the hangs in statfs. |
880 | 898 | ||
@@ -884,7 +902,7 @@ ToDo/Notes: | |||
884 | 902 | ||
885 | - Add handling for initialized_size != data_size in compressed files. | 903 | - Add handling for initialized_size != data_size in compressed files. |
886 | - Reduce function local stack usage from 0x3d4 bytes to just noise in | 904 | - Reduce function local stack usage from 0x3d4 bytes to just noise in |
887 | fs/ntfs/upcase.c. (Randy Dunlap <rdunlap@xenotime.net>) | 905 | fs/ntfs/upcase.c. (Randy Dunlap) |
888 | - Remove compiler warnings for newer gcc. | 906 | - Remove compiler warnings for newer gcc. |
889 | - Pages are no longer kmapped by mm/filemap.c::generic_file_write() | 907 | - Pages are no longer kmapped by mm/filemap.c::generic_file_write() |
890 | around calls to ->{prepare,commit}_write. Adapt NTFS appropriately | 908 | around calls to ->{prepare,commit}_write. Adapt NTFS appropriately |
@@ -1201,11 +1219,11 @@ ToDo/Notes: | |||
1201 | the kernel. We probably want a kernel generic init_address_space() | 1219 | the kernel. We probably want a kernel generic init_address_space() |
1202 | function... | 1220 | function... |
1203 | - Drop BKL from ntfs_readdir() after consultation with Al Viro. The | 1221 | - Drop BKL from ntfs_readdir() after consultation with Al Viro. The |
1204 | only caller of ->readdir() is vfs_readdir() which holds i_sem during | 1222 | only caller of ->readdir() is vfs_readdir() which holds i_mutex |
1205 | the call, and i_sem is sufficient protection against changes in the | 1223 | during the call, and i_mutex is sufficient protection against changes |
1206 | directory inode (including ->i_size). | 1224 | in the directory inode (including ->i_size). |
1207 | - Use generic_file_llseek() for directories (as opposed to | 1225 | - Use generic_file_llseek() for directories (as opposed to |
1208 | default_llseek()) as this downs i_sem instead of the BKL which is | 1226 | default_llseek()) as this downs i_mutex instead of the BKL which is |
1209 | what we now need for exclusion against ->f_pos changes considering we | 1227 | what we now need for exclusion against ->f_pos changes considering we |
1210 | no longer take the BKL in ntfs_readdir(). | 1228 | no longer take the BKL in ntfs_readdir(). |
1211 | 1229 | ||
diff --git a/fs/ntfs/Makefile b/fs/ntfs/Makefile index d0d45d1c853a..d95fac7fdeb6 100644 --- a/fs/ntfs/Makefile +++ b/fs/ntfs/Makefile | |||
@@ -6,7 +6,7 @@ ntfs-objs := aops.o attrib.o collate.o compress.o debug.o dir.o file.o \ | |||
6 | index.o inode.o mft.o mst.o namei.o runlist.o super.o sysctl.o \ | 6 | index.o inode.o mft.o mst.o namei.o runlist.o super.o sysctl.o \ |
7 | unistr.o upcase.o | 7 | unistr.o upcase.o |
8 | 8 | ||
9 | EXTRA_CFLAGS = -DNTFS_VERSION=\"2.1.25\" | 9 | EXTRA_CFLAGS = -DNTFS_VERSION=\"2.1.26\" |
10 | 10 | ||
11 | ifeq ($(CONFIG_NTFS_DEBUG),y) | 11 | ifeq ($(CONFIG_NTFS_DEBUG),y) |
12 | EXTRA_CFLAGS += -DDEBUG | 12 | EXTRA_CFLAGS += -DDEBUG |
diff --git a/fs/ntfs/aops.c b/fs/ntfs/aops.c index 1c0a4315876a..7e361da770b3 100644 --- a/fs/ntfs/aops.c +++ b/fs/ntfs/aops.c | |||
@@ -2,7 +2,7 @@ | |||
2 | * aops.c - NTFS kernel address space operations and page cache handling. | 2 | * aops.c - NTFS kernel address space operations and page cache handling. |
3 | * Part of the Linux-NTFS project. | 3 | * Part of the Linux-NTFS project. |
4 | * | 4 | * |
5 | * Copyright (c) 2001-2005 Anton Altaparmakov | 5 | * Copyright (c) 2001-2006 Anton Altaparmakov |
6 | * Copyright (c) 2002 Richard Russon | 6 | * Copyright (c) 2002 Richard Russon |
7 | * | 7 | * |
8 | * This program/include file is free software; you can redistribute it and/or | 8 | * This program/include file is free software; you can redistribute it and/or |
@@ -200,8 +200,8 @@ static int ntfs_read_block(struct page *page) | |||
200 | /* $MFT/$DATA must have its complete runlist in memory at all times. */ | 200 | /* $MFT/$DATA must have its complete runlist in memory at all times. */ |
201 | BUG_ON(!ni->runlist.rl && !ni->mft_no && !NInoAttr(ni)); | 201 | BUG_ON(!ni->runlist.rl && !ni->mft_no && !NInoAttr(ni)); |
202 | 202 | ||
203 | blocksize_bits = VFS_I(ni)->i_blkbits; | 203 | blocksize = vol->sb->s_blocksize; |
204 | blocksize = 1 << blocksize_bits; | 204 | blocksize_bits = vol->sb->s_blocksize_bits; |
205 | 205 | ||
206 | if (!page_has_buffers(page)) { | 206 | if (!page_has_buffers(page)) { |
207 | create_empty_buffers(page, blocksize, 0); | 207 | create_empty_buffers(page, blocksize, 0); |
@@ -569,10 +569,8 @@ static int ntfs_write_block(struct page *page, struct writeback_control *wbc) | |||
569 | 569 | ||
570 | BUG_ON(!NInoNonResident(ni)); | 570 | BUG_ON(!NInoNonResident(ni)); |
571 | BUG_ON(NInoMstProtected(ni)); | 571 | BUG_ON(NInoMstProtected(ni)); |
572 | 572 | blocksize = vol->sb->s_blocksize; | |
573 | blocksize_bits = vi->i_blkbits; | 573 | blocksize_bits = vol->sb->s_blocksize_bits; |
574 | blocksize = 1 << blocksize_bits; | ||
575 | |||
576 | if (!page_has_buffers(page)) { | 574 | if (!page_has_buffers(page)) { |
577 | BUG_ON(!PageUptodate(page)); | 575 | BUG_ON(!PageUptodate(page)); |
578 | create_empty_buffers(page, blocksize, | 576 | create_empty_buffers(page, blocksize, |
@@ -949,8 +947,8 @@ static int ntfs_write_mst_block(struct page *page, | |||
949 | */ | 947 | */ |
950 | BUG_ON(!(is_mft || S_ISDIR(vi->i_mode) || | 948 | BUG_ON(!(is_mft || S_ISDIR(vi->i_mode) || |
951 | (NInoAttr(ni) && ni->type == AT_INDEX_ALLOCATION))); | 949 | (NInoAttr(ni) && ni->type == AT_INDEX_ALLOCATION))); |
952 | bh_size_bits = vi->i_blkbits; | 950 | bh_size = vol->sb->s_blocksize; |
953 | bh_size = 1 << bh_size_bits; | 951 | bh_size_bits = vol->sb->s_blocksize_bits; |
954 | max_bhs = PAGE_CACHE_SIZE / bh_size; | 952 | max_bhs = PAGE_CACHE_SIZE / bh_size; |
955 | BUG_ON(!max_bhs); | 953 | BUG_ON(!max_bhs); |
956 | BUG_ON(max_bhs > MAX_BUF_PER_PAGE); | 954 | BUG_ON(max_bhs > MAX_BUF_PER_PAGE); |
@@ -1596,7 +1594,7 @@ void mark_ntfs_record_dirty(struct page *page, const unsigned int ofs) { | |||
1596 | 1594 | ||
1597 | BUG_ON(!PageUptodate(page)); | 1595 | BUG_ON(!PageUptodate(page)); |
1598 | end = ofs + ni->itype.index.block_size; | 1596 | end = ofs + ni->itype.index.block_size; |
1599 | bh_size = 1 << VFS_I(ni)->i_blkbits; | 1597 | bh_size = VFS_I(ni)->i_sb->s_blocksize; |
1600 | spin_lock(&mapping->private_lock); | 1598 | spin_lock(&mapping->private_lock); |
1601 | if (unlikely(!page_has_buffers(page))) { | 1599 | if (unlikely(!page_has_buffers(page))) { |
1602 | spin_unlock(&mapping->private_lock); | 1600 | spin_unlock(&mapping->private_lock); |
diff --git a/fs/ntfs/file.c b/fs/ntfs/file.c index fb413d3d8618..5027d3d1b3fe 100644 --- a/fs/ntfs/file.c +++ b/fs/ntfs/file.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * file.c - NTFS kernel file operations. Part of the Linux-NTFS project. | 2 | * file.c - NTFS kernel file operations. Part of the Linux-NTFS project. |
3 | * | 3 | * |
4 | * Copyright (c) 2001-2005 Anton Altaparmakov | 4 | * Copyright (c) 2001-2006 Anton Altaparmakov |
5 | * | 5 | * |
6 | * This program/include file is free software; you can redistribute it and/or | 6 | * This program/include file is free software; you can redistribute it and/or |
7 | * modify it under the terms of the GNU General Public License as published | 7 | * modify it under the terms of the GNU General Public License as published |
@@ -248,7 +248,7 @@ do_non_resident_extend: | |||
248 | * enough to make ntfs_writepage() work. | 248 | * enough to make ntfs_writepage() work. |
249 | */ | 249 | */ |
250 | write_lock_irqsave(&ni->size_lock, flags); | 250 | write_lock_irqsave(&ni->size_lock, flags); |
251 | ni->initialized_size = (index + 1) << PAGE_CACHE_SHIFT; | 251 | ni->initialized_size = (s64)(index + 1) << PAGE_CACHE_SHIFT; |
252 | if (ni->initialized_size > new_init_size) | 252 | if (ni->initialized_size > new_init_size) |
253 | ni->initialized_size = new_init_size; | 253 | ni->initialized_size = new_init_size; |
254 | write_unlock_irqrestore(&ni->size_lock, flags); | 254 | write_unlock_irqrestore(&ni->size_lock, flags); |
@@ -529,8 +529,8 @@ static int ntfs_prepare_pages_for_non_resident_write(struct page **pages, | |||
529 | "index 0x%lx, nr_pages 0x%x, pos 0x%llx, bytes 0x%zx.", | 529 | "index 0x%lx, nr_pages 0x%x, pos 0x%llx, bytes 0x%zx.", |
530 | vi->i_ino, ni->type, pages[0]->index, nr_pages, | 530 | vi->i_ino, ni->type, pages[0]->index, nr_pages, |
531 | (long long)pos, bytes); | 531 | (long long)pos, bytes); |
532 | blocksize_bits = vi->i_blkbits; | 532 | blocksize = vol->sb->s_blocksize; |
533 | blocksize = 1 << blocksize_bits; | 533 | blocksize_bits = vol->sb->s_blocksize_bits; |
534 | u = 0; | 534 | u = 0; |
535 | do { | 535 | do { |
536 | struct page *page = pages[u]; | 536 | struct page *page = pages[u]; |
@@ -1525,7 +1525,7 @@ static inline int ntfs_commit_pages_after_non_resident_write( | |||
1525 | 1525 | ||
1526 | vi = pages[0]->mapping->host; | 1526 | vi = pages[0]->mapping->host; |
1527 | ni = NTFS_I(vi); | 1527 | ni = NTFS_I(vi); |
1528 | blocksize = 1 << vi->i_blkbits; | 1528 | blocksize = vi->i_sb->s_blocksize; |
1529 | end = pos + bytes; | 1529 | end = pos + bytes; |
1530 | u = 0; | 1530 | u = 0; |
1531 | do { | 1531 | do { |
diff --git a/fs/ntfs/inode.c b/fs/ntfs/inode.c index ea1bd3feea1b..55263b7de9c0 100644 --- a/fs/ntfs/inode.c +++ b/fs/ntfs/inode.c | |||
@@ -677,13 +677,28 @@ static int ntfs_read_locked_inode(struct inode *vi) | |||
677 | ntfs_debug("Attribute list found in inode 0x%lx.", vi->i_ino); | 677 | ntfs_debug("Attribute list found in inode 0x%lx.", vi->i_ino); |
678 | NInoSetAttrList(ni); | 678 | NInoSetAttrList(ni); |
679 | a = ctx->attr; | 679 | a = ctx->attr; |
680 | if (a->flags & ATTR_IS_ENCRYPTED || | 680 | if (a->flags & ATTR_COMPRESSION_MASK) { |
681 | a->flags & ATTR_COMPRESSION_MASK || | ||
682 | a->flags & ATTR_IS_SPARSE) { | ||
683 | ntfs_error(vi->i_sb, "Attribute list attribute is " | 681 | ntfs_error(vi->i_sb, "Attribute list attribute is " |
684 | "compressed/encrypted/sparse."); | 682 | "compressed."); |
685 | goto unm_err_out; | 683 | goto unm_err_out; |
686 | } | 684 | } |
685 | if (a->flags & ATTR_IS_ENCRYPTED || | ||
686 | a->flags & ATTR_IS_SPARSE) { | ||
687 | if (a->non_resident) { | ||
688 | ntfs_error(vi->i_sb, "Non-resident attribute " | ||
689 | "list attribute is encrypted/" | ||
690 | "sparse."); | ||
691 | goto unm_err_out; | ||
692 | } | ||
693 | ntfs_warning(vi->i_sb, "Resident attribute list " | ||
694 | "attribute in inode 0x%lx is marked " | ||
695 | "encrypted/sparse which is not true. " | ||
696 | "However, Windows allows this and " | ||
697 | "chkdsk does not detect or correct it " | ||
698 | "so we will just ignore the invalid " | ||
699 | "flags and pretend they are not set.", | ||
700 | vi->i_ino); | ||
701 | } | ||
687 | /* Now allocate memory for the attribute list. */ | 702 | /* Now allocate memory for the attribute list. */ |
688 | ni->attr_list_size = (u32)ntfs_attr_size(a); | 703 | ni->attr_list_size = (u32)ntfs_attr_size(a); |
689 | ni->attr_list = ntfs_malloc_nofs(ni->attr_list_size); | 704 | ni->attr_list = ntfs_malloc_nofs(ni->attr_list_size); |
@@ -1809,19 +1824,33 @@ int ntfs_read_inode_mount(struct inode *vi) | |||
1809 | } else /* if (!err) */ { | 1824 | } else /* if (!err) */ { |
1810 | ATTR_LIST_ENTRY *al_entry, *next_al_entry; | 1825 | ATTR_LIST_ENTRY *al_entry, *next_al_entry; |
1811 | u8 *al_end; | 1826 | u8 *al_end; |
1827 | static const char *es = " Not allowed. $MFT is corrupt. " | ||
1828 | "You should run chkdsk."; | ||
1812 | 1829 | ||
1813 | ntfs_debug("Attribute list attribute found in $MFT."); | 1830 | ntfs_debug("Attribute list attribute found in $MFT."); |
1814 | NInoSetAttrList(ni); | 1831 | NInoSetAttrList(ni); |
1815 | a = ctx->attr; | 1832 | a = ctx->attr; |
1816 | if (a->flags & ATTR_IS_ENCRYPTED || | 1833 | if (a->flags & ATTR_COMPRESSION_MASK) { |
1817 | a->flags & ATTR_COMPRESSION_MASK || | ||
1818 | a->flags & ATTR_IS_SPARSE) { | ||
1819 | ntfs_error(sb, "Attribute list attribute is " | 1834 | ntfs_error(sb, "Attribute list attribute is " |
1820 | "compressed/encrypted/sparse. Not " | 1835 | "compressed.%s", es); |
1821 | "allowed. $MFT is corrupt. You should " | ||
1822 | "run chkdsk."); | ||
1823 | goto put_err_out; | 1836 | goto put_err_out; |
1824 | } | 1837 | } |
1838 | if (a->flags & ATTR_IS_ENCRYPTED || | ||
1839 | a->flags & ATTR_IS_SPARSE) { | ||
1840 | if (a->non_resident) { | ||
1841 | ntfs_error(sb, "Non-resident attribute list " | ||
1842 | "attribute is encrypted/" | ||
1843 | "sparse.%s", es); | ||
1844 | goto put_err_out; | ||
1845 | } | ||
1846 | ntfs_warning(sb, "Resident attribute list attribute " | ||
1847 | "in $MFT system file is marked " | ||
1848 | "encrypted/sparse which is not true. " | ||
1849 | "However, Windows allows this and " | ||
1850 | "chkdsk does not detect or correct it " | ||
1851 | "so we will just ignore the invalid " | ||
1852 | "flags and pretend they are not set."); | ||
1853 | } | ||
1825 | /* Now allocate memory for the attribute list. */ | 1854 | /* Now allocate memory for the attribute list. */ |
1826 | ni->attr_list_size = (u32)ntfs_attr_size(a); | 1855 | ni->attr_list_size = (u32)ntfs_attr_size(a); |
1827 | ni->attr_list = ntfs_malloc_nofs(ni->attr_list_size); | 1856 | ni->attr_list = ntfs_malloc_nofs(ni->attr_list_size); |
diff --git a/fs/ntfs/layout.h b/fs/ntfs/layout.h index f5678d5d7919..bb408d4dcbb0 100644 --- a/fs/ntfs/layout.h +++ b/fs/ntfs/layout.h | |||
@@ -838,15 +838,19 @@ enum { | |||
838 | F_A_DEVICE, F_A_DIRECTORY, F_A_SPARSE_FILE, F_A_REPARSE_POINT, | 838 | F_A_DEVICE, F_A_DIRECTORY, F_A_SPARSE_FILE, F_A_REPARSE_POINT, |
839 | F_A_COMPRESSED, and F_A_ENCRYPTED and preserves the rest. This mask | 839 | F_A_COMPRESSED, and F_A_ENCRYPTED and preserves the rest. This mask |
840 | is used to to obtain all flags that are valid for setting. */ | 840 | is used to to obtain all flags that are valid for setting. */ |
841 | |||
842 | /* | 841 | /* |
843 | * The following flags are only present in the FILE_NAME attribute (in | 842 | * The following flag is only present in the FILE_NAME attribute (in |
844 | * the field file_attributes). | 843 | * the field file_attributes). |
845 | */ | 844 | */ |
846 | FILE_ATTR_DUP_FILE_NAME_INDEX_PRESENT = const_cpu_to_le32(0x10000000), | 845 | FILE_ATTR_DUP_FILE_NAME_INDEX_PRESENT = const_cpu_to_le32(0x10000000), |
847 | /* Note, this is a copy of the corresponding bit from the mft record, | 846 | /* Note, this is a copy of the corresponding bit from the mft record, |
848 | telling us whether this is a directory or not, i.e. whether it has | 847 | telling us whether this is a directory or not, i.e. whether it has |
849 | an index root attribute or not. */ | 848 | an index root attribute or not. */ |
849 | /* | ||
850 | * The following flag is present both in the STANDARD_INFORMATION | ||
851 | * attribute and in the FILE_NAME attribute (in the field | ||
852 | * file_attributes). | ||
853 | */ | ||
850 | FILE_ATTR_DUP_VIEW_INDEX_PRESENT = const_cpu_to_le32(0x20000000), | 854 | FILE_ATTR_DUP_VIEW_INDEX_PRESENT = const_cpu_to_le32(0x20000000), |
851 | /* Note, this is a copy of the corresponding bit from the mft record, | 855 | /* Note, this is a copy of the corresponding bit from the mft record, |
852 | telling us whether this file has a view index present (eg. object id | 856 | telling us whether this file has a view index present (eg. object id |
@@ -1071,9 +1075,15 @@ typedef struct { | |||
1071 | modified. */ | 1075 | modified. */ |
1072 | /* 20*/ sle64 last_access_time; /* Time this mft record was last | 1076 | /* 20*/ sle64 last_access_time; /* Time this mft record was last |
1073 | accessed. */ | 1077 | accessed. */ |
1074 | /* 28*/ sle64 allocated_size; /* Byte size of allocated space for the | 1078 | /* 28*/ sle64 allocated_size; /* Byte size of on-disk allocated space |
1075 | data attribute. NOTE: Is a multiple | 1079 | for the data attribute. So for |
1076 | of the cluster size. */ | 1080 | normal $DATA, this is the |
1081 | allocated_size from the unnamed | ||
1082 | $DATA attribute and for compressed | ||
1083 | and/or sparse $DATA, this is the | ||
1084 | compressed_size from the unnamed | ||
1085 | $DATA attribute. NOTE: This is a | ||
1086 | multiple of the cluster size. */ | ||
1077 | /* 30*/ sle64 data_size; /* Byte size of actual data in data | 1087 | /* 30*/ sle64 data_size; /* Byte size of actual data in data |
1078 | attribute. */ | 1088 | attribute. */ |
1079 | /* 38*/ FILE_ATTR_FLAGS file_attributes; /* Flags describing the file. */ | 1089 | /* 38*/ FILE_ATTR_FLAGS file_attributes; /* Flags describing the file. */ |
@@ -1904,12 +1914,13 @@ enum { | |||
1904 | VOLUME_DELETE_USN_UNDERWAY = const_cpu_to_le16(0x0010), | 1914 | VOLUME_DELETE_USN_UNDERWAY = const_cpu_to_le16(0x0010), |
1905 | VOLUME_REPAIR_OBJECT_ID = const_cpu_to_le16(0x0020), | 1915 | VOLUME_REPAIR_OBJECT_ID = const_cpu_to_le16(0x0020), |
1906 | 1916 | ||
1917 | VOLUME_CHKDSK_UNDERWAY = const_cpu_to_le16(0x4000), | ||
1907 | VOLUME_MODIFIED_BY_CHKDSK = const_cpu_to_le16(0x8000), | 1918 | VOLUME_MODIFIED_BY_CHKDSK = const_cpu_to_le16(0x8000), |
1908 | 1919 | ||
1909 | VOLUME_FLAGS_MASK = const_cpu_to_le16(0x803f), | 1920 | VOLUME_FLAGS_MASK = const_cpu_to_le16(0xc03f), |
1910 | 1921 | ||
1911 | /* To make our life easier when checking if we must mount read-only. */ | 1922 | /* To make our life easier when checking if we must mount read-only. */ |
1912 | VOLUME_MUST_MOUNT_RO_MASK = const_cpu_to_le16(0x8027), | 1923 | VOLUME_MUST_MOUNT_RO_MASK = const_cpu_to_le16(0xc027), |
1913 | } __attribute__ ((__packed__)); | 1924 | } __attribute__ ((__packed__)); |
1914 | 1925 | ||
1915 | typedef le16 VOLUME_FLAGS; | 1926 | typedef le16 VOLUME_FLAGS; |
diff --git a/fs/ntfs/mft.c b/fs/ntfs/mft.c index 0c65cbb8c5cf..6499aafc2258 100644 --- a/fs/ntfs/mft.c +++ b/fs/ntfs/mft.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /** | 1 | /** |
2 | * mft.c - NTFS kernel mft record operations. Part of the Linux-NTFS project. | 2 | * mft.c - NTFS kernel mft record operations. Part of the Linux-NTFS project. |
3 | * | 3 | * |
4 | * Copyright (c) 2001-2005 Anton Altaparmakov | 4 | * Copyright (c) 2001-2006 Anton Altaparmakov |
5 | * Copyright (c) 2002 Richard Russon | 5 | * Copyright (c) 2002 Richard Russon |
6 | * | 6 | * |
7 | * This program/include file is free software; you can redistribute it and/or | 7 | * This program/include file is free software; you can redistribute it and/or |
@@ -473,7 +473,7 @@ int ntfs_sync_mft_mirror(ntfs_volume *vol, const unsigned long mft_no, | |||
473 | runlist_element *rl; | 473 | runlist_element *rl; |
474 | unsigned int block_start, block_end, m_start, m_end, page_ofs; | 474 | unsigned int block_start, block_end, m_start, m_end, page_ofs; |
475 | int i_bhs, nr_bhs, err = 0; | 475 | int i_bhs, nr_bhs, err = 0; |
476 | unsigned char blocksize_bits = vol->mftmirr_ino->i_blkbits; | 476 | unsigned char blocksize_bits = vol->sb->s_blocksize_bits; |
477 | 477 | ||
478 | ntfs_debug("Entering for inode 0x%lx.", mft_no); | 478 | ntfs_debug("Entering for inode 0x%lx.", mft_no); |
479 | BUG_ON(!max_bhs); | 479 | BUG_ON(!max_bhs); |
@@ -672,8 +672,8 @@ int write_mft_record_nolock(ntfs_inode *ni, MFT_RECORD *m, int sync) | |||
672 | { | 672 | { |
673 | ntfs_volume *vol = ni->vol; | 673 | ntfs_volume *vol = ni->vol; |
674 | struct page *page = ni->page; | 674 | struct page *page = ni->page; |
675 | unsigned char blocksize_bits = vol->mft_ino->i_blkbits; | 675 | unsigned int blocksize = vol->sb->s_blocksize; |
676 | unsigned int blocksize = 1 << blocksize_bits; | 676 | unsigned char blocksize_bits = vol->sb->s_blocksize_bits; |
677 | int max_bhs = vol->mft_record_size / blocksize; | 677 | int max_bhs = vol->mft_record_size / blocksize; |
678 | struct buffer_head *bhs[max_bhs]; | 678 | struct buffer_head *bhs[max_bhs]; |
679 | struct buffer_head *bh, *head; | 679 | struct buffer_head *bh, *head; |
diff --git a/fs/ntfs/ntfs.h b/fs/ntfs/ntfs.h index 446b5014115c..653d2a5c4899 100644 --- a/fs/ntfs/ntfs.h +++ b/fs/ntfs/ntfs.h | |||
@@ -50,11 +50,11 @@ typedef enum { | |||
50 | /* Global variables. */ | 50 | /* Global variables. */ |
51 | 51 | ||
52 | /* Slab caches (from super.c). */ | 52 | /* Slab caches (from super.c). */ |
53 | extern kmem_cache_t *ntfs_name_cache; | 53 | extern struct kmem_cache *ntfs_name_cache; |
54 | extern kmem_cache_t *ntfs_inode_cache; | 54 | extern struct kmem_cache *ntfs_inode_cache; |
55 | extern kmem_cache_t *ntfs_big_inode_cache; | 55 | extern struct kmem_cache *ntfs_big_inode_cache; |
56 | extern kmem_cache_t *ntfs_attr_ctx_cache; | 56 | extern struct kmem_cache *ntfs_attr_ctx_cache; |
57 | extern kmem_cache_t *ntfs_index_ctx_cache; | 57 | extern struct kmem_cache *ntfs_index_ctx_cache; |
58 | 58 | ||
59 | /* The various operations structs defined throughout the driver files. */ | 59 | /* The various operations structs defined throughout the driver files. */ |
60 | extern struct address_space_operations ntfs_aops; | 60 | extern struct address_space_operations ntfs_aops; |
diff --git a/fs/ntfs/super.c b/fs/ntfs/super.c index c3a3f1a8310b..368a8ec10668 100644 --- a/fs/ntfs/super.c +++ b/fs/ntfs/super.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * super.c - NTFS kernel super block handling. Part of the Linux-NTFS project. | 2 | * super.c - NTFS kernel super block handling. Part of the Linux-NTFS project. |
3 | * | 3 | * |
4 | * Copyright (c) 2001-2005 Anton Altaparmakov | 4 | * Copyright (c) 2001-2006 Anton Altaparmakov |
5 | * Copyright (c) 2001,2002 Richard Russon | 5 | * Copyright (c) 2001,2002 Richard Russon |
6 | * | 6 | * |
7 | * This program/include file is free software; you can redistribute it and/or | 7 | * This program/include file is free software; you can redistribute it and/or |
@@ -22,6 +22,7 @@ | |||
22 | 22 | ||
23 | #include <linux/stddef.h> | 23 | #include <linux/stddef.h> |
24 | #include <linux/init.h> | 24 | #include <linux/init.h> |
25 | #include <linux/slab.h> | ||
25 | #include <linux/string.h> | 26 | #include <linux/string.h> |
26 | #include <linux/spinlock.h> | 27 | #include <linux/spinlock.h> |
27 | #include <linux/blkdev.h> /* For bdev_hardsect_size(). */ | 28 | #include <linux/blkdev.h> /* For bdev_hardsect_size(). */ |
@@ -471,9 +472,16 @@ static int ntfs_remount(struct super_block *sb, int *flags, char *opt) | |||
471 | ntfs_error(sb, "Volume is dirty and read-only%s", es); | 472 | ntfs_error(sb, "Volume is dirty and read-only%s", es); |
472 | return -EROFS; | 473 | return -EROFS; |
473 | } | 474 | } |
475 | if (vol->vol_flags & VOLUME_MODIFIED_BY_CHKDSK) { | ||
476 | ntfs_error(sb, "Volume has been modified by chkdsk " | ||
477 | "and is read-only%s", es); | ||
478 | return -EROFS; | ||
479 | } | ||
474 | if (vol->vol_flags & VOLUME_MUST_MOUNT_RO_MASK) { | 480 | if (vol->vol_flags & VOLUME_MUST_MOUNT_RO_MASK) { |
475 | ntfs_error(sb, "Volume has unsupported flags set and " | 481 | ntfs_error(sb, "Volume has unsupported flags set " |
476 | "is read-only%s", es); | 482 | "(0x%x) and is read-only%s", |
483 | (unsigned)le16_to_cpu(vol->vol_flags), | ||
484 | es); | ||
477 | return -EROFS; | 485 | return -EROFS; |
478 | } | 486 | } |
479 | if (ntfs_set_volume_flags(vol, VOLUME_IS_DIRTY)) { | 487 | if (ntfs_set_volume_flags(vol, VOLUME_IS_DIRTY)) { |
@@ -641,7 +649,7 @@ static struct buffer_head *read_ntfs_boot_sector(struct super_block *sb, | |||
641 | { | 649 | { |
642 | const char *read_err_str = "Unable to read %s boot sector."; | 650 | const char *read_err_str = "Unable to read %s boot sector."; |
643 | struct buffer_head *bh_primary, *bh_backup; | 651 | struct buffer_head *bh_primary, *bh_backup; |
644 | long nr_blocks = NTFS_SB(sb)->nr_blocks; | 652 | sector_t nr_blocks = NTFS_SB(sb)->nr_blocks; |
645 | 653 | ||
646 | /* Try to read primary boot sector. */ | 654 | /* Try to read primary boot sector. */ |
647 | if ((bh_primary = sb_bread(sb, 0))) { | 655 | if ((bh_primary = sb_bread(sb, 0))) { |
@@ -688,13 +696,18 @@ hotfix_primary_boot_sector: | |||
688 | /* | 696 | /* |
689 | * If we managed to read sector zero and the volume is not | 697 | * If we managed to read sector zero and the volume is not |
690 | * read-only, copy the found, valid backup boot sector to the | 698 | * read-only, copy the found, valid backup boot sector to the |
691 | * primary boot sector. | 699 | * primary boot sector. Note we only copy the actual boot |
700 | * sector structure, not the actual whole device sector as that | ||
701 | * may be bigger and would potentially damage the $Boot system | ||
702 | * file (FIXME: Would be nice to know if the backup boot sector | ||
703 | * on a large sector device contains the whole boot loader or | ||
704 | * just the first 512 bytes). | ||
692 | */ | 705 | */ |
693 | if (!(sb->s_flags & MS_RDONLY)) { | 706 | if (!(sb->s_flags & MS_RDONLY)) { |
694 | ntfs_warning(sb, "Hot-fix: Recovering invalid primary " | 707 | ntfs_warning(sb, "Hot-fix: Recovering invalid primary " |
695 | "boot sector from backup copy."); | 708 | "boot sector from backup copy."); |
696 | memcpy(bh_primary->b_data, bh_backup->b_data, | 709 | memcpy(bh_primary->b_data, bh_backup->b_data, |
697 | sb->s_blocksize); | 710 | NTFS_BLOCK_SIZE); |
698 | mark_buffer_dirty(bh_primary); | 711 | mark_buffer_dirty(bh_primary); |
699 | sync_dirty_buffer(bh_primary); | 712 | sync_dirty_buffer(bh_primary); |
700 | if (buffer_uptodate(bh_primary)) { | 713 | if (buffer_uptodate(bh_primary)) { |
@@ -733,9 +746,13 @@ static BOOL parse_ntfs_boot_sector(ntfs_volume *vol, const NTFS_BOOT_SECTOR *b) | |||
733 | vol->sector_size); | 746 | vol->sector_size); |
734 | ntfs_debug("vol->sector_size_bits = %i (0x%x)", vol->sector_size_bits, | 747 | ntfs_debug("vol->sector_size_bits = %i (0x%x)", vol->sector_size_bits, |
735 | vol->sector_size_bits); | 748 | vol->sector_size_bits); |
736 | if (vol->sector_size != vol->sb->s_blocksize) | 749 | if (vol->sector_size < vol->sb->s_blocksize) { |
737 | ntfs_warning(vol->sb, "The boot sector indicates a sector size " | 750 | ntfs_error(vol->sb, "Sector size (%i) is smaller than the " |
738 | "different from the device sector size."); | 751 | "device block size (%lu). This is not " |
752 | "supported. Sorry.", vol->sector_size, | ||
753 | vol->sb->s_blocksize); | ||
754 | return FALSE; | ||
755 | } | ||
739 | ntfs_debug("sectors_per_cluster = 0x%x", b->bpb.sectors_per_cluster); | 756 | ntfs_debug("sectors_per_cluster = 0x%x", b->bpb.sectors_per_cluster); |
740 | sectors_per_cluster_bits = ffs(b->bpb.sectors_per_cluster) - 1; | 757 | sectors_per_cluster_bits = ffs(b->bpb.sectors_per_cluster) - 1; |
741 | ntfs_debug("sectors_per_cluster_bits = 0x%x", | 758 | ntfs_debug("sectors_per_cluster_bits = 0x%x", |
@@ -748,16 +765,11 @@ static BOOL parse_ntfs_boot_sector(ntfs_volume *vol, const NTFS_BOOT_SECTOR *b) | |||
748 | ntfs_debug("vol->cluster_size = %i (0x%x)", vol->cluster_size, | 765 | ntfs_debug("vol->cluster_size = %i (0x%x)", vol->cluster_size, |
749 | vol->cluster_size); | 766 | vol->cluster_size); |
750 | ntfs_debug("vol->cluster_size_mask = 0x%x", vol->cluster_size_mask); | 767 | ntfs_debug("vol->cluster_size_mask = 0x%x", vol->cluster_size_mask); |
751 | ntfs_debug("vol->cluster_size_bits = %i (0x%x)", | 768 | ntfs_debug("vol->cluster_size_bits = %i", vol->cluster_size_bits); |
752 | vol->cluster_size_bits, vol->cluster_size_bits); | 769 | if (vol->cluster_size < vol->sector_size) { |
753 | if (vol->sector_size > vol->cluster_size) { | 770 | ntfs_error(vol->sb, "Cluster size (%i) is smaller than the " |
754 | ntfs_error(vol->sb, "Sector sizes above the cluster size are " | 771 | "sector size (%i). This is not supported. " |
755 | "not supported. Sorry."); | 772 | "Sorry.", vol->cluster_size, vol->sector_size); |
756 | return FALSE; | ||
757 | } | ||
758 | if (vol->sb->s_blocksize > vol->cluster_size) { | ||
759 | ntfs_error(vol->sb, "Cluster sizes smaller than the device " | ||
760 | "sector size are not supported. Sorry."); | ||
761 | return FALSE; | 773 | return FALSE; |
762 | } | 774 | } |
763 | clusters_per_mft_record = b->clusters_per_mft_record; | 775 | clusters_per_mft_record = b->clusters_per_mft_record; |
@@ -786,11 +798,18 @@ static BOOL parse_ntfs_boot_sector(ntfs_volume *vol, const NTFS_BOOT_SECTOR *b) | |||
786 | * we store $MFT/$DATA, the table of mft records in the page cache. | 798 | * we store $MFT/$DATA, the table of mft records in the page cache. |
787 | */ | 799 | */ |
788 | if (vol->mft_record_size > PAGE_CACHE_SIZE) { | 800 | if (vol->mft_record_size > PAGE_CACHE_SIZE) { |
789 | ntfs_error(vol->sb, "Mft record size %i (0x%x) exceeds the " | 801 | ntfs_error(vol->sb, "Mft record size (%i) exceeds the " |
790 | "page cache size on your system %lu (0x%lx). " | 802 | "PAGE_CACHE_SIZE on your system (%lu). " |
791 | "This is not supported. Sorry.", | 803 | "This is not supported. Sorry.", |
792 | vol->mft_record_size, vol->mft_record_size, | 804 | vol->mft_record_size, PAGE_CACHE_SIZE); |
793 | PAGE_CACHE_SIZE, PAGE_CACHE_SIZE); | 805 | return FALSE; |
806 | } | ||
807 | /* We cannot support mft record sizes below the sector size. */ | ||
808 | if (vol->mft_record_size < vol->sector_size) { | ||
809 | ntfs_error(vol->sb, "Mft record size (%i) is smaller than the " | ||
810 | "sector size (%i). This is not supported. " | ||
811 | "Sorry.", vol->mft_record_size, | ||
812 | vol->sector_size); | ||
794 | return FALSE; | 813 | return FALSE; |
795 | } | 814 | } |
796 | clusters_per_index_record = b->clusters_per_index_record; | 815 | clusters_per_index_record = b->clusters_per_index_record; |
@@ -816,6 +835,14 @@ static BOOL parse_ntfs_boot_sector(ntfs_volume *vol, const NTFS_BOOT_SECTOR *b) | |||
816 | ntfs_debug("vol->index_record_size_bits = %i (0x%x)", | 835 | ntfs_debug("vol->index_record_size_bits = %i (0x%x)", |
817 | vol->index_record_size_bits, | 836 | vol->index_record_size_bits, |
818 | vol->index_record_size_bits); | 837 | vol->index_record_size_bits); |
838 | /* We cannot support index record sizes below the sector size. */ | ||
839 | if (vol->index_record_size < vol->sector_size) { | ||
840 | ntfs_error(vol->sb, "Index record size (%i) is smaller than " | ||
841 | "the sector size (%i). This is not " | ||
842 | "supported. Sorry.", vol->index_record_size, | ||
843 | vol->sector_size); | ||
844 | return FALSE; | ||
845 | } | ||
819 | /* | 846 | /* |
820 | * Get the size of the volume in clusters and check for 64-bit-ness. | 847 | * Get the size of the volume in clusters and check for 64-bit-ness. |
821 | * Windows currently only uses 32 bits to save the clusters so we do | 848 | * Windows currently only uses 32 bits to save the clusters so we do |
@@ -845,15 +872,18 @@ static BOOL parse_ntfs_boot_sector(ntfs_volume *vol, const NTFS_BOOT_SECTOR *b) | |||
845 | } | 872 | } |
846 | ll = sle64_to_cpu(b->mft_lcn); | 873 | ll = sle64_to_cpu(b->mft_lcn); |
847 | if (ll >= vol->nr_clusters) { | 874 | if (ll >= vol->nr_clusters) { |
848 | ntfs_error(vol->sb, "MFT LCN is beyond end of volume. Weird."); | 875 | ntfs_error(vol->sb, "MFT LCN (%lli, 0x%llx) is beyond end of " |
876 | "volume. Weird.", (unsigned long long)ll, | ||
877 | (unsigned long long)ll); | ||
849 | return FALSE; | 878 | return FALSE; |
850 | } | 879 | } |
851 | vol->mft_lcn = ll; | 880 | vol->mft_lcn = ll; |
852 | ntfs_debug("vol->mft_lcn = 0x%llx", (long long)vol->mft_lcn); | 881 | ntfs_debug("vol->mft_lcn = 0x%llx", (long long)vol->mft_lcn); |
853 | ll = sle64_to_cpu(b->mftmirr_lcn); | 882 | ll = sle64_to_cpu(b->mftmirr_lcn); |
854 | if (ll >= vol->nr_clusters) { | 883 | if (ll >= vol->nr_clusters) { |
855 | ntfs_error(vol->sb, "MFTMirr LCN is beyond end of volume. " | 884 | ntfs_error(vol->sb, "MFTMirr LCN (%lli, 0x%llx) is beyond end " |
856 | "Weird."); | 885 | "of volume. Weird.", (unsigned long long)ll, |
886 | (unsigned long long)ll); | ||
857 | return FALSE; | 887 | return FALSE; |
858 | } | 888 | } |
859 | vol->mftmirr_lcn = ll; | 889 | vol->mftmirr_lcn = ll; |
@@ -1822,11 +1852,24 @@ get_ctx_vol_failed: | |||
1822 | /* Make sure that no unsupported volume flags are set. */ | 1852 | /* Make sure that no unsupported volume flags are set. */ |
1823 | if (vol->vol_flags & VOLUME_MUST_MOUNT_RO_MASK) { | 1853 | if (vol->vol_flags & VOLUME_MUST_MOUNT_RO_MASK) { |
1824 | static const char *es1a = "Volume is dirty"; | 1854 | static const char *es1a = "Volume is dirty"; |
1825 | static const char *es1b = "Volume has unsupported flags set"; | 1855 | static const char *es1b = "Volume has been modified by chkdsk"; |
1826 | static const char *es2 = ". Run chkdsk and mount in Windows."; | 1856 | static const char *es1c = "Volume has unsupported flags set"; |
1827 | const char *es1; | 1857 | static const char *es2a = ". Run chkdsk and mount in Windows."; |
1828 | 1858 | static const char *es2b = ". Mount in Windows."; | |
1829 | es1 = vol->vol_flags & VOLUME_IS_DIRTY ? es1a : es1b; | 1859 | const char *es1, *es2; |
1860 | |||
1861 | es2 = es2a; | ||
1862 | if (vol->vol_flags & VOLUME_IS_DIRTY) | ||
1863 | es1 = es1a; | ||
1864 | else if (vol->vol_flags & VOLUME_MODIFIED_BY_CHKDSK) { | ||
1865 | es1 = es1b; | ||
1866 | es2 = es2b; | ||
1867 | } else { | ||
1868 | es1 = es1c; | ||
1869 | ntfs_warning(sb, "Unsupported volume flags 0x%x " | ||
1870 | "encountered.", | ||
1871 | (unsigned)le16_to_cpu(vol->vol_flags)); | ||
1872 | } | ||
1830 | /* If a read-write mount, convert it to a read-only mount. */ | 1873 | /* If a read-write mount, convert it to a read-only mount. */ |
1831 | if (!(sb->s_flags & MS_RDONLY)) { | 1874 | if (!(sb->s_flags & MS_RDONLY)) { |
1832 | if (!(vol->on_errors & (ON_ERRORS_REMOUNT_RO | | 1875 | if (!(vol->on_errors & (ON_ERRORS_REMOUNT_RO | |
@@ -2685,7 +2728,7 @@ static int ntfs_fill_super(struct super_block *sb, void *opt, const int silent) | |||
2685 | ntfs_volume *vol; | 2728 | ntfs_volume *vol; |
2686 | struct buffer_head *bh; | 2729 | struct buffer_head *bh; |
2687 | struct inode *tmp_ino; | 2730 | struct inode *tmp_ino; |
2688 | int result; | 2731 | int blocksize, result; |
2689 | 2732 | ||
2690 | ntfs_debug("Entering."); | 2733 | ntfs_debug("Entering."); |
2691 | #ifndef NTFS_RW | 2734 | #ifndef NTFS_RW |
@@ -2724,60 +2767,85 @@ static int ntfs_fill_super(struct super_block *sb, void *opt, const int silent) | |||
2724 | if (!parse_options(vol, (char*)opt)) | 2767 | if (!parse_options(vol, (char*)opt)) |
2725 | goto err_out_now; | 2768 | goto err_out_now; |
2726 | 2769 | ||
2770 | /* We support sector sizes up to the PAGE_CACHE_SIZE. */ | ||
2771 | if (bdev_hardsect_size(sb->s_bdev) > PAGE_CACHE_SIZE) { | ||
2772 | if (!silent) | ||
2773 | ntfs_error(sb, "Device has unsupported sector size " | ||
2774 | "(%i). The maximum supported sector " | ||
2775 | "size on this architecture is %lu " | ||
2776 | "bytes.", | ||
2777 | bdev_hardsect_size(sb->s_bdev), | ||
2778 | PAGE_CACHE_SIZE); | ||
2779 | goto err_out_now; | ||
2780 | } | ||
2727 | /* | 2781 | /* |
2728 | * TODO: Fail safety check. In the future we should really be able to | 2782 | * Setup the device access block size to NTFS_BLOCK_SIZE or the hard |
2729 | * cope with this being the case, but for now just bail out. | 2783 | * sector size, whichever is bigger. |
2730 | */ | 2784 | */ |
2731 | if (bdev_hardsect_size(sb->s_bdev) > NTFS_BLOCK_SIZE) { | 2785 | blocksize = sb_min_blocksize(sb, NTFS_BLOCK_SIZE); |
2786 | if (blocksize < NTFS_BLOCK_SIZE) { | ||
2732 | if (!silent) | 2787 | if (!silent) |
2733 | ntfs_error(sb, "Device has unsupported hardsect_size."); | 2788 | ntfs_error(sb, "Unable to set device block size."); |
2734 | goto err_out_now; | 2789 | goto err_out_now; |
2735 | } | 2790 | } |
2736 | 2791 | BUG_ON(blocksize != sb->s_blocksize); | |
2737 | /* Setup the device access block size to NTFS_BLOCK_SIZE. */ | 2792 | ntfs_debug("Set device block size to %i bytes (block size bits %i).", |
2738 | if (sb_set_blocksize(sb, NTFS_BLOCK_SIZE) != NTFS_BLOCK_SIZE) { | 2793 | blocksize, sb->s_blocksize_bits); |
2794 | /* Determine the size of the device in units of block_size bytes. */ | ||
2795 | if (!i_size_read(sb->s_bdev->bd_inode)) { | ||
2739 | if (!silent) | 2796 | if (!silent) |
2740 | ntfs_error(sb, "Unable to set block size."); | 2797 | ntfs_error(sb, "Unable to determine device size."); |
2741 | goto err_out_now; | 2798 | goto err_out_now; |
2742 | } | 2799 | } |
2743 | |||
2744 | /* Get the size of the device in units of NTFS_BLOCK_SIZE bytes. */ | ||
2745 | vol->nr_blocks = i_size_read(sb->s_bdev->bd_inode) >> | 2800 | vol->nr_blocks = i_size_read(sb->s_bdev->bd_inode) >> |
2746 | NTFS_BLOCK_SIZE_BITS; | 2801 | sb->s_blocksize_bits; |
2747 | |||
2748 | /* Read the boot sector and return unlocked buffer head to it. */ | 2802 | /* Read the boot sector and return unlocked buffer head to it. */ |
2749 | if (!(bh = read_ntfs_boot_sector(sb, silent))) { | 2803 | if (!(bh = read_ntfs_boot_sector(sb, silent))) { |
2750 | if (!silent) | 2804 | if (!silent) |
2751 | ntfs_error(sb, "Not an NTFS volume."); | 2805 | ntfs_error(sb, "Not an NTFS volume."); |
2752 | goto err_out_now; | 2806 | goto err_out_now; |
2753 | } | 2807 | } |
2754 | |||
2755 | /* | 2808 | /* |
2756 | * Extract the data from the boot sector and setup the ntfs super block | 2809 | * Extract the data from the boot sector and setup the ntfs volume |
2757 | * using it. | 2810 | * using it. |
2758 | */ | 2811 | */ |
2759 | result = parse_ntfs_boot_sector(vol, (NTFS_BOOT_SECTOR*)bh->b_data); | 2812 | result = parse_ntfs_boot_sector(vol, (NTFS_BOOT_SECTOR*)bh->b_data); |
2760 | |||
2761 | /* Initialize the cluster and mft allocators. */ | ||
2762 | ntfs_setup_allocators(vol); | ||
2763 | |||
2764 | brelse(bh); | 2813 | brelse(bh); |
2765 | |||
2766 | if (!result) { | 2814 | if (!result) { |
2767 | if (!silent) | 2815 | if (!silent) |
2768 | ntfs_error(sb, "Unsupported NTFS filesystem."); | 2816 | ntfs_error(sb, "Unsupported NTFS filesystem."); |
2769 | goto err_out_now; | 2817 | goto err_out_now; |
2770 | } | 2818 | } |
2771 | |||
2772 | /* | 2819 | /* |
2773 | * TODO: When we start coping with sector sizes different from | 2820 | * If the boot sector indicates a sector size bigger than the current |
2774 | * NTFS_BLOCK_SIZE, we now probably need to set the blocksize of the | 2821 | * device block size, switch the device block size to the sector size. |
2775 | * device (probably to NTFS_BLOCK_SIZE). | 2822 | * TODO: It may be possible to support this case even when the set |
2823 | * below fails, we would just be breaking up the i/o for each sector | ||
2824 | * into multiple blocks for i/o purposes but otherwise it should just | ||
2825 | * work. However it is safer to leave disabled until someone hits this | ||
2826 | * error message and then we can get them to try it without the setting | ||
2827 | * so we know for sure that it works. | ||
2776 | */ | 2828 | */ |
2777 | 2829 | if (vol->sector_size > blocksize) { | |
2830 | blocksize = sb_set_blocksize(sb, vol->sector_size); | ||
2831 | if (blocksize != vol->sector_size) { | ||
2832 | if (!silent) | ||
2833 | ntfs_error(sb, "Unable to set device block " | ||
2834 | "size to sector size (%i).", | ||
2835 | vol->sector_size); | ||
2836 | goto err_out_now; | ||
2837 | } | ||
2838 | BUG_ON(blocksize != sb->s_blocksize); | ||
2839 | vol->nr_blocks = i_size_read(sb->s_bdev->bd_inode) >> | ||
2840 | sb->s_blocksize_bits; | ||
2841 | ntfs_debug("Changed device block size to %i bytes (block size " | ||
2842 | "bits %i) to match volume sector size.", | ||
2843 | blocksize, sb->s_blocksize_bits); | ||
2844 | } | ||
2845 | /* Initialize the cluster and mft allocators. */ | ||
2846 | ntfs_setup_allocators(vol); | ||
2778 | /* Setup remaining fields in the super block. */ | 2847 | /* Setup remaining fields in the super block. */ |
2779 | sb->s_magic = NTFS_SB_MAGIC; | 2848 | sb->s_magic = NTFS_SB_MAGIC; |
2780 | |||
2781 | /* | 2849 | /* |
2782 | * Ntfs allows 63 bits for the file size, i.e. correct would be: | 2850 | * Ntfs allows 63 bits for the file size, i.e. correct would be: |
2783 | * sb->s_maxbytes = ~0ULL >> 1; | 2851 | * sb->s_maxbytes = ~0ULL >> 1; |
@@ -2787,9 +2855,8 @@ static int ntfs_fill_super(struct super_block *sb, void *opt, const int silent) | |||
2787 | * without overflowing the index or to 2^63 - 1, whichever is smaller. | 2855 | * without overflowing the index or to 2^63 - 1, whichever is smaller. |
2788 | */ | 2856 | */ |
2789 | sb->s_maxbytes = MAX_LFS_FILESIZE; | 2857 | sb->s_maxbytes = MAX_LFS_FILESIZE; |
2790 | 2858 | /* Ntfs measures time in 100ns intervals. */ | |
2791 | sb->s_time_gran = 100; | 2859 | sb->s_time_gran = 100; |
2792 | |||
2793 | /* | 2860 | /* |
2794 | * Now load the metadata required for the page cache and our address | 2861 | * Now load the metadata required for the page cache and our address |
2795 | * space operations to function. We do this by setting up a specialised | 2862 | * space operations to function. We do this by setting up a specialised |
@@ -2987,14 +3054,14 @@ err_out_now: | |||
2987 | * strings of the maximum length allowed by NTFS, which is NTFS_MAX_NAME_LEN | 3054 | * strings of the maximum length allowed by NTFS, which is NTFS_MAX_NAME_LEN |
2988 | * (255) Unicode characters + a terminating NULL Unicode character. | 3055 | * (255) Unicode characters + a terminating NULL Unicode character. |
2989 | */ | 3056 | */ |
2990 | kmem_cache_t *ntfs_name_cache; | 3057 | struct kmem_cache *ntfs_name_cache; |
2991 | 3058 | ||
2992 | /* Slab caches for efficient allocation/deallocation of inodes. */ | 3059 | /* Slab caches for efficient allocation/deallocation of inodes. */ |
2993 | kmem_cache_t *ntfs_inode_cache; | 3060 | struct kmem_cache *ntfs_inode_cache; |
2994 | kmem_cache_t *ntfs_big_inode_cache; | 3061 | struct kmem_cache *ntfs_big_inode_cache; |
2995 | 3062 | ||
2996 | /* Init once constructor for the inode slab cache. */ | 3063 | /* Init once constructor for the inode slab cache. */ |
2997 | static void ntfs_big_inode_init_once(void *foo, kmem_cache_t *cachep, | 3064 | static void ntfs_big_inode_init_once(void *foo, struct kmem_cache *cachep, |
2998 | unsigned long flags) | 3065 | unsigned long flags) |
2999 | { | 3066 | { |
3000 | ntfs_inode *ni = (ntfs_inode *)foo; | 3067 | ntfs_inode *ni = (ntfs_inode *)foo; |
@@ -3008,8 +3075,8 @@ static void ntfs_big_inode_init_once(void *foo, kmem_cache_t *cachep, | |||
3008 | * Slab caches to optimize allocations and deallocations of attribute search | 3075 | * Slab caches to optimize allocations and deallocations of attribute search |
3009 | * contexts and index contexts, respectively. | 3076 | * contexts and index contexts, respectively. |
3010 | */ | 3077 | */ |
3011 | kmem_cache_t *ntfs_attr_ctx_cache; | 3078 | struct kmem_cache *ntfs_attr_ctx_cache; |
3012 | kmem_cache_t *ntfs_index_ctx_cache; | 3079 | struct kmem_cache *ntfs_index_ctx_cache; |
3013 | 3080 | ||
3014 | /* Driver wide semaphore. */ | 3081 | /* Driver wide semaphore. */ |
3015 | DECLARE_MUTEX(ntfs_lock); | 3082 | DECLARE_MUTEX(ntfs_lock); |
diff --git a/fs/ntfs/upcase.c b/fs/ntfs/upcase.c index 879cdf1d5bd3..9101807dc81a 100644 --- a/fs/ntfs/upcase.c +++ b/fs/ntfs/upcase.c | |||
@@ -3,10 +3,7 @@ | |||
3 | * Part of the Linux-NTFS project. | 3 | * Part of the Linux-NTFS project. |
4 | * | 4 | * |
5 | * Copyright (c) 2001 Richard Russon <ntfs@flatcap.org> | 5 | * Copyright (c) 2001 Richard Russon <ntfs@flatcap.org> |
6 | * Copyright (c) 2001-2004 Anton Altaparmakov | 6 | * Copyright (c) 2001-2006 Anton Altaparmakov |
7 | * | ||
8 | * Modified for mkntfs inclusion 9 June 2001 by Anton Altaparmakov. | ||
9 | * Modified for kernel inclusion 10 September 2001 by Anton Altparmakov. | ||
10 | * | 7 | * |
11 | * This program is free software; you can redistribute it and/or modify it | 8 | * This program is free software; you can redistribute it and/or modify it |
12 | * under the terms of the GNU General Public License as published by the Free | 9 | * under the terms of the GNU General Public License as published by the Free |
@@ -75,12 +72,13 @@ ntfschar *generate_default_upcase(void) | |||
75 | if (!uc) | 72 | if (!uc) |
76 | return uc; | 73 | return uc; |
77 | memset(uc, 0, default_upcase_len * sizeof(ntfschar)); | 74 | memset(uc, 0, default_upcase_len * sizeof(ntfschar)); |
75 | /* Generate the little endian Unicode upcase table used by ntfs. */ | ||
78 | for (i = 0; i < default_upcase_len; i++) | 76 | for (i = 0; i < default_upcase_len; i++) |
79 | uc[i] = cpu_to_le16(i); | 77 | uc[i] = cpu_to_le16(i); |
80 | for (r = 0; uc_run_table[r][0]; r++) | 78 | for (r = 0; uc_run_table[r][0]; r++) |
81 | for (i = uc_run_table[r][0]; i < uc_run_table[r][1]; i++) | 79 | for (i = uc_run_table[r][0]; i < uc_run_table[r][1]; i++) |
82 | uc[i] = cpu_to_le16((le16_to_cpu(uc[i]) + | 80 | uc[i] = cpu_to_le16(le16_to_cpu(uc[i]) + |
83 | uc_run_table[r][2])); | 81 | uc_run_table[r][2]); |
84 | for (r = 0; uc_dup_table[r][0]; r++) | 82 | for (r = 0; uc_dup_table[r][0]; r++) |
85 | for (i = uc_dup_table[r][0]; i < uc_dup_table[r][1]; i += 2) | 83 | for (i = uc_dup_table[r][0]; i < uc_dup_table[r][1]; i += 2) |
86 | uc[i + 1] = cpu_to_le16(le16_to_cpu(uc[i + 1]) - 1); | 84 | uc[i + 1] = cpu_to_le16(le16_to_cpu(uc[i + 1]) - 1); |
diff --git a/fs/ntfs/volume.h b/fs/ntfs/volume.h index 375cd20a9f61..406ab55dfb32 100644 --- a/fs/ntfs/volume.h +++ b/fs/ntfs/volume.h | |||
@@ -2,7 +2,7 @@ | |||
2 | * volume.h - Defines for volume structures in NTFS Linux kernel driver. Part | 2 | * volume.h - Defines for volume structures in NTFS Linux kernel driver. Part |
3 | * of the Linux-NTFS project. | 3 | * of the Linux-NTFS project. |
4 | * | 4 | * |
5 | * Copyright (c) 2001-2005 Anton Altaparmakov | 5 | * Copyright (c) 2001-2006 Anton Altaparmakov |
6 | * Copyright (c) 2002 Richard Russon | 6 | * Copyright (c) 2002 Richard Russon |
7 | * | 7 | * |
8 | * This program/include file is free software; you can redistribute it and/or | 8 | * This program/include file is free software; you can redistribute it and/or |
@@ -41,10 +41,8 @@ typedef struct { | |||
41 | * structure has stabilized... (AIA) | 41 | * structure has stabilized... (AIA) |
42 | */ | 42 | */ |
43 | /* Device specifics. */ | 43 | /* Device specifics. */ |
44 | struct super_block *sb; /* Pointer back to the super_block, | 44 | struct super_block *sb; /* Pointer back to the super_block. */ |
45 | so we don't have to get the offset | 45 | LCN nr_blocks; /* Number of sb->s_blocksize bytes |
46 | every time. */ | ||
47 | LCN nr_blocks; /* Number of NTFS_BLOCK_SIZE bytes | ||
48 | sized blocks on the device. */ | 46 | sized blocks on the device. */ |
49 | /* Configuration provided by user at mount time. */ | 47 | /* Configuration provided by user at mount time. */ |
50 | unsigned long flags; /* Miscellaneous flags, see below. */ | 48 | unsigned long flags; /* Miscellaneous flags, see below. */ |
@@ -141,8 +139,8 @@ typedef enum { | |||
141 | NV_ShowSystemFiles, /* 1: Return system files in ntfs_readdir(). */ | 139 | NV_ShowSystemFiles, /* 1: Return system files in ntfs_readdir(). */ |
142 | NV_CaseSensitive, /* 1: Treat file names as case sensitive and | 140 | NV_CaseSensitive, /* 1: Treat file names as case sensitive and |
143 | create filenames in the POSIX namespace. | 141 | create filenames in the POSIX namespace. |
144 | Otherwise be case insensitive and create | 142 | Otherwise be case insensitive but still |
145 | file names in WIN32 namespace. */ | 143 | create file names in POSIX namespace. */ |
146 | NV_LogFileEmpty, /* 1: $LogFile journal is empty. */ | 144 | NV_LogFileEmpty, /* 1: $LogFile journal is empty. */ |
147 | NV_QuotaOutOfDate, /* 1: $Quota is out of date. */ | 145 | NV_QuotaOutOfDate, /* 1: $Quota is out of date. */ |
148 | NV_UsnJrnlStamped, /* 1: $UsnJrnl has been stamped. */ | 146 | NV_UsnJrnlStamped, /* 1: $UsnJrnl has been stamped. */ |
@@ -153,7 +151,7 @@ typedef enum { | |||
153 | * Macro tricks to expand the NVolFoo(), NVolSetFoo(), and NVolClearFoo() | 151 | * Macro tricks to expand the NVolFoo(), NVolSetFoo(), and NVolClearFoo() |
154 | * functions. | 152 | * functions. |
155 | */ | 153 | */ |
156 | #define NVOL_FNS(flag) \ | 154 | #define DEFINE_NVOL_BIT_OPS(flag) \ |
157 | static inline int NVol##flag(ntfs_volume *vol) \ | 155 | static inline int NVol##flag(ntfs_volume *vol) \ |
158 | { \ | 156 | { \ |
159 | return test_bit(NV_##flag, &(vol)->flags); \ | 157 | return test_bit(NV_##flag, &(vol)->flags); \ |
@@ -168,12 +166,12 @@ static inline void NVolClear##flag(ntfs_volume *vol) \ | |||
168 | } | 166 | } |
169 | 167 | ||
170 | /* Emit the ntfs volume bitops functions. */ | 168 | /* Emit the ntfs volume bitops functions. */ |
171 | NVOL_FNS(Errors) | 169 | DEFINE_NVOL_BIT_OPS(Errors) |
172 | NVOL_FNS(ShowSystemFiles) | 170 | DEFINE_NVOL_BIT_OPS(ShowSystemFiles) |
173 | NVOL_FNS(CaseSensitive) | 171 | DEFINE_NVOL_BIT_OPS(CaseSensitive) |
174 | NVOL_FNS(LogFileEmpty) | 172 | DEFINE_NVOL_BIT_OPS(LogFileEmpty) |
175 | NVOL_FNS(QuotaOutOfDate) | 173 | DEFINE_NVOL_BIT_OPS(QuotaOutOfDate) |
176 | NVOL_FNS(UsnJrnlStamped) | 174 | DEFINE_NVOL_BIT_OPS(UsnJrnlStamped) |
177 | NVOL_FNS(SparseEnabled) | 175 | DEFINE_NVOL_BIT_OPS(SparseEnabled) |
178 | 176 | ||
179 | #endif /* _LINUX_NTFS_VOLUME_H */ | 177 | #endif /* _LINUX_NTFS_VOLUME_H */ |
diff --git a/fs/ramfs/inode.c b/fs/ramfs/inode.c index c66bd5e4c05c..cde5d48994ae 100644 --- a/fs/ramfs/inode.c +++ b/fs/ramfs/inode.c | |||
@@ -27,6 +27,7 @@ | |||
27 | #include <linux/fs.h> | 27 | #include <linux/fs.h> |
28 | #include <linux/pagemap.h> | 28 | #include <linux/pagemap.h> |
29 | #include <linux/highmem.h> | 29 | #include <linux/highmem.h> |
30 | #include <linux/time.h> | ||
30 | #include <linux/init.h> | 31 | #include <linux/init.h> |
31 | #include <linux/string.h> | 32 | #include <linux/string.h> |
32 | #include <linux/smp_lock.h> | 33 | #include <linux/smp_lock.h> |
@@ -104,6 +105,7 @@ ramfs_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t dev) | |||
104 | d_instantiate(dentry, inode); | 105 | d_instantiate(dentry, inode); |
105 | dget(dentry); /* Extra count - pin the dentry in core */ | 106 | dget(dentry); /* Extra count - pin the dentry in core */ |
106 | error = 0; | 107 | error = 0; |
108 | dir->i_mtime = dir->i_ctime = CURRENT_TIME; | ||
107 | } | 109 | } |
108 | return error; | 110 | return error; |
109 | } | 111 | } |
diff --git a/fs/xfs/linux-2.6/xfs_aops.c b/fs/xfs/linux-2.6/xfs_aops.c index 8f2beec526cf..74d8be87f983 100644 --- a/fs/xfs/linux-2.6/xfs_aops.c +++ b/fs/xfs/linux-2.6/xfs_aops.c | |||
@@ -540,7 +540,7 @@ xfs_probe_cluster( | |||
540 | 540 | ||
541 | /* First sum forwards in this page */ | 541 | /* First sum forwards in this page */ |
542 | do { | 542 | do { |
543 | if (mapped != buffer_mapped(bh)) | 543 | if (!buffer_uptodate(bh) || (mapped != buffer_mapped(bh))) |
544 | return total; | 544 | return total; |
545 | total += bh->b_size; | 545 | total += bh->b_size; |
546 | } while ((bh = bh->b_this_page) != head); | 546 | } while ((bh = bh->b_this_page) != head); |
diff --git a/fs/xfs/quota/xfs_qm.c b/fs/xfs/quota/xfs_qm.c index 53a00fb217fa..7c0e39dc6189 100644 --- a/fs/xfs/quota/xfs_qm.c +++ b/fs/xfs/quota/xfs_qm.c | |||
@@ -68,6 +68,9 @@ kmem_zone_t *qm_dqzone; | |||
68 | kmem_zone_t *qm_dqtrxzone; | 68 | kmem_zone_t *qm_dqtrxzone; |
69 | STATIC kmem_shaker_t xfs_qm_shaker; | 69 | STATIC kmem_shaker_t xfs_qm_shaker; |
70 | 70 | ||
71 | STATIC cred_t xfs_zerocr; | ||
72 | STATIC xfs_inode_t xfs_zeroino; | ||
73 | |||
71 | STATIC void xfs_qm_list_init(xfs_dqlist_t *, char *, int); | 74 | STATIC void xfs_qm_list_init(xfs_dqlist_t *, char *, int); |
72 | STATIC void xfs_qm_list_destroy(xfs_dqlist_t *); | 75 | STATIC void xfs_qm_list_destroy(xfs_dqlist_t *); |
73 | 76 | ||
@@ -1393,8 +1396,6 @@ xfs_qm_qino_alloc( | |||
1393 | xfs_trans_t *tp; | 1396 | xfs_trans_t *tp; |
1394 | int error; | 1397 | int error; |
1395 | unsigned long s; | 1398 | unsigned long s; |
1396 | cred_t zerocr; | ||
1397 | xfs_inode_t zeroino; | ||
1398 | int committed; | 1399 | int committed; |
1399 | 1400 | ||
1400 | tp = xfs_trans_alloc(mp, XFS_TRANS_QM_QINOCREATE); | 1401 | tp = xfs_trans_alloc(mp, XFS_TRANS_QM_QINOCREATE); |
@@ -1406,11 +1407,9 @@ xfs_qm_qino_alloc( | |||
1406 | xfs_trans_cancel(tp, 0); | 1407 | xfs_trans_cancel(tp, 0); |
1407 | return error; | 1408 | return error; |
1408 | } | 1409 | } |
1409 | memset(&zerocr, 0, sizeof(zerocr)); | ||
1410 | memset(&zeroino, 0, sizeof(zeroino)); | ||
1411 | 1410 | ||
1412 | if ((error = xfs_dir_ialloc(&tp, &zeroino, S_IFREG, 1, 0, | 1411 | if ((error = xfs_dir_ialloc(&tp, &xfs_zeroino, S_IFREG, 1, 0, |
1413 | &zerocr, 0, 1, ip, &committed))) { | 1412 | &xfs_zerocr, 0, 1, ip, &committed))) { |
1414 | xfs_trans_cancel(tp, XFS_TRANS_RELEASE_LOG_RES | | 1413 | xfs_trans_cancel(tp, XFS_TRANS_RELEASE_LOG_RES | |
1415 | XFS_TRANS_ABORT); | 1414 | XFS_TRANS_ABORT); |
1416 | return error; | 1415 | return error; |
diff --git a/fs/xfs/xfs_rtalloc.c b/fs/xfs/xfs_rtalloc.c index 06fc061c50fc..5b413946b1c5 100644 --- a/fs/xfs/xfs_rtalloc.c +++ b/fs/xfs/xfs_rtalloc.c | |||
@@ -130,7 +130,8 @@ xfs_growfs_rt_alloc( | |||
130 | /* | 130 | /* |
131 | * Lock the inode. | 131 | * Lock the inode. |
132 | */ | 132 | */ |
133 | if ((error = xfs_trans_iget(mp, tp, ino, 0, XFS_ILOCK_EXCL, &ip))) | 133 | if ((error = xfs_trans_iget(mp, tp, ino, 0, |
134 | XFS_ILOCK_EXCL, &ip))) | ||
134 | goto error_exit; | 135 | goto error_exit; |
135 | XFS_BMAP_INIT(&flist, &firstblock); | 136 | XFS_BMAP_INIT(&flist, &firstblock); |
136 | /* | 137 | /* |
@@ -170,8 +171,8 @@ xfs_growfs_rt_alloc( | |||
170 | /* | 171 | /* |
171 | * Lock the bitmap inode. | 172 | * Lock the bitmap inode. |
172 | */ | 173 | */ |
173 | if ((error = xfs_trans_iget(mp, tp, ino, 0, XFS_ILOCK_EXCL, | 174 | if ((error = xfs_trans_iget(mp, tp, ino, 0, |
174 | &ip))) | 175 | XFS_ILOCK_EXCL, &ip))) |
175 | goto error_exit; | 176 | goto error_exit; |
176 | /* | 177 | /* |
177 | * Get a buffer for the block. | 178 | * Get a buffer for the block. |
@@ -2023,8 +2024,8 @@ xfs_growfs_rt( | |||
2023 | /* | 2024 | /* |
2024 | * Lock out other callers by grabbing the bitmap inode lock. | 2025 | * Lock out other callers by grabbing the bitmap inode lock. |
2025 | */ | 2026 | */ |
2026 | if ((error = xfs_trans_iget(mp, tp, 0, mp->m_sb.sb_rbmino, | 2027 | if ((error = xfs_trans_iget(mp, tp, mp->m_sb.sb_rbmino, 0, |
2027 | XFS_ILOCK_EXCL, &ip))) | 2028 | XFS_ILOCK_EXCL, &ip))) |
2028 | goto error_exit; | 2029 | goto error_exit; |
2029 | ASSERT(ip == mp->m_rbmip); | 2030 | ASSERT(ip == mp->m_rbmip); |
2030 | /* | 2031 | /* |
@@ -2037,8 +2038,8 @@ xfs_growfs_rt( | |||
2037 | /* | 2038 | /* |
2038 | * Get the summary inode into the transaction. | 2039 | * Get the summary inode into the transaction. |
2039 | */ | 2040 | */ |
2040 | if ((error = xfs_trans_iget(mp, tp, mp->m_sb.sb_rsumino, | 2041 | if ((error = xfs_trans_iget(mp, tp, mp->m_sb.sb_rsumino, 0, |
2041 | 0, XFS_ILOCK_EXCL, &ip))) | 2042 | XFS_ILOCK_EXCL, &ip))) |
2042 | goto error_exit; | 2043 | goto error_exit; |
2043 | ASSERT(ip == mp->m_rsumip); | 2044 | ASSERT(ip == mp->m_rsumip); |
2044 | /* | 2045 | /* |
@@ -2158,10 +2159,9 @@ xfs_rtallocate_extent( | |||
2158 | /* | 2159 | /* |
2159 | * Lock out other callers by grabbing the bitmap inode lock. | 2160 | * Lock out other callers by grabbing the bitmap inode lock. |
2160 | */ | 2161 | */ |
2161 | error = xfs_trans_iget(mp, tp, mp->m_sb.sb_rbmino, 0, XFS_ILOCK_EXCL, &ip); | 2162 | if ((error = xfs_trans_iget(mp, tp, mp->m_sb.sb_rbmino, 0, |
2162 | if (error) { | 2163 | XFS_ILOCK_EXCL, &ip))) |
2163 | return error; | 2164 | return error; |
2164 | } | ||
2165 | sumbp = NULL; | 2165 | sumbp = NULL; |
2166 | /* | 2166 | /* |
2167 | * Allocate by size, or near another block, or exactly at some block. | 2167 | * Allocate by size, or near another block, or exactly at some block. |
@@ -2221,10 +2221,9 @@ xfs_rtfree_extent( | |||
2221 | /* | 2221 | /* |
2222 | * Synchronize by locking the bitmap inode. | 2222 | * Synchronize by locking the bitmap inode. |
2223 | */ | 2223 | */ |
2224 | error = xfs_trans_iget(mp, tp, mp->m_sb.sb_rbmino, 0, XFS_ILOCK_EXCL, &ip); | 2224 | if ((error = xfs_trans_iget(mp, tp, mp->m_sb.sb_rbmino, 0, |
2225 | if (error) { | 2225 | XFS_ILOCK_EXCL, &ip))) |
2226 | return error; | 2226 | return error; |
2227 | } | ||
2228 | #if defined(__KERNEL__) && defined(DEBUG) | 2227 | #if defined(__KERNEL__) && defined(DEBUG) |
2229 | /* | 2228 | /* |
2230 | * Check to see that this whole range is currently allocated. | 2229 | * Check to see that this whole range is currently allocated. |
@@ -2365,8 +2364,8 @@ xfs_rtpick_extent( | |||
2365 | __uint64_t seq; /* sequence number of file creation */ | 2364 | __uint64_t seq; /* sequence number of file creation */ |
2366 | __uint64_t *seqp; /* pointer to seqno in inode */ | 2365 | __uint64_t *seqp; /* pointer to seqno in inode */ |
2367 | 2366 | ||
2368 | error = xfs_trans_iget(mp, tp, mp->m_sb.sb_rbmino, 0, XFS_ILOCK_EXCL, &ip); | 2367 | if ((error = xfs_trans_iget(mp, tp, mp->m_sb.sb_rbmino, 0, |
2369 | if (error) | 2368 | XFS_ILOCK_EXCL, &ip))) |
2370 | return error; | 2369 | return error; |
2371 | ASSERT(ip == mp->m_rbmip); | 2370 | ASSERT(ip == mp->m_rbmip); |
2372 | seqp = (__uint64_t *)&ip->i_d.di_atime; | 2371 | seqp = (__uint64_t *)&ip->i_d.di_atime; |
diff --git a/include/asm-i386/desc.h b/include/asm-i386/desc.h index 494e73bca095..89b8b82c82b3 100644 --- a/include/asm-i386/desc.h +++ b/include/asm-i386/desc.h | |||
@@ -24,11 +24,13 @@ struct Xgt_desc_struct { | |||
24 | unsigned short pad; | 24 | unsigned short pad; |
25 | } __attribute__ ((packed)); | 25 | } __attribute__ ((packed)); |
26 | 26 | ||
27 | extern struct Xgt_desc_struct idt_descr, cpu_gdt_descr[NR_CPUS]; | 27 | extern struct Xgt_desc_struct idt_descr; |
28 | DECLARE_PER_CPU(struct Xgt_desc_struct, cpu_gdt_descr); | ||
29 | |||
28 | 30 | ||
29 | static inline struct desc_struct *get_cpu_gdt_table(unsigned int cpu) | 31 | static inline struct desc_struct *get_cpu_gdt_table(unsigned int cpu) |
30 | { | 32 | { |
31 | return ((struct desc_struct *)cpu_gdt_descr[cpu].address); | 33 | return (struct desc_struct *)per_cpu(cpu_gdt_descr, cpu).address; |
32 | } | 34 | } |
33 | 35 | ||
34 | #define load_TR_desc() __asm__ __volatile__("ltr %w0"::"q" (GDT_ENTRY_TSS*8)) | 36 | #define load_TR_desc() __asm__ __volatile__("ltr %w0"::"q" (GDT_ENTRY_TSS*8)) |
diff --git a/include/asm-i386/kprobes.h b/include/asm-i386/kprobes.h index 27cac050a60e..a0d2d74a7dda 100644 --- a/include/asm-i386/kprobes.h +++ b/include/asm-i386/kprobes.h | |||
@@ -27,6 +27,9 @@ | |||
27 | #include <linux/types.h> | 27 | #include <linux/types.h> |
28 | #include <linux/ptrace.h> | 28 | #include <linux/ptrace.h> |
29 | 29 | ||
30 | #define __ARCH_WANT_KPROBES_INSN_SLOT | ||
31 | |||
32 | struct kprobe; | ||
30 | struct pt_regs; | 33 | struct pt_regs; |
31 | 34 | ||
32 | typedef u8 kprobe_opcode_t; | 35 | typedef u8 kprobe_opcode_t; |
@@ -40,14 +43,14 @@ typedef u8 kprobe_opcode_t; | |||
40 | 43 | ||
41 | #define JPROBE_ENTRY(pentry) (kprobe_opcode_t *)pentry | 44 | #define JPROBE_ENTRY(pentry) (kprobe_opcode_t *)pentry |
42 | #define ARCH_SUPPORTS_KRETPROBES | 45 | #define ARCH_SUPPORTS_KRETPROBES |
43 | #define arch_remove_kprobe(p) do {} while (0) | ||
44 | 46 | ||
47 | void arch_remove_kprobe(struct kprobe *p); | ||
45 | void kretprobe_trampoline(void); | 48 | void kretprobe_trampoline(void); |
46 | 49 | ||
47 | /* Architecture specific copy of original instruction*/ | 50 | /* Architecture specific copy of original instruction*/ |
48 | struct arch_specific_insn { | 51 | struct arch_specific_insn { |
49 | /* copy of the original instruction */ | 52 | /* copy of the original instruction */ |
50 | kprobe_opcode_t insn[MAX_INSN_SIZE]; | 53 | kprobe_opcode_t *insn; |
51 | }; | 54 | }; |
52 | 55 | ||
53 | struct prev_kprobe { | 56 | struct prev_kprobe { |
diff --git a/include/asm-m32r/uaccess.h b/include/asm-m32r/uaccess.h index 0da7c47d2f01..e8ae61956a51 100644 --- a/include/asm-m32r/uaccess.h +++ b/include/asm-m32r/uaccess.h | |||
@@ -328,7 +328,7 @@ extern void __put_user_bad(void); | |||
328 | " .long 1b,4b\n" \ | 328 | " .long 1b,4b\n" \ |
329 | " .long 2b,4b\n" \ | 329 | " .long 2b,4b\n" \ |
330 | ".previous" \ | 330 | ".previous" \ |
331 | : "=r"(err) \ | 331 | : "=&r"(err) \ |
332 | : "r"(x), "r"(addr), "i"(-EFAULT), "0"(err) \ | 332 | : "r"(x), "r"(addr), "i"(-EFAULT), "0"(err) \ |
333 | : "r14", "memory") | 333 | : "r14", "memory") |
334 | 334 | ||
@@ -353,7 +353,7 @@ extern void __put_user_bad(void); | |||
353 | " .long 1b,4b\n" \ | 353 | " .long 1b,4b\n" \ |
354 | " .long 2b,4b\n" \ | 354 | " .long 2b,4b\n" \ |
355 | ".previous" \ | 355 | ".previous" \ |
356 | : "=r"(err) \ | 356 | : "=&r"(err) \ |
357 | : "r"(x), "r"(addr), "i"(-EFAULT), "0"(err) \ | 357 | : "r"(x), "r"(addr), "i"(-EFAULT), "0"(err) \ |
358 | : "r14", "memory") | 358 | : "r14", "memory") |
359 | #else | 359 | #else |
@@ -398,7 +398,7 @@ struct __large_struct { unsigned long buf[100]; }; | |||
398 | " .balign 4\n" \ | 398 | " .balign 4\n" \ |
399 | " .long 1b,3b\n" \ | 399 | " .long 1b,3b\n" \ |
400 | ".previous" \ | 400 | ".previous" \ |
401 | : "=r"(err) \ | 401 | : "=&r"(err) \ |
402 | : "r"(x), "r"(addr), "i"(-EFAULT), "0"(err) \ | 402 | : "r"(x), "r"(addr), "i"(-EFAULT), "0"(err) \ |
403 | : "r14", "memory") | 403 | : "r14", "memory") |
404 | 404 | ||
@@ -442,7 +442,7 @@ do { \ | |||
442 | " .balign 4\n" \ | 442 | " .balign 4\n" \ |
443 | " .long 1b,3b\n" \ | 443 | " .long 1b,3b\n" \ |
444 | ".previous" \ | 444 | ".previous" \ |
445 | : "=r"(err), "=&r"(x) \ | 445 | : "=&r"(err), "=&r"(x) \ |
446 | : "r"(addr), "i"(-EFAULT), "0"(err) \ | 446 | : "r"(addr), "i"(-EFAULT), "0"(err) \ |
447 | : "r14", "memory") | 447 | : "r14", "memory") |
448 | 448 | ||
diff --git a/include/asm-mips/atomic.h b/include/asm-mips/atomic.h index 654b97d3e13a..2c8b853376c9 100644 --- a/include/asm-mips/atomic.h +++ b/include/asm-mips/atomic.h | |||
@@ -250,7 +250,10 @@ static __inline__ int atomic_sub_if_positive(int i, atomic_t * v) | |||
250 | " subu %0, %1, %3 \n" | 250 | " subu %0, %1, %3 \n" |
251 | " bltz %0, 1f \n" | 251 | " bltz %0, 1f \n" |
252 | " sc %0, %2 \n" | 252 | " sc %0, %2 \n" |
253 | " .set noreorder \n" | ||
253 | " beqzl %0, 1b \n" | 254 | " beqzl %0, 1b \n" |
255 | " subu %0, %1, %3 \n" | ||
256 | " .set reorder \n" | ||
254 | " sync \n" | 257 | " sync \n" |
255 | "1: \n" | 258 | "1: \n" |
256 | " .set mips0 \n" | 259 | " .set mips0 \n" |
@@ -266,7 +269,10 @@ static __inline__ int atomic_sub_if_positive(int i, atomic_t * v) | |||
266 | " subu %0, %1, %3 \n" | 269 | " subu %0, %1, %3 \n" |
267 | " bltz %0, 1f \n" | 270 | " bltz %0, 1f \n" |
268 | " sc %0, %2 \n" | 271 | " sc %0, %2 \n" |
272 | " .set noreorder \n" | ||
269 | " beqz %0, 1b \n" | 273 | " beqz %0, 1b \n" |
274 | " subu %0, %1, %3 \n" | ||
275 | " .set reorder \n" | ||
270 | " sync \n" | 276 | " sync \n" |
271 | "1: \n" | 277 | "1: \n" |
272 | " .set mips0 \n" | 278 | " .set mips0 \n" |
@@ -598,7 +604,10 @@ static __inline__ long atomic64_sub_if_positive(long i, atomic64_t * v) | |||
598 | " dsubu %0, %1, %3 \n" | 604 | " dsubu %0, %1, %3 \n" |
599 | " bltz %0, 1f \n" | 605 | " bltz %0, 1f \n" |
600 | " scd %0, %2 \n" | 606 | " scd %0, %2 \n" |
607 | " .set noreorder \n" | ||
601 | " beqzl %0, 1b \n" | 608 | " beqzl %0, 1b \n" |
609 | " dsubu %0, %1, %3 \n" | ||
610 | " .set reorder \n" | ||
602 | " sync \n" | 611 | " sync \n" |
603 | "1: \n" | 612 | "1: \n" |
604 | " .set mips0 \n" | 613 | " .set mips0 \n" |
@@ -614,7 +623,10 @@ static __inline__ long atomic64_sub_if_positive(long i, atomic64_t * v) | |||
614 | " dsubu %0, %1, %3 \n" | 623 | " dsubu %0, %1, %3 \n" |
615 | " bltz %0, 1f \n" | 624 | " bltz %0, 1f \n" |
616 | " scd %0, %2 \n" | 625 | " scd %0, %2 \n" |
626 | " .set noreorder \n" | ||
617 | " beqz %0, 1b \n" | 627 | " beqz %0, 1b \n" |
628 | " dsubu %0, %1, %3 \n" | ||
629 | " .set reorder \n" | ||
618 | " sync \n" | 630 | " sync \n" |
619 | "1: \n" | 631 | "1: \n" |
620 | " .set mips0 \n" | 632 | " .set mips0 \n" |
diff --git a/include/asm-mips/smp.h b/include/asm-mips/smp.h index 5618f1e12f40..75c6fe7c2126 100644 --- a/include/asm-mips/smp.h +++ b/include/asm-mips/smp.h | |||
@@ -58,7 +58,9 @@ static inline int num_booting_cpus(void) | |||
58 | return cpus_weight(cpu_callout_map); | 58 | return cpus_weight(cpu_callout_map); |
59 | } | 59 | } |
60 | 60 | ||
61 | /* These are defined by the board-specific code. */ | 61 | /* |
62 | * These are defined by the board-specific code. | ||
63 | */ | ||
62 | 64 | ||
63 | /* | 65 | /* |
64 | * Cause the function described by call_data to be executed on the passed | 66 | * Cause the function described by call_data to be executed on the passed |
@@ -79,7 +81,12 @@ extern void prom_boot_secondary(int cpu, struct task_struct *idle); | |||
79 | extern void prom_init_secondary(void); | 81 | extern void prom_init_secondary(void); |
80 | 82 | ||
81 | /* | 83 | /* |
82 | * Detect available CPUs, populate phys_cpu_present_map before smp_init | 84 | * Populate cpu_possible_map before smp_init, called from setup_arch. |
85 | */ | ||
86 | extern void plat_smp_setup(void); | ||
87 | |||
88 | /* | ||
89 | * Called after init_IRQ but before __cpu_up. | ||
83 | */ | 90 | */ |
84 | extern void prom_prepare_cpus(unsigned int max_cpus); | 91 | extern void prom_prepare_cpus(unsigned int max_cpus); |
85 | 92 | ||
diff --git a/include/asm-mips/system.h b/include/asm-mips/system.h index e8e5d4143377..ddae9bae31af 100644 --- a/include/asm-mips/system.h +++ b/include/asm-mips/system.h | |||
@@ -322,7 +322,7 @@ static inline unsigned long __cmpxchg_u32(volatile int * m, unsigned long old, | |||
322 | #endif | 322 | #endif |
323 | "2: \n" | 323 | "2: \n" |
324 | " .set pop \n" | 324 | " .set pop \n" |
325 | : "=&r" (retval), "=m" (*m) | 325 | : "=&r" (retval), "=R" (*m) |
326 | : "R" (*m), "Jr" (old), "Jr" (new) | 326 | : "R" (*m), "Jr" (old), "Jr" (new) |
327 | : "memory"); | 327 | : "memory"); |
328 | } else if (cpu_has_llsc) { | 328 | } else if (cpu_has_llsc) { |
@@ -342,7 +342,7 @@ static inline unsigned long __cmpxchg_u32(volatile int * m, unsigned long old, | |||
342 | #endif | 342 | #endif |
343 | "2: \n" | 343 | "2: \n" |
344 | " .set pop \n" | 344 | " .set pop \n" |
345 | : "=&r" (retval), "=m" (*m) | 345 | : "=&r" (retval), "=R" (*m) |
346 | : "R" (*m), "Jr" (old), "Jr" (new) | 346 | : "R" (*m), "Jr" (old), "Jr" (new) |
347 | : "memory"); | 347 | : "memory"); |
348 | } else { | 348 | } else { |
@@ -379,7 +379,7 @@ static inline unsigned long __cmpxchg_u64(volatile int * m, unsigned long old, | |||
379 | #endif | 379 | #endif |
380 | "2: \n" | 380 | "2: \n" |
381 | " .set pop \n" | 381 | " .set pop \n" |
382 | : "=&r" (retval), "=m" (*m) | 382 | : "=&r" (retval), "=R" (*m) |
383 | : "R" (*m), "Jr" (old), "Jr" (new) | 383 | : "R" (*m), "Jr" (old), "Jr" (new) |
384 | : "memory"); | 384 | : "memory"); |
385 | } else if (cpu_has_llsc) { | 385 | } else if (cpu_has_llsc) { |
@@ -397,7 +397,7 @@ static inline unsigned long __cmpxchg_u64(volatile int * m, unsigned long old, | |||
397 | #endif | 397 | #endif |
398 | "2: \n" | 398 | "2: \n" |
399 | " .set pop \n" | 399 | " .set pop \n" |
400 | : "=&r" (retval), "=m" (*m) | 400 | : "=&r" (retval), "=R" (*m) |
401 | : "R" (*m), "Jr" (old), "Jr" (new) | 401 | : "R" (*m), "Jr" (old), "Jr" (new) |
402 | : "memory"); | 402 | : "memory"); |
403 | } else { | 403 | } else { |
diff --git a/include/asm-powerpc/eeh.h b/include/asm-powerpc/eeh.h index b263fb2fa6e4..7dfb408fe2ca 100644 --- a/include/asm-powerpc/eeh.h +++ b/include/asm-powerpc/eeh.h | |||
@@ -27,6 +27,7 @@ | |||
27 | #include <linux/string.h> | 27 | #include <linux/string.h> |
28 | 28 | ||
29 | struct pci_dev; | 29 | struct pci_dev; |
30 | struct pci_bus; | ||
30 | struct device_node; | 31 | struct device_node; |
31 | 32 | ||
32 | #ifdef CONFIG_EEH | 33 | #ifdef CONFIG_EEH |
@@ -61,7 +62,7 @@ void __init pci_addr_cache_build(void); | |||
61 | */ | 62 | */ |
62 | void eeh_add_device_early(struct device_node *); | 63 | void eeh_add_device_early(struct device_node *); |
63 | void eeh_add_device_tree_early(struct device_node *); | 64 | void eeh_add_device_tree_early(struct device_node *); |
64 | void eeh_add_device_late(struct pci_dev *); | 65 | void eeh_add_device_tree_late(struct pci_bus *); |
65 | 66 | ||
66 | /** | 67 | /** |
67 | * eeh_remove_device - undo EEH setup for the indicated pci device | 68 | * eeh_remove_device - undo EEH setup for the indicated pci device |
@@ -116,12 +117,12 @@ static inline void pci_addr_cache_build(void) { } | |||
116 | 117 | ||
117 | static inline void eeh_add_device_early(struct device_node *dn) { } | 118 | static inline void eeh_add_device_early(struct device_node *dn) { } |
118 | 119 | ||
119 | static inline void eeh_add_device_late(struct pci_dev *dev) { } | ||
120 | |||
121 | static inline void eeh_remove_device(struct pci_dev *dev) { } | 120 | static inline void eeh_remove_device(struct pci_dev *dev) { } |
122 | 121 | ||
123 | static inline void eeh_add_device_tree_early(struct device_node *dn) { } | 122 | static inline void eeh_add_device_tree_early(struct device_node *dn) { } |
124 | 123 | ||
124 | static inline void eeh_add_device_tree_late(struct pci_bus *bus) { } | ||
125 | |||
125 | static inline void eeh_remove_bus_device(struct pci_dev *dev) { } | 126 | static inline void eeh_remove_bus_device(struct pci_dev *dev) { } |
126 | #define EEH_POSSIBLE_ERROR(val, type) (0) | 127 | #define EEH_POSSIBLE_ERROR(val, type) (0) |
127 | #define EEH_IO_ERROR_VALUE(size) (-1UL) | 128 | #define EEH_IO_ERROR_VALUE(size) (-1UL) |
diff --git a/include/asm-sparc64/futex.h b/include/asm-sparc64/futex.h index 6a332a9f099c..0caf60147e97 100644 --- a/include/asm-sparc64/futex.h +++ b/include/asm-sparc64/futex.h | |||
@@ -1,6 +1,86 @@ | |||
1 | #ifndef _ASM_FUTEX_H | 1 | #ifndef _SPARC64_FUTEX_H |
2 | #define _ASM_FUTEX_H | 2 | #define _SPARC64_FUTEX_H |
3 | 3 | ||
4 | #include <asm-generic/futex.h> | 4 | #include <linux/futex.h> |
5 | #include <asm/errno.h> | ||
6 | #include <asm/system.h> | ||
7 | #include <asm/uaccess.h> | ||
5 | 8 | ||
6 | #endif | 9 | #define __futex_cas_op(insn, ret, oldval, uaddr, oparg) \ |
10 | __asm__ __volatile__( \ | ||
11 | "\n1: lduwa [%3] %%asi, %2\n" \ | ||
12 | " " insn "\n" \ | ||
13 | "2: casa [%3] %%asi, %2, %1\n" \ | ||
14 | " cmp %2, %1\n" \ | ||
15 | " bne,pn %%icc, 1b\n" \ | ||
16 | " mov 0, %0\n" \ | ||
17 | "3:\n" \ | ||
18 | " .section .fixup,#alloc,#execinstr\n" \ | ||
19 | " .align 4\n" \ | ||
20 | "4: ba 3b\n" \ | ||
21 | " mov %5, %0\n" \ | ||
22 | " .previous\n" \ | ||
23 | " .section __ex_table,#alloc\n" \ | ||
24 | " .align 4\n" \ | ||
25 | " .word 1b, 4b\n" \ | ||
26 | " .word 2b, 4b\n" \ | ||
27 | " .previous\n" \ | ||
28 | : "=&r" (ret), "=&r" (oldval), "=&r" (tem) \ | ||
29 | : "r" (uaddr), "r" (oparg), "i" (-EFAULT) \ | ||
30 | : "memory") | ||
31 | |||
32 | static inline int futex_atomic_op_inuser(int encoded_op, int __user *uaddr) | ||
33 | { | ||
34 | int op = (encoded_op >> 28) & 7; | ||
35 | int cmp = (encoded_op >> 24) & 15; | ||
36 | int oparg = (encoded_op << 8) >> 20; | ||
37 | int cmparg = (encoded_op << 20) >> 20; | ||
38 | int oldval = 0, ret, tem; | ||
39 | |||
40 | if (unlikely(!access_ok(VERIFY_WRITE, uaddr, sizeof(int)))) | ||
41 | return -EFAULT; | ||
42 | if (unlikely((((unsigned long) uaddr) & 0x3UL))) | ||
43 | return -EINVAL; | ||
44 | |||
45 | if (encoded_op & (FUTEX_OP_OPARG_SHIFT << 28)) | ||
46 | oparg = 1 << oparg; | ||
47 | |||
48 | inc_preempt_count(); | ||
49 | |||
50 | switch (op) { | ||
51 | case FUTEX_OP_SET: | ||
52 | __futex_cas_op("mov\t%4, %1", ret, oldval, uaddr, oparg); | ||
53 | break; | ||
54 | case FUTEX_OP_ADD: | ||
55 | __futex_cas_op("add\t%2, %4, %1", ret, oldval, uaddr, oparg); | ||
56 | break; | ||
57 | case FUTEX_OP_OR: | ||
58 | __futex_cas_op("or\t%2, %4, %1", ret, oldval, uaddr, oparg); | ||
59 | break; | ||
60 | case FUTEX_OP_ANDN: | ||
61 | __futex_cas_op("and\t%2, %4, %1", ret, oldval, uaddr, oparg); | ||
62 | break; | ||
63 | case FUTEX_OP_XOR: | ||
64 | __futex_cas_op("xor\t%2, %4, %1", ret, oldval, uaddr, oparg); | ||
65 | break; | ||
66 | default: | ||
67 | ret = -ENOSYS; | ||
68 | } | ||
69 | |||
70 | dec_preempt_count(); | ||
71 | |||
72 | if (!ret) { | ||
73 | switch (cmp) { | ||
74 | case FUTEX_OP_CMP_EQ: ret = (oldval == cmparg); break; | ||
75 | case FUTEX_OP_CMP_NE: ret = (oldval != cmparg); break; | ||
76 | case FUTEX_OP_CMP_LT: ret = (oldval < cmparg); break; | ||
77 | case FUTEX_OP_CMP_GE: ret = (oldval >= cmparg); break; | ||
78 | case FUTEX_OP_CMP_LE: ret = (oldval <= cmparg); break; | ||
79 | case FUTEX_OP_CMP_GT: ret = (oldval > cmparg); break; | ||
80 | default: ret = -ENOSYS; | ||
81 | } | ||
82 | } | ||
83 | return ret; | ||
84 | } | ||
85 | |||
86 | #endif /* !(_SPARC64_FUTEX_H) */ | ||
diff --git a/include/asm-sparc64/smp.h b/include/asm-sparc64/smp.h index 110a2de89123..473edb2603ec 100644 --- a/include/asm-sparc64/smp.h +++ b/include/asm-sparc64/smp.h | |||
@@ -66,8 +66,14 @@ static __inline__ int hard_smp_processor_id(void) | |||
66 | 66 | ||
67 | #define raw_smp_processor_id() (current_thread_info()->cpu) | 67 | #define raw_smp_processor_id() (current_thread_info()->cpu) |
68 | 68 | ||
69 | extern void smp_setup_cpu_possible_map(void); | ||
70 | |||
69 | #endif /* !(__ASSEMBLY__) */ | 71 | #endif /* !(__ASSEMBLY__) */ |
70 | 72 | ||
73 | #else | ||
74 | |||
75 | #define smp_setup_cpu_possible_map() do { } while (0) | ||
76 | |||
71 | #endif /* !(CONFIG_SMP) */ | 77 | #endif /* !(CONFIG_SMP) */ |
72 | 78 | ||
73 | #define NO_PROC_ID 0xFF | 79 | #define NO_PROC_ID 0xFF |
diff --git a/include/asm-x86_64/pci.h b/include/asm-x86_64/pci.h index fd03e15d7ea6..8a05af264d18 100644 --- a/include/asm-x86_64/pci.h +++ b/include/asm-x86_64/pci.h | |||
@@ -19,8 +19,6 @@ extern unsigned int pcibios_assign_all_busses(void); | |||
19 | #endif | 19 | #endif |
20 | #define pcibios_scan_all_fns(a, b) 0 | 20 | #define pcibios_scan_all_fns(a, b) 0 |
21 | 21 | ||
22 | extern int no_iommu, force_iommu; | ||
23 | |||
24 | extern unsigned long pci_mem_start; | 22 | extern unsigned long pci_mem_start; |
25 | #define PCIBIOS_MIN_IO 0x1000 | 23 | #define PCIBIOS_MIN_IO 0x1000 |
26 | #define PCIBIOS_MIN_MEM (pci_mem_start) | 24 | #define PCIBIOS_MIN_MEM (pci_mem_start) |
diff --git a/include/asm-x86_64/pgtable.h b/include/asm-x86_64/pgtable.h index 8fbf4dd72115..715fd94cf577 100644 --- a/include/asm-x86_64/pgtable.h +++ b/include/asm-x86_64/pgtable.h | |||
@@ -131,7 +131,7 @@ static inline pte_t ptep_get_and_clear_full(struct mm_struct *mm, unsigned long | |||
131 | #define PGDIR_SIZE (1UL << PGDIR_SHIFT) | 131 | #define PGDIR_SIZE (1UL << PGDIR_SHIFT) |
132 | #define PGDIR_MASK (~(PGDIR_SIZE-1)) | 132 | #define PGDIR_MASK (~(PGDIR_SIZE-1)) |
133 | 133 | ||
134 | #define USER_PTRS_PER_PGD (TASK_SIZE/PGDIR_SIZE) | 134 | #define USER_PTRS_PER_PGD ((TASK_SIZE-1)/PGDIR_SIZE+1) |
135 | #define FIRST_USER_ADDRESS 0 | 135 | #define FIRST_USER_ADDRESS 0 |
136 | 136 | ||
137 | #ifndef __ASSEMBLY__ | 137 | #ifndef __ASSEMBLY__ |
diff --git a/include/asm-x86_64/proto.h b/include/asm-x86_64/proto.h index eca3f2d633db..3ba8fd45fcb3 100644 --- a/include/asm-x86_64/proto.h +++ b/include/asm-x86_64/proto.h | |||
@@ -39,7 +39,6 @@ extern void config_acpi_tables(void); | |||
39 | extern void ia32_syscall(void); | 39 | extern void ia32_syscall(void); |
40 | extern void iommu_hole_init(void); | 40 | extern void iommu_hole_init(void); |
41 | 41 | ||
42 | extern void time_init_gtod(void); | ||
43 | extern int pmtimer_mark_offset(void); | 42 | extern int pmtimer_mark_offset(void); |
44 | extern void pmtimer_resume(void); | 43 | extern void pmtimer_resume(void); |
45 | extern void pmtimer_wait(unsigned); | 44 | extern void pmtimer_wait(unsigned); |
@@ -134,6 +133,7 @@ extern int force_iommu; | |||
134 | 133 | ||
135 | extern int reboot_force; | 134 | extern int reboot_force; |
136 | extern int notsc_setup(char *); | 135 | extern int notsc_setup(char *); |
136 | extern int setup_additional_cpus(char *); | ||
137 | 137 | ||
138 | extern void smp_local_timer_interrupt(struct pt_regs * regs); | 138 | extern void smp_local_timer_interrupt(struct pt_regs * regs); |
139 | 139 | ||
diff --git a/include/linux/netfilter_bridge/ebt_log.h b/include/linux/netfilter_bridge/ebt_log.h index 358fbc84fb59..96e231ae7554 100644 --- a/include/linux/netfilter_bridge/ebt_log.h +++ b/include/linux/netfilter_bridge/ebt_log.h | |||
@@ -3,6 +3,7 @@ | |||
3 | 3 | ||
4 | #define EBT_LOG_IP 0x01 /* if the frame is made by ip, log the ip information */ | 4 | #define EBT_LOG_IP 0x01 /* if the frame is made by ip, log the ip information */ |
5 | #define EBT_LOG_ARP 0x02 | 5 | #define EBT_LOG_ARP 0x02 |
6 | #define EBT_LOG_NFLOG 0x04 | ||
6 | #define EBT_LOG_MASK (EBT_LOG_IP | EBT_LOG_ARP) | 7 | #define EBT_LOG_MASK (EBT_LOG_IP | EBT_LOG_ARP) |
7 | #define EBT_LOG_PREFIX_SIZE 30 | 8 | #define EBT_LOG_PREFIX_SIZE 30 |
8 | #define EBT_LOG_WATCHER "log" | 9 | #define EBT_LOG_WATCHER "log" |
diff --git a/include/linux/netfilter_ipv4/ipt_LOG.h b/include/linux/netfilter_ipv4/ipt_LOG.h index 22d16177319b..892f9a33fea8 100644 --- a/include/linux/netfilter_ipv4/ipt_LOG.h +++ b/include/linux/netfilter_ipv4/ipt_LOG.h | |||
@@ -6,7 +6,8 @@ | |||
6 | #define IPT_LOG_TCPOPT 0x02 /* Log TCP options */ | 6 | #define IPT_LOG_TCPOPT 0x02 /* Log TCP options */ |
7 | #define IPT_LOG_IPOPT 0x04 /* Log IP options */ | 7 | #define IPT_LOG_IPOPT 0x04 /* Log IP options */ |
8 | #define IPT_LOG_UID 0x08 /* Log UID owning local socket */ | 8 | #define IPT_LOG_UID 0x08 /* Log UID owning local socket */ |
9 | #define IPT_LOG_MASK 0x0f | 9 | #define IPT_LOG_NFLOG 0x10 /* Log using nf_log backend */ |
10 | #define IPT_LOG_MASK 0x1f | ||
10 | 11 | ||
11 | struct ipt_log_info { | 12 | struct ipt_log_info { |
12 | unsigned char level; | 13 | unsigned char level; |
diff --git a/include/linux/netfilter_ipv6/ip6t_LOG.h b/include/linux/netfilter_ipv6/ip6t_LOG.h index 9008ff5c40ae..060c1a1c6c60 100644 --- a/include/linux/netfilter_ipv6/ip6t_LOG.h +++ b/include/linux/netfilter_ipv6/ip6t_LOG.h | |||
@@ -6,7 +6,8 @@ | |||
6 | #define IP6T_LOG_TCPOPT 0x02 /* Log TCP options */ | 6 | #define IP6T_LOG_TCPOPT 0x02 /* Log TCP options */ |
7 | #define IP6T_LOG_IPOPT 0x04 /* Log IP options */ | 7 | #define IP6T_LOG_IPOPT 0x04 /* Log IP options */ |
8 | #define IP6T_LOG_UID 0x08 /* Log UID owning local socket */ | 8 | #define IP6T_LOG_UID 0x08 /* Log UID owning local socket */ |
9 | #define IP6T_LOG_MASK 0x0f | 9 | #define IP6T_LOG_NFLOG 0x10 /* Log using nf_log backend */ |
10 | #define IP6T_LOG_MASK 0x1f | ||
10 | 11 | ||
11 | struct ip6t_log_info { | 12 | struct ip6t_log_info { |
12 | unsigned char level; | 13 | unsigned char level; |
diff --git a/include/linux/serial_reg.h b/include/linux/serial_reg.h index 6a2bb955844b..3c8a6aa77415 100644 --- a/include/linux/serial_reg.h +++ b/include/linux/serial_reg.h | |||
@@ -247,10 +247,10 @@ | |||
247 | #define UART_CTR 0xFF | 247 | #define UART_CTR 0xFF |
248 | 248 | ||
249 | /* | 249 | /* |
250 | * The 16C950 Additional Control Reigster | 250 | * The 16C950 Additional Control Register |
251 | */ | 251 | */ |
252 | #define UART_ACR_RXDIS 0x01 /* Receiver disable */ | 252 | #define UART_ACR_RXDIS 0x01 /* Receiver disable */ |
253 | #define UART_ACR_TXDIS 0x02 /* Receiver disable */ | 253 | #define UART_ACR_TXDIS 0x02 /* Transmitter disable */ |
254 | #define UART_ACR_DSRFC 0x04 /* DSR Flow Control */ | 254 | #define UART_ACR_DSRFC 0x04 /* DSR Flow Control */ |
255 | #define UART_ACR_TLENB 0x20 /* 950 trigger levels enable */ | 255 | #define UART_ACR_TLENB 0x20 /* 950 trigger levels enable */ |
256 | #define UART_ACR_ICRRD 0x40 /* ICR Read enable */ | 256 | #define UART_ACR_ICRRD 0x40 /* ICR Read enable */ |
diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h index d73501ba7e44..b9ea44ac0ddb 100644 --- a/include/linux/syscalls.h +++ b/include/linux/syscalls.h | |||
@@ -543,7 +543,7 @@ asmlinkage long sys_unlinkat(int dfd, const char __user * pathname, int flag); | |||
543 | asmlinkage long sys_symlinkat(const char __user * oldname, | 543 | asmlinkage long sys_symlinkat(const char __user * oldname, |
544 | int newdfd, const char __user * newname); | 544 | int newdfd, const char __user * newname); |
545 | asmlinkage long sys_linkat(int olddfd, const char __user *oldname, | 545 | asmlinkage long sys_linkat(int olddfd, const char __user *oldname, |
546 | int newdfd, const char __user *newname); | 546 | int newdfd, const char __user *newname, int flags); |
547 | asmlinkage long sys_renameat(int olddfd, const char __user * oldname, | 547 | asmlinkage long sys_renameat(int olddfd, const char __user * oldname, |
548 | int newdfd, const char __user * newname); | 548 | int newdfd, const char __user * newname); |
549 | asmlinkage long sys_futimesat(int dfd, char __user *filename, | 549 | asmlinkage long sys_futimesat(int dfd, char __user *filename, |
diff --git a/include/net/xfrm.h b/include/net/xfrm.h index d6111a2f0a23..8d362c49b8a9 100644 --- a/include/net/xfrm.h +++ b/include/net/xfrm.h | |||
@@ -233,7 +233,6 @@ struct xfrm_type | |||
233 | int (*init_state)(struct xfrm_state *x); | 233 | int (*init_state)(struct xfrm_state *x); |
234 | void (*destructor)(struct xfrm_state *); | 234 | void (*destructor)(struct xfrm_state *); |
235 | int (*input)(struct xfrm_state *, struct xfrm_decap_state *, struct sk_buff *skb); | 235 | int (*input)(struct xfrm_state *, struct xfrm_decap_state *, struct sk_buff *skb); |
236 | int (*post_input)(struct xfrm_state *, struct xfrm_decap_state *, struct sk_buff *skb); | ||
237 | int (*output)(struct xfrm_state *, struct sk_buff *pskb); | 236 | int (*output)(struct xfrm_state *, struct sk_buff *pskb); |
238 | /* Estimate maximal size of result of transformation of a dgram */ | 237 | /* Estimate maximal size of result of transformation of a dgram */ |
239 | u32 (*get_max_size)(struct xfrm_state *, int size); | 238 | u32 (*get_max_size)(struct xfrm_state *, int size); |
@@ -403,6 +402,11 @@ unsigned xfrm_spi_hash(xfrm_address_t *addr, u32 spi, u8 proto, unsigned short f | |||
403 | 402 | ||
404 | extern void __xfrm_state_destroy(struct xfrm_state *); | 403 | extern void __xfrm_state_destroy(struct xfrm_state *); |
405 | 404 | ||
405 | static inline void __xfrm_state_put(struct xfrm_state *x) | ||
406 | { | ||
407 | atomic_dec(&x->refcnt); | ||
408 | } | ||
409 | |||
406 | static inline void xfrm_state_put(struct xfrm_state *x) | 410 | static inline void xfrm_state_put(struct xfrm_state *x) |
407 | { | 411 | { |
408 | if (atomic_dec_and_test(&x->refcnt)) | 412 | if (atomic_dec_and_test(&x->refcnt)) |
diff --git a/mm/mempolicy.c b/mm/mempolicy.c index 880831bd3003..67af4cea1e23 100644 --- a/mm/mempolicy.c +++ b/mm/mempolicy.c | |||
@@ -552,7 +552,7 @@ static void migrate_page_add(struct page *page, struct list_head *pagelist, | |||
552 | */ | 552 | */ |
553 | if ((flags & MPOL_MF_MOVE_ALL) || page_mapcount(page) == 1) { | 553 | if ((flags & MPOL_MF_MOVE_ALL) || page_mapcount(page) == 1) { |
554 | if (isolate_lru_page(page)) | 554 | if (isolate_lru_page(page)) |
555 | list_add(&page->lru, pagelist); | 555 | list_add_tail(&page->lru, pagelist); |
556 | } | 556 | } |
557 | } | 557 | } |
558 | 558 | ||
@@ -569,6 +569,7 @@ static int migrate_pages_to(struct list_head *pagelist, | |||
569 | LIST_HEAD(moved); | 569 | LIST_HEAD(moved); |
570 | LIST_HEAD(failed); | 570 | LIST_HEAD(failed); |
571 | int err = 0; | 571 | int err = 0; |
572 | unsigned long offset = 0; | ||
572 | int nr_pages; | 573 | int nr_pages; |
573 | struct page *page; | 574 | struct page *page; |
574 | struct list_head *p; | 575 | struct list_head *p; |
@@ -576,8 +577,21 @@ static int migrate_pages_to(struct list_head *pagelist, | |||
576 | redo: | 577 | redo: |
577 | nr_pages = 0; | 578 | nr_pages = 0; |
578 | list_for_each(p, pagelist) { | 579 | list_for_each(p, pagelist) { |
579 | if (vma) | 580 | if (vma) { |
580 | page = alloc_page_vma(GFP_HIGHUSER, vma, vma->vm_start); | 581 | /* |
582 | * The address passed to alloc_page_vma is used to | ||
583 | * generate the proper interleave behavior. We fake | ||
584 | * the address here by an increasing offset in order | ||
585 | * to get the proper distribution of pages. | ||
586 | * | ||
587 | * No decision has been made as to which page | ||
588 | * a certain old page is moved to so we cannot | ||
589 | * specify the correct address. | ||
590 | */ | ||
591 | page = alloc_page_vma(GFP_HIGHUSER, vma, | ||
592 | offset + vma->vm_start); | ||
593 | offset += PAGE_SIZE; | ||
594 | } | ||
581 | else | 595 | else |
582 | page = alloc_pages_node(dest, GFP_HIGHUSER, 0); | 596 | page = alloc_pages_node(dest, GFP_HIGHUSER, 0); |
583 | 597 | ||
@@ -585,7 +599,7 @@ redo: | |||
585 | err = -ENOMEM; | 599 | err = -ENOMEM; |
586 | goto out; | 600 | goto out; |
587 | } | 601 | } |
588 | list_add(&page->lru, &newlist); | 602 | list_add_tail(&page->lru, &newlist); |
589 | nr_pages++; | 603 | nr_pages++; |
590 | if (nr_pages > MIGRATE_CHUNK_SIZE) | 604 | if (nr_pages > MIGRATE_CHUNK_SIZE) |
591 | break; | 605 | break; |
diff --git a/mm/vmscan.c b/mm/vmscan.c index 1838c15ca4fd..b0af7593d01e 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c | |||
@@ -1908,7 +1908,12 @@ int zone_reclaim(struct zone *zone, gfp_t gfp_mask, unsigned int order) | |||
1908 | sc.swap_cluster_max = SWAP_CLUSTER_MAX; | 1908 | sc.swap_cluster_max = SWAP_CLUSTER_MAX; |
1909 | 1909 | ||
1910 | cond_resched(); | 1910 | cond_resched(); |
1911 | p->flags |= PF_MEMALLOC; | 1911 | /* |
1912 | * We need to be able to allocate from the reserves for RECLAIM_SWAP | ||
1913 | * and we also need to be able to write out pages for RECLAIM_WRITE | ||
1914 | * and RECLAIM_SWAP. | ||
1915 | */ | ||
1916 | p->flags |= PF_MEMALLOC | PF_SWAPWRITE; | ||
1912 | reclaim_state.reclaimed_slab = 0; | 1917 | reclaim_state.reclaimed_slab = 0; |
1913 | p->reclaim_state = &reclaim_state; | 1918 | p->reclaim_state = &reclaim_state; |
1914 | 1919 | ||
@@ -1932,11 +1937,10 @@ int zone_reclaim(struct zone *zone, gfp_t gfp_mask, unsigned int order) | |||
1932 | * a long time. | 1937 | * a long time. |
1933 | */ | 1938 | */ |
1934 | shrink_slab(sc.nr_scanned, gfp_mask, order); | 1939 | shrink_slab(sc.nr_scanned, gfp_mask, order); |
1935 | sc.nr_reclaimed = 1; /* Avoid getting the off node timeout */ | ||
1936 | } | 1940 | } |
1937 | 1941 | ||
1938 | p->reclaim_state = NULL; | 1942 | p->reclaim_state = NULL; |
1939 | current->flags &= ~PF_MEMALLOC; | 1943 | current->flags &= ~(PF_MEMALLOC | PF_SWAPWRITE); |
1940 | 1944 | ||
1941 | if (sc.nr_reclaimed == 0) | 1945 | if (sc.nr_reclaimed == 0) |
1942 | zone->last_unsuccessful_zone_reclaim = jiffies; | 1946 | zone->last_unsuccessful_zone_reclaim = jiffies; |
diff --git a/net/bridge/br_netfilter.c b/net/bridge/br_netfilter.c index 6bb0c7eb1ef0..e060aad8624d 100644 --- a/net/bridge/br_netfilter.c +++ b/net/bridge/br_netfilter.c | |||
@@ -90,6 +90,7 @@ static struct rtable __fake_rtable = { | |||
90 | .dev = &__fake_net_device, | 90 | .dev = &__fake_net_device, |
91 | .path = &__fake_rtable.u.dst, | 91 | .path = &__fake_rtable.u.dst, |
92 | .metrics = {[RTAX_MTU - 1] = 1500}, | 92 | .metrics = {[RTAX_MTU - 1] = 1500}, |
93 | .flags = DST_NOXFRM, | ||
93 | } | 94 | } |
94 | }, | 95 | }, |
95 | .rt_flags = 0, | 96 | .rt_flags = 0, |
diff --git a/net/bridge/netfilter/ebt_log.c b/net/bridge/netfilter/ebt_log.c index 0128fbbe2328..288ff1d4ccc4 100644 --- a/net/bridge/netfilter/ebt_log.c +++ b/net/bridge/netfilter/ebt_log.c | |||
@@ -166,7 +166,12 @@ static void ebt_log(const struct sk_buff *skb, unsigned int hooknr, | |||
166 | li.u.log.level = info->loglevel; | 166 | li.u.log.level = info->loglevel; |
167 | li.u.log.logflags = info->bitmask; | 167 | li.u.log.logflags = info->bitmask; |
168 | 168 | ||
169 | nf_log_packet(PF_BRIDGE, hooknr, skb, in, out, &li, info->prefix); | 169 | if (info->bitmask & EBT_LOG_NFLOG) |
170 | nf_log_packet(PF_BRIDGE, hooknr, skb, in, out, &li, | ||
171 | info->prefix); | ||
172 | else | ||
173 | ebt_log_packet(PF_BRIDGE, hooknr, skb, in, out, &li, | ||
174 | info->prefix); | ||
170 | } | 175 | } |
171 | 176 | ||
172 | static struct ebt_watcher log = | 177 | static struct ebt_watcher log = |
diff --git a/net/core/request_sock.c b/net/core/request_sock.c index b8203de5ff07..98f0fc923f91 100644 --- a/net/core/request_sock.c +++ b/net/core/request_sock.c | |||
@@ -52,7 +52,6 @@ int reqsk_queue_alloc(struct request_sock_queue *queue, | |||
52 | get_random_bytes(&lopt->hash_rnd, sizeof(lopt->hash_rnd)); | 52 | get_random_bytes(&lopt->hash_rnd, sizeof(lopt->hash_rnd)); |
53 | rwlock_init(&queue->syn_wait_lock); | 53 | rwlock_init(&queue->syn_wait_lock); |
54 | queue->rskq_accept_head = queue->rskq_accept_head = NULL; | 54 | queue->rskq_accept_head = queue->rskq_accept_head = NULL; |
55 | queue->rskq_defer_accept = 0; | ||
56 | lopt->nr_table_entries = nr_table_entries; | 55 | lopt->nr_table_entries = nr_table_entries; |
57 | 56 | ||
58 | write_lock_bh(&queue->syn_wait_lock); | 57 | write_lock_bh(&queue->syn_wait_lock); |
diff --git a/net/ethernet/eth.c b/net/ethernet/eth.c index 9890fd97e538..c971f14712ec 100644 --- a/net/ethernet/eth.c +++ b/net/ethernet/eth.c | |||
@@ -95,6 +95,12 @@ int eth_header(struct sk_buff *skb, struct net_device *dev, unsigned short type, | |||
95 | saddr = dev->dev_addr; | 95 | saddr = dev->dev_addr; |
96 | memcpy(eth->h_source,saddr,dev->addr_len); | 96 | memcpy(eth->h_source,saddr,dev->addr_len); |
97 | 97 | ||
98 | if(daddr) | ||
99 | { | ||
100 | memcpy(eth->h_dest,daddr,dev->addr_len); | ||
101 | return ETH_HLEN; | ||
102 | } | ||
103 | |||
98 | /* | 104 | /* |
99 | * Anyway, the loopback-device should never use this function... | 105 | * Anyway, the loopback-device should never use this function... |
100 | */ | 106 | */ |
@@ -105,12 +111,6 @@ int eth_header(struct sk_buff *skb, struct net_device *dev, unsigned short type, | |||
105 | return ETH_HLEN; | 111 | return ETH_HLEN; |
106 | } | 112 | } |
107 | 113 | ||
108 | if(daddr) | ||
109 | { | ||
110 | memcpy(eth->h_dest,daddr,dev->addr_len); | ||
111 | return ETH_HLEN; | ||
112 | } | ||
113 | |||
114 | return -ETH_HLEN; | 114 | return -ETH_HLEN; |
115 | } | 115 | } |
116 | 116 | ||
diff --git a/net/ipv4/esp4.c b/net/ipv4/esp4.c index 73bfcae8af9c..09590f356086 100644 --- a/net/ipv4/esp4.c +++ b/net/ipv4/esp4.c | |||
@@ -12,13 +12,6 @@ | |||
12 | #include <net/protocol.h> | 12 | #include <net/protocol.h> |
13 | #include <net/udp.h> | 13 | #include <net/udp.h> |
14 | 14 | ||
15 | /* decapsulation data for use when post-processing */ | ||
16 | struct esp_decap_data { | ||
17 | xfrm_address_t saddr; | ||
18 | __u16 sport; | ||
19 | __u8 proto; | ||
20 | }; | ||
21 | |||
22 | static int esp_output(struct xfrm_state *x, struct sk_buff *skb) | 15 | static int esp_output(struct xfrm_state *x, struct sk_buff *skb) |
23 | { | 16 | { |
24 | int err; | 17 | int err; |
@@ -150,6 +143,10 @@ static int esp_input(struct xfrm_state *x, struct xfrm_decap_state *decap, struc | |||
150 | int elen = skb->len - sizeof(struct ip_esp_hdr) - esp->conf.ivlen - alen; | 143 | int elen = skb->len - sizeof(struct ip_esp_hdr) - esp->conf.ivlen - alen; |
151 | int nfrags; | 144 | int nfrags; |
152 | int encap_len = 0; | 145 | int encap_len = 0; |
146 | u8 nexthdr[2]; | ||
147 | struct scatterlist *sg; | ||
148 | u8 workbuf[60]; | ||
149 | int padlen; | ||
153 | 150 | ||
154 | if (!pskb_may_pull(skb, sizeof(struct ip_esp_hdr))) | 151 | if (!pskb_may_pull(skb, sizeof(struct ip_esp_hdr))) |
155 | goto out; | 152 | goto out; |
@@ -185,122 +182,82 @@ static int esp_input(struct xfrm_state *x, struct xfrm_decap_state *decap, struc | |||
185 | if (esp->conf.ivlen) | 182 | if (esp->conf.ivlen) |
186 | crypto_cipher_set_iv(esp->conf.tfm, esph->enc_data, crypto_tfm_alg_ivsize(esp->conf.tfm)); | 183 | crypto_cipher_set_iv(esp->conf.tfm, esph->enc_data, crypto_tfm_alg_ivsize(esp->conf.tfm)); |
187 | 184 | ||
188 | { | 185 | sg = &esp->sgbuf[0]; |
189 | u8 nexthdr[2]; | ||
190 | struct scatterlist *sg = &esp->sgbuf[0]; | ||
191 | u8 workbuf[60]; | ||
192 | int padlen; | ||
193 | |||
194 | if (unlikely(nfrags > ESP_NUM_FAST_SG)) { | ||
195 | sg = kmalloc(sizeof(struct scatterlist)*nfrags, GFP_ATOMIC); | ||
196 | if (!sg) | ||
197 | goto out; | ||
198 | } | ||
199 | skb_to_sgvec(skb, sg, sizeof(struct ip_esp_hdr) + esp->conf.ivlen, elen); | ||
200 | crypto_cipher_decrypt(esp->conf.tfm, sg, sg, elen); | ||
201 | if (unlikely(sg != &esp->sgbuf[0])) | ||
202 | kfree(sg); | ||
203 | |||
204 | if (skb_copy_bits(skb, skb->len-alen-2, nexthdr, 2)) | ||
205 | BUG(); | ||
206 | 186 | ||
207 | padlen = nexthdr[0]; | 187 | if (unlikely(nfrags > ESP_NUM_FAST_SG)) { |
208 | if (padlen+2 >= elen) | 188 | sg = kmalloc(sizeof(struct scatterlist)*nfrags, GFP_ATOMIC); |
189 | if (!sg) | ||
209 | goto out; | 190 | goto out; |
210 | |||
211 | /* ... check padding bits here. Silly. :-) */ | ||
212 | |||
213 | if (x->encap && decap && decap->decap_type) { | ||
214 | struct esp_decap_data *encap_data; | ||
215 | struct udphdr *uh = (struct udphdr *) (iph+1); | ||
216 | |||
217 | encap_data = (struct esp_decap_data *) (decap->decap_data); | ||
218 | encap_data->proto = 0; | ||
219 | |||
220 | switch (decap->decap_type) { | ||
221 | case UDP_ENCAP_ESPINUDP: | ||
222 | case UDP_ENCAP_ESPINUDP_NON_IKE: | ||
223 | encap_data->proto = AF_INET; | ||
224 | encap_data->saddr.a4 = iph->saddr; | ||
225 | encap_data->sport = uh->source; | ||
226 | encap_len = (void*)esph - (void*)uh; | ||
227 | break; | ||
228 | |||
229 | default: | ||
230 | goto out; | ||
231 | } | ||
232 | } | ||
233 | |||
234 | iph->protocol = nexthdr[1]; | ||
235 | pskb_trim(skb, skb->len - alen - padlen - 2); | ||
236 | memcpy(workbuf, skb->nh.raw, iph->ihl*4); | ||
237 | skb->h.raw = skb_pull(skb, sizeof(struct ip_esp_hdr) + esp->conf.ivlen); | ||
238 | skb->nh.raw += encap_len + sizeof(struct ip_esp_hdr) + esp->conf.ivlen; | ||
239 | memcpy(skb->nh.raw, workbuf, iph->ihl*4); | ||
240 | skb->nh.iph->tot_len = htons(skb->len); | ||
241 | } | 191 | } |
192 | skb_to_sgvec(skb, sg, sizeof(struct ip_esp_hdr) + esp->conf.ivlen, elen); | ||
193 | crypto_cipher_decrypt(esp->conf.tfm, sg, sg, elen); | ||
194 | if (unlikely(sg != &esp->sgbuf[0])) | ||
195 | kfree(sg); | ||
242 | 196 | ||
243 | return 0; | 197 | if (skb_copy_bits(skb, skb->len-alen-2, nexthdr, 2)) |
198 | BUG(); | ||
244 | 199 | ||
245 | out: | 200 | padlen = nexthdr[0]; |
246 | return -EINVAL; | 201 | if (padlen+2 >= elen) |
247 | } | 202 | goto out; |
248 | 203 | ||
249 | static int esp_post_input(struct xfrm_state *x, struct xfrm_decap_state *decap, struct sk_buff *skb) | 204 | /* ... check padding bits here. Silly. :-) */ |
250 | { | ||
251 | |||
252 | if (x->encap) { | ||
253 | struct xfrm_encap_tmpl *encap; | ||
254 | struct esp_decap_data *decap_data; | ||
255 | 205 | ||
256 | encap = x->encap; | 206 | if (x->encap) { |
257 | decap_data = (struct esp_decap_data *)(decap->decap_data); | 207 | struct xfrm_encap_tmpl *encap = x->encap; |
208 | struct udphdr *uh; | ||
258 | 209 | ||
259 | /* first, make sure that the decap type == the encap type */ | ||
260 | if (encap->encap_type != decap->decap_type) | 210 | if (encap->encap_type != decap->decap_type) |
261 | return -EINVAL; | 211 | goto out; |
262 | 212 | ||
263 | switch (encap->encap_type) { | 213 | uh = (struct udphdr *)(iph + 1); |
264 | default: | 214 | encap_len = (void*)esph - (void*)uh; |
265 | case UDP_ENCAP_ESPINUDP: | 215 | |
266 | case UDP_ENCAP_ESPINUDP_NON_IKE: | 216 | /* |
267 | /* | 217 | * 1) if the NAT-T peer's IP or port changed then |
268 | * 1) if the NAT-T peer's IP or port changed then | 218 | * advertize the change to the keying daemon. |
269 | * advertize the change to the keying daemon. | 219 | * This is an inbound SA, so just compare |
270 | * This is an inbound SA, so just compare | 220 | * SRC ports. |
271 | * SRC ports. | 221 | */ |
272 | */ | 222 | if (iph->saddr != x->props.saddr.a4 || |
273 | if (decap_data->proto == AF_INET && | 223 | uh->source != encap->encap_sport) { |
274 | (decap_data->saddr.a4 != x->props.saddr.a4 || | 224 | xfrm_address_t ipaddr; |
275 | decap_data->sport != encap->encap_sport)) { | 225 | |
276 | xfrm_address_t ipaddr; | 226 | ipaddr.a4 = iph->saddr; |
277 | 227 | km_new_mapping(x, &ipaddr, uh->source); | |
278 | ipaddr.a4 = decap_data->saddr.a4; | 228 | |
279 | km_new_mapping(x, &ipaddr, decap_data->sport); | 229 | /* XXX: perhaps add an extra |
280 | 230 | * policy check here, to see | |
281 | /* XXX: perhaps add an extra | 231 | * if we should allow or |
282 | * policy check here, to see | 232 | * reject a packet from a |
283 | * if we should allow or | 233 | * different source |
284 | * reject a packet from a | 234 | * address/port. |
285 | * different source | ||
286 | * address/port. | ||
287 | */ | ||
288 | } | ||
289 | |||
290 | /* | ||
291 | * 2) ignore UDP/TCP checksums in case | ||
292 | * of NAT-T in Transport Mode, or | ||
293 | * perform other post-processing fixes | ||
294 | * as per * draft-ietf-ipsec-udp-encaps-06, | ||
295 | * section 3.1.2 | ||
296 | */ | 235 | */ |
297 | if (!x->props.mode) | ||
298 | skb->ip_summed = CHECKSUM_UNNECESSARY; | ||
299 | |||
300 | break; | ||
301 | } | 236 | } |
237 | |||
238 | /* | ||
239 | * 2) ignore UDP/TCP checksums in case | ||
240 | * of NAT-T in Transport Mode, or | ||
241 | * perform other post-processing fixes | ||
242 | * as per draft-ietf-ipsec-udp-encaps-06, | ||
243 | * section 3.1.2 | ||
244 | */ | ||
245 | if (!x->props.mode) | ||
246 | skb->ip_summed = CHECKSUM_UNNECESSARY; | ||
302 | } | 247 | } |
248 | |||
249 | iph->protocol = nexthdr[1]; | ||
250 | pskb_trim(skb, skb->len - alen - padlen - 2); | ||
251 | memcpy(workbuf, skb->nh.raw, iph->ihl*4); | ||
252 | skb->h.raw = skb_pull(skb, sizeof(struct ip_esp_hdr) + esp->conf.ivlen); | ||
253 | skb->nh.raw += encap_len + sizeof(struct ip_esp_hdr) + esp->conf.ivlen; | ||
254 | memcpy(skb->nh.raw, workbuf, iph->ihl*4); | ||
255 | skb->nh.iph->tot_len = htons(skb->len); | ||
256 | |||
303 | return 0; | 257 | return 0; |
258 | |||
259 | out: | ||
260 | return -EINVAL; | ||
304 | } | 261 | } |
305 | 262 | ||
306 | static u32 esp4_get_max_size(struct xfrm_state *x, int mtu) | 263 | static u32 esp4_get_max_size(struct xfrm_state *x, int mtu) |
@@ -458,7 +415,6 @@ static struct xfrm_type esp_type = | |||
458 | .destructor = esp_destroy, | 415 | .destructor = esp_destroy, |
459 | .get_max_size = esp4_get_max_size, | 416 | .get_max_size = esp4_get_max_size, |
460 | .input = esp_input, | 417 | .input = esp_input, |
461 | .post_input = esp_post_input, | ||
462 | .output = esp_output | 418 | .output = esp_output |
463 | }; | 419 | }; |
464 | 420 | ||
@@ -470,15 +426,6 @@ static struct net_protocol esp4_protocol = { | |||
470 | 426 | ||
471 | static int __init esp4_init(void) | 427 | static int __init esp4_init(void) |
472 | { | 428 | { |
473 | struct xfrm_decap_state decap; | ||
474 | |||
475 | if (sizeof(struct esp_decap_data) > | ||
476 | sizeof(decap.decap_data)) { | ||
477 | extern void decap_data_too_small(void); | ||
478 | |||
479 | decap_data_too_small(); | ||
480 | } | ||
481 | |||
482 | if (xfrm_register_type(&esp_type, AF_INET) < 0) { | 429 | if (xfrm_register_type(&esp_type, AF_INET) < 0) { |
483 | printk(KERN_INFO "ip esp init: can't add xfrm type\n"); | 430 | printk(KERN_INFO "ip esp init: can't add xfrm type\n"); |
484 | return -EAGAIN; | 431 | return -EAGAIN; |
diff --git a/net/ipv4/netfilter/ipt_LOG.c b/net/ipv4/netfilter/ipt_LOG.c index 6606ddb66a29..cc27545ff97f 100644 --- a/net/ipv4/netfilter/ipt_LOG.c +++ b/net/ipv4/netfilter/ipt_LOG.c | |||
@@ -425,7 +425,12 @@ ipt_log_target(struct sk_buff **pskb, | |||
425 | li.u.log.level = loginfo->level; | 425 | li.u.log.level = loginfo->level; |
426 | li.u.log.logflags = loginfo->logflags; | 426 | li.u.log.logflags = loginfo->logflags; |
427 | 427 | ||
428 | nf_log_packet(PF_INET, hooknum, *pskb, in, out, &li, loginfo->prefix); | 428 | if (loginfo->logflags & IPT_LOG_NFLOG) |
429 | nf_log_packet(PF_INET, hooknum, *pskb, in, out, &li, | ||
430 | loginfo->prefix); | ||
431 | else | ||
432 | ipt_log_packet(PF_INET, hooknum, *pskb, in, out, &li, | ||
433 | loginfo->prefix); | ||
429 | 434 | ||
430 | return IPT_CONTINUE; | 435 | return IPT_CONTINUE; |
431 | } | 436 | } |
diff --git a/net/ipv4/route.c b/net/ipv4/route.c index d82c242ea704..fca5fe0cf94a 100644 --- a/net/ipv4/route.c +++ b/net/ipv4/route.c | |||
@@ -835,7 +835,7 @@ static int rt_garbage_collect(void) | |||
835 | int r; | 835 | int r; |
836 | 836 | ||
837 | rthp = rt_remove_balanced_route( | 837 | rthp = rt_remove_balanced_route( |
838 | &rt_hash_table[i].chain, | 838 | &rt_hash_table[k].chain, |
839 | rth, | 839 | rth, |
840 | &r); | 840 | &r); |
841 | goal -= r; | 841 | goal -= r; |
diff --git a/net/ipv4/xfrm4_policy.c b/net/ipv4/xfrm4_policy.c index 45f7ae58f2c0..f285bbf296e2 100644 --- a/net/ipv4/xfrm4_policy.c +++ b/net/ipv4/xfrm4_policy.c | |||
@@ -35,6 +35,7 @@ __xfrm4_find_bundle(struct flowi *fl, struct xfrm_policy *policy) | |||
35 | if (xdst->u.rt.fl.oif == fl->oif && /*XXX*/ | 35 | if (xdst->u.rt.fl.oif == fl->oif && /*XXX*/ |
36 | xdst->u.rt.fl.fl4_dst == fl->fl4_dst && | 36 | xdst->u.rt.fl.fl4_dst == fl->fl4_dst && |
37 | xdst->u.rt.fl.fl4_src == fl->fl4_src && | 37 | xdst->u.rt.fl.fl4_src == fl->fl4_src && |
38 | xdst->u.rt.fl.fl4_tos == fl->fl4_tos && | ||
38 | xfrm_bundle_ok(xdst, fl, AF_INET)) { | 39 | xfrm_bundle_ok(xdst, fl, AF_INET)) { |
39 | dst_clone(dst); | 40 | dst_clone(dst); |
40 | break; | 41 | break; |
@@ -61,7 +62,8 @@ __xfrm4_bundle_create(struct xfrm_policy *policy, struct xfrm_state **xfrm, int | |||
61 | .nl_u = { | 62 | .nl_u = { |
62 | .ip4_u = { | 63 | .ip4_u = { |
63 | .saddr = local, | 64 | .saddr = local, |
64 | .daddr = remote | 65 | .daddr = remote, |
66 | .tos = fl->fl4_tos | ||
65 | } | 67 | } |
66 | } | 68 | } |
67 | }; | 69 | }; |
@@ -230,6 +232,7 @@ _decode_session4(struct sk_buff *skb, struct flowi *fl) | |||
230 | fl->proto = iph->protocol; | 232 | fl->proto = iph->protocol; |
231 | fl->fl4_dst = iph->daddr; | 233 | fl->fl4_dst = iph->daddr; |
232 | fl->fl4_src = iph->saddr; | 234 | fl->fl4_src = iph->saddr; |
235 | fl->fl4_tos = iph->tos; | ||
233 | } | 236 | } |
234 | 237 | ||
235 | static inline int xfrm4_garbage_collect(void) | 238 | static inline int xfrm4_garbage_collect(void) |
diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c index efa3e72cfcfa..f999edd846a9 100644 --- a/net/ipv6/ip6_output.c +++ b/net/ipv6/ip6_output.c | |||
@@ -494,6 +494,7 @@ static int ip6_fragment(struct sk_buff *skb, int (*output)(struct sk_buff *)) | |||
494 | struct net_device *dev; | 494 | struct net_device *dev; |
495 | struct sk_buff *frag; | 495 | struct sk_buff *frag; |
496 | struct rt6_info *rt = (struct rt6_info*)skb->dst; | 496 | struct rt6_info *rt = (struct rt6_info*)skb->dst; |
497 | struct ipv6_pinfo *np = skb->sk ? inet6_sk(skb->sk) : NULL; | ||
497 | struct ipv6hdr *tmp_hdr; | 498 | struct ipv6hdr *tmp_hdr; |
498 | struct frag_hdr *fh; | 499 | struct frag_hdr *fh; |
499 | unsigned int mtu, hlen, left, len; | 500 | unsigned int mtu, hlen, left, len; |
@@ -505,7 +506,12 @@ static int ip6_fragment(struct sk_buff *skb, int (*output)(struct sk_buff *)) | |||
505 | hlen = ip6_find_1stfragopt(skb, &prevhdr); | 506 | hlen = ip6_find_1stfragopt(skb, &prevhdr); |
506 | nexthdr = *prevhdr; | 507 | nexthdr = *prevhdr; |
507 | 508 | ||
508 | mtu = dst_mtu(&rt->u.dst) - hlen - sizeof(struct frag_hdr); | 509 | mtu = dst_mtu(&rt->u.dst); |
510 | if (np && np->frag_size < mtu) { | ||
511 | if (np->frag_size) | ||
512 | mtu = np->frag_size; | ||
513 | } | ||
514 | mtu -= hlen + sizeof(struct frag_hdr); | ||
509 | 515 | ||
510 | if (skb_shinfo(skb)->frag_list) { | 516 | if (skb_shinfo(skb)->frag_list) { |
511 | int first_len = skb_pagelen(skb); | 517 | int first_len = skb_pagelen(skb); |
@@ -882,7 +888,12 @@ int ip6_append_data(struct sock *sk, int getfrag(void *from, char *to, | |||
882 | inet->cork.fl = *fl; | 888 | inet->cork.fl = *fl; |
883 | np->cork.hop_limit = hlimit; | 889 | np->cork.hop_limit = hlimit; |
884 | np->cork.tclass = tclass; | 890 | np->cork.tclass = tclass; |
885 | inet->cork.fragsize = mtu = dst_mtu(rt->u.dst.path); | 891 | mtu = dst_mtu(rt->u.dst.path); |
892 | if (np && np->frag_size < mtu) { | ||
893 | if (np->frag_size) | ||
894 | mtu = np->frag_size; | ||
895 | } | ||
896 | inet->cork.fragsize = mtu; | ||
886 | if (dst_allfrag(rt->u.dst.path)) | 897 | if (dst_allfrag(rt->u.dst.path)) |
887 | inet->cork.flags |= IPCORK_ALLFRAG; | 898 | inet->cork.flags |= IPCORK_ALLFRAG; |
888 | inet->cork.length = 0; | 899 | inet->cork.length = 0; |
diff --git a/net/ipv6/ip6_tunnel.c b/net/ipv6/ip6_tunnel.c index faea8a120ee2..48597538db3f 100644 --- a/net/ipv6/ip6_tunnel.c +++ b/net/ipv6/ip6_tunnel.c | |||
@@ -884,6 +884,7 @@ ip6ip6_tnl_change(struct ip6_tnl *t, struct ip6_tnl_parm *p) | |||
884 | t->parms.encap_limit = p->encap_limit; | 884 | t->parms.encap_limit = p->encap_limit; |
885 | t->parms.flowinfo = p->flowinfo; | 885 | t->parms.flowinfo = p->flowinfo; |
886 | t->parms.link = p->link; | 886 | t->parms.link = p->link; |
887 | ip6_tnl_dst_reset(t); | ||
887 | ip6ip6_tnl_link_config(t); | 888 | ip6ip6_tnl_link_config(t); |
888 | return 0; | 889 | return 0; |
889 | } | 890 | } |
diff --git a/net/ipv6/netfilter/ip6t_LOG.c b/net/ipv6/netfilter/ip6t_LOG.c index 77c725832dec..6b930efa9fb9 100644 --- a/net/ipv6/netfilter/ip6t_LOG.c +++ b/net/ipv6/netfilter/ip6t_LOG.c | |||
@@ -436,7 +436,12 @@ ip6t_log_target(struct sk_buff **pskb, | |||
436 | li.u.log.level = loginfo->level; | 436 | li.u.log.level = loginfo->level; |
437 | li.u.log.logflags = loginfo->logflags; | 437 | li.u.log.logflags = loginfo->logflags; |
438 | 438 | ||
439 | nf_log_packet(PF_INET6, hooknum, *pskb, in, out, &li, loginfo->prefix); | 439 | if (loginfo->logflags & IP6T_LOG_NFLOG) |
440 | nf_log_packet(PF_INET6, hooknum, *pskb, in, out, &li, | ||
441 | loginfo->prefix); | ||
442 | else | ||
443 | ip6t_log_packet(PF_INET6, hooknum, *pskb, in, out, &li, | ||
444 | loginfo->prefix); | ||
440 | 445 | ||
441 | return IP6T_CONTINUE; | 446 | return IP6T_CONTINUE; |
442 | } | 447 | } |
diff --git a/net/key/af_key.c b/net/key/af_key.c index ae86d237a456..b2d4d1dd2116 100644 --- a/net/key/af_key.c +++ b/net/key/af_key.c | |||
@@ -1423,7 +1423,7 @@ static int pfkey_add(struct sock *sk, struct sk_buff *skb, struct sadb_msg *hdr, | |||
1423 | 1423 | ||
1424 | if (err < 0) { | 1424 | if (err < 0) { |
1425 | x->km.state = XFRM_STATE_DEAD; | 1425 | x->km.state = XFRM_STATE_DEAD; |
1426 | xfrm_state_put(x); | 1426 | __xfrm_state_put(x); |
1427 | goto out; | 1427 | goto out; |
1428 | } | 1428 | } |
1429 | 1429 | ||
diff --git a/net/netfilter/nf_queue.c b/net/netfilter/nf_queue.c index d3a4f30a7f22..d9f0d7ef103b 100644 --- a/net/netfilter/nf_queue.c +++ b/net/netfilter/nf_queue.c | |||
@@ -6,6 +6,7 @@ | |||
6 | #include <linux/skbuff.h> | 6 | #include <linux/skbuff.h> |
7 | #include <linux/netfilter.h> | 7 | #include <linux/netfilter.h> |
8 | #include <linux/seq_file.h> | 8 | #include <linux/seq_file.h> |
9 | #include <linux/rcupdate.h> | ||
9 | #include <net/protocol.h> | 10 | #include <net/protocol.h> |
10 | 11 | ||
11 | #include "nf_internals.h" | 12 | #include "nf_internals.h" |
@@ -16,7 +17,7 @@ | |||
16 | * for queueing and must reinject all packets it receives, no matter what. | 17 | * for queueing and must reinject all packets it receives, no matter what. |
17 | */ | 18 | */ |
18 | static struct nf_queue_handler *queue_handler[NPROTO]; | 19 | static struct nf_queue_handler *queue_handler[NPROTO]; |
19 | static struct nf_queue_rerouter *queue_rerouter; | 20 | static struct nf_queue_rerouter *queue_rerouter[NPROTO]; |
20 | 21 | ||
21 | static DEFINE_RWLOCK(queue_handler_lock); | 22 | static DEFINE_RWLOCK(queue_handler_lock); |
22 | 23 | ||
@@ -64,7 +65,7 @@ int nf_register_queue_rerouter(int pf, struct nf_queue_rerouter *rer) | |||
64 | return -EINVAL; | 65 | return -EINVAL; |
65 | 66 | ||
66 | write_lock_bh(&queue_handler_lock); | 67 | write_lock_bh(&queue_handler_lock); |
67 | memcpy(&queue_rerouter[pf], rer, sizeof(queue_rerouter[pf])); | 68 | rcu_assign_pointer(queue_rerouter[pf], rer); |
68 | write_unlock_bh(&queue_handler_lock); | 69 | write_unlock_bh(&queue_handler_lock); |
69 | 70 | ||
70 | return 0; | 71 | return 0; |
@@ -77,8 +78,9 @@ int nf_unregister_queue_rerouter(int pf) | |||
77 | return -EINVAL; | 78 | return -EINVAL; |
78 | 79 | ||
79 | write_lock_bh(&queue_handler_lock); | 80 | write_lock_bh(&queue_handler_lock); |
80 | memset(&queue_rerouter[pf], 0, sizeof(queue_rerouter[pf])); | 81 | rcu_assign_pointer(queue_rerouter[pf], NULL); |
81 | write_unlock_bh(&queue_handler_lock); | 82 | write_unlock_bh(&queue_handler_lock); |
83 | synchronize_rcu(); | ||
82 | return 0; | 84 | return 0; |
83 | } | 85 | } |
84 | EXPORT_SYMBOL_GPL(nf_unregister_queue_rerouter); | 86 | EXPORT_SYMBOL_GPL(nf_unregister_queue_rerouter); |
@@ -114,16 +116,17 @@ int nf_queue(struct sk_buff **skb, | |||
114 | struct net_device *physindev = NULL; | 116 | struct net_device *physindev = NULL; |
115 | struct net_device *physoutdev = NULL; | 117 | struct net_device *physoutdev = NULL; |
116 | #endif | 118 | #endif |
119 | struct nf_queue_rerouter *rerouter; | ||
117 | 120 | ||
118 | /* QUEUE == DROP if noone is waiting, to be safe. */ | 121 | /* QUEUE == DROP if noone is waiting, to be safe. */ |
119 | read_lock(&queue_handler_lock); | 122 | read_lock(&queue_handler_lock); |
120 | if (!queue_handler[pf] || !queue_handler[pf]->outfn) { | 123 | if (!queue_handler[pf]) { |
121 | read_unlock(&queue_handler_lock); | 124 | read_unlock(&queue_handler_lock); |
122 | kfree_skb(*skb); | 125 | kfree_skb(*skb); |
123 | return 1; | 126 | return 1; |
124 | } | 127 | } |
125 | 128 | ||
126 | info = kmalloc(sizeof(*info)+queue_rerouter[pf].rer_size, GFP_ATOMIC); | 129 | info = kmalloc(sizeof(*info)+queue_rerouter[pf]->rer_size, GFP_ATOMIC); |
127 | if (!info) { | 130 | if (!info) { |
128 | if (net_ratelimit()) | 131 | if (net_ratelimit()) |
129 | printk(KERN_ERR "OOM queueing packet %p\n", | 132 | printk(KERN_ERR "OOM queueing packet %p\n", |
@@ -155,15 +158,13 @@ int nf_queue(struct sk_buff **skb, | |||
155 | if (physoutdev) dev_hold(physoutdev); | 158 | if (physoutdev) dev_hold(physoutdev); |
156 | } | 159 | } |
157 | #endif | 160 | #endif |
158 | if (queue_rerouter[pf].save) | 161 | rerouter = rcu_dereference(queue_rerouter[pf]); |
159 | queue_rerouter[pf].save(*skb, info); | 162 | if (rerouter) |
163 | rerouter->save(*skb, info); | ||
160 | 164 | ||
161 | status = queue_handler[pf]->outfn(*skb, info, queuenum, | 165 | status = queue_handler[pf]->outfn(*skb, info, queuenum, |
162 | queue_handler[pf]->data); | 166 | queue_handler[pf]->data); |
163 | 167 | ||
164 | if (status >= 0 && queue_rerouter[pf].reroute) | ||
165 | status = queue_rerouter[pf].reroute(skb, info); | ||
166 | |||
167 | read_unlock(&queue_handler_lock); | 168 | read_unlock(&queue_handler_lock); |
168 | 169 | ||
169 | if (status < 0) { | 170 | if (status < 0) { |
@@ -189,6 +190,7 @@ void nf_reinject(struct sk_buff *skb, struct nf_info *info, | |||
189 | { | 190 | { |
190 | struct list_head *elem = &info->elem->list; | 191 | struct list_head *elem = &info->elem->list; |
191 | struct list_head *i; | 192 | struct list_head *i; |
193 | struct nf_queue_rerouter *rerouter; | ||
192 | 194 | ||
193 | rcu_read_lock(); | 195 | rcu_read_lock(); |
194 | 196 | ||
@@ -212,7 +214,7 @@ void nf_reinject(struct sk_buff *skb, struct nf_info *info, | |||
212 | break; | 214 | break; |
213 | } | 215 | } |
214 | 216 | ||
215 | if (elem == &nf_hooks[info->pf][info->hook]) { | 217 | if (i == &nf_hooks[info->pf][info->hook]) { |
216 | /* The module which sent it to userspace is gone. */ | 218 | /* The module which sent it to userspace is gone. */ |
217 | NFDEBUG("%s: module disappeared, dropping packet.\n", | 219 | NFDEBUG("%s: module disappeared, dropping packet.\n", |
218 | __FUNCTION__); | 220 | __FUNCTION__); |
@@ -226,6 +228,12 @@ void nf_reinject(struct sk_buff *skb, struct nf_info *info, | |||
226 | } | 228 | } |
227 | 229 | ||
228 | if (verdict == NF_ACCEPT) { | 230 | if (verdict == NF_ACCEPT) { |
231 | rerouter = rcu_dereference(queue_rerouter[info->pf]); | ||
232 | if (rerouter && rerouter->reroute(&skb, info) < 0) | ||
233 | verdict = NF_DROP; | ||
234 | } | ||
235 | |||
236 | if (verdict == NF_ACCEPT) { | ||
229 | next_hook: | 237 | next_hook: |
230 | verdict = nf_iterate(&nf_hooks[info->pf][info->hook], | 238 | verdict = nf_iterate(&nf_hooks[info->pf][info->hook], |
231 | &skb, info->hook, | 239 | &skb, info->hook, |
@@ -322,22 +330,12 @@ int __init netfilter_queue_init(void) | |||
322 | { | 330 | { |
323 | #ifdef CONFIG_PROC_FS | 331 | #ifdef CONFIG_PROC_FS |
324 | struct proc_dir_entry *pde; | 332 | struct proc_dir_entry *pde; |
325 | #endif | ||
326 | queue_rerouter = kmalloc(NPROTO * sizeof(struct nf_queue_rerouter), | ||
327 | GFP_KERNEL); | ||
328 | if (!queue_rerouter) | ||
329 | return -ENOMEM; | ||
330 | 333 | ||
331 | #ifdef CONFIG_PROC_FS | ||
332 | pde = create_proc_entry("nf_queue", S_IRUGO, proc_net_netfilter); | 334 | pde = create_proc_entry("nf_queue", S_IRUGO, proc_net_netfilter); |
333 | if (!pde) { | 335 | if (!pde) |
334 | kfree(queue_rerouter); | ||
335 | return -1; | 336 | return -1; |
336 | } | ||
337 | pde->proc_fops = &nfqueue_file_ops; | 337 | pde->proc_fops = &nfqueue_file_ops; |
338 | #endif | 338 | #endif |
339 | memset(queue_rerouter, 0, NPROTO * sizeof(struct nf_queue_rerouter)); | ||
340 | |||
341 | return 0; | 339 | return 0; |
342 | } | 340 | } |
343 | 341 | ||
diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c index 5e6b05ac1260..ae62054a9fc4 100644 --- a/net/xfrm/xfrm_policy.c +++ b/net/xfrm/xfrm_policy.c | |||
@@ -782,7 +782,7 @@ int xfrm_lookup(struct dst_entry **dst_p, struct flowi *fl, | |||
782 | int nx = 0; | 782 | int nx = 0; |
783 | int err; | 783 | int err; |
784 | u32 genid; | 784 | u32 genid; |
785 | u16 family = dst_orig->ops->family; | 785 | u16 family; |
786 | u8 dir = policy_to_flow_dir(XFRM_POLICY_OUT); | 786 | u8 dir = policy_to_flow_dir(XFRM_POLICY_OUT); |
787 | u32 sk_sid = security_sk_sid(sk, fl, dir); | 787 | u32 sk_sid = security_sk_sid(sk, fl, dir); |
788 | restart: | 788 | restart: |
@@ -796,13 +796,14 @@ restart: | |||
796 | if ((dst_orig->flags & DST_NOXFRM) || !xfrm_policy_list[XFRM_POLICY_OUT]) | 796 | if ((dst_orig->flags & DST_NOXFRM) || !xfrm_policy_list[XFRM_POLICY_OUT]) |
797 | return 0; | 797 | return 0; |
798 | 798 | ||
799 | policy = flow_cache_lookup(fl, sk_sid, family, dir, | 799 | policy = flow_cache_lookup(fl, sk_sid, dst_orig->ops->family, |
800 | xfrm_policy_lookup); | 800 | dir, xfrm_policy_lookup); |
801 | } | 801 | } |
802 | 802 | ||
803 | if (!policy) | 803 | if (!policy) |
804 | return 0; | 804 | return 0; |
805 | 805 | ||
806 | family = dst_orig->ops->family; | ||
806 | policy->curlft.use_time = (unsigned long)xtime.tv_sec; | 807 | policy->curlft.use_time = (unsigned long)xtime.tv_sec; |
807 | 808 | ||
808 | switch (policy->action) { | 809 | switch (policy->action) { |
@@ -995,13 +996,6 @@ int __xfrm_policy_check(struct sock *sk, int dir, struct sk_buff *skb, | |||
995 | struct sec_decap_state *xvec = &(skb->sp->x[i]); | 996 | struct sec_decap_state *xvec = &(skb->sp->x[i]); |
996 | if (!xfrm_selector_match(&xvec->xvec->sel, &fl, family)) | 997 | if (!xfrm_selector_match(&xvec->xvec->sel, &fl, family)) |
997 | return 0; | 998 | return 0; |
998 | |||
999 | /* If there is a post_input processor, try running it */ | ||
1000 | if (xvec->xvec->type->post_input && | ||
1001 | (xvec->xvec->type->post_input)(xvec->xvec, | ||
1002 | &(xvec->decap), | ||
1003 | skb) != 0) | ||
1004 | return 0; | ||
1005 | } | 999 | } |
1006 | } | 1000 | } |
1007 | 1001 | ||
diff --git a/net/xfrm/xfrm_state.c b/net/xfrm/xfrm_state.c index e12d0be5f976..c656cbaf35e8 100644 --- a/net/xfrm/xfrm_state.c +++ b/net/xfrm/xfrm_state.c | |||
@@ -220,14 +220,14 @@ static int __xfrm_state_delete(struct xfrm_state *x) | |||
220 | x->km.state = XFRM_STATE_DEAD; | 220 | x->km.state = XFRM_STATE_DEAD; |
221 | spin_lock(&xfrm_state_lock); | 221 | spin_lock(&xfrm_state_lock); |
222 | list_del(&x->bydst); | 222 | list_del(&x->bydst); |
223 | atomic_dec(&x->refcnt); | 223 | __xfrm_state_put(x); |
224 | if (x->id.spi) { | 224 | if (x->id.spi) { |
225 | list_del(&x->byspi); | 225 | list_del(&x->byspi); |
226 | atomic_dec(&x->refcnt); | 226 | __xfrm_state_put(x); |
227 | } | 227 | } |
228 | spin_unlock(&xfrm_state_lock); | 228 | spin_unlock(&xfrm_state_lock); |
229 | if (del_timer(&x->timer)) | 229 | if (del_timer(&x->timer)) |
230 | atomic_dec(&x->refcnt); | 230 | __xfrm_state_put(x); |
231 | 231 | ||
232 | /* The number two in this test is the reference | 232 | /* The number two in this test is the reference |
233 | * mentioned in the comment below plus the reference | 233 | * mentioned in the comment below plus the reference |
@@ -243,7 +243,7 @@ static int __xfrm_state_delete(struct xfrm_state *x) | |||
243 | * The xfrm_state_alloc call gives a reference, and that | 243 | * The xfrm_state_alloc call gives a reference, and that |
244 | * is what we are dropping here. | 244 | * is what we are dropping here. |
245 | */ | 245 | */ |
246 | atomic_dec(&x->refcnt); | 246 | __xfrm_state_put(x); |
247 | err = 0; | 247 | err = 0; |
248 | } | 248 | } |
249 | 249 | ||
diff --git a/net/xfrm/xfrm_user.c b/net/xfrm/xfrm_user.c index ac87a09ba83e..7de17559249a 100644 --- a/net/xfrm/xfrm_user.c +++ b/net/xfrm/xfrm_user.c | |||
@@ -345,7 +345,7 @@ static int xfrm_add_sa(struct sk_buff *skb, struct nlmsghdr *nlh, void **xfrma) | |||
345 | 345 | ||
346 | if (err < 0) { | 346 | if (err < 0) { |
347 | x->km.state = XFRM_STATE_DEAD; | 347 | x->km.state = XFRM_STATE_DEAD; |
348 | xfrm_state_put(x); | 348 | __xfrm_state_put(x); |
349 | goto out; | 349 | goto out; |
350 | } | 350 | } |
351 | 351 | ||
diff --git a/sound/drivers/opl3/opl3_oss.c b/sound/drivers/opl3/opl3_oss.c index 31f1f2e25aa0..0345ae647681 100644 --- a/sound/drivers/opl3/opl3_oss.c +++ b/sound/drivers/opl3/opl3_oss.c | |||
@@ -146,7 +146,7 @@ void snd_opl3_init_seq_oss(struct snd_opl3 *opl3, char *name) | |||
146 | void snd_opl3_free_seq_oss(struct snd_opl3 *opl3) | 146 | void snd_opl3_free_seq_oss(struct snd_opl3 *opl3) |
147 | { | 147 | { |
148 | if (opl3->oss_seq_dev) { | 148 | if (opl3->oss_seq_dev) { |
149 | snd_device_free(opl3->card, opl3->oss_seq_dev); | 149 | /* The instance should have been released in prior */ |
150 | opl3->oss_seq_dev = NULL; | 150 | opl3->oss_seq_dev = NULL; |
151 | } | 151 | } |
152 | } | 152 | } |
diff --git a/sound/isa/cs423x/cs4236.c b/sound/isa/cs423x/cs4236.c index 4fa431040564..99a42138bea0 100644 --- a/sound/isa/cs423x/cs4236.c +++ b/sound/isa/cs423x/cs4236.c | |||
@@ -414,7 +414,7 @@ static int __devinit snd_card_cs423x_pnpc(int dev, struct snd_card_cs4236 *acard | |||
414 | } | 414 | } |
415 | /* MPU initialization */ | 415 | /* MPU initialization */ |
416 | if (acard->mpu && mpu_port[dev] > 0) { | 416 | if (acard->mpu && mpu_port[dev] > 0) { |
417 | if (snd_cs423x_pnp_init_mpu(dev, acard->ctrl, cfg) < 0) | 417 | if (snd_cs423x_pnp_init_mpu(dev, acard->mpu, cfg) < 0) |
418 | goto error; | 418 | goto error; |
419 | } | 419 | } |
420 | kfree(cfg); | 420 | kfree(cfg); |