aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/i386/IO-APIC.txt32
-rw-r--r--Documentation/kernel-parameters.txt2
-rw-r--r--Documentation/networking/tcp.txt8
-rw-r--r--arch/mips/bcm47xx/setup.c12
-rw-r--r--arch/mips/bcm47xx/wgt634u.c71
-rw-r--r--arch/mips/configs/bcm47xx_defconfig1939
-rw-r--r--arch/mips/configs/ip28_defconfig891
-rw-r--r--arch/mips/configs/qemu_defconfig800
-rw-r--r--arch/mips/kernel/irq-rm7000.c1
-rw-r--r--arch/mips/kernel/irq-rm9000.c1
-rw-r--r--arch/mips/kernel/mips-mt-fpaff.c2
-rw-r--r--arch/mips/kernel/scall32-o32.S3
-rw-r--r--arch/mips/kernel/scall64-64.S3
-rw-r--r--arch/mips/kernel/scall64-n32.S3
-rw-r--r--arch/mips/kernel/scall64-o32.S3
-rw-r--r--arch/mips/kernel/sysirix.c2
-rw-r--r--arch/mips/mm/c-r4k.c9
-rw-r--r--arch/mips/mm/cache.c15
-rw-r--r--arch/mips/mm/init.c9
-rw-r--r--arch/mips/mm/pg-sb1.c14
-rw-r--r--arch/mips/pci/pci.c14
-rw-r--r--arch/mips/sibyte/bcm1480/smp.c1
-rw-r--r--arch/mn10300/configs/asb2303_defconfig33
-rw-r--r--arch/mn10300/kernel/gdb-io-ttysm.c2
-rw-r--r--arch/mn10300/kernel/time.c4
-rw-r--r--arch/mn10300/kernel/traps.c2
-rw-r--r--arch/powerpc/Makefile2
-rw-r--r--arch/s390/Kconfig3
-rw-r--r--arch/s390/kernel/process.c15
-rw-r--r--arch/s390/kernel/smp.c53
-rw-r--r--arch/s390/kernel/time.c2
-rw-r--r--arch/s390/lib/uaccess_std.c8
-rw-r--r--arch/sparc/kernel/process.c6
-rw-r--r--arch/sparc/kernel/setup.c4
-rw-r--r--arch/sparc/mm/sun4c.c4
-rw-r--r--arch/sparc/prom/misc.c7
-rw-r--r--arch/sparc64/Kconfig.debug4
-rw-r--r--arch/sparc64/Makefile36
-rw-r--r--arch/sparc64/defconfig33
-rw-r--r--arch/sparc64/kernel/iommu.c3
-rw-r--r--arch/sparc64/kernel/pci.c21
-rw-r--r--arch/sparc64/kernel/process.c15
-rw-r--r--arch/sparc64/kernel/prom.c1
-rw-r--r--arch/sparc64/kernel/setup.c29
-rw-r--r--arch/sparc64/kernel/sparc64_ksyms.c3
-rw-r--r--arch/sparc64/kernel/unaligned.c3
-rw-r--r--arch/sparc64/mm/init.c49
-rw-r--r--arch/sparc64/prom/misc.c9
-rw-r--r--arch/x86/Kconfig.debug2
-rw-r--r--arch/x86/Makefile2
-rw-r--r--arch/x86/kernel/Makefile10
-rw-r--r--arch/x86/kernel/cpu/bugs.c8
-rw-r--r--arch/x86/kernel/efi.c2
-rw-r--r--arch/x86/kernel/efi_32.c1
-rw-r--r--arch/x86/kernel/entry_32.S2
-rw-r--r--arch/x86/kernel/entry_64.S2
-rw-r--r--arch/x86/kernel/head_32.S2
-rw-r--r--arch/x86/kernel/head_64.S2
-rw-r--r--arch/x86/kernel/i387.c2
-rw-r--r--arch/x86/kernel/i8259_32.c25
-rw-r--r--arch/x86/kernel/io_delay.c1
-rw-r--r--arch/x86/kernel/kprobes.c4
-rw-r--r--arch/x86/kernel/nmi_32.c21
-rw-r--r--arch/x86/kernel/nmi_64.c21
-rw-r--r--arch/x86/kernel/setup_32.c1
-rw-r--r--arch/x86/kernel/setup_64.c6
-rw-r--r--arch/x86/kernel/topology.c2
-rw-r--r--arch/x86/kernel/vmlinux_32.lds.S26
-rw-r--r--arch/x86/kernel/vmlinux_64.lds.S30
-rw-r--r--arch/x86/lib/csum-wrappers_64.c147
-rw-r--r--arch/x86/lib/io_64.c18
-rw-r--r--arch/x86/mm/ioremap.c24
-rw-r--r--arch/x86/mm/pageattr.c5
-rw-r--r--arch/x86/mm/srat_64.c3
-rw-r--r--arch/x86/pci/common.c2
-rw-r--r--arch/x86/power/hibernate_asm_64.S5
-rw-r--r--arch/xtensa/Makefile2
-rw-r--r--arch/xtensa/boot/boot-elf/Makefile9
-rw-r--r--arch/xtensa/boot/boot-elf/boot.lds.S (renamed from arch/xtensa/boot/boot-elf/boot.ld)4
-rw-r--r--arch/xtensa/boot/boot-redboot/Makefile2
-rw-r--r--arch/xtensa/boot/boot-redboot/boot.ld2
-rw-r--r--arch/xtensa/kernel/asm-offsets.c17
-rw-r--r--arch/xtensa/kernel/coprocessor.S443
-rw-r--r--arch/xtensa/kernel/entry.S355
-rw-r--r--arch/xtensa/kernel/module.c2
-rw-r--r--arch/xtensa/kernel/process.c306
-rw-r--r--arch/xtensa/kernel/ptrace.c351
-rw-r--r--arch/xtensa/kernel/setup.c5
-rw-r--r--arch/xtensa/kernel/signal.c89
-rw-r--r--arch/xtensa/kernel/traps.c20
-rw-r--r--arch/xtensa/kernel/vmlinux.lds.S6
-rw-r--r--arch/xtensa/mm/cache.c7
-rw-r--r--arch/xtensa/mm/init.c2
-rw-r--r--arch/xtensa/mm/misc.S2
-rw-r--r--arch/xtensa/platforms/iss/Makefile (renamed from arch/xtensa/platform-iss/Makefile)0
-rw-r--r--arch/xtensa/platforms/iss/console.c (renamed from arch/xtensa/platform-iss/console.c)1
-rw-r--r--arch/xtensa/platforms/iss/io.c (renamed from arch/xtensa/platform-iss/io.c)0
-rw-r--r--arch/xtensa/platforms/iss/network.c (renamed from arch/xtensa/platform-iss/network.c)2
-rw-r--r--arch/xtensa/platforms/iss/setup.c (renamed from arch/xtensa/platform-iss/setup.c)0
-rw-r--r--block/blk-core.c4
-rw-r--r--block/blk-ioc.c37
-rw-r--r--block/blk-map.c20
-rw-r--r--block/blk-merge.c6
-rw-r--r--block/blk-settings.c9
-rw-r--r--block/bsg.c8
-rw-r--r--block/cfq-iosched.c38
-rw-r--r--block/elevator.c15
-rw-r--r--block/scsi_ioctl.c3
-rw-r--r--drivers/ata/ahci.c5
-rw-r--r--drivers/ata/libata-core.c249
-rw-r--r--drivers/ata/libata-scsi.c72
-rw-r--r--drivers/ata/pata_icside.c8
-rw-r--r--drivers/ata/sata_fsl.c13
-rw-r--r--drivers/ata/sata_mv.c6
-rw-r--r--drivers/ata/sata_sil24.c5
-rw-r--r--drivers/char/drm/drmP.h2
-rw-r--r--drivers/char/drm/drm_pciids.h3
-rw-r--r--drivers/char/drm/drm_sysfs.c2
-rw-r--r--drivers/char/drm/drm_vm.c125
-rw-r--r--drivers/char/drm/i915_dma.c5
-rw-r--r--drivers/char/drm/i915_drv.c51
-rw-r--r--drivers/char/drm/i915_drv.h17
-rw-r--r--drivers/char/drm/radeon_cp.c81
-rw-r--r--drivers/char/drm/radeon_drv.h38
-rw-r--r--drivers/infiniband/hw/mthca/mthca_mr.c2
-rw-r--r--drivers/infiniband/ulp/ipoib/ipoib_cm.c10
-rw-r--r--drivers/md/dm-raid1.c7
-rw-r--r--drivers/net/e1000/e1000_ethtool.c2
-rw-r--r--drivers/net/e1000/e1000_main.c8
-rw-r--r--drivers/net/e1000e/netdev.c34
-rw-r--r--drivers/net/gianfar.c4
-rw-r--r--drivers/net/gianfar_mii.c4
-rw-r--r--drivers/net/hamradio/mkiss.c5
-rw-r--r--drivers/net/igb/igb_ethtool.c2
-rw-r--r--drivers/net/igb/igb_main.c28
-rw-r--r--drivers/net/ixgb/ixgb_ethtool.c2
-rw-r--r--drivers/net/ixgbe/ixgbe_main.c41
-rw-r--r--drivers/net/niu.c11
-rw-r--r--drivers/net/pcmcia/smc91c92_cs.c12
-rw-r--r--drivers/net/tsi108_eth.c72
-rw-r--r--drivers/net/wireless/ath5k/base.c4
-rw-r--r--drivers/net/wireless/ath5k/hw.c34
-rw-r--r--drivers/net/wireless/b43/b43.h6
-rw-r--r--drivers/net/wireless/b43/main.c40
-rw-r--r--drivers/net/wireless/b43legacy/b43legacy.h4
-rw-r--r--drivers/net/wireless/b43legacy/dma.c167
-rw-r--r--drivers/net/wireless/b43legacy/dma.h33
-rw-r--r--drivers/net/wireless/b43legacy/main.c41
-rw-r--r--drivers/net/wireless/ipw2200.c45
-rw-r--r--drivers/net/wireless/iwlwifi/iwl3945-base.c19
-rw-r--r--drivers/net/wireless/iwlwifi/iwl4965-base.c17
-rw-r--r--drivers/net/wireless/rndis_wlan.c14
-rw-r--r--drivers/net/wireless/rt2x00/rt2500usb.c2
-rw-r--r--drivers/net/wireless/wavelan.h6
-rw-r--r--drivers/s390/block/dasd.c12
-rw-r--r--drivers/s390/block/dcssblk.c2
-rw-r--r--drivers/s390/char/sclp.c12
-rw-r--r--drivers/s390/char/sclp.h6
-rw-r--r--drivers/s390/char/sclp_config.c2
-rw-r--r--drivers/s390/char/sclp_cpi_sys.c2
-rw-r--r--drivers/s390/char/sclp_rw.c4
-rw-r--r--drivers/s390/char/sclp_vt220.c2
-rw-r--r--drivers/s390/cio/device.c15
-rw-r--r--drivers/s390/cio/qdio.c13
-rw-r--r--drivers/s390/cio/qdio.h2
-rw-r--r--drivers/scsi/ipr.c4
-rw-r--r--drivers/scsi/libsas/sas_ata.c4
-rw-r--r--drivers/scsi/scsi_lib.c8
-rw-r--r--drivers/video/aty/atyfb_base.c64
-rw-r--r--drivers/video/cg14.c1
-rw-r--r--drivers/video/sbuslib.c1
-rw-r--r--drivers/watchdog/Kconfig25
-rw-r--r--drivers/watchdog/Makefile2
-rw-r--r--drivers/watchdog/bfin_wdt.c7
-rw-r--r--drivers/watchdog/hpwdt.c926
-rw-r--r--drivers/watchdog/mtx-1_wdt.c35
-rw-r--r--drivers/watchdog/sb_wdog.c353
-rw-r--r--fs/bio.c2
-rw-r--r--fs/block_dev.c201
-rw-r--r--include/asm-generic/vmlinux.lds.h3
-rw-r--r--include/asm-mips/mach-ip27/dma-coherence.h2
-rw-r--r--include/asm-mips/qemu.h30
-rw-r--r--include/asm-mips/sni.h7
-rw-r--r--include/asm-mips/unistd.h21
-rw-r--r--include/asm-s390/bitops.h20
-rw-r--r--include/asm-sparc64/ptrace.h1
-rw-r--r--include/asm-x86/i387.h1
-rw-r--r--include/asm-x86/pgtable_64.h1
-rw-r--r--include/asm-x86/processor.h5
-rw-r--r--include/asm-xtensa/cacheflush.h2
-rw-r--r--include/asm-xtensa/coprocessor.h214
-rw-r--r--include/asm-xtensa/elf.h110
-rw-r--r--include/asm-xtensa/module.h4
-rw-r--r--include/asm-xtensa/pgalloc.h2
-rw-r--r--include/asm-xtensa/pgtable.h8
-rw-r--r--include/asm-xtensa/processor.h13
-rw-r--r--include/asm-xtensa/ptrace.h44
-rw-r--r--include/asm-xtensa/regs.h9
-rw-r--r--include/asm-xtensa/sigcontext.h4
-rw-r--r--include/asm-xtensa/stat.h36
-rw-r--r--include/asm-xtensa/system.h39
-rw-r--r--include/asm-xtensa/thread_info.h21
-rw-r--r--include/asm-xtensa/timex.h8
-rw-r--r--include/asm-xtensa/uaccess.h99
-rw-r--r--include/asm-xtensa/variant-fsf/tie-asm.h70
-rw-r--r--include/asm-xtensa/variant-fsf/tie.h75
-rw-r--r--include/linux/aio.h1
-rw-r--r--include/linux/bio.h1
-rw-r--r--include/linux/blkdev.h8
-rw-r--r--include/linux/fs.h1
-rw-r--r--include/linux/if_ether.h3
-rw-r--r--include/linux/init.h2
-rw-r--r--include/linux/iocontext.h2
-rw-r--r--include/linux/libata.h28
-rw-r--r--include/linux/skbuff.h2
-rw-r--r--include/net/sock.h1
-rw-r--r--kernel/irq/chip.c20
-rw-r--r--kernel/irq/spurious.c3
-rw-r--r--mm/slub.c87
-rw-r--r--net/8021q/vlan_dev.c10
-rw-r--r--net/9p/trans_virtio.c3
-rw-r--r--net/ax25/ax25_out.c13
-rw-r--r--net/bluetooth/hci_conn.c1
-rw-r--r--net/bluetooth/hci_core.c5
-rw-r--r--net/bluetooth/hci_sysfs.c24
-rw-r--r--net/core/neighbour.c12
-rw-r--r--net/core/rtnetlink.c36
-rw-r--r--net/ipv4/arp.c3
-rw-r--r--net/ipv4/ipconfig.c2
-rw-r--r--net/ipv4/tcp_ipv4.c2
-rw-r--r--net/ipv6/af_inet6.c8
-rw-r--r--net/ipv6/ip6_fib.c2
-rw-r--r--net/ipv6/ip6_tunnel.c1
-rw-r--r--net/mac80211/ieee80211.c5
-rw-r--r--net/netlabel/netlabel_cipso_v4.c45
-rw-r--r--net/netlabel/netlabel_domainhash.c2
-rw-r--r--net/netlabel/netlabel_mgmt.c81
-rw-r--r--net/netlabel/netlabel_unlabeled.c92
-rw-r--r--net/netlabel/netlabel_user.c2
-rw-r--r--net/rxrpc/ar-accept.c3
-rw-r--r--net/rxrpc/ar-ack.c3
-rw-r--r--net/xfrm/xfrm_policy.c20
-rw-r--r--scripts/mod/modpost.c2
-rw-r--r--security/smack/smack_lsm.c36
-rw-r--r--security/smack/smackfs.c61
245 files changed, 7028 insertions, 3846 deletions
diff --git a/Documentation/i386/IO-APIC.txt b/Documentation/i386/IO-APIC.txt
index 435e69e6e9aa..f95166645d29 100644
--- a/Documentation/i386/IO-APIC.txt
+++ b/Documentation/i386/IO-APIC.txt
@@ -1,12 +1,14 @@
1Most (all) Intel-MP compliant SMP boards have the so-called 'IO-APIC', 1Most (all) Intel-MP compliant SMP boards have the so-called 'IO-APIC',
2which is an enhanced interrupt controller, it enables us to route 2which is an enhanced interrupt controller. It enables us to route
3hardware interrupts to multiple CPUs, or to CPU groups. 3hardware interrupts to multiple CPUs, or to CPU groups. Without an
4IO-APIC, interrupts from hardware will be delivered only to the
5CPU which boots the operating system (usually CPU#0).
4 6
5Linux supports all variants of compliant SMP boards, including ones with 7Linux supports all variants of compliant SMP boards, including ones with
6multiple IO-APICs. (multiple IO-APICs are used in high-end servers to 8multiple IO-APICs. Multiple IO-APICs are used in high-end servers to
7distribute IRQ load further). 9distribute IRQ load further.
8 10
9There are (a few) known breakages in certain older boards, which bugs are 11There are (a few) known breakages in certain older boards, such bugs are
10usually worked around by the kernel. If your MP-compliant SMP board does 12usually worked around by the kernel. If your MP-compliant SMP board does
11not boot Linux, then consult the linux-smp mailing list archives first. 13not boot Linux, then consult the linux-smp mailing list archives first.
12 14
@@ -28,18 +30,18 @@ If your box boots fine with enabled IO-APIC IRQs, then your
28 hell:~> 30 hell:~>
29 <---------------------------- 31 <----------------------------
30 32
31some interrupts are still listed as 'XT PIC', but this is not a problem, 33Some interrupts are still listed as 'XT PIC', but this is not a problem;
32none of those IRQ sources is performance-critical. 34none of those IRQ sources is performance-critical.
33 35
34 36
35in the unlikely case that your board does not create a working mp-table, 37In the unlikely case that your board does not create a working mp-table,
36you can use the pirq= boot parameter to 'hand-construct' IRQ entries. This 38you can use the pirq= boot parameter to 'hand-construct' IRQ entries. This
37is nontrivial though and cannot be automated. One sample /etc/lilo.conf 39is non-trivial though and cannot be automated. One sample /etc/lilo.conf
38entry: 40entry:
39 41
40 append="pirq=15,11,10" 42 append="pirq=15,11,10"
41 43
42the actual numbers depend on your system, on your PCI cards and on their 44The actual numbers depend on your system, on your PCI cards and on their
43PCI slot position. Usually PCI slots are 'daisy chained' before they are 45PCI slot position. Usually PCI slots are 'daisy chained' before they are
44connected to the PCI chipset IRQ routing facility (the incoming PIRQ1-4 46connected to the PCI chipset IRQ routing facility (the incoming PIRQ1-4
45lines): 47lines):
@@ -54,7 +56,7 @@ lines):
54 PIRQ1 ----| |- `----| |- `----| |- `----| |--------| | 56 PIRQ1 ----| |- `----| |- `----| |- `----| |--------| |
55 `-' `-' `-' `-' `-' 57 `-' `-' `-' `-' `-'
56 58
57every PCI card emits a PCI IRQ, which can be INTA,INTB,INTC,INTD: 59Every PCI card emits a PCI IRQ, which can be INTA, INTB, INTC or INTD:
58 60
59 ,-. 61 ,-.
60 INTD--| | 62 INTD--| |
@@ -95,21 +97,21 @@ card (IRQ11) in Slot3, and have Slot1 empty:
95[value '0' is a generic 'placeholder', reserved for empty (or non-IRQ emitting) 97[value '0' is a generic 'placeholder', reserved for empty (or non-IRQ emitting)
96slots.] 98slots.]
97 99
98generally, it's always possible to find out the correct pirq= settings, just 100Generally, it's always possible to find out the correct pirq= settings, just
99permute all IRQ numbers properly ... it will take some time though. An 101permute all IRQ numbers properly ... it will take some time though. An
100'incorrect' pirq line will cause the booting process to hang, or a device 102'incorrect' pirq line will cause the booting process to hang, or a device
101won't function properly (if it's inserted as eg. a module). 103won't function properly (e.g. if it's inserted as a module).
102 104
103If you have 2 PCI buses, then you can use up to 8 pirq values. Although such 105If you have 2 PCI buses, then you can use up to 8 pirq values, although such
104boards tend to have a good configuration. 106boards tend to have a good configuration.
105 107
106Be prepared that it might happen that you need some strange pirq line: 108Be prepared that it might happen that you need some strange pirq line:
107 109
108 append="pirq=0,0,0,0,0,0,9,11" 110 append="pirq=0,0,0,0,0,0,9,11"
109 111
110use smart try-and-err techniques to find out the correct pirq line ... 112Use smart trial-and-error techniques to find out the correct pirq line ...
111 113
112good luck and mail to linux-smp@vger.kernel.org or 114Good luck and mail to linux-smp@vger.kernel.org or
113linux-kernel@vger.kernel.org if you have any problems that are not covered 115linux-kernel@vger.kernel.org if you have any problems that are not covered
114by this document. 116by this document.
115 117
diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt
index a4fc7fc21439..7278295f94d2 100644
--- a/Documentation/kernel-parameters.txt
+++ b/Documentation/kernel-parameters.txt
@@ -1056,8 +1056,6 @@ and is between 256 and 4096 characters. It is defined in the file
1056 [SCSI] Maximum number of LUNs received. 1056 [SCSI] Maximum number of LUNs received.
1057 Should be between 1 and 16384. 1057 Should be between 1 and 16384.
1058 1058
1059 mca-pentium [BUGS=X86-32]
1060
1061 mcatest= [IA-64] 1059 mcatest= [IA-64]
1062 1060
1063 mce [X86-32] Machine Check Exception 1061 mce [X86-32] Machine Check Exception
diff --git a/Documentation/networking/tcp.txt b/Documentation/networking/tcp.txt
index 0121edc3ba06..7d11bb5dc30a 100644
--- a/Documentation/networking/tcp.txt
+++ b/Documentation/networking/tcp.txt
@@ -1,7 +1,7 @@
1TCP protocol 1TCP protocol
2============ 2============
3 3
4Last updated: 21 June 2005 4Last updated: 9 February 2008
5 5
6Contents 6Contents
7======== 7========
@@ -52,9 +52,9 @@ research and RFC's before developing new modules.
52The method that is used to determine which congestion control mechanism is 52The method that is used to determine which congestion control mechanism is
53determined by the setting of the sysctl net.ipv4.tcp_congestion_control. 53determined by the setting of the sysctl net.ipv4.tcp_congestion_control.
54The default congestion control will be the last one registered (LIFO); 54The default congestion control will be the last one registered (LIFO);
55so if you built everything as modules. the default will be reno. If you 55so if you built everything as modules, the default will be reno. If you
56build with the default's from Kconfig, then BIC will be builtin (not a module) 56build with the defaults from Kconfig, then CUBIC will be builtin (not a
57and it will end up the default. 57module) and it will end up the default.
58 58
59If you really want a particular default value then you will need 59If you really want a particular default value then you will need
60to set it with the sysctl. If you use a sysctl, the module will be autoloaded 60to set it with the sysctl. If you use a sysctl, the module will be autoloaded
diff --git a/arch/mips/bcm47xx/setup.c b/arch/mips/bcm47xx/setup.c
index 1b6b0fa5028f..8d36f186890e 100644
--- a/arch/mips/bcm47xx/setup.c
+++ b/arch/mips/bcm47xx/setup.c
@@ -92,17 +92,17 @@ static int bcm47xx_get_invariants(struct ssb_bus *bus,
92 iv->sprom.revision = 3; 92 iv->sprom.revision = 3;
93 93
94 if (cfe_getenv("et0macaddr", buf, sizeof(buf)) >= 0) 94 if (cfe_getenv("et0macaddr", buf, sizeof(buf)) >= 0)
95 str2eaddr(buf, iv->sprom.r1.et0mac); 95 str2eaddr(buf, iv->sprom.et0mac);
96 if (cfe_getenv("et1macaddr", buf, sizeof(buf)) >= 0) 96 if (cfe_getenv("et1macaddr", buf, sizeof(buf)) >= 0)
97 str2eaddr(buf, iv->sprom.r1.et1mac); 97 str2eaddr(buf, iv->sprom.et1mac);
98 if (cfe_getenv("et0phyaddr", buf, sizeof(buf)) >= 0) 98 if (cfe_getenv("et0phyaddr", buf, sizeof(buf)) >= 0)
99 iv->sprom.r1.et0phyaddr = simple_strtoul(buf, NULL, 10); 99 iv->sprom.et0phyaddr = simple_strtoul(buf, NULL, 10);
100 if (cfe_getenv("et1phyaddr", buf, sizeof(buf)) >= 0) 100 if (cfe_getenv("et1phyaddr", buf, sizeof(buf)) >= 0)
101 iv->sprom.r1.et1phyaddr = simple_strtoul(buf, NULL, 10); 101 iv->sprom.et1phyaddr = simple_strtoul(buf, NULL, 10);
102 if (cfe_getenv("et0mdcport", buf, sizeof(buf)) >= 0) 102 if (cfe_getenv("et0mdcport", buf, sizeof(buf)) >= 0)
103 iv->sprom.r1.et0mdcport = simple_strtoul(buf, NULL, 10); 103 iv->sprom.et0mdcport = simple_strtoul(buf, NULL, 10);
104 if (cfe_getenv("et1mdcport", buf, sizeof(buf)) >= 0) 104 if (cfe_getenv("et1mdcport", buf, sizeof(buf)) >= 0)
105 iv->sprom.r1.et1mdcport = simple_strtoul(buf, NULL, 10); 105 iv->sprom.et1mdcport = simple_strtoul(buf, NULL, 10);
106 106
107 return 0; 107 return 0;
108} 108}
diff --git a/arch/mips/bcm47xx/wgt634u.c b/arch/mips/bcm47xx/wgt634u.c
index 5a017eaee712..d1d90c9ef2fa 100644
--- a/arch/mips/bcm47xx/wgt634u.c
+++ b/arch/mips/bcm47xx/wgt634u.c
@@ -9,6 +9,7 @@
9#include <linux/platform_device.h> 9#include <linux/platform_device.h>
10#include <linux/module.h> 10#include <linux/module.h>
11#include <linux/leds.h> 11#include <linux/leds.h>
12#include <linux/mtd/physmap.h>
12#include <linux/ssb/ssb.h> 13#include <linux/ssb/ssb.h>
13#include <asm/mach-bcm47xx/bcm47xx.h> 14#include <asm/mach-bcm47xx/bcm47xx.h>
14 15
@@ -43,6 +44,61 @@ static struct platform_device wgt634u_gpio_leds = {
43 } 44 }
44}; 45};
45 46
47
48/* 8MiB flash. The struct mtd_partition matches original Netgear WGT634U
49 firmware. */
50static struct mtd_partition wgt634u_partitions[] = {
51 {
52 .name = "cfe",
53 .offset = 0,
54 .size = 0x60000, /* 384k */
55 .mask_flags = MTD_WRITEABLE /* force read-only */
56 },
57 {
58 .name = "config",
59 .offset = 0x60000,
60 .size = 0x20000 /* 128k */
61 },
62 {
63 .name = "linux",
64 .offset = 0x80000,
65 .size = 0x140000 /* 1280k */
66 },
67 {
68 .name = "jffs",
69 .offset = 0x1c0000,
70 .size = 0x620000 /* 6272k */
71 },
72 {
73 .name = "nvram",
74 .offset = 0x7e0000,
75 .size = 0x20000 /* 128k */
76 },
77};
78
79static struct physmap_flash_data wgt634u_flash_data = {
80 .parts = wgt634u_partitions,
81 .nr_parts = ARRAY_SIZE(wgt634u_partitions)
82};
83
84static struct resource wgt634u_flash_resource = {
85 .flags = IORESOURCE_MEM,
86};
87
88static struct platform_device wgt634u_flash = {
89 .name = "physmap-flash",
90 .id = 0,
91 .dev = { .platform_data = &wgt634u_flash_data, },
92 .resource = &wgt634u_flash_resource,
93 .num_resources = 1,
94};
95
96/* Platform devices */
97static struct platform_device *wgt634u_devices[] __initdata = {
98 &wgt634u_flash,
99 &wgt634u_gpio_leds,
100};
101
46static int __init wgt634u_init(void) 102static int __init wgt634u_init(void)
47{ 103{
48 /* There is no easy way to detect that we are running on a WGT634U 104 /* There is no easy way to detect that we are running on a WGT634U
@@ -50,13 +106,20 @@ static int __init wgt634u_init(void)
50 * been allocated ranges 00:09:5b:xx:xx:xx and 00:0f:b5:xx:xx:xx. 106 * been allocated ranges 00:09:5b:xx:xx:xx and 00:0f:b5:xx:xx:xx.
51 */ 107 */
52 108
53 u8 *et0mac = ssb_bcm47xx.sprom.r1.et0mac; 109 u8 *et0mac = ssb_bcm47xx.sprom.et0mac;
54 110
55 if (et0mac[0] == 0x00 && 111 if (et0mac[0] == 0x00 &&
56 ((et0mac[1] == 0x09 && et0mac[2] == 0x5b) || 112 ((et0mac[1] == 0x09 && et0mac[2] == 0x5b) ||
57 (et0mac[1] == 0x0f && et0mac[2] == 0xb5))) 113 (et0mac[1] == 0x0f && et0mac[2] == 0xb5))) {
58 return platform_device_register(&wgt634u_gpio_leds); 114 struct ssb_mipscore *mcore = &ssb_bcm47xx.mipscore;
59 else 115 wgt634u_flash_data.width = mcore->flash_buswidth;
116 wgt634u_flash_resource.start = mcore->flash_window;
117 wgt634u_flash_resource.end = mcore->flash_window
118 + mcore->flash_window_size
119 - 1;
120 return platform_add_devices(wgt634u_devices,
121 ARRAY_SIZE(wgt634u_devices));
122 } else
60 return -ENODEV; 123 return -ENODEV;
61} 124}
62 125
diff --git a/arch/mips/configs/bcm47xx_defconfig b/arch/mips/configs/bcm47xx_defconfig
new file mode 100644
index 000000000000..c0e42e74dfbd
--- /dev/null
+++ b/arch/mips/configs/bcm47xx_defconfig
@@ -0,0 +1,1939 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.25-rc2
4# Mon Feb 18 11:55:24 2008
5#
6CONFIG_MIPS=y
7
8#
9# Machine selection
10#
11# CONFIG_MACH_ALCHEMY is not set
12# CONFIG_BASLER_EXCITE is not set
13CONFIG_BCM47XX=y
14# CONFIG_MIPS_COBALT is not set
15# CONFIG_MACH_DECSTATION is not set
16# CONFIG_MACH_JAZZ is not set
17# CONFIG_LASAT is not set
18# CONFIG_LEMOTE_FULONG is not set
19# CONFIG_MIPS_ATLAS is not set
20# CONFIG_MIPS_MALTA is not set
21# CONFIG_MIPS_SEAD is not set
22# CONFIG_MIPS_SIM is not set
23# CONFIG_MARKEINS is not set
24# CONFIG_MACH_VR41XX is not set
25# CONFIG_PNX8550_JBS is not set
26# CONFIG_PNX8550_STB810 is not set
27# CONFIG_PMC_MSP is not set
28# CONFIG_PMC_YOSEMITE is not set
29# CONFIG_SGI_IP22 is not set
30# CONFIG_SGI_IP27 is not set
31# CONFIG_SGI_IP28 is not set
32# CONFIG_SGI_IP32 is not set
33# CONFIG_SIBYTE_CRHINE is not set
34# CONFIG_SIBYTE_CARMEL is not set
35# CONFIG_SIBYTE_CRHONE is not set
36# CONFIG_SIBYTE_RHONE is not set
37# CONFIG_SIBYTE_SWARM is not set
38# CONFIG_SIBYTE_LITTLESUR is not set
39# CONFIG_SIBYTE_SENTOSA is not set
40# CONFIG_SIBYTE_BIGSUR is not set
41# CONFIG_SNI_RM is not set
42# CONFIG_TOSHIBA_JMR3927 is not set
43# CONFIG_TOSHIBA_RBTX4927 is not set
44# CONFIG_TOSHIBA_RBTX4938 is not set
45# CONFIG_WR_PPMC is not set
46CONFIG_RWSEM_GENERIC_SPINLOCK=y
47# CONFIG_ARCH_HAS_ILOG2_U32 is not set
48# CONFIG_ARCH_HAS_ILOG2_U64 is not set
49CONFIG_ARCH_SUPPORTS_OPROFILE=y
50CONFIG_GENERIC_FIND_NEXT_BIT=y
51CONFIG_GENERIC_HWEIGHT=y
52CONFIG_GENERIC_CALIBRATE_DELAY=y
53CONFIG_GENERIC_CLOCKEVENTS=y
54CONFIG_GENERIC_TIME=y
55CONFIG_GENERIC_CMOS_UPDATE=y
56CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER=y
57# CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ is not set
58CONFIG_CEVT_R4K=y
59CONFIG_CSRC_R4K=y
60CONFIG_CFE=y
61CONFIG_DMA_NONCOHERENT=y
62CONFIG_DMA_NEED_PCI_MAP_STATE=y
63CONFIG_EARLY_PRINTK=y
64CONFIG_SYS_HAS_EARLY_PRINTK=y
65# CONFIG_HOTPLUG_CPU is not set
66# CONFIG_NO_IOPORT is not set
67CONFIG_GENERIC_GPIO=y
68# CONFIG_CPU_BIG_ENDIAN is not set
69CONFIG_CPU_LITTLE_ENDIAN=y
70CONFIG_SYS_SUPPORTS_LITTLE_ENDIAN=y
71CONFIG_IRQ_CPU=y
72CONFIG_MIPS_L1_CACHE_SHIFT=5
73
74#
75# CPU selection
76#
77# CONFIG_CPU_LOONGSON2 is not set
78CONFIG_CPU_MIPS32_R1=y
79# CONFIG_CPU_MIPS32_R2 is not set
80# CONFIG_CPU_MIPS64_R1 is not set
81# CONFIG_CPU_MIPS64_R2 is not set
82# CONFIG_CPU_R3000 is not set
83# CONFIG_CPU_TX39XX is not set
84# CONFIG_CPU_VR41XX is not set
85# CONFIG_CPU_R4300 is not set
86# CONFIG_CPU_R4X00 is not set
87# CONFIG_CPU_TX49XX is not set
88# CONFIG_CPU_R5000 is not set
89# CONFIG_CPU_R5432 is not set
90# CONFIG_CPU_R6000 is not set
91# CONFIG_CPU_NEVADA is not set
92# CONFIG_CPU_R8000 is not set
93# CONFIG_CPU_R10000 is not set
94# CONFIG_CPU_RM7000 is not set
95# CONFIG_CPU_RM9000 is not set
96# CONFIG_CPU_SB1 is not set
97CONFIG_SYS_HAS_CPU_MIPS32_R1=y
98CONFIG_CPU_MIPS32=y
99CONFIG_CPU_MIPSR1=y
100CONFIG_SYS_SUPPORTS_32BIT_KERNEL=y
101CONFIG_CPU_SUPPORTS_32BIT_KERNEL=y
102
103#
104# Kernel type
105#
106CONFIG_32BIT=y
107# CONFIG_64BIT is not set
108CONFIG_PAGE_SIZE_4KB=y
109# CONFIG_PAGE_SIZE_8KB is not set
110# CONFIG_PAGE_SIZE_16KB is not set
111# CONFIG_PAGE_SIZE_64KB is not set
112CONFIG_CPU_HAS_PREFETCH=y
113CONFIG_MIPS_MT_DISABLED=y
114# CONFIG_MIPS_MT_SMP is not set
115# CONFIG_MIPS_MT_SMTC is not set
116CONFIG_CPU_HAS_LLSC=y
117CONFIG_CPU_HAS_SYNC=y
118CONFIG_GENERIC_HARDIRQS=y
119CONFIG_GENERIC_IRQ_PROBE=y
120CONFIG_CPU_SUPPORTS_HIGHMEM=y
121CONFIG_ARCH_FLATMEM_ENABLE=y
122CONFIG_ARCH_POPULATES_NODE_MAP=y
123CONFIG_SELECT_MEMORY_MODEL=y
124CONFIG_FLATMEM_MANUAL=y
125# CONFIG_DISCONTIGMEM_MANUAL is not set
126# CONFIG_SPARSEMEM_MANUAL is not set
127CONFIG_FLATMEM=y
128CONFIG_FLAT_NODE_MEM_MAP=y
129# CONFIG_SPARSEMEM_STATIC is not set
130# CONFIG_SPARSEMEM_VMEMMAP_ENABLE is not set
131CONFIG_SPLIT_PTLOCK_CPUS=4
132# CONFIG_RESOURCES_64BIT is not set
133CONFIG_ZONE_DMA_FLAG=0
134CONFIG_VIRT_TO_BUS=y
135CONFIG_TICK_ONESHOT=y
136CONFIG_NO_HZ=y
137CONFIG_HIGH_RES_TIMERS=y
138CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
139# CONFIG_HZ_48 is not set
140# CONFIG_HZ_100 is not set
141# CONFIG_HZ_128 is not set
142CONFIG_HZ_250=y
143# CONFIG_HZ_256 is not set
144# CONFIG_HZ_1000 is not set
145# CONFIG_HZ_1024 is not set
146CONFIG_SYS_SUPPORTS_ARBIT_HZ=y
147CONFIG_HZ=250
148CONFIG_PREEMPT_NONE=y
149# CONFIG_PREEMPT_VOLUNTARY is not set
150# CONFIG_PREEMPT is not set
151CONFIG_RCU_TRACE=y
152CONFIG_KEXEC=y
153# CONFIG_SECCOMP is not set
154CONFIG_LOCKDEP_SUPPORT=y
155CONFIG_STACKTRACE_SUPPORT=y
156CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
157
158#
159# General setup
160#
161CONFIG_EXPERIMENTAL=y
162CONFIG_BROKEN_ON_SMP=y
163CONFIG_INIT_ENV_ARG_LIMIT=32
164CONFIG_LOCALVERSION=""
165# CONFIG_LOCALVERSION_AUTO is not set
166CONFIG_SWAP=y
167CONFIG_SYSVIPC=y
168CONFIG_SYSVIPC_SYSCTL=y
169CONFIG_POSIX_MQUEUE=y
170CONFIG_BSD_PROCESS_ACCT=y
171CONFIG_BSD_PROCESS_ACCT_V3=y
172CONFIG_TASKSTATS=y
173CONFIG_TASK_DELAY_ACCT=y
174CONFIG_TASK_XACCT=y
175CONFIG_TASK_IO_ACCOUNTING=y
176CONFIG_AUDIT=y
177# CONFIG_IKCONFIG is not set
178CONFIG_LOG_BUF_SHIFT=17
179CONFIG_CGROUPS=y
180# CONFIG_CGROUP_DEBUG is not set
181CONFIG_CGROUP_NS=y
182CONFIG_GROUP_SCHED=y
183CONFIG_FAIR_GROUP_SCHED=y
184# CONFIG_RT_GROUP_SCHED is not set
185CONFIG_USER_SCHED=y
186# CONFIG_CGROUP_SCHED is not set
187CONFIG_CGROUP_CPUACCT=y
188# CONFIG_RESOURCE_COUNTERS is not set
189CONFIG_SYSFS_DEPRECATED=y
190CONFIG_RELAY=y
191# CONFIG_NAMESPACES is not set
192CONFIG_BLK_DEV_INITRD=y
193CONFIG_INITRAMFS_SOURCE=""
194CONFIG_CC_OPTIMIZE_FOR_SIZE=y
195CONFIG_SYSCTL=y
196CONFIG_EMBEDDED=y
197CONFIG_SYSCTL_SYSCALL=y
198CONFIG_KALLSYMS=y
199# CONFIG_KALLSYMS_EXTRA_PASS is not set
200CONFIG_HOTPLUG=y
201CONFIG_PRINTK=y
202CONFIG_BUG=y
203CONFIG_ELF_CORE=y
204CONFIG_COMPAT_BRK=y
205CONFIG_BASE_FULL=y
206CONFIG_FUTEX=y
207CONFIG_ANON_INODES=y
208CONFIG_EPOLL=y
209CONFIG_SIGNALFD=y
210CONFIG_TIMERFD=y
211CONFIG_EVENTFD=y
212CONFIG_SHMEM=y
213CONFIG_VM_EVENT_COUNTERS=y
214CONFIG_SLAB=y
215# CONFIG_SLUB is not set
216# CONFIG_SLOB is not set
217# CONFIG_PROFILING is not set
218# CONFIG_MARKERS is not set
219CONFIG_HAVE_OPROFILE=y
220# CONFIG_HAVE_KPROBES is not set
221CONFIG_PROC_PAGE_MONITOR=y
222CONFIG_SLABINFO=y
223CONFIG_RT_MUTEXES=y
224# CONFIG_TINY_SHMEM is not set
225CONFIG_BASE_SMALL=0
226CONFIG_MODULES=y
227CONFIG_MODULE_UNLOAD=y
228CONFIG_MODULE_FORCE_UNLOAD=y
229CONFIG_MODVERSIONS=y
230# CONFIG_MODULE_SRCVERSION_ALL is not set
231CONFIG_KMOD=y
232CONFIG_BLOCK=y
233CONFIG_LBD=y
234CONFIG_BLK_DEV_IO_TRACE=y
235CONFIG_LSF=y
236# CONFIG_BLK_DEV_BSG is not set
237
238#
239# IO Schedulers
240#
241CONFIG_IOSCHED_NOOP=y
242CONFIG_IOSCHED_AS=y
243CONFIG_IOSCHED_DEADLINE=y
244CONFIG_IOSCHED_CFQ=y
245# CONFIG_DEFAULT_AS is not set
246# CONFIG_DEFAULT_DEADLINE is not set
247CONFIG_DEFAULT_CFQ=y
248# CONFIG_DEFAULT_NOOP is not set
249CONFIG_DEFAULT_IOSCHED="cfq"
250CONFIG_CLASSIC_RCU=y
251# CONFIG_PREEMPT_RCU is not set
252
253#
254# Bus options (PCI, PCMCIA, EISA, ISA, TC)
255#
256CONFIG_HW_HAS_PCI=y
257CONFIG_PCI=y
258CONFIG_PCI_DOMAINS=y
259# CONFIG_ARCH_SUPPORTS_MSI is not set
260CONFIG_PCI_LEGACY=y
261CONFIG_MMU=y
262# CONFIG_PCCARD is not set
263# CONFIG_HOTPLUG_PCI is not set
264
265#
266# Executable file formats
267#
268CONFIG_BINFMT_ELF=y
269CONFIG_BINFMT_MISC=m
270CONFIG_TRAD_SIGNALS=y
271
272#
273# Power management options
274#
275CONFIG_ARCH_SUSPEND_POSSIBLE=y
276# CONFIG_PM is not set
277
278#
279# Networking
280#
281CONFIG_NET=y
282
283#
284# Networking options
285#
286CONFIG_PACKET=y
287CONFIG_PACKET_MMAP=y
288CONFIG_UNIX=y
289CONFIG_XFRM=y
290CONFIG_XFRM_USER=m
291# CONFIG_XFRM_SUB_POLICY is not set
292# CONFIG_XFRM_MIGRATE is not set
293# CONFIG_XFRM_STATISTICS is not set
294CONFIG_NET_KEY=m
295# CONFIG_NET_KEY_MIGRATE is not set
296CONFIG_INET=y
297CONFIG_IP_MULTICAST=y
298CONFIG_IP_ADVANCED_ROUTER=y
299CONFIG_ASK_IP_FIB_HASH=y
300# CONFIG_IP_FIB_TRIE is not set
301CONFIG_IP_FIB_HASH=y
302CONFIG_IP_MULTIPLE_TABLES=y
303CONFIG_IP_ROUTE_MULTIPATH=y
304CONFIG_IP_ROUTE_VERBOSE=y
305# CONFIG_IP_PNP is not set
306CONFIG_NET_IPIP=m
307CONFIG_NET_IPGRE=m
308CONFIG_NET_IPGRE_BROADCAST=y
309CONFIG_IP_MROUTE=y
310CONFIG_IP_PIMSM_V1=y
311CONFIG_IP_PIMSM_V2=y
312# CONFIG_ARPD is not set
313CONFIG_SYN_COOKIES=y
314CONFIG_INET_AH=m
315CONFIG_INET_ESP=m
316CONFIG_INET_IPCOMP=m
317CONFIG_INET_XFRM_TUNNEL=m
318CONFIG_INET_TUNNEL=m
319CONFIG_INET_XFRM_MODE_TRANSPORT=m
320CONFIG_INET_XFRM_MODE_TUNNEL=m
321CONFIG_INET_XFRM_MODE_BEET=m
322CONFIG_INET_LRO=m
323CONFIG_INET_DIAG=m
324CONFIG_INET_TCP_DIAG=m
325CONFIG_TCP_CONG_ADVANCED=y
326CONFIG_TCP_CONG_BIC=y
327CONFIG_TCP_CONG_CUBIC=m
328CONFIG_TCP_CONG_WESTWOOD=m
329CONFIG_TCP_CONG_HTCP=m
330CONFIG_TCP_CONG_HSTCP=m
331CONFIG_TCP_CONG_HYBLA=m
332CONFIG_TCP_CONG_VEGAS=m
333CONFIG_TCP_CONG_SCALABLE=m
334CONFIG_TCP_CONG_LP=m
335CONFIG_TCP_CONG_VENO=m
336CONFIG_TCP_CONG_YEAH=m
337CONFIG_TCP_CONG_ILLINOIS=m
338CONFIG_DEFAULT_BIC=y
339# CONFIG_DEFAULT_CUBIC is not set
340# CONFIG_DEFAULT_HTCP is not set
341# CONFIG_DEFAULT_VEGAS is not set
342# CONFIG_DEFAULT_WESTWOOD is not set
343# CONFIG_DEFAULT_RENO is not set
344CONFIG_DEFAULT_TCP_CONG="bic"
345# CONFIG_TCP_MD5SIG is not set
346CONFIG_IP_VS=m
347# CONFIG_IP_VS_DEBUG is not set
348CONFIG_IP_VS_TAB_BITS=12
349
350#
351# IPVS transport protocol load balancing support
352#
353CONFIG_IP_VS_PROTO_TCP=y
354CONFIG_IP_VS_PROTO_UDP=y
355CONFIG_IP_VS_PROTO_ESP=y
356CONFIG_IP_VS_PROTO_AH=y
357
358#
359# IPVS scheduler
360#
361CONFIG_IP_VS_RR=m
362CONFIG_IP_VS_WRR=m
363CONFIG_IP_VS_LC=m
364CONFIG_IP_VS_WLC=m
365CONFIG_IP_VS_LBLC=m
366CONFIG_IP_VS_LBLCR=m
367CONFIG_IP_VS_DH=m
368CONFIG_IP_VS_SH=m
369CONFIG_IP_VS_SED=m
370CONFIG_IP_VS_NQ=m
371
372#
373# IPVS application helper
374#
375CONFIG_IP_VS_FTP=m
376CONFIG_IPV6=m
377CONFIG_IPV6_PRIVACY=y
378# CONFIG_IPV6_ROUTER_PREF is not set
379# CONFIG_IPV6_OPTIMISTIC_DAD is not set
380CONFIG_INET6_AH=m
381CONFIG_INET6_ESP=m
382CONFIG_INET6_IPCOMP=m
383# CONFIG_IPV6_MIP6 is not set
384CONFIG_INET6_XFRM_TUNNEL=m
385CONFIG_INET6_TUNNEL=m
386CONFIG_INET6_XFRM_MODE_TRANSPORT=m
387CONFIG_INET6_XFRM_MODE_TUNNEL=m
388CONFIG_INET6_XFRM_MODE_BEET=m
389CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION=m
390CONFIG_IPV6_SIT=m
391CONFIG_IPV6_TUNNEL=m
392CONFIG_IPV6_MULTIPLE_TABLES=y
393CONFIG_IPV6_SUBTREES=y
394CONFIG_NETWORK_SECMARK=y
395CONFIG_NETFILTER=y
396# CONFIG_NETFILTER_DEBUG is not set
397CONFIG_NETFILTER_ADVANCED=y
398CONFIG_BRIDGE_NETFILTER=y
399
400#
401# Core Netfilter Configuration
402#
403CONFIG_NETFILTER_NETLINK=m
404CONFIG_NETFILTER_NETLINK_QUEUE=m
405CONFIG_NETFILTER_NETLINK_LOG=m
406CONFIG_NF_CONNTRACK=m
407CONFIG_NF_CT_ACCT=y
408CONFIG_NF_CONNTRACK_MARK=y
409CONFIG_NF_CONNTRACK_SECMARK=y
410CONFIG_NF_CONNTRACK_EVENTS=y
411CONFIG_NF_CT_PROTO_GRE=m
412CONFIG_NF_CT_PROTO_SCTP=m
413CONFIG_NF_CT_PROTO_UDPLITE=m
414CONFIG_NF_CONNTRACK_AMANDA=m
415CONFIG_NF_CONNTRACK_FTP=m
416CONFIG_NF_CONNTRACK_H323=m
417CONFIG_NF_CONNTRACK_IRC=m
418CONFIG_NF_CONNTRACK_NETBIOS_NS=m
419CONFIG_NF_CONNTRACK_PPTP=m
420CONFIG_NF_CONNTRACK_SANE=m
421CONFIG_NF_CONNTRACK_SIP=m
422CONFIG_NF_CONNTRACK_TFTP=m
423CONFIG_NF_CT_NETLINK=m
424CONFIG_NETFILTER_XTABLES=m
425CONFIG_NETFILTER_XT_TARGET_CLASSIFY=m
426CONFIG_NETFILTER_XT_TARGET_CONNMARK=m
427CONFIG_NETFILTER_XT_TARGET_DSCP=m
428CONFIG_NETFILTER_XT_TARGET_MARK=m
429CONFIG_NETFILTER_XT_TARGET_NFQUEUE=m
430CONFIG_NETFILTER_XT_TARGET_NFLOG=m
431CONFIG_NETFILTER_XT_TARGET_NOTRACK=m
432# CONFIG_NETFILTER_XT_TARGET_RATEEST is not set
433CONFIG_NETFILTER_XT_TARGET_TRACE=m
434CONFIG_NETFILTER_XT_TARGET_SECMARK=m
435CONFIG_NETFILTER_XT_TARGET_CONNSECMARK=m
436CONFIG_NETFILTER_XT_TARGET_TCPMSS=m
437# CONFIG_NETFILTER_XT_TARGET_TCPOPTSTRIP is not set
438CONFIG_NETFILTER_XT_MATCH_COMMENT=m
439CONFIG_NETFILTER_XT_MATCH_CONNBYTES=m
440CONFIG_NETFILTER_XT_MATCH_CONNLIMIT=m
441CONFIG_NETFILTER_XT_MATCH_CONNMARK=m
442CONFIG_NETFILTER_XT_MATCH_CONNTRACK=m
443CONFIG_NETFILTER_XT_MATCH_DCCP=m
444CONFIG_NETFILTER_XT_MATCH_DSCP=m
445CONFIG_NETFILTER_XT_MATCH_ESP=m
446CONFIG_NETFILTER_XT_MATCH_HELPER=m
447# CONFIG_NETFILTER_XT_MATCH_IPRANGE is not set
448CONFIG_NETFILTER_XT_MATCH_LENGTH=m
449CONFIG_NETFILTER_XT_MATCH_LIMIT=m
450CONFIG_NETFILTER_XT_MATCH_MAC=m
451CONFIG_NETFILTER_XT_MATCH_MARK=m
452# CONFIG_NETFILTER_XT_MATCH_OWNER is not set
453CONFIG_NETFILTER_XT_MATCH_POLICY=m
454CONFIG_NETFILTER_XT_MATCH_MULTIPORT=m
455CONFIG_NETFILTER_XT_MATCH_PHYSDEV=m
456CONFIG_NETFILTER_XT_MATCH_PKTTYPE=m
457CONFIG_NETFILTER_XT_MATCH_QUOTA=m
458# CONFIG_NETFILTER_XT_MATCH_RATEEST is not set
459CONFIG_NETFILTER_XT_MATCH_REALM=m
460CONFIG_NETFILTER_XT_MATCH_SCTP=m
461CONFIG_NETFILTER_XT_MATCH_STATE=m
462CONFIG_NETFILTER_XT_MATCH_STATISTIC=m
463CONFIG_NETFILTER_XT_MATCH_STRING=m
464CONFIG_NETFILTER_XT_MATCH_TCPMSS=m
465CONFIG_NETFILTER_XT_MATCH_TIME=m
466CONFIG_NETFILTER_XT_MATCH_U32=m
467CONFIG_NETFILTER_XT_MATCH_HASHLIMIT=m
468
469#
470# IP: Netfilter Configuration
471#
472CONFIG_NF_CONNTRACK_IPV4=m
473CONFIG_NF_CONNTRACK_PROC_COMPAT=y
474CONFIG_IP_NF_QUEUE=m
475CONFIG_IP_NF_IPTABLES=m
476CONFIG_IP_NF_MATCH_RECENT=m
477CONFIG_IP_NF_MATCH_ECN=m
478CONFIG_IP_NF_MATCH_AH=m
479CONFIG_IP_NF_MATCH_TTL=m
480CONFIG_IP_NF_MATCH_ADDRTYPE=m
481CONFIG_IP_NF_FILTER=m
482CONFIG_IP_NF_TARGET_REJECT=m
483CONFIG_IP_NF_TARGET_LOG=m
484CONFIG_IP_NF_TARGET_ULOG=m
485CONFIG_NF_NAT=m
486CONFIG_NF_NAT_NEEDED=y
487CONFIG_IP_NF_TARGET_MASQUERADE=m
488CONFIG_IP_NF_TARGET_REDIRECT=m
489CONFIG_IP_NF_TARGET_NETMAP=m
490CONFIG_NF_NAT_SNMP_BASIC=m
491CONFIG_NF_NAT_PROTO_GRE=m
492CONFIG_NF_NAT_FTP=m
493CONFIG_NF_NAT_IRC=m
494CONFIG_NF_NAT_TFTP=m
495CONFIG_NF_NAT_AMANDA=m
496CONFIG_NF_NAT_PPTP=m
497CONFIG_NF_NAT_H323=m
498CONFIG_NF_NAT_SIP=m
499CONFIG_IP_NF_MANGLE=m
500CONFIG_IP_NF_TARGET_ECN=m
501CONFIG_IP_NF_TARGET_TTL=m
502CONFIG_IP_NF_TARGET_CLUSTERIP=m
503CONFIG_IP_NF_RAW=m
504CONFIG_IP_NF_ARPTABLES=m
505CONFIG_IP_NF_ARPFILTER=m
506CONFIG_IP_NF_ARP_MANGLE=m
507
508#
509# IPv6: Netfilter Configuration
510#
511CONFIG_NF_CONNTRACK_IPV6=m
512CONFIG_IP6_NF_QUEUE=m
513CONFIG_IP6_NF_IPTABLES=m
514CONFIG_IP6_NF_MATCH_RT=m
515CONFIG_IP6_NF_MATCH_OPTS=m
516CONFIG_IP6_NF_MATCH_FRAG=m
517CONFIG_IP6_NF_MATCH_HL=m
518CONFIG_IP6_NF_MATCH_IPV6HEADER=m
519CONFIG_IP6_NF_MATCH_AH=m
520CONFIG_IP6_NF_MATCH_MH=m
521CONFIG_IP6_NF_MATCH_EUI64=m
522CONFIG_IP6_NF_FILTER=m
523CONFIG_IP6_NF_TARGET_LOG=m
524CONFIG_IP6_NF_TARGET_REJECT=m
525CONFIG_IP6_NF_MANGLE=m
526CONFIG_IP6_NF_TARGET_HL=m
527CONFIG_IP6_NF_RAW=m
528
529#
530# Bridge: Netfilter Configuration
531#
532CONFIG_BRIDGE_NF_EBTABLES=m
533CONFIG_BRIDGE_EBT_BROUTE=m
534CONFIG_BRIDGE_EBT_T_FILTER=m
535CONFIG_BRIDGE_EBT_T_NAT=m
536CONFIG_BRIDGE_EBT_802_3=m
537CONFIG_BRIDGE_EBT_AMONG=m
538CONFIG_BRIDGE_EBT_ARP=m
539CONFIG_BRIDGE_EBT_IP=m
540CONFIG_BRIDGE_EBT_LIMIT=m
541CONFIG_BRIDGE_EBT_MARK=m
542CONFIG_BRIDGE_EBT_PKTTYPE=m
543CONFIG_BRIDGE_EBT_STP=m
544CONFIG_BRIDGE_EBT_VLAN=m
545CONFIG_BRIDGE_EBT_ARPREPLY=m
546CONFIG_BRIDGE_EBT_DNAT=m
547CONFIG_BRIDGE_EBT_MARK_T=m
548CONFIG_BRIDGE_EBT_REDIRECT=m
549CONFIG_BRIDGE_EBT_SNAT=m
550CONFIG_BRIDGE_EBT_LOG=m
551CONFIG_BRIDGE_EBT_ULOG=m
552CONFIG_IP_DCCP=m
553CONFIG_INET_DCCP_DIAG=m
554CONFIG_IP_DCCP_ACKVEC=y
555
556#
557# DCCP CCIDs Configuration (EXPERIMENTAL)
558#
559CONFIG_IP_DCCP_CCID2=m
560# CONFIG_IP_DCCP_CCID2_DEBUG is not set
561CONFIG_IP_DCCP_CCID3=m
562# CONFIG_IP_DCCP_CCID3_DEBUG is not set
563CONFIG_IP_DCCP_CCID3_RTO=100
564CONFIG_IP_DCCP_TFRC_LIB=m
565CONFIG_IP_SCTP=m
566# CONFIG_SCTP_DBG_MSG is not set
567# CONFIG_SCTP_DBG_OBJCNT is not set
568# CONFIG_SCTP_HMAC_NONE is not set
569# CONFIG_SCTP_HMAC_SHA1 is not set
570CONFIG_SCTP_HMAC_MD5=y
571CONFIG_TIPC=m
572CONFIG_TIPC_ADVANCED=y
573CONFIG_TIPC_ZONES=3
574CONFIG_TIPC_CLUSTERS=1
575CONFIG_TIPC_NODES=255
576CONFIG_TIPC_SLAVE_NODES=0
577CONFIG_TIPC_PORTS=8191
578CONFIG_TIPC_LOG=0
579# CONFIG_TIPC_DEBUG is not set
580CONFIG_ATM=m
581CONFIG_ATM_CLIP=m
582# CONFIG_ATM_CLIP_NO_ICMP is not set
583CONFIG_ATM_LANE=m
584CONFIG_ATM_MPOA=m
585CONFIG_ATM_BR2684=m
586# CONFIG_ATM_BR2684_IPFILTER is not set
587CONFIG_BRIDGE=m
588CONFIG_VLAN_8021Q=m
589# CONFIG_DECNET is not set
590CONFIG_LLC=m
591# CONFIG_LLC2 is not set
592# CONFIG_IPX is not set
593# CONFIG_ATALK is not set
594# CONFIG_X25 is not set
595# CONFIG_LAPB is not set
596# CONFIG_ECONET is not set
597# CONFIG_WAN_ROUTER is not set
598CONFIG_NET_SCHED=y
599
600#
601# Queueing/Scheduling
602#
603CONFIG_NET_SCH_CBQ=m
604CONFIG_NET_SCH_HTB=m
605CONFIG_NET_SCH_HFSC=m
606CONFIG_NET_SCH_ATM=m
607CONFIG_NET_SCH_PRIO=m
608CONFIG_NET_SCH_RR=m
609CONFIG_NET_SCH_RED=m
610CONFIG_NET_SCH_SFQ=m
611CONFIG_NET_SCH_TEQL=m
612CONFIG_NET_SCH_TBF=m
613CONFIG_NET_SCH_GRED=m
614CONFIG_NET_SCH_DSMARK=m
615CONFIG_NET_SCH_NETEM=m
616CONFIG_NET_SCH_INGRESS=m
617
618#
619# Classification
620#
621CONFIG_NET_CLS=y
622CONFIG_NET_CLS_BASIC=m
623CONFIG_NET_CLS_TCINDEX=m
624CONFIG_NET_CLS_ROUTE4=m
625CONFIG_NET_CLS_ROUTE=y
626CONFIG_NET_CLS_FW=m
627CONFIG_NET_CLS_U32=m
628CONFIG_CLS_U32_PERF=y
629CONFIG_CLS_U32_MARK=y
630CONFIG_NET_CLS_RSVP=m
631CONFIG_NET_CLS_RSVP6=m
632# CONFIG_NET_CLS_FLOW is not set
633CONFIG_NET_EMATCH=y
634CONFIG_NET_EMATCH_STACK=32
635CONFIG_NET_EMATCH_CMP=m
636CONFIG_NET_EMATCH_NBYTE=m
637CONFIG_NET_EMATCH_U32=m
638CONFIG_NET_EMATCH_META=m
639CONFIG_NET_EMATCH_TEXT=m
640CONFIG_NET_CLS_ACT=y
641CONFIG_NET_ACT_POLICE=m
642CONFIG_NET_ACT_GACT=m
643CONFIG_GACT_PROB=y
644CONFIG_NET_ACT_MIRRED=m
645CONFIG_NET_ACT_IPT=m
646CONFIG_NET_ACT_NAT=m
647CONFIG_NET_ACT_PEDIT=m
648CONFIG_NET_ACT_SIMP=m
649CONFIG_NET_CLS_IND=y
650CONFIG_NET_SCH_FIFO=y
651
652#
653# Network testing
654#
655CONFIG_NET_PKTGEN=m
656# CONFIG_HAMRADIO is not set
657# CONFIG_CAN is not set
658CONFIG_IRDA=m
659
660#
661# IrDA protocols
662#
663CONFIG_IRLAN=m
664CONFIG_IRNET=m
665CONFIG_IRCOMM=m
666# CONFIG_IRDA_ULTRA is not set
667
668#
669# IrDA options
670#
671CONFIG_IRDA_CACHE_LAST_LSAP=y
672CONFIG_IRDA_FAST_RR=y
673# CONFIG_IRDA_DEBUG is not set
674
675#
676# Infrared-port device drivers
677#
678
679#
680# SIR device drivers
681#
682CONFIG_IRTTY_SIR=m
683
684#
685# Dongle support
686#
687CONFIG_DONGLE=y
688CONFIG_ESI_DONGLE=m
689CONFIG_ACTISYS_DONGLE=m
690CONFIG_TEKRAM_DONGLE=m
691CONFIG_TOIM3232_DONGLE=m
692CONFIG_LITELINK_DONGLE=m
693CONFIG_MA600_DONGLE=m
694CONFIG_GIRBIL_DONGLE=m
695CONFIG_MCP2120_DONGLE=m
696CONFIG_OLD_BELKIN_DONGLE=m
697CONFIG_ACT200L_DONGLE=m
698CONFIG_KINGSUN_DONGLE=m
699CONFIG_KSDAZZLE_DONGLE=m
700CONFIG_KS959_DONGLE=m
701
702#
703# FIR device drivers
704#
705CONFIG_USB_IRDA=m
706CONFIG_SIGMATEL_FIR=m
707CONFIG_TOSHIBA_FIR=m
708CONFIG_VLSI_FIR=m
709CONFIG_MCS_FIR=m
710CONFIG_BT=m
711# CONFIG_BT_L2CAP is not set
712# CONFIG_BT_SCO is not set
713
714#
715# Bluetooth device drivers
716#
717CONFIG_BT_HCIUSB=m
718CONFIG_BT_HCIUSB_SCO=y
719CONFIG_BT_HCIUART=m
720CONFIG_BT_HCIUART_H4=y
721CONFIG_BT_HCIUART_BCSP=y
722CONFIG_BT_HCIUART_LL=y
723CONFIG_BT_HCIBCM203X=m
724CONFIG_BT_HCIBPA10X=m
725CONFIG_BT_HCIBFUSB=m
726CONFIG_BT_HCIVHCI=m
727# CONFIG_AF_RXRPC is not set
728CONFIG_FIB_RULES=y
729
730#
731# Wireless
732#
733CONFIG_CFG80211=m
734CONFIG_NL80211=y
735CONFIG_WIRELESS_EXT=y
736CONFIG_MAC80211=m
737
738#
739# Rate control algorithm selection
740#
741CONFIG_MAC80211_RC_DEFAULT_PID=y
742# CONFIG_MAC80211_RC_DEFAULT_SIMPLE is not set
743# CONFIG_MAC80211_RC_DEFAULT_NONE is not set
744
745#
746# Selecting 'y' for an algorithm will
747#
748
749#
750# build the algorithm into mac80211.
751#
752CONFIG_MAC80211_RC_DEFAULT="pid"
753CONFIG_MAC80211_RC_PID=y
754# CONFIG_MAC80211_RC_SIMPLE is not set
755CONFIG_MAC80211_LEDS=y
756# CONFIG_MAC80211_DEBUGFS is not set
757# CONFIG_MAC80211_DEBUG_PACKET_ALIGNMENT is not set
758# CONFIG_MAC80211_DEBUG is not set
759CONFIG_IEEE80211=m
760# CONFIG_IEEE80211_DEBUG is not set
761CONFIG_IEEE80211_CRYPT_WEP=m
762CONFIG_IEEE80211_CRYPT_CCMP=m
763CONFIG_IEEE80211_CRYPT_TKIP=m
764CONFIG_IEEE80211_SOFTMAC=m
765# CONFIG_IEEE80211_SOFTMAC_DEBUG is not set
766CONFIG_RFKILL=m
767CONFIG_RFKILL_INPUT=m
768CONFIG_RFKILL_LEDS=y
769CONFIG_NET_9P=m
770CONFIG_NET_9P_FD=m
771# CONFIG_NET_9P_DEBUG is not set
772
773#
774# Device Drivers
775#
776
777#
778# Generic Driver Options
779#
780CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
781CONFIG_STANDALONE=y
782CONFIG_PREVENT_FIRMWARE_BUILD=y
783CONFIG_FW_LOADER=m
784# CONFIG_SYS_HYPERVISOR is not set
785CONFIG_CONNECTOR=m
786CONFIG_MTD=y
787# CONFIG_MTD_DEBUG is not set
788CONFIG_MTD_CONCAT=y
789CONFIG_MTD_PARTITIONS=y
790# CONFIG_MTD_REDBOOT_PARTS is not set
791# CONFIG_MTD_CMDLINE_PARTS is not set
792
793#
794# User Modules And Translation Layers
795#
796CONFIG_MTD_CHAR=y
797CONFIG_MTD_BLKDEVS=y
798CONFIG_MTD_BLOCK=y
799# CONFIG_FTL is not set
800# CONFIG_NFTL is not set
801# CONFIG_INFTL is not set
802# CONFIG_RFD_FTL is not set
803# CONFIG_SSFDC is not set
804# CONFIG_MTD_OOPS is not set
805
806#
807# RAM/ROM/Flash chip drivers
808#
809CONFIG_MTD_CFI=y
810# CONFIG_MTD_JEDECPROBE is not set
811CONFIG_MTD_GEN_PROBE=y
812# CONFIG_MTD_CFI_ADV_OPTIONS is not set
813CONFIG_MTD_MAP_BANK_WIDTH_1=y
814CONFIG_MTD_MAP_BANK_WIDTH_2=y
815CONFIG_MTD_MAP_BANK_WIDTH_4=y
816# CONFIG_MTD_MAP_BANK_WIDTH_8 is not set
817# CONFIG_MTD_MAP_BANK_WIDTH_16 is not set
818# CONFIG_MTD_MAP_BANK_WIDTH_32 is not set
819CONFIG_MTD_CFI_I1=y
820CONFIG_MTD_CFI_I2=y
821# CONFIG_MTD_CFI_I4 is not set
822# CONFIG_MTD_CFI_I8 is not set
823CONFIG_MTD_CFI_INTELEXT=y
824CONFIG_MTD_CFI_AMDSTD=y
825CONFIG_MTD_CFI_STAA=y
826CONFIG_MTD_CFI_UTIL=y
827CONFIG_MTD_RAM=y
828CONFIG_MTD_ROM=y
829CONFIG_MTD_ABSENT=y
830
831#
832# Mapping drivers for chip access
833#
834# CONFIG_MTD_COMPLEX_MAPPINGS is not set
835CONFIG_MTD_PHYSMAP=y
836CONFIG_MTD_PHYSMAP_START=0x8000000
837CONFIG_MTD_PHYSMAP_LEN=0x0
838CONFIG_MTD_PHYSMAP_BANKWIDTH=2
839# CONFIG_MTD_INTEL_VR_NOR is not set
840# CONFIG_MTD_PLATRAM is not set
841
842#
843# Self-contained MTD device drivers
844#
845# CONFIG_MTD_PMC551 is not set
846# CONFIG_MTD_SLRAM is not set
847# CONFIG_MTD_PHRAM is not set
848# CONFIG_MTD_MTDRAM is not set
849# CONFIG_MTD_BLOCK2MTD is not set
850
851#
852# Disk-On-Chip Device Drivers
853#
854# CONFIG_MTD_DOC2000 is not set
855# CONFIG_MTD_DOC2001 is not set
856# CONFIG_MTD_DOC2001PLUS is not set
857# CONFIG_MTD_NAND is not set
858# CONFIG_MTD_ONENAND is not set
859
860#
861# UBI - Unsorted block images
862#
863# CONFIG_MTD_UBI is not set
864# CONFIG_PARPORT is not set
865CONFIG_BLK_DEV=y
866# CONFIG_BLK_CPQ_DA is not set
867# CONFIG_BLK_CPQ_CISS_DA is not set
868# CONFIG_BLK_DEV_DAC960 is not set
869# CONFIG_BLK_DEV_UMEM is not set
870# CONFIG_BLK_DEV_COW_COMMON is not set
871CONFIG_BLK_DEV_LOOP=m
872CONFIG_BLK_DEV_CRYPTOLOOP=m
873CONFIG_BLK_DEV_NBD=m
874# CONFIG_BLK_DEV_SX8 is not set
875# CONFIG_BLK_DEV_UB is not set
876CONFIG_BLK_DEV_RAM=y
877CONFIG_BLK_DEV_RAM_COUNT=16
878CONFIG_BLK_DEV_RAM_SIZE=16384
879# CONFIG_BLK_DEV_XIP is not set
880# CONFIG_CDROM_PKTCDVD is not set
881CONFIG_ATA_OVER_ETH=m
882CONFIG_MISC_DEVICES=y
883# CONFIG_PHANTOM is not set
884# CONFIG_EEPROM_93CX6 is not set
885# CONFIG_SGI_IOC4 is not set
886# CONFIG_TIFM_CORE is not set
887# CONFIG_ENCLOSURE_SERVICES is not set
888CONFIG_HAVE_IDE=y
889# CONFIG_IDE is not set
890
891#
892# SCSI device support
893#
894CONFIG_RAID_ATTRS=m
895CONFIG_SCSI=y
896CONFIG_SCSI_DMA=y
897CONFIG_SCSI_TGT=m
898# CONFIG_SCSI_NETLINK is not set
899CONFIG_SCSI_PROC_FS=y
900
901#
902# SCSI support type (disk, tape, CD-ROM)
903#
904CONFIG_BLK_DEV_SD=y
905CONFIG_CHR_DEV_ST=m
906CONFIG_CHR_DEV_OSST=m
907CONFIG_BLK_DEV_SR=m
908CONFIG_BLK_DEV_SR_VENDOR=y
909CONFIG_CHR_DEV_SG=m
910CONFIG_CHR_DEV_SCH=m
911
912#
913# Some SCSI devices (e.g. CD jukebox) support multiple LUNs
914#
915CONFIG_SCSI_MULTI_LUN=y
916CONFIG_SCSI_CONSTANTS=y
917CONFIG_SCSI_LOGGING=y
918CONFIG_SCSI_SCAN_ASYNC=y
919CONFIG_SCSI_WAIT_SCAN=m
920
921#
922# SCSI Transports
923#
924# CONFIG_SCSI_SPI_ATTRS is not set
925# CONFIG_SCSI_FC_ATTRS is not set
926CONFIG_SCSI_ISCSI_ATTRS=m
927# CONFIG_SCSI_SAS_LIBSAS is not set
928# CONFIG_SCSI_SRP_ATTRS is not set
929CONFIG_SCSI_LOWLEVEL=y
930CONFIG_ISCSI_TCP=m
931# CONFIG_BLK_DEV_3W_XXXX_RAID is not set
932# CONFIG_SCSI_3W_9XXX is not set
933# CONFIG_SCSI_ACARD is not set
934# CONFIG_SCSI_AACRAID is not set
935# CONFIG_SCSI_AIC7XXX is not set
936# CONFIG_SCSI_AIC7XXX_OLD is not set
937# CONFIG_SCSI_AIC79XX is not set
938# CONFIG_SCSI_AIC94XX is not set
939# CONFIG_SCSI_DPT_I2O is not set
940# CONFIG_SCSI_ADVANSYS is not set
941# CONFIG_SCSI_ARCMSR is not set
942# CONFIG_MEGARAID_NEWGEN is not set
943# CONFIG_MEGARAID_LEGACY is not set
944# CONFIG_MEGARAID_SAS is not set
945# CONFIG_SCSI_HPTIOP is not set
946# CONFIG_SCSI_DMX3191D is not set
947# CONFIG_SCSI_FUTURE_DOMAIN is not set
948# CONFIG_SCSI_IPS is not set
949# CONFIG_SCSI_INITIO is not set
950# CONFIG_SCSI_INIA100 is not set
951# CONFIG_SCSI_STEX is not set
952# CONFIG_SCSI_SYM53C8XX_2 is not set
953# CONFIG_SCSI_QLOGIC_1280 is not set
954# CONFIG_SCSI_QLA_FC is not set
955# CONFIG_SCSI_QLA_ISCSI is not set
956# CONFIG_SCSI_LPFC is not set
957# CONFIG_SCSI_DC395x is not set
958# CONFIG_SCSI_DC390T is not set
959# CONFIG_SCSI_NSP32 is not set
960# CONFIG_SCSI_DEBUG is not set
961# CONFIG_SCSI_SRP is not set
962# CONFIG_ATA is not set
963# CONFIG_MD is not set
964# CONFIG_FUSION is not set
965
966#
967# IEEE 1394 (FireWire) support
968#
969# CONFIG_FIREWIRE is not set
970# CONFIG_IEEE1394 is not set
971# CONFIG_I2O is not set
972CONFIG_NETDEVICES=y
973# CONFIG_NETDEVICES_MULTIQUEUE is not set
974# CONFIG_IFB is not set
975CONFIG_DUMMY=m
976# CONFIG_BONDING is not set
977# CONFIG_MACVLAN is not set
978CONFIG_EQUALIZER=m
979CONFIG_TUN=m
980CONFIG_VETH=m
981# CONFIG_ARCNET is not set
982CONFIG_PHYLIB=m
983
984#
985# MII PHY device drivers
986#
987CONFIG_MARVELL_PHY=m
988CONFIG_DAVICOM_PHY=m
989CONFIG_QSEMI_PHY=m
990CONFIG_LXT_PHY=m
991CONFIG_CICADA_PHY=m
992CONFIG_VITESSE_PHY=m
993CONFIG_SMSC_PHY=m
994CONFIG_BROADCOM_PHY=m
995CONFIG_ICPLUS_PHY=m
996# CONFIG_REALTEK_PHY is not set
997# CONFIG_FIXED_PHY is not set
998CONFIG_MDIO_BITBANG=m
999CONFIG_NET_ETHERNET=y
1000CONFIG_MII=y
1001# CONFIG_AX88796 is not set
1002# CONFIG_HAPPYMEAL is not set
1003# CONFIG_SUNGEM is not set
1004# CONFIG_CASSINI is not set
1005# CONFIG_NET_VENDOR_3COM is not set
1006# CONFIG_DM9000 is not set
1007# CONFIG_NET_TULIP is not set
1008# CONFIG_HP100 is not set
1009# CONFIG_IBM_NEW_EMAC_ZMII is not set
1010# CONFIG_IBM_NEW_EMAC_RGMII is not set
1011# CONFIG_IBM_NEW_EMAC_TAH is not set
1012# CONFIG_IBM_NEW_EMAC_EMAC4 is not set
1013CONFIG_NET_PCI=y
1014# CONFIG_PCNET32 is not set
1015# CONFIG_AMD8111_ETH is not set
1016# CONFIG_ADAPTEC_STARFIRE is not set
1017CONFIG_B44=y
1018CONFIG_B44_PCI_AUTOSELECT=y
1019CONFIG_B44_PCICORE_AUTOSELECT=y
1020CONFIG_B44_PCI=y
1021# CONFIG_FORCEDETH is not set
1022# CONFIG_TC35815 is not set
1023# CONFIG_EEPRO100 is not set
1024# CONFIG_E100 is not set
1025# CONFIG_FEALNX is not set
1026# CONFIG_NATSEMI is not set
1027# CONFIG_NE2K_PCI is not set
1028# CONFIG_8139CP is not set
1029# CONFIG_8139TOO is not set
1030# CONFIG_R6040 is not set
1031# CONFIG_SIS900 is not set
1032# CONFIG_EPIC100 is not set
1033# CONFIG_SUNDANCE is not set
1034# CONFIG_TLAN is not set
1035# CONFIG_VIA_RHINE is not set
1036# CONFIG_SC92031 is not set
1037# CONFIG_NETDEV_1000 is not set
1038# CONFIG_NETDEV_10000 is not set
1039# CONFIG_TR is not set
1040
1041#
1042# Wireless LAN
1043#
1044# CONFIG_WLAN_PRE80211 is not set
1045CONFIG_WLAN_80211=y
1046# CONFIG_IPW2100 is not set
1047# CONFIG_IPW2200 is not set
1048# CONFIG_LIBERTAS is not set
1049# CONFIG_HERMES is not set
1050# CONFIG_ATMEL is not set
1051# CONFIG_PRISM54 is not set
1052# CONFIG_USB_ZD1201 is not set
1053# CONFIG_USB_NET_RNDIS_WLAN is not set
1054# CONFIG_RTL8180 is not set
1055# CONFIG_RTL8187 is not set
1056# CONFIG_ADM8211 is not set
1057# CONFIG_P54_COMMON is not set
1058CONFIG_ATH5K=m
1059# CONFIG_IWL4965 is not set
1060# CONFIG_IWL3945 is not set
1061# CONFIG_HOSTAP is not set
1062# CONFIG_BCM43XX is not set
1063# CONFIG_B43 is not set
1064# CONFIG_B43LEGACY is not set
1065CONFIG_ZD1211RW=m
1066# CONFIG_ZD1211RW_DEBUG is not set
1067# CONFIG_RT2X00 is not set
1068
1069#
1070# USB Network Adapters
1071#
1072CONFIG_USB_CATC=m
1073CONFIG_USB_KAWETH=m
1074CONFIG_USB_PEGASUS=m
1075CONFIG_USB_RTL8150=m
1076CONFIG_USB_USBNET=m
1077CONFIG_USB_NET_AX8817X=m
1078CONFIG_USB_NET_CDCETHER=m
1079CONFIG_USB_NET_DM9601=m
1080CONFIG_USB_NET_GL620A=m
1081CONFIG_USB_NET_NET1080=m
1082CONFIG_USB_NET_PLUSB=m
1083CONFIG_USB_NET_MCS7830=m
1084CONFIG_USB_NET_RNDIS_HOST=m
1085CONFIG_USB_NET_CDC_SUBSET=m
1086CONFIG_USB_ALI_M5632=y
1087CONFIG_USB_AN2720=y
1088CONFIG_USB_BELKIN=y
1089CONFIG_USB_ARMLINUX=y
1090CONFIG_USB_EPSON2888=y
1091CONFIG_USB_KC2190=y
1092CONFIG_USB_NET_ZAURUS=m
1093# CONFIG_WAN is not set
1094CONFIG_ATM_DRIVERS=y
1095CONFIG_ATM_DUMMY=m
1096CONFIG_ATM_TCP=m
1097# CONFIG_ATM_LANAI is not set
1098# CONFIG_ATM_ENI is not set
1099# CONFIG_ATM_FIRESTREAM is not set
1100# CONFIG_ATM_ZATM is not set
1101# CONFIG_ATM_NICSTAR is not set
1102# CONFIG_ATM_IDT77252 is not set
1103# CONFIG_ATM_AMBASSADOR is not set
1104# CONFIG_ATM_HORIZON is not set
1105# CONFIG_ATM_IA is not set
1106# CONFIG_ATM_FORE200E_MAYBE is not set
1107# CONFIG_ATM_HE is not set
1108# CONFIG_FDDI is not set
1109# CONFIG_HIPPI is not set
1110CONFIG_PPP=m
1111# CONFIG_PPP_MULTILINK is not set
1112# CONFIG_PPP_FILTER is not set
1113CONFIG_PPP_ASYNC=m
1114# CONFIG_PPP_SYNC_TTY is not set
1115CONFIG_PPP_DEFLATE=m
1116CONFIG_PPP_BSDCOMP=m
1117CONFIG_PPP_MPPE=m
1118CONFIG_PPPOE=m
1119CONFIG_PPPOATM=m
1120# CONFIG_PPPOL2TP is not set
1121CONFIG_SLIP=m
1122# CONFIG_SLIP_COMPRESSED is not set
1123CONFIG_SLHC=m
1124# CONFIG_SLIP_SMART is not set
1125# CONFIG_SLIP_MODE_SLIP6 is not set
1126# CONFIG_NET_FC is not set
1127CONFIG_NETCONSOLE=y
1128# CONFIG_NETCONSOLE_DYNAMIC is not set
1129CONFIG_NETPOLL=y
1130# CONFIG_NETPOLL_TRAP is not set
1131CONFIG_NET_POLL_CONTROLLER=y
1132# CONFIG_ISDN is not set
1133# CONFIG_PHONE is not set
1134
1135#
1136# Input device support
1137#
1138CONFIG_INPUT=y
1139# CONFIG_INPUT_FF_MEMLESS is not set
1140# CONFIG_INPUT_POLLDEV is not set
1141
1142#
1143# Userland interfaces
1144#
1145CONFIG_INPUT_MOUSEDEV=y
1146CONFIG_INPUT_MOUSEDEV_PSAUX=y
1147CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
1148CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
1149# CONFIG_INPUT_JOYDEV is not set
1150CONFIG_INPUT_EVDEV=m
1151# CONFIG_INPUT_EVBUG is not set
1152
1153#
1154# Input Device Drivers
1155#
1156# CONFIG_INPUT_KEYBOARD is not set
1157# CONFIG_INPUT_MOUSE is not set
1158# CONFIG_INPUT_JOYSTICK is not set
1159# CONFIG_INPUT_TABLET is not set
1160# CONFIG_INPUT_TOUCHSCREEN is not set
1161# CONFIG_INPUT_MISC is not set
1162
1163#
1164# Hardware I/O ports
1165#
1166# CONFIG_SERIO is not set
1167# CONFIG_GAMEPORT is not set
1168
1169#
1170# Character devices
1171#
1172# CONFIG_VT is not set
1173# CONFIG_SERIAL_NONSTANDARD is not set
1174# CONFIG_NOZOMI is not set
1175
1176#
1177# Serial drivers
1178#
1179CONFIG_SERIAL_8250=y
1180CONFIG_SERIAL_8250_CONSOLE=y
1181# CONFIG_SERIAL_8250_PCI is not set
1182CONFIG_SERIAL_8250_NR_UARTS=2
1183CONFIG_SERIAL_8250_RUNTIME_UARTS=2
1184# CONFIG_SERIAL_8250_EXTENDED is not set
1185
1186#
1187# Non-8250 serial port support
1188#
1189CONFIG_SERIAL_CORE=y
1190CONFIG_SERIAL_CORE_CONSOLE=y
1191# CONFIG_SERIAL_JSM is not set
1192CONFIG_UNIX98_PTYS=y
1193# CONFIG_LEGACY_PTYS is not set
1194# CONFIG_IPMI_HANDLER is not set
1195# CONFIG_HW_RANDOM is not set
1196# CONFIG_RTC is not set
1197# CONFIG_R3964 is not set
1198# CONFIG_APPLICOM is not set
1199# CONFIG_RAW_DRIVER is not set
1200# CONFIG_TCG_TPM is not set
1201CONFIG_DEVPORT=y
1202# CONFIG_I2C is not set
1203
1204#
1205# SPI support
1206#
1207# CONFIG_SPI is not set
1208# CONFIG_SPI_MASTER is not set
1209CONFIG_W1=m
1210CONFIG_W1_CON=y
1211
1212#
1213# 1-wire Bus Masters
1214#
1215CONFIG_W1_MASTER_MATROX=m
1216CONFIG_W1_MASTER_DS2490=m
1217# CONFIG_W1_MASTER_GPIO is not set
1218
1219#
1220# 1-wire Slaves
1221#
1222CONFIG_W1_SLAVE_THERM=m
1223CONFIG_W1_SLAVE_SMEM=m
1224CONFIG_W1_SLAVE_DS2433=m
1225# CONFIG_W1_SLAVE_DS2433_CRC is not set
1226CONFIG_W1_SLAVE_DS2760=m
1227# CONFIG_POWER_SUPPLY is not set
1228# CONFIG_HWMON is not set
1229CONFIG_THERMAL=y
1230# CONFIG_WATCHDOG is not set
1231
1232#
1233# Sonics Silicon Backplane
1234#
1235CONFIG_SSB_POSSIBLE=y
1236CONFIG_SSB=y
1237CONFIG_SSB_PCIHOST_POSSIBLE=y
1238CONFIG_SSB_PCIHOST=y
1239# CONFIG_SSB_SILENT is not set
1240# CONFIG_SSB_DEBUG is not set
1241CONFIG_SSB_SERIAL=y
1242CONFIG_SSB_DRIVER_PCICORE_POSSIBLE=y
1243CONFIG_SSB_DRIVER_PCICORE=y
1244CONFIG_SSB_PCICORE_HOSTMODE=y
1245CONFIG_SSB_DRIVER_MIPS=y
1246CONFIG_SSB_DRIVER_EXTIF=y
1247
1248#
1249# Multifunction device drivers
1250#
1251# CONFIG_MFD_SM501 is not set
1252
1253#
1254# Multimedia devices
1255#
1256# CONFIG_VIDEO_DEV is not set
1257# CONFIG_DVB_CORE is not set
1258CONFIG_DAB=y
1259CONFIG_USB_DABUSB=m
1260
1261#
1262# Graphics support
1263#
1264# CONFIG_DRM is not set
1265# CONFIG_VGASTATE is not set
1266# CONFIG_VIDEO_OUTPUT_CONTROL is not set
1267# CONFIG_FB is not set
1268# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
1269
1270#
1271# Display device support
1272#
1273CONFIG_DISPLAY_SUPPORT=m
1274
1275#
1276# Display hardware drivers
1277#
1278
1279#
1280# Sound
1281#
1282CONFIG_SOUND=m
1283
1284#
1285# Advanced Linux Sound Architecture
1286#
1287CONFIG_SND=m
1288CONFIG_SND_TIMER=m
1289CONFIG_SND_PCM=m
1290CONFIG_SND_HWDEP=m
1291CONFIG_SND_RAWMIDI=m
1292CONFIG_SND_SEQUENCER=m
1293CONFIG_SND_SEQ_DUMMY=m
1294CONFIG_SND_OSSEMUL=y
1295CONFIG_SND_MIXER_OSS=m
1296CONFIG_SND_PCM_OSS=m
1297CONFIG_SND_PCM_OSS_PLUGINS=y
1298CONFIG_SND_SEQUENCER_OSS=y
1299# CONFIG_SND_DYNAMIC_MINORS is not set
1300CONFIG_SND_SUPPORT_OLD_API=y
1301CONFIG_SND_VERBOSE_PROCFS=y
1302# CONFIG_SND_VERBOSE_PRINTK is not set
1303# CONFIG_SND_DEBUG is not set
1304
1305#
1306# Generic devices
1307#
1308CONFIG_SND_DUMMY=m
1309CONFIG_SND_VIRMIDI=m
1310# CONFIG_SND_MTPAV is not set
1311# CONFIG_SND_SERIAL_U16550 is not set
1312# CONFIG_SND_MPU401 is not set
1313
1314#
1315# PCI devices
1316#
1317# CONFIG_SND_AD1889 is not set
1318# CONFIG_SND_ALS300 is not set
1319# CONFIG_SND_ALI5451 is not set
1320# CONFIG_SND_ATIIXP is not set
1321# CONFIG_SND_ATIIXP_MODEM is not set
1322# CONFIG_SND_AU8810 is not set
1323# CONFIG_SND_AU8820 is not set
1324# CONFIG_SND_AU8830 is not set
1325# CONFIG_SND_AZT3328 is not set
1326# CONFIG_SND_BT87X is not set
1327# CONFIG_SND_CA0106 is not set
1328# CONFIG_SND_CMIPCI is not set
1329# CONFIG_SND_OXYGEN is not set
1330# CONFIG_SND_CS4281 is not set
1331# CONFIG_SND_CS46XX is not set
1332# CONFIG_SND_DARLA20 is not set
1333# CONFIG_SND_GINA20 is not set
1334# CONFIG_SND_LAYLA20 is not set
1335# CONFIG_SND_DARLA24 is not set
1336# CONFIG_SND_GINA24 is not set
1337# CONFIG_SND_LAYLA24 is not set
1338# CONFIG_SND_MONA is not set
1339# CONFIG_SND_MIA is not set
1340# CONFIG_SND_ECHO3G is not set
1341# CONFIG_SND_INDIGO is not set
1342# CONFIG_SND_INDIGOIO is not set
1343# CONFIG_SND_INDIGODJ is not set
1344# CONFIG_SND_EMU10K1 is not set
1345# CONFIG_SND_EMU10K1X is not set
1346# CONFIG_SND_ENS1370 is not set
1347# CONFIG_SND_ENS1371 is not set
1348# CONFIG_SND_ES1938 is not set
1349# CONFIG_SND_ES1968 is not set
1350# CONFIG_SND_FM801 is not set
1351# CONFIG_SND_HDA_INTEL is not set
1352# CONFIG_SND_HDSP is not set
1353# CONFIG_SND_HDSPM is not set
1354# CONFIG_SND_HIFIER is not set
1355# CONFIG_SND_ICE1712 is not set
1356# CONFIG_SND_ICE1724 is not set
1357# CONFIG_SND_INTEL8X0 is not set
1358# CONFIG_SND_INTEL8X0M is not set
1359# CONFIG_SND_KORG1212 is not set
1360# CONFIG_SND_MAESTRO3 is not set
1361# CONFIG_SND_MIXART is not set
1362# CONFIG_SND_NM256 is not set
1363# CONFIG_SND_PCXHR is not set
1364# CONFIG_SND_RIPTIDE is not set
1365# CONFIG_SND_RME32 is not set
1366# CONFIG_SND_RME96 is not set
1367# CONFIG_SND_RME9652 is not set
1368# CONFIG_SND_SONICVIBES is not set
1369# CONFIG_SND_TRIDENT is not set
1370# CONFIG_SND_VIA82XX is not set
1371# CONFIG_SND_VIA82XX_MODEM is not set
1372# CONFIG_SND_VIRTUOSO is not set
1373# CONFIG_SND_VX222 is not set
1374# CONFIG_SND_YMFPCI is not set
1375
1376#
1377# ALSA MIPS devices
1378#
1379
1380#
1381# USB devices
1382#
1383CONFIG_SND_USB_AUDIO=m
1384# CONFIG_SND_USB_CAIAQ is not set
1385
1386#
1387# System on Chip audio support
1388#
1389# CONFIG_SND_SOC is not set
1390
1391#
1392# SoC Audio support for SuperH
1393#
1394
1395#
1396# ALSA SoC audio for Freescale SOCs
1397#
1398
1399#
1400# Open Sound System
1401#
1402# CONFIG_SOUND_PRIME is not set
1403CONFIG_HID_SUPPORT=y
1404CONFIG_HID=m
1405# CONFIG_HID_DEBUG is not set
1406# CONFIG_HIDRAW is not set
1407
1408#
1409# USB Input Devices
1410#
1411CONFIG_USB_HID=m
1412# CONFIG_USB_HIDINPUT_POWERBOOK is not set
1413# CONFIG_HID_FF is not set
1414CONFIG_USB_HIDDEV=y
1415
1416#
1417# USB HID Boot Protocol drivers
1418#
1419# CONFIG_USB_KBD is not set
1420# CONFIG_USB_MOUSE is not set
1421CONFIG_USB_SUPPORT=y
1422CONFIG_USB_ARCH_HAS_HCD=y
1423CONFIG_USB_ARCH_HAS_OHCI=y
1424CONFIG_USB_ARCH_HAS_EHCI=y
1425CONFIG_USB=y
1426# CONFIG_USB_DEBUG is not set
1427# CONFIG_USB_ANNOUNCE_NEW_DEVICES is not set
1428
1429#
1430# Miscellaneous USB options
1431#
1432CONFIG_USB_DEVICEFS=y
1433# CONFIG_USB_DEVICE_CLASS is not set
1434# CONFIG_USB_DYNAMIC_MINORS is not set
1435# CONFIG_USB_OTG is not set
1436
1437#
1438# USB Host Controller Drivers
1439#
1440CONFIG_USB_EHCI_HCD=y
1441CONFIG_USB_EHCI_ROOT_HUB_TT=y
1442CONFIG_USB_EHCI_TT_NEWSCHED=y
1443# CONFIG_USB_ISP116X_HCD is not set
1444CONFIG_USB_OHCI_HCD=y
1445# CONFIG_USB_OHCI_HCD_SSB is not set
1446# CONFIG_USB_OHCI_BIG_ENDIAN_DESC is not set
1447# CONFIG_USB_OHCI_BIG_ENDIAN_MMIO is not set
1448CONFIG_USB_OHCI_LITTLE_ENDIAN=y
1449# CONFIG_USB_UHCI_HCD is not set
1450CONFIG_USB_U132_HCD=m
1451# CONFIG_USB_SL811_HCD is not set
1452CONFIG_USB_R8A66597_HCD=m
1453
1454#
1455# USB Device Class drivers
1456#
1457CONFIG_USB_ACM=m
1458CONFIG_USB_PRINTER=m
1459
1460#
1461# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
1462#
1463
1464#
1465# may also be needed; see USB_STORAGE Help for more information
1466#
1467CONFIG_USB_STORAGE=y
1468# CONFIG_USB_STORAGE_DEBUG is not set
1469CONFIG_USB_STORAGE_DATAFAB=y
1470CONFIG_USB_STORAGE_FREECOM=y
1471# CONFIG_USB_STORAGE_ISD200 is not set
1472CONFIG_USB_STORAGE_DPCM=y
1473CONFIG_USB_STORAGE_USBAT=y
1474CONFIG_USB_STORAGE_SDDR09=y
1475CONFIG_USB_STORAGE_SDDR55=y
1476CONFIG_USB_STORAGE_JUMPSHOT=y
1477CONFIG_USB_STORAGE_ALAUDA=y
1478CONFIG_USB_STORAGE_ONETOUCH=y
1479CONFIG_USB_STORAGE_KARMA=y
1480# CONFIG_USB_LIBUSUAL is not set
1481
1482#
1483# USB Imaging devices
1484#
1485CONFIG_USB_MDC800=m
1486CONFIG_USB_MICROTEK=m
1487# CONFIG_USB_MON is not set
1488
1489#
1490# USB port drivers
1491#
1492CONFIG_USB_SERIAL=m
1493CONFIG_USB_EZUSB=y
1494CONFIG_USB_SERIAL_GENERIC=y
1495CONFIG_USB_SERIAL_AIRCABLE=m
1496CONFIG_USB_SERIAL_AIRPRIME=m
1497CONFIG_USB_SERIAL_ARK3116=m
1498CONFIG_USB_SERIAL_BELKIN=m
1499CONFIG_USB_SERIAL_CH341=m
1500# CONFIG_USB_SERIAL_WHITEHEAT is not set
1501CONFIG_USB_SERIAL_DIGI_ACCELEPORT=m
1502CONFIG_USB_SERIAL_CP2101=m
1503CONFIG_USB_SERIAL_CYPRESS_M8=m
1504CONFIG_USB_SERIAL_EMPEG=m
1505CONFIG_USB_SERIAL_FTDI_SIO=m
1506CONFIG_USB_SERIAL_FUNSOFT=m
1507CONFIG_USB_SERIAL_VISOR=m
1508CONFIG_USB_SERIAL_IPAQ=m
1509CONFIG_USB_SERIAL_IR=m
1510# CONFIG_USB_SERIAL_EDGEPORT is not set
1511# CONFIG_USB_SERIAL_EDGEPORT_TI is not set
1512CONFIG_USB_SERIAL_GARMIN=m
1513CONFIG_USB_SERIAL_IPW=m
1514# CONFIG_USB_SERIAL_IUU is not set
1515CONFIG_USB_SERIAL_KEYSPAN_PDA=m
1516# CONFIG_USB_SERIAL_KEYSPAN is not set
1517CONFIG_USB_SERIAL_KLSI=m
1518CONFIG_USB_SERIAL_KOBIL_SCT=m
1519CONFIG_USB_SERIAL_MCT_U232=m
1520CONFIG_USB_SERIAL_MOS7720=m
1521CONFIG_USB_SERIAL_MOS7840=m
1522CONFIG_USB_SERIAL_NAVMAN=m
1523CONFIG_USB_SERIAL_PL2303=m
1524CONFIG_USB_SERIAL_OTI6858=m
1525CONFIG_USB_SERIAL_HP4X=m
1526CONFIG_USB_SERIAL_SAFE=m
1527# CONFIG_USB_SERIAL_SAFE_PADDED is not set
1528CONFIG_USB_SERIAL_SIERRAWIRELESS=m
1529# CONFIG_USB_SERIAL_TI is not set
1530CONFIG_USB_SERIAL_CYBERJACK=m
1531CONFIG_USB_SERIAL_XIRCOM=m
1532CONFIG_USB_SERIAL_OPTION=m
1533CONFIG_USB_SERIAL_OMNINET=m
1534CONFIG_USB_SERIAL_DEBUG=m
1535
1536#
1537# USB Miscellaneous drivers
1538#
1539# CONFIG_USB_EMI62 is not set
1540# CONFIG_USB_EMI26 is not set
1541CONFIG_USB_ADUTUX=m
1542CONFIG_USB_AUERSWALD=m
1543CONFIG_USB_RIO500=m
1544CONFIG_USB_LEGOTOWER=m
1545CONFIG_USB_LCD=m
1546CONFIG_USB_BERRY_CHARGE=m
1547CONFIG_USB_LED=m
1548CONFIG_USB_CYPRESS_CY7C63=m
1549CONFIG_USB_CYTHERM=m
1550CONFIG_USB_PHIDGET=m
1551CONFIG_USB_PHIDGETKIT=m
1552CONFIG_USB_PHIDGETMOTORCONTROL=m
1553CONFIG_USB_PHIDGETSERVO=m
1554CONFIG_USB_IDMOUSE=m
1555CONFIG_USB_FTDI_ELAN=m
1556# CONFIG_USB_APPLEDISPLAY is not set
1557CONFIG_USB_SISUSBVGA=m
1558CONFIG_USB_LD=m
1559CONFIG_USB_TRANCEVIBRATOR=m
1560CONFIG_USB_IOWARRIOR=m
1561CONFIG_USB_TEST=m
1562CONFIG_USB_ATM=m
1563CONFIG_USB_SPEEDTOUCH=m
1564CONFIG_USB_CXACRU=m
1565CONFIG_USB_UEAGLEATM=m
1566CONFIG_USB_XUSBATM=m
1567CONFIG_USB_GADGET=m
1568# CONFIG_USB_GADGET_DEBUG_FILES is not set
1569# CONFIG_USB_GADGET_DEBUG_FS is not set
1570CONFIG_USB_GADGET_SELECTED=y
1571# CONFIG_USB_GADGET_AMD5536UDC is not set
1572# CONFIG_USB_GADGET_ATMEL_USBA is not set
1573# CONFIG_USB_GADGET_FSL_USB2 is not set
1574CONFIG_USB_GADGET_NET2280=y
1575CONFIG_USB_NET2280=m
1576# CONFIG_USB_GADGET_PXA2XX is not set
1577# CONFIG_USB_GADGET_M66592 is not set
1578# CONFIG_USB_GADGET_GOKU is not set
1579# CONFIG_USB_GADGET_LH7A40X is not set
1580# CONFIG_USB_GADGET_OMAP is not set
1581# CONFIG_USB_GADGET_S3C2410 is not set
1582# CONFIG_USB_GADGET_AT91 is not set
1583# CONFIG_USB_GADGET_DUMMY_HCD is not set
1584CONFIG_USB_GADGET_DUALSPEED=y
1585CONFIG_USB_ZERO=m
1586CONFIG_USB_ETH=m
1587CONFIG_USB_ETH_RNDIS=y
1588CONFIG_USB_GADGETFS=m
1589CONFIG_USB_FILE_STORAGE=m
1590# CONFIG_USB_FILE_STORAGE_TEST is not set
1591CONFIG_USB_G_SERIAL=m
1592CONFIG_USB_MIDI_GADGET=m
1593# CONFIG_USB_G_PRINTER is not set
1594# CONFIG_MMC is not set
1595# CONFIG_MEMSTICK is not set
1596CONFIG_NEW_LEDS=y
1597CONFIG_LEDS_CLASS=y
1598
1599#
1600# LED drivers
1601#
1602CONFIG_LEDS_GPIO=y
1603
1604#
1605# LED Triggers
1606#
1607CONFIG_LEDS_TRIGGERS=y
1608CONFIG_LEDS_TRIGGER_TIMER=y
1609CONFIG_LEDS_TRIGGER_HEARTBEAT=y
1610# CONFIG_INFINIBAND is not set
1611CONFIG_RTC_LIB=y
1612# CONFIG_RTC_CLASS is not set
1613
1614#
1615# Userspace I/O
1616#
1617# CONFIG_UIO is not set
1618
1619#
1620# File systems
1621#
1622CONFIG_EXT2_FS=y
1623CONFIG_EXT2_FS_XATTR=y
1624CONFIG_EXT2_FS_POSIX_ACL=y
1625CONFIG_EXT2_FS_SECURITY=y
1626# CONFIG_EXT2_FS_XIP is not set
1627CONFIG_EXT3_FS=y
1628CONFIG_EXT3_FS_XATTR=y
1629CONFIG_EXT3_FS_POSIX_ACL=y
1630CONFIG_EXT3_FS_SECURITY=y
1631# CONFIG_EXT4DEV_FS is not set
1632CONFIG_JBD=y
1633# CONFIG_JBD_DEBUG is not set
1634CONFIG_FS_MBCACHE=y
1635CONFIG_REISERFS_FS=m
1636# CONFIG_REISERFS_CHECK is not set
1637# CONFIG_REISERFS_PROC_INFO is not set
1638CONFIG_REISERFS_FS_XATTR=y
1639CONFIG_REISERFS_FS_POSIX_ACL=y
1640CONFIG_REISERFS_FS_SECURITY=y
1641CONFIG_JFS_FS=m
1642CONFIG_JFS_POSIX_ACL=y
1643CONFIG_JFS_SECURITY=y
1644# CONFIG_JFS_DEBUG is not set
1645# CONFIG_JFS_STATISTICS is not set
1646CONFIG_FS_POSIX_ACL=y
1647CONFIG_XFS_FS=m
1648CONFIG_XFS_QUOTA=y
1649CONFIG_XFS_SECURITY=y
1650CONFIG_XFS_POSIX_ACL=y
1651CONFIG_XFS_RT=y
1652CONFIG_GFS2_FS=m
1653CONFIG_GFS2_FS_LOCKING_NOLOCK=m
1654CONFIG_GFS2_FS_LOCKING_DLM=m
1655# CONFIG_OCFS2_FS is not set
1656CONFIG_DNOTIFY=y
1657CONFIG_INOTIFY=y
1658CONFIG_INOTIFY_USER=y
1659CONFIG_QUOTA=y
1660CONFIG_QUOTA_NETLINK_INTERFACE=y
1661CONFIG_PRINT_QUOTA_WARNING=y
1662CONFIG_QFMT_V1=m
1663CONFIG_QFMT_V2=m
1664CONFIG_QUOTACTL=y
1665CONFIG_AUTOFS_FS=m
1666CONFIG_AUTOFS4_FS=m
1667CONFIG_FUSE_FS=m
1668CONFIG_GENERIC_ACL=y
1669
1670#
1671# CD-ROM/DVD Filesystems
1672#
1673CONFIG_ISO9660_FS=m
1674CONFIG_JOLIET=y
1675CONFIG_ZISOFS=y
1676CONFIG_UDF_FS=m
1677CONFIG_UDF_NLS=y
1678
1679#
1680# DOS/FAT/NT Filesystems
1681#
1682CONFIG_FAT_FS=m
1683CONFIG_MSDOS_FS=m
1684CONFIG_VFAT_FS=m
1685CONFIG_FAT_DEFAULT_CODEPAGE=437
1686CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1"
1687CONFIG_NTFS_FS=m
1688# CONFIG_NTFS_DEBUG is not set
1689CONFIG_NTFS_RW=y
1690
1691#
1692# Pseudo filesystems
1693#
1694CONFIG_PROC_FS=y
1695CONFIG_PROC_KCORE=y
1696CONFIG_PROC_SYSCTL=y
1697CONFIG_SYSFS=y
1698CONFIG_TMPFS=y
1699CONFIG_TMPFS_POSIX_ACL=y
1700# CONFIG_HUGETLB_PAGE is not set
1701CONFIG_CONFIGFS_FS=m
1702
1703#
1704# Miscellaneous filesystems
1705#
1706CONFIG_ADFS_FS=m
1707# CONFIG_ADFS_FS_RW is not set
1708CONFIG_AFFS_FS=m
1709CONFIG_HFS_FS=m
1710CONFIG_HFSPLUS_FS=m
1711CONFIG_BEFS_FS=m
1712# CONFIG_BEFS_DEBUG is not set
1713CONFIG_BFS_FS=m
1714CONFIG_EFS_FS=m
1715CONFIG_JFFS2_FS=m
1716CONFIG_JFFS2_FS_DEBUG=0
1717CONFIG_JFFS2_FS_WRITEBUFFER=y
1718# CONFIG_JFFS2_FS_WBUF_VERIFY is not set
1719# CONFIG_JFFS2_SUMMARY is not set
1720CONFIG_JFFS2_FS_XATTR=y
1721CONFIG_JFFS2_FS_POSIX_ACL=y
1722CONFIG_JFFS2_FS_SECURITY=y
1723# CONFIG_JFFS2_COMPRESSION_OPTIONS is not set
1724CONFIG_JFFS2_ZLIB=y
1725# CONFIG_JFFS2_LZO is not set
1726CONFIG_JFFS2_RTIME=y
1727# CONFIG_JFFS2_RUBIN is not set
1728CONFIG_CRAMFS=m
1729CONFIG_VXFS_FS=m
1730CONFIG_MINIX_FS=m
1731CONFIG_HPFS_FS=m
1732CONFIG_QNX4FS_FS=m
1733CONFIG_ROMFS_FS=m
1734CONFIG_SYSV_FS=m
1735CONFIG_UFS_FS=m
1736# CONFIG_UFS_FS_WRITE is not set
1737# CONFIG_UFS_DEBUG is not set
1738CONFIG_NETWORK_FILESYSTEMS=y
1739CONFIG_NFS_FS=m
1740CONFIG_NFS_V3=y
1741CONFIG_NFS_V3_ACL=y
1742CONFIG_NFS_V4=y
1743# CONFIG_NFS_DIRECTIO is not set
1744CONFIG_NFSD=m
1745CONFIG_NFSD_V2_ACL=y
1746CONFIG_NFSD_V3=y
1747CONFIG_NFSD_V3_ACL=y
1748CONFIG_NFSD_V4=y
1749CONFIG_NFSD_TCP=y
1750CONFIG_LOCKD=m
1751CONFIG_LOCKD_V4=y
1752CONFIG_EXPORTFS=m
1753CONFIG_NFS_ACL_SUPPORT=m
1754CONFIG_NFS_COMMON=y
1755CONFIG_SUNRPC=m
1756CONFIG_SUNRPC_GSS=m
1757CONFIG_SUNRPC_BIND34=y
1758CONFIG_RPCSEC_GSS_KRB5=m
1759CONFIG_RPCSEC_GSS_SPKM3=m
1760# CONFIG_SMB_FS is not set
1761CONFIG_CIFS=m
1762# CONFIG_CIFS_STATS is not set
1763# CONFIG_CIFS_WEAK_PW_HASH is not set
1764CONFIG_CIFS_XATTR=y
1765CONFIG_CIFS_POSIX=y
1766# CONFIG_CIFS_DEBUG2 is not set
1767# CONFIG_CIFS_EXPERIMENTAL is not set
1768CONFIG_NCP_FS=m
1769# CONFIG_NCPFS_PACKET_SIGNING is not set
1770# CONFIG_NCPFS_IOCTL_LOCKING is not set
1771# CONFIG_NCPFS_STRONG is not set
1772CONFIG_NCPFS_NFS_NS=y
1773CONFIG_NCPFS_OS2_NS=y
1774# CONFIG_NCPFS_SMALLDOS is not set
1775CONFIG_NCPFS_NLS=y
1776CONFIG_NCPFS_EXTRAS=y
1777CONFIG_CODA_FS=m
1778# CONFIG_CODA_FS_OLD_API is not set
1779# CONFIG_AFS_FS is not set
1780CONFIG_9P_FS=m
1781
1782#
1783# Partition Types
1784#
1785CONFIG_PARTITION_ADVANCED=y
1786# CONFIG_ACORN_PARTITION is not set
1787# CONFIG_OSF_PARTITION is not set
1788# CONFIG_AMIGA_PARTITION is not set
1789# CONFIG_ATARI_PARTITION is not set
1790# CONFIG_MAC_PARTITION is not set
1791CONFIG_MSDOS_PARTITION=y
1792# CONFIG_BSD_DISKLABEL is not set
1793# CONFIG_MINIX_SUBPARTITION is not set
1794# CONFIG_SOLARIS_X86_PARTITION is not set
1795# CONFIG_UNIXWARE_DISKLABEL is not set
1796# CONFIG_LDM_PARTITION is not set
1797# CONFIG_SGI_PARTITION is not set
1798# CONFIG_ULTRIX_PARTITION is not set
1799# CONFIG_SUN_PARTITION is not set
1800CONFIG_KARMA_PARTITION=y
1801# CONFIG_EFI_PARTITION is not set
1802# CONFIG_SYSV68_PARTITION is not set
1803CONFIG_NLS=y
1804CONFIG_NLS_DEFAULT="iso8859-1"
1805CONFIG_NLS_CODEPAGE_437=m
1806CONFIG_NLS_CODEPAGE_737=m
1807CONFIG_NLS_CODEPAGE_775=m
1808CONFIG_NLS_CODEPAGE_850=m
1809CONFIG_NLS_CODEPAGE_852=m
1810CONFIG_NLS_CODEPAGE_855=m
1811CONFIG_NLS_CODEPAGE_857=m
1812CONFIG_NLS_CODEPAGE_860=m
1813CONFIG_NLS_CODEPAGE_861=m
1814CONFIG_NLS_CODEPAGE_862=m
1815CONFIG_NLS_CODEPAGE_863=m
1816CONFIG_NLS_CODEPAGE_864=m
1817CONFIG_NLS_CODEPAGE_865=m
1818CONFIG_NLS_CODEPAGE_866=m
1819CONFIG_NLS_CODEPAGE_869=m
1820CONFIG_NLS_CODEPAGE_936=m
1821CONFIG_NLS_CODEPAGE_950=m
1822CONFIG_NLS_CODEPAGE_932=m
1823CONFIG_NLS_CODEPAGE_949=m
1824CONFIG_NLS_CODEPAGE_874=m
1825CONFIG_NLS_ISO8859_8=m
1826CONFIG_NLS_CODEPAGE_1250=m
1827CONFIG_NLS_CODEPAGE_1251=m
1828CONFIG_NLS_ASCII=m
1829CONFIG_NLS_ISO8859_1=m
1830CONFIG_NLS_ISO8859_2=m
1831CONFIG_NLS_ISO8859_3=m
1832CONFIG_NLS_ISO8859_4=m
1833CONFIG_NLS_ISO8859_5=m
1834CONFIG_NLS_ISO8859_6=m
1835CONFIG_NLS_ISO8859_7=m
1836CONFIG_NLS_ISO8859_9=m
1837CONFIG_NLS_ISO8859_13=m
1838CONFIG_NLS_ISO8859_14=m
1839CONFIG_NLS_ISO8859_15=m
1840CONFIG_NLS_KOI8_R=m
1841CONFIG_NLS_KOI8_U=m
1842CONFIG_NLS_UTF8=m
1843CONFIG_DLM=m
1844CONFIG_DLM_DEBUG=y
1845
1846#
1847# Kernel hacking
1848#
1849CONFIG_TRACE_IRQFLAGS_SUPPORT=y
1850# CONFIG_PRINTK_TIME is not set
1851CONFIG_ENABLE_WARN_DEPRECATED=y
1852CONFIG_ENABLE_MUST_CHECK=y
1853# CONFIG_MAGIC_SYSRQ is not set
1854# CONFIG_UNUSED_SYMBOLS is not set
1855CONFIG_DEBUG_FS=y
1856# CONFIG_HEADERS_CHECK is not set
1857# CONFIG_DEBUG_KERNEL is not set
1858# CONFIG_SAMPLES is not set
1859CONFIG_CMDLINE=""
1860
1861#
1862# Security options
1863#
1864# CONFIG_KEYS is not set
1865# CONFIG_SECURITY is not set
1866# CONFIG_SECURITY_FILE_CAPABILITIES is not set
1867CONFIG_CRYPTO=y
1868CONFIG_CRYPTO_ALGAPI=y
1869CONFIG_CRYPTO_AEAD=m
1870CONFIG_CRYPTO_BLKCIPHER=m
1871# CONFIG_CRYPTO_SEQIV is not set
1872CONFIG_CRYPTO_HASH=y
1873CONFIG_CRYPTO_MANAGER=y
1874CONFIG_CRYPTO_HMAC=y
1875CONFIG_CRYPTO_XCBC=m
1876CONFIG_CRYPTO_NULL=m
1877CONFIG_CRYPTO_MD4=m
1878CONFIG_CRYPTO_MD5=y
1879CONFIG_CRYPTO_SHA1=m
1880CONFIG_CRYPTO_SHA256=m
1881CONFIG_CRYPTO_SHA512=m
1882CONFIG_CRYPTO_WP512=m
1883CONFIG_CRYPTO_TGR192=m
1884CONFIG_CRYPTO_GF128MUL=m
1885CONFIG_CRYPTO_ECB=m
1886CONFIG_CRYPTO_CBC=m
1887CONFIG_CRYPTO_PCBC=m
1888CONFIG_CRYPTO_LRW=m
1889CONFIG_CRYPTO_XTS=m
1890# CONFIG_CRYPTO_CTR is not set
1891# CONFIG_CRYPTO_GCM is not set
1892# CONFIG_CRYPTO_CCM is not set
1893# CONFIG_CRYPTO_CRYPTD is not set
1894CONFIG_CRYPTO_DES=m
1895CONFIG_CRYPTO_FCRYPT=m
1896CONFIG_CRYPTO_BLOWFISH=m
1897CONFIG_CRYPTO_TWOFISH=m
1898CONFIG_CRYPTO_TWOFISH_COMMON=m
1899CONFIG_CRYPTO_SERPENT=m
1900CONFIG_CRYPTO_AES=m
1901CONFIG_CRYPTO_CAST5=m
1902CONFIG_CRYPTO_CAST6=m
1903CONFIG_CRYPTO_TEA=m
1904CONFIG_CRYPTO_ARC4=m
1905CONFIG_CRYPTO_KHAZAD=m
1906CONFIG_CRYPTO_ANUBIS=m
1907CONFIG_CRYPTO_SEED=m
1908# CONFIG_CRYPTO_SALSA20 is not set
1909CONFIG_CRYPTO_DEFLATE=m
1910CONFIG_CRYPTO_MICHAEL_MIC=m
1911CONFIG_CRYPTO_CRC32C=m
1912CONFIG_CRYPTO_CAMELLIA=m
1913CONFIG_CRYPTO_TEST=m
1914CONFIG_CRYPTO_AUTHENC=m
1915# CONFIG_CRYPTO_LZO is not set
1916CONFIG_CRYPTO_HW=y
1917# CONFIG_CRYPTO_DEV_HIFN_795X is not set
1918
1919#
1920# Library routines
1921#
1922CONFIG_BITREVERSE=y
1923CONFIG_CRC_CCITT=m
1924CONFIG_CRC16=m
1925CONFIG_CRC_ITU_T=m
1926CONFIG_CRC32=y
1927CONFIG_CRC7=m
1928CONFIG_LIBCRC32C=m
1929CONFIG_AUDIT_GENERIC=y
1930CONFIG_ZLIB_INFLATE=m
1931CONFIG_ZLIB_DEFLATE=m
1932CONFIG_TEXTSEARCH=y
1933CONFIG_TEXTSEARCH_KMP=m
1934CONFIG_TEXTSEARCH_BM=m
1935CONFIG_TEXTSEARCH_FSM=m
1936CONFIG_PLIST=y
1937CONFIG_HAS_IOMEM=y
1938CONFIG_HAS_IOPORT=y
1939CONFIG_HAS_DMA=y
diff --git a/arch/mips/configs/ip28_defconfig b/arch/mips/configs/ip28_defconfig
new file mode 100644
index 000000000000..ec188be9a67a
--- /dev/null
+++ b/arch/mips/configs/ip28_defconfig
@@ -0,0 +1,891 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.25-rc1
4# Mon Feb 11 15:58:54 2008
5#
6CONFIG_MIPS=y
7
8#
9# Machine selection
10#
11# CONFIG_MACH_ALCHEMY is not set
12# CONFIG_BASLER_EXCITE is not set
13# CONFIG_BCM47XX is not set
14# CONFIG_MIPS_COBALT is not set
15# CONFIG_MACH_DECSTATION is not set
16# CONFIG_MACH_JAZZ is not set
17# CONFIG_LASAT is not set
18# CONFIG_LEMOTE_FULONG is not set
19# CONFIG_MIPS_ATLAS is not set
20# CONFIG_MIPS_MALTA is not set
21# CONFIG_MIPS_SEAD is not set
22# CONFIG_MIPS_SIM is not set
23# CONFIG_MARKEINS is not set
24# CONFIG_MACH_VR41XX is not set
25# CONFIG_PNX8550_JBS is not set
26# CONFIG_PNX8550_STB810 is not set
27# CONFIG_PMC_MSP is not set
28# CONFIG_PMC_YOSEMITE is not set
29# CONFIG_SGI_IP22 is not set
30# CONFIG_SGI_IP27 is not set
31CONFIG_SGI_IP28=y
32# CONFIG_SGI_IP32 is not set
33# CONFIG_SIBYTE_CRHINE is not set
34# CONFIG_SIBYTE_CARMEL is not set
35# CONFIG_SIBYTE_CRHONE is not set
36# CONFIG_SIBYTE_RHONE is not set
37# CONFIG_SIBYTE_SWARM is not set
38# CONFIG_SIBYTE_LITTLESUR is not set
39# CONFIG_SIBYTE_SENTOSA is not set
40# CONFIG_SIBYTE_BIGSUR is not set
41# CONFIG_SNI_RM is not set
42# CONFIG_TOSHIBA_JMR3927 is not set
43# CONFIG_TOSHIBA_RBTX4927 is not set
44# CONFIG_TOSHIBA_RBTX4938 is not set
45# CONFIG_WR_PPMC is not set
46CONFIG_RWSEM_GENERIC_SPINLOCK=y
47# CONFIG_ARCH_HAS_ILOG2_U32 is not set
48# CONFIG_ARCH_HAS_ILOG2_U64 is not set
49CONFIG_ARCH_SUPPORTS_OPROFILE=y
50CONFIG_GENERIC_FIND_NEXT_BIT=y
51CONFIG_GENERIC_HWEIGHT=y
52CONFIG_GENERIC_CALIBRATE_DELAY=y
53CONFIG_GENERIC_CLOCKEVENTS=y
54CONFIG_GENERIC_TIME=y
55CONFIG_GENERIC_CMOS_UPDATE=y
56CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER=y
57# CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ is not set
58CONFIG_ARC=y
59CONFIG_CEVT_R4K=y
60CONFIG_CSRC_R4K=y
61CONFIG_DMA_NONCOHERENT=y
62CONFIG_DMA_NEED_PCI_MAP_STATE=y
63CONFIG_EARLY_PRINTK=y
64CONFIG_SYS_HAS_EARLY_PRINTK=y
65# CONFIG_HOTPLUG_CPU is not set
66CONFIG_I8259=y
67# CONFIG_NO_IOPORT is not set
68CONFIG_GENERIC_ISA_DMA=y
69CONFIG_GENERIC_ISA_DMA_SUPPORT_BROKEN=y
70CONFIG_CPU_BIG_ENDIAN=y
71# CONFIG_CPU_LITTLE_ENDIAN is not set
72CONFIG_SYS_SUPPORTS_BIG_ENDIAN=y
73CONFIG_IRQ_CPU=y
74CONFIG_SWAP_IO_SPACE=y
75CONFIG_SGI_HAS_DS1286=y
76CONFIG_SGI_HAS_INDYDOG=y
77CONFIG_SGI_HAS_SEEQ=y
78CONFIG_SGI_HAS_WD93=y
79CONFIG_SGI_HAS_ZILOG=y
80CONFIG_SGI_HAS_I8042=y
81CONFIG_DEFAULT_SGI_PARTITION=y
82CONFIG_MIPS_L1_CACHE_SHIFT=7
83CONFIG_ARC_CONSOLE=y
84CONFIG_ARC_PROMLIB=y
85CONFIG_ARC64=y
86CONFIG_BOOT_ELF64=y
87
88#
89# CPU selection
90#
91# CONFIG_CPU_LOONGSON2 is not set
92# CONFIG_CPU_MIPS32_R1 is not set
93# CONFIG_CPU_MIPS32_R2 is not set
94# CONFIG_CPU_MIPS64_R1 is not set
95# CONFIG_CPU_MIPS64_R2 is not set
96# CONFIG_CPU_R3000 is not set
97# CONFIG_CPU_TX39XX is not set
98# CONFIG_CPU_VR41XX is not set
99# CONFIG_CPU_R4300 is not set
100# CONFIG_CPU_R4X00 is not set
101# CONFIG_CPU_TX49XX is not set
102# CONFIG_CPU_R5000 is not set
103# CONFIG_CPU_R5432 is not set
104# CONFIG_CPU_R6000 is not set
105# CONFIG_CPU_NEVADA is not set
106# CONFIG_CPU_R8000 is not set
107CONFIG_CPU_R10000=y
108# CONFIG_CPU_RM7000 is not set
109# CONFIG_CPU_RM9000 is not set
110# CONFIG_CPU_SB1 is not set
111CONFIG_SYS_HAS_CPU_R10000=y
112CONFIG_SYS_SUPPORTS_64BIT_KERNEL=y
113CONFIG_CPU_SUPPORTS_32BIT_KERNEL=y
114CONFIG_CPU_SUPPORTS_64BIT_KERNEL=y
115
116#
117# Kernel type
118#
119# CONFIG_32BIT is not set
120CONFIG_64BIT=y
121CONFIG_PAGE_SIZE_4KB=y
122# CONFIG_PAGE_SIZE_8KB is not set
123# CONFIG_PAGE_SIZE_16KB is not set
124# CONFIG_PAGE_SIZE_64KB is not set
125CONFIG_CPU_HAS_PREFETCH=y
126CONFIG_MIPS_MT_DISABLED=y
127# CONFIG_MIPS_MT_SMP is not set
128# CONFIG_MIPS_MT_SMTC is not set
129CONFIG_CPU_HAS_LLSC=y
130CONFIG_CPU_HAS_SYNC=y
131CONFIG_GENERIC_HARDIRQS=y
132CONFIG_GENERIC_IRQ_PROBE=y
133CONFIG_CPU_SUPPORTS_HIGHMEM=y
134CONFIG_ARCH_FLATMEM_ENABLE=y
135CONFIG_ARCH_POPULATES_NODE_MAP=y
136CONFIG_SELECT_MEMORY_MODEL=y
137CONFIG_FLATMEM_MANUAL=y
138# CONFIG_DISCONTIGMEM_MANUAL is not set
139# CONFIG_SPARSEMEM_MANUAL is not set
140CONFIG_FLATMEM=y
141CONFIG_FLAT_NODE_MEM_MAP=y
142# CONFIG_SPARSEMEM_STATIC is not set
143# CONFIG_SPARSEMEM_VMEMMAP_ENABLE is not set
144CONFIG_SPLIT_PTLOCK_CPUS=4
145CONFIG_RESOURCES_64BIT=y
146CONFIG_ZONE_DMA_FLAG=0
147CONFIG_VIRT_TO_BUS=y
148# CONFIG_TICK_ONESHOT is not set
149# CONFIG_NO_HZ is not set
150# CONFIG_HIGH_RES_TIMERS is not set
151CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
152# CONFIG_HZ_48 is not set
153# CONFIG_HZ_100 is not set
154# CONFIG_HZ_128 is not set
155CONFIG_HZ_250=y
156# CONFIG_HZ_256 is not set
157# CONFIG_HZ_1000 is not set
158# CONFIG_HZ_1024 is not set
159CONFIG_SYS_SUPPORTS_ARBIT_HZ=y
160CONFIG_HZ=250
161# CONFIG_PREEMPT_NONE is not set
162CONFIG_PREEMPT_VOLUNTARY=y
163# CONFIG_PREEMPT is not set
164# CONFIG_RCU_TRACE is not set
165# CONFIG_MIPS_INSANE_LARGE is not set
166# CONFIG_KEXEC is not set
167CONFIG_SECCOMP=y
168CONFIG_LOCKDEP_SUPPORT=y
169CONFIG_STACKTRACE_SUPPORT=y
170CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
171
172#
173# General setup
174#
175CONFIG_EXPERIMENTAL=y
176CONFIG_BROKEN_ON_SMP=y
177CONFIG_INIT_ENV_ARG_LIMIT=32
178CONFIG_LOCALVERSION=""
179CONFIG_LOCALVERSION_AUTO=y
180CONFIG_SWAP=y
181CONFIG_SYSVIPC=y
182CONFIG_SYSVIPC_SYSCTL=y
183# CONFIG_POSIX_MQUEUE is not set
184# CONFIG_BSD_PROCESS_ACCT is not set
185# CONFIG_TASKSTATS is not set
186# CONFIG_AUDIT is not set
187CONFIG_IKCONFIG=y
188CONFIG_IKCONFIG_PROC=y
189CONFIG_LOG_BUF_SHIFT=14
190# CONFIG_CGROUPS is not set
191CONFIG_FAIR_GROUP_SCHED=y
192CONFIG_FAIR_USER_SCHED=y
193# CONFIG_FAIR_CGROUP_SCHED is not set
194CONFIG_SYSFS_DEPRECATED=y
195CONFIG_RELAY=y
196# CONFIG_NAMESPACES is not set
197# CONFIG_BLK_DEV_INITRD is not set
198# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
199CONFIG_SYSCTL=y
200CONFIG_EMBEDDED=y
201CONFIG_SYSCTL_SYSCALL=y
202CONFIG_KALLSYMS=y
203# CONFIG_KALLSYMS_EXTRA_PASS is not set
204# CONFIG_HOTPLUG is not set
205CONFIG_PRINTK=y
206CONFIG_BUG=y
207CONFIG_ELF_CORE=y
208CONFIG_COMPAT_BRK=y
209CONFIG_BASE_FULL=y
210CONFIG_FUTEX=y
211CONFIG_ANON_INODES=y
212CONFIG_EPOLL=y
213CONFIG_SIGNALFD=y
214CONFIG_TIMERFD=y
215CONFIG_EVENTFD=y
216CONFIG_SHMEM=y
217CONFIG_VM_EVENT_COUNTERS=y
218CONFIG_SLAB=y
219# CONFIG_SLUB is not set
220# CONFIG_SLOB is not set
221# CONFIG_PROFILING is not set
222# CONFIG_MARKERS is not set
223CONFIG_HAVE_OPROFILE=y
224# CONFIG_HAVE_KPROBES is not set
225# CONFIG_PROC_PAGE_MONITOR is not set
226CONFIG_SLABINFO=y
227CONFIG_RT_MUTEXES=y
228# CONFIG_TINY_SHMEM is not set
229CONFIG_BASE_SMALL=0
230CONFIG_MODULES=y
231CONFIG_MODULE_UNLOAD=y
232# CONFIG_MODULE_FORCE_UNLOAD is not set
233CONFIG_MODVERSIONS=y
234CONFIG_MODULE_SRCVERSION_ALL=y
235CONFIG_KMOD=y
236CONFIG_BLOCK=y
237# CONFIG_BLK_DEV_IO_TRACE is not set
238# CONFIG_BLK_DEV_BSG is not set
239CONFIG_BLOCK_COMPAT=y
240
241#
242# IO Schedulers
243#
244CONFIG_IOSCHED_NOOP=y
245CONFIG_IOSCHED_AS=y
246CONFIG_IOSCHED_DEADLINE=y
247CONFIG_IOSCHED_CFQ=y
248CONFIG_DEFAULT_AS=y
249# CONFIG_DEFAULT_DEADLINE is not set
250# CONFIG_DEFAULT_CFQ is not set
251# CONFIG_DEFAULT_NOOP is not set
252CONFIG_DEFAULT_IOSCHED="anticipatory"
253CONFIG_CLASSIC_RCU=y
254# CONFIG_PREEMPT_RCU is not set
255
256#
257# Bus options (PCI, PCMCIA, EISA, ISA, TC)
258#
259CONFIG_HW_HAS_EISA=y
260# CONFIG_ARCH_SUPPORTS_MSI is not set
261CONFIG_ISA=y
262CONFIG_EISA=y
263CONFIG_EISA_NAMES=y
264CONFIG_MMU=y
265CONFIG_I8253=y
266
267#
268# Executable file formats
269#
270CONFIG_BINFMT_ELF=y
271# CONFIG_BINFMT_MISC is not set
272CONFIG_MIPS32_COMPAT=y
273CONFIG_COMPAT=y
274CONFIG_SYSVIPC_COMPAT=y
275CONFIG_MIPS32_O32=y
276CONFIG_MIPS32_N32=y
277CONFIG_BINFMT_ELF32=y
278
279#
280# Power management options
281#
282CONFIG_ARCH_SUSPEND_POSSIBLE=y
283CONFIG_PM=y
284# CONFIG_PM_LEGACY is not set
285# CONFIG_PM_DEBUG is not set
286# CONFIG_SUSPEND is not set
287
288#
289# Networking
290#
291CONFIG_NET=y
292
293#
294# Networking options
295#
296CONFIG_PACKET=y
297CONFIG_PACKET_MMAP=y
298CONFIG_UNIX=y
299CONFIG_XFRM=y
300# CONFIG_XFRM_USER is not set
301# CONFIG_XFRM_SUB_POLICY is not set
302CONFIG_XFRM_MIGRATE=y
303# CONFIG_XFRM_STATISTICS is not set
304CONFIG_NET_KEY=y
305CONFIG_NET_KEY_MIGRATE=y
306CONFIG_INET=y
307CONFIG_IP_MULTICAST=y
308# CONFIG_IP_ADVANCED_ROUTER is not set
309CONFIG_IP_FIB_HASH=y
310CONFIG_IP_PNP=y
311CONFIG_IP_PNP_DHCP=y
312CONFIG_IP_PNP_BOOTP=y
313# CONFIG_IP_PNP_RARP is not set
314# CONFIG_NET_IPIP is not set
315# CONFIG_NET_IPGRE is not set
316# CONFIG_IP_MROUTE is not set
317# CONFIG_ARPD is not set
318# CONFIG_SYN_COOKIES is not set
319# CONFIG_INET_AH is not set
320# CONFIG_INET_ESP is not set
321# CONFIG_INET_IPCOMP is not set
322# CONFIG_INET_XFRM_TUNNEL is not set
323# CONFIG_INET_TUNNEL is not set
324# CONFIG_INET_XFRM_MODE_TRANSPORT is not set
325# CONFIG_INET_XFRM_MODE_TUNNEL is not set
326# CONFIG_INET_XFRM_MODE_BEET is not set
327# CONFIG_INET_LRO is not set
328CONFIG_INET_DIAG=y
329CONFIG_INET_TCP_DIAG=y
330# CONFIG_TCP_CONG_ADVANCED is not set
331CONFIG_TCP_CONG_CUBIC=y
332CONFIG_DEFAULT_TCP_CONG="cubic"
333CONFIG_TCP_MD5SIG=y
334# CONFIG_IPV6 is not set
335# CONFIG_INET6_XFRM_TUNNEL is not set
336# CONFIG_INET6_TUNNEL is not set
337# CONFIG_NETWORK_SECMARK is not set
338# CONFIG_NETFILTER is not set
339# CONFIG_IP_DCCP is not set
340# CONFIG_IP_SCTP is not set
341# CONFIG_TIPC is not set
342# CONFIG_ATM is not set
343# CONFIG_BRIDGE is not set
344# CONFIG_VLAN_8021Q is not set
345# CONFIG_DECNET is not set
346# CONFIG_LLC2 is not set
347# CONFIG_IPX is not set
348# CONFIG_ATALK is not set
349# CONFIG_X25 is not set
350# CONFIG_LAPB is not set
351# CONFIG_ECONET is not set
352# CONFIG_WAN_ROUTER is not set
353# CONFIG_NET_SCHED is not set
354
355#
356# Network testing
357#
358# CONFIG_NET_PKTGEN is not set
359# CONFIG_HAMRADIO is not set
360# CONFIG_CAN is not set
361# CONFIG_IRDA is not set
362# CONFIG_BT is not set
363# CONFIG_AF_RXRPC is not set
364
365#
366# Wireless
367#
368# CONFIG_CFG80211 is not set
369# CONFIG_WIRELESS_EXT is not set
370# CONFIG_MAC80211 is not set
371# CONFIG_IEEE80211 is not set
372# CONFIG_RFKILL is not set
373# CONFIG_NET_9P is not set
374
375#
376# Device Drivers
377#
378
379#
380# Generic Driver Options
381#
382CONFIG_STANDALONE=y
383CONFIG_PREVENT_FIRMWARE_BUILD=y
384# CONFIG_SYS_HYPERVISOR is not set
385# CONFIG_CONNECTOR is not set
386# CONFIG_MTD is not set
387# CONFIG_PARPORT is not set
388# CONFIG_PNP is not set
389CONFIG_BLK_DEV=y
390# CONFIG_BLK_DEV_COW_COMMON is not set
391# CONFIG_BLK_DEV_LOOP is not set
392# CONFIG_BLK_DEV_NBD is not set
393# CONFIG_BLK_DEV_RAM is not set
394# CONFIG_CDROM_PKTCDVD is not set
395# CONFIG_ATA_OVER_ETH is not set
396# CONFIG_MISC_DEVICES is not set
397CONFIG_HAVE_IDE=y
398# CONFIG_IDE is not set
399
400#
401# SCSI device support
402#
403# CONFIG_RAID_ATTRS is not set
404CONFIG_SCSI=y
405CONFIG_SCSI_DMA=y
406# CONFIG_SCSI_TGT is not set
407# CONFIG_SCSI_NETLINK is not set
408CONFIG_SCSI_PROC_FS=y
409
410#
411# SCSI support type (disk, tape, CD-ROM)
412#
413CONFIG_BLK_DEV_SD=y
414# CONFIG_CHR_DEV_ST is not set
415# CONFIG_CHR_DEV_OSST is not set
416CONFIG_BLK_DEV_SR=y
417# CONFIG_BLK_DEV_SR_VENDOR is not set
418# CONFIG_CHR_DEV_SG is not set
419# CONFIG_CHR_DEV_SCH is not set
420
421#
422# Some SCSI devices (e.g. CD jukebox) support multiple LUNs
423#
424# CONFIG_SCSI_MULTI_LUN is not set
425CONFIG_SCSI_CONSTANTS=y
426# CONFIG_SCSI_LOGGING is not set
427# CONFIG_SCSI_SCAN_ASYNC is not set
428CONFIG_SCSI_WAIT_SCAN=m
429
430#
431# SCSI Transports
432#
433# CONFIG_SCSI_SPI_ATTRS is not set
434# CONFIG_SCSI_FC_ATTRS is not set
435# CONFIG_SCSI_ISCSI_ATTRS is not set
436# CONFIG_SCSI_SAS_LIBSAS is not set
437# CONFIG_SCSI_SRP_ATTRS is not set
438CONFIG_SCSI_LOWLEVEL=y
439# CONFIG_ISCSI_TCP is not set
440CONFIG_SGIWD93_SCSI=y
441# CONFIG_SCSI_AHA1740 is not set
442# CONFIG_SCSI_AIC7XXX is not set
443# CONFIG_SCSI_AIC7XXX_OLD is not set
444# CONFIG_SCSI_ADVANSYS is not set
445# CONFIG_SCSI_IN2000 is not set
446# CONFIG_SCSI_DTC3280 is not set
447# CONFIG_SCSI_FUTURE_DOMAIN is not set
448# CONFIG_SCSI_GENERIC_NCR5380 is not set
449# CONFIG_SCSI_GENERIC_NCR5380_MMIO is not set
450# CONFIG_SCSI_NCR53C406A is not set
451# CONFIG_SCSI_PAS16 is not set
452# CONFIG_SCSI_QLOGIC_FAS is not set
453# CONFIG_SCSI_SIM710 is not set
454# CONFIG_SCSI_SYM53C416 is not set
455# CONFIG_SCSI_T128 is not set
456# CONFIG_SCSI_DEBUG is not set
457# CONFIG_ATA is not set
458# CONFIG_MD is not set
459CONFIG_NETDEVICES=y
460# CONFIG_NETDEVICES_MULTIQUEUE is not set
461CONFIG_DUMMY=m
462# CONFIG_BONDING is not set
463# CONFIG_MACVLAN is not set
464# CONFIG_EQUALIZER is not set
465# CONFIG_TUN is not set
466# CONFIG_VETH is not set
467# CONFIG_ARCNET is not set
468# CONFIG_PHYLIB is not set
469CONFIG_NET_ETHERNET=y
470# CONFIG_MII is not set
471# CONFIG_AX88796 is not set
472# CONFIG_NET_VENDOR_3COM is not set
473# CONFIG_NET_VENDOR_SMC is not set
474# CONFIG_DM9000 is not set
475# CONFIG_NET_VENDOR_RACAL is not set
476# CONFIG_NET_TULIP is not set
477# CONFIG_AT1700 is not set
478# CONFIG_DEPCA is not set
479# CONFIG_HP100 is not set
480# CONFIG_NET_ISA is not set
481# CONFIG_IBM_NEW_EMAC_ZMII is not set
482# CONFIG_IBM_NEW_EMAC_RGMII is not set
483# CONFIG_IBM_NEW_EMAC_TAH is not set
484# CONFIG_IBM_NEW_EMAC_EMAC4 is not set
485# CONFIG_NET_PCI is not set
486# CONFIG_B44 is not set
487CONFIG_SGISEEQ=y
488# CONFIG_NETDEV_1000 is not set
489# CONFIG_NETDEV_10000 is not set
490# CONFIG_TR is not set
491
492#
493# Wireless LAN
494#
495# CONFIG_WLAN_PRE80211 is not set
496# CONFIG_WLAN_80211 is not set
497# CONFIG_WAN is not set
498# CONFIG_FDDI is not set
499# CONFIG_PPP is not set
500# CONFIG_SLIP is not set
501# CONFIG_NETCONSOLE is not set
502# CONFIG_NETPOLL is not set
503# CONFIG_NET_POLL_CONTROLLER is not set
504# CONFIG_ISDN is not set
505# CONFIG_PHONE is not set
506
507#
508# Input device support
509#
510CONFIG_INPUT=y
511# CONFIG_INPUT_FF_MEMLESS is not set
512# CONFIG_INPUT_POLLDEV is not set
513
514#
515# Userland interfaces
516#
517CONFIG_INPUT_MOUSEDEV=y
518CONFIG_INPUT_MOUSEDEV_PSAUX=y
519CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
520CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
521# CONFIG_INPUT_JOYDEV is not set
522# CONFIG_INPUT_EVDEV is not set
523# CONFIG_INPUT_EVBUG is not set
524
525#
526# Input Device Drivers
527#
528CONFIG_INPUT_KEYBOARD=y
529CONFIG_KEYBOARD_ATKBD=y
530# CONFIG_KEYBOARD_SUNKBD is not set
531# CONFIG_KEYBOARD_LKKBD is not set
532# CONFIG_KEYBOARD_XTKBD is not set
533# CONFIG_KEYBOARD_NEWTON is not set
534# CONFIG_KEYBOARD_STOWAWAY is not set
535CONFIG_INPUT_MOUSE=y
536CONFIG_MOUSE_PS2=y
537# CONFIG_MOUSE_PS2_ALPS is not set
538CONFIG_MOUSE_PS2_LOGIPS2PP=y
539# CONFIG_MOUSE_PS2_SYNAPTICS is not set
540# CONFIG_MOUSE_PS2_LIFEBOOK is not set
541CONFIG_MOUSE_PS2_TRACKPOINT=y
542# CONFIG_MOUSE_PS2_TOUCHKIT is not set
543# CONFIG_MOUSE_SERIAL is not set
544# CONFIG_MOUSE_INPORT is not set
545# CONFIG_MOUSE_LOGIBM is not set
546# CONFIG_MOUSE_PC110PAD is not set
547# CONFIG_MOUSE_VSXXXAA is not set
548# CONFIG_INPUT_JOYSTICK is not set
549# CONFIG_INPUT_TABLET is not set
550# CONFIG_INPUT_TOUCHSCREEN is not set
551# CONFIG_INPUT_MISC is not set
552
553#
554# Hardware I/O ports
555#
556CONFIG_SERIO=y
557CONFIG_SERIO_I8042=y
558CONFIG_SERIO_SERPORT=y
559CONFIG_SERIO_LIBPS2=y
560# CONFIG_SERIO_RAW is not set
561# CONFIG_GAMEPORT is not set
562
563#
564# Character devices
565#
566CONFIG_VT=y
567CONFIG_VT_CONSOLE=y
568CONFIG_HW_CONSOLE=y
569CONFIG_VT_HW_CONSOLE_BINDING=y
570# CONFIG_SERIAL_NONSTANDARD is not set
571
572#
573# Serial drivers
574#
575# CONFIG_SERIAL_8250 is not set
576
577#
578# Non-8250 serial port support
579#
580CONFIG_SERIAL_IP22_ZILOG=y
581CONFIG_SERIAL_IP22_ZILOG_CONSOLE=y
582CONFIG_SERIAL_CORE=y
583CONFIG_SERIAL_CORE_CONSOLE=y
584CONFIG_UNIX98_PTYS=y
585CONFIG_LEGACY_PTYS=y
586CONFIG_LEGACY_PTY_COUNT=256
587# CONFIG_IPMI_HANDLER is not set
588# CONFIG_HW_RANDOM is not set
589# CONFIG_RTC is not set
590CONFIG_SGI_DS1286=y
591# CONFIG_DTLK is not set
592# CONFIG_R3964 is not set
593# CONFIG_RAW_DRIVER is not set
594# CONFIG_TCG_TPM is not set
595CONFIG_DEVPORT=y
596# CONFIG_I2C is not set
597
598#
599# SPI support
600#
601# CONFIG_SPI is not set
602# CONFIG_SPI_MASTER is not set
603# CONFIG_W1 is not set
604# CONFIG_POWER_SUPPLY is not set
605# CONFIG_HWMON is not set
606# CONFIG_THERMAL is not set
607CONFIG_WATCHDOG=y
608# CONFIG_WATCHDOG_NOWAYOUT is not set
609
610#
611# Watchdog Device Drivers
612#
613# CONFIG_SOFT_WATCHDOG is not set
614CONFIG_INDYDOG=y
615
616#
617# ISA-based Watchdog Cards
618#
619# CONFIG_PCWATCHDOG is not set
620# CONFIG_MIXCOMWD is not set
621# CONFIG_WDT is not set
622
623#
624# Sonics Silicon Backplane
625#
626CONFIG_SSB_POSSIBLE=y
627# CONFIG_SSB is not set
628
629#
630# Multifunction device drivers
631#
632# CONFIG_MFD_SM501 is not set
633
634#
635# Multimedia devices
636#
637# CONFIG_VIDEO_DEV is not set
638# CONFIG_DVB_CORE is not set
639# CONFIG_DAB is not set
640
641#
642# Graphics support
643#
644# CONFIG_VGASTATE is not set
645# CONFIG_VIDEO_OUTPUT_CONTROL is not set
646# CONFIG_FB is not set
647# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
648
649#
650# Display device support
651#
652# CONFIG_DISPLAY_SUPPORT is not set
653
654#
655# Console display driver support
656#
657# CONFIG_VGA_CONSOLE is not set
658# CONFIG_MDA_CONSOLE is not set
659CONFIG_DUMMY_CONSOLE=y
660
661#
662# Sound
663#
664# CONFIG_SOUND is not set
665CONFIG_HID_SUPPORT=y
666CONFIG_HID=y
667# CONFIG_HID_DEBUG is not set
668# CONFIG_HIDRAW is not set
669CONFIG_USB_SUPPORT=y
670# CONFIG_USB_ARCH_HAS_HCD is not set
671# CONFIG_USB_ARCH_HAS_OHCI is not set
672# CONFIG_USB_ARCH_HAS_EHCI is not set
673
674#
675# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
676#
677# CONFIG_USB_GADGET is not set
678# CONFIG_MMC is not set
679# CONFIG_MEMSTICK is not set
680# CONFIG_NEW_LEDS is not set
681CONFIG_RTC_LIB=y
682# CONFIG_RTC_CLASS is not set
683
684#
685# Userspace I/O
686#
687# CONFIG_UIO is not set
688
689#
690# File systems
691#
692CONFIG_EXT2_FS=y
693# CONFIG_EXT2_FS_XATTR is not set
694# CONFIG_EXT2_FS_XIP is not set
695CONFIG_EXT3_FS=y
696CONFIG_EXT3_FS_XATTR=y
697CONFIG_EXT3_FS_POSIX_ACL=y
698CONFIG_EXT3_FS_SECURITY=y
699# CONFIG_EXT4DEV_FS is not set
700CONFIG_JBD=y
701CONFIG_FS_MBCACHE=y
702# CONFIG_REISERFS_FS is not set
703# CONFIG_JFS_FS is not set
704CONFIG_FS_POSIX_ACL=y
705# CONFIG_XFS_FS is not set
706# CONFIG_GFS2_FS is not set
707# CONFIG_OCFS2_FS is not set
708CONFIG_DNOTIFY=y
709CONFIG_INOTIFY=y
710CONFIG_INOTIFY_USER=y
711CONFIG_QUOTA=y
712# CONFIG_QUOTA_NETLINK_INTERFACE is not set
713CONFIG_PRINT_QUOTA_WARNING=y
714# CONFIG_QFMT_V1 is not set
715# CONFIG_QFMT_V2 is not set
716CONFIG_QUOTACTL=y
717# CONFIG_AUTOFS_FS is not set
718# CONFIG_AUTOFS4_FS is not set
719# CONFIG_FUSE_FS is not set
720CONFIG_GENERIC_ACL=y
721
722#
723# CD-ROM/DVD Filesystems
724#
725# CONFIG_ISO9660_FS is not set
726# CONFIG_UDF_FS is not set
727
728#
729# DOS/FAT/NT Filesystems
730#
731# CONFIG_MSDOS_FS is not set
732# CONFIG_VFAT_FS is not set
733# CONFIG_NTFS_FS is not set
734
735#
736# Pseudo filesystems
737#
738CONFIG_PROC_FS=y
739CONFIG_PROC_KCORE=y
740CONFIG_PROC_SYSCTL=y
741CONFIG_SYSFS=y
742CONFIG_TMPFS=y
743CONFIG_TMPFS_POSIX_ACL=y
744# CONFIG_HUGETLB_PAGE is not set
745# CONFIG_CONFIGFS_FS is not set
746
747#
748# Miscellaneous filesystems
749#
750# CONFIG_ADFS_FS is not set
751# CONFIG_AFFS_FS is not set
752# CONFIG_HFS_FS is not set
753# CONFIG_HFSPLUS_FS is not set
754# CONFIG_BEFS_FS is not set
755# CONFIG_BFS_FS is not set
756# CONFIG_EFS_FS is not set
757# CONFIG_CRAMFS is not set
758# CONFIG_VXFS_FS is not set
759# CONFIG_MINIX_FS is not set
760# CONFIG_HPFS_FS is not set
761# CONFIG_QNX4FS_FS is not set
762# CONFIG_ROMFS_FS is not set
763# CONFIG_SYSV_FS is not set
764# CONFIG_UFS_FS is not set
765CONFIG_NETWORK_FILESYSTEMS=y
766CONFIG_NFS_FS=y
767CONFIG_NFS_V3=y
768CONFIG_NFS_V3_ACL=y
769# CONFIG_NFS_V4 is not set
770# CONFIG_NFS_DIRECTIO is not set
771# CONFIG_NFSD is not set
772CONFIG_ROOT_NFS=y
773CONFIG_LOCKD=y
774CONFIG_LOCKD_V4=y
775CONFIG_NFS_ACL_SUPPORT=y
776CONFIG_NFS_COMMON=y
777CONFIG_SUNRPC=y
778# CONFIG_SUNRPC_BIND34 is not set
779# CONFIG_RPCSEC_GSS_KRB5 is not set
780# CONFIG_RPCSEC_GSS_SPKM3 is not set
781# CONFIG_SMB_FS is not set
782# CONFIG_CIFS is not set
783# CONFIG_NCP_FS is not set
784# CONFIG_CODA_FS is not set
785# CONFIG_AFS_FS is not set
786
787#
788# Partition Types
789#
790CONFIG_PARTITION_ADVANCED=y
791# CONFIG_ACORN_PARTITION is not set
792# CONFIG_OSF_PARTITION is not set
793# CONFIG_AMIGA_PARTITION is not set
794# CONFIG_ATARI_PARTITION is not set
795# CONFIG_MAC_PARTITION is not set
796CONFIG_MSDOS_PARTITION=y
797# CONFIG_BSD_DISKLABEL is not set
798# CONFIG_MINIX_SUBPARTITION is not set
799# CONFIG_SOLARIS_X86_PARTITION is not set
800# CONFIG_UNIXWARE_DISKLABEL is not set
801# CONFIG_LDM_PARTITION is not set
802CONFIG_SGI_PARTITION=y
803# CONFIG_ULTRIX_PARTITION is not set
804# CONFIG_SUN_PARTITION is not set
805# CONFIG_KARMA_PARTITION is not set
806# CONFIG_EFI_PARTITION is not set
807# CONFIG_SYSV68_PARTITION is not set
808# CONFIG_NLS is not set
809# CONFIG_DLM is not set
810
811#
812# Kernel hacking
813#
814CONFIG_TRACE_IRQFLAGS_SUPPORT=y
815# CONFIG_PRINTK_TIME is not set
816CONFIG_ENABLE_WARN_DEPRECATED=y
817CONFIG_ENABLE_MUST_CHECK=y
818CONFIG_MAGIC_SYSRQ=y
819# CONFIG_UNUSED_SYMBOLS is not set
820# CONFIG_DEBUG_FS is not set
821# CONFIG_HEADERS_CHECK is not set
822# CONFIG_DEBUG_KERNEL is not set
823# CONFIG_SAMPLES is not set
824CONFIG_CMDLINE=""
825
826#
827# Security options
828#
829# CONFIG_KEYS is not set
830# CONFIG_SECURITY is not set
831# CONFIG_SECURITY_FILE_CAPABILITIES is not set
832CONFIG_CRYPTO=y
833CONFIG_CRYPTO_ALGAPI=y
834# CONFIG_CRYPTO_SEQIV is not set
835CONFIG_CRYPTO_MANAGER=y
836# CONFIG_CRYPTO_HMAC is not set
837# CONFIG_CRYPTO_XCBC is not set
838# CONFIG_CRYPTO_NULL is not set
839# CONFIG_CRYPTO_MD4 is not set
840CONFIG_CRYPTO_MD5=y
841# CONFIG_CRYPTO_SHA1 is not set
842# CONFIG_CRYPTO_SHA256 is not set
843# CONFIG_CRYPTO_SHA512 is not set
844# CONFIG_CRYPTO_WP512 is not set
845# CONFIG_CRYPTO_TGR192 is not set
846# CONFIG_CRYPTO_GF128MUL is not set
847# CONFIG_CRYPTO_ECB is not set
848# CONFIG_CRYPTO_CBC is not set
849# CONFIG_CRYPTO_PCBC is not set
850# CONFIG_CRYPTO_LRW is not set
851# CONFIG_CRYPTO_XTS is not set
852# CONFIG_CRYPTO_CTR is not set
853# CONFIG_CRYPTO_GCM is not set
854# CONFIG_CRYPTO_CCM is not set
855# CONFIG_CRYPTO_CRYPTD is not set
856# CONFIG_CRYPTO_DES is not set
857# CONFIG_CRYPTO_FCRYPT is not set
858# CONFIG_CRYPTO_BLOWFISH is not set
859# CONFIG_CRYPTO_TWOFISH is not set
860# CONFIG_CRYPTO_SERPENT is not set
861# CONFIG_CRYPTO_AES is not set
862# CONFIG_CRYPTO_CAST5 is not set
863# CONFIG_CRYPTO_CAST6 is not set
864# CONFIG_CRYPTO_TEA is not set
865# CONFIG_CRYPTO_ARC4 is not set
866# CONFIG_CRYPTO_KHAZAD is not set
867# CONFIG_CRYPTO_ANUBIS is not set
868# CONFIG_CRYPTO_SEED is not set
869# CONFIG_CRYPTO_SALSA20 is not set
870# CONFIG_CRYPTO_DEFLATE is not set
871# CONFIG_CRYPTO_MICHAEL_MIC is not set
872# CONFIG_CRYPTO_CRC32C is not set
873# CONFIG_CRYPTO_CAMELLIA is not set
874# CONFIG_CRYPTO_TEST is not set
875# CONFIG_CRYPTO_AUTHENC is not set
876# CONFIG_CRYPTO_LZO is not set
877# CONFIG_CRYPTO_HW is not set
878
879#
880# Library routines
881#
882# CONFIG_CRC_CCITT is not set
883# CONFIG_CRC16 is not set
884# CONFIG_CRC_ITU_T is not set
885# CONFIG_CRC32 is not set
886# CONFIG_CRC7 is not set
887# CONFIG_LIBCRC32C is not set
888CONFIG_PLIST=y
889CONFIG_HAS_IOMEM=y
890CONFIG_HAS_IOPORT=y
891CONFIG_HAS_DMA=y
diff --git a/arch/mips/configs/qemu_defconfig b/arch/mips/configs/qemu_defconfig
deleted file mode 100644
index 72ca147f9422..000000000000
--- a/arch/mips/configs/qemu_defconfig
+++ /dev/null
@@ -1,800 +0,0 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.20
4# Tue Feb 20 21:47:39 2007
5#
6CONFIG_MIPS=y
7
8#
9# Machine selection
10#
11CONFIG_ZONE_DMA=y
12# CONFIG_MIPS_MTX1 is not set
13# CONFIG_MIPS_BOSPORUS is not set
14# CONFIG_MIPS_PB1000 is not set
15# CONFIG_MIPS_PB1100 is not set
16# CONFIG_MIPS_PB1500 is not set
17# CONFIG_MIPS_PB1550 is not set
18# CONFIG_MIPS_PB1200 is not set
19# CONFIG_MIPS_DB1000 is not set
20# CONFIG_MIPS_DB1100 is not set
21# CONFIG_MIPS_DB1500 is not set
22# CONFIG_MIPS_DB1550 is not set
23# CONFIG_MIPS_DB1200 is not set
24# CONFIG_MIPS_MIRAGE is not set
25# CONFIG_BASLER_EXCITE is not set
26# CONFIG_MIPS_COBALT is not set
27# CONFIG_MACH_DECSTATION is not set
28# CONFIG_MACH_JAZZ is not set
29# CONFIG_MIPS_ATLAS is not set
30# CONFIG_MIPS_MALTA is not set
31# CONFIG_MIPS_SEAD is not set
32# CONFIG_WR_PPMC is not set
33# CONFIG_MIPS_SIM is not set
34# CONFIG_MOMENCO_JAGUAR_ATX is not set
35# CONFIG_MIPS_XXS1500 is not set
36# CONFIG_PNX8550_JBS is not set
37# CONFIG_PNX8550_STB810 is not set
38# CONFIG_MACH_VR41XX is not set
39# CONFIG_PMC_YOSEMITE is not set
40# CONFIG_MARKEINS is not set
41# CONFIG_SGI_IP22 is not set
42# CONFIG_SGI_IP27 is not set
43# CONFIG_SGI_IP32 is not set
44# CONFIG_SIBYTE_BIGSUR is not set
45# CONFIG_SIBYTE_SWARM is not set
46# CONFIG_SIBYTE_SENTOSA is not set
47# CONFIG_SIBYTE_RHONE is not set
48# CONFIG_SIBYTE_CARMEL is not set
49# CONFIG_SIBYTE_LITTLESUR is not set
50# CONFIG_SIBYTE_CRHINE is not set
51# CONFIG_SIBYTE_CRHONE is not set
52# CONFIG_SNI_RM is not set
53# CONFIG_TOSHIBA_JMR3927 is not set
54# CONFIG_TOSHIBA_RBTX4927 is not set
55# CONFIG_TOSHIBA_RBTX4938 is not set
56CONFIG_RWSEM_GENERIC_SPINLOCK=y
57# CONFIG_ARCH_HAS_ILOG2_U32 is not set
58# CONFIG_ARCH_HAS_ILOG2_U64 is not set
59CONFIG_GENERIC_FIND_NEXT_BIT=y
60CONFIG_GENERIC_HWEIGHT=y
61CONFIG_GENERIC_CALIBRATE_DELAY=y
62CONFIG_GENERIC_TIME=y
63CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER=y
64CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y
65CONFIG_DMA_COHERENT=y
66CONFIG_GENERIC_ISA_DMA=y
67CONFIG_I8259=y
68CONFIG_CPU_BIG_ENDIAN=y
69# CONFIG_CPU_LITTLE_ENDIAN is not set
70CONFIG_SYS_SUPPORTS_BIG_ENDIAN=y
71CONFIG_SYS_SUPPORTS_LITTLE_ENDIAN=y
72CONFIG_SWAP_IO_SPACE=y
73CONFIG_MIPS_L1_CACHE_SHIFT=5
74CONFIG_HAVE_STD_PC_SERIAL_PORT=y
75
76#
77# CPU selection
78#
79CONFIG_CPU_MIPS32_R1=y
80# CONFIG_CPU_MIPS32_R2 is not set
81# CONFIG_CPU_MIPS64_R1 is not set
82# CONFIG_CPU_MIPS64_R2 is not set
83# CONFIG_CPU_R3000 is not set
84# CONFIG_CPU_TX39XX is not set
85# CONFIG_CPU_VR41XX is not set
86# CONFIG_CPU_R4300 is not set
87# CONFIG_CPU_R4X00 is not set
88# CONFIG_CPU_TX49XX is not set
89# CONFIG_CPU_R5000 is not set
90# CONFIG_CPU_R5432 is not set
91# CONFIG_CPU_R6000 is not set
92# CONFIG_CPU_NEVADA is not set
93# CONFIG_CPU_R8000 is not set
94# CONFIG_CPU_R10000 is not set
95# CONFIG_CPU_RM7000 is not set
96# CONFIG_CPU_RM9000 is not set
97# CONFIG_CPU_SB1 is not set
98CONFIG_SYS_HAS_CPU_MIPS32_R1=y
99CONFIG_CPU_MIPS32=y
100CONFIG_CPU_MIPSR1=y
101CONFIG_SYS_SUPPORTS_32BIT_KERNEL=y
102CONFIG_CPU_SUPPORTS_32BIT_KERNEL=y
103
104#
105# Kernel type
106#
107CONFIG_32BIT=y
108# CONFIG_64BIT is not set
109CONFIG_PAGE_SIZE_4KB=y
110# CONFIG_PAGE_SIZE_8KB is not set
111# CONFIG_PAGE_SIZE_16KB is not set
112# CONFIG_PAGE_SIZE_64KB is not set
113CONFIG_CPU_HAS_PREFETCH=y
114CONFIG_MIPS_MT_DISABLED=y
115# CONFIG_MIPS_MT_SMP is not set
116# CONFIG_MIPS_MT_SMTC is not set
117# CONFIG_MIPS_VPE_LOADER is not set
118# CONFIG_64BIT_PHYS_ADDR is not set
119CONFIG_CPU_HAS_LLSC=y
120CONFIG_CPU_HAS_SYNC=y
121CONFIG_GENERIC_HARDIRQS=y
122CONFIG_GENERIC_IRQ_PROBE=y
123CONFIG_CPU_SUPPORTS_HIGHMEM=y
124CONFIG_ARCH_FLATMEM_ENABLE=y
125CONFIG_ARCH_SPARSEMEM_ENABLE=y
126CONFIG_FLATMEM=y
127CONFIG_FLAT_NODE_MEM_MAP=y
128CONFIG_SPARSEMEM_STATIC=y
129CONFIG_SPLIT_PTLOCK_CPUS=4
130# CONFIG_RESOURCES_64BIT is not set
131CONFIG_ZONE_DMA_FLAG=1
132# CONFIG_HZ_48 is not set
133CONFIG_HZ_100=y
134# CONFIG_HZ_128 is not set
135# CONFIG_HZ_250 is not set
136# CONFIG_HZ_256 is not set
137# CONFIG_HZ_1000 is not set
138# CONFIG_HZ_1024 is not set
139CONFIG_SYS_SUPPORTS_ARBIT_HZ=y
140CONFIG_HZ=100
141CONFIG_PREEMPT_NONE=y
142# CONFIG_PREEMPT_VOLUNTARY is not set
143# CONFIG_PREEMPT is not set
144CONFIG_LOCKDEP_SUPPORT=y
145CONFIG_STACKTRACE_SUPPORT=y
146CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
147
148#
149# Code maturity level options
150#
151# CONFIG_EXPERIMENTAL is not set
152CONFIG_BROKEN_ON_SMP=y
153CONFIG_INIT_ENV_ARG_LIMIT=32
154
155#
156# General setup
157#
158CONFIG_LOCALVERSION=""
159CONFIG_LOCALVERSION_AUTO=y
160# CONFIG_SWAP is not set
161# CONFIG_SYSVIPC is not set
162# CONFIG_BSD_PROCESS_ACCT is not set
163# CONFIG_TASKSTATS is not set
164# CONFIG_UTS_NS is not set
165# CONFIG_AUDIT is not set
166# CONFIG_IKCONFIG is not set
167CONFIG_SYSFS_DEPRECATED=y
168CONFIG_RELAY=y
169CONFIG_SYSCTL=y
170CONFIG_EMBEDDED=y
171CONFIG_SYSCTL_SYSCALL=y
172CONFIG_KALLSYMS=y
173# CONFIG_KALLSYMS_EXTRA_PASS is not set
174# CONFIG_HOTPLUG is not set
175CONFIG_PRINTK=y
176# CONFIG_BUG is not set
177CONFIG_ELF_CORE=y
178# CONFIG_BASE_FULL is not set
179# CONFIG_FUTEX is not set
180# CONFIG_EPOLL is not set
181# CONFIG_SHMEM is not set
182CONFIG_SLAB=y
183CONFIG_VM_EVENT_COUNTERS=y
184CONFIG_TINY_SHMEM=y
185CONFIG_BASE_SMALL=1
186# CONFIG_SLOB is not set
187
188#
189# Loadable module support
190#
191# CONFIG_MODULES is not set
192
193#
194# Block layer
195#
196CONFIG_BLOCK=y
197# CONFIG_LBD is not set
198# CONFIG_BLK_DEV_IO_TRACE is not set
199# CONFIG_LSF is not set
200
201#
202# IO Schedulers
203#
204CONFIG_IOSCHED_NOOP=y
205# CONFIG_IOSCHED_AS is not set
206# CONFIG_IOSCHED_DEADLINE is not set
207# CONFIG_IOSCHED_CFQ is not set
208# CONFIG_DEFAULT_AS is not set
209# CONFIG_DEFAULT_DEADLINE is not set
210# CONFIG_DEFAULT_CFQ is not set
211CONFIG_DEFAULT_NOOP=y
212CONFIG_DEFAULT_IOSCHED="noop"
213
214#
215# Bus options (PCI, PCMCIA, EISA, ISA, TC)
216#
217CONFIG_ISA=y
218CONFIG_MMU=y
219CONFIG_PCSPEAKER=y
220
221#
222# PCCARD (PCMCIA/CardBus) support
223#
224
225#
226# PCI Hotplug Support
227#
228
229#
230# Executable file formats
231#
232CONFIG_BINFMT_ELF=y
233# CONFIG_BINFMT_MISC is not set
234CONFIG_TRAD_SIGNALS=y
235
236#
237# Power management options
238#
239CONFIG_PM=y
240# CONFIG_PM_LEGACY is not set
241# CONFIG_PM_DEBUG is not set
242# CONFIG_PM_SYSFS_DEPRECATED is not set
243
244#
245# Networking
246#
247CONFIG_NET=y
248
249#
250# Networking options
251#
252# CONFIG_NETDEBUG is not set
253CONFIG_PACKET=y
254CONFIG_PACKET_MMAP=y
255CONFIG_UNIX=y
256CONFIG_XFRM=y
257# CONFIG_XFRM_USER is not set
258# CONFIG_NET_KEY is not set
259CONFIG_INET=y
260CONFIG_IP_MULTICAST=y
261# CONFIG_IP_ADVANCED_ROUTER is not set
262CONFIG_IP_FIB_HASH=y
263CONFIG_IP_PNP=y
264CONFIG_IP_PNP_DHCP=y
265CONFIG_IP_PNP_BOOTP=y
266# CONFIG_IP_PNP_RARP is not set
267# CONFIG_NET_IPIP is not set
268# CONFIG_NET_IPGRE is not set
269# CONFIG_IP_MROUTE is not set
270# CONFIG_SYN_COOKIES is not set
271# CONFIG_INET_AH is not set
272# CONFIG_INET_ESP is not set
273# CONFIG_INET_IPCOMP is not set
274# CONFIG_INET_XFRM_TUNNEL is not set
275# CONFIG_INET_TUNNEL is not set
276CONFIG_INET_XFRM_MODE_TRANSPORT=y
277CONFIG_INET_XFRM_MODE_TUNNEL=y
278CONFIG_INET_XFRM_MODE_BEET=y
279CONFIG_INET_DIAG=y
280CONFIG_INET_TCP_DIAG=y
281# CONFIG_TCP_CONG_ADVANCED is not set
282CONFIG_TCP_CONG_CUBIC=y
283CONFIG_DEFAULT_TCP_CONG="cubic"
284# CONFIG_IPV6 is not set
285# CONFIG_INET6_XFRM_TUNNEL is not set
286# CONFIG_INET6_TUNNEL is not set
287CONFIG_NETWORK_SECMARK=y
288# CONFIG_NETFILTER is not set
289# CONFIG_BRIDGE is not set
290# CONFIG_VLAN_8021Q is not set
291# CONFIG_DECNET is not set
292# CONFIG_LLC2 is not set
293# CONFIG_IPX is not set
294# CONFIG_ATALK is not set
295
296#
297# QoS and/or fair queueing
298#
299# CONFIG_NET_SCHED is not set
300
301#
302# Network testing
303#
304# CONFIG_NET_PKTGEN is not set
305# CONFIG_HAMRADIO is not set
306# CONFIG_IRDA is not set
307# CONFIG_BT is not set
308# CONFIG_IEEE80211 is not set
309
310#
311# Device Drivers
312#
313
314#
315# Generic Driver Options
316#
317CONFIG_STANDALONE=y
318# CONFIG_PREVENT_FIRMWARE_BUILD is not set
319# CONFIG_SYS_HYPERVISOR is not set
320
321#
322# Connector - unified userspace <-> kernelspace linker
323#
324CONFIG_CONNECTOR=y
325CONFIG_PROC_EVENTS=y
326
327#
328# Memory Technology Devices (MTD)
329#
330# CONFIG_MTD is not set
331
332#
333# Parallel port support
334#
335# CONFIG_PARPORT is not set
336
337#
338# Plug and Play support
339#
340# CONFIG_PNP is not set
341# CONFIG_PNPACPI is not set
342
343#
344# Block devices
345#
346# CONFIG_BLK_DEV_COW_COMMON is not set
347# CONFIG_BLK_DEV_LOOP is not set
348# CONFIG_BLK_DEV_NBD is not set
349# CONFIG_BLK_DEV_RAM is not set
350# CONFIG_BLK_DEV_INITRD is not set
351# CONFIG_CDROM_PKTCDVD is not set
352# CONFIG_ATA_OVER_ETH is not set
353
354#
355# Misc devices
356#
357
358#
359# ATA/ATAPI/MFM/RLL support
360#
361# CONFIG_IDE is not set
362
363#
364# SCSI device support
365#
366# CONFIG_RAID_ATTRS is not set
367# CONFIG_SCSI is not set
368# CONFIG_SCSI_NETLINK is not set
369
370#
371# Serial ATA (prod) and Parallel ATA (experimental) drivers
372#
373# CONFIG_ATA is not set
374
375#
376# Old CD-ROM drivers (not SCSI, not IDE)
377#
378# CONFIG_CD_NO_IDESCSI is not set
379
380#
381# Multi-device support (RAID and LVM)
382#
383# CONFIG_MD is not set
384
385#
386# Fusion MPT device support
387#
388# CONFIG_FUSION is not set
389
390#
391# IEEE 1394 (FireWire) support
392#
393
394#
395# I2O device support
396#
397
398#
399# Network device support
400#
401CONFIG_NETDEVICES=y
402# CONFIG_DUMMY is not set
403# CONFIG_BONDING is not set
404# CONFIG_EQUALIZER is not set
405# CONFIG_TUN is not set
406
407#
408# ARCnet devices
409#
410# CONFIG_ARCNET is not set
411
412#
413# PHY device support
414#
415# CONFIG_PHYLIB is not set
416
417#
418# Ethernet (10 or 100Mbit)
419#
420CONFIG_NET_ETHERNET=y
421# CONFIG_MII is not set
422# CONFIG_NET_VENDOR_3COM is not set
423# CONFIG_NET_VENDOR_SMC is not set
424# CONFIG_DM9000 is not set
425# CONFIG_NET_VENDOR_RACAL is not set
426# CONFIG_DEPCA is not set
427# CONFIG_HP100 is not set
428CONFIG_NET_ISA=y
429# CONFIG_E2100 is not set
430# CONFIG_EWRK3 is not set
431# CONFIG_EEXPRESS is not set
432# CONFIG_EEXPRESS_PRO is not set
433# CONFIG_HPLAN_PLUS is not set
434# CONFIG_HPLAN is not set
435# CONFIG_LP486E is not set
436# CONFIG_ETH16I is not set
437CONFIG_NE2000=y
438# CONFIG_NET_PCI is not set
439
440#
441# Ethernet (1000 Mbit)
442#
443
444#
445# Ethernet (10000 Mbit)
446#
447
448#
449# Token Ring devices
450#
451# CONFIG_TR is not set
452
453#
454# Wireless LAN (non-hamradio)
455#
456# CONFIG_NET_RADIO is not set
457
458#
459# Wan interfaces
460#
461# CONFIG_WAN is not set
462# CONFIG_PPP is not set
463# CONFIG_SLIP is not set
464# CONFIG_NETPOLL is not set
465# CONFIG_NET_POLL_CONTROLLER is not set
466
467#
468# ISDN subsystem
469#
470# CONFIG_ISDN is not set
471
472#
473# Telephony Support
474#
475# CONFIG_PHONE is not set
476
477#
478# Input device support
479#
480CONFIG_INPUT=y
481# CONFIG_INPUT_FF_MEMLESS is not set
482
483#
484# Userland interfaces
485#
486# CONFIG_INPUT_MOUSEDEV is not set
487# CONFIG_INPUT_JOYDEV is not set
488# CONFIG_INPUT_TSDEV is not set
489# CONFIG_INPUT_EVDEV is not set
490# CONFIG_INPUT_EVBUG is not set
491
492#
493# Input Device Drivers
494#
495# CONFIG_INPUT_KEYBOARD is not set
496# CONFIG_INPUT_MOUSE is not set
497# CONFIG_INPUT_JOYSTICK is not set
498# CONFIG_INPUT_TOUCHSCREEN is not set
499# CONFIG_INPUT_MISC is not set
500
501#
502# Hardware I/O ports
503#
504# CONFIG_SERIO is not set
505# CONFIG_GAMEPORT is not set
506
507#
508# Character devices
509#
510CONFIG_VT=y
511CONFIG_VT_CONSOLE=y
512CONFIG_HW_CONSOLE=y
513CONFIG_VT_HW_CONSOLE_BINDING=y
514# CONFIG_SERIAL_NONSTANDARD is not set
515
516#
517# Serial drivers
518#
519CONFIG_SERIAL_8250=y
520CONFIG_SERIAL_8250_CONSOLE=y
521CONFIG_SERIAL_8250_NR_UARTS=4
522CONFIG_SERIAL_8250_RUNTIME_UARTS=4
523# CONFIG_SERIAL_8250_EXTENDED is not set
524
525#
526# Non-8250 serial port support
527#
528CONFIG_SERIAL_CORE=y
529CONFIG_SERIAL_CORE_CONSOLE=y
530CONFIG_UNIX98_PTYS=y
531CONFIG_LEGACY_PTYS=y
532CONFIG_LEGACY_PTY_COUNT=256
533
534#
535# IPMI
536#
537# CONFIG_IPMI_HANDLER is not set
538
539#
540# Watchdog Cards
541#
542# CONFIG_WATCHDOG is not set
543# CONFIG_HW_RANDOM is not set
544# CONFIG_RTC is not set
545# CONFIG_GEN_RTC is not set
546# CONFIG_DTLK is not set
547# CONFIG_R3964 is not set
548# CONFIG_RAW_DRIVER is not set
549
550#
551# TPM devices
552#
553
554#
555# I2C support
556#
557# CONFIG_I2C is not set
558
559#
560# SPI support
561#
562# CONFIG_SPI is not set
563# CONFIG_SPI_MASTER is not set
564
565#
566# Dallas's 1-wire bus
567#
568# CONFIG_W1 is not set
569
570#
571# Hardware Monitoring support
572#
573# CONFIG_HWMON is not set
574# CONFIG_HWMON_VID is not set
575
576#
577# Multimedia devices
578#
579# CONFIG_VIDEO_DEV is not set
580
581#
582# Digital Video Broadcasting Devices
583#
584# CONFIG_DVB is not set
585
586#
587# Graphics support
588#
589# CONFIG_FIRMWARE_EDID is not set
590# CONFIG_FB is not set
591
592#
593# Console display driver support
594#
595CONFIG_VGA_CONSOLE=y
596# CONFIG_VGACON_SOFT_SCROLLBACK is not set
597# CONFIG_MDA_CONSOLE is not set
598CONFIG_DUMMY_CONSOLE=y
599# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
600
601#
602# Sound
603#
604# CONFIG_SOUND is not set
605
606#
607# HID Devices
608#
609CONFIG_HID=y
610# CONFIG_HID_DEBUG is not set
611
612#
613# USB support
614#
615# CONFIG_USB_ARCH_HAS_HCD is not set
616# CONFIG_USB_ARCH_HAS_OHCI is not set
617# CONFIG_USB_ARCH_HAS_EHCI is not set
618
619#
620# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
621#
622
623#
624# USB Gadget Support
625#
626# CONFIG_USB_GADGET is not set
627
628#
629# MMC/SD Card support
630#
631# CONFIG_MMC is not set
632
633#
634# LED devices
635#
636# CONFIG_NEW_LEDS is not set
637
638#
639# LED drivers
640#
641
642#
643# LED Triggers
644#
645
646#
647# InfiniBand support
648#
649
650#
651# EDAC - error detection and reporting (RAS) (EXPERIMENTAL)
652#
653
654#
655# Real Time Clock
656#
657
658#
659# DMA Engine support
660#
661# CONFIG_DMA_ENGINE is not set
662
663#
664# DMA Clients
665#
666
667#
668# DMA Devices
669#
670
671#
672# Auxiliary Display support
673#
674
675#
676# Virtualization
677#
678
679#
680# File systems
681#
682# CONFIG_EXT2_FS is not set
683# CONFIG_EXT3_FS is not set
684# CONFIG_REISERFS_FS is not set
685# CONFIG_JFS_FS is not set
686CONFIG_FS_POSIX_ACL=y
687# CONFIG_XFS_FS is not set
688# CONFIG_OCFS2_FS is not set
689# CONFIG_MINIX_FS is not set
690# CONFIG_ROMFS_FS is not set
691CONFIG_INOTIFY=y
692CONFIG_INOTIFY_USER=y
693# CONFIG_QUOTA is not set
694# CONFIG_DNOTIFY is not set
695# CONFIG_AUTOFS_FS is not set
696# CONFIG_AUTOFS4_FS is not set
697CONFIG_FUSE_FS=y
698CONFIG_GENERIC_ACL=y
699
700#
701# CD-ROM/DVD Filesystems
702#
703# CONFIG_ISO9660_FS is not set
704# CONFIG_UDF_FS is not set
705
706#
707# DOS/FAT/NT Filesystems
708#
709# CONFIG_MSDOS_FS is not set
710# CONFIG_VFAT_FS is not set
711# CONFIG_NTFS_FS is not set
712
713#
714# Pseudo filesystems
715#
716CONFIG_PROC_FS=y
717CONFIG_PROC_KCORE=y
718CONFIG_PROC_SYSCTL=y
719CONFIG_SYSFS=y
720CONFIG_TMPFS=y
721CONFIG_TMPFS_POSIX_ACL=y
722# CONFIG_HUGETLB_PAGE is not set
723CONFIG_RAMFS=y
724
725#
726# Miscellaneous filesystems
727#
728# CONFIG_HFSPLUS_FS is not set
729# CONFIG_CRAMFS is not set
730# CONFIG_VXFS_FS is not set
731# CONFIG_HPFS_FS is not set
732# CONFIG_QNX4FS_FS is not set
733# CONFIG_SYSV_FS is not set
734# CONFIG_UFS_FS is not set
735
736#
737# Network File Systems
738#
739CONFIG_NFS_FS=y
740CONFIG_NFS_V3=y
741# CONFIG_NFS_V3_ACL is not set
742CONFIG_NFS_DIRECTIO=y
743# CONFIG_NFSD is not set
744CONFIG_ROOT_NFS=y
745CONFIG_LOCKD=y
746CONFIG_LOCKD_V4=y
747CONFIG_NFS_COMMON=y
748CONFIG_SUNRPC=y
749# CONFIG_SMB_FS is not set
750# CONFIG_CIFS is not set
751# CONFIG_NCP_FS is not set
752# CONFIG_CODA_FS is not set
753
754#
755# Partition Types
756#
757# CONFIG_PARTITION_ADVANCED is not set
758CONFIG_MSDOS_PARTITION=y
759
760#
761# Native Language Support
762#
763# CONFIG_NLS is not set
764
765#
766# Kernel hacking
767#
768CONFIG_TRACE_IRQFLAGS_SUPPORT=y
769# CONFIG_PRINTK_TIME is not set
770CONFIG_ENABLE_MUST_CHECK=y
771# CONFIG_MAGIC_SYSRQ is not set
772# CONFIG_UNUSED_SYMBOLS is not set
773# CONFIG_DEBUG_FS is not set
774# CONFIG_HEADERS_CHECK is not set
775# CONFIG_DEBUG_KERNEL is not set
776CONFIG_LOG_BUF_SHIFT=14
777CONFIG_CROSSCOMPILE=y
778CONFIG_CMDLINE=""
779
780#
781# Security options
782#
783# CONFIG_KEYS is not set
784# CONFIG_SECURITY is not set
785
786#
787# Cryptographic options
788#
789# CONFIG_CRYPTO is not set
790
791#
792# Library routines
793#
794CONFIG_BITREVERSE=y
795# CONFIG_CRC_CCITT is not set
796# CONFIG_CRC16 is not set
797CONFIG_CRC32=y
798# CONFIG_LIBCRC32C is not set
799CONFIG_HAS_IOMEM=y
800CONFIG_HAS_IOPORT=y
diff --git a/arch/mips/kernel/irq-rm7000.c b/arch/mips/kernel/irq-rm7000.c
index 971adf6ef4f4..fb50cc78b28b 100644
--- a/arch/mips/kernel/irq-rm7000.c
+++ b/arch/mips/kernel/irq-rm7000.c
@@ -33,6 +33,7 @@ static struct irq_chip rm7k_irq_controller = {
33 .mask = mask_rm7k_irq, 33 .mask = mask_rm7k_irq,
34 .mask_ack = mask_rm7k_irq, 34 .mask_ack = mask_rm7k_irq,
35 .unmask = unmask_rm7k_irq, 35 .unmask = unmask_rm7k_irq,
36 .eoi = unmask_rm7k_irq
36}; 37};
37 38
38void __init rm7k_cpu_irq_init(void) 39void __init rm7k_cpu_irq_init(void)
diff --git a/arch/mips/kernel/irq-rm9000.c b/arch/mips/kernel/irq-rm9000.c
index 7b04583bd800..ed9febe63d72 100644
--- a/arch/mips/kernel/irq-rm9000.c
+++ b/arch/mips/kernel/irq-rm9000.c
@@ -75,6 +75,7 @@ static struct irq_chip rm9k_irq_controller = {
75 .mask = mask_rm9k_irq, 75 .mask = mask_rm9k_irq,
76 .mask_ack = mask_rm9k_irq, 76 .mask_ack = mask_rm9k_irq,
77 .unmask = unmask_rm9k_irq, 77 .unmask = unmask_rm9k_irq,
78 .eoi = unmask_rm9k_irq
78}; 79};
79 80
80static struct irq_chip rm9k_perfcounter_irq = { 81static struct irq_chip rm9k_perfcounter_irq = {
diff --git a/arch/mips/kernel/mips-mt-fpaff.c b/arch/mips/kernel/mips-mt-fpaff.c
index bb4f00c0cbe9..df4d3f2f740c 100644
--- a/arch/mips/kernel/mips-mt-fpaff.c
+++ b/arch/mips/kernel/mips-mt-fpaff.c
@@ -36,7 +36,7 @@ unsigned long mt_fpemul_threshold = 0;
36 */ 36 */
37static inline struct task_struct *find_process_by_pid(pid_t pid) 37static inline struct task_struct *find_process_by_pid(pid_t pid)
38{ 38{
39 return pid ? find_task_by_pid(pid) : current; 39 return pid ? find_task_by_vpid(pid) : current;
40} 40}
41 41
42 42
diff --git a/arch/mips/kernel/scall32-o32.S b/arch/mips/kernel/scall32-o32.S
index f798139e888e..08a9c5070ea8 100644
--- a/arch/mips/kernel/scall32-o32.S
+++ b/arch/mips/kernel/scall32-o32.S
@@ -663,6 +663,9 @@ einval: li v0, -EINVAL
663 sys sys_ni_syscall 0 663 sys sys_ni_syscall 0
664 sys sys_eventfd 1 664 sys sys_eventfd 1
665 sys sys_fallocate 6 /* 4320 */ 665 sys sys_fallocate 6 /* 4320 */
666 sys sys_timerfd_create 2
667 sys sys_timerfd_gettime 2
668 sys sys_timerfd_settime 4
666 .endm 669 .endm
667 670
668 /* We pre-compute the number of _instruction_ bytes needed to 671 /* We pre-compute the number of _instruction_ bytes needed to
diff --git a/arch/mips/kernel/scall64-64.S b/arch/mips/kernel/scall64-64.S
index a626be6baea3..dc597b600c68 100644
--- a/arch/mips/kernel/scall64-64.S
+++ b/arch/mips/kernel/scall64-64.S
@@ -478,4 +478,7 @@ sys_call_table:
478 PTR sys_ni_syscall 478 PTR sys_ni_syscall
479 PTR sys_eventfd 479 PTR sys_eventfd
480 PTR sys_fallocate 480 PTR sys_fallocate
481 PTR sys_timerfd_create /* 5280 */
482 PTR sys_timerfd_gettime
483 PTR sys_timerfd_settime
481 .size sys_call_table,.-sys_call_table 484 .size sys_call_table,.-sys_call_table
diff --git a/arch/mips/kernel/scall64-n32.S b/arch/mips/kernel/scall64-n32.S
index 9d5bcaf1b389..12940eca7893 100644
--- a/arch/mips/kernel/scall64-n32.S
+++ b/arch/mips/kernel/scall64-n32.S
@@ -404,4 +404,7 @@ EXPORT(sysn32_call_table)
404 PTR sys_ni_syscall 404 PTR sys_ni_syscall
405 PTR sys_eventfd 405 PTR sys_eventfd
406 PTR sys_fallocate 406 PTR sys_fallocate
407 PTR sys_timerfd_create
408 PTR sys_timerfd_gettime /* 5285 */
409 PTR sys_timerfd_settime
407 .size sysn32_call_table,.-sysn32_call_table 410 .size sysn32_call_table,.-sysn32_call_table
diff --git a/arch/mips/kernel/scall64-o32.S b/arch/mips/kernel/scall64-o32.S
index fd2019c1ec2d..9a275efb4f04 100644
--- a/arch/mips/kernel/scall64-o32.S
+++ b/arch/mips/kernel/scall64-o32.S
@@ -526,4 +526,7 @@ sys_call_table:
526 PTR sys_ni_syscall 526 PTR sys_ni_syscall
527 PTR sys_eventfd 527 PTR sys_eventfd
528 PTR sys32_fallocate /* 4320 */ 528 PTR sys32_fallocate /* 4320 */
529 PTR sys_timerfd_create
530 PTR sys_timerfd_gettime
531 PTR sys_timerfd_settime
529 .size sys_call_table,.-sys_call_table 532 .size sys_call_table,.-sys_call_table
diff --git a/arch/mips/kernel/sysirix.c b/arch/mips/kernel/sysirix.c
index 672fba84b2cc..c357762b8012 100644
--- a/arch/mips/kernel/sysirix.c
+++ b/arch/mips/kernel/sysirix.c
@@ -111,7 +111,7 @@ asmlinkage int irix_prctl(unsigned option, ...)
111 printk("irix_prctl[%s:%d]: Wants PR_ISBLOCKED\n", 111 printk("irix_prctl[%s:%d]: Wants PR_ISBLOCKED\n",
112 current->comm, current->pid); 112 current->comm, current->pid);
113 read_lock(&tasklist_lock); 113 read_lock(&tasklist_lock);
114 task = find_task_by_pid(va_arg(args, pid_t)); 114 task = find_task_by_vpid(va_arg(args, pid_t));
115 error = -ESRCH; 115 error = -ESRCH;
116 if (error) 116 if (error)
117 error = (task->run_list.next != NULL); 117 error = (task->run_list.next != NULL);
diff --git a/arch/mips/mm/c-r4k.c b/arch/mips/mm/c-r4k.c
index 53ec05267a98..2c4f7e11f0d5 100644
--- a/arch/mips/mm/c-r4k.c
+++ b/arch/mips/mm/c-r4k.c
@@ -364,20 +364,23 @@ static inline int has_valid_asid(const struct mm_struct *mm)
364static inline void local_r4k_flush_cache_range(void * args) 364static inline void local_r4k_flush_cache_range(void * args)
365{ 365{
366 struct vm_area_struct *vma = args; 366 struct vm_area_struct *vma = args;
367 int exec = vma->vm_flags & VM_EXEC;
367 368
368 if (!(has_valid_asid(vma->vm_mm))) 369 if (!(has_valid_asid(vma->vm_mm)))
369 return; 370 return;
370 371
371 r4k_blast_dcache(); 372 r4k_blast_dcache();
373 if (exec)
374 r4k_blast_icache();
372} 375}
373 376
374static void r4k_flush_cache_range(struct vm_area_struct *vma, 377static void r4k_flush_cache_range(struct vm_area_struct *vma,
375 unsigned long start, unsigned long end) 378 unsigned long start, unsigned long end)
376{ 379{
377 if (!cpu_has_dc_aliases) 380 int exec = vma->vm_flags & VM_EXEC;
378 return;
379 381
380 r4k_on_each_cpu(local_r4k_flush_cache_range, vma, 1, 1); 382 if (cpu_has_dc_aliases || (exec && !cpu_has_ic_fills_f_dc))
383 r4k_on_each_cpu(local_r4k_flush_cache_range, vma, 1, 1);
381} 384}
382 385
383static inline void local_r4k_flush_cache_mm(void * args) 386static inline void local_r4k_flush_cache_mm(void * args)
diff --git a/arch/mips/mm/cache.c b/arch/mips/mm/cache.c
index 81f30ac2bff9..6a24651971df 100644
--- a/arch/mips/mm/cache.c
+++ b/arch/mips/mm/cache.c
@@ -92,12 +92,17 @@ EXPORT_SYMBOL(__flush_dcache_page);
92 92
93void __flush_anon_page(struct page *page, unsigned long vmaddr) 93void __flush_anon_page(struct page *page, unsigned long vmaddr)
94{ 94{
95 if (pages_do_alias((unsigned long)page_address(page), vmaddr)) { 95 unsigned long addr = (unsigned long) page_address(page);
96 void *kaddr;
97 96
98 kaddr = kmap_coherent(page, vmaddr); 97 if (pages_do_alias(addr, vmaddr)) {
99 flush_data_cache_page((unsigned long)kaddr); 98 if (page_mapped(page) && !Page_dcache_dirty(page)) {
100 kunmap_coherent(); 99 void *kaddr;
100
101 kaddr = kmap_coherent(page, vmaddr);
102 flush_data_cache_page((unsigned long)kaddr);
103 kunmap_coherent();
104 } else
105 flush_data_cache_page(addr);
101 } 106 }
102} 107}
103 108
diff --git a/arch/mips/mm/init.c b/arch/mips/mm/init.c
index 480dec04f552..c7aed133d11d 100644
--- a/arch/mips/mm/init.c
+++ b/arch/mips/mm/init.c
@@ -211,7 +211,8 @@ void copy_user_highpage(struct page *to, struct page *from,
211 void *vfrom, *vto; 211 void *vfrom, *vto;
212 212
213 vto = kmap_atomic(to, KM_USER1); 213 vto = kmap_atomic(to, KM_USER1);
214 if (cpu_has_dc_aliases && page_mapped(from)) { 214 if (cpu_has_dc_aliases &&
215 page_mapped(from) && !Page_dcache_dirty(from)) {
215 vfrom = kmap_coherent(from, vaddr); 216 vfrom = kmap_coherent(from, vaddr);
216 copy_page(vto, vfrom); 217 copy_page(vto, vfrom);
217 kunmap_coherent(); 218 kunmap_coherent();
@@ -234,7 +235,8 @@ void copy_to_user_page(struct vm_area_struct *vma,
234 struct page *page, unsigned long vaddr, void *dst, const void *src, 235 struct page *page, unsigned long vaddr, void *dst, const void *src,
235 unsigned long len) 236 unsigned long len)
236{ 237{
237 if (cpu_has_dc_aliases && page_mapped(page)) { 238 if (cpu_has_dc_aliases &&
239 page_mapped(page) && !Page_dcache_dirty(page)) {
238 void *vto = kmap_coherent(page, vaddr) + (vaddr & ~PAGE_MASK); 240 void *vto = kmap_coherent(page, vaddr) + (vaddr & ~PAGE_MASK);
239 memcpy(vto, src, len); 241 memcpy(vto, src, len);
240 kunmap_coherent(); 242 kunmap_coherent();
@@ -253,7 +255,8 @@ void copy_from_user_page(struct vm_area_struct *vma,
253 struct page *page, unsigned long vaddr, void *dst, const void *src, 255 struct page *page, unsigned long vaddr, void *dst, const void *src,
254 unsigned long len) 256 unsigned long len)
255{ 257{
256 if (cpu_has_dc_aliases && page_mapped(page)) { 258 if (cpu_has_dc_aliases &&
259 page_mapped(page) && !Page_dcache_dirty(page)) {
257 void *vfrom = kmap_coherent(page, vaddr) + (vaddr & ~PAGE_MASK); 260 void *vfrom = kmap_coherent(page, vaddr) + (vaddr & ~PAGE_MASK);
258 memcpy(dst, vfrom, len); 261 memcpy(dst, vfrom, len);
259 kunmap_coherent(); 262 kunmap_coherent();
diff --git a/arch/mips/mm/pg-sb1.c b/arch/mips/mm/pg-sb1.c
index a3e98c243a89..89925ec57d6a 100644
--- a/arch/mips/mm/pg-sb1.c
+++ b/arch/mips/mm/pg-sb1.c
@@ -216,7 +216,7 @@ void sb1_dma_init(void)
216 int i; 216 int i;
217 217
218 for (i = 0; i < DM_NUM_CHANNELS; i++) { 218 for (i = 0; i < DM_NUM_CHANNELS; i++) {
219 const u64 base_val = CPHYSADDR(&page_descr[i]) | 219 const u64 base_val = CPHYSADDR((unsigned long)&page_descr[i]) |
220 V_DM_DSCR_BASE_RINGSZ(1); 220 V_DM_DSCR_BASE_RINGSZ(1);
221 void *base_reg = IOADDR(A_DM_REGISTER(i, R_DM_DSCR_BASE)); 221 void *base_reg = IOADDR(A_DM_REGISTER(i, R_DM_DSCR_BASE));
222 222
@@ -228,11 +228,11 @@ void sb1_dma_init(void)
228 228
229void clear_page(void *page) 229void clear_page(void *page)
230{ 230{
231 u64 to_phys = CPHYSADDR(page); 231 u64 to_phys = CPHYSADDR((unsigned long)page);
232 unsigned int cpu = smp_processor_id(); 232 unsigned int cpu = smp_processor_id();
233 233
234 /* if the page is not in KSEG0, use old way */ 234 /* if the page is not in KSEG0, use old way */
235 if ((long)KSEGX(page) != (long)CKSEG0) 235 if ((long)KSEGX((unsigned long)page) != (long)CKSEG0)
236 return clear_page_cpu(page); 236 return clear_page_cpu(page);
237 237
238 page_descr[cpu].dscr_a = to_phys | M_DM_DSCRA_ZERO_MEM | 238 page_descr[cpu].dscr_a = to_phys | M_DM_DSCRA_ZERO_MEM |
@@ -252,13 +252,13 @@ void clear_page(void *page)
252 252
253void copy_page(void *to, void *from) 253void copy_page(void *to, void *from)
254{ 254{
255 u64 from_phys = CPHYSADDR(from); 255 u64 from_phys = CPHYSADDR((unsigned long)from);
256 u64 to_phys = CPHYSADDR(to); 256 u64 to_phys = CPHYSADDR((unsigned long)to);
257 unsigned int cpu = smp_processor_id(); 257 unsigned int cpu = smp_processor_id();
258 258
259 /* if any page is not in KSEG0, use old way */ 259 /* if any page is not in KSEG0, use old way */
260 if ((long)KSEGX(to) != (long)CKSEG0 260 if ((long)KSEGX((unsigned long)to) != (long)CKSEG0
261 || (long)KSEGX(from) != (long)CKSEG0) 261 || (long)KSEGX((unsigned long)from) != (long)CKSEG0)
262 return copy_page_cpu(to, from); 262 return copy_page_cpu(to, from);
263 263
264 page_descr[cpu].dscr_a = to_phys | M_DM_DSCRA_L2C_DEST | 264 page_descr[cpu].dscr_a = to_phys | M_DM_DSCRA_L2C_DEST |
diff --git a/arch/mips/pci/pci.c b/arch/mips/pci/pci.c
index 6e6981fd7934..f9471d77c096 100644
--- a/arch/mips/pci/pci.c
+++ b/arch/mips/pci/pci.c
@@ -177,8 +177,15 @@ static int pcibios_enable_resources(struct pci_dev *dev, int mask)
177 continue; 177 continue;
178 178
179 r = &dev->resource[idx]; 179 r = &dev->resource[idx];
180 if (!(r->flags & (IORESOURCE_IO | IORESOURCE_MEM)))
181 continue;
182 if ((idx == PCI_ROM_RESOURCE) &&
183 (!(r->flags & IORESOURCE_ROM_ENABLE)))
184 continue;
180 if (!r->start && r->end) { 185 if (!r->start && r->end) {
181 printk(KERN_ERR "PCI: Device %s not available because of resource collisions\n", pci_name(dev)); 186 printk(KERN_ERR "PCI: Device %s not available "
187 "because of resource collisions\n",
188 pci_name(dev));
182 return -EINVAL; 189 return -EINVAL;
183 } 190 }
184 if (r->flags & IORESOURCE_IO) 191 if (r->flags & IORESOURCE_IO)
@@ -186,10 +193,9 @@ static int pcibios_enable_resources(struct pci_dev *dev, int mask)
186 if (r->flags & IORESOURCE_MEM) 193 if (r->flags & IORESOURCE_MEM)
187 cmd |= PCI_COMMAND_MEMORY; 194 cmd |= PCI_COMMAND_MEMORY;
188 } 195 }
189 if (dev->resource[PCI_ROM_RESOURCE].start)
190 cmd |= PCI_COMMAND_MEMORY;
191 if (cmd != old_cmd) { 196 if (cmd != old_cmd) {
192 printk("PCI: Enabling device %s (%04x -> %04x)\n", pci_name(dev), old_cmd, cmd); 197 printk("PCI: Enabling device %s (%04x -> %04x)\n",
198 pci_name(dev), old_cmd, cmd);
193 pci_write_config_word(dev, PCI_COMMAND, cmd); 199 pci_write_config_word(dev, PCI_COMMAND, cmd);
194 } 200 }
195 return 0; 201 return 0;
diff --git a/arch/mips/sibyte/bcm1480/smp.c b/arch/mips/sibyte/bcm1480/smp.c
index 183c460b9ca1..bd9eeb43ed0e 100644
--- a/arch/mips/sibyte/bcm1480/smp.c
+++ b/arch/mips/sibyte/bcm1480/smp.c
@@ -110,7 +110,6 @@ static void __cpuinit bcm1480_smp_finish(void)
110 110
111 sb1480_clockevent_init(); 111 sb1480_clockevent_init();
112 local_irq_enable(); 112 local_irq_enable();
113 bcm1480_smp_finish();
114} 113}
115 114
116/* 115/*
diff --git a/arch/mn10300/configs/asb2303_defconfig b/arch/mn10300/configs/asb2303_defconfig
index ca9876a111d3..3aa8906b3dea 100644
--- a/arch/mn10300/configs/asb2303_defconfig
+++ b/arch/mn10300/configs/asb2303_defconfig
@@ -1,7 +1,7 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.24-rc2 3# Linux kernel version: 2.6.25-rc2
4# Fri Nov 16 13:36:38 2007 4# Tue Feb 19 18:52:24 2008
5# 5#
6CONFIG_MN10300=y 6CONFIG_MN10300=y
7CONFIG_AM33=y 7CONFIG_AM33=y
@@ -21,6 +21,7 @@ CONFIG_ARCH_HAS_ILOG2_U32=y
21# CONFIG_ARCH_SUPPORTS_AOUT is not set 21# CONFIG_ARCH_SUPPORTS_AOUT is not set
22CONFIG_GENERIC_HARDIRQS=y 22CONFIG_GENERIC_HARDIRQS=y
23# CONFIG_HOTPLUG_CPU is not set 23# CONFIG_HOTPLUG_CPU is not set
24CONFIG_HZ=1000
24CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 25CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
25 26
26# 27#
@@ -38,15 +39,16 @@ CONFIG_SYSVIPC_SYSCTL=y
38CONFIG_BSD_PROCESS_ACCT=y 39CONFIG_BSD_PROCESS_ACCT=y
39# CONFIG_BSD_PROCESS_ACCT_V3 is not set 40# CONFIG_BSD_PROCESS_ACCT_V3 is not set
40# CONFIG_TASKSTATS is not set 41# CONFIG_TASKSTATS is not set
41# CONFIG_USER_NS is not set
42# CONFIG_PID_NS is not set
43# CONFIG_AUDIT is not set 42# CONFIG_AUDIT is not set
44# CONFIG_IKCONFIG is not set 43# CONFIG_IKCONFIG is not set
45CONFIG_LOG_BUF_SHIFT=14 44CONFIG_LOG_BUF_SHIFT=14
46# CONFIG_CGROUPS is not set 45# CONFIG_CGROUPS is not set
47# CONFIG_FAIR_GROUP_SCHED is not set 46# CONFIG_GROUP_SCHED is not set
47# CONFIG_USER_SCHED is not set
48# CONFIG_CGROUP_SCHED is not set
48# CONFIG_SYSFS_DEPRECATED is not set 49# CONFIG_SYSFS_DEPRECATED is not set
49# CONFIG_RELAY is not set 50# CONFIG_RELAY is not set
51# CONFIG_NAMESPACES is not set
50# CONFIG_BLK_DEV_INITRD is not set 52# CONFIG_BLK_DEV_INITRD is not set
51# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 53# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
52CONFIG_SYSCTL=y 54CONFIG_SYSCTL=y
@@ -57,22 +59,33 @@ CONFIG_SYSCTL_SYSCALL=y
57CONFIG_PRINTK=y 59CONFIG_PRINTK=y
58CONFIG_BUG=y 60CONFIG_BUG=y
59CONFIG_ELF_CORE=y 61CONFIG_ELF_CORE=y
62CONFIG_COMPAT_BRK=y
60CONFIG_BASE_FULL=y 63CONFIG_BASE_FULL=y
61CONFIG_FUTEX=y 64CONFIG_FUTEX=y
62CONFIG_ANON_INODES=y 65CONFIG_ANON_INODES=y
63CONFIG_EPOLL=y 66CONFIG_EPOLL=y
64CONFIG_SIGNALFD=y 67CONFIG_SIGNALFD=y
68CONFIG_TIMERFD=y
65CONFIG_EVENTFD=y 69CONFIG_EVENTFD=y
66CONFIG_SHMEM=y 70CONFIG_SHMEM=y
67# CONFIG_VM_EVENT_COUNTERS is not set 71# CONFIG_VM_EVENT_COUNTERS is not set
68CONFIG_SLAB=y 72CONFIG_SLAB=y
69# CONFIG_SLUB is not set 73# CONFIG_SLUB is not set
70# CONFIG_SLOB is not set 74# CONFIG_SLOB is not set
75CONFIG_PROFILING=y
76# CONFIG_MARKERS is not set
77CONFIG_OPROFILE=y
78# CONFIG_HAVE_OPROFILE is not set
79# CONFIG_HAVE_KPROBES is not set
80# CONFIG_PROC_PAGE_MONITOR is not set
81CONFIG_SLABINFO=y
71CONFIG_RT_MUTEXES=y 82CONFIG_RT_MUTEXES=y
72# CONFIG_TINY_SHMEM is not set 83# CONFIG_TINY_SHMEM is not set
73CONFIG_BASE_SMALL=0 84CONFIG_BASE_SMALL=0
74# CONFIG_MODULES is not set 85# CONFIG_MODULES is not set
75# CONFIG_BLOCK is not set 86# CONFIG_BLOCK is not set
87CONFIG_CLASSIC_RCU=y
88# CONFIG_PREEMPT_RCU is not set
76 89
77# 90#
78# Matsushita MN10300 system setup 91# Matsushita MN10300 system setup
@@ -206,6 +219,7 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
206# 219#
207# CONFIG_NET_PKTGEN is not set 220# CONFIG_NET_PKTGEN is not set
208# CONFIG_HAMRADIO is not set 221# CONFIG_HAMRADIO is not set
222# CONFIG_CAN is not set
209# CONFIG_IRDA is not set 223# CONFIG_IRDA is not set
210# CONFIG_BT is not set 224# CONFIG_BT is not set
211# CONFIG_AF_RXRPC is not set 225# CONFIG_AF_RXRPC is not set
@@ -311,6 +325,8 @@ CONFIG_MTD_PHYSMAP_BANKWIDTH=2
311# CONFIG_PARPORT is not set 325# CONFIG_PARPORT is not set
312CONFIG_MISC_DEVICES=y 326CONFIG_MISC_DEVICES=y
313# CONFIG_EEPROM_93CX6 is not set 327# CONFIG_EEPROM_93CX6 is not set
328# CONFIG_ENCLOSURE_SERVICES is not set
329# CONFIG_HAVE_IDE is not set
314 330
315# 331#
316# SCSI device support 332# SCSI device support
@@ -345,7 +361,6 @@ CONFIG_SMC91X=y
345# CONFIG_WAN is not set 361# CONFIG_WAN is not set
346# CONFIG_PPP is not set 362# CONFIG_PPP is not set
347# CONFIG_SLIP is not set 363# CONFIG_SLIP is not set
348# CONFIG_SHAPER is not set
349# CONFIG_NETCONSOLE is not set 364# CONFIG_NETCONSOLE is not set
350# CONFIG_NETPOLL is not set 365# CONFIG_NETPOLL is not set
351# CONFIG_NET_POLL_CONTROLLER is not set 366# CONFIG_NET_POLL_CONTROLLER is not set
@@ -405,6 +420,7 @@ CONFIG_RTC=y
405# CONFIG_W1 is not set 420# CONFIG_W1 is not set
406# CONFIG_POWER_SUPPLY is not set 421# CONFIG_POWER_SUPPLY is not set
407# CONFIG_HWMON is not set 422# CONFIG_HWMON is not set
423# CONFIG_THERMAL is not set
408# CONFIG_WATCHDOG is not set 424# CONFIG_WATCHDOG is not set
409 425
410# 426#
@@ -444,6 +460,7 @@ CONFIG_SSB_POSSIBLE=y
444# CONFIG_SOUND is not set 460# CONFIG_SOUND is not set
445# CONFIG_USB_SUPPORT is not set 461# CONFIG_USB_SUPPORT is not set
446# CONFIG_MMC is not set 462# CONFIG_MMC is not set
463# CONFIG_MEMSTICK is not set
447# CONFIG_NEW_LEDS is not set 464# CONFIG_NEW_LEDS is not set
448# CONFIG_RTC_CLASS is not set 465# CONFIG_RTC_CLASS is not set
449 466
@@ -455,10 +472,10 @@ CONFIG_SSB_POSSIBLE=y
455# 472#
456# File systems 473# File systems
457# 474#
475CONFIG_DNOTIFY=y
458CONFIG_INOTIFY=y 476CONFIG_INOTIFY=y
459CONFIG_INOTIFY_USER=y 477CONFIG_INOTIFY_USER=y
460# CONFIG_QUOTA is not set 478# CONFIG_QUOTA is not set
461CONFIG_DNOTIFY=y
462# CONFIG_AUTOFS_FS is not set 479# CONFIG_AUTOFS_FS is not set
463# CONFIG_AUTOFS4_FS is not set 480# CONFIG_AUTOFS4_FS is not set
464# CONFIG_FUSE_FS is not set 481# CONFIG_FUSE_FS is not set
@@ -554,5 +571,3 @@ CONFIG_HAS_DMA=y
554# 571#
555# Profiling support 572# Profiling support
556# 573#
557CONFIG_PROFILING=y
558CONFIG_OPROFILE=y
diff --git a/arch/mn10300/kernel/gdb-io-ttysm.c b/arch/mn10300/kernel/gdb-io-ttysm.c
index c5451592d403..e94c25e8ca05 100644
--- a/arch/mn10300/kernel/gdb-io-ttysm.c
+++ b/arch/mn10300/kernel/gdb-io-ttysm.c
@@ -196,6 +196,7 @@ int gdbstub_io_rx_char(unsigned char *_ch, int nonblock)
196try_again: 196try_again:
197 /* pull chars out of the buffer */ 197 /* pull chars out of the buffer */
198 ix = gdbstub_rx_outp; 198 ix = gdbstub_rx_outp;
199 barrier();
199 if (ix == gdbstub_rx_inp) { 200 if (ix == gdbstub_rx_inp) {
200 if (nonblock) 201 if (nonblock)
201 return -EAGAIN; 202 return -EAGAIN;
@@ -207,6 +208,7 @@ try_again:
207 208
208 ch = gdbstub_rx_buffer[ix++]; 209 ch = gdbstub_rx_buffer[ix++];
209 st = gdbstub_rx_buffer[ix++]; 210 st = gdbstub_rx_buffer[ix++];
211 barrier();
210 gdbstub_rx_outp = ix & (PAGE_SIZE - 1); 212 gdbstub_rx_outp = ix & (PAGE_SIZE - 1);
211 213
212 st &= SC01STR_RXF | SC01STR_RBF | SC01STR_FEF | SC01STR_PEF | 214 st &= SC01STR_RXF | SC01STR_RBF | SC01STR_FEF | SC01STR_PEF |
diff --git a/arch/mn10300/kernel/time.c b/arch/mn10300/kernel/time.c
index ff492e3b3457..babb7c2ac377 100644
--- a/arch/mn10300/kernel/time.c
+++ b/arch/mn10300/kernel/time.c
@@ -84,11 +84,13 @@ static irqreturn_t timer_interrupt(int irq, void *dev_id)
84 /* advance the kernel's time tracking system */ 84 /* advance the kernel's time tracking system */
85 profile_tick(CPU_PROFILING); 85 profile_tick(CPU_PROFILING);
86 do_timer(1); 86 do_timer(1);
87 update_process_times(user_mode(get_irq_regs()));
88 check_rtc_time(); 87 check_rtc_time();
89 } 88 }
90 89
91 write_sequnlock(&xtime_lock); 90 write_sequnlock(&xtime_lock);
91
92 update_process_times(user_mode(get_irq_regs()));
93
92 return IRQ_HANDLED; 94 return IRQ_HANDLED;
93} 95}
94 96
diff --git a/arch/mn10300/kernel/traps.c b/arch/mn10300/kernel/traps.c
index 8b9dc6d9dcc6..fcb9a03d46a8 100644
--- a/arch/mn10300/kernel/traps.c
+++ b/arch/mn10300/kernel/traps.c
@@ -391,7 +391,7 @@ static asmlinkage void unsupported_syscall(struct pt_regs *regs,
391 if (code == EXCEP_SYSCALL15 && !user_mode(regs)) { 391 if (code == EXCEP_SYSCALL15 && !user_mode(regs)) {
392 if (report_bug(regs->pc, regs) == BUG_TRAP_TYPE_BUG) { 392 if (report_bug(regs->pc, regs) == BUG_TRAP_TYPE_BUG) {
393#ifdef CONFIG_GDBSTUB 393#ifdef CONFIG_GDBSTUB
394 __gdbstub_bug_trap(); 394 gdbstub_intercept(regs, code);
395#endif 395#endif
396 } 396 }
397 } 397 }
diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile
index 6845482f0093..1c6ce3536e4c 100644
--- a/arch/powerpc/Makefile
+++ b/arch/powerpc/Makefile
@@ -176,7 +176,7 @@ define archhelp
176 @echo ' *_defconfig - Select default config from arch/$(ARCH)/configs' 176 @echo ' *_defconfig - Select default config from arch/$(ARCH)/configs'
177endef 177endef
178 178
179install: vdso_install 179install:
180 $(Q)$(MAKE) $(build)=$(boot) install 180 $(Q)$(MAKE) $(build)=$(boot) install
181 181
182vdso_install: 182vdso_install:
diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig
index 92a4f7b4323a..b21444b681b6 100644
--- a/arch/s390/Kconfig
+++ b/arch/s390/Kconfig
@@ -100,7 +100,8 @@ config NR_CPUS
100 int "Maximum number of CPUs (2-64)" 100 int "Maximum number of CPUs (2-64)"
101 range 2 64 101 range 2 64
102 depends on SMP 102 depends on SMP
103 default "32" 103 default "32" if !64BIT
104 default "64" if 64BIT
104 help 105 help
105 This allows you to specify the maximum number of CPUs which this 106 This allows you to specify the maximum number of CPUs which this
106 kernel will support. The maximum supported value is 64 and the 107 kernel will support. The maximum supported value is 64 and the
diff --git a/arch/s390/kernel/process.c b/arch/s390/kernel/process.c
index a6a4729e0e94..1c59ec161cf8 100644
--- a/arch/s390/kernel/process.c
+++ b/arch/s390/kernel/process.c
@@ -114,24 +114,27 @@ extern void s390_handle_mcck(void);
114static void default_idle(void) 114static void default_idle(void)
115{ 115{
116 int cpu, rc; 116 int cpu, rc;
117 int nr_calls = 0;
118 void *hcpu;
117#ifdef CONFIG_SMP 119#ifdef CONFIG_SMP
118 struct s390_idle_data *idle; 120 struct s390_idle_data *idle;
119#endif 121#endif
120 122
121 /* CPU is going idle. */ 123 /* CPU is going idle. */
122 cpu = smp_processor_id(); 124 cpu = smp_processor_id();
123 125 hcpu = (void *)(long)cpu;
124 local_irq_disable(); 126 local_irq_disable();
125 if (need_resched()) { 127 if (need_resched()) {
126 local_irq_enable(); 128 local_irq_enable();
127 return; 129 return;
128 } 130 }
129 131
130 rc = atomic_notifier_call_chain(&idle_chain, 132 rc = __atomic_notifier_call_chain(&idle_chain, S390_CPU_IDLE, hcpu, -1,
131 S390_CPU_IDLE, (void *)(long) cpu); 133 &nr_calls);
132 if (rc != NOTIFY_OK && rc != NOTIFY_DONE) 134 if (rc == NOTIFY_BAD) {
133 BUG(); 135 nr_calls--;
134 if (rc != NOTIFY_OK) { 136 __atomic_notifier_call_chain(&idle_chain, S390_CPU_NOT_IDLE,
137 hcpu, nr_calls, NULL);
135 local_irq_enable(); 138 local_irq_enable();
136 return; 139 return;
137 } 140 }
diff --git a/arch/s390/kernel/smp.c b/arch/s390/kernel/smp.c
index 85060659fb12..818bd09c0260 100644
--- a/arch/s390/kernel/smp.c
+++ b/arch/s390/kernel/smp.c
@@ -626,13 +626,17 @@ static int __cpuinit smp_alloc_lowcore(int cpu)
626 if (!lowcore) 626 if (!lowcore)
627 return -ENOMEM; 627 return -ENOMEM;
628 async_stack = __get_free_pages(GFP_KERNEL, ASYNC_ORDER); 628 async_stack = __get_free_pages(GFP_KERNEL, ASYNC_ORDER);
629 if (!async_stack)
630 goto out_async_stack;
631 panic_stack = __get_free_page(GFP_KERNEL); 629 panic_stack = __get_free_page(GFP_KERNEL);
632 if (!panic_stack) 630 if (!panic_stack || !async_stack)
633 goto out_panic_stack; 631 goto out;
634 632 /*
635 *lowcore = S390_lowcore; 633 * Only need to copy the first 512 bytes from address 0. But since
634 * the compiler emits a warning if src == NULL for memcpy use copy_page
635 * instead. Copies more than needed but this code is not performance
636 * critical.
637 */
638 copy_page(lowcore, &S390_lowcore);
639 memset((void *)lowcore + 512, 0, sizeof(*lowcore) - 512);
636 lowcore->async_stack = async_stack + ASYNC_SIZE; 640 lowcore->async_stack = async_stack + ASYNC_SIZE;
637 lowcore->panic_stack = panic_stack + PAGE_SIZE; 641 lowcore->panic_stack = panic_stack + PAGE_SIZE;
638 642
@@ -653,9 +657,8 @@ static int __cpuinit smp_alloc_lowcore(int cpu)
653out_save_area: 657out_save_area:
654 free_page(panic_stack); 658 free_page(panic_stack);
655#endif 659#endif
656out_panic_stack: 660out:
657 free_pages(async_stack, ASYNC_ORDER); 661 free_pages(async_stack, ASYNC_ORDER);
658out_async_stack:
659 free_pages((unsigned long) lowcore, lc_order); 662 free_pages((unsigned long) lowcore, lc_order);
660 return -ENOMEM; 663 return -ENOMEM;
661} 664}
@@ -719,8 +722,8 @@ int __cpuinit __cpu_up(unsigned int cpu)
719 cpu_lowcore->percpu_offset = __per_cpu_offset[cpu]; 722 cpu_lowcore->percpu_offset = __per_cpu_offset[cpu];
720 cpu_lowcore->current_task = (unsigned long) idle; 723 cpu_lowcore->current_task = (unsigned long) idle;
721 cpu_lowcore->cpu_data.cpu_nr = cpu; 724 cpu_lowcore->cpu_data.cpu_nr = cpu;
722 cpu_lowcore->softirq_pending = 0; 725 cpu_lowcore->kernel_asce = S390_lowcore.kernel_asce;
723 cpu_lowcore->ext_call_fast = 0; 726 cpu_lowcore->ipl_device = S390_lowcore.ipl_device;
724 eieio(); 727 eieio();
725 728
726 while (signal_processor(cpu, sigp_restart) == sigp_busy) 729 while (signal_processor(cpu, sigp_restart) == sigp_busy)
@@ -797,23 +800,43 @@ void cpu_die(void)
797 800
798void __init smp_prepare_cpus(unsigned int max_cpus) 801void __init smp_prepare_cpus(unsigned int max_cpus)
799{ 802{
803#ifndef CONFIG_64BIT
804 unsigned long save_area = 0;
805#endif
806 unsigned long async_stack, panic_stack;
807 struct _lowcore *lowcore;
800 unsigned int cpu; 808 unsigned int cpu;
809 int lc_order;
801 810
802 smp_detect_cpus(); 811 smp_detect_cpus();
803 812
804 /* request the 0x1201 emergency signal external interrupt */ 813 /* request the 0x1201 emergency signal external interrupt */
805 if (register_external_interrupt(0x1201, do_ext_call_interrupt) != 0) 814 if (register_external_interrupt(0x1201, do_ext_call_interrupt) != 0)
806 panic("Couldn't request external interrupt 0x1201"); 815 panic("Couldn't request external interrupt 0x1201");
807 memset(lowcore_ptr, 0, sizeof(lowcore_ptr));
808 print_cpu_info(&S390_lowcore.cpu_data); 816 print_cpu_info(&S390_lowcore.cpu_data);
809 smp_alloc_lowcore(smp_processor_id());
810 817
818 /* Reallocate current lowcore, but keep its contents. */
819 lc_order = sizeof(long) == 8 ? 1 : 0;
820 lowcore = (void *) __get_free_pages(GFP_KERNEL | GFP_DMA, lc_order);
821 panic_stack = __get_free_page(GFP_KERNEL);
822 async_stack = __get_free_pages(GFP_KERNEL, ASYNC_ORDER);
811#ifndef CONFIG_64BIT 823#ifndef CONFIG_64BIT
812 if (MACHINE_HAS_IEEE) 824 if (MACHINE_HAS_IEEE)
813 ctl_set_bit(14, 29); /* enable extended save area */ 825 save_area = get_zeroed_page(GFP_KERNEL);
814#endif 826#endif
815 set_prefix((u32)(unsigned long) lowcore_ptr[smp_processor_id()]); 827 local_irq_disable();
816 828 local_mcck_disable();
829 lowcore_ptr[smp_processor_id()] = lowcore;
830 *lowcore = S390_lowcore;
831 lowcore->panic_stack = panic_stack + PAGE_SIZE;
832 lowcore->async_stack = async_stack + ASYNC_SIZE;
833#ifndef CONFIG_64BIT
834 if (MACHINE_HAS_IEEE)
835 lowcore->extended_save_area_addr = (u32) save_area;
836#endif
837 set_prefix((u32)(unsigned long) lowcore);
838 local_mcck_enable();
839 local_irq_enable();
817 for_each_possible_cpu(cpu) 840 for_each_possible_cpu(cpu)
818 if (cpu != smp_processor_id()) 841 if (cpu != smp_processor_id())
819 smp_create_idle(cpu); 842 smp_create_idle(cpu);
diff --git a/arch/s390/kernel/time.c b/arch/s390/kernel/time.c
index 3bbac1293be4..76a5dd1b4ce9 100644
--- a/arch/s390/kernel/time.c
+++ b/arch/s390/kernel/time.c
@@ -744,7 +744,6 @@ static void etr_adjust_time(unsigned long long clock, unsigned long long delay)
744 } 744 }
745} 745}
746 746
747#ifdef CONFIG_SMP
748static void etr_sync_cpu_start(void *dummy) 747static void etr_sync_cpu_start(void *dummy)
749{ 748{
750 int *in_sync = dummy; 749 int *in_sync = dummy;
@@ -777,7 +776,6 @@ static void etr_sync_cpu_start(void *dummy)
777static void etr_sync_cpu_end(void *dummy) 776static void etr_sync_cpu_end(void *dummy)
778{ 777{
779} 778}
780#endif /* CONFIG_SMP */
781 779
782/* 780/*
783 * Sync the TOD clock using the port refered to by aibp. This port 781 * Sync the TOD clock using the port refered to by aibp. This port
diff --git a/arch/s390/lib/uaccess_std.c b/arch/s390/lib/uaccess_std.c
index 28c4500a58d0..d2ffbadb51a7 100644
--- a/arch/s390/lib/uaccess_std.c
+++ b/arch/s390/lib/uaccess_std.c
@@ -293,10 +293,10 @@ int futex_atomic_cmpxchg_std(int __user *uaddr, int oldval, int newval)
293 293
294 asm volatile( 294 asm volatile(
295 " sacf 256\n" 295 " sacf 256\n"
296 " cs %1,%4,0(%5)\n" 296 "0: cs %1,%4,0(%5)\n"
297 "0: lr %0,%1\n" 297 "1: lr %0,%1\n"
298 "1: sacf 0\n" 298 "2: sacf 0\n"
299 EX_TABLE(0b,1b) 299 EX_TABLE(0b,2b) EX_TABLE(1b,2b)
300 : "=d" (ret), "+d" (oldval), "=m" (*uaddr) 300 : "=d" (ret), "+d" (oldval), "=m" (*uaddr)
301 : "0" (-EFAULT), "d" (newval), "a" (uaddr), "m" (*uaddr) 301 : "0" (-EFAULT), "d" (newval), "a" (uaddr), "m" (*uaddr)
302 : "cc", "memory" ); 302 : "cc", "memory" );
diff --git a/arch/sparc/kernel/process.c b/arch/sparc/kernel/process.c
index 19186ce8850d..0bd69d0b5cd7 100644
--- a/arch/sparc/kernel/process.c
+++ b/arch/sparc/kernel/process.c
@@ -141,16 +141,12 @@ void cpu_idle(void)
141 141
142extern char reboot_command []; 142extern char reboot_command [];
143 143
144extern void (*prom_palette)(int);
145
146/* XXX cli/sti -> local_irq_xxx here, check this works once SMP is fixed. */ 144/* XXX cli/sti -> local_irq_xxx here, check this works once SMP is fixed. */
147void machine_halt(void) 145void machine_halt(void)
148{ 146{
149 local_irq_enable(); 147 local_irq_enable();
150 mdelay(8); 148 mdelay(8);
151 local_irq_disable(); 149 local_irq_disable();
152 if (prom_palette)
153 prom_palette (1);
154 prom_halt(); 150 prom_halt();
155 panic("Halt failed!"); 151 panic("Halt failed!");
156} 152}
@@ -165,8 +161,6 @@ void machine_restart(char * cmd)
165 161
166 p = strchr (reboot_command, '\n'); 162 p = strchr (reboot_command, '\n');
167 if (p) *p = 0; 163 if (p) *p = 0;
168 if (prom_palette)
169 prom_palette (1);
170 if (cmd) 164 if (cmd)
171 prom_reboot(cmd); 165 prom_reboot(cmd);
172 if (*reboot_command) 166 if (*reboot_command)
diff --git a/arch/sparc/kernel/setup.c b/arch/sparc/kernel/setup.c
index 3cf78f160846..3c13137685da 100644
--- a/arch/sparc/kernel/setup.c
+++ b/arch/sparc/kernel/setup.c
@@ -65,7 +65,6 @@ struct screen_info screen_info = {
65 */ 65 */
66 66
67extern unsigned long trapbase; 67extern unsigned long trapbase;
68void (*prom_palette)(int);
69 68
70/* Pretty sick eh? */ 69/* Pretty sick eh? */
71void prom_sync_me(void) 70void prom_sync_me(void)
@@ -80,8 +79,6 @@ void prom_sync_me(void)
80 "nop\n\t" 79 "nop\n\t"
81 "nop\n\t" : : "r" (&trapbase)); 80 "nop\n\t" : : "r" (&trapbase));
82 81
83 if (prom_palette)
84 prom_palette(1);
85 prom_printf("PROM SYNC COMMAND...\n"); 82 prom_printf("PROM SYNC COMMAND...\n");
86 show_free_areas(); 83 show_free_areas();
87 if(current->pid != 0) { 84 if(current->pid != 0) {
@@ -191,7 +188,6 @@ extern int prom_probe_memory(void);
191extern void sun4c_probe_vac(void); 188extern void sun4c_probe_vac(void);
192extern char cputypval; 189extern char cputypval;
193extern unsigned long start, end; 190extern unsigned long start, end;
194extern void panic_setup(char *, int *);
195 191
196extern unsigned short root_flags; 192extern unsigned short root_flags;
197extern unsigned short root_dev; 193extern unsigned short root_dev;
diff --git a/arch/sparc/mm/sun4c.c b/arch/sparc/mm/sun4c.c
index c0442e8c4b15..2375fe9dc312 100644
--- a/arch/sparc/mm/sun4c.c
+++ b/arch/sparc/mm/sun4c.c
@@ -1941,9 +1941,7 @@ static pte_t *sun4c_pte_alloc_one_kernel(struct mm_struct *mm, unsigned long add
1941 if ((pte = sun4c_pte_alloc_one_fast(mm, address)) != NULL) 1941 if ((pte = sun4c_pte_alloc_one_fast(mm, address)) != NULL)
1942 return pte; 1942 return pte;
1943 1943
1944 pte = (pte_t *)__get_free_page(GFP_KERNEL|__GFP_REPEAT); 1944 pte = (pte_t *)get_zeroed_page(GFP_KERNEL|__GFP_REPEAT);
1945 if (pte)
1946 memset(pte, 0, PAGE_SIZE);
1947 return pte; 1945 return pte;
1948} 1946}
1949 1947
diff --git a/arch/sparc/prom/misc.c b/arch/sparc/prom/misc.c
index 37cff5f54704..d9fb3af41c1f 100644
--- a/arch/sparc/prom/misc.c
+++ b/arch/sparc/prom/misc.c
@@ -45,9 +45,6 @@ prom_feval(char *fstring)
45 spin_unlock_irqrestore(&prom_lock, flags); 45 spin_unlock_irqrestore(&prom_lock, flags);
46} 46}
47 47
48/* We want to do this more nicely some day. */
49extern void (*prom_palette)(int);
50
51/* Drop into the prom, with the chance to continue with the 'go' 48/* Drop into the prom, with the chance to continue with the 'go'
52 * prom command. 49 * prom command.
53 */ 50 */
@@ -58,8 +55,6 @@ prom_cmdline(void)
58 extern void install_linux_ticker(void); 55 extern void install_linux_ticker(void);
59 unsigned long flags; 56 unsigned long flags;
60 57
61 if (prom_palette)
62 prom_palette (1);
63 spin_lock_irqsave(&prom_lock, flags); 58 spin_lock_irqsave(&prom_lock, flags);
64 install_obp_ticker(); 59 install_obp_ticker();
65 (*(romvec->pv_abort))(); 60 (*(romvec->pv_abort))();
@@ -69,8 +64,6 @@ prom_cmdline(void)
69#ifdef CONFIG_SUN_AUXIO 64#ifdef CONFIG_SUN_AUXIO
70 set_auxio(AUXIO_LED, 0); 65 set_auxio(AUXIO_LED, 0);
71#endif 66#endif
72 if (prom_palette)
73 prom_palette (0);
74} 67}
75 68
76/* Drop into the prom, but completely terminate the program. 69/* Drop into the prom, but completely terminate the program.
diff --git a/arch/sparc64/Kconfig.debug b/arch/sparc64/Kconfig.debug
index a5faa3683bd6..6a4d28a4076d 100644
--- a/arch/sparc64/Kconfig.debug
+++ b/arch/sparc64/Kconfig.debug
@@ -23,10 +23,6 @@ config STACK_DEBUG
23 depends on DEBUG_KERNEL 23 depends on DEBUG_KERNEL
24 bool "Stack Overflow Detection Support" 24 bool "Stack Overflow Detection Support"
25 25
26config DEBUG_BOOTMEM
27 depends on DEBUG_KERNEL
28 bool "Debug BOOTMEM initialization"
29
30config DEBUG_PAGEALLOC 26config DEBUG_PAGEALLOC
31 bool "Debug page memory allocations" 27 bool "Debug page memory allocations"
32 depends on DEBUG_KERNEL && !HIBERNATION 28 depends on DEBUG_KERNEL && !HIBERNATION
diff --git a/arch/sparc64/Makefile b/arch/sparc64/Makefile
index 01159cb5f16d..f0c22f826982 100644
--- a/arch/sparc64/Makefile
+++ b/arch/sparc64/Makefile
@@ -12,39 +12,13 @@ CHECKFLAGS += -D__sparc__ -D__sparc_v9__ -m64
12 12
13CPPFLAGS_vmlinux.lds += -Usparc 13CPPFLAGS_vmlinux.lds += -Usparc
14 14
15CC := $(shell if $(CC) -m64 -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo $(CC); else echo sparc64-linux-gcc; fi )
16
17NEW_GCC := $(call cc-option-yn, -m64 -mcmodel=medlow)
18NEW_GAS := $(shell if $(LD) -V 2>&1 | grep 'elf64_sparc' > /dev/null; then echo y; else echo n; fi)
19UNDECLARED_REGS := $(shell if $(CC) -c -x assembler /dev/null -Wa,--help | grep undeclared-regs > /dev/null; then echo y; else echo n; fi; )
20
21ifneq ($(NEW_GAS),y)
22AS = sparc64-linux-as
23LD = sparc64-linux-ld
24NM = sparc64-linux-nm
25AR = sparc64-linux-ar
26RANLIB = sparc64-linux-ranlib
27else
28AS := $(AS) -64
29LDFLAGS := -m elf64_sparc 15LDFLAGS := -m elf64_sparc
30endif
31 16
32ifneq ($(UNDECLARED_REGS),y) 17KBUILD_CFLAGS += -m64 -pipe -mno-fpu -mcpu=ultrasparc -mcmodel=medlow \
33CC_UNDECL = 18 -ffixed-g4 -ffixed-g5 -fcall-used-g7 -Wno-sign-compare \
34else 19 -Wa,--undeclared-regs
35CC_UNDECL = -Wa,--undeclared-regs 20KBUILD_CFLAGS += $(call cc-option,-mtune=ultrasparc3)
36AS := $(AS) --undeclared-regs 21KBUILD_AFLAGS += -m64 -mcpu=ultrasparc -Wa,--undeclared-regs
37endif
38
39ifneq ($(NEW_GCC),y)
40 KBUILD_CFLAGS += -pipe -mno-fpu -mtune=ultrasparc -mmedlow \
41 -ffixed-g4 -ffixed-g5 -fcall-used-g7 -Wno-sign-compare
42else
43 KBUILD_CFLAGS += -m64 -pipe -mno-fpu -mcpu=ultrasparc -mcmodel=medlow \
44 -ffixed-g4 -ffixed-g5 -fcall-used-g7 -Wno-sign-compare \
45 $(CC_UNDECL)
46 KBUILD_AFLAGS += -m64 -mcpu=ultrasparc $(CC_UNDECL)
47endif
48 22
49ifeq ($(CONFIG_MCOUNT),y) 23ifeq ($(CONFIG_MCOUNT),y)
50 KBUILD_CFLAGS += -pg 24 KBUILD_CFLAGS += -pg
diff --git a/arch/sparc64/defconfig b/arch/sparc64/defconfig
index 833d74b2b192..250958d1e3cb 100644
--- a/arch/sparc64/defconfig
+++ b/arch/sparc64/defconfig
@@ -1,7 +1,7 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.24 3# Linux kernel version: 2.6.25-rc1
4# Tue Feb 5 17:28:19 2008 4# Sun Feb 17 22:44:12 2008
5# 5#
6CONFIG_SPARC=y 6CONFIG_SPARC=y
7CONFIG_SPARC64=y 7CONFIG_SPARC64=y
@@ -10,6 +10,7 @@ CONFIG_GENERIC_CMOS_UPDATE=y
10CONFIG_GENERIC_CLOCKEVENTS=y 10CONFIG_GENERIC_CLOCKEVENTS=y
11CONFIG_64BIT=y 11CONFIG_64BIT=y
12CONFIG_MMU=y 12CONFIG_MMU=y
13CONFIG_IOMMU_HELPER=y
13CONFIG_QUICKLIST=y 14CONFIG_QUICKLIST=y
14CONFIG_STACKTRACE_SUPPORT=y 15CONFIG_STACKTRACE_SUPPORT=y
15CONFIG_LOCKDEP_SUPPORT=y 16CONFIG_LOCKDEP_SUPPORT=y
@@ -21,6 +22,7 @@ CONFIG_HAVE_SETUP_PER_CPU_AREA=y
21CONFIG_ARCH_NO_VIRT_TO_BUS=y 22CONFIG_ARCH_NO_VIRT_TO_BUS=y
22CONFIG_OF=y 23CONFIG_OF=y
23CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y 24CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y
25CONFIG_ARCH_SUPPORTS_AOUT=y
24CONFIG_SPARC64_PAGE_SIZE_8KB=y 26CONFIG_SPARC64_PAGE_SIZE_8KB=y
25# CONFIG_SPARC64_PAGE_SIZE_64KB is not set 27# CONFIG_SPARC64_PAGE_SIZE_64KB is not set
26# CONFIG_SPARC64_PAGE_SIZE_512KB is not set 28# CONFIG_SPARC64_PAGE_SIZE_512KB is not set
@@ -49,8 +51,6 @@ CONFIG_SYSVIPC_SYSCTL=y
49CONFIG_POSIX_MQUEUE=y 51CONFIG_POSIX_MQUEUE=y
50# CONFIG_BSD_PROCESS_ACCT is not set 52# CONFIG_BSD_PROCESS_ACCT is not set
51# CONFIG_TASKSTATS is not set 53# CONFIG_TASKSTATS is not set
52# CONFIG_USER_NS is not set
53# CONFIG_PID_NS is not set
54# CONFIG_AUDIT is not set 54# CONFIG_AUDIT is not set
55# CONFIG_IKCONFIG is not set 55# CONFIG_IKCONFIG is not set
56CONFIG_LOG_BUF_SHIFT=18 56CONFIG_LOG_BUF_SHIFT=18
@@ -60,6 +60,11 @@ CONFIG_FAIR_USER_SCHED=y
60# CONFIG_FAIR_CGROUP_SCHED is not set 60# CONFIG_FAIR_CGROUP_SCHED is not set
61CONFIG_SYSFS_DEPRECATED=y 61CONFIG_SYSFS_DEPRECATED=y
62CONFIG_RELAY=y 62CONFIG_RELAY=y
63CONFIG_NAMESPACES=y
64# CONFIG_UTS_NS is not set
65# CONFIG_IPC_NS is not set
66# CONFIG_USER_NS is not set
67# CONFIG_PID_NS is not set
63CONFIG_BLK_DEV_INITRD=y 68CONFIG_BLK_DEV_INITRD=y
64CONFIG_INITRAMFS_SOURCE="" 69CONFIG_INITRAMFS_SOURCE=""
65CONFIG_CC_OPTIMIZE_FOR_SIZE=y 70CONFIG_CC_OPTIMIZE_FOR_SIZE=y
@@ -74,6 +79,7 @@ CONFIG_HOTPLUG=y
74CONFIG_PRINTK=y 79CONFIG_PRINTK=y
75CONFIG_BUG=y 80CONFIG_BUG=y
76CONFIG_ELF_CORE=y 81CONFIG_ELF_CORE=y
82# CONFIG_COMPAT_BRK is not set
77CONFIG_BASE_FULL=y 83CONFIG_BASE_FULL=y
78CONFIG_FUTEX=y 84CONFIG_FUTEX=y
79CONFIG_ANON_INODES=y 85CONFIG_ANON_INODES=y
@@ -176,13 +182,13 @@ CONFIG_PCI_MSI=y
176CONFIG_SUN_OPENPROMFS=m 182CONFIG_SUN_OPENPROMFS=m
177CONFIG_SPARC32_COMPAT=y 183CONFIG_SPARC32_COMPAT=y
178CONFIG_COMPAT=y 184CONFIG_COMPAT=y
179CONFIG_BINFMT_ELF32=y
180# CONFIG_BINFMT_AOUT32 is not set 185# CONFIG_BINFMT_AOUT32 is not set
181 186
182# 187#
183# Executable file formats 188# Executable file formats
184# 189#
185CONFIG_BINFMT_ELF=y 190CONFIG_BINFMT_ELF=y
191CONFIG_COMPAT_BINFMT_ELF=y
186CONFIG_BINFMT_MISC=m 192CONFIG_BINFMT_MISC=m
187CONFIG_SOLARIS_EMUL=y 193CONFIG_SOLARIS_EMUL=y
188CONFIG_SCHED_SMT=y 194CONFIG_SCHED_SMT=y
@@ -354,6 +360,8 @@ CONFIG_MISC_DEVICES=y
354# CONFIG_EEPROM_93CX6 is not set 360# CONFIG_EEPROM_93CX6 is not set
355# CONFIG_SGI_IOC4 is not set 361# CONFIG_SGI_IOC4 is not set
356# CONFIG_TIFM_CORE is not set 362# CONFIG_TIFM_CORE is not set
363# CONFIG_ENCLOSURE_SERVICES is not set
364CONFIG_HAVE_IDE=y
357CONFIG_IDE=y 365CONFIG_IDE=y
358CONFIG_BLK_DEV_IDE=y 366CONFIG_BLK_DEV_IDE=y
359 367
@@ -376,6 +384,7 @@ CONFIG_IDE_PROC_FS=y
376# 384#
377CONFIG_IDE_GENERIC=y 385CONFIG_IDE_GENERIC=y
378# CONFIG_BLK_DEV_PLATFORM is not set 386# CONFIG_BLK_DEV_PLATFORM is not set
387CONFIG_BLK_DEV_IDEDMA_SFF=y
379 388
380# 389#
381# PCI IDE chipsets support 390# PCI IDE chipsets support
@@ -775,7 +784,6 @@ CONFIG_I2C_ALGOBIT=y
775# CONFIG_SENSORS_EEPROM is not set 784# CONFIG_SENSORS_EEPROM is not set
776# CONFIG_SENSORS_PCF8574 is not set 785# CONFIG_SENSORS_PCF8574 is not set
777# CONFIG_PCF8575 is not set 786# CONFIG_PCF8575 is not set
778# CONFIG_SENSORS_PCA9539 is not set
779# CONFIG_SENSORS_PCF8591 is not set 787# CONFIG_SENSORS_PCF8591 is not set
780# CONFIG_TPS65010 is not set 788# CONFIG_TPS65010 is not set
781# CONFIG_SENSORS_MAX6875 is not set 789# CONFIG_SENSORS_MAX6875 is not set
@@ -831,6 +839,7 @@ CONFIG_HWMON=y
831# CONFIG_SENSORS_SMSC47M1 is not set 839# CONFIG_SENSORS_SMSC47M1 is not set
832# CONFIG_SENSORS_SMSC47M192 is not set 840# CONFIG_SENSORS_SMSC47M192 is not set
833# CONFIG_SENSORS_SMSC47B397 is not set 841# CONFIG_SENSORS_SMSC47B397 is not set
842# CONFIG_SENSORS_ADS7828 is not set
834# CONFIG_SENSORS_THMC50 is not set 843# CONFIG_SENSORS_THMC50 is not set
835# CONFIG_SENSORS_VIA686A is not set 844# CONFIG_SENSORS_VIA686A is not set
836# CONFIG_SENSORS_VT1211 is not set 845# CONFIG_SENSORS_VT1211 is not set
@@ -840,9 +849,11 @@ CONFIG_HWMON=y
840# CONFIG_SENSORS_W83792D is not set 849# CONFIG_SENSORS_W83792D is not set
841# CONFIG_SENSORS_W83793 is not set 850# CONFIG_SENSORS_W83793 is not set
842# CONFIG_SENSORS_W83L785TS is not set 851# CONFIG_SENSORS_W83L785TS is not set
852# CONFIG_SENSORS_W83L786NG is not set
843# CONFIG_SENSORS_W83627HF is not set 853# CONFIG_SENSORS_W83627HF is not set
844# CONFIG_SENSORS_W83627EHF is not set 854# CONFIG_SENSORS_W83627EHF is not set
845# CONFIG_HWMON_DEBUG_CHIP is not set 855# CONFIG_HWMON_DEBUG_CHIP is not set
856# CONFIG_THERMAL is not set
846# CONFIG_WATCHDOG is not set 857# CONFIG_WATCHDOG is not set
847 858
848# 859#
@@ -1201,6 +1212,7 @@ CONFIG_USB_STORAGE=m
1201# CONFIG_USB_TEST is not set 1212# CONFIG_USB_TEST is not set
1202# CONFIG_USB_GADGET is not set 1213# CONFIG_USB_GADGET is not set
1203# CONFIG_MMC is not set 1214# CONFIG_MMC is not set
1215# CONFIG_MEMSTICK is not set
1204# CONFIG_NEW_LEDS is not set 1216# CONFIG_NEW_LEDS is not set
1205# CONFIG_INFINIBAND is not set 1217# CONFIG_INFINIBAND is not set
1206# CONFIG_RTC_CLASS is not set 1218# CONFIG_RTC_CLASS is not set
@@ -1242,12 +1254,10 @@ CONFIG_FS_POSIX_ACL=y
1242# CONFIG_XFS_FS is not set 1254# CONFIG_XFS_FS is not set
1243# CONFIG_GFS2_FS is not set 1255# CONFIG_GFS2_FS is not set
1244# CONFIG_OCFS2_FS is not set 1256# CONFIG_OCFS2_FS is not set
1245# CONFIG_MINIX_FS is not set 1257CONFIG_DNOTIFY=y
1246# CONFIG_ROMFS_FS is not set
1247CONFIG_INOTIFY=y 1258CONFIG_INOTIFY=y
1248CONFIG_INOTIFY_USER=y 1259CONFIG_INOTIFY_USER=y
1249# CONFIG_QUOTA is not set 1260# CONFIG_QUOTA is not set
1250CONFIG_DNOTIFY=y
1251# CONFIG_AUTOFS_FS is not set 1261# CONFIG_AUTOFS_FS is not set
1252# CONFIG_AUTOFS4_FS is not set 1262# CONFIG_AUTOFS4_FS is not set
1253# CONFIG_FUSE_FS is not set 1263# CONFIG_FUSE_FS is not set
@@ -1291,8 +1301,10 @@ CONFIG_HUGETLB_PAGE=y
1291# CONFIG_EFS_FS is not set 1301# CONFIG_EFS_FS is not set
1292# CONFIG_CRAMFS is not set 1302# CONFIG_CRAMFS is not set
1293# CONFIG_VXFS_FS is not set 1303# CONFIG_VXFS_FS is not set
1304# CONFIG_MINIX_FS is not set
1294# CONFIG_HPFS_FS is not set 1305# CONFIG_HPFS_FS is not set
1295# CONFIG_QNX4FS_FS is not set 1306# CONFIG_QNX4FS_FS is not set
1307# CONFIG_ROMFS_FS is not set
1296# CONFIG_SYSV_FS is not set 1308# CONFIG_SYSV_FS is not set
1297# CONFIG_UFS_FS is not set 1309# CONFIG_UFS_FS is not set
1298CONFIG_NETWORK_FILESYSTEMS=y 1310CONFIG_NETWORK_FILESYSTEMS=y
@@ -1370,6 +1382,7 @@ CONFIG_DETECT_SOFTLOCKUP=y
1370CONFIG_SCHEDSTATS=y 1382CONFIG_SCHEDSTATS=y
1371# CONFIG_TIMER_STATS is not set 1383# CONFIG_TIMER_STATS is not set
1372# CONFIG_SLUB_DEBUG_ON is not set 1384# CONFIG_SLUB_DEBUG_ON is not set
1385# CONFIG_SLUB_STATS is not set
1373# CONFIG_DEBUG_RT_MUTEXES is not set 1386# CONFIG_DEBUG_RT_MUTEXES is not set
1374# CONFIG_RT_MUTEX_TESTER is not set 1387# CONFIG_RT_MUTEX_TESTER is not set
1375# CONFIG_DEBUG_SPINLOCK is not set 1388# CONFIG_DEBUG_SPINLOCK is not set
@@ -1385,7 +1398,6 @@ CONFIG_DEBUG_BUGVERBOSE=y
1385# CONFIG_DEBUG_VM is not set 1398# CONFIG_DEBUG_VM is not set
1386# CONFIG_DEBUG_LIST is not set 1399# CONFIG_DEBUG_LIST is not set
1387# CONFIG_DEBUG_SG is not set 1400# CONFIG_DEBUG_SG is not set
1388CONFIG_FORCED_INLINING=y
1389# CONFIG_BOOT_PRINTK_DELAY is not set 1401# CONFIG_BOOT_PRINTK_DELAY is not set
1390# CONFIG_RCU_TORTURE_TEST is not set 1402# CONFIG_RCU_TORTURE_TEST is not set
1391# CONFIG_KPROBES_SANITY_TEST is not set 1403# CONFIG_KPROBES_SANITY_TEST is not set
@@ -1396,7 +1408,6 @@ CONFIG_FORCED_INLINING=y
1396# CONFIG_DEBUG_STACK_USAGE is not set 1408# CONFIG_DEBUG_STACK_USAGE is not set
1397# CONFIG_DEBUG_DCFLUSH is not set 1409# CONFIG_DEBUG_DCFLUSH is not set
1398# CONFIG_STACK_DEBUG is not set 1410# CONFIG_STACK_DEBUG is not set
1399# CONFIG_DEBUG_BOOTMEM is not set
1400# CONFIG_DEBUG_PAGEALLOC is not set 1411# CONFIG_DEBUG_PAGEALLOC is not set
1401 1412
1402# 1413#
diff --git a/arch/sparc64/kernel/iommu.c b/arch/sparc64/kernel/iommu.c
index d3276ebcfb47..0e347ff812a3 100644
--- a/arch/sparc64/kernel/iommu.c
+++ b/arch/sparc64/kernel/iommu.c
@@ -200,12 +200,11 @@ int iommu_table_init(struct iommu *iommu, int tsbsize,
200 /* Allocate and initialize the dummy page which we 200 /* Allocate and initialize the dummy page which we
201 * set inactive IO PTEs to point to. 201 * set inactive IO PTEs to point to.
202 */ 202 */
203 iommu->dummy_page = __get_free_pages(GFP_KERNEL, 0); 203 iommu->dummy_page = get_zeroed_page(GFP_KERNEL);
204 if (!iommu->dummy_page) { 204 if (!iommu->dummy_page) {
205 printk(KERN_ERR "IOMMU: Error, gfp(dummy_page) failed.\n"); 205 printk(KERN_ERR "IOMMU: Error, gfp(dummy_page) failed.\n");
206 goto out_free_map; 206 goto out_free_map;
207 } 207 }
208 memset((void *)iommu->dummy_page, 0, PAGE_SIZE);
209 iommu->dummy_page_pa = (unsigned long) __pa(iommu->dummy_page); 208 iommu->dummy_page_pa = (unsigned long) __pa(iommu->dummy_page);
210 209
211 /* Now allocate and setup the IOMMU page table itself. */ 210 /* Now allocate and setup the IOMMU page table itself. */
diff --git a/arch/sparc64/kernel/pci.c b/arch/sparc64/kernel/pci.c
index a61c38fe75ea..545356b00e2e 100644
--- a/arch/sparc64/kernel/pci.c
+++ b/arch/sparc64/kernel/pci.c
@@ -225,20 +225,6 @@ static int __init pci_controller_init(const char *model_name, int namelen, struc
225 return 0; 225 return 0;
226} 226}
227 227
228static int __init pci_is_controller(const char *model_name, int namelen, struct device_node *dp)
229{
230 int i;
231
232 for (i = 0; i < PCI_NUM_CONTROLLER_TYPES; i++) {
233 if (!strncmp(model_name,
234 pci_controller_table[i].model_name,
235 namelen)) {
236 return 1;
237 }
238 }
239 return 0;
240}
241
242static int __init pci_controller_scan(int (*handler)(const char *, int, struct device_node *)) 228static int __init pci_controller_scan(int (*handler)(const char *, int, struct device_node *))
243{ 229{
244 struct device_node *dp; 230 struct device_node *dp;
@@ -273,13 +259,6 @@ static int __init pci_controller_scan(int (*handler)(const char *, int, struct d
273 return count; 259 return count;
274} 260}
275 261
276
277/* Is there some PCI controller in the system? */
278int __init pcic_present(void)
279{
280 return pci_controller_scan(pci_is_controller);
281}
282
283/* Find each controller in the system, attach and initialize 262/* Find each controller in the system, attach and initialize
284 * software state structure for each and link into the 263 * software state structure for each and link into the
285 * pci_pbm_root. Setup the controller enough such 264 * pci_pbm_root. Setup the controller enough such
diff --git a/arch/sparc64/kernel/process.c b/arch/sparc64/kernel/process.c
index 1b2379174988..6eceac51ae62 100644
--- a/arch/sparc64/kernel/process.c
+++ b/arch/sparc64/kernel/process.c
@@ -113,16 +113,9 @@ void cpu_idle(void)
113 113
114extern char reboot_command []; 114extern char reboot_command [];
115 115
116extern void (*prom_palette)(int);
117extern void (*prom_keyboard)(void);
118
119void machine_halt(void) 116void machine_halt(void)
120{ 117{
121 sstate_halt(); 118 sstate_halt();
122 if (prom_palette)
123 prom_palette (1);
124 if (prom_keyboard)
125 prom_keyboard();
126 prom_halt(); 119 prom_halt();
127 panic("Halt failed!"); 120 panic("Halt failed!");
128} 121}
@@ -130,10 +123,6 @@ void machine_halt(void)
130void machine_alt_power_off(void) 123void machine_alt_power_off(void)
131{ 124{
132 sstate_poweroff(); 125 sstate_poweroff();
133 if (prom_palette)
134 prom_palette(1);
135 if (prom_keyboard)
136 prom_keyboard();
137 prom_halt_power_off(); 126 prom_halt_power_off();
138 panic("Power-off failed!"); 127 panic("Power-off failed!");
139} 128}
@@ -145,10 +134,6 @@ void machine_restart(char * cmd)
145 sstate_reboot(); 134 sstate_reboot();
146 p = strchr (reboot_command, '\n'); 135 p = strchr (reboot_command, '\n');
147 if (p) *p = 0; 136 if (p) *p = 0;
148 if (prom_palette)
149 prom_palette (1);
150 if (prom_keyboard)
151 prom_keyboard();
152 if (cmd) 137 if (cmd)
153 prom_reboot(cmd); 138 prom_reboot(cmd);
154 if (*reboot_command) 139 if (*reboot_command)
diff --git a/arch/sparc64/kernel/prom.c b/arch/sparc64/kernel/prom.c
index a246e962e5a7..68964ddcde1e 100644
--- a/arch/sparc64/kernel/prom.c
+++ b/arch/sparc64/kernel/prom.c
@@ -1716,7 +1716,6 @@ static void __init of_console_init(void)
1716 1716
1717 of_console_device = dp; 1717 of_console_device = dp;
1718 1718
1719 prom_printf(msg, of_console_path);
1720 printk(msg, of_console_path); 1719 printk(msg, of_console_path);
1721} 1720}
1722 1721
diff --git a/arch/sparc64/kernel/setup.c b/arch/sparc64/kernel/setup.c
index 5964d8653ade..d036dbe72864 100644
--- a/arch/sparc64/kernel/setup.c
+++ b/arch/sparc64/kernel/setup.c
@@ -68,33 +68,22 @@ struct screen_info screen_info = {
68 16 /* orig-video-points */ 68 16 /* orig-video-points */
69}; 69};
70 70
71void (*prom_palette)(int);
72void (*prom_keyboard)(void);
73
74static void 71static void
75prom_console_write(struct console *con, const char *s, unsigned n) 72prom_console_write(struct console *con, const char *s, unsigned n)
76{ 73{
77 prom_write(s, n); 74 prom_write(s, n);
78} 75}
79 76
80unsigned int boot_flags = 0;
81#define BOOTME_DEBUG 0x1
82
83/* Exported for mm/init.c:paging_init. */ 77/* Exported for mm/init.c:paging_init. */
84unsigned long cmdline_memory_size = 0; 78unsigned long cmdline_memory_size = 0;
85 79
86static struct console prom_debug_console = { 80static struct console prom_early_console = {
87 .name = "debug", 81 .name = "earlyprom",
88 .write = prom_console_write, 82 .write = prom_console_write,
89 .flags = CON_PRINTBUFFER, 83 .flags = CON_PRINTBUFFER | CON_BOOT,
90 .index = -1, 84 .index = -1,
91}; 85};
92 86
93/* XXX Implement this at some point... */
94void kernel_enter_debugger(void)
95{
96}
97
98/* 87/*
99 * Process kernel command line switches that are specific to the 88 * Process kernel command line switches that are specific to the
100 * SPARC or that require special low-level processing. 89 * SPARC or that require special low-level processing.
@@ -103,8 +92,6 @@ static void __init process_switch(char c)
103{ 92{
104 switch (c) { 93 switch (c) {
105 case 'd': 94 case 'd':
106 boot_flags |= BOOTME_DEBUG;
107 break;
108 case 's': 95 case 's':
109 break; 96 break;
110 case 'h': 97 case 'h':
@@ -112,8 +99,7 @@ static void __init process_switch(char c)
112 prom_halt(); 99 prom_halt();
113 break; 100 break;
114 case 'p': 101 case 'p':
115 /* Use PROM debug console. */ 102 /* Just ignore, this behavior is now the default. */
116 register_console(&prom_debug_console);
117 break; 103 break;
118 case 'P': 104 case 'P':
119 /* Force UltraSPARC-III P-Cache on. */ 105 /* Force UltraSPARC-III P-Cache on. */
@@ -168,8 +154,6 @@ static void __init boot_flags_init(char *commands)
168 } 154 }
169} 155}
170 156
171extern void panic_setup(char *, int *);
172
173extern unsigned short root_flags; 157extern unsigned short root_flags;
174extern unsigned short root_dev; 158extern unsigned short root_dev;
175extern unsigned short ram_flags; 159extern unsigned short ram_flags;
@@ -296,6 +280,9 @@ void __init setup_arch(char **cmdline_p)
296 *cmdline_p = prom_getbootargs(); 280 *cmdline_p = prom_getbootargs();
297 strcpy(boot_command_line, *cmdline_p); 281 strcpy(boot_command_line, *cmdline_p);
298 282
283 boot_flags_init(*cmdline_p);
284 register_console(&prom_early_console);
285
299 if (tlb_type == hypervisor) 286 if (tlb_type == hypervisor)
300 printk("ARCH: SUN4V\n"); 287 printk("ARCH: SUN4V\n");
301 else 288 else
@@ -307,8 +294,6 @@ void __init setup_arch(char **cmdline_p)
307 conswitchp = &prom_con; 294 conswitchp = &prom_con;
308#endif 295#endif
309 296
310 boot_flags_init(*cmdline_p);
311
312 idprom_init(); 297 idprom_init();
313 298
314 if (!root_flags) 299 if (!root_flags)
diff --git a/arch/sparc64/kernel/sparc64_ksyms.c b/arch/sparc64/kernel/sparc64_ksyms.c
index 68db08930399..51fa773f38c9 100644
--- a/arch/sparc64/kernel/sparc64_ksyms.c
+++ b/arch/sparc64/kernel/sparc64_ksyms.c
@@ -85,7 +85,6 @@ extern int (*handle_mathemu)(struct pt_regs *, struct fpustate *);
85extern long sparc32_open(const char __user * filename, int flags, int mode); 85extern long sparc32_open(const char __user * filename, int flags, int mode);
86extern int io_remap_pfn_range(struct vm_area_struct *vma, unsigned long from, 86extern int io_remap_pfn_range(struct vm_area_struct *vma, unsigned long from,
87 unsigned long pfn, unsigned long size, pgprot_t prot); 87 unsigned long pfn, unsigned long size, pgprot_t prot);
88extern void (*prom_palette)(int);
89 88
90extern int __ashrdi3(int, int); 89extern int __ashrdi3(int, int);
91 90
@@ -355,5 +354,3 @@ EXPORT_SYMBOL(xor_niagara_2);
355EXPORT_SYMBOL(xor_niagara_3); 354EXPORT_SYMBOL(xor_niagara_3);
356EXPORT_SYMBOL(xor_niagara_4); 355EXPORT_SYMBOL(xor_niagara_4);
357EXPORT_SYMBOL(xor_niagara_5); 356EXPORT_SYMBOL(xor_niagara_5);
358
359EXPORT_SYMBOL(prom_palette);
diff --git a/arch/sparc64/kernel/unaligned.c b/arch/sparc64/kernel/unaligned.c
index dc7bf1b6321c..1a511e9f0d3e 100644
--- a/arch/sparc64/kernel/unaligned.c
+++ b/arch/sparc64/kernel/unaligned.c
@@ -7,6 +7,7 @@
7 */ 7 */
8 8
9 9
10#include <linux/jiffies.h>
10#include <linux/kernel.h> 11#include <linux/kernel.h>
11#include <linux/sched.h> 12#include <linux/sched.h>
12#include <linux/mm.h> 13#include <linux/mm.h>
@@ -283,7 +284,7 @@ static void log_unaligned(struct pt_regs *regs)
283{ 284{
284 static unsigned long count, last_time; 285 static unsigned long count, last_time;
285 286
286 if (jiffies - last_time > 5 * HZ) 287 if (time_after(jiffies, last_time + 5 * HZ))
287 count = 0; 288 count = 0;
288 if (count < 5) { 289 if (count < 5) {
289 last_time = jiffies; 290 last_time = jiffies;
diff --git a/arch/sparc64/mm/init.c b/arch/sparc64/mm/init.c
index e726c45645ff..9e6bca266d88 100644
--- a/arch/sparc64/mm/init.c
+++ b/arch/sparc64/mm/init.c
@@ -618,9 +618,9 @@ static void __init inherit_prom_mappings(void)
618 read_obp_translations(); 618 read_obp_translations();
619 619
620 /* Now fixup OBP's idea about where we really are mapped. */ 620 /* Now fixup OBP's idea about where we really are mapped. */
621 prom_printf("Remapping the kernel... "); 621 printk("Remapping the kernel... ");
622 remap_kernel(); 622 remap_kernel();
623 prom_printf("done.\n"); 623 printk("done.\n");
624} 624}
625 625
626void prom_world(int enter) 626void prom_world(int enter)
@@ -739,11 +739,6 @@ static unsigned long __init choose_bootmap_pfn(unsigned long start_pfn,
739 avoid_end = PAGE_ALIGN(initrd_end); 739 avoid_end = PAGE_ALIGN(initrd_end);
740#endif 740#endif
741 741
742#ifdef CONFIG_DEBUG_BOOTMEM
743 prom_printf("choose_bootmap_pfn: kern[%lx:%lx] avoid[%lx:%lx]\n",
744 kern_base, PAGE_ALIGN(kern_base + kern_size),
745 avoid_start, avoid_end);
746#endif
747 for (i = 0; i < pavail_ents; i++) { 742 for (i = 0; i < pavail_ents; i++) {
748 unsigned long start, end; 743 unsigned long start, end;
749 744
@@ -777,10 +772,6 @@ static unsigned long __init choose_bootmap_pfn(unsigned long start_pfn,
777 } 772 }
778 773
779 /* OK, it doesn't overlap anything, use it. */ 774 /* OK, it doesn't overlap anything, use it. */
780#ifdef CONFIG_DEBUG_BOOTMEM
781 prom_printf("choose_bootmap_pfn: Using %lx [%lx]\n",
782 start >> PAGE_SHIFT, start);
783#endif
784 return start >> PAGE_SHIFT; 775 return start >> PAGE_SHIFT;
785 } 776 }
786 } 777 }
@@ -920,10 +911,6 @@ static unsigned long __init bootmem_init(unsigned long *pages_avail,
920 unsigned long bootmap_pfn, bytes_avail, size; 911 unsigned long bootmap_pfn, bytes_avail, size;
921 int i; 912 int i;
922 913
923#ifdef CONFIG_DEBUG_BOOTMEM
924 prom_printf("bootmem_init: Scan pavail, ");
925#endif
926
927 bytes_avail = 0UL; 914 bytes_avail = 0UL;
928 for (i = 0; i < pavail_ents; i++) { 915 for (i = 0; i < pavail_ents; i++) {
929 end_of_phys_memory = pavail[i].phys_addr + 916 end_of_phys_memory = pavail[i].phys_addr +
@@ -970,33 +957,20 @@ static unsigned long __init bootmem_init(unsigned long *pages_avail,
970 957
971 bootmap_pfn = choose_bootmap_pfn(min_low_pfn, end_pfn); 958 bootmap_pfn = choose_bootmap_pfn(min_low_pfn, end_pfn);
972 959
973#ifdef CONFIG_DEBUG_BOOTMEM
974 prom_printf("init_bootmem(min[%lx], bootmap[%lx], max[%lx])\n",
975 min_low_pfn, bootmap_pfn, max_low_pfn);
976#endif
977 bootmap_size = init_bootmem_node(NODE_DATA(0), bootmap_pfn, 960 bootmap_size = init_bootmem_node(NODE_DATA(0), bootmap_pfn,
978 min_low_pfn, end_pfn); 961 min_low_pfn, end_pfn);
979 962
980 /* Now register the available physical memory with the 963 /* Now register the available physical memory with the
981 * allocator. 964 * allocator.
982 */ 965 */
983 for (i = 0; i < pavail_ents; i++) { 966 for (i = 0; i < pavail_ents; i++)
984#ifdef CONFIG_DEBUG_BOOTMEM
985 prom_printf("free_bootmem(pavail:%d): base[%lx] size[%lx]\n",
986 i, pavail[i].phys_addr, pavail[i].reg_size);
987#endif
988 free_bootmem(pavail[i].phys_addr, pavail[i].reg_size); 967 free_bootmem(pavail[i].phys_addr, pavail[i].reg_size);
989 }
990 968
991#ifdef CONFIG_BLK_DEV_INITRD 969#ifdef CONFIG_BLK_DEV_INITRD
992 if (initrd_start) { 970 if (initrd_start) {
993 size = initrd_end - initrd_start; 971 size = initrd_end - initrd_start;
994 972
995 /* Reserve the initrd image area. */ 973 /* Reserve the initrd image area. */
996#ifdef CONFIG_DEBUG_BOOTMEM
997 prom_printf("reserve_bootmem(initrd): base[%llx] size[%lx]\n",
998 initrd_start, initrd_end);
999#endif
1000 reserve_bootmem(initrd_start, size, BOOTMEM_DEFAULT); 974 reserve_bootmem(initrd_start, size, BOOTMEM_DEFAULT);
1001 975
1002 initrd_start += PAGE_OFFSET; 976 initrd_start += PAGE_OFFSET;
@@ -1004,9 +978,6 @@ static unsigned long __init bootmem_init(unsigned long *pages_avail,
1004 } 978 }
1005#endif 979#endif
1006 /* Reserve the kernel text/data/bss. */ 980 /* Reserve the kernel text/data/bss. */
1007#ifdef CONFIG_DEBUG_BOOTMEM
1008 prom_printf("reserve_bootmem(kernel): base[%lx] size[%lx]\n", kern_base, kern_size);
1009#endif
1010 reserve_bootmem(kern_base, kern_size, BOOTMEM_DEFAULT); 981 reserve_bootmem(kern_base, kern_size, BOOTMEM_DEFAULT);
1011 *pages_avail -= PAGE_ALIGN(kern_size) >> PAGE_SHIFT; 982 *pages_avail -= PAGE_ALIGN(kern_size) >> PAGE_SHIFT;
1012 983
@@ -1020,10 +991,6 @@ static unsigned long __init bootmem_init(unsigned long *pages_avail,
1020 * in free_all_bootmem. 991 * in free_all_bootmem.
1021 */ 992 */
1022 size = bootmap_size; 993 size = bootmap_size;
1023#ifdef CONFIG_DEBUG_BOOTMEM
1024 prom_printf("reserve_bootmem(bootmap): base[%lx] size[%lx]\n",
1025 (bootmap_pfn << PAGE_SHIFT), size);
1026#endif
1027 reserve_bootmem((bootmap_pfn << PAGE_SHIFT), size, BOOTMEM_DEFAULT); 994 reserve_bootmem((bootmap_pfn << PAGE_SHIFT), size, BOOTMEM_DEFAULT);
1028 995
1029 for (i = 0; i < pavail_ents; i++) { 996 for (i = 0; i < pavail_ents; i++) {
@@ -1031,10 +998,6 @@ static unsigned long __init bootmem_init(unsigned long *pages_avail,
1031 998
1032 start_pfn = pavail[i].phys_addr >> PAGE_SHIFT; 999 start_pfn = pavail[i].phys_addr >> PAGE_SHIFT;
1033 end_pfn = (start_pfn + (pavail[i].reg_size >> PAGE_SHIFT)); 1000 end_pfn = (start_pfn + (pavail[i].reg_size >> PAGE_SHIFT));
1034#ifdef CONFIG_DEBUG_BOOTMEM
1035 prom_printf("memory_present(0, %lx, %lx)\n",
1036 start_pfn, end_pfn);
1037#endif
1038 memory_present(0, start_pfn, end_pfn); 1001 memory_present(0, start_pfn, end_pfn);
1039 } 1002 }
1040 1003
@@ -1451,7 +1414,7 @@ void __init paging_init(void)
1451 zholes_size); 1414 zholes_size);
1452 } 1415 }
1453 1416
1454 prom_printf("Booting Linux...\n"); 1417 printk("Booting Linux...\n");
1455 1418
1456 central_probe(); 1419 central_probe();
1457 cpu_probe(); 1420 cpu_probe();
@@ -1549,10 +1512,6 @@ void __init mem_init(void)
1549 1512
1550 high_memory = __va(last_valid_pfn << PAGE_SHIFT); 1513 high_memory = __va(last_valid_pfn << PAGE_SHIFT);
1551 1514
1552#ifdef CONFIG_DEBUG_BOOTMEM
1553 prom_printf("mem_init: Calling free_all_bootmem().\n");
1554#endif
1555
1556 /* We subtract one to account for the mem_map_zero page 1515 /* We subtract one to account for the mem_map_zero page
1557 * allocated below. 1516 * allocated below.
1558 */ 1517 */
diff --git a/arch/sparc64/prom/misc.c b/arch/sparc64/prom/misc.c
index bbec7522826c..47a877a15abd 100644
--- a/arch/sparc64/prom/misc.c
+++ b/arch/sparc64/prom/misc.c
@@ -55,9 +55,6 @@ void prom_feval(const char *fstring)
55 P1275_INOUT(1, 1), fstring); 55 P1275_INOUT(1, 1), fstring);
56} 56}
57 57
58/* We want to do this more nicely some day. */
59extern void (*prom_palette)(int);
60
61#ifdef CONFIG_SMP 58#ifdef CONFIG_SMP
62extern void smp_capture(void); 59extern void smp_capture(void);
63extern void smp_release(void); 60extern void smp_release(void);
@@ -72,9 +69,6 @@ void prom_cmdline(void)
72 69
73 local_irq_save(flags); 70 local_irq_save(flags);
74 71
75 if (prom_palette)
76 prom_palette(1);
77
78#ifdef CONFIG_SMP 72#ifdef CONFIG_SMP
79 smp_capture(); 73 smp_capture();
80#endif 74#endif
@@ -85,9 +79,6 @@ void prom_cmdline(void)
85 smp_release(); 79 smp_release();
86#endif 80#endif
87 81
88 if (prom_palette)
89 prom_palette(0);
90
91 local_irq_restore(flags); 82 local_irq_restore(flags);
92} 83}
93 84
diff --git a/arch/x86/Kconfig.debug b/arch/x86/Kconfig.debug
index 864affc9a7b0..702eb39901ca 100644
--- a/arch/x86/Kconfig.debug
+++ b/arch/x86/Kconfig.debug
@@ -156,7 +156,7 @@ config IO_DELAY_TYPE_NONE
156 156
157choice 157choice
158 prompt "IO delay type" 158 prompt "IO delay type"
159 default IO_DELAY_0XED 159 default IO_DELAY_0X80
160 160
161config IO_DELAY_0X80 161config IO_DELAY_0X80
162 bool "port 0x80 based port-IO delay [recommended]" 162 bool "port 0x80 based port-IO delay [recommended]"
diff --git a/arch/x86/Makefile b/arch/x86/Makefile
index 204af43535c5..f1e739a43d41 100644
--- a/arch/x86/Makefile
+++ b/arch/x86/Makefile
@@ -229,7 +229,7 @@ zdisk bzdisk: vmlinux
229fdimage fdimage144 fdimage288 isoimage: vmlinux 229fdimage fdimage144 fdimage288 isoimage: vmlinux
230 $(Q)$(MAKE) $(build)=$(boot) BOOTIMAGE=$(KBUILD_IMAGE) $@ 230 $(Q)$(MAKE) $(build)=$(boot) BOOTIMAGE=$(KBUILD_IMAGE) $@
231 231
232install: vdso_install 232install:
233 $(Q)$(MAKE) $(build)=$(boot) BOOTIMAGE=$(KBUILD_IMAGE) install 233 $(Q)$(MAKE) $(build)=$(boot) BOOTIMAGE=$(KBUILD_IMAGE) install
234 234
235PHONY += vdso_install 235PHONY += vdso_install
diff --git a/arch/x86/kernel/Makefile b/arch/x86/kernel/Makefile
index 76ec0f8f138a..4eb5ce841106 100644
--- a/arch/x86/kernel/Makefile
+++ b/arch/x86/kernel/Makefile
@@ -6,7 +6,15 @@ extra-y := head_$(BITS).o init_task.o vmlinux.lds
6extra-$(CONFIG_X86_64) += head64.o 6extra-$(CONFIG_X86_64) += head64.o
7 7
8CPPFLAGS_vmlinux.lds += -U$(UTS_MACHINE) 8CPPFLAGS_vmlinux.lds += -U$(UTS_MACHINE)
9CFLAGS_vsyscall_64.o := $(PROFILING) -g0 9
10#
11# vsyscalls (which work on the user stack) should have
12# no stack-protector checks:
13#
14nostackp := $(call cc-option, -fno-stack-protector)
15CFLAGS_vsyscall_64.o := $(PROFILING) -g0 $(nostackp)
16CFLAGS_hpet.o := $(nostackp)
17CFLAGS_tsc_64.o := $(nostackp)
10 18
11obj-y := process_$(BITS).o signal_$(BITS).o entry_$(BITS).o 19obj-y := process_$(BITS).o signal_$(BITS).o entry_$(BITS).o
12obj-y += traps_$(BITS).o irq_$(BITS).o 20obj-y += traps_$(BITS).o irq_$(BITS).o
diff --git a/arch/x86/kernel/cpu/bugs.c b/arch/x86/kernel/cpu/bugs.c
index 9b95edcfc6ae..027e5c003b16 100644
--- a/arch/x86/kernel/cpu/bugs.c
+++ b/arch/x86/kernel/cpu/bugs.c
@@ -25,14 +25,6 @@ static int __init no_halt(char *s)
25 25
26__setup("no-hlt", no_halt); 26__setup("no-hlt", no_halt);
27 27
28static int __init mca_pentium(char *s)
29{
30 mca_pentium_flag = 1;
31 return 1;
32}
33
34__setup("mca-pentium", mca_pentium);
35
36static int __init no_387(char *s) 28static int __init no_387(char *s)
37{ 29{
38 boot_cpu_data.hard_math = 0; 30 boot_cpu_data.hard_math = 0;
diff --git a/arch/x86/kernel/efi.c b/arch/x86/kernel/efi.c
index 0c0eeb163d90..759e02bec070 100644
--- a/arch/x86/kernel/efi.c
+++ b/arch/x86/kernel/efi.c
@@ -54,7 +54,7 @@ EXPORT_SYMBOL(efi);
54 54
55struct efi_memory_map memmap; 55struct efi_memory_map memmap;
56 56
57struct efi efi_phys __initdata; 57static struct efi efi_phys __initdata;
58static efi_system_table_t efi_systab __initdata; 58static efi_system_table_t efi_systab __initdata;
59 59
60static int __init setup_noefi(char *arg) 60static int __init setup_noefi(char *arg)
diff --git a/arch/x86/kernel/efi_32.c b/arch/x86/kernel/efi_32.c
index cb91f985b4a1..5d23d85624d4 100644
--- a/arch/x86/kernel/efi_32.c
+++ b/arch/x86/kernel/efi_32.c
@@ -28,6 +28,7 @@
28#include <asm/page.h> 28#include <asm/page.h>
29#include <asm/pgtable.h> 29#include <asm/pgtable.h>
30#include <asm/tlbflush.h> 30#include <asm/tlbflush.h>
31#include <asm/efi.h>
31 32
32/* 33/*
33 * To make EFI call EFI runtime service in physical addressing mode we need 34 * To make EFI call EFI runtime service in physical addressing mode we need
diff --git a/arch/x86/kernel/entry_32.S b/arch/x86/kernel/entry_32.S
index 824e21b80aad..4b87c32b639f 100644
--- a/arch/x86/kernel/entry_32.S
+++ b/arch/x86/kernel/entry_32.S
@@ -409,7 +409,7 @@ restore_nocheck_notrace:
409 RESTORE_REGS 409 RESTORE_REGS
410 addl $4, %esp # skip orig_eax/error_code 410 addl $4, %esp # skip orig_eax/error_code
411 CFI_ADJUST_CFA_OFFSET -4 411 CFI_ADJUST_CFA_OFFSET -4
412ENTRY(irq_return) 412irq_return:
413 INTERRUPT_RETURN 413 INTERRUPT_RETURN
414.section .fixup,"ax" 414.section .fixup,"ax"
415iret_exc: 415iret_exc:
diff --git a/arch/x86/kernel/entry_64.S b/arch/x86/kernel/entry_64.S
index 6be39a387c5a..2ad9a1bc6a73 100644
--- a/arch/x86/kernel/entry_64.S
+++ b/arch/x86/kernel/entry_64.S
@@ -583,7 +583,7 @@ retint_restore_args: /* return to kernel space */
583restore_args: 583restore_args:
584 RESTORE_ARGS 0,8,0 584 RESTORE_ARGS 0,8,0
585 585
586ENTRY(irq_return) 586irq_return:
587 INTERRUPT_RETURN 587 INTERRUPT_RETURN
588 588
589 .section __ex_table, "a" 589 .section __ex_table, "a"
diff --git a/arch/x86/kernel/head_32.S b/arch/x86/kernel/head_32.S
index 74ef4a41f224..25eb98540a41 100644
--- a/arch/x86/kernel/head_32.S
+++ b/arch/x86/kernel/head_32.S
@@ -612,7 +612,7 @@ ENTRY(swapper_pg_pmd)
612ENTRY(swapper_pg_dir) 612ENTRY(swapper_pg_dir)
613 .fill 1024,4,0 613 .fill 1024,4,0
614#endif 614#endif
615ENTRY(swapper_pg_fixmap) 615swapper_pg_fixmap:
616 .fill 1024,4,0 616 .fill 1024,4,0
617ENTRY(empty_zero_page) 617ENTRY(empty_zero_page)
618 .fill 4096,1,0 618 .fill 4096,1,0
diff --git a/arch/x86/kernel/head_64.S b/arch/x86/kernel/head_64.S
index 53e5820d6054..eb415043a929 100644
--- a/arch/x86/kernel/head_64.S
+++ b/arch/x86/kernel/head_64.S
@@ -255,7 +255,7 @@ ENTRY(secondary_startup_64)
255 lretq 255 lretq
256 256
257 /* SMP bootup changes these two */ 257 /* SMP bootup changes these two */
258 __CPUINITDATA 258 __REFDATA
259 .align 8 259 .align 8
260 ENTRY(initial_code) 260 ENTRY(initial_code)
261 .quad x86_64_start_kernel 261 .quad x86_64_start_kernel
diff --git a/arch/x86/kernel/i387.c b/arch/x86/kernel/i387.c
index 26719bd2c77c..763dfc407232 100644
--- a/arch/x86/kernel/i387.c
+++ b/arch/x86/kernel/i387.c
@@ -39,7 +39,7 @@
39#define HAVE_HWFP 1 39#define HAVE_HWFP 1
40#endif 40#endif
41 41
42unsigned int mxcsr_feature_mask __read_mostly = 0xffffffffu; 42static unsigned int mxcsr_feature_mask __read_mostly = 0xffffffffu;
43 43
44void mxcsr_feature_mask_init(void) 44void mxcsr_feature_mask_init(void)
45{ 45{
diff --git a/arch/x86/kernel/i8259_32.c b/arch/x86/kernel/i8259_32.c
index 2d25b77102fe..fe631967d625 100644
--- a/arch/x86/kernel/i8259_32.c
+++ b/arch/x86/kernel/i8259_32.c
@@ -26,8 +26,6 @@
26 * present in the majority of PC/AT boxes. 26 * present in the majority of PC/AT boxes.
27 * plus some generic x86 specific things if generic specifics makes 27 * plus some generic x86 specific things if generic specifics makes
28 * any sense at all. 28 * any sense at all.
29 * this file should become arch/i386/kernel/irq.c when the old irq.c
30 * moves to arch independent land
31 */ 29 */
32 30
33static int i8259A_auto_eoi; 31static int i8259A_auto_eoi;
@@ -362,23 +360,12 @@ void __init init_ISA_irqs (void)
362#endif 360#endif
363 init_8259A(0); 361 init_8259A(0);
364 362
365 for (i = 0; i < NR_IRQS; i++) { 363 /*
366 irq_desc[i].status = IRQ_DISABLED; 364 * 16 old-style INTA-cycle interrupts:
367 irq_desc[i].action = NULL; 365 */
368 irq_desc[i].depth = 1; 366 for (i = 0; i < 16; i++) {
369 367 set_irq_chip_and_handler_name(i, &i8259A_chip,
370 if (i < 16) { 368 handle_level_irq, "XT");
371 /*
372 * 16 old-style INTA-cycle interrupts:
373 */
374 set_irq_chip_and_handler_name(i, &i8259A_chip,
375 handle_level_irq, "XT");
376 } else {
377 /*
378 * 'high' PCI IRQs filled in on demand
379 */
380 irq_desc[i].chip = &no_irq_chip;
381 }
382 } 369 }
383} 370}
384 371
diff --git a/arch/x86/kernel/io_delay.c b/arch/x86/kernel/io_delay.c
index bd49321034db..c706a3061553 100644
--- a/arch/x86/kernel/io_delay.c
+++ b/arch/x86/kernel/io_delay.c
@@ -13,7 +13,6 @@
13#include <asm/io.h> 13#include <asm/io.h>
14 14
15int io_delay_type __read_mostly = CONFIG_DEFAULT_IO_DELAY_TYPE; 15int io_delay_type __read_mostly = CONFIG_DEFAULT_IO_DELAY_TYPE;
16EXPORT_SYMBOL_GPL(io_delay_type);
17 16
18static int __initdata io_delay_override; 17static int __initdata io_delay_override;
19 18
diff --git a/arch/x86/kernel/kprobes.c b/arch/x86/kernel/kprobes.c
index a99e764fd66a..34a591283f5d 100644
--- a/arch/x86/kernel/kprobes.c
+++ b/arch/x86/kernel/kprobes.c
@@ -581,7 +581,7 @@ static int __kprobes kprobe_handler(struct pt_regs *regs)
581 * When a retprobed function returns, this code saves registers and 581 * When a retprobed function returns, this code saves registers and
582 * calls trampoline_handler() runs, which calls the kretprobe's handler. 582 * calls trampoline_handler() runs, which calls the kretprobe's handler.
583 */ 583 */
584void __kprobes kretprobe_trampoline_holder(void) 584static void __used __kprobes kretprobe_trampoline_holder(void)
585{ 585{
586 asm volatile ( 586 asm volatile (
587 ".global kretprobe_trampoline\n" 587 ".global kretprobe_trampoline\n"
@@ -673,7 +673,7 @@ void __kprobes kretprobe_trampoline_holder(void)
673/* 673/*
674 * Called from kretprobe_trampoline 674 * Called from kretprobe_trampoline
675 */ 675 */
676void * __kprobes trampoline_handler(struct pt_regs *regs) 676static __used __kprobes void *trampoline_handler(struct pt_regs *regs)
677{ 677{
678 struct kretprobe_instance *ri = NULL; 678 struct kretprobe_instance *ri = NULL;
679 struct hlist_head *head, empty_rp; 679 struct hlist_head *head, empty_rp;
diff --git a/arch/x86/kernel/nmi_32.c b/arch/x86/kernel/nmi_32.c
index edd413650b3b..6a0aa7038685 100644
--- a/arch/x86/kernel/nmi_32.c
+++ b/arch/x86/kernel/nmi_32.c
@@ -46,9 +46,6 @@ static unsigned int nmi_hz = HZ;
46 46
47static DEFINE_PER_CPU(short, wd_enabled); 47static DEFINE_PER_CPU(short, wd_enabled);
48 48
49/* local prototypes */
50static int unknown_nmi_panic_callback(struct pt_regs *regs, int cpu);
51
52static int endflag __initdata = 0; 49static int endflag __initdata = 0;
53 50
54#ifdef CONFIG_SMP 51#ifdef CONFIG_SMP
@@ -391,15 +388,6 @@ __kprobes int nmi_watchdog_tick(struct pt_regs * regs, unsigned reason)
391 return rc; 388 return rc;
392} 389}
393 390
394int do_nmi_callback(struct pt_regs * regs, int cpu)
395{
396#ifdef CONFIG_SYSCTL
397 if (unknown_nmi_panic)
398 return unknown_nmi_panic_callback(regs, cpu);
399#endif
400 return 0;
401}
402
403#ifdef CONFIG_SYSCTL 391#ifdef CONFIG_SYSCTL
404 392
405static int unknown_nmi_panic_callback(struct pt_regs *regs, int cpu) 393static int unknown_nmi_panic_callback(struct pt_regs *regs, int cpu)
@@ -453,6 +441,15 @@ int proc_nmi_enabled(struct ctl_table *table, int write, struct file *file,
453 441
454#endif 442#endif
455 443
444int do_nmi_callback(struct pt_regs *regs, int cpu)
445{
446#ifdef CONFIG_SYSCTL
447 if (unknown_nmi_panic)
448 return unknown_nmi_panic_callback(regs, cpu);
449#endif
450 return 0;
451}
452
456void __trigger_all_cpu_backtrace(void) 453void __trigger_all_cpu_backtrace(void)
457{ 454{
458 int i; 455 int i;
diff --git a/arch/x86/kernel/nmi_64.c b/arch/x86/kernel/nmi_64.c
index fb99484d21cf..9a4fde74bee1 100644
--- a/arch/x86/kernel/nmi_64.c
+++ b/arch/x86/kernel/nmi_64.c
@@ -46,9 +46,6 @@ static unsigned int nmi_hz = HZ;
46 46
47static DEFINE_PER_CPU(short, wd_enabled); 47static DEFINE_PER_CPU(short, wd_enabled);
48 48
49/* local prototypes */
50static int unknown_nmi_panic_callback(struct pt_regs *regs, int cpu);
51
52/* Run after command line and cpu_init init, but before all other checks */ 49/* Run after command line and cpu_init init, but before all other checks */
53void nmi_watchdog_default(void) 50void nmi_watchdog_default(void)
54{ 51{
@@ -394,15 +391,6 @@ asmlinkage __kprobes void do_nmi(struct pt_regs * regs, long error_code)
394 nmi_exit(); 391 nmi_exit();
395} 392}
396 393
397int do_nmi_callback(struct pt_regs * regs, int cpu)
398{
399#ifdef CONFIG_SYSCTL
400 if (unknown_nmi_panic)
401 return unknown_nmi_panic_callback(regs, cpu);
402#endif
403 return 0;
404}
405
406void stop_nmi(void) 394void stop_nmi(void)
407{ 395{
408 acpi_nmi_disable(); 396 acpi_nmi_disable();
@@ -464,6 +452,15 @@ int proc_nmi_enabled(struct ctl_table *table, int write, struct file *file,
464 452
465#endif 453#endif
466 454
455int do_nmi_callback(struct pt_regs *regs, int cpu)
456{
457#ifdef CONFIG_SYSCTL
458 if (unknown_nmi_panic)
459 return unknown_nmi_panic_callback(regs, cpu);
460#endif
461 return 0;
462}
463
467void __trigger_all_cpu_backtrace(void) 464void __trigger_all_cpu_backtrace(void)
468{ 465{
469 int i; 466 int i;
diff --git a/arch/x86/kernel/setup_32.c b/arch/x86/kernel/setup_32.c
index 691ab4cb167b..a1d7071a51c9 100644
--- a/arch/x86/kernel/setup_32.c
+++ b/arch/x86/kernel/setup_32.c
@@ -164,7 +164,6 @@ unsigned long mmu_cr4_features = X86_CR4_PAE;
164unsigned int machine_id; 164unsigned int machine_id;
165unsigned int machine_submodel_id; 165unsigned int machine_submodel_id;
166unsigned int BIOS_revision; 166unsigned int BIOS_revision;
167unsigned int mca_pentium_flag;
168 167
169/* Boot loader ID as an integer, for the benefit of proc_dointvec */ 168/* Boot loader ID as an integer, for the benefit of proc_dointvec */
170int bootloader_type; 169int bootloader_type;
diff --git a/arch/x86/kernel/setup_64.c b/arch/x86/kernel/setup_64.c
index c0d8208af12a..6fd804f07821 100644
--- a/arch/x86/kernel/setup_64.c
+++ b/arch/x86/kernel/setup_64.c
@@ -518,7 +518,7 @@ static void __cpuinit display_cacheinfo(struct cpuinfo_x86 *c)
518} 518}
519 519
520#ifdef CONFIG_NUMA 520#ifdef CONFIG_NUMA
521static int nearby_node(int apicid) 521static int __cpuinit nearby_node(int apicid)
522{ 522{
523 int i, node; 523 int i, node;
524 524
@@ -791,7 +791,7 @@ static int __cpuinit intel_num_cpu_cores(struct cpuinfo_x86 *c)
791 return 1; 791 return 1;
792} 792}
793 793
794static void srat_detect_node(void) 794static void __cpuinit srat_detect_node(void)
795{ 795{
796#ifdef CONFIG_NUMA 796#ifdef CONFIG_NUMA
797 unsigned node; 797 unsigned node;
@@ -1046,7 +1046,7 @@ __setup("noclflush", setup_noclflush);
1046void __cpuinit print_cpu_info(struct cpuinfo_x86 *c) 1046void __cpuinit print_cpu_info(struct cpuinfo_x86 *c)
1047{ 1047{
1048 if (c->x86_model_id[0]) 1048 if (c->x86_model_id[0])
1049 printk(KERN_INFO "%s", c->x86_model_id); 1049 printk(KERN_CONT "%s", c->x86_model_id);
1050 1050
1051 if (c->x86_mask || c->cpuid_level >= 0) 1051 if (c->x86_mask || c->cpuid_level >= 0)
1052 printk(KERN_CONT " stepping %02x\n", c->x86_mask); 1052 printk(KERN_CONT " stepping %02x\n", c->x86_mask);
diff --git a/arch/x86/kernel/topology.c b/arch/x86/kernel/topology.c
index a40051b71d9b..0fcc95a354f7 100644
--- a/arch/x86/kernel/topology.c
+++ b/arch/x86/kernel/topology.c
@@ -34,7 +34,7 @@
34static DEFINE_PER_CPU(struct x86_cpu, cpu_devices); 34static DEFINE_PER_CPU(struct x86_cpu, cpu_devices);
35 35
36#ifdef CONFIG_HOTPLUG_CPU 36#ifdef CONFIG_HOTPLUG_CPU
37int arch_register_cpu(int num) 37int __ref arch_register_cpu(int num)
38{ 38{
39 /* 39 /*
40 * CPU0 cannot be offlined due to several 40 * CPU0 cannot be offlined due to several
diff --git a/arch/x86/kernel/vmlinux_32.lds.S b/arch/x86/kernel/vmlinux_32.lds.S
index f1148ac8abe3..2ffa9656fe7a 100644
--- a/arch/x86/kernel/vmlinux_32.lds.S
+++ b/arch/x86/kernel/vmlinux_32.lds.S
@@ -38,7 +38,7 @@ SECTIONS
38 38
39 /* read-only */ 39 /* read-only */
40 .text : AT(ADDR(.text) - LOAD_OFFSET) { 40 .text : AT(ADDR(.text) - LOAD_OFFSET) {
41 . = ALIGN(4096); /* not really needed, already page aligned */ 41 . = ALIGN(PAGE_SIZE); /* not really needed, already page aligned */
42 *(.text.page_aligned) 42 *(.text.page_aligned)
43 TEXT_TEXT 43 TEXT_TEXT
44 SCHED_TEXT 44 SCHED_TEXT
@@ -70,21 +70,21 @@ SECTIONS
70 RODATA 70 RODATA
71 71
72 /* writeable */ 72 /* writeable */
73 . = ALIGN(4096); 73 . = ALIGN(PAGE_SIZE);
74 .data : AT(ADDR(.data) - LOAD_OFFSET) { /* Data */ 74 .data : AT(ADDR(.data) - LOAD_OFFSET) { /* Data */
75 DATA_DATA 75 DATA_DATA
76 CONSTRUCTORS 76 CONSTRUCTORS
77 } :data 77 } :data
78 78
79 . = ALIGN(4096); 79 . = ALIGN(PAGE_SIZE);
80 .data_nosave : AT(ADDR(.data_nosave) - LOAD_OFFSET) { 80 .data_nosave : AT(ADDR(.data_nosave) - LOAD_OFFSET) {
81 __nosave_begin = .; 81 __nosave_begin = .;
82 *(.data.nosave) 82 *(.data.nosave)
83 . = ALIGN(4096); 83 . = ALIGN(PAGE_SIZE);
84 __nosave_end = .; 84 __nosave_end = .;
85 } 85 }
86 86
87 . = ALIGN(4096); 87 . = ALIGN(PAGE_SIZE);
88 .data.page_aligned : AT(ADDR(.data.page_aligned) - LOAD_OFFSET) { 88 .data.page_aligned : AT(ADDR(.data.page_aligned) - LOAD_OFFSET) {
89 *(.data.page_aligned) 89 *(.data.page_aligned)
90 *(.data.idt) 90 *(.data.idt)
@@ -108,7 +108,7 @@ SECTIONS
108 } 108 }
109 109
110 /* might get freed after init */ 110 /* might get freed after init */
111 . = ALIGN(4096); 111 . = ALIGN(PAGE_SIZE);
112 .smp_locks : AT(ADDR(.smp_locks) - LOAD_OFFSET) { 112 .smp_locks : AT(ADDR(.smp_locks) - LOAD_OFFSET) {
113 __smp_locks = .; 113 __smp_locks = .;
114 *(.smp_locks) 114 *(.smp_locks)
@@ -120,10 +120,10 @@ SECTIONS
120 * after boot. Always make sure that ALIGN() directive is present after 120 * after boot. Always make sure that ALIGN() directive is present after
121 * the section which contains __smp_alt_end. 121 * the section which contains __smp_alt_end.
122 */ 122 */
123 . = ALIGN(4096); 123 . = ALIGN(PAGE_SIZE);
124 124
125 /* will be freed after init */ 125 /* will be freed after init */
126 . = ALIGN(4096); /* Init code and data */ 126 . = ALIGN(PAGE_SIZE); /* Init code and data */
127 .init.text : AT(ADDR(.init.text) - LOAD_OFFSET) { 127 .init.text : AT(ADDR(.init.text) - LOAD_OFFSET) {
128 __init_begin = .; 128 __init_begin = .;
129 _sinittext = .; 129 _sinittext = .;
@@ -174,23 +174,23 @@ SECTIONS
174 EXIT_DATA 174 EXIT_DATA
175 } 175 }
176#if defined(CONFIG_BLK_DEV_INITRD) 176#if defined(CONFIG_BLK_DEV_INITRD)
177 . = ALIGN(4096); 177 . = ALIGN(PAGE_SIZE);
178 .init.ramfs : AT(ADDR(.init.ramfs) - LOAD_OFFSET) { 178 .init.ramfs : AT(ADDR(.init.ramfs) - LOAD_OFFSET) {
179 __initramfs_start = .; 179 __initramfs_start = .;
180 *(.init.ramfs) 180 *(.init.ramfs)
181 __initramfs_end = .; 181 __initramfs_end = .;
182 } 182 }
183#endif 183#endif
184 . = ALIGN(4096); 184 . = ALIGN(PAGE_SIZE);
185 .data.percpu : AT(ADDR(.data.percpu) - LOAD_OFFSET) { 185 .data.percpu : AT(ADDR(.data.percpu) - LOAD_OFFSET) {
186 __per_cpu_start = .; 186 __per_cpu_start = .;
187 *(.data.percpu) 187 *(.data.percpu)
188 *(.data.percpu.shared_aligned) 188 *(.data.percpu.shared_aligned)
189 __per_cpu_end = .; 189 __per_cpu_end = .;
190 } 190 }
191 . = ALIGN(4096); 191 . = ALIGN(PAGE_SIZE);
192 /* freed after init ends here */ 192 /* freed after init ends here */
193 193
194 .bss : AT(ADDR(.bss) - LOAD_OFFSET) { 194 .bss : AT(ADDR(.bss) - LOAD_OFFSET) {
195 __init_end = .; 195 __init_end = .;
196 __bss_start = .; /* BSS */ 196 __bss_start = .; /* BSS */
@@ -200,7 +200,7 @@ SECTIONS
200 __bss_stop = .; 200 __bss_stop = .;
201 _end = . ; 201 _end = . ;
202 /* This is where the kernel creates the early boot page tables */ 202 /* This is where the kernel creates the early boot page tables */
203 . = ALIGN(4096); 203 . = ALIGN(PAGE_SIZE);
204 pg0 = . ; 204 pg0 = . ;
205 } 205 }
206 206
diff --git a/arch/x86/kernel/vmlinux_64.lds.S b/arch/x86/kernel/vmlinux_64.lds.S
index 0992b9946c6f..fab132299735 100644
--- a/arch/x86/kernel/vmlinux_64.lds.S
+++ b/arch/x86/kernel/vmlinux_64.lds.S
@@ -37,7 +37,7 @@ SECTIONS
37 KPROBES_TEXT 37 KPROBES_TEXT
38 *(.fixup) 38 *(.fixup)
39 *(.gnu.warning) 39 *(.gnu.warning)
40 _etext = .; /* End of text section */ 40 _etext = .; /* End of text section */
41 } :text = 0x9090 41 } :text = 0x9090
42 42
43 . = ALIGN(16); /* Exception table */ 43 . = ALIGN(16); /* Exception table */
@@ -60,7 +60,7 @@ SECTIONS
60 __tracedata_end = .; 60 __tracedata_end = .;
61 } 61 }
62 62
63 . = ALIGN(PAGE_SIZE); /* Align data segment to page size boundary */ 63 . = ALIGN(PAGE_SIZE); /* Align data segment to page size boundary */
64 /* Data */ 64 /* Data */
65 .data : AT(ADDR(.data) - LOAD_OFFSET) { 65 .data : AT(ADDR(.data) - LOAD_OFFSET) {
66 DATA_DATA 66 DATA_DATA
@@ -119,7 +119,7 @@ SECTIONS
119 .vsyscall_3 ADDR(.vsyscall_0) + 3072: AT(VLOAD(.vsyscall_3)) 119 .vsyscall_3 ADDR(.vsyscall_0) + 3072: AT(VLOAD(.vsyscall_3))
120 { *(.vsyscall_3) } 120 { *(.vsyscall_3) }
121 121
122 . = VSYSCALL_VIRT_ADDR + 4096; 122 . = VSYSCALL_VIRT_ADDR + PAGE_SIZE;
123 123
124#undef VSYSCALL_ADDR 124#undef VSYSCALL_ADDR
125#undef VSYSCALL_PHYS_ADDR 125#undef VSYSCALL_PHYS_ADDR
@@ -129,28 +129,28 @@ SECTIONS
129#undef VVIRT_OFFSET 129#undef VVIRT_OFFSET
130#undef VVIRT 130#undef VVIRT
131 131
132 . = ALIGN(8192); /* init_task */ 132 . = ALIGN(THREAD_SIZE); /* init_task */
133 .data.init_task : AT(ADDR(.data.init_task) - LOAD_OFFSET) { 133 .data.init_task : AT(ADDR(.data.init_task) - LOAD_OFFSET) {
134 *(.data.init_task) 134 *(.data.init_task)
135 }:data.init 135 }:data.init
136 136
137 . = ALIGN(4096); 137 . = ALIGN(PAGE_SIZE);
138 .data.page_aligned : AT(ADDR(.data.page_aligned) - LOAD_OFFSET) { 138 .data.page_aligned : AT(ADDR(.data.page_aligned) - LOAD_OFFSET) {
139 *(.data.page_aligned) 139 *(.data.page_aligned)
140 } 140 }
141 141
142 /* might get freed after init */ 142 /* might get freed after init */
143 . = ALIGN(4096); 143 . = ALIGN(PAGE_SIZE);
144 __smp_alt_begin = .; 144 __smp_alt_begin = .;
145 __smp_locks = .; 145 __smp_locks = .;
146 .smp_locks : AT(ADDR(.smp_locks) - LOAD_OFFSET) { 146 .smp_locks : AT(ADDR(.smp_locks) - LOAD_OFFSET) {
147 *(.smp_locks) 147 *(.smp_locks)
148 } 148 }
149 __smp_locks_end = .; 149 __smp_locks_end = .;
150 . = ALIGN(4096); 150 . = ALIGN(PAGE_SIZE);
151 __smp_alt_end = .; 151 __smp_alt_end = .;
152 152
153 . = ALIGN(4096); /* Init code and data */ 153 . = ALIGN(PAGE_SIZE); /* Init code and data */
154 __init_begin = .; 154 __init_begin = .;
155 .init.text : AT(ADDR(.init.text) - LOAD_OFFSET) { 155 .init.text : AT(ADDR(.init.text) - LOAD_OFFSET) {
156 _sinittext = .; 156 _sinittext = .;
@@ -191,7 +191,7 @@ SECTIONS
191 .altinstructions : AT(ADDR(.altinstructions) - LOAD_OFFSET) { 191 .altinstructions : AT(ADDR(.altinstructions) - LOAD_OFFSET) {
192 *(.altinstructions) 192 *(.altinstructions)
193 } 193 }
194 __alt_instructions_end = .; 194 __alt_instructions_end = .;
195 .altinstr_replacement : AT(ADDR(.altinstr_replacement) - LOAD_OFFSET) { 195 .altinstr_replacement : AT(ADDR(.altinstr_replacement) - LOAD_OFFSET) {
196 *(.altinstr_replacement) 196 *(.altinstr_replacement)
197 } 197 }
@@ -207,25 +207,25 @@ SECTIONS
207/* vdso blob that is mapped into user space */ 207/* vdso blob that is mapped into user space */
208 vdso_start = . ; 208 vdso_start = . ;
209 .vdso : AT(ADDR(.vdso) - LOAD_OFFSET) { *(.vdso) } 209 .vdso : AT(ADDR(.vdso) - LOAD_OFFSET) { *(.vdso) }
210 . = ALIGN(4096); 210 . = ALIGN(PAGE_SIZE);
211 vdso_end = .; 211 vdso_end = .;
212 212
213#ifdef CONFIG_BLK_DEV_INITRD 213#ifdef CONFIG_BLK_DEV_INITRD
214 . = ALIGN(4096); 214 . = ALIGN(PAGE_SIZE);
215 __initramfs_start = .; 215 __initramfs_start = .;
216 .init.ramfs : AT(ADDR(.init.ramfs) - LOAD_OFFSET) { *(.init.ramfs) } 216 .init.ramfs : AT(ADDR(.init.ramfs) - LOAD_OFFSET) { *(.init.ramfs) }
217 __initramfs_end = .; 217 __initramfs_end = .;
218#endif 218#endif
219 219
220 PERCPU(4096) 220 PERCPU(PAGE_SIZE)
221 221
222 . = ALIGN(4096); 222 . = ALIGN(PAGE_SIZE);
223 __init_end = .; 223 __init_end = .;
224 224
225 . = ALIGN(4096); 225 . = ALIGN(PAGE_SIZE);
226 __nosave_begin = .; 226 __nosave_begin = .;
227 .data_nosave : AT(ADDR(.data_nosave) - LOAD_OFFSET) { *(.data.nosave) } 227 .data_nosave : AT(ADDR(.data_nosave) - LOAD_OFFSET) { *(.data.nosave) }
228 . = ALIGN(4096); 228 . = ALIGN(PAGE_SIZE);
229 __nosave_end = .; 229 __nosave_end = .;
230 230
231 __bss_start = .; /* BSS */ 231 __bss_start = .; /* BSS */
diff --git a/arch/x86/lib/csum-wrappers_64.c b/arch/x86/lib/csum-wrappers_64.c
index fd42a4a095fc..459b58a8a15c 100644
--- a/arch/x86/lib/csum-wrappers_64.c
+++ b/arch/x86/lib/csum-wrappers_64.c
@@ -1,117 +1,129 @@
1/* Copyright 2002,2003 Andi Kleen, SuSE Labs. 1/*
2 * Copyright 2002, 2003 Andi Kleen, SuSE Labs.
2 * Subject to the GNU Public License v.2 3 * Subject to the GNU Public License v.2
3 * 4 *
4 * Wrappers of assembly checksum functions for x86-64. 5 * Wrappers of assembly checksum functions for x86-64.
5 */ 6 */
6
7#include <asm/checksum.h> 7#include <asm/checksum.h>
8#include <linux/module.h> 8#include <linux/module.h>
9 9
10/** 10/**
11 * csum_partial_copy_from_user - Copy and checksum from user space. 11 * csum_partial_copy_from_user - Copy and checksum from user space.
12 * @src: source address (user space) 12 * @src: source address (user space)
13 * @dst: destination address 13 * @dst: destination address
14 * @len: number of bytes to be copied. 14 * @len: number of bytes to be copied.
15 * @isum: initial sum that is added into the result (32bit unfolded) 15 * @isum: initial sum that is added into the result (32bit unfolded)
16 * @errp: set to -EFAULT for an bad source address. 16 * @errp: set to -EFAULT for an bad source address.
17 * 17 *
18 * Returns an 32bit unfolded checksum of the buffer. 18 * Returns an 32bit unfolded checksum of the buffer.
19 * src and dst are best aligned to 64bits. 19 * src and dst are best aligned to 64bits.
20 */ 20 */
21__wsum 21__wsum
22csum_partial_copy_from_user(const void __user *src, void *dst, 22csum_partial_copy_from_user(const void __user *src, void *dst,
23 int len, __wsum isum, int *errp) 23 int len, __wsum isum, int *errp)
24{ 24{
25 might_sleep(); 25 might_sleep();
26 *errp = 0; 26 *errp = 0;
27 if (likely(access_ok(VERIFY_READ,src, len))) { 27
28 /* Why 6, not 7? To handle odd addresses aligned we 28 if (!likely(access_ok(VERIFY_READ, src, len)))
29 would need to do considerable complications to fix the 29 goto out_err;
30 checksum which is defined as an 16bit accumulator. The 30
31 fix alignment code is primarily for performance 31 /*
32 compatibility with 32bit and that will handle odd 32 * Why 6, not 7? To handle odd addresses aligned we
33 addresses slowly too. */ 33 * would need to do considerable complications to fix the
34 if (unlikely((unsigned long)src & 6)) { 34 * checksum which is defined as an 16bit accumulator. The
35 while (((unsigned long)src & 6) && len >= 2) { 35 * fix alignment code is primarily for performance
36 __u16 val16; 36 * compatibility with 32bit and that will handle odd
37 *errp = __get_user(val16, (const __u16 __user *)src); 37 * addresses slowly too.
38 if (*errp) 38 */
39 return isum; 39 if (unlikely((unsigned long)src & 6)) {
40 *(__u16 *)dst = val16; 40 while (((unsigned long)src & 6) && len >= 2) {
41 isum = (__force __wsum)add32_with_carry( 41 __u16 val16;
42 (__force unsigned)isum, val16); 42
43 src += 2; 43 *errp = __get_user(val16, (const __u16 __user *)src);
44 dst += 2; 44 if (*errp)
45 len -= 2; 45 return isum;
46 } 46
47 *(__u16 *)dst = val16;
48 isum = (__force __wsum)add32_with_carry(
49 (__force unsigned)isum, val16);
50 src += 2;
51 dst += 2;
52 len -= 2;
47 } 53 }
48 isum = csum_partial_copy_generic((__force const void *)src, 54 }
49 dst, len, isum, errp, NULL); 55 isum = csum_partial_copy_generic((__force const void *)src,
50 if (likely(*errp == 0)) 56 dst, len, isum, errp, NULL);
51 return isum; 57 if (unlikely(*errp))
52 } 58 goto out_err;
59
60 return isum;
61
62out_err:
53 *errp = -EFAULT; 63 *errp = -EFAULT;
54 memset(dst,0,len); 64 memset(dst, 0, len);
55 return isum;
56}
57 65
66 return isum;
67}
58EXPORT_SYMBOL(csum_partial_copy_from_user); 68EXPORT_SYMBOL(csum_partial_copy_from_user);
59 69
60/** 70/**
61 * csum_partial_copy_to_user - Copy and checksum to user space. 71 * csum_partial_copy_to_user - Copy and checksum to user space.
62 * @src: source address 72 * @src: source address
63 * @dst: destination address (user space) 73 * @dst: destination address (user space)
64 * @len: number of bytes to be copied. 74 * @len: number of bytes to be copied.
65 * @isum: initial sum that is added into the result (32bit unfolded) 75 * @isum: initial sum that is added into the result (32bit unfolded)
66 * @errp: set to -EFAULT for an bad destination address. 76 * @errp: set to -EFAULT for an bad destination address.
67 * 77 *
68 * Returns an 32bit unfolded checksum of the buffer. 78 * Returns an 32bit unfolded checksum of the buffer.
69 * src and dst are best aligned to 64bits. 79 * src and dst are best aligned to 64bits.
70 */ 80 */
71__wsum 81__wsum
72csum_partial_copy_to_user(const void *src, void __user *dst, 82csum_partial_copy_to_user(const void *src, void __user *dst,
73 int len, __wsum isum, int *errp) 83 int len, __wsum isum, int *errp)
74{ 84{
75 might_sleep(); 85 might_sleep();
86
76 if (unlikely(!access_ok(VERIFY_WRITE, dst, len))) { 87 if (unlikely(!access_ok(VERIFY_WRITE, dst, len))) {
77 *errp = -EFAULT; 88 *errp = -EFAULT;
78 return 0; 89 return 0;
79 } 90 }
80 91
81 if (unlikely((unsigned long)dst & 6)) { 92 if (unlikely((unsigned long)dst & 6)) {
82 while (((unsigned long)dst & 6) && len >= 2) { 93 while (((unsigned long)dst & 6) && len >= 2) {
83 __u16 val16 = *(__u16 *)src; 94 __u16 val16 = *(__u16 *)src;
95
84 isum = (__force __wsum)add32_with_carry( 96 isum = (__force __wsum)add32_with_carry(
85 (__force unsigned)isum, val16); 97 (__force unsigned)isum, val16);
86 *errp = __put_user(val16, (__u16 __user *)dst); 98 *errp = __put_user(val16, (__u16 __user *)dst);
87 if (*errp) 99 if (*errp)
88 return isum; 100 return isum;
89 src += 2; 101 src += 2;
90 dst += 2; 102 dst += 2;
91 len -= 2; 103 len -= 2;
92 } 104 }
93 } 105 }
94 106
95 *errp = 0; 107 *errp = 0;
96 return csum_partial_copy_generic(src, (void __force *)dst,len,isum,NULL,errp); 108 return csum_partial_copy_generic(src, (void __force *)dst,
97} 109 len, isum, NULL, errp);
98 110}
99EXPORT_SYMBOL(csum_partial_copy_to_user); 111EXPORT_SYMBOL(csum_partial_copy_to_user);
100 112
101/** 113/**
102 * csum_partial_copy_nocheck - Copy and checksum. 114 * csum_partial_copy_nocheck - Copy and checksum.
103 * @src: source address 115 * @src: source address
104 * @dst: destination address 116 * @dst: destination address
105 * @len: number of bytes to be copied. 117 * @len: number of bytes to be copied.
106 * @isum: initial sum that is added into the result (32bit unfolded) 118 * @isum: initial sum that is added into the result (32bit unfolded)
107 * 119 *
108 * Returns an 32bit unfolded checksum of the buffer. 120 * Returns an 32bit unfolded checksum of the buffer.
109 */ 121 */
110__wsum 122__wsum
111csum_partial_copy_nocheck(const void *src, void *dst, int len, __wsum sum) 123csum_partial_copy_nocheck(const void *src, void *dst, int len, __wsum sum)
112{ 124{
113 return csum_partial_copy_generic(src,dst,len,sum,NULL,NULL); 125 return csum_partial_copy_generic(src, dst, len, sum, NULL, NULL);
114} 126}
115EXPORT_SYMBOL(csum_partial_copy_nocheck); 127EXPORT_SYMBOL(csum_partial_copy_nocheck);
116 128
117__sum16 csum_ipv6_magic(const struct in6_addr *saddr, 129__sum16 csum_ipv6_magic(const struct in6_addr *saddr,
@@ -119,17 +131,20 @@ __sum16 csum_ipv6_magic(const struct in6_addr *saddr,
119 __u32 len, unsigned short proto, __wsum sum) 131 __u32 len, unsigned short proto, __wsum sum)
120{ 132{
121 __u64 rest, sum64; 133 __u64 rest, sum64;
122 134
123 rest = (__force __u64)htonl(len) + (__force __u64)htons(proto) + 135 rest = (__force __u64)htonl(len) + (__force __u64)htons(proto) +
124 (__force __u64)sum; 136 (__force __u64)sum;
125 asm(" addq (%[saddr]),%[sum]\n"
126 " adcq 8(%[saddr]),%[sum]\n"
127 " adcq (%[daddr]),%[sum]\n"
128 " adcq 8(%[daddr]),%[sum]\n"
129 " adcq $0,%[sum]\n"
130 : [sum] "=r" (sum64)
131 : "[sum]" (rest),[saddr] "r" (saddr), [daddr] "r" (daddr));
132 return csum_fold((__force __wsum)add32_with_carry(sum64 & 0xffffffff, sum64>>32));
133}
134 137
138 asm(" addq (%[saddr]),%[sum]\n"
139 " adcq 8(%[saddr]),%[sum]\n"
140 " adcq (%[daddr]),%[sum]\n"
141 " adcq 8(%[daddr]),%[sum]\n"
142 " adcq $0,%[sum]\n"
143
144 : [sum] "=r" (sum64)
145 : "[sum]" (rest), [saddr] "r" (saddr), [daddr] "r" (daddr));
146
147 return csum_fold(
148 (__force __wsum)add32_with_carry(sum64 & 0xffffffff, sum64>>32));
149}
135EXPORT_SYMBOL(csum_ipv6_magic); 150EXPORT_SYMBOL(csum_ipv6_magic);
diff --git a/arch/x86/lib/io_64.c b/arch/x86/lib/io_64.c
index 87b4a4e18039..3f1eb59b5f08 100644
--- a/arch/x86/lib/io_64.c
+++ b/arch/x86/lib/io_64.c
@@ -1,23 +1,25 @@
1#include <linux/string.h> 1#include <linux/string.h>
2#include <asm/io.h>
3#include <linux/module.h> 2#include <linux/module.h>
3#include <asm/io.h>
4 4
5void __memcpy_toio(unsigned long dst,const void*src,unsigned len) 5void __memcpy_toio(unsigned long dst, const void *src, unsigned len)
6{ 6{
7 __inline_memcpy((void *) dst,src,len); 7 __inline_memcpy((void *)dst, src, len);
8} 8}
9EXPORT_SYMBOL(__memcpy_toio); 9EXPORT_SYMBOL(__memcpy_toio);
10 10
11void __memcpy_fromio(void *dst,unsigned long src,unsigned len) 11void __memcpy_fromio(void *dst, unsigned long src, unsigned len)
12{ 12{
13 __inline_memcpy(dst,(const void *) src,len); 13 __inline_memcpy(dst, (const void *)src, len);
14} 14}
15EXPORT_SYMBOL(__memcpy_fromio); 15EXPORT_SYMBOL(__memcpy_fromio);
16 16
17void memset_io(volatile void __iomem *a, int b, size_t c) 17void memset_io(volatile void __iomem *a, int b, size_t c)
18{ 18{
19 /* XXX: memset can mangle the IO patterns quite a bit. 19 /*
20 perhaps it would be better to use a dumb one */ 20 * TODO: memset can mangle the IO patterns quite a bit.
21 memset((void *)a,b,c); 21 * perhaps it would be better to use a dumb one:
22 */
23 memset((void *)a, b, c);
22} 24}
23EXPORT_SYMBOL(memset_io); 25EXPORT_SYMBOL(memset_io);
diff --git a/arch/x86/mm/ioremap.c b/arch/x86/mm/ioremap.c
index 69f4981db80f..882328efc3db 100644
--- a/arch/x86/mm/ioremap.c
+++ b/arch/x86/mm/ioremap.c
@@ -42,6 +42,22 @@ int page_is_ram(unsigned long pagenr)
42 unsigned long addr, end; 42 unsigned long addr, end;
43 int i; 43 int i;
44 44
45 /*
46 * A special case is the first 4Kb of memory;
47 * This is a BIOS owned area, not kernel ram, but generally
48 * not listed as such in the E820 table.
49 */
50 if (pagenr == 0)
51 return 0;
52
53 /*
54 * Second special case: Some BIOSen report the PC BIOS
55 * area (640->1Mb) as ram even though it is not.
56 */
57 if (pagenr >= (BIOS_BEGIN >> PAGE_SHIFT) &&
58 pagenr < (BIOS_END >> PAGE_SHIFT))
59 return 0;
60
45 for (i = 0; i < e820.nr_map; i++) { 61 for (i = 0; i < e820.nr_map; i++) {
46 /* 62 /*
47 * Not usable memory: 63 * Not usable memory:
@@ -51,14 +67,6 @@ int page_is_ram(unsigned long pagenr)
51 addr = (e820.map[i].addr + PAGE_SIZE-1) >> PAGE_SHIFT; 67 addr = (e820.map[i].addr + PAGE_SIZE-1) >> PAGE_SHIFT;
52 end = (e820.map[i].addr + e820.map[i].size) >> PAGE_SHIFT; 68 end = (e820.map[i].addr + e820.map[i].size) >> PAGE_SHIFT;
53 69
54 /*
55 * Sanity check: Some BIOSen report areas as RAM that
56 * are not. Notably the 640->1Mb area, which is the
57 * PCI BIOS area.
58 */
59 if (addr >= (BIOS_BEGIN >> PAGE_SHIFT) &&
60 end < (BIOS_END >> PAGE_SHIFT))
61 continue;
62 70
63 if ((pagenr >= addr) && (pagenr < end)) 71 if ((pagenr >= addr) && (pagenr < end))
64 return 1; 72 return 1;
diff --git a/arch/x86/mm/pageattr.c b/arch/x86/mm/pageattr.c
index 3ee14996c829..e2a74ea11a53 100644
--- a/arch/x86/mm/pageattr.c
+++ b/arch/x86/mm/pageattr.c
@@ -513,7 +513,6 @@ static int __change_page_attr(struct cpa_data *cpa, int primary)
513 unsigned long address = cpa->vaddr; 513 unsigned long address = cpa->vaddr;
514 int do_split, err; 514 int do_split, err;
515 unsigned int level; 515 unsigned int level;
516 struct page *kpte_page;
517 pte_t *kpte, old_pte; 516 pte_t *kpte, old_pte;
518 517
519repeat: 518repeat:
@@ -532,10 +531,6 @@ repeat:
532 return -EINVAL; 531 return -EINVAL;
533 } 532 }
534 533
535 kpte_page = virt_to_page(kpte);
536 BUG_ON(PageLRU(kpte_page));
537 BUG_ON(PageCompound(kpte_page));
538
539 if (level == PG_LEVEL_4K) { 534 if (level == PG_LEVEL_4K) {
540 pte_t new_pte; 535 pte_t new_pte;
541 pgprot_t new_prot = pte_pgprot(old_pte); 536 pgprot_t new_prot = pte_pgprot(old_pte);
diff --git a/arch/x86/mm/srat_64.c b/arch/x86/mm/srat_64.c
index ecd91ea8a8ae..845001c617cc 100644
--- a/arch/x86/mm/srat_64.c
+++ b/arch/x86/mm/srat_64.c
@@ -166,7 +166,8 @@ static inline int save_add_info(void) {return 0;}
166 * Both SPARSE and RESERVE need nodes_add information. 166 * Both SPARSE and RESERVE need nodes_add information.
167 * This code supports one contiguous hot add area per node. 167 * This code supports one contiguous hot add area per node.
168 */ 168 */
169static int reserve_hotadd(int node, unsigned long start, unsigned long end) 169static int __init
170reserve_hotadd(int node, unsigned long start, unsigned long end)
170{ 171{
171 unsigned long s_pfn = start >> PAGE_SHIFT; 172 unsigned long s_pfn = start >> PAGE_SHIFT;
172 unsigned long e_pfn = end >> PAGE_SHIFT; 173 unsigned long e_pfn = end >> PAGE_SHIFT;
diff --git a/arch/x86/pci/common.c b/arch/x86/pci/common.c
index b7c67a187b6b..7b6e3bb9b28c 100644
--- a/arch/x86/pci/common.c
+++ b/arch/x86/pci/common.c
@@ -541,7 +541,7 @@ void pcibios_disable_device (struct pci_dev *dev)
541 pcibios_disable_irq(dev); 541 pcibios_disable_irq(dev);
542} 542}
543 543
544struct pci_bus *pci_scan_bus_with_sysdata(int busno) 544struct pci_bus *__devinit pci_scan_bus_with_sysdata(int busno)
545{ 545{
546 struct pci_bus *bus = NULL; 546 struct pci_bus *bus = NULL;
547 struct pci_sysdata *sd; 547 struct pci_sysdata *sd;
diff --git a/arch/x86/power/hibernate_asm_64.S b/arch/x86/power/hibernate_asm_64.S
index 1deb3244b99b..000415947d93 100644
--- a/arch/x86/power/hibernate_asm_64.S
+++ b/arch/x86/power/hibernate_asm_64.S
@@ -20,6 +20,7 @@
20#include <asm/segment.h> 20#include <asm/segment.h>
21#include <asm/page.h> 21#include <asm/page.h>
22#include <asm/asm-offsets.h> 22#include <asm/asm-offsets.h>
23#include <asm/processor-flags.h>
23 24
24ENTRY(swsusp_arch_suspend) 25ENTRY(swsusp_arch_suspend)
25 movq $saved_context, %rax 26 movq $saved_context, %rax
@@ -60,7 +61,7 @@ ENTRY(restore_image)
60 /* Flush TLB */ 61 /* Flush TLB */
61 movq mmu_cr4_features(%rip), %rax 62 movq mmu_cr4_features(%rip), %rax
62 movq %rax, %rdx 63 movq %rax, %rdx
63 andq $~(1<<7), %rdx # PGE 64 andq $~(X86_CR4_PGE), %rdx
64 movq %rdx, %cr4; # turn off PGE 65 movq %rdx, %cr4; # turn off PGE
65 movq %cr3, %rcx; # flush TLB 66 movq %cr3, %rcx; # flush TLB
66 movq %rcx, %cr3; 67 movq %rcx, %cr3;
@@ -112,7 +113,7 @@ ENTRY(restore_registers)
112 /* Flush TLB, including "global" things (vmalloc) */ 113 /* Flush TLB, including "global" things (vmalloc) */
113 movq mmu_cr4_features(%rip), %rax 114 movq mmu_cr4_features(%rip), %rax
114 movq %rax, %rdx 115 movq %rax, %rdx
115 andq $~(1<<7), %rdx; # PGE 116 andq $~(X86_CR4_PGE), %rdx
116 movq %rdx, %cr4; # turn off PGE 117 movq %rdx, %cr4; # turn off PGE
117 movq %cr3, %rcx; # flush TLB 118 movq %cr3, %rcx; # flush TLB
118 movq %rcx, %cr3 119 movq %rcx, %cr3
diff --git a/arch/xtensa/Makefile b/arch/xtensa/Makefile
index 56685a883347..4bd1e14c6b90 100644
--- a/arch/xtensa/Makefile
+++ b/arch/xtensa/Makefile
@@ -59,7 +59,7 @@ LIBGCC := $(shell $(CC) $(KBUILD_CFLAGS) -print-libgcc-file-name)
59head-y := arch/xtensa/kernel/head.o 59head-y := arch/xtensa/kernel/head.o
60core-y += arch/xtensa/kernel/ arch/xtensa/mm/ 60core-y += arch/xtensa/kernel/ arch/xtensa/mm/
61ifneq ($(PLATFORM),) 61ifneq ($(PLATFORM),)
62core-y += arch/xtensa/platform-$(PLATFORM)/ 62core-y += arch/xtensa/platforms/$(PLATFORM)/
63endif 63endif
64libs-y += arch/xtensa/lib/ $(LIBGCC) 64libs-y += arch/xtensa/lib/ $(LIBGCC)
65 65
diff --git a/arch/xtensa/boot/boot-elf/Makefile b/arch/xtensa/boot/boot-elf/Makefile
index 734db7f76583..08e8814f8c71 100644
--- a/arch/xtensa/boot/boot-elf/Makefile
+++ b/arch/xtensa/boot/boot-elf/Makefile
@@ -14,25 +14,26 @@ OBJCOPY_ARGS := -O elf32-xtensa-le
14endif 14endif
15 15
16export OBJCOPY_ARGS 16export OBJCOPY_ARGS
17export CPPFLAGS_boot.lds += -P -C
17 18
18boot-y := bootstrap.o 19boot-y := bootstrap.o
19 20
20OBJS := $(addprefix $(obj)/,$(boot-y)) 21OBJS := $(addprefix $(obj)/,$(boot-y))
21 22
22Image: vmlinux $(OBJS) 23Image: vmlinux $(OBJS) arch/$(ARCH)/boot/boot-elf/boot.lds
23 $(OBJCOPY) --strip-all -R .comment -R .xt.insn -O binary \ 24 $(OBJCOPY) --strip-all -R .comment -R .note.gnu.build-id -O binary \
24 vmlinux vmlinux.tmp 25 vmlinux vmlinux.tmp
25 $(OBJCOPY) $(OBJCOPY_ARGS) -R .comment \ 26 $(OBJCOPY) $(OBJCOPY_ARGS) -R .comment \
26 --add-section image=vmlinux.tmp \ 27 --add-section image=vmlinux.tmp \
27 --set-section-flags image=contents,alloc,load,load,data \ 28 --set-section-flags image=contents,alloc,load,load,data \
28 $(OBJS) $@.tmp 29 $(OBJS) $@.tmp
29 $(LD) $(LDFLAGS) $(LDFLAGS_vmlinux) \ 30 $(LD) $(LDFLAGS) $(LDFLAGS_vmlinux) \
30 -T $(srctree)/arch/$(ARCH)/boot/boot-elf/boot.ld \ 31 -T arch/$(ARCH)/boot/boot-elf/boot.lds \
31 -o arch/$(ARCH)/boot/$@.elf $@.tmp 32 -o arch/$(ARCH)/boot/$@.elf $@.tmp
32 rm -f $@.tmp vmlinux.tmp 33 rm -f $@.tmp vmlinux.tmp
33 34
34Image.initrd: vmlinux $(OBJS) 35Image.initrd: vmlinux $(OBJS)
35 $(OBJCOPY) --strip-all -R .comment -R .xt.insn -O binary \ 36 $(OBJCOPY) --strip-all -R .comment -R .note.gnu.build-id -O binary \
36 --add-section .initrd=arch/$(ARCH)/boot/ramdisk \ 37 --add-section .initrd=arch/$(ARCH)/boot/ramdisk \
37 --set-section-flags .initrd=contents,alloc,load,load,data \ 38 --set-section-flags .initrd=contents,alloc,load,load,data \
38 vmlinux vmlinux.tmp 39 vmlinux vmlinux.tmp
diff --git a/arch/xtensa/boot/boot-elf/boot.ld b/arch/xtensa/boot/boot-elf/boot.lds.S
index 4ab06a0a7a6b..849dfcafd518 100644
--- a/arch/xtensa/boot/boot-elf/boot.ld
+++ b/arch/xtensa/boot/boot-elf/boot.lds.S
@@ -1,4 +1,6 @@
1#include <asm/variant/core.h>
1OUTPUT_ARCH(xtensa) 2OUTPUT_ARCH(xtensa)
3ENTRY(_ResetVector)
2 4
3SECTIONS 5SECTIONS
4{ 6{
@@ -61,7 +63,7 @@ SECTIONS
61 _end = .; 63 _end = .;
62 _param_start = .; 64 _param_start = .;
63 65
64 .ResetVector.text 0xfe000020 : 66 .ResetVector.text XCHAL_RESET_VECTOR_VADDR :
65 { 67 {
66 *(.ResetVector.text) 68 *(.ResetVector.text)
67 } 69 }
diff --git a/arch/xtensa/boot/boot-redboot/Makefile b/arch/xtensa/boot/boot-redboot/Makefile
index 74d15d08077b..872029b84435 100644
--- a/arch/xtensa/boot/boot-redboot/Makefile
+++ b/arch/xtensa/boot/boot-redboot/Makefile
@@ -22,7 +22,7 @@ LIBS := arch/xtensa/boot/lib/lib.a arch/xtensa/lib/lib.a
22LIBGCC := $(shell $(CC) $(KBUILD_CFLAGS) -print-libgcc-file-name) 22LIBGCC := $(shell $(CC) $(KBUILD_CFLAGS) -print-libgcc-file-name)
23 23
24zImage: vmlinux $(OBJS) $(LIBS) 24zImage: vmlinux $(OBJS) $(LIBS)
25 $(OBJCOPY) --strip-all -R .comment -R .xt.insn -O binary \ 25 $(OBJCOPY) --strip-all -R .comment -R .note.gnu.build-id -O binary \
26 vmlinux vmlinux.tmp 26 vmlinux vmlinux.tmp
27 gzip -vf9 vmlinux.tmp 27 gzip -vf9 vmlinux.tmp
28 $(OBJCOPY) $(OBJCOPY_ARGS) -R .comment \ 28 $(OBJCOPY) $(OBJCOPY_ARGS) -R .comment \
diff --git a/arch/xtensa/boot/boot-redboot/boot.ld b/arch/xtensa/boot/boot-redboot/boot.ld
index 65b726410e8a..774db20d11f7 100644
--- a/arch/xtensa/boot/boot-redboot/boot.ld
+++ b/arch/xtensa/boot/boot-redboot/boot.ld
@@ -2,7 +2,7 @@ OUTPUT_ARCH(xtensa)
2 2
3SECTIONS 3SECTIONS
4{ 4{
5 .start 0xD0200000 : { *(.start) } 5 .start 0xD1000000 : { *(.start) }
6 6
7 .text : 7 .text :
8 { 8 {
diff --git a/arch/xtensa/kernel/asm-offsets.c b/arch/xtensa/kernel/asm-offsets.c
index d5ffe7b6443e..ef63adadf7f4 100644
--- a/arch/xtensa/kernel/asm-offsets.c
+++ b/arch/xtensa/kernel/asm-offsets.c
@@ -21,7 +21,6 @@
21#include <linux/mm.h> 21#include <linux/mm.h>
22 22
23#include <asm/ptrace.h> 23#include <asm/ptrace.h>
24#include <asm/processor.h>
25#include <asm/uaccess.h> 24#include <asm/uaccess.h>
26 25
27#define DEFINE(sym, val) asm volatile("\n->" #sym " %0 " #val : : "i" (val)) 26#define DEFINE(sym, val) asm volatile("\n->" #sym " %0 " #val : : "i" (val))
@@ -64,6 +63,8 @@ int main(void)
64 DEFINE(PT_SIZE, sizeof(struct pt_regs)); 63 DEFINE(PT_SIZE, sizeof(struct pt_regs));
65 DEFINE(PT_AREG_END, offsetof (struct pt_regs, areg[XCHAL_NUM_AREGS])); 64 DEFINE(PT_AREG_END, offsetof (struct pt_regs, areg[XCHAL_NUM_AREGS]));
66 DEFINE(PT_USER_SIZE, offsetof(struct pt_regs, areg[XCHAL_NUM_AREGS])); 65 DEFINE(PT_USER_SIZE, offsetof(struct pt_regs, areg[XCHAL_NUM_AREGS]));
66 DEFINE(PT_XTREGS_OPT, offsetof(struct pt_regs, xtregs_opt));
67 DEFINE(XTREGS_OPT_SIZE, sizeof(xtregs_opt_t));
67 68
68 /* struct task_struct */ 69 /* struct task_struct */
69 DEFINE(TASK_PTRACE, offsetof (struct task_struct, ptrace)); 70 DEFINE(TASK_PTRACE, offsetof (struct task_struct, ptrace));
@@ -77,7 +78,19 @@ int main(void)
77 /* struct thread_info (offset from start_struct) */ 78 /* struct thread_info (offset from start_struct) */
78 DEFINE(THREAD_RA, offsetof (struct task_struct, thread.ra)); 79 DEFINE(THREAD_RA, offsetof (struct task_struct, thread.ra));
79 DEFINE(THREAD_SP, offsetof (struct task_struct, thread.sp)); 80 DEFINE(THREAD_SP, offsetof (struct task_struct, thread.sp));
80 DEFINE(THREAD_CP_SAVE, offsetof (struct task_struct, thread.cp_save)); 81 DEFINE(THREAD_CPENABLE, offsetof (struct thread_info, cpenable));
82#if XTENSA_HAVE_COPROCESSORS
83 DEFINE(THREAD_XTREGS_CP0, offsetof (struct thread_info, xtregs_cp));
84 DEFINE(THREAD_XTREGS_CP1, offsetof (struct thread_info, xtregs_cp));
85 DEFINE(THREAD_XTREGS_CP2, offsetof (struct thread_info, xtregs_cp));
86 DEFINE(THREAD_XTREGS_CP3, offsetof (struct thread_info, xtregs_cp));
87 DEFINE(THREAD_XTREGS_CP4, offsetof (struct thread_info, xtregs_cp));
88 DEFINE(THREAD_XTREGS_CP5, offsetof (struct thread_info, xtregs_cp));
89 DEFINE(THREAD_XTREGS_CP6, offsetof (struct thread_info, xtregs_cp));
90 DEFINE(THREAD_XTREGS_CP7, offsetof (struct thread_info, xtregs_cp));
91#endif
92 DEFINE(THREAD_XTREGS_USER, offsetof (struct thread_info, xtregs_user));
93 DEFINE(XTREGS_USER_SIZE, sizeof(xtregs_user_t));
81 DEFINE(THREAD_CURRENT_DS, offsetof (struct task_struct, thread.current_ds)); 94 DEFINE(THREAD_CURRENT_DS, offsetof (struct task_struct, thread.current_ds));
82 95
83 /* struct mm_struct */ 96 /* struct mm_struct */
diff --git a/arch/xtensa/kernel/coprocessor.S b/arch/xtensa/kernel/coprocessor.S
index 01bcb9fcfcbd..2bc1e145c0a4 100644
--- a/arch/xtensa/kernel/coprocessor.S
+++ b/arch/xtensa/kernel/coprocessor.S
@@ -8,193 +8,328 @@
8 * License. See the file "COPYING" in the main directory of this archive 8 * License. See the file "COPYING" in the main directory of this archive
9 * for more details. 9 * for more details.
10 * 10 *
11 * Copyright (C) 2003 - 2005 Tensilica Inc. 11 * Copyright (C) 2003 - 2007 Tensilica Inc.
12 *
13 * Marc Gauthier <marc@tensilica.com> <marc@alumni.uwaterloo.ca>
14 */ 12 */
15 13
16/*
17 * This module contains a table that describes the layout of the various
18 * custom registers and states associated with each coprocessor, as well
19 * as those not associated with any coprocessor ("extra state").
20 * This table is included with core dumps and is available via the ptrace
21 * interface, allowing the layout of such register/state information to
22 * be modified in the kernel without affecting the debugger. Each
23 * register or state is identified using a 32-bit "libdb target number"
24 * assigned when the Xtensa processor is generated.
25 */
26 14
27#include <linux/linkage.h> 15#include <linux/linkage.h>
16#include <asm/asm-offsets.h>
28#include <asm/processor.h> 17#include <asm/processor.h>
18#include <asm/coprocessor.h>
19#include <asm/thread_info.h>
20#include <asm/uaccess.h>
21#include <asm/unistd.h>
22#include <asm/ptrace.h>
23#include <asm/current.h>
24#include <asm/pgtable.h>
25#include <asm/page.h>
26#include <asm/signal.h>
27#include <asm/tlbflush.h>
29 28
30#if XCHAL_HAVE_CP 29/*
30 * Entry condition:
31 *
32 * a0: trashed, original value saved on stack (PT_AREG0)
33 * a1: a1
34 * a2: new stack pointer, original in DEPC
35 * a3: dispatch table
36 * depc: a2, original value saved on stack (PT_DEPC)
37 * excsave_1: a3
38 *
39 * PT_DEPC >= VALID_DOUBLE_EXCEPTION_ADDRESS: double exception, DEPC
40 * < VALID_DOUBLE_EXCEPTION_ADDRESS: regular exception
41 */
31 42
32#define CP_LAST ((XCHAL_CP_MAX - 1) * COPROCESSOR_INFO_SIZE) 43/* IO protection is currently unsupported. */
33 44
34ENTRY(release_coprocessors) 45ENTRY(fast_io_protect)
46 wsr a0, EXCSAVE_1
47 movi a0, unrecoverable_exception
48 callx0 a0
35 49
36 entry a1, 16 50#if XTENSA_HAVE_COPROCESSORS
37 # a2: task
38 movi a3, 1 << XCHAL_CP_MAX # a3: coprocessor-bit
39 movi a4, coprocessor_info+CP_LAST # a4: owner-table
40 # a5: tmp
41 movi a6, 0 # a6: 0
42 rsil a7, LOCKLEVEL # a7: PS
43 51
441: /* Check if task is coprocessor owner of coprocessor[i]. */ 52/*
53 * Macros for lazy context switch.
54 */
45 55
46 l32i a5, a4, COPROCESSOR_INFO_OWNER 56#define SAVE_CP_REGS(x) \
47 srli a3, a3, 1 57 .align 4; \
48 beqz a3, 1f 58 .Lsave_cp_regs_cp##x: \
49 addi a4, a4, -8 59 .if XTENSA_HAVE_COPROCESSOR(x); \
50 beq a2, a5, 1b 60 xchal_cp##x##_store a2 a4 a5 a6 a7; \
61 .endif; \
62 jx a0
51 63
52 /* Found an entry: Clear entry CPENABLE bit to disable CP. */ 64#define SAVE_CP_REGS_TAB(x) \
65 .if XTENSA_HAVE_COPROCESSOR(x); \
66 .long .Lsave_cp_regs_cp##x - .Lsave_cp_regs_jump_table; \
67 .else; \
68 .long 0; \
69 .endif; \
70 .long THREAD_XTREGS_CP##x
53 71
54 rsr a5, CPENABLE
55 s32i a6, a4, COPROCESSOR_INFO_OWNER
56 xor a5, a3, a5
57 wsr a5, CPENABLE
58 72
59 bnez a3, 1b 73#define LOAD_CP_REGS(x) \
74 .align 4; \
75 .Lload_cp_regs_cp##x: \
76 .if XTENSA_HAVE_COPROCESSOR(x); \
77 xchal_cp##x##_load a2 a4 a5 a6 a7; \
78 .endif; \
79 jx a0
60 80
611: wsr a7, PS 81#define LOAD_CP_REGS_TAB(x) \
62 rsync 82 .if XTENSA_HAVE_COPROCESSOR(x); \
63 retw 83 .long .Lload_cp_regs_cp##x - .Lload_cp_regs_jump_table; \
84 .else; \
85 .long 0; \
86 .endif; \
87 .long THREAD_XTREGS_CP##x
64 88
89 SAVE_CP_REGS(0)
90 SAVE_CP_REGS(1)
91 SAVE_CP_REGS(2)
92 SAVE_CP_REGS(3)
93 SAVE_CP_REGS(4)
94 SAVE_CP_REGS(5)
95 SAVE_CP_REGS(6)
96 SAVE_CP_REGS(7)
65 97
66ENTRY(disable_coprocessor) 98 LOAD_CP_REGS(0)
67 entry sp, 16 99 LOAD_CP_REGS(1)
68 rsil a7, LOCKLEVEL 100 LOAD_CP_REGS(2)
69 rsr a3, CPENABLE 101 LOAD_CP_REGS(3)
70 movi a4, 1 102 LOAD_CP_REGS(4)
71 ssl a2 103 LOAD_CP_REGS(5)
72 sll a4, a4 104 LOAD_CP_REGS(6)
73 and a4, a3, a4 105 LOAD_CP_REGS(7)
74 xor a3, a3, a4
75 wsr a3, CPENABLE
76 wsr a7, PS
77 rsync
78 retw
79 106
80ENTRY(enable_coprocessor) 107 .align 4
81 entry sp, 16 108.Lsave_cp_regs_jump_table:
82 rsil a7, LOCKLEVEL 109 SAVE_CP_REGS_TAB(0)
83 rsr a3, CPENABLE 110 SAVE_CP_REGS_TAB(1)
84 movi a4, 1 111 SAVE_CP_REGS_TAB(2)
85 ssl a2 112 SAVE_CP_REGS_TAB(3)
86 sll a4, a4 113 SAVE_CP_REGS_TAB(4)
87 or a3, a3, a4 114 SAVE_CP_REGS_TAB(5)
88 wsr a3, CPENABLE 115 SAVE_CP_REGS_TAB(6)
89 wsr a7, PS 116 SAVE_CP_REGS_TAB(7)
90 rsync
91 retw
92 117
118.Lload_cp_regs_jump_table:
119 LOAD_CP_REGS_TAB(0)
120 LOAD_CP_REGS_TAB(1)
121 LOAD_CP_REGS_TAB(2)
122 LOAD_CP_REGS_TAB(3)
123 LOAD_CP_REGS_TAB(4)
124 LOAD_CP_REGS_TAB(5)
125 LOAD_CP_REGS_TAB(6)
126 LOAD_CP_REGS_TAB(7)
93 127
94ENTRY(save_coprocessor_extra) 128/*
95 entry sp, 16 129 * coprocessor_save(buffer, index)
96 xchal_extra_store_funcbody 130 * a2 a3
97 retw 131 * coprocessor_load(buffer, index)
132 * a2 a3
133 *
134 * Save or load coprocessor registers for coprocessor 'index'.
135 * The register values are saved to or loaded from them 'buffer' address.
136 *
137 * Note that these functions don't update the coprocessor_owner information!
138 *
139 */
98 140
99ENTRY(restore_coprocessor_extra) 141ENTRY(coprocessor_save)
100 entry sp, 16 142 entry a1, 32
101 xchal_extra_load_funcbody 143 s32i a0, a1, 0
144 movi a0, .Lsave_cp_regs_jump_table
145 addx8 a3, a3, a0
146 l32i a3, a3, 0
147 beqz a3, 1f
148 add a0, a0, a3
149 callx0 a0
1501: l32i a0, a1, 0
102 retw 151 retw
103 152
104ENTRY(save_coprocessor_registers) 153ENTRY(coprocessor_load)
105 entry sp, 16 154 entry a1, 32
106 xchal_cpi_store_funcbody 155 s32i a0, a1, 0
156 movi a0, .Lload_cp_regs_jump_table
157 addx4 a3, a3, a0
158 l32i a3, a3, 0
159 beqz a3, 1f
160 add a0, a0, a3
161 callx0 a0
1621: l32i a0, a1, 0
107 retw 163 retw
108 164
109ENTRY(restore_coprocessor_registers) 165/*
110 entry sp, 16 166 * coprocessor_flush(struct task_info*, index)
111 xchal_cpi_load_funcbody 167 * a2 a3
168 * coprocessor_restore(struct task_info*, index)
169 * a2 a3
170 *
171 * Save or load coprocessor registers for coprocessor 'index'.
172 * The register values are saved to or loaded from the coprocessor area
173 * inside the task_info structure.
174 *
175 * Note that these functions don't update the coprocessor_owner information!
176 *
177 */
178
179
180ENTRY(coprocessor_flush)
181 entry a1, 32
182 s32i a0, a1, 0
183 movi a0, .Lsave_cp_regs_jump_table
184 addx8 a3, a3, a0
185 l32i a4, a3, 4
186 l32i a3, a3, 0
187 add a2, a2, a4
188 beqz a3, 1f
189 add a0, a0, a3
190 callx0 a0
1911: l32i a0, a1, 0
112 retw 192 retw
113 193
194ENTRY(coprocessor_restore)
195 entry a1, 32
196 s32i a0, a1, 0
197 movi a0, .Lload_cp_regs_jump_table
198 addx4 a3, a3, a0
199 l32i a4, a3, 4
200 l32i a3, a3, 0
201 add a2, a2, a4
202 beqz a3, 1f
203 add a0, a0, a3
204 callx0 a0
2051: l32i a0, a1, 0
206 retw
114 207
115/* 208/*
116 * The Xtensa compile-time HAL (core.h) XCHAL_*_SA_CONTENTS_LIBDB macros 209 * Entry condition:
117 * describe the contents of coprocessor & extra save areas in terms of
118 * undefined CONTENTS_LIBDB_{SREG,UREG,REGF} macros. We define these
119 * latter macros here; they expand into a table of the format we want.
120 * The general format is:
121 * 210 *
122 * CONTENTS_LIBDB_SREG(libdbnum, offset, size, align, rsv1, name, sregnum, 211 * a0: trashed, original value saved on stack (PT_AREG0)
123 * bitmask, rsv2, rsv3) 212 * a1: a1
124 * CONTENTS_LIBDB_UREG(libdbnum, offset, size, align, rsv1, name, uregnum, 213 * a2: new stack pointer, original in DEPC
125 * bitmask, rsv2, rsv3) 214 * a3: dispatch table
126 * CONTENTS_LIBDB_REGF(libdbnum, offset, size, align, rsv1, name, index, 215 * depc: a2, original value saved on stack (PT_DEPC)
127 * numentries, contentsize, regname_base, 216 * excsave_1: a3
128 * regfile_name, rsv2, rsv3)
129 * 217 *
130 * For this table, we only care about the <libdbnum>, <offset> and <size> 218 * PT_DEPC >= VALID_DOUBLE_EXCEPTION_ADDRESS: double exception, DEPC
131 * fields. 219 * < VALID_DOUBLE_EXCEPTION_ADDRESS: regular exception
132 */ 220 */
133 221
134/* Map all XCHAL CONTENTS macros to the reg_entry asm macro defined below: */ 222ENTRY(fast_coprocessor_double)
135 223 wsr a0, EXCSAVE_1
136#define CONTENTS_LIBDB_SREG(libdbnum,offset,size,align,rsv1,name,sregnum, \ 224 movi a0, unrecoverable_exception
137 bitmask, rsv2, rsv3) \ 225 callx0 a0
138 reg_entry libdbnum, offset, size ;
139#define CONTENTS_LIBDB_UREG(libdbnum,offset,size,align,rsv1,name,uregnum, \
140 bitmask, rsv2, rsv3) \
141 reg_entry libdbnum, offset, size ;
142#define CONTENTS_LIBDB_REGF(libdbnum, offset, size, align, rsv1, name, index, \
143 numentries, contentsize, regname_base, \
144 regfile_name, rsv2, rsv3) \
145 reg_entry libdbnum, offset, size ;
146
147/* A single table entry: */
148 .macro reg_entry libdbnum, offset, size
149 .ifne (__last_offset-(__last_group_offset+\offset))
150 /* padding entry */
151 .word (0xFC000000+__last_offset-(__last_group_offset+\offset))
152 .endif
153 .word \libdbnum /* actual entry */
154 .set __last_offset, __last_group_offset+\offset+\size
155 .endm /* reg_entry */
156
157
158/* Table entry that marks the beginning of a group (coprocessor or "extra"): */
159 .macro reg_group cpnum, num_entries, align
160 .set __last_group_offset, (__last_offset + \align- 1) & -\align
161 .ifne \num_entries
162 .word 0xFD000000+(\cpnum<<16)+\num_entries
163 .endif
164 .endm /* reg_group */
165 226
166/*
167 * Register info tables.
168 */
169 227
170 .section .rodata, "a" 228ENTRY(fast_coprocessor)
171 .globl _xtensa_reginfo_tables 229
172 .globl _xtensa_reginfo_table_size 230 /* Save remaining registers a1-a3 and SAR */
173 .align 4 231
174_xtensa_reginfo_table_size: 232 xsr a3, EXCSAVE_1
175 .word _xtensa_reginfo_table_end - _xtensa_reginfo_tables 233 s32i a3, a2, PT_AREG3
176 234 rsr a3, SAR
177_xtensa_reginfo_tables: 235 s32i a1, a2, PT_AREG1
178 .set __last_offset, 0 236 s32i a3, a2, PT_SAR
179 reg_group 0xFF, XCHAL_EXTRA_SA_CONTENTS_LIBDB_NUM, XCHAL_EXTRA_SA_ALIGN 237 mov a1, a2
180 XCHAL_EXTRA_SA_CONTENTS_LIBDB 238 rsr a2, DEPC
181 reg_group 0, XCHAL_CP0_SA_CONTENTS_LIBDB_NUM, XCHAL_CP0_SA_ALIGN 239 s32i a2, a1, PT_AREG2
182 XCHAL_CP0_SA_CONTENTS_LIBDB 240
183 reg_group 1, XCHAL_CP1_SA_CONTENTS_LIBDB_NUM, XCHAL_CP1_SA_ALIGN 241 /*
184 XCHAL_CP1_SA_CONTENTS_LIBDB 242 * The hal macros require up to 4 temporary registers. We use a3..a6.
185 reg_group 2, XCHAL_CP2_SA_CONTENTS_LIBDB_NUM, XCHAL_CP2_SA_ALIGN 243 */
186 XCHAL_CP2_SA_CONTENTS_LIBDB 244
187 reg_group 3, XCHAL_CP3_SA_CONTENTS_LIBDB_NUM, XCHAL_CP3_SA_ALIGN 245 s32i a4, a1, PT_AREG4
188 XCHAL_CP3_SA_CONTENTS_LIBDB 246 s32i a5, a1, PT_AREG5
189 reg_group 4, XCHAL_CP4_SA_CONTENTS_LIBDB_NUM, XCHAL_CP4_SA_ALIGN 247 s32i a6, a1, PT_AREG6
190 XCHAL_CP4_SA_CONTENTS_LIBDB 248
191 reg_group 5, XCHAL_CP5_SA_CONTENTS_LIBDB_NUM, XCHAL_CP5_SA_ALIGN 249 /* Find coprocessor number. Subtract first CP EXCCAUSE from EXCCAUSE */
192 XCHAL_CP5_SA_CONTENTS_LIBDB 250
193 reg_group 6, XCHAL_CP6_SA_CONTENTS_LIBDB_NUM, XCHAL_CP6_SA_ALIGN 251 rsr a3, EXCCAUSE
194 XCHAL_CP6_SA_CONTENTS_LIBDB 252 addi a3, a3, -EXCCAUSE_COPROCESSOR0_DISABLED
195 reg_group 7, XCHAL_CP7_SA_CONTENTS_LIBDB_NUM, XCHAL_CP7_SA_ALIGN 253
196 XCHAL_CP7_SA_CONTENTS_LIBDB 254 /* Set corresponding CPENABLE bit -> (sar:cp-index, a3: 1<<cp-index)*/
197 .word 0xFC000000 /* invalid register number,marks end of table*/ 255
198_xtensa_reginfo_table_end: 256 ssl a3 # SAR: 32 - coprocessor_number
199#endif 257 movi a2, 1
258 rsr a0, CPENABLE
259 sll a2, a2
260 or a0, a0, a2
261 wsr a0, CPENABLE
262 rsync
263
264 /* Retrieve previous owner. (a3 still holds CP number) */
265
266 movi a0, coprocessor_owner # list of owners
267 addx4 a0, a3, a0 # entry for CP
268 l32i a4, a0, 0
269
270 beqz a4, 1f # skip 'save' if no previous owner
271
272 /* Disable coprocessor for previous owner. (a2 = 1 << CP number) */
273
274 l32i a5, a4, THREAD_CPENABLE
275 xor a5, a5, a2 # (1 << cp-id) still in a2
276 s32i a5, a4, THREAD_CPENABLE
277
278 /*
279 * Get context save area and 'call' save routine.
280 * (a4 still holds previous owner (thread_info), a3 CP number)
281 */
282
283 movi a5, .Lsave_cp_regs_jump_table
284 movi a0, 2f # a0: 'return' address
285 addx8 a3, a3, a5 # a3: coprocessor number
286 l32i a2, a3, 4 # a2: xtregs offset
287 l32i a3, a3, 0 # a3: jump offset
288 add a2, a2, a4
289 add a4, a3, a5 # a4: address of save routine
290 jx a4
291
292 /* Note that only a0 and a1 were preserved. */
293
2942: rsr a3, EXCCAUSE
295 addi a3, a3, -EXCCAUSE_COPROCESSOR0_DISABLED
296 movi a0, coprocessor_owner
297 addx4 a0, a3, a0
298
299 /* Set new 'owner' (a0 points to the CP owner, a3 contains the CP nr) */
300
3011: GET_THREAD_INFO (a4, a1)
302 s32i a4, a0, 0
303
304 /* Get context save area and 'call' load routine. */
305
306 movi a5, .Lload_cp_regs_jump_table
307 movi a0, 1f
308 addx8 a3, a3, a5
309 l32i a2, a3, 4 # a2: xtregs offset
310 l32i a3, a3, 0 # a3: jump offset
311 add a2, a2, a4
312 add a4, a3, a5
313 jx a4
314
315 /* Restore all registers and return from exception handler. */
316
3171: l32i a6, a1, PT_AREG6
318 l32i a5, a1, PT_AREG5
319 l32i a4, a1, PT_AREG4
320
321 l32i a0, a1, PT_SAR
322 l32i a3, a1, PT_AREG3
323 l32i a2, a1, PT_AREG2
324 wsr a0, SAR
325 l32i a0, a1, PT_AREG0
326 l32i a1, a1, PT_AREG1
327
328 rfe
329
330 .data
331ENTRY(coprocessor_owner)
332 .fill XCHAL_CP_MAX, 4, 0
333
334#endif /* XTENSA_HAVE_COPROCESSORS */
200 335
diff --git a/arch/xtensa/kernel/entry.S b/arch/xtensa/kernel/entry.S
index 91a689eca43d..dfd35dcc1cb5 100644
--- a/arch/xtensa/kernel/entry.S
+++ b/arch/xtensa/kernel/entry.S
@@ -25,10 +25,10 @@
25#include <asm/page.h> 25#include <asm/page.h>
26#include <asm/signal.h> 26#include <asm/signal.h>
27#include <asm/tlbflush.h> 27#include <asm/tlbflush.h>
28#include <asm/variant/tie-asm.h>
28 29
29/* Unimplemented features. */ 30/* Unimplemented features. */
30 31
31#undef SIGNAL_HANDLING_IN_DOUBLE_EXCEPTION
32#undef KERNEL_STACK_OVERFLOW_CHECK 32#undef KERNEL_STACK_OVERFLOW_CHECK
33#undef PREEMPTIBLE_KERNEL 33#undef PREEMPTIBLE_KERNEL
34#undef ALLOCA_EXCEPTION_IN_IRAM 34#undef ALLOCA_EXCEPTION_IN_IRAM
@@ -214,19 +214,7 @@ _user_exception:
214 214
215 /* We are back to the original stack pointer (a1) */ 215 /* We are back to the original stack pointer (a1) */
216 216
2172: 2172: /* Now, jump to the common exception handler. */
218#if XCHAL_EXTRA_SA_SIZE
219
220 /* For user exceptions, save the extra state into the user's TCB.
221 * Note: We must assume that xchal_extra_store_funcbody destroys a2..a15
222 */
223
224 GET_CURRENT(a2,a1)
225 addi a2, a2, THREAD_CP_SAVE
226 xchal_extra_store_funcbody
227#endif
228
229 /* Now, jump to the common exception handler. */
230 218
231 j common_exception 219 j common_exception
232 220
@@ -382,6 +370,10 @@ common_exception:
382 s32i a2, a1, PT_LBEG 370 s32i a2, a1, PT_LBEG
383 s32i a3, a1, PT_LEND 371 s32i a3, a1, PT_LEND
384 372
373 /* Save optional registers. */
374
375 save_xtregs_opt a1 a2 a4 a5 a6 a7 PT_XTREGS_OPT
376
385 /* Go to second-level dispatcher. Set up parameters to pass to the 377 /* Go to second-level dispatcher. Set up parameters to pass to the
386 * exception handler and call the exception handler. 378 * exception handler and call the exception handler.
387 */ 379 */
@@ -403,74 +395,49 @@ common_exception_return:
403 /* Jump if we are returning from kernel exceptions. */ 395 /* Jump if we are returning from kernel exceptions. */
404 396
4051: l32i a3, a1, PT_PS 3971: l32i a3, a1, PT_PS
406 _bbsi.l a3, PS_UM_BIT, 2f 398 _bbci.l a3, PS_UM_BIT, 4f
407 j kernel_exception_exit
408 399
409 /* Specific to a user exception exit: 400 /* Specific to a user exception exit:
410 * We need to check some flags for signal handling and rescheduling, 401 * We need to check some flags for signal handling and rescheduling,
411 * and have to restore WB and WS, extra states, and all registers 402 * and have to restore WB and WS, extra states, and all registers
412 * in the register file that were in use in the user task. 403 * in the register file that were in use in the user task.
413 */ 404 * Note that we don't disable interrupts here.
414
4152: wsr a3, PS /* disable interrupts */
416
417 /* Check for signals (keep interrupts disabled while we read TI_FLAGS)
418 * Note: PS.INTLEVEL = 0, PS.EXCM = 1
419 */ 405 */
420 406
421 GET_THREAD_INFO(a2,a1) 407 GET_THREAD_INFO(a2,a1)
422 l32i a4, a2, TI_FLAGS 408 l32i a4, a2, TI_FLAGS
423 409
424 /* Enable interrupts again.
425 * Note: When we get here, we certainly have handled any interrupts.
426 * (Hint: There is only one user exception frame on stack)
427 */
428
429 movi a3, 1 << PS_WOE_BIT
430
431 _bbsi.l a4, TIF_NEED_RESCHED, 3f 410 _bbsi.l a4, TIF_NEED_RESCHED, 3f
432 _bbci.l a4, TIF_SIGPENDING, 4f 411 _bbci.l a4, TIF_SIGPENDING, 4f
433 412
434#ifndef SIGNAL_HANDLING_IN_DOUBLE_EXCEPTION
435 l32i a4, a1, PT_DEPC 413 l32i a4, a1, PT_DEPC
436 bgeui a4, VALID_DOUBLE_EXCEPTION_ADDRESS, 4f 414 bgeui a4, VALID_DOUBLE_EXCEPTION_ADDRESS, 4f
437#endif
438 415
439 /* Reenable interrupts and call do_signal() */ 416 /* Call do_signal() */
440 417
441 wsr a3, PS
442 movi a4, do_signal # int do_signal(struct pt_regs*, sigset_t*) 418 movi a4, do_signal # int do_signal(struct pt_regs*, sigset_t*)
443 mov a6, a1 419 mov a6, a1
444 movi a7, 0 420 movi a7, 0
445 callx4 a4 421 callx4 a4
446 j 1b 422 j 1b
447 423
4483: /* Reenable interrupts and reschedule */ 4243: /* Reschedule */
449 425
450 wsr a3, PS
451 movi a4, schedule # void schedule (void) 426 movi a4, schedule # void schedule (void)
452 callx4 a4 427 callx4 a4
453 j 1b 428 j 1b
454 429
455 /* Restore the state of the task and return from the exception. */ 4304: /* Restore optional registers. */
456
4574: /* a2 holds GET_CURRENT(a2,a1) */
458
459#if XCHAL_EXTRA_SA_SIZE
460 431
461 /* For user exceptions, restore the extra state from the user's TCB. */ 432 load_xtregs_opt a1 a2 a4 a5 a6 a7 PT_XTREGS_OPT
462 433
463 /* Note: a2 still contains GET_CURRENT(a2,a1) */ 434 wsr a3, PS /* disable interrupts */
464 addi a2, a2, THREAD_CP_SAVE
465 xchal_extra_load_funcbody
466 435
467 /* We must assume that xchal_extra_store_funcbody destroys 436 _bbci.l a3, PS_UM_BIT, kernel_exception_exit
468 * registers a2..a15. FIXME, this list can eventually be
469 * reduced once real register requirements of the macro are
470 * finalized. */
471 437
472#endif /* XCHAL_EXTRA_SA_SIZE */ 438user_exception_exit:
473 439
440 /* Restore the state of the task and return from the exception. */
474 441
475 /* Switch to the user thread WINDOWBASE. Save SP temporarily in DEPC */ 442 /* Switch to the user thread WINDOWBASE. Save SP temporarily in DEPC */
476 443
@@ -536,10 +503,6 @@ common_exception_return:
536 503
537kernel_exception_exit: 504kernel_exception_exit:
538 505
539 /* Disable interrupts (a3 holds PT_PS) */
540
541 wsr a3, PS
542
543#ifdef PREEMPTIBLE_KERNEL 506#ifdef PREEMPTIBLE_KERNEL
544 507
545#ifdef CONFIG_PREEMPT 508#ifdef CONFIG_PREEMPT
@@ -618,6 +581,8 @@ kernel_exception_exit:
618 581
619common_exception_exit: 582common_exception_exit:
620 583
584 /* Restore address registers. */
585
621 _bbsi.l a2, 1, 1f 586 _bbsi.l a2, 1, 1f
622 l32i a4, a1, PT_AREG4 587 l32i a4, a1, PT_AREG4
623 l32i a5, a1, PT_AREG5 588 l32i a5, a1, PT_AREG5
@@ -1150,7 +1115,6 @@ CATCH
1150 * excsave_1: a3 1115 * excsave_1: a3
1151 * 1116 *
1152 * Note: We assume the stack pointer is EXC_TABLE_KSTK in the fixup handler. 1117 * Note: We assume the stack pointer is EXC_TABLE_KSTK in the fixup handler.
1153 * Note: We don't need to save a2 in depc (return value)
1154 */ 1118 */
1155 1119
1156ENTRY(fast_syscall_spill_registers) 1120ENTRY(fast_syscall_spill_registers)
@@ -1166,29 +1130,31 @@ ENTRY(fast_syscall_spill_registers)
1166 1130
1167 rsr a0, SAR 1131 rsr a0, SAR
1168 xsr a3, EXCSAVE_1 # restore a3 and excsave_1 1132 xsr a3, EXCSAVE_1 # restore a3 and excsave_1
1169 s32i a0, a2, PT_AREG4 # store SAR to PT_AREG4
1170 s32i a3, a2, PT_AREG3 1133 s32i a3, a2, PT_AREG3
1134 s32i a4, a2, PT_AREG4
1135 s32i a0, a2, PT_AREG5 # store SAR to PT_AREG5
1171 1136
1172 /* The spill routine might clobber a7, a11, and a15. */ 1137 /* The spill routine might clobber a7, a11, and a15. */
1173 1138
1174 s32i a7, a2, PT_AREG5 1139 s32i a7, a2, PT_AREG7
1175 s32i a11, a2, PT_AREG6 1140 s32i a11, a2, PT_AREG11
1176 s32i a15, a2, PT_AREG7 1141 s32i a15, a2, PT_AREG15
1177 1142
1178 call0 _spill_registers # destroys a3, DEPC, and SAR 1143 call0 _spill_registers # destroys a3, a4, and SAR
1179 1144
1180 /* Advance PC, restore registers and SAR, and return from exception. */ 1145 /* Advance PC, restore registers and SAR, and return from exception. */
1181 1146
1182 l32i a3, a2, PT_AREG4 1147 l32i a3, a2, PT_AREG5
1148 l32i a4, a2, PT_AREG4
1183 l32i a0, a2, PT_AREG0 1149 l32i a0, a2, PT_AREG0
1184 wsr a3, SAR 1150 wsr a3, SAR
1185 l32i a3, a2, PT_AREG3 1151 l32i a3, a2, PT_AREG3
1186 1152
1187 /* Restore clobbered registers. */ 1153 /* Restore clobbered registers. */
1188 1154
1189 l32i a7, a2, PT_AREG5 1155 l32i a7, a2, PT_AREG7
1190 l32i a11, a2, PT_AREG6 1156 l32i a11, a2, PT_AREG11
1191 l32i a15, a2, PT_AREG7 1157 l32i a15, a2, PT_AREG15
1192 1158
1193 movi a2, 0 1159 movi a2, 0
1194 rfe 1160 rfe
@@ -1247,16 +1213,6 @@ fast_syscall_spill_registers_fixup:
1247 * Note: This frame might be the same as above. 1213 * Note: This frame might be the same as above.
1248 */ 1214 */
1249 1215
1250#ifdef SIGNAL_HANDLING_IN_DOUBLE_EXCEPTION
1251 /* Restore registers we precautiously saved.
1252 * We have the value of the 'right' a3
1253 */
1254
1255 l32i a7, a2, PT_AREG5
1256 l32i a11, a2, PT_AREG6
1257 l32i a15, a2, PT_AREG7
1258#endif
1259
1260 /* Setup stack pointer. */ 1216 /* Setup stack pointer. */
1261 1217
1262 addi a2, a2, -PT_USER_SIZE 1218 addi a2, a2, -PT_USER_SIZE
@@ -1271,9 +1227,9 @@ fast_syscall_spill_registers_fixup:
1271 1227
1272 movi a3, exc_table 1228 movi a3, exc_table
1273 rsr a0, EXCCAUSE 1229 rsr a0, EXCCAUSE
1274 addx4 a0, a0, a3 # find entry in table 1230 addx4 a0, a0, a3 # find entry in table
1275 l32i a0, a0, EXC_TABLE_FAST_USER # load handler 1231 l32i a0, a0, EXC_TABLE_FAST_USER # load handler
1276 jx a0 1232 jx a0
1277 1233
1278fast_syscall_spill_registers_fixup_return: 1234fast_syscall_spill_registers_fixup_return:
1279 1235
@@ -1290,14 +1246,6 @@ fast_syscall_spill_registers_fixup_return:
1290 s32i a2, a3, EXC_TABLE_PARAM 1246 s32i a2, a3, EXC_TABLE_PARAM
1291 l32i a2, a3, EXC_TABLE_KSTK 1247 l32i a2, a3, EXC_TABLE_KSTK
1292 1248
1293#ifdef SIGNAL_HANDLING_IN_DOUBLE_EXCEPTION
1294 /* Save registers again that might be clobbered. */
1295
1296 s32i a7, a2, PT_AREG5
1297 s32i a11, a2, PT_AREG6
1298 s32i a15, a2, PT_AREG7
1299#endif
1300
1301 /* Load WB at the time the exception occurred. */ 1249 /* Load WB at the time the exception occurred. */
1302 1250
1303 rsr a3, SAR # WB is still in SAR 1251 rsr a3, SAR # WB is still in SAR
@@ -1319,7 +1267,7 @@ fast_syscall_spill_registers_fixup_return:
1319 * This is not a real function. The following conditions must be met: 1267 * This is not a real function. The following conditions must be met:
1320 * 1268 *
1321 * - must be called with call0. 1269 * - must be called with call0.
1322 * - uses DEPC, a3 and SAR. 1270 * - uses a3, a4 and SAR.
1323 * - the last 'valid' register of each frame are clobbered. 1271 * - the last 'valid' register of each frame are clobbered.
1324 * - the caller must have registered a fixup handler 1272 * - the caller must have registered a fixup handler
1325 * (or be inside a critical section) 1273 * (or be inside a critical section)
@@ -1331,41 +1279,39 @@ ENTRY(_spill_registers)
1331 /* 1279 /*
1332 * Rotate ws so that the current windowbase is at bit 0. 1280 * Rotate ws so that the current windowbase is at bit 0.
1333 * Assume ws = xxxwww1yy (www1 current window frame). 1281 * Assume ws = xxxwww1yy (www1 current window frame).
1334 * Rotate ws right so that a2 = yyxxxwww1. 1282 * Rotate ws right so that a4 = yyxxxwww1.
1335 */ 1283 */
1336 1284
1337 wsr a2, DEPC # preserve a2 1285 rsr a4, WINDOWBASE
1338 rsr a2, WINDOWBASE 1286 rsr a3, WINDOWSTART # a3 = xxxwww1yy
1339 rsr a3, WINDOWSTART 1287 ssr a4 # holds WB
1340 ssr a2 # holds WB 1288 slli a4, a3, WSBITS
1341 slli a2, a3, WSBITS 1289 or a3, a3, a4 # a3 = xxxwww1yyxxxwww1yy
1342 or a3, a3, a2 # a2 = xxxwww1yyxxxwww1yy 1290 srl a3, a3 # a3 = 00xxxwww1yyxxxwww1
1343 srl a3, a3
1344 1291
1345 /* We are done if there are no more than the current register frame. */ 1292 /* We are done if there are no more than the current register frame. */
1346 1293
1347 extui a3, a3, 1, WSBITS-2 # a3 = 0yyxxxwww 1294 extui a3, a3, 1, WSBITS-1 # a3 = 0yyxxxwww
1348 movi a2, (1 << (WSBITS-1)) 1295 movi a4, (1 << (WSBITS-1))
1349 _beqz a3, .Lnospill # only one active frame? jump 1296 _beqz a3, .Lnospill # only one active frame? jump
1350 1297
1351 /* We want 1 at the top, so that we return to the current windowbase */ 1298 /* We want 1 at the top, so that we return to the current windowbase */
1352 1299
1353 or a3, a3, a2 # 1yyxxxwww 1300 or a3, a3, a4 # 1yyxxxwww
1354 1301
1355 /* Skip empty frames - get 'oldest' WINDOWSTART-bit. */ 1302 /* Skip empty frames - get 'oldest' WINDOWSTART-bit. */
1356 1303
1357 wsr a3, WINDOWSTART # save shifted windowstart 1304 wsr a3, WINDOWSTART # save shifted windowstart
1358 neg a2, a3 1305 neg a4, a3
1359 and a3, a2, a3 # first bit set from right: 000010000 1306 and a3, a4, a3 # first bit set from right: 000010000
1360 1307
1361 ffs_ws a2, a3 # a2: shifts to skip empty frames 1308 ffs_ws a4, a3 # a4: shifts to skip empty frames
1362 movi a3, WSBITS 1309 movi a3, WSBITS
1363 sub a2, a3, a2 # WSBITS-a2:number of 0-bits from right 1310 sub a4, a3, a4 # WSBITS-a4:number of 0-bits from right
1364 ssr a2 # save in SAR for later. 1311 ssr a4 # save in SAR for later.
1365 1312
1366 rsr a3, WINDOWBASE 1313 rsr a3, WINDOWBASE
1367 add a3, a3, a2 1314 add a3, a3, a4
1368 rsr a2, DEPC # restore a2
1369 wsr a3, WINDOWBASE 1315 wsr a3, WINDOWBASE
1370 rsync 1316 rsync
1371 1317
@@ -1394,6 +1340,9 @@ ENTRY(_spill_registers)
1394 l32e a4, a1, -16 1340 l32e a4, a1, -16
1395 j .Lc12c 1341 j .Lc12c
1396 1342
1343.Lnospill:
1344 ret
1345
1397.Lloop: _bbsi.l a3, 1, .Lc4 1346.Lloop: _bbsi.l a3, 1, .Lc4
1398 _bbci.l a3, 2, .Lc12 1347 _bbci.l a3, 2, .Lc12
1399 1348
@@ -1419,9 +1368,7 @@ ENTRY(_spill_registers)
1419 movi a3, 1 1368 movi a3, 1
1420 sll a3, a3 1369 sll a3, a3
1421 wsr a3, WINDOWSTART 1370 wsr a3, WINDOWSTART
1422 1371 ret
1423.Lnospill:
1424 jx a0
1425 1372
1426.Lc4: s32e a4, a9, -16 1373.Lc4: s32e a4, a9, -16
1427 s32e a5, a9, -12 1374 s32e a5, a9, -12
@@ -1830,154 +1777,6 @@ ENTRY(fast_store_prohibited)
18301: j _user_exception 17771: j _user_exception
1831 1778
1832 1779
1833#if XCHAL_EXTRA_SA_SIZE
1834
1835#warning fast_coprocessor untested
1836
1837/*
1838 * Entry condition:
1839 *
1840 * a0: trashed, original value saved on stack (PT_AREG0)
1841 * a1: a1
1842 * a2: new stack pointer, original in DEPC
1843 * a3: dispatch table
1844 * depc: a2, original value saved on stack (PT_DEPC)
1845 * excsave_1: a3
1846 *
1847 * PT_DEPC >= VALID_DOUBLE_EXCEPTION_ADDRESS: double exception, DEPC
1848 * < VALID_DOUBLE_EXCEPTION_ADDRESS: regular exception
1849 */
1850
1851ENTRY(fast_coprocessor_double)
1852 wsr a0, EXCSAVE_1
1853 movi a0, unrecoverable_exception
1854 callx0 a0
1855
1856ENTRY(fast_coprocessor)
1857
1858 /* Fatal if we are in a double exception. */
1859
1860 l32i a0, a2, PT_DEPC
1861 _bgeui a0, VALID_DOUBLE_EXCEPTION_ADDRESS, fast_coprocessor_double
1862
1863 /* Save some registers a1, a3, a4, SAR */
1864
1865 xsr a3, EXCSAVE_1
1866 s32i a3, a2, PT_AREG3
1867 rsr a3, SAR
1868 s32i a4, a2, PT_AREG4
1869 s32i a1, a2, PT_AREG1
1870 s32i a5, a1, PT_AREG5
1871 s32i a3, a2, PT_SAR
1872 mov a1, a2
1873
1874 /* Currently, the HAL macros only guarantee saving a0 and a1.
1875 * These can and will be refined in the future, but for now,
1876 * just save the remaining registers of a2...a15.
1877 */
1878 s32i a6, a1, PT_AREG6
1879 s32i a7, a1, PT_AREG7
1880 s32i a8, a1, PT_AREG8
1881 s32i a9, a1, PT_AREG9
1882 s32i a10, a1, PT_AREG10
1883 s32i a11, a1, PT_AREG11
1884 s32i a12, a1, PT_AREG12
1885 s32i a13, a1, PT_AREG13
1886 s32i a14, a1, PT_AREG14
1887 s32i a15, a1, PT_AREG15
1888
1889 /* Find coprocessor number. Subtract first CP EXCCAUSE from EXCCAUSE */
1890
1891 rsr a0, EXCCAUSE
1892 addi a3, a0, -XCHAL_EXCCAUSE_COPROCESSOR0_DISABLED
1893
1894 /* Set corresponding CPENABLE bit */
1895
1896 movi a4, 1
1897 ssl a3 # SAR: 32 - coprocessor_number
1898 rsr a5, CPENABLE
1899 sll a4, a4
1900 or a4, a5, a4
1901 wsr a4, CPENABLE
1902 rsync
1903 movi a5, coprocessor_info # list of owner and offset into cp_save
1904 addx8 a0, a4, a5 # entry for CP
1905
1906 bne a4, a5, .Lload # bit wasn't set before, cp not in use
1907
1908 /* Now compare the current task with the owner of the coprocessor.
1909 * If they are the same, there is no reason to save or restore any
1910 * coprocessor state. Having already enabled the coprocessor,
1911 * branch ahead to return.
1912 */
1913 GET_CURRENT(a5,a1)
1914 l32i a4, a0, COPROCESSOR_INFO_OWNER # a4: current owner for this CP
1915 beq a4, a5, .Ldone
1916
1917 /* Find location to dump current coprocessor state:
1918 * task_struct->task_cp_save_offset + coprocessor_offset[coprocessor]
1919 *
1920 * Note: a0 pointer to the entry in the coprocessor owner table,
1921 * a3 coprocessor number,
1922 * a4 current owner of coprocessor.
1923 */
1924 l32i a5, a0, COPROCESSOR_INFO_OFFSET
1925 addi a2, a4, THREAD_CP_SAVE
1926 add a2, a2, a5
1927
1928 /* Store current coprocessor states. (a5 still has CP number) */
1929
1930 xchal_cpi_store_funcbody
1931
1932 /* The macro might have destroyed a3 (coprocessor number), but
1933 * SAR still has 32 - coprocessor_number!
1934 */
1935 movi a3, 32
1936 rsr a4, SAR
1937 sub a3, a3, a4
1938
1939.Lload: /* A new task now owns the corpocessors. Save its TCB pointer into
1940 * the coprocessor owner table.
1941 *
1942 * Note: a0 pointer to the entry in the coprocessor owner table,
1943 * a3 coprocessor number.
1944 */
1945 GET_CURRENT(a4,a1)
1946 s32i a4, a0, 0
1947
1948 /* Find location from where to restore the current coprocessor state.*/
1949
1950 l32i a5, a0, COPROCESSOR_INFO_OFFSET
1951 addi a2, a4, THREAD_CP_SAVE
1952 add a2, a2, a4
1953
1954 xchal_cpi_load_funcbody
1955
1956 /* We must assume that the xchal_cpi_store_funcbody macro destroyed
1957 * registers a2..a15.
1958 */
1959
1960.Ldone: l32i a15, a1, PT_AREG15
1961 l32i a14, a1, PT_AREG14
1962 l32i a13, a1, PT_AREG13
1963 l32i a12, a1, PT_AREG12
1964 l32i a11, a1, PT_AREG11
1965 l32i a10, a1, PT_AREG10
1966 l32i a9, a1, PT_AREG9
1967 l32i a8, a1, PT_AREG8
1968 l32i a7, a1, PT_AREG7
1969 l32i a6, a1, PT_AREG6
1970 l32i a5, a1, PT_AREG5
1971 l32i a4, a1, PT_AREG4
1972 l32i a3, a1, PT_AREG3
1973 l32i a2, a1, PT_AREG2
1974 l32i a0, a1, PT_AREG0
1975 l32i a1, a1, PT_AREG1
1976
1977 rfe
1978
1979#endif /* XCHAL_EXTRA_SA_SIZE */
1980
1981/* 1780/*
1982 * System Calls. 1781 * System Calls.
1983 * 1782 *
@@ -2086,20 +1885,36 @@ ENTRY(_switch_to)
2086 1885
2087 entry a1, 16 1886 entry a1, 16
2088 1887
2089 mov a4, a3 # preserve a3 1888 mov a12, a2 # preserve 'prev' (a2)
1889 mov a13, a3 # and 'next' (a3)
1890
1891 l32i a4, a2, TASK_THREAD_INFO
1892 l32i a5, a3, TASK_THREAD_INFO
1893
1894 save_xtregs_user a4 a6 a8 a9 a10 a11 THREAD_XTREGS_USER
2090 1895
2091 s32i a0, a2, THREAD_RA # save return address 1896 s32i a0, a12, THREAD_RA # save return address
2092 s32i a1, a2, THREAD_SP # save stack pointer 1897 s32i a1, a12, THREAD_SP # save stack pointer
2093 1898
2094 /* Disable ints while we manipulate the stack pointer; spill regs. */ 1899 /* Disable ints while we manipulate the stack pointer. */
2095 1900
2096 movi a5, (1 << PS_EXCM_BIT) | LOCKLEVEL 1901 movi a14, (1 << PS_EXCM_BIT) | LOCKLEVEL
2097 xsr a5, PS 1902 xsr a14, PS
2098 rsr a3, EXCSAVE_1 1903 rsr a3, EXCSAVE_1
2099 rsync 1904 rsync
2100 s32i a3, a3, EXC_TABLE_FIXUP /* enter critical section */ 1905 s32i a3, a3, EXC_TABLE_FIXUP /* enter critical section */
2101 1906
2102 call0 _spill_registers 1907 /* Switch CPENABLE */
1908
1909#if (XTENSA_HAVE_COPROCESSORS || XTENSA_HAVE_IO_PORTS)
1910 l32i a3, a5, THREAD_CPENABLE
1911 xsr a3, CPENABLE
1912 s32i a3, a4, THREAD_CPENABLE
1913#endif
1914
1915 /* Flush register file. */
1916
1917 call0 _spill_registers # destroys a3, a4, and SAR
2103 1918
2104 /* Set kernel stack (and leave critical section) 1919 /* Set kernel stack (and leave critical section)
2105 * Note: It's save to set it here. The stack will not be overwritten 1920 * Note: It's save to set it here. The stack will not be overwritten
@@ -2107,19 +1922,21 @@ ENTRY(_switch_to)
2107 * we return from kernel space. 1922 * we return from kernel space.
2108 */ 1923 */
2109 1924
2110 l32i a0, a4, TASK_THREAD_INFO
2111 rsr a3, EXCSAVE_1 # exc_table 1925 rsr a3, EXCSAVE_1 # exc_table
2112 movi a1, 0 1926 movi a6, 0
2113 addi a0, a0, PT_REGS_OFFSET 1927 addi a7, a5, PT_REGS_OFFSET
2114 s32i a1, a3, EXC_TABLE_FIXUP 1928 s32i a6, a3, EXC_TABLE_FIXUP
2115 s32i a0, a3, EXC_TABLE_KSTK 1929 s32i a7, a3, EXC_TABLE_KSTK
2116 1930
2117 /* restore context of the task that 'next' addresses */ 1931 /* restore context of the task that 'next' addresses */
2118 1932
2119 l32i a0, a4, THREAD_RA /* restore return address */ 1933 l32i a0, a13, THREAD_RA # restore return address
2120 l32i a1, a4, THREAD_SP /* restore stack pointer */ 1934 l32i a1, a13, THREAD_SP # restore stack pointer
1935
1936 load_xtregs_user a5 a6 a8 a9 a10 a11 THREAD_XTREGS_USER
2121 1937
2122 wsr a5, PS 1938 wsr a14, PS
1939 mov a2, a12 # return 'prev'
2123 rsync 1940 rsync
2124 1941
2125 retw 1942 retw
diff --git a/arch/xtensa/kernel/module.c b/arch/xtensa/kernel/module.c
index ddf14dcf2ad9..3981a466c779 100644
--- a/arch/xtensa/kernel/module.c
+++ b/arch/xtensa/kernel/module.c
@@ -28,7 +28,7 @@ void *module_alloc(unsigned long size)
28{ 28{
29 if (size == 0) 29 if (size == 0)
30 return NULL; 30 return NULL;
31 return vmalloc(size); 31 return vmalloc_exec(size);
32} 32}
33 33
34void module_free(struct module *mod, void *module_region) 34void module_free(struct module *mod, void *module_region)
diff --git a/arch/xtensa/kernel/process.c b/arch/xtensa/kernel/process.c
index f53d7bd9dfb2..9185597eb6a0 100644
--- a/arch/xtensa/kernel/process.c
+++ b/arch/xtensa/kernel/process.c
@@ -52,6 +52,55 @@ void (*pm_power_off)(void) = NULL;
52EXPORT_SYMBOL(pm_power_off); 52EXPORT_SYMBOL(pm_power_off);
53 53
54 54
55#if XTENSA_HAVE_COPROCESSORS
56
57void coprocessor_release_all(struct thread_info *ti)
58{
59 unsigned long cpenable;
60 int i;
61
62 /* Make sure we don't switch tasks during this operation. */
63
64 preempt_disable();
65
66 /* Walk through all cp owners and release it for the requested one. */
67
68 cpenable = ti->cpenable;
69
70 for (i = 0; i < XCHAL_CP_MAX; i++) {
71 if (coprocessor_owner[i] == ti) {
72 coprocessor_owner[i] = 0;
73 cpenable &= ~(1 << i);
74 }
75 }
76
77 ti->cpenable = cpenable;
78 coprocessor_clear_cpenable();
79
80 preempt_enable();
81}
82
83void coprocessor_flush_all(struct thread_info *ti)
84{
85 unsigned long cpenable;
86 int i;
87
88 preempt_disable();
89
90 cpenable = ti->cpenable;
91
92 for (i = 0; i < XCHAL_CP_MAX; i++) {
93 if ((cpenable & 1) != 0 && coprocessor_owner[i] == ti)
94 coprocessor_flush(ti, i);
95 cpenable >>= 1;
96 }
97
98 preempt_enable();
99}
100
101#endif
102
103
55/* 104/*
56 * Powermanagement idle function, if any is provided by the platform. 105 * Powermanagement idle function, if any is provided by the platform.
57 */ 106 */
@@ -71,15 +120,36 @@ void cpu_idle(void)
71} 120}
72 121
73/* 122/*
74 * Free current thread data structures etc.. 123 * This is called when the thread calls exit().
75 */ 124 */
76
77void exit_thread(void) 125void exit_thread(void)
78{ 126{
127#if XTENSA_HAVE_COPROCESSORS
128 coprocessor_release_all(current_thread_info());
129#endif
79} 130}
80 131
132/*
133 * Flush thread state. This is called when a thread does an execve()
134 * Note that we flush coprocessor registers for the case execve fails.
135 */
81void flush_thread(void) 136void flush_thread(void)
82{ 137{
138#if XTENSA_HAVE_COPROCESSORS
139 struct thread_info *ti = current_thread_info();
140 coprocessor_flush_all(ti);
141 coprocessor_release_all(ti);
142#endif
143}
144
145/*
146 * This is called before the thread is copied.
147 */
148void prepare_to_copy(struct task_struct *tsk)
149{
150#if XTENSA_HAVE_COPROCESSORS
151 coprocessor_flush_all(task_thread_info(tsk));
152#endif
83} 153}
84 154
85/* 155/*
@@ -107,6 +177,7 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long usp,
107 struct task_struct * p, struct pt_regs * regs) 177 struct task_struct * p, struct pt_regs * regs)
108{ 178{
109 struct pt_regs *childregs; 179 struct pt_regs *childregs;
180 struct thread_info *ti;
110 unsigned long tos; 181 unsigned long tos;
111 int user_mode = user_mode(regs); 182 int user_mode = user_mode(regs);
112 183
@@ -128,13 +199,14 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long usp,
128 p->set_child_tid = p->clear_child_tid = NULL; 199 p->set_child_tid = p->clear_child_tid = NULL;
129 p->thread.ra = MAKE_RA_FOR_CALL((unsigned long)ret_from_fork, 0x1); 200 p->thread.ra = MAKE_RA_FOR_CALL((unsigned long)ret_from_fork, 0x1);
130 p->thread.sp = (unsigned long)childregs; 201 p->thread.sp = (unsigned long)childregs;
202
131 if (user_mode(regs)) { 203 if (user_mode(regs)) {
132 204
133 int len = childregs->wmask & ~0xf; 205 int len = childregs->wmask & ~0xf;
134 childregs->areg[1] = usp; 206 childregs->areg[1] = usp;
135 memcpy(&childregs->areg[XCHAL_NUM_AREGS - len/4], 207 memcpy(&childregs->areg[XCHAL_NUM_AREGS - len/4],
136 &regs->areg[XCHAL_NUM_AREGS - len/4], len); 208 &regs->areg[XCHAL_NUM_AREGS - len/4], len);
137 209// FIXME: we need to set THREADPTR in thread_info...
138 if (clone_flags & CLONE_SETTLS) 210 if (clone_flags & CLONE_SETTLS)
139 childregs->areg[2] = childregs->areg[6]; 211 childregs->areg[2] = childregs->areg[6];
140 212
@@ -142,6 +214,12 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long usp,
142 /* In kernel space, we start a new thread with a new stack. */ 214 /* In kernel space, we start a new thread with a new stack. */
143 childregs->wmask = 1; 215 childregs->wmask = 1;
144 } 216 }
217
218#if (XTENSA_HAVE_COPROCESSORS || XTENSA_HAVE_IO_PORTS)
219 ti = task_thread_info(p);
220 ti->cpenable = 0;
221#endif
222
145 return 0; 223 return 0;
146} 224}
147 225
@@ -179,10 +257,6 @@ unsigned long get_wchan(struct task_struct *p)
179} 257}
180 258
181/* 259/*
182 * do_copy_regs() gathers information from 'struct pt_regs' and
183 * 'current->thread.areg[]' to fill in the xtensa_gregset_t
184 * structure.
185 *
186 * xtensa_gregset_t and 'struct pt_regs' are vastly different formats 260 * xtensa_gregset_t and 'struct pt_regs' are vastly different formats
187 * of processor registers. Besides different ordering, 261 * of processor registers. Besides different ordering,
188 * xtensa_gregset_t contains non-live register information that 262 * xtensa_gregset_t contains non-live register information that
@@ -191,18 +265,19 @@ unsigned long get_wchan(struct task_struct *p)
191 * 265 *
192 */ 266 */
193 267
194void do_copy_regs (xtensa_gregset_t *elfregs, struct pt_regs *regs, 268void xtensa_elf_core_copy_regs (xtensa_gregset_t *elfregs, struct pt_regs *regs)
195 struct task_struct *tsk)
196{ 269{
197 int i, n, wb_offset; 270 unsigned long wb, ws, wm;
271 int live, last;
198 272
199 elfregs->xchal_config_id0 = XCHAL_HW_CONFIGID0; 273 wb = regs->windowbase;
200 elfregs->xchal_config_id1 = XCHAL_HW_CONFIGID1; 274 ws = regs->windowstart;
275 wm = regs->wmask;
276 ws = ((ws >> wb) | (ws << (WSBITS - wb))) & ((1 << WSBITS) - 1);
201 277
202 __asm__ __volatile__ ("rsr %0, 176\n" : "=a" (i)); 278 /* Don't leak any random bits. */
203 elfregs->cpux = i; 279
204 __asm__ __volatile__ ("rsr %0, 208\n" : "=a" (i)); 280 memset(elfregs, 0, sizeof (elfregs));
205 elfregs->cpuy = i;
206 281
207 /* Note: PS.EXCM is not set while user task is running; its 282 /* Note: PS.EXCM is not set while user task is running; its
208 * being set in regs->ps is for exception handling convenience. 283 * being set in regs->ps is for exception handling convenience.
@@ -210,204 +285,22 @@ void do_copy_regs (xtensa_gregset_t *elfregs, struct pt_regs *regs,
210 285
211 elfregs->pc = regs->pc; 286 elfregs->pc = regs->pc;
212 elfregs->ps = (regs->ps & ~(1 << PS_EXCM_BIT)); 287 elfregs->ps = (regs->ps & ~(1 << PS_EXCM_BIT));
213 elfregs->exccause = regs->exccause;
214 elfregs->excvaddr = regs->excvaddr;
215 elfregs->windowbase = regs->windowbase;
216 elfregs->windowstart = regs->windowstart;
217 elfregs->lbeg = regs->lbeg; 288 elfregs->lbeg = regs->lbeg;
218 elfregs->lend = regs->lend; 289 elfregs->lend = regs->lend;
219 elfregs->lcount = regs->lcount; 290 elfregs->lcount = regs->lcount;
220 elfregs->sar = regs->sar; 291 elfregs->sar = regs->sar;
221 elfregs->syscall = regs->syscall; 292 elfregs->windowstart = ws;
222
223 /* Copy register file.
224 * The layout looks like this:
225 *
226 * | a0 ... a15 | Z ... Z | arX ... arY |
227 * current window unused saved frames
228 */
229
230 memset (elfregs->ar, 0, sizeof(elfregs->ar));
231 293
232 wb_offset = regs->windowbase * 4; 294 live = (wm & 2) ? 4 : (wm & 4) ? 8 : (wm & 8) ? 12 : 16;
233 n = (regs->wmask&1)? 4 : (regs->wmask&2)? 8 : (regs->wmask&4)? 12 : 16; 295 last = XCHAL_NUM_AREGS - (wm >> 4) * 4;
234 296 memcpy(elfregs->a, regs->areg, live * 4);
235 for (i = 0; i < n; i++) 297 memcpy(elfregs->a + last, regs->areg + last, (wm >> 4) * 16);
236 elfregs->ar[(wb_offset + i) % XCHAL_NUM_AREGS] = regs->areg[i];
237
238 n = (regs->wmask >> 4) * 4;
239
240 for (i = XCHAL_NUM_AREGS - n; n > 0; i++, n--)
241 elfregs->ar[(wb_offset + i) % XCHAL_NUM_AREGS] = regs->areg[i];
242} 298}
243 299
244void xtensa_elf_core_copy_regs (xtensa_gregset_t *elfregs, struct pt_regs *regs) 300int dump_fpu(void)
245{ 301{
246 do_copy_regs ((xtensa_gregset_t *)elfregs, regs, current);
247}
248
249
250/* The inverse of do_copy_regs(). No error or sanity checking. */
251
252void do_restore_regs (xtensa_gregset_t *elfregs, struct pt_regs *regs,
253 struct task_struct *tsk)
254{
255 int i, n, wb_offset;
256
257 /* Note: PS.EXCM is not set while user task is running; it
258 * needs to be set in regs->ps is for exception handling convenience.
259 */
260
261 regs->pc = elfregs->pc;
262 regs->ps = (elfregs->ps | (1 << PS_EXCM_BIT));
263 regs->exccause = elfregs->exccause;
264 regs->excvaddr = elfregs->excvaddr;
265 regs->windowbase = elfregs->windowbase;
266 regs->windowstart = elfregs->windowstart;
267 regs->lbeg = elfregs->lbeg;
268 regs->lend = elfregs->lend;
269 regs->lcount = elfregs->lcount;
270 regs->sar = elfregs->sar;
271 regs->syscall = elfregs->syscall;
272
273 /* Clear everything. */
274
275 memset (regs->areg, 0, sizeof(regs->areg));
276
277 /* Copy regs from live window frame. */
278
279 wb_offset = regs->windowbase * 4;
280 n = (regs->wmask&1)? 4 : (regs->wmask&2)? 8 : (regs->wmask&4)? 12 : 16;
281
282 for (i = 0; i < n; i++)
283 regs->areg[(wb_offset+i) % XCHAL_NUM_AREGS] = elfregs->ar[i];
284
285 n = (regs->wmask >> 4) * 4;
286
287 for (i = XCHAL_NUM_AREGS - n; n > 0; i++, n--)
288 regs->areg[(wb_offset+i) % XCHAL_NUM_AREGS] = elfregs->ar[i];
289}
290
291/*
292 * do_save_fpregs() gathers information from 'struct pt_regs' and
293 * 'current->thread' to fill in the elf_fpregset_t structure.
294 *
295 * Core files and ptrace use elf_fpregset_t.
296 */
297
298void do_save_fpregs (elf_fpregset_t *fpregs, struct pt_regs *regs,
299 struct task_struct *tsk)
300{
301#if XCHAL_HAVE_CP
302
303 extern unsigned char _xtensa_reginfo_tables[];
304 extern unsigned _xtensa_reginfo_table_size;
305 int i;
306 unsigned long flags;
307
308 /* Before dumping coprocessor state from memory,
309 * ensure any live coprocessor contents for this
310 * task are first saved to memory:
311 */
312 local_irq_save(flags);
313
314 for (i = 0; i < XCHAL_CP_MAX; i++) {
315 if (tsk == coprocessor_info[i].owner) {
316 enable_coprocessor(i);
317 save_coprocessor_registers(
318 tsk->thread.cp_save+coprocessor_info[i].offset,i);
319 disable_coprocessor(i);
320 }
321 }
322
323 local_irq_restore(flags);
324
325 /* Now dump coprocessor & extra state: */
326 memcpy((unsigned char*)fpregs,
327 _xtensa_reginfo_tables, _xtensa_reginfo_table_size);
328 memcpy((unsigned char*)fpregs + _xtensa_reginfo_table_size,
329 tsk->thread.cp_save, XTENSA_CP_EXTRA_SIZE);
330#endif
331}
332
333/*
334 * The inverse of do_save_fpregs().
335 * Copies coprocessor and extra state from fpregs into regs and tsk->thread.
336 * Returns 0 on success, non-zero if layout doesn't match.
337 */
338
339int do_restore_fpregs (elf_fpregset_t *fpregs, struct pt_regs *regs,
340 struct task_struct *tsk)
341{
342#if XCHAL_HAVE_CP
343
344 extern unsigned char _xtensa_reginfo_tables[];
345 extern unsigned _xtensa_reginfo_table_size;
346 int i;
347 unsigned long flags;
348
349 /* Make sure save area layouts match.
350 * FIXME: in the future we could allow restoring from
351 * a different layout of the same registers, by comparing
352 * fpregs' table with _xtensa_reginfo_tables and matching
353 * entries and copying registers one at a time.
354 * Not too sure yet whether that's very useful.
355 */
356
357 if( memcmp((unsigned char*)fpregs,
358 _xtensa_reginfo_tables, _xtensa_reginfo_table_size) ) {
359 return -1;
360 }
361
362 /* Before restoring coprocessor state from memory,
363 * ensure any live coprocessor contents for this
364 * task are first invalidated.
365 */
366
367 local_irq_save(flags);
368
369 for (i = 0; i < XCHAL_CP_MAX; i++) {
370 if (tsk == coprocessor_info[i].owner) {
371 enable_coprocessor(i);
372 save_coprocessor_registers(
373 tsk->thread.cp_save+coprocessor_info[i].offset,i);
374 coprocessor_info[i].owner = 0;
375 disable_coprocessor(i);
376 }
377 }
378
379 local_irq_restore(flags);
380
381 /* Now restore coprocessor & extra state: */
382
383 memcpy(tsk->thread.cp_save,
384 (unsigned char*)fpregs + _xtensa_reginfo_table_size,
385 XTENSA_CP_EXTRA_SIZE);
386#endif
387 return 0; 302 return 0;
388} 303}
389/*
390 * Fill in the CP structure for a core dump for a particular task.
391 */
392
393int
394dump_task_fpu(struct pt_regs *regs, struct task_struct *task, elf_fpregset_t *r)
395{
396 return 0; /* no coprocessors active on this processor */
397}
398
399/*
400 * Fill in the CP structure for a core dump.
401 * This includes any FPU coprocessor.
402 * Here, we dump all coprocessors, and other ("extra") custom state.
403 *
404 * This function is called by elf_core_dump() in fs/binfmt_elf.c
405 * (in which case 'regs' comes from calls to do_coredump, see signals.c).
406 */
407int dump_fpu(struct pt_regs *regs, elf_fpregset_t *r)
408{
409 return dump_task_fpu(regs, current, r);
410}
411 304
412asmlinkage 305asmlinkage
413long xtensa_clone(unsigned long clone_flags, unsigned long newsp, 306long xtensa_clone(unsigned long clone_flags, unsigned long newsp,
@@ -421,8 +314,8 @@ long xtensa_clone(unsigned long clone_flags, unsigned long newsp,
421} 314}
422 315
423/* 316/*
424 * * xtensa_execve() executes a new program. 317 * xtensa_execve() executes a new program.
425 * */ 318 */
426 319
427asmlinkage 320asmlinkage
428long xtensa_execve(char __user *name, char __user * __user *argv, 321long xtensa_execve(char __user *name, char __user * __user *argv,
@@ -437,7 +330,6 @@ long xtensa_execve(char __user *name, char __user * __user *argv,
437 error = PTR_ERR(filename); 330 error = PTR_ERR(filename);
438 if (IS_ERR(filename)) 331 if (IS_ERR(filename))
439 goto out; 332 goto out;
440 // FIXME: release coprocessor??
441 error = do_execve(filename, argv, envp, regs); 333 error = do_execve(filename, argv, envp, regs);
442 if (error == 0) { 334 if (error == 0) {
443 task_lock(current); 335 task_lock(current);
diff --git a/arch/xtensa/kernel/ptrace.c b/arch/xtensa/kernel/ptrace.c
index 5533c7850d53..9486882ef0af 100644
--- a/arch/xtensa/kernel/ptrace.c
+++ b/arch/xtensa/kernel/ptrace.c
@@ -4,7 +4,7 @@
4 * License. See the file "COPYING" in the main directory of this archive 4 * License. See the file "COPYING" in the main directory of this archive
5 * for more details. 5 * for more details.
6 * 6 *
7 * Copyright (C) 2001 - 2005 Tensilica Inc. 7 * Copyright (C) 2001 - 2007 Tensilica Inc.
8 * 8 *
9 * Joe Taylor <joe@tensilica.com, joetylr@yahoo.com> 9 * Joe Taylor <joe@tensilica.com, joetylr@yahoo.com>
10 * Chris Zankel <chris@zankel.net> 10 * Chris Zankel <chris@zankel.net>
@@ -28,14 +28,10 @@
28#include <asm/uaccess.h> 28#include <asm/uaccess.h>
29#include <asm/ptrace.h> 29#include <asm/ptrace.h>
30#include <asm/elf.h> 30#include <asm/elf.h>
31 31#include <asm/coprocessor.h>
32#define TEST_KERNEL // verify kernel operations FIXME: remove
33
34 32
35/* 33/*
36 * Called by kernel/ptrace.c when detaching.. 34 * Called by kernel/ptrace.c when detaching to disable single stepping.
37 *
38 * Make sure single step bits etc are not set.
39 */ 35 */
40 36
41void ptrace_disable(struct task_struct *child) 37void ptrace_disable(struct task_struct *child)
@@ -43,136 +39,237 @@ void ptrace_disable(struct task_struct *child)
43 /* Nothing to do.. */ 39 /* Nothing to do.. */
44} 40}
45 41
46long arch_ptrace(struct task_struct *child, long request, long addr, long data) 42int ptrace_getregs(struct task_struct *child, void __user *uregs)
47{ 43{
48 int ret = -EPERM; 44 struct pt_regs *regs = task_pt_regs(child);
45 xtensa_gregset_t __user *gregset = uregs;
46 unsigned long wm = regs->wmask;
47 unsigned long wb = regs->windowbase;
48 int live, i;
49
50 if (!access_ok(VERIFY_WRITE, uregs, sizeof(xtensa_gregset_t)))
51 return -EIO;
52
53 __put_user(regs->pc, &gregset->pc);
54 __put_user(regs->ps & ~(1 << PS_EXCM_BIT), &gregset->ps);
55 __put_user(regs->lbeg, &gregset->lbeg);
56 __put_user(regs->lend, &gregset->lend);
57 __put_user(regs->lcount, &gregset->lcount);
58 __put_user(regs->windowstart, &gregset->windowstart);
59 __put_user(regs->windowbase, &gregset->windowbase);
60
61 live = (wm & 2) ? 4 : (wm & 4) ? 8 : (wm & 8) ? 12 : 16;
62
63 for (i = 0; i < live; i++)
64 __put_user(regs->areg[i],gregset->a+((wb*4+i)%XCHAL_NUM_AREGS));
65 for (i = XCHAL_NUM_AREGS - (wm >> 4) * 4; i < XCHAL_NUM_AREGS; i++)
66 __put_user(regs->areg[i],gregset->a+((wb*4+i)%XCHAL_NUM_AREGS));
67
68 return 0;
69}
49 70
50 switch (request) { 71int ptrace_setregs(struct task_struct *child, void __user *uregs)
51 case PTRACE_PEEKTEXT: /* read word at location addr. */ 72{
52 case PTRACE_PEEKDATA: 73 struct pt_regs *regs = task_pt_regs(child);
53 ret = generic_ptrace_peekdata(child, addr, data); 74 xtensa_gregset_t *gregset = uregs;
54 goto out; 75 const unsigned long ps_mask = PS_CALLINC_MASK | PS_OWB_MASK;
76 unsigned long ps;
77 unsigned long wb;
55 78
56 /* Read the word at location addr in the USER area. */ 79 if (!access_ok(VERIFY_WRITE, uregs, sizeof(xtensa_gregset_t)))
80 return -EIO;
57 81
58 case PTRACE_PEEKUSR: 82 __get_user(regs->pc, &gregset->pc);
59 { 83 __get_user(ps, &gregset->ps);
60 struct pt_regs *regs; 84 __get_user(regs->lbeg, &gregset->lbeg);
61 unsigned long tmp; 85 __get_user(regs->lend, &gregset->lend);
86 __get_user(regs->lcount, &gregset->lcount);
87 __get_user(regs->windowstart, &gregset->windowstart);
88 __get_user(wb, &gregset->windowbase);
89
90 regs->ps = (regs->ps & ~ps_mask) | (ps & ps_mask) | (1 << PS_EXCM_BIT);
91
92 if (wb >= XCHAL_NUM_AREGS / 4)
93 return -EFAULT;
94
95 regs->windowbase = wb;
96
97 if (wb != 0 && __copy_from_user(regs->areg + XCHAL_NUM_AREGS - wb * 4,
98 gregset->a, wb * 16))
99 return -EFAULT;
100
101 if (__copy_from_user(regs->areg, gregset->a + wb*4, (WSBITS-wb) * 16))
102 return -EFAULT;
103
104 return 0;
105}
106
107
108int ptrace_getxregs(struct task_struct *child, void __user *uregs)
109{
110 struct pt_regs *regs = task_pt_regs(child);
111 struct thread_info *ti = task_thread_info(child);
112 elf_xtregs_t __user *xtregs = uregs;
113 int ret = 0;
114
115 if (!access_ok(VERIFY_WRITE, uregs, sizeof(elf_xtregs_t)))
116 return -EIO;
117
118#if XTENSA_HAVE_COPROCESSORS
119 /* Flush all coprocessor registers to memory. */
120 coprocessor_flush_all(ti);
121 ret |= __copy_to_user(&xtregs->cp0, &ti->xtregs_cp,
122 sizeof(xtregs_coprocessor_t));
123#endif
124 ret |= __copy_to_user(&xtregs->opt, &regs->xtregs_opt,
125 sizeof(xtregs->opt));
126 ret |= __copy_to_user(&xtregs->user,&ti->xtregs_user,
127 sizeof(xtregs->user));
128
129 return ret ? -EFAULT : 0;
130}
131
132int ptrace_setxregs(struct task_struct *child, void __user *uregs)
133{
134 struct thread_info *ti = task_thread_info(child);
135 struct pt_regs *regs = task_pt_regs(child);
136 elf_xtregs_t *xtregs = uregs;
137 int ret = 0;
138
139#if XTENSA_HAVE_COPROCESSORS
140 /* Flush all coprocessors before we overwrite them. */
141 coprocessor_flush_all(ti);
142 coprocessor_release_all(ti);
143
144 ret |= __copy_from_user(&ti->xtregs_cp, &xtregs->cp0,
145 sizeof(xtregs_coprocessor_t));
146#endif
147 ret |= __copy_from_user(&regs->xtregs_opt, &xtregs->opt,
148 sizeof(xtregs->opt));
149 ret |= __copy_from_user(&ti->xtregs_user, &xtregs->user,
150 sizeof(xtregs->user));
151
152 return ret ? -EFAULT : 0;
153}
154
155int ptrace_peekusr(struct task_struct *child, long regno, long __user *ret)
156{
157 struct pt_regs *regs;
158 unsigned long tmp;
62 159
63 regs = task_pt_regs(child); 160 regs = task_pt_regs(child);
64 tmp = 0; /* Default return value. */ 161 tmp = 0; /* Default return value. */
65 162
66 switch(addr) { 163 switch(regno) {
67 164
68 case REG_AR_BASE ... REG_AR_BASE + XCHAL_NUM_AREGS - 1: 165 case REG_AR_BASE ... REG_AR_BASE + XCHAL_NUM_AREGS - 1:
69 { 166 tmp = regs->areg[regno - REG_AR_BASE];
70 int ar = addr - REG_AR_BASE - regs->windowbase * 4;
71 ar &= (XCHAL_NUM_AREGS - 1);
72 if (ar < 16 && ar + (regs->wmask >> 4) * 4 >= 0)
73 tmp = regs->areg[ar];
74 else
75 ret = -EIO;
76 break; 167 break;
77 } 168
78 case REG_A_BASE ... REG_A_BASE + 15: 169 case REG_A_BASE ... REG_A_BASE + 15:
79 tmp = regs->areg[addr - REG_A_BASE]; 170 tmp = regs->areg[regno - REG_A_BASE];
80 break; 171 break;
172
81 case REG_PC: 173 case REG_PC:
82 tmp = regs->pc; 174 tmp = regs->pc;
83 break; 175 break;
176
84 case REG_PS: 177 case REG_PS:
85 /* Note: PS.EXCM is not set while user task is running; 178 /* Note: PS.EXCM is not set while user task is running;
86 * its being set in regs is for exception handling 179 * its being set in regs is for exception handling
87 * convenience. */ 180 * convenience. */
88 tmp = (regs->ps & ~(1 << PS_EXCM_BIT)); 181 tmp = (regs->ps & ~(1 << PS_EXCM_BIT));
89 break; 182 break;
183
90 case REG_WB: 184 case REG_WB:
91 tmp = regs->windowbase; 185 break; /* tmp = 0 */
92 break; 186
93 case REG_WS: 187 case REG_WS:
94 tmp = regs->windowstart; 188 {
189 unsigned long wb = regs->windowbase;
190 unsigned long ws = regs->windowstart;
191 tmp = ((ws>>wb) | (ws<<(WSBITS-wb))) & ((1<<WSBITS)-1);
95 break; 192 break;
193 }
96 case REG_LBEG: 194 case REG_LBEG:
97 tmp = regs->lbeg; 195 tmp = regs->lbeg;
98 break; 196 break;
197
99 case REG_LEND: 198 case REG_LEND:
100 tmp = regs->lend; 199 tmp = regs->lend;
101 break; 200 break;
201
102 case REG_LCOUNT: 202 case REG_LCOUNT:
103 tmp = regs->lcount; 203 tmp = regs->lcount;
104 break; 204 break;
205
105 case REG_SAR: 206 case REG_SAR:
106 tmp = regs->sar; 207 tmp = regs->sar;
107 break; 208 break;
108 case REG_DEPC: 209
109 tmp = regs->depc;
110 break;
111 case REG_EXCCAUSE:
112 tmp = regs->exccause;
113 break;
114 case REG_EXCVADDR:
115 tmp = regs->excvaddr;
116 break;
117 case SYSCALL_NR: 210 case SYSCALL_NR:
118 tmp = regs->syscall; 211 tmp = regs->syscall;
119 break; 212 break;
120 default:
121 tmp = 0;
122 ret = -EIO;
123 goto out;
124 }
125 ret = put_user(tmp, (unsigned long *) data);
126 goto out;
127 }
128 213
129 case PTRACE_POKETEXT: /* write the word at location addr. */ 214 default:
130 case PTRACE_POKEDATA: 215 return -EIO;
131 ret = generic_ptrace_pokedata(child, addr, data); 216 }
132 goto out; 217 return put_user(tmp, ret);
218}
133 219
134 case PTRACE_POKEUSR: 220int ptrace_pokeusr(struct task_struct *child, long regno, long val)
135 { 221{
136 struct pt_regs *regs; 222 struct pt_regs *regs;
137 regs = task_pt_regs(child); 223 regs = task_pt_regs(child);
138 224
139 switch (addr) { 225 switch (regno) {
140 case REG_AR_BASE ... REG_AR_BASE + XCHAL_NUM_AREGS - 1: 226 case REG_AR_BASE ... REG_AR_BASE + XCHAL_NUM_AREGS - 1:
141 { 227 regs->areg[regno - REG_AR_BASE] = val;
142 int ar = addr - REG_AR_BASE - regs->windowbase * 4;
143 if (ar < 16 && ar + (regs->wmask >> 4) * 4 >= 0)
144 regs->areg[ar & (XCHAL_NUM_AREGS - 1)] = data;
145 else
146 ret = -EIO;
147 break; 228 break;
148 } 229
149 case REG_A_BASE ... REG_A_BASE + 15: 230 case REG_A_BASE ... REG_A_BASE + 15:
150 regs->areg[addr - REG_A_BASE] = data; 231 regs->areg[regno - REG_A_BASE] = val;
151 break; 232 break;
233
152 case REG_PC: 234 case REG_PC:
153 regs->pc = data; 235 regs->pc = val;
154 break; 236 break;
237
155 case SYSCALL_NR: 238 case SYSCALL_NR:
156 regs->syscall = data; 239 regs->syscall = val;
157 break;
158#ifdef TEST_KERNEL
159 case REG_WB:
160 regs->windowbase = data;
161 break;
162 case REG_WS:
163 regs->windowstart = data;
164 break; 240 break;
165#endif
166 241
167 default: 242 default:
168 /* The rest are not allowed. */ 243 return -EIO;
169 ret = -EIO; 244 }
170 break; 245 return 0;
171 } 246}
247
248long arch_ptrace(struct task_struct *child, long request, long addr, long data)
249{
250 int ret = -EPERM;
251
252 switch (request) {
253 case PTRACE_PEEKTEXT: /* read word at location addr. */
254 case PTRACE_PEEKDATA:
255 ret = generic_ptrace_peekdata(child, addr, data);
256 break;
257
258 case PTRACE_PEEKUSR: /* read register specified by addr. */
259 ret = ptrace_peekusr(child, addr, (void __user *) data);
260 break;
261
262 case PTRACE_POKETEXT: /* write the word at location addr. */
263 case PTRACE_POKEDATA:
264 ret = generic_ptrace_pokedata(child, addr, data);
265 break;
266
267 case PTRACE_POKEUSR: /* write register specified by addr. */
268 ret = ptrace_pokeusr(child, addr, data);
172 break; 269 break;
173 }
174 270
175 /* continue and stop at next (return from) syscall */ 271 /* continue and stop at next (return from) syscall */
272
176 case PTRACE_SYSCALL: 273 case PTRACE_SYSCALL:
177 case PTRACE_CONT: /* restart after signal. */ 274 case PTRACE_CONT: /* restart after signal. */
178 { 275 {
@@ -217,98 +314,26 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
217 break; 314 break;
218 315
219 case PTRACE_GETREGS: 316 case PTRACE_GETREGS:
220 { 317 ret = ptrace_getregs(child, (void __user *) data);
221 /* 'data' points to user memory in which to write.
222 * Mainly due to the non-live register values, we
223 * reformat the register values into something more
224 * standard. For convenience, we use the handy
225 * elf_gregset_t format. */
226
227 xtensa_gregset_t format;
228 struct pt_regs *regs = task_pt_regs(child);
229
230 do_copy_regs (&format, regs, child);
231
232 /* Now, copy to user space nice and easy... */
233 ret = 0;
234 if (copy_to_user((void *)data, &format, sizeof(elf_gregset_t)))
235 ret = -EFAULT;
236 break; 318 break;
237 }
238 319
239 case PTRACE_SETREGS: 320 case PTRACE_SETREGS:
240 { 321 ret = ptrace_setregs(child, (void __user *) data);
241 /* 'data' points to user memory that contains the new
242 * values in the elf_gregset_t format. */
243
244 xtensa_gregset_t format;
245 struct pt_regs *regs = task_pt_regs(child);
246
247 if (copy_from_user(&format,(void *)data,sizeof(elf_gregset_t))){
248 ret = -EFAULT;
249 break;
250 }
251
252 /* FIXME: Perhaps we want some sanity checks on
253 * these user-space values? See ARM version. Are
254 * debuggers a security concern? */
255
256 do_restore_regs (&format, regs, child);
257
258 ret = 0;
259 break;
260 }
261
262 case PTRACE_GETFPREGS:
263 {
264 /* 'data' points to user memory in which to write.
265 * For convenience, we use the handy
266 * elf_fpregset_t format. */
267
268 elf_fpregset_t fpregs;
269 struct pt_regs *regs = task_pt_regs(child);
270
271 do_save_fpregs (&fpregs, regs, child);
272
273 /* Now, copy to user space nice and easy... */
274 ret = 0;
275 if (copy_to_user((void *)data, &fpregs, sizeof(elf_fpregset_t)))
276 ret = -EFAULT;
277
278 break; 322 break;
279 }
280
281 case PTRACE_SETFPREGS:
282 {
283 /* 'data' points to user memory that contains the new
284 * values in the elf_fpregset_t format.
285 */
286 elf_fpregset_t fpregs;
287 struct pt_regs *regs = task_pt_regs(child);
288 323
289 ret = 0; 324 case PTRACE_GETXTREGS:
290 if (copy_from_user(&fpregs, (void *)data, sizeof(elf_fpregset_t))) { 325 ret = ptrace_getxregs(child, (void __user *) data);
291 ret = -EFAULT;
292 break;
293 }
294
295 if (do_restore_fpregs (&fpregs, regs, child))
296 ret = -EIO;
297 break; 326 break;
298 }
299 327
300 case PTRACE_GETFPREGSIZE: 328 case PTRACE_SETXTREGS:
301 /* 'data' points to 'unsigned long' set to the size 329 ret = ptrace_setxregs(child, (void __user *) data);
302 * of elf_fpregset_t
303 */
304 ret = put_user(sizeof(elf_fpregset_t), (unsigned long *) data);
305 break; 330 break;
306 331
307 default: 332 default:
308 ret = ptrace_request(child, request, addr, data); 333 ret = ptrace_request(child, request, addr, data);
309 goto out; 334 break;
310 } 335 }
311 out: 336
312 return ret; 337 return ret;
313} 338}
314 339
diff --git a/arch/xtensa/kernel/setup.c b/arch/xtensa/kernel/setup.c
index b80f2cb1b4fb..5e6d75c9f92b 100644
--- a/arch/xtensa/kernel/setup.c
+++ b/arch/xtensa/kernel/setup.c
@@ -60,11 +60,6 @@ struct ide_ops *ide_ops;
60extern struct rtc_ops no_rtc_ops; 60extern struct rtc_ops no_rtc_ops;
61struct rtc_ops *rtc_ops; 61struct rtc_ops *rtc_ops;
62 62
63#ifdef CONFIG_PC_KEYB
64extern struct kbd_ops no_kbd_ops;
65struct kbd_ops *kbd_ops;
66#endif
67
68#ifdef CONFIG_BLK_DEV_INITRD 63#ifdef CONFIG_BLK_DEV_INITRD
69extern void *initrd_start; 64extern void *initrd_start;
70extern void *initrd_end; 65extern void *initrd_end;
diff --git a/arch/xtensa/kernel/signal.c b/arch/xtensa/kernel/signal.c
index 033aae0336d2..f2220b5bdce6 100644
--- a/arch/xtensa/kernel/signal.c
+++ b/arch/xtensa/kernel/signal.c
@@ -35,13 +35,17 @@ asmlinkage int do_signal(struct pt_regs *regs, sigset_t *oldset);
35 35
36extern struct task_struct *coproc_owners[]; 36extern struct task_struct *coproc_owners[];
37 37
38extern void release_all_cp (struct task_struct *);
39
40struct rt_sigframe 38struct rt_sigframe
41{ 39{
42 struct siginfo info; 40 struct siginfo info;
43 struct ucontext uc; 41 struct ucontext uc;
44 cp_state_t cpstate; 42 struct {
43 xtregs_opt_t opt;
44 xtregs_user_t user;
45#if XTENSA_HAVE_COPROCESSORS
46 xtregs_coprocessor_t cp;
47#endif
48 } xtregs;
45 unsigned char retcode[6]; 49 unsigned char retcode[6];
46 unsigned int window[4]; 50 unsigned int window[4];
47}; 51};
@@ -49,8 +53,6 @@ struct rt_sigframe
49/* 53/*
50 * Flush register windows stored in pt_regs to stack. 54 * Flush register windows stored in pt_regs to stack.
51 * Returns 1 for errors. 55 * Returns 1 for errors.
52 *
53 * Note that windowbase, windowstart, and wmask are not updated!
54 */ 56 */
55 57
56int 58int
@@ -116,6 +118,9 @@ flush_window_regs_user(struct pt_regs *regs)
116 base += inc; 118 base += inc;
117 } 119 }
118 120
121 regs->wmask = 1;
122 regs->windowstart = 1 << wb;
123
119 return 0; 124 return 0;
120 125
121errout: 126errout:
@@ -131,9 +136,10 @@ errout:
131 */ 136 */
132 137
133static int 138static int
134setup_sigcontext(struct sigcontext __user *sc, cp_state_t *cpstate, 139setup_sigcontext(struct rt_sigframe __user *frame, struct pt_regs *regs)
135 struct pt_regs *regs, unsigned long mask)
136{ 140{
141 struct sigcontext __user *sc = &frame->uc.uc_mcontext;
142 struct thread_info *ti = current_thread_info();
137 int err = 0; 143 int err = 0;
138 144
139#define COPY(x) err |= __put_user(regs->x, &sc->sc_##x) 145#define COPY(x) err |= __put_user(regs->x, &sc->sc_##x)
@@ -147,23 +153,32 @@ setup_sigcontext(struct sigcontext __user *sc, cp_state_t *cpstate,
147 153
148 err |= flush_window_regs_user(regs); 154 err |= flush_window_regs_user(regs);
149 err |= __copy_to_user (sc->sc_a, regs->areg, 16 * 4); 155 err |= __copy_to_user (sc->sc_a, regs->areg, 16 * 4);
156 err |= __put_user(0, &sc->sc_xtregs);
150 157
151 // err |= __copy_to_user (sc->sc_a, regs->areg, XCHAL_NUM_AREGS * 4) 158 if (err)
159 return err;
152 160
153#if XCHAL_HAVE_CP 161#if XTENSA_HAVE_COPROCESSORS
154# error Coprocessors unsupported 162 coprocessor_flush_all(ti);
155 err |= save_cpextra(cpstate); 163 coprocessor_release_all(ti);
156 err |= __put_user(err ? NULL : cpstate, &sc->sc_cpstate); 164 err |= __copy_to_user(&frame->xtregs.cp, &ti->xtregs_cp,
165 sizeof (frame->xtregs.cp));
157#endif 166#endif
158 /* non-iBCS2 extensions.. */ 167 err |= __copy_to_user(&frame->xtregs.opt, &regs->xtregs_opt,
159 err |= __put_user(mask, &sc->oldmask); 168 sizeof (xtregs_opt_t));
169 err |= __copy_to_user(&frame->xtregs.user, &ti->xtregs_user,
170 sizeof (xtregs_user_t));
171
172 err |= __put_user(err ? NULL : &frame->xtregs, &sc->sc_xtregs);
160 173
161 return err; 174 return err;
162} 175}
163 176
164static int 177static int
165restore_sigcontext(struct pt_regs *regs, struct sigcontext __user *sc) 178restore_sigcontext(struct pt_regs *regs, struct rt_sigframe __user *frame)
166{ 179{
180 struct sigcontext __user *sc = &frame->uc.uc_mcontext;
181 struct thread_info *ti = current_thread_info();
167 unsigned int err = 0; 182 unsigned int err = 0;
168 unsigned long ps; 183 unsigned long ps;
169 184
@@ -181,6 +196,8 @@ restore_sigcontext(struct pt_regs *regs, struct sigcontext __user *sc)
181 regs->windowbase = 0; 196 regs->windowbase = 0;
182 regs->windowstart = 1; 197 regs->windowstart = 1;
183 198
199 regs->syscall = -1; /* disable syscall checks */
200
184 /* For PS, restore only PS.CALLINC. 201 /* For PS, restore only PS.CALLINC.
185 * Assume that all other bits are either the same as for the signal 202 * Assume that all other bits are either the same as for the signal
186 * handler, or the user mode value doesn't matter (e.g. PS.OWB). 203 * handler, or the user mode value doesn't matter (e.g. PS.OWB).
@@ -196,8 +213,9 @@ restore_sigcontext(struct pt_regs *regs, struct sigcontext __user *sc)
196 213
197 err |= __copy_from_user(regs->areg, sc->sc_a, 16 * 4); 214 err |= __copy_from_user(regs->areg, sc->sc_a, 16 * 4);
198 215
199#if XCHAL_HAVE_CP 216 if (err)
200# error Coprocessors unsupported 217 return err;
218
201 /* The signal handler may have used coprocessors in which 219 /* The signal handler may have used coprocessors in which
202 * case they are still enabled. We disable them to force a 220 * case they are still enabled. We disable them to force a
203 * reloading of the original task's CP state by the lazy 221 * reloading of the original task's CP state by the lazy
@@ -205,20 +223,20 @@ restore_sigcontext(struct pt_regs *regs, struct sigcontext __user *sc)
205 * Also, we essentially discard any coprocessor state that the 223 * Also, we essentially discard any coprocessor state that the
206 * signal handler created. */ 224 * signal handler created. */
207 225
208 if (!err) { 226#if XTENSA_HAVE_COPROCESSORS
209 struct task_struct *tsk = current; 227 coprocessor_release_all(ti);
210 release_all_cp(tsk); 228 err |= __copy_from_user(&ti->xtregs_cp, &frame->xtregs.cp,
211 err |= __copy_from_user(tsk->thread.cpextra, sc->sc_cpstate, 229 sizeof (frame->xtregs.cp));
212 XTENSA_CP_EXTRA_SIZE);
213 }
214#endif 230#endif
231 err |= __copy_from_user(&ti->xtregs_user, &frame->xtregs.user,
232 sizeof (xtregs_user_t));
233 err |= __copy_from_user(&regs->xtregs_opt, &frame->xtregs.opt,
234 sizeof (xtregs_opt_t));
215 235
216 regs->syscall = -1; /* disable syscall checks */
217 return err; 236 return err;
218} 237}
219 238
220 239
221
222/* 240/*
223 * Do a signal return; undo the signal stack. 241 * Do a signal return; undo the signal stack.
224 */ 242 */
@@ -247,7 +265,7 @@ asmlinkage long xtensa_rt_sigreturn(long a0, long a1, long a2, long a3,
247 recalc_sigpending(); 265 recalc_sigpending();
248 spin_unlock_irq(&current->sighand->siglock); 266 spin_unlock_irq(&current->sighand->siglock);
249 267
250 if (restore_sigcontext(regs, &frame->uc.uc_mcontext)) 268 if (restore_sigcontext(regs, frame))
251 goto badframe; 269 goto badframe;
252 270
253 ret = regs->areg[2]; 271 ret = regs->areg[2];
@@ -360,18 +378,22 @@ static void setup_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
360 err |= __put_user(sas_ss_flags(regs->areg[1]), 378 err |= __put_user(sas_ss_flags(regs->areg[1]),
361 &frame->uc.uc_stack.ss_flags); 379 &frame->uc.uc_stack.ss_flags);
362 err |= __put_user(current->sas_ss_size, &frame->uc.uc_stack.ss_size); 380 err |= __put_user(current->sas_ss_size, &frame->uc.uc_stack.ss_size);
363 err |= setup_sigcontext(&frame->uc.uc_mcontext, &frame->cpstate, 381 err |= setup_sigcontext(frame, regs);
364 regs, set->sig[0]);
365 err |= __copy_to_user(&frame->uc.uc_sigmask, set, sizeof(*set)); 382 err |= __copy_to_user(&frame->uc.uc_sigmask, set, sizeof(*set));
366 383
367 /* Create sys_rt_sigreturn syscall in stack frame */ 384 if (ka->sa.sa_flags & SA_RESTORER) {
385 ra = (unsigned long)ka->sa.sa_restorer;
386 } else {
368 387
369 err |= gen_return_code(frame->retcode); 388 /* Create sys_rt_sigreturn syscall in stack frame */
370 389
371 if (err) { 390 err |= gen_return_code(frame->retcode);
372 goto give_sigsegv; 391
392 if (err) {
393 goto give_sigsegv;
394 }
395 ra = (unsigned long) frame->retcode;
373 } 396 }
374
375 397
376 /* 398 /*
377 * Create signal handler execution context. 399 * Create signal handler execution context.
@@ -385,7 +407,6 @@ static void setup_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
385 /* Set up a stack frame for a call4 407 /* Set up a stack frame for a call4
386 * Note: PS.CALLINC is set to one by start_thread 408 * Note: PS.CALLINC is set to one by start_thread
387 */ 409 */
388 ra = (unsigned long) frame->retcode;
389 regs->areg[4] = (((unsigned long) ra) & 0x3fffffff) | 0x40000000; 410 regs->areg[4] = (((unsigned long) ra) & 0x3fffffff) | 0x40000000;
390 regs->areg[6] = (unsigned long) signal; 411 regs->areg[6] = (unsigned long) signal;
391 regs->areg[7] = (unsigned long) &frame->info; 412 regs->areg[7] = (unsigned long) &frame->info;
diff --git a/arch/xtensa/kernel/traps.c b/arch/xtensa/kernel/traps.c
index 397bcd6ad08d..c7a021d9f696 100644
--- a/arch/xtensa/kernel/traps.c
+++ b/arch/xtensa/kernel/traps.c
@@ -118,28 +118,28 @@ static dispatch_init_table_t __initdata dispatch_init_table[] = {
118{ EXCCAUSE_STORE_CACHE_ATTRIBUTE, 0, do_page_fault }, 118{ EXCCAUSE_STORE_CACHE_ATTRIBUTE, 0, do_page_fault },
119{ EXCCAUSE_LOAD_CACHE_ATTRIBUTE, 0, do_page_fault }, 119{ EXCCAUSE_LOAD_CACHE_ATTRIBUTE, 0, do_page_fault },
120/* XCCHAL_EXCCAUSE_FLOATING_POINT unhandled */ 120/* XCCHAL_EXCCAUSE_FLOATING_POINT unhandled */
121#if (XCHAL_CP_MASK & 1) 121#if XTENSA_HAVE_COPROCESSOR(0)
122COPROCESSOR(0), 122COPROCESSOR(0),
123#endif 123#endif
124#if (XCHAL_CP_MASK & 2) 124#if XTENSA_HAVE_COPROCESSOR(1)
125COPROCESSOR(1), 125COPROCESSOR(1),
126#endif 126#endif
127#if (XCHAL_CP_MASK & 4) 127#if XTENSA_HAVE_COPROCESSOR(2)
128COPROCESSOR(2), 128COPROCESSOR(2),
129#endif 129#endif
130#if (XCHAL_CP_MASK & 8) 130#if XTENSA_HAVE_COPROCESSOR(3)
131COPROCESSOR(3), 131COPROCESSOR(3),
132#endif 132#endif
133#if (XCHAL_CP_MASK & 16) 133#if XTENSA_HAVE_COPROCESSOR(4)
134COPROCESSOR(4), 134COPROCESSOR(4),
135#endif 135#endif
136#if (XCHAL_CP_MASK & 32) 136#if XTENSA_HAVE_COPROCESSOR(5)
137COPROCESSOR(5), 137COPROCESSOR(5),
138#endif 138#endif
139#if (XCHAL_CP_MASK & 64) 139#if XTENSA_HAVE_COPROCESSOR(6)
140COPROCESSOR(6), 140COPROCESSOR(6),
141#endif 141#endif
142#if (XCHAL_CP_MASK & 128) 142#if XTENSA_HAVE_COPROCESSOR(7)
143COPROCESSOR(7), 143COPROCESSOR(7),
144#endif 144#endif
145{ EXCCAUSE_MAPPED_DEBUG, 0, do_debug }, 145{ EXCCAUSE_MAPPED_DEBUG, 0, do_debug },
@@ -349,9 +349,7 @@ void show_regs(struct pt_regs * regs)
349 349
350 wmask = regs->wmask & ~1; 350 wmask = regs->wmask & ~1;
351 351
352 for (i = 0; i < 32; i++) { 352 for (i = 0; i < 16; i++) {
353 if (wmask & (1 << (i / 4)))
354 break;
355 if ((i % 8) == 0) 353 if ((i % 8) == 0)
356 printk ("\n" KERN_INFO "a%02d: ", i); 354 printk ("\n" KERN_INFO "a%02d: ", i);
357 printk("%08lx ", regs->areg[i]); 355 printk("%08lx ", regs->areg[i]);
diff --git a/arch/xtensa/kernel/vmlinux.lds.S b/arch/xtensa/kernel/vmlinux.lds.S
index 7d0f55a4982d..51f4fb6f16f9 100644
--- a/arch/xtensa/kernel/vmlinux.lds.S
+++ b/arch/xtensa/kernel/vmlinux.lds.S
@@ -136,7 +136,9 @@ SECTIONS
136 __init_begin = .; 136 __init_begin = .;
137 .init.text : { 137 .init.text : {
138 _sinittext = .; 138 _sinittext = .;
139 *(.init.literal) INIT_TEXT 139 *(.init.literal) *(.cpuinit.literal)
140 *(.devinit.literal) *(.meminit.literal)
141 INIT_TEXT
140 _einittext = .; 142 _einittext = .;
141 } 143 }
142 144
@@ -161,6 +163,8 @@ SECTIONS
161 .DoubleExceptionVector.literal); 163 .DoubleExceptionVector.literal);
162 RELOCATE_ENTRY(_DoubleExceptionVector_text, 164 RELOCATE_ENTRY(_DoubleExceptionVector_text,
163 .DoubleExceptionVector.text); 165 .DoubleExceptionVector.text);
166 RELOCATE_ENTRY(_DebugInterruptVector_text,
167 .DebugInterruptVector.text);
164 168
165 __boot_reloc_table_end = ABSOLUTE(.) ; 169 __boot_reloc_table_end = ABSOLUTE(.) ;
166 } 170 }
diff --git a/arch/xtensa/mm/cache.c b/arch/xtensa/mm/cache.c
index 9a1fa9478ae7..3ba990c67676 100644
--- a/arch/xtensa/mm/cache.c
+++ b/arch/xtensa/mm/cache.c
@@ -25,7 +25,6 @@
25#include <linux/swap.h> 25#include <linux/swap.h>
26#include <linux/pagemap.h> 26#include <linux/pagemap.h>
27 27
28#include <asm/pgtable.h>
29#include <asm/bootparam.h> 28#include <asm/bootparam.h>
30#include <asm/mmu_context.h> 29#include <asm/mmu_context.h>
31#include <asm/tlb.h> 30#include <asm/tlb.h>
@@ -181,9 +180,9 @@ update_mmu_cache(struct vm_area_struct * vma, unsigned long addr, pte_t pte)
181#else 180#else
182 if (!PageReserved(page) && !test_bit(PG_arch_1, &page->flags) 181 if (!PageReserved(page) && !test_bit(PG_arch_1, &page->flags)
183 && (vma->vm_flags & VM_EXEC) != 0) { 182 && (vma->vm_flags & VM_EXEC) != 0) {
184 unsigned long vaddr = addr & PAGE_MASK; 183 unsigned long paddr = (unsigned long) page_address(page);
185 __flush_dcache_page(vaddr); 184 __flush_dcache_page(paddr);
186 __invalidate_icache_page(vaddr); 185 __invalidate_icache_page(paddr);
187 set_bit(PG_arch_1, &page->flags); 186 set_bit(PG_arch_1, &page->flags);
188 } 187 }
189#endif 188#endif
diff --git a/arch/xtensa/mm/init.c b/arch/xtensa/mm/init.c
index b3086f34a8e7..81d0560eaea2 100644
--- a/arch/xtensa/mm/init.c
+++ b/arch/xtensa/mm/init.c
@@ -309,7 +309,7 @@ void show_mem(void)
309 309
310struct kmem_cache *pgtable_cache __read_mostly; 310struct kmem_cache *pgtable_cache __read_mostly;
311 311
312static void pgd_ctor(void *addr, struct kmem_cache *cache, unsigned long flags) 312static void pgd_ctor(struct kmem_cache *cache, void* addr)
313{ 313{
314 pte_t* ptep = (pte_t*)addr; 314 pte_t* ptep = (pte_t*)addr;
315 int i; 315 int i;
diff --git a/arch/xtensa/mm/misc.S b/arch/xtensa/mm/misc.S
index e1f880368e32..c885664211d1 100644
--- a/arch/xtensa/mm/misc.S
+++ b/arch/xtensa/mm/misc.S
@@ -295,7 +295,7 @@ ENTRY(__tlbtemp_mapping_itlb)
295ENTRY(__invalidate_icache_page_alias) 295ENTRY(__invalidate_icache_page_alias)
296 entry sp, 16 296 entry sp, 16
297 297
298 addi a6, a3, (PAGE_KERNEL | _PAGE_HW_WRITE) 298 addi a6, a3, (PAGE_KERNEL_EXEC | _PAGE_HW_WRITE)
299 mov a4, a2 299 mov a4, a2
300 witlb a6, a2 300 witlb a6, a2
301 isync 301 isync
diff --git a/arch/xtensa/platform-iss/Makefile b/arch/xtensa/platforms/iss/Makefile
index af96e314d71f..af96e314d71f 100644
--- a/arch/xtensa/platform-iss/Makefile
+++ b/arch/xtensa/platforms/iss/Makefile
diff --git a/arch/xtensa/platform-iss/console.c b/arch/xtensa/platforms/iss/console.c
index 854677d0c3f6..9141e3690731 100644
--- a/arch/xtensa/platform-iss/console.c
+++ b/arch/xtensa/platforms/iss/console.c
@@ -43,6 +43,7 @@ static DEFINE_SPINLOCK(timer_lock);
43 43
44int errno; 44int errno;
45 45
46static int __simc (int a, int b, int c, int d, int e, int f) __attribute__((__noinline__));
46static int __simc (int a, int b, int c, int d, int e, int f) 47static int __simc (int a, int b, int c, int d, int e, int f)
47{ 48{
48 int ret; 49 int ret;
diff --git a/arch/xtensa/platform-iss/io.c b/arch/xtensa/platforms/iss/io.c
index 5b161a5cb65f..5b161a5cb65f 100644
--- a/arch/xtensa/platform-iss/io.c
+++ b/arch/xtensa/platforms/iss/io.c
diff --git a/arch/xtensa/platform-iss/network.c b/arch/xtensa/platforms/iss/network.c
index f21b9b0899a8..a2e252217428 100644
--- a/arch/xtensa/platform-iss/network.c
+++ b/arch/xtensa/platforms/iss/network.c
@@ -31,7 +31,6 @@
31#include <linux/bootmem.h> 31#include <linux/bootmem.h>
32#include <linux/ethtool.h> 32#include <linux/ethtool.h>
33#include <linux/rtnetlink.h> 33#include <linux/rtnetlink.h>
34#include <linux/timer.h>
35#include <linux/platform_device.h> 34#include <linux/platform_device.h>
36 35
37#include <asm/platform/simcall.h> 36#include <asm/platform/simcall.h>
@@ -108,6 +107,7 @@ struct iss_net_private {
108 107
109static int errno; 108static int errno;
110 109
110static int __simc (int a, int b, int c, int d, int e, int f) __attribute__((__noinline__));
111static int __simc (int a, int b, int c, int d, int e, int f) 111static int __simc (int a, int b, int c, int d, int e, int f)
112{ 112{
113 int ret; 113 int ret;
diff --git a/arch/xtensa/platform-iss/setup.c b/arch/xtensa/platforms/iss/setup.c
index f60c8cf6dfbe..f60c8cf6dfbe 100644
--- a/arch/xtensa/platform-iss/setup.c
+++ b/arch/xtensa/platforms/iss/setup.c
diff --git a/block/blk-core.c b/block/blk-core.c
index e9754dc98ec4..775c8516abf5 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -38,7 +38,7 @@ static int __make_request(struct request_queue *q, struct bio *bio);
38/* 38/*
39 * For the allocated request tables 39 * For the allocated request tables
40 */ 40 */
41struct kmem_cache *request_cachep; 41static struct kmem_cache *request_cachep;
42 42
43/* 43/*
44 * For queue allocation 44 * For queue allocation
@@ -127,6 +127,7 @@ void rq_init(struct request_queue *q, struct request *rq)
127 rq->nr_hw_segments = 0; 127 rq->nr_hw_segments = 0;
128 rq->ioprio = 0; 128 rq->ioprio = 0;
129 rq->special = NULL; 129 rq->special = NULL;
130 rq->raw_data_len = 0;
130 rq->buffer = NULL; 131 rq->buffer = NULL;
131 rq->tag = -1; 132 rq->tag = -1;
132 rq->errors = 0; 133 rq->errors = 0;
@@ -2015,6 +2016,7 @@ void blk_rq_bio_prep(struct request_queue *q, struct request *rq,
2015 rq->hard_cur_sectors = rq->current_nr_sectors; 2016 rq->hard_cur_sectors = rq->current_nr_sectors;
2016 rq->hard_nr_sectors = rq->nr_sectors = bio_sectors(bio); 2017 rq->hard_nr_sectors = rq->nr_sectors = bio_sectors(bio);
2017 rq->buffer = bio_data(bio); 2018 rq->buffer = bio_data(bio);
2019 rq->raw_data_len = bio->bi_size;
2018 rq->data_len = bio->bi_size; 2020 rq->data_len = bio->bi_size;
2019 2021
2020 rq->bio = rq->biotail = bio; 2022 rq->bio = rq->biotail = bio;
diff --git a/block/blk-ioc.c b/block/blk-ioc.c
index 80245dc30c75..e34df7c9fc36 100644
--- a/block/blk-ioc.c
+++ b/block/blk-ioc.c
@@ -17,17 +17,13 @@ static struct kmem_cache *iocontext_cachep;
17 17
18static void cfq_dtor(struct io_context *ioc) 18static void cfq_dtor(struct io_context *ioc)
19{ 19{
20 struct cfq_io_context *cic[1]; 20 if (!hlist_empty(&ioc->cic_list)) {
21 int r; 21 struct cfq_io_context *cic;
22 22
23 /* 23 cic = list_entry(ioc->cic_list.first, struct cfq_io_context,
24 * We don't have a specific key to lookup with, so use the gang 24 cic_list);
25 * lookup to just retrieve the first item stored. The cfq exit 25 cic->dtor(ioc);
26 * function will iterate the full tree, so any member will do. 26 }
27 */
28 r = radix_tree_gang_lookup(&ioc->radix_root, (void **) cic, 0, 1);
29 if (r > 0)
30 cic[0]->dtor(ioc);
31} 27}
32 28
33/* 29/*
@@ -57,18 +53,16 @@ EXPORT_SYMBOL(put_io_context);
57 53
58static void cfq_exit(struct io_context *ioc) 54static void cfq_exit(struct io_context *ioc)
59{ 55{
60 struct cfq_io_context *cic[1];
61 int r;
62
63 rcu_read_lock(); 56 rcu_read_lock();
64 /*
65 * See comment for cfq_dtor()
66 */
67 r = radix_tree_gang_lookup(&ioc->radix_root, (void **) cic, 0, 1);
68 rcu_read_unlock();
69 57
70 if (r > 0) 58 if (!hlist_empty(&ioc->cic_list)) {
71 cic[0]->exit(ioc); 59 struct cfq_io_context *cic;
60
61 cic = list_entry(ioc->cic_list.first, struct cfq_io_context,
62 cic_list);
63 cic->exit(ioc);
64 }
65 rcu_read_unlock();
72} 66}
73 67
74/* Called by the exitting task */ 68/* Called by the exitting task */
@@ -105,6 +99,7 @@ struct io_context *alloc_io_context(gfp_t gfp_flags, int node)
105 ret->nr_batch_requests = 0; /* because this is 0 */ 99 ret->nr_batch_requests = 0; /* because this is 0 */
106 ret->aic = NULL; 100 ret->aic = NULL;
107 INIT_RADIX_TREE(&ret->radix_root, GFP_ATOMIC | __GFP_HIGH); 101 INIT_RADIX_TREE(&ret->radix_root, GFP_ATOMIC | __GFP_HIGH);
102 INIT_HLIST_HEAD(&ret->cic_list);
108 ret->ioc_data = NULL; 103 ret->ioc_data = NULL;
109 } 104 }
110 105
@@ -176,7 +171,7 @@ void copy_io_context(struct io_context **pdst, struct io_context **psrc)
176} 171}
177EXPORT_SYMBOL(copy_io_context); 172EXPORT_SYMBOL(copy_io_context);
178 173
179int __init blk_ioc_init(void) 174static int __init blk_ioc_init(void)
180{ 175{
181 iocontext_cachep = kmem_cache_create("blkdev_ioc", 176 iocontext_cachep = kmem_cache_create("blkdev_ioc",
182 sizeof(struct io_context), 0, SLAB_PANIC, NULL); 177 sizeof(struct io_context), 0, SLAB_PANIC, NULL);
diff --git a/block/blk-map.c b/block/blk-map.c
index 955d75c1a58f..09f7fd0bcb73 100644
--- a/block/blk-map.c
+++ b/block/blk-map.c
@@ -19,6 +19,7 @@ int blk_rq_append_bio(struct request_queue *q, struct request *rq,
19 rq->biotail->bi_next = bio; 19 rq->biotail->bi_next = bio;
20 rq->biotail = bio; 20 rq->biotail = bio;
21 21
22 rq->raw_data_len += bio->bi_size;
22 rq->data_len += bio->bi_size; 23 rq->data_len += bio->bi_size;
23 } 24 }
24 return 0; 25 return 0;
@@ -139,10 +140,29 @@ int blk_rq_map_user(struct request_queue *q, struct request *rq,
139 ubuf += ret; 140 ubuf += ret;
140 } 141 }
141 142
143 /*
144 * __blk_rq_map_user() copies the buffers if starting address
145 * or length isn't aligned. As the copied buffer is always
146 * page aligned, we know that there's enough room for padding.
147 * Extend the last bio and update rq->data_len accordingly.
148 *
149 * On unmap, bio_uncopy_user() will use unmodified
150 * bio_map_data pointed to by bio->bi_private.
151 */
152 if (len & queue_dma_alignment(q)) {
153 unsigned int pad_len = (queue_dma_alignment(q) & ~len) + 1;
154 struct bio *bio = rq->biotail;
155
156 bio->bi_io_vec[bio->bi_vcnt - 1].bv_len += pad_len;
157 bio->bi_size += pad_len;
158 rq->data_len += pad_len;
159 }
160
142 rq->buffer = rq->data = NULL; 161 rq->buffer = rq->data = NULL;
143 return 0; 162 return 0;
144unmap_rq: 163unmap_rq:
145 blk_rq_unmap_user(bio); 164 blk_rq_unmap_user(bio);
165 rq->bio = NULL;
146 return ret; 166 return ret;
147} 167}
148EXPORT_SYMBOL(blk_rq_map_user); 168EXPORT_SYMBOL(blk_rq_map_user);
diff --git a/block/blk-merge.c b/block/blk-merge.c
index d3b84bbb776a..7506c4fe0264 100644
--- a/block/blk-merge.c
+++ b/block/blk-merge.c
@@ -220,7 +220,10 @@ new_segment:
220 bvprv = bvec; 220 bvprv = bvec;
221 } /* segments in rq */ 221 } /* segments in rq */
222 222
223 if (q->dma_drain_size) { 223 if (q->dma_drain_size && q->dma_drain_needed(rq)) {
224 if (rq->cmd_flags & REQ_RW)
225 memset(q->dma_drain_buffer, 0, q->dma_drain_size);
226
224 sg->page_link &= ~0x02; 227 sg->page_link &= ~0x02;
225 sg = sg_next(sg); 228 sg = sg_next(sg);
226 sg_set_page(sg, virt_to_page(q->dma_drain_buffer), 229 sg_set_page(sg, virt_to_page(q->dma_drain_buffer),
@@ -228,6 +231,7 @@ new_segment:
228 ((unsigned long)q->dma_drain_buffer) & 231 ((unsigned long)q->dma_drain_buffer) &
229 (PAGE_SIZE - 1)); 232 (PAGE_SIZE - 1));
230 nsegs++; 233 nsegs++;
234 rq->data_len += q->dma_drain_size;
231 } 235 }
232 236
233 if (sg) 237 if (sg)
diff --git a/block/blk-settings.c b/block/blk-settings.c
index c8d0c5724098..9a8ffdd0ce3d 100644
--- a/block/blk-settings.c
+++ b/block/blk-settings.c
@@ -296,6 +296,7 @@ EXPORT_SYMBOL(blk_queue_stack_limits);
296 * blk_queue_dma_drain - Set up a drain buffer for excess dma. 296 * blk_queue_dma_drain - Set up a drain buffer for excess dma.
297 * 297 *
298 * @q: the request queue for the device 298 * @q: the request queue for the device
299 * @dma_drain_needed: fn which returns non-zero if drain is necessary
299 * @buf: physically contiguous buffer 300 * @buf: physically contiguous buffer
300 * @size: size of the buffer in bytes 301 * @size: size of the buffer in bytes
301 * 302 *
@@ -315,14 +316,16 @@ EXPORT_SYMBOL(blk_queue_stack_limits);
315 * device can support otherwise there won't be room for the drain 316 * device can support otherwise there won't be room for the drain
316 * buffer. 317 * buffer.
317 */ 318 */
318int blk_queue_dma_drain(struct request_queue *q, void *buf, 319extern int blk_queue_dma_drain(struct request_queue *q,
319 unsigned int size) 320 dma_drain_needed_fn *dma_drain_needed,
321 void *buf, unsigned int size)
320{ 322{
321 if (q->max_hw_segments < 2 || q->max_phys_segments < 2) 323 if (q->max_hw_segments < 2 || q->max_phys_segments < 2)
322 return -EINVAL; 324 return -EINVAL;
323 /* make room for appending the drain */ 325 /* make room for appending the drain */
324 --q->max_hw_segments; 326 --q->max_hw_segments;
325 --q->max_phys_segments; 327 --q->max_phys_segments;
328 q->dma_drain_needed = dma_drain_needed;
326 q->dma_drain_buffer = buf; 329 q->dma_drain_buffer = buf;
327 q->dma_drain_size = size; 330 q->dma_drain_size = size;
328 331
@@ -386,7 +389,7 @@ void blk_queue_update_dma_alignment(struct request_queue *q, int mask)
386} 389}
387EXPORT_SYMBOL(blk_queue_update_dma_alignment); 390EXPORT_SYMBOL(blk_queue_update_dma_alignment);
388 391
389int __init blk_settings_init(void) 392static int __init blk_settings_init(void)
390{ 393{
391 blk_max_low_pfn = max_low_pfn - 1; 394 blk_max_low_pfn = max_low_pfn - 1;
392 blk_max_pfn = max_pfn - 1; 395 blk_max_pfn = max_pfn - 1;
diff --git a/block/bsg.c b/block/bsg.c
index 8917c5174dc2..7f3c09549e4b 100644
--- a/block/bsg.c
+++ b/block/bsg.c
@@ -437,14 +437,14 @@ static int blk_complete_sgv4_hdr_rq(struct request *rq, struct sg_io_v4 *hdr,
437 } 437 }
438 438
439 if (rq->next_rq) { 439 if (rq->next_rq) {
440 hdr->dout_resid = rq->data_len; 440 hdr->dout_resid = rq->raw_data_len;
441 hdr->din_resid = rq->next_rq->data_len; 441 hdr->din_resid = rq->next_rq->raw_data_len;
442 blk_rq_unmap_user(bidi_bio); 442 blk_rq_unmap_user(bidi_bio);
443 blk_put_request(rq->next_rq); 443 blk_put_request(rq->next_rq);
444 } else if (rq_data_dir(rq) == READ) 444 } else if (rq_data_dir(rq) == READ)
445 hdr->din_resid = rq->data_len; 445 hdr->din_resid = rq->raw_data_len;
446 else 446 else
447 hdr->dout_resid = rq->data_len; 447 hdr->dout_resid = rq->raw_data_len;
448 448
449 /* 449 /*
450 * If the request generated a negative error number, return it 450 * If the request generated a negative error number, return it
diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c
index ca198e61fa65..0f962ecae91f 100644
--- a/block/cfq-iosched.c
+++ b/block/cfq-iosched.c
@@ -1145,38 +1145,19 @@ static void cfq_put_queue(struct cfq_queue *cfqq)
1145/* 1145/*
1146 * Call func for each cic attached to this ioc. Returns number of cic's seen. 1146 * Call func for each cic attached to this ioc. Returns number of cic's seen.
1147 */ 1147 */
1148#define CIC_GANG_NR 16
1149static unsigned int 1148static unsigned int
1150call_for_each_cic(struct io_context *ioc, 1149call_for_each_cic(struct io_context *ioc,
1151 void (*func)(struct io_context *, struct cfq_io_context *)) 1150 void (*func)(struct io_context *, struct cfq_io_context *))
1152{ 1151{
1153 struct cfq_io_context *cics[CIC_GANG_NR]; 1152 struct cfq_io_context *cic;
1154 unsigned long index = 0; 1153 struct hlist_node *n;
1155 unsigned int called = 0; 1154 int called = 0;
1156 int nr;
1157 1155
1158 rcu_read_lock(); 1156 rcu_read_lock();
1159 1157 hlist_for_each_entry_rcu(cic, n, &ioc->cic_list, cic_list) {
1160 do { 1158 func(ioc, cic);
1161 int i; 1159 called++;
1162 1160 }
1163 /*
1164 * Perhaps there's a better way - this just gang lookups from
1165 * 0 to the end, restarting after each CIC_GANG_NR from the
1166 * last key + 1.
1167 */
1168 nr = radix_tree_gang_lookup(&ioc->radix_root, (void **) cics,
1169 index, CIC_GANG_NR);
1170 if (!nr)
1171 break;
1172
1173 called += nr;
1174 index = 1 + (unsigned long) cics[nr - 1]->key;
1175
1176 for (i = 0; i < nr; i++)
1177 func(ioc, cics[i]);
1178 } while (nr == CIC_GANG_NR);
1179
1180 rcu_read_unlock(); 1161 rcu_read_unlock();
1181 1162
1182 return called; 1163 return called;
@@ -1190,6 +1171,7 @@ static void cic_free_func(struct io_context *ioc, struct cfq_io_context *cic)
1190 1171
1191 spin_lock_irqsave(&ioc->lock, flags); 1172 spin_lock_irqsave(&ioc->lock, flags);
1192 radix_tree_delete(&ioc->radix_root, cic->dead_key); 1173 radix_tree_delete(&ioc->radix_root, cic->dead_key);
1174 hlist_del_rcu(&cic->cic_list);
1193 spin_unlock_irqrestore(&ioc->lock, flags); 1175 spin_unlock_irqrestore(&ioc->lock, flags);
1194 1176
1195 kmem_cache_free(cfq_ioc_pool, cic); 1177 kmem_cache_free(cfq_ioc_pool, cic);
@@ -1280,6 +1262,7 @@ cfq_alloc_io_context(struct cfq_data *cfqd, gfp_t gfp_mask)
1280 if (cic) { 1262 if (cic) {
1281 cic->last_end_request = jiffies; 1263 cic->last_end_request = jiffies;
1282 INIT_LIST_HEAD(&cic->queue_list); 1264 INIT_LIST_HEAD(&cic->queue_list);
1265 INIT_HLIST_NODE(&cic->cic_list);
1283 cic->dtor = cfq_free_io_context; 1266 cic->dtor = cfq_free_io_context;
1284 cic->exit = cfq_exit_io_context; 1267 cic->exit = cfq_exit_io_context;
1285 elv_ioc_count_inc(ioc_count); 1268 elv_ioc_count_inc(ioc_count);
@@ -1501,6 +1484,7 @@ cfq_drop_dead_cic(struct cfq_data *cfqd, struct io_context *ioc,
1501 rcu_assign_pointer(ioc->ioc_data, NULL); 1484 rcu_assign_pointer(ioc->ioc_data, NULL);
1502 1485
1503 radix_tree_delete(&ioc->radix_root, (unsigned long) cfqd); 1486 radix_tree_delete(&ioc->radix_root, (unsigned long) cfqd);
1487 hlist_del_rcu(&cic->cic_list);
1504 spin_unlock_irqrestore(&ioc->lock, flags); 1488 spin_unlock_irqrestore(&ioc->lock, flags);
1505 1489
1506 cfq_cic_free(cic); 1490 cfq_cic_free(cic);
@@ -1561,6 +1545,8 @@ static int cfq_cic_link(struct cfq_data *cfqd, struct io_context *ioc,
1561 spin_lock_irqsave(&ioc->lock, flags); 1545 spin_lock_irqsave(&ioc->lock, flags);
1562 ret = radix_tree_insert(&ioc->radix_root, 1546 ret = radix_tree_insert(&ioc->radix_root,
1563 (unsigned long) cfqd, cic); 1547 (unsigned long) cfqd, cic);
1548 if (!ret)
1549 hlist_add_head_rcu(&cic->cic_list, &ioc->cic_list);
1564 spin_unlock_irqrestore(&ioc->lock, flags); 1550 spin_unlock_irqrestore(&ioc->lock, flags);
1565 1551
1566 radix_tree_preload_end(); 1552 radix_tree_preload_end();
diff --git a/block/elevator.c b/block/elevator.c
index bafbae0344d3..88318c383608 100644
--- a/block/elevator.c
+++ b/block/elevator.c
@@ -134,6 +134,21 @@ static struct elevator_type *elevator_get(const char *name)
134 spin_lock(&elv_list_lock); 134 spin_lock(&elv_list_lock);
135 135
136 e = elevator_find(name); 136 e = elevator_find(name);
137 if (!e) {
138 char elv[ELV_NAME_MAX + strlen("-iosched")];
139
140 spin_unlock(&elv_list_lock);
141
142 if (!strcmp(name, "anticipatory"))
143 sprintf(elv, "as-iosched");
144 else
145 sprintf(elv, "%s-iosched", name);
146
147 request_module(elv);
148 spin_lock(&elv_list_lock);
149 e = elevator_find(name);
150 }
151
137 if (e && !try_module_get(e->elevator_owner)) 152 if (e && !try_module_get(e->elevator_owner))
138 e = NULL; 153 e = NULL;
139 154
diff --git a/block/scsi_ioctl.c b/block/scsi_ioctl.c
index 9675b34638d4..e993cac4911d 100644
--- a/block/scsi_ioctl.c
+++ b/block/scsi_ioctl.c
@@ -266,7 +266,7 @@ static int blk_complete_sghdr_rq(struct request *rq, struct sg_io_hdr *hdr,
266 hdr->info = 0; 266 hdr->info = 0;
267 if (hdr->masked_status || hdr->host_status || hdr->driver_status) 267 if (hdr->masked_status || hdr->host_status || hdr->driver_status)
268 hdr->info |= SG_INFO_CHECK; 268 hdr->info |= SG_INFO_CHECK;
269 hdr->resid = rq->data_len; 269 hdr->resid = rq->raw_data_len;
270 hdr->sb_len_wr = 0; 270 hdr->sb_len_wr = 0;
271 271
272 if (rq->sense_len && hdr->sbp) { 272 if (rq->sense_len && hdr->sbp) {
@@ -528,6 +528,7 @@ static int __blk_send_generic(struct request_queue *q, struct gendisk *bd_disk,
528 rq = blk_get_request(q, WRITE, __GFP_WAIT); 528 rq = blk_get_request(q, WRITE, __GFP_WAIT);
529 rq->cmd_type = REQ_TYPE_BLOCK_PC; 529 rq->cmd_type = REQ_TYPE_BLOCK_PC;
530 rq->data = NULL; 530 rq->data = NULL;
531 rq->raw_data_len = 0;
531 rq->data_len = 0; 532 rq->data_len = 0;
532 rq->timeout = BLK_DEFAULT_SG_TIMEOUT; 533 rq->timeout = BLK_DEFAULT_SG_TIMEOUT;
533 memset(rq->cmd, 0, sizeof(rq->cmd)); 534 memset(rq->cmd, 0, sizeof(rq->cmd));
diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
index 29e71bddd6ff..3c06e457b4dc 100644
--- a/drivers/ata/ahci.c
+++ b/drivers/ata/ahci.c
@@ -1975,16 +1975,11 @@ static int ahci_port_start(struct ata_port *ap)
1975 struct ahci_port_priv *pp; 1975 struct ahci_port_priv *pp;
1976 void *mem; 1976 void *mem;
1977 dma_addr_t mem_dma; 1977 dma_addr_t mem_dma;
1978 int rc;
1979 1978
1980 pp = devm_kzalloc(dev, sizeof(*pp), GFP_KERNEL); 1979 pp = devm_kzalloc(dev, sizeof(*pp), GFP_KERNEL);
1981 if (!pp) 1980 if (!pp)
1982 return -ENOMEM; 1981 return -ENOMEM;
1983 1982
1984 rc = ata_pad_alloc(ap, dev);
1985 if (rc)
1986 return rc;
1987
1988 mem = dmam_alloc_coherent(dev, AHCI_PORT_PRIV_DMA_SZ, &mem_dma, 1983 mem = dmam_alloc_coherent(dev, AHCI_PORT_PRIV_DMA_SZ, &mem_dma,
1989 GFP_KERNEL); 1984 GFP_KERNEL);
1990 if (!mem) 1985 if (!mem)
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index f46eb6f6dc9f..def3682f416a 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -4493,30 +4493,13 @@ void ata_sg_clean(struct ata_queued_cmd *qc)
4493 struct ata_port *ap = qc->ap; 4493 struct ata_port *ap = qc->ap;
4494 struct scatterlist *sg = qc->sg; 4494 struct scatterlist *sg = qc->sg;
4495 int dir = qc->dma_dir; 4495 int dir = qc->dma_dir;
4496 void *pad_buf = NULL;
4497 4496
4498 WARN_ON(sg == NULL); 4497 WARN_ON(sg == NULL);
4499 4498
4500 VPRINTK("unmapping %u sg elements\n", qc->mapped_n_elem); 4499 VPRINTK("unmapping %u sg elements\n", qc->n_elem);
4501 4500
4502 /* if we padded the buffer out to 32-bit bound, and data 4501 if (qc->n_elem)
4503 * xfer direction is from-device, we must copy from the 4502 dma_unmap_sg(ap->dev, sg, qc->n_elem, dir);
4504 * pad buffer back into the supplied buffer
4505 */
4506 if (qc->pad_len && !(qc->tf.flags & ATA_TFLAG_WRITE))
4507 pad_buf = ap->pad + (qc->tag * ATA_DMA_PAD_SZ);
4508
4509 if (qc->mapped_n_elem)
4510 dma_unmap_sg(ap->dev, sg, qc->mapped_n_elem, dir);
4511 /* restore last sg */
4512 if (qc->last_sg)
4513 *qc->last_sg = qc->saved_last_sg;
4514 if (pad_buf) {
4515 struct scatterlist *psg = &qc->extra_sg[1];
4516 void *addr = kmap_atomic(sg_page(psg), KM_IRQ0);
4517 memcpy(addr + psg->offset, pad_buf, qc->pad_len);
4518 kunmap_atomic(addr, KM_IRQ0);
4519 }
4520 4503
4521 qc->flags &= ~ATA_QCFLAG_DMAMAP; 4504 qc->flags &= ~ATA_QCFLAG_DMAMAP;
4522 qc->sg = NULL; 4505 qc->sg = NULL;
@@ -4659,43 +4642,6 @@ int ata_check_atapi_dma(struct ata_queued_cmd *qc)
4659} 4642}
4660 4643
4661/** 4644/**
4662 * atapi_qc_may_overflow - Check whether data transfer may overflow
4663 * @qc: ATA command in question
4664 *
4665 * ATAPI commands which transfer variable length data to host
4666 * might overflow due to application error or hardare bug. This
4667 * function checks whether overflow should be drained and ignored
4668 * for @qc.
4669 *
4670 * LOCKING:
4671 * None.
4672 *
4673 * RETURNS:
4674 * 1 if @qc may overflow; otherwise, 0.
4675 */
4676static int atapi_qc_may_overflow(struct ata_queued_cmd *qc)
4677{
4678 if (qc->tf.protocol != ATAPI_PROT_PIO &&
4679 qc->tf.protocol != ATAPI_PROT_DMA)
4680 return 0;
4681
4682 if (qc->tf.flags & ATA_TFLAG_WRITE)
4683 return 0;
4684
4685 switch (qc->cdb[0]) {
4686 case READ_10:
4687 case READ_12:
4688 case WRITE_10:
4689 case WRITE_12:
4690 case GPCMD_READ_CD:
4691 case GPCMD_READ_CD_MSF:
4692 return 0;
4693 }
4694
4695 return 1;
4696}
4697
4698/**
4699 * ata_std_qc_defer - Check whether a qc needs to be deferred 4645 * ata_std_qc_defer - Check whether a qc needs to be deferred
4700 * @qc: ATA command in question 4646 * @qc: ATA command in question
4701 * 4647 *
@@ -4782,97 +4728,6 @@ void ata_sg_init(struct ata_queued_cmd *qc, struct scatterlist *sg,
4782 qc->cursg = qc->sg; 4728 qc->cursg = qc->sg;
4783} 4729}
4784 4730
4785static unsigned int ata_sg_setup_extra(struct ata_queued_cmd *qc,
4786 unsigned int *n_elem_extra,
4787 unsigned int *nbytes_extra)
4788{
4789 struct ata_port *ap = qc->ap;
4790 unsigned int n_elem = qc->n_elem;
4791 struct scatterlist *lsg, *copy_lsg = NULL, *tsg = NULL, *esg = NULL;
4792
4793 *n_elem_extra = 0;
4794 *nbytes_extra = 0;
4795
4796 /* needs padding? */
4797 qc->pad_len = qc->nbytes & 3;
4798
4799 if (likely(!qc->pad_len))
4800 return n_elem;
4801
4802 /* locate last sg and save it */
4803 lsg = sg_last(qc->sg, n_elem);
4804 qc->last_sg = lsg;
4805 qc->saved_last_sg = *lsg;
4806
4807 sg_init_table(qc->extra_sg, ARRAY_SIZE(qc->extra_sg));
4808
4809 if (qc->pad_len) {
4810 struct scatterlist *psg = &qc->extra_sg[1];
4811 void *pad_buf = ap->pad + (qc->tag * ATA_DMA_PAD_SZ);
4812 unsigned int offset;
4813
4814 WARN_ON(qc->dev->class != ATA_DEV_ATAPI);
4815
4816 memset(pad_buf, 0, ATA_DMA_PAD_SZ);
4817
4818 /* psg->page/offset are used to copy to-be-written
4819 * data in this function or read data in ata_sg_clean.
4820 */
4821 offset = lsg->offset + lsg->length - qc->pad_len;
4822 sg_set_page(psg, nth_page(sg_page(lsg), offset >> PAGE_SHIFT),
4823 qc->pad_len, offset_in_page(offset));
4824
4825 if (qc->tf.flags & ATA_TFLAG_WRITE) {
4826 void *addr = kmap_atomic(sg_page(psg), KM_IRQ0);
4827 memcpy(pad_buf, addr + psg->offset, qc->pad_len);
4828 kunmap_atomic(addr, KM_IRQ0);
4829 }
4830
4831 sg_dma_address(psg) = ap->pad_dma + (qc->tag * ATA_DMA_PAD_SZ);
4832 sg_dma_len(psg) = ATA_DMA_PAD_SZ;
4833
4834 /* Trim the last sg entry and chain the original and
4835 * padding sg lists.
4836 *
4837 * Because chaining consumes one sg entry, one extra
4838 * sg entry is allocated and the last sg entry is
4839 * copied to it if the length isn't zero after padded
4840 * amount is removed.
4841 *
4842 * If the last sg entry is completely replaced by
4843 * padding sg entry, the first sg entry is skipped
4844 * while chaining.
4845 */
4846 lsg->length -= qc->pad_len;
4847 if (lsg->length) {
4848 copy_lsg = &qc->extra_sg[0];
4849 tsg = &qc->extra_sg[0];
4850 } else {
4851 n_elem--;
4852 tsg = &qc->extra_sg[1];
4853 }
4854
4855 esg = &qc->extra_sg[1];
4856
4857 (*n_elem_extra)++;
4858 (*nbytes_extra) += 4 - qc->pad_len;
4859 }
4860
4861 if (copy_lsg)
4862 sg_set_page(copy_lsg, sg_page(lsg), lsg->length, lsg->offset);
4863
4864 sg_chain(lsg, 1, tsg);
4865 sg_mark_end(esg);
4866
4867 /* sglist can't start with chaining sg entry, fast forward */
4868 if (qc->sg == lsg) {
4869 qc->sg = tsg;
4870 qc->cursg = tsg;
4871 }
4872
4873 return n_elem;
4874}
4875
4876/** 4731/**
4877 * ata_sg_setup - DMA-map the scatter-gather table associated with a command. 4732 * ata_sg_setup - DMA-map the scatter-gather table associated with a command.
4878 * @qc: Command with scatter-gather table to be mapped. 4733 * @qc: Command with scatter-gather table to be mapped.
@@ -4889,26 +4744,17 @@ static unsigned int ata_sg_setup_extra(struct ata_queued_cmd *qc,
4889static int ata_sg_setup(struct ata_queued_cmd *qc) 4744static int ata_sg_setup(struct ata_queued_cmd *qc)
4890{ 4745{
4891 struct ata_port *ap = qc->ap; 4746 struct ata_port *ap = qc->ap;
4892 unsigned int n_elem, n_elem_extra, nbytes_extra; 4747 unsigned int n_elem;
4893 4748
4894 VPRINTK("ENTER, ata%u\n", ap->print_id); 4749 VPRINTK("ENTER, ata%u\n", ap->print_id);
4895 4750
4896 n_elem = ata_sg_setup_extra(qc, &n_elem_extra, &nbytes_extra); 4751 n_elem = dma_map_sg(ap->dev, qc->sg, qc->n_elem, qc->dma_dir);
4752 if (n_elem < 1)
4753 return -1;
4897 4754
4898 if (n_elem) { 4755 DPRINTK("%d sg elements mapped\n", n_elem);
4899 n_elem = dma_map_sg(ap->dev, qc->sg, n_elem, qc->dma_dir);
4900 if (n_elem < 1) {
4901 /* restore last sg */
4902 if (qc->last_sg)
4903 *qc->last_sg = qc->saved_last_sg;
4904 return -1;
4905 }
4906 DPRINTK("%d sg elements mapped\n", n_elem);
4907 }
4908 4756
4909 qc->n_elem = qc->mapped_n_elem = n_elem; 4757 qc->n_elem = n_elem;
4910 qc->n_elem += n_elem_extra;
4911 qc->nbytes += nbytes_extra;
4912 qc->flags |= ATA_QCFLAG_DMAMAP; 4758 qc->flags |= ATA_QCFLAG_DMAMAP;
4913 4759
4914 return 0; 4760 return 0;
@@ -5146,46 +4992,22 @@ static void atapi_send_cdb(struct ata_port *ap, struct ata_queued_cmd *qc)
5146 */ 4992 */
5147static int __atapi_pio_bytes(struct ata_queued_cmd *qc, unsigned int bytes) 4993static int __atapi_pio_bytes(struct ata_queued_cmd *qc, unsigned int bytes)
5148{ 4994{
5149 int do_write = (qc->tf.flags & ATA_TFLAG_WRITE); 4995 int rw = (qc->tf.flags & ATA_TFLAG_WRITE) ? WRITE : READ;
5150 struct ata_port *ap = qc->ap; 4996 struct ata_port *ap = qc->ap;
5151 struct ata_eh_info *ehi = &qc->dev->link->eh_info; 4997 struct ata_device *dev = qc->dev;
4998 struct ata_eh_info *ehi = &dev->link->eh_info;
5152 struct scatterlist *sg; 4999 struct scatterlist *sg;
5153 struct page *page; 5000 struct page *page;
5154 unsigned char *buf; 5001 unsigned char *buf;
5155 unsigned int offset, count; 5002 unsigned int offset, count, consumed;
5156 5003
5157next_sg: 5004next_sg:
5158 sg = qc->cursg; 5005 sg = qc->cursg;
5159 if (unlikely(!sg)) { 5006 if (unlikely(!sg)) {
5160 /* 5007 ata_ehi_push_desc(ehi, "unexpected or too much trailing data "
5161 * The end of qc->sg is reached and the device expects 5008 "buf=%u cur=%u bytes=%u",
5162 * more data to transfer. In order not to overrun qc->sg 5009 qc->nbytes, qc->curbytes, bytes);
5163 * and fulfill length specified in the byte count register, 5010 return -1;
5164 * - for read case, discard trailing data from the device
5165 * - for write case, padding zero data to the device
5166 */
5167 u16 pad_buf[1] = { 0 };
5168 unsigned int i;
5169
5170 if (bytes > qc->curbytes - qc->nbytes + ATAPI_MAX_DRAIN) {
5171 ata_ehi_push_desc(ehi, "too much trailing data "
5172 "buf=%u cur=%u bytes=%u",
5173 qc->nbytes, qc->curbytes, bytes);
5174 return -1;
5175 }
5176
5177 /* overflow is exptected for misc ATAPI commands */
5178 if (bytes && !atapi_qc_may_overflow(qc))
5179 ata_dev_printk(qc->dev, KERN_WARNING, "ATAPI %u bytes "
5180 "trailing data (cdb=%02x nbytes=%u)\n",
5181 bytes, qc->cdb[0], qc->nbytes);
5182
5183 for (i = 0; i < (bytes + 1) / 2; i++)
5184 ap->ops->data_xfer(qc->dev, (unsigned char *)pad_buf, 2, do_write);
5185
5186 qc->curbytes += bytes;
5187
5188 return 0;
5189 } 5011 }
5190 5012
5191 page = sg_page(sg); 5013 page = sg_page(sg);
@@ -5211,18 +5033,16 @@ next_sg:
5211 buf = kmap_atomic(page, KM_IRQ0); 5033 buf = kmap_atomic(page, KM_IRQ0);
5212 5034
5213 /* do the actual data transfer */ 5035 /* do the actual data transfer */
5214 ap->ops->data_xfer(qc->dev, buf + offset, count, do_write); 5036 consumed = ap->ops->data_xfer(dev, buf + offset, count, rw);
5215 5037
5216 kunmap_atomic(buf, KM_IRQ0); 5038 kunmap_atomic(buf, KM_IRQ0);
5217 local_irq_restore(flags); 5039 local_irq_restore(flags);
5218 } else { 5040 } else {
5219 buf = page_address(page); 5041 buf = page_address(page);
5220 ap->ops->data_xfer(qc->dev, buf + offset, count, do_write); 5042 consumed = ap->ops->data_xfer(dev, buf + offset, count, rw);
5221 } 5043 }
5222 5044
5223 bytes -= count; 5045 bytes -= min(bytes, consumed);
5224 if ((count & 1) && bytes)
5225 bytes--;
5226 qc->curbytes += count; 5046 qc->curbytes += count;
5227 qc->cursg_ofs += count; 5047 qc->cursg_ofs += count;
5228 5048
@@ -5231,9 +5051,11 @@ next_sg:
5231 qc->cursg_ofs = 0; 5051 qc->cursg_ofs = 0;
5232 } 5052 }
5233 5053
5054 /* consumed can be larger than count only for the last transfer */
5055 WARN_ON(qc->cursg && count != consumed);
5056
5234 if (bytes) 5057 if (bytes)
5235 goto next_sg; 5058 goto next_sg;
5236
5237 return 0; 5059 return 0;
5238} 5060}
5239 5061
@@ -5251,6 +5073,7 @@ static void atapi_pio_bytes(struct ata_queued_cmd *qc)
5251{ 5073{
5252 struct ata_port *ap = qc->ap; 5074 struct ata_port *ap = qc->ap;
5253 struct ata_device *dev = qc->dev; 5075 struct ata_device *dev = qc->dev;
5076 struct ata_eh_info *ehi = &dev->link->eh_info;
5254 unsigned int ireason, bc_lo, bc_hi, bytes; 5077 unsigned int ireason, bc_lo, bc_hi, bytes;
5255 int i_write, do_write = (qc->tf.flags & ATA_TFLAG_WRITE) ? 1 : 0; 5078 int i_write, do_write = (qc->tf.flags & ATA_TFLAG_WRITE) ? 1 : 0;
5256 5079
@@ -5268,26 +5091,28 @@ static void atapi_pio_bytes(struct ata_queued_cmd *qc)
5268 5091
5269 /* shall be cleared to zero, indicating xfer of data */ 5092 /* shall be cleared to zero, indicating xfer of data */
5270 if (unlikely(ireason & (1 << 0))) 5093 if (unlikely(ireason & (1 << 0)))
5271 goto err_out; 5094 goto atapi_check;
5272 5095
5273 /* make sure transfer direction matches expected */ 5096 /* make sure transfer direction matches expected */
5274 i_write = ((ireason & (1 << 1)) == 0) ? 1 : 0; 5097 i_write = ((ireason & (1 << 1)) == 0) ? 1 : 0;
5275 if (unlikely(do_write != i_write)) 5098 if (unlikely(do_write != i_write))
5276 goto err_out; 5099 goto atapi_check;
5277 5100
5278 if (unlikely(!bytes)) 5101 if (unlikely(!bytes))
5279 goto err_out; 5102 goto atapi_check;
5280 5103
5281 VPRINTK("ata%u: xfering %d bytes\n", ap->print_id, bytes); 5104 VPRINTK("ata%u: xfering %d bytes\n", ap->print_id, bytes);
5282 5105
5283 if (__atapi_pio_bytes(qc, bytes)) 5106 if (unlikely(__atapi_pio_bytes(qc, bytes)))
5284 goto err_out; 5107 goto err_out;
5285 ata_altstatus(ap); /* flush */ 5108 ata_altstatus(ap); /* flush */
5286 5109
5287 return; 5110 return;
5288 5111
5289err_out: 5112 atapi_check:
5290 ata_dev_printk(dev, KERN_INFO, "ATAPI check failed\n"); 5113 ata_ehi_push_desc(ehi, "ATAPI check failed (ireason=0x%x bytes=%u)",
5114 ireason, bytes);
5115 err_out:
5291 qc->err_mask |= AC_ERR_HSM; 5116 qc->err_mask |= AC_ERR_HSM;
5292 ap->hsm_task_state = HSM_ST_ERR; 5117 ap->hsm_task_state = HSM_ST_ERR;
5293} 5118}
@@ -5972,9 +5797,6 @@ void ata_qc_issue(struct ata_queued_cmd *qc)
5972 */ 5797 */
5973 BUG_ON(ata_is_data(prot) && (!qc->sg || !qc->n_elem || !qc->nbytes)); 5798 BUG_ON(ata_is_data(prot) && (!qc->sg || !qc->n_elem || !qc->nbytes));
5974 5799
5975 /* ata_sg_setup() may update nbytes */
5976 qc->raw_nbytes = qc->nbytes;
5977
5978 if (ata_is_dma(prot) || (ata_is_pio(prot) && 5800 if (ata_is_dma(prot) || (ata_is_pio(prot) &&
5979 (ap->flags & ATA_FLAG_PIO_DMA))) 5801 (ap->flags & ATA_FLAG_PIO_DMA)))
5980 if (ata_sg_setup(qc)) 5802 if (ata_sg_setup(qc))
@@ -6583,19 +6405,12 @@ void ata_host_resume(struct ata_host *host)
6583int ata_port_start(struct ata_port *ap) 6405int ata_port_start(struct ata_port *ap)
6584{ 6406{
6585 struct device *dev = ap->dev; 6407 struct device *dev = ap->dev;
6586 int rc;
6587 6408
6588 ap->prd = dmam_alloc_coherent(dev, ATA_PRD_TBL_SZ, &ap->prd_dma, 6409 ap->prd = dmam_alloc_coherent(dev, ATA_PRD_TBL_SZ, &ap->prd_dma,
6589 GFP_KERNEL); 6410 GFP_KERNEL);
6590 if (!ap->prd) 6411 if (!ap->prd)
6591 return -ENOMEM; 6412 return -ENOMEM;
6592 6413
6593 rc = ata_pad_alloc(ap, dev);
6594 if (rc)
6595 return rc;
6596
6597 DPRINTK("prd alloc, virt %p, dma %llx\n", ap->prd,
6598 (unsigned long long)ap->prd_dma);
6599 return 0; 6414 return 0;
6600} 6415}
6601 6416
diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
index 1cea18f62abc..dd41b1a1b304 100644
--- a/drivers/ata/libata-scsi.c
+++ b/drivers/ata/libata-scsi.c
@@ -826,30 +826,61 @@ static void ata_scsi_sdev_config(struct scsi_device *sdev)
826 sdev->max_device_blocked = 1; 826 sdev->max_device_blocked = 1;
827} 827}
828 828
829static void ata_scsi_dev_config(struct scsi_device *sdev, 829/**
830 struct ata_device *dev) 830 * atapi_drain_needed - Check whether data transfer may overflow
831 * @request: request to be checked
832 *
833 * ATAPI commands which transfer variable length data to host
834 * might overflow due to application error or hardare bug. This
835 * function checks whether overflow should be drained and ignored
836 * for @request.
837 *
838 * LOCKING:
839 * None.
840 *
841 * RETURNS:
842 * 1 if ; otherwise, 0.
843 */
844static int atapi_drain_needed(struct request *rq)
845{
846 if (likely(!blk_pc_request(rq)))
847 return 0;
848
849 if (!rq->data_len || (rq->cmd_flags & REQ_RW))
850 return 0;
851
852 return atapi_cmd_type(rq->cmd[0]) == ATAPI_MISC;
853}
854
855static int ata_scsi_dev_config(struct scsi_device *sdev,
856 struct ata_device *dev)
831{ 857{
832 /* configure max sectors */ 858 /* configure max sectors */
833 blk_queue_max_sectors(sdev->request_queue, dev->max_sectors); 859 blk_queue_max_sectors(sdev->request_queue, dev->max_sectors);
834 860
835 /* SATA DMA transfers must be multiples of 4 byte, so
836 * we need to pad ATAPI transfers using an extra sg.
837 * Decrement max hw segments accordingly.
838 */
839 if (dev->class == ATA_DEV_ATAPI) { 861 if (dev->class == ATA_DEV_ATAPI) {
840 struct request_queue *q = sdev->request_queue; 862 struct request_queue *q = sdev->request_queue;
841 blk_queue_max_hw_segments(q, q->max_hw_segments - 1); 863 void *buf;
842 864
843 /* set the min alignment */ 865 /* set the min alignment */
844 blk_queue_update_dma_alignment(sdev->request_queue, 866 blk_queue_update_dma_alignment(sdev->request_queue,
845 ATA_DMA_PAD_SZ - 1); 867 ATA_DMA_PAD_SZ - 1);
846 } else 868
869 /* configure draining */
870 buf = kmalloc(ATAPI_MAX_DRAIN, q->bounce_gfp | GFP_KERNEL);
871 if (!buf) {
872 ata_dev_printk(dev, KERN_ERR,
873 "drain buffer allocation failed\n");
874 return -ENOMEM;
875 }
876
877 blk_queue_dma_drain(q, atapi_drain_needed, buf, ATAPI_MAX_DRAIN);
878 } else {
847 /* ATA devices must be sector aligned */ 879 /* ATA devices must be sector aligned */
848 blk_queue_update_dma_alignment(sdev->request_queue, 880 blk_queue_update_dma_alignment(sdev->request_queue,
849 ATA_SECT_SIZE - 1); 881 ATA_SECT_SIZE - 1);
850
851 if (dev->class == ATA_DEV_ATA)
852 sdev->manage_start_stop = 1; 882 sdev->manage_start_stop = 1;
883 }
853 884
854 if (dev->flags & ATA_DFLAG_AN) 885 if (dev->flags & ATA_DFLAG_AN)
855 set_bit(SDEV_EVT_MEDIA_CHANGE, sdev->supported_events); 886 set_bit(SDEV_EVT_MEDIA_CHANGE, sdev->supported_events);
@@ -861,6 +892,8 @@ static void ata_scsi_dev_config(struct scsi_device *sdev,
861 depth = min(ATA_MAX_QUEUE - 1, depth); 892 depth = min(ATA_MAX_QUEUE - 1, depth);
862 scsi_adjust_queue_depth(sdev, MSG_SIMPLE_TAG, depth); 893 scsi_adjust_queue_depth(sdev, MSG_SIMPLE_TAG, depth);
863 } 894 }
895
896 return 0;
864} 897}
865 898
866/** 899/**
@@ -879,13 +912,14 @@ int ata_scsi_slave_config(struct scsi_device *sdev)
879{ 912{
880 struct ata_port *ap = ata_shost_to_port(sdev->host); 913 struct ata_port *ap = ata_shost_to_port(sdev->host);
881 struct ata_device *dev = __ata_scsi_find_dev(ap, sdev); 914 struct ata_device *dev = __ata_scsi_find_dev(ap, sdev);
915 int rc = 0;
882 916
883 ata_scsi_sdev_config(sdev); 917 ata_scsi_sdev_config(sdev);
884 918
885 if (dev) 919 if (dev)
886 ata_scsi_dev_config(sdev, dev); 920 rc = ata_scsi_dev_config(sdev, dev);
887 921
888 return 0; 922 return rc;
889} 923}
890 924
891/** 925/**
@@ -905,6 +939,7 @@ int ata_scsi_slave_config(struct scsi_device *sdev)
905void ata_scsi_slave_destroy(struct scsi_device *sdev) 939void ata_scsi_slave_destroy(struct scsi_device *sdev)
906{ 940{
907 struct ata_port *ap = ata_shost_to_port(sdev->host); 941 struct ata_port *ap = ata_shost_to_port(sdev->host);
942 struct request_queue *q = sdev->request_queue;
908 unsigned long flags; 943 unsigned long flags;
909 struct ata_device *dev; 944 struct ata_device *dev;
910 945
@@ -920,6 +955,10 @@ void ata_scsi_slave_destroy(struct scsi_device *sdev)
920 ata_port_schedule_eh(ap); 955 ata_port_schedule_eh(ap);
921 } 956 }
922 spin_unlock_irqrestore(ap->lock, flags); 957 spin_unlock_irqrestore(ap->lock, flags);
958
959 kfree(q->dma_drain_buffer);
960 q->dma_drain_buffer = NULL;
961 q->dma_drain_size = 0;
923} 962}
924 963
925/** 964/**
@@ -2500,7 +2539,7 @@ static unsigned int atapi_xlat(struct ata_queued_cmd *qc)
2500 * want to set it properly, and for DMA where it is 2539 * want to set it properly, and for DMA where it is
2501 * effectively meaningless. 2540 * effectively meaningless.
2502 */ 2541 */
2503 nbytes = min(qc->nbytes, (unsigned int)63 * 1024); 2542 nbytes = min(scmd->request->raw_data_len, (unsigned int)63 * 1024);
2504 2543
2505 /* Most ATAPI devices which honor transfer chunk size don't 2544 /* Most ATAPI devices which honor transfer chunk size don't
2506 * behave according to the spec when odd chunk size which 2545 * behave according to the spec when odd chunk size which
@@ -3555,7 +3594,7 @@ EXPORT_SYMBOL_GPL(ata_sas_port_alloc);
3555 * @ap: Port to initialize 3594 * @ap: Port to initialize
3556 * 3595 *
3557 * Called just after data structures for each port are 3596 * Called just after data structures for each port are
3558 * initialized. Allocates DMA pad. 3597 * initialized.
3559 * 3598 *
3560 * May be used as the port_start() entry in ata_port_operations. 3599 * May be used as the port_start() entry in ata_port_operations.
3561 * 3600 *
@@ -3564,7 +3603,7 @@ EXPORT_SYMBOL_GPL(ata_sas_port_alloc);
3564 */ 3603 */
3565int ata_sas_port_start(struct ata_port *ap) 3604int ata_sas_port_start(struct ata_port *ap)
3566{ 3605{
3567 return ata_pad_alloc(ap, ap->dev); 3606 return 0;
3568} 3607}
3569EXPORT_SYMBOL_GPL(ata_sas_port_start); 3608EXPORT_SYMBOL_GPL(ata_sas_port_start);
3570 3609
@@ -3572,8 +3611,6 @@ EXPORT_SYMBOL_GPL(ata_sas_port_start);
3572 * ata_port_stop - Undo ata_sas_port_start() 3611 * ata_port_stop - Undo ata_sas_port_start()
3573 * @ap: Port to shut down 3612 * @ap: Port to shut down
3574 * 3613 *
3575 * Frees the DMA pad.
3576 *
3577 * May be used as the port_stop() entry in ata_port_operations. 3614 * May be used as the port_stop() entry in ata_port_operations.
3578 * 3615 *
3579 * LOCKING: 3616 * LOCKING:
@@ -3582,7 +3619,6 @@ EXPORT_SYMBOL_GPL(ata_sas_port_start);
3582 3619
3583void ata_sas_port_stop(struct ata_port *ap) 3620void ata_sas_port_stop(struct ata_port *ap)
3584{ 3621{
3585 ata_pad_free(ap, ap->dev);
3586} 3622}
3587EXPORT_SYMBOL_GPL(ata_sas_port_stop); 3623EXPORT_SYMBOL_GPL(ata_sas_port_stop);
3588 3624
diff --git a/drivers/ata/pata_icside.c b/drivers/ata/pata_icside.c
index 5b8586dac63b..f97068be2d79 100644
--- a/drivers/ata/pata_icside.c
+++ b/drivers/ata/pata_icside.c
@@ -304,12 +304,6 @@ static int icside_dma_init(struct pata_icside_info *info)
304} 304}
305 305
306 306
307static int pata_icside_port_start(struct ata_port *ap)
308{
309 /* No PRD to alloc */
310 return ata_pad_alloc(ap, ap->dev);
311}
312
313static struct scsi_host_template pata_icside_sht = { 307static struct scsi_host_template pata_icside_sht = {
314 .module = THIS_MODULE, 308 .module = THIS_MODULE,
315 .name = DRV_NAME, 309 .name = DRV_NAME,
@@ -389,8 +383,6 @@ static struct ata_port_operations pata_icside_port_ops = {
389 .irq_clear = ata_dummy_noret, 383 .irq_clear = ata_dummy_noret,
390 .irq_on = ata_irq_on, 384 .irq_on = ata_irq_on,
391 385
392 .port_start = pata_icside_port_start,
393
394 .bmdma_stop = pata_icside_bmdma_stop, 386 .bmdma_stop = pata_icside_bmdma_stop,
395 .bmdma_status = pata_icside_bmdma_status, 387 .bmdma_status = pata_icside_bmdma_status,
396}; 388};
diff --git a/drivers/ata/sata_fsl.c b/drivers/ata/sata_fsl.c
index efcb66b6ccef..9323dd0c7d8d 100644
--- a/drivers/ata/sata_fsl.c
+++ b/drivers/ata/sata_fsl.c
@@ -601,21 +601,9 @@ static int sata_fsl_port_start(struct ata_port *ap)
601 if (!pp) 601 if (!pp)
602 return -ENOMEM; 602 return -ENOMEM;
603 603
604 /*
605 * allocate per command dma alignment pad buffer, which is used
606 * internally by libATA to ensure that all transfers ending on
607 * unaligned boundaries are padded, to align on Dword boundaries
608 */
609 retval = ata_pad_alloc(ap, dev);
610 if (retval) {
611 kfree(pp);
612 return retval;
613 }
614
615 mem = dma_alloc_coherent(dev, SATA_FSL_PORT_PRIV_DMA_SZ, &mem_dma, 604 mem = dma_alloc_coherent(dev, SATA_FSL_PORT_PRIV_DMA_SZ, &mem_dma,
616 GFP_KERNEL); 605 GFP_KERNEL);
617 if (!mem) { 606 if (!mem) {
618 ata_pad_free(ap, dev);
619 kfree(pp); 607 kfree(pp);
620 return -ENOMEM; 608 return -ENOMEM;
621 } 609 }
@@ -694,7 +682,6 @@ static void sata_fsl_port_stop(struct ata_port *ap)
694 dma_free_coherent(dev, SATA_FSL_PORT_PRIV_DMA_SZ, 682 dma_free_coherent(dev, SATA_FSL_PORT_PRIV_DMA_SZ,
695 pp->cmdslot, pp->cmdslot_paddr); 683 pp->cmdslot, pp->cmdslot_paddr);
696 684
697 ata_pad_free(ap, dev);
698 kfree(pp); 685 kfree(pp);
699} 686}
700 687
diff --git a/drivers/ata/sata_mv.c b/drivers/ata/sata_mv.c
index 2ecd44db4142..1c1fbf375d9a 100644
--- a/drivers/ata/sata_mv.c
+++ b/drivers/ata/sata_mv.c
@@ -1158,17 +1158,13 @@ static int mv_port_start(struct ata_port *ap)
1158 struct mv_port_priv *pp; 1158 struct mv_port_priv *pp;
1159 void __iomem *port_mmio = mv_ap_base(ap); 1159 void __iomem *port_mmio = mv_ap_base(ap);
1160 unsigned long flags; 1160 unsigned long flags;
1161 int tag, rc; 1161 int tag;
1162 1162
1163 pp = devm_kzalloc(dev, sizeof(*pp), GFP_KERNEL); 1163 pp = devm_kzalloc(dev, sizeof(*pp), GFP_KERNEL);
1164 if (!pp) 1164 if (!pp)
1165 return -ENOMEM; 1165 return -ENOMEM;
1166 ap->private_data = pp; 1166 ap->private_data = pp;
1167 1167
1168 rc = ata_pad_alloc(ap, dev);
1169 if (rc)
1170 return rc;
1171
1172 pp->crqb = dma_pool_alloc(hpriv->crqb_pool, GFP_KERNEL, &pp->crqb_dma); 1168 pp->crqb = dma_pool_alloc(hpriv->crqb_pool, GFP_KERNEL, &pp->crqb_dma);
1173 if (!pp->crqb) 1169 if (!pp->crqb)
1174 return -ENOMEM; 1170 return -ENOMEM;
diff --git a/drivers/ata/sata_sil24.c b/drivers/ata/sata_sil24.c
index b4b1f91ea693..df7988df7908 100644
--- a/drivers/ata/sata_sil24.c
+++ b/drivers/ata/sata_sil24.c
@@ -1234,7 +1234,6 @@ static int sil24_port_start(struct ata_port *ap)
1234 union sil24_cmd_block *cb; 1234 union sil24_cmd_block *cb;
1235 size_t cb_size = sizeof(*cb) * SIL24_MAX_CMDS; 1235 size_t cb_size = sizeof(*cb) * SIL24_MAX_CMDS;
1236 dma_addr_t cb_dma; 1236 dma_addr_t cb_dma;
1237 int rc;
1238 1237
1239 pp = devm_kzalloc(dev, sizeof(*pp), GFP_KERNEL); 1238 pp = devm_kzalloc(dev, sizeof(*pp), GFP_KERNEL);
1240 if (!pp) 1239 if (!pp)
@@ -1247,10 +1246,6 @@ static int sil24_port_start(struct ata_port *ap)
1247 return -ENOMEM; 1246 return -ENOMEM;
1248 memset(cb, 0, cb_size); 1247 memset(cb, 0, cb_size);
1249 1248
1250 rc = ata_pad_alloc(ap, dev);
1251 if (rc)
1252 return rc;
1253
1254 pp->cmd_block = cb; 1249 pp->cmd_block = cb;
1255 pp->cmd_block_dma = cb_dma; 1250 pp->cmd_block_dma = cb_dma;
1256 1251
diff --git a/drivers/char/drm/drmP.h b/drivers/char/drm/drmP.h
index 19d3be5c4b2d..a6789f25009b 100644
--- a/drivers/char/drm/drmP.h
+++ b/drivers/char/drm/drmP.h
@@ -568,7 +568,7 @@ struct drm_driver {
568 void (*postclose) (struct drm_device *, struct drm_file *); 568 void (*postclose) (struct drm_device *, struct drm_file *);
569 void (*lastclose) (struct drm_device *); 569 void (*lastclose) (struct drm_device *);
570 int (*unload) (struct drm_device *); 570 int (*unload) (struct drm_device *);
571 int (*suspend) (struct drm_device *); 571 int (*suspend) (struct drm_device *, pm_message_t state);
572 int (*resume) (struct drm_device *); 572 int (*resume) (struct drm_device *);
573 int (*dma_ioctl) (struct drm_device *dev, void *data, struct drm_file *file_priv); 573 int (*dma_ioctl) (struct drm_device *dev, void *data, struct drm_file *file_priv);
574 void (*dma_ready) (struct drm_device *); 574 void (*dma_ready) (struct drm_device *);
diff --git a/drivers/char/drm/drm_pciids.h b/drivers/char/drm/drm_pciids.h
index f52468843678..715b361f0c2b 100644
--- a/drivers/char/drm/drm_pciids.h
+++ b/drivers/char/drm/drm_pciids.h
@@ -83,6 +83,7 @@
83 {0x1002, 0x5460, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV380|RADEON_IS_MOBILITY}, \ 83 {0x1002, 0x5460, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV380|RADEON_IS_MOBILITY}, \
84 {0x1002, 0x5462, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV380|RADEON_IS_MOBILITY}, \ 84 {0x1002, 0x5462, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV380|RADEON_IS_MOBILITY}, \
85 {0x1002, 0x5464, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV380|RADEON_IS_MOBILITY}, \ 85 {0x1002, 0x5464, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV380|RADEON_IS_MOBILITY}, \
86 {0x1002, 0x5657, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV380|RADEON_NEW_MEMMAP}, \
86 {0x1002, 0x5548, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R420|RADEON_NEW_MEMMAP}, \ 87 {0x1002, 0x5548, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R420|RADEON_NEW_MEMMAP}, \
87 {0x1002, 0x5549, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R420|RADEON_NEW_MEMMAP}, \ 88 {0x1002, 0x5549, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R420|RADEON_NEW_MEMMAP}, \
88 {0x1002, 0x554A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R420|RADEON_NEW_MEMMAP}, \ 89 {0x1002, 0x554A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R420|RADEON_NEW_MEMMAP}, \
@@ -236,6 +237,7 @@
236 {0x1002, 0x7297, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV560|RADEON_NEW_MEMMAP}, \ 237 {0x1002, 0x7297, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV560|RADEON_NEW_MEMMAP}, \
237 {0x1002, 0x7834, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS300|RADEON_IS_IGP|RADEON_NEW_MEMMAP}, \ 238 {0x1002, 0x7834, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS300|RADEON_IS_IGP|RADEON_NEW_MEMMAP}, \
238 {0x1002, 0x7835, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS300|RADEON_IS_IGP|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ 239 {0x1002, 0x7835, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS300|RADEON_IS_IGP|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
240 {0x1002, 0x791e, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS690|RADEON_IS_IGP|RADEON_NEW_MEMMAP|RADEON_IS_IGPGART}, \
239 {0, 0, 0} 241 {0, 0, 0}
240 242
241#define r128_PCI_IDS \ 243#define r128_PCI_IDS \
@@ -313,6 +315,7 @@
313 {0x1039, 0x5300, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \ 315 {0x1039, 0x5300, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
314 {0x1039, 0x6300, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \ 316 {0x1039, 0x6300, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
315 {0x1039, 0x6330, PCI_ANY_ID, PCI_ANY_ID, 0, 0, SIS_CHIP_315}, \ 317 {0x1039, 0x6330, PCI_ANY_ID, PCI_ANY_ID, 0, 0, SIS_CHIP_315}, \
318 {0x1039, 0x6351, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
316 {0x1039, 0x7300, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \ 319 {0x1039, 0x7300, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
317 {0x18CA, 0x0040, PCI_ANY_ID, PCI_ANY_ID, 0, 0, SIS_CHIP_315}, \ 320 {0x18CA, 0x0040, PCI_ANY_ID, PCI_ANY_ID, 0, 0, SIS_CHIP_315}, \
318 {0x18CA, 0x0042, PCI_ANY_ID, PCI_ANY_ID, 0, 0, SIS_CHIP_315}, \ 321 {0x18CA, 0x0042, PCI_ANY_ID, PCI_ANY_ID, 0, 0, SIS_CHIP_315}, \
diff --git a/drivers/char/drm/drm_sysfs.c b/drivers/char/drm/drm_sysfs.c
index fa36153619e8..05ed5043254f 100644
--- a/drivers/char/drm/drm_sysfs.c
+++ b/drivers/char/drm/drm_sysfs.c
@@ -36,7 +36,7 @@ static int drm_sysfs_suspend(struct device *dev, pm_message_t state)
36 printk(KERN_ERR "%s\n", __FUNCTION__); 36 printk(KERN_ERR "%s\n", __FUNCTION__);
37 37
38 if (drm_dev->driver->suspend) 38 if (drm_dev->driver->suspend)
39 return drm_dev->driver->suspend(drm_dev); 39 return drm_dev->driver->suspend(drm_dev, state);
40 40
41 return 0; 41 return 0;
42} 42}
diff --git a/drivers/char/drm/drm_vm.c b/drivers/char/drm/drm_vm.c
index cea4105374b2..3d65c4dcd0c6 100644
--- a/drivers/char/drm/drm_vm.c
+++ b/drivers/char/drm/drm_vm.c
@@ -66,7 +66,7 @@ static pgprot_t drm_io_prot(uint32_t map_type, struct vm_area_struct *vma)
66} 66}
67 67
68/** 68/**
69 * \c nopage method for AGP virtual memory. 69 * \c fault method for AGP virtual memory.
70 * 70 *
71 * \param vma virtual memory area. 71 * \param vma virtual memory area.
72 * \param address access address. 72 * \param address access address.
@@ -76,8 +76,7 @@ static pgprot_t drm_io_prot(uint32_t map_type, struct vm_area_struct *vma)
76 * map, get the page, increment the use count and return it. 76 * map, get the page, increment the use count and return it.
77 */ 77 */
78#if __OS_HAS_AGP 78#if __OS_HAS_AGP
79static __inline__ struct page *drm_do_vm_nopage(struct vm_area_struct *vma, 79static int drm_do_vm_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
80 unsigned long address)
81{ 80{
82 struct drm_file *priv = vma->vm_file->private_data; 81 struct drm_file *priv = vma->vm_file->private_data;
83 struct drm_device *dev = priv->head->dev; 82 struct drm_device *dev = priv->head->dev;
@@ -89,19 +88,24 @@ static __inline__ struct page *drm_do_vm_nopage(struct vm_area_struct *vma,
89 * Find the right map 88 * Find the right map
90 */ 89 */
91 if (!drm_core_has_AGP(dev)) 90 if (!drm_core_has_AGP(dev))
92 goto vm_nopage_error; 91 goto vm_fault_error;
93 92
94 if (!dev->agp || !dev->agp->cant_use_aperture) 93 if (!dev->agp || !dev->agp->cant_use_aperture)
95 goto vm_nopage_error; 94 goto vm_fault_error;
96 95
97 if (drm_ht_find_item(&dev->map_hash, vma->vm_pgoff, &hash)) 96 if (drm_ht_find_item(&dev->map_hash, vma->vm_pgoff, &hash))
98 goto vm_nopage_error; 97 goto vm_fault_error;
99 98
100 r_list = drm_hash_entry(hash, struct drm_map_list, hash); 99 r_list = drm_hash_entry(hash, struct drm_map_list, hash);
101 map = r_list->map; 100 map = r_list->map;
102 101
103 if (map && map->type == _DRM_AGP) { 102 if (map && map->type == _DRM_AGP) {
104 unsigned long offset = address - vma->vm_start; 103 /*
104 * Using vm_pgoff as a selector forces us to use this unusual
105 * addressing scheme.
106 */
107 unsigned long offset = (unsigned long)vmf->virtual_address -
108 vma->vm_start;
105 unsigned long baddr = map->offset + offset; 109 unsigned long baddr = map->offset + offset;
106 struct drm_agp_mem *agpmem; 110 struct drm_agp_mem *agpmem;
107 struct page *page; 111 struct page *page;
@@ -123,7 +127,7 @@ static __inline__ struct page *drm_do_vm_nopage(struct vm_area_struct *vma,
123 } 127 }
124 128
125 if (!agpmem) 129 if (!agpmem)
126 goto vm_nopage_error; 130 goto vm_fault_error;
127 131
128 /* 132 /*
129 * Get the page, inc the use count, and return it 133 * Get the page, inc the use count, and return it
@@ -131,22 +135,21 @@ static __inline__ struct page *drm_do_vm_nopage(struct vm_area_struct *vma,
131 offset = (baddr - agpmem->bound) >> PAGE_SHIFT; 135 offset = (baddr - agpmem->bound) >> PAGE_SHIFT;
132 page = virt_to_page(__va(agpmem->memory->memory[offset])); 136 page = virt_to_page(__va(agpmem->memory->memory[offset]));
133 get_page(page); 137 get_page(page);
138 vmf->page = page;
134 139
135 DRM_DEBUG 140 DRM_DEBUG
136 ("baddr = 0x%lx page = 0x%p, offset = 0x%lx, count=%d\n", 141 ("baddr = 0x%lx page = 0x%p, offset = 0x%lx, count=%d\n",
137 baddr, __va(agpmem->memory->memory[offset]), offset, 142 baddr, __va(agpmem->memory->memory[offset]), offset,
138 page_count(page)); 143 page_count(page));
139 144 return 0;
140 return page;
141 } 145 }
142 vm_nopage_error: 146vm_fault_error:
143 return NOPAGE_SIGBUS; /* Disallow mremap */ 147 return VM_FAULT_SIGBUS; /* Disallow mremap */
144} 148}
145#else /* __OS_HAS_AGP */ 149#else /* __OS_HAS_AGP */
146static __inline__ struct page *drm_do_vm_nopage(struct vm_area_struct *vma, 150static int drm_do_vm_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
147 unsigned long address)
148{ 151{
149 return NOPAGE_SIGBUS; 152 return VM_FAULT_SIGBUS;
150} 153}
151#endif /* __OS_HAS_AGP */ 154#endif /* __OS_HAS_AGP */
152 155
@@ -160,28 +163,26 @@ static __inline__ struct page *drm_do_vm_nopage(struct vm_area_struct *vma,
160 * Get the mapping, find the real physical page to map, get the page, and 163 * Get the mapping, find the real physical page to map, get the page, and
161 * return it. 164 * return it.
162 */ 165 */
163static __inline__ struct page *drm_do_vm_shm_nopage(struct vm_area_struct *vma, 166static int drm_do_vm_shm_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
164 unsigned long address)
165{ 167{
166 struct drm_map *map = (struct drm_map *) vma->vm_private_data; 168 struct drm_map *map = (struct drm_map *) vma->vm_private_data;
167 unsigned long offset; 169 unsigned long offset;
168 unsigned long i; 170 unsigned long i;
169 struct page *page; 171 struct page *page;
170 172
171 if (address > vma->vm_end)
172 return NOPAGE_SIGBUS; /* Disallow mremap */
173 if (!map) 173 if (!map)
174 return NOPAGE_SIGBUS; /* Nothing allocated */ 174 return VM_FAULT_SIGBUS; /* Nothing allocated */
175 175
176 offset = address - vma->vm_start; 176 offset = (unsigned long)vmf->virtual_address - vma->vm_start;
177 i = (unsigned long)map->handle + offset; 177 i = (unsigned long)map->handle + offset;
178 page = vmalloc_to_page((void *)i); 178 page = vmalloc_to_page((void *)i);
179 if (!page) 179 if (!page)
180 return NOPAGE_SIGBUS; 180 return VM_FAULT_SIGBUS;
181 get_page(page); 181 get_page(page);
182 vmf->page = page;
182 183
183 DRM_DEBUG("0x%lx\n", address); 184 DRM_DEBUG("shm_fault 0x%lx\n", offset);
184 return page; 185 return 0;
185} 186}
186 187
187/** 188/**
@@ -263,7 +264,7 @@ static void drm_vm_shm_close(struct vm_area_struct *vma)
263} 264}
264 265
265/** 266/**
266 * \c nopage method for DMA virtual memory. 267 * \c fault method for DMA virtual memory.
267 * 268 *
268 * \param vma virtual memory area. 269 * \param vma virtual memory area.
269 * \param address access address. 270 * \param address access address.
@@ -271,8 +272,7 @@ static void drm_vm_shm_close(struct vm_area_struct *vma)
271 * 272 *
272 * Determine the page number from the page offset and get it from drm_device_dma::pagelist. 273 * Determine the page number from the page offset and get it from drm_device_dma::pagelist.
273 */ 274 */
274static __inline__ struct page *drm_do_vm_dma_nopage(struct vm_area_struct *vma, 275static int drm_do_vm_dma_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
275 unsigned long address)
276{ 276{
277 struct drm_file *priv = vma->vm_file->private_data; 277 struct drm_file *priv = vma->vm_file->private_data;
278 struct drm_device *dev = priv->head->dev; 278 struct drm_device *dev = priv->head->dev;
@@ -282,24 +282,23 @@ static __inline__ struct page *drm_do_vm_dma_nopage(struct vm_area_struct *vma,
282 struct page *page; 282 struct page *page;
283 283
284 if (!dma) 284 if (!dma)
285 return NOPAGE_SIGBUS; /* Error */ 285 return VM_FAULT_SIGBUS; /* Error */
286 if (address > vma->vm_end)
287 return NOPAGE_SIGBUS; /* Disallow mremap */
288 if (!dma->pagelist) 286 if (!dma->pagelist)
289 return NOPAGE_SIGBUS; /* Nothing allocated */ 287 return VM_FAULT_SIGBUS; /* Nothing allocated */
290 288
291 offset = address - vma->vm_start; /* vm_[pg]off[set] should be 0 */ 289 offset = (unsigned long)vmf->virtual_address - vma->vm_start; /* vm_[pg]off[set] should be 0 */
292 page_nr = offset >> PAGE_SHIFT; 290 page_nr = offset >> PAGE_SHIFT; /* page_nr could just be vmf->pgoff */
293 page = virt_to_page((dma->pagelist[page_nr] + (offset & (~PAGE_MASK)))); 291 page = virt_to_page((dma->pagelist[page_nr] + (offset & (~PAGE_MASK))));
294 292
295 get_page(page); 293 get_page(page);
294 vmf->page = page;
296 295
297 DRM_DEBUG("0x%lx (page %lu)\n", address, page_nr); 296 DRM_DEBUG("dma_fault 0x%lx (page %lu)\n", offset, page_nr);
298 return page; 297 return 0;
299} 298}
300 299
301/** 300/**
302 * \c nopage method for scatter-gather virtual memory. 301 * \c fault method for scatter-gather virtual memory.
303 * 302 *
304 * \param vma virtual memory area. 303 * \param vma virtual memory area.
305 * \param address access address. 304 * \param address access address.
@@ -307,8 +306,7 @@ static __inline__ struct page *drm_do_vm_dma_nopage(struct vm_area_struct *vma,
307 * 306 *
308 * Determine the map offset from the page offset and get it from drm_sg_mem::pagelist. 307 * Determine the map offset from the page offset and get it from drm_sg_mem::pagelist.
309 */ 308 */
310static __inline__ struct page *drm_do_vm_sg_nopage(struct vm_area_struct *vma, 309static int drm_do_vm_sg_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
311 unsigned long address)
312{ 310{
313 struct drm_map *map = (struct drm_map *) vma->vm_private_data; 311 struct drm_map *map = (struct drm_map *) vma->vm_private_data;
314 struct drm_file *priv = vma->vm_file->private_data; 312 struct drm_file *priv = vma->vm_file->private_data;
@@ -320,77 +318,64 @@ static __inline__ struct page *drm_do_vm_sg_nopage(struct vm_area_struct *vma,
320 struct page *page; 318 struct page *page;
321 319
322 if (!entry) 320 if (!entry)
323 return NOPAGE_SIGBUS; /* Error */ 321 return VM_FAULT_SIGBUS; /* Error */
324 if (address > vma->vm_end)
325 return NOPAGE_SIGBUS; /* Disallow mremap */
326 if (!entry->pagelist) 322 if (!entry->pagelist)
327 return NOPAGE_SIGBUS; /* Nothing allocated */ 323 return VM_FAULT_SIGBUS; /* Nothing allocated */
328 324
329 offset = address - vma->vm_start; 325 offset = (unsigned long)vmf->virtual_address - vma->vm_start;
330 map_offset = map->offset - (unsigned long)dev->sg->virtual; 326 map_offset = map->offset - (unsigned long)dev->sg->virtual;
331 page_offset = (offset >> PAGE_SHIFT) + (map_offset >> PAGE_SHIFT); 327 page_offset = (offset >> PAGE_SHIFT) + (map_offset >> PAGE_SHIFT);
332 page = entry->pagelist[page_offset]; 328 page = entry->pagelist[page_offset];
333 get_page(page); 329 get_page(page);
330 vmf->page = page;
334 331
335 return page; 332 return 0;
336} 333}
337 334
338static struct page *drm_vm_nopage(struct vm_area_struct *vma, 335static int drm_vm_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
339 unsigned long address, int *type)
340{ 336{
341 if (type) 337 return drm_do_vm_fault(vma, vmf);
342 *type = VM_FAULT_MINOR;
343 return drm_do_vm_nopage(vma, address);
344} 338}
345 339
346static struct page *drm_vm_shm_nopage(struct vm_area_struct *vma, 340static int drm_vm_shm_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
347 unsigned long address, int *type)
348{ 341{
349 if (type) 342 return drm_do_vm_shm_fault(vma, vmf);
350 *type = VM_FAULT_MINOR;
351 return drm_do_vm_shm_nopage(vma, address);
352} 343}
353 344
354static struct page *drm_vm_dma_nopage(struct vm_area_struct *vma, 345static int drm_vm_dma_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
355 unsigned long address, int *type)
356{ 346{
357 if (type) 347 return drm_do_vm_dma_fault(vma, vmf);
358 *type = VM_FAULT_MINOR;
359 return drm_do_vm_dma_nopage(vma, address);
360} 348}
361 349
362static struct page *drm_vm_sg_nopage(struct vm_area_struct *vma, 350static int drm_vm_sg_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
363 unsigned long address, int *type)
364{ 351{
365 if (type) 352 return drm_do_vm_sg_fault(vma, vmf);
366 *type = VM_FAULT_MINOR;
367 return drm_do_vm_sg_nopage(vma, address);
368} 353}
369 354
370/** AGP virtual memory operations */ 355/** AGP virtual memory operations */
371static struct vm_operations_struct drm_vm_ops = { 356static struct vm_operations_struct drm_vm_ops = {
372 .nopage = drm_vm_nopage, 357 .fault = drm_vm_fault,
373 .open = drm_vm_open, 358 .open = drm_vm_open,
374 .close = drm_vm_close, 359 .close = drm_vm_close,
375}; 360};
376 361
377/** Shared virtual memory operations */ 362/** Shared virtual memory operations */
378static struct vm_operations_struct drm_vm_shm_ops = { 363static struct vm_operations_struct drm_vm_shm_ops = {
379 .nopage = drm_vm_shm_nopage, 364 .fault = drm_vm_shm_fault,
380 .open = drm_vm_open, 365 .open = drm_vm_open,
381 .close = drm_vm_shm_close, 366 .close = drm_vm_shm_close,
382}; 367};
383 368
384/** DMA virtual memory operations */ 369/** DMA virtual memory operations */
385static struct vm_operations_struct drm_vm_dma_ops = { 370static struct vm_operations_struct drm_vm_dma_ops = {
386 .nopage = drm_vm_dma_nopage, 371 .fault = drm_vm_dma_fault,
387 .open = drm_vm_open, 372 .open = drm_vm_open,
388 .close = drm_vm_close, 373 .close = drm_vm_close,
389}; 374};
390 375
391/** Scatter-gather virtual memory operations */ 376/** Scatter-gather virtual memory operations */
392static struct vm_operations_struct drm_vm_sg_ops = { 377static struct vm_operations_struct drm_vm_sg_ops = {
393 .nopage = drm_vm_sg_nopage, 378 .fault = drm_vm_sg_fault,
394 .open = drm_vm_open, 379 .open = drm_vm_open,
395 .close = drm_vm_close, 380 .close = drm_vm_close,
396}; 381};
@@ -604,7 +589,7 @@ static int drm_mmap_locked(struct file *filp, struct vm_area_struct *vma)
604 /* 589 /*
605 * On some platforms we can't talk to bus dma address from the CPU, so for 590 * On some platforms we can't talk to bus dma address from the CPU, so for
606 * memory of type DRM_AGP, we'll deal with sorting out the real physical 591 * memory of type DRM_AGP, we'll deal with sorting out the real physical
607 * pages and mappings in nopage() 592 * pages and mappings in fault()
608 */ 593 */
609#if defined(__powerpc__) 594#if defined(__powerpc__)
610 pgprot_val(vma->vm_page_prot) |= _PAGE_NO_CACHE; 595 pgprot_val(vma->vm_page_prot) |= _PAGE_NO_CACHE;
@@ -634,7 +619,7 @@ static int drm_mmap_locked(struct file *filp, struct vm_area_struct *vma)
634 break; 619 break;
635 case _DRM_CONSISTENT: 620 case _DRM_CONSISTENT:
636 /* Consistent memory is really like shared memory. But 621 /* Consistent memory is really like shared memory. But
637 * it's allocated in a different way, so avoid nopage */ 622 * it's allocated in a different way, so avoid fault */
638 if (remap_pfn_range(vma, vma->vm_start, 623 if (remap_pfn_range(vma, vma->vm_start,
639 page_to_pfn(virt_to_page(map->handle)), 624 page_to_pfn(virt_to_page(map->handle)),
640 vma->vm_end - vma->vm_start, vma->vm_page_prot)) 625 vma->vm_end - vma->vm_start, vma->vm_page_prot))
diff --git a/drivers/char/drm/i915_dma.c b/drivers/char/drm/i915_dma.c
index 43986d81ae34..e9d6663bec73 100644
--- a/drivers/char/drm/i915_dma.c
+++ b/drivers/char/drm/i915_dma.c
@@ -171,7 +171,7 @@ static int i915_initialize(struct drm_device * dev, drm_i915_init_t * init)
171 dev_priv->allow_batchbuffer = 1; 171 dev_priv->allow_batchbuffer = 1;
172 172
173 /* Program Hardware Status Page */ 173 /* Program Hardware Status Page */
174 if (!IS_G33(dev)) { 174 if (!I915_NEED_GFX_HWS(dev)) {
175 dev_priv->status_page_dmah = 175 dev_priv->status_page_dmah =
176 drm_pci_alloc(dev, PAGE_SIZE, PAGE_SIZE, 0xffffffff); 176 drm_pci_alloc(dev, PAGE_SIZE, PAGE_SIZE, 0xffffffff);
177 177
@@ -720,6 +720,9 @@ static int i915_set_status_page(struct drm_device *dev, void *data,
720 drm_i915_private_t *dev_priv = dev->dev_private; 720 drm_i915_private_t *dev_priv = dev->dev_private;
721 drm_i915_hws_addr_t *hws = data; 721 drm_i915_hws_addr_t *hws = data;
722 722
723 if (!I915_NEED_GFX_HWS(dev))
724 return -EINVAL;
725
723 if (!dev_priv) { 726 if (!dev_priv) {
724 DRM_ERROR("called with no initialization\n"); 727 DRM_ERROR("called with no initialization\n");
725 return -EINVAL; 728 return -EINVAL;
diff --git a/drivers/char/drm/i915_drv.c b/drivers/char/drm/i915_drv.c
index 52e51033d32c..4048f39b7eed 100644
--- a/drivers/char/drm/i915_drv.c
+++ b/drivers/char/drm/i915_drv.c
@@ -160,6 +160,7 @@ static void i915_save_vga(struct drm_device *dev)
160 dev_priv->saveAR[i] = i915_read_ar(st01, i, 0); 160 dev_priv->saveAR[i] = i915_read_ar(st01, i, 0);
161 inb(st01); 161 inb(st01);
162 outb(dev_priv->saveAR_INDEX, VGA_AR_INDEX); 162 outb(dev_priv->saveAR_INDEX, VGA_AR_INDEX);
163 inb(st01);
163 164
164 /* Graphics controller registers */ 165 /* Graphics controller registers */
165 for (i = 0; i < 9; i++) 166 for (i = 0; i < 9; i++)
@@ -225,6 +226,7 @@ static void i915_restore_vga(struct drm_device *dev)
225 i915_write_ar(st01, i, dev_priv->saveAR[i], 0); 226 i915_write_ar(st01, i, dev_priv->saveAR[i], 0);
226 inb(st01); /* switch back to index mode */ 227 inb(st01); /* switch back to index mode */
227 outb(dev_priv->saveAR_INDEX | 0x20, VGA_AR_INDEX); 228 outb(dev_priv->saveAR_INDEX | 0x20, VGA_AR_INDEX);
229 inb(st01);
228 230
229 /* VGA color palette registers */ 231 /* VGA color palette registers */
230 outb(dev_priv->saveDACMASK, VGA_DACMASK); 232 outb(dev_priv->saveDACMASK, VGA_DACMASK);
@@ -236,7 +238,7 @@ static void i915_restore_vga(struct drm_device *dev)
236 238
237} 239}
238 240
239static int i915_suspend(struct drm_device *dev) 241static int i915_suspend(struct drm_device *dev, pm_message_t state)
240{ 242{
241 struct drm_i915_private *dev_priv = dev->dev_private; 243 struct drm_i915_private *dev_priv = dev->dev_private;
242 int i; 244 int i;
@@ -247,6 +249,9 @@ static int i915_suspend(struct drm_device *dev)
247 return -ENODEV; 249 return -ENODEV;
248 } 250 }
249 251
252 if (state.event == PM_EVENT_PRETHAW)
253 return 0;
254
250 pci_save_state(dev->pdev); 255 pci_save_state(dev->pdev);
251 pci_read_config_byte(dev->pdev, LBB, &dev_priv->saveLBB); 256 pci_read_config_byte(dev->pdev, LBB, &dev_priv->saveLBB);
252 257
@@ -276,6 +281,7 @@ static int i915_suspend(struct drm_device *dev)
276 dev_priv->saveDSPATILEOFF = I915_READ(DSPATILEOFF); 281 dev_priv->saveDSPATILEOFF = I915_READ(DSPATILEOFF);
277 } 282 }
278 i915_save_palette(dev, PIPE_A); 283 i915_save_palette(dev, PIPE_A);
284 dev_priv->savePIPEASTAT = I915_READ(I915REG_PIPEASTAT);
279 285
280 /* Pipe & plane B info */ 286 /* Pipe & plane B info */
281 dev_priv->savePIPEBCONF = I915_READ(PIPEBCONF); 287 dev_priv->savePIPEBCONF = I915_READ(PIPEBCONF);
@@ -303,6 +309,7 @@ static int i915_suspend(struct drm_device *dev)
303 dev_priv->saveDSPBTILEOFF = I915_READ(DSPBTILEOFF); 309 dev_priv->saveDSPBTILEOFF = I915_READ(DSPBTILEOFF);
304 } 310 }
305 i915_save_palette(dev, PIPE_B); 311 i915_save_palette(dev, PIPE_B);
312 dev_priv->savePIPEBSTAT = I915_READ(I915REG_PIPEBSTAT);
306 313
307 /* CRT state */ 314 /* CRT state */
308 dev_priv->saveADPA = I915_READ(ADPA); 315 dev_priv->saveADPA = I915_READ(ADPA);
@@ -329,12 +336,26 @@ static int i915_suspend(struct drm_device *dev)
329 dev_priv->saveFBC_CONTROL2 = I915_READ(FBC_CONTROL2); 336 dev_priv->saveFBC_CONTROL2 = I915_READ(FBC_CONTROL2);
330 dev_priv->saveFBC_CONTROL = I915_READ(FBC_CONTROL); 337 dev_priv->saveFBC_CONTROL = I915_READ(FBC_CONTROL);
331 338
339 /* Interrupt state */
340 dev_priv->saveIIR = I915_READ(I915REG_INT_IDENTITY_R);
341 dev_priv->saveIER = I915_READ(I915REG_INT_ENABLE_R);
342 dev_priv->saveIMR = I915_READ(I915REG_INT_MASK_R);
343
332 /* VGA state */ 344 /* VGA state */
333 dev_priv->saveVCLK_DIVISOR_VGA0 = I915_READ(VCLK_DIVISOR_VGA0); 345 dev_priv->saveVCLK_DIVISOR_VGA0 = I915_READ(VCLK_DIVISOR_VGA0);
334 dev_priv->saveVCLK_DIVISOR_VGA1 = I915_READ(VCLK_DIVISOR_VGA1); 346 dev_priv->saveVCLK_DIVISOR_VGA1 = I915_READ(VCLK_DIVISOR_VGA1);
335 dev_priv->saveVCLK_POST_DIV = I915_READ(VCLK_POST_DIV); 347 dev_priv->saveVCLK_POST_DIV = I915_READ(VCLK_POST_DIV);
336 dev_priv->saveVGACNTRL = I915_READ(VGACNTRL); 348 dev_priv->saveVGACNTRL = I915_READ(VGACNTRL);
337 349
350 /* Clock gating state */
351 dev_priv->saveDSPCLK_GATE_D = I915_READ(DSPCLK_GATE_D);
352
353 /* Cache mode state */
354 dev_priv->saveCACHE_MODE_0 = I915_READ(CACHE_MODE_0);
355
356 /* Memory Arbitration state */
357 dev_priv->saveMI_ARB_STATE = I915_READ(MI_ARB_STATE);
358
338 /* Scratch space */ 359 /* Scratch space */
339 for (i = 0; i < 16; i++) { 360 for (i = 0; i < 16; i++) {
340 dev_priv->saveSWF0[i] = I915_READ(SWF0 + (i << 2)); 361 dev_priv->saveSWF0[i] = I915_READ(SWF0 + (i << 2));
@@ -345,9 +366,11 @@ static int i915_suspend(struct drm_device *dev)
345 366
346 i915_save_vga(dev); 367 i915_save_vga(dev);
347 368
348 /* Shut down the device */ 369 if (state.event == PM_EVENT_SUSPEND) {
349 pci_disable_device(dev->pdev); 370 /* Shut down the device */
350 pci_set_power_state(dev->pdev, PCI_D3hot); 371 pci_disable_device(dev->pdev);
372 pci_set_power_state(dev->pdev, PCI_D3hot);
373 }
351 374
352 return 0; 375 return 0;
353} 376}
@@ -400,9 +423,7 @@ static int i915_resume(struct drm_device *dev)
400 I915_WRITE(DSPATILEOFF, dev_priv->saveDSPATILEOFF); 423 I915_WRITE(DSPATILEOFF, dev_priv->saveDSPATILEOFF);
401 } 424 }
402 425
403 if ((dev_priv->saveDPLL_A & DPLL_VCO_ENABLE) && 426 I915_WRITE(PIPEACONF, dev_priv->savePIPEACONF);
404 (dev_priv->saveDPLL_A & DPLL_VGA_MODE_DIS))
405 I915_WRITE(PIPEACONF, dev_priv->savePIPEACONF);
406 427
407 i915_restore_palette(dev, PIPE_A); 428 i915_restore_palette(dev, PIPE_A);
408 /* Enable the plane */ 429 /* Enable the plane */
@@ -444,10 +465,9 @@ static int i915_resume(struct drm_device *dev)
444 I915_WRITE(DSPBTILEOFF, dev_priv->saveDSPBTILEOFF); 465 I915_WRITE(DSPBTILEOFF, dev_priv->saveDSPBTILEOFF);
445 } 466 }
446 467
447 if ((dev_priv->saveDPLL_B & DPLL_VCO_ENABLE) && 468 I915_WRITE(PIPEBCONF, dev_priv->savePIPEBCONF);
448 (dev_priv->saveDPLL_B & DPLL_VGA_MODE_DIS)) 469
449 I915_WRITE(PIPEBCONF, dev_priv->savePIPEBCONF); 470 i915_restore_palette(dev, PIPE_B);
450 i915_restore_palette(dev, PIPE_A);
451 /* Enable the plane */ 471 /* Enable the plane */
452 I915_WRITE(DSPBCNTR, dev_priv->saveDSPBCNTR); 472 I915_WRITE(DSPBCNTR, dev_priv->saveDSPBCNTR);
453 I915_WRITE(DSPBBASE, I915_READ(DSPBBASE)); 473 I915_WRITE(DSPBBASE, I915_READ(DSPBBASE));
@@ -485,6 +505,15 @@ static int i915_resume(struct drm_device *dev)
485 I915_WRITE(VCLK_POST_DIV, dev_priv->saveVCLK_POST_DIV); 505 I915_WRITE(VCLK_POST_DIV, dev_priv->saveVCLK_POST_DIV);
486 udelay(150); 506 udelay(150);
487 507
508 /* Clock gating state */
509 I915_WRITE (DSPCLK_GATE_D, dev_priv->saveDSPCLK_GATE_D);
510
511 /* Cache mode state */
512 I915_WRITE (CACHE_MODE_0, dev_priv->saveCACHE_MODE_0 | 0xffff0000);
513
514 /* Memory arbitration state */
515 I915_WRITE (MI_ARB_STATE, dev_priv->saveMI_ARB_STATE | 0xffff0000);
516
488 for (i = 0; i < 16; i++) { 517 for (i = 0; i < 16; i++) {
489 I915_WRITE(SWF0 + (i << 2), dev_priv->saveSWF0[i]); 518 I915_WRITE(SWF0 + (i << 2), dev_priv->saveSWF0[i]);
490 I915_WRITE(SWF10 + (i << 2), dev_priv->saveSWF1[i+7]); 519 I915_WRITE(SWF10 + (i << 2), dev_priv->saveSWF1[i+7]);
diff --git a/drivers/char/drm/i915_drv.h b/drivers/char/drm/i915_drv.h
index f8308bfb2613..c10d128e34db 100644
--- a/drivers/char/drm/i915_drv.h
+++ b/drivers/char/drm/i915_drv.h
@@ -134,6 +134,7 @@ typedef struct drm_i915_private {
134 u32 saveVBLANK_A; 134 u32 saveVBLANK_A;
135 u32 saveVSYNC_A; 135 u32 saveVSYNC_A;
136 u32 saveBCLRPAT_A; 136 u32 saveBCLRPAT_A;
137 u32 savePIPEASTAT;
137 u32 saveDSPASTRIDE; 138 u32 saveDSPASTRIDE;
138 u32 saveDSPASIZE; 139 u32 saveDSPASIZE;
139 u32 saveDSPAPOS; 140 u32 saveDSPAPOS;
@@ -154,6 +155,7 @@ typedef struct drm_i915_private {
154 u32 saveVBLANK_B; 155 u32 saveVBLANK_B;
155 u32 saveVSYNC_B; 156 u32 saveVSYNC_B;
156 u32 saveBCLRPAT_B; 157 u32 saveBCLRPAT_B;
158 u32 savePIPEBSTAT;
157 u32 saveDSPBSTRIDE; 159 u32 saveDSPBSTRIDE;
158 u32 saveDSPBSIZE; 160 u32 saveDSPBSIZE;
159 u32 saveDSPBPOS; 161 u32 saveDSPBPOS;
@@ -182,6 +184,12 @@ typedef struct drm_i915_private {
182 u32 saveFBC_LL_BASE; 184 u32 saveFBC_LL_BASE;
183 u32 saveFBC_CONTROL; 185 u32 saveFBC_CONTROL;
184 u32 saveFBC_CONTROL2; 186 u32 saveFBC_CONTROL2;
187 u32 saveIER;
188 u32 saveIIR;
189 u32 saveIMR;
190 u32 saveCACHE_MODE_0;
191 u32 saveDSPCLK_GATE_D;
192 u32 saveMI_ARB_STATE;
185 u32 saveSWF0[16]; 193 u32 saveSWF0[16];
186 u32 saveSWF1[16]; 194 u32 saveSWF1[16];
187 u32 saveSWF2[3]; 195 u32 saveSWF2[3];
@@ -450,6 +458,10 @@ extern int i915_wait_ring(struct drm_device * dev, int n, const char *caller);
450 */ 458 */
451#define DMA_FADD_S 0x20d4 459#define DMA_FADD_S 0x20d4
452 460
461/* Memory Interface Arbitration State
462 */
463#define MI_ARB_STATE 0x20e4
464
453/* Cache mode 0 reg. 465/* Cache mode 0 reg.
454 * - Manipulating render cache behaviour is central 466 * - Manipulating render cache behaviour is central
455 * to the concept of zone rendering, tuning this reg can help avoid 467 * to the concept of zone rendering, tuning this reg can help avoid
@@ -460,6 +472,7 @@ extern int i915_wait_ring(struct drm_device * dev, int n, const char *caller);
460 * bit of interest either set or cleared. EG: (BIT<<16) | BIT to set. 472 * bit of interest either set or cleared. EG: (BIT<<16) | BIT to set.
461 */ 473 */
462#define Cache_Mode_0 0x2120 474#define Cache_Mode_0 0x2120
475#define CACHE_MODE_0 0x2120
463#define CM0_MASK_SHIFT 16 476#define CM0_MASK_SHIFT 16
464#define CM0_IZ_OPT_DISABLE (1<<6) 477#define CM0_IZ_OPT_DISABLE (1<<6)
465#define CM0_ZR_OPT_DISABLE (1<<5) 478#define CM0_ZR_OPT_DISABLE (1<<5)
@@ -655,6 +668,8 @@ extern int i915_wait_ring(struct drm_device * dev, int n, const char *caller);
655/** P1 value is 2 greater than this field */ 668/** P1 value is 2 greater than this field */
656# define VGA0_PD_P1_MASK (0x1f << 0) 669# define VGA0_PD_P1_MASK (0x1f << 0)
657 670
671#define DSPCLK_GATE_D 0x6200
672
658/* I830 CRTC registers */ 673/* I830 CRTC registers */
659#define HTOTAL_A 0x60000 674#define HTOTAL_A 0x60000
660#define HBLANK_A 0x60004 675#define HBLANK_A 0x60004
@@ -1101,6 +1116,8 @@ extern int i915_wait_ring(struct drm_device * dev, int n, const char *caller);
1101#define IS_MOBILE(dev) (IS_I830(dev) || IS_I85X(dev) || IS_I915GM(dev) || \ 1116#define IS_MOBILE(dev) (IS_I830(dev) || IS_I85X(dev) || IS_I915GM(dev) || \
1102 IS_I945GM(dev) || IS_I965GM(dev) || IS_IGD_GM(dev)) 1117 IS_I945GM(dev) || IS_I965GM(dev) || IS_IGD_GM(dev))
1103 1118
1119#define I915_NEED_GFX_HWS(dev) (IS_G33(dev) || IS_IGD_GM(dev))
1120
1104#define PRIMARY_RINGBUFFER_SIZE (128*1024) 1121#define PRIMARY_RINGBUFFER_SIZE (128*1024)
1105 1122
1106#endif 1123#endif
diff --git a/drivers/char/drm/radeon_cp.c b/drivers/char/drm/radeon_cp.c
index 5dc799ab86b8..833abc7e55fb 100644
--- a/drivers/char/drm/radeon_cp.c
+++ b/drivers/char/drm/radeon_cp.c
@@ -825,11 +825,19 @@ static u32 RADEON_READ_MCIND(drm_radeon_private_t *dev_priv, int addr)
825 return ret; 825 return ret;
826} 826}
827 827
828static u32 RS690_READ_MCIND(drm_radeon_private_t *dev_priv, int addr)
829{
830 RADEON_WRITE(RS690_MC_INDEX, (addr & RS690_MC_INDEX_MASK));
831 return RADEON_READ(RS690_MC_DATA);
832}
833
828u32 radeon_read_fb_location(drm_radeon_private_t *dev_priv) 834u32 radeon_read_fb_location(drm_radeon_private_t *dev_priv)
829{ 835{
830 836
831 if ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RV515) 837 if ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RV515)
832 return RADEON_READ_MCIND(dev_priv, RV515_MC_FB_LOCATION); 838 return RADEON_READ_MCIND(dev_priv, RV515_MC_FB_LOCATION);
839 else if ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RS690)
840 return RS690_READ_MCIND(dev_priv, RS690_MC_FB_LOCATION);
833 else if ((dev_priv->flags & RADEON_FAMILY_MASK) > CHIP_RV515) 841 else if ((dev_priv->flags & RADEON_FAMILY_MASK) > CHIP_RV515)
834 return RADEON_READ_MCIND(dev_priv, R520_MC_FB_LOCATION); 842 return RADEON_READ_MCIND(dev_priv, R520_MC_FB_LOCATION);
835 else 843 else
@@ -840,6 +848,8 @@ static void radeon_write_fb_location(drm_radeon_private_t *dev_priv, u32 fb_loc)
840{ 848{
841 if ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RV515) 849 if ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RV515)
842 RADEON_WRITE_MCIND(RV515_MC_FB_LOCATION, fb_loc); 850 RADEON_WRITE_MCIND(RV515_MC_FB_LOCATION, fb_loc);
851 else if ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RS690)
852 RS690_WRITE_MCIND(RS690_MC_FB_LOCATION, fb_loc);
843 else if ((dev_priv->flags & RADEON_FAMILY_MASK) > CHIP_RV515) 853 else if ((dev_priv->flags & RADEON_FAMILY_MASK) > CHIP_RV515)
844 RADEON_WRITE_MCIND(R520_MC_FB_LOCATION, fb_loc); 854 RADEON_WRITE_MCIND(R520_MC_FB_LOCATION, fb_loc);
845 else 855 else
@@ -850,6 +860,8 @@ static void radeon_write_agp_location(drm_radeon_private_t *dev_priv, u32 agp_lo
850{ 860{
851 if ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RV515) 861 if ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RV515)
852 RADEON_WRITE_MCIND(RV515_MC_AGP_LOCATION, agp_loc); 862 RADEON_WRITE_MCIND(RV515_MC_AGP_LOCATION, agp_loc);
863 else if ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RS690)
864 RS690_WRITE_MCIND(RS690_MC_AGP_LOCATION, agp_loc);
853 else if ((dev_priv->flags & RADEON_FAMILY_MASK) > CHIP_RV515) 865 else if ((dev_priv->flags & RADEON_FAMILY_MASK) > CHIP_RV515)
854 RADEON_WRITE_MCIND(R520_MC_AGP_LOCATION, agp_loc); 866 RADEON_WRITE_MCIND(R520_MC_AGP_LOCATION, agp_loc);
855 else 867 else
@@ -1362,6 +1374,70 @@ static void radeon_set_igpgart(drm_radeon_private_t * dev_priv, int on)
1362 } 1374 }
1363} 1375}
1364 1376
1377/* Enable or disable RS690 GART on the chip */
1378static void radeon_set_rs690gart(drm_radeon_private_t *dev_priv, int on)
1379{
1380 u32 temp;
1381
1382 if (on) {
1383 DRM_DEBUG("programming rs690 gart %08X %08lX %08X\n",
1384 dev_priv->gart_vm_start,
1385 (long)dev_priv->gart_info.bus_addr,
1386 dev_priv->gart_size);
1387
1388 temp = RS690_READ_MCIND(dev_priv, RS690_MC_MISC_CNTL);
1389 RS690_WRITE_MCIND(RS690_MC_MISC_CNTL, 0x5000);
1390
1391 RS690_WRITE_MCIND(RS690_MC_AGP_SIZE,
1392 RS690_MC_GART_EN | RS690_MC_AGP_SIZE_32MB);
1393
1394 temp = RS690_READ_MCIND(dev_priv, RS690_MC_GART_FEATURE_ID);
1395 RS690_WRITE_MCIND(RS690_MC_GART_FEATURE_ID, 0x42040800);
1396
1397 RS690_WRITE_MCIND(RS690_MC_GART_BASE,
1398 dev_priv->gart_info.bus_addr);
1399
1400 temp = RS690_READ_MCIND(dev_priv, RS690_MC_AGP_MODE_CONTROL);
1401 RS690_WRITE_MCIND(RS690_MC_AGP_MODE_CONTROL, 0x01400000);
1402
1403 RS690_WRITE_MCIND(RS690_MC_AGP_BASE,
1404 (unsigned int)dev_priv->gart_vm_start);
1405
1406 dev_priv->gart_size = 32*1024*1024;
1407 temp = (((dev_priv->gart_vm_start - 1 + dev_priv->gart_size) &
1408 0xffff0000) | (dev_priv->gart_vm_start >> 16));
1409
1410 RS690_WRITE_MCIND(RS690_MC_AGP_LOCATION, temp);
1411
1412 temp = RS690_READ_MCIND(dev_priv, RS690_MC_AGP_SIZE);
1413 RS690_WRITE_MCIND(RS690_MC_AGP_SIZE,
1414 RS690_MC_GART_EN | RS690_MC_AGP_SIZE_32MB);
1415
1416 do {
1417 temp = RS690_READ_MCIND(dev_priv, RS690_MC_GART_CACHE_CNTL);
1418 if ((temp & RS690_MC_GART_CLEAR_STATUS) ==
1419 RS690_MC_GART_CLEAR_DONE)
1420 break;
1421 DRM_UDELAY(1);
1422 } while (1);
1423
1424 RS690_WRITE_MCIND(RS690_MC_GART_CACHE_CNTL,
1425 RS690_MC_GART_CC_CLEAR);
1426 do {
1427 temp = RS690_READ_MCIND(dev_priv, RS690_MC_GART_CACHE_CNTL);
1428 if ((temp & RS690_MC_GART_CLEAR_STATUS) ==
1429 RS690_MC_GART_CLEAR_DONE)
1430 break;
1431 DRM_UDELAY(1);
1432 } while (1);
1433
1434 RS690_WRITE_MCIND(RS690_MC_GART_CACHE_CNTL,
1435 RS690_MC_GART_CC_NO_CHANGE);
1436 } else {
1437 RS690_WRITE_MCIND(RS690_MC_AGP_SIZE, RS690_MC_GART_DIS);
1438 }
1439}
1440
1365static void radeon_set_pciegart(drm_radeon_private_t * dev_priv, int on) 1441static void radeon_set_pciegart(drm_radeon_private_t * dev_priv, int on)
1366{ 1442{
1367 u32 tmp = RADEON_READ_PCIE(dev_priv, RADEON_PCIE_TX_GART_CNTL); 1443 u32 tmp = RADEON_READ_PCIE(dev_priv, RADEON_PCIE_TX_GART_CNTL);
@@ -1396,6 +1472,11 @@ static void radeon_set_pcigart(drm_radeon_private_t * dev_priv, int on)
1396{ 1472{
1397 u32 tmp; 1473 u32 tmp;
1398 1474
1475 if ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RS690) {
1476 radeon_set_rs690gart(dev_priv, on);
1477 return;
1478 }
1479
1399 if (dev_priv->flags & RADEON_IS_IGPGART) { 1480 if (dev_priv->flags & RADEON_IS_IGPGART) {
1400 radeon_set_igpgart(dev_priv, on); 1481 radeon_set_igpgart(dev_priv, on);
1401 return; 1482 return;
diff --git a/drivers/char/drm/radeon_drv.h b/drivers/char/drm/radeon_drv.h
index 4434332c79bc..173ae620223a 100644
--- a/drivers/char/drm/radeon_drv.h
+++ b/drivers/char/drm/radeon_drv.h
@@ -123,6 +123,7 @@ enum radeon_family {
123 CHIP_R420, 123 CHIP_R420,
124 CHIP_RV410, 124 CHIP_RV410,
125 CHIP_RS400, 125 CHIP_RS400,
126 CHIP_RS690,
126 CHIP_RV515, 127 CHIP_RV515,
127 CHIP_R520, 128 CHIP_R520,
128 CHIP_RV530, 129 CHIP_RV530,
@@ -467,6 +468,36 @@ extern int r300_do_cp_cmdbuf(struct drm_device * dev,
467#define RADEON_IGPGART_ENABLE 0x38 468#define RADEON_IGPGART_ENABLE 0x38
468#define RADEON_IGPGART_UNK_39 0x39 469#define RADEON_IGPGART_UNK_39 0x39
469 470
471#define RS690_MC_INDEX 0x78
472# define RS690_MC_INDEX_MASK 0x1ff
473# define RS690_MC_INDEX_WR_EN (1 << 9)
474# define RS690_MC_INDEX_WR_ACK 0x7f
475#define RS690_MC_DATA 0x7c
476
477#define RS690_MC_MISC_CNTL 0x18
478#define RS690_MC_GART_FEATURE_ID 0x2b
479#define RS690_MC_GART_BASE 0x2c
480#define RS690_MC_GART_CACHE_CNTL 0x2e
481# define RS690_MC_GART_CC_NO_CHANGE 0x0
482# define RS690_MC_GART_CC_CLEAR 0x1
483# define RS690_MC_GART_CLEAR_STATUS (1 << 1)
484# define RS690_MC_GART_CLEAR_DONE (0 << 1)
485# define RS690_MC_GART_CLEAR_PENDING (1 << 1)
486#define RS690_MC_AGP_SIZE 0x38
487# define RS690_MC_GART_DIS 0x0
488# define RS690_MC_GART_EN 0x1
489# define RS690_MC_AGP_SIZE_32MB (0 << 1)
490# define RS690_MC_AGP_SIZE_64MB (1 << 1)
491# define RS690_MC_AGP_SIZE_128MB (2 << 1)
492# define RS690_MC_AGP_SIZE_256MB (3 << 1)
493# define RS690_MC_AGP_SIZE_512MB (4 << 1)
494# define RS690_MC_AGP_SIZE_1GB (5 << 1)
495# define RS690_MC_AGP_SIZE_2GB (6 << 1)
496#define RS690_MC_AGP_MODE_CONTROL 0x39
497#define RS690_MC_FB_LOCATION 0x100
498#define RS690_MC_AGP_LOCATION 0x101
499#define RS690_MC_AGP_BASE 0x102
500
470#define R520_MC_IND_INDEX 0x70 501#define R520_MC_IND_INDEX 0x70
471#define R520_MC_IND_WR_EN (1<<24) 502#define R520_MC_IND_WR_EN (1<<24)
472#define R520_MC_IND_DATA 0x74 503#define R520_MC_IND_DATA 0x74
@@ -1076,6 +1107,13 @@ do { \
1076 RADEON_WRITE(R520_MC_IND_INDEX, 0); \ 1107 RADEON_WRITE(R520_MC_IND_INDEX, 0); \
1077 } while (0) 1108 } while (0)
1078 1109
1110#define RS690_WRITE_MCIND( addr, val ) \
1111do { \
1112 RADEON_WRITE(RS690_MC_INDEX, RS690_MC_INDEX_WR_EN | ((addr) & RS690_MC_INDEX_MASK)); \
1113 RADEON_WRITE(RS690_MC_DATA, val); \
1114 RADEON_WRITE(RS690_MC_INDEX, RS690_MC_INDEX_WR_ACK); \
1115} while (0)
1116
1079#define CP_PACKET0( reg, n ) \ 1117#define CP_PACKET0( reg, n ) \
1080 (RADEON_CP_PACKET0 | ((n) << 16) | ((reg) >> 2)) 1118 (RADEON_CP_PACKET0 | ((n) << 16) | ((reg) >> 2))
1081#define CP_PACKET0_TABLE( reg, n ) \ 1119#define CP_PACKET0_TABLE( reg, n ) \
diff --git a/drivers/infiniband/hw/mthca/mthca_mr.c b/drivers/infiniband/hw/mthca/mthca_mr.c
index 3b6985557cb2..3538da16e3fe 100644
--- a/drivers/infiniband/hw/mthca/mthca_mr.c
+++ b/drivers/infiniband/hw/mthca/mthca_mr.c
@@ -686,7 +686,7 @@ err_out_table:
686 mthca_table_put(dev, dev->mr_table.mpt_table, key); 686 mthca_table_put(dev, dev->mr_table.mpt_table, key);
687 687
688err_out_mpt_free: 688err_out_mpt_free:
689 mthca_free(&dev->mr_table.mpt_alloc, mr->ibmr.lkey); 689 mthca_free(&dev->mr_table.mpt_alloc, key);
690 return err; 690 return err;
691} 691}
692 692
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_cm.c b/drivers/infiniband/ulp/ipoib/ipoib_cm.c
index 7dd2ec473d24..52b1bebfa744 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib_cm.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_cm.c
@@ -824,7 +824,6 @@ void ipoib_cm_dev_stop(struct net_device *dev)
824 struct ipoib_dev_priv *priv = netdev_priv(dev); 824 struct ipoib_dev_priv *priv = netdev_priv(dev);
825 struct ipoib_cm_rx *p; 825 struct ipoib_cm_rx *p;
826 unsigned long begin; 826 unsigned long begin;
827 LIST_HEAD(list);
828 int ret; 827 int ret;
829 828
830 if (!IPOIB_CM_SUPPORTED(dev->dev_addr) || !priv->cm.id) 829 if (!IPOIB_CM_SUPPORTED(dev->dev_addr) || !priv->cm.id)
@@ -857,9 +856,12 @@ void ipoib_cm_dev_stop(struct net_device *dev)
857 /* 856 /*
858 * assume the HW is wedged and just free up everything. 857 * assume the HW is wedged and just free up everything.
859 */ 858 */
860 list_splice_init(&priv->cm.rx_flush_list, &list); 859 list_splice_init(&priv->cm.rx_flush_list,
861 list_splice_init(&priv->cm.rx_error_list, &list); 860 &priv->cm.rx_reap_list);
862 list_splice_init(&priv->cm.rx_drain_list, &list); 861 list_splice_init(&priv->cm.rx_error_list,
862 &priv->cm.rx_reap_list);
863 list_splice_init(&priv->cm.rx_drain_list,
864 &priv->cm.rx_reap_list);
863 break; 865 break;
864 } 866 }
865 spin_unlock_irq(&priv->lock); 867 spin_unlock_irq(&priv->lock);
diff --git a/drivers/md/dm-raid1.c b/drivers/md/dm-raid1.c
index 2928ef228101..51605870f898 100644
--- a/drivers/md/dm-raid1.c
+++ b/drivers/md/dm-raid1.c
@@ -1695,14 +1695,15 @@ static int mirror_end_io(struct dm_target *ti, struct bio *bio,
1695 * information for a retry or there was no other 1695 * information for a retry or there was no other
1696 * mirror in-sync. 1696 * mirror in-sync.
1697 */ 1697 */
1698 DMERR_LIMIT("Mirror read failed from %s.", 1698 DMERR_LIMIT("Mirror read failed.");
1699 m->dev->name);
1700 return -EIO; 1699 return -EIO;
1701 } 1700 }
1701
1702 m = read_record->m;
1703
1702 DMERR("Mirror read failed from %s. Trying alternative device.", 1704 DMERR("Mirror read failed from %s. Trying alternative device.",
1703 m->dev->name); 1705 m->dev->name);
1704 1706
1705 m = read_record->m;
1706 fail_mirror(m, DM_RAID1_READ_ERROR); 1707 fail_mirror(m, DM_RAID1_READ_ERROR);
1707 1708
1708 /* 1709 /*
diff --git a/drivers/net/e1000/e1000_ethtool.c b/drivers/net/e1000/e1000_ethtool.c
index d876787ce336..85e66f4c7886 100644
--- a/drivers/net/e1000/e1000_ethtool.c
+++ b/drivers/net/e1000/e1000_ethtool.c
@@ -50,7 +50,7 @@ struct e1000_stats {
50 int stat_offset; 50 int stat_offset;
51}; 51};
52 52
53#define E1000_STAT(m) sizeof(((struct e1000_adapter *)0)->m), \ 53#define E1000_STAT(m) FIELD_SIZEOF(struct e1000_adapter, m), \
54 offsetof(struct e1000_adapter, m) 54 offsetof(struct e1000_adapter, m)
55static const struct e1000_stats e1000_gstrings_stats[] = { 55static const struct e1000_stats e1000_gstrings_stats[] = {
56 { "rx_packets", E1000_STAT(stats.gprc) }, 56 { "rx_packets", E1000_STAT(stats.gprc) },
diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c
index d4ee8ec34b56..0991648c53dc 100644
--- a/drivers/net/e1000/e1000_main.c
+++ b/drivers/net/e1000/e1000_main.c
@@ -1195,6 +1195,14 @@ e1000_probe(struct pci_dev *pdev,
1195 1195
1196 printk("%s\n", print_mac(mac, netdev->dev_addr)); 1196 printk("%s\n", print_mac(mac, netdev->dev_addr));
1197 1197
1198 if (adapter->hw.bus_type == e1000_bus_type_pci_express) {
1199 DPRINTK(PROBE, WARNING, "This device (id %04x:%04x) will no "
1200 "longer be supported by this driver in the future.\n",
1201 pdev->vendor, pdev->device);
1202 DPRINTK(PROBE, WARNING, "please use the \"e1000e\" "
1203 "driver instead.\n");
1204 }
1205
1198 /* reset the hardware with the new settings */ 1206 /* reset the hardware with the new settings */
1199 e1000_reset(adapter); 1207 e1000_reset(adapter);
1200 1208
diff --git a/drivers/net/e1000e/netdev.c b/drivers/net/e1000e/netdev.c
index f58f017ee47a..3031d6d16247 100644
--- a/drivers/net/e1000e/netdev.c
+++ b/drivers/net/e1000e/netdev.c
@@ -1055,23 +1055,6 @@ static void e1000_release_hw_control(struct e1000_adapter *adapter)
1055 } 1055 }
1056} 1056}
1057 1057
1058static void e1000_release_manageability(struct e1000_adapter *adapter)
1059{
1060 if (adapter->flags & FLAG_MNG_PT_ENABLED) {
1061 struct e1000_hw *hw = &adapter->hw;
1062
1063 u32 manc = er32(MANC);
1064
1065 /* re-enable hardware interception of ARP */
1066 manc |= E1000_MANC_ARP_EN;
1067 manc &= ~E1000_MANC_EN_MNG2HOST;
1068
1069 /* don't explicitly have to mess with MANC2H since
1070 * MANC has an enable disable that gates MANC2H */
1071 ew32(MANC, manc);
1072 }
1073}
1074
1075/** 1058/**
1076 * @e1000_alloc_ring - allocate memory for a ring structure 1059 * @e1000_alloc_ring - allocate memory for a ring structure
1077 **/ 1060 **/
@@ -1561,9 +1544,6 @@ static void e1000_init_manageability(struct e1000_adapter *adapter)
1561 1544
1562 manc = er32(MANC); 1545 manc = er32(MANC);
1563 1546
1564 /* disable hardware interception of ARP */
1565 manc &= ~(E1000_MANC_ARP_EN);
1566
1567 /* enable receiving management packets to the host. this will probably 1547 /* enable receiving management packets to the host. this will probably
1568 * generate destination unreachable messages from the host OS, but 1548 * generate destination unreachable messages from the host OS, but
1569 * the packets will be handled on SMBUS */ 1549 * the packets will be handled on SMBUS */
@@ -1690,6 +1670,9 @@ static void e1000_setup_rctl(struct e1000_adapter *adapter)
1690 else 1670 else
1691 rctl |= E1000_RCTL_LPE; 1671 rctl |= E1000_RCTL_LPE;
1692 1672
1673 /* Enable hardware CRC frame stripping */
1674 rctl |= E1000_RCTL_SECRC;
1675
1693 /* Setup buffer sizes */ 1676 /* Setup buffer sizes */
1694 rctl &= ~E1000_RCTL_SZ_4096; 1677 rctl &= ~E1000_RCTL_SZ_4096;
1695 rctl |= E1000_RCTL_BSEX; 1678 rctl |= E1000_RCTL_BSEX;
@@ -1755,9 +1738,6 @@ static void e1000_setup_rctl(struct e1000_adapter *adapter)
1755 1738
1756 /* Enable Packet split descriptors */ 1739 /* Enable Packet split descriptors */
1757 rctl |= E1000_RCTL_DTYP_PS; 1740 rctl |= E1000_RCTL_DTYP_PS;
1758
1759 /* Enable hardware CRC frame stripping */
1760 rctl |= E1000_RCTL_SECRC;
1761 1741
1762 psrctl |= adapter->rx_ps_bsize0 >> 1742 psrctl |= adapter->rx_ps_bsize0 >>
1763 E1000_PSRCTL_BSIZE0_SHIFT; 1743 E1000_PSRCTL_BSIZE0_SHIFT;
@@ -2008,7 +1988,7 @@ static void e1000_power_down_phy(struct e1000_adapter *adapter)
2008 u16 mii_reg; 1988 u16 mii_reg;
2009 1989
2010 /* WoL is enabled */ 1990 /* WoL is enabled */
2011 if (!adapter->wol) 1991 if (adapter->wol)
2012 return; 1992 return;
2013 1993
2014 /* non-copper PHY? */ 1994 /* non-copper PHY? */
@@ -2140,8 +2120,6 @@ void e1000e_reset(struct e1000_adapter *adapter)
2140 phy_data &= ~IGP02E1000_PM_SPD; 2120 phy_data &= ~IGP02E1000_PM_SPD;
2141 e1e_wphy(hw, IGP02E1000_PHY_POWER_MGMT, phy_data); 2121 e1e_wphy(hw, IGP02E1000_PHY_POWER_MGMT, phy_data);
2142 } 2122 }
2143
2144 e1000_release_manageability(adapter);
2145} 2123}
2146 2124
2147int e1000e_up(struct e1000_adapter *adapter) 2125int e1000e_up(struct e1000_adapter *adapter)
@@ -3487,8 +3465,6 @@ static int e1000_suspend(struct pci_dev *pdev, pm_message_t state)
3487 pci_enable_wake(pdev, PCI_D3cold, 0); 3465 pci_enable_wake(pdev, PCI_D3cold, 0);
3488 } 3466 }
3489 3467
3490 e1000_release_manageability(adapter);
3491
3492 /* make sure adapter isn't asleep if manageability is enabled */ 3468 /* make sure adapter isn't asleep if manageability is enabled */
3493 if (adapter->flags & FLAG_MNG_PT_ENABLED) { 3469 if (adapter->flags & FLAG_MNG_PT_ENABLED) {
3494 pci_enable_wake(pdev, PCI_D3hot, 1); 3470 pci_enable_wake(pdev, PCI_D3hot, 1);
@@ -4054,8 +4030,6 @@ static void __devexit e1000_remove(struct pci_dev *pdev)
4054 4030
4055 flush_scheduled_work(); 4031 flush_scheduled_work();
4056 4032
4057 e1000_release_manageability(adapter);
4058
4059 /* Release control of h/w to f/w. If f/w is AMT enabled, this 4033 /* Release control of h/w to f/w. If f/w is AMT enabled, this
4060 * would have already happened in close and is redundant. */ 4034 * would have already happened in close and is redundant. */
4061 e1000_release_hw_control(adapter); 4035 e1000_release_hw_control(adapter);
diff --git a/drivers/net/gianfar.c b/drivers/net/gianfar.c
index 0431e9ed0fac..4244fc282f21 100644
--- a/drivers/net/gianfar.c
+++ b/drivers/net/gianfar.c
@@ -130,8 +130,8 @@ static void free_skb_resources(struct gfar_private *priv);
130static void gfar_set_multi(struct net_device *dev); 130static void gfar_set_multi(struct net_device *dev);
131static void gfar_set_hash_for_addr(struct net_device *dev, u8 *addr); 131static void gfar_set_hash_for_addr(struct net_device *dev, u8 *addr);
132static void gfar_configure_serdes(struct net_device *dev); 132static void gfar_configure_serdes(struct net_device *dev);
133extern int gfar_local_mdio_write(struct gfar_mii *regs, int mii_id, int regnum, u16 value); 133extern int gfar_local_mdio_write(struct gfar_mii __iomem *regs, int mii_id, int regnum, u16 value);
134extern int gfar_local_mdio_read(struct gfar_mii *regs, int mii_id, int regnum); 134extern int gfar_local_mdio_read(struct gfar_mii __iomem *regs, int mii_id, int regnum);
135#ifdef CONFIG_GFAR_NAPI 135#ifdef CONFIG_GFAR_NAPI
136static int gfar_poll(struct napi_struct *napi, int budget); 136static int gfar_poll(struct napi_struct *napi, int budget);
137#endif 137#endif
diff --git a/drivers/net/gianfar_mii.c b/drivers/net/gianfar_mii.c
index 6a647d95e6ea..24327629bf03 100644
--- a/drivers/net/gianfar_mii.c
+++ b/drivers/net/gianfar_mii.c
@@ -51,7 +51,7 @@
51 * the local mdio pins, which may not be the same as system mdio bus, used for 51 * the local mdio pins, which may not be the same as system mdio bus, used for
52 * controlling the external PHYs, for example. 52 * controlling the external PHYs, for example.
53 */ 53 */
54int gfar_local_mdio_write(struct gfar_mii *regs, int mii_id, 54int gfar_local_mdio_write(struct gfar_mii __iomem *regs, int mii_id,
55 int regnum, u16 value) 55 int regnum, u16 value)
56{ 56{
57 /* Set the PHY address and the register address we want to write */ 57 /* Set the PHY address and the register address we want to write */
@@ -77,7 +77,7 @@ int gfar_local_mdio_write(struct gfar_mii *regs, int mii_id,
77 * and are always tied to the local mdio pins, which may not be the 77 * and are always tied to the local mdio pins, which may not be the
78 * same as system mdio bus, used for controlling the external PHYs, for eg. 78 * same as system mdio bus, used for controlling the external PHYs, for eg.
79 */ 79 */
80int gfar_local_mdio_read(struct gfar_mii *regs, int mii_id, int regnum) 80int gfar_local_mdio_read(struct gfar_mii __iomem *regs, int mii_id, int regnum)
81 81
82{ 82{
83 u16 value; 83 u16 value;
diff --git a/drivers/net/hamradio/mkiss.c b/drivers/net/hamradio/mkiss.c
index cfcd15af501e..30c9b3b0d131 100644
--- a/drivers/net/hamradio/mkiss.c
+++ b/drivers/net/hamradio/mkiss.c
@@ -289,7 +289,6 @@ static void ax_bump(struct mkiss *ax)
289 *ax->rbuff &= ~0x20; 289 *ax->rbuff &= ~0x20;
290 } 290 }
291 } 291 }
292 spin_unlock_bh(&ax->buflock);
293 292
294 count = ax->rcount; 293 count = ax->rcount;
295 294
@@ -297,17 +296,17 @@ static void ax_bump(struct mkiss *ax)
297 printk(KERN_ERR "mkiss: %s: memory squeeze, dropping packet.\n", 296 printk(KERN_ERR "mkiss: %s: memory squeeze, dropping packet.\n",
298 ax->dev->name); 297 ax->dev->name);
299 ax->stats.rx_dropped++; 298 ax->stats.rx_dropped++;
299 spin_unlock_bh(&ax->buflock);
300 return; 300 return;
301 } 301 }
302 302
303 spin_lock_bh(&ax->buflock);
304 memcpy(skb_put(skb,count), ax->rbuff, count); 303 memcpy(skb_put(skb,count), ax->rbuff, count);
305 spin_unlock_bh(&ax->buflock);
306 skb->protocol = ax25_type_trans(skb, ax->dev); 304 skb->protocol = ax25_type_trans(skb, ax->dev);
307 netif_rx(skb); 305 netif_rx(skb);
308 ax->dev->last_rx = jiffies; 306 ax->dev->last_rx = jiffies;
309 ax->stats.rx_packets++; 307 ax->stats.rx_packets++;
310 ax->stats.rx_bytes += count; 308 ax->stats.rx_bytes += count;
309 spin_unlock_bh(&ax->buflock);
311} 310}
312 311
313static void kiss_unesc(struct mkiss *ax, unsigned char s) 312static void kiss_unesc(struct mkiss *ax, unsigned char s)
diff --git a/drivers/net/igb/igb_ethtool.c b/drivers/net/igb/igb_ethtool.c
index f69721e4eaa1..0447f9bcd27a 100644
--- a/drivers/net/igb/igb_ethtool.c
+++ b/drivers/net/igb/igb_ethtool.c
@@ -43,7 +43,7 @@ struct igb_stats {
43 int stat_offset; 43 int stat_offset;
44}; 44};
45 45
46#define IGB_STAT(m) sizeof(((struct igb_adapter *)0)->m), \ 46#define IGB_STAT(m) FIELD_SIZEOF(struct igb_adapter, m), \
47 offsetof(struct igb_adapter, m) 47 offsetof(struct igb_adapter, m)
48static const struct igb_stats igb_gstrings_stats[] = { 48static const struct igb_stats igb_gstrings_stats[] = {
49 { "rx_packets", IGB_STAT(stats.gprc) }, 49 { "rx_packets", IGB_STAT(stats.gprc) },
diff --git a/drivers/net/igb/igb_main.c b/drivers/net/igb/igb_main.c
index d4eb8e2d8720..bff280eff5e3 100644
--- a/drivers/net/igb/igb_main.c
+++ b/drivers/net/igb/igb_main.c
@@ -606,9 +606,6 @@ static void igb_init_manageability(struct igb_adapter *adapter)
606 u32 manc2h = rd32(E1000_MANC2H); 606 u32 manc2h = rd32(E1000_MANC2H);
607 u32 manc = rd32(E1000_MANC); 607 u32 manc = rd32(E1000_MANC);
608 608
609 /* disable hardware interception of ARP */
610 manc &= ~(E1000_MANC_ARP_EN);
611
612 /* enable receiving management packets to the host */ 609 /* enable receiving management packets to the host */
613 /* this will probably generate destination unreachable messages 610 /* this will probably generate destination unreachable messages
614 * from the host OS, but the packets will be handled on SMBUS */ 611 * from the host OS, but the packets will be handled on SMBUS */
@@ -623,25 +620,6 @@ static void igb_init_manageability(struct igb_adapter *adapter)
623 } 620 }
624} 621}
625 622
626static void igb_release_manageability(struct igb_adapter *adapter)
627{
628 struct e1000_hw *hw = &adapter->hw;
629
630 if (adapter->en_mng_pt) {
631 u32 manc = rd32(E1000_MANC);
632
633 /* re-enable hardware interception of ARP */
634 manc |= E1000_MANC_ARP_EN;
635 manc &= ~E1000_MANC_EN_MNG2HOST;
636
637 /* don't explicitly have to mess with MANC2H since
638 * MANC has an enable disable that gates MANC2H */
639
640 /* XXX stop the hardware watchdog ? */
641 wr32(E1000_MANC, manc);
642 }
643}
644
645/** 623/**
646 * igb_configure - configure the hardware for RX and TX 624 * igb_configure - configure the hardware for RX and TX
647 * @adapter: private board structure 625 * @adapter: private board structure
@@ -844,7 +822,6 @@ void igb_reset(struct igb_adapter *adapter)
844 822
845 igb_reset_adaptive(&adapter->hw); 823 igb_reset_adaptive(&adapter->hw);
846 adapter->hw.phy.ops.get_phy_info(&adapter->hw); 824 adapter->hw.phy.ops.get_phy_info(&adapter->hw);
847 igb_release_manageability(adapter);
848} 825}
849 826
850/** 827/**
@@ -1178,9 +1155,6 @@ static void __devexit igb_remove(struct pci_dev *pdev)
1178 1155
1179 flush_scheduled_work(); 1156 flush_scheduled_work();
1180 1157
1181
1182 igb_release_manageability(adapter);
1183
1184 /* Release control of h/w to f/w. If f/w is AMT enabled, this 1158 /* Release control of h/w to f/w. If f/w is AMT enabled, this
1185 * would have already happened in close and is redundant. */ 1159 * would have already happened in close and is redundant. */
1186 igb_release_hw_control(adapter); 1160 igb_release_hw_control(adapter);
@@ -3955,8 +3929,6 @@ static int igb_suspend(struct pci_dev *pdev, pm_message_t state)
3955 pci_enable_wake(pdev, PCI_D3cold, 0); 3929 pci_enable_wake(pdev, PCI_D3cold, 0);
3956 } 3930 }
3957 3931
3958 igb_release_manageability(adapter);
3959
3960 /* make sure adapter isn't asleep if manageability is enabled */ 3932 /* make sure adapter isn't asleep if manageability is enabled */
3961 if (adapter->en_mng_pt) { 3933 if (adapter->en_mng_pt) {
3962 pci_enable_wake(pdev, PCI_D3hot, 1); 3934 pci_enable_wake(pdev, PCI_D3hot, 1);
diff --git a/drivers/net/ixgb/ixgb_ethtool.c b/drivers/net/ixgb/ixgb_ethtool.c
index a267dd862520..53a9fd086f96 100644
--- a/drivers/net/ixgb/ixgb_ethtool.c
+++ b/drivers/net/ixgb/ixgb_ethtool.c
@@ -49,7 +49,7 @@ struct ixgb_stats {
49 int stat_offset; 49 int stat_offset;
50}; 50};
51 51
52#define IXGB_STAT(m) sizeof(((struct ixgb_adapter *)0)->m), \ 52#define IXGB_STAT(m) FIELD_SIZEOF(struct ixgb_adapter, m), \
53 offsetof(struct ixgb_adapter, m) 53 offsetof(struct ixgb_adapter, m)
54static struct ixgb_stats ixgb_gstrings_stats[] = { 54static struct ixgb_stats ixgb_gstrings_stats[] = {
55 {"rx_packets", IXGB_STAT(net_stats.rx_packets)}, 55 {"rx_packets", IXGB_STAT(net_stats.rx_packets)},
diff --git a/drivers/net/ixgbe/ixgbe_main.c b/drivers/net/ixgbe/ixgbe_main.c
index ead49e54f31b..23d0a4afe0e1 100644
--- a/drivers/net/ixgbe/ixgbe_main.c
+++ b/drivers/net/ixgbe/ixgbe_main.c
@@ -220,7 +220,6 @@ static bool ixgbe_clean_tx_irq(struct ixgbe_adapter *adapter,
220 tx_ring->stats.bytes += tx_buffer_info->length; 220 tx_ring->stats.bytes += tx_buffer_info->length;
221 if (cleaned) { 221 if (cleaned) {
222 struct sk_buff *skb = tx_buffer_info->skb; 222 struct sk_buff *skb = tx_buffer_info->skb;
223#ifdef NETIF_F_TSO
224 unsigned int segs, bytecount; 223 unsigned int segs, bytecount;
225 segs = skb_shinfo(skb)->gso_segs ?: 1; 224 segs = skb_shinfo(skb)->gso_segs ?: 1;
226 /* multiply data chunks by size of headers */ 225 /* multiply data chunks by size of headers */
@@ -228,10 +227,6 @@ static bool ixgbe_clean_tx_irq(struct ixgbe_adapter *adapter,
228 skb->len; 227 skb->len;
229 total_tx_packets += segs; 228 total_tx_packets += segs;
230 total_tx_bytes += bytecount; 229 total_tx_bytes += bytecount;
231#else
232 total_tx_packets++;
233 total_tx_bytes += skb->len;
234#endif
235 } 230 }
236 ixgbe_unmap_and_free_tx_resource(adapter, 231 ixgbe_unmap_and_free_tx_resource(adapter,
237 tx_buffer_info); 232 tx_buffer_info);
@@ -1942,6 +1937,10 @@ static int ixgbe_open(struct net_device *netdev)
1942 int err; 1937 int err;
1943 u32 num_rx_queues = adapter->num_rx_queues; 1938 u32 num_rx_queues = adapter->num_rx_queues;
1944 1939
1940 /* disallow open during test */
1941 if (test_bit(__IXGBE_TESTING, &adapter->state))
1942 return -EBUSY;
1943
1945try_intr_reinit: 1944try_intr_reinit:
1946 /* allocate transmit descriptors */ 1945 /* allocate transmit descriptors */
1947 err = ixgbe_setup_all_tx_resources(adapter); 1946 err = ixgbe_setup_all_tx_resources(adapter);
@@ -2278,11 +2277,29 @@ static bool ixgbe_tx_csum(struct ixgbe_adapter *adapter,
2278 IXGBE_ADVTXD_DTYP_CTXT); 2277 IXGBE_ADVTXD_DTYP_CTXT);
2279 2278
2280 if (skb->ip_summed == CHECKSUM_PARTIAL) { 2279 if (skb->ip_summed == CHECKSUM_PARTIAL) {
2281 if (skb->protocol == htons(ETH_P_IP)) 2280 switch (skb->protocol) {
2281 case __constant_htons(ETH_P_IP):
2282 type_tucmd_mlhl |= IXGBE_ADVTXD_TUCMD_IPV4; 2282 type_tucmd_mlhl |= IXGBE_ADVTXD_TUCMD_IPV4;
2283 if (ip_hdr(skb)->protocol == IPPROTO_TCP)
2284 type_tucmd_mlhl |=
2285 IXGBE_ADVTXD_TUCMD_L4T_TCP;
2286 break;
2287
2288 case __constant_htons(ETH_P_IPV6):
2289 /* XXX what about other V6 headers?? */
2290 if (ipv6_hdr(skb)->nexthdr == IPPROTO_TCP)
2291 type_tucmd_mlhl |=
2292 IXGBE_ADVTXD_TUCMD_L4T_TCP;
2293 break;
2283 2294
2284 if (skb->sk->sk_protocol == IPPROTO_TCP) 2295 default:
2285 type_tucmd_mlhl |= IXGBE_ADVTXD_TUCMD_L4T_TCP; 2296 if (unlikely(net_ratelimit())) {
2297 DPRINTK(PROBE, WARNING,
2298 "partial checksum but proto=%x!\n",
2299 skb->protocol);
2300 }
2301 break;
2302 }
2286 } 2303 }
2287 2304
2288 context_desc->type_tucmd_mlhl = cpu_to_le32(type_tucmd_mlhl); 2305 context_desc->type_tucmd_mlhl = cpu_to_le32(type_tucmd_mlhl);
@@ -2778,6 +2795,14 @@ static int __devinit ixgbe_probe(struct pci_dev *pdev,
2778 hw->mac.type, hw->phy.type, 2795 hw->mac.type, hw->phy.type,
2779 (part_num >> 8), (part_num & 0xff)); 2796 (part_num >> 8), (part_num & 0xff));
2780 2797
2798 if (link_width <= IXGBE_PCI_LINK_WIDTH_4) {
2799 dev_warn(&pdev->dev, "PCI-Express bandwidth available for "
2800 "this card is not sufficient for optimal "
2801 "performance.\n");
2802 dev_warn(&pdev->dev, "For optimal performance a x8 "
2803 "PCI-Express slot is required.\n");
2804 }
2805
2781 /* reset the hardware with the new settings */ 2806 /* reset the hardware with the new settings */
2782 ixgbe_start_hw(hw); 2807 ixgbe_start_hw(hw);
2783 2808
diff --git a/drivers/net/niu.c b/drivers/net/niu.c
index 2fe14b0c5c67..e98ce1e4965b 100644
--- a/drivers/net/niu.c
+++ b/drivers/net/niu.c
@@ -33,8 +33,8 @@
33 33
34#define DRV_MODULE_NAME "niu" 34#define DRV_MODULE_NAME "niu"
35#define PFX DRV_MODULE_NAME ": " 35#define PFX DRV_MODULE_NAME ": "
36#define DRV_MODULE_VERSION "0.6" 36#define DRV_MODULE_VERSION "0.7"
37#define DRV_MODULE_RELDATE "January 5, 2008" 37#define DRV_MODULE_RELDATE "February 18, 2008"
38 38
39static char version[] __devinitdata = 39static char version[] __devinitdata =
40 DRV_MODULE_NAME ".c:v" DRV_MODULE_VERSION " (" DRV_MODULE_RELDATE ")\n"; 40 DRV_MODULE_NAME ".c:v" DRV_MODULE_VERSION " (" DRV_MODULE_RELDATE ")\n";
@@ -5147,7 +5147,12 @@ static void niu_set_rx_mode(struct net_device *dev)
5147 index++; 5147 index++;
5148 } 5148 }
5149 } else { 5149 } else {
5150 for (i = 0; i < niu_num_alt_addr(np); i++) { 5150 int alt_start;
5151 if (np->flags & NIU_FLAGS_XMAC)
5152 alt_start = 0;
5153 else
5154 alt_start = 1;
5155 for (i = alt_start; i < niu_num_alt_addr(np); i++) {
5151 err = niu_enable_alt_mac(np, i, 0); 5156 err = niu_enable_alt_mac(np, i, 0);
5152 if (err) 5157 if (err)
5153 printk(KERN_WARNING PFX "%s: Error %d " 5158 printk(KERN_WARNING PFX "%s: Error %d "
diff --git a/drivers/net/pcmcia/smc91c92_cs.c b/drivers/net/pcmcia/smc91c92_cs.c
index f18eca9831e8..250eb1954c34 100644
--- a/drivers/net/pcmcia/smc91c92_cs.c
+++ b/drivers/net/pcmcia/smc91c92_cs.c
@@ -559,8 +559,16 @@ static int mhz_setup(struct pcmcia_device *link)
559 559
560 /* Read the station address from the CIS. It is stored as the last 560 /* Read the station address from the CIS. It is stored as the last
561 (fourth) string in the Version 1 Version/ID tuple. */ 561 (fourth) string in the Version 1 Version/ID tuple. */
562 if (link->prod_id[3]) { 562 tuple->DesiredTuple = CISTPL_VERS_1;
563 station_addr = link->prod_id[3]; 563 if (first_tuple(link, tuple, parse) != CS_SUCCESS) {
564 rc = -1;
565 goto free_cfg_mem;
566 }
567 /* Ugh -- the EM1144 card has two VERS_1 tuples!?! */
568 if (next_tuple(link, tuple, parse) != CS_SUCCESS)
569 first_tuple(link, tuple, parse);
570 if (parse->version_1.ns > 3) {
571 station_addr = parse->version_1.str + parse->version_1.ofs[3];
564 if (cvt_ascii_address(dev, station_addr) == 0) { 572 if (cvt_ascii_address(dev, station_addr) == 0) {
565 rc = 0; 573 rc = 0;
566 goto free_cfg_mem; 574 goto free_cfg_mem;
diff --git a/drivers/net/tsi108_eth.c b/drivers/net/tsi108_eth.c
index 35d15e850075..6f33f84d37b0 100644
--- a/drivers/net/tsi108_eth.c
+++ b/drivers/net/tsi108_eth.c
@@ -36,6 +36,7 @@
36#include <linux/net.h> 36#include <linux/net.h>
37#include <linux/netdevice.h> 37#include <linux/netdevice.h>
38#include <linux/etherdevice.h> 38#include <linux/etherdevice.h>
39#include <linux/ethtool.h>
39#include <linux/skbuff.h> 40#include <linux/skbuff.h>
40#include <linux/slab.h> 41#include <linux/slab.h>
41#include <linux/spinlock.h> 42#include <linux/spinlock.h>
@@ -297,18 +298,11 @@ static void tsi108_check_phy(struct net_device *dev)
297 u32 speed; 298 u32 speed;
298 unsigned long flags; 299 unsigned long flags;
299 300
300 /* Do a dummy read, as for some reason the first read
301 * after a link becomes up returns link down, even if
302 * it's been a while since the link came up.
303 */
304
305 spin_lock_irqsave(&phy_lock, flags); 301 spin_lock_irqsave(&phy_lock, flags);
306 302
307 if (!data->phy_ok) 303 if (!data->phy_ok)
308 goto out; 304 goto out;
309 305
310 tsi108_read_mii(data, MII_BMSR);
311
312 duplex = mii_check_media(&data->mii_if, netif_msg_link(data), data->init_media); 306 duplex = mii_check_media(&data->mii_if, netif_msg_link(data), data->init_media);
313 data->init_media = 0; 307 data->init_media = 0;
314 308
@@ -345,22 +339,21 @@ static void tsi108_check_phy(struct net_device *dev)
345 339
346 TSI_WRITE(TSI108_MAC_CFG2, mac_cfg2_reg); 340 TSI_WRITE(TSI108_MAC_CFG2, mac_cfg2_reg);
347 TSI_WRITE(TSI108_EC_PORTCTRL, portctrl_reg); 341 TSI_WRITE(TSI108_EC_PORTCTRL, portctrl_reg);
342 }
348 343
349 if (data->link_up == 0) { 344 if (data->link_up == 0) {
350 /* The manual says it can take 3-4 usecs for the speed change 345 /* The manual says it can take 3-4 usecs for the speed change
351 * to take effect. 346 * to take effect.
352 */ 347 */
353 udelay(5); 348 udelay(5);
354 349
355 spin_lock(&data->txlock); 350 spin_lock(&data->txlock);
356 if (is_valid_ether_addr(dev->dev_addr) && data->txfree) 351 if (is_valid_ether_addr(dev->dev_addr) && data->txfree)
357 netif_wake_queue(dev); 352 netif_wake_queue(dev);
358 353
359 data->link_up = 1; 354 data->link_up = 1;
360 spin_unlock(&data->txlock); 355 spin_unlock(&data->txlock);
361 }
362 } 356 }
363
364 } else { 357 } else {
365 if (data->link_up == 1) { 358 if (data->link_up == 1) {
366 netif_stop_queue(dev); 359 netif_stop_queue(dev);
@@ -1274,12 +1267,11 @@ static void tsi108_init_phy(struct net_device *dev)
1274 * PHY_STAT register before the link up status bit is set. 1267 * PHY_STAT register before the link up status bit is set.
1275 */ 1268 */
1276 1269
1277 data->link_up = 1; 1270 data->link_up = 0;
1278 1271
1279 while (!((phyval = tsi108_read_mii(data, MII_BMSR)) & 1272 while (!((phyval = tsi108_read_mii(data, MII_BMSR)) &
1280 BMSR_LSTATUS)) { 1273 BMSR_LSTATUS)) {
1281 if (i++ > (MII_READ_DELAY / 10)) { 1274 if (i++ > (MII_READ_DELAY / 10)) {
1282 data->link_up = 0;
1283 break; 1275 break;
1284 } 1276 }
1285 spin_unlock_irqrestore(&phy_lock, flags); 1277 spin_unlock_irqrestore(&phy_lock, flags);
@@ -1287,6 +1279,7 @@ static void tsi108_init_phy(struct net_device *dev)
1287 spin_lock_irqsave(&phy_lock, flags); 1279 spin_lock_irqsave(&phy_lock, flags);
1288 } 1280 }
1289 1281
1282 data->mii_if.supports_gmii = mii_check_gmii_support(&data->mii_if);
1290 printk(KERN_DEBUG "PHY_STAT reg contains %08x\n", phyval); 1283 printk(KERN_DEBUG "PHY_STAT reg contains %08x\n", phyval);
1291 data->phy_ok = 1; 1284 data->phy_ok = 1;
1292 data->init_media = 1; 1285 data->init_media = 1;
@@ -1527,12 +1520,46 @@ static void tsi108_init_mac(struct net_device *dev)
1527 TSI_WRITE(TSI108_EC_INTMASK, ~0); 1520 TSI_WRITE(TSI108_EC_INTMASK, ~0);
1528} 1521}
1529 1522
1523static int tsi108_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
1524{
1525 struct tsi108_prv_data *data = netdev_priv(dev);
1526 unsigned long flags;
1527 int rc;
1528
1529 spin_lock_irqsave(&data->txlock, flags);
1530 rc = mii_ethtool_gset(&data->mii_if, cmd);
1531 spin_unlock_irqrestore(&data->txlock, flags);
1532
1533 return rc;
1534}
1535
1536static int tsi108_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
1537{
1538 struct tsi108_prv_data *data = netdev_priv(dev);
1539 unsigned long flags;
1540 int rc;
1541
1542 spin_lock_irqsave(&data->txlock, flags);
1543 rc = mii_ethtool_sset(&data->mii_if, cmd);
1544 spin_unlock_irqrestore(&data->txlock, flags);
1545
1546 return rc;
1547}
1548
1530static int tsi108_do_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) 1549static int tsi108_do_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
1531{ 1550{
1532 struct tsi108_prv_data *data = netdev_priv(dev); 1551 struct tsi108_prv_data *data = netdev_priv(dev);
1552 if (!netif_running(dev))
1553 return -EINVAL;
1533 return generic_mii_ioctl(&data->mii_if, if_mii(rq), cmd, NULL); 1554 return generic_mii_ioctl(&data->mii_if, if_mii(rq), cmd, NULL);
1534} 1555}
1535 1556
1557static const struct ethtool_ops tsi108_ethtool_ops = {
1558 .get_link = ethtool_op_get_link,
1559 .get_settings = tsi108_get_settings,
1560 .set_settings = tsi108_set_settings,
1561};
1562
1536static int 1563static int
1537tsi108_init_one(struct platform_device *pdev) 1564tsi108_init_one(struct platform_device *pdev)
1538{ 1565{
@@ -1584,7 +1611,6 @@ tsi108_init_one(struct platform_device *pdev)
1584 data->mii_if.phy_id = einfo->phy; 1611 data->mii_if.phy_id = einfo->phy;
1585 data->mii_if.phy_id_mask = 0x1f; 1612 data->mii_if.phy_id_mask = 0x1f;
1586 data->mii_if.reg_num_mask = 0x1f; 1613 data->mii_if.reg_num_mask = 0x1f;
1587 data->mii_if.supports_gmii = mii_check_gmii_support(&data->mii_if);
1588 1614
1589 data->phy = einfo->phy; 1615 data->phy = einfo->phy;
1590 data->phy_type = einfo->phy_type; 1616 data->phy_type = einfo->phy_type;
@@ -1598,6 +1624,7 @@ tsi108_init_one(struct platform_device *pdev)
1598 dev->get_stats = tsi108_get_stats; 1624 dev->get_stats = tsi108_get_stats;
1599 netif_napi_add(dev, &data->napi, tsi108_poll, 64); 1625 netif_napi_add(dev, &data->napi, tsi108_poll, 64);
1600 dev->do_ioctl = tsi108_do_ioctl; 1626 dev->do_ioctl = tsi108_do_ioctl;
1627 dev->ethtool_ops = &tsi108_ethtool_ops;
1601 1628
1602 /* Apparently, the Linux networking code won't use scatter-gather 1629 /* Apparently, the Linux networking code won't use scatter-gather
1603 * if the hardware doesn't do checksums. However, it's faster 1630 * if the hardware doesn't do checksums. However, it's faster
@@ -1629,6 +1656,7 @@ tsi108_init_one(struct platform_device *pdev)
1629 goto register_fail; 1656 goto register_fail;
1630 } 1657 }
1631 1658
1659 platform_set_drvdata(pdev, dev);
1632 printk(KERN_INFO "%s: Tsi108 Gigabit Ethernet, MAC: %s\n", 1660 printk(KERN_INFO "%s: Tsi108 Gigabit Ethernet, MAC: %s\n",
1633 dev->name, print_mac(mac, dev->dev_addr)); 1661 dev->name, print_mac(mac, dev->dev_addr));
1634#ifdef DEBUG 1662#ifdef DEBUG
diff --git a/drivers/net/wireless/ath5k/base.c b/drivers/net/wireless/ath5k/base.c
index ddc87149fe31..dfdaec020739 100644
--- a/drivers/net/wireless/ath5k/base.c
+++ b/drivers/net/wireless/ath5k/base.c
@@ -1256,7 +1256,7 @@ ath5k_txbuf_setup(struct ath5k_softc *sc, struct ath5k_buf *bf,
1256 if (ctl->flags & IEEE80211_TXCTL_NO_ACK) 1256 if (ctl->flags & IEEE80211_TXCTL_NO_ACK)
1257 flags |= AR5K_TXDESC_NOACK; 1257 flags |= AR5K_TXDESC_NOACK;
1258 1258
1259 pktlen = skb->len + FCS_LEN; 1259 pktlen = skb->len;
1260 1260
1261 if (!(ctl->flags & IEEE80211_TXCTL_DO_NOT_ENCRYPT)) { 1261 if (!(ctl->flags & IEEE80211_TXCTL_DO_NOT_ENCRYPT)) {
1262 keyidx = ctl->key_idx; 1262 keyidx = ctl->key_idx;
@@ -1952,7 +1952,7 @@ ath5k_beacon_setup(struct ath5k_softc *sc, struct ath5k_buf *bf,
1952 } 1952 }
1953 1953
1954 ds->ds_data = bf->skbaddr; 1954 ds->ds_data = bf->skbaddr;
1955 ret = ah->ah_setup_tx_desc(ah, ds, skb->len + FCS_LEN, 1955 ret = ah->ah_setup_tx_desc(ah, ds, skb->len,
1956 ieee80211_get_hdrlen_from_skb(skb), 1956 ieee80211_get_hdrlen_from_skb(skb),
1957 AR5K_PKT_TYPE_BEACON, (ctl->power_level * 2), ctl->tx_rate, 1, 1957 AR5K_PKT_TYPE_BEACON, (ctl->power_level * 2), ctl->tx_rate, 1,
1958 AR5K_TXKEYIX_INVALID, antenna, flags, 0, 0); 1958 AR5K_TXKEYIX_INVALID, antenna, flags, 0, 0);
diff --git a/drivers/net/wireless/ath5k/hw.c b/drivers/net/wireless/ath5k/hw.c
index 3a4bf4035a23..1ab57aa6e4dc 100644
--- a/drivers/net/wireless/ath5k/hw.c
+++ b/drivers/net/wireless/ath5k/hw.c
@@ -3506,7 +3506,7 @@ ath5k_hw_setup_2word_tx_desc(struct ath5k_hw *ah, struct ath5k_desc *desc,
3506{ 3506{
3507 u32 frame_type; 3507 u32 frame_type;
3508 struct ath5k_hw_2w_tx_desc *tx_desc; 3508 struct ath5k_hw_2w_tx_desc *tx_desc;
3509 unsigned int buff_len; 3509 unsigned int frame_len;
3510 3510
3511 tx_desc = (struct ath5k_hw_2w_tx_desc *)&desc->ds_ctl0; 3511 tx_desc = (struct ath5k_hw_2w_tx_desc *)&desc->ds_ctl0;
3512 3512
@@ -3537,22 +3537,25 @@ ath5k_hw_setup_2word_tx_desc(struct ath5k_hw *ah, struct ath5k_desc *desc,
3537 /* Setup control descriptor */ 3537 /* Setup control descriptor */
3538 3538
3539 /* Verify and set frame length */ 3539 /* Verify and set frame length */
3540 if (pkt_len & ~AR5K_2W_TX_DESC_CTL0_FRAME_LEN) 3540
3541 /* remove padding we might have added before */
3542 frame_len = pkt_len - (hdr_len & 3) + FCS_LEN;
3543
3544 if (frame_len & ~AR5K_2W_TX_DESC_CTL0_FRAME_LEN)
3541 return -EINVAL; 3545 return -EINVAL;
3542 3546
3543 tx_desc->tx_control_0 = pkt_len & AR5K_2W_TX_DESC_CTL0_FRAME_LEN; 3547 tx_desc->tx_control_0 = frame_len & AR5K_2W_TX_DESC_CTL0_FRAME_LEN;
3544 3548
3545 /* Verify and set buffer length */ 3549 /* Verify and set buffer length */
3546 buff_len = pkt_len - FCS_LEN;
3547 3550
3548 /* NB: beacon's BufLen must be a multiple of 4 bytes */ 3551 /* NB: beacon's BufLen must be a multiple of 4 bytes */
3549 if(type == AR5K_PKT_TYPE_BEACON) 3552 if(type == AR5K_PKT_TYPE_BEACON)
3550 buff_len = roundup(buff_len, 4); 3553 pkt_len = roundup(pkt_len, 4);
3551 3554
3552 if (buff_len & ~AR5K_2W_TX_DESC_CTL1_BUF_LEN) 3555 if (pkt_len & ~AR5K_2W_TX_DESC_CTL1_BUF_LEN)
3553 return -EINVAL; 3556 return -EINVAL;
3554 3557
3555 tx_desc->tx_control_1 = buff_len & AR5K_2W_TX_DESC_CTL1_BUF_LEN; 3558 tx_desc->tx_control_1 = pkt_len & AR5K_2W_TX_DESC_CTL1_BUF_LEN;
3556 3559
3557 /* 3560 /*
3558 * Verify and set header length 3561 * Verify and set header length
@@ -3634,7 +3637,7 @@ static int ath5k_hw_setup_4word_tx_desc(struct ath5k_hw *ah,
3634{ 3637{
3635 struct ath5k_hw_4w_tx_desc *tx_desc; 3638 struct ath5k_hw_4w_tx_desc *tx_desc;
3636 struct ath5k_hw_tx_status *tx_status; 3639 struct ath5k_hw_tx_status *tx_status;
3637 unsigned int buff_len; 3640 unsigned int frame_len;
3638 3641
3639 ATH5K_TRACE(ah->ah_sc); 3642 ATH5K_TRACE(ah->ah_sc);
3640 tx_desc = (struct ath5k_hw_4w_tx_desc *)&desc->ds_ctl0; 3643 tx_desc = (struct ath5k_hw_4w_tx_desc *)&desc->ds_ctl0;
@@ -3669,22 +3672,25 @@ static int ath5k_hw_setup_4word_tx_desc(struct ath5k_hw *ah,
3669 /* Setup control descriptor */ 3672 /* Setup control descriptor */
3670 3673
3671 /* Verify and set frame length */ 3674 /* Verify and set frame length */
3672 if (pkt_len & ~AR5K_4W_TX_DESC_CTL0_FRAME_LEN) 3675
3676 /* remove padding we might have added before */
3677 frame_len = pkt_len - (hdr_len & 3) + FCS_LEN;
3678
3679 if (frame_len & ~AR5K_4W_TX_DESC_CTL0_FRAME_LEN)
3673 return -EINVAL; 3680 return -EINVAL;
3674 3681
3675 tx_desc->tx_control_0 = pkt_len & AR5K_4W_TX_DESC_CTL0_FRAME_LEN; 3682 tx_desc->tx_control_0 = frame_len & AR5K_4W_TX_DESC_CTL0_FRAME_LEN;
3676 3683
3677 /* Verify and set buffer length */ 3684 /* Verify and set buffer length */
3678 buff_len = pkt_len - FCS_LEN;
3679 3685
3680 /* NB: beacon's BufLen must be a multiple of 4 bytes */ 3686 /* NB: beacon's BufLen must be a multiple of 4 bytes */
3681 if(type == AR5K_PKT_TYPE_BEACON) 3687 if(type == AR5K_PKT_TYPE_BEACON)
3682 buff_len = roundup(buff_len, 4); 3688 pkt_len = roundup(pkt_len, 4);
3683 3689
3684 if (buff_len & ~AR5K_4W_TX_DESC_CTL1_BUF_LEN) 3690 if (pkt_len & ~AR5K_4W_TX_DESC_CTL1_BUF_LEN)
3685 return -EINVAL; 3691 return -EINVAL;
3686 3692
3687 tx_desc->tx_control_1 = buff_len & AR5K_4W_TX_DESC_CTL1_BUF_LEN; 3693 tx_desc->tx_control_1 = pkt_len & AR5K_4W_TX_DESC_CTL1_BUF_LEN;
3688 3694
3689 tx_desc->tx_control_0 |= 3695 tx_desc->tx_control_0 |=
3690 AR5K_REG_SM(tx_power, AR5K_4W_TX_DESC_CTL0_XMIT_POWER) | 3696 AR5K_REG_SM(tx_power, AR5K_4W_TX_DESC_CTL0_XMIT_POWER) |
diff --git a/drivers/net/wireless/b43/b43.h b/drivers/net/wireless/b43/b43.h
index 08a011f0834a..f13346ba9dd2 100644
--- a/drivers/net/wireless/b43/b43.h
+++ b/drivers/net/wireless/b43/b43.h
@@ -14,6 +14,12 @@
14#include "lo.h" 14#include "lo.h"
15#include "phy.h" 15#include "phy.h"
16 16
17
18/* The unique identifier of the firmware that's officially supported by
19 * this driver version. */
20#define B43_SUPPORTED_FIRMWARE_ID "FW13"
21
22
17#ifdef CONFIG_B43_DEBUG 23#ifdef CONFIG_B43_DEBUG
18# define B43_DEBUG 1 24# define B43_DEBUG 1
19#else 25#else
diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c
index ef65c41af00f..51dfce16178a 100644
--- a/drivers/net/wireless/b43/main.c
+++ b/drivers/net/wireless/b43/main.c
@@ -58,6 +58,8 @@ MODULE_AUTHOR("Stefano Brivio");
58MODULE_AUTHOR("Michael Buesch"); 58MODULE_AUTHOR("Michael Buesch");
59MODULE_LICENSE("GPL"); 59MODULE_LICENSE("GPL");
60 60
61MODULE_FIRMWARE(B43_SUPPORTED_FIRMWARE_ID);
62
61 63
62static int modparam_bad_frames_preempt; 64static int modparam_bad_frames_preempt;
63module_param_named(bad_frames_preempt, modparam_bad_frames_preempt, int, 0444); 65module_param_named(bad_frames_preempt, modparam_bad_frames_preempt, int, 0444);
@@ -1859,11 +1861,11 @@ static int b43_upload_microcode(struct b43_wldev *dev)
1859 err = -EOPNOTSUPP; 1861 err = -EOPNOTSUPP;
1860 goto error; 1862 goto error;
1861 } 1863 }
1862 b43dbg(dev->wl, "Loading firmware version %u.%u " 1864 b43info(dev->wl, "Loading firmware version %u.%u "
1863 "(20%.2i-%.2i-%.2i %.2i:%.2i:%.2i)\n", 1865 "(20%.2i-%.2i-%.2i %.2i:%.2i:%.2i)\n",
1864 fwrev, fwpatch, 1866 fwrev, fwpatch,
1865 (fwdate >> 12) & 0xF, (fwdate >> 8) & 0xF, fwdate & 0xFF, 1867 (fwdate >> 12) & 0xF, (fwdate >> 8) & 0xF, fwdate & 0xFF,
1866 (fwtime >> 11) & 0x1F, (fwtime >> 5) & 0x3F, fwtime & 0x1F); 1868 (fwtime >> 11) & 0x1F, (fwtime >> 5) & 0x3F, fwtime & 0x1F);
1867 1869
1868 dev->fw.rev = fwrev; 1870 dev->fw.rev = fwrev;
1869 dev->fw.patch = fwpatch; 1871 dev->fw.patch = fwpatch;
@@ -4200,6 +4202,33 @@ static struct ssb_driver b43_ssb_driver = {
4200 .resume = b43_resume, 4202 .resume = b43_resume,
4201}; 4203};
4202 4204
4205static void b43_print_driverinfo(void)
4206{
4207 const char *feat_pci = "", *feat_pcmcia = "", *feat_nphy = "",
4208 *feat_leds = "", *feat_rfkill = "";
4209
4210#ifdef CONFIG_B43_PCI_AUTOSELECT
4211 feat_pci = "P";
4212#endif
4213#ifdef CONFIG_B43_PCMCIA
4214 feat_pcmcia = "M";
4215#endif
4216#ifdef CONFIG_B43_NPHY
4217 feat_nphy = "N";
4218#endif
4219#ifdef CONFIG_B43_LEDS
4220 feat_leds = "L";
4221#endif
4222#ifdef CONFIG_B43_RFKILL
4223 feat_rfkill = "R";
4224#endif
4225 printk(KERN_INFO "Broadcom 43xx driver loaded "
4226 "[ Features: %s%s%s%s%s, Firmware-ID: "
4227 B43_SUPPORTED_FIRMWARE_ID " ]\n",
4228 feat_pci, feat_pcmcia, feat_nphy,
4229 feat_leds, feat_rfkill);
4230}
4231
4203static int __init b43_init(void) 4232static int __init b43_init(void)
4204{ 4233{
4205 int err; 4234 int err;
@@ -4211,6 +4240,7 @@ static int __init b43_init(void)
4211 err = ssb_driver_register(&b43_ssb_driver); 4240 err = ssb_driver_register(&b43_ssb_driver);
4212 if (err) 4241 if (err)
4213 goto err_pcmcia_exit; 4242 goto err_pcmcia_exit;
4243 b43_print_driverinfo();
4214 4244
4215 return err; 4245 return err;
4216 4246
diff --git a/drivers/net/wireless/b43legacy/b43legacy.h b/drivers/net/wireless/b43legacy/b43legacy.h
index c80edd2b9044..93d45b71799a 100644
--- a/drivers/net/wireless/b43legacy/b43legacy.h
+++ b/drivers/net/wireless/b43legacy/b43legacy.h
@@ -23,6 +23,10 @@
23#include "phy.h" 23#include "phy.h"
24 24
25 25
26/* The unique identifier of the firmware that's officially supported by this
27 * driver version. */
28#define B43legacy_SUPPORTED_FIRMWARE_ID "FW10"
29
26#define B43legacy_IRQWAIT_MAX_RETRIES 20 30#define B43legacy_IRQWAIT_MAX_RETRIES 20
27 31
28#define B43legacy_RX_MAX_SSI 60 /* best guess at max ssi */ 32#define B43legacy_RX_MAX_SSI 60 /* best guess at max ssi */
diff --git a/drivers/net/wireless/b43legacy/dma.c b/drivers/net/wireless/b43legacy/dma.c
index 6e08405e8026..e87b427d5e43 100644
--- a/drivers/net/wireless/b43legacy/dma.c
+++ b/drivers/net/wireless/b43legacy/dma.c
@@ -354,7 +354,8 @@ return 0;
354} 354}
355 355
356 356
357u16 b43legacy_dmacontroller_base(int dma64bit, int controller_idx) 357static u16 b43legacy_dmacontroller_base(enum b43legacy_dmatype type,
358 int controller_idx)
358{ 359{
359 static const u16 map64[] = { 360 static const u16 map64[] = {
360 B43legacy_MMIO_DMA64_BASE0, 361 B43legacy_MMIO_DMA64_BASE0,
@@ -373,7 +374,7 @@ u16 b43legacy_dmacontroller_base(int dma64bit, int controller_idx)
373 B43legacy_MMIO_DMA32_BASE5, 374 B43legacy_MMIO_DMA32_BASE5,
374 }; 375 };
375 376
376 if (dma64bit) { 377 if (type == B43legacy_DMA_64BIT) {
377 B43legacy_WARN_ON(!(controller_idx >= 0 && 378 B43legacy_WARN_ON(!(controller_idx >= 0 &&
378 controller_idx < ARRAY_SIZE(map64))); 379 controller_idx < ARRAY_SIZE(map64)));
379 return map64[controller_idx]; 380 return map64[controller_idx];
@@ -480,8 +481,9 @@ static void free_ringmemory(struct b43legacy_dmaring *ring)
480} 481}
481 482
482/* Reset the RX DMA channel */ 483/* Reset the RX DMA channel */
483int b43legacy_dmacontroller_rx_reset(struct b43legacy_wldev *dev, 484static int b43legacy_dmacontroller_rx_reset(struct b43legacy_wldev *dev,
484 u16 mmio_base, int dma64) 485 u16 mmio_base,
486 enum b43legacy_dmatype type)
485{ 487{
486 int i; 488 int i;
487 u32 value; 489 u32 value;
@@ -489,13 +491,14 @@ int b43legacy_dmacontroller_rx_reset(struct b43legacy_wldev *dev,
489 491
490 might_sleep(); 492 might_sleep();
491 493
492 offset = dma64 ? B43legacy_DMA64_RXCTL : B43legacy_DMA32_RXCTL; 494 offset = (type == B43legacy_DMA_64BIT) ?
495 B43legacy_DMA64_RXCTL : B43legacy_DMA32_RXCTL;
493 b43legacy_write32(dev, mmio_base + offset, 0); 496 b43legacy_write32(dev, mmio_base + offset, 0);
494 for (i = 0; i < 10; i++) { 497 for (i = 0; i < 10; i++) {
495 offset = dma64 ? B43legacy_DMA64_RXSTATUS : 498 offset = (type == B43legacy_DMA_64BIT) ?
496 B43legacy_DMA32_RXSTATUS; 499 B43legacy_DMA64_RXSTATUS : B43legacy_DMA32_RXSTATUS;
497 value = b43legacy_read32(dev, mmio_base + offset); 500 value = b43legacy_read32(dev, mmio_base + offset);
498 if (dma64) { 501 if (type == B43legacy_DMA_64BIT) {
499 value &= B43legacy_DMA64_RXSTAT; 502 value &= B43legacy_DMA64_RXSTAT;
500 if (value == B43legacy_DMA64_RXSTAT_DISABLED) { 503 if (value == B43legacy_DMA64_RXSTAT_DISABLED) {
501 i = -1; 504 i = -1;
@@ -519,8 +522,9 @@ int b43legacy_dmacontroller_rx_reset(struct b43legacy_wldev *dev,
519} 522}
520 523
521/* Reset the RX DMA channel */ 524/* Reset the RX DMA channel */
522int b43legacy_dmacontroller_tx_reset(struct b43legacy_wldev *dev, 525static int b43legacy_dmacontroller_tx_reset(struct b43legacy_wldev *dev,
523 u16 mmio_base, int dma64) 526 u16 mmio_base,
527 enum b43legacy_dmatype type)
524{ 528{
525 int i; 529 int i;
526 u32 value; 530 u32 value;
@@ -529,10 +533,10 @@ int b43legacy_dmacontroller_tx_reset(struct b43legacy_wldev *dev,
529 might_sleep(); 533 might_sleep();
530 534
531 for (i = 0; i < 10; i++) { 535 for (i = 0; i < 10; i++) {
532 offset = dma64 ? B43legacy_DMA64_TXSTATUS : 536 offset = (type == B43legacy_DMA_64BIT) ?
533 B43legacy_DMA32_TXSTATUS; 537 B43legacy_DMA64_TXSTATUS : B43legacy_DMA32_TXSTATUS;
534 value = b43legacy_read32(dev, mmio_base + offset); 538 value = b43legacy_read32(dev, mmio_base + offset);
535 if (dma64) { 539 if (type == B43legacy_DMA_64BIT) {
536 value &= B43legacy_DMA64_TXSTAT; 540 value &= B43legacy_DMA64_TXSTAT;
537 if (value == B43legacy_DMA64_TXSTAT_DISABLED || 541 if (value == B43legacy_DMA64_TXSTAT_DISABLED ||
538 value == B43legacy_DMA64_TXSTAT_IDLEWAIT || 542 value == B43legacy_DMA64_TXSTAT_IDLEWAIT ||
@@ -547,13 +551,14 @@ int b43legacy_dmacontroller_tx_reset(struct b43legacy_wldev *dev,
547 } 551 }
548 msleep(1); 552 msleep(1);
549 } 553 }
550 offset = dma64 ? B43legacy_DMA64_TXCTL : B43legacy_DMA32_TXCTL; 554 offset = (type == B43legacy_DMA_64BIT) ? B43legacy_DMA64_TXCTL :
555 B43legacy_DMA32_TXCTL;
551 b43legacy_write32(dev, mmio_base + offset, 0); 556 b43legacy_write32(dev, mmio_base + offset, 0);
552 for (i = 0; i < 10; i++) { 557 for (i = 0; i < 10; i++) {
553 offset = dma64 ? B43legacy_DMA64_TXSTATUS : 558 offset = (type == B43legacy_DMA_64BIT) ?
554 B43legacy_DMA32_TXSTATUS; 559 B43legacy_DMA64_TXSTATUS : B43legacy_DMA32_TXSTATUS;
555 value = b43legacy_read32(dev, mmio_base + offset); 560 value = b43legacy_read32(dev, mmio_base + offset);
556 if (dma64) { 561 if (type == B43legacy_DMA_64BIT) {
557 value &= B43legacy_DMA64_TXSTAT; 562 value &= B43legacy_DMA64_TXSTAT;
558 if (value == B43legacy_DMA64_TXSTAT_DISABLED) { 563 if (value == B43legacy_DMA64_TXSTAT_DISABLED) {
559 i = -1; 564 i = -1;
@@ -578,6 +583,32 @@ int b43legacy_dmacontroller_tx_reset(struct b43legacy_wldev *dev,
578 return 0; 583 return 0;
579} 584}
580 585
586/* Check if a DMA mapping address is invalid. */
587static bool b43legacy_dma_mapping_error(struct b43legacy_dmaring *ring,
588 dma_addr_t addr,
589 size_t buffersize)
590{
591 if (unlikely(dma_mapping_error(addr)))
592 return 1;
593
594 switch (ring->type) {
595 case B43legacy_DMA_30BIT:
596 if ((u64)addr + buffersize > (1ULL << 30))
597 return 1;
598 break;
599 case B43legacy_DMA_32BIT:
600 if ((u64)addr + buffersize > (1ULL << 32))
601 return 1;
602 break;
603 case B43legacy_DMA_64BIT:
604 /* Currently we can't have addresses beyond 64 bits in the kernel. */
605 break;
606 }
607
608 /* The address is OK. */
609 return 0;
610}
611
581static int setup_rx_descbuffer(struct b43legacy_dmaring *ring, 612static int setup_rx_descbuffer(struct b43legacy_dmaring *ring,
582 struct b43legacy_dmadesc_generic *desc, 613 struct b43legacy_dmadesc_generic *desc,
583 struct b43legacy_dmadesc_meta *meta, 614 struct b43legacy_dmadesc_meta *meta,
@@ -595,7 +626,7 @@ static int setup_rx_descbuffer(struct b43legacy_dmaring *ring,
595 return -ENOMEM; 626 return -ENOMEM;
596 dmaaddr = map_descbuffer(ring, skb->data, 627 dmaaddr = map_descbuffer(ring, skb->data,
597 ring->rx_buffersize, 0); 628 ring->rx_buffersize, 0);
598 if (dma_mapping_error(dmaaddr)) { 629 if (b43legacy_dma_mapping_error(ring, dmaaddr, ring->rx_buffersize)) {
599 /* ugh. try to realloc in zone_dma */ 630 /* ugh. try to realloc in zone_dma */
600 gfp_flags |= GFP_DMA; 631 gfp_flags |= GFP_DMA;
601 632
@@ -608,7 +639,7 @@ static int setup_rx_descbuffer(struct b43legacy_dmaring *ring,
608 ring->rx_buffersize, 0); 639 ring->rx_buffersize, 0);
609 } 640 }
610 641
611 if (dma_mapping_error(dmaaddr)) { 642 if (b43legacy_dma_mapping_error(ring, dmaaddr, ring->rx_buffersize)) {
612 dev_kfree_skb_any(skb); 643 dev_kfree_skb_any(skb);
613 return -EIO; 644 return -EIO;
614 } 645 }
@@ -674,7 +705,7 @@ static int dmacontroller_setup(struct b43legacy_dmaring *ring)
674 u32 trans = ssb_dma_translation(ring->dev->dev); 705 u32 trans = ssb_dma_translation(ring->dev->dev);
675 706
676 if (ring->tx) { 707 if (ring->tx) {
677 if (ring->dma64) { 708 if (ring->type == B43legacy_DMA_64BIT) {
678 u64 ringbase = (u64)(ring->dmabase); 709 u64 ringbase = (u64)(ring->dmabase);
679 710
680 addrext = ((ringbase >> 32) & SSB_DMA_TRANSLATION_MASK) 711 addrext = ((ringbase >> 32) & SSB_DMA_TRANSLATION_MASK)
@@ -709,7 +740,7 @@ static int dmacontroller_setup(struct b43legacy_dmaring *ring)
709 err = alloc_initial_descbuffers(ring); 740 err = alloc_initial_descbuffers(ring);
710 if (err) 741 if (err)
711 goto out; 742 goto out;
712 if (ring->dma64) { 743 if (ring->type == B43legacy_DMA_64BIT) {
713 u64 ringbase = (u64)(ring->dmabase); 744 u64 ringbase = (u64)(ring->dmabase);
714 745
715 addrext = ((ringbase >> 32) & SSB_DMA_TRANSLATION_MASK) 746 addrext = ((ringbase >> 32) & SSB_DMA_TRANSLATION_MASK)
@@ -760,16 +791,16 @@ static void dmacontroller_cleanup(struct b43legacy_dmaring *ring)
760{ 791{
761 if (ring->tx) { 792 if (ring->tx) {
762 b43legacy_dmacontroller_tx_reset(ring->dev, ring->mmio_base, 793 b43legacy_dmacontroller_tx_reset(ring->dev, ring->mmio_base,
763 ring->dma64); 794 ring->type);
764 if (ring->dma64) { 795 if (ring->type == B43legacy_DMA_64BIT) {
765 b43legacy_dma_write(ring, B43legacy_DMA64_TXRINGLO, 0); 796 b43legacy_dma_write(ring, B43legacy_DMA64_TXRINGLO, 0);
766 b43legacy_dma_write(ring, B43legacy_DMA64_TXRINGHI, 0); 797 b43legacy_dma_write(ring, B43legacy_DMA64_TXRINGHI, 0);
767 } else 798 } else
768 b43legacy_dma_write(ring, B43legacy_DMA32_TXRING, 0); 799 b43legacy_dma_write(ring, B43legacy_DMA32_TXRING, 0);
769 } else { 800 } else {
770 b43legacy_dmacontroller_rx_reset(ring->dev, ring->mmio_base, 801 b43legacy_dmacontroller_rx_reset(ring->dev, ring->mmio_base,
771 ring->dma64); 802 ring->type);
772 if (ring->dma64) { 803 if (ring->type == B43legacy_DMA_64BIT) {
773 b43legacy_dma_write(ring, B43legacy_DMA64_RXRINGLO, 0); 804 b43legacy_dma_write(ring, B43legacy_DMA64_RXRINGLO, 0);
774 b43legacy_dma_write(ring, B43legacy_DMA64_RXRINGHI, 0); 805 b43legacy_dma_write(ring, B43legacy_DMA64_RXRINGHI, 0);
775 } else 806 } else
@@ -824,11 +855,10 @@ static u64 supported_dma_mask(struct b43legacy_wldev *dev)
824 855
825/* Main initialization function. */ 856/* Main initialization function. */
826static 857static
827struct b43legacy_dmaring *b43legacy_setup_dmaring( 858struct b43legacy_dmaring *b43legacy_setup_dmaring(struct b43legacy_wldev *dev,
828 struct b43legacy_wldev *dev, 859 int controller_index,
829 int controller_index, 860 int for_tx,
830 int for_tx, 861 enum b43legacy_dmatype type)
831 int dma64)
832{ 862{
833 struct b43legacy_dmaring *ring; 863 struct b43legacy_dmaring *ring;
834 int err; 864 int err;
@@ -838,6 +868,7 @@ struct b43legacy_dmaring *b43legacy_setup_dmaring(
838 ring = kzalloc(sizeof(*ring), GFP_KERNEL); 868 ring = kzalloc(sizeof(*ring), GFP_KERNEL);
839 if (!ring) 869 if (!ring)
840 goto out; 870 goto out;
871 ring->type = type;
841 872
842 nr_slots = B43legacy_RXRING_SLOTS; 873 nr_slots = B43legacy_RXRING_SLOTS;
843 if (for_tx) 874 if (for_tx)
@@ -855,12 +886,12 @@ struct b43legacy_dmaring *b43legacy_setup_dmaring(
855 goto err_kfree_meta; 886 goto err_kfree_meta;
856 887
857 /* test for ability to dma to txhdr_cache */ 888 /* test for ability to dma to txhdr_cache */
858 dma_test = dma_map_single(dev->dev->dev, 889 dma_test = dma_map_single(dev->dev->dev, ring->txhdr_cache,
859 ring->txhdr_cache, 890 sizeof(struct b43legacy_txhdr_fw3),
860 sizeof(struct b43legacy_txhdr_fw3), 891 DMA_TO_DEVICE);
861 DMA_TO_DEVICE);
862 892
863 if (dma_mapping_error(dma_test)) { 893 if (b43legacy_dma_mapping_error(ring, dma_test,
894 sizeof(struct b43legacy_txhdr_fw3))) {
864 /* ugh realloc */ 895 /* ugh realloc */
865 kfree(ring->txhdr_cache); 896 kfree(ring->txhdr_cache);
866 ring->txhdr_cache = kcalloc(nr_slots, 897 ring->txhdr_cache = kcalloc(nr_slots,
@@ -874,7 +905,8 @@ struct b43legacy_dmaring *b43legacy_setup_dmaring(
874 sizeof(struct b43legacy_txhdr_fw3), 905 sizeof(struct b43legacy_txhdr_fw3),
875 DMA_TO_DEVICE); 906 DMA_TO_DEVICE);
876 907
877 if (dma_mapping_error(dma_test)) 908 if (b43legacy_dma_mapping_error(ring, dma_test,
909 sizeof(struct b43legacy_txhdr_fw3)))
878 goto err_kfree_txhdr_cache; 910 goto err_kfree_txhdr_cache;
879 } 911 }
880 912
@@ -885,11 +917,9 @@ struct b43legacy_dmaring *b43legacy_setup_dmaring(
885 917
886 ring->dev = dev; 918 ring->dev = dev;
887 ring->nr_slots = nr_slots; 919 ring->nr_slots = nr_slots;
888 ring->mmio_base = b43legacy_dmacontroller_base(dma64, 920 ring->mmio_base = b43legacy_dmacontroller_base(type, controller_index);
889 controller_index);
890 ring->index = controller_index; 921 ring->index = controller_index;
891 ring->dma64 = !!dma64; 922 if (type == B43legacy_DMA_64BIT)
892 if (dma64)
893 ring->ops = &dma64_ops; 923 ring->ops = &dma64_ops;
894 else 924 else
895 ring->ops = &dma32_ops; 925 ring->ops = &dma32_ops;
@@ -939,10 +969,10 @@ static void b43legacy_destroy_dmaring(struct b43legacy_dmaring *ring)
939 if (!ring) 969 if (!ring)
940 return; 970 return;
941 971
942 b43legacydbg(ring->dev->wl, "DMA-%s 0x%04X (%s) max used slots:" 972 b43legacydbg(ring->dev->wl, "DMA-%u 0x%04X (%s) max used slots:"
943 " %d/%d\n", (ring->dma64) ? "64" : "32", ring->mmio_base, 973 " %d/%d\n", (unsigned int)(ring->type), ring->mmio_base,
944 (ring->tx) ? "TX" : "RX", 974 (ring->tx) ? "TX" : "RX", ring->max_used_slots,
945 ring->max_used_slots, ring->nr_slots); 975 ring->nr_slots);
946 /* Device IRQs are disabled prior entering this function, 976 /* Device IRQs are disabled prior entering this function,
947 * so no need to take care of concurrency with rx handler stuff. 977 * so no need to take care of concurrency with rx handler stuff.
948 */ 978 */
@@ -988,11 +1018,22 @@ int b43legacy_dma_init(struct b43legacy_wldev *dev)
988 struct b43legacy_dmaring *ring; 1018 struct b43legacy_dmaring *ring;
989 int err; 1019 int err;
990 u64 dmamask; 1020 u64 dmamask;
991 int dma64 = 0; 1021 enum b43legacy_dmatype type;
992 1022
993 dmamask = supported_dma_mask(dev); 1023 dmamask = supported_dma_mask(dev);
994 if (dmamask == DMA_64BIT_MASK) 1024 switch (dmamask) {
995 dma64 = 1; 1025 default:
1026 B43legacy_WARN_ON(1);
1027 case DMA_30BIT_MASK:
1028 type = B43legacy_DMA_30BIT;
1029 break;
1030 case DMA_32BIT_MASK:
1031 type = B43legacy_DMA_32BIT;
1032 break;
1033 case DMA_64BIT_MASK:
1034 type = B43legacy_DMA_64BIT;
1035 break;
1036 }
996 1037
997 err = ssb_dma_set_mask(dev->dev, dmamask); 1038 err = ssb_dma_set_mask(dev->dev, dmamask);
998 if (err) { 1039 if (err) {
@@ -1010,52 +1051,50 @@ int b43legacy_dma_init(struct b43legacy_wldev *dev)
1010 1051
1011 err = -ENOMEM; 1052 err = -ENOMEM;
1012 /* setup TX DMA channels. */ 1053 /* setup TX DMA channels. */
1013 ring = b43legacy_setup_dmaring(dev, 0, 1, dma64); 1054 ring = b43legacy_setup_dmaring(dev, 0, 1, type);
1014 if (!ring) 1055 if (!ring)
1015 goto out; 1056 goto out;
1016 dma->tx_ring0 = ring; 1057 dma->tx_ring0 = ring;
1017 1058
1018 ring = b43legacy_setup_dmaring(dev, 1, 1, dma64); 1059 ring = b43legacy_setup_dmaring(dev, 1, 1, type);
1019 if (!ring) 1060 if (!ring)
1020 goto err_destroy_tx0; 1061 goto err_destroy_tx0;
1021 dma->tx_ring1 = ring; 1062 dma->tx_ring1 = ring;
1022 1063
1023 ring = b43legacy_setup_dmaring(dev, 2, 1, dma64); 1064 ring = b43legacy_setup_dmaring(dev, 2, 1, type);
1024 if (!ring) 1065 if (!ring)
1025 goto err_destroy_tx1; 1066 goto err_destroy_tx1;
1026 dma->tx_ring2 = ring; 1067 dma->tx_ring2 = ring;
1027 1068
1028 ring = b43legacy_setup_dmaring(dev, 3, 1, dma64); 1069 ring = b43legacy_setup_dmaring(dev, 3, 1, type);
1029 if (!ring) 1070 if (!ring)
1030 goto err_destroy_tx2; 1071 goto err_destroy_tx2;
1031 dma->tx_ring3 = ring; 1072 dma->tx_ring3 = ring;
1032 1073
1033 ring = b43legacy_setup_dmaring(dev, 4, 1, dma64); 1074 ring = b43legacy_setup_dmaring(dev, 4, 1, type);
1034 if (!ring) 1075 if (!ring)
1035 goto err_destroy_tx3; 1076 goto err_destroy_tx3;
1036 dma->tx_ring4 = ring; 1077 dma->tx_ring4 = ring;
1037 1078
1038 ring = b43legacy_setup_dmaring(dev, 5, 1, dma64); 1079 ring = b43legacy_setup_dmaring(dev, 5, 1, type);
1039 if (!ring) 1080 if (!ring)
1040 goto err_destroy_tx4; 1081 goto err_destroy_tx4;
1041 dma->tx_ring5 = ring; 1082 dma->tx_ring5 = ring;
1042 1083
1043 /* setup RX DMA channels. */ 1084 /* setup RX DMA channels. */
1044 ring = b43legacy_setup_dmaring(dev, 0, 0, dma64); 1085 ring = b43legacy_setup_dmaring(dev, 0, 0, type);
1045 if (!ring) 1086 if (!ring)
1046 goto err_destroy_tx5; 1087 goto err_destroy_tx5;
1047 dma->rx_ring0 = ring; 1088 dma->rx_ring0 = ring;
1048 1089
1049 if (dev->dev->id.revision < 5) { 1090 if (dev->dev->id.revision < 5) {
1050 ring = b43legacy_setup_dmaring(dev, 3, 0, dma64); 1091 ring = b43legacy_setup_dmaring(dev, 3, 0, type);
1051 if (!ring) 1092 if (!ring)
1052 goto err_destroy_rx0; 1093 goto err_destroy_rx0;
1053 dma->rx_ring3 = ring; 1094 dma->rx_ring3 = ring;
1054 } 1095 }
1055 1096
1056 b43legacydbg(dev->wl, "%d-bit DMA initialized\n", 1097 b43legacydbg(dev->wl, "%u-bit DMA initialized\n", (unsigned int)type);
1057 (dmamask == DMA_64BIT_MASK) ? 64 :
1058 (dmamask == DMA_32BIT_MASK) ? 32 : 30);
1059 err = 0; 1098 err = 0;
1060out: 1099out:
1061 return err; 1100 return err;
@@ -1194,9 +1233,13 @@ static int dma_tx_fragment(struct b43legacy_dmaring *ring,
1194 } 1233 }
1195 1234
1196 meta_hdr->dmaaddr = map_descbuffer(ring, (unsigned char *)header, 1235 meta_hdr->dmaaddr = map_descbuffer(ring, (unsigned char *)header,
1197 sizeof(struct b43legacy_txhdr_fw3), 1); 1236 sizeof(struct b43legacy_txhdr_fw3), 1);
1198 if (dma_mapping_error(meta_hdr->dmaaddr)) 1237 if (b43legacy_dma_mapping_error(ring, meta_hdr->dmaaddr,
1238 sizeof(struct b43legacy_txhdr_fw3))) {
1239 ring->current_slot = old_top_slot;
1240 ring->used_slots = old_used_slots;
1199 return -EIO; 1241 return -EIO;
1242 }
1200 ops->fill_descriptor(ring, desc, meta_hdr->dmaaddr, 1243 ops->fill_descriptor(ring, desc, meta_hdr->dmaaddr,
1201 sizeof(struct b43legacy_txhdr_fw3), 1, 0, 0); 1244 sizeof(struct b43legacy_txhdr_fw3), 1, 0, 0);
1202 1245
@@ -1211,7 +1254,7 @@ static int dma_tx_fragment(struct b43legacy_dmaring *ring,
1211 1254
1212 meta->dmaaddr = map_descbuffer(ring, skb->data, skb->len, 1); 1255 meta->dmaaddr = map_descbuffer(ring, skb->data, skb->len, 1);
1213 /* create a bounce buffer in zone_dma on mapping failure. */ 1256 /* create a bounce buffer in zone_dma on mapping failure. */
1214 if (dma_mapping_error(meta->dmaaddr)) { 1257 if (b43legacy_dma_mapping_error(ring, meta->dmaaddr, skb->len)) {
1215 bounce_skb = __dev_alloc_skb(skb->len, GFP_ATOMIC | GFP_DMA); 1258 bounce_skb = __dev_alloc_skb(skb->len, GFP_ATOMIC | GFP_DMA);
1216 if (!bounce_skb) { 1259 if (!bounce_skb) {
1217 ring->current_slot = old_top_slot; 1260 ring->current_slot = old_top_slot;
@@ -1225,7 +1268,7 @@ static int dma_tx_fragment(struct b43legacy_dmaring *ring,
1225 skb = bounce_skb; 1268 skb = bounce_skb;
1226 meta->skb = skb; 1269 meta->skb = skb;
1227 meta->dmaaddr = map_descbuffer(ring, skb->data, skb->len, 1); 1270 meta->dmaaddr = map_descbuffer(ring, skb->data, skb->len, 1);
1228 if (dma_mapping_error(meta->dmaaddr)) { 1271 if (b43legacy_dma_mapping_error(ring, meta->dmaaddr, skb->len)) {
1229 ring->current_slot = old_top_slot; 1272 ring->current_slot = old_top_slot;
1230 ring->used_slots = old_used_slots; 1273 ring->used_slots = old_used_slots;
1231 err = -EIO; 1274 err = -EIO;
diff --git a/drivers/net/wireless/b43legacy/dma.h b/drivers/net/wireless/b43legacy/dma.h
index 26f6ab08de75..2dd488c5be2d 100644
--- a/drivers/net/wireless/b43legacy/dma.h
+++ b/drivers/net/wireless/b43legacy/dma.h
@@ -218,6 +218,12 @@ struct b43legacy_dma_ops {
218 void (*set_current_rxslot)(struct b43legacy_dmaring *ring, int slot); 218 void (*set_current_rxslot)(struct b43legacy_dmaring *ring, int slot);
219}; 219};
220 220
221enum b43legacy_dmatype {
222 B43legacy_DMA_30BIT = 30,
223 B43legacy_DMA_32BIT = 32,
224 B43legacy_DMA_64BIT = 64,
225};
226
221struct b43legacy_dmaring { 227struct b43legacy_dmaring {
222 /* Lowlevel DMA ops. */ 228 /* Lowlevel DMA ops. */
223 const struct b43legacy_dma_ops *ops; 229 const struct b43legacy_dma_ops *ops;
@@ -250,8 +256,8 @@ struct b43legacy_dmaring {
250 int index; 256 int index;
251 /* Boolean. Is this a TX ring? */ 257 /* Boolean. Is this a TX ring? */
252 bool tx; 258 bool tx;
253 /* Boolean. 64bit DMA if true, 32bit DMA otherwise. */ 259 /* The type of DMA engine used. */
254 bool dma64; 260 enum b43legacy_dmatype type;
255 /* Boolean. Is this ring stopped at ieee80211 level? */ 261 /* Boolean. Is this ring stopped at ieee80211 level? */
256 bool stopped; 262 bool stopped;
257 /* Lock, only used for TX. */ 263 /* Lock, only used for TX. */
@@ -284,15 +290,6 @@ void b43legacy_dma_write(struct b43legacy_dmaring *ring,
284int b43legacy_dma_init(struct b43legacy_wldev *dev); 290int b43legacy_dma_init(struct b43legacy_wldev *dev);
285void b43legacy_dma_free(struct b43legacy_wldev *dev); 291void b43legacy_dma_free(struct b43legacy_wldev *dev);
286 292
287int b43legacy_dmacontroller_rx_reset(struct b43legacy_wldev *dev,
288 u16 dmacontroller_mmio_base,
289 int dma64);
290int b43legacy_dmacontroller_tx_reset(struct b43legacy_wldev *dev,
291 u16 dmacontroller_mmio_base,
292 int dma64);
293
294u16 b43legacy_dmacontroller_base(int dma64bit, int dmacontroller_idx);
295
296void b43legacy_dma_tx_suspend(struct b43legacy_wldev *dev); 293void b43legacy_dma_tx_suspend(struct b43legacy_wldev *dev);
297void b43legacy_dma_tx_resume(struct b43legacy_wldev *dev); 294void b43legacy_dma_tx_resume(struct b43legacy_wldev *dev);
298 295
@@ -320,20 +317,6 @@ void b43legacy_dma_free(struct b43legacy_wldev *dev)
320{ 317{
321} 318}
322static inline 319static inline
323int b43legacy_dmacontroller_rx_reset(struct b43legacy_wldev *dev,
324 u16 dmacontroller_mmio_base,
325 int dma64)
326{
327 return 0;
328}
329static inline
330int b43legacy_dmacontroller_tx_reset(struct b43legacy_wldev *dev,
331 u16 dmacontroller_mmio_base,
332 int dma64)
333{
334 return 0;
335}
336static inline
337void b43legacy_dma_get_tx_stats(struct b43legacy_wldev *dev, 320void b43legacy_dma_get_tx_stats(struct b43legacy_wldev *dev,
338 struct ieee80211_tx_queue_stats *stats) 321 struct ieee80211_tx_queue_stats *stats)
339{ 322{
diff --git a/drivers/net/wireless/b43legacy/main.c b/drivers/net/wireless/b43legacy/main.c
index 53f7f2e97615..c39de422e220 100644
--- a/drivers/net/wireless/b43legacy/main.c
+++ b/drivers/net/wireless/b43legacy/main.c
@@ -3,7 +3,7 @@
3 * Broadcom B43legacy wireless driver 3 * Broadcom B43legacy wireless driver
4 * 4 *
5 * Copyright (c) 2005 Martin Langer <martin-langer@gmx.de> 5 * Copyright (c) 2005 Martin Langer <martin-langer@gmx.de>
6 * Copyright (c) 2005-2007 Stefano Brivio <stefano.brivio@polimi.it> 6 * Copyright (c) 2005-2008 Stefano Brivio <stefano.brivio@polimi.it>
7 * Copyright (c) 2005, 2006 Michael Buesch <mb@bu3sch.de> 7 * Copyright (c) 2005, 2006 Michael Buesch <mb@bu3sch.de>
8 * Copyright (c) 2005 Danny van Dyk <kugelfang@gentoo.org> 8 * Copyright (c) 2005 Danny van Dyk <kugelfang@gentoo.org>
9 * Copyright (c) 2005 Andreas Jaggi <andreas.jaggi@waterwave.ch> 9 * Copyright (c) 2005 Andreas Jaggi <andreas.jaggi@waterwave.ch>
@@ -60,6 +60,8 @@ MODULE_AUTHOR("Stefano Brivio");
60MODULE_AUTHOR("Michael Buesch"); 60MODULE_AUTHOR("Michael Buesch");
61MODULE_LICENSE("GPL"); 61MODULE_LICENSE("GPL");
62 62
63MODULE_FIRMWARE(B43legacy_SUPPORTED_FIRMWARE_ID);
64
63#if defined(CONFIG_B43LEGACY_DMA) && defined(CONFIG_B43LEGACY_PIO) 65#if defined(CONFIG_B43LEGACY_DMA) && defined(CONFIG_B43LEGACY_PIO)
64static int modparam_pio; 66static int modparam_pio;
65module_param_named(pio, modparam_pio, int, 0444); 67module_param_named(pio, modparam_pio, int, 0444);
@@ -1640,10 +1642,11 @@ static int b43legacy_upload_microcode(struct b43legacy_wldev *dev)
1640 err = -EOPNOTSUPP; 1642 err = -EOPNOTSUPP;
1641 goto error; 1643 goto error;
1642 } 1644 }
1643 b43legacydbg(dev->wl, "Loading firmware version 0x%X, patch level %u " 1645 b43legacyinfo(dev->wl, "Loading firmware version 0x%X, patch level %u "
1644 "(20%.2i-%.2i-%.2i %.2i:%.2i:%.2i)\n", fwrev, fwpatch, 1646 "(20%.2i-%.2i-%.2i %.2i:%.2i:%.2i)\n", fwrev, fwpatch,
1645 (fwdate >> 12) & 0xF, (fwdate >> 8) & 0xF, fwdate & 0xFF, 1647 (fwdate >> 12) & 0xF, (fwdate >> 8) & 0xF, fwdate & 0xFF,
1646 (fwtime >> 11) & 0x1F, (fwtime >> 5) & 0x3F, fwtime & 0x1F); 1648 (fwtime >> 11) & 0x1F, (fwtime >> 5) & 0x3F,
1649 fwtime & 0x1F);
1647 1650
1648 dev->fw.rev = fwrev; 1651 dev->fw.rev = fwrev;
1649 dev->fw.patch = fwpatch; 1652 dev->fw.patch = fwpatch;
@@ -3806,6 +3809,32 @@ static struct ssb_driver b43legacy_ssb_driver = {
3806 .resume = b43legacy_resume, 3809 .resume = b43legacy_resume,
3807}; 3810};
3808 3811
3812static void b43legacy_print_driverinfo(void)
3813{
3814 const char *feat_pci = "", *feat_leds = "", *feat_rfkill = "",
3815 *feat_pio = "", *feat_dma = "";
3816
3817#ifdef CONFIG_B43LEGACY_PCI_AUTOSELECT
3818 feat_pci = "P";
3819#endif
3820#ifdef CONFIG_B43LEGACY_LEDS
3821 feat_leds = "L";
3822#endif
3823#ifdef CONFIG_B43LEGACY_RFKILL
3824 feat_rfkill = "R";
3825#endif
3826#ifdef CONFIG_B43LEGACY_PIO
3827 feat_pio = "I";
3828#endif
3829#ifdef CONFIG_B43LEGACY_DMA
3830 feat_dma = "D";
3831#endif
3832 printk(KERN_INFO "Broadcom 43xx driver loaded "
3833 "[ Features: %s%s%s%s%s, Firmware-ID: "
3834 B43legacy_SUPPORTED_FIRMWARE_ID " ]\n",
3835 feat_pci, feat_leds, feat_rfkill, feat_pio, feat_dma);
3836}
3837
3809static int __init b43legacy_init(void) 3838static int __init b43legacy_init(void)
3810{ 3839{
3811 int err; 3840 int err;
@@ -3816,6 +3845,8 @@ static int __init b43legacy_init(void)
3816 if (err) 3845 if (err)
3817 goto err_dfs_exit; 3846 goto err_dfs_exit;
3818 3847
3848 b43legacy_print_driverinfo();
3849
3819 return err; 3850 return err;
3820 3851
3821err_dfs_exit: 3852err_dfs_exit:
diff --git a/drivers/net/wireless/ipw2200.c b/drivers/net/wireless/ipw2200.c
index 3e6ad7b92c83..a56d9fc6354f 100644
--- a/drivers/net/wireless/ipw2200.c
+++ b/drivers/net/wireless/ipw2200.c
@@ -3365,7 +3365,6 @@ static void ipw_rx_queue_reset(struct ipw_priv *priv,
3365 /* Set us so that we have processed and used all buffers, but have 3365 /* Set us so that we have processed and used all buffers, but have
3366 * not restocked the Rx queue with fresh buffers */ 3366 * not restocked the Rx queue with fresh buffers */
3367 rxq->read = rxq->write = 0; 3367 rxq->read = rxq->write = 0;
3368 rxq->processed = RX_QUEUE_SIZE - 1;
3369 rxq->free_count = 0; 3368 rxq->free_count = 0;
3370 spin_unlock_irqrestore(&rxq->lock, flags); 3369 spin_unlock_irqrestore(&rxq->lock, flags);
3371} 3370}
@@ -3607,7 +3606,22 @@ static int ipw_load(struct ipw_priv *priv)
3607 * Driver allocates buffers of this size for Rx 3606 * Driver allocates buffers of this size for Rx
3608 */ 3607 */
3609 3608
3610static inline int ipw_queue_space(const struct clx2_queue *q) 3609/**
3610 * ipw_rx_queue_space - Return number of free slots available in queue.
3611 */
3612static int ipw_rx_queue_space(const struct ipw_rx_queue *q)
3613{
3614 int s = q->read - q->write;
3615 if (s <= 0)
3616 s += RX_QUEUE_SIZE;
3617 /* keep some buffer to not confuse full and empty queue */
3618 s -= 2;
3619 if (s < 0)
3620 s = 0;
3621 return s;
3622}
3623
3624static inline int ipw_tx_queue_space(const struct clx2_queue *q)
3611{ 3625{
3612 int s = q->last_used - q->first_empty; 3626 int s = q->last_used - q->first_empty;
3613 if (s <= 0) 3627 if (s <= 0)
@@ -4947,7 +4961,7 @@ static int ipw_queue_tx_reclaim(struct ipw_priv *priv,
4947 priv->tx_packets++; 4961 priv->tx_packets++;
4948 } 4962 }
4949 done: 4963 done:
4950 if ((ipw_queue_space(q) > q->low_mark) && 4964 if ((ipw_tx_queue_space(q) > q->low_mark) &&
4951 (qindex >= 0) && 4965 (qindex >= 0) &&
4952 (priv->status & STATUS_ASSOCIATED) && netif_running(priv->net_dev)) 4966 (priv->status & STATUS_ASSOCIATED) && netif_running(priv->net_dev))
4953 netif_wake_queue(priv->net_dev); 4967 netif_wake_queue(priv->net_dev);
@@ -4965,7 +4979,7 @@ static int ipw_queue_tx_hcmd(struct ipw_priv *priv, int hcmd, void *buf,
4965 struct clx2_queue *q = &txq->q; 4979 struct clx2_queue *q = &txq->q;
4966 struct tfd_frame *tfd; 4980 struct tfd_frame *tfd;
4967 4981
4968 if (ipw_queue_space(q) < (sync ? 1 : 2)) { 4982 if (ipw_tx_queue_space(q) < (sync ? 1 : 2)) {
4969 IPW_ERROR("No space for Tx\n"); 4983 IPW_ERROR("No space for Tx\n");
4970 return -EBUSY; 4984 return -EBUSY;
4971 } 4985 }
@@ -5070,7 +5084,7 @@ static void ipw_rx_queue_restock(struct ipw_priv *priv)
5070 5084
5071 spin_lock_irqsave(&rxq->lock, flags); 5085 spin_lock_irqsave(&rxq->lock, flags);
5072 write = rxq->write; 5086 write = rxq->write;
5073 while ((rxq->write != rxq->processed) && (rxq->free_count)) { 5087 while ((ipw_rx_queue_space(rxq) > 0) && (rxq->free_count)) {
5074 element = rxq->rx_free.next; 5088 element = rxq->rx_free.next;
5075 rxb = list_entry(element, struct ipw_rx_mem_buffer, list); 5089 rxb = list_entry(element, struct ipw_rx_mem_buffer, list);
5076 list_del(element); 5090 list_del(element);
@@ -5187,7 +5201,6 @@ static struct ipw_rx_queue *ipw_rx_queue_alloc(struct ipw_priv *priv)
5187 /* Set us so that we have processed and used all buffers, but have 5201 /* Set us so that we have processed and used all buffers, but have
5188 * not restocked the Rx queue with fresh buffers */ 5202 * not restocked the Rx queue with fresh buffers */
5189 rxq->read = rxq->write = 0; 5203 rxq->read = rxq->write = 0;
5190 rxq->processed = RX_QUEUE_SIZE - 1;
5191 rxq->free_count = 0; 5204 rxq->free_count = 0;
5192 5205
5193 return rxq; 5206 return rxq;
@@ -8223,13 +8236,17 @@ static void ipw_rx(struct ipw_priv *priv)
8223 struct ieee80211_hdr_4addr *header; 8236 struct ieee80211_hdr_4addr *header;
8224 u32 r, w, i; 8237 u32 r, w, i;
8225 u8 network_packet; 8238 u8 network_packet;
8239 u8 fill_rx = 0;
8226 DECLARE_MAC_BUF(mac); 8240 DECLARE_MAC_BUF(mac);
8227 DECLARE_MAC_BUF(mac2); 8241 DECLARE_MAC_BUF(mac2);
8228 DECLARE_MAC_BUF(mac3); 8242 DECLARE_MAC_BUF(mac3);
8229 8243
8230 r = ipw_read32(priv, IPW_RX_READ_INDEX); 8244 r = ipw_read32(priv, IPW_RX_READ_INDEX);
8231 w = ipw_read32(priv, IPW_RX_WRITE_INDEX); 8245 w = ipw_read32(priv, IPW_RX_WRITE_INDEX);
8232 i = (priv->rxq->processed + 1) % RX_QUEUE_SIZE; 8246 i = priv->rxq->read;
8247
8248 if (ipw_rx_queue_space (priv->rxq) > (RX_QUEUE_SIZE / 2))
8249 fill_rx = 1;
8233 8250
8234 while (i != r) { 8251 while (i != r) {
8235 rxb = priv->rxq->queue[i]; 8252 rxb = priv->rxq->queue[i];
@@ -8404,11 +8421,17 @@ static void ipw_rx(struct ipw_priv *priv)
8404 list_add_tail(&rxb->list, &priv->rxq->rx_used); 8421 list_add_tail(&rxb->list, &priv->rxq->rx_used);
8405 8422
8406 i = (i + 1) % RX_QUEUE_SIZE; 8423 i = (i + 1) % RX_QUEUE_SIZE;
8424
8425 /* If there are a lot of unsued frames, restock the Rx queue
8426 * so the ucode won't assert */
8427 if (fill_rx) {
8428 priv->rxq->read = i;
8429 ipw_rx_queue_replenish(priv);
8430 }
8407 } 8431 }
8408 8432
8409 /* Backtrack one entry */ 8433 /* Backtrack one entry */
8410 priv->rxq->processed = (i ? i : RX_QUEUE_SIZE) - 1; 8434 priv->rxq->read = i;
8411
8412 ipw_rx_queue_restock(priv); 8435 ipw_rx_queue_restock(priv);
8413} 8436}
8414 8437
@@ -10336,7 +10359,7 @@ static int ipw_tx_skb(struct ipw_priv *priv, struct ieee80211_txb *txb,
10336 q->first_empty = ipw_queue_inc_wrap(q->first_empty, q->n_bd); 10359 q->first_empty = ipw_queue_inc_wrap(q->first_empty, q->n_bd);
10337 ipw_write32(priv, q->reg_w, q->first_empty); 10360 ipw_write32(priv, q->reg_w, q->first_empty);
10338 10361
10339 if (ipw_queue_space(q) < q->high_mark) 10362 if (ipw_tx_queue_space(q) < q->high_mark)
10340 netif_stop_queue(priv->net_dev); 10363 netif_stop_queue(priv->net_dev);
10341 10364
10342 return NETDEV_TX_OK; 10365 return NETDEV_TX_OK;
@@ -10357,7 +10380,7 @@ static int ipw_net_is_queue_full(struct net_device *dev, int pri)
10357 struct clx2_tx_queue *txq = &priv->txq[0]; 10380 struct clx2_tx_queue *txq = &priv->txq[0];
10358#endif /* CONFIG_IPW2200_QOS */ 10381#endif /* CONFIG_IPW2200_QOS */
10359 10382
10360 if (ipw_queue_space(&txq->q) < txq->q.high_mark) 10383 if (ipw_tx_queue_space(&txq->q) < txq->q.high_mark)
10361 return 1; 10384 return 1;
10362 10385
10363 return 0; 10386 return 0;
diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c
index 5ee1ad69898b..40b71bc2c4a4 100644
--- a/drivers/net/wireless/iwlwifi/iwl3945-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c
@@ -687,6 +687,12 @@ static int iwl3945_enqueue_hcmd(struct iwl3945_priv *priv, struct iwl3945_host_c
687 BUG_ON((fix_size > TFD_MAX_PAYLOAD_SIZE) && 687 BUG_ON((fix_size > TFD_MAX_PAYLOAD_SIZE) &&
688 !(cmd->meta.flags & CMD_SIZE_HUGE)); 688 !(cmd->meta.flags & CMD_SIZE_HUGE));
689 689
690
691 if (iwl3945_is_rfkill(priv)) {
692 IWL_DEBUG_INFO("Not sending command - RF KILL");
693 return -EIO;
694 }
695
690 if (iwl3945_queue_space(q) < ((cmd->meta.flags & CMD_ASYNC) ? 2 : 1)) { 696 if (iwl3945_queue_space(q) < ((cmd->meta.flags & CMD_ASYNC) ? 2 : 1)) {
691 IWL_ERROR("No space for Tx\n"); 697 IWL_ERROR("No space for Tx\n");
692 return -ENOSPC; 698 return -ENOSPC;
@@ -1580,7 +1586,7 @@ static inline int iwl3945_eeprom_acquire_semaphore(struct iwl3945_priv *priv)
1580 */ 1586 */
1581int iwl3945_eeprom_init(struct iwl3945_priv *priv) 1587int iwl3945_eeprom_init(struct iwl3945_priv *priv)
1582{ 1588{
1583 __le16 *e = (__le16 *)&priv->eeprom; 1589 u16 *e = (u16 *)&priv->eeprom;
1584 u32 gp = iwl3945_read32(priv, CSR_EEPROM_GP); 1590 u32 gp = iwl3945_read32(priv, CSR_EEPROM_GP);
1585 u32 r; 1591 u32 r;
1586 int sz = sizeof(priv->eeprom); 1592 int sz = sizeof(priv->eeprom);
@@ -1623,7 +1629,7 @@ int iwl3945_eeprom_init(struct iwl3945_priv *priv)
1623 IWL_ERROR("Time out reading EEPROM[%d]", addr); 1629 IWL_ERROR("Time out reading EEPROM[%d]", addr);
1624 return -ETIMEDOUT; 1630 return -ETIMEDOUT;
1625 } 1631 }
1626 e[addr / 2] = cpu_to_le16(r >> 16); 1632 e[addr / 2] = le16_to_cpu((__force __le16)(r >> 16));
1627 } 1633 }
1628 1634
1629 return 0; 1635 return 0;
@@ -2806,7 +2812,8 @@ static int iwl3945_tx_skb(struct iwl3945_priv *priv,
2806#endif 2812#endif
2807 2813
2808 /* drop all data frame if we are not associated */ 2814 /* drop all data frame if we are not associated */
2809 if ((!iwl3945_is_associated(priv) || !priv->assoc_id) && 2815 if ((!iwl3945_is_associated(priv) ||
2816 ((priv->iw_mode == IEEE80211_IF_TYPE_STA) && !priv->assoc_id)) &&
2810 ((fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_DATA)) { 2817 ((fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_DATA)) {
2811 IWL_DEBUG_DROP("Dropping - !iwl3945_is_associated\n"); 2818 IWL_DEBUG_DROP("Dropping - !iwl3945_is_associated\n");
2812 goto drop_unlock; 2819 goto drop_unlock;
@@ -4281,7 +4288,7 @@ static void iwl3945_rx_handle(struct iwl3945_priv *priv)
4281 int reclaim; 4288 int reclaim;
4282 unsigned long flags; 4289 unsigned long flags;
4283 u8 fill_rx = 0; 4290 u8 fill_rx = 0;
4284 u32 count = 0; 4291 u32 count = 8;
4285 4292
4286 /* uCode's read index (stored in shared DRAM) indicates the last Rx 4293 /* uCode's read index (stored in shared DRAM) indicates the last Rx
4287 * buffer that the driver may process (last buffer filled by ucode). */ 4294 * buffer that the driver may process (last buffer filled by ucode). */
@@ -6256,6 +6263,8 @@ static void __iwl3945_down(struct iwl3945_priv *priv)
6256 STATUS_RF_KILL_HW | 6263 STATUS_RF_KILL_HW |
6257 test_bit(STATUS_RF_KILL_SW, &priv->status) << 6264 test_bit(STATUS_RF_KILL_SW, &priv->status) <<
6258 STATUS_RF_KILL_SW | 6265 STATUS_RF_KILL_SW |
6266 test_bit(STATUS_GEO_CONFIGURED, &priv->status) <<
6267 STATUS_GEO_CONFIGURED |
6259 test_bit(STATUS_IN_SUSPEND, &priv->status) << 6268 test_bit(STATUS_IN_SUSPEND, &priv->status) <<
6260 STATUS_IN_SUSPEND; 6269 STATUS_IN_SUSPEND;
6261 goto exit; 6270 goto exit;
@@ -6267,6 +6276,8 @@ static void __iwl3945_down(struct iwl3945_priv *priv)
6267 STATUS_RF_KILL_HW | 6276 STATUS_RF_KILL_HW |
6268 test_bit(STATUS_RF_KILL_SW, &priv->status) << 6277 test_bit(STATUS_RF_KILL_SW, &priv->status) <<
6269 STATUS_RF_KILL_SW | 6278 STATUS_RF_KILL_SW |
6279 test_bit(STATUS_GEO_CONFIGURED, &priv->status) <<
6280 STATUS_GEO_CONFIGURED |
6270 test_bit(STATUS_IN_SUSPEND, &priv->status) << 6281 test_bit(STATUS_IN_SUSPEND, &priv->status) <<
6271 STATUS_IN_SUSPEND | 6282 STATUS_IN_SUSPEND |
6272 test_bit(STATUS_FW_ERROR, &priv->status) << 6283 test_bit(STATUS_FW_ERROR, &priv->status) <<
diff --git a/drivers/net/wireless/iwlwifi/iwl4965-base.c b/drivers/net/wireless/iwlwifi/iwl4965-base.c
index f423241b9567..a23d4798653b 100644
--- a/drivers/net/wireless/iwlwifi/iwl4965-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl4965-base.c
@@ -692,6 +692,11 @@ static int iwl4965_enqueue_hcmd(struct iwl4965_priv *priv, struct iwl4965_host_c
692 BUG_ON((fix_size > TFD_MAX_PAYLOAD_SIZE) && 692 BUG_ON((fix_size > TFD_MAX_PAYLOAD_SIZE) &&
693 !(cmd->meta.flags & CMD_SIZE_HUGE)); 693 !(cmd->meta.flags & CMD_SIZE_HUGE));
694 694
695 if (iwl4965_is_rfkill(priv)) {
696 IWL_DEBUG_INFO("Not sending command - RF KILL");
697 return -EIO;
698 }
699
695 if (iwl4965_queue_space(q) < ((cmd->meta.flags & CMD_ASYNC) ? 2 : 1)) { 700 if (iwl4965_queue_space(q) < ((cmd->meta.flags & CMD_ASYNC) ? 2 : 1)) {
696 IWL_ERROR("No space for Tx\n"); 701 IWL_ERROR("No space for Tx\n");
697 return -ENOSPC; 702 return -ENOSPC;
@@ -1654,7 +1659,7 @@ static inline void iwl4965_eeprom_release_semaphore(struct iwl4965_priv *priv)
1654 */ 1659 */
1655int iwl4965_eeprom_init(struct iwl4965_priv *priv) 1660int iwl4965_eeprom_init(struct iwl4965_priv *priv)
1656{ 1661{
1657 __le16 *e = (__le16 *)&priv->eeprom; 1662 u16 *e = (u16 *)&priv->eeprom;
1658 u32 gp = iwl4965_read32(priv, CSR_EEPROM_GP); 1663 u32 gp = iwl4965_read32(priv, CSR_EEPROM_GP);
1659 u32 r; 1664 u32 r;
1660 int sz = sizeof(priv->eeprom); 1665 int sz = sizeof(priv->eeprom);
@@ -1698,7 +1703,7 @@ int iwl4965_eeprom_init(struct iwl4965_priv *priv)
1698 rc = -ETIMEDOUT; 1703 rc = -ETIMEDOUT;
1699 goto done; 1704 goto done;
1700 } 1705 }
1701 e[addr / 2] = cpu_to_le16(r >> 16); 1706 e[addr / 2] = le16_to_cpu((__force __le16)(r >> 16));
1702 } 1707 }
1703 rc = 0; 1708 rc = 0;
1704 1709
@@ -2935,7 +2940,7 @@ static int iwl4965_tx_skb(struct iwl4965_priv *priv,
2935 /* drop all data frame if we are not associated */ 2940 /* drop all data frame if we are not associated */
2936 if (((fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_DATA) && 2941 if (((fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_DATA) &&
2937 (!iwl4965_is_associated(priv) || 2942 (!iwl4965_is_associated(priv) ||
2938 !priv->assoc_id || 2943 ((priv->iw_mode == IEEE80211_IF_TYPE_STA) && !priv->assoc_id) ||
2939 !priv->assoc_station_added)) { 2944 !priv->assoc_station_added)) {
2940 IWL_DEBUG_DROP("Dropping - !iwl4965_is_associated\n"); 2945 IWL_DEBUG_DROP("Dropping - !iwl4965_is_associated\n");
2941 goto drop_unlock; 2946 goto drop_unlock;
@@ -4664,7 +4669,7 @@ static void iwl4965_rx_handle(struct iwl4965_priv *priv)
4664 int reclaim; 4669 int reclaim;
4665 unsigned long flags; 4670 unsigned long flags;
4666 u8 fill_rx = 0; 4671 u8 fill_rx = 0;
4667 u32 count = 0; 4672 u32 count = 8;
4668 4673
4669 /* uCode's read index (stored in shared DRAM) indicates the last Rx 4674 /* uCode's read index (stored in shared DRAM) indicates the last Rx
4670 * buffer that the driver may process (last buffer filled by ucode). */ 4675 * buffer that the driver may process (last buffer filled by ucode). */
@@ -6680,6 +6685,8 @@ static void __iwl4965_down(struct iwl4965_priv *priv)
6680 STATUS_RF_KILL_HW | 6685 STATUS_RF_KILL_HW |
6681 test_bit(STATUS_RF_KILL_SW, &priv->status) << 6686 test_bit(STATUS_RF_KILL_SW, &priv->status) <<
6682 STATUS_RF_KILL_SW | 6687 STATUS_RF_KILL_SW |
6688 test_bit(STATUS_GEO_CONFIGURED, &priv->status) <<
6689 STATUS_GEO_CONFIGURED |
6683 test_bit(STATUS_IN_SUSPEND, &priv->status) << 6690 test_bit(STATUS_IN_SUSPEND, &priv->status) <<
6684 STATUS_IN_SUSPEND; 6691 STATUS_IN_SUSPEND;
6685 goto exit; 6692 goto exit;
@@ -6691,6 +6698,8 @@ static void __iwl4965_down(struct iwl4965_priv *priv)
6691 STATUS_RF_KILL_HW | 6698 STATUS_RF_KILL_HW |
6692 test_bit(STATUS_RF_KILL_SW, &priv->status) << 6699 test_bit(STATUS_RF_KILL_SW, &priv->status) <<
6693 STATUS_RF_KILL_SW | 6700 STATUS_RF_KILL_SW |
6701 test_bit(STATUS_GEO_CONFIGURED, &priv->status) <<
6702 STATUS_GEO_CONFIGURED |
6694 test_bit(STATUS_IN_SUSPEND, &priv->status) << 6703 test_bit(STATUS_IN_SUSPEND, &priv->status) <<
6695 STATUS_IN_SUSPEND | 6704 STATUS_IN_SUSPEND |
6696 test_bit(STATUS_FW_ERROR, &priv->status) << 6705 test_bit(STATUS_FW_ERROR, &priv->status) <<
diff --git a/drivers/net/wireless/rndis_wlan.c b/drivers/net/wireless/rndis_wlan.c
index d3ecf89abd93..8ce2ddf8024f 100644
--- a/drivers/net/wireless/rndis_wlan.c
+++ b/drivers/net/wireless/rndis_wlan.c
@@ -2300,7 +2300,7 @@ static void rndis_update_wireless_stats(struct work_struct *work)
2300 struct usbnet *usbdev = priv->usbdev; 2300 struct usbnet *usbdev = priv->usbdev;
2301 struct iw_statistics iwstats; 2301 struct iw_statistics iwstats;
2302 __le32 rssi, tmp; 2302 __le32 rssi, tmp;
2303 int len, ret, bitrate, j; 2303 int len, ret, j;
2304 unsigned long flags; 2304 unsigned long flags;
2305 int update_jiffies = STATS_UPDATE_JIFFIES; 2305 int update_jiffies = STATS_UPDATE_JIFFIES;
2306 void *buf; 2306 void *buf;
@@ -2352,14 +2352,10 @@ static void rndis_update_wireless_stats(struct work_struct *work)
2352 if (ret == 0) 2352 if (ret == 0)
2353 iwstats.discard.misc += le32_to_cpu(tmp); 2353 iwstats.discard.misc += le32_to_cpu(tmp);
2354 2354
2355 /* Workaround transfer stalls on poor quality links. */ 2355 /* Workaround transfer stalls on poor quality links.
2356 len = sizeof(tmp); 2356 * TODO: find right way to fix these stalls (as stalls do not happen
2357 ret = rndis_query_oid(usbdev, OID_GEN_LINK_SPEED, &tmp, &len); 2357 * with ndiswrapper/windows driver). */
2358 if (ret == 0) { 2358 if (iwstats.qual.qual <= 25) {
2359 bitrate = le32_to_cpu(tmp) * 100;
2360 if (bitrate > 11000000)
2361 goto end;
2362
2363 /* Decrease stats worker interval to catch stalls. 2359 /* Decrease stats worker interval to catch stalls.
2364 * faster. Faster than 400-500ms causes packet loss, 2360 * faster. Faster than 400-500ms causes packet loss,
2365 * Slower doesn't catch stalls fast enough. 2361 * Slower doesn't catch stalls fast enough.
diff --git a/drivers/net/wireless/rt2x00/rt2500usb.c b/drivers/net/wireless/rt2x00/rt2500usb.c
index 86ded4066f5b..4ca9730e5e92 100644
--- a/drivers/net/wireless/rt2x00/rt2500usb.c
+++ b/drivers/net/wireless/rt2x00/rt2500usb.c
@@ -1839,11 +1839,11 @@ static struct usb_device_id rt2500usb_device_table[] = {
1839 /* Hercules */ 1839 /* Hercules */
1840 { USB_DEVICE(0x06f8, 0xe000), USB_DEVICE_DATA(&rt2500usb_ops) }, 1840 { USB_DEVICE(0x06f8, 0xe000), USB_DEVICE_DATA(&rt2500usb_ops) },
1841 /* Melco */ 1841 /* Melco */
1842 { USB_DEVICE(0x0411, 0x005e), USB_DEVICE_DATA(&rt2500usb_ops) },
1842 { USB_DEVICE(0x0411, 0x0066), USB_DEVICE_DATA(&rt2500usb_ops) }, 1843 { USB_DEVICE(0x0411, 0x0066), USB_DEVICE_DATA(&rt2500usb_ops) },
1843 { USB_DEVICE(0x0411, 0x0067), USB_DEVICE_DATA(&rt2500usb_ops) }, 1844 { USB_DEVICE(0x0411, 0x0067), USB_DEVICE_DATA(&rt2500usb_ops) },
1844 { USB_DEVICE(0x0411, 0x008b), USB_DEVICE_DATA(&rt2500usb_ops) }, 1845 { USB_DEVICE(0x0411, 0x008b), USB_DEVICE_DATA(&rt2500usb_ops) },
1845 { USB_DEVICE(0x0411, 0x0097), USB_DEVICE_DATA(&rt2500usb_ops) }, 1846 { USB_DEVICE(0x0411, 0x0097), USB_DEVICE_DATA(&rt2500usb_ops) },
1846
1847 /* MSI */ 1847 /* MSI */
1848 { USB_DEVICE(0x0db0, 0x6861), USB_DEVICE_DATA(&rt2500usb_ops) }, 1848 { USB_DEVICE(0x0db0, 0x6861), USB_DEVICE_DATA(&rt2500usb_ops) },
1849 { USB_DEVICE(0x0db0, 0x6865), USB_DEVICE_DATA(&rt2500usb_ops) }, 1849 { USB_DEVICE(0x0db0, 0x6865), USB_DEVICE_DATA(&rt2500usb_ops) },
diff --git a/drivers/net/wireless/wavelan.h b/drivers/net/wireless/wavelan.h
index 27172cde5a39..9ab360558ffd 100644
--- a/drivers/net/wireless/wavelan.h
+++ b/drivers/net/wireless/wavelan.h
@@ -85,7 +85,7 @@ union hacs_u
85#define HASR_MMC_INTR 0x0002 /* Interrupt request from MMC */ 85#define HASR_MMC_INTR 0x0002 /* Interrupt request from MMC */
86#define HASR_MMC_BUSY 0x0004 /* MMC busy indication */ 86#define HASR_MMC_BUSY 0x0004 /* MMC busy indication */
87#define HASR_PSA_BUSY 0x0008 /* LAN parameter storage area busy */ 87#define HASR_PSA_BUSY 0x0008 /* LAN parameter storage area busy */
88}; 88} __attribute__ ((packed));
89 89
90typedef struct ha_t ha_t; 90typedef struct ha_t ha_t;
91struct ha_t 91struct ha_t
@@ -292,7 +292,7 @@ struct mmw_t
292#define MMW_EXT_ANT_INTERNAL 0x00 /* Internal antenna */ 292#define MMW_EXT_ANT_INTERNAL 0x00 /* Internal antenna */
293#define MMW_EXT_ANT_EXTERNAL 0x03 /* External antenna */ 293#define MMW_EXT_ANT_EXTERNAL 0x03 /* External antenna */
294#define MMW_EXT_ANT_IQ_TEST 0x1C /* IQ test pattern (set to 0) */ 294#define MMW_EXT_ANT_IQ_TEST 0x1C /* IQ test pattern (set to 0) */
295}; 295} __attribute__ ((packed));
296 296
297#define MMW_SIZE 37 297#define MMW_SIZE 37
298 298
@@ -347,7 +347,7 @@ struct mmr_t
347 unsigned char mmr_unused4[1]; /* unused */ 347 unsigned char mmr_unused4[1]; /* unused */
348 unsigned char mmr_fee_data_l; /* Read data from EEPROM (low) */ 348 unsigned char mmr_fee_data_l; /* Read data from EEPROM (low) */
349 unsigned char mmr_fee_data_h; /* Read data from EEPROM (high) */ 349 unsigned char mmr_fee_data_h; /* Read data from EEPROM (high) */
350}; 350} __attribute__ ((packed));
351 351
352#define MMR_SIZE 36 352#define MMR_SIZE 36
353 353
diff --git a/drivers/s390/block/dasd.c b/drivers/s390/block/dasd.c
index d984e0fae630..ccf46c96adb4 100644
--- a/drivers/s390/block/dasd.c
+++ b/drivers/s390/block/dasd.c
@@ -1149,12 +1149,14 @@ static void __dasd_device_process_final_queue(struct dasd_device *device,
1149{ 1149{
1150 struct list_head *l, *n; 1150 struct list_head *l, *n;
1151 struct dasd_ccw_req *cqr; 1151 struct dasd_ccw_req *cqr;
1152 struct dasd_block *block;
1152 1153
1153 list_for_each_safe(l, n, final_queue) { 1154 list_for_each_safe(l, n, final_queue) {
1154 cqr = list_entry(l, struct dasd_ccw_req, devlist); 1155 cqr = list_entry(l, struct dasd_ccw_req, devlist);
1155 list_del_init(&cqr->devlist); 1156 list_del_init(&cqr->devlist);
1156 if (cqr->block) 1157 block = cqr->block;
1157 spin_lock_bh(&cqr->block->queue_lock); 1158 if (block)
1159 spin_lock_bh(&block->queue_lock);
1158 switch (cqr->status) { 1160 switch (cqr->status) {
1159 case DASD_CQR_SUCCESS: 1161 case DASD_CQR_SUCCESS:
1160 cqr->status = DASD_CQR_DONE; 1162 cqr->status = DASD_CQR_DONE;
@@ -1172,15 +1174,13 @@ static void __dasd_device_process_final_queue(struct dasd_device *device,
1172 cqr, cqr->status); 1174 cqr, cqr->status);
1173 BUG(); 1175 BUG();
1174 } 1176 }
1175 if (cqr->block)
1176 spin_unlock_bh(&cqr->block->queue_lock);
1177 if (cqr->callback != NULL) 1177 if (cqr->callback != NULL)
1178 (cqr->callback)(cqr, cqr->callback_data); 1178 (cqr->callback)(cqr, cqr->callback_data);
1179 if (block)
1180 spin_unlock_bh(&block->queue_lock);
1179 } 1181 }
1180} 1182}
1181 1183
1182
1183
1184/* 1184/*
1185 * Take a look at the first request on the ccw queue and check 1185 * Take a look at the first request on the ccw queue and check
1186 * if it reached its expire time. If so, terminate the IO. 1186 * if it reached its expire time. If so, terminate the IO.
diff --git a/drivers/s390/block/dcssblk.c b/drivers/s390/block/dcssblk.c
index 3faf0538b328..e6c94dbfdeaa 100644
--- a/drivers/s390/block/dcssblk.c
+++ b/drivers/s390/block/dcssblk.c
@@ -666,7 +666,7 @@ dcssblk_make_request(struct request_queue *q, struct bio *bio)
666 page_addr = (unsigned long) 666 page_addr = (unsigned long)
667 page_address(bvec->bv_page) + bvec->bv_offset; 667 page_address(bvec->bv_page) + bvec->bv_offset;
668 source_addr = dev_info->start + (index<<12) + bytes_done; 668 source_addr = dev_info->start + (index<<12) + bytes_done;
669 if (unlikely(page_addr & 4095) != 0 || (bvec->bv_len & 4095) != 0) 669 if (unlikely((page_addr & 4095) != 0) || (bvec->bv_len & 4095) != 0)
670 // More paranoia. 670 // More paranoia.
671 goto fail; 671 goto fail;
672 if (bio_data_dir(bio) == READ) { 672 if (bio_data_dir(bio) == READ) {
diff --git a/drivers/s390/char/sclp.c b/drivers/s390/char/sclp.c
index 25629b92dec3..2c7a1ee6b041 100644
--- a/drivers/s390/char/sclp.c
+++ b/drivers/s390/char/sclp.c
@@ -29,10 +29,10 @@ static ext_int_info_t ext_int_info_hwc;
29/* Lock to protect internal data consistency. */ 29/* Lock to protect internal data consistency. */
30static DEFINE_SPINLOCK(sclp_lock); 30static DEFINE_SPINLOCK(sclp_lock);
31 31
32/* Mask of events that we can receive from the sclp interface. */ 32/* Mask of events that we can send to the sclp interface. */
33static sccb_mask_t sclp_receive_mask; 33static sccb_mask_t sclp_receive_mask;
34 34
35/* Mask of events that we can send to the sclp interface. */ 35/* Mask of events that we can receive from the sclp interface. */
36static sccb_mask_t sclp_send_mask; 36static sccb_mask_t sclp_send_mask;
37 37
38/* List of registered event listeners and senders. */ 38/* List of registered event listeners and senders. */
@@ -380,7 +380,7 @@ sclp_interrupt_handler(__u16 code)
380 } 380 }
381 sclp_running_state = sclp_running_state_idle; 381 sclp_running_state = sclp_running_state_idle;
382 } 382 }
383 if (evbuf_pending && sclp_receive_mask != 0 && 383 if (evbuf_pending &&
384 sclp_activation_state == sclp_activation_state_active) 384 sclp_activation_state == sclp_activation_state_active)
385 __sclp_queue_read_req(); 385 __sclp_queue_read_req();
386 spin_unlock(&sclp_lock); 386 spin_unlock(&sclp_lock);
@@ -459,8 +459,8 @@ sclp_dispatch_state_change(void)
459 reg = NULL; 459 reg = NULL;
460 list_for_each(l, &sclp_reg_list) { 460 list_for_each(l, &sclp_reg_list) {
461 reg = list_entry(l, struct sclp_register, list); 461 reg = list_entry(l, struct sclp_register, list);
462 receive_mask = reg->receive_mask & sclp_receive_mask; 462 receive_mask = reg->send_mask & sclp_receive_mask;
463 send_mask = reg->send_mask & sclp_send_mask; 463 send_mask = reg->receive_mask & sclp_send_mask;
464 if (reg->sclp_receive_mask != receive_mask || 464 if (reg->sclp_receive_mask != receive_mask ||
465 reg->sclp_send_mask != send_mask) { 465 reg->sclp_send_mask != send_mask) {
466 reg->sclp_receive_mask = receive_mask; 466 reg->sclp_receive_mask = receive_mask;
@@ -615,8 +615,8 @@ struct init_sccb {
615 u16 mask_length; 615 u16 mask_length;
616 sccb_mask_t receive_mask; 616 sccb_mask_t receive_mask;
617 sccb_mask_t send_mask; 617 sccb_mask_t send_mask;
618 sccb_mask_t sclp_send_mask;
619 sccb_mask_t sclp_receive_mask; 618 sccb_mask_t sclp_receive_mask;
619 sccb_mask_t sclp_send_mask;
620} __attribute__((packed)); 620} __attribute__((packed));
621 621
622/* Prepare init mask request. Called while sclp_lock is locked. */ 622/* Prepare init mask request. Called while sclp_lock is locked. */
diff --git a/drivers/s390/char/sclp.h b/drivers/s390/char/sclp.h
index aa8186d18aee..bac80e856f97 100644
--- a/drivers/s390/char/sclp.h
+++ b/drivers/s390/char/sclp.h
@@ -122,11 +122,13 @@ struct sclp_req {
122/* of some routines it wants to be called from the low level driver */ 122/* of some routines it wants to be called from the low level driver */
123struct sclp_register { 123struct sclp_register {
124 struct list_head list; 124 struct list_head list;
125 /* event masks this user is registered for */ 125 /* User wants to receive: */
126 sccb_mask_t receive_mask; 126 sccb_mask_t receive_mask;
127 /* User wants to send: */
127 sccb_mask_t send_mask; 128 sccb_mask_t send_mask;
128 /* actually present events */ 129 /* H/W can receive: */
129 sccb_mask_t sclp_receive_mask; 130 sccb_mask_t sclp_receive_mask;
131 /* H/W can send: */
130 sccb_mask_t sclp_send_mask; 132 sccb_mask_t sclp_send_mask;
131 /* called if event type availability changes */ 133 /* called if event type availability changes */
132 void (*state_change_fn)(struct sclp_register *); 134 void (*state_change_fn)(struct sclp_register *);
diff --git a/drivers/s390/char/sclp_config.c b/drivers/s390/char/sclp_config.c
index 9dc77f14fa52..b8f35bc52b7b 100644
--- a/drivers/s390/char/sclp_config.c
+++ b/drivers/s390/char/sclp_config.c
@@ -64,7 +64,7 @@ static int __init sclp_conf_init(void)
64 return rc; 64 return rc;
65 } 65 }
66 66
67 if (!(sclp_conf_register.sclp_receive_mask & EVTYP_CONFMGMDATA_MASK)) { 67 if (!(sclp_conf_register.sclp_send_mask & EVTYP_CONFMGMDATA_MASK)) {
68 printk(KERN_WARNING TAG "no configuration management.\n"); 68 printk(KERN_WARNING TAG "no configuration management.\n");
69 sclp_unregister(&sclp_conf_register); 69 sclp_unregister(&sclp_conf_register);
70 rc = -ENOSYS; 70 rc = -ENOSYS;
diff --git a/drivers/s390/char/sclp_cpi_sys.c b/drivers/s390/char/sclp_cpi_sys.c
index 41617032afdc..9f37456222e9 100644
--- a/drivers/s390/char/sclp_cpi_sys.c
+++ b/drivers/s390/char/sclp_cpi_sys.c
@@ -129,7 +129,7 @@ static int cpi_req(void)
129 "to hardware console.\n"); 129 "to hardware console.\n");
130 goto out; 130 goto out;
131 } 131 }
132 if (!(sclp_cpi_event.sclp_send_mask & EVTYP_CTLPROGIDENT_MASK)) { 132 if (!(sclp_cpi_event.sclp_receive_mask & EVTYP_CTLPROGIDENT_MASK)) {
133 printk(KERN_WARNING "cpi: no control program " 133 printk(KERN_WARNING "cpi: no control program "
134 "identification support\n"); 134 "identification support\n");
135 rc = -EOPNOTSUPP; 135 rc = -EOPNOTSUPP;
diff --git a/drivers/s390/char/sclp_rw.c b/drivers/s390/char/sclp_rw.c
index ad7195d3de0c..da09781b32f7 100644
--- a/drivers/s390/char/sclp_rw.c
+++ b/drivers/s390/char/sclp_rw.c
@@ -452,10 +452,10 @@ sclp_emit_buffer(struct sclp_buffer *buffer,
452 return -EIO; 452 return -EIO;
453 453
454 sccb = buffer->sccb; 454 sccb = buffer->sccb;
455 if (sclp_rw_event.sclp_send_mask & EVTYP_MSG_MASK) 455 if (sclp_rw_event.sclp_receive_mask & EVTYP_MSG_MASK)
456 /* Use normal write message */ 456 /* Use normal write message */
457 sccb->msg_buf.header.type = EVTYP_MSG; 457 sccb->msg_buf.header.type = EVTYP_MSG;
458 else if (sclp_rw_event.sclp_send_mask & EVTYP_PMSGCMD_MASK) 458 else if (sclp_rw_event.sclp_receive_mask & EVTYP_PMSGCMD_MASK)
459 /* Use write priority message */ 459 /* Use write priority message */
460 sccb->msg_buf.header.type = EVTYP_PMSGCMD; 460 sccb->msg_buf.header.type = EVTYP_PMSGCMD;
461 else 461 else
diff --git a/drivers/s390/char/sclp_vt220.c b/drivers/s390/char/sclp_vt220.c
index f47f4a768be5..92f527201792 100644
--- a/drivers/s390/char/sclp_vt220.c
+++ b/drivers/s390/char/sclp_vt220.c
@@ -202,7 +202,7 @@ sclp_vt220_callback(struct sclp_req *request, void *data)
202static int 202static int
203__sclp_vt220_emit(struct sclp_vt220_request *request) 203__sclp_vt220_emit(struct sclp_vt220_request *request)
204{ 204{
205 if (!(sclp_vt220_register.sclp_send_mask & EVTYP_VT220MSG_MASK)) { 205 if (!(sclp_vt220_register.sclp_receive_mask & EVTYP_VT220MSG_MASK)) {
206 request->sclp_req.status = SCLP_REQ_FAILED; 206 request->sclp_req.status = SCLP_REQ_FAILED;
207 return -EIO; 207 return -EIO;
208 } 208 }
diff --git a/drivers/s390/cio/device.c b/drivers/s390/cio/device.c
index d35dc3f25d06..fec004f62bcf 100644
--- a/drivers/s390/cio/device.c
+++ b/drivers/s390/cio/device.c
@@ -32,7 +32,7 @@
32#include "io_sch.h" 32#include "io_sch.h"
33 33
34static struct timer_list recovery_timer; 34static struct timer_list recovery_timer;
35static spinlock_t recovery_lock; 35static DEFINE_SPINLOCK(recovery_lock);
36static int recovery_phase; 36static int recovery_phase;
37static const unsigned long recovery_delay[] = { 3, 30, 300 }; 37static const unsigned long recovery_delay[] = { 3, 30, 300 };
38 38
@@ -1535,7 +1535,7 @@ static int recovery_check(struct device *dev, void *data)
1535 return 0; 1535 return 0;
1536} 1536}
1537 1537
1538static void recovery_func(unsigned long data) 1538static void recovery_work_func(struct work_struct *unused)
1539{ 1539{
1540 int redo = 0; 1540 int redo = 0;
1541 1541
@@ -1553,6 +1553,17 @@ static void recovery_func(unsigned long data)
1553 CIO_MSG_EVENT(2, "recovery: end\n"); 1553 CIO_MSG_EVENT(2, "recovery: end\n");
1554} 1554}
1555 1555
1556static DECLARE_WORK(recovery_work, recovery_work_func);
1557
1558static void recovery_func(unsigned long data)
1559{
1560 /*
1561 * We can't do our recovery in softirq context and it's not
1562 * performance critical, so we schedule it.
1563 */
1564 schedule_work(&recovery_work);
1565}
1566
1556void ccw_device_schedule_recovery(void) 1567void ccw_device_schedule_recovery(void)
1557{ 1568{
1558 unsigned long flags; 1569 unsigned long flags;
diff --git a/drivers/s390/cio/qdio.c b/drivers/s390/cio/qdio.c
index 097fc0967e9d..2b5bfb7c69e5 100644
--- a/drivers/s390/cio/qdio.c
+++ b/drivers/s390/cio/qdio.c
@@ -32,7 +32,7 @@
32 32
33#include <linux/module.h> 33#include <linux/module.h>
34#include <linux/init.h> 34#include <linux/init.h>
35 35#include <linux/delay.h>
36#include <linux/slab.h> 36#include <linux/slab.h>
37#include <linux/kernel.h> 37#include <linux/kernel.h>
38#include <linux/proc_fs.h> 38#include <linux/proc_fs.h>
@@ -1215,9 +1215,6 @@ tiqdio_is_inbound_q_done(struct qdio_q *q)
1215 1215
1216 if (!no_used) 1216 if (!no_used)
1217 return 1; 1217 return 1;
1218 if (!q->siga_sync && !irq->is_qebsm)
1219 /* we'll check for more primed buffers in qeth_stop_polling */
1220 return 0;
1221 if (irq->is_qebsm) { 1218 if (irq->is_qebsm) {
1222 count = 1; 1219 count = 1;
1223 start_buf = q->first_to_check; 1220 start_buf = q->first_to_check;
@@ -3332,13 +3329,7 @@ qdio_activate(struct ccw_device *cdev, int flags)
3332 } 3329 }
3333 } 3330 }
3334 3331
3335 wait_event_interruptible_timeout(cdev->private->wait_q, 3332 msleep(QDIO_ACTIVATE_TIMEOUT);
3336 ((irq_ptr->state ==
3337 QDIO_IRQ_STATE_STOPPED) ||
3338 (irq_ptr->state ==
3339 QDIO_IRQ_STATE_ERR)),
3340 QDIO_ACTIVATE_TIMEOUT);
3341
3342 switch (irq_ptr->state) { 3333 switch (irq_ptr->state) {
3343 case QDIO_IRQ_STATE_STOPPED: 3334 case QDIO_IRQ_STATE_STOPPED:
3344 case QDIO_IRQ_STATE_ERR: 3335 case QDIO_IRQ_STATE_ERR:
diff --git a/drivers/s390/cio/qdio.h b/drivers/s390/cio/qdio.h
index 37870e4e938e..da8a272fd75b 100644
--- a/drivers/s390/cio/qdio.h
+++ b/drivers/s390/cio/qdio.h
@@ -57,10 +57,10 @@
57 of the queue to 0 */ 57 of the queue to 0 */
58 58
59#define QDIO_ESTABLISH_TIMEOUT (1*HZ) 59#define QDIO_ESTABLISH_TIMEOUT (1*HZ)
60#define QDIO_ACTIVATE_TIMEOUT (5*HZ)
61#define QDIO_CLEANUP_CLEAR_TIMEOUT (20*HZ) 60#define QDIO_CLEANUP_CLEAR_TIMEOUT (20*HZ)
62#define QDIO_CLEANUP_HALT_TIMEOUT (10*HZ) 61#define QDIO_CLEANUP_HALT_TIMEOUT (10*HZ)
63#define QDIO_FORCE_CHECK_TIMEOUT (10*HZ) 62#define QDIO_FORCE_CHECK_TIMEOUT (10*HZ)
63#define QDIO_ACTIVATE_TIMEOUT (5) /* 5 ms */
64 64
65enum qdio_irq_states { 65enum qdio_irq_states {
66 QDIO_IRQ_STATE_INACTIVE, 66 QDIO_IRQ_STATE_INACTIVE,
diff --git a/drivers/scsi/ipr.c b/drivers/scsi/ipr.c
index 2074701f7e76..c72014a3e7d4 100644
--- a/drivers/scsi/ipr.c
+++ b/drivers/scsi/ipr.c
@@ -5140,7 +5140,7 @@ static void ipr_build_ata_ioadl(struct ipr_cmnd *ipr_cmd,
5140 struct ipr_ioarcb *ioarcb = &ipr_cmd->ioarcb; 5140 struct ipr_ioarcb *ioarcb = &ipr_cmd->ioarcb;
5141 struct ipr_ioadl_desc *ioadl = ipr_cmd->ioadl; 5141 struct ipr_ioadl_desc *ioadl = ipr_cmd->ioadl;
5142 struct ipr_ioadl_desc *last_ioadl = NULL; 5142 struct ipr_ioadl_desc *last_ioadl = NULL;
5143 int len = qc->nbytes + qc->pad_len; 5143 int len = qc->nbytes;
5144 struct scatterlist *sg; 5144 struct scatterlist *sg;
5145 unsigned int si; 5145 unsigned int si;
5146 5146
@@ -5206,7 +5206,7 @@ static unsigned int ipr_qc_issue(struct ata_queued_cmd *qc)
5206 ioarcb->cmd_pkt.request_type = IPR_RQTYPE_ATA_PASSTHRU; 5206 ioarcb->cmd_pkt.request_type = IPR_RQTYPE_ATA_PASSTHRU;
5207 ioarcb->cmd_pkt.flags_hi |= IPR_FLAGS_HI_NO_LINK_DESC; 5207 ioarcb->cmd_pkt.flags_hi |= IPR_FLAGS_HI_NO_LINK_DESC;
5208 ioarcb->cmd_pkt.flags_hi |= IPR_FLAGS_HI_NO_ULEN_CHK; 5208 ioarcb->cmd_pkt.flags_hi |= IPR_FLAGS_HI_NO_ULEN_CHK;
5209 ipr_cmd->dma_use_sg = qc->pad_len ? qc->n_elem + 1 : qc->n_elem; 5209 ipr_cmd->dma_use_sg = qc->n_elem;
5210 5210
5211 ipr_build_ata_ioadl(ipr_cmd, qc); 5211 ipr_build_ata_ioadl(ipr_cmd, qc);
5212 regs->flags |= IPR_ATA_FLAG_STATUS_ON_GOOD_COMPLETION; 5212 regs->flags |= IPR_ATA_FLAG_STATUS_ON_GOOD_COMPLETION;
diff --git a/drivers/scsi/libsas/sas_ata.c b/drivers/scsi/libsas/sas_ata.c
index 0996f866f14c..7cd05b599a12 100644
--- a/drivers/scsi/libsas/sas_ata.c
+++ b/drivers/scsi/libsas/sas_ata.c
@@ -178,8 +178,8 @@ static unsigned int sas_ata_qc_issue(struct ata_queued_cmd *qc)
178 task->uldd_task = qc; 178 task->uldd_task = qc;
179 if (ata_is_atapi(qc->tf.protocol)) { 179 if (ata_is_atapi(qc->tf.protocol)) {
180 memcpy(task->ata_task.atapi_packet, qc->cdb, qc->dev->cdb_len); 180 memcpy(task->ata_task.atapi_packet, qc->cdb, qc->dev->cdb_len);
181 task->total_xfer_len = qc->nbytes + qc->pad_len; 181 task->total_xfer_len = qc->nbytes;
182 task->num_scatter = qc->pad_len ? qc->n_elem + 1 : qc->n_elem; 182 task->num_scatter = qc->n_elem;
183 } else { 183 } else {
184 for_each_sg(qc->sg, sg, qc->n_elem, si) 184 for_each_sg(qc->sg, sg, qc->n_elem, si)
185 xfer += sg->length; 185 xfer += sg->length;
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index 135c1d054701..ba21d97d1855 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -1014,10 +1014,6 @@ static int scsi_init_sgtable(struct request *req, struct scsi_data_buffer *sdb,
1014 } 1014 }
1015 1015
1016 req->buffer = NULL; 1016 req->buffer = NULL;
1017 if (blk_pc_request(req))
1018 sdb->length = req->data_len;
1019 else
1020 sdb->length = req->nr_sectors << 9;
1021 1017
1022 /* 1018 /*
1023 * Next, walk the list, and fill in the addresses and sizes of 1019 * Next, walk the list, and fill in the addresses and sizes of
@@ -1026,6 +1022,10 @@ static int scsi_init_sgtable(struct request *req, struct scsi_data_buffer *sdb,
1026 count = blk_rq_map_sg(req->q, req, sdb->table.sgl); 1022 count = blk_rq_map_sg(req->q, req, sdb->table.sgl);
1027 BUG_ON(count > sdb->table.nents); 1023 BUG_ON(count > sdb->table.nents);
1028 sdb->table.nents = count; 1024 sdb->table.nents = count;
1025 if (blk_pc_request(req))
1026 sdb->length = req->data_len;
1027 else
1028 sdb->length = req->nr_sectors << 9;
1029 return BLKPREP_OK; 1029 return BLKPREP_OK;
1030} 1030}
1031 1031
diff --git a/drivers/video/aty/atyfb_base.c b/drivers/video/aty/atyfb_base.c
index d775eb6590b6..62f9c6e387cc 100644
--- a/drivers/video/aty/atyfb_base.c
+++ b/drivers/video/aty/atyfb_base.c
@@ -1913,61 +1913,6 @@ static int atyfb_mmap(struct fb_info *info, struct vm_area_struct *vma)
1913 par->mmaped = 1; 1913 par->mmaped = 1;
1914 return 0; 1914 return 0;
1915} 1915}
1916
1917static struct {
1918 u32 yoffset;
1919 u8 r[2][256];
1920 u8 g[2][256];
1921 u8 b[2][256];
1922} atyfb_save;
1923
1924static void atyfb_save_palette(struct atyfb_par *par, int enter)
1925{
1926 int i, tmp;
1927
1928 for (i = 0; i < 256; i++) {
1929 tmp = aty_ld_8(DAC_CNTL, par) & 0xfc;
1930 if (M64_HAS(EXTRA_BRIGHT))
1931 tmp |= 0x2;
1932 aty_st_8(DAC_CNTL, tmp, par);
1933 aty_st_8(DAC_MASK, 0xff, par);
1934
1935 aty_st_8(DAC_R_INDEX, i, par);
1936 atyfb_save.r[enter][i] = aty_ld_8(DAC_DATA, par);
1937 atyfb_save.g[enter][i] = aty_ld_8(DAC_DATA, par);
1938 atyfb_save.b[enter][i] = aty_ld_8(DAC_DATA, par);
1939 aty_st_8(DAC_W_INDEX, i, par);
1940 aty_st_8(DAC_DATA, atyfb_save.r[1 - enter][i], par);
1941 aty_st_8(DAC_DATA, atyfb_save.g[1 - enter][i], par);
1942 aty_st_8(DAC_DATA, atyfb_save.b[1 - enter][i], par);
1943 }
1944}
1945
1946static void atyfb_palette(int enter)
1947{
1948 struct atyfb_par *par;
1949 struct fb_info *info;
1950 int i;
1951
1952 for (i = 0; i < FB_MAX; i++) {
1953 info = registered_fb[i];
1954 if (info && info->fbops == &atyfb_ops) {
1955 par = (struct atyfb_par *) info->par;
1956
1957 atyfb_save_palette(par, enter);
1958 if (enter) {
1959 atyfb_save.yoffset = info->var.yoffset;
1960 info->var.yoffset = 0;
1961 set_off_pitch(par, info);
1962 } else {
1963 info->var.yoffset = atyfb_save.yoffset;
1964 set_off_pitch(par, info);
1965 }
1966 aty_st_le32(CRTC_OFF_PITCH, par->crtc.off_pitch, par);
1967 break;
1968 }
1969 }
1970}
1971#endif /* __sparc__ */ 1916#endif /* __sparc__ */
1972 1917
1973 1918
@@ -2670,10 +2615,6 @@ static int __devinit aty_init(struct fb_info *info)
2670 goto aty_init_exit; 2615 goto aty_init_exit;
2671 } 2616 }
2672 2617
2673#ifdef __sparc__
2674 atyfb_save_palette(par, 0);
2675#endif
2676
2677#ifdef CONFIG_FB_ATY_CT 2618#ifdef CONFIG_FB_ATY_CT
2678 if (!noaccel && M64_HAS(INTEGRATED)) 2619 if (!noaccel && M64_HAS(INTEGRATED))
2679 aty_init_cursor(info); 2620 aty_init_cursor(info);
@@ -2900,8 +2841,6 @@ static int atyfb_setcolreg(u_int regno, u_int red, u_int green, u_int blue,
2900 2841
2901#ifdef __sparc__ 2842#ifdef __sparc__
2902 2843
2903extern void (*prom_palette) (int);
2904
2905static int __devinit atyfb_setup_sparc(struct pci_dev *pdev, 2844static int __devinit atyfb_setup_sparc(struct pci_dev *pdev,
2906 struct fb_info *info, unsigned long addr) 2845 struct fb_info *info, unsigned long addr)
2907{ 2846{
@@ -3536,9 +3475,6 @@ static int __devinit atyfb_pci_probe(struct pci_dev *pdev, const struct pci_devi
3536 goto err_release_io; 3475 goto err_release_io;
3537 3476
3538#ifdef __sparc__ 3477#ifdef __sparc__
3539 if (!prom_palette)
3540 prom_palette = atyfb_palette;
3541
3542 /* 3478 /*
3543 * Add /dev/fb mmap values. 3479 * Add /dev/fb mmap values.
3544 */ 3480 */
diff --git a/drivers/video/cg14.c b/drivers/video/cg14.c
index 41f6dbf61be7..fdc9f43ec30a 100644
--- a/drivers/video/cg14.c
+++ b/drivers/video/cg14.c
@@ -16,6 +16,7 @@
16#include <linux/init.h> 16#include <linux/init.h>
17#include <linux/fb.h> 17#include <linux/fb.h>
18#include <linux/mm.h> 18#include <linux/mm.h>
19#include <linux/uaccess.h>
19 20
20#include <asm/io.h> 21#include <asm/io.h>
21#include <asm/prom.h> 22#include <asm/prom.h>
diff --git a/drivers/video/sbuslib.c b/drivers/video/sbuslib.c
index 963a454b7074..4deaac05b938 100644
--- a/drivers/video/sbuslib.c
+++ b/drivers/video/sbuslib.c
@@ -9,6 +9,7 @@
9#include <linux/string.h> 9#include <linux/string.h>
10#include <linux/fb.h> 10#include <linux/fb.h>
11#include <linux/mm.h> 11#include <linux/mm.h>
12#include <linux/uaccess.h>
12 13
13#include <asm/oplib.h> 14#include <asm/oplib.h>
14#include <asm/fbio.h> 15#include <asm/fbio.h>
diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig
index afcdc69e37d6..254d115cafab 100644
--- a/drivers/watchdog/Kconfig
+++ b/drivers/watchdog/Kconfig
@@ -402,6 +402,18 @@ config IT8712F_WDT
402 To compile this driver as a module, choose M here: the 402 To compile this driver as a module, choose M here: the
403 module will be called it8712f_wdt. 403 module will be called it8712f_wdt.
404 404
405config HP_WATCHDOG
406 tristate "HP Proliant iLO 2 Hardware Watchdog Timer"
407 depends on X86
408 help
409 A software monitoring watchdog and NMI sourcing driver. This driver
410 will detect lockups and provide stack trace. Also, when an NMI
411 occurs this driver will make the necessary BIOS calls to log
412 the cause of the NMI. This is a driver that will only load on a
413 HP ProLiant system with a minimum of iLO2 support.
414 To compile this driver as a module, choose M here: the
415 module will be called hpwdt.
416
405config SC1200_WDT 417config SC1200_WDT
406 tristate "National Semiconductor PC87307/PC97307 (ala SC1200) Watchdog" 418 tristate "National Semiconductor PC87307/PC97307 (ala SC1200) Watchdog"
407 depends on X86 419 depends on X86
@@ -633,6 +645,19 @@ config WDT_RM9K_GPI
633 To compile this driver as a module, choose M here: the 645 To compile this driver as a module, choose M here: the
634 module will be called rm9k_wdt. 646 module will be called rm9k_wdt.
635 647
648config SIBYTE_WDOG
649 tristate "Sibyte SoC hardware watchdog"
650 depends on CPU_SB1
651 help
652 Watchdog driver for the built in watchdog hardware in Sibyte
653 SoC processors. There are apparently two watchdog timers
654 on such processors; this driver supports only the first one,
655 because currently Linux only supports exporting one watchdog
656 to userspace.
657
658 To compile this driver as a loadable module, choose M here.
659 The module will be called sb_wdog.
660
636config AR7_WDT 661config AR7_WDT
637 tristate "TI AR7 Watchdog Timer" 662 tristate "TI AR7 Watchdog Timer"
638 depends on AR7 663 depends on AR7
diff --git a/drivers/watchdog/Makefile b/drivers/watchdog/Makefile
index ebc21146d40c..f3fb170fe5c6 100644
--- a/drivers/watchdog/Makefile
+++ b/drivers/watchdog/Makefile
@@ -67,6 +67,7 @@ obj-$(CONFIG_WAFER_WDT) += wafer5823wdt.o
67obj-$(CONFIG_I6300ESB_WDT) += i6300esb.o 67obj-$(CONFIG_I6300ESB_WDT) += i6300esb.o
68obj-$(CONFIG_ITCO_WDT) += iTCO_wdt.o iTCO_vendor_support.o 68obj-$(CONFIG_ITCO_WDT) += iTCO_wdt.o iTCO_vendor_support.o
69obj-$(CONFIG_IT8712F_WDT) += it8712f_wdt.o 69obj-$(CONFIG_IT8712F_WDT) += it8712f_wdt.o
70obj-$(CONFIG_HP_WATCHDOG) += hpwdt.o
70obj-$(CONFIG_SC1200_WDT) += sc1200wdt.o 71obj-$(CONFIG_SC1200_WDT) += sc1200wdt.o
71obj-$(CONFIG_SCx200_WDT) += scx200_wdt.o 72obj-$(CONFIG_SCx200_WDT) += scx200_wdt.o
72obj-$(CONFIG_PC87413_WDT) += pc87413_wdt.o 73obj-$(CONFIG_PC87413_WDT) += pc87413_wdt.o
@@ -92,6 +93,7 @@ obj-$(CONFIG_SBC_EPX_C3_WATCHDOG) += sbc_epx_c3.o
92obj-$(CONFIG_INDYDOG) += indydog.o 93obj-$(CONFIG_INDYDOG) += indydog.o
93obj-$(CONFIG_WDT_MTX1) += mtx-1_wdt.o 94obj-$(CONFIG_WDT_MTX1) += mtx-1_wdt.o
94obj-$(CONFIG_WDT_RM9K_GPI) += rm9k_wdt.o 95obj-$(CONFIG_WDT_RM9K_GPI) += rm9k_wdt.o
96obj-$(CONFIG_SIBYTE_WDOG) += sb_wdog.o
95obj-$(CONFIG_AR7_WDT) += ar7_wdt.o 97obj-$(CONFIG_AR7_WDT) += ar7_wdt.o
96obj-$(CONFIG_TXX9_WDT) += txx9wdt.o 98obj-$(CONFIG_TXX9_WDT) += txx9wdt.o
97 99
diff --git a/drivers/watchdog/bfin_wdt.c b/drivers/watchdog/bfin_wdt.c
index 472be10f0686..1237113dc14a 100644
--- a/drivers/watchdog/bfin_wdt.c
+++ b/drivers/watchdog/bfin_wdt.c
@@ -29,6 +29,7 @@
29 29
30#define stamp(fmt, args...) pr_debug("%s:%i: " fmt "\n", __func__, __LINE__, ## args) 30#define stamp(fmt, args...) pr_debug("%s:%i: " fmt "\n", __func__, __LINE__, ## args)
31#define stampit() stamp("here i am") 31#define stampit() stamp("here i am")
32#define pr_init(fmt, args...) ({ static const __initdata char __fmt[] = fmt; printk(__fmt, ## args); })
32 33
33#define WATCHDOG_NAME "bfin-wdt" 34#define WATCHDOG_NAME "bfin-wdt"
34#define PFX WATCHDOG_NAME ": " 35#define PFX WATCHDOG_NAME ": "
@@ -445,19 +446,19 @@ static int __init bfin_wdt_init(void)
445 446
446 ret = register_reboot_notifier(&bfin_wdt_notifier); 447 ret = register_reboot_notifier(&bfin_wdt_notifier);
447 if (ret) { 448 if (ret) {
448 printk(KERN_ERR PFX "cannot register reboot notifier (err=%d)\n", ret); 449 pr_init(KERN_ERR PFX "cannot register reboot notifier (err=%d)\n", ret);
449 return ret; 450 return ret;
450 } 451 }
451 452
452 ret = misc_register(&bfin_wdt_miscdev); 453 ret = misc_register(&bfin_wdt_miscdev);
453 if (ret) { 454 if (ret) {
454 printk(KERN_ERR PFX "cannot register miscdev on minor=%d (err=%d)\n", 455 pr_init(KERN_ERR PFX "cannot register miscdev on minor=%d (err=%d)\n",
455 WATCHDOG_MINOR, ret); 456 WATCHDOG_MINOR, ret);
456 unregister_reboot_notifier(&bfin_wdt_notifier); 457 unregister_reboot_notifier(&bfin_wdt_notifier);
457 return ret; 458 return ret;
458 } 459 }
459 460
460 printk(KERN_INFO PFX "initialized: timeout=%d sec (nowayout=%d)\n", 461 pr_init(KERN_INFO PFX "initialized: timeout=%d sec (nowayout=%d)\n",
461 timeout, nowayout); 462 timeout, nowayout);
462 463
463 return 0; 464 return 0;
diff --git a/drivers/watchdog/hpwdt.c b/drivers/watchdog/hpwdt.c
new file mode 100644
index 000000000000..a2e174b09fe7
--- /dev/null
+++ b/drivers/watchdog/hpwdt.c
@@ -0,0 +1,926 @@
1/*
2 * HP WatchDog Driver
3 * based on
4 *
5 * SoftDog 0.05: A Software Watchdog Device
6 *
7 * (c) Copyright 2007 Hewlett-Packard Development Company, L.P.
8 * Thomas Mingarelli <thomas.mingarelli@hp.com>
9 *
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public License
12 * version 2 as published by the Free Software Foundation
13 *
14 */
15
16#include <linux/device.h>
17#include <linux/fs.h>
18#include <linux/init.h>
19#include <linux/interrupt.h>
20#include <linux/io.h>
21#include <linux/irq.h>
22#include <linux/kernel.h>
23#include <linux/miscdevice.h>
24#include <linux/mm.h>
25#include <linux/module.h>
26#include <linux/kdebug.h>
27#include <linux/moduleparam.h>
28#include <linux/notifier.h>
29#include <linux/pci.h>
30#include <linux/pci_ids.h>
31#include <linux/reboot.h>
32#include <linux/sched.h>
33#include <linux/timer.h>
34#include <linux/types.h>
35#include <linux/uaccess.h>
36#include <linux/watchdog.h>
37#include <linux/dmi.h>
38#include <linux/efi.h>
39#include <linux/string.h>
40#include <linux/bootmem.h>
41#include <linux/slab.h>
42#include <asm/dmi.h>
43#include <asm/desc.h>
44#include <asm/kdebug.h>
45
46#define PCI_BIOS32_SD_VALUE 0x5F32335F /* "_32_" */
47#define CRU_BIOS_SIGNATURE_VALUE 0x55524324
48#define PCI_BIOS32_PARAGRAPH_LEN 16
49#define PCI_ROM_BASE1 0x000F0000
50#define ROM_SIZE 0x10000
51
52struct bios32_service_dir {
53 u32 signature;
54 u32 entry_point;
55 u8 revision;
56 u8 length;
57 u8 checksum;
58 u8 reserved[5];
59};
60
61/*
62 * smbios_entry_point - defines SMBIOS entry point structure
63 *
64 * anchor[4] - anchor string (_SM_)
65 * checksum - checksum of the entry point structure
66 * length - length of the entry point structure
67 * major_ver - major version (02h for revision 2.1)
68 * minor_ver - minor version (01h for revision 2.1)
69 * max_struct_size - size of the largest SMBIOS structure
70 * revision - entry point structure revision implemented
71 * formatted_area[5] - reserved
72 * intermediate_anchor[5] - intermediate anchor string (_DMI_)
73 * intermediate_checksum - intermediate checksum
74 * table_length - structure table length
75 * table_address - structure table address
76 * table_num_structs - number of SMBIOS structures present
77 * bcd_revision - BCD revision
78 */
79struct smbios_entry_point {
80 u8 anchor[4];
81 u8 checksum;
82 u8 length;
83 u8 major_ver;
84 u8 minor_ver;
85 u16 max_struct_size;
86 u8 revision;
87 u8 formatted_area[5];
88 u8 intermediate_anchor[5];
89 u8 intermediate_checksum;
90 u16 table_length;
91 u64 table_address;
92 u16 table_num_structs;
93 u8 bcd_revision;
94};
95
96/* type 212 */
97struct smbios_cru64_info {
98 u8 type;
99 u8 byte_length;
100 u16 handle;
101 u32 signature;
102 u64 physical_address;
103 u32 double_length;
104 u32 double_offset;
105};
106#define SMBIOS_CRU64_INFORMATION 212
107
108struct cmn_registers {
109 union {
110 struct {
111 u8 ral;
112 u8 rah;
113 u16 rea2;
114 };
115 u32 reax;
116 } u1;
117 union {
118 struct {
119 u8 rbl;
120 u8 rbh;
121 u8 reb2l;
122 u8 reb2h;
123 };
124 u32 rebx;
125 } u2;
126 union {
127 struct {
128 u8 rcl;
129 u8 rch;
130 u16 rec2;
131 };
132 u32 recx;
133 } u3;
134 union {
135 struct {
136 u8 rdl;
137 u8 rdh;
138 u16 red2;
139 };
140 u32 redx;
141 } u4;
142
143 u32 resi;
144 u32 redi;
145 u16 rds;
146 u16 res;
147 u32 reflags;
148} __attribute__((packed));
149
150#define DEFAULT_MARGIN 30
151static unsigned int soft_margin = DEFAULT_MARGIN; /* in seconds */
152static unsigned int reload; /* the computed soft_margin */
153static int nowayout = WATCHDOG_NOWAYOUT;
154static char expect_release;
155static unsigned long hpwdt_is_open;
156
157static void __iomem *pci_mem_addr; /* the PCI-memory address */
158static unsigned long __iomem *hpwdt_timer_reg;
159static unsigned long __iomem *hpwdt_timer_con;
160
161static DEFINE_SPINLOCK(rom_lock);
162
163static void *cru_rom_addr;
164
165static struct cmn_registers cmn_regs;
166
167static struct pci_device_id hpwdt_devices[] = {
168 {
169 .vendor = PCI_VENDOR_ID_COMPAQ,
170 .device = 0xB203,
171 .subvendor = PCI_ANY_ID,
172 .subdevice = PCI_ANY_ID,
173 },
174 {0}, /* terminate list */
175};
176MODULE_DEVICE_TABLE(pci, hpwdt_devices);
177
178/*
179 * bios_checksum
180 */
181static int __devinit bios_checksum(const char __iomem *ptr, int len)
182{
183 char sum = 0;
184 int i;
185
186 /*
187 * calculate checksum of size bytes. This should add up
188 * to zero if we have a valid header.
189 */
190 for (i = 0; i < len; i++)
191 sum += ptr[i];
192
193 return ((sum == 0) && (len > 0));
194}
195
196#ifndef CONFIG_X86_64
197/* --32 Bit Bios------------------------------------------------------------ */
198
199#define HPWDT_ARCH 32
200
201asmlinkage void asminline_call(struct cmn_registers *pi86Regs,
202 unsigned long *pRomEntry)
203{
204 asm("pushl %ebp \n\t"
205 "movl %esp, %ebp \n\t"
206 "pusha \n\t"
207 "pushf \n\t"
208 "push %es \n\t"
209 "push %ds \n\t"
210 "pop %es \n\t"
211 "movl 8(%ebp),%eax \n\t"
212 "movl 4(%eax),%ebx \n\t"
213 "movl 8(%eax),%ecx \n\t"
214 "movl 12(%eax),%edx \n\t"
215 "movl 16(%eax),%esi \n\t"
216 "movl 20(%eax),%edi \n\t"
217 "movl (%eax),%eax \n\t"
218 "push %cs \n\t"
219 "call *12(%ebp) \n\t"
220 "pushf \n\t"
221 "pushl %eax \n\t"
222 "movl 8(%ebp),%eax \n\t"
223 "movl %ebx,4(%eax) \n\t"
224 "movl %ecx,8(%eax) \n\t"
225 "movl %edx,12(%eax) \n\t"
226 "movl %esi,16(%eax) \n\t"
227 "movl %edi,20(%eax) \n\t"
228 "movw %ds,24(%eax) \n\t"
229 "movw %es,26(%eax) \n\t"
230 "popl %ebx \n\t"
231 "movl %ebx,(%eax) \n\t"
232 "popl %ebx \n\t"
233 "movl %ebx,28(%eax) \n\t"
234 "pop %es \n\t"
235 "popf \n\t"
236 "popa \n\t"
237 "leave \n\t" "ret");
238}
239
240/*
241 * cru_detect
242 *
243 * Routine Description:
244 * This function uses the 32-bit BIOS Service Directory record to
245 * search for a $CRU record.
246 *
247 * Return Value:
248 * 0 : SUCCESS
249 * <0 : FAILURE
250 */
251static int __devinit cru_detect(unsigned long map_entry,
252 unsigned long map_offset)
253{
254 void *bios32_map;
255 unsigned long *bios32_entrypoint;
256 unsigned long cru_physical_address;
257 unsigned long cru_length;
258 unsigned long physical_bios_base = 0;
259 unsigned long physical_bios_offset = 0;
260 int retval = -ENODEV;
261
262 bios32_map = ioremap(map_entry, (2 * PAGE_SIZE));
263
264 if (bios32_map == NULL)
265 return -ENODEV;
266
267 bios32_entrypoint = bios32_map + map_offset;
268
269 cmn_regs.u1.reax = CRU_BIOS_SIGNATURE_VALUE;
270
271 asminline_call(&cmn_regs, bios32_entrypoint);
272
273 if (cmn_regs.u1.ral != 0) {
274 printk(KERN_WARNING
275 "hpwdt: Call succeeded but with an error: 0x%x\n",
276 cmn_regs.u1.ral);
277 } else {
278 physical_bios_base = cmn_regs.u2.rebx;
279 physical_bios_offset = cmn_regs.u4.redx;
280 cru_length = cmn_regs.u3.recx;
281 cru_physical_address =
282 physical_bios_base + physical_bios_offset;
283
284 /* If the values look OK, then map it in. */
285 if ((physical_bios_base + physical_bios_offset)) {
286 cru_rom_addr =
287 ioremap(cru_physical_address, cru_length);
288 if (cru_rom_addr)
289 retval = 0;
290 }
291
292 printk(KERN_DEBUG "hpwdt: CRU Base Address: 0x%lx\n",
293 physical_bios_base);
294 printk(KERN_DEBUG "hpwdt: CRU Offset Address: 0x%lx\n",
295 physical_bios_offset);
296 printk(KERN_DEBUG "hpwdt: CRU Length: 0x%lx\n",
297 cru_length);
298 printk(KERN_DEBUG "hpwdt: CRU Mapped Address: 0x%x\n",
299 (unsigned int)&cru_rom_addr);
300 }
301 iounmap(bios32_map);
302 return retval;
303}
304
305/*
306 * bios32_present
307 *
308 * Routine Description:
309 * This function finds the 32-bit BIOS Service Directory
310 *
311 * Return Value:
312 * 0 : SUCCESS
313 * <0 : FAILURE
314 */
315static int __devinit bios32_present(const char __iomem *p)
316{
317 struct bios32_service_dir *bios_32_ptr;
318 int length;
319 unsigned long map_entry, map_offset;
320
321 bios_32_ptr = (struct bios32_service_dir *) p;
322
323 /*
324 * Search for signature by checking equal to the swizzled value
325 * instead of calling another routine to perform a strcmp.
326 */
327 if (bios_32_ptr->signature == PCI_BIOS32_SD_VALUE) {
328 length = bios_32_ptr->length * PCI_BIOS32_PARAGRAPH_LEN;
329 if (bios_checksum(p, length)) {
330 /*
331 * According to the spec, we're looking for the
332 * first 4KB-aligned address below the entrypoint
333 * listed in the header. The Service Directory code
334 * is guaranteed to occupy no more than 2 4KB pages.
335 */
336 map_entry = bios_32_ptr->entry_point & ~(PAGE_SIZE - 1);
337 map_offset = bios_32_ptr->entry_point - map_entry;
338
339 return cru_detect(map_entry, map_offset);
340 }
341 }
342 return -ENODEV;
343}
344
345static int __devinit detect_cru_service(void)
346{
347 char __iomem *p, *q;
348 int rc = -1;
349
350 /*
351 * Search from 0x0f0000 through 0x0fffff, inclusive.
352 */
353 p = ioremap(PCI_ROM_BASE1, ROM_SIZE);
354 if (p == NULL)
355 return -ENOMEM;
356
357 for (q = p; q < p + ROM_SIZE; q += 16) {
358 rc = bios32_present(q);
359 if (!rc)
360 break;
361 }
362 iounmap(p);
363 return rc;
364}
365
366#else
367/* --64 Bit Bios------------------------------------------------------------ */
368
369#define HPWDT_ARCH 64
370
371asmlinkage void asminline_call(struct cmn_registers *pi86Regs,
372 unsigned long *pRomEntry)
373{
374 asm("pushq %rbp \n\t"
375 "movq %rsp, %rbp \n\t"
376 "pushq %rax \n\t"
377 "pushq %rbx \n\t"
378 "pushq %rdx \n\t"
379 "pushq %r12 \n\t"
380 "pushq %r9 \n\t"
381 "movq %rsi, %r12 \n\t"
382 "movq %rdi, %r9 \n\t"
383 "movl 4(%r9),%ebx \n\t"
384 "movl 8(%r9),%ecx \n\t"
385 "movl 12(%r9),%edx \n\t"
386 "movl 16(%r9),%esi \n\t"
387 "movl 20(%r9),%edi \n\t"
388 "movl (%r9),%eax \n\t"
389 "call *%r12 \n\t"
390 "pushfq \n\t"
391 "popq %r12 \n\t"
392 "popfq \n\t"
393 "movl %eax, (%r9) \n\t"
394 "movl %ebx, 4(%r9) \n\t"
395 "movl %ecx, 8(%r9) \n\t"
396 "movl %edx, 12(%r9) \n\t"
397 "movl %esi, 16(%r9) \n\t"
398 "movl %edi, 20(%r9) \n\t"
399 "movq %r12, %rax \n\t"
400 "movl %eax, 28(%r9) \n\t"
401 "popq %r9 \n\t"
402 "popq %r12 \n\t"
403 "popq %rdx \n\t"
404 "popq %rbx \n\t"
405 "popq %rax \n\t"
406 "leave \n\t" "ret");
407}
408
409/*
410 * dmi_find_cru
411 *
412 * Routine Description:
413 * This function checks wether or not a SMBIOS/DMI record is
414 * the 64bit CRU info or not
415 *
416 * Return Value:
417 * 0 : SUCCESS - if record found
418 * <0 : FAILURE - if record not found
419 */
420static void __devinit dmi_find_cru(const struct dmi_header *dm)
421{
422 struct smbios_cru64_info *smbios_cru64_ptr;
423 unsigned long cru_physical_address;
424
425 if (dm->type == SMBIOS_CRU64_INFORMATION) {
426 smbios_cru64_ptr = (struct smbios_cru64_info *) dm;
427 if (smbios_cru64_ptr->signature == CRU_BIOS_SIGNATURE_VALUE) {
428 cru_physical_address =
429 smbios_cru64_ptr->physical_address +
430 smbios_cru64_ptr->double_offset;
431 cru_rom_addr = ioremap(cru_physical_address,
432 smbios_cru64_ptr->double_length);
433 }
434 }
435}
436
437/*
438 * dmi_table
439 *
440 * Routine Description:
441 * Decode the SMBIOS/DMI table and check if we have a 64bit CRU record
442 * or not.
443 *
444 * We have to be cautious here. We have seen BIOSes with DMI pointers
445 * pointing to completely the wrong place for example
446 */
447static void __devinit dmi_table(u8 *buf, int len, int num,
448 void (*decode)(const struct dmi_header *))
449{
450 u8 *data = buf;
451 int i = 0;
452
453 /*
454 * Stop when we see all the items the table claimed to have
455 * OR we run off the end of the table (also happens)
456 */
457 while ((i < num) && (data - buf + sizeof(struct dmi_header)) <= len) {
458 const struct dmi_header *dm = (const struct dmi_header *)data;
459
460 /*
461 * We want to know the total length (formated area and strings)
462 * before decoding to make sure we won't run off the table in
463 * dmi_decode or dmi_string
464 */
465 data += dm->length;
466 while ((data - buf < len - 1) && (data[0] || data[1]))
467 data++;
468 if (data - buf < len - 1)
469 decode(dm);
470 data += 2;
471 i++;
472 }
473}
474
475/*
476 * smbios_present
477 *
478 * Routine Description:
479 * This function parses the SMBIOS entry point table to retrieve
480 * the 64 bit CRU Service.
481 *
482 * Return Value:
483 * 0 : SUCCESS
484 * <0 : FAILURE
485 */
486static int __devinit smbios_present(const char __iomem *p)
487{
488 struct smbios_entry_point *eps =
489 (struct smbios_entry_point *) p;
490 int length;
491 u8 *buf;
492
493 /* check if we have indeed the SMBIOS table entry point */
494 if ((strncmp((char *)eps->anchor, "_SM_",
495 sizeof(eps->anchor))) == 0) {
496 length = eps->length;
497
498 /* SMBIOS v2.1 implementation might use 0x1e */
499 if ((length == 0x1e) &&
500 (eps->major_ver == 2) &&
501 (eps->minor_ver == 1))
502 length = 0x1f;
503
504 /*
505 * Now we will check:
506 * - SMBIOS checksum must be 0
507 * - intermediate anchor should be _DMI_
508 * - intermediate checksum should be 0
509 */
510 if ((bios_checksum(p, length)) &&
511 (strncmp((char *)eps->intermediate_anchor, "_DMI_",
512 sizeof(eps->intermediate_anchor)) == 0) &&
513 (bios_checksum(p+0x10, 15))) {
514 buf = ioremap(eps->table_address, eps->table_length);
515 if (buf == NULL)
516 return -ENODEV;
517
518
519 /* Scan the DMI table for the 64 bit CRU service */
520 dmi_table(buf, eps->table_length,
521 eps->table_num_structs, dmi_find_cru);
522
523 iounmap(buf);
524 return 0;
525 }
526 }
527
528 return -ENODEV;
529}
530
531static int __devinit smbios_scan_machine(void)
532{
533 char __iomem *p, *q;
534 int rc;
535
536 if (efi_enabled) {
537 if (efi.smbios == EFI_INVALID_TABLE_ADDR)
538 return -ENODEV;
539
540 p = ioremap(efi.smbios, 32);
541 if (p == NULL)
542 return -ENOMEM;
543
544 rc = smbios_present(p);
545 iounmap(p);
546 } else {
547 /*
548 * Search from 0x0f0000 through 0x0fffff, inclusive.
549 */
550 p = ioremap(PCI_ROM_BASE1, ROM_SIZE);
551 if (p == NULL)
552 return -ENOMEM;
553
554 for (q = p; q < p + ROM_SIZE; q += 16) {
555 rc = smbios_present(q);
556 if (!rc) {
557 break;
558 }
559 }
560 iounmap(p);
561 }
562}
563
564static int __devinit detect_cru_service(void)
565{
566 cru_rom_addr = NULL;
567
568 smbios_scan_machine(); /* will become dmi_walk(dmi_find_cru); */
569
570 /* if cru_rom_addr has been set then we found a CRU service */
571 return ((cru_rom_addr != NULL)? 0: -ENODEV);
572}
573
574/* ------------------------------------------------------------------------- */
575
576#endif
577
578/*
579 * NMI Handler
580 */
581static int hpwdt_pretimeout(struct notifier_block *nb, unsigned long ulReason,
582 void *data)
583{
584 static unsigned long rom_pl;
585 static int die_nmi_called;
586
587 if (ulReason != DIE_NMI && ulReason != DIE_NMI_IPI)
588 return NOTIFY_OK;
589
590 spin_lock_irqsave(&rom_lock, rom_pl);
591 if (!die_nmi_called)
592 asminline_call(&cmn_regs, cru_rom_addr);
593 die_nmi_called = 1;
594 spin_unlock_irqrestore(&rom_lock, rom_pl);
595 if (cmn_regs.u1.ral == 0) {
596 printk(KERN_WARNING "hpwdt: An NMI occurred, "
597 "but unable to determine source.\n");
598 } else {
599 panic("An NMI occurred, please see the Integrated "
600 "Management Log for details.\n");
601 }
602
603 return NOTIFY_STOP;
604}
605
606/*
607 * Watchdog operations
608 */
609static void hpwdt_start(void)
610{
611 reload = (soft_margin * 1000) / 128;
612 iowrite16(reload, hpwdt_timer_reg);
613 iowrite16(0x85, hpwdt_timer_con);
614}
615
616static void hpwdt_stop(void)
617{
618 unsigned long data;
619
620 data = ioread16(hpwdt_timer_con);
621 data &= 0xFE;
622 iowrite16(data, hpwdt_timer_con);
623}
624
625static void hpwdt_ping(void)
626{
627 iowrite16(reload, hpwdt_timer_reg);
628}
629
630static int hpwdt_change_timer(int new_margin)
631{
632 /* Arbitrary, can't find the card's limits */
633 if (new_margin < 30 || new_margin > 600) {
634 printk(KERN_WARNING
635 "hpwdt: New value passed in is invalid: %d seconds.\n",
636 new_margin);
637 return -EINVAL;
638 }
639
640 soft_margin = new_margin;
641 printk(KERN_DEBUG
642 "hpwdt: New timer passed in is %d seconds.\n",
643 new_margin);
644 reload = (soft_margin * 1000) / 128;
645
646 return 0;
647}
648
649/*
650 * /dev/watchdog handling
651 */
652static int hpwdt_open(struct inode *inode, struct file *file)
653{
654 /* /dev/watchdog can only be opened once */
655 if (test_and_set_bit(0, &hpwdt_is_open))
656 return -EBUSY;
657
658 /* Start the watchdog */
659 hpwdt_start();
660 hpwdt_ping();
661
662 return nonseekable_open(inode, file);
663}
664
665static int hpwdt_release(struct inode *inode, struct file *file)
666{
667 /* Stop the watchdog */
668 if (expect_release == 42) {
669 hpwdt_stop();
670 } else {
671 printk(KERN_CRIT
672 "hpwdt: Unexpected close, not stopping watchdog!\n");
673 hpwdt_ping();
674 }
675
676 expect_release = 0;
677
678 /* /dev/watchdog is being closed, make sure it can be re-opened */
679 clear_bit(0, &hpwdt_is_open);
680
681 return 0;
682}
683
684static ssize_t hpwdt_write(struct file *file, const char __user *data,
685 size_t len, loff_t *ppos)
686{
687 /* See if we got the magic character 'V' and reload the timer */
688 if (len) {
689 if (!nowayout) {
690 size_t i;
691
692 /* note: just in case someone wrote the magic character
693 * five months ago... */
694 expect_release = 0;
695
696 /* scan to see whether or not we got the magic char. */
697 for (i = 0; i != len; i++) {
698 char c;
699 if (get_user(c, data+i))
700 return -EFAULT;
701 if (c == 'V')
702 expect_release = 42;
703 }
704 }
705
706 /* someone wrote to us, we should reload the timer */
707 hpwdt_ping();
708 }
709
710 return len;
711}
712
713static struct watchdog_info ident = {
714 .options = WDIOF_SETTIMEOUT |
715 WDIOF_KEEPALIVEPING |
716 WDIOF_MAGICCLOSE,
717 .identity = "HP iLO2 HW Watchdog Timer",
718};
719
720static long hpwdt_ioctl(struct file *file, unsigned int cmd,
721 unsigned long arg)
722{
723 void __user *argp = (void __user *)arg;
724 int __user *p = argp;
725 int new_margin;
726 int ret = -ENOTTY;
727
728 switch (cmd) {
729 case WDIOC_GETSUPPORT:
730 ret = 0;
731 if (copy_to_user(argp, &ident, sizeof(ident)))
732 ret = -EFAULT;
733 break;
734
735 case WDIOC_GETSTATUS:
736 case WDIOC_GETBOOTSTATUS:
737 ret = put_user(0, p);
738 break;
739
740 case WDIOC_KEEPALIVE:
741 hpwdt_ping();
742 ret = 0;
743 break;
744
745 case WDIOC_SETTIMEOUT:
746 ret = get_user(new_margin, p);
747 if (ret)
748 break;
749
750 ret = hpwdt_change_timer(new_margin);
751 if (ret)
752 break;
753
754 hpwdt_ping();
755 /* Fall */
756 case WDIOC_GETTIMEOUT:
757 ret = put_user(soft_margin, p);
758 break;
759 }
760 return ret;
761}
762
763/*
764 * Kernel interfaces
765 */
766static struct file_operations hpwdt_fops = {
767 .owner = THIS_MODULE,
768 .llseek = no_llseek,
769 .write = hpwdt_write,
770 .unlocked_ioctl = hpwdt_ioctl,
771 .open = hpwdt_open,
772 .release = hpwdt_release,
773};
774
775static struct miscdevice hpwdt_miscdev = {
776 .minor = WATCHDOG_MINOR,
777 .name = "watchdog",
778 .fops = &hpwdt_fops,
779};
780
781static struct notifier_block die_notifier = {
782 .notifier_call = hpwdt_pretimeout,
783 .priority = 0x7FFFFFFF,
784};
785
786/*
787 * Init & Exit
788 */
789
790static int __devinit hpwdt_init_one(struct pci_dev *dev,
791 const struct pci_device_id *ent)
792{
793 int retval;
794
795 /*
796 * First let's find out if we are on an iLO2 server. We will
797 * not run on a legacy ASM box.
798 */
799 if (dev->subsystem_vendor != PCI_VENDOR_ID_HP) {
800 dev_warn(&dev->dev,
801 "This server does not have an iLO2 ASIC.\n");
802 return -ENODEV;
803 }
804
805 if (pci_enable_device(dev)) {
806 dev_warn(&dev->dev,
807 "Not possible to enable PCI Device: 0x%x:0x%x.\n",
808 ent->vendor, ent->device);
809 return -ENODEV;
810 }
811
812 pci_mem_addr = pci_iomap(dev, 1, 0x80);
813 if (!pci_mem_addr) {
814 dev_warn(&dev->dev,
815 "Unable to detect the iLO2 server memory.\n");
816 retval = -ENOMEM;
817 goto error_pci_iomap;
818 }
819 hpwdt_timer_reg = pci_mem_addr + 0x70;
820 hpwdt_timer_con = pci_mem_addr + 0x72;
821
822 /* Make sure that we have a valid soft_margin */
823 if (hpwdt_change_timer(soft_margin))
824 hpwdt_change_timer(DEFAULT_MARGIN);
825
826 /*
827 * We need to map the ROM to get the CRU service.
828 * For 32 bit Operating Systems we need to go through the 32 Bit
829 * BIOS Service Directory
830 * For 64 bit Operating Systems we get that service through SMBIOS.
831 */
832 retval = detect_cru_service();
833 if (retval < 0) {
834 dev_warn(&dev->dev,
835 "Unable to detect the %d Bit CRU Service.\n",
836 HPWDT_ARCH);
837 goto error_get_cru;
838 }
839
840 /*
841 * We know this is the only CRU call we need to make so lets keep as
842 * few instructions as possible once the NMI comes in.
843 */
844 cmn_regs.u1.rah = 0x0D;
845 cmn_regs.u1.ral = 0x02;
846
847 retval = register_die_notifier(&die_notifier);
848 if (retval != 0) {
849 dev_warn(&dev->dev,
850 "Unable to register a die notifier (err=%d).\n",
851 retval);
852 goto error_die_notifier;
853 }
854
855 retval = misc_register(&hpwdt_miscdev);
856 if (retval < 0) {
857 dev_warn(&dev->dev,
858 "Unable to register miscdev on minor=%d (err=%d).\n",
859 WATCHDOG_MINOR, retval);
860 goto error_misc_register;
861 }
862
863 printk(KERN_INFO
864 "hp Watchdog Timer Driver: 1.00"
865 ", timer margin: %d seconds( nowayout=%d).\n",
866 soft_margin, nowayout);
867
868 return 0;
869
870error_misc_register:
871 unregister_die_notifier(&die_notifier);
872error_die_notifier:
873 if (cru_rom_addr)
874 iounmap(cru_rom_addr);
875error_get_cru:
876 pci_iounmap(dev, pci_mem_addr);
877error_pci_iomap:
878 pci_disable_device(dev);
879 return retval;
880}
881
882static void __devexit hpwdt_exit(struct pci_dev *dev)
883{
884 if (!nowayout)
885 hpwdt_stop();
886
887 misc_deregister(&hpwdt_miscdev);
888 unregister_die_notifier(&die_notifier);
889
890 if (cru_rom_addr)
891 iounmap(cru_rom_addr);
892 pci_iounmap(dev, pci_mem_addr);
893 pci_disable_device(dev);
894}
895
896static struct pci_driver hpwdt_driver = {
897 .name = "hpwdt",
898 .id_table = hpwdt_devices,
899 .probe = hpwdt_init_one,
900 .remove = __devexit_p(hpwdt_exit),
901};
902
903static void __exit hpwdt_cleanup(void)
904{
905 pci_unregister_driver(&hpwdt_driver);
906}
907
908static int __init hpwdt_init(void)
909{
910 return pci_register_driver(&hpwdt_driver);
911}
912
913MODULE_AUTHOR("Tom Mingarelli");
914MODULE_DESCRIPTION("hp watchdog driver");
915MODULE_LICENSE("GPL");
916MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR);
917
918module_param(soft_margin, int, 0);
919MODULE_PARM_DESC(soft_margin, "Watchdog timeout in seconds");
920
921module_param(nowayout, int, 0);
922MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default="
923 __MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
924
925module_init(hpwdt_init);
926module_exit(hpwdt_cleanup);
diff --git a/drivers/watchdog/mtx-1_wdt.c b/drivers/watchdog/mtx-1_wdt.c
index 98451747d3cd..789831b3fa00 100644
--- a/drivers/watchdog/mtx-1_wdt.c
+++ b/drivers/watchdog/mtx-1_wdt.c
@@ -45,10 +45,13 @@
45#include <linux/completion.h> 45#include <linux/completion.h>
46#include <linux/jiffies.h> 46#include <linux/jiffies.h>
47#include <linux/watchdog.h> 47#include <linux/watchdog.h>
48#include <linux/platform_device.h>
49
48#include <asm/io.h> 50#include <asm/io.h>
49#include <asm/uaccess.h> 51#include <asm/uaccess.h>
50 52
51#include <asm/mach-au1x00/au1000.h> 53#include <asm/mach-au1x00/au1000.h>
54#include <asm/gpio.h>
52 55
53#define MTX1_WDT_INTERVAL (5 * HZ) 56#define MTX1_WDT_INTERVAL (5 * HZ)
54 57
@@ -61,6 +64,7 @@ static struct {
61 volatile int queue; 64 volatile int queue;
62 int default_ticks; 65 int default_ticks;
63 unsigned long inuse; 66 unsigned long inuse;
67 unsigned gpio;
64} mtx1_wdt_device; 68} mtx1_wdt_device;
65 69
66static void mtx1_wdt_trigger(unsigned long unused) 70static void mtx1_wdt_trigger(unsigned long unused)
@@ -73,7 +77,8 @@ static void mtx1_wdt_trigger(unsigned long unused)
73 * toggle GPIO2_15 77 * toggle GPIO2_15
74 */ 78 */
75 tmp = au_readl(GPIO2_DIR); 79 tmp = au_readl(GPIO2_DIR);
76 tmp = (tmp & ~(1<<15)) | ((~tmp) & (1<<15)); 80 tmp = (tmp & ~(1 << mtx1_wdt_device.gpio)) |
81 ((~tmp) & (1 << mtx1_wdt_device.gpio));
77 au_writel (tmp, GPIO2_DIR); 82 au_writel (tmp, GPIO2_DIR);
78 83
79 if (mtx1_wdt_device.queue && ticks) 84 if (mtx1_wdt_device.queue && ticks)
@@ -93,7 +98,7 @@ static void mtx1_wdt_start(void)
93{ 98{
94 if (!mtx1_wdt_device.queue) { 99 if (!mtx1_wdt_device.queue) {
95 mtx1_wdt_device.queue = 1; 100 mtx1_wdt_device.queue = 1;
96 au_writel (au_readl(GPIO2_DIR) | (u32)(1<<15), GPIO2_DIR); 101 gpio_set_value(mtx1_wdt_device.gpio, 1);
97 mod_timer(&mtx1_wdt_device.timer, jiffies + MTX1_WDT_INTERVAL); 102 mod_timer(&mtx1_wdt_device.timer, jiffies + MTX1_WDT_INTERVAL);
98 } 103 }
99 mtx1_wdt_device.running++; 104 mtx1_wdt_device.running++;
@@ -103,7 +108,7 @@ static int mtx1_wdt_stop(void)
103{ 108{
104 if (mtx1_wdt_device.queue) { 109 if (mtx1_wdt_device.queue) {
105 mtx1_wdt_device.queue = 0; 110 mtx1_wdt_device.queue = 0;
106 au_writel (au_readl(GPIO2_DIR) & ~((u32)(1<<15)), GPIO2_DIR); 111 gpio_set_value(mtx1_wdt_device.gpio, 0);
107 } 112 }
108 113
109 ticks = mtx1_wdt_device.default_ticks; 114 ticks = mtx1_wdt_device.default_ticks;
@@ -197,10 +202,12 @@ static struct miscdevice mtx1_wdt_misc = {
197}; 202};
198 203
199 204
200static int __init mtx1_wdt_init(void) 205static int mtx1_wdt_probe(struct platform_device *pdev)
201{ 206{
202 int ret; 207 int ret;
203 208
209 mtx1_wdt_device.gpio = pdev->resource[0].start;
210
204 if ((ret = misc_register(&mtx1_wdt_misc)) < 0) { 211 if ((ret = misc_register(&mtx1_wdt_misc)) < 0) {
205 printk(KERN_ERR " mtx-1_wdt : failed to register\n"); 212 printk(KERN_ERR " mtx-1_wdt : failed to register\n");
206 return ret; 213 return ret;
@@ -222,13 +229,30 @@ static int __init mtx1_wdt_init(void)
222 return 0; 229 return 0;
223} 230}
224 231
225static void __exit mtx1_wdt_exit(void) 232static int mtx1_wdt_remove(struct platform_device *pdev)
226{ 233{
227 if (mtx1_wdt_device.queue) { 234 if (mtx1_wdt_device.queue) {
228 mtx1_wdt_device.queue = 0; 235 mtx1_wdt_device.queue = 0;
229 wait_for_completion(&mtx1_wdt_device.stop); 236 wait_for_completion(&mtx1_wdt_device.stop);
230 } 237 }
231 misc_deregister(&mtx1_wdt_misc); 238 misc_deregister(&mtx1_wdt_misc);
239 return 0;
240}
241
242static struct platform_driver mtx1_wdt = {
243 .probe = mtx1_wdt_probe,
244 .remove = mtx1_wdt_remove,
245 .driver.name = "mtx1-wdt",
246};
247
248static int __init mtx1_wdt_init(void)
249{
250 return platform_driver_register(&mtx1_wdt);
251}
252
253static void __exit mtx1_wdt_exit(void)
254{
255 platform_driver_unregister(&mtx1_wdt);
232} 256}
233 257
234module_init(mtx1_wdt_init); 258module_init(mtx1_wdt_init);
@@ -237,3 +261,4 @@ module_exit(mtx1_wdt_exit);
237MODULE_AUTHOR("Michael Stickel, Florian Fainelli"); 261MODULE_AUTHOR("Michael Stickel, Florian Fainelli");
238MODULE_DESCRIPTION("Driver for the MTX-1 watchdog"); 262MODULE_DESCRIPTION("Driver for the MTX-1 watchdog");
239MODULE_LICENSE("GPL"); 263MODULE_LICENSE("GPL");
264MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR);
diff --git a/drivers/watchdog/sb_wdog.c b/drivers/watchdog/sb_wdog.c
new file mode 100644
index 000000000000..b94431433695
--- /dev/null
+++ b/drivers/watchdog/sb_wdog.c
@@ -0,0 +1,353 @@
1/*
2 * Watchdog driver for SiByte SB1 SoCs
3 *
4 * Copyright (C) 2007 OnStor, Inc. * Andrew Sharp <andy.sharp@onstor.com>
5 *
6 * This driver is intended to make the second of two hardware watchdogs
7 * on the Sibyte 12XX and 11XX SoCs available to the user. There are two
8 * such devices available on the SoC, but it seems that there isn't an
9 * enumeration class for watchdogs in Linux like there is for RTCs.
10 * The second is used rather than the first because it uses IRQ 1,
11 * thereby avoiding all that IRQ 0 problematic nonsense.
12 *
13 * I have not tried this driver on a 1480 processor; it might work
14 * just well enough to really screw things up.
15 *
16 * It is a simple timer, and there is an interrupt that is raised the
17 * first time the timer expires. The second time it expires, the chip
18 * is reset and there is no way to redirect that NMI. Which could
19 * be problematic in some cases where this chip is sitting on the HT
20 * bus and has just taken responsibility for providing a cache block.
21 * Since the reset can't be redirected to the external reset pin, it is
22 * possible that other HT connected processors might hang and not reset.
23 * For Linux, a soft reset would probably be even worse than a hard reset.
24 * There you have it.
25 *
26 * The timer takes 23 bits of a 64 bit register (?) as a count value,
27 * and decrements the count every microsecond, for a max value of
28 * 0x7fffff usec or about 8.3ish seconds.
29 *
30 * This watchdog borrows some user semantics from the softdog driver,
31 * in that if you close the fd, it leaves the watchdog running, unless
32 * you previously wrote a 'V' to the fd, in which case it disables
33 * the watchdog when you close the fd like some other drivers.
34 *
35 * Based on various other watchdog drivers, which are probably all
36 * loosely based on something Alan Cox wrote years ago.
37 *
38 * (c) Copyright 1996 Alan Cox <alan@redhat.com>, All Rights Reserved.
39 * http://www.redhat.com
40 *
41 * This program is free software; you can redistribute it and/or
42 * modify it under the terms of the GNU General Public License
43 * version 1 or 2 as published by the Free Software Foundation.
44 *
45 */
46#include <linux/module.h>
47#include <linux/io.h>
48#include <linux/uaccess.h>
49#include <linux/fs.h>
50#include <linux/reboot.h>
51#include <linux/miscdevice.h>
52#include <linux/watchdog.h>
53#include <linux/interrupt.h>
54
55#include <asm/sibyte/sb1250.h>
56#include <asm/sibyte/sb1250_regs.h>
57#include <asm/sibyte/sb1250_int.h>
58#include <asm/sibyte/sb1250_scd.h>
59
60
61/*
62 * set the initial count value of a timer
63 *
64 * wdog is the iomem address of the cfg register
65 */
66void sbwdog_set(char __iomem *wdog, unsigned long t)
67{
68 __raw_writeb(0, wdog - 0x10);
69 __raw_writeq(t & 0x7fffffUL, wdog);
70}
71
72/*
73 * cause the timer to [re]load it's initial count and start counting
74 * all over again
75 *
76 * wdog is the iomem address of the cfg register
77 */
78void sbwdog_pet(char __iomem *wdog)
79{
80 __raw_writeb(__raw_readb(wdog) | 1, wdog);
81}
82
83static unsigned long sbwdog_gate; /* keeps it to one thread only */
84static char __iomem *kern_dog = (char __iomem *)(IO_BASE + (A_SCD_WDOG_CFG_0));
85static char __iomem *user_dog = (char __iomem *)(IO_BASE + (A_SCD_WDOG_CFG_1));
86static unsigned long timeout = 0x7fffffUL; /* useconds: 8.3ish secs. */
87static int expect_close;
88
89static struct watchdog_info ident = {
90 .options = WDIOF_CARDRESET | WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING,
91 .identity = "SiByte Watchdog",
92};
93
94/*
95 * Allow only a single thread to walk the dog
96 */
97static int sbwdog_open(struct inode *inode, struct file *file)
98{
99 nonseekable_open(inode, file);
100 if (test_and_set_bit(0, &sbwdog_gate)) {
101 return -EBUSY;
102 }
103 __module_get(THIS_MODULE);
104
105 /*
106 * Activate the timer
107 */
108 sbwdog_set(user_dog, timeout);
109 __raw_writeb(1, user_dog);
110
111 return 0;
112}
113
114/*
115 * Put the dog back in the kennel.
116 */
117static int sbwdog_release(struct inode *inode, struct file *file)
118{
119 if (expect_close == 42) {
120 __raw_writeb(0, user_dog);
121 module_put(THIS_MODULE);
122 } else {
123 printk(KERN_CRIT "%s: Unexpected close, not stopping watchdog!\n",
124 ident.identity);
125 sbwdog_pet(user_dog);
126 }
127 clear_bit(0, &sbwdog_gate);
128 expect_close = 0;
129
130 return 0;
131}
132
133/*
134 * 42 - the answer
135 */
136static ssize_t sbwdog_write(struct file *file, const char __user *data,
137 size_t len, loff_t *ppos)
138{
139 int i;
140
141 if (len) {
142 /*
143 * restart the timer
144 */
145 expect_close = 0;
146
147 for (i = 0; i != len; i++) {
148 char c;
149
150 if (get_user(c, data + i)) {
151 return -EFAULT;
152 }
153 if (c == 'V') {
154 expect_close = 42;
155 }
156 }
157 sbwdog_pet(user_dog);
158 }
159
160 return len;
161}
162
163static int sbwdog_ioctl(struct inode *inode, struct file *file,
164 unsigned int cmd, unsigned long arg)
165{
166 int ret = -ENOTTY;
167 unsigned long time;
168 void __user *argp = (void __user *)arg;
169 int __user *p = argp;
170
171 switch (cmd) {
172 case WDIOC_GETSUPPORT:
173 ret = copy_to_user(argp, &ident, sizeof(ident)) ? -EFAULT : 0;
174 break;
175
176 case WDIOC_GETSTATUS:
177 case WDIOC_GETBOOTSTATUS:
178 ret = put_user(0, p);
179 break;
180
181 case WDIOC_SETTIMEOUT:
182 ret = get_user(time, p);
183 if (ret) {
184 break;
185 }
186
187 time *= 1000000;
188 if (time > 0x7fffffUL) {
189 ret = -EINVAL;
190 break;
191 }
192 timeout = time;
193 sbwdog_set(user_dog, timeout);
194 sbwdog_pet(user_dog);
195
196 case WDIOC_GETTIMEOUT:
197 /*
198 * get the remaining count from the ... count register
199 * which is 1*8 before the config register
200 */
201 ret = put_user(__raw_readq(user_dog - 8) / 1000000, p);
202 break;
203
204 case WDIOC_KEEPALIVE:
205 sbwdog_pet(user_dog);
206 ret = 0;
207 break;
208 }
209 return ret;
210}
211
212/*
213 * Notifier for system down
214 */
215static int
216sbwdog_notify_sys(struct notifier_block *this, unsigned long code, void *erf)
217{
218 if (code == SYS_DOWN || code == SYS_HALT) {
219 /*
220 * sit and sit
221 */
222 __raw_writeb(0, user_dog);
223 __raw_writeb(0, kern_dog);
224 }
225
226 return NOTIFY_DONE;
227}
228
229static const struct file_operations sbwdog_fops =
230{
231 .owner = THIS_MODULE,
232 .llseek = no_llseek,
233 .write = sbwdog_write,
234 .ioctl = sbwdog_ioctl,
235 .open = sbwdog_open,
236 .release = sbwdog_release,
237};
238
239static struct miscdevice sbwdog_miscdev =
240{
241 .minor = WATCHDOG_MINOR,
242 .name = "watchdog",
243 .fops = &sbwdog_fops,
244};
245
246static struct notifier_block sbwdog_notifier = {
247 .notifier_call = sbwdog_notify_sys,
248};
249
250/*
251 * interrupt handler
252 *
253 * doesn't do a whole lot for user, but oh so cleverly written so kernel
254 * code can use it to re-up the watchdog, thereby saving the kernel from
255 * having to create and maintain a timer, just to tickle another timer,
256 * which is just so wrong.
257 */
258irqreturn_t sbwdog_interrupt(int irq, void *addr)
259{
260 unsigned long wd_init;
261 char *wd_cfg_reg = (char *)addr;
262 u8 cfg;
263
264 cfg = __raw_readb(wd_cfg_reg);
265 wd_init = __raw_readq(wd_cfg_reg - 8) & 0x7fffff;
266
267 /*
268 * if it's the second watchdog timer, it's for those users
269 */
270 if (wd_cfg_reg == user_dog) {
271 printk(KERN_CRIT
272 "%s in danger of initiating system reset in %ld.%01ld seconds\n",
273 ident.identity, wd_init / 1000000, (wd_init / 100000) % 10);
274 } else {
275 cfg |= 1;
276 }
277
278 __raw_writeb(cfg, wd_cfg_reg);
279
280 return IRQ_HANDLED;
281}
282
283static int __init sbwdog_init(void)
284{
285 int ret;
286
287 /*
288 * register a reboot notifier
289 */
290 ret = register_reboot_notifier(&sbwdog_notifier);
291 if (ret) {
292 printk (KERN_ERR "%s: cannot register reboot notifier (err=%d)\n",
293 ident.identity, ret);
294 return ret;
295 }
296
297 /*
298 * get the resources
299 */
300 ret = misc_register(&sbwdog_miscdev);
301 if (ret == 0) {
302 printk(KERN_INFO "%s: timeout is %ld.%ld secs\n", ident.identity,
303 timeout / 1000000, (timeout / 100000) % 10);
304 }
305
306 ret = request_irq(1, sbwdog_interrupt, IRQF_DISABLED | IRQF_SHARED,
307 ident.identity, (void *)user_dog);
308 if (ret) {
309 printk(KERN_ERR "%s: failed to request irq 1 - %d\n", ident.identity,
310 ret);
311 misc_deregister(&sbwdog_miscdev);
312 }
313
314 return ret;
315}
316
317static void __exit sbwdog_exit(void)
318{
319 misc_deregister(&sbwdog_miscdev);
320}
321
322module_init(sbwdog_init);
323module_exit(sbwdog_exit);
324
325MODULE_AUTHOR("Andrew Sharp <andy.sharp@onstor.com>");
326MODULE_DESCRIPTION("SiByte Watchdog");
327
328module_param(timeout, ulong, 0);
329MODULE_PARM_DESC(timeout,
330 "Watchdog timeout in microseconds (max/default 8388607 or 8.3ish secs)");
331
332MODULE_LICENSE("GPL");
333MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR);
334
335/*
336 * example code that can be put in a platform code area to utilize the
337 * first watchdog timer for the kernels own purpose.
338
339 void
340platform_wd_setup(void)
341{
342 int ret;
343
344 ret = request_irq(0, sbwdog_interrupt, IRQF_DISABLED | IRQF_SHARED,
345 "Kernel Watchdog", IOADDR(A_SCD_WDOG_CFG_0));
346 if (ret) {
347 printk(KERN_CRIT "Watchdog IRQ zero(0) failed to be requested - %d\n",
348 ret);
349 }
350}
351
352
353 */
diff --git a/fs/bio.c b/fs/bio.c
index 242e409dab4b..3312fcc3c098 100644
--- a/fs/bio.c
+++ b/fs/bio.c
@@ -903,7 +903,7 @@ void bio_set_pages_dirty(struct bio *bio)
903 } 903 }
904} 904}
905 905
906void bio_release_pages(struct bio *bio) 906static void bio_release_pages(struct bio *bio)
907{ 907{
908 struct bio_vec *bvec = bio->bi_io_vec; 908 struct bio_vec *bvec = bio->bi_io_vec;
909 int i; 909 int i;
diff --git a/fs/block_dev.c b/fs/block_dev.c
index 67fe72ce6ac7..7d822fae7765 100644
--- a/fs/block_dev.c
+++ b/fs/block_dev.c
@@ -31,6 +31,8 @@ struct bdev_inode {
31 struct inode vfs_inode; 31 struct inode vfs_inode;
32}; 32};
33 33
34static const struct address_space_operations def_blk_aops;
35
34static inline struct bdev_inode *BDEV_I(struct inode *inode) 36static inline struct bdev_inode *BDEV_I(struct inode *inode)
35{ 37{
36 return container_of(inode, struct bdev_inode, vfs_inode); 38 return container_of(inode, struct bdev_inode, vfs_inode);
@@ -171,203 +173,6 @@ blkdev_direct_IO(int rw, struct kiocb *iocb, const struct iovec *iov,
171 iov, offset, nr_segs, blkdev_get_blocks, NULL); 173 iov, offset, nr_segs, blkdev_get_blocks, NULL);
172} 174}
173 175
174#if 0
175static void blk_end_aio(struct bio *bio, int error)
176{
177 struct kiocb *iocb = bio->bi_private;
178 atomic_t *bio_count = &iocb->ki_bio_count;
179
180 if (bio_data_dir(bio) == READ)
181 bio_check_pages_dirty(bio);
182 else {
183 bio_release_pages(bio);
184 bio_put(bio);
185 }
186
187 /* iocb->ki_nbytes stores error code from LLDD */
188 if (error)
189 iocb->ki_nbytes = -EIO;
190
191 if (atomic_dec_and_test(bio_count)) {
192 if ((long)iocb->ki_nbytes < 0)
193 aio_complete(iocb, iocb->ki_nbytes, 0);
194 else
195 aio_complete(iocb, iocb->ki_left, 0);
196 }
197
198 return 0;
199}
200
201#define VEC_SIZE 16
202struct pvec {
203 unsigned short nr;
204 unsigned short idx;
205 struct page *page[VEC_SIZE];
206};
207
208#define PAGES_SPANNED(addr, len) \
209 (DIV_ROUND_UP((addr) + (len), PAGE_SIZE) - (addr) / PAGE_SIZE);
210
211/*
212 * get page pointer for user addr, we internally cache struct page array for
213 * (addr, count) range in pvec to avoid frequent call to get_user_pages. If
214 * internal page list is exhausted, a batch count of up to VEC_SIZE is used
215 * to get next set of page struct.
216 */
217static struct page *blk_get_page(unsigned long addr, size_t count, int rw,
218 struct pvec *pvec)
219{
220 int ret, nr_pages;
221 if (pvec->idx == pvec->nr) {
222 nr_pages = PAGES_SPANNED(addr, count);
223 nr_pages = min(nr_pages, VEC_SIZE);
224 down_read(&current->mm->mmap_sem);
225 ret = get_user_pages(current, current->mm, addr, nr_pages,
226 rw == READ, 0, pvec->page, NULL);
227 up_read(&current->mm->mmap_sem);
228 if (ret < 0)
229 return ERR_PTR(ret);
230 pvec->nr = ret;
231 pvec->idx = 0;
232 }
233 return pvec->page[pvec->idx++];
234}
235
236/* return a page back to pvec array */
237static void blk_unget_page(struct page *page, struct pvec *pvec)
238{
239 pvec->page[--pvec->idx] = page;
240}
241
242static ssize_t
243blkdev_direct_IO(int rw, struct kiocb *iocb, const struct iovec *iov,
244 loff_t pos, unsigned long nr_segs)
245{
246 struct inode *inode = iocb->ki_filp->f_mapping->host;
247 unsigned blkbits = blksize_bits(bdev_hardsect_size(I_BDEV(inode)));
248 unsigned blocksize_mask = (1 << blkbits) - 1;
249 unsigned long seg = 0; /* iov segment iterator */
250 unsigned long nvec; /* number of bio vec needed */
251 unsigned long cur_off; /* offset into current page */
252 unsigned long cur_len; /* I/O len of current page, up to PAGE_SIZE */
253
254 unsigned long addr; /* user iovec address */
255 size_t count; /* user iovec len */
256 size_t nbytes = iocb->ki_nbytes = iocb->ki_left; /* total xfer size */
257 loff_t size; /* size of block device */
258 struct bio *bio;
259 atomic_t *bio_count = &iocb->ki_bio_count;
260 struct page *page;
261 struct pvec pvec;
262
263 pvec.nr = 0;
264 pvec.idx = 0;
265
266 if (pos & blocksize_mask)
267 return -EINVAL;
268
269 size = i_size_read(inode);
270 if (pos + nbytes > size) {
271 nbytes = size - pos;
272 iocb->ki_left = nbytes;
273 }
274
275 /*
276 * check first non-zero iov alignment, the remaining
277 * iov alignment is checked inside bio loop below.
278 */
279 do {
280 addr = (unsigned long) iov[seg].iov_base;
281 count = min(iov[seg].iov_len, nbytes);
282 if (addr & blocksize_mask || count & blocksize_mask)
283 return -EINVAL;
284 } while (!count && ++seg < nr_segs);
285 atomic_set(bio_count, 1);
286
287 while (nbytes) {
288 /* roughly estimate number of bio vec needed */
289 nvec = (nbytes + PAGE_SIZE - 1) / PAGE_SIZE;
290 nvec = max(nvec, nr_segs - seg);
291 nvec = min(nvec, (unsigned long) BIO_MAX_PAGES);
292
293 /* bio_alloc should not fail with GFP_KERNEL flag */
294 bio = bio_alloc(GFP_KERNEL, nvec);
295 bio->bi_bdev = I_BDEV(inode);
296 bio->bi_end_io = blk_end_aio;
297 bio->bi_private = iocb;
298 bio->bi_sector = pos >> blkbits;
299same_bio:
300 cur_off = addr & ~PAGE_MASK;
301 cur_len = PAGE_SIZE - cur_off;
302 if (count < cur_len)
303 cur_len = count;
304
305 page = blk_get_page(addr, count, rw, &pvec);
306 if (unlikely(IS_ERR(page)))
307 goto backout;
308
309 if (bio_add_page(bio, page, cur_len, cur_off)) {
310 pos += cur_len;
311 addr += cur_len;
312 count -= cur_len;
313 nbytes -= cur_len;
314
315 if (count)
316 goto same_bio;
317 while (++seg < nr_segs) {
318 addr = (unsigned long) iov[seg].iov_base;
319 count = iov[seg].iov_len;
320 if (!count)
321 continue;
322 if (unlikely(addr & blocksize_mask ||
323 count & blocksize_mask)) {
324 page = ERR_PTR(-EINVAL);
325 goto backout;
326 }
327 count = min(count, nbytes);
328 goto same_bio;
329 }
330 } else {
331 blk_unget_page(page, &pvec);
332 }
333
334 /* bio is ready, submit it */
335 if (rw == READ)
336 bio_set_pages_dirty(bio);
337 atomic_inc(bio_count);
338 submit_bio(rw, bio);
339 }
340
341completion:
342 iocb->ki_left -= nbytes;
343 nbytes = iocb->ki_left;
344 iocb->ki_pos += nbytes;
345
346 blk_run_address_space(inode->i_mapping);
347 if (atomic_dec_and_test(bio_count))
348 aio_complete(iocb, nbytes, 0);
349
350 return -EIOCBQUEUED;
351
352backout:
353 /*
354 * back out nbytes count constructed so far for this bio,
355 * we will throw away current bio.
356 */
357 nbytes += bio->bi_size;
358 bio_release_pages(bio);
359 bio_put(bio);
360
361 /*
362 * if no bio was submmitted, return the error code.
363 * otherwise, proceed with pending I/O completion.
364 */
365 if (atomic_read(bio_count) == 1)
366 return PTR_ERR(page);
367 goto completion;
368}
369#endif
370
371static int blkdev_writepage(struct page *page, struct writeback_control *wbc) 176static int blkdev_writepage(struct page *page, struct writeback_control *wbc)
372{ 177{
373 return block_write_full_page(page, blkdev_get_block, wbc); 178 return block_write_full_page(page, blkdev_get_block, wbc);
@@ -1334,7 +1139,7 @@ static long block_ioctl(struct file *file, unsigned cmd, unsigned long arg)
1334 return blkdev_ioctl(file->f_mapping->host, file, cmd, arg); 1139 return blkdev_ioctl(file->f_mapping->host, file, cmd, arg);
1335} 1140}
1336 1141
1337const struct address_space_operations def_blk_aops = { 1142static const struct address_space_operations def_blk_aops = {
1338 .readpage = blkdev_readpage, 1143 .readpage = blkdev_readpage,
1339 .writepage = blkdev_writepage, 1144 .writepage = blkdev_writepage,
1340 .sync_page = block_sync_page, 1145 .sync_page = block_sync_page,
diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
index f784d2f34149..f054778e916c 100644
--- a/include/asm-generic/vmlinux.lds.h
+++ b/include/asm-generic/vmlinux.lds.h
@@ -238,6 +238,9 @@
238 *(.kprobes.text) \ 238 *(.kprobes.text) \
239 VMLINUX_SYMBOL(__kprobes_text_end) = .; 239 VMLINUX_SYMBOL(__kprobes_text_end) = .;
240 240
241/* Section used for early init (in .S files) */
242#define HEAD_TEXT *(.head.text)
243
241/* init and exit section handling */ 244/* init and exit section handling */
242#define INIT_DATA \ 245#define INIT_DATA \
243 *(.init.data) \ 246 *(.init.data) \
diff --git a/include/asm-mips/mach-ip27/dma-coherence.h b/include/asm-mips/mach-ip27/dma-coherence.h
index 3fdbbf68e952..ed7e6222dc15 100644
--- a/include/asm-mips/mach-ip27/dma-coherence.h
+++ b/include/asm-mips/mach-ip27/dma-coherence.h
@@ -35,7 +35,7 @@ static dma_addr_t plat_map_dma_mem_page(struct device *dev, struct page *page)
35 35
36static unsigned long plat_dma_addr_to_phys(dma_addr_t dma_addr) 36static unsigned long plat_dma_addr_to_phys(dma_addr_t dma_addr)
37{ 37{
38 return dma_addr & (0xffUL << 56); 38 return dma_addr & ~(0xffUL << 56);
39} 39}
40 40
41static inline void plat_unmap_dma_mem(dma_addr_t dma_addr) 41static inline void plat_unmap_dma_mem(dma_addr_t dma_addr)
diff --git a/include/asm-mips/qemu.h b/include/asm-mips/qemu.h
deleted file mode 100644
index 487ced4a40de..000000000000
--- a/include/asm-mips/qemu.h
+++ /dev/null
@@ -1,30 +0,0 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 2005 by Ralf Baechle (ralf@linux-mips.org)
7 */
8#ifndef __ASM_QEMU_H
9#define __ASM_QEMU_H
10
11/*
12 * Interrupt numbers
13 */
14#define Q_PIC_IRQ_BASE 0
15#define Q_COUNT_COMPARE_IRQ 23
16
17/*
18 * Qemu clock rate. Unlike on real MIPS this has no relation to the
19 * instruction issue rate, so the choosen value is pure fiction, just needs
20 * to match the value in Qemu itself.
21 */
22#define QEMU_C0_COUNTER_CLOCK 100000000
23
24/*
25 * Magic qemu system control location.
26 */
27#define QEMU_RESTART_REG 0xBFBF0000
28#define QEMU_HALT_REG 0xBFBF0004
29
30#endif /* __ASM_QEMU_H */
diff --git a/include/asm-mips/sni.h b/include/asm-mips/sni.h
index e716447e5e03..8c1eb02c6d16 100644
--- a/include/asm-mips/sni.h
+++ b/include/asm-mips/sni.h
@@ -228,7 +228,14 @@ extern void sni_pcimt_irq_init(void);
228extern void sni_cpu_time_init(void); 228extern void sni_cpu_time_init(void);
229 229
230/* eisa init for RM200/400 */ 230/* eisa init for RM200/400 */
231#ifdef CONFIG_EISA
231extern int sni_eisa_root_init(void); 232extern int sni_eisa_root_init(void);
233#else
234static inline int sni_eisa_root_init(void)
235{
236 return 0;
237}
238#endif
232 239
233/* common irq stuff */ 240/* common irq stuff */
234extern void (*sni_hwint)(void); 241extern void (*sni_hwint)(void);
diff --git a/include/asm-mips/unistd.h b/include/asm-mips/unistd.h
index fa9a587b3bf1..4964c82f85f9 100644
--- a/include/asm-mips/unistd.h
+++ b/include/asm-mips/unistd.h
@@ -341,16 +341,19 @@
341#define __NR_timerfd (__NR_Linux + 318) 341#define __NR_timerfd (__NR_Linux + 318)
342#define __NR_eventfd (__NR_Linux + 319) 342#define __NR_eventfd (__NR_Linux + 319)
343#define __NR_fallocate (__NR_Linux + 320) 343#define __NR_fallocate (__NR_Linux + 320)
344#define __NR_timerfd_create (__NR_Linux + 321)
345#define __NR_timerfd_gettime (__NR_Linux + 322)
346#define __NR_timerfd_settime (__NR_Linux + 323)
344 347
345/* 348/*
346 * Offset of the last Linux o32 flavoured syscall 349 * Offset of the last Linux o32 flavoured syscall
347 */ 350 */
348#define __NR_Linux_syscalls 320 351#define __NR_Linux_syscalls 323
349 352
350#endif /* _MIPS_SIM == _MIPS_SIM_ABI32 */ 353#endif /* _MIPS_SIM == _MIPS_SIM_ABI32 */
351 354
352#define __NR_O32_Linux 4000 355#define __NR_O32_Linux 4000
353#define __NR_O32_Linux_syscalls 320 356#define __NR_O32_Linux_syscalls 323
354 357
355#if _MIPS_SIM == _MIPS_SIM_ABI64 358#if _MIPS_SIM == _MIPS_SIM_ABI64
356 359
@@ -638,16 +641,19 @@
638#define __NR_timerfd (__NR_Linux + 277) 641#define __NR_timerfd (__NR_Linux + 277)
639#define __NR_eventfd (__NR_Linux + 278) 642#define __NR_eventfd (__NR_Linux + 278)
640#define __NR_fallocate (__NR_Linux + 279) 643#define __NR_fallocate (__NR_Linux + 279)
644#define __NR_timerfd_create (__NR_Linux + 280)
645#define __NR_timerfd_gettime (__NR_Linux + 281)
646#define __NR_timerfd_settime (__NR_Linux + 282)
641 647
642/* 648/*
643 * Offset of the last Linux 64-bit flavoured syscall 649 * Offset of the last Linux 64-bit flavoured syscall
644 */ 650 */
645#define __NR_Linux_syscalls 279 651#define __NR_Linux_syscalls 282
646 652
647#endif /* _MIPS_SIM == _MIPS_SIM_ABI64 */ 653#endif /* _MIPS_SIM == _MIPS_SIM_ABI64 */
648 654
649#define __NR_64_Linux 5000 655#define __NR_64_Linux 5000
650#define __NR_64_Linux_syscalls 279 656#define __NR_64_Linux_syscalls 282
651 657
652#if _MIPS_SIM == _MIPS_SIM_NABI32 658#if _MIPS_SIM == _MIPS_SIM_NABI32
653 659
@@ -939,16 +945,19 @@
939#define __NR_timerfd (__NR_Linux + 281) 945#define __NR_timerfd (__NR_Linux + 281)
940#define __NR_eventfd (__NR_Linux + 282) 946#define __NR_eventfd (__NR_Linux + 282)
941#define __NR_fallocate (__NR_Linux + 283) 947#define __NR_fallocate (__NR_Linux + 283)
948#define __NR_timerfd_create (__NR_Linux + 284)
949#define __NR_timerfd_gettime (__NR_Linux + 285)
950#define __NR_timerfd_settime (__NR_Linux + 286)
942 951
943/* 952/*
944 * Offset of the last N32 flavoured syscall 953 * Offset of the last N32 flavoured syscall
945 */ 954 */
946#define __NR_Linux_syscalls 283 955#define __NR_Linux_syscalls 286
947 956
948#endif /* _MIPS_SIM == _MIPS_SIM_NABI32 */ 957#endif /* _MIPS_SIM == _MIPS_SIM_NABI32 */
949 958
950#define __NR_N32_Linux 6000 959#define __NR_N32_Linux 6000
951#define __NR_N32_Linux_syscalls 283 960#define __NR_N32_Linux_syscalls 286
952 961
953#ifdef __KERNEL__ 962#ifdef __KERNEL__
954 963
diff --git a/include/asm-s390/bitops.h b/include/asm-s390/bitops.h
index ab83c844d04c..965394e69452 100644
--- a/include/asm-s390/bitops.h
+++ b/include/asm-s390/bitops.h
@@ -456,16 +456,18 @@ static inline unsigned long __ffz_word_loop(const unsigned long *addr,
456 456
457 asm volatile( 457 asm volatile(
458#ifndef __s390x__ 458#ifndef __s390x__
459 " ahi %1,31\n" 459 " ahi %1,-1\n"
460 " srl %1,5\n" 460 " sra %1,5\n"
461 " jz 1f\n"
461 "0: c %2,0(%0,%3)\n" 462 "0: c %2,0(%0,%3)\n"
462 " jne 1f\n" 463 " jne 1f\n"
463 " la %0,4(%0)\n" 464 " la %0,4(%0)\n"
464 " brct %1,0b\n" 465 " brct %1,0b\n"
465 "1:\n" 466 "1:\n"
466#else 467#else
467 " aghi %1,63\n" 468 " aghi %1,-1\n"
468 " srlg %1,%1,6\n" 469 " srag %1,%1,6\n"
470 " jz 1f\n"
469 "0: cg %2,0(%0,%3)\n" 471 "0: cg %2,0(%0,%3)\n"
470 " jne 1f\n" 472 " jne 1f\n"
471 " la %0,8(%0)\n" 473 " la %0,8(%0)\n"
@@ -491,16 +493,18 @@ static inline unsigned long __ffs_word_loop(const unsigned long *addr,
491 493
492 asm volatile( 494 asm volatile(
493#ifndef __s390x__ 495#ifndef __s390x__
494 " ahi %1,31\n" 496 " ahi %1,-1\n"
495 " srl %1,5\n" 497 " sra %1,5\n"
498 " jz 1f\n"
496 "0: c %2,0(%0,%3)\n" 499 "0: c %2,0(%0,%3)\n"
497 " jne 1f\n" 500 " jne 1f\n"
498 " la %0,4(%0)\n" 501 " la %0,4(%0)\n"
499 " brct %1,0b\n" 502 " brct %1,0b\n"
500 "1:\n" 503 "1:\n"
501#else 504#else
502 " aghi %1,63\n" 505 " aghi %1,-1\n"
503 " srlg %1,%1,6\n" 506 " srag %1,%1,6\n"
507 " jz 1f\n"
504 "0: cg %2,0(%0,%3)\n" 508 "0: cg %2,0(%0,%3)\n"
505 " jne 1f\n" 509 " jne 1f\n"
506 " la %0,8(%0)\n" 510 " la %0,8(%0)\n"
diff --git a/include/asm-sparc64/ptrace.h b/include/asm-sparc64/ptrace.h
index 8617c3a5143b..67341cff2e6b 100644
--- a/include/asm-sparc64/ptrace.h
+++ b/include/asm-sparc64/ptrace.h
@@ -102,6 +102,7 @@ do { current_thread_info()->syscall_noerror = 1; \
102} while (0) 102} while (0)
103#define user_mode(regs) (!((regs)->tstate & TSTATE_PRIV)) 103#define user_mode(regs) (!((regs)->tstate & TSTATE_PRIV))
104#define instruction_pointer(regs) ((regs)->tpc) 104#define instruction_pointer(regs) ((regs)->tpc)
105#define regs_return_value(regs) ((regs)->u_regs[UREG_I0])
105#ifdef CONFIG_SMP 106#ifdef CONFIG_SMP
106extern unsigned long profile_pc(struct pt_regs *); 107extern unsigned long profile_pc(struct pt_regs *);
107#else 108#else
diff --git a/include/asm-x86/i387.h b/include/asm-x86/i387.h
index 6b1895ccd6b7..f377b76b2f34 100644
--- a/include/asm-x86/i387.h
+++ b/include/asm-x86/i387.h
@@ -20,7 +20,6 @@
20#include <asm/uaccess.h> 20#include <asm/uaccess.h>
21 21
22extern void fpu_init(void); 22extern void fpu_init(void);
23extern unsigned int mxcsr_feature_mask;
24extern void mxcsr_feature_mask_init(void); 23extern void mxcsr_feature_mask_init(void);
25extern void init_fpu(struct task_struct *child); 24extern void init_fpu(struct task_struct *child);
26extern asmlinkage void math_state_restore(void); 25extern asmlinkage void math_state_restore(void);
diff --git a/include/asm-x86/pgtable_64.h b/include/asm-x86/pgtable_64.h
index 7fd5e0e2361e..0a0b77bc736a 100644
--- a/include/asm-x86/pgtable_64.h
+++ b/include/asm-x86/pgtable_64.h
@@ -188,6 +188,7 @@ static inline unsigned long pmd_bad(pmd_t pmd)
188#define pgd_offset(mm, addr) ((mm)->pgd + pgd_index(addr)) 188#define pgd_offset(mm, addr) ((mm)->pgd + pgd_index(addr))
189#define pgd_offset_k(address) (init_level4_pgt + pgd_index(address)) 189#define pgd_offset_k(address) (init_level4_pgt + pgd_index(address))
190#define pgd_present(pgd) (pgd_val(pgd) & _PAGE_PRESENT) 190#define pgd_present(pgd) (pgd_val(pgd) & _PAGE_PRESENT)
191static inline int pgd_large(pgd_t pgd) { return 0; }
191#define mk_kernel_pgd(address) ((pgd_t){ (address) | _KERNPG_TABLE }) 192#define mk_kernel_pgd(address) ((pgd_t){ (address) | _KERNPG_TABLE })
192 193
193/* PUD - Level3 access */ 194/* PUD - Level3 access */
diff --git a/include/asm-x86/processor.h b/include/asm-x86/processor.h
index 149920dcd341..45a2f0ab33d0 100644
--- a/include/asm-x86/processor.h
+++ b/include/asm-x86/processor.h
@@ -302,10 +302,6 @@ union i387_union {
302}; 302};
303 303
304#ifdef CONFIG_X86_32 304#ifdef CONFIG_X86_32
305/*
306 * the following now lives in the per cpu area:
307 * extern int cpu_llc_id[NR_CPUS];
308 */
309DECLARE_PER_CPU(u8, cpu_llc_id); 305DECLARE_PER_CPU(u8, cpu_llc_id);
310#else 306#else
311DECLARE_PER_CPU(struct orig_ist, orig_ist); 307DECLARE_PER_CPU(struct orig_ist, orig_ist);
@@ -671,7 +667,6 @@ extern void init_gdt(int cpu);
671extern unsigned int machine_id; 667extern unsigned int machine_id;
672extern unsigned int machine_submodel_id; 668extern unsigned int machine_submodel_id;
673extern unsigned int BIOS_revision; 669extern unsigned int BIOS_revision;
674extern unsigned int mca_pentium_flag;
675 670
676/* Boot loader type from the setup header */ 671/* Boot loader type from the setup header */
677extern int bootloader_type; 672extern int bootloader_type;
diff --git a/include/asm-xtensa/cacheflush.h b/include/asm-xtensa/cacheflush.h
index b773c57e75a5..94c4c53a099e 100644
--- a/include/asm-xtensa/cacheflush.h
+++ b/include/asm-xtensa/cacheflush.h
@@ -70,6 +70,8 @@ extern void __flush_invalidate_dcache_page_alias(unsigned long, unsigned long);
70#endif 70#endif
71#if (ICACHE_WAY_SIZE > PAGE_SIZE) 71#if (ICACHE_WAY_SIZE > PAGE_SIZE)
72extern void __invalidate_icache_page_alias(unsigned long, unsigned long); 72extern void __invalidate_icache_page_alias(unsigned long, unsigned long);
73#else
74# define __invalidate_icache_page_alias(v,p) do { } while(0)
73#endif 75#endif
74 76
75/* 77/*
diff --git a/include/asm-xtensa/coprocessor.h b/include/asm-xtensa/coprocessor.h
index aa2121034558..1cbcf9001a41 100644
--- a/include/asm-xtensa/coprocessor.h
+++ b/include/asm-xtensa/coprocessor.h
@@ -5,81 +5,173 @@
5 * License. See the file "COPYING" in the main directory of this archive 5 * License. See the file "COPYING" in the main directory of this archive
6 * for more details. 6 * for more details.
7 * 7 *
8 * Copyright (C) 2003 - 2005 Tensilica Inc. 8 * Copyright (C) 2003 - 2007 Tensilica Inc.
9 */ 9 */
10 10
11
11#ifndef _XTENSA_COPROCESSOR_H 12#ifndef _XTENSA_COPROCESSOR_H
12#define _XTENSA_COPROCESSOR_H 13#define _XTENSA_COPROCESSOR_H
13 14
14#include <asm/variant/core.h> 15#include <linux/stringify.h>
15#include <asm/variant/tie.h> 16#include <asm/variant/tie.h>
17#include <asm/types.h>
18
19#ifdef __ASSEMBLY__
20# include <asm/variant/tie-asm.h>
21
22.macro xchal_sa_start a b
23 .set .Lxchal_pofs_, 0
24 .set .Lxchal_ofs_, 0
25.endm
26
27.macro xchal_sa_align ptr minofs maxofs ofsalign totalign
28 .set .Lxchal_ofs_, .Lxchal_ofs_ + .Lxchal_pofs_ + \totalign - 1
29 .set .Lxchal_ofs_, (.Lxchal_ofs_ & -\totalign) - .Lxchal_pofs_
30.endm
31
32#define _SELECT ( XTHAL_SAS_TIE | XTHAL_SAS_OPT \
33 | XTHAL_SAS_CC \
34 | XTHAL_SAS_CALR | XTHAL_SAS_CALE )
35
36.macro save_xtregs_opt ptr clb at1 at2 at3 at4 offset
37 .if XTREGS_OPT_SIZE > 0
38 addi \clb, \ptr, \offset
39 xchal_ncp_store \clb \at1 \at2 \at3 \at4 select=_SELECT
40 .endif
41.endm
42
43.macro load_xtregs_opt ptr clb at1 at2 at3 at4 offset
44 .if XTREGS_OPT_SIZE > 0
45 addi \clb, \ptr, \offset
46 xchal_ncp_load \clb \at1 \at2 \at3 \at4 select=_SELECT
47 .endif
48.endm
49#undef _SELECT
50
51#define _SELECT ( XTHAL_SAS_TIE | XTHAL_SAS_OPT \
52 | XTHAL_SAS_NOCC \
53 | XTHAL_SAS_CALR | XTHAL_SAS_CALE | XTHAL_SAS_GLOB )
54
55.macro save_xtregs_user ptr clb at1 at2 at3 at4 offset
56 .if XTREGS_USER_SIZE > 0
57 addi \clb, \ptr, \offset
58 xchal_ncp_store \clb \at1 \at2 \at3 \at4 select=_SELECT
59 .endif
60.endm
61
62.macro load_xtregs_user ptr clb at1 at2 at3 at4 offset
63 .if XTREGS_USER_SIZE > 0
64 addi \clb, \ptr, \offset
65 xchal_ncp_load \clb \at1 \at2 \at3 \at4 select=_SELECT
66 .endif
67.endm
68#undef _SELECT
69
70
71
72#endif /* __ASSEMBLY__ */
16 73
17#if !XCHAL_HAVE_CP
18
19#define XTENSA_CP_EXTRA_OFFSET 0
20#define XTENSA_CP_EXTRA_ALIGN 1 /* must be a power of 2 */
21#define XTENSA_CP_EXTRA_SIZE 0
22
23#else
24
25#define XTOFS(last_start,last_size,align) \
26 ((last_start+last_size+align-1) & -align)
27
28#define XTENSA_CP_EXTRA_OFFSET 0
29#define XTENSA_CP_EXTRA_ALIGN XCHAL_EXTRA_SA_ALIGN
30
31#define XTENSA_CPE_CP0_OFFSET \
32 XTOFS(XTENSA_CP_EXTRA_OFFSET, XCHAL_EXTRA_SA_SIZE, XCHAL_CP0_SA_ALIGN)
33#define XTENSA_CPE_CP1_OFFSET \
34 XTOFS(XTENSA_CPE_CP0_OFFSET, XCHAL_CP0_SA_SIZE, XCHAL_CP1_SA_ALIGN)
35#define XTENSA_CPE_CP2_OFFSET \
36 XTOFS(XTENSA_CPE_CP1_OFFSET, XCHAL_CP1_SA_SIZE, XCHAL_CP2_SA_ALIGN)
37#define XTENSA_CPE_CP3_OFFSET \
38 XTOFS(XTENSA_CPE_CP2_OFFSET, XCHAL_CP2_SA_SIZE, XCHAL_CP3_SA_ALIGN)
39#define XTENSA_CPE_CP4_OFFSET \
40 XTOFS(XTENSA_CPE_CP3_OFFSET, XCHAL_CP3_SA_SIZE, XCHAL_CP4_SA_ALIGN)
41#define XTENSA_CPE_CP5_OFFSET \
42 XTOFS(XTENSA_CPE_CP4_OFFSET, XCHAL_CP4_SA_SIZE, XCHAL_CP5_SA_ALIGN)
43#define XTENSA_CPE_CP6_OFFSET \
44 XTOFS(XTENSA_CPE_CP5_OFFSET, XCHAL_CP5_SA_SIZE, XCHAL_CP6_SA_ALIGN)
45#define XTENSA_CPE_CP7_OFFSET \
46 XTOFS(XTENSA_CPE_CP6_OFFSET, XCHAL_CP6_SA_SIZE, XCHAL_CP7_SA_ALIGN)
47#define XTENSA_CP_EXTRA_SIZE \
48 XTOFS(XTENSA_CPE_CP7_OFFSET, XCHAL_CP7_SA_SIZE, 16)
49
50#if XCHAL_CP_NUM > 0
51# ifndef __ASSEMBLY__
52/* 74/*
53 * Tasks that own contents of (last user) each coprocessor. 75 * XTENSA_HAVE_COPROCESSOR(x) returns 1 if coprocessor x is configured.
54 * Entries are 0 for not-owned or non-existent coprocessors. 76 *
55 * Note: The size of this structure is fixed to 8 bytes in entry.S 77 * XTENSA_HAVE_IO_PORT(x) returns 1 if io-port x is configured.
78 *
56 */ 79 */
57typedef struct {
58 struct task_struct *owner; /* owner */
59 int offset; /* offset in cpextra space. */
60} coprocessor_info_t;
61# else
62# define COPROCESSOR_INFO_OWNER 0
63# define COPROCESSOR_INFO_OFFSET 4
64# define COPROCESSOR_INFO_SIZE 8
65# endif
66#endif
67#endif /* XCHAL_HAVE_CP */
68 80
81#define XTENSA_HAVE_COPROCESSOR(x) \
82 ((XCHAL_CP_MASK ^ XCHAL_CP_PORT_MASK) & (1 << (x)))
83#define XTENSA_HAVE_COPROCESSORS \
84 (XCHAL_CP_MASK ^ XCHAL_CP_PORT_MASK)
85#define XTENSA_HAVE_IO_PORT(x) \
86 (XCHAL_CP_PORT_MASK & (1 << (x)))
87#define XTENSA_HAVE_IO_PORTS \
88 XCHAL_CP_PORT_MASK
69 89
70#ifndef __ASSEMBLY__ 90#ifndef __ASSEMBLY__
71# if XCHAL_CP_NUM > 0
72struct task_struct;
73extern void release_coprocessors (struct task_struct*);
74extern void save_coprocessor_registers(void*, int);
75# else
76# define release_coprocessors(task)
77# endif
78 91
79typedef unsigned char cp_state_t[XTENSA_CP_EXTRA_SIZE]
80 __attribute__ ((aligned (XTENSA_CP_EXTRA_ALIGN)));
81 92
82#endif /* !__ASSEMBLY__ */ 93#if XCHAL_HAVE_CP
94
95#define RSR_CPENABLE(x) do { \
96 __asm__ __volatile__("rsr %0," __stringify(CPENABLE) : "=a" (x)); \
97 } while(0);
98#define WSR_CPENABLE(x) do { \
99 __asm__ __volatile__("wsr %0," __stringify(CPENABLE) "; rsync" \
100 :: "a" (x)); \
101 } while(0);
83 102
103#endif /* XCHAL_HAVE_CP */
84 104
105
106/*
107 * Additional registers.
108 * We define three types of additional registers:
109 * ext: extra registers that are used by the compiler
110 * cpn: optional registers that can be used by a user application
111 * cpX: coprocessor registers that can only be used if the corresponding
112 * CPENABLE bit is set.
113 */
114
115#define XCHAL_SA_REG(list,cc,abi,type,y,name,z,align,size,...) \
116 __REG ## list (cc, abi, type, name, size, align)
117
118#define __REG0(cc,abi,t,name,s,a) __REG0_ ## cc (abi,name)
119#define __REG1(cc,abi,t,name,s,a) __REG1_ ## cc (name)
120#define __REG2(cc,abi,type,...) __REG2_ ## type (__VA_ARGS__)
121
122#define __REG0_0(abi,name)
123#define __REG0_1(abi,name) __REG0_1 ## abi (name)
124#define __REG0_10(name) __u32 name;
125#define __REG0_11(name) __u32 name;
126#define __REG0_12(name)
127
128#define __REG1_0(name) __u32 name;
129#define __REG1_1(name)
130
131#define __REG2_0(n,s,a) __u32 name;
132#define __REG2_1(n,s,a) unsigned char n[s] __attribute__ ((aligned(a)));
133#define __REG2_2(n,s,a) unsigned char n[s] __attribute__ ((aligned(a)));
134
135typedef struct { XCHAL_NCP_SA_LIST(0) } xtregs_opt_t
136 __attribute__ ((aligned (XCHAL_NCP_SA_ALIGN)));
137typedef struct { XCHAL_NCP_SA_LIST(1) } xtregs_user_t
138 __attribute__ ((aligned (XCHAL_NCP_SA_ALIGN)));
139
140#if XTENSA_HAVE_COPROCESSORS
141
142typedef struct { XCHAL_CP0_SA_LIST(2) } xtregs_cp0_t
143 __attribute__ ((aligned (XCHAL_CP0_SA_ALIGN)));
144typedef struct { XCHAL_CP1_SA_LIST(2) } xtregs_cp1_t
145 __attribute__ ((aligned (XCHAL_CP1_SA_ALIGN)));
146typedef struct { XCHAL_CP2_SA_LIST(2) } xtregs_cp2_t
147 __attribute__ ((aligned (XCHAL_CP2_SA_ALIGN)));
148typedef struct { XCHAL_CP3_SA_LIST(2) } xtregs_cp3_t
149 __attribute__ ((aligned (XCHAL_CP3_SA_ALIGN)));
150typedef struct { XCHAL_CP4_SA_LIST(2) } xtregs_cp4_t
151 __attribute__ ((aligned (XCHAL_CP4_SA_ALIGN)));
152typedef struct { XCHAL_CP5_SA_LIST(2) } xtregs_cp5_t
153 __attribute__ ((aligned (XCHAL_CP5_SA_ALIGN)));
154typedef struct { XCHAL_CP6_SA_LIST(2) } xtregs_cp6_t
155 __attribute__ ((aligned (XCHAL_CP6_SA_ALIGN)));
156typedef struct { XCHAL_CP7_SA_LIST(2) } xtregs_cp7_t
157 __attribute__ ((aligned (XCHAL_CP7_SA_ALIGN)));
158
159extern struct thread_info* coprocessor_owner[XCHAL_CP_MAX];
160extern void coprocessor_save(void*, int);
161extern void coprocessor_load(void*, int);
162extern void coprocessor_flush(struct thread_info*, int);
163extern void coprocessor_restore(struct thread_info*, int);
164
165extern void coprocessor_release_all(struct thread_info*);
166extern void coprocessor_flush_all(struct thread_info*);
167
168static inline void coprocessor_clear_cpenable(void)
169{
170 unsigned long i = 0;
171 WSR_CPENABLE(i);
172}
173
174#endif /* XTENSA_HAVE_COPROCESSORS */
175
176#endif /* !__ASSEMBLY__ */
85#endif /* _XTENSA_COPROCESSOR_H */ 177#endif /* _XTENSA_COPROCESSOR_H */
diff --git a/include/asm-xtensa/elf.h b/include/asm-xtensa/elf.h
index 467384542502..ca6e5101a2cb 100644
--- a/include/asm-xtensa/elf.h
+++ b/include/asm-xtensa/elf.h
@@ -72,115 +72,32 @@
72 72
73/* ELF register definitions. This is needed for core dump support. */ 73/* ELF register definitions. This is needed for core dump support. */
74 74
75/*
76 * elf_gregset_t contains the application-level state in the following order:
77 * Processor info: config_version, cpuxy
78 * Processor state: pc, ps, exccause, excvaddr, wb, ws,
79 * lbeg, lend, lcount, sar
80 * GP regs: ar0 - arXX
81 */
82
83typedef unsigned long elf_greg_t; 75typedef unsigned long elf_greg_t;
84 76
85typedef struct { 77typedef struct {
86 elf_greg_t xchal_config_id0;
87 elf_greg_t xchal_config_id1;
88 elf_greg_t cpux;
89 elf_greg_t cpuy;
90 elf_greg_t pc; 78 elf_greg_t pc;
91 elf_greg_t ps; 79 elf_greg_t ps;
92 elf_greg_t exccause;
93 elf_greg_t excvaddr;
94 elf_greg_t windowbase;
95 elf_greg_t windowstart;
96 elf_greg_t lbeg; 80 elf_greg_t lbeg;
97 elf_greg_t lend; 81 elf_greg_t lend;
98 elf_greg_t lcount; 82 elf_greg_t lcount;
99 elf_greg_t sar; 83 elf_greg_t sar;
100 elf_greg_t syscall; 84 elf_greg_t windowstart;
101 elf_greg_t ar[64]; 85 elf_greg_t windowbase;
86 elf_greg_t reserved[8+48];
87 elf_greg_t a[64];
102} xtensa_gregset_t; 88} xtensa_gregset_t;
103 89
104#define ELF_NGREG (sizeof(xtensa_gregset_t) / sizeof(elf_greg_t)) 90#define ELF_NGREG (sizeof(xtensa_gregset_t) / sizeof(elf_greg_t))
105 91
106typedef elf_greg_t elf_gregset_t[ELF_NGREG]; 92typedef elf_greg_t elf_gregset_t[ELF_NGREG];
107 93
108/* 94#define ELF_NFPREG 18
109 * Compute the size of the coprocessor and extra state layout (register info)
110 * table (in bytes).
111 * This is actually the maximum size of the table, as opposed to the size,
112 * which is available from the _xtensa_reginfo_table_size global variable.
113 *
114 * (See also arch/xtensa/kernel/coprocessor.S)
115 *
116 */
117
118#ifndef XCHAL_EXTRA_SA_CONTENTS_LIBDB_NUM
119# define XTENSA_CPE_LTABLE_SIZE 0
120#else
121# define XTENSA_CPE_SEGMENT(num) (num ? (1+num) : 0)
122# define XTENSA_CPE_LTABLE_ENTRIES \
123 ( XTENSA_CPE_SEGMENT(XCHAL_EXTRA_SA_CONTENTS_LIBDB_NUM) \
124 + XTENSA_CPE_SEGMENT(XCHAL_CP0_SA_CONTENTS_LIBDB_NUM) \
125 + XTENSA_CPE_SEGMENT(XCHAL_CP1_SA_CONTENTS_LIBDB_NUM) \
126 + XTENSA_CPE_SEGMENT(XCHAL_CP2_SA_CONTENTS_LIBDB_NUM) \
127 + XTENSA_CPE_SEGMENT(XCHAL_CP3_SA_CONTENTS_LIBDB_NUM) \
128 + XTENSA_CPE_SEGMENT(XCHAL_CP4_SA_CONTENTS_LIBDB_NUM) \
129 + XTENSA_CPE_SEGMENT(XCHAL_CP5_SA_CONTENTS_LIBDB_NUM) \
130 + XTENSA_CPE_SEGMENT(XCHAL_CP6_SA_CONTENTS_LIBDB_NUM) \
131 + XTENSA_CPE_SEGMENT(XCHAL_CP7_SA_CONTENTS_LIBDB_NUM) \
132 + 1 /* final entry */ \
133 )
134# define XTENSA_CPE_LTABLE_SIZE (XTENSA_CPE_LTABLE_ENTRIES * 8)
135#endif
136
137
138/*
139 * Instantiations of the elf_fpregset_t type contain, in most
140 * architectures, the floating point (FPU) register set.
141 * For Xtensa, this type is extended to contain all custom state,
142 * ie. coprocessor and "extra" (non-coprocessor) state (including,
143 * for example, TIE-defined states and register files; as well
144 * as other optional processor state).
145 * This includes FPU state if a floating-point coprocessor happens
146 * to have been configured within the Xtensa processor.
147 *
148 * TOTAL_FPREGS_SIZE is the required size (without rounding)
149 * of elf_fpregset_t. It provides space for the following:
150 *
151 * a) 32-bit mask of active coprocessors for this task (similar
152 * to CPENABLE in single-threaded Xtensa processor systems)
153 *
154 * b) table describing the layout of custom states (ie. of
155 * individual registers, etc) within the save areas
156 *
157 * c) save areas for each coprocessor and for non-coprocessor
158 * ("extra") state
159 *
160 * Note that save areas may require up to 16-byte alignment when
161 * accessed by save/restore sequences. We do not need to ensure
162 * such alignment in an elf_fpregset_t structure because custom
163 * state is not directly loaded/stored into it; rather, save area
164 * contents are copied to elf_fpregset_t from the active save areas
165 * (see 'struct task_struct' definition in processor.h for that)
166 * using memcpy(). But we do allow space for such alignment,
167 * to allow optimizations of layout and copying.
168 */
169#if 0
170#define TOTAL_FPREGS_SIZE \
171 (4 + XTENSA_CPE_LTABLE_SIZE + XTENSA_CP_EXTRA_SIZE)
172#define ELF_NFPREG \
173 ((TOTAL_FPREGS_SIZE + sizeof(elf_fpreg_t) - 1) / sizeof(elf_fpreg_t))
174#else
175#define TOTAL_FPREGS_SIZE 0
176#define ELF_NFPREG 0
177#endif
178 95
179typedef unsigned int elf_fpreg_t; 96typedef unsigned int elf_fpreg_t;
180typedef elf_fpreg_t elf_fpregset_t[ELF_NFPREG]; 97typedef elf_fpreg_t elf_fpregset_t[ELF_NFPREG];
181 98
182#define ELF_CORE_COPY_REGS(_eregs, _pregs) \ 99#define ELF_CORE_COPY_REGS(_eregs, _pregs) \
183 xtensa_elf_core_copy_regs (&_eregs, _pregs); 100 xtensa_elf_core_copy_regs ((xtensa_gregset_t*)&(_eregs), _pregs);
184 101
185extern void xtensa_elf_core_copy_regs (xtensa_gregset_t *, struct pt_regs *); 102extern void xtensa_elf_core_copy_regs (xtensa_gregset_t *, struct pt_regs *);
186 103
@@ -257,6 +174,21 @@ extern void xtensa_elf_core_copy_regs (xtensa_gregset_t *, struct pt_regs *);
257 _r->areg[12]=0; _r->areg[13]=0; _r->areg[14]=0; _r->areg[15]=0; \ 174 _r->areg[12]=0; _r->areg[13]=0; _r->areg[14]=0; _r->areg[15]=0; \
258 } while (0) 175 } while (0)
259 176
177typedef struct {
178 xtregs_opt_t opt;
179 xtregs_user_t user;
180#if XTENSA_HAVE_COPROCESSORS
181 xtregs_cp0_t cp0;
182 xtregs_cp1_t cp1;
183 xtregs_cp2_t cp2;
184 xtregs_cp3_t cp3;
185 xtregs_cp4_t cp4;
186 xtregs_cp5_t cp5;
187 xtregs_cp6_t cp6;
188 xtregs_cp7_t cp7;
189#endif
190} elf_xtregs_t;
191
260#define SET_PERSONALITY(ex, ibcs2) set_personality(PER_LINUX_32BIT) 192#define SET_PERSONALITY(ex, ibcs2) set_personality(PER_LINUX_32BIT)
261 193
262struct task_struct; 194struct task_struct;
diff --git a/include/asm-xtensa/module.h b/include/asm-xtensa/module.h
index ffb25bfdf6a1..d9b34bee4d42 100644
--- a/include/asm-xtensa/module.h
+++ b/include/asm-xtensa/module.h
@@ -15,9 +15,11 @@
15 15
16struct mod_arch_specific 16struct mod_arch_specific
17{ 17{
18 /* Module support is not completely implemented. */ 18 /* No special elements, yet. */
19}; 19};
20 20
21#define MODULE_ARCH_VERMAGIC "xtensa-" __stringify(XCHAL_CORE_ID) " "
22
21#define Elf_Shdr Elf32_Shdr 23#define Elf_Shdr Elf32_Shdr
22#define Elf_Sym Elf32_Sym 24#define Elf_Sym Elf32_Sym
23#define Elf_Ehdr Elf32_Ehdr 25#define Elf_Ehdr Elf32_Ehdr
diff --git a/include/asm-xtensa/pgalloc.h b/include/asm-xtensa/pgalloc.h
index 8d1544eb461e..4f4a7987eded 100644
--- a/include/asm-xtensa/pgalloc.h
+++ b/include/asm-xtensa/pgalloc.h
@@ -47,7 +47,7 @@ static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm,
47 return kmem_cache_alloc(pgtable_cache, GFP_KERNEL|__GFP_REPEAT); 47 return kmem_cache_alloc(pgtable_cache, GFP_KERNEL|__GFP_REPEAT);
48} 48}
49 49
50static inline pte_token_t pte_alloc_one(struct mm_struct *mm, 50static inline pgtable_t pte_alloc_one(struct mm_struct *mm,
51 unsigned long addr) 51 unsigned long addr)
52{ 52{
53 struct page *page; 53 struct page *page;
diff --git a/include/asm-xtensa/pgtable.h b/include/asm-xtensa/pgtable.h
index c0fcc1c9660c..c8b024a48b4d 100644
--- a/include/asm-xtensa/pgtable.h
+++ b/include/asm-xtensa/pgtable.h
@@ -66,11 +66,9 @@
66 */ 66 */
67 67
68#define VMALLOC_START 0xC0000000 68#define VMALLOC_START 0xC0000000
69#define VMALLOC_END 0xC6FEFFFF 69#define VMALLOC_END 0xC7FEFFFF
70#define TLBTEMP_BASE_1 0xC6FF0000 70#define TLBTEMP_BASE_1 0xC7FF0000
71#define TLBTEMP_BASE_2 0xC6FF8000 71#define TLBTEMP_BASE_2 0xC7FF8000
72#define MODULE_START 0xC7000000
73#define MODULE_END 0xC7FFFFFF
74 72
75/* 73/*
76 * Xtensa Linux config PTE layout (when present): 74 * Xtensa Linux config PTE layout (when present):
diff --git a/include/asm-xtensa/processor.h b/include/asm-xtensa/processor.h
index 96408f436624..4918a4e96d42 100644
--- a/include/asm-xtensa/processor.h
+++ b/include/asm-xtensa/processor.h
@@ -103,10 +103,6 @@ struct thread_struct {
103 unsigned long dbreaka[XCHAL_NUM_DBREAK]; 103 unsigned long dbreaka[XCHAL_NUM_DBREAK];
104 unsigned long dbreakc[XCHAL_NUM_DBREAK]; 104 unsigned long dbreakc[XCHAL_NUM_DBREAK];
105 105
106 /* Allocate storage for extra state and coprocessor state. */
107 unsigned char cp_save[XTENSA_CP_EXTRA_SIZE]
108 __attribute__ ((aligned(XTENSA_CP_EXTRA_ALIGN)));
109
110 /* Make structure 16 bytes aligned. */ 106 /* Make structure 16 bytes aligned. */
111 int align[0] __attribute__ ((aligned(16))); 107 int align[0] __attribute__ ((aligned(16)));
112}; 108};
@@ -162,21 +158,16 @@ struct thread_struct {
162struct task_struct; 158struct task_struct;
163struct mm_struct; 159struct mm_struct;
164 160
165// FIXME: do we need release_thread for CP??
166/* Free all resources held by a thread. */ 161/* Free all resources held by a thread. */
167#define release_thread(thread) do { } while(0) 162#define release_thread(thread) do { } while(0)
168 163
169// FIXME: do we need prepare_to_copy (lazy status) for CP??
170/* Prepare to copy thread state - unlazy all lazy status */ 164/* Prepare to copy thread state - unlazy all lazy status */
171#define prepare_to_copy(tsk) do { } while (0) 165extern void prepare_to_copy(struct task_struct*);
172 166
173/* 167/* Create a kernel thread without removing it from tasklists */
174 * create a kernel thread without removing it from tasklists
175 */
176extern int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags); 168extern int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags);
177 169
178/* Copy and release all segment info associated with a VM */ 170/* Copy and release all segment info associated with a VM */
179
180#define copy_segments(p, mm) do { } while(0) 171#define copy_segments(p, mm) do { } while(0)
181#define release_segments(mm) do { } while(0) 172#define release_segments(mm) do { } while(0)
182#define forget_segments() do { } while (0) 173#define forget_segments() do { } while (0)
diff --git a/include/asm-xtensa/ptrace.h b/include/asm-xtensa/ptrace.h
index 77ff02d307bb..422c73e26937 100644
--- a/include/asm-xtensa/ptrace.h
+++ b/include/asm-xtensa/ptrace.h
@@ -53,33 +53,30 @@
53 53
54/* Registers used by strace */ 54/* Registers used by strace */
55 55
56#define REG_A_BASE 0xfc000000 56#define REG_A_BASE 0x0000
57#define REG_AR_BASE 0x04000000 57#define REG_AR_BASE 0x0100
58#define REG_PC 0x14000000 58#define REG_PC 0x0020
59#define REG_PS 0x080000e6 59#define REG_PS 0x02e6
60#define REG_WB 0x08000048 60#define REG_WB 0x0248
61#define REG_WS 0x08000049 61#define REG_WS 0x0249
62#define REG_LBEG 0x08000000 62#define REG_LBEG 0x0200
63#define REG_LEND 0x08000001 63#define REG_LEND 0x0201
64#define REG_LCOUNT 0x08000002 64#define REG_LCOUNT 0x0202
65#define REG_SAR 0x08000003 65#define REG_SAR 0x0203
66#define REG_DEPC 0x080000c0 66
67#define REG_EXCCAUSE 0x080000e8 67#define SYSCALL_NR 0x00ff
68#define REG_EXCVADDR 0x080000ee
69#define SYSCALL_NR 0x1
70
71#define AR_REGNO_TO_A_REGNO(ar, wb) (ar - wb*4) & ~(XCHAL_NUM_AREGS - 1)
72 68
73/* Other PTRACE_ values defined in <linux/ptrace.h> using values 0-9,16,17,24 */ 69/* Other PTRACE_ values defined in <linux/ptrace.h> using values 0-9,16,17,24 */
74 70
75#define PTRACE_GETREGS 12 71#define PTRACE_GETREGS 12
76#define PTRACE_SETREGS 13 72#define PTRACE_SETREGS 13
77#define PTRACE_GETFPREGS 14 73#define PTRACE_GETXTREGS 18
78#define PTRACE_SETFPREGS 15 74#define PTRACE_SETXTREGS 19
79#define PTRACE_GETFPREGSIZE 18
80 75
81#ifndef __ASSEMBLY__ 76#ifndef __ASSEMBLY__
82 77
78#ifdef __KERNEL__
79
83/* 80/*
84 * This struct defines the way the registers are stored on the 81 * This struct defines the way the registers are stored on the
85 * kernel stack during a system call or other kernel entry. 82 * kernel stack during a system call or other kernel entry.
@@ -102,6 +99,9 @@ struct pt_regs {
102 unsigned long icountlevel; /* 60 */ 99 unsigned long icountlevel; /* 60 */
103 int reserved[1]; /* 64 */ 100 int reserved[1]; /* 64 */
104 101
102 /* Additional configurable registers that are used by the compiler. */
103 xtregs_opt_t xtregs_opt;
104
105 /* Make sure the areg field is 16 bytes aligned. */ 105 /* Make sure the areg field is 16 bytes aligned. */
106 int align[0] __attribute__ ((aligned(16))); 106 int align[0] __attribute__ ((aligned(16)));
107 107
@@ -111,8 +111,6 @@ struct pt_regs {
111 unsigned long areg[16]; /* 128 (64) */ 111 unsigned long areg[16]; /* 128 (64) */
112}; 112};
113 113
114#ifdef __KERNEL__
115
116#include <asm/variant/core.h> 114#include <asm/variant/core.h>
117 115
118# define task_pt_regs(tsk) ((struct pt_regs*) \ 116# define task_pt_regs(tsk) ((struct pt_regs*) \
diff --git a/include/asm-xtensa/regs.h b/include/asm-xtensa/regs.h
index c913d259faaa..d4baed246928 100644
--- a/include/asm-xtensa/regs.h
+++ b/include/asm-xtensa/regs.h
@@ -100,7 +100,14 @@
100#define EXCCAUSE_DTLB_SIZE_RESTRICTION 27 100#define EXCCAUSE_DTLB_SIZE_RESTRICTION 27
101#define EXCCAUSE_LOAD_CACHE_ATTRIBUTE 28 101#define EXCCAUSE_LOAD_CACHE_ATTRIBUTE 28
102#define EXCCAUSE_STORE_CACHE_ATTRIBUTE 29 102#define EXCCAUSE_STORE_CACHE_ATTRIBUTE 29
103#define EXCCAUSE_FLOATING_POINT 40 103#define EXCCAUSE_COPROCESSOR0_DISABLED 32
104#define EXCCAUSE_COPROCESSOR1_DISABLED 33
105#define EXCCAUSE_COPROCESSOR2_DISABLED 34
106#define EXCCAUSE_COPROCESSOR3_DISABLED 35
107#define EXCCAUSE_COPROCESSOR4_DISABLED 36
108#define EXCCAUSE_COPROCESSOR5_DISABLED 37
109#define EXCCAUSE_COPROCESSOR6_DISABLED 38
110#define EXCCAUSE_COPROCESSOR7_DISABLED 39
104 111
105/* PS register fields. */ 112/* PS register fields. */
106 113
diff --git a/include/asm-xtensa/sigcontext.h b/include/asm-xtensa/sigcontext.h
index e3381cee5059..03383af8c3b7 100644
--- a/include/asm-xtensa/sigcontext.h
+++ b/include/asm-xtensa/sigcontext.h
@@ -13,9 +13,6 @@
13 13
14 14
15struct sigcontext { 15struct sigcontext {
16 unsigned long oldmask;
17
18 /* CPU registers */
19 unsigned long sc_pc; 16 unsigned long sc_pc;
20 unsigned long sc_ps; 17 unsigned long sc_ps;
21 unsigned long sc_lbeg; 18 unsigned long sc_lbeg;
@@ -25,6 +22,7 @@ struct sigcontext {
25 unsigned long sc_acclo; 22 unsigned long sc_acclo;
26 unsigned long sc_acchi; 23 unsigned long sc_acchi;
27 unsigned long sc_a[16]; 24 unsigned long sc_a[16];
25 void *sc_xtregs;
28}; 26};
29 27
30#endif /* _XTENSA_SIGCONTEXT_H */ 28#endif /* _XTENSA_SIGCONTEXT_H */
diff --git a/include/asm-xtensa/stat.h b/include/asm-xtensa/stat.h
index 149f4bce092f..c4992038cee0 100644
--- a/include/asm-xtensa/stat.h
+++ b/include/asm-xtensa/stat.h
@@ -5,25 +5,23 @@
5 * License. See the file "COPYING" in the main directory of this archive 5 * License. See the file "COPYING" in the main directory of this archive
6 * for more details. 6 * for more details.
7 * 7 *
8 * Copyright (C) 2001 - 2005 Tensilica Inc. 8 * Copyright (C) 2001 - 2007 Tensilica Inc.
9 */ 9 */
10 10
11#ifndef _XTENSA_STAT_H 11#ifndef _XTENSA_STAT_H
12#define _XTENSA_STAT_H 12#define _XTENSA_STAT_H
13 13
14#include <linux/types.h>
15
16#define STAT_HAVE_NSEC 1 14#define STAT_HAVE_NSEC 1
17 15
18struct stat { 16struct stat {
19 unsigned long st_dev; 17 unsigned long st_dev;
20 ino_t st_ino; 18 unsigned long st_ino;
21 mode_t st_mode; 19 unsigned int st_mode;
22 nlink_t st_nlink; 20 unsigned int st_nlink;
23 uid_t st_uid; 21 unsigned int st_uid;
24 gid_t st_gid; 22 unsigned int st_gid;
25 unsigned int st_rdev; 23 unsigned long st_rdev;
26 off_t st_size; 24 long st_size;
27 unsigned long st_blksize; 25 unsigned long st_blksize;
28 unsigned long st_blocks; 26 unsigned long st_blocks;
29 unsigned long st_atime; 27 unsigned long st_atime;
@@ -36,8 +34,6 @@ struct stat {
36 unsigned long __unused5; 34 unsigned long __unused5;
37}; 35};
38 36
39/* This matches struct stat64 in glibc-2.3 */
40
41struct stat64 { 37struct stat64 {
42 unsigned long long st_dev; /* Device */ 38 unsigned long long st_dev; /* Device */
43 unsigned long long st_ino; /* File serial number */ 39 unsigned long long st_ino; /* File serial number */
@@ -47,20 +43,14 @@ struct stat64 {
47 unsigned int st_gid; /* Group ID of the file's group. */ 43 unsigned int st_gid; /* Group ID of the file's group. */
48 unsigned long long st_rdev; /* Device number, if device. */ 44 unsigned long long st_rdev; /* Device number, if device. */
49 long long st_size; /* Size of file, in bytes. */ 45 long long st_size; /* Size of file, in bytes. */
50 long st_blksize; /* Optimal block size for I/O. */ 46 unsigned long st_blksize; /* Optimal block size for I/O. */
51 unsigned long __unused2; 47 unsigned long __unused2;
52#ifdef __XTENSA_EB__ 48 unsigned long long st_blocks; /* Number 512-byte blocks allocated. */
53 unsigned long __unused3; 49 unsigned long st_atime; /* Time of last access. */
54 long st_blocks; /* Number 512-byte blocks allocated. */
55#else
56 long st_blocks; /* Number 512-byte blocks allocated. */
57 unsigned long __unused3;
58#endif
59 long st_atime; /* Time of last access. */
60 unsigned long st_atime_nsec; 50 unsigned long st_atime_nsec;
61 long st_mtime; /* Time of last modification. */ 51 unsigned long st_mtime; /* Time of last modification. */
62 unsigned long st_mtime_nsec; 52 unsigned long st_mtime_nsec;
63 long st_ctime; /* Time of last status change. */ 53 unsigned long st_ctime; /* Time of last status change. */
64 unsigned long st_ctime_nsec; 54 unsigned long st_ctime_nsec;
65 unsigned long __unused4; 55 unsigned long __unused4;
66 unsigned long __unused5; 56 unsigned long __unused5;
diff --git a/include/asm-xtensa/system.h b/include/asm-xtensa/system.h
index e0cb9116d8ab..62b1e8f3c13c 100644
--- a/include/asm-xtensa/system.h
+++ b/include/asm-xtensa/system.h
@@ -46,42 +46,6 @@ static inline int irqs_disabled(void)
46 return flags & 0xf; 46 return flags & 0xf;
47} 47}
48 48
49#define RSR_CPENABLE(x) do { \
50 __asm__ __volatile__("rsr %0," __stringify(CPENABLE) : "=a" (x)); \
51 } while(0);
52#define WSR_CPENABLE(x) do { \
53 __asm__ __volatile__("wsr %0," __stringify(CPENABLE)";rsync" \
54 :: "a" (x));} while(0);
55
56#define clear_cpenable() __clear_cpenable()
57
58static inline void __clear_cpenable(void)
59{
60#if XCHAL_HAVE_CP
61 unsigned long i = 0;
62 WSR_CPENABLE(i);
63#endif
64}
65
66static inline void enable_coprocessor(int i)
67{
68#if XCHAL_HAVE_CP
69 int cp;
70 RSR_CPENABLE(cp);
71 cp |= 1 << i;
72 WSR_CPENABLE(cp);
73#endif
74}
75
76static inline void disable_coprocessor(int i)
77{
78#if XCHAL_HAVE_CP
79 int cp;
80 RSR_CPENABLE(cp);
81 cp &= ~(1 << i);
82 WSR_CPENABLE(cp);
83#endif
84}
85 49
86#define smp_read_barrier_depends() do { } while(0) 50#define smp_read_barrier_depends() do { } while(0)
87#define read_barrier_depends() do { } while(0) 51#define read_barrier_depends() do { } while(0)
@@ -111,7 +75,6 @@ extern void *_switch_to(void *last, void *next);
111 75
112#define switch_to(prev,next,last) \ 76#define switch_to(prev,next,last) \
113do { \ 77do { \
114 clear_cpenable(); \
115 (last) = _switch_to(prev, next); \ 78 (last) = _switch_to(prev, next); \
116} while(0) 79} while(0)
117 80
@@ -244,7 +207,7 @@ static inline void spill_registers(void)
244 "wsr a13," __stringify(SAR) "\n\t" 207 "wsr a13," __stringify(SAR) "\n\t"
245 "wsr a14," __stringify(PS) "\n\t" 208 "wsr a14," __stringify(PS) "\n\t"
246 :: "a" (&a0), "a" (&ps) 209 :: "a" (&a0), "a" (&ps)
247 : "a2", "a3", "a12", "a13", "a14", "a15", "memory"); 210 : "a2", "a3", "a4", "a7", "a11", "a12", "a13", "a14", "a15", "memory");
248} 211}
249 212
250#define arch_align_stack(x) (x) 213#define arch_align_stack(x) (x)
diff --git a/include/asm-xtensa/thread_info.h b/include/asm-xtensa/thread_info.h
index 52c958285bcb..a2c640682ed9 100644
--- a/include/asm-xtensa/thread_info.h
+++ b/include/asm-xtensa/thread_info.h
@@ -27,6 +27,21 @@
27 27
28#ifndef __ASSEMBLY__ 28#ifndef __ASSEMBLY__
29 29
30#if XTENSA_HAVE_COPROCESSORS
31
32typedef struct xtregs_coprocessor {
33 xtregs_cp0_t cp0;
34 xtregs_cp1_t cp1;
35 xtregs_cp2_t cp2;
36 xtregs_cp3_t cp3;
37 xtregs_cp4_t cp4;
38 xtregs_cp5_t cp5;
39 xtregs_cp6_t cp6;
40 xtregs_cp7_t cp7;
41} xtregs_coprocessor_t;
42
43#endif
44
30struct thread_info { 45struct thread_info {
31 struct task_struct *task; /* main task structure */ 46 struct task_struct *task; /* main task structure */
32 struct exec_domain *exec_domain; /* execution domain */ 47 struct exec_domain *exec_domain; /* execution domain */
@@ -38,7 +53,13 @@ struct thread_info {
38 mm_segment_t addr_limit; /* thread address space */ 53 mm_segment_t addr_limit; /* thread address space */
39 struct restart_block restart_block; 54 struct restart_block restart_block;
40 55
56 unsigned long cpenable;
41 57
58 /* Allocate storage for extra user states and coprocessor states. */
59#if XTENSA_HAVE_COPROCESSORS
60 xtregs_coprocessor_t xtregs_cp;
61#endif
62 xtregs_user_t xtregs_user;
42}; 63};
43 64
44#else /* !__ASSEMBLY__ */ 65#else /* !__ASSEMBLY__ */
diff --git a/include/asm-xtensa/timex.h b/include/asm-xtensa/timex.h
index a5fca59fba9e..b83a8181d448 100644
--- a/include/asm-xtensa/timex.h
+++ b/include/asm-xtensa/timex.h
@@ -63,10 +63,10 @@ extern cycles_t cacheflush_time;
63 * Register access. 63 * Register access.
64 */ 64 */
65 65
66#define WSR_CCOUNT(r) __asm__("wsr %0,"__stringify(CCOUNT) :: "a" (r)) 66#define WSR_CCOUNT(r) asm volatile ("wsr %0,"__stringify(CCOUNT) :: "a" (r))
67#define RSR_CCOUNT(r) __asm__("rsr %0,"__stringify(CCOUNT) : "=a" (r)) 67#define RSR_CCOUNT(r) asm volatile ("rsr %0,"__stringify(CCOUNT) : "=a" (r))
68#define WSR_CCOMPARE(x,r) __asm__("wsr %0,"__stringify(CCOMPARE)"+"__stringify(x) :: "a"(r)) 68#define WSR_CCOMPARE(x,r) asm volatile ("wsr %0,"__stringify(CCOMPARE)"+"__stringify(x) :: "a"(r))
69#define RSR_CCOMPARE(x,r) __asm__("rsr %0,"__stringify(CCOMPARE)"+"__stringify(x) : "=a"(r)) 69#define RSR_CCOMPARE(x,r) asm volatile ("rsr %0,"__stringify(CCOMPARE)"+"__stringify(x) : "=a"(r))
70 70
71static inline unsigned long get_ccount (void) 71static inline unsigned long get_ccount (void)
72{ 72{
diff --git a/include/asm-xtensa/uaccess.h b/include/asm-xtensa/uaccess.h
index d6352da05b10..b8528426ab1f 100644
--- a/include/asm-xtensa/uaccess.h
+++ b/include/asm-xtensa/uaccess.h
@@ -26,6 +26,7 @@
26#include <asm/current.h> 26#include <asm/current.h>
27#include <asm/asm-offsets.h> 27#include <asm/asm-offsets.h>
28#include <asm/processor.h> 28#include <asm/processor.h>
29#include <asm/types.h>
29 30
30/* 31/*
31 * These assembly macros mirror the C macros that follow below. They 32 * These assembly macros mirror the C macros that follow below. They
@@ -118,7 +119,7 @@
118 * <at> destroyed (actually, (TASK_SIZE + 1 - size)) 119 * <at> destroyed (actually, (TASK_SIZE + 1 - size))
119 */ 120 */
120 .macro user_ok aa, as, at, error 121 .macro user_ok aa, as, at, error
121 movi \at, (TASK_SIZE+1) 122 movi \at, __XTENSA_UL_CONST(TASK_SIZE)
122 bgeu \as, \at, \error 123 bgeu \as, \at, \error
123 sub \at, \at, \as 124 sub \at, \at, \as
124 bgeu \aa, \at, \error 125 bgeu \aa, \at, \error
@@ -226,20 +227,21 @@ extern long __put_user_bad(void);
226 __pu_err; \ 227 __pu_err; \
227}) 228})
228 229
229#define __put_user_size(x,ptr,size,retval) \ 230#define __put_user_size(x,ptr,size,retval) \
230do { \ 231do { \
231 retval = 0; \ 232 int __cb; \
232 switch (size) { \ 233 retval = 0; \
233 case 1: __put_user_asm(x,ptr,retval,1,"s8i"); break; \ 234 switch (size) { \
234 case 2: __put_user_asm(x,ptr,retval,2,"s16i"); break; \ 235 case 1: __put_user_asm(x,ptr,retval,1,"s8i",__cb); break; \
235 case 4: __put_user_asm(x,ptr,retval,4,"s32i"); break; \ 236 case 2: __put_user_asm(x,ptr,retval,2,"s16i",__cb); break; \
236 case 8: { \ 237 case 4: __put_user_asm(x,ptr,retval,4,"s32i",__cb); break; \
237 __typeof__(*ptr) __v64 = x; \ 238 case 8: { \
238 retval = __copy_to_user(ptr,&__v64,8); \ 239 __typeof__(*ptr) __v64 = x; \
239 break; \ 240 retval = __copy_to_user(ptr,&__v64,8); \
240 } \ 241 break; \
241 default: __put_user_bad(); \ 242 } \
242 } \ 243 default: __put_user_bad(); \
244 } \
243} while (0) 245} while (0)
244 246
245 247
@@ -267,14 +269,14 @@ do { \
267#define __check_align_1 "" 269#define __check_align_1 ""
268 270
269#define __check_align_2 \ 271#define __check_align_2 \
270 " _bbci.l %2, 0, 1f \n" \ 272 " _bbci.l %3, 0, 1f \n" \
271 " movi %0, %3 \n" \ 273 " movi %0, %4 \n" \
272 " _j 2f \n" 274 " _j 2f \n"
273 275
274#define __check_align_4 \ 276#define __check_align_4 \
275 " _bbsi.l %2, 0, 0f \n" \ 277 " _bbsi.l %3, 0, 0f \n" \
276 " _bbci.l %2, 1, 1f \n" \ 278 " _bbci.l %3, 1, 1f \n" \
277 "0: movi %0, %3 \n" \ 279 "0: movi %0, %4 \n" \
278 " _j 2f \n" 280 " _j 2f \n"
279 281
280 282
@@ -286,24 +288,24 @@ do { \
286 * WARNING: If you modify this macro at all, verify that the 288 * WARNING: If you modify this macro at all, verify that the
287 * __check_align_* macros still work. 289 * __check_align_* macros still work.
288 */ 290 */
289#define __put_user_asm(x, addr, err, align, insn) \ 291#define __put_user_asm(x, addr, err, align, insn, cb) \
290 __asm__ __volatile__( \ 292 __asm__ __volatile__( \
291 __check_align_##align \ 293 __check_align_##align \
292 "1: "insn" %1, %2, 0 \n" \ 294 "1: "insn" %2, %3, 0 \n" \
293 "2: \n" \ 295 "2: \n" \
294 " .section .fixup,\"ax\" \n" \ 296 " .section .fixup,\"ax\" \n" \
295 " .align 4 \n" \ 297 " .align 4 \n" \
296 "4: \n" \ 298 "4: \n" \
297 " .long 2b \n" \ 299 " .long 2b \n" \
298 "5: \n" \ 300 "5: \n" \
299 " l32r %2, 4b \n" \ 301 " l32r %1, 4b \n" \
300 " movi %0, %3 \n" \ 302 " movi %0, %4 \n" \
301 " jx %2 \n" \ 303 " jx %1 \n" \
302 " .previous \n" \ 304 " .previous \n" \
303 " .section __ex_table,\"a\" \n" \ 305 " .section __ex_table,\"a\" \n" \
304 " .long 1b, 5b \n" \ 306 " .long 1b, 5b \n" \
305 " .previous" \ 307 " .previous" \
306 :"=r" (err) \ 308 :"=r" (err), "=r" (cb) \
307 :"r" ((int)(x)), "r" (addr), "i" (-EFAULT), "0" (err)) 309 :"r" ((int)(x)), "r" (addr), "i" (-EFAULT), "0" (err))
308 310
309#define __get_user_nocheck(x,ptr,size) \ 311#define __get_user_nocheck(x,ptr,size) \
@@ -328,11 +330,12 @@ extern long __get_user_bad(void);
328 330
329#define __get_user_size(x,ptr,size,retval) \ 331#define __get_user_size(x,ptr,size,retval) \
330do { \ 332do { \
333 int __cb; \
331 retval = 0; \ 334 retval = 0; \
332 switch (size) { \ 335 switch (size) { \
333 case 1: __get_user_asm(x,ptr,retval,1,"l8ui"); break; \ 336 case 1: __get_user_asm(x,ptr,retval,1,"l8ui",__cb); break; \
334 case 2: __get_user_asm(x,ptr,retval,2,"l16ui"); break; \ 337 case 2: __get_user_asm(x,ptr,retval,2,"l16ui",__cb); break; \
335 case 4: __get_user_asm(x,ptr,retval,4,"l32i"); break; \ 338 case 4: __get_user_asm(x,ptr,retval,4,"l32i",__cb); break; \
336 case 8: retval = __copy_from_user(&x,ptr,8); break; \ 339 case 8: retval = __copy_from_user(&x,ptr,8); break; \
337 default: (x) = __get_user_bad(); \ 340 default: (x) = __get_user_bad(); \
338 } \ 341 } \
@@ -343,25 +346,25 @@ do { \
343 * WARNING: If you modify this macro at all, verify that the 346 * WARNING: If you modify this macro at all, verify that the
344 * __check_align_* macros still work. 347 * __check_align_* macros still work.
345 */ 348 */
346#define __get_user_asm(x, addr, err, align, insn) \ 349#define __get_user_asm(x, addr, err, align, insn, cb) \
347 __asm__ __volatile__( \ 350 __asm__ __volatile__( \
348 __check_align_##align \ 351 __check_align_##align \
349 "1: "insn" %1, %2, 0 \n" \ 352 "1: "insn" %2, %3, 0 \n" \
350 "2: \n" \ 353 "2: \n" \
351 " .section .fixup,\"ax\" \n" \ 354 " .section .fixup,\"ax\" \n" \
352 " .align 4 \n" \ 355 " .align 4 \n" \
353 "4: \n" \ 356 "4: \n" \
354 " .long 2b \n" \ 357 " .long 2b \n" \
355 "5: \n" \ 358 "5: \n" \
356 " l32r %2, 4b \n" \ 359 " l32r %1, 4b \n" \
357 " movi %1, 0 \n" \ 360 " movi %2, 0 \n" \
358 " movi %0, %3 \n" \ 361 " movi %0, %4 \n" \
359 " jx %2 \n" \ 362 " jx %1 \n" \
360 " .previous \n" \ 363 " .previous \n" \
361 " .section __ex_table,\"a\" \n" \ 364 " .section __ex_table,\"a\" \n" \
362 " .long 1b, 5b \n" \ 365 " .long 1b, 5b \n" \
363 " .previous" \ 366 " .previous" \
364 :"=r" (err), "=r" (x) \ 367 :"=r" (err), "=r" (cb), "=r" (x) \
365 :"r" (addr), "i" (-EFAULT), "0" (err)) 368 :"r" (addr), "i" (-EFAULT), "0" (err))
366 369
367 370
diff --git a/include/asm-xtensa/variant-fsf/tie-asm.h b/include/asm-xtensa/variant-fsf/tie-asm.h
new file mode 100644
index 000000000000..68a73bf4ffc5
--- /dev/null
+++ b/include/asm-xtensa/variant-fsf/tie-asm.h
@@ -0,0 +1,70 @@
1/*
2 * This header file contains assembly-language definitions (assembly
3 * macros, etc.) for this specific Xtensa processor's TIE extensions
4 * and options. It is customized to this Xtensa processor configuration.
5 *
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file "COPYING" in the main directory of this archive
8 * for more details.
9 *
10 * Copyright (C) 1999-2008 Tensilica Inc.
11 */
12
13#ifndef _XTENSA_CORE_TIE_ASM_H
14#define _XTENSA_CORE_TIE_ASM_H
15
16/* Selection parameter values for save-area save/restore macros: */
17/* Option vs. TIE: */
18#define XTHAL_SAS_TIE 0x0001 /* custom extension or coprocessor */
19#define XTHAL_SAS_OPT 0x0002 /* optional (and not a coprocessor) */
20/* Whether used automatically by compiler: */
21#define XTHAL_SAS_NOCC 0x0004 /* not used by compiler w/o special opts/code */
22#define XTHAL_SAS_CC 0x0008 /* used by compiler without special opts/code */
23/* ABI handling across function calls: */
24#define XTHAL_SAS_CALR 0x0010 /* caller-saved */
25#define XTHAL_SAS_CALE 0x0020 /* callee-saved */
26#define XTHAL_SAS_GLOB 0x0040 /* global across function calls (in thread) */
27/* Misc */
28#define XTHAL_SAS_ALL 0xFFFF /* include all default NCP contents */
29
30
31
32/* Macro to save all non-coprocessor (extra) custom TIE and optional state
33 * (not including zero-overhead loop registers).
34 * Save area ptr (clobbered): ptr (1 byte aligned)
35 * Scratch regs (clobbered): at1..at4 (only first XCHAL_NCP_NUM_ATMPS needed)
36 */
37 .macro xchal_ncp_store ptr at1 at2 at3 at4 continue=0 ofs=-1 select=XTHAL_SAS_ALL
38 xchal_sa_start \continue, \ofs
39 .ifeq (XTHAL_SAS_OPT | XTHAL_SAS_CC | XTHAL_SAS_GLOB) & ~\select
40 xchal_sa_align \ptr, 0, 1024-4, 4, 4
41 rur \at1, THREADPTR // threadptr option
42 s32i \at1, \ptr, .Lxchal_ofs_ + 0
43 .set .Lxchal_ofs_, .Lxchal_ofs_ + 4
44 .endif
45 .endm // xchal_ncp_store
46
47/* Macro to save all non-coprocessor (extra) custom TIE and optional state
48 * (not including zero-overhead loop registers).
49 * Save area ptr (clobbered): ptr (1 byte aligned)
50 * Scratch regs (clobbered): at1..at4 (only first XCHAL_NCP_NUM_ATMPS needed)
51 */
52 .macro xchal_ncp_load ptr at1 at2 at3 at4 continue=0 ofs=-1 select=XTHAL_SAS_ALL
53 xchal_sa_start \continue, \ofs
54 .ifeq (XTHAL_SAS_OPT | XTHAL_SAS_CC | XTHAL_SAS_GLOB) & ~\select
55 xchal_sa_align \ptr, 0, 1024-4, 4, 4
56 l32i \at1, \ptr, .Lxchal_ofs_ + 0
57 wur \at1, THREADPTR // threadptr option
58 .set .Lxchal_ofs_, .Lxchal_ofs_ + 4
59 .endif
60 .endm // xchal_ncp_load
61
62
63
64#define XCHAL_NCP_NUM_ATMPS 1
65
66
67#define XCHAL_SA_NUM_ATMPS 1
68
69#endif /*_XTENSA_CORE_TIE_ASM_H*/
70
diff --git a/include/asm-xtensa/variant-fsf/tie.h b/include/asm-xtensa/variant-fsf/tie.h
index a73c71664918..bf4020116df5 100644
--- a/include/asm-xtensa/variant-fsf/tie.h
+++ b/include/asm-xtensa/variant-fsf/tie.h
@@ -1,22 +1,77 @@
1/* 1/*
2 * Xtensa processor core configuration information. 2 * This header file describes this specific Xtensa processor's TIE extensions
3 * that extend basic Xtensa core functionality. It is customized to this
4 * Xtensa processor configuration.
3 * 5 *
4 * This file is subject to the terms and conditions of the GNU General Public 6 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file "COPYING" in the main directory of this archive 7 * License. See the file "COPYING" in the main directory of this archive
6 * for more details. 8 * for more details.
7 * 9 *
8 * Copyright (C) 1999-2006 Tensilica Inc. 10 * Copyright (C) 1999-2007 Tensilica Inc.
9 */ 11 */
10 12
11#ifndef XTENSA_TIE_H 13#ifndef _XTENSA_CORE_TIE_H
12#define XTENSA_TIE_H 14#define _XTENSA_CORE_TIE_H
13
14/*----------------------------------------------------------------------
15 COPROCESSORS and EXTRA STATE
16 ----------------------------------------------------------------------*/
17 15
18#define XCHAL_CP_NUM 0 /* number of coprocessors */ 16#define XCHAL_CP_NUM 0 /* number of coprocessors */
19#define XCHAL_CP_MASK 0x00 17#define XCHAL_CP_MAX 0 /* max CP ID + 1 (0 if none) */
18#define XCHAL_CP_MASK 0x00 /* bitmask of all CPs by ID */
19#define XCHAL_CP_PORT_MASK 0x00 /* bitmask of only port CPs */
20
21/* Basic parameters of each coprocessor: */
22#define XCHAL_CP7_NAME "XTIOP"
23#define XCHAL_CP7_IDENT XTIOP
24#define XCHAL_CP7_SA_SIZE 0 /* size of state save area */
25#define XCHAL_CP7_SA_ALIGN 1 /* min alignment of save area */
26#define XCHAL_CP_ID_XTIOP 7 /* coprocessor ID (0..7) */
27
28/* Filler info for unassigned coprocessors, to simplify arrays etc: */
29#define XCHAL_NCP_SA_SIZE 0
30#define XCHAL_NCP_SA_ALIGN 1
31#define XCHAL_CP0_SA_SIZE 0
32#define XCHAL_CP0_SA_ALIGN 1
33#define XCHAL_CP1_SA_SIZE 0
34#define XCHAL_CP1_SA_ALIGN 1
35#define XCHAL_CP2_SA_SIZE 0
36#define XCHAL_CP2_SA_ALIGN 1
37#define XCHAL_CP3_SA_SIZE 0
38#define XCHAL_CP3_SA_ALIGN 1
39#define XCHAL_CP4_SA_SIZE 0
40#define XCHAL_CP4_SA_ALIGN 1
41#define XCHAL_CP5_SA_SIZE 0
42#define XCHAL_CP5_SA_ALIGN 1
43#define XCHAL_CP6_SA_SIZE 0
44#define XCHAL_CP6_SA_ALIGN 1
45
46/* Save area for non-coprocessor optional and custom (TIE) state: */
47#define XCHAL_NCP_SA_SIZE 0
48#define XCHAL_NCP_SA_ALIGN 1
49
50/* Total save area for optional and custom state (NCP + CPn): */
51#define XCHAL_TOTAL_SA_SIZE 0 /* with 16-byte align padding */
52#define XCHAL_TOTAL_SA_ALIGN 1 /* actual minimum alignment */
53
54#define XCHAL_NCP_SA_NUM 0
55#define XCHAL_NCP_SA_LIST(s)
56#define XCHAL_CP0_SA_NUM 0
57#define XCHAL_CP0_SA_LIST(s)
58#define XCHAL_CP1_SA_NUM 0
59#define XCHAL_CP1_SA_LIST(s)
60#define XCHAL_CP2_SA_NUM 0
61#define XCHAL_CP2_SA_LIST(s)
62#define XCHAL_CP3_SA_NUM 0
63#define XCHAL_CP3_SA_LIST(s)
64#define XCHAL_CP4_SA_NUM 0
65#define XCHAL_CP4_SA_LIST(s)
66#define XCHAL_CP5_SA_NUM 0
67#define XCHAL_CP5_SA_LIST(s)
68#define XCHAL_CP6_SA_NUM 0
69#define XCHAL_CP6_SA_LIST(s)
70#define XCHAL_CP7_SA_NUM 0
71#define XCHAL_CP7_SA_LIST(s)
72
73/* Byte length of instruction from its first nibble (op0 field), per FLIX. */
74#define XCHAL_OP0_FORMAT_LENGTHS 3,3,3,3,3,3,3,3,2,2,2,2,2,2,3,3
20 75
21#endif /*XTENSA_CONFIG_TIE_H*/ 76#endif /*_XTENSA_CORE_TIE_H*/
22 77
diff --git a/include/linux/aio.h b/include/linux/aio.h
index a9931e2e5624..0d0b7f629bd3 100644
--- a/include/linux/aio.h
+++ b/include/linux/aio.h
@@ -105,7 +105,6 @@ struct kiocb {
105 wait_queue_t ki_wait; 105 wait_queue_t ki_wait;
106 loff_t ki_pos; 106 loff_t ki_pos;
107 107
108 atomic_t ki_bio_count; /* num bio used for this iocb */
109 void *private; 108 void *private;
110 /* State that we remember to be able to restart/retry */ 109 /* State that we remember to be able to restart/retry */
111 unsigned short ki_opcode; 110 unsigned short ki_opcode;
diff --git a/include/linux/bio.h b/include/linux/bio.h
index 4da441337d6e..4c59bdccd3ee 100644
--- a/include/linux/bio.h
+++ b/include/linux/bio.h
@@ -326,7 +326,6 @@ extern struct bio *bio_map_kern(struct request_queue *, void *, unsigned int,
326 gfp_t); 326 gfp_t);
327extern void bio_set_pages_dirty(struct bio *bio); 327extern void bio_set_pages_dirty(struct bio *bio);
328extern void bio_check_pages_dirty(struct bio *bio); 328extern void bio_check_pages_dirty(struct bio *bio);
329extern void bio_release_pages(struct bio *bio);
330extern struct bio *bio_copy_user(struct request_queue *, unsigned long, unsigned int, int); 329extern struct bio *bio_copy_user(struct request_queue *, unsigned long, unsigned int, int);
331extern int bio_uncopy_user(struct bio *); 330extern int bio_uncopy_user(struct bio *);
332void zero_fill_bio(struct bio *bio); 331void zero_fill_bio(struct bio *bio);
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index e1888cc5b8ae..6fe67d1939c2 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -216,6 +216,7 @@ struct request {
216 unsigned int cmd_len; 216 unsigned int cmd_len;
217 unsigned char cmd[BLK_MAX_CDB]; 217 unsigned char cmd[BLK_MAX_CDB];
218 218
219 unsigned int raw_data_len;
219 unsigned int data_len; 220 unsigned int data_len;
220 unsigned int sense_len; 221 unsigned int sense_len;
221 void *data; 222 void *data;
@@ -258,6 +259,7 @@ struct bio_vec;
258typedef int (merge_bvec_fn) (struct request_queue *, struct bio *, struct bio_vec *); 259typedef int (merge_bvec_fn) (struct request_queue *, struct bio *, struct bio_vec *);
259typedef void (prepare_flush_fn) (struct request_queue *, struct request *); 260typedef void (prepare_flush_fn) (struct request_queue *, struct request *);
260typedef void (softirq_done_fn)(struct request *); 261typedef void (softirq_done_fn)(struct request *);
262typedef int (dma_drain_needed_fn)(struct request *);
261 263
262enum blk_queue_state { 264enum blk_queue_state {
263 Queue_down, 265 Queue_down,
@@ -294,6 +296,7 @@ struct request_queue
294 merge_bvec_fn *merge_bvec_fn; 296 merge_bvec_fn *merge_bvec_fn;
295 prepare_flush_fn *prepare_flush_fn; 297 prepare_flush_fn *prepare_flush_fn;
296 softirq_done_fn *softirq_done_fn; 298 softirq_done_fn *softirq_done_fn;
299 dma_drain_needed_fn *dma_drain_needed;
297 300
298 /* 301 /*
299 * Dispatch queue sorting 302 * Dispatch queue sorting
@@ -698,8 +701,9 @@ extern void blk_queue_max_hw_segments(struct request_queue *, unsigned short);
698extern void blk_queue_max_segment_size(struct request_queue *, unsigned int); 701extern void blk_queue_max_segment_size(struct request_queue *, unsigned int);
699extern void blk_queue_hardsect_size(struct request_queue *, unsigned short); 702extern void blk_queue_hardsect_size(struct request_queue *, unsigned short);
700extern void blk_queue_stack_limits(struct request_queue *t, struct request_queue *b); 703extern void blk_queue_stack_limits(struct request_queue *t, struct request_queue *b);
701extern int blk_queue_dma_drain(struct request_queue *q, void *buf, 704extern int blk_queue_dma_drain(struct request_queue *q,
702 unsigned int size); 705 dma_drain_needed_fn *dma_drain_needed,
706 void *buf, unsigned int size);
703extern void blk_queue_segment_boundary(struct request_queue *, unsigned long); 707extern void blk_queue_segment_boundary(struct request_queue *, unsigned long);
704extern void blk_queue_prep_rq(struct request_queue *, prep_rq_fn *pfn); 708extern void blk_queue_prep_rq(struct request_queue *, prep_rq_fn *pfn);
705extern void blk_queue_merge_bvec(struct request_queue *, merge_bvec_fn *); 709extern void blk_queue_merge_bvec(struct request_queue *, merge_bvec_fn *);
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 98ffb6ead434..b84b848431f2 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -1590,7 +1590,6 @@ extern void bd_set_size(struct block_device *, loff_t size);
1590extern void bd_forget(struct inode *inode); 1590extern void bd_forget(struct inode *inode);
1591extern void bdput(struct block_device *); 1591extern void bdput(struct block_device *);
1592extern struct block_device *open_by_devnum(dev_t, unsigned); 1592extern struct block_device *open_by_devnum(dev_t, unsigned);
1593extern const struct address_space_operations def_blk_aops;
1594#else 1593#else
1595static inline void bd_forget(struct inode *inode) {} 1594static inline void bd_forget(struct inode *inode) {}
1596#endif 1595#endif
diff --git a/include/linux/if_ether.h b/include/linux/if_ether.h
index e157c1399b61..42dc6a3571ec 100644
--- a/include/linux/if_ether.h
+++ b/include/linux/if_ether.h
@@ -129,8 +129,7 @@ extern ssize_t sysfs_format_mac(char *buf, const unsigned char *addr, int len);
129/* 129/*
130 * Display a 6 byte device address (MAC) in a readable format. 130 * Display a 6 byte device address (MAC) in a readable format.
131 */ 131 */
132extern char *print_mac(char *buf, const unsigned char *addr); 132extern __pure char *print_mac(char *buf, const unsigned char *addr);
133#define MAC_FMT "%02x:%02x:%02x:%02x:%02x:%02x"
134#define MAC_BUF_SIZE 18 133#define MAC_BUF_SIZE 18
135#define DECLARE_MAC_BUF(var) char var[MAC_BUF_SIZE] __maybe_unused 134#define DECLARE_MAC_BUF(var) char var[MAC_BUF_SIZE] __maybe_unused
136 135
diff --git a/include/linux/init.h b/include/linux/init.h
index a404a0055dd7..fb58c0493cf2 100644
--- a/include/linux/init.h
+++ b/include/linux/init.h
@@ -42,6 +42,7 @@
42 discard it in modules) */ 42 discard it in modules) */
43#define __init __section(.init.text) __cold 43#define __init __section(.init.text) __cold
44#define __initdata __section(.init.data) 44#define __initdata __section(.init.data)
45#define __initconst __section(.init.rodata)
45#define __exitdata __section(.exit.data) 46#define __exitdata __section(.exit.data)
46#define __exit_call __used __section(.exitcall.exit) 47#define __exit_call __used __section(.exitcall.exit)
47 48
@@ -106,6 +107,7 @@
106#define __memexitconst __section(.memexit.rodata) 107#define __memexitconst __section(.memexit.rodata)
107 108
108/* For assembly routines */ 109/* For assembly routines */
110#define __HEAD .section ".head.text","ax"
109#define __INIT .section ".init.text","ax" 111#define __INIT .section ".init.text","ax"
110#define __FINIT .previous 112#define __FINIT .previous
111 113
diff --git a/include/linux/iocontext.h b/include/linux/iocontext.h
index 593b222d9dcc..1b4ccf25b4d2 100644
--- a/include/linux/iocontext.h
+++ b/include/linux/iocontext.h
@@ -50,6 +50,7 @@ struct cfq_io_context {
50 sector_t seek_mean; 50 sector_t seek_mean;
51 51
52 struct list_head queue_list; 52 struct list_head queue_list;
53 struct hlist_node cic_list;
53 54
54 void (*dtor)(struct io_context *); /* destructor */ 55 void (*dtor)(struct io_context *); /* destructor */
55 void (*exit)(struct io_context *); /* called on task exit */ 56 void (*exit)(struct io_context *); /* called on task exit */
@@ -77,6 +78,7 @@ struct io_context {
77 78
78 struct as_io_context *aic; 79 struct as_io_context *aic;
79 struct radix_tree_root radix_root; 80 struct radix_tree_root radix_root;
81 struct hlist_head cic_list;
80 void *ioc_data; 82 void *ioc_data;
81}; 83};
82 84
diff --git a/include/linux/libata.h b/include/linux/libata.h
index bc5a8d0c7090..2e098f940cec 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -278,7 +278,6 @@ enum {
278 278
279 /* size of buffer to pad xfers ending on unaligned boundaries */ 279 /* size of buffer to pad xfers ending on unaligned boundaries */
280 ATA_DMA_PAD_SZ = 4, 280 ATA_DMA_PAD_SZ = 4,
281 ATA_DMA_PAD_BUF_SZ = ATA_DMA_PAD_SZ * ATA_MAX_QUEUE,
282 281
283 /* ering size */ 282 /* ering size */
284 ATA_ERING_SIZE = 32, 283 ATA_ERING_SIZE = 32,
@@ -457,24 +456,18 @@ struct ata_queued_cmd {
457 unsigned long flags; /* ATA_QCFLAG_xxx */ 456 unsigned long flags; /* ATA_QCFLAG_xxx */
458 unsigned int tag; 457 unsigned int tag;
459 unsigned int n_elem; 458 unsigned int n_elem;
460 unsigned int mapped_n_elem;
461 459
462 int dma_dir; 460 int dma_dir;
463 461
464 unsigned int pad_len;
465 unsigned int sect_size; 462 unsigned int sect_size;
466 463
467 unsigned int nbytes; 464 unsigned int nbytes;
468 unsigned int raw_nbytes;
469 unsigned int curbytes; 465 unsigned int curbytes;
470 466
471 struct scatterlist *cursg; 467 struct scatterlist *cursg;
472 unsigned int cursg_ofs; 468 unsigned int cursg_ofs;
473 469
474 struct scatterlist *last_sg;
475 struct scatterlist saved_last_sg;
476 struct scatterlist sgent; 470 struct scatterlist sgent;
477 struct scatterlist extra_sg[2];
478 471
479 struct scatterlist *sg; 472 struct scatterlist *sg;
480 473
@@ -619,9 +612,6 @@ struct ata_port {
619 struct ata_prd *prd; /* our SG list */ 612 struct ata_prd *prd; /* our SG list */
620 dma_addr_t prd_dma; /* and its DMA mapping */ 613 dma_addr_t prd_dma; /* and its DMA mapping */
621 614
622 void *pad; /* array of DMA pad buffers */
623 dma_addr_t pad_dma;
624
625 struct ata_ioports ioaddr; /* ATA cmd/ctl/dma register blocks */ 615 struct ata_ioports ioaddr; /* ATA cmd/ctl/dma register blocks */
626 616
627 u8 ctl; /* cache of ATA control register */ 617 u8 ctl; /* cache of ATA control register */
@@ -1363,12 +1353,9 @@ static inline void ata_qc_reinit(struct ata_queued_cmd *qc)
1363 qc->flags = 0; 1353 qc->flags = 0;
1364 qc->cursg = NULL; 1354 qc->cursg = NULL;
1365 qc->cursg_ofs = 0; 1355 qc->cursg_ofs = 0;
1366 qc->nbytes = qc->raw_nbytes = qc->curbytes = 0; 1356 qc->nbytes = qc->curbytes = 0;
1367 qc->n_elem = 0; 1357 qc->n_elem = 0;
1368 qc->mapped_n_elem = 0;
1369 qc->err_mask = 0; 1358 qc->err_mask = 0;
1370 qc->pad_len = 0;
1371 qc->last_sg = NULL;
1372 qc->sect_size = ATA_SECT_SIZE; 1359 qc->sect_size = ATA_SECT_SIZE;
1373 1360
1374 ata_tf_init(qc->dev, &qc->tf); 1361 ata_tf_init(qc->dev, &qc->tf);
@@ -1423,19 +1410,6 @@ static inline unsigned int __ac_err_mask(u8 status)
1423 return mask; 1410 return mask;
1424} 1411}
1425 1412
1426static inline int ata_pad_alloc(struct ata_port *ap, struct device *dev)
1427{
1428 ap->pad_dma = 0;
1429 ap->pad = dmam_alloc_coherent(dev, ATA_DMA_PAD_BUF_SZ,
1430 &ap->pad_dma, GFP_KERNEL);
1431 return (ap->pad == NULL) ? -ENOMEM : 0;
1432}
1433
1434static inline void ata_pad_free(struct ata_port *ap, struct device *dev)
1435{
1436 dmam_free_coherent(dev, ATA_DMA_PAD_BUF_SZ, ap->pad, ap->pad_dma);
1437}
1438
1439static inline struct ata_port *ata_shost_to_port(struct Scsi_Host *host) 1413static inline struct ata_port *ata_shost_to_port(struct Scsi_Host *host)
1440{ 1414{
1441 return *(struct ata_port **)&host->hostdata[0]; 1415 return *(struct ata_port **)&host->hostdata[0];
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index 412672a79e8a..bbd8d0027e2f 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -232,6 +232,8 @@ typedef unsigned char *sk_buff_data_t;
232 * @mark: Generic packet mark 232 * @mark: Generic packet mark
233 * @nfct: Associated connection, if any 233 * @nfct: Associated connection, if any
234 * @ipvs_property: skbuff is owned by ipvs 234 * @ipvs_property: skbuff is owned by ipvs
235 * @peeked: this packet has been seen already, so stats have been
236 * done for it, don't do them again
235 * @nf_trace: netfilter packet trace flag 237 * @nf_trace: netfilter packet trace flag
236 * @nfctinfo: Relationship of this skb to the connection 238 * @nfctinfo: Relationship of this skb to the connection
237 * @nfct_reasm: netfilter conntrack re-assembly pointer 239 * @nfct_reasm: netfilter conntrack re-assembly pointer
diff --git a/include/net/sock.h b/include/net/sock.h
index 8a7889b35810..fd9876087651 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -180,6 +180,7 @@ struct sock_common {
180 * @sk_sndmsg_off: cached offset for sendmsg 180 * @sk_sndmsg_off: cached offset for sendmsg
181 * @sk_send_head: front of stuff to transmit 181 * @sk_send_head: front of stuff to transmit
182 * @sk_security: used by security modules 182 * @sk_security: used by security modules
183 * @sk_mark: generic packet mark
183 * @sk_write_pending: a write to stream socket waits to start 184 * @sk_write_pending: a write to stream socket waits to start
184 * @sk_state_change: callback to indicate change in the state of the sock 185 * @sk_state_change: callback to indicate change in the state of the sock
185 * @sk_data_ready: callback to indicate there is data to be processed 186 * @sk_data_ready: callback to indicate there is data to be processed
diff --git a/kernel/irq/chip.c b/kernel/irq/chip.c
index cc54c6276356..fdb3fbe2b0c4 100644
--- a/kernel/irq/chip.c
+++ b/kernel/irq/chip.c
@@ -246,6 +246,17 @@ static unsigned int default_startup(unsigned int irq)
246} 246}
247 247
248/* 248/*
249 * default shutdown function
250 */
251static void default_shutdown(unsigned int irq)
252{
253 struct irq_desc *desc = irq_desc + irq;
254
255 desc->chip->mask(irq);
256 desc->status |= IRQ_MASKED;
257}
258
259/*
249 * Fixup enable/disable function pointers 260 * Fixup enable/disable function pointers
250 */ 261 */
251void irq_chip_set_defaults(struct irq_chip *chip) 262void irq_chip_set_defaults(struct irq_chip *chip)
@@ -256,8 +267,15 @@ void irq_chip_set_defaults(struct irq_chip *chip)
256 chip->disable = default_disable; 267 chip->disable = default_disable;
257 if (!chip->startup) 268 if (!chip->startup)
258 chip->startup = default_startup; 269 chip->startup = default_startup;
270 /*
271 * We use chip->disable, when the user provided its own. When
272 * we have default_disable set for chip->disable, then we need
273 * to use default_shutdown, otherwise the irq line is not
274 * disabled on free_irq():
275 */
259 if (!chip->shutdown) 276 if (!chip->shutdown)
260 chip->shutdown = chip->disable; 277 chip->shutdown = chip->disable != default_disable ?
278 chip->disable : default_shutdown;
261 if (!chip->name) 279 if (!chip->name)
262 chip->name = chip->typename; 280 chip->name = chip->typename;
263 if (!chip->end) 281 if (!chip->end)
diff --git a/kernel/irq/spurious.c b/kernel/irq/spurious.c
index a6b2bc831dd0..088dabbf2d6a 100644
--- a/kernel/irq/spurious.c
+++ b/kernel/irq/spurious.c
@@ -6,6 +6,7 @@
6 * This file contains spurious interrupt handling. 6 * This file contains spurious interrupt handling.
7 */ 7 */
8 8
9#include <linux/jiffies.h>
9#include <linux/irq.h> 10#include <linux/irq.h>
10#include <linux/module.h> 11#include <linux/module.h>
11#include <linux/kallsyms.h> 12#include <linux/kallsyms.h>
@@ -179,7 +180,7 @@ void note_interrupt(unsigned int irq, struct irq_desc *desc,
179 * otherwise the couter becomes a doomsday timer for otherwise 180 * otherwise the couter becomes a doomsday timer for otherwise
180 * working systems 181 * working systems
181 */ 182 */
182 if (jiffies - desc->last_unhandled > HZ/10) 183 if (time_after(jiffies, desc->last_unhandled + HZ/10))
183 desc->irqs_unhandled = 1; 184 desc->irqs_unhandled = 1;
184 else 185 else
185 desc->irqs_unhandled++; 186 desc->irqs_unhandled++;
diff --git a/mm/slub.c b/mm/slub.c
index 4b3895cb90ee..74c65af0a54f 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -149,13 +149,6 @@ static inline void ClearSlabDebug(struct page *page)
149/* Enable to test recovery from slab corruption on boot */ 149/* Enable to test recovery from slab corruption on boot */
150#undef SLUB_RESILIENCY_TEST 150#undef SLUB_RESILIENCY_TEST
151 151
152/*
153 * Currently fastpath is not supported if preemption is enabled.
154 */
155#if defined(CONFIG_FAST_CMPXCHG_LOCAL) && !defined(CONFIG_PREEMPT)
156#define SLUB_FASTPATH
157#endif
158
159#if PAGE_SHIFT <= 12 152#if PAGE_SHIFT <= 12
160 153
161/* 154/*
@@ -1514,11 +1507,7 @@ static void *__slab_alloc(struct kmem_cache *s,
1514{ 1507{
1515 void **object; 1508 void **object;
1516 struct page *new; 1509 struct page *new;
1517#ifdef SLUB_FASTPATH
1518 unsigned long flags;
1519 1510
1520 local_irq_save(flags);
1521#endif
1522 if (!c->page) 1511 if (!c->page)
1523 goto new_slab; 1512 goto new_slab;
1524 1513
@@ -1541,9 +1530,6 @@ load_freelist:
1541unlock_out: 1530unlock_out:
1542 slab_unlock(c->page); 1531 slab_unlock(c->page);
1543 stat(c, ALLOC_SLOWPATH); 1532 stat(c, ALLOC_SLOWPATH);
1544#ifdef SLUB_FASTPATH
1545 local_irq_restore(flags);
1546#endif
1547 return object; 1533 return object;
1548 1534
1549another_slab: 1535another_slab:
@@ -1575,9 +1561,7 @@ new_slab:
1575 c->page = new; 1561 c->page = new;
1576 goto load_freelist; 1562 goto load_freelist;
1577 } 1563 }
1578#ifdef SLUB_FASTPATH 1564
1579 local_irq_restore(flags);
1580#endif
1581 /* 1565 /*
1582 * No memory available. 1566 * No memory available.
1583 * 1567 *
@@ -1619,34 +1603,6 @@ static __always_inline void *slab_alloc(struct kmem_cache *s,
1619{ 1603{
1620 void **object; 1604 void **object;
1621 struct kmem_cache_cpu *c; 1605 struct kmem_cache_cpu *c;
1622
1623/*
1624 * The SLUB_FASTPATH path is provisional and is currently disabled if the
1625 * kernel is compiled with preemption or if the arch does not support
1626 * fast cmpxchg operations. There are a couple of coming changes that will
1627 * simplify matters and allow preemption. Ultimately we may end up making
1628 * SLUB_FASTPATH the default.
1629 *
1630 * 1. The introduction of the per cpu allocator will avoid array lookups
1631 * through get_cpu_slab(). A special register can be used instead.
1632 *
1633 * 2. The introduction of per cpu atomic operations (cpu_ops) means that
1634 * we can realize the logic here entirely with per cpu atomics. The
1635 * per cpu atomic ops will take care of the preemption issues.
1636 */
1637
1638#ifdef SLUB_FASTPATH
1639 c = get_cpu_slab(s, raw_smp_processor_id());
1640 do {
1641 object = c->freelist;
1642 if (unlikely(is_end(object) || !node_match(c, node))) {
1643 object = __slab_alloc(s, gfpflags, node, addr, c);
1644 break;
1645 }
1646 stat(c, ALLOC_FASTPATH);
1647 } while (cmpxchg_local(&c->freelist, object, object[c->offset])
1648 != object);
1649#else
1650 unsigned long flags; 1606 unsigned long flags;
1651 1607
1652 local_irq_save(flags); 1608 local_irq_save(flags);
@@ -1661,7 +1617,6 @@ static __always_inline void *slab_alloc(struct kmem_cache *s,
1661 stat(c, ALLOC_FASTPATH); 1617 stat(c, ALLOC_FASTPATH);
1662 } 1618 }
1663 local_irq_restore(flags); 1619 local_irq_restore(flags);
1664#endif
1665 1620
1666 if (unlikely((gfpflags & __GFP_ZERO) && object)) 1621 if (unlikely((gfpflags & __GFP_ZERO) && object))
1667 memset(object, 0, c->objsize); 1622 memset(object, 0, c->objsize);
@@ -1698,11 +1653,6 @@ static void __slab_free(struct kmem_cache *s, struct page *page,
1698 void **object = (void *)x; 1653 void **object = (void *)x;
1699 struct kmem_cache_cpu *c; 1654 struct kmem_cache_cpu *c;
1700 1655
1701#ifdef SLUB_FASTPATH
1702 unsigned long flags;
1703
1704 local_irq_save(flags);
1705#endif
1706 c = get_cpu_slab(s, raw_smp_processor_id()); 1656 c = get_cpu_slab(s, raw_smp_processor_id());
1707 stat(c, FREE_SLOWPATH); 1657 stat(c, FREE_SLOWPATH);
1708 slab_lock(page); 1658 slab_lock(page);
@@ -1734,9 +1684,6 @@ checks_ok:
1734 1684
1735out_unlock: 1685out_unlock:
1736 slab_unlock(page); 1686 slab_unlock(page);
1737#ifdef SLUB_FASTPATH
1738 local_irq_restore(flags);
1739#endif
1740 return; 1687 return;
1741 1688
1742slab_empty: 1689slab_empty:
@@ -1749,9 +1696,6 @@ slab_empty:
1749 } 1696 }
1750 slab_unlock(page); 1697 slab_unlock(page);
1751 stat(c, FREE_SLAB); 1698 stat(c, FREE_SLAB);
1752#ifdef SLUB_FASTPATH
1753 local_irq_restore(flags);
1754#endif
1755 discard_slab(s, page); 1699 discard_slab(s, page);
1756 return; 1700 return;
1757 1701
@@ -1777,34 +1721,6 @@ static __always_inline void slab_free(struct kmem_cache *s,
1777{ 1721{
1778 void **object = (void *)x; 1722 void **object = (void *)x;
1779 struct kmem_cache_cpu *c; 1723 struct kmem_cache_cpu *c;
1780
1781#ifdef SLUB_FASTPATH
1782 void **freelist;
1783
1784 c = get_cpu_slab(s, raw_smp_processor_id());
1785 debug_check_no_locks_freed(object, s->objsize);
1786 do {
1787 freelist = c->freelist;
1788 barrier();
1789 /*
1790 * If the compiler would reorder the retrieval of c->page to
1791 * come before c->freelist then an interrupt could
1792 * change the cpu slab before we retrieve c->freelist. We
1793 * could be matching on a page no longer active and put the
1794 * object onto the freelist of the wrong slab.
1795 *
1796 * On the other hand: If we already have the freelist pointer
1797 * then any change of cpu_slab will cause the cmpxchg to fail
1798 * since the freelist pointers are unique per slab.
1799 */
1800 if (unlikely(page != c->page || c->node < 0)) {
1801 __slab_free(s, page, x, addr, c->offset);
1802 break;
1803 }
1804 object[c->offset] = freelist;
1805 stat(c, FREE_FASTPATH);
1806 } while (cmpxchg_local(&c->freelist, freelist, object) != freelist);
1807#else
1808 unsigned long flags; 1724 unsigned long flags;
1809 1725
1810 local_irq_save(flags); 1726 local_irq_save(flags);
@@ -1818,7 +1734,6 @@ static __always_inline void slab_free(struct kmem_cache *s,
1818 __slab_free(s, page, x, addr, c->offset); 1734 __slab_free(s, page, x, addr, c->offset);
1819 1735
1820 local_irq_restore(flags); 1736 local_irq_restore(flags);
1821#endif
1822} 1737}
1823 1738
1824void kmem_cache_free(struct kmem_cache *s, void *x) 1739void kmem_cache_free(struct kmem_cache *s, void *x)
diff --git a/net/8021q/vlan_dev.c b/net/8021q/vlan_dev.c
index 77f04e49a1a0..fc60c6d096b9 100644
--- a/net/8021q/vlan_dev.c
+++ b/net/8021q/vlan_dev.c
@@ -366,7 +366,8 @@ static int vlan_dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
366{ 366{
367 struct net_device_stats *stats = &dev->stats; 367 struct net_device_stats *stats = &dev->stats;
368 struct vlan_ethhdr *veth = (struct vlan_ethhdr *)(skb->data); 368 struct vlan_ethhdr *veth = (struct vlan_ethhdr *)(skb->data);
369 369 DECLARE_MAC_BUF(mac);
370 DECLARE_MAC_BUF(mac2);
370 /* Handle non-VLAN frames if they are sent to us, for example by DHCP. 371 /* Handle non-VLAN frames if they are sent to us, for example by DHCP.
371 * 372 *
372 * NOTE: THIS ASSUMES DIX ETHERNET, SPECIFICALLY NOT SUPPORTING 373 * NOTE: THIS ASSUMES DIX ETHERNET, SPECIFICALLY NOT SUPPORTING
@@ -404,11 +405,8 @@ static int vlan_dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
404 405
405 pr_debug("%s: about to send skb: %p to dev: %s\n", 406 pr_debug("%s: about to send skb: %p to dev: %s\n",
406 __FUNCTION__, skb, skb->dev->name); 407 __FUNCTION__, skb, skb->dev->name);
407 pr_debug(" " MAC_FMT " " MAC_FMT " %4hx %4hx %4hx\n", 408 pr_debug(" %s %s %4hx %4hx %4hx\n",
408 veth->h_dest[0], veth->h_dest[1], veth->h_dest[2], 409 print_mac(mac, veth->h_dest), print_mac(mac2, veth->h_source),
409 veth->h_dest[3], veth->h_dest[4], veth->h_dest[5],
410 veth->h_source[0], veth->h_source[1], veth->h_source[2],
411 veth->h_source[3], veth->h_source[4], veth->h_source[5],
412 veth->h_vlan_proto, veth->h_vlan_TCI, 410 veth->h_vlan_proto, veth->h_vlan_TCI,
413 veth->h_vlan_encapsulated_proto); 411 veth->h_vlan_encapsulated_proto);
414 412
diff --git a/net/9p/trans_virtio.c b/net/9p/trans_virtio.c
index 0117b9fb8480..9e3d81cb9f08 100644
--- a/net/9p/trans_virtio.c
+++ b/net/9p/trans_virtio.c
@@ -183,8 +183,7 @@ pack_sg_list(struct scatterlist *sg, int start, int limit, char *data,
183 sg_set_buf(&sg[index++], data, s); 183 sg_set_buf(&sg[index++], data, s);
184 count -= s; 184 count -= s;
185 data += s; 185 data += s;
186 if (index > limit) 186 BUG_ON(index > limit);
187 BUG();
188 } 187 }
189 188
190 return index-start; 189 return index-start;
diff --git a/net/ax25/ax25_out.c b/net/ax25/ax25_out.c
index 92b517af7260..bf706f83a5c9 100644
--- a/net/ax25/ax25_out.c
+++ b/net/ax25/ax25_out.c
@@ -117,6 +117,12 @@ void ax25_output(ax25_cb *ax25, int paclen, struct sk_buff *skb)
117 unsigned char *p; 117 unsigned char *p;
118 int frontlen, len, fragno, ka9qfrag, first = 1; 118 int frontlen, len, fragno, ka9qfrag, first = 1;
119 119
120 if (paclen < 16) {
121 WARN_ON_ONCE(1);
122 kfree_skb(skb);
123 return;
124 }
125
120 if ((skb->len - 1) > paclen) { 126 if ((skb->len - 1) > paclen) {
121 if (*skb->data == AX25_P_TEXT) { 127 if (*skb->data == AX25_P_TEXT) {
122 skb_pull(skb, 1); /* skip PID */ 128 skb_pull(skb, 1); /* skip PID */
@@ -251,8 +257,6 @@ void ax25_kick(ax25_cb *ax25)
251 if (start == end) 257 if (start == end)
252 return; 258 return;
253 259
254 ax25->vs = start;
255
256 /* 260 /*
257 * Transmit data until either we're out of data to send or 261 * Transmit data until either we're out of data to send or
258 * the window is full. Send a poll on the final I frame if 262 * the window is full. Send a poll on the final I frame if
@@ -261,8 +265,13 @@ void ax25_kick(ax25_cb *ax25)
261 265
262 /* 266 /*
263 * Dequeue the frame and copy it. 267 * Dequeue the frame and copy it.
268 * Check for race with ax25_clear_queues().
264 */ 269 */
265 skb = skb_dequeue(&ax25->write_queue); 270 skb = skb_dequeue(&ax25->write_queue);
271 if (!skb)
272 return;
273
274 ax25->vs = start;
266 275
267 do { 276 do {
268 if ((skbn = skb_clone(skb, GFP_ATOMIC)) == NULL) { 277 if ((skbn = skb_clone(skb, GFP_ATOMIC)) == NULL) {
diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c
index 5fc7be206f62..f8880261da0e 100644
--- a/net/bluetooth/hci_conn.c
+++ b/net/bluetooth/hci_conn.c
@@ -260,7 +260,6 @@ int hci_conn_del(struct hci_conn *conn)
260 tasklet_enable(&hdev->tx_task); 260 tasklet_enable(&hdev->tx_task);
261 skb_queue_purge(&conn->data_q); 261 skb_queue_purge(&conn->data_q);
262 hci_conn_del_sysfs(conn); 262 hci_conn_del_sysfs(conn);
263 hci_dev_put(hdev);
264 263
265 return 0; 264 return 0;
266} 265}
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index 372b0d3b75a8..930b58e7149a 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -24,6 +24,7 @@
24 24
25/* Bluetooth HCI core. */ 25/* Bluetooth HCI core. */
26 26
27#include <linux/jiffies.h>
27#include <linux/module.h> 28#include <linux/module.h>
28#include <linux/kmod.h> 29#include <linux/kmod.h>
29 30
@@ -1321,7 +1322,7 @@ static inline void hci_sched_acl(struct hci_dev *hdev)
1321 if (!test_bit(HCI_RAW, &hdev->flags)) { 1322 if (!test_bit(HCI_RAW, &hdev->flags)) {
1322 /* ACL tx timeout must be longer than maximum 1323 /* ACL tx timeout must be longer than maximum
1323 * link supervision timeout (40.9 seconds) */ 1324 * link supervision timeout (40.9 seconds) */
1324 if (!hdev->acl_cnt && (jiffies - hdev->acl_last_tx) > (HZ * 45)) 1325 if (!hdev->acl_cnt && time_after(jiffies, hdev->acl_last_tx + HZ * 45))
1325 hci_acl_tx_to(hdev); 1326 hci_acl_tx_to(hdev);
1326 } 1327 }
1327 1328
@@ -1543,7 +1544,7 @@ static void hci_cmd_task(unsigned long arg)
1543 1544
1544 BT_DBG("%s cmd %d", hdev->name, atomic_read(&hdev->cmd_cnt)); 1545 BT_DBG("%s cmd %d", hdev->name, atomic_read(&hdev->cmd_cnt));
1545 1546
1546 if (!atomic_read(&hdev->cmd_cnt) && (jiffies - hdev->cmd_last_tx) > HZ) { 1547 if (!atomic_read(&hdev->cmd_cnt) && time_after(jiffies, hdev->cmd_last_tx + HZ)) {
1547 BT_ERR("%s command tx timeout", hdev->name); 1548 BT_ERR("%s command tx timeout", hdev->name);
1548 atomic_set(&hdev->cmd_cnt, 1); 1549 atomic_set(&hdev->cmd_cnt, 1);
1549 } 1550 }
diff --git a/net/bluetooth/hci_sysfs.c b/net/bluetooth/hci_sysfs.c
index e13cf5ef144c..84360c117d4e 100644
--- a/net/bluetooth/hci_sysfs.c
+++ b/net/bluetooth/hci_sysfs.c
@@ -320,28 +320,34 @@ void hci_conn_add_sysfs(struct hci_conn *conn)
320 queue_work(btaddconn, &conn->work); 320 queue_work(btaddconn, &conn->work);
321} 321}
322 322
323/*
324 * The rfcomm tty device will possibly retain even when conn
325 * is down, and sysfs doesn't support move zombie device,
326 * so we should move the device before conn device is destroyed.
327 */
323static int __match_tty(struct device *dev, void *data) 328static int __match_tty(struct device *dev, void *data)
324{ 329{
325 /* The rfcomm tty device will possibly retain even when conn 330 return !strncmp(dev->bus_id, "rfcomm", 6);
326 * is down, and sysfs doesn't support move zombie device,
327 * so we should move the device before conn device is destroyed.
328 * Due to the only child device of hci_conn dev is rfcomm
329 * tty_dev, here just return 1
330 */
331 return 1;
332} 331}
333 332
334static void del_conn(struct work_struct *work) 333static void del_conn(struct work_struct *work)
335{ 334{
336 struct device *dev;
337 struct hci_conn *conn = container_of(work, struct hci_conn, work); 335 struct hci_conn *conn = container_of(work, struct hci_conn, work);
336 struct hci_dev *hdev = conn->hdev;
337
338 while (1) {
339 struct device *dev;
338 340
339 while (dev = device_find_child(&conn->dev, NULL, __match_tty)) { 341 dev = device_find_child(&conn->dev, NULL, __match_tty);
342 if (!dev)
343 break;
340 device_move(dev, NULL); 344 device_move(dev, NULL);
341 put_device(dev); 345 put_device(dev);
342 } 346 }
347
343 device_del(&conn->dev); 348 device_del(&conn->dev);
344 put_device(&conn->dev); 349 put_device(&conn->dev);
350 hci_dev_put(hdev);
345} 351}
346 352
347void hci_conn_del_sysfs(struct hci_conn *conn) 353void hci_conn_del_sysfs(struct hci_conn *conn)
diff --git a/net/core/neighbour.c b/net/core/neighbour.c
index 7bb6a9a1256d..a16cf1ec5e5e 100644
--- a/net/core/neighbour.c
+++ b/net/core/neighbour.c
@@ -834,12 +834,18 @@ static void neigh_timer_handler(unsigned long arg)
834 } 834 }
835 if (neigh->nud_state & (NUD_INCOMPLETE | NUD_PROBE)) { 835 if (neigh->nud_state & (NUD_INCOMPLETE | NUD_PROBE)) {
836 struct sk_buff *skb = skb_peek(&neigh->arp_queue); 836 struct sk_buff *skb = skb_peek(&neigh->arp_queue);
837 837 /* keep skb alive even if arp_queue overflows */
838 if (skb)
839 skb_get(skb);
840 write_unlock(&neigh->lock);
838 neigh->ops->solicit(neigh, skb); 841 neigh->ops->solicit(neigh, skb);
839 atomic_inc(&neigh->probes); 842 atomic_inc(&neigh->probes);
840 } 843 if (skb)
844 kfree_skb(skb);
845 } else {
841out: 846out:
842 write_unlock(&neigh->lock); 847 write_unlock(&neigh->lock);
848 }
843 849
844 if (notify) 850 if (notify)
845 neigh_update_notify(neigh); 851 neigh_update_notify(neigh);
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index ecb02afd52dc..61ac8d06292c 100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -504,7 +504,7 @@ int rtnl_put_cacheinfo(struct sk_buff *skb, struct dst_entry *dst, u32 id,
504 504
505EXPORT_SYMBOL_GPL(rtnl_put_cacheinfo); 505EXPORT_SYMBOL_GPL(rtnl_put_cacheinfo);
506 506
507static int set_operstate(struct net_device *dev, unsigned char transition, bool send_notification) 507static void set_operstate(struct net_device *dev, unsigned char transition)
508{ 508{
509 unsigned char operstate = dev->operstate; 509 unsigned char operstate = dev->operstate;
510 510
@@ -527,12 +527,8 @@ static int set_operstate(struct net_device *dev, unsigned char transition, bool
527 write_lock_bh(&dev_base_lock); 527 write_lock_bh(&dev_base_lock);
528 dev->operstate = operstate; 528 dev->operstate = operstate;
529 write_unlock_bh(&dev_base_lock); 529 write_unlock_bh(&dev_base_lock);
530 530 netdev_state_change(dev);
531 if (send_notification) 531 }
532 netdev_state_change(dev);
533 return 1;
534 } else
535 return 0;
536} 532}
537 533
538static void copy_rtnl_link_stats(struct rtnl_link_stats *a, 534static void copy_rtnl_link_stats(struct rtnl_link_stats *a,
@@ -826,7 +822,6 @@ static int do_setlink(struct net_device *dev, struct ifinfomsg *ifm,
826 if (tb[IFLA_BROADCAST]) { 822 if (tb[IFLA_BROADCAST]) {
827 nla_memcpy(dev->broadcast, tb[IFLA_BROADCAST], dev->addr_len); 823 nla_memcpy(dev->broadcast, tb[IFLA_BROADCAST], dev->addr_len);
828 send_addr_notify = 1; 824 send_addr_notify = 1;
829 modified = 1;
830 } 825 }
831 826
832 if (ifm->ifi_flags || ifm->ifi_change) { 827 if (ifm->ifi_flags || ifm->ifi_change) {
@@ -839,23 +834,16 @@ static int do_setlink(struct net_device *dev, struct ifinfomsg *ifm,
839 dev_change_flags(dev, flags); 834 dev_change_flags(dev, flags);
840 } 835 }
841 836
842 if (tb[IFLA_TXQLEN]) { 837 if (tb[IFLA_TXQLEN])
843 if (dev->tx_queue_len != nla_get_u32(tb[IFLA_TXQLEN])) { 838 dev->tx_queue_len = nla_get_u32(tb[IFLA_TXQLEN]);
844 dev->tx_queue_len = nla_get_u32(tb[IFLA_TXQLEN]);
845 modified = 1;
846 }
847 }
848 839
849 if (tb[IFLA_OPERSTATE]) 840 if (tb[IFLA_OPERSTATE])
850 modified |= set_operstate(dev, nla_get_u8(tb[IFLA_OPERSTATE]), false); 841 set_operstate(dev, nla_get_u8(tb[IFLA_OPERSTATE]));
851 842
852 if (tb[IFLA_LINKMODE]) { 843 if (tb[IFLA_LINKMODE]) {
853 if (dev->link_mode != nla_get_u8(tb[IFLA_LINKMODE])) { 844 write_lock_bh(&dev_base_lock);
854 write_lock_bh(&dev_base_lock); 845 dev->link_mode = nla_get_u8(tb[IFLA_LINKMODE]);
855 dev->link_mode = nla_get_u8(tb[IFLA_LINKMODE]); 846 write_unlock_bh(&dev_base_lock);
856 write_lock_bh(&dev_base_lock);
857 modified = 1;
858 }
859 } 847 }
860 848
861 err = 0; 849 err = 0;
@@ -869,10 +857,6 @@ errout:
869 857
870 if (send_addr_notify) 858 if (send_addr_notify)
871 call_netdevice_notifiers(NETDEV_CHANGEADDR, dev); 859 call_netdevice_notifiers(NETDEV_CHANGEADDR, dev);
872
873 if (modified)
874 netdev_state_change(dev);
875
876 return err; 860 return err;
877} 861}
878 862
@@ -990,7 +974,7 @@ struct net_device *rtnl_create_link(struct net *net, char *ifname,
990 if (tb[IFLA_TXQLEN]) 974 if (tb[IFLA_TXQLEN])
991 dev->tx_queue_len = nla_get_u32(tb[IFLA_TXQLEN]); 975 dev->tx_queue_len = nla_get_u32(tb[IFLA_TXQLEN]);
992 if (tb[IFLA_OPERSTATE]) 976 if (tb[IFLA_OPERSTATE])
993 set_operstate(dev, nla_get_u8(tb[IFLA_OPERSTATE]), true); 977 set_operstate(dev, nla_get_u8(tb[IFLA_OPERSTATE]));
994 if (tb[IFLA_LINKMODE]) 978 if (tb[IFLA_LINKMODE])
995 dev->link_mode = nla_get_u8(tb[IFLA_LINKMODE]); 979 dev->link_mode = nla_get_u8(tb[IFLA_LINKMODE]);
996 980
diff --git a/net/ipv4/arp.c b/net/ipv4/arp.c
index c663fa5339ee..8e17f65f4002 100644
--- a/net/ipv4/arp.c
+++ b/net/ipv4/arp.c
@@ -368,6 +368,7 @@ static void arp_solicit(struct neighbour *neigh, struct sk_buff *skb)
368 if (!(neigh->nud_state&NUD_VALID)) 368 if (!(neigh->nud_state&NUD_VALID))
369 printk(KERN_DEBUG "trying to ucast probe in NUD_INVALID\n"); 369 printk(KERN_DEBUG "trying to ucast probe in NUD_INVALID\n");
370 dst_ha = neigh->ha; 370 dst_ha = neigh->ha;
371 read_lock_bh(&neigh->lock);
371 } else if ((probes -= neigh->parms->app_probes) < 0) { 372 } else if ((probes -= neigh->parms->app_probes) < 0) {
372#ifdef CONFIG_ARPD 373#ifdef CONFIG_ARPD
373 neigh_app_ns(neigh); 374 neigh_app_ns(neigh);
@@ -377,6 +378,8 @@ static void arp_solicit(struct neighbour *neigh, struct sk_buff *skb)
377 378
378 arp_send(ARPOP_REQUEST, ETH_P_ARP, target, dev, saddr, 379 arp_send(ARPOP_REQUEST, ETH_P_ARP, target, dev, saddr,
379 dst_ha, dev->dev_addr, NULL); 380 dst_ha, dev->dev_addr, NULL);
381 if (dst_ha)
382 read_unlock_bh(&neigh->lock);
380} 383}
381 384
382static int arp_ignore(struct in_device *in_dev, __be32 sip, __be32 tip) 385static int arp_ignore(struct in_device *in_dev, __be32 sip, __be32 tip)
diff --git a/net/ipv4/ipconfig.c b/net/ipv4/ipconfig.c
index a52b5853aaa8..10013ccee8dd 100644
--- a/net/ipv4/ipconfig.c
+++ b/net/ipv4/ipconfig.c
@@ -1390,7 +1390,7 @@ static int __init ip_auto_config(void)
1390 * Clue in the operator. 1390 * Clue in the operator.
1391 */ 1391 */
1392 printk("IP-Config: Complete:"); 1392 printk("IP-Config: Complete:");
1393 printk("\n device=%s", ic_dev->name); 1393 printk("\n device=%s", ic_dev->name);
1394 printk(", addr=%u.%u.%u.%u", NIPQUAD(ic_myaddr)); 1394 printk(", addr=%u.%u.%u.%u", NIPQUAD(ic_myaddr));
1395 printk(", mask=%u.%u.%u.%u", NIPQUAD(ic_netmask)); 1395 printk(", mask=%u.%u.%u.%u", NIPQUAD(ic_netmask));
1396 printk(", gw=%u.%u.%u.%u", NIPQUAD(ic_gateway)); 1396 printk(", gw=%u.%u.%u.%u", NIPQUAD(ic_gateway));
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
index 63414ea427c5..00156bf421ca 100644
--- a/net/ipv4/tcp_ipv4.c
+++ b/net/ipv4/tcp_ipv4.c
@@ -719,7 +719,7 @@ static void tcp_v4_reqsk_send_ack(struct sk_buff *skb,
719} 719}
720 720
721/* 721/*
722 * Send a SYN-ACK after having received an ACK. 722 * Send a SYN-ACK after having received a SYN.
723 * This still operates on a request_sock only, not on a big 723 * This still operates on a request_sock only, not on a big
724 * socket. 724 * socket.
725 */ 725 */
diff --git a/net/ipv6/af_inet6.c b/net/ipv6/af_inet6.c
index bddac0e8780f..f0aa97738746 100644
--- a/net/ipv6/af_inet6.c
+++ b/net/ipv6/af_inet6.c
@@ -752,14 +752,6 @@ static int __init inet6_init(void)
752 752
753 BUILD_BUG_ON(sizeof(struct inet6_skb_parm) > sizeof(dummy_skb->cb)); 753 BUILD_BUG_ON(sizeof(struct inet6_skb_parm) > sizeof(dummy_skb->cb));
754 754
755#ifdef MODULE
756#if 0 /* FIXME --RR */
757 if (!mod_member_present(&__this_module, can_unload))
758 return -EINVAL;
759
760 __this_module.can_unload = &ipv6_unload;
761#endif
762#endif
763 err = proto_register(&tcpv6_prot, 1); 755 err = proto_register(&tcpv6_prot, 1);
764 if (err) 756 if (err)
765 goto out; 757 goto out;
diff --git a/net/ipv6/ip6_fib.c b/net/ipv6/ip6_fib.c
index f93407cf6515..bab72b6f1444 100644
--- a/net/ipv6/ip6_fib.c
+++ b/net/ipv6/ip6_fib.c
@@ -1151,7 +1151,7 @@ static void fib6_del_route(struct fib6_node *fn, struct rt6_info **rtp,
1151 fn = fn->parent; 1151 fn = fn->parent;
1152 } 1152 }
1153 /* No more references are possible at this point. */ 1153 /* No more references are possible at this point. */
1154 if (atomic_read(&rt->rt6i_ref) != 1) BUG(); 1154 BUG_ON(atomic_read(&rt->rt6i_ref) != 1);
1155 } 1155 }
1156 1156
1157 inet6_rt_notify(RTM_DELROUTE, rt, info); 1157 inet6_rt_notify(RTM_DELROUTE, rt, info);
diff --git a/net/ipv6/ip6_tunnel.c b/net/ipv6/ip6_tunnel.c
index 9031e521c1df..cd940647bd12 100644
--- a/net/ipv6/ip6_tunnel.c
+++ b/net/ipv6/ip6_tunnel.c
@@ -550,6 +550,7 @@ ip4ip6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
550 ip_rt_put(rt); 550 ip_rt_put(rt);
551 goto out; 551 goto out;
552 } 552 }
553 skb2->dst = (struct dst_entry *)rt;
553 } else { 554 } else {
554 ip_rt_put(rt); 555 ip_rt_put(rt);
555 if (ip_route_input(skb2, eiph->daddr, eiph->saddr, eiph->tos, 556 if (ip_route_input(skb2, eiph->daddr, eiph->saddr, eiph->tos,
diff --git a/net/mac80211/ieee80211.c b/net/mac80211/ieee80211.c
index 67b7c75c430d..28bcdf9fc3df 100644
--- a/net/mac80211/ieee80211.c
+++ b/net/mac80211/ieee80211.c
@@ -165,6 +165,7 @@ static int ieee80211_open(struct net_device *dev)
165 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); 165 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
166 struct ieee80211_if_init_conf conf; 166 struct ieee80211_if_init_conf conf;
167 int res; 167 int res;
168 bool need_hw_reconfig = 0;
168 169
169 sdata = IEEE80211_DEV_TO_SUB_IF(dev); 170 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
170 171
@@ -218,7 +219,7 @@ static int ieee80211_open(struct net_device *dev)
218 res = local->ops->start(local_to_hw(local)); 219 res = local->ops->start(local_to_hw(local));
219 if (res) 220 if (res)
220 return res; 221 return res;
221 ieee80211_hw_config(local); 222 need_hw_reconfig = 1;
222 ieee80211_led_radio(local, local->hw.conf.radio_enabled); 223 ieee80211_led_radio(local, local->hw.conf.radio_enabled);
223 } 224 }
224 225
@@ -282,6 +283,8 @@ static int ieee80211_open(struct net_device *dev)
282 atomic_inc(&local->iff_promiscs); 283 atomic_inc(&local->iff_promiscs);
283 284
284 local->open_count++; 285 local->open_count++;
286 if (need_hw_reconfig)
287 ieee80211_hw_config(local);
285 288
286 netif_start_queue(dev); 289 netif_start_queue(dev);
287 290
diff --git a/net/netlabel/netlabel_cipso_v4.c b/net/netlabel/netlabel_cipso_v4.c
index c7ad64d664ad..fdc14a0d21af 100644
--- a/net/netlabel/netlabel_cipso_v4.c
+++ b/net/netlabel/netlabel_cipso_v4.c
@@ -718,36 +718,35 @@ static int netlbl_cipsov4_remove(struct sk_buff *skb, struct genl_info *info)
718 * NetLabel Generic NETLINK Command Definitions 718 * NetLabel Generic NETLINK Command Definitions
719 */ 719 */
720 720
721static struct genl_ops netlbl_cipsov4_genl_c_add = { 721static struct genl_ops netlbl_cipsov4_ops[] = {
722 {
722 .cmd = NLBL_CIPSOV4_C_ADD, 723 .cmd = NLBL_CIPSOV4_C_ADD,
723 .flags = GENL_ADMIN_PERM, 724 .flags = GENL_ADMIN_PERM,
724 .policy = netlbl_cipsov4_genl_policy, 725 .policy = netlbl_cipsov4_genl_policy,
725 .doit = netlbl_cipsov4_add, 726 .doit = netlbl_cipsov4_add,
726 .dumpit = NULL, 727 .dumpit = NULL,
727}; 728 },
728 729 {
729static struct genl_ops netlbl_cipsov4_genl_c_remove = {
730 .cmd = NLBL_CIPSOV4_C_REMOVE, 730 .cmd = NLBL_CIPSOV4_C_REMOVE,
731 .flags = GENL_ADMIN_PERM, 731 .flags = GENL_ADMIN_PERM,
732 .policy = netlbl_cipsov4_genl_policy, 732 .policy = netlbl_cipsov4_genl_policy,
733 .doit = netlbl_cipsov4_remove, 733 .doit = netlbl_cipsov4_remove,
734 .dumpit = NULL, 734 .dumpit = NULL,
735}; 735 },
736 736 {
737static struct genl_ops netlbl_cipsov4_genl_c_list = {
738 .cmd = NLBL_CIPSOV4_C_LIST, 737 .cmd = NLBL_CIPSOV4_C_LIST,
739 .flags = 0, 738 .flags = 0,
740 .policy = netlbl_cipsov4_genl_policy, 739 .policy = netlbl_cipsov4_genl_policy,
741 .doit = netlbl_cipsov4_list, 740 .doit = netlbl_cipsov4_list,
742 .dumpit = NULL, 741 .dumpit = NULL,
743}; 742 },
744 743 {
745static struct genl_ops netlbl_cipsov4_genl_c_listall = {
746 .cmd = NLBL_CIPSOV4_C_LISTALL, 744 .cmd = NLBL_CIPSOV4_C_LISTALL,
747 .flags = 0, 745 .flags = 0,
748 .policy = netlbl_cipsov4_genl_policy, 746 .policy = netlbl_cipsov4_genl_policy,
749 .doit = NULL, 747 .doit = NULL,
750 .dumpit = netlbl_cipsov4_listall, 748 .dumpit = netlbl_cipsov4_listall,
749 },
751}; 750};
752 751
753/* 752/*
@@ -762,30 +761,20 @@ static struct genl_ops netlbl_cipsov4_genl_c_listall = {
762 * mechanism. Returns zero on success, negative values on failure. 761 * mechanism. Returns zero on success, negative values on failure.
763 * 762 *
764 */ 763 */
765int netlbl_cipsov4_genl_init(void) 764int __init netlbl_cipsov4_genl_init(void)
766{ 765{
767 int ret_val; 766 int ret_val, i;
768 767
769 ret_val = genl_register_family(&netlbl_cipsov4_gnl_family); 768 ret_val = genl_register_family(&netlbl_cipsov4_gnl_family);
770 if (ret_val != 0) 769 if (ret_val != 0)
771 return ret_val; 770 return ret_val;
772 771
773 ret_val = genl_register_ops(&netlbl_cipsov4_gnl_family, 772 for (i = 0; i < ARRAY_SIZE(netlbl_cipsov4_ops); i++) {
774 &netlbl_cipsov4_genl_c_add); 773 ret_val = genl_register_ops(&netlbl_cipsov4_gnl_family,
775 if (ret_val != 0) 774 &netlbl_cipsov4_ops[i]);
776 return ret_val; 775 if (ret_val != 0)
777 ret_val = genl_register_ops(&netlbl_cipsov4_gnl_family, 776 return ret_val;
778 &netlbl_cipsov4_genl_c_remove); 777 }
779 if (ret_val != 0)
780 return ret_val;
781 ret_val = genl_register_ops(&netlbl_cipsov4_gnl_family,
782 &netlbl_cipsov4_genl_c_list);
783 if (ret_val != 0)
784 return ret_val;
785 ret_val = genl_register_ops(&netlbl_cipsov4_gnl_family,
786 &netlbl_cipsov4_genl_c_listall);
787 if (ret_val != 0)
788 return ret_val;
789 778
790 return 0; 779 return 0;
791} 780}
diff --git a/net/netlabel/netlabel_domainhash.c b/net/netlabel/netlabel_domainhash.c
index fd462313471c..02c2f7c0b255 100644
--- a/net/netlabel/netlabel_domainhash.c
+++ b/net/netlabel/netlabel_domainhash.c
@@ -171,7 +171,7 @@ static struct netlbl_dom_map *netlbl_domhsh_search_def(const char *domain)
171 * values on error. 171 * values on error.
172 * 172 *
173 */ 173 */
174int netlbl_domhsh_init(u32 size) 174int __init netlbl_domhsh_init(u32 size)
175{ 175{
176 u32 iter; 176 u32 iter;
177 struct netlbl_domhsh_tbl *hsh_tbl; 177 struct netlbl_domhsh_tbl *hsh_tbl;
diff --git a/net/netlabel/netlabel_mgmt.c b/net/netlabel/netlabel_mgmt.c
index e2258dc3c845..22c191267808 100644
--- a/net/netlabel/netlabel_mgmt.c
+++ b/net/netlabel/netlabel_mgmt.c
@@ -517,68 +517,63 @@ version_failure:
517 * NetLabel Generic NETLINK Command Definitions 517 * NetLabel Generic NETLINK Command Definitions
518 */ 518 */
519 519
520static struct genl_ops netlbl_mgmt_genl_c_add = { 520static struct genl_ops netlbl_mgmt_genl_ops[] = {
521 {
521 .cmd = NLBL_MGMT_C_ADD, 522 .cmd = NLBL_MGMT_C_ADD,
522 .flags = GENL_ADMIN_PERM, 523 .flags = GENL_ADMIN_PERM,
523 .policy = netlbl_mgmt_genl_policy, 524 .policy = netlbl_mgmt_genl_policy,
524 .doit = netlbl_mgmt_add, 525 .doit = netlbl_mgmt_add,
525 .dumpit = NULL, 526 .dumpit = NULL,
526}; 527 },
527 528 {
528static struct genl_ops netlbl_mgmt_genl_c_remove = {
529 .cmd = NLBL_MGMT_C_REMOVE, 529 .cmd = NLBL_MGMT_C_REMOVE,
530 .flags = GENL_ADMIN_PERM, 530 .flags = GENL_ADMIN_PERM,
531 .policy = netlbl_mgmt_genl_policy, 531 .policy = netlbl_mgmt_genl_policy,
532 .doit = netlbl_mgmt_remove, 532 .doit = netlbl_mgmt_remove,
533 .dumpit = NULL, 533 .dumpit = NULL,
534}; 534 },
535 535 {
536static struct genl_ops netlbl_mgmt_genl_c_listall = {
537 .cmd = NLBL_MGMT_C_LISTALL, 536 .cmd = NLBL_MGMT_C_LISTALL,
538 .flags = 0, 537 .flags = 0,
539 .policy = netlbl_mgmt_genl_policy, 538 .policy = netlbl_mgmt_genl_policy,
540 .doit = NULL, 539 .doit = NULL,
541 .dumpit = netlbl_mgmt_listall, 540 .dumpit = netlbl_mgmt_listall,
542}; 541 },
543 542 {
544static struct genl_ops netlbl_mgmt_genl_c_adddef = {
545 .cmd = NLBL_MGMT_C_ADDDEF, 543 .cmd = NLBL_MGMT_C_ADDDEF,
546 .flags = GENL_ADMIN_PERM, 544 .flags = GENL_ADMIN_PERM,
547 .policy = netlbl_mgmt_genl_policy, 545 .policy = netlbl_mgmt_genl_policy,
548 .doit = netlbl_mgmt_adddef, 546 .doit = netlbl_mgmt_adddef,
549 .dumpit = NULL, 547 .dumpit = NULL,
550}; 548 },
551 549 {
552static struct genl_ops netlbl_mgmt_genl_c_removedef = {
553 .cmd = NLBL_MGMT_C_REMOVEDEF, 550 .cmd = NLBL_MGMT_C_REMOVEDEF,
554 .flags = GENL_ADMIN_PERM, 551 .flags = GENL_ADMIN_PERM,
555 .policy = netlbl_mgmt_genl_policy, 552 .policy = netlbl_mgmt_genl_policy,
556 .doit = netlbl_mgmt_removedef, 553 .doit = netlbl_mgmt_removedef,
557 .dumpit = NULL, 554 .dumpit = NULL,
558}; 555 },
559 556 {
560static struct genl_ops netlbl_mgmt_genl_c_listdef = {
561 .cmd = NLBL_MGMT_C_LISTDEF, 557 .cmd = NLBL_MGMT_C_LISTDEF,
562 .flags = 0, 558 .flags = 0,
563 .policy = netlbl_mgmt_genl_policy, 559 .policy = netlbl_mgmt_genl_policy,
564 .doit = netlbl_mgmt_listdef, 560 .doit = netlbl_mgmt_listdef,
565 .dumpit = NULL, 561 .dumpit = NULL,
566}; 562 },
567 563 {
568static struct genl_ops netlbl_mgmt_genl_c_protocols = {
569 .cmd = NLBL_MGMT_C_PROTOCOLS, 564 .cmd = NLBL_MGMT_C_PROTOCOLS,
570 .flags = 0, 565 .flags = 0,
571 .policy = netlbl_mgmt_genl_policy, 566 .policy = netlbl_mgmt_genl_policy,
572 .doit = NULL, 567 .doit = NULL,
573 .dumpit = netlbl_mgmt_protocols, 568 .dumpit = netlbl_mgmt_protocols,
574}; 569 },
575 570 {
576static struct genl_ops netlbl_mgmt_genl_c_version = {
577 .cmd = NLBL_MGMT_C_VERSION, 571 .cmd = NLBL_MGMT_C_VERSION,
578 .flags = 0, 572 .flags = 0,
579 .policy = netlbl_mgmt_genl_policy, 573 .policy = netlbl_mgmt_genl_policy,
580 .doit = netlbl_mgmt_version, 574 .doit = netlbl_mgmt_version,
581 .dumpit = NULL, 575 .dumpit = NULL,
576 },
582}; 577};
583 578
584/* 579/*
@@ -593,46 +588,20 @@ static struct genl_ops netlbl_mgmt_genl_c_version = {
593 * mechanism. Returns zero on success, negative values on failure. 588 * mechanism. Returns zero on success, negative values on failure.
594 * 589 *
595 */ 590 */
596int netlbl_mgmt_genl_init(void) 591int __init netlbl_mgmt_genl_init(void)
597{ 592{
598 int ret_val; 593 int ret_val, i;
599 594
600 ret_val = genl_register_family(&netlbl_mgmt_gnl_family); 595 ret_val = genl_register_family(&netlbl_mgmt_gnl_family);
601 if (ret_val != 0) 596 if (ret_val != 0)
602 return ret_val; 597 return ret_val;
603 598
604 ret_val = genl_register_ops(&netlbl_mgmt_gnl_family, 599 for (i = 0; i < ARRAY_SIZE(netlbl_mgmt_genl_ops); i++) {
605 &netlbl_mgmt_genl_c_add); 600 ret_val = genl_register_ops(&netlbl_mgmt_gnl_family,
606 if (ret_val != 0) 601 &netlbl_mgmt_genl_ops[i]);
607 return ret_val; 602 if (ret_val != 0)
608 ret_val = genl_register_ops(&netlbl_mgmt_gnl_family, 603 return ret_val;
609 &netlbl_mgmt_genl_c_remove); 604 }
610 if (ret_val != 0)
611 return ret_val;
612 ret_val = genl_register_ops(&netlbl_mgmt_gnl_family,
613 &netlbl_mgmt_genl_c_listall);
614 if (ret_val != 0)
615 return ret_val;
616 ret_val = genl_register_ops(&netlbl_mgmt_gnl_family,
617 &netlbl_mgmt_genl_c_adddef);
618 if (ret_val != 0)
619 return ret_val;
620 ret_val = genl_register_ops(&netlbl_mgmt_gnl_family,
621 &netlbl_mgmt_genl_c_removedef);
622 if (ret_val != 0)
623 return ret_val;
624 ret_val = genl_register_ops(&netlbl_mgmt_gnl_family,
625 &netlbl_mgmt_genl_c_listdef);
626 if (ret_val != 0)
627 return ret_val;
628 ret_val = genl_register_ops(&netlbl_mgmt_gnl_family,
629 &netlbl_mgmt_genl_c_protocols);
630 if (ret_val != 0)
631 return ret_val;
632 ret_val = genl_register_ops(&netlbl_mgmt_gnl_family,
633 &netlbl_mgmt_genl_c_version);
634 if (ret_val != 0)
635 return ret_val;
636 605
637 return 0; 606 return 0;
638} 607}
diff --git a/net/netlabel/netlabel_unlabeled.c b/net/netlabel/netlabel_unlabeled.c
index 3e745b72fded..4478f2f6079d 100644
--- a/net/netlabel/netlabel_unlabeled.c
+++ b/net/netlabel/netlabel_unlabeled.c
@@ -1553,68 +1553,63 @@ unlabel_staticlistdef_return:
1553 * NetLabel Generic NETLINK Command Definitions 1553 * NetLabel Generic NETLINK Command Definitions
1554 */ 1554 */
1555 1555
1556static struct genl_ops netlbl_unlabel_genl_c_staticadd = { 1556static struct genl_ops netlbl_unlabel_genl_ops[] = {
1557 {
1557 .cmd = NLBL_UNLABEL_C_STATICADD, 1558 .cmd = NLBL_UNLABEL_C_STATICADD,
1558 .flags = GENL_ADMIN_PERM, 1559 .flags = GENL_ADMIN_PERM,
1559 .policy = netlbl_unlabel_genl_policy, 1560 .policy = netlbl_unlabel_genl_policy,
1560 .doit = netlbl_unlabel_staticadd, 1561 .doit = netlbl_unlabel_staticadd,
1561 .dumpit = NULL, 1562 .dumpit = NULL,
1562}; 1563 },
1563 1564 {
1564static struct genl_ops netlbl_unlabel_genl_c_staticremove = {
1565 .cmd = NLBL_UNLABEL_C_STATICREMOVE, 1565 .cmd = NLBL_UNLABEL_C_STATICREMOVE,
1566 .flags = GENL_ADMIN_PERM, 1566 .flags = GENL_ADMIN_PERM,
1567 .policy = netlbl_unlabel_genl_policy, 1567 .policy = netlbl_unlabel_genl_policy,
1568 .doit = netlbl_unlabel_staticremove, 1568 .doit = netlbl_unlabel_staticremove,
1569 .dumpit = NULL, 1569 .dumpit = NULL,
1570}; 1570 },
1571 1571 {
1572static struct genl_ops netlbl_unlabel_genl_c_staticlist = {
1573 .cmd = NLBL_UNLABEL_C_STATICLIST, 1572 .cmd = NLBL_UNLABEL_C_STATICLIST,
1574 .flags = 0, 1573 .flags = 0,
1575 .policy = netlbl_unlabel_genl_policy, 1574 .policy = netlbl_unlabel_genl_policy,
1576 .doit = NULL, 1575 .doit = NULL,
1577 .dumpit = netlbl_unlabel_staticlist, 1576 .dumpit = netlbl_unlabel_staticlist,
1578}; 1577 },
1579 1578 {
1580static struct genl_ops netlbl_unlabel_genl_c_staticadddef = {
1581 .cmd = NLBL_UNLABEL_C_STATICADDDEF, 1579 .cmd = NLBL_UNLABEL_C_STATICADDDEF,
1582 .flags = GENL_ADMIN_PERM, 1580 .flags = GENL_ADMIN_PERM,
1583 .policy = netlbl_unlabel_genl_policy, 1581 .policy = netlbl_unlabel_genl_policy,
1584 .doit = netlbl_unlabel_staticadddef, 1582 .doit = netlbl_unlabel_staticadddef,
1585 .dumpit = NULL, 1583 .dumpit = NULL,
1586}; 1584 },
1587 1585 {
1588static struct genl_ops netlbl_unlabel_genl_c_staticremovedef = {
1589 .cmd = NLBL_UNLABEL_C_STATICREMOVEDEF, 1586 .cmd = NLBL_UNLABEL_C_STATICREMOVEDEF,
1590 .flags = GENL_ADMIN_PERM, 1587 .flags = GENL_ADMIN_PERM,
1591 .policy = netlbl_unlabel_genl_policy, 1588 .policy = netlbl_unlabel_genl_policy,
1592 .doit = netlbl_unlabel_staticremovedef, 1589 .doit = netlbl_unlabel_staticremovedef,
1593 .dumpit = NULL, 1590 .dumpit = NULL,
1594}; 1591 },
1595 1592 {
1596static struct genl_ops netlbl_unlabel_genl_c_staticlistdef = {
1597 .cmd = NLBL_UNLABEL_C_STATICLISTDEF, 1593 .cmd = NLBL_UNLABEL_C_STATICLISTDEF,
1598 .flags = 0, 1594 .flags = 0,
1599 .policy = netlbl_unlabel_genl_policy, 1595 .policy = netlbl_unlabel_genl_policy,
1600 .doit = NULL, 1596 .doit = NULL,
1601 .dumpit = netlbl_unlabel_staticlistdef, 1597 .dumpit = netlbl_unlabel_staticlistdef,
1602}; 1598 },
1603 1599 {
1604static struct genl_ops netlbl_unlabel_genl_c_accept = {
1605 .cmd = NLBL_UNLABEL_C_ACCEPT, 1600 .cmd = NLBL_UNLABEL_C_ACCEPT,
1606 .flags = GENL_ADMIN_PERM, 1601 .flags = GENL_ADMIN_PERM,
1607 .policy = netlbl_unlabel_genl_policy, 1602 .policy = netlbl_unlabel_genl_policy,
1608 .doit = netlbl_unlabel_accept, 1603 .doit = netlbl_unlabel_accept,
1609 .dumpit = NULL, 1604 .dumpit = NULL,
1610}; 1605 },
1611 1606 {
1612static struct genl_ops netlbl_unlabel_genl_c_list = {
1613 .cmd = NLBL_UNLABEL_C_LIST, 1607 .cmd = NLBL_UNLABEL_C_LIST,
1614 .flags = 0, 1608 .flags = 0,
1615 .policy = netlbl_unlabel_genl_policy, 1609 .policy = netlbl_unlabel_genl_policy,
1616 .doit = netlbl_unlabel_list, 1610 .doit = netlbl_unlabel_list,
1617 .dumpit = NULL, 1611 .dumpit = NULL,
1612 },
1618}; 1613};
1619 1614
1620/* 1615/*
@@ -1629,53 +1624,20 @@ static struct genl_ops netlbl_unlabel_genl_c_list = {
1629 * mechanism. Returns zero on success, negative values on failure. 1624 * mechanism. Returns zero on success, negative values on failure.
1630 * 1625 *
1631 */ 1626 */
1632int netlbl_unlabel_genl_init(void) 1627int __init netlbl_unlabel_genl_init(void)
1633{ 1628{
1634 int ret_val; 1629 int ret_val, i;
1635 1630
1636 ret_val = genl_register_family(&netlbl_unlabel_gnl_family); 1631 ret_val = genl_register_family(&netlbl_unlabel_gnl_family);
1637 if (ret_val != 0) 1632 if (ret_val != 0)
1638 return ret_val; 1633 return ret_val;
1639 1634
1640 ret_val = genl_register_ops(&netlbl_unlabel_gnl_family, 1635 for (i = 0; i < ARRAY_SIZE(netlbl_unlabel_genl_ops); i++) {
1641 &netlbl_unlabel_genl_c_staticadd); 1636 ret_val = genl_register_ops(&netlbl_unlabel_gnl_family,
1642 if (ret_val != 0) 1637 &netlbl_unlabel_genl_ops[i]);
1643 return ret_val; 1638 if (ret_val != 0)
1644 1639 return ret_val;
1645 ret_val = genl_register_ops(&netlbl_unlabel_gnl_family, 1640 }
1646 &netlbl_unlabel_genl_c_staticremove);
1647 if (ret_val != 0)
1648 return ret_val;
1649
1650 ret_val = genl_register_ops(&netlbl_unlabel_gnl_family,
1651 &netlbl_unlabel_genl_c_staticlist);
1652 if (ret_val != 0)
1653 return ret_val;
1654
1655 ret_val = genl_register_ops(&netlbl_unlabel_gnl_family,
1656 &netlbl_unlabel_genl_c_staticadddef);
1657 if (ret_val != 0)
1658 return ret_val;
1659
1660 ret_val = genl_register_ops(&netlbl_unlabel_gnl_family,
1661 &netlbl_unlabel_genl_c_staticremovedef);
1662 if (ret_val != 0)
1663 return ret_val;
1664
1665 ret_val = genl_register_ops(&netlbl_unlabel_gnl_family,
1666 &netlbl_unlabel_genl_c_staticlistdef);
1667 if (ret_val != 0)
1668 return ret_val;
1669
1670 ret_val = genl_register_ops(&netlbl_unlabel_gnl_family,
1671 &netlbl_unlabel_genl_c_accept);
1672 if (ret_val != 0)
1673 return ret_val;
1674
1675 ret_val = genl_register_ops(&netlbl_unlabel_gnl_family,
1676 &netlbl_unlabel_genl_c_list);
1677 if (ret_val != 0)
1678 return ret_val;
1679 1641
1680 return 0; 1642 return 0;
1681} 1643}
@@ -1699,7 +1661,7 @@ static struct notifier_block netlbl_unlhsh_netdev_notifier = {
1699 * non-zero values on error. 1661 * non-zero values on error.
1700 * 1662 *
1701 */ 1663 */
1702int netlbl_unlabel_init(u32 size) 1664int __init netlbl_unlabel_init(u32 size)
1703{ 1665{
1704 u32 iter; 1666 u32 iter;
1705 struct netlbl_unlhsh_tbl *hsh_tbl; 1667 struct netlbl_unlhsh_tbl *hsh_tbl;
@@ -1803,7 +1765,7 @@ unlabel_getattr_nolabel:
1803 * and to send unlabeled network traffic by default. 1765 * and to send unlabeled network traffic by default.
1804 * 1766 *
1805 */ 1767 */
1806int netlbl_unlabel_defconf(void) 1768int __init netlbl_unlabel_defconf(void)
1807{ 1769{
1808 int ret_val; 1770 int ret_val;
1809 struct netlbl_dom_map *entry; 1771 struct netlbl_dom_map *entry;
diff --git a/net/netlabel/netlabel_user.c b/net/netlabel/netlabel_user.c
index 023fc8fe840d..b17d4203806e 100644
--- a/net/netlabel/netlabel_user.c
+++ b/net/netlabel/netlabel_user.c
@@ -59,7 +59,7 @@
59 * non-zero on failure. 59 * non-zero on failure.
60 * 60 *
61 */ 61 */
62int netlbl_netlink_init(void) 62int __init netlbl_netlink_init(void)
63{ 63{
64 int ret_val; 64 int ret_val;
65 65
diff --git a/net/rxrpc/ar-accept.c b/net/rxrpc/ar-accept.c
index 92a87fde8bfe..bdfb77417794 100644
--- a/net/rxrpc/ar-accept.c
+++ b/net/rxrpc/ar-accept.c
@@ -156,8 +156,7 @@ static int rxrpc_accept_incoming_call(struct rxrpc_local *local,
156 false); 156 false);
157 spin_unlock(&call->lock); 157 spin_unlock(&call->lock);
158 notification = NULL; 158 notification = NULL;
159 if (ret < 0) 159 BUG_ON(ret < 0);
160 BUG();
161 } 160 }
162 spin_unlock(&call->conn->state_lock); 161 spin_unlock(&call->conn->state_lock);
163 162
diff --git a/net/rxrpc/ar-ack.c b/net/rxrpc/ar-ack.c
index 657ee69f2133..3ac1672e1070 100644
--- a/net/rxrpc/ar-ack.c
+++ b/net/rxrpc/ar-ack.c
@@ -814,8 +814,7 @@ static int rxrpc_post_message(struct rxrpc_call *call, u32 mark, u32 error,
814 spin_lock_bh(&call->lock); 814 spin_lock_bh(&call->lock);
815 ret = rxrpc_queue_rcv_skb(call, skb, true, fatal); 815 ret = rxrpc_queue_rcv_skb(call, skb, true, fatal);
816 spin_unlock_bh(&call->lock); 816 spin_unlock_bh(&call->lock);
817 if (ret < 0) 817 BUG_ON(ret < 0);
818 BUG();
819 } 818 }
820 819
821 return 0; 820 return 0;
diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c
index 47219f98053f..9fc4c315f6cd 100644
--- a/net/xfrm/xfrm_policy.c
+++ b/net/xfrm/xfrm_policy.c
@@ -331,15 +331,31 @@ static void xfrm_dst_hash_transfer(struct hlist_head *list,
331 struct hlist_head *ndsttable, 331 struct hlist_head *ndsttable,
332 unsigned int nhashmask) 332 unsigned int nhashmask)
333{ 333{
334 struct hlist_node *entry, *tmp; 334 struct hlist_node *entry, *tmp, *entry0 = NULL;
335 struct xfrm_policy *pol; 335 struct xfrm_policy *pol;
336 unsigned int h0 = 0;
336 337
338redo:
337 hlist_for_each_entry_safe(pol, entry, tmp, list, bydst) { 339 hlist_for_each_entry_safe(pol, entry, tmp, list, bydst) {
338 unsigned int h; 340 unsigned int h;
339 341
340 h = __addr_hash(&pol->selector.daddr, &pol->selector.saddr, 342 h = __addr_hash(&pol->selector.daddr, &pol->selector.saddr,
341 pol->family, nhashmask); 343 pol->family, nhashmask);
342 hlist_add_head(&pol->bydst, ndsttable+h); 344 if (!entry0) {
345 hlist_del(entry);
346 hlist_add_head(&pol->bydst, ndsttable+h);
347 h0 = h;
348 } else {
349 if (h != h0)
350 continue;
351 hlist_del(entry);
352 hlist_add_after(entry0, &pol->bydst);
353 }
354 entry0 = entry;
355 }
356 if (!hlist_empty(list)) {
357 entry0 = NULL;
358 goto redo;
343 } 359 }
344} 360}
345 361
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index 61742771c65d..695b5d657cf5 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -1200,7 +1200,7 @@ static void report_sec_mismatch(const char *modname, enum mismatch mismatch,
1200 "annotate %s with a matching annotation.\n", 1200 "annotate %s with a matching annotation.\n",
1201 from, sec2annotation(fromsec), fromsym, from_p, 1201 from, sec2annotation(fromsec), fromsym, from_p,
1202 to, sec2annotation(tosec), tosym, to_p, 1202 to, sec2annotation(tosec), tosym, to_p,
1203 fromsym, tosym, fromsym); 1203 tosym, fromsym, tosym);
1204 break; 1204 break;
1205 case INIT_TO_EXIT: 1205 case INIT_TO_EXIT:
1206 fprintf(stderr, 1206 fprintf(stderr,
diff --git a/security/smack/smack_lsm.c b/security/smack/smack_lsm.c
index 2b5d6f72f678..25cbfa3f71f4 100644
--- a/security/smack/smack_lsm.c
+++ b/security/smack/smack_lsm.c
@@ -1251,9 +1251,8 @@ static void smack_to_secattr(char *smack, struct netlbl_lsm_secattr *nlsp)
1251 1251
1252 switch (smack_net_nltype) { 1252 switch (smack_net_nltype) {
1253 case NETLBL_NLTYPE_CIPSOV4: 1253 case NETLBL_NLTYPE_CIPSOV4:
1254 nlsp->domain = NULL; 1254 nlsp->domain = kstrdup(smack, GFP_ATOMIC);
1255 nlsp->flags = NETLBL_SECATTR_DOMAIN; 1255 nlsp->flags = NETLBL_SECATTR_DOMAIN | NETLBL_SECATTR_MLS_LVL;
1256 nlsp->flags |= NETLBL_SECATTR_MLS_LVL;
1257 1256
1258 rc = smack_to_cipso(smack, &cipso); 1257 rc = smack_to_cipso(smack, &cipso);
1259 if (rc == 0) { 1258 if (rc == 0) {
@@ -1282,15 +1281,14 @@ static int smack_netlabel(struct sock *sk)
1282{ 1281{
1283 struct socket_smack *ssp; 1282 struct socket_smack *ssp;
1284 struct netlbl_lsm_secattr secattr; 1283 struct netlbl_lsm_secattr secattr;
1285 int rc = 0; 1284 int rc;
1286 1285
1287 ssp = sk->sk_security; 1286 ssp = sk->sk_security;
1288 netlbl_secattr_init(&secattr); 1287 netlbl_secattr_init(&secattr);
1289 smack_to_secattr(ssp->smk_out, &secattr); 1288 smack_to_secattr(ssp->smk_out, &secattr);
1290 if (secattr.flags != NETLBL_SECATTR_NONE) 1289 rc = netlbl_sock_setattr(sk, &secattr);
1291 rc = netlbl_sock_setattr(sk, &secattr);
1292
1293 netlbl_secattr_destroy(&secattr); 1290 netlbl_secattr_destroy(&secattr);
1291
1294 return rc; 1292 return rc;
1295} 1293}
1296 1294
@@ -1313,6 +1311,7 @@ static int smack_inode_setsecurity(struct inode *inode, const char *name,
1313 struct inode_smack *nsp = inode->i_security; 1311 struct inode_smack *nsp = inode->i_security;
1314 struct socket_smack *ssp; 1312 struct socket_smack *ssp;
1315 struct socket *sock; 1313 struct socket *sock;
1314 int rc = 0;
1316 1315
1317 if (value == NULL || size > SMK_LABELLEN) 1316 if (value == NULL || size > SMK_LABELLEN)
1318 return -EACCES; 1317 return -EACCES;
@@ -1341,7 +1340,10 @@ static int smack_inode_setsecurity(struct inode *inode, const char *name,
1341 ssp->smk_in = sp; 1340 ssp->smk_in = sp;
1342 else if (strcmp(name, XATTR_SMACK_IPOUT) == 0) { 1341 else if (strcmp(name, XATTR_SMACK_IPOUT) == 0) {
1343 ssp->smk_out = sp; 1342 ssp->smk_out = sp;
1344 return smack_netlabel(sock->sk); 1343 rc = smack_netlabel(sock->sk);
1344 if (rc != 0)
1345 printk(KERN_WARNING "Smack: \"%s\" netlbl error %d.\n",
1346 __func__, -rc);
1345 } else 1347 } else
1346 return -EOPNOTSUPP; 1348 return -EOPNOTSUPP;
1347 1349
@@ -2214,6 +2216,9 @@ static void smack_sock_graft(struct sock *sk, struct socket *parent)
2214 ssp->smk_packet[0] = '\0'; 2216 ssp->smk_packet[0] = '\0';
2215 2217
2216 rc = smack_netlabel(sk); 2218 rc = smack_netlabel(sk);
2219 if (rc != 0)
2220 printk(KERN_WARNING "Smack: \"%s\" netlbl error %d.\n",
2221 __func__, -rc);
2217} 2222}
2218 2223
2219/** 2224/**
@@ -2346,6 +2351,20 @@ static int smack_secid_to_secctx(u32 secid, char **secdata, u32 *seclen)
2346} 2351}
2347 2352
2348/* 2353/*
2354 * smack_secctx_to_secid - return the secid for a smack label
2355 * @secdata: smack label
2356 * @seclen: how long result is
2357 * @secid: outgoing integer
2358 *
2359 * Exists for audit and networking code.
2360 */
2361static int smack_secctx_to_secid(char *secdata, u32 seclen, u32 *secid)
2362{
2363 *secid = smack_to_secid(secdata);
2364 return 0;
2365}
2366
2367/*
2349 * smack_release_secctx - don't do anything. 2368 * smack_release_secctx - don't do anything.
2350 * @key_ref: unused 2369 * @key_ref: unused
2351 * @context: unused 2370 * @context: unused
@@ -2475,6 +2494,7 @@ static struct security_operations smack_ops = {
2475 .key_permission = smack_key_permission, 2494 .key_permission = smack_key_permission,
2476#endif /* CONFIG_KEYS */ 2495#endif /* CONFIG_KEYS */
2477 .secid_to_secctx = smack_secid_to_secctx, 2496 .secid_to_secctx = smack_secid_to_secctx,
2497 .secctx_to_secid = smack_secctx_to_secid,
2478 .release_secctx = smack_release_secctx, 2498 .release_secctx = smack_release_secctx,
2479}; 2499};
2480 2500
diff --git a/security/smack/smackfs.c b/security/smack/smackfs.c
index 15aa37f65b39..358c92c1a153 100644
--- a/security/smack/smackfs.c
+++ b/security/smack/smackfs.c
@@ -24,6 +24,7 @@
24#include <net/cipso_ipv4.h> 24#include <net/cipso_ipv4.h>
25#include <linux/seq_file.h> 25#include <linux/seq_file.h>
26#include <linux/ctype.h> 26#include <linux/ctype.h>
27#include <linux/audit.h>
27#include "smack.h" 28#include "smack.h"
28 29
29/* 30/*
@@ -45,6 +46,7 @@ enum smk_inos {
45 */ 46 */
46static DEFINE_MUTEX(smack_list_lock); 47static DEFINE_MUTEX(smack_list_lock);
47static DEFINE_MUTEX(smack_cipso_lock); 48static DEFINE_MUTEX(smack_cipso_lock);
49static DEFINE_MUTEX(smack_ambient_lock);
48 50
49/* 51/*
50 * This is the "ambient" label for network traffic. 52 * This is the "ambient" label for network traffic.
@@ -342,6 +344,9 @@ void smk_cipso_doi(void)
342 struct cipso_v4_doi *doip; 344 struct cipso_v4_doi *doip;
343 struct netlbl_audit audit_info; 345 struct netlbl_audit audit_info;
344 346
347 audit_info.loginuid = audit_get_loginuid(current);
348 audit_info.secid = smack_to_secid(current->security);
349
345 rc = netlbl_cfg_map_del(NULL, &audit_info); 350 rc = netlbl_cfg_map_del(NULL, &audit_info);
346 if (rc != 0) 351 if (rc != 0)
347 printk(KERN_WARNING "%s:%d remove rc = %d\n", 352 printk(KERN_WARNING "%s:%d remove rc = %d\n",
@@ -363,6 +368,30 @@ void smk_cipso_doi(void)
363 __func__, __LINE__, rc); 368 __func__, __LINE__, rc);
364} 369}
365 370
371/**
372 * smk_unlbl_ambient - initialize the unlabeled domain
373 */
374void smk_unlbl_ambient(char *oldambient)
375{
376 int rc;
377 struct netlbl_audit audit_info;
378
379 audit_info.loginuid = audit_get_loginuid(current);
380 audit_info.secid = smack_to_secid(current->security);
381
382 if (oldambient != NULL) {
383 rc = netlbl_cfg_map_del(oldambient, &audit_info);
384 if (rc != 0)
385 printk(KERN_WARNING "%s:%d remove rc = %d\n",
386 __func__, __LINE__, rc);
387 }
388
389 rc = netlbl_cfg_unlbl_add_map(smack_net_ambient, &audit_info);
390 if (rc != 0)
391 printk(KERN_WARNING "%s:%d add rc = %d\n",
392 __func__, __LINE__, rc);
393}
394
366/* 395/*
367 * Seq_file read operations for /smack/cipso 396 * Seq_file read operations for /smack/cipso
368 */ 397 */
@@ -709,7 +738,6 @@ static ssize_t smk_read_ambient(struct file *filp, char __user *buf,
709 size_t cn, loff_t *ppos) 738 size_t cn, loff_t *ppos)
710{ 739{
711 ssize_t rc; 740 ssize_t rc;
712 char out[SMK_LABELLEN];
713 int asize; 741 int asize;
714 742
715 if (*ppos != 0) 743 if (*ppos != 0)
@@ -717,23 +745,18 @@ static ssize_t smk_read_ambient(struct file *filp, char __user *buf,
717 /* 745 /*
718 * Being careful to avoid a problem in the case where 746 * Being careful to avoid a problem in the case where
719 * smack_net_ambient gets changed in midstream. 747 * smack_net_ambient gets changed in midstream.
720 * Since smack_net_ambient is always set with a value
721 * from the label list, including initially, and those
722 * never get freed, the worst case is that the pointer
723 * gets changed just after this strncpy, in which case
724 * the value passed up is incorrect. Locking around
725 * smack_net_ambient wouldn't be any better than this
726 * copy scheme as by the time the caller got to look
727 * at the ambient value it would have cleared the lock
728 * and been changed.
729 */ 748 */
730 strncpy(out, smack_net_ambient, SMK_LABELLEN); 749 mutex_lock(&smack_ambient_lock);
731 asize = strlen(out) + 1;
732 750
733 if (cn < asize) 751 asize = strlen(smack_net_ambient) + 1;
734 return -EINVAL; 752
753 if (cn >= asize)
754 rc = simple_read_from_buffer(buf, cn, ppos,
755 smack_net_ambient, asize);
756 else
757 rc = -EINVAL;
735 758
736 rc = simple_read_from_buffer(buf, cn, ppos, out, asize); 759 mutex_unlock(&smack_ambient_lock);
737 760
738 return rc; 761 return rc;
739} 762}
@@ -751,6 +774,7 @@ static ssize_t smk_write_ambient(struct file *file, const char __user *buf,
751 size_t count, loff_t *ppos) 774 size_t count, loff_t *ppos)
752{ 775{
753 char in[SMK_LABELLEN]; 776 char in[SMK_LABELLEN];
777 char *oldambient;
754 char *smack; 778 char *smack;
755 779
756 if (!capable(CAP_MAC_ADMIN)) 780 if (!capable(CAP_MAC_ADMIN))
@@ -766,7 +790,13 @@ static ssize_t smk_write_ambient(struct file *file, const char __user *buf,
766 if (smack == NULL) 790 if (smack == NULL)
767 return -EINVAL; 791 return -EINVAL;
768 792
793 mutex_lock(&smack_ambient_lock);
794
795 oldambient = smack_net_ambient;
769 smack_net_ambient = smack; 796 smack_net_ambient = smack;
797 smk_unlbl_ambient(oldambient);
798
799 mutex_unlock(&smack_ambient_lock);
770 800
771 return count; 801 return count;
772} 802}
@@ -974,6 +1004,7 @@ static int __init init_smk_fs(void)
974 1004
975 sema_init(&smack_write_sem, 1); 1005 sema_init(&smack_write_sem, 1);
976 smk_cipso_doi(); 1006 smk_cipso_doi();
1007 smk_unlbl_ambient(NULL);
977 1008
978 return err; 1009 return err;
979} 1010}